surreal-memory 2.2.0__tar.gz → 2.3.0__tar.gz

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 (387) hide show
  1. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/PKG-INFO +2 -2
  2. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/README.md +1 -1
  3. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/pyproject.toml +1 -1
  4. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/__init__.py +1 -1
  5. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/server/routes/dashboard_api.py +21 -19
  6. surreal_memory-2.2.0/src/surreal_memory/server/static/dist/assets/DiagramsPage-DxGbFDqh.js → surreal_memory-2.3.0/src/surreal_memory/server/static/dist/assets/DiagramsPage-DxR1C_Ua.js +1 -1
  7. surreal_memory-2.2.0/src/surreal_memory/server/static/dist/assets/EvolutionPage-BCt3Gjlg.js → surreal_memory-2.3.0/src/surreal_memory/server/static/dist/assets/EvolutionPage-By828lS5.js +1 -1
  8. surreal_memory-2.2.0/src/surreal_memory/server/static/dist/assets/GraphPage-Bn2XnYSM.js → surreal_memory-2.3.0/src/surreal_memory/server/static/dist/assets/GraphPage-DwQB1_DY.js +1 -1
  9. surreal_memory-2.2.0/src/surreal_memory/server/static/dist/assets/HealthPage-BOvDCRq_.js → surreal_memory-2.3.0/src/surreal_memory/server/static/dist/assets/HealthPage-DetJg-Qr.js +1 -1
  10. surreal_memory-2.2.0/src/surreal_memory/server/static/dist/assets/OraclePage-Cx309IS8.js → surreal_memory-2.3.0/src/surreal_memory/server/static/dist/assets/OraclePage-7FBeVFXa.js +1 -1
  11. surreal_memory-2.3.0/src/surreal_memory/server/static/dist/assets/OverviewPage-xe8kFqX3.js +1 -0
  12. surreal_memory-2.3.0/src/surreal_memory/server/static/dist/assets/ProGate-CwBF4etn.js +1 -0
  13. surreal_memory-2.2.0/src/surreal_memory/server/static/dist/assets/SettingsPage-Co7mL5ao.js → surreal_memory-2.3.0/src/surreal_memory/server/static/dist/assets/SettingsPage-CH2mIMiD.js +1 -1
  14. surreal_memory-2.3.0/src/surreal_memory/server/static/dist/assets/StoragePage-CLDPXEH8.js +1 -0
  15. surreal_memory-2.3.0/src/surreal_memory/server/static/dist/assets/SyncPage-MbtH1dwD.js +1 -0
  16. surreal_memory-2.2.0/src/surreal_memory/server/static/dist/assets/TimelinePage-D7a4yM0C.js → surreal_memory-2.3.0/src/surreal_memory/server/static/dist/assets/TimelinePage-BIybkdH4.js +1 -1
  17. surreal_memory-2.2.0/src/surreal_memory/server/static/dist/assets/ToolStatsPage-DSbdcAxV.js → surreal_memory-2.3.0/src/surreal_memory/server/static/dist/assets/ToolStatsPage-BA-DvxES.js +1 -1
  18. surreal_memory-2.2.0/src/surreal_memory/server/static/dist/assets/VisualizePage-CQRwt661.js → surreal_memory-2.3.0/src/surreal_memory/server/static/dist/assets/VisualizePage-B_IPrBGU.js +1 -1
  19. surreal_memory-2.2.0/src/surreal_memory/server/static/dist/assets/card-DMi3iNIj.js → surreal_memory-2.3.0/src/surreal_memory/server/static/dist/assets/card-B0vNsxr_.js +1 -1
  20. surreal_memory-2.3.0/src/surreal_memory/server/static/dist/assets/index-BFkJgtCN.css +1 -0
  21. surreal_memory-2.3.0/src/surreal_memory/server/static/dist/assets/index-C26pxqlr.js +54 -0
  22. surreal_memory-2.3.0/src/surreal_memory/server/static/dist/assets/skeleton-DQJ-n00q.js +1 -0
  23. surreal_memory-2.3.0/src/surreal_memory/server/static/dist/assets/vendor-icons-BYlYobEK.js +1 -0
  24. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/server/static/dist/index.html +3 -3
  25. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/surrealdb/schema.py +20 -1
  26. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/surrealdb/store.py +20 -2
  27. surreal_memory-2.3.0/src/surreal_memory/storage/surrealdb/tool_events.py +235 -0
  28. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/unified_config.py +38 -15
  29. surreal_memory-2.2.0/src/surreal_memory/server/static/dist/assets/OverviewPage-C9zanzbn.js +0 -1
  30. surreal_memory-2.2.0/src/surreal_memory/server/static/dist/assets/ProGate-CWdLKxhy.js +0 -1
  31. surreal_memory-2.2.0/src/surreal_memory/server/static/dist/assets/StoragePage-ChOPs2Io.js +0 -1
  32. surreal_memory-2.2.0/src/surreal_memory/server/static/dist/assets/SyncPage-XHo3B9mj.js +0 -1
  33. surreal_memory-2.2.0/src/surreal_memory/server/static/dist/assets/index-C4hAA6lf.css +0 -1
  34. surreal_memory-2.2.0/src/surreal_memory/server/static/dist/assets/index-eqEVe4jF.js +0 -54
  35. surreal_memory-2.2.0/src/surreal_memory/server/static/dist/assets/skeleton-CMgwRZUe.js +0 -1
  36. surreal_memory-2.2.0/src/surreal_memory/server/static/dist/assets/vendor-icons-ILWTDAJI.js +0 -1
  37. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/.gitignore +0 -0
  38. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/LICENSE +0 -0
  39. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/NOTICE +0 -0
  40. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/cli/__init__.py +0 -0
  41. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/cli/__main__.py +0 -0
  42. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/cli/_helpers.py +0 -0
  43. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/cli/commands/__init__.py +0 -0
  44. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/cli/commands/brain.py +0 -0
  45. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/cli/commands/codebase.py +0 -0
  46. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/cli/commands/config_cmd.py +0 -0
  47. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/cli/commands/habits.py +0 -0
  48. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/cli/commands/info.py +0 -0
  49. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/cli/commands/listing.py +0 -0
  50. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/cli/commands/memory.py +0 -0
  51. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/cli/commands/project.py +0 -0
  52. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/cli/commands/reindex.py +0 -0
  53. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/cli/commands/shared.py +0 -0
  54. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/cli/commands/shortcuts.py +0 -0
  55. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/cli/commands/storage.py +0 -0
  56. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/cli/commands/telegram.py +0 -0
  57. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/cli/commands/tools.py +0 -0
  58. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/cli/commands/train.py +0 -0
  59. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/cli/commands/update.py +0 -0
  60. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/cli/commands/version.py +0 -0
  61. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/cli/commands/watch.py +0 -0
  62. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/cli/config.py +0 -0
  63. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/cli/doctor.py +0 -0
  64. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/cli/embedding_setup.py +0 -0
  65. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/cli/full_setup.py +0 -0
  66. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/cli/graph_export.py +0 -0
  67. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/cli/ide_rules.py +0 -0
  68. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/cli/main.py +0 -0
  69. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/cli/markdown_export.py +0 -0
  70. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/cli/setup.py +0 -0
  71. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/cli/storage.py +0 -0
  72. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/cli/tui.py +0 -0
  73. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/cli/update_check.py +0 -0
  74. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/cli/wizard.py +0 -0
  75. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/config_presets.py +0 -0
  76. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/core/__init__.py +0 -0
  77. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/core/action_event.py +0 -0
  78. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/core/alert.py +0 -0
  79. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/core/brain.py +0 -0
  80. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/core/brain_mode.py +0 -0
  81. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/core/eternal_context.py +0 -0
  82. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/core/fiber.py +0 -0
  83. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/core/memory_types.py +0 -0
  84. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/core/neuron.py +0 -0
  85. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/core/project.py +0 -0
  86. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/core/review_schedule.py +0 -0
  87. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/core/source.py +0 -0
  88. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/core/synapse.py +0 -0
  89. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/core/trigger_engine.py +0 -0
  90. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/__init__.py +0 -0
  91. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/activation.py +0 -0
  92. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/arousal.py +0 -0
  93. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/associative_inference.py +0 -0
  94. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/brain_evolution.py +0 -0
  95. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/brain_transplant.py +0 -0
  96. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/brain_versioning.py +0 -0
  97. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/causal_traversal.py +0 -0
  98. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/chart_generator.py +0 -0
  99. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/chunking.py +0 -0
  100. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/citation.py +0 -0
  101. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/clustering.py +0 -0
  102. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/codebase_encoder.py +0 -0
  103. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/cognitive.py +0 -0
  104. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/compression.py +0 -0
  105. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/conflict_auto_resolve.py +0 -0
  106. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/conflict_detection.py +0 -0
  107. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/connection_explainer.py +0 -0
  108. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/consolidation.py +0 -0
  109. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/consolidation_delta.py +0 -0
  110. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/context_merger.py +0 -0
  111. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/context_optimizer.py +0 -0
  112. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/context_retrieval.py +0 -0
  113. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/cross_brain.py +0 -0
  114. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/db_introspector.py +0 -0
  115. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/db_knowledge.py +0 -0
  116. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/db_trainer.py +0 -0
  117. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/decision_intel.py +0 -0
  118. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/dedup/__init__.py +0 -0
  119. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/dedup/config.py +0 -0
  120. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/dedup/llm_judge.py +0 -0
  121. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/dedup/pipeline.py +0 -0
  122. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/dedup/prompts.py +0 -0
  123. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/depth_prior.py +0 -0
  124. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/diagnostics.py +0 -0
  125. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/doc_chunker.py +0 -0
  126. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/doc_extractor.py +0 -0
  127. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/doc_trainer.py +0 -0
  128. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/dream.py +0 -0
  129. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/drift_detection.py +0 -0
  130. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/embedding/__init__.py +0 -0
  131. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/embedding/capability.py +0 -0
  132. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/embedding/config.py +0 -0
  133. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/embedding/gemini_embedding.py +0 -0
  134. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/embedding/ollama_embedding.py +0 -0
  135. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/embedding/openai_embedding.py +0 -0
  136. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/embedding/openrouter_embedding.py +0 -0
  137. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/embedding/provider.py +0 -0
  138. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/embedding/retry.py +0 -0
  139. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/embedding/sentence_transformer.py +0 -0
  140. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/encoder.py +0 -0
  141. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/enrichment.py +0 -0
  142. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/fidelity.py +0 -0
  143. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/file_watcher.py +0 -0
  144. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/fuzzy_match.py +0 -0
  145. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/fuzzy_query.py +0 -0
  146. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/gromov.py +0 -0
  147. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/hippocampal_replay.py +0 -0
  148. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/hooks.py +0 -0
  149. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/idf_anchor.py +0 -0
  150. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/importance.py +0 -0
  151. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/interference.py +0 -0
  152. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/koopman.py +0 -0
  153. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/learning_rule.py +0 -0
  154. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/lifecycle.py +0 -0
  155. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/memory_stages.py +0 -0
  156. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/merge.py +0 -0
  157. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/narrative.py +0 -0
  158. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/pattern_extraction.py +0 -0
  159. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/pipeline.py +0 -0
  160. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/pipeline_steps.py +0 -0
  161. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/ppr_activation.py +0 -0
  162. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/prediction_error.py +0 -0
  163. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/priming.py +0 -0
  164. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/quality_scorer.py +0 -0
  165. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/query_expander.py +0 -0
  166. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/query_expansion.py +0 -0
  167. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/query_pattern_mining.py +0 -0
  168. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/reconsolidation.py +0 -0
  169. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/reconstruction.py +0 -0
  170. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/reflection.py +0 -0
  171. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/reflex_activation.py +0 -0
  172. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/reranker.py +0 -0
  173. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/retrieval.py +0 -0
  174. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/retrieval_context.py +0 -0
  175. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/retrieval_types.py +0 -0
  176. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/schema_assimilation.py +0 -0
  177. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/score_fusion.py +0 -0
  178. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/semantic_discovery.py +0 -0
  179. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/sequence_mining.py +0 -0
  180. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/session_state.py +0 -0
  181. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/spaced_repetition.py +0 -0
  182. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/stabilization.py +0 -0
  183. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/sufficiency.py +0 -0
  184. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/temporal_binding.py +0 -0
  185. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/tier_engine.py +0 -0
  186. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/token_budget.py +0 -0
  187. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/token_normalizer.py +0 -0
  188. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/tool_memory.py +0 -0
  189. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/topology_analysis.py +0 -0
  190. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/watch_state.py +0 -0
  191. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/workflow_suggest.py +0 -0
  192. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/engine/write_queue.py +0 -0
  193. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/extraction/__init__.py +0 -0
  194. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/extraction/codebase.py +0 -0
  195. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/extraction/entities.py +0 -0
  196. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/extraction/keywords.py +0 -0
  197. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/extraction/llm_provider.py +0 -0
  198. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/extraction/parser.py +0 -0
  199. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/extraction/relations.py +0 -0
  200. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/extraction/router.py +0 -0
  201. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/extraction/sentiment.py +0 -0
  202. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/extraction/structure_detector.py +0 -0
  203. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/extraction/temporal.py +0 -0
  204. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/git_context.py +0 -0
  205. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/hooks/__init__.py +0 -0
  206. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/hooks/post_tool_use.py +0 -0
  207. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/hooks/pre_compact.py +0 -0
  208. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/hooks/project_context.py +0 -0
  209. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/hooks/session_start.py +0 -0
  210. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/hooks/stop.py +0 -0
  211. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/hooks/task_context.py +0 -0
  212. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/integration/__init__.py +0 -0
  213. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/integration/adapter.py +0 -0
  214. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/integration/adapters/__init__.py +0 -0
  215. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/integration/adapters/awf_adapter.py +0 -0
  216. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/integration/adapters/chromadb_adapter.py +0 -0
  217. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/integration/adapters/cognee_adapter.py +0 -0
  218. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/integration/adapters/graphiti_adapter.py +0 -0
  219. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/integration/adapters/llamaindex_adapter.py +0 -0
  220. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/integration/adapters/mem0_adapter.py +0 -0
  221. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/integration/mapper.py +0 -0
  222. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/integration/models.py +0 -0
  223. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/integration/sync_engine.py +0 -0
  224. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/integration/telegram.py +0 -0
  225. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/integrations/__init__.py +0 -0
  226. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/integrations/nanobot/__init__.py +0 -0
  227. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/integrations/nanobot/base_tool.py +0 -0
  228. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/integrations/nanobot/context.py +0 -0
  229. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/integrations/nanobot/memory_store.py +0 -0
  230. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/integrations/nanobot/protocol.py +0 -0
  231. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/integrations/nanobot/setup.py +0 -0
  232. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/integrations/nanobot/tools.py +0 -0
  233. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/integrations/openclaw_config.py +0 -0
  234. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/mcp/__init__.py +0 -0
  235. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/mcp/__main__.py +0 -0
  236. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/mcp/alert_handler.py +0 -0
  237. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/mcp/auto_capture.py +0 -0
  238. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/mcp/auto_handler.py +0 -0
  239. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/mcp/budget_handler.py +0 -0
  240. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/mcp/cognitive_handler.py +0 -0
  241. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/mcp/conflict_handler.py +0 -0
  242. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/mcp/connection_handler.py +0 -0
  243. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/mcp/constants.py +0 -0
  244. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/mcp/db_train_handler.py +0 -0
  245. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/mcp/drift_handler.py +0 -0
  246. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/mcp/eternal_handler.py +0 -0
  247. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/mcp/evolution_handler.py +0 -0
  248. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/mcp/expiry_cleanup_handler.py +0 -0
  249. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/mcp/http_transport.py +0 -0
  250. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/mcp/index_handler.py +0 -0
  251. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/mcp/instruction_handler.py +0 -0
  252. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/mcp/lifecycle_handler.py +0 -0
  253. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/mcp/maintenance_handler.py +0 -0
  254. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/mcp/mem0_sync_handler.py +0 -0
  255. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/mcp/narrative_handler.py +0 -0
  256. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/mcp/onboarding_handler.py +0 -0
  257. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/mcp/prompt.py +0 -0
  258. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/mcp/provenance_handler.py +0 -0
  259. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/mcp/recall_handler.py +0 -0
  260. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/mcp/remember_handler.py +0 -0
  261. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/mcp/response_compactor.py +0 -0
  262. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/mcp/review_handler.py +0 -0
  263. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/mcp/scheduled_consolidation_handler.py +0 -0
  264. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/mcp/server.py +0 -0
  265. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/mcp/session_handler.py +0 -0
  266. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/mcp/stats_handler.py +0 -0
  267. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/mcp/surface_handler.py +0 -0
  268. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/mcp/sync_handler.py +0 -0
  269. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/mcp/telegram_handler.py +0 -0
  270. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/mcp/tier_handler.py +0 -0
  271. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/mcp/tool_handler_utils.py +0 -0
  272. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/mcp/tool_handlers.py +0 -0
  273. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/mcp/tool_schemas.py +0 -0
  274. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/mcp/train_handler.py +0 -0
  275. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/mcp/version_check_handler.py +0 -0
  276. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/mcp/visualize_handler.py +0 -0
  277. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/mcp/watch_handler.py +0 -0
  278. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/plugins/__init__.py +0 -0
  279. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/plugins/base.py +0 -0
  280. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/plugins/community.py +0 -0
  281. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/py.typed +0 -0
  282. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/safety/__init__.py +0 -0
  283. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/safety/encryption.py +0 -0
  284. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/safety/freshness.py +0 -0
  285. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/safety/input_firewall.py +0 -0
  286. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/safety/sensitive.py +0 -0
  287. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/server/__init__.py +0 -0
  288. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/server/app.py +0 -0
  289. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/server/dependencies.py +0 -0
  290. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/server/models.py +0 -0
  291. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/server/routes/__init__.py +0 -0
  292. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/server/routes/brain.py +0 -0
  293. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/server/routes/consolidation.py +0 -0
  294. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/server/routes/hub.py +0 -0
  295. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/server/routes/integration_status.py +0 -0
  296. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/server/routes/memory.py +0 -0
  297. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/server/routes/oauth.py +0 -0
  298. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/server/routes/openclaw_api.py +0 -0
  299. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/server/routes/sync.py +0 -0
  300. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/server/static/dist/assets/DiagramsPage-BZV40eAE.css +0 -0
  301. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/server/static/dist/assets/embed-gLOWnRXV.js +0 -0
  302. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/server/static/dist/assets/timer-DWAvo6M8.js +0 -0
  303. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/server/static/dist/assets/vendor-motion-Ct_HHbYW.js +0 -0
  304. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/server/static/dist/assets/vendor-query-CqA1cBNl.js +0 -0
  305. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/server/static/dist/assets/vendor-react-BfuodpLv.js +0 -0
  306. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/server/static/dist/assets/vendor-recharts-BkwZfCWA.js +0 -0
  307. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/server/static/dist/assets/vendor-ui-Qm4_4bAc.js +0 -0
  308. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/skills/__init__.py +0 -0
  309. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/skills/memory-audit/SKILL.md +0 -0
  310. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/skills/memory-evolution/SKILL.md +0 -0
  311. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/skills/memory-intake/SKILL.md +0 -0
  312. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/__init__.py +0 -0
  313. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/base.py +0 -0
  314. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/factory.py +0 -0
  315. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/memory_brain_ops.py +0 -0
  316. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/memory_collections.py +0 -0
  317. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/memory_reviews.py +0 -0
  318. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/memory_store.py +0 -0
  319. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/neuron_cache.py +0 -0
  320. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/read_pool.py +0 -0
  321. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/shared_store.py +0 -0
  322. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/shared_store_collections.py +0 -0
  323. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/shared_store_mappers.py +0 -0
  324. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/sqlite_action_log.py +0 -0
  325. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/sqlite_alerts.py +0 -0
  326. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/sqlite_brain_ops.py +0 -0
  327. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/sqlite_calibration.py +0 -0
  328. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/sqlite_change_log.py +0 -0
  329. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/sqlite_coactivation.py +0 -0
  330. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/sqlite_cognitive.py +0 -0
  331. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/sqlite_compression.py +0 -0
  332. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/sqlite_depth_priors.py +0 -0
  333. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/sqlite_devices.py +0 -0
  334. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/sqlite_drift.py +0 -0
  335. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/sqlite_entity_refs.py +0 -0
  336. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/sqlite_fibers.py +0 -0
  337. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/sqlite_maturation.py +0 -0
  338. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/sqlite_merkle.py +0 -0
  339. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/sqlite_neurons.py +0 -0
  340. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/sqlite_projects.py +0 -0
  341. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/sqlite_reviews.py +0 -0
  342. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/sqlite_row_mappers.py +0 -0
  343. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/sqlite_schema.py +0 -0
  344. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/sqlite_sessions.py +0 -0
  345. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/sqlite_sources.py +0 -0
  346. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/sqlite_store.py +0 -0
  347. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/sqlite_synapses.py +0 -0
  348. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/sqlite_sync_state.py +0 -0
  349. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/sqlite_tool_events.py +0 -0
  350. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/sqlite_training_files.py +0 -0
  351. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/sqlite_typed.py +0 -0
  352. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/sqlite_versioning.py +0 -0
  353. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/surrealdb/__init__.py +0 -0
  354. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/surrealdb/activity.py +0 -0
  355. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/surrealdb/alerts.py +0 -0
  356. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/surrealdb/cognitive.py +0 -0
  357. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/surrealdb/compression.py +0 -0
  358. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/surrealdb/depth_priors.py +0 -0
  359. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/surrealdb/keyword_entity.py +0 -0
  360. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/surrealdb/projects.py +0 -0
  361. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/surrealdb/review_schedules.py +0 -0
  362. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/surrealdb/sources.py +0 -0
  363. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/surrealdb/typed_memory.py +0 -0
  364. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/storage/surrealdb/versions.py +0 -0
  365. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/surface/__init__.py +0 -0
  366. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/surface/generator.py +0 -0
  367. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/surface/lifecycle.py +0 -0
  368. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/surface/models.py +0 -0
  369. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/surface/parser.py +0 -0
  370. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/surface/resolver.py +0 -0
  371. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/surface/serializer.py +0 -0
  372. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/surface/token_budget.py +0 -0
  373. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/sync/__init__.py +0 -0
  374. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/sync/client.py +0 -0
  375. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/sync/device.py +0 -0
  376. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/sync/incremental_merge.py +0 -0
  377. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/sync/merkle.py +0 -0
  378. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/sync/protocol.py +0 -0
  379. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/sync/sync_engine.py +0 -0
  380. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/utils/__init__.py +0 -0
  381. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/utils/config.py +0 -0
  382. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/utils/consolidation_lock.py +0 -0
  383. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/utils/sandbox.py +0 -0
  384. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/utils/simhash.py +0 -0
  385. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/utils/ssl_helper.py +0 -0
  386. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/utils/tag_normalizer.py +0 -0
  387. {surreal_memory-2.2.0 → surreal_memory-2.3.0}/src/surreal_memory/utils/timeutils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: surreal-memory
3
- Version: 2.2.0
3
+ Version: 2.3.0
4
4
  Summary: Reflex-based memory system for AI agents with SurrealDB backend — retrieval through activation, not search
5
5
  Project-URL: Homepage, https://github.com/acidkill/surreal-memory
6
6
  Project-URL: Documentation, https://github.com/acidkill/surreal-memory/blob/main/docs/getting-started/quickstart.md
@@ -315,7 +315,7 @@ Sync uses **Merkle delta** — only diffs travel, not the full brain.
315
315
  - **Brain versioning** — snapshot, rollback, diff, transplant memories between brains
316
316
 
317
317
  #### Ecosystem
318
- - **Web dashboard** — 7-page React UI with graph visualization, health radar, timeline
318
+ - **Web dashboard** — multi-page React UI at `/ui` (overview, health radar, graph, timeline, evolution, storage, tool-stats, visualize, settings) — every page free, no Pro gate
319
319
  - **VS Code extension** — memory tree, graph explorer, CodeLens, WebSocket sync
320
320
  - **Safety** — Fernet encryption, sensitive content auto-detection, input firewall
321
321
  - **Plugin system** — extend with custom retrieval strategies, compression, and storage backends
@@ -204,7 +204,7 @@ Sync uses **Merkle delta** — only diffs travel, not the full brain.
204
204
  - **Brain versioning** — snapshot, rollback, diff, transplant memories between brains
205
205
 
206
206
  #### Ecosystem
207
- - **Web dashboard** — 7-page React UI with graph visualization, health radar, timeline
207
+ - **Web dashboard** — multi-page React UI at `/ui` (overview, health radar, graph, timeline, evolution, storage, tool-stats, visualize, settings) — every page free, no Pro gate
208
208
  - **VS Code extension** — memory tree, graph explorer, CodeLens, WebSocket sync
209
209
  - **Safety** — Fernet encryption, sensitive content auto-detection, input firewall
210
210
  - **Plugin system** — extend with custom retrieval strategies, compression, and storage backends
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "surreal-memory"
7
- version = "2.2.0"
7
+ version = "2.3.0"
8
8
  description = "Reflex-based memory system for AI agents with SurrealDB backend — retrieval through activation, not search"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -16,7 +16,7 @@ from surreal_memory.engine.encoder import EncodingResult, MemoryEncoder
16
16
  from surreal_memory.engine.reflex_activation import CoActivation, ReflexActivation
17
17
  from surreal_memory.engine.retrieval import DepthLevel, ReflexPipeline, RetrievalResult
18
18
 
19
- __version__ = "2.2.0"
19
+ __version__ = "2.3.0"
20
20
 
21
21
  __all__ = [
22
22
  "__version__",
@@ -81,10 +81,14 @@ class SwitchBrainRequest(BaseModel):
81
81
  )
82
82
  async def get_stats() -> DashboardStats:
83
83
  """Get overall dashboard statistics across all brains."""
84
- from surreal_memory.unified_config import get_config, get_shared_storage
84
+ from surreal_memory.unified_config import (
85
+ get_config,
86
+ get_shared_storage,
87
+ list_available_brains,
88
+ )
85
89
 
86
90
  cfg = get_config()
87
- brain_names = cfg.list_brains()
91
+ brain_names = await list_available_brains()
88
92
  active_name = cfg.current_brain
89
93
 
90
94
  async def _analyze_brain(name: str) -> BrainSummary:
@@ -119,7 +123,11 @@ async def get_stats() -> DashboardStats:
119
123
  is_active=name == active_name,
120
124
  )
121
125
  except Exception:
122
- logger.debug("Brain analysis failed for %s", name, exc_info=True)
126
+ # Surface at WARNING (not debug): swallowing this silently made the
127
+ # active brain report 0/F even when the store held data, masking a
128
+ # storage/config misconfiguration. Keep returning a placeholder so
129
+ # one bad brain does not break the whole dashboard.
130
+ logger.warning("Brain analysis failed for %s", name, exc_info=True)
123
131
  return BrainSummary(id=name, name=name, is_active=name == active_name)
124
132
 
125
133
  brains = list(await asyncio.gather(*[_analyze_brain(name) for name in brain_names]))
@@ -185,10 +193,14 @@ async def get_tier_stats(
185
193
  )
186
194
  async def list_brains_api() -> list[BrainSummary]:
187
195
  """List all available brains with summary stats."""
188
- from surreal_memory.unified_config import get_config, get_shared_storage
196
+ from surreal_memory.unified_config import (
197
+ get_config,
198
+ get_shared_storage,
199
+ list_available_brains,
200
+ )
189
201
 
190
202
  cfg = get_config()
191
- brain_names = cfg.list_brains()
203
+ brain_names = await list_available_brains()
192
204
  active_name = cfg.current_brain
193
205
  results: list[BrainSummary] = []
194
206
 
@@ -998,11 +1010,6 @@ async def update_config(body: ConfigUpdateRequest) -> dict[str, Any]:
998
1010
  new_embedding = config.embedding
999
1011
 
1000
1012
  if body.embedding is not None:
1001
- if not config.is_pro():
1002
- raise HTTPException(
1003
- status_code=403,
1004
- detail="Embedding configuration requires a Pro license. Activate via smem_sync_config(action='activate').",
1005
- )
1006
1013
  update = body.embedding
1007
1014
 
1008
1015
  if update.enabled is not None:
@@ -1487,21 +1494,16 @@ async def visualize_memory(
1487
1494
 
1488
1495
  @router.get("/license", tags=["dashboard"], summary="Current license tier")
1489
1496
  async def get_license() -> dict[str, Any]:
1490
- """Return the current license tier and expiry."""
1497
+ """Surreal-Memory is fully free: always report a FULL, unlocked license."""
1491
1498
  from surreal_memory.unified_config import get_config
1492
1499
 
1493
1500
  cfg = get_config(reload=True)
1494
- result: dict[str, Any] = {
1495
- "tier": cfg.license.tier,
1496
- "is_pro": cfg.is_pro(),
1501
+ return {
1502
+ "tier": "full",
1503
+ "is_pro": True,
1497
1504
  "activated_at": cfg.license.activated_at,
1498
1505
  "expires_at": cfg.license.expires_at,
1499
1506
  }
1500
- if not cfg.is_pro():
1501
- from surreal_memory.mcp.sync_handler import PRO_LANDING_URL
1502
-
1503
- result["upgrade_url"] = PRO_LANDING_URL
1504
- return result
1505
1507
 
1506
1508
 
1507
1509
  class ActivateLicenseRequest(BaseModel):
@@ -1,4 +1,4 @@
1
- import{j as R}from"./vendor-query-CqA1cBNl.js";import{d as hs,r as Z,b as gs}from"./vendor-react-BfuodpLv.js";import{l as ps,m as ms,u as ys,b as xs}from"./index-eqEVe4jF.js";import{C as Ht,a as Dn,b as Ln,c as Vt}from"./card-DMi3iNIj.js";import{S as jn}from"./skeleton-CMgwRZUe.js";import{d as cn,T as ws,t as vs,n as bs}from"./timer-DWAvo6M8.js";import{i as Es,h as $n,j as zn,k as _s,l as Ns,m as Ss,n as yt,o as Bt,u as Cs}from"./vendor-recharts-BkwZfCWA.js";import"./vendor-icons-ILWTDAJI.js";import"./vendor-ui-Qm4_4bAc.js";function ae(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,o;n<e.length;n++)(o=ae(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Ut="http://www.w3.org/1999/xhtml";const Rn={svg:"http://www.w3.org/2000/svg",xhtml:Ut,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Mt(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Rn.hasOwnProperty(t)?{space:Rn[t],local:e}:e}function ks(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Ut&&t.documentElement.namespaceURI===Ut?t.createElement(e):t.createElementNS(n,e)}}function Ms(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function To(e){var t=Mt(e);return(t.local?Ms:ks)(t)}function Is(){}function ln(e){return e==null?Is:function(){return this.querySelector(e)}}function Os(e){typeof e!="function"&&(e=ln(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,c=o[r]=new Array(s),a,l,u=0;u<s;++u)(a=i[u])&&(l=e.call(a,a.__data__,u,i))&&("__data__"in a&&(l.__data__=a.__data__),c[u]=l);return new ue(o,this._parents)}function Ts(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Ps(){return[]}function Po(e){return e==null?Ps:function(){return this.querySelectorAll(e)}}function As(e){return function(){return Ts(e.apply(this,arguments))}}function Ds(e){typeof e=="function"?e=As(e):e=Po(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var s=t[i],c=s.length,a,l=0;l<c;++l)(a=s[l])&&(o.push(e.call(a,a.__data__,l,s)),r.push(a));return new ue(o,r)}function Ao(e){return function(){return this.matches(e)}}function Do(e){return function(t){return t.matches(e)}}var Ls=Array.prototype.find;function js(e){return function(){return Ls.call(this.children,e)}}function $s(){return this.firstElementChild}function zs(e){return this.select(e==null?$s:js(typeof e=="function"?e:Do(e)))}var Rs=Array.prototype.filter;function Hs(){return Array.from(this.children)}function Vs(e){return function(){return Rs.call(this.children,e)}}function Bs(e){return this.selectAll(e==null?Hs:Vs(typeof e=="function"?e:Do(e)))}function Fs(e){typeof e!="function"&&(e=Ao(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,c=o[r]=[],a,l=0;l<s;++l)(a=i[l])&&e.call(a,a.__data__,l,i)&&c.push(a);return new ue(o,this._parents)}function Lo(e){return new Array(e.length)}function Ys(){return new ue(this._enter||this._groups.map(Lo),this._parents)}function bt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}bt.prototype={constructor:bt,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Ws(e){return function(){return e}}function Zs(e,t,n,o,r,i){for(var s=0,c,a=t.length,l=i.length;s<l;++s)(c=t[s])?(c.__data__=i[s],o[s]=c):n[s]=new bt(e,i[s]);for(;s<a;++s)(c=t[s])&&(r[s]=c)}function Xs(e,t,n,o,r,i,s){var c,a,l=new Map,u=t.length,d=i.length,f=new Array(u),h;for(c=0;c<u;++c)(a=t[c])&&(f[c]=h=s.call(a,a.__data__,c,t)+"",l.has(h)?r[c]=a:l.set(h,a));for(c=0;c<d;++c)h=s.call(e,i[c],c,i)+"",(a=l.get(h))?(o[c]=a,a.__data__=i[c],l.delete(h)):n[c]=new bt(e,i[c]);for(c=0;c<u;++c)(a=t[c])&&l.get(f[c])===a&&(r[c]=a)}function Gs(e){return e.__data__}function qs(e,t){if(!arguments.length)return Array.from(this,Gs);var n=t?Xs:Zs,o=this._parents,r=this._groups;typeof e!="function"&&(e=Ws(e));for(var i=r.length,s=new Array(i),c=new Array(i),a=new Array(i),l=0;l<i;++l){var u=o[l],d=r[l],f=d.length,h=Us(e.call(u,u&&u.__data__,l,o)),m=h.length,w=c[l]=new Array(m),_=s[l]=new Array(m),b=a[l]=new Array(f);n(u,d,w,_,b,h,t);for(var E=0,g=0,p,N;E<m;++E)if(p=w[E]){for(E>=g&&(g=E+1);!(N=_[g])&&++g<m;);p._next=N||null}}return s=new ue(s,o),s._enter=c,s._exit=a,s}function Us(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Ks(){return new ue(this._exit||this._groups.map(Lo),this._parents)}function Qs(e,t,n){var o=this.enter(),r=this,i=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),t!=null&&(r=t(r),r&&(r=r.selection())),n==null?i.remove():n(i),o&&r?o.merge(r).order():r}function Js(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,i=o.length,s=Math.min(r,i),c=new Array(r),a=0;a<s;++a)for(var l=n[a],u=o[a],d=l.length,f=c[a]=new Array(d),h,m=0;m<d;++m)(h=l[m]||u[m])&&(f[m]=h);for(;a<r;++a)c[a]=n[a];return new ue(c,this._parents)}function ea(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],r=o.length-1,i=o[r],s;--r>=0;)(s=o[r])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function ta(e){e||(e=na);function t(d,f){return d&&f?e(d.__data__,f.__data__):!d-!f}for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var s=n[i],c=s.length,a=r[i]=new Array(c),l,u=0;u<c;++u)(l=s[u])&&(a[u]=l);a.sort(t)}return new ue(r,this._parents).order()}function na(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function oa(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function ra(){return Array.from(this)}function ia(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length;r<i;++r){var s=o[r];if(s)return s}return null}function sa(){let e=0;for(const t of this)++e;return e}function aa(){return!this.node()}function ca(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r=t[n],i=0,s=r.length,c;i<s;++i)(c=r[i])&&e.call(c,c.__data__,i,r);return this}function la(e){return function(){this.removeAttribute(e)}}function ua(e){return function(){this.removeAttributeNS(e.space,e.local)}}function da(e,t){return function(){this.setAttribute(e,t)}}function fa(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function ha(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function ga(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function pa(e,t){var n=Mt(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((t==null?n.local?ua:la:typeof t=="function"?n.local?ga:ha:n.local?fa:da)(n,t))}function jo(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function ma(e){return function(){this.style.removeProperty(e)}}function ya(e,t,n){return function(){this.style.setProperty(e,t,n)}}function xa(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function wa(e,t,n){return arguments.length>1?this.each((t==null?ma:typeof t=="function"?xa:ya)(e,t,n??"")):He(this.node(),e)}function He(e,t){return e.style.getPropertyValue(t)||jo(e).getComputedStyle(e,null).getPropertyValue(t)}function va(e){return function(){delete this[e]}}function ba(e,t){return function(){this[e]=t}}function Ea(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function _a(e,t){return arguments.length>1?this.each((t==null?va:typeof t=="function"?Ea:ba)(e,t)):this.node()[e]}function $o(e){return e.trim().split(/^|\s+/)}function un(e){return e.classList||new zo(e)}function zo(e){this._node=e,this._names=$o(e.getAttribute("class")||"")}zo.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Ro(e,t){for(var n=un(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function Ho(e,t){for(var n=un(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function Na(e){return function(){Ro(this,e)}}function Sa(e){return function(){Ho(this,e)}}function Ca(e,t){return function(){(t.apply(this,arguments)?Ro:Ho)(this,e)}}function ka(e,t){var n=$o(e+"");if(arguments.length<2){for(var o=un(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?Ca:t?Na:Sa)(n,t))}function Ma(){this.textContent=""}function Ia(e){return function(){this.textContent=e}}function Oa(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Ta(e){return arguments.length?this.each(e==null?Ma:(typeof e=="function"?Oa:Ia)(e)):this.node().textContent}function Pa(){this.innerHTML=""}function Aa(e){return function(){this.innerHTML=e}}function Da(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function La(e){return arguments.length?this.each(e==null?Pa:(typeof e=="function"?Da:Aa)(e)):this.node().innerHTML}function ja(){this.nextSibling&&this.parentNode.appendChild(this)}function $a(){return this.each(ja)}function za(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Ra(){return this.each(za)}function Ha(e){var t=typeof e=="function"?e:To(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Va(){return null}function Ba(e,t){var n=typeof e=="function"?e:To(e),o=t==null?Va:typeof t=="function"?t:ln(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function Fa(){var e=this.parentNode;e&&e.removeChild(this)}function Ya(){return this.each(Fa)}function Wa(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Za(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Xa(e){return this.select(e?Za:Wa)}function Ga(e){return arguments.length?this.property("__data__",e):this.node().__data__}function qa(e){return function(t){e.call(this,t,this.__data__)}}function Ua(e){return e.trim().split(/^|\s+/).map(function(t){var n="",o=t.indexOf(".");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{type:t,name:n}})}function Ka(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,r=t.length,i;n<r;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++o]=i;++o?t.length=o:delete this.__on}}}function Qa(e,t,n){return function(){var o=this.__on,r,i=qa(t);if(o){for(var s=0,c=o.length;s<c;++s)if((r=o[s]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=n),r.value=t;return}}this.addEventListener(e.type,i,n),r={type:e.type,name:e.name,value:t,listener:i,options:n},o?o.push(r):this.__on=[r]}}function Ja(e,t,n){var o=Ua(e+""),r,i=o.length,s;if(arguments.length<2){var c=this.node().__on;if(c){for(var a=0,l=c.length,u;a<l;++a)for(r=0,u=c[a];r<i;++r)if((s=o[r]).type===u.type&&s.name===u.name)return u.value}return}for(c=t?Qa:Ka,r=0;r<i;++r)this.each(c(o[r],t,n));return this}function Vo(e,t,n){var o=jo(e),r=o.CustomEvent;typeof r=="function"?r=new r(t,n):(r=o.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function ec(e,t){return function(){return Vo(this,e,t)}}function tc(e,t){return function(){return Vo(this,e,t.apply(this,arguments))}}function nc(e,t){return this.each((typeof t=="function"?tc:ec)(e,t))}function*oc(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length,s;r<i;++r)(s=o[r])&&(yield s)}var Bo=[null];function ue(e,t){this._groups=e,this._parents=t}function it(){return new ue([[document.documentElement]],Bo)}function rc(){return this}ue.prototype=it.prototype={constructor:ue,select:Os,selectAll:Ds,selectChild:zs,selectChildren:Bs,filter:Fs,data:qs,enter:Ys,exit:Ks,join:Qs,merge:Js,selection:rc,order:ea,sort:ta,call:oa,nodes:ra,node:ia,size:sa,empty:aa,each:ca,attr:pa,style:wa,property:_a,classed:ka,text:Ta,html:La,raise:$a,lower:Ra,append:Ha,insert:Ba,remove:Ya,clone:Xa,datum:Ga,on:Ja,dispatch:nc,[Symbol.iterator]:oc};function le(e){return typeof e=="string"?new ue([[document.querySelector(e)]],[document.documentElement]):new ue([[e]],Bo)}function ic(e){let t;for(;t=e.sourceEvent;)e=t;return e}function fe(e,t){if(e=ic(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,o=o.matrixTransform(t.getScreenCTM().inverse()),[o.x,o.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}const sc={passive:!1},Je={capture:!0,passive:!1};function Ft(e){e.stopImmediatePropagation()}function Re(e){e.preventDefault(),e.stopImmediatePropagation()}function Fo(e){var t=e.document.documentElement,n=le(e).on("dragstart.drag",Re,Je);"onselectstart"in t?n.on("selectstart.drag",Re,Je):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Yo(e,t){var n=e.document.documentElement,o=le(e).on("dragstart.drag",null);t&&(o.on("click.drag",Re,Je),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const dt=e=>()=>e;function Kt(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,y:c,dx:a,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:c,enumerable:!0,configurable:!0},dx:{value:a,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}Kt.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function ac(e){return!e.ctrlKey&&!e.button}function cc(){return this.parentNode}function lc(e,t){return t??{x:e.x,y:e.y}}function uc(){return navigator.maxTouchPoints||"ontouchstart"in this}function Wo(){var e=ac,t=cc,n=lc,o=uc,r={},i=cn("start","drag","end"),s=0,c,a,l,u,d=0;function f(p){p.on("mousedown.drag",h).filter(o).on("touchstart.drag",_).on("touchmove.drag",b,sc).on("touchend.drag touchcancel.drag",E).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(p,N){if(!(u||!e.call(this,p,N))){var S=g(this,t.call(this,p,N),p,N,"mouse");S&&(le(p.view).on("mousemove.drag",m,Je).on("mouseup.drag",w,Je),Fo(p.view),Ft(p),l=!1,c=p.clientX,a=p.clientY,S("start",p))}}function m(p){if(Re(p),!l){var N=p.clientX-c,S=p.clientY-a;l=N*N+S*S>d}r.mouse("drag",p)}function w(p){le(p.view).on("mousemove.drag mouseup.drag",null),Yo(p.view,l),Re(p),r.mouse("end",p)}function _(p,N){if(e.call(this,p,N)){var S=p.changedTouches,T=t.call(this,p,N),L=S.length,$,A;for($=0;$<L;++$)(A=g(this,T,p,N,S[$].identifier,S[$]))&&(Ft(p),A("start",p,S[$]))}}function b(p){var N=p.changedTouches,S=N.length,T,L;for(T=0;T<S;++T)(L=r[N[T].identifier])&&(Re(p),L("drag",p,N[T]))}function E(p){var N=p.changedTouches,S=N.length,T,L;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),T=0;T<S;++T)(L=r[N[T].identifier])&&(Ft(p),L("end",p,N[T]))}function g(p,N,S,T,L,$){var A=i.copy(),C=fe($||S,N),P,D,y;if((y=n.call(p,new Kt("beforestart",{sourceEvent:S,target:f,identifier:L,active:s,x:C[0],y:C[1],dx:0,dy:0,dispatch:A}),T))!=null)return P=y.x-C[0]||0,D=y.y-C[1]||0,function I(v,k,M){var j=C,B;switch(v){case"start":r[L]=I,B=s++;break;case"end":delete r[L],--s;case"drag":C=fe(M||k,N),B=s;break}A.call(v,p,new Kt(v,{sourceEvent:k,subject:y,target:f,identifier:L,active:B,x:C[0]+P,y:C[1]+D,dx:C[0]-j[0],dy:C[1]-j[1],dispatch:A}),T)}}return f.filter=function(p){return arguments.length?(e=typeof p=="function"?p:dt(!!p),f):e},f.container=function(p){return arguments.length?(t=typeof p=="function"?p:dt(p),f):t},f.subject=function(p){return arguments.length?(n=typeof p=="function"?p:dt(p),f):n},f.touchable=function(p){return arguments.length?(o=typeof p=="function"?p:dt(!!p),f):o},f.on=function(){var p=i.on.apply(i,arguments);return p===i?f:p},f.clickDistance=function(p){return arguments.length?(d=(p=+p)*p,f):Math.sqrt(d)},f}function Hn(e,t,n){var o=new ws;return t=t==null?0:+t,o.restart(r=>{o.stop(),e(r+t)},t,n),o}var dc=cn("start","end","cancel","interrupt"),fc=[],Zo=0,Vn=1,Qt=2,xt=3,Bn=4,Jt=5,wt=6;function It(e,t,n,o,r,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;hc(e,n,{name:t,index:o,group:r,on:dc,tween:fc,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Zo})}function dn(e,t){var n=me(e,t);if(n.state>Zo)throw new Error("too late; already scheduled");return n}function we(e,t){var n=me(e,t);if(n.state>xt)throw new Error("too late; already running");return n}function me(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function hc(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=vs(i,0,n.time);function i(l){n.state=Vn,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var u,d,f,h;if(n.state!==Vn)return a();for(u in o)if(h=o[u],h.name===n.name){if(h.state===xt)return Hn(s);h.state===Bn?(h.state=wt,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete o[u]):+u<t&&(h.state=wt,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete o[u])}if(Hn(function(){n.state===xt&&(n.state=Bn,n.timer.restart(c,n.delay,n.time),c(l))}),n.state=Qt,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Qt){for(n.state=xt,r=new Array(f=n.tween.length),u=0,d=-1;u<f;++u)(h=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(r[++d]=h);r.length=d+1}}function c(l){for(var u=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(a),n.state=Jt,1),d=-1,f=r.length;++d<f;)r[d].call(e,u);n.state===Jt&&(n.on.call("end",e,e.__data__,n.index,n.group),a())}function a(){n.state=wt,n.timer.stop(),delete o[t];for(var l in o)return;delete e.__transition}}function vt(e,t){var n=e.__transition,o,r,i=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((o=n[s]).name!==t){i=!1;continue}r=o.state>Qt&&o.state<Jt,o.state=wt,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[s]}i&&delete e.__transition}}function gc(e){return this.each(function(){vt(this,e)})}function pc(e,t){var n,o;return function(){var r=we(this,e),i=r.tween;if(i!==n){o=n=i;for(var s=0,c=o.length;s<c;++s)if(o[s].name===t){o=o.slice(),o.splice(s,1);break}}r.tween=o}}function mc(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var i=we(this,e),s=i.tween;if(s!==o){r=(o=s).slice();for(var c={name:t,value:n},a=0,l=r.length;a<l;++a)if(r[a].name===t){r[a]=c;break}a===l&&r.push(c)}i.tween=r}}function yc(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=me(this.node(),n).tween,r=0,i=o.length,s;r<i;++r)if((s=o[r]).name===e)return s.value;return null}return this.each((t==null?pc:mc)(n,e,t))}function fn(e,t,n){var o=e._id;return e.each(function(){var r=we(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return me(r,o).value[t]}}function Xo(e,t){var n;return(typeof t=="number"?Es:t instanceof $n?zn:(n=$n(t))?(t=n,zn):_s)(e,t)}function xc(e){return function(){this.removeAttribute(e)}}function wc(e){return function(){this.removeAttributeNS(e.space,e.local)}}function vc(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttribute(e);return s===r?null:s===o?i:i=t(o=s,n)}}function bc(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttributeNS(e.space,e.local);return s===r?null:s===o?i:i=t(o=s,n)}}function Ec(e,t,n){var o,r,i;return function(){var s,c=n(this),a;return c==null?void this.removeAttribute(e):(s=this.getAttribute(e),a=c+"",s===a?null:s===o&&a===r?i:(r=a,i=t(o=s,c)))}}function _c(e,t,n){var o,r,i;return function(){var s,c=n(this),a;return c==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),a=c+"",s===a?null:s===o&&a===r?i:(r=a,i=t(o=s,c)))}}function Nc(e,t){var n=Mt(e),o=n==="transform"?Ns:Xo;return this.attrTween(e,typeof t=="function"?(n.local?_c:Ec)(n,o,fn(this,"attr."+e,t)):t==null?(n.local?wc:xc)(n):(n.local?bc:vc)(n,o,t))}function Sc(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Cc(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function kc(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Cc(e,i)),n}return r._value=t,r}function Mc(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Sc(e,i)),n}return r._value=t,r}function Ic(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var o=Mt(e);return this.tween(n,(o.local?kc:Mc)(o,t))}function Oc(e,t){return function(){dn(this,e).delay=+t.apply(this,arguments)}}function Tc(e,t){return t=+t,function(){dn(this,e).delay=t}}function Pc(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Oc:Tc)(t,e)):me(this.node(),t).delay}function Ac(e,t){return function(){we(this,e).duration=+t.apply(this,arguments)}}function Dc(e,t){return t=+t,function(){we(this,e).duration=t}}function Lc(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Ac:Dc)(t,e)):me(this.node(),t).duration}function jc(e,t){if(typeof t!="function")throw new Error;return function(){we(this,e).ease=t}}function $c(e){var t=this._id;return arguments.length?this.each(jc(t,e)):me(this.node(),t).ease}function zc(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;we(this,e).ease=n}}function Rc(e){if(typeof e!="function")throw new Error;return this.each(zc(this._id,e))}function Hc(e){typeof e!="function"&&(e=Ao(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,c=o[r]=[],a,l=0;l<s;++l)(a=i[l])&&e.call(a,a.__data__,l,i)&&c.push(a);return new _e(o,this._parents,this._name,this._id)}function Vc(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,i=Math.min(o,r),s=new Array(o),c=0;c<i;++c)for(var a=t[c],l=n[c],u=a.length,d=s[c]=new Array(u),f,h=0;h<u;++h)(f=a[h]||l[h])&&(d[h]=f);for(;c<o;++c)s[c]=t[c];return new _e(s,this._parents,this._name,this._id)}function Bc(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function Fc(e,t,n){var o,r,i=Bc(t)?dn:we;return function(){var s=i(this,e),c=s.on;c!==o&&(r=(o=c).copy()).on(t,n),s.on=r}}function Yc(e,t){var n=this._id;return arguments.length<2?me(this.node(),n).on.on(e):this.each(Fc(n,e,t))}function Wc(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Zc(){return this.on("end.remove",Wc(this._id))}function Xc(e){var t=this._name,n=this._id;typeof e!="function"&&(e=ln(e));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var c=o[s],a=c.length,l=i[s]=new Array(a),u,d,f=0;f<a;++f)(u=c[f])&&(d=e.call(u,u.__data__,f,c))&&("__data__"in u&&(d.__data__=u.__data__),l[f]=d,It(l[f],t,n,f,l,me(u,n)));return new _e(i,this._parents,t,n)}function Gc(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Po(e));for(var o=this._groups,r=o.length,i=[],s=[],c=0;c<r;++c)for(var a=o[c],l=a.length,u,d=0;d<l;++d)if(u=a[d]){for(var f=e.call(u,u.__data__,d,a),h,m=me(u,n),w=0,_=f.length;w<_;++w)(h=f[w])&&It(h,t,n,w,f,m);i.push(f),s.push(u)}return new _e(i,s,t,n)}var qc=it.prototype.constructor;function Uc(){return new qc(this._groups,this._parents)}function Kc(e,t){var n,o,r;return function(){var i=He(this,e),s=(this.style.removeProperty(e),He(this,e));return i===s?null:i===n&&s===o?r:r=t(n=i,o=s)}}function Go(e){return function(){this.style.removeProperty(e)}}function Qc(e,t,n){var o,r=n+"",i;return function(){var s=He(this,e);return s===r?null:s===o?i:i=t(o=s,n)}}function Jc(e,t,n){var o,r,i;return function(){var s=He(this,e),c=n(this),a=c+"";return c==null&&(a=c=(this.style.removeProperty(e),He(this,e))),s===a?null:s===o&&a===r?i:(r=a,i=t(o=s,c))}}function el(e,t){var n,o,r,i="style."+t,s="end."+i,c;return function(){var a=we(this,e),l=a.on,u=a.value[i]==null?c||(c=Go(t)):void 0;(l!==n||r!==u)&&(o=(n=l).copy()).on(s,r=u),a.on=o}}function tl(e,t,n){var o=(e+="")=="transform"?Ss:Xo;return t==null?this.styleTween(e,Kc(e,o)).on("end.style."+e,Go(e)):typeof t=="function"?this.styleTween(e,Jc(e,o,fn(this,"style."+e,t))).each(el(this._id,e)):this.styleTween(e,Qc(e,o,t),n).on("end.style."+e,null)}function nl(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function ol(e,t,n){var o,r;function i(){var s=t.apply(this,arguments);return s!==r&&(o=(r=s)&&nl(e,s,n)),o}return i._value=t,i}function rl(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;return this.tween(o,ol(e,t,n??""))}function il(e){return function(){this.textContent=e}}function sl(e){return function(){var t=e(this);this.textContent=t??""}}function al(e){return this.tween("text",typeof e=="function"?sl(fn(this,"text",e)):il(e==null?"":e+""))}function cl(e){return function(t){this.textContent=e.call(this,t)}}function ll(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&cl(r)),t}return o._value=e,o}function ul(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,ll(e))}function dl(){for(var e=this._name,t=this._id,n=qo(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],c=s.length,a,l=0;l<c;++l)if(a=s[l]){var u=me(a,t);It(a,e,n,l,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new _e(o,this._parents,e,n)}function fl(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var c={value:s},a={value:function(){--r===0&&i()}};n.each(function(){var l=we(this,o),u=l.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(c),t._.interrupt.push(c),t._.end.push(a)),l.on=t}),r===0&&i()})}var hl=0;function _e(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function qo(){return++hl}var be=it.prototype;_e.prototype={constructor:_e,select:Xc,selectAll:Gc,selectChild:be.selectChild,selectChildren:be.selectChildren,filter:Hc,merge:Vc,selection:Uc,transition:dl,call:be.call,nodes:be.nodes,node:be.node,size:be.size,empty:be.empty,each:be.each,on:Yc,attr:Nc,attrTween:Ic,style:tl,styleTween:rl,text:al,textTween:ul,remove:Zc,tween:yc,delay:Pc,duration:Lc,ease:$c,easeVarying:Rc,end:fl,[Symbol.iterator]:be[Symbol.iterator]};function gl(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var pl={time:null,delay:0,duration:250,ease:gl};function ml(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function yl(e){var t,n;e instanceof _e?(t=e._id,e=e._name):(t=qo(),(n=pl).time=bs(),e=e==null?null:e+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],c=s.length,a,l=0;l<c;++l)(a=s[l])&&It(a,e,t,l,s,n||ml(a,t));return new _e(o,this._parents,e,t)}it.prototype.interrupt=gc;it.prototype.transition=yl;const ft=e=>()=>e;function xl(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function Ee(e,t,n){this.k=e,this.x=t,this.y=n}Ee.prototype={constructor:Ee,scale:function(e){return e===1?this:new Ee(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ee(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Ot=new Ee(1,0,0);Uo.prototype=Ee.prototype;function Uo(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Ot;return e.__zoom}function Yt(e){e.stopImmediatePropagation()}function Ke(e){e.preventDefault(),e.stopImmediatePropagation()}function wl(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function vl(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Fn(){return this.__zoom||Ot}function bl(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function El(){return navigator.maxTouchPoints||"ontouchstart"in this}function _l(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function Ko(){var e=wl,t=vl,n=_l,o=bl,r=El,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],c=250,a=yt,l=cn("start","zoom","end"),u,d,f,h=500,m=150,w=0,_=10;function b(y){y.property("__zoom",Fn).on("wheel.zoom",L,{passive:!1}).on("mousedown.zoom",$).on("dblclick.zoom",A).filter(r).on("touchstart.zoom",C).on("touchmove.zoom",P).on("touchend.zoom touchcancel.zoom",D).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(y,I,v,k){var M=y.selection?y.selection():y;M.property("__zoom",Fn),y!==M?N(y,I,v,k):M.interrupt().each(function(){S(this,arguments).event(k).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},b.scaleBy=function(y,I,v,k){b.scaleTo(y,function(){var M=this.__zoom.k,j=typeof I=="function"?I.apply(this,arguments):I;return M*j},v,k)},b.scaleTo=function(y,I,v,k){b.transform(y,function(){var M=t.apply(this,arguments),j=this.__zoom,B=v==null?p(M):typeof v=="function"?v.apply(this,arguments):v,F=j.invert(B),Y=typeof I=="function"?I.apply(this,arguments):I;return n(g(E(j,Y),B,F),M,s)},v,k)},b.translateBy=function(y,I,v,k){b.transform(y,function(){return n(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof v=="function"?v.apply(this,arguments):v),t.apply(this,arguments),s)},null,k)},b.translateTo=function(y,I,v,k,M){b.transform(y,function(){var j=t.apply(this,arguments),B=this.__zoom,F=k==null?p(j):typeof k=="function"?k.apply(this,arguments):k;return n(Ot.translate(F[0],F[1]).scale(B.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof v=="function"?-v.apply(this,arguments):-v),j,s)},k,M)};function E(y,I){return I=Math.max(i[0],Math.min(i[1],I)),I===y.k?y:new Ee(I,y.x,y.y)}function g(y,I,v){var k=I[0]-v[0]*y.k,M=I[1]-v[1]*y.k;return k===y.x&&M===y.y?y:new Ee(y.k,k,M)}function p(y){return[(+y[0][0]+ +y[1][0])/2,(+y[0][1]+ +y[1][1])/2]}function N(y,I,v,k){y.on("start.zoom",function(){S(this,arguments).event(k).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(k).end()}).tween("zoom",function(){var M=this,j=arguments,B=S(M,j).event(k),F=t.apply(M,j),Y=v==null?p(F):typeof v=="function"?v.apply(M,j):v,X=Math.max(F[1][0]-F[0][0],F[1][1]-F[0][1]),O=M.__zoom,x=typeof I=="function"?I.apply(M,j):I,z=a(O.invert(Y).concat(X/O.k),x.invert(Y).concat(X/x.k));return function(V){if(V===1)V=x;else{var H=z(V),W=X/H[2];V=new Ee(W,Y[0]-H[0]*W,Y[1]-H[1]*W)}B.zoom(null,V)}})}function S(y,I,v){return!v&&y.__zooming||new T(y,I)}function T(y,I){this.that=y,this.args=I,this.active=0,this.sourceEvent=null,this.extent=t.apply(y,I),this.taps=0}T.prototype={event:function(y){return y&&(this.sourceEvent=y),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(y,I){return this.mouse&&y!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&y!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&y!=="touch"&&(this.touch1[1]=I.invert(this.touch1[0])),this.that.__zoom=I,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(y){var I=le(this.that).datum();l.call(y,this.that,new xl(y,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:l}),I)}};function L(y,...I){if(!e.apply(this,arguments))return;var v=S(this,I).event(y),k=this.__zoom,M=Math.max(i[0],Math.min(i[1],k.k*Math.pow(2,o.apply(this,arguments)))),j=fe(y);if(v.wheel)(v.mouse[0][0]!==j[0]||v.mouse[0][1]!==j[1])&&(v.mouse[1]=k.invert(v.mouse[0]=j)),clearTimeout(v.wheel);else{if(k.k===M)return;v.mouse=[j,k.invert(j)],vt(this),v.start()}Ke(y),v.wheel=setTimeout(B,m),v.zoom("mouse",n(g(E(k,M),v.mouse[0],v.mouse[1]),v.extent,s));function B(){v.wheel=null,v.end()}}function $(y,...I){if(f||!e.apply(this,arguments))return;var v=y.currentTarget,k=S(this,I,!0).event(y),M=le(y.view).on("mousemove.zoom",Y,!0).on("mouseup.zoom",X,!0),j=fe(y,v),B=y.clientX,F=y.clientY;Fo(y.view),Yt(y),k.mouse=[j,this.__zoom.invert(j)],vt(this),k.start();function Y(O){if(Ke(O),!k.moved){var x=O.clientX-B,z=O.clientY-F;k.moved=x*x+z*z>w}k.event(O).zoom("mouse",n(g(k.that.__zoom,k.mouse[0]=fe(O,v),k.mouse[1]),k.extent,s))}function X(O){M.on("mousemove.zoom mouseup.zoom",null),Yo(O.view,k.moved),Ke(O),k.event(O).end()}}function A(y,...I){if(e.apply(this,arguments)){var v=this.__zoom,k=fe(y.changedTouches?y.changedTouches[0]:y,this),M=v.invert(k),j=v.k*(y.shiftKey?.5:2),B=n(g(E(v,j),k,M),t.apply(this,I),s);Ke(y),c>0?le(this).transition().duration(c).call(N,B,k,y):le(this).call(b.transform,B,k,y)}}function C(y,...I){if(e.apply(this,arguments)){var v=y.touches,k=v.length,M=S(this,I,y.changedTouches.length===k).event(y),j,B,F,Y;for(Yt(y),B=0;B<k;++B)F=v[B],Y=fe(F,this),Y=[Y,this.__zoom.invert(Y),F.identifier],M.touch0?!M.touch1&&M.touch0[2]!==Y[2]&&(M.touch1=Y,M.taps=0):(M.touch0=Y,j=!0,M.taps=1+!!u);u&&(u=clearTimeout(u)),j&&(M.taps<2&&(d=Y[0],u=setTimeout(function(){u=null},h)),vt(this),M.start())}}function P(y,...I){if(this.__zooming){var v=S(this,I).event(y),k=y.changedTouches,M=k.length,j,B,F,Y;for(Ke(y),j=0;j<M;++j)B=k[j],F=fe(B,this),v.touch0&&v.touch0[2]===B.identifier?v.touch0[0]=F:v.touch1&&v.touch1[2]===B.identifier&&(v.touch1[0]=F);if(B=v.that.__zoom,v.touch1){var X=v.touch0[0],O=v.touch0[1],x=v.touch1[0],z=v.touch1[1],V=(V=x[0]-X[0])*V+(V=x[1]-X[1])*V,H=(H=z[0]-O[0])*H+(H=z[1]-O[1])*H;B=E(B,Math.sqrt(V/H)),F=[(X[0]+x[0])/2,(X[1]+x[1])/2],Y=[(O[0]+z[0])/2,(O[1]+z[1])/2]}else if(v.touch0)F=v.touch0[0],Y=v.touch0[1];else return;v.zoom("touch",n(g(B,F,Y),v.extent,s))}}function D(y,...I){if(this.__zooming){var v=S(this,I).event(y),k=y.changedTouches,M=k.length,j,B;for(Yt(y),f&&clearTimeout(f),f=setTimeout(function(){f=null},h),j=0;j<M;++j)B=k[j],v.touch0&&v.touch0[2]===B.identifier?delete v.touch0:v.touch1&&v.touch1[2]===B.identifier&&delete v.touch1;if(v.touch1&&!v.touch0&&(v.touch0=v.touch1,delete v.touch1),v.touch0)v.touch0[1]=this.__zoom.invert(v.touch0[0]);else if(v.end(),v.taps===2&&(B=fe(B,this),Math.hypot(d[0]-B[0],d[1]-B[1])<_)){var F=le(this).on("dblclick.zoom");F&&F.apply(this,arguments)}}}return b.wheelDelta=function(y){return arguments.length?(o=typeof y=="function"?y:ft(+y),b):o},b.filter=function(y){return arguments.length?(e=typeof y=="function"?y:ft(!!y),b):e},b.touchable=function(y){return arguments.length?(r=typeof y=="function"?y:ft(!!y),b):r},b.extent=function(y){return arguments.length?(t=typeof y=="function"?y:ft([[+y[0][0],+y[0][1]],[+y[1][0],+y[1][1]]]),b):t},b.scaleExtent=function(y){return arguments.length?(i[0]=+y[0],i[1]=+y[1],b):[i[0],i[1]]},b.translateExtent=function(y){return arguments.length?(s[0][0]=+y[0][0],s[1][0]=+y[1][0],s[0][1]=+y[0][1],s[1][1]=+y[1][1],b):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},b.constrain=function(y){return arguments.length?(n=y,b):n},b.duration=function(y){return arguments.length?(c=+y,b):c},b.interpolate=function(y){return arguments.length?(a=y,b):a},b.on=function(){var y=l.on.apply(l,arguments);return y===l?b:y},b.clickDistance=function(y){return arguments.length?(w=(y=+y)*y,b):Math.sqrt(w)},b.tapDistance=function(y){return arguments.length?(_=+y,b):_},b}const xe={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:o}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},et=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Qo=["Enter"," ","Escape"],Jo={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Ve;(function(e){e.Strict="strict",e.Loose="loose"})(Ve||(Ve={}));var Pe;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Pe||(Pe={}));var tt;(function(e){e.Partial="partial",e.Full="full"})(tt||(tt={}));const er={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Me;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Me||(Me={}));var Et;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Et||(Et={}));var K;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(K||(K={}));const Yn={[K.Left]:K.Right,[K.Right]:K.Left,[K.Top]:K.Bottom,[K.Bottom]:K.Top};function tr(e){return e===null?null:e?"valid":"invalid"}const nr=e=>"id"in e&&"source"in e&&"target"in e,Nl=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),hn=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),st=(e,t=[0,0])=>{const{width:n,height:o}=Se(e),r=e.origin??t,i=n*r[0],s=o*r[1];return{x:e.position.x-i,y:e.position.y-s}},Sl=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((o,r)=>{const i=typeof r=="string";let s=!t.nodeLookup&&!i?r:void 0;t.nodeLookup&&(s=i?t.nodeLookup.get(r):hn(r)?r:t.nodeLookup.get(r.id));const c=s?_t(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Tt(o,c)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Pt(n)},at=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(r=>{(t.filter===void 0||t.filter(r))&&(n=Tt(n,_t(r)),o=!0)}),o?Pt(n):{x:0,y:0,width:0,height:0}},gn=(e,t,[n,o,r]=[0,0,1],i=!1,s=!1)=>{const c={...lt(t,[n,o,r]),width:t.width/r,height:t.height/r},a=[];for(const l of e.values()){const{measured:u,selectable:d=!0,hidden:f=!1}=l;if(s&&!d||f)continue;const h=u.width??l.width??l.initialWidth??null,m=u.height??l.height??l.initialHeight??null,w=nt(c,Fe(l)),_=(h??0)*(m??0),b=i&&w>0;(!l.internals.handleBounds||b||w>=_||l.dragging)&&a.push(l)}return a},Cl=(e,t)=>{const n=new Set;return e.forEach(o=>{n.add(o.id)}),t.filter(o=>n.has(o.source)||n.has(o.target))};function kl(e,t){const n=new Map,o=t?.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{r.measured.width&&r.measured.height&&(t?.includeHiddenNodes||!r.hidden)&&(!o||o.has(r.id))&&n.set(r.id,r)}),n}async function Ml({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(e.size===0)return Promise.resolve(!0);const c=kl(e,s),a=at(c),l=pn(a,t,n,s?.minZoom??r,s?.maxZoom??i,s?.padding??.1);return await o.setViewport(l,{duration:s?.duration,ease:s?.ease,interpolate:s?.interpolate}),Promise.resolve(!0)}function or({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){const s=n.get(e),c=s.parentId?n.get(s.parentId):void 0,{x:a,y:l}=c?c.internals.positionAbsolute:{x:0,y:0},u=s.origin??o;let d=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!c)i?.("005",xe.error005());else{const h=c.measured.width,m=c.measured.height;h&&m&&(d=[[a,l],[a+h,l+m]])}else c&&Ye(s.extent)&&(d=[[s.extent[0][0]+a,s.extent[0][1]+l],[s.extent[1][0]+a,s.extent[1][1]+l]]);const f=Ye(d)?Ae(t,d,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&i?.("015",xe.error015()),{position:{x:f.x-a+(s.measured.width??0)*u[0],y:f.y-l+(s.measured.height??0)*u[1]},positionAbsolute:f}}async function Il({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(e.map(f=>f.id)),s=[];for(const f of n){if(f.deletable===!1)continue;const h=i.has(f.id),m=!h&&f.parentId&&s.find(w=>w.id===f.parentId);(h||m)&&s.push(f)}const c=new Set(t.map(f=>f.id)),a=o.filter(f=>f.deletable!==!1),u=Cl(s,a);for(const f of a)c.has(f.id)&&!u.find(m=>m.id===f.id)&&u.push(f);if(!r)return{edges:u,nodes:s};const d=await r({nodes:s,edges:u});return typeof d=="boolean"?d?{edges:u,nodes:s}:{edges:[],nodes:[]}:d}const Be=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Ae=(e={x:0,y:0},t,n)=>({x:Be(e.x,t[0][0],t[1][0]-(n?.width??0)),y:Be(e.y,t[0][1],t[1][1]-(n?.height??0))});function rr(e,t,n){const{width:o,height:r}=Se(n),{x:i,y:s}=n.internals.positionAbsolute;return Ae(e,[[i,s],[i+o,s+r]],t)}const Wn=(e,t,n)=>e<t?Be(Math.abs(e-t),1,t)/t:e>n?-Be(Math.abs(e-n),1,t)/t:0,ir=(e,t,n=15,o=40)=>{const r=Wn(e.x,o,t.width-o)*n,i=Wn(e.y,o,t.height-o)*n;return[r,i]},Tt=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),en=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),Pt=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),Fe=(e,t=[0,0])=>{const{x:n,y:o}=hn(e)?e.internals.positionAbsolute:st(e,t);return{x:n,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},_t=(e,t=[0,0])=>{const{x:n,y:o}=hn(e)?e.internals.positionAbsolute:st(e,t);return{x:n,y:o,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},sr=(e,t)=>Pt(Tt(en(e),en(t))),nt=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*o)},Zn=e=>he(e.width)&&he(e.height)&&he(e.x)&&he(e.y),he=e=>!isNaN(e)&&isFinite(e),Ol=(e,t)=>{},ct=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),lt=({x:e,y:t},[n,o,r],i=!1,s=[1,1])=>{const c={x:(e-n)/r,y:(t-o)/r};return i?ct(c,s):c},Nt=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function je(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Tl(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=je(e,n),r=je(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=je(e.top??e.y??0,n),r=je(e.bottom??e.y??0,n),i=je(e.left??e.x??0,t),s=je(e.right??e.x??0,t);return{top:o,right:s,bottom:r,left:i,x:i+s,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Pl(e,t,n,o,r,i){const{x:s,y:c}=Nt(e,[t,n,o]),{x:a,y:l}=Nt({x:e.x+e.width,y:e.y+e.height},[t,n,o]),u=r-a,d=i-l;return{left:Math.floor(s),top:Math.floor(c),right:Math.floor(u),bottom:Math.floor(d)}}const pn=(e,t,n,o,r,i)=>{const s=Tl(i,t,n),c=(t-s.x)/e.width,a=(n-s.y)/e.height,l=Math.min(c,a),u=Be(l,o,r),d=e.x+e.width/2,f=e.y+e.height/2,h=t/2-d*u,m=n/2-f*u,w=Pl(e,h,m,u,t,n),_={left:Math.min(w.left-s.left,0),top:Math.min(w.top-s.top,0),right:Math.min(w.right-s.right,0),bottom:Math.min(w.bottom-s.bottom,0)};return{x:h-_.left+_.right,y:m-_.top+_.bottom,zoom:u}},ot=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Ye(e){return e!=null&&e!=="parent"}function Se(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function ar(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function cr(e,t={width:0,height:0},n,o,r){const i={...e},s=o.get(n);if(s){const c=s.origin||r;i.x+=s.internals.positionAbsolute.x-(t.width??0)*c[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*c[1]}return i}function Xn(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Al(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function Dl(e){return{...Jo,...e||{}}}function Qe(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=ge(e),c=lt({x:i-(r?.left??0),y:s-(r?.top??0)},o),{x:a,y:l}=n?ct(c,t):c;return{xSnapped:a,ySnapped:l,...c}}const mn=e=>({width:e.offsetWidth,height:e.offsetHeight}),lr=e=>e?.getRootNode?.()||window?.document,Ll=["INPUT","SELECT","TEXTAREA"];function ur(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:Ll.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const dr=e=>"clientX"in e,ge=(e,t)=>{const n=dr(e),o=n?e.clientX:e.touches?.[0].clientX,r=n?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:r-(t?.top??0)}},Gn=(e,t,n,o,r)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(s=>{const c=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:r,position:s.getAttribute("data-handlepos"),x:(c.left-n.left)/o,y:(c.top-n.top)/o,...mn(s)}})};function fr({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:c}){const a=e*.125+r*.375+s*.375+n*.125,l=t*.125+i*.375+c*.375+o*.125,u=Math.abs(a-e),d=Math.abs(l-t);return[a,l,u,d]}function ht(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function qn({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case K.Left:return[t-ht(t-o,i),n];case K.Right:return[t+ht(o-t,i),n];case K.Top:return[t,n-ht(n-r,i)];case K.Bottom:return[t,n+ht(r-n,i)]}}function yn({sourceX:e,sourceY:t,sourcePosition:n=K.Bottom,targetX:o,targetY:r,targetPosition:i=K.Top,curvature:s=.25}){const[c,a]=qn({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[l,u]=qn({pos:i,x1:o,y1:r,x2:e,y2:t,c:s}),[d,f,h,m]=fr({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:c,sourceControlY:a,targetControlX:l,targetControlY:u});return[`M${e},${t} C${c},${a} ${l},${u} ${o},${r}`,d,f,h,m]}function hr({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,i=n<e?n+r:n-r,s=Math.abs(o-t)/2,c=o<t?o+s:o-s;return[i,c,r,s]}function jl({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:i="basic"}){if(i==="manual")return o;const s=r&&n?o+1e3:o,c=Math.max(e.parentId||r&&e.selected?e.internals.z:0,t.parentId||r&&t.selected?t.internals.z:0);return s+c}function $l({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const i=Tt(_t(e),_t(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const s={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return nt(s,Pt(i))>0}const zl=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,Rl=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),Hl=(e,t,n={})=>{if(!e.source||!e.target)return t;const o=n.getEdgeId||zl;let r;return nr(e)?r={...e}:r={...e,id:o(e)},Rl(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function gr({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,i,s,c]=hr({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,c]}const Un={[K.Left]:{x:-1,y:0},[K.Right]:{x:1,y:0},[K.Top]:{x:0,y:-1},[K.Bottom]:{x:0,y:1}},Vl=({source:e,sourcePosition:t=K.Bottom,target:n})=>t===K.Left||t===K.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},Kn=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Bl({source:e,sourcePosition:t=K.Bottom,target:n,targetPosition:o=K.Top,center:r,offset:i,stepPosition:s}){const c=Un[t],a=Un[o],l={x:e.x+c.x*i,y:e.y+c.y*i},u={x:n.x+a.x*i,y:n.y+a.y*i},d=Vl({source:l,sourcePosition:t,target:u}),f=d.x!==0?"x":"y",h=d[f];let m=[],w,_;const b={x:0,y:0},E={x:0,y:0},[,,g,p]=hr({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(c[f]*a[f]===-1){f==="x"?(w=r.x??l.x+(u.x-l.x)*s,_=r.y??(l.y+u.y)/2):(w=r.x??(l.x+u.x)/2,_=r.y??l.y+(u.y-l.y)*s);const S=[{x:w,y:l.y},{x:w,y:u.y}],T=[{x:l.x,y:_},{x:u.x,y:_}];c[f]===h?m=f==="x"?S:T:m=f==="x"?T:S}else{const S=[{x:l.x,y:u.y}],T=[{x:u.x,y:l.y}];if(f==="x"?m=c.x===h?T:S:m=c.y===h?S:T,t===o){const P=Math.abs(e[f]-n[f]);if(P<=i){const D=Math.min(i-1,i-P);c[f]===h?b[f]=(l[f]>e[f]?-1:1)*D:E[f]=(u[f]>n[f]?-1:1)*D}}if(t!==o){const P=f==="x"?"y":"x",D=c[f]===a[P],y=l[P]>u[P],I=l[P]<u[P];(c[f]===1&&(!D&&y||D&&I)||c[f]!==1&&(!D&&I||D&&y))&&(m=f==="x"?S:T)}const L={x:l.x+b.x,y:l.y+b.y},$={x:u.x+E.x,y:u.y+E.y},A=Math.max(Math.abs(L.x-m[0].x),Math.abs($.x-m[0].x)),C=Math.max(Math.abs(L.y-m[0].y),Math.abs($.y-m[0].y));A>=C?(w=(L.x+$.x)/2,_=m[0].y):(w=m[0].x,_=(L.y+$.y)/2)}return[[e,{x:l.x+b.x,y:l.y+b.y},...m,{x:u.x+E.x,y:u.y+E.y},n],w,_,g,p]}function Fl(e,t,n,o){const r=Math.min(Kn(e,t)/2,Kn(t,n)/2,o),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){const l=e.x<n.x?-1:1,u=e.y<n.y?1:-1;return`L ${i+r*l},${s}Q ${i},${s} ${i},${s+r*u}`}const c=e.x<n.x?1:-1,a=e.y<n.y?-1:1;return`L ${i},${s+r*a}Q ${i},${s} ${i+r*c},${s}`}function tn({sourceX:e,sourceY:t,sourcePosition:n=K.Bottom,targetX:o,targetY:r,targetPosition:i=K.Top,borderRadius:s=5,centerX:c,centerY:a,offset:l=20,stepPosition:u=.5}){const[d,f,h,m,w]=Bl({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:c,y:a},offset:l,stepPosition:u});return[d.reduce((b,E,g)=>{let p="";return g>0&&g<d.length-1?p=Fl(d[g-1],E,d[g+1],s):p=`${g===0?"M":"L"}${E.x} ${E.y}`,b+=p,b},""),f,h,m,w]}function Qn(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Yl(e){const{sourceNode:t,targetNode:n}=e;if(!Qn(t)||!Qn(n))return null;const o=t.internals.handleBounds||Jn(t.handles),r=n.internals.handleBounds||Jn(n.handles),i=eo(o?.source??[],e.sourceHandle),s=eo(e.connectionMode===Ve.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!i||!s)return e.onError?.("008",xe.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const c=i?.position||K.Bottom,a=s?.position||K.Top,l=De(t,i,c),u=De(n,s,a);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:c,targetPosition:a}}function Jn(e){if(!e)return null;const t=[],n=[];for(const o of e)o.width=o.width??1,o.height=o.height??1,o.type==="source"?t.push(o):o.type==="target"&&n.push(o);return{source:t,target:n}}function De(e,t,n=K.Left,o=!1){const r=(t?.x??0)+e.internals.positionAbsolute.x,i=(t?.y??0)+e.internals.positionAbsolute.y,{width:s,height:c}=t??Se(e);if(o)return{x:r+s/2,y:i+c/2};switch(t?.position??n){case K.Top:return{x:r+s/2,y:i};case K.Right:return{x:r+s,y:i+c/2};case K.Bottom:return{x:r+s/2,y:i+c};case K.Left:return{x:r,y:i+c/2}}}function eo(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function nn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function Wl(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const i=new Set;return e.reduce((s,c)=>([c.markerStart||o,c.markerEnd||r].forEach(a=>{if(a&&typeof a=="object"){const l=nn(a,t);i.has(l)||(s.push({id:l,color:a.color||n,...a}),i.add(l))}}),s),[]).sort((s,c)=>s.id.localeCompare(c.id))}const pr=1e3,Zl=10,xn={nodeOrigin:[0,0],nodeExtent:et,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Xl={...xn,checkEquality:!0};function wn(e,t){const n={...e};for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function Gl(e,t,n){const o=wn(xn,n);for(const r of e.values())if(r.parentId)bn(r,e,t,o);else{const i=st(r,o.nodeOrigin),s=Ye(r.extent)?r.extent:o.nodeExtent,c=Ae(i,s,Se(r));r.internals.positionAbsolute=c}}function ql(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],o=[];for(const r of e.handles){const i={id:r.id,width:r.width??1,height:r.height??1,nodeId:e.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(i):r.type==="target"&&o.push(i)}return{source:n,target:o}}function vn(e){return e==="manual"}function on(e,t,n,o={}){const r=wn(Xl,o),i={i:0},s=new Map(t),c=r?.elevateNodesOnSelect&&!vn(r.zIndexMode)?pr:0;let a=e.length>0;t.clear(),n.clear();for(const l of e){let u=s.get(l.id);if(r.checkEquality&&l===u?.internals.userNode)t.set(l.id,u);else{const d=st(l,r.nodeOrigin),f=Ye(l.extent)?l.extent:r.nodeExtent,h=Ae(d,f,Se(l));u={...r.defaults,...l,measured:{width:l.measured?.width,height:l.measured?.height},internals:{positionAbsolute:h,handleBounds:ql(l,u),z:mr(l,c,r.zIndexMode),userNode:l}},t.set(l.id,u)}(u.measured===void 0||u.measured.width===void 0||u.measured.height===void 0)&&!u.hidden&&(a=!1),l.parentId&&bn(u,t,n,o,i)}return a}function Ul(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function bn(e,t,n,o,r){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:c,zIndexMode:a}=wn(xn,o),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Ul(e,n),r&&!u.parentId&&u.internals.rootParentIndex===void 0&&a==="auto"&&(u.internals.rootParentIndex=++r.i,u.internals.z=u.internals.z+r.i*Zl),r&&u.internals.rootParentIndex!==void 0&&(r.i=u.internals.rootParentIndex);const d=i&&!vn(a)?pr:0,{x:f,y:h,z:m}=Kl(e,u,s,c,d,a),{positionAbsolute:w}=e.internals,_=f!==w.x||h!==w.y;(_||m!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:_?{x:f,y:h}:w,z:m}})}function mr(e,t,n){const o=he(e.zIndex)?e.zIndex:0;return vn(n)?o:o+(e.selected?t:0)}function Kl(e,t,n,o,r,i){const{x:s,y:c}=t.internals.positionAbsolute,a=Se(e),l=st(e,n),u=Ye(e.extent)?Ae(l,e.extent,a):l;let d=Ae({x:s+u.x,y:c+u.y},o,a);e.extent==="parent"&&(d=rr(d,a,t));const f=mr(e,r,i),h=t.internals.z??0;return{x:d.x,y:d.y,z:h>=f?h+1:f}}function En(e,t,n,o=[0,0]){const r=[],i=new Map;for(const s of e){const c=t.get(s.parentId);if(!c)continue;const a=i.get(s.parentId)?.expandedRect??Fe(c),l=sr(a,s.rect);i.set(s.parentId,{expandedRect:l,parent:c})}return i.size>0&&i.forEach(({expandedRect:s,parent:c},a)=>{const l=c.internals.positionAbsolute,u=Se(c),d=c.origin??o,f=s.x<l.x?Math.round(Math.abs(l.x-s.x)):0,h=s.y<l.y?Math.round(Math.abs(l.y-s.y)):0,m=Math.max(u.width,Math.round(s.width)),w=Math.max(u.height,Math.round(s.height)),_=(m-u.width)*d[0],b=(w-u.height)*d[1];(f>0||h>0||_||b)&&(r.push({id:a,type:"position",position:{x:c.position.x-f+_,y:c.position.y-h+b}}),n.get(a)?.forEach(E=>{e.some(g=>g.id===E.id)||r.push({id:E.id,type:"position",position:{x:E.position.x+f,y:E.position.y+h}})})),(u.width<s.width||u.height<s.height||f||h)&&r.push({id:a,type:"dimensions",setAttributes:!0,dimensions:{width:m+(f?d[0]*f-_:0),height:w+(h?d[1]*h-b:0)}})}),r}function Ql(e,t,n,o,r,i,s){const c=o?.querySelector(".xyflow__viewport");let a=!1;if(!c)return{changes:[],updatedInternals:a};const l=[],u=window.getComputedStyle(c),{m22:d}=new window.DOMMatrixReadOnly(u.transform),f=[];for(const h of e.values()){const m=t.get(h.id);if(!m)continue;if(m.hidden){t.set(m.id,{...m,internals:{...m.internals,handleBounds:void 0}}),a=!0;continue}const w=mn(h.nodeElement),_=m.measured.width!==w.width||m.measured.height!==w.height;if(!!(w.width&&w.height&&(_||!m.internals.handleBounds||h.force))){const E=h.nodeElement.getBoundingClientRect(),g=Ye(m.extent)?m.extent:i;let{positionAbsolute:p}=m.internals;m.parentId&&m.extent==="parent"?p=rr(p,w,t.get(m.parentId)):g&&(p=Ae(p,g,w));const N={...m,measured:w,internals:{...m.internals,positionAbsolute:p,handleBounds:{source:Gn("source",h.nodeElement,E,d,m.id),target:Gn("target",h.nodeElement,E,d,m.id)}}};t.set(m.id,N),m.parentId&&bn(N,t,n,{nodeOrigin:r,zIndexMode:s}),a=!0,_&&(l.push({id:m.id,type:"dimensions",dimensions:w}),m.expandParent&&m.parentId&&f.push({id:m.id,parentId:m.parentId,rect:Fe(N,r)}))}}if(f.length>0){const h=En(f,t,n,r);l.push(...h)}return{changes:l,updatedInternals:a}}async function Jl({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:i}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,i]],o),c=!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2]);return Promise.resolve(c)}function to(e,t,n,o,r,i){let s=r;const c=o.get(s)||new Map;o.set(s,c.set(n,t)),s=`${r}-${e}`;const a=o.get(s)||new Map;if(o.set(s,a.set(n,t)),i){s=`${r}-${e}-${i}`;const l=o.get(s)||new Map;o.set(s,l.set(n,t))}}function yr(e,t,n){e.clear(),t.clear();for(const o of n){const{source:r,target:i,sourceHandle:s=null,targetHandle:c=null}=o,a={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:c},l=`${r}-${s}--${i}-${c}`,u=`${i}-${c}--${r}-${s}`;to("source",a,u,e,r,s),to("target",a,l,e,i,c),t.set(o.id,o)}}function xr(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:xr(n,t):!1}function no(e,t,n){let o=e;do{if(o?.matches?.(t))return!0;if(o===n)return!1;o=o?.parentElement}while(o);return!1}function eu(e,t,n,o){const r=new Map;for(const[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!xr(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){const c=e.get(i);c&&r.set(i,{id:i,position:c.position||{x:0,y:0},distance:{x:n.x-c.internals.positionAbsolute.x,y:n.y-c.internals.positionAbsolute.y},extent:c.extent,parentId:c.parentId,origin:c.origin,expandParent:c.expandParent,internals:{positionAbsolute:c.internals.positionAbsolute||{x:0,y:0}},measured:{width:c.measured.width??0,height:c.measured.height??0}})}return r}function Wt({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[s,c]of t){const a=n.get(s)?.internals.userNode;a&&r.push({...a,position:c.position,dragging:o})}if(!e)return[r[0],r];const i=n.get(e)?.internals.userNode;return[i?{...i,position:t.get(e)?.position||i.position,dragging:o}:r[0],r]}function tu({dragItems:e,snapGrid:t,x:n,y:o}){const r=e.values().next().value;if(!r)return null;const i={x:n-r.distance.x,y:o-r.distance.y},s=ct(i,t);return{x:s.x-i.x,y:s.y-i.y}}function nu({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,c=new Map,a=!1,l={x:0,y:0},u=null,d=!1,f=null,h=!1,m=!1,w=null;function _({noDragClassName:E,handleSelector:g,domNode:p,isSelectable:N,nodeId:S,nodeClickDistance:T=0}){f=le(p);function L({x:P,y:D}){const{nodeLookup:y,nodeExtent:I,snapGrid:v,snapToGrid:k,nodeOrigin:M,onNodeDrag:j,onSelectionDrag:B,onError:F,updateNodePositions:Y}=t();i={x:P,y:D};let X=!1;const O=c.size>1,x=O&&I?en(at(c)):null,z=O&&k?tu({dragItems:c,snapGrid:v,x:P,y:D}):null;for(const[V,H]of c){if(!y.has(V))continue;let W={x:P-H.distance.x,y:D-H.distance.y};k&&(W=z?{x:Math.round(W.x+z.x),y:Math.round(W.y+z.y)}:ct(W,v));let G=null;if(O&&I&&!H.extent&&x){const{positionAbsolute:Q}=H.internals,J=Q.x-x.x+I[0][0],ee=Q.x+H.measured.width-x.x2+I[1][0],ne=Q.y-x.y+I[0][1],ce=Q.y+H.measured.height-x.y2+I[1][1];G=[[J,ne],[ee,ce]]}const{position:q,positionAbsolute:U}=or({nodeId:V,nextPosition:W,nodeLookup:y,nodeExtent:G||I,nodeOrigin:M,onError:F});X=X||H.position.x!==q.x||H.position.y!==q.y,H.position=q,H.internals.positionAbsolute=U}if(m=m||X,!!X&&(Y(c,!0),w&&(o||j||!S&&B))){const[V,H]=Wt({nodeId:S,dragItems:c,nodeLookup:y});o?.(w,c,V,H),j?.(w,V,H),S||B?.(w,H)}}async function $(){if(!u)return;const{transform:P,panBy:D,autoPanSpeed:y,autoPanOnNodeDrag:I}=t();if(!I){a=!1,cancelAnimationFrame(s);return}const[v,k]=ir(l,u,y);(v!==0||k!==0)&&(i.x=(i.x??0)-v/P[2],i.y=(i.y??0)-k/P[2],await D({x:v,y:k})&&L(i)),s=requestAnimationFrame($)}function A(P){const{nodeLookup:D,multiSelectionActive:y,nodesDraggable:I,transform:v,snapGrid:k,snapToGrid:M,selectNodesOnDrag:j,onNodeDragStart:B,onSelectionDragStart:F,unselectNodesAndEdges:Y}=t();d=!0,(!j||!N)&&!y&&S&&(D.get(S)?.selected||Y()),N&&j&&S&&e?.(S);const X=Qe(P.sourceEvent,{transform:v,snapGrid:k,snapToGrid:M,containerBounds:u});if(i=X,c=eu(D,I,X,S),c.size>0&&(n||B||!S&&F)){const[O,x]=Wt({nodeId:S,dragItems:c,nodeLookup:D});n?.(P.sourceEvent,c,O,x),B?.(P.sourceEvent,O,x),S||F?.(P.sourceEvent,x)}}const C=Wo().clickDistance(T).on("start",P=>{const{domNode:D,nodeDragThreshold:y,transform:I,snapGrid:v,snapToGrid:k}=t();u=D?.getBoundingClientRect()||null,h=!1,m=!1,w=P.sourceEvent,y===0&&A(P),i=Qe(P.sourceEvent,{transform:I,snapGrid:v,snapToGrid:k,containerBounds:u}),l=ge(P.sourceEvent,u)}).on("drag",P=>{const{autoPanOnNodeDrag:D,transform:y,snapGrid:I,snapToGrid:v,nodeDragThreshold:k,nodeLookup:M}=t(),j=Qe(P.sourceEvent,{transform:y,snapGrid:I,snapToGrid:v,containerBounds:u});if(w=P.sourceEvent,(P.sourceEvent.type==="touchmove"&&P.sourceEvent.touches.length>1||S&&!M.has(S))&&(h=!0),!h){if(!a&&D&&d&&(a=!0,$()),!d){const B=ge(P.sourceEvent,u),F=B.x-l.x,Y=B.y-l.y;Math.sqrt(F*F+Y*Y)>k&&A(P)}(i.x!==j.xSnapped||i.y!==j.ySnapped)&&c&&d&&(l=ge(P.sourceEvent,u),L(j))}}).on("end",P=>{if(!(!d||h)&&(a=!1,d=!1,cancelAnimationFrame(s),c.size>0)){const{nodeLookup:D,updateNodePositions:y,onNodeDragStop:I,onSelectionDragStop:v}=t();if(m&&(y(c,!1),m=!1),r||I||!S&&v){const[k,M]=Wt({nodeId:S,dragItems:c,nodeLookup:D,dragging:!1});r?.(P.sourceEvent,c,k,M),I?.(P.sourceEvent,k,M),S||v?.(P.sourceEvent,M)}}}).filter(P=>{const D=P.target;return!P.button&&(!E||!no(D,`.${E}`,p))&&(!g||no(D,g,p))});f.call(C)}function b(){f?.on(".drag",null)}return{update:_,destroy:b}}function ou(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())nt(r,Fe(i))>0&&o.push(i);return o}const ru=250;function iu(e,t,n,o){let r=[],i=1/0;const s=ou(e,n,t+ru);for(const c of s){const a=[...c.internals.handleBounds?.source??[],...c.internals.handleBounds?.target??[]];for(const l of a){if(o.nodeId===l.nodeId&&o.type===l.type&&o.id===l.id)continue;const{x:u,y:d}=De(c,l,l.position,!0),f=Math.sqrt(Math.pow(u-e.x,2)+Math.pow(d-e.y,2));f>t||(f<i?(r=[{...l,x:u,y:d}],i=f):f===i&&r.push({...l,x:u,y:d}))}}if(!r.length)return null;if(r.length>1){const c=o.type==="source"?"target":"source";return r.find(a=>a.type===c)??r[0]}return r[0]}function wr(e,t,n,o,r,i=!1){const s=o.get(e);if(!s)return null;const c=r==="strict"?s.internals.handleBounds?.[t]:[...s.internals.handleBounds?.source??[],...s.internals.handleBounds?.target??[]],a=(n?c?.find(l=>l.id===n):c?.[0])??null;return a&&i?{...a,...De(s,a,a.position,!0)}:a}function vr(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function su(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const br=()=>!0;function au(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:c,nodeLookup:a,lib:l,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:h,onConnectStart:m,onConnect:w,onConnectEnd:_,isValidConnection:b=br,onReconnectEnd:E,updateConnection:g,getTransform:p,getFromHandle:N,autoPanSpeed:S,dragThreshold:T=1,handleDomNode:L}){const $=lr(e.target);let A=0,C;const{x:P,y:D}=ge(e),y=vr(i,L),I=c?.getBoundingClientRect();let v=!1;if(!I||!y)return;const k=wr(r,y,o,a,t);if(!k)return;let M=ge(e,I),j=!1,B=null,F=!1,Y=null;function X(){if(!u||!I)return;const[q,U]=ir(M,I,S);f({x:q,y:U}),A=requestAnimationFrame(X)}const O={...k,nodeId:r,type:y,position:k.position},x=a.get(r);let V={inProgress:!0,isValid:null,from:De(x,O,K.Left,!0),fromHandle:O,fromPosition:O.position,fromNode:x,to:M,toHandle:null,toPosition:Yn[O.position],toNode:null,pointer:M};function H(){v=!0,g(V),m?.(e,{nodeId:r,handleId:o,handleType:y})}T===0&&H();function W(q){if(!v){const{x:ce,y:de}=ge(q),ve=ce-P,Oe=de-D;if(!(ve*ve+Oe*Oe>T*T))return;H()}if(!N()||!O){G(q);return}const U=p();M=ge(q,I),C=iu(lt(M,U,!1,[1,1]),n,a,O),j||(X(),j=!0);const Q=Er(q,{handle:C,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:b,doc:$,lib:l,flowId:d,nodeLookup:a});Y=Q.handleDomNode,B=Q.connection,F=su(!!C,Q.isValid);const J=a.get(r),ee=J?De(J,O,K.Left,!0):V.from,ne={...V,from:ee,isValid:F,to:Q.toHandle&&F?Nt({x:Q.toHandle.x,y:Q.toHandle.y},U):M,toHandle:Q.toHandle,toPosition:F&&Q.toHandle?Q.toHandle.position:Yn[O.position],toNode:Q.toHandle?a.get(Q.toHandle.nodeId):null,pointer:M};g(ne),V=ne}function G(q){if(!("touches"in q&&q.touches.length>0)){if(v){(C||Y)&&B&&F&&w?.(B);const{inProgress:U,...Q}=V,J={...Q,toPosition:V.toHandle?V.toPosition:null};_?.(q,J),i&&E?.(q,J)}h(),cancelAnimationFrame(A),j=!1,F=!1,B=null,Y=null,$.removeEventListener("mousemove",W),$.removeEventListener("mouseup",G),$.removeEventListener("touchmove",W),$.removeEventListener("touchend",G)}}$.addEventListener("mousemove",W),$.addEventListener("mouseup",G),$.addEventListener("touchmove",W),$.addEventListener("touchend",G)}function Er(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:c,flowId:a,isValidConnection:l=br,nodeLookup:u}){const d=i==="target",f=t?s.querySelector(`.${c}-flow__handle[data-id="${a}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:h,y:m}=ge(e),w=s.elementFromPoint(h,m),_=w?.classList.contains(`${c}-flow__handle`)?w:f,b={handleDomNode:_,isValid:!1,connection:null,toHandle:null};if(_){const E=vr(void 0,_),g=_.getAttribute("data-nodeid"),p=_.getAttribute("data-handleid"),N=_.classList.contains("connectable"),S=_.classList.contains("connectableend");if(!g||!E)return b;const T={source:d?g:o,sourceHandle:d?p:r,target:d?o:g,targetHandle:d?r:p};b.connection=T;const $=N&&S&&(n===Ve.Strict?d&&E==="source"||!d&&E==="target":g!==o||p!==r);b.isValid=$&&l(T),b.toHandle=wr(g,E,p,u,n,!0)}return b}const rn={onPointerDown:au,isValid:Er};function cu({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=le(e);function i({translateExtent:c,width:a,height:l,zoomStep:u=1,pannable:d=!0,zoomable:f=!0,inversePan:h=!1}){const m=g=>{if(g.sourceEvent.type!=="wheel"||!t)return;const p=n(),N=g.sourceEvent.ctrlKey&&ot()?10:1,S=-g.sourceEvent.deltaY*(g.sourceEvent.deltaMode===1?.05:g.sourceEvent.deltaMode?1:.002)*u,T=p[2]*Math.pow(2,S*N);t.scaleTo(T)};let w=[0,0];const _=g=>{(g.sourceEvent.type==="mousedown"||g.sourceEvent.type==="touchstart")&&(w=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY])},b=g=>{const p=n();if(g.sourceEvent.type!=="mousemove"&&g.sourceEvent.type!=="touchmove"||!t)return;const N=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY],S=[N[0]-w[0],N[1]-w[1]];w=N;const T=o()*Math.max(p[2],Math.log(p[2]))*(h?-1:1),L={x:p[0]-S[0]*T,y:p[1]-S[1]*T},$=[[0,0],[a,l]];t.setViewportConstrained({x:L.x,y:L.y,zoom:p[2]},$,c)},E=Ko().on("start",_).on("zoom",d?b:null).on("zoom.wheel",f?m:null);r.call(E,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:fe}}const At=e=>({x:e.x,y:e.y,zoom:e.k}),Zt=({x:e,y:t,zoom:n})=>Ot.translate(e,t).scale(n),$e=(e,t)=>e.target.closest(`.${t}`),_r=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),lu=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Xt=(e,t=0,n=lu,o=()=>{})=>{const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},Nr=e=>{const t=e.ctrlKey&&ot()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function uu({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:c,onPanZoom:a,onPanZoomEnd:l}){return u=>{if($e(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();const d=n.property("__zoom").k||1;if(u.ctrlKey&&s){const _=fe(u),b=Nr(u),E=d*Math.pow(2,b);o.scaleTo(n,E,_,u);return}const f=u.deltaMode===1?20:1;let h=r===Pe.Vertical?0:u.deltaX*f,m=r===Pe.Horizontal?0:u.deltaY*f;!ot()&&u.shiftKey&&r!==Pe.Vertical&&(h=u.deltaY*f,m=0),o.translateBy(n,-(h/d)*i,-(m/d)*i,{internal:!0});const w=At(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(a?.(u,w),e.panScrollTimeout=setTimeout(()=>{l?.(u,w),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,c?.(u,w))}}function du({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const i=o.type==="wheel",s=!t&&i&&!o.ctrlKey,c=$e(o,e);if(o.ctrlKey&&i&&c&&o.preventDefault(),s||c)return null;o.preventDefault(),n.call(this,o,r)}}function fu({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=At(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=r,o.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(o.sourceEvent,r)}}function hu({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!!(n&&_r(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,At(i.transform))}}function gu({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&_r(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const c=At(s.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(s.sourceEvent,c)},n?150:0)}}}function pu({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:c,noPanClassName:a,lib:l,connectionInProgress:u}){return d=>{const f=e||t,h=n&&d.ctrlKey,m=d.type==="wheel";if(d.button===1&&d.type==="mousedown"&&($e(d,`${l}-flow__node`)||$e(d,`${l}-flow__edge`)))return!0;if(!o&&!f&&!r&&!i&&!n||s||u&&!m||$e(d,c)&&m||$e(d,a)&&(!m||r&&m&&!e)||!n&&d.ctrlKey&&m)return!1;if(!n&&d.type==="touchstart"&&d.touches?.length>1)return d.preventDefault(),!1;if(!f&&!r&&!h&&m||!o&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(o)&&!o.includes(d.button)&&d.type==="mousedown")return!1;const w=Array.isArray(o)&&o.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||m)&&w}}function mu({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:c,onDraggingChange:a}){const l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=Ko().scaleExtent([t,n]).translateExtent(o),f=le(e).call(d);E({x:r.x,y:r.y,zoom:Be(r.zoom,t,n)},[[0,0],[u.width,u.height]],o);const h=f.on("wheel.zoom"),m=f.on("dblclick.zoom");d.wheelDelta(Nr);function w(C,P){return f?new Promise(D=>{d?.interpolate(P?.interpolate==="linear"?Bt:yt).transform(Xt(f,P?.duration,P?.ease,()=>D(!0)),C)}):Promise.resolve(!1)}function _({noWheelClassName:C,noPanClassName:P,onPaneContextMenu:D,userSelectionActive:y,panOnScroll:I,panOnDrag:v,panOnScrollMode:k,panOnScrollSpeed:M,preventScrolling:j,zoomOnPinch:B,zoomOnScroll:F,zoomOnDoubleClick:Y,zoomActivationKeyPressed:X,lib:O,onTransformChange:x,connectionInProgress:z,paneClickDistance:V,selectionOnDrag:H}){y&&!l.isZoomingOrPanning&&b();const W=I&&!X&&!y;d.clickDistance(H?1/0:!he(V)||V<0?0:V);const G=W?uu({zoomPanValues:l,noWheelClassName:C,d3Selection:f,d3Zoom:d,panOnScrollMode:k,panOnScrollSpeed:M,zoomOnPinch:B,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:c}):du({noWheelClassName:C,preventScrolling:j,d3ZoomHandler:h});if(f.on("wheel.zoom",G,{passive:!1}),!y){const U=fu({zoomPanValues:l,onDraggingChange:a,onPanZoomStart:s});d.on("start",U);const Q=hu({zoomPanValues:l,panOnDrag:v,onPaneContextMenu:!!D,onPanZoom:i,onTransformChange:x});d.on("zoom",Q);const J=gu({zoomPanValues:l,panOnDrag:v,panOnScroll:I,onPaneContextMenu:D,onPanZoomEnd:c,onDraggingChange:a});d.on("end",J)}const q=pu({zoomActivationKeyPressed:X,panOnDrag:v,zoomOnScroll:F,panOnScroll:I,zoomOnDoubleClick:Y,zoomOnPinch:B,userSelectionActive:y,noPanClassName:P,noWheelClassName:C,lib:O,connectionInProgress:z});d.filter(q),Y?f.on("dblclick.zoom",m):f.on("dblclick.zoom",null)}function b(){d.on("zoom",null)}async function E(C,P,D){const y=Zt(C),I=d?.constrain()(y,P,D);return I&&await w(I),new Promise(v=>v(I))}async function g(C,P){const D=Zt(C);return await w(D,P),new Promise(y=>y(D))}function p(C){if(f){const P=Zt(C),D=f.property("__zoom");(D.k!==C.zoom||D.x!==C.x||D.y!==C.y)&&d?.transform(f,P,null,{sync:!0})}}function N(){const C=f?Uo(f.node()):{x:0,y:0,k:1};return{x:C.x,y:C.y,zoom:C.k}}function S(C,P){return f?new Promise(D=>{d?.interpolate(P?.interpolate==="linear"?Bt:yt).scaleTo(Xt(f,P?.duration,P?.ease,()=>D(!0)),C)}):Promise.resolve(!1)}function T(C,P){return f?new Promise(D=>{d?.interpolate(P?.interpolate==="linear"?Bt:yt).scaleBy(Xt(f,P?.duration,P?.ease,()=>D(!0)),C)}):Promise.resolve(!1)}function L(C){d?.scaleExtent(C)}function $(C){d?.translateExtent(C)}function A(C){const P=!he(C)||C<0?0:C;d?.clickDistance(P)}return{update:_,destroy:b,setViewport:g,setViewportConstrained:E,getViewport:N,scaleTo:S,scaleBy:T,setScaleExtent:L,setTranslateExtent:$,syncViewport:p,setClickDistance:A}}var We;(function(e){e.Line="line",e.Handle="handle"})(We||(We={}));function yu({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){const s=e-t,c=n-o,a=[s>0?1:s<0?-1:0,c>0?1:c<0?-1:0];return s&&r&&(a[0]=a[0]*-1),c&&i&&(a[1]=a[1]*-1),a}function oo(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),o=e.includes("left"),r=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:o,affectsY:r}}function Ce(e,t){return Math.max(0,t-e)}function ke(e,t){return Math.max(0,e-t)}function gt(e,t,n){return Math.max(0,t-e,e-n)}function ro(e,t){return e?!t:t}function xu(e,t,n,o,r,i,s,c){let{affectsX:a,affectsY:l}=t;const{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:h,ySnapped:m}=n,{minWidth:w,maxWidth:_,minHeight:b,maxHeight:E}=o,{x:g,y:p,width:N,height:S,aspectRatio:T}=e;let L=Math.floor(u?h-e.pointerX:0),$=Math.floor(d?m-e.pointerY:0);const A=N+(a?-L:L),C=S+(l?-$:$),P=-i[0]*N,D=-i[1]*S;let y=gt(A,w,_),I=gt(C,b,E);if(s){let M=0,j=0;a&&L<0?M=Ce(g+L+P,s[0][0]):!a&&L>0&&(M=ke(g+A+P,s[1][0])),l&&$<0?j=Ce(p+$+D,s[0][1]):!l&&$>0&&(j=ke(p+C+D,s[1][1])),y=Math.max(y,M),I=Math.max(I,j)}if(c){let M=0,j=0;a&&L>0?M=ke(g+L,c[0][0]):!a&&L<0&&(M=Ce(g+A,c[1][0])),l&&$>0?j=ke(p+$,c[0][1]):!l&&$<0&&(j=Ce(p+C,c[1][1])),y=Math.max(y,M),I=Math.max(I,j)}if(r){if(u){const M=gt(A/T,b,E)*T;if(y=Math.max(y,M),s){let j=0;!a&&!l||a&&!l&&f?j=ke(p+D+A/T,s[1][1])*T:j=Ce(p+D+(a?L:-L)/T,s[0][1])*T,y=Math.max(y,j)}if(c){let j=0;!a&&!l||a&&!l&&f?j=Ce(p+A/T,c[1][1])*T:j=ke(p+(a?L:-L)/T,c[0][1])*T,y=Math.max(y,j)}}if(d){const M=gt(C*T,w,_)/T;if(I=Math.max(I,M),s){let j=0;!a&&!l||l&&!a&&f?j=ke(g+C*T+P,s[1][0])/T:j=Ce(g+(l?$:-$)*T+P,s[0][0])/T,I=Math.max(I,j)}if(c){let j=0;!a&&!l||l&&!a&&f?j=Ce(g+C*T,c[1][0])/T:j=ke(g+(l?$:-$)*T,c[0][0])/T,I=Math.max(I,j)}}}$=$+($<0?I:-I),L=L+(L<0?y:-y),r&&(f?A>C*T?$=(ro(a,l)?-L:L)/T:L=(ro(a,l)?-$:$)*T:u?($=L/T,l=a):(L=$*T,a=l));const v=a?g+L:g,k=l?p+$:p;return{width:N+(a?-L:L),height:S+(l?-$:$),x:i[0]*L*(a?-1:1)+v,y:i[1]*$*(l?-1:1)+k}}const Sr={width:0,height:0,x:0,y:0},wu={...Sr,pointerX:0,pointerY:0,aspectRatio:1};function vu(e){return[[0,0],[e.measured.width,e.measured.height]]}function bu(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,c=n[0]*i,a=n[1]*s;return[[o-c,r-a],[o+i-c,r+s-a]]}function Eu({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const i=le(e);let s={controlDirection:oo("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function c({controlPosition:l,boundaries:u,keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:m,onResizeEnd:w,shouldResize:_}){let b={...Sr},E={...wu};s={boundaries:u,resizeDirection:f,keepAspectRatio:d,controlDirection:oo(l)};let g,p=null,N=[],S,T,L,$=!1;const A=Wo().on("start",C=>{const{nodeLookup:P,transform:D,snapGrid:y,snapToGrid:I,nodeOrigin:v,paneDomNode:k}=n();if(g=P.get(t),!g)return;p=k?.getBoundingClientRect()??null;const{xSnapped:M,ySnapped:j}=Qe(C.sourceEvent,{transform:D,snapGrid:y,snapToGrid:I,containerBounds:p});b={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},E={...b,pointerX:M,pointerY:j,aspectRatio:b.width/b.height},S=void 0,g.parentId&&(g.extent==="parent"||g.expandParent)&&(S=P.get(g.parentId),T=S&&g.extent==="parent"?vu(S):void 0),N=[],L=void 0;for(const[B,F]of P)if(F.parentId===t&&(N.push({id:B,position:{...F.position},extent:F.extent}),F.extent==="parent"||F.expandParent)){const Y=bu(F,g,F.origin??v);L?L=[[Math.min(Y[0][0],L[0][0]),Math.min(Y[0][1],L[0][1])],[Math.max(Y[1][0],L[1][0]),Math.max(Y[1][1],L[1][1])]]:L=Y}h?.(C,{...b})}).on("drag",C=>{const{transform:P,snapGrid:D,snapToGrid:y,nodeOrigin:I}=n(),v=Qe(C.sourceEvent,{transform:P,snapGrid:D,snapToGrid:y,containerBounds:p}),k=[];if(!g)return;const{x:M,y:j,width:B,height:F}=b,Y={},X=g.origin??I,{width:O,height:x,x:z,y:V}=xu(E,s.controlDirection,v,s.boundaries,s.keepAspectRatio,X,T,L),H=O!==B,W=x!==F,G=z!==M&&H,q=V!==j&&W;if(!G&&!q&&!H&&!W)return;if((G||q||X[0]===1||X[1]===1)&&(Y.x=G?z:b.x,Y.y=q?V:b.y,b.x=Y.x,b.y=Y.y,N.length>0)){const ee=z-M,ne=V-j;for(const ce of N)ce.position={x:ce.position.x-ee+X[0]*(O-B),y:ce.position.y-ne+X[1]*(x-F)},k.push(ce)}if((H||W)&&(Y.width=H&&(!s.resizeDirection||s.resizeDirection==="horizontal")?O:b.width,Y.height=W&&(!s.resizeDirection||s.resizeDirection==="vertical")?x:b.height,b.width=Y.width,b.height=Y.height),S&&g.expandParent){const ee=X[0]*(Y.width??0);Y.x&&Y.x<ee&&(b.x=ee,E.x=E.x-(Y.x-ee));const ne=X[1]*(Y.height??0);Y.y&&Y.y<ne&&(b.y=ne,E.y=E.y-(Y.y-ne))}const U=yu({width:b.width,prevWidth:B,height:b.height,prevHeight:F,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),Q={...b,direction:U};_?.(C,Q)!==!1&&($=!0,m?.(C,Q),o(Y,k))}).on("end",C=>{$&&(w?.(C,{...b}),r?.({...b}),$=!1)});i.call(A)}function a(){i.on(".drag",null)}return{update:c,destroy:a}}const _u={},io=e=>{let t;const n=new Set,o=(u,d)=>{const f=typeof u=="function"?u(t):u;if(!Object.is(f,t)){const h=t;t=d??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(m=>m(t,h))}},r=()=>t,a={setState:o,getState:r,getInitialState:()=>l,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(_u?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},l=t=e(o,r,a);return a},Nu=e=>e?io(e):io,{useDebugValue:Su}=hs,{useSyncExternalStoreWithSelector:Cu}=Cs,ku=e=>e;function Cr(e,t=ku,n){const o=Cu(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Su(o),o}const so=(e,t)=>{const n=Nu(e),o=(r,i=t)=>Cr(n,r,i);return Object.assign(o,n),o},Mu=(e,t)=>e?so(e,t):so;function re(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[o,r]of e)if(!Object.is(r,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}const Dt=Z.createContext(null),Iu=Dt.Provider,kr=xe.error001();function te(e,t){const n=Z.useContext(Dt);if(n===null)throw new Error(kr);return Cr(n,e,t)}function ie(){const e=Z.useContext(Dt);if(e===null)throw new Error(kr);return Z.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const ao={display:"none"},Ou={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Mr="react-flow__node-desc",Ir="react-flow__edge-desc",Tu="react-flow__aria-live",Pu=e=>e.ariaLiveMessage,Au=e=>e.ariaLabelConfig;function Du({rfId:e}){const t=te(Pu);return R.jsx("div",{id:`${Tu}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Ou,children:t})}function Lu({rfId:e,disableKeyboardA11y:t}){const n=te(Au);return R.jsxs(R.Fragment,{children:[R.jsx("div",{id:`${Mr}-${e}`,style:ao,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),R.jsx("div",{id:`${Ir}-${e}`,style:ao,children:n["edge.a11yDescription.default"]}),!t&&R.jsx(Du,{rfId:e})]})}const Lt=Z.forwardRef(({position:e="top-left",children:t,className:n,style:o,...r},i)=>{const s=`${e}`.split("-");return R.jsx("div",{className:ae(["react-flow__panel",n,...s]),style:o,ref:i,...r,children:t})});Lt.displayName="Panel";function ju({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:R.jsx(Lt,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:R.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const $u=e=>{const t=[],n=[];for(const[,o]of e.nodeLookup)o.selected&&t.push(o.internals.userNode);for(const[,o]of e.edgeLookup)o.selected&&n.push(o);return{selectedNodes:t,selectedEdges:n}},pt=e=>e.id;function zu(e,t){return re(e.selectedNodes.map(pt),t.selectedNodes.map(pt))&&re(e.selectedEdges.map(pt),t.selectedEdges.map(pt))}function Ru({onSelectionChange:e}){const t=ie(),{selectedNodes:n,selectedEdges:o}=te($u,zu);return Z.useEffect(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(i=>i(r))},[n,o,e]),null}const Hu=e=>!!e.onSelectionChangeHandlers;function Vu({onSelectionChange:e}){const t=te(Hu);return e||t?R.jsx(Ru,{onSelectionChange:e}):null}const Or=[0,0],Bu={x:0,y:0,zoom:1},Fu=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],co=[...Fu,"rfId"],Yu=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),lo={translateExtent:et,nodeOrigin:Or,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Wu(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:c,setDefaultNodesAndEdges:a}=te(Yu,re),l=ie();Z.useEffect(()=>(a(e.defaultNodes,e.defaultEdges),()=>{u.current=lo,c()}),[]);const u=Z.useRef(lo);return Z.useEffect(()=>{for(const d of co){const f=e[d],h=u.current[d];f!==h&&(typeof e[d]>"u"||(d==="nodes"?t(f):d==="edges"?n(f):d==="minZoom"?o(f):d==="maxZoom"?r(f):d==="translateExtent"?i(f):d==="nodeExtent"?s(f):d==="ariaLabelConfig"?l.setState({ariaLabelConfig:Dl(f)}):d==="fitView"?l.setState({fitViewQueued:f}):d==="fitViewOptions"?l.setState({fitViewOptions:f}):l.setState({[d]:f})))}u.current=e},co.map(d=>e[d])),null}function uo(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Zu(e){const[t,n]=Z.useState(e==="system"?null:e);return Z.useEffect(()=>{if(e!=="system"){n(e);return}const o=uo(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:uo()?.matches?"dark":"light"}const fo=typeof document<"u"?document:null;function rt(e=null,t={target:fo,actInsideInputWithModifier:!0}){const[n,o]=Z.useState(!1),r=Z.useRef(!1),i=Z.useRef(new Set([])),[s,c]=Z.useMemo(()=>{if(e!==null){const l=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.replace("+",`
1
+ import{j as R}from"./vendor-query-CqA1cBNl.js";import{d as hs,r as Z,b as gs}from"./vendor-react-BfuodpLv.js";import{l as ps,m as ms,u as ys,b as xs}from"./index-C26pxqlr.js";import{C as Ht,a as Dn,b as Ln,c as Vt}from"./card-B0vNsxr_.js";import{S as jn}from"./skeleton-DQJ-n00q.js";import{d as cn,T as ws,t as vs,n as bs}from"./timer-DWAvo6M8.js";import{i as Es,h as $n,j as zn,k as _s,l as Ns,m as Ss,n as yt,o as Bt,u as Cs}from"./vendor-recharts-BkwZfCWA.js";import"./vendor-icons-BYlYobEK.js";import"./vendor-ui-Qm4_4bAc.js";function ae(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,o;n<e.length;n++)(o=ae(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Ut="http://www.w3.org/1999/xhtml";const Rn={svg:"http://www.w3.org/2000/svg",xhtml:Ut,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Mt(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Rn.hasOwnProperty(t)?{space:Rn[t],local:e}:e}function ks(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Ut&&t.documentElement.namespaceURI===Ut?t.createElement(e):t.createElementNS(n,e)}}function Ms(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function To(e){var t=Mt(e);return(t.local?Ms:ks)(t)}function Is(){}function ln(e){return e==null?Is:function(){return this.querySelector(e)}}function Os(e){typeof e!="function"&&(e=ln(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,c=o[r]=new Array(s),a,l,u=0;u<s;++u)(a=i[u])&&(l=e.call(a,a.__data__,u,i))&&("__data__"in a&&(l.__data__=a.__data__),c[u]=l);return new ue(o,this._parents)}function Ts(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Ps(){return[]}function Po(e){return e==null?Ps:function(){return this.querySelectorAll(e)}}function As(e){return function(){return Ts(e.apply(this,arguments))}}function Ds(e){typeof e=="function"?e=As(e):e=Po(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var s=t[i],c=s.length,a,l=0;l<c;++l)(a=s[l])&&(o.push(e.call(a,a.__data__,l,s)),r.push(a));return new ue(o,r)}function Ao(e){return function(){return this.matches(e)}}function Do(e){return function(t){return t.matches(e)}}var Ls=Array.prototype.find;function js(e){return function(){return Ls.call(this.children,e)}}function $s(){return this.firstElementChild}function zs(e){return this.select(e==null?$s:js(typeof e=="function"?e:Do(e)))}var Rs=Array.prototype.filter;function Hs(){return Array.from(this.children)}function Vs(e){return function(){return Rs.call(this.children,e)}}function Bs(e){return this.selectAll(e==null?Hs:Vs(typeof e=="function"?e:Do(e)))}function Fs(e){typeof e!="function"&&(e=Ao(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,c=o[r]=[],a,l=0;l<s;++l)(a=i[l])&&e.call(a,a.__data__,l,i)&&c.push(a);return new ue(o,this._parents)}function Lo(e){return new Array(e.length)}function Ys(){return new ue(this._enter||this._groups.map(Lo),this._parents)}function bt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}bt.prototype={constructor:bt,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Ws(e){return function(){return e}}function Zs(e,t,n,o,r,i){for(var s=0,c,a=t.length,l=i.length;s<l;++s)(c=t[s])?(c.__data__=i[s],o[s]=c):n[s]=new bt(e,i[s]);for(;s<a;++s)(c=t[s])&&(r[s]=c)}function Xs(e,t,n,o,r,i,s){var c,a,l=new Map,u=t.length,d=i.length,f=new Array(u),h;for(c=0;c<u;++c)(a=t[c])&&(f[c]=h=s.call(a,a.__data__,c,t)+"",l.has(h)?r[c]=a:l.set(h,a));for(c=0;c<d;++c)h=s.call(e,i[c],c,i)+"",(a=l.get(h))?(o[c]=a,a.__data__=i[c],l.delete(h)):n[c]=new bt(e,i[c]);for(c=0;c<u;++c)(a=t[c])&&l.get(f[c])===a&&(r[c]=a)}function Gs(e){return e.__data__}function qs(e,t){if(!arguments.length)return Array.from(this,Gs);var n=t?Xs:Zs,o=this._parents,r=this._groups;typeof e!="function"&&(e=Ws(e));for(var i=r.length,s=new Array(i),c=new Array(i),a=new Array(i),l=0;l<i;++l){var u=o[l],d=r[l],f=d.length,h=Us(e.call(u,u&&u.__data__,l,o)),m=h.length,w=c[l]=new Array(m),_=s[l]=new Array(m),b=a[l]=new Array(f);n(u,d,w,_,b,h,t);for(var E=0,g=0,p,N;E<m;++E)if(p=w[E]){for(E>=g&&(g=E+1);!(N=_[g])&&++g<m;);p._next=N||null}}return s=new ue(s,o),s._enter=c,s._exit=a,s}function Us(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Ks(){return new ue(this._exit||this._groups.map(Lo),this._parents)}function Qs(e,t,n){var o=this.enter(),r=this,i=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),t!=null&&(r=t(r),r&&(r=r.selection())),n==null?i.remove():n(i),o&&r?o.merge(r).order():r}function Js(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,i=o.length,s=Math.min(r,i),c=new Array(r),a=0;a<s;++a)for(var l=n[a],u=o[a],d=l.length,f=c[a]=new Array(d),h,m=0;m<d;++m)(h=l[m]||u[m])&&(f[m]=h);for(;a<r;++a)c[a]=n[a];return new ue(c,this._parents)}function ea(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],r=o.length-1,i=o[r],s;--r>=0;)(s=o[r])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function ta(e){e||(e=na);function t(d,f){return d&&f?e(d.__data__,f.__data__):!d-!f}for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var s=n[i],c=s.length,a=r[i]=new Array(c),l,u=0;u<c;++u)(l=s[u])&&(a[u]=l);a.sort(t)}return new ue(r,this._parents).order()}function na(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function oa(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function ra(){return Array.from(this)}function ia(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length;r<i;++r){var s=o[r];if(s)return s}return null}function sa(){let e=0;for(const t of this)++e;return e}function aa(){return!this.node()}function ca(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r=t[n],i=0,s=r.length,c;i<s;++i)(c=r[i])&&e.call(c,c.__data__,i,r);return this}function la(e){return function(){this.removeAttribute(e)}}function ua(e){return function(){this.removeAttributeNS(e.space,e.local)}}function da(e,t){return function(){this.setAttribute(e,t)}}function fa(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function ha(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function ga(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function pa(e,t){var n=Mt(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((t==null?n.local?ua:la:typeof t=="function"?n.local?ga:ha:n.local?fa:da)(n,t))}function jo(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function ma(e){return function(){this.style.removeProperty(e)}}function ya(e,t,n){return function(){this.style.setProperty(e,t,n)}}function xa(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function wa(e,t,n){return arguments.length>1?this.each((t==null?ma:typeof t=="function"?xa:ya)(e,t,n??"")):He(this.node(),e)}function He(e,t){return e.style.getPropertyValue(t)||jo(e).getComputedStyle(e,null).getPropertyValue(t)}function va(e){return function(){delete this[e]}}function ba(e,t){return function(){this[e]=t}}function Ea(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function _a(e,t){return arguments.length>1?this.each((t==null?va:typeof t=="function"?Ea:ba)(e,t)):this.node()[e]}function $o(e){return e.trim().split(/^|\s+/)}function un(e){return e.classList||new zo(e)}function zo(e){this._node=e,this._names=$o(e.getAttribute("class")||"")}zo.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Ro(e,t){for(var n=un(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function Ho(e,t){for(var n=un(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function Na(e){return function(){Ro(this,e)}}function Sa(e){return function(){Ho(this,e)}}function Ca(e,t){return function(){(t.apply(this,arguments)?Ro:Ho)(this,e)}}function ka(e,t){var n=$o(e+"");if(arguments.length<2){for(var o=un(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?Ca:t?Na:Sa)(n,t))}function Ma(){this.textContent=""}function Ia(e){return function(){this.textContent=e}}function Oa(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Ta(e){return arguments.length?this.each(e==null?Ma:(typeof e=="function"?Oa:Ia)(e)):this.node().textContent}function Pa(){this.innerHTML=""}function Aa(e){return function(){this.innerHTML=e}}function Da(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function La(e){return arguments.length?this.each(e==null?Pa:(typeof e=="function"?Da:Aa)(e)):this.node().innerHTML}function ja(){this.nextSibling&&this.parentNode.appendChild(this)}function $a(){return this.each(ja)}function za(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Ra(){return this.each(za)}function Ha(e){var t=typeof e=="function"?e:To(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Va(){return null}function Ba(e,t){var n=typeof e=="function"?e:To(e),o=t==null?Va:typeof t=="function"?t:ln(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function Fa(){var e=this.parentNode;e&&e.removeChild(this)}function Ya(){return this.each(Fa)}function Wa(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Za(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Xa(e){return this.select(e?Za:Wa)}function Ga(e){return arguments.length?this.property("__data__",e):this.node().__data__}function qa(e){return function(t){e.call(this,t,this.__data__)}}function Ua(e){return e.trim().split(/^|\s+/).map(function(t){var n="",o=t.indexOf(".");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{type:t,name:n}})}function Ka(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,r=t.length,i;n<r;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++o]=i;++o?t.length=o:delete this.__on}}}function Qa(e,t,n){return function(){var o=this.__on,r,i=qa(t);if(o){for(var s=0,c=o.length;s<c;++s)if((r=o[s]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=n),r.value=t;return}}this.addEventListener(e.type,i,n),r={type:e.type,name:e.name,value:t,listener:i,options:n},o?o.push(r):this.__on=[r]}}function Ja(e,t,n){var o=Ua(e+""),r,i=o.length,s;if(arguments.length<2){var c=this.node().__on;if(c){for(var a=0,l=c.length,u;a<l;++a)for(r=0,u=c[a];r<i;++r)if((s=o[r]).type===u.type&&s.name===u.name)return u.value}return}for(c=t?Qa:Ka,r=0;r<i;++r)this.each(c(o[r],t,n));return this}function Vo(e,t,n){var o=jo(e),r=o.CustomEvent;typeof r=="function"?r=new r(t,n):(r=o.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function ec(e,t){return function(){return Vo(this,e,t)}}function tc(e,t){return function(){return Vo(this,e,t.apply(this,arguments))}}function nc(e,t){return this.each((typeof t=="function"?tc:ec)(e,t))}function*oc(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length,s;r<i;++r)(s=o[r])&&(yield s)}var Bo=[null];function ue(e,t){this._groups=e,this._parents=t}function it(){return new ue([[document.documentElement]],Bo)}function rc(){return this}ue.prototype=it.prototype={constructor:ue,select:Os,selectAll:Ds,selectChild:zs,selectChildren:Bs,filter:Fs,data:qs,enter:Ys,exit:Ks,join:Qs,merge:Js,selection:rc,order:ea,sort:ta,call:oa,nodes:ra,node:ia,size:sa,empty:aa,each:ca,attr:pa,style:wa,property:_a,classed:ka,text:Ta,html:La,raise:$a,lower:Ra,append:Ha,insert:Ba,remove:Ya,clone:Xa,datum:Ga,on:Ja,dispatch:nc,[Symbol.iterator]:oc};function le(e){return typeof e=="string"?new ue([[document.querySelector(e)]],[document.documentElement]):new ue([[e]],Bo)}function ic(e){let t;for(;t=e.sourceEvent;)e=t;return e}function fe(e,t){if(e=ic(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,o=o.matrixTransform(t.getScreenCTM().inverse()),[o.x,o.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}const sc={passive:!1},Je={capture:!0,passive:!1};function Ft(e){e.stopImmediatePropagation()}function Re(e){e.preventDefault(),e.stopImmediatePropagation()}function Fo(e){var t=e.document.documentElement,n=le(e).on("dragstart.drag",Re,Je);"onselectstart"in t?n.on("selectstart.drag",Re,Je):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Yo(e,t){var n=e.document.documentElement,o=le(e).on("dragstart.drag",null);t&&(o.on("click.drag",Re,Je),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const dt=e=>()=>e;function Kt(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,y:c,dx:a,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:c,enumerable:!0,configurable:!0},dx:{value:a,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}Kt.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function ac(e){return!e.ctrlKey&&!e.button}function cc(){return this.parentNode}function lc(e,t){return t??{x:e.x,y:e.y}}function uc(){return navigator.maxTouchPoints||"ontouchstart"in this}function Wo(){var e=ac,t=cc,n=lc,o=uc,r={},i=cn("start","drag","end"),s=0,c,a,l,u,d=0;function f(p){p.on("mousedown.drag",h).filter(o).on("touchstart.drag",_).on("touchmove.drag",b,sc).on("touchend.drag touchcancel.drag",E).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(p,N){if(!(u||!e.call(this,p,N))){var S=g(this,t.call(this,p,N),p,N,"mouse");S&&(le(p.view).on("mousemove.drag",m,Je).on("mouseup.drag",w,Je),Fo(p.view),Ft(p),l=!1,c=p.clientX,a=p.clientY,S("start",p))}}function m(p){if(Re(p),!l){var N=p.clientX-c,S=p.clientY-a;l=N*N+S*S>d}r.mouse("drag",p)}function w(p){le(p.view).on("mousemove.drag mouseup.drag",null),Yo(p.view,l),Re(p),r.mouse("end",p)}function _(p,N){if(e.call(this,p,N)){var S=p.changedTouches,T=t.call(this,p,N),L=S.length,$,A;for($=0;$<L;++$)(A=g(this,T,p,N,S[$].identifier,S[$]))&&(Ft(p),A("start",p,S[$]))}}function b(p){var N=p.changedTouches,S=N.length,T,L;for(T=0;T<S;++T)(L=r[N[T].identifier])&&(Re(p),L("drag",p,N[T]))}function E(p){var N=p.changedTouches,S=N.length,T,L;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),T=0;T<S;++T)(L=r[N[T].identifier])&&(Ft(p),L("end",p,N[T]))}function g(p,N,S,T,L,$){var A=i.copy(),C=fe($||S,N),P,D,y;if((y=n.call(p,new Kt("beforestart",{sourceEvent:S,target:f,identifier:L,active:s,x:C[0],y:C[1],dx:0,dy:0,dispatch:A}),T))!=null)return P=y.x-C[0]||0,D=y.y-C[1]||0,function I(v,k,M){var j=C,B;switch(v){case"start":r[L]=I,B=s++;break;case"end":delete r[L],--s;case"drag":C=fe(M||k,N),B=s;break}A.call(v,p,new Kt(v,{sourceEvent:k,subject:y,target:f,identifier:L,active:B,x:C[0]+P,y:C[1]+D,dx:C[0]-j[0],dy:C[1]-j[1],dispatch:A}),T)}}return f.filter=function(p){return arguments.length?(e=typeof p=="function"?p:dt(!!p),f):e},f.container=function(p){return arguments.length?(t=typeof p=="function"?p:dt(p),f):t},f.subject=function(p){return arguments.length?(n=typeof p=="function"?p:dt(p),f):n},f.touchable=function(p){return arguments.length?(o=typeof p=="function"?p:dt(!!p),f):o},f.on=function(){var p=i.on.apply(i,arguments);return p===i?f:p},f.clickDistance=function(p){return arguments.length?(d=(p=+p)*p,f):Math.sqrt(d)},f}function Hn(e,t,n){var o=new ws;return t=t==null?0:+t,o.restart(r=>{o.stop(),e(r+t)},t,n),o}var dc=cn("start","end","cancel","interrupt"),fc=[],Zo=0,Vn=1,Qt=2,xt=3,Bn=4,Jt=5,wt=6;function It(e,t,n,o,r,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;hc(e,n,{name:t,index:o,group:r,on:dc,tween:fc,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Zo})}function dn(e,t){var n=me(e,t);if(n.state>Zo)throw new Error("too late; already scheduled");return n}function we(e,t){var n=me(e,t);if(n.state>xt)throw new Error("too late; already running");return n}function me(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function hc(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=vs(i,0,n.time);function i(l){n.state=Vn,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var u,d,f,h;if(n.state!==Vn)return a();for(u in o)if(h=o[u],h.name===n.name){if(h.state===xt)return Hn(s);h.state===Bn?(h.state=wt,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete o[u]):+u<t&&(h.state=wt,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete o[u])}if(Hn(function(){n.state===xt&&(n.state=Bn,n.timer.restart(c,n.delay,n.time),c(l))}),n.state=Qt,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Qt){for(n.state=xt,r=new Array(f=n.tween.length),u=0,d=-1;u<f;++u)(h=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(r[++d]=h);r.length=d+1}}function c(l){for(var u=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(a),n.state=Jt,1),d=-1,f=r.length;++d<f;)r[d].call(e,u);n.state===Jt&&(n.on.call("end",e,e.__data__,n.index,n.group),a())}function a(){n.state=wt,n.timer.stop(),delete o[t];for(var l in o)return;delete e.__transition}}function vt(e,t){var n=e.__transition,o,r,i=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((o=n[s]).name!==t){i=!1;continue}r=o.state>Qt&&o.state<Jt,o.state=wt,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[s]}i&&delete e.__transition}}function gc(e){return this.each(function(){vt(this,e)})}function pc(e,t){var n,o;return function(){var r=we(this,e),i=r.tween;if(i!==n){o=n=i;for(var s=0,c=o.length;s<c;++s)if(o[s].name===t){o=o.slice(),o.splice(s,1);break}}r.tween=o}}function mc(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var i=we(this,e),s=i.tween;if(s!==o){r=(o=s).slice();for(var c={name:t,value:n},a=0,l=r.length;a<l;++a)if(r[a].name===t){r[a]=c;break}a===l&&r.push(c)}i.tween=r}}function yc(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=me(this.node(),n).tween,r=0,i=o.length,s;r<i;++r)if((s=o[r]).name===e)return s.value;return null}return this.each((t==null?pc:mc)(n,e,t))}function fn(e,t,n){var o=e._id;return e.each(function(){var r=we(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return me(r,o).value[t]}}function Xo(e,t){var n;return(typeof t=="number"?Es:t instanceof $n?zn:(n=$n(t))?(t=n,zn):_s)(e,t)}function xc(e){return function(){this.removeAttribute(e)}}function wc(e){return function(){this.removeAttributeNS(e.space,e.local)}}function vc(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttribute(e);return s===r?null:s===o?i:i=t(o=s,n)}}function bc(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttributeNS(e.space,e.local);return s===r?null:s===o?i:i=t(o=s,n)}}function Ec(e,t,n){var o,r,i;return function(){var s,c=n(this),a;return c==null?void this.removeAttribute(e):(s=this.getAttribute(e),a=c+"",s===a?null:s===o&&a===r?i:(r=a,i=t(o=s,c)))}}function _c(e,t,n){var o,r,i;return function(){var s,c=n(this),a;return c==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),a=c+"",s===a?null:s===o&&a===r?i:(r=a,i=t(o=s,c)))}}function Nc(e,t){var n=Mt(e),o=n==="transform"?Ns:Xo;return this.attrTween(e,typeof t=="function"?(n.local?_c:Ec)(n,o,fn(this,"attr."+e,t)):t==null?(n.local?wc:xc)(n):(n.local?bc:vc)(n,o,t))}function Sc(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Cc(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function kc(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Cc(e,i)),n}return r._value=t,r}function Mc(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Sc(e,i)),n}return r._value=t,r}function Ic(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var o=Mt(e);return this.tween(n,(o.local?kc:Mc)(o,t))}function Oc(e,t){return function(){dn(this,e).delay=+t.apply(this,arguments)}}function Tc(e,t){return t=+t,function(){dn(this,e).delay=t}}function Pc(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Oc:Tc)(t,e)):me(this.node(),t).delay}function Ac(e,t){return function(){we(this,e).duration=+t.apply(this,arguments)}}function Dc(e,t){return t=+t,function(){we(this,e).duration=t}}function Lc(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Ac:Dc)(t,e)):me(this.node(),t).duration}function jc(e,t){if(typeof t!="function")throw new Error;return function(){we(this,e).ease=t}}function $c(e){var t=this._id;return arguments.length?this.each(jc(t,e)):me(this.node(),t).ease}function zc(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;we(this,e).ease=n}}function Rc(e){if(typeof e!="function")throw new Error;return this.each(zc(this._id,e))}function Hc(e){typeof e!="function"&&(e=Ao(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,c=o[r]=[],a,l=0;l<s;++l)(a=i[l])&&e.call(a,a.__data__,l,i)&&c.push(a);return new _e(o,this._parents,this._name,this._id)}function Vc(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,i=Math.min(o,r),s=new Array(o),c=0;c<i;++c)for(var a=t[c],l=n[c],u=a.length,d=s[c]=new Array(u),f,h=0;h<u;++h)(f=a[h]||l[h])&&(d[h]=f);for(;c<o;++c)s[c]=t[c];return new _e(s,this._parents,this._name,this._id)}function Bc(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function Fc(e,t,n){var o,r,i=Bc(t)?dn:we;return function(){var s=i(this,e),c=s.on;c!==o&&(r=(o=c).copy()).on(t,n),s.on=r}}function Yc(e,t){var n=this._id;return arguments.length<2?me(this.node(),n).on.on(e):this.each(Fc(n,e,t))}function Wc(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Zc(){return this.on("end.remove",Wc(this._id))}function Xc(e){var t=this._name,n=this._id;typeof e!="function"&&(e=ln(e));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var c=o[s],a=c.length,l=i[s]=new Array(a),u,d,f=0;f<a;++f)(u=c[f])&&(d=e.call(u,u.__data__,f,c))&&("__data__"in u&&(d.__data__=u.__data__),l[f]=d,It(l[f],t,n,f,l,me(u,n)));return new _e(i,this._parents,t,n)}function Gc(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Po(e));for(var o=this._groups,r=o.length,i=[],s=[],c=0;c<r;++c)for(var a=o[c],l=a.length,u,d=0;d<l;++d)if(u=a[d]){for(var f=e.call(u,u.__data__,d,a),h,m=me(u,n),w=0,_=f.length;w<_;++w)(h=f[w])&&It(h,t,n,w,f,m);i.push(f),s.push(u)}return new _e(i,s,t,n)}var qc=it.prototype.constructor;function Uc(){return new qc(this._groups,this._parents)}function Kc(e,t){var n,o,r;return function(){var i=He(this,e),s=(this.style.removeProperty(e),He(this,e));return i===s?null:i===n&&s===o?r:r=t(n=i,o=s)}}function Go(e){return function(){this.style.removeProperty(e)}}function Qc(e,t,n){var o,r=n+"",i;return function(){var s=He(this,e);return s===r?null:s===o?i:i=t(o=s,n)}}function Jc(e,t,n){var o,r,i;return function(){var s=He(this,e),c=n(this),a=c+"";return c==null&&(a=c=(this.style.removeProperty(e),He(this,e))),s===a?null:s===o&&a===r?i:(r=a,i=t(o=s,c))}}function el(e,t){var n,o,r,i="style."+t,s="end."+i,c;return function(){var a=we(this,e),l=a.on,u=a.value[i]==null?c||(c=Go(t)):void 0;(l!==n||r!==u)&&(o=(n=l).copy()).on(s,r=u),a.on=o}}function tl(e,t,n){var o=(e+="")=="transform"?Ss:Xo;return t==null?this.styleTween(e,Kc(e,o)).on("end.style."+e,Go(e)):typeof t=="function"?this.styleTween(e,Jc(e,o,fn(this,"style."+e,t))).each(el(this._id,e)):this.styleTween(e,Qc(e,o,t),n).on("end.style."+e,null)}function nl(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function ol(e,t,n){var o,r;function i(){var s=t.apply(this,arguments);return s!==r&&(o=(r=s)&&nl(e,s,n)),o}return i._value=t,i}function rl(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;return this.tween(o,ol(e,t,n??""))}function il(e){return function(){this.textContent=e}}function sl(e){return function(){var t=e(this);this.textContent=t??""}}function al(e){return this.tween("text",typeof e=="function"?sl(fn(this,"text",e)):il(e==null?"":e+""))}function cl(e){return function(t){this.textContent=e.call(this,t)}}function ll(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&cl(r)),t}return o._value=e,o}function ul(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,ll(e))}function dl(){for(var e=this._name,t=this._id,n=qo(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],c=s.length,a,l=0;l<c;++l)if(a=s[l]){var u=me(a,t);It(a,e,n,l,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new _e(o,this._parents,e,n)}function fl(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var c={value:s},a={value:function(){--r===0&&i()}};n.each(function(){var l=we(this,o),u=l.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(c),t._.interrupt.push(c),t._.end.push(a)),l.on=t}),r===0&&i()})}var hl=0;function _e(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function qo(){return++hl}var be=it.prototype;_e.prototype={constructor:_e,select:Xc,selectAll:Gc,selectChild:be.selectChild,selectChildren:be.selectChildren,filter:Hc,merge:Vc,selection:Uc,transition:dl,call:be.call,nodes:be.nodes,node:be.node,size:be.size,empty:be.empty,each:be.each,on:Yc,attr:Nc,attrTween:Ic,style:tl,styleTween:rl,text:al,textTween:ul,remove:Zc,tween:yc,delay:Pc,duration:Lc,ease:$c,easeVarying:Rc,end:fl,[Symbol.iterator]:be[Symbol.iterator]};function gl(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var pl={time:null,delay:0,duration:250,ease:gl};function ml(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function yl(e){var t,n;e instanceof _e?(t=e._id,e=e._name):(t=qo(),(n=pl).time=bs(),e=e==null?null:e+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],c=s.length,a,l=0;l<c;++l)(a=s[l])&&It(a,e,t,l,s,n||ml(a,t));return new _e(o,this._parents,e,t)}it.prototype.interrupt=gc;it.prototype.transition=yl;const ft=e=>()=>e;function xl(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function Ee(e,t,n){this.k=e,this.x=t,this.y=n}Ee.prototype={constructor:Ee,scale:function(e){return e===1?this:new Ee(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ee(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Ot=new Ee(1,0,0);Uo.prototype=Ee.prototype;function Uo(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Ot;return e.__zoom}function Yt(e){e.stopImmediatePropagation()}function Ke(e){e.preventDefault(),e.stopImmediatePropagation()}function wl(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function vl(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Fn(){return this.__zoom||Ot}function bl(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function El(){return navigator.maxTouchPoints||"ontouchstart"in this}function _l(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function Ko(){var e=wl,t=vl,n=_l,o=bl,r=El,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],c=250,a=yt,l=cn("start","zoom","end"),u,d,f,h=500,m=150,w=0,_=10;function b(y){y.property("__zoom",Fn).on("wheel.zoom",L,{passive:!1}).on("mousedown.zoom",$).on("dblclick.zoom",A).filter(r).on("touchstart.zoom",C).on("touchmove.zoom",P).on("touchend.zoom touchcancel.zoom",D).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(y,I,v,k){var M=y.selection?y.selection():y;M.property("__zoom",Fn),y!==M?N(y,I,v,k):M.interrupt().each(function(){S(this,arguments).event(k).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},b.scaleBy=function(y,I,v,k){b.scaleTo(y,function(){var M=this.__zoom.k,j=typeof I=="function"?I.apply(this,arguments):I;return M*j},v,k)},b.scaleTo=function(y,I,v,k){b.transform(y,function(){var M=t.apply(this,arguments),j=this.__zoom,B=v==null?p(M):typeof v=="function"?v.apply(this,arguments):v,F=j.invert(B),Y=typeof I=="function"?I.apply(this,arguments):I;return n(g(E(j,Y),B,F),M,s)},v,k)},b.translateBy=function(y,I,v,k){b.transform(y,function(){return n(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof v=="function"?v.apply(this,arguments):v),t.apply(this,arguments),s)},null,k)},b.translateTo=function(y,I,v,k,M){b.transform(y,function(){var j=t.apply(this,arguments),B=this.__zoom,F=k==null?p(j):typeof k=="function"?k.apply(this,arguments):k;return n(Ot.translate(F[0],F[1]).scale(B.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof v=="function"?-v.apply(this,arguments):-v),j,s)},k,M)};function E(y,I){return I=Math.max(i[0],Math.min(i[1],I)),I===y.k?y:new Ee(I,y.x,y.y)}function g(y,I,v){var k=I[0]-v[0]*y.k,M=I[1]-v[1]*y.k;return k===y.x&&M===y.y?y:new Ee(y.k,k,M)}function p(y){return[(+y[0][0]+ +y[1][0])/2,(+y[0][1]+ +y[1][1])/2]}function N(y,I,v,k){y.on("start.zoom",function(){S(this,arguments).event(k).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(k).end()}).tween("zoom",function(){var M=this,j=arguments,B=S(M,j).event(k),F=t.apply(M,j),Y=v==null?p(F):typeof v=="function"?v.apply(M,j):v,X=Math.max(F[1][0]-F[0][0],F[1][1]-F[0][1]),O=M.__zoom,x=typeof I=="function"?I.apply(M,j):I,z=a(O.invert(Y).concat(X/O.k),x.invert(Y).concat(X/x.k));return function(V){if(V===1)V=x;else{var H=z(V),W=X/H[2];V=new Ee(W,Y[0]-H[0]*W,Y[1]-H[1]*W)}B.zoom(null,V)}})}function S(y,I,v){return!v&&y.__zooming||new T(y,I)}function T(y,I){this.that=y,this.args=I,this.active=0,this.sourceEvent=null,this.extent=t.apply(y,I),this.taps=0}T.prototype={event:function(y){return y&&(this.sourceEvent=y),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(y,I){return this.mouse&&y!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&y!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&y!=="touch"&&(this.touch1[1]=I.invert(this.touch1[0])),this.that.__zoom=I,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(y){var I=le(this.that).datum();l.call(y,this.that,new xl(y,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:l}),I)}};function L(y,...I){if(!e.apply(this,arguments))return;var v=S(this,I).event(y),k=this.__zoom,M=Math.max(i[0],Math.min(i[1],k.k*Math.pow(2,o.apply(this,arguments)))),j=fe(y);if(v.wheel)(v.mouse[0][0]!==j[0]||v.mouse[0][1]!==j[1])&&(v.mouse[1]=k.invert(v.mouse[0]=j)),clearTimeout(v.wheel);else{if(k.k===M)return;v.mouse=[j,k.invert(j)],vt(this),v.start()}Ke(y),v.wheel=setTimeout(B,m),v.zoom("mouse",n(g(E(k,M),v.mouse[0],v.mouse[1]),v.extent,s));function B(){v.wheel=null,v.end()}}function $(y,...I){if(f||!e.apply(this,arguments))return;var v=y.currentTarget,k=S(this,I,!0).event(y),M=le(y.view).on("mousemove.zoom",Y,!0).on("mouseup.zoom",X,!0),j=fe(y,v),B=y.clientX,F=y.clientY;Fo(y.view),Yt(y),k.mouse=[j,this.__zoom.invert(j)],vt(this),k.start();function Y(O){if(Ke(O),!k.moved){var x=O.clientX-B,z=O.clientY-F;k.moved=x*x+z*z>w}k.event(O).zoom("mouse",n(g(k.that.__zoom,k.mouse[0]=fe(O,v),k.mouse[1]),k.extent,s))}function X(O){M.on("mousemove.zoom mouseup.zoom",null),Yo(O.view,k.moved),Ke(O),k.event(O).end()}}function A(y,...I){if(e.apply(this,arguments)){var v=this.__zoom,k=fe(y.changedTouches?y.changedTouches[0]:y,this),M=v.invert(k),j=v.k*(y.shiftKey?.5:2),B=n(g(E(v,j),k,M),t.apply(this,I),s);Ke(y),c>0?le(this).transition().duration(c).call(N,B,k,y):le(this).call(b.transform,B,k,y)}}function C(y,...I){if(e.apply(this,arguments)){var v=y.touches,k=v.length,M=S(this,I,y.changedTouches.length===k).event(y),j,B,F,Y;for(Yt(y),B=0;B<k;++B)F=v[B],Y=fe(F,this),Y=[Y,this.__zoom.invert(Y),F.identifier],M.touch0?!M.touch1&&M.touch0[2]!==Y[2]&&(M.touch1=Y,M.taps=0):(M.touch0=Y,j=!0,M.taps=1+!!u);u&&(u=clearTimeout(u)),j&&(M.taps<2&&(d=Y[0],u=setTimeout(function(){u=null},h)),vt(this),M.start())}}function P(y,...I){if(this.__zooming){var v=S(this,I).event(y),k=y.changedTouches,M=k.length,j,B,F,Y;for(Ke(y),j=0;j<M;++j)B=k[j],F=fe(B,this),v.touch0&&v.touch0[2]===B.identifier?v.touch0[0]=F:v.touch1&&v.touch1[2]===B.identifier&&(v.touch1[0]=F);if(B=v.that.__zoom,v.touch1){var X=v.touch0[0],O=v.touch0[1],x=v.touch1[0],z=v.touch1[1],V=(V=x[0]-X[0])*V+(V=x[1]-X[1])*V,H=(H=z[0]-O[0])*H+(H=z[1]-O[1])*H;B=E(B,Math.sqrt(V/H)),F=[(X[0]+x[0])/2,(X[1]+x[1])/2],Y=[(O[0]+z[0])/2,(O[1]+z[1])/2]}else if(v.touch0)F=v.touch0[0],Y=v.touch0[1];else return;v.zoom("touch",n(g(B,F,Y),v.extent,s))}}function D(y,...I){if(this.__zooming){var v=S(this,I).event(y),k=y.changedTouches,M=k.length,j,B;for(Yt(y),f&&clearTimeout(f),f=setTimeout(function(){f=null},h),j=0;j<M;++j)B=k[j],v.touch0&&v.touch0[2]===B.identifier?delete v.touch0:v.touch1&&v.touch1[2]===B.identifier&&delete v.touch1;if(v.touch1&&!v.touch0&&(v.touch0=v.touch1,delete v.touch1),v.touch0)v.touch0[1]=this.__zoom.invert(v.touch0[0]);else if(v.end(),v.taps===2&&(B=fe(B,this),Math.hypot(d[0]-B[0],d[1]-B[1])<_)){var F=le(this).on("dblclick.zoom");F&&F.apply(this,arguments)}}}return b.wheelDelta=function(y){return arguments.length?(o=typeof y=="function"?y:ft(+y),b):o},b.filter=function(y){return arguments.length?(e=typeof y=="function"?y:ft(!!y),b):e},b.touchable=function(y){return arguments.length?(r=typeof y=="function"?y:ft(!!y),b):r},b.extent=function(y){return arguments.length?(t=typeof y=="function"?y:ft([[+y[0][0],+y[0][1]],[+y[1][0],+y[1][1]]]),b):t},b.scaleExtent=function(y){return arguments.length?(i[0]=+y[0],i[1]=+y[1],b):[i[0],i[1]]},b.translateExtent=function(y){return arguments.length?(s[0][0]=+y[0][0],s[1][0]=+y[1][0],s[0][1]=+y[0][1],s[1][1]=+y[1][1],b):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},b.constrain=function(y){return arguments.length?(n=y,b):n},b.duration=function(y){return arguments.length?(c=+y,b):c},b.interpolate=function(y){return arguments.length?(a=y,b):a},b.on=function(){var y=l.on.apply(l,arguments);return y===l?b:y},b.clickDistance=function(y){return arguments.length?(w=(y=+y)*y,b):Math.sqrt(w)},b.tapDistance=function(y){return arguments.length?(_=+y,b):_},b}const xe={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:o}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},et=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Qo=["Enter"," ","Escape"],Jo={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Ve;(function(e){e.Strict="strict",e.Loose="loose"})(Ve||(Ve={}));var Pe;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Pe||(Pe={}));var tt;(function(e){e.Partial="partial",e.Full="full"})(tt||(tt={}));const er={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Me;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Me||(Me={}));var Et;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Et||(Et={}));var K;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(K||(K={}));const Yn={[K.Left]:K.Right,[K.Right]:K.Left,[K.Top]:K.Bottom,[K.Bottom]:K.Top};function tr(e){return e===null?null:e?"valid":"invalid"}const nr=e=>"id"in e&&"source"in e&&"target"in e,Nl=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),hn=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),st=(e,t=[0,0])=>{const{width:n,height:o}=Se(e),r=e.origin??t,i=n*r[0],s=o*r[1];return{x:e.position.x-i,y:e.position.y-s}},Sl=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((o,r)=>{const i=typeof r=="string";let s=!t.nodeLookup&&!i?r:void 0;t.nodeLookup&&(s=i?t.nodeLookup.get(r):hn(r)?r:t.nodeLookup.get(r.id));const c=s?_t(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Tt(o,c)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Pt(n)},at=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(r=>{(t.filter===void 0||t.filter(r))&&(n=Tt(n,_t(r)),o=!0)}),o?Pt(n):{x:0,y:0,width:0,height:0}},gn=(e,t,[n,o,r]=[0,0,1],i=!1,s=!1)=>{const c={...lt(t,[n,o,r]),width:t.width/r,height:t.height/r},a=[];for(const l of e.values()){const{measured:u,selectable:d=!0,hidden:f=!1}=l;if(s&&!d||f)continue;const h=u.width??l.width??l.initialWidth??null,m=u.height??l.height??l.initialHeight??null,w=nt(c,Fe(l)),_=(h??0)*(m??0),b=i&&w>0;(!l.internals.handleBounds||b||w>=_||l.dragging)&&a.push(l)}return a},Cl=(e,t)=>{const n=new Set;return e.forEach(o=>{n.add(o.id)}),t.filter(o=>n.has(o.source)||n.has(o.target))};function kl(e,t){const n=new Map,o=t?.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{r.measured.width&&r.measured.height&&(t?.includeHiddenNodes||!r.hidden)&&(!o||o.has(r.id))&&n.set(r.id,r)}),n}async function Ml({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(e.size===0)return Promise.resolve(!0);const c=kl(e,s),a=at(c),l=pn(a,t,n,s?.minZoom??r,s?.maxZoom??i,s?.padding??.1);return await o.setViewport(l,{duration:s?.duration,ease:s?.ease,interpolate:s?.interpolate}),Promise.resolve(!0)}function or({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){const s=n.get(e),c=s.parentId?n.get(s.parentId):void 0,{x:a,y:l}=c?c.internals.positionAbsolute:{x:0,y:0},u=s.origin??o;let d=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!c)i?.("005",xe.error005());else{const h=c.measured.width,m=c.measured.height;h&&m&&(d=[[a,l],[a+h,l+m]])}else c&&Ye(s.extent)&&(d=[[s.extent[0][0]+a,s.extent[0][1]+l],[s.extent[1][0]+a,s.extent[1][1]+l]]);const f=Ye(d)?Ae(t,d,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&i?.("015",xe.error015()),{position:{x:f.x-a+(s.measured.width??0)*u[0],y:f.y-l+(s.measured.height??0)*u[1]},positionAbsolute:f}}async function Il({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(e.map(f=>f.id)),s=[];for(const f of n){if(f.deletable===!1)continue;const h=i.has(f.id),m=!h&&f.parentId&&s.find(w=>w.id===f.parentId);(h||m)&&s.push(f)}const c=new Set(t.map(f=>f.id)),a=o.filter(f=>f.deletable!==!1),u=Cl(s,a);for(const f of a)c.has(f.id)&&!u.find(m=>m.id===f.id)&&u.push(f);if(!r)return{edges:u,nodes:s};const d=await r({nodes:s,edges:u});return typeof d=="boolean"?d?{edges:u,nodes:s}:{edges:[],nodes:[]}:d}const Be=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Ae=(e={x:0,y:0},t,n)=>({x:Be(e.x,t[0][0],t[1][0]-(n?.width??0)),y:Be(e.y,t[0][1],t[1][1]-(n?.height??0))});function rr(e,t,n){const{width:o,height:r}=Se(n),{x:i,y:s}=n.internals.positionAbsolute;return Ae(e,[[i,s],[i+o,s+r]],t)}const Wn=(e,t,n)=>e<t?Be(Math.abs(e-t),1,t)/t:e>n?-Be(Math.abs(e-n),1,t)/t:0,ir=(e,t,n=15,o=40)=>{const r=Wn(e.x,o,t.width-o)*n,i=Wn(e.y,o,t.height-o)*n;return[r,i]},Tt=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),en=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),Pt=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),Fe=(e,t=[0,0])=>{const{x:n,y:o}=hn(e)?e.internals.positionAbsolute:st(e,t);return{x:n,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},_t=(e,t=[0,0])=>{const{x:n,y:o}=hn(e)?e.internals.positionAbsolute:st(e,t);return{x:n,y:o,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},sr=(e,t)=>Pt(Tt(en(e),en(t))),nt=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*o)},Zn=e=>he(e.width)&&he(e.height)&&he(e.x)&&he(e.y),he=e=>!isNaN(e)&&isFinite(e),Ol=(e,t)=>{},ct=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),lt=({x:e,y:t},[n,o,r],i=!1,s=[1,1])=>{const c={x:(e-n)/r,y:(t-o)/r};return i?ct(c,s):c},Nt=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function je(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Tl(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=je(e,n),r=je(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=je(e.top??e.y??0,n),r=je(e.bottom??e.y??0,n),i=je(e.left??e.x??0,t),s=je(e.right??e.x??0,t);return{top:o,right:s,bottom:r,left:i,x:i+s,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Pl(e,t,n,o,r,i){const{x:s,y:c}=Nt(e,[t,n,o]),{x:a,y:l}=Nt({x:e.x+e.width,y:e.y+e.height},[t,n,o]),u=r-a,d=i-l;return{left:Math.floor(s),top:Math.floor(c),right:Math.floor(u),bottom:Math.floor(d)}}const pn=(e,t,n,o,r,i)=>{const s=Tl(i,t,n),c=(t-s.x)/e.width,a=(n-s.y)/e.height,l=Math.min(c,a),u=Be(l,o,r),d=e.x+e.width/2,f=e.y+e.height/2,h=t/2-d*u,m=n/2-f*u,w=Pl(e,h,m,u,t,n),_={left:Math.min(w.left-s.left,0),top:Math.min(w.top-s.top,0),right:Math.min(w.right-s.right,0),bottom:Math.min(w.bottom-s.bottom,0)};return{x:h-_.left+_.right,y:m-_.top+_.bottom,zoom:u}},ot=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Ye(e){return e!=null&&e!=="parent"}function Se(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function ar(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function cr(e,t={width:0,height:0},n,o,r){const i={...e},s=o.get(n);if(s){const c=s.origin||r;i.x+=s.internals.positionAbsolute.x-(t.width??0)*c[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*c[1]}return i}function Xn(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Al(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function Dl(e){return{...Jo,...e||{}}}function Qe(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=ge(e),c=lt({x:i-(r?.left??0),y:s-(r?.top??0)},o),{x:a,y:l}=n?ct(c,t):c;return{xSnapped:a,ySnapped:l,...c}}const mn=e=>({width:e.offsetWidth,height:e.offsetHeight}),lr=e=>e?.getRootNode?.()||window?.document,Ll=["INPUT","SELECT","TEXTAREA"];function ur(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:Ll.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const dr=e=>"clientX"in e,ge=(e,t)=>{const n=dr(e),o=n?e.clientX:e.touches?.[0].clientX,r=n?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:r-(t?.top??0)}},Gn=(e,t,n,o,r)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(s=>{const c=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:r,position:s.getAttribute("data-handlepos"),x:(c.left-n.left)/o,y:(c.top-n.top)/o,...mn(s)}})};function fr({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:c}){const a=e*.125+r*.375+s*.375+n*.125,l=t*.125+i*.375+c*.375+o*.125,u=Math.abs(a-e),d=Math.abs(l-t);return[a,l,u,d]}function ht(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function qn({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case K.Left:return[t-ht(t-o,i),n];case K.Right:return[t+ht(o-t,i),n];case K.Top:return[t,n-ht(n-r,i)];case K.Bottom:return[t,n+ht(r-n,i)]}}function yn({sourceX:e,sourceY:t,sourcePosition:n=K.Bottom,targetX:o,targetY:r,targetPosition:i=K.Top,curvature:s=.25}){const[c,a]=qn({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[l,u]=qn({pos:i,x1:o,y1:r,x2:e,y2:t,c:s}),[d,f,h,m]=fr({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:c,sourceControlY:a,targetControlX:l,targetControlY:u});return[`M${e},${t} C${c},${a} ${l},${u} ${o},${r}`,d,f,h,m]}function hr({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,i=n<e?n+r:n-r,s=Math.abs(o-t)/2,c=o<t?o+s:o-s;return[i,c,r,s]}function jl({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:i="basic"}){if(i==="manual")return o;const s=r&&n?o+1e3:o,c=Math.max(e.parentId||r&&e.selected?e.internals.z:0,t.parentId||r&&t.selected?t.internals.z:0);return s+c}function $l({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const i=Tt(_t(e),_t(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const s={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return nt(s,Pt(i))>0}const zl=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,Rl=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),Hl=(e,t,n={})=>{if(!e.source||!e.target)return t;const o=n.getEdgeId||zl;let r;return nr(e)?r={...e}:r={...e,id:o(e)},Rl(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function gr({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,i,s,c]=hr({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,c]}const Un={[K.Left]:{x:-1,y:0},[K.Right]:{x:1,y:0},[K.Top]:{x:0,y:-1},[K.Bottom]:{x:0,y:1}},Vl=({source:e,sourcePosition:t=K.Bottom,target:n})=>t===K.Left||t===K.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},Kn=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Bl({source:e,sourcePosition:t=K.Bottom,target:n,targetPosition:o=K.Top,center:r,offset:i,stepPosition:s}){const c=Un[t],a=Un[o],l={x:e.x+c.x*i,y:e.y+c.y*i},u={x:n.x+a.x*i,y:n.y+a.y*i},d=Vl({source:l,sourcePosition:t,target:u}),f=d.x!==0?"x":"y",h=d[f];let m=[],w,_;const b={x:0,y:0},E={x:0,y:0},[,,g,p]=hr({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(c[f]*a[f]===-1){f==="x"?(w=r.x??l.x+(u.x-l.x)*s,_=r.y??(l.y+u.y)/2):(w=r.x??(l.x+u.x)/2,_=r.y??l.y+(u.y-l.y)*s);const S=[{x:w,y:l.y},{x:w,y:u.y}],T=[{x:l.x,y:_},{x:u.x,y:_}];c[f]===h?m=f==="x"?S:T:m=f==="x"?T:S}else{const S=[{x:l.x,y:u.y}],T=[{x:u.x,y:l.y}];if(f==="x"?m=c.x===h?T:S:m=c.y===h?S:T,t===o){const P=Math.abs(e[f]-n[f]);if(P<=i){const D=Math.min(i-1,i-P);c[f]===h?b[f]=(l[f]>e[f]?-1:1)*D:E[f]=(u[f]>n[f]?-1:1)*D}}if(t!==o){const P=f==="x"?"y":"x",D=c[f]===a[P],y=l[P]>u[P],I=l[P]<u[P];(c[f]===1&&(!D&&y||D&&I)||c[f]!==1&&(!D&&I||D&&y))&&(m=f==="x"?S:T)}const L={x:l.x+b.x,y:l.y+b.y},$={x:u.x+E.x,y:u.y+E.y},A=Math.max(Math.abs(L.x-m[0].x),Math.abs($.x-m[0].x)),C=Math.max(Math.abs(L.y-m[0].y),Math.abs($.y-m[0].y));A>=C?(w=(L.x+$.x)/2,_=m[0].y):(w=m[0].x,_=(L.y+$.y)/2)}return[[e,{x:l.x+b.x,y:l.y+b.y},...m,{x:u.x+E.x,y:u.y+E.y},n],w,_,g,p]}function Fl(e,t,n,o){const r=Math.min(Kn(e,t)/2,Kn(t,n)/2,o),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){const l=e.x<n.x?-1:1,u=e.y<n.y?1:-1;return`L ${i+r*l},${s}Q ${i},${s} ${i},${s+r*u}`}const c=e.x<n.x?1:-1,a=e.y<n.y?-1:1;return`L ${i},${s+r*a}Q ${i},${s} ${i+r*c},${s}`}function tn({sourceX:e,sourceY:t,sourcePosition:n=K.Bottom,targetX:o,targetY:r,targetPosition:i=K.Top,borderRadius:s=5,centerX:c,centerY:a,offset:l=20,stepPosition:u=.5}){const[d,f,h,m,w]=Bl({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:c,y:a},offset:l,stepPosition:u});return[d.reduce((b,E,g)=>{let p="";return g>0&&g<d.length-1?p=Fl(d[g-1],E,d[g+1],s):p=`${g===0?"M":"L"}${E.x} ${E.y}`,b+=p,b},""),f,h,m,w]}function Qn(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Yl(e){const{sourceNode:t,targetNode:n}=e;if(!Qn(t)||!Qn(n))return null;const o=t.internals.handleBounds||Jn(t.handles),r=n.internals.handleBounds||Jn(n.handles),i=eo(o?.source??[],e.sourceHandle),s=eo(e.connectionMode===Ve.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!i||!s)return e.onError?.("008",xe.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const c=i?.position||K.Bottom,a=s?.position||K.Top,l=De(t,i,c),u=De(n,s,a);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:c,targetPosition:a}}function Jn(e){if(!e)return null;const t=[],n=[];for(const o of e)o.width=o.width??1,o.height=o.height??1,o.type==="source"?t.push(o):o.type==="target"&&n.push(o);return{source:t,target:n}}function De(e,t,n=K.Left,o=!1){const r=(t?.x??0)+e.internals.positionAbsolute.x,i=(t?.y??0)+e.internals.positionAbsolute.y,{width:s,height:c}=t??Se(e);if(o)return{x:r+s/2,y:i+c/2};switch(t?.position??n){case K.Top:return{x:r+s/2,y:i};case K.Right:return{x:r+s,y:i+c/2};case K.Bottom:return{x:r+s/2,y:i+c};case K.Left:return{x:r,y:i+c/2}}}function eo(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function nn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function Wl(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const i=new Set;return e.reduce((s,c)=>([c.markerStart||o,c.markerEnd||r].forEach(a=>{if(a&&typeof a=="object"){const l=nn(a,t);i.has(l)||(s.push({id:l,color:a.color||n,...a}),i.add(l))}}),s),[]).sort((s,c)=>s.id.localeCompare(c.id))}const pr=1e3,Zl=10,xn={nodeOrigin:[0,0],nodeExtent:et,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Xl={...xn,checkEquality:!0};function wn(e,t){const n={...e};for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function Gl(e,t,n){const o=wn(xn,n);for(const r of e.values())if(r.parentId)bn(r,e,t,o);else{const i=st(r,o.nodeOrigin),s=Ye(r.extent)?r.extent:o.nodeExtent,c=Ae(i,s,Se(r));r.internals.positionAbsolute=c}}function ql(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],o=[];for(const r of e.handles){const i={id:r.id,width:r.width??1,height:r.height??1,nodeId:e.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(i):r.type==="target"&&o.push(i)}return{source:n,target:o}}function vn(e){return e==="manual"}function on(e,t,n,o={}){const r=wn(Xl,o),i={i:0},s=new Map(t),c=r?.elevateNodesOnSelect&&!vn(r.zIndexMode)?pr:0;let a=e.length>0;t.clear(),n.clear();for(const l of e){let u=s.get(l.id);if(r.checkEquality&&l===u?.internals.userNode)t.set(l.id,u);else{const d=st(l,r.nodeOrigin),f=Ye(l.extent)?l.extent:r.nodeExtent,h=Ae(d,f,Se(l));u={...r.defaults,...l,measured:{width:l.measured?.width,height:l.measured?.height},internals:{positionAbsolute:h,handleBounds:ql(l,u),z:mr(l,c,r.zIndexMode),userNode:l}},t.set(l.id,u)}(u.measured===void 0||u.measured.width===void 0||u.measured.height===void 0)&&!u.hidden&&(a=!1),l.parentId&&bn(u,t,n,o,i)}return a}function Ul(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function bn(e,t,n,o,r){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:c,zIndexMode:a}=wn(xn,o),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Ul(e,n),r&&!u.parentId&&u.internals.rootParentIndex===void 0&&a==="auto"&&(u.internals.rootParentIndex=++r.i,u.internals.z=u.internals.z+r.i*Zl),r&&u.internals.rootParentIndex!==void 0&&(r.i=u.internals.rootParentIndex);const d=i&&!vn(a)?pr:0,{x:f,y:h,z:m}=Kl(e,u,s,c,d,a),{positionAbsolute:w}=e.internals,_=f!==w.x||h!==w.y;(_||m!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:_?{x:f,y:h}:w,z:m}})}function mr(e,t,n){const o=he(e.zIndex)?e.zIndex:0;return vn(n)?o:o+(e.selected?t:0)}function Kl(e,t,n,o,r,i){const{x:s,y:c}=t.internals.positionAbsolute,a=Se(e),l=st(e,n),u=Ye(e.extent)?Ae(l,e.extent,a):l;let d=Ae({x:s+u.x,y:c+u.y},o,a);e.extent==="parent"&&(d=rr(d,a,t));const f=mr(e,r,i),h=t.internals.z??0;return{x:d.x,y:d.y,z:h>=f?h+1:f}}function En(e,t,n,o=[0,0]){const r=[],i=new Map;for(const s of e){const c=t.get(s.parentId);if(!c)continue;const a=i.get(s.parentId)?.expandedRect??Fe(c),l=sr(a,s.rect);i.set(s.parentId,{expandedRect:l,parent:c})}return i.size>0&&i.forEach(({expandedRect:s,parent:c},a)=>{const l=c.internals.positionAbsolute,u=Se(c),d=c.origin??o,f=s.x<l.x?Math.round(Math.abs(l.x-s.x)):0,h=s.y<l.y?Math.round(Math.abs(l.y-s.y)):0,m=Math.max(u.width,Math.round(s.width)),w=Math.max(u.height,Math.round(s.height)),_=(m-u.width)*d[0],b=(w-u.height)*d[1];(f>0||h>0||_||b)&&(r.push({id:a,type:"position",position:{x:c.position.x-f+_,y:c.position.y-h+b}}),n.get(a)?.forEach(E=>{e.some(g=>g.id===E.id)||r.push({id:E.id,type:"position",position:{x:E.position.x+f,y:E.position.y+h}})})),(u.width<s.width||u.height<s.height||f||h)&&r.push({id:a,type:"dimensions",setAttributes:!0,dimensions:{width:m+(f?d[0]*f-_:0),height:w+(h?d[1]*h-b:0)}})}),r}function Ql(e,t,n,o,r,i,s){const c=o?.querySelector(".xyflow__viewport");let a=!1;if(!c)return{changes:[],updatedInternals:a};const l=[],u=window.getComputedStyle(c),{m22:d}=new window.DOMMatrixReadOnly(u.transform),f=[];for(const h of e.values()){const m=t.get(h.id);if(!m)continue;if(m.hidden){t.set(m.id,{...m,internals:{...m.internals,handleBounds:void 0}}),a=!0;continue}const w=mn(h.nodeElement),_=m.measured.width!==w.width||m.measured.height!==w.height;if(!!(w.width&&w.height&&(_||!m.internals.handleBounds||h.force))){const E=h.nodeElement.getBoundingClientRect(),g=Ye(m.extent)?m.extent:i;let{positionAbsolute:p}=m.internals;m.parentId&&m.extent==="parent"?p=rr(p,w,t.get(m.parentId)):g&&(p=Ae(p,g,w));const N={...m,measured:w,internals:{...m.internals,positionAbsolute:p,handleBounds:{source:Gn("source",h.nodeElement,E,d,m.id),target:Gn("target",h.nodeElement,E,d,m.id)}}};t.set(m.id,N),m.parentId&&bn(N,t,n,{nodeOrigin:r,zIndexMode:s}),a=!0,_&&(l.push({id:m.id,type:"dimensions",dimensions:w}),m.expandParent&&m.parentId&&f.push({id:m.id,parentId:m.parentId,rect:Fe(N,r)}))}}if(f.length>0){const h=En(f,t,n,r);l.push(...h)}return{changes:l,updatedInternals:a}}async function Jl({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:i}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,i]],o),c=!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2]);return Promise.resolve(c)}function to(e,t,n,o,r,i){let s=r;const c=o.get(s)||new Map;o.set(s,c.set(n,t)),s=`${r}-${e}`;const a=o.get(s)||new Map;if(o.set(s,a.set(n,t)),i){s=`${r}-${e}-${i}`;const l=o.get(s)||new Map;o.set(s,l.set(n,t))}}function yr(e,t,n){e.clear(),t.clear();for(const o of n){const{source:r,target:i,sourceHandle:s=null,targetHandle:c=null}=o,a={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:c},l=`${r}-${s}--${i}-${c}`,u=`${i}-${c}--${r}-${s}`;to("source",a,u,e,r,s),to("target",a,l,e,i,c),t.set(o.id,o)}}function xr(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:xr(n,t):!1}function no(e,t,n){let o=e;do{if(o?.matches?.(t))return!0;if(o===n)return!1;o=o?.parentElement}while(o);return!1}function eu(e,t,n,o){const r=new Map;for(const[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!xr(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){const c=e.get(i);c&&r.set(i,{id:i,position:c.position||{x:0,y:0},distance:{x:n.x-c.internals.positionAbsolute.x,y:n.y-c.internals.positionAbsolute.y},extent:c.extent,parentId:c.parentId,origin:c.origin,expandParent:c.expandParent,internals:{positionAbsolute:c.internals.positionAbsolute||{x:0,y:0}},measured:{width:c.measured.width??0,height:c.measured.height??0}})}return r}function Wt({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[s,c]of t){const a=n.get(s)?.internals.userNode;a&&r.push({...a,position:c.position,dragging:o})}if(!e)return[r[0],r];const i=n.get(e)?.internals.userNode;return[i?{...i,position:t.get(e)?.position||i.position,dragging:o}:r[0],r]}function tu({dragItems:e,snapGrid:t,x:n,y:o}){const r=e.values().next().value;if(!r)return null;const i={x:n-r.distance.x,y:o-r.distance.y},s=ct(i,t);return{x:s.x-i.x,y:s.y-i.y}}function nu({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,c=new Map,a=!1,l={x:0,y:0},u=null,d=!1,f=null,h=!1,m=!1,w=null;function _({noDragClassName:E,handleSelector:g,domNode:p,isSelectable:N,nodeId:S,nodeClickDistance:T=0}){f=le(p);function L({x:P,y:D}){const{nodeLookup:y,nodeExtent:I,snapGrid:v,snapToGrid:k,nodeOrigin:M,onNodeDrag:j,onSelectionDrag:B,onError:F,updateNodePositions:Y}=t();i={x:P,y:D};let X=!1;const O=c.size>1,x=O&&I?en(at(c)):null,z=O&&k?tu({dragItems:c,snapGrid:v,x:P,y:D}):null;for(const[V,H]of c){if(!y.has(V))continue;let W={x:P-H.distance.x,y:D-H.distance.y};k&&(W=z?{x:Math.round(W.x+z.x),y:Math.round(W.y+z.y)}:ct(W,v));let G=null;if(O&&I&&!H.extent&&x){const{positionAbsolute:Q}=H.internals,J=Q.x-x.x+I[0][0],ee=Q.x+H.measured.width-x.x2+I[1][0],ne=Q.y-x.y+I[0][1],ce=Q.y+H.measured.height-x.y2+I[1][1];G=[[J,ne],[ee,ce]]}const{position:q,positionAbsolute:U}=or({nodeId:V,nextPosition:W,nodeLookup:y,nodeExtent:G||I,nodeOrigin:M,onError:F});X=X||H.position.x!==q.x||H.position.y!==q.y,H.position=q,H.internals.positionAbsolute=U}if(m=m||X,!!X&&(Y(c,!0),w&&(o||j||!S&&B))){const[V,H]=Wt({nodeId:S,dragItems:c,nodeLookup:y});o?.(w,c,V,H),j?.(w,V,H),S||B?.(w,H)}}async function $(){if(!u)return;const{transform:P,panBy:D,autoPanSpeed:y,autoPanOnNodeDrag:I}=t();if(!I){a=!1,cancelAnimationFrame(s);return}const[v,k]=ir(l,u,y);(v!==0||k!==0)&&(i.x=(i.x??0)-v/P[2],i.y=(i.y??0)-k/P[2],await D({x:v,y:k})&&L(i)),s=requestAnimationFrame($)}function A(P){const{nodeLookup:D,multiSelectionActive:y,nodesDraggable:I,transform:v,snapGrid:k,snapToGrid:M,selectNodesOnDrag:j,onNodeDragStart:B,onSelectionDragStart:F,unselectNodesAndEdges:Y}=t();d=!0,(!j||!N)&&!y&&S&&(D.get(S)?.selected||Y()),N&&j&&S&&e?.(S);const X=Qe(P.sourceEvent,{transform:v,snapGrid:k,snapToGrid:M,containerBounds:u});if(i=X,c=eu(D,I,X,S),c.size>0&&(n||B||!S&&F)){const[O,x]=Wt({nodeId:S,dragItems:c,nodeLookup:D});n?.(P.sourceEvent,c,O,x),B?.(P.sourceEvent,O,x),S||F?.(P.sourceEvent,x)}}const C=Wo().clickDistance(T).on("start",P=>{const{domNode:D,nodeDragThreshold:y,transform:I,snapGrid:v,snapToGrid:k}=t();u=D?.getBoundingClientRect()||null,h=!1,m=!1,w=P.sourceEvent,y===0&&A(P),i=Qe(P.sourceEvent,{transform:I,snapGrid:v,snapToGrid:k,containerBounds:u}),l=ge(P.sourceEvent,u)}).on("drag",P=>{const{autoPanOnNodeDrag:D,transform:y,snapGrid:I,snapToGrid:v,nodeDragThreshold:k,nodeLookup:M}=t(),j=Qe(P.sourceEvent,{transform:y,snapGrid:I,snapToGrid:v,containerBounds:u});if(w=P.sourceEvent,(P.sourceEvent.type==="touchmove"&&P.sourceEvent.touches.length>1||S&&!M.has(S))&&(h=!0),!h){if(!a&&D&&d&&(a=!0,$()),!d){const B=ge(P.sourceEvent,u),F=B.x-l.x,Y=B.y-l.y;Math.sqrt(F*F+Y*Y)>k&&A(P)}(i.x!==j.xSnapped||i.y!==j.ySnapped)&&c&&d&&(l=ge(P.sourceEvent,u),L(j))}}).on("end",P=>{if(!(!d||h)&&(a=!1,d=!1,cancelAnimationFrame(s),c.size>0)){const{nodeLookup:D,updateNodePositions:y,onNodeDragStop:I,onSelectionDragStop:v}=t();if(m&&(y(c,!1),m=!1),r||I||!S&&v){const[k,M]=Wt({nodeId:S,dragItems:c,nodeLookup:D,dragging:!1});r?.(P.sourceEvent,c,k,M),I?.(P.sourceEvent,k,M),S||v?.(P.sourceEvent,M)}}}).filter(P=>{const D=P.target;return!P.button&&(!E||!no(D,`.${E}`,p))&&(!g||no(D,g,p))});f.call(C)}function b(){f?.on(".drag",null)}return{update:_,destroy:b}}function ou(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())nt(r,Fe(i))>0&&o.push(i);return o}const ru=250;function iu(e,t,n,o){let r=[],i=1/0;const s=ou(e,n,t+ru);for(const c of s){const a=[...c.internals.handleBounds?.source??[],...c.internals.handleBounds?.target??[]];for(const l of a){if(o.nodeId===l.nodeId&&o.type===l.type&&o.id===l.id)continue;const{x:u,y:d}=De(c,l,l.position,!0),f=Math.sqrt(Math.pow(u-e.x,2)+Math.pow(d-e.y,2));f>t||(f<i?(r=[{...l,x:u,y:d}],i=f):f===i&&r.push({...l,x:u,y:d}))}}if(!r.length)return null;if(r.length>1){const c=o.type==="source"?"target":"source";return r.find(a=>a.type===c)??r[0]}return r[0]}function wr(e,t,n,o,r,i=!1){const s=o.get(e);if(!s)return null;const c=r==="strict"?s.internals.handleBounds?.[t]:[...s.internals.handleBounds?.source??[],...s.internals.handleBounds?.target??[]],a=(n?c?.find(l=>l.id===n):c?.[0])??null;return a&&i?{...a,...De(s,a,a.position,!0)}:a}function vr(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function su(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const br=()=>!0;function au(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:c,nodeLookup:a,lib:l,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:h,onConnectStart:m,onConnect:w,onConnectEnd:_,isValidConnection:b=br,onReconnectEnd:E,updateConnection:g,getTransform:p,getFromHandle:N,autoPanSpeed:S,dragThreshold:T=1,handleDomNode:L}){const $=lr(e.target);let A=0,C;const{x:P,y:D}=ge(e),y=vr(i,L),I=c?.getBoundingClientRect();let v=!1;if(!I||!y)return;const k=wr(r,y,o,a,t);if(!k)return;let M=ge(e,I),j=!1,B=null,F=!1,Y=null;function X(){if(!u||!I)return;const[q,U]=ir(M,I,S);f({x:q,y:U}),A=requestAnimationFrame(X)}const O={...k,nodeId:r,type:y,position:k.position},x=a.get(r);let V={inProgress:!0,isValid:null,from:De(x,O,K.Left,!0),fromHandle:O,fromPosition:O.position,fromNode:x,to:M,toHandle:null,toPosition:Yn[O.position],toNode:null,pointer:M};function H(){v=!0,g(V),m?.(e,{nodeId:r,handleId:o,handleType:y})}T===0&&H();function W(q){if(!v){const{x:ce,y:de}=ge(q),ve=ce-P,Oe=de-D;if(!(ve*ve+Oe*Oe>T*T))return;H()}if(!N()||!O){G(q);return}const U=p();M=ge(q,I),C=iu(lt(M,U,!1,[1,1]),n,a,O),j||(X(),j=!0);const Q=Er(q,{handle:C,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:b,doc:$,lib:l,flowId:d,nodeLookup:a});Y=Q.handleDomNode,B=Q.connection,F=su(!!C,Q.isValid);const J=a.get(r),ee=J?De(J,O,K.Left,!0):V.from,ne={...V,from:ee,isValid:F,to:Q.toHandle&&F?Nt({x:Q.toHandle.x,y:Q.toHandle.y},U):M,toHandle:Q.toHandle,toPosition:F&&Q.toHandle?Q.toHandle.position:Yn[O.position],toNode:Q.toHandle?a.get(Q.toHandle.nodeId):null,pointer:M};g(ne),V=ne}function G(q){if(!("touches"in q&&q.touches.length>0)){if(v){(C||Y)&&B&&F&&w?.(B);const{inProgress:U,...Q}=V,J={...Q,toPosition:V.toHandle?V.toPosition:null};_?.(q,J),i&&E?.(q,J)}h(),cancelAnimationFrame(A),j=!1,F=!1,B=null,Y=null,$.removeEventListener("mousemove",W),$.removeEventListener("mouseup",G),$.removeEventListener("touchmove",W),$.removeEventListener("touchend",G)}}$.addEventListener("mousemove",W),$.addEventListener("mouseup",G),$.addEventListener("touchmove",W),$.addEventListener("touchend",G)}function Er(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:c,flowId:a,isValidConnection:l=br,nodeLookup:u}){const d=i==="target",f=t?s.querySelector(`.${c}-flow__handle[data-id="${a}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:h,y:m}=ge(e),w=s.elementFromPoint(h,m),_=w?.classList.contains(`${c}-flow__handle`)?w:f,b={handleDomNode:_,isValid:!1,connection:null,toHandle:null};if(_){const E=vr(void 0,_),g=_.getAttribute("data-nodeid"),p=_.getAttribute("data-handleid"),N=_.classList.contains("connectable"),S=_.classList.contains("connectableend");if(!g||!E)return b;const T={source:d?g:o,sourceHandle:d?p:r,target:d?o:g,targetHandle:d?r:p};b.connection=T;const $=N&&S&&(n===Ve.Strict?d&&E==="source"||!d&&E==="target":g!==o||p!==r);b.isValid=$&&l(T),b.toHandle=wr(g,E,p,u,n,!0)}return b}const rn={onPointerDown:au,isValid:Er};function cu({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=le(e);function i({translateExtent:c,width:a,height:l,zoomStep:u=1,pannable:d=!0,zoomable:f=!0,inversePan:h=!1}){const m=g=>{if(g.sourceEvent.type!=="wheel"||!t)return;const p=n(),N=g.sourceEvent.ctrlKey&&ot()?10:1,S=-g.sourceEvent.deltaY*(g.sourceEvent.deltaMode===1?.05:g.sourceEvent.deltaMode?1:.002)*u,T=p[2]*Math.pow(2,S*N);t.scaleTo(T)};let w=[0,0];const _=g=>{(g.sourceEvent.type==="mousedown"||g.sourceEvent.type==="touchstart")&&(w=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY])},b=g=>{const p=n();if(g.sourceEvent.type!=="mousemove"&&g.sourceEvent.type!=="touchmove"||!t)return;const N=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY],S=[N[0]-w[0],N[1]-w[1]];w=N;const T=o()*Math.max(p[2],Math.log(p[2]))*(h?-1:1),L={x:p[0]-S[0]*T,y:p[1]-S[1]*T},$=[[0,0],[a,l]];t.setViewportConstrained({x:L.x,y:L.y,zoom:p[2]},$,c)},E=Ko().on("start",_).on("zoom",d?b:null).on("zoom.wheel",f?m:null);r.call(E,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:fe}}const At=e=>({x:e.x,y:e.y,zoom:e.k}),Zt=({x:e,y:t,zoom:n})=>Ot.translate(e,t).scale(n),$e=(e,t)=>e.target.closest(`.${t}`),_r=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),lu=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Xt=(e,t=0,n=lu,o=()=>{})=>{const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},Nr=e=>{const t=e.ctrlKey&&ot()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function uu({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:c,onPanZoom:a,onPanZoomEnd:l}){return u=>{if($e(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();const d=n.property("__zoom").k||1;if(u.ctrlKey&&s){const _=fe(u),b=Nr(u),E=d*Math.pow(2,b);o.scaleTo(n,E,_,u);return}const f=u.deltaMode===1?20:1;let h=r===Pe.Vertical?0:u.deltaX*f,m=r===Pe.Horizontal?0:u.deltaY*f;!ot()&&u.shiftKey&&r!==Pe.Vertical&&(h=u.deltaY*f,m=0),o.translateBy(n,-(h/d)*i,-(m/d)*i,{internal:!0});const w=At(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(a?.(u,w),e.panScrollTimeout=setTimeout(()=>{l?.(u,w),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,c?.(u,w))}}function du({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const i=o.type==="wheel",s=!t&&i&&!o.ctrlKey,c=$e(o,e);if(o.ctrlKey&&i&&c&&o.preventDefault(),s||c)return null;o.preventDefault(),n.call(this,o,r)}}function fu({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=At(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=r,o.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(o.sourceEvent,r)}}function hu({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!!(n&&_r(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,At(i.transform))}}function gu({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&_r(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const c=At(s.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(s.sourceEvent,c)},n?150:0)}}}function pu({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:c,noPanClassName:a,lib:l,connectionInProgress:u}){return d=>{const f=e||t,h=n&&d.ctrlKey,m=d.type==="wheel";if(d.button===1&&d.type==="mousedown"&&($e(d,`${l}-flow__node`)||$e(d,`${l}-flow__edge`)))return!0;if(!o&&!f&&!r&&!i&&!n||s||u&&!m||$e(d,c)&&m||$e(d,a)&&(!m||r&&m&&!e)||!n&&d.ctrlKey&&m)return!1;if(!n&&d.type==="touchstart"&&d.touches?.length>1)return d.preventDefault(),!1;if(!f&&!r&&!h&&m||!o&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(o)&&!o.includes(d.button)&&d.type==="mousedown")return!1;const w=Array.isArray(o)&&o.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||m)&&w}}function mu({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:c,onDraggingChange:a}){const l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=Ko().scaleExtent([t,n]).translateExtent(o),f=le(e).call(d);E({x:r.x,y:r.y,zoom:Be(r.zoom,t,n)},[[0,0],[u.width,u.height]],o);const h=f.on("wheel.zoom"),m=f.on("dblclick.zoom");d.wheelDelta(Nr);function w(C,P){return f?new Promise(D=>{d?.interpolate(P?.interpolate==="linear"?Bt:yt).transform(Xt(f,P?.duration,P?.ease,()=>D(!0)),C)}):Promise.resolve(!1)}function _({noWheelClassName:C,noPanClassName:P,onPaneContextMenu:D,userSelectionActive:y,panOnScroll:I,panOnDrag:v,panOnScrollMode:k,panOnScrollSpeed:M,preventScrolling:j,zoomOnPinch:B,zoomOnScroll:F,zoomOnDoubleClick:Y,zoomActivationKeyPressed:X,lib:O,onTransformChange:x,connectionInProgress:z,paneClickDistance:V,selectionOnDrag:H}){y&&!l.isZoomingOrPanning&&b();const W=I&&!X&&!y;d.clickDistance(H?1/0:!he(V)||V<0?0:V);const G=W?uu({zoomPanValues:l,noWheelClassName:C,d3Selection:f,d3Zoom:d,panOnScrollMode:k,panOnScrollSpeed:M,zoomOnPinch:B,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:c}):du({noWheelClassName:C,preventScrolling:j,d3ZoomHandler:h});if(f.on("wheel.zoom",G,{passive:!1}),!y){const U=fu({zoomPanValues:l,onDraggingChange:a,onPanZoomStart:s});d.on("start",U);const Q=hu({zoomPanValues:l,panOnDrag:v,onPaneContextMenu:!!D,onPanZoom:i,onTransformChange:x});d.on("zoom",Q);const J=gu({zoomPanValues:l,panOnDrag:v,panOnScroll:I,onPaneContextMenu:D,onPanZoomEnd:c,onDraggingChange:a});d.on("end",J)}const q=pu({zoomActivationKeyPressed:X,panOnDrag:v,zoomOnScroll:F,panOnScroll:I,zoomOnDoubleClick:Y,zoomOnPinch:B,userSelectionActive:y,noPanClassName:P,noWheelClassName:C,lib:O,connectionInProgress:z});d.filter(q),Y?f.on("dblclick.zoom",m):f.on("dblclick.zoom",null)}function b(){d.on("zoom",null)}async function E(C,P,D){const y=Zt(C),I=d?.constrain()(y,P,D);return I&&await w(I),new Promise(v=>v(I))}async function g(C,P){const D=Zt(C);return await w(D,P),new Promise(y=>y(D))}function p(C){if(f){const P=Zt(C),D=f.property("__zoom");(D.k!==C.zoom||D.x!==C.x||D.y!==C.y)&&d?.transform(f,P,null,{sync:!0})}}function N(){const C=f?Uo(f.node()):{x:0,y:0,k:1};return{x:C.x,y:C.y,zoom:C.k}}function S(C,P){return f?new Promise(D=>{d?.interpolate(P?.interpolate==="linear"?Bt:yt).scaleTo(Xt(f,P?.duration,P?.ease,()=>D(!0)),C)}):Promise.resolve(!1)}function T(C,P){return f?new Promise(D=>{d?.interpolate(P?.interpolate==="linear"?Bt:yt).scaleBy(Xt(f,P?.duration,P?.ease,()=>D(!0)),C)}):Promise.resolve(!1)}function L(C){d?.scaleExtent(C)}function $(C){d?.translateExtent(C)}function A(C){const P=!he(C)||C<0?0:C;d?.clickDistance(P)}return{update:_,destroy:b,setViewport:g,setViewportConstrained:E,getViewport:N,scaleTo:S,scaleBy:T,setScaleExtent:L,setTranslateExtent:$,syncViewport:p,setClickDistance:A}}var We;(function(e){e.Line="line",e.Handle="handle"})(We||(We={}));function yu({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){const s=e-t,c=n-o,a=[s>0?1:s<0?-1:0,c>0?1:c<0?-1:0];return s&&r&&(a[0]=a[0]*-1),c&&i&&(a[1]=a[1]*-1),a}function oo(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),o=e.includes("left"),r=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:o,affectsY:r}}function Ce(e,t){return Math.max(0,t-e)}function ke(e,t){return Math.max(0,e-t)}function gt(e,t,n){return Math.max(0,t-e,e-n)}function ro(e,t){return e?!t:t}function xu(e,t,n,o,r,i,s,c){let{affectsX:a,affectsY:l}=t;const{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:h,ySnapped:m}=n,{minWidth:w,maxWidth:_,minHeight:b,maxHeight:E}=o,{x:g,y:p,width:N,height:S,aspectRatio:T}=e;let L=Math.floor(u?h-e.pointerX:0),$=Math.floor(d?m-e.pointerY:0);const A=N+(a?-L:L),C=S+(l?-$:$),P=-i[0]*N,D=-i[1]*S;let y=gt(A,w,_),I=gt(C,b,E);if(s){let M=0,j=0;a&&L<0?M=Ce(g+L+P,s[0][0]):!a&&L>0&&(M=ke(g+A+P,s[1][0])),l&&$<0?j=Ce(p+$+D,s[0][1]):!l&&$>0&&(j=ke(p+C+D,s[1][1])),y=Math.max(y,M),I=Math.max(I,j)}if(c){let M=0,j=0;a&&L>0?M=ke(g+L,c[0][0]):!a&&L<0&&(M=Ce(g+A,c[1][0])),l&&$>0?j=ke(p+$,c[0][1]):!l&&$<0&&(j=Ce(p+C,c[1][1])),y=Math.max(y,M),I=Math.max(I,j)}if(r){if(u){const M=gt(A/T,b,E)*T;if(y=Math.max(y,M),s){let j=0;!a&&!l||a&&!l&&f?j=ke(p+D+A/T,s[1][1])*T:j=Ce(p+D+(a?L:-L)/T,s[0][1])*T,y=Math.max(y,j)}if(c){let j=0;!a&&!l||a&&!l&&f?j=Ce(p+A/T,c[1][1])*T:j=ke(p+(a?L:-L)/T,c[0][1])*T,y=Math.max(y,j)}}if(d){const M=gt(C*T,w,_)/T;if(I=Math.max(I,M),s){let j=0;!a&&!l||l&&!a&&f?j=ke(g+C*T+P,s[1][0])/T:j=Ce(g+(l?$:-$)*T+P,s[0][0])/T,I=Math.max(I,j)}if(c){let j=0;!a&&!l||l&&!a&&f?j=Ce(g+C*T,c[1][0])/T:j=ke(g+(l?$:-$)*T,c[0][0])/T,I=Math.max(I,j)}}}$=$+($<0?I:-I),L=L+(L<0?y:-y),r&&(f?A>C*T?$=(ro(a,l)?-L:L)/T:L=(ro(a,l)?-$:$)*T:u?($=L/T,l=a):(L=$*T,a=l));const v=a?g+L:g,k=l?p+$:p;return{width:N+(a?-L:L),height:S+(l?-$:$),x:i[0]*L*(a?-1:1)+v,y:i[1]*$*(l?-1:1)+k}}const Sr={width:0,height:0,x:0,y:0},wu={...Sr,pointerX:0,pointerY:0,aspectRatio:1};function vu(e){return[[0,0],[e.measured.width,e.measured.height]]}function bu(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,c=n[0]*i,a=n[1]*s;return[[o-c,r-a],[o+i-c,r+s-a]]}function Eu({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const i=le(e);let s={controlDirection:oo("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function c({controlPosition:l,boundaries:u,keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:m,onResizeEnd:w,shouldResize:_}){let b={...Sr},E={...wu};s={boundaries:u,resizeDirection:f,keepAspectRatio:d,controlDirection:oo(l)};let g,p=null,N=[],S,T,L,$=!1;const A=Wo().on("start",C=>{const{nodeLookup:P,transform:D,snapGrid:y,snapToGrid:I,nodeOrigin:v,paneDomNode:k}=n();if(g=P.get(t),!g)return;p=k?.getBoundingClientRect()??null;const{xSnapped:M,ySnapped:j}=Qe(C.sourceEvent,{transform:D,snapGrid:y,snapToGrid:I,containerBounds:p});b={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},E={...b,pointerX:M,pointerY:j,aspectRatio:b.width/b.height},S=void 0,g.parentId&&(g.extent==="parent"||g.expandParent)&&(S=P.get(g.parentId),T=S&&g.extent==="parent"?vu(S):void 0),N=[],L=void 0;for(const[B,F]of P)if(F.parentId===t&&(N.push({id:B,position:{...F.position},extent:F.extent}),F.extent==="parent"||F.expandParent)){const Y=bu(F,g,F.origin??v);L?L=[[Math.min(Y[0][0],L[0][0]),Math.min(Y[0][1],L[0][1])],[Math.max(Y[1][0],L[1][0]),Math.max(Y[1][1],L[1][1])]]:L=Y}h?.(C,{...b})}).on("drag",C=>{const{transform:P,snapGrid:D,snapToGrid:y,nodeOrigin:I}=n(),v=Qe(C.sourceEvent,{transform:P,snapGrid:D,snapToGrid:y,containerBounds:p}),k=[];if(!g)return;const{x:M,y:j,width:B,height:F}=b,Y={},X=g.origin??I,{width:O,height:x,x:z,y:V}=xu(E,s.controlDirection,v,s.boundaries,s.keepAspectRatio,X,T,L),H=O!==B,W=x!==F,G=z!==M&&H,q=V!==j&&W;if(!G&&!q&&!H&&!W)return;if((G||q||X[0]===1||X[1]===1)&&(Y.x=G?z:b.x,Y.y=q?V:b.y,b.x=Y.x,b.y=Y.y,N.length>0)){const ee=z-M,ne=V-j;for(const ce of N)ce.position={x:ce.position.x-ee+X[0]*(O-B),y:ce.position.y-ne+X[1]*(x-F)},k.push(ce)}if((H||W)&&(Y.width=H&&(!s.resizeDirection||s.resizeDirection==="horizontal")?O:b.width,Y.height=W&&(!s.resizeDirection||s.resizeDirection==="vertical")?x:b.height,b.width=Y.width,b.height=Y.height),S&&g.expandParent){const ee=X[0]*(Y.width??0);Y.x&&Y.x<ee&&(b.x=ee,E.x=E.x-(Y.x-ee));const ne=X[1]*(Y.height??0);Y.y&&Y.y<ne&&(b.y=ne,E.y=E.y-(Y.y-ne))}const U=yu({width:b.width,prevWidth:B,height:b.height,prevHeight:F,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),Q={...b,direction:U};_?.(C,Q)!==!1&&($=!0,m?.(C,Q),o(Y,k))}).on("end",C=>{$&&(w?.(C,{...b}),r?.({...b}),$=!1)});i.call(A)}function a(){i.on(".drag",null)}return{update:c,destroy:a}}const _u={},io=e=>{let t;const n=new Set,o=(u,d)=>{const f=typeof u=="function"?u(t):u;if(!Object.is(f,t)){const h=t;t=d??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(m=>m(t,h))}},r=()=>t,a={setState:o,getState:r,getInitialState:()=>l,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(_u?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},l=t=e(o,r,a);return a},Nu=e=>e?io(e):io,{useDebugValue:Su}=hs,{useSyncExternalStoreWithSelector:Cu}=Cs,ku=e=>e;function Cr(e,t=ku,n){const o=Cu(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Su(o),o}const so=(e,t)=>{const n=Nu(e),o=(r,i=t)=>Cr(n,r,i);return Object.assign(o,n),o},Mu=(e,t)=>e?so(e,t):so;function re(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[o,r]of e)if(!Object.is(r,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}const Dt=Z.createContext(null),Iu=Dt.Provider,kr=xe.error001();function te(e,t){const n=Z.useContext(Dt);if(n===null)throw new Error(kr);return Cr(n,e,t)}function ie(){const e=Z.useContext(Dt);if(e===null)throw new Error(kr);return Z.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const ao={display:"none"},Ou={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Mr="react-flow__node-desc",Ir="react-flow__edge-desc",Tu="react-flow__aria-live",Pu=e=>e.ariaLiveMessage,Au=e=>e.ariaLabelConfig;function Du({rfId:e}){const t=te(Pu);return R.jsx("div",{id:`${Tu}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Ou,children:t})}function Lu({rfId:e,disableKeyboardA11y:t}){const n=te(Au);return R.jsxs(R.Fragment,{children:[R.jsx("div",{id:`${Mr}-${e}`,style:ao,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),R.jsx("div",{id:`${Ir}-${e}`,style:ao,children:n["edge.a11yDescription.default"]}),!t&&R.jsx(Du,{rfId:e})]})}const Lt=Z.forwardRef(({position:e="top-left",children:t,className:n,style:o,...r},i)=>{const s=`${e}`.split("-");return R.jsx("div",{className:ae(["react-flow__panel",n,...s]),style:o,ref:i,...r,children:t})});Lt.displayName="Panel";function ju({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:R.jsx(Lt,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:R.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const $u=e=>{const t=[],n=[];for(const[,o]of e.nodeLookup)o.selected&&t.push(o.internals.userNode);for(const[,o]of e.edgeLookup)o.selected&&n.push(o);return{selectedNodes:t,selectedEdges:n}},pt=e=>e.id;function zu(e,t){return re(e.selectedNodes.map(pt),t.selectedNodes.map(pt))&&re(e.selectedEdges.map(pt),t.selectedEdges.map(pt))}function Ru({onSelectionChange:e}){const t=ie(),{selectedNodes:n,selectedEdges:o}=te($u,zu);return Z.useEffect(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(i=>i(r))},[n,o,e]),null}const Hu=e=>!!e.onSelectionChangeHandlers;function Vu({onSelectionChange:e}){const t=te(Hu);return e||t?R.jsx(Ru,{onSelectionChange:e}):null}const Or=[0,0],Bu={x:0,y:0,zoom:1},Fu=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],co=[...Fu,"rfId"],Yu=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),lo={translateExtent:et,nodeOrigin:Or,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Wu(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:c,setDefaultNodesAndEdges:a}=te(Yu,re),l=ie();Z.useEffect(()=>(a(e.defaultNodes,e.defaultEdges),()=>{u.current=lo,c()}),[]);const u=Z.useRef(lo);return Z.useEffect(()=>{for(const d of co){const f=e[d],h=u.current[d];f!==h&&(typeof e[d]>"u"||(d==="nodes"?t(f):d==="edges"?n(f):d==="minZoom"?o(f):d==="maxZoom"?r(f):d==="translateExtent"?i(f):d==="nodeExtent"?s(f):d==="ariaLabelConfig"?l.setState({ariaLabelConfig:Dl(f)}):d==="fitView"?l.setState({fitViewQueued:f}):d==="fitViewOptions"?l.setState({fitViewOptions:f}):l.setState({[d]:f})))}u.current=e},co.map(d=>e[d])),null}function uo(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Zu(e){const[t,n]=Z.useState(e==="system"?null:e);return Z.useEffect(()=>{if(e!=="system"){n(e);return}const o=uo(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:uo()?.matches?"dark":"light"}const fo=typeof document<"u"?document:null;function rt(e=null,t={target:fo,actInsideInputWithModifier:!0}){const[n,o]=Z.useState(!1),r=Z.useRef(!1),i=Z.useRef(new Set([])),[s,c]=Z.useMemo(()=>{if(e!==null){const l=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.replace("+",`
2
2
  `).replace(`
3
3
 
4
4
  `,`