@openrig/cli 0.2.0 → 0.3.0

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 (469) hide show
  1. package/daemon/dist/adapters/claude-code-adapter.d.ts +10 -0
  2. package/daemon/dist/adapters/claude-code-adapter.d.ts.map +1 -1
  3. package/daemon/dist/adapters/claude-code-adapter.js +41 -3
  4. package/daemon/dist/adapters/claude-code-adapter.js.map +1 -1
  5. package/daemon/dist/builtins/workflow-specs/basic-loop.yaml +76 -0
  6. package/daemon/dist/builtins/workflow-specs/conveyor.yaml +80 -0
  7. package/daemon/dist/db/migrations/026_inbox_entries.d.ts +1 -1
  8. package/daemon/dist/db/migrations/026_inbox_entries.js +1 -1
  9. package/daemon/dist/db/migrations/029_classifier_leases.d.ts +1 -1
  10. package/daemon/dist/db/migrations/029_classifier_leases.js +1 -1
  11. package/daemon/dist/db/migrations/037_mission_control_actions.d.ts +51 -0
  12. package/daemon/dist/db/migrations/037_mission_control_actions.d.ts.map +1 -0
  13. package/daemon/dist/db/migrations/037_mission_control_actions.js +74 -0
  14. package/daemon/dist/db/migrations/037_mission_control_actions.js.map +1 -0
  15. package/daemon/dist/db/migrations/038_workspace_primitive.d.ts +16 -0
  16. package/daemon/dist/db/migrations/038_workspace_primitive.d.ts.map +1 -0
  17. package/daemon/dist/db/migrations/038_workspace_primitive.js +20 -0
  18. package/daemon/dist/db/migrations/038_workspace_primitive.js.map +1 -0
  19. package/daemon/dist/db/migrations/039_queue_target_repo.d.ts +16 -0
  20. package/daemon/dist/db/migrations/039_queue_target_repo.d.ts.map +1 -0
  21. package/daemon/dist/db/migrations/039_queue_target_repo.js +21 -0
  22. package/daemon/dist/db/migrations/039_queue_target_repo.js.map +1 -0
  23. package/daemon/dist/domain/active-lens-store.d.ts +23 -0
  24. package/daemon/dist/domain/active-lens-store.d.ts.map +1 -0
  25. package/daemon/dist/domain/active-lens-store.js +87 -0
  26. package/daemon/dist/domain/active-lens-store.js.map +1 -0
  27. package/daemon/dist/domain/agent-images/agent-image-library-service.d.ts +68 -0
  28. package/daemon/dist/domain/agent-images/agent-image-library-service.d.ts.map +1 -0
  29. package/daemon/dist/domain/agent-images/agent-image-library-service.js +339 -0
  30. package/daemon/dist/domain/agent-images/agent-image-library-service.js.map +1 -0
  31. package/daemon/dist/domain/agent-images/agent-image-types.d.ts +113 -0
  32. package/daemon/dist/domain/agent-images/agent-image-types.d.ts.map +1 -0
  33. package/daemon/dist/domain/agent-images/agent-image-types.js +24 -0
  34. package/daemon/dist/domain/agent-images/agent-image-types.js.map +1 -0
  35. package/daemon/dist/domain/agent-images/evidence-guard.d.ts +26 -0
  36. package/daemon/dist/domain/agent-images/evidence-guard.d.ts.map +1 -0
  37. package/daemon/dist/domain/agent-images/evidence-guard.js +185 -0
  38. package/daemon/dist/domain/agent-images/evidence-guard.js.map +1 -0
  39. package/daemon/dist/domain/agent-images/manifest-parser.d.ts +3 -0
  40. package/daemon/dist/domain/agent-images/manifest-parser.d.ts.map +1 -0
  41. package/daemon/dist/domain/agent-images/manifest-parser.js +114 -0
  42. package/daemon/dist/domain/agent-images/manifest-parser.js.map +1 -0
  43. package/daemon/dist/domain/agent-images/resume-token-discovery.d.ts +28 -0
  44. package/daemon/dist/domain/agent-images/resume-token-discovery.d.ts.map +1 -0
  45. package/daemon/dist/domain/agent-images/resume-token-discovery.js +83 -0
  46. package/daemon/dist/domain/agent-images/resume-token-discovery.js.map +1 -0
  47. package/daemon/dist/domain/agent-images/snapshot-capturer.d.ts +36 -0
  48. package/daemon/dist/domain/agent-images/snapshot-capturer.d.ts.map +1 -0
  49. package/daemon/dist/domain/agent-images/snapshot-capturer.js +58 -0
  50. package/daemon/dist/domain/agent-images/snapshot-capturer.js.map +1 -0
  51. package/daemon/dist/domain/agent-starter-resolver.d.ts +10 -16
  52. package/daemon/dist/domain/agent-starter-resolver.d.ts.map +1 -1
  53. package/daemon/dist/domain/agent-starter-resolver.js +11 -13
  54. package/daemon/dist/domain/agent-starter-resolver.js.map +1 -1
  55. package/daemon/dist/domain/classifier-lease-manager.d.ts +1 -1
  56. package/daemon/dist/domain/classifier-lease-manager.js +1 -1
  57. package/daemon/dist/domain/conflict-detector.d.ts.map +1 -1
  58. package/daemon/dist/domain/conflict-detector.js +6 -3
  59. package/daemon/dist/domain/conflict-detector.js.map +1 -1
  60. package/daemon/dist/domain/context-monitor.d.ts +5 -4
  61. package/daemon/dist/domain/context-monitor.d.ts.map +1 -1
  62. package/daemon/dist/domain/context-monitor.js +26 -11
  63. package/daemon/dist/domain/context-monitor.js.map +1 -1
  64. package/daemon/dist/domain/context-packs/bundle-assembler.d.ts +49 -0
  65. package/daemon/dist/domain/context-packs/bundle-assembler.d.ts.map +1 -0
  66. package/daemon/dist/domain/context-packs/bundle-assembler.js +81 -0
  67. package/daemon/dist/domain/context-packs/bundle-assembler.js.map +1 -0
  68. package/daemon/dist/domain/context-packs/context-pack-library-service.d.ts +41 -0
  69. package/daemon/dist/domain/context-packs/context-pack-library-service.d.ts.map +1 -0
  70. package/daemon/dist/domain/context-packs/context-pack-library-service.js +148 -0
  71. package/daemon/dist/domain/context-packs/context-pack-library-service.js.map +1 -0
  72. package/daemon/dist/domain/context-packs/context-pack-types.d.ts +64 -0
  73. package/daemon/dist/domain/context-packs/context-pack-types.d.ts.map +1 -0
  74. package/daemon/dist/domain/context-packs/context-pack-types.js +22 -0
  75. package/daemon/dist/domain/context-packs/context-pack-types.js.map +1 -0
  76. package/daemon/dist/domain/context-packs/manifest-parser.d.ts +3 -0
  77. package/daemon/dist/domain/context-packs/manifest-parser.d.ts.map +1 -0
  78. package/daemon/dist/domain/context-packs/manifest-parser.js +74 -0
  79. package/daemon/dist/domain/context-packs/manifest-parser.js.map +1 -0
  80. package/daemon/dist/domain/context-usage-store.d.ts +14 -1
  81. package/daemon/dist/domain/context-usage-store.d.ts.map +1 -1
  82. package/daemon/dist/domain/context-usage-store.js +156 -1
  83. package/daemon/dist/domain/context-usage-store.js.map +1 -1
  84. package/daemon/dist/domain/files/file-write-service.d.ts +61 -0
  85. package/daemon/dist/domain/files/file-write-service.d.ts.map +1 -0
  86. package/daemon/dist/domain/files/file-write-service.js +180 -0
  87. package/daemon/dist/domain/files/file-write-service.js.map +1 -0
  88. package/daemon/dist/domain/files/path-safety.d.ts +47 -0
  89. package/daemon/dist/domain/files/path-safety.d.ts.map +1 -0
  90. package/daemon/dist/domain/files/path-safety.js +176 -0
  91. package/daemon/dist/domain/files/path-safety.js.map +1 -0
  92. package/daemon/dist/domain/graph-projection.d.ts +14 -1
  93. package/daemon/dist/domain/graph-projection.d.ts.map +1 -1
  94. package/daemon/dist/domain/graph-projection.js +8 -0
  95. package/daemon/dist/domain/graph-projection.js.map +1 -1
  96. package/daemon/dist/domain/install-engine.d.ts.map +1 -1
  97. package/daemon/dist/domain/install-engine.js +22 -6
  98. package/daemon/dist/domain/install-engine.js.map +1 -1
  99. package/daemon/dist/domain/install-verifier.d.ts.map +1 -1
  100. package/daemon/dist/domain/install-verifier.js +10 -5
  101. package/daemon/dist/domain/install-verifier.js.map +1 -1
  102. package/daemon/dist/domain/managed-blocks.d.ts.map +1 -1
  103. package/daemon/dist/domain/managed-blocks.js +22 -3
  104. package/daemon/dist/domain/managed-blocks.js.map +1 -1
  105. package/daemon/dist/domain/mission-control/audit-browse.d.ts +26 -0
  106. package/daemon/dist/domain/mission-control/audit-browse.d.ts.map +1 -0
  107. package/daemon/dist/domain/mission-control/audit-browse.js +101 -0
  108. package/daemon/dist/domain/mission-control/audit-browse.js.map +1 -0
  109. package/daemon/dist/domain/mission-control/mission-control-action-log.d.ts +51 -0
  110. package/daemon/dist/domain/mission-control/mission-control-action-log.d.ts.map +1 -0
  111. package/daemon/dist/domain/mission-control/mission-control-action-log.js +124 -0
  112. package/daemon/dist/domain/mission-control/mission-control-action-log.js.map +1 -0
  113. package/daemon/dist/domain/mission-control/mission-control-fleet-cli-capability.d.ts +131 -0
  114. package/daemon/dist/domain/mission-control/mission-control-fleet-cli-capability.d.ts.map +1 -0
  115. package/daemon/dist/domain/mission-control/mission-control-fleet-cli-capability.js +232 -0
  116. package/daemon/dist/domain/mission-control/mission-control-fleet-cli-capability.js.map +1 -0
  117. package/daemon/dist/domain/mission-control/mission-control-read-layer.d.ts +85 -0
  118. package/daemon/dist/domain/mission-control/mission-control-read-layer.d.ts.map +1 -0
  119. package/daemon/dist/domain/mission-control/mission-control-read-layer.js +265 -0
  120. package/daemon/dist/domain/mission-control/mission-control-read-layer.js.map +1 -0
  121. package/daemon/dist/domain/mission-control/mission-control-write-contract.d.ts +69 -0
  122. package/daemon/dist/domain/mission-control/mission-control-write-contract.d.ts.map +1 -0
  123. package/daemon/dist/domain/mission-control/mission-control-write-contract.js +300 -0
  124. package/daemon/dist/domain/mission-control/mission-control-write-contract.js.map +1 -0
  125. package/daemon/dist/domain/mission-control/notification-adapter-ntfy.d.ts +18 -0
  126. package/daemon/dist/domain/mission-control/notification-adapter-ntfy.d.ts.map +1 -0
  127. package/daemon/dist/domain/mission-control/notification-adapter-ntfy.js +48 -0
  128. package/daemon/dist/domain/mission-control/notification-adapter-ntfy.js.map +1 -0
  129. package/daemon/dist/domain/mission-control/notification-adapter-types.d.ts +25 -0
  130. package/daemon/dist/domain/mission-control/notification-adapter-types.d.ts.map +1 -0
  131. package/daemon/dist/domain/mission-control/notification-adapter-types.js +7 -0
  132. package/daemon/dist/domain/mission-control/notification-adapter-types.js.map +1 -0
  133. package/daemon/dist/domain/mission-control/notification-adapter-webhook.d.ts +27 -0
  134. package/daemon/dist/domain/mission-control/notification-adapter-webhook.d.ts.map +1 -0
  135. package/daemon/dist/domain/mission-control/notification-adapter-webhook.js +47 -0
  136. package/daemon/dist/domain/mission-control/notification-adapter-webhook.js.map +1 -0
  137. package/daemon/dist/domain/mission-control/notification-dispatcher.d.ts +53 -0
  138. package/daemon/dist/domain/mission-control/notification-dispatcher.d.ts.map +1 -0
  139. package/daemon/dist/domain/mission-control/notification-dispatcher.js +181 -0
  140. package/daemon/dist/domain/mission-control/notification-dispatcher.js.map +1 -0
  141. package/daemon/dist/domain/node-inventory.d.ts.map +1 -1
  142. package/daemon/dist/domain/node-inventory.js +24 -0
  143. package/daemon/dist/domain/node-inventory.js.map +1 -1
  144. package/daemon/dist/domain/node-launcher.d.ts.map +1 -1
  145. package/daemon/dist/domain/node-launcher.js +7 -5
  146. package/daemon/dist/domain/node-launcher.js.map +1 -1
  147. package/daemon/dist/domain/preview/preview-rate-limiter.d.ts +20 -0
  148. package/daemon/dist/domain/preview/preview-rate-limiter.d.ts.map +1 -0
  149. package/daemon/dist/domain/preview/preview-rate-limiter.js +46 -0
  150. package/daemon/dist/domain/preview/preview-rate-limiter.js.map +1 -0
  151. package/daemon/dist/domain/profile-resolver.d.ts +5 -0
  152. package/daemon/dist/domain/profile-resolver.d.ts.map +1 -1
  153. package/daemon/dist/domain/profile-resolver.js +62 -8
  154. package/daemon/dist/domain/profile-resolver.js.map +1 -1
  155. package/daemon/dist/domain/progress/progress-indexer.d.ts +73 -0
  156. package/daemon/dist/domain/progress/progress-indexer.d.ts.map +1 -0
  157. package/daemon/dist/domain/progress/progress-indexer.js +210 -0
  158. package/daemon/dist/domain/progress/progress-indexer.js.map +1 -0
  159. package/daemon/dist/domain/project-classifier.d.ts +1 -1
  160. package/daemon/dist/domain/queue-repository.d.ts +22 -4
  161. package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
  162. package/daemon/dist/domain/queue-repository.js +80 -22
  163. package/daemon/dist/domain/queue-repository.js.map +1 -1
  164. package/daemon/dist/domain/rehydrate-eligibility.d.ts +16 -0
  165. package/daemon/dist/domain/rehydrate-eligibility.d.ts.map +1 -0
  166. package/daemon/dist/domain/rehydrate-eligibility.js +43 -0
  167. package/daemon/dist/domain/rehydrate-eligibility.js.map +1 -0
  168. package/daemon/dist/domain/restore-check-service.d.ts.map +1 -1
  169. package/daemon/dist/domain/restore-check-service.js +19 -6
  170. package/daemon/dist/domain/restore-check-service.js.map +1 -1
  171. package/daemon/dist/domain/restore-orchestrator.d.ts.map +1 -1
  172. package/daemon/dist/domain/restore-orchestrator.js +4 -2
  173. package/daemon/dist/domain/restore-orchestrator.js.map +1 -1
  174. package/daemon/dist/domain/rig-repository.d.ts +14 -0
  175. package/daemon/dist/domain/rig-repository.d.ts.map +1 -1
  176. package/daemon/dist/domain/rig-repository.js +41 -0
  177. package/daemon/dist/domain/rig-repository.js.map +1 -1
  178. package/daemon/dist/domain/rig-teardown.d.ts.map +1 -1
  179. package/daemon/dist/domain/rig-teardown.js +5 -0
  180. package/daemon/dist/domain/rig-teardown.js.map +1 -1
  181. package/daemon/dist/domain/rigspec-codec.d.ts.map +1 -1
  182. package/daemon/dist/domain/rigspec-codec.js +15 -0
  183. package/daemon/dist/domain/rigspec-codec.js.map +1 -1
  184. package/daemon/dist/domain/rigspec-instantiator.d.ts +29 -0
  185. package/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
  186. package/daemon/dist/domain/rigspec-instantiator.js +136 -4
  187. package/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
  188. package/daemon/dist/domain/rigspec-schema.d.ts.map +1 -1
  189. package/daemon/dist/domain/rigspec-schema.js +157 -4
  190. package/daemon/dist/domain/rigspec-schema.js.map +1 -1
  191. package/daemon/dist/domain/runtime-adapter.d.ts +11 -0
  192. package/daemon/dist/domain/runtime-adapter.d.ts.map +1 -1
  193. package/daemon/dist/domain/runtime-adapter.js.map +1 -1
  194. package/daemon/dist/domain/skill-discovery.d.ts +51 -0
  195. package/daemon/dist/domain/skill-discovery.d.ts.map +1 -0
  196. package/daemon/dist/domain/skill-discovery.js +144 -0
  197. package/daemon/dist/domain/skill-discovery.js.map +1 -0
  198. package/daemon/dist/domain/slices/slice-detail-projector.d.ts +182 -0
  199. package/daemon/dist/domain/slices/slice-detail-projector.d.ts.map +1 -0
  200. package/daemon/dist/domain/slices/slice-detail-projector.js +508 -0
  201. package/daemon/dist/domain/slices/slice-detail-projector.js.map +1 -0
  202. package/daemon/dist/domain/slices/slice-indexer.d.ts +118 -0
  203. package/daemon/dist/domain/slices/slice-indexer.d.ts.map +1 -0
  204. package/daemon/dist/domain/slices/slice-indexer.js +503 -0
  205. package/daemon/dist/domain/slices/slice-indexer.js.map +1 -0
  206. package/daemon/dist/domain/spec-library-service.d.ts +17 -2
  207. package/daemon/dist/domain/spec-library-service.d.ts.map +1 -1
  208. package/daemon/dist/domain/spec-library-service.js +31 -1
  209. package/daemon/dist/domain/spec-library-service.js.map +1 -1
  210. package/daemon/dist/domain/spec-library-workflow-scanner.d.ts +81 -0
  211. package/daemon/dist/domain/spec-library-workflow-scanner.d.ts.map +1 -0
  212. package/daemon/dist/domain/spec-library-workflow-scanner.js +171 -0
  213. package/daemon/dist/domain/spec-library-workflow-scanner.js.map +1 -0
  214. package/daemon/dist/domain/startup-validation.d.ts.map +1 -1
  215. package/daemon/dist/domain/startup-validation.js +57 -11
  216. package/daemon/dist/domain/startup-validation.js.map +1 -1
  217. package/daemon/dist/domain/steering/health-summary.d.ts +39 -0
  218. package/daemon/dist/domain/steering/health-summary.d.ts.map +1 -0
  219. package/daemon/dist/domain/steering/health-summary.js +100 -0
  220. package/daemon/dist/domain/steering/health-summary.js.map +1 -0
  221. package/daemon/dist/domain/steering/steering-composer.d.ts +102 -0
  222. package/daemon/dist/domain/steering/steering-composer.d.ts.map +1 -0
  223. package/daemon/dist/domain/steering/steering-composer.js +263 -0
  224. package/daemon/dist/domain/steering/steering-composer.js.map +1 -0
  225. package/daemon/dist/domain/transcript-capture.d.ts.map +1 -1
  226. package/daemon/dist/domain/transcript-capture.js +7 -4
  227. package/daemon/dist/domain/transcript-capture.js.map +1 -1
  228. package/daemon/dist/domain/transcript-rotation.d.ts +29 -0
  229. package/daemon/dist/domain/transcript-rotation.d.ts.map +1 -0
  230. package/daemon/dist/domain/transcript-rotation.js +109 -0
  231. package/daemon/dist/domain/transcript-rotation.js.map +1 -0
  232. package/daemon/dist/domain/transcript-store.d.ts.map +1 -1
  233. package/daemon/dist/domain/transcript-store.js +7 -1
  234. package/daemon/dist/domain/transcript-store.js.map +1 -1
  235. package/daemon/dist/domain/types.d.ts +101 -2
  236. package/daemon/dist/domain/types.d.ts.map +1 -1
  237. package/daemon/dist/domain/types.js +8 -1
  238. package/daemon/dist/domain/types.js.map +1 -1
  239. package/daemon/dist/domain/user-settings/settings-store.d.ts +42 -0
  240. package/daemon/dist/domain/user-settings/settings-store.d.ts.map +1 -0
  241. package/daemon/dist/domain/user-settings/settings-store.js +364 -0
  242. package/daemon/dist/domain/user-settings/settings-store.js.map +1 -0
  243. package/daemon/dist/domain/view-event-bridge.d.ts.map +1 -1
  244. package/daemon/dist/domain/view-event-bridge.js +2 -3
  245. package/daemon/dist/domain/view-event-bridge.js.map +1 -1
  246. package/daemon/dist/domain/whoami-service.d.ts +29 -0
  247. package/daemon/dist/domain/whoami-service.d.ts.map +1 -1
  248. package/daemon/dist/domain/whoami-service.js +68 -0
  249. package/daemon/dist/domain/whoami-service.js.map +1 -1
  250. package/daemon/dist/domain/workflow/slice-workflow-binding.d.ts +21 -0
  251. package/daemon/dist/domain/workflow/slice-workflow-binding.d.ts.map +1 -0
  252. package/daemon/dist/domain/workflow/slice-workflow-binding.js +103 -0
  253. package/daemon/dist/domain/workflow/slice-workflow-binding.js.map +1 -0
  254. package/daemon/dist/domain/workflow/slice-workflow-projection.d.ts +81 -0
  255. package/daemon/dist/domain/workflow/slice-workflow-projection.d.ts.map +1 -0
  256. package/daemon/dist/domain/workflow/slice-workflow-projection.js +127 -0
  257. package/daemon/dist/domain/workflow/slice-workflow-projection.js.map +1 -0
  258. package/daemon/dist/domain/workflow/starter-spec-loader.d.ts +51 -0
  259. package/daemon/dist/domain/workflow/starter-spec-loader.d.ts.map +1 -0
  260. package/daemon/dist/domain/workflow/starter-spec-loader.js +140 -0
  261. package/daemon/dist/domain/workflow/starter-spec-loader.js.map +1 -0
  262. package/daemon/dist/domain/workflow-projector.js +11 -3
  263. package/daemon/dist/domain/workflow-projector.js.map +1 -1
  264. package/daemon/dist/domain/workflow-spec-cache.d.ts +7 -0
  265. package/daemon/dist/domain/workflow-spec-cache.d.ts.map +1 -1
  266. package/daemon/dist/domain/workflow-spec-cache.js +62 -15
  267. package/daemon/dist/domain/workflow-spec-cache.js.map +1 -1
  268. package/daemon/dist/domain/workspace/default-workspace-scaffold.d.ts +6 -0
  269. package/daemon/dist/domain/workspace/default-workspace-scaffold.d.ts.map +1 -0
  270. package/daemon/dist/domain/workspace/default-workspace-scaffold.js +207 -0
  271. package/daemon/dist/domain/workspace/default-workspace-scaffold.js.map +1 -0
  272. package/daemon/dist/domain/workspace/frontmatter-validator.d.ts +40 -0
  273. package/daemon/dist/domain/workspace/frontmatter-validator.d.ts.map +1 -0
  274. package/daemon/dist/domain/workspace/frontmatter-validator.js +185 -0
  275. package/daemon/dist/domain/workspace/frontmatter-validator.js.map +1 -0
  276. package/daemon/dist/domain/workspace/workspace-resolver.d.ts +25 -0
  277. package/daemon/dist/domain/workspace/workspace-resolver.d.ts.map +1 -0
  278. package/daemon/dist/domain/workspace/workspace-resolver.js +86 -0
  279. package/daemon/dist/domain/workspace/workspace-resolver.js.map +1 -0
  280. package/daemon/dist/index.d.ts.map +1 -1
  281. package/daemon/dist/index.js +10 -1
  282. package/daemon/dist/index.js.map +1 -1
  283. package/daemon/dist/middleware/auth-bearer-token.d.ts +49 -0
  284. package/daemon/dist/middleware/auth-bearer-token.d.ts.map +1 -0
  285. package/daemon/dist/middleware/auth-bearer-token.js +135 -0
  286. package/daemon/dist/middleware/auth-bearer-token.js.map +1 -0
  287. package/daemon/dist/openrig-compat.d.ts +1 -1
  288. package/daemon/dist/openrig-compat.d.ts.map +1 -1
  289. package/daemon/dist/openrig-compat.js +6 -4
  290. package/daemon/dist/openrig-compat.js.map +1 -1
  291. package/daemon/dist/routes/agent-images.d.ts +8 -0
  292. package/daemon/dist/routes/agent-images.d.ts.map +1 -0
  293. package/daemon/dist/routes/agent-images.js +253 -0
  294. package/daemon/dist/routes/agent-images.js.map +1 -0
  295. package/daemon/dist/routes/config.d.ts +3 -0
  296. package/daemon/dist/routes/config.d.ts.map +1 -0
  297. package/daemon/dist/routes/config.js +109 -0
  298. package/daemon/dist/routes/config.js.map +1 -0
  299. package/daemon/dist/routes/context-packs.d.ts +3 -0
  300. package/daemon/dist/routes/context-packs.d.ts.map +1 -0
  301. package/daemon/dist/routes/context-packs.js +129 -0
  302. package/daemon/dist/routes/context-packs.js.map +1 -0
  303. package/daemon/dist/routes/files.d.ts +17 -0
  304. package/daemon/dist/routes/files.d.ts.map +1 -0
  305. package/daemon/dist/routes/files.js +262 -0
  306. package/daemon/dist/routes/files.js.map +1 -0
  307. package/daemon/dist/routes/health-summary.d.ts +9 -0
  308. package/daemon/dist/routes/health-summary.d.ts.map +1 -0
  309. package/daemon/dist/routes/health-summary.js +33 -0
  310. package/daemon/dist/routes/health-summary.js.map +1 -0
  311. package/daemon/dist/routes/mission-control.d.ts +37 -0
  312. package/daemon/dist/routes/mission-control.d.ts.map +1 -0
  313. package/daemon/dist/routes/mission-control.js +283 -0
  314. package/daemon/dist/routes/mission-control.js.map +1 -0
  315. package/daemon/dist/routes/progress.d.ts +7 -0
  316. package/daemon/dist/routes/progress.d.ts.map +1 -0
  317. package/daemon/dist/routes/progress.js +33 -0
  318. package/daemon/dist/routes/progress.js.map +1 -0
  319. package/daemon/dist/routes/queue.d.ts.map +1 -1
  320. package/daemon/dist/routes/queue.js +52 -1
  321. package/daemon/dist/routes/queue.js.map +1 -1
  322. package/daemon/dist/routes/rigs.d.ts +3 -0
  323. package/daemon/dist/routes/rigs.d.ts.map +1 -1
  324. package/daemon/dist/routes/rigs.js +73 -7
  325. package/daemon/dist/routes/rigs.js.map +1 -1
  326. package/daemon/dist/routes/rigspec.js +6 -3
  327. package/daemon/dist/routes/rigspec.js.map +1 -1
  328. package/daemon/dist/routes/sessions.d.ts.map +1 -1
  329. package/daemon/dist/routes/sessions.js +119 -0
  330. package/daemon/dist/routes/sessions.js.map +1 -1
  331. package/daemon/dist/routes/slices.d.ts +9 -0
  332. package/daemon/dist/routes/slices.d.ts.map +1 -0
  333. package/daemon/dist/routes/slices.js +192 -0
  334. package/daemon/dist/routes/slices.js.map +1 -0
  335. package/daemon/dist/routes/spec-library.d.ts.map +1 -1
  336. package/daemon/dist/routes/spec-library.js +72 -5
  337. package/daemon/dist/routes/spec-library.js.map +1 -1
  338. package/daemon/dist/routes/steering.d.ts +7 -0
  339. package/daemon/dist/routes/steering.d.ts.map +1 -0
  340. package/daemon/dist/routes/steering.js +27 -0
  341. package/daemon/dist/routes/steering.js.map +1 -0
  342. package/daemon/dist/routes/up.d.ts.map +1 -1
  343. package/daemon/dist/routes/up.js +21 -3
  344. package/daemon/dist/routes/up.js.map +1 -1
  345. package/daemon/dist/routes/whoami.d.ts.map +1 -1
  346. package/daemon/dist/routes/whoami.js +6 -1
  347. package/daemon/dist/routes/whoami.js.map +1 -1
  348. package/daemon/dist/routes/workflow.d.ts.map +1 -1
  349. package/daemon/dist/routes/workflow.js +43 -0
  350. package/daemon/dist/routes/workflow.js.map +1 -1
  351. package/daemon/dist/routes/workspace.d.ts +3 -0
  352. package/daemon/dist/routes/workspace.d.ts.map +1 -0
  353. package/daemon/dist/routes/workspace.js +53 -0
  354. package/daemon/dist/routes/workspace.js.map +1 -0
  355. package/daemon/dist/server.d.ts +51 -0
  356. package/daemon/dist/server.d.ts.map +1 -1
  357. package/daemon/dist/server.js +52 -1
  358. package/daemon/dist/server.js.map +1 -1
  359. package/daemon/dist/startup.d.ts +9 -0
  360. package/daemon/dist/startup.d.ts.map +1 -1
  361. package/daemon/dist/startup.js +385 -2
  362. package/daemon/dist/startup.js.map +1 -1
  363. package/daemon/docs/reference/agent-spec.md +7 -7
  364. package/daemon/docs/reference/agent-startup-guide.md +2 -2
  365. package/daemon/docs/reference/project-workspace.md +102 -0
  366. package/daemon/specs/agents/apps/vault-specialist/agent.yaml +1 -1
  367. package/daemon/specs/agents/apps/vault-specialist/guidance/role.md +0 -1
  368. package/daemon/specs/agents/conveyor/builder/agent.yaml +35 -0
  369. package/daemon/specs/agents/conveyor/builder/guidance/role.md +31 -0
  370. package/daemon/specs/agents/conveyor/builder/startup/context.md +9 -0
  371. package/daemon/specs/agents/conveyor/lead/agent.yaml +35 -0
  372. package/daemon/specs/agents/conveyor/lead/guidance/role.md +34 -0
  373. package/daemon/specs/agents/conveyor/lead/startup/context.md +15 -0
  374. package/daemon/specs/agents/conveyor/planner/agent.yaml +35 -0
  375. package/daemon/specs/agents/conveyor/planner/guidance/role.md +29 -0
  376. package/daemon/specs/agents/conveyor/planner/startup/context.md +12 -0
  377. package/daemon/specs/agents/conveyor/reviewer/agent.yaml +35 -0
  378. package/daemon/specs/agents/conveyor/reviewer/guidance/role.md +29 -0
  379. package/daemon/specs/agents/conveyor/reviewer/startup/context.md +10 -0
  380. package/daemon/specs/agents/development/implementer/agent.yaml +1 -1
  381. package/daemon/specs/agents/development/implementer/guidance/role.md +0 -1
  382. package/daemon/specs/agents/orchestration/orchestrator/agent.yaml +1 -1
  383. package/daemon/specs/agents/orchestration/orchestrator/guidance/role.md +2 -3
  384. package/daemon/specs/agents/shared/agent.yaml +0 -2
  385. package/daemon/specs/agents/shared/skills/core/openrig-user/SKILL.md +25 -0
  386. package/daemon/specs/agents/shared/skills/core/openrig-user-settings/SKILL.md +153 -0
  387. package/daemon/specs/agents/shared/skills/rig-architect/SKILL.md +1 -1
  388. package/daemon/specs/rigs/launch/conveyor/CULTURE.md +34 -0
  389. package/daemon/specs/rigs/launch/conveyor/README.md +33 -0
  390. package/daemon/specs/rigs/launch/conveyor/rig.yaml +72 -0
  391. package/daemon/specs/rigs/preview/product-team/CULTURE.md +2 -2
  392. package/daemon/specs/rigs/preview/product-team/rig.yaml +3 -4
  393. package/dist/commands/agent-image.d.ts +4 -0
  394. package/dist/commands/agent-image.d.ts.map +1 -0
  395. package/dist/commands/agent-image.js +352 -0
  396. package/dist/commands/agent-image.js.map +1 -0
  397. package/dist/commands/config-init-workspace.d.ts +35 -0
  398. package/dist/commands/config-init-workspace.d.ts.map +1 -0
  399. package/dist/commands/config-init-workspace.js +300 -0
  400. package/dist/commands/config-init-workspace.js.map +1 -0
  401. package/dist/commands/config.d.ts.map +1 -1
  402. package/dist/commands/config.js +78 -18
  403. package/dist/commands/config.js.map +1 -1
  404. package/dist/commands/context-pack.d.ts +4 -0
  405. package/dist/commands/context-pack.d.ts.map +1 -0
  406. package/dist/commands/context-pack.js +357 -0
  407. package/dist/commands/context-pack.js.map +1 -0
  408. package/dist/commands/daemon.d.ts.map +1 -1
  409. package/dist/commands/daemon.js +8 -0
  410. package/dist/commands/daemon.js.map +1 -1
  411. package/dist/commands/import.d.ts.map +1 -1
  412. package/dist/commands/import.js +7 -2
  413. package/dist/commands/import.js.map +1 -1
  414. package/dist/commands/ps.d.ts.map +1 -1
  415. package/dist/commands/ps.js +173 -14
  416. package/dist/commands/ps.js.map +1 -1
  417. package/dist/commands/queue.d.ts.map +1 -1
  418. package/dist/commands/queue.js +9 -0
  419. package/dist/commands/queue.js.map +1 -1
  420. package/dist/commands/send.d.ts +7 -0
  421. package/dist/commands/send.d.ts.map +1 -1
  422. package/dist/commands/send.js +24 -1
  423. package/dist/commands/send.js.map +1 -1
  424. package/dist/commands/specs.d.ts +4 -2
  425. package/dist/commands/specs.d.ts.map +1 -1
  426. package/dist/commands/specs.js +12 -8
  427. package/dist/commands/specs.js.map +1 -1
  428. package/dist/commands/up.d.ts.map +1 -1
  429. package/dist/commands/up.js +17 -3
  430. package/dist/commands/up.js.map +1 -1
  431. package/dist/commands/whoami.d.ts.map +1 -1
  432. package/dist/commands/whoami.js +9 -4
  433. package/dist/commands/whoami.js.map +1 -1
  434. package/dist/commands/workflow.d.ts.map +1 -1
  435. package/dist/commands/workflow.js +37 -0
  436. package/dist/commands/workflow.js.map +1 -1
  437. package/dist/commands/workspace.d.ts +6 -0
  438. package/dist/commands/workspace.d.ts.map +1 -0
  439. package/dist/commands/workspace.js +83 -0
  440. package/dist/commands/workspace.js.map +1 -0
  441. package/dist/config-store.d.ts +73 -1
  442. package/dist/config-store.d.ts.map +1 -1
  443. package/dist/config-store.js +314 -42
  444. package/dist/config-store.js.map +1 -1
  445. package/dist/daemon-lifecycle.d.ts +22 -0
  446. package/dist/daemon-lifecycle.d.ts.map +1 -1
  447. package/dist/daemon-lifecycle.js +41 -0
  448. package/dist/daemon-lifecycle.js.map +1 -1
  449. package/dist/index.d.ts +4 -0
  450. package/dist/index.d.ts.map +1 -1
  451. package/dist/index.js +6 -0
  452. package/dist/index.js.map +1 -1
  453. package/dist/openrig-compat.d.ts +1 -1
  454. package/dist/openrig-compat.d.ts.map +1 -1
  455. package/dist/openrig-compat.js +6 -4
  456. package/dist/openrig-compat.js.map +1 -1
  457. package/dist/restore-packet/claude-transcript-parser.js +1 -1
  458. package/dist/restore-packet/claude-transcript-parser.js.map +1 -1
  459. package/dist/restore-packet/codex-jsonl-parser.js +1 -1
  460. package/dist/restore-packet/codex-jsonl-parser.js.map +1 -1
  461. package/package.json +2 -2
  462. package/ui/dist/assets/index-BDHU1JUK.js +412 -0
  463. package/ui/dist/assets/index-DXTyJSqu.css +1 -0
  464. package/ui/dist/graphics/operator-climber-monochrome.png +0 -0
  465. package/ui/dist/index.html +3 -2
  466. package/daemon/specs/agents/shared/skills/mental-model-ha/SKILL.md +0 -956
  467. package/ui/dist/assets/index-B09doO8H.js +0 -139
  468. package/ui/dist/assets/index-Dec25siz.css +0 -1
  469. package/ui/dist/assets/index-GNYaWmBj.js +0 -225
@@ -0,0 +1,412 @@
1
+ var Rz=Object.defineProperty;var aR=e=>{throw TypeError(e)};var Ez=(e,t,n)=>t in e?Rz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Qn=(e,t,n)=>Ez(e,typeof t!="symbol"?t+"":t,n),zx=(e,t,n)=>t.has(e)||aR("Cannot "+n);var K=(e,t,n)=>(zx(e,t,"read from private field"),n?n.call(e):t.get(e)),be=(e,t,n)=>t.has(e)?aR("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),pe=(e,t,n,s)=>(zx(e,t,"write to private field"),s?s.call(e,n):t.set(e,n),n),Ae=(e,t,n)=>(zx(e,t,"access private method"),n);var Kf=(e,t,n,s)=>({set _(r){pe(e,t,r,n)},get _(){return K(e,t,s)}});function Az(e,t){for(var n=0;n<t.length;n++){const s=t[n];if(typeof s!="string"&&!Array.isArray(s)){for(const r in s)if(r!=="default"&&!(r in e)){const o=Object.getOwnPropertyDescriptor(s,r);o&&Object.defineProperty(e,r,o.get?o:{enumerable:!0,get:()=>s[r]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))s(r);new MutationObserver(r=>{for(const o of r)if(o.type==="childList")for(const c of o.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&s(c)}).observe(document,{childList:!0,subtree:!0});function n(r){const o={};return r.integrity&&(o.integrity=r.integrity),r.referrerPolicy&&(o.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?o.credentials="include":r.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(r){if(r.ep)return;r.ep=!0;const o=n(r);fetch(r.href,o)}})();var Yf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Np(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Bx={exports:{}},Qc={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var oR;function Tz(){if(oR)return Qc;oR=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(s,r,o){var c=null;if(o!==void 0&&(c=""+o),r.key!==void 0&&(c=""+r.key),"key"in r){o={};for(var u in r)u!=="key"&&(o[u]=r[u])}else o=r;return r=o.ref,{$$typeof:e,type:s,key:c,ref:r!==void 0?r:null,props:o}}return Qc.Fragment=t,Qc.jsx=n,Qc.jsxs=n,Qc}var lR;function Mz(){return lR||(lR=1,Bx.exports=Tz()),Bx.exports}var a=Mz(),Fx={exports:{}},Le={};/**
10
+ * @license React
11
+ * react.production.js
12
+ *
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var cR;function Iz(){if(cR)return Le;cR=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),c=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),x=Symbol.iterator;function v(D){return D===null||typeof D!="object"?null:(D=x&&D[x]||D["@@iterator"],typeof D=="function"?D:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,S={};function N(D,U,te){this.props=D,this.context=U,this.refs=S,this.updater=te||b}N.prototype.isReactComponent={},N.prototype.setState=function(D,U){if(typeof D!="object"&&typeof D!="function"&&D!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,D,U,"setState")},N.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function C(){}C.prototype=N.prototype;function k(D,U,te){this.props=D,this.context=U,this.refs=S,this.updater=te||b}var _=k.prototype=new C;_.constructor=k,w(_,N.prototype),_.isPureReactComponent=!0;var E=Array.isArray;function M(){}var A={H:null,A:null,T:null,S:null},O=Object.prototype.hasOwnProperty;function L(D,U,te){var H=te.ref;return{$$typeof:e,type:D,key:U,ref:H!==void 0?H:null,props:te}}function P(D,U){return L(D.type,U,D.props)}function I(D){return typeof D=="object"&&D!==null&&D.$$typeof===e}function B(D){var U={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(te){return U[te]})}var F=/\/+/g;function z(D,U){return typeof D=="object"&&D!==null&&D.key!=null?B(""+D.key):U.toString(36)}function Y(D){switch(D.status){case"fulfilled":return D.value;case"rejected":throw D.reason;default:switch(typeof D.status=="string"?D.then(M,M):(D.status="pending",D.then(function(U){D.status==="pending"&&(D.status="fulfilled",D.value=U)},function(U){D.status==="pending"&&(D.status="rejected",D.reason=U)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function $(D,U,te,H,W){var Q=typeof D;(Q==="undefined"||Q==="boolean")&&(D=null);var se=!1;if(D===null)se=!0;else switch(Q){case"bigint":case"string":case"number":se=!0;break;case"object":switch(D.$$typeof){case e:case t:se=!0;break;case p:return se=D._init,$(se(D._payload),U,te,H,W)}}if(se)return W=W(D),se=H===""?"."+z(D,0):H,E(W)?(te="",se!=null&&(te=se.replace(F,"$&/")+"/"),$(W,U,te,"",function(me){return me})):W!=null&&(I(W)&&(W=P(W,te+(W.key==null||D&&D.key===W.key?"":(""+W.key).replace(F,"$&/")+"/")+se)),U.push(W)),1;se=0;var re=H===""?".":H+":";if(E(D))for(var ce=0;ce<D.length;ce++)H=D[ce],Q=re+z(H,ce),se+=$(H,U,te,Q,W);else if(ce=v(D),typeof ce=="function")for(D=ce.call(D),ce=0;!(H=D.next()).done;)H=H.value,Q=re+z(H,ce++),se+=$(H,U,te,Q,W);else if(Q==="object"){if(typeof D.then=="function")return $(Y(D),U,te,H,W);throw U=String(D),Error("Objects are not valid as a React child (found: "+(U==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":U)+"). If you meant to render a collection of children, use an array instead.")}return se}function V(D,U,te){if(D==null)return D;var H=[],W=0;return $(D,H,"","",function(Q){return U.call(te,Q,W++)}),H}function G(D){if(D._status===-1){var U=D._result;U=U(),U.then(function(te){(D._status===0||D._status===-1)&&(D._status=1,D._result=te)},function(te){(D._status===0||D._status===-1)&&(D._status=2,D._result=te)}),D._status===-1&&(D._status=0,D._result=U)}if(D._status===1)return D._result.default;throw D._result}var Z=typeof reportError=="function"?reportError:function(D){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var U=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof D=="object"&&D!==null&&typeof D.message=="string"?String(D.message):String(D),error:D});if(!window.dispatchEvent(U))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",D);return}console.error(D)},J={map:V,forEach:function(D,U,te){V(D,function(){U.apply(this,arguments)},te)},count:function(D){var U=0;return V(D,function(){U++}),U},toArray:function(D){return V(D,function(U){return U})||[]},only:function(D){if(!I(D))throw Error("React.Children.only expected to receive a single React element child.");return D}};return Le.Activity=g,Le.Children=J,Le.Component=N,Le.Fragment=n,Le.Profiler=r,Le.PureComponent=k,Le.StrictMode=s,Le.Suspense=f,Le.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=A,Le.__COMPILER_RUNTIME={__proto__:null,c:function(D){return A.H.useMemoCache(D)}},Le.cache=function(D){return function(){return D.apply(null,arguments)}},Le.cacheSignal=function(){return null},Le.cloneElement=function(D,U,te){if(D==null)throw Error("The argument must be a React element, but you passed "+D+".");var H=w({},D.props),W=D.key;if(U!=null)for(Q in U.key!==void 0&&(W=""+U.key),U)!O.call(U,Q)||Q==="key"||Q==="__self"||Q==="__source"||Q==="ref"&&U.ref===void 0||(H[Q]=U[Q]);var Q=arguments.length-2;if(Q===1)H.children=te;else if(1<Q){for(var se=Array(Q),re=0;re<Q;re++)se[re]=arguments[re+2];H.children=se}return L(D.type,W,H)},Le.createContext=function(D){return D={$$typeof:c,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null},D.Provider=D,D.Consumer={$$typeof:o,_context:D},D},Le.createElement=function(D,U,te){var H,W={},Q=null;if(U!=null)for(H in U.key!==void 0&&(Q=""+U.key),U)O.call(U,H)&&H!=="key"&&H!=="__self"&&H!=="__source"&&(W[H]=U[H]);var se=arguments.length-2;if(se===1)W.children=te;else if(1<se){for(var re=Array(se),ce=0;ce<se;ce++)re[ce]=arguments[ce+2];W.children=re}if(D&&D.defaultProps)for(H in se=D.defaultProps,se)W[H]===void 0&&(W[H]=se[H]);return L(D,Q,W)},Le.createRef=function(){return{current:null}},Le.forwardRef=function(D){return{$$typeof:u,render:D}},Le.isValidElement=I,Le.lazy=function(D){return{$$typeof:p,_payload:{_status:-1,_result:D},_init:G}},Le.memo=function(D,U){return{$$typeof:h,type:D,compare:U===void 0?null:U}},Le.startTransition=function(D){var U=A.T,te={};A.T=te;try{var H=D(),W=A.S;W!==null&&W(te,H),typeof H=="object"&&H!==null&&typeof H.then=="function"&&H.then(M,Z)}catch(Q){Z(Q)}finally{U!==null&&te.types!==null&&(U.types=te.types),A.T=U}},Le.unstable_useCacheRefresh=function(){return A.H.useCacheRefresh()},Le.use=function(D){return A.H.use(D)},Le.useActionState=function(D,U,te){return A.H.useActionState(D,U,te)},Le.useCallback=function(D,U){return A.H.useCallback(D,U)},Le.useContext=function(D){return A.H.useContext(D)},Le.useDebugValue=function(){},Le.useDeferredValue=function(D,U){return A.H.useDeferredValue(D,U)},Le.useEffect=function(D,U){return A.H.useEffect(D,U)},Le.useEffectEvent=function(D){return A.H.useEffectEvent(D)},Le.useId=function(){return A.H.useId()},Le.useImperativeHandle=function(D,U,te){return A.H.useImperativeHandle(D,U,te)},Le.useInsertionEffect=function(D,U){return A.H.useInsertionEffect(D,U)},Le.useLayoutEffect=function(D,U){return A.H.useLayoutEffect(D,U)},Le.useMemo=function(D,U){return A.H.useMemo(D,U)},Le.useOptimistic=function(D,U){return A.H.useOptimistic(D,U)},Le.useReducer=function(D,U,te){return A.H.useReducer(D,U,te)},Le.useRef=function(D){return A.H.useRef(D)},Le.useState=function(D){return A.H.useState(D)},Le.useSyncExternalStore=function(D,U,te){return A.H.useSyncExternalStore(D,U,te)},Le.useTransition=function(){return A.H.useTransition()},Le.version="19.2.6",Le}var uR;function id(){return uR||(uR=1,Fx.exports=Iz()),Fx.exports}var R=id();const Ga=Np(R),hj=Az({__proto__:null,default:Ga},[R]);var Hx={exports:{}},Xc={},Ux={exports:{}},Vx={};/**
18
+ * @license React
19
+ * scheduler.production.js
20
+ *
21
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */var dR;function Oz(){return dR||(dR=1,(function(e){function t($,V){var G=$.length;$.push(V);e:for(;0<G;){var Z=G-1>>>1,J=$[Z];if(0<r(J,V))$[Z]=V,$[G]=J,G=Z;else break e}}function n($){return $.length===0?null:$[0]}function s($){if($.length===0)return null;var V=$[0],G=$.pop();if(G!==V){$[0]=G;e:for(var Z=0,J=$.length,D=J>>>1;Z<D;){var U=2*(Z+1)-1,te=$[U],H=U+1,W=$[H];if(0>r(te,G))H<J&&0>r(W,te)?($[Z]=W,$[H]=G,Z=H):($[Z]=te,$[U]=G,Z=U);else if(H<J&&0>r(W,G))$[Z]=W,$[H]=G,Z=H;else break e}}return V}function r($,V){var G=$.sortIndex-V.sortIndex;return G!==0?G:$.id-V.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var c=Date,u=c.now();e.unstable_now=function(){return c.now()-u}}var f=[],h=[],p=1,g=null,x=3,v=!1,b=!1,w=!1,S=!1,N=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;function _($){for(var V=n(h);V!==null;){if(V.callback===null)s(h);else if(V.startTime<=$)s(h),V.sortIndex=V.expirationTime,t(f,V);else break;V=n(h)}}function E($){if(w=!1,_($),!b)if(n(f)!==null)b=!0,M||(M=!0,B());else{var V=n(h);V!==null&&Y(E,V.startTime-$)}}var M=!1,A=-1,O=5,L=-1;function P(){return S?!0:!(e.unstable_now()-L<O)}function I(){if(S=!1,M){var $=e.unstable_now();L=$;var V=!0;try{e:{b=!1,w&&(w=!1,C(A),A=-1),v=!0;var G=x;try{t:{for(_($),g=n(f);g!==null&&!(g.expirationTime>$&&P());){var Z=g.callback;if(typeof Z=="function"){g.callback=null,x=g.priorityLevel;var J=Z(g.expirationTime<=$);if($=e.unstable_now(),typeof J=="function"){g.callback=J,_($),V=!0;break t}g===n(f)&&s(f),_($)}else s(f);g=n(f)}if(g!==null)V=!0;else{var D=n(h);D!==null&&Y(E,D.startTime-$),V=!1}}break e}finally{g=null,x=G,v=!1}V=void 0}}finally{V?B():M=!1}}}var B;if(typeof k=="function")B=function(){k(I)};else if(typeof MessageChannel<"u"){var F=new MessageChannel,z=F.port2;F.port1.onmessage=I,B=function(){z.postMessage(null)}}else B=function(){N(I,0)};function Y($,V){A=N(function(){$(e.unstable_now())},V)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function($){$.callback=null},e.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):O=0<$?Math.floor(1e3/$):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_next=function($){switch(x){case 1:case 2:case 3:var V=3;break;default:V=x}var G=x;x=V;try{return $()}finally{x=G}},e.unstable_requestPaint=function(){S=!0},e.unstable_runWithPriority=function($,V){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var G=x;x=$;try{return V()}finally{x=G}},e.unstable_scheduleCallback=function($,V,G){var Z=e.unstable_now();switch(typeof G=="object"&&G!==null?(G=G.delay,G=typeof G=="number"&&0<G?Z+G:Z):G=Z,$){case 1:var J=-1;break;case 2:J=250;break;case 5:J=1073741823;break;case 4:J=1e4;break;default:J=5e3}return J=G+J,$={id:p++,callback:V,priorityLevel:$,startTime:G,expirationTime:J,sortIndex:-1},G>Z?($.sortIndex=G,t(h,$),n(f)===null&&$===n(h)&&(w?(C(A),A=-1):w=!0,Y(E,G-Z))):($.sortIndex=J,t(f,$),b||v||(b=!0,M||(M=!0,B()))),$},e.unstable_shouldYield=P,e.unstable_wrapCallback=function($){var V=x;return function(){var G=x;x=V;try{return $.apply(this,arguments)}finally{x=G}}}})(Vx)),Vx}var fR;function Lz(){return fR||(fR=1,Ux.exports=Oz()),Ux.exports}var Gx={exports:{}},cn={};/**
26
+ * @license React
27
+ * react-dom.production.js
28
+ *
29
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
30
+ *
31
+ * This source code is licensed under the MIT license found in the
32
+ * LICENSE file in the root directory of this source tree.
33
+ */var hR;function Pz(){if(hR)return cn;hR=1;var e=id();function t(f){var h="https://react.dev/errors/"+f;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)h+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+f+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var s={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},r=Symbol.for("react.portal");function o(f,h,p){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:r,key:g==null?null:""+g,children:f,containerInfo:h,implementation:p}}var c=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(f,h){if(f==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return cn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,cn.createPortal=function(f,h){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(t(299));return o(f,h,null,p)},cn.flushSync=function(f){var h=c.T,p=s.p;try{if(c.T=null,s.p=2,f)return f()}finally{c.T=h,s.p=p,s.d.f()}},cn.preconnect=function(f,h){typeof f=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,s.d.C(f,h))},cn.prefetchDNS=function(f){typeof f=="string"&&s.d.D(f)},cn.preinit=function(f,h){if(typeof f=="string"&&h&&typeof h.as=="string"){var p=h.as,g=u(p,h.crossOrigin),x=typeof h.integrity=="string"?h.integrity:void 0,v=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;p==="style"?s.d.S(f,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:g,integrity:x,fetchPriority:v}):p==="script"&&s.d.X(f,{crossOrigin:g,integrity:x,fetchPriority:v,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},cn.preinitModule=function(f,h){if(typeof f=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var p=u(h.as,h.crossOrigin);s.d.M(f,{crossOrigin:p,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&s.d.M(f)},cn.preload=function(f,h){if(typeof f=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var p=h.as,g=u(p,h.crossOrigin);s.d.L(f,p,{crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},cn.preloadModule=function(f,h){if(typeof f=="string")if(h){var p=u(h.as,h.crossOrigin);s.d.m(f,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:p,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else s.d.m(f)},cn.requestFormReset=function(f){s.d.r(f)},cn.unstable_batchedUpdates=function(f,h){return f(h)},cn.useFormState=function(f,h,p){return c.H.useFormState(f,h,p)},cn.useFormStatus=function(){return c.H.useHostTransitionStatus()},cn.version="19.2.6",cn}var pR;function X4(){if(pR)return Gx.exports;pR=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Gx.exports=Pz(),Gx.exports}/**
34
+ * @license React
35
+ * react-dom-client.production.js
36
+ *
37
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
38
+ *
39
+ * This source code is licensed under the MIT license found in the
40
+ * LICENSE file in the root directory of this source tree.
41
+ */var mR;function Dz(){if(mR)return Xc;mR=1;var e=Lz(),t=id(),n=X4();function s(i){var l="https://react.dev/errors/"+i;if(1<arguments.length){l+="?args[]="+encodeURIComponent(arguments[1]);for(var d=2;d<arguments.length;d++)l+="&args[]="+encodeURIComponent(arguments[d])}return"Minified React error #"+i+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function o(i){var l=i,d=i;if(i.alternate)for(;l.return;)l=l.return;else{i=l;do l=i,(l.flags&4098)!==0&&(d=l.return),i=l.return;while(i)}return l.tag===3?d:null}function c(i){if(i.tag===13){var l=i.memoizedState;if(l===null&&(i=i.alternate,i!==null&&(l=i.memoizedState)),l!==null)return l.dehydrated}return null}function u(i){if(i.tag===31){var l=i.memoizedState;if(l===null&&(i=i.alternate,i!==null&&(l=i.memoizedState)),l!==null)return l.dehydrated}return null}function f(i){if(o(i)!==i)throw Error(s(188))}function h(i){var l=i.alternate;if(!l){if(l=o(i),l===null)throw Error(s(188));return l!==i?null:i}for(var d=i,m=l;;){var y=d.return;if(y===null)break;var j=y.alternate;if(j===null){if(m=y.return,m!==null){d=m;continue}break}if(y.child===j.child){for(j=y.child;j;){if(j===d)return f(y),i;if(j===m)return f(y),l;j=j.sibling}throw Error(s(188))}if(d.return!==m.return)d=y,m=j;else{for(var T=!1,q=y.child;q;){if(q===d){T=!0,d=y,m=j;break}if(q===m){T=!0,m=y,d=j;break}q=q.sibling}if(!T){for(q=j.child;q;){if(q===d){T=!0,d=j,m=y;break}if(q===m){T=!0,m=j,d=y;break}q=q.sibling}if(!T)throw Error(s(189))}}if(d.alternate!==m)throw Error(s(190))}if(d.tag!==3)throw Error(s(188));return d.stateNode.current===d?i:l}function p(i){var l=i.tag;if(l===5||l===26||l===27||l===6)return i;for(i=i.child;i!==null;){if(l=p(i),l!==null)return l;i=i.sibling}return null}var g=Object.assign,x=Symbol.for("react.element"),v=Symbol.for("react.transitional.element"),b=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),N=Symbol.for("react.profiler"),C=Symbol.for("react.consumer"),k=Symbol.for("react.context"),_=Symbol.for("react.forward_ref"),E=Symbol.for("react.suspense"),M=Symbol.for("react.suspense_list"),A=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),L=Symbol.for("react.activity"),P=Symbol.for("react.memo_cache_sentinel"),I=Symbol.iterator;function B(i){return i===null||typeof i!="object"?null:(i=I&&i[I]||i["@@iterator"],typeof i=="function"?i:null)}var F=Symbol.for("react.client.reference");function z(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===F?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case w:return"Fragment";case N:return"Profiler";case S:return"StrictMode";case E:return"Suspense";case M:return"SuspenseList";case L:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case b:return"Portal";case k:return i.displayName||"Context";case C:return(i._context.displayName||"Context")+".Consumer";case _:var l=i.render;return i=i.displayName,i||(i=l.displayName||l.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case A:return l=i.displayName||null,l!==null?l:z(i.type)||"Memo";case O:l=i._payload,i=i._init;try{return z(i(l))}catch{}}return null}var Y=Array.isArray,$=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G={pending:!1,data:null,method:null,action:null},Z=[],J=-1;function D(i){return{current:i}}function U(i){0>J||(i.current=Z[J],Z[J]=null,J--)}function te(i,l){J++,Z[J]=i.current,i.current=l}var H=D(null),W=D(null),Q=D(null),se=D(null);function re(i,l){switch(te(Q,l),te(W,i),te(H,null),l.nodeType){case 9:case 11:i=(i=l.documentElement)&&(i=i.namespaceURI)?Ek(i):0;break;default:if(i=l.tagName,l=l.namespaceURI)l=Ek(l),i=Ak(l,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}U(H),te(H,i)}function ce(){U(H),U(W),U(Q)}function me(i){i.memoizedState!==null&&te(se,i);var l=H.current,d=Ak(l,i.type);l!==d&&(te(W,i),te(H,d))}function ge(i){W.current===i&&(U(H),U(W)),se.current===i&&(U(se),Gc._currentValue=G)}var ye,xe;function Se(i){if(ye===void 0)try{throw Error()}catch(d){var l=d.stack.trim().match(/\n( *(at )?)/);ye=l&&l[1]||"",xe=-1<d.stack.indexOf(`
42
+ at`)?" (<anonymous>)":-1<d.stack.indexOf("@")?"@unknown:0:0":""}return`
43
+ `+ye+i+xe}var je=!1;function Oe(i,l){if(!i||je)return"";je=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var m={DetermineComponentFrameRoot:function(){try{if(l){var fe=function(){throw Error()};if(Object.defineProperty(fe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(fe,[])}catch(le){var oe=le}Reflect.construct(i,[],fe)}else{try{fe.call()}catch(le){oe=le}i.call(fe.prototype)}}else{try{throw Error()}catch(le){oe=le}(fe=i())&&typeof fe.catch=="function"&&fe.catch(function(){})}}catch(le){if(le&&oe&&typeof le.stack=="string")return[le.stack,oe.stack]}return[null,null]}};m.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var y=Object.getOwnPropertyDescriptor(m.DetermineComponentFrameRoot,"name");y&&y.configurable&&Object.defineProperty(m.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var j=m.DetermineComponentFrameRoot(),T=j[0],q=j[1];if(T&&q){var X=T.split(`
44
+ `),ae=q.split(`
45
+ `);for(y=m=0;m<X.length&&!X[m].includes("DetermineComponentFrameRoot");)m++;for(;y<ae.length&&!ae[y].includes("DetermineComponentFrameRoot");)y++;if(m===X.length||y===ae.length)for(m=X.length-1,y=ae.length-1;1<=m&&0<=y&&X[m]!==ae[y];)y--;for(;1<=m&&0<=y;m--,y--)if(X[m]!==ae[y]){if(m!==1||y!==1)do if(m--,y--,0>y||X[m]!==ae[y]){var ue=`
46
+ `+X[m].replace(" at new "," at ");return i.displayName&&ue.includes("<anonymous>")&&(ue=ue.replace("<anonymous>",i.displayName)),ue}while(1<=m&&0<=y);break}}}finally{je=!1,Error.prepareStackTrace=d}return(d=i?i.displayName||i.name:"")?Se(d):""}function Ee(i,l){switch(i.tag){case 26:case 27:case 5:return Se(i.type);case 16:return Se("Lazy");case 13:return i.child!==l&&l!==null?Se("Suspense Fallback"):Se("Suspense");case 19:return Se("SuspenseList");case 0:case 15:return Oe(i.type,!1);case 11:return Oe(i.type.render,!1);case 1:return Oe(i.type,!0);case 31:return Se("Activity");default:return""}}function mt(i){try{var l="",d=null;do l+=Ee(i,d),d=i,i=i.return;while(i);return l}catch(m){return`
47
+ Error generating stack: `+m.message+`
48
+ `+m.stack}}var yt=Object.prototype.hasOwnProperty,Tt=e.unstable_scheduleCallback,rn=e.unstable_cancelCallback,Ht=e.unstable_shouldYield,bt=e.unstable_requestPaint,gt=e.unstable_now,Fe=e.unstable_getCurrentPriorityLevel,ht=e.unstable_ImmediatePriority,Ut=e.unstable_UserBlockingPriority,an=e.unstable_NormalPriority,po=e.unstable_LowPriority,tr=e.unstable_IdlePriority,nc=e.log,mo=e.unstable_setDisableYieldValue,on=null,Ct=null;function Ls(i){if(typeof nc=="function"&&mo(i),Ct&&typeof Ct.setStrictMode=="function")try{Ct.setStrictMode(on,i)}catch{}}var yn=Math.clz32?Math.clz32:Rm,Cm=Math.log,km=Math.LN2;function Rm(i){return i>>>=0,i===0?32:31-(Cm(i)/km|0)|0}var go=256,xo=262144,vo=4194304;function nr(i){var l=i&42;if(l!==0)return l;switch(i&-i){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return i&261888;case 262144:case 524288:case 1048576:case 2097152:return i&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function yo(i,l,d){var m=i.pendingLanes;if(m===0)return 0;var y=0,j=i.suspendedLanes,T=i.pingedLanes;i=i.warmLanes;var q=m&134217727;return q!==0?(m=q&~j,m!==0?y=nr(m):(T&=q,T!==0?y=nr(T):d||(d=q&~i,d!==0&&(y=nr(d))))):(q=m&~j,q!==0?y=nr(q):T!==0?y=nr(T):d||(d=m&~i,d!==0&&(y=nr(d)))),y===0?0:l!==0&&l!==y&&(l&j)===0&&(j=y&-y,d=l&-l,j>=d||j===32&&(d&4194048)!==0)?l:y}function Ji(i,l){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&l)===0}function Em(i,l){switch(i){case 1:case 2:case 4:case 8:case 64:return l+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function jd(){var i=vo;return vo<<=1,(vo&62914560)===0&&(vo=4194304),i}function sc(i){for(var l=[],d=0;31>d;d++)l.push(i);return l}function ea(i,l){i.pendingLanes|=l,l!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function Am(i,l,d,m,y,j){var T=i.pendingLanes;i.pendingLanes=d,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=d,i.entangledLanes&=d,i.errorRecoveryDisabledLanes&=d,i.shellSuspendCounter=0;var q=i.entanglements,X=i.expirationTimes,ae=i.hiddenUpdates;for(d=T&~d;0<d;){var ue=31-yn(d),fe=1<<ue;q[ue]=0,X[ue]=-1;var oe=ae[ue];if(oe!==null)for(ae[ue]=null,ue=0;ue<oe.length;ue++){var le=oe[ue];le!==null&&(le.lane&=-536870913)}d&=~fe}m!==0&&Nd(i,m,0),j!==0&&y===0&&i.tag!==0&&(i.suspendedLanes|=j&~(T&~l))}function Nd(i,l,d){i.pendingLanes|=l,i.suspendedLanes&=~l;var m=31-yn(l);i.entangledLanes|=l,i.entanglements[m]=i.entanglements[m]|1073741824|d&261930}function _d(i,l){var d=i.entangledLanes|=l;for(i=i.entanglements;d;){var m=31-yn(d),y=1<<m;y&l|i[m]&l&&(i[m]|=l),d&=~y}}function Cd(i,l){var d=l&-l;return d=(d&42)!==0?1:rc(d),(d&(i.suspendedLanes|l))!==0?0:d}function rc(i){switch(i){case 2:i=1;break;case 8:i=4;break;case 32:i=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:i=128;break;case 268435456:i=134217728;break;default:i=0}return i}function ic(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function kd(){var i=V.p;return i!==0?i:(i=window.event,i===void 0?32:Jk(i.type))}function Rd(i,l){var d=V.p;try{return V.p=i,l()}finally{V.p=d}}var Ps=Math.random().toString(36).slice(2),Vt="__reactFiber$"+Ps,ln="__reactProps$"+Ps,sr="__reactContainer$"+Ps,bo="__reactEvents$"+Ps,Ed="__reactListeners$"+Ps,Tm="__reactHandles$"+Ps,Ad="__reactResources$"+Ps,ta="__reactMarker$"+Ps;function ac(i){delete i[Vt],delete i[ln],delete i[bo],delete i[Ed],delete i[Tm]}function Hr(i){var l=i[Vt];if(l)return l;for(var d=i.parentNode;d;){if(l=d[sr]||d[Vt]){if(d=l.alternate,l.child!==null||d!==null&&d.child!==null)for(i=Dk(i);i!==null;){if(d=i[Vt])return d;i=Dk(i)}return l}i=d,d=i.parentNode}return null}function Ur(i){if(i=i[Vt]||i[sr]){var l=i.tag;if(l===5||l===6||l===13||l===31||l===26||l===27||l===3)return i}return null}function Vr(i){var l=i.tag;if(l===5||l===26||l===27||l===6)return i.stateNode;throw Error(s(33))}function Gr(i){var l=i[Ad];return l||(l=i[Ad]={hoistableStyles:new Map,hoistableScripts:new Map}),l}function Lt(i){i[ta]=!0}var Td=new Set,Md={};function rr(i,l){Kr(i,l),Kr(i+"Capture",l)}function Kr(i,l){for(Md[i]=l,i=0;i<l.length;i++)Td.add(l[i])}var Mm=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),oc={},Id={};function Im(i){return yt.call(Id,i)?!0:yt.call(oc,i)?!1:Mm.test(i)?Id[i]=!0:(oc[i]=!0,!1)}function wo(i,l,d){if(Im(l))if(d===null)i.removeAttribute(l);else{switch(typeof d){case"undefined":case"function":case"symbol":i.removeAttribute(l);return;case"boolean":var m=l.toLowerCase().slice(0,5);if(m!=="data-"&&m!=="aria-"){i.removeAttribute(l);return}}i.setAttribute(l,""+d)}}function So(i,l,d){if(d===null)i.removeAttribute(l);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(l);return}i.setAttribute(l,""+d)}}function gs(i,l,d,m){if(m===null)i.removeAttribute(d);else{switch(typeof m){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(d);return}i.setAttributeNS(l,d,""+m)}}function kn(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function Od(i){var l=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function Om(i,l,d){var m=Object.getOwnPropertyDescriptor(i.constructor.prototype,l);if(!i.hasOwnProperty(l)&&typeof m<"u"&&typeof m.get=="function"&&typeof m.set=="function"){var y=m.get,j=m.set;return Object.defineProperty(i,l,{configurable:!0,get:function(){return y.call(this)},set:function(T){d=""+T,j.call(this,T)}}),Object.defineProperty(i,l,{enumerable:m.enumerable}),{getValue:function(){return d},setValue:function(T){d=""+T},stopTracking:function(){i._valueTracker=null,delete i[l]}}}}function Yr(i){if(!i._valueTracker){var l=Od(i)?"checked":"value";i._valueTracker=Om(i,l,""+i[l])}}function Ld(i){if(!i)return!1;var l=i._valueTracker;if(!l)return!0;var d=l.getValue(),m="";return i&&(m=Od(i)?i.checked?"true":"false":i.value),i=m,i!==d?(l.setValue(i),!0):!1}function na(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}var Lm=/[\n"\\]/g;function Rn(i){return i.replace(Lm,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function sa(i,l,d,m,y,j,T,q){i.name="",T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"?i.type=T:i.removeAttribute("type"),l!=null?T==="number"?(l===0&&i.value===""||i.value!=l)&&(i.value=""+kn(l)):i.value!==""+kn(l)&&(i.value=""+kn(l)):T!=="submit"&&T!=="reset"||i.removeAttribute("value"),l!=null?lc(i,T,kn(l)):d!=null?lc(i,T,kn(d)):m!=null&&i.removeAttribute("value"),y==null&&j!=null&&(i.defaultChecked=!!j),y!=null&&(i.checked=y&&typeof y!="function"&&typeof y!="symbol"),q!=null&&typeof q!="function"&&typeof q!="symbol"&&typeof q!="boolean"?i.name=""+kn(q):i.removeAttribute("name")}function Pd(i,l,d,m,y,j,T,q){if(j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"&&(i.type=j),l!=null||d!=null){if(!(j!=="submit"&&j!=="reset"||l!=null)){Yr(i);return}d=d!=null?""+kn(d):"",l=l!=null?""+kn(l):d,q||l===i.value||(i.value=l),i.defaultValue=l}m=m??y,m=typeof m!="function"&&typeof m!="symbol"&&!!m,i.checked=q?i.checked:!!m,i.defaultChecked=!!m,T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"&&(i.name=T),Yr(i)}function lc(i,l,d){l==="number"&&na(i.ownerDocument)===i||i.defaultValue===""+d||(i.defaultValue=""+d)}function ir(i,l,d,m){if(i=i.options,l){l={};for(var y=0;y<d.length;y++)l["$"+d[y]]=!0;for(d=0;d<i.length;d++)y=l.hasOwnProperty("$"+i[d].value),i[d].selected!==y&&(i[d].selected=y),y&&m&&(i[d].defaultSelected=!0)}else{for(d=""+kn(d),l=null,y=0;y<i.length;y++){if(i[y].value===d){i[y].selected=!0,m&&(i[y].defaultSelected=!0);return}l!==null||i[y].disabled||(l=i[y])}l!==null&&(l.selected=!0)}}function N_(i,l,d){if(l!=null&&(l=""+kn(l),l!==i.value&&(i.value=l),d==null)){i.defaultValue!==l&&(i.defaultValue=l);return}i.defaultValue=d!=null?""+kn(d):""}function __(i,l,d,m){if(l==null){if(m!=null){if(d!=null)throw Error(s(92));if(Y(m)){if(1<m.length)throw Error(s(93));m=m[0]}d=m}d==null&&(d=""),l=d}d=kn(l),i.defaultValue=d,m=i.textContent,m===d&&m!==""&&m!==null&&(i.value=m),Yr(i)}function jo(i,l){if(l){var d=i.firstChild;if(d&&d===i.lastChild&&d.nodeType===3){d.nodeValue=l;return}}i.textContent=l}var j6=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function C_(i,l,d){var m=l.indexOf("--")===0;d==null||typeof d=="boolean"||d===""?m?i.setProperty(l,""):l==="float"?i.cssFloat="":i[l]="":m?i.setProperty(l,d):typeof d!="number"||d===0||j6.has(l)?l==="float"?i.cssFloat=d:i[l]=(""+d).trim():i[l]=d+"px"}function k_(i,l,d){if(l!=null&&typeof l!="object")throw Error(s(62));if(i=i.style,d!=null){for(var m in d)!d.hasOwnProperty(m)||l!=null&&l.hasOwnProperty(m)||(m.indexOf("--")===0?i.setProperty(m,""):m==="float"?i.cssFloat="":i[m]="");for(var y in l)m=l[y],l.hasOwnProperty(y)&&d[y]!==m&&C_(i,y,m)}else for(var j in l)l.hasOwnProperty(j)&&C_(i,j,l[j])}function Pm(i){if(i.indexOf("-")===-1)return!1;switch(i){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var N6=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),_6=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Dd(i){return _6.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function ar(){}var Dm=null;function qm(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var No=null,_o=null;function R_(i){var l=Ur(i);if(l&&(i=l.stateNode)){var d=i[ln]||null;e:switch(i=l.stateNode,l.type){case"input":if(sa(i,d.value,d.defaultValue,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name),l=d.name,d.type==="radio"&&l!=null){for(d=i;d.parentNode;)d=d.parentNode;for(d=d.querySelectorAll('input[name="'+Rn(""+l)+'"][type="radio"]'),l=0;l<d.length;l++){var m=d[l];if(m!==i&&m.form===i.form){var y=m[ln]||null;if(!y)throw Error(s(90));sa(m,y.value,y.defaultValue,y.defaultValue,y.checked,y.defaultChecked,y.type,y.name)}}for(l=0;l<d.length;l++)m=d[l],m.form===i.form&&Ld(m)}break e;case"textarea":N_(i,d.value,d.defaultValue);break e;case"select":l=d.value,l!=null&&ir(i,!!d.multiple,l,!1)}}}var $m=!1;function E_(i,l,d){if($m)return i(l,d);$m=!0;try{var m=i(l);return m}finally{if($m=!1,(No!==null||_o!==null)&&(_f(),No&&(l=No,i=_o,_o=No=null,R_(l),i)))for(l=0;l<i.length;l++)R_(i[l])}}function cc(i,l){var d=i.stateNode;if(d===null)return null;var m=d[ln]||null;if(m===null)return null;d=m[l];e:switch(l){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(m=!m.disabled)||(i=i.type,m=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!m;break e;default:i=!1}if(i)return null;if(d&&typeof d!="function")throw Error(s(231,l,typeof d));return d}var or=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),zm=!1;if(or)try{var uc={};Object.defineProperty(uc,"passive",{get:function(){zm=!0}}),window.addEventListener("test",uc,uc),window.removeEventListener("test",uc,uc)}catch{zm=!1}var Wr=null,Bm=null,qd=null;function A_(){if(qd)return qd;var i,l=Bm,d=l.length,m,y="value"in Wr?Wr.value:Wr.textContent,j=y.length;for(i=0;i<d&&l[i]===y[i];i++);var T=d-i;for(m=1;m<=T&&l[d-m]===y[j-m];m++);return qd=y.slice(i,1<m?1-m:void 0)}function $d(i){var l=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&l===13&&(i=13)):i=l,i===10&&(i=13),32<=i||i===13?i:0}function zd(){return!0}function T_(){return!1}function En(i){function l(d,m,y,j,T){this._reactName=d,this._targetInst=y,this.type=m,this.nativeEvent=j,this.target=T,this.currentTarget=null;for(var q in i)i.hasOwnProperty(q)&&(d=i[q],this[q]=d?d(j):j[q]);return this.isDefaultPrevented=(j.defaultPrevented!=null?j.defaultPrevented:j.returnValue===!1)?zd:T_,this.isPropagationStopped=T_,this}return g(l.prototype,{preventDefault:function(){this.defaultPrevented=!0;var d=this.nativeEvent;d&&(d.preventDefault?d.preventDefault():typeof d.returnValue!="unknown"&&(d.returnValue=!1),this.isDefaultPrevented=zd)},stopPropagation:function(){var d=this.nativeEvent;d&&(d.stopPropagation?d.stopPropagation():typeof d.cancelBubble!="unknown"&&(d.cancelBubble=!0),this.isPropagationStopped=zd)},persist:function(){},isPersistent:zd}),l}var ra={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Bd=En(ra),dc=g({},ra,{view:0,detail:0}),C6=En(dc),Fm,Hm,fc,Fd=g({},dc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Vm,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==fc&&(fc&&i.type==="mousemove"?(Fm=i.screenX-fc.screenX,Hm=i.screenY-fc.screenY):Hm=Fm=0,fc=i),Fm)},movementY:function(i){return"movementY"in i?i.movementY:Hm}}),M_=En(Fd),k6=g({},Fd,{dataTransfer:0}),R6=En(k6),E6=g({},dc,{relatedTarget:0}),Um=En(E6),A6=g({},ra,{animationName:0,elapsedTime:0,pseudoElement:0}),T6=En(A6),M6=g({},ra,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),I6=En(M6),O6=g({},ra,{data:0}),I_=En(O6),L6={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},P6={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},D6={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function q6(i){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(i):(i=D6[i])?!!l[i]:!1}function Vm(){return q6}var $6=g({},dc,{key:function(i){if(i.key){var l=L6[i.key]||i.key;if(l!=="Unidentified")return l}return i.type==="keypress"?(i=$d(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?P6[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Vm,charCode:function(i){return i.type==="keypress"?$d(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?$d(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),z6=En($6),B6=g({},Fd,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),O_=En(B6),F6=g({},dc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Vm}),H6=En(F6),U6=g({},ra,{propertyName:0,elapsedTime:0,pseudoElement:0}),V6=En(U6),G6=g({},Fd,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),K6=En(G6),Y6=g({},ra,{newState:0,oldState:0}),W6=En(Y6),Q6=[9,13,27,32],Gm=or&&"CompositionEvent"in window,hc=null;or&&"documentMode"in document&&(hc=document.documentMode);var X6=or&&"TextEvent"in window&&!hc,L_=or&&(!Gm||hc&&8<hc&&11>=hc),P_=" ",D_=!1;function q_(i,l){switch(i){case"keyup":return Q6.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function $_(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var Co=!1;function Z6(i,l){switch(i){case"compositionend":return $_(l);case"keypress":return l.which!==32?null:(D_=!0,P_);case"textInput":return i=l.data,i===P_&&D_?null:i;default:return null}}function J6(i,l){if(Co)return i==="compositionend"||!Gm&&q_(i,l)?(i=A_(),qd=Bm=Wr=null,Co=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1<l.char.length)return l.char;if(l.which)return String.fromCharCode(l.which)}return null;case"compositionend":return L_&&l.locale!=="ko"?null:l.data;default:return null}}var e8={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function z_(i){var l=i&&i.nodeName&&i.nodeName.toLowerCase();return l==="input"?!!e8[i.type]:l==="textarea"}function B_(i,l,d,m){No?_o?_o.push(m):_o=[m]:No=m,l=Mf(l,"onChange"),0<l.length&&(d=new Bd("onChange","change",null,d,m),i.push({event:d,listeners:l}))}var pc=null,mc=null;function t8(i){jk(i,0)}function Hd(i){var l=Vr(i);if(Ld(l))return i}function F_(i,l){if(i==="change")return l}var H_=!1;if(or){var Km;if(or){var Ym="oninput"in document;if(!Ym){var U_=document.createElement("div");U_.setAttribute("oninput","return;"),Ym=typeof U_.oninput=="function"}Km=Ym}else Km=!1;H_=Km&&(!document.documentMode||9<document.documentMode)}function V_(){pc&&(pc.detachEvent("onpropertychange",G_),mc=pc=null)}function G_(i){if(i.propertyName==="value"&&Hd(mc)){var l=[];B_(l,mc,i,qm(i)),E_(t8,l)}}function n8(i,l,d){i==="focusin"?(V_(),pc=l,mc=d,pc.attachEvent("onpropertychange",G_)):i==="focusout"&&V_()}function s8(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return Hd(mc)}function r8(i,l){if(i==="click")return Hd(l)}function i8(i,l){if(i==="input"||i==="change")return Hd(l)}function a8(i,l){return i===l&&(i!==0||1/i===1/l)||i!==i&&l!==l}var Hn=typeof Object.is=="function"?Object.is:a8;function gc(i,l){if(Hn(i,l))return!0;if(typeof i!="object"||i===null||typeof l!="object"||l===null)return!1;var d=Object.keys(i),m=Object.keys(l);if(d.length!==m.length)return!1;for(m=0;m<d.length;m++){var y=d[m];if(!yt.call(l,y)||!Hn(i[y],l[y]))return!1}return!0}function K_(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function Y_(i,l){var d=K_(i);i=0;for(var m;d;){if(d.nodeType===3){if(m=i+d.textContent.length,i<=l&&m>=l)return{node:d,offset:l-i};i=m}e:{for(;d;){if(d.nextSibling){d=d.nextSibling;break e}d=d.parentNode}d=void 0}d=K_(d)}}function W_(i,l){return i&&l?i===l?!0:i&&i.nodeType===3?!1:l&&l.nodeType===3?W_(i,l.parentNode):"contains"in i?i.contains(l):i.compareDocumentPosition?!!(i.compareDocumentPosition(l)&16):!1:!1}function Q_(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var l=na(i.document);l instanceof i.HTMLIFrameElement;){try{var d=typeof l.contentWindow.location.href=="string"}catch{d=!1}if(d)i=l.contentWindow;else break;l=na(i.document)}return l}function Wm(i){var l=i&&i.nodeName&&i.nodeName.toLowerCase();return l&&(l==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||l==="textarea"||i.contentEditable==="true")}var o8=or&&"documentMode"in document&&11>=document.documentMode,ko=null,Qm=null,xc=null,Xm=!1;function X_(i,l,d){var m=d.window===d?d.document:d.nodeType===9?d:d.ownerDocument;Xm||ko==null||ko!==na(m)||(m=ko,"selectionStart"in m&&Wm(m)?m={start:m.selectionStart,end:m.selectionEnd}:(m=(m.ownerDocument&&m.ownerDocument.defaultView||window).getSelection(),m={anchorNode:m.anchorNode,anchorOffset:m.anchorOffset,focusNode:m.focusNode,focusOffset:m.focusOffset}),xc&&gc(xc,m)||(xc=m,m=Mf(Qm,"onSelect"),0<m.length&&(l=new Bd("onSelect","select",null,l,d),i.push({event:l,listeners:m}),l.target=ko)))}function ia(i,l){var d={};return d[i.toLowerCase()]=l.toLowerCase(),d["Webkit"+i]="webkit"+l,d["Moz"+i]="moz"+l,d}var Ro={animationend:ia("Animation","AnimationEnd"),animationiteration:ia("Animation","AnimationIteration"),animationstart:ia("Animation","AnimationStart"),transitionrun:ia("Transition","TransitionRun"),transitionstart:ia("Transition","TransitionStart"),transitioncancel:ia("Transition","TransitionCancel"),transitionend:ia("Transition","TransitionEnd")},Zm={},Z_={};or&&(Z_=document.createElement("div").style,"AnimationEvent"in window||(delete Ro.animationend.animation,delete Ro.animationiteration.animation,delete Ro.animationstart.animation),"TransitionEvent"in window||delete Ro.transitionend.transition);function aa(i){if(Zm[i])return Zm[i];if(!Ro[i])return i;var l=Ro[i],d;for(d in l)if(l.hasOwnProperty(d)&&d in Z_)return Zm[i]=l[d];return i}var J_=aa("animationend"),eC=aa("animationiteration"),tC=aa("animationstart"),l8=aa("transitionrun"),c8=aa("transitionstart"),u8=aa("transitioncancel"),nC=aa("transitionend"),sC=new Map,Jm="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Jm.push("scrollEnd");function xs(i,l){sC.set(i,l),rr(l,[i])}var Ud=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var l=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(l))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},ss=[],Eo=0,eg=0;function Vd(){for(var i=Eo,l=eg=Eo=0;l<i;){var d=ss[l];ss[l++]=null;var m=ss[l];ss[l++]=null;var y=ss[l];ss[l++]=null;var j=ss[l];if(ss[l++]=null,m!==null&&y!==null){var T=m.pending;T===null?y.next=y:(y.next=T.next,T.next=y),m.pending=y}j!==0&&rC(d,y,j)}}function Gd(i,l,d,m){ss[Eo++]=i,ss[Eo++]=l,ss[Eo++]=d,ss[Eo++]=m,eg|=m,i.lanes|=m,i=i.alternate,i!==null&&(i.lanes|=m)}function tg(i,l,d,m){return Gd(i,l,d,m),Kd(i)}function oa(i,l){return Gd(i,null,null,l),Kd(i)}function rC(i,l,d){i.lanes|=d;var m=i.alternate;m!==null&&(m.lanes|=d);for(var y=!1,j=i.return;j!==null;)j.childLanes|=d,m=j.alternate,m!==null&&(m.childLanes|=d),j.tag===22&&(i=j.stateNode,i===null||i._visibility&1||(y=!0)),i=j,j=j.return;return i.tag===3?(j=i.stateNode,y&&l!==null&&(y=31-yn(d),i=j.hiddenUpdates,m=i[y],m===null?i[y]=[l]:m.push(l),l.lane=d|536870912),j):null}function Kd(i){if(50<$c)throw $c=0,ux=null,Error(s(185));for(var l=i.return;l!==null;)i=l,l=i.return;return i.tag===3?i.stateNode:null}var Ao={};function d8(i,l,d,m){this.tag=i,this.key=d,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=l,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=m,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Un(i,l,d,m){return new d8(i,l,d,m)}function ng(i){return i=i.prototype,!(!i||!i.isReactComponent)}function lr(i,l){var d=i.alternate;return d===null?(d=Un(i.tag,l,i.key,i.mode),d.elementType=i.elementType,d.type=i.type,d.stateNode=i.stateNode,d.alternate=i,i.alternate=d):(d.pendingProps=l,d.type=i.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=i.flags&65011712,d.childLanes=i.childLanes,d.lanes=i.lanes,d.child=i.child,d.memoizedProps=i.memoizedProps,d.memoizedState=i.memoizedState,d.updateQueue=i.updateQueue,l=i.dependencies,d.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},d.sibling=i.sibling,d.index=i.index,d.ref=i.ref,d.refCleanup=i.refCleanup,d}function iC(i,l){i.flags&=65011714;var d=i.alternate;return d===null?(i.childLanes=0,i.lanes=l,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=d.childLanes,i.lanes=d.lanes,i.child=d.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=d.memoizedProps,i.memoizedState=d.memoizedState,i.updateQueue=d.updateQueue,i.type=d.type,l=d.dependencies,i.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext}),i}function Yd(i,l,d,m,y,j){var T=0;if(m=i,typeof i=="function")ng(i)&&(T=1);else if(typeof i=="string")T=gz(i,d,H.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case L:return i=Un(31,d,l,y),i.elementType=L,i.lanes=j,i;case w:return la(d.children,y,j,l);case S:T=8,y|=24;break;case N:return i=Un(12,d,l,y|2),i.elementType=N,i.lanes=j,i;case E:return i=Un(13,d,l,y),i.elementType=E,i.lanes=j,i;case M:return i=Un(19,d,l,y),i.elementType=M,i.lanes=j,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case k:T=10;break e;case C:T=9;break e;case _:T=11;break e;case A:T=14;break e;case O:T=16,m=null;break e}T=29,d=Error(s(130,i===null?"null":typeof i,"")),m=null}return l=Un(T,d,l,y),l.elementType=i,l.type=m,l.lanes=j,l}function la(i,l,d,m){return i=Un(7,i,m,l),i.lanes=d,i}function sg(i,l,d){return i=Un(6,i,null,l),i.lanes=d,i}function aC(i){var l=Un(18,null,null,0);return l.stateNode=i,l}function rg(i,l,d){return l=Un(4,i.children!==null?i.children:[],i.key,l),l.lanes=d,l.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},l}var oC=new WeakMap;function rs(i,l){if(typeof i=="object"&&i!==null){var d=oC.get(i);return d!==void 0?d:(l={value:i,source:l,stack:mt(l)},oC.set(i,l),l)}return{value:i,source:l,stack:mt(l)}}var To=[],Mo=0,Wd=null,vc=0,is=[],as=0,Qr=null,Ds=1,qs="";function cr(i,l){To[Mo++]=vc,To[Mo++]=Wd,Wd=i,vc=l}function lC(i,l,d){is[as++]=Ds,is[as++]=qs,is[as++]=Qr,Qr=i;var m=Ds;i=qs;var y=32-yn(m)-1;m&=~(1<<y),d+=1;var j=32-yn(l)+y;if(30<j){var T=y-y%5;j=(m&(1<<T)-1).toString(32),m>>=T,y-=T,Ds=1<<32-yn(l)+y|d<<y|m,qs=j+i}else Ds=1<<j|d<<y|m,qs=i}function ig(i){i.return!==null&&(cr(i,1),lC(i,1,0))}function ag(i){for(;i===Wd;)Wd=To[--Mo],To[Mo]=null,vc=To[--Mo],To[Mo]=null;for(;i===Qr;)Qr=is[--as],is[as]=null,qs=is[--as],is[as]=null,Ds=is[--as],is[as]=null}function cC(i,l){is[as++]=Ds,is[as++]=qs,is[as++]=Qr,Ds=l.id,qs=l.overflow,Qr=i}var Zt=null,xt=null,We=!1,Xr=null,os=!1,og=Error(s(519));function Zr(i){var l=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw yc(rs(l,i)),og}function uC(i){var l=i.stateNode,d=i.type,m=i.memoizedProps;switch(l[Vt]=i,l[ln]=m,d){case"dialog":Ve("cancel",l),Ve("close",l);break;case"iframe":case"object":case"embed":Ve("load",l);break;case"video":case"audio":for(d=0;d<Bc.length;d++)Ve(Bc[d],l);break;case"source":Ve("error",l);break;case"img":case"image":case"link":Ve("error",l),Ve("load",l);break;case"details":Ve("toggle",l);break;case"input":Ve("invalid",l),Pd(l,m.value,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name,!0);break;case"select":Ve("invalid",l);break;case"textarea":Ve("invalid",l),__(l,m.value,m.defaultValue,m.children)}d=m.children,typeof d!="string"&&typeof d!="number"&&typeof d!="bigint"||l.textContent===""+d||m.suppressHydrationWarning===!0||kk(l.textContent,d)?(m.popover!=null&&(Ve("beforetoggle",l),Ve("toggle",l)),m.onScroll!=null&&Ve("scroll",l),m.onScrollEnd!=null&&Ve("scrollend",l),m.onClick!=null&&(l.onclick=ar),l=!0):l=!1,l||Zr(i,!0)}function dC(i){for(Zt=i.return;Zt;)switch(Zt.tag){case 5:case 31:case 13:os=!1;return;case 27:case 3:os=!0;return;default:Zt=Zt.return}}function Io(i){if(i!==Zt)return!1;if(!We)return dC(i),We=!0,!1;var l=i.tag,d;if((d=l!==3&&l!==27)&&((d=l===5)&&(d=i.type,d=!(d!=="form"&&d!=="button")||_x(i.type,i.memoizedProps)),d=!d),d&&xt&&Zr(i),dC(i),l===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(s(317));xt=Pk(i)}else if(l===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(s(317));xt=Pk(i)}else l===27?(l=xt,fi(i.type)?(i=Ax,Ax=null,xt=i):xt=l):xt=Zt?cs(i.stateNode.nextSibling):null;return!0}function ca(){xt=Zt=null,We=!1}function lg(){var i=Xr;return i!==null&&(In===null?In=i:In.push.apply(In,i),Xr=null),i}function yc(i){Xr===null?Xr=[i]:Xr.push(i)}var cg=D(null),ua=null,ur=null;function Jr(i,l,d){te(cg,l._currentValue),l._currentValue=d}function dr(i){i._currentValue=cg.current,U(cg)}function ug(i,l,d){for(;i!==null;){var m=i.alternate;if((i.childLanes&l)!==l?(i.childLanes|=l,m!==null&&(m.childLanes|=l)):m!==null&&(m.childLanes&l)!==l&&(m.childLanes|=l),i===d)break;i=i.return}}function dg(i,l,d,m){var y=i.child;for(y!==null&&(y.return=i);y!==null;){var j=y.dependencies;if(j!==null){var T=y.child;j=j.firstContext;e:for(;j!==null;){var q=j;j=y;for(var X=0;X<l.length;X++)if(q.context===l[X]){j.lanes|=d,q=j.alternate,q!==null&&(q.lanes|=d),ug(j.return,d,i),m||(T=null);break e}j=q.next}}else if(y.tag===18){if(T=y.return,T===null)throw Error(s(341));T.lanes|=d,j=T.alternate,j!==null&&(j.lanes|=d),ug(T,d,i),T=null}else T=y.child;if(T!==null)T.return=y;else for(T=y;T!==null;){if(T===i){T=null;break}if(y=T.sibling,y!==null){y.return=T.return,T=y;break}T=T.return}y=T}}function Oo(i,l,d,m){i=null;for(var y=l,j=!1;y!==null;){if(!j){if((y.flags&524288)!==0)j=!0;else if((y.flags&262144)!==0)break}if(y.tag===10){var T=y.alternate;if(T===null)throw Error(s(387));if(T=T.memoizedProps,T!==null){var q=y.type;Hn(y.pendingProps.value,T.value)||(i!==null?i.push(q):i=[q])}}else if(y===se.current){if(T=y.alternate,T===null)throw Error(s(387));T.memoizedState.memoizedState!==y.memoizedState.memoizedState&&(i!==null?i.push(Gc):i=[Gc])}y=y.return}i!==null&&dg(l,i,d,m),l.flags|=262144}function Qd(i){for(i=i.firstContext;i!==null;){if(!Hn(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function da(i){ua=i,ur=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function Jt(i){return fC(ua,i)}function Xd(i,l){return ua===null&&da(i),fC(i,l)}function fC(i,l){var d=l._currentValue;if(l={context:l,memoizedValue:d,next:null},ur===null){if(i===null)throw Error(s(308));ur=l,i.dependencies={lanes:0,firstContext:l},i.flags|=524288}else ur=ur.next=l;return d}var f8=typeof AbortController<"u"?AbortController:function(){var i=[],l=this.signal={aborted:!1,addEventListener:function(d,m){i.push(m)}};this.abort=function(){l.aborted=!0,i.forEach(function(d){return d()})}},h8=e.unstable_scheduleCallback,p8=e.unstable_NormalPriority,Pt={$$typeof:k,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function fg(){return{controller:new f8,data:new Map,refCount:0}}function bc(i){i.refCount--,i.refCount===0&&h8(p8,function(){i.controller.abort()})}var wc=null,hg=0,Lo=0,Po=null;function m8(i,l){if(wc===null){var d=wc=[];hg=0,Lo=gx(),Po={status:"pending",value:void 0,then:function(m){d.push(m)}}}return hg++,l.then(hC,hC),l}function hC(){if(--hg===0&&wc!==null){Po!==null&&(Po.status="fulfilled");var i=wc;wc=null,Lo=0,Po=null;for(var l=0;l<i.length;l++)(0,i[l])()}}function g8(i,l){var d=[],m={status:"pending",value:null,reason:null,then:function(y){d.push(y)}};return i.then(function(){m.status="fulfilled",m.value=l;for(var y=0;y<d.length;y++)(0,d[y])(l)},function(y){for(m.status="rejected",m.reason=y,y=0;y<d.length;y++)(0,d[y])(void 0)}),m}var pC=$.S;$.S=function(i,l){X2=gt(),typeof l=="object"&&l!==null&&typeof l.then=="function"&&m8(i,l),pC!==null&&pC(i,l)};var fa=D(null);function pg(){var i=fa.current;return i!==null?i:ft.pooledCache}function Zd(i,l){l===null?te(fa,fa.current):te(fa,l.pool)}function mC(){var i=pg();return i===null?null:{parent:Pt._currentValue,pool:i}}var Do=Error(s(460)),mg=Error(s(474)),Jd=Error(s(542)),ef={then:function(){}};function gC(i){return i=i.status,i==="fulfilled"||i==="rejected"}function xC(i,l,d){switch(d=i[d],d===void 0?i.push(l):d!==l&&(l.then(ar,ar),l=d),l.status){case"fulfilled":return l.value;case"rejected":throw i=l.reason,yC(i),i;default:if(typeof l.status=="string")l.then(ar,ar);else{if(i=ft,i!==null&&100<i.shellSuspendCounter)throw Error(s(482));i=l,i.status="pending",i.then(function(m){if(l.status==="pending"){var y=l;y.status="fulfilled",y.value=m}},function(m){if(l.status==="pending"){var y=l;y.status="rejected",y.reason=m}})}switch(l.status){case"fulfilled":return l.value;case"rejected":throw i=l.reason,yC(i),i}throw pa=l,Do}}function ha(i){try{var l=i._init;return l(i._payload)}catch(d){throw d!==null&&typeof d=="object"&&typeof d.then=="function"?(pa=d,Do):d}}var pa=null;function vC(){if(pa===null)throw Error(s(459));var i=pa;return pa=null,i}function yC(i){if(i===Do||i===Jd)throw Error(s(483))}var qo=null,Sc=0;function tf(i){var l=Sc;return Sc+=1,qo===null&&(qo=[]),xC(qo,i,l)}function jc(i,l){l=l.props.ref,i.ref=l!==void 0?l:null}function nf(i,l){throw l.$$typeof===x?Error(s(525)):(i=Object.prototype.toString.call(l),Error(s(31,i==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":i)))}function bC(i){function l(ne,ee){if(i){var ie=ne.deletions;ie===null?(ne.deletions=[ee],ne.flags|=16):ie.push(ee)}}function d(ne,ee){if(!i)return null;for(;ee!==null;)l(ne,ee),ee=ee.sibling;return null}function m(ne){for(var ee=new Map;ne!==null;)ne.key!==null?ee.set(ne.key,ne):ee.set(ne.index,ne),ne=ne.sibling;return ee}function y(ne,ee){return ne=lr(ne,ee),ne.index=0,ne.sibling=null,ne}function j(ne,ee,ie){return ne.index=ie,i?(ie=ne.alternate,ie!==null?(ie=ie.index,ie<ee?(ne.flags|=67108866,ee):ie):(ne.flags|=67108866,ee)):(ne.flags|=1048576,ee)}function T(ne){return i&&ne.alternate===null&&(ne.flags|=67108866),ne}function q(ne,ee,ie,de){return ee===null||ee.tag!==6?(ee=sg(ie,ne.mode,de),ee.return=ne,ee):(ee=y(ee,ie),ee.return=ne,ee)}function X(ne,ee,ie,de){var Re=ie.type;return Re===w?ue(ne,ee,ie.props.children,de,ie.key):ee!==null&&(ee.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===O&&ha(Re)===ee.type)?(ee=y(ee,ie.props),jc(ee,ie),ee.return=ne,ee):(ee=Yd(ie.type,ie.key,ie.props,null,ne.mode,de),jc(ee,ie),ee.return=ne,ee)}function ae(ne,ee,ie,de){return ee===null||ee.tag!==4||ee.stateNode.containerInfo!==ie.containerInfo||ee.stateNode.implementation!==ie.implementation?(ee=rg(ie,ne.mode,de),ee.return=ne,ee):(ee=y(ee,ie.children||[]),ee.return=ne,ee)}function ue(ne,ee,ie,de,Re){return ee===null||ee.tag!==7?(ee=la(ie,ne.mode,de,Re),ee.return=ne,ee):(ee=y(ee,ie),ee.return=ne,ee)}function fe(ne,ee,ie){if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return ee=sg(""+ee,ne.mode,ie),ee.return=ne,ee;if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case v:return ie=Yd(ee.type,ee.key,ee.props,null,ne.mode,ie),jc(ie,ee),ie.return=ne,ie;case b:return ee=rg(ee,ne.mode,ie),ee.return=ne,ee;case O:return ee=ha(ee),fe(ne,ee,ie)}if(Y(ee)||B(ee))return ee=la(ee,ne.mode,ie,null),ee.return=ne,ee;if(typeof ee.then=="function")return fe(ne,tf(ee),ie);if(ee.$$typeof===k)return fe(ne,Xd(ne,ee),ie);nf(ne,ee)}return null}function oe(ne,ee,ie,de){var Re=ee!==null?ee.key:null;if(typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint")return Re!==null?null:q(ne,ee,""+ie,de);if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case v:return ie.key===Re?X(ne,ee,ie,de):null;case b:return ie.key===Re?ae(ne,ee,ie,de):null;case O:return ie=ha(ie),oe(ne,ee,ie,de)}if(Y(ie)||B(ie))return Re!==null?null:ue(ne,ee,ie,de,null);if(typeof ie.then=="function")return oe(ne,ee,tf(ie),de);if(ie.$$typeof===k)return oe(ne,ee,Xd(ne,ie),de);nf(ne,ie)}return null}function le(ne,ee,ie,de,Re){if(typeof de=="string"&&de!==""||typeof de=="number"||typeof de=="bigint")return ne=ne.get(ie)||null,q(ee,ne,""+de,Re);if(typeof de=="object"&&de!==null){switch(de.$$typeof){case v:return ne=ne.get(de.key===null?ie:de.key)||null,X(ee,ne,de,Re);case b:return ne=ne.get(de.key===null?ie:de.key)||null,ae(ee,ne,de,Re);case O:return de=ha(de),le(ne,ee,ie,de,Re)}if(Y(de)||B(de))return ne=ne.get(ie)||null,ue(ee,ne,de,Re,null);if(typeof de.then=="function")return le(ne,ee,ie,tf(de),Re);if(de.$$typeof===k)return le(ne,ee,ie,Xd(ee,de),Re);nf(ee,de)}return null}function we(ne,ee,ie,de){for(var Re=null,et=null,ke=ee,$e=ee=0,Ke=null;ke!==null&&$e<ie.length;$e++){ke.index>$e?(Ke=ke,ke=null):Ke=ke.sibling;var tt=oe(ne,ke,ie[$e],de);if(tt===null){ke===null&&(ke=Ke);break}i&&ke&&tt.alternate===null&&l(ne,ke),ee=j(tt,ee,$e),et===null?Re=tt:et.sibling=tt,et=tt,ke=Ke}if($e===ie.length)return d(ne,ke),We&&cr(ne,$e),Re;if(ke===null){for(;$e<ie.length;$e++)ke=fe(ne,ie[$e],de),ke!==null&&(ee=j(ke,ee,$e),et===null?Re=ke:et.sibling=ke,et=ke);return We&&cr(ne,$e),Re}for(ke=m(ke);$e<ie.length;$e++)Ke=le(ke,ne,$e,ie[$e],de),Ke!==null&&(i&&Ke.alternate!==null&&ke.delete(Ke.key===null?$e:Ke.key),ee=j(Ke,ee,$e),et===null?Re=Ke:et.sibling=Ke,et=Ke);return i&&ke.forEach(function(xi){return l(ne,xi)}),We&&cr(ne,$e),Re}function Te(ne,ee,ie,de){if(ie==null)throw Error(s(151));for(var Re=null,et=null,ke=ee,$e=ee=0,Ke=null,tt=ie.next();ke!==null&&!tt.done;$e++,tt=ie.next()){ke.index>$e?(Ke=ke,ke=null):Ke=ke.sibling;var xi=oe(ne,ke,tt.value,de);if(xi===null){ke===null&&(ke=Ke);break}i&&ke&&xi.alternate===null&&l(ne,ke),ee=j(xi,ee,$e),et===null?Re=xi:et.sibling=xi,et=xi,ke=Ke}if(tt.done)return d(ne,ke),We&&cr(ne,$e),Re;if(ke===null){for(;!tt.done;$e++,tt=ie.next())tt=fe(ne,tt.value,de),tt!==null&&(ee=j(tt,ee,$e),et===null?Re=tt:et.sibling=tt,et=tt);return We&&cr(ne,$e),Re}for(ke=m(ke);!tt.done;$e++,tt=ie.next())tt=le(ke,ne,$e,tt.value,de),tt!==null&&(i&&tt.alternate!==null&&ke.delete(tt.key===null?$e:tt.key),ee=j(tt,ee,$e),et===null?Re=tt:et.sibling=tt,et=tt);return i&&ke.forEach(function(kz){return l(ne,kz)}),We&&cr(ne,$e),Re}function dt(ne,ee,ie,de){if(typeof ie=="object"&&ie!==null&&ie.type===w&&ie.key===null&&(ie=ie.props.children),typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case v:e:{for(var Re=ie.key;ee!==null;){if(ee.key===Re){if(Re=ie.type,Re===w){if(ee.tag===7){d(ne,ee.sibling),de=y(ee,ie.props.children),de.return=ne,ne=de;break e}}else if(ee.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===O&&ha(Re)===ee.type){d(ne,ee.sibling),de=y(ee,ie.props),jc(de,ie),de.return=ne,ne=de;break e}d(ne,ee);break}else l(ne,ee);ee=ee.sibling}ie.type===w?(de=la(ie.props.children,ne.mode,de,ie.key),de.return=ne,ne=de):(de=Yd(ie.type,ie.key,ie.props,null,ne.mode,de),jc(de,ie),de.return=ne,ne=de)}return T(ne);case b:e:{for(Re=ie.key;ee!==null;){if(ee.key===Re)if(ee.tag===4&&ee.stateNode.containerInfo===ie.containerInfo&&ee.stateNode.implementation===ie.implementation){d(ne,ee.sibling),de=y(ee,ie.children||[]),de.return=ne,ne=de;break e}else{d(ne,ee);break}else l(ne,ee);ee=ee.sibling}de=rg(ie,ne.mode,de),de.return=ne,ne=de}return T(ne);case O:return ie=ha(ie),dt(ne,ee,ie,de)}if(Y(ie))return we(ne,ee,ie,de);if(B(ie)){if(Re=B(ie),typeof Re!="function")throw Error(s(150));return ie=Re.call(ie),Te(ne,ee,ie,de)}if(typeof ie.then=="function")return dt(ne,ee,tf(ie),de);if(ie.$$typeof===k)return dt(ne,ee,Xd(ne,ie),de);nf(ne,ie)}return typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint"?(ie=""+ie,ee!==null&&ee.tag===6?(d(ne,ee.sibling),de=y(ee,ie),de.return=ne,ne=de):(d(ne,ee),de=sg(ie,ne.mode,de),de.return=ne,ne=de),T(ne)):d(ne,ee)}return function(ne,ee,ie,de){try{Sc=0;var Re=dt(ne,ee,ie,de);return qo=null,Re}catch(ke){if(ke===Do||ke===Jd)throw ke;var et=Un(29,ke,null,ne.mode);return et.lanes=de,et.return=ne,et}finally{}}}var ma=bC(!0),wC=bC(!1),ei=!1;function gg(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function xg(i,l){i=i.updateQueue,l.updateQueue===i&&(l.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function ti(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function ni(i,l,d){var m=i.updateQueue;if(m===null)return null;if(m=m.shared,(st&2)!==0){var y=m.pending;return y===null?l.next=l:(l.next=y.next,y.next=l),m.pending=l,l=Kd(i),rC(i,null,d),l}return Gd(i,m,l,d),Kd(i)}function Nc(i,l,d){if(l=l.updateQueue,l!==null&&(l=l.shared,(d&4194048)!==0)){var m=l.lanes;m&=i.pendingLanes,d|=m,l.lanes=d,_d(i,d)}}function vg(i,l){var d=i.updateQueue,m=i.alternate;if(m!==null&&(m=m.updateQueue,d===m)){var y=null,j=null;if(d=d.firstBaseUpdate,d!==null){do{var T={lane:d.lane,tag:d.tag,payload:d.payload,callback:null,next:null};j===null?y=j=T:j=j.next=T,d=d.next}while(d!==null);j===null?y=j=l:j=j.next=l}else y=j=l;d={baseState:m.baseState,firstBaseUpdate:y,lastBaseUpdate:j,shared:m.shared,callbacks:m.callbacks},i.updateQueue=d;return}i=d.lastBaseUpdate,i===null?d.firstBaseUpdate=l:i.next=l,d.lastBaseUpdate=l}var yg=!1;function _c(){if(yg){var i=Po;if(i!==null)throw i}}function Cc(i,l,d,m){yg=!1;var y=i.updateQueue;ei=!1;var j=y.firstBaseUpdate,T=y.lastBaseUpdate,q=y.shared.pending;if(q!==null){y.shared.pending=null;var X=q,ae=X.next;X.next=null,T===null?j=ae:T.next=ae,T=X;var ue=i.alternate;ue!==null&&(ue=ue.updateQueue,q=ue.lastBaseUpdate,q!==T&&(q===null?ue.firstBaseUpdate=ae:q.next=ae,ue.lastBaseUpdate=X))}if(j!==null){var fe=y.baseState;T=0,ue=ae=X=null,q=j;do{var oe=q.lane&-536870913,le=oe!==q.lane;if(le?(Ge&oe)===oe:(m&oe)===oe){oe!==0&&oe===Lo&&(yg=!0),ue!==null&&(ue=ue.next={lane:0,tag:q.tag,payload:q.payload,callback:null,next:null});e:{var we=i,Te=q;oe=l;var dt=d;switch(Te.tag){case 1:if(we=Te.payload,typeof we=="function"){fe=we.call(dt,fe,oe);break e}fe=we;break e;case 3:we.flags=we.flags&-65537|128;case 0:if(we=Te.payload,oe=typeof we=="function"?we.call(dt,fe,oe):we,oe==null)break e;fe=g({},fe,oe);break e;case 2:ei=!0}}oe=q.callback,oe!==null&&(i.flags|=64,le&&(i.flags|=8192),le=y.callbacks,le===null?y.callbacks=[oe]:le.push(oe))}else le={lane:oe,tag:q.tag,payload:q.payload,callback:q.callback,next:null},ue===null?(ae=ue=le,X=fe):ue=ue.next=le,T|=oe;if(q=q.next,q===null){if(q=y.shared.pending,q===null)break;le=q,q=le.next,le.next=null,y.lastBaseUpdate=le,y.shared.pending=null}}while(!0);ue===null&&(X=fe),y.baseState=X,y.firstBaseUpdate=ae,y.lastBaseUpdate=ue,j===null&&(y.shared.lanes=0),oi|=T,i.lanes=T,i.memoizedState=fe}}function SC(i,l){if(typeof i!="function")throw Error(s(191,i));i.call(l)}function jC(i,l){var d=i.callbacks;if(d!==null)for(i.callbacks=null,i=0;i<d.length;i++)SC(d[i],l)}var $o=D(null),sf=D(0);function NC(i,l){i=br,te(sf,i),te($o,l),br=i|l.baseLanes}function bg(){te(sf,br),te($o,$o.current)}function wg(){br=sf.current,U($o),U(sf)}var Vn=D(null),ls=null;function si(i){var l=i.alternate;te(Mt,Mt.current&1),te(Vn,i),ls===null&&(l===null||$o.current!==null||l.memoizedState!==null)&&(ls=i)}function Sg(i){te(Mt,Mt.current),te(Vn,i),ls===null&&(ls=i)}function _C(i){i.tag===22?(te(Mt,Mt.current),te(Vn,i),ls===null&&(ls=i)):ri()}function ri(){te(Mt,Mt.current),te(Vn,Vn.current)}function Gn(i){U(Vn),ls===i&&(ls=null),U(Mt)}var Mt=D(0);function rf(i){for(var l=i;l!==null;){if(l.tag===13){var d=l.memoizedState;if(d!==null&&(d=d.dehydrated,d===null||Rx(d)||Ex(d)))return l}else if(l.tag===19&&(l.memoizedProps.revealOrder==="forwards"||l.memoizedProps.revealOrder==="backwards"||l.memoizedProps.revealOrder==="unstable_legacy-backwards"||l.memoizedProps.revealOrder==="together")){if((l.flags&128)!==0)return l}else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===i)break;for(;l.sibling===null;){if(l.return===null||l.return===i)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}var fr=0,qe=null,ct=null,Dt=null,af=!1,zo=!1,ga=!1,of=0,kc=0,Bo=null,x8=0;function kt(){throw Error(s(321))}function jg(i,l){if(l===null)return!1;for(var d=0;d<l.length&&d<i.length;d++)if(!Hn(i[d],l[d]))return!1;return!0}function Ng(i,l,d,m,y,j){return fr=j,qe=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,$.H=i===null||i.memoizedState===null?l2:$g,ga=!1,j=d(m,y),ga=!1,zo&&(j=kC(l,d,m,y)),CC(i),j}function CC(i){$.H=Ac;var l=ct!==null&&ct.next!==null;if(fr=0,Dt=ct=qe=null,af=!1,kc=0,Bo=null,l)throw Error(s(300));i===null||qt||(i=i.dependencies,i!==null&&Qd(i)&&(qt=!0))}function kC(i,l,d,m){qe=i;var y=0;do{if(zo&&(Bo=null),kc=0,zo=!1,25<=y)throw Error(s(301));if(y+=1,Dt=ct=null,i.updateQueue!=null){var j=i.updateQueue;j.lastEffect=null,j.events=null,j.stores=null,j.memoCache!=null&&(j.memoCache.index=0)}$.H=c2,j=l(d,m)}while(zo);return j}function v8(){var i=$.H,l=i.useState()[0];return l=typeof l.then=="function"?Rc(l):l,i=i.useState()[0],(ct!==null?ct.memoizedState:null)!==i&&(qe.flags|=1024),l}function _g(){var i=of!==0;return of=0,i}function Cg(i,l,d){l.updateQueue=i.updateQueue,l.flags&=-2053,i.lanes&=~d}function kg(i){if(af){for(i=i.memoizedState;i!==null;){var l=i.queue;l!==null&&(l.pending=null),i=i.next}af=!1}fr=0,Dt=ct=qe=null,zo=!1,kc=of=0,Bo=null}function bn(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Dt===null?qe.memoizedState=Dt=i:Dt=Dt.next=i,Dt}function It(){if(ct===null){var i=qe.alternate;i=i!==null?i.memoizedState:null}else i=ct.next;var l=Dt===null?qe.memoizedState:Dt.next;if(l!==null)Dt=l,ct=i;else{if(i===null)throw qe.alternate===null?Error(s(467)):Error(s(310));ct=i,i={memoizedState:ct.memoizedState,baseState:ct.baseState,baseQueue:ct.baseQueue,queue:ct.queue,next:null},Dt===null?qe.memoizedState=Dt=i:Dt=Dt.next=i}return Dt}function lf(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Rc(i){var l=kc;return kc+=1,Bo===null&&(Bo=[]),i=xC(Bo,i,l),l=qe,(Dt===null?l.memoizedState:Dt.next)===null&&(l=l.alternate,$.H=l===null||l.memoizedState===null?l2:$g),i}function cf(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return Rc(i);if(i.$$typeof===k)return Jt(i)}throw Error(s(438,String(i)))}function Rg(i){var l=null,d=qe.updateQueue;if(d!==null&&(l=d.memoCache),l==null){var m=qe.alternate;m!==null&&(m=m.updateQueue,m!==null&&(m=m.memoCache,m!=null&&(l={data:m.data.map(function(y){return y.slice()}),index:0})))}if(l==null&&(l={data:[],index:0}),d===null&&(d=lf(),qe.updateQueue=d),d.memoCache=l,d=l.data[l.index],d===void 0)for(d=l.data[l.index]=Array(i),m=0;m<i;m++)d[m]=P;return l.index++,d}function hr(i,l){return typeof l=="function"?l(i):l}function uf(i){var l=It();return Eg(l,ct,i)}function Eg(i,l,d){var m=i.queue;if(m===null)throw Error(s(311));m.lastRenderedReducer=d;var y=i.baseQueue,j=m.pending;if(j!==null){if(y!==null){var T=y.next;y.next=j.next,j.next=T}l.baseQueue=y=j,m.pending=null}if(j=i.baseState,y===null)i.memoizedState=j;else{l=y.next;var q=T=null,X=null,ae=l,ue=!1;do{var fe=ae.lane&-536870913;if(fe!==ae.lane?(Ge&fe)===fe:(fr&fe)===fe){var oe=ae.revertLane;if(oe===0)X!==null&&(X=X.next={lane:0,revertLane:0,gesture:null,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null}),fe===Lo&&(ue=!0);else if((fr&oe)===oe){ae=ae.next,oe===Lo&&(ue=!0);continue}else fe={lane:0,revertLane:ae.revertLane,gesture:null,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null},X===null?(q=X=fe,T=j):X=X.next=fe,qe.lanes|=oe,oi|=oe;fe=ae.action,ga&&d(j,fe),j=ae.hasEagerState?ae.eagerState:d(j,fe)}else oe={lane:fe,revertLane:ae.revertLane,gesture:ae.gesture,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null},X===null?(q=X=oe,T=j):X=X.next=oe,qe.lanes|=fe,oi|=fe;ae=ae.next}while(ae!==null&&ae!==l);if(X===null?T=j:X.next=q,!Hn(j,i.memoizedState)&&(qt=!0,ue&&(d=Po,d!==null)))throw d;i.memoizedState=j,i.baseState=T,i.baseQueue=X,m.lastRenderedState=j}return y===null&&(m.lanes=0),[i.memoizedState,m.dispatch]}function Ag(i){var l=It(),d=l.queue;if(d===null)throw Error(s(311));d.lastRenderedReducer=i;var m=d.dispatch,y=d.pending,j=l.memoizedState;if(y!==null){d.pending=null;var T=y=y.next;do j=i(j,T.action),T=T.next;while(T!==y);Hn(j,l.memoizedState)||(qt=!0),l.memoizedState=j,l.baseQueue===null&&(l.baseState=j),d.lastRenderedState=j}return[j,m]}function RC(i,l,d){var m=qe,y=It(),j=We;if(j){if(d===void 0)throw Error(s(407));d=d()}else d=l();var T=!Hn((ct||y).memoizedState,d);if(T&&(y.memoizedState=d,qt=!0),y=y.queue,Ig(TC.bind(null,m,y,i),[i]),y.getSnapshot!==l||T||Dt!==null&&Dt.memoizedState.tag&1){if(m.flags|=2048,Fo(9,{destroy:void 0},AC.bind(null,m,y,d,l),null),ft===null)throw Error(s(349));j||(fr&127)!==0||EC(m,l,d)}return d}function EC(i,l,d){i.flags|=16384,i={getSnapshot:l,value:d},l=qe.updateQueue,l===null?(l=lf(),qe.updateQueue=l,l.stores=[i]):(d=l.stores,d===null?l.stores=[i]:d.push(i))}function AC(i,l,d,m){l.value=d,l.getSnapshot=m,MC(l)&&IC(i)}function TC(i,l,d){return d(function(){MC(l)&&IC(i)})}function MC(i){var l=i.getSnapshot;i=i.value;try{var d=l();return!Hn(i,d)}catch{return!0}}function IC(i){var l=oa(i,2);l!==null&&On(l,i,2)}function Tg(i){var l=bn();if(typeof i=="function"){var d=i;if(i=d(),ga){Ls(!0);try{d()}finally{Ls(!1)}}}return l.memoizedState=l.baseState=i,l.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:hr,lastRenderedState:i},l}function OC(i,l,d,m){return i.baseState=d,Eg(i,ct,typeof m=="function"?m:hr)}function y8(i,l,d,m,y){if(hf(i))throw Error(s(485));if(i=l.action,i!==null){var j={payload:y,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(T){j.listeners.push(T)}};$.T!==null?d(!0):j.isTransition=!1,m(j),d=l.pending,d===null?(j.next=l.pending=j,LC(l,j)):(j.next=d.next,l.pending=d.next=j)}}function LC(i,l){var d=l.action,m=l.payload,y=i.state;if(l.isTransition){var j=$.T,T={};$.T=T;try{var q=d(y,m),X=$.S;X!==null&&X(T,q),PC(i,l,q)}catch(ae){Mg(i,l,ae)}finally{j!==null&&T.types!==null&&(j.types=T.types),$.T=j}}else try{j=d(y,m),PC(i,l,j)}catch(ae){Mg(i,l,ae)}}function PC(i,l,d){d!==null&&typeof d=="object"&&typeof d.then=="function"?d.then(function(m){DC(i,l,m)},function(m){return Mg(i,l,m)}):DC(i,l,d)}function DC(i,l,d){l.status="fulfilled",l.value=d,qC(l),i.state=d,l=i.pending,l!==null&&(d=l.next,d===l?i.pending=null:(d=d.next,l.next=d,LC(i,d)))}function Mg(i,l,d){var m=i.pending;if(i.pending=null,m!==null){m=m.next;do l.status="rejected",l.reason=d,qC(l),l=l.next;while(l!==m)}i.action=null}function qC(i){i=i.listeners;for(var l=0;l<i.length;l++)(0,i[l])()}function $C(i,l){return l}function zC(i,l){if(We){var d=ft.formState;if(d!==null){e:{var m=qe;if(We){if(xt){t:{for(var y=xt,j=os;y.nodeType!==8;){if(!j){y=null;break t}if(y=cs(y.nextSibling),y===null){y=null;break t}}j=y.data,y=j==="F!"||j==="F"?y:null}if(y){xt=cs(y.nextSibling),m=y.data==="F!";break e}}Zr(m)}m=!1}m&&(l=d[0])}}return d=bn(),d.memoizedState=d.baseState=l,m={pending:null,lanes:0,dispatch:null,lastRenderedReducer:$C,lastRenderedState:l},d.queue=m,d=i2.bind(null,qe,m),m.dispatch=d,m=Tg(!1),j=qg.bind(null,qe,!1,m.queue),m=bn(),y={state:l,dispatch:null,action:i,pending:null},m.queue=y,d=y8.bind(null,qe,y,j,d),y.dispatch=d,m.memoizedState=i,[l,d,!1]}function BC(i){var l=It();return FC(l,ct,i)}function FC(i,l,d){if(l=Eg(i,l,$C)[0],i=uf(hr)[0],typeof l=="object"&&l!==null&&typeof l.then=="function")try{var m=Rc(l)}catch(T){throw T===Do?Jd:T}else m=l;l=It();var y=l.queue,j=y.dispatch;return d!==l.memoizedState&&(qe.flags|=2048,Fo(9,{destroy:void 0},b8.bind(null,y,d),null)),[m,j,i]}function b8(i,l){i.action=l}function HC(i){var l=It(),d=ct;if(d!==null)return FC(l,d,i);It(),l=l.memoizedState,d=It();var m=d.queue.dispatch;return d.memoizedState=i,[l,m,!1]}function Fo(i,l,d,m){return i={tag:i,create:d,deps:m,inst:l,next:null},l=qe.updateQueue,l===null&&(l=lf(),qe.updateQueue=l),d=l.lastEffect,d===null?l.lastEffect=i.next=i:(m=d.next,d.next=i,i.next=m,l.lastEffect=i),i}function UC(){return It().memoizedState}function df(i,l,d,m){var y=bn();qe.flags|=i,y.memoizedState=Fo(1|l,{destroy:void 0},d,m===void 0?null:m)}function ff(i,l,d,m){var y=It();m=m===void 0?null:m;var j=y.memoizedState.inst;ct!==null&&m!==null&&jg(m,ct.memoizedState.deps)?y.memoizedState=Fo(l,j,d,m):(qe.flags|=i,y.memoizedState=Fo(1|l,j,d,m))}function VC(i,l){df(8390656,8,i,l)}function Ig(i,l){ff(2048,8,i,l)}function w8(i){qe.flags|=4;var l=qe.updateQueue;if(l===null)l=lf(),qe.updateQueue=l,l.events=[i];else{var d=l.events;d===null?l.events=[i]:d.push(i)}}function GC(i){var l=It().memoizedState;return w8({ref:l,nextImpl:i}),function(){if((st&2)!==0)throw Error(s(440));return l.impl.apply(void 0,arguments)}}function KC(i,l){return ff(4,2,i,l)}function YC(i,l){return ff(4,4,i,l)}function WC(i,l){if(typeof l=="function"){i=i();var d=l(i);return function(){typeof d=="function"?d():l(null)}}if(l!=null)return i=i(),l.current=i,function(){l.current=null}}function QC(i,l,d){d=d!=null?d.concat([i]):null,ff(4,4,WC.bind(null,l,i),d)}function Og(){}function XC(i,l){var d=It();l=l===void 0?null:l;var m=d.memoizedState;return l!==null&&jg(l,m[1])?m[0]:(d.memoizedState=[i,l],i)}function ZC(i,l){var d=It();l=l===void 0?null:l;var m=d.memoizedState;if(l!==null&&jg(l,m[1]))return m[0];if(m=i(),ga){Ls(!0);try{i()}finally{Ls(!1)}}return d.memoizedState=[m,l],m}function Lg(i,l,d){return d===void 0||(fr&1073741824)!==0&&(Ge&261930)===0?i.memoizedState=l:(i.memoizedState=d,i=J2(),qe.lanes|=i,oi|=i,d)}function JC(i,l,d,m){return Hn(d,l)?d:$o.current!==null?(i=Lg(i,d,m),Hn(i,l)||(qt=!0),i):(fr&42)===0||(fr&1073741824)!==0&&(Ge&261930)===0?(qt=!0,i.memoizedState=d):(i=J2(),qe.lanes|=i,oi|=i,l)}function e2(i,l,d,m,y){var j=V.p;V.p=j!==0&&8>j?j:8;var T=$.T,q={};$.T=q,qg(i,!1,l,d);try{var X=y(),ae=$.S;if(ae!==null&&ae(q,X),X!==null&&typeof X=="object"&&typeof X.then=="function"){var ue=g8(X,m);Ec(i,l,ue,Wn(i))}else Ec(i,l,m,Wn(i))}catch(fe){Ec(i,l,{then:function(){},status:"rejected",reason:fe},Wn())}finally{V.p=j,T!==null&&q.types!==null&&(T.types=q.types),$.T=T}}function S8(){}function Pg(i,l,d,m){if(i.tag!==5)throw Error(s(476));var y=t2(i).queue;e2(i,y,l,G,d===null?S8:function(){return n2(i),d(m)})}function t2(i){var l=i.memoizedState;if(l!==null)return l;l={memoizedState:G,baseState:G,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:hr,lastRenderedState:G},next:null};var d={};return l.next={memoizedState:d,baseState:d,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:hr,lastRenderedState:d},next:null},i.memoizedState=l,i=i.alternate,i!==null&&(i.memoizedState=l),l}function n2(i){var l=t2(i);l.next===null&&(l=i.alternate.memoizedState),Ec(i,l.next.queue,{},Wn())}function Dg(){return Jt(Gc)}function s2(){return It().memoizedState}function r2(){return It().memoizedState}function j8(i){for(var l=i.return;l!==null;){switch(l.tag){case 24:case 3:var d=Wn();i=ti(d);var m=ni(l,i,d);m!==null&&(On(m,l,d),Nc(m,l,d)),l={cache:fg()},i.payload=l;return}l=l.return}}function N8(i,l,d){var m=Wn();d={lane:m,revertLane:0,gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},hf(i)?a2(l,d):(d=tg(i,l,d,m),d!==null&&(On(d,i,m),o2(d,l,m)))}function i2(i,l,d){var m=Wn();Ec(i,l,d,m)}function Ec(i,l,d,m){var y={lane:m,revertLane:0,gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null};if(hf(i))a2(l,y);else{var j=i.alternate;if(i.lanes===0&&(j===null||j.lanes===0)&&(j=l.lastRenderedReducer,j!==null))try{var T=l.lastRenderedState,q=j(T,d);if(y.hasEagerState=!0,y.eagerState=q,Hn(q,T))return Gd(i,l,y,0),ft===null&&Vd(),!1}catch{}finally{}if(d=tg(i,l,y,m),d!==null)return On(d,i,m),o2(d,l,m),!0}return!1}function qg(i,l,d,m){if(m={lane:2,revertLane:gx(),gesture:null,action:m,hasEagerState:!1,eagerState:null,next:null},hf(i)){if(l)throw Error(s(479))}else l=tg(i,d,m,2),l!==null&&On(l,i,2)}function hf(i){var l=i.alternate;return i===qe||l!==null&&l===qe}function a2(i,l){zo=af=!0;var d=i.pending;d===null?l.next=l:(l.next=d.next,d.next=l),i.pending=l}function o2(i,l,d){if((d&4194048)!==0){var m=l.lanes;m&=i.pendingLanes,d|=m,l.lanes=d,_d(i,d)}}var Ac={readContext:Jt,use:cf,useCallback:kt,useContext:kt,useEffect:kt,useImperativeHandle:kt,useLayoutEffect:kt,useInsertionEffect:kt,useMemo:kt,useReducer:kt,useRef:kt,useState:kt,useDebugValue:kt,useDeferredValue:kt,useTransition:kt,useSyncExternalStore:kt,useId:kt,useHostTransitionStatus:kt,useFormState:kt,useActionState:kt,useOptimistic:kt,useMemoCache:kt,useCacheRefresh:kt};Ac.useEffectEvent=kt;var l2={readContext:Jt,use:cf,useCallback:function(i,l){return bn().memoizedState=[i,l===void 0?null:l],i},useContext:Jt,useEffect:VC,useImperativeHandle:function(i,l,d){d=d!=null?d.concat([i]):null,df(4194308,4,WC.bind(null,l,i),d)},useLayoutEffect:function(i,l){return df(4194308,4,i,l)},useInsertionEffect:function(i,l){df(4,2,i,l)},useMemo:function(i,l){var d=bn();l=l===void 0?null:l;var m=i();if(ga){Ls(!0);try{i()}finally{Ls(!1)}}return d.memoizedState=[m,l],m},useReducer:function(i,l,d){var m=bn();if(d!==void 0){var y=d(l);if(ga){Ls(!0);try{d(l)}finally{Ls(!1)}}}else y=l;return m.memoizedState=m.baseState=y,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:y},m.queue=i,i=i.dispatch=N8.bind(null,qe,i),[m.memoizedState,i]},useRef:function(i){var l=bn();return i={current:i},l.memoizedState=i},useState:function(i){i=Tg(i);var l=i.queue,d=i2.bind(null,qe,l);return l.dispatch=d,[i.memoizedState,d]},useDebugValue:Og,useDeferredValue:function(i,l){var d=bn();return Lg(d,i,l)},useTransition:function(){var i=Tg(!1);return i=e2.bind(null,qe,i.queue,!0,!1),bn().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,l,d){var m=qe,y=bn();if(We){if(d===void 0)throw Error(s(407));d=d()}else{if(d=l(),ft===null)throw Error(s(349));(Ge&127)!==0||EC(m,l,d)}y.memoizedState=d;var j={value:d,getSnapshot:l};return y.queue=j,VC(TC.bind(null,m,j,i),[i]),m.flags|=2048,Fo(9,{destroy:void 0},AC.bind(null,m,j,d,l),null),d},useId:function(){var i=bn(),l=ft.identifierPrefix;if(We){var d=qs,m=Ds;d=(m&~(1<<32-yn(m)-1)).toString(32)+d,l="_"+l+"R_"+d,d=of++,0<d&&(l+="H"+d.toString(32)),l+="_"}else d=x8++,l="_"+l+"r_"+d.toString(32)+"_";return i.memoizedState=l},useHostTransitionStatus:Dg,useFormState:zC,useActionState:zC,useOptimistic:function(i){var l=bn();l.memoizedState=l.baseState=i;var d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return l.queue=d,l=qg.bind(null,qe,!0,d),d.dispatch=l,[i,l]},useMemoCache:Rg,useCacheRefresh:function(){return bn().memoizedState=j8.bind(null,qe)},useEffectEvent:function(i){var l=bn(),d={impl:i};return l.memoizedState=d,function(){if((st&2)!==0)throw Error(s(440));return d.impl.apply(void 0,arguments)}}},$g={readContext:Jt,use:cf,useCallback:XC,useContext:Jt,useEffect:Ig,useImperativeHandle:QC,useInsertionEffect:KC,useLayoutEffect:YC,useMemo:ZC,useReducer:uf,useRef:UC,useState:function(){return uf(hr)},useDebugValue:Og,useDeferredValue:function(i,l){var d=It();return JC(d,ct.memoizedState,i,l)},useTransition:function(){var i=uf(hr)[0],l=It().memoizedState;return[typeof i=="boolean"?i:Rc(i),l]},useSyncExternalStore:RC,useId:s2,useHostTransitionStatus:Dg,useFormState:BC,useActionState:BC,useOptimistic:function(i,l){var d=It();return OC(d,ct,i,l)},useMemoCache:Rg,useCacheRefresh:r2};$g.useEffectEvent=GC;var c2={readContext:Jt,use:cf,useCallback:XC,useContext:Jt,useEffect:Ig,useImperativeHandle:QC,useInsertionEffect:KC,useLayoutEffect:YC,useMemo:ZC,useReducer:Ag,useRef:UC,useState:function(){return Ag(hr)},useDebugValue:Og,useDeferredValue:function(i,l){var d=It();return ct===null?Lg(d,i,l):JC(d,ct.memoizedState,i,l)},useTransition:function(){var i=Ag(hr)[0],l=It().memoizedState;return[typeof i=="boolean"?i:Rc(i),l]},useSyncExternalStore:RC,useId:s2,useHostTransitionStatus:Dg,useFormState:HC,useActionState:HC,useOptimistic:function(i,l){var d=It();return ct!==null?OC(d,ct,i,l):(d.baseState=i,[i,d.queue.dispatch])},useMemoCache:Rg,useCacheRefresh:r2};c2.useEffectEvent=GC;function zg(i,l,d,m){l=i.memoizedState,d=d(m,l),d=d==null?l:g({},l,d),i.memoizedState=d,i.lanes===0&&(i.updateQueue.baseState=d)}var Bg={enqueueSetState:function(i,l,d){i=i._reactInternals;var m=Wn(),y=ti(m);y.payload=l,d!=null&&(y.callback=d),l=ni(i,y,m),l!==null&&(On(l,i,m),Nc(l,i,m))},enqueueReplaceState:function(i,l,d){i=i._reactInternals;var m=Wn(),y=ti(m);y.tag=1,y.payload=l,d!=null&&(y.callback=d),l=ni(i,y,m),l!==null&&(On(l,i,m),Nc(l,i,m))},enqueueForceUpdate:function(i,l){i=i._reactInternals;var d=Wn(),m=ti(d);m.tag=2,l!=null&&(m.callback=l),l=ni(i,m,d),l!==null&&(On(l,i,d),Nc(l,i,d))}};function u2(i,l,d,m,y,j,T){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(m,j,T):l.prototype&&l.prototype.isPureReactComponent?!gc(d,m)||!gc(y,j):!0}function d2(i,l,d,m){i=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(d,m),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(d,m),l.state!==i&&Bg.enqueueReplaceState(l,l.state,null)}function xa(i,l){var d=l;if("ref"in l){d={};for(var m in l)m!=="ref"&&(d[m]=l[m])}if(i=i.defaultProps){d===l&&(d=g({},d));for(var y in i)d[y]===void 0&&(d[y]=i[y])}return d}function f2(i){Ud(i)}function h2(i){console.error(i)}function p2(i){Ud(i)}function pf(i,l){try{var d=i.onUncaughtError;d(l.value,{componentStack:l.stack})}catch(m){setTimeout(function(){throw m})}}function m2(i,l,d){try{var m=i.onCaughtError;m(d.value,{componentStack:d.stack,errorBoundary:l.tag===1?l.stateNode:null})}catch(y){setTimeout(function(){throw y})}}function Fg(i,l,d){return d=ti(d),d.tag=3,d.payload={element:null},d.callback=function(){pf(i,l)},d}function g2(i){return i=ti(i),i.tag=3,i}function x2(i,l,d,m){var y=d.type.getDerivedStateFromError;if(typeof y=="function"){var j=m.value;i.payload=function(){return y(j)},i.callback=function(){m2(l,d,m)}}var T=d.stateNode;T!==null&&typeof T.componentDidCatch=="function"&&(i.callback=function(){m2(l,d,m),typeof y!="function"&&(li===null?li=new Set([this]):li.add(this));var q=m.stack;this.componentDidCatch(m.value,{componentStack:q!==null?q:""})})}function _8(i,l,d,m,y){if(d.flags|=32768,m!==null&&typeof m=="object"&&typeof m.then=="function"){if(l=d.alternate,l!==null&&Oo(l,d,y,!0),d=Vn.current,d!==null){switch(d.tag){case 31:case 13:return ls===null?Cf():d.alternate===null&&Rt===0&&(Rt=3),d.flags&=-257,d.flags|=65536,d.lanes=y,m===ef?d.flags|=16384:(l=d.updateQueue,l===null?d.updateQueue=new Set([m]):l.add(m),hx(i,m,y)),!1;case 22:return d.flags|=65536,m===ef?d.flags|=16384:(l=d.updateQueue,l===null?(l={transitions:null,markerInstances:null,retryQueue:new Set([m])},d.updateQueue=l):(d=l.retryQueue,d===null?l.retryQueue=new Set([m]):d.add(m)),hx(i,m,y)),!1}throw Error(s(435,d.tag))}return hx(i,m,y),Cf(),!1}if(We)return l=Vn.current,l!==null?((l.flags&65536)===0&&(l.flags|=256),l.flags|=65536,l.lanes=y,m!==og&&(i=Error(s(422),{cause:m}),yc(rs(i,d)))):(m!==og&&(l=Error(s(423),{cause:m}),yc(rs(l,d))),i=i.current.alternate,i.flags|=65536,y&=-y,i.lanes|=y,m=rs(m,d),y=Fg(i.stateNode,m,y),vg(i,y),Rt!==4&&(Rt=2)),!1;var j=Error(s(520),{cause:m});if(j=rs(j,d),qc===null?qc=[j]:qc.push(j),Rt!==4&&(Rt=2),l===null)return!0;m=rs(m,d),d=l;do{switch(d.tag){case 3:return d.flags|=65536,i=y&-y,d.lanes|=i,i=Fg(d.stateNode,m,i),vg(d,i),!1;case 1:if(l=d.type,j=d.stateNode,(d.flags&128)===0&&(typeof l.getDerivedStateFromError=="function"||j!==null&&typeof j.componentDidCatch=="function"&&(li===null||!li.has(j))))return d.flags|=65536,y&=-y,d.lanes|=y,y=g2(y),x2(y,i,d,m),vg(d,y),!1}d=d.return}while(d!==null);return!1}var Hg=Error(s(461)),qt=!1;function en(i,l,d,m){l.child=i===null?wC(l,null,d,m):ma(l,i.child,d,m)}function v2(i,l,d,m,y){d=d.render;var j=l.ref;if("ref"in m){var T={};for(var q in m)q!=="ref"&&(T[q]=m[q])}else T=m;return da(l),m=Ng(i,l,d,T,j,y),q=_g(),i!==null&&!qt?(Cg(i,l,y),pr(i,l,y)):(We&&q&&ig(l),l.flags|=1,en(i,l,m,y),l.child)}function y2(i,l,d,m,y){if(i===null){var j=d.type;return typeof j=="function"&&!ng(j)&&j.defaultProps===void 0&&d.compare===null?(l.tag=15,l.type=j,b2(i,l,j,m,y)):(i=Yd(d.type,null,m,l,l.mode,y),i.ref=l.ref,i.return=l,l.child=i)}if(j=i.child,!Xg(i,y)){var T=j.memoizedProps;if(d=d.compare,d=d!==null?d:gc,d(T,m)&&i.ref===l.ref)return pr(i,l,y)}return l.flags|=1,i=lr(j,m),i.ref=l.ref,i.return=l,l.child=i}function b2(i,l,d,m,y){if(i!==null){var j=i.memoizedProps;if(gc(j,m)&&i.ref===l.ref)if(qt=!1,l.pendingProps=m=j,Xg(i,y))(i.flags&131072)!==0&&(qt=!0);else return l.lanes=i.lanes,pr(i,l,y)}return Ug(i,l,d,m,y)}function w2(i,l,d,m){var y=m.children,j=i!==null?i.memoizedState:null;if(i===null&&l.stateNode===null&&(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),m.mode==="hidden"){if((l.flags&128)!==0){if(j=j!==null?j.baseLanes|d:d,i!==null){for(m=l.child=i.child,y=0;m!==null;)y=y|m.lanes|m.childLanes,m=m.sibling;m=y&~j}else m=0,l.child=null;return S2(i,l,j,d,m)}if((d&536870912)!==0)l.memoizedState={baseLanes:0,cachePool:null},i!==null&&Zd(l,j!==null?j.cachePool:null),j!==null?NC(l,j):bg(),_C(l);else return m=l.lanes=536870912,S2(i,l,j!==null?j.baseLanes|d:d,d,m)}else j!==null?(Zd(l,j.cachePool),NC(l,j),ri(),l.memoizedState=null):(i!==null&&Zd(l,null),bg(),ri());return en(i,l,y,d),l.child}function Tc(i,l){return i!==null&&i.tag===22||l.stateNode!==null||(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.sibling}function S2(i,l,d,m,y){var j=pg();return j=j===null?null:{parent:Pt._currentValue,pool:j},l.memoizedState={baseLanes:d,cachePool:j},i!==null&&Zd(l,null),bg(),_C(l),i!==null&&Oo(i,l,m,!0),l.childLanes=y,null}function mf(i,l){return l=xf({mode:l.mode,children:l.children},i.mode),l.ref=i.ref,i.child=l,l.return=i,l}function j2(i,l,d){return ma(l,i.child,null,d),i=mf(l,l.pendingProps),i.flags|=2,Gn(l),l.memoizedState=null,i}function C8(i,l,d){var m=l.pendingProps,y=(l.flags&128)!==0;if(l.flags&=-129,i===null){if(We){if(m.mode==="hidden")return i=mf(l,m),l.lanes=536870912,Tc(null,i);if(Sg(l),(i=xt)?(i=Lk(i,os),i=i!==null&&i.data==="&"?i:null,i!==null&&(l.memoizedState={dehydrated:i,treeContext:Qr!==null?{id:Ds,overflow:qs}:null,retryLane:536870912,hydrationErrors:null},d=aC(i),d.return=l,l.child=d,Zt=l,xt=null)):i=null,i===null)throw Zr(l);return l.lanes=536870912,null}return mf(l,m)}var j=i.memoizedState;if(j!==null){var T=j.dehydrated;if(Sg(l),y)if(l.flags&256)l.flags&=-257,l=j2(i,l,d);else if(l.memoizedState!==null)l.child=i.child,l.flags|=128,l=null;else throw Error(s(558));else if(qt||Oo(i,l,d,!1),y=(d&i.childLanes)!==0,qt||y){if(m=ft,m!==null&&(T=Cd(m,d),T!==0&&T!==j.retryLane))throw j.retryLane=T,oa(i,T),On(m,i,T),Hg;Cf(),l=j2(i,l,d)}else i=j.treeContext,xt=cs(T.nextSibling),Zt=l,We=!0,Xr=null,os=!1,i!==null&&cC(l,i),l=mf(l,m),l.flags|=4096;return l}return i=lr(i.child,{mode:m.mode,children:m.children}),i.ref=l.ref,l.child=i,i.return=l,i}function gf(i,l){var d=l.ref;if(d===null)i!==null&&i.ref!==null&&(l.flags|=4194816);else{if(typeof d!="function"&&typeof d!="object")throw Error(s(284));(i===null||i.ref!==d)&&(l.flags|=4194816)}}function Ug(i,l,d,m,y){return da(l),d=Ng(i,l,d,m,void 0,y),m=_g(),i!==null&&!qt?(Cg(i,l,y),pr(i,l,y)):(We&&m&&ig(l),l.flags|=1,en(i,l,d,y),l.child)}function N2(i,l,d,m,y,j){return da(l),l.updateQueue=null,d=kC(l,m,d,y),CC(i),m=_g(),i!==null&&!qt?(Cg(i,l,j),pr(i,l,j)):(We&&m&&ig(l),l.flags|=1,en(i,l,d,j),l.child)}function _2(i,l,d,m,y){if(da(l),l.stateNode===null){var j=Ao,T=d.contextType;typeof T=="object"&&T!==null&&(j=Jt(T)),j=new d(m,j),l.memoizedState=j.state!==null&&j.state!==void 0?j.state:null,j.updater=Bg,l.stateNode=j,j._reactInternals=l,j=l.stateNode,j.props=m,j.state=l.memoizedState,j.refs={},gg(l),T=d.contextType,j.context=typeof T=="object"&&T!==null?Jt(T):Ao,j.state=l.memoizedState,T=d.getDerivedStateFromProps,typeof T=="function"&&(zg(l,d,T,m),j.state=l.memoizedState),typeof d.getDerivedStateFromProps=="function"||typeof j.getSnapshotBeforeUpdate=="function"||typeof j.UNSAFE_componentWillMount!="function"&&typeof j.componentWillMount!="function"||(T=j.state,typeof j.componentWillMount=="function"&&j.componentWillMount(),typeof j.UNSAFE_componentWillMount=="function"&&j.UNSAFE_componentWillMount(),T!==j.state&&Bg.enqueueReplaceState(j,j.state,null),Cc(l,m,j,y),_c(),j.state=l.memoizedState),typeof j.componentDidMount=="function"&&(l.flags|=4194308),m=!0}else if(i===null){j=l.stateNode;var q=l.memoizedProps,X=xa(d,q);j.props=X;var ae=j.context,ue=d.contextType;T=Ao,typeof ue=="object"&&ue!==null&&(T=Jt(ue));var fe=d.getDerivedStateFromProps;ue=typeof fe=="function"||typeof j.getSnapshotBeforeUpdate=="function",q=l.pendingProps!==q,ue||typeof j.UNSAFE_componentWillReceiveProps!="function"&&typeof j.componentWillReceiveProps!="function"||(q||ae!==T)&&d2(l,j,m,T),ei=!1;var oe=l.memoizedState;j.state=oe,Cc(l,m,j,y),_c(),ae=l.memoizedState,q||oe!==ae||ei?(typeof fe=="function"&&(zg(l,d,fe,m),ae=l.memoizedState),(X=ei||u2(l,d,X,m,oe,ae,T))?(ue||typeof j.UNSAFE_componentWillMount!="function"&&typeof j.componentWillMount!="function"||(typeof j.componentWillMount=="function"&&j.componentWillMount(),typeof j.UNSAFE_componentWillMount=="function"&&j.UNSAFE_componentWillMount()),typeof j.componentDidMount=="function"&&(l.flags|=4194308)):(typeof j.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=m,l.memoizedState=ae),j.props=m,j.state=ae,j.context=T,m=X):(typeof j.componentDidMount=="function"&&(l.flags|=4194308),m=!1)}else{j=l.stateNode,xg(i,l),T=l.memoizedProps,ue=xa(d,T),j.props=ue,fe=l.pendingProps,oe=j.context,ae=d.contextType,X=Ao,typeof ae=="object"&&ae!==null&&(X=Jt(ae)),q=d.getDerivedStateFromProps,(ae=typeof q=="function"||typeof j.getSnapshotBeforeUpdate=="function")||typeof j.UNSAFE_componentWillReceiveProps!="function"&&typeof j.componentWillReceiveProps!="function"||(T!==fe||oe!==X)&&d2(l,j,m,X),ei=!1,oe=l.memoizedState,j.state=oe,Cc(l,m,j,y),_c();var le=l.memoizedState;T!==fe||oe!==le||ei||i!==null&&i.dependencies!==null&&Qd(i.dependencies)?(typeof q=="function"&&(zg(l,d,q,m),le=l.memoizedState),(ue=ei||u2(l,d,ue,m,oe,le,X)||i!==null&&i.dependencies!==null&&Qd(i.dependencies))?(ae||typeof j.UNSAFE_componentWillUpdate!="function"&&typeof j.componentWillUpdate!="function"||(typeof j.componentWillUpdate=="function"&&j.componentWillUpdate(m,le,X),typeof j.UNSAFE_componentWillUpdate=="function"&&j.UNSAFE_componentWillUpdate(m,le,X)),typeof j.componentDidUpdate=="function"&&(l.flags|=4),typeof j.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof j.componentDidUpdate!="function"||T===i.memoizedProps&&oe===i.memoizedState||(l.flags|=4),typeof j.getSnapshotBeforeUpdate!="function"||T===i.memoizedProps&&oe===i.memoizedState||(l.flags|=1024),l.memoizedProps=m,l.memoizedState=le),j.props=m,j.state=le,j.context=X,m=ue):(typeof j.componentDidUpdate!="function"||T===i.memoizedProps&&oe===i.memoizedState||(l.flags|=4),typeof j.getSnapshotBeforeUpdate!="function"||T===i.memoizedProps&&oe===i.memoizedState||(l.flags|=1024),m=!1)}return j=m,gf(i,l),m=(l.flags&128)!==0,j||m?(j=l.stateNode,d=m&&typeof d.getDerivedStateFromError!="function"?null:j.render(),l.flags|=1,i!==null&&m?(l.child=ma(l,i.child,null,y),l.child=ma(l,null,d,y)):en(i,l,d,y),l.memoizedState=j.state,i=l.child):i=pr(i,l,y),i}function C2(i,l,d,m){return ca(),l.flags|=256,en(i,l,d,m),l.child}var Vg={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Gg(i){return{baseLanes:i,cachePool:mC()}}function Kg(i,l,d){return i=i!==null?i.childLanes&~d:0,l&&(i|=Yn),i}function k2(i,l,d){var m=l.pendingProps,y=!1,j=(l.flags&128)!==0,T;if((T=j)||(T=i!==null&&i.memoizedState===null?!1:(Mt.current&2)!==0),T&&(y=!0,l.flags&=-129),T=(l.flags&32)!==0,l.flags&=-33,i===null){if(We){if(y?si(l):ri(),(i=xt)?(i=Lk(i,os),i=i!==null&&i.data!=="&"?i:null,i!==null&&(l.memoizedState={dehydrated:i,treeContext:Qr!==null?{id:Ds,overflow:qs}:null,retryLane:536870912,hydrationErrors:null},d=aC(i),d.return=l,l.child=d,Zt=l,xt=null)):i=null,i===null)throw Zr(l);return Ex(i)?l.lanes=32:l.lanes=536870912,null}var q=m.children;return m=m.fallback,y?(ri(),y=l.mode,q=xf({mode:"hidden",children:q},y),m=la(m,y,d,null),q.return=l,m.return=l,q.sibling=m,l.child=q,m=l.child,m.memoizedState=Gg(d),m.childLanes=Kg(i,T,d),l.memoizedState=Vg,Tc(null,m)):(si(l),Yg(l,q))}var X=i.memoizedState;if(X!==null&&(q=X.dehydrated,q!==null)){if(j)l.flags&256?(si(l),l.flags&=-257,l=Wg(i,l,d)):l.memoizedState!==null?(ri(),l.child=i.child,l.flags|=128,l=null):(ri(),q=m.fallback,y=l.mode,m=xf({mode:"visible",children:m.children},y),q=la(q,y,d,null),q.flags|=2,m.return=l,q.return=l,m.sibling=q,l.child=m,ma(l,i.child,null,d),m=l.child,m.memoizedState=Gg(d),m.childLanes=Kg(i,T,d),l.memoizedState=Vg,l=Tc(null,m));else if(si(l),Ex(q)){if(T=q.nextSibling&&q.nextSibling.dataset,T)var ae=T.dgst;T=ae,m=Error(s(419)),m.stack="",m.digest=T,yc({value:m,source:null,stack:null}),l=Wg(i,l,d)}else if(qt||Oo(i,l,d,!1),T=(d&i.childLanes)!==0,qt||T){if(T=ft,T!==null&&(m=Cd(T,d),m!==0&&m!==X.retryLane))throw X.retryLane=m,oa(i,m),On(T,i,m),Hg;Rx(q)||Cf(),l=Wg(i,l,d)}else Rx(q)?(l.flags|=192,l.child=i.child,l=null):(i=X.treeContext,xt=cs(q.nextSibling),Zt=l,We=!0,Xr=null,os=!1,i!==null&&cC(l,i),l=Yg(l,m.children),l.flags|=4096);return l}return y?(ri(),q=m.fallback,y=l.mode,X=i.child,ae=X.sibling,m=lr(X,{mode:"hidden",children:m.children}),m.subtreeFlags=X.subtreeFlags&65011712,ae!==null?q=lr(ae,q):(q=la(q,y,d,null),q.flags|=2),q.return=l,m.return=l,m.sibling=q,l.child=m,Tc(null,m),m=l.child,q=i.child.memoizedState,q===null?q=Gg(d):(y=q.cachePool,y!==null?(X=Pt._currentValue,y=y.parent!==X?{parent:X,pool:X}:y):y=mC(),q={baseLanes:q.baseLanes|d,cachePool:y}),m.memoizedState=q,m.childLanes=Kg(i,T,d),l.memoizedState=Vg,Tc(i.child,m)):(si(l),d=i.child,i=d.sibling,d=lr(d,{mode:"visible",children:m.children}),d.return=l,d.sibling=null,i!==null&&(T=l.deletions,T===null?(l.deletions=[i],l.flags|=16):T.push(i)),l.child=d,l.memoizedState=null,d)}function Yg(i,l){return l=xf({mode:"visible",children:l},i.mode),l.return=i,i.child=l}function xf(i,l){return i=Un(22,i,null,l),i.lanes=0,i}function Wg(i,l,d){return ma(l,i.child,null,d),i=Yg(l,l.pendingProps.children),i.flags|=2,l.memoizedState=null,i}function R2(i,l,d){i.lanes|=l;var m=i.alternate;m!==null&&(m.lanes|=l),ug(i.return,l,d)}function Qg(i,l,d,m,y,j){var T=i.memoizedState;T===null?i.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:m,tail:d,tailMode:y,treeForkCount:j}:(T.isBackwards=l,T.rendering=null,T.renderingStartTime=0,T.last=m,T.tail=d,T.tailMode=y,T.treeForkCount=j)}function E2(i,l,d){var m=l.pendingProps,y=m.revealOrder,j=m.tail;m=m.children;var T=Mt.current,q=(T&2)!==0;if(q?(T=T&1|2,l.flags|=128):T&=1,te(Mt,T),en(i,l,m,d),m=We?vc:0,!q&&i!==null&&(i.flags&128)!==0)e:for(i=l.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&R2(i,d,l);else if(i.tag===19)R2(i,d,l);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===l)break e;for(;i.sibling===null;){if(i.return===null||i.return===l)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}switch(y){case"forwards":for(d=l.child,y=null;d!==null;)i=d.alternate,i!==null&&rf(i)===null&&(y=d),d=d.sibling;d=y,d===null?(y=l.child,l.child=null):(y=d.sibling,d.sibling=null),Qg(l,!1,y,d,j,m);break;case"backwards":case"unstable_legacy-backwards":for(d=null,y=l.child,l.child=null;y!==null;){if(i=y.alternate,i!==null&&rf(i)===null){l.child=y;break}i=y.sibling,y.sibling=d,d=y,y=i}Qg(l,!0,d,null,j,m);break;case"together":Qg(l,!1,null,null,void 0,m);break;default:l.memoizedState=null}return l.child}function pr(i,l,d){if(i!==null&&(l.dependencies=i.dependencies),oi|=l.lanes,(d&l.childLanes)===0)if(i!==null){if(Oo(i,l,d,!1),(d&l.childLanes)===0)return null}else return null;if(i!==null&&l.child!==i.child)throw Error(s(153));if(l.child!==null){for(i=l.child,d=lr(i,i.pendingProps),l.child=d,d.return=l;i.sibling!==null;)i=i.sibling,d=d.sibling=lr(i,i.pendingProps),d.return=l;d.sibling=null}return l.child}function Xg(i,l){return(i.lanes&l)!==0?!0:(i=i.dependencies,!!(i!==null&&Qd(i)))}function k8(i,l,d){switch(l.tag){case 3:re(l,l.stateNode.containerInfo),Jr(l,Pt,i.memoizedState.cache),ca();break;case 27:case 5:me(l);break;case 4:re(l,l.stateNode.containerInfo);break;case 10:Jr(l,l.type,l.memoizedProps.value);break;case 31:if(l.memoizedState!==null)return l.flags|=128,Sg(l),null;break;case 13:var m=l.memoizedState;if(m!==null)return m.dehydrated!==null?(si(l),l.flags|=128,null):(d&l.child.childLanes)!==0?k2(i,l,d):(si(l),i=pr(i,l,d),i!==null?i.sibling:null);si(l);break;case 19:var y=(i.flags&128)!==0;if(m=(d&l.childLanes)!==0,m||(Oo(i,l,d,!1),m=(d&l.childLanes)!==0),y){if(m)return E2(i,l,d);l.flags|=128}if(y=l.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),te(Mt,Mt.current),m)break;return null;case 22:return l.lanes=0,w2(i,l,d,l.pendingProps);case 24:Jr(l,Pt,i.memoizedState.cache)}return pr(i,l,d)}function A2(i,l,d){if(i!==null)if(i.memoizedProps!==l.pendingProps)qt=!0;else{if(!Xg(i,d)&&(l.flags&128)===0)return qt=!1,k8(i,l,d);qt=(i.flags&131072)!==0}else qt=!1,We&&(l.flags&1048576)!==0&&lC(l,vc,l.index);switch(l.lanes=0,l.tag){case 16:e:{var m=l.pendingProps;if(i=ha(l.elementType),l.type=i,typeof i=="function")ng(i)?(m=xa(i,m),l.tag=1,l=_2(null,l,i,m,d)):(l.tag=0,l=Ug(null,l,i,m,d));else{if(i!=null){var y=i.$$typeof;if(y===_){l.tag=11,l=v2(null,l,i,m,d);break e}else if(y===A){l.tag=14,l=y2(null,l,i,m,d);break e}}throw l=z(i)||i,Error(s(306,l,""))}}return l;case 0:return Ug(i,l,l.type,l.pendingProps,d);case 1:return m=l.type,y=xa(m,l.pendingProps),_2(i,l,m,y,d);case 3:e:{if(re(l,l.stateNode.containerInfo),i===null)throw Error(s(387));m=l.pendingProps;var j=l.memoizedState;y=j.element,xg(i,l),Cc(l,m,null,d);var T=l.memoizedState;if(m=T.cache,Jr(l,Pt,m),m!==j.cache&&dg(l,[Pt],d,!0),_c(),m=T.element,j.isDehydrated)if(j={element:m,isDehydrated:!1,cache:T.cache},l.updateQueue.baseState=j,l.memoizedState=j,l.flags&256){l=C2(i,l,m,d);break e}else if(m!==y){y=rs(Error(s(424)),l),yc(y),l=C2(i,l,m,d);break e}else{switch(i=l.stateNode.containerInfo,i.nodeType){case 9:i=i.body;break;default:i=i.nodeName==="HTML"?i.ownerDocument.body:i}for(xt=cs(i.firstChild),Zt=l,We=!0,Xr=null,os=!0,d=wC(l,null,m,d),l.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling}else{if(ca(),m===y){l=pr(i,l,d);break e}en(i,l,m,d)}l=l.child}return l;case 26:return gf(i,l),i===null?(d=Bk(l.type,null,l.pendingProps,null))?l.memoizedState=d:We||(d=l.type,i=l.pendingProps,m=If(Q.current).createElement(d),m[Vt]=l,m[ln]=i,tn(m,d,i),Lt(m),l.stateNode=m):l.memoizedState=Bk(l.type,i.memoizedProps,l.pendingProps,i.memoizedState),null;case 27:return me(l),i===null&&We&&(m=l.stateNode=qk(l.type,l.pendingProps,Q.current),Zt=l,os=!0,y=xt,fi(l.type)?(Ax=y,xt=cs(m.firstChild)):xt=y),en(i,l,l.pendingProps.children,d),gf(i,l),i===null&&(l.flags|=4194304),l.child;case 5:return i===null&&We&&((y=m=xt)&&(m=sz(m,l.type,l.pendingProps,os),m!==null?(l.stateNode=m,Zt=l,xt=cs(m.firstChild),os=!1,y=!0):y=!1),y||Zr(l)),me(l),y=l.type,j=l.pendingProps,T=i!==null?i.memoizedProps:null,m=j.children,_x(y,j)?m=null:T!==null&&_x(y,T)&&(l.flags|=32),l.memoizedState!==null&&(y=Ng(i,l,v8,null,null,d),Gc._currentValue=y),gf(i,l),en(i,l,m,d),l.child;case 6:return i===null&&We&&((i=d=xt)&&(d=rz(d,l.pendingProps,os),d!==null?(l.stateNode=d,Zt=l,xt=null,i=!0):i=!1),i||Zr(l)),null;case 13:return k2(i,l,d);case 4:return re(l,l.stateNode.containerInfo),m=l.pendingProps,i===null?l.child=ma(l,null,m,d):en(i,l,m,d),l.child;case 11:return v2(i,l,l.type,l.pendingProps,d);case 7:return en(i,l,l.pendingProps,d),l.child;case 8:return en(i,l,l.pendingProps.children,d),l.child;case 12:return en(i,l,l.pendingProps.children,d),l.child;case 10:return m=l.pendingProps,Jr(l,l.type,m.value),en(i,l,m.children,d),l.child;case 9:return y=l.type._context,m=l.pendingProps.children,da(l),y=Jt(y),m=m(y),l.flags|=1,en(i,l,m,d),l.child;case 14:return y2(i,l,l.type,l.pendingProps,d);case 15:return b2(i,l,l.type,l.pendingProps,d);case 19:return E2(i,l,d);case 31:return C8(i,l,d);case 22:return w2(i,l,d,l.pendingProps);case 24:return da(l),m=Jt(Pt),i===null?(y=pg(),y===null&&(y=ft,j=fg(),y.pooledCache=j,j.refCount++,j!==null&&(y.pooledCacheLanes|=d),y=j),l.memoizedState={parent:m,cache:y},gg(l),Jr(l,Pt,y)):((i.lanes&d)!==0&&(xg(i,l),Cc(l,null,null,d),_c()),y=i.memoizedState,j=l.memoizedState,y.parent!==m?(y={parent:m,cache:m},l.memoizedState=y,l.lanes===0&&(l.memoizedState=l.updateQueue.baseState=y),Jr(l,Pt,m)):(m=j.cache,Jr(l,Pt,m),m!==y.cache&&dg(l,[Pt],d,!0))),en(i,l,l.pendingProps.children,d),l.child;case 29:throw l.pendingProps}throw Error(s(156,l.tag))}function mr(i){i.flags|=4}function Zg(i,l,d,m,y){if((l=(i.mode&32)!==0)&&(l=!1),l){if(i.flags|=16777216,(y&335544128)===y)if(i.stateNode.complete)i.flags|=8192;else if(sk())i.flags|=8192;else throw pa=ef,mg}else i.flags&=-16777217}function T2(i,l){if(l.type!=="stylesheet"||(l.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!Gk(l))if(sk())i.flags|=8192;else throw pa=ef,mg}function vf(i,l){l!==null&&(i.flags|=4),i.flags&16384&&(l=i.tag!==22?jd():536870912,i.lanes|=l,Go|=l)}function Mc(i,l){if(!We)switch(i.tailMode){case"hidden":l=i.tail;for(var d=null;l!==null;)l.alternate!==null&&(d=l),l=l.sibling;d===null?i.tail=null:d.sibling=null;break;case"collapsed":d=i.tail;for(var m=null;d!==null;)d.alternate!==null&&(m=d),d=d.sibling;m===null?l||i.tail===null?i.tail=null:i.tail.sibling=null:m.sibling=null}}function vt(i){var l=i.alternate!==null&&i.alternate.child===i.child,d=0,m=0;if(l)for(var y=i.child;y!==null;)d|=y.lanes|y.childLanes,m|=y.subtreeFlags&65011712,m|=y.flags&65011712,y.return=i,y=y.sibling;else for(y=i.child;y!==null;)d|=y.lanes|y.childLanes,m|=y.subtreeFlags,m|=y.flags,y.return=i,y=y.sibling;return i.subtreeFlags|=m,i.childLanes=d,l}function R8(i,l,d){var m=l.pendingProps;switch(ag(l),l.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return vt(l),null;case 1:return vt(l),null;case 3:return d=l.stateNode,m=null,i!==null&&(m=i.memoizedState.cache),l.memoizedState.cache!==m&&(l.flags|=2048),dr(Pt),ce(),d.pendingContext&&(d.context=d.pendingContext,d.pendingContext=null),(i===null||i.child===null)&&(Io(l)?mr(l):i===null||i.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,lg())),vt(l),null;case 26:var y=l.type,j=l.memoizedState;return i===null?(mr(l),j!==null?(vt(l),T2(l,j)):(vt(l),Zg(l,y,null,m,d))):j?j!==i.memoizedState?(mr(l),vt(l),T2(l,j)):(vt(l),l.flags&=-16777217):(i=i.memoizedProps,i!==m&&mr(l),vt(l),Zg(l,y,i,m,d)),null;case 27:if(ge(l),d=Q.current,y=l.type,i!==null&&l.stateNode!=null)i.memoizedProps!==m&&mr(l);else{if(!m){if(l.stateNode===null)throw Error(s(166));return vt(l),null}i=H.current,Io(l)?uC(l):(i=qk(y,m,d),l.stateNode=i,mr(l))}return vt(l),null;case 5:if(ge(l),y=l.type,i!==null&&l.stateNode!=null)i.memoizedProps!==m&&mr(l);else{if(!m){if(l.stateNode===null)throw Error(s(166));return vt(l),null}if(j=H.current,Io(l))uC(l);else{var T=If(Q.current);switch(j){case 1:j=T.createElementNS("http://www.w3.org/2000/svg",y);break;case 2:j=T.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;default:switch(y){case"svg":j=T.createElementNS("http://www.w3.org/2000/svg",y);break;case"math":j=T.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;case"script":j=T.createElement("div"),j.innerHTML="<script><\/script>",j=j.removeChild(j.firstChild);break;case"select":j=typeof m.is=="string"?T.createElement("select",{is:m.is}):T.createElement("select"),m.multiple?j.multiple=!0:m.size&&(j.size=m.size);break;default:j=typeof m.is=="string"?T.createElement(y,{is:m.is}):T.createElement(y)}}j[Vt]=l,j[ln]=m;e:for(T=l.child;T!==null;){if(T.tag===5||T.tag===6)j.appendChild(T.stateNode);else if(T.tag!==4&&T.tag!==27&&T.child!==null){T.child.return=T,T=T.child;continue}if(T===l)break e;for(;T.sibling===null;){if(T.return===null||T.return===l)break e;T=T.return}T.sibling.return=T.return,T=T.sibling}l.stateNode=j;e:switch(tn(j,y,m),y){case"button":case"input":case"select":case"textarea":m=!!m.autoFocus;break e;case"img":m=!0;break e;default:m=!1}m&&mr(l)}}return vt(l),Zg(l,l.type,i===null?null:i.memoizedProps,l.pendingProps,d),null;case 6:if(i&&l.stateNode!=null)i.memoizedProps!==m&&mr(l);else{if(typeof m!="string"&&l.stateNode===null)throw Error(s(166));if(i=Q.current,Io(l)){if(i=l.stateNode,d=l.memoizedProps,m=null,y=Zt,y!==null)switch(y.tag){case 27:case 5:m=y.memoizedProps}i[Vt]=l,i=!!(i.nodeValue===d||m!==null&&m.suppressHydrationWarning===!0||kk(i.nodeValue,d)),i||Zr(l,!0)}else i=If(i).createTextNode(m),i[Vt]=l,l.stateNode=i}return vt(l),null;case 31:if(d=l.memoizedState,i===null||i.memoizedState!==null){if(m=Io(l),d!==null){if(i===null){if(!m)throw Error(s(318));if(i=l.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(s(557));i[Vt]=l}else ca(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;vt(l),i=!1}else d=lg(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=d),i=!0;if(!i)return l.flags&256?(Gn(l),l):(Gn(l),null);if((l.flags&128)!==0)throw Error(s(558))}return vt(l),null;case 13:if(m=l.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(y=Io(l),m!==null&&m.dehydrated!==null){if(i===null){if(!y)throw Error(s(318));if(y=l.memoizedState,y=y!==null?y.dehydrated:null,!y)throw Error(s(317));y[Vt]=l}else ca(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;vt(l),y=!1}else y=lg(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=y),y=!0;if(!y)return l.flags&256?(Gn(l),l):(Gn(l),null)}return Gn(l),(l.flags&128)!==0?(l.lanes=d,l):(d=m!==null,i=i!==null&&i.memoizedState!==null,d&&(m=l.child,y=null,m.alternate!==null&&m.alternate.memoizedState!==null&&m.alternate.memoizedState.cachePool!==null&&(y=m.alternate.memoizedState.cachePool.pool),j=null,m.memoizedState!==null&&m.memoizedState.cachePool!==null&&(j=m.memoizedState.cachePool.pool),j!==y&&(m.flags|=2048)),d!==i&&d&&(l.child.flags|=8192),vf(l,l.updateQueue),vt(l),null);case 4:return ce(),i===null&&bx(l.stateNode.containerInfo),vt(l),null;case 10:return dr(l.type),vt(l),null;case 19:if(U(Mt),m=l.memoizedState,m===null)return vt(l),null;if(y=(l.flags&128)!==0,j=m.rendering,j===null)if(y)Mc(m,!1);else{if(Rt!==0||i!==null&&(i.flags&128)!==0)for(i=l.child;i!==null;){if(j=rf(i),j!==null){for(l.flags|=128,Mc(m,!1),i=j.updateQueue,l.updateQueue=i,vf(l,i),l.subtreeFlags=0,i=d,d=l.child;d!==null;)iC(d,i),d=d.sibling;return te(Mt,Mt.current&1|2),We&&cr(l,m.treeForkCount),l.child}i=i.sibling}m.tail!==null&&gt()>jf&&(l.flags|=128,y=!0,Mc(m,!1),l.lanes=4194304)}else{if(!y)if(i=rf(j),i!==null){if(l.flags|=128,y=!0,i=i.updateQueue,l.updateQueue=i,vf(l,i),Mc(m,!0),m.tail===null&&m.tailMode==="hidden"&&!j.alternate&&!We)return vt(l),null}else 2*gt()-m.renderingStartTime>jf&&d!==536870912&&(l.flags|=128,y=!0,Mc(m,!1),l.lanes=4194304);m.isBackwards?(j.sibling=l.child,l.child=j):(i=m.last,i!==null?i.sibling=j:l.child=j,m.last=j)}return m.tail!==null?(i=m.tail,m.rendering=i,m.tail=i.sibling,m.renderingStartTime=gt(),i.sibling=null,d=Mt.current,te(Mt,y?d&1|2:d&1),We&&cr(l,m.treeForkCount),i):(vt(l),null);case 22:case 23:return Gn(l),wg(),m=l.memoizedState!==null,i!==null?i.memoizedState!==null!==m&&(l.flags|=8192):m&&(l.flags|=8192),m?(d&536870912)!==0&&(l.flags&128)===0&&(vt(l),l.subtreeFlags&6&&(l.flags|=8192)):vt(l),d=l.updateQueue,d!==null&&vf(l,d.retryQueue),d=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(d=i.memoizedState.cachePool.pool),m=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(m=l.memoizedState.cachePool.pool),m!==d&&(l.flags|=2048),i!==null&&U(fa),null;case 24:return d=null,i!==null&&(d=i.memoizedState.cache),l.memoizedState.cache!==d&&(l.flags|=2048),dr(Pt),vt(l),null;case 25:return null;case 30:return null}throw Error(s(156,l.tag))}function E8(i,l){switch(ag(l),l.tag){case 1:return i=l.flags,i&65536?(l.flags=i&-65537|128,l):null;case 3:return dr(Pt),ce(),i=l.flags,(i&65536)!==0&&(i&128)===0?(l.flags=i&-65537|128,l):null;case 26:case 27:case 5:return ge(l),null;case 31:if(l.memoizedState!==null){if(Gn(l),l.alternate===null)throw Error(s(340));ca()}return i=l.flags,i&65536?(l.flags=i&-65537|128,l):null;case 13:if(Gn(l),i=l.memoizedState,i!==null&&i.dehydrated!==null){if(l.alternate===null)throw Error(s(340));ca()}return i=l.flags,i&65536?(l.flags=i&-65537|128,l):null;case 19:return U(Mt),null;case 4:return ce(),null;case 10:return dr(l.type),null;case 22:case 23:return Gn(l),wg(),i!==null&&U(fa),i=l.flags,i&65536?(l.flags=i&-65537|128,l):null;case 24:return dr(Pt),null;case 25:return null;default:return null}}function M2(i,l){switch(ag(l),l.tag){case 3:dr(Pt),ce();break;case 26:case 27:case 5:ge(l);break;case 4:ce();break;case 31:l.memoizedState!==null&&Gn(l);break;case 13:Gn(l);break;case 19:U(Mt);break;case 10:dr(l.type);break;case 22:case 23:Gn(l),wg(),i!==null&&U(fa);break;case 24:dr(Pt)}}function Ic(i,l){try{var d=l.updateQueue,m=d!==null?d.lastEffect:null;if(m!==null){var y=m.next;d=y;do{if((d.tag&i)===i){m=void 0;var j=d.create,T=d.inst;m=j(),T.destroy=m}d=d.next}while(d!==y)}}catch(q){lt(l,l.return,q)}}function ii(i,l,d){try{var m=l.updateQueue,y=m!==null?m.lastEffect:null;if(y!==null){var j=y.next;m=j;do{if((m.tag&i)===i){var T=m.inst,q=T.destroy;if(q!==void 0){T.destroy=void 0,y=l;var X=d,ae=q;try{ae()}catch(ue){lt(y,X,ue)}}}m=m.next}while(m!==j)}}catch(ue){lt(l,l.return,ue)}}function I2(i){var l=i.updateQueue;if(l!==null){var d=i.stateNode;try{jC(l,d)}catch(m){lt(i,i.return,m)}}}function O2(i,l,d){d.props=xa(i.type,i.memoizedProps),d.state=i.memoizedState;try{d.componentWillUnmount()}catch(m){lt(i,l,m)}}function Oc(i,l){try{var d=i.ref;if(d!==null){switch(i.tag){case 26:case 27:case 5:var m=i.stateNode;break;case 30:m=i.stateNode;break;default:m=i.stateNode}typeof d=="function"?i.refCleanup=d(m):d.current=m}}catch(y){lt(i,l,y)}}function $s(i,l){var d=i.ref,m=i.refCleanup;if(d!==null)if(typeof m=="function")try{m()}catch(y){lt(i,l,y)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof d=="function")try{d(null)}catch(y){lt(i,l,y)}else d.current=null}function L2(i){var l=i.type,d=i.memoizedProps,m=i.stateNode;try{e:switch(l){case"button":case"input":case"select":case"textarea":d.autoFocus&&m.focus();break e;case"img":d.src?m.src=d.src:d.srcSet&&(m.srcset=d.srcSet)}}catch(y){lt(i,i.return,y)}}function Jg(i,l,d){try{var m=i.stateNode;X8(m,i.type,d,l),m[ln]=l}catch(y){lt(i,i.return,y)}}function P2(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&fi(i.type)||i.tag===4}function ex(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||P2(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.tag===27&&fi(i.type)||i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function tx(i,l,d){var m=i.tag;if(m===5||m===6)i=i.stateNode,l?(d.nodeType===9?d.body:d.nodeName==="HTML"?d.ownerDocument.body:d).insertBefore(i,l):(l=d.nodeType===9?d.body:d.nodeName==="HTML"?d.ownerDocument.body:d,l.appendChild(i),d=d._reactRootContainer,d!=null||l.onclick!==null||(l.onclick=ar));else if(m!==4&&(m===27&&fi(i.type)&&(d=i.stateNode,l=null),i=i.child,i!==null))for(tx(i,l,d),i=i.sibling;i!==null;)tx(i,l,d),i=i.sibling}function yf(i,l,d){var m=i.tag;if(m===5||m===6)i=i.stateNode,l?d.insertBefore(i,l):d.appendChild(i);else if(m!==4&&(m===27&&fi(i.type)&&(d=i.stateNode),i=i.child,i!==null))for(yf(i,l,d),i=i.sibling;i!==null;)yf(i,l,d),i=i.sibling}function D2(i){var l=i.stateNode,d=i.memoizedProps;try{for(var m=i.type,y=l.attributes;y.length;)l.removeAttributeNode(y[0]);tn(l,m,d),l[Vt]=i,l[ln]=d}catch(j){lt(i,i.return,j)}}var gr=!1,$t=!1,nx=!1,q2=typeof WeakSet=="function"?WeakSet:Set,Qt=null;function A8(i,l){if(i=i.containerInfo,jx=zf,i=Q_(i),Wm(i)){if("selectionStart"in i)var d={start:i.selectionStart,end:i.selectionEnd};else e:{d=(d=i.ownerDocument)&&d.defaultView||window;var m=d.getSelection&&d.getSelection();if(m&&m.rangeCount!==0){d=m.anchorNode;var y=m.anchorOffset,j=m.focusNode;m=m.focusOffset;try{d.nodeType,j.nodeType}catch{d=null;break e}var T=0,q=-1,X=-1,ae=0,ue=0,fe=i,oe=null;t:for(;;){for(var le;fe!==d||y!==0&&fe.nodeType!==3||(q=T+y),fe!==j||m!==0&&fe.nodeType!==3||(X=T+m),fe.nodeType===3&&(T+=fe.nodeValue.length),(le=fe.firstChild)!==null;)oe=fe,fe=le;for(;;){if(fe===i)break t;if(oe===d&&++ae===y&&(q=T),oe===j&&++ue===m&&(X=T),(le=fe.nextSibling)!==null)break;fe=oe,oe=fe.parentNode}fe=le}d=q===-1||X===-1?null:{start:q,end:X}}else d=null}d=d||{start:0,end:0}}else d=null;for(Nx={focusedElem:i,selectionRange:d},zf=!1,Qt=l;Qt!==null;)if(l=Qt,i=l.child,(l.subtreeFlags&1028)!==0&&i!==null)i.return=l,Qt=i;else for(;Qt!==null;){switch(l=Qt,j=l.alternate,i=l.flags,l.tag){case 0:if((i&4)!==0&&(i=l.updateQueue,i=i!==null?i.events:null,i!==null))for(d=0;d<i.length;d++)y=i[d],y.ref.impl=y.nextImpl;break;case 11:case 15:break;case 1:if((i&1024)!==0&&j!==null){i=void 0,d=l,y=j.memoizedProps,j=j.memoizedState,m=d.stateNode;try{var we=xa(d.type,y);i=m.getSnapshotBeforeUpdate(we,j),m.__reactInternalSnapshotBeforeUpdate=i}catch(Te){lt(d,d.return,Te)}}break;case 3:if((i&1024)!==0){if(i=l.stateNode.containerInfo,d=i.nodeType,d===9)kx(i);else if(d===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":kx(i);break;default:i.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((i&1024)!==0)throw Error(s(163))}if(i=l.sibling,i!==null){i.return=l.return,Qt=i;break}Qt=l.return}}function $2(i,l,d){var m=d.flags;switch(d.tag){case 0:case 11:case 15:vr(i,d),m&4&&Ic(5,d);break;case 1:if(vr(i,d),m&4)if(i=d.stateNode,l===null)try{i.componentDidMount()}catch(T){lt(d,d.return,T)}else{var y=xa(d.type,l.memoizedProps);l=l.memoizedState;try{i.componentDidUpdate(y,l,i.__reactInternalSnapshotBeforeUpdate)}catch(T){lt(d,d.return,T)}}m&64&&I2(d),m&512&&Oc(d,d.return);break;case 3:if(vr(i,d),m&64&&(i=d.updateQueue,i!==null)){if(l=null,d.child!==null)switch(d.child.tag){case 27:case 5:l=d.child.stateNode;break;case 1:l=d.child.stateNode}try{jC(i,l)}catch(T){lt(d,d.return,T)}}break;case 27:l===null&&m&4&&D2(d);case 26:case 5:vr(i,d),l===null&&m&4&&L2(d),m&512&&Oc(d,d.return);break;case 12:vr(i,d);break;case 31:vr(i,d),m&4&&F2(i,d);break;case 13:vr(i,d),m&4&&H2(i,d),m&64&&(i=d.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(d=$8.bind(null,d),iz(i,d))));break;case 22:if(m=d.memoizedState!==null||gr,!m){l=l!==null&&l.memoizedState!==null||$t,y=gr;var j=$t;gr=m,($t=l)&&!j?yr(i,d,(d.subtreeFlags&8772)!==0):vr(i,d),gr=y,$t=j}break;case 30:break;default:vr(i,d)}}function z2(i){var l=i.alternate;l!==null&&(i.alternate=null,z2(l)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(l=i.stateNode,l!==null&&ac(l)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}var wt=null,An=!1;function xr(i,l,d){for(d=d.child;d!==null;)B2(i,l,d),d=d.sibling}function B2(i,l,d){if(Ct&&typeof Ct.onCommitFiberUnmount=="function")try{Ct.onCommitFiberUnmount(on,d)}catch{}switch(d.tag){case 26:$t||$s(d,l),xr(i,l,d),d.memoizedState?d.memoizedState.count--:d.stateNode&&(d=d.stateNode,d.parentNode.removeChild(d));break;case 27:$t||$s(d,l);var m=wt,y=An;fi(d.type)&&(wt=d.stateNode,An=!1),xr(i,l,d),Hc(d.stateNode),wt=m,An=y;break;case 5:$t||$s(d,l);case 6:if(m=wt,y=An,wt=null,xr(i,l,d),wt=m,An=y,wt!==null)if(An)try{(wt.nodeType===9?wt.body:wt.nodeName==="HTML"?wt.ownerDocument.body:wt).removeChild(d.stateNode)}catch(j){lt(d,l,j)}else try{wt.removeChild(d.stateNode)}catch(j){lt(d,l,j)}break;case 18:wt!==null&&(An?(i=wt,Ik(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,d.stateNode),el(i)):Ik(wt,d.stateNode));break;case 4:m=wt,y=An,wt=d.stateNode.containerInfo,An=!0,xr(i,l,d),wt=m,An=y;break;case 0:case 11:case 14:case 15:ii(2,d,l),$t||ii(4,d,l),xr(i,l,d);break;case 1:$t||($s(d,l),m=d.stateNode,typeof m.componentWillUnmount=="function"&&O2(d,l,m)),xr(i,l,d);break;case 21:xr(i,l,d);break;case 22:$t=(m=$t)||d.memoizedState!==null,xr(i,l,d),$t=m;break;default:xr(i,l,d)}}function F2(i,l){if(l.memoizedState===null&&(i=l.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{el(i)}catch(d){lt(l,l.return,d)}}}function H2(i,l){if(l.memoizedState===null&&(i=l.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{el(i)}catch(d){lt(l,l.return,d)}}function T8(i){switch(i.tag){case 31:case 13:case 19:var l=i.stateNode;return l===null&&(l=i.stateNode=new q2),l;case 22:return i=i.stateNode,l=i._retryCache,l===null&&(l=i._retryCache=new q2),l;default:throw Error(s(435,i.tag))}}function bf(i,l){var d=T8(i);l.forEach(function(m){if(!d.has(m)){d.add(m);var y=z8.bind(null,i,m);m.then(y,y)}})}function Tn(i,l){var d=l.deletions;if(d!==null)for(var m=0;m<d.length;m++){var y=d[m],j=i,T=l,q=T;e:for(;q!==null;){switch(q.tag){case 27:if(fi(q.type)){wt=q.stateNode,An=!1;break e}break;case 5:wt=q.stateNode,An=!1;break e;case 3:case 4:wt=q.stateNode.containerInfo,An=!0;break e}q=q.return}if(wt===null)throw Error(s(160));B2(j,T,y),wt=null,An=!1,j=y.alternate,j!==null&&(j.return=null),y.return=null}if(l.subtreeFlags&13886)for(l=l.child;l!==null;)U2(l,i),l=l.sibling}var vs=null;function U2(i,l){var d=i.alternate,m=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:Tn(l,i),Mn(i),m&4&&(ii(3,i,i.return),Ic(3,i),ii(5,i,i.return));break;case 1:Tn(l,i),Mn(i),m&512&&($t||d===null||$s(d,d.return)),m&64&&gr&&(i=i.updateQueue,i!==null&&(m=i.callbacks,m!==null&&(d=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=d===null?m:d.concat(m))));break;case 26:var y=vs;if(Tn(l,i),Mn(i),m&512&&($t||d===null||$s(d,d.return)),m&4){var j=d!==null?d.memoizedState:null;if(m=i.memoizedState,d===null)if(m===null)if(i.stateNode===null){e:{m=i.type,d=i.memoizedProps,y=y.ownerDocument||y;t:switch(m){case"title":j=y.getElementsByTagName("title")[0],(!j||j[ta]||j[Vt]||j.namespaceURI==="http://www.w3.org/2000/svg"||j.hasAttribute("itemprop"))&&(j=y.createElement(m),y.head.insertBefore(j,y.querySelector("head > title"))),tn(j,m,d),j[Vt]=i,Lt(j),m=j;break e;case"link":var T=Uk("link","href",y).get(m+(d.href||""));if(T){for(var q=0;q<T.length;q++)if(j=T[q],j.getAttribute("href")===(d.href==null||d.href===""?null:d.href)&&j.getAttribute("rel")===(d.rel==null?null:d.rel)&&j.getAttribute("title")===(d.title==null?null:d.title)&&j.getAttribute("crossorigin")===(d.crossOrigin==null?null:d.crossOrigin)){T.splice(q,1);break t}}j=y.createElement(m),tn(j,m,d),y.head.appendChild(j);break;case"meta":if(T=Uk("meta","content",y).get(m+(d.content||""))){for(q=0;q<T.length;q++)if(j=T[q],j.getAttribute("content")===(d.content==null?null:""+d.content)&&j.getAttribute("name")===(d.name==null?null:d.name)&&j.getAttribute("property")===(d.property==null?null:d.property)&&j.getAttribute("http-equiv")===(d.httpEquiv==null?null:d.httpEquiv)&&j.getAttribute("charset")===(d.charSet==null?null:d.charSet)){T.splice(q,1);break t}}j=y.createElement(m),tn(j,m,d),y.head.appendChild(j);break;default:throw Error(s(468,m))}j[Vt]=i,Lt(j),m=j}i.stateNode=m}else Vk(y,i.type,i.stateNode);else i.stateNode=Hk(y,m,i.memoizedProps);else j!==m?(j===null?d.stateNode!==null&&(d=d.stateNode,d.parentNode.removeChild(d)):j.count--,m===null?Vk(y,i.type,i.stateNode):Hk(y,m,i.memoizedProps)):m===null&&i.stateNode!==null&&Jg(i,i.memoizedProps,d.memoizedProps)}break;case 27:Tn(l,i),Mn(i),m&512&&($t||d===null||$s(d,d.return)),d!==null&&m&4&&Jg(i,i.memoizedProps,d.memoizedProps);break;case 5:if(Tn(l,i),Mn(i),m&512&&($t||d===null||$s(d,d.return)),i.flags&32){y=i.stateNode;try{jo(y,"")}catch(we){lt(i,i.return,we)}}m&4&&i.stateNode!=null&&(y=i.memoizedProps,Jg(i,y,d!==null?d.memoizedProps:y)),m&1024&&(nx=!0);break;case 6:if(Tn(l,i),Mn(i),m&4){if(i.stateNode===null)throw Error(s(162));m=i.memoizedProps,d=i.stateNode;try{d.nodeValue=m}catch(we){lt(i,i.return,we)}}break;case 3:if(Pf=null,y=vs,vs=Of(l.containerInfo),Tn(l,i),vs=y,Mn(i),m&4&&d!==null&&d.memoizedState.isDehydrated)try{el(l.containerInfo)}catch(we){lt(i,i.return,we)}nx&&(nx=!1,V2(i));break;case 4:m=vs,vs=Of(i.stateNode.containerInfo),Tn(l,i),Mn(i),vs=m;break;case 12:Tn(l,i),Mn(i);break;case 31:Tn(l,i),Mn(i),m&4&&(m=i.updateQueue,m!==null&&(i.updateQueue=null,bf(i,m)));break;case 13:Tn(l,i),Mn(i),i.child.flags&8192&&i.memoizedState!==null!=(d!==null&&d.memoizedState!==null)&&(Sf=gt()),m&4&&(m=i.updateQueue,m!==null&&(i.updateQueue=null,bf(i,m)));break;case 22:y=i.memoizedState!==null;var X=d!==null&&d.memoizedState!==null,ae=gr,ue=$t;if(gr=ae||y,$t=ue||X,Tn(l,i),$t=ue,gr=ae,Mn(i),m&8192)e:for(l=i.stateNode,l._visibility=y?l._visibility&-2:l._visibility|1,y&&(d===null||X||gr||$t||va(i)),d=null,l=i;;){if(l.tag===5||l.tag===26){if(d===null){X=d=l;try{if(j=X.stateNode,y)T=j.style,typeof T.setProperty=="function"?T.setProperty("display","none","important"):T.display="none";else{q=X.stateNode;var fe=X.memoizedProps.style,oe=fe!=null&&fe.hasOwnProperty("display")?fe.display:null;q.style.display=oe==null||typeof oe=="boolean"?"":(""+oe).trim()}}catch(we){lt(X,X.return,we)}}}else if(l.tag===6){if(d===null){X=l;try{X.stateNode.nodeValue=y?"":X.memoizedProps}catch(we){lt(X,X.return,we)}}}else if(l.tag===18){if(d===null){X=l;try{var le=X.stateNode;y?Ok(le,!0):Ok(X.stateNode,!1)}catch(we){lt(X,X.return,we)}}}else if((l.tag!==22&&l.tag!==23||l.memoizedState===null||l===i)&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===i)break e;for(;l.sibling===null;){if(l.return===null||l.return===i)break e;d===l&&(d=null),l=l.return}d===l&&(d=null),l.sibling.return=l.return,l=l.sibling}m&4&&(m=i.updateQueue,m!==null&&(d=m.retryQueue,d!==null&&(m.retryQueue=null,bf(i,d))));break;case 19:Tn(l,i),Mn(i),m&4&&(m=i.updateQueue,m!==null&&(i.updateQueue=null,bf(i,m)));break;case 30:break;case 21:break;default:Tn(l,i),Mn(i)}}function Mn(i){var l=i.flags;if(l&2){try{for(var d,m=i.return;m!==null;){if(P2(m)){d=m;break}m=m.return}if(d==null)throw Error(s(160));switch(d.tag){case 27:var y=d.stateNode,j=ex(i);yf(i,j,y);break;case 5:var T=d.stateNode;d.flags&32&&(jo(T,""),d.flags&=-33);var q=ex(i);yf(i,q,T);break;case 3:case 4:var X=d.stateNode.containerInfo,ae=ex(i);tx(i,ae,X);break;default:throw Error(s(161))}}catch(ue){lt(i,i.return,ue)}i.flags&=-3}l&4096&&(i.flags&=-4097)}function V2(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var l=i;V2(l),l.tag===5&&l.flags&1024&&l.stateNode.reset(),i=i.sibling}}function vr(i,l){if(l.subtreeFlags&8772)for(l=l.child;l!==null;)$2(i,l.alternate,l),l=l.sibling}function va(i){for(i=i.child;i!==null;){var l=i;switch(l.tag){case 0:case 11:case 14:case 15:ii(4,l,l.return),va(l);break;case 1:$s(l,l.return);var d=l.stateNode;typeof d.componentWillUnmount=="function"&&O2(l,l.return,d),va(l);break;case 27:Hc(l.stateNode);case 26:case 5:$s(l,l.return),va(l);break;case 22:l.memoizedState===null&&va(l);break;case 30:va(l);break;default:va(l)}i=i.sibling}}function yr(i,l,d){for(d=d&&(l.subtreeFlags&8772)!==0,l=l.child;l!==null;){var m=l.alternate,y=i,j=l,T=j.flags;switch(j.tag){case 0:case 11:case 15:yr(y,j,d),Ic(4,j);break;case 1:if(yr(y,j,d),m=j,y=m.stateNode,typeof y.componentDidMount=="function")try{y.componentDidMount()}catch(ae){lt(m,m.return,ae)}if(m=j,y=m.updateQueue,y!==null){var q=m.stateNode;try{var X=y.shared.hiddenCallbacks;if(X!==null)for(y.shared.hiddenCallbacks=null,y=0;y<X.length;y++)SC(X[y],q)}catch(ae){lt(m,m.return,ae)}}d&&T&64&&I2(j),Oc(j,j.return);break;case 27:D2(j);case 26:case 5:yr(y,j,d),d&&m===null&&T&4&&L2(j),Oc(j,j.return);break;case 12:yr(y,j,d);break;case 31:yr(y,j,d),d&&T&4&&F2(y,j);break;case 13:yr(y,j,d),d&&T&4&&H2(y,j);break;case 22:j.memoizedState===null&&yr(y,j,d),Oc(j,j.return);break;case 30:break;default:yr(y,j,d)}l=l.sibling}}function sx(i,l){var d=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(d=i.memoizedState.cachePool.pool),i=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(i=l.memoizedState.cachePool.pool),i!==d&&(i!=null&&i.refCount++,d!=null&&bc(d))}function rx(i,l){i=null,l.alternate!==null&&(i=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==i&&(l.refCount++,i!=null&&bc(i))}function ys(i,l,d,m){if(l.subtreeFlags&10256)for(l=l.child;l!==null;)G2(i,l,d,m),l=l.sibling}function G2(i,l,d,m){var y=l.flags;switch(l.tag){case 0:case 11:case 15:ys(i,l,d,m),y&2048&&Ic(9,l);break;case 1:ys(i,l,d,m);break;case 3:ys(i,l,d,m),y&2048&&(i=null,l.alternate!==null&&(i=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==i&&(l.refCount++,i!=null&&bc(i)));break;case 12:if(y&2048){ys(i,l,d,m),i=l.stateNode;try{var j=l.memoizedProps,T=j.id,q=j.onPostCommit;typeof q=="function"&&q(T,l.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(X){lt(l,l.return,X)}}else ys(i,l,d,m);break;case 31:ys(i,l,d,m);break;case 13:ys(i,l,d,m);break;case 23:break;case 22:j=l.stateNode,T=l.alternate,l.memoizedState!==null?j._visibility&2?ys(i,l,d,m):Lc(i,l):j._visibility&2?ys(i,l,d,m):(j._visibility|=2,Ho(i,l,d,m,(l.subtreeFlags&10256)!==0||!1)),y&2048&&sx(T,l);break;case 24:ys(i,l,d,m),y&2048&&rx(l.alternate,l);break;default:ys(i,l,d,m)}}function Ho(i,l,d,m,y){for(y=y&&((l.subtreeFlags&10256)!==0||!1),l=l.child;l!==null;){var j=i,T=l,q=d,X=m,ae=T.flags;switch(T.tag){case 0:case 11:case 15:Ho(j,T,q,X,y),Ic(8,T);break;case 23:break;case 22:var ue=T.stateNode;T.memoizedState!==null?ue._visibility&2?Ho(j,T,q,X,y):Lc(j,T):(ue._visibility|=2,Ho(j,T,q,X,y)),y&&ae&2048&&sx(T.alternate,T);break;case 24:Ho(j,T,q,X,y),y&&ae&2048&&rx(T.alternate,T);break;default:Ho(j,T,q,X,y)}l=l.sibling}}function Lc(i,l){if(l.subtreeFlags&10256)for(l=l.child;l!==null;){var d=i,m=l,y=m.flags;switch(m.tag){case 22:Lc(d,m),y&2048&&sx(m.alternate,m);break;case 24:Lc(d,m),y&2048&&rx(m.alternate,m);break;default:Lc(d,m)}l=l.sibling}}var Pc=8192;function Uo(i,l,d){if(i.subtreeFlags&Pc)for(i=i.child;i!==null;)K2(i,l,d),i=i.sibling}function K2(i,l,d){switch(i.tag){case 26:Uo(i,l,d),i.flags&Pc&&i.memoizedState!==null&&xz(d,vs,i.memoizedState,i.memoizedProps);break;case 5:Uo(i,l,d);break;case 3:case 4:var m=vs;vs=Of(i.stateNode.containerInfo),Uo(i,l,d),vs=m;break;case 22:i.memoizedState===null&&(m=i.alternate,m!==null&&m.memoizedState!==null?(m=Pc,Pc=16777216,Uo(i,l,d),Pc=m):Uo(i,l,d));break;default:Uo(i,l,d)}}function Y2(i){var l=i.alternate;if(l!==null&&(i=l.child,i!==null)){l.child=null;do l=i.sibling,i.sibling=null,i=l;while(i!==null)}}function Dc(i){var l=i.deletions;if((i.flags&16)!==0){if(l!==null)for(var d=0;d<l.length;d++){var m=l[d];Qt=m,Q2(m,i)}Y2(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)W2(i),i=i.sibling}function W2(i){switch(i.tag){case 0:case 11:case 15:Dc(i),i.flags&2048&&ii(9,i,i.return);break;case 3:Dc(i);break;case 12:Dc(i);break;case 22:var l=i.stateNode;i.memoizedState!==null&&l._visibility&2&&(i.return===null||i.return.tag!==13)?(l._visibility&=-3,wf(i)):Dc(i);break;default:Dc(i)}}function wf(i){var l=i.deletions;if((i.flags&16)!==0){if(l!==null)for(var d=0;d<l.length;d++){var m=l[d];Qt=m,Q2(m,i)}Y2(i)}for(i=i.child;i!==null;){switch(l=i,l.tag){case 0:case 11:case 15:ii(8,l,l.return),wf(l);break;case 22:d=l.stateNode,d._visibility&2&&(d._visibility&=-3,wf(l));break;default:wf(l)}i=i.sibling}}function Q2(i,l){for(;Qt!==null;){var d=Qt;switch(d.tag){case 0:case 11:case 15:ii(8,d,l);break;case 23:case 22:if(d.memoizedState!==null&&d.memoizedState.cachePool!==null){var m=d.memoizedState.cachePool.pool;m!=null&&m.refCount++}break;case 24:bc(d.memoizedState.cache)}if(m=d.child,m!==null)m.return=d,Qt=m;else e:for(d=i;Qt!==null;){m=Qt;var y=m.sibling,j=m.return;if(z2(m),m===d){Qt=null;break e}if(y!==null){y.return=j,Qt=y;break e}Qt=j}}}var M8={getCacheForType:function(i){var l=Jt(Pt),d=l.data.get(i);return d===void 0&&(d=i(),l.data.set(i,d)),d},cacheSignal:function(){return Jt(Pt).controller.signal}},I8=typeof WeakMap=="function"?WeakMap:Map,st=0,ft=null,Ue=null,Ge=0,ot=0,Kn=null,ai=!1,Vo=!1,ix=!1,br=0,Rt=0,oi=0,ya=0,ax=0,Yn=0,Go=0,qc=null,In=null,ox=!1,Sf=0,X2=0,jf=1/0,Nf=null,li=null,Gt=0,ci=null,Ko=null,wr=0,lx=0,cx=null,Z2=null,$c=0,ux=null;function Wn(){return(st&2)!==0&&Ge!==0?Ge&-Ge:$.T!==null?gx():kd()}function J2(){if(Yn===0)if((Ge&536870912)===0||We){var i=xo;xo<<=1,(xo&3932160)===0&&(xo=262144),Yn=i}else Yn=536870912;return i=Vn.current,i!==null&&(i.flags|=32),Yn}function On(i,l,d){(i===ft&&(ot===2||ot===9)||i.cancelPendingCommit!==null)&&(Yo(i,0),ui(i,Ge,Yn,!1)),ea(i,d),((st&2)===0||i!==ft)&&(i===ft&&((st&2)===0&&(ya|=d),Rt===4&&ui(i,Ge,Yn,!1)),zs(i))}function ek(i,l,d){if((st&6)!==0)throw Error(s(327));var m=!d&&(l&127)===0&&(l&i.expiredLanes)===0||Ji(i,l),y=m?P8(i,l):fx(i,l,!0),j=m;do{if(y===0){Vo&&!m&&ui(i,l,0,!1);break}else{if(d=i.current.alternate,j&&!O8(d)){y=fx(i,l,!1),j=!1;continue}if(y===2){if(j=l,i.errorRecoveryDisabledLanes&j)var T=0;else T=i.pendingLanes&-536870913,T=T!==0?T:T&536870912?536870912:0;if(T!==0){l=T;e:{var q=i;y=qc;var X=q.current.memoizedState.isDehydrated;if(X&&(Yo(q,T).flags|=256),T=fx(q,T,!1),T!==2){if(ix&&!X){q.errorRecoveryDisabledLanes|=j,ya|=j,y=4;break e}j=In,In=y,j!==null&&(In===null?In=j:In.push.apply(In,j))}y=T}if(j=!1,y!==2)continue}}if(y===1){Yo(i,0),ui(i,l,0,!0);break}e:{switch(m=i,j=y,j){case 0:case 1:throw Error(s(345));case 4:if((l&4194048)!==l)break;case 6:ui(m,l,Yn,!ai);break e;case 2:In=null;break;case 3:case 5:break;default:throw Error(s(329))}if((l&62914560)===l&&(y=Sf+300-gt(),10<y)){if(ui(m,l,Yn,!ai),yo(m,0,!0)!==0)break e;wr=l,m.timeoutHandle=Tk(tk.bind(null,m,d,In,Nf,ox,l,Yn,ya,Go,ai,j,"Throttled",-0,0),y);break e}tk(m,d,In,Nf,ox,l,Yn,ya,Go,ai,j,null,-0,0)}}break}while(!0);zs(i)}function tk(i,l,d,m,y,j,T,q,X,ae,ue,fe,oe,le){if(i.timeoutHandle=-1,fe=l.subtreeFlags,fe&8192||(fe&16785408)===16785408){fe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ar},K2(l,j,fe);var we=(j&62914560)===j?Sf-gt():(j&4194048)===j?X2-gt():0;if(we=vz(fe,we),we!==null){wr=j,i.cancelPendingCommit=we(ck.bind(null,i,l,j,d,m,y,T,q,X,ue,fe,null,oe,le)),ui(i,j,T,!ae);return}}ck(i,l,j,d,m,y,T,q,X)}function O8(i){for(var l=i;;){var d=l.tag;if((d===0||d===11||d===15)&&l.flags&16384&&(d=l.updateQueue,d!==null&&(d=d.stores,d!==null)))for(var m=0;m<d.length;m++){var y=d[m],j=y.getSnapshot;y=y.value;try{if(!Hn(j(),y))return!1}catch{return!1}}if(d=l.child,l.subtreeFlags&16384&&d!==null)d.return=l,l=d;else{if(l===i)break;for(;l.sibling===null;){if(l.return===null||l.return===i)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function ui(i,l,d,m){l&=~ax,l&=~ya,i.suspendedLanes|=l,i.pingedLanes&=~l,m&&(i.warmLanes|=l),m=i.expirationTimes;for(var y=l;0<y;){var j=31-yn(y),T=1<<j;m[j]=-1,y&=~T}d!==0&&Nd(i,d,l)}function _f(){return(st&6)===0?(zc(0),!1):!0}function dx(){if(Ue!==null){if(ot===0)var i=Ue.return;else i=Ue,ur=ua=null,kg(i),qo=null,Sc=0,i=Ue;for(;i!==null;)M2(i.alternate,i),i=i.return;Ue=null}}function Yo(i,l){var d=i.timeoutHandle;d!==-1&&(i.timeoutHandle=-1,ez(d)),d=i.cancelPendingCommit,d!==null&&(i.cancelPendingCommit=null,d()),wr=0,dx(),ft=i,Ue=d=lr(i.current,null),Ge=l,ot=0,Kn=null,ai=!1,Vo=Ji(i,l),ix=!1,Go=Yn=ax=ya=oi=Rt=0,In=qc=null,ox=!1,(l&8)!==0&&(l|=l&32);var m=i.entangledLanes;if(m!==0)for(i=i.entanglements,m&=l;0<m;){var y=31-yn(m),j=1<<y;l|=i[y],m&=~j}return br=l,Vd(),d}function nk(i,l){qe=null,$.H=Ac,l===Do||l===Jd?(l=vC(),ot=3):l===mg?(l=vC(),ot=4):ot=l===Hg?8:l!==null&&typeof l=="object"&&typeof l.then=="function"?6:1,Kn=l,Ue===null&&(Rt=1,pf(i,rs(l,i.current)))}function sk(){var i=Vn.current;return i===null?!0:(Ge&4194048)===Ge?ls===null:(Ge&62914560)===Ge||(Ge&536870912)!==0?i===ls:!1}function rk(){var i=$.H;return $.H=Ac,i===null?Ac:i}function ik(){var i=$.A;return $.A=M8,i}function Cf(){Rt=4,ai||(Ge&4194048)!==Ge&&Vn.current!==null||(Vo=!0),(oi&134217727)===0&&(ya&134217727)===0||ft===null||ui(ft,Ge,Yn,!1)}function fx(i,l,d){var m=st;st|=2;var y=rk(),j=ik();(ft!==i||Ge!==l)&&(Nf=null,Yo(i,l)),l=!1;var T=Rt;e:do try{if(ot!==0&&Ue!==null){var q=Ue,X=Kn;switch(ot){case 8:dx(),T=6;break e;case 3:case 2:case 9:case 6:Vn.current===null&&(l=!0);var ae=ot;if(ot=0,Kn=null,Wo(i,q,X,ae),d&&Vo){T=0;break e}break;default:ae=ot,ot=0,Kn=null,Wo(i,q,X,ae)}}L8(),T=Rt;break}catch(ue){nk(i,ue)}while(!0);return l&&i.shellSuspendCounter++,ur=ua=null,st=m,$.H=y,$.A=j,Ue===null&&(ft=null,Ge=0,Vd()),T}function L8(){for(;Ue!==null;)ak(Ue)}function P8(i,l){var d=st;st|=2;var m=rk(),y=ik();ft!==i||Ge!==l?(Nf=null,jf=gt()+500,Yo(i,l)):Vo=Ji(i,l);e:do try{if(ot!==0&&Ue!==null){l=Ue;var j=Kn;t:switch(ot){case 1:ot=0,Kn=null,Wo(i,l,j,1);break;case 2:case 9:if(gC(j)){ot=0,Kn=null,ok(l);break}l=function(){ot!==2&&ot!==9||ft!==i||(ot=7),zs(i)},j.then(l,l);break e;case 3:ot=7;break e;case 4:ot=5;break e;case 7:gC(j)?(ot=0,Kn=null,ok(l)):(ot=0,Kn=null,Wo(i,l,j,7));break;case 5:var T=null;switch(Ue.tag){case 26:T=Ue.memoizedState;case 5:case 27:var q=Ue;if(T?Gk(T):q.stateNode.complete){ot=0,Kn=null;var X=q.sibling;if(X!==null)Ue=X;else{var ae=q.return;ae!==null?(Ue=ae,kf(ae)):Ue=null}break t}}ot=0,Kn=null,Wo(i,l,j,5);break;case 6:ot=0,Kn=null,Wo(i,l,j,6);break;case 8:dx(),Rt=6;break e;default:throw Error(s(462))}}D8();break}catch(ue){nk(i,ue)}while(!0);return ur=ua=null,$.H=m,$.A=y,st=d,Ue!==null?0:(ft=null,Ge=0,Vd(),Rt)}function D8(){for(;Ue!==null&&!Ht();)ak(Ue)}function ak(i){var l=A2(i.alternate,i,br);i.memoizedProps=i.pendingProps,l===null?kf(i):Ue=l}function ok(i){var l=i,d=l.alternate;switch(l.tag){case 15:case 0:l=N2(d,l,l.pendingProps,l.type,void 0,Ge);break;case 11:l=N2(d,l,l.pendingProps,l.type.render,l.ref,Ge);break;case 5:kg(l);default:M2(d,l),l=Ue=iC(l,br),l=A2(d,l,br)}i.memoizedProps=i.pendingProps,l===null?kf(i):Ue=l}function Wo(i,l,d,m){ur=ua=null,kg(l),qo=null,Sc=0;var y=l.return;try{if(_8(i,y,l,d,Ge)){Rt=1,pf(i,rs(d,i.current)),Ue=null;return}}catch(j){if(y!==null)throw Ue=y,j;Rt=1,pf(i,rs(d,i.current)),Ue=null;return}l.flags&32768?(We||m===1?i=!0:Vo||(Ge&536870912)!==0?i=!1:(ai=i=!0,(m===2||m===9||m===3||m===6)&&(m=Vn.current,m!==null&&m.tag===13&&(m.flags|=16384))),lk(l,i)):kf(l)}function kf(i){var l=i;do{if((l.flags&32768)!==0){lk(l,ai);return}i=l.return;var d=R8(l.alternate,l,br);if(d!==null){Ue=d;return}if(l=l.sibling,l!==null){Ue=l;return}Ue=l=i}while(l!==null);Rt===0&&(Rt=5)}function lk(i,l){do{var d=E8(i.alternate,i);if(d!==null){d.flags&=32767,Ue=d;return}if(d=i.return,d!==null&&(d.flags|=32768,d.subtreeFlags=0,d.deletions=null),!l&&(i=i.sibling,i!==null)){Ue=i;return}Ue=i=d}while(i!==null);Rt=6,Ue=null}function ck(i,l,d,m,y,j,T,q,X){i.cancelPendingCommit=null;do Rf();while(Gt!==0);if((st&6)!==0)throw Error(s(327));if(l!==null){if(l===i.current)throw Error(s(177));if(j=l.lanes|l.childLanes,j|=eg,Am(i,d,j,T,q,X),i===ft&&(Ue=ft=null,Ge=0),Ko=l,ci=i,wr=d,lx=j,cx=y,Z2=m,(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,B8(an,function(){return pk(),null})):(i.callbackNode=null,i.callbackPriority=0),m=(l.flags&13878)!==0,(l.subtreeFlags&13878)!==0||m){m=$.T,$.T=null,y=V.p,V.p=2,T=st,st|=4;try{A8(i,l,d)}finally{st=T,V.p=y,$.T=m}}Gt=1,uk(),dk(),fk()}}function uk(){if(Gt===1){Gt=0;var i=ci,l=Ko,d=(l.flags&13878)!==0;if((l.subtreeFlags&13878)!==0||d){d=$.T,$.T=null;var m=V.p;V.p=2;var y=st;st|=4;try{U2(l,i);var j=Nx,T=Q_(i.containerInfo),q=j.focusedElem,X=j.selectionRange;if(T!==q&&q&&q.ownerDocument&&W_(q.ownerDocument.documentElement,q)){if(X!==null&&Wm(q)){var ae=X.start,ue=X.end;if(ue===void 0&&(ue=ae),"selectionStart"in q)q.selectionStart=ae,q.selectionEnd=Math.min(ue,q.value.length);else{var fe=q.ownerDocument||document,oe=fe&&fe.defaultView||window;if(oe.getSelection){var le=oe.getSelection(),we=q.textContent.length,Te=Math.min(X.start,we),dt=X.end===void 0?Te:Math.min(X.end,we);!le.extend&&Te>dt&&(T=dt,dt=Te,Te=T);var ne=Y_(q,Te),ee=Y_(q,dt);if(ne&&ee&&(le.rangeCount!==1||le.anchorNode!==ne.node||le.anchorOffset!==ne.offset||le.focusNode!==ee.node||le.focusOffset!==ee.offset)){var ie=fe.createRange();ie.setStart(ne.node,ne.offset),le.removeAllRanges(),Te>dt?(le.addRange(ie),le.extend(ee.node,ee.offset)):(ie.setEnd(ee.node,ee.offset),le.addRange(ie))}}}}for(fe=[],le=q;le=le.parentNode;)le.nodeType===1&&fe.push({element:le,left:le.scrollLeft,top:le.scrollTop});for(typeof q.focus=="function"&&q.focus(),q=0;q<fe.length;q++){var de=fe[q];de.element.scrollLeft=de.left,de.element.scrollTop=de.top}}zf=!!jx,Nx=jx=null}finally{st=y,V.p=m,$.T=d}}i.current=l,Gt=2}}function dk(){if(Gt===2){Gt=0;var i=ci,l=Ko,d=(l.flags&8772)!==0;if((l.subtreeFlags&8772)!==0||d){d=$.T,$.T=null;var m=V.p;V.p=2;var y=st;st|=4;try{$2(i,l.alternate,l)}finally{st=y,V.p=m,$.T=d}}Gt=3}}function fk(){if(Gt===4||Gt===3){Gt=0,bt();var i=ci,l=Ko,d=wr,m=Z2;(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?Gt=5:(Gt=0,Ko=ci=null,hk(i,i.pendingLanes));var y=i.pendingLanes;if(y===0&&(li=null),ic(d),l=l.stateNode,Ct&&typeof Ct.onCommitFiberRoot=="function")try{Ct.onCommitFiberRoot(on,l,void 0,(l.current.flags&128)===128)}catch{}if(m!==null){l=$.T,y=V.p,V.p=2,$.T=null;try{for(var j=i.onRecoverableError,T=0;T<m.length;T++){var q=m[T];j(q.value,{componentStack:q.stack})}}finally{$.T=l,V.p=y}}(wr&3)!==0&&Rf(),zs(i),y=i.pendingLanes,(d&261930)!==0&&(y&42)!==0?i===ux?$c++:($c=0,ux=i):$c=0,zc(0)}}function hk(i,l){(i.pooledCacheLanes&=l)===0&&(l=i.pooledCache,l!=null&&(i.pooledCache=null,bc(l)))}function Rf(){return uk(),dk(),fk(),pk()}function pk(){if(Gt!==5)return!1;var i=ci,l=lx;lx=0;var d=ic(wr),m=$.T,y=V.p;try{V.p=32>d?32:d,$.T=null,d=cx,cx=null;var j=ci,T=wr;if(Gt=0,Ko=ci=null,wr=0,(st&6)!==0)throw Error(s(331));var q=st;if(st|=4,W2(j.current),G2(j,j.current,T,d),st=q,zc(0,!1),Ct&&typeof Ct.onPostCommitFiberRoot=="function")try{Ct.onPostCommitFiberRoot(on,j)}catch{}return!0}finally{V.p=y,$.T=m,hk(i,l)}}function mk(i,l,d){l=rs(d,l),l=Fg(i.stateNode,l,2),i=ni(i,l,2),i!==null&&(ea(i,2),zs(i))}function lt(i,l,d){if(i.tag===3)mk(i,i,d);else for(;l!==null;){if(l.tag===3){mk(l,i,d);break}else if(l.tag===1){var m=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(li===null||!li.has(m))){i=rs(d,i),d=g2(2),m=ni(l,d,2),m!==null&&(x2(d,m,l,i),ea(m,2),zs(m));break}}l=l.return}}function hx(i,l,d){var m=i.pingCache;if(m===null){m=i.pingCache=new I8;var y=new Set;m.set(l,y)}else y=m.get(l),y===void 0&&(y=new Set,m.set(l,y));y.has(d)||(ix=!0,y.add(d),i=q8.bind(null,i,l,d),l.then(i,i))}function q8(i,l,d){var m=i.pingCache;m!==null&&m.delete(l),i.pingedLanes|=i.suspendedLanes&d,i.warmLanes&=~d,ft===i&&(Ge&d)===d&&(Rt===4||Rt===3&&(Ge&62914560)===Ge&&300>gt()-Sf?(st&2)===0&&Yo(i,0):ax|=d,Go===Ge&&(Go=0)),zs(i)}function gk(i,l){l===0&&(l=jd()),i=oa(i,l),i!==null&&(ea(i,l),zs(i))}function $8(i){var l=i.memoizedState,d=0;l!==null&&(d=l.retryLane),gk(i,d)}function z8(i,l){var d=0;switch(i.tag){case 31:case 13:var m=i.stateNode,y=i.memoizedState;y!==null&&(d=y.retryLane);break;case 19:m=i.stateNode;break;case 22:m=i.stateNode._retryCache;break;default:throw Error(s(314))}m!==null&&m.delete(l),gk(i,d)}function B8(i,l){return Tt(i,l)}var Ef=null,Qo=null,px=!1,Af=!1,mx=!1,di=0;function zs(i){i!==Qo&&i.next===null&&(Qo===null?Ef=Qo=i:Qo=Qo.next=i),Af=!0,px||(px=!0,H8())}function zc(i,l){if(!mx&&Af){mx=!0;do for(var d=!1,m=Ef;m!==null;){if(i!==0){var y=m.pendingLanes;if(y===0)var j=0;else{var T=m.suspendedLanes,q=m.pingedLanes;j=(1<<31-yn(42|i)+1)-1,j&=y&~(T&~q),j=j&201326741?j&201326741|1:j?j|2:0}j!==0&&(d=!0,bk(m,j))}else j=Ge,j=yo(m,m===ft?j:0,m.cancelPendingCommit!==null||m.timeoutHandle!==-1),(j&3)===0||Ji(m,j)||(d=!0,bk(m,j));m=m.next}while(d);mx=!1}}function F8(){xk()}function xk(){Af=px=!1;var i=0;di!==0&&J8()&&(i=di);for(var l=gt(),d=null,m=Ef;m!==null;){var y=m.next,j=vk(m,l);j===0?(m.next=null,d===null?Ef=y:d.next=y,y===null&&(Qo=d)):(d=m,(i!==0||(j&3)!==0)&&(Af=!0)),m=y}Gt!==0&&Gt!==5||zc(i),di!==0&&(di=0)}function vk(i,l){for(var d=i.suspendedLanes,m=i.pingedLanes,y=i.expirationTimes,j=i.pendingLanes&-62914561;0<j;){var T=31-yn(j),q=1<<T,X=y[T];X===-1?((q&d)===0||(q&m)!==0)&&(y[T]=Em(q,l)):X<=l&&(i.expiredLanes|=q),j&=~q}if(l=ft,d=Ge,d=yo(i,i===l?d:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),m=i.callbackNode,d===0||i===l&&(ot===2||ot===9)||i.cancelPendingCommit!==null)return m!==null&&m!==null&&rn(m),i.callbackNode=null,i.callbackPriority=0;if((d&3)===0||Ji(i,d)){if(l=d&-d,l===i.callbackPriority)return l;switch(m!==null&&rn(m),ic(d)){case 2:case 8:d=Ut;break;case 32:d=an;break;case 268435456:d=tr;break;default:d=an}return m=yk.bind(null,i),d=Tt(d,m),i.callbackPriority=l,i.callbackNode=d,l}return m!==null&&m!==null&&rn(m),i.callbackPriority=2,i.callbackNode=null,2}function yk(i,l){if(Gt!==0&&Gt!==5)return i.callbackNode=null,i.callbackPriority=0,null;var d=i.callbackNode;if(Rf()&&i.callbackNode!==d)return null;var m=Ge;return m=yo(i,i===ft?m:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),m===0?null:(ek(i,m,l),vk(i,gt()),i.callbackNode!=null&&i.callbackNode===d?yk.bind(null,i):null)}function bk(i,l){if(Rf())return null;ek(i,l,!0)}function H8(){tz(function(){(st&6)!==0?Tt(ht,F8):xk()})}function gx(){if(di===0){var i=Lo;i===0&&(i=go,go<<=1,(go&261888)===0&&(go=256)),di=i}return di}function wk(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:Dd(""+i)}function Sk(i,l){var d=l.ownerDocument.createElement("input");return d.name=l.name,d.value=l.value,i.id&&d.setAttribute("form",i.id),l.parentNode.insertBefore(d,l),i=new FormData(i),d.parentNode.removeChild(d),i}function U8(i,l,d,m,y){if(l==="submit"&&d&&d.stateNode===y){var j=wk((y[ln]||null).action),T=m.submitter;T&&(l=(l=T[ln]||null)?wk(l.formAction):T.getAttribute("formAction"),l!==null&&(j=l,T=null));var q=new Bd("action","action",null,m,y);i.push({event:q,listeners:[{instance:null,listener:function(){if(m.defaultPrevented){if(di!==0){var X=T?Sk(y,T):new FormData(y);Pg(d,{pending:!0,data:X,method:y.method,action:j},null,X)}}else typeof j=="function"&&(q.preventDefault(),X=T?Sk(y,T):new FormData(y),Pg(d,{pending:!0,data:X,method:y.method,action:j},j,X))},currentTarget:y}]})}}for(var xx=0;xx<Jm.length;xx++){var vx=Jm[xx],V8=vx.toLowerCase(),G8=vx[0].toUpperCase()+vx.slice(1);xs(V8,"on"+G8)}xs(J_,"onAnimationEnd"),xs(eC,"onAnimationIteration"),xs(tC,"onAnimationStart"),xs("dblclick","onDoubleClick"),xs("focusin","onFocus"),xs("focusout","onBlur"),xs(l8,"onTransitionRun"),xs(c8,"onTransitionStart"),xs(u8,"onTransitionCancel"),xs(nC,"onTransitionEnd"),Kr("onMouseEnter",["mouseout","mouseover"]),Kr("onMouseLeave",["mouseout","mouseover"]),Kr("onPointerEnter",["pointerout","pointerover"]),Kr("onPointerLeave",["pointerout","pointerover"]),rr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),rr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),rr("onBeforeInput",["compositionend","keypress","textInput","paste"]),rr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),rr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),rr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Bc="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),K8=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Bc));function jk(i,l){l=(l&4)!==0;for(var d=0;d<i.length;d++){var m=i[d],y=m.event;m=m.listeners;e:{var j=void 0;if(l)for(var T=m.length-1;0<=T;T--){var q=m[T],X=q.instance,ae=q.currentTarget;if(q=q.listener,X!==j&&y.isPropagationStopped())break e;j=q,y.currentTarget=ae;try{j(y)}catch(ue){Ud(ue)}y.currentTarget=null,j=X}else for(T=0;T<m.length;T++){if(q=m[T],X=q.instance,ae=q.currentTarget,q=q.listener,X!==j&&y.isPropagationStopped())break e;j=q,y.currentTarget=ae;try{j(y)}catch(ue){Ud(ue)}y.currentTarget=null,j=X}}}}function Ve(i,l){var d=l[bo];d===void 0&&(d=l[bo]=new Set);var m=i+"__bubble";d.has(m)||(Nk(l,i,2,!1),d.add(m))}function yx(i,l,d){var m=0;l&&(m|=4),Nk(d,i,m,l)}var Tf="_reactListening"+Math.random().toString(36).slice(2);function bx(i){if(!i[Tf]){i[Tf]=!0,Td.forEach(function(d){d!=="selectionchange"&&(K8.has(d)||yx(d,!1,i),yx(d,!0,i))});var l=i.nodeType===9?i:i.ownerDocument;l===null||l[Tf]||(l[Tf]=!0,yx("selectionchange",!1,l))}}function Nk(i,l,d,m){switch(Jk(l)){case 2:var y=wz;break;case 8:y=Sz;break;default:y=Lx}d=y.bind(null,l,d,i),y=void 0,!zm||l!=="touchstart"&&l!=="touchmove"&&l!=="wheel"||(y=!0),m?y!==void 0?i.addEventListener(l,d,{capture:!0,passive:y}):i.addEventListener(l,d,!0):y!==void 0?i.addEventListener(l,d,{passive:y}):i.addEventListener(l,d,!1)}function wx(i,l,d,m,y){var j=m;if((l&1)===0&&(l&2)===0&&m!==null)e:for(;;){if(m===null)return;var T=m.tag;if(T===3||T===4){var q=m.stateNode.containerInfo;if(q===y)break;if(T===4)for(T=m.return;T!==null;){var X=T.tag;if((X===3||X===4)&&T.stateNode.containerInfo===y)return;T=T.return}for(;q!==null;){if(T=Hr(q),T===null)return;if(X=T.tag,X===5||X===6||X===26||X===27){m=j=T;continue e}q=q.parentNode}}m=m.return}E_(function(){var ae=j,ue=qm(d),fe=[];e:{var oe=sC.get(i);if(oe!==void 0){var le=Bd,we=i;switch(i){case"keypress":if($d(d)===0)break e;case"keydown":case"keyup":le=z6;break;case"focusin":we="focus",le=Um;break;case"focusout":we="blur",le=Um;break;case"beforeblur":case"afterblur":le=Um;break;case"click":if(d.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":le=M_;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":le=R6;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":le=H6;break;case J_:case eC:case tC:le=T6;break;case nC:le=V6;break;case"scroll":case"scrollend":le=C6;break;case"wheel":le=K6;break;case"copy":case"cut":case"paste":le=I6;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":le=O_;break;case"toggle":case"beforetoggle":le=W6}var Te=(l&4)!==0,dt=!Te&&(i==="scroll"||i==="scrollend"),ne=Te?oe!==null?oe+"Capture":null:oe;Te=[];for(var ee=ae,ie;ee!==null;){var de=ee;if(ie=de.stateNode,de=de.tag,de!==5&&de!==26&&de!==27||ie===null||ne===null||(de=cc(ee,ne),de!=null&&Te.push(Fc(ee,de,ie))),dt)break;ee=ee.return}0<Te.length&&(oe=new le(oe,we,null,d,ue),fe.push({event:oe,listeners:Te}))}}if((l&7)===0){e:{if(oe=i==="mouseover"||i==="pointerover",le=i==="mouseout"||i==="pointerout",oe&&d!==Dm&&(we=d.relatedTarget||d.fromElement)&&(Hr(we)||we[sr]))break e;if((le||oe)&&(oe=ue.window===ue?ue:(oe=ue.ownerDocument)?oe.defaultView||oe.parentWindow:window,le?(we=d.relatedTarget||d.toElement,le=ae,we=we?Hr(we):null,we!==null&&(dt=o(we),Te=we.tag,we!==dt||Te!==5&&Te!==27&&Te!==6)&&(we=null)):(le=null,we=ae),le!==we)){if(Te=M_,de="onMouseLeave",ne="onMouseEnter",ee="mouse",(i==="pointerout"||i==="pointerover")&&(Te=O_,de="onPointerLeave",ne="onPointerEnter",ee="pointer"),dt=le==null?oe:Vr(le),ie=we==null?oe:Vr(we),oe=new Te(de,ee+"leave",le,d,ue),oe.target=dt,oe.relatedTarget=ie,de=null,Hr(ue)===ae&&(Te=new Te(ne,ee+"enter",we,d,ue),Te.target=ie,Te.relatedTarget=dt,de=Te),dt=de,le&&we)t:{for(Te=Y8,ne=le,ee=we,ie=0,de=ne;de;de=Te(de))ie++;de=0;for(var Re=ee;Re;Re=Te(Re))de++;for(;0<ie-de;)ne=Te(ne),ie--;for(;0<de-ie;)ee=Te(ee),de--;for(;ie--;){if(ne===ee||ee!==null&&ne===ee.alternate){Te=ne;break t}ne=Te(ne),ee=Te(ee)}Te=null}else Te=null;le!==null&&_k(fe,oe,le,Te,!1),we!==null&&dt!==null&&_k(fe,dt,we,Te,!0)}}e:{if(oe=ae?Vr(ae):window,le=oe.nodeName&&oe.nodeName.toLowerCase(),le==="select"||le==="input"&&oe.type==="file")var et=F_;else if(z_(oe))if(H_)et=i8;else{et=s8;var ke=n8}else le=oe.nodeName,!le||le.toLowerCase()!=="input"||oe.type!=="checkbox"&&oe.type!=="radio"?ae&&Pm(ae.elementType)&&(et=F_):et=r8;if(et&&(et=et(i,ae))){B_(fe,et,d,ue);break e}ke&&ke(i,oe,ae),i==="focusout"&&ae&&oe.type==="number"&&ae.memoizedProps.value!=null&&lc(oe,"number",oe.value)}switch(ke=ae?Vr(ae):window,i){case"focusin":(z_(ke)||ke.contentEditable==="true")&&(ko=ke,Qm=ae,xc=null);break;case"focusout":xc=Qm=ko=null;break;case"mousedown":Xm=!0;break;case"contextmenu":case"mouseup":case"dragend":Xm=!1,X_(fe,d,ue);break;case"selectionchange":if(o8)break;case"keydown":case"keyup":X_(fe,d,ue)}var $e;if(Gm)e:{switch(i){case"compositionstart":var Ke="onCompositionStart";break e;case"compositionend":Ke="onCompositionEnd";break e;case"compositionupdate":Ke="onCompositionUpdate";break e}Ke=void 0}else Co?q_(i,d)&&(Ke="onCompositionEnd"):i==="keydown"&&d.keyCode===229&&(Ke="onCompositionStart");Ke&&(L_&&d.locale!=="ko"&&(Co||Ke!=="onCompositionStart"?Ke==="onCompositionEnd"&&Co&&($e=A_()):(Wr=ue,Bm="value"in Wr?Wr.value:Wr.textContent,Co=!0)),ke=Mf(ae,Ke),0<ke.length&&(Ke=new I_(Ke,i,null,d,ue),fe.push({event:Ke,listeners:ke}),$e?Ke.data=$e:($e=$_(d),$e!==null&&(Ke.data=$e)))),($e=X6?Z6(i,d):J6(i,d))&&(Ke=Mf(ae,"onBeforeInput"),0<Ke.length&&(ke=new I_("onBeforeInput","beforeinput",null,d,ue),fe.push({event:ke,listeners:Ke}),ke.data=$e)),U8(fe,i,ae,d,ue)}jk(fe,l)})}function Fc(i,l,d){return{instance:i,listener:l,currentTarget:d}}function Mf(i,l){for(var d=l+"Capture",m=[];i!==null;){var y=i,j=y.stateNode;if(y=y.tag,y!==5&&y!==26&&y!==27||j===null||(y=cc(i,d),y!=null&&m.unshift(Fc(i,y,j)),y=cc(i,l),y!=null&&m.push(Fc(i,y,j))),i.tag===3)return m;i=i.return}return[]}function Y8(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function _k(i,l,d,m,y){for(var j=l._reactName,T=[];d!==null&&d!==m;){var q=d,X=q.alternate,ae=q.stateNode;if(q=q.tag,X!==null&&X===m)break;q!==5&&q!==26&&q!==27||ae===null||(X=ae,y?(ae=cc(d,j),ae!=null&&T.unshift(Fc(d,ae,X))):y||(ae=cc(d,j),ae!=null&&T.push(Fc(d,ae,X)))),d=d.return}T.length!==0&&i.push({event:l,listeners:T})}var W8=/\r\n?/g,Q8=/\u0000|\uFFFD/g;function Ck(i){return(typeof i=="string"?i:""+i).replace(W8,`
49
+ `).replace(Q8,"")}function kk(i,l){return l=Ck(l),Ck(i)===l}function ut(i,l,d,m,y,j){switch(d){case"children":typeof m=="string"?l==="body"||l==="textarea"&&m===""||jo(i,m):(typeof m=="number"||typeof m=="bigint")&&l!=="body"&&jo(i,""+m);break;case"className":So(i,"class",m);break;case"tabIndex":So(i,"tabindex",m);break;case"dir":case"role":case"viewBox":case"width":case"height":So(i,d,m);break;case"style":k_(i,m,j);break;case"data":if(l!=="object"){So(i,"data",m);break}case"src":case"href":if(m===""&&(l!=="a"||d!=="href")){i.removeAttribute(d);break}if(m==null||typeof m=="function"||typeof m=="symbol"||typeof m=="boolean"){i.removeAttribute(d);break}m=Dd(""+m),i.setAttribute(d,m);break;case"action":case"formAction":if(typeof m=="function"){i.setAttribute(d,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof j=="function"&&(d==="formAction"?(l!=="input"&&ut(i,l,"name",y.name,y,null),ut(i,l,"formEncType",y.formEncType,y,null),ut(i,l,"formMethod",y.formMethod,y,null),ut(i,l,"formTarget",y.formTarget,y,null)):(ut(i,l,"encType",y.encType,y,null),ut(i,l,"method",y.method,y,null),ut(i,l,"target",y.target,y,null)));if(m==null||typeof m=="symbol"||typeof m=="boolean"){i.removeAttribute(d);break}m=Dd(""+m),i.setAttribute(d,m);break;case"onClick":m!=null&&(i.onclick=ar);break;case"onScroll":m!=null&&Ve("scroll",i);break;case"onScrollEnd":m!=null&&Ve("scrollend",i);break;case"dangerouslySetInnerHTML":if(m!=null){if(typeof m!="object"||!("__html"in m))throw Error(s(61));if(d=m.__html,d!=null){if(y.children!=null)throw Error(s(60));i.innerHTML=d}}break;case"multiple":i.multiple=m&&typeof m!="function"&&typeof m!="symbol";break;case"muted":i.muted=m&&typeof m!="function"&&typeof m!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(m==null||typeof m=="function"||typeof m=="boolean"||typeof m=="symbol"){i.removeAttribute("xlink:href");break}d=Dd(""+m),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",d);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":m!=null&&typeof m!="function"&&typeof m!="symbol"?i.setAttribute(d,""+m):i.removeAttribute(d);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":m&&typeof m!="function"&&typeof m!="symbol"?i.setAttribute(d,""):i.removeAttribute(d);break;case"capture":case"download":m===!0?i.setAttribute(d,""):m!==!1&&m!=null&&typeof m!="function"&&typeof m!="symbol"?i.setAttribute(d,m):i.removeAttribute(d);break;case"cols":case"rows":case"size":case"span":m!=null&&typeof m!="function"&&typeof m!="symbol"&&!isNaN(m)&&1<=m?i.setAttribute(d,m):i.removeAttribute(d);break;case"rowSpan":case"start":m==null||typeof m=="function"||typeof m=="symbol"||isNaN(m)?i.removeAttribute(d):i.setAttribute(d,m);break;case"popover":Ve("beforetoggle",i),Ve("toggle",i),wo(i,"popover",m);break;case"xlinkActuate":gs(i,"http://www.w3.org/1999/xlink","xlink:actuate",m);break;case"xlinkArcrole":gs(i,"http://www.w3.org/1999/xlink","xlink:arcrole",m);break;case"xlinkRole":gs(i,"http://www.w3.org/1999/xlink","xlink:role",m);break;case"xlinkShow":gs(i,"http://www.w3.org/1999/xlink","xlink:show",m);break;case"xlinkTitle":gs(i,"http://www.w3.org/1999/xlink","xlink:title",m);break;case"xlinkType":gs(i,"http://www.w3.org/1999/xlink","xlink:type",m);break;case"xmlBase":gs(i,"http://www.w3.org/XML/1998/namespace","xml:base",m);break;case"xmlLang":gs(i,"http://www.w3.org/XML/1998/namespace","xml:lang",m);break;case"xmlSpace":gs(i,"http://www.w3.org/XML/1998/namespace","xml:space",m);break;case"is":wo(i,"is",m);break;case"innerText":case"textContent":break;default:(!(2<d.length)||d[0]!=="o"&&d[0]!=="O"||d[1]!=="n"&&d[1]!=="N")&&(d=N6.get(d)||d,wo(i,d,m))}}function Sx(i,l,d,m,y,j){switch(d){case"style":k_(i,m,j);break;case"dangerouslySetInnerHTML":if(m!=null){if(typeof m!="object"||!("__html"in m))throw Error(s(61));if(d=m.__html,d!=null){if(y.children!=null)throw Error(s(60));i.innerHTML=d}}break;case"children":typeof m=="string"?jo(i,m):(typeof m=="number"||typeof m=="bigint")&&jo(i,""+m);break;case"onScroll":m!=null&&Ve("scroll",i);break;case"onScrollEnd":m!=null&&Ve("scrollend",i);break;case"onClick":m!=null&&(i.onclick=ar);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Md.hasOwnProperty(d))e:{if(d[0]==="o"&&d[1]==="n"&&(y=d.endsWith("Capture"),l=d.slice(2,y?d.length-7:void 0),j=i[ln]||null,j=j!=null?j[d]:null,typeof j=="function"&&i.removeEventListener(l,j,y),typeof m=="function")){typeof j!="function"&&j!==null&&(d in i?i[d]=null:i.hasAttribute(d)&&i.removeAttribute(d)),i.addEventListener(l,m,y);break e}d in i?i[d]=m:m===!0?i.setAttribute(d,""):wo(i,d,m)}}}function tn(i,l,d){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ve("error",i),Ve("load",i);var m=!1,y=!1,j;for(j in d)if(d.hasOwnProperty(j)){var T=d[j];if(T!=null)switch(j){case"src":m=!0;break;case"srcSet":y=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,l));default:ut(i,l,j,T,d,null)}}y&&ut(i,l,"srcSet",d.srcSet,d,null),m&&ut(i,l,"src",d.src,d,null);return;case"input":Ve("invalid",i);var q=j=T=y=null,X=null,ae=null;for(m in d)if(d.hasOwnProperty(m)){var ue=d[m];if(ue!=null)switch(m){case"name":y=ue;break;case"type":T=ue;break;case"checked":X=ue;break;case"defaultChecked":ae=ue;break;case"value":j=ue;break;case"defaultValue":q=ue;break;case"children":case"dangerouslySetInnerHTML":if(ue!=null)throw Error(s(137,l));break;default:ut(i,l,m,ue,d,null)}}Pd(i,j,q,X,ae,T,y,!1);return;case"select":Ve("invalid",i),m=T=j=null;for(y in d)if(d.hasOwnProperty(y)&&(q=d[y],q!=null))switch(y){case"value":j=q;break;case"defaultValue":T=q;break;case"multiple":m=q;default:ut(i,l,y,q,d,null)}l=j,d=T,i.multiple=!!m,l!=null?ir(i,!!m,l,!1):d!=null&&ir(i,!!m,d,!0);return;case"textarea":Ve("invalid",i),j=y=m=null;for(T in d)if(d.hasOwnProperty(T)&&(q=d[T],q!=null))switch(T){case"value":m=q;break;case"defaultValue":y=q;break;case"children":j=q;break;case"dangerouslySetInnerHTML":if(q!=null)throw Error(s(91));break;default:ut(i,l,T,q,d,null)}__(i,m,y,j);return;case"option":for(X in d)if(d.hasOwnProperty(X)&&(m=d[X],m!=null))switch(X){case"selected":i.selected=m&&typeof m!="function"&&typeof m!="symbol";break;default:ut(i,l,X,m,d,null)}return;case"dialog":Ve("beforetoggle",i),Ve("toggle",i),Ve("cancel",i),Ve("close",i);break;case"iframe":case"object":Ve("load",i);break;case"video":case"audio":for(m=0;m<Bc.length;m++)Ve(Bc[m],i);break;case"image":Ve("error",i),Ve("load",i);break;case"details":Ve("toggle",i);break;case"embed":case"source":case"link":Ve("error",i),Ve("load",i);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ae in d)if(d.hasOwnProperty(ae)&&(m=d[ae],m!=null))switch(ae){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,l));default:ut(i,l,ae,m,d,null)}return;default:if(Pm(l)){for(ue in d)d.hasOwnProperty(ue)&&(m=d[ue],m!==void 0&&Sx(i,l,ue,m,d,void 0));return}}for(q in d)d.hasOwnProperty(q)&&(m=d[q],m!=null&&ut(i,l,q,m,d,null))}function X8(i,l,d,m){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var y=null,j=null,T=null,q=null,X=null,ae=null,ue=null;for(le in d){var fe=d[le];if(d.hasOwnProperty(le)&&fe!=null)switch(le){case"checked":break;case"value":break;case"defaultValue":X=fe;default:m.hasOwnProperty(le)||ut(i,l,le,null,m,fe)}}for(var oe in m){var le=m[oe];if(fe=d[oe],m.hasOwnProperty(oe)&&(le!=null||fe!=null))switch(oe){case"type":j=le;break;case"name":y=le;break;case"checked":ae=le;break;case"defaultChecked":ue=le;break;case"value":T=le;break;case"defaultValue":q=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(s(137,l));break;default:le!==fe&&ut(i,l,oe,le,m,fe)}}sa(i,T,q,X,ae,ue,j,y);return;case"select":le=T=q=oe=null;for(j in d)if(X=d[j],d.hasOwnProperty(j)&&X!=null)switch(j){case"value":break;case"multiple":le=X;default:m.hasOwnProperty(j)||ut(i,l,j,null,m,X)}for(y in m)if(j=m[y],X=d[y],m.hasOwnProperty(y)&&(j!=null||X!=null))switch(y){case"value":oe=j;break;case"defaultValue":q=j;break;case"multiple":T=j;default:j!==X&&ut(i,l,y,j,m,X)}l=q,d=T,m=le,oe!=null?ir(i,!!d,oe,!1):!!m!=!!d&&(l!=null?ir(i,!!d,l,!0):ir(i,!!d,d?[]:"",!1));return;case"textarea":le=oe=null;for(q in d)if(y=d[q],d.hasOwnProperty(q)&&y!=null&&!m.hasOwnProperty(q))switch(q){case"value":break;case"children":break;default:ut(i,l,q,null,m,y)}for(T in m)if(y=m[T],j=d[T],m.hasOwnProperty(T)&&(y!=null||j!=null))switch(T){case"value":oe=y;break;case"defaultValue":le=y;break;case"children":break;case"dangerouslySetInnerHTML":if(y!=null)throw Error(s(91));break;default:y!==j&&ut(i,l,T,y,m,j)}N_(i,oe,le);return;case"option":for(var we in d)if(oe=d[we],d.hasOwnProperty(we)&&oe!=null&&!m.hasOwnProperty(we))switch(we){case"selected":i.selected=!1;break;default:ut(i,l,we,null,m,oe)}for(X in m)if(oe=m[X],le=d[X],m.hasOwnProperty(X)&&oe!==le&&(oe!=null||le!=null))switch(X){case"selected":i.selected=oe&&typeof oe!="function"&&typeof oe!="symbol";break;default:ut(i,l,X,oe,m,le)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Te in d)oe=d[Te],d.hasOwnProperty(Te)&&oe!=null&&!m.hasOwnProperty(Te)&&ut(i,l,Te,null,m,oe);for(ae in m)if(oe=m[ae],le=d[ae],m.hasOwnProperty(ae)&&oe!==le&&(oe!=null||le!=null))switch(ae){case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(s(137,l));break;default:ut(i,l,ae,oe,m,le)}return;default:if(Pm(l)){for(var dt in d)oe=d[dt],d.hasOwnProperty(dt)&&oe!==void 0&&!m.hasOwnProperty(dt)&&Sx(i,l,dt,void 0,m,oe);for(ue in m)oe=m[ue],le=d[ue],!m.hasOwnProperty(ue)||oe===le||oe===void 0&&le===void 0||Sx(i,l,ue,oe,m,le);return}}for(var ne in d)oe=d[ne],d.hasOwnProperty(ne)&&oe!=null&&!m.hasOwnProperty(ne)&&ut(i,l,ne,null,m,oe);for(fe in m)oe=m[fe],le=d[fe],!m.hasOwnProperty(fe)||oe===le||oe==null&&le==null||ut(i,l,fe,oe,m,le)}function Rk(i){switch(i){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Z8(){if(typeof performance.getEntriesByType=="function"){for(var i=0,l=0,d=performance.getEntriesByType("resource"),m=0;m<d.length;m++){var y=d[m],j=y.transferSize,T=y.initiatorType,q=y.duration;if(j&&q&&Rk(T)){for(T=0,q=y.responseEnd,m+=1;m<d.length;m++){var X=d[m],ae=X.startTime;if(ae>q)break;var ue=X.transferSize,fe=X.initiatorType;ue&&Rk(fe)&&(X=X.responseEnd,T+=ue*(X<q?1:(q-ae)/(X-ae)))}if(--m,l+=8*(j+T)/(y.duration/1e3),i++,10<i)break}}if(0<i)return l/i/1e6}return navigator.connection&&(i=navigator.connection.downlink,typeof i=="number")?i:5}var jx=null,Nx=null;function If(i){return i.nodeType===9?i:i.ownerDocument}function Ek(i){switch(i){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Ak(i,l){if(i===0)switch(l){case"svg":return 1;case"math":return 2;default:return 0}return i===1&&l==="foreignObject"?0:i}function _x(i,l){return i==="textarea"||i==="noscript"||typeof l.children=="string"||typeof l.children=="number"||typeof l.children=="bigint"||typeof l.dangerouslySetInnerHTML=="object"&&l.dangerouslySetInnerHTML!==null&&l.dangerouslySetInnerHTML.__html!=null}var Cx=null;function J8(){var i=window.event;return i&&i.type==="popstate"?i===Cx?!1:(Cx=i,!0):(Cx=null,!1)}var Tk=typeof setTimeout=="function"?setTimeout:void 0,ez=typeof clearTimeout=="function"?clearTimeout:void 0,Mk=typeof Promise=="function"?Promise:void 0,tz=typeof queueMicrotask=="function"?queueMicrotask:typeof Mk<"u"?function(i){return Mk.resolve(null).then(i).catch(nz)}:Tk;function nz(i){setTimeout(function(){throw i})}function fi(i){return i==="head"}function Ik(i,l){var d=l,m=0;do{var y=d.nextSibling;if(i.removeChild(d),y&&y.nodeType===8)if(d=y.data,d==="/$"||d==="/&"){if(m===0){i.removeChild(y),el(l);return}m--}else if(d==="$"||d==="$?"||d==="$~"||d==="$!"||d==="&")m++;else if(d==="html")Hc(i.ownerDocument.documentElement);else if(d==="head"){d=i.ownerDocument.head,Hc(d);for(var j=d.firstChild;j;){var T=j.nextSibling,q=j.nodeName;j[ta]||q==="SCRIPT"||q==="STYLE"||q==="LINK"&&j.rel.toLowerCase()==="stylesheet"||d.removeChild(j),j=T}}else d==="body"&&Hc(i.ownerDocument.body);d=y}while(d);el(l)}function Ok(i,l){var d=i;i=0;do{var m=d.nextSibling;if(d.nodeType===1?l?(d._stashedDisplay=d.style.display,d.style.display="none"):(d.style.display=d._stashedDisplay||"",d.getAttribute("style")===""&&d.removeAttribute("style")):d.nodeType===3&&(l?(d._stashedText=d.nodeValue,d.nodeValue=""):d.nodeValue=d._stashedText||""),m&&m.nodeType===8)if(d=m.data,d==="/$"){if(i===0)break;i--}else d!=="$"&&d!=="$?"&&d!=="$~"&&d!=="$!"||i++;d=m}while(d)}function kx(i){var l=i.firstChild;for(l&&l.nodeType===10&&(l=l.nextSibling);l;){var d=l;switch(l=l.nextSibling,d.nodeName){case"HTML":case"HEAD":case"BODY":kx(d),ac(d);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(d.rel.toLowerCase()==="stylesheet")continue}i.removeChild(d)}}function sz(i,l,d,m){for(;i.nodeType===1;){var y=d;if(i.nodeName.toLowerCase()!==l.toLowerCase()){if(!m&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(m){if(!i[ta])switch(l){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(j=i.getAttribute("rel"),j==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(j!==y.rel||i.getAttribute("href")!==(y.href==null||y.href===""?null:y.href)||i.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin)||i.getAttribute("title")!==(y.title==null?null:y.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(j=i.getAttribute("src"),(j!==(y.src==null?null:y.src)||i.getAttribute("type")!==(y.type==null?null:y.type)||i.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin))&&j&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(l==="input"&&i.type==="hidden"){var j=y.name==null?null:""+y.name;if(y.type==="hidden"&&i.getAttribute("name")===j)return i}else return i;if(i=cs(i.nextSibling),i===null)break}return null}function rz(i,l,d){if(l==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!d||(i=cs(i.nextSibling),i===null))return null;return i}function Lk(i,l){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!l||(i=cs(i.nextSibling),i===null))return null;return i}function Rx(i){return i.data==="$?"||i.data==="$~"}function Ex(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function iz(i,l){var d=i.ownerDocument;if(i.data==="$~")i._reactRetry=l;else if(i.data!=="$?"||d.readyState!=="loading")l();else{var m=function(){l(),d.removeEventListener("DOMContentLoaded",m)};d.addEventListener("DOMContentLoaded",m),i._reactRetry=m}}function cs(i){for(;i!=null;i=i.nextSibling){var l=i.nodeType;if(l===1||l===3)break;if(l===8){if(l=i.data,l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"||l==="F!"||l==="F")break;if(l==="/$"||l==="/&")return null}}return i}var Ax=null;function Pk(i){i=i.nextSibling;for(var l=0;i;){if(i.nodeType===8){var d=i.data;if(d==="/$"||d==="/&"){if(l===0)return cs(i.nextSibling);l--}else d!=="$"&&d!=="$!"&&d!=="$?"&&d!=="$~"&&d!=="&"||l++}i=i.nextSibling}return null}function Dk(i){i=i.previousSibling;for(var l=0;i;){if(i.nodeType===8){var d=i.data;if(d==="$"||d==="$!"||d==="$?"||d==="$~"||d==="&"){if(l===0)return i;l--}else d!=="/$"&&d!=="/&"||l++}i=i.previousSibling}return null}function qk(i,l,d){switch(l=If(d),i){case"html":if(i=l.documentElement,!i)throw Error(s(452));return i;case"head":if(i=l.head,!i)throw Error(s(453));return i;case"body":if(i=l.body,!i)throw Error(s(454));return i;default:throw Error(s(451))}}function Hc(i){for(var l=i.attributes;l.length;)i.removeAttributeNode(l[0]);ac(i)}var us=new Map,$k=new Set;function Of(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var Sr=V.d;V.d={f:az,r:oz,D:lz,C:cz,L:uz,m:dz,X:hz,S:fz,M:pz};function az(){var i=Sr.f(),l=_f();return i||l}function oz(i){var l=Ur(i);l!==null&&l.tag===5&&l.type==="form"?n2(l):Sr.r(i)}var Xo=typeof document>"u"?null:document;function zk(i,l,d){var m=Xo;if(m&&typeof l=="string"&&l){var y=Rn(l);y='link[rel="'+i+'"][href="'+y+'"]',typeof d=="string"&&(y+='[crossorigin="'+d+'"]'),$k.has(y)||($k.add(y),i={rel:i,crossOrigin:d,href:l},m.querySelector(y)===null&&(l=m.createElement("link"),tn(l,"link",i),Lt(l),m.head.appendChild(l)))}}function lz(i){Sr.D(i),zk("dns-prefetch",i,null)}function cz(i,l){Sr.C(i,l),zk("preconnect",i,l)}function uz(i,l,d){Sr.L(i,l,d);var m=Xo;if(m&&i&&l){var y='link[rel="preload"][as="'+Rn(l)+'"]';l==="image"&&d&&d.imageSrcSet?(y+='[imagesrcset="'+Rn(d.imageSrcSet)+'"]',typeof d.imageSizes=="string"&&(y+='[imagesizes="'+Rn(d.imageSizes)+'"]')):y+='[href="'+Rn(i)+'"]';var j=y;switch(l){case"style":j=Zo(i);break;case"script":j=Jo(i)}us.has(j)||(i=g({rel:"preload",href:l==="image"&&d&&d.imageSrcSet?void 0:i,as:l},d),us.set(j,i),m.querySelector(y)!==null||l==="style"&&m.querySelector(Uc(j))||l==="script"&&m.querySelector(Vc(j))||(l=m.createElement("link"),tn(l,"link",i),Lt(l),m.head.appendChild(l)))}}function dz(i,l){Sr.m(i,l);var d=Xo;if(d&&i){var m=l&&typeof l.as=="string"?l.as:"script",y='link[rel="modulepreload"][as="'+Rn(m)+'"][href="'+Rn(i)+'"]',j=y;switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":j=Jo(i)}if(!us.has(j)&&(i=g({rel:"modulepreload",href:i},l),us.set(j,i),d.querySelector(y)===null)){switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(d.querySelector(Vc(j)))return}m=d.createElement("link"),tn(m,"link",i),Lt(m),d.head.appendChild(m)}}}function fz(i,l,d){Sr.S(i,l,d);var m=Xo;if(m&&i){var y=Gr(m).hoistableStyles,j=Zo(i);l=l||"default";var T=y.get(j);if(!T){var q={loading:0,preload:null};if(T=m.querySelector(Uc(j)))q.loading=5;else{i=g({rel:"stylesheet",href:i,"data-precedence":l},d),(d=us.get(j))&&Tx(i,d);var X=T=m.createElement("link");Lt(X),tn(X,"link",i),X._p=new Promise(function(ae,ue){X.onload=ae,X.onerror=ue}),X.addEventListener("load",function(){q.loading|=1}),X.addEventListener("error",function(){q.loading|=2}),q.loading|=4,Lf(T,l,m)}T={type:"stylesheet",instance:T,count:1,state:q},y.set(j,T)}}}function hz(i,l){Sr.X(i,l);var d=Xo;if(d&&i){var m=Gr(d).hoistableScripts,y=Jo(i),j=m.get(y);j||(j=d.querySelector(Vc(y)),j||(i=g({src:i,async:!0},l),(l=us.get(y))&&Mx(i,l),j=d.createElement("script"),Lt(j),tn(j,"link",i),d.head.appendChild(j)),j={type:"script",instance:j,count:1,state:null},m.set(y,j))}}function pz(i,l){Sr.M(i,l);var d=Xo;if(d&&i){var m=Gr(d).hoistableScripts,y=Jo(i),j=m.get(y);j||(j=d.querySelector(Vc(y)),j||(i=g({src:i,async:!0,type:"module"},l),(l=us.get(y))&&Mx(i,l),j=d.createElement("script"),Lt(j),tn(j,"link",i),d.head.appendChild(j)),j={type:"script",instance:j,count:1,state:null},m.set(y,j))}}function Bk(i,l,d,m){var y=(y=Q.current)?Of(y):null;if(!y)throw Error(s(446));switch(i){case"meta":case"title":return null;case"style":return typeof d.precedence=="string"&&typeof d.href=="string"?(l=Zo(d.href),d=Gr(y).hoistableStyles,m=d.get(l),m||(m={type:"style",instance:null,count:0,state:null},d.set(l,m)),m):{type:"void",instance:null,count:0,state:null};case"link":if(d.rel==="stylesheet"&&typeof d.href=="string"&&typeof d.precedence=="string"){i=Zo(d.href);var j=Gr(y).hoistableStyles,T=j.get(i);if(T||(y=y.ownerDocument||y,T={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},j.set(i,T),(j=y.querySelector(Uc(i)))&&!j._p&&(T.instance=j,T.state.loading=5),us.has(i)||(d={rel:"preload",as:"style",href:d.href,crossOrigin:d.crossOrigin,integrity:d.integrity,media:d.media,hrefLang:d.hrefLang,referrerPolicy:d.referrerPolicy},us.set(i,d),j||mz(y,i,d,T.state))),l&&m===null)throw Error(s(528,""));return T}if(l&&m!==null)throw Error(s(529,""));return null;case"script":return l=d.async,d=d.src,typeof d=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(l=Jo(d),d=Gr(y).hoistableScripts,m=d.get(l),m||(m={type:"script",instance:null,count:0,state:null},d.set(l,m)),m):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,i))}}function Zo(i){return'href="'+Rn(i)+'"'}function Uc(i){return'link[rel="stylesheet"]['+i+"]"}function Fk(i){return g({},i,{"data-precedence":i.precedence,precedence:null})}function mz(i,l,d,m){i.querySelector('link[rel="preload"][as="style"]['+l+"]")?m.loading=1:(l=i.createElement("link"),m.preload=l,l.addEventListener("load",function(){return m.loading|=1}),l.addEventListener("error",function(){return m.loading|=2}),tn(l,"link",d),Lt(l),i.head.appendChild(l))}function Jo(i){return'[src="'+Rn(i)+'"]'}function Vc(i){return"script[async]"+i}function Hk(i,l,d){if(l.count++,l.instance===null)switch(l.type){case"style":var m=i.querySelector('style[data-href~="'+Rn(d.href)+'"]');if(m)return l.instance=m,Lt(m),m;var y=g({},d,{"data-href":d.href,"data-precedence":d.precedence,href:null,precedence:null});return m=(i.ownerDocument||i).createElement("style"),Lt(m),tn(m,"style",y),Lf(m,d.precedence,i),l.instance=m;case"stylesheet":y=Zo(d.href);var j=i.querySelector(Uc(y));if(j)return l.state.loading|=4,l.instance=j,Lt(j),j;m=Fk(d),(y=us.get(y))&&Tx(m,y),j=(i.ownerDocument||i).createElement("link"),Lt(j);var T=j;return T._p=new Promise(function(q,X){T.onload=q,T.onerror=X}),tn(j,"link",m),l.state.loading|=4,Lf(j,d.precedence,i),l.instance=j;case"script":return j=Jo(d.src),(y=i.querySelector(Vc(j)))?(l.instance=y,Lt(y),y):(m=d,(y=us.get(j))&&(m=g({},d),Mx(m,y)),i=i.ownerDocument||i,y=i.createElement("script"),Lt(y),tn(y,"link",m),i.head.appendChild(y),l.instance=y);case"void":return null;default:throw Error(s(443,l.type))}else l.type==="stylesheet"&&(l.state.loading&4)===0&&(m=l.instance,l.state.loading|=4,Lf(m,d.precedence,i));return l.instance}function Lf(i,l,d){for(var m=d.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),y=m.length?m[m.length-1]:null,j=y,T=0;T<m.length;T++){var q=m[T];if(q.dataset.precedence===l)j=q;else if(j!==y)break}j?j.parentNode.insertBefore(i,j.nextSibling):(l=d.nodeType===9?d.head:d,l.insertBefore(i,l.firstChild))}function Tx(i,l){i.crossOrigin==null&&(i.crossOrigin=l.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=l.referrerPolicy),i.title==null&&(i.title=l.title)}function Mx(i,l){i.crossOrigin==null&&(i.crossOrigin=l.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=l.referrerPolicy),i.integrity==null&&(i.integrity=l.integrity)}var Pf=null;function Uk(i,l,d){if(Pf===null){var m=new Map,y=Pf=new Map;y.set(d,m)}else y=Pf,m=y.get(d),m||(m=new Map,y.set(d,m));if(m.has(i))return m;for(m.set(i,null),d=d.getElementsByTagName(i),y=0;y<d.length;y++){var j=d[y];if(!(j[ta]||j[Vt]||i==="link"&&j.getAttribute("rel")==="stylesheet")&&j.namespaceURI!=="http://www.w3.org/2000/svg"){var T=j.getAttribute(l)||"";T=i+T;var q=m.get(T);q?q.push(j):m.set(T,[j])}}return m}function Vk(i,l,d){i=i.ownerDocument||i,i.head.insertBefore(d,l==="title"?i.querySelector("head > title"):null)}function gz(i,l,d){if(d===1||l.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof l.precedence!="string"||typeof l.href!="string"||l.href==="")break;return!0;case"link":if(typeof l.rel!="string"||typeof l.href!="string"||l.href===""||l.onLoad||l.onError)break;switch(l.rel){case"stylesheet":return i=l.disabled,typeof l.precedence=="string"&&i==null;default:return!0}case"script":if(l.async&&typeof l.async!="function"&&typeof l.async!="symbol"&&!l.onLoad&&!l.onError&&l.src&&typeof l.src=="string")return!0}return!1}function Gk(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function xz(i,l,d,m){if(d.type==="stylesheet"&&(typeof m.media!="string"||matchMedia(m.media).matches!==!1)&&(d.state.loading&4)===0){if(d.instance===null){var y=Zo(m.href),j=l.querySelector(Uc(y));if(j){l=j._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(i.count++,i=Df.bind(i),l.then(i,i)),d.state.loading|=4,d.instance=j,Lt(j);return}j=l.ownerDocument||l,m=Fk(m),(y=us.get(y))&&Tx(m,y),j=j.createElement("link"),Lt(j);var T=j;T._p=new Promise(function(q,X){T.onload=q,T.onerror=X}),tn(j,"link",m),d.instance=j}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(d,l),(l=d.state.preload)&&(d.state.loading&3)===0&&(i.count++,d=Df.bind(i),l.addEventListener("load",d),l.addEventListener("error",d))}}var Ix=0;function vz(i,l){return i.stylesheets&&i.count===0&&$f(i,i.stylesheets),0<i.count||0<i.imgCount?function(d){var m=setTimeout(function(){if(i.stylesheets&&$f(i,i.stylesheets),i.unsuspend){var j=i.unsuspend;i.unsuspend=null,j()}},6e4+l);0<i.imgBytes&&Ix===0&&(Ix=62500*Z8());var y=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&$f(i,i.stylesheets),i.unsuspend)){var j=i.unsuspend;i.unsuspend=null,j()}},(i.imgBytes>Ix?50:800)+l);return i.unsuspend=d,function(){i.unsuspend=null,clearTimeout(m),clearTimeout(y)}}:null}function Df(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)$f(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var qf=null;function $f(i,l){i.stylesheets=null,i.unsuspend!==null&&(i.count++,qf=new Map,l.forEach(yz,i),qf=null,Df.call(i))}function yz(i,l){if(!(l.state.loading&4)){var d=qf.get(i);if(d)var m=d.get(null);else{d=new Map,qf.set(i,d);for(var y=i.querySelectorAll("link[data-precedence],style[data-precedence]"),j=0;j<y.length;j++){var T=y[j];(T.nodeName==="LINK"||T.getAttribute("media")!=="not all")&&(d.set(T.dataset.precedence,T),m=T)}m&&d.set(null,m)}y=l.instance,T=y.getAttribute("data-precedence"),j=d.get(T)||m,j===m&&d.set(null,y),d.set(T,y),this.count++,m=Df.bind(this),y.addEventListener("load",m),y.addEventListener("error",m),j?j.parentNode.insertBefore(y,j.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(y,i.firstChild)),l.state.loading|=4}}var Gc={$$typeof:k,Provider:null,Consumer:null,_currentValue:G,_currentValue2:G,_threadCount:0};function bz(i,l,d,m,y,j,T,q,X){this.tag=1,this.containerInfo=i,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=sc(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=sc(0),this.hiddenUpdates=sc(null),this.identifierPrefix=m,this.onUncaughtError=y,this.onCaughtError=j,this.onRecoverableError=T,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=X,this.incompleteTransitions=new Map}function Kk(i,l,d,m,y,j,T,q,X,ae,ue,fe){return i=new bz(i,l,d,T,X,ae,ue,fe,q),l=1,j===!0&&(l|=24),j=Un(3,null,null,l),i.current=j,j.stateNode=i,l=fg(),l.refCount++,i.pooledCache=l,l.refCount++,j.memoizedState={element:m,isDehydrated:d,cache:l},gg(j),i}function Yk(i){return i?(i=Ao,i):Ao}function Wk(i,l,d,m,y,j){y=Yk(y),m.context===null?m.context=y:m.pendingContext=y,m=ti(l),m.payload={element:d},j=j===void 0?null:j,j!==null&&(m.callback=j),d=ni(i,m,l),d!==null&&(On(d,i,l),Nc(d,i,l))}function Qk(i,l){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var d=i.retryLane;i.retryLane=d!==0&&d<l?d:l}}function Ox(i,l){Qk(i,l),(i=i.alternate)&&Qk(i,l)}function Xk(i){if(i.tag===13||i.tag===31){var l=oa(i,67108864);l!==null&&On(l,i,67108864),Ox(i,67108864)}}function Zk(i){if(i.tag===13||i.tag===31){var l=Wn();l=rc(l);var d=oa(i,l);d!==null&&On(d,i,l),Ox(i,l)}}var zf=!0;function wz(i,l,d,m){var y=$.T;$.T=null;var j=V.p;try{V.p=2,Lx(i,l,d,m)}finally{V.p=j,$.T=y}}function Sz(i,l,d,m){var y=$.T;$.T=null;var j=V.p;try{V.p=8,Lx(i,l,d,m)}finally{V.p=j,$.T=y}}function Lx(i,l,d,m){if(zf){var y=Px(m);if(y===null)wx(i,l,m,Bf,d),eR(i,m);else if(Nz(y,i,l,d,m))m.stopPropagation();else if(eR(i,m),l&4&&-1<jz.indexOf(i)){for(;y!==null;){var j=Ur(y);if(j!==null)switch(j.tag){case 3:if(j=j.stateNode,j.current.memoizedState.isDehydrated){var T=nr(j.pendingLanes);if(T!==0){var q=j;for(q.pendingLanes|=2,q.entangledLanes|=2;T;){var X=1<<31-yn(T);q.entanglements[1]|=X,T&=~X}zs(j),(st&6)===0&&(jf=gt()+500,zc(0))}}break;case 31:case 13:q=oa(j,2),q!==null&&On(q,j,2),_f(),Ox(j,2)}if(j=Px(m),j===null&&wx(i,l,m,Bf,d),j===y)break;y=j}y!==null&&m.stopPropagation()}else wx(i,l,m,null,d)}}function Px(i){return i=qm(i),Dx(i)}var Bf=null;function Dx(i){if(Bf=null,i=Hr(i),i!==null){var l=o(i);if(l===null)i=null;else{var d=l.tag;if(d===13){if(i=c(l),i!==null)return i;i=null}else if(d===31){if(i=u(l),i!==null)return i;i=null}else if(d===3){if(l.stateNode.current.memoizedState.isDehydrated)return l.tag===3?l.stateNode.containerInfo:null;i=null}else l!==i&&(i=null)}}return Bf=i,null}function Jk(i){switch(i){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Fe()){case ht:return 2;case Ut:return 8;case an:case po:return 32;case tr:return 268435456;default:return 32}default:return 32}}var qx=!1,hi=null,pi=null,mi=null,Kc=new Map,Yc=new Map,gi=[],jz="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function eR(i,l){switch(i){case"focusin":case"focusout":hi=null;break;case"dragenter":case"dragleave":pi=null;break;case"mouseover":case"mouseout":mi=null;break;case"pointerover":case"pointerout":Kc.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":Yc.delete(l.pointerId)}}function Wc(i,l,d,m,y,j){return i===null||i.nativeEvent!==j?(i={blockedOn:l,domEventName:d,eventSystemFlags:m,nativeEvent:j,targetContainers:[y]},l!==null&&(l=Ur(l),l!==null&&Xk(l)),i):(i.eventSystemFlags|=m,l=i.targetContainers,y!==null&&l.indexOf(y)===-1&&l.push(y),i)}function Nz(i,l,d,m,y){switch(l){case"focusin":return hi=Wc(hi,i,l,d,m,y),!0;case"dragenter":return pi=Wc(pi,i,l,d,m,y),!0;case"mouseover":return mi=Wc(mi,i,l,d,m,y),!0;case"pointerover":var j=y.pointerId;return Kc.set(j,Wc(Kc.get(j)||null,i,l,d,m,y)),!0;case"gotpointercapture":return j=y.pointerId,Yc.set(j,Wc(Yc.get(j)||null,i,l,d,m,y)),!0}return!1}function tR(i){var l=Hr(i.target);if(l!==null){var d=o(l);if(d!==null){if(l=d.tag,l===13){if(l=c(d),l!==null){i.blockedOn=l,Rd(i.priority,function(){Zk(d)});return}}else if(l===31){if(l=u(d),l!==null){i.blockedOn=l,Rd(i.priority,function(){Zk(d)});return}}else if(l===3&&d.stateNode.current.memoizedState.isDehydrated){i.blockedOn=d.tag===3?d.stateNode.containerInfo:null;return}}}i.blockedOn=null}function Ff(i){if(i.blockedOn!==null)return!1;for(var l=i.targetContainers;0<l.length;){var d=Px(i.nativeEvent);if(d===null){d=i.nativeEvent;var m=new d.constructor(d.type,d);Dm=m,d.target.dispatchEvent(m),Dm=null}else return l=Ur(d),l!==null&&Xk(l),i.blockedOn=d,!1;l.shift()}return!0}function nR(i,l,d){Ff(i)&&d.delete(l)}function _z(){qx=!1,hi!==null&&Ff(hi)&&(hi=null),pi!==null&&Ff(pi)&&(pi=null),mi!==null&&Ff(mi)&&(mi=null),Kc.forEach(nR),Yc.forEach(nR)}function Hf(i,l){i.blockedOn===l&&(i.blockedOn=null,qx||(qx=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,_z)))}var Uf=null;function sR(i){Uf!==i&&(Uf=i,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Uf===i&&(Uf=null);for(var l=0;l<i.length;l+=3){var d=i[l],m=i[l+1],y=i[l+2];if(typeof m!="function"){if(Dx(m||d)===null)continue;break}var j=Ur(d);j!==null&&(i.splice(l,3),l-=3,Pg(j,{pending:!0,data:y,method:d.method,action:m},m,y))}}))}function el(i){function l(X){return Hf(X,i)}hi!==null&&Hf(hi,i),pi!==null&&Hf(pi,i),mi!==null&&Hf(mi,i),Kc.forEach(l),Yc.forEach(l);for(var d=0;d<gi.length;d++){var m=gi[d];m.blockedOn===i&&(m.blockedOn=null)}for(;0<gi.length&&(d=gi[0],d.blockedOn===null);)tR(d),d.blockedOn===null&&gi.shift();if(d=(i.ownerDocument||i).$$reactFormReplay,d!=null)for(m=0;m<d.length;m+=3){var y=d[m],j=d[m+1],T=y[ln]||null;if(typeof j=="function")T||sR(d);else if(T){var q=null;if(j&&j.hasAttribute("formAction")){if(y=j,T=j[ln]||null)q=T.formAction;else if(Dx(y)!==null)continue}else q=T.action;typeof q=="function"?d[m+1]=q:(d.splice(m,3),m-=3),sR(d)}}}function rR(){function i(j){j.canIntercept&&j.info==="react-transition"&&j.intercept({handler:function(){return new Promise(function(T){return y=T})},focusReset:"manual",scroll:"manual"})}function l(){y!==null&&(y(),y=null),m||setTimeout(d,20)}function d(){if(!m&&!navigation.transition){var j=navigation.currentEntry;j&&j.url!=null&&navigation.navigate(j.url,{state:j.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var m=!1,y=null;return navigation.addEventListener("navigate",i),navigation.addEventListener("navigatesuccess",l),navigation.addEventListener("navigateerror",l),setTimeout(d,100),function(){m=!0,navigation.removeEventListener("navigate",i),navigation.removeEventListener("navigatesuccess",l),navigation.removeEventListener("navigateerror",l),y!==null&&(y(),y=null)}}}function $x(i){this._internalRoot=i}Vf.prototype.render=$x.prototype.render=function(i){var l=this._internalRoot;if(l===null)throw Error(s(409));var d=l.current,m=Wn();Wk(d,m,i,l,null,null)},Vf.prototype.unmount=$x.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var l=i.containerInfo;Wk(i.current,2,null,i,null,null),_f(),l[sr]=null}};function Vf(i){this._internalRoot=i}Vf.prototype.unstable_scheduleHydration=function(i){if(i){var l=kd();i={blockedOn:null,target:i,priority:l};for(var d=0;d<gi.length&&l!==0&&l<gi[d].priority;d++);gi.splice(d,0,i),d===0&&tR(i)}};var iR=t.version;if(iR!=="19.2.6")throw Error(s(527,iR,"19.2.6"));V.findDOMNode=function(i){var l=i._reactInternals;if(l===void 0)throw typeof i.render=="function"?Error(s(188)):(i=Object.keys(i).join(","),Error(s(268,i)));return i=h(l),i=i!==null?p(i):null,i=i===null?null:i.stateNode,i};var Cz={bundleType:0,version:"19.2.6",rendererPackageName:"react-dom",currentDispatcherRef:$,reconcilerVersion:"19.2.6"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Gf=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Gf.isDisabled&&Gf.supportsFiber)try{on=Gf.inject(Cz),Ct=Gf}catch{}}return Xc.createRoot=function(i,l){if(!r(i))throw Error(s(299));var d=!1,m="",y=f2,j=h2,T=p2;return l!=null&&(l.unstable_strictMode===!0&&(d=!0),l.identifierPrefix!==void 0&&(m=l.identifierPrefix),l.onUncaughtError!==void 0&&(y=l.onUncaughtError),l.onCaughtError!==void 0&&(j=l.onCaughtError),l.onRecoverableError!==void 0&&(T=l.onRecoverableError)),l=Kk(i,1,!1,null,null,d,m,null,y,j,T,rR),i[sr]=l.current,bx(i),new $x(l)},Xc.hydrateRoot=function(i,l,d){if(!r(i))throw Error(s(299));var m=!1,y="",j=f2,T=h2,q=p2,X=null;return d!=null&&(d.unstable_strictMode===!0&&(m=!0),d.identifierPrefix!==void 0&&(y=d.identifierPrefix),d.onUncaughtError!==void 0&&(j=d.onUncaughtError),d.onCaughtError!==void 0&&(T=d.onCaughtError),d.onRecoverableError!==void 0&&(q=d.onRecoverableError),d.formState!==void 0&&(X=d.formState)),l=Kk(i,1,!0,l,d??null,m,y,X,j,T,q,rR),l.context=Yk(null),d=l.current,m=Wn(),m=rc(m),y=ti(m),y.callback=null,ni(d,y,m),d=m,l.current.lanes=d,ea(l,d),zs(l),i[sr]=l.current,bx(i),new Vf(l)},Xc.version="19.2.6",Xc}var gR;function qz(){if(gR)return Hx.exports;gR=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Hx.exports=Dz(),Hx.exports}var $z=qz(),pl=typeof window<"u"?R.useLayoutEffect:R.useEffect;function Kx(e){const t=R.useRef({value:e,prev:null}),n=t.current.value;return e!==n&&(t.current={value:e,prev:n}),t.current.prev}function zz(e,t,n={},s={}){R.useEffect(()=>{if(!e.current||s.disabled||typeof IntersectionObserver!="function")return;const r=new IntersectionObserver(([o])=>{t(o)},n);return r.observe(e.current),()=>{r.disconnect()}},[t,n,s.disabled,e])}function Bz(e){const t=R.useRef(null);return R.useImperativeHandle(e,()=>t.current,[]),t}const Z4=!1;function Cu(e){return e[e.length-1]}function Fz(e){return typeof e=="function"}function qi(e,t){return Fz(e)?e(t):e}const J4=Object.prototype.hasOwnProperty,xR=Object.prototype.propertyIsEnumerable;function eO(e){for(const t in e)if(J4.call(e,t))return!0;return!1}const Hz=()=>Object.create(null),ba=(e,t)=>$i(e,t,Hz);function $i(e,t,n=()=>({}),s=0){if(e===t)return e;if(s>500)return t;const r=t,o=bR(e)&&bR(r);if(!o&&!($l(e)&&$l(r)))return r;const c=o?e:vR(e);if(!c)return r;const u=o?r:vR(r);if(!u)return r;const f=c.length,h=u.length,p=o?new Array(h):n();let g=0;for(let x=0;x<h;x++){const v=o?x:u[x],b=e[v],w=r[v];if(b===w){p[v]=b,(o?x<f:J4.call(e,v))&&g++;continue}if(b===null||w===null||typeof b!="object"||typeof w!="object"){p[v]=w;continue}const S=$i(b,w,n,s+1);p[v]=S,S===b&&g++}return f===h&&g===f?e:p}function vR(e){const t=Object.getOwnPropertyNames(e);for(const r of t)if(!xR.call(e,r))return!1;const n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;const s=t;for(const r of n){if(!xR.call(e,r))return!1;s.push(r)}return s}function $l(e){if(!yR(e))return!1;const t=e.constructor;if(typeof t>"u")return!0;const n=t.prototype;return!(!yR(n)||!n.hasOwnProperty("isPrototypeOf"))}function yR(e){return Object.prototype.toString.call(e)==="[object Object]"}function bR(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function za(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let s=0,r=e.length;s<r;s++)if(!za(e[s],t[s],n))return!1;return!0}if($l(e)&&$l(t)){const s=(n==null?void 0:n.ignoreUndefined)??!0;if(n!=null&&n.partial){for(const c in t)if((!s||t[c]!==void 0)&&!za(e[c],t[c],n))return!1;return!0}let r=0;if(!s)r=Object.keys(e).length;else for(const c in e)e[c]!==void 0&&r++;let o=0;for(const c in t)if((!s||t[c]!==void 0)&&(o++,o>r||!za(e[c],t[c],n)))return!1;return r===o}return!1}function zl(e){let t,n;const s=new Promise((r,o)=>{t=r,n=o});return s.status="pending",s.resolve=r=>{s.status="resolved",s.value=r,t(r),e==null||e(r)},s.reject=r=>{s.status="rejected",n(r)},s}function ku(e){return!!(e&&typeof e=="object"&&typeof e.then=="function")}function Uz(e){return e.replace(/[\x00-\x1f\x7f]/g,"")}function wR(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,n=>{try{return decodeURI(n)}catch{return n}})}return Uz(t)}const Vz=["http:","https:","mailto:","tel:"];function Qh(e,t){if(!e)return!1;try{const n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function Zc(e){if(!e)return{path:e,handledProtocolRelativeURL:!1};if(!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith("//"))return{path:e,handledProtocolRelativeURL:!1};const t=/%25|%5C/gi;let n=0,s="",r;for(;(r=t.exec(e))!==null;)s+=wR(e.slice(n,r.index))+r[0],n=t.lastIndex;s=s+wR(n?e.slice(n):e);let o=!1;return s.startsWith("//")&&(o=!0,s="/"+s.replace(/^\/+/,"")),{path:s,handledProtocolRelativeURL:o}}function Gz(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function Kz(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Or(){throw new Error("Invariant failed")}function Ru(e){const t=new Map;let n,s;const r=o=>{o.next&&(o.prev?(o.prev.next=o.next,o.next.prev=o.prev,o.next=void 0,s&&(s.next=o,o.prev=s)):(o.next.prev=void 0,n=o.next,o.next=void 0,s&&(o.prev=s,s.next=o)),s=o)};return{get(o){const c=t.get(o);if(c)return r(c),c.value},set(o,c){if(t.size>=e&&n){const f=n;t.delete(f.key),f.next&&(n=f.next,f.next.prev=void 0),f===s&&(s=void 0)}const u=t.get(o);if(u)u.value=c,r(u);else{const f={key:o,value:c,prev:s};s&&(s.next=f),s=f,n||(n=f),t.set(o,f)}},clear(){t.clear(),n=void 0,s=void 0}}}const zi=4,tO=5;function Yz(e){const t=e.indexOf("{");if(t===-1)return null;const n=e.indexOf("}",t);return n===-1||t+1>=e.length?null:[t,n]}function nO(e,t,n=new Uint16Array(6)){const s=e.indexOf("/",t),r=s===-1?e.length:s,o=e.substring(t,r);if(!o||!o.includes("$"))return n[0]=0,n[1]=t,n[2]=t,n[3]=r,n[4]=r,n[5]=r,n;if(o==="$"){const u=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=u,n[4]=u,n[5]=u,n}if(o.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=r,n[4]=r,n[5]=r,n;const c=Yz(o);if(c){const[u,f]=c,h=o.charCodeAt(u+1);if(h===45){if(u+2<o.length&&o.charCodeAt(u+2)===36){const p=u+3,g=f;if(p<g)return n[0]=3,n[1]=t+u,n[2]=t+p,n[3]=t+g,n[4]=t+f+1,n[5]=r,n}}else if(h===36){const p=u+1,g=u+2;return g===f?(n[0]=2,n[1]=t+u,n[2]=t+p,n[3]=t+g,n[4]=t+f+1,n[5]=e.length,n):(n[0]=1,n[1]=t+u,n[2]=t+g,n[3]=t+f,n[4]=t+f+1,n[5]=r,n)}}return n[0]=0,n[1]=t,n[2]=t,n[3]=r,n[4]=r,n[5]=r,n}function _p(e,t,n,s,r,o,c){var f,h,p,g,x,v,b,w;c==null||c(n);let u=s;{const S=n.fullPath??n.from,N=S.length,C=((f=n.options)==null?void 0:f.caseSensitive)??e,k=((p=(h=n.options)==null?void 0:h.params)==null?void 0:p.parse)??((g=n.options)==null?void 0:g.parseParams);for(;u<N;){const E=nO(S,u,t);let M;const A=u,O=E[5];switch(u=O+1,o++,E[0]){case 0:{const L=S.substring(E[2],E[3]);if(C){const P=(x=r.static)==null?void 0:x.get(L);if(P)M=P;else{r.static??(r.static=new Map);const I=Na(n.fullPath??n.from);I.parent=r,I.depth=o,M=I,r.static.set(L,I)}}else{const P=L.toLowerCase(),I=(v=r.staticInsensitive)==null?void 0:v.get(P);if(I)M=I;else{r.staticInsensitive??(r.staticInsensitive=new Map);const B=Na(n.fullPath??n.from);B.parent=r,B.depth=o,M=B,r.staticInsensitive.set(P,B)}}break}case 1:{const L=S.substring(A,E[1]),P=S.substring(E[4],O),I=C&&!!(L||P),B=L?I?L:L.toLowerCase():void 0,F=P?I?P:P.toLowerCase():void 0,z=!k&&((b=r.dynamic)==null?void 0:b.find(Y=>!Y.parse&&Y.caseSensitive===I&&Y.prefix===B&&Y.suffix===F));if(z)M=z;else{const Y=Wx(1,n.fullPath??n.from,I,B,F);M=Y,Y.depth=o,Y.parent=r,r.dynamic??(r.dynamic=[]),r.dynamic.push(Y)}break}case 3:{const L=S.substring(A,E[1]),P=S.substring(E[4],O),I=C&&!!(L||P),B=L?I?L:L.toLowerCase():void 0,F=P?I?P:P.toLowerCase():void 0,z=!k&&((w=r.optional)==null?void 0:w.find(Y=>!Y.parse&&Y.caseSensitive===I&&Y.prefix===B&&Y.suffix===F));if(z)M=z;else{const Y=Wx(3,n.fullPath??n.from,I,B,F);M=Y,Y.parent=r,Y.depth=o,r.optional??(r.optional=[]),r.optional.push(Y)}break}case 2:{const L=S.substring(A,E[1]),P=S.substring(E[4],O),I=C&&!!(L||P),B=L?I?L:L.toLowerCase():void 0,F=P?I?P:P.toLowerCase():void 0,z=Wx(2,n.fullPath??n.from,I,B,F);M=z,z.parent=r,z.depth=o,r.wildcard??(r.wildcard=[]),r.wildcard.push(z)}}r=M}if(k&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf("/")+1)===95){const E=Na(n.fullPath??n.from);E.kind=tO,E.parent=r,o++,E.depth=o,r.pathless??(r.pathless=[]),r.pathless.push(E),r=E}const _=(n.path||!n.children)&&!n.isRoot;if(_&&S.endsWith("/")){const E=Na(n.fullPath??n.from);E.kind=zi,E.parent=r,o++,E.depth=o,r.index=E,r=E}r.parse=k??null,_&&!r.route&&(r.route=n,r.fullPath=n.fullPath??n.from)}if(n.children)for(const S of n.children)_p(e,t,S,u,r,o,c)}function Yx(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function Ci(e){var t,n,s;if(e.pathless)for(const r of e.pathless)Ci(r);if(e.static)for(const r of e.static.values())Ci(r);if(e.staticInsensitive)for(const r of e.staticInsensitive.values())Ci(r);if((t=e.dynamic)!=null&&t.length){e.dynamic.sort(Yx);for(const r of e.dynamic)Ci(r)}if((n=e.optional)!=null&&n.length){e.optional.sort(Yx);for(const r of e.optional)Ci(r)}if((s=e.wildcard)!=null&&s.length){e.wildcard.sort(Yx);for(const r of e.wildcard)Ci(r)}}function Na(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null}}function Wx(e,t,n,s,r){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,caseSensitive:n,prefix:s,suffix:r}}function Wz(e,t){const n=Na("/"),s=new Uint16Array(6);for(const r of e)_p(!1,s,r,1,n,0);Ci(n),t.masksTree=n,t.flatCache=Ru(1e3)}function Qz(e,t){e||(e="/");const n=t.flatCache.get(e);if(n)return n;const s=pj(e,t.masksTree);return t.flatCache.set(e,s),s}function Xz(e,t,n,s,r){e||(e="/"),s||(s="/");const o=t?`case\0${e}`:e;let c=r.singleCache.get(o);return c||(c=Na("/"),_p(t,new Uint16Array(6),{from:e},1,c,0),r.singleCache.set(o,c)),pj(s,c,n)}function Zz(e,t,n=!1){const s=n?e:`nofuzz\0${e}`,r=t.matchCache.get(s);if(r!==void 0)return r;e||(e="/");let o;try{o=pj(e,t.segmentTree,n)}catch(c){if(c instanceof URIError)o=null;else throw c}return o&&(o.branch=rO(o.route)),t.matchCache.set(s,o),o}function Jz(e){return e==="/"?e:e.replace(/\/{1,}$/,"")}function e9(e,t=!1,n){const s=Na(e.fullPath),r=new Uint16Array(6),o={},c={};let u=0;return _p(t,r,e,1,s,0,f=>{if(n==null||n(f,u),f.id in o&&Or(),o[f.id]=f,u!==0&&f.path){const h=Jz(f.fullPath);(!c[h]||f.fullPath.endsWith("/"))&&(c[h]=f)}u++}),Ci(s),{processedTree:{segmentTree:s,singleCache:Ru(1e3),matchCache:Ru(1e3),flatCache:null,masksTree:null},routesById:o,routesByPath:c}}function pj(e,t,n=!1){const s=e.split("/"),r=n9(e,s,t,n);if(!r)return null;const[o]=sO(e,s,r);return{route:r.node.route,rawParams:o}}function sO(e,t,n){var p,g,x,v,b,w,S,N,C,k;const s=t9(n.node);let r=null;const o=Object.create(null);let c=((p=n.extract)==null?void 0:p.part)??0,u=((g=n.extract)==null?void 0:g.node)??0,f=((x=n.extract)==null?void 0:x.path)??0,h=((v=n.extract)==null?void 0:v.segment)??0;for(;u<s.length;c++,u++,f++,h++){const _=s[u];if(_.kind===zi)break;if(_.kind===tO){h--,c--,f--;continue}const E=t[c],M=f;if(E&&(f+=E.length),_.kind===1){r??(r=n.node.fullPath.split("/"));const A=r[h],O=((b=_.prefix)==null?void 0:b.length)??0;if(A.charCodeAt(O)===123){const L=((w=_.suffix)==null?void 0:w.length)??0,P=A.substring(O+2,A.length-L-1),I=E.substring(O,E.length-L);o[P]=decodeURIComponent(I)}else{const L=A.substring(1);o[L]=decodeURIComponent(E)}}else if(_.kind===3){if(n.skipped&1<<u){c--,f=M-1;continue}r??(r=n.node.fullPath.split("/"));const A=r[h],O=((S=_.prefix)==null?void 0:S.length)??0,L=((N=_.suffix)==null?void 0:N.length)??0,P=A.substring(O+3,A.length-L-1),I=_.suffix||_.prefix?E.substring(O,E.length-L):E;I&&(o[P]=decodeURIComponent(I))}else if(_.kind===2){const A=_,O=e.substring(M+(((C=A.prefix)==null?void 0:C.length)??0),e.length-(((k=A.suffix)==null?void 0:k.length)??0)),L=decodeURIComponent(O);o["*"]=L,o._splat=L;break}}return n.rawParams&&Object.assign(o,n.rawParams),[o,{part:c,node:u,path:f,segment:h}]}function rO(e){const t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function t9(e){const t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function n9(e,t,n,s){if(e==="/"&&n.index)return{node:n.index,skipped:0};const r=!Cu(t),o=r&&e!=="/",c=t.length-(r?1:0),u=[{node:n,index:1,skipped:0,depth:1,statics:0,dynamics:0,optionals:0}];let f=null,h=null;for(;u.length;){const p=u.pop(),{node:g,index:x,skipped:v,depth:b,statics:w,dynamics:S,optionals:N}=p;let{extract:C,rawParams:k}=p;if(g.kind===2&&g.route&&!Qf(h,p))continue;if(g.parse){if(!SR(e,t,p))continue;k=p.rawParams,C=p.extract}s&&g.route&&g.kind!==zi&&Qf(f,p)&&(f=p);const _=x===c;if(_&&(g.route&&(!o||g.kind===zi||g.kind===2)&&Qf(h,p)&&(h=p),!g.optional&&!g.wildcard&&!g.index&&!g.pathless))continue;const E=_?void 0:t[x];let M;if(_&&g.index){const A={node:g.index,index:x,skipped:v,depth:b+1,statics:w,dynamics:S,optionals:N,extract:C,rawParams:k};let O=!0;if(g.index.parse&&(SR(e,t,A)||(O=!1)),O){if(!S&&!N&&!v&&s9(w,c))return A;Qf(h,A)&&(h=A)}}if(g.wildcard)for(let A=g.wildcard.length-1;A>=0;A--){const O=g.wildcard[A],{prefix:L,suffix:P}=O;if(!(L&&(_||!(O.caseSensitive?E:M??(M=E.toLowerCase())).startsWith(L)))){if(P){if(_)continue;const I=t.slice(x).join("/").slice(-P.length);if((O.caseSensitive?I:I.toLowerCase())!==P)continue}u.push({node:O,index:c,skipped:v,depth:b+1,statics:w,dynamics:S,optionals:N,extract:C,rawParams:k})}}if(g.optional){const A=v|1<<b,O=b+1;for(let L=g.optional.length-1;L>=0;L--){const P=g.optional[L];u.push({node:P,index:x,skipped:A,depth:O,statics:w,dynamics:S,optionals:N,extract:C,rawParams:k})}if(!_)for(let L=g.optional.length-1;L>=0;L--){const P=g.optional[L],{prefix:I,suffix:B}=P;if(I||B){const F=P.caseSensitive?E:M??(M=E.toLowerCase());if(I&&!F.startsWith(I)||B&&!F.endsWith(B))continue}u.push({node:P,index:x+1,skipped:v,depth:O,statics:w,dynamics:S,optionals:N+Wf(c,x),extract:C,rawParams:k})}}if(!_&&g.dynamic&&E)for(let A=g.dynamic.length-1;A>=0;A--){const O=g.dynamic[A],{prefix:L,suffix:P}=O;if(L||P){const I=O.caseSensitive?E:M??(M=E.toLowerCase());if(L&&!I.startsWith(L)||P&&!I.endsWith(P))continue}u.push({node:O,index:x+1,skipped:v,depth:b+1,statics:w,dynamics:S+Wf(c,x),optionals:N,extract:C,rawParams:k})}if(!_&&g.staticInsensitive){const A=g.staticInsensitive.get(M??(M=E.toLowerCase()));A&&u.push({node:A,index:x+1,skipped:v,depth:b+1,statics:w+Wf(c,x),dynamics:S,optionals:N,extract:C,rawParams:k})}if(!_&&g.static){const A=g.static.get(E);A&&u.push({node:A,index:x+1,skipped:v,depth:b+1,statics:w+Wf(c,x),dynamics:S,optionals:N,extract:C,rawParams:k})}if(g.pathless){const A=b+1;for(let O=g.pathless.length-1;O>=0;O--){const L=g.pathless[O];u.push({node:L,index:x,skipped:v,depth:A,statics:w,dynamics:S,optionals:N,extract:C,rawParams:k})}}}if(h)return h;if(s&&f){let p=f.index;for(let x=0;x<f.index;x++)p+=t[x].length;const g=p===e.length?"/":e.slice(p);return f.rawParams??(f.rawParams=Object.create(null)),f.rawParams["**"]=decodeURIComponent(g),f}return null}function Wf(e,t){return 2**(e-t-1)}function s9(e,t){return e===2**(t-1)-1}function SR(e,t,n){let s,r;try{[s,r]=sO(e,t,n)}catch{return null}if(n.rawParams=s,n.extract=r,!n.node.parse)return!0;try{if(n.node.parse(s)===!1)return null}catch{}return!0}function Qf(e,t){return e?t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===zi)>(e.node.kind===zi)||t.node.kind===zi==(e.node.kind===zi)&&t.depth>e.depth))):!0}function Oh(e){return mj(e.filter(t=>t!==void 0).join("/"))}function mj(e){return e.replace(/\/{2,}/g,"/")}function iO(e){return e==="/"?e:e.replace(/^\/{1,}/,"")}function Mr(e){const t=e.length;return t>1&&e[t-1]==="/"?e.replace(/\/{1,}$/,""):e}function aO(e){return Mr(iO(e))}function Xh(e,t){return e!=null&&e.endsWith("/")&&e!=="/"&&e!==`${t}/`?e.slice(0,-1):e}function r9(e,t,n){return Xh(e,n)===Xh(t,n)}function i9({base:e,to:t,trailingSlash:n="never",cache:s}){const r=t.startsWith("/"),o=!r&&t===".";let c;if(s){c=r?t:o?e:e+"\0"+t;const h=s.get(c);if(h)return h}let u;if(o)u=e.split("/");else if(r)u=t.split("/");else{for(u=e.split("/");u.length>1&&Cu(u)==="";)u.pop();const h=t.split("/");for(let p=0,g=h.length;p<g;p++){const x=h[p];x===""?p?p===g-1&&u.push(x):u=[x]:x===".."?u.pop():x==="."||u.push(x)}}u.length>1&&(Cu(u)===""?n==="never"&&u.pop():n==="always"&&u.push(""));const f=mj(u.join("/"))||"/";return c&&s&&s.set(c,f),f}function a9(e){const t=new Map(e.map(r=>[encodeURIComponent(r),r])),n=Array.from(t.keys()).map(r=>r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),s=new RegExp(n,"g");return r=>r.replace(s,o=>t.get(o)??o)}function Qx(e,t,n){const s=t[e];return typeof s!="string"?s:e==="_splat"?/^[a-zA-Z0-9\-._~!/]*$/.test(s)?s:s.split("/").map(r=>NR(r,n)).join("/"):NR(s,n)}function jR({path:e,params:t,decoder:n,...s}){let r=!1;const o=Object.create(null);if(!e||e==="/")return{interpolatedPath:"/",usedParams:o,isMissingParams:r};if(!e.includes("$"))return{interpolatedPath:e,usedParams:o,isMissingParams:r};const c=e.length;let u=0,f,h="";for(;u<c;){const p=u;f=nO(e,p,f);const g=f[5];if(u=g+1,p===g)continue;const x=f[0];if(x===0){h+="/"+e.substring(p,g);continue}if(x===2){const v=t._splat;o._splat=v,o["*"]=v;const b=e.substring(p,f[1]),w=e.substring(f[4],g);if(!v){r=!0,(b||w)&&(h+="/"+b+w);continue}const S=Qx("_splat",t,n);h+="/"+b+S+w;continue}if(x===1){const v=e.substring(f[2],f[3]);!r&&!(v in t)&&(r=!0),o[v]=t[v];const b=e.substring(p,f[1]),w=e.substring(f[4],g),S=Qx(v,t,n)??"undefined";h+="/"+b+S+w;continue}if(x===3){const v=e.substring(f[2],f[3]),b=t[v];if(b==null)continue;o[v]=b;const w=e.substring(p,f[1]),S=e.substring(f[4],g),N=Qx(v,t,n)??"";h+="/"+w+N+S;continue}}return e.endsWith("/")&&(h+="/"),{usedParams:o,interpolatedPath:h||"/",isMissingParams:r}}function NR(e,t){const n=encodeURIComponent(e);return(t==null?void 0:t(n))??n}function mn(e){return(e==null?void 0:e.isNotFound)===!0}function o9(){try{return typeof window<"u"&&typeof window.sessionStorage=="object"?window.sessionStorage:void 0}catch{return}}const l9="tsr-scroll-restoration-v1_3";function c9(){const e=o9();if(!e)return null;let t={};try{const s=JSON.parse(e.getItem("tsr-scroll-restoration-v1_3")||"{}");$l(s)&&(t=s)}catch{}return{get state(){return t},set:s=>{t=qi(s,t)||t},persist:()=>{try{e.setItem(l9,JSON.stringify(t))}catch{}}}}const _R=c9(),u9=e=>e.state.__TSR_key||e.href;function d9(e){const t=[];let n;for(;n=e.parentNode;)t.push(`${e.tagName}:nth-child(${Array.prototype.indexOf.call(n.children,e)+1})`),e=n;return`${t.reverse().join(" > ")}`.toLowerCase()}let Xf=!1;const Jc="window",CR="data-scroll-restoration-id";function f9(e,t){if(!_R)return;const n=_R;if((e.options.scrollRestoration??!1)&&(e.isScrollRestoring=!0),e.isScrollRestorationSetup||!n)return;e.isScrollRestorationSetup=!0,Xf=!1;const s=e.options.getScrollRestorationKey||u9,r=new Map;window.history.scrollRestoration="manual";const o=u=>{if(!(Xf||!e.isScrollRestoring))if(u.target===document||u.target===window)r.set(Jc,{scrollX:window.scrollX||0,scrollY:window.scrollY||0});else{const f=u.target;r.set(f,{scrollX:f.scrollLeft||0,scrollY:f.scrollTop||0})}},c=u=>{var h;if(!e.isScrollRestoring||!u||r.size===0||!n)return;const f=(h=n.state)[u]||(h[u]={});for(const[p,g]of r){let x;if(p===Jc)x=Jc;else if(p.isConnected){const v=p.getAttribute(CR);x=v?`[${CR}="${v}"]`:d9(p)}x&&(f[x]=g)}};document.addEventListener("scroll",o,!0),e.subscribe("onBeforeLoad",u=>{c(u.fromLocation?s(u.fromLocation):void 0),r.clear()}),window.addEventListener("pagehide",()=>{c(s(e.stores.resolvedLocation.get()??e.stores.location.get())),n.persist()}),e.subscribe("onRendered",u=>{var g;const f=s(u.toLocation),h=e.options.scrollRestorationBehavior,p=e.options.scrollToTopSelectors;if(r.clear(),!e.resetNextScroll){e.resetNextScroll=!0;return}if(!(typeof e.options.scrollRestoration=="function"&&!e.options.scrollRestoration({location:e.latestLocation}))){Xf=!0;try{const x=e.isScrollRestoring?n.state[f]:void 0;let v=!1;if(x)for(const b in x){const w=x[b];if(!$l(w))continue;const{scrollX:S,scrollY:N}=w;if(!(!Number.isFinite(S)||!Number.isFinite(N))){if(b===Jc)window.scrollTo({top:N,left:S,behavior:h}),v=!0;else if(b){let C;try{C=document.querySelector(b)}catch{continue}C&&(C.scrollLeft=S,C.scrollTop=N,v=!0)}}}if(!v){const b=e.history.location.hash.slice(1);if(b){const w=((g=window.history.state)==null?void 0:g.__hashScrollIntoViewOptions)??!0;if(w){const S=document.getElementById(b);S&&S.scrollIntoView(w)}}else{const w={top:0,left:0,behavior:h};if(window.scrollTo(w),p)for(const S of p){if(S===Jc)continue;const N=typeof S=="function"?S():document.querySelector(S);N&&N.scrollTo(w)}}}}finally{Xf=!1}e.isScrollRestoring&&n.set(x=>(x[f]||(x[f]={}),x))}})}function h9(e,t=String){const n=new URLSearchParams;for(const s in e){const r=e[s];r!==void 0&&n.set(s,t(r))}return n.toString()}function Xx(e){return e?e==="false"?!1:e==="true"?!0:+e*0===0&&+e+""===e?+e:e:""}function p9(e){const t=new URLSearchParams(e),n=Object.create(null);for(const[s,r]of t.entries()){const o=n[s];o==null?n[s]=Xx(r):Array.isArray(o)?o.push(Xx(r)):n[s]=[o,Xx(r)]}return n}const m9=x9(JSON.parse),g9=v9(JSON.stringify,JSON.parse);function x9(e){return t=>{t[0]==="?"&&(t=t.substring(1));const n=p9(t);for(const s in n){const r=n[s];if(typeof r=="string")try{n[s]=e(r)}catch{}}return n}}function v9(e,t){const n=typeof t=="function";function s(r){if(typeof r=="object"&&r!==null)try{return e(r)}catch{}else if(n&&typeof r=="string")try{return t(r),e(r)}catch{}return r}return r=>{const o=h9(r,s);return o?`?${o}`:""}}const Ba="__root__";function y9(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&!e.reloadDocument&&typeof e.href=="string")try{new URL(e.href),e.reloadDocument=!0}catch{}const t=new Headers(e.headers);e.href&&t.get("Location")===null&&t.set("Location",e.href);const n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function qn(e){return e instanceof Response&&!!e.options}function b9(e){return{input:({url:t})=>{for(const n of e)t=oS(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=oO(e[n],t);return t}}}function w9(e){const t=aO(e.basepath),n=`/${t}`,s=`${n}/`,r=e.caseSensitive?n:n.toLowerCase(),o=e.caseSensitive?s:s.toLowerCase();return{input:({url:c})=>{const u=e.caseSensitive?c.pathname:c.pathname.toLowerCase();return u===r?c.pathname="/":u.startsWith(o)&&(c.pathname=c.pathname.slice(n.length)),c},output:({url:c})=>(c.pathname=Oh(["/",t,c.pathname]),c)}}function oS(e,t){var s;const n=(s=e==null?void 0:e.input)==null?void 0:s.call(e,{url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function oO(e,t){var s;const n=(s=e==null?void 0:e.output)==null?void 0:s.call(e,{url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function S9(e,t){const{createMutableStore:n,createReadonlyStore:s,batch:r,init:o}=t,c=new Map,u=new Map,f=new Map,h=n(e.status),p=n(e.loadedAt),g=n(e.isLoading),x=n(e.isTransitioning),v=n(e.location),b=n(e.resolvedLocation),w=n(e.statusCode),S=n(e.redirect),N=n([]),C=n([]),k=n([]),_=s(()=>Zx(c,N.get())),E=s(()=>Zx(u,C.get())),M=s(()=>Zx(f,k.get())),A=s(()=>N.get()[0]),O=s(()=>N.get().some(V=>{var G;return((G=c.get(V))==null?void 0:G.get().status)==="pending"})),L=s(()=>{var V;return{locationHref:v.get().href,resolvedLocationHref:(V=b.get())==null?void 0:V.href,status:h.get()}}),P=s(()=>({status:h.get(),loadedAt:p.get(),isLoading:g.get(),isTransitioning:x.get(),matches:_.get(),location:v.get(),resolvedLocation:b.get(),statusCode:w.get(),redirect:S.get()})),I=Ru(64);function B(V){let G=I.get(V);return G||(G=s(()=>{const Z=N.get();for(const J of Z){const D=c.get(J);if(D&&D.routeId===V)return D.get()}}),I.set(V,G)),G}const F={status:h,loadedAt:p,isLoading:g,isTransitioning:x,location:v,resolvedLocation:b,statusCode:w,redirect:S,matchesId:N,pendingIds:C,cachedIds:k,matches:_,pendingMatches:E,cachedMatches:M,firstId:A,hasPending:O,matchRouteDeps:L,matchStores:c,pendingMatchStores:u,cachedMatchStores:f,__store:P,getRouteMatchStore:B,setMatches:z,setPending:Y,setCached:$};z(e.matches),o==null||o(F);function z(V){Jx(V,c,N,n,r)}function Y(V){Jx(V,u,C,n,r)}function $(V){Jx(V,f,k,n,r)}return F}function Zx(e,t){const n=[];for(const s of t){const r=e.get(s);r&&n.push(r.get())}return n}function Jx(e,t,n,s,r){const o=e.map(u=>u.id),c=new Set(o);r(()=>{for(const u of t.keys())c.has(u)||t.delete(u);for(const u of e){const f=t.get(u.id);if(!f){const h=s(u);h.routeId=u.routeId,t.set(u.id,h);continue}f.routeId=u.routeId,f.get()!==u&&f.set(u)}Kz(n.get(),o)||n.set(o)})}const lS=e=>{var t;if(!e.rendered)return e.rendered=!0,(t=e.onReady)==null?void 0:t.call(e)},j9=e=>e.stores.matchesId.get().some(t=>{var n;return(n=e.stores.matchStores.get(t))==null?void 0:n.get()._forcePending}),Cp=(e,t)=>!!(e.preload&&!e.router.stores.matchStores.has(t)),Fa=(e,t,n=!0)=>{const s={...e.router.options.context??{}},r=n?t:t-1;for(let o=0;o<=r;o++){const c=e.matches[o];if(!c)continue;const u=e.router.getMatch(c.id);u&&Object.assign(s,u.__routeContext,u.__beforeLoadContext)}return s},kR=(e,t)=>{if(!e.matches.length)return;const n=t.routeId,s=e.matches.findIndex(c=>c.routeId===e.router.routeTree.id),r=s>=0?s:0;let o=n?e.matches.findIndex(c=>c.routeId===n):e.firstBadMatchIndex??e.matches.length-1;o<0&&(o=r);for(let c=o;c>=0;c--){const u=e.matches[c];if(e.router.looseRoutesById[u.routeId].options.notFoundComponent)return c}return n?o:r},Bi=(e,t,n)=>{var s,r,o;if(!(!qn(n)&&!mn(n)))throw qn(n)&&n.redirectHandled&&!n.options.reloadDocument||(t&&((s=t._nonReactive.beforeLoadPromise)==null||s.resolve(),(r=t._nonReactive.loaderPromise)==null||r.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0,t._nonReactive.error=n,e.updateMatch(t.id,c=>({...c,status:qn(n)?"redirected":mn(n)?"notFound":c.status==="pending"?"success":c.status,context:Fa(e,t.index),isFetching:!1,error:n})),mn(n)&&!n.routeId&&(n.routeId=t.routeId),(o=t._nonReactive.loadPromise)==null||o.resolve()),qn(n)&&(e.rendered=!0,n.options._fromLocation=e.location,n.redirectHandled=!0,n=e.router.resolveRedirect(n))),n},lO=(e,t)=>{const n=e.router.getMatch(t);return!!(!n||n._nonReactive.dehydrated)},RR=(e,t,n)=>{const s=Fa(e,n);e.updateMatch(t,r=>({...r,context:s}))},eu=(e,t,n,s)=>{var u,f;const{id:r,routeId:o}=e.matches[t],c=e.router.looseRoutesById[o];if(n instanceof Promise)throw n;n.routerCode=s,e.firstBadMatchIndex??(e.firstBadMatchIndex=t),Bi(e,e.router.getMatch(r),n);try{(f=(u=c.options).onError)==null||f.call(u,n)}catch(h){n=h,Bi(e,e.router.getMatch(r),n)}e.updateMatch(r,h=>{var p,g;return(p=h._nonReactive.beforeLoadPromise)==null||p.resolve(),h._nonReactive.beforeLoadPromise=void 0,(g=h._nonReactive.loadPromise)==null||g.resolve(),{...h,error:n,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController}}),!e.preload&&!qn(n)&&!mn(n)&&(e.serialError??(e.serialError=n))},cO=(e,t,n,s)=>{var o;if(s._nonReactive.pendingTimeout!==void 0)return;const r=n.options.pendingMs??e.router.options.defaultPendingMs;if(e.onReady&&!Cp(e,t)&&(n.options.loader||n.options.beforeLoad||dO(n))&&typeof r=="number"&&r!==1/0&&(n.options.pendingComponent??((o=e.router.options)==null?void 0:o.defaultPendingComponent))){const c=setTimeout(()=>{lS(e)},r);s._nonReactive.pendingTimeout=c}},N9=(e,t,n)=>{const s=e.router.getMatch(t);if(!s._nonReactive.beforeLoadPromise&&!s._nonReactive.loaderPromise)return;cO(e,t,n,s);const r=()=>{const o=e.router.getMatch(t);o.preload&&(o.status==="redirected"||o.status==="notFound")&&Bi(e,o,o.error)};return s._nonReactive.beforeLoadPromise?s._nonReactive.beforeLoadPromise.then(r):r()},_9=(e,t,n,s)=>{const r=e.router.getMatch(t);let o=r._nonReactive.loadPromise;r._nonReactive.loadPromise=zl(()=>{o==null||o.resolve(),o=void 0});const{paramsError:c,searchError:u}=r;c&&eu(e,n,c,"PARSE_PARAMS"),u&&eu(e,n,u,"VALIDATE_SEARCH"),cO(e,t,s,r);const f=new AbortController;let h=!1;const p=()=>{h||(h=!0,e.updateMatch(t,_=>({..._,isFetching:"beforeLoad",fetchCount:_.fetchCount+1,abortController:f})))},g=()=>{var _;(_=r._nonReactive.beforeLoadPromise)==null||_.resolve(),r._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,E=>({...E,isFetching:!1}))};if(!s.options.beforeLoad){e.router.batch(()=>{p(),g()});return}r._nonReactive.beforeLoadPromise=zl();const x={...Fa(e,n,!1),...r.__routeContext},{search:v,params:b,cause:w}=r,S=Cp(e,t),N={search:v,abortController:f,params:b,preload:S,context:x,location:e.location,navigate:_=>e.router.navigate({..._,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:S?"preload":w,matches:e.matches,routeId:s.id,...e.router.options.additionalContext},C=_=>{if(_===void 0){e.router.batch(()=>{p(),g()});return}(qn(_)||mn(_))&&(p(),eu(e,n,_,"BEFORE_LOAD")),e.router.batch(()=>{p(),e.updateMatch(t,E=>({...E,__beforeLoadContext:_})),g()})};let k;try{if(k=s.options.beforeLoad(N),ku(k))return p(),k.catch(_=>{eu(e,n,_,"BEFORE_LOAD")}).then(C)}catch(_){p(),eu(e,n,_,"BEFORE_LOAD")}C(k)},C9=(e,t)=>{const{id:n,routeId:s}=e.matches[t],r=e.router.looseRoutesById[s],o=()=>u(),c=()=>_9(e,n,t,r),u=()=>{if(lO(e,n))return;const f=N9(e,n,r);return ku(f)?f.then(c):c()};return o()},k9=(e,t,n)=>{var o,c,u,f,h,p;const s=e.router.getMatch(t);if(!s||!n.options.head&&!n.options.scripts&&!n.options.headers)return;const r={ssr:e.router.options.ssr,matches:e.matches,match:s,params:s.params,loaderData:s.loaderData};return Promise.all([(c=(o=n.options).head)==null?void 0:c.call(o,r),(f=(u=n.options).scripts)==null?void 0:f.call(u,r),(p=(h=n.options).headers)==null?void 0:p.call(h,r)]).then(([g,x,v])=>({meta:g==null?void 0:g.meta,links:g==null?void 0:g.links,headScripts:g==null?void 0:g.scripts,headers:v,scripts:x,styles:g==null?void 0:g.styles}))},uO=(e,t,n,s,r)=>{const o=t[s-1],{params:c,loaderDeps:u,abortController:f,cause:h}=e.router.getMatch(n),p=Fa(e,s),g=Cp(e,n);return{params:c,deps:u,preload:!!g,parentMatchPromise:o,abortController:f,context:p,location:e.location,navigate:x=>e.router.navigate({...x,_fromLocation:e.location}),cause:g?"preload":h,route:r,...e.router.options.additionalContext}},ER=async(e,t,n,s,r)=>{var o,c,u,f,h;try{const p=e.router.getMatch(n);try{(!(Z4??e.router.isServer)||p.ssr===!0)&&Eu(r);const g=r.options.loader,x=typeof g=="function"?g:g==null?void 0:g.handler,v=x==null?void 0:x(uO(e,t,n,s,r)),b=!!x&&ku(v);if((b||r._lazyPromise||r._componentsPromise||r.options.head||r.options.scripts||r.options.headers||p._nonReactive.minPendingPromise)&&e.updateMatch(n,S=>({...S,isFetching:"loader"})),x){const S=b?await v:v;Bi(e,e.router.getMatch(n),S),S!==void 0&&e.updateMatch(n,N=>({...N,loaderData:S}))}r._lazyPromise&&await r._lazyPromise;const w=p._nonReactive.minPendingPromise;w&&await w,r._componentsPromise&&await r._componentsPromise,e.updateMatch(n,S=>({...S,error:void 0,context:Fa(e,s),status:"success",isFetching:!1,updatedAt:Date.now()}))}catch(g){let x=g;if((x==null?void 0:x.name)==="AbortError"){if(p.abortController.signal.aborted){(o=p._nonReactive.loaderPromise)==null||o.resolve(),p._nonReactive.loaderPromise=void 0;return}e.updateMatch(n,b=>({...b,status:b.status==="pending"?"success":b.status,isFetching:!1,context:Fa(e,s)}));return}const v=p._nonReactive.minPendingPromise;v&&await v,mn(g)&&await((u=(c=r.options.notFoundComponent)==null?void 0:c.preload)==null?void 0:u.call(c)),Bi(e,e.router.getMatch(n),g);try{(h=(f=r.options).onError)==null||h.call(f,g)}catch(b){x=b,Bi(e,e.router.getMatch(n),b)}!qn(x)&&!mn(x)&&await Eu(r,["errorComponent"]),e.updateMatch(n,b=>({...b,error:x,context:Fa(e,s),status:"error",isFetching:!1}))}}catch(p){const g=e.router.getMatch(n);g&&(g._nonReactive.loaderPromise=void 0),Bi(e,g,p)}},R9=async(e,t,n)=>{var v,b,w,S;async function s(N,C,k,_,E){const M=Date.now()-C.updatedAt,A=N?E.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:E.options.staleTime??e.router.options.defaultStaleTime??0,O=E.options.shouldReload,L=typeof O=="function"?O(uO(e,t,r,n,E)):O,{status:P,invalid:I}=_,B=M>=A&&(!!e.forceStaleReload||_.cause==="enter"||k!==void 0&&k!==_.id);c=P==="success"&&(I||(L??B)),N&&E.options.preload===!1||(c&&!e.sync&&p?(u=!0,(async()=>{var F,z;try{await ER(e,t,r,n,E);const Y=e.router.getMatch(r);(F=Y._nonReactive.loaderPromise)==null||F.resolve(),(z=Y._nonReactive.loadPromise)==null||z.resolve(),Y._nonReactive.loaderPromise=void 0,Y._nonReactive.loadPromise=void 0}catch(Y){qn(Y)&&await e.router.navigate(Y.options)}})()):P!=="success"||c?await ER(e,t,r,n,E):RR(e,r,n))}const{id:r,routeId:o}=e.matches[n];let c=!1,u=!1;const f=e.router.looseRoutesById[o],h=f.options.loader,p=((typeof h=="function"||h==null?void 0:h.staleReloadMode)??e.router.options.defaultStaleReloadMode)!=="blocking";if(lO(e,r)){if(!e.router.getMatch(r))return e.matches[n];RR(e,r,n)}else{const N=e.router.getMatch(r),C=e.router.stores.matchesId.get()[n],k=((v=C&&e.router.stores.matchStores.get(C)||null)==null?void 0:v.routeId)===o?C:(b=e.router.stores.matches.get().find(E=>E.routeId===o))==null?void 0:b.id,_=Cp(e,r);if(N._nonReactive.loaderPromise){if(N.status==="success"&&!e.sync&&!N.preload&&p)return N;await N._nonReactive.loaderPromise;const E=e.router.getMatch(r),M=E._nonReactive.error||E.error;M&&Bi(e,E,M),E.status==="pending"&&await s(_,N,k,E,f)}else{const E=_&&!e.router.stores.matchStores.has(r),M=e.router.getMatch(r);M._nonReactive.loaderPromise=zl(),E!==M.preload&&e.updateMatch(r,A=>({...A,preload:E})),await s(_,N,k,M,f)}}const g=e.router.getMatch(r);u||((w=g._nonReactive.loaderPromise)==null||w.resolve(),(S=g._nonReactive.loadPromise)==null||S.resolve(),g._nonReactive.loadPromise=void 0),clearTimeout(g._nonReactive.pendingTimeout),g._nonReactive.pendingTimeout=void 0,u||(g._nonReactive.loaderPromise=void 0),g._nonReactive.dehydrated=void 0;const x=u?g.isFetching:!1;return x!==g.isFetching||g.invalid!==!1?(e.updateMatch(r,N=>({...N,isFetching:x,invalid:!1})),e.router.getMatch(r)):g};async function AR(e){var x,v;const t=e,n=[];j9(t.router)&&lS(t);let s;for(let b=0;b<t.matches.length;b++){try{const w=C9(t,b);ku(w)&&await w}catch(w){if(qn(w))throw w;if(mn(w))s=w;else if(!t.preload)throw w;break}if(t.serialError||t.firstBadMatchIndex!=null)break}const r=t.firstBadMatchIndex??t.matches.length,o=s&&!t.preload?kR(t,s):void 0,c=s&&t.preload?0:o!==void 0?Math.min(o+1,r):r;let u,f;for(let b=0;b<c;b++)n.push(R9(t,n,b));try{await Promise.all(n)}catch{const b=await Promise.allSettled(n);for(const w of b){if(w.status!=="rejected")continue;const S=w.reason;if(qn(S))throw S;mn(S)?u??(u=S):f??(f=S)}if(f!==void 0)throw f}const h=u??(s&&!t.preload?s:void 0);let p=t.firstBadMatchIndex!==void 0?t.firstBadMatchIndex:t.matches.length-1;if(!h&&s&&t.preload)return t.matches;if(h){const b=kR(t,h);b===void 0&&Or();const w=t.matches[b],S=t.router.looseRoutesById[w.routeId],N=(x=t.router.options)==null?void 0:x.defaultNotFoundComponent;!S.options.notFoundComponent&&N&&(S.options.notFoundComponent=N),h.routeId=w.routeId;const C=w.routeId===t.router.routeTree.id;t.updateMatch(w.id,k=>({...k,...C?{status:"success",globalNotFound:!0,error:void 0}:{status:"notFound",error:h},isFetching:!1})),p=b,await Eu(S,["notFoundComponent"])}else if(!t.preload){const b=t.matches[0];b.globalNotFound||(v=t.router.getMatch(b.id))!=null&&v.globalNotFound&&t.updateMatch(b.id,w=>({...w,globalNotFound:!1,error:void 0}))}if(t.serialError&&t.firstBadMatchIndex!==void 0){const b=t.router.looseRoutesById[t.matches[t.firstBadMatchIndex].routeId];await Eu(b,["errorComponent"])}for(let b=0;b<=p;b++){const{id:w,routeId:S}=t.matches[b],N=t.router.looseRoutesById[S];try{const C=k9(t,w,N);if(C){const k=await C;t.updateMatch(w,_=>({..._,...k}))}}catch(C){console.error(`Error executing head for route ${S}:`,C)}}const g=lS(t);if(ku(g)&&await g,h)throw h;if(t.serialError&&!t.preload&&!t.onReady)throw t.serialError;return t.matches}function TR(e,t){const n=t.map(s=>{var r,o;return(o=(r=e.options[s])==null?void 0:r.preload)==null?void 0:o.call(r)}).filter(Boolean);if(n.length!==0)return Promise.all(n)}function Eu(e,t=Lh){!e._lazyLoaded&&e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(s=>{const{id:r,...o}=s.options;Object.assign(e.options,o),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0);const n=()=>e._componentsLoaded?void 0:t===Lh?(()=>{if(e._componentsPromise===void 0){const s=TR(e,Lh);s?e._componentsPromise=s.then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0}):e._componentsLoaded=!0}return e._componentsPromise})():TR(e,t);return e._lazyPromise?e._lazyPromise.then(n):n()}function dO(e){var t;for(const n of Lh)if((t=e.options[n])!=null&&t.preload)return!0;return!1}const Lh=["component","errorComponent","pendingComponent","notFoundComponent"];var Hi="__TSR_index",MR="popstate",IR="beforeunload";function E9(e){let t=e.getLocation();const n=new Set,s=c=>{t=e.getLocation(),n.forEach(u=>u({location:t,action:c}))},r=c=>{e.notifyOnIndexChange??!0?s(c):t=e.getLocation()},o=async({task:c,navigateOpts:u,...f})=>{var g,x;if((u==null?void 0:u.ignoreBlocker)??!1){c();return}const h=((g=e.getBlockers)==null?void 0:g.call(e))??[],p=f.type==="PUSH"||f.type==="REPLACE";if(typeof document<"u"&&h.length&&p)for(const v of h){const b=Zh(f.path,f.state);if(await v.blockerFn({currentLocation:t,nextLocation:b,action:f.type})){(x=e.onBlocked)==null||x.call(e);return}}c()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:c=>(n.add(c),()=>{n.delete(c)}),push:(c,u,f)=>{const h=t.state[Hi];u=OR(h+1,u),o({task:()=>{e.pushState(c,u),s({type:"PUSH"})},navigateOpts:f,type:"PUSH",path:c,state:u})},replace:(c,u,f)=>{const h=t.state[Hi];u=OR(h,u),o({task:()=>{e.replaceState(c,u),s({type:"REPLACE"})},navigateOpts:f,type:"REPLACE",path:c,state:u})},go:(c,u)=>{o({task:()=>{e.go(c),r({type:"GO",index:c})},navigateOpts:u,type:"GO"})},back:c=>{o({task:()=>{e.back((c==null?void 0:c.ignoreBlocker)??!1),r({type:"BACK"})},navigateOpts:c,type:"BACK"})},forward:c=>{o({task:()=>{e.forward((c==null?void 0:c.ignoreBlocker)??!1),r({type:"FORWARD"})},navigateOpts:c,type:"FORWARD"})},canGoBack:()=>t.state[Hi]!==0,createHref:c=>e.createHref(c),block:c=>{var f;if(!e.setBlockers)return()=>{};const u=((f=e.getBlockers)==null?void 0:f.call(e))??[];return e.setBlockers([...u,c]),()=>{var p,g;const h=((p=e.getBlockers)==null?void 0:p.call(e))??[];(g=e.setBlockers)==null||g.call(e,h.filter(x=>x!==c))}},flush:()=>{var c;return(c=e.flush)==null?void 0:c.call(e)},destroy:()=>{var c;return(c=e.destroy)==null?void 0:c.call(e)},notify:s}}function OR(e,t){t||(t={});const n=gj();return{...t,key:n,__TSR_key:n,[Hi]:e}}function A9(e){var O,L;const t=typeof document<"u"?window:void 0,n=t.history.pushState,s=t.history.replaceState;let r=[];const o=()=>r,c=P=>r=P,u=(P=>P),f=(()=>Zh(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!((O=t.history.state)!=null&&O.__TSR_key)&&!((L=t.history.state)!=null&&L.key)){const P=gj();t.history.replaceState({[Hi]:0,key:P,__TSR_key:P},"")}let h=f(),p,g=!1,x=!1,v=!1,b=!1;const w=()=>h;let S,N;const C=()=>{S&&(A._ignoreSubscribers=!0,(S.isPush?t.history.pushState:t.history.replaceState)(S.state,"",S.href),A._ignoreSubscribers=!1,S=void 0,N=void 0,p=void 0)},k=(P,I,B)=>{const F=u(I);N||(p=h),h=Zh(I,B),S={href:F,state:B,isPush:(S==null?void 0:S.isPush)||P==="push"},N||(N=Promise.resolve().then(()=>C()))},_=P=>{h=f(),A.notify({type:P})},E=async()=>{if(x){x=!1;return}const P=f(),I=P.state[Hi]-h.state[Hi],B=I===1,F=I===-1,z=!B&&!F||g;g=!1;const Y=z?"GO":F?"BACK":"FORWARD",$=z?{type:"GO",index:I}:{type:F?"BACK":"FORWARD"};if(v)v=!1;else{const V=o();if(typeof document<"u"&&V.length){for(const G of V)if(await G.blockerFn({currentLocation:h,nextLocation:P,action:Y})){x=!0,t.history.go(1),A.notify($);return}}}h=f(),A.notify($)},M=P=>{if(b){b=!1;return}let I=!1;const B=o();if(typeof document<"u"&&B.length)for(const F of B){const z=F.enableBeforeUnload??!0;if(z===!0){I=!0;break}if(typeof z=="function"&&z()===!0){I=!0;break}}if(I)return P.preventDefault(),P.returnValue=""},A=E9({getLocation:w,getLength:()=>t.history.length,pushState:(P,I)=>k("push",P,I),replaceState:(P,I)=>k("replace",P,I),back:P=>(P&&(v=!0),b=!0,t.history.back()),forward:P=>{P&&(v=!0),b=!0,t.history.forward()},go:P=>{g=!0,t.history.go(P)},createHref:P=>u(P),flush:C,destroy:()=>{t.history.pushState=n,t.history.replaceState=s,t.removeEventListener(IR,M,{capture:!0}),t.removeEventListener(MR,E)},onBlocked:()=>{p&&h!==p&&(h=p)},getBlockers:o,setBlockers:c,notifyOnIndexChange:!1});return t.addEventListener(IR,M,{capture:!0}),t.addEventListener(MR,E),t.history.pushState=function(...P){const I=n.apply(t.history,P);return A._ignoreSubscribers||_("PUSH"),I},t.history.replaceState=function(...P){const I=s.apply(t.history,P);return A._ignoreSubscribers||_("REPLACE"),I},A}function T9(e){let t=e.replace(/[\x00-\x1f\x7f]/g,"");return t.startsWith("//")&&(t="/"+t.replace(/^\/+/,"")),t}function Zh(e,t){const n=T9(e),s=n.indexOf("#"),r=n.indexOf("?"),o=gj();return{href:n,pathname:n.substring(0,s>0?r>0?Math.min(s,r):s:r>0?r:n.length),hash:s>-1?n.substring(s):"",search:r>-1?n.slice(r,s===-1?void 0:s):"",state:t||{[Hi]:0,key:o,__TSR_key:o}}}function gj(){return(Math.random()+1).toString(36).substring(7)}function vl(e,t){const n=t,s=e;return{fromLocation:n,toLocation:s,pathChanged:(n==null?void 0:n.pathname)!==s.pathname,hrefChanged:(n==null?void 0:n.href)!==s.href,hashChanged:(n==null?void 0:n.hash)!==s.hash}}var M9=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this.resetNextScroll=!0,this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.isScrollRestoring=!1,this.isScrollRestorationSetup=!1,this.routeBranchCache=new WeakMap,this.startTransition=n=>n(),this.update=n=>{var p;const s=this.options,r=this.basepath??(s==null?void 0:s.basepath)??"/",o=this.basepath===void 0,c=s==null?void 0:s.rewrite;if(this.options={...s,...n},this.isServer=this.options.isServer??typeof document>"u",this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=a9(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=A9()),this.origin=this.options.origin,this.origin||(window!=null&&window.origin&&window.origin!=="null"?this.origin=window.origin:this.origin="http://localhost"),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let g;this.resolvePathCache=Ru(1e3),g=this.buildRouteTree(),this.setRoutes(g)}if(!this.stores&&this.latestLocation){const g=this.getStoreConfig(this);this.batch=g.batch,this.stores=S9(O9(this.latestLocation),g),f9(this)}let u=!1;const f=this.options.basepath??"/",h=this.options.rewrite;if(o||r!==f||c!==h){this.basepath=f;const g=[],x=aO(f);x&&x!=="/"&&g.push(w9({basepath:f})),h&&g.push(h),this.rewrite=g.length===0?void 0:g.length===1?g[0]:b9(g),this.history&&this.updateLatestLocation(),u=!0}u&&this.stores&&this.stores.location.set(this.latestLocation),typeof window<"u"&&"CSS"in window&&typeof((p=window.CSS)==null?void 0:p.supports)=="function"&&(this.isViewTransitionTypesSupported=window.CSS.supports("selector(:active-view-transition-type(a)"))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{const n=e9(this.routeTree,this.options.caseSensitive,(s,r)=>{s.init({originalIndex:r})});return this.options.routeMasks&&Wz(this.options.routeMasks,n.processedTree),n},this.subscribe=(n,s)=>{const r={eventType:n,fn:s};return this.subscribers.add(r),()=>{this.subscribers.delete(r)}},this.emit=n=>{this.subscribers.forEach(s=>{s.eventType===n.type&&s.fn(n)})},this.parseLocation=(n,s)=>{const r=({pathname:f,search:h,hash:p,href:g,state:x})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(f)){const N=this.options.parseSearch(h),C=this.options.stringifySearch(N);return{href:f+C+p,publicHref:f+C+p,pathname:Zc(f).path,external:!1,searchStr:C,search:ba(s==null?void 0:s.search,N),hash:Zc(p.slice(1)).path,state:$i(s==null?void 0:s.state,x)}}const v=new URL(g,this.origin),b=oS(this.rewrite,v),w=this.options.parseSearch(b.search),S=this.options.stringifySearch(w);return b.search=S,{href:b.href.replace(b.origin,""),publicHref:g,pathname:Zc(b.pathname).path,external:!!this.rewrite&&b.origin!==this.origin,searchStr:S,search:ba(s==null?void 0:s.search,w),hash:Zc(b.hash.slice(1)).path,state:$i(s==null?void 0:s.state,x)}},o=r(n),{__tempLocation:c,__tempKey:u}=o.state;if(c&&(!u||u===this.tempLocationKey)){const f=r(c);return f.state.key=o.state.key,f.state.__TSR_key=o.state.__TSR_key,delete f.state.__tempLocation,{...f,maskedLocation:o}}return o},this.resolvePathWithBase=(n,s)=>i9({base:n,to:s.includes("//")?mj(s):s,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(n,s,r)=>typeof n=="string"?this.matchRoutesInternal({pathname:n,search:s},r):this.matchRoutesInternal(n,s),this.getMatchedRoutes=n=>L9({pathname:n,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=n=>{const s=this.getMatch(n);s&&(s.abortController.abort(),clearTimeout(s._nonReactive.pendingTimeout),s._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{this.stores.pendingIds.get().forEach(n=>{this.cancelMatch(n)}),this.stores.matchesId.get().forEach(n=>{var r;if(this.stores.pendingMatchStores.has(n))return;const s=(r=this.stores.matchStores.get(n))==null?void 0:r.get();s&&(s.status==="pending"||s.isFetching==="loader")&&this.cancelMatch(n)})},this.buildLocation=n=>{const s=(o={})=>{var I,B;const c=o._fromLocation||this.pendingBuiltLocation||this.latestLocation,u=this.matchRoutesLightweight(c);o.from;const f=o.unsafeRelative==="path"?c.pathname:o.from??u.fullPath,h=o.to?`${o.to}`:void 0,p=u.search,g=Object.assign(Object.create(null),u.params),x=(h==null?void 0:h.charCodeAt(0))===47?"/":this.resolvePathWithBase(f,"."),v=h?this.resolvePathWithBase(x,h):x,b=o.params===!1||o.params===null?Object.create(null):(o.params??!0)===!0?g:Object.assign(g,qi(o.params,g)),w=this.routesByPath[Mr(v)];let S;if(w)S=this.getRouteBranch(w);else if(v.includes("$"))S=[];else{const F=this.getMatchedRoutes(v);S=F.matchedRoutes,this.options.notFoundRoute&&(!F.foundRoute||F.foundRoute.path!=="/"&&F.routeParams["**"])&&(S=[...S,this.options.notFoundRoute])}if(S.length&&eO(b))for(const F of S){const z=((I=F.options.params)==null?void 0:I.stringify)??F.options.stringifyParams;if(z)try{Object.assign(b,z(b))}catch{}}const N=n.leaveParams?v:Zc(jR({path:v,params:b,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path;let C=p;if(n._includeValidateSearch&&((B=this.options.search)!=null&&B.strict)){const F={};S.forEach(z=>{if(z.options.validateSearch)try{Object.assign(F,Ph(z.options.validateSearch,{...F,...C}))}catch{}}),C=F}C=P9({search:C,dest:o,destRoutes:S,_includeValidateSearch:n._includeValidateSearch}),C=ba(p,C);const k=this.options.stringifySearch(C),_=o.hash===!0?c.hash:o.hash?qi(o.hash,c.hash):void 0,E=_?`#${_}`:"";let M=o.state===!0?c.state:o.state?qi(o.state,c.state):{};M=$i(c.state,M);const A=`${N}${k}${E}`;let O,L,P=!1;if(this.rewrite){const F=new URL(A,this.origin),z=oO(this.rewrite,F);O=F.href.replace(F.origin,""),z.origin!==this.origin?(L=z.href,P=!0):L=z.pathname+z.search+z.hash}else O=Gz(A),L=O;return{publicHref:L,href:O,pathname:N,search:C,searchStr:k,state:M,hash:_??"",external:P,unmaskOnReload:o.unmaskOnReload}},r=(o={},c)=>{const u=s(o);let f=c?s(c):void 0;if(!f){const h=Object.create(null);if(this.options.routeMasks){const p=Qz(u.pathname,this.processedTree);if(p){Object.assign(h,p.rawParams);const{from:g,params:x,...v}=p.route,b=x===!1||x===null?Object.create(null):(x??!0)===!0?h:Object.assign(h,qi(x,h));c={from:n.from,...v,params:b},f=s(c)}}}return f&&(u.maskedLocation=f),u};return n.mask?r(n,{from:n.from,...n.mask}):r(n)},this.commitLocation=async({viewTransition:n,ignoreBlocker:s,...r})=>{const o=()=>{const f=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];f.forEach(p=>{r.state[p]=this.latestLocation.state[p]});const h=za(r.state,this.latestLocation.state);return f.forEach(p=>{delete r.state[p]}),h},c=Mr(this.latestLocation.href)===Mr(r.href);let u=this.commitLocationPromise;if(this.commitLocationPromise=zl(()=>{u==null||u.resolve(),u=void 0}),c&&o())this.load();else{let{maskedLocation:f,hashScrollIntoView:h,...p}=r;f&&(p={...f,state:{...f.state,__tempKey:void 0,__tempLocation:{...p,search:p.searchStr,state:{...p.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(p.unmaskOnReload??this.options.unmaskOnReload??!1)&&(p.state.__tempKey=this.tempLocationKey)),p.state.__hashScrollIntoViewOptions=h??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=n,this.history[r.replace?"replace":"push"](p.publicHref,p.state,{ignoreBlocker:s})}return this.resetNextScroll=r.resetScroll??!0,this.history.subscribers.size||this.load(),this.commitLocationPromise},this.buildAndCommitLocation=({replace:n,resetScroll:s,hashScrollIntoView:r,viewTransition:o,ignoreBlocker:c,href:u,...f}={})=>{if(u){const g=this.history.location.state.__TSR_index,x=Zh(u,{__TSR_index:n?g:g+1}),v=new URL(x.pathname,this.origin);f.to=oS(this.rewrite,v).pathname,f.search=this.options.parseSearch(x.search),f.hash=x.hash.slice(1)}const h=this.buildLocation({...f,_includeValidateSearch:!0});this.pendingBuiltLocation=h;const p=this.commitLocation({...h,viewTransition:o,replace:n,resetScroll:s,hashScrollIntoView:r,ignoreBlocker:c});return Promise.resolve().then(()=>{this.pendingBuiltLocation===h&&(this.pendingBuiltLocation=void 0)}),p},this.navigate=async({to:n,reloadDocument:s,href:r,publicHref:o,...c})=>{var f,h;let u=!1;if(r)try{new URL(`${r}`),u=!0}catch{}if(u&&!s&&(s=!0),s){if(n!==void 0||!r){const g=this.buildLocation({to:n,...c});r=r??g.publicHref,o=o??g.publicHref}const p=!u&&o?o:r;if(Qh(p,this.protocolAllowlist))return Promise.resolve();if(!c.ignoreBlocker){const g=((h=(f=this.history).getBlockers)==null?void 0:h.call(f))??[];for(const x of g)if(x!=null&&x.blockerFn&&await x.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:"PUSH"}))return Promise.resolve()}return c.replace?window.location.replace(p):window.location.href=p,Promise.resolve()}return this.buildAndCommitLocation({...c,href:r,to:n,_isNavigate:!0})},this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();const n=this.matchRoutes(this.latestLocation),s=this.stores.cachedMatches.get().filter(r=>!n.some(o=>o.id===r.id));this.batch(()=>{this.stores.status.set("pending"),this.stores.statusCode.set(200),this.stores.isLoading.set(!0),this.stores.location.set(this.latestLocation),this.stores.setPending(n),this.stores.setCached(s)})},this.load=async n=>{let s,r,o;const c=this.stores.resolvedLocation.get()??this.stores.location.get();for(o=new Promise(f=>{this.startTransition(async()=>{var h;try{this.beforeLoad();const p=this.latestLocation,g=vl(p,this.stores.resolvedLocation.get());this.stores.redirect.get()||this.emit({type:"onBeforeNavigate",...g}),this.emit({type:"onBeforeLoad",...g}),await AR({router:this,sync:n==null?void 0:n.sync,forceStaleReload:c.href===p.href,matches:this.stores.pendingMatches.get(),location:p,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{var S,N;let x=null,v=null,b=null,w=null;this.batch(()=>{const C=this.stores.pendingMatches.get(),k=C.length,_=this.stores.matches.get();x=k?_.filter(A=>!this.stores.pendingMatchStores.has(A.id)):null;const E=new Set;for(const A of this.stores.pendingMatchStores.values())A.routeId&&E.add(A.routeId);const M=new Set;for(const A of this.stores.matchStores.values())A.routeId&&M.add(A.routeId);v=k?_.filter(A=>!E.has(A.routeId)):null,b=k?C.filter(A=>!M.has(A.routeId)):null,w=k?C.filter(A=>M.has(A.routeId)):_,this.stores.isLoading.set(!1),this.stores.loadedAt.set(Date.now()),k&&(this.stores.setMatches(C),this.stores.setPending([]),this.stores.setCached([...this.stores.cachedMatches.get(),...x.filter(A=>A.status!=="error"&&A.status!=="notFound"&&A.status!=="redirected")]),this.clearExpiredCache())});for(const[C,k]of[[v,"onLeave"],[b,"onEnter"],[w,"onStay"]])if(C)for(const _ of C)(N=(S=this.looseRoutesById[_.routeId].options)[k])==null||N.call(S,_)})})}})}catch(p){qn(p)?(s=p,this.navigate({...s.options,replace:!0,ignoreBlocker:!0})):mn(p)&&(r=p);const g=s?s.status:r?404:this.stores.matches.get().some(x=>x.status==="error")?500:200;this.batch(()=>{this.stores.statusCode.set(g),this.stores.redirect.set(s)})}this.latestLoadPromise===o&&((h=this.commitLocationPromise)==null||h.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),f()})}),this.latestLoadPromise=o,await o;this.latestLoadPromise&&o!==this.latestLoadPromise;)await this.latestLoadPromise;let u;this.hasNotFoundMatch()?u=404:this.stores.matches.get().some(f=>f.status==="error")&&(u=500),u!==void 0&&this.stores.statusCode.set(u)},this.startViewTransition=n=>{const s=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,s&&typeof document<"u"&&"startViewTransition"in document&&typeof document.startViewTransition=="function"){let r;if(typeof s=="object"&&this.isViewTransitionTypesSupported){const o=this.latestLocation,c=this.stores.resolvedLocation.get(),u=typeof s.types=="function"?s.types(vl(o,c)):s.types;if(u===!1){n();return}r={update:n,types:u}}else r=n;document.startViewTransition(r)}else n()},this.updateMatch=(n,s)=>{this.startTransition(()=>{const r=this.stores.pendingMatchStores.get(n);if(r){r.set(s);return}const o=this.stores.matchStores.get(n);if(o){o.set(s);return}const c=this.stores.cachedMatchStores.get(n);if(c){const u=s(c.get());u.status==="redirected"?this.stores.cachedMatchStores.delete(n)&&this.stores.cachedIds.set(f=>f.filter(h=>h!==n)):c.set(u)}})},this.getMatch=n=>{var s,r,o;return((s=this.stores.cachedMatchStores.get(n))==null?void 0:s.get())??((r=this.stores.pendingMatchStores.get(n))==null?void 0:r.get())??((o=this.stores.matchStores.get(n))==null?void 0:o.get())},this.invalidate=n=>{const s=r=>{var o;return((o=n==null?void 0:n.filter)==null?void 0:o.call(n,r))??!0?{...r,invalid:!0,...n!=null&&n.forcePending||r.status==="error"||r.status==="notFound"?{status:"pending",error:void 0}:void 0}:r};return this.batch(()=>{this.stores.setMatches(this.stores.matches.get().map(s)),this.stores.setCached(this.stores.cachedMatches.get().map(s)),this.stores.setPending(this.stores.pendingMatches.get().map(s))}),this.shouldViewTransition=!1,this.load({sync:n==null?void 0:n.sync})},this.getParsedLocationHref=n=>n.publicHref||"/",this.resolveRedirect=n=>{const s=n.headers.get("Location");if(!n.options.href||n.options._builtLocation){const r=n.options._builtLocation??this.buildLocation(n.options),o=this.getParsedLocationHref(r);n.options.href=o,n.headers.set("Location",o)}else if(s)try{const r=new URL(s);if(this.origin&&r.origin===this.origin){const o=r.pathname+r.search+r.hash;n.options.href=o,n.headers.set("Location",o)}}catch{}if(n.options.href&&!n.options._builtLocation&&Qh(n.options.href,this.protocolAllowlist))throw new Error("Redirect blocked: unsafe protocol");return n.headers.get("Location")||n.headers.set("Location",n.options.href),n},this.clearCache=n=>{const s=n==null?void 0:n.filter;s!==void 0?this.stores.setCached(this.stores.cachedMatches.get().filter(r=>!s(r))):this.stores.setCached([])},this.clearExpiredCache=()=>{const n=Date.now(),s=r=>{const o=this.looseRoutesById[r.routeId];if(!o.options.loader)return!0;const c=(r.preload?o.options.preloadGcTime??this.options.defaultPreloadGcTime:o.options.gcTime??this.options.defaultGcTime)??300*1e3;return r.status==="error"?!0:n-r.updatedAt>=c};this.clearCache({filter:s})},this.loadRouteChunk=Eu,this.preloadRoute=async n=>{const s=n._builtLocation??this.buildLocation(n);let r=this.matchRoutes(s,{throwOnError:!0,preload:!0,dest:n});const o=new Set([...this.stores.matchesId.get(),...this.stores.pendingIds.get()]),c=new Set([...o,...this.stores.cachedIds.get()]),u=r.filter(f=>!c.has(f.id));if(u.length){const f=this.stores.cachedMatches.get();this.stores.setCached([...f,...u])}try{return r=await AR({router:this,matches:r,location:s,preload:!0,updateMatch:(f,h)=>{o.has(f)?r=r.map(p=>p.id===f?h(p):p):this.updateMatch(f,h)}}),r}catch(f){if(qn(f))return f.options.reloadDocument?void 0:await this.preloadRoute({...f.options,_fromLocation:s});mn(f)||console.error(f);return}},this.matchRoute=(n,s)=>{const r={...n,to:n.to?this.resolvePathWithBase(n.from||"",n.to):void 0,params:n.params||{},leaveParams:!0},o=this.buildLocation(r);if(s!=null&&s.pending&&this.stores.status.get()!=="pending")return!1;const c=((s==null?void 0:s.pending)===void 0?!this.stores.isLoading.get():s.pending)?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),u=Xz(o.pathname,(s==null?void 0:s.caseSensitive)??!1,(s==null?void 0:s.fuzzy)??!1,c.pathname,this.processedTree);return!u||n.params&&!za(u.rawParams,n.params,{partial:!0})?!1:(s==null?void 0:s.includeSearch)??!0?za(c.search,o.search,{partial:!0})?u.rawParams:!1:u.rawParams},this.hasNotFoundMatch=()=>this.stores.matches.get().some(n=>n.status==="notFound"||n.globalNotFound),this.getStoreConfig=t,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??"fuzzy",stringifySearch:e.stringifySearch??g9,parseSearch:e.parseSearch??m9,protocolAllowlist:e.protocolAllowlist??Vz}),typeof document<"u"&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.stores.__store.get()}setRoutes({routesById:e,routesByPath:t,processedTree:n}){this.routesById=e,this.routesByPath=t,this.processedTree=n;const s=this.options.notFoundRoute;s&&(s.init({originalIndex:99999999999}),this.routesById[s.id]=s)}getRouteBranch(e){let t=this.routeBranchCache.get(e);return t||(t=rO(e),this.routeBranchCache.set(e,t)),t}get looseRoutesById(){return this.routesById}getParentContext(e){return e!=null&&e.id?e.context??this.options.context??void 0:this.options.context??void 0}matchRoutesInternal(e,t){var p,g;const n=this.getMatchedRoutes(e.pathname),{foundRoute:s,routeParams:r}=n;let{matchedRoutes:o}=n,c=!1;(s?s.path!=="/"&&r["**"]:Mr(e.pathname))&&(this.options.notFoundRoute?o=[...o,this.options.notFoundRoute]:c=!0);const u=c?q9(this.options.notFoundMode,o):void 0,f=new Array(o.length),h=new Map;for(const x of this.stores.matchStores.values())x.routeId&&h.set(x.routeId,x.get());for(let x=0;x<o.length;x++){const v=o[x],b=f[x-1];let w,S,N;{const z=(b==null?void 0:b.search)??e.search,Y=(b==null?void 0:b._strictSearch)??void 0;try{const $=Ph(v.options.validateSearch,{...z})??void 0;w={...z,...$},S={...Y,...$},N=void 0}catch($){let V=$;if($ instanceof Jh||(V=new Jh($.message,{cause:$})),t!=null&&t.throwOnError)throw V;w=z,S={},N=V}}const C=((g=(p=v.options).loaderDeps)==null?void 0:g.call(p,{search:w}))??"",k=C?JSON.stringify(C):"",{interpolatedPath:_,usedParams:E}=jR({path:v.fullPath,params:r,decoder:this.pathParamsDecoder,server:this.isServer}),M=v.id+_+k,A=this.getMatch(M),O=h.get(v.id),L=(A==null?void 0:A._strictParams)??E;let P;if(!A)try{LR(v,L)}catch(z){if(mn(z)||qn(z)?P=z:P=new I9(z.message,{cause:z}),t!=null&&t.throwOnError)throw P}Object.assign(r,L);const I=O?"stay":"enter";let B;if(A)B={...A,cause:I,params:(O==null?void 0:O.params)??r,_strictParams:L,search:ba(O?O.search:A.search,w),_strictSearch:S};else{const z=v.options.loader||v.options.beforeLoad||v.lazyFn||dO(v)?"pending":"success";B={id:M,ssr:v.options.ssr,index:x,routeId:v.id,params:(O==null?void 0:O.params)??r,_strictParams:L,pathname:_,updatedAt:Date.now(),search:O?ba(O.search,w):w,_strictSearch:S,searchError:void 0,status:z,isFetching:!1,error:void 0,paramsError:P,__routeContext:void 0,_nonReactive:{loadPromise:zl()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:I,loaderDeps:O?$i(O.loaderDeps,C):C,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:v.options.staticData||{},fullPath:v.fullPath}}t!=null&&t.preload||(B.globalNotFound=u===v.id),B.searchError=N;const F=this.getParentContext(b);B.context={...F,...B.__routeContext,...B.__beforeLoadContext},f[x]=B}for(let x=0;x<f.length;x++){const v=f[x],b=this.looseRoutesById[v.routeId],w=this.getMatch(v.id),S=h.get(v.routeId);if(v.params=S?ba(S.params,r):r,!w){const N=f[x-1],C=this.getParentContext(N);if(b.options.context){const k={deps:v.loaderDeps,params:v.params,context:C??{},location:e,navigate:_=>this.navigate({..._,_fromLocation:e}),buildLocation:this.buildLocation,cause:v.cause,abortController:v.abortController,preload:!!v.preload,matches:f,routeId:b.id};v.__routeContext=b.options.context(k)??void 0}v.context={...C,...v.__routeContext,...v.__beforeLoadContext}}}return f}matchRoutesLightweight(e){var h;const{matchedRoutes:t,routeParams:n}=this.getMatchedRoutes(e.pathname),s=Cu(t),r={...e.search};for(const p of t)try{Object.assign(r,Ph(p.options.validateSearch,r))}catch{}const o=Cu(this.stores.matchesId.get()),c=o&&((h=this.stores.matchStores.get(o))==null?void 0:h.get()),u=c&&c.routeId===s.id&&c.pathname===e.pathname;let f;if(u)f=c.params;else{const p=Object.assign(Object.create(null),n);for(const g of t)try{LR(g,p)}catch{}f=p}return{matchedRoutes:t,fullPath:s.fullPath,search:r,params:f}}},Jh=class extends Error{},I9=class extends Error{};function O9(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:e,matches:[],statusCode:200}}function Ph(e,t){if(e==null)return{};if("~standard"in e){const n=e["~standard"].validate(t);if(n instanceof Promise)throw new Jh("Async validation not supported");if(n.issues)throw new Jh(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return"parse"in e?e.parse(t):typeof e=="function"?e(t):{}}function L9({pathname:e,routesById:t,processedTree:n}){const s=Object.create(null),r=Mr(e);let o;const c=Zz(r,n,!0);return c&&(o=c.route,Object.assign(s,c.rawParams)),{matchedRoutes:(c==null?void 0:c.branch)||[t.__root__],routeParams:s,foundRoute:o}}function P9({search:e,dest:t,destRoutes:n,_includeValidateSearch:s}){return D9(n)(e,t,s??!1)}function D9(e){var r;const t={dest:null,_includeValidateSearch:!1,middlewares:[]};for(const o of e){if("search"in o.options)(r=o.options.search)!=null&&r.middlewares&&t.middlewares.push(...o.options.search.middlewares);else if(o.options.preSearchFilters||o.options.postSearchFilters){const c=({search:u,next:f})=>{let h=u;"preSearchFilters"in o.options&&o.options.preSearchFilters&&(h=o.options.preSearchFilters.reduce((g,x)=>x(g),u));const p=f(h);return"postSearchFilters"in o.options&&o.options.postSearchFilters?o.options.postSearchFilters.reduce((g,x)=>x(g),p):p};t.middlewares.push(c)}if(o.options.validateSearch){const c=({search:u,next:f})=>{const h=f(u);if(!t._includeValidateSearch)return h;try{return{...h,...Ph(o.options.validateSearch,h)??void 0}}catch{return h}};t.middlewares.push(c)}}const n=({search:o})=>{const c=t.dest;return c.search?c.search===!0?o:qi(c.search,o):{}};t.middlewares.push(n);const s=(o,c,u)=>{if(o>=u.length)return c;const f=u[o];return f({search:c,next:p=>s(o+1,p,u)})};return function(c,u,f){return t.dest=u,t._includeValidateSearch=f,s(0,c,t.middlewares)}}function q9(e,t){if(e!=="root")for(let n=t.length-1;n>=0;n--){const s=t[n];if(s.children)return s.id}return Ba}function LR(e,t){var s;const n=((s=e.options.params)==null?void 0:s.parse)??e.options.parseParams;if(n){const r=n(t);if(r===!1)throw new Error("Route params.parse returned false for a matched route");Object.assign(t,r)}}const $9="Error preloading route! ☝️";var fO=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=t=>{var f,h;this.originalIndex=t.originalIndex;const n=this.options,s=!(n!=null&&n.path)&&!(n!=null&&n.id);this.parentRoute=(h=(f=this.options).getParentRoute)==null?void 0:h.call(f),s?this._path=Ba:this.parentRoute||Or();let r=s?Ba:n==null?void 0:n.path;r&&r!=="/"&&(r=iO(r));const o=(n==null?void 0:n.id)||r;let c=s?Ba:Oh([this.parentRoute.id==="__root__"?"":this.parentRoute.id,o]);r==="__root__"&&(r="/"),c!=="__root__"&&(c=Oh(["/",c]));const u=c==="__root__"?"/":Oh([this.parentRoute.fullPath,r]);this._path=r,this._id=c,this._fullPath=u,this._to=Mr(u)},this.addChildren=t=>this._addFileChildren(t),this._addFileChildren=t=>(Array.isArray(t)&&(this.children=t),typeof t=="object"&&t!==null&&(this.children=Object.values(t)),this),this._addFileTypes=()=>this,this.updateLoader=t=>(Object.assign(this.options,t),this),this.update=t=>(Object.assign(this.options,t),this),this.lazy=t=>(this.lazyFn=t,this),this.redirect=t=>y9({from:this.fullPath,...t}),this.options=e||{},this.isRoot=!(e!=null&&e.getParentRoute),e!=null&&e.id&&(e!=null&&e.path))throw new Error("Route cannot have both an 'id' and a 'path' option.")}},z9=class extends fO{constructor(e){super(e)}};function B9(e){if(typeof document<"u"&&document.querySelector){const t=e.stores.location.get(),n=t.state.__hashScrollIntoViewOptions??!0;if(n&&t.hash!==""){const s=document.getElementById(t.hash);s&&s.scrollIntoView(n)}}}function xj(e){const t=e.errorComponent??vj;return a.jsx(F9,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:n,reset:s})=>n?R.createElement(t,{error:n,reset:s}):e.children})}var F9=class extends R.Component{constructor(...e){super(...e),this.state={error:null}}static getDerivedStateFromProps(e,t){const n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:null}:{resetKey:n}}static getDerivedStateFromError(e){return{error:e}}reset(){this.setState({error:null})}componentDidCatch(e,t){this.props.onCatch&&this.props.onCatch(e,t)}render(){return this.props.children({error:this.state.error,reset:()=>{this.reset()}})}};function vj({error:e}){const[t,n]=R.useState(!1);return a.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[a.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),a.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>n(s=>!s),children:t?"Hide Error":"Show Error"})]}),a.jsx("div",{style:{height:".25rem"}}),t?a.jsx("div",{children:a.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:e.message?a.jsx("code",{children:e.message}):null})}):null]})}function H9({children:e,fallback:t=null}){return hO()?a.jsx(Ga.Fragment,{children:e}):a.jsx(Ga.Fragment,{children:t})}function hO(){return Ga.useSyncExternalStore(U9,()=>!0,()=>!1)}function U9(){return()=>{}}var pO=R.createContext(null);function Fn(e){return R.useContext(pO)}var kp=R.createContext(void 0),V9=R.createContext(void 0),St=(e=>(e[e.None=0]="None",e[e.Mutable=1]="Mutable",e[e.Watching=2]="Watching",e[e.RecursedCheck=4]="RecursedCheck",e[e.Recursed=8]="Recursed",e[e.Dirty=16]="Dirty",e[e.Pending=32]="Pending",e))(St||{});function G9({update:e,notify:t,unwatched:n}){return{link:s,unlink:r,propagate:o,checkDirty:c,shallowPropagate:u};function s(h,p,g){const x=p.depsTail;if(x!==void 0&&x.dep===h)return;const v=x!==void 0?x.nextDep:p.deps;if(v!==void 0&&v.dep===h){v.version=g,p.depsTail=v;return}const b=h.subsTail;if(b!==void 0&&b.version===g&&b.sub===p)return;const w=p.depsTail=h.subsTail={version:g,dep:h,sub:p,prevDep:x,nextDep:v,prevSub:b,nextSub:void 0};v!==void 0&&(v.prevDep=w),x!==void 0?x.nextDep=w:p.deps=w,b!==void 0?b.nextSub=w:h.subs=w}function r(h,p=h.sub){const g=h.dep,x=h.prevDep,v=h.nextDep,b=h.nextSub,w=h.prevSub;return v!==void 0?v.prevDep=x:p.depsTail=x,x!==void 0?x.nextDep=v:p.deps=v,b!==void 0?b.prevSub=w:g.subsTail=w,w!==void 0?w.nextSub=b:(g.subs=b)===void 0&&n(g),v}function o(h){let p=h.nextSub,g;e:do{const x=h.sub;let v=x.flags;if(v&60?v&12?v&4?!(v&48)&&f(h,x)?(x.flags=v|40,v&=1):v=0:x.flags=v&-9|32:v=0:x.flags=v|32,v&2&&t(x),v&1){const b=x.subs;if(b!==void 0){const w=(h=b).nextSub;w!==void 0&&(g={value:p,prev:g},p=w);continue}}if((h=p)!==void 0){p=h.nextSub;continue}for(;g!==void 0;)if(h=g.value,g=g.prev,h!==void 0){p=h.nextSub;continue e}break}while(!0)}function c(h,p){let g,x=0,v=!1;e:do{const b=h.dep,w=b.flags;if(p.flags&16)v=!0;else if((w&17)===17){if(e(b)){const S=b.subs;S.nextSub!==void 0&&u(S),v=!0}}else if((w&33)===33){(h.nextSub!==void 0||h.prevSub!==void 0)&&(g={value:h,prev:g}),h=b.deps,p=b,++x;continue}if(!v){const S=h.nextDep;if(S!==void 0){h=S;continue}}for(;x--;){const S=p.subs,N=S.nextSub!==void 0;if(N?(h=g.value,g=g.prev):h=S,v){if(e(p)){N&&u(S),p=h.sub;continue}v=!1}else p.flags&=-33;p=h.sub;const C=h.nextDep;if(C!==void 0){h=C;continue e}}return v}while(!0)}function u(h){do{const p=h.sub,g=p.flags;(g&48)===32&&(p.flags=g|16,(g&6)===2&&t(p))}while((h=h.nextSub)!==void 0)}function f(h,p){let g=p.depsTail;for(;g!==void 0;){if(g===h)return!0;g=g.prevDep}return!1}}function K9(e,t,n){var o,c,u;const s=typeof e=="object",r=s?e:void 0;return{next:(o=s?e.next:e)==null?void 0:o.bind(r),error:(c=s?e.error:t)==null?void 0:c.bind(r),complete:(u=s?e.complete:n)==null?void 0:u.bind(r)}}const cS=[];let Dh=0;const{link:PR,unlink:Y9,propagate:W9,checkDirty:mO,shallowPropagate:DR}=G9({update(e){return e._update()},notify(e){cS[uS++]=e,e.flags&=~St.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=St.Mutable|St.Dirty,ep(e))}});let Zf=0,uS=0,Bs,dS=0;function gO(e){try{++dS,e()}finally{--dS||xO()}}function ep(e){const t=e.depsTail;let n=t!==void 0?t.nextDep:e.deps;for(;n!==void 0;)n=Y9(n,e)}function xO(){if(!(dS>0)){for(;Zf<uS;){const e=cS[Zf];cS[Zf++]=void 0,e.notify()}Zf=0,uS=0}}function qR(e,t){const n=typeof e=="function",s=e,r={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:n?St.None:St.Mutable,get(){return Bs!==void 0&&PR(r,Bs,Dh),r._snapshot},subscribe(o){const c=K9(o),u={current:!1},f=Q9(()=>{var h;r.get(),u.current?(h=c.next)==null||h.call(c,r._snapshot):u.current=!0});return{unsubscribe:()=>{f.stop()}}},_update(o){const c=Bs,u=(t==null?void 0:t.compare)??Object.is;if(n)Bs=r,++Dh,r.depsTail=void 0;else if(o===void 0)return!1;n&&(r.flags=St.Mutable|St.RecursedCheck);try{const f=r._snapshot,h=typeof o=="function"?o(f):o===void 0&&n?s(f):o;return f===void 0||!u(f,h)?(r._snapshot=h,!0):!1}finally{Bs=c,n&&(r.flags&=~St.RecursedCheck),ep(r)}}};return n?(r.flags=St.Mutable|St.Dirty,r.get=function(){const o=r.flags;if(o&St.Dirty||o&St.Pending&&mO(r.deps,r)){if(r._update()){const c=r.subs;c!==void 0&&DR(c)}}else o&St.Pending&&(r.flags=o&~St.Pending);return Bs!==void 0&&PR(r,Bs,Dh),r._snapshot}):r.set=function(o){if(r._update(o)){const c=r.subs;c!==void 0&&(W9(c),DR(c),xO())}},r}function Q9(e){const t=()=>{const s=Bs;Bs=n,++Dh,n.depsTail=void 0,n.flags=St.Watching|St.RecursedCheck;try{return e()}finally{Bs=s,n.flags&=~St.RecursedCheck,ep(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:St.Watching|St.RecursedCheck,notify(){const s=this.flags;s&St.Dirty||s&St.Pending&&mO(this.deps,this)?t():this.flags=St.Watching},stop(){this.flags=St.None,this.depsTail=void 0,ep(this)}};return t(),n}var ev={exports:{}},tv={},nv={exports:{}},sv={};/**
50
+ * @license React
51
+ * use-sync-external-store-shim.production.js
52
+ *
53
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
54
+ *
55
+ * This source code is licensed under the MIT license found in the
56
+ * LICENSE file in the root directory of this source tree.
57
+ */var $R;function X9(){if($R)return sv;$R=1;var e=id();function t(g,x){return g===x&&(g!==0||1/g===1/x)||g!==g&&x!==x}var n=typeof Object.is=="function"?Object.is:t,s=e.useState,r=e.useEffect,o=e.useLayoutEffect,c=e.useDebugValue;function u(g,x){var v=x(),b=s({inst:{value:v,getSnapshot:x}}),w=b[0].inst,S=b[1];return o(function(){w.value=v,w.getSnapshot=x,f(w)&&S({inst:w})},[g,v,x]),r(function(){return f(w)&&S({inst:w}),g(function(){f(w)&&S({inst:w})})},[g]),c(v),v}function f(g){var x=g.getSnapshot;g=g.value;try{var v=x();return!n(g,v)}catch{return!0}}function h(g,x){return x()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:u;return sv.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:p,sv}var zR;function Z9(){return zR||(zR=1,nv.exports=X9()),nv.exports}/**
58
+ * @license React
59
+ * use-sync-external-store-shim/with-selector.production.js
60
+ *
61
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
62
+ *
63
+ * This source code is licensed under the MIT license found in the
64
+ * LICENSE file in the root directory of this source tree.
65
+ */var BR;function J9(){if(BR)return tv;BR=1;var e=id(),t=Z9();function n(h,p){return h===p&&(h!==0||1/h===1/p)||h!==h&&p!==p}var s=typeof Object.is=="function"?Object.is:n,r=t.useSyncExternalStore,o=e.useRef,c=e.useEffect,u=e.useMemo,f=e.useDebugValue;return tv.useSyncExternalStoreWithSelector=function(h,p,g,x,v){var b=o(null);if(b.current===null){var w={hasValue:!1,value:null};b.current=w}else w=b.current;b=u(function(){function N(M){if(!C){if(C=!0,k=M,M=x(M),v!==void 0&&w.hasValue){var A=w.value;if(v(A,M))return _=A}return _=M}if(A=_,s(k,M))return A;var O=x(M);return v!==void 0&&v(A,O)?(k=M,A):(k=M,_=O)}var C=!1,k,_,E=g===void 0?null:g;return[function(){return N(p())},E===null?void 0:function(){return N(E())}]},[p,g,x,v]);var S=r(h,b[0],b[1]);return c(function(){w.hasValue=!0,w.value=S},[S]),f(S),S},tv}var FR;function eB(){return FR||(FR=1,ev.exports=J9()),ev.exports}var vO=eB();const tB=Np(vO);function nB(e,t){return e===t}function Bn(e,t,n=nB){const s=R.useCallback(c=>{if(!e)return()=>{};const{unsubscribe:u}=e.subscribe(c);return u},[e]),r=R.useCallback(()=>e==null?void 0:e.get(),[e]);return vO.useSyncExternalStoreWithSelector(s,r,r,t,n)}var sB={get:()=>{},subscribe:()=>({unsubscribe:()=>{}})};function eo(e){const t=Fn(),n=R.useContext(e.from?V9:kp),s=e.from??n,r=s?e.from?t.stores.getRouteMatchStore(s):t.stores.matchStores.get(s):void 0,o=R.useRef(void 0);return Bn(r??sB,c=>{if((e.shouldThrow??!0)&&!c&&Or(),c===void 0)return;const u=e.select?e.select(c):c;if(e.structuralSharing??t.options.defaultStructuralSharing){const f=$i(o.current,u);return o.current=f,f}return u})}function yO(e){return eo({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function bO(e){const{select:t,...n}=e;return eo({...n,select:s=>t?t(s.loaderDeps):s.loaderDeps})}function Cn(e){return eo({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{const n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function wO(e){return eo({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function Ot(e){const t=Fn();return R.useCallback(n=>t.navigate({...n,from:n.from??(e==null?void 0:e.from)}),[e==null?void 0:e.from,t])}function to(e){const t=Fn(),n=Ot(),s=R.useRef(null);return pl(()=>{s.current!==e&&(n(e),s.current=e)},[t,e,n]),null}function SO(e){return eo({...e,select:t=>e.select?e.select(t.context):t.context})}var Rp=X4();const rB=Np(Rp);function iB(e,t){const n=Fn(),s=Bz(t),{activeProps:r,inactiveProps:o,activeOptions:c,to:u,preload:f,preloadDelay:h,preloadIntentProximity:p,hashScrollIntoView:g,replace:x,startTransition:v,resetScroll:b,viewTransition:w,children:S,target:N,disabled:C,style:k,className:_,onClick:E,onBlur:M,onFocus:A,onMouseEnter:O,onMouseLeave:L,onTouchStart:P,ignoreBlocker:I,params:B,search:F,hash:z,state:Y,mask:$,reloadDocument:V,unsafeRelative:G,from:Z,_fromLocation:J,...D}=e,U=hO(),te=R.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),H=Bn(n.stores.location,Fe=>Fe,(Fe,ht)=>Fe.href===ht.href),W=R.useMemo(()=>{const Fe={_fromLocation:H,...te};return n.buildLocation(Fe)},[n,H,te]),Q=W.maskedLocation?W.maskedLocation.publicHref:W.publicHref,se=W.maskedLocation?W.maskedLocation.external:W.external,re=R.useMemo(()=>dB(Q,se,n.history,C),[C,se,Q,n.history]),ce=R.useMemo(()=>{if(re!=null&&re.external)return Qh(re.href,n.protocolAllowlist)?void 0:re.href;if(!fB(u)&&!(typeof u!="string"||u.indexOf(":")===-1))try{return new URL(u),Qh(u,n.protocolAllowlist)?void 0:u}catch{}},[u,re,n.protocolAllowlist]),me=R.useMemo(()=>{if(ce)return!1;if(c!=null&&c.exact){if(!r9(H.pathname,W.pathname,n.basepath))return!1}else{const Fe=Xh(H.pathname,n.basepath),ht=Xh(W.pathname,n.basepath);if(!(Fe.startsWith(ht)&&(Fe.length===ht.length||Fe[ht.length]==="/")))return!1}return((c==null?void 0:c.includeSearch)??!0)&&!za(H.search,W.search,{partial:!(c!=null&&c.exact),ignoreUndefined:!(c!=null&&c.explicitUndefined)})?!1:c!=null&&c.includeHash?U&&H.hash===W.hash:!0},[c==null?void 0:c.exact,c==null?void 0:c.explicitUndefined,c==null?void 0:c.includeHash,c==null?void 0:c.includeSearch,H,ce,U,W.hash,W.pathname,W.search,n.basepath]),ge=me?qi(r,{})??aB:rv,ye=me?rv:qi(o,{})??rv,xe=[_,ge.className,ye.className].filter(Boolean).join(" "),Se=(k||ge.style||ye.style)&&{...k,...ge.style,...ye.style},[je,Oe]=R.useState(!1),Ee=R.useRef(!1),mt=e.reloadDocument||ce?!1:f??n.options.defaultPreload,yt=h??n.options.defaultPreloadDelay??0,Tt=R.useCallback(()=>{n.preloadRoute({...te,_builtLocation:W}).catch(Fe=>{console.warn(Fe),console.warn($9)})},[n,te,W]);zz(s,R.useCallback(Fe=>{Fe!=null&&Fe.isIntersecting&&Tt()},[Tt]),uB,{disabled:!!C||mt!=="viewport"}),R.useEffect(()=>{Ee.current||!C&&mt==="render"&&(Tt(),Ee.current=!0)},[C,Tt,mt]);const rn=Fe=>{const ht=Fe.currentTarget.getAttribute("target"),Ut=N!==void 0?N:ht;if(!C&&!hB(Fe)&&!Fe.defaultPrevented&&(!Ut||Ut==="_self")&&Fe.button===0){Fe.preventDefault(),Rp.flushSync(()=>{Oe(!0)});const an=n.subscribe("onResolved",()=>{an(),Oe(!1)});n.navigate({...te,replace:x,resetScroll:b,hashScrollIntoView:g,startTransition:v,viewTransition:w,ignoreBlocker:I})}};if(ce)return{...D,ref:s,href:ce,...S&&{children:S},...N&&{target:N},...C&&{disabled:C},...k&&{style:k},..._&&{className:_},...E&&{onClick:E},...M&&{onBlur:M},...A&&{onFocus:A},...O&&{onMouseEnter:O},...L&&{onMouseLeave:L},...P&&{onTouchStart:P}};const Ht=Fe=>{if(C||mt!=="intent")return;if(!yt){Tt();return}const ht=Fe.currentTarget;if(tu.has(ht))return;const Ut=setTimeout(()=>{tu.delete(ht),Tt()},yt);tu.set(ht,Ut)},bt=Fe=>{C||mt!=="intent"||Tt()},gt=Fe=>{if(C||!mt||!yt)return;const ht=Fe.currentTarget,Ut=tu.get(ht);Ut&&(clearTimeout(Ut),tu.delete(ht))};return{...D,...ge,...ye,href:re==null?void 0:re.href,ref:s,onClick:tl([E,rn]),onBlur:tl([M,gt]),onFocus:tl([A,Ht]),onMouseEnter:tl([O,Ht]),onMouseLeave:tl([L,gt]),onTouchStart:tl([P,bt]),disabled:!!C,target:N,...Se&&{style:Se},...xe&&{className:xe},...C&&oB,...me&&lB,...U&&je&&cB}}var rv={},aB={className:"active"},oB={role:"link","aria-disabled":!0},lB={"data-status":"active","aria-current":"page"},cB={"data-transitioning":"transitioning"},tu=new WeakMap,uB={rootMargin:"100px"},tl=e=>t=>{for(const n of e)if(n){if(t.defaultPrevented)return;n(t)}};function dB(e,t,n,s){if(!s)return t?{href:e,external:!0}:{href:n.createHref(e)||"/",external:!1}}function fB(e){if(typeof e!="string")return!1;const t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var Ye=R.forwardRef((e,t)=>{const{_asChild:n,...s}=e,{type:r,...o}=iB(s,t),c=typeof s.children=="function"?s.children({isActive:o["data-status"]==="active"}):s.children;if(!n){const{disabled:u,...f}=o;return R.createElement("a",f,c)}return R.createElement(n,o,c)});function hB(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var pB=class extends fO{constructor(t){super(t),this.useMatch=n=>eo({select:n==null?void 0:n.select,from:this.id,structuralSharing:n==null?void 0:n.structuralSharing}),this.useRouteContext=n=>SO({...n,from:this.id}),this.useSearch=n=>wO({select:n==null?void 0:n.select,structuralSharing:n==null?void 0:n.structuralSharing,from:this.id}),this.useParams=n=>Cn({select:n==null?void 0:n.select,structuralSharing:n==null?void 0:n.structuralSharing,from:this.id}),this.useLoaderDeps=n=>bO({...n,from:this.id}),this.useLoaderData=n=>yO({...n,from:this.id}),this.useNavigate=()=>Ot({from:this.fullPath}),this.Link=Ga.forwardRef((n,s)=>a.jsx(Ye,{ref:s,from:this.fullPath,...n}))}};function He(e){return new pB(e)}var mB=class extends z9{constructor(e){super(e),this.useMatch=t=>eo({select:t==null?void 0:t.select,from:this.id,structuralSharing:t==null?void 0:t.structuralSharing}),this.useRouteContext=t=>SO({...t,from:this.id}),this.useSearch=t=>wO({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useParams=t=>Cn({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useLoaderDeps=t=>bO({...t,from:this.id}),this.useLoaderData=t=>yO({...t,from:this.id}),this.useNavigate=()=>Ot({from:this.fullPath}),this.Link=Ga.forwardRef((t,n)=>a.jsx(Ye,{ref:n,from:this.fullPath,...t}))}};function gB(e){return new mB(e)}function xB(e){const t=Fn(),n=`not-found-${Bn(t.stores.location,s=>s.pathname)}-${Bn(t.stores.status,s=>s)}`;return a.jsx(xj,{getResetKey:()=>n,onCatch:(s,r)=>{var o;if(mn(s))(o=e.onCatch)==null||o.call(e,s,r);else throw s},errorComponent:({error:s})=>{var r;if(mn(s))return(r=e.fallback)==null?void 0:r.call(e,s);throw s},children:e.children})}function vB(){return a.jsx("p",{children:"Not Found"})}function ul(e){return a.jsx(a.Fragment,{children:e.children})}function jO(e,t,n){return t.options.notFoundComponent?a.jsx(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?a.jsx(e.options.defaultNotFoundComponent,{...n}):a.jsx(vB,{})}function yB(e){return null}function bB(){return yB(Fn()),null}var NO=R.memo(function({matchId:t}){const n=Fn(),s=n.stores.matchStores.get(t);s||Or();const r=Bn(n.stores.loadedAt,c=>c),o=Bn(s,c=>c);return a.jsx(wB,{router:n,matchId:t,resetKey:r,matchState:R.useMemo(()=>{var f;const c=o.routeId,u=(f=n.routesById[c].parentRoute)==null?void 0:f.id;return{routeId:c,ssr:o.ssr,_displayPending:o._displayPending,parentRouteId:u}},[o._displayPending,o.routeId,o.ssr,n.routesById])})});function wB({router:e,matchId:t,resetKey:n,matchState:s}){var b,w;const r=e.routesById[s.routeId],o=r.options.pendingComponent??e.options.defaultPendingComponent,c=o?a.jsx(o,{}):null,u=r.options.errorComponent??e.options.defaultErrorComponent,f=r.options.onCatch??e.options.defaultOnCatch,h=r.isRoot?r.options.notFoundComponent??((b=e.options.notFoundRoute)==null?void 0:b.options.component):r.options.notFoundComponent,p=s.ssr===!1||s.ssr==="data-only",g=(!r.isRoot||r.options.wrapInSuspense||p)&&(r.options.wrapInSuspense??o??(((w=r.options.errorComponent)==null?void 0:w.preload)||p))?R.Suspense:ul,x=u?xj:ul,v=h?xB:ul;return a.jsxs(r.isRoot?r.options.shellComponent??ul:ul,{children:[a.jsx(kp.Provider,{value:t,children:a.jsx(g,{fallback:c,children:a.jsx(x,{getResetKey:()=>n,errorComponent:u||vj,onCatch:(S,N)=>{if(mn(S))throw S.routeId??(S.routeId=s.routeId),S;f==null||f(S,N)},children:a.jsx(v,{fallback:S=>{if(S.routeId??(S.routeId=s.routeId),!h||S.routeId&&S.routeId!==s.routeId||!S.routeId&&!r.isRoot)throw S;return R.createElement(h,S)},children:p||s._displayPending?a.jsx(H9,{fallback:c,children:a.jsx(HR,{matchId:t})}):a.jsx(HR,{matchId:t})})})})}),s.parentRouteId===Ba?a.jsxs(a.Fragment,{children:[a.jsx(SB,{resetKey:n}),e.options.scrollRestoration&&Z4?a.jsx(bB,{}):null]}):null]})}function SB({resetKey:e}){const t=Fn(),n=R.useRef(void 0);return pl(()=>{const s=t.latestLocation.href;(n.current===void 0||n.current!==s)&&(t.emit({type:"onRendered",...vl(t.stores.location.get(),t.stores.resolvedLocation.get())}),n.current=s)},[t.latestLocation.state.__TSR_key,e,t]),null}var HR=R.memo(function({matchId:t}){const n=Fn(),s=(p,g)=>{var x;return((x=n.getMatch(p.id))==null?void 0:x._nonReactive[g])??p._nonReactive[g]},r=n.stores.matchStores.get(t);r||Or();const o=Bn(r,p=>p),c=o.routeId,u=n.routesById[c],f=R.useMemo(()=>{var g;const p=(g=n.routesById[c].options.remountDeps??n.options.defaultRemountDeps)==null?void 0:g({routeId:c,loaderDeps:o.loaderDeps,params:o._strictParams,search:o._strictSearch});return p?JSON.stringify(p):void 0},[c,o.loaderDeps,o._strictParams,o._strictSearch,n.options.defaultRemountDeps,n.routesById]),h=R.useMemo(()=>{const p=u.options.component??n.options.defaultComponent;return p?a.jsx(p,{},f):a.jsx(_O,{})},[f,u.options.component,n.options.defaultComponent]);if(o._displayPending)throw s(o,"displayPendingPromise");if(o._forcePending)throw s(o,"minPendingPromise");if(o.status==="pending"){const p=u.options.pendingMinMs??n.options.defaultPendingMinMs;if(p){const g=n.getMatch(o.id);if(g&&!g._nonReactive.minPendingPromise){const x=zl();g._nonReactive.minPendingPromise=x,setTimeout(()=>{x.resolve(),g._nonReactive.minPendingPromise=void 0},p)}}throw s(o,"loadPromise")}if(o.status==="notFound")return mn(o.error)||Or(),jO(n,u,o.error);if(o.status==="redirected")throw qn(o.error)||Or(),s(o,"loadPromise");if(o.status==="error")throw o.error;return h}),_O=R.memo(function(){const t=Fn(),n=R.useContext(kp);let s,r=!1,o;{const h=n?t.stores.matchStores.get(n):void 0;[s,r]=Bn(h,p=>[p==null?void 0:p.routeId,(p==null?void 0:p.globalNotFound)??!1]),o=Bn(t.stores.matchesId,p=>p[p.findIndex(g=>g===n)+1])}const c=s?t.routesById[s]:void 0,u=t.options.defaultPendingComponent?a.jsx(t.options.defaultPendingComponent,{}):null;if(r)return c||Or(),jO(t,c,void 0);if(!o)return null;const f=a.jsx(NO,{matchId:o});return s===Ba?a.jsx(R.Suspense,{fallback:u,children:f}):f});function jB(){const e=Fn(),t=R.useRef({router:e,mounted:!1}),[n,s]=R.useState(!1),r=Bn(e.stores.isLoading,g=>g),o=Bn(e.stores.hasPending,g=>g),c=Kx(r),u=r||n||o,f=Kx(u),h=r||o,p=Kx(h);return e.startTransition=g=>{s(!0),R.startTransition(()=>{g(),s(!1)})},R.useEffect(()=>{const g=e.history.subscribe(e.load),x=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return Mr(e.latestLocation.publicHref)!==Mr(x.publicHref)&&e.commitLocation({...x,replace:!0}),()=>{g()}},[e,e.history]),pl(()=>{if(typeof window<"u"&&e.ssr||t.current.router===e&&t.current.mounted)return;t.current={router:e,mounted:!0},(async()=>{try{await e.load()}catch(x){console.error(x)}})()},[e]),pl(()=>{c&&!r&&e.emit({type:"onLoad",...vl(e.stores.location.get(),e.stores.resolvedLocation.get())})},[c,e,r]),pl(()=>{p&&!h&&e.emit({type:"onBeforeRouteMount",...vl(e.stores.location.get(),e.stores.resolvedLocation.get())})},[h,p,e]),pl(()=>{if(f&&!u){const g=vl(e.stores.location.get(),e.stores.resolvedLocation.get());e.emit({type:"onResolved",...g}),gO(()=>{e.stores.status.set("idle"),e.stores.resolvedLocation.set(e.stores.location.get())}),g.hrefChanged&&B9(e)}},[u,f,e]),null}function NB(){const e=Fn(),t=e.routesById[Ba].options.pendingComponent??e.options.defaultPendingComponent,n=t?a.jsx(t,{}):null,s=a.jsxs(typeof document<"u"&&e.ssr?ul:R.Suspense,{fallback:n,children:[a.jsx(jB,{}),a.jsx(_B,{})]});return e.options.InnerWrap?a.jsx(e.options.InnerWrap,{children:s}):s}function _B(){const e=Fn(),t=Bn(e.stores.firstId,r=>r),n=Bn(e.stores.loadedAt,r=>r),s=t?a.jsx(NO,{matchId:t}):null;return a.jsx(kp.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?s:a.jsx(xj,{getResetKey:()=>n,errorComponent:vj,onCatch:void 0,children:s})})}var CB=e=>({createMutableStore:qR,createReadonlyStore:qR,batch:gO}),kB=e=>new RB(e),RB=class extends M9{constructor(e){super(e,CB)}};function EB({router:e,children:t,...n}){eO(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});const s=a.jsx(pO.Provider,{value:e,children:t});return e.options.Wrap?a.jsx(e.options.Wrap,{children:s}):s}function AB({router:e,...t}){return a.jsx(EB,{router:e,...t,children:a.jsx(NB,{})})}function no(e){const t=Fn({warn:(e==null?void 0:e.router)===void 0}),n=(e==null?void 0:e.router)||t,s=R.useRef(void 0);return Bn(n.stores.__store,r=>{if(e!=null&&e.select){if(e.structuralSharing??n.options.defaultStructuralSharing){const o=$i(s.current,e.select(r));return s.current=o,o}return e.select(r)}return r})}var so=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Aa,Ri,Nl,$4,TB=($4=class extends so{constructor(){super();be(this,Aa);be(this,Ri);be(this,Nl);pe(this,Nl,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){K(this,Ri)||this.setEventListener(K(this,Nl))}onUnsubscribe(){var t;this.hasListeners()||((t=K(this,Ri))==null||t.call(this),pe(this,Ri,void 0))}setEventListener(t){var n;pe(this,Nl,t),(n=K(this,Ri))==null||n.call(this),pe(this,Ri,t(s=>{typeof s=="boolean"?this.setFocused(s):this.onFocus()}))}setFocused(t){K(this,Aa)!==t&&(pe(this,Aa,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof K(this,Aa)=="boolean"?K(this,Aa):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Aa=new WeakMap,Ri=new WeakMap,Nl=new WeakMap,$4),yj=new TB,MB={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Ei,fj,z4,IB=(z4=class{constructor(){be(this,Ei,MB);be(this,fj,!1)}setTimeoutProvider(e){pe(this,Ei,e)}setTimeout(e,t){return K(this,Ei).setTimeout(e,t)}clearTimeout(e){K(this,Ei).clearTimeout(e)}setInterval(e,t){return K(this,Ei).setInterval(e,t)}clearInterval(e){K(this,Ei).clearInterval(e)}},Ei=new WeakMap,fj=new WeakMap,z4),_a=new IB;function OB(e){setTimeout(e,0)}var LB=typeof window>"u"||"Deno"in globalThis;function hn(){}function PB(e,t){return typeof e=="function"?e(t):e}function fS(e){return typeof e=="number"&&e>=0&&e!==1/0}function CO(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Ui(e,t){return typeof e=="function"?e(t):e}function Jn(e,t){return typeof e=="function"?e(t):e}function UR(e,t){const{type:n="all",exact:s,fetchStatus:r,predicate:o,queryKey:c,stale:u}=e;if(c){if(s){if(t.queryHash!==bj(c,t.options))return!1}else if(!Au(t.queryKey,c))return!1}if(n!=="all"){const f=t.isActive();if(n==="active"&&!f||n==="inactive"&&f)return!1}return!(typeof u=="boolean"&&t.isStale()!==u||r&&r!==t.state.fetchStatus||o&&!o(t))}function VR(e,t){const{exact:n,status:s,predicate:r,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(n){if(Ka(t.options.mutationKey)!==Ka(o))return!1}else if(!Au(t.options.mutationKey,o))return!1}return!(s&&t.state.status!==s||r&&!r(t))}function bj(e,t){return((t==null?void 0:t.queryKeyHashFn)||Ka)(e)}function Ka(e){return JSON.stringify(e,(t,n)=>hS(n)?Object.keys(n).sort().reduce((s,r)=>(s[r]=n[r],s),{}):n)}function Au(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Au(e[n],t[n])):!1}var DB=Object.prototype.hasOwnProperty;function wj(e,t,n=0){if(e===t)return e;if(n>500)return t;const s=GR(e)&&GR(t);if(!s&&!(hS(e)&&hS(t)))return t;const o=(s?e:Object.keys(e)).length,c=s?t:Object.keys(t),u=c.length,f=s?new Array(u):{};let h=0;for(let p=0;p<u;p++){const g=s?p:c[p],x=e[g],v=t[g];if(x===v){f[g]=x,(s?p<o:DB.call(e,g))&&h++;continue}if(x===null||v===null||typeof x!="object"||typeof v!="object"){f[g]=v;continue}const b=wj(x,v,n+1);f[g]=b,b===x&&h++}return o===u&&h===o?e:f}function Tu(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function GR(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function hS(e){if(!KR(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!KR(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function KR(e){return Object.prototype.toString.call(e)==="[object Object]"}function qB(e){return new Promise(t=>{_a.setTimeout(t,e)})}function pS(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?wj(e,t):t}function $B(e,t,n=0){const s=[...e,t];return n&&s.length>n?s.slice(1):s}function zB(e,t,n=0){const s=[t,...e];return n&&s.length>n?s.slice(0,-1):s}var Sj=Symbol();function kO(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Sj?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function jj(e,t){return typeof e=="function"?e(...t):!!e}function BB(e,t,n){let s=!1,r;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(r??(r=t()),s||(s=!0,r.aborted?n():r.addEventListener("abort",n,{once:!0})),r)}),e}var Mu=(()=>{let e=()=>LB;return{isServer(){return e()},setIsServer(t){e=t}}})();function mS(){let e,t;const n=new Promise((r,o)=>{e=r,t=o});n.status="pending",n.catch(()=>{});function s(r){Object.assign(n,r),delete n.resolve,delete n.reject}return n.resolve=r=>{s({status:"fulfilled",value:r}),e(r)},n.reject=r=>{s({status:"rejected",reason:r}),t(r)},n}var FB=OB;function HB(){let e=[],t=0,n=u=>{u()},s=u=>{u()},r=FB;const o=u=>{t?e.push(u):r(()=>{n(u)})},c=()=>{const u=e;e=[],u.length&&r(()=>{s(()=>{u.forEach(f=>{n(f)})})})};return{batch:u=>{let f;t++;try{f=u()}finally{t--,t||c()}return f},batchCalls:u=>(...f)=>{o(()=>{u(...f)})},schedule:o,setNotifyFunction:u=>{n=u},setBatchNotifyFunction:u=>{s=u},setScheduler:u=>{r=u}}}var At=HB(),_l,Ai,Cl,B4,UB=(B4=class extends so{constructor(){super();be(this,_l,!0);be(this,Ai);be(this,Cl);pe(this,Cl,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t(!0),s=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",s)}}})}onSubscribe(){K(this,Ai)||this.setEventListener(K(this,Cl))}onUnsubscribe(){var t;this.hasListeners()||((t=K(this,Ai))==null||t.call(this),pe(this,Ai,void 0))}setEventListener(t){var n;pe(this,Cl,t),(n=K(this,Ai))==null||n.call(this),pe(this,Ai,t(this.setOnline.bind(this)))}setOnline(t){K(this,_l)!==t&&(pe(this,_l,t),this.listeners.forEach(s=>{s(t)}))}isOnline(){return K(this,_l)}},_l=new WeakMap,Ai=new WeakMap,Cl=new WeakMap,B4),tp=new UB;function VB(e){return Math.min(1e3*2**e,3e4)}function RO(e){return(e??"online")==="online"?tp.isOnline():!0}var gS=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function EO(e){let t=!1,n=0,s;const r=mS(),o=()=>r.status!=="pending",c=w=>{var S;if(!o()){const N=new gS(w);x(N),(S=e.onCancel)==null||S.call(e,N)}},u=()=>{t=!0},f=()=>{t=!1},h=()=>yj.isFocused()&&(e.networkMode==="always"||tp.isOnline())&&e.canRun(),p=()=>RO(e.networkMode)&&e.canRun(),g=w=>{o()||(s==null||s(),r.resolve(w))},x=w=>{o()||(s==null||s(),r.reject(w))},v=()=>new Promise(w=>{var S;s=N=>{(o()||h())&&w(N)},(S=e.onPause)==null||S.call(e)}).then(()=>{var w;s=void 0,o()||(w=e.onContinue)==null||w.call(e)}),b=()=>{if(o())return;let w;const S=n===0?e.initialPromise:void 0;try{w=S??e.fn()}catch(N){w=Promise.reject(N)}Promise.resolve(w).then(g).catch(N=>{var M;if(o())return;const C=e.retry??(Mu.isServer()?0:3),k=e.retryDelay??VB,_=typeof k=="function"?k(n,N):k,E=C===!0||typeof C=="number"&&n<C||typeof C=="function"&&C(n,N);if(t||!E){x(N);return}n++,(M=e.onFail)==null||M.call(e,n,N),qB(_).then(()=>h()?void 0:v()).then(()=>{t?x(N):b()})})};return{promise:r,status:()=>r.status,cancel:c,continue:()=>(s==null||s(),r),cancelRetry:u,continueRetry:f,canStart:p,start:()=>(p()?b():v().then(b),r)}}var Ta,F4,AO=(F4=class{constructor(){be(this,Ta)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),fS(this.gcTime)&&pe(this,Ta,_a.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Mu.isServer()?1/0:300*1e3))}clearGcTimeout(){K(this,Ta)!==void 0&&(_a.clearTimeout(K(this,Ta)),pe(this,Ta,void 0))}},Ta=new WeakMap,F4);function GB(e){return{onFetch:(t,n)=>{var p,g,x,v,b;const s=t.options,r=(x=(g=(p=t.fetchOptions)==null?void 0:p.meta)==null?void 0:g.fetchMore)==null?void 0:x.direction,o=((v=t.state.data)==null?void 0:v.pages)||[],c=((b=t.state.data)==null?void 0:b.pageParams)||[];let u={pages:[],pageParams:[]},f=0;const h=async()=>{let w=!1;const S=k=>{BB(k,()=>t.signal,()=>w=!0)},N=kO(t.options,t.fetchOptions),C=async(k,_,E)=>{if(w)return Promise.reject(t.signal.reason);if(_==null&&k.pages.length)return Promise.resolve(k);const A=(()=>{const I={client:t.client,queryKey:t.queryKey,pageParam:_,direction:E?"backward":"forward",meta:t.options.meta};return S(I),I})(),O=await N(A),{maxPages:L}=t.options,P=E?zB:$B;return{pages:P(k.pages,O,L),pageParams:P(k.pageParams,_,L)}};if(r&&o.length){const k=r==="backward",_=k?KB:YR,E={pages:o,pageParams:c},M=_(s,E);u=await C(E,M,k)}else{const k=e??o.length;do{const _=f===0?c[0]??s.initialPageParam:YR(s,u);if(f>0&&_==null)break;u=await C(u,_),f++}while(f<k)}return u};t.options.persister?t.fetchFn=()=>{var w,S;return(S=(w=t.options).persister)==null?void 0:S.call(w,h,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=h}}}function YR(e,{pages:t,pageParams:n}){const s=t.length-1;return t.length>0?e.getNextPageParam(t[s],t,n[s],n):void 0}function KB(e,{pages:t,pageParams:n}){var s;return t.length>0?(s=e.getPreviousPageParam)==null?void 0:s.call(e,t[0],t,n[0],n):void 0}var kl,Ma,Rl,fs,Ia,Xt,Qu,Oa,Zn,TO,Cr,H4,YB=(H4=class extends AO{constructor(t){super();be(this,Zn);be(this,kl);be(this,Ma);be(this,Rl);be(this,fs);be(this,Ia);be(this,Xt);be(this,Qu);be(this,Oa);pe(this,Oa,!1),pe(this,Qu,t.defaultOptions),this.setOptions(t.options),this.observers=[],pe(this,Ia,t.client),pe(this,fs,K(this,Ia).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,pe(this,Ma,QR(this.options)),this.state=t.state??K(this,Ma),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return K(this,kl)}get promise(){var t;return(t=K(this,Xt))==null?void 0:t.promise}setOptions(t){if(this.options={...K(this,Qu),...t},t!=null&&t._type&&pe(this,kl,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=QR(this.options);n.data!==void 0&&(this.setState(WR(n.data,n.dataUpdatedAt)),pe(this,Ma,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&K(this,fs).remove(this)}setData(t,n){const s=pS(this.state.data,t,this.options);return Ae(this,Zn,Cr).call(this,{data:s,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),s}setState(t){Ae(this,Zn,Cr).call(this,{type:"setState",state:t})}cancel(t){var s,r;const n=(s=K(this,Xt))==null?void 0:s.promise;return(r=K(this,Xt))==null||r.cancel(t),n?n.then(hn).catch(hn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return K(this,Ma)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>Jn(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Sj||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Ui(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!CO(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(s=>s.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=K(this,Xt))==null||n.continue()}onOnline(){var n;const t=this.observers.find(s=>s.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=K(this,Xt))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),K(this,fs).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(K(this,Xt)&&(K(this,Oa)||Ae(this,Zn,TO).call(this)?K(this,Xt).cancel({revert:!0}):K(this,Xt).cancelRetry()),this.scheduleGc()),K(this,fs).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Ae(this,Zn,Cr).call(this,{type:"invalidate"})}async fetch(t,n){var h,p,g,x,v,b,w,S,N,C,k;if(this.state.fetchStatus!=="idle"&&((h=K(this,Xt))==null?void 0:h.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(K(this,Xt))return K(this,Xt).continueRetry(),K(this,Xt).promise}if(t&&this.setOptions(t),!this.options.queryFn){const _=this.observers.find(E=>E.options.queryFn);_&&this.setOptions(_.options)}const s=new AbortController,r=_=>{Object.defineProperty(_,"signal",{enumerable:!0,get:()=>(pe(this,Oa,!0),s.signal)})},o=()=>{const _=kO(this.options,n),M=(()=>{const A={client:K(this,Ia),queryKey:this.queryKey,meta:this.meta};return r(A),A})();return pe(this,Oa,!1),this.options.persister?this.options.persister(_,M,this):_(M)},u=(()=>{const _={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:K(this,Ia),state:this.state,fetchFn:o};return r(_),_})(),f=K(this,kl)==="infinite"?GB(this.options.pages):this.options.behavior;f==null||f.onFetch(u,this),pe(this,Rl,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((p=u.fetchOptions)==null?void 0:p.meta))&&Ae(this,Zn,Cr).call(this,{type:"fetch",meta:(g=u.fetchOptions)==null?void 0:g.meta}),pe(this,Xt,EO({initialPromise:n==null?void 0:n.initialPromise,fn:u.fetchFn,onCancel:_=>{_ instanceof gS&&_.revert&&this.setState({...K(this,Rl),fetchStatus:"idle"}),s.abort()},onFail:(_,E)=>{Ae(this,Zn,Cr).call(this,{type:"failed",failureCount:_,error:E})},onPause:()=>{Ae(this,Zn,Cr).call(this,{type:"pause"})},onContinue:()=>{Ae(this,Zn,Cr).call(this,{type:"continue"})},retry:u.options.retry,retryDelay:u.options.retryDelay,networkMode:u.options.networkMode,canRun:()=>!0}));try{const _=await K(this,Xt).start();if(_===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(_),(v=(x=K(this,fs).config).onSuccess)==null||v.call(x,_,this),(w=(b=K(this,fs).config).onSettled)==null||w.call(b,_,this.state.error,this),_}catch(_){if(_ instanceof gS){if(_.silent)return K(this,Xt).promise;if(_.revert){if(this.state.data===void 0)throw _;return this.state.data}}throw Ae(this,Zn,Cr).call(this,{type:"error",error:_}),(N=(S=K(this,fs).config).onError)==null||N.call(S,_,this),(k=(C=K(this,fs).config).onSettled)==null||k.call(C,this.state.data,_,this),_}finally{this.scheduleGc()}}},kl=new WeakMap,Ma=new WeakMap,Rl=new WeakMap,fs=new WeakMap,Ia=new WeakMap,Xt=new WeakMap,Qu=new WeakMap,Oa=new WeakMap,Zn=new WeakSet,TO=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Cr=function(t){const n=s=>{switch(t.type){case"failed":return{...s,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...s,fetchStatus:"paused"};case"continue":return{...s,fetchStatus:"fetching"};case"fetch":return{...s,...MO(s.data,this.options),fetchMeta:t.meta??null};case"success":const r={...s,...WR(t.data,t.dataUpdatedAt),dataUpdateCount:s.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return pe(this,Rl,t.manual?r:void 0),r;case"error":const o=t.error;return{...s,error:o,errorUpdateCount:s.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:s.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...s,isInvalidated:!0};case"setState":return{...s,...t.state}}};this.state=n(this.state),At.batch(()=>{this.observers.forEach(s=>{s.onQueryUpdate()}),K(this,fs).notify({query:this,type:"updated",action:t})})},H4);function MO(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:RO(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function WR(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function QR(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,s=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?s??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Ln,Qe,Xu,wn,La,El,Rr,Ti,Zu,Al,Tl,Pa,Da,Mi,Ml,at,hu,xS,vS,yS,bS,wS,SS,jS,IO,U4,Nj=(U4=class extends so{constructor(t,n){super();be(this,at);be(this,Ln);be(this,Qe);be(this,Xu);be(this,wn);be(this,La);be(this,El);be(this,Rr);be(this,Ti);be(this,Zu);be(this,Al);be(this,Tl);be(this,Pa);be(this,Da);be(this,Mi);be(this,Ml,new Set);this.options=n,pe(this,Ln,t),pe(this,Ti,null),pe(this,Rr,mS()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(K(this,Qe).addObserver(this),XR(K(this,Qe),this.options)?Ae(this,at,hu).call(this):this.updateResult(),Ae(this,at,bS).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return NS(K(this,Qe),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return NS(K(this,Qe),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ae(this,at,wS).call(this),Ae(this,at,SS).call(this),K(this,Qe).removeObserver(this)}setOptions(t){const n=this.options,s=K(this,Qe);if(this.options=K(this,Ln).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Jn(this.options.enabled,K(this,Qe))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Ae(this,at,jS).call(this),K(this,Qe).setOptions(this.options),n._defaulted&&!Tu(this.options,n)&&K(this,Ln).getQueryCache().notify({type:"observerOptionsUpdated",query:K(this,Qe),observer:this});const r=this.hasListeners();r&&ZR(K(this,Qe),s,this.options,n)&&Ae(this,at,hu).call(this),this.updateResult(),r&&(K(this,Qe)!==s||Jn(this.options.enabled,K(this,Qe))!==Jn(n.enabled,K(this,Qe))||Ui(this.options.staleTime,K(this,Qe))!==Ui(n.staleTime,K(this,Qe)))&&Ae(this,at,xS).call(this);const o=Ae(this,at,vS).call(this);r&&(K(this,Qe)!==s||Jn(this.options.enabled,K(this,Qe))!==Jn(n.enabled,K(this,Qe))||o!==K(this,Mi))&&Ae(this,at,yS).call(this,o)}getOptimisticResult(t){const n=K(this,Ln).getQueryCache().build(K(this,Ln),t),s=this.createResult(n,t);return QB(this,s)&&(pe(this,wn,s),pe(this,El,this.options),pe(this,La,K(this,Qe).state)),s}getCurrentResult(){return K(this,wn)}trackResult(t,n){return new Proxy(t,{get:(s,r)=>(this.trackProp(r),n==null||n(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&K(this,Rr).status==="pending"&&K(this,Rr).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(s,r))})}trackProp(t){K(this,Ml).add(t)}getCurrentQuery(){return K(this,Qe)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=K(this,Ln).defaultQueryOptions(t),s=K(this,Ln).getQueryCache().build(K(this,Ln),n);return s.fetch().then(()=>this.createResult(s,n))}fetch(t){return Ae(this,at,hu).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),K(this,wn)))}createResult(t,n){var L;const s=K(this,Qe),r=this.options,o=K(this,wn),c=K(this,La),u=K(this,El),h=t!==s?t.state:K(this,Xu),{state:p}=t;let g={...p},x=!1,v;if(n._optimisticResults){const P=this.hasListeners(),I=!P&&XR(t,n),B=P&&ZR(t,s,n,r);(I||B)&&(g={...g,...MO(p.data,t.options)}),n._optimisticResults==="isRestoring"&&(g.fetchStatus="idle")}let{error:b,errorUpdatedAt:w,status:S}=g;v=g.data;let N=!1;if(n.placeholderData!==void 0&&v===void 0&&S==="pending"){let P;o!=null&&o.isPlaceholderData&&n.placeholderData===(u==null?void 0:u.placeholderData)?(P=o.data,N=!0):P=typeof n.placeholderData=="function"?n.placeholderData((L=K(this,Tl))==null?void 0:L.state.data,K(this,Tl)):n.placeholderData,P!==void 0&&(S="success",v=pS(o==null?void 0:o.data,P,n),x=!0)}if(n.select&&v!==void 0&&!N)if(o&&v===(c==null?void 0:c.data)&&n.select===K(this,Zu))v=K(this,Al);else try{pe(this,Zu,n.select),v=n.select(v),v=pS(o==null?void 0:o.data,v,n),pe(this,Al,v),pe(this,Ti,null)}catch(P){pe(this,Ti,P)}K(this,Ti)&&(b=K(this,Ti),v=K(this,Al),w=Date.now(),S="error");const C=g.fetchStatus==="fetching",k=S==="pending",_=S==="error",E=k&&C,M=v!==void 0,O={status:S,fetchStatus:g.fetchStatus,isPending:k,isSuccess:S==="success",isError:_,isInitialLoading:E,isLoading:E,data:v,dataUpdatedAt:g.dataUpdatedAt,error:b,errorUpdatedAt:w,failureCount:g.fetchFailureCount,failureReason:g.fetchFailureReason,errorUpdateCount:g.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:g.dataUpdateCount>h.dataUpdateCount||g.errorUpdateCount>h.errorUpdateCount,isFetching:C,isRefetching:C&&!k,isLoadingError:_&&!M,isPaused:g.fetchStatus==="paused",isPlaceholderData:x,isRefetchError:_&&M,isStale:_j(t,n),refetch:this.refetch,promise:K(this,Rr),isEnabled:Jn(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const P=O.data!==void 0,I=O.status==="error"&&!P,B=Y=>{I?Y.reject(O.error):P&&Y.resolve(O.data)},F=()=>{const Y=pe(this,Rr,O.promise=mS());B(Y)},z=K(this,Rr);switch(z.status){case"pending":t.queryHash===s.queryHash&&B(z);break;case"fulfilled":(I||O.data!==z.value)&&F();break;case"rejected":(!I||O.error!==z.reason)&&F();break}}return O}updateResult(){const t=K(this,wn),n=this.createResult(K(this,Qe),this.options);if(pe(this,La,K(this,Qe).state),pe(this,El,this.options),K(this,La).data!==void 0&&pe(this,Tl,K(this,Qe)),Tu(n,t))return;pe(this,wn,n);const s=()=>{if(!t)return!0;const{notifyOnChangeProps:r}=this.options,o=typeof r=="function"?r():r;if(o==="all"||!o&&!K(this,Ml).size)return!0;const c=new Set(o??K(this,Ml));return this.options.throwOnError&&c.add("error"),Object.keys(K(this,wn)).some(u=>{const f=u;return K(this,wn)[f]!==t[f]&&c.has(f)})};Ae(this,at,IO).call(this,{listeners:s()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ae(this,at,bS).call(this)}},Ln=new WeakMap,Qe=new WeakMap,Xu=new WeakMap,wn=new WeakMap,La=new WeakMap,El=new WeakMap,Rr=new WeakMap,Ti=new WeakMap,Zu=new WeakMap,Al=new WeakMap,Tl=new WeakMap,Pa=new WeakMap,Da=new WeakMap,Mi=new WeakMap,Ml=new WeakMap,at=new WeakSet,hu=function(t){Ae(this,at,jS).call(this);let n=K(this,Qe).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(hn)),n},xS=function(){Ae(this,at,wS).call(this);const t=Ui(this.options.staleTime,K(this,Qe));if(Mu.isServer()||K(this,wn).isStale||!fS(t))return;const s=CO(K(this,wn).dataUpdatedAt,t)+1;pe(this,Pa,_a.setTimeout(()=>{K(this,wn).isStale||this.updateResult()},s))},vS=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(K(this,Qe)):this.options.refetchInterval)??!1},yS=function(t){Ae(this,at,SS).call(this),pe(this,Mi,t),!(Mu.isServer()||Jn(this.options.enabled,K(this,Qe))===!1||!fS(K(this,Mi))||K(this,Mi)===0)&&pe(this,Da,_a.setInterval(()=>{(this.options.refetchIntervalInBackground||yj.isFocused())&&Ae(this,at,hu).call(this)},K(this,Mi)))},bS=function(){Ae(this,at,xS).call(this),Ae(this,at,yS).call(this,Ae(this,at,vS).call(this))},wS=function(){K(this,Pa)!==void 0&&(_a.clearTimeout(K(this,Pa)),pe(this,Pa,void 0))},SS=function(){K(this,Da)!==void 0&&(_a.clearInterval(K(this,Da)),pe(this,Da,void 0))},jS=function(){const t=K(this,Ln).getQueryCache().build(K(this,Ln),this.options);if(t===K(this,Qe))return;const n=K(this,Qe);pe(this,Qe,t),pe(this,Xu,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},IO=function(t){At.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(K(this,wn))}),K(this,Ln).getQueryCache().notify({query:K(this,Qe),type:"observerResultsUpdated"})})},U4);function WB(e,t){return Jn(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&Jn(t.retryOnMount,e)===!1)}function XR(e,t){return WB(e,t)||e.state.data!==void 0&&NS(e,t,t.refetchOnMount)}function NS(e,t,n){if(Jn(t.enabled,e)!==!1&&Ui(t.staleTime,e)!=="static"){const s=typeof n=="function"?n(e):n;return s==="always"||s!==!1&&_j(e,t)}return!1}function ZR(e,t,n,s){return(e!==t||Jn(s.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&_j(e,n)}function _j(e,t){return Jn(t.enabled,e)!==!1&&e.isStaleByTime(Ui(t.staleTime,e))}function QB(e,t){return!Tu(e.getCurrentResult(),t)}var Ju,Fs,dn,qa,Hs,Ni,V4,XB=(V4=class extends AO{constructor(t){super();be(this,Hs);be(this,Ju);be(this,Fs);be(this,dn);be(this,qa);pe(this,Ju,t.client),this.mutationId=t.mutationId,pe(this,dn,t.mutationCache),pe(this,Fs,[]),this.state=t.state||OO(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){K(this,Fs).includes(t)||(K(this,Fs).push(t),this.clearGcTimeout(),K(this,dn).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){pe(this,Fs,K(this,Fs).filter(n=>n!==t)),this.scheduleGc(),K(this,dn).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){K(this,Fs).length||(this.state.status==="pending"?this.scheduleGc():K(this,dn).remove(this))}continue(){var t;return((t=K(this,qa))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var c,u,f,h,p,g,x,v,b,w,S,N,C,k,_,E,M,A;const n=()=>{Ae(this,Hs,Ni).call(this,{type:"continue"})},s={client:K(this,Ju),meta:this.options.meta,mutationKey:this.options.mutationKey};pe(this,qa,EO({fn:()=>this.options.mutationFn?this.options.mutationFn(t,s):Promise.reject(new Error("No mutationFn found")),onFail:(O,L)=>{Ae(this,Hs,Ni).call(this,{type:"failed",failureCount:O,error:L})},onPause:()=>{Ae(this,Hs,Ni).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>K(this,dn).canRun(this)}));const r=this.state.status==="pending",o=!K(this,qa).canStart();try{if(r)n();else{Ae(this,Hs,Ni).call(this,{type:"pending",variables:t,isPaused:o}),K(this,dn).config.onMutate&&await K(this,dn).config.onMutate(t,this,s);const L=await((u=(c=this.options).onMutate)==null?void 0:u.call(c,t,s));L!==this.state.context&&Ae(this,Hs,Ni).call(this,{type:"pending",context:L,variables:t,isPaused:o})}const O=await K(this,qa).start();return await((h=(f=K(this,dn).config).onSuccess)==null?void 0:h.call(f,O,t,this.state.context,this,s)),await((g=(p=this.options).onSuccess)==null?void 0:g.call(p,O,t,this.state.context,s)),await((v=(x=K(this,dn).config).onSettled)==null?void 0:v.call(x,O,null,this.state.variables,this.state.context,this,s)),await((w=(b=this.options).onSettled)==null?void 0:w.call(b,O,null,t,this.state.context,s)),Ae(this,Hs,Ni).call(this,{type:"success",data:O}),O}catch(O){try{await((N=(S=K(this,dn).config).onError)==null?void 0:N.call(S,O,t,this.state.context,this,s))}catch(L){Promise.reject(L)}try{await((k=(C=this.options).onError)==null?void 0:k.call(C,O,t,this.state.context,s))}catch(L){Promise.reject(L)}try{await((E=(_=K(this,dn).config).onSettled)==null?void 0:E.call(_,void 0,O,this.state.variables,this.state.context,this,s))}catch(L){Promise.reject(L)}try{await((A=(M=this.options).onSettled)==null?void 0:A.call(M,void 0,O,t,this.state.context,s))}catch(L){Promise.reject(L)}throw Ae(this,Hs,Ni).call(this,{type:"error",error:O}),O}finally{K(this,dn).runNext(this)}}},Ju=new WeakMap,Fs=new WeakMap,dn=new WeakMap,qa=new WeakMap,Hs=new WeakSet,Ni=function(t){const n=s=>{switch(t.type){case"failed":return{...s,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...s,isPaused:!0};case"continue":return{...s,isPaused:!1};case"pending":return{...s,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...s,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...s,data:void 0,error:t.error,failureCount:s.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),At.batch(()=>{K(this,Fs).forEach(s=>{s.onMutationUpdate(t)}),K(this,dn).notify({mutation:this,type:"updated",action:t})})},V4);function OO(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Er,Ss,ed,G4,ZB=(G4=class extends so{constructor(t={}){super();be(this,Er);be(this,Ss);be(this,ed);this.config=t,pe(this,Er,new Set),pe(this,Ss,new Map),pe(this,ed,0)}build(t,n,s){const r=new XB({client:t,mutationCache:this,mutationId:++Kf(this,ed)._,options:t.defaultMutationOptions(n),state:s});return this.add(r),r}add(t){K(this,Er).add(t);const n=Jf(t);if(typeof n=="string"){const s=K(this,Ss).get(n);s?s.push(t):K(this,Ss).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(K(this,Er).delete(t)){const n=Jf(t);if(typeof n=="string"){const s=K(this,Ss).get(n);if(s)if(s.length>1){const r=s.indexOf(t);r!==-1&&s.splice(r,1)}else s[0]===t&&K(this,Ss).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Jf(t);if(typeof n=="string"){const s=K(this,Ss).get(n),r=s==null?void 0:s.find(o=>o.state.status==="pending");return!r||r===t}else return!0}runNext(t){var s;const n=Jf(t);if(typeof n=="string"){const r=(s=K(this,Ss).get(n))==null?void 0:s.find(o=>o!==t&&o.state.isPaused);return(r==null?void 0:r.continue())??Promise.resolve()}else return Promise.resolve()}clear(){At.batch(()=>{K(this,Er).forEach(t=>{this.notify({type:"removed",mutation:t})}),K(this,Er).clear(),K(this,Ss).clear()})}getAll(){return Array.from(K(this,Er))}find(t){const n={exact:!0,...t};return this.getAll().find(s=>VR(n,s))}findAll(t={}){return this.getAll().filter(n=>VR(t,n))}notify(t){At.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return At.batch(()=>Promise.all(t.map(n=>n.continue().catch(hn))))}},Er=new WeakMap,Ss=new WeakMap,ed=new WeakMap,G4);function Jf(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Ar,Ii,Pn,Tr,Lr,qh,_S,K4,JB=(K4=class extends so{constructor(n,s){super();be(this,Lr);be(this,Ar);be(this,Ii);be(this,Pn);be(this,Tr);pe(this,Ar,n),this.setOptions(s),this.bindMethods(),Ae(this,Lr,qh).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var r;const s=this.options;this.options=K(this,Ar).defaultMutationOptions(n),Tu(this.options,s)||K(this,Ar).getMutationCache().notify({type:"observerOptionsUpdated",mutation:K(this,Pn),observer:this}),s!=null&&s.mutationKey&&this.options.mutationKey&&Ka(s.mutationKey)!==Ka(this.options.mutationKey)?this.reset():((r=K(this,Pn))==null?void 0:r.state.status)==="pending"&&K(this,Pn).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=K(this,Pn))==null||n.removeObserver(this)}onMutationUpdate(n){Ae(this,Lr,qh).call(this),Ae(this,Lr,_S).call(this,n)}getCurrentResult(){return K(this,Ii)}reset(){var n;(n=K(this,Pn))==null||n.removeObserver(this),pe(this,Pn,void 0),Ae(this,Lr,qh).call(this),Ae(this,Lr,_S).call(this)}mutate(n,s){var r;return pe(this,Tr,s),(r=K(this,Pn))==null||r.removeObserver(this),pe(this,Pn,K(this,Ar).getMutationCache().build(K(this,Ar),this.options)),K(this,Pn).addObserver(this),K(this,Pn).execute(n)}},Ar=new WeakMap,Ii=new WeakMap,Pn=new WeakMap,Tr=new WeakMap,Lr=new WeakSet,qh=function(){var s;const n=((s=K(this,Pn))==null?void 0:s.state)??OO();pe(this,Ii,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},_S=function(n){At.batch(()=>{var s,r,o,c,u,f,h,p;if(K(this,Tr)&&this.hasListeners()){const g=K(this,Ii).variables,x=K(this,Ii).context,v={client:K(this,Ar),meta:this.options.meta,mutationKey:this.options.mutationKey};if((n==null?void 0:n.type)==="success"){try{(r=(s=K(this,Tr)).onSuccess)==null||r.call(s,n.data,g,x,v)}catch(b){Promise.reject(b)}try{(c=(o=K(this,Tr)).onSettled)==null||c.call(o,n.data,null,g,x,v)}catch(b){Promise.reject(b)}}else if((n==null?void 0:n.type)==="error"){try{(f=(u=K(this,Tr)).onError)==null||f.call(u,n.error,g,x,v)}catch(b){Promise.reject(b)}try{(p=(h=K(this,Tr)).onSettled)==null||p.call(h,void 0,n.error,g,x,v)}catch(b){Promise.reject(b)}}}this.listeners.forEach(g=>{g(K(this,Ii))})})},K4);function JR(e,t){const n=new Set(t);return e.filter(s=>!n.has(s))}function eF(e,t,n){const s=e.slice(0);return s[t]=n,s}var Il,Dn,Ol,$a,Xn,Oi,td,nd,sd,rd,Yt,CS,kS,LO,RS,ES,AS,Y4,tF=(Y4=class extends so{constructor(t,n,s){super();be(this,Yt);be(this,Il);be(this,Dn);be(this,Ol);be(this,$a);be(this,Xn);be(this,Oi);be(this,td);be(this,nd);be(this,sd);be(this,rd,[]);pe(this,Il,t),pe(this,$a,s),pe(this,Ol,[]),pe(this,Xn,[]),pe(this,Dn,[]),this.setQueries(n)}onSubscribe(){this.listeners.size===1&&K(this,Xn).forEach(t=>{t.subscribe(n=>{Ae(this,Yt,ES).call(this,t,n)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,K(this,Xn).forEach(t=>{t.destroy()})}setQueries(t,n){pe(this,Ol,t),pe(this,$a,n),At.batch(()=>{const s=K(this,Xn),r=Ae(this,Yt,RS).call(this,K(this,Ol));r.forEach(g=>g.observer.setOptions(g.defaultedQueryOptions));const o=r.map(g=>g.observer),c=o.map(g=>g.getCurrentResult()),u=s.length!==o.length,f=o.some((g,x)=>g!==s[x]),h=u||f,p=h?!0:c.some((g,x)=>{const v=K(this,Dn)[x];return!v||!Tu(g,v)});!h&&!p||(h&&(pe(this,rd,r),pe(this,Xn,o)),pe(this,Dn,c),this.hasListeners()&&(h&&(JR(s,o).forEach(g=>{g.destroy()}),JR(o,s).forEach(g=>{g.subscribe(x=>{Ae(this,Yt,ES).call(this,g,x)})})),Ae(this,Yt,AS).call(this)))})}getCurrentResult(){return K(this,Dn)}getQueries(){return K(this,Xn).map(t=>t.getCurrentQuery())}getObservers(){return K(this,Xn)}getOptimisticResult(t,n){const s=Ae(this,Yt,RS).call(this,t),r=s.map(c=>c.observer.getOptimisticResult(c.defaultedQueryOptions)),o=s.map(c=>c.defaultedQueryOptions.queryHash);return[r,c=>Ae(this,Yt,kS).call(this,c??r,n,o),()=>Ae(this,Yt,CS).call(this,r,s)]}},Il=new WeakMap,Dn=new WeakMap,Ol=new WeakMap,$a=new WeakMap,Xn=new WeakMap,Oi=new WeakMap,td=new WeakMap,nd=new WeakMap,sd=new WeakMap,rd=new WeakMap,Yt=new WeakSet,CS=function(t,n){return n.map((s,r)=>{const o=t[r];return s.defaultedQueryOptions.notifyOnChangeProps?o:s.observer.trackResult(o,c=>{n.forEach(u=>{u.observer.trackProp(c)})})})},kS=function(t,n,s){if(n){const r=K(this,sd),o=s!==void 0&&r!==void 0&&(r.length!==s.length||s.some((c,u)=>c!==r[u]));return(!K(this,Oi)||K(this,Dn)!==K(this,nd)||o||n!==K(this,td))&&(pe(this,td,n),pe(this,nd,K(this,Dn)),s!==void 0&&pe(this,sd,s),pe(this,Oi,wj(K(this,Oi),n(t)))),K(this,Oi)}return t},LO=function(){var t;return((t=K(this,$a))==null?void 0:t.combine)!==void 0&&K(this,Xn).some((n,s)=>{var r;return n.options.suspense&&((r=K(this,Dn)[s])==null?void 0:r.data)===void 0})},RS=function(t){const n=new Map;K(this,Xn).forEach(r=>{const o=r.options.queryHash;if(!o)return;const c=n.get(o);c?c.push(r):n.set(o,[r])});const s=[];return t.forEach(r=>{var f;const o=K(this,Il).defaultQueryOptions(r),u=((f=n.get(o.queryHash))==null?void 0:f.shift())??new Nj(K(this,Il),o);s.push({defaultedQueryOptions:o,observer:u})}),s},ES=function(t,n){const s=K(this,Xn).indexOf(t);s!==-1&&(pe(this,Dn,eF(K(this,Dn),s,n)),Ae(this,Yt,AS).call(this))},AS=function(){var t;if(this.hasListeners()){const n=Ae(this,Yt,CS).call(this,K(this,Dn),K(this,rd)),s=Ae(this,Yt,LO).call(this),r=K(this,Oi),o=s?r:Ae(this,Yt,kS).call(this,n,(t=K(this,$a))==null?void 0:t.combine);(s||r!==o)&&At.batch(()=>{this.listeners.forEach(c=>{c(K(this,Dn))})})}},Y4),Us,W4,nF=(W4=class extends so{constructor(t={}){super();be(this,Us);this.config=t,pe(this,Us,new Map)}build(t,n,s){const r=n.queryKey,o=n.queryHash??bj(r,n);let c=this.get(o);return c||(c=new YB({client:t,queryKey:r,queryHash:o,options:t.defaultQueryOptions(n),state:s,defaultOptions:t.getQueryDefaults(r)}),this.add(c)),c}add(t){K(this,Us).has(t.queryHash)||(K(this,Us).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=K(this,Us).get(t.queryHash);n&&(t.destroy(),n===t&&K(this,Us).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){At.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return K(this,Us).get(t)}getAll(){return[...K(this,Us).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(s=>UR(n,s))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(s=>UR(t,s)):n}notify(t){At.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){At.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){At.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Us=new WeakMap,W4),Et,Li,Pi,Ll,Pl,Di,Dl,ql,Q4,sF=(Q4=class{constructor(e={}){be(this,Et);be(this,Li);be(this,Pi);be(this,Ll);be(this,Pl);be(this,Di);be(this,Dl);be(this,ql);pe(this,Et,e.queryCache||new nF),pe(this,Li,e.mutationCache||new ZB),pe(this,Pi,e.defaultOptions||{}),pe(this,Ll,new Map),pe(this,Pl,new Map),pe(this,Di,0)}mount(){Kf(this,Di)._++,K(this,Di)===1&&(pe(this,Dl,yj.subscribe(async e=>{e&&(await this.resumePausedMutations(),K(this,Et).onFocus())})),pe(this,ql,tp.subscribe(async e=>{e&&(await this.resumePausedMutations(),K(this,Et).onOnline())})))}unmount(){var e,t;Kf(this,Di)._--,K(this,Di)===0&&((e=K(this,Dl))==null||e.call(this),pe(this,Dl,void 0),(t=K(this,ql))==null||t.call(this),pe(this,ql,void 0))}isFetching(e){return K(this,Et).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return K(this,Li).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=K(this,Et).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=K(this,Et).build(this,t),s=n.state.data;return s===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Ui(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(s))}getQueriesData(e){return K(this,Et).findAll(e).map(({queryKey:t,state:n})=>{const s=n.data;return[t,s]})}setQueryData(e,t,n){const s=this.defaultQueryOptions({queryKey:e}),r=K(this,Et).get(s.queryHash),o=r==null?void 0:r.state.data,c=PB(t,o);if(c!==void 0)return K(this,Et).build(this,s).setData(c,{...n,manual:!0})}setQueriesData(e,t,n){return At.batch(()=>K(this,Et).findAll(e).map(({queryKey:s})=>[s,this.setQueryData(s,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=K(this,Et).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=K(this,Et);At.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=K(this,Et);return At.batch(()=>(n.findAll(e).forEach(s=>{s.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},s=At.batch(()=>K(this,Et).findAll(e).map(r=>r.cancel(n)));return Promise.all(s).then(hn).catch(hn)}invalidateQueries(e,t={}){return At.batch(()=>(K(this,Et).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},s=At.batch(()=>K(this,Et).findAll(e).filter(r=>!r.isDisabled()&&!r.isStatic()).map(r=>{let o=r.fetch(void 0,n);return n.throwOnError||(o=o.catch(hn)),r.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(s).then(hn)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=K(this,Et).build(this,t);return n.isStaleByTime(Ui(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(hn).catch(hn)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(hn).catch(hn)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return tp.isOnline()?K(this,Li).resumePausedMutations():Promise.resolve()}getQueryCache(){return K(this,Et)}getMutationCache(){return K(this,Li)}getDefaultOptions(){return K(this,Pi)}setDefaultOptions(e){pe(this,Pi,e)}setQueryDefaults(e,t){K(this,Ll).set(Ka(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...K(this,Ll).values()],n={};return t.forEach(s=>{Au(e,s.queryKey)&&Object.assign(n,s.defaultOptions)}),n}setMutationDefaults(e,t){K(this,Pl).set(Ka(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...K(this,Pl).values()],n={};return t.forEach(s=>{Au(e,s.mutationKey)&&Object.assign(n,s.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...K(this,Pi).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=bj(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Sj&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...K(this,Pi).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){K(this,Et).clear(),K(this,Li).clear()}},Et=new WeakMap,Li=new WeakMap,Pi=new WeakMap,Ll=new WeakMap,Pl=new WeakMap,Di=new WeakMap,Dl=new WeakMap,ql=new WeakMap,Q4),PO=R.createContext(void 0),Wt=e=>{const t=R.useContext(PO);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},rF=({client:e,children:t})=>(R.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),a.jsx(PO.Provider,{value:e,children:t})),DO=R.createContext(!1),qO=()=>R.useContext(DO);DO.Provider;function iF(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var aF=R.createContext(iF()),$O=()=>R.useContext(aF),zO=(e,t,n)=>{const s=n!=null&&n.state.error&&typeof e.throwOnError=="function"?jj(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||s)&&(t.isReset()||(e.retryOnMount=!1))},BO=e=>{R.useEffect(()=>{e.clearReset()},[e])},FO=({result:e,errorResetBoundary:t,throwOnError:n,query:s,suspense:r})=>e.isError&&!t.isReset()&&!e.isFetching&&s&&(r&&e.data===void 0||jj(n,[e.error,s])),HO=e=>{if(e.suspense){const n=r=>r==="static"?r:Math.max(r??1e3,1e3),s=e.staleTime;e.staleTime=typeof s=="function"?(...r)=>n(s(...r)):n(s),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},oF=(e,t)=>e.isLoading&&e.isFetching&&!t,TS=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,MS=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Ep({queries:e,...t},n){const s=Wt(),r=qO(),o=$O(),c=R.useMemo(()=>e.map(w=>{const S=s.defaultQueryOptions(w);return S._optimisticResults=r?"isRestoring":"optimistic",S}),[e,s,r]);c.forEach(w=>{HO(w);const S=s.getQueryCache().get(w.queryHash);zO(w,o,S)}),BO(o);const[u]=R.useState(()=>new tF(s,c,t)),[f,h,p]=u.getOptimisticResult(c,t.combine),g=!r&&t.subscribed!==!1;R.useSyncExternalStore(R.useCallback(w=>g?u.subscribe(At.batchCalls(w)):hn,[u,g]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),R.useEffect(()=>{u.setQueries(c,t)},[c,t,u]);const v=f.some((w,S)=>TS(c[S],w))?f.flatMap((w,S)=>{const N=c[S];if(N&&TS(N,w)){const C=new Nj(s,N);return MS(N,C,o)}return[]}):[];if(v.length>0)throw Promise.all(v);const b=f.find((w,S)=>{const N=c[S];return N&&FO({result:w,errorResetBoundary:o,throwOnError:N.throwOnError,query:s.getQueryCache().get(N.queryHash),suspense:N.suspense})});if(b!=null&&b.error)throw b.error;return h(p())}function lF(e,t,n){var x,v,b,w;const s=qO(),r=$O(),o=Wt(),c=o.defaultQueryOptions(e);(v=(x=o.getDefaultOptions().queries)==null?void 0:x._experimental_beforeQuery)==null||v.call(x,c);const u=o.getQueryCache().get(c.queryHash);c._optimisticResults=s?"isRestoring":"optimistic",HO(c),zO(c,r,u),BO(r);const f=!o.getQueryCache().get(c.queryHash),[h]=R.useState(()=>new t(o,c)),p=h.getOptimisticResult(c),g=!s&&e.subscribed!==!1;if(R.useSyncExternalStore(R.useCallback(S=>{const N=g?h.subscribe(At.batchCalls(S)):hn;return h.updateResult(),N},[h,g]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),R.useEffect(()=>{h.setOptions(c)},[c,h]),TS(c,p))throw MS(c,h,r);if(FO({result:p,errorResetBoundary:r,throwOnError:c.throwOnError,query:u,suspense:c.suspense}))throw p.error;if((w=(b=o.getDefaultOptions().queries)==null?void 0:b._experimental_afterQuery)==null||w.call(b,c,p),c.experimental_prefetchInRender&&!Mu.isServer()&&oF(p,s)){const S=f?MS(c,h,r):u==null?void 0:u.promise;S==null||S.catch(hn).finally(()=>{h.updateResult()})}return c.notifyOnChangeProps?p:h.trackResult(p)}function Ze(e,t){return lF(e,Nj)}function vn(e,t){const n=Wt(),[s]=R.useState(()=>new JB(n,e));R.useEffect(()=>{s.setOptions(e)},[s,e]);const r=R.useSyncExternalStore(R.useCallback(c=>s.subscribe(At.batchCalls(c)),[s]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),o=R.useCallback((c,u)=>{s.mutate(c,u).catch(hn)},[s]);if(r.error&&jj(s.options.throwOnError,[r.error]))throw r.error;return{...r,mutate:o,mutateAsync:r.mutate}}const cF=new sF({defaultOptions:{queries:{staleTime:5e3,gcTime:5*6e4,retry:1,refetchOnWindowFocus:!1}}});/**
66
+ * @license lucide-react v1.14.0 - ISC
67
+ *
68
+ * This source code is licensed under the ISC license.
69
+ * See the LICENSE file in the root directory of this source tree.
70
+ */const UO=(...e)=>e.filter((t,n,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===n).join(" ").trim();/**
71
+ * @license lucide-react v1.14.0 - ISC
72
+ *
73
+ * This source code is licensed under the ISC license.
74
+ * See the LICENSE file in the root directory of this source tree.
75
+ */const uF=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
76
+ * @license lucide-react v1.14.0 - ISC
77
+ *
78
+ * This source code is licensed under the ISC license.
79
+ * See the LICENSE file in the root directory of this source tree.
80
+ */const dF=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,s)=>s?s.toUpperCase():n.toLowerCase());/**
81
+ * @license lucide-react v1.14.0 - ISC
82
+ *
83
+ * This source code is licensed under the ISC license.
84
+ * See the LICENSE file in the root directory of this source tree.
85
+ */const eE=e=>{const t=dF(e);return t.charAt(0).toUpperCase()+t.slice(1)};/**
86
+ * @license lucide-react v1.14.0 - ISC
87
+ *
88
+ * This source code is licensed under the ISC license.
89
+ * See the LICENSE file in the root directory of this source tree.
90
+ */var iv={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
91
+ * @license lucide-react v1.14.0 - ISC
92
+ *
93
+ * This source code is licensed under the ISC license.
94
+ * See the LICENSE file in the root directory of this source tree.
95
+ */const fF=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},hF=R.createContext({}),pF=()=>R.useContext(hF),mF=R.forwardRef(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:s,className:r="",children:o,iconNode:c,...u},f)=>{const{size:h=24,strokeWidth:p=2,absoluteStrokeWidth:g=!1,color:x="currentColor",className:v=""}=pF()??{},b=s??g?Number(n??p)*24/Number(t??h):n??p;return R.createElement("svg",{ref:f,...iv,width:t??h??iv.width,height:t??h??iv.height,stroke:e??x,strokeWidth:b,className:UO("lucide",v,r),...!o&&!fF(u)&&{"aria-hidden":"true"},...u},[...c.map(([w,S])=>R.createElement(w,S)),...Array.isArray(o)?o:[o]])});/**
96
+ * @license lucide-react v1.14.0 - ISC
97
+ *
98
+ * This source code is licensed under the ISC license.
99
+ * See the LICENSE file in the root directory of this source tree.
100
+ */const De=(e,t)=>{const n=R.forwardRef(({className:s,...r},o)=>R.createElement(mF,{ref:o,iconNode:t,className:UO(`lucide-${uF(eE(e))}`,`lucide-${e}`,s),...r}));return n.displayName=eE(e),n};/**
101
+ * @license lucide-react v1.14.0 - ISC
102
+ *
103
+ * This source code is licensed under the ISC license.
104
+ * See the LICENSE file in the root directory of this source tree.
105
+ */const gF=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],np=De("arrow-right",gF);/**
106
+ * @license lucide-react v1.14.0 - ISC
107
+ *
108
+ * This source code is licensed under the ISC license.
109
+ * See the LICENSE file in the root directory of this source tree.
110
+ */const xF=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],vF=De("arrow-up-right",xF);/**
111
+ * @license lucide-react v1.14.0 - ISC
112
+ *
113
+ * This source code is licensed under the ISC license.
114
+ * See the LICENSE file in the root directory of this source tree.
115
+ */const yF=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}]],VO=De("ban",yF);/**
116
+ * @license lucide-react v1.14.0 - ISC
117
+ *
118
+ * This source code is licensed under the ISC license.
119
+ * See the LICENSE file in the root directory of this source tree.
120
+ */const bF=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],wF=De("bot",bF);/**
121
+ * @license lucide-react v1.14.0 - ISC
122
+ *
123
+ * This source code is licensed under the ISC license.
124
+ * See the LICENSE file in the root directory of this source tree.
125
+ */const SF=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],jF=De("brain",SF);/**
126
+ * @license lucide-react v1.14.0 - ISC
127
+ *
128
+ * This source code is licensed under the ISC license.
129
+ * See the LICENSE file in the root directory of this source tree.
130
+ */const NF=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]],Cj=De("calendar-days",NF);/**
131
+ * @license lucide-react v1.14.0 - ISC
132
+ *
133
+ * This source code is licensed under the ISC license.
134
+ * See the LICENSE file in the root directory of this source tree.
135
+ */const _F=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Yi=De("chevron-down",_F);/**
136
+ * @license lucide-react v1.14.0 - ISC
137
+ *
138
+ * This source code is licensed under the ISC license.
139
+ * See the LICENSE file in the root directory of this source tree.
140
+ */const CF=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],kF=De("chevron-left",CF);/**
141
+ * @license lucide-react v1.14.0 - ISC
142
+ *
143
+ * This source code is licensed under the ISC license.
144
+ * See the LICENSE file in the root directory of this source tree.
145
+ */const RF=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Xs=De("chevron-right",RF);/**
146
+ * @license lucide-react v1.14.0 - ISC
147
+ *
148
+ * This source code is licensed under the ISC license.
149
+ * See the LICENSE file in the root directory of this source tree.
150
+ */const EF=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],Pr=De("circle-alert",EF);/**
151
+ * @license lucide-react v1.14.0 - ISC
152
+ *
153
+ * This source code is licensed under the ISC license.
154
+ * See the LICENSE file in the root directory of this source tree.
155
+ */const AF=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Iu=De("circle-check",AF);/**
156
+ * @license lucide-react v1.14.0 - ISC
157
+ *
158
+ * This source code is licensed under the ISC license.
159
+ * See the LICENSE file in the root directory of this source tree.
160
+ */const TF=[["path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z",key:"kmsa83"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],MF=De("circle-play",TF);/**
161
+ * @license lucide-react v1.14.0 - ISC
162
+ *
163
+ * This source code is licensed under the ISC license.
164
+ * See the LICENSE file in the root directory of this source tree.
165
+ */const IF=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],GO=De("circle-plus",IF);/**
166
+ * @license lucide-react v1.14.0 - ISC
167
+ *
168
+ * This source code is licensed under the ISC license.
169
+ * See the LICENSE file in the root directory of this source tree.
170
+ */const OF=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]],IS=De("clipboard-check",OF);/**
171
+ * @license lucide-react v1.14.0 - ISC
172
+ *
173
+ * This source code is licensed under the ISC license.
174
+ * See the LICENSE file in the root directory of this source tree.
175
+ */const LF=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],Ou=De("clock",LF);/**
176
+ * @license lucide-react v1.14.0 - ISC
177
+ *
178
+ * This source code is licensed under the ISC license.
179
+ * See the LICENSE file in the root directory of this source tree.
180
+ */const PF=[["path",{d:"M11 10.27 7 3.34",key:"16pf9h"}],["path",{d:"m11 13.73-4 6.93",key:"794ttg"}],["path",{d:"M12 22v-2",key:"1osdcq"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M14 12h8",key:"4f43i9"}],["path",{d:"m17 20.66-1-1.73",key:"eq3orb"}],["path",{d:"m17 3.34-1 1.73",key:"2wel8s"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"m20.66 17-1.73-1",key:"sg0v6f"}],["path",{d:"m20.66 7-1.73 1",key:"1ow05n"}],["path",{d:"m3.34 17 1.73-1",key:"nuk764"}],["path",{d:"m3.34 7 1.73 1",key:"1ulond"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["circle",{cx:"12",cy:"12",r:"8",key:"46899m"}]],KO=De("cog",PF);/**
181
+ * @license lucide-react v1.14.0 - ISC
182
+ *
183
+ * This source code is licensed under the ISC license.
184
+ * See the LICENSE file in the root directory of this source tree.
185
+ */const DF=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]],qF=De("file-image",DF);/**
186
+ * @license lucide-react v1.14.0 - ISC
187
+ *
188
+ * This source code is licensed under the ISC license.
189
+ * See the LICENSE file in the root directory of this source tree.
190
+ */const $F=[["path",{d:"M14.364 13.634a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506l4.013-4.009a1 1 0 0 0-3.004-3.004z",key:"ukzhwg"}],["path",{d:"M14.487 7.858A1 1 0 0 1 14 7V2",key:"1klhew"}],["path",{d:"M20 19.645V20a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l2.516 2.516",key:"rxaxab"}],["path",{d:"M8 18h1",key:"13wk12"}]],zF=De("file-pen-line",$F);/**
191
+ * @license lucide-react v1.14.0 - ISC
192
+ *
193
+ * This source code is licensed under the ISC license.
194
+ * See the LICENSE file in the root directory of this source tree.
195
+ */const BF=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],YO=De("file-text",BF);/**
196
+ * @license lucide-react v1.14.0 - ISC
197
+ *
198
+ * This source code is licensed under the ISC license.
199
+ * See the LICENSE file in the root directory of this source tree.
200
+ */const FF=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],kj=De("folder",FF);/**
201
+ * @license lucide-react v1.14.0 - ISC
202
+ *
203
+ * This source code is licensed under the ISC license.
204
+ * See the LICENSE file in the root directory of this source tree.
205
+ */const HF=[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]],UF=De("git-branch",HF);/**
206
+ * @license lucide-react v1.14.0 - ISC
207
+ *
208
+ * This source code is licensed under the ISC license.
209
+ * See the LICENSE file in the root directory of this source tree.
210
+ */const VF=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],GF=De("globe",VF);/**
211
+ * @license lucide-react v1.14.0 - ISC
212
+ *
213
+ * This source code is licensed under the ISC license.
214
+ * See the LICENSE file in the root directory of this source tree.
215
+ */const KF=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],yl=De("history",KF);/**
216
+ * @license lucide-react v1.14.0 - ISC
217
+ *
218
+ * This source code is licensed under the ISC license.
219
+ * See the LICENSE file in the root directory of this source tree.
220
+ */const YF=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]],WF=De("inbox",YF);/**
221
+ * @license lucide-react v1.14.0 - ISC
222
+ *
223
+ * This source code is licensed under the ISC license.
224
+ * See the LICENSE file in the root directory of this source tree.
225
+ */const QF=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],XF=De("layout-dashboard",QF);/**
226
+ * @license lucide-react v1.14.0 - ISC
227
+ *
228
+ * This source code is licensed under the ISC license.
229
+ * See the LICENSE file in the root directory of this source tree.
230
+ */const ZF=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],JF=De("maximize-2",ZF);/**
231
+ * @license lucide-react v1.14.0 - ISC
232
+ *
233
+ * This source code is licensed under the ISC license.
234
+ * See the LICENSE file in the root directory of this source tree.
235
+ */const eH=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M7 11h10",key:"1twpyw"}],["path",{d:"M7 15h6",key:"d9of3u"}],["path",{d:"M7 7h8",key:"af5zfr"}]],Ap=De("message-square-text",eH);/**
236
+ * @license lucide-react v1.14.0 - ISC
237
+ *
238
+ * This source code is licensed under the ISC license.
239
+ * See the LICENSE file in the root directory of this source tree.
240
+ */const tH=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],nH=De("minimize-2",tH);/**
241
+ * @license lucide-react v1.14.0 - ISC
242
+ *
243
+ * This source code is licensed under the ISC license.
244
+ * See the LICENSE file in the root directory of this source tree.
245
+ */const sH=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],Rj=De("network",sH);/**
246
+ * @license lucide-react v1.14.0 - ISC
247
+ *
248
+ * This source code is licensed under the ISC license.
249
+ * See the LICENSE file in the root directory of this source tree.
250
+ */const rH=[["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"m16 17 2 2 4-4",key:"uh5qu3"}],["path",{d:"M21 11.127V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.32-.753",key:"kpkbpo"}],["path",{d:"M3.29 7 12 12l8.71-5",key:"19ckod"}],["path",{d:"m7.5 4.27 8.997 5.148",key:"9yrvtv"}]],Ej=De("package-check",rH);/**
251
+ * @license lucide-react v1.14.0 - ISC
252
+ *
253
+ * This source code is licensed under the ISC license.
254
+ * See the LICENSE file in the root directory of this source tree.
255
+ */const iH=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],aH=De("pause",iH);/**
256
+ * @license lucide-react v1.14.0 - ISC
257
+ *
258
+ * This source code is licensed under the ISC license.
259
+ * See the LICENSE file in the root directory of this source tree.
260
+ */const oH=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],lH=De("rotate-ccw",oH);/**
261
+ * @license lucide-react v1.14.0 - ISC
262
+ *
263
+ * This source code is licensed under the ISC license.
264
+ * See the LICENSE file in the root directory of this source tree.
265
+ */const cH=[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]],WO=De("route",cH);/**
266
+ * @license lucide-react v1.14.0 - ISC
267
+ *
268
+ * This source code is licensed under the ISC license.
269
+ * See the LICENSE file in the root directory of this source tree.
270
+ */const uH=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],dH=De("search",uH);/**
271
+ * @license lucide-react v1.14.0 - ISC
272
+ *
273
+ * This source code is licensed under the ISC license.
274
+ * See the LICENSE file in the root directory of this source tree.
275
+ */const fH=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],Tp=De("send",fH);/**
276
+ * @license lucide-react v1.14.0 - ISC
277
+ *
278
+ * This source code is licensed under the ISC license.
279
+ * See the LICENSE file in the root directory of this source tree.
280
+ */const hH=[["path",{d:"m10.852 14.772-.383.923",key:"11vil6"}],["path",{d:"M13.148 14.772a3 3 0 1 0-2.296-5.544l-.383-.923",key:"1v3clb"}],["path",{d:"m13.148 9.228.383-.923",key:"t2zzyc"}],["path",{d:"m13.53 15.696-.382-.924a3 3 0 1 1-2.296-5.544",key:"1bxfiv"}],["path",{d:"m14.772 10.852.923-.383",key:"k9m8cz"}],["path",{d:"m14.772 13.148.923.383",key:"1xvhww"}],["path",{d:"M4.5 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-.5",key:"tn8das"}],["path",{d:"M4.5 14H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2h-.5",key:"1g2pve"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M6 6h.01",key:"1utrut"}],["path",{d:"m9.228 10.852-.923-.383",key:"1wtb30"}],["path",{d:"m9.228 13.148-.923.383",key:"1a830x"}]],pH=De("server-cog",hH);/**
281
+ * @license lucide-react v1.14.0 - ISC
282
+ *
283
+ * This source code is licensed under the ISC license.
284
+ * See the LICENSE file in the root directory of this source tree.
285
+ */const mH=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]],gH=De("shield-x",mH);/**
286
+ * @license lucide-react v1.14.0 - ISC
287
+ *
288
+ * This source code is licensed under the ISC license.
289
+ * See the LICENSE file in the root directory of this source tree.
290
+ */const xH=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],Aj=De("sparkles",xH);/**
291
+ * @license lucide-react v1.14.0 - ISC
292
+ *
293
+ * This source code is licensed under the ISC license.
294
+ * See the LICENSE file in the root directory of this source tree.
295
+ */const vH=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],yH=De("trash-2",vH);/**
296
+ * @license lucide-react v1.14.0 - ISC
297
+ *
298
+ * This source code is licensed under the ISC license.
299
+ * See the LICENSE file in the root directory of this source tree.
300
+ */const bH=[["path",{d:"m16 11 2 2 4-4",key:"9rsbq5"}],["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],QO=De("user-check",bH);/**
301
+ * @license lucide-react v1.14.0 - ISC
302
+ *
303
+ * This source code is licensed under the ISC license.
304
+ * See the LICENSE file in the root directory of this source tree.
305
+ */const wH=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],SH=De("user-round",wH);/**
306
+ * @license lucide-react v1.14.0 - ISC
307
+ *
308
+ * This source code is licensed under the ISC license.
309
+ * See the LICENSE file in the root directory of this source tree.
310
+ */const jH=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],NH=De("wrench",jH);/**
311
+ * @license lucide-react v1.14.0 - ISC
312
+ *
313
+ * This source code is licensed under the ISC license.
314
+ * See the LICENSE file in the root directory of this source tree.
315
+ */const _H=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],XO=De("x",_H);async function CH(){const e=await fetch("/api/rigs/summary");if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}function Ts(){return Ze({queryKey:["rigs","summary"],queryFn:CH})}async function kH(){const e=await fetch("/api/ps");if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}function ad(){return Ze({queryKey:["ps"],queryFn:kH})}function ZO(e){var t,n,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=ZO(e[t]))&&(s&&(s+=" "),s+=n)}else for(n in e)e[n]&&(s&&(s+=" "),s+=n);return s}function JO(){for(var e,t,n=0,s="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=ZO(e))&&(s&&(s+=" "),s+=t);return s}const RH=(e,t)=>{const n=new Array(e.length+t.length);for(let s=0;s<e.length;s++)n[s]=e[s];for(let s=0;s<t.length;s++)n[e.length+s]=t[s];return n},EH=(e,t)=>({classGroupId:e,validator:t}),eL=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),sp="-",tE=[],AH="arbitrary..",TH=e=>{const t=IH(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:c=>{if(c.startsWith("[")&&c.endsWith("]"))return MH(c);const u=c.split(sp),f=u[0]===""&&u.length>1?1:0;return tL(u,f,t)},getConflictingClassGroupIds:(c,u)=>{if(u){const f=s[c],h=n[c];return f?h?RH(h,f):f:h||tE}return n[c]||tE}}},tL=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const r=e[t],o=n.nextPart.get(r);if(o){const h=tL(e,t+1,o);if(h)return h}const c=n.validators;if(c===null)return;const u=t===0?e.join(sp):e.slice(t).join(sp),f=c.length;for(let h=0;h<f;h++){const p=c[h];if(p.validator(u))return p.classGroupId}},MH=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),s=t.slice(0,n);return s?AH+s:void 0})(),IH=e=>{const{theme:t,classGroups:n}=e;return OH(n,t)},OH=(e,t)=>{const n=eL();for(const s in e){const r=e[s];Tj(r,n,s,t)}return n},Tj=(e,t,n,s)=>{const r=e.length;for(let o=0;o<r;o++){const c=e[o];LH(c,t,n,s)}},LH=(e,t,n,s)=>{if(typeof e=="string"){PH(e,t,n);return}if(typeof e=="function"){DH(e,t,n,s);return}qH(e,t,n,s)},PH=(e,t,n)=>{const s=e===""?t:nL(t,e);s.classGroupId=n},DH=(e,t,n,s)=>{if($H(e)){Tj(e(s),t,n,s);return}t.validators===null&&(t.validators=[]),t.validators.push(EH(n,e))},qH=(e,t,n,s)=>{const r=Object.entries(e),o=r.length;for(let c=0;c<o;c++){const[u,f]=r[c];Tj(f,nL(t,u),n,s)}},nL=(e,t)=>{let n=e;const s=t.split(sp),r=s.length;for(let o=0;o<r;o++){const c=s[o];let u=n.nextPart.get(c);u||(u=eL(),n.nextPart.set(c,u)),n=u}return n},$H=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,zH=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),s=Object.create(null);const r=(o,c)=>{n[o]=c,t++,t>e&&(t=0,s=n,n=Object.create(null))};return{get(o){let c=n[o];if(c!==void 0)return c;if((c=s[o])!==void 0)return r(o,c),c},set(o,c){o in n?n[o]=c:r(o,c)}}},OS="!",nE=":",BH=[],sE=(e,t,n,s,r)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:s,isExternal:r}),FH=e=>{const{prefix:t,experimentalParseClassName:n}=e;let s=r=>{const o=[];let c=0,u=0,f=0,h;const p=r.length;for(let w=0;w<p;w++){const S=r[w];if(c===0&&u===0){if(S===nE){o.push(r.slice(f,w)),f=w+1;continue}if(S==="/"){h=w;continue}}S==="["?c++:S==="]"?c--:S==="("?u++:S===")"&&u--}const g=o.length===0?r:r.slice(f);let x=g,v=!1;g.endsWith(OS)?(x=g.slice(0,-1),v=!0):g.startsWith(OS)&&(x=g.slice(1),v=!0);const b=h&&h>f?h-f:void 0;return sE(o,v,x,b)};if(t){const r=t+nE,o=s;s=c=>c.startsWith(r)?o(c.slice(r.length)):sE(BH,!1,c,void 0,!0)}if(n){const r=s;s=o=>n({className:o,parseClassName:r})}return s},HH=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,s)=>{t.set(n,1e6+s)}),n=>{const s=[];let r=[];for(let o=0;o<n.length;o++){const c=n[o],u=c[0]==="[",f=t.has(c);u||f?(r.length>0&&(r.sort(),s.push(...r),r=[]),s.push(c)):r.push(c)}return r.length>0&&(r.sort(),s.push(...r)),s}},UH=e=>({cache:zH(e.cacheSize),parseClassName:FH(e),sortModifiers:HH(e),...TH(e)}),VH=/\s+/,GH=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:r,sortModifiers:o}=t,c=[],u=e.trim().split(VH);let f="";for(let h=u.length-1;h>=0;h-=1){const p=u[h],{isExternal:g,modifiers:x,hasImportantModifier:v,baseClassName:b,maybePostfixModifierPosition:w}=n(p);if(g){f=p+(f.length>0?" "+f:f);continue}let S=!!w,N=s(S?b.substring(0,w):b);if(!N){if(!S){f=p+(f.length>0?" "+f:f);continue}if(N=s(b),!N){f=p+(f.length>0?" "+f:f);continue}S=!1}const C=x.length===0?"":x.length===1?x[0]:o(x).join(":"),k=v?C+OS:C,_=k+N;if(c.indexOf(_)>-1)continue;c.push(_);const E=r(N,S);for(let M=0;M<E.length;++M){const A=E[M];c.push(k+A)}f=p+(f.length>0?" "+f:f)}return f},KH=(...e)=>{let t=0,n,s,r="";for(;t<e.length;)(n=e[t++])&&(s=sL(n))&&(r&&(r+=" "),r+=s);return r},sL=e=>{if(typeof e=="string")return e;let t,n="";for(let s=0;s<e.length;s++)e[s]&&(t=sL(e[s]))&&(n&&(n+=" "),n+=t);return n},YH=(e,...t)=>{let n,s,r,o;const c=f=>{const h=t.reduce((p,g)=>g(p),e());return n=UH(h),s=n.cache.get,r=n.cache.set,o=u,u(f)},u=f=>{const h=s(f);if(h)return h;const p=GH(f,n);return r(f,p),p};return o=c,(...f)=>o(KH(...f))},WH=[],Kt=e=>{const t=n=>n[e]||WH;return t.isThemeGetter=!0,t},rL=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,iL=/^\((?:(\w[\w-]*):)?(.+)\)$/i,QH=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,XH=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ZH=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,JH=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,e7=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,t7=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,vi=e=>QH.test(e),ze=e=>!!e&&!Number.isNaN(Number(e)),yi=e=>!!e&&Number.isInteger(Number(e)),av=e=>e.endsWith("%")&&ze(e.slice(0,-1)),jr=e=>XH.test(e),aL=()=>!0,n7=e=>ZH.test(e)&&!JH.test(e),Mj=()=>!1,s7=e=>e7.test(e),r7=e=>t7.test(e),i7=e=>!Ne(e)&&!_e(e),a7=e=>Xi(e,cL,Mj),Ne=e=>rL.test(e),wa=e=>Xi(e,uL,n7),rE=e=>Xi(e,p7,ze),o7=e=>Xi(e,fL,aL),l7=e=>Xi(e,dL,Mj),iE=e=>Xi(e,oL,Mj),c7=e=>Xi(e,lL,r7),eh=e=>Xi(e,hL,s7),_e=e=>iL.test(e),nu=e=>ro(e,uL),u7=e=>ro(e,dL),aE=e=>ro(e,oL),d7=e=>ro(e,cL),f7=e=>ro(e,lL),th=e=>ro(e,hL,!0),h7=e=>ro(e,fL,!0),Xi=(e,t,n)=>{const s=rL.exec(e);return s?s[1]?t(s[1]):n(s[2]):!1},ro=(e,t,n=!1)=>{const s=iL.exec(e);return s?s[1]?t(s[1]):n:!1},oL=e=>e==="position"||e==="percentage",lL=e=>e==="image"||e==="url",cL=e=>e==="length"||e==="size"||e==="bg-size",uL=e=>e==="length",p7=e=>e==="number",dL=e=>e==="family-name",fL=e=>e==="number"||e==="weight",hL=e=>e==="shadow",m7=()=>{const e=Kt("color"),t=Kt("font"),n=Kt("text"),s=Kt("font-weight"),r=Kt("tracking"),o=Kt("leading"),c=Kt("breakpoint"),u=Kt("container"),f=Kt("spacing"),h=Kt("radius"),p=Kt("shadow"),g=Kt("inset-shadow"),x=Kt("text-shadow"),v=Kt("drop-shadow"),b=Kt("blur"),w=Kt("perspective"),S=Kt("aspect"),N=Kt("ease"),C=Kt("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],_=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],E=()=>[..._(),_e,Ne],M=()=>["auto","hidden","clip","visible","scroll"],A=()=>["auto","contain","none"],O=()=>[_e,Ne,f],L=()=>[vi,"full","auto",...O()],P=()=>[yi,"none","subgrid",_e,Ne],I=()=>["auto",{span:["full",yi,_e,Ne]},yi,_e,Ne],B=()=>[yi,"auto",_e,Ne],F=()=>["auto","min","max","fr",_e,Ne],z=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Y=()=>["start","end","center","stretch","center-safe","end-safe"],$=()=>["auto",...O()],V=()=>[vi,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...O()],G=()=>[vi,"screen","full","dvw","lvw","svw","min","max","fit",...O()],Z=()=>[vi,"screen","full","lh","dvh","lvh","svh","min","max","fit",...O()],J=()=>[e,_e,Ne],D=()=>[..._(),aE,iE,{position:[_e,Ne]}],U=()=>["no-repeat",{repeat:["","x","y","space","round"]}],te=()=>["auto","cover","contain",d7,a7,{size:[_e,Ne]}],H=()=>[av,nu,wa],W=()=>["","none","full",h,_e,Ne],Q=()=>["",ze,nu,wa],se=()=>["solid","dashed","dotted","double"],re=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ce=()=>[ze,av,aE,iE],me=()=>["","none",b,_e,Ne],ge=()=>["none",ze,_e,Ne],ye=()=>["none",ze,_e,Ne],xe=()=>[ze,_e,Ne],Se=()=>[vi,"full",...O()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[jr],breakpoint:[jr],color:[aL],container:[jr],"drop-shadow":[jr],ease:["in","out","in-out"],font:[i7],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[jr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[jr],shadow:[jr],spacing:["px",ze],text:[jr],"text-shadow":[jr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",vi,Ne,_e,S]}],container:["container"],columns:[{columns:[ze,Ne,_e,u]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:E()}],overflow:[{overflow:M()}],"overflow-x":[{"overflow-x":M()}],"overflow-y":[{"overflow-y":M()}],overscroll:[{overscroll:A()}],"overscroll-x":[{"overscroll-x":A()}],"overscroll-y":[{"overscroll-y":A()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:L()}],"inset-x":[{"inset-x":L()}],"inset-y":[{"inset-y":L()}],start:[{"inset-s":L(),start:L()}],end:[{"inset-e":L(),end:L()}],"inset-bs":[{"inset-bs":L()}],"inset-be":[{"inset-be":L()}],top:[{top:L()}],right:[{right:L()}],bottom:[{bottom:L()}],left:[{left:L()}],visibility:["visible","invisible","collapse"],z:[{z:[yi,"auto",_e,Ne]}],basis:[{basis:[vi,"full","auto",u,...O()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ze,vi,"auto","initial","none",Ne]}],grow:[{grow:["",ze,_e,Ne]}],shrink:[{shrink:["",ze,_e,Ne]}],order:[{order:[yi,"first","last","none",_e,Ne]}],"grid-cols":[{"grid-cols":P()}],"col-start-end":[{col:I()}],"col-start":[{"col-start":B()}],"col-end":[{"col-end":B()}],"grid-rows":[{"grid-rows":P()}],"row-start-end":[{row:I()}],"row-start":[{"row-start":B()}],"row-end":[{"row-end":B()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":F()}],"auto-rows":[{"auto-rows":F()}],gap:[{gap:O()}],"gap-x":[{"gap-x":O()}],"gap-y":[{"gap-y":O()}],"justify-content":[{justify:[...z(),"normal"]}],"justify-items":[{"justify-items":[...Y(),"normal"]}],"justify-self":[{"justify-self":["auto",...Y()]}],"align-content":[{content:["normal",...z()]}],"align-items":[{items:[...Y(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Y(),{baseline:["","last"]}]}],"place-content":[{"place-content":z()}],"place-items":[{"place-items":[...Y(),"baseline"]}],"place-self":[{"place-self":["auto",...Y()]}],p:[{p:O()}],px:[{px:O()}],py:[{py:O()}],ps:[{ps:O()}],pe:[{pe:O()}],pbs:[{pbs:O()}],pbe:[{pbe:O()}],pt:[{pt:O()}],pr:[{pr:O()}],pb:[{pb:O()}],pl:[{pl:O()}],m:[{m:$()}],mx:[{mx:$()}],my:[{my:$()}],ms:[{ms:$()}],me:[{me:$()}],mbs:[{mbs:$()}],mbe:[{mbe:$()}],mt:[{mt:$()}],mr:[{mr:$()}],mb:[{mb:$()}],ml:[{ml:$()}],"space-x":[{"space-x":O()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":O()}],"space-y-reverse":["space-y-reverse"],size:[{size:V()}],"inline-size":[{inline:["auto",...G()]}],"min-inline-size":[{"min-inline":["auto",...G()]}],"max-inline-size":[{"max-inline":["none",...G()]}],"block-size":[{block:["auto",...Z()]}],"min-block-size":[{"min-block":["auto",...Z()]}],"max-block-size":[{"max-block":["none",...Z()]}],w:[{w:[u,"screen",...V()]}],"min-w":[{"min-w":[u,"screen","none",...V()]}],"max-w":[{"max-w":[u,"screen","none","prose",{screen:[c]},...V()]}],h:[{h:["screen","lh",...V()]}],"min-h":[{"min-h":["screen","lh","none",...V()]}],"max-h":[{"max-h":["screen","lh",...V()]}],"font-size":[{text:["base",n,nu,wa]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,h7,o7]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",av,Ne]}],"font-family":[{font:[u7,l7,t]}],"font-features":[{"font-features":[Ne]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[r,_e,Ne]}],"line-clamp":[{"line-clamp":[ze,"none",_e,rE]}],leading:[{leading:[o,...O()]}],"list-image":[{"list-image":["none",_e,Ne]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",_e,Ne]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:J()}],"text-color":[{text:J()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...se(),"wavy"]}],"text-decoration-thickness":[{decoration:[ze,"from-font","auto",_e,wa]}],"text-decoration-color":[{decoration:J()}],"underline-offset":[{"underline-offset":[ze,"auto",_e,Ne]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:O()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",_e,Ne]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",_e,Ne]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:D()}],"bg-repeat":[{bg:U()}],"bg-size":[{bg:te()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},yi,_e,Ne],radial:["",_e,Ne],conic:[yi,_e,Ne]},f7,c7]}],"bg-color":[{bg:J()}],"gradient-from-pos":[{from:H()}],"gradient-via-pos":[{via:H()}],"gradient-to-pos":[{to:H()}],"gradient-from":[{from:J()}],"gradient-via":[{via:J()}],"gradient-to":[{to:J()}],rounded:[{rounded:W()}],"rounded-s":[{"rounded-s":W()}],"rounded-e":[{"rounded-e":W()}],"rounded-t":[{"rounded-t":W()}],"rounded-r":[{"rounded-r":W()}],"rounded-b":[{"rounded-b":W()}],"rounded-l":[{"rounded-l":W()}],"rounded-ss":[{"rounded-ss":W()}],"rounded-se":[{"rounded-se":W()}],"rounded-ee":[{"rounded-ee":W()}],"rounded-es":[{"rounded-es":W()}],"rounded-tl":[{"rounded-tl":W()}],"rounded-tr":[{"rounded-tr":W()}],"rounded-br":[{"rounded-br":W()}],"rounded-bl":[{"rounded-bl":W()}],"border-w":[{border:Q()}],"border-w-x":[{"border-x":Q()}],"border-w-y":[{"border-y":Q()}],"border-w-s":[{"border-s":Q()}],"border-w-e":[{"border-e":Q()}],"border-w-bs":[{"border-bs":Q()}],"border-w-be":[{"border-be":Q()}],"border-w-t":[{"border-t":Q()}],"border-w-r":[{"border-r":Q()}],"border-w-b":[{"border-b":Q()}],"border-w-l":[{"border-l":Q()}],"divide-x":[{"divide-x":Q()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Q()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...se(),"hidden","none"]}],"divide-style":[{divide:[...se(),"hidden","none"]}],"border-color":[{border:J()}],"border-color-x":[{"border-x":J()}],"border-color-y":[{"border-y":J()}],"border-color-s":[{"border-s":J()}],"border-color-e":[{"border-e":J()}],"border-color-bs":[{"border-bs":J()}],"border-color-be":[{"border-be":J()}],"border-color-t":[{"border-t":J()}],"border-color-r":[{"border-r":J()}],"border-color-b":[{"border-b":J()}],"border-color-l":[{"border-l":J()}],"divide-color":[{divide:J()}],"outline-style":[{outline:[...se(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ze,_e,Ne]}],"outline-w":[{outline:["",ze,nu,wa]}],"outline-color":[{outline:J()}],shadow:[{shadow:["","none",p,th,eh]}],"shadow-color":[{shadow:J()}],"inset-shadow":[{"inset-shadow":["none",g,th,eh]}],"inset-shadow-color":[{"inset-shadow":J()}],"ring-w":[{ring:Q()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:J()}],"ring-offset-w":[{"ring-offset":[ze,wa]}],"ring-offset-color":[{"ring-offset":J()}],"inset-ring-w":[{"inset-ring":Q()}],"inset-ring-color":[{"inset-ring":J()}],"text-shadow":[{"text-shadow":["none",x,th,eh]}],"text-shadow-color":[{"text-shadow":J()}],opacity:[{opacity:[ze,_e,Ne]}],"mix-blend":[{"mix-blend":[...re(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":re()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[ze]}],"mask-image-linear-from-pos":[{"mask-linear-from":ce()}],"mask-image-linear-to-pos":[{"mask-linear-to":ce()}],"mask-image-linear-from-color":[{"mask-linear-from":J()}],"mask-image-linear-to-color":[{"mask-linear-to":J()}],"mask-image-t-from-pos":[{"mask-t-from":ce()}],"mask-image-t-to-pos":[{"mask-t-to":ce()}],"mask-image-t-from-color":[{"mask-t-from":J()}],"mask-image-t-to-color":[{"mask-t-to":J()}],"mask-image-r-from-pos":[{"mask-r-from":ce()}],"mask-image-r-to-pos":[{"mask-r-to":ce()}],"mask-image-r-from-color":[{"mask-r-from":J()}],"mask-image-r-to-color":[{"mask-r-to":J()}],"mask-image-b-from-pos":[{"mask-b-from":ce()}],"mask-image-b-to-pos":[{"mask-b-to":ce()}],"mask-image-b-from-color":[{"mask-b-from":J()}],"mask-image-b-to-color":[{"mask-b-to":J()}],"mask-image-l-from-pos":[{"mask-l-from":ce()}],"mask-image-l-to-pos":[{"mask-l-to":ce()}],"mask-image-l-from-color":[{"mask-l-from":J()}],"mask-image-l-to-color":[{"mask-l-to":J()}],"mask-image-x-from-pos":[{"mask-x-from":ce()}],"mask-image-x-to-pos":[{"mask-x-to":ce()}],"mask-image-x-from-color":[{"mask-x-from":J()}],"mask-image-x-to-color":[{"mask-x-to":J()}],"mask-image-y-from-pos":[{"mask-y-from":ce()}],"mask-image-y-to-pos":[{"mask-y-to":ce()}],"mask-image-y-from-color":[{"mask-y-from":J()}],"mask-image-y-to-color":[{"mask-y-to":J()}],"mask-image-radial":[{"mask-radial":[_e,Ne]}],"mask-image-radial-from-pos":[{"mask-radial-from":ce()}],"mask-image-radial-to-pos":[{"mask-radial-to":ce()}],"mask-image-radial-from-color":[{"mask-radial-from":J()}],"mask-image-radial-to-color":[{"mask-radial-to":J()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":_()}],"mask-image-conic-pos":[{"mask-conic":[ze]}],"mask-image-conic-from-pos":[{"mask-conic-from":ce()}],"mask-image-conic-to-pos":[{"mask-conic-to":ce()}],"mask-image-conic-from-color":[{"mask-conic-from":J()}],"mask-image-conic-to-color":[{"mask-conic-to":J()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:D()}],"mask-repeat":[{mask:U()}],"mask-size":[{mask:te()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",_e,Ne]}],filter:[{filter:["","none",_e,Ne]}],blur:[{blur:me()}],brightness:[{brightness:[ze,_e,Ne]}],contrast:[{contrast:[ze,_e,Ne]}],"drop-shadow":[{"drop-shadow":["","none",v,th,eh]}],"drop-shadow-color":[{"drop-shadow":J()}],grayscale:[{grayscale:["",ze,_e,Ne]}],"hue-rotate":[{"hue-rotate":[ze,_e,Ne]}],invert:[{invert:["",ze,_e,Ne]}],saturate:[{saturate:[ze,_e,Ne]}],sepia:[{sepia:["",ze,_e,Ne]}],"backdrop-filter":[{"backdrop-filter":["","none",_e,Ne]}],"backdrop-blur":[{"backdrop-blur":me()}],"backdrop-brightness":[{"backdrop-brightness":[ze,_e,Ne]}],"backdrop-contrast":[{"backdrop-contrast":[ze,_e,Ne]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ze,_e,Ne]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ze,_e,Ne]}],"backdrop-invert":[{"backdrop-invert":["",ze,_e,Ne]}],"backdrop-opacity":[{"backdrop-opacity":[ze,_e,Ne]}],"backdrop-saturate":[{"backdrop-saturate":[ze,_e,Ne]}],"backdrop-sepia":[{"backdrop-sepia":["",ze,_e,Ne]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":O()}],"border-spacing-x":[{"border-spacing-x":O()}],"border-spacing-y":[{"border-spacing-y":O()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",_e,Ne]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ze,"initial",_e,Ne]}],ease:[{ease:["linear","initial",N,_e,Ne]}],delay:[{delay:[ze,_e,Ne]}],animate:[{animate:["none",C,_e,Ne]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[w,_e,Ne]}],"perspective-origin":[{"perspective-origin":E()}],rotate:[{rotate:ge()}],"rotate-x":[{"rotate-x":ge()}],"rotate-y":[{"rotate-y":ge()}],"rotate-z":[{"rotate-z":ge()}],scale:[{scale:ye()}],"scale-x":[{"scale-x":ye()}],"scale-y":[{"scale-y":ye()}],"scale-z":[{"scale-z":ye()}],"scale-3d":["scale-3d"],skew:[{skew:xe()}],"skew-x":[{"skew-x":xe()}],"skew-y":[{"skew-y":xe()}],transform:[{transform:[_e,Ne,"","none","gpu","cpu"]}],"transform-origin":[{origin:E()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Se()}],"translate-x":[{"translate-x":Se()}],"translate-y":[{"translate-y":Se()}],"translate-z":[{"translate-z":Se()}],"translate-none":["translate-none"],accent:[{accent:J()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:J()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",_e,Ne]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mbs":[{"scroll-mbs":O()}],"scroll-mbe":[{"scroll-mbe":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pbs":[{"scroll-pbs":O()}],"scroll-pbe":[{"scroll-pbe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",_e,Ne]}],fill:[{fill:["none",...J()]}],"stroke-w":[{stroke:[ze,nu,wa,rE]}],stroke:[{stroke:["none",...J()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},g7=YH(m7);function he(...e){return g7(JO(e))}const x7={running:"running",needs_input:"needs input",idle:"idle",unknown:"unknown"},v7={running:"bg-emerald-500",needs_input:"bg-amber-500",idle:"bg-slate-400",unknown:"bg-stone-300"},y7={running:"text-emerald-600",needs_input:"text-amber-600",idle:"text-slate-500",unknown:"text-stone-400"};function Ij(e){return e?e.state:"unknown"}function Oj(e){return x7[e]}function pL(e){return v7[e]}function b7(e){return y7[e]}function mL(e){return e==="running"?"activity-pulse-running":""}const oE=30;function Lj(e){if(!e)return!1;if(typeof e.staleness=="number")return e.staleness>oE;if(!e.sampledAt)return!1;const t=Date.parse(e.sampledAt);return Number.isNaN(t)?!1:(Date.now()-t)/1e3>oE}function w7(e){return e.length<=8?e:e.slice(-8)}async function S7(e,t){const n=new URLSearchParams({filter:e});t&&n.set("boundToWorkflow",`${t.specName}:${t.specVersion}`);const s=await fetch(`/api/slices?${n.toString()}`);if(s.status===503){const r=await s.json().catch(()=>({}));return{unavailable:!0,error:r.error??"slices_indexer_unavailable",hint:r.hint}}if(!s.ok)throw new Error(`HTTP ${s.status}`);return await s.json()}function Mp(e,t=null){return Ze({queryKey:["slices","list",e,t?`${t.specName}:${t.specVersion}`:"all"],queryFn:()=>S7(e,t),staleTime:3e4})}async function gL(e){const t=await fetch(`/api/slices/${encodeURIComponent(e)}`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return await t.json()}function j7(e){return Ze({queryKey:["slices","detail",e],queryFn:()=>gL(e),enabled:!!e,staleTime:3e4})}function xL(e){const t=R.useMemo(()=>Array.from(new Set(e.filter(s=>s.length>0))).sort(),[e]),n=Ep({queries:t.map(s=>({queryKey:["slices","detail",s],queryFn:()=>gL(s),staleTime:3e4}))});return R.useMemo(()=>{const s=new Map,r=[];return t.forEach((o,c)=>{var f,h;const u=(f=n[c])==null?void 0:f.data;u?s.set(o,u):(h=n[c])!=null&&h.isError&&r.push(o)}),{itemsByName:s,isFetching:n.some(o=>o.isFetching),missingNames:r}},[n,t])}async function N7(e,t){const n=await fetch(`/api/slices/${encodeURIComponent(e)}/doc/${encodeURI(t)}`);if(!n.ok)throw new Error(`HTTP ${n.status}`);return await n.json()}function _7(e,t){return Ze({queryKey:["slices","doc",e,t],queryFn:()=>N7(e,t),enabled:!!e&&!!t,staleTime:6e4})}function yu(e,t){return`/api/slices/${encodeURIComponent(e)}/proof-asset/${encodeURI(t)}`}async function C7(e){const t=await fetch(`/api/queue/${encodeURIComponent(e)}`);if(t.status===404)return null;if(!t.ok)throw new Error(`HTTP ${t.status}`);return await t.json()}function Pj(e){const t=R.useMemo(()=>Array.from(new Set(e.filter(s=>s.length>0))).sort(),[e]),n=Ep({queries:t.map(s=>({queryKey:["queue","item",s],queryFn:()=>C7(s),staleTime:3e4}))});return R.useMemo(()=>{const s=new Map,r=[];return t.forEach((o,c)=>{var f,h;const u=(f=n[c])==null?void 0:f.data;u?s.set(o,u):((h=n[c])==null?void 0:h.status)==="success"&&r.push(o)}),{itemsById:s,isFetching:n.some(o=>o.isFetching),missingIds:r}},[n,t])}async function k7(){const e=await fetch("/api/config");if(!e.ok){const t=await e.json().catch(()=>({}));throw new Error(t.error??`HTTP ${e.status}`)}return e.json()}function io(){return Ze({queryKey:["settings","all"],queryFn:k7,staleTime:0})}function vL(){const e=Wt();return vn({mutationFn:async t=>{const n=await fetch(`/api/config/${encodeURIComponent(t.key)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:t.value})});if(!n.ok){const s=await n.json().catch(()=>({}));throw new Error(s.error??`HTTP ${n.status}`)}return n.json()},onSuccess:()=>{e.invalidateQueries({queryKey:["settings"]})}})}function R7(){const e=Wt();return vn({mutationFn:async t=>{const n=await fetch(`/api/config/${encodeURIComponent(t)}`,{method:"DELETE"});if(!n.ok){const s=await n.json().catch(()=>({}));throw new Error(s.error??`HTTP ${n.status}`)}return n.json()},onSuccess:()=>{e.invalidateQueries({queryKey:["settings"]})}})}function E7(){const e=Wt();return vn({mutationFn:async t=>{const n=await fetch("/api/config/init-workspace",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){const s=await n.json().catch(()=>({}));throw new Error(s.error??`HTTP ${n.status}`)}return n.json()},onSuccess:()=>{e.invalidateQueries({queryKey:["settings"]})}})}function A7(e){if(!e)return"";const t=e.replace(/\/+$/,""),n=t.lastIndexOf("/");return n===-1?t:t.slice(n+1)}function Dj(){const{data:e,isLoading:t,error:n}=io();if(n||!e||!e.settings||typeof e.settings!="object")return{name:null,root:null,settingsAvailable:!1,isLoading:t};const s=e.settings["workspace.root"],r=s==null?void 0:s.value,o=typeof r=="string"&&r.length>0?r:null;return{name:o?A7(o):null,root:o,settingsAvailable:!0,isLoading:t}}async function T7(){const e=await fetch("/api/files/roots");if(e.status===503){const t=await e.json().catch(()=>({}));return{unavailable:!0,error:t.error??"files_routes_unavailable",hint:t.hint}}if(!e.ok)throw new Error(`HTTP ${e.status}`);return await e.json()}function yL(){return Ze({queryKey:["files","roots"],queryFn:T7,staleTime:6e4})}async function M7(e,t){const n=await fetch(`/api/files/list?root=${encodeURIComponent(e)}&path=${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`HTTP ${n.status}`);return await n.json()}function I7(e,t){return Ze({queryKey:["files","list",e,t],queryFn:()=>M7(e,t??""),enabled:!!e,staleTime:15e3})}async function O7(e,t){const n=await fetch(`/api/files/read?root=${encodeURIComponent(e)}&path=${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`HTTP ${n.status}`);return await n.json()}function bL(e,t){return Ze({queryKey:["files","read",e,t],queryFn:()=>O7(e,t),enabled:!!e&&!!t,staleTime:0})}function L7(e,t){return`/api/files/asset?root=${encodeURIComponent(e)}&path=${encodeURIComponent(t)}`}function P7(e,t){const n=e.replace(/\/+$/,""),s=t.replace(/\/+$/,"");return s===n?!0:s.startsWith(n+"/")}function D7(e,t){const n=e.replace(/\/+$/,""),s=t.replace(/\/+$/,"");return s===n?"":s.startsWith(n+"/")?s.slice(n.length+1):s}function q7(){var h;const e=Dj(),t=yL(),n=t.data;let s=null;if(e.root&&n&&"roots"in n){const p=n.roots.find(g=>g.path===e.root);if(p)s=p;else{const x=n.roots.filter(v=>e.root&&P7(v.path,e.root)).sort((v,b)=>b.path.length-v.path.length)[0];x&&(s=x)}}const r=s&&e.root?(()=>{const p=D7(s.path,e.root);return p?`${p}/missions`:"missions"})():null,o=I7(s?s.name:null,r),c=e.isLoading||t.isLoading||s!==null&&o.isLoading;return!e.settingsAvailable&&!e.isLoading?{missions:[],unavailable:!0,isLoading:c,hint:"Daemon does not expose /api/config (likely v0.2.0). Upgrade to v0.3.0+ for live mission discovery."}:!e.root&&!e.isLoading?{missions:[],unavailable:!0,isLoading:c,hint:"Configure a workspace root: rig config set workspace.root <path>"}:!s&&!t.isLoading?{missions:[],unavailable:!0,isLoading:c,hint:`No allowlist root contains workspace.root (${e.root}). Set OPENRIG_FILES_ALLOWLIST=<name>:<path> to register.`}:o.isError?{missions:[],unavailable:!0,isLoading:c,hint:`Could not list ${r} under ${s==null?void 0:s.name}.`}:{missions:(((h=o.data)==null?void 0:h.entries)??[]).filter(p=>p.type==="dir").map(p=>({name:p.name,root:s.name,path:r?`${r}/${p.name}`:p.name})).sort((p,g)=>p.name.localeCompare(g.name)),unavailable:!1,isLoading:c,hint:null}}const $7={active:"border-success text-success",paused:"border-stone-400 text-stone-500",shipped:"border-secondary text-secondary",blocked:"border-warning text-warning",unknown:"border-stone-300 text-stone-400"},z7={active:"bg-success",paused:"bg-stone-400",shipped:"bg-secondary",blocked:"bg-warning",unknown:"bg-stone-300"};function B7({status:e,label:t,className:n,testId:s}){return a.jsxs("span",{"data-testid":s??`mission-status-${e}`,role:"status","aria-label":t??e,className:he("inline-flex items-center gap-1 px-1.5 py-0.5 border font-mono text-[9px] uppercase tracking-wide",$7[e],n),children:[a.jsx("span",{className:he("w-1.5 h-1.5 rounded-full",z7[e]),"aria-hidden":"true"}),t??e]})}function F7(e){var o;if(!e)return"unknown";const t=e.match(/^---\s*\n([\s\S]*?)\n---/),s=((t==null?void 0:t[1])??e).match(/^\s*status:\s*([a-z_-]+)\s*$/im),r=((o=s==null?void 0:s[1])==null?void 0:o.toLowerCase())??"";return r==="active"||r==="in_progress"||r==="in-progress"?"active":r==="paused"||r==="on_hold"||r==="on-hold"?"paused":r==="shipped"||r==="complete"||r==="completed"||r==="done"?"shipped":r==="blocked"||r==="stalled"?"blocked":"unknown"}function H7(e,t){const n=e&&t?`${t}/PROGRESS.md`:null,s=bL(e,n);return!e||!t?{status:"unknown",isLoading:!1,unavailable:!0,mtime:null}:s.isLoading?{status:"unknown",isLoading:!0,unavailable:!1,mtime:null}:s.isError||!s.data?{status:"unknown",isLoading:!1,unavailable:!0,mtime:null}:{status:F7(s.data.content),isLoading:!1,unavailable:!1,mtime:s.data.mtime??null}}const U7=2160*60*1e3;function wL(e){return{name:e.name,displayName:e.displayName,status:e.status,rawStatus:e.rawStatus,qitemCount:e.qitemCount,hasProofPacket:e.hasProofPacket,lastActivityAt:e.lastActivityAt,missionId:e.missionId,railItem:e.railItem}}function V7(e,t=Date.now()){if(!e)return!1;const n=Date.parse(e);return Number.isNaN(n)?!1:t-n<=U7}function Lu(e,t=Date.now()){return e.qitemCount>0||e.status==="blocked"?!0:e.status==="active"||e.status==="draft"?!e.lastActivityAt||V7(e.lastActivityAt,t):!1}function $h(e){if(e.length===0)return"unknown";const t=Date.now();return e.some(n=>n.status==="blocked"&&Lu(n,t))?"blocked":e.some(n=>Lu(n,t))?"active":e.every(n=>n.status==="done")?"shipped":"unknown"}function G7(e){return e.slices.some(t=>Lu(t))||e.slices.length===0&&e.status!=="shipped"?"current":"archive"}function LS(e){return e.slices.reduce((t,n)=>{if(!n.lastActivityAt)return t;const s=Date.parse(n.lastActivityAt);return Number.isNaN(s)?t:Math.max(t,s)},0)}function lE(e,t){const n=LS(t)-LS(e);return n!==0?n:e.label.localeCompare(t.label)}function SL(e){const t=[],n=[];for(const s of e)G7(s)==="current"?t.push(s):n.push(s);return{current:t.sort(lE),archive:n.sort(lE)}}function jL(e){const t=[];e.qitemCount>0&&t.push(`${e.qitemCount} qitem${e.qitemCount===1?"":"s"}`);const n=(e.status==="active"||e.status==="draft")&&!Lu(e)?`stale ${e.status}`:e.status;return e.rawStatus&&e.rawStatus!==e.status?t.push(`${n} from ${e.rawStatus}`):t.push(n),e.hasProofPacket&&t.push("proof"),t.join(" · ")}function K7({mission:e}){const t=H7(e.fsRoot??null,e.fsPath??null),n=e.fsRoot&&!t.unavailable&&!t.isLoading?t.status:e.status;return a.jsx(B7,{status:n,testId:`project-mission-${e.id}-badge`})}function Y7(){const{data:e}=Mp("all"),t=Dj(),n=q7(),[s,r]=R.useState({workspace:!0}),o=v=>r(b=>({...b,[v]:!b[v]})),c=e&&"slices"in e?e.slices:[],u=R.useMemo(()=>{const v=new Map;for(const b of c){const w=b.missionId??b.railItem??"unsorted";v.has(w)||v.set(w,[]),v.get(w).push(wL(b))}return v},[c]),f=R.useMemo(()=>{if(!n.unavailable&&n.missions.length>0){const v=new Set,b=n.missions.map(w=>{const S=u.get(w.name)??[];return S.length>0&&v.add(w.name),{id:w.name,label:w.name,status:$h(S),slices:S,fsRoot:w.root,fsPath:w.path}});for(const[w,S]of u.entries())v.has(w)||b.push({id:w,label:w==="unsorted"?"Unsorted":w,status:$h(S),slices:S});return b}return Array.from(u.entries()).map(([v,b])=>({id:v,label:v==="unsorted"?"Unsorted":v,status:$h(b),slices:b}))},[n.unavailable,n.missions,u]),h=R.useMemo(()=>SL(f),[f]);if(!t.isLoading&&t.name===null)return a.jsx("div",{"data-testid":"project-tree-view",className:"flex-1 overflow-y-auto py-3 px-3",children:a.jsxs("div",{"data-testid":"project-no-workspace",className:"border border-outline-variant bg-surface-low px-3 py-3 font-mono text-[10px]",children:[a.jsx("div",{className:"text-stone-900 uppercase tracking-wide font-bold mb-1",children:"No workspace connected"}),a.jsx("p",{className:"text-on-surface-variant mb-2",children:"Configure a workspace root to browse missions and slices."}),a.jsx(Ye,{to:"/settings","data-testid":"project-no-workspace-cta",className:"inline-flex items-center text-stone-900 hover:underline uppercase",children:"Open settings →"})]})});const p=t.name??"loading…",g=(v,b=!1)=>s[v]??b,x=(v,b)=>{const w=b==="current",S=g(`mission-${v.id}`,w);return a.jsxs("li",{"data-testid":`project-mission-${v.id}`,"data-mission-bucket":b,children:[a.jsxs("div",{className:"w-full flex items-center gap-1 px-2 py-0.5 hover:bg-surface-low text-left",children:[a.jsx("button",{type:"button","aria-label":`${S?"Collapse":"Expand"} ${v.label}`,onClick:()=>r(N=>({...N,[`mission-${v.id}`]:!S})),className:"flex h-4 w-4 items-center justify-center","data-testid":`project-mission-toggle-${v.id}`,children:S?a.jsx(Yi,{className:"h-3 w-3 text-on-surface-variant"}):a.jsx(Xs,{className:"h-3 w-3 text-on-surface-variant"})}),a.jsx(Ye,{to:"/project/mission/$missionId",params:{missionId:v.id},"data-testid":`project-mission-link-${v.id}`,className:"font-mono text-[11px] text-stone-900 flex-1 truncate hover:underline",children:v.label}),a.jsx(K7,{mission:v})]}),S?a.jsx("ul",{className:"ml-4 border-l border-stone-200",children:v.slices.length===0?a.jsx("li",{className:"px-2 py-0.5 font-mono text-[10px] text-on-surface-variant italic",children:"No slices."}):v.slices.map(N=>{const C=Lu(N)?"current":"archive";return a.jsx("li",{"data-slice-bucket":C,children:a.jsxs(Ye,{to:"/project/slice/$sliceId",params:{sliceId:N.name},"data-testid":`project-slice-${N.name}`,className:"block px-2 py-1 font-mono text-xs text-on-surface hover:text-stone-900 hover:bg-surface-low",children:[a.jsx("span",{className:"block truncate",children:N.displayName}),a.jsx("span",{"data-testid":`project-slice-${N.name}-meta`,className:"block truncate text-[9px] uppercase tracking-[0.12em] text-stone-500",children:jL(N)})]})},N.name)})}):null]},v.id)};return a.jsx("div",{"data-testid":"project-tree-view",className:"flex-1 overflow-y-auto py-2",children:a.jsx("ul",{children:a.jsxs("li",{"data-testid":"project-workspace-node",children:[a.jsxs("button",{type:"button",onClick:()=>o("workspace"),className:"w-full flex items-center gap-1 px-2 py-1 hover:bg-surface-low text-left","data-testid":"project-workspace-toggle",children:[s.workspace?a.jsx(Yi,{className:"h-3 w-3 text-on-surface-variant"}):a.jsx(Xs,{className:"h-3 w-3 text-on-surface-variant"}),a.jsx("span",{"data-testid":"project-workspace-label",className:"font-mono text-[11px] uppercase tracking-wide text-stone-900 flex-1",children:p}),a.jsx(Ye,{to:"/project","data-testid":"project-workspace-link",onClick:v=>v.stopPropagation(),className:"font-mono text-[9px] uppercase tracking-wide text-on-surface-variant hover:text-stone-900",children:"open"})]}),g("workspace")?a.jsxs("ul",{className:"ml-4 border-l border-stone-200",children:[n.unavailable&&n.hint?a.jsx("li",{"data-testid":"project-discovery-degraded",className:"px-2 py-1 font-mono text-[9px] text-on-surface-variant italic",title:n.hint,children:"Workspace missions folder unavailable; showing indexed slice grouping. Expected workspace/missions/<mission>/slices/<slice>."}):null,f.length===0?a.jsx("li",{className:"px-2 py-1 font-mono text-[10px] text-on-surface-variant italic",children:"No missions yet."}):a.jsxs(a.Fragment,{children:[a.jsxs("li",{"data-testid":"project-mission-section-current",className:"px-2 pt-2 pb-1 font-mono text-[9px] uppercase tracking-[0.16em] text-stone-500",children:["Current Work · ",h.current.length]}),h.current.length>0?h.current.map(v=>x(v,"current")):a.jsx("li",{"data-testid":"project-mission-section-current-empty",className:"px-2 py-1 font-mono text-[10px] text-on-surface-variant italic",children:"No current work."}),a.jsxs("li",{"data-testid":"project-mission-section-archive",className:"px-2 pt-3 pb-1 font-mono text-[9px] uppercase tracking-[0.16em] text-stone-500",children:["Archive · ",h.archive.length]}),h.archive.length>0?h.archive.map(v=>x(v,"archive")):a.jsx("li",{"data-testid":"project-mission-section-archive-empty",className:"px-2 py-1 font-mono text-[10px] text-on-surface-variant italic",children:"No archived work."})]})]}):null]})})})}async function W7(e){const t=e?`/api/specs/library?kind=${e}`:"/api/specs/library",n=await fetch(t);if(!n.ok)throw new Error(`HTTP ${n.status}`);return n.json()}async function Q7(e){const t=await fetch(`/api/specs/library/${encodeURIComponent(e)}/review`);if(!t.ok){const n=await t.json().catch(()=>({}));throw new Error(n.error??`HTTP ${t.status}`)}return t.json()}function Wl(e){return Ze({queryKey:["spec-library",e??"all"],queryFn:()=>W7(e)})}function qj(e){return Ze({queryKey:["spec-library","review",e],queryFn:()=>Q7(e),enabled:!!e})}async function X7(){const e=await fetch("/api/specs/library/active-lens");if(!e.ok)throw new Error(`HTTP ${e.status}`);return(await e.json()).activeLens??null}function Z7(){return Ze({queryKey:["spec-library","active-lens"],queryFn:X7,staleTime:0})}async function J7(e,t){const n=await fetch("/api/specs/library/active-lens",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({specName:e,specVersion:t})});if(!n.ok)throw new Error(`HTTP ${n.status}`);return(await n.json()).activeLens??null}async function eU(){const e=await fetch("/api/specs/library/active-lens",{method:"DELETE"});if(!e.ok)throw new Error(`HTTP ${e.status}`)}async function tU(){const e=await fetch("/api/context-packs/library");if(!e.ok){if(e.status===503)return[];throw new Error(`HTTP ${e.status}`)}const t=await e.json().catch(()=>null);return Array.isArray(t)?t:[]}function $j(){return Ze({queryKey:["context-packs","library"],queryFn:tU,staleTime:3e4})}async function nU(e){const t=await fetch(`/api/context-packs/library/${encodeURIComponent(e)}/preview`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}function sU(e){return Ze({queryKey:["context-packs","preview",e],queryFn:()=>nU(e),enabled:!!e,staleTime:3e4})}function rU(){const e=Wt();return vn({mutationFn:async t=>{const n=await fetch(`/api/context-packs/library/${encodeURIComponent(t.id)}/send`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({destinationSession:t.destinationSession,dryRun:t.dryRun??!1})});if(!n.ok){const s=await n.json().catch(()=>({}));throw new Error(s.error??`HTTP ${n.status}`)}return n.json()},onSuccess:()=>{e.invalidateQueries({queryKey:["context-packs"]})}})}async function iU(){const e=await fetch("/api/agent-images/library");if(!e.ok){if(e.status===503)return[];throw new Error(`HTTP ${e.status}`)}const t=await e.json().catch(()=>null);return Array.isArray(t)?t:[]}function zj(){return Ze({queryKey:["agent-images","library"],queryFn:iU,staleTime:3e4})}async function aU(e){const t=await fetch(`/api/agent-images/library/${encodeURIComponent(e)}/preview`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}function oU(e){return Ze({queryKey:["agent-images","preview",e],queryFn:()=>aU(e),enabled:!!e,staleTime:3e4})}function lU(){const e=Wt();return vn({mutationFn:async t=>{const n=t.pin?"pin":"unpin",s=await fetch(`/api/agent-images/library/${encodeURIComponent(t.id)}/${n}`,{method:"POST"});if(!s.ok)throw new Error(`HTTP ${s.status}`);return s.json()},onSuccess:()=>{e.invalidateQueries({queryKey:["agent-images"]})}})}const cU=[{source:"workspace",path:".openrig/skills"},{source:"openrig-managed",path:"packages/daemon/specs/agents/shared/skills"},{source:"openrig-managed",path:"node_modules/@openrig/daemon/specs/agents/shared/skills"}];function uU(e){return!!(e&&typeof e=="object"&&"unavailable"in e)}async function NL(e){const t=await fetch(e);if(t.status===404||t.status===400||t.status===503)return null;if(!t.ok)throw new Error(`HTTP ${t.status}`);return await t.json()}async function cE(e,t){return NL(`/api/files/list?root=${encodeURIComponent(e)}&path=${encodeURIComponent(t)}`)}function dU(e,t){return t.filter(n=>n.type==="file"&&/\.(md|mdx)$/i.test(n.name)).map(n=>({name:n.name,path:`${e}/${n.name}`,size:n.size,mtime:n.mtime})).sort((n,s)=>n.name==="SKILL.md"?-1:s.name==="SKILL.md"?1:n.name.localeCompare(s.name))}function fU(e){return e.source==="workspace"?e.id:`${e.source}:${e.name}`}function uE(e){return e.source==="workspace"?0:e.root==="openrig"&&e.directoryPath.startsWith("packages/daemon/")?1:e.directoryPath.startsWith("packages/daemon/")?2:3}function hU(e){const t=new Map;for(const n of e){const s=fU(n),r=t.get(s);(!r||uE(n)<uE(r))&&t.set(s,n)}return Array.from(t.values())}async function pU(){const e=await NL("/api/files/roots");if(!e||uU(e))return[];const t=[];for(const n of e.roots)for(const s of cU){const r=await cE(n.name,s.path);if(!r)continue;const o=r.entries.filter(c=>c.type==="dir");for(const c of o){const u=`${s.path}/${c.name}`,f=await cE(n.name,u);if(!f)continue;const h=dU(u,f.entries);h.length!==0&&t.push({id:`${s.source}:${n.name}:${u}`,name:c.name,source:s.source,root:n.name,directoryPath:u,files:h})}}return hU(t).sort((n,s)=>n.source!==s.source?n.source==="workspace"?-1:1:n.name.localeCompare(s.name))}function Bj(){return Ze({queryKey:["library","skills"],queryFn:pU,staleTime:3e4})}function _L(e){const t=new TextEncoder().encode(e);let n="";for(const s of t)n+=String.fromCharCode(s);return btoa(n).replaceAll("+","-").replaceAll("/","_").replace(/=+$/,"")}function CL(e){try{const t=e.replaceAll("-","+").replaceAll("_","/"),n=t.padEnd(Math.ceil(t.length/4)*4,"="),s=atob(n),r=Uint8Array.from(s,o=>o.charCodeAt(0));return new TextDecoder().decode(r)}catch{return null}}function rp(e){return _L(e)}function mU(e){return _L(e)}function kL(e){return CL(e)}function RL(e){return CL(e)}function gU(e){return`/specs/skills/${rp(e)}`}function xU(e){const t=e.match(/^\/specs\/skills\/([^/]+)(?:\/file\/([^/]+))?$/);if(!t)return null;const n=t[1];if(!n)return null;const s=kL(n);if(!s)return null;const r=t[2]?RL(t[2]):null;return{skillId:s,filePath:r}}const vU={"claude-code":{id:"claude-code",label:"Claude",shortLabel:"Claude",tone:"sand"},codex:{id:"codex",label:"Codex",shortLabel:"Codex",tone:"green"},terminal:{id:"terminal",label:"Terminal",shortLabel:"TTY",tone:"slate"},unknown:{id:"unknown",label:"Unknown",shortLabel:"Unknown",tone:"neutral"}};function Ip(e){const t=(e==null?void 0:e.toLowerCase().trim())??"";return t==="claude"||t==="claude-code"||t.includes("claude")?"claude-code":t==="codex"||t.includes("codex")||t.includes("openai")?"codex":t==="terminal"||t==="tmux"||t==="shell"?"terminal":"unknown"}function Fj(e){return vU[Ip(e)]}function EL(e,t){const n=Fj(e);return n.id==="unknown"?t??"Runtime unknown":t?`${n.label} / ${t}`:n.label}const yU={cmux:{id:"cmux",label:"CMUX",shortLabel:"CMUX",actionLabel:"Open in CMUX",tone:"cyan"},tmux:{id:"tmux",label:"tmux",shortLabel:"tmux",actionLabel:"Attach tmux",tone:"green"},vscode:{id:"vscode",label:"VS Code",shortLabel:"VS Code",actionLabel:"Open in VS Code",tone:"blue"},terminal:{id:"terminal",label:"Terminal",shortLabel:"TTY",actionLabel:"Preview terminal",tone:"slate"},file:{id:"file",label:"File",shortLabel:"File",actionLabel:"Open file",tone:"neutral"},markdown:{id:"markdown",label:"Markdown",shortLabel:"MD",actionLabel:"Open markdown",tone:"neutral"},config:{id:"config",label:"Config",shortLabel:"YAML",actionLabel:"Open config",tone:"blue"},code:{id:"code",label:"Code",shortLabel:"Code",actionLabel:"Open code",tone:"slate"},screenshot:{id:"screenshot",label:"Screenshot",shortLabel:"Shot",actionLabel:"Open screenshot",tone:"amber"},proof:{id:"proof",label:"Proof",shortLabel:"Proof",actionLabel:"Open proof packet",tone:"green"},transcript:{id:"transcript",label:"Transcript",shortLabel:"Log",actionLabel:"Open transcript",tone:"slate"},commit:{id:"commit",label:"Commit",shortLabel:"Git",actionLabel:"Open commit",tone:"green"},folder:{id:"folder",label:"Folder",shortLabel:"Dir",actionLabel:"Open folder",tone:"neutral"},skill:{id:"skill",label:"Skill",shortLabel:"Skill",actionLabel:"Open skill",tone:"amber"},video:{id:"video",label:"Video",shortLabel:"Video",actionLabel:"Open video",tone:"blue"},trace:{id:"trace",label:"Trace",shortLabel:"Trace",actionLabel:"Open trace",tone:"neutral"},unknown:{id:"unknown",label:"Unknown tool",shortLabel:"Unknown",actionLabel:"Open",tone:"neutral"}};function AL(e){const t=(e==null?void 0:e.toLowerCase().trim())??"";return t==="cmux"||t.includes("cmux")?"cmux":t==="tmux"||t.includes("tmux")?"tmux":t==="vscode"||t==="vs-code"||t==="vs code"||t.includes("visual studio code")?"vscode":t==="terminal"||t==="tty"||t==="shell"?"terminal":t==="screenshot"||t==="image"||t==="proof-image"||t.endsWith(".png")||t.endsWith(".jpg")||t.endsWith(".jpeg")||t.endsWith(".gif")||t.endsWith(".webp")||t.endsWith(".svg")||t.includes("screenshot")?"screenshot":t==="proof"||t==="proof-packet"||t.includes("proof packet")||t.endsWith("proof.md")?"proof":t==="skill"||t==="skill-folder"||t==="skill.md"||t.endsWith("/skill.md")?"skill":t==="folder"||t==="directory"||t==="dir"?"folder":t==="commit"||t==="git"||t.includes("commit")||/^[a-f0-9]{7,40}$/.test(t)?"commit":t==="transcript"||t.includes("transcript")||t.endsWith(".log")?"transcript":t==="video"||t.endsWith(".mp4")||t.endsWith(".webm")||t.endsWith(".mov")?"video":t==="trace"||t.endsWith(".zip")||t.endsWith(".har")||t.endsWith(".trace")?"trace":t.endsWith(".md")||t.endsWith(".mdx")?"markdown":t.endsWith(".yaml")||t.endsWith(".yml")||t.endsWith(".json")||t.endsWith(".jsonl")||t.endsWith(".toml")?"config":t.endsWith(".ts")||t.endsWith(".tsx")||t.endsWith(".js")||t.endsWith(".jsx")||t.endsWith(".py")||t.endsWith(".rs")||t.endsWith(".go")||t.endsWith(".sh")?"code":t==="file"||t==="path"||t.includes("artifact")||t.endsWith(".txt")?"file":"unknown"}function TL(e){return yU[AL(e)]}const Hj={xs:"h-3 w-3",sm:"h-4 w-4",md:"h-6 w-6",lg:"h-9 w-9"},bU={xs:"gap-1 px-1 py-0.5 text-[8px]",sm:"gap-1.5 px-1.5 py-0.5 text-[9px]",md:"gap-2 px-2 py-1 text-[10px]",lg:"gap-2.5 px-2.5 py-1.5 text-[11px]"},wU={xs:"gap-1 text-[8px]",sm:"gap-1.5 text-[9px]",md:"gap-2 text-[10px]",lg:"gap-2.5 text-[11px]"},SU={"claude-code":"border-[#9f5f4e]/40 bg-[#b06a57]/12 text-[#62392f]",codex:"border-stone-400/50 bg-white/75 text-stone-950",terminal:"border-stone-400/45 bg-stone-900/8 text-stone-800",unknown:"border-stone-300 bg-white/55 text-stone-600"},jU={"claude-code":"text-[#62392f]",codex:"text-stone-950",terminal:"text-stone-800",unknown:"text-stone-600"},dE="/graphics/operator-climber-monochrome.png";function zt(e,t){return t?{"aria-hidden":!0}:{"aria-label":e,role:"img"}}function NU({className:e,title:t,decorative:n}){return a.jsxs("svg",{viewBox:"0 0 16 16",...zt(t,n),className:e,shapeRendering:"crispEdges",children:[a.jsx("rect",{x:"3",y:"2",width:"10",height:"8",fill:"#ad6755"}),a.jsx("rect",{x:"1",y:"5",width:"2",height:"3",fill:"#ad6755"}),a.jsx("rect",{x:"13",y:"5",width:"2",height:"3",fill:"#ad6755"}),a.jsx("rect",{x:"4",y:"10",width:"2",height:"3",fill:"#ad6755"}),a.jsx("rect",{x:"7",y:"10",width:"2",height:"3",fill:"#ad6755"}),a.jsx("rect",{x:"10",y:"10",width:"2",height:"3",fill:"#ad6755"}),a.jsx("rect",{x:"5",y:"4",width:"1",height:"2",fill:"#181818"}),a.jsx("rect",{x:"10",y:"4",width:"1",height:"2",fill:"#181818"})]})}function _U({className:e,title:t,decorative:n}){return a.jsxs("svg",{viewBox:"0 0 16 16",...zt(t,n),className:e,children:[a.jsx("circle",{cx:"8",cy:"8",r:"5.7",fill:"#fafaf9",stroke:"#0c0a09",strokeWidth:"1.25"}),a.jsx("path",{d:"M5.8 6.35 7.25 8 5.8 9.65",fill:"none",stroke:"#0c0a09",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("path",{d:"M8.65 9.65h2.25",fill:"none",stroke:"#0c0a09",strokeWidth:"1.25",strokeLinecap:"round"})]})}function Uj({className:e,title:t,decorative:n}){return a.jsxs("svg",{viewBox:"0 0 16 16",...zt(t,n),className:e,children:[a.jsx("rect",{x:"2",y:"3",width:"12",height:"10",fill:"#1c1917"}),a.jsx("path",{d:"M4 6 6 8 4 10",fill:"none",stroke:"#fafaf9",strokeWidth:"1.2",strokeLinecap:"square",strokeLinejoin:"miter"}),a.jsx("path",{d:"M7.5 10h4",fill:"none",stroke:"#fafaf9",strokeWidth:"1.2",strokeLinecap:"square"})]})}function CU({className:e,title:t,decorative:n}){return a.jsxs("svg",{viewBox:"0 0 16 16",...zt(t,n),className:e,children:[a.jsx("defs",{children:a.jsxs("linearGradient",{id:"cmux-preview-mark",x1:"3",x2:"13",y1:"3",y2:"13",gradientUnits:"userSpaceOnUse",children:[a.jsx("stop",{stopColor:"#20d5f4"}),a.jsx("stop",{offset:"1",stopColor:"#4357ff"})]})}),a.jsx("path",{d:"M4.1 2.7 12.3 8l-8.2 5.3V9.9L7.8 8 4.1 6.1z",fill:"url(#cmux-preview-mark)"})]})}function kU({className:e,title:t,decorative:n}){return a.jsxs("svg",{viewBox:"0 0 16 16",...zt(t,n),className:e,children:[a.jsx("path",{d:"M2.1 3.5c0-.8.6-1.4 1.4-1.4h9c.8 0 1.4.6 1.4 1.4v9c0 .8-.6 1.4-1.4 1.4h-9c-.8 0-1.4-.6-1.4-1.4z",fill:"#3a3a39"}),a.jsx("path",{d:"M7.5 2.1v8.7M7.5 6.3h6.4",stroke:"#f8fafc",strokeWidth:"0.7"}),a.jsx("path",{d:"M2.1 11.1h11.8v1.4c0 .8-.6 1.4-1.4 1.4h-9c-.8 0-1.4-.6-1.4-1.4z",fill:"#14c21a"})]})}function RU({className:e,title:t,decorative:n}){return a.jsxs("svg",{viewBox:"0 0 16 16",...zt(t,n),className:e,children:[a.jsx("path",{d:"M12.5 2.4 6.8 6.7 3.9 4.5 2.4 5.7 5.2 8l-2.8 2.3 1.5 1.2 2.9-2.2 5.7 4.3 1.1-.5V2.9z",fill:"#007acc"}),a.jsx("path",{d:"M12.3 5.3 8.4 8l3.9 2.7z",fill:"#35a9ff",opacity:"0.9"})]})}function EU({className:e,title:t,decorative:n}){return a.jsxs("svg",{viewBox:"0 0 16 16",...zt(t,n),className:e,children:[a.jsx("path",{d:"M4 2.5h5.2L12 5.3v8.2H4z",fill:"#f5f5f4",stroke:"#78716c",strokeWidth:"1"}),a.jsx("path",{d:"M9.2 2.5v3h2.8",fill:"none",stroke:"#78716c",strokeWidth:"1"}),a.jsx("path",{d:"M5.8 8h4.4M5.8 10.1h3.5",fill:"none",stroke:"#57534e",strokeWidth:"0.8",strokeLinecap:"square"})]})}function AU({className:e,title:t,decorative:n}){return a.jsxs("svg",{viewBox:"0 0 16 16",...zt(t,n),className:e,children:[a.jsx("path",{d:"M3 2.5h10v11H3z",fill:"#fafaf9",stroke:"#57534e",strokeWidth:"0.9"}),a.jsx("path",{d:"M5 6v4M5 6l1.7 2.2L8.4 6v4M10 6v4M9.1 9.1 10 10l.9-.9",fill:"none",stroke:"#292524",strokeWidth:"0.85",strokeLinecap:"square",strokeLinejoin:"miter"}),a.jsx("path",{d:"M4.6 4.2h6.8",stroke:"#a8a29e",strokeWidth:"0.65"})]})}function TU({className:e,title:t,decorative:n}){return a.jsxs("svg",{viewBox:"0 0 16 16",...zt(t,n),className:e,children:[a.jsx("path",{d:"M3 2.5h10v11H3z",fill:"#eff6ff",stroke:"#0369a1",strokeWidth:"0.9"}),a.jsx("path",{d:"M5.1 5.3h5.8M5.1 8h5.8M5.1 10.7h5.8",stroke:"#075985",strokeWidth:"0.75",strokeLinecap:"square"}),a.jsx("circle",{cx:"4.2",cy:"5.3",r:"0.45",fill:"#0284c7"}),a.jsx("circle",{cx:"4.2",cy:"8",r:"0.45",fill:"#0284c7"}),a.jsx("circle",{cx:"4.2",cy:"10.7",r:"0.45",fill:"#0284c7"})]})}function MU({className:e,title:t,decorative:n}){return a.jsxs("svg",{viewBox:"0 0 16 16",...zt(t,n),className:e,children:[a.jsx("rect",{x:"2.5",y:"3",width:"11",height:"10",fill:"#fafaf9",stroke:"#292524",strokeWidth:"0.9"}),a.jsx("path",{d:"M6.2 6.2 4.6 8l1.6 1.8M9.8 6.2 11.4 8 9.8 9.8",fill:"none",stroke:"#292524",strokeWidth:"0.9",strokeLinecap:"square",strokeLinejoin:"miter"}),a.jsx("path",{d:"M8.7 5.4 7.3 10.6",stroke:"#57534e",strokeWidth:"0.75",strokeLinecap:"square"})]})}function IU({className:e,title:t,decorative:n}){return a.jsxs("svg",{viewBox:"0 0 16 16",...zt(t,n),className:e,children:[a.jsx("rect",{x:"2",y:"3",width:"12",height:"10",fill:"#fff7ed",stroke:"#9a3412",strokeWidth:"0.9"}),a.jsx("path",{d:"M2.4 5.2h11.2",stroke:"#9a3412",strokeWidth:"0.9"}),a.jsx("rect",{x:"3.8",y:"6.7",width:"3.1",height:"2.3",fill:"#fdba74"}),a.jsx("rect",{x:"7.7",y:"6.7",width:"4.5",height:"0.8",fill:"#fed7aa"}),a.jsx("rect",{x:"7.7",y:"8.4",width:"3.5",height:"0.8",fill:"#fed7aa"}),a.jsx("path",{d:"M4 11.5h7.8",stroke:"#ea580c",strokeWidth:"0.9",strokeLinecap:"square"}),a.jsx("circle",{cx:"4",cy:"4.1",r:"0.35",fill:"#9a3412"}),a.jsx("circle",{cx:"5.1",cy:"4.1",r:"0.35",fill:"#9a3412"})]})}function OU({className:e,title:t,decorative:n}){return a.jsxs("svg",{viewBox:"0 0 16 16",...zt(t,n),className:e,children:[a.jsx("path",{d:"M3 2.8h10v10.4H3z",fill:"#ecfdf5",stroke:"#047857",strokeWidth:"0.9"}),a.jsx("path",{d:"M5.1 8.1 7 10l4-4.3",fill:"none",stroke:"#059669",strokeWidth:"1.2",strokeLinecap:"square",strokeLinejoin:"miter"}),a.jsx("path",{d:"M4.7 4.7h6.6",stroke:"#6ee7b7",strokeWidth:"0.7"}),a.jsx("path",{d:"M4.7 11.6h6.6",stroke:"#6ee7b7",strokeWidth:"0.7"})]})}function LU({className:e,title:t,decorative:n}){return a.jsxs("svg",{viewBox:"0 0 16 16",...zt(t,n),className:e,children:[a.jsx("rect",{x:"2.5",y:"3",width:"11",height:"10",fill:"#1c1917"}),a.jsx("path",{d:"M4.3 5.5h3.8M4.3 7.6h6.8M4.3 9.7h5.2",stroke:"#fafaf9",strokeWidth:"0.75",strokeLinecap:"square"}),a.jsx("rect",{x:"11.1",y:"5.1",width:"1",height:"5.6",fill:"#a8a29e"})]})}function PU({className:e,title:t,decorative:n}){return a.jsxs("svg",{viewBox:"0 0 16 16",...zt(t,n),className:e,children:[a.jsx("path",{d:"M2.4 8h11.2",stroke:"#064e3b",strokeWidth:"1",strokeLinecap:"square"}),a.jsx("circle",{cx:"8",cy:"8",r:"2.6",fill:"#ecfdf5",stroke:"#047857",strokeWidth:"1"}),a.jsx("circle",{cx:"8",cy:"8",r:"0.8",fill:"#10b981"})]})}function DU({className:e,title:t,decorative:n}){return a.jsxs("svg",{viewBox:"0 0 16 16",...zt(t,n),className:e,children:[a.jsx("path",{d:"M2.3 5.1h4l1-1.5h6.4v8.8H2.3z",fill:"#f5f5f4",stroke:"#78716c",strokeWidth:"0.9"}),a.jsx("path",{d:"M2.3 6.3h11.4",stroke:"#a8a29e",strokeWidth:"0.75"})]})}function qU({className:e,title:t,decorative:n}){return a.jsxs("svg",{viewBox:"0 0 16 16",...zt(t,n),className:e,children:[a.jsx("path",{d:"M3.2 2.8h7.1L13 5.5v7.7H3.2z",fill:"#fffbeb",stroke:"#92400e",strokeWidth:"0.9"}),a.jsx("path",{d:"M10.3 2.8v2.8H13",fill:"none",stroke:"#92400e",strokeWidth:"0.8"}),a.jsx("path",{d:"M5.1 6.7h5.1M5.1 8.7h4.1",stroke:"#b45309",strokeWidth:"0.75",strokeLinecap:"square"}),a.jsx("path",{d:"M5.1 11.1h2.2",stroke:"#f59e0b",strokeWidth:"1",strokeLinecap:"square"})]})}function $U({className:e,title:t,decorative:n}){return a.jsxs("svg",{viewBox:"0 0 16 16",...zt(t,n),className:e,children:[a.jsx("rect",{x:"2.5",y:"3.6",width:"8.4",height:"8.8",fill:"#eff6ff",stroke:"#0369a1",strokeWidth:"0.9"}),a.jsx("path",{d:"M10.9 6.3 13.7 4.9v6.2l-2.8-1.4z",fill:"#38bdf8",stroke:"#0369a1",strokeWidth:"0.75"}),a.jsx("path",{d:"M5.7 6.3v3.4L8.5 8z",fill:"#0284c7"})]})}function zU({className:e,title:t,decorative:n}){return a.jsxs("svg",{viewBox:"0 0 16 16",...zt(t,n),className:e,children:[a.jsx("rect",{x:"2.7",y:"2.7",width:"10.6",height:"10.6",fill:"#fafaf9",stroke:"#57534e",strokeWidth:"0.9"}),a.jsx("path",{d:"M4.7 10.2c1.1-4.8 2.3-4.8 3.4-.1s2.2 4.7 3.2-.2",fill:"none",stroke:"#44403c",strokeWidth:"0.9",strokeLinecap:"square"}),a.jsx("path",{d:"M4.4 5.2h2M9.6 5.2h2",stroke:"#a8a29e",strokeWidth:"0.7"})]})}function BU({className:e,title:t,decorative:n}){return a.jsx("span",{...zt(t,n),title:t,className:he(e,"inline-block bg-current"),style:{WebkitMaskImage:`url(${dE})`,WebkitMaskPosition:"center",WebkitMaskRepeat:"no-repeat",WebkitMaskSize:"contain",maskImage:`url(${dE})`,maskPosition:"center",maskRepeat:"no-repeat",maskSize:"contain"}})}function ML({className:e,title:t,decorative:n}){return a.jsxs("svg",{viewBox:"0 0 16 16",...zt(t,n),className:e,children:[a.jsx("rect",{x:"2",y:"2",width:"12",height:"12",fill:"#e7e5e4",stroke:"#78716c",strokeWidth:"1"}),a.jsx("path",{d:"M6.2 6.2c.2-1 1-1.7 2-1.7 1.2 0 2 .7 2 1.8 0 .7-.3 1.1-.9 1.5-.6.4-.8.7-.8 1.4",fill:"none",stroke:"#57534e",strokeWidth:"1.1"}),a.jsx("rect",{x:"7.6",y:"11",width:"1",height:"1",fill:"#57534e"})]})}function Vj({runtime:e,size:t="sm",className:n,title:s,decorative:r}){const o=Ip(e),c=s??Fj(e).label,u=he(Hj[t],"shrink-0",n);return o==="claude-code"?a.jsx(NU,{className:u,title:c,decorative:r}):o==="codex"?a.jsx(_U,{className:u,title:c,decorative:r}):o==="terminal"?a.jsx(Uj,{className:u,title:c,decorative:r}):a.jsx(ML,{className:u,title:c,decorative:r})}function _n({runtime:e,model:t,size:n="sm",className:s,compact:r=!1,variant:o="badge"}){const c=Ip(e),u=Fj(e),f=o==="inline";return a.jsxs("span",{className:he("inline-flex min-w-0 items-center font-mono uppercase tracking-[0.10em]",f?wU[n??"sm"]:bU[n??"sm"],f?jU[c]:he("border",SU[c]),s),title:t?`${u.label} / ${t}`:u.label,children:[a.jsx(Vj,{runtime:e,size:n}),a.jsx("span",{className:"truncate",children:r?u.shortLabel:u.label}),t&&!r?a.jsx("span",{className:"truncate text-current/60",children:t}):null]})}function Pe({tool:e,size:t="sm",className:n,title:s,decorative:r}){const o=AL(e),c=s??TL(e).label,u=he(Hj[t],"shrink-0",n);return o==="cmux"?a.jsx(CU,{className:u,title:c,decorative:r}):o==="tmux"?a.jsx(kU,{className:u,title:c,decorative:r}):o==="vscode"?a.jsx(RU,{className:u,title:c,decorative:r}):o==="terminal"?a.jsx(Uj,{className:u,title:c,decorative:r}):o==="file"?a.jsx(EU,{className:u,title:c,decorative:r}):o==="markdown"?a.jsx(AU,{className:u,title:c,decorative:r}):o==="config"?a.jsx(TU,{className:u,title:c,decorative:r}):o==="code"?a.jsx(MU,{className:u,title:c,decorative:r}):o==="screenshot"?a.jsx(IU,{className:u,title:c,decorative:r}):o==="proof"?a.jsx(OU,{className:u,title:c,decorative:r}):o==="transcript"?a.jsx(LU,{className:u,title:c,decorative:r}):o==="commit"?a.jsx(PU,{className:u,title:c,decorative:r}):o==="folder"?a.jsx(DU,{className:u,title:c,decorative:r}):o==="skill"?a.jsx(qU,{className:u,title:c,decorative:r}):o==="video"?a.jsx($U,{className:u,title:c,decorative:r}):o==="trace"?a.jsx(zU,{className:u,title:c,decorative:r}):a.jsx(ML,{className:u,title:c,decorative:r})}function IL(e){const t=(e==null?void 0:e.toLowerCase().trim())??"";return t==="human"||t.includes("human@")||t.includes("human-")||t.includes("operator")||t.includes("host")}function ip({actor:e,size:t="sm",className:n,title:s,decorative:r}){const o=s??(e||"Operator"),c=he(Hj[t],"shrink-0",n);return IL(e)?a.jsx(BU,{className:c,title:o,decorative:r}):Ip(e)!=="unknown"?a.jsx(Vj,{runtime:e,size:t,className:n,title:s,decorative:r}):a.jsx(Uj,{className:c,title:o,decorative:r})}function nh(e){return{id:e.id,name:e.name,entryId:e.id,meta:e.version}}function FU({def:e,expanded:t,onToggle:n}){const s=t?Yi:Xs;return a.jsxs("li",{"data-testid":`specs-section-${e.id}`,children:[a.jsxs("button",{type:"button",onClick:n,"data-testid":`specs-section-toggle-${e.id}`,className:"w-full flex items-center gap-1 px-2 py-1 hover:bg-surface-low text-left",children:[a.jsx(s,{className:"h-3 w-3 text-on-surface-variant"}),a.jsx("span",{className:"font-mono text-[11px] uppercase tracking-wide text-stone-900 flex-1",children:e.label}),a.jsx("span",{className:"font-mono text-[10px] text-on-surface-variant",children:e.loading?"...":e.entries.length})]}),t?a.jsx("ul",{className:"ml-5 border-l border-stone-200",children:e.entries.length>0?e.entries.map(r=>a.jsxs("li",{className:"px-2 py-0.5",children:[r.entryId?a.jsx(Ye,{to:"/specs/library/$entryId",params:{entryId:r.entryId},"data-testid":`specs-leaf-${r.id}`,className:"block truncate font-mono text-xs text-on-surface hover:bg-surface-low hover:text-stone-900",children:r.name}):r.skillId?a.jsx(Ye,{to:"/specs/skills/$skillToken",params:{skillToken:rp(r.skillId)},"data-testid":`specs-leaf-${r.id}`,className:"block truncate font-mono text-xs text-on-surface hover:bg-surface-low hover:text-stone-900",children:r.name}):a.jsx("div",{"data-testid":`specs-leaf-${r.id}`,className:"truncate font-mono text-xs text-on-surface",children:r.name}),r.meta?a.jsxs("div",{className:"flex min-w-0 items-center gap-1 truncate font-mono text-[9px] text-on-surface-variant",children:[r.metaNode,a.jsx("span",{className:"truncate",children:r.meta})]}):null]},r.id)):a.jsx("li",{className:"px-2 py-1 font-mono text-[10px] text-on-surface-variant italic",children:e.loading?"Loading...":`No ${e.label.toLowerCase()} yet.`})}):null]})}function HU(){const e=no(),{data:t=[],isLoading:n}=Wl(),{data:s=[],isLoading:r}=$j(),{data:o=[],isLoading:c}=zj(),{data:u=[],isLoading:f}=Bj(),h=xU(e.location.pathname),[p,g]=R.useState({"rig-specs":!0,"workspace-specs":!1,"workflow-specs":!1,"context-packs":!1,"agent-specs":!1,"agent-images":!1,applications:!1,skills:!1}),[x,v]=R.useState({}),b=N=>g(C=>({...C,[N]:!C[N]})),w=N=>v(C=>({...C,[N]:!C[N]})),S=R.useMemo(()=>{const N=t.filter(E=>E.kind==="rig"&&!E.hasServices).map(nh),C=t.filter(E=>E.kind==="workflow").map(nh),k=t.filter(E=>E.kind==="agent").map(nh),_=t.filter(E=>E.kind==="rig"&&E.hasServices).map(nh);return[{id:"rig-specs",label:"Rig Specs",entries:N,loading:n},{id:"workspace-specs",label:"Workspace Specs",entries:[]},{id:"workflow-specs",label:"Workflow Specs",entries:C,loading:n},{id:"context-packs",label:"Context Packs",entries:s.map(E=>({id:E.id,name:E.name,entryId:E.id,meta:`${E.version} · ${E.sourceType}`})),loading:r},{id:"agent-specs",label:"Agent Specs",entries:k,loading:n},{id:"agent-images",label:"Agent Images",entries:o.map(E=>({id:E.id,name:E.name,entryId:E.id,meta:E.version,metaNode:a.jsx(_n,{runtime:E.runtime,size:"xs",compact:!0,variant:"inline"})})),loading:c},{id:"applications",label:"Applications",entries:_,loading:n},{id:"skills",label:"Skills",entries:u.map(E=>({id:E.id,name:E.name,skillId:E.id})),loading:f}]},[o,c,s,r,t,u,f,n]);return a.jsxs("div",{"data-testid":"specs-tree-view",className:"flex-1 overflow-y-auto py-2",children:[a.jsx("div",{className:"px-2 mb-2",children:a.jsxs(Ye,{to:"/specs","data-testid":"specs-tree-overview-link",className:"block font-mono text-[11px] uppercase tracking-wide text-stone-900 px-2 py-1 hover:bg-surface-low",children:["> ","Library"]})}),a.jsx("ul",{children:S.map(N=>{if(N.id!=="skills")return a.jsx(FU,{def:N,expanded:!!p[N.id],onToggle:()=>b(N.id)},N.id);const C=p.skills||!!h,k=C?Yi:Xs;return a.jsxs("li",{"data-testid":"specs-section-skills",children:[a.jsxs("button",{type:"button",onClick:()=>b("skills"),"data-testid":"specs-section-toggle-skills",className:"w-full flex items-center gap-1 px-2 py-1 hover:bg-surface-low text-left",children:[a.jsx(k,{className:"h-3 w-3 text-on-surface-variant"}),a.jsx("span",{className:"font-mono text-[11px] uppercase tracking-wide text-stone-900 flex-1",children:"Skills"}),a.jsx("span",{className:"font-mono text-[10px] text-on-surface-variant",children:f?"...":u.length})]}),C?a.jsx("ul",{className:"ml-5 border-l border-stone-200",children:u.length>0?u.map(_=>{const E=x[_.id]||(h==null?void 0:h.skillId)===_.id,M=E?Yi:Xs;return a.jsxs("li",{className:"px-2 py-0.5",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{type:"button",onClick:()=>w(_.id),"aria-label":`${E?"Collapse":"Expand"} ${_.name}`,className:"inline-flex h-4 w-4 shrink-0 items-center justify-center text-stone-500 hover:text-stone-900",children:a.jsx(M,{className:"h-3 w-3"})}),a.jsx(Ye,{to:"/specs/skills/$skillToken",params:{skillToken:rp(_.id)},"data-testid":`specs-leaf-${_.id}`,onClick:()=>{v(A=>({...A,[_.id]:!0}))},className:"min-w-0 flex-1 truncate font-mono text-xs text-on-surface hover:bg-surface-low hover:text-stone-900",children:a.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1.5",children:[a.jsx(Pe,{tool:"skill",size:"xs",title:`${_.name} skill`,decorative:!0}),a.jsx("span",{className:"truncate",children:_.name})]})})]}),E?a.jsx("ul",{className:"ml-4 border-l border-stone-200",children:_.files.map(A=>{const O=(h==null?void 0:h.skillId)===_.id&&(h.filePath===A.path||!h.filePath&&A.name.toLowerCase()==="skill.md");return a.jsx("li",{className:"px-2 py-0.5",children:a.jsxs(Ye,{to:"/specs/skills/$skillToken/file/$fileToken",params:{skillToken:rp(_.id),fileToken:mU(A.path)},"data-testid":`specs-skill-file-${A.name}`,"data-active":O,className:`flex min-w-0 items-center gap-1 truncate font-mono text-[11px] hover:bg-surface-low hover:text-stone-900 ${O?"text-stone-900":"text-on-surface-variant"}`,children:[a.jsx(Pe,{tool:A.name,size:"xs",title:A.name,decorative:!0}),a.jsx("span",{className:"truncate",children:A.name})]})},A.path)})}):null]},_.id)}):a.jsx("li",{className:"px-2 py-1 font-mono text-[10px] text-on-surface-variant italic",children:f?"Loading...":"No skills yet."})}):null]},N.id)})})]})}async function UU(e){const t=await fetch(`/api/rigs/${encodeURIComponent(e)}/nodes`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}function Gj(e){return Ze({queryKey:["rig",e,"nodes"],queryFn:()=>UU(e),enabled:!!e,refetchInterval:3e4})}function Ys(e){if(!e)return null;const t=e.split(".");return t.length<=1?e:t[0]??e}function bl(e){return e&&e.length>0?e:"ungrouped"}function Op(e){if(!e)return"unknown";const t=e.split(".");return t.length<=1?e:t.at(-1)??e}function VU(){const e=no({select:r=>r.location.pathname}),t=e.match(/^\/topology\/seat\/([^/]+)\/(.+)$/);if(t){const r=decodeURIComponent(t[1]),o=decodeURIComponent(t[2]),c=Ys(o)??"default";return{rigId:r,podName:c,logicalId:o}}const n=e.match(/^\/topology\/pod\/([^/]+)\/([^/]+)$/);if(n)return{rigId:decodeURIComponent(n[1]),podName:decodeURIComponent(n[2]),logicalId:null};const s=e.match(/^\/topology\/rig\/([^/]+)$/);return s?{rigId:decodeURIComponent(s[1]),podName:null,logicalId:null}:{rigId:null,podName:null,logicalId:null}}function GU({rigId:e,logicalId:t,label:n,runtime:s,isActive:r}){return a.jsx("li",{className:"px-2 py-0.5 hover:bg-surface-low",children:a.jsxs(Ye,{to:"/topology/seat/$rigId/$logicalId",params:{rigId:e,logicalId:encodeURIComponent(t)},"data-testid":`topology-seat-${e}-${t}`,"data-active":r,className:he("flex w-full min-w-0 items-center gap-1.5 font-mono text-xs",r?"text-stone-900 font-bold":"text-on-surface hover:text-stone-900"),children:[a.jsx(Vj,{runtime:s,size:"xs"}),a.jsx("span",{className:"truncate",children:n})]})})}function KU({rigId:e,podName:t,seats:n,activeRigId:s,activePodName:r,activeLogicalId:o}){const[c,u]=R.useState(!1),f=s===e&&r===t;return R.useEffect(()=>{f&&!c&&u(!0)},[f,c]),a.jsxs("li",{"data-testid":`topology-pod-${e}-${t}`,children:[a.jsxs("button",{type:"button",onClick:()=>u(h=>!h),className:"w-full flex items-center gap-1 px-2 py-0.5 hover:bg-surface-low text-left",children:[c?a.jsx(Yi,{className:"h-3 w-3 text-on-surface-variant"}):a.jsx(Xs,{className:"h-3 w-3 text-on-surface-variant"}),a.jsx(Ye,{to:"/topology/pod/$rigId/$podName",params:{rigId:e,podName:t},onClick:h=>h.stopPropagation(),className:"font-mono text-[11px] text-stone-900 flex-1 truncate hover:underline",children:bl(t)}),a.jsx("span",{className:"font-mono text-[9px] text-on-surface-variant",children:n.length})]}),c?a.jsx("ul",{className:"ml-4 border-l border-stone-200",children:n.map(h=>a.jsx(GU,{rigId:e,logicalId:h.logicalId,label:h.label,runtime:h.runtime,isActive:s===e&&o===h.logicalId},h.logicalId))}):null]})}function YU({rigId:e,rigName:t,activeRigId:n,activePodName:s,activeLogicalId:r}){const o=n===e,[c,u]=R.useState(!1);R.useEffect(()=>{o&&!c&&u(!0)},[o,c]);const f=c||o,{data:h}=Gj(f?e:null),p=new Map;for(const x of h??[]){const v=Ys(x.logicalId)??"default";p.has(v)||p.set(v,[]),p.get(v).push({logicalId:x.logicalId,label:x.canonicalSessionName??x.logicalId,runtime:x.runtime})}const g=Array.from(p.entries());return a.jsxs("li",{"data-testid":`topology-rig-${e}`,children:[a.jsxs("button",{type:"button",onClick:()=>u(x=>!x),className:"w-full flex items-center gap-1 px-2 py-1 hover:bg-surface-low text-left",children:[c?a.jsx(Yi,{className:"h-3 w-3 text-on-surface-variant"}):a.jsx(Xs,{className:"h-3 w-3 text-on-surface-variant"}),a.jsx(Ye,{to:"/topology/rig/$rigId",params:{rigId:e},onClick:x=>x.stopPropagation(),className:"font-mono text-[11px] uppercase text-stone-900 flex-1 truncate hover:underline",children:t})]}),c?a.jsx("ul",{className:"ml-4 border-l border-stone-200",children:g.length===0?a.jsx("li",{className:"px-2 py-1 font-mono text-[10px] text-on-surface-variant italic",children:"Loading…"}):g.map(([x,v])=>a.jsx(KU,{rigId:e,podName:x,seats:v,activeRigId:n,activePodName:s,activeLogicalId:r},x))}):null]})}function WU(){const{data:e}=Ts(),[t,n]=R.useState(!0),{rigId:s,podName:r,logicalId:o}=VU();return a.jsx("div",{"data-testid":"topology-tree-view",className:"flex-1 overflow-y-auto py-2",children:a.jsx("ul",{children:a.jsxs("li",{"data-testid":"topology-host-localhost",children:[a.jsxs("button",{type:"button",onClick:()=>n(c=>!c),className:"w-full flex items-center gap-1 px-2 py-1 hover:bg-surface-low text-left",children:[t?a.jsx(Yi,{className:"h-3 w-3 text-on-surface-variant"}):a.jsx(Xs,{className:"h-3 w-3 text-on-surface-variant"}),a.jsx(GF,{className:"h-3 w-3 text-on-surface-variant"}),a.jsx(Ye,{to:"/topology",onClick:c=>c.stopPropagation(),className:"font-mono text-[11px] uppercase text-stone-900 flex-1 hover:underline",children:"localhost"}),a.jsx("span",{className:"font-mono text-[9px] text-on-surface-variant",children:(e==null?void 0:e.length)??0})]}),t?a.jsx("ul",{className:"ml-5",children:e&&e.length>0?e.map(c=>a.jsx(YU,{rigId:c.id,rigName:c.name,activeRigId:s,activePodName:r,activeLogicalId:o},c.id)):a.jsx("li",{className:"px-2 py-1 font-mono text-[10px] text-on-surface-variant italic",children:"No rigs."})}):null]})})})}const QU={approvals:"feed.subscriptions.approvals",shipped:"feed.subscriptions.shipped",progress:"feed.subscriptions.progress",auditLog:"feed.subscriptions.audit_log"},nl={actionRequired:!0,approvals:!0,shipped:!0,progress:!0,auditLog:!1};function su(e,t){if(typeof e=="boolean")return e;if(typeof e=="string"){if(e==="true"||e==="1")return!0;if(e==="false"||e==="0")return!1}return t}function OL(){var u,f,h,p,g;const{data:e,error:t}=io(),n=vL(),s=e==null?void 0:e.settings,r=!!t||!s,o=r?nl:{actionRequired:su((u=s==null?void 0:s["feed.subscriptions.action_required"])==null?void 0:u.value,nl.actionRequired),approvals:su((f=s==null?void 0:s["feed.subscriptions.approvals"])==null?void 0:f.value,nl.approvals),shipped:su((h=s==null?void 0:s["feed.subscriptions.shipped"])==null?void 0:h.value,nl.shipped),progress:su((p=s==null?void 0:s["feed.subscriptions.progress"])==null?void 0:p.value,nl.progress),auditLog:su((g=s==null?void 0:s["feed.subscriptions.audit_log"])==null?void 0:g.value,nl.auditLog)};return{state:o,toggle:x=>{const v=QU[x],b=o[x];n.mutate({key:v,value:b?"false":"true"})},isMutating:n.isPending,unavailable:r}}function XU(e,t){switch(e){case"action-required":return t.actionRequired;case"approval":return t.approvals;case"shipped":return t.shipped;case"progress":return t.progress;case"observation":return t.auditLog}}const ZU=[{toggleKey:null,label:"Action required",description:"Items the human must act on",forced:!0,testId:"subscription-toggle-action-required"},{toggleKey:"approvals",label:"Approvals",description:"Closeout-pending-ratify items",testId:"subscription-toggle-approvals"},{toggleKey:"shipped",label:"Feature ships",description:"Slice / mission deliveries + git tag landings",testId:"subscription-toggle-shipped"},{toggleKey:"progress",label:"Slice progress",description:"Compact progress rollups",testId:"subscription-toggle-progress"},{toggleKey:"auditLog",label:"Audit log",description:"Verbose stream + watchdog observations",testId:"subscription-toggle-audit-log"}];function JU(){const{state:e,toggle:t,isMutating:n,unavailable:s}=OL();return a.jsxs("div",{"data-testid":"subscription-toggle-list",className:"font-mono text-xs",children:[a.jsx("div",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-on-surface-variant mb-2",children:"Subscriptions"}),a.jsx("ul",{className:"space-y-1",children:ZU.map(r=>{const o=r.toggleKey===null?e.actionRequired:e[r.toggleKey],c=!r.forced&&!s;return a.jsxs("li",{"data-testid":r.testId,"data-on":o?"true":"false",className:"flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-stone-900 truncate",children:r.label}),a.jsx("div",{className:"font-mono text-[9px] text-on-surface-variant truncate",children:r.description})]}),r.forced?a.jsx("span",{className:"font-mono text-[9px] uppercase tracking-wide text-on-surface-variant shrink-0",children:"forced ON"}):a.jsx("button",{type:"button",role:"switch","aria-checked":o,disabled:!c||n,"data-testid":`${r.testId}-button`,onClick:()=>r.toggleKey&&t(r.toggleKey),className:"shrink-0 px-2 py-0.5 border font-mono text-[9px] uppercase tracking-wide "+(o?"border-success text-success":"border-stone-300 text-on-surface-variant")+(c?" hover:bg-stone-100/60":" opacity-60 cursor-not-allowed"),children:o?"on":"off"})]},r.testId)})}),s?a.jsxs("p",{"data-testid":"subscription-toggle-unavailable",className:"mt-3 font-mono text-[9px] text-on-surface-variant italic",children:["Settings endpoint unreachable (legacy daemon < v0.3.0). Toggles render the canonical defaults; configure via CLI:",a.jsx("code",{className:"ml-1 text-stone-700",children:"rig config set feed.subscriptions.<kind> true|false"})]}):null]})}function eV(e){const t=e.match(/^\/rigs\/([^/]+)/);return(t==null?void 0:t[1])??null}function tV({surface:e,rigs:t,psMap:n,selection:s,onSelect:r,onClose:o,currentRigId:c}){return e==="topology"?a.jsx(WU,{}):e==="project"?a.jsx(Y7,{}):e==="specs"?a.jsx(HU,{}):e==="for-you"?a.jsx("div",{"data-testid":"explorer-for-you-subscriptions",className:"flex-1 overflow-y-auto py-3 px-3",children:a.jsx(JU,{})}):null}function nV({open:e,onClose:t,selection:n,onSelect:s,desktopMode:r="full",surface:o="topology",onDesktopToggle:c=()=>{},overlayMode:u="opaque"}){const h=no().location.pathname,p=eV(h),{data:g}=Ts(),{data:x}=ad(),v=new Map((x??[]).map(S=>[S.rigId,S]));if(o==="none")return null;const b=u==="overlay";return r==="hidden"?a.jsx("button",{type:"button","data-testid":"explorer-edge-toggle","data-explorer-collapsed":"true","aria-label":"Expand explorer",onClick:c,className:he("hidden lg:flex fixed top-[5.5rem] left-[3.5rem] z-30 h-8 w-8 items-center justify-center","rounded-full border border-outline-variant bg-background/90 text-stone-700","shadow-[0_2px_8px_rgba(41,37,36,0.08)] backdrop-blur-sm transition-colors","hover:bg-stone-100 hover:text-stone-900"),children:a.jsx(Xs,{className:"h-4 w-4",strokeWidth:1.5})}):a.jsx("aside",{"data-testid":"explorer","data-surface":o,"data-explorer-mode":u,"data-explorer-collapsed":"false",className:he("border-r border-outline-variant flex overflow-hidden",b?"vellum z-30 shadow-[6px_0_14px_rgba(46,52,46,0.06)]":"z-20 bg-[rgba(250,249,245,0.035)] supports-[backdrop-filter]:bg-[rgba(250,249,245,0.018)] backdrop-blur-[14px] backdrop-saturate-75 shadow-[6px_0_14px_rgba(46,52,46,0.04)]","fixed top-14 bottom-0 left-0 transition-transform duration-200 ease-tactical w-72 max-w-[80vw]",e?"translate-x-0":"-translate-x-full","lg:absolute lg:top-0 lg:bottom-0 lg:left-12 lg:w-72 lg:max-w-none lg:translate-x-0"),children:a.jsxs("div",{className:"relative flex h-full w-full flex-col",children:[a.jsx("button",{type:"button","data-testid":"explorer-edge-toggle","aria-label":"Collapse explorer",onClick:c,className:he("hidden lg:flex absolute z-10 h-8 w-8 items-center justify-center rounded-full border border-outline-variant bg-background/90 text-stone-700","shadow-[0_2px_8px_rgba(41,37,36,0.08)] backdrop-blur-sm transition-colors hover:bg-stone-100 hover:text-stone-900","right-2 top-3"),children:a.jsx(kF,{className:"h-4 w-4",strokeWidth:1.5})}),a.jsx(tV,{surface:o,rigs:g,psMap:v,selection:n,onSelect:s,onClose:t,currentRigId:p})]})})}const sV="/api/events";class rV{constructor(){Qn(this,"eventSource",null);Qn(this,"eventListeners",new Set);Qn(this,"statusListeners",new Set);Qn(this,"replayEvents",[]);Qn(this,"connected",!1);Qn(this,"reconnecting",!1)}subscribe(t){this.eventListeners.add(t),this.ensureConnected();for(const n of this.replayEvents)t(n.event,n.rawData);return()=>{this.eventListeners.delete(t),this.closeIfIdle()}}subscribeStatus(t){return this.statusListeners.add(t),t(this.snapshot()),this.ensureConnected(),()=>{this.statusListeners.delete(t),this.closeIfIdle()}}snapshot(){return{connected:this.connected,reconnecting:this.reconnecting}}ensureConnected(){if(this.eventSource||typeof EventSource>"u")return;const t=new EventSource(sV);this.eventSource=t,t.addEventListener("open",()=>{this.connected=!0,this.reconnecting=!1,this.emitStatus()}),t.addEventListener("error",()=>{this.connected=!1,this.reconnecting=!0,this.emitStatus()}),t.addEventListener("message",n=>{const s=n.data;if(typeof s!="string")return;let r=null;try{r=JSON.parse(s)}catch{return}if(!r||typeof r!="object")return;const o=r;this.replayEvents=[...this.replayEvents,{event:o,rawData:s}].slice(-100);for(const c of[...this.eventListeners])c(o,s)})}closeIfIdle(){this.eventListeners.size>0||this.statusListeners.size>0||(this.eventSource&&(this.eventSource.close(),this.eventSource=null),this.replayEvents=[],this.connected=!1,this.reconnecting=!1)}emitStatus(){const t=this.snapshot();for(const n of[...this.statusListeners])n(t)}}const LL=new rV;function Lp(e){return LL.subscribe(e)}function PL(e){return LL.subscribeStatus(e)}const PS=100;function Pp(){const e=Wt(),[t,n]=R.useState([]),[s,r]=R.useState(!1),[o,c]=R.useState(!1),u=R.useCallback(f=>{const h={seq:typeof f.seq=="number"?f.seq:Date.now(),type:f.type??"unknown",payload:f,createdAt:f.createdAt??new Date().toISOString(),receivedAt:Date.now()};if(n(p=>[h,...p].slice(0,PS)),(h.type==="package.installed"||h.type==="package.rolledback")&&e.invalidateQueries({queryKey:["packages"]}),(h.type==="bootstrap.completed"||h.type==="bootstrap.partial")&&e.invalidateQueries({queryKey:["rigs","summary"]}),(h.type==="session.discovered"||h.type==="session.vanished")&&e.invalidateQueries({queryKey:["discovery"]}),h.type==="mission_control.action_executed"){e.invalidateQueries({queryKey:["mission-control","audit"]}),e.invalidateQueries({queryKey:["slices"]});const p=h.payload.qitemId;p&&e.invalidateQueries({queryKey:["queue","item",p]})}if(h.type==="node.claimed"){e.invalidateQueries({queryKey:["discovery"]});const p=h.payload.rigId;p&&(e.invalidateQueries({queryKey:["rig",p,"graph"]}),e.invalidateQueries({queryKey:["rig",p,"nodes"]}),e.invalidateQueries({queryKey:["rig",p,"sessions"]}),e.invalidateQueries({queryKey:["rigs","summary"]}),e.invalidateQueries({queryKey:["ps"]}))}if(h.type==="session.detached"&&e.invalidateQueries({queryKey:["discovery"]}),h.type==="session.detached"||h.type==="node.removed"||h.type==="pod.deleted"||h.type==="rig.expanded"||h.type==="restore.completed"||h.type==="rig.deleted"){const p=h.payload.rigId;p&&(e.invalidateQueries({queryKey:["rig",p,"graph"]}),e.invalidateQueries({queryKey:["rig",p,"nodes"]}),e.invalidateQueries({queryKey:["rig",p,"sessions"]})),e.invalidateQueries({queryKey:["rigs","summary"]}),e.invalidateQueries({queryKey:["ps"]})}},[e]);return R.useEffect(()=>{const f=Lp(p=>u(p)),h=PL(p=>{r(p.connected)});return()=>{f(),h()}},[u]),{events:t,connected:s,feedOpen:o,setFeedOpen:c}}function ov(e){return String(e).padStart(2,"0")}function sh(e,t=6){return typeof e!="string"||e.length===0?null:e.slice(-t)}function rh(e){if(typeof e!="string")return null;const t=e.replace(/\s+/g," ").trim();return t.length>0?t:null}function iV(e){const t=e instanceof Date?e:new Date(e);return Number.isNaN(t.getTime())?"??:??:??":`${ov(t.getHours())}:${ov(t.getMinutes())}:${ov(t.getSeconds())}`}function aV(e){return e==="bundle.created"||e.startsWith("bootstrap.")?"bg-accent":e.startsWith("package.")?"bg-primary":e.startsWith("rig.")?"bg-accent":e.startsWith("snapshot.")?"bg-primary":e.startsWith("restore.")?"bg-warning":e==="chat.message"?"bg-primary":e==="node.startup_ready"?"bg-green-500":e==="node.startup_pending"?"bg-amber-400":e==="node.startup_failed"||e==="session.detached"?"bg-destructive":e==="session.discovered"?"bg-accent":e==="session.vanished"?"bg-destructive":e==="node.claimed"||e==="node.launched"?"bg-primary":"bg-foreground-muted-on-dark"}function oV(e){var h;const t=e.payload,n=sh(t.rigId),s=sh(t.snapshotId),r=sh(t.installId),o=sh(t.nodeId),c=rh(t.logicalId),u=rh(t.sender),f=rh(t.body);switch(e.type){case"bootstrap.planned":return`bootstrap planned ${t.sourceRef}`;case"bootstrap.started":return`bootstrap started ${t.sourceRef}`;case"bootstrap.completed":return n?`bootstrap rig#${n} completed`:"bootstrap completed";case"bootstrap.partial":return`bootstrap partial ${t.completed} ok ${t.failed} failed`;case"bootstrap.failed":return`error bootstrap ${t.error}`;case"package.validated":return`package ${t.packageName} validated`;case"package.planned":return`package ${t.packageName} planned ${t.actionable} actionable ${t.deferred} deferred`;case"package.installed":return`package ${t.packageName}@${t.packageVersion} ${t.applied} applied ${t.deferred} deferred`;case"package.rolledback":return r?`rollback install#${r} restored ${t.restored}`:`rollback restored ${t.restored}`;case"package.install_failed":return`error package ${t.packageName} ${t.message}`;case"rig.created":return n?`rig rig#${n} created`:"rig created";case"rig.deleted":return n?`rig rig#${n} deleted`:"rig deleted";case"rig.imported":return n?`import ${t.specName} rig#${n} created`:`import ${t.specName} created`;case"snapshot.created":return n&&s?`snapshot rig#${n} ${t.kind} snap#${s}`:`snapshot ${t.kind}`;case"restore.started":return n?`restore rig#${n} started`:"restore started";case"restore.completed":{const p=Array.isArray(t.result)?t.result:((h=t.result)==null?void 0:h.nodes)??[];return n?`restore rig#${n} ${p.length} nodes restored`:`restore ${p.length} nodes restored`}case"node.launched":return`startup ${c??rh(t.nodeId)??"unknown"} launched`;case"node.startup_pending":return o?`startup node#${o} pending`:"startup pending";case"node.startup_ready":return o?`startup node#${o} ready`:"startup ready";case"node.startup_failed":return o?`error startup node#${o} ${t.error}`:`error startup ${t.error}`;case"session.detached":return`error session ${t.sessionName} lost`;case"bundle.created":return`bundle ${t.bundleName} v${t.bundleVersion} bundled`;case"session.discovered":return`discover ${t.tmuxSession}:${t.tmuxPane} ${t.runtimeHint}`;case"session.vanished":return`error ${t.tmuxSession}:${t.tmuxPane} vanished`;case"node.claimed":return n?`claim ${t.logicalId} rig#${n}`:`claim ${t.logicalId}`;case"chat.message":return`chat ${u??"unknown"}: ${f??""}`.trim();default:return e.type}}function lV(e){const n=e.payload.rigId;if(e.type==="session.discovered"||e.type==="session.vanished")return"/discovery";if(e.type==="node.claimed"){const s=e.payload.rigId;return s?`/rigs/${s}`:"/discovery"}return e.type.startsWith("bootstrap.")||e.type.startsWith("package.")?"/bootstrap":n?`/rigs/${n}`:null}function cV({events:e}){const t=Ot(),n=e.length>=PS;return a.jsxs("div",{"data-testid":"feed-scroll-region",className:"relative z-10 overflow-y-auto flex-1 min-h-0",children:[a.jsxs("div",{"data-testid":"feed-disclosure",className:"px-spacing-3 py-2 border-b border-stone-300/20 font-mono text-[9px] uppercase tracking-[0.06em] text-stone-500",children:["Showing last ",PS," live events in this panel."]}),e.length===0?a.jsx("div",{"data-testid":"feed-empty",className:"px-spacing-3 py-spacing-4 font-mono text-[10px] text-stone-500 text-center",children:"No recent log entries"}):a.jsxs(a.Fragment,{children:[e.map(s=>{const r=lV(s),o=r!==null;return a.jsxs("div",{"data-testid":"feed-entry","data-event-type":s.type,role:o?"link":void 0,tabIndex:o?0:void 0,onClick:o?()=>t({to:r}):void 0,onKeyDown:o?c=>{c.key==="Enter"&&t({to:r})}:void 0,className:he("flex items-center gap-2 px-spacing-3 py-1.5 border-b border-stone-300/20 transition-colors duration-150 ease-tactical font-mono text-[10px] leading-4",o&&"cursor-pointer hover:bg-white/24"),children:[a.jsx("span",{"data-testid":"feed-dot",className:he("inline-block h-[6px] w-[6px] shrink-0",aV(s.type))}),a.jsx("span",{"data-testid":"feed-time",className:"shrink-0 text-[9px] text-stone-500 tabular-nums",children:iV(s.createdAt)}),a.jsx("span",{"data-testid":"feed-summary",className:"min-w-0 flex-1 truncate text-stone-900",children:oV(s)})]},s.seq)}),n?a.jsx("div",{"data-testid":"feed-end-of-history",className:"px-spacing-3 py-2 font-mono text-[9px] uppercase tracking-[0.06em] text-stone-400 text-center",children:"Older events are not loaded in this panel yet."}):null]})]})}function ds({label:e,settingKey:t,resolved:n,testIdPrefix:s}){const[r,o]=R.useState(!1),[c,u]=R.useState(String(n.value??"")),[f,h]=R.useState(null),p=vL(),g=R7(),x=n.source!=="default",v=async()=>{h(null);try{await p.mutateAsync({key:t,value:c}),o(!1)}catch(w){h(w.message)}},b=async()=>{h(null);try{await g.mutateAsync(t)}catch(w){h(w.message)}};return a.jsxs("div",{"data-testid":`${s}-${t}`,className:"border border-stone-300/40 bg-white/8 px-3 py-2 space-y-1",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx("span",{className:"font-mono text-[10px] text-stone-700 truncate",children:e}),a.jsxs("span",{className:"font-mono text-[8px] uppercase tracking-[0.10em] text-stone-500 shrink-0",children:["source: ",n.source]})]}),r?a.jsxs("div",{className:"space-y-1",children:[a.jsx("input",{"data-testid":`${s}-${t}-input`,value:c,onChange:w=>u(w.target.value),className:"w-full border border-stone-300 bg-white/80 px-2 py-1 font-mono text-[10px]"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{"data-testid":`${s}-${t}-save`,onClick:()=>void v(),disabled:p.isPending,className:"font-mono text-[8px] uppercase border border-stone-300 px-2 py-0.5 hover:bg-stone-200 disabled:opacity-50",children:"Save"}),a.jsx("button",{onClick:()=>{o(!1),u(String(n.value??"")),h(null)},className:"font-mono text-[8px] uppercase text-stone-500 hover:text-stone-900",children:"Cancel"})]})]}):a.jsxs("div",{className:"space-y-0.5",children:[a.jsx("div",{className:"font-mono text-[10px] text-stone-800 break-all",children:String(n.value??"")}),a.jsxs("div",{className:"font-mono text-[8px] text-stone-500 break-all",children:["default: ",String(n.defaultValue??"")]}),a.jsxs("div",{className:"flex gap-1 pt-1",children:[a.jsx("button",{"data-testid":`${s}-${t}-edit`,onClick:()=>{o(!0),h(null)},className:"font-mono text-[8px] uppercase border border-stone-300 px-1 py-0.5 hover:bg-stone-200",children:"Edit"}),x&&a.jsx("button",{"data-testid":`${s}-${t}-reset`,onClick:()=>void b(),disabled:g.isPending,className:"font-mono text-[8px] uppercase border border-stone-300 px-1 py-0.5 hover:bg-stone-200 disabled:opacity-50",children:"Reset"})]})]}),f&&a.jsx("div",{"data-testid":`${s}-${t}-error`,className:"font-mono text-[9px] text-red-600",children:f})]})}function ru({title:e,children:t}){return a.jsxs("section",{className:"space-y-2",children:[a.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.16em] text-stone-500",children:e}),a.jsx("div",{className:"space-y-1",children:t})]})}function DL(){const{data:e,isLoading:t,error:n}=io(),s=E7(),[r,o]=R.useState(null),[c,u]=R.useState(null),f=async()=>{u(null),o(null);try{const p=await s.mutateAsync({});o(`Initialized at ${p.root} — created ${p.subdirs.filter(g=>g.created).length} subdir(s).`)}catch(p){u(p.message)}};if(t)return a.jsx("div",{"data-testid":"settings-loading",className:"px-4 py-3 font-mono text-[10px] text-stone-400",children:"Loading settings…"});if(n||!e){const p=(n==null?void 0:n.message)??"",g=p.includes("404");return a.jsx("div",{"data-testid":"settings-error",className:"px-4 py-6 font-mono text-xs text-on-surface-variant border border-outline-variant bg-surface-low",children:g?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"text-stone-900 font-bold uppercase tracking-wide text-[10px] mb-2",children:"Settings UI requires daemon ≥ v0.3.0"}),a.jsx("p",{className:"mb-2",children:"The shipped daemon doesn't expose the settings HTTP route yet. Until that lands, configure via the CLI:"}),a.jsx("pre",{className:"font-mono text-[10px] bg-stone-50 border border-outline-variant px-2 py-1 inline-block",children:"rig config get / set / reset"})]}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"text-stone-900 font-bold uppercase tracking-wide text-[10px] mb-2",children:"Settings unavailable"}),a.jsx("p",{children:p||"Daemon is unreachable."})]})})}const h=e.settings;return a.jsxs("div",{"data-testid":"settings-tab",className:"flex-1 overflow-y-auto px-4 py-3 space-y-4",children:[a.jsxs(ru,{title:"Workspace",children:[a.jsx(ds,{label:"Workspace root",settingKey:"workspace.root",resolved:h["workspace.root"],testIdPrefix:"setting"}),a.jsx(ds,{label:"Mission/slice root",settingKey:"workspace.slices_root",resolved:h["workspace.slices_root"],testIdPrefix:"setting"}),a.jsx(ds,{label:"Steering path",settingKey:"workspace.steering_path",resolved:h["workspace.steering_path"],testIdPrefix:"setting"}),a.jsx(ds,{label:"Field notes root",settingKey:"workspace.field_notes_root",resolved:h["workspace.field_notes_root"],testIdPrefix:"setting"}),a.jsx(ds,{label:"Specs root",settingKey:"workspace.specs_root",resolved:h["workspace.specs_root"],testIdPrefix:"setting"}),a.jsx("button",{"data-testid":"settings-init-workspace",onClick:()=>void f(),disabled:s.isPending,className:"mt-2 font-mono text-[9px] uppercase border border-stone-400 px-2 py-1 hover:bg-stone-200 disabled:opacity-50",children:s.isPending?"Initializing…":"Init Workspace"}),r&&a.jsx("div",{"data-testid":"settings-init-result",className:"font-mono text-[9px] text-stone-600",children:r}),c&&a.jsx("div",{"data-testid":"settings-init-error",className:"font-mono text-[9px] text-red-600",children:c})]}),a.jsx(ru,{title:"Files (browser allowlist)",children:a.jsx(ds,{label:"Allowlist (name:/abs/path,...)",settingKey:"files.allowlist",resolved:h["files.allowlist"],testIdPrefix:"setting"})}),a.jsx(ru,{title:"Progress",children:a.jsx(ds,{label:"Scan roots (name:/abs/path,...)",settingKey:"progress.scan_roots",resolved:h["progress.scan_roots"],testIdPrefix:"setting"})}),a.jsxs(ru,{title:"Daemon (legacy)",children:[a.jsx(ds,{label:"Port",settingKey:"daemon.port",resolved:h["daemon.port"],testIdPrefix:"setting"}),a.jsx(ds,{label:"Host",settingKey:"daemon.host",resolved:h["daemon.host"],testIdPrefix:"setting"})]}),a.jsxs(ru,{title:"Database / Transcripts (legacy)",children:[a.jsx(ds,{label:"DB path",settingKey:"db.path",resolved:h["db.path"],testIdPrefix:"setting"}),a.jsx(ds,{label:"Transcripts enabled",settingKey:"transcripts.enabled",resolved:h["transcripts.enabled"],testIdPrefix:"setting"}),a.jsx(ds,{label:"Transcripts path",settingKey:"transcripts.path",resolved:h["transcripts.path"],testIdPrefix:"setting"})]})]})}async function uV(){if(!(await fetch("/healthz")).ok)throw new Error("unhealthy");return!0}async function dV(){const e=await fetch("/api/adapters/cmux/status");if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}function ih(e){return e===null?"text-stone-500":e?"text-green-600":"text-amber-600"}function fE(e,t,n,s="unknown"){return e===null?s:e?t:n}function fV({onClose:e,events:t,initialTab:n="log"}){var h;const[s,r]=R.useState(n);R.useEffect(()=>{r(n)},[n]);const o=Ze({queryKey:["daemon","health"],queryFn:uV,refetchInterval:1e4,retry:!1}),c=Ze({queryKey:["daemon","cmux"],queryFn:dV,refetchInterval:3e4,retry:!1}),u=o.isSuccess,f=u?((h=c.data)==null?void 0:h.available)??null:null;return a.jsxs("aside",{"data-testid":"system-panel",className:"absolute inset-y-0 right-0 z-20 w-80 border-l border-stone-300/25 bg-[rgba(250,249,245,0.035)] supports-[backdrop-filter]:bg-[rgba(250,249,245,0.018)] backdrop-blur-[14px] backdrop-saturate-75 shadow-[-6px_0_14px_rgba(46,52,46,0.04)] flex flex-col overflow-hidden",children:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-stone-300/35 shrink-0",children:[a.jsx("h2",{className:"min-w-0 font-mono text-xs font-bold text-stone-900 truncate",children:"system"}),a.jsx("button",{"data-testid":"system-close",onClick:e,className:"text-stone-400 hover:text-stone-900 text-sm","aria-label":"Close",children:"✕"})]}),a.jsxs("div",{className:"flex border-b border-stone-300/35 shrink-0","data-testid":"system-tabs",children:[a.jsx("button",{"data-testid":"system-tab-log",onClick:()=>r("log"),className:`flex-1 py-2 text-xs font-mono uppercase text-center ${s==="log"?"border-b-2 border-stone-800 font-bold text-stone-900":"text-stone-400"}`,children:"Recent Log"}),a.jsx("button",{"data-testid":"system-tab-status",onClick:()=>r("status"),className:`flex-1 py-2 text-xs font-mono uppercase text-center ${s==="status"?"border-b-2 border-stone-800 font-bold text-stone-900":"text-stone-400"}`,children:"Status"}),a.jsx("button",{"data-testid":"system-tab-settings",onClick:()=>r("settings"),className:`flex-1 py-2 text-xs font-mono uppercase text-center ${s==="settings"?"border-b-2 border-stone-800 font-bold text-stone-900":"text-stone-400"}`,children:"Settings"})]}),s==="log"&&a.jsx("div",{className:"flex flex-1 min-h-0 flex-col overflow-hidden","data-testid":"system-log-tab",children:a.jsx(cV,{events:t})}),s==="status"&&a.jsx("div",{className:"flex-1 overflow-y-auto px-4 py-3 space-y-4","data-testid":"system-status-tab",children:a.jsxs("section",{className:"border border-stone-300/28 bg-white/12 px-3 py-3",children:[a.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-3",children:"Runtime"}),a.jsxs("div",{className:"space-y-3 font-mono text-[10px]",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(pH,{className:`mt-[1px] h-3.5 w-3.5 shrink-0 ${ih(u)}`}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-stone-900",children:"Daemon"}),a.jsx("div",{"data-testid":"system-daemon-status",className:ih(u),children:fE(u,"connected","unavailable")}),a.jsx("div",{className:"text-stone-500",children:"Controls the local OpenRig daemon connection."})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(Pe,{tool:"cmux",size:"sm",className:`mt-[1px] ${ih(f)}`}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-stone-900",children:"cmux control"}),a.jsx("div",{"data-testid":"system-cmux-status",className:ih(f),children:fE(f,"available","unavailable")}),a.jsx("div",{className:"text-stone-500",children:"OpenRig can control cmux surfaces for node open-or-focus."})]})]})]})]})}),s==="settings"&&a.jsx(DL,{})]})}function hE(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Kj(...e){return t=>{let n=!1;const s=e.map(r=>{const o=hE(r,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let r=0;r<s.length;r++){const o=s[r];typeof o=="function"?o():hE(e[r],null)}}}}function ao(...e){return R.useCallback(Kj(...e),e)}var hV=Symbol.for("react.lazy"),ap=hj[" use ".trim().toString()];function pV(e){return typeof e=="object"&&e!==null&&"then"in e}function qL(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===hV&&"_payload"in e&&pV(e._payload)}function mV(e){const t=xV(e),n=R.forwardRef((s,r)=>{let{children:o,...c}=s;qL(o)&&typeof ap=="function"&&(o=ap(o._payload));const u=R.Children.toArray(o),f=u.find(yV);if(f){const h=f.props.children,p=u.map(g=>g===f?R.Children.count(h)>1?R.Children.only(null):R.isValidElement(h)?h.props.children:null:g);return a.jsx(t,{...c,ref:r,children:R.isValidElement(h)?R.cloneElement(h,void 0,p):null})}return a.jsx(t,{...c,ref:r,children:o})});return n.displayName=`${e}.Slot`,n}var gV=mV("Slot");function xV(e){const t=R.forwardRef((n,s)=>{let{children:r,...o}=n;if(qL(r)&&typeof ap=="function"&&(r=ap(r._payload)),R.isValidElement(r)){const c=wV(r),u=bV(o,r.props);return r.type!==R.Fragment&&(u.ref=s?Kj(s,c):c),R.cloneElement(r,u)}return R.Children.count(r)>1?R.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var vV=Symbol("radix.slottable");function yV(e){return R.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===vV}function bV(e,t){const n={...t};for(const s in t){const r=e[s],o=t[s];/^on[A-Z]/.test(s)?r&&o?n[s]=(...u)=>{const f=o(...u);return r(...u),f}:r&&(n[s]=r):s==="style"?n[s]={...r,...o}:s==="className"&&(n[s]=[r,o].filter(Boolean).join(" "))}return{...e,...n}}function wV(e){var s,r;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const pE=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,mE=JO,$L=(e,t)=>n=>{var s;if((t==null?void 0:t.variants)==null)return mE(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:r,defaultVariants:o}=t,c=Object.keys(r).map(h=>{const p=n==null?void 0:n[h],g=o==null?void 0:o[h];if(p===null)return null;const x=pE(p)||pE(g);return r[h][x]}),u=n&&Object.entries(n).reduce((h,p)=>{let[g,x]=p;return x===void 0||(h[g]=x),h},{}),f=t==null||(s=t.compoundVariants)===null||s===void 0?void 0:s.reduce((h,p)=>{let{class:g,className:x,...v}=p;return Object.entries(v).every(b=>{let[w,S]=b;return Array.isArray(S)?S.includes({...o,...u}[w]):{...o,...u}[w]===S})?[...h,g,x]:h},[]);return mE(e,c,f,n==null?void 0:n.class,n==null?void 0:n.className)},SV=$L("inline-flex items-center justify-center gap-2 whitespace-nowrap text-sm font-medium transition-colors duration-150 ease-tactical focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-stone-900 text-white font-headline font-bold uppercase tracking-widest hover:bg-stone-800",destructive:"bg-tertiary text-white font-bold hover:bg-tertiary/90",outline:"border border-outline bg-transparent hover:bg-stone-100 text-on-surface",secondary:"border border-stone-900 bg-transparent text-stone-900 font-mono text-[10px] uppercase hover:bg-stone-900 hover:text-white",ghost:"text-on-surface-variant hover:bg-stone-100 hover:text-on-surface",link:"text-secondary underline-offset-4 hover:underline",tactical:"border border-outline font-mono text-[10px] text-secondary uppercase tracking-widest hover:border-stone-900 hover:text-stone-900"},size:{default:"h-10 px-4 py-2",sm:"h-9 px-3",lg:"h-11 px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Ce=R.forwardRef(({className:e,variant:t,size:n,asChild:s=!1,children:r,...o},c)=>{const u=s?gV:"button";return a.jsx(u,{className:he(SV({variant:t,size:n,className:e})),ref:c,...o,children:r})});Ce.displayName="Button";async function Dr(e){var n,s;try{if((s=(n=globalThis.navigator)==null?void 0:n.clipboard)!=null&&s.writeText)return await globalThis.navigator.clipboard.writeText(e),!0}catch{}if(!globalThis.document)return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.opacity="0",t.style.pointerEvents="none",document.body.appendChild(t),t.select();try{return document.execCommand("copy")}catch{return!1}finally{t.remove()}}function Yj(e,t=6){return e.length<=t?e:e.slice(-t)}function zL(){const e=Wt();return vn({mutationFn:async()=>{const t=await fetch("/api/discovery/scan",{method:"POST"});if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()},onSuccess:()=>{e.invalidateQueries({queryKey:["discovery"]})}})}function jV(e){const t=new URLSearchParams;e!=null&&e.status&&t.set("status",e.status),e!=null&&e.runtimeHint&&e.runtimeHint.length>0&&t.set("runtimeHint",e.runtimeHint.join(",")),e!=null&&e.minConfidence&&t.set("minConfidence",e.minConfidence);const n=t.toString();return n?`/api/discovery?${n}`:"/api/discovery"}function Wj(e,t=!0){var r;const n=jV(e),s=["discovery",(e==null?void 0:e.status)??"all",((r=e==null?void 0:e.runtimeHint)==null?void 0:r.join(","))??"any",(e==null?void 0:e.minConfidence)??"any"];return Ze({queryKey:s,queryFn:async()=>{const o=await fetch(n);if(!o.ok)throw new Error(`HTTP ${o.status}`);const c=await o.json();return Array.isArray(c)?c:[]},enabled:t})}function NV(e){const{data:t}=Wj({status:"active"},e);return t??[]}function _V(){const e=Wt();return vn({mutationFn:async({discoveredId:t,rigId:n,logicalId:s})=>{const r=await fetch(`/api/discovery/${encodeURIComponent(t)}/bind`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({rigId:n,logicalId:s})});if(!r.ok){const o=await r.json().catch(()=>({}));throw new Error(o.error??`HTTP ${r.status}`)}return r.json()},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["discovery"]}),e.invalidateQueries({queryKey:["rig",n.rigId,"graph"]})}})}function CV(){const e=Wt();return vn({mutationFn:async({discoveredId:t,rigId:n,target:s})=>{const r=await fetch(`/api/discovery/${encodeURIComponent(t)}/adopt`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({rigId:n,target:s})});if(!r.ok){const o=await r.json().catch(()=>({}));throw new Error(o.error??`HTTP ${r.status}`)}return r.json()},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["discovery"]}),e.invalidateQueries({queryKey:["rig",n.rigId,"graph"]})}})}function kV(e){const t=e.match(/^\/rigs\/([^/]+)/);return(t==null?void 0:t[1])??null}function RV(e){return`'${e.replace(/'/g,"'\\''")}'`}function EV(e){const t=e.tmuxWindow?`${e.tmuxSession}:${e.tmuxWindow}`:e.tmuxSession;return`tmux attach -t ${RV(t)}`}function AV(e){const t=e.split(/[@:]/)[0]??e;return(t.split(/[-_.]/).filter(Boolean).at(-1)??t).toLowerCase().replace(/[^a-z0-9_-]/g,"")||"member"}function gE(e){return e.includes(".")?Op(e):e.length>12?Yj(e):e}function xE(e){return e.podLabel??e.podNamespace??Yj(e.podId)}function vE({label:e,activeLabel:t,onClick:n,testId:s,tool:r}){const[o,c]=R.useState(!1),u=R.useRef(null);R.useEffect(()=>()=>{u.current&&clearTimeout(u.current)},[]);const f=async()=>{await n()&&(c(!0),u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{c(!1),u.current=null},900))};return a.jsxs("button",{type:"button","data-testid":s,"aria-label":e,onClick:()=>{f()},className:he("inline-flex items-center gap-1 px-1.5 py-0.5 border font-mono text-[7px] uppercase transition-colors",o?"bg-stone-900 text-white border-stone-900":"bg-white text-stone-900 border-stone-300 hover:bg-stone-100"),children:[r?a.jsx(Pe,{tool:r,size:"xs"}):null,a.jsx("span",{children:o?t:e})]})}function TV({onClose:e,selectedDiscoveredId:t,onSelectDiscoveredId:n,placementTarget:s,onClearPlacement:r}){const o=no({select:w=>w.location.pathname}),c=kV(o),{data:u=[]}=Wj({status:"active",runtimeHint:["claude-code","codex"],minConfidence:"medium"}),f=zL(),h=CV(),p=u.find(w=>w.id===t)??null,[g,x]=R.useState("");R.useEffect(()=>{if(p&&(s==null?void 0:s.kind)==="pod"){x(w=>w||AV(p.tmuxSession));return}(!p||!s||s.kind!=="pod")&&x("")},[p,s]);const v=R.useMemo(()=>p?c?s?s.eligible?s.kind==="node"?`Bind ${p.tmuxSession} to ${gE(s.logicalId)}.`:`Add ${p.tmuxSession} to ${xE(s)} pod.`:s.reason??"That target cannot receive the selected session.":`Selected ${p.tmuxSession}. Click an available node to bind it, or click a pod to add it there.`:"Select a rig in the explorer to place the selected session.":null,[c,s,p]),b=()=>{if(!p||!c||!s||!s.eligible)return;let w;if(s.kind==="node")w={kind:"node",logicalId:s.logicalId};else{if(!s.podNamespace)return;w={kind:"pod",podId:s.podId,podNamespace:s.podNamespace,memberName:g.trim()}}h.mutate({discoveredId:p.id,rigId:c,target:w},{onSuccess:()=>{n(null),r()}})};return a.jsxs("aside",{"data-testid":"discovery-panel",className:"absolute inset-y-0 right-0 z-20 w-80 border-l border-stone-300/25 bg-[rgba(250,249,245,0.035)] supports-[backdrop-filter]:bg-[rgba(250,249,245,0.018)] backdrop-blur-[14px] backdrop-saturate-75 shadow-[-6px_0_14px_rgba(46,52,46,0.04)] flex flex-col overflow-hidden",children:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-stone-300/35 shrink-0",children:[a.jsx("h2",{className:"min-w-0 font-mono text-xs font-bold text-stone-900 truncate",children:"discovery"}),a.jsx("button",{"data-testid":"discovery-close",onClick:e,className:"text-stone-400 hover:text-stone-900 text-sm","aria-label":"Close",children:"✕"})]}),a.jsxs("div",{className:"border-b border-stone-300/35 px-4 py-3 shrink-0 space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.16em] text-stone-500",children:"Inventory"}),a.jsx(Ce,{variant:"ghost",size:"sm","data-testid":"discovery-scan-now",disabled:f.isPending,onClick:()=>f.mutate(),children:f.isPending?"SCANNING...":"SCAN NOW"})]}),a.jsx(Ye,{to:"/discovery/inventory","data-testid":"discovery-open-inventory",onClick:e,className:"inline-flex items-center border border-stone-300 bg-white px-1.5 py-0.5 font-mono text-[7px] uppercase tracking-[0.12em] text-stone-700 transition-colors hover:bg-stone-100 hover:text-stone-900",children:"Legacy Inventory Page"})]}),a.jsx("div",{className:"flex-1 overflow-y-auto px-4 py-3 space-y-3",children:u.length===0?a.jsx("div",{"data-testid":"discovery-empty",className:"font-mono text-[10px] text-stone-500",children:"No running Claude or Codex sessions are currently visible."}):u.map(w=>{const S=w.id===t;return a.jsxs("div",{"data-testid":`discovery-session-${w.id}`,className:he("border border-stone-200 bg-white/60 px-3 py-3",S&&"border-emerald-500 shadow-[0_10px_24px_rgba(34,197,94,0.16)]"),children:[a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[a.jsx(_n,{runtime:w.runtimeHint,size:"xs",compact:!0,className:"bg-white/45"}),a.jsx("div",{className:"font-mono text-[10px] text-stone-900 truncate",title:w.tmuxSession,children:w.tmuxSession})]}),w.cwd?a.jsx("div",{className:"mt-1 font-mono text-[9px] text-stone-500 truncate",title:w.cwd,children:w.cwd}):null]}),a.jsx(Ce,{variant:S?"tactical":"ghost",size:"sm","data-testid":`discovery-select-${w.id}`,onClick:()=>n(S?null:w.id),children:S?"SELECTED":"SELECT"})]}),a.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:[a.jsx(vE,{label:"copy tmux",activeLabel:"copied",testId:`discovery-copy-tmux-${w.id}`,tool:"tmux",onClick:async()=>Dr(EV(w))}),w.cwd?a.jsx(vE,{label:"copy cwd",activeLabel:"copied",testId:`discovery-copy-cwd-${w.id}`,onClick:async()=>Dr(w.cwd??"")}):null]}),S?a.jsxs("div",{className:"mt-3 space-y-2 border-t border-emerald-200/80 pt-3",children:[v?a.jsx("div",{"data-testid":"discovery-selected-session-status",className:"border border-emerald-300/80 bg-white/70 px-2.5 py-2 font-mono text-[10px] leading-5 text-stone-900",children:v}):null,s&&!s.eligible?a.jsx("div",{"data-testid":"discovery-target-error",className:"border border-red-200 bg-red-50/80 px-2.5 py-2 font-mono text-[9px] text-red-700",children:s.reason??"That destination is not available."}):null,s!=null&&s.eligible?a.jsxs("div",{className:"space-y-2 border border-emerald-300/80 bg-white/70 px-3 py-2","data-testid":"discovery-target-card",children:[a.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.16em] text-emerald-800",children:"Target"}),a.jsx("div",{"data-testid":"discovery-target-summary",className:"font-mono text-[10px] text-stone-900",children:s.kind==="node"?`${gE(s.logicalId)} selected`:`${xE(s)} pod selected`}),s.kind==="pod"?a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"font-mono text-[8px] uppercase tracking-[0.16em] text-emerald-800",htmlFor:"discovery-member-name",children:"Member name"}),a.jsx("input",{id:"discovery-member-name","data-testid":"discovery-member-name-input",value:g,onChange:N=>x(N.target.value),className:"w-full bg-transparent border-b border-emerald-300 py-1 font-mono text-[10px] text-stone-900 focus:outline-none focus:border-emerald-700"})]}):null,h.isError?a.jsx("div",{"data-testid":"discovery-adopt-error",className:"font-mono text-[9px] text-red-600",children:h.error.message}):null,a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ce,{variant:"tactical",size:"sm","data-testid":"discovery-confirm-adopt",disabled:h.isPending||s.kind==="pod"&&!g.trim(),onClick:b,children:h.isPending?"ADOPTING...":"ADOPT"}),a.jsx(Ce,{variant:"ghost",size:"sm","data-testid":"discovery-clear-target",onClick:r,children:"CLEAR"})]})]}):null]}):null]},w.id)})})]})}function Dp({testIdPrefix:e,className:t}){const n=s=>e?`${e}-reg-${s}`:void 0;return a.jsxs(a.Fragment,{children:[a.jsx("span",{className:he("reg-tl",t),"data-testid":n("tl"),"aria-hidden":"true"}),a.jsx("span",{className:he("reg-tr",t),"data-testid":n("tr"),"aria-hidden":"true"}),a.jsx("span",{className:he("reg-bl",t),"data-testid":n("bl"),"aria-hidden":"true"}),a.jsx("span",{className:he("reg-br",t),"data-testid":n("br"),"aria-hidden":"true"})]})}const MV={wide:"w-full lg:w-[38rem] lg:max-w-[80vw]",narrow:"w-full lg:w-[22rem] lg:max-w-[60vw]"},IV={left:"border-r border-outline-variant",right:"border-l border-outline-variant"};function OV({children:e,edge:t="right",width:n="wide",onClose:s,className:r,testId:o,...c}){return a.jsxs("div",{className:he("vellum-heavy relative flex flex-col h-full shadow-[0_0_24px_rgba(0,0,0,0.08)]",MV[n],IV[t],r),"data-testid":o,role:"dialog","aria-modal":"false",...c,children:[s?a.jsx("button",{type:"button",onClick:s,"aria-label":"Close sheet",className:"absolute top-2 right-2 z-10 px-2 py-0.5 border border-stone-900 bg-white font-mono text-[10px] hover:bg-stone-100","data-testid":o?`${o}-close`:void 0,children:"×"}):null,a.jsx("div",{className:"flex-1 overflow-auto",children:e}),a.jsx(Dp,{testIdPrefix:o})]})}const LV={default:"text-stone-900",muted:"text-on-surface-variant",strong:"text-stone-900 font-bold",alert:"text-tertiary"};function rt({children:e,right:t,tone:n="default",as:s="header",className:r,...o}){const c=he("font-mono text-[10px] uppercase tracking-[0.18em] flex items-baseline justify-between gap-2",LV[n],r),u=a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"flex-1",children:e}),t?a.jsx("span",{className:"ml-auto flex items-center gap-2",children:t}):null]});return s==="div"?a.jsx("div",{className:c,...o,children:u}):s==="section"?a.jsx("section",{className:c,...o,children:u}):a.jsx("header",{className:c,...o,children:u})}const PV={primary:"bg-white border border-stone-900",ghost:"bg-transparent border border-stone-300"},DV={elevated:"hard-shadow",flat:""};function Es({children:e,header:t,registrationMarks:n=!0,elevation:s="elevated",variant:r="primary",accentClass:o,href:c,as:u="div",className:f,testId:h,onClick:p,...g}){const x=!!(c||p),v=he(PV[r],DV[s],"flex flex-col relative",x&&"focus-visible:outline focus-visible:outline-2 focus-visible:outline-stone-900 focus-visible:outline-offset-2",o,f),b=a.jsxs(a.Fragment,{children:[t?a.jsx("div",{className:"bg-stone-900 text-white px-4 py-1.5 font-mono text-[10px]",children:t}):null,a.jsx("div",{className:"flex flex-col flex-1",children:e}),n?a.jsx(Dp,{testIdPrefix:h}):null]});return c?a.jsx("a",{href:c,className:v,"data-testid":h,onClick:p,...g,children:b}):u==="article"?a.jsx("article",{className:v,"data-testid":h,onClick:p,...g,children:b}):u==="section"?a.jsx("section",{className:v,"data-testid":h,onClick:p,...g,children:b}):a.jsx("div",{className:v,"data-testid":h,onClick:p,...g,children:b})}function qV({action:e,testId:t}){const n="inline-flex items-center px-3 py-1 border border-stone-900 bg-white font-mono text-[10px] uppercase hover:bg-stone-100";return e.href?a.jsx("a",{href:e.href,className:n,"data-testid":t?`${t}-action`:void 0,children:e.label}):a.jsx("button",{type:"button",onClick:e.onClick,className:n,"data-testid":t?`${t}-action`:void 0,children:e.label})}function Xe({icon:e,label:t,description:n,action:s,variant:r="minimal",className:o,testId:c}){const u=a.jsxs("div",{className:he("flex flex-col items-center justify-center text-center p-6 gap-2",o),"data-testid":c,children:[e?a.jsx("div",{className:"text-on-surface-variant","aria-hidden":"true",children:typeof e=="string"?a.jsx("span",{className:"text-2xl",children:e}):e}):null,a.jsx("div",{className:"font-headline font-bold uppercase text-stone-900 text-sm tracking-tight",children:t}),n?a.jsx("div",{className:"text-xs text-on-surface-variant max-w-prose",children:n}):null,s?a.jsx("div",{className:"pt-2",children:a.jsx(qV,{action:s,testId:c})}):null]});return r==="card"?a.jsx(Es,{variant:"ghost",elevation:"flat",registrationMarks:!1,children:u}):u}const $V={neutral:"border-stone-300 bg-white/55 text-stone-700",info:"border-sky-300 bg-sky-50/75 text-sky-800",success:"border-emerald-300 bg-emerald-50/75 text-emerald-800",warning:"border-amber-300 bg-amber-50/80 text-amber-800",danger:"border-rose-300 bg-rose-50/80 text-rose-800"};function Qj(e){const t=e.toLowerCase();return t.includes("mission_control.action_executed")?{label:"Human decision",tone:"success",icon:IS}:t.includes("closure_overdue")||t.includes("overdue")?{label:"Overdue",tone:"danger",icon:Pr}:t.includes("approval")?{label:"Needs approval",tone:"warning",icon:IS}:t.includes("human-gate")||t.includes("human")?{label:"Human action",tone:"danger",icon:Pr}:t.includes("inbox.denied")?{label:"Inbox denied",tone:"danger",icon:VO}:t.includes("inbox.absorbed")?{label:"Inbox absorbed",tone:"success",icon:WF}:t.includes("shipped")?{label:"Shipped",tone:"success",icon:Ej}:t.includes("transition.done")||t.includes("transition.complete")?{label:"Marked done",tone:"success",icon:Iu}:t.includes("transition.in-progress")||t.includes("transition.claim")?{label:"In progress",tone:"info",icon:Ou}:t.includes("transition.pending")?{label:"Pending",tone:"warning",icon:Ou}:t.includes("transition")?{label:"State change",tone:"neutral",icon:yl}:t.includes("ship")||t.includes("done")||t.includes("complete")?{label:"Completed",tone:"success",icon:Iu}:t.includes("unclaim")?{label:"Released",tone:"neutral",icon:lH}:t.includes("claim")?{label:"Claimed",tone:"info",icon:QO}:t.includes("handoff")||t.includes("handed_off")||t.includes("routed")?{label:"Handoff",tone:"info",icon:Tp}:t.includes("created")?{label:"Created",tone:"info",icon:GO}:t.includes("queue.updated")||t.includes("queue.item.updated")?{label:"Queue update",tone:"neutral",icon:yl}:t.includes("progress")?{label:"Progress",tone:"info",icon:yl}:{label:zh(e),tone:"neutral",icon:Ap}}function BL(e){const t=(e==null?void 0:e.toLowerCase().trim())??"";return t?t.includes("closeout-pending-ratify")?{label:"Awaiting approval",tone:"warning",icon:IS}:t.includes("human-gate")||t.includes("pending-approval")?{label:"Needs human",tone:"danger",icon:Pr}:t.includes("blocked")||t.includes("failed")||t.includes("error")||t.includes("denied")?{label:zh(e??""),tone:"danger",icon:Pr}:t.includes("handed-off")||t.includes("routed")?{label:"Routed",tone:"info",icon:Tp}:t.includes("done")||t.includes("complete")||t.includes("closed")||t.includes("shipped")?{label:"Done",tone:"success",icon:Iu}:t.includes("in-progress")||t.includes("running")||t.includes("claimed")?{label:"In progress",tone:"info",icon:QO}:t.includes("pending")||t.includes("open")||t.includes("queued")?{label:"Pending",tone:"warning",icon:Ou}:t.includes("canceled")||t.includes("cancelled")||t.includes("stopped")?{label:zh(e??""),tone:"neutral",icon:VO}:{label:zh(e??""),tone:"neutral",icon:yl}:{label:"Unknown state",tone:"neutral",icon:Ap}}function qp(e){return{label:"Slice",tone:"success",icon:Ap}}function $p(e){const t=(e==null?void 0:e.toLowerCase())??"";return t.includes("done")||t.includes("complete")||t.includes("closed")?"success":t.includes("fail")||t.includes("blocked")||t.includes("overdue")?"danger":t.includes("pending")||t.includes("human")||t.includes("approval")?"warning":t.includes("progress")||t.includes("claim")?"info":"neutral"}function zh(e){return e.replace(/[_./-]+/g," ").replace(/\b\w/g,t=>t.toUpperCase()).trim()}function FL(e){if(!e)return"unknown";if(e==="human@host")return"human@host";const[t,n]=e.split("@");return n?`${t}@${n}`:e}function Xj(e){if(!e)return"unknown";const t=new Date(e);if(Number.isNaN(t.getTime()))return e;const n=new Date,s=t.toDateString()===n.toDateString(),r=new Date(n);r.setDate(n.getDate()-1);const o=new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit"}).format(t);return s?`Today ${o}`:t.toDateString()===r.toDateString()?`Yesterday ${o}`:new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(t)}function Nn({token:e,compact:t=!1,testId:n,className:s}){const r=e.icon;return a.jsxs("span",{"data-testid":n,className:he("inline-flex items-center gap-1 border font-mono uppercase tracking-[0.10em]",t?"px-1.5 py-0.5 text-[8px]":"px-2 py-1 text-[9px]",$V[e.tone],s),children:[r?a.jsx(r,{className:t?"h-2.5 w-2.5":"h-3 w-3",strokeWidth:1.6}):null,e.label]})}function Zj({kind:e,compact:t,testId:n}){return a.jsx(Nn,{token:Qj(e),compact:t,testId:n})}function Jj({state:e,compact:t,testId:n}){return a.jsx(Nn,{token:BL(e),compact:t,testId:n})}function Wi({tag:e,compact:t=!0}){const n=/urgent|blocked|human/i.test(e)?"danger":/proof|pass|done|ship/i.test(e)?"success":/cycle|phase|qa|review/i.test(e)?"info":"neutral";return a.jsx(Nn,{token:{label:e,tone:n},compact:t})}function op({session:e,muted:t}){return a.jsxs("span",{className:he("inline-flex min-w-0 items-center gap-1 border px-1.5 py-0.5 font-mono text-[9px]",t?"border-stone-200 bg-white/35 text-stone-500":"border-stone-300 bg-white/55 text-stone-800"),children:[a.jsx(ip,{actor:e,size:"xs",decorative:!0}),a.jsx("span",{className:"truncate",children:FL(e)})]})}function oo({value:e}){return a.jsxs("time",{dateTime:e??void 0,className:"inline-flex items-center gap-1 border border-stone-200 bg-white/45 px-1.5 py-0.5 font-mono text-[9px] text-stone-600",children:[a.jsx(Cj,{className:"h-3 w-3",strokeWidth:1.5}),Xj(e)]})}function zp({source:e,destination:t,muted:n}){return!e&&!t?null:a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[a.jsx(op,{session:e??"unknown source",muted:n}),a.jsx(np,{className:"h-3.5 w-3.5 text-stone-400",strokeWidth:1.4}),a.jsx(op,{session:t??"unresolved target",muted:n})]})}function HL({sliceName:e,screenshots:t,onSelect:n,max:s=4,testIdPrefix:r}){return t.length===0?null:a.jsx("div",{className:"grid grid-cols-2 gap-2",children:t.slice(0,s).map(o=>{const c=a.jsx("img",{"data-testid":r?`${r}-${o}`:void 0,src:yu(e,o),alt:o,className:"h-24 w-full border border-stone-200 bg-stone-100 object-cover",loading:"lazy"});return n?a.jsxs("button",{type:"button",onClick:()=>n(o),className:"group relative block w-full text-left focus:outline-none focus:ring-2 focus:ring-stone-900/20",children:[c,a.jsxs("span",{className:"absolute left-1.5 top-1.5 inline-flex items-center gap-1 border border-amber-400/45 bg-white/80 px-1.5 py-0.5 font-mono text-[8px] uppercase tracking-[0.10em] text-amber-950 backdrop-blur-sm",children:[a.jsx(Pe,{tool:o,size:"xs",decorative:!0}),"Proof image"]})]},o):a.jsx("div",{children:c},o)})})}function Bp({title:e,badge:t}){return a.jsxs("div",{className:"flex items-center justify-between gap-2 font-mono text-[9px] uppercase tracking-[0.12em] text-stone-600",children:[a.jsxs("span",{className:"truncate inline-flex items-center gap-1",children:[a.jsx(Pe,{tool:"proof",size:"xs"}),e]}),a.jsx(Nn,{token:{label:t,tone:$p(t)},compact:!0})]})}const yE=30;function zV({qitemId:e,source:t,destination:n,state:s,tags:r,createdAt:o,body:c,related:u}){const[f,h]=R.useState(!1),p=c?c.split(`
316
+ `):[],g=f?p:p.slice(0,yE);return e?a.jsxs("div",{"data-testid":"queue-item-viewer",className:"flex flex-col h-full",children:[a.jsxs("header",{className:"px-4 py-3 border-b border-outline-variant",children:[a.jsx(rt,{tone:"muted",children:"Queue item"}),a.jsx("h3",{className:"mt-1 font-mono text-xs text-stone-900 break-all",children:e})]}),a.jsxs("div",{className:"px-4 py-3 border-b border-outline-variant space-y-2 font-mono text-xs",children:[t||n?a.jsx(sl,{label:"Route",children:a.jsx(zp,{source:t,destination:n,muted:!0})}):null,t?a.jsx(sl,{label:"Source",children:a.jsx(op,{session:t,muted:!0})}):null,n?a.jsx(sl,{label:"Dest",children:a.jsx(op,{session:n,muted:!0})}):null,s?a.jsx(sl,{label:"State",children:a.jsx(Jj,{state:s,testId:"qitem-state"})}):null,r&&r.length>0?a.jsx(sl,{label:"Tags",children:a.jsx("span",{className:"flex min-w-0 flex-wrap justify-end gap-1",children:r.map(x=>a.jsx(Wi,{tag:x},x))})}):null,o?a.jsx(sl,{label:"Created",children:a.jsx(oo,{value:o})}):null]}),a.jsxs("div",{className:"px-4 py-3 border-b border-outline-variant flex-1 min-h-0 overflow-y-auto",children:[a.jsx(rt,{tone:"muted",children:"Body"}),c?a.jsx("pre",{"data-testid":"qitem-body",className:"mt-2 whitespace-pre-wrap font-mono text-xs text-stone-900",children:g.join(`
317
+ `)}):a.jsx("p",{className:"mt-2 font-mono text-xs text-on-surface-variant italic",children:"No body."}),c&&p.length>yE?a.jsx("button",{type:"button",onClick:()=>h(x=>!x),"data-testid":"qitem-body-toggle",className:"mt-2 font-mono text-[10px] uppercase tracking-wide text-stone-700 hover:text-stone-900 underline",children:f?"Show less":`Show full body (${p.length} lines)`}):null]}),u&&u.length>0?a.jsxs("div",{className:"px-4 py-3",children:[a.jsx(rt,{tone:"muted",children:"Related"}),a.jsx("ul",{className:"mt-2 space-y-1 font-mono text-xs",children:u.map((x,v)=>a.jsxs("li",{className:"flex items-baseline gap-2",children:[a.jsxs("span",{className:"inline-flex w-12 shrink-0 items-center gap-1 text-on-surface-variant text-[10px] uppercase tracking-wide",children:[a.jsx(BV,{kind:x.kind,label:x.label}),x.kind]}),x.href?a.jsx("a",{href:x.href,className:"text-stone-900 hover:underline truncate",children:x.label}):a.jsx("span",{className:"text-stone-900 truncate",children:x.label})]},`${x.kind}-${v}`))})]}):null]}):a.jsx(Xe,{label:"NO QITEM",description:"No queue item selected.",variant:"card",testId:"queue-item-viewer-empty"})}function BV({kind:e,label:t}){return e==="file"?a.jsx(Pe,{tool:t,size:"xs"}):e==="commit"?a.jsx(Pe,{tool:"commit",size:"xs",decorative:!0}):e==="slice"?a.jsx(Pe,{tool:"folder",size:"xs",decorative:!0}):a.jsx(Pe,{tool:"terminal",size:"xs",decorative:!0})}function sl({label:e,children:t}){return a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsx("span",{className:"shrink-0 text-on-surface-variant",children:e}),a.jsx("span",{className:"min-w-0 text-stone-900",children:t})]})}function FV({code:e,language:t}){const n=UV(t),s=R.useMemo(()=>GV(e,n),[e,n]);return a.jsx("pre",{"data-testid":"syntax-highlight-block","data-language":n,className:"overflow-x-auto bg-stone-900 p-3 font-mono text-[10px] leading-relaxed text-stone-100",children:a.jsx("code",{children:s.map((r,o)=>a.jsx("span",{className:r.className,"data-token-kind":r.kind,children:r.text},o))})})}const HV={plain:"",keyword:"text-violet-300",string:"text-emerald-300",comment:"text-stone-500 italic",number:"text-amber-300",tag:"text-sky-300",punctuation:"text-stone-400"};function pt(e,t){return{kind:e,text:t,className:HV[e]}}function UV(e){if(!e)return"";const t=e.toLowerCase().trim();return t==="javascript"?"js":t==="typescript"?"ts":t==="shell"?"sh":t}const VV={ts:new Set(["const","let","var","function","return","if","else","for","while","switch","case","break","continue","default","class","extends","implements","interface","type","enum","import","export","from","as","new","this","super","async","await","throw","try","catch","finally","static","public","private","protected","readonly","abstract","true","false","null","undefined","void","string","number","boolean","any","unknown","never"]),tsx:new Set(["const","let","var","function","return","if","else","for","while","switch","case","break","continue","default","class","extends","implements","interface","type","enum","import","export","from","as","new","this","super","async","await","throw","try","catch","finally","static","public","private","protected","readonly","abstract","true","false","null","undefined","void","string","number","boolean","any","unknown","never"]),js:new Set(["const","let","var","function","return","if","else","for","while","switch","case","break","continue","default","class","extends","import","export","from","as","new","this","super","async","await","throw","try","catch","finally","true","false","null","undefined"]),jsx:new Set(["const","let","var","function","return","if","else","for","while","switch","case","break","continue","default","class","extends","import","export","from","as","new","this","super","async","await","throw","try","catch","finally","true","false","null","undefined"]),py:new Set(["def","class","if","elif","else","for","while","return","import","from","as","with","try","except","finally","raise","lambda","yield","pass","break","continue","global","nonlocal","True","False","None","and","or","not","in","is","async","await"]),python:new Set(["def","class","if","elif","else","for","while","return","import","from","as","with","try","except","finally","raise","lambda","yield","pass","break","continue","global","nonlocal","True","False","None","and","or","not","in","is","async","await"]),bash:new Set(["if","then","else","elif","fi","for","while","do","done","case","esac","function","return","export","local","readonly","echo","printf","exit","set","unset","shift","true","false"]),sh:new Set(["if","then","else","elif","fi","for","while","do","done","case","esac","function","return","export","local","readonly","echo","printf","exit","set","unset","shift","true","false"]),sql:new Set(["select","from","where","and","or","not","null","is","in","like","between","join","left","right","inner","outer","on","group","by","order","having","limit","offset","insert","into","values","update","set","delete","create","table","drop","alter","index","primary","key","foreign","references","constraint","unique","default","as","case","when","then","else","end"])};function GV(e,t){return t===""||t==="text"||t==="plain"?[pt("plain",e)]:t==="json"?YV(e):t==="yaml"||t==="yml"?KV(e):t==="md"||t==="markdown"?WV(e):t==="py"||t==="python"||t==="sh"||t==="bash"?ah(e,t,"#"):t==="ts"||t==="tsx"||t==="js"||t==="jsx"?ah(e,t,"//","/*","*/"):t==="sql"?ah(e,t,"--"):[pt("plain",e)]}function ah(e,t,n,s,r){const o=VV[t]??new Set,c=[];let u=0;for(;u<e.length;){const f=e.slice(u);if(s&&f.startsWith(s)){const x=r?f.indexOf(r,s.length):-1,v=x===-1?f.length:x+((r==null?void 0:r.length)??0);c.push(pt("comment",f.slice(0,v))),u+=v;continue}if(f.startsWith(n)){const x=f.indexOf(`
318
+ `),v=x===-1?f.length:x;c.push(pt("comment",f.slice(0,v))),u+=v;continue}const h=f[0];if(h==='"'||h==="'"||h==="`"){let x=1;for(;x<f.length&&f[x]!==h;)f[x]==="\\"&&x+1<f.length?x+=2:x++;const v=x<f.length?x+1:x;c.push(pt("string",f.slice(0,v))),u+=v;continue}const p=f.match(/^-?\d+(\.\d+)?/);if(p&&(u===0||!/[a-zA-Z_]/.test(e[u-1]??""))){c.push(pt("number",p[0])),u+=p[0].length;continue}const g=f.match(/^[a-zA-Z_][a-zA-Z0-9_]*/);if(g){o.has(g[0])?c.push(pt("keyword",g[0])):c.push(pt("plain",g[0])),u+=g[0].length;continue}c.push(pt("plain",e[u]??"")),u++}return eN(c)}function KV(e){const t=[];for(const n of e.split(/(\n)/)){if(n===`
319
+ `){t.push(pt("plain",`
320
+ `));continue}const s=n.indexOf("#");if(s!==-1){const r=n.slice(0,s);t.push(...bE(r)),t.push(pt("comment",n.slice(s)))}else t.push(...bE(n))}return eN(t)}function bE(e){const t=e.match(/^(\s*)([\w.-]+)(:)(\s*)(.*)$/);if(t){const n=[];n.push(pt("plain",t[1])),n.push(pt("tag",t[2])),n.push(pt("punctuation",t[3])),n.push(pt("plain",t[4]));const s=t[5];return s.startsWith('"')||s.startsWith("'")?n.push(pt("string",s)):/^\d+(\.\d+)?$/.test(s)?n.push(pt("number",s)):n.push(pt("plain",s)),n}return[pt("plain",e)]}function YV(e){const t=[];let n=0;for(;n<e.length;){const s=e[n];if(s==='"'){let c=1;for(;c<e.length-n&&e[n+c]!=='"';)e[n+c]==="\\"?c+=2:c++;t.push(pt("string",e.slice(n,n+c+1))),n+=c+1;continue}if(s==="{"||s==="}"||s==="["||s==="]"||s===","||s===":"){t.push(pt("punctuation",s)),n++;continue}const r=e.slice(n).match(/^-?\d+(\.\d+)?/);if(r){t.push(pt("number",r[0])),n+=r[0].length;continue}const o=e.slice(n).match(/^(true|false|null)\b/);if(o){t.push(pt("keyword",o[0])),n+=o[0].length;continue}t.push(pt("plain",s??"")),n++}return eN(t)}function WV(e){return[pt("plain",e)]}function eN(e){const t=[];for(const n of e){const s=t[t.length-1];s&&s.kind==="plain"&&n.kind==="plain"?t[t.length-1]=pt("plain",s.text+n.text):t.push(n)}return t}function UL({content:e,assetBasePath:t,hideFrontmatter:n=!1,hideRawToggle:s=!1}){const r=R.useMemo(()=>QV(e),[e]),[o,c]=R.useState("rendered");return a.jsxs("article",{"data-testid":"markdown-viewer","data-mode":o,className:"prose-tactical max-w-none",children:[!s&&a.jsxs("div",{"data-testid":"markdown-viewer-mode-toggle",className:"mb-2 flex items-center gap-1",children:[a.jsx("button",{type:"button","data-testid":"markdown-viewer-mode-rendered","data-active":o==="rendered",onClick:()=>c("rendered"),className:`border px-2 py-0.5 font-mono text-[9px] uppercase tracking-[0.10em] ${o==="rendered"?"border-stone-700 bg-stone-700 text-white":"border-stone-300 text-stone-700 hover:bg-stone-100"}`,children:"rendered"}),a.jsx("button",{type:"button","data-testid":"markdown-viewer-mode-raw","data-active":o==="raw",onClick:()=>c("raw"),className:`border px-2 py-0.5 font-mono text-[9px] uppercase tracking-[0.10em] ${o==="raw"?"border-stone-700 bg-stone-700 text-white":"border-stone-300 text-stone-700 hover:bg-stone-100"}`,children:"raw"})]}),!n&&r.frontmatter&&a.jsx(ZV,{frontmatter:r.frontmatter}),o==="raw"?a.jsx("pre",{"data-testid":"markdown-viewer-raw",className:"overflow-x-auto whitespace-pre-wrap break-words bg-stone-50 p-3 font-mono text-[10px] text-stone-800",children:e}):a.jsx("div",{className:"space-y-3","data-testid":"markdown-viewer-rendered",children:r.blocks.map((u,f)=>a.jsx(JV,{block:u,assetBasePath:t},f))})]})}function QV(e){var c;const{frontmatter:t,body:n}=XV(e),s=n.split(`
321
+ `),r=[];let o=0;for(;o<s.length;){const u=s[o],f=u.match(/^```(\w*)\s*$/);if(f){const g=f[1]||null,x=(g==null?void 0:g.toLowerCase())==="mermaid",v=o+1;let b=v;for(;b<s.length&&!s[b].match(/^```\s*$/);)b++;const w=s.slice(v,b).join(`
322
+ `);r.push({type:"code",language:g,text:w,isMermaid:x}),o=b+1;continue}const h=u.match(/^(#{1,4})\s+(.+?)\s*$/);if(h){r.push({type:"heading",level:h[1].length,text:h[2]}),o++;continue}if(u.match(/^\s*([-*]|\d+\.)\s+/)){const g=[],x=!!u.match(/^\s*\d+\./);for(;o<s.length&&s[o].match(/^\s*([-*]|\d+\.)\s+/);){const v=s[o].match(/^(\s*)([-*]|\d+\.)\s+(.+)$/);if(!v)break;const b=Math.floor((((c=v[1])==null?void 0:c.length)??0)/2);g.push({depth:b,text:v[3]}),o++}r.push({type:"list",ordered:x,items:g});continue}if(u.match(/^\s*\|.*\|\s*$/)&&o+1<s.length&&s[o+1].match(/^\s*\|[\s\-:|]+\|\s*$/)){const g=wE(u);o+=2;const x=[];for(;o<s.length&&s[o].match(/^\s*\|.*\|\s*$/);)x.push(wE(s[o])),o++;r.push({type:"table",headers:g,rows:x});continue}if(u.trim()===""){r.push({type:"blank"}),o++;continue}const p=[u];for(o++;o<s.length;){const g=s[o];if(g.trim()===""||g.match(/^```/)||g.match(/^#{1,4}\s/)||g.match(/^\s*([-*]|\d+\.)\s/)||g.match(/^\s*\|.*\|\s*$/))break;p.push(g),o++}r.push({type:"paragraph",text:p.join(" ")})}return{frontmatter:t,blocks:r}}function XV(e){if(!e.startsWith(`---
323
+ `)&&!e.startsWith(`---\r
324
+ `))return{frontmatter:null,body:e};const t=e.slice(e.indexOf(`
325
+ `)+1),n=t.match(/(^|\n)---(\n|$)/);if(!n||n.index===void 0)return{frontmatter:null,body:e};const s=t.slice(0,n.index),r=t.slice(n.index+n[0].length),o={};for(const c of s.split(`
326
+ `)){const u=c.match(/^([\w.-]+):\s*(.+?)\s*$/);if(u){let f=u[2];(f.startsWith('"')&&f.endsWith('"')||f.startsWith("'")&&f.endsWith("'"))&&(f=f.slice(1,-1)),o[u[1]]=f}}return{frontmatter:o,body:r}}function wE(e){return e.trim().replace(/^\||\|$/g,"").split("|").map(t=>t.trim())}function ZV({frontmatter:e}){const t=Object.entries(e);return t.length===0?null:a.jsxs("section",{"data-testid":"markdown-frontmatter",className:"mb-4 border border-stone-300 bg-stone-50 p-3",children:[a.jsx("div",{className:"mb-2 font-mono text-[8px] uppercase tracking-[0.18em] text-stone-500",children:"Frontmatter"}),a.jsx("dl",{className:"grid grid-cols-[max-content_1fr] gap-x-3 gap-y-1",children:t.map(([n,s])=>a.jsxs(R.Fragment,{children:[a.jsx("dt",{className:"font-mono text-[10px] font-bold text-stone-700",children:n}),a.jsx("dd",{className:"font-mono text-[10px] text-stone-800 break-all",children:s})]},n))})]})}function JV({block:e,assetBasePath:t}){if(e.type==="blank")return null;if(e.type==="heading"){const n={1:"text-lg font-bold",2:"text-base font-bold",3:"text-sm font-bold",4:"text-xs font-bold"},s=`h${e.level}`;return a.jsx(s,{"data-testid":`md-heading-${e.level}`,className:`${n[e.level]} mt-4 text-stone-900`,children:iu(e.text,t)})}if(e.type==="paragraph")return a.jsx("p",{"data-testid":"md-paragraph",className:"text-[12px] leading-relaxed text-stone-800",children:iu(e.text,t)});if(e.type==="code")return e.isMermaid?a.jsxs("div",{"data-testid":"md-mermaid-placeholder",className:"border border-amber-300 bg-amber-50 p-3",children:[a.jsx("div",{className:"mb-2 font-mono text-[8px] uppercase tracking-[0.18em] text-amber-700",children:"mermaid diagram (v0+1 trigger: render-on-click flow)"}),a.jsx("pre",{className:"overflow-x-auto bg-stone-900 p-2 font-mono text-[10px] text-stone-100",children:a.jsx("code",{children:e.text})}),a.jsx("button",{type:"button","data-testid":"md-mermaid-render-btn",disabled:!0,title:"Mermaid rendering not bundled at v0 (named v0+1 trigger). Inspect the source above.",className:"mt-2 cursor-not-allowed border border-amber-400 bg-amber-100 px-2 py-1 font-mono text-[9px] uppercase tracking-[0.10em] text-amber-800",children:"[render mermaid] (v0+1)"})]}):a.jsx(FV,{code:e.text,language:e.language});if(e.type==="list"){const n=e.ordered?"ol":"ul";return a.jsx(n,{"data-testid":`md-list-${e.ordered?"ol":"ul"}`,className:`${e.ordered?"list-decimal":"list-disc"} ml-5 space-y-1 text-[12px] text-stone-800`,children:e.items.map((s,r)=>a.jsx("li",{style:{marginLeft:`${s.depth*1}rem`},children:iu(s.text,t)},r))})}return e.type==="table"?a.jsx("div",{"data-testid":"md-table-wrapper",className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full border-collapse border border-stone-300 text-[10px]",children:[a.jsx("thead",{className:"bg-stone-100",children:a.jsx("tr",{children:e.headers.map((n,s)=>a.jsx("th",{className:"border border-stone-300 px-2 py-1 text-left font-bold text-stone-900",children:iu(n,t)},s))})}),a.jsx("tbody",{children:e.rows.map((n,s)=>a.jsx("tr",{className:s%2===0?"bg-white":"bg-stone-50",children:n.map((r,o)=>a.jsx("td",{className:"border border-stone-300 px-2 py-1 text-stone-800",children:iu(r,t)},o))},s))})]})}):null}function iu(e,t){const n=[];let s=0,r=0;const o=(u,f)=>{f>u&&n.push(e.slice(u,f))};let c=0;for(;s<e.length;){const u=e.slice(s),f=u.match(/^!\[([^\]]*)\]\(([^)]+)\)/);if(f){o(c,s);const p=eG(f[2],t);n.push(a.jsx("img",{"data-testid":"md-inline-image",src:p,alt:f[1]??"",loading:"lazy",className:"my-2 inline-block max-w-full border border-stone-200"},r++)),s+=f[0].length,c=s;continue}const h=u.match(/^\[([^\]]+)\]\(([^)]+)\)/);if(h){o(c,s),n.push(a.jsx("a",{"data-testid":"md-inline-link",href:h[2],target:"_blank",rel:"noopener noreferrer",className:"text-blue-700 underline hover:text-blue-900",children:h[1]},r++)),s+=h[0].length,c=s;continue}if(u.startsWith("`")){const p=u.indexOf("`",1);if(p!==-1){o(c,s),n.push(a.jsx("code",{"data-testid":"md-inline-code",className:"bg-stone-100 px-1 font-mono text-[10px] text-stone-900",children:u.slice(1,p)},r++)),s+=p+1,c=s;continue}}if(u.startsWith("**")){const p=u.indexOf("**",2);if(p!==-1){o(c,s),n.push(a.jsx("strong",{className:"font-bold",children:u.slice(2,p)},r++)),s+=p+2,c=s;continue}}if(u.startsWith("*")&&!u.startsWith("**")){const p=u.indexOf("*",1);if(p!==-1&&p>1){o(c,s),n.push(a.jsx("em",{className:"italic",children:u.slice(1,p)},r++)),s+=p+1,c=s;continue}}s++}return o(c,e.length),n}function eG(e,t){if(!e||e.startsWith("http://")||e.startsWith("https://")||e.startsWith("data:")||e.startsWith("/")||!t)return e;const n=t.endsWith("/")?"":"/";return`${t}${n}${e}`}function VL(e){const t=e.toLowerCase();return t.endsWith(".md")||t.endsWith(".mdx")?"markdown":t.endsWith(".yaml")||t.endsWith(".yml")?"yaml":t.endsWith(".json")?"json":t.endsWith(".png")||t.endsWith(".jpg")||t.endsWith(".jpeg")||t.endsWith(".gif")||t.endsWith(".webp")||t.endsWith(".svg")?"image":(t.endsWith(".log")||t.endsWith(".txt"),"text")}function SE(e){return e.replaceAll("\\","/").replace(/\/+$/,"")}function tG(e,t){if(!e||!t)return null;const n=SE(t),s=[...e].sort((r,o)=>o.path.length-r.path.length);for(const r of s){const o=SE(r.path);if(n===o)return null;const c=`${o}/`;if(!n.startsWith(c))continue;const u=n.slice(c.length);return!u||u.includes("../")?null:{root:r.name,path:u}}return null}function nG(e){const t=e.root?{root:e.root,path:e.readPath??e.path}:null,n=!t&&!!e.absolutePath,s=yL(),r=R.useMemo(()=>{if(!n)return null;const o=s.data;return!o||"unavailable"in o?null:tG(o.roots,e.absolutePath)},[e.absolutePath,n,s.data]);return{rootsLoading:n&&s.isLoading,target:t??r,hasFetchIntent:!!t||!!e.absolutePath}}function GL({path:e,resolvedKind:t,content:n,imageUrl:s,target:r}){return!n&&!s&&t!=="binary"?a.jsx(Xe,{label:"NO CONTENT",description:`Loading ${e}...`,variant:"card",testId:"file-viewer-empty"}):a.jsxs("div",{"data-testid":"file-viewer","data-file-kind":t,className:"flex flex-col h-full",children:[a.jsxs("header",{className:"px-4 py-3 border-b border-outline-variant",children:[a.jsxs("div",{className:"inline-flex items-center gap-1.5",children:[a.jsx(Pe,{tool:e,size:"sm",decorative:!0}),a.jsx(rt,{tone:"muted",children:TL(e).label})]}),a.jsx("h3",{className:"mt-1 font-mono text-xs text-stone-900 break-all",children:e}),r&&a.jsxs("div",{"data-testid":"file-viewer-root-path",className:"mt-1 font-mono text-[9px] text-stone-500 break-all",children:[r.root,"/",r.path]})]}),a.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[t==="markdown"&&n?a.jsx("div",{className:"px-4 py-3",children:a.jsx(UL,{content:n})}):null,t==="yaml"||t==="json"?a.jsx("pre",{className:"px-4 py-3 font-mono text-xs text-stone-900 whitespace-pre-wrap",children:n}):null,t==="text"?a.jsx("pre",{className:"px-4 py-3 font-mono text-xs text-stone-900 whitespace-pre",children:n}):null,t==="image"&&s?a.jsx("div",{className:"px-4 py-3 flex justify-center",children:a.jsx("img",{src:s,alt:e,className:"max-w-full h-auto"})}):null,t==="binary"?a.jsx("div",{className:"px-4 py-6",children:a.jsx(Xe,{label:"BINARY",description:"Cannot preview; download instead.",variant:"card",testId:"file-viewer-binary"})}):null]})]})}function sG(e){var b,w;const{path:t,kind:n,content:s,imageUrl:r}=e,o=n??VL(t),{rootsLoading:c,target:u,hasFetchIntent:f}=nG(e),h=bL((u==null?void 0:u.root)??null,(u==null?void 0:u.path)??null),p=(b=h.data)==null?void 0:b.content,g=u&&o==="image"?L7(u.root,u.path):void 0,x=s??p,v=r??g;return!s&&!r&&f&&(c||h.isLoading)?a.jsx(Xe,{label:"LOADING",description:`Loading ${t}...`,variant:"card",testId:"file-viewer-empty"}):!s&&!r&&f&&!u?a.jsx(Xe,{label:"FILE UNAVAILABLE",description:`No configured file root contains ${t}.`,variant:"card",testId:"file-viewer-error"}):!s&&!r&&h.isError?a.jsx(Xe,{label:"FILE UNAVAILABLE",description:((w=h.error)==null?void 0:w.message)??`Could not load ${t}.`,variant:"card",testId:"file-viewer-error"}):a.jsx(GL,{path:t,resolvedKind:o,content:x,imageUrl:v,target:u})}function KL(e){return!e.root&&!e.absolutePath?a.jsx(GL,{path:e.path,resolvedKind:e.kind??VL(e.path),content:e.content,imageUrl:e.imageUrl}):a.jsx(sG,{...e})}function rG({specKind:e,specName:t,version:n,source:s,manifestExcerpt:r,entryId:o}){return a.jsxs("div",{"data-testid":"sub-spec-preview",className:"flex flex-col h-full",children:[a.jsxs("header",{className:"px-4 py-3 border-b border-outline-variant",children:[a.jsx(rt,{tone:"muted",children:"Referenced spec"}),a.jsxs("h3",{className:"mt-1 font-mono text-xs text-stone-900 break-all",children:[e,": ",t]})]}),a.jsxs("div",{className:"px-4 py-3 border-b border-outline-variant space-y-1.5 font-mono text-xs",children:[a.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[a.jsx("span",{className:"text-on-surface-variant",children:"Kind"}),a.jsx("span",{className:"text-stone-900",children:e})]}),n?a.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[a.jsx("span",{className:"text-on-surface-variant",children:"Version"}),a.jsx("span",{className:"text-stone-900",children:n})]}):null,s?a.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[a.jsx("span",{className:"text-on-surface-variant",children:"Source"}),a.jsx("span",{className:"text-stone-900 uppercase",children:s.replace("_"," ")})]}):null]}),a.jsxs("div",{className:"px-4 py-3 flex-1 min-h-0 overflow-y-auto",children:[a.jsx(rt,{tone:"muted",children:"Manifest excerpt"}),r?a.jsx("pre",{className:"mt-2 whitespace-pre-wrap font-mono text-xs text-stone-900",children:r}):a.jsx("p",{className:"mt-2 font-mono text-xs text-on-surface-variant italic",children:"No excerpt available."})]}),o?a.jsx("div",{className:"px-4 py-3 border-t border-outline-variant",children:a.jsx(Ye,{to:"/specs/library/$entryId",params:{entryId:o},"data-testid":"sub-spec-open-center",className:"inline-flex items-center px-3 py-1 border border-outline-variant bg-white font-mono text-[10px] uppercase tracking-wide text-stone-900 hover:bg-stone-100",children:"Open in center →"})}):null]})}function iG({selection:e,onClose:t,events:n,selectedDiscoveredId:s,onSelectDiscoveredId:r,placementTarget:o,onClearPlacement:c}){if(!e)return null;const u=e.type==="system"?a.jsx(fV,{onClose:t,events:n,initialTab:e.tab??"log"}):e.type==="discovery"?a.jsx(TV,{onClose:t,selectedDiscoveredId:s,onSelectDiscoveredId:r,placementTarget:o,onClearPlacement:c}):e.type==="qitem"?a.jsx(zV,{...e.data}):e.type==="file"?a.jsx(KL,{...e.data}):e.type==="sub-spec"?a.jsx(rG,{...e.data}):null;return a.jsxs("div",{"data-testid":"shared-detail-drawer-layer",className:"fixed top-14 right-0 bottom-0 left-0 z-30 pointer-events-none",children:[a.jsx("button",{type:"button","aria-label":"Close drawer","data-testid":"shared-detail-drawer-outside",className:"absolute inset-0 cursor-default pointer-events-auto",onPointerDown:t}),a.jsx(OV,{edge:"right",width:"wide",onClose:t,testId:"shared-detail-drawer",className:"absolute top-0 right-0 bottom-0 z-10 pointer-events-auto",children:u})]})}async function aG(e,t,n){const s=`/api/rigs/${encodeURIComponent(e)}/nodes/${encodeURIComponent(t)}/preview?lines=${n}`,r=await fetch(s);if(r.status===404)return{unavailable:!0,reason:(await r.json().catch(()=>({}))).error??"preview_unavailable"};if(r.status===409){const o=await r.json().catch(()=>({}));return{unavailable:!0,reason:o.error??"session_unbound",hint:o.hint}}if(r.status===502){const o=await r.json().catch(()=>({}));return{unavailable:!0,reason:o.error??"capture_failed",hint:o.hint}}if(r.status===503){const o=await r.json().catch(()=>({}));return{unavailable:!0,reason:o.error??"preview_unavailable",hint:o.hint}}if(!r.ok)throw new Error(`HTTP ${r.status}`);return await r.json()}function oG(e){var c,u,f,h;const{data:t}=io(),n=(u=(c=t==null?void 0:t.settings)==null?void 0:c["ui.preview.refresh_interval_seconds"])==null?void 0:u.value,s=(h=(f=t==null?void 0:t.settings)==null?void 0:f["ui.preview.default_lines"])==null?void 0:h.value,r=e.lines??s??50,o=e.paused?!1:(n??3)*1e3;return Ze({queryKey:["node-preview",e.rigId,e.logicalId,r],queryFn:()=>aG(e.rigId,e.logicalId,r),enabled:!!e.rigId&&!!e.logicalId&&!e.paused,refetchInterval:o,refetchIntervalInBackground:!1,staleTime:0})}function Ca(e){return!!(e&&"unavailable"in e)}async function lG(e,t){const n=`/api/sessions/${encodeURIComponent(e)}/preview?lines=${t}`,s=await fetch(n);if(s.status===404)return{unavailable:!0,reason:(await s.json().catch(()=>({}))).error??"preview_unavailable"};if(s.status===502||s.status===503){const r=await s.json().catch(()=>({}));return{unavailable:!0,reason:r.error??"preview_unavailable",hint:r.hint}}if(!s.ok)throw new Error(`HTTP ${s.status}`);return await s.json()}function cG(e){var c,u,f,h;const{data:t}=io(),n=(u=(c=t==null?void 0:t.settings)==null?void 0:c["ui.preview.refresh_interval_seconds"])==null?void 0:u.value,s=(h=(f=t==null?void 0:t.settings)==null?void 0:f["ui.preview.default_lines"])==null?void 0:h.value,r=e.lines??s??50,o=e.paused?!1:(n??3)*1e3;return Ze({queryKey:["session-preview",e.sessionName,r],queryFn:()=>lG(e.sessionName,r),enabled:!!e.sessionName&&!e.paused,refetchInterval:o,refetchIntervalInBackground:!1,staleTime:0})}class uG{constructor(){Qn(this,"pins",[]);Qn(this,"listeners",new Set);Qn(this,"maxPins",4)}setMaxPins(t){this.maxPins=Math.max(1,Math.floor(t)),this.pins.length>this.maxPins&&(this.pins=this.pins.slice(0,this.maxPins),this.notify())}getMaxPins(){return this.maxPins}list(){return this.pins}isPinned(t,n){return this.pins.some(s=>s.rigId===t&&s.logicalId===n)}pin(t){return this.isPinned(t.rigId,t.logicalId)?!0:this.pins.length>=this.maxPins?!1:(this.pins=[...this.pins,t],this.notify(),!0)}unpin(t,n){const s=this.pins.filter(r=>!(r.rigId===t&&r.logicalId===n));s.length!==this.pins.length&&(this.pins=s,this.notify())}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}notify(){for(const t of this.listeners)t(this.pins)}}const bi=new uG;function YL(){var s,r;const{data:e}=io(),t=(r=(s=e==null?void 0:e.settings)==null?void 0:s["ui.preview.max_pins"])==null?void 0:r.value;return R.useEffect(()=>{typeof t=="number"&&bi.setMaxPins(t)},[t]),{pins:R.useSyncExternalStore(o=>bi.subscribe(o),()=>bi.list(),()=>bi.list()),maxPins:bi.getMaxPins(),pin:o=>bi.pin(o),unpin:(o,c)=>bi.unpin(o,c),isPinned:(o,c)=>bi.isPinned(o,c)}}function WL({rigId:e,rigName:t,logicalId:n,lines:s,paused:r,hidePinButton:o,compact:c,testIdPrefix:u="preview"}){var w;const f=oG({rigId:e,logicalId:n,lines:s,paused:r}),{isPinned:h,pin:p,unpin:g}=YL(),x=h(e,n),v=()=>{var S;if(x)g(e,n);else{const N=Ca(f.data)?"":((S=f.data)==null?void 0:S.sessionName)??"";p({rigId:e,rigName:t??e,logicalId:n,sessionName:N})}},b=c?"max-h-32":"max-h-64";return a.jsxs("div",{"data-testid":`${u}-pane`,"data-rig-id":e,"data-logical-id":n,"data-paused":r?"true":"false",className:"border border-stone-300/40 bg-white/8 px-3 py-2 space-y-1",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("span",{className:"font-mono text-[9px] uppercase tracking-[0.10em] text-stone-500 truncate",children:["live preview · ",n]}),!o&&a.jsx("button",{type:"button","data-testid":`${u}-pin-toggle`,"data-pinned":x?"true":"false",onClick:v,className:"font-mono text-[8px] uppercase border border-stone-300 px-1 py-0.5 hover:bg-stone-200 shrink-0",children:x?"Unpin":"Pin"})]}),f.isLoading&&a.jsx("div",{"data-testid":`${u}-loading`,className:"font-mono text-[9px] text-stone-400",children:"Loading…"}),f.isError&&a.jsx("div",{"data-testid":`${u}-error`,className:"font-mono text-[9px] text-red-600",children:((w=f.error)==null?void 0:w.message)??"Preview failed."}),Ca(f.data)&&a.jsxs("div",{"data-testid":`${u}-unavailable`,className:"font-mono text-[9px] text-stone-500 space-y-0.5",children:[a.jsxs("div",{children:["Preview unavailable: ",f.data.reason,"."]}),f.data.hint&&a.jsx("div",{className:"text-stone-400",children:f.data.hint}),a.jsxs("div",{className:"text-stone-400",children:["Use ",a.jsxs("code",{children:["rig capture ",n]})," from terminal as a fallback."]})]}),!Ca(f.data)&&f.data&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{"data-testid":`${u}-content`,className:`font-mono text-[9px] text-stone-800 bg-stone-50 px-2 py-1 ${b} overflow-y-auto whitespace-pre-wrap break-all`,children:f.data.content||"(empty pane)"}),a.jsxs("div",{className:"font-mono text-[8px] text-stone-400 flex justify-between",children:[a.jsxs("span",{children:["captured ",new Date(f.data.capturedAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})]}),a.jsxs("span",{children:[f.data.lines," lines"]})]})]})]})}function dG({testIdPrefix:e="preview-stack"}){const{pins:t}=YL();return t.length===0?null:a.jsxs("aside",{"data-testid":e,className:"absolute inset-y-0 right-0 z-10 w-72 border-l border-stone-300/25 bg-[rgba(250,249,245,0.04)] supports-[backdrop-filter]:bg-[rgba(250,249,245,0.02)] backdrop-blur-[12px] shadow-[-6px_0_14px_rgba(46,52,46,0.04)] flex flex-col overflow-y-auto pointer-events-auto",children:[a.jsxs("header",{className:"px-3 py-2 border-b border-stone-300/35 shrink-0",children:[a.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-stone-700",children:"Pinned previews"}),a.jsxs("span",{className:"ml-2 font-mono text-[9px] text-stone-500",children:[t.length," pinned"]})]}),a.jsx("div",{className:"flex-1 px-2 py-2 space-y-2",children:t.map(n=>a.jsx(WL,{rigId:n.rigId,rigName:n.rigName,logicalId:n.logicalId,compact:!0,testIdPrefix:`pinned-preview-${n.logicalId}`},`${n.rigId}:${n.logicalId}`))})]})}const ws={currentRigDraft:"openrig.specs.current-rig-draft",currentAgentDraft:"openrig.specs.current-agent-draft",recentRigDrafts:"openrig.specs.recent-rig-drafts",recentAgentDrafts:"openrig.specs.recent-agent-drafts",bootstrapSourceRef:"openrig.specs.bootstrap-source-ref"},fG={currentRigDraft:"rigged.specs.current-rig-draft",currentAgentDraft:"rigged.specs.current-agent-draft",recentRigDrafts:"rigged.specs.recent-rig-drafts",recentAgentDrafts:"rigged.specs.recent-agent-drafts",bootstrapSourceRef:"rigged.specs.bootstrap-source-ref"},hG={activeTask:null,currentRigDraft:null,currentAgentDraft:null,recentRigDrafts:[],recentAgentDrafts:[],selectedRigDraft:null,selectedAgentDraft:null,bootstrapSourceRef:"",saveRigDraft:()=>{},rememberRigDraft:()=>{},selectRigDraft:()=>{},clearSelectedRigDraft:()=>{},saveAgentDraft:()=>{},rememberAgentDraft:()=>{},selectAgentDraft:()=>{},clearSelectedAgentDraft:()=>{},setBootstrapSourceRef:()=>{}},QL=R.createContext(hG);function au(e,t){var n;if(typeof window>"u")return t;try{const s=window.localStorage.getItem(e);if(s)return JSON.parse(s);const r=((n=Object.entries(ws).find(([,f])=>f===e))==null?void 0:n[0])??null;if(!r)return t;const o=fG[r];if(!o)return t;const c=window.localStorage.getItem(o);if(!c)return t;const u=JSON.parse(c);return window.localStorage.setItem(e,JSON.stringify(u)),window.localStorage.removeItem(o),u}catch{return t}}function ou(e,t){if(!(typeof window>"u"))try{if(t===""||t===null){window.localStorage.removeItem(e);return}window.localStorage.setItem(e,JSON.stringify(t))}catch{}}function oh(e,t,n){return{id:`${e}-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,kind:e,label:n??(e==="rig"?"Untitled RigSpec":"Untitled AgentSpec"),yaml:t,updatedAt:Date.now()}}function lh(e,t){var s;const n=e.match(/^\s*name:\s*["']?([^"'\n#]+)["']?/m);return((s=n==null?void 0:n[1])==null?void 0:s.trim())||t}function jE(e,t){return[t,...e.filter(n=>n.id!==t.id&&n.yaml!==t.yaml)].slice(0,5)}function pG(e,t,n,s){if(e==="/import")return t?{id:"import",label:"Import RigSpec",route:"/import",summary:t.label}:null;if(e==="/bootstrap"){const r=s.trim();return r?{id:"bootstrap",label:"Bootstrap",route:"/bootstrap",summary:r}:null}return e==="/agents/validate"&&n?{id:"validate-agent",label:"Validate AgentSpec",route:"/agents/validate",summary:n.label}:null}function mG({children:e}){const t=no({select:L=>L.location.pathname}),[n,s]=R.useState(()=>au(ws.currentRigDraft,null)),[r,o]=R.useState(()=>au(ws.currentAgentDraft,null)),[c,u]=R.useState(()=>au(ws.recentRigDrafts,[])),[f,h]=R.useState(()=>au(ws.recentAgentDrafts,[])),[p,g]=R.useState(null),[x,v]=R.useState(null),[b,w]=R.useState(()=>au(ws.bootstrapSourceRef,""));R.useEffect(()=>{ou(ws.currentRigDraft,n)},[n]),R.useEffect(()=>{ou(ws.currentAgentDraft,r)},[r]),R.useEffect(()=>{ou(ws.recentRigDrafts,c)},[c]),R.useEffect(()=>{ou(ws.recentAgentDrafts,f)},[f]),R.useEffect(()=>{ou(ws.bootstrapSourceRef,b.trim())},[b]);const S=R.useMemo(()=>c.find(L=>L.id===p)??((n==null?void 0:n.id)===p?n:null),[n,c,p]),N=R.useMemo(()=>f.find(L=>L.id===x)??((r==null?void 0:r.id)===x?r:null),[r,f,x]),C=R.useCallback((L,P)=>{if(!L.trim()){s(null);return}s(I=>({id:(I==null?void 0:I.id)??oh("rig",L,P).id,kind:"rig",label:P??lh(L,(I==null?void 0:I.label)??"Untitled RigSpec"),yaml:L,updatedAt:Date.now()}))},[]),k=R.useCallback((L,P)=>{if(!L.trim())return;const I=oh("rig",L,P??lh(L,"Untitled RigSpec"));s(I),u(B=>jE(B,I)),g(I.id)},[]),_=R.useCallback((L,P)=>{if(!L.trim()){o(null);return}o(I=>({id:(I==null?void 0:I.id)??oh("agent",L,P).id,kind:"agent",label:P??lh(L,(I==null?void 0:I.label)??"Untitled AgentSpec"),yaml:L,updatedAt:Date.now()}))},[]),E=R.useCallback((L,P)=>{if(!L.trim())return;const I=oh("agent",L,P??lh(L,"Untitled AgentSpec"));o(I),h(B=>jE(B,I)),v(I.id)},[]),M=R.useCallback(L=>{g(L);const P=c.find(I=>I.id===L)??((n==null?void 0:n.id)===L?n:null);P&&s(P)},[n,c]),A=R.useCallback(L=>{v(L);const P=f.find(I=>I.id===L)??((r==null?void 0:r.id)===L?r:null);P&&o(P)},[r,f]),O=R.useMemo(()=>({activeTask:pG(t,n,r,b),currentRigDraft:n,currentAgentDraft:r,recentRigDrafts:c,recentAgentDrafts:f,selectedRigDraft:S,selectedAgentDraft:N,bootstrapSourceRef:b,saveRigDraft:C,rememberRigDraft:k,selectRigDraft:M,clearSelectedRigDraft:()=>g(null),saveAgentDraft:_,rememberAgentDraft:E,selectAgentDraft:A,clearSelectedAgentDraft:()=>v(null),setBootstrapSourceRef:w}),[t,n,r,c,f,S,N,b,C,k,M,_,E,A]);return a.jsx(QL.Provider,{value:O,children:e})}function od(){return R.useContext(QL)}const XL=R.createContext({mode:"opaque",setMode:()=>{},expandedRigs:new Map,setRigExpanded:()=>{},toggleRig:()=>{}});function gG(e){const t=e.match(/^\/topology\/seat\/([^/]+)\//);if(t)return decodeURIComponent(t[1]);const n=e.match(/^\/topology\/pod\/([^/]+)\//);if(n)return decodeURIComponent(n[1]);const s=e.match(/^\/topology\/rig\/([^/]+)$/);return s?decodeURIComponent(s[1]):null}function xG({children:e}){const[t,n]=R.useState("opaque"),s=R.useCallback(p=>{n(p)},[]),[r,o]=R.useState(()=>new Map),c=R.useCallback((p,g)=>{o(x=>{if(x.has(p)&&x.get(p)===g)return x;const v=new Map(x);return v.set(p,g),v})},[]),u=R.useCallback(p=>{o(g=>{const x=new Map(g);return x.set(p,!(g.get(p)??!1)),x})},[]),f=no({select:p=>p.location.pathname});R.useEffect(()=>{const p=gG(f);p&&c(p,!0)},[f,c]);const h=R.useMemo(()=>({mode:t,setMode:s,expandedRigs:r,setRigExpanded:c,toggleRig:u}),[t,s,r,c,u]);return a.jsx(XL.Provider,{value:h,children:e})}function tN(){return R.useContext(XL)}function vG(){const e=Wt(),t=R.useRef(null);R.useEffect(()=>{const n=new Set,s=Lp(r=>{const{type:o,rigId:c}=r;o&&(o.startsWith("node.startup_")&&c&&n.add(`rig:${c}:nodes`),(o==="rig.created"||o==="rig.deleted"||o==="rig.stopped"||o==="rig.imported"||o==="bootstrap.completed"||o==="bootstrap.partial")&&(n.add("rigs:summary"),n.add("ps")),o==="restore.completed"&&c&&(n.add("rigs:summary"),n.add("ps"),n.add(`rig:${c}:nodes`)),!t.current&&(t.current=setTimeout(()=>{t.current=null;for(const u of n)if(u==="rigs:summary")e.invalidateQueries({queryKey:["rigs","summary"]});else if(u==="ps")e.invalidateQueries({queryKey:["ps"]});else if(u.startsWith("rig:")){const f=u.split(":");e.invalidateQueries({queryKey:["rig",f[1],f[2]]})}n.clear()},150)))});return()=>{s(),t.current&&(clearTimeout(t.current),t.current=null)}},[e])}const ZL=R.createContext({selection:null,setSelection:()=>{}}),JL=R.createContext({selectedDiscoveredId:null,setSelectedDiscoveredId:()=>{},placementTarget:null,setPlacementTarget:()=>{},clearPlacement:()=>{}});function Fp(){return R.useContext(ZL)}function yG(){return R.useContext(JL)}const NE=[{id:"dashboard",label:"Dashboard",to:"/",icon:XF,activeWhen:e=>e==="/",testId:"rail-dashboard",group:"destination"},{id:"topology",label:"Topology",to:"/topology",icon:Rj,activeWhen:e=>e.startsWith("/topology")||e.startsWith("/rigs/"),testId:"rail-topology",group:"destination"},{id:"for-you",label:"For You",to:"/for-you",icon:Aj,activeWhen:e=>e.startsWith("/for-you"),testId:"rail-for-you",group:"destination"},{id:"project",label:"Project",to:"/project",icon:kj,activeWhen:e=>e.startsWith("/project"),testId:"rail-project",group:"destination"},{id:"specs",label:"Library",to:"/specs",icon:YO,activeWhen:e=>e.startsWith("/specs"),testId:"rail-specs",group:"destination"},{id:"settings",label:"Settings",to:"/settings",icon:KO,activeWhen:e=>e.startsWith("/settings"),testId:"rail-settings",group:"destination"},{id:"advisor",label:"Advisor",to:"/settings#agents-advisor-session",icon:jF,activeWhen:()=>!1,testId:"rail-advisor",group:"chat"},{id:"operator",label:"Operator",to:"/settings#agents-operator-session",icon:NH,activeWhen:()=>!1,testId:"rail-operator",group:"chat"}];function _E(e,t){var s;if(!e||!e.settings)return"";const n=(s=e.settings[t])==null?void 0:s.value;return typeof n=="string"?n:""}function CE(e,t){if(!e)return`/settings#agents-${t}-session`;const n=e.indexOf("@");if(n===-1)return`/settings#agents-${t}-session`;const s=e.slice(0,n),r=e.slice(n+1);return!r||!s?`/settings#agents-${t}-session`:`/topology/seat/${encodeURIComponent(r)}/${encodeURIComponent(s)}`}function bG(e){return e.startsWith("/topology")||e.startsWith("/rigs/")?"topology":e.startsWith("/project")?"project":e.startsWith("/specs")?"specs":e.startsWith("/for-you")?"for-you":"none"}function kE({pathname:e,onMobileClose:t,vertical:n}){const s=NE.filter(h=>h.group==="destination"),{data:r}=io(),o=_E(r,"agents.advisor_session"),c=_E(r,"agents.operator_session"),u=NE.filter(h=>h.group==="chat").map(h=>h.id==="advisor"?{...h,to:CE(o,"advisor")}:h.id==="operator"?{...h,to:CE(c,"operator")}:h),f=h=>{const p=h.icon,g=h.activeWhen(e);return a.jsxs(Ye,{to:h.to,"data-testid":h.testId,"data-active":g,"aria-label":h.label,title:h.label,onClick:t,className:he("relative flex h-10 w-10 items-center justify-center transition-colors","focus-visible:outline focus-visible:outline-2 focus-visible:outline-stone-900 focus-visible:outline-offset-2",g?"bg-stone-900 text-stone-50":"text-stone-700 hover:bg-stone-200/60 hover:text-stone-900"),children:[a.jsx(p,{className:"h-5 w-5",strokeWidth:1.25}),g&&a.jsx("span",{"aria-hidden":"true",className:"absolute left-0 top-1 bottom-1 w-[2px] bg-tertiary"})]},h.id)};return a.jsxs("nav",{"data-testid":"app-rail","aria-label":"Primary navigation",className:he("vellum border-outline-variant flex shrink-0",n?"w-12 flex-col items-center border-r py-2 gap-1":"w-full flex-row items-center border-b px-2 gap-1 overflow-x-auto"),children:[a.jsx("div",{className:he("flex",n?"flex-col gap-1 items-center":"flex-row gap-1 items-center"),children:s.map(f)}),a.jsx("div",{className:he(n?"flex-1":"flex-1 hidden lg:block")}),a.jsx("div",{className:he("flex",n?"flex-col gap-1 items-center pb-1":"flex-row gap-1 items-center"),children:u.map(f)})]})}const RE=1024;function wG({children:e}){return a.jsx(mG,{children:a.jsx(xG,{children:a.jsx(SG,{children:e})})})}function SG({children:e}){const n=no().location.pathname,s=bG(n),{mode:r}=tN(),[o,c]=R.useState(!1),[u,f]=R.useState(!0),[h,p]=R.useState(()=>typeof window>"u"?!0:window.innerWidth>=RE),[g,x]=R.useState(null),[v,b]=R.useState(null),[w,S]=R.useState(null),{events:N}=Pp(),C=R.useCallback(F=>{x(F),!h&&F&&c(!1)},[h]),k=R.useCallback(()=>{b(null),S(null)},[]),_=R.useCallback(F=>{b(F),S(null)},[]);R.useEffect(()=>{const F=()=>{p(window.innerWidth>=RE)};return F(),window.addEventListener("resize",F),()=>window.removeEventListener("resize",F)},[]),R.useEffect(()=>{(g==null?void 0:g.type)!=="discovery"&&k()},[g,k]),R.useEffect(()=>{h||(x(null),c(!1))},[h,n]),vG();const E=s!=="none",M=!!g,A=r==="overlay"&&s==="topology",O=h&&E&&u?"21rem":"3rem",B={"--workspace-left-offset":h?A?"0rem":O:"0rem","--workspace-right-offset":h&&M?"38rem":"0rem","--explorer-anchor-left":O,"--header-anchor-offset":h&&A?O:"0rem"};return a.jsx(ZL.Provider,{value:{selection:g,setSelection:C},children:a.jsx(JL.Provider,{value:{selectedDiscoveredId:v,setSelectedDiscoveredId:_,placementTarget:w,setPlacementTarget:S,clearPlacement:k},children:a.jsxs("div",{className:"h-screen flex flex-col",children:[a.jsxs("header",{"data-testid":"app-topbar",className:"h-14 flex items-center justify-between px-4 bg-background border-b border-outline-variant shrink-0 relative z-30",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("button",{type:"button","data-testid":"mobile-menu-toggle",onClick:()=>c(F=>!F),"aria-label":"Toggle navigation",className:"flex flex-col gap-[3px] p-2 lg:hidden",children:[a.jsx("span",{className:"block w-4 h-[1.5px] bg-stone-900"}),a.jsx("span",{className:"block w-4 h-[1.5px] bg-stone-900"}),a.jsx("span",{className:"block w-3 h-[1.5px] bg-stone-900"})]}),a.jsx(Ye,{to:"/","data-testid":"brand-home-link",className:"inline-flex items-center bg-stone-950 px-3 py-1 font-mono text-sm font-bold uppercase tracking-[0.08em] text-stone-50 hover:bg-stone-800",children:"OPENRIG"})]}),a.jsx("div",{"data-testid":"topbar-right-slot",className:"hidden sm:flex items-center gap-2",children:a.jsx("span",{"data-testid":"topbar-env-indicator",className:"font-mono text-[10px] uppercase tracking-[0.18em] text-on-surface-variant",children:"localhost"})})]}),a.jsxs("div",{className:"flex flex-1 min-h-0 relative",children:[a.jsx("div",{className:"hidden lg:flex",children:a.jsx(kE,{pathname:n,vertical:!0})}),!h&&a.jsxs(a.Fragment,{children:[o&&a.jsx("div",{className:"fixed inset-0 bg-black/20 z-20 lg:hidden",onClick:()=>c(!1)}),a.jsx("div",{"data-testid":"mobile-rail-tray",className:he("fixed top-14 left-0 bottom-0 z-30 bg-background border-r border-outline-variant transition-transform duration-200 ease-tactical lg:hidden","w-72 max-w-[85vw] flex flex-col",o?"translate-x-0":"-translate-x-full"),children:a.jsx(kE,{pathname:n,vertical:!1,onMobileClose:()=>c(!1)})})]}),E&&a.jsx(nV,{open:o,onClose:()=>c(!1),selection:g,onSelect:C,desktopMode:u?"full":"hidden",surface:s,onDesktopToggle:()=>f(F=>!F),overlayMode:A?"overlay":"opaque"}),a.jsx("main",{"data-testid":"content-area","data-explorer-mode":A?"overlay":"opaque",className:"flex-1 flex flex-col overflow-auto relative",style:{...B,paddingLeft:"var(--workspace-left-offset, 0px)"},children:a.jsx("div",{className:"relative z-10 route-enter flex-1 flex flex-col pb-14 lg:pb-0",style:{"--workspace-left-offset":"0px","--workspace-right-offset":"0px"},children:e},n)}),a.jsx(iG,{selection:g,onClose:()=>C(null),events:N,selectedDiscoveredId:v,onSelectDiscoveredId:_,placementTarget:w,onClearPlacement:k}),a.jsx(dG,{}),a.jsx(jG,{pathname:n})]})]})})})}function jG({pathname:e}){const t=[{id:"for-you",label:"For You",to:"/for-you",activeWhen:n=>n.startsWith("/for-you"),icon:Aj},{id:"project",label:"Project",to:"/project",activeWhen:n=>n.startsWith("/project"),icon:kj},{id:"topology",label:"Topology",to:"/topology",activeWhen:n=>n.startsWith("/topology")||n.startsWith("/rigs/"),icon:Rj}];return a.jsx("nav",{"data-testid":"mobile-bottom-nav","aria-label":"Mobile bottom navigation",className:"fixed bottom-0 left-0 right-0 z-40 lg:hidden vellum border-t border-outline-variant flex",children:t.map(n=>{const s=n.activeWhen(e);return a.jsxs(Ye,{to:n.to,"data-testid":`mobile-nav-${n.id}`,"data-active":s,className:he("flex-1 flex flex-col items-center justify-center gap-0.5 py-2 font-mono text-[9px] uppercase tracking-wide",s?"text-stone-900":"text-on-surface-variant hover:text-stone-900"),children:[a.jsx(n.icon,{className:"h-5 w-5",strokeWidth:1.25,"aria-hidden":"true"}),a.jsx("span",{children:n.label})]},n.id)})})}function Bt(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,s;n<e.length;n++)(s=Bt(e[n]))!==""&&(t+=(t&&" ")+s);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var NG={value:()=>{}};function Hp(){for(var e=0,t=arguments.length,n={},s;e<t;++e){if(!(s=arguments[e]+"")||s in n||/[\s.]/.test(s))throw new Error("illegal type: "+s);n[s]=[]}return new Bh(n)}function Bh(e){this._=e}function _G(e,t){return e.trim().split(/^|\s+/).map(function(n){var s="",r=n.indexOf(".");if(r>=0&&(s=n.slice(r+1),n=n.slice(0,r)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:s}})}Bh.prototype=Hp.prototype={constructor:Bh,on:function(e,t){var n=this._,s=_G(e+"",n),r,o=-1,c=s.length;if(arguments.length<2){for(;++o<c;)if((r=(e=s[o]).type)&&(r=CG(n[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++o<c;)if(r=(e=s[o]).type)n[r]=EE(n[r],e.name,t);else if(t==null)for(r in n)n[r]=EE(n[r],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Bh(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var n=new Array(r),s=0,r,o;s<r;++s)n[s]=arguments[s+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(o=this._[e],s=0,r=o.length;s<r;++s)o[s].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var s=this._[e],r=0,o=s.length;r<o;++r)s[r].value.apply(t,n)}};function CG(e,t){for(var n=0,s=e.length,r;n<s;++n)if((r=e[n]).name===t)return r.value}function EE(e,t,n){for(var s=0,r=e.length;s<r;++s)if(e[s].name===t){e[s]=NG,e=e.slice(0,s).concat(e.slice(s+1));break}return n!=null&&e.push({name:t,value:n}),e}var DS="http://www.w3.org/1999/xhtml";const AE={svg:"http://www.w3.org/2000/svg",xhtml:DS,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Up(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),AE.hasOwnProperty(t)?{space:AE[t],local:e}:e}function kG(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===DS&&t.documentElement.namespaceURI===DS?t.createElement(e):t.createElementNS(n,e)}}function RG(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function eP(e){var t=Up(e);return(t.local?RG:kG)(t)}function EG(){}function nN(e){return e==null?EG:function(){return this.querySelector(e)}}function AG(e){typeof e!="function"&&(e=nN(e));for(var t=this._groups,n=t.length,s=new Array(n),r=0;r<n;++r)for(var o=t[r],c=o.length,u=s[r]=new Array(c),f,h,p=0;p<c;++p)(f=o[p])&&(h=e.call(f,f.__data__,p,o))&&("__data__"in f&&(h.__data__=f.__data__),u[p]=h);return new ts(s,this._parents)}function TG(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function MG(){return[]}function tP(e){return e==null?MG:function(){return this.querySelectorAll(e)}}function IG(e){return function(){return TG(e.apply(this,arguments))}}function OG(e){typeof e=="function"?e=IG(e):e=tP(e);for(var t=this._groups,n=t.length,s=[],r=[],o=0;o<n;++o)for(var c=t[o],u=c.length,f,h=0;h<u;++h)(f=c[h])&&(s.push(e.call(f,f.__data__,h,c)),r.push(f));return new ts(s,r)}function nP(e){return function(){return this.matches(e)}}function sP(e){return function(t){return t.matches(e)}}var LG=Array.prototype.find;function PG(e){return function(){return LG.call(this.children,e)}}function DG(){return this.firstElementChild}function qG(e){return this.select(e==null?DG:PG(typeof e=="function"?e:sP(e)))}var $G=Array.prototype.filter;function zG(){return Array.from(this.children)}function BG(e){return function(){return $G.call(this.children,e)}}function FG(e){return this.selectAll(e==null?zG:BG(typeof e=="function"?e:sP(e)))}function HG(e){typeof e!="function"&&(e=nP(e));for(var t=this._groups,n=t.length,s=new Array(n),r=0;r<n;++r)for(var o=t[r],c=o.length,u=s[r]=[],f,h=0;h<c;++h)(f=o[h])&&e.call(f,f.__data__,h,o)&&u.push(f);return new ts(s,this._parents)}function rP(e){return new Array(e.length)}function UG(){return new ts(this._enter||this._groups.map(rP),this._parents)}function lp(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}lp.prototype={constructor:lp,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 VG(e){return function(){return e}}function GG(e,t,n,s,r,o){for(var c=0,u,f=t.length,h=o.length;c<h;++c)(u=t[c])?(u.__data__=o[c],s[c]=u):n[c]=new lp(e,o[c]);for(;c<f;++c)(u=t[c])&&(r[c]=u)}function KG(e,t,n,s,r,o,c){var u,f,h=new Map,p=t.length,g=o.length,x=new Array(p),v;for(u=0;u<p;++u)(f=t[u])&&(x[u]=v=c.call(f,f.__data__,u,t)+"",h.has(v)?r[u]=f:h.set(v,f));for(u=0;u<g;++u)v=c.call(e,o[u],u,o)+"",(f=h.get(v))?(s[u]=f,f.__data__=o[u],h.delete(v)):n[u]=new lp(e,o[u]);for(u=0;u<p;++u)(f=t[u])&&h.get(x[u])===f&&(r[u]=f)}function YG(e){return e.__data__}function WG(e,t){if(!arguments.length)return Array.from(this,YG);var n=t?KG:GG,s=this._parents,r=this._groups;typeof e!="function"&&(e=VG(e));for(var o=r.length,c=new Array(o),u=new Array(o),f=new Array(o),h=0;h<o;++h){var p=s[h],g=r[h],x=g.length,v=QG(e.call(p,p&&p.__data__,h,s)),b=v.length,w=u[h]=new Array(b),S=c[h]=new Array(b),N=f[h]=new Array(x);n(p,g,w,S,N,v,t);for(var C=0,k=0,_,E;C<b;++C)if(_=w[C]){for(C>=k&&(k=C+1);!(E=S[k])&&++k<b;);_._next=E||null}}return c=new ts(c,s),c._enter=u,c._exit=f,c}function QG(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function XG(){return new ts(this._exit||this._groups.map(rP),this._parents)}function ZG(e,t,n){var s=this.enter(),r=this,o=this.exit();return typeof e=="function"?(s=e(s),s&&(s=s.selection())):s=s.append(e+""),t!=null&&(r=t(r),r&&(r=r.selection())),n==null?o.remove():n(o),s&&r?s.merge(r).order():r}function JG(e){for(var t=e.selection?e.selection():e,n=this._groups,s=t._groups,r=n.length,o=s.length,c=Math.min(r,o),u=new Array(r),f=0;f<c;++f)for(var h=n[f],p=s[f],g=h.length,x=u[f]=new Array(g),v,b=0;b<g;++b)(v=h[b]||p[b])&&(x[b]=v);for(;f<r;++f)u[f]=n[f];return new ts(u,this._parents)}function eK(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var s=e[t],r=s.length-1,o=s[r],c;--r>=0;)(c=s[r])&&(o&&c.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(c,o),o=c);return this}function tK(e){e||(e=nK);function t(g,x){return g&&x?e(g.__data__,x.__data__):!g-!x}for(var n=this._groups,s=n.length,r=new Array(s),o=0;o<s;++o){for(var c=n[o],u=c.length,f=r[o]=new Array(u),h,p=0;p<u;++p)(h=c[p])&&(f[p]=h);f.sort(t)}return new ts(r,this._parents).order()}function nK(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function sK(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function rK(){return Array.from(this)}function iK(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var s=e[t],r=0,o=s.length;r<o;++r){var c=s[r];if(c)return c}return null}function aK(){let e=0;for(const t of this)++e;return e}function oK(){return!this.node()}function lK(e){for(var t=this._groups,n=0,s=t.length;n<s;++n)for(var r=t[n],o=0,c=r.length,u;o<c;++o)(u=r[o])&&e.call(u,u.__data__,o,r);return this}function cK(e){return function(){this.removeAttribute(e)}}function uK(e){return function(){this.removeAttributeNS(e.space,e.local)}}function dK(e,t){return function(){this.setAttribute(e,t)}}function fK(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function hK(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function pK(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 mK(e,t){var n=Up(e);if(arguments.length<2){var s=this.node();return n.local?s.getAttributeNS(n.space,n.local):s.getAttribute(n)}return this.each((t==null?n.local?uK:cK:typeof t=="function"?n.local?pK:hK:n.local?fK:dK)(n,t))}function iP(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function gK(e){return function(){this.style.removeProperty(e)}}function xK(e,t,n){return function(){this.style.setProperty(e,t,n)}}function vK(e,t,n){return function(){var s=t.apply(this,arguments);s==null?this.style.removeProperty(e):this.style.setProperty(e,s,n)}}function yK(e,t,n){return arguments.length>1?this.each((t==null?gK:typeof t=="function"?vK:xK)(e,t,n??"")):Bl(this.node(),e)}function Bl(e,t){return e.style.getPropertyValue(t)||iP(e).getComputedStyle(e,null).getPropertyValue(t)}function bK(e){return function(){delete this[e]}}function wK(e,t){return function(){this[e]=t}}function SK(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function jK(e,t){return arguments.length>1?this.each((t==null?bK:typeof t=="function"?SK:wK)(e,t)):this.node()[e]}function aP(e){return e.trim().split(/^|\s+/)}function sN(e){return e.classList||new oP(e)}function oP(e){this._node=e,this._names=aP(e.getAttribute("class")||"")}oP.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 lP(e,t){for(var n=sN(e),s=-1,r=t.length;++s<r;)n.add(t[s])}function cP(e,t){for(var n=sN(e),s=-1,r=t.length;++s<r;)n.remove(t[s])}function NK(e){return function(){lP(this,e)}}function _K(e){return function(){cP(this,e)}}function CK(e,t){return function(){(t.apply(this,arguments)?lP:cP)(this,e)}}function kK(e,t){var n=aP(e+"");if(arguments.length<2){for(var s=sN(this.node()),r=-1,o=n.length;++r<o;)if(!s.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?CK:t?NK:_K)(n,t))}function RK(){this.textContent=""}function EK(e){return function(){this.textContent=e}}function AK(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function TK(e){return arguments.length?this.each(e==null?RK:(typeof e=="function"?AK:EK)(e)):this.node().textContent}function MK(){this.innerHTML=""}function IK(e){return function(){this.innerHTML=e}}function OK(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function LK(e){return arguments.length?this.each(e==null?MK:(typeof e=="function"?OK:IK)(e)):this.node().innerHTML}function PK(){this.nextSibling&&this.parentNode.appendChild(this)}function DK(){return this.each(PK)}function qK(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function $K(){return this.each(qK)}function zK(e){var t=typeof e=="function"?e:eP(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function BK(){return null}function FK(e,t){var n=typeof e=="function"?e:eP(e),s=t==null?BK:typeof t=="function"?t:nN(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),s.apply(this,arguments)||null)})}function HK(){var e=this.parentNode;e&&e.removeChild(this)}function UK(){return this.each(HK)}function VK(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function GK(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function KK(e){return this.select(e?GK:VK)}function YK(e){return arguments.length?this.property("__data__",e):this.node().__data__}function WK(e){return function(t){e.call(this,t,this.__data__)}}function QK(e){return e.trim().split(/^|\s+/).map(function(t){var n="",s=t.indexOf(".");return s>=0&&(n=t.slice(s+1),t=t.slice(0,s)),{type:t,name:n}})}function XK(e){return function(){var t=this.__on;if(t){for(var n=0,s=-1,r=t.length,o;n<r;++n)o=t[n],(!e.type||o.type===e.type)&&o.name===e.name?this.removeEventListener(o.type,o.listener,o.options):t[++s]=o;++s?t.length=s:delete this.__on}}}function ZK(e,t,n){return function(){var s=this.__on,r,o=WK(t);if(s){for(var c=0,u=s.length;c<u;++c)if((r=s[c]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=o,r.options=n),r.value=t;return}}this.addEventListener(e.type,o,n),r={type:e.type,name:e.name,value:t,listener:o,options:n},s?s.push(r):this.__on=[r]}}function JK(e,t,n){var s=QK(e+""),r,o=s.length,c;if(arguments.length<2){var u=this.node().__on;if(u){for(var f=0,h=u.length,p;f<h;++f)for(r=0,p=u[f];r<o;++r)if((c=s[r]).type===p.type&&c.name===p.name)return p.value}return}for(u=t?ZK:XK,r=0;r<o;++r)this.each(u(s[r],t,n));return this}function uP(e,t,n){var s=iP(e),r=s.CustomEvent;typeof r=="function"?r=new r(t,n):(r=s.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function eY(e,t){return function(){return uP(this,e,t)}}function tY(e,t){return function(){return uP(this,e,t.apply(this,arguments))}}function nY(e,t){return this.each((typeof t=="function"?tY:eY)(e,t))}function*sY(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var s=e[t],r=0,o=s.length,c;r<o;++r)(c=s[r])&&(yield c)}var dP=[null];function ts(e,t){this._groups=e,this._parents=t}function ld(){return new ts([[document.documentElement]],dP)}function rY(){return this}ts.prototype=ld.prototype={constructor:ts,select:AG,selectAll:OG,selectChild:qG,selectChildren:FG,filter:HG,data:WG,enter:UG,exit:XG,join:ZG,merge:JG,selection:rY,order:eK,sort:tK,call:sK,nodes:rK,node:iK,size:aK,empty:oK,each:lK,attr:mK,style:yK,property:jK,classed:kK,text:TK,html:LK,raise:DK,lower:$K,append:zK,insert:FK,remove:UK,clone:KK,datum:YK,on:JK,dispatch:nY,[Symbol.iterator]:sY};function es(e){return typeof e=="string"?new ts([[document.querySelector(e)]],[document.documentElement]):new ts([[e]],dP)}function iY(e){let t;for(;t=e.sourceEvent;)e=t;return e}function js(e,t){if(e=iY(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var s=n.createSVGPoint();return s.x=e.clientX,s.y=e.clientY,s=s.matrixTransform(t.getScreenCTM().inverse()),[s.x,s.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 aY={passive:!1},Pu={capture:!0,passive:!1};function lv(e){e.stopImmediatePropagation()}function wl(e){e.preventDefault(),e.stopImmediatePropagation()}function fP(e){var t=e.document.documentElement,n=es(e).on("dragstart.drag",wl,Pu);"onselectstart"in t?n.on("selectstart.drag",wl,Pu):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function hP(e,t){var n=e.document.documentElement,s=es(e).on("dragstart.drag",null);t&&(s.on("click.drag",wl,Pu),setTimeout(function(){s.on("click.drag",null)},0)),"onselectstart"in n?s.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const ch=e=>()=>e;function qS(e,{sourceEvent:t,subject:n,target:s,identifier:r,active:o,x:c,y:u,dx:f,dy:h,dispatch:p}){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:s,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:c,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:f,enumerable:!0,configurable:!0},dy:{value:h,enumerable:!0,configurable:!0},_:{value:p}})}qS.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function oY(e){return!e.ctrlKey&&!e.button}function lY(){return this.parentNode}function cY(e,t){return t??{x:e.x,y:e.y}}function uY(){return navigator.maxTouchPoints||"ontouchstart"in this}function pP(){var e=oY,t=lY,n=cY,s=uY,r={},o=Hp("start","drag","end"),c=0,u,f,h,p,g=0;function x(_){_.on("mousedown.drag",v).filter(s).on("touchstart.drag",S).on("touchmove.drag",N,aY).on("touchend.drag touchcancel.drag",C).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function v(_,E){if(!(p||!e.call(this,_,E))){var M=k(this,t.call(this,_,E),_,E,"mouse");M&&(es(_.view).on("mousemove.drag",b,Pu).on("mouseup.drag",w,Pu),fP(_.view),lv(_),h=!1,u=_.clientX,f=_.clientY,M("start",_))}}function b(_){if(wl(_),!h){var E=_.clientX-u,M=_.clientY-f;h=E*E+M*M>g}r.mouse("drag",_)}function w(_){es(_.view).on("mousemove.drag mouseup.drag",null),hP(_.view,h),wl(_),r.mouse("end",_)}function S(_,E){if(e.call(this,_,E)){var M=_.changedTouches,A=t.call(this,_,E),O=M.length,L,P;for(L=0;L<O;++L)(P=k(this,A,_,E,M[L].identifier,M[L]))&&(lv(_),P("start",_,M[L]))}}function N(_){var E=_.changedTouches,M=E.length,A,O;for(A=0;A<M;++A)(O=r[E[A].identifier])&&(wl(_),O("drag",_,E[A]))}function C(_){var E=_.changedTouches,M=E.length,A,O;for(p&&clearTimeout(p),p=setTimeout(function(){p=null},500),A=0;A<M;++A)(O=r[E[A].identifier])&&(lv(_),O("end",_,E[A]))}function k(_,E,M,A,O,L){var P=o.copy(),I=js(L||M,E),B,F,z;if((z=n.call(_,new qS("beforestart",{sourceEvent:M,target:x,identifier:O,active:c,x:I[0],y:I[1],dx:0,dy:0,dispatch:P}),A))!=null)return B=z.x-I[0]||0,F=z.y-I[1]||0,function Y($,V,G){var Z=I,J;switch($){case"start":r[O]=Y,J=c++;break;case"end":delete r[O],--c;case"drag":I=js(G||V,E),J=c;break}P.call($,_,new qS($,{sourceEvent:V,subject:z,target:x,identifier:O,active:J,x:I[0]+B,y:I[1]+F,dx:I[0]-Z[0],dy:I[1]-Z[1],dispatch:P}),A)}}return x.filter=function(_){return arguments.length?(e=typeof _=="function"?_:ch(!!_),x):e},x.container=function(_){return arguments.length?(t=typeof _=="function"?_:ch(_),x):t},x.subject=function(_){return arguments.length?(n=typeof _=="function"?_:ch(_),x):n},x.touchable=function(_){return arguments.length?(s=typeof _=="function"?_:ch(!!_),x):s},x.on=function(){var _=o.on.apply(o,arguments);return _===o?x:_},x.clickDistance=function(_){return arguments.length?(g=(_=+_)*_,x):Math.sqrt(g)},x}function rN(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function mP(e,t){var n=Object.create(e.prototype);for(var s in t)n[s]=t[s];return n}function cd(){}var Du=.7,cp=1/Du,Sl="\\s*([+-]?\\d+)\\s*",qu="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ws="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",dY=/^#([0-9a-f]{3,8})$/,fY=new RegExp(`^rgb\\(${Sl},${Sl},${Sl}\\)$`),hY=new RegExp(`^rgb\\(${Ws},${Ws},${Ws}\\)$`),pY=new RegExp(`^rgba\\(${Sl},${Sl},${Sl},${qu}\\)$`),mY=new RegExp(`^rgba\\(${Ws},${Ws},${Ws},${qu}\\)$`),gY=new RegExp(`^hsl\\(${qu},${Ws},${Ws}\\)$`),xY=new RegExp(`^hsla\\(${qu},${Ws},${Ws},${qu}\\)$`),TE={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};rN(cd,Ya,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:ME,formatHex:ME,formatHex8:vY,formatHsl:yY,formatRgb:IE,toString:IE});function ME(){return this.rgb().formatHex()}function vY(){return this.rgb().formatHex8()}function yY(){return gP(this).formatHsl()}function IE(){return this.rgb().formatRgb()}function Ya(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=dY.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?OE(t):n===3?new $n(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?uh(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?uh(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=fY.exec(e))?new $n(t[1],t[2],t[3],1):(t=hY.exec(e))?new $n(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=pY.exec(e))?uh(t[1],t[2],t[3],t[4]):(t=mY.exec(e))?uh(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=gY.exec(e))?DE(t[1],t[2]/100,t[3]/100,1):(t=xY.exec(e))?DE(t[1],t[2]/100,t[3]/100,t[4]):TE.hasOwnProperty(e)?OE(TE[e]):e==="transparent"?new $n(NaN,NaN,NaN,0):null}function OE(e){return new $n(e>>16&255,e>>8&255,e&255,1)}function uh(e,t,n,s){return s<=0&&(e=t=n=NaN),new $n(e,t,n,s)}function bY(e){return e instanceof cd||(e=Ya(e)),e?(e=e.rgb(),new $n(e.r,e.g,e.b,e.opacity)):new $n}function $S(e,t,n,s){return arguments.length===1?bY(e):new $n(e,t,n,s??1)}function $n(e,t,n,s){this.r=+e,this.g=+t,this.b=+n,this.opacity=+s}rN($n,$S,mP(cd,{brighter(e){return e=e==null?cp:Math.pow(cp,e),new $n(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Du:Math.pow(Du,e),new $n(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new $n(Ha(this.r),Ha(this.g),Ha(this.b),up(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:LE,formatHex:LE,formatHex8:wY,formatRgb:PE,toString:PE}));function LE(){return`#${ka(this.r)}${ka(this.g)}${ka(this.b)}`}function wY(){return`#${ka(this.r)}${ka(this.g)}${ka(this.b)}${ka((isNaN(this.opacity)?1:this.opacity)*255)}`}function PE(){const e=up(this.opacity);return`${e===1?"rgb(":"rgba("}${Ha(this.r)}, ${Ha(this.g)}, ${Ha(this.b)}${e===1?")":`, ${e})`}`}function up(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ha(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ka(e){return e=Ha(e),(e<16?"0":"")+e.toString(16)}function DE(e,t,n,s){return s<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new _s(e,t,n,s)}function gP(e){if(e instanceof _s)return new _s(e.h,e.s,e.l,e.opacity);if(e instanceof cd||(e=Ya(e)),!e)return new _s;if(e instanceof _s)return e;e=e.rgb();var t=e.r/255,n=e.g/255,s=e.b/255,r=Math.min(t,n,s),o=Math.max(t,n,s),c=NaN,u=o-r,f=(o+r)/2;return u?(t===o?c=(n-s)/u+(n<s)*6:n===o?c=(s-t)/u+2:c=(t-n)/u+4,u/=f<.5?o+r:2-o-r,c*=60):u=f>0&&f<1?0:c,new _s(c,u,f,e.opacity)}function SY(e,t,n,s){return arguments.length===1?gP(e):new _s(e,t,n,s??1)}function _s(e,t,n,s){this.h=+e,this.s=+t,this.l=+n,this.opacity=+s}rN(_s,SY,mP(cd,{brighter(e){return e=e==null?cp:Math.pow(cp,e),new _s(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Du:Math.pow(Du,e),new _s(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,s=n+(n<.5?n:1-n)*t,r=2*n-s;return new $n(cv(e>=240?e-240:e+120,r,s),cv(e,r,s),cv(e<120?e+240:e-120,r,s),this.opacity)},clamp(){return new _s(qE(this.h),dh(this.s),dh(this.l),up(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=up(this.opacity);return`${e===1?"hsl(":"hsla("}${qE(this.h)}, ${dh(this.s)*100}%, ${dh(this.l)*100}%${e===1?")":`, ${e})`}`}}));function qE(e){return e=(e||0)%360,e<0?e+360:e}function dh(e){return Math.max(0,Math.min(1,e||0))}function cv(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const iN=e=>()=>e;function jY(e,t){return function(n){return e+n*t}}function NY(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(s){return Math.pow(e+s*t,n)}}function _Y(e){return(e=+e)==1?xP:function(t,n){return n-t?NY(t,n,e):iN(isNaN(t)?n:t)}}function xP(e,t){var n=t-e;return n?jY(e,n):iN(isNaN(e)?t:e)}const dp=(function e(t){var n=_Y(t);function s(r,o){var c=n((r=$S(r)).r,(o=$S(o)).r),u=n(r.g,o.g),f=n(r.b,o.b),h=xP(r.opacity,o.opacity);return function(p){return r.r=c(p),r.g=u(p),r.b=f(p),r.opacity=h(p),r+""}}return s.gamma=e,s})(1);function CY(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,s=t.slice(),r;return function(o){for(r=0;r<n;++r)s[r]=e[r]*(1-o)+t[r]*o;return s}}function kY(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function RY(e,t){var n=t?t.length:0,s=e?Math.min(n,e.length):0,r=new Array(s),o=new Array(n),c;for(c=0;c<s;++c)r[c]=bu(e[c],t[c]);for(;c<n;++c)o[c]=t[c];return function(u){for(c=0;c<s;++c)o[c]=r[c](u);return o}}function EY(e,t){var n=new Date;return e=+e,t=+t,function(s){return n.setTime(e*(1-s)+t*s),n}}function Vs(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function AY(e,t){var n={},s={},r;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(r in t)r in e?n[r]=bu(e[r],t[r]):s[r]=t[r];return function(o){for(r in n)s[r]=n[r](o);return s}}var zS=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,uv=new RegExp(zS.source,"g");function TY(e){return function(){return e}}function MY(e){return function(t){return e(t)+""}}function vP(e,t){var n=zS.lastIndex=uv.lastIndex=0,s,r,o,c=-1,u=[],f=[];for(e=e+"",t=t+"";(s=zS.exec(e))&&(r=uv.exec(t));)(o=r.index)>n&&(o=t.slice(n,o),u[c]?u[c]+=o:u[++c]=o),(s=s[0])===(r=r[0])?u[c]?u[c]+=r:u[++c]=r:(u[++c]=null,f.push({i:c,x:Vs(s,r)})),n=uv.lastIndex;return n<t.length&&(o=t.slice(n),u[c]?u[c]+=o:u[++c]=o),u.length<2?f[0]?MY(f[0].x):TY(t):(t=f.length,function(h){for(var p=0,g;p<t;++p)u[(g=f[p]).i]=g.x(h);return u.join("")})}function bu(e,t){var n=typeof t,s;return t==null||n==="boolean"?iN(t):(n==="number"?Vs:n==="string"?(s=Ya(t))?(t=s,dp):vP:t instanceof Ya?dp:t instanceof Date?EY:kY(t)?CY:Array.isArray(t)?RY:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?AY:Vs)(e,t)}var $E=180/Math.PI,BS={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function yP(e,t,n,s,r,o){var c,u,f;return(c=Math.sqrt(e*e+t*t))&&(e/=c,t/=c),(f=e*n+t*s)&&(n-=e*f,s-=t*f),(u=Math.sqrt(n*n+s*s))&&(n/=u,s/=u,f/=u),e*s<t*n&&(e=-e,t=-t,f=-f,c=-c),{translateX:r,translateY:o,rotate:Math.atan2(t,e)*$E,skewX:Math.atan(f)*$E,scaleX:c,scaleY:u}}var fh;function IY(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?BS:yP(t.a,t.b,t.c,t.d,t.e,t.f)}function OY(e){return e==null||(fh||(fh=document.createElementNS("http://www.w3.org/2000/svg","g")),fh.setAttribute("transform",e),!(e=fh.transform.baseVal.consolidate()))?BS:(e=e.matrix,yP(e.a,e.b,e.c,e.d,e.e,e.f))}function bP(e,t,n,s){function r(h){return h.length?h.pop()+" ":""}function o(h,p,g,x,v,b){if(h!==g||p!==x){var w=v.push("translate(",null,t,null,n);b.push({i:w-4,x:Vs(h,g)},{i:w-2,x:Vs(p,x)})}else(g||x)&&v.push("translate("+g+t+x+n)}function c(h,p,g,x){h!==p?(h-p>180?p+=360:p-h>180&&(h+=360),x.push({i:g.push(r(g)+"rotate(",null,s)-2,x:Vs(h,p)})):p&&g.push(r(g)+"rotate("+p+s)}function u(h,p,g,x){h!==p?x.push({i:g.push(r(g)+"skewX(",null,s)-2,x:Vs(h,p)}):p&&g.push(r(g)+"skewX("+p+s)}function f(h,p,g,x,v,b){if(h!==g||p!==x){var w=v.push(r(v)+"scale(",null,",",null,")");b.push({i:w-4,x:Vs(h,g)},{i:w-2,x:Vs(p,x)})}else(g!==1||x!==1)&&v.push(r(v)+"scale("+g+","+x+")")}return function(h,p){var g=[],x=[];return h=e(h),p=e(p),o(h.translateX,h.translateY,p.translateX,p.translateY,g,x),c(h.rotate,p.rotate,g,x),u(h.skewX,p.skewX,g,x),f(h.scaleX,h.scaleY,p.scaleX,p.scaleY,g,x),h=p=null,function(v){for(var b=-1,w=x.length,S;++b<w;)g[(S=x[b]).i]=S.x(v);return g.join("")}}}var LY=bP(IY,"px, ","px)","deg)"),PY=bP(OY,", ",")",")"),DY=1e-12;function zE(e){return((e=Math.exp(e))+1/e)/2}function qY(e){return((e=Math.exp(e))-1/e)/2}function $Y(e){return((e=Math.exp(2*e))-1)/(e+1)}const Fh=(function e(t,n,s){function r(o,c){var u=o[0],f=o[1],h=o[2],p=c[0],g=c[1],x=c[2],v=p-u,b=g-f,w=v*v+b*b,S,N;if(w<DY)N=Math.log(x/h)/t,S=function(A){return[u+A*v,f+A*b,h*Math.exp(t*A*N)]};else{var C=Math.sqrt(w),k=(x*x-h*h+s*w)/(2*h*n*C),_=(x*x-h*h-s*w)/(2*x*n*C),E=Math.log(Math.sqrt(k*k+1)-k),M=Math.log(Math.sqrt(_*_+1)-_);N=(M-E)/t,S=function(A){var O=A*N,L=zE(E),P=h/(n*C)*(L*$Y(t*O+E)-qY(E));return[u+P*v,f+P*b,h*L/zE(t*O+E)]}}return S.duration=N*1e3*t/Math.SQRT2,S}return r.rho=function(o){var c=Math.max(.001,+o),u=c*c,f=u*u;return e(c,u,f)},r})(Math.SQRT2,2,4);var Fl=0,pu=0,lu=0,wP=1e3,fp,mu,hp=0,Wa=0,Vp=0,$u=typeof performance=="object"&&performance.now?performance:Date,SP=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function aN(){return Wa||(SP(zY),Wa=$u.now()+Vp)}function zY(){Wa=0}function pp(){this._call=this._time=this._next=null}pp.prototype=jP.prototype={constructor:pp,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?aN():+n)+(t==null?0:+t),!this._next&&mu!==this&&(mu?mu._next=this:fp=this,mu=this),this._call=e,this._time=n,FS()},stop:function(){this._call&&(this._call=null,this._time=1/0,FS())}};function jP(e,t,n){var s=new pp;return s.restart(e,t,n),s}function BY(){aN(),++Fl;for(var e=fp,t;e;)(t=Wa-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Fl}function BE(){Wa=(hp=$u.now())+Vp,Fl=pu=0;try{BY()}finally{Fl=0,HY(),Wa=0}}function FY(){var e=$u.now(),t=e-hp;t>wP&&(Vp-=t,hp=e)}function HY(){for(var e,t=fp,n,s=1/0;t;)t._call?(s>t._time&&(s=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:fp=n);mu=e,FS(s)}function FS(e){if(!Fl){pu&&(pu=clearTimeout(pu));var t=e-Wa;t>24?(e<1/0&&(pu=setTimeout(BE,e-$u.now()-Vp)),lu&&(lu=clearInterval(lu))):(lu||(hp=$u.now(),lu=setInterval(FY,wP)),Fl=1,SP(BE))}}function FE(e,t,n){var s=new pp;return t=t==null?0:+t,s.restart(r=>{s.stop(),e(r+t)},t,n),s}var UY=Hp("start","end","cancel","interrupt"),VY=[],NP=0,HE=1,HS=2,Hh=3,UE=4,US=5,Uh=6;function Gp(e,t,n,s,r,o){var c=e.__transition;if(!c)e.__transition={};else if(n in c)return;GY(e,n,{name:t,index:s,group:r,on:UY,tween:VY,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:NP})}function oN(e,t){var n=Ms(e,t);if(n.state>NP)throw new Error("too late; already scheduled");return n}function Js(e,t){var n=Ms(e,t);if(n.state>Hh)throw new Error("too late; already running");return n}function Ms(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function GY(e,t,n){var s=e.__transition,r;s[t]=n,n.timer=jP(o,0,n.time);function o(h){n.state=HE,n.timer.restart(c,n.delay,n.time),n.delay<=h&&c(h-n.delay)}function c(h){var p,g,x,v;if(n.state!==HE)return f();for(p in s)if(v=s[p],v.name===n.name){if(v.state===Hh)return FE(c);v.state===UE?(v.state=Uh,v.timer.stop(),v.on.call("interrupt",e,e.__data__,v.index,v.group),delete s[p]):+p<t&&(v.state=Uh,v.timer.stop(),v.on.call("cancel",e,e.__data__,v.index,v.group),delete s[p])}if(FE(function(){n.state===Hh&&(n.state=UE,n.timer.restart(u,n.delay,n.time),u(h))}),n.state=HS,n.on.call("start",e,e.__data__,n.index,n.group),n.state===HS){for(n.state=Hh,r=new Array(x=n.tween.length),p=0,g=-1;p<x;++p)(v=n.tween[p].value.call(e,e.__data__,n.index,n.group))&&(r[++g]=v);r.length=g+1}}function u(h){for(var p=h<n.duration?n.ease.call(null,h/n.duration):(n.timer.restart(f),n.state=US,1),g=-1,x=r.length;++g<x;)r[g].call(e,p);n.state===US&&(n.on.call("end",e,e.__data__,n.index,n.group),f())}function f(){n.state=Uh,n.timer.stop(),delete s[t];for(var h in s)return;delete e.__transition}}function Vh(e,t){var n=e.__transition,s,r,o=!0,c;if(n){t=t==null?null:t+"";for(c in n){if((s=n[c]).name!==t){o=!1;continue}r=s.state>HS&&s.state<US,s.state=Uh,s.timer.stop(),s.on.call(r?"interrupt":"cancel",e,e.__data__,s.index,s.group),delete n[c]}o&&delete e.__transition}}function KY(e){return this.each(function(){Vh(this,e)})}function YY(e,t){var n,s;return function(){var r=Js(this,e),o=r.tween;if(o!==n){s=n=o;for(var c=0,u=s.length;c<u;++c)if(s[c].name===t){s=s.slice(),s.splice(c,1);break}}r.tween=s}}function WY(e,t,n){var s,r;if(typeof n!="function")throw new Error;return function(){var o=Js(this,e),c=o.tween;if(c!==s){r=(s=c).slice();for(var u={name:t,value:n},f=0,h=r.length;f<h;++f)if(r[f].name===t){r[f]=u;break}f===h&&r.push(u)}o.tween=r}}function QY(e,t){var n=this._id;if(e+="",arguments.length<2){for(var s=Ms(this.node(),n).tween,r=0,o=s.length,c;r<o;++r)if((c=s[r]).name===e)return c.value;return null}return this.each((t==null?YY:WY)(n,e,t))}function lN(e,t,n){var s=e._id;return e.each(function(){var r=Js(this,s);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return Ms(r,s).value[t]}}function _P(e,t){var n;return(typeof t=="number"?Vs:t instanceof Ya?dp:(n=Ya(t))?(t=n,dp):vP)(e,t)}function XY(e){return function(){this.removeAttribute(e)}}function ZY(e){return function(){this.removeAttributeNS(e.space,e.local)}}function JY(e,t,n){var s,r=n+"",o;return function(){var c=this.getAttribute(e);return c===r?null:c===s?o:o=t(s=c,n)}}function eW(e,t,n){var s,r=n+"",o;return function(){var c=this.getAttributeNS(e.space,e.local);return c===r?null:c===s?o:o=t(s=c,n)}}function tW(e,t,n){var s,r,o;return function(){var c,u=n(this),f;return u==null?void this.removeAttribute(e):(c=this.getAttribute(e),f=u+"",c===f?null:c===s&&f===r?o:(r=f,o=t(s=c,u)))}}function nW(e,t,n){var s,r,o;return function(){var c,u=n(this),f;return u==null?void this.removeAttributeNS(e.space,e.local):(c=this.getAttributeNS(e.space,e.local),f=u+"",c===f?null:c===s&&f===r?o:(r=f,o=t(s=c,u)))}}function sW(e,t){var n=Up(e),s=n==="transform"?PY:_P;return this.attrTween(e,typeof t=="function"?(n.local?nW:tW)(n,s,lN(this,"attr."+e,t)):t==null?(n.local?ZY:XY)(n):(n.local?eW:JY)(n,s,t))}function rW(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function iW(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function aW(e,t){var n,s;function r(){var o=t.apply(this,arguments);return o!==s&&(n=(s=o)&&iW(e,o)),n}return r._value=t,r}function oW(e,t){var n,s;function r(){var o=t.apply(this,arguments);return o!==s&&(n=(s=o)&&rW(e,o)),n}return r._value=t,r}function lW(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 s=Up(e);return this.tween(n,(s.local?aW:oW)(s,t))}function cW(e,t){return function(){oN(this,e).delay=+t.apply(this,arguments)}}function uW(e,t){return t=+t,function(){oN(this,e).delay=t}}function dW(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?cW:uW)(t,e)):Ms(this.node(),t).delay}function fW(e,t){return function(){Js(this,e).duration=+t.apply(this,arguments)}}function hW(e,t){return t=+t,function(){Js(this,e).duration=t}}function pW(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?fW:hW)(t,e)):Ms(this.node(),t).duration}function mW(e,t){if(typeof t!="function")throw new Error;return function(){Js(this,e).ease=t}}function gW(e){var t=this._id;return arguments.length?this.each(mW(t,e)):Ms(this.node(),t).ease}function xW(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Js(this,e).ease=n}}function vW(e){if(typeof e!="function")throw new Error;return this.each(xW(this._id,e))}function yW(e){typeof e!="function"&&(e=nP(e));for(var t=this._groups,n=t.length,s=new Array(n),r=0;r<n;++r)for(var o=t[r],c=o.length,u=s[r]=[],f,h=0;h<c;++h)(f=o[h])&&e.call(f,f.__data__,h,o)&&u.push(f);return new qr(s,this._parents,this._name,this._id)}function bW(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,s=t.length,r=n.length,o=Math.min(s,r),c=new Array(s),u=0;u<o;++u)for(var f=t[u],h=n[u],p=f.length,g=c[u]=new Array(p),x,v=0;v<p;++v)(x=f[v]||h[v])&&(g[v]=x);for(;u<s;++u)c[u]=t[u];return new qr(c,this._parents,this._name,this._id)}function wW(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 SW(e,t,n){var s,r,o=wW(t)?oN:Js;return function(){var c=o(this,e),u=c.on;u!==s&&(r=(s=u).copy()).on(t,n),c.on=r}}function jW(e,t){var n=this._id;return arguments.length<2?Ms(this.node(),n).on.on(e):this.each(SW(n,e,t))}function NW(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function _W(){return this.on("end.remove",NW(this._id))}function CW(e){var t=this._name,n=this._id;typeof e!="function"&&(e=nN(e));for(var s=this._groups,r=s.length,o=new Array(r),c=0;c<r;++c)for(var u=s[c],f=u.length,h=o[c]=new Array(f),p,g,x=0;x<f;++x)(p=u[x])&&(g=e.call(p,p.__data__,x,u))&&("__data__"in p&&(g.__data__=p.__data__),h[x]=g,Gp(h[x],t,n,x,h,Ms(p,n)));return new qr(o,this._parents,t,n)}function kW(e){var t=this._name,n=this._id;typeof e!="function"&&(e=tP(e));for(var s=this._groups,r=s.length,o=[],c=[],u=0;u<r;++u)for(var f=s[u],h=f.length,p,g=0;g<h;++g)if(p=f[g]){for(var x=e.call(p,p.__data__,g,f),v,b=Ms(p,n),w=0,S=x.length;w<S;++w)(v=x[w])&&Gp(v,t,n,w,x,b);o.push(x),c.push(p)}return new qr(o,c,t,n)}var RW=ld.prototype.constructor;function EW(){return new RW(this._groups,this._parents)}function AW(e,t){var n,s,r;return function(){var o=Bl(this,e),c=(this.style.removeProperty(e),Bl(this,e));return o===c?null:o===n&&c===s?r:r=t(n=o,s=c)}}function CP(e){return function(){this.style.removeProperty(e)}}function TW(e,t,n){var s,r=n+"",o;return function(){var c=Bl(this,e);return c===r?null:c===s?o:o=t(s=c,n)}}function MW(e,t,n){var s,r,o;return function(){var c=Bl(this,e),u=n(this),f=u+"";return u==null&&(f=u=(this.style.removeProperty(e),Bl(this,e))),c===f?null:c===s&&f===r?o:(r=f,o=t(s=c,u))}}function IW(e,t){var n,s,r,o="style."+t,c="end."+o,u;return function(){var f=Js(this,e),h=f.on,p=f.value[o]==null?u||(u=CP(t)):void 0;(h!==n||r!==p)&&(s=(n=h).copy()).on(c,r=p),f.on=s}}function OW(e,t,n){var s=(e+="")=="transform"?LY:_P;return t==null?this.styleTween(e,AW(e,s)).on("end.style."+e,CP(e)):typeof t=="function"?this.styleTween(e,MW(e,s,lN(this,"style."+e,t))).each(IW(this._id,e)):this.styleTween(e,TW(e,s,t),n).on("end.style."+e,null)}function LW(e,t,n){return function(s){this.style.setProperty(e,t.call(this,s),n)}}function PW(e,t,n){var s,r;function o(){var c=t.apply(this,arguments);return c!==r&&(s=(r=c)&&LW(e,c,n)),s}return o._value=t,o}function DW(e,t,n){var s="style."+(e+="");if(arguments.length<2)return(s=this.tween(s))&&s._value;if(t==null)return this.tween(s,null);if(typeof t!="function")throw new Error;return this.tween(s,PW(e,t,n??""))}function qW(e){return function(){this.textContent=e}}function $W(e){return function(){var t=e(this);this.textContent=t??""}}function zW(e){return this.tween("text",typeof e=="function"?$W(lN(this,"text",e)):qW(e==null?"":e+""))}function BW(e){return function(t){this.textContent=e.call(this,t)}}function FW(e){var t,n;function s(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&BW(r)),t}return s._value=e,s}function HW(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,FW(e))}function UW(){for(var e=this._name,t=this._id,n=kP(),s=this._groups,r=s.length,o=0;o<r;++o)for(var c=s[o],u=c.length,f,h=0;h<u;++h)if(f=c[h]){var p=Ms(f,t);Gp(f,e,n,h,c,{time:p.time+p.delay+p.duration,delay:0,duration:p.duration,ease:p.ease})}return new qr(s,this._parents,e,n)}function VW(){var e,t,n=this,s=n._id,r=n.size();return new Promise(function(o,c){var u={value:c},f={value:function(){--r===0&&o()}};n.each(function(){var h=Js(this,s),p=h.on;p!==e&&(t=(e=p).copy(),t._.cancel.push(u),t._.interrupt.push(u),t._.end.push(f)),h.on=t}),r===0&&o()})}var GW=0;function qr(e,t,n,s){this._groups=e,this._parents=t,this._name=n,this._id=s}function kP(){return++GW}var Nr=ld.prototype;qr.prototype={constructor:qr,select:CW,selectAll:kW,selectChild:Nr.selectChild,selectChildren:Nr.selectChildren,filter:yW,merge:bW,selection:EW,transition:UW,call:Nr.call,nodes:Nr.nodes,node:Nr.node,size:Nr.size,empty:Nr.empty,each:Nr.each,on:jW,attr:sW,attrTween:lW,style:OW,styleTween:DW,text:zW,textTween:HW,remove:_W,tween:QY,delay:dW,duration:pW,ease:gW,easeVarying:vW,end:VW,[Symbol.iterator]:Nr[Symbol.iterator]};function KW(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var YW={time:null,delay:0,duration:250,ease:KW};function WW(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 QW(e){var t,n;e instanceof qr?(t=e._id,e=e._name):(t=kP(),(n=YW).time=aN(),e=e==null?null:e+"");for(var s=this._groups,r=s.length,o=0;o<r;++o)for(var c=s[o],u=c.length,f,h=0;h<u;++h)(f=c[h])&&Gp(f,e,t,h,c,n||WW(f,t));return new qr(s,this._parents,e,t)}ld.prototype.interrupt=KY;ld.prototype.transition=QW;const hh=e=>()=>e;function XW(e,{sourceEvent:t,target:n,transform:s,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:s,enumerable:!0,configurable:!0},_:{value:r}})}function Ir(e,t,n){this.k=e,this.x=t,this.y=n}Ir.prototype={constructor:Ir,scale:function(e){return e===1?this:new Ir(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ir(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 Kp=new Ir(1,0,0);RP.prototype=Ir.prototype;function RP(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Kp;return e.__zoom}function dv(e){e.stopImmediatePropagation()}function cu(e){e.preventDefault(),e.stopImmediatePropagation()}function ZW(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function JW(){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 VE(){return this.__zoom||Kp}function eQ(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function tQ(){return navigator.maxTouchPoints||"ontouchstart"in this}function nQ(e,t,n){var s=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],o=e.invertY(t[0][1])-n[0][1],c=e.invertY(t[1][1])-n[1][1];return e.translate(r>s?(s+r)/2:Math.min(0,s)||Math.max(0,r),c>o?(o+c)/2:Math.min(0,o)||Math.max(0,c))}function EP(){var e=ZW,t=JW,n=nQ,s=eQ,r=tQ,o=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],u=250,f=Fh,h=Hp("start","zoom","end"),p,g,x,v=500,b=150,w=0,S=10;function N(z){z.property("__zoom",VE).on("wheel.zoom",O,{passive:!1}).on("mousedown.zoom",L).on("dblclick.zoom",P).filter(r).on("touchstart.zoom",I).on("touchmove.zoom",B).on("touchend.zoom touchcancel.zoom",F).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}N.transform=function(z,Y,$,V){var G=z.selection?z.selection():z;G.property("__zoom",VE),z!==G?E(z,Y,$,V):G.interrupt().each(function(){M(this,arguments).event(V).start().zoom(null,typeof Y=="function"?Y.apply(this,arguments):Y).end()})},N.scaleBy=function(z,Y,$,V){N.scaleTo(z,function(){var G=this.__zoom.k,Z=typeof Y=="function"?Y.apply(this,arguments):Y;return G*Z},$,V)},N.scaleTo=function(z,Y,$,V){N.transform(z,function(){var G=t.apply(this,arguments),Z=this.__zoom,J=$==null?_(G):typeof $=="function"?$.apply(this,arguments):$,D=Z.invert(J),U=typeof Y=="function"?Y.apply(this,arguments):Y;return n(k(C(Z,U),J,D),G,c)},$,V)},N.translateBy=function(z,Y,$,V){N.transform(z,function(){return n(this.__zoom.translate(typeof Y=="function"?Y.apply(this,arguments):Y,typeof $=="function"?$.apply(this,arguments):$),t.apply(this,arguments),c)},null,V)},N.translateTo=function(z,Y,$,V,G){N.transform(z,function(){var Z=t.apply(this,arguments),J=this.__zoom,D=V==null?_(Z):typeof V=="function"?V.apply(this,arguments):V;return n(Kp.translate(D[0],D[1]).scale(J.k).translate(typeof Y=="function"?-Y.apply(this,arguments):-Y,typeof $=="function"?-$.apply(this,arguments):-$),Z,c)},V,G)};function C(z,Y){return Y=Math.max(o[0],Math.min(o[1],Y)),Y===z.k?z:new Ir(Y,z.x,z.y)}function k(z,Y,$){var V=Y[0]-$[0]*z.k,G=Y[1]-$[1]*z.k;return V===z.x&&G===z.y?z:new Ir(z.k,V,G)}function _(z){return[(+z[0][0]+ +z[1][0])/2,(+z[0][1]+ +z[1][1])/2]}function E(z,Y,$,V){z.on("start.zoom",function(){M(this,arguments).event(V).start()}).on("interrupt.zoom end.zoom",function(){M(this,arguments).event(V).end()}).tween("zoom",function(){var G=this,Z=arguments,J=M(G,Z).event(V),D=t.apply(G,Z),U=$==null?_(D):typeof $=="function"?$.apply(G,Z):$,te=Math.max(D[1][0]-D[0][0],D[1][1]-D[0][1]),H=G.__zoom,W=typeof Y=="function"?Y.apply(G,Z):Y,Q=f(H.invert(U).concat(te/H.k),W.invert(U).concat(te/W.k));return function(se){if(se===1)se=W;else{var re=Q(se),ce=te/re[2];se=new Ir(ce,U[0]-re[0]*ce,U[1]-re[1]*ce)}J.zoom(null,se)}})}function M(z,Y,$){return!$&&z.__zooming||new A(z,Y)}function A(z,Y){this.that=z,this.args=Y,this.active=0,this.sourceEvent=null,this.extent=t.apply(z,Y),this.taps=0}A.prototype={event:function(z){return z&&(this.sourceEvent=z),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(z,Y){return this.mouse&&z!=="mouse"&&(this.mouse[1]=Y.invert(this.mouse[0])),this.touch0&&z!=="touch"&&(this.touch0[1]=Y.invert(this.touch0[0])),this.touch1&&z!=="touch"&&(this.touch1[1]=Y.invert(this.touch1[0])),this.that.__zoom=Y,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(z){var Y=es(this.that).datum();h.call(z,this.that,new XW(z,{sourceEvent:this.sourceEvent,target:N,transform:this.that.__zoom,dispatch:h}),Y)}};function O(z,...Y){if(!e.apply(this,arguments))return;var $=M(this,Y).event(z),V=this.__zoom,G=Math.max(o[0],Math.min(o[1],V.k*Math.pow(2,s.apply(this,arguments)))),Z=js(z);if($.wheel)($.mouse[0][0]!==Z[0]||$.mouse[0][1]!==Z[1])&&($.mouse[1]=V.invert($.mouse[0]=Z)),clearTimeout($.wheel);else{if(V.k===G)return;$.mouse=[Z,V.invert(Z)],Vh(this),$.start()}cu(z),$.wheel=setTimeout(J,b),$.zoom("mouse",n(k(C(V,G),$.mouse[0],$.mouse[1]),$.extent,c));function J(){$.wheel=null,$.end()}}function L(z,...Y){if(x||!e.apply(this,arguments))return;var $=z.currentTarget,V=M(this,Y,!0).event(z),G=es(z.view).on("mousemove.zoom",U,!0).on("mouseup.zoom",te,!0),Z=js(z,$),J=z.clientX,D=z.clientY;fP(z.view),dv(z),V.mouse=[Z,this.__zoom.invert(Z)],Vh(this),V.start();function U(H){if(cu(H),!V.moved){var W=H.clientX-J,Q=H.clientY-D;V.moved=W*W+Q*Q>w}V.event(H).zoom("mouse",n(k(V.that.__zoom,V.mouse[0]=js(H,$),V.mouse[1]),V.extent,c))}function te(H){G.on("mousemove.zoom mouseup.zoom",null),hP(H.view,V.moved),cu(H),V.event(H).end()}}function P(z,...Y){if(e.apply(this,arguments)){var $=this.__zoom,V=js(z.changedTouches?z.changedTouches[0]:z,this),G=$.invert(V),Z=$.k*(z.shiftKey?.5:2),J=n(k(C($,Z),V,G),t.apply(this,Y),c);cu(z),u>0?es(this).transition().duration(u).call(E,J,V,z):es(this).call(N.transform,J,V,z)}}function I(z,...Y){if(e.apply(this,arguments)){var $=z.touches,V=$.length,G=M(this,Y,z.changedTouches.length===V).event(z),Z,J,D,U;for(dv(z),J=0;J<V;++J)D=$[J],U=js(D,this),U=[U,this.__zoom.invert(U),D.identifier],G.touch0?!G.touch1&&G.touch0[2]!==U[2]&&(G.touch1=U,G.taps=0):(G.touch0=U,Z=!0,G.taps=1+!!p);p&&(p=clearTimeout(p)),Z&&(G.taps<2&&(g=U[0],p=setTimeout(function(){p=null},v)),Vh(this),G.start())}}function B(z,...Y){if(this.__zooming){var $=M(this,Y).event(z),V=z.changedTouches,G=V.length,Z,J,D,U;for(cu(z),Z=0;Z<G;++Z)J=V[Z],D=js(J,this),$.touch0&&$.touch0[2]===J.identifier?$.touch0[0]=D:$.touch1&&$.touch1[2]===J.identifier&&($.touch1[0]=D);if(J=$.that.__zoom,$.touch1){var te=$.touch0[0],H=$.touch0[1],W=$.touch1[0],Q=$.touch1[1],se=(se=W[0]-te[0])*se+(se=W[1]-te[1])*se,re=(re=Q[0]-H[0])*re+(re=Q[1]-H[1])*re;J=C(J,Math.sqrt(se/re)),D=[(te[0]+W[0])/2,(te[1]+W[1])/2],U=[(H[0]+Q[0])/2,(H[1]+Q[1])/2]}else if($.touch0)D=$.touch0[0],U=$.touch0[1];else return;$.zoom("touch",n(k(J,D,U),$.extent,c))}}function F(z,...Y){if(this.__zooming){var $=M(this,Y).event(z),V=z.changedTouches,G=V.length,Z,J;for(dv(z),x&&clearTimeout(x),x=setTimeout(function(){x=null},v),Z=0;Z<G;++Z)J=V[Z],$.touch0&&$.touch0[2]===J.identifier?delete $.touch0:$.touch1&&$.touch1[2]===J.identifier&&delete $.touch1;if($.touch1&&!$.touch0&&($.touch0=$.touch1,delete $.touch1),$.touch0)$.touch0[1]=this.__zoom.invert($.touch0[0]);else if($.end(),$.taps===2&&(J=js(J,this),Math.hypot(g[0]-J[0],g[1]-J[1])<S)){var D=es(this).on("dblclick.zoom");D&&D.apply(this,arguments)}}}return N.wheelDelta=function(z){return arguments.length?(s=typeof z=="function"?z:hh(+z),N):s},N.filter=function(z){return arguments.length?(e=typeof z=="function"?z:hh(!!z),N):e},N.touchable=function(z){return arguments.length?(r=typeof z=="function"?z:hh(!!z),N):r},N.extent=function(z){return arguments.length?(t=typeof z=="function"?z:hh([[+z[0][0],+z[0][1]],[+z[1][0],+z[1][1]]]),N):t},N.scaleExtent=function(z){return arguments.length?(o[0]=+z[0],o[1]=+z[1],N):[o[0],o[1]]},N.translateExtent=function(z){return arguments.length?(c[0][0]=+z[0][0],c[1][0]=+z[1][0],c[0][1]=+z[0][1],c[1][1]=+z[1][1],N):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},N.constrain=function(z){return arguments.length?(n=z,N):n},N.duration=function(z){return arguments.length?(u=+z,N):u},N.interpolate=function(z){return arguments.length?(f=z,N):f},N.on=function(){var z=h.on.apply(h,arguments);return z===h?N:z},N.clickDistance=function(z){return arguments.length?(w=(z=+z)*z,N):Math.sqrt(w)},N.tapDistance=function(z){return arguments.length?(S=+z,N):S},N}const Zs={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:s})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:s}", 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."},zu=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],AP=["Enter"," ","Escape"],TP={"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 Hl;(function(e){e.Strict="strict",e.Loose="loose"})(Hl||(Hl={}));var Ua;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Ua||(Ua={}));var Bu;(function(e){e.Partial="partial",e.Full="full"})(Bu||(Bu={}));const MP={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var ki;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(ki||(ki={}));var Ul;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Ul||(Ul={}));var ve;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(ve||(ve={}));const GE={[ve.Left]:ve.Right,[ve.Right]:ve.Left,[ve.Top]:ve.Bottom,[ve.Bottom]:ve.Top};function IP(e){return e===null?null:e?"valid":"invalid"}const OP=e=>"id"in e&&"source"in e&&"target"in e,sQ=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),cN=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),ud=(e,t=[0,0])=>{const{width:n,height:s}=$r(e),r=e.origin??t,o=n*r[0],c=s*r[1];return{x:e.position.x-o,y:e.position.y-c}},rQ=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((s,r)=>{const o=typeof r=="string";let c=!t.nodeLookup&&!o?r:void 0;t.nodeLookup&&(c=o?t.nodeLookup.get(r):cN(r)?r:t.nodeLookup.get(r.id));const u=c?mp(c,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Yp(s,u)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Wp(n)},dd=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},s=!1;return e.forEach(r=>{(t.filter===void 0||t.filter(r))&&(n=Yp(n,mp(r)),s=!0)}),s?Wp(n):{x:0,y:0,width:0,height:0}},uN=(e,t,[n,s,r]=[0,0,1],o=!1,c=!1)=>{const u={...hd(t,[n,s,r]),width:t.width/r,height:t.height/r},f=[];for(const h of e.values()){const{measured:p,selectable:g=!0,hidden:x=!1}=h;if(c&&!g||x)continue;const v=p.width??h.width??h.initialWidth??null,b=p.height??h.height??h.initialHeight??null,w=Fu(u,Gl(h)),S=(v??0)*(b??0),N=o&&w>0;(!h.internals.handleBounds||N||w>=S||h.dragging)&&f.push(h)}return f},iQ=(e,t)=>{const n=new Set;return e.forEach(s=>{n.add(s.id)}),t.filter(s=>n.has(s.source)||n.has(s.target))};function aQ(e,t){const n=new Map,s=t!=null&&t.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{r.measured.width&&r.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!r.hidden)&&(!s||s.has(r.id))&&n.set(r.id,r)}),n}async function oQ({nodes:e,width:t,height:n,panZoom:s,minZoom:r,maxZoom:o},c){if(e.size===0)return Promise.resolve(!0);const u=aQ(e,c),f=dd(u),h=dN(f,t,n,(c==null?void 0:c.minZoom)??r,(c==null?void 0:c.maxZoom)??o,(c==null?void 0:c.padding)??.1);return await s.setViewport(h,{duration:c==null?void 0:c.duration,ease:c==null?void 0:c.ease,interpolate:c==null?void 0:c.interpolate}),Promise.resolve(!0)}function LP({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:s=[0,0],nodeExtent:r,onError:o}){const c=n.get(e),u=c.parentId?n.get(c.parentId):void 0,{x:f,y:h}=u?u.internals.positionAbsolute:{x:0,y:0},p=c.origin??s;let g=c.extent||r;if(c.extent==="parent"&&!c.expandParent)if(!u)o==null||o("005",Zs.error005());else{const v=u.measured.width,b=u.measured.height;v&&b&&(g=[[f,h],[f+v,h+b]])}else u&&Kl(c.extent)&&(g=[[c.extent[0][0]+f,c.extent[0][1]+h],[c.extent[1][0]+f,c.extent[1][1]+h]]);const x=Kl(g)?Qa(t,g,c.measured):t;return(c.measured.width===void 0||c.measured.height===void 0)&&(o==null||o("015",Zs.error015())),{position:{x:x.x-f+(c.measured.width??0)*p[0],y:x.y-h+(c.measured.height??0)*p[1]},positionAbsolute:x}}async function lQ({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:s,onBeforeDelete:r}){const o=new Set(e.map(x=>x.id)),c=[];for(const x of n){if(x.deletable===!1)continue;const v=o.has(x.id),b=!v&&x.parentId&&c.find(w=>w.id===x.parentId);(v||b)&&c.push(x)}const u=new Set(t.map(x=>x.id)),f=s.filter(x=>x.deletable!==!1),p=iQ(c,f);for(const x of f)u.has(x.id)&&!p.find(b=>b.id===x.id)&&p.push(x);if(!r)return{edges:p,nodes:c};const g=await r({nodes:c,edges:p});return typeof g=="boolean"?g?{edges:p,nodes:c}:{edges:[],nodes:[]}:g}const Vl=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Qa=(e={x:0,y:0},t,n)=>({x:Vl(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Vl(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function PP(e,t,n){const{width:s,height:r}=$r(n),{x:o,y:c}=n.internals.positionAbsolute;return Qa(e,[[o,c],[o+s,c+r]],t)}const KE=(e,t,n)=>e<t?Vl(Math.abs(e-t),1,t)/t:e>n?-Vl(Math.abs(e-n),1,t)/t:0,DP=(e,t,n=15,s=40)=>{const r=KE(e.x,s,t.width-s)*n,o=KE(e.y,s,t.height-s)*n;return[r,o]},Yp=(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)}),VS=({x:e,y:t,width:n,height:s})=>({x:e,y:t,x2:e+n,y2:t+s}),Wp=({x:e,y:t,x2:n,y2:s})=>({x:e,y:t,width:n-e,height:s-t}),Gl=(e,t=[0,0])=>{var r,o;const{x:n,y:s}=cN(e)?e.internals.positionAbsolute:ud(e,t);return{x:n,y:s,width:((r=e.measured)==null?void 0:r.width)??e.width??e.initialWidth??0,height:((o=e.measured)==null?void 0:o.height)??e.height??e.initialHeight??0}},mp=(e,t=[0,0])=>{var r,o;const{x:n,y:s}=cN(e)?e.internals.positionAbsolute:ud(e,t);return{x:n,y:s,x2:n+(((r=e.measured)==null?void 0:r.width)??e.width??e.initialWidth??0),y2:s+(((o=e.measured)==null?void 0:o.height)??e.height??e.initialHeight??0)}},qP=(e,t)=>Wp(Yp(VS(e),VS(t))),Fu=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),s=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*s)},YE=e=>Cs(e.width)&&Cs(e.height)&&Cs(e.x)&&Cs(e.y),Cs=e=>!isNaN(e)&&isFinite(e),cQ=(e,t)=>{},fd=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),hd=({x:e,y:t},[n,s,r],o=!1,c=[1,1])=>{const u={x:(e-n)/r,y:(t-s)/r};return o?fd(u,c):u},gp=({x:e,y:t},[n,s,r])=>({x:e*r+n,y:t*r+s});function rl(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 uQ(e,t,n){if(typeof e=="string"||typeof e=="number"){const s=rl(e,n),r=rl(e,t);return{top:s,right:r,bottom:s,left:r,x:r*2,y:s*2}}if(typeof e=="object"){const s=rl(e.top??e.y??0,n),r=rl(e.bottom??e.y??0,n),o=rl(e.left??e.x??0,t),c=rl(e.right??e.x??0,t);return{top:s,right:c,bottom:r,left:o,x:o+c,y:s+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function dQ(e,t,n,s,r,o){const{x:c,y:u}=gp(e,[t,n,s]),{x:f,y:h}=gp({x:e.x+e.width,y:e.y+e.height},[t,n,s]),p=r-f,g=o-h;return{left:Math.floor(c),top:Math.floor(u),right:Math.floor(p),bottom:Math.floor(g)}}const dN=(e,t,n,s,r,o)=>{const c=uQ(o,t,n),u=(t-c.x)/e.width,f=(n-c.y)/e.height,h=Math.min(u,f),p=Vl(h,s,r),g=e.x+e.width/2,x=e.y+e.height/2,v=t/2-g*p,b=n/2-x*p,w=dQ(e,v,b,p,t,n),S={left:Math.min(w.left-c.left,0),top:Math.min(w.top-c.top,0),right:Math.min(w.right-c.right,0),bottom:Math.min(w.bottom-c.bottom,0)};return{x:v-S.left+S.right,y:b-S.top+S.bottom,zoom:p}},Hu=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Kl(e){return e!=null&&e!=="parent"}function $r(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function $P(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function zP(e,t={width:0,height:0},n,s,r){const o={...e},c=s.get(n);if(c){const u=c.origin||r;o.x+=c.internals.positionAbsolute.x-(t.width??0)*u[0],o.y+=c.internals.positionAbsolute.y-(t.height??0)*u[1]}return o}function WE(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function fQ(){let e,t;return{promise:new Promise((s,r)=>{e=s,t=r}),resolve:e,reject:t}}function hQ(e){return{...TP,...e||{}}}function wu(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:s,containerBounds:r}){const{x:o,y:c}=ks(e),u=hd({x:o-((r==null?void 0:r.left)??0),y:c-((r==null?void 0:r.top)??0)},s),{x:f,y:h}=n?fd(u,t):u;return{xSnapped:f,ySnapped:h,...u}}const fN=e=>({width:e.offsetWidth,height:e.offsetHeight}),BP=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},pQ=["INPUT","SELECT","TEXTAREA"];function FP(e){var s,r;const t=((r=(s=e.composedPath)==null?void 0:s.call(e))==null?void 0:r[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:pQ.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const HP=e=>"clientX"in e,ks=(e,t)=>{var o,c;const n=HP(e),s=n?e.clientX:(o=e.touches)==null?void 0:o[0].clientX,r=n?e.clientY:(c=e.touches)==null?void 0:c[0].clientY;return{x:s-((t==null?void 0:t.left)??0),y:r-((t==null?void 0:t.top)??0)}},QE=(e,t,n,s,r)=>{const o=t.querySelectorAll(`.${e}`);return!o||!o.length?null:Array.from(o).map(c=>{const u=c.getBoundingClientRect();return{id:c.getAttribute("data-handleid"),type:e,nodeId:r,position:c.getAttribute("data-handlepos"),x:(u.left-n.left)/s,y:(u.top-n.top)/s,...fN(c)}})};function UP({sourceX:e,sourceY:t,targetX:n,targetY:s,sourceControlX:r,sourceControlY:o,targetControlX:c,targetControlY:u}){const f=e*.125+r*.375+c*.375+n*.125,h=t*.125+o*.375+u*.375+s*.125,p=Math.abs(f-e),g=Math.abs(h-t);return[f,h,p,g]}function ph(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function XE({pos:e,x1:t,y1:n,x2:s,y2:r,c:o}){switch(e){case ve.Left:return[t-ph(t-s,o),n];case ve.Right:return[t+ph(s-t,o),n];case ve.Top:return[t,n-ph(n-r,o)];case ve.Bottom:return[t,n+ph(r-n,o)]}}function hN({sourceX:e,sourceY:t,sourcePosition:n=ve.Bottom,targetX:s,targetY:r,targetPosition:o=ve.Top,curvature:c=.25}){const[u,f]=XE({pos:n,x1:e,y1:t,x2:s,y2:r,c}),[h,p]=XE({pos:o,x1:s,y1:r,x2:e,y2:t,c}),[g,x,v,b]=UP({sourceX:e,sourceY:t,targetX:s,targetY:r,sourceControlX:u,sourceControlY:f,targetControlX:h,targetControlY:p});return[`M${e},${t} C${u},${f} ${h},${p} ${s},${r}`,g,x,v,b]}function VP({sourceX:e,sourceY:t,targetX:n,targetY:s}){const r=Math.abs(n-e)/2,o=n<e?n+r:n-r,c=Math.abs(s-t)/2,u=s<t?s+c:s-c;return[o,u,r,c]}function mQ({sourceNode:e,targetNode:t,selected:n=!1,zIndex:s=0,elevateOnSelect:r=!1,zIndexMode:o="basic"}){if(o==="manual")return s;const c=r&&n?s+1e3:s,u=Math.max(e.parentId||r&&e.selected?e.internals.z:0,t.parentId||r&&t.selected?t.internals.z:0);return c+u}function gQ({sourceNode:e,targetNode:t,width:n,height:s,transform:r}){const o=Yp(mp(e),mp(t));o.x===o.x2&&(o.x2+=1),o.y===o.y2&&(o.y2+=1);const c={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:s/r[2]};return Fu(c,Wp(o))>0}const xQ=({source:e,sourceHandle:t,target:n,targetHandle:s})=>`xy-edge__${e}${t||""}-${n}${s||""}`,vQ=(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)),yQ=(e,t,n={})=>{if(!e.source||!e.target)return t;const s=n.getEdgeId||xQ;let r;return OP(e)?r={...e}:r={...e,id:s(e)},vQ(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function GP({sourceX:e,sourceY:t,targetX:n,targetY:s}){const[r,o,c,u]=VP({sourceX:e,sourceY:t,targetX:n,targetY:s});return[`M ${e},${t}L ${n},${s}`,r,o,c,u]}const ZE={[ve.Left]:{x:-1,y:0},[ve.Right]:{x:1,y:0},[ve.Top]:{x:0,y:-1},[ve.Bottom]:{x:0,y:1}},bQ=({source:e,sourcePosition:t=ve.Bottom,target:n})=>t===ve.Left||t===ve.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},JE=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function wQ({source:e,sourcePosition:t=ve.Bottom,target:n,targetPosition:s=ve.Top,center:r,offset:o,stepPosition:c}){const u=ZE[t],f=ZE[s],h={x:e.x+u.x*o,y:e.y+u.y*o},p={x:n.x+f.x*o,y:n.y+f.y*o},g=bQ({source:h,sourcePosition:t,target:p}),x=g.x!==0?"x":"y",v=g[x];let b=[],w,S;const N={x:0,y:0},C={x:0,y:0},[,,k,_]=VP({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(u[x]*f[x]===-1){x==="x"?(w=r.x??h.x+(p.x-h.x)*c,S=r.y??(h.y+p.y)/2):(w=r.x??(h.x+p.x)/2,S=r.y??h.y+(p.y-h.y)*c);const O=[{x:w,y:h.y},{x:w,y:p.y}],L=[{x:h.x,y:S},{x:p.x,y:S}];u[x]===v?b=x==="x"?O:L:b=x==="x"?L:O}else{const O=[{x:h.x,y:p.y}],L=[{x:p.x,y:h.y}];if(x==="x"?b=u.x===v?L:O:b=u.y===v?O:L,t===s){const z=Math.abs(e[x]-n[x]);if(z<=o){const Y=Math.min(o-1,o-z);u[x]===v?N[x]=(h[x]>e[x]?-1:1)*Y:C[x]=(p[x]>n[x]?-1:1)*Y}}if(t!==s){const z=x==="x"?"y":"x",Y=u[x]===f[z],$=h[z]>p[z],V=h[z]<p[z];(u[x]===1&&(!Y&&$||Y&&V)||u[x]!==1&&(!Y&&V||Y&&$))&&(b=x==="x"?O:L)}const P={x:h.x+N.x,y:h.y+N.y},I={x:p.x+C.x,y:p.y+C.y},B=Math.max(Math.abs(P.x-b[0].x),Math.abs(I.x-b[0].x)),F=Math.max(Math.abs(P.y-b[0].y),Math.abs(I.y-b[0].y));B>=F?(w=(P.x+I.x)/2,S=b[0].y):(w=b[0].x,S=(P.y+I.y)/2)}const E={x:h.x+N.x,y:h.y+N.y},M={x:p.x+C.x,y:p.y+C.y};return[[e,...E.x!==b[0].x||E.y!==b[0].y?[E]:[],...b,...M.x!==b[b.length-1].x||M.y!==b[b.length-1].y?[M]:[],n],w,S,k,_]}function SQ(e,t,n,s){const r=Math.min(JE(e,t)/2,JE(t,n)/2,s),{x:o,y:c}=t;if(e.x===o&&o===n.x||e.y===c&&c===n.y)return`L${o} ${c}`;if(e.y===c){const h=e.x<n.x?-1:1,p=e.y<n.y?1:-1;return`L ${o+r*h},${c}Q ${o},${c} ${o},${c+r*p}`}const u=e.x<n.x?1:-1,f=e.y<n.y?-1:1;return`L ${o},${c+r*f}Q ${o},${c} ${o+r*u},${c}`}function GS({sourceX:e,sourceY:t,sourcePosition:n=ve.Bottom,targetX:s,targetY:r,targetPosition:o=ve.Top,borderRadius:c=5,centerX:u,centerY:f,offset:h=20,stepPosition:p=.5}){const[g,x,v,b,w]=wQ({source:{x:e,y:t},sourcePosition:n,target:{x:s,y:r},targetPosition:o,center:{x:u,y:f},offset:h,stepPosition:p});let S=`M${g[0].x} ${g[0].y}`;for(let N=1;N<g.length-1;N++)S+=SQ(g[N-1],g[N],g[N+1],c);return S+=`L${g[g.length-1].x} ${g[g.length-1].y}`,[S,x,v,b,w]}function eA(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function jQ(e){var g;const{sourceNode:t,targetNode:n}=e;if(!eA(t)||!eA(n))return null;const s=t.internals.handleBounds||tA(t.handles),r=n.internals.handleBounds||tA(n.handles),o=nA((s==null?void 0:s.source)??[],e.sourceHandle),c=nA(e.connectionMode===Hl.Strict?(r==null?void 0:r.target)??[]:((r==null?void 0:r.target)??[]).concat((r==null?void 0:r.source)??[]),e.targetHandle);if(!o||!c)return(g=e.onError)==null||g.call(e,"008",Zs.error008(o?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const u=(o==null?void 0:o.position)||ve.Bottom,f=(c==null?void 0:c.position)||ve.Top,h=Xa(t,o,u),p=Xa(n,c,f);return{sourceX:h.x,sourceY:h.y,targetX:p.x,targetY:p.y,sourcePosition:u,targetPosition:f}}function tA(e){if(!e)return null;const t=[],n=[];for(const s of e)s.width=s.width??1,s.height=s.height??1,s.type==="source"?t.push(s):s.type==="target"&&n.push(s);return{source:t,target:n}}function Xa(e,t,n=ve.Left,s=!1){const r=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,o=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:c,height:u}=t??$r(e);if(s)return{x:r+c/2,y:o+u/2};switch((t==null?void 0:t.position)??n){case ve.Top:return{x:r+c/2,y:o};case ve.Right:return{x:r+c,y:o+u/2};case ve.Bottom:return{x:r+c/2,y:o+u};case ve.Left:return{x:r,y:o+u/2}}}function nA(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function KS(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(s=>`${s}=${e[s]}`).join("&")}`:""}function NQ(e,{id:t,defaultColor:n,defaultMarkerStart:s,defaultMarkerEnd:r}){const o=new Set;return e.reduce((c,u)=>([u.markerStart||s,u.markerEnd||r].forEach(f=>{if(f&&typeof f=="object"){const h=KS(f,t);o.has(h)||(c.push({id:h,color:f.color||n,...f}),o.add(h))}}),c),[]).sort((c,u)=>c.id.localeCompare(u.id))}const KP=1e3,_Q=10,pN={nodeOrigin:[0,0],nodeExtent:zu,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},CQ={...pN,checkEquality:!0};function mN(e,t){const n={...e};for(const s in t)t[s]!==void 0&&(n[s]=t[s]);return n}function kQ(e,t,n){const s=mN(pN,n);for(const r of e.values())if(r.parentId)xN(r,e,t,s);else{const o=ud(r,s.nodeOrigin),c=Kl(r.extent)?r.extent:s.nodeExtent,u=Qa(o,c,$r(r));r.internals.positionAbsolute=u}}function RQ(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],s=[];for(const r of e.handles){const o={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(o):r.type==="target"&&s.push(o)}return{source:n,target:s}}function gN(e){return e==="manual"}function YS(e,t,n,s={}){var p,g;const r=mN(CQ,s),o={i:0},c=new Map(t),u=r!=null&&r.elevateNodesOnSelect&&!gN(r.zIndexMode)?KP:0;let f=e.length>0,h=!1;t.clear(),n.clear();for(const x of e){let v=c.get(x.id);if(r.checkEquality&&x===(v==null?void 0:v.internals.userNode))t.set(x.id,v);else{const b=ud(x,r.nodeOrigin),w=Kl(x.extent)?x.extent:r.nodeExtent,S=Qa(b,w,$r(x));v={...r.defaults,...x,measured:{width:(p=x.measured)==null?void 0:p.width,height:(g=x.measured)==null?void 0:g.height},internals:{positionAbsolute:S,handleBounds:RQ(x,v),z:YP(x,u,r.zIndexMode),userNode:x}},t.set(x.id,v)}(v.measured===void 0||v.measured.width===void 0||v.measured.height===void 0)&&!v.hidden&&(f=!1),x.parentId&&xN(v,t,n,s,o),h||(h=x.selected??!1)}return{nodesInitialized:f,hasSelectedNodes:h}}function EQ(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 xN(e,t,n,s,r){const{elevateNodesOnSelect:o,nodeOrigin:c,nodeExtent:u,zIndexMode:f}=mN(pN,s),h=e.parentId,p=t.get(h);if(!p){console.warn(`Parent node ${h} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}EQ(e,n),r&&!p.parentId&&p.internals.rootParentIndex===void 0&&f==="auto"&&(p.internals.rootParentIndex=++r.i,p.internals.z=p.internals.z+r.i*_Q),r&&p.internals.rootParentIndex!==void 0&&(r.i=p.internals.rootParentIndex);const g=o&&!gN(f)?KP:0,{x,y:v,z:b}=AQ(e,p,c,u,g,f),{positionAbsolute:w}=e.internals,S=x!==w.x||v!==w.y;(S||b!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:S?{x,y:v}:w,z:b}})}function YP(e,t,n){const s=Cs(e.zIndex)?e.zIndex:0;return gN(n)?s:s+(e.selected?t:0)}function AQ(e,t,n,s,r,o){const{x:c,y:u}=t.internals.positionAbsolute,f=$r(e),h=ud(e,n),p=Kl(e.extent)?Qa(h,e.extent,f):h;let g=Qa({x:c+p.x,y:u+p.y},s,f);e.extent==="parent"&&(g=PP(g,f,t));const x=YP(e,r,o),v=t.internals.z??0;return{x:g.x,y:g.y,z:v>=x?v+1:x}}function vN(e,t,n,s=[0,0]){var c;const r=[],o=new Map;for(const u of e){const f=t.get(u.parentId);if(!f)continue;const h=((c=o.get(u.parentId))==null?void 0:c.expandedRect)??Gl(f),p=qP(h,u.rect);o.set(u.parentId,{expandedRect:p,parent:f})}return o.size>0&&o.forEach(({expandedRect:u,parent:f},h)=>{var k;const p=f.internals.positionAbsolute,g=$r(f),x=f.origin??s,v=u.x<p.x?Math.round(Math.abs(p.x-u.x)):0,b=u.y<p.y?Math.round(Math.abs(p.y-u.y)):0,w=Math.max(g.width,Math.round(u.width)),S=Math.max(g.height,Math.round(u.height)),N=(w-g.width)*x[0],C=(S-g.height)*x[1];(v>0||b>0||N||C)&&(r.push({id:h,type:"position",position:{x:f.position.x-v+N,y:f.position.y-b+C}}),(k=n.get(h))==null||k.forEach(_=>{e.some(E=>E.id===_.id)||r.push({id:_.id,type:"position",position:{x:_.position.x+v,y:_.position.y+b}})})),(g.width<u.width||g.height<u.height||v||b)&&r.push({id:h,type:"dimensions",setAttributes:!0,dimensions:{width:w+(v?x[0]*v-N:0),height:S+(b?x[1]*b-C:0)}})}),r}function TQ(e,t,n,s,r,o,c){const u=s==null?void 0:s.querySelector(".xyflow__viewport");let f=!1;if(!u)return{changes:[],updatedInternals:f};const h=[],p=window.getComputedStyle(u),{m22:g}=new window.DOMMatrixReadOnly(p.transform),x=[];for(const v of e.values()){const b=t.get(v.id);if(!b)continue;if(b.hidden){t.set(b.id,{...b,internals:{...b.internals,handleBounds:void 0}}),f=!0;continue}const w=fN(v.nodeElement),S=b.measured.width!==w.width||b.measured.height!==w.height;if(!!(w.width&&w.height&&(S||!b.internals.handleBounds||v.force))){const C=v.nodeElement.getBoundingClientRect(),k=Kl(b.extent)?b.extent:o;let{positionAbsolute:_}=b.internals;b.parentId&&b.extent==="parent"?_=PP(_,w,t.get(b.parentId)):k&&(_=Qa(_,k,w));const E={...b,measured:w,internals:{...b.internals,positionAbsolute:_,handleBounds:{source:QE("source",v.nodeElement,C,g,b.id),target:QE("target",v.nodeElement,C,g,b.id)}}};t.set(b.id,E),b.parentId&&xN(E,t,n,{nodeOrigin:r,zIndexMode:c}),f=!0,S&&(h.push({id:b.id,type:"dimensions",dimensions:w}),b.expandParent&&b.parentId&&x.push({id:b.id,parentId:b.parentId,rect:Gl(E,r)}))}}if(x.length>0){const v=vN(x,t,n,r);h.push(...v)}return{changes:h,updatedInternals:f}}async function MQ({delta:e,panZoom:t,transform:n,translateExtent:s,width:r,height:o}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const c=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,o]],s),u=!!c&&(c.x!==n[0]||c.y!==n[1]||c.k!==n[2]);return Promise.resolve(u)}function sA(e,t,n,s,r,o){let c=r;const u=s.get(c)||new Map;s.set(c,u.set(n,t)),c=`${r}-${e}`;const f=s.get(c)||new Map;if(s.set(c,f.set(n,t)),o){c=`${r}-${e}-${o}`;const h=s.get(c)||new Map;s.set(c,h.set(n,t))}}function WP(e,t,n){e.clear(),t.clear();for(const s of n){const{source:r,target:o,sourceHandle:c=null,targetHandle:u=null}=s,f={edgeId:s.id,source:r,target:o,sourceHandle:c,targetHandle:u},h=`${r}-${c}--${o}-${u}`,p=`${o}-${u}--${r}-${c}`;sA("source",f,p,e,r,c),sA("target",f,h,e,o,u),t.set(s.id,s)}}function QP(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:QP(n,t):!1}function rA(e,t,n){var r;let s=e;do{if((r=s==null?void 0:s.matches)!=null&&r.call(s,t))return!0;if(s===n)return!1;s=s==null?void 0:s.parentElement}while(s);return!1}function IQ(e,t,n,s){const r=new Map;for(const[o,c]of e)if((c.selected||c.id===s)&&(!c.parentId||!QP(c,e))&&(c.draggable||t&&typeof c.draggable>"u")){const u=e.get(o);u&&r.set(o,{id:o,position:u.position||{x:0,y:0},distance:{x:n.x-u.internals.positionAbsolute.x,y:n.y-u.internals.positionAbsolute.y},extent:u.extent,parentId:u.parentId,origin:u.origin,expandParent:u.expandParent,internals:{positionAbsolute:u.internals.positionAbsolute||{x:0,y:0}},measured:{width:u.measured.width??0,height:u.measured.height??0}})}return r}function fv({nodeId:e,dragItems:t,nodeLookup:n,dragging:s=!0}){var c,u,f;const r=[];for(const[h,p]of t){const g=(c=n.get(h))==null?void 0:c.internals.userNode;g&&r.push({...g,position:p.position,dragging:s})}if(!e)return[r[0],r];const o=(u=n.get(e))==null?void 0:u.internals.userNode;return[o?{...o,position:((f=t.get(e))==null?void 0:f.position)||o.position,dragging:s}:r[0],r]}function OQ({dragItems:e,snapGrid:t,x:n,y:s}){const r=e.values().next().value;if(!r)return null;const o={x:n-r.distance.x,y:s-r.distance.y},c=fd(o,t);return{x:c.x-o.x,y:c.y-o.y}}function LQ({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:s,onDragStop:r}){let o={x:null,y:null},c=0,u=new Map,f=!1,h={x:0,y:0},p=null,g=!1,x=null,v=!1,b=!1,w=null;function S({noDragClassName:C,handleSelector:k,domNode:_,isSelectable:E,nodeId:M,nodeClickDistance:A=0}){x=es(_);function O({x:B,y:F}){const{nodeLookup:z,nodeExtent:Y,snapGrid:$,snapToGrid:V,nodeOrigin:G,onNodeDrag:Z,onSelectionDrag:J,onError:D,updateNodePositions:U}=t();o={x:B,y:F};let te=!1;const H=u.size>1,W=H&&Y?VS(dd(u)):null,Q=H&&V?OQ({dragItems:u,snapGrid:$,x:B,y:F}):null;for(const[se,re]of u){if(!z.has(se))continue;let ce={x:B-re.distance.x,y:F-re.distance.y};V&&(ce=Q?{x:Math.round(ce.x+Q.x),y:Math.round(ce.y+Q.y)}:fd(ce,$));let me=null;if(H&&Y&&!re.extent&&W){const{positionAbsolute:xe}=re.internals,Se=xe.x-W.x+Y[0][0],je=xe.x+re.measured.width-W.x2+Y[1][0],Oe=xe.y-W.y+Y[0][1],Ee=xe.y+re.measured.height-W.y2+Y[1][1];me=[[Se,Oe],[je,Ee]]}const{position:ge,positionAbsolute:ye}=LP({nodeId:se,nextPosition:ce,nodeLookup:z,nodeExtent:me||Y,nodeOrigin:G,onError:D});te=te||re.position.x!==ge.x||re.position.y!==ge.y,re.position=ge,re.internals.positionAbsolute=ye}if(b=b||te,!!te&&(U(u,!0),w&&(s||Z||!M&&J))){const[se,re]=fv({nodeId:M,dragItems:u,nodeLookup:z});s==null||s(w,u,se,re),Z==null||Z(w,se,re),M||J==null||J(w,re)}}async function L(){if(!p)return;const{transform:B,panBy:F,autoPanSpeed:z,autoPanOnNodeDrag:Y}=t();if(!Y){f=!1,cancelAnimationFrame(c);return}const[$,V]=DP(h,p,z);($!==0||V!==0)&&(o.x=(o.x??0)-$/B[2],o.y=(o.y??0)-V/B[2],await F({x:$,y:V})&&O(o)),c=requestAnimationFrame(L)}function P(B){var H;const{nodeLookup:F,multiSelectionActive:z,nodesDraggable:Y,transform:$,snapGrid:V,snapToGrid:G,selectNodesOnDrag:Z,onNodeDragStart:J,onSelectionDragStart:D,unselectNodesAndEdges:U}=t();g=!0,(!Z||!E)&&!z&&M&&((H=F.get(M))!=null&&H.selected||U()),E&&Z&&M&&(e==null||e(M));const te=wu(B.sourceEvent,{transform:$,snapGrid:V,snapToGrid:G,containerBounds:p});if(o=te,u=IQ(F,Y,te,M),u.size>0&&(n||J||!M&&D)){const[W,Q]=fv({nodeId:M,dragItems:u,nodeLookup:F});n==null||n(B.sourceEvent,u,W,Q),J==null||J(B.sourceEvent,W,Q),M||D==null||D(B.sourceEvent,Q)}}const I=pP().clickDistance(A).on("start",B=>{const{domNode:F,nodeDragThreshold:z,transform:Y,snapGrid:$,snapToGrid:V}=t();p=(F==null?void 0:F.getBoundingClientRect())||null,v=!1,b=!1,w=B.sourceEvent,z===0&&P(B),o=wu(B.sourceEvent,{transform:Y,snapGrid:$,snapToGrid:V,containerBounds:p}),h=ks(B.sourceEvent,p)}).on("drag",B=>{const{autoPanOnNodeDrag:F,transform:z,snapGrid:Y,snapToGrid:$,nodeDragThreshold:V,nodeLookup:G}=t(),Z=wu(B.sourceEvent,{transform:z,snapGrid:Y,snapToGrid:$,containerBounds:p});if(w=B.sourceEvent,(B.sourceEvent.type==="touchmove"&&B.sourceEvent.touches.length>1||M&&!G.has(M))&&(v=!0),!v){if(!f&&F&&g&&(f=!0,L()),!g){const J=ks(B.sourceEvent,p),D=J.x-h.x,U=J.y-h.y;Math.sqrt(D*D+U*U)>V&&P(B)}(o.x!==Z.xSnapped||o.y!==Z.ySnapped)&&u&&g&&(h=ks(B.sourceEvent,p),O(Z))}}).on("end",B=>{if(!(!g||v)&&(f=!1,g=!1,cancelAnimationFrame(c),u.size>0)){const{nodeLookup:F,updateNodePositions:z,onNodeDragStop:Y,onSelectionDragStop:$}=t();if(b&&(z(u,!1),b=!1),r||Y||!M&&$){const[V,G]=fv({nodeId:M,dragItems:u,nodeLookup:F,dragging:!1});r==null||r(B.sourceEvent,u,V,G),Y==null||Y(B.sourceEvent,V,G),M||$==null||$(B.sourceEvent,G)}}}).filter(B=>{const F=B.target;return!B.button&&(!C||!rA(F,`.${C}`,_))&&(!k||rA(F,k,_))});x.call(I)}function N(){x==null||x.on(".drag",null)}return{update:S,destroy:N}}function PQ(e,t,n){const s=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const o of t.values())Fu(r,Gl(o))>0&&s.push(o);return s}const DQ=250;function qQ(e,t,n,s){var u,f;let r=[],o=1/0;const c=PQ(e,n,t+DQ);for(const h of c){const p=[...((u=h.internals.handleBounds)==null?void 0:u.source)??[],...((f=h.internals.handleBounds)==null?void 0:f.target)??[]];for(const g of p){if(s.nodeId===g.nodeId&&s.type===g.type&&s.id===g.id)continue;const{x,y:v}=Xa(h,g,g.position,!0),b=Math.sqrt(Math.pow(x-e.x,2)+Math.pow(v-e.y,2));b>t||(b<o?(r=[{...g,x,y:v}],o=b):b===o&&r.push({...g,x,y:v}))}}if(!r.length)return null;if(r.length>1){const h=s.type==="source"?"target":"source";return r.find(p=>p.type===h)??r[0]}return r[0]}function XP(e,t,n,s,r,o=!1){var h,p,g;const c=s.get(e);if(!c)return null;const u=r==="strict"?(h=c.internals.handleBounds)==null?void 0:h[t]:[...((p=c.internals.handleBounds)==null?void 0:p.source)??[],...((g=c.internals.handleBounds)==null?void 0:g.target)??[]],f=(n?u==null?void 0:u.find(x=>x.id===n):u==null?void 0:u[0])??null;return f&&o?{...f,...Xa(c,f,f.position,!0)}:f}function ZP(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function $Q(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const JP=()=>!0;function zQ(e,{connectionMode:t,connectionRadius:n,handleId:s,nodeId:r,edgeUpdaterType:o,isTarget:c,domNode:u,nodeLookup:f,lib:h,autoPanOnConnect:p,flowId:g,panBy:x,cancelConnection:v,onConnectStart:b,onConnect:w,onConnectEnd:S,isValidConnection:N=JP,onReconnectEnd:C,updateConnection:k,getTransform:_,getFromHandle:E,autoPanSpeed:M,dragThreshold:A=1,handleDomNode:O}){const L=BP(e.target);let P=0,I;const{x:B,y:F}=ks(e),z=ZP(o,O),Y=u==null?void 0:u.getBoundingClientRect();let $=!1;if(!Y||!z)return;const V=XP(r,z,s,f,t);if(!V)return;let G=ks(e,Y),Z=!1,J=null,D=!1,U=null;function te(){if(!p||!Y)return;const[ge,ye]=DP(G,Y,M);x({x:ge,y:ye}),P=requestAnimationFrame(te)}const H={...V,nodeId:r,type:z,position:V.position},W=f.get(r);let se={inProgress:!0,isValid:null,from:Xa(W,H,ve.Left,!0),fromHandle:H,fromPosition:H.position,fromNode:W,to:G,toHandle:null,toPosition:GE[H.position],toNode:null,pointer:G};function re(){$=!0,k(se),b==null||b(e,{nodeId:r,handleId:s,handleType:z})}A===0&&re();function ce(ge){if(!$){const{x:Ee,y:mt}=ks(ge),yt=Ee-B,Tt=mt-F;if(!(yt*yt+Tt*Tt>A*A))return;re()}if(!E()||!H){me(ge);return}const ye=_();G=ks(ge,Y),I=qQ(hd(G,ye,!1,[1,1]),n,f,H),Z||(te(),Z=!0);const xe=eD(ge,{handle:I,connectionMode:t,fromNodeId:r,fromHandleId:s,fromType:c?"target":"source",isValidConnection:N,doc:L,lib:h,flowId:g,nodeLookup:f});U=xe.handleDomNode,J=xe.connection,D=$Q(!!I,xe.isValid);const Se=f.get(r),je=Se?Xa(Se,H,ve.Left,!0):se.from,Oe={...se,from:je,isValid:D,to:xe.toHandle&&D?gp({x:xe.toHandle.x,y:xe.toHandle.y},ye):G,toHandle:xe.toHandle,toPosition:D&&xe.toHandle?xe.toHandle.position:GE[H.position],toNode:xe.toHandle?f.get(xe.toHandle.nodeId):null,pointer:G};k(Oe),se=Oe}function me(ge){if(!("touches"in ge&&ge.touches.length>0)){if($){(I||U)&&J&&D&&(w==null||w(J));const{inProgress:ye,...xe}=se,Se={...xe,toPosition:se.toHandle?se.toPosition:null};S==null||S(ge,Se),o&&(C==null||C(ge,Se))}v(),cancelAnimationFrame(P),Z=!1,D=!1,J=null,U=null,L.removeEventListener("mousemove",ce),L.removeEventListener("mouseup",me),L.removeEventListener("touchmove",ce),L.removeEventListener("touchend",me)}}L.addEventListener("mousemove",ce),L.addEventListener("mouseup",me),L.addEventListener("touchmove",ce),L.addEventListener("touchend",me)}function eD(e,{handle:t,connectionMode:n,fromNodeId:s,fromHandleId:r,fromType:o,doc:c,lib:u,flowId:f,isValidConnection:h=JP,nodeLookup:p}){const g=o==="target",x=t?c.querySelector(`.${u}-flow__handle[data-id="${f}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:v,y:b}=ks(e),w=c.elementFromPoint(v,b),S=w!=null&&w.classList.contains(`${u}-flow__handle`)?w:x,N={handleDomNode:S,isValid:!1,connection:null,toHandle:null};if(S){const C=ZP(void 0,S),k=S.getAttribute("data-nodeid"),_=S.getAttribute("data-handleid"),E=S.classList.contains("connectable"),M=S.classList.contains("connectableend");if(!k||!C)return N;const A={source:g?k:s,sourceHandle:g?_:r,target:g?s:k,targetHandle:g?r:_};N.connection=A;const L=E&&M&&(n===Hl.Strict?g&&C==="source"||!g&&C==="target":k!==s||_!==r);N.isValid=L&&h(A),N.toHandle=XP(k,C,_,p,n,!0)}return N}const WS={onPointerDown:zQ,isValid:eD};function BQ({domNode:e,panZoom:t,getTransform:n,getViewScale:s}){const r=es(e);function o({translateExtent:u,width:f,height:h,zoomStep:p=1,pannable:g=!0,zoomable:x=!0,inversePan:v=!1}){const b=k=>{if(k.sourceEvent.type!=="wheel"||!t)return;const _=n(),E=k.sourceEvent.ctrlKey&&Hu()?10:1,M=-k.sourceEvent.deltaY*(k.sourceEvent.deltaMode===1?.05:k.sourceEvent.deltaMode?1:.002)*p,A=_[2]*Math.pow(2,M*E);t.scaleTo(A)};let w=[0,0];const S=k=>{(k.sourceEvent.type==="mousedown"||k.sourceEvent.type==="touchstart")&&(w=[k.sourceEvent.clientX??k.sourceEvent.touches[0].clientX,k.sourceEvent.clientY??k.sourceEvent.touches[0].clientY])},N=k=>{const _=n();if(k.sourceEvent.type!=="mousemove"&&k.sourceEvent.type!=="touchmove"||!t)return;const E=[k.sourceEvent.clientX??k.sourceEvent.touches[0].clientX,k.sourceEvent.clientY??k.sourceEvent.touches[0].clientY],M=[E[0]-w[0],E[1]-w[1]];w=E;const A=s()*Math.max(_[2],Math.log(_[2]))*(v?-1:1),O={x:_[0]-M[0]*A,y:_[1]-M[1]*A},L=[[0,0],[f,h]];t.setViewportConstrained({x:O.x,y:O.y,zoom:_[2]},L,u)},C=EP().on("start",S).on("zoom",g?N:null).on("zoom.wheel",x?b:null);r.call(C,{})}function c(){r.on("zoom",null)}return{update:o,destroy:c,pointer:js}}const Qp=e=>({x:e.x,y:e.y,zoom:e.k}),hv=({x:e,y:t,zoom:n})=>Kp.translate(e,t).scale(n),ml=(e,t)=>e.target.closest(`.${t}`),tD=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),FQ=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,pv=(e,t=0,n=FQ,s=()=>{})=>{const r=typeof t=="number"&&t>0;return r||s(),r?e.transition().duration(t).ease(n).on("end",s):e},nD=e=>{const t=e.ctrlKey&&Hu()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function HQ({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:s,panOnScrollMode:r,panOnScrollSpeed:o,zoomOnPinch:c,onPanZoomStart:u,onPanZoom:f,onPanZoomEnd:h}){return p=>{if(ml(p,t))return p.ctrlKey&&p.preventDefault(),!1;p.preventDefault(),p.stopImmediatePropagation();const g=n.property("__zoom").k||1;if(p.ctrlKey&&c){const S=js(p),N=nD(p),C=g*Math.pow(2,N);s.scaleTo(n,C,S,p);return}const x=p.deltaMode===1?20:1;let v=r===Ua.Vertical?0:p.deltaX*x,b=r===Ua.Horizontal?0:p.deltaY*x;!Hu()&&p.shiftKey&&r!==Ua.Vertical&&(v=p.deltaY*x,b=0),s.translateBy(n,-(v/g)*o,-(b/g)*o,{internal:!0});const w=Qp(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(f==null||f(p,w),e.panScrollTimeout=setTimeout(()=>{h==null||h(p,w),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,u==null||u(p,w))}}function UQ({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(s,r){const o=s.type==="wheel",c=!t&&o&&!s.ctrlKey,u=ml(s,e);if(s.ctrlKey&&o&&u&&s.preventDefault(),c||u)return null;s.preventDefault(),n.call(this,s,r)}}function VQ({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return s=>{var o,c,u;if((o=s.sourceEvent)!=null&&o.internal)return;const r=Qp(s.transform);e.mouseButton=((c=s.sourceEvent)==null?void 0:c.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=r,((u=s.sourceEvent)==null?void 0:u.type)==="mousedown"&&t(!0),n&&(n==null||n(s.sourceEvent,r))}}function GQ({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:s,onPanZoom:r}){return o=>{var c,u;e.usedRightMouseButton=!!(n&&tD(t,e.mouseButton??0)),(c=o.sourceEvent)!=null&&c.sync||s([o.transform.x,o.transform.y,o.transform.k]),r&&!((u=o.sourceEvent)!=null&&u.internal)&&(r==null||r(o.sourceEvent,Qp(o.transform)))}}function KQ({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:s,onPanZoomEnd:r,onPaneContextMenu:o}){return c=>{var u;if(!((u=c.sourceEvent)!=null&&u.internal)&&(e.isZoomingOrPanning=!1,o&&tD(t,e.mouseButton??0)&&!e.usedRightMouseButton&&c.sourceEvent&&o(c.sourceEvent),e.usedRightMouseButton=!1,s(!1),r)){const f=Qp(c.transform);e.prevViewport=f,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r==null||r(c.sourceEvent,f)},n?150:0)}}}function YQ({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:s,panOnScroll:r,zoomOnDoubleClick:o,userSelectionActive:c,noWheelClassName:u,noPanClassName:f,lib:h,connectionInProgress:p}){return g=>{var S;const x=e||t,v=n&&g.ctrlKey,b=g.type==="wheel";if(g.button===1&&g.type==="mousedown"&&(ml(g,`${h}-flow__node`)||ml(g,`${h}-flow__edge`)))return!0;if(!s&&!x&&!r&&!o&&!n||c||p&&!b||ml(g,u)&&b||ml(g,f)&&(!b||r&&b&&!e)||!n&&g.ctrlKey&&b)return!1;if(!n&&g.type==="touchstart"&&((S=g.touches)==null?void 0:S.length)>1)return g.preventDefault(),!1;if(!x&&!r&&!v&&b||!s&&(g.type==="mousedown"||g.type==="touchstart")||Array.isArray(s)&&!s.includes(g.button)&&g.type==="mousedown")return!1;const w=Array.isArray(s)&&s.includes(g.button)||!g.button||g.button<=1;return(!g.ctrlKey||b)&&w}}function WQ({domNode:e,minZoom:t,maxZoom:n,translateExtent:s,viewport:r,onPanZoom:o,onPanZoomStart:c,onPanZoomEnd:u,onDraggingChange:f}){const h={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},p=e.getBoundingClientRect(),g=EP().scaleExtent([t,n]).translateExtent(s),x=es(e).call(g);C({x:r.x,y:r.y,zoom:Vl(r.zoom,t,n)},[[0,0],[p.width,p.height]],s);const v=x.on("wheel.zoom"),b=x.on("dblclick.zoom");g.wheelDelta(nD);function w(I,B){return x?new Promise(F=>{g==null||g.interpolate((B==null?void 0:B.interpolate)==="linear"?bu:Fh).transform(pv(x,B==null?void 0:B.duration,B==null?void 0:B.ease,()=>F(!0)),I)}):Promise.resolve(!1)}function S({noWheelClassName:I,noPanClassName:B,onPaneContextMenu:F,userSelectionActive:z,panOnScroll:Y,panOnDrag:$,panOnScrollMode:V,panOnScrollSpeed:G,preventScrolling:Z,zoomOnPinch:J,zoomOnScroll:D,zoomOnDoubleClick:U,zoomActivationKeyPressed:te,lib:H,onTransformChange:W,connectionInProgress:Q,paneClickDistance:se,selectionOnDrag:re}){z&&!h.isZoomingOrPanning&&N();const ce=Y&&!te&&!z;g.clickDistance(re?1/0:!Cs(se)||se<0?0:se);const me=ce?HQ({zoomPanValues:h,noWheelClassName:I,d3Selection:x,d3Zoom:g,panOnScrollMode:V,panOnScrollSpeed:G,zoomOnPinch:J,onPanZoomStart:c,onPanZoom:o,onPanZoomEnd:u}):UQ({noWheelClassName:I,preventScrolling:Z,d3ZoomHandler:v});if(x.on("wheel.zoom",me,{passive:!1}),!z){const ye=VQ({zoomPanValues:h,onDraggingChange:f,onPanZoomStart:c});g.on("start",ye);const xe=GQ({zoomPanValues:h,panOnDrag:$,onPaneContextMenu:!!F,onPanZoom:o,onTransformChange:W});g.on("zoom",xe);const Se=KQ({zoomPanValues:h,panOnDrag:$,panOnScroll:Y,onPaneContextMenu:F,onPanZoomEnd:u,onDraggingChange:f});g.on("end",Se)}const ge=YQ({zoomActivationKeyPressed:te,panOnDrag:$,zoomOnScroll:D,panOnScroll:Y,zoomOnDoubleClick:U,zoomOnPinch:J,userSelectionActive:z,noPanClassName:B,noWheelClassName:I,lib:H,connectionInProgress:Q});g.filter(ge),U?x.on("dblclick.zoom",b):x.on("dblclick.zoom",null)}function N(){g.on("zoom",null)}async function C(I,B,F){const z=hv(I),Y=g==null?void 0:g.constrain()(z,B,F);return Y&&await w(Y),new Promise($=>$(Y))}async function k(I,B){const F=hv(I);return await w(F,B),new Promise(z=>z(F))}function _(I){if(x){const B=hv(I),F=x.property("__zoom");(F.k!==I.zoom||F.x!==I.x||F.y!==I.y)&&(g==null||g.transform(x,B,null,{sync:!0}))}}function E(){const I=x?RP(x.node()):{x:0,y:0,k:1};return{x:I.x,y:I.y,zoom:I.k}}function M(I,B){return x?new Promise(F=>{g==null||g.interpolate((B==null?void 0:B.interpolate)==="linear"?bu:Fh).scaleTo(pv(x,B==null?void 0:B.duration,B==null?void 0:B.ease,()=>F(!0)),I)}):Promise.resolve(!1)}function A(I,B){return x?new Promise(F=>{g==null||g.interpolate((B==null?void 0:B.interpolate)==="linear"?bu:Fh).scaleBy(pv(x,B==null?void 0:B.duration,B==null?void 0:B.ease,()=>F(!0)),I)}):Promise.resolve(!1)}function O(I){g==null||g.scaleExtent(I)}function L(I){g==null||g.translateExtent(I)}function P(I){const B=!Cs(I)||I<0?0:I;g==null||g.clickDistance(B)}return{update:S,destroy:N,setViewport:k,setViewportConstrained:C,getViewport:E,scaleTo:M,scaleBy:A,setScaleExtent:O,setTranslateExtent:L,syncViewport:_,setClickDistance:P}}var Yl;(function(e){e.Line="line",e.Handle="handle"})(Yl||(Yl={}));function QQ({width:e,prevWidth:t,height:n,prevHeight:s,affectsX:r,affectsY:o}){const c=e-t,u=n-s,f=[c>0?1:c<0?-1:0,u>0?1:u<0?-1:0];return c&&r&&(f[0]=f[0]*-1),u&&o&&(f[1]=f[1]*-1),f}function iA(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),s=e.includes("left"),r=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:s,affectsY:r}}function wi(e,t){return Math.max(0,t-e)}function Si(e,t){return Math.max(0,e-t)}function mh(e,t,n){return Math.max(0,t-e,e-n)}function aA(e,t){return e?!t:t}function XQ(e,t,n,s,r,o,c,u){let{affectsX:f,affectsY:h}=t;const{isHorizontal:p,isVertical:g}=t,x=p&&g,{xSnapped:v,ySnapped:b}=n,{minWidth:w,maxWidth:S,minHeight:N,maxHeight:C}=s,{x:k,y:_,width:E,height:M,aspectRatio:A}=e;let O=Math.floor(p?v-e.pointerX:0),L=Math.floor(g?b-e.pointerY:0);const P=E+(f?-O:O),I=M+(h?-L:L),B=-o[0]*E,F=-o[1]*M;let z=mh(P,w,S),Y=mh(I,N,C);if(c){let G=0,Z=0;f&&O<0?G=wi(k+O+B,c[0][0]):!f&&O>0&&(G=Si(k+P+B,c[1][0])),h&&L<0?Z=wi(_+L+F,c[0][1]):!h&&L>0&&(Z=Si(_+I+F,c[1][1])),z=Math.max(z,G),Y=Math.max(Y,Z)}if(u){let G=0,Z=0;f&&O>0?G=Si(k+O,u[0][0]):!f&&O<0&&(G=wi(k+P,u[1][0])),h&&L>0?Z=Si(_+L,u[0][1]):!h&&L<0&&(Z=wi(_+I,u[1][1])),z=Math.max(z,G),Y=Math.max(Y,Z)}if(r){if(p){const G=mh(P/A,N,C)*A;if(z=Math.max(z,G),c){let Z=0;!f&&!h||f&&!h&&x?Z=Si(_+F+P/A,c[1][1])*A:Z=wi(_+F+(f?O:-O)/A,c[0][1])*A,z=Math.max(z,Z)}if(u){let Z=0;!f&&!h||f&&!h&&x?Z=wi(_+P/A,u[1][1])*A:Z=Si(_+(f?O:-O)/A,u[0][1])*A,z=Math.max(z,Z)}}if(g){const G=mh(I*A,w,S)/A;if(Y=Math.max(Y,G),c){let Z=0;!f&&!h||h&&!f&&x?Z=Si(k+I*A+B,c[1][0])/A:Z=wi(k+(h?L:-L)*A+B,c[0][0])/A,Y=Math.max(Y,Z)}if(u){let Z=0;!f&&!h||h&&!f&&x?Z=wi(k+I*A,u[1][0])/A:Z=Si(k+(h?L:-L)*A,u[0][0])/A,Y=Math.max(Y,Z)}}}L=L+(L<0?Y:-Y),O=O+(O<0?z:-z),r&&(x?P>I*A?L=(aA(f,h)?-O:O)/A:O=(aA(f,h)?-L:L)*A:p?(L=O/A,h=f):(O=L*A,f=h));const $=f?k+O:k,V=h?_+L:_;return{width:E+(f?-O:O),height:M+(h?-L:L),x:o[0]*O*(f?-1:1)+$,y:o[1]*L*(h?-1:1)+V}}const sD={width:0,height:0,x:0,y:0},ZQ={...sD,pointerX:0,pointerY:0,aspectRatio:1};function JQ(e){return[[0,0],[e.measured.width,e.measured.height]]}function eX(e,t,n){const s=t.position.x+e.position.x,r=t.position.y+e.position.y,o=e.measured.width??0,c=e.measured.height??0,u=n[0]*o,f=n[1]*c;return[[s-u,r-f],[s+o-u,r+c-f]]}function tX({domNode:e,nodeId:t,getStoreItems:n,onChange:s,onEnd:r}){const o=es(e);let c={controlDirection:iA("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function u({controlPosition:h,boundaries:p,keepAspectRatio:g,resizeDirection:x,onResizeStart:v,onResize:b,onResizeEnd:w,shouldResize:S}){let N={...sD},C={...ZQ};c={boundaries:p,resizeDirection:x,keepAspectRatio:g,controlDirection:iA(h)};let k,_=null,E=[],M,A,O,L=!1;const P=pP().on("start",I=>{const{nodeLookup:B,transform:F,snapGrid:z,snapToGrid:Y,nodeOrigin:$,paneDomNode:V}=n();if(k=B.get(t),!k)return;_=(V==null?void 0:V.getBoundingClientRect())??null;const{xSnapped:G,ySnapped:Z}=wu(I.sourceEvent,{transform:F,snapGrid:z,snapToGrid:Y,containerBounds:_});N={width:k.measured.width??0,height:k.measured.height??0,x:k.position.x??0,y:k.position.y??0},C={...N,pointerX:G,pointerY:Z,aspectRatio:N.width/N.height},M=void 0,k.parentId&&(k.extent==="parent"||k.expandParent)&&(M=B.get(k.parentId),A=M&&k.extent==="parent"?JQ(M):void 0),E=[],O=void 0;for(const[J,D]of B)if(D.parentId===t&&(E.push({id:J,position:{...D.position},extent:D.extent}),D.extent==="parent"||D.expandParent)){const U=eX(D,k,D.origin??$);O?O=[[Math.min(U[0][0],O[0][0]),Math.min(U[0][1],O[0][1])],[Math.max(U[1][0],O[1][0]),Math.max(U[1][1],O[1][1])]]:O=U}v==null||v(I,{...N})}).on("drag",I=>{const{transform:B,snapGrid:F,snapToGrid:z,nodeOrigin:Y}=n(),$=wu(I.sourceEvent,{transform:B,snapGrid:F,snapToGrid:z,containerBounds:_}),V=[];if(!k)return;const{x:G,y:Z,width:J,height:D}=N,U={},te=k.origin??Y,{width:H,height:W,x:Q,y:se}=XQ(C,c.controlDirection,$,c.boundaries,c.keepAspectRatio,te,A,O),re=H!==J,ce=W!==D,me=Q!==G&&re,ge=se!==Z&&ce;if(!me&&!ge&&!re&&!ce)return;if((me||ge||te[0]===1||te[1]===1)&&(U.x=me?Q:N.x,U.y=ge?se:N.y,N.x=U.x,N.y=U.y,E.length>0)){const je=Q-G,Oe=se-Z;for(const Ee of E)Ee.position={x:Ee.position.x-je+te[0]*(H-J),y:Ee.position.y-Oe+te[1]*(W-D)},V.push(Ee)}if((re||ce)&&(U.width=re&&(!c.resizeDirection||c.resizeDirection==="horizontal")?H:N.width,U.height=ce&&(!c.resizeDirection||c.resizeDirection==="vertical")?W:N.height,N.width=U.width,N.height=U.height),M&&k.expandParent){const je=te[0]*(U.width??0);U.x&&U.x<je&&(N.x=je,C.x=C.x-(U.x-je));const Oe=te[1]*(U.height??0);U.y&&U.y<Oe&&(N.y=Oe,C.y=C.y-(U.y-Oe))}const ye=QQ({width:N.width,prevWidth:J,height:N.height,prevHeight:D,affectsX:c.controlDirection.affectsX,affectsY:c.controlDirection.affectsY}),xe={...N,direction:ye};(S==null?void 0:S(I,xe))!==!1&&(L=!0,b==null||b(I,xe),s(U,V))}).on("end",I=>{L&&(w==null||w(I,{...N}),r==null||r({...N}),L=!1)});o.call(P)}function f(){o.on(".drag",null)}return{update:u,destroy:f}}const nX={},oA=e=>{let t;const n=new Set,s=(p,g)=>{const x=typeof p=="function"?p(t):p;if(!Object.is(x,t)){const v=t;t=g??(typeof x!="object"||x===null)?x:Object.assign({},t,x),n.forEach(b=>b(t,v))}},r=()=>t,f={setState:s,getState:r,getInitialState:()=>h,subscribe:p=>(n.add(p),()=>n.delete(p)),destroy:()=>{(nX?"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()}},h=t=e(s,r,f);return f},sX=e=>e?oA(e):oA,{useDebugValue:rX}=Ga,{useSyncExternalStoreWithSelector:iX}=tB,aX=e=>e;function rD(e,t=aX,n){const s=iX(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return rX(s),s}const lA=(e,t)=>{const n=sX(e),s=(r,o=t)=>rD(n,r,o);return Object.assign(s,n),s},oX=(e,t)=>e?lA(e,t):lA;function jt(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[s,r]of e)if(!Object.is(r,t.get(s)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const s of e)if(!t.has(s))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const s of n)if(!Object.prototype.hasOwnProperty.call(t,s)||!Object.is(e[s],t[s]))return!1;return!0}const Xp=R.createContext(null),lX=Xp.Provider,iD=Zs.error001();function Je(e,t){const n=R.useContext(Xp);if(n===null)throw new Error(iD);return rD(n,e,t)}function Nt(){const e=R.useContext(Xp);if(e===null)throw new Error(iD);return R.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const cA={display:"none"},cX={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},aD="react-flow__node-desc",oD="react-flow__edge-desc",uX="react-flow__aria-live",dX=e=>e.ariaLiveMessage,fX=e=>e.ariaLabelConfig;function hX({rfId:e}){const t=Je(dX);return a.jsx("div",{id:`${uX}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:cX,children:t})}function pX({rfId:e,disableKeyboardA11y:t}){const n=Je(fX);return a.jsxs(a.Fragment,{children:[a.jsx("div",{id:`${aD}-${e}`,style:cA,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),a.jsx("div",{id:`${oD}-${e}`,style:cA,children:n["edge.a11yDescription.default"]}),!t&&a.jsx(hX,{rfId:e})]})}const pd=R.forwardRef(({position:e="top-left",children:t,className:n,style:s,...r},o)=>{const c=`${e}`.split("-");return a.jsx("div",{className:Bt(["react-flow__panel",n,...c]),style:s,ref:o,...r,children:t})});pd.displayName="Panel";function mX({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:a.jsx(pd,{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:a.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const gX=e=>{const t=[],n=[];for(const[,s]of e.nodeLookup)s.selected&&t.push(s.internals.userNode);for(const[,s]of e.edgeLookup)s.selected&&n.push(s);return{selectedNodes:t,selectedEdges:n}},gh=e=>e.id;function xX(e,t){return jt(e.selectedNodes.map(gh),t.selectedNodes.map(gh))&&jt(e.selectedEdges.map(gh),t.selectedEdges.map(gh))}function vX({onSelectionChange:e}){const t=Nt(),{selectedNodes:n,selectedEdges:s}=Je(gX,xX);return R.useEffect(()=>{const r={nodes:n,edges:s};e==null||e(r),t.getState().onSelectionChangeHandlers.forEach(o=>o(r))},[n,s,e]),null}const yX=e=>!!e.onSelectionChangeHandlers;function bX({onSelectionChange:e}){const t=Je(yX);return e||t?a.jsx(vX,{onSelectionChange:e}):null}const QS=typeof window<"u"?R.useLayoutEffect:R.useEffect,lD=[0,0],wX={x:0,y:0,zoom:1},SX=["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"],uA=[...SX,"rfId"],jX=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}),dA={translateExtent:zu,nodeOrigin:lD,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function NX(e){const{setNodes:t,setEdges:n,setMinZoom:s,setMaxZoom:r,setTranslateExtent:o,setNodeExtent:c,reset:u,setDefaultNodesAndEdges:f}=Je(jX,jt),h=Nt();QS(()=>(f(e.defaultNodes,e.defaultEdges),()=>{p.current=dA,u()}),[]);const p=R.useRef(dA);return QS(()=>{for(const g of uA){const x=e[g],v=p.current[g];x!==v&&(typeof e[g]>"u"||(g==="nodes"?t(x):g==="edges"?n(x):g==="minZoom"?s(x):g==="maxZoom"?r(x):g==="translateExtent"?o(x):g==="nodeExtent"?c(x):g==="ariaLabelConfig"?h.setState({ariaLabelConfig:hQ(x)}):g==="fitView"?h.setState({fitViewQueued:x}):g==="fitViewOptions"?h.setState({fitViewOptions:x}):h.setState({[g]:x})))}p.current=e},uA.map(g=>e[g])),null}function fA(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function _X(e){var s;const[t,n]=R.useState(e==="system"?null:e);return R.useEffect(()=>{if(e!=="system"){n(e);return}const r=fA(),o=()=>n(r!=null&&r.matches?"dark":"light");return o(),r==null||r.addEventListener("change",o),()=>{r==null||r.removeEventListener("change",o)}},[e]),t!==null?t:(s=fA())!=null&&s.matches?"dark":"light"}const hA=typeof document<"u"?document:null;function Uu(e=null,t={target:hA,actInsideInputWithModifier:!0}){const[n,s]=R.useState(!1),r=R.useRef(!1),o=R.useRef(new Set([])),[c,u]=R.useMemo(()=>{if(e!==null){const h=(Array.isArray(e)?e:[e]).filter(g=>typeof g=="string").map(g=>g.replace("+",`
327
+ `).replace(`
328
+
329
+ `,`
330
+ +`).split(`
331
+ `)),p=h.reduce((g,x)=>g.concat(...x),[]);return[h,p]}return[[],[]]},[e]);return R.useEffect(()=>{const f=(t==null?void 0:t.target)??hA,h=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const p=v=>{var S,N;if(r.current=v.ctrlKey||v.metaKey||v.shiftKey||v.altKey,(!r.current||r.current&&!h)&&FP(v))return!1;const w=mA(v.code,u);if(o.current.add(v[w]),pA(c,o.current,!1)){const C=((N=(S=v.composedPath)==null?void 0:S.call(v))==null?void 0:N[0])||v.target,k=(C==null?void 0:C.nodeName)==="BUTTON"||(C==null?void 0:C.nodeName)==="A";t.preventDefault!==!1&&(r.current||!k)&&v.preventDefault(),s(!0)}},g=v=>{const b=mA(v.code,u);pA(c,o.current,!0)?(s(!1),o.current.clear()):o.current.delete(v[b]),v.key==="Meta"&&o.current.clear(),r.current=!1},x=()=>{o.current.clear(),s(!1)};return f==null||f.addEventListener("keydown",p),f==null||f.addEventListener("keyup",g),window.addEventListener("blur",x),window.addEventListener("contextmenu",x),()=>{f==null||f.removeEventListener("keydown",p),f==null||f.removeEventListener("keyup",g),window.removeEventListener("blur",x),window.removeEventListener("contextmenu",x)}}},[e,s]),n}function pA(e,t,n){return e.filter(s=>n||s.length===t.size).some(s=>s.every(r=>t.has(r)))}function mA(e,t){return t.includes(e)?"code":"key"}const CX=()=>{const e=Nt();return R.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:s}=e.getState();return s?s.scaleTo(t,n):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[s,r,o],panZoom:c}=e.getState();return c?(await c.setViewport({x:t.x??s,y:t.y??r,zoom:t.zoom??o},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,s]=e.getState().transform;return{x:t,y:n,zoom:s}},setCenter:async(t,n,s)=>e.getState().setCenter(t,n,s),fitBounds:async(t,n)=>{const{width:s,height:r,minZoom:o,maxZoom:c,panZoom:u}=e.getState(),f=dN(t,s,r,o,c,(n==null?void 0:n.padding)??.1);return u?(await u.setViewport(f,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:s,snapGrid:r,snapToGrid:o,domNode:c}=e.getState();if(!c)return t;const{x:u,y:f}=c.getBoundingClientRect(),h={x:t.x-u,y:t.y-f},p=n.snapGrid??r,g=n.snapToGrid??o;return hd(h,s,g,p)},flowToScreenPosition:t=>{const{transform:n,domNode:s}=e.getState();if(!s)return t;const{x:r,y:o}=s.getBoundingClientRect(),c=gp(t,n);return{x:c.x+r,y:c.y+o}}}),[])};function cD(e,t){const n=[],s=new Map,r=[];for(const o of e)if(o.type==="add"){r.push(o);continue}else if(o.type==="remove"||o.type==="replace")s.set(o.id,[o]);else{const c=s.get(o.id);c?c.push(o):s.set(o.id,[o])}for(const o of t){const c=s.get(o.id);if(!c){n.push(o);continue}if(c[0].type==="remove")continue;if(c[0].type==="replace"){n.push({...c[0].item});continue}const u={...o};for(const f of c)kX(f,u);n.push(u)}return r.length&&r.forEach(o=>{o.index!==void 0?n.splice(o.index,0,{...o.item}):n.push({...o.item})}),n}function kX(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function RX(e,t){return cD(e,t)}function EX(e,t){return cD(e,t)}function ja(e,t){return{id:e,type:"select",selected:t}}function gl(e,t=new Set,n=!1){const s=[];for(const[r,o]of e){const c=t.has(r);!(o.selected===void 0&&!c)&&o.selected!==c&&(n&&(o.selected=c),s.push(ja(o.id,c)))}return s}function gA({items:e=[],lookup:t}){var r;const n=[],s=new Map(e.map(o=>[o.id,o]));for(const[o,c]of e.entries()){const u=t.get(c.id),f=((r=u==null?void 0:u.internals)==null?void 0:r.userNode)??u;f!==void 0&&f!==c&&n.push({id:c.id,item:c,type:"replace"}),f===void 0&&n.push({item:c,type:"add",index:o})}for(const[o]of t)s.get(o)===void 0&&n.push({id:o,type:"remove"});return n}function xA(e){return{id:e.id,type:"remove"}}const vA=e=>sQ(e),AX=e=>OP(e);function uD(e){return R.forwardRef(e)}function yA(e){const[t,n]=R.useState(BigInt(0)),[s]=R.useState(()=>TX(()=>n(r=>r+BigInt(1))));return QS(()=>{const r=s.get();r.length&&(e(r),s.reset())},[t]),s}function TX(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const dD=R.createContext(null);function MX({children:e}){const t=Nt(),n=R.useCallback(u=>{const{nodes:f=[],setNodes:h,hasDefaultNodes:p,onNodesChange:g,nodeLookup:x,fitViewQueued:v,onNodesChangeMiddlewareMap:b}=t.getState();let w=f;for(const N of u)w=typeof N=="function"?N(w):N;let S=gA({items:w,lookup:x});for(const N of b.values())S=N(S);p&&h(w),S.length>0?g==null||g(S):v&&window.requestAnimationFrame(()=>{const{fitViewQueued:N,nodes:C,setNodes:k}=t.getState();N&&k(C)})},[]),s=yA(n),r=R.useCallback(u=>{const{edges:f=[],setEdges:h,hasDefaultEdges:p,onEdgesChange:g,edgeLookup:x}=t.getState();let v=f;for(const b of u)v=typeof b=="function"?b(v):b;p?h(v):g&&g(gA({items:v,lookup:x}))},[]),o=yA(r),c=R.useMemo(()=>({nodeQueue:s,edgeQueue:o}),[]);return a.jsx(dD.Provider,{value:c,children:e})}function IX(){const e=R.useContext(dD);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const OX=e=>!!e.panZoom;function Zp(){const e=CX(),t=Nt(),n=IX(),s=Je(OX),r=R.useMemo(()=>{const o=g=>t.getState().nodeLookup.get(g),c=g=>{n.nodeQueue.push(g)},u=g=>{n.edgeQueue.push(g)},f=g=>{var N,C;const{nodeLookup:x,nodeOrigin:v}=t.getState(),b=vA(g)?g:x.get(g.id),w=b.parentId?zP(b.position,b.measured,b.parentId,x,v):b.position,S={...b,position:w,width:((N=b.measured)==null?void 0:N.width)??b.width,height:((C=b.measured)==null?void 0:C.height)??b.height};return Gl(S)},h=(g,x,v={replace:!1})=>{c(b=>b.map(w=>{if(w.id===g){const S=typeof x=="function"?x(w):x;return v.replace&&vA(S)?S:{...w,...S}}return w}))},p=(g,x,v={replace:!1})=>{u(b=>b.map(w=>{if(w.id===g){const S=typeof x=="function"?x(w):x;return v.replace&&AX(S)?S:{...w,...S}}return w}))};return{getNodes:()=>t.getState().nodes.map(g=>({...g})),getNode:g=>{var x;return(x=o(g))==null?void 0:x.internals.userNode},getInternalNode:o,getEdges:()=>{const{edges:g=[]}=t.getState();return g.map(x=>({...x}))},getEdge:g=>t.getState().edgeLookup.get(g),setNodes:c,setEdges:u,addNodes:g=>{const x=Array.isArray(g)?g:[g];n.nodeQueue.push(v=>[...v,...x])},addEdges:g=>{const x=Array.isArray(g)?g:[g];n.edgeQueue.push(v=>[...v,...x])},toObject:()=>{const{nodes:g=[],edges:x=[],transform:v}=t.getState(),[b,w,S]=v;return{nodes:g.map(N=>({...N})),edges:x.map(N=>({...N})),viewport:{x:b,y:w,zoom:S}}},deleteElements:async({nodes:g=[],edges:x=[]})=>{const{nodes:v,edges:b,onNodesDelete:w,onEdgesDelete:S,triggerNodeChanges:N,triggerEdgeChanges:C,onDelete:k,onBeforeDelete:_}=t.getState(),{nodes:E,edges:M}=await lQ({nodesToRemove:g,edgesToRemove:x,nodes:v,edges:b,onBeforeDelete:_}),A=M.length>0,O=E.length>0;if(A){const L=M.map(xA);S==null||S(M),C(L)}if(O){const L=E.map(xA);w==null||w(E),N(L)}return(O||A)&&(k==null||k({nodes:E,edges:M})),{deletedNodes:E,deletedEdges:M}},getIntersectingNodes:(g,x=!0,v)=>{const b=YE(g),w=b?g:f(g),S=v!==void 0;return w?(v||t.getState().nodes).filter(N=>{const C=t.getState().nodeLookup.get(N.id);if(C&&!b&&(N.id===g.id||!C.internals.positionAbsolute))return!1;const k=Gl(S?N:C),_=Fu(k,w);return x&&_>0||_>=k.width*k.height||_>=w.width*w.height}):[]},isNodeIntersecting:(g,x,v=!0)=>{const w=YE(g)?g:f(g);if(!w)return!1;const S=Fu(w,x);return v&&S>0||S>=x.width*x.height||S>=w.width*w.height},updateNode:h,updateNodeData:(g,x,v={replace:!1})=>{h(g,b=>{const w=typeof x=="function"?x(b):x;return v.replace?{...b,data:w}:{...b,data:{...b.data,...w}}},v)},updateEdge:p,updateEdgeData:(g,x,v={replace:!1})=>{p(g,b=>{const w=typeof x=="function"?x(b):x;return v.replace?{...b,data:w}:{...b,data:{...b.data,...w}}},v)},getNodesBounds:g=>{const{nodeLookup:x,nodeOrigin:v}=t.getState();return rQ(g,{nodeLookup:x,nodeOrigin:v})},getHandleConnections:({type:g,id:x,nodeId:v})=>{var b;return Array.from(((b=t.getState().connectionLookup.get(`${v}-${g}${x?`-${x}`:""}`))==null?void 0:b.values())??[])},getNodeConnections:({type:g,handleId:x,nodeId:v})=>{var b;return Array.from(((b=t.getState().connectionLookup.get(`${v}${g?x?`-${g}-${x}`:`-${g}`:""}`))==null?void 0:b.values())??[])},fitView:async g=>{const x=t.getState().fitViewResolver??fQ();return t.setState({fitViewQueued:!0,fitViewOptions:g,fitViewResolver:x}),n.nodeQueue.push(v=>[...v]),x.promise}}},[]);return R.useMemo(()=>({...r,...e,viewportInitialized:s}),[s])}const bA=e=>e.selected,LX=typeof window<"u"?window:void 0;function PX({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=Nt(),{deleteElements:s}=Zp(),r=Uu(e,{actInsideInputWithModifier:!1}),o=Uu(t,{target:LX});R.useEffect(()=>{if(r){const{edges:c,nodes:u}=n.getState();s({nodes:u.filter(bA),edges:c.filter(bA)}),n.setState({nodesSelectionActive:!1})}},[r]),R.useEffect(()=>{n.setState({multiSelectionActive:o})},[o])}function DX(e){const t=Nt();R.useEffect(()=>{const n=()=>{var r,o,c,u;if(!e.current||!(((o=(r=e.current).checkVisibility)==null?void 0:o.call(r))??!0))return!1;const s=fN(e.current);(s.height===0||s.width===0)&&((u=(c=t.getState()).onError)==null||u.call(c,"004",Zs.error004())),t.setState({width:s.width||500,height:s.height||500})};if(e.current){n(),window.addEventListener("resize",n);const s=new ResizeObserver(()=>n());return s.observe(e.current),()=>{window.removeEventListener("resize",n),s&&e.current&&s.unobserve(e.current)}}},[])}const Jp={position:"absolute",width:"100%",height:"100%",top:0,left:0},qX=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function $X({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:s=!1,panOnScrollSpeed:r=.5,panOnScrollMode:o=Ua.Free,zoomOnDoubleClick:c=!0,panOnDrag:u=!0,defaultViewport:f,translateExtent:h,minZoom:p,maxZoom:g,zoomActivationKeyCode:x,preventScrolling:v=!0,children:b,noWheelClassName:w,noPanClassName:S,onViewportChange:N,isControlledViewport:C,paneClickDistance:k,selectionOnDrag:_}){const E=Nt(),M=R.useRef(null),{userSelectionActive:A,lib:O,connectionInProgress:L}=Je(qX,jt),P=Uu(x),I=R.useRef();DX(M);const B=R.useCallback(F=>{N==null||N({x:F[0],y:F[1],zoom:F[2]}),C||E.setState({transform:F})},[N,C]);return R.useEffect(()=>{if(M.current){I.current=WQ({domNode:M.current,minZoom:p,maxZoom:g,translateExtent:h,viewport:f,onDraggingChange:$=>E.setState(V=>V.paneDragging===$?V:{paneDragging:$}),onPanZoomStart:($,V)=>{const{onViewportChangeStart:G,onMoveStart:Z}=E.getState();Z==null||Z($,V),G==null||G(V)},onPanZoom:($,V)=>{const{onViewportChange:G,onMove:Z}=E.getState();Z==null||Z($,V),G==null||G(V)},onPanZoomEnd:($,V)=>{const{onViewportChangeEnd:G,onMoveEnd:Z}=E.getState();Z==null||Z($,V),G==null||G(V)}});const{x:F,y:z,zoom:Y}=I.current.getViewport();return E.setState({panZoom:I.current,transform:[F,z,Y],domNode:M.current.closest(".react-flow")}),()=>{var $;($=I.current)==null||$.destroy()}}},[]),R.useEffect(()=>{var F;(F=I.current)==null||F.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:s,panOnScrollSpeed:r,panOnScrollMode:o,zoomOnDoubleClick:c,panOnDrag:u,zoomActivationKeyPressed:P,preventScrolling:v,noPanClassName:S,userSelectionActive:A,noWheelClassName:w,lib:O,onTransformChange:B,connectionInProgress:L,selectionOnDrag:_,paneClickDistance:k})},[e,t,n,s,r,o,c,u,P,v,S,A,w,O,B,L,_,k]),a.jsx("div",{className:"react-flow__renderer",ref:M,style:Jp,children:b})}const zX=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function BX(){const{userSelectionActive:e,userSelectionRect:t}=Je(zX,jt);return e&&t?a.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const mv=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},FX=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function HX({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Bu.Full,panOnDrag:s,paneClickDistance:r,selectionOnDrag:o,onSelectionStart:c,onSelectionEnd:u,onPaneClick:f,onPaneContextMenu:h,onPaneScroll:p,onPaneMouseEnter:g,onPaneMouseMove:x,onPaneMouseLeave:v,children:b}){const w=Nt(),{userSelectionActive:S,elementsSelectable:N,dragging:C,connectionInProgress:k}=Je(FX,jt),_=N&&(e||S),E=R.useRef(null),M=R.useRef(),A=R.useRef(new Set),O=R.useRef(new Set),L=R.useRef(!1),P=G=>{if(L.current||k){L.current=!1;return}f==null||f(G),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},I=G=>{if(Array.isArray(s)&&(s!=null&&s.includes(2))){G.preventDefault();return}h==null||h(G)},B=p?G=>p(G):void 0,F=G=>{L.current&&(G.stopPropagation(),L.current=!1)},z=G=>{var W,Q;const{domNode:Z}=w.getState();if(M.current=Z==null?void 0:Z.getBoundingClientRect(),!M.current)return;const J=G.target===E.current;if(!J&&!!G.target.closest(".nokey")||!e||!(o&&J||t)||G.button!==0||!G.isPrimary)return;(Q=(W=G.target)==null?void 0:W.setPointerCapture)==null||Q.call(W,G.pointerId),L.current=!1;const{x:te,y:H}=ks(G.nativeEvent,M.current);w.setState({userSelectionRect:{width:0,height:0,startX:te,startY:H,x:te,y:H}}),J||(G.stopPropagation(),G.preventDefault())},Y=G=>{const{userSelectionRect:Z,transform:J,nodeLookup:D,edgeLookup:U,connectionLookup:te,triggerNodeChanges:H,triggerEdgeChanges:W,defaultEdgeOptions:Q,resetSelectedElements:se}=w.getState();if(!M.current||!Z)return;const{x:re,y:ce}=ks(G.nativeEvent,M.current),{startX:me,startY:ge}=Z;if(!L.current){const Oe=t?0:r;if(Math.hypot(re-me,ce-ge)<=Oe)return;se(),c==null||c(G)}L.current=!0;const ye={startX:me,startY:ge,x:re<me?re:me,y:ce<ge?ce:ge,width:Math.abs(re-me),height:Math.abs(ce-ge)},xe=A.current,Se=O.current;A.current=new Set(uN(D,ye,J,n===Bu.Partial,!0).map(Oe=>Oe.id)),O.current=new Set;const je=(Q==null?void 0:Q.selectable)??!0;for(const Oe of A.current){const Ee=te.get(Oe);if(Ee)for(const{edgeId:mt}of Ee.values()){const yt=U.get(mt);yt&&(yt.selectable??je)&&O.current.add(mt)}}if(!WE(xe,A.current)){const Oe=gl(D,A.current,!0);H(Oe)}if(!WE(Se,O.current)){const Oe=gl(U,O.current);W(Oe)}w.setState({userSelectionRect:ye,userSelectionActive:!0,nodesSelectionActive:!1})},$=G=>{var Z,J;G.button===0&&((J=(Z=G.target)==null?void 0:Z.releasePointerCapture)==null||J.call(Z,G.pointerId),!S&&G.target===E.current&&w.getState().userSelectionRect&&(P==null||P(G)),w.setState({userSelectionActive:!1,userSelectionRect:null}),L.current&&(u==null||u(G),w.setState({nodesSelectionActive:A.current.size>0})))},V=s===!0||Array.isArray(s)&&s.includes(0);return a.jsxs("div",{className:Bt(["react-flow__pane",{draggable:V,dragging:C,selection:e}]),onClick:_?void 0:mv(P,E),onContextMenu:mv(I,E),onWheel:mv(B,E),onPointerEnter:_?void 0:g,onPointerMove:_?Y:x,onPointerUp:_?$:void 0,onPointerDownCapture:_?z:void 0,onClickCapture:_?F:void 0,onPointerLeave:v,ref:E,style:Jp,children:[b,a.jsx(BX,{})]})}function XS({id:e,store:t,unselect:n=!1,nodeRef:s}){const{addSelectedNodes:r,unselectNodesAndEdges:o,multiSelectionActive:c,nodeLookup:u,onError:f}=t.getState(),h=u.get(e);if(!h){f==null||f("012",Zs.error012(e));return}t.setState({nodesSelectionActive:!1}),h.selected?(n||h.selected&&c)&&(o({nodes:[h],edges:[]}),requestAnimationFrame(()=>{var p;return(p=s==null?void 0:s.current)==null?void 0:p.blur()})):r([e])}function fD({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:s,nodeId:r,isSelectable:o,nodeClickDistance:c}){const u=Nt(),[f,h]=R.useState(!1),p=R.useRef();return R.useEffect(()=>{p.current=LQ({getStoreItems:()=>u.getState(),onNodeMouseDown:g=>{XS({id:g,store:u,nodeRef:e})},onDragStart:()=>{h(!0)},onDragStop:()=>{h(!1)}})},[]),R.useEffect(()=>{if(!(t||!e.current||!p.current))return p.current.update({noDragClassName:n,handleSelector:s,domNode:e.current,isSelectable:o,nodeId:r,nodeClickDistance:c}),()=>{var g;(g=p.current)==null||g.destroy()}},[n,s,t,o,e,r,c]),f}const UX=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function hD(){const e=Nt();return R.useCallback(n=>{const{nodeExtent:s,snapToGrid:r,snapGrid:o,nodesDraggable:c,onError:u,updateNodePositions:f,nodeLookup:h,nodeOrigin:p}=e.getState(),g=new Map,x=UX(c),v=r?o[0]:5,b=r?o[1]:5,w=n.direction.x*v*n.factor,S=n.direction.y*b*n.factor;for(const[,N]of h){if(!x(N))continue;let C={x:N.internals.positionAbsolute.x+w,y:N.internals.positionAbsolute.y+S};r&&(C=fd(C,o));const{position:k,positionAbsolute:_}=LP({nodeId:N.id,nextPosition:C,nodeLookup:h,nodeExtent:s,nodeOrigin:p,onError:u});N.position=k,N.internals.positionAbsolute=_,g.set(N.id,N)}f(g)},[])}const yN=R.createContext(null),VX=yN.Provider;yN.Consumer;const pD=()=>R.useContext(yN),GX=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),KX=(e,t,n)=>s=>{const{connectionClickStartHandle:r,connectionMode:o,connection:c}=s,{fromHandle:u,toHandle:f,isValid:h}=c,p=(f==null?void 0:f.nodeId)===e&&(f==null?void 0:f.id)===t&&(f==null?void 0:f.type)===n;return{connectingFrom:(u==null?void 0:u.nodeId)===e&&(u==null?void 0:u.id)===t&&(u==null?void 0:u.type)===n,connectingTo:p,clickConnecting:(r==null?void 0:r.nodeId)===e&&(r==null?void 0:r.id)===t&&(r==null?void 0:r.type)===n,isPossibleEndHandle:o===Hl.Strict?(u==null?void 0:u.type)!==n:e!==(u==null?void 0:u.nodeId)||t!==(u==null?void 0:u.id),connectionInProcess:!!u,clickConnectionInProcess:!!r,valid:p&&h}};function YX({type:e="source",position:t=ve.Top,isValidConnection:n,isConnectable:s=!0,isConnectableStart:r=!0,isConnectableEnd:o=!0,id:c,onConnect:u,children:f,className:h,onMouseDown:p,onTouchStart:g,...x},v){var Y,$;const b=c||null,w=e==="target",S=Nt(),N=pD(),{connectOnClick:C,noPanClassName:k,rfId:_}=Je(GX,jt),{connectingFrom:E,connectingTo:M,clickConnecting:A,isPossibleEndHandle:O,connectionInProcess:L,clickConnectionInProcess:P,valid:I}=Je(KX(N,b,e),jt);N||($=(Y=S.getState()).onError)==null||$.call(Y,"010",Zs.error010());const B=V=>{const{defaultEdgeOptions:G,onConnect:Z,hasDefaultEdges:J}=S.getState(),D={...G,...V};if(J){const{edges:U,setEdges:te}=S.getState();te(yQ(D,U))}Z==null||Z(D),u==null||u(D)},F=V=>{if(!N)return;const G=HP(V.nativeEvent);if(r&&(G&&V.button===0||!G)){const Z=S.getState();WS.onPointerDown(V.nativeEvent,{handleDomNode:V.currentTarget,autoPanOnConnect:Z.autoPanOnConnect,connectionMode:Z.connectionMode,connectionRadius:Z.connectionRadius,domNode:Z.domNode,nodeLookup:Z.nodeLookup,lib:Z.lib,isTarget:w,handleId:b,nodeId:N,flowId:Z.rfId,panBy:Z.panBy,cancelConnection:Z.cancelConnection,onConnectStart:Z.onConnectStart,onConnectEnd:(...J)=>{var D,U;return(U=(D=S.getState()).onConnectEnd)==null?void 0:U.call(D,...J)},updateConnection:Z.updateConnection,onConnect:B,isValidConnection:n||((...J)=>{var D,U;return((U=(D=S.getState()).isValidConnection)==null?void 0:U.call(D,...J))??!0}),getTransform:()=>S.getState().transform,getFromHandle:()=>S.getState().connection.fromHandle,autoPanSpeed:Z.autoPanSpeed,dragThreshold:Z.connectionDragThreshold})}G?p==null||p(V):g==null||g(V)},z=V=>{const{onClickConnectStart:G,onClickConnectEnd:Z,connectionClickStartHandle:J,connectionMode:D,isValidConnection:U,lib:te,rfId:H,nodeLookup:W,connection:Q}=S.getState();if(!N||!J&&!r)return;if(!J){G==null||G(V.nativeEvent,{nodeId:N,handleId:b,handleType:e}),S.setState({connectionClickStartHandle:{nodeId:N,type:e,id:b}});return}const se=BP(V.target),re=n||U,{connection:ce,isValid:me}=WS.isValid(V.nativeEvent,{handle:{nodeId:N,id:b,type:e},connectionMode:D,fromNodeId:J.nodeId,fromHandleId:J.id||null,fromType:J.type,isValidConnection:re,flowId:H,doc:se,lib:te,nodeLookup:W});me&&ce&&B(ce);const ge=structuredClone(Q);delete ge.inProgress,ge.toPosition=ge.toHandle?ge.toHandle.position:null,Z==null||Z(V,ge),S.setState({connectionClickStartHandle:null})};return a.jsx("div",{"data-handleid":b,"data-nodeid":N,"data-handlepos":t,"data-id":`${_}-${N}-${b}-${e}`,className:Bt(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",k,h,{source:!w,target:w,connectable:s,connectablestart:r,connectableend:o,clickconnecting:A,connectingfrom:E,connectingto:M,valid:I,connectionindicator:s&&(!L||O)&&(L||P?o:r)}]),onMouseDown:F,onTouchStart:F,onClick:C?z:void 0,ref:v,...x,children:f})}const gn=R.memo(uD(YX));function WX({data:e,isConnectable:t,sourcePosition:n=ve.Bottom}){return a.jsxs(a.Fragment,{children:[e==null?void 0:e.label,a.jsx(gn,{type:"source",position:n,isConnectable:t})]})}function QX({data:e,isConnectable:t,targetPosition:n=ve.Top,sourcePosition:s=ve.Bottom}){return a.jsxs(a.Fragment,{children:[a.jsx(gn,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,a.jsx(gn,{type:"source",position:s,isConnectable:t})]})}function XX(){return null}function ZX({data:e,isConnectable:t,targetPosition:n=ve.Top}){return a.jsxs(a.Fragment,{children:[a.jsx(gn,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const xp={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},wA={input:WX,default:QX,output:ZX,group:XX};function JX(e){var t,n,s,r;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((s=e.style)==null?void 0:s.width),height:e.height??((r=e.style)==null?void 0:r.height)}}const eZ=e=>{const{width:t,height:n,x:s,y:r}=dd(e.nodeLookup,{filter:o=>!!o.selected});return{width:Cs(t)?t:null,height:Cs(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${s}px,${r}px)`}};function tZ({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const s=Nt(),{width:r,height:o,transformString:c,userSelectionActive:u}=Je(eZ,jt),f=hD(),h=R.useRef(null);R.useEffect(()=>{var v;n||(v=h.current)==null||v.focus({preventScroll:!0})},[n]);const p=!u&&r!==null&&o!==null;if(fD({nodeRef:h,disabled:!p}),!p)return null;const g=e?v=>{const b=s.getState().nodes.filter(w=>w.selected);e(v,b)}:void 0,x=v=>{Object.prototype.hasOwnProperty.call(xp,v.key)&&(v.preventDefault(),f({direction:xp[v.key],factor:v.shiftKey?4:1}))};return a.jsx("div",{className:Bt(["react-flow__nodesselection","react-flow__container",t]),style:{transform:c},children:a.jsx("div",{ref:h,className:"react-flow__nodesselection-rect",onContextMenu:g,tabIndex:n?void 0:-1,onKeyDown:n?void 0:x,style:{width:r,height:o}})})}const SA=typeof window<"u"?window:void 0,nZ=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function mD({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:r,onPaneContextMenu:o,onPaneScroll:c,paneClickDistance:u,deleteKeyCode:f,selectionKeyCode:h,selectionOnDrag:p,selectionMode:g,onSelectionStart:x,onSelectionEnd:v,multiSelectionKeyCode:b,panActivationKeyCode:w,zoomActivationKeyCode:S,elementsSelectable:N,zoomOnScroll:C,zoomOnPinch:k,panOnScroll:_,panOnScrollSpeed:E,panOnScrollMode:M,zoomOnDoubleClick:A,panOnDrag:O,defaultViewport:L,translateExtent:P,minZoom:I,maxZoom:B,preventScrolling:F,onSelectionContextMenu:z,noWheelClassName:Y,noPanClassName:$,disableKeyboardA11y:V,onViewportChange:G,isControlledViewport:Z}){const{nodesSelectionActive:J,userSelectionActive:D}=Je(nZ,jt),U=Uu(h,{target:SA}),te=Uu(w,{target:SA}),H=te||O,W=te||_,Q=p&&H!==!0,se=U||D||Q;return PX({deleteKeyCode:f,multiSelectionKeyCode:b}),a.jsx($X,{onPaneContextMenu:o,elementsSelectable:N,zoomOnScroll:C,zoomOnPinch:k,panOnScroll:W,panOnScrollSpeed:E,panOnScrollMode:M,zoomOnDoubleClick:A,panOnDrag:!U&&H,defaultViewport:L,translateExtent:P,minZoom:I,maxZoom:B,zoomActivationKeyCode:S,preventScrolling:F,noWheelClassName:Y,noPanClassName:$,onViewportChange:G,isControlledViewport:Z,paneClickDistance:u,selectionOnDrag:Q,children:a.jsxs(HX,{onSelectionStart:x,onSelectionEnd:v,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:r,onPaneContextMenu:o,onPaneScroll:c,panOnDrag:H,isSelecting:!!se,selectionMode:g,selectionKeyPressed:U,paneClickDistance:u,selectionOnDrag:Q,children:[e,J&&a.jsx(tZ,{onSelectionContextMenu:z,noPanClassName:$,disableKeyboardA11y:V})]})})}mD.displayName="FlowRenderer";const sZ=R.memo(mD),rZ=e=>t=>e?uN(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function iZ(e){return Je(R.useCallback(rZ(e),[e]),jt)}const aZ=e=>e.updateNodeInternals;function oZ(){const e=Je(aZ),[t]=R.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const s=new Map;n.forEach(r=>{const o=r.target.getAttribute("data-id");s.set(o,{id:o,nodeElement:r.target,force:!0})}),e(s)}));return R.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function lZ({node:e,nodeType:t,hasDimensions:n,resizeObserver:s}){const r=Nt(),o=R.useRef(null),c=R.useRef(null),u=R.useRef(e.sourcePosition),f=R.useRef(e.targetPosition),h=R.useRef(t),p=n&&!!e.internals.handleBounds;return R.useEffect(()=>{o.current&&!e.hidden&&(!p||c.current!==o.current)&&(c.current&&(s==null||s.unobserve(c.current)),s==null||s.observe(o.current),c.current=o.current)},[p,e.hidden]),R.useEffect(()=>()=>{c.current&&(s==null||s.unobserve(c.current),c.current=null)},[]),R.useEffect(()=>{if(o.current){const g=h.current!==t,x=u.current!==e.sourcePosition,v=f.current!==e.targetPosition;(g||x||v)&&(h.current=t,u.current=e.sourcePosition,f.current=e.targetPosition,r.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:o.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),o}function cZ({id:e,onClick:t,onMouseEnter:n,onMouseMove:s,onMouseLeave:r,onContextMenu:o,onDoubleClick:c,nodesDraggable:u,elementsSelectable:f,nodesConnectable:h,nodesFocusable:p,resizeObserver:g,noDragClassName:x,noPanClassName:v,disableKeyboardA11y:b,rfId:w,nodeTypes:S,nodeClickDistance:N,onError:C}){const{node:k,internals:_,isParent:E}=Je(re=>{const ce=re.nodeLookup.get(e),me=re.parentLookup.has(e);return{node:ce,internals:ce.internals,isParent:me}},jt);let M=k.type||"default",A=(S==null?void 0:S[M])||wA[M];A===void 0&&(C==null||C("003",Zs.error003(M)),M="default",A=(S==null?void 0:S.default)||wA.default);const O=!!(k.draggable||u&&typeof k.draggable>"u"),L=!!(k.selectable||f&&typeof k.selectable>"u"),P=!!(k.connectable||h&&typeof k.connectable>"u"),I=!!(k.focusable||p&&typeof k.focusable>"u"),B=Nt(),F=$P(k),z=lZ({node:k,nodeType:M,hasDimensions:F,resizeObserver:g}),Y=fD({nodeRef:z,disabled:k.hidden||!O,noDragClassName:x,handleSelector:k.dragHandle,nodeId:e,isSelectable:L,nodeClickDistance:N}),$=hD();if(k.hidden)return null;const V=$r(k),G=JX(k),Z=L||O||t||n||s||r,J=n?re=>n(re,{..._.userNode}):void 0,D=s?re=>s(re,{..._.userNode}):void 0,U=r?re=>r(re,{..._.userNode}):void 0,te=o?re=>o(re,{..._.userNode}):void 0,H=c?re=>c(re,{..._.userNode}):void 0,W=re=>{const{selectNodesOnDrag:ce,nodeDragThreshold:me}=B.getState();L&&(!ce||!O||me>0)&&XS({id:e,store:B,nodeRef:z}),t&&t(re,{..._.userNode})},Q=re=>{if(!(FP(re.nativeEvent)||b)){if(AP.includes(re.key)&&L){const ce=re.key==="Escape";XS({id:e,store:B,unselect:ce,nodeRef:z})}else if(O&&k.selected&&Object.prototype.hasOwnProperty.call(xp,re.key)){re.preventDefault();const{ariaLabelConfig:ce}=B.getState();B.setState({ariaLiveMessage:ce["node.a11yDescription.ariaLiveMessage"]({direction:re.key.replace("Arrow","").toLowerCase(),x:~~_.positionAbsolute.x,y:~~_.positionAbsolute.y})}),$({direction:xp[re.key],factor:re.shiftKey?4:1})}}},se=()=>{var Se;if(b||!((Se=z.current)!=null&&Se.matches(":focus-visible")))return;const{transform:re,width:ce,height:me,autoPanOnNodeFocus:ge,setCenter:ye}=B.getState();if(!ge)return;uN(new Map([[e,k]]),{x:0,y:0,width:ce,height:me},re,!0).length>0||ye(k.position.x+V.width/2,k.position.y+V.height/2,{zoom:re[2]})};return a.jsx("div",{className:Bt(["react-flow__node",`react-flow__node-${M}`,{[v]:O},k.className,{selected:k.selected,selectable:L,parent:E,draggable:O,dragging:Y}]),ref:z,style:{zIndex:_.z,transform:`translate(${_.positionAbsolute.x}px,${_.positionAbsolute.y}px)`,pointerEvents:Z?"all":"none",visibility:F?"visible":"hidden",...k.style,...G},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:J,onMouseMove:D,onMouseLeave:U,onContextMenu:te,onClick:W,onDoubleClick:H,onKeyDown:I?Q:void 0,tabIndex:I?0:void 0,onFocus:I?se:void 0,role:k.ariaRole??(I?"group":void 0),"aria-roledescription":"node","aria-describedby":b?void 0:`${aD}-${w}`,"aria-label":k.ariaLabel,...k.domAttributes,children:a.jsx(VX,{value:e,children:a.jsx(A,{id:e,data:k.data,type:M,positionAbsoluteX:_.positionAbsolute.x,positionAbsoluteY:_.positionAbsolute.y,selected:k.selected??!1,selectable:L,draggable:O,deletable:k.deletable??!0,isConnectable:P,sourcePosition:k.sourcePosition,targetPosition:k.targetPosition,dragging:Y,dragHandle:k.dragHandle,zIndex:_.z,parentId:k.parentId,...V})})})}var uZ=R.memo(cZ);const dZ=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function gD(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:s,elementsSelectable:r,onError:o}=Je(dZ,jt),c=iZ(e.onlyRenderVisibleElements),u=oZ();return a.jsx("div",{className:"react-flow__nodes",style:Jp,children:c.map(f=>a.jsx(uZ,{id:f,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:u,nodesDraggable:t,nodesConnectable:n,nodesFocusable:s,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:o},f))})}gD.displayName="NodeRenderer";const fZ=R.memo(gD);function hZ(e){return Je(R.useCallback(n=>{if(!e)return n.edges.map(r=>r.id);const s=[];if(n.width&&n.height)for(const r of n.edges){const o=n.nodeLookup.get(r.source),c=n.nodeLookup.get(r.target);o&&c&&gQ({sourceNode:o,targetNode:c,width:n.width,height:n.height,transform:n.transform})&&s.push(r.id)}return s},[e]),jt)}const pZ=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return a.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},mZ=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return a.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},jA={[Ul.Arrow]:pZ,[Ul.ArrowClosed]:mZ};function gZ(e){const t=Nt();return R.useMemo(()=>{var r,o;return Object.prototype.hasOwnProperty.call(jA,e)?jA[e]:((o=(r=t.getState()).onError)==null||o.call(r,"009",Zs.error009(e)),null)},[e])}const xZ=({id:e,type:t,color:n,width:s=12.5,height:r=12.5,markerUnits:o="strokeWidth",strokeWidth:c,orient:u="auto-start-reverse"})=>{const f=gZ(t);return f?a.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${s}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:o,orient:u,refX:"0",refY:"0",children:a.jsx(f,{color:n,strokeWidth:c})}):null},xD=({defaultColor:e,rfId:t})=>{const n=Je(o=>o.edges),s=Je(o=>o.defaultEdgeOptions),r=R.useMemo(()=>NQ(n,{id:t,defaultColor:e,defaultMarkerStart:s==null?void 0:s.markerStart,defaultMarkerEnd:s==null?void 0:s.markerEnd}),[n,s,t,e]);return r.length?a.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:a.jsx("defs",{children:r.map(o=>a.jsx(xZ,{id:o.id,type:o.type,color:o.color,width:o.width,height:o.height,markerUnits:o.markerUnits,strokeWidth:o.strokeWidth,orient:o.orient},o.id))})}):null};xD.displayName="MarkerDefinitions";var vZ=R.memo(xD);function vD({x:e,y:t,label:n,labelStyle:s,labelShowBg:r=!0,labelBgStyle:o,labelBgPadding:c=[2,4],labelBgBorderRadius:u=2,children:f,className:h,...p}){const[g,x]=R.useState({x:1,y:0,width:0,height:0}),v=Bt(["react-flow__edge-textwrapper",h]),b=R.useRef(null);return R.useEffect(()=>{if(b.current){const w=b.current.getBBox();x({x:w.x,y:w.y,width:w.width,height:w.height})}},[n]),n?a.jsxs("g",{transform:`translate(${e-g.width/2} ${t-g.height/2})`,className:v,visibility:g.width?"visible":"hidden",...p,children:[r&&a.jsx("rect",{width:g.width+2*c[0],x:-c[0],y:-c[1],height:g.height+2*c[1],className:"react-flow__edge-textbg",style:o,rx:u,ry:u}),a.jsx("text",{className:"react-flow__edge-text",y:g.height/2,dy:"0.3em",ref:b,style:s,children:n}),f]}):null}vD.displayName="EdgeText";const yZ=R.memo(vD);function md({path:e,labelX:t,labelY:n,label:s,labelStyle:r,labelShowBg:o,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:f,interactionWidth:h=20,...p}){return a.jsxs(a.Fragment,{children:[a.jsx("path",{...p,d:e,fill:"none",className:Bt(["react-flow__edge-path",p.className])}),h?a.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:h,className:"react-flow__edge-interaction"}):null,s&&Cs(t)&&Cs(n)?a.jsx(yZ,{x:t,y:n,label:s,labelStyle:r,labelShowBg:o,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:f}):null]})}function NA({pos:e,x1:t,y1:n,x2:s,y2:r}){return e===ve.Left||e===ve.Right?[.5*(t+s),n]:[t,.5*(n+r)]}function yD({sourceX:e,sourceY:t,sourcePosition:n=ve.Bottom,targetX:s,targetY:r,targetPosition:o=ve.Top}){const[c,u]=NA({pos:n,x1:e,y1:t,x2:s,y2:r}),[f,h]=NA({pos:o,x1:s,y1:r,x2:e,y2:t}),[p,g,x,v]=UP({sourceX:e,sourceY:t,targetX:s,targetY:r,sourceControlX:c,sourceControlY:u,targetControlX:f,targetControlY:h});return[`M${e},${t} C${c},${u} ${f},${h} ${s},${r}`,p,g,x,v]}function bD(e){return R.memo(({id:t,sourceX:n,sourceY:s,targetX:r,targetY:o,sourcePosition:c,targetPosition:u,label:f,labelStyle:h,labelShowBg:p,labelBgStyle:g,labelBgPadding:x,labelBgBorderRadius:v,style:b,markerEnd:w,markerStart:S,interactionWidth:N})=>{const[C,k,_]=yD({sourceX:n,sourceY:s,sourcePosition:c,targetX:r,targetY:o,targetPosition:u}),E=e.isInternal?void 0:t;return a.jsx(md,{id:E,path:C,labelX:k,labelY:_,label:f,labelStyle:h,labelShowBg:p,labelBgStyle:g,labelBgPadding:x,labelBgBorderRadius:v,style:b,markerEnd:w,markerStart:S,interactionWidth:N})})}const bZ=bD({isInternal:!1}),wD=bD({isInternal:!0});bZ.displayName="SimpleBezierEdge";wD.displayName="SimpleBezierEdgeInternal";function SD(e){return R.memo(({id:t,sourceX:n,sourceY:s,targetX:r,targetY:o,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:g,style:x,sourcePosition:v=ve.Bottom,targetPosition:b=ve.Top,markerEnd:w,markerStart:S,pathOptions:N,interactionWidth:C})=>{const[k,_,E]=GS({sourceX:n,sourceY:s,sourcePosition:v,targetX:r,targetY:o,targetPosition:b,borderRadius:N==null?void 0:N.borderRadius,offset:N==null?void 0:N.offset,stepPosition:N==null?void 0:N.stepPosition}),M=e.isInternal?void 0:t;return a.jsx(md,{id:M,path:k,labelX:_,labelY:E,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:g,style:x,markerEnd:w,markerStart:S,interactionWidth:C})})}const jD=SD({isInternal:!1}),ND=SD({isInternal:!0});jD.displayName="SmoothStepEdge";ND.displayName="SmoothStepEdgeInternal";function _D(e){return R.memo(({id:t,...n})=>{var r;const s=e.isInternal?void 0:t;return a.jsx(jD,{...n,id:s,pathOptions:R.useMemo(()=>{var o;return{borderRadius:0,offset:(o=n.pathOptions)==null?void 0:o.offset}},[(r=n.pathOptions)==null?void 0:r.offset])})})}const wZ=_D({isInternal:!1}),CD=_D({isInternal:!0});wZ.displayName="StepEdge";CD.displayName="StepEdgeInternal";function kD(e){return R.memo(({id:t,sourceX:n,sourceY:s,targetX:r,targetY:o,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:g,style:x,markerEnd:v,markerStart:b,interactionWidth:w})=>{const[S,N,C]=GP({sourceX:n,sourceY:s,targetX:r,targetY:o}),k=e.isInternal?void 0:t;return a.jsx(md,{id:k,path:S,labelX:N,labelY:C,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:g,style:x,markerEnd:v,markerStart:b,interactionWidth:w})})}const SZ=kD({isInternal:!1}),RD=kD({isInternal:!0});SZ.displayName="StraightEdge";RD.displayName="StraightEdgeInternal";function ED(e){return R.memo(({id:t,sourceX:n,sourceY:s,targetX:r,targetY:o,sourcePosition:c=ve.Bottom,targetPosition:u=ve.Top,label:f,labelStyle:h,labelShowBg:p,labelBgStyle:g,labelBgPadding:x,labelBgBorderRadius:v,style:b,markerEnd:w,markerStart:S,pathOptions:N,interactionWidth:C})=>{const[k,_,E]=hN({sourceX:n,sourceY:s,sourcePosition:c,targetX:r,targetY:o,targetPosition:u,curvature:N==null?void 0:N.curvature}),M=e.isInternal?void 0:t;return a.jsx(md,{id:M,path:k,labelX:_,labelY:E,label:f,labelStyle:h,labelShowBg:p,labelBgStyle:g,labelBgPadding:x,labelBgBorderRadius:v,style:b,markerEnd:w,markerStart:S,interactionWidth:C})})}const jZ=ED({isInternal:!1}),AD=ED({isInternal:!0});jZ.displayName="BezierEdge";AD.displayName="BezierEdgeInternal";const _A={default:AD,straight:RD,step:CD,smoothstep:ND,simplebezier:wD},CA={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},NZ=(e,t,n)=>n===ve.Left?e-t:n===ve.Right?e+t:e,_Z=(e,t,n)=>n===ve.Top?e-t:n===ve.Bottom?e+t:e,kA="react-flow__edgeupdater";function RA({position:e,centerX:t,centerY:n,radius:s=10,onMouseDown:r,onMouseEnter:o,onMouseOut:c,type:u}){return a.jsx("circle",{onMouseDown:r,onMouseEnter:o,onMouseOut:c,className:Bt([kA,`${kA}-${u}`]),cx:NZ(t,s,e),cy:_Z(n,s,e),r:s,stroke:"transparent",fill:"transparent"})}function CZ({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:s,sourceY:r,targetX:o,targetY:c,sourcePosition:u,targetPosition:f,onReconnect:h,onReconnectStart:p,onReconnectEnd:g,setReconnecting:x,setUpdateHover:v}){const b=Nt(),w=(_,E)=>{if(_.button!==0)return;const{autoPanOnConnect:M,domNode:A,connectionMode:O,connectionRadius:L,lib:P,onConnectStart:I,cancelConnection:B,nodeLookup:F,rfId:z,panBy:Y,updateConnection:$}=b.getState(),V=E.type==="target",G=(D,U)=>{x(!1),g==null||g(D,n,E.type,U)},Z=D=>h==null?void 0:h(n,D),J=(D,U)=>{x(!0),p==null||p(_,n,E.type),I==null||I(D,U)};WS.onPointerDown(_.nativeEvent,{autoPanOnConnect:M,connectionMode:O,connectionRadius:L,domNode:A,handleId:E.id,nodeId:E.nodeId,nodeLookup:F,isTarget:V,edgeUpdaterType:E.type,lib:P,flowId:z,cancelConnection:B,panBy:Y,isValidConnection:(...D)=>{var U,te;return((te=(U=b.getState()).isValidConnection)==null?void 0:te.call(U,...D))??!0},onConnect:Z,onConnectStart:J,onConnectEnd:(...D)=>{var U,te;return(te=(U=b.getState()).onConnectEnd)==null?void 0:te.call(U,...D)},onReconnectEnd:G,updateConnection:$,getTransform:()=>b.getState().transform,getFromHandle:()=>b.getState().connection.fromHandle,dragThreshold:b.getState().connectionDragThreshold,handleDomNode:_.currentTarget})},S=_=>w(_,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),N=_=>w(_,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),C=()=>v(!0),k=()=>v(!1);return a.jsxs(a.Fragment,{children:[(e===!0||e==="source")&&a.jsx(RA,{position:u,centerX:s,centerY:r,radius:t,onMouseDown:S,onMouseEnter:C,onMouseOut:k,type:"source"}),(e===!0||e==="target")&&a.jsx(RA,{position:f,centerX:o,centerY:c,radius:t,onMouseDown:N,onMouseEnter:C,onMouseOut:k,type:"target"})]})}function kZ({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:s,onClick:r,onDoubleClick:o,onContextMenu:c,onMouseEnter:u,onMouseMove:f,onMouseLeave:h,reconnectRadius:p,onReconnect:g,onReconnectStart:x,onReconnectEnd:v,rfId:b,edgeTypes:w,noPanClassName:S,onError:N,disableKeyboardA11y:C}){let k=Je(ye=>ye.edgeLookup.get(e));const _=Je(ye=>ye.defaultEdgeOptions);k=_?{..._,...k}:k;let E=k.type||"default",M=(w==null?void 0:w[E])||_A[E];M===void 0&&(N==null||N("011",Zs.error011(E)),E="default",M=(w==null?void 0:w.default)||_A.default);const A=!!(k.focusable||t&&typeof k.focusable>"u"),O=typeof g<"u"&&(k.reconnectable||n&&typeof k.reconnectable>"u"),L=!!(k.selectable||s&&typeof k.selectable>"u"),P=R.useRef(null),[I,B]=R.useState(!1),[F,z]=R.useState(!1),Y=Nt(),{zIndex:$,sourceX:V,sourceY:G,targetX:Z,targetY:J,sourcePosition:D,targetPosition:U}=Je(R.useCallback(ye=>{const xe=ye.nodeLookup.get(k.source),Se=ye.nodeLookup.get(k.target);if(!xe||!Se)return{zIndex:k.zIndex,...CA};const je=jQ({id:e,sourceNode:xe,targetNode:Se,sourceHandle:k.sourceHandle||null,targetHandle:k.targetHandle||null,connectionMode:ye.connectionMode,onError:N});return{zIndex:mQ({selected:k.selected,zIndex:k.zIndex,sourceNode:xe,targetNode:Se,elevateOnSelect:ye.elevateEdgesOnSelect,zIndexMode:ye.zIndexMode}),...je||CA}},[k.source,k.target,k.sourceHandle,k.targetHandle,k.selected,k.zIndex]),jt),te=R.useMemo(()=>k.markerStart?`url('#${KS(k.markerStart,b)}')`:void 0,[k.markerStart,b]),H=R.useMemo(()=>k.markerEnd?`url('#${KS(k.markerEnd,b)}')`:void 0,[k.markerEnd,b]);if(k.hidden||V===null||G===null||Z===null||J===null)return null;const W=ye=>{var Oe;const{addSelectedEdges:xe,unselectNodesAndEdges:Se,multiSelectionActive:je}=Y.getState();L&&(Y.setState({nodesSelectionActive:!1}),k.selected&&je?(Se({nodes:[],edges:[k]}),(Oe=P.current)==null||Oe.blur()):xe([e])),r&&r(ye,k)},Q=o?ye=>{o(ye,{...k})}:void 0,se=c?ye=>{c(ye,{...k})}:void 0,re=u?ye=>{u(ye,{...k})}:void 0,ce=f?ye=>{f(ye,{...k})}:void 0,me=h?ye=>{h(ye,{...k})}:void 0,ge=ye=>{var xe;if(!C&&AP.includes(ye.key)&&L){const{unselectNodesAndEdges:Se,addSelectedEdges:je}=Y.getState();ye.key==="Escape"?((xe=P.current)==null||xe.blur(),Se({edges:[k]})):je([e])}};return a.jsx("svg",{style:{zIndex:$},children:a.jsxs("g",{className:Bt(["react-flow__edge",`react-flow__edge-${E}`,k.className,S,{selected:k.selected,animated:k.animated,inactive:!L&&!r,updating:I,selectable:L}]),onClick:W,onDoubleClick:Q,onContextMenu:se,onMouseEnter:re,onMouseMove:ce,onMouseLeave:me,onKeyDown:A?ge:void 0,tabIndex:A?0:void 0,role:k.ariaRole??(A?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":k.ariaLabel===null?void 0:k.ariaLabel||`Edge from ${k.source} to ${k.target}`,"aria-describedby":A?`${oD}-${b}`:void 0,ref:P,...k.domAttributes,children:[!F&&a.jsx(M,{id:e,source:k.source,target:k.target,type:k.type,selected:k.selected,animated:k.animated,selectable:L,deletable:k.deletable??!0,label:k.label,labelStyle:k.labelStyle,labelShowBg:k.labelShowBg,labelBgStyle:k.labelBgStyle,labelBgPadding:k.labelBgPadding,labelBgBorderRadius:k.labelBgBorderRadius,sourceX:V,sourceY:G,targetX:Z,targetY:J,sourcePosition:D,targetPosition:U,data:k.data,style:k.style,sourceHandleId:k.sourceHandle,targetHandleId:k.targetHandle,markerStart:te,markerEnd:H,pathOptions:"pathOptions"in k?k.pathOptions:void 0,interactionWidth:k.interactionWidth}),O&&a.jsx(CZ,{edge:k,isReconnectable:O,reconnectRadius:p,onReconnect:g,onReconnectStart:x,onReconnectEnd:v,sourceX:V,sourceY:G,targetX:Z,targetY:J,sourcePosition:D,targetPosition:U,setUpdateHover:B,setReconnecting:z})]})})}var RZ=R.memo(kZ);const EZ=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function TD({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:s,noPanClassName:r,onReconnect:o,onEdgeContextMenu:c,onEdgeMouseEnter:u,onEdgeMouseMove:f,onEdgeMouseLeave:h,onEdgeClick:p,reconnectRadius:g,onEdgeDoubleClick:x,onReconnectStart:v,onReconnectEnd:b,disableKeyboardA11y:w}){const{edgesFocusable:S,edgesReconnectable:N,elementsSelectable:C,onError:k}=Je(EZ,jt),_=hZ(t);return a.jsxs("div",{className:"react-flow__edges",children:[a.jsx(vZ,{defaultColor:e,rfId:n}),_.map(E=>a.jsx(RZ,{id:E,edgesFocusable:S,edgesReconnectable:N,elementsSelectable:C,noPanClassName:r,onReconnect:o,onContextMenu:c,onMouseEnter:u,onMouseMove:f,onMouseLeave:h,onClick:p,reconnectRadius:g,onDoubleClick:x,onReconnectStart:v,onReconnectEnd:b,rfId:n,onError:k,edgeTypes:s,disableKeyboardA11y:w},E))]})}TD.displayName="EdgeRenderer";const AZ=R.memo(TD),TZ=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function MZ({children:e}){const t=Je(TZ);return a.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function IZ(e){const t=Zp(),n=R.useRef(!1);R.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const OZ=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function LZ(e){const t=Je(OZ),n=Nt();return R.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function PZ(e){return e.connection.inProgress?{...e.connection,to:hd(e.connection.to,e.transform)}:{...e.connection}}function DZ(e){return PZ}function qZ(e){const t=DZ();return Je(t,jt)}const $Z=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function zZ({containerStyle:e,style:t,type:n,component:s}){const{nodesConnectable:r,width:o,height:c,isValid:u,inProgress:f}=Je($Z,jt);return!(o&&r&&f)?null:a.jsx("svg",{style:e,width:o,height:c,className:"react-flow__connectionline react-flow__container",children:a.jsx("g",{className:Bt(["react-flow__connection",IP(u)]),children:a.jsx(MD,{style:t,type:n,CustomComponent:s,isValid:u})})})}const MD=({style:e,type:t=ki.Bezier,CustomComponent:n,isValid:s})=>{const{inProgress:r,from:o,fromNode:c,fromHandle:u,fromPosition:f,to:h,toNode:p,toHandle:g,toPosition:x,pointer:v}=qZ();if(!r)return;if(n)return a.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:c,fromHandle:u,fromX:o.x,fromY:o.y,toX:h.x,toY:h.y,fromPosition:f,toPosition:x,connectionStatus:IP(s),toNode:p,toHandle:g,pointer:v});let b="";const w={sourceX:o.x,sourceY:o.y,sourcePosition:f,targetX:h.x,targetY:h.y,targetPosition:x};switch(t){case ki.Bezier:[b]=hN(w);break;case ki.SimpleBezier:[b]=yD(w);break;case ki.Step:[b]=GS({...w,borderRadius:0});break;case ki.SmoothStep:[b]=GS(w);break;default:[b]=GP(w)}return a.jsx("path",{d:b,fill:"none",className:"react-flow__connection-path",style:e})};MD.displayName="ConnectionLine";const BZ={};function EA(e=BZ){R.useRef(e),Nt(),R.useEffect(()=>{},[e])}function FZ(){Nt(),R.useRef(!1),R.useEffect(()=>{},[])}function ID({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:s,onEdgeClick:r,onNodeDoubleClick:o,onEdgeDoubleClick:c,onNodeMouseEnter:u,onNodeMouseMove:f,onNodeMouseLeave:h,onNodeContextMenu:p,onSelectionContextMenu:g,onSelectionStart:x,onSelectionEnd:v,connectionLineType:b,connectionLineStyle:w,connectionLineComponent:S,connectionLineContainerStyle:N,selectionKeyCode:C,selectionOnDrag:k,selectionMode:_,multiSelectionKeyCode:E,panActivationKeyCode:M,zoomActivationKeyCode:A,deleteKeyCode:O,onlyRenderVisibleElements:L,elementsSelectable:P,defaultViewport:I,translateExtent:B,minZoom:F,maxZoom:z,preventScrolling:Y,defaultMarkerColor:$,zoomOnScroll:V,zoomOnPinch:G,panOnScroll:Z,panOnScrollSpeed:J,panOnScrollMode:D,zoomOnDoubleClick:U,panOnDrag:te,onPaneClick:H,onPaneMouseEnter:W,onPaneMouseMove:Q,onPaneMouseLeave:se,onPaneScroll:re,onPaneContextMenu:ce,paneClickDistance:me,nodeClickDistance:ge,onEdgeContextMenu:ye,onEdgeMouseEnter:xe,onEdgeMouseMove:Se,onEdgeMouseLeave:je,reconnectRadius:Oe,onReconnect:Ee,onReconnectStart:mt,onReconnectEnd:yt,noDragClassName:Tt,noWheelClassName:rn,noPanClassName:Ht,disableKeyboardA11y:bt,nodeExtent:gt,rfId:Fe,viewport:ht,onViewportChange:Ut}){return EA(e),EA(t),FZ(),IZ(n),LZ(ht),a.jsx(sZ,{onPaneClick:H,onPaneMouseEnter:W,onPaneMouseMove:Q,onPaneMouseLeave:se,onPaneContextMenu:ce,onPaneScroll:re,paneClickDistance:me,deleteKeyCode:O,selectionKeyCode:C,selectionOnDrag:k,selectionMode:_,onSelectionStart:x,onSelectionEnd:v,multiSelectionKeyCode:E,panActivationKeyCode:M,zoomActivationKeyCode:A,elementsSelectable:P,zoomOnScroll:V,zoomOnPinch:G,zoomOnDoubleClick:U,panOnScroll:Z,panOnScrollSpeed:J,panOnScrollMode:D,panOnDrag:te,defaultViewport:I,translateExtent:B,minZoom:F,maxZoom:z,onSelectionContextMenu:g,preventScrolling:Y,noDragClassName:Tt,noWheelClassName:rn,noPanClassName:Ht,disableKeyboardA11y:bt,onViewportChange:Ut,isControlledViewport:!!ht,children:a.jsxs(MZ,{children:[a.jsx(AZ,{edgeTypes:t,onEdgeClick:r,onEdgeDoubleClick:c,onReconnect:Ee,onReconnectStart:mt,onReconnectEnd:yt,onlyRenderVisibleElements:L,onEdgeContextMenu:ye,onEdgeMouseEnter:xe,onEdgeMouseMove:Se,onEdgeMouseLeave:je,reconnectRadius:Oe,defaultMarkerColor:$,noPanClassName:Ht,disableKeyboardA11y:bt,rfId:Fe}),a.jsx(zZ,{style:w,type:b,component:S,containerStyle:N}),a.jsx("div",{className:"react-flow__edgelabel-renderer"}),a.jsx(fZ,{nodeTypes:e,onNodeClick:s,onNodeDoubleClick:o,onNodeMouseEnter:u,onNodeMouseMove:f,onNodeMouseLeave:h,onNodeContextMenu:p,nodeClickDistance:ge,onlyRenderVisibleElements:L,noPanClassName:Ht,noDragClassName:Tt,disableKeyboardA11y:bt,nodeExtent:gt,rfId:Fe}),a.jsx("div",{className:"react-flow__viewport-portal"})]})})}ID.displayName="GraphView";const HZ=R.memo(ID),AA=({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,width:r,height:o,fitView:c,fitViewOptions:u,minZoom:f=.5,maxZoom:h=2,nodeOrigin:p,nodeExtent:g,zIndexMode:x="basic"}={})=>{const v=new Map,b=new Map,w=new Map,S=new Map,N=s??t??[],C=n??e??[],k=p??[0,0],_=g??zu;WP(w,S,N);const{nodesInitialized:E}=YS(C,v,b,{nodeOrigin:k,nodeExtent:_,zIndexMode:x});let M=[0,0,1];if(c&&r&&o){const A=dd(v,{filter:I=>!!((I.width||I.initialWidth)&&(I.height||I.initialHeight))}),{x:O,y:L,zoom:P}=dN(A,r,o,f,h,(u==null?void 0:u.padding)??.1);M=[O,L,P]}return{rfId:"1",width:r??0,height:o??0,transform:M,nodes:C,nodesInitialized:E,nodeLookup:v,parentLookup:b,edges:N,edgeLookup:S,connectionLookup:w,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:s!==void 0,panZoom:null,minZoom:f,maxZoom:h,translateExtent:zu,nodeExtent:_,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Hl.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:k,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:c??!1,fitViewOptions:u,fitViewResolver:null,connection:{...MP},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:cQ,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:TP,zIndexMode:x,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},UZ=({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,width:r,height:o,fitView:c,fitViewOptions:u,minZoom:f,maxZoom:h,nodeOrigin:p,nodeExtent:g,zIndexMode:x})=>oX((v,b)=>{async function w(){const{nodeLookup:S,panZoom:N,fitViewOptions:C,fitViewResolver:k,width:_,height:E,minZoom:M,maxZoom:A}=b();N&&(await oQ({nodes:S,width:_,height:E,panZoom:N,minZoom:M,maxZoom:A},C),k==null||k.resolve(!0),v({fitViewResolver:null}))}return{...AA({nodes:e,edges:t,width:r,height:o,fitView:c,fitViewOptions:u,minZoom:f,maxZoom:h,nodeOrigin:p,nodeExtent:g,defaultNodes:n,defaultEdges:s,zIndexMode:x}),setNodes:S=>{const{nodeLookup:N,parentLookup:C,nodeOrigin:k,elevateNodesOnSelect:_,fitViewQueued:E,zIndexMode:M,nodesSelectionActive:A}=b(),{nodesInitialized:O,hasSelectedNodes:L}=YS(S,N,C,{nodeOrigin:k,nodeExtent:g,elevateNodesOnSelect:_,checkEquality:!0,zIndexMode:M}),P=A&&L;E&&O?(w(),v({nodes:S,nodesInitialized:O,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:P})):v({nodes:S,nodesInitialized:O,nodesSelectionActive:P})},setEdges:S=>{const{connectionLookup:N,edgeLookup:C}=b();WP(N,C,S),v({edges:S})},setDefaultNodesAndEdges:(S,N)=>{if(S){const{setNodes:C}=b();C(S),v({hasDefaultNodes:!0})}if(N){const{setEdges:C}=b();C(N),v({hasDefaultEdges:!0})}},updateNodeInternals:S=>{const{triggerNodeChanges:N,nodeLookup:C,parentLookup:k,domNode:_,nodeOrigin:E,nodeExtent:M,debug:A,fitViewQueued:O,zIndexMode:L}=b(),{changes:P,updatedInternals:I}=TQ(S,C,k,_,E,M,L);I&&(kQ(C,k,{nodeOrigin:E,nodeExtent:M,zIndexMode:L}),O?(w(),v({fitViewQueued:!1,fitViewOptions:void 0})):v({}),(P==null?void 0:P.length)>0&&(A&&console.log("React Flow: trigger node changes",P),N==null||N(P)))},updateNodePositions:(S,N=!1)=>{const C=[];let k=[];const{nodeLookup:_,triggerNodeChanges:E,connection:M,updateConnection:A,onNodesChangeMiddlewareMap:O}=b();for(const[L,P]of S){const I=_.get(L),B=!!(I!=null&&I.expandParent&&(I!=null&&I.parentId)&&(P!=null&&P.position)),F={id:L,type:"position",position:B?{x:Math.max(0,P.position.x),y:Math.max(0,P.position.y)}:P.position,dragging:N};if(I&&M.inProgress&&M.fromNode.id===I.id){const z=Xa(I,M.fromHandle,ve.Left,!0);A({...M,from:z})}B&&I.parentId&&C.push({id:L,parentId:I.parentId,rect:{...P.internals.positionAbsolute,width:P.measured.width??0,height:P.measured.height??0}}),k.push(F)}if(C.length>0){const{parentLookup:L,nodeOrigin:P}=b(),I=vN(C,_,L,P);k.push(...I)}for(const L of O.values())k=L(k);E(k)},triggerNodeChanges:S=>{const{onNodesChange:N,setNodes:C,nodes:k,hasDefaultNodes:_,debug:E}=b();if(S!=null&&S.length){if(_){const M=RX(S,k);C(M)}E&&console.log("React Flow: trigger node changes",S),N==null||N(S)}},triggerEdgeChanges:S=>{const{onEdgesChange:N,setEdges:C,edges:k,hasDefaultEdges:_,debug:E}=b();if(S!=null&&S.length){if(_){const M=EX(S,k);C(M)}E&&console.log("React Flow: trigger edge changes",S),N==null||N(S)}},addSelectedNodes:S=>{const{multiSelectionActive:N,edgeLookup:C,nodeLookup:k,triggerNodeChanges:_,triggerEdgeChanges:E}=b();if(N){const M=S.map(A=>ja(A,!0));_(M);return}_(gl(k,new Set([...S]),!0)),E(gl(C))},addSelectedEdges:S=>{const{multiSelectionActive:N,edgeLookup:C,nodeLookup:k,triggerNodeChanges:_,triggerEdgeChanges:E}=b();if(N){const M=S.map(A=>ja(A,!0));E(M);return}E(gl(C,new Set([...S]))),_(gl(k,new Set,!0))},unselectNodesAndEdges:({nodes:S,edges:N}={})=>{const{edges:C,nodes:k,nodeLookup:_,triggerNodeChanges:E,triggerEdgeChanges:M}=b(),A=S||k,O=N||C,L=[];for(const I of A){if(!I.selected)continue;const B=_.get(I.id);B&&(B.selected=!1),L.push(ja(I.id,!1))}const P=[];for(const I of O)I.selected&&P.push(ja(I.id,!1));E(L),M(P)},setMinZoom:S=>{const{panZoom:N,maxZoom:C}=b();N==null||N.setScaleExtent([S,C]),v({minZoom:S})},setMaxZoom:S=>{const{panZoom:N,minZoom:C}=b();N==null||N.setScaleExtent([C,S]),v({maxZoom:S})},setTranslateExtent:S=>{var N;(N=b().panZoom)==null||N.setTranslateExtent(S),v({translateExtent:S})},resetSelectedElements:()=>{const{edges:S,nodes:N,triggerNodeChanges:C,triggerEdgeChanges:k,elementsSelectable:_}=b();if(!_)return;const E=N.reduce((A,O)=>O.selected?[...A,ja(O.id,!1)]:A,[]),M=S.reduce((A,O)=>O.selected?[...A,ja(O.id,!1)]:A,[]);C(E),k(M)},setNodeExtent:S=>{const{nodes:N,nodeLookup:C,parentLookup:k,nodeOrigin:_,elevateNodesOnSelect:E,nodeExtent:M,zIndexMode:A}=b();S[0][0]===M[0][0]&&S[0][1]===M[0][1]&&S[1][0]===M[1][0]&&S[1][1]===M[1][1]||(YS(N,C,k,{nodeOrigin:_,nodeExtent:S,elevateNodesOnSelect:E,checkEquality:!1,zIndexMode:A}),v({nodeExtent:S}))},panBy:S=>{const{transform:N,width:C,height:k,panZoom:_,translateExtent:E}=b();return MQ({delta:S,panZoom:_,transform:N,translateExtent:E,width:C,height:k})},setCenter:async(S,N,C)=>{const{width:k,height:_,maxZoom:E,panZoom:M}=b();if(!M)return Promise.resolve(!1);const A=typeof(C==null?void 0:C.zoom)<"u"?C.zoom:E;return await M.setViewport({x:k/2-S*A,y:_/2-N*A,zoom:A},{duration:C==null?void 0:C.duration,ease:C==null?void 0:C.ease,interpolate:C==null?void 0:C.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{v({connection:{...MP}})},updateConnection:S=>{v({connection:S})},reset:()=>v({...AA()})}},Object.is);function VZ({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:s,initialWidth:r,initialHeight:o,initialMinZoom:c,initialMaxZoom:u,initialFitViewOptions:f,fitView:h,nodeOrigin:p,nodeExtent:g,zIndexMode:x,children:v}){const[b]=R.useState(()=>UZ({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,width:r,height:o,fitView:h,minZoom:c,maxZoom:u,fitViewOptions:f,nodeOrigin:p,nodeExtent:g,zIndexMode:x}));return a.jsx(lX,{value:b,children:a.jsx(MX,{children:v})})}function GZ({children:e,nodes:t,edges:n,defaultNodes:s,defaultEdges:r,width:o,height:c,fitView:u,fitViewOptions:f,minZoom:h,maxZoom:p,nodeOrigin:g,nodeExtent:x,zIndexMode:v}){return R.useContext(Xp)?a.jsx(a.Fragment,{children:e}):a.jsx(VZ,{initialNodes:t,initialEdges:n,defaultNodes:s,defaultEdges:r,initialWidth:o,initialHeight:c,fitView:u,initialFitViewOptions:f,initialMinZoom:h,initialMaxZoom:p,nodeOrigin:g,nodeExtent:x,zIndexMode:v,children:e})}const KZ={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function YZ({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,className:r,nodeTypes:o,edgeTypes:c,onNodeClick:u,onEdgeClick:f,onInit:h,onMove:p,onMoveStart:g,onMoveEnd:x,onConnect:v,onConnectStart:b,onConnectEnd:w,onClickConnectStart:S,onClickConnectEnd:N,onNodeMouseEnter:C,onNodeMouseMove:k,onNodeMouseLeave:_,onNodeContextMenu:E,onNodeDoubleClick:M,onNodeDragStart:A,onNodeDrag:O,onNodeDragStop:L,onNodesDelete:P,onEdgesDelete:I,onDelete:B,onSelectionChange:F,onSelectionDragStart:z,onSelectionDrag:Y,onSelectionDragStop:$,onSelectionContextMenu:V,onSelectionStart:G,onSelectionEnd:Z,onBeforeDelete:J,connectionMode:D,connectionLineType:U=ki.Bezier,connectionLineStyle:te,connectionLineComponent:H,connectionLineContainerStyle:W,deleteKeyCode:Q="Backspace",selectionKeyCode:se="Shift",selectionOnDrag:re=!1,selectionMode:ce=Bu.Full,panActivationKeyCode:me="Space",multiSelectionKeyCode:ge=Hu()?"Meta":"Control",zoomActivationKeyCode:ye=Hu()?"Meta":"Control",snapToGrid:xe,snapGrid:Se,onlyRenderVisibleElements:je=!1,selectNodesOnDrag:Oe,nodesDraggable:Ee,autoPanOnNodeFocus:mt,nodesConnectable:yt,nodesFocusable:Tt,nodeOrigin:rn=lD,edgesFocusable:Ht,edgesReconnectable:bt,elementsSelectable:gt=!0,defaultViewport:Fe=wX,minZoom:ht=.5,maxZoom:Ut=2,translateExtent:an=zu,preventScrolling:po=!0,nodeExtent:tr,defaultMarkerColor:nc="#b1b1b7",zoomOnScroll:mo=!0,zoomOnPinch:on=!0,panOnScroll:Ct=!1,panOnScrollSpeed:Ls=.5,panOnScrollMode:yn=Ua.Free,zoomOnDoubleClick:Cm=!0,panOnDrag:km=!0,onPaneClick:Rm,onPaneMouseEnter:go,onPaneMouseMove:xo,onPaneMouseLeave:vo,onPaneScroll:nr,onPaneContextMenu:yo,paneClickDistance:Ji=1,nodeClickDistance:Em=0,children:jd,onReconnect:sc,onReconnectStart:ea,onReconnectEnd:Am,onEdgeContextMenu:Nd,onEdgeDoubleClick:_d,onEdgeMouseEnter:Cd,onEdgeMouseMove:rc,onEdgeMouseLeave:ic,reconnectRadius:kd=10,onNodesChange:Rd,onEdgesChange:Ps,noDragClassName:Vt="nodrag",noWheelClassName:ln="nowheel",noPanClassName:sr="nopan",fitView:bo,fitViewOptions:Ed,connectOnClick:Tm,attributionPosition:Ad,proOptions:ta,defaultEdgeOptions:ac,elevateNodesOnSelect:Hr=!0,elevateEdgesOnSelect:Ur=!1,disableKeyboardA11y:Vr=!1,autoPanOnConnect:Gr,autoPanOnNodeDrag:Lt,autoPanSpeed:Td,connectionRadius:Md,isValidConnection:rr,onError:Kr,style:Mm,id:oc,nodeDragThreshold:Id,connectionDragThreshold:Im,viewport:wo,onViewportChange:So,width:gs,height:kn,colorMode:Od="light",debug:Om,onScroll:Yr,ariaLabelConfig:Ld,zIndexMode:na="basic",...Lm},Rn){const sa=oc||"1",Pd=_X(Od),lc=R.useCallback(ir=>{ir.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Yr==null||Yr(ir)},[Yr]);return a.jsx("div",{"data-testid":"rf__wrapper",...Lm,onScroll:lc,style:{...Mm,...KZ},ref:Rn,className:Bt(["react-flow",r,Pd]),id:oc,role:"application",children:a.jsxs(GZ,{nodes:e,edges:t,width:gs,height:kn,fitView:bo,fitViewOptions:Ed,minZoom:ht,maxZoom:Ut,nodeOrigin:rn,nodeExtent:tr,zIndexMode:na,children:[a.jsx(NX,{nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:v,onConnectStart:b,onConnectEnd:w,onClickConnectStart:S,onClickConnectEnd:N,nodesDraggable:Ee,autoPanOnNodeFocus:mt,nodesConnectable:yt,nodesFocusable:Tt,edgesFocusable:Ht,edgesReconnectable:bt,elementsSelectable:gt,elevateNodesOnSelect:Hr,elevateEdgesOnSelect:Ur,minZoom:ht,maxZoom:Ut,nodeExtent:tr,onNodesChange:Rd,onEdgesChange:Ps,snapToGrid:xe,snapGrid:Se,connectionMode:D,translateExtent:an,connectOnClick:Tm,defaultEdgeOptions:ac,fitView:bo,fitViewOptions:Ed,onNodesDelete:P,onEdgesDelete:I,onDelete:B,onNodeDragStart:A,onNodeDrag:O,onNodeDragStop:L,onSelectionDrag:Y,onSelectionDragStart:z,onSelectionDragStop:$,onMove:p,onMoveStart:g,onMoveEnd:x,noPanClassName:sr,nodeOrigin:rn,rfId:sa,autoPanOnConnect:Gr,autoPanOnNodeDrag:Lt,autoPanSpeed:Td,onError:Kr,connectionRadius:Md,isValidConnection:rr,selectNodesOnDrag:Oe,nodeDragThreshold:Id,connectionDragThreshold:Im,onBeforeDelete:J,debug:Om,ariaLabelConfig:Ld,zIndexMode:na}),a.jsx(HZ,{onInit:h,onNodeClick:u,onEdgeClick:f,onNodeMouseEnter:C,onNodeMouseMove:k,onNodeMouseLeave:_,onNodeContextMenu:E,onNodeDoubleClick:M,nodeTypes:o,edgeTypes:c,connectionLineType:U,connectionLineStyle:te,connectionLineComponent:H,connectionLineContainerStyle:W,selectionKeyCode:se,selectionOnDrag:re,selectionMode:ce,deleteKeyCode:Q,multiSelectionKeyCode:ge,panActivationKeyCode:me,zoomActivationKeyCode:ye,onlyRenderVisibleElements:je,defaultViewport:Fe,translateExtent:an,minZoom:ht,maxZoom:Ut,preventScrolling:po,zoomOnScroll:mo,zoomOnPinch:on,zoomOnDoubleClick:Cm,panOnScroll:Ct,panOnScrollSpeed:Ls,panOnScrollMode:yn,panOnDrag:km,onPaneClick:Rm,onPaneMouseEnter:go,onPaneMouseMove:xo,onPaneMouseLeave:vo,onPaneScroll:nr,onPaneContextMenu:yo,paneClickDistance:Ji,nodeClickDistance:Em,onSelectionContextMenu:V,onSelectionStart:G,onSelectionEnd:Z,onReconnect:sc,onReconnectStart:ea,onReconnectEnd:Am,onEdgeContextMenu:Nd,onEdgeDoubleClick:_d,onEdgeMouseEnter:Cd,onEdgeMouseMove:rc,onEdgeMouseLeave:ic,reconnectRadius:kd,defaultMarkerColor:nc,noDragClassName:Vt,noWheelClassName:ln,noPanClassName:sr,rfId:sa,disableKeyboardA11y:Vr,nodeExtent:tr,viewport:wo,onViewportChange:So}),a.jsx(bX,{onSelectionChange:F}),jd,a.jsx(mX,{proOptions:ta,position:Ad}),a.jsx(pX,{rfId:sa,disableKeyboardA11y:Vr})]})})}var gd=uD(YZ);function WZ({dimensions:e,lineWidth:t,variant:n,className:s}){return a.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Bt(["react-flow__background-pattern",n,s])})}function QZ({radius:e,className:t}){return a.jsx("circle",{cx:e,cy:e,r:e,className:Bt(["react-flow__background-pattern","dots",t])})}var Vi;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Vi||(Vi={}));const XZ={[Vi.Dots]:1,[Vi.Lines]:1,[Vi.Cross]:6},ZZ=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function OD({id:e,variant:t=Vi.Dots,gap:n=20,size:s,lineWidth:r=1,offset:o=0,color:c,bgColor:u,style:f,className:h,patternClassName:p}){const g=R.useRef(null),{transform:x,patternId:v}=Je(ZZ,jt),b=s||XZ[t],w=t===Vi.Dots,S=t===Vi.Cross,N=Array.isArray(n)?n:[n,n],C=[N[0]*x[2]||1,N[1]*x[2]||1],k=b*x[2],_=Array.isArray(o)?o:[o,o],E=S?[k,k]:C,M=[_[0]*x[2]||1+E[0]/2,_[1]*x[2]||1+E[1]/2],A=`${v}${e||""}`;return a.jsxs("svg",{className:Bt(["react-flow__background",h]),style:{...f,...Jp,"--xy-background-color-props":u,"--xy-background-pattern-color-props":c},ref:g,"data-testid":"rf__background",children:[a.jsx("pattern",{id:A,x:x[0]%C[0],y:x[1]%C[1],width:C[0],height:C[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${M[0]},-${M[1]})`,children:w?a.jsx(QZ,{radius:k/2,className:p}):a.jsx(WZ,{dimensions:E,lineWidth:r,variant:t,className:p})}),a.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${A})`})]})}OD.displayName="Background";const bN=R.memo(OD);function JZ(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:a.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function eJ(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:a.jsx("path",{d:"M0 0h32v4.2H0z"})})}function tJ(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:a.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function nJ(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:a.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function sJ(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:a.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function xh({children:e,className:t,...n}){return a.jsx("button",{type:"button",className:Bt(["react-flow__controls-button",t]),...n,children:e})}const rJ=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function LD({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:s=!0,fitViewOptions:r,onZoomIn:o,onZoomOut:c,onFitView:u,onInteractiveChange:f,className:h,children:p,position:g="bottom-left",orientation:x="vertical","aria-label":v}){const b=Nt(),{isInteractive:w,minZoomReached:S,maxZoomReached:N,ariaLabelConfig:C}=Je(rJ,jt),{zoomIn:k,zoomOut:_,fitView:E}=Zp(),M=()=>{k(),o==null||o()},A=()=>{_(),c==null||c()},O=()=>{E(r),u==null||u()},L=()=>{b.setState({nodesDraggable:!w,nodesConnectable:!w,elementsSelectable:!w}),f==null||f(!w)},P=x==="horizontal"?"horizontal":"vertical";return a.jsxs(pd,{className:Bt(["react-flow__controls",P,h]),position:g,style:e,"data-testid":"rf__controls","aria-label":v??C["controls.ariaLabel"],children:[t&&a.jsxs(a.Fragment,{children:[a.jsx(xh,{onClick:M,className:"react-flow__controls-zoomin",title:C["controls.zoomIn.ariaLabel"],"aria-label":C["controls.zoomIn.ariaLabel"],disabled:N,children:a.jsx(JZ,{})}),a.jsx(xh,{onClick:A,className:"react-flow__controls-zoomout",title:C["controls.zoomOut.ariaLabel"],"aria-label":C["controls.zoomOut.ariaLabel"],disabled:S,children:a.jsx(eJ,{})})]}),n&&a.jsx(xh,{className:"react-flow__controls-fitview",onClick:O,title:C["controls.fitView.ariaLabel"],"aria-label":C["controls.fitView.ariaLabel"],children:a.jsx(tJ,{})}),s&&a.jsx(xh,{className:"react-flow__controls-interactive",onClick:L,title:C["controls.interactive.ariaLabel"],"aria-label":C["controls.interactive.ariaLabel"],children:w?a.jsx(sJ,{}):a.jsx(nJ,{})}),p]})}LD.displayName="Controls";const xd=R.memo(LD);function iJ({id:e,x:t,y:n,width:s,height:r,style:o,color:c,strokeColor:u,strokeWidth:f,className:h,borderRadius:p,shapeRendering:g,selected:x,onClick:v}){const{background:b,backgroundColor:w}=o||{},S=c||b||w;return a.jsx("rect",{className:Bt(["react-flow__minimap-node",{selected:x},h]),x:t,y:n,rx:p,ry:p,width:s,height:r,style:{fill:S,stroke:u,strokeWidth:f},shapeRendering:g,onClick:v?N=>v(N,e):void 0})}const aJ=R.memo(iJ),oJ=e=>e.nodes.map(t=>t.id),gv=e=>e instanceof Function?e:()=>e;function lJ({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:s=5,nodeStrokeWidth:r,nodeComponent:o=aJ,onClick:c}){const u=Je(oJ,jt),f=gv(t),h=gv(e),p=gv(n),g=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return a.jsx(a.Fragment,{children:u.map(x=>a.jsx(uJ,{id:x,nodeColorFunc:f,nodeStrokeColorFunc:h,nodeClassNameFunc:p,nodeBorderRadius:s,nodeStrokeWidth:r,NodeComponent:o,onClick:c,shapeRendering:g},x))})}function cJ({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:s,nodeBorderRadius:r,nodeStrokeWidth:o,shapeRendering:c,NodeComponent:u,onClick:f}){const{node:h,x:p,y:g,width:x,height:v}=Je(b=>{const w=b.nodeLookup.get(e);if(!w)return{node:void 0,x:0,y:0,width:0,height:0};const S=w.internals.userNode,{x:N,y:C}=w.internals.positionAbsolute,{width:k,height:_}=$r(S);return{node:S,x:N,y:C,width:k,height:_}},jt);return!h||h.hidden||!$P(h)?null:a.jsx(u,{x:p,y:g,width:x,height:v,style:h.style,selected:!!h.selected,className:s(h),color:t(h),borderRadius:r,strokeColor:n(h),strokeWidth:o,shapeRendering:c,onClick:f,id:h.id})}const uJ=R.memo(cJ);var dJ=R.memo(lJ);const fJ=200,hJ=150,pJ=e=>!e.hidden,mJ=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?qP(dd(e.nodeLookup,{filter:pJ}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},gJ="react-flow__minimap-desc";function PD({style:e,className:t,nodeStrokeColor:n,nodeColor:s,nodeClassName:r="",nodeBorderRadius:o=5,nodeStrokeWidth:c,nodeComponent:u,bgColor:f,maskColor:h,maskStrokeColor:p,maskStrokeWidth:g,position:x="bottom-right",onClick:v,onNodeClick:b,pannable:w=!1,zoomable:S=!1,ariaLabel:N,inversePan:C,zoomStep:k=1,offsetScale:_=5}){const E=Nt(),M=R.useRef(null),{boundingRect:A,viewBB:O,rfId:L,panZoom:P,translateExtent:I,flowWidth:B,flowHeight:F,ariaLabelConfig:z}=Je(mJ,jt),Y=(e==null?void 0:e.width)??fJ,$=(e==null?void 0:e.height)??hJ,V=A.width/Y,G=A.height/$,Z=Math.max(V,G),J=Z*Y,D=Z*$,U=_*Z,te=A.x-(J-A.width)/2-U,H=A.y-(D-A.height)/2-U,W=J+U*2,Q=D+U*2,se=`${gJ}-${L}`,re=R.useRef(0),ce=R.useRef();re.current=Z,R.useEffect(()=>{if(M.current&&P)return ce.current=BQ({domNode:M.current,panZoom:P,getTransform:()=>E.getState().transform,getViewScale:()=>re.current}),()=>{var xe;(xe=ce.current)==null||xe.destroy()}},[P]),R.useEffect(()=>{var xe;(xe=ce.current)==null||xe.update({translateExtent:I,width:B,height:F,inversePan:C,pannable:w,zoomStep:k,zoomable:S})},[w,S,C,k,I,B,F]);const me=v?xe=>{var Oe;const[Se,je]=((Oe=ce.current)==null?void 0:Oe.pointer(xe))||[0,0];v(xe,{x:Se,y:je})}:void 0,ge=b?R.useCallback((xe,Se)=>{const je=E.getState().nodeLookup.get(Se).internals.userNode;b(xe,je)},[]):void 0,ye=N??z["minimap.ariaLabel"];return a.jsx(pd,{position:x,style:{...e,"--xy-minimap-background-color-props":typeof f=="string"?f:void 0,"--xy-minimap-mask-background-color-props":typeof h=="string"?h:void 0,"--xy-minimap-mask-stroke-color-props":typeof p=="string"?p:void 0,"--xy-minimap-mask-stroke-width-props":typeof g=="number"?g*Z:void 0,"--xy-minimap-node-background-color-props":typeof s=="string"?s:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof c=="number"?c:void 0},className:Bt(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:a.jsxs("svg",{width:Y,height:$,viewBox:`${te} ${H} ${W} ${Q}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":se,ref:M,onClick:me,children:[ye&&a.jsx("title",{id:se,children:ye}),a.jsx(dJ,{onClick:ge,nodeColor:s,nodeStrokeColor:n,nodeBorderRadius:o,nodeClassName:r,nodeStrokeWidth:c,nodeComponent:u}),a.jsx("path",{className:"react-flow__minimap-mask",d:`M${te-U},${H-U}h${W+U*2}v${Q+U*2}h${-W-U*2}z
332
+ M${O.x},${O.y}h${O.width}v${O.height}h${-O.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}PD.displayName="MiniMap";R.memo(PD);const xJ=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,vJ={[Yl.Line]:"right",[Yl.Handle]:"bottom-right"};function yJ({nodeId:e,position:t,variant:n=Yl.Handle,className:s,style:r=void 0,children:o,color:c,minWidth:u=10,minHeight:f=10,maxWidth:h=Number.MAX_VALUE,maxHeight:p=Number.MAX_VALUE,keepAspectRatio:g=!1,resizeDirection:x,autoScale:v=!0,shouldResize:b,onResizeStart:w,onResize:S,onResizeEnd:N}){const C=pD(),k=typeof e=="string"?e:C,_=Nt(),E=R.useRef(null),M=n===Yl.Handle,A=Je(R.useCallback(xJ(M&&v),[M,v]),jt),O=R.useRef(null),L=t??vJ[n];R.useEffect(()=>{if(!(!E.current||!k))return O.current||(O.current=tX({domNode:E.current,nodeId:k,getStoreItems:()=>{const{nodeLookup:I,transform:B,snapGrid:F,snapToGrid:z,nodeOrigin:Y,domNode:$}=_.getState();return{nodeLookup:I,transform:B,snapGrid:F,snapToGrid:z,nodeOrigin:Y,paneDomNode:$}},onChange:(I,B)=>{const{triggerNodeChanges:F,nodeLookup:z,parentLookup:Y,nodeOrigin:$}=_.getState(),V=[],G={x:I.x,y:I.y},Z=z.get(k);if(Z&&Z.expandParent&&Z.parentId){const J=Z.origin??$,D=I.width??Z.measured.width??0,U=I.height??Z.measured.height??0,te={id:Z.id,parentId:Z.parentId,rect:{width:D,height:U,...zP({x:I.x??Z.position.x,y:I.y??Z.position.y},{width:D,height:U},Z.parentId,z,J)}},H=vN([te],z,Y,$);V.push(...H),G.x=I.x?Math.max(J[0]*D,I.x):void 0,G.y=I.y?Math.max(J[1]*U,I.y):void 0}if(G.x!==void 0&&G.y!==void 0){const J={id:k,type:"position",position:{...G}};V.push(J)}if(I.width!==void 0&&I.height!==void 0){const D={id:k,type:"dimensions",resizing:!0,setAttributes:x?x==="horizontal"?"width":"height":!0,dimensions:{width:I.width,height:I.height}};V.push(D)}for(const J of B){const D={...J,type:"position"};V.push(D)}F(V)},onEnd:({width:I,height:B})=>{const F={id:k,type:"dimensions",resizing:!1,dimensions:{width:I,height:B}};_.getState().triggerNodeChanges([F])}})),O.current.update({controlPosition:L,boundaries:{minWidth:u,minHeight:f,maxWidth:h,maxHeight:p},keepAspectRatio:g,resizeDirection:x,onResizeStart:w,onResize:S,onResizeEnd:N,shouldResize:b}),()=>{var I;(I=O.current)==null||I.destroy()}},[L,u,f,h,p,g,w,S,N,b]);const P=L.split("-");return a.jsx("div",{className:Bt(["react-flow__resize-control","nodrag",...P,n,s]),ref:E,style:{...r,scale:A,...c&&{[M?"backgroundColor":"borderColor"]:c}},children:o})}R.memo(yJ);async function bJ(e){const t=await fetch(`/api/rigs/${encodeURIComponent(e)}/graph`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}function wJ(e){return Ze({queryKey:["rig",e,"graph"],queryFn:()=>bJ(e),enabled:!!e,refetchInterval:3e4})}const SJ=100;function jJ(e){const t=Wt(),[n,s]=R.useState(!1),[r,o]=R.useState(!1),c=R.useRef(!1),u=R.useRef(null),f=R.useCallback(()=>{e&&(u.current||(u.current=setTimeout(()=>{u.current=null,t.invalidateQueries({queryKey:["rig",e,"graph"]})},SJ)))},[e,t]);return R.useEffect(()=>{if(!e){s(!1),o(!1);return}c.current=!1,s(!1),o(!1);const h=PL(g=>{if(s(g.connected),o(g.reconnecting),g.reconnecting){c.current=!0;return}g.connected&&c.current&&(c.current=!1,f())}),p=Lp(g=>{g.rigId===e&&f()});return()=>{p(),h(),u.current&&(clearTimeout(u.current),u.current=null)}},[e,f]),{connected:n,reconnecting:r}}const dl="#546073",uu={type:Ul.ArrowClosed,color:dl,width:12,height:12};function NJ(e){switch(e){case"delegates_to":return{style:{stroke:dl,strokeWidth:1.5},animated:!1,type:"smoothstep",pathOptions:{borderRadius:18,offset:20},markerEnd:uu,label:void 0};case"spawned_by":return{style:{stroke:dl,strokeWidth:1.5,strokeDasharray:"6 3"},animated:!1,type:"smoothstep",pathOptions:{borderRadius:18,offset:20},markerEnd:uu,label:void 0};case"can_observe":return{style:{stroke:dl,strokeWidth:1,strokeDasharray:"4 2"},animated:!1,type:"smoothstep",pathOptions:{borderRadius:18,offset:20},markerEnd:uu,label:void 0};case"uses":return{style:{stroke:dl,strokeWidth:1,strokeDasharray:"2 2"},animated:!1,type:"smoothstep",pathOptions:{borderRadius:18,offset:20},markerEnd:uu,label:void 0};default:return{style:{stroke:dl,strokeWidth:1},animated:!1,type:"smoothstep",pathOptions:{borderRadius:18,offset:20},markerEnd:uu,label:void 0}}}function TA(e){return e.type==="group"||e.type==="podGroup"}const Su=240,ju=160,vp=3,DD=36,qD=32,$D=28,zD=44,_J=28,CJ=120,kJ=0,RJ=new Set(["delegates_to","spawned_by"]);function EJ(e,t){if(e.length<=1)return e;const n=new Set(e.filter(h=>TA(h)).map(h=>h.id)),s=new Map;for(const h of e)typeof h.parentId!="string"||!n.has(h.parentId)||(s.has(h.parentId)||s.set(h.parentId,[]),s.get(h.parentId).push(h));const r=[],o=new Map;for(const h of e){if(TA(h)){const p=s.get(h.id)??[],{width:g,height:x}=TJ(p.length);r.push({id:h.id,kind:"group",node:h,width:g,height:x,members:p}),o.set(h.id,h.id);for(const v of p)o.set(v.id,h.id);continue}typeof h.parentId=="string"&&n.has(h.parentId)||(r.push({id:h.id,kind:"standalone",node:h,width:Su,height:ju,members:[]}),o.set(h.id,h.id))}if(r.length===0)return e;const c=AJ(t,o),u=OJ(r,c),f=new Map;for(const h of e)f.set(h.id,{...h});for(const h of r){const p=u.get(h.id);if(!p)continue;if(h.kind==="standalone"){const x=f.get(h.node.id);x.position={x:p.x,y:p.y},x.initialWidth=Su,x.initialHeight=ju;continue}const g=f.get(h.node.id);g.position={x:p.x,y:p.y},g.initialWidth=h.width,g.initialHeight=h.height,g.style={...g.style??{},width:h.width,height:h.height,background:"linear-gradient(180deg, rgba(84, 96, 115, 0.08) 0px, rgba(84, 96, 115, 0.08) 32px, rgba(255, 255, 255, 0.22) 32px, rgba(255, 255, 255, 0.22) 100%)",border:"1px dashed rgba(84, 96, 115, 0.45)",boxShadow:"0 0 0 1px rgba(84, 96, 115, 0.10)"};for(let x=0;x<h.members.length;x+=1){const v=h.members[x],b=f.get(v.id);b.position=MJ(x),b.initialWidth=Su,b.initialHeight=ju}}return e.map(h=>f.get(h.id)??h)}function AJ(e,t){const n=MA(e.filter(s=>RJ.has(IJ(s))),t);return n.length>0?n:MA(e,t)}function MA(e,t){const n=new Map;for(const s of e){const r=t.get(s.source),o=t.get(s.target);if(!r||!o||r===o)continue;const c=`${r}->${o}`;n.has(c)||n.set(c,{source:r,target:o})}return Array.from(n.values())}function TJ(e){const t=Math.max(e,1),n=Math.min(t,vp),s=Math.ceil(t/vp),r=n*Su+Math.max(n-1,0)*DD,o=s*ju+Math.max(s-1,0)*qD;return{width:r+$D*2,height:o+zD+_J}}function MJ(e){const t=e%vp,n=Math.floor(e/vp);return{x:$D+t*(Su+DD),y:zD+n*(ju+qD)}}function IJ(e){var t;return((t=e.data)==null?void 0:t.kind)??e.label??""}function OJ(e,t){const n=new Map(e.map(v=>[v.id,v])),s=new Map,r=new Map,o=[],c=new Set;for(const v of e)s.set(v.id,new Set),r.set(v.id,0);for(const v of t)!n.has(v.source)||!n.has(v.target)||s.get(v.source).has(v.target)||(s.get(v.source).add(v.target),r.set(v.target,(r.get(v.target)??0)+1));const u=e.filter(v=>{var b;return(r.get(v.id)??0)===0&&(((b=s.get(v.id))==null?void 0:b.size)??0)>0}).map(v=>v.id).sort((v,b)=>vh(v,b,s,e)),f=e.filter(v=>{var b;return(r.get(v.id)??0)===0&&(((b=s.get(v.id))==null?void 0:b.size)??0)===0}).map(v=>v.id).sort((v,b)=>vh(v,b,s,e)),h=v=>{const b=new Map(r),w=[...v],S=new Set(w);for(;w.length>0;){const N=w.shift();if(c.has(N))continue;c.add(N),o.push(N);const C=Array.from(s.get(N)??[]).sort((_,E)=>vh(_,E,s,e));for(const _ of C)b.set(_,(b.get(_)??1)-1);const k=C.filter(_=>(b.get(_)??0)===0&&!c.has(_)&&!S.has(_));for(const _ of k)w.push(_),S.add(_)}};h(u),h(f);const p=e.map(v=>v.id).filter(v=>!c.has(v)).sort((v,b)=>vh(v,b,s,e));o.push(...p);const g=new Map;let x=0;for(const v of o){const b=n.get(v);b&&(g.set(b.id,{x:kJ,y:x}),x+=b.height+CJ)}return g}function vh(e,t,n,s){var c,u;const r=((c=n.get(e))==null?void 0:c.size)??0,o=((u=n.get(t))==null?void 0:u.size)??0;return r!==o?o-r:s.findIndex(f=>f.id===e)-s.findIndex(f=>f.id===t)}function BD(e,t){return t!=="known"||typeof e!="number"?"unknown":e>=80?"critical":e>=60?"warning":"low"}const LJ={critical:"border-red-500",warning:"border-amber-500",low:"border-emerald-500",unknown:"border-stone-400 border-dotted"},PJ={critical:"text-red-600",warning:"text-amber-600",low:"text-green-700",unknown:"text-stone-300"};function FD(e,t,n){const s=BD(e,n??void 0);return`${PJ[s]}${s!=="unknown"&&t===!1?" opacity-50":""}`}function DJ({percent:e,fresh:t,availability:n,testIdSuffix:s}){const r=BD(e,n),o=[];r==="unknown"?o.push("context: unknown"):typeof e=="number"&&o.push(`context: ${e}% (${r})`),r!=="unknown"&&t===!1&&o.push("stale sample");const c=o.join(" · ");return a.jsx("span",{"data-testid":s?`context-ring-${s}`:"context-ring","data-context-tier":r,className:`inline-block h-2.5 w-2.5 rounded-full border-2 bg-transparent ${LJ[r]}${r!=="unknown"&&t===!1?" opacity-50":""}`,"aria-label":c||"context usage",title:c||"context usage"})}const qJ={active:"border-emerald-500/70 shadow-[0_0_0_1px_rgba(16,185,129,0.10)]",needs_input:"border-amber-500/80 shadow-[0_0_0_1px_rgba(245,158,11,0.15)]",blocked:"border-red-600/80 shadow-[0_0_0_1px_rgba(220,38,38,0.16)]"},$J={active:"activity-ring-active",needs_input:"activity-ring-needs-input",blocked:"activity-ring-blocked"};function wN({as:e="div",state:t,flash:n=null,reducedMotion:s=!1,children:r,className:o,ringClassName:c,testId:u}){const f=e;return a.jsxs(f,{className:he("relative",e==="span"?"inline-flex":"block",o),children:[t!=="idle"?a.jsx("span",{"aria-hidden":"true","data-testid":u,"data-activity-ring-state":t,"data-activity-flash":n??"none","data-reduced-motion":s?"true":"false",className:he("pointer-events-none absolute -inset-1 rounded-[inherit] border",qJ[t],!s&&$J[t],n==="source"&&"activity-ring-source-flash",n==="target"&&"activity-ring-target-flash",c)}):null,r]})}function zJ(e){return e==="running"?"active":e==="needs_input"?"needs_input":"idle"}function HD(e){var t,n;return{state:((t=e.activityRing)==null?void 0:t.state)??zJ(e.activityState),flash:((n=e.activityRing)==null?void 0:n.flash)??null}}function UD(e){return he("activity-card-surface",e.state==="active"&&"activity-card-active",e.state==="needs_input"&&"activity-card-needs-input",e.state==="blocked"&&"activity-card-blocked",e.flash==="source"&&"activity-card-source-flash",e.flash==="target"&&"activity-card-target-flash",e.reducedMotion&&"activity-card-reduced-motion")}function BJ(e){return e.scrollHeight-e.scrollTop-e.clientHeight<=4}function em({sessionName:e,lines:t,paused:n,testIdPrefix:s="session-preview",variant:r="default"}){var g,x;const o=cG({sessionName:e,lines:t,paused:n}),c=R.useRef(null),u=R.useRef(!0),f=Ca(o.data)||(g=o.data)==null?void 0:g.content,h=r==="compact-terminal";R.useLayoutEffect(()=>{const v=c.current;!v||!o.data||Ca(o.data)||u.current&&(v.scrollTop=v.scrollHeight)},[f,o.data]);const p=()=>{const v=c.current;v&&(u.current=BJ(v))};return a.jsxs("div",{"data-testid":`${s}-pane`,"data-session-name":e,"data-variant":r,className:he("space-y-1",h?"border-0 bg-transparent p-0 text-stone-50":"border border-stone-300/40 bg-white/8 px-3 py-2"),children:[!h&&a.jsxs("div",{className:"font-mono text-[9px] uppercase tracking-[0.10em] text-stone-500 truncate",children:["live preview · ",e]}),o.isLoading&&a.jsx("div",{"data-testid":`${s}-loading`,className:"font-mono text-[9px] text-stone-400",children:"Loading…"}),o.isError&&a.jsx("div",{"data-testid":`${s}-error`,className:he("font-mono text-[9px]",h?"text-red-200":"text-red-600"),children:((x=o.error)==null?void 0:x.message)??"Preview failed."}),Ca(o.data)&&a.jsx("div",{"data-testid":`${s}-unavailable`,className:he("font-mono space-y-0.5",h?"text-[10px] text-stone-50":"text-[9px] text-stone-500"),children:h?a.jsxs(a.Fragment,{children:[a.jsx("div",{children:"Preview unavailable."}),a.jsx("div",{className:"text-stone-400",children:"$ waiting for terminal output"})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{children:["Preview unavailable: ",o.data.reason,"."]}),o.data.hint&&a.jsx("div",{className:"text-stone-400",children:o.data.hint}),a.jsxs("div",{className:"text-stone-400",children:["Use ",a.jsxs("code",{children:["rig capture ",e]})," from terminal as a fallback."]})]})}),!Ca(o.data)&&o.data&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{ref:c,"data-testid":`${s}-content`,onScroll:p,className:he("font-mono",h?"scrollbar-none max-h-72 overflow-y-auto overflow-x-hidden whitespace-pre-wrap break-words bg-transparent px-1 py-0.5 text-[8px] leading-[1.2] text-stone-50":"max-h-32 overflow-y-auto whitespace-pre-wrap break-all bg-stone-50 px-2 py-1 text-[9px] text-stone-800"),children:o.data.content||"(empty pane)"}),!h&&a.jsxs("div",{className:"font-mono text-[8px] text-stone-400 flex justify-between",children:[a.jsxs("span",{children:["captured"," ",new Date(o.data.capturedAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})]}),a.jsxs("span",{children:[o.data.lines," lines"]})]})]})]})}const xv="openrig:topology-terminal-preview",vv=8,fn=8,IA=408,OA=240;function LA(e){const t=e==null?void 0:e.getBoundingClientRect();return{left:(t==null?void 0:t.left)??fn,right:(t==null?void 0:t.right)??fn,top:(t==null?void 0:t.top)??fn,bottom:(t==null?void 0:t.bottom)??fn}}function PA(e,t,n){return Math.min(Math.max(e,t),n)}function DA(e,t,n,s){const r=typeof window>"u"?t+fn*2:window.innerWidth,o=typeof window>"u"?n+fn*2:window.innerHeight,c=e.right+vv,u=e.left-t-vv,f=c+t<=r-fn?c:u,h=e.top,p=e.top-n-vv,g=h+n<=o-fn?h:p>=fn?p:o-n-fn;return{left:PA(f,fn,Math.max(fn,r-t-fn)),top:PA(g,fn,Math.max(fn,o-n-fn))}}function VD({rigId:e,logicalId:t,sessionName:n,reducedMotion:s,wrapperClassName:r,buttonClassName:o,popoverClassName:c,testIdPrefix:u}){const f=`${e??"unknown"}:${t}`,h=R.useRef(null),p=R.useRef(null),[g,x]=R.useState(!1),[v,b]=R.useState(null),w=R.useCallback(()=>{var E,M;if(!g)return;const C=LA(h.current),k=((E=p.current)==null?void 0:E.offsetWidth)||IA,_=((M=p.current)==null?void 0:M.offsetHeight)||OA;b(DA(C,k,_))},[g]);if(R.useEffect(()=>{const C=k=>{const _=k.detail,E=(_==null?void 0:_.key)===f;if(x(E),E){const M=LA(h.current);b(DA(M,IA,OA))}};return window.addEventListener(xv,C),()=>window.removeEventListener(xv,C)},[f]),R.useLayoutEffect(()=>{if(!g||!p.current)return;w();const C=window.requestAnimationFrame(w);return()=>window.cancelAnimationFrame(C)},[g,w]),R.useEffect(()=>{if(!g)return;const C=()=>w(),k=typeof ResizeObserver>"u"||!p.current?null:new ResizeObserver(C);return p.current&&(k==null||k.observe(p.current)),window.addEventListener("resize",C),window.addEventListener("scroll",C,!0),()=>{k==null||k.disconnect(),window.removeEventListener("resize",C),window.removeEventListener("scroll",C,!0)}},[g,w]),R.useEffect(()=>{if(!g)return;const C=k=>{var E,M;const _=k.target;_ instanceof Node&&((E=h.current)!=null&&E.contains(_)||(M=p.current)!=null&&M.contains(_)||x(!1))};return document.addEventListener("pointerdown",C),()=>document.removeEventListener("pointerdown",C)},[g]),!n)return null;const S=C=>{C.stopPropagation(),window.dispatchEvent(new CustomEvent(xv,{detail:{key:f}}))},N=g&&v?Rp.createPortal(a.jsx("div",{ref:p,"data-testid":`${u}-terminal-popover`,"data-reduced-motion":s?"true":"false",className:he("nodrag nopan fixed z-[1000] max-h-[calc(100vh-1rem)] w-[calc(80ch+24px)] max-w-[calc(100vw-1rem)] overflow-hidden bg-stone-950/65 p-1.5 backdrop-blur-sm","cursor-default select-text font-mono text-[8px] text-stone-50",c),style:{left:v.left,top:v.top},onClick:C=>C.stopPropagation(),onPointerDown:C=>C.stopPropagation(),children:a.jsx(em,{sessionName:n,lines:80,testIdPrefix:`${u}-terminal-preview`,variant:"compact-terminal"})}),document.body):null;return a.jsxs("div",{ref:h,className:he("relative inline-flex",r),children:[a.jsx("button",{type:"button","data-testid":`${u}-terminal-open`,"aria-label":`View ${t} terminal`,title:"View terminal",onClick:S,className:o,children:a.jsx(Pe,{tool:"terminal",size:"sm"})}),N]})}function Vu(e){return typeof e!="number"||!Number.isFinite(e)||e<0?null:Math.round(e)}function qA(e){const n=Math.abs(e)<10?Math.round(e*10)/10:Math.round(e);return String(n).replace(/\.0$/,"")}function Za(e,t){const n=Vu(e),s=Vu(t);return n===null&&s===null?null:(n??0)+(s??0)}function tm(e){const t=Vu(e);return t===null?null:t>=999500?`${qA(t/1e6)}m`:t>=1e3?`${qA(t/1e3)}k`:t.toLocaleString("en-US")}function nm(e,t){const n=Vu(e),s=Vu(t),r=Za(n,s);if(r===null)return null;const o=[`Tokens: ${r.toLocaleString("en-US")}`];return n!==null&&o.push(`Input: ${n.toLocaleString("en-US")}`),s!==null&&o.push(`Output: ${s.toLocaleString("en-US")}`),o.join(`
333
+ `)}function FJ(e){return e==="architect"||e==="lead"||e==="orchestrator"}function HJ({data:e}){var Y,$,V;const t=R.useRef(e.startupStatus),n=R.useRef(null),[s,r]=R.useState(!1),[o,c]=R.useState(null),u=FJ(e.role),f=e.nodeKind==="infrastructure";R.useEffect(()=>{if(t.current!==e.startupStatus&&t.current!==null){r(!0);const G=setTimeout(()=>r(!1),600);return t.current=e.startupStatus,()=>clearTimeout(G)}t.current=e.startupStatus},[e.startupStatus]),R.useEffect(()=>()=>{n.current&&clearTimeout(n.current)},[]);const h=e.runtime||e.model?EL(e.runtime,e.model):null,p=Op(e.logicalId),g=Ij(e.agentActivity),x=Oj(g),v=pL(g),b=mL(g),w=Lj(e.agentActivity),S=HD({activityRing:e.activityRing,activityState:g}),N=Za(e.contextTotalInputTokens,e.contextTotalOutputTokens),C=tm(N),k=nm(e.contextTotalInputTokens,e.contextTotalOutputTokens),_=e.placementState==="selected"?"target":e.placementState==="available"?"avail":null,E=e.currentQitems??[],M=E.length>0?E.map(G=>`On: ${w7(G.qitemId)} — ${G.bodyExcerpt}`):[],A=[`Activity: ${x}${w?" (stale sample)":""}`,e.canonicalSessionName?`Session: ${e.canonicalSessionName}`:null,h?`Runtime: ${h}`:null,e.resolvedSpecName?`Spec: ${e.resolvedSpecName}`:null,e.profile?`Profile: ${e.profile}`:null,typeof e.edgeCount=="number"?`Edges: ${e.edgeCount}`:null,k,...M].filter(G=>!!G),O=A.join(`
334
+ `),L=G=>{n.current&&clearTimeout(n.current),c(G),n.current=setTimeout(()=>{c(Z=>Z===G?null:Z),n.current=null},900)},P=async G=>{if(G.stopPropagation(),!!e.rigId)try{(await fetch(`/api/rigs/${encodeURIComponent(e.rigId)}/nodes/${encodeURIComponent(e.logicalId)}/open-cmux`,{method:"POST"})).ok&&L("cmux")}catch{}},I=G=>`inline-flex items-center gap-1 px-1.5 py-0.5 border font-mono text-[7px] uppercase transition-colors ${o===G?"bg-stone-900 text-white border-stone-900":"bg-white text-stone-900 border-stone-300 hover:bg-stone-100"}`,B="border font-mono text-[7px] uppercase transition-colors bg-white text-stone-900 border-stone-300 hover:bg-stone-100 inline-flex h-6 w-6 items-center justify-center px-0 py-0",F=e.canonicalSessionName??((Y=e.binding)==null?void 0:Y.tmuxSession)??null,z=a.jsxs("div",{className:he("group relative min-w-[200px] border hard-shadow transition-[background-color,border-color,box-shadow] duration-300",UD({state:S.state,flash:S.flash,reducedMotion:e.reducedMotion}),e.placementState==="selected"?"border-emerald-600 ring-2 ring-emerald-400/70 shadow-[0_0_0_3px_rgba(52,211,153,0.12)]":e.placementState==="available"?"border-emerald-500 ring-1 ring-emerald-300/70":"border-stone-900"),"data-activity-card-state":S.state,"data-activity-card-flash":S.flash??"none","data-testid":"rig-node",title:O||void 0,children:[a.jsx(gn,{type:"target",position:ve.Top}),a.jsxs("div",{className:`px-3 py-1 font-mono text-[10px] flex justify-between items-center ${f?"bg-stone-500 text-white border-b border-stone-900":u?"bg-stone-900 text-white":"bg-stone-200 text-stone-900 border-b border-stone-900"}`,children:[a.jsx("span",{className:"font-bold truncate",children:p}),a.jsxs("span",{className:"inline-flex items-center gap-1",children:[w&&a.jsx("span",{"data-testid":`activity-staleness-${e.logicalId}`,className:"font-mono text-[7px] uppercase tracking-[0.10em] text-stone-300",title:"Activity sample is older than threshold; daemon may not be probing this seat",children:"stale"}),a.jsx("span",{className:`inline-flex h-2.5 w-2.5 rounded-full border border-white/50 ${v} ${b} ${s?"status-changed":""}`,"data-testid":`activity-dot-${e.logicalId}`,"data-activity-state":g,"aria-label":`activity: ${x}`,title:`activity: ${x}`}),a.jsx(DJ,{percent:e.contextUsedPercentage,fresh:e.contextFresh,availability:e.contextAvailability,testIdSuffix:e.logicalId})]})]}),a.jsxs("div",{className:"space-y-1 px-2 py-1.5",children:[a.jsx("div",{className:"truncate font-mono text-[8px] leading-tight text-stone-500",children:e.canonicalSessionName??e.logicalId}),a.jsxs("div",{className:"min-w-0",children:[a.jsx(_n,{runtime:e.runtime,model:e.model,size:"xs",compact:!0,variant:"inline",className:"max-w-full"}),!h&&e.profile?a.jsx("span",{className:"ml-1 font-mono text-[8px] uppercase tracking-[0.12em] text-stone-400",children:e.profile}):null]}),e.resolvedSpecName&&a.jsxs("div",{className:"font-mono text-[8px] text-stone-400","data-testid":"spec-hint",children:[e.resolvedSpecName,e.profile?` · ${e.profile}`:""]}),a.jsxs("div",{className:"flex items-end justify-between gap-3 pt-0.5",children:[e.contextAvailability==="known"&&typeof e.contextUsedPercentage=="number"?a.jsxs("div",{className:`font-mono text-base font-bold leading-none ${e.contextUsedPercentage>=80?"text-red-600":e.contextUsedPercentage>=60?"text-amber-600":"text-green-700"}${e.contextFresh?"":" opacity-50"}`,"data-testid":"context-badge",title:e.contextFresh?"Context usage (fresh)":"Context usage (stale sample)",children:[e.contextUsedPercentage,"%"]}):a.jsx("div",{className:"font-mono text-xs text-stone-400","data-testid":"context-badge-unknown",children:"?"}),a.jsx("div",{className:`font-mono text-base font-bold leading-none tracking-[0.02em] ${C?"text-stone-500":"text-stone-300"}`,"data-testid":"token-total",title:k??"Token sample unavailable",children:C??"--"})]}),e.restoreOutcome&&e.restoreOutcome!=="n-a"&&a.jsxs("div",{className:"font-mono text-[8px] text-stone-500",children:["RESTORE: ",e.restoreOutcome]}),e.packageRefs&&e.packageRefs.length>0&&a.jsxs("div",{"data-testid":"package-badge",title:e.packageRefs.join(", "),className:"font-mono text-[8px] text-stone-400",onClick:G=>G.stopPropagation(),onKeyDown:G=>G.stopPropagation(),children:["PKG ",e.packageRefs.length]}),e.startupStatus==="attention_required"&&a.jsxs("div",{className:"stamp-badge",children:[a.jsx("div",{className:"w-2 h-2 rounded-full bg-orange-500"}),a.jsx("span",{className:"text-orange-600",children:"ATTN"})]}),e.startupStatus==="failed"&&a.jsxs("div",{className:"stamp-badge",children:[a.jsx("div",{className:"w-2 h-2 rounded-full bg-red-500"}),a.jsx("span",{className:"text-red-600",children:"FAILED"})]}),(F??e.rigId)&&a.jsxs("div",{"data-testid":"node-toolbar",className:"absolute right-2 top-8 z-20 flex flex-wrap justify-end gap-1 opacity-0 transition-opacity group-hover:!opacity-100 group-hover:opacity-100 group-focus-within:!opacity-100 group-focus-within:opacity-100",onClick:G=>G.stopPropagation(),onKeyDown:G=>G.stopPropagation(),children:[e.rigId&&a.jsxs("button",{onClick:P,"data-testid":"toolbar-cmux-open",className:`${I("cmux")} inline-flex h-6 w-6 items-center justify-center px-0 py-0`,"aria-label":"Open in cmux",title:"Open in cmux",children:[a.jsx(Pe,{tool:"cmux",size:"sm"}),a.jsx("span",{className:"sr-only",children:o==="cmux"?"opened":"cmux"})]}),e.rigId&&F&&a.jsx(VD,{rigId:e.rigId,logicalId:e.logicalId,sessionName:F,reducedMotion:e.reducedMotion,testIdPrefix:`rig-node-${e.logicalId}`,buttonClassName:B})]}),_&&a.jsx("div",{className:"pt-1",children:a.jsx("span",{"data-testid":`placement-chip-${e.logicalId}`,className:`inline-flex items-center border px-1.5 py-0.5 font-mono text-[7px] uppercase tracking-[0.12em] ${e.placementState==="selected"?"border-emerald-700 bg-emerald-700 text-white":"border-emerald-300 bg-emerald-50 text-emerald-800"}`,children:_})})]}),A.length>0&&a.jsx("div",{"data-testid":"node-hover-hint",className:"pointer-events-none absolute left-2 top-full z-20 mt-2 hidden min-w-[180px] border border-stone-900 bg-white px-2 py-1 font-mono text-[8px] text-stone-700 shadow-[4px_4px_0_rgba(28,25,23,0.14)] group-hover:block",children:A.map(G=>a.jsx("div",{children:G},G))}),a.jsx(gn,{type:"source",position:ve.Bottom})]});return a.jsx(wN,{state:(($=e.activityRing)==null?void 0:$.state)??"idle",flash:((V=e.activityRing)==null?void 0:V.flash)??null,reducedMotion:e.reducedMotion,testId:`rig-node-activity-ring-${e.logicalId}`,className:"rounded-none",children:z})}function GD({id:e,sourceX:t,sourceY:n,targetX:s,targetY:r,sourcePosition:o,targetPosition:c,style:u,markerEnd:f,data:h}){const[p]=hN({sourceX:t,sourceY:n,sourcePosition:o,targetX:s,targetY:r,targetPosition:c}),g=h??{},x=g.hotPotatoPacket??null,v=g.hotPotatoCrossRig??!1,b=g.hotPotatoReducedMotion??!1,w=x?v?1.25:2.25:u==null?void 0:u.strokeWidth;return a.jsxs(a.Fragment,{children:[a.jsx(md,{id:e,path:p,markerEnd:f,style:{...u,strokeWidth:w,filter:x?"drop-shadow(0 0 3px rgba(16,185,129,0.22))":u==null?void 0:u.filter}}),x?b?a.jsx("circle",{"data-testid":`hot-potato-packet-${x.id}`,"data-reduced-motion":"true",cx:s,cy:r,r:v?5:6.5,stroke:"rgba(255,255,255,0.88)",strokeWidth:v?1.75:2.25,vectorEffect:"non-scaling-stroke",className:v?"fill-stone-500":"fill-emerald-600"}):a.jsx("circle",{"data-testid":`hot-potato-packet-${x.id}`,"data-reduced-motion":"false",r:v?5:6.5,stroke:"rgba(255,255,255,0.88)",strokeWidth:v?1.75:2.25,vectorEffect:"non-scaling-stroke",className:v?"fill-stone-500 hot-potato-packet-cross":"fill-emerald-600 hot-potato-packet",children:a.jsx("animateMotion",{dur:`${x.durationMs}ms`,path:p,fill:"freeze",calcMode:"spline",keySplines:"0.2 0 0 1",keyTimes:"0;1"})},x.id):null]})}const UJ=$L("relative w-full p-4 bg-surface-low border-l-2 border-l-stone-900 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-on-surface",{variants:{variant:{default:"bg-background text-foreground",destructive:"text-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),Sn=R.forwardRef(({className:e,variant:t,...n},s)=>a.jsx("div",{ref:s,role:"alert",className:he(UJ({variant:t}),e),...n}));Sn.displayName="Alert";const VJ=R.forwardRef(({className:e,...t},n)=>a.jsx("h5",{ref:n,className:he("mb-1 font-medium leading-none tracking-tight",e),...t}));VJ.displayName="AlertTitle";const jn=R.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:he("text-sm [&_p]:leading-relaxed",e),...t}));jn.displayName="AlertDescription";function SN(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var yv,$A;function GJ(){if($A)return yv;$A=1;function e(){this.__data__=[],this.size=0}return yv=e,yv}var bv,zA;function Ql(){if(zA)return bv;zA=1;function e(t,n){return t===n||t!==t&&n!==n}return bv=e,bv}var wv,BA;function sm(){if(BA)return wv;BA=1;var e=Ql();function t(n,s){for(var r=n.length;r--;)if(e(n[r][0],s))return r;return-1}return wv=t,wv}var Sv,FA;function KJ(){if(FA)return Sv;FA=1;var e=sm(),t=Array.prototype,n=t.splice;function s(r){var o=this.__data__,c=e(o,r);if(c<0)return!1;var u=o.length-1;return c==u?o.pop():n.call(o,c,1),--this.size,!0}return Sv=s,Sv}var jv,HA;function YJ(){if(HA)return jv;HA=1;var e=sm();function t(n){var s=this.__data__,r=e(s,n);return r<0?void 0:s[r][1]}return jv=t,jv}var Nv,UA;function WJ(){if(UA)return Nv;UA=1;var e=sm();function t(n){return e(this.__data__,n)>-1}return Nv=t,Nv}var _v,VA;function QJ(){if(VA)return _v;VA=1;var e=sm();function t(n,s){var r=this.__data__,o=e(r,n);return o<0?(++this.size,r.push([n,s])):r[o][1]=s,this}return _v=t,_v}var Cv,GA;function rm(){if(GA)return Cv;GA=1;var e=GJ(),t=KJ(),n=YJ(),s=WJ(),r=QJ();function o(c){var u=-1,f=c==null?0:c.length;for(this.clear();++u<f;){var h=c[u];this.set(h[0],h[1])}}return o.prototype.clear=e,o.prototype.delete=t,o.prototype.get=n,o.prototype.has=s,o.prototype.set=r,Cv=o,Cv}var kv,KA;function XJ(){if(KA)return kv;KA=1;var e=rm();function t(){this.__data__=new e,this.size=0}return kv=t,kv}var Rv,YA;function ZJ(){if(YA)return Rv;YA=1;function e(t){var n=this.__data__,s=n.delete(t);return this.size=n.size,s}return Rv=e,Rv}var Ev,WA;function JJ(){if(WA)return Ev;WA=1;function e(t){return this.__data__.get(t)}return Ev=e,Ev}var Av,QA;function eee(){if(QA)return Av;QA=1;function e(t){return this.__data__.has(t)}return Av=e,Av}var Tv,XA;function KD(){if(XA)return Tv;XA=1;var e=typeof Yf=="object"&&Yf&&Yf.Object===Object&&Yf;return Tv=e,Tv}var Mv,ZA;function Is(){if(ZA)return Mv;ZA=1;var e=KD(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return Mv=n,Mv}var Iv,JA;function Xl(){if(JA)return Iv;JA=1;var e=Is(),t=e.Symbol;return Iv=t,Iv}var Ov,eT;function tee(){if(eT)return Ov;eT=1;var e=Xl(),t=Object.prototype,n=t.hasOwnProperty,s=t.toString,r=e?e.toStringTag:void 0;function o(c){var u=n.call(c,r),f=c[r];try{c[r]=void 0;var h=!0}catch{}var p=s.call(c);return h&&(u?c[r]=f:delete c[r]),p}return Ov=o,Ov}var Lv,tT;function nee(){if(tT)return Lv;tT=1;var e=Object.prototype,t=e.toString;function n(s){return t.call(s)}return Lv=n,Lv}var Pv,nT;function lo(){if(nT)return Pv;nT=1;var e=Xl(),t=tee(),n=nee(),s="[object Null]",r="[object Undefined]",o=e?e.toStringTag:void 0;function c(u){return u==null?u===void 0?r:s:o&&o in Object(u)?t(u):n(u)}return Pv=c,Pv}var Dv,sT;function ps(){if(sT)return Dv;sT=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return Dv=e,Dv}var qv,rT;function vd(){if(rT)return qv;rT=1;var e=lo(),t=ps(),n="[object AsyncFunction]",s="[object Function]",r="[object GeneratorFunction]",o="[object Proxy]";function c(u){if(!t(u))return!1;var f=e(u);return f==s||f==r||f==n||f==o}return qv=c,qv}var $v,iT;function see(){if(iT)return $v;iT=1;var e=Is(),t=e["__core-js_shared__"];return $v=t,$v}var zv,aT;function ree(){if(aT)return zv;aT=1;var e=see(),t=(function(){var s=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return s?"Symbol(src)_1."+s:""})();function n(s){return!!t&&t in s}return zv=n,zv}var Bv,oT;function YD(){if(oT)return Bv;oT=1;var e=Function.prototype,t=e.toString;function n(s){if(s!=null){try{return t.call(s)}catch{}try{return s+""}catch{}}return""}return Bv=n,Bv}var Fv,lT;function iee(){if(lT)return Fv;lT=1;var e=vd(),t=ree(),n=ps(),s=YD(),r=/[\\^$.*+?()[\]{}|]/g,o=/^\[object .+?Constructor\]$/,c=Function.prototype,u=Object.prototype,f=c.toString,h=u.hasOwnProperty,p=RegExp("^"+f.call(h).replace(r,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function g(x){if(!n(x)||t(x))return!1;var v=e(x)?p:o;return v.test(s(x))}return Fv=g,Fv}var Hv,cT;function aee(){if(cT)return Hv;cT=1;function e(t,n){return t==null?void 0:t[n]}return Hv=e,Hv}var Uv,uT;function co(){if(uT)return Uv;uT=1;var e=iee(),t=aee();function n(s,r){var o=t(s,r);return e(o)?o:void 0}return Uv=n,Uv}var Vv,dT;function jN(){if(dT)return Vv;dT=1;var e=co(),t=Is(),n=e(t,"Map");return Vv=n,Vv}var Gv,fT;function im(){if(fT)return Gv;fT=1;var e=co(),t=e(Object,"create");return Gv=t,Gv}var Kv,hT;function oee(){if(hT)return Kv;hT=1;var e=im();function t(){this.__data__=e?e(null):{},this.size=0}return Kv=t,Kv}var Yv,pT;function lee(){if(pT)return Yv;pT=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return Yv=e,Yv}var Wv,mT;function cee(){if(mT)return Wv;mT=1;var e=im(),t="__lodash_hash_undefined__",n=Object.prototype,s=n.hasOwnProperty;function r(o){var c=this.__data__;if(e){var u=c[o];return u===t?void 0:u}return s.call(c,o)?c[o]:void 0}return Wv=r,Wv}var Qv,gT;function uee(){if(gT)return Qv;gT=1;var e=im(),t=Object.prototype,n=t.hasOwnProperty;function s(r){var o=this.__data__;return e?o[r]!==void 0:n.call(o,r)}return Qv=s,Qv}var Xv,xT;function dee(){if(xT)return Xv;xT=1;var e=im(),t="__lodash_hash_undefined__";function n(s,r){var o=this.__data__;return this.size+=this.has(s)?0:1,o[s]=e&&r===void 0?t:r,this}return Xv=n,Xv}var Zv,vT;function fee(){if(vT)return Zv;vT=1;var e=oee(),t=lee(),n=cee(),s=uee(),r=dee();function o(c){var u=-1,f=c==null?0:c.length;for(this.clear();++u<f;){var h=c[u];this.set(h[0],h[1])}}return o.prototype.clear=e,o.prototype.delete=t,o.prototype.get=n,o.prototype.has=s,o.prototype.set=r,Zv=o,Zv}var Jv,yT;function hee(){if(yT)return Jv;yT=1;var e=fee(),t=rm(),n=jN();function s(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return Jv=s,Jv}var e0,bT;function pee(){if(bT)return e0;bT=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return e0=e,e0}var t0,wT;function am(){if(wT)return t0;wT=1;var e=pee();function t(n,s){var r=n.__data__;return e(s)?r[typeof s=="string"?"string":"hash"]:r.map}return t0=t,t0}var n0,ST;function mee(){if(ST)return n0;ST=1;var e=am();function t(n){var s=e(this,n).delete(n);return this.size-=s?1:0,s}return n0=t,n0}var s0,jT;function gee(){if(jT)return s0;jT=1;var e=am();function t(n){return e(this,n).get(n)}return s0=t,s0}var r0,NT;function xee(){if(NT)return r0;NT=1;var e=am();function t(n){return e(this,n).has(n)}return r0=t,r0}var i0,_T;function vee(){if(_T)return i0;_T=1;var e=am();function t(n,s){var r=e(this,n),o=r.size;return r.set(n,s),this.size+=r.size==o?0:1,this}return i0=t,i0}var a0,CT;function NN(){if(CT)return a0;CT=1;var e=hee(),t=mee(),n=gee(),s=xee(),r=vee();function o(c){var u=-1,f=c==null?0:c.length;for(this.clear();++u<f;){var h=c[u];this.set(h[0],h[1])}}return o.prototype.clear=e,o.prototype.delete=t,o.prototype.get=n,o.prototype.has=s,o.prototype.set=r,a0=o,a0}var o0,kT;function yee(){if(kT)return o0;kT=1;var e=rm(),t=jN(),n=NN(),s=200;function r(o,c){var u=this.__data__;if(u instanceof e){var f=u.__data__;if(!t||f.length<s-1)return f.push([o,c]),this.size=++u.size,this;u=this.__data__=new n(f)}return u.set(o,c),this.size=u.size,this}return o0=r,o0}var l0,RT;function om(){if(RT)return l0;RT=1;var e=rm(),t=XJ(),n=ZJ(),s=JJ(),r=eee(),o=yee();function c(u){var f=this.__data__=new e(u);this.size=f.size}return c.prototype.clear=t,c.prototype.delete=n,c.prototype.get=s,c.prototype.has=r,c.prototype.set=o,l0=c,l0}var c0,ET;function _N(){if(ET)return c0;ET=1;function e(t,n){for(var s=-1,r=t==null?0:t.length;++s<r&&n(t[s],s,t)!==!1;);return t}return c0=e,c0}var u0,AT;function WD(){if(AT)return u0;AT=1;var e=co(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return u0=t,u0}var d0,TT;function lm(){if(TT)return d0;TT=1;var e=WD();function t(n,s,r){s=="__proto__"&&e?e(n,s,{configurable:!0,enumerable:!0,value:r,writable:!0}):n[s]=r}return d0=t,d0}var f0,MT;function cm(){if(MT)return f0;MT=1;var e=lm(),t=Ql(),n=Object.prototype,s=n.hasOwnProperty;function r(o,c,u){var f=o[c];(!(s.call(o,c)&&t(f,u))||u===void 0&&!(c in o))&&e(o,c,u)}return f0=r,f0}var h0,IT;function yd(){if(IT)return h0;IT=1;var e=cm(),t=lm();function n(s,r,o,c){var u=!o;o||(o={});for(var f=-1,h=r.length;++f<h;){var p=r[f],g=c?c(o[p],s[p],p,o,s):void 0;g===void 0&&(g=s[p]),u?t(o,p,g):e(o,p,g)}return o}return h0=n,h0}var p0,OT;function bee(){if(OT)return p0;OT=1;function e(t,n){for(var s=-1,r=Array(t);++s<t;)r[s]=n(s);return r}return p0=e,p0}var m0,LT;function er(){if(LT)return m0;LT=1;function e(t){return t!=null&&typeof t=="object"}return m0=e,m0}var g0,PT;function wee(){if(PT)return g0;PT=1;var e=lo(),t=er(),n="[object Arguments]";function s(r){return t(r)&&e(r)==n}return g0=s,g0}var x0,DT;function bd(){if(DT)return x0;DT=1;var e=wee(),t=er(),n=Object.prototype,s=n.hasOwnProperty,r=n.propertyIsEnumerable,o=e((function(){return arguments})())?e:function(c){return t(c)&&s.call(c,"callee")&&!r.call(c,"callee")};return x0=o,x0}var v0,qT;function Ft(){if(qT)return v0;qT=1;var e=Array.isArray;return v0=e,v0}var gu={exports:{}},y0,$T;function See(){if($T)return y0;$T=1;function e(){return!1}return y0=e,y0}gu.exports;var zT;function Zl(){return zT||(zT=1,(function(e,t){var n=Is(),s=See(),r=t&&!t.nodeType&&t,o=r&&!0&&e&&!e.nodeType&&e,c=o&&o.exports===r,u=c?n.Buffer:void 0,f=u?u.isBuffer:void 0,h=f||s;e.exports=h})(gu,gu.exports)),gu.exports}var b0,BT;function um(){if(BT)return b0;BT=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(s,r){var o=typeof s;return r=r??e,!!r&&(o=="number"||o!="symbol"&&t.test(s))&&s>-1&&s%1==0&&s<r}return b0=n,b0}var w0,FT;function CN(){if(FT)return w0;FT=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return w0=t,w0}var S0,HT;function jee(){if(HT)return S0;HT=1;var e=lo(),t=CN(),n=er(),s="[object Arguments]",r="[object Array]",o="[object Boolean]",c="[object Date]",u="[object Error]",f="[object Function]",h="[object Map]",p="[object Number]",g="[object Object]",x="[object RegExp]",v="[object Set]",b="[object String]",w="[object WeakMap]",S="[object ArrayBuffer]",N="[object DataView]",C="[object Float32Array]",k="[object Float64Array]",_="[object Int8Array]",E="[object Int16Array]",M="[object Int32Array]",A="[object Uint8Array]",O="[object Uint8ClampedArray]",L="[object Uint16Array]",P="[object Uint32Array]",I={};I[C]=I[k]=I[_]=I[E]=I[M]=I[A]=I[O]=I[L]=I[P]=!0,I[s]=I[r]=I[S]=I[o]=I[N]=I[c]=I[u]=I[f]=I[h]=I[p]=I[g]=I[x]=I[v]=I[b]=I[w]=!1;function B(F){return n(F)&&t(F.length)&&!!I[e(F)]}return S0=B,S0}var j0,UT;function dm(){if(UT)return j0;UT=1;function e(t){return function(n){return t(n)}}return j0=e,j0}var xu={exports:{}};xu.exports;var VT;function kN(){return VT||(VT=1,(function(e,t){var n=KD(),s=t&&!t.nodeType&&t,r=s&&!0&&e&&!e.nodeType&&e,o=r&&r.exports===s,c=o&&n.process,u=(function(){try{var f=r&&r.require&&r.require("util").types;return f||c&&c.binding&&c.binding("util")}catch{}})();e.exports=u})(xu,xu.exports)),xu.exports}var N0,GT;function wd(){if(GT)return N0;GT=1;var e=jee(),t=dm(),n=kN(),s=n&&n.isTypedArray,r=s?t(s):e;return N0=r,N0}var _0,KT;function QD(){if(KT)return _0;KT=1;var e=bee(),t=bd(),n=Ft(),s=Zl(),r=um(),o=wd(),c=Object.prototype,u=c.hasOwnProperty;function f(h,p){var g=n(h),x=!g&&t(h),v=!g&&!x&&s(h),b=!g&&!x&&!v&&o(h),w=g||x||v||b,S=w?e(h.length,String):[],N=S.length;for(var C in h)(p||u.call(h,C))&&!(w&&(C=="length"||v&&(C=="offset"||C=="parent")||b&&(C=="buffer"||C=="byteLength"||C=="byteOffset")||r(C,N)))&&S.push(C);return S}return _0=f,_0}var C0,YT;function fm(){if(YT)return C0;YT=1;var e=Object.prototype;function t(n){var s=n&&n.constructor,r=typeof s=="function"&&s.prototype||e;return n===r}return C0=t,C0}var k0,WT;function XD(){if(WT)return k0;WT=1;function e(t,n){return function(s){return t(n(s))}}return k0=e,k0}var R0,QT;function Nee(){if(QT)return R0;QT=1;var e=XD(),t=e(Object.keys,Object);return R0=t,R0}var E0,XT;function RN(){if(XT)return E0;XT=1;var e=fm(),t=Nee(),n=Object.prototype,s=n.hasOwnProperty;function r(o){if(!e(o))return t(o);var c=[];for(var u in Object(o))s.call(o,u)&&u!="constructor"&&c.push(u);return c}return E0=r,E0}var A0,ZT;function zr(){if(ZT)return A0;ZT=1;var e=vd(),t=CN();function n(s){return s!=null&&t(s.length)&&!e(s)}return A0=n,A0}var T0,JT;function Zi(){if(JT)return T0;JT=1;var e=QD(),t=RN(),n=zr();function s(r){return n(r)?e(r):t(r)}return T0=s,T0}var M0,eM;function _ee(){if(eM)return M0;eM=1;var e=yd(),t=Zi();function n(s,r){return s&&e(r,t(r),s)}return M0=n,M0}var I0,tM;function Cee(){if(tM)return I0;tM=1;function e(t){var n=[];if(t!=null)for(var s in Object(t))n.push(s);return n}return I0=e,I0}var O0,nM;function kee(){if(nM)return O0;nM=1;var e=ps(),t=fm(),n=Cee(),s=Object.prototype,r=s.hasOwnProperty;function o(c){if(!e(c))return n(c);var u=t(c),f=[];for(var h in c)h=="constructor"&&(u||!r.call(c,h))||f.push(h);return f}return O0=o,O0}var L0,sM;function uo(){if(sM)return L0;sM=1;var e=QD(),t=kee(),n=zr();function s(r){return n(r)?e(r,!0):t(r)}return L0=s,L0}var P0,rM;function Ree(){if(rM)return P0;rM=1;var e=yd(),t=uo();function n(s,r){return s&&e(r,t(r),s)}return P0=n,P0}var vu={exports:{}};vu.exports;var iM;function ZD(){return iM||(iM=1,(function(e,t){var n=Is(),s=t&&!t.nodeType&&t,r=s&&!0&&e&&!e.nodeType&&e,o=r&&r.exports===s,c=o?n.Buffer:void 0,u=c?c.allocUnsafe:void 0;function f(h,p){if(p)return h.slice();var g=h.length,x=u?u(g):new h.constructor(g);return h.copy(x),x}e.exports=f})(vu,vu.exports)),vu.exports}var D0,aM;function JD(){if(aM)return D0;aM=1;function e(t,n){var s=-1,r=t.length;for(n||(n=Array(r));++s<r;)n[s]=t[s];return n}return D0=e,D0}var q0,oM;function eq(){if(oM)return q0;oM=1;function e(t,n){for(var s=-1,r=t==null?0:t.length,o=0,c=[];++s<r;){var u=t[s];n(u,s,t)&&(c[o++]=u)}return c}return q0=e,q0}var $0,lM;function tq(){if(lM)return $0;lM=1;function e(){return[]}return $0=e,$0}var z0,cM;function EN(){if(cM)return z0;cM=1;var e=eq(),t=tq(),n=Object.prototype,s=n.propertyIsEnumerable,r=Object.getOwnPropertySymbols,o=r?function(c){return c==null?[]:(c=Object(c),e(r(c),function(u){return s.call(c,u)}))}:t;return z0=o,z0}var B0,uM;function Eee(){if(uM)return B0;uM=1;var e=yd(),t=EN();function n(s,r){return e(s,t(s),r)}return B0=n,B0}var F0,dM;function AN(){if(dM)return F0;dM=1;function e(t,n){for(var s=-1,r=n.length,o=t.length;++s<r;)t[o+s]=n[s];return t}return F0=e,F0}var H0,fM;function hm(){if(fM)return H0;fM=1;var e=XD(),t=e(Object.getPrototypeOf,Object);return H0=t,H0}var U0,hM;function nq(){if(hM)return U0;hM=1;var e=AN(),t=hm(),n=EN(),s=tq(),r=Object.getOwnPropertySymbols,o=r?function(c){for(var u=[];c;)e(u,n(c)),c=t(c);return u}:s;return U0=o,U0}var V0,pM;function Aee(){if(pM)return V0;pM=1;var e=yd(),t=nq();function n(s,r){return e(s,t(s),r)}return V0=n,V0}var G0,mM;function sq(){if(mM)return G0;mM=1;var e=AN(),t=Ft();function n(s,r,o){var c=r(s);return t(s)?c:e(c,o(s))}return G0=n,G0}var K0,gM;function rq(){if(gM)return K0;gM=1;var e=sq(),t=EN(),n=Zi();function s(r){return e(r,n,t)}return K0=s,K0}var Y0,xM;function Tee(){if(xM)return Y0;xM=1;var e=sq(),t=nq(),n=uo();function s(r){return e(r,n,t)}return Y0=s,Y0}var W0,vM;function Mee(){if(vM)return W0;vM=1;var e=co(),t=Is(),n=e(t,"DataView");return W0=n,W0}var Q0,yM;function Iee(){if(yM)return Q0;yM=1;var e=co(),t=Is(),n=e(t,"Promise");return Q0=n,Q0}var X0,bM;function iq(){if(bM)return X0;bM=1;var e=co(),t=Is(),n=e(t,"Set");return X0=n,X0}var Z0,wM;function Oee(){if(wM)return Z0;wM=1;var e=co(),t=Is(),n=e(t,"WeakMap");return Z0=n,Z0}var J0,SM;function Jl(){if(SM)return J0;SM=1;var e=Mee(),t=jN(),n=Iee(),s=iq(),r=Oee(),o=lo(),c=YD(),u="[object Map]",f="[object Object]",h="[object Promise]",p="[object Set]",g="[object WeakMap]",x="[object DataView]",v=c(e),b=c(t),w=c(n),S=c(s),N=c(r),C=o;return(e&&C(new e(new ArrayBuffer(1)))!=x||t&&C(new t)!=u||n&&C(n.resolve())!=h||s&&C(new s)!=p||r&&C(new r)!=g)&&(C=function(k){var _=o(k),E=_==f?k.constructor:void 0,M=E?c(E):"";if(M)switch(M){case v:return x;case b:return u;case w:return h;case S:return p;case N:return g}return _}),J0=C,J0}var ey,jM;function Lee(){if(jM)return ey;jM=1;var e=Object.prototype,t=e.hasOwnProperty;function n(s){var r=s.length,o=new s.constructor(r);return r&&typeof s[0]=="string"&&t.call(s,"index")&&(o.index=s.index,o.input=s.input),o}return ey=n,ey}var ty,NM;function aq(){if(NM)return ty;NM=1;var e=Is(),t=e.Uint8Array;return ty=t,ty}var ny,_M;function TN(){if(_M)return ny;_M=1;var e=aq();function t(n){var s=new n.constructor(n.byteLength);return new e(s).set(new e(n)),s}return ny=t,ny}var sy,CM;function Pee(){if(CM)return sy;CM=1;var e=TN();function t(n,s){var r=s?e(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.byteLength)}return sy=t,sy}var ry,kM;function Dee(){if(kM)return ry;kM=1;var e=/\w*$/;function t(n){var s=new n.constructor(n.source,e.exec(n));return s.lastIndex=n.lastIndex,s}return ry=t,ry}var iy,RM;function qee(){if(RM)return iy;RM=1;var e=Xl(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function s(r){return n?Object(n.call(r)):{}}return iy=s,iy}var ay,EM;function oq(){if(EM)return ay;EM=1;var e=TN();function t(n,s){var r=s?e(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.length)}return ay=t,ay}var oy,AM;function $ee(){if(AM)return oy;AM=1;var e=TN(),t=Pee(),n=Dee(),s=qee(),r=oq(),o="[object Boolean]",c="[object Date]",u="[object Map]",f="[object Number]",h="[object RegExp]",p="[object Set]",g="[object String]",x="[object Symbol]",v="[object ArrayBuffer]",b="[object DataView]",w="[object Float32Array]",S="[object Float64Array]",N="[object Int8Array]",C="[object Int16Array]",k="[object Int32Array]",_="[object Uint8Array]",E="[object Uint8ClampedArray]",M="[object Uint16Array]",A="[object Uint32Array]";function O(L,P,I){var B=L.constructor;switch(P){case v:return e(L);case o:case c:return new B(+L);case b:return t(L,I);case w:case S:case N:case C:case k:case _:case E:case M:case A:return r(L,I);case u:return new B;case f:case g:return new B(L);case h:return n(L);case p:return new B;case x:return s(L)}}return oy=O,oy}var ly,TM;function lq(){if(TM)return ly;TM=1;var e=ps(),t=Object.create,n=(function(){function s(){}return function(r){if(!e(r))return{};if(t)return t(r);s.prototype=r;var o=new s;return s.prototype=void 0,o}})();return ly=n,ly}var cy,MM;function cq(){if(MM)return cy;MM=1;var e=lq(),t=hm(),n=fm();function s(r){return typeof r.constructor=="function"&&!n(r)?e(t(r)):{}}return cy=s,cy}var uy,IM;function zee(){if(IM)return uy;IM=1;var e=Jl(),t=er(),n="[object Map]";function s(r){return t(r)&&e(r)==n}return uy=s,uy}var dy,OM;function Bee(){if(OM)return dy;OM=1;var e=zee(),t=dm(),n=kN(),s=n&&n.isMap,r=s?t(s):e;return dy=r,dy}var fy,LM;function Fee(){if(LM)return fy;LM=1;var e=Jl(),t=er(),n="[object Set]";function s(r){return t(r)&&e(r)==n}return fy=s,fy}var hy,PM;function Hee(){if(PM)return hy;PM=1;var e=Fee(),t=dm(),n=kN(),s=n&&n.isSet,r=s?t(s):e;return hy=r,hy}var py,DM;function uq(){if(DM)return py;DM=1;var e=om(),t=_N(),n=cm(),s=_ee(),r=Ree(),o=ZD(),c=JD(),u=Eee(),f=Aee(),h=rq(),p=Tee(),g=Jl(),x=Lee(),v=$ee(),b=cq(),w=Ft(),S=Zl(),N=Bee(),C=ps(),k=Hee(),_=Zi(),E=uo(),M=1,A=2,O=4,L="[object Arguments]",P="[object Array]",I="[object Boolean]",B="[object Date]",F="[object Error]",z="[object Function]",Y="[object GeneratorFunction]",$="[object Map]",V="[object Number]",G="[object Object]",Z="[object RegExp]",J="[object Set]",D="[object String]",U="[object Symbol]",te="[object WeakMap]",H="[object ArrayBuffer]",W="[object DataView]",Q="[object Float32Array]",se="[object Float64Array]",re="[object Int8Array]",ce="[object Int16Array]",me="[object Int32Array]",ge="[object Uint8Array]",ye="[object Uint8ClampedArray]",xe="[object Uint16Array]",Se="[object Uint32Array]",je={};je[L]=je[P]=je[H]=je[W]=je[I]=je[B]=je[Q]=je[se]=je[re]=je[ce]=je[me]=je[$]=je[V]=je[G]=je[Z]=je[J]=je[D]=je[U]=je[ge]=je[ye]=je[xe]=je[Se]=!0,je[F]=je[z]=je[te]=!1;function Oe(Ee,mt,yt,Tt,rn,Ht){var bt,gt=mt&M,Fe=mt&A,ht=mt&O;if(yt&&(bt=rn?yt(Ee,Tt,rn,Ht):yt(Ee)),bt!==void 0)return bt;if(!C(Ee))return Ee;var Ut=w(Ee);if(Ut){if(bt=x(Ee),!gt)return c(Ee,bt)}else{var an=g(Ee),po=an==z||an==Y;if(S(Ee))return o(Ee,gt);if(an==G||an==L||po&&!rn){if(bt=Fe||po?{}:b(Ee),!gt)return Fe?f(Ee,r(bt,Ee)):u(Ee,s(bt,Ee))}else{if(!je[an])return rn?Ee:{};bt=v(Ee,an,gt)}}Ht||(Ht=new e);var tr=Ht.get(Ee);if(tr)return tr;Ht.set(Ee,bt),k(Ee)?Ee.forEach(function(on){bt.add(Oe(on,mt,yt,on,Ee,Ht))}):N(Ee)&&Ee.forEach(function(on,Ct){bt.set(Ct,Oe(on,mt,yt,Ct,Ee,Ht))});var nc=ht?Fe?p:h:Fe?E:_,mo=Ut?void 0:nc(Ee);return t(mo||Ee,function(on,Ct){mo&&(Ct=on,on=Ee[Ct]),n(bt,Ct,Oe(on,mt,yt,Ct,Ee,Ht))}),bt}return py=Oe,py}var my,qM;function Uee(){if(qM)return my;qM=1;var e=uq(),t=4;function n(s){return e(s,t)}return my=n,my}var gy,$M;function MN(){if($M)return gy;$M=1;function e(t){return function(){return t}}return gy=e,gy}var xy,zM;function Vee(){if(zM)return xy;zM=1;function e(t){return function(n,s,r){for(var o=-1,c=Object(n),u=r(n),f=u.length;f--;){var h=u[t?f:++o];if(s(c[h],h,c)===!1)break}return n}}return xy=e,xy}var vy,BM;function IN(){if(BM)return vy;BM=1;var e=Vee(),t=e();return vy=t,vy}var yy,FM;function ON(){if(FM)return yy;FM=1;var e=IN(),t=Zi();function n(s,r){return s&&e(s,r,t)}return yy=n,yy}var by,HM;function Gee(){if(HM)return by;HM=1;var e=zr();function t(n,s){return function(r,o){if(r==null)return r;if(!e(r))return n(r,o);for(var c=r.length,u=s?c:-1,f=Object(r);(s?u--:++u<c)&&o(f[u],u,f)!==!1;);return r}}return by=t,by}var wy,UM;function pm(){if(UM)return wy;UM=1;var e=ON(),t=Gee(),n=t(e);return wy=n,wy}var Sy,VM;function fo(){if(VM)return Sy;VM=1;function e(t){return t}return Sy=e,Sy}var jy,GM;function dq(){if(GM)return jy;GM=1;var e=fo();function t(n){return typeof n=="function"?n:e}return jy=t,jy}var Ny,KM;function fq(){if(KM)return Ny;KM=1;var e=_N(),t=pm(),n=dq(),s=Ft();function r(o,c){var u=s(o)?e:t;return u(o,n(c))}return Ny=r,Ny}var _y,YM;function hq(){return YM||(YM=1,_y=fq()),_y}var Cy,WM;function Kee(){if(WM)return Cy;WM=1;var e=pm();function t(n,s){var r=[];return e(n,function(o,c,u){s(o,c,u)&&r.push(o)}),r}return Cy=t,Cy}var ky,QM;function Yee(){if(QM)return ky;QM=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return ky=t,ky}var Ry,XM;function Wee(){if(XM)return Ry;XM=1;function e(t){return this.__data__.has(t)}return Ry=e,Ry}var Ey,ZM;function pq(){if(ZM)return Ey;ZM=1;var e=NN(),t=Yee(),n=Wee();function s(r){var o=-1,c=r==null?0:r.length;for(this.__data__=new e;++o<c;)this.add(r[o])}return s.prototype.add=s.prototype.push=t,s.prototype.has=n,Ey=s,Ey}var Ay,JM;function Qee(){if(JM)return Ay;JM=1;function e(t,n){for(var s=-1,r=t==null?0:t.length;++s<r;)if(n(t[s],s,t))return!0;return!1}return Ay=e,Ay}var Ty,eI;function mq(){if(eI)return Ty;eI=1;function e(t,n){return t.has(n)}return Ty=e,Ty}var My,tI;function gq(){if(tI)return My;tI=1;var e=pq(),t=Qee(),n=mq(),s=1,r=2;function o(c,u,f,h,p,g){var x=f&s,v=c.length,b=u.length;if(v!=b&&!(x&&b>v))return!1;var w=g.get(c),S=g.get(u);if(w&&S)return w==u&&S==c;var N=-1,C=!0,k=f&r?new e:void 0;for(g.set(c,u),g.set(u,c);++N<v;){var _=c[N],E=u[N];if(h)var M=x?h(E,_,N,u,c,g):h(_,E,N,c,u,g);if(M!==void 0){if(M)continue;C=!1;break}if(k){if(!t(u,function(A,O){if(!n(k,O)&&(_===A||p(_,A,f,h,g)))return k.push(O)})){C=!1;break}}else if(!(_===E||p(_,E,f,h,g))){C=!1;break}}return g.delete(c),g.delete(u),C}return My=o,My}var Iy,nI;function Xee(){if(nI)return Iy;nI=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(r,o){s[++n]=[o,r]}),s}return Iy=e,Iy}var Oy,sI;function LN(){if(sI)return Oy;sI=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(r){s[++n]=r}),s}return Oy=e,Oy}var Ly,rI;function Zee(){if(rI)return Ly;rI=1;var e=Xl(),t=aq(),n=Ql(),s=gq(),r=Xee(),o=LN(),c=1,u=2,f="[object Boolean]",h="[object Date]",p="[object Error]",g="[object Map]",x="[object Number]",v="[object RegExp]",b="[object Set]",w="[object String]",S="[object Symbol]",N="[object ArrayBuffer]",C="[object DataView]",k=e?e.prototype:void 0,_=k?k.valueOf:void 0;function E(M,A,O,L,P,I,B){switch(O){case C:if(M.byteLength!=A.byteLength||M.byteOffset!=A.byteOffset)return!1;M=M.buffer,A=A.buffer;case N:return!(M.byteLength!=A.byteLength||!I(new t(M),new t(A)));case f:case h:case x:return n(+M,+A);case p:return M.name==A.name&&M.message==A.message;case v:case w:return M==A+"";case g:var F=r;case b:var z=L&c;if(F||(F=o),M.size!=A.size&&!z)return!1;var Y=B.get(M);if(Y)return Y==A;L|=u,B.set(M,A);var $=s(F(M),F(A),L,P,I,B);return B.delete(M),$;case S:if(_)return _.call(M)==_.call(A)}return!1}return Ly=E,Ly}var Py,iI;function Jee(){if(iI)return Py;iI=1;var e=rq(),t=1,n=Object.prototype,s=n.hasOwnProperty;function r(o,c,u,f,h,p){var g=u&t,x=e(o),v=x.length,b=e(c),w=b.length;if(v!=w&&!g)return!1;for(var S=v;S--;){var N=x[S];if(!(g?N in c:s.call(c,N)))return!1}var C=p.get(o),k=p.get(c);if(C&&k)return C==c&&k==o;var _=!0;p.set(o,c),p.set(c,o);for(var E=g;++S<v;){N=x[S];var M=o[N],A=c[N];if(f)var O=g?f(A,M,N,c,o,p):f(M,A,N,o,c,p);if(!(O===void 0?M===A||h(M,A,u,f,p):O)){_=!1;break}E||(E=N=="constructor")}if(_&&!E){var L=o.constructor,P=c.constructor;L!=P&&"constructor"in o&&"constructor"in c&&!(typeof L=="function"&&L instanceof L&&typeof P=="function"&&P instanceof P)&&(_=!1)}return p.delete(o),p.delete(c),_}return Py=r,Py}var Dy,aI;function ete(){if(aI)return Dy;aI=1;var e=om(),t=gq(),n=Zee(),s=Jee(),r=Jl(),o=Ft(),c=Zl(),u=wd(),f=1,h="[object Arguments]",p="[object Array]",g="[object Object]",x=Object.prototype,v=x.hasOwnProperty;function b(w,S,N,C,k,_){var E=o(w),M=o(S),A=E?p:r(w),O=M?p:r(S);A=A==h?g:A,O=O==h?g:O;var L=A==g,P=O==g,I=A==O;if(I&&c(w)){if(!c(S))return!1;E=!0,L=!1}if(I&&!L)return _||(_=new e),E||u(w)?t(w,S,N,C,k,_):n(w,S,A,N,C,k,_);if(!(N&f)){var B=L&&v.call(w,"__wrapped__"),F=P&&v.call(S,"__wrapped__");if(B||F){var z=B?w.value():w,Y=F?S.value():S;return _||(_=new e),k(z,Y,N,C,_)}}return I?(_||(_=new e),s(w,S,N,C,k,_)):!1}return Dy=b,Dy}var qy,oI;function xq(){if(oI)return qy;oI=1;var e=ete(),t=er();function n(s,r,o,c,u){return s===r?!0:s==null||r==null||!t(s)&&!t(r)?s!==s&&r!==r:e(s,r,o,c,n,u)}return qy=n,qy}var $y,lI;function tte(){if(lI)return $y;lI=1;var e=om(),t=xq(),n=1,s=2;function r(o,c,u,f){var h=u.length,p=h,g=!f;if(o==null)return!p;for(o=Object(o);h--;){var x=u[h];if(g&&x[2]?x[1]!==o[x[0]]:!(x[0]in o))return!1}for(;++h<p;){x=u[h];var v=x[0],b=o[v],w=x[1];if(g&&x[2]){if(b===void 0&&!(v in o))return!1}else{var S=new e;if(f)var N=f(b,w,v,o,c,S);if(!(N===void 0?t(w,b,n|s,f,S):N))return!1}}return!0}return $y=r,$y}var zy,cI;function vq(){if(cI)return zy;cI=1;var e=ps();function t(n){return n===n&&!e(n)}return zy=t,zy}var By,uI;function nte(){if(uI)return By;uI=1;var e=vq(),t=Zi();function n(s){for(var r=t(s),o=r.length;o--;){var c=r[o],u=s[c];r[o]=[c,u,e(u)]}return r}return By=n,By}var Fy,dI;function yq(){if(dI)return Fy;dI=1;function e(t,n){return function(s){return s==null?!1:s[t]===n&&(n!==void 0||t in Object(s))}}return Fy=e,Fy}var Hy,fI;function ste(){if(fI)return Hy;fI=1;var e=tte(),t=nte(),n=yq();function s(r){var o=t(r);return o.length==1&&o[0][2]?n(o[0][0],o[0][1]):function(c){return c===r||e(c,r,o)}}return Hy=s,Hy}var Uy,hI;function ec(){if(hI)return Uy;hI=1;var e=lo(),t=er(),n="[object Symbol]";function s(r){return typeof r=="symbol"||t(r)&&e(r)==n}return Uy=s,Uy}var Vy,pI;function PN(){if(pI)return Vy;pI=1;var e=Ft(),t=ec(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;function r(o,c){if(e(o))return!1;var u=typeof o;return u=="number"||u=="symbol"||u=="boolean"||o==null||t(o)?!0:s.test(o)||!n.test(o)||c!=null&&o in Object(c)}return Vy=r,Vy}var Gy,mI;function rte(){if(mI)return Gy;mI=1;var e=NN(),t="Expected a function";function n(s,r){if(typeof s!="function"||r!=null&&typeof r!="function")throw new TypeError(t);var o=function(){var c=arguments,u=r?r.apply(this,c):c[0],f=o.cache;if(f.has(u))return f.get(u);var h=s.apply(this,c);return o.cache=f.set(u,h)||f,h};return o.cache=new(n.Cache||e),o}return n.Cache=e,Gy=n,Gy}var Ky,gI;function ite(){if(gI)return Ky;gI=1;var e=rte(),t=500;function n(s){var r=e(s,function(c){return o.size===t&&o.clear(),c}),o=r.cache;return r}return Ky=n,Ky}var Yy,xI;function ate(){if(xI)return Yy;xI=1;var e=ite(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,s=e(function(r){var o=[];return r.charCodeAt(0)===46&&o.push(""),r.replace(t,function(c,u,f,h){o.push(f?h.replace(n,"$1"):u||c)}),o});return Yy=s,Yy}var Wy,vI;function mm(){if(vI)return Wy;vI=1;function e(t,n){for(var s=-1,r=t==null?0:t.length,o=Array(r);++s<r;)o[s]=n(t[s],s,t);return o}return Wy=e,Wy}var Qy,yI;function ote(){if(yI)return Qy;yI=1;var e=Xl(),t=mm(),n=Ft(),s=ec(),r=e?e.prototype:void 0,o=r?r.toString:void 0;function c(u){if(typeof u=="string")return u;if(n(u))return t(u,c)+"";if(s(u))return o?o.call(u):"";var f=u+"";return f=="0"&&1/u==-1/0?"-0":f}return Qy=c,Qy}var Xy,bI;function bq(){if(bI)return Xy;bI=1;var e=ote();function t(n){return n==null?"":e(n)}return Xy=t,Xy}var Zy,wI;function gm(){if(wI)return Zy;wI=1;var e=Ft(),t=PN(),n=ate(),s=bq();function r(o,c){return e(o)?o:t(o,c)?[o]:n(s(o))}return Zy=r,Zy}var Jy,SI;function Sd(){if(SI)return Jy;SI=1;var e=ec();function t(n){if(typeof n=="string"||e(n))return n;var s=n+"";return s=="0"&&1/n==-1/0?"-0":s}return Jy=t,Jy}var eb,jI;function xm(){if(jI)return eb;jI=1;var e=gm(),t=Sd();function n(s,r){r=e(r,s);for(var o=0,c=r.length;s!=null&&o<c;)s=s[t(r[o++])];return o&&o==c?s:void 0}return eb=n,eb}var tb,NI;function lte(){if(NI)return tb;NI=1;var e=xm();function t(n,s,r){var o=n==null?void 0:e(n,s);return o===void 0?r:o}return tb=t,tb}var nb,_I;function cte(){if(_I)return nb;_I=1;function e(t,n){return t!=null&&n in Object(t)}return nb=e,nb}var sb,CI;function wq(){if(CI)return sb;CI=1;var e=gm(),t=bd(),n=Ft(),s=um(),r=CN(),o=Sd();function c(u,f,h){f=e(f,u);for(var p=-1,g=f.length,x=!1;++p<g;){var v=o(f[p]);if(!(x=u!=null&&h(u,v)))break;u=u[v]}return x||++p!=g?x:(g=u==null?0:u.length,!!g&&r(g)&&s(v,g)&&(n(u)||t(u)))}return sb=c,sb}var rb,kI;function Sq(){if(kI)return rb;kI=1;var e=cte(),t=wq();function n(s,r){return s!=null&&t(s,r,e)}return rb=n,rb}var ib,RI;function ute(){if(RI)return ib;RI=1;var e=xq(),t=lte(),n=Sq(),s=PN(),r=vq(),o=yq(),c=Sd(),u=1,f=2;function h(p,g){return s(p)&&r(g)?o(c(p),g):function(x){var v=t(x,p);return v===void 0&&v===g?n(x,p):e(g,v,u|f)}}return ib=h,ib}var ab,EI;function jq(){if(EI)return ab;EI=1;function e(t){return function(n){return n==null?void 0:n[t]}}return ab=e,ab}var ob,AI;function dte(){if(AI)return ob;AI=1;var e=xm();function t(n){return function(s){return e(s,n)}}return ob=t,ob}var lb,TI;function fte(){if(TI)return lb;TI=1;var e=jq(),t=dte(),n=PN(),s=Sd();function r(o){return n(o)?e(s(o)):t(o)}return lb=r,lb}var cb,MI;function Br(){if(MI)return cb;MI=1;var e=ste(),t=ute(),n=fo(),s=Ft(),r=fte();function o(c){return typeof c=="function"?c:c==null?n:typeof c=="object"?s(c)?t(c[0],c[1]):e(c):r(c)}return cb=o,cb}var ub,II;function Nq(){if(II)return ub;II=1;var e=eq(),t=Kee(),n=Br(),s=Ft();function r(o,c){var u=s(o)?e:t;return u(o,n(c,3))}return ub=r,ub}var db,OI;function hte(){if(OI)return db;OI=1;var e=Object.prototype,t=e.hasOwnProperty;function n(s,r){return s!=null&&t.call(s,r)}return db=n,db}var fb,LI;function _q(){if(LI)return fb;LI=1;var e=hte(),t=wq();function n(s,r){return s!=null&&t(s,r,e)}return fb=n,fb}var hb,PI;function pte(){if(PI)return hb;PI=1;var e=RN(),t=Jl(),n=bd(),s=Ft(),r=zr(),o=Zl(),c=fm(),u=wd(),f="[object Map]",h="[object Set]",p=Object.prototype,g=p.hasOwnProperty;function x(v){if(v==null)return!0;if(r(v)&&(s(v)||typeof v=="string"||typeof v.splice=="function"||o(v)||u(v)||n(v)))return!v.length;var b=t(v);if(b==f||b==h)return!v.size;if(c(v))return!e(v).length;for(var w in v)if(g.call(v,w))return!1;return!0}return hb=x,hb}var pb,DI;function Cq(){if(DI)return pb;DI=1;function e(t){return t===void 0}return pb=e,pb}var mb,qI;function kq(){if(qI)return mb;qI=1;var e=pm(),t=zr();function n(s,r){var o=-1,c=t(s)?Array(s.length):[];return e(s,function(u,f,h){c[++o]=r(u,f,h)}),c}return mb=n,mb}var gb,$I;function Rq(){if($I)return gb;$I=1;var e=mm(),t=Br(),n=kq(),s=Ft();function r(o,c){var u=s(o)?e:n;return u(o,t(c,3))}return gb=r,gb}var xb,zI;function mte(){if(zI)return xb;zI=1;function e(t,n,s,r){var o=-1,c=t==null?0:t.length;for(r&&c&&(s=t[++o]);++o<c;)s=n(s,t[o],o,t);return s}return xb=e,xb}var vb,BI;function gte(){if(BI)return vb;BI=1;function e(t,n,s,r,o){return o(t,function(c,u,f){s=r?(r=!1,c):n(s,c,u,f)}),s}return vb=e,vb}var yb,FI;function Eq(){if(FI)return yb;FI=1;var e=mte(),t=pm(),n=Br(),s=gte(),r=Ft();function o(c,u,f){var h=r(c)?e:s,p=arguments.length<3;return h(c,n(u,4),f,p,t)}return yb=o,yb}var bb,HI;function xte(){if(HI)return bb;HI=1;var e=lo(),t=Ft(),n=er(),s="[object String]";function r(o){return typeof o=="string"||!t(o)&&n(o)&&e(o)==s}return bb=r,bb}var wb,UI;function vte(){if(UI)return wb;UI=1;var e=jq(),t=e("length");return wb=t,wb}var Sb,VI;function yte(){if(VI)return Sb;VI=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",r=t+n+s,o="\\ufe0e\\ufe0f",c="\\u200d",u=RegExp("["+c+e+r+o+"]");function f(h){return u.test(h)}return Sb=f,Sb}var jb,GI;function bte(){if(GI)return jb;GI=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",r=t+n+s,o="\\ufe0e\\ufe0f",c="["+e+"]",u="["+r+"]",f="\\ud83c[\\udffb-\\udfff]",h="(?:"+u+"|"+f+")",p="[^"+e+"]",g="(?:\\ud83c[\\udde6-\\uddff]){2}",x="[\\ud800-\\udbff][\\udc00-\\udfff]",v="\\u200d",b=h+"?",w="["+o+"]?",S="(?:"+v+"(?:"+[p,g,x].join("|")+")"+w+b+")*",N=w+b+S,C="(?:"+[p+u+"?",u,g,x,c].join("|")+")",k=RegExp(f+"(?="+f+")|"+C+N,"g");function _(E){for(var M=k.lastIndex=0;k.test(E);)++M;return M}return jb=_,jb}var Nb,KI;function wte(){if(KI)return Nb;KI=1;var e=vte(),t=yte(),n=bte();function s(r){return t(r)?n(r):e(r)}return Nb=s,Nb}var _b,YI;function Ste(){if(YI)return _b;YI=1;var e=RN(),t=Jl(),n=zr(),s=xte(),r=wte(),o="[object Map]",c="[object Set]";function u(f){if(f==null)return 0;if(n(f))return s(f)?r(f):f.length;var h=t(f);return h==o||h==c?f.size:e(f).length}return _b=u,_b}var Cb,WI;function jte(){if(WI)return Cb;WI=1;var e=_N(),t=lq(),n=ON(),s=Br(),r=hm(),o=Ft(),c=Zl(),u=vd(),f=ps(),h=wd();function p(g,x,v){var b=o(g),w=b||c(g)||h(g);if(x=s(x,4),v==null){var S=g&&g.constructor;w?v=b?new S:[]:f(g)?v=u(S)?t(r(g)):{}:v={}}return(w?e:n)(g,function(N,C,k){return x(v,N,C,k)}),v}return Cb=p,Cb}var kb,QI;function Nte(){if(QI)return kb;QI=1;var e=Xl(),t=bd(),n=Ft(),s=e?e.isConcatSpreadable:void 0;function r(o){return n(o)||t(o)||!!(s&&o&&o[s])}return kb=r,kb}var Rb,XI;function DN(){if(XI)return Rb;XI=1;var e=AN(),t=Nte();function n(s,r,o,c,u){var f=-1,h=s.length;for(o||(o=t),u||(u=[]);++f<h;){var p=s[f];r>0&&o(p)?r>1?n(p,r-1,o,c,u):e(u,p):c||(u[u.length]=p)}return u}return Rb=n,Rb}var Eb,ZI;function _te(){if(ZI)return Eb;ZI=1;function e(t,n,s){switch(s.length){case 0:return t.call(n);case 1:return t.call(n,s[0]);case 2:return t.call(n,s[0],s[1]);case 3:return t.call(n,s[0],s[1],s[2])}return t.apply(n,s)}return Eb=e,Eb}var Ab,JI;function Aq(){if(JI)return Ab;JI=1;var e=_te(),t=Math.max;function n(s,r,o){return r=t(r===void 0?s.length-1:r,0),function(){for(var c=arguments,u=-1,f=t(c.length-r,0),h=Array(f);++u<f;)h[u]=c[r+u];u=-1;for(var p=Array(r+1);++u<r;)p[u]=c[u];return p[r]=o(h),e(s,this,p)}}return Ab=n,Ab}var Tb,e3;function Cte(){if(e3)return Tb;e3=1;var e=MN(),t=WD(),n=fo(),s=t?function(r,o){return t(r,"toString",{configurable:!0,enumerable:!1,value:e(o),writable:!0})}:n;return Tb=s,Tb}var Mb,t3;function kte(){if(t3)return Mb;t3=1;var e=800,t=16,n=Date.now;function s(r){var o=0,c=0;return function(){var u=n(),f=t-(u-c);if(c=u,f>0){if(++o>=e)return arguments[0]}else o=0;return r.apply(void 0,arguments)}}return Mb=s,Mb}var Ib,n3;function Tq(){if(n3)return Ib;n3=1;var e=Cte(),t=kte(),n=t(e);return Ib=n,Ib}var Ob,s3;function vm(){if(s3)return Ob;s3=1;var e=fo(),t=Aq(),n=Tq();function s(r,o){return n(t(r,o,e),r+"")}return Ob=s,Ob}var Lb,r3;function Mq(){if(r3)return Lb;r3=1;function e(t,n,s,r){for(var o=t.length,c=s+(r?1:-1);r?c--:++c<o;)if(n(t[c],c,t))return c;return-1}return Lb=e,Lb}var Pb,i3;function Rte(){if(i3)return Pb;i3=1;function e(t){return t!==t}return Pb=e,Pb}var Db,a3;function Ete(){if(a3)return Db;a3=1;function e(t,n,s){for(var r=s-1,o=t.length;++r<o;)if(t[r]===n)return r;return-1}return Db=e,Db}var qb,o3;function Ate(){if(o3)return qb;o3=1;var e=Mq(),t=Rte(),n=Ete();function s(r,o,c){return o===o?n(r,o,c):e(r,t,c)}return qb=s,qb}var $b,l3;function Tte(){if(l3)return $b;l3=1;var e=Ate();function t(n,s){var r=n==null?0:n.length;return!!r&&e(n,s,0)>-1}return $b=t,$b}var zb,c3;function Mte(){if(c3)return zb;c3=1;function e(t,n,s){for(var r=-1,o=t==null?0:t.length;++r<o;)if(s(n,t[r]))return!0;return!1}return zb=e,zb}var Bb,u3;function Ite(){if(u3)return Bb;u3=1;function e(){}return Bb=e,Bb}var Fb,d3;function Ote(){if(d3)return Fb;d3=1;var e=iq(),t=Ite(),n=LN(),s=1/0,r=e&&1/n(new e([,-0]))[1]==s?function(o){return new e(o)}:t;return Fb=r,Fb}var Hb,f3;function Lte(){if(f3)return Hb;f3=1;var e=pq(),t=Tte(),n=Mte(),s=mq(),r=Ote(),o=LN(),c=200;function u(f,h,p){var g=-1,x=t,v=f.length,b=!0,w=[],S=w;if(p)b=!1,x=n;else if(v>=c){var N=h?null:r(f);if(N)return o(N);b=!1,x=s,S=new e}else S=h?[]:w;e:for(;++g<v;){var C=f[g],k=h?h(C):C;if(C=p||C!==0?C:0,b&&k===k){for(var _=S.length;_--;)if(S[_]===k)continue e;h&&S.push(k),w.push(C)}else x(S,k,p)||(S!==w&&S.push(k),w.push(C))}return w}return Hb=u,Hb}var Ub,h3;function Iq(){if(h3)return Ub;h3=1;var e=zr(),t=er();function n(s){return t(s)&&e(s)}return Ub=n,Ub}var Vb,p3;function Pte(){if(p3)return Vb;p3=1;var e=DN(),t=vm(),n=Lte(),s=Iq(),r=t(function(o){return n(e(o,1,s,!0))});return Vb=r,Vb}var Gb,m3;function Dte(){if(m3)return Gb;m3=1;var e=mm();function t(n,s){return e(s,function(r){return n[r]})}return Gb=t,Gb}var Kb,g3;function Oq(){if(g3)return Kb;g3=1;var e=Dte(),t=Zi();function n(s){return s==null?[]:e(s,t(s))}return Kb=n,Kb}var Yb,x3;function ms(){if(x3)return Yb;x3=1;var e;if(typeof SN=="function")try{e={clone:Uee(),constant:MN(),each:hq(),filter:Nq(),has:_q(),isArray:Ft(),isEmpty:pte(),isFunction:vd(),isUndefined:Cq(),keys:Zi(),map:Rq(),reduce:Eq(),size:Ste(),transform:jte(),union:Pte(),values:Oq()}}catch{}return e||(e=window._),Yb=e,Yb}var Wb,v3;function qN(){if(v3)return Wb;v3=1;var e=ms();Wb=r;var t="\0",n="\0",s="";function r(p){this._isDirected=e.has(p,"directed")?p.directed:!0,this._isMultigraph=e.has(p,"multigraph")?p.multigraph:!1,this._isCompound=e.has(p,"compound")?p.compound:!1,this._label=void 0,this._defaultNodeLabelFn=e.constant(void 0),this._defaultEdgeLabelFn=e.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[n]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}r.prototype._nodeCount=0,r.prototype._edgeCount=0,r.prototype.isDirected=function(){return this._isDirected},r.prototype.isMultigraph=function(){return this._isMultigraph},r.prototype.isCompound=function(){return this._isCompound},r.prototype.setGraph=function(p){return this._label=p,this},r.prototype.graph=function(){return this._label},r.prototype.setDefaultNodeLabel=function(p){return e.isFunction(p)||(p=e.constant(p)),this._defaultNodeLabelFn=p,this},r.prototype.nodeCount=function(){return this._nodeCount},r.prototype.nodes=function(){return e.keys(this._nodes)},r.prototype.sources=function(){var p=this;return e.filter(this.nodes(),function(g){return e.isEmpty(p._in[g])})},r.prototype.sinks=function(){var p=this;return e.filter(this.nodes(),function(g){return e.isEmpty(p._out[g])})},r.prototype.setNodes=function(p,g){var x=arguments,v=this;return e.each(p,function(b){x.length>1?v.setNode(b,g):v.setNode(b)}),this},r.prototype.setNode=function(p,g){return e.has(this._nodes,p)?(arguments.length>1&&(this._nodes[p]=g),this):(this._nodes[p]=arguments.length>1?g:this._defaultNodeLabelFn(p),this._isCompound&&(this._parent[p]=n,this._children[p]={},this._children[n][p]=!0),this._in[p]={},this._preds[p]={},this._out[p]={},this._sucs[p]={},++this._nodeCount,this)},r.prototype.node=function(p){return this._nodes[p]},r.prototype.hasNode=function(p){return e.has(this._nodes,p)},r.prototype.removeNode=function(p){var g=this;if(e.has(this._nodes,p)){var x=function(v){g.removeEdge(g._edgeObjs[v])};delete this._nodes[p],this._isCompound&&(this._removeFromParentsChildList(p),delete this._parent[p],e.each(this.children(p),function(v){g.setParent(v)}),delete this._children[p]),e.each(e.keys(this._in[p]),x),delete this._in[p],delete this._preds[p],e.each(e.keys(this._out[p]),x),delete this._out[p],delete this._sucs[p],--this._nodeCount}return this},r.prototype.setParent=function(p,g){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(g))g=n;else{g+="";for(var x=g;!e.isUndefined(x);x=this.parent(x))if(x===p)throw new Error("Setting "+g+" as parent of "+p+" would create a cycle");this.setNode(g)}return this.setNode(p),this._removeFromParentsChildList(p),this._parent[p]=g,this._children[g][p]=!0,this},r.prototype._removeFromParentsChildList=function(p){delete this._children[this._parent[p]][p]},r.prototype.parent=function(p){if(this._isCompound){var g=this._parent[p];if(g!==n)return g}},r.prototype.children=function(p){if(e.isUndefined(p)&&(p=n),this._isCompound){var g=this._children[p];if(g)return e.keys(g)}else{if(p===n)return this.nodes();if(this.hasNode(p))return[]}},r.prototype.predecessors=function(p){var g=this._preds[p];if(g)return e.keys(g)},r.prototype.successors=function(p){var g=this._sucs[p];if(g)return e.keys(g)},r.prototype.neighbors=function(p){var g=this.predecessors(p);if(g)return e.union(g,this.successors(p))},r.prototype.isLeaf=function(p){var g;return this.isDirected()?g=this.successors(p):g=this.neighbors(p),g.length===0},r.prototype.filterNodes=function(p){var g=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});g.setGraph(this.graph());var x=this;e.each(this._nodes,function(w,S){p(S)&&g.setNode(S,w)}),e.each(this._edgeObjs,function(w){g.hasNode(w.v)&&g.hasNode(w.w)&&g.setEdge(w,x.edge(w))});var v={};function b(w){var S=x.parent(w);return S===void 0||g.hasNode(S)?(v[w]=S,S):S in v?v[S]:b(S)}return this._isCompound&&e.each(g.nodes(),function(w){g.setParent(w,b(w))}),g},r.prototype.setDefaultEdgeLabel=function(p){return e.isFunction(p)||(p=e.constant(p)),this._defaultEdgeLabelFn=p,this},r.prototype.edgeCount=function(){return this._edgeCount},r.prototype.edges=function(){return e.values(this._edgeObjs)},r.prototype.setPath=function(p,g){var x=this,v=arguments;return e.reduce(p,function(b,w){return v.length>1?x.setEdge(b,w,g):x.setEdge(b,w),w}),this},r.prototype.setEdge=function(){var p,g,x,v,b=!1,w=arguments[0];typeof w=="object"&&w!==null&&"v"in w?(p=w.v,g=w.w,x=w.name,arguments.length===2&&(v=arguments[1],b=!0)):(p=w,g=arguments[1],x=arguments[3],arguments.length>2&&(v=arguments[2],b=!0)),p=""+p,g=""+g,e.isUndefined(x)||(x=""+x);var S=u(this._isDirected,p,g,x);if(e.has(this._edgeLabels,S))return b&&(this._edgeLabels[S]=v),this;if(!e.isUndefined(x)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(p),this.setNode(g),this._edgeLabels[S]=b?v:this._defaultEdgeLabelFn(p,g,x);var N=f(this._isDirected,p,g,x);return p=N.v,g=N.w,Object.freeze(N),this._edgeObjs[S]=N,o(this._preds[g],p),o(this._sucs[p],g),this._in[g][S]=N,this._out[p][S]=N,this._edgeCount++,this},r.prototype.edge=function(p,g,x){var v=arguments.length===1?h(this._isDirected,arguments[0]):u(this._isDirected,p,g,x);return this._edgeLabels[v]},r.prototype.hasEdge=function(p,g,x){var v=arguments.length===1?h(this._isDirected,arguments[0]):u(this._isDirected,p,g,x);return e.has(this._edgeLabels,v)},r.prototype.removeEdge=function(p,g,x){var v=arguments.length===1?h(this._isDirected,arguments[0]):u(this._isDirected,p,g,x),b=this._edgeObjs[v];return b&&(p=b.v,g=b.w,delete this._edgeLabels[v],delete this._edgeObjs[v],c(this._preds[g],p),c(this._sucs[p],g),delete this._in[g][v],delete this._out[p][v],this._edgeCount--),this},r.prototype.inEdges=function(p,g){var x=this._in[p];if(x){var v=e.values(x);return g?e.filter(v,function(b){return b.v===g}):v}},r.prototype.outEdges=function(p,g){var x=this._out[p];if(x){var v=e.values(x);return g?e.filter(v,function(b){return b.w===g}):v}},r.prototype.nodeEdges=function(p,g){var x=this.inEdges(p,g);if(x)return x.concat(this.outEdges(p,g))};function o(p,g){p[g]?p[g]++:p[g]=1}function c(p,g){--p[g]||delete p[g]}function u(p,g,x,v){var b=""+g,w=""+x;if(!p&&b>w){var S=b;b=w,w=S}return b+s+w+s+(e.isUndefined(v)?t:v)}function f(p,g,x,v){var b=""+g,w=""+x;if(!p&&b>w){var S=b;b=w,w=S}var N={v:b,w};return v&&(N.name=v),N}function h(p,g){return u(p,g.v,g.w,g.name)}return Wb}var Qb,y3;function qte(){return y3||(y3=1,Qb="2.1.8"),Qb}var Xb,b3;function $te(){return b3||(b3=1,Xb={Graph:qN(),version:qte()}),Xb}var Zb,w3;function zte(){if(w3)return Zb;w3=1;var e=ms(),t=qN();Zb={write:n,read:o};function n(c){var u={options:{directed:c.isDirected(),multigraph:c.isMultigraph(),compound:c.isCompound()},nodes:s(c),edges:r(c)};return e.isUndefined(c.graph())||(u.value=e.clone(c.graph())),u}function s(c){return e.map(c.nodes(),function(u){var f=c.node(u),h=c.parent(u),p={v:u};return e.isUndefined(f)||(p.value=f),e.isUndefined(h)||(p.parent=h),p})}function r(c){return e.map(c.edges(),function(u){var f=c.edge(u),h={v:u.v,w:u.w};return e.isUndefined(u.name)||(h.name=u.name),e.isUndefined(f)||(h.value=f),h})}function o(c){var u=new t(c.options).setGraph(c.value);return e.each(c.nodes,function(f){u.setNode(f.v,f.value),f.parent&&u.setParent(f.v,f.parent)}),e.each(c.edges,function(f){u.setEdge({v:f.v,w:f.w,name:f.name},f.value)}),u}return Zb}var Jb,S3;function Bte(){if(S3)return Jb;S3=1;var e=ms();Jb=t;function t(n){var s={},r=[],o;function c(u){e.has(s,u)||(s[u]=!0,o.push(u),e.each(n.successors(u),c),e.each(n.predecessors(u),c))}return e.each(n.nodes(),function(u){o=[],c(u),o.length&&r.push(o)}),r}return Jb}var ew,j3;function Lq(){if(j3)return ew;j3=1;var e=ms();ew=t;function t(){this._arr=[],this._keyIndices={}}return t.prototype.size=function(){return this._arr.length},t.prototype.keys=function(){return this._arr.map(function(n){return n.key})},t.prototype.has=function(n){return e.has(this._keyIndices,n)},t.prototype.priority=function(n){var s=this._keyIndices[n];if(s!==void 0)return this._arr[s].priority},t.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},t.prototype.add=function(n,s){var r=this._keyIndices;if(n=String(n),!e.has(r,n)){var o=this._arr,c=o.length;return r[n]=c,o.push({key:n,priority:s}),this._decrease(c),!0}return!1},t.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var n=this._arr.pop();return delete this._keyIndices[n.key],this._heapify(0),n.key},t.prototype.decrease=function(n,s){var r=this._keyIndices[n];if(s>this._arr[r].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[r].priority+" New: "+s);this._arr[r].priority=s,this._decrease(r)},t.prototype._heapify=function(n){var s=this._arr,r=2*n,o=r+1,c=n;r<s.length&&(c=s[r].priority<s[c].priority?r:c,o<s.length&&(c=s[o].priority<s[c].priority?o:c),c!==n&&(this._swap(n,c),this._heapify(c)))},t.prototype._decrease=function(n){for(var s=this._arr,r=s[n].priority,o;n!==0&&(o=n>>1,!(s[o].priority<r));)this._swap(n,o),n=o},t.prototype._swap=function(n,s){var r=this._arr,o=this._keyIndices,c=r[n],u=r[s];r[n]=u,r[s]=c,o[u.key]=n,o[c.key]=s},ew}var tw,N3;function Pq(){if(N3)return tw;N3=1;var e=ms(),t=Lq();tw=s;var n=e.constant(1);function s(o,c,u,f){return r(o,String(c),u||n,f||function(h){return o.outEdges(h)})}function r(o,c,u,f){var h={},p=new t,g,x,v=function(b){var w=b.v!==g?b.v:b.w,S=h[w],N=u(b),C=x.distance+N;if(N<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+b+" Weight: "+N);C<S.distance&&(S.distance=C,S.predecessor=g,p.decrease(w,C))};for(o.nodes().forEach(function(b){var w=b===c?0:Number.POSITIVE_INFINITY;h[b]={distance:w},p.add(b,w)});p.size()>0&&(g=p.removeMin(),x=h[g],x.distance!==Number.POSITIVE_INFINITY);)f(g).forEach(v);return h}return tw}var nw,_3;function Fte(){if(_3)return nw;_3=1;var e=Pq(),t=ms();nw=n;function n(s,r,o){return t.transform(s.nodes(),function(c,u){c[u]=e(s,u,r,o)},{})}return nw}var sw,C3;function Dq(){if(C3)return sw;C3=1;var e=ms();sw=t;function t(n){var s=0,r=[],o={},c=[];function u(f){var h=o[f]={onStack:!0,lowlink:s,index:s++};if(r.push(f),n.successors(f).forEach(function(x){e.has(o,x)?o[x].onStack&&(h.lowlink=Math.min(h.lowlink,o[x].index)):(u(x),h.lowlink=Math.min(h.lowlink,o[x].lowlink))}),h.lowlink===h.index){var p=[],g;do g=r.pop(),o[g].onStack=!1,p.push(g);while(f!==g);c.push(p)}}return n.nodes().forEach(function(f){e.has(o,f)||u(f)}),c}return sw}var rw,k3;function Hte(){if(k3)return rw;k3=1;var e=ms(),t=Dq();rw=n;function n(s){return e.filter(t(s),function(r){return r.length>1||r.length===1&&s.hasEdge(r[0],r[0])})}return rw}var iw,R3;function Ute(){if(R3)return iw;R3=1;var e=ms();iw=n;var t=e.constant(1);function n(r,o,c){return s(r,o||t,c||function(u){return r.outEdges(u)})}function s(r,o,c){var u={},f=r.nodes();return f.forEach(function(h){u[h]={},u[h][h]={distance:0},f.forEach(function(p){h!==p&&(u[h][p]={distance:Number.POSITIVE_INFINITY})}),c(h).forEach(function(p){var g=p.v===h?p.w:p.v,x=o(p);u[h][g]={distance:x,predecessor:h}})}),f.forEach(function(h){var p=u[h];f.forEach(function(g){var x=u[g];f.forEach(function(v){var b=x[h],w=p[v],S=x[v],N=b.distance+w.distance;N<S.distance&&(S.distance=N,S.predecessor=w.predecessor)})})}),u}return iw}var aw,E3;function qq(){if(E3)return aw;E3=1;var e=ms();aw=t,t.CycleException=n;function t(s){var r={},o={},c=[];function u(f){if(e.has(o,f))throw new n;e.has(r,f)||(o[f]=!0,r[f]=!0,e.each(s.predecessors(f),u),delete o[f],c.push(f))}if(e.each(s.sinks(),u),e.size(r)!==s.nodeCount())throw new n;return c}function n(){}return n.prototype=new Error,aw}var ow,A3;function Vte(){if(A3)return ow;A3=1;var e=qq();ow=t;function t(n){try{e(n)}catch(s){if(s instanceof e.CycleException)return!1;throw s}return!0}return ow}var lw,T3;function $q(){if(T3)return lw;T3=1;var e=ms();lw=t;function t(s,r,o){e.isArray(r)||(r=[r]);var c=(s.isDirected()?s.successors:s.neighbors).bind(s),u=[],f={};return e.each(r,function(h){if(!s.hasNode(h))throw new Error("Graph does not have node: "+h);n(s,h,o==="post",f,c,u)}),u}function n(s,r,o,c,u,f){e.has(c,r)||(c[r]=!0,o||f.push(r),e.each(u(r),function(h){n(s,h,o,c,u,f)}),o&&f.push(r))}return lw}var cw,M3;function Gte(){if(M3)return cw;M3=1;var e=$q();cw=t;function t(n,s){return e(n,s,"post")}return cw}var uw,I3;function Kte(){if(I3)return uw;I3=1;var e=$q();uw=t;function t(n,s){return e(n,s,"pre")}return uw}var dw,O3;function Yte(){if(O3)return dw;O3=1;var e=ms(),t=qN(),n=Lq();dw=s;function s(r,o){var c=new t,u={},f=new n,h;function p(x){var v=x.v===h?x.w:x.v,b=f.priority(v);if(b!==void 0){var w=o(x);w<b&&(u[v]=h,f.decrease(v,w))}}if(r.nodeCount()===0)return c;e.each(r.nodes(),function(x){f.add(x,Number.POSITIVE_INFINITY),c.setNode(x)}),f.decrease(r.nodes()[0],0);for(var g=!1;f.size()>0;){if(h=f.removeMin(),e.has(u,h))c.setEdge(h,u[h]);else{if(g)throw new Error("Input graph is not connected: "+r);g=!0}r.nodeEdges(h).forEach(p)}return c}return dw}var fw,L3;function Wte(){return L3||(L3=1,fw={components:Bte(),dijkstra:Pq(),dijkstraAll:Fte(),findCycles:Hte(),floydWarshall:Ute(),isAcyclic:Vte(),postorder:Gte(),preorder:Kte(),prim:Yte(),tarjan:Dq(),topsort:qq()}),fw}var hw,P3;function Qte(){if(P3)return hw;P3=1;var e=$te();return hw={Graph:e.Graph,json:zte(),alg:Wte(),version:e.version},hw}var pw,D3;function As(){if(D3)return pw;D3=1;var e;if(typeof SN=="function")try{e=Qte()}catch{}return e||(e=window.graphlib),pw=e,pw}var mw,q3;function Xte(){if(q3)return mw;q3=1;var e=uq(),t=1,n=4;function s(r){return e(r,t|n)}return mw=s,mw}var gw,$3;function ym(){if($3)return gw;$3=1;var e=Ql(),t=zr(),n=um(),s=ps();function r(o,c,u){if(!s(u))return!1;var f=typeof c;return(f=="number"?t(u)&&n(c,u.length):f=="string"&&c in u)?e(u[c],o):!1}return gw=r,gw}var xw,z3;function Zte(){if(z3)return xw;z3=1;var e=vm(),t=Ql(),n=ym(),s=uo(),r=Object.prototype,o=r.hasOwnProperty,c=e(function(u,f){u=Object(u);var h=-1,p=f.length,g=p>2?f[2]:void 0;for(g&&n(f[0],f[1],g)&&(p=1);++h<p;)for(var x=f[h],v=s(x),b=-1,w=v.length;++b<w;){var S=v[b],N=u[S];(N===void 0||t(N,r[S])&&!o.call(u,S))&&(u[S]=x[S])}return u});return xw=c,xw}var vw,B3;function Jte(){if(B3)return vw;B3=1;var e=Br(),t=zr(),n=Zi();function s(r){return function(o,c,u){var f=Object(o);if(!t(o)){var h=e(c,3);o=n(o),c=function(g){return h(f[g],g,f)}}var p=r(o,c,u);return p>-1?f[h?o[p]:p]:void 0}}return vw=s,vw}var yw,F3;function ene(){if(F3)return yw;F3=1;var e=/\s/;function t(n){for(var s=n.length;s--&&e.test(n.charAt(s)););return s}return yw=t,yw}var bw,H3;function tne(){if(H3)return bw;H3=1;var e=ene(),t=/^\s+/;function n(s){return s&&s.slice(0,e(s)+1).replace(t,"")}return bw=n,bw}var ww,U3;function nne(){if(U3)return ww;U3=1;var e=tne(),t=ps(),n=ec(),s=NaN,r=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,c=/^0o[0-7]+$/i,u=parseInt;function f(h){if(typeof h=="number")return h;if(n(h))return s;if(t(h)){var p=typeof h.valueOf=="function"?h.valueOf():h;h=t(p)?p+"":p}if(typeof h!="string")return h===0?h:+h;h=e(h);var g=o.test(h);return g||c.test(h)?u(h.slice(2),g?2:8):r.test(h)?s:+h}return ww=f,ww}var Sw,V3;function zq(){if(V3)return Sw;V3=1;var e=nne(),t=1/0,n=17976931348623157e292;function s(r){if(!r)return r===0?r:0;if(r=e(r),r===t||r===-t){var o=r<0?-1:1;return o*n}return r===r?r:0}return Sw=s,Sw}var jw,G3;function sne(){if(G3)return jw;G3=1;var e=zq();function t(n){var s=e(n),r=s%1;return s===s?r?s-r:s:0}return jw=t,jw}var Nw,K3;function rne(){if(K3)return Nw;K3=1;var e=Mq(),t=Br(),n=sne(),s=Math.max;function r(o,c,u){var f=o==null?0:o.length;if(!f)return-1;var h=u==null?0:n(u);return h<0&&(h=s(f+h,0)),e(o,t(c,3),h)}return Nw=r,Nw}var _w,Y3;function ine(){if(Y3)return _w;Y3=1;var e=Jte(),t=rne(),n=e(t);return _w=n,_w}var Cw,W3;function Bq(){if(W3)return Cw;W3=1;var e=DN();function t(n){var s=n==null?0:n.length;return s?e(n,1):[]}return Cw=t,Cw}var kw,Q3;function ane(){if(Q3)return kw;Q3=1;var e=IN(),t=dq(),n=uo();function s(r,o){return r==null?r:e(r,t(o),n)}return kw=s,kw}var Rw,X3;function one(){if(X3)return Rw;X3=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return Rw=e,Rw}var Ew,Z3;function lne(){if(Z3)return Ew;Z3=1;var e=lm(),t=ON(),n=Br();function s(r,o){var c={};return o=n(o,3),t(r,function(u,f,h){e(c,f,o(u,f,h))}),c}return Ew=s,Ew}var Aw,J3;function $N(){if(J3)return Aw;J3=1;var e=ec();function t(n,s,r){for(var o=-1,c=n.length;++o<c;){var u=n[o],f=s(u);if(f!=null&&(h===void 0?f===f&&!e(f):r(f,h)))var h=f,p=u}return p}return Aw=t,Aw}var Tw,e5;function cne(){if(e5)return Tw;e5=1;function e(t,n){return t>n}return Tw=e,Tw}var Mw,t5;function une(){if(t5)return Mw;t5=1;var e=$N(),t=cne(),n=fo();function s(r){return r&&r.length?e(r,n,t):void 0}return Mw=s,Mw}var Iw,n5;function Fq(){if(n5)return Iw;n5=1;var e=lm(),t=Ql();function n(s,r,o){(o!==void 0&&!t(s[r],o)||o===void 0&&!(r in s))&&e(s,r,o)}return Iw=n,Iw}var Ow,s5;function dne(){if(s5)return Ow;s5=1;var e=lo(),t=hm(),n=er(),s="[object Object]",r=Function.prototype,o=Object.prototype,c=r.toString,u=o.hasOwnProperty,f=c.call(Object);function h(p){if(!n(p)||e(p)!=s)return!1;var g=t(p);if(g===null)return!0;var x=u.call(g,"constructor")&&g.constructor;return typeof x=="function"&&x instanceof x&&c.call(x)==f}return Ow=h,Ow}var Lw,r5;function Hq(){if(r5)return Lw;r5=1;function e(t,n){if(!(n==="constructor"&&typeof t[n]=="function")&&n!="__proto__")return t[n]}return Lw=e,Lw}var Pw,i5;function fne(){if(i5)return Pw;i5=1;var e=yd(),t=uo();function n(s){return e(s,t(s))}return Pw=n,Pw}var Dw,a5;function hne(){if(a5)return Dw;a5=1;var e=Fq(),t=ZD(),n=oq(),s=JD(),r=cq(),o=bd(),c=Ft(),u=Iq(),f=Zl(),h=vd(),p=ps(),g=dne(),x=wd(),v=Hq(),b=fne();function w(S,N,C,k,_,E,M){var A=v(S,C),O=v(N,C),L=M.get(O);if(L){e(S,C,L);return}var P=E?E(A,O,C+"",S,N,M):void 0,I=P===void 0;if(I){var B=c(O),F=!B&&f(O),z=!B&&!F&&x(O);P=O,B||F||z?c(A)?P=A:u(A)?P=s(A):F?(I=!1,P=t(O,!0)):z?(I=!1,P=n(O,!0)):P=[]:g(O)||o(O)?(P=A,o(A)?P=b(A):(!p(A)||h(A))&&(P=r(O))):I=!1}I&&(M.set(O,P),_(P,O,k,E,M),M.delete(O)),e(S,C,P)}return Dw=w,Dw}var qw,o5;function pne(){if(o5)return qw;o5=1;var e=om(),t=Fq(),n=IN(),s=hne(),r=ps(),o=uo(),c=Hq();function u(f,h,p,g,x){f!==h&&n(h,function(v,b){if(x||(x=new e),r(v))s(f,h,b,p,u,g,x);else{var w=g?g(c(f,b),v,b+"",f,h,x):void 0;w===void 0&&(w=v),t(f,b,w)}},o)}return qw=u,qw}var $w,l5;function mne(){if(l5)return $w;l5=1;var e=vm(),t=ym();function n(s){return e(function(r,o){var c=-1,u=o.length,f=u>1?o[u-1]:void 0,h=u>2?o[2]:void 0;for(f=s.length>3&&typeof f=="function"?(u--,f):void 0,h&&t(o[0],o[1],h)&&(f=u<3?void 0:f,u=1),r=Object(r);++c<u;){var p=o[c];p&&s(r,p,c,f)}return r})}return $w=n,$w}var zw,c5;function gne(){if(c5)return zw;c5=1;var e=pne(),t=mne(),n=t(function(s,r,o){e(s,r,o)});return zw=n,zw}var Bw,u5;function Uq(){if(u5)return Bw;u5=1;function e(t,n){return t<n}return Bw=e,Bw}var Fw,d5;function xne(){if(d5)return Fw;d5=1;var e=$N(),t=Uq(),n=fo();function s(r){return r&&r.length?e(r,n,t):void 0}return Fw=s,Fw}var Hw,f5;function vne(){if(f5)return Hw;f5=1;var e=$N(),t=Br(),n=Uq();function s(r,o){return r&&r.length?e(r,t(o,2),n):void 0}return Hw=s,Hw}var Uw,h5;function yne(){if(h5)return Uw;h5=1;var e=Is(),t=function(){return e.Date.now()};return Uw=t,Uw}var Vw,p5;function bne(){if(p5)return Vw;p5=1;var e=cm(),t=gm(),n=um(),s=ps(),r=Sd();function o(c,u,f,h){if(!s(c))return c;u=t(u,c);for(var p=-1,g=u.length,x=g-1,v=c;v!=null&&++p<g;){var b=r(u[p]),w=f;if(b==="__proto__"||b==="constructor"||b==="prototype")return c;if(p!=x){var S=v[b];w=h?h(S,b,v):void 0,w===void 0&&(w=s(S)?S:n(u[p+1])?[]:{})}e(v,b,w),v=v[b]}return c}return Vw=o,Vw}var Gw,m5;function wne(){if(m5)return Gw;m5=1;var e=xm(),t=bne(),n=gm();function s(r,o,c){for(var u=-1,f=o.length,h={};++u<f;){var p=o[u],g=e(r,p);c(g,p)&&t(h,n(p,r),g)}return h}return Gw=s,Gw}var Kw,g5;function Sne(){if(g5)return Kw;g5=1;var e=wne(),t=Sq();function n(s,r){return e(s,r,function(o,c){return t(s,c)})}return Kw=n,Kw}var Yw,x5;function jne(){if(x5)return Yw;x5=1;var e=Bq(),t=Aq(),n=Tq();function s(r){return n(t(r,void 0,e),r+"")}return Yw=s,Yw}var Ww,v5;function Nne(){if(v5)return Ww;v5=1;var e=Sne(),t=jne(),n=t(function(s,r){return s==null?{}:e(s,r)});return Ww=n,Ww}var Qw,y5;function _ne(){if(y5)return Qw;y5=1;var e=Math.ceil,t=Math.max;function n(s,r,o,c){for(var u=-1,f=t(e((r-s)/(o||1)),0),h=Array(f);f--;)h[c?f:++u]=s,s+=o;return h}return Qw=n,Qw}var Xw,b5;function Cne(){if(b5)return Xw;b5=1;var e=_ne(),t=ym(),n=zq();function s(r){return function(o,c,u){return u&&typeof u!="number"&&t(o,c,u)&&(c=u=void 0),o=n(o),c===void 0?(c=o,o=0):c=n(c),u=u===void 0?o<c?1:-1:n(u),e(o,c,u,r)}}return Xw=s,Xw}var Zw,w5;function kne(){if(w5)return Zw;w5=1;var e=Cne(),t=e();return Zw=t,Zw}var Jw,S5;function Rne(){if(S5)return Jw;S5=1;function e(t,n){var s=t.length;for(t.sort(n);s--;)t[s]=t[s].value;return t}return Jw=e,Jw}var e1,j5;function Ene(){if(j5)return e1;j5=1;var e=ec();function t(n,s){if(n!==s){var r=n!==void 0,o=n===null,c=n===n,u=e(n),f=s!==void 0,h=s===null,p=s===s,g=e(s);if(!h&&!g&&!u&&n>s||u&&f&&p&&!h&&!g||o&&f&&p||!r&&p||!c)return 1;if(!o&&!u&&!g&&n<s||g&&r&&c&&!o&&!u||h&&r&&c||!f&&c||!p)return-1}return 0}return e1=t,e1}var t1,N5;function Ane(){if(N5)return t1;N5=1;var e=Ene();function t(n,s,r){for(var o=-1,c=n.criteria,u=s.criteria,f=c.length,h=r.length;++o<f;){var p=e(c[o],u[o]);if(p){if(o>=h)return p;var g=r[o];return p*(g=="desc"?-1:1)}}return n.index-s.index}return t1=t,t1}var n1,_5;function Tne(){if(_5)return n1;_5=1;var e=mm(),t=xm(),n=Br(),s=kq(),r=Rne(),o=dm(),c=Ane(),u=fo(),f=Ft();function h(p,g,x){g.length?g=e(g,function(w){return f(w)?function(S){return t(S,w.length===1?w[0]:w)}:w}):g=[u];var v=-1;g=e(g,o(n));var b=s(p,function(w,S,N){var C=e(g,function(k){return k(w)});return{criteria:C,index:++v,value:w}});return r(b,function(w,S){return c(w,S,x)})}return n1=h,n1}var s1,C5;function Mne(){if(C5)return s1;C5=1;var e=DN(),t=Tne(),n=vm(),s=ym(),r=n(function(o,c){if(o==null)return[];var u=c.length;return u>1&&s(o,c[0],c[1])?c=[]:u>2&&s(c[0],c[1],c[2])&&(c=[c[0]]),t(o,e(c,1),[])});return s1=r,s1}var r1,k5;function Ine(){if(k5)return r1;k5=1;var e=bq(),t=0;function n(s){var r=++t;return e(s)+r}return r1=n,r1}var i1,R5;function One(){if(R5)return i1;R5=1;function e(t,n,s){for(var r=-1,o=t.length,c=n.length,u={};++r<o;){var f=r<c?n[r]:void 0;s(u,t[r],f)}return u}return i1=e,i1}var a1,E5;function Lne(){if(E5)return a1;E5=1;var e=cm(),t=One();function n(s,r){return t(s||[],r||[],e)}return a1=n,a1}var o1,A5;function _t(){if(A5)return o1;A5=1;var e;if(typeof SN=="function")try{e={cloneDeep:Xte(),constant:MN(),defaults:Zte(),each:hq(),filter:Nq(),find:ine(),flatten:Bq(),forEach:fq(),forIn:ane(),has:_q(),isUndefined:Cq(),last:one(),map:Rq(),mapValues:lne(),max:une(),merge:gne(),min:xne(),minBy:vne(),now:yne(),pick:Nne(),range:kne(),reduce:Eq(),sortBy:Mne(),uniqueId:Ine(),values:Oq(),zipObject:Lne()}}catch{}return e||(e=window._),o1=e,o1}var l1,T5;function Pne(){if(T5)return l1;T5=1,l1=e;function e(){var s={};s._next=s._prev=s,this._sentinel=s}e.prototype.dequeue=function(){var s=this._sentinel,r=s._prev;if(r!==s)return t(r),r},e.prototype.enqueue=function(s){var r=this._sentinel;s._prev&&s._next&&t(s),s._next=r._next,r._next._prev=s,r._next=s,s._prev=r},e.prototype.toString=function(){for(var s=[],r=this._sentinel,o=r._prev;o!==r;)s.push(JSON.stringify(o,n)),o=o._prev;return"["+s.join(", ")+"]"};function t(s){s._prev._next=s._next,s._next._prev=s._prev,delete s._next,delete s._prev}function n(s,r){if(s!=="_next"&&s!=="_prev")return r}return l1}var c1,M5;function Dne(){if(M5)return c1;M5=1;var e=_t(),t=As().Graph,n=Pne();c1=r;var s=e.constant(1);function r(h,p){if(h.nodeCount()<=1)return[];var g=u(h,p||s),x=o(g.graph,g.buckets,g.zeroIdx);return e.flatten(e.map(x,function(v){return h.outEdges(v.v,v.w)}),!0)}function o(h,p,g){for(var x=[],v=p[p.length-1],b=p[0],w;h.nodeCount();){for(;w=b.dequeue();)c(h,p,g,w);for(;w=v.dequeue();)c(h,p,g,w);if(h.nodeCount()){for(var S=p.length-2;S>0;--S)if(w=p[S].dequeue(),w){x=x.concat(c(h,p,g,w,!0));break}}}return x}function c(h,p,g,x,v){var b=v?[]:void 0;return e.forEach(h.inEdges(x.v),function(w){var S=h.edge(w),N=h.node(w.v);v&&b.push({v:w.v,w:w.w}),N.out-=S,f(p,g,N)}),e.forEach(h.outEdges(x.v),function(w){var S=h.edge(w),N=w.w,C=h.node(N);C.in-=S,f(p,g,C)}),h.removeNode(x.v),b}function u(h,p){var g=new t,x=0,v=0;e.forEach(h.nodes(),function(S){g.setNode(S,{v:S,in:0,out:0})}),e.forEach(h.edges(),function(S){var N=g.edge(S.v,S.w)||0,C=p(S),k=N+C;g.setEdge(S.v,S.w,k),v=Math.max(v,g.node(S.v).out+=C),x=Math.max(x,g.node(S.w).in+=C)});var b=e.range(v+x+3).map(function(){return new n}),w=x+1;return e.forEach(g.nodes(),function(S){f(b,w,g.node(S))}),{graph:g,buckets:b,zeroIdx:w}}function f(h,p,g){g.out?g.in?h[g.out-g.in+p].enqueue(g):h[h.length-1].enqueue(g):h[0].enqueue(g)}return c1}var u1,I5;function qne(){if(I5)return u1;I5=1;var e=_t(),t=Dne();u1={run:n,undo:r};function n(o){var c=o.graph().acyclicer==="greedy"?t(o,u(o)):s(o);e.forEach(c,function(f){var h=o.edge(f);o.removeEdge(f),h.forwardName=f.name,h.reversed=!0,o.setEdge(f.w,f.v,h,e.uniqueId("rev"))});function u(f){return function(h){return f.edge(h).weight}}}function s(o){var c=[],u={},f={};function h(p){e.has(f,p)||(f[p]=!0,u[p]=!0,e.forEach(o.outEdges(p),function(g){e.has(u,g.w)?c.push(g):h(g.w)}),delete u[p])}return e.forEach(o.nodes(),h),c}function r(o){e.forEach(o.edges(),function(c){var u=o.edge(c);if(u.reversed){o.removeEdge(c);var f=u.forwardName;delete u.reversed,delete u.forwardName,o.setEdge(c.w,c.v,u,f)}})}return u1}var d1,O5;function zn(){if(O5)return d1;O5=1;var e=_t(),t=As().Graph;d1={addDummyNode:n,simplify:s,asNonCompoundGraph:r,successorWeights:o,predecessorWeights:c,intersectRect:u,buildLayerMatrix:f,normalizeRanks:h,removeEmptyRanks:p,addBorderNode:g,maxRank:x,partition:v,time:b,notime:w};function n(S,N,C,k){var _;do _=e.uniqueId(k);while(S.hasNode(_));return C.dummy=N,S.setNode(_,C),_}function s(S){var N=new t().setGraph(S.graph());return e.forEach(S.nodes(),function(C){N.setNode(C,S.node(C))}),e.forEach(S.edges(),function(C){var k=N.edge(C.v,C.w)||{weight:0,minlen:1},_=S.edge(C);N.setEdge(C.v,C.w,{weight:k.weight+_.weight,minlen:Math.max(k.minlen,_.minlen)})}),N}function r(S){var N=new t({multigraph:S.isMultigraph()}).setGraph(S.graph());return e.forEach(S.nodes(),function(C){S.children(C).length||N.setNode(C,S.node(C))}),e.forEach(S.edges(),function(C){N.setEdge(C,S.edge(C))}),N}function o(S){var N=e.map(S.nodes(),function(C){var k={};return e.forEach(S.outEdges(C),function(_){k[_.w]=(k[_.w]||0)+S.edge(_).weight}),k});return e.zipObject(S.nodes(),N)}function c(S){var N=e.map(S.nodes(),function(C){var k={};return e.forEach(S.inEdges(C),function(_){k[_.v]=(k[_.v]||0)+S.edge(_).weight}),k});return e.zipObject(S.nodes(),N)}function u(S,N){var C=S.x,k=S.y,_=N.x-C,E=N.y-k,M=S.width/2,A=S.height/2;if(!_&&!E)throw new Error("Not possible to find intersection inside of the rectangle");var O,L;return Math.abs(E)*M>Math.abs(_)*A?(E<0&&(A=-A),O=A*_/E,L=A):(_<0&&(M=-M),O=M,L=M*E/_),{x:C+O,y:k+L}}function f(S){var N=e.map(e.range(x(S)+1),function(){return[]});return e.forEach(S.nodes(),function(C){var k=S.node(C),_=k.rank;e.isUndefined(_)||(N[_][k.order]=C)}),N}function h(S){var N=e.min(e.map(S.nodes(),function(C){return S.node(C).rank}));e.forEach(S.nodes(),function(C){var k=S.node(C);e.has(k,"rank")&&(k.rank-=N)})}function p(S){var N=e.min(e.map(S.nodes(),function(E){return S.node(E).rank})),C=[];e.forEach(S.nodes(),function(E){var M=S.node(E).rank-N;C[M]||(C[M]=[]),C[M].push(E)});var k=0,_=S.graph().nodeRankFactor;e.forEach(C,function(E,M){e.isUndefined(E)&&M%_!==0?--k:k&&e.forEach(E,function(A){S.node(A).rank+=k})})}function g(S,N,C,k){var _={width:0,height:0};return arguments.length>=4&&(_.rank=C,_.order=k),n(S,"border",_,N)}function x(S){return e.max(e.map(S.nodes(),function(N){var C=S.node(N).rank;if(!e.isUndefined(C))return C}))}function v(S,N){var C={lhs:[],rhs:[]};return e.forEach(S,function(k){N(k)?C.lhs.push(k):C.rhs.push(k)}),C}function b(S,N){var C=e.now();try{return N()}finally{console.log(S+" time: "+(e.now()-C)+"ms")}}function w(S,N){return N()}return d1}var f1,L5;function $ne(){if(L5)return f1;L5=1;var e=_t(),t=zn();f1={run:n,undo:r};function n(o){o.graph().dummyChains=[],e.forEach(o.edges(),function(c){s(o,c)})}function s(o,c){var u=c.v,f=o.node(u).rank,h=c.w,p=o.node(h).rank,g=c.name,x=o.edge(c),v=x.labelRank;if(p!==f+1){o.removeEdge(c);var b,w,S;for(S=0,++f;f<p;++S,++f)x.points=[],w={width:0,height:0,edgeLabel:x,edgeObj:c,rank:f},b=t.addDummyNode(o,"edge",w,"_d"),f===v&&(w.width=x.width,w.height=x.height,w.dummy="edge-label",w.labelpos=x.labelpos),o.setEdge(u,b,{weight:x.weight},g),S===0&&o.graph().dummyChains.push(b),u=b;o.setEdge(u,h,{weight:x.weight},g)}}function r(o){e.forEach(o.graph().dummyChains,function(c){var u=o.node(c),f=u.edgeLabel,h;for(o.setEdge(u.edgeObj,f);u.dummy;)h=o.successors(c)[0],o.removeNode(c),f.points.push({x:u.x,y:u.y}),u.dummy==="edge-label"&&(f.x=u.x,f.y=u.y,f.width=u.width,f.height=u.height),c=h,u=o.node(c)})}return f1}var h1,P5;function yp(){if(P5)return h1;P5=1;var e=_t();h1={longestPath:t,slack:n};function t(s){var r={};function o(c){var u=s.node(c);if(e.has(r,c))return u.rank;r[c]=!0;var f=e.min(e.map(s.outEdges(c),function(h){return o(h.w)-s.edge(h).minlen}));return(f===Number.POSITIVE_INFINITY||f===void 0||f===null)&&(f=0),u.rank=f}e.forEach(s.sources(),o)}function n(s,r){return s.node(r.w).rank-s.node(r.v).rank-s.edge(r).minlen}return h1}var p1,D5;function Vq(){if(D5)return p1;D5=1;var e=_t(),t=As().Graph,n=yp().slack;p1=s;function s(u){var f=new t({directed:!1}),h=u.nodes()[0],p=u.nodeCount();f.setNode(h,{});for(var g,x;r(f,u)<p;)g=o(f,u),x=f.hasNode(g.v)?n(u,g):-n(u,g),c(f,u,x);return f}function r(u,f){function h(p){e.forEach(f.nodeEdges(p),function(g){var x=g.v,v=p===x?g.w:x;!u.hasNode(v)&&!n(f,g)&&(u.setNode(v,{}),u.setEdge(p,v,{}),h(v))})}return e.forEach(u.nodes(),h),u.nodeCount()}function o(u,f){return e.minBy(f.edges(),function(h){if(u.hasNode(h.v)!==u.hasNode(h.w))return n(f,h)})}function c(u,f,h){e.forEach(u.nodes(),function(p){f.node(p).rank+=h})}return p1}var m1,q5;function zne(){if(q5)return m1;q5=1;var e=_t(),t=Vq(),n=yp().slack,s=yp().longestPath,r=As().alg.preorder,o=As().alg.postorder,c=zn().simplify;m1=u,u.initLowLimValues=g,u.initCutValues=f,u.calcCutValue=p,u.leaveEdge=v,u.enterEdge=b,u.exchangeEdges=w;function u(k){k=c(k),s(k);var _=t(k);g(_),f(_,k);for(var E,M;E=v(_);)M=b(_,k,E),w(_,k,E,M)}function f(k,_){var E=o(k,k.nodes());E=E.slice(0,E.length-1),e.forEach(E,function(M){h(k,_,M)})}function h(k,_,E){var M=k.node(E),A=M.parent;k.edge(E,A).cutvalue=p(k,_,E)}function p(k,_,E){var M=k.node(E),A=M.parent,O=!0,L=_.edge(E,A),P=0;return L||(O=!1,L=_.edge(A,E)),P=L.weight,e.forEach(_.nodeEdges(E),function(I){var B=I.v===E,F=B?I.w:I.v;if(F!==A){var z=B===O,Y=_.edge(I).weight;if(P+=z?Y:-Y,N(k,E,F)){var $=k.edge(E,F).cutvalue;P+=z?-$:$}}}),P}function g(k,_){arguments.length<2&&(_=k.nodes()[0]),x(k,{},1,_)}function x(k,_,E,M,A){var O=E,L=k.node(M);return _[M]=!0,e.forEach(k.neighbors(M),function(P){e.has(_,P)||(E=x(k,_,E,P,M))}),L.low=O,L.lim=E++,A?L.parent=A:delete L.parent,E}function v(k){return e.find(k.edges(),function(_){return k.edge(_).cutvalue<0})}function b(k,_,E){var M=E.v,A=E.w;_.hasEdge(M,A)||(M=E.w,A=E.v);var O=k.node(M),L=k.node(A),P=O,I=!1;O.lim>L.lim&&(P=L,I=!0);var B=e.filter(_.edges(),function(F){return I===C(k,k.node(F.v),P)&&I!==C(k,k.node(F.w),P)});return e.minBy(B,function(F){return n(_,F)})}function w(k,_,E,M){var A=E.v,O=E.w;k.removeEdge(A,O),k.setEdge(M.v,M.w,{}),g(k),f(k,_),S(k,_)}function S(k,_){var E=e.find(k.nodes(),function(A){return!_.node(A).parent}),M=r(k,E);M=M.slice(1),e.forEach(M,function(A){var O=k.node(A).parent,L=_.edge(A,O),P=!1;L||(L=_.edge(O,A),P=!0),_.node(A).rank=_.node(O).rank+(P?L.minlen:-L.minlen)})}function N(k,_,E){return k.hasEdge(_,E)}function C(k,_,E){return E.low<=_.lim&&_.lim<=E.lim}return m1}var g1,$5;function Bne(){if($5)return g1;$5=1;var e=yp(),t=e.longestPath,n=Vq(),s=zne();g1=r;function r(f){switch(f.graph().ranker){case"network-simplex":u(f);break;case"tight-tree":c(f);break;case"longest-path":o(f);break;default:u(f)}}var o=t;function c(f){t(f),n(f)}function u(f){s(f)}return g1}var x1,z5;function Fne(){if(z5)return x1;z5=1;var e=_t();x1=t;function t(r){var o=s(r);e.forEach(r.graph().dummyChains,function(c){for(var u=r.node(c),f=u.edgeObj,h=n(r,o,f.v,f.w),p=h.path,g=h.lca,x=0,v=p[x],b=!0;c!==f.w;){if(u=r.node(c),b){for(;(v=p[x])!==g&&r.node(v).maxRank<u.rank;)x++;v===g&&(b=!1)}if(!b){for(;x<p.length-1&&r.node(v=p[x+1]).minRank<=u.rank;)x++;v=p[x]}r.setParent(c,v),c=r.successors(c)[0]}})}function n(r,o,c,u){var f=[],h=[],p=Math.min(o[c].low,o[u].low),g=Math.max(o[c].lim,o[u].lim),x,v;x=c;do x=r.parent(x),f.push(x);while(x&&(o[x].low>p||g>o[x].lim));for(v=x,x=u;(x=r.parent(x))!==v;)h.push(x);return{path:f.concat(h.reverse()),lca:v}}function s(r){var o={},c=0;function u(f){var h=c;e.forEach(r.children(f),u),o[f]={low:h,lim:c++}}return e.forEach(r.children(),u),o}return x1}var v1,B5;function Hne(){if(B5)return v1;B5=1;var e=_t(),t=zn();v1={run:n,cleanup:c};function n(u){var f=t.addDummyNode(u,"root",{},"_root"),h=r(u),p=e.max(e.values(h))-1,g=2*p+1;u.graph().nestingRoot=f,e.forEach(u.edges(),function(v){u.edge(v).minlen*=g});var x=o(u)+1;e.forEach(u.children(),function(v){s(u,f,g,x,p,h,v)}),u.graph().nodeRankFactor=g}function s(u,f,h,p,g,x,v){var b=u.children(v);if(!b.length){v!==f&&u.setEdge(f,v,{weight:0,minlen:h});return}var w=t.addBorderNode(u,"_bt"),S=t.addBorderNode(u,"_bb"),N=u.node(v);u.setParent(w,v),N.borderTop=w,u.setParent(S,v),N.borderBottom=S,e.forEach(b,function(C){s(u,f,h,p,g,x,C);var k=u.node(C),_=k.borderTop?k.borderTop:C,E=k.borderBottom?k.borderBottom:C,M=k.borderTop?p:2*p,A=_!==E?1:g-x[v]+1;u.setEdge(w,_,{weight:M,minlen:A,nestingEdge:!0}),u.setEdge(E,S,{weight:M,minlen:A,nestingEdge:!0})}),u.parent(v)||u.setEdge(f,w,{weight:0,minlen:g+x[v]})}function r(u){var f={};function h(p,g){var x=u.children(p);x&&x.length&&e.forEach(x,function(v){h(v,g+1)}),f[p]=g}return e.forEach(u.children(),function(p){h(p,1)}),f}function o(u){return e.reduce(u.edges(),function(f,h){return f+u.edge(h).weight},0)}function c(u){var f=u.graph();u.removeNode(f.nestingRoot),delete f.nestingRoot,e.forEach(u.edges(),function(h){var p=u.edge(h);p.nestingEdge&&u.removeEdge(h)})}return v1}var y1,F5;function Une(){if(F5)return y1;F5=1;var e=_t(),t=zn();y1=n;function n(r){function o(c){var u=r.children(c),f=r.node(c);if(u.length&&e.forEach(u,o),e.has(f,"minRank")){f.borderLeft=[],f.borderRight=[];for(var h=f.minRank,p=f.maxRank+1;h<p;++h)s(r,"borderLeft","_bl",c,f,h),s(r,"borderRight","_br",c,f,h)}}e.forEach(r.children(),o)}function s(r,o,c,u,f,h){var p={width:0,height:0,rank:h,borderType:o},g=f[o][h-1],x=t.addDummyNode(r,"border",p,c);f[o][h]=x,r.setParent(x,u),g&&r.setEdge(g,x,{weight:1})}return y1}var b1,H5;function Vne(){if(H5)return b1;H5=1;var e=_t();b1={adjust:t,undo:n};function t(h){var p=h.graph().rankdir.toLowerCase();(p==="lr"||p==="rl")&&s(h)}function n(h){var p=h.graph().rankdir.toLowerCase();(p==="bt"||p==="rl")&&o(h),(p==="lr"||p==="rl")&&(u(h),s(h))}function s(h){e.forEach(h.nodes(),function(p){r(h.node(p))}),e.forEach(h.edges(),function(p){r(h.edge(p))})}function r(h){var p=h.width;h.width=h.height,h.height=p}function o(h){e.forEach(h.nodes(),function(p){c(h.node(p))}),e.forEach(h.edges(),function(p){var g=h.edge(p);e.forEach(g.points,c),e.has(g,"y")&&c(g)})}function c(h){h.y=-h.y}function u(h){e.forEach(h.nodes(),function(p){f(h.node(p))}),e.forEach(h.edges(),function(p){var g=h.edge(p);e.forEach(g.points,f),e.has(g,"x")&&f(g)})}function f(h){var p=h.x;h.x=h.y,h.y=p}return b1}var w1,U5;function Gne(){if(U5)return w1;U5=1;var e=_t();w1=t;function t(n){var s={},r=e.filter(n.nodes(),function(h){return!n.children(h).length}),o=e.max(e.map(r,function(h){return n.node(h).rank})),c=e.map(e.range(o+1),function(){return[]});function u(h){if(!e.has(s,h)){s[h]=!0;var p=n.node(h);c[p.rank].push(h),e.forEach(n.successors(h),u)}}var f=e.sortBy(r,function(h){return n.node(h).rank});return e.forEach(f,u),c}return w1}var S1,V5;function Kne(){if(V5)return S1;V5=1;var e=_t();S1=t;function t(s,r){for(var o=0,c=1;c<r.length;++c)o+=n(s,r[c-1],r[c]);return o}function n(s,r,o){for(var c=e.zipObject(o,e.map(o,function(x,v){return v})),u=e.flatten(e.map(r,function(x){return e.sortBy(e.map(s.outEdges(x),function(v){return{pos:c[v.w],weight:s.edge(v).weight}}),"pos")}),!0),f=1;f<o.length;)f<<=1;var h=2*f-1;f-=1;var p=e.map(new Array(h),function(){return 0}),g=0;return e.forEach(u.forEach(function(x){var v=x.pos+f;p[v]+=x.weight;for(var b=0;v>0;)v%2&&(b+=p[v+1]),v=v-1>>1,p[v]+=x.weight;g+=x.weight*b})),g}return S1}var j1,G5;function Yne(){if(G5)return j1;G5=1;var e=_t();j1=t;function t(n,s){return e.map(s,function(r){var o=n.inEdges(r);if(o.length){var c=e.reduce(o,function(u,f){var h=n.edge(f),p=n.node(f.v);return{sum:u.sum+h.weight*p.order,weight:u.weight+h.weight}},{sum:0,weight:0});return{v:r,barycenter:c.sum/c.weight,weight:c.weight}}else return{v:r}})}return j1}var N1,K5;function Wne(){if(K5)return N1;K5=1;var e=_t();N1=t;function t(r,o){var c={};e.forEach(r,function(f,h){var p=c[f.v]={indegree:0,in:[],out:[],vs:[f.v],i:h};e.isUndefined(f.barycenter)||(p.barycenter=f.barycenter,p.weight=f.weight)}),e.forEach(o.edges(),function(f){var h=c[f.v],p=c[f.w];!e.isUndefined(h)&&!e.isUndefined(p)&&(p.indegree++,h.out.push(c[f.w]))});var u=e.filter(c,function(f){return!f.indegree});return n(u)}function n(r){var o=[];function c(h){return function(p){p.merged||(e.isUndefined(p.barycenter)||e.isUndefined(h.barycenter)||p.barycenter>=h.barycenter)&&s(h,p)}}function u(h){return function(p){p.in.push(h),--p.indegree===0&&r.push(p)}}for(;r.length;){var f=r.pop();o.push(f),e.forEach(f.in.reverse(),c(f)),e.forEach(f.out,u(f))}return e.map(e.filter(o,function(h){return!h.merged}),function(h){return e.pick(h,["vs","i","barycenter","weight"])})}function s(r,o){var c=0,u=0;r.weight&&(c+=r.barycenter*r.weight,u+=r.weight),o.weight&&(c+=o.barycenter*o.weight,u+=o.weight),r.vs=o.vs.concat(r.vs),r.barycenter=c/u,r.weight=u,r.i=Math.min(o.i,r.i),o.merged=!0}return N1}var _1,Y5;function Qne(){if(Y5)return _1;Y5=1;var e=_t(),t=zn();_1=n;function n(o,c){var u=t.partition(o,function(w){return e.has(w,"barycenter")}),f=u.lhs,h=e.sortBy(u.rhs,function(w){return-w.i}),p=[],g=0,x=0,v=0;f.sort(r(!!c)),v=s(p,h,v),e.forEach(f,function(w){v+=w.vs.length,p.push(w.vs),g+=w.barycenter*w.weight,x+=w.weight,v=s(p,h,v)});var b={vs:e.flatten(p,!0)};return x&&(b.barycenter=g/x,b.weight=x),b}function s(o,c,u){for(var f;c.length&&(f=e.last(c)).i<=u;)c.pop(),o.push(f.vs),u++;return u}function r(o){return function(c,u){return c.barycenter<u.barycenter?-1:c.barycenter>u.barycenter?1:o?u.i-c.i:c.i-u.i}}return _1}var C1,W5;function Xne(){if(W5)return C1;W5=1;var e=_t(),t=Yne(),n=Wne(),s=Qne();C1=r;function r(u,f,h,p){var g=u.children(f),x=u.node(f),v=x?x.borderLeft:void 0,b=x?x.borderRight:void 0,w={};v&&(g=e.filter(g,function(E){return E!==v&&E!==b}));var S=t(u,g);e.forEach(S,function(E){if(u.children(E.v).length){var M=r(u,E.v,h,p);w[E.v]=M,e.has(M,"barycenter")&&c(E,M)}});var N=n(S,h);o(N,w);var C=s(N,p);if(v&&(C.vs=e.flatten([v,C.vs,b],!0),u.predecessors(v).length)){var k=u.node(u.predecessors(v)[0]),_=u.node(u.predecessors(b)[0]);e.has(C,"barycenter")||(C.barycenter=0,C.weight=0),C.barycenter=(C.barycenter*C.weight+k.order+_.order)/(C.weight+2),C.weight+=2}return C}function o(u,f){e.forEach(u,function(h){h.vs=e.flatten(h.vs.map(function(p){return f[p]?f[p].vs:p}),!0)})}function c(u,f){e.isUndefined(u.barycenter)?(u.barycenter=f.barycenter,u.weight=f.weight):(u.barycenter=(u.barycenter*u.weight+f.barycenter*f.weight)/(u.weight+f.weight),u.weight+=f.weight)}return C1}var k1,Q5;function Zne(){if(Q5)return k1;Q5=1;var e=_t(),t=As().Graph;k1=n;function n(r,o,c){var u=s(r),f=new t({compound:!0}).setGraph({root:u}).setDefaultNodeLabel(function(h){return r.node(h)});return e.forEach(r.nodes(),function(h){var p=r.node(h),g=r.parent(h);(p.rank===o||p.minRank<=o&&o<=p.maxRank)&&(f.setNode(h),f.setParent(h,g||u),e.forEach(r[c](h),function(x){var v=x.v===h?x.w:x.v,b=f.edge(v,h),w=e.isUndefined(b)?0:b.weight;f.setEdge(v,h,{weight:r.edge(x).weight+w})}),e.has(p,"minRank")&&f.setNode(h,{borderLeft:p.borderLeft[o],borderRight:p.borderRight[o]}))}),f}function s(r){for(var o;r.hasNode(o=e.uniqueId("_root")););return o}return k1}var R1,X5;function Jne(){if(X5)return R1;X5=1;var e=_t();R1=t;function t(n,s,r){var o={},c;e.forEach(r,function(u){for(var f=n.parent(u),h,p;f;){if(h=n.parent(f),h?(p=o[h],o[h]=f):(p=c,c=f),p&&p!==f){s.setEdge(p,f);return}f=h}})}return R1}var E1,Z5;function ese(){if(Z5)return E1;Z5=1;var e=_t(),t=Gne(),n=Kne(),s=Xne(),r=Zne(),o=Jne(),c=As().Graph,u=zn();E1=f;function f(x){var v=u.maxRank(x),b=h(x,e.range(1,v+1),"inEdges"),w=h(x,e.range(v-1,-1,-1),"outEdges"),S=t(x);g(x,S);for(var N=Number.POSITIVE_INFINITY,C,k=0,_=0;_<4;++k,++_){p(k%2?b:w,k%4>=2),S=u.buildLayerMatrix(x);var E=n(x,S);E<N&&(_=0,C=e.cloneDeep(S),N=E)}g(x,C)}function h(x,v,b){return e.map(v,function(w){return r(x,w,b)})}function p(x,v){var b=new c;e.forEach(x,function(w){var S=w.graph().root,N=s(w,S,b,v);e.forEach(N.vs,function(C,k){w.node(C).order=k}),o(w,b,N.vs)})}function g(x,v){e.forEach(v,function(b){e.forEach(b,function(w,S){x.node(w).order=S})})}return E1}var A1,J5;function tse(){if(J5)return A1;J5=1;var e=_t(),t=As().Graph,n=zn();A1={positionX:b,findType1Conflicts:s,findType2Conflicts:r,addConflict:c,hasConflict:u,verticalAlignment:f,horizontalCompaction:h,alignCoordinates:x,findSmallestWidthAlignment:g,balance:v};function s(N,C){var k={};function _(E,M){var A=0,O=0,L=E.length,P=e.last(M);return e.forEach(M,function(I,B){var F=o(N,I),z=F?N.node(F).order:L;(F||I===P)&&(e.forEach(M.slice(O,B+1),function(Y){e.forEach(N.predecessors(Y),function($){var V=N.node($),G=V.order;(G<A||z<G)&&!(V.dummy&&N.node(Y).dummy)&&c(k,$,Y)})}),O=B+1,A=z)}),M}return e.reduce(C,_),k}function r(N,C){var k={};function _(M,A,O,L,P){var I;e.forEach(e.range(A,O),function(B){I=M[B],N.node(I).dummy&&e.forEach(N.predecessors(I),function(F){var z=N.node(F);z.dummy&&(z.order<L||z.order>P)&&c(k,F,I)})})}function E(M,A){var O=-1,L,P=0;return e.forEach(A,function(I,B){if(N.node(I).dummy==="border"){var F=N.predecessors(I);F.length&&(L=N.node(F[0]).order,_(A,P,B,O,L),P=B,O=L)}_(A,P,A.length,L,M.length)}),A}return e.reduce(C,E),k}function o(N,C){if(N.node(C).dummy)return e.find(N.predecessors(C),function(k){return N.node(k).dummy})}function c(N,C,k){if(C>k){var _=C;C=k,k=_}var E=N[C];E||(N[C]=E={}),E[k]=!0}function u(N,C,k){if(C>k){var _=C;C=k,k=_}return e.has(N[C],k)}function f(N,C,k,_){var E={},M={},A={};return e.forEach(C,function(O){e.forEach(O,function(L,P){E[L]=L,M[L]=L,A[L]=P})}),e.forEach(C,function(O){var L=-1;e.forEach(O,function(P){var I=_(P);if(I.length){I=e.sortBy(I,function($){return A[$]});for(var B=(I.length-1)/2,F=Math.floor(B),z=Math.ceil(B);F<=z;++F){var Y=I[F];M[P]===P&&L<A[Y]&&!u(k,P,Y)&&(M[Y]=P,M[P]=E[P]=E[Y],L=A[Y])}}})}),{root:E,align:M}}function h(N,C,k,_,E){var M={},A=p(N,C,k,E),O=E?"borderLeft":"borderRight";function L(B,F){for(var z=A.nodes(),Y=z.pop(),$={};Y;)$[Y]?B(Y):($[Y]=!0,z.push(Y),z=z.concat(F(Y))),Y=z.pop()}function P(B){M[B]=A.inEdges(B).reduce(function(F,z){return Math.max(F,M[z.v]+A.edge(z))},0)}function I(B){var F=A.outEdges(B).reduce(function(Y,$){return Math.min(Y,M[$.w]-A.edge($))},Number.POSITIVE_INFINITY),z=N.node(B);F!==Number.POSITIVE_INFINITY&&z.borderType!==O&&(M[B]=Math.max(M[B],F))}return L(P,A.predecessors.bind(A)),L(I,A.successors.bind(A)),e.forEach(_,function(B){M[B]=M[k[B]]}),M}function p(N,C,k,_){var E=new t,M=N.graph(),A=w(M.nodesep,M.edgesep,_);return e.forEach(C,function(O){var L;e.forEach(O,function(P){var I=k[P];if(E.setNode(I),L){var B=k[L],F=E.edge(B,I);E.setEdge(B,I,Math.max(A(N,P,L),F||0))}L=P})}),E}function g(N,C){return e.minBy(e.values(C),function(k){var _=Number.NEGATIVE_INFINITY,E=Number.POSITIVE_INFINITY;return e.forIn(k,function(M,A){var O=S(N,A)/2;_=Math.max(M+O,_),E=Math.min(M-O,E)}),_-E})}function x(N,C){var k=e.values(C),_=e.min(k),E=e.max(k);e.forEach(["u","d"],function(M){e.forEach(["l","r"],function(A){var O=M+A,L=N[O],P;if(L!==C){var I=e.values(L);P=A==="l"?_-e.min(I):E-e.max(I),P&&(N[O]=e.mapValues(L,function(B){return B+P}))}})})}function v(N,C){return e.mapValues(N.ul,function(k,_){if(C)return N[C.toLowerCase()][_];var E=e.sortBy(e.map(N,_));return(E[1]+E[2])/2})}function b(N){var C=n.buildLayerMatrix(N),k=e.merge(s(N,C),r(N,C)),_={},E;e.forEach(["u","d"],function(A){E=A==="u"?C:e.values(C).reverse(),e.forEach(["l","r"],function(O){O==="r"&&(E=e.map(E,function(B){return e.values(B).reverse()}));var L=(A==="u"?N.predecessors:N.successors).bind(N),P=f(N,E,k,L),I=h(N,E,P.root,P.align,O==="r");O==="r"&&(I=e.mapValues(I,function(B){return-B})),_[A+O]=I})});var M=g(N,_);return x(_,M),v(_,N.graph().align)}function w(N,C,k){return function(_,E,M){var A=_.node(E),O=_.node(M),L=0,P;if(L+=A.width/2,e.has(A,"labelpos"))switch(A.labelpos.toLowerCase()){case"l":P=-A.width/2;break;case"r":P=A.width/2;break}if(P&&(L+=k?P:-P),P=0,L+=(A.dummy?C:N)/2,L+=(O.dummy?C:N)/2,L+=O.width/2,e.has(O,"labelpos"))switch(O.labelpos.toLowerCase()){case"l":P=O.width/2;break;case"r":P=-O.width/2;break}return P&&(L+=k?P:-P),P=0,L}}function S(N,C){return N.node(C).width}return A1}var T1,e4;function nse(){if(e4)return T1;e4=1;var e=_t(),t=zn(),n=tse().positionX;T1=s;function s(o){o=t.asNonCompoundGraph(o),r(o),e.forEach(n(o),function(c,u){o.node(u).x=c})}function r(o){var c=t.buildLayerMatrix(o),u=o.graph().ranksep,f=0;e.forEach(c,function(h){var p=e.max(e.map(h,function(g){return o.node(g).height}));e.forEach(h,function(g){o.node(g).y=f+p/2}),f+=p+u})}return T1}var M1,t4;function sse(){if(t4)return M1;t4=1;var e=_t(),t=qne(),n=$ne(),s=Bne(),r=zn().normalizeRanks,o=Fne(),c=zn().removeEmptyRanks,u=Hne(),f=Une(),h=Vne(),p=ese(),g=nse(),x=zn(),v=As().Graph;M1=b;function b(H,W){var Q=W&&W.debugTiming?x.time:x.notime;Q("layout",function(){var se=Q(" buildLayoutGraph",function(){return L(H)});Q(" runLayout",function(){w(se,Q)}),Q(" updateInputGraph",function(){S(H,se)})})}function w(H,W){W(" makeSpaceForEdgeLabels",function(){P(H)}),W(" removeSelfEdges",function(){Z(H)}),W(" acyclic",function(){t.run(H)}),W(" nestingGraph.run",function(){u.run(H)}),W(" rank",function(){s(x.asNonCompoundGraph(H))}),W(" injectEdgeLabelProxies",function(){I(H)}),W(" removeEmptyRanks",function(){c(H)}),W(" nestingGraph.cleanup",function(){u.cleanup(H)}),W(" normalizeRanks",function(){r(H)}),W(" assignRankMinMax",function(){B(H)}),W(" removeEdgeLabelProxies",function(){F(H)}),W(" normalize.run",function(){n.run(H)}),W(" parentDummyChains",function(){o(H)}),W(" addBorderSegments",function(){f(H)}),W(" order",function(){p(H)}),W(" insertSelfEdges",function(){J(H)}),W(" adjustCoordinateSystem",function(){h.adjust(H)}),W(" position",function(){g(H)}),W(" positionSelfEdges",function(){D(H)}),W(" removeBorderNodes",function(){G(H)}),W(" normalize.undo",function(){n.undo(H)}),W(" fixupEdgeLabelCoords",function(){$(H)}),W(" undoCoordinateSystem",function(){h.undo(H)}),W(" translateGraph",function(){z(H)}),W(" assignNodeIntersects",function(){Y(H)}),W(" reversePoints",function(){V(H)}),W(" acyclic.undo",function(){t.undo(H)})}function S(H,W){e.forEach(H.nodes(),function(Q){var se=H.node(Q),re=W.node(Q);se&&(se.x=re.x,se.y=re.y,W.children(Q).length&&(se.width=re.width,se.height=re.height))}),e.forEach(H.edges(),function(Q){var se=H.edge(Q),re=W.edge(Q);se.points=re.points,e.has(re,"x")&&(se.x=re.x,se.y=re.y)}),H.graph().width=W.graph().width,H.graph().height=W.graph().height}var N=["nodesep","edgesep","ranksep","marginx","marginy"],C={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},k=["acyclicer","ranker","rankdir","align"],_=["width","height"],E={width:0,height:0},M=["minlen","weight","width","height","labeloffset"],A={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},O=["labelpos"];function L(H){var W=new v({multigraph:!0,compound:!0}),Q=te(H.graph());return W.setGraph(e.merge({},C,U(Q,N),e.pick(Q,k))),e.forEach(H.nodes(),function(se){var re=te(H.node(se));W.setNode(se,e.defaults(U(re,_),E)),W.setParent(se,H.parent(se))}),e.forEach(H.edges(),function(se){var re=te(H.edge(se));W.setEdge(se,e.merge({},A,U(re,M),e.pick(re,O)))}),W}function P(H){var W=H.graph();W.ranksep/=2,e.forEach(H.edges(),function(Q){var se=H.edge(Q);se.minlen*=2,se.labelpos.toLowerCase()!=="c"&&(W.rankdir==="TB"||W.rankdir==="BT"?se.width+=se.labeloffset:se.height+=se.labeloffset)})}function I(H){e.forEach(H.edges(),function(W){var Q=H.edge(W);if(Q.width&&Q.height){var se=H.node(W.v),re=H.node(W.w),ce={rank:(re.rank-se.rank)/2+se.rank,e:W};x.addDummyNode(H,"edge-proxy",ce,"_ep")}})}function B(H){var W=0;e.forEach(H.nodes(),function(Q){var se=H.node(Q);se.borderTop&&(se.minRank=H.node(se.borderTop).rank,se.maxRank=H.node(se.borderBottom).rank,W=e.max(W,se.maxRank))}),H.graph().maxRank=W}function F(H){e.forEach(H.nodes(),function(W){var Q=H.node(W);Q.dummy==="edge-proxy"&&(H.edge(Q.e).labelRank=Q.rank,H.removeNode(W))})}function z(H){var W=Number.POSITIVE_INFINITY,Q=0,se=Number.POSITIVE_INFINITY,re=0,ce=H.graph(),me=ce.marginx||0,ge=ce.marginy||0;function ye(xe){var Se=xe.x,je=xe.y,Oe=xe.width,Ee=xe.height;W=Math.min(W,Se-Oe/2),Q=Math.max(Q,Se+Oe/2),se=Math.min(se,je-Ee/2),re=Math.max(re,je+Ee/2)}e.forEach(H.nodes(),function(xe){ye(H.node(xe))}),e.forEach(H.edges(),function(xe){var Se=H.edge(xe);e.has(Se,"x")&&ye(Se)}),W-=me,se-=ge,e.forEach(H.nodes(),function(xe){var Se=H.node(xe);Se.x-=W,Se.y-=se}),e.forEach(H.edges(),function(xe){var Se=H.edge(xe);e.forEach(Se.points,function(je){je.x-=W,je.y-=se}),e.has(Se,"x")&&(Se.x-=W),e.has(Se,"y")&&(Se.y-=se)}),ce.width=Q-W+me,ce.height=re-se+ge}function Y(H){e.forEach(H.edges(),function(W){var Q=H.edge(W),se=H.node(W.v),re=H.node(W.w),ce,me;Q.points?(ce=Q.points[0],me=Q.points[Q.points.length-1]):(Q.points=[],ce=re,me=se),Q.points.unshift(x.intersectRect(se,ce)),Q.points.push(x.intersectRect(re,me))})}function $(H){e.forEach(H.edges(),function(W){var Q=H.edge(W);if(e.has(Q,"x"))switch((Q.labelpos==="l"||Q.labelpos==="r")&&(Q.width-=Q.labeloffset),Q.labelpos){case"l":Q.x-=Q.width/2+Q.labeloffset;break;case"r":Q.x+=Q.width/2+Q.labeloffset;break}})}function V(H){e.forEach(H.edges(),function(W){var Q=H.edge(W);Q.reversed&&Q.points.reverse()})}function G(H){e.forEach(H.nodes(),function(W){if(H.children(W).length){var Q=H.node(W),se=H.node(Q.borderTop),re=H.node(Q.borderBottom),ce=H.node(e.last(Q.borderLeft)),me=H.node(e.last(Q.borderRight));Q.width=Math.abs(me.x-ce.x),Q.height=Math.abs(re.y-se.y),Q.x=ce.x+Q.width/2,Q.y=se.y+Q.height/2}}),e.forEach(H.nodes(),function(W){H.node(W).dummy==="border"&&H.removeNode(W)})}function Z(H){e.forEach(H.edges(),function(W){if(W.v===W.w){var Q=H.node(W.v);Q.selfEdges||(Q.selfEdges=[]),Q.selfEdges.push({e:W,label:H.edge(W)}),H.removeEdge(W)}})}function J(H){var W=x.buildLayerMatrix(H);e.forEach(W,function(Q){var se=0;e.forEach(Q,function(re,ce){var me=H.node(re);me.order=ce+se,e.forEach(me.selfEdges,function(ge){x.addDummyNode(H,"selfedge",{width:ge.label.width,height:ge.label.height,rank:me.rank,order:ce+ ++se,e:ge.e,label:ge.label},"_se")}),delete me.selfEdges})})}function D(H){e.forEach(H.nodes(),function(W){var Q=H.node(W);if(Q.dummy==="selfedge"){var se=H.node(Q.e.v),re=se.x+se.width/2,ce=se.y,me=Q.x-re,ge=se.height/2;H.setEdge(Q.e,Q.label),H.removeNode(W),Q.label.points=[{x:re+2*me/3,y:ce-ge},{x:re+5*me/6,y:ce-ge},{x:re+me,y:ce},{x:re+5*me/6,y:ce+ge},{x:re+2*me/3,y:ce+ge}],Q.label.x=Q.x,Q.label.y=Q.y}})}function U(H,W){return e.mapValues(e.pick(H,W),Number)}function te(H){var W={};return e.forEach(H,function(Q,se){W[se.toLowerCase()]=Q}),W}return M1}var I1,n4;function rse(){if(n4)return I1;n4=1;var e=_t(),t=zn(),n=As().Graph;I1={debugOrdering:s};function s(r){var o=t.buildLayerMatrix(r),c=new n({compound:!0,multigraph:!0}).setGraph({});return e.forEach(r.nodes(),function(u){c.setNode(u,{label:u}),c.setParent(u,"layer"+r.node(u).rank)}),e.forEach(r.edges(),function(u){c.setEdge(u.v,u.w,{},u.name)}),e.forEach(o,function(u,f){var h="layer"+f;c.setNode(h,{rank:"same"}),e.reduce(u,function(p,g){return c.setEdge(p,g,{style:"invis"}),g})}),c}return I1}var O1,s4;function ise(){return s4||(s4=1,O1="0.8.5"),O1}var L1,r4;function ase(){return r4||(r4=1,L1={graphlib:As(),layout:sse(),debug:rse(),util:{time:zn().time,notime:zn().notime},version:ise()}),L1}var ose=ase();const bp=Np(ose),lse="::",fl=166,hl=94,yh=38,P1=28,i4=22,cse=188,bh=78,wh=42,use=40,dse=320,Gq=280,ZS=118,Sh=96,fse=3,zN="6 7";function il(e,t){return`${e}${lse}${t}`}function D1(e){return e.type==="podGroup"||e.type==="group"}function hse(e,t=!1){return t?{stroke:"#a8a29e",strokeWidth:1,strokeDasharray:zN}:e==="pod-internal"||e==="contains"||e==="member"?{stroke:"#44403c",strokeWidth:1.5}:{stroke:"#78716c",strokeWidth:1.5}}function pse(e){if(e.collapsed)return{nodes:[],edges:[],width:Gq,height:ZS,podCount:0};const t=new Set(e.nodes.filter(D1).map(S=>S.id)),n=new Map,s=[];for(const S of e.nodes)if(!D1(S)){if(typeof S.parentId=="string"&&t.has(S.parentId)){n.has(S.parentId)||n.set(S.parentId,[]),n.get(S.parentId).push(S);continue}s.push(S)}const r=e.nodes.filter(D1).map(S=>gse(S,n.get(S.id)??[],e.edges)),o=s.map(S=>({node:S,width:S.initialWidth??fl,height:S.initialHeight??hl,position:{x:0,y:0}})),c=[...r.map(S=>({id:S.node.id,width:S.width,height:S.height})),...o.map(S=>({id:S.node.id,width:S.width,height:S.height}))],u=xse(r,o),f=vse(e.edges.map(S=>{const N=u.get(S.source),C=u.get(S.target);return!N||!C||N===C?null:{source:N,target:C}}).filter(S=>!!S)),h=BN(c,f,"LR",{nodesep:34,ranksep:34}),p=FN(c,h,{x:wh,y:bh});for(const S of r)S.position=p.positions.get(S.node.id)??{x:wh,y:bh};for(const S of o)S.position=p.positions.get(S.node.id)??{x:wh,y:bh};const g=Math.max(dse,p.width+wh*2),x=Math.max(ZS,p.height+bh+use),v=`rig-${e.rigId}`,b=[];for(const S of r){const N=il(e.rigId,S.node.id);b.push({...S.node,id:N,type:"podGroup",parentId:v,extent:"parent",position:S.position,data:{...S.node.data??{},rigId:e.rigId,rigName:e.rigName??null,agentCount:S.members.length},style:{...S.node.style??{},width:S.width,height:S.height},draggable:!1,zIndex:1});for(const C of S.members)b.push({...C.node,id:il(e.rigId,C.node.id),type:"rigNode",parentId:N,extent:"parent",position:C.position,data:{...C.node.data??{},rigId:e.rigId,rigName:e.rigName??null},style:{...C.node.style??{},width:fl,height:hl},initialWidth:fl,initialHeight:hl,sourcePosition:ve.Right,targetPosition:ve.Left,draggable:!1,zIndex:2})}for(const S of o)b.push({...S.node,id:il(e.rigId,S.node.id),type:"rigNode",parentId:v,extent:"parent",position:S.position,data:{...S.node.data??{},rigId:e.rigId,rigName:e.rigName??null},style:{...S.node.style??{},width:fl,height:hl},initialWidth:fl,initialHeight:hl,sourcePosition:ve.Right,targetPosition:ve.Left,draggable:!1,zIndex:2});const w=e.edges.map(S=>{var A;const N=e.rigId,C=e.rigId,k=S.id||`${S.source}->${S.target}`,_=typeof((A=S.data)==null?void 0:A.kind)=="string"?S.data.kind:typeof S.label=="string"?S.label:null,{label:E,...M}=S;return{...M,id:il(e.rigId,k),source:il(N,S.source),target:il(C,S.target),label:typeof E=="string"?E:void 0,type:S.type??"default",selectable:!1,focusable:!1,interactionWidth:S.interactionWidth??10,style:{...hse(_),...S.style??{}},data:{...S.data??{},kind:_}}});return{nodes:b,edges:w,width:g,height:x,podCount:r.length}}function mse(e){const t=e.map(c=>({id:c.rigId,width:c.width,height:c.height})),n=Array.from({length:fse},()=>[]);e.forEach((c,u)=>{n[u%n.length].push(c.rigId)});const s=[];for(const c of n)for(let u=0;u<c.length-1;u+=1)s.push({source:c[u],target:c[u+1]});const r=BN(t,s,"TB",{nodesep:68,ranksep:62}),o=FN(t,r,{x:Sh,y:Sh});return e.map(c=>({...c,position:o.positions.get(c.rigId)??{x:Sh,y:Sh}}))}function gse(e,t,n){const s=t.map(p=>({id:p.id,width:fl,height:hl})),r=new Set(t.map(p=>p.id)),o=n.filter(p=>r.has(p.source)&&r.has(p.target)),c=BN(s,o,"TB",{nodesep:16,ranksep:16}),u=FN(s,c,{x:P1,y:yh}),f=Math.max(cse,u.width+P1*2),h=Math.max(yh+i4,u.height+yh+i4);return{node:e,width:f,height:h,position:{x:0,y:0},members:t.map(p=>({node:p,position:u.positions.get(p.id)??{x:P1,y:yh}}))}}function xse(e,t){const n=new Map;for(const s of e){n.set(s.node.id,s.node.id);for(const r of s.members)n.set(r.node.id,s.node.id)}for(const s of t)n.set(s.node.id,s.node.id);return n}function vse(e){const t=new Set,n=[];for(const s of e){const r=`${s.source}->${s.target}`;t.has(r)||(t.add(r),n.push(s))}return n}function BN(e,t,n,s){const r=new bp.graphlib.Graph;r.setDefaultEdgeLabel(()=>({})),r.setGraph({rankdir:n,nodesep:s.nodesep,ranksep:s.ranksep,marginx:0,marginy:0});for(const u of e)r.setNode(u.id,{width:u.width,height:u.height});const o=new Set(e.map(u=>u.id));for(const u of t)!o.has(u.source)||!o.has(u.target)||u.source===u.target||r.setEdge(u.source,u.target);bp.layout(r);const c=new Map;for(const u of e){const f=r.node(u.id);c.set(u.id,f??{x:0,y:0})}return c}function FN(e,t,n){let s=1/0,r=1/0,o=-1/0,c=-1/0;for(const f of e){const h=t.get(f.id)??{x:0,y:0};s=Math.min(s,h.x-f.width/2),r=Math.min(r,h.y-f.height/2),o=Math.max(o,h.x+f.width/2),c=Math.max(c,h.y+f.height/2)}if(!Number.isFinite(s)||!Number.isFinite(r))return{positions:new Map,width:0,height:0};const u=new Map;for(const f of e){const h=t.get(f.id)??{x:0,y:0};u.set(f.id,{x:n.x+h.x-f.width/2-s,y:n.y+h.y-f.height/2-r})}return{positions:u,width:o-s,height:c-r}}const yse="\0",HN=1e4,Kq=4e3,bse=1100,wse=1600,Sse=3e3,jse=650,Nse=900;function UN(e){var r;const t=new Map,n=new Map,s=(o,c)=>{const u=o==null?void 0:o.trim();if(u)for(const f of[u,u.toLowerCase()]){const h=n.get(f);h&&h.nodeId!==c.nodeId?n.set(f,null):n.has(f)||n.set(f,c)}};for(const o of e){t.set(o.nodeId,o);const c=JS(o.nodeId);s(o.nodeId,o),s(c,o),s(o.logicalId,o),s(o.canonicalSessionName,o);for(const u of[o.rigName,o.rigId])if(u&&(s(`${o.logicalId??c}@${u}`,o),(r=o.canonicalSessionName)!=null&&r.includes("@"))){const[f]=o.canonicalSessionName.split("@");s(`${f}@${u}`,o)}}return{byNodeId:t,bySession:n}}function q1(e,t){var u;const n=t==null?void 0:t.trim();if(!n)return null;const s=e.bySession.get(n)??e.bySession.get(n.toLowerCase());if(s)return{...s,session:n};if(s===null)return null;const r=n.lastIndexOf("@");if(r<0)return null;const o=n.slice(0,r),c=n.slice(r+1);for(const f of e.byNodeId.values()){const h=f.logicalId??JS(f.nodeId),p=((u=f.canonicalSessionName)==null?void 0:u.split("@")[0])??null,g=h===o||p===o||JS(f.nodeId)===o,x=f.rigName===c||f.rigId===c;if(g&&x)return{...f,session:n}}return null}function _se(e){var t,n,s;return e?e.startupStatus==="failed"?"blocked":e.startupStatus==="attention_required"||((t=e.agentActivity)==null?void 0:t.state)==="needs_input"?"needs_input":((n=e.agentActivity)==null?void 0:n.state)==="running"||(((s=e.currentQitems)==null?void 0:s.length)??0)>0?"active":"idle":"idle"}function Cse(e){const t=_se(e.baseline),n=e.recent,s=n&&e.nowMs-n.lastActiveAt<=HN?n:null,r=s?Ase(t,s.state):t,o=(s==null?void 0:s.sourceFlashAt)&&e.nowMs-s.sourceFlashAt<=jse,c=(s==null?void 0:s.targetFlashAt)&&e.nowMs-s.targetFlashAt<=Nse;return{state:r,flash:c?"target":o?"source":null,recent:!!s}}function kse(e,t){return typeof e=="number"&&t-e<=Kq}function Rse(e){if(!e||typeof e!="object")return null;const t=e,n=nn(t,"type");if(!n)return null;const s=nn(t,"qitemId"),r=(o,c="active",u=null)=>o?{session:o,state:c,flash:u}:null;if(n==="agent.activity"){const o=nn(t,"sessionName"),c=t.activity&&typeof t.activity=="object"?t.activity:null,u=(c==null?void 0:c.state)==="needs_input"?"needs_input":(c==null?void 0:c.state)==="running"?"active":"idle";return{type:n,qitemId:s,sessions:[r(o,u)].filter(_r)}}if(n==="queue.created"){const o=nn(t,"sourceSession"),c=nn(t,"destinationSession");return!o||!c?null:{type:n,qitemId:s,packet:{sourceSession:o,targetSession:c},sessions:[r(o,"active","source"),r(c,"active","target")].filter(_r)}}if(n==="queue.handed_off"){const o=nn(t,"fromSession"),c=nn(t,"toSession");return!o||!c?null:{type:n,qitemId:s,packet:{sourceSession:o,targetSession:c},sessions:[r(o,"active","source"),r(c,"active","target")].filter(_r)}}if(n==="queue.claimed"){const o=nn(t,"destinationSession");return{type:n,qitemId:s,sessions:[r(o,"active","target")].filter(_r)}}if(n==="queue.updated"){const o=nn(t,"actorSession"),c=nn(t,"closureTarget"),f=nn(t,"toState")==="blocked"?"blocked":"active";return{type:n,qitemId:s,packet:o&&c?{sourceSession:o,targetSession:c}:void 0,sessions:[r(o,f,"source"),r(c,f,"target")].filter(_r)}}return n==="queue.unclaimed"?{type:n,qitemId:s,sessions:[r(nn(t,"destinationSession"),"active")].filter(_r)}:n==="qitem.fallback_routed"?{type:n,qitemId:s,sessions:[r(nn(t,"originalDestination"),"active","source"),r(nn(t,"rerouteDestination"),"active","target")].filter(_r)}:n==="qitem.closure_overdue"?{type:n,qitemId:s,sessions:[r(nn(t,"destinationSession"),"blocked","target")].filter(_r)}:n==="inbox.absorbed"||n==="inbox.denied"?{type:n,qitemId:s,sessions:[r(nn(t,"senderSession"),"active","source"),r(nn(t,"destinationSession"),"needs_input","target")].filter(_r)}:null}function $1(e,t){return`${e}${yse}${t}`}function Ese(e){const t=!!(e.sourceSession.rigId&&e.targetSession.rigId&&e.sourceSession.rigId!==e.targetSession.rigId);return{id:`${e.createdAt}-${e.sequence}-${e.sourceSession.nodeId}-${e.targetSession.nodeId}`,eventType:e.eventType,qitemId:e.qitemId??null,sourceSession:e.sourceSession.session,targetSession:e.targetSession.session,sourceNodeId:e.sourceSession.nodeId,targetNodeId:e.targetSession.nodeId,sourceRigId:e.sourceSession.rigId,targetRigId:e.targetSession.rigId,crossRig:t,createdAt:e.createdAt,durationMs:t?wse:bse}}function Yq(e,t,n){const s=new Map;for(const c of t)s.set($1(c.sourceNodeId,c.targetNodeId),c);const r=new Set,o=e.map(c=>{const u=$1(c.source,c.target),f=s.get(u)??null;return f&&r.add(u),a4(c,f,n.reducedMotion)});for(const c of t){const u=$1(c.sourceNodeId,c.targetNodeId);r.has(u)||o.push(a4({id:`hot-potato-${c.id}`,source:c.sourceNodeId,target:c.targetNodeId,type:"hotPotato",selectable:!1,focusable:!1,interactionWidth:8,style:Wq(c.crossRig),data:{}},c,n.reducedMotion))}return o}function a4(e,t,n){var o;const s=(t==null?void 0:t.crossRig)||((o=e.style)==null?void 0:o.strokeDasharray)===zN,r={...e.data??{},hotPotatoPacket:t,hotPotatoRecent:!!t,hotPotatoCrossRig:s,hotPotatoReducedMotion:n};return{...e,type:"hotPotato",className:[e.className,t?"hot-potato-edge-active":""].filter(Boolean).join(" ")||void 0,data:r,style:{...e.style??{},...t?Wq(t.crossRig):{}}}}function Wq(e){return{stroke:e?"#a8a29e":"#047857",strokeWidth:e?1.25:2.25,strokeDasharray:e?zN:void 0}}function Ase(e,t){return o4(t)>o4(e)?t:e}function o4(e){return e==="blocked"?3:e==="needs_input"?2:e==="active"?1:0}function JS(e){const t=e.indexOf("::");return t<0?e:e.slice(t+2)}function nn(e,t){const n=e[t];return typeof n=="string"&&n.trim()?n:null}function _r(e){return e!==null}function Tse(){return{nodeActivity:new Map,rigActivity:new Map,packets:[],unresolvedCount:0,sequence:0}}function z1(e,t,n,s,r){const o=e.nodeActivity.get(t),c=o&&s-o.lastActiveAt<=HN?o:void 0,u={state:Mse((c==null?void 0:c.state)??"idle",n),lastActiveAt:s,sourceFlashAt:r==="source"?s:c==null?void 0:c.sourceFlashAt,targetFlashAt:r==="target"?s:c==null?void 0:c.targetFlashAt};e.nodeActivity.set(t,u)}function Mse(e,t){const n=s=>s==="blocked"?3:s==="needs_input"?2:s==="active"?1:0;return n(t)>n(e)?t:e}function l4(e,t){let n=!1;const s=e.packets.length;e.packets=e.packets.filter(r=>t-r.createdAt<=Sse),n||(n=e.packets.length!==s);for(const[r,o]of e.nodeActivity.entries())t-o.lastActiveAt>HN&&(e.nodeActivity.delete(r),n=!0);for(const[r,o]of e.rigActivity.entries())t-o>Kq&&(e.rigActivity.delete(r),n=!0);return n}function VN(e){const[t,n]=R.useState(0),s=R.useRef(e),r=R.useRef(Tse());s.current=e;const o=R.useCallback(()=>{n(c=>c+1)},[]);return R.useEffect(()=>Lp(u=>{const f=Rse(u);if(!f)return;const h=Date.now(),p=r.current,g=s.current;let x=!1;for(const v of f.sessions){const b=q1(g,v.session);if(!b){p.unresolvedCount+=1,x=!0;continue}z1(p,b.nodeId,v.state,h,v.flash??null),b.rigId&&p.rigActivity.set(b.rigId,h),x=!0}if(f.packet){const v=q1(g,f.packet.sourceSession),b=q1(g,f.packet.targetSession);v&&b?(p.sequence+=1,p.packets.push(Ese({eventType:f.type,qitemId:f.qitemId,sourceSession:v,targetSession:b,createdAt:h,sequence:p.sequence})),z1(p,v.nodeId,"active",h,"source"),z1(p,b.nodeId,"active",h,"target"),v.rigId&&p.rigActivity.set(v.rigId,h),b.rigId&&p.rigActivity.set(b.rigId,h),x=!0):(p.unresolvedCount+=1,x=!0)}x||(x=l4(p,h)),x&&o()}),[o]),R.useEffect(()=>{const c=window.setInterval(()=>{const u=Date.now(),f=r.current;l4(f,u)&&o()},1e3);return()=>window.clearInterval(c)},[o]),R.useMemo(()=>{const c=r.current,u=Date.now();return{version:t,unresolvedCount:c.unresolvedCount,packets:[...c.packets],getNodeActivity(f,h){return Cse({baseline:h,recent:c.nodeActivity.get(f)??null,nowMs:u})},isRigRecentlyActive(f){return f?kse(c.rigActivity.get(f),u):!1}}},[t])}const c4="(prefers-reduced-motion: reduce)";function GN(){const[e,t]=R.useState(()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia(c4).matches);return R.useEffect(()=>{var r;if(typeof window>"u"||typeof window.matchMedia!="function")return;const n=window.matchMedia(c4);t(n.matches);const s=()=>t(n.matches);return(r=n.addEventListener)==null||r.call(n,"change",s),()=>{var o;return(o=n.removeEventListener)==null?void 0:o.call(n,"change",s)}},[]),e}function Ise({data:e}){const t=e.podDisplayName??e.podNamespace??Ys(e.logicalId)??bl(e.podId??e.logicalId);return a.jsx("div",{"data-testid":"pod-group-node",className:`w-full h-full relative pointer-events-auto ${e.placementState==="selected"?"ring-2 ring-emerald-500/80 shadow-[0_0_0_4px_rgba(52,211,153,0.12)]":e.placementState==="available"?"ring-1 ring-emerald-300/80":""}`,children:a.jsx("div",{className:"absolute left-4 top-3 inline-flex items-center font-mono text-[12px] font-bold leading-none tracking-[0.08em] text-stone-800",children:`${t} pod`})})}function Ose({data:e}){const t=e.session;return a.jsxs("div",{"data-testid":"discovered-graph-node",className:"border-dashed border-2 border-foreground/30 bg-surface-low/50 p-spacing-3 min-w-[180px]",children:[a.jsx(gn,{type:"target",position:ve.Top,className:"opacity-0"}),a.jsxs("div",{className:"text-label-sm font-mono uppercase mb-spacing-1",children:[t.tmuxSession,":",t.tmuxPane]}),a.jsxs("div",{className:"flex gap-spacing-2 items-center mb-spacing-1",children:[a.jsx("span",{className:"text-label-sm uppercase text-foreground-muted",children:t.runtimeHint}),a.jsx("span",{className:"text-label-sm text-foreground-muted",children:t.confidence})]}),t.cwd&&a.jsx("div",{className:"text-label-sm font-mono text-foreground-muted truncate",children:t.cwd}),a.jsx(gn,{type:"source",position:ve.Bottom,className:"opacity-0"})]})}const Lse={rigNode:HJ,discoveredNode:Ose,podGroup:Ise},Pse={hotPotato:GD};function Dse(){return a.jsxs("div",{className:"flex flex-col items-center justify-center h-full relative text-foreground-muted","data-testid":"empty-topology",children:[a.jsxs("svg",{className:"absolute inset-0 w-full h-full",viewBox:"0 0 400 300",fill:"none",style:{opacity:.08},children:[a.jsx("rect",{x:"160",y:"60",width:"80",height:"40",stroke:"currentColor",strokeWidth:"1"}),a.jsx("rect",{x:"60",y:"180",width:"80",height:"40",stroke:"currentColor",strokeWidth:"1"}),a.jsx("rect",{x:"260",y:"180",width:"80",height:"40",stroke:"currentColor",strokeWidth:"1"}),a.jsx("line",{x1:"200",y1:"100",x2:"100",y2:"180",stroke:"currentColor",strokeWidth:"1",strokeDasharray:"4 4"}),a.jsx("line",{x1:"200",y1:"100",x2:"300",y2:"180",stroke:"currentColor",strokeWidth:"1",strokeDasharray:"4 4"})]}),a.jsx("div",{className:"relative z-10 text-center",children:a.jsx("h2",{className:"text-headline-md uppercase",children:"EMPTY TOPOLOGY"})})]})}function KN({rigId:e,rigName:t=null,showDiscovered:n=!0,podScope:s}){const{data:r,isPending:o,error:c}=wJ(e??""),u=NV(n),f=(r==null?void 0:r.nodes)??[],h=(r==null?void 0:r.edges)??[],{rawNodes:p,rawEdges:g}=R.useMemo(()=>{if(!s)return{rawNodes:f,rawEdges:h};const D=new Set,U=f.filter(H=>{var se,re,ce,me,ge;if(H.type==="podGroup"||H.type==="group"){const ye=(((se=H.data)==null?void 0:se.podNamespace)??((re=H.data)==null?void 0:re.podId))===s;return ye&&D.add(H.id),ye}const Q=(((ce=H.data)==null?void 0:ce.podNamespace)??((me=H.data)==null?void 0:me.podId)??Ys(((ge=H.data)==null?void 0:ge.logicalId)??null))===s;return Q&&D.add(H.id),Q}),te=h.filter(H=>D.has(H.source)&&D.has(H.target));return{rawNodes:U,rawEdges:te}},[f,h,s]),x=(c==null?void 0:c.message)??null,{reconnecting:v}=jJ(e),b=GN(),[w,S]=R.useState(null),N=R.useRef(null),C=R.useRef(null),k=e!==null&&C.current!==e;R.useEffect(()=>{e&&p.length>0&&C.current!==e&&(C.current=e)},[e,p.length]);const _=R.useCallback(D=>{N.current&&clearTimeout(N.current),S(D),N.current=setTimeout(()=>{S(null),N.current=null},3e3)},[]);R.useEffect(()=>()=>{N.current&&clearTimeout(N.current)},[]);const E=R.useMemo(()=>UN(p.filter(D=>D.type==="rigNode").map(D=>{const U=D.data;return{nodeId:D.id,rigId:e,rigName:t,logicalId:(U==null?void 0:U.logicalId)??null,canonicalSessionName:(U==null?void 0:U.canonicalSessionName)??null,agentActivity:(U==null?void 0:U.agentActivity)??null,currentQitems:(U==null?void 0:U.currentQitems)??null,startupStatus:(U==null?void 0:U.startupStatus)??null}})),[p,e,t]),M=VN(E),A=R.useMemo(()=>g.map(D=>{var H;const U=((H=D.data)==null?void 0:H.kind)??D.label??"delegates_to",te=NJ(U);return{...D,...te,className:k?"edge-draw-in":void 0,style:{...te.style,animationDelay:k?`${Math.min(p.length*50+100,2e3)}ms`:void 0}}}),[g,k,p.length]),O=R.useMemo(()=>{const D=new Map;for(const U of p){const te=U.data;if((U.type==="podGroup"||U.type==="group")&&(te!=null&&te.podId)){D.set(te.podId,{displayName:te.podLabel??te.podNamespace??Ys(te.logicalId)??bl(te.podId),namespace:te.podNamespace??te.logicalId??null});continue}const H=(te==null?void 0:te.podId)??null;if(!H)continue;const W=(te==null?void 0:te.podNamespace)??Ys(te==null?void 0:te.logicalId)??null,Q=(te==null?void 0:te.podLabel)??W??bl(H);D.has(H)||D.set(H,{displayName:Q,namespace:W})}return D},[p]),{selection:L,setSelection:P}=Fp(),{selectedDiscoveredId:I,placementTarget:B,setPlacementTarget:F}=yG(),z=(L==null?void 0:L.type)==="discovery"&&!!I,Y=R.useMemo(()=>{const D=new Map;for(const Q of p){if(!Q.parentId)continue;const se=typeof Q.data=="object"&&Q.data!==null&&"logicalId"in Q.data?Q.data.logicalId:null,re=typeof Q.data=="object"&&Q.data!==null&&"podId"in Q.data?Q.data.podId:null,ce=Ys(se)??bl(re);ce&&!D.has(Q.parentId)&&D.set(Q.parentId,ce)}const te=EJ(p,g).map((Q,se)=>({...Q,data:(()=>{if(Q.type==="podGroup"||Q.type==="group"){const re=Q.data,ce=(re==null?void 0:re.podId)??null,me=(B==null?void 0:B.kind)==="pod"&&ce!==null&&B.podId===ce;return{...Q.data??{},podDisplayName:D.get(Q.id)??null,placementState:z?me?"selected":"available":null}}if(Q.type==="rigNode"){const re=Q.data,ce=!(re!=null&&re.binding)&&!(re!=null&&re.canonicalSessionName),me=(B==null?void 0:B.kind)==="node"&&(re==null?void 0:re.logicalId)!==void 0&&B.logicalId===re.logicalId;return{...Q.data??{},placementState:z?me?"selected":ce?"available":null:null}}return Q.data})(),className:k?"node-enter":void 0,style:{...Q.style??{},animationDelay:k?`${Math.min(se*50,2e3)}ms`:void 0}})),H=te.reduce((Q,se)=>{var re;return Math.max(Q,((re=se.position)==null?void 0:re.y)??0)},0),W=u.map((Q,se)=>({id:`discovered-${Q.id}`,type:"discoveredNode",position:{x:300,y:H+200+se*150},data:{session:Q}}));return[...te,...W]},[p,g,k,u,z,B]),$=R.useMemo(()=>Y.map(D=>{if(D.type!=="rigNode")return D;const U=D.data;return{...D,data:{...D.data??{},activityRing:M.getNodeActivity(D.id,U),reducedMotion:b}}}),[Y,M,b]),V=R.useMemo(()=>Yq(A,M.packets,{reducedMotion:b}),[A,M.packets,b]),G=Ot(),Z=t!=null&&t.trim()?t:e?Yj(e):null,J=R.useCallback(async(D,U)=>{var H;if(!e)return;if(z){if(U.type==="podGroup"||U.type==="group"){const W=U.data,Q=(W==null?void 0:W.podId)??null,se=Q?O.get(Q):null,re=!!(Q&&(se!=null&&se.namespace));F({kind:"pod",rigId:e,podId:Q??"",podNamespace:(se==null?void 0:se.namespace)??null,podLabel:(se==null?void 0:se.displayName)??null,eligible:re,...re?{}:{reason:"This pod cannot receive a new node yet."}});return}if(U.type==="rigNode"){const W=U.data,Q=!W.binding&&!W.canonicalSessionName;F({kind:"node",rigId:e,logicalId:W.logicalId,eligible:Q,...Q?{}:{reason:"This node is already claimed."}});return}}if(U.type==="podGroup"||U.type==="group")return;const te=U.data;if(G({to:"/topology/seat/$rigId/$logicalId",params:{rigId:e,logicalId:encodeURIComponent(te.logicalId)}}),!((H=te.binding)!=null&&H.cmuxSurface)){_({text:"Not bound to cmux surface",type:"info"});return}try{const W=await fetch(`/api/rigs/${encodeURIComponent(e)}/nodes/${encodeURIComponent(te.logicalId)}/focus`,{method:"POST"});if(!W.ok){_({text:"Focus failed",type:"error"});return}const Q=await W.json();Q.ok===!1&&Q.code==="unavailable"?_({text:"cmux not connected",type:"error"}):Q.ok?_({text:"Focused",type:"success"}):_({text:"Focus failed",type:"error"})}catch{_({text:"Focus failed",type:"error"})}},[z,O,e,F,G,P,_]);return e===null?a.jsx("div",{className:"p-spacing-6 text-foreground-muted",children:"No rig selected"}):o?a.jsxs("div",{className:"p-spacing-6","data-testid":"graph-loading",children:[a.jsx("div",{className:"h-8 w-48 animate-pulse-tactical mb-spacing-4"}),a.jsx("div",{className:"h-64 animate-pulse-tactical"})]}):x?a.jsx("div",{className:"p-spacing-6",children:a.jsx(Sn,{"data-testid":"graph-error",children:a.jsxs(jn,{children:["Error: ",x]})})}):$.length===0?a.jsx(Dse,{}):a.jsxs("div",{className:"w-full h-full relative","data-testid":"graph-view","data-animated":k?"true":"false",children:[a.jsx("div",{className:"absolute top-4 left-4 w-3 h-3 reg-mark",children:a.jsx("div",{className:"reg-tl"})}),a.jsx("div",{className:"absolute top-4 right-4 w-3 h-3",children:a.jsx("div",{className:"reg-tr"})}),a.jsx("div",{className:"absolute bottom-4 left-4 w-3 h-3",children:a.jsx("div",{className:"reg-bl"})}),a.jsx("div",{className:"absolute bottom-4 right-4 w-3 h-3",children:a.jsx("div",{className:"reg-br"})}),Z&&a.jsx("div",{"data-testid":"rig-stamp-watermark",className:"stamp-watermark text-3xl left-[20%] top-[35%]",children:Z}),v&&a.jsx("div",{className:"absolute top-spacing-4 right-spacing-4 z-20",children:a.jsx(Sn,{children:a.jsx(jn,{className:"text-warning",children:"Live updates disconnected from daemon - reconnecting..."})})}),w&&a.jsx("div",{className:`absolute top-spacing-4 left-spacing-4 z-20 px-spacing-4 py-spacing-2 font-mono text-[10px] border ${w.type==="success"?"bg-white border-stone-900 text-stone-900":w.type==="error"?"bg-tertiary/10 border-tertiary text-tertiary":"bg-white border-stone-300 text-stone-600"}`,children:w.text}),z&&a.jsx("div",{"data-testid":"graph-placement-banner",className:"absolute top-spacing-4 left-1/2 z-20 -translate-x-1/2 border border-emerald-300/90 bg-[rgba(236,253,245,0.92)] px-3.5 py-2 font-mono text-[10px] text-emerald-950 shadow-[0_12px_28px_rgba(34,197,94,0.14)] backdrop-blur-sm",children:"PLACEMENT MODE / click an available node to bind, or click a pod to add a new node."}),a.jsx(gd,{nodes:$,edges:V,nodeTypes:Lse,edgeTypes:Pse,onNodeClick:J,nodesDraggable:!1,selectionOnDrag:!1,panOnDrag:!0,fitView:!0,fitViewOptions:{padding:.16,maxZoom:1.15},className:"relative z-10",proOptions:{hideAttribution:!0},minZoom:.3,maxZoom:1.5,children:a.jsx(xd,{})})]})}class ej extends Error{constructor(n){var r;const s=((r=n.errors)==null?void 0:r.join(", "))??n.message??"Import failed";super(s);Qn(this,"errors");Qn(this,"warnings");Qn(this,"code");this.name="ImportError",this.code=n.code??"unknown",this.errors=n.errors??(n.message?[n.message]:["Import failed"]),this.warnings=n.warnings??[]}}function qse(){const e=Wt();return vn({mutationFn:async({yaml:t,rigRoot:n})=>{const s={"Content-Type":"text/yaml"};n&&(s["X-Rig-Root"]=n);const r=await fetch("/api/rigs/import",{method:"POST",headers:s,body:t});if(!r.ok){const o=await r.json().catch(()=>({}));throw o.code==="cycle_error"?new ej({...o,errors:o.errors??["Cycle detected in rig topology"]}):new ej(o)}return r.json()},onSuccess:()=>{e.invalidateQueries({queryKey:["rigs","summary"]})}})}function $se(e){switch(e){case"launched":return"text-success";case"failed":return"text-destructive";default:return"text-foreground-muted"}}const YN=R.forwardRef(({className:e,type:t,...n},s)=>a.jsx("input",{type:t,className:he("flex h-11 w-full border border-stone-300/55 bg-white/85 px-4 py-2 text-base text-foreground placeholder:text-foreground-muted/60 transition-colors duration-150 focus-visible:outline-none focus-visible:border-stone-900/35 focus-visible:ring-2 focus-visible:ring-stone-900/10 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:s,...n}));YN.displayName="Input";const WN=R.forwardRef(({className:e,...t},n)=>a.jsx("textarea",{className:he("flex min-h-[80px] w-full border border-stone-300/55 bg-white/85 px-4 py-3 text-base text-on-surface font-mono placeholder:text-stone-400 transition-all duration-150 focus-visible:outline-none focus-visible:border-stone-900/35 focus-visible:ring-2 focus-visible:ring-stone-900/10 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:n,...t}));WN.displayName="Textarea";function it({children:e,className:t,innerClassName:n}){return a.jsx("div",{"data-testid":"workspace-page",className:he("w-full flex-1 overflow-y-auto lg:pl-[var(--workspace-left-offset,0px)] lg:pr-[var(--workspace-right-offset,0px)]",t),children:a.jsx("div",{"data-testid":"workspace-page-inner",className:he("mx-auto w-full max-w-[960px] px-4 py-6 sm:px-6 sm:py-8 md:px-8 lg:px-10",n),children:e})})}const QN=R.forwardRef(({className:e,...t},n)=>a.jsx("div",{className:"relative w-full overflow-auto",children:a.jsx("table",{ref:n,className:he("w-full caption-bottom text-sm",e),...t})}));QN.displayName="Table";const XN=R.forwardRef(({className:e,...t},n)=>a.jsx("thead",{ref:n,className:he("bg-surface-low [&_tr]:border-b [&_tr]:border-stone-300",e),...t}));XN.displayName="TableHeader";const ZN=R.forwardRef(({className:e,...t},n)=>a.jsx("tbody",{ref:n,className:he("[&_tr:last-child]:border-0",e),...t}));ZN.displayName="TableBody";const zse=R.forwardRef(({className:e,...t},n)=>a.jsx("tfoot",{ref:n,className:he("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));zse.displayName="TableFooter";const Gu=R.forwardRef(({className:e,...t},n)=>a.jsx("tr",{ref:n,className:he("border-b border-stone-200 transition-colors duration-150 hover:bg-surface-low data-[state=selected]:bg-surface-mid odd:bg-surface-low/50",e),...t}));Gu.displayName="TableRow";const Ra=R.forwardRef(({className:e,...t},n)=>a.jsx("th",{ref:n,className:he("h-12 px-4 text-left align-middle font-medium text-foreground-muted uppercase text-label-md tracking-[0.04em] [&:has([role=checkbox])]:pr-0",e),...t}));Ra.displayName="TableHead";const Ea=R.forwardRef(({className:e,...t},n)=>a.jsx("td",{ref:n,className:he("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));Ea.displayName="TableCell";const Bse=R.forwardRef(({className:e,...t},n)=>a.jsx("caption",{ref:n,className:he("mt-4 text-sm text-foreground-muted",e),...t}));Bse.displayName="TableCaption";function xn({eyebrow:e,title:t,description:n,actions:s}){return a.jsxs("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-end lg:justify-between",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-stone-500",children:e}),a.jsx("h2",{className:"text-2xl font-bold uppercase tracking-[0.04em] text-stone-900 sm:text-3xl",children:t}),n&&a.jsx("p",{className:"max-w-2xl text-base leading-8 text-stone-600",children:n})]}),s?a.jsx("div",{className:"flex flex-wrap gap-2",children:s}):null]})}function Qq({steps:e,currentStep:t,errorAtStep:n=0,"data-testid":s}){const r=n||t;return a.jsx("div",{className:"flex flex-wrap items-center gap-2 sm:gap-3","data-testid":s,children:e.map((o,c)=>{const u=r>o.num,f=r===o.num,h=r<o.num,p=u?"done":f?"active":"upcoming";return a.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[a.jsxs("div",{"data-testid":`step-${o.num}`,"data-step-state":p,className:he("inline-flex min-h-0 items-center gap-2 border-b-2 px-1 py-1 font-mono text-[10px] uppercase tracking-[0.16em] transition-colors",u&&"border-primary/35 text-foreground-muted",f&&"border-stone-900 text-foreground",h&&"border-transparent text-foreground-muted/35"),children:[a.jsxs("span",{className:"text-[9px] tracking-[0.22em]",children:[u?"✓ ":"",String(o.num).padStart(2,"0")]}),a.jsx("span",{className:"text-[10px] leading-none tracking-[0.2em]",children:o.label})]}),c<e.length-1?a.jsx("div",{"aria-hidden":"true",className:he("h-px w-4 shrink-0 sm:w-6",u?"bg-primary/35":"bg-stone-300/45")}):null]},o.num)})})}function hs({title:e,description:t,children:n,className:s}){return a.jsxs("section",{className:he("space-y-4 border border-stone-300/45 bg-[rgba(255,255,255,0.62)] p-5 shadow-[0_1px_0_rgba(255,255,255,0.95)_inset,0_10px_26px_rgba(34,34,24,0.035)] sm:p-6",s),children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("div",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-stone-500",children:e}),t?a.jsx("p",{className:"text-base leading-8 text-stone-600",children:t}):null]}),n]})}function ho({children:e}){return a.jsx("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:e})}function nt({label:e,value:t,testId:n}){return a.jsxs("div",{className:"border border-stone-300/35 bg-white/10 px-4 py-4",children:[a.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.16em] text-stone-500",children:e}),a.jsx("div",{"data-testid":n,className:"mt-2 text-2xl font-semibold uppercase tracking-[0.04em] text-stone-900",children:t})]})}function Xq({title:e,testId:t,children:n}){return a.jsx(hs,{title:e,children:a.jsx("pre",{"data-testid":t,className:"overflow-x-auto border border-stone-300/45 bg-white/75 p-4 text-xs leading-6 text-stone-800",children:n})})}const Fse=[{num:1,label:"VALIDATE RIGSPEC"},{num:2,label:"PREFLIGHT"},{num:3,label:"INSTANTIATE"}];function Hse(e){switch(e){case"input":case"validating":return 1;case"valid":case"preflight":return 2;case"preflight_done":case"instantiating":case"done":return 3;case"error":return 0}}function Use({onBack:e}={}){const t=qse(),{currentRigDraft:n,selectedRigDraft:s,saveRigDraft:r,rememberRigDraft:o,clearSelectedRigDraft:c}=od(),[u,f]=R.useState(()=>(s==null?void 0:s.yaml)??(n==null?void 0:n.yaml)??""),[h,p]=R.useState(""),[g,x]=R.useState("input"),[v,b]=R.useState(0),[w,S]=R.useState([]),[N,C]=R.useState([]),[k,_]=R.useState(null);R.useEffect(()=>{r(u)},[r,u]),R.useEffect(()=>{s&&(f(s.yaml),c())},[c,s]);const E=async()=>{o(u),x("validating"),S([]);try{const L=await(await fetch("/api/rigs/import/validate",{method:"POST",headers:{"Content-Type":"text/yaml"},body:u})).json();L.valid?x("valid"):(S(L.errors??["Validation failed"]),b(1),x("error"))}catch{S(["Validation request failed"]),b(1),x("error")}},M=async()=>{x("preflight"),S([]),C([]);try{const O={"Content-Type":"text/yaml"};h&&(O["X-Rig-Root"]=h);const P=await(await fetch("/api/rigs/import/preflight",{method:"POST",headers:O,body:u})).json();C(P.warnings??[]),P.errors&&P.errors.length>0?(S(P.errors),b(2),x("error")):x("preflight_done")}catch{S(["Preflight request failed"]),b(2),x("error")}},A=async()=>{x("instantiating"),S([]);try{const O=await t.mutateAsync({yaml:u,rigRoot:h.trim()||void 0});_(O),x("done")}catch(O){O instanceof ej?(O.code==="cycle_error"?S(["Cycle detected in rig topology"]):S(O.errors),C(O.warnings)):S([O instanceof Error?O.message:"Instantiate request failed"]),b(3),x("error")}};return a.jsx(it,{children:a.jsxs("div",{"data-testid":"import-flow",className:"space-y-8",children:[a.jsx(xn,{eyebrow:"Rig Import",title:"Import Rig",description:"Validate a RigSpec, run preflight checks, then instantiate a topology from YAML."}),a.jsx(Qq,{"data-testid":"step-indicator",steps:Fse,currentStep:Hse(g),errorAtStep:g==="error"?v:0}),g==="input"&&a.jsxs(hs,{title:"Rig YAML",description:"Paste a rig spec and optionally provide a rig root to anchor relative references during import.",children:[a.jsx(WN,{"data-testid":"yaml-input",value:u,onChange:O=>f(O.target.value),placeholder:"Paste YAML rig spec here...",rows:14,className:"font-mono text-body-sm mb-spacing-4"}),a.jsxs("div",{className:"mb-spacing-4",children:[a.jsx("label",{className:"text-label-sm text-foreground-muted uppercase tracking-[0.04em] block mb-spacing-1",children:"RIG ROOT (OPTIONAL)"}),a.jsx(YN,{"data-testid":"rig-root-input",type:"text",value:h,onChange:O=>p(O.target.value),placeholder:"/path/to/rig/root",className:"font-mono text-body-sm"})]}),a.jsx(Ce,{variant:"tactical","data-testid":"validate-btn",onClick:E,disabled:!u.trim(),children:"VALIDATE RIGSPEC"})]}),g==="validating"&&a.jsx("div",{className:"text-label-md text-foreground-muted",children:"Validating..."}),g==="valid"&&a.jsxs(hs,{title:"Validation Passed",description:"The RigSpec is valid. Run preflight checks before you instantiate it.",children:[a.jsx(Sn,{className:"mb-spacing-4","data-testid":"valid-message",children:a.jsx(jn,{className:"text-primary",children:"RigSpec valid. Run preflight checks?"})}),a.jsx(Ce,{variant:"tactical","data-testid":"preflight-btn",onClick:M,children:"RUN PREFLIGHT"})]}),g==="preflight"&&a.jsx("div",{className:"text-label-md text-foreground-muted",children:"Running preflight..."}),g==="preflight_done"&&a.jsxs(hs,{title:"Preflight Results",description:"Review warnings before you instantiate the rig into live runtime sessions.",children:[N.length>0&&a.jsx(Sn,{className:"mb-spacing-4","data-testid":"preflight-warnings",children:a.jsxs(jn,{className:"text-warning",children:[a.jsx("div",{className:"text-label-md uppercase mb-spacing-1",children:"WARNINGS"}),N.map((O,L)=>a.jsxs("div",{children:["— ",O]},L))]})}),a.jsx(Sn,{className:"mb-spacing-4","data-testid":"preflight-ready",children:a.jsx(jn,{className:"text-primary",children:"Preflight passed. Ready to instantiate."})}),a.jsx(Ce,{variant:"tactical","data-testid":"instantiate-btn",onClick:A,children:"INSTANTIATE"})]}),g==="instantiating"&&a.jsx("div",{className:"text-label-md text-foreground-muted",children:"Instantiating..."}),g==="done"&&k&&a.jsx(hs,{title:"Instantiate Result",description:"The daemon returned per-node launch status for the imported topology.",className:"space-y-4",children:a.jsxs("div",{"data-testid":"import-result",children:[a.jsx(Sn,{className:"mb-spacing-4",children:a.jsxs(jn,{children:[a.jsx("span",{className:"text-primary font-mono",children:k.specName}),a.jsxs("span",{className:"text-foreground-muted",children:[" (",k.rigId,")"]})]})}),a.jsxs(QN,{children:[a.jsx(XN,{children:a.jsxs(Gu,{children:[a.jsx(Ra,{children:"NODE"}),a.jsx(Ra,{children:"STATUS"})]})}),a.jsx(ZN,{children:k.nodes.map(O=>a.jsxs(Gu,{children:[a.jsx(Ea,{className:"font-mono",children:O.logicalId}),a.jsx(Ea,{children:a.jsx("span",{className:`font-mono ${$se(O.status)}`,"data-testid":`inst-status-${O.logicalId}`,children:O.status})})]},O.logicalId))})]}),e?a.jsx("div",{className:"mt-spacing-6",children:a.jsx(Ce,{variant:"ghost",onClick:e,children:"Close"})}):null]})}),g==="error"&&a.jsx(hs,{title:"Import Errors",description:"Fix the reported issues, then retry the import flow.",children:a.jsxs("div",{"data-testid":"import-errors",children:[N.length>0&&a.jsx(Sn,{className:"mb-spacing-2","data-testid":"error-warnings",children:a.jsxs(jn,{className:"text-warning",children:[a.jsx("div",{className:"text-label-md uppercase mb-spacing-1",children:"WARNINGS"}),N.map((O,L)=>a.jsxs("div",{children:["— ",O]},L))]})}),w.map((O,L)=>a.jsx(Sn,{className:"mb-spacing-2",children:a.jsx(jn,{className:"text-destructive",children:O})},L)),a.jsx(Ce,{variant:"tactical",className:"mt-spacing-4",onClick:()=>{x("input"),S([]),C([]),_(null),b(0),p("")},children:"TRY AGAIN"})]})})]})})}async function Vse(){const e=await fetch("/api/packages/summary");if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}function Gse(){return Ze({queryKey:["packages"],queryFn:Vse})}function Kse(e){switch(e){case"applied":return"bg-success";case"rolled_back":return"bg-warning";case"failed":return"bg-destructive";default:return"bg-foreground-muted-on-dark"}}function Yse(e){switch(e){case"applied":return"APPLIED";case"rolled_back":return"ROLLED BACK";case"failed":return"FAILED";default:return"NONE"}}function Wse({pkg:e,onSelect:t}){return a.jsxs("div",{"data-testid":"package-card",role:"link",tabIndex:0,className:"card-dark p-spacing-6 mb-spacing-3 cursor-pointer",onClick:()=>t(e.id),onKeyDown:n=>{n.key==="Enter"&&t(e.id)},children:[a.jsxs("div",{className:"flex items-baseline justify-between mb-spacing-2",children:[a.jsx("h3",{className:"text-headline-md uppercase",children:e.name}),a.jsxs("span",{className:"text-label-md font-mono text-foreground-muted-on-dark",children:["v",e.version]})]}),e.summary&&a.jsx("p",{className:"text-body-sm text-foreground-muted-on-dark mb-spacing-4",children:e.summary}),a.jsx("div",{className:"flex items-center gap-spacing-4 text-label-sm",children:a.jsxs("span",{className:"text-foreground-muted-on-dark",children:["SOURCE ",a.jsx("span",{className:"font-mono text-foreground-on-dark",children:e.sourceRef})]})}),a.jsxs("div",{className:"flex items-center gap-spacing-4 mt-spacing-3 text-label-sm",children:[a.jsxs("span",{className:"text-foreground-muted-on-dark",children:["INSTALLS ",a.jsx("span",{className:"font-mono text-foreground-on-dark","data-testid":"install-count",children:e.installCount})]}),a.jsxs("span",{className:"flex items-center gap-spacing-1",children:[a.jsx("span",{className:he("inline-block w-[6px] h-[6px]",Kse(e.latestInstallStatus))}),a.jsx("span",{className:"text-foreground-muted-on-dark","data-testid":"install-status",children:Yse(e.latestInstallStatus)})]})]})]})}function Qse(){const e=Ot(),{data:t,isPending:n,error:s}=Gse(),r=t?[...t].sort((o,c)=>c.createdAt.localeCompare(o.createdAt)):[];return n?a.jsx(it,{children:a.jsxs("div",{"data-testid":"packages-loading",children:[a.jsxs("div",{className:"flex justify-between mb-spacing-6",children:[a.jsx("div",{className:"h-8 w-32 shimmer"}),a.jsx("div",{className:"h-8 w-28 shimmer"})]}),[1,2].map(o=>a.jsxs("div",{className:"card-dark p-spacing-6 mb-spacing-3",children:[a.jsx("div",{className:"h-6 w-48 shimmer-dark mb-spacing-4"}),a.jsx("div",{className:"h-12 shimmer-dark mb-spacing-4"}),a.jsx("div",{className:"h-4 w-64 shimmer-dark"})]},o))]})}):s?a.jsx(it,{children:a.jsx("div",{children:a.jsx(Sn,{"data-testid":"packages-error",children:a.jsx(jn,{children:s.message})})})}):r.length===0?a.jsx(it,{children:a.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[60vh]","data-testid":"packages-empty",children:[a.jsx("h2",{className:"text-display-lg text-foreground mb-spacing-4",children:"NO LEGACY PACKAGE INSTALLS"}),a.jsx("p",{className:"text-body-md text-foreground-muted mb-spacing-8",children:"Legacy package tools remain available for bootstrap internals while Library becomes the main authoring surface."}),a.jsxs("div",{className:"flex flex-col items-center gap-spacing-3",children:[a.jsx(Ce,{variant:"default",size:"lg","data-testid":"empty-import-btn",onClick:()=>e({to:"/import"}),children:"IMPORT RIGSPEC"}),a.jsx(Ce,{variant:"ghost",size:"lg","data-testid":"empty-bootstrap-btn",onClick:()=>e({to:"/bootstrap"}),children:"BOOTSTRAP"})]})]})}):a.jsx(it,{children:a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between items-baseline mb-spacing-6",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-headline-lg uppercase",children:"LEGACY PACKAGE TOOLS"}),a.jsxs("p",{className:"text-label-md text-foreground-muted font-grotesk mt-spacing-1",children:[r.length," legacy package install",r.length!==1?"s":""," retained for bootstrap internals"]})]}),a.jsxs("div",{className:"flex flex-col items-end gap-spacing-2",children:[a.jsx(Ce,{variant:"default",size:"sm","data-testid":"header-import-btn",onClick:()=>e({to:"/import"}),children:"IMPORT RIGSPEC"}),a.jsx(Ce,{variant:"ghost",size:"sm","data-testid":"header-bootstrap-btn",onClick:()=>e({to:"/bootstrap"}),children:"BOOTSTRAP"})]})]}),r.map(o=>a.jsx(Wse,{pkg:o,onSelect:c=>e({to:"/packages/$packageId",params:{packageId:c}})},o.id))]})})}const Xse=[{num:1,label:"ENTER"},{num:2,label:"VALIDATE"},{num:3,label:"CONFIGURE"},{num:4,label:"PLAN"},{num:5,label:"APPLY"}];function Zse(e){switch(e){case"enter":return 1;case"validating":case"validated":return 2;case"configure":return 3;case"planning":case"planned":return 4;case"applying":case"done":return 5;case"error":return 0}}function Jse({currentStep:e,errorAtStep:t}){const n=e==="error"?t:Zse(e);return a.jsx("div",{className:"flex items-center gap-spacing-2 mb-spacing-8 p-spacing-4 inset-light flex-wrap","data-testid":"step-indicator",children:Xse.map((s,r)=>{const o=n>s.num,c=n===s.num;return a.jsxs("div",{className:"flex items-center gap-spacing-2",children:[r>0&&a.jsx("div",{className:`w-6 h-px mx-spacing-1 ${o?"bg-primary/40":"bg-foreground-muted/20"}`}),a.jsxs("span",{"data-testid":`step-${s.num}`,className:he("text-label-sm uppercase tracking-[0.04em] font-mono px-spacing-2 py-spacing-1 transition-colors whitespace-nowrap",o?"text-foreground-muted":c?"text-foreground bg-foreground/10":"text-foreground-muted/30"),children:[o?"✓":""," [ ",s.num," ",s.label," ]"]})]},s.num)})})}function ere(e){switch(e){case"approved":return"text-success";case"rejected":return"text-warning";case"deferred":return"text-foreground-muted";case"conflict":return"text-destructive";case"noop":return"text-foreground-muted/50";default:return""}}function tre(e){switch(e){case"approved":return"bg-success/8";case"rejected":return"bg-warning/8";case"deferred":return"bg-foreground-muted/4";case"conflict":return"bg-destructive/8";default:return""}}function nre(){const e=Ot(),[t,n]=R.useState(""),[s,r]=R.useState("enter"),[o,c]=R.useState(0),[u,f]=R.useState([]),[h,p]=R.useState(null),[g,x]=R.useState("claude-code"),[v,b]=R.useState("."),[w,S]=R.useState(""),[N,C]=R.useState(!1),[k,_]=R.useState(null),[E,M]=R.useState(null),A=async()=>{r("validating"),f([]);try{const B=await(await fetch("/api/packages/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceRef:t})})).json();B.valid?(p(B.manifest),r("validated")):(f(B.errors??[B.error??"Validation failed"]),c(2),r("error"))}catch{f(["Validation request failed"]),c(2),r("error")}},O=async()=>{r("planning"),f([]);try{const I=await fetch("/api/packages/plan",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceRef:t,targetRoot:v,runtime:g,roleName:w||void 0,allowMerge:N})});if(!I.ok){const F=await I.json();f(F.errors??[F.error??"Plan failed"]),c(4),r("error");return}const B=await I.json();_(B),r("planned")}catch{f(["Plan request failed"]),c(4),r("error")}},L=async()=>{r("applying"),f([]);try{const I=await fetch("/api/packages/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceRef:t,targetRoot:v,runtime:g,roleName:w||void 0,allowMerge:N})}),B=await I.json();if(I.status>=400){f(B.errors??[B.error??"Install failed"]),c(5),r("error");return}M(B),r("done")}catch{f(["Install request failed"]),c(5),r("error")}},P=((k==null?void 0:k.conflicts)??0)>0;return a.jsx(it,{children:a.jsxs("div",{"data-testid":"install-flow",children:[a.jsx("div",{className:"mb-spacing-8",children:a.jsxs("div",{children:[a.jsx("h2",{className:"text-headline-lg uppercase tracking-[0.06em]",children:"INSTALL PACKAGE (Legacy)"}),a.jsx("p",{className:"text-label-md text-foreground-muted font-grotesk mt-spacing-1",children:"Validate, configure, and apply an agent package"})]})}),a.jsx(Jse,{currentStep:s,errorAtStep:o}),s==="enter"&&a.jsxs("div",{children:[a.jsx("label",{className:"text-label-md text-foreground-muted uppercase tracking-[0.04em] block mb-spacing-2",children:"PACKAGE PATH"}),a.jsx("input",{"data-testid":"source-path-input",type:"text",value:t,onChange:I=>n(I.target.value),placeholder:"/path/to/package",className:"w-full bg-transparent border-b border-foreground/20 focus:border-foreground px-0 py-spacing-2 text-body-md font-mono outline-none transition-colors"}),a.jsx(Ce,{variant:"tactical","data-testid":"validate-btn",onClick:A,disabled:!t.trim(),className:"mt-spacing-4",children:"VALIDATE"})]}),s==="validating"&&a.jsx("div",{className:"text-label-md text-foreground-muted","data-testid":"validating-indicator",children:"Validating..."}),s==="validated"&&h&&a.jsxs("div",{"data-testid":"manifest-summary",children:[a.jsxs("div",{className:"card-dark p-spacing-4 mb-spacing-4",children:[a.jsxs("div",{className:"flex items-baseline justify-between mb-spacing-2",children:[a.jsx("span",{className:"text-headline-md uppercase",children:h.name}),a.jsxs("span",{className:"font-mono text-foreground-muted-on-dark",children:["v",h.version]})]}),a.jsx("p",{className:"text-body-sm text-foreground-muted-on-dark mb-spacing-3",children:h.summary}),a.jsxs("div",{className:"flex flex-wrap gap-spacing-3 text-label-sm",children:[a.jsxs("span",{children:["Skills: ",a.jsx("span",{className:"font-mono text-foreground-on-dark",children:h.exportCounts.skills})]}),a.jsxs("span",{children:["Guidance: ",a.jsx("span",{className:"font-mono text-foreground-on-dark",children:h.exportCounts.guidance})]}),a.jsxs("span",{children:["Agents: ",a.jsx("span",{className:"font-mono text-foreground-on-dark",children:h.exportCounts.agents})]}),a.jsxs("span",{children:["Hooks: ",a.jsx("span",{className:"font-mono text-foreground-on-dark",children:h.exportCounts.hooks})]}),a.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1.5",children:[a.jsx("span",{children:"Runtimes:"}),a.jsx("span",{className:"inline-flex min-w-0 flex-wrap items-center gap-1",children:h.runtimes.map(I=>a.jsx(_n,{runtime:I,size:"xs",compact:!0,className:"border-white/20 bg-white/10 text-foreground-on-dark"},I))})]})]})]}),a.jsx(Ce,{variant:"tactical","data-testid":"configure-btn",onClick:()=>r("configure"),children:"CONFIGURE"})]}),s==="configure"&&h&&a.jsxs("div",{"data-testid":"configure-step",children:[a.jsxs("div",{className:"space-y-spacing-4 mb-spacing-6",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-label-sm text-foreground-muted uppercase tracking-[0.04em] block mb-spacing-1",children:"RUNTIME"}),a.jsx("select",{"data-testid":"runtime-select",value:g,onChange:I=>x(I.target.value),className:"bg-transparent border-b border-foreground/20 py-spacing-1 text-body-md font-mono outline-none",children:h.runtimes.map(I=>a.jsx("option",{value:I,children:I},I))})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-label-sm text-foreground-muted uppercase tracking-[0.04em] block mb-spacing-1",children:"TARGET ROOT"}),a.jsx("input",{"data-testid":"target-root-input",type:"text",value:v,onChange:I=>b(I.target.value),className:"w-full bg-transparent border-b border-foreground/20 px-0 py-spacing-1 text-body-md font-mono outline-none"})]}),h.roles.length>0&&a.jsxs("div",{children:[a.jsx("label",{className:"text-label-sm text-foreground-muted uppercase tracking-[0.04em] block mb-spacing-1",children:"ROLE"}),a.jsxs("select",{"data-testid":"role-select",value:w,onChange:I=>S(I.target.value),className:"bg-transparent border-b border-foreground/20 py-spacing-1 text-body-md font-mono outline-none",children:[a.jsx("option",{value:"",children:"All exports"}),h.roles.map(I=>a.jsxs("option",{value:I.name,children:[I.name,I.description?` — ${I.description}`:""]},I.name))]})]}),a.jsxs("div",{className:"flex items-center gap-spacing-2",children:[a.jsx("input",{"data-testid":"allow-merge-toggle",type:"checkbox",checked:N,onChange:I=>C(I.target.checked),className:"accent-primary"}),a.jsx("label",{className:"text-label-sm text-foreground-muted",children:"Allow managed block merges into existing files"})]}),(h.requirements.cliTools.length>0||h.requirements.systemPackages.length>0)&&a.jsxs("div",{"data-testid":"requirements-section",className:"p-spacing-3 bg-foreground/4",children:[a.jsx("span",{className:"text-label-sm text-foreground-muted uppercase block mb-spacing-1",children:"REQUIREMENTS"}),h.requirements.cliTools.map(I=>a.jsxs("div",{className:"text-body-sm font-mono",children:["CLI: ",I.name]},I.name)),h.requirements.systemPackages.map(I=>a.jsxs("div",{className:"text-body-sm font-mono",children:["System: ",I.name]},I.name))]})]}),a.jsx(Ce,{variant:"tactical","data-testid":"plan-btn",onClick:O,children:"PREVIEW PLAN"})]}),s==="planning"&&a.jsx("div",{className:"text-label-md text-foreground-muted","data-testid":"planning-indicator",children:"Planning..."}),s==="planned"&&k&&a.jsxs("div",{"data-testid":"plan-preview",children:[a.jsxs("div",{className:"flex flex-wrap gap-spacing-4 mb-spacing-4 text-label-sm",children:[a.jsxs("span",{children:["Approved: ",a.jsx("span",{className:"font-mono text-success","data-testid":"plan-actionable",children:k.actionable})]}),a.jsxs("span",{children:["Deferred: ",a.jsx("span",{className:"font-mono text-foreground-muted","data-testid":"plan-deferred",children:k.deferred})]}),a.jsxs("span",{children:["Conflicts: ",a.jsx("span",{className:"font-mono text-destructive","data-testid":"plan-conflicts",children:k.conflicts})]}),a.jsxs("span",{children:["No-ops: ",a.jsx("span",{className:"font-mono","data-testid":"plan-noops",children:k.noOps})]}),k.rejected>0&&a.jsxs("span",{children:["Rejected: ",a.jsx("span",{className:"font-mono text-warning","data-testid":"plan-rejected",children:k.rejected})]})]}),P&&a.jsx(Sn,{className:"mb-spacing-4","data-testid":"conflict-warning",children:a.jsx(jn,{className:"text-destructive",children:"Conflicts detected — resolve before applying"})}),a.jsxs(QN,{children:[a.jsx(XN,{children:a.jsxs(Gu,{children:[a.jsx(Ra,{children:"TYPE"}),a.jsx(Ra,{children:"NAME"}),a.jsx(Ra,{children:"STATUS"}),a.jsx(Ra,{children:"TARGET"})]})}),a.jsx(ZN,{children:k.entries.map((I,B)=>a.jsxs(Gu,{className:tre(I.policyStatus),"data-testid":"plan-entry","data-policy-status":I.policyStatus,children:[a.jsx(Ea,{className:"font-mono text-label-sm",children:I.exportType}),a.jsx(Ea,{className:"font-mono text-label-sm",children:I.exportName}),a.jsxs(Ea,{className:he("font-mono text-label-sm uppercase",ere(I.policyStatus)),children:[I.policyStatus,I.deferReason&&a.jsxs("span",{className:"text-foreground-muted normal-case",children:[" — ",I.deferReason]}),I.conflict&&a.jsxs("span",{className:"text-destructive normal-case",children:[" — ",I.conflict.reason]})]}),a.jsx(Ea,{className:"font-mono text-label-sm text-foreground-muted truncate max-w-[200px]",children:I.targetPath||"—"})]},B))})]}),a.jsx("div",{className:"mt-spacing-4",children:a.jsx(Ce,{variant:"tactical","data-testid":"apply-btn",onClick:L,disabled:P,title:P?"Resolve conflicts before applying":void 0,children:"APPLY"})})]}),s==="applying"&&a.jsx("div",{className:"text-label-md text-foreground-muted","data-testid":"applying-indicator",children:"Applying..."}),s==="done"&&E&&a.jsxs("div",{"data-testid":"install-result",children:[a.jsx(Sn,{className:"mb-spacing-4",children:a.jsxs(jn,{children:[a.jsx("span",{className:"text-primary font-mono",children:E.packageName}),a.jsx("span",{className:"text-foreground-muted",children:" installed as "}),a.jsx("span",{className:"font-mono","data-testid":"result-install-id",children:E.installId})]})}),a.jsxs("div",{className:"flex gap-spacing-4 text-label-sm mb-spacing-4",children:[a.jsxs("span",{children:["Applied: ",a.jsx("span",{className:"font-mono text-success","data-testid":"result-applied",children:E.applied.length})]}),a.jsxs("span",{children:["Deferred: ",a.jsx("span",{className:"font-mono text-foreground-muted","data-testid":"result-deferred",children:E.deferred.length})]}),a.jsxs("span",{children:["Verified: ",a.jsx("span",{className:he("font-mono",E.verification.passed?"text-success":"text-destructive"),"data-testid":"result-verified",children:E.verification.passed?"PASS":"FAIL"})]})]}),a.jsx("div",{className:"flex gap-spacing-3",children:a.jsx(Ce,{variant:"tactical","data-testid":"detail-link",onClick:()=>e({to:"/packages/$packageId",params:{packageId:E.packageId}}),children:"VIEW INSTALL DETAILS"})})]}),s==="error"&&a.jsxs("div",{"data-testid":"install-errors",children:[u.map((I,B)=>a.jsx(Sn,{className:"mb-spacing-2",children:a.jsx(jn,{className:"text-destructive",children:I})},B)),a.jsx(Ce,{variant:"tactical",className:"mt-spacing-4","data-testid":"try-again-btn",onClick:()=>{r("enter"),f([]),p(null),_(null),M(null),c(0)},children:"TRY AGAIN"})]})]})})}function Gi(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e==null||e(r),n===!1||!r.defaultPrevented)return t==null?void 0:t(r)}}function sre(e,t){const n=R.createContext(t),s=o=>{const{children:c,...u}=o,f=R.useMemo(()=>u,Object.values(u));return a.jsx(n.Provider,{value:f,children:c})};s.displayName=e+"Provider";function r(o){const c=R.useContext(n);if(c)return c;if(t!==void 0)return t;throw new Error(`\`${o}\` must be used within \`${e}\``)}return[s,r]}function rre(e,t=[]){let n=[];function s(o,c){const u=R.createContext(c),f=n.length;n=[...n,c];const h=g=>{var N;const{scope:x,children:v,...b}=g,w=((N=x==null?void 0:x[e])==null?void 0:N[f])||u,S=R.useMemo(()=>b,Object.values(b));return a.jsx(w.Provider,{value:S,children:v})};h.displayName=o+"Provider";function p(g,x){var w;const v=((w=x==null?void 0:x[e])==null?void 0:w[f])||u,b=R.useContext(v);if(b)return b;if(c!==void 0)return c;throw new Error(`\`${g}\` must be used within \`${o}\``)}return[h,p]}const r=()=>{const o=n.map(c=>R.createContext(c));return function(u){const f=(u==null?void 0:u[e])||o;return R.useMemo(()=>({[`__scope${e}`]:{...u,[e]:f}}),[u,f])}};return r.scopeName=e,[s,ire(r,...t)]}function ire(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const s=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(o){const c=s.reduce((u,{useScope:f,scopeName:h})=>{const g=f(o)[`__scope${h}`];return{...u,...g}},{});return R.useMemo(()=>({[`__scope${t.scopeName}`]:c}),[c])}};return n.scopeName=t.scopeName,n}var Ku=globalThis!=null&&globalThis.document?R.useLayoutEffect:()=>{},are=hj[" useId ".trim().toString()]||(()=>{}),ore=0;function B1(e){const[t,n]=R.useState(are());return Ku(()=>{n(s=>s??String(ore++))},[e]),e||(t?`radix-${t}`:"")}var lre=hj[" useInsertionEffect ".trim().toString()]||Ku;function cre({prop:e,defaultProp:t,onChange:n=()=>{},caller:s}){const[r,o,c]=ure({defaultProp:t,onChange:n}),u=e!==void 0,f=u?e:r;{const p=R.useRef(e!==void 0);R.useEffect(()=>{const g=p.current;g!==u&&console.warn(`${s} is changing from ${g?"controlled":"uncontrolled"} to ${u?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),p.current=u},[u,s])}const h=R.useCallback(p=>{var g;if(u){const x=dre(p)?p(e):p;x!==e&&((g=c.current)==null||g.call(c,x))}else o(p)},[u,e,o,c]);return[f,h]}function ure({defaultProp:e,onChange:t}){const[n,s]=R.useState(e),r=R.useRef(n),o=R.useRef(t);return lre(()=>{o.current=t},[t]),R.useEffect(()=>{var c;r.current!==n&&((c=o.current)==null||c.call(o,n),r.current=n)},[n,r]),[n,s,o]}function dre(e){return typeof e=="function"}function Zq(e){const t=fre(e),n=R.forwardRef((s,r)=>{const{children:o,...c}=s,u=R.Children.toArray(o),f=u.find(pre);if(f){const h=f.props.children,p=u.map(g=>g===f?R.Children.count(h)>1?R.Children.only(null):R.isValidElement(h)?h.props.children:null:g);return a.jsx(t,{...c,ref:r,children:R.isValidElement(h)?R.cloneElement(h,void 0,p):null})}return a.jsx(t,{...c,ref:r,children:o})});return n.displayName=`${e}.Slot`,n}function fre(e){const t=R.forwardRef((n,s)=>{const{children:r,...o}=n;if(R.isValidElement(r)){const c=gre(r),u=mre(o,r.props);return r.type!==R.Fragment&&(u.ref=s?Kj(s,c):c),R.cloneElement(r,u)}return R.Children.count(r)>1?R.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var hre=Symbol("radix.slottable");function pre(e){return R.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===hre}function mre(e,t){const n={...t};for(const s in t){const r=e[s],o=t[s];/^on[A-Z]/.test(s)?r&&o?n[s]=(...u)=>{const f=o(...u);return r(...u),f}:r&&(n[s]=r):s==="style"?n[s]={...r,...o}:s==="className"&&(n[s]=[r,o].filter(Boolean).join(" "))}return{...e,...n}}function gre(e){var s,r;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var xre=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Fr=xre.reduce((e,t)=>{const n=Zq(`Primitive.${t}`),s=R.forwardRef((r,o)=>{const{asChild:c,...u}=r,f=c?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(f,{...u,ref:o})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function vre(e,t){e&&Rp.flushSync(()=>e.dispatchEvent(t))}function Yu(e){const t=R.useRef(e);return R.useEffect(()=>{t.current=e}),R.useMemo(()=>(...n)=>{var s;return(s=t.current)==null?void 0:s.call(t,...n)},[])}function yre(e,t=globalThis==null?void 0:globalThis.document){const n=Yu(e);R.useEffect(()=>{const s=r=>{r.key==="Escape"&&n(r)};return t.addEventListener("keydown",s,{capture:!0}),()=>t.removeEventListener("keydown",s,{capture:!0})},[n,t])}var bre="DismissableLayer",tj="dismissableLayer.update",wre="dismissableLayer.pointerDownOutside",Sre="dismissableLayer.focusOutside",u4,Jq=R.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),e$=R.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:r,onFocusOutside:o,onInteractOutside:c,onDismiss:u,...f}=e,h=R.useContext(Jq),[p,g]=R.useState(null),x=(p==null?void 0:p.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,v]=R.useState({}),b=ao(t,A=>g(A)),w=Array.from(h.layers),[S]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),N=w.indexOf(S),C=p?w.indexOf(p):-1,k=h.layersWithOutsidePointerEventsDisabled.size>0,_=C>=N,E=_re(A=>{const O=A.target,L=[...h.branches].some(P=>P.contains(O));!_||L||(r==null||r(A),c==null||c(A),A.defaultPrevented||u==null||u())},x),M=Cre(A=>{const O=A.target;[...h.branches].some(P=>P.contains(O))||(o==null||o(A),c==null||c(A),A.defaultPrevented||u==null||u())},x);return yre(A=>{C===h.layers.size-1&&(s==null||s(A),!A.defaultPrevented&&u&&(A.preventDefault(),u()))},x),R.useEffect(()=>{if(p)return n&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(u4=x.body.style.pointerEvents,x.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(p)),h.layers.add(p),d4(),()=>{n&&h.layersWithOutsidePointerEventsDisabled.size===1&&(x.body.style.pointerEvents=u4)}},[p,x,n,h]),R.useEffect(()=>()=>{p&&(h.layers.delete(p),h.layersWithOutsidePointerEventsDisabled.delete(p),d4())},[p,h]),R.useEffect(()=>{const A=()=>v({});return document.addEventListener(tj,A),()=>document.removeEventListener(tj,A)},[]),a.jsx(Fr.div,{...f,ref:b,style:{pointerEvents:k?_?"auto":"none":void 0,...e.style},onFocusCapture:Gi(e.onFocusCapture,M.onFocusCapture),onBlurCapture:Gi(e.onBlurCapture,M.onBlurCapture),onPointerDownCapture:Gi(e.onPointerDownCapture,E.onPointerDownCapture)})});e$.displayName=bre;var jre="DismissableLayerBranch",Nre=R.forwardRef((e,t)=>{const n=R.useContext(Jq),s=R.useRef(null),r=ao(t,s);return R.useEffect(()=>{const o=s.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),a.jsx(Fr.div,{...e,ref:r})});Nre.displayName=jre;function _re(e,t=globalThis==null?void 0:globalThis.document){const n=Yu(e),s=R.useRef(!1),r=R.useRef(()=>{});return R.useEffect(()=>{const o=u=>{if(u.target&&!s.current){let f=function(){t$(wre,n,h,{discrete:!0})};const h={originalEvent:u};u.pointerType==="touch"?(t.removeEventListener("click",r.current),r.current=f,t.addEventListener("click",r.current,{once:!0})):f()}else t.removeEventListener("click",r.current);s.current=!1},c=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(c),t.removeEventListener("pointerdown",o),t.removeEventListener("click",r.current)}},[t,n]),{onPointerDownCapture:()=>s.current=!0}}function Cre(e,t=globalThis==null?void 0:globalThis.document){const n=Yu(e),s=R.useRef(!1);return R.useEffect(()=>{const r=o=>{o.target&&!s.current&&t$(Sre,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",r),()=>t.removeEventListener("focusin",r)},[t,n]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function d4(){const e=new CustomEvent(tj);document.dispatchEvent(e)}function t$(e,t,n,{discrete:s}){const r=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&r.addEventListener(e,t,{once:!0}),s?vre(r,o):r.dispatchEvent(o)}var F1="focusScope.autoFocusOnMount",H1="focusScope.autoFocusOnUnmount",f4={bubbles:!1,cancelable:!0},kre="FocusScope",n$=R.forwardRef((e,t)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:r,onUnmountAutoFocus:o,...c}=e,[u,f]=R.useState(null),h=Yu(r),p=Yu(o),g=R.useRef(null),x=ao(t,w=>f(w)),v=R.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;R.useEffect(()=>{if(s){let w=function(k){if(v.paused||!u)return;const _=k.target;u.contains(_)?g.current=_:_i(g.current,{select:!0})},S=function(k){if(v.paused||!u)return;const _=k.relatedTarget;_!==null&&(u.contains(_)||_i(g.current,{select:!0}))},N=function(k){if(document.activeElement===document.body)for(const E of k)E.removedNodes.length>0&&_i(u)};document.addEventListener("focusin",w),document.addEventListener("focusout",S);const C=new MutationObserver(N);return u&&C.observe(u,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",w),document.removeEventListener("focusout",S),C.disconnect()}}},[s,u,v.paused]),R.useEffect(()=>{if(u){p4.add(v);const w=document.activeElement;if(!u.contains(w)){const N=new CustomEvent(F1,f4);u.addEventListener(F1,h),u.dispatchEvent(N),N.defaultPrevented||(Rre(Ire(s$(u)),{select:!0}),document.activeElement===w&&_i(u))}return()=>{u.removeEventListener(F1,h),setTimeout(()=>{const N=new CustomEvent(H1,f4);u.addEventListener(H1,p),u.dispatchEvent(N),N.defaultPrevented||_i(w??document.body,{select:!0}),u.removeEventListener(H1,p),p4.remove(v)},0)}}},[u,h,p,v]);const b=R.useCallback(w=>{if(!n&&!s||v.paused)return;const S=w.key==="Tab"&&!w.altKey&&!w.ctrlKey&&!w.metaKey,N=document.activeElement;if(S&&N){const C=w.currentTarget,[k,_]=Ere(C);k&&_?!w.shiftKey&&N===_?(w.preventDefault(),n&&_i(k,{select:!0})):w.shiftKey&&N===k&&(w.preventDefault(),n&&_i(_,{select:!0})):N===C&&w.preventDefault()}},[n,s,v.paused]);return a.jsx(Fr.div,{tabIndex:-1,...c,ref:x,onKeyDown:b})});n$.displayName=kre;function Rre(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if(_i(s,{select:t}),document.activeElement!==n)return}function Ere(e){const t=s$(e),n=h4(t,e),s=h4(t.reverse(),e);return[n,s]}function s$(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const r=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||r?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function h4(e,t){for(const n of e)if(!Are(n,{upTo:t}))return n}function Are(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function Tre(e){return e instanceof HTMLInputElement&&"select"in e}function _i(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Tre(e)&&t&&e.select()}}var p4=Mre();function Mre(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=m4(e,t),e.unshift(t)},remove(t){var n;e=m4(e,t),(n=e[0])==null||n.resume()}}}function m4(e,t){const n=[...e],s=n.indexOf(t);return s!==-1&&n.splice(s,1),n}function Ire(e){return e.filter(t=>t.tagName!=="A")}var Ore="Portal",r$=R.forwardRef((e,t)=>{var u;const{container:n,...s}=e,[r,o]=R.useState(!1);Ku(()=>o(!0),[]);const c=n||r&&((u=globalThis==null?void 0:globalThis.document)==null?void 0:u.body);return c?rB.createPortal(a.jsx(Fr.div,{...s,ref:t}),c):null});r$.displayName=Ore;function Lre(e,t){return R.useReducer((n,s)=>t[n][s]??n,e)}var bm=e=>{const{present:t,children:n}=e,s=Pre(t),r=typeof n=="function"?n({present:s.isPresent}):R.Children.only(n),o=ao(s.ref,Dre(r));return typeof n=="function"||s.isPresent?R.cloneElement(r,{ref:o}):null};bm.displayName="Presence";function Pre(e){const[t,n]=R.useState(),s=R.useRef(null),r=R.useRef(e),o=R.useRef("none"),c=e?"mounted":"unmounted",[u,f]=Lre(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return R.useEffect(()=>{const h=jh(s.current);o.current=u==="mounted"?h:"none"},[u]),Ku(()=>{const h=s.current,p=r.current;if(p!==e){const x=o.current,v=jh(h);e?f("MOUNT"):v==="none"||(h==null?void 0:h.display)==="none"?f("UNMOUNT"):f(p&&x!==v?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,f]),Ku(()=>{if(t){let h;const p=t.ownerDocument.defaultView??window,g=v=>{const w=jh(s.current).includes(CSS.escape(v.animationName));if(v.target===t&&w&&(f("ANIMATION_END"),!r.current)){const S=t.style.animationFillMode;t.style.animationFillMode="forwards",h=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=S)})}},x=v=>{v.target===t&&(o.current=jh(s.current))};return t.addEventListener("animationstart",x),t.addEventListener("animationcancel",g),t.addEventListener("animationend",g),()=>{p.clearTimeout(h),t.removeEventListener("animationstart",x),t.removeEventListener("animationcancel",g),t.removeEventListener("animationend",g)}}else f("ANIMATION_END")},[t,f]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:R.useCallback(h=>{s.current=h?getComputedStyle(h):null,n(h)},[])}}function jh(e){return(e==null?void 0:e.animationName)||"none"}function Dre(e){var s,r;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var U1=0;function qre(){R.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??g4()),document.body.insertAdjacentElement("beforeend",e[1]??g4()),U1++,()=>{U1===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),U1--}},[])}function g4(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Ks=function(){return Ks=Object.assign||function(t){for(var n,s=1,r=arguments.length;s<r;s++){n=arguments[s];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},Ks.apply(this,arguments)};function i$(e,t){var n={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,s=Object.getOwnPropertySymbols(e);r<s.length;r++)t.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(e,s[r])&&(n[s[r]]=e[s[r]]);return n}function $re(e,t,n){if(n||arguments.length===2)for(var s=0,r=t.length,o;s<r;s++)(o||!(s in t))&&(o||(o=Array.prototype.slice.call(t,0,s)),o[s]=t[s]);return e.concat(o||Array.prototype.slice.call(t))}var Gh="right-scroll-bar-position",Kh="width-before-scroll-bar",zre="with-scroll-bars-hidden",Bre="--removed-body-scroll-bar-size";function V1(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Fre(e,t){var n=R.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(s){var r=n.value;r!==s&&(n.value=s,n.callback(s,r))}}}})[0];return n.callback=t,n.facade}var Hre=typeof window<"u"?R.useLayoutEffect:R.useEffect,x4=new WeakMap;function Ure(e,t){var n=Fre(null,function(s){return e.forEach(function(r){return V1(r,s)})});return Hre(function(){var s=x4.get(n);if(s){var r=new Set(s),o=new Set(e),c=n.current;r.forEach(function(u){o.has(u)||V1(u,null)}),o.forEach(function(u){r.has(u)||V1(u,c)})}x4.set(n,e)},[e]),n}function Vre(e){return e}function Gre(e,t){t===void 0&&(t=Vre);var n=[],s=!1,r={read:function(){if(s)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(o){var c=t(o,s);return n.push(c),function(){n=n.filter(function(u){return u!==c})}},assignSyncMedium:function(o){for(s=!0;n.length;){var c=n;n=[],c.forEach(o)}n={push:function(u){return o(u)},filter:function(){return n}}},assignMedium:function(o){s=!0;var c=[];if(n.length){var u=n;n=[],u.forEach(o),c=n}var f=function(){var p=c;c=[],p.forEach(o)},h=function(){return Promise.resolve().then(f)};h(),n={push:function(p){c.push(p),h()},filter:function(p){return c=c.filter(p),n}}}};return r}function Kre(e){e===void 0&&(e={});var t=Gre(null);return t.options=Ks({async:!0,ssr:!1},e),t}var a$=function(e){var t=e.sideCar,n=i$(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var s=t.read();if(!s)throw new Error("Sidecar medium not found");return R.createElement(s,Ks({},n))};a$.isSideCarExport=!0;function Yre(e,t){return e.useMedium(t),a$}var o$=Kre(),G1=function(){},wm=R.forwardRef(function(e,t){var n=R.useRef(null),s=R.useState({onScrollCapture:G1,onWheelCapture:G1,onTouchMoveCapture:G1}),r=s[0],o=s[1],c=e.forwardProps,u=e.children,f=e.className,h=e.removeScrollBar,p=e.enabled,g=e.shards,x=e.sideCar,v=e.noRelative,b=e.noIsolation,w=e.inert,S=e.allowPinchZoom,N=e.as,C=N===void 0?"div":N,k=e.gapMode,_=i$(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),E=x,M=Ure([n,t]),A=Ks(Ks({},_),r);return R.createElement(R.Fragment,null,p&&R.createElement(E,{sideCar:o$,removeScrollBar:h,shards:g,noRelative:v,noIsolation:b,inert:w,setCallbacks:o,allowPinchZoom:!!S,lockRef:n,gapMode:k}),c?R.cloneElement(R.Children.only(u),Ks(Ks({},A),{ref:M})):R.createElement(C,Ks({},A,{className:f,ref:M}),u))});wm.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};wm.classNames={fullWidth:Kh,zeroRight:Gh};var Wre=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Qre(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Wre();return t&&e.setAttribute("nonce",t),e}function Xre(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Zre(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Jre=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Qre())&&(Xre(t,n),Zre(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},eie=function(){var e=Jre();return function(t,n){R.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},l$=function(){var e=eie(),t=function(n){var s=n.styles,r=n.dynamic;return e(s,r),null};return t},tie={left:0,top:0,right:0,gap:0},K1=function(e){return parseInt(e||"",10)||0},nie=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],s=t[e==="padding"?"paddingTop":"marginTop"],r=t[e==="padding"?"paddingRight":"marginRight"];return[K1(n),K1(s),K1(r)]},sie=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return tie;var t=nie(e),n=document.documentElement.clientWidth,s=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,s-n+t[2]-t[0])}},rie=l$(),jl="data-scroll-locked",iie=function(e,t,n,s){var r=e.left,o=e.top,c=e.right,u=e.gap;return n===void 0&&(n="margin"),`
335
+ .`.concat(zre,` {
336
+ overflow: hidden `).concat(s,`;
337
+ padding-right: `).concat(u,"px ").concat(s,`;
338
+ }
339
+ body[`).concat(jl,`] {
340
+ overflow: hidden `).concat(s,`;
341
+ overscroll-behavior: contain;
342
+ `).concat([t&&"position: relative ".concat(s,";"),n==="margin"&&`
343
+ padding-left: `.concat(r,`px;
344
+ padding-top: `).concat(o,`px;
345
+ padding-right: `).concat(c,`px;
346
+ margin-left:0;
347
+ margin-top:0;
348
+ margin-right: `).concat(u,"px ").concat(s,`;
349
+ `),n==="padding"&&"padding-right: ".concat(u,"px ").concat(s,";")].filter(Boolean).join(""),`
350
+ }
351
+
352
+ .`).concat(Gh,` {
353
+ right: `).concat(u,"px ").concat(s,`;
354
+ }
355
+
356
+ .`).concat(Kh,` {
357
+ margin-right: `).concat(u,"px ").concat(s,`;
358
+ }
359
+
360
+ .`).concat(Gh," .").concat(Gh,` {
361
+ right: 0 `).concat(s,`;
362
+ }
363
+
364
+ .`).concat(Kh," .").concat(Kh,` {
365
+ margin-right: 0 `).concat(s,`;
366
+ }
367
+
368
+ body[`).concat(jl,`] {
369
+ `).concat(Bre,": ").concat(u,`px;
370
+ }
371
+ `)},v4=function(){var e=parseInt(document.body.getAttribute(jl)||"0",10);return isFinite(e)?e:0},aie=function(){R.useEffect(function(){return document.body.setAttribute(jl,(v4()+1).toString()),function(){var e=v4()-1;e<=0?document.body.removeAttribute(jl):document.body.setAttribute(jl,e.toString())}},[])},oie=function(e){var t=e.noRelative,n=e.noImportant,s=e.gapMode,r=s===void 0?"margin":s;aie();var o=R.useMemo(function(){return sie(r)},[r]);return R.createElement(rie,{styles:iie(o,!t,r,n?"":"!important")})},nj=!1;if(typeof window<"u")try{var Nh=Object.defineProperty({},"passive",{get:function(){return nj=!0,!0}});window.addEventListener("test",Nh,Nh),window.removeEventListener("test",Nh,Nh)}catch{nj=!1}var al=nj?{passive:!1}:!1,lie=function(e){return e.tagName==="TEXTAREA"},c$=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!lie(e)&&n[t]==="visible")},cie=function(e){return c$(e,"overflowY")},uie=function(e){return c$(e,"overflowX")},y4=function(e,t){var n=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var r=u$(e,s);if(r){var o=d$(e,s),c=o[1],u=o[2];if(c>u)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},die=function(e){var t=e.scrollTop,n=e.scrollHeight,s=e.clientHeight;return[t,n,s]},fie=function(e){var t=e.scrollLeft,n=e.scrollWidth,s=e.clientWidth;return[t,n,s]},u$=function(e,t){return e==="v"?cie(t):uie(t)},d$=function(e,t){return e==="v"?die(t):fie(t)},hie=function(e,t){return e==="h"&&t==="rtl"?-1:1},pie=function(e,t,n,s,r){var o=hie(e,window.getComputedStyle(t).direction),c=o*s,u=n.target,f=t.contains(u),h=!1,p=c>0,g=0,x=0;do{if(!u)break;var v=d$(e,u),b=v[0],w=v[1],S=v[2],N=w-S-o*b;(b||N)&&u$(e,u)&&(g+=N,x+=b);var C=u.parentNode;u=C&&C.nodeType===Node.DOCUMENT_FRAGMENT_NODE?C.host:C}while(!f&&u!==document.body||f&&(t.contains(u)||t===u));return(p&&Math.abs(g)<1||!p&&Math.abs(x)<1)&&(h=!0),h},_h=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},b4=function(e){return[e.deltaX,e.deltaY]},w4=function(e){return e&&"current"in e?e.current:e},mie=function(e,t){return e[0]===t[0]&&e[1]===t[1]},gie=function(e){return`
372
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
373
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
374
+ `)},xie=0,ol=[];function vie(e){var t=R.useRef([]),n=R.useRef([0,0]),s=R.useRef(),r=R.useState(xie++)[0],o=R.useState(l$)[0],c=R.useRef(e);R.useEffect(function(){c.current=e},[e]),R.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(r));var w=$re([e.lockRef.current],(e.shards||[]).map(w4),!0).filter(Boolean);return w.forEach(function(S){return S.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),w.forEach(function(S){return S.classList.remove("allow-interactivity-".concat(r))})}}},[e.inert,e.lockRef.current,e.shards]);var u=R.useCallback(function(w,S){if("touches"in w&&w.touches.length===2||w.type==="wheel"&&w.ctrlKey)return!c.current.allowPinchZoom;var N=_h(w),C=n.current,k="deltaX"in w?w.deltaX:C[0]-N[0],_="deltaY"in w?w.deltaY:C[1]-N[1],E,M=w.target,A=Math.abs(k)>Math.abs(_)?"h":"v";if("touches"in w&&A==="h"&&M.type==="range")return!1;var O=window.getSelection(),L=O&&O.anchorNode,P=L?L===M||L.contains(M):!1;if(P)return!1;var I=y4(A,M);if(!I)return!0;if(I?E=A:(E=A==="v"?"h":"v",I=y4(A,M)),!I)return!1;if(!s.current&&"changedTouches"in w&&(k||_)&&(s.current=E),!E)return!0;var B=s.current||E;return pie(B,S,w,B==="h"?k:_)},[]),f=R.useCallback(function(w){var S=w;if(!(!ol.length||ol[ol.length-1]!==o)){var N="deltaY"in S?b4(S):_h(S),C=t.current.filter(function(E){return E.name===S.type&&(E.target===S.target||S.target===E.shadowParent)&&mie(E.delta,N)})[0];if(C&&C.should){S.cancelable&&S.preventDefault();return}if(!C){var k=(c.current.shards||[]).map(w4).filter(Boolean).filter(function(E){return E.contains(S.target)}),_=k.length>0?u(S,k[0]):!c.current.noIsolation;_&&S.cancelable&&S.preventDefault()}}},[]),h=R.useCallback(function(w,S,N,C){var k={name:w,delta:S,target:N,should:C,shadowParent:yie(N)};t.current.push(k),setTimeout(function(){t.current=t.current.filter(function(_){return _!==k})},1)},[]),p=R.useCallback(function(w){n.current=_h(w),s.current=void 0},[]),g=R.useCallback(function(w){h(w.type,b4(w),w.target,u(w,e.lockRef.current))},[]),x=R.useCallback(function(w){h(w.type,_h(w),w.target,u(w,e.lockRef.current))},[]);R.useEffect(function(){return ol.push(o),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:x}),document.addEventListener("wheel",f,al),document.addEventListener("touchmove",f,al),document.addEventListener("touchstart",p,al),function(){ol=ol.filter(function(w){return w!==o}),document.removeEventListener("wheel",f,al),document.removeEventListener("touchmove",f,al),document.removeEventListener("touchstart",p,al)}},[]);var v=e.removeScrollBar,b=e.inert;return R.createElement(R.Fragment,null,b?R.createElement(o,{styles:gie(r)}):null,v?R.createElement(oie,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function yie(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const bie=Yre(o$,vie);var f$=R.forwardRef(function(e,t){return R.createElement(wm,Ks({},e,{ref:t,sideCar:bie}))});f$.classNames=wm.classNames;var wie=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},ll=new WeakMap,Ch=new WeakMap,kh={},Y1=0,h$=function(e){return e&&(e.host||h$(e.parentNode))},Sie=function(e,t){return t.map(function(n){if(e.contains(n))return n;var s=h$(n);return s&&e.contains(s)?s:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},jie=function(e,t,n,s){var r=Sie(t,Array.isArray(e)?e:[e]);kh[n]||(kh[n]=new WeakMap);var o=kh[n],c=[],u=new Set,f=new Set(r),h=function(g){!g||u.has(g)||(u.add(g),h(g.parentNode))};r.forEach(h);var p=function(g){!g||f.has(g)||Array.prototype.forEach.call(g.children,function(x){if(u.has(x))p(x);else try{var v=x.getAttribute(s),b=v!==null&&v!=="false",w=(ll.get(x)||0)+1,S=(o.get(x)||0)+1;ll.set(x,w),o.set(x,S),c.push(x),w===1&&b&&Ch.set(x,!0),S===1&&x.setAttribute(n,"true"),b||x.setAttribute(s,"true")}catch(N){console.error("aria-hidden: cannot operate on ",x,N)}})};return p(t),u.clear(),Y1++,function(){c.forEach(function(g){var x=ll.get(g)-1,v=o.get(g)-1;ll.set(g,x),o.set(g,v),x||(Ch.has(g)||g.removeAttribute(s),Ch.delete(g)),v||g.removeAttribute(n)}),Y1--,Y1||(ll=new WeakMap,ll=new WeakMap,Ch=new WeakMap,kh={})}},Nie=function(e,t,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),r=wie(e);return r?(s.push.apply(s,Array.from(r.querySelectorAll("[aria-live], script"))),jie(s,r,n,"aria-hidden")):function(){return null}},Sm="Dialog",[p$]=rre(Sm),[_ie,Os]=p$(Sm),m$=e=>{const{__scopeDialog:t,children:n,open:s,defaultOpen:r,onOpenChange:o,modal:c=!0}=e,u=R.useRef(null),f=R.useRef(null),[h,p]=cre({prop:s,defaultProp:r??!1,onChange:o,caller:Sm});return a.jsx(_ie,{scope:t,triggerRef:u,contentRef:f,contentId:B1(),titleId:B1(),descriptionId:B1(),open:h,onOpenChange:p,onOpenToggle:R.useCallback(()=>p(g=>!g),[p]),modal:c,children:n})};m$.displayName=Sm;var g$="DialogTrigger",Cie=R.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Os(g$,n),o=ao(t,r.triggerRef);return a.jsx(Fr.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":t_(r.open),...s,ref:o,onClick:Gi(e.onClick,r.onOpenToggle)})});Cie.displayName=g$;var JN="DialogPortal",[kie,x$]=p$(JN,{forceMount:void 0}),v$=e=>{const{__scopeDialog:t,forceMount:n,children:s,container:r}=e,o=Os(JN,t);return a.jsx(kie,{scope:t,forceMount:n,children:R.Children.map(s,c=>a.jsx(bm,{present:n||o.open,children:a.jsx(r$,{asChild:!0,container:r,children:c})}))})};v$.displayName=JN;var wp="DialogOverlay",y$=R.forwardRef((e,t)=>{const n=x$(wp,e.__scopeDialog),{forceMount:s=n.forceMount,...r}=e,o=Os(wp,e.__scopeDialog);return o.modal?a.jsx(bm,{present:s||o.open,children:a.jsx(Eie,{...r,ref:t})}):null});y$.displayName=wp;var Rie=Zq("DialogOverlay.RemoveScroll"),Eie=R.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Os(wp,n);return a.jsx(f$,{as:Rie,allowPinchZoom:!0,shards:[r.contentRef],children:a.jsx(Fr.div,{"data-state":t_(r.open),...s,ref:t,style:{pointerEvents:"auto",...s.style}})})}),Ja="DialogContent",b$=R.forwardRef((e,t)=>{const n=x$(Ja,e.__scopeDialog),{forceMount:s=n.forceMount,...r}=e,o=Os(Ja,e.__scopeDialog);return a.jsx(bm,{present:s||o.open,children:o.modal?a.jsx(Aie,{...r,ref:t}):a.jsx(Tie,{...r,ref:t})})});b$.displayName=Ja;var Aie=R.forwardRef((e,t)=>{const n=Os(Ja,e.__scopeDialog),s=R.useRef(null),r=ao(t,n.contentRef,s);return R.useEffect(()=>{const o=s.current;if(o)return Nie(o)},[]),a.jsx(w$,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Gi(e.onCloseAutoFocus,o=>{var c;o.preventDefault(),(c=n.triggerRef.current)==null||c.focus()}),onPointerDownOutside:Gi(e.onPointerDownOutside,o=>{const c=o.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0;(c.button===2||u)&&o.preventDefault()}),onFocusOutside:Gi(e.onFocusOutside,o=>o.preventDefault())})}),Tie=R.forwardRef((e,t)=>{const n=Os(Ja,e.__scopeDialog),s=R.useRef(!1),r=R.useRef(!1);return a.jsx(w$,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var c,u;(c=e.onCloseAutoFocus)==null||c.call(e,o),o.defaultPrevented||(s.current||(u=n.triggerRef.current)==null||u.focus(),o.preventDefault()),s.current=!1,r.current=!1},onInteractOutside:o=>{var f,h;(f=e.onInteractOutside)==null||f.call(e,o),o.defaultPrevented||(s.current=!0,o.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const c=o.target;((h=n.triggerRef.current)==null?void 0:h.contains(c))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&r.current&&o.preventDefault()}})}),w$=R.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:r,onCloseAutoFocus:o,...c}=e,u=Os(Ja,n),f=R.useRef(null),h=ao(t,f);return qre(),a.jsxs(a.Fragment,{children:[a.jsx(n$,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:r,onUnmountAutoFocus:o,children:a.jsx(e$,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":t_(u.open),...c,ref:h,onDismiss:()=>u.onOpenChange(!1)})}),a.jsxs(a.Fragment,{children:[a.jsx(Mie,{titleId:u.titleId}),a.jsx(Oie,{contentRef:f,descriptionId:u.descriptionId})]})]})}),e_="DialogTitle",S$=R.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Os(e_,n);return a.jsx(Fr.h2,{id:r.titleId,...s,ref:t})});S$.displayName=e_;var j$="DialogDescription",N$=R.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Os(j$,n);return a.jsx(Fr.p,{id:r.descriptionId,...s,ref:t})});N$.displayName=j$;var _$="DialogClose",C$=R.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Os(_$,n);return a.jsx(Fr.button,{type:"button",...s,ref:t,onClick:Gi(e.onClick,()=>r.onOpenChange(!1))})});C$.displayName=_$;function t_(e){return e?"open":"closed"}var k$="DialogTitleWarning",[Tde,R$]=sre(k$,{contentName:Ja,titleName:e_,docsSlug:"dialog"}),Mie=({titleId:e})=>{const t=R$(k$),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
375
+
376
+ If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
377
+
378
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return R.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Iie="DialogDescriptionWarning",Oie=({contentRef:e,descriptionId:t})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${R$(Iie).contentName}}.`;return R.useEffect(()=>{var o;const r=(o=e.current)==null?void 0:o.getAttribute("aria-describedby");t&&r&&(document.getElementById(t)||console.warn(s))},[s,e,t]),null},Lie=m$,Pie=v$,E$=y$,A$=b$,T$=S$,M$=N$,Die=C$;const I$=Lie,qie=Pie,O$=R.forwardRef(({className:e,...t},n)=>a.jsx(E$,{ref:n,className:he("fixed inset-0 z-50 bg-black/20 backdrop-blur-[8px]",e),...t}));O$.displayName=E$.displayName;const n_=R.forwardRef(({className:e,children:t,hideCloseButton:n,...s},r)=>a.jsxs(qie,{children:[a.jsx(O$,{}),a.jsxs(A$,{ref:r,className:he("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 vellum-heavy p-6 shadow-[0_20px_40px_rgba(46,52,46,0.06)] border border-stone-300",e),...s,children:[t,!n&&a.jsxs(Die,{className:"absolute right-4 top-4 opacity-70 transition-opacity duration-150 hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 focus:ring-offset-background disabled:pointer-events-none",children:[a.jsx(XO,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));n_.displayName=A$.displayName;const s_=({className:e,...t})=>a.jsx("div",{className:he("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});s_.displayName="DialogHeader";const r_=({className:e,...t})=>a.jsx("div",{className:he("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});r_.displayName="DialogFooter";const i_=R.forwardRef(({className:e,...t},n)=>a.jsx(T$,{ref:n,className:he("text-lg font-semibold leading-none tracking-tight",e),...t}));i_.displayName=T$.displayName;const a_=R.forwardRef(({className:e,...t},n)=>a.jsx(M$,{ref:n,className:he("text-sm text-foreground-muted",e),...t}));a_.displayName=M$.displayName;function $ie(e){return Ze({queryKey:["packages",e],queryFn:async()=>{const t=await fetch(`/api/packages/${e}`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()},enabled:!!e})}function zie(e){return Ze({queryKey:["packages",e,"installs"],queryFn:async()=>{const t=await fetch(`/api/packages/${e}/installs`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()},enabled:!!e})}function Bie(e){return Ze({queryKey:["installs",e,"journal"],queryFn:async()=>{const t=await fetch(`/api/packages/installs/${e}/journal`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()},enabled:!!e})}function Fie(e){const t=Wt();return vn({mutationFn:async n=>{const s=await fetch(`/api/packages/${n}/rollback`,{method:"POST"});if(!s.ok)throw new Error(`HTTP ${s.status}`);return s.json()},onSuccess:()=>{t.invalidateQueries({queryKey:["packages",e,"installs"]}),t.invalidateQueries({queryKey:["installs"]})}})}function Hie(e){switch(e){case"applied":return"bg-success";case"rolled_back":return"bg-warning";case"failed":return"bg-destructive";default:return"bg-foreground-muted"}}function Uie(e){switch(e){case"applied":return"APPLIED";case"rolled_back":return"ROLLED BACK";case"failed":return"FAILED";default:return e.toUpperCase()}}function Vie({installId:e}){const{data:t,isPending:n,isError:s}=Bie(e);return n?a.jsx("div",{className:"pl-spacing-6 py-spacing-2 text-label-sm text-foreground-muted",children:"Loading journal..."}):s?a.jsx("div",{className:"pl-spacing-6 py-spacing-2 text-label-sm text-destructive","data-testid":"journal-error",children:"Failed to load journal entries"}):!t||t.length===0?a.jsx("div",{className:"pl-spacing-6 py-spacing-2 text-label-sm text-foreground-muted",children:"No journal entries"}):a.jsx("div",{className:"pl-spacing-6 py-spacing-2 space-y-spacing-1","data-testid":"journal-entries",children:t.map(r=>a.jsxs("div",{"data-testid":"journal-entry",className:"flex items-center gap-spacing-3 text-label-sm font-mono py-spacing-1 border-b border-foreground/6 last:border-0",children:[a.jsx("span",{className:"text-foreground-muted w-6 text-right",children:r.seq}),a.jsx("span",{className:"uppercase",children:r.action}),a.jsx("span",{className:"text-foreground-muted",children:r.exportType}),a.jsx("span",{className:"text-foreground-muted truncate max-w-[200px]",children:r.targetPath}),a.jsx("span",{className:"text-foreground-muted ml-auto",children:r.status})]},r.id))})}function Gie({install:e,onRollback:t}){const[n,s]=R.useState(!1);return a.jsxs("div",{"data-testid":"install-row",className:"card-dark p-spacing-4 mb-spacing-2",children:[a.jsxs("div",{className:"flex items-center gap-spacing-4",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-spacing-3 mb-spacing-1",children:[a.jsx("span",{className:"font-mono text-label-sm text-foreground-muted",children:e.createdAt}),a.jsx("span",{"data-testid":"install-status-badge",className:he("inline-block px-spacing-2 py-px text-label-sm uppercase",Hie(e.status)),children:Uie(e.status)})]}),a.jsx("div",{className:"text-label-sm font-mono text-foreground-muted-on-dark",children:e.targetRoot}),a.jsxs("div",{className:"flex items-center gap-spacing-3 mt-spacing-1 text-label-sm",children:[a.jsxs("span",{"data-testid":"applied-count",children:[a.jsx("span",{className:"font-mono",children:e.appliedCount})," applied"]}),a.jsx("span",{"data-testid":"deferred-placeholder",className:"text-foreground-muted",children:"— deferred"})]})]}),a.jsxs("div",{className:"flex items-center gap-spacing-2 shrink-0",children:[a.jsx(Ce,{variant:"tactical",size:"sm","data-testid":"expand-btn",onClick:()=>s(!n),children:n?"COLLAPSE":"EXPAND"}),e.status==="applied"&&a.jsx(Ce,{variant:"tactical",size:"sm","data-testid":"rollback-btn",onClick:()=>t(e.id),children:"ROLLBACK"})]})]}),n&&a.jsx(Vie,{installId:e.id})]})}function Kie(){var w;const{packageId:e}=Cn({strict:!1}),{data:t,isPending:n,error:s}=$ie(e),{data:r,isPending:o,error:c}=zie(e),u=Fie(e),[f,h]=R.useState(null),[p,g]=R.useState(!1),x=S=>{h(S),g(!0)},v=()=>{f&&u.mutate(f,{onSuccess:()=>{g(!1),h(null)}})};if(n||o)return a.jsx(it,{children:a.jsxs("div",{"data-testid":"detail-loading",children:[a.jsx("div",{className:"h-8 w-48 shimmer mb-spacing-4"}),a.jsxs("div",{className:"card-dark p-spacing-6 mb-spacing-4",children:[a.jsx("div",{className:"h-6 w-64 shimmer-dark mb-spacing-3"}),a.jsx("div",{className:"h-4 w-full shimmer-dark"})]})]})});if(s)return a.jsx(it,{children:a.jsx("div",{"data-testid":"detail-error",children:a.jsx("p",{className:"text-destructive",children:s.message})})});if(c)return a.jsx(it,{children:a.jsx("div",{"data-testid":"installs-error",children:a.jsx("p",{className:"text-destructive",children:"Failed to load install history"})})});const b=r??[];return a.jsx(it,{children:a.jsxs("div",{children:[t&&a.jsxs("div",{className:"card-dark p-spacing-6 mb-spacing-6","data-testid":"package-header",children:[a.jsxs("div",{className:"flex items-baseline justify-between mb-spacing-2",children:[a.jsxs("h2",{className:"text-headline-lg uppercase",children:[t.name," (Legacy)"]}),a.jsxs("span",{className:"text-label-md font-mono text-foreground-muted-on-dark",children:["v",t.version]})]}),a.jsxs("div",{className:"text-label-sm text-foreground-muted-on-dark mb-spacing-2",children:["SOURCE"," ",a.jsx("span",{className:"font-mono text-foreground-on-dark","data-testid":"package-source",children:t.sourceRef})]}),t.summary&&a.jsx("p",{className:"text-body-sm text-foreground-muted-on-dark",children:t.summary})]}),a.jsx("h3",{className:"text-headline-md uppercase mb-spacing-4",children:"INSTALL HISTORY"}),b.length===0?a.jsx("div",{"data-testid":"empty-installs",className:"text-body-md text-foreground-muted",children:"No installs yet"}):a.jsx("div",{"data-testid":"install-list",children:b.map(S=>a.jsx(Gie,{install:S,onRollback:x},S.id))}),a.jsx(I$,{open:p,onOpenChange:S=>{u.isPending||(g(S),S||u.reset())},children:a.jsxs(n_,{"data-testid":"rollback-dialog",onPointerDownOutside:S=>{u.isPending&&S.preventDefault()},onEscapeKeyDown:S=>{u.isPending&&S.preventDefault()},hideCloseButton:u.isPending,children:[a.jsxs(s_,{children:[a.jsx(i_,{className:"text-headline-md uppercase",children:"CONFIRM ROLLBACK"}),a.jsx(a_,{children:"This will roll back the install and restore previous file states. This action cannot be undone."})]}),u.isError&&a.jsxs("p",{className:"text-destructive text-label-sm","data-testid":"rollback-error",children:["Rollback failed: ",((w=u.error)==null?void 0:w.message)??"Unknown error"]}),a.jsxs(r_,{children:[a.jsx(Ce,{variant:"ghost",onClick:()=>{u.reset(),g(!1)},"data-testid":"rollback-cancel",disabled:u.isPending,children:"CANCEL"}),a.jsx(Ce,{variant:"destructive",onClick:v,"data-testid":"rollback-confirm",disabled:u.isPending,children:u.isPending?"ROLLING BACK...":"ROLLBACK"})]})]})})]})})}function Yie(e){switch(e){case"installed":return"bg-success";case"missing":return"bg-destructive";case"unsupported":return"bg-warning";case"unknown":return"bg-warning";default:return"bg-foreground-muted"}}function Wie(e){switch(e){case"installed":return"OK";case"missing":return"MISSING";case"unsupported":return"MANUAL";case"unknown":return"UNKNOWN";default:return e.toUpperCase()}}function Qie({results:e}){return e.length===0?a.jsx("div",{className:"text-body-sm text-foreground-muted","data-testid":"no-requirements",children:"No requirements declared."}):a.jsx("div",{className:"space-y-spacing-1","data-testid":"requirements-panel",children:e.map(t=>a.jsxs("div",{"data-testid":"requirement-row",className:"flex items-center gap-spacing-3 py-spacing-1 text-label-sm font-mono",children:[a.jsx("span",{"data-testid":"requirement-dot",className:he("w-2 h-2 shrink-0",Yie(t.status))}),a.jsx("span",{"data-testid":"requirement-status",className:"w-16 uppercase",children:Wie(t.status)}),a.jsx("span",{className:"text-foreground-muted w-24",children:t.kind}),a.jsx("span",{children:t.name}),t.detectedPath&&a.jsx("span",{className:"text-foreground-muted ml-auto truncate max-w-[200px]",children:t.detectedPath})]},`${t.kind}:${t.name}`))})}function L$(e,t){var s,r;const n=((s=e.stages)==null?void 0:s.flatMap(o=>{const c=o.detail;if(!c)return[];const u=[];return Array.isArray(c.errors)&&u.push(...c.errors.filter(f=>typeof f=="string")),typeof c.error=="string"&&u.push(c.error),u}))??[];return((r=e.errors)==null?void 0:r.find(o=>typeof o=="string"))??n[0]??e.error??`HTTP ${t}`}function Xie(){return vn({mutationFn:async({sourceRef:e})=>{const t=await fetch("/api/bootstrap/plan",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceRef:e})});if(!t.ok){const n=await t.json().catch(()=>({})),s=new Error(L$(n,t.status));throw s.data=n,s}return t.json()}})}function Zie(){const e=Wt();return vn({mutationFn:async({sourceRef:t,autoApprove:n,approvedActionKeys:s})=>{const r=await fetch("/api/bootstrap/apply",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceRef:t,autoApprove:n,approvedActionKeys:s})}),o=await r.json();if(!r.ok){const c=new Error(L$(o,r.status));throw c.data=o,c}return o},onSuccess:()=>{e.invalidateQueries({queryKey:["rigs","summary"]})}})}const Jie=["ENTER","PLAN","REVIEW","APPLY"],eae=Jie.map((e,t)=>({num:t+1,label:e}));function tae(e){switch(e){case"enter":return 1;case"planning":return 2;case"planned":return 3;case"applying":return 4;case"done":case"error":return 4;default:return 1}}function nae(){const e=Ot(),{bootstrapSourceRef:t,setBootstrapSourceRef:n}=od(),[s,r]=R.useState("enter"),[o,c]=R.useState(()=>t),[u,f]=R.useState(null),[h,p]=R.useState(new Set),[g,x]=R.useState(!1),[v,b]=R.useState(null),w=Xie(),S=Zie();R.useEffect(()=>{n(o)},[n,o]);const N=async()=>{if(o.trim()){r("planning");try{const F=await w.mutateAsync({sourceRef:o.trim()});f(F),p(new Set(F.actionKeys??[])),r("planned")}catch(F){b(F.message),r("error")}}},C=async()=>{r("applying");try{const F=await S.mutateAsync({sourceRef:o.trim(),autoApprove:g,approvedActionKeys:g?void 0:[...h]});f(F),r("done")}catch(F){b(F.message),r("error")}},k=()=>{r("enter"),c(""),f(null),p(new Set),x(!1),b(null),w.reset(),S.reset()},_=u==null?void 0:u.stages.find(F=>F.stage==="probe_requirements"),E=_==null?void 0:_.detail,M=(E==null?void 0:E.results)??[],A=u==null?void 0:u.stages.find(F=>F.stage==="build_install_plan"),O=A==null?void 0:A.detail,L=(O==null?void 0:O.actions)??[],P=(A==null?void 0:A.status)==="blocked",B=L.some(F=>F.classification!=="manual_only"&&F.commandPreview)&&h.size===0&&!g;return a.jsx(it,{children:a.jsxs("div",{"data-testid":"bootstrap-wizard",className:"space-y-8",children:[a.jsx(xn,{eyebrow:"Bootstrap",title:"Bootstrap",description:"Plan environment requirements, approve install actions, then import the rig into a running topology."}),a.jsx(Qq,{"data-testid":"step-indicator",steps:eae,currentStep:tae(s)}),s==="enter"&&a.jsx(hs,{title:"Source",description:"Provide a rig spec or bundle path. Bootstrap will inspect requirements before it imports anything.",children:a.jsxs("div",{"data-testid":"step-enter",children:[a.jsx("label",{className:"text-label-md uppercase block mb-spacing-2",children:"SPEC OR BUNDLE PATH"}),a.jsx(YN,{"data-testid":"spec-input",type:"text",value:o,onChange:F=>c(F.target.value),placeholder:"/path/to/rig.yaml or /path/to/bundle.rigbundle",className:"font-mono text-body-md"}),a.jsxs("p",{className:"text-label-sm text-foreground-muted mt-spacing-1",children:["Accepts .yaml rig specs or .rigbundle archives."," ",a.jsx("span",{role:"link",tabIndex:0,className:"text-primary cursor-pointer","data-testid":"inspect-link",onClick:()=>e({to:"/bundles/inspect"}),onKeyDown:F=>{F.key==="Enter"&&e({to:"/bundles/inspect"})},children:"Inspect a bundle first →"})]}),a.jsx("div",{className:"mt-spacing-4",children:a.jsx(Ce,{variant:"tactical",onClick:N,disabled:!o.trim(),"data-testid":"plan-btn",children:"PLAN"})})]})}),s==="planning"&&a.jsx("div",{"data-testid":"step-planning",className:"text-body-md text-foreground-muted",children:"Planning..."}),s==="planned"&&u&&a.jsx(hs,{title:"Plan Review",description:"Review requirement probe results and approve the install actions that bootstrap should execute.",children:a.jsxs("div",{"data-testid":"step-planned",children:[a.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:"STAGES"}),a.jsx("div",{className:"space-y-spacing-1 mb-spacing-6","data-testid":"stage-list",children:u.stages.map(F=>a.jsxs("div",{className:"flex items-center gap-spacing-3 text-label-sm font-mono","data-testid":"stage-row",children:[a.jsx("span",{className:F.status==="ok"?"text-success":F.status==="blocked"?"text-warning":"text-foreground-muted",children:F.status.toUpperCase()}),a.jsx("span",{children:F.stage})]},F.stage))}),M.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:"REQUIREMENTS"}),a.jsx("div",{className:"mb-spacing-6",children:a.jsx(Qie,{results:M})})]}),L.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:"ACTIONS"}),a.jsx("div",{className:"space-y-spacing-1 mb-spacing-4",children:L.map(F=>a.jsxs("label",{className:"flex items-center gap-spacing-3 text-label-sm font-mono cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:g||h.has(F.key),disabled:g||F.classification==="manual_only",onChange:z=>{const Y=new Set(h);z.target.checked?Y.add(F.key):Y.delete(F.key),p(Y)}}),a.jsx("span",{className:F.classification==="manual_only"?"text-warning":"",children:F.requirementName}),F.commandPreview&&a.jsx("span",{className:"text-foreground-muted",children:F.commandPreview})]},F.key))}),a.jsxs("label",{className:"flex items-center gap-spacing-2 text-label-sm mb-spacing-4",children:[a.jsx("input",{type:"checkbox",checked:g,onChange:F=>x(F.target.checked)}),"Auto-approve all trusted actions"]})]}),P&&a.jsx("div",{className:"text-warning text-label-sm mb-spacing-4","data-testid":"blocked-warning",children:"Manual requirements must be resolved before bootstrap can proceed."}),u.warnings.length>0&&a.jsx("div",{className:"mb-spacing-4",children:u.warnings.map((F,z)=>a.jsx("div",{className:"text-warning text-label-sm",children:F},z))}),a.jsx(Ce,{variant:"tactical",onClick:C,disabled:P||B,title:P?"Manual requirements must be resolved":B?"Select actions to approve":void 0,"data-testid":"apply-btn",children:"APPLY"})]})}),s==="applying"&&u&&a.jsx(hs,{title:"Applying",description:"Bootstrap is executing the approved actions and importing the rig.",children:a.jsxs("div",{"data-testid":"step-applying",children:[a.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:"APPLYING"}),a.jsxs("div",{className:"space-y-spacing-1 mb-spacing-4","data-testid":"applying-checklist",children:[u.stages.map(F=>a.jsxs("div",{className:"flex items-center gap-spacing-3 text-label-sm font-mono",children:[a.jsx("span",{className:"text-foreground-muted",children:"○"}),a.jsx("span",{children:F.stage})]},F.stage)),a.jsxs("div",{className:"flex items-center gap-spacing-3 text-label-sm font-mono",children:[a.jsx("span",{className:"text-foreground-muted",children:"○"}),a.jsx("span",{children:"execute_external_installs"})]}),a.jsxs("div",{className:"flex items-center gap-spacing-3 text-label-sm font-mono",children:[a.jsx("span",{className:"text-foreground-muted",children:"○"}),a.jsx("span",{children:"install_packages"})]}),a.jsxs("div",{className:"flex items-center gap-spacing-3 text-label-sm font-mono",children:[a.jsx("span",{className:"text-foreground-muted",children:"○"}),a.jsx("span",{children:"import_rig"})]})]}),a.jsx("p",{className:"text-body-sm text-foreground-muted",children:"Bootstrapping..."})]})}),s==="done"&&u&&a.jsx(hs,{title:"Result",description:"Bootstrap finished and returned the managed rig identity.",children:a.jsxs("div",{"data-testid":"step-done",children:[a.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:u.status==="completed"?"BOOTSTRAP COMPLETE":"BOOTSTRAP PARTIAL"}),a.jsxs("div",{className:"text-label-sm font-mono space-y-spacing-1 mb-spacing-4",children:[a.jsxs("div",{children:["Status: ",a.jsx("span",{className:u.status==="completed"?"text-success":"text-warning",children:u.status.toUpperCase()})]}),u.rigId&&a.jsxs("div",{"data-testid":"result-rig-id",children:["Rig: ",u.rigId]})]}),u.rigId&&a.jsx(Ce,{variant:"tactical","data-testid":"view-rig-btn",onClick:()=>e({to:"/rigs/$rigId",params:{rigId:u.rigId}}),children:"VIEW RIG"})]})}),s==="error"&&a.jsx(hs,{title:"Bootstrap Error",description:"Bootstrap could not complete. Fix the issue and retry the plan.",children:a.jsxs("div",{"data-testid":"step-error",children:[a.jsx("p",{className:"text-destructive text-body-md mb-spacing-4",children:v}),a.jsx(Ce,{variant:"tactical",onClick:k,"data-testid":"try-again-btn",children:"TRY AGAIN"})]})})]})})}function sae(){const{currentAgentDraft:e,selectedAgentDraft:t,saveAgentDraft:n,rememberAgentDraft:s,clearSelectedAgentDraft:r}=od(),[o,c]=R.useState(()=>(t==null?void 0:t.yaml)??(e==null?void 0:e.yaml)??""),[u,f]=R.useState("idle"),[h,p]=R.useState([]);R.useEffect(()=>{n(o)},[n,o]),R.useEffect(()=>{t&&(c(t.yaml),r())},[r,t]);const g=async()=>{s(o),f("pending"),p([]);try{const x=await fetch("/api/agents/validate",{method:"POST",headers:{"Content-Type":"text/yaml"},body:o}),v=await x.json().catch(()=>({}));if(x.ok&&v.valid){f("valid");return}p(v.errors??["Validation failed"]),f("invalid")}catch{p(["Validation request failed"]),f("error")}};return a.jsx(it,{children:a.jsxs("div",{"data-testid":"agent-spec-validate-flow",className:"space-y-8",children:[a.jsx(xn,{eyebrow:"Agent Spec Validation",title:"VALIDATE AGENT",description:"Check an AgentSpec before you use it in a rig."}),a.jsxs(hs,{title:"Agent YAML",description:"Paste or refine an AgentSpec draft, then validate it against the daemon contract.",children:[a.jsx(WN,{"data-testid":"agent-spec-yaml-input",value:o,onChange:x=>c(x.target.value),placeholder:"Paste agent.yaml here...",rows:16,className:"bg-background font-mono text-body-sm"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:a.jsx(Ce,{variant:"tactical","data-testid":"agent-spec-validate-btn",onClick:g,disabled:!o.trim()||u==="pending",children:u==="pending"?"VALIDATING...":"VALIDATE AGENTSPEC"})}),u==="valid"&&a.jsx(Sn,{className:"mt-spacing-1","data-testid":"agent-spec-valid",children:a.jsx(jn,{className:"text-primary",children:"AgentSpec valid."})}),(u==="invalid"||u==="error")&&a.jsx(Sn,{className:"mt-spacing-1","data-testid":"agent-spec-invalid",children:a.jsx(jn,{children:a.jsx("ul",{className:"list-disc pl-5",children:h.map(x=>a.jsx("li",{children:x},x))})})})]})]})})}async function rae(e,t="draft"){var s;const n=await fetch("/api/specs/review/rig",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({yaml:e,sourceState:t})});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(((s=r.errors)==null?void 0:s.join("; "))??`HTTP ${n.status}`)}return n.json()}async function iae(e,t="draft"){var s;const n=await fetch("/api/specs/review/agent",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({yaml:e,sourceState:t})});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(((s=r.errors)==null?void 0:s.join("; "))??`HTTP ${n.status}`)}return n.json()}function P$(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return t}function aae(e,t="draft"){return Ze({queryKey:["spec-review","rig",e?P$(e):null,t],queryFn:()=>rae(e,t),enabled:!!e})}function oae(e,t="draft"){return Ze({queryKey:["spec-review","agent",e?P$(e):null,t],queryFn:()=>iae(e,t),enabled:!!e})}const lae=160,cae=48,S4=200,uae=100;function dae(e){switch(e){case"claude-code":return"#d4c4a8";case"codex":return"#b8c9d4";case"terminal":return"#c4c4c4";default:return"#e0ddd4"}}function fae(e){const t=new Map,n=[];for(const o of e)o.pod?(t.has(o.pod)||t.set(o.pod,[]),t.get(o.pod).push(o)):n.push(o);const s=[];let r=0;for(const[,o]of t)o.forEach((c,u)=>{s.push({id:c.id,x:u*S4,y:r})}),r+=uae;return n.forEach((o,c)=>{s.push({id:o.id,x:c*S4,y:r})}),s}function hae({graph:e,testId:t}){const n=e??{nodes:[],edges:[]},{nodes:s,edges:r}=R.useMemo(()=>{const o=fae(n.nodes),c=new Map(o.map(h=>[h.id,h])),u=n.nodes.map(h=>{const p=c.get(h.id)??{x:0,y:0};return{id:h.id,type:"default",position:{x:p.x,y:p.y},data:{label:a.jsxs("div",{className:"flex h-full min-w-0 flex-col justify-center gap-1 font-mono leading-tight",children:[a.jsxs("div",{className:"truncate text-[10px] font-bold text-stone-900",children:[h.pod?`${h.pod} / `:"",h.label]}),a.jsx(_n,{runtime:h.runtime,size:"xs",compact:!0,variant:"inline"})]})},style:{backgroundColor:dae(h.runtime),border:"1px solid #8a8577",fontSize:11,fontFamily:"monospace",width:lae,height:cae}}}),f=n.edges.map((h,p)=>({id:`e-${p}`,source:h.source,target:h.target,label:h.kind,labelStyle:{fontSize:9,fontFamily:"monospace"},style:{strokeDasharray:"4 4",stroke:"#8a8577"}}));return{nodes:u,edges:f}},[n]);return a.jsx("div",{"data-testid":t??"spec-topology-preview",className:"w-full h-[400px] bg-stone-50 border border-stone-200",children:a.jsxs(gd,{nodes:s,edges:r,fitView:!0,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,proOptions:{hideAttribution:!0},children:[a.jsx(bN,{gap:20,size:.5,color:"#d4d0c8"}),a.jsx(xd,{showInteractive:!1})]})})}function pae({data:e,children:t,className:n,style:s,testId:r}){const{setSelection:o}=Fp();return a.jsx("button",{type:"button","data-testid":r??"sub-spec-trigger",onClick:()=>o({type:"sub-spec",data:e}),className:n??"text-left",style:s,children:t})}function mae(e){const n=(e.startsWith("local:")?e.slice(6):e).replace(/^(builtin|user|fork):/,""),s=n.startsWith("agents/")?n.slice(7):n,r=s.split("@")[0]??s,o=e.startsWith("fork:")?"fork":e.startsWith("builtin:")?"builtin":"user_file";return{specName:r,source:o}}function o_({review:e,yaml:t,testIdPrefix:n="",yamlTestId:s,showEnvironmentTab:r,onMemberClick:o}){var b,w,S;const c=r&&!!(e!=null&&e.services),u=c?["topology","configuration","environment","yaml"]:["topology","configuration","yaml"],[f,h]=R.useState("topology"),p=(e==null?void 0:e.pods)??[],g=(e==null?void 0:e.nodes)??[],x=(e==null?void 0:e.edges)??[],v=n?`${n}-`:"";return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"flex gap-1 border-b border-stone-200",children:u.map(N=>a.jsx("button",{"data-testid":`${v}tab-${N}`,onClick:()=>h(N),className:`px-3 py-1.5 font-mono text-[10px] uppercase tracking-wider transition-colors ${f===N?"border-b-2 border-stone-900 text-stone-900 font-bold":"text-stone-500 hover:text-stone-700"}`,children:N},N))}),f==="topology"&&e&&a.jsx(hae,{graph:e.graph,testId:`${v}topology-preview`}),f==="configuration"&&e&&a.jsxs("div",{"data-testid":`${v}config-tables`,className:"space-y-4",children:[e.format==="pod_aware"&&p.map(N=>a.jsxs("div",{className:"border border-stone-200 p-3",children:[a.jsx("div",{className:"font-mono text-xs font-bold mb-2",children:N.label??N.id}),a.jsxs("table",{className:"w-full font-mono text-[10px]",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-stone-200 text-stone-500",children:[a.jsx("th",{className:"text-left py-1",children:"Member"}),a.jsx("th",{className:"text-left py-1",children:"Agent Ref"}),a.jsx("th",{className:"text-left py-1",children:"Runtime"}),a.jsx("th",{className:"text-left py-1",children:"Profile"})]})}),a.jsx("tbody",{children:N.members.map(C=>a.jsxs("tr",{className:"border-b border-stone-100",children:[a.jsx("td",{className:"py-1",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{children:C.id}),o&&a.jsx(Ce,{variant:"outline",size:"sm","data-testid":`${v}member-open-agent-${N.id}-${C.id}`,className:"h-6 px-2 font-mono text-[9px] uppercase tracking-[0.12em]",onClick:()=>o(N.id,C),children:"Agent Spec"})]})}),a.jsx("td",{className:"py-1 text-stone-600",children:(()=>{const k=mae(C.agentRef);return a.jsx(pae,{data:{specKind:"agent",specName:k.specName,source:k.source},testId:`${v}member-sub-spec-${N.id}-${C.id}`,className:"text-stone-600 underline decoration-dotted decoration-stone-400 hover:text-stone-900 hover:decoration-stone-700",children:C.agentRef})})()}),a.jsx("td",{className:"py-1",children:a.jsx(_n,{runtime:C.runtime,size:"xs",compact:!0,variant:"inline"})}),a.jsx("td",{className:"py-1 text-stone-500",children:C.profile??"—"})]},C.id))})]})]},N.id)),e.format==="legacy"&&g.length>0&&a.jsxs("div",{className:"border border-stone-200 p-3",children:[a.jsx("div",{className:"font-mono text-xs font-bold mb-2",children:"Nodes"}),a.jsxs("table",{className:"w-full font-mono text-[10px]",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-stone-200 text-stone-500",children:[a.jsx("th",{className:"text-left py-1",children:"ID"}),a.jsx("th",{className:"text-left py-1",children:"Runtime"}),a.jsx("th",{className:"text-left py-1",children:"Role"})]})}),a.jsx("tbody",{children:g.map(N=>a.jsxs("tr",{className:"border-b border-stone-100",children:[a.jsx("td",{className:"py-1",children:N.id}),a.jsx("td",{className:"py-1",children:a.jsx(_n,{runtime:N.runtime,size:"xs",compact:!0,variant:"inline"})}),a.jsx("td",{className:"py-1 text-stone-500",children:N.role??"—"})]},N.id))})]})]}),x.length>0&&a.jsxs("div",{className:"border border-stone-200 p-3",children:[a.jsx("div",{className:"font-mono text-xs font-bold mb-2",children:e.format==="pod_aware"?"Cross-Pod Edges":"Edges"}),a.jsxs("table",{className:"w-full font-mono text-[10px]",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-stone-200 text-stone-500",children:[a.jsx("th",{className:"text-left py-1",children:"From"}),a.jsx("th",{className:"text-left py-1",children:"To"}),a.jsx("th",{className:"text-left py-1",children:"Kind"})]})}),a.jsx("tbody",{children:x.map((N,C)=>a.jsxs("tr",{className:"border-b border-stone-100",children:[a.jsx("td",{className:"py-1",children:N.from}),a.jsx("td",{className:"py-1",children:N.to}),a.jsx("td",{className:"py-1 text-stone-500",children:N.kind})]},C))})]})]})]}),f==="environment"&&c&&(e==null?void 0:e.services)&&a.jsxs("div",{className:"space-y-4","data-testid":`${v}env-details`,children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.16em] text-stone-500",children:"Services"}),(b=e.services.composePreview)==null?void 0:b.services.map(N=>a.jsxs("div",{className:"flex items-center justify-between border border-stone-200 px-3 py-2",children:[a.jsx("span",{className:"font-mono text-[11px] text-stone-800",children:N.name}),N.image&&a.jsx("span",{className:"font-mono text-[9px] text-stone-500",children:N.image})]},N.name))]}),e.services.waitFor.length>0&&a.jsxs("div",{className:"space-y-2",children:[a.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.16em] text-stone-500",children:"Health Gates"}),e.services.waitFor.map((N,C)=>a.jsxs("div",{className:"font-mono text-[10px] text-stone-600 border border-stone-200 px-3 py-2",children:[N.url&&a.jsx("span",{children:N.url}),N.tcp&&a.jsxs("span",{children:["tcp: ",N.tcp]}),N.service&&a.jsxs("span",{children:["service: ",N.service,N.condition?` (${N.condition})`:""]})]},C))]}),e.services.surfaces&&a.jsxs("div",{className:"space-y-2",children:[a.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.16em] text-stone-500",children:"Surfaces"}),(w=e.services.surfaces.urls)==null?void 0:w.map(N=>a.jsxs("div",{className:"flex items-center justify-between border border-stone-200 px-3 py-2",children:[a.jsx("span",{className:"text-[11px] text-stone-800",children:N.name}),a.jsx("span",{className:"font-mono text-[9px] text-stone-500",children:N.url})]},N.name)),(S=e.services.surfaces.commands)==null?void 0:S.map(N=>a.jsxs("div",{className:"flex items-center justify-between border border-stone-200 px-3 py-2",children:[a.jsx("span",{className:"text-[11px] text-stone-800",children:N.name}),a.jsx("span",{className:"font-mono text-[9px] text-stone-500",children:N.command})]},N.name))]})]}),f==="yaml"&&a.jsx(Xq,{title:"YAML Preview",testId:s??`${v}spec-yaml`,children:t})]})}function gae(){const e=Ot(),{selectedRigDraft:t,currentRigDraft:n}=od(),s=t??n,{data:r,isLoading:o,error:c}=aae((s==null?void 0:s.yaml)??null),u=(r==null?void 0:r.pods)??[],f=(r==null?void 0:r.nodes)??[],h=(r==null?void 0:r.edges)??[];return s?a.jsx(it,{children:a.jsxs("div",{"data-testid":"rig-spec-review",className:"space-y-6",children:[a.jsx(xn,{eyebrow:"Rig Spec Review",title:(r==null?void 0:r.name)??s.label,description:(r==null?void 0:r.summary)??"Review the spec structure before import or bootstrap.",actions:a.jsxs(a.Fragment,{children:[a.jsx(Ce,{variant:"outline",size:"sm",onClick:()=>e({to:"/import"}),children:"Open In Import"}),a.jsx(Ce,{variant:"outline",size:"sm",onClick:()=>e({to:"/bootstrap"}),children:"Bootstrap"})]})}),r&&a.jsxs(ho,{children:[a.jsx(nt,{label:"Format",value:r.format==="pod_aware"?"Pod-Aware":"Legacy",testId:"rig-spec-summary-format"}),a.jsx(nt,{label:r.format==="pod_aware"?"Pods":"Nodes",value:r.format==="pod_aware"?u.length:f.length,testId:"rig-spec-summary-pods"}),a.jsx(nt,{label:"Members",value:r.format==="pod_aware"?u.reduce((p,g)=>p+g.members.length,0):f.length,testId:"rig-spec-summary-members"}),a.jsx(nt,{label:"Edges",value:h.length+(r.format==="pod_aware"?u.reduce((p,g)=>{var x;return p+(((x=g.edges)==null?void 0:x.length)??0)},0):0),testId:"rig-spec-summary-edges"})]}),o&&a.jsx("div",{className:"font-mono text-[10px] text-stone-400",children:"Loading review..."}),c&&a.jsx("div",{className:"p-3 bg-red-50 border border-red-200 font-mono text-[10px] text-red-700",children:c.message}),a.jsx(o_,{review:r,yaml:s.yaml,yamlTestId:"rig-spec-yaml"})]})}):a.jsx(it,{children:a.jsxs("div",{"data-testid":"rig-spec-review-empty",className:"space-y-5",children:[a.jsx(xn,{eyebrow:"Rig Spec Review",title:"No RigSpec Selected",description:"Choose a current or recent rig draft from the Library drawer to review it here before you import or bootstrap it."}),a.jsx(Ce,{variant:"outline",size:"sm",onClick:()=>e({to:"/import"}),children:"Open Import"})]})})}function jm({data:e,children:t,className:n,style:s,testId:r}){const{setSelection:o}=Fp();return a.jsx("button",{type:"button","data-testid":r??"file-reference-trigger",onClick:()=>o({type:"file",data:e}),className:n??"text-left",style:s,children:t})}function xae(e,t){if(!e||!t)return null;if(t.startsWith("/"))return t;const s=`${e.replace(/\/[^/]*$/,"")}/${t}`.split("/"),r=[];for(const o of s)if(!(!o||o===".")){if(o===".."){r.pop();continue}r.push(o)}return`/${r.join("/")}`}function j4({label:e,sourcePath:t,testId:n,children:s}){const r=xae(t,e);return r?a.jsx(jm,{data:{path:e,absolutePath:r},testId:n,className:"inline-block text-left",children:s}):a.jsx(a.Fragment,{children:s})}function l_({review:e,yaml:t,testIdPrefix:n="agent",sourcePath:s}){const r=(e==null?void 0:e.profiles)??[],o=(e==null?void 0:e.resources)??{skills:[],guidance:[],hooks:[]},c=(e==null?void 0:e.startup)??{files:[],actions:[]};return a.jsxs(a.Fragment,{children:[r.length>0&&a.jsxs("div",{"data-testid":`${n}-profiles-section`,className:"border border-stone-200 p-3",children:[a.jsx("div",{className:"font-mono text-xs font-bold mb-2",children:"Profiles"}),a.jsx("div",{className:"space-y-1",children:r.map(u=>a.jsxs("div",{className:"font-mono text-[10px] flex justify-between",children:[a.jsx("span",{className:"font-bold",children:u.name}),u.description&&a.jsx("span",{className:"text-stone-500",children:u.description})]},u.name))})]}),a.jsxs("div",{"data-testid":`${n}-resources-section`,className:"border border-stone-200 p-3",children:[a.jsx("div",{className:"font-mono text-xs font-bold mb-2",children:"Resources"}),a.jsxs("div",{className:"space-y-2 font-mono text-[10px]",children:[o.skills.length>0&&a.jsxs("div",{children:[a.jsx("span",{className:"text-stone-500",children:"Skills:"})," ",o.skills.map((u,f)=>a.jsxs("span",{className:"mr-1 mb-0.5 inline-flex items-center gap-1 bg-stone-100 px-1.5 py-0.5",children:[a.jsx(Pe,{tool:"file",size:"xs",decorative:!0}),u]},f))]}),o.guidance.length>0&&a.jsxs("div",{children:[a.jsx("span",{className:"text-stone-500",children:"Guidance:"})," ",o.guidance.map((u,f)=>a.jsx(j4,{label:u,sourcePath:s,testId:`${n}-guidance-file-trigger-${u}`,children:a.jsxs("span",{className:"mr-1 mb-0.5 inline-flex items-center gap-1 bg-stone-100 px-1.5 py-0.5 underline decoration-dotted decoration-stone-400",children:[a.jsx(Pe,{tool:u,size:"xs",decorative:!0}),u]})},`${u}-${f}`))]}),o.hooks.length>0&&a.jsxs("div",{children:[a.jsx("span",{className:"text-stone-500",children:"Hooks:"})," ",o.hooks.join(", ")]})]})]}),(c.files.length>0||c.actions.length>0)&&a.jsxs("div",{"data-testid":`${n}-startup-section`,className:"border border-stone-200 p-3",children:[a.jsx("div",{className:"font-mono text-xs font-bold mb-2",children:"Startup"}),c.files.length>0&&a.jsxs("div",{className:"mb-2",children:[a.jsx("div",{className:"font-mono text-[9px] text-stone-500 uppercase mb-1",children:"Files"}),c.files.map((u,f)=>a.jsxs("div",{className:"font-mono text-[10px]",children:[a.jsx(j4,{label:u.path,sourcePath:s,testId:`${n}-startup-file-trigger-${u.path}`,children:a.jsxs("span",{className:"inline-flex items-center gap-1 underline decoration-dotted decoration-stone-400",children:[a.jsx(Pe,{tool:u.path,size:"xs",decorative:!0}),u.path]})})," ",u.required&&a.jsx("span",{className:"text-red-500 text-[8px]",children:"REQUIRED"})]},f))]}),c.actions.length>0&&a.jsxs("div",{children:[a.jsx("div",{className:"font-mono text-[9px] text-stone-500 uppercase mb-1",children:"Actions"}),c.actions.map((u,f)=>a.jsxs("div",{className:"font-mono text-[10px]",children:[a.jsxs("span",{className:"inline-flex items-center gap-1 text-stone-500",children:[a.jsx(Pe,{tool:u.type.includes("command")?"terminal":u.type,size:"xs",decorative:!0}),u.type,":"]})," ",u.value]},f))]})]}),a.jsx(Xq,{title:"YAML Preview",testId:`${n}-spec-yaml`,children:t})]})}function vae(){const e=Ot(),{selectedAgentDraft:t,currentAgentDraft:n}=od(),s=t??n,{data:r,isLoading:o,error:c}=oae((s==null?void 0:s.yaml)??null);return s?a.jsx(it,{children:a.jsxs("div",{"data-testid":"agent-spec-review",className:"space-y-6",children:[a.jsx(xn,{eyebrow:"Agent Spec Review",title:(r==null?void 0:r.name)??s.label,description:(r==null?void 0:r.description)??"Review the agent spec structure before validation.",actions:a.jsx(Ce,{variant:"outline",size:"sm",onClick:()=>e({to:"/agents/validate"}),children:"Open In Validate"})}),r&&a.jsxs(ho,{children:[a.jsx(nt,{label:"Format",value:"AgentSpec",testId:"agent-spec-summary-format"}),a.jsx(nt,{label:"Version",value:r.version,testId:"agent-spec-summary-version"}),a.jsx(nt,{label:"Profiles",value:(r.profiles??[]).length,testId:"agent-spec-summary-profiles"}),a.jsx(nt,{label:"Skills",value:(r.resources??{skills:[]}).skills.length,testId:"agent-spec-summary-skills"})]}),o&&a.jsx("div",{className:"font-mono text-[10px] text-stone-400",children:"Loading review..."}),c&&a.jsx("div",{className:"p-3 bg-red-50 border border-red-200 font-mono text-[10px] text-red-700",children:c.message}),a.jsx(l_,{review:r,yaml:s.yaml,testIdPrefix:"agent"})]})}):a.jsx(it,{children:a.jsxs("div",{"data-testid":"agent-spec-review-empty",className:"space-y-5",children:[a.jsx(xn,{eyebrow:"Agent Spec Review",title:"No AgentSpec Selected",description:"Choose a current or recent agent draft from the Library drawer to review it here before you validate it."}),a.jsx(Ce,{variant:"outline",size:"sm",onClick:()=>e({to:"/agents/validate"}),children:"Open Validate"})]})})}function yae(){return vn({mutationFn:async({bundlePath:e})=>{const t=await fetch("/api/bundles/inspect",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({bundlePath:e})}),n=await t.json();if(n.error)throw new Error(n.error);if(!t.ok)throw new Error(`HTTP ${t.status}`);return n}})}function bae(){return vn({mutationFn:async({bundlePath:e,plan:t,autoApprove:n,targetRoot:s})=>{const r=await fetch("/api/bundles/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({bundlePath:e,plan:t,autoApprove:n,targetRoot:s})}),o=await r.json();if(!r.ok)throw new Error(o.error??`HTTP ${r.status}`);return o}})}function wae(){var o,c;const[e,t]=R.useState(""),n=yae(),s=()=>{e.trim()&&n.mutate({bundlePath:e.trim()})},r=n.data;return a.jsx(it,{children:a.jsxs("div",{"data-testid":"bundle-inspector",children:[a.jsx("h2",{className:"text-headline-lg uppercase mb-spacing-4",children:"INSPECT BUNDLE"}),a.jsxs("div",{className:"mb-spacing-4",children:[a.jsx("label",{className:"text-label-md uppercase block mb-spacing-2",children:"BUNDLE PATH"}),a.jsx("input",{"data-testid":"bundle-path-input",type:"text",value:e,onChange:u=>t(u.target.value),placeholder:"/path/to/my-rig.rigbundle",className:"w-full bg-transparent border-b border-foreground/20 py-spacing-2 text-body-md font-mono focus:outline-none focus:border-primary"}),a.jsx(Ce,{variant:"tactical",onClick:s,disabled:!e.trim()||n.isPending,className:"mt-spacing-3","data-testid":"inspect-btn",children:n.isPending?"INSPECTING...":"INSPECT"})]}),n.isError&&a.jsx("div",{className:"text-destructive text-body-md mb-spacing-4","data-testid":"inspect-error",children:n.error.message}),r&&a.jsxs("div",{"data-testid":"inspect-result",children:[a.jsxs("div",{className:"card-dark p-spacing-4 mb-spacing-4","data-testid":"manifest-summary",children:[a.jsxs("div",{className:"flex items-center gap-spacing-2 mb-spacing-2",children:[a.jsx("h3",{className:"text-headline-md uppercase",children:r.manifest.name}),a.jsxs("span",{className:"text-label-sm font-mono px-spacing-2 py-px bg-foreground/10","data-testid":"schema-badge",children:["v",r.manifest.schemaVersion??1]})]}),a.jsxs("div",{className:"text-label-sm font-mono text-foreground-muted-on-dark",children:["v",r.manifest.version]}),a.jsxs("div",{className:"text-label-sm font-mono text-foreground-muted-on-dark",children:["Spec: ",r.manifest.rigSpec]}),a.jsxs("div",{className:"mt-spacing-2 flex gap-spacing-3",children:[a.jsxs("span",{className:he("text-label-sm",r.digestValid?"text-success":"text-destructive"),children:["DIGEST: ",r.digestValid?"VALID":"INVALID"]}),a.jsxs("span",{className:he("text-label-sm",r.integrityResult.passed?"text-success":"text-destructive"),"data-testid":"integrity-status",children:["INTEGRITY: ",r.integrityResult.passed?"PASS":"FAIL"]})]})]}),r.manifest.schemaVersion===2&&r.manifest.agents?a.jsxs(a.Fragment,{children:[a.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:"AGENTS"}),a.jsx("div",{className:"space-y-spacing-1 mb-spacing-4","data-testid":"agent-list",children:r.manifest.agents.map(u=>a.jsxs("div",{className:"text-label-sm font-mono","data-testid":"agent-entry",children:[u.name," v",u.version," — ",u.path]},u.name))})]}):a.jsxs(a.Fragment,{children:[a.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:"PACKAGES"}),a.jsx("div",{className:"space-y-spacing-1 mb-spacing-4","data-testid":"package-list",children:(r.manifest.packages??[]).map(u=>a.jsxs("div",{className:"text-label-sm font-mono","data-testid":"package-entry",children:[u.name," v",u.version," — ",u.path]},u.name))})]}),r.integrityResult&&a.jsxs(a.Fragment,{children:[a.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:"FILE INTEGRITY"}),a.jsxs("div",{className:"space-y-spacing-1 mb-spacing-4","data-testid":"file-integrity",children:[Object.keys((r.manifest.packages??r.manifest.agents??[]).length>0?((c=(o=r.manifest)==null?void 0:o.integrity)==null?void 0:c.files)??{}:{}).map(u=>{const f=r.integrityResult.mismatches.includes(u),h=r.integrityResult.missing.includes(u),p=f?"MISMATCH":h?"MISSING":"OK";return a.jsxs("div",{className:"flex items-center gap-spacing-3 text-label-sm font-mono","data-testid":"file-row",children:[a.jsx("span",{className:he("w-2 h-2",p==="OK"?"bg-success":"bg-destructive"),"data-testid":"file-dot"}),a.jsx("span",{children:u}),a.jsx("span",{className:"text-foreground-muted ml-auto",children:p})]},u)}),r.integrityResult.extra.map(u=>a.jsxs("div",{className:"flex items-center gap-spacing-3 text-label-sm font-mono","data-testid":"file-row",children:[a.jsx("span",{className:"w-2 h-2 bg-warning","data-testid":"file-dot"}),a.jsx("span",{children:u}),a.jsx("span",{className:"text-foreground-muted ml-auto",children:"EXTRA"})]},u))]})]}),a.jsx(Ce,{variant:"tactical","data-testid":"install-btn",onClick:()=>window.location.href=`/bundles/install?bundlePath=${encodeURIComponent(e)}`,children:"INSTALL THIS BUNDLE"})]})]})})}function Sae(){const e=Ot(),[t,n]=R.useState("enter"),s=typeof window<"u"?new URLSearchParams(window.location.search):null,[r,o]=R.useState((s==null?void 0:s.get("bundlePath"))??""),[c,u]=R.useState(""),[f,h]=R.useState(null),[p,g]=R.useState(null),x=bae(),v=async()=>{if(r.trim()){n("planning");try{const w=await x.mutateAsync({bundlePath:r.trim(),plan:!0});h(w),n("planned")}catch(w){g(w.message),n("error")}}},b=async()=>{if(c.trim()){n("applying");try{const w=await x.mutateAsync({bundlePath:r.trim(),autoApprove:!0,targetRoot:c.trim()});h(w),n("done")}catch(w){g(w.message),n("error")}}};return a.jsx(it,{children:a.jsxs("div",{"data-testid":"bundle-install-flow",children:[a.jsx("h2",{className:"text-headline-lg uppercase mb-spacing-4",children:"INSTALL BUNDLE"}),t==="enter"&&a.jsxs("div",{"data-testid":"step-enter",children:[a.jsx("label",{className:"text-label-md uppercase block mb-spacing-2",children:"BUNDLE PATH"}),a.jsx("input",{"data-testid":"bundle-input",type:"text",value:r,onChange:w=>o(w.target.value),placeholder:"/path/to/my-rig.rigbundle",className:"w-full bg-transparent border-b border-foreground/20 py-spacing-2 text-body-md font-mono focus:outline-none focus:border-primary mb-spacing-4"}),a.jsx("label",{className:"text-label-md uppercase block mb-spacing-2",children:"TARGET ROOT"}),a.jsx("input",{"data-testid":"target-input",type:"text",value:c,onChange:w=>u(w.target.value),placeholder:"/path/to/target/project",className:"w-full bg-transparent border-b border-foreground/20 py-spacing-2 text-body-md font-mono focus:outline-none focus:border-primary mb-spacing-4"}),a.jsx(Ce,{variant:"tactical",onClick:v,disabled:!r.trim(),"data-testid":"plan-btn",children:"PLAN"})]}),t==="planning"&&a.jsx("div",{"data-testid":"step-planning",className:"text-foreground-muted",children:"Planning..."}),t==="planned"&&f&&a.jsxs("div",{"data-testid":"step-planned",children:[a.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:"PLAN"}),a.jsx("div",{className:"space-y-spacing-1 mb-spacing-4",children:f.stages.map(w=>a.jsxs("div",{className:"text-label-sm font-mono",children:[a.jsx("span",{className:w.status==="ok"?"text-success":"text-foreground-muted",children:w.status.toUpperCase()})," ",w.stage]},w.stage))}),a.jsx(Ce,{variant:"tactical",onClick:b,disabled:!c.trim(),"data-testid":"apply-btn",children:"APPLY"})]}),t==="applying"&&a.jsx("div",{"data-testid":"step-applying",className:"text-foreground-muted",children:"Installing..."}),t==="done"&&f&&a.jsxs("div",{"data-testid":"step-done",children:[a.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:"COMPLETE"}),a.jsxs("div",{className:"text-label-sm font-mono",children:["Status: ",a.jsx("span",{className:"text-success",children:f.status.toUpperCase()}),f.stages.some(w=>{var S;return((S=w.detail)==null?void 0:S.source)==="pod_bundle"})?a.jsx("span",{className:"ml-spacing-2 text-primary","data-testid":"bundle-type-label",children:"Pod-aware bundle"}):a.jsx("span",{className:"ml-spacing-2 text-foreground-muted","data-testid":"bundle-type-label",children:"Legacy bundle"})]}),f.rigId&&a.jsxs("div",{className:"text-label-sm font-mono","data-testid":"result-rig-id",children:["Rig: ",f.rigId]}),f.rigId&&a.jsx(Ce,{variant:"tactical",className:"mt-spacing-3",onClick:()=>e({to:"/rigs/$rigId",params:{rigId:f.rigId}}),children:"VIEW RIG"})]}),t==="error"&&a.jsxs("div",{"data-testid":"step-error",children:[a.jsx("p",{className:"text-destructive text-body-md mb-spacing-4",children:p}),a.jsx(Ce,{variant:"tactical",onClick:()=>{n("enter"),g(null),x.reset()},"data-testid":"try-again-btn",children:"TRY AGAIN"})]})]})})}async function jae(){const e=await fetch("/api/mission-control/destinations");if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}function D$(e){return Ze({queryKey:["mission-control","destinations"],queryFn:jae,enabled:e,staleTime:3e4})}function Nae(e){const t=[`Install and launch the "${e.name}" managed app using OpenRig.`,""];return e.summary&&t.push(`About: ${e.summary}`,""),t.push(`Source: ${e.sourcePath}`,"","Steps:",`1. Run: rig up ${e.name}`,"2. Monitor: rig ps --nodes","3. Check env: rig env status <rig-name>"),t.join(`
379
+ `)}function c_({sourcePath:e,sourceState:t}){return a.jsxs("div",{className:"font-mono text-[9px] text-stone-500","data-testid":"library-provenance",children:["Source: ",e," · ",t]})}function _ae({review:e}){const t=Ot(),n=e.profiles??[],s=e.resources??{skills:[]};return a.jsx(it,{children:a.jsxs("div",{"data-testid":"library-review-agent",className:"space-y-6",children:[a.jsx(xn,{eyebrow:"Library — Agent Spec",title:e.name,description:e.description??"Agent spec from library.",actions:a.jsx(Ce,{variant:"outline",size:"sm",onClick:()=>t({to:"/agents/validate"}),children:"Validate"})}),a.jsx(c_,{sourcePath:e.sourcePath,sourceState:e.sourceState}),a.jsxs(ho,{children:[a.jsx(nt,{label:"Format",value:"AgentSpec",testId:"lib-agent-format"}),a.jsx(nt,{label:"Version",value:e.version,testId:"lib-agent-version"}),a.jsx(nt,{label:"Profiles",value:n.length,testId:"lib-agent-profiles"}),a.jsx(nt,{label:"Skills",value:s.skills.length,testId:"lib-agent-skills"})]}),a.jsx(l_,{review:e,yaml:e.raw,testIdPrefix:"lib-agent",sourcePath:e.sourcePath})]})})}function Cae({review:e}){const t=Ot(),[n,s]=R.useState(!1),{data:r=[]}=Wl("agent");new Map(r.map(h=>[h.name,h]));const o=e.pods??[],c=e.nodes??[],u=e.edges??[],f=h=>{if(!h.startsWith("local:"))return null;const p=h.slice(6),x=`${e.sourcePath.replace(/\/[^/]+$/,"")}/${p}`.split("/"),v=[];for(const w of x)w===".."?v.pop():w!=="."&&w!==""&&v.push(w);const b="/"+v.join("/");return r.find(w=>w.sourcePath.startsWith(b+"/"))??null};return a.jsx(it,{children:a.jsxs("div",{"data-testid":"library-review-rig",className:"space-y-6",children:[a.jsx(xn,{eyebrow:e.services?"Library — Managed App":"Library — Rig Spec",title:e.name,description:e.summary??"Rig spec from library.",actions:a.jsxs("div",{className:"flex gap-2",children:[e.services&&a.jsx(Ce,{variant:"outline",size:"sm","data-testid":"copy-setup-prompt",onClick:()=>void(async()=>{await Dr(Nae({name:e.name,summary:e.summary,sourcePath:e.sourcePath}))&&(s(!0),window.setTimeout(()=>s(!1),2e3))})(),children:n?"Copied":"Copy Setup Prompt"}),a.jsx(Ce,{variant:"outline",size:"sm",onClick:()=>t({to:"/import"}),children:"Import"})]})}),a.jsx(c_,{sourcePath:e.sourcePath,sourceState:e.sourceState}),a.jsxs(ho,{children:[a.jsx(nt,{label:"Format",value:e.format==="pod_aware"?"Pod-Aware":"Legacy",testId:"lib-rig-format"}),e.services&&a.jsx(nt,{label:"Type",value:"Agent-Managed App",testId:"lib-rig-type"}),e.services&&o.length>0&&(()=>{const h=o.find(p=>p.members.some(g=>g.id==="specialist"));return h?a.jsx(nt,{label:"Specialist Agent",value:`${h.id}.specialist`,testId:"lib-rig-specialist"}):null})(),a.jsx(nt,{label:e.format==="pod_aware"?"Pods":"Nodes",value:e.format==="pod_aware"?o.length:c.length,testId:"lib-rig-pods"}),a.jsx(nt,{label:"Members",value:e.format==="pod_aware"?o.reduce((h,p)=>h+p.members.length,0):c.length,testId:"lib-rig-members"}),a.jsx(nt,{label:"Edges",value:u.length+(e.format==="pod_aware"?o.reduce((h,p)=>{var g;return h+(((g=p.edges)==null?void 0:g.length)??0)},0):0),testId:"lib-rig-edges"})]}),a.jsx(o_,{review:e,yaml:e.raw,testIdPrefix:"lib",yamlTestId:"lib-rig-yaml",showEnvironmentTab:!!e.services,onMemberClick:(h,p)=>{const g=f(p.agentRef);g&&t({to:"/specs/library/$entryId",params:{entryId:g.id}})}})]})})}function kae({entryId:e}){return e.startsWith("context-pack:")?a.jsx(Lae,{entryId:e}):e.startsWith("agent-image:")?a.jsx(Dae,{entryId:e}):a.jsx(Rae,{entryId:e})}function Rae({entryId:e}){const t=Ot(),{data:n,isLoading:s,error:r}=qj(e);return s?a.jsx(it,{children:a.jsx("div",{className:"font-mono text-[10px] text-stone-400",children:"Loading spec review..."})}):r||!n?a.jsx(it,{children:a.jsxs("div",{"data-testid":"library-review-error",className:"space-y-4",children:[a.jsx(xn,{eyebrow:"Library",title:"Spec Not Found",description:(r==null?void 0:r.message)??"Could not load spec."}),a.jsx(Ce,{variant:"outline",size:"sm",onClick:()=>t({to:"/specs"}),children:"Back to Library"})]})}):n.kind==="agent"?a.jsx(_ae,{review:n}):n.kind==="workflow"?a.jsx(Oae,{review:n}):a.jsx(Cae,{review:n})}const Eae=180,Aae=56,Tae=220,Mae=110;function Iae({topology:e,testId:t}){const{nodes:n,edges:s}=R.useMemo(()=>{const r=new Map;for(const x of e.edges)r.has(x.fromStepId)||r.set(x.fromStepId,[]),r.get(x.fromStepId).push(x.toStepId);const o=new Map,c=[];for(const x of e.nodes)x.isEntry&&(o.set(x.stepId,0),c.push({id:x.stepId,d:0}));for(;c.length>0;){const{id:x,d:v}=c.shift(),b=r.get(x)??[];for(const w of b)o.has(w)||(o.set(w,v+1),c.push({id:w,d:v+1}))}let u=0;for(const x of e.nodes)o.has(x.stepId)||o.set(x.stepId,u++);const f=new Map;for(const x of e.nodes){const v=o.get(x.stepId)??0;f.has(v)||f.set(v,[]),f.get(v).push(x.stepId)}const h=new Map;for(const[x,v]of f)v.forEach((b,w)=>{h.set(b,{x:w*Tae,y:x*Mae})});const p=e.nodes.map(x=>{const v=h.get(x.stepId)??{x:0,y:0},b=x.isEntry?"#a8c8d4":x.isTerminal?"#d4b8a8":"#d4c4a8";return{id:x.stepId,type:"default",position:v,data:{label:a.jsxs("div",{className:"font-mono text-[10px] leading-tight",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2 font-bold",children:[a.jsx("span",{children:x.stepId}),x.isTerminal?a.jsx(Pe,{tool:"terminal",size:"xs",title:"Terminal step",decorative:!0}):null]}),a.jsx("div",{className:"text-stone-600",children:x.role}),x.preferredTarget&&a.jsxs("div",{className:"text-[8px] text-stone-500",children:["→ ",x.preferredTarget]})]})},style:{backgroundColor:b,border:"1px solid #8a8577",fontSize:11,fontFamily:"monospace",width:Eae,height:Aae,padding:6}}}),g=e.edges.map((x,v)=>({id:`e-${v}`,source:x.fromStepId,target:x.toStepId,style:{stroke:"#8a8577"}}));return{nodes:p,edges:g}},[e]);return a.jsx("div",{"data-testid":t??"workflow-topology-graph",className:"w-full h-[400px] bg-stone-50 border border-stone-200",children:a.jsxs(gd,{nodes:n,edges:s,fitView:!0,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,proOptions:{hideAttribution:!0},children:[a.jsx(bN,{gap:20,size:.5,color:"#d4d0c8"}),a.jsx(xd,{showInteractive:!1})]})})}function Oae({review:e}){const t=Ot(),n=Wt(),{data:s}=Z7(),[r,o]=R.useState(null),[c,u]=R.useState(!1),f=(s==null?void 0:s.specName)===e.name&&(s==null?void 0:s.specVersion)===e.version,h=async()=>{u(!0),o(null);try{await J7(e.name,e.version),await n.invalidateQueries({queryKey:["spec-library","active-lens"]}),await n.invalidateQueries({queryKey:["slices"]})}catch(g){o(g.message)}finally{u(!1)}},p=async()=>{u(!0),o(null);try{await eU(),await n.invalidateQueries({queryKey:["spec-library","active-lens"]}),await n.invalidateQueries({queryKey:["slices"]})}catch(g){o(g.message)}finally{u(!1)}};return a.jsx(it,{children:a.jsxs("div",{"data-testid":"library-review-workflow",className:"space-y-6",children:[a.jsx(xn,{eyebrow:e.isBuiltIn?"Library — Workflow (Built-in)":"Library — Workflow",title:`${e.name} v${e.version}`,description:e.purpose??"Workflow spec from library.",actions:a.jsxs("div",{className:"flex gap-2 items-center",children:[f?a.jsx(Ce,{variant:"outline",size:"sm","data-testid":"workflow-deactivate-lens",onClick:()=>void p(),disabled:c,children:c?"...":"Deactivate Lens"}):a.jsx(Ce,{variant:"outline",size:"sm","data-testid":"workflow-activate-lens",onClick:()=>void h(),disabled:c,children:c?"...":"Activate as Lens"}),a.jsx(Ce,{variant:"outline",size:"sm",onClick:()=>t({to:"/specs"}),children:"Back"})]})}),a.jsx(c_,{sourcePath:e.sourcePath,sourceState:"library_item"}),r&&a.jsx("div",{"data-testid":"workflow-lens-error",className:"font-mono text-[10px] text-red-600",children:r}),a.jsxs(ho,{children:[a.jsx(nt,{label:"Format",value:"WorkflowSpec",testId:"lib-wf-format"}),a.jsx(nt,{label:"Version",value:e.version,testId:"lib-wf-version"}),a.jsx(nt,{label:"Roles",value:e.rolesCount,testId:"lib-wf-roles"}),a.jsx(nt,{label:"Steps",value:e.stepsCount,testId:"lib-wf-steps"}),a.jsx(nt,{label:"Target Rig",value:e.targetRig??"(any)",testId:"lib-wf-target-rig"}),a.jsx(nt,{label:"Source",value:e.isBuiltIn?"built-in":"user file",testId:"lib-wf-source"})]}),a.jsxs("div",{"data-testid":"workflow-terminal-rule",className:"flex items-center gap-2 border border-stone-300/40 bg-white/10 px-3 py-2 font-mono text-[10px] text-stone-700",children:[a.jsx(Pe,{tool:"terminal",size:"xs",decorative:!0}),a.jsx("span",{className:"text-stone-500 uppercase tracking-[0.16em] text-[8px]",children:"Coordination Terminal Turn:"}),e.terminalTurnRule]}),a.jsx(Iae,{topology:e.topology}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.16em] text-stone-500",children:"Steps"}),a.jsx("div",{className:"space-y-1",children:e.steps.map(g=>a.jsxs("div",{"data-testid":`workflow-step-${g.stepId}`,className:"border border-stone-300/40 bg-white/5 px-3 py-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"font-mono text-[11px] font-bold text-stone-800",children:g.stepId}),a.jsx("span",{className:"font-mono text-[9px] text-stone-500",children:g.role})]}),g.objective&&a.jsx("div",{className:"mt-1 text-[10px] text-stone-600 leading-tight",children:g.objective}),g.allowedNextSteps.length>0&&a.jsxs("div",{className:"mt-1 font-mono text-[9px] text-stone-500",children:["next: ",g.allowedNextSteps.map(x=>`${x.stepId} (${x.role})`).join(", ")]}),g.allowedExits.length>0&&a.jsxs("div",{className:"font-mono text-[9px] text-stone-400",children:["exits: ",g.allowedExits.join(", ")]})]},g.stepId))})]})]})})}function Lae({entryId:e}){const t=Ot(),{data:n=[],isLoading:s,error:r}=$j(),o=n.find(f=>f.id===e)??null,{data:c,isLoading:u}=sU(o?e:null);return s?a.jsx(it,{children:a.jsx("div",{className:"font-mono text-[10px] text-stone-400",children:"Loading context pack…"})}):r||!o?a.jsx(it,{children:a.jsxs("div",{"data-testid":"library-review-error",className:"space-y-4",children:[a.jsx(xn,{eyebrow:"Library",title:"Context Pack Not Found",description:(r==null?void 0:r.message)??`No context pack with id ${e}.`}),a.jsx(Ce,{variant:"outline",size:"sm",onClick:()=>t({to:"/specs"}),children:"Back to Library"})]})}):a.jsx(Pae,{entry:o,preview:c,previewLoading:u})}function Pae({entry:e,preview:t,previewLoading:n}){var N;const s=Ot(),[r,o]=R.useState(!1),[c,u]=R.useState(""),[f,h]=R.useState(null),[p,g]=R.useState("idle"),x=rU(),{data:v}=D$(r),b=((v==null?void 0:v.destinations)??[]).filter(C=>C.source==="topology"&&C.status==="running").map(C=>C.sessionName).sort(),w=async()=>{if(h(null),!c){h("Pick a destination session first.");return}try{await x.mutateAsync({id:e.id,destinationSession:c,dryRun:!0}),g("dry-run-shown")}catch(C){h(C.message)}},S=async()=>{if(h(null),!c){h("Pick a destination session first.");return}try{await x.mutateAsync({id:e.id,destinationSession:c,dryRun:!1}),g("sent")}catch(C){h(C.message)}};return a.jsx(it,{children:a.jsxs("div",{"data-testid":"library-review-context-pack",className:"space-y-4",children:[a.jsx(xn,{eyebrow:`Library — Context Pack${e.sourceType==="builtin"?" (built-in)":""}`,title:e.name,description:e.purpose??"Operator-authored composable context bundle.",actions:a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Ce,{variant:"outline",size:"sm","data-testid":"context-pack-send-button",onClick:()=>o(C=>!C),children:r?"Hide Send":"Send to seat"}),a.jsx(Ce,{variant:"outline",size:"sm",onClick:()=>s({to:"/specs"}),children:"Back to Library"})]})}),a.jsxs(ho,{children:[a.jsx(nt,{label:"Version",value:e.version,testId:"lib-pack-version"}),a.jsx(nt,{label:"Files",value:e.files.length,testId:"lib-pack-files"}),a.jsx(nt,{label:"Tokens (~)",value:String(e.derivedEstimatedTokens),testId:"lib-pack-tokens"}),a.jsx(nt,{label:"Source",value:e.sourceType,testId:"lib-pack-source"})]}),a.jsxs("div",{"data-testid":"lib-pack-source-path",className:"font-mono text-[9px] text-stone-500",children:["path: ",e.sourcePath]}),a.jsxs("section",{className:"border border-stone-300/40 bg-white/8",children:[a.jsx("header",{className:"border-b border-stone-200 bg-stone-50 px-3 py-2 font-mono text-[10px] uppercase tracking-[0.10em] text-stone-600",children:"Files"}),a.jsx("ul",{"data-testid":"lib-pack-file-list",className:"divide-y divide-stone-100",children:e.files.map(C=>{const k=C.bytes===null;return a.jsx("li",{"data-testid":`lib-pack-file-${C.path}`,"data-missing":k?"true":"false",className:`font-mono text-[10px] ${k?"text-red-700":"text-stone-800"}`,children:a.jsxs(jm,{data:{path:C.path,absolutePath:C.absolutePath},testId:`lib-pack-file-trigger-${C.path}`,className:"block w-full px-3 py-2 text-left hover:bg-stone-100/60 transition-colors",children:[a.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[a.jsx("span",{className:"font-bold truncate underline decoration-dotted decoration-stone-400",children:C.path}),a.jsxs("span",{className:"font-mono text-[8px] text-stone-500 shrink-0",children:["role: ",C.role,k?" · MISSING":` · ${C.bytes}B · ~${C.estimatedTokens} tokens`]})]}),C.summary&&a.jsx("div",{className:"mt-0.5 text-stone-600 text-[9px]",children:C.summary})]})},C.path)})})]}),r&&a.jsxs("section",{"data-testid":"context-pack-send-modal",className:"border border-stone-400 bg-white px-3 py-3 space-y-2",children:[a.jsx("div",{className:"font-mono text-[10px] uppercase tracking-[0.10em] text-stone-700",children:"Send to seat"}),a.jsxs("select",{"data-testid":"context-pack-send-session",className:"w-full font-mono text-[10px] border border-stone-300 px-2 py-1",value:c,onChange:C=>u(C.target.value),children:[a.jsx("option",{value:"",children:"Pick a running session…"}),b.map(C=>a.jsx("option",{value:C,children:C},C))]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Ce,{variant:"outline",size:"sm","data-testid":"context-pack-send-dry-run",onClick:()=>void w(),disabled:x.isPending,children:x.isPending?"…":"Dry run"}),a.jsx(Ce,{size:"sm","data-testid":"context-pack-send-confirm",onClick:()=>void S(),disabled:x.isPending||!c,children:x.isPending?"Sending…":"Send"})]}),f&&a.jsx("div",{"data-testid":"context-pack-send-error",className:"font-mono text-[9px] text-red-600",children:f}),p==="sent"&&a.jsxs("div",{"data-testid":"context-pack-send-success",className:"font-mono text-[9px] text-emerald-700",children:["Sent to ",c,"."]}),p==="dry-run-shown"&&((N=x.data)==null?void 0:N.bundleText)&&a.jsx("pre",{"data-testid":"context-pack-send-bundle-preview",className:"font-mono text-[9px] bg-stone-50 border border-stone-200 px-2 py-1 max-h-64 overflow-y-auto whitespace-pre-wrap",children:x.data.bundleText})]}),a.jsxs("section",{className:"border border-stone-300/40 bg-white/8",children:[a.jsx("header",{className:"border-b border-stone-200 bg-stone-50 px-3 py-2 font-mono text-[10px] uppercase tracking-[0.10em] text-stone-600",children:"Bundle preview"}),n&&a.jsx("div",{className:"px-3 py-2 font-mono text-[9px] text-stone-400",children:"Loading bundle…"}),t&&a.jsxs(a.Fragment,{children:[t.missingFiles.length>0&&a.jsxs("div",{"data-testid":"lib-pack-missing-warning",className:"px-3 py-2 font-mono text-[9px] text-red-700 border-b border-stone-200",children:["Warning: ",t.missingFiles.length," file",t.missingFiles.length===1?"":"s"," referenced by manifest but missing on disk."]}),a.jsx("pre",{"data-testid":"lib-pack-bundle-text",className:"font-mono text-[9px] text-stone-800 bg-stone-50 px-3 py-2 max-h-96 overflow-y-auto whitespace-pre-wrap",children:t.bundleText})]})]})]})})}function Dae({entryId:e}){const t=Ot(),{data:n=[],isLoading:s,error:r}=zj(),o=n.find(f=>f.id===e)??null,{data:c,isLoading:u}=oU(o?e:null);return s?a.jsx(it,{children:a.jsx("div",{className:"font-mono text-[10px] text-stone-400",children:"Loading agent image…"})}):r||!o?a.jsx(it,{children:a.jsxs("div",{"data-testid":"library-review-error",className:"space-y-4",children:[a.jsx(xn,{eyebrow:"Library",title:"Agent Image Not Found",description:(r==null?void 0:r.message)??`No agent image with id ${e}.`}),a.jsx(Ce,{variant:"outline",size:"sm",onClick:()=>t({to:"/specs"}),children:"Back to Library"})]})}):a.jsx(qae,{entry:o,preview:c,previewLoading:u})}function qae({entry:e,preview:t,previewLoading:n}){const s=Ot(),r=lU(),[o,c]=R.useState(!1),[u,f]=R.useState(null),h=async()=>{if(!(t!=null&&t.starterSnippet))return;await Dr(t.starterSnippet)&&(c(!0),window.setTimeout(()=>c(!1),2e3))},p=async()=>{f(null);try{await r.mutateAsync({id:e.id,pin:!e.pinned})}catch(g){f(g.message)}};return a.jsx(it,{children:a.jsxs("div",{"data-testid":"library-review-agent-image",className:"space-y-4",children:[a.jsx(xn,{eyebrow:`Library — Agent Image${e.sourceType==="builtin"?" (built-in)":""}`,title:`${e.name} v${e.version}`,description:e.notes??`Snapshot of ${e.sourceSeat}.`,actions:a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Ce,{variant:"outline",size:"sm","data-testid":"agent-image-pin-toggle",onClick:()=>void p(),disabled:r.isPending,children:e.pinned?"Unpin":"Pin"}),a.jsx(Ce,{variant:"outline",size:"sm",onClick:()=>s({to:"/specs"}),children:"Back to Library"})]})}),a.jsxs(ho,{children:[a.jsx(nt,{label:"Runtime",value:a.jsx(_n,{runtime:e.runtime,size:"sm",compact:!0,variant:"inline"}),testId:"lib-image-runtime"}),a.jsx(nt,{label:"Forks",value:String(e.stats.forkCount),testId:"lib-image-forks"}),a.jsx(nt,{label:"Tokens (~)",value:String(e.derivedEstimatedTokens),testId:"lib-image-tokens"}),a.jsx(nt,{label:"Size",value:`${e.stats.estimatedSizeBytes}B`,testId:"lib-image-size"})]}),a.jsxs("div",{"data-testid":"lib-image-source",className:"font-mono text-[9px] text-stone-500 space-y-0.5",children:[a.jsxs("div",{children:["source seat: ",e.sourceSeat]}),a.jsxs("div",{"data-testid":"lib-image-source-cwd",children:["source cwd: ",e.sourceCwd??"(unknown — pre-Finding-2 manifest)"]}),a.jsxs("div",{children:["created: ",e.createdAt]}),a.jsxs("div",{children:["last used: ",e.stats.lastUsedAt??"never"]}),a.jsxs("div",{children:["path: ",e.sourcePath]}),a.jsxs("div",{"data-testid":"lib-image-pinned",className:e.pinned?"text-amber-700 font-bold":"",children:["pinned: ",String(e.pinned)]})]}),e.lineage.length>0&&a.jsxs("section",{"data-testid":"lib-image-lineage",className:"border border-stone-300/40 bg-white/8",children:[a.jsx("header",{className:"border-b border-stone-200 bg-stone-50 px-3 py-2 font-mono text-[10px] uppercase tracking-[0.10em] text-stone-600",children:"Lineage"}),a.jsxs("div",{className:"px-3 py-2 font-mono text-[10px] text-stone-700",children:[e.lineage.join(" → ")," → ",a.jsx("span",{className:"font-bold",children:e.name})]})]}),a.jsxs("section",{"data-testid":"lib-image-starter-snippet",className:"border border-stone-400 bg-white px-3 py-3 space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("div",{className:"font-mono text-[10px] uppercase tracking-[0.10em] text-stone-700",children:"Use as starter"}),a.jsx(Ce,{variant:"outline",size:"sm","data-testid":"agent-image-copy-snippet",onClick:()=>void h(),disabled:!(t!=null&&t.starterSnippet),children:o?"Copied":"Copy snippet"})]}),a.jsx("div",{className:"font-mono text-[9px] text-stone-500",children:"Paste into your agent.yaml's session_source. The instantiator resolves the image via the daemon AgentImageLibraryService at startup time."}),n&&a.jsx("div",{className:"font-mono text-[9px] text-stone-400",children:"Loading snippet…"}),(t==null?void 0:t.starterSnippet)&&a.jsx("pre",{"data-testid":"lib-image-snippet-text",className:"font-mono text-[10px] bg-stone-50 border border-stone-200 px-2 py-1 whitespace-pre-wrap",children:t.starterSnippet})]}),u&&a.jsx("div",{"data-testid":"lib-image-pin-error",className:"font-mono text-[9px] text-red-600",children:u}),e.files.length>0&&a.jsxs("section",{className:"border border-stone-300/40 bg-white/8",children:[a.jsx("header",{className:"border-b border-stone-200 bg-stone-50 px-3 py-2 font-mono text-[10px] uppercase tracking-[0.10em] text-stone-600",children:"Supplementary files"}),a.jsx("ul",{className:"divide-y divide-stone-100",children:e.files.map(g=>a.jsx("li",{className:"font-mono text-[10px] text-stone-800","data-testid":`lib-image-file-${g.path}`,children:a.jsxs(jm,{data:{path:g.path,absolutePath:g.absolutePath},testId:`lib-image-file-trigger-${g.path}`,className:"block w-full px-3 py-2 text-left hover:bg-stone-100/60 transition-colors",children:[a.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[a.jsx("span",{className:"font-bold truncate underline decoration-dotted decoration-stone-400",children:g.path}),a.jsxs("span",{className:"font-mono text-[8px] text-stone-500 shrink-0",children:["role: ",g.role,g.bytes===null?" · MISSING":` · ${g.bytes}B`]})]}),g.summary&&a.jsx("div",{className:"mt-0.5 text-stone-600 text-[9px]",children:g.summary})]})},g.path))})]})]})})}async function $ae(e,t){const n=await fetch(`/api/rigs/${encodeURIComponent(e)}/nodes/${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`HTTP ${n.status}`);return n.json()}function zae(e,t){return Ze({queryKey:["rig",e,"nodes",t],queryFn:()=>$ae(e,t),enabled:!!e&&!!t,refetchInterval:3e4})}function Bae(e){switch(e){case"resumed":return"text-success";case"rebuilt":return"text-success";case"fresh":return"text-foreground-muted";case"failed":return"text-destructive";case"checkpoint_written":return"text-success";case"fresh_no_checkpoint":return"text-foreground-muted";default:return"text-foreground-muted"}}const Qs="border border-outline-variant bg-white/30 p-3";function Fae(e){switch(e){case"ready":return"text-green-600";case"pending":return"text-amber-600";case"attention_required":return"text-orange-600";case"failed":return"text-red-600";default:return"text-stone-400"}}function Hae(e){switch(e){case"attention_required":return"attention required";default:return e??"stopped"}}function Uae(e){if(!e)return null;const t=e.match(/^local:agents\/([^/]+)$/);return(t==null?void 0:t[1])??null}function Ns({label:e,value:t}){return t==null||t===""?null:a.jsxs("div",{className:"flex justify-between gap-3 font-mono text-[10px]",children:[a.jsx("span",{className:"text-stone-500",children:e}),a.jsx("span",{className:"truncate text-right text-stone-900",children:t})]})}function cl({label:e,children:t,wide:n=!1}){return t==null||t===""?null:a.jsxs("div",{"data-testid":`identity-field-${e.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`,className:`min-w-0 border border-outline-variant/55 bg-white/20 px-2 py-1.5 font-mono ${n?"md:col-span-2 xl:col-span-3":""}`,children:[a.jsx("div",{className:"text-[8px] uppercase tracking-[0.14em] text-stone-400",children:e}),a.jsx("div",{className:"mt-1 min-w-0 truncate text-[11px] text-stone-900",children:t})]})}function Vae({data:e}){const t=Uae(e.agentRef),{data:n=[],isLoading:s}=Wl("agent"),r=t?n.filter(f=>f.name===t):[],o=r.length===1?r[0].id:null,{data:c,isLoading:u}=qj(o);return a.jsxs("div",{"data-testid":"live-agent-spec-section",className:"space-y-4",children:[e.compactSpec.name&&a.jsxs("section",{"data-testid":"detail-compact-spec",className:Qs,children:[a.jsx("div",{className:"mb-2 font-mono text-[8px] uppercase tracking-wider text-stone-400",children:"Resolved Agent Spec"}),a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(Ns,{label:"Spec",value:e.compactSpec.name}),a.jsx(Ns,{label:"Version",value:e.compactSpec.version}),a.jsx(Ns,{label:"Profile",value:e.compactSpec.profile}),a.jsx(Ns,{label:"Skills",value:e.compactSpec.skillCount}),a.jsx(Ns,{label:"Guidance",value:e.compactSpec.guidanceCount})]})]}),t?s||u?a.jsx("div",{className:"p-4 font-mono text-[10px] text-stone-400",children:"Loading agent spec..."}):r.length===0?a.jsx("div",{"data-testid":"agent-spec-unavailable",className:"p-4 font-mono text-[10px] text-stone-400",children:"No agent spec available"}):r.length>1?a.jsxs("div",{"data-testid":"agent-spec-ambiguous",className:"p-4 font-mono text-[10px] text-amber-600",children:["Agent spec ambiguous (",r.length,' matches for "',t,'")']}):!c||c.kind!=="agent"?a.jsx("div",{"data-testid":"agent-spec-unavailable",className:"p-4 font-mono text-[10px] text-stone-400",children:"No agent spec available"}):a.jsx(l_,{review:c,yaml:c.raw,testIdPrefix:"live-agent",sourcePath:c.sourcePath}):a.jsx("div",{"data-testid":"agent-spec-unavailable",className:"p-4 font-mono text-[10px] text-stone-400",children:"No agent spec available"})]})}function Gae({rigId:e,logicalId:t,data:n}){const s=async()=>{n.tmuxAttachCommand&&await Dr(n.tmuxAttachCommand)},r=async()=>{try{await fetch(`/api/rigs/${encodeURIComponent(e)}/nodes/${encodeURIComponent(t)}/open-cmux`,{method:"POST"})}catch{}},o=async()=>{n.resumeCommand&&await Dr(n.resumeCommand)};return a.jsxs("div",{"data-testid":"live-node-actions",className:"flex flex-wrap gap-2",children:[a.jsxs("button",{onClick:r,"data-testid":"detail-cmux-open",className:"inline-flex items-center gap-1.5 px-3 py-1.5 border border-outline-variant bg-white/30 font-mono text-[10px] uppercase tracking-wide text-stone-900 hover:bg-stone-100/60",children:[a.jsx(Pe,{tool:"cmux",size:"sm"}),"Open CMUX"]}),n.tmuxAttachCommand&&a.jsxs("button",{onClick:s,"data-testid":"detail-copy-attach",className:"inline-flex items-center gap-1.5 px-3 py-1.5 border border-outline-variant bg-white/30 font-mono text-[10px] uppercase tracking-wide text-stone-700 hover:bg-stone-100/60",children:[a.jsx(Pe,{tool:"tmux",size:"sm"}),"Copy tmux attach"]}),n.resumeCommand&&a.jsxs("button",{onClick:o,"data-testid":"detail-copy-resume",className:"inline-flex items-center gap-1.5 px-3 py-1.5 border border-outline-variant bg-white/30 font-mono text-[10px] uppercase tracking-wide text-stone-700 hover:bg-stone-100/60",children:[a.jsx(MF,{"aria-hidden":"true",className:"h-4 w-4 shrink-0",strokeWidth:1.5}),"Copy resume command"]})]})}function Kae({data:e}){const t=e.startupStatus==="failed"||e.startupStatus==="attention_required"||!!e.latestError;return a.jsxs("section",{"data-testid":"live-node-status",className:"grid gap-2 border border-outline-variant bg-white/30 p-3 sm:grid-cols-2",children:[a.jsxs("div",{className:"flex items-baseline gap-2",children:[a.jsx("span",{className:"font-mono text-[8px] uppercase tracking-wider text-stone-400",children:"Startup"}),a.jsx("span",{className:Fae(e.startupStatus),"data-testid":"detail-startup-status",children:Hae(e.startupStatus)})]}),a.jsxs("div",{className:"flex items-baseline gap-2",children:[a.jsx("span",{className:"font-mono text-[8px] uppercase tracking-wider text-stone-400",children:"Restore"}),a.jsx("span",{className:`font-mono text-xs font-bold ${Bae(e.restoreOutcome)}`,"data-testid":"detail-restore-outcome",children:e.restoreOutcome})]}),t&&a.jsxs("div",{className:`sm:col-span-2 mt-1 p-2 border ${e.startupStatus==="attention_required"?"bg-orange-50 border-orange-200":"bg-red-50 border-red-200"}`,"data-testid":"detail-failure-banner",children:[a.jsx("div",{className:`font-mono text-[9px] font-bold mb-1 ${e.startupStatus==="attention_required"?"text-orange-700":"text-red-700"}`,children:e.startupStatus==="attention_required"?"Attention Required":e.startupStatus==="failed"?"Startup Failed":"Error"}),e.latestError&&a.jsx("div",{className:`font-mono text-[9px] mb-1 ${e.startupStatus==="attention_required"?"text-orange-700":"text-red-600"}`,children:e.latestError}),a.jsx("div",{className:"font-mono text-[8px] text-stone-500",children:e.startupStatus==="attention_required"?`Use rig capture ${e.canonicalSessionName??"<session>"} to inspect the prompt, then rig send ${e.canonicalSessionName??"<session>"} to clear it.`:e.startupStatus==="failed"?"Check logs with: rig ps --nodes, or restart with: rig up":"Try: rig restore <snapshotId>"}),e.recoveryGuidance&&a.jsxs("div",{className:"mt-2 border-t border-stone-200 pt-2","data-testid":"detail-recovery-guidance",children:[a.jsx("div",{className:"font-mono text-[8px] font-bold text-stone-700 mb-1",children:"Recovery"}),a.jsx("div",{className:"font-mono text-[8px] text-stone-600 mb-1",children:e.recoveryGuidance.summary}),a.jsx("div",{className:"space-y-0.5 mb-1",children:e.recoveryGuidance.commands.map((n,s)=>a.jsx("code",{className:"font-mono text-[8px] text-stone-800 bg-stone-100 px-1 py-0.5 block",children:n},`${n}-${s}`))}),a.jsx("div",{className:"space-y-0.5",children:e.recoveryGuidance.notes.map((n,s)=>a.jsx("div",{className:"font-mono text-[8px] text-stone-500",children:n},`${n}-${s}`))})]})]})]})}function Yae({data:e}){var c;const t=Ij(e.agentActivity),n=Oj(t),s=b7(t),r=Lj(e.agentActivity),o=e.currentQitems??[];return a.jsxs("section",{"data-testid":"live-node-current-state",className:"grid gap-3 border border-outline-variant bg-white/30 p-3 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx("div",{className:"font-mono text-[8px] uppercase tracking-wider text-stone-400",children:"Activity"}),a.jsxs("div",{"data-testid":"live-node-agent-activity",className:`mt-1 font-mono text-[11px] font-bold uppercase ${s}`,children:[n,r?" stale":""]}),((c=e.agentActivity)==null?void 0:c.reason)&&a.jsx("div",{className:"mt-1 font-mono text-[9px] text-stone-500",children:e.agentActivity.reason})]}),a.jsxs("div",{children:[a.jsx("div",{className:"font-mono text-[8px] uppercase tracking-wider text-stone-400",children:"Current Work"}),a.jsx("div",{"data-testid":"live-node-current-qitems",className:"mt-1 space-y-1",children:o.length>0?o.map(u=>a.jsxs("div",{className:"font-mono text-[9px] leading-4 text-stone-700",children:[a.jsx("div",{className:"font-bold text-stone-900",children:u.qitemId}),a.jsx("div",{children:u.bodyExcerpt}),u.tier&&a.jsx("div",{className:"text-[8px] uppercase tracking-wider text-stone-400",children:u.tier})]},u.qitemId)):a.jsx("div",{className:"font-mono text-[9px] text-stone-400",children:"No current qitems"})})]})]})}function Wae({data:e}){return!e.recentEvents||e.recentEvents.length===0?null:a.jsxs("section",{"data-testid":"live-node-recent-events",className:Qs,children:[a.jsx("div",{className:"font-mono text-[8px] uppercase tracking-wider text-stone-400 mb-2",children:"Recent Events"}),a.jsx("div",{className:"space-y-0.5",children:e.recentEvents.slice(0,10).map((t,n)=>a.jsxs("div",{className:"font-mono text-[9px] flex justify-between gap-3",children:[a.jsx("span",{className:"text-stone-700 truncate",children:t.type}),a.jsx("span",{className:"text-stone-400 ml-2 shrink-0",children:t.createdAt})]},`${t.type}-${n}`))})]})}function Qae({data:e}){return a.jsxs("section",{"data-testid":"live-identity-summary",className:Qs,children:[a.jsx("div",{className:"mb-2 font-mono text-[8px] uppercase tracking-wider text-stone-400",children:"Identity"}),a.jsxs("div",{className:"grid gap-2 md:grid-cols-2 xl:grid-cols-3",children:[e.runtime?a.jsx(cl,{label:"Runtime",children:a.jsx(_n,{runtime:e.runtime,model:e.model,size:"xs",compact:!0,variant:"inline",className:"max-w-full"})}):null,a.jsx(cl,{label:"Model",children:e.model}),a.jsx(cl,{label:"Profile",children:e.profile}),a.jsx(cl,{label:"Spec",children:e.resolvedSpecName}),a.jsx(cl,{label:"Version",children:e.resolvedSpecVersion}),a.jsx(cl,{label:"CWD",wide:!0,children:e.cwd})]})]})}function Xae({data:e}){const{outgoing:t,incoming:n}=e.edges;return t.length===0&&n.length===0?null:a.jsxs("section",{"data-testid":"detail-edges",className:Qs,children:[a.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-2",children:"Edges"}),a.jsxs("div",{className:"space-y-0.5 font-mono text-[10px]",children:[t.map((s,r)=>{var o;return a.jsxs("div",{className:"flex gap-1",children:[a.jsx("span",{className:"text-stone-400",children:"->"}),a.jsx("span",{className:"text-stone-500",children:s.kind}),a.jsx("span",{className:"text-stone-900",children:((o=s.to)==null?void 0:o.logicalId)??"?"})]},`out-${r}`)}),n.map((s,r)=>{var o;return a.jsxs("div",{className:"flex gap-1",children:[a.jsx("span",{className:"text-stone-400",children:"<-"}),a.jsx("span",{className:"text-stone-500",children:s.kind}),a.jsx("span",{className:"text-stone-900",children:((o=s.from)==null?void 0:o.logicalId)??"?"})]},`in-${r}`)})]})]})}function Zae({data:e}){return e.peers.length===0?null:a.jsxs("section",{"data-testid":"detail-peers",className:Qs,children:[a.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-2",children:"Peers"}),a.jsx("div",{className:"space-y-1 font-mono text-[10px]",children:e.peers.map(t=>a.jsxs("div",{className:"space-y-0",children:[a.jsxs("div",{className:"flex justify-between gap-3",children:[a.jsx("span",{className:"text-stone-900",children:t.logicalId}),a.jsx("span",{className:"text-stone-500",children:t.runtime??"-"})]}),t.canonicalSessionName&&a.jsx("div",{className:"text-[9px] text-stone-400 truncate",children:t.canonicalSessionName})]},t.logicalId))})]})}function Jae({data:e}){var n,s,r;const t=e.contextUsage;return a.jsxs("section",{"data-testid":"detail-context-usage",className:Qs,children:[a.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-2",children:"Context"}),(t==null?void 0:t.availability)==="known"?a.jsxs("div",{className:"space-y-0.5 font-mono text-[10px]",children:[a.jsx(Ns,{label:"Used",value:t.usedPercentage!=null?`${t.usedPercentage}%`:null}),a.jsx(Ns,{label:"Remaining",value:t.remainingPercentage!=null?`${t.remainingPercentage}%`:null}),a.jsx(Ns,{label:"Window",value:(n=t.contextWindowSize)==null?void 0:n.toLocaleString()}),a.jsx(Ns,{label:"Input tokens",value:(s=t.totalInputTokens)==null?void 0:s.toLocaleString()}),a.jsx(Ns,{label:"Output tokens",value:(r=t.totalOutputTokens)==null?void 0:r.toLocaleString()}),a.jsx(Ns,{label:"Sampled",value:t.sampledAt}),t.fresh===!1&&a.jsx("div",{className:"font-mono text-[9px] text-amber-600 mt-1",children:"Stale sample"})]}):a.jsxs("div",{className:"font-mono text-[10px] text-stone-400",children:["unknown",t!=null&&t.reason?` (${t.reason})`:""]})]})}function eoe({data:e}){return a.jsxs("div",{"data-testid":"live-identity-section",className:"space-y-4",children:[a.jsx(Qae,{data:e}),a.jsx(Yae,{data:e}),a.jsx(Wae,{data:e}),a.jsx(Xae,{data:e}),a.jsx(Zae,{data:e}),a.jsx(Jae,{data:e})]})}function toe({rigId:e,logicalId:t,data:n}){return a.jsxs("div",{"data-testid":"live-startup-section",className:"space-y-4",children:[a.jsx(Kae,{data:n}),n.canonicalSessionName&&a.jsxs("section",{"data-testid":"live-node-preview",className:Qs,children:[a.jsx("div",{className:"font-mono text-[8px] uppercase tracking-wider text-stone-400 mb-2",children:"Preview"}),a.jsx(WL,{rigId:e,rigName:n.rigName,logicalId:t,testIdPrefix:"detail-preview"})]}),n.infrastructureStartupCommand&&a.jsxs("section",{"data-testid":"live-node-infra-startup",className:Qs,children:[a.jsx("div",{className:"font-mono text-[8px] uppercase tracking-wider text-stone-400 mb-2",children:"Startup Command"}),a.jsx("code",{className:"font-mono text-[9px] text-stone-700 bg-stone-100 px-2 py-1 block",children:n.infrastructureStartupCommand})]}),n.startupActions.length>0&&a.jsxs("section",{"data-testid":"live-startup-actions",className:Qs,children:[a.jsx("div",{className:"font-mono text-[8px] uppercase tracking-wider text-stone-400 mb-2",children:"Startup Actions"}),a.jsx("div",{className:"space-y-1",children:n.startupActions.map((s,r)=>a.jsxs("div",{className:"font-mono text-[10px] text-stone-700",children:[a.jsxs("span",{className:"text-stone-500",children:[s.type,":"]})," ",s.value]},`${s.type}-${s.value}-${r}`))})]}),n.startupFiles.length>0?a.jsxs("section",{className:"border border-outline-variant bg-white/30",children:[a.jsx("div",{className:"px-3 py-2 border-b border-outline-variant font-mono text-xs font-bold",children:"Startup Files"}),a.jsx("ul",{className:"divide-y divide-outline-variant",children:n.startupFiles.map((s,r)=>a.jsx("li",{"data-testid":`live-startup-file-${s.path}`,children:a.jsxs(jm,{data:{path:s.path,absolutePath:s.absolutePath},testId:`live-startup-file-trigger-${s.path}`,className:"block w-full px-3 py-2 text-left hover:bg-stone-100/60 transition-colors font-mono text-[10px]",children:[a.jsx("span",{className:"font-bold underline decoration-dotted decoration-stone-400",children:s.path}),a.jsxs("span",{className:"text-stone-400 ml-2",children:["(",s.deliveryHint,")"]}),s.required&&a.jsx("span",{className:"text-red-500 text-[8px] ml-1",children:"REQUIRED"})]})},`${s.path}-${r}`))})]}):a.jsx("div",{className:"font-mono text-[10px] text-stone-400 p-4",children:"No startup files declared"})]})}function noe({data:e}){return e.transcript.enabled?a.jsx("div",{"data-testid":"live-transcript-section",className:"space-y-4",children:a.jsxs("section",{"data-testid":"detail-transcript",className:Qs,children:[a.jsx("div",{className:"font-mono text-xs font-bold mb-2",children:"Transcript"}),a.jsx("div",{className:"font-mono text-[10px] text-stone-700",children:e.transcript.path??"enabled"}),e.transcript.tailCommand&&a.jsx("button",{type:"button",onClick:()=>Dr(e.transcript.tailCommand),className:"mt-2 w-full border border-stone-300 bg-white/40 px-2 py-1 text-left font-mono text-[8px] uppercase text-stone-700 hover:bg-stone-100",children:"Copy tail command"})]})}):a.jsx("div",{"data-testid":"live-transcript-section",className:"font-mono text-[10px] text-stone-400 p-4",children:"Transcript capture not enabled"})}function soe({data:e}){return a.jsx("div",{"data-testid":"live-terminal-section",className:"space-y-4",children:e.canonicalSessionName?a.jsx("div",{"data-testid":"live-terminal-shell",className:"bg-stone-950/65 p-2 text-stone-50 backdrop-blur-sm",children:a.jsx(em,{sessionName:e.canonicalSessionName,lines:80,testIdPrefix:"live-terminal-preview",variant:"compact-terminal"})}):a.jsx("div",{className:"font-mono text-[10px] text-stone-400 p-4",children:"No canonical session name; terminal preview unavailable."})})}function roe({tabs:e,activeTab:t,onSelect:n}){return a.jsx("div",{className:"flex gap-1 border-b border-outline-variant",role:"tablist","data-testid":"live-node-tabs",children:e.map(s=>a.jsx("button",{role:"tab","aria-selected":t===s,"data-testid":`live-tab-${s}`,onClick:()=>n(s),className:`px-3 py-1.5 font-mono text-[10px] uppercase tracking-wider transition-colors ${t===s?"border-b-2 border-stone-900 text-stone-900 font-bold -mb-px":"text-stone-500 hover:text-stone-700"}`,children:s.replace("-"," ")},s))})}function q$({rigId:e,logicalId:t}){const{data:n,isLoading:s,error:r}=zae(e,t),[o,c]=R.useState("identity"),u=n?n.nodeKind!=="infrastructure":!0,f=u?["identity","agent-spec","startup","transcript","terminal"]:["identity","startup","transcript","terminal"];return a.jsx(it,{children:a.jsxs("div",{"data-testid":"live-node-details",className:"space-y-4",children:[a.jsx(xn,{eyebrow:"Live Node Details",title:(n==null?void 0:n.canonicalSessionName)??t,description:`${(n==null?void 0:n.rigName)??e} / ${(n==null?void 0:n.podNamespace)??Ys(t)??bl((n==null?void 0:n.podId)??null)} / ${t}`,actions:n?a.jsx(_n,{runtime:n.runtime,model:n.model,size:"sm",compact:!0,className:"bg-white/40 backdrop-blur-sm"}):null}),s&&a.jsx("div",{className:"font-mono text-[10px] text-stone-400",children:"Loading..."}),r&&a.jsx("div",{className:"p-3 bg-red-50 border border-red-200 font-mono text-[10px] text-red-700",children:r.message}),n&&a.jsxs(a.Fragment,{children:[a.jsx(Gae,{rigId:e,logicalId:t,data:n}),a.jsx(roe,{tabs:f,activeTab:o,onSelect:c}),a.jsxs("div",{"data-testid":"live-node-tab-body",className:"space-y-4",children:[o==="identity"&&a.jsx(eoe,{data:n}),o==="agent-spec"&&u&&a.jsx(Vae,{data:n}),o==="startup"&&a.jsx(toe,{rigId:e,logicalId:t,data:n}),o==="transcript"&&a.jsx(noe,{data:n}),o==="terminal"&&a.jsx(soe,{data:n})]})]})]})})}function ioe(e){return`'${e.replace(/'/g,"'\\''")}'`}function aoe(e){const t=e.tmuxWindow?`${e.tmuxSession}:${e.tmuxWindow}`:e.tmuxSession;return`tmux attach -t ${ioe(t)}`}function N4({label:e,activeLabel:t,onClick:n,testId:s,tool:r}){const[o,c]=R.useState(!1),u=R.useRef(null);R.useEffect(()=>()=>{u.current&&clearTimeout(u.current)},[]);const f=async()=>{await n()&&(c(!0),u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{c(!1),u.current=null},900))};return a.jsxs("button",{type:"button","data-testid":s,"aria-label":e,onClick:()=>{f()},className:he("inline-flex items-center gap-1.5 px-spacing-2 py-1 border font-mono text-[10px] uppercase transition-colors duration-150 ease-tactical",o?"bg-stone-900 text-white border-stone-900":"bg-white text-stone-900 border-stone-300 hover:bg-stone-100"),children:[r?a.jsx(Pe,{tool:r,size:"sm"}):null,a.jsx("span",{children:o?t:e})]})}function ooe({session:e,onAdopt:t}){return a.jsx("div",{"data-testid":"discovered-node",className:he("border-dashed border border-foreground/20 bg-[rgba(255,255,255,0.72)] px-spacing-4 py-spacing-3 mb-spacing-2 shadow-[0_10px_28px_rgba(20,20,20,0.04)] backdrop-blur-sm"),children:a.jsxs("div",{className:"flex flex-col gap-spacing-3 lg:flex-row lg:items-center lg:justify-between",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-x-spacing-3 gap-y-spacing-1",children:[a.jsx("span",{"data-testid":"runtime-badge",children:a.jsx(_n,{runtime:e.runtimeHint,size:"sm",compact:!0})}),a.jsx("div",{"data-testid":"session-name",className:"font-mono text-[13px] leading-5 text-foreground",title:e.tmuxSession,children:e.tmuxSession}),e.confidence==="medium"?a.jsx("div",{"data-testid":"runtime-inferred-note",className:"text-[10px] uppercase tracking-[0.08em] text-foreground-muted",children:"runtime inferred"}):null]}),e.cwd?a.jsxs("div",{className:"mt-spacing-2 min-w-0",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-[0.08em] text-foreground-muted",children:"cwd"}),a.jsx("div",{className:"font-mono text-[12px] leading-5 text-foreground-muted truncate",title:e.cwd,children:e.cwd})]}):null]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-spacing-2 lg:justify-end",children:[a.jsx(N4,{label:"copy tmux",activeLabel:"copied",testId:"copy-tmux-btn",tool:"tmux",onClick:async()=>await Dr(aoe(e))}),e.cwd?a.jsx(N4,{label:"copy cwd",activeLabel:"copied",testId:"copy-cwd-btn",onClick:async()=>await Dr(e.cwd??"")}):null,a.jsx(Ce,{variant:"tactical",size:"sm","data-testid":"adopt-btn",onClick:()=>t(e.id),children:"ADOPT"})]})]})})}function loe(){const[e,t]=R.useState(null),[n,s]=R.useState(!1),r=R.useCallback(async()=>{s(!0);try{const o=await fetch("/api/discovery/draft-rig",{method:"POST"});if(!o.ok){t(`# Error: draft generation failed (HTTP ${o.status})`);return}const c=await o.text();t(c)}catch{t("# Error: failed to reach daemon")}finally{s(!1)}},[]);return a.jsxs("div",{className:"mt-spacing-4 border-t border-foreground/10 pt-spacing-4","data-testid":"generate-draft-section",children:[a.jsx(Ce,{variant:"tactical",onClick:r,disabled:n,"data-testid":"generate-draft-btn",className:"mb-spacing-3",children:n?"GENERATING...":"GENERATE RIG SPEC"}),e&&(()=>{const o=e.split(`
380
+ `),c=o.filter(f=>f.startsWith("# WARNING:")).map(f=>f.replace(/^# WARNING:\s*/,"")),u=o.filter(f=>!f.startsWith("# WARNING:")).join(`
381
+ `).trim();return a.jsxs("div",{className:"relative",children:[c.length>0&&a.jsx("div",{className:"mb-spacing-2 p-spacing-2 bg-warning/10 border border-warning/30 text-label-sm","data-testid":"draft-warnings",children:c.map((f,h)=>a.jsx("div",{className:"text-warning font-mono",children:f},h))}),a.jsx("pre",{className:"bg-surface-low p-spacing-3 text-label-sm font-mono overflow-x-auto max-h-64 border border-foreground/10","data-testid":"draft-yaml",children:u}),a.jsx("button",{onClick:()=>{var f;return(f=navigator.clipboard)==null?void 0:f.writeText(e)},className:"absolute top-2 right-2 text-label-sm text-foreground-muted hover:text-foreground","data-testid":"copy-draft-btn",children:"COPY"})]})})()]})}function coe(){var C,k;const{data:e=[]}=Wj({status:"active",runtimeHint:["claude-code","codex"],minConfidence:"medium"}),t=zL(),{data:n=[]}=Ts(),s=_V(),r=e,[o,c]=R.useState(null),[u,f]=R.useState(!1),[h,p]=R.useState(""),[g,x]=R.useState(""),v=_=>{c(_),f(!0),p(""),x(""),s.reset()},b=()=>{f(!1),c(null)},w=()=>{!o||!h||!g.trim()||s.mutate({discoveredId:o,rigId:h,logicalId:g.trim()},{onSuccess:b})},S=((C=s.error)==null?void 0:C.message)??null,N=s.isPending;return a.jsx(it,{children:a.jsxs("div",{"data-testid":"discovery-overlay",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex flex-col gap-spacing-4 border-b border-foreground/10 pb-spacing-5 sm:flex-row sm:items-end sm:justify-between",children:[a.jsxs("div",{className:"max-w-[620px]",children:[a.jsx("h2",{className:"text-headline-lg uppercase",children:"DISCOVERY"}),a.jsx("p",{className:"mt-spacing-1 text-body-md text-foreground-muted",children:"Running agent sessions currently visible on this machine. Copy a tmux attach command, review the working directory, or adopt the session into a rig."})]}),a.jsx(Ce,{variant:"ghost",size:"sm","data-testid":"scan-now-btn",disabled:t.isPending,onClick:()=>t.mutate(),children:t.isPending?"SCANNING...":"SCAN NOW"})]}),t.isError?a.jsxs("div",{className:"mt-spacing-4 text-label-sm text-destructive","data-testid":"scan-error",children:["Discovery scan failed: ",(k=t.error)==null?void 0:k.message]}):null,r.length===0?a.jsx("div",{className:"py-spacing-8","data-testid":"discovery-empty",children:a.jsx("p",{className:"text-body-md text-foreground-muted",children:"No running Claude or Codex sessions are currently visible."})}):a.jsxs("div",{className:"mt-spacing-6 space-y-spacing-3","data-testid":"discovery-active-section",children:[a.jsxs("div",{className:"mb-spacing-2",children:[a.jsx("h3",{className:"text-headline-sm uppercase",children:"Running agents"}),a.jsxs("p",{className:"text-label-md text-foreground-muted",children:[r.length," session",r.length!==1?"s":""," available to inspect or adopt"]})]}),r.map(_=>a.jsx(ooe,{session:_,onAdopt:v},_.id))]}),a.jsx(loe,{})]}),a.jsx(I$,{open:u,onOpenChange:f,children:a.jsxs(n_,{"data-testid":"adopt-dialog",children:[a.jsxs(s_,{children:[a.jsx(i_,{className:"text-headline-md uppercase",children:"ADOPT SESSION"}),a.jsx(a_,{children:"Bind this session to an existing logical node in the rig."})]}),a.jsxs("div",{className:"space-y-spacing-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-label-sm uppercase block mb-spacing-1",children:"RIG"}),a.jsxs("select",{"data-testid":"adopt-rig-input",value:h,onChange:_=>p(_.target.value),className:"w-full bg-white border-b border-outline py-spacing-1 text-body-md font-mono focus:outline-none focus:border-stone-900 appearance-none cursor-pointer",children:[a.jsx("option",{value:"",children:"Select a rig..."}),n.map(_=>a.jsxs("option",{value:_.id,children:[_.name," (",_.nodeCount," nodes)"]},_.id))]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-label-sm uppercase block mb-spacing-1",children:"LOGICAL ID (required)"}),a.jsx("input",{"data-testid":"adopt-logical-input",type:"text",value:g,onChange:_=>x(_.target.value),className:"w-full bg-transparent border-b border-foreground/20 py-spacing-1 text-body-md font-mono focus:outline-none focus:border-primary"}),a.jsx("p",{className:"mt-spacing-1 text-label-sm text-foreground-muted",children:"Enter the logical ID of an existing node in the target rig. For pod placement, use the Discovery drawer instead."})]})]}),S&&a.jsx("p",{className:"text-destructive text-label-sm","data-testid":"adopt-error",children:S}),a.jsxs(r_,{children:[a.jsx(Ce,{variant:"ghost",onClick:()=>f(!1),children:"CANCEL"}),a.jsx(Ce,{variant:"tactical",onClick:w,disabled:!h||!g.trim()||N,"data-testid":"adopt-confirm",children:N?"ADOPTING...":"ADOPT"})]})]})})]})})}async function uoe(e){const t=new URLSearchParams;e.qitemId&&t.set("qitem_id",e.qitemId),e.actionVerb&&t.set("action_verb",e.actionVerb),e.actorSession&&t.set("actor_session",e.actorSession),e.since&&t.set("since",e.since),e.until&&t.set("until",e.until),e.limit!==void 0&&t.set("limit",String(e.limit)),e.beforeId&&t.set("before_id",e.beforeId);const n=t.toString(),s=`/api/mission-control/audit${n?`?${n}`:""}`,r=await fetch(s);if(!r.ok)throw new Error(`HTTP ${r.status}`);return r.json()}function $$(e){return Ze({queryKey:["mission-control","audit",e],queryFn:()=>uoe(e)})}const doe="openrig.missionControlBearerToken";function foe(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(doe),t=e==null?void 0:e.trim();return t||null}catch{return null}}function hoe(){const e=foe();return e?{Authorization:`Bearer ${e}`}:{}}const z$=["approve","deny","route","annotate","hold","drop","handoff"];async function poe(e){const t=await fetch("/api/mission-control/action",{method:"POST",headers:{"Content-Type":"application/json",...hoe()},body:JSON.stringify(e)}),n=await t.json();if(!t.ok){const s=new Error(typeof n=="object"&&n&&"message"in n?String(n.message):`HTTP ${t.status}`);throw typeof n=="object"&&n&&"error"in n&&(s.code=String(n.error)),s.details=n,s}return n}function moe(){const e=Wt();return vn({mutationFn:poe,onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["mission-control","view"]}),e.invalidateQueries({queryKey:["mission-control","audit"]}),e.invalidateQueries({queryKey:["queue","item",n.qitemId]}),t.createdQitemId&&e.invalidateQueries({queryKey:["queue","item",t.createdQitemId]}),e.invalidateQueries({queryKey:["slices"]})}})}function ji(e){return typeof window>"u"?"":new URL(window.location.href).searchParams.get(e)??""}function goe(){var C,k,_,E;const[e,t]=R.useState(()=>ji("qitem_id")||ji("qitem")),[n,s]=R.useState(()=>ji("action_verb")||ji("verb")),[r,o]=R.useState(()=>ji("actor_session")||ji("actor")),[c,u]=R.useState(()=>ji("since")),[f,h]=R.useState(()=>ji("until")),[p]=R.useState(50),[g,x]=R.useState([]),v={qitemId:e||void 0,actionVerb:n||void 0,actorSession:r||void 0,since:c||void 0,until:f||void 0,limit:p,beforeId:g[g.length-1]},b=$$(v);function w(){x([])}function S(){var M;(M=b.data)!=null&&M.nextBeforeId&&x([...g,b.data.nextBeforeId])}function N(){x(g.slice(0,-1))}return a.jsxs("div",{"data-testid":"mc-view-audit-history",className:"space-y-3 p-3",children:[a.jsxs("header",{className:"space-y-0.5",children:[a.jsx("div",{className:"font-mono text-[10px] uppercase tracking-[0.16em] text-stone-500",children:"audit-history"}),a.jsx("h2",{className:"font-headline text-lg text-stone-900",children:"Audit history"}),a.jsxs("p",{className:"text-xs text-stone-600",children:["Browse ",a.jsx("code",{children:"mission_control_actions"})," by qitem, verb, actor, and time range. Read-only."]})]}),a.jsxs("div",{"data-testid":"mc-audit-filters",className:"grid grid-cols-1 gap-2 border border-stone-200 bg-stone-50 p-2 sm:grid-cols-2",children:[a.jsx("input",{type:"text","data-testid":"mc-audit-filter-qitem-id",placeholder:"qitem_id (exact)",value:e,onChange:M=>t(M.target.value),className:"border border-stone-300 px-2 py-1 font-mono text-xs"}),a.jsxs("select",{"data-testid":"mc-audit-filter-action-verb",value:n,onChange:M=>s(M.target.value),className:"border border-stone-300 px-2 py-1 font-mono text-xs",children:[a.jsx("option",{value:"",children:"all verbs"}),z$.map(M=>a.jsx("option",{value:M,children:M},M))]}),a.jsx("input",{type:"text","data-testid":"mc-audit-filter-actor-session",placeholder:"actor_session (e.g., human-operator@kernel)",value:r,onChange:M=>o(M.target.value),className:"border border-stone-300 px-2 py-1 font-mono text-xs"}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("input",{type:"datetime-local","data-testid":"mc-audit-filter-since",value:c,onChange:M=>u(M.target.value),className:"flex-1 border border-stone-300 px-2 py-1 font-mono text-[11px]",title:"since"}),a.jsx("input",{type:"datetime-local","data-testid":"mc-audit-filter-until",value:f,onChange:M=>h(M.target.value),className:"flex-1 border border-stone-300 px-2 py-1 font-mono text-[11px]",title:"until"})]}),a.jsx("button",{type:"button","data-testid":"mc-audit-filter-apply",onClick:w,className:"border border-stone-700 bg-stone-800 px-2 py-1 font-mono text-[10px] uppercase tracking-[0.12em] text-white",children:"Apply filters"})]}),b.isLoading?a.jsx("div",{"data-testid":"mc-audit-loading",className:"font-mono text-[10px] text-stone-500",children:"loading..."}):b.isError?a.jsxs("div",{"data-testid":"mc-audit-error",className:"font-mono text-[11px] text-red-700",children:["error: ",b.error.message]}):((C=b.data)==null?void 0:C.rows.length)===0?a.jsx("div",{"data-testid":"mc-audit-empty",className:"font-mono text-[11px] text-stone-500",children:"No audit entries match these filters."}):a.jsx("ul",{"data-testid":"mc-audit-rows",className:"space-y-1",children:(k=b.data)==null?void 0:k.rows.map(M=>a.jsxs("li",{"data-testid":"mc-audit-row","data-action-id":M.actionId,className:"border border-stone-200 bg-white p-2 text-[11px]",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx("span",{className:"font-mono uppercase tracking-[0.1em] text-stone-700",children:M.actionVerb}),a.jsx("span",{className:"font-mono text-[10px] text-stone-500",children:M.actedAt})]}),a.jsxs("div",{className:"mt-1 text-stone-700",children:["qitem: ",a.jsx("span",{className:"font-mono",children:M.qitemId??"—"})]}),a.jsxs("div",{className:"text-stone-700",children:["actor: ",a.jsx("span",{className:"font-mono",children:M.actorSession})]}),M.reason?a.jsxs("div",{className:"text-stone-700",children:["reason: ",a.jsx("span",{className:"italic",children:M.reason})]}):null,M.annotation?a.jsxs("div",{className:"text-stone-700",children:["annotation: ",a.jsx("span",{className:"italic",children:M.annotation})]}):null]},M.actionId))}),a.jsxs("footer",{"data-testid":"mc-audit-pagination",className:"flex items-center justify-between font-mono text-[10px] uppercase tracking-[0.12em] text-stone-500",children:[a.jsx("button",{type:"button","data-testid":"mc-audit-prev-page",onClick:N,disabled:g.length===0,className:"border border-stone-300 px-2 py-0.5 disabled:opacity-50",children:"← prev"}),a.jsxs("span",{children:["rows: ",((_=b.data)==null?void 0:_.rows.length)??0]}),a.jsx("button",{type:"button","data-testid":"mc-audit-next-page",onClick:S,disabled:!((E=b.data)!=null&&E.hasMore),className:"border border-stone-300 px-2 py-0.5 disabled:opacity-50",children:"next →"})]})]})}function xoe(){return typeof window>"u"?"openrig @ localhost":`openrig @ ${window.location.hostname||"localhost"}`}function voe(){const{data:e}=Ts(),{data:t}=ad(),n=(e==null?void 0:e.length)??0,s=(e==null?void 0:e.reduce((o,c)=>o+c.nodeCount,0))??0,r=(t==null?void 0:t.reduce((o,c)=>o+c.runningCount,0))??0;return a.jsxs("header",{"data-testid":"dashboard-header",className:"border-b border-outline-variant pb-4 mb-6",children:[a.jsx("div",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-on-surface-variant mb-1",children:xoe()}),a.jsx("h1",{"data-testid":"dashboard-greeting",className:"font-headline text-headline-md font-bold tracking-tight uppercase text-stone-900",children:"Welcome back"}),a.jsxs("div",{"data-testid":"dashboard-stats",className:"font-mono text-xs text-on-surface-variant mt-2",children:[a.jsxs("span",{"data-testid":"stat-rigs",children:[n," rigs"]}),a.jsx("span",{className:"mx-2",children:"·"}),a.jsxs("span",{"data-testid":"stat-agents",children:[s," agents (",r," active)"]})]})]})}const tc="h-full bg-white/40 backdrop-blur-[8px] hover:bg-white/50 hover:hard-shadow-hover";function yoe(){const{data:e}=Ts(),{data:t}=ad(),n=(e==null?void 0:e.length)??0,s=(e==null?void 0:e.reduce((o,c)=>o+c.nodeCount,0))??0,r=(t==null?void 0:t.reduce((o,c)=>o+c.runningCount,0))??0;return a.jsx(Ye,{to:"/topology","data-testid":"dashboard-card-topology",className:"block focus-visible:outline focus-visible:outline-2 focus-visible:outline-stone-900 focus-visible:outline-offset-2",children:a.jsxs(Es,{className:tc,children:[a.jsxs("div",{className:"bg-stone-900 text-white px-4 py-1.5 flex items-center gap-2",children:[a.jsx(Rj,{className:"h-3 w-3"}),a.jsx(rt,{tone:"default",className:"text-stone-50",children:"Topology"})]}),a.jsxs("div",{className:"p-4 space-y-3",children:[a.jsxs("div",{"data-testid":"topology-card-counts",className:"space-y-1.5",children:[a.jsxs("div",{className:"flex justify-between font-mono text-xs",children:[a.jsx("span",{className:"text-on-surface-variant",children:"Rigs"}),a.jsx("span",{className:"text-stone-900 font-bold",children:n})]}),a.jsxs("div",{className:"flex justify-between font-mono text-xs",children:[a.jsx("span",{className:"text-on-surface-variant",children:"Agents"}),a.jsx("span",{className:"text-stone-900 font-bold",children:s})]}),a.jsxs("div",{className:"flex justify-between font-mono text-xs",children:[a.jsx("span",{className:"text-on-surface-variant",children:"Active"}),a.jsx("span",{className:"text-success font-bold",children:r})]})]}),a.jsx("div",{className:"font-mono text-[9px] uppercase tracking-wide text-on-surface-variant pt-1",children:"host · rig · pod · seat tree →"})]})]})})}function boe(){return a.jsx(Ye,{to:"/project","data-testid":"dashboard-card-project",className:"block focus-visible:outline focus-visible:outline-2 focus-visible:outline-stone-900 focus-visible:outline-offset-2",children:a.jsxs(Es,{className:tc,children:[a.jsxs("div",{className:"bg-stone-900 text-white px-4 py-1.5 flex items-center gap-2",children:[a.jsx(kj,{className:"h-3 w-3"}),a.jsx(rt,{tone:"default",className:"text-stone-50",children:"Project"})]}),a.jsxs("div",{className:"p-4 space-y-2",children:[a.jsx("div",{className:"text-sm text-stone-900 font-mono uppercase",children:"Workspace · Mission · Slice"}),a.jsx("div",{className:"text-xs text-on-surface-variant",children:"Browse by what agents are doing."}),a.jsx("div",{className:"font-mono text-[9px] uppercase tracking-wide text-on-surface-variant pt-1",children:"Open project tree →"})]})]})})}function woe(){return a.jsx(Ye,{to:"/for-you","data-testid":"dashboard-card-for-you",className:"block focus-visible:outline focus-visible:outline-2 focus-visible:outline-stone-900 focus-visible:outline-offset-2",children:a.jsxs(Es,{className:tc,accentClass:"border-l-4 border-l-tertiary",children:[a.jsxs("div",{className:"bg-stone-900 text-white px-4 py-1.5 flex items-center gap-2",children:[a.jsx(Aj,{className:"h-3 w-3"}),a.jsx(rt,{tone:"default",className:"text-stone-50",children:"For You"})]}),a.jsxs("div",{className:"p-4 space-y-2",children:[a.jsx("div",{className:"text-sm text-stone-900 font-mono uppercase",children:"Action feed"}),a.jsx("div",{className:"text-xs text-on-surface-variant",children:"What needs you · what shipped · what's in flight."}),a.jsx("div",{className:"font-mono text-[9px] uppercase tracking-wide text-tertiary pt-1",children:"Open feed →"})]})]})})}function Soe(){const{data:e}=Wl(),t=(e==null?void 0:e.length)??0;return a.jsx(Ye,{to:"/specs","data-testid":"dashboard-card-specs",className:"block focus-visible:outline focus-visible:outline-2 focus-visible:outline-stone-900 focus-visible:outline-offset-2",children:a.jsxs(Es,{className:tc,children:[a.jsxs("div",{className:"bg-stone-900 text-white px-4 py-1.5 flex items-center gap-2",children:[a.jsx(YO,{className:"h-3 w-3"}),a.jsx(rt,{tone:"default",className:"text-stone-50",children:"Library"})]}),a.jsxs("div",{className:"p-4 space-y-2",children:[a.jsxs("div",{className:"flex justify-between font-mono text-xs",children:[a.jsx("span",{className:"text-on-surface-variant",children:"Library"}),a.jsx("span",{className:"text-stone-900 font-bold","data-testid":"specs-count",children:t})]}),a.jsx("div",{className:"text-xs text-on-surface-variant",children:"Specs / context packs / agent images / skills"}),a.jsx("div",{className:"font-mono text-[9px] uppercase tracking-wide text-on-surface-variant pt-1",children:"Open Library →"})]})]})})}function joe(){return a.jsx(Ye,{to:"/search","data-testid":"dashboard-card-search",className:"block focus-visible:outline focus-visible:outline-2 focus-visible:outline-stone-900 focus-visible:outline-offset-2",children:a.jsxs(Es,{className:tc,variant:"ghost",elevation:"flat",children:[a.jsxs("div",{className:"border-b border-outline-variant px-4 py-1.5 flex items-center gap-2",children:[a.jsx(dH,{className:"h-3 w-3 text-stone-700"}),a.jsx(rt,{tone:"muted",children:"Search & Audit"})]}),a.jsxs("div",{className:"p-4 space-y-2",children:[a.jsx("div",{className:"text-sm text-stone-900 font-mono uppercase",children:"Audit history"}),a.jsx("div",{className:"text-xs text-on-surface-variant",children:"V1 placeholder · full artifact explorer in V2."}),a.jsx("div",{className:"font-mono text-[9px] uppercase tracking-wide text-on-surface-variant pt-1",children:"Open audit →"})]})]})})}function Noe(){return a.jsx(Ye,{to:"/settings","data-testid":"dashboard-card-settings",className:"block focus-visible:outline focus-visible:outline-2 focus-visible:outline-stone-900 focus-visible:outline-offset-2",children:a.jsxs(Es,{className:tc,variant:"ghost",elevation:"flat",children:[a.jsxs("div",{className:"border-b border-outline-variant px-4 py-1.5 flex items-center gap-2",children:[a.jsx(KO,{className:"h-3 w-3 text-stone-700"}),a.jsx(rt,{tone:"muted",children:"Settings"})]}),a.jsxs("div",{className:"p-4 space-y-2",children:[a.jsx("div",{className:"text-sm text-stone-900 font-mono uppercase",children:"Configuration"}),a.jsx("div",{className:"text-xs text-on-surface-variant",children:"Settings · Log · Status"}),a.jsx("div",{className:"font-mono text-[9px] uppercase tracking-wide text-on-surface-variant pt-1",children:"Open settings →"})]})]})})}function _oe(){return a.jsxs("div",{"data-testid":"dashboard-card-grid",className:"grid gap-4 grid-cols-1 sm:grid-cols-2 lg:grid-cols-3",children:[a.jsx(yoe,{}),a.jsx(boe,{}),a.jsx(woe,{}),a.jsx(Soe,{}),a.jsx(joe,{}),a.jsx(Noe,{})]})}const Coe=["summary","body","detail","message","title","text","description"],koe=new Set(["ts","ts_created","ts_updated","ts_emitted","created_at","updated_at","received_at","stream_sort_key","audit_pointer"]);function sj(e,t=40){return e.length<=t?e:e.slice(0,t-1)+"…"}function Roe(e){if(e==null)return null;if(typeof e=="string"){const t=e.trim();return t.length>0?sj(t):null}return typeof e=="number"||typeof e=="boolean"?String(e):null}function Sp(e){if(!e||typeof e!="object")return"—";const t=e;for(const s of Coe){const r=t[s];if(typeof r=="string"&&r.trim().length>0)return sj(r.trim(),200)}const n=[];for(const[s,r]of Object.entries(t)){if(koe.has(s))continue;const o=Roe(r);if(o!==null&&(n.push(`${s}=${o}`),n.length>=4))break}if(n.length>0)return n.join(" · ");try{const s=JSON.stringify(t);return sj(s,200)}catch{return"—"}}const Eoe=10;function Aoe(){const{events:e}=Pp(),t=e.slice(0,Eoe);return a.jsxs("section",{"data-testid":"dashboard-recent-activity",className:"mt-8",children:[a.jsx(rt,{tone:"muted",children:"Recent activity"}),a.jsx("div",{className:"mt-2 border-t border-outline-variant",children:t.length===0?a.jsx("div",{className:"py-6",children:a.jsx(Xe,{label:"NO ACTIVITY",description:"Activity from rigs in flight will appear here.",variant:"minimal",testId:"recent-activity-empty"})}):a.jsx("ul",{className:"divide-y divide-outline-variant",children:t.map(n=>a.jsxs("li",{"data-testid":"recent-activity-item",className:"py-2 flex items-baseline gap-3 font-mono text-xs",children:[a.jsx("span",{className:"text-on-surface-variant text-[10px] uppercase tracking-wide w-32 shrink-0 truncate",children:n.type}),a.jsx("span",{className:"text-stone-900 truncate",title:Sp(n.payload),children:Sp(n.payload)})]},n.seq))})})]})}function Toe(){return a.jsxs("div",{"data-testid":"dashboard-surface",className:"mx-auto w-full max-w-[960px] px-6 py-8",children:[a.jsx(voe,{}),a.jsx(_oe,{}),a.jsx(Aoe,{})]})}function rj(e){return typeof e=="string"&&e.length>0?e:void 0}function sn(e,...t){for(const n of t){const s=rj(e[n]);if(s)return s}}function Moe(e){if(e)return e.length<=28?e:`${e.slice(0,18)}...${e.slice(-6)}`}function Ioe(e){switch(e){case"queue.created":case"queue.item.created":return"Queue item created";case"queue.updated":case"queue.item.updated":return"Queue item updated";case"queue.handed_off":return"Queue item handed off";case"queue.claimed":return"Queue item claimed";case"queue.unclaimed":return"Queue item unclaimed";case"qitem.fallback_routed":return"Queue item fallback routed";case"qitem.closure_overdue":return"Queue item closure overdue";case"inbox.absorbed":return"Inbox item absorbed";case"inbox.denied":return"Inbox item denied";default:return e}}function Ooe(e){return e==="queue.created"||e==="queue.updated"||e==="queue.claimed"||e==="queue.unclaimed"||e==="queue.handed_off"||e==="queue.item.created"||e==="queue.item.updated"||e==="qitem.fallback_routed"||e==="qitem.closure_overdue"||e==="inbox.absorbed"||e==="inbox.denied"}function Loe(e,t){return e.startsWith("queue.")&&e.endsWith(".closed")?"shipped":e==="qitem.closure_overdue"||e==="inbox.denied"||t==="human-gate"||t==="pending-approval"?"action-required":t==="closeout-pending-ratify"?"approval":t==="done"||t==="closed"||t==="completed"||t==="shipped"?"shipped":"progress"}function Poe(e){const t=sn(e,"sourceSession","source_session","fromSession"),n=sn(e,"destinationSession","destination_session","toSession","destination"),s=t&&n?`${t} -> ${n}`:t?`Source: ${t}`:n?`Destination: ${n}`:void 0,r=[sn(e,"priority")?`priority=${sn(e,"priority")}`:void 0,sn(e,"tier")?`tier=${sn(e,"tier")}`:void 0,sn(e,"state","toState")?`state=${sn(e,"state","toState")}`:void 0,sn(e,"closureReason")?`closure=${sn(e,"closureReason")}`:void 0].filter(o=>!!o);return[s,r.length>0?r.join(" / "):void 0].filter(o=>!!o).join(`
382
+ `)||void 0}function Doe(e){return/^human(?:-[A-Za-z0-9._-]+)?@(kernel|host)$/.test(e??"")}function qoe(e){const t=e.payload??{},n=sn(t,"actor_session","actorSession","source_session","sourceSession","fromSession","sender"),s=sn(t,"rig_id","rigId"),r=sn(t,"summary","body","title"),o={id:`${e.type}-${e.seq}`,title:r??e.type,body:rj(t.body),authorSession:n,rigId:s,receivedAt:e.receivedAt,createdAt:e.createdAt,source:e};if(e.type.startsWith("queue.")&&e.type.endsWith(".closed"))return{...o,kind:"shipped"};if(Ooe(e.type)){const c=sn(t,"qitemId","qitem_id"),u=sn(t,"destinationSession","destination_session","toSession","destination"),f=sn(t,"state","toState"),h=Loe(e.type,f),p=h==="approval"?"approval":Doe(u)?"action-required":h,g=sn(t,"summary","title"),x=p==="shipped"&&e.type==="queue.updated"?"Queue item shipped":Ioe(e.type),v=g??[x,Moe(c)].filter(b=>!!b).join(": ");return{...o,title:v,body:rj(t.body)??Poe(t),kind:p}}return e.type.startsWith("workflow.")?{...o,kind:"progress"}:e.type.startsWith("stream.")||e.type.startsWith("watchdog.")?{...o,kind:"observation"}:e.type.startsWith("lifecycle.")||e.type.startsWith("git.")?{...o,kind:"shipped"}:{...o,kind:"observation"}}function $oe(e){return e.map(qoe).filter(n=>n!==null).sort((n,s)=>s.receivedAt-n.receivedAt)}async function zoe({rigId:e,logicalId:t}){const n=await fetch(`/api/rigs/${encodeURIComponent(e)}/nodes/${encodeURIComponent(t)}/focus`,{method:"POST"});if(!n.ok)throw new Error(`HTTP ${n.status}`);return n.json()}function u_(){return vn({mutationFn:zoe})}function Boe(e){const t=e.indexOf("@");return t===-1?{logicalId:e,rigId:null}:{logicalId:e.slice(0,t),rigId:e.slice(t+1)}}function Foe({authorSession:e,rigId:t,className:n,testId:s}){const r=Boe(e),o=t??r.rigId,c=u_(),u=IL(e);return o?a.jsxs(Ye,{to:"/topology/seat/$rigId/$logicalId",params:{rigId:o,logicalId:encodeURIComponent(r.logicalId)},"data-testid":s??"author-agent-tag",onClick:f=>{f.metaKey||f.ctrlKey||f.shiftKey||f.button!==0||c.mutate({rigId:o,logicalId:r.logicalId})},className:n??"inline-flex items-center gap-1 font-mono text-[10px] text-on-surface-variant hover:text-stone-900 hover:underline",children:[u?a.jsx(ip,{actor:e,size:"xs"}):null,a.jsx("span",{children:e})]}):a.jsxs("span",{"data-testid":s??"author-agent-tag",className:n??"inline-flex items-center gap-1 font-mono text-[10px] text-on-surface-variant",children:[u?a.jsx(ip,{actor:e,size:"xs"}):null,a.jsx("span",{children:e})]})}function Nm({data:e,children:t,className:n,style:s,testId:r}){const{setSelection:o}=Fp();return a.jsx("button",{type:"button","data-testid":r??"queue-item-trigger",onClick:()=>o({type:"qitem",data:e}),className:n??"text-left",style:s,children:t})}const xl={approve:{label:"Approve",outcomeLabel:"Approved",description:"Accept the work and let it close or continue.",tone:"success",icon:Iu},deny:{label:"Deny",outcomeLabel:"Denied",description:"Reject this request and leave a reason if needed.",tone:"danger",icon:gH},route:{label:"Route",outcomeLabel:"Routed",description:"Send this to another session for follow-up.",tone:"info",icon:WO},annotate:{label:"Annotate",outcomeLabel:"Annotated",description:"Add context without changing ownership.",tone:"neutral",icon:zF},hold:{label:"Hold",outcomeLabel:"Held",description:"Pause this item until more context is available.",tone:"warning",icon:aH},drop:{label:"Drop",outcomeLabel:"Dropped",description:"Remove this item from the active path.",tone:"neutral",icon:yH},handoff:{label:"Handoff",outcomeLabel:"Handed off",description:"Transfer active ownership to another session.",tone:"info",icon:Tp}};function Hoe(e,t="action"){const n=xl[e];return{label:t==="outcome"?n.outcomeLabel:n.label,tone:n.tone,icon:n.icon}}const _4={approve:{idle:"border-emerald-300 bg-emerald-50/70 text-emerald-800 hover:bg-emerald-100/80",active:"border-emerald-700 bg-emerald-700 text-white"},deny:{idle:"border-rose-300 bg-rose-50/75 text-rose-800 hover:bg-rose-100/80",active:"border-rose-700 bg-rose-700 text-white"},route:{idle:"border-sky-300 bg-sky-50/75 text-sky-800 hover:bg-sky-100/80",active:"border-sky-700 bg-sky-700 text-white"},annotate:{idle:"border-stone-300 bg-white/55 text-stone-700 hover:bg-stone-100",active:"border-stone-700 bg-stone-700 text-white"},hold:{idle:"border-amber-300 bg-amber-50/80 text-amber-800 hover:bg-amber-100/80",active:"border-amber-700 bg-amber-700 text-white"},drop:{idle:"border-stone-300 bg-white/55 text-stone-700 hover:bg-stone-100",active:"border-stone-700 bg-stone-700 text-white"},handoff:{idle:"border-sky-300 bg-sky-50/75 text-sky-800 hover:bg-sky-100/80",active:"border-sky-700 bg-sky-700 text-white"}};function Uoe({qitemId:e,actorSession:t,enabledVerbs:n=[...z$],onSettled:s}){var P;const r=moe(),[o,c]=R.useState(null),[u,f]=R.useState(""),[h,p]=R.useState(!1),[g,x]=R.useState(""),[v,b]=R.useState(""),w=o==="route"||o==="handoff",S=o==="annotate",N=o==="hold"||o==="drop";function C(){c(null),f(""),p(!1),x(""),b("")}function k(I){c(I),f(""),p(!1),x(""),b("")}function _(){o&&r.mutate({verb:o,qitemId:e,actorSession:t,destinationSession:w?u:void 0,annotation:S?g:void 0,reason:N?v:void 0},{onSettled:()=>{C(),s==null||s()}})}const E=D$(w),M=((P=E.data)==null?void 0:P.destinations)??[],A=w&&E.isLoading,O=w&&(M.length>0||A),L=w&&(h||E.isError||E.isFetched&&M.length===0);return a.jsxs("div",{"data-testid":"mc-verb-actions",className:"space-y-2",children:[a.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2 border border-outline-variant bg-white/40 px-2 py-1.5 backdrop-blur-sm",children:[a.jsxs("div",{children:[a.jsx("div",{className:"font-mono text-[9px] uppercase tracking-[0.12em] text-stone-800",children:"Choose response"}),a.jsx("div",{className:"mt-0.5 font-mono text-[10px] leading-relaxed text-stone-500",children:"Pick the next move for this queue item."})]}),o?a.jsxs("div",{className:"font-mono text-[9px] uppercase tracking-[0.12em] text-stone-500",children:["Selected: ",a.jsx("span",{className:"text-stone-900",children:xl[o].label})]}):null]}),a.jsx("div",{className:"flex flex-wrap gap-1",children:n.map(I=>{const B=xl[I],F=B.icon;return a.jsxs("button",{type:"button","data-testid":`mc-verb-${I}`,onClick:()=>k(I),disabled:r.isPending,title:B.description,className:he("inline-flex items-center gap-1 border px-2 py-1 font-mono text-[9px] uppercase tracking-[0.12em] transition-colors disabled:opacity-50",o===I?_4[I].active:_4[I].idle),children:[a.jsx(F,{className:"h-3 w-3",strokeWidth:1.7}),B.label]},I)})}),o&&a.jsxs("div",{className:"space-y-1 border border-stone-200 bg-stone-50 p-2",children:[a.jsx("div",{"data-testid":"mc-verb-guidance",className:"font-mono text-[10px] leading-relaxed text-stone-600",children:xl[o].description}),w&&a.jsxs("div",{className:"space-y-1",children:[O?a.jsxs("select",{"data-testid":"mc-verb-destination-select","aria-label":"Destination session",value:h?"__manual__":u,disabled:A,onChange:I=>{if(I.target.value==="__manual__"){p(!0),f("");return}p(!1),f(I.target.value)},className:"w-full border border-stone-300 bg-white px-2 py-1 font-mono text-xs",children:[a.jsx("option",{value:"",children:A?"loading destinations...":"choose destination"}),M.map(I=>a.jsx("option",{value:I.sessionName,children:I.label},I.sessionName)),a.jsx("option",{value:"__manual__",children:"manual entry"})]}):null,L?a.jsx("input",{type:"text","data-testid":"mc-verb-destination-input",value:u,onChange:I=>f(I.target.value),placeholder:"destination session (member@rig)",className:"w-full border border-stone-300 px-2 py-1 font-mono text-xs"}):null,E.isError?a.jsx("div",{className:"font-mono text-[10px] text-amber-700",children:"destination list unavailable"}):null]}),S&&a.jsx("textarea",{"data-testid":"mc-verb-annotation-input",value:g,onChange:I=>x(I.target.value),placeholder:"annotation",rows:2,className:"w-full border border-stone-300 px-2 py-1 font-mono text-xs"}),N&&a.jsx("input",{type:"text","data-testid":"mc-verb-reason-input",value:v,onChange:I=>b(I.target.value),placeholder:`${o} reason`,className:"w-full border border-stone-300 px-2 py-1 font-mono text-xs"}),a.jsxs("div",{className:"flex items-center justify-end gap-1",children:[a.jsx("button",{type:"button",onClick:C,"data-testid":"mc-verb-cancel",className:"border border-stone-300 px-2 py-0.5 font-mono text-[9px] uppercase tracking-[0.12em] text-stone-600",children:"Cancel"}),a.jsx("button",{type:"button",onClick:_,"data-testid":"mc-verb-submit",disabled:r.isPending||w&&!u||S&&!g||N&&!v,className:"border border-stone-700 bg-stone-800 px-2 py-0.5 font-mono text-[9px] uppercase tracking-[0.12em] text-white disabled:opacity-50",children:r.isPending?"...":`Confirm ${xl[o].label}`})]}),r.isError?a.jsxs("div",{"data-testid":"mc-verb-error",className:"font-mono text-[10px] text-red-700",children:["error: ",r.error.message]}):null]})]})}function d_({sliceName:e,relPath:t,onClose:n,testId:s="proof-image-viewer",imageTestId:r="proof-image-viewer-image",closeTestId:o="proof-image-viewer-close"}){return t?a.jsx("div",{role:"dialog","aria-label":"Screenshot preview","data-testid":s,className:"fixed bottom-0 right-0 top-14 z-[1000] flex items-center justify-center bg-stone-950/20 p-6 backdrop-blur-[2px] lg:left-[21rem]",onClick:n,children:a.jsxs("div",{className:"max-h-full max-w-[92vw] border border-white/20 bg-stone-950/70 p-2 backdrop-blur-sm",onClick:c=>c.stopPropagation(),children:[a.jsx("img",{src:yu(e,t),alt:t,"data-testid":r,className:"max-h-[78vh] max-w-full object-contain"}),a.jsxs("div",{className:"mt-2 flex items-center justify-between gap-3 font-mono text-[10px] text-stone-50",children:[a.jsx("span",{className:"truncate",children:t}),a.jsx("button",{type:"button","data-testid":o,onClick:n,className:"inline-flex h-7 w-7 items-center justify-center border border-white/30 text-stone-50 hover:bg-white/10","aria-label":"Close screenshot preview",children:a.jsx(XO,{className:"h-3.5 w-3.5",strokeWidth:1.5})})]})]})}):null}const Voe={"action-required":"border-l-4 border-l-tertiary",approval:"border-l-4 border-l-warning",shipped:"border-l-4 border-l-success",progress:"border-l-4 border-l-secondary",observation:"border-l-4 border-l-stone-300"},Goe={neutral:"border-l-4 border-l-stone-300",info:"border-l-4 border-l-secondary",success:"border-l-4 border-l-success",warning:"border-l-4 border-l-warning",danger:"border-l-4 border-l-tertiary"},B$={neutral:"text-stone-600",info:"text-sky-800",success:"text-emerald-800",warning:"text-amber-800",danger:"text-rose-800"},Koe={neutral:"border-stone-300 bg-white/35 text-stone-700",info:"border-sky-300 bg-sky-50/30 text-sky-900",success:"border-emerald-300 bg-emerald-50/30 text-emerald-900",warning:"border-amber-300 bg-amber-50/35 text-amber-900",danger:"border-rose-300 bg-rose-50/35 text-rose-900"},Yoe={"action-required":"feed-card-action",approval:"feed-card-approval",shipped:"feed-card-shipped",progress:"feed-card-progress",observation:"feed-card-observation"},Woe={"action-required":{label:"Your turn",tone:"danger",icon:Pr},approval:{label:"Needs approval",tone:"warning",icon:Pr},shipped:{label:"Shipped",tone:"success",icon:Ej},progress:{label:"Progress",tone:"info",icon:yl},observation:{label:"Observation",tone:"neutral",icon:Ou}};function bs(e){return typeof e=="string"&&e.length>0?e:void 0}function Qoe(e){const t=e.source.payload??{},n=bs(t.qitem_id)??bs(t.qitemId);if(!n)return null;const s=t.tags,r=Array.isArray(s)?s.filter(o=>typeof o=="string"):void 0;return{qitemId:n,source:bs(t.source_session)??bs(t.sourceSession)??bs(t.fromSession),destination:bs(t.destination)??bs(t.destination_session)??bs(t.destinationSession)??bs(t.toSession),state:bs(t.state),tags:r,createdAt:e.createdAt,body:bs(t.body)??e.body}}function Xoe(e,t){const n=Qoe(e);return t?{qitemId:t.qitemId,source:t.sourceSession,destination:t.destinationSession,state:t.state,tags:t.tags??void 0,createdAt:t.tsCreated,body:t.body||(n==null?void 0:n.body)||e.body}:n}function Zoe(e){if(!e)return;const t=e.trim();return t.length<=520?t:`${t.slice(0,520).trimEnd()}
383
+ ...`}const Joe=new Set(["done","closed","completed","shipped","canceled","cancelled","denied","failed","handed-off"]);function F$(e){return e?Joe.has(e.state.toLowerCase()):!1}function ele(e,t,n){return!(e!=="action-required"&&e!=="approval"||n||F$(t))}function tle(e,t){if(e!=="action-required"&&e!=="approval"||!t||!F$(t))return null;const n=t.closureReason??null,s=t.handedOffTo??t.closureTarget??null;return{verb:n==="denied"?"deny":n==="handed_off_to"?"route":n==="canceled"?"drop":"approve",actorSession:t.destinationSession,actedAt:t.tsUpdated,state:t.state,destinationSession:s,reason:n==="no-follow-on"?null:t.closureTarget??n}}function nle(e){return Hoe(e.verb,"outcome")}function C4({token:e}){const t=e.icon;return a.jsxs("span",{className:he("inline-flex items-center gap-1 font-mono text-[9px] uppercase tracking-[0.12em]",B$[e.tone]),children:[t?a.jsx(t,{className:"h-3 w-3",strokeWidth:1.6}):null,e.label]})}function H$({value:e}){return a.jsxs("time",{dateTime:e??void 0,className:"inline-flex items-center gap-1 font-mono text-[10px] text-stone-500",children:[a.jsx(Cj,{className:"h-3 w-3",strokeWidth:1.5}),Xj(e)]})}function ij({session:e}){return a.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1 font-mono text-[10px] text-stone-600",children:[a.jsx(ip,{actor:e,size:"xs",decorative:!0}),a.jsx("span",{className:"truncate",children:FL(e)})]})}function U$({source:e,destination:t}){return!e&&!t?null:a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[a.jsx(ij,{session:e??"unknown source"}),a.jsx(np,{className:"h-3.5 w-3.5 text-stone-400",strokeWidth:1.4}),a.jsx(ij,{session:t??"unresolved target"})]})}function sle(e){switch(e.verb){case"approve":return`Approved by ${e.actorSession}.`;case"deny":return`Denied by ${e.actorSession}${e.reason?`: ${e.reason}.`:"."}`;case"route":case"handoff":return e.destinationSession?`Routed by ${e.actorSession} to ${e.destinationSession}.`:`Routed by ${e.actorSession}.`;case"hold":return`Held by ${e.actorSession}${e.reason?`: ${e.reason}.`:"."}`;case"drop":return`Dropped by ${e.actorSession}${e.reason?`: ${e.reason}.`:"."}`;case"annotate":return`Annotated by ${e.actorSession}.`}}function rle({outcome:e}){const t=xl[e.verb],n=t.icon;return a.jsxs("div",{"data-testid":"feed-card-action-outcome",className:he("mt-3 border-l-2 px-3 py-2 backdrop-blur-sm",Koe[t.tone]),children:[a.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[a.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[a.jsx("span",{className:"mt-0.5 inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-white/55 text-current",children:a.jsx(n,{className:"h-4 w-4",strokeWidth:1.8})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"font-mono text-[10px] uppercase tracking-[0.16em]",children:t.outcomeLabel}),a.jsx("div",{className:"mt-0.5 font-mono text-[9px] uppercase tracking-[0.12em] text-stone-500",children:"Decision recorded"})]})]}),a.jsx(H$,{value:e.actedAt})]}),a.jsx("p",{className:"mt-3 font-mono text-[11px] leading-relaxed text-stone-800",children:sle(e)}),a.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[a.jsx(ij,{session:e.actorSession}),e.reason?a.jsx(Wi,{tag:e.reason}):null]}),(e.verb==="route"||e.verb==="handoff")&&e.destinationSession?a.jsx("div",{className:"mt-2",children:a.jsx(U$,{source:e.actorSession,destination:e.destinationSession})}):null]})}function ile({card:e,queueItem:t,proofPreview:n,actionOutcome:s}){const[r,o]=R.useState(null),c=Xoe(e,t),u=Zoe((t==null?void 0:t.body)||e.body),f=(t==null?void 0:t.tags)??(c==null?void 0:c.tags)??[],h=(c==null?void 0:c.source)??e.authorSession,p=c==null?void 0:c.destination,g=p!=null&&p.startsWith("human")?p:"human@host",x=s??tle(e.kind,t),v=x?nle(x):Woe[e.kind],b=v.icon;return a.jsxs(Es,{as:"article",testId:Yoe[e.kind],accentClass:x?Goe[v.tone]:Voe[e.kind],className:"mb-3 bg-white/50 backdrop-blur-sm",children:[a.jsxs("div",{className:"px-4 py-3",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{className:"min-w-0 space-y-2",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1",children:[a.jsxs("span",{className:he("inline-flex items-center gap-1.5 font-mono text-[10px] uppercase tracking-[0.16em]",B$[v.tone]),children:[b?a.jsx(b,{className:"h-3.5 w-3.5",strokeWidth:1.8}):null,v.label]}),a.jsx(C4,{token:Qj(e.source.type)}),c!=null&&c.state?a.jsx(C4,{token:BL(c.state)}):null]}),a.jsx("h3",{className:"font-mono text-sm text-stone-900 truncate",children:e.title})]}),a.jsx(H$,{value:e.createdAt})]}),u?a.jsx("p",{className:"mt-3 font-mono text-xs leading-relaxed text-on-surface-variant whitespace-pre-line",children:u}):null,a.jsx("div",{className:"mt-3",children:a.jsx(U$,{source:h,destination:p})}),f.length>0?a.jsx("div",{className:"mt-3 flex flex-wrap gap-1.5",children:f.slice(0,6).map(w=>a.jsx(Wi,{tag:w},w))}):null,n&&n.screenshots.length>0?a.jsxs("div",{"data-testid":`feed-card-proof-preview-${e.id}`,className:"mt-3 border border-outline-variant bg-white/35 p-2 backdrop-blur-sm",children:[a.jsx(Bp,{title:`Proof packet · ${n.displayName}`,badge:n.passFailBadge}),a.jsx("div",{className:"mt-2",children:a.jsx(HL,{sliceName:n.sliceName,screenshots:n.screenshots,onSelect:o,testIdPrefix:"feed-card-proof-screenshot"})})]}):null,x?a.jsx(rle,{outcome:x}):null,c&&ele(e.kind,t,x)?a.jsxs("div",{"data-testid":`feed-card-actions-${e.id}`,className:"mt-3 border border-rose-200 bg-rose-50/45 p-3 backdrop-blur-sm",children:[a.jsx("div",{className:"mb-2 flex flex-wrap items-start justify-between gap-2",children:a.jsxs("div",{children:[a.jsxs("div",{className:"inline-flex items-center gap-1.5 font-mono text-[10px] uppercase tracking-[0.14em] text-rose-900",children:[a.jsx(Pr,{className:"h-3.5 w-3.5",strokeWidth:1.7}),"Your turn"]}),a.jsx("p",{className:"mt-1 max-w-xl font-mono text-[10px] leading-relaxed text-rose-800/80",children:"Review the context, then approve, deny, or route this queue item."})]})}),a.jsx(Uoe,{qitemId:c.qitemId,actorSession:g,enabledVerbs:["approve","deny","route"]})]}):null,a.jsx("div",{className:"mt-3 flex items-center justify-between gap-3 font-mono text-[10px] text-on-surface-variant",children:a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.authorSession?a.jsx(Foe,{authorSession:e.authorSession,rigId:e.rigId}):a.jsx("span",{className:"truncate",children:e.source.type}),c?a.jsx(Nm,{data:c,testId:`feed-card-show-context-${e.id}`,className:"font-mono text-[10px] uppercase tracking-wide text-stone-700 hover:text-stone-900 underline",children:"show context"}):null]})})]}),n?a.jsx(d_,{sliceName:n.sliceName,relPath:r,onClose:()=>o(null)}):null]})}const ale=[{id:"all",label:"All"},{id:"action-required",label:"Action req"},{id:"approval",label:"Approvals"},{id:"shipped",label:"Shipped"},{id:"progress",label:"Progress"},{id:"observation",label:"Audit"}],ole=50,k4={all:{label:"All caught up",description:"Nothing needs you right now. New human tasks, approvals, shipped proof, and progress updates will appear here."},"action-required":{label:"No actions waiting",description:"When a queue item needs your response, it will appear here with approve, deny, and route controls."},approval:{label:"No approvals waiting",description:"Closeout and ratification requests will collect here when work needs an explicit decision."},shipped:{label:"No shipped proof yet",description:"Completed work with proof packets and screenshots will appear here when slices close."},progress:{label:"No progress cards",description:"Fresh queue movement and project updates will appear here as work advances."},observation:{label:"No audit cards",description:"Observation events are quiet right now. Turn the audit subscription on to watch more verbose activity."}};function R4(e){return typeof e=="string"&&e.length>0?e:void 0}function lle(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function Rh(e){const t=e.source.payload??{};return R4(t.qitemId)??R4(t.qitem_id)??null}const cle=new Set(["approve","deny","route","handoff","hold","drop"]);function du(e,t){const n=e==null?void 0:e[t];return typeof n=="string"&&n.length>0?n:null}function ule(e){if(!e.qitemId)return null;const t=e.actionVerb;if(!cle.has(t))return null;const n=du(e.afterState,"handedOffTo")??(du(e.afterState,"closureReason")==="handed_off_to"?du(e.afterState,"closureTarget"):null);return{verb:t,actorSession:e.actorSession,actedAt:e.actedAt,state:du(e.afterState,"state"),destinationSession:n,reason:e.reason??du(e.afterState,"closureTarget")}}function dle(e){const t=new Map;for(const n of e){if(!n.qitemId||t.has(n.qitemId))continue;const s=ule(n);s&&t.set(n.qitemId,s)}return t}function V$(e,t){const n=e.source.payload??{};return[...lle(n.tags),...(t==null?void 0:t.tags)??[]]}function fle(e,t,n){if(n&&(e.kind==="action-required"||e.kind==="approval"))return"approval";if(!t)return e.kind;const s=V$(e,t).join(" ").toLowerCase(),r=t.state.toLowerCase(),o=t.destinationSession.toLowerCase(),c=t.body.toLowerCase();return s.includes("approval")||s.includes("ratify")||r.includes("approval")||c.includes("approval requested")?"approval":r==="done"||r==="closed"||r==="completed"?"shipped":o==="human@host"||o.startsWith("human-")?"action-required":e.kind}function E4(e,t,n){const s=new Set(V$(e,t));for(const o of n)if(s.has(o.name))return o.name;const r=[e.title,e.body,t==null?void 0:t.body,...(t==null?void 0:t.tags)??[]].filter(o=>!!o).join(`
384
+ `);for(const o of n)if(r.includes(o.name))return o.name;return null}function hle(e){const t=(e==null?void 0:e.tests.proofPackets.find(n=>n.screenshots.length>0))??(e==null?void 0:e.tests.proofPackets[0]);return!e||!t||t.screenshots.length===0?null:{sliceName:e.name,displayName:e.displayName||e.name,passFailBadge:t.passFailBadge,screenshots:t.screenshots}}function ple(){var b;const{events:e}=Pp(),[t,n]=R.useState("all"),s=OL(),r=R.useMemo(()=>$oe(e).slice(0,ole),[e]),o=R.useMemo(()=>r.map(Rh).filter(w=>!!w),[r]),c=Pj(o),u=$$({limit:200}),f=R.useMemo(()=>{var w;return dle(((w=u.data)==null?void 0:w.rows)??[])},[(b=u.data)==null?void 0:b.rows]),h=R.useMemo(()=>{const S=r.map(N=>{const C=Rh(N),k=C?c.itemsById.get(C):void 0,_=C?f.get(C):void 0,E=fle(N,k,_);return E===N.kind?N:{...N,kind:E}}).filter(N=>XU(N.kind,s.state));return t==="all"?S:S.filter(N=>N.kind===t)},[r,t,c.itemsById,f,s.state]),p=Mp("all"),g=R.useMemo(()=>!p.data||"unavailable"in p.data?[]:p.data.slices,[p.data]),x=R.useMemo(()=>{const w=new Set;for(const S of h){if(S.kind!=="shipped")continue;const N=Rh(S),C=N?c.itemsById.get(N):void 0,k=E4(S,C,g);k&&w.add(k)}return Array.from(w)},[h,c.itemsById,g]),v=xL(x);return a.jsxs("div",{"data-testid":"for-you-feed",className:"mx-auto w-full max-w-[720px] px-6 py-8",children:[a.jsxs("header",{className:"border-b border-outline-variant pb-4 mb-4",children:[a.jsx(rt,{tone:"muted",children:"Attention"}),a.jsx("h1",{className:"font-headline text-headline-md font-bold tracking-tight uppercase text-stone-900 mt-1",children:"For You"})]}),a.jsx("div",{"data-testid":"feed-lens-chips",role:"toolbar","aria-label":"Feed filters",className:"flex flex-wrap gap-1 mb-4",children:ale.map(w=>a.jsx("button",{type:"button","data-testid":`feed-lens-${w.id}`,"data-active":t===w.id,onClick:()=>n(w.id),className:he("px-2 py-1 border font-mono text-[9px] uppercase tracking-wide",t===w.id?"border-stone-900 bg-stone-900 text-stone-50":"border-outline-variant text-on-surface-variant hover:bg-stone-100"),children:w.label},w.id))}),h.length===0?a.jsx(Xe,{label:k4[t].label,description:k4[t].description,variant:"card",testId:"for-you-empty"}):a.jsx("div",{"data-testid":"for-you-feed-cards",children:h.map(w=>{const S=Rh(w),N=S?c.itemsById.get(S):void 0,C=w.kind==="shipped"?E4(w,N,g):null,k=C?hle(v.itemsByName.get(C)):null,_=S?f.get(S)??null:null;return a.jsx(ile,{card:w,queueItem:N,proofPreview:k,actionOutcome:_},w.id)})})]})}const mle=[{label:"+ Add spec",to:"/specs/rig",testId:"specs-toolbar-add"},{label:"Import",to:"/import",testId:"specs-toolbar-import"},{label:"Discover",to:"/search",testId:"specs-toolbar-discover"},{label:"Create rig",to:"/specs/rig",testId:"specs-toolbar-create-rig"},{label:"Generate workflow",to:"/specs/agent",testId:"specs-toolbar-gen-workflow"}];function Eh(e){return{id:e.id,label:e.name,meta:`${e.version} · ${e.sourceType}`,entryId:e.id}}function gle(e){return{id:e.id,label:e.name,meta:`${e.version} · ${e.sourceType} · ~${e.derivedEstimatedTokens} tokens`,entryId:e.id}}function xle(e){return{id:e.id,label:e.name,meta:`${e.version} · ${e.sourceType}`,metaNode:a.jsx(_n,{runtime:e.runtime,size:"xs",compact:!0,variant:"inline"}),entryId:e.id}}function Sa({id:e,title:t,rows:n,isLoading:s,emptyLabel:r}){return a.jsxs("section",{"data-testid":`library-section-${e}`,className:"border border-outline-variant bg-white/25 hard-shadow",children:[a.jsxs("header",{className:"flex items-baseline justify-between border-b border-outline-variant bg-white/30 px-3 py-2",children:[a.jsx(rt,{tone:"default",children:t}),a.jsx("span",{className:"font-mono text-[9px] uppercase tracking-[0.12em] text-stone-500",children:s?"loading":`${n.length} items`})]}),n.length>0?a.jsx("ul",{className:"divide-y divide-outline-variant",children:n.map(o=>a.jsx("li",{children:o.entryId?a.jsx(Ye,{to:"/specs/library/$entryId",params:{entryId:o.entryId},"data-testid":`library-row-${e}-${o.id}`,className:"block px-3 py-2 hover:bg-stone-100/50",children:a.jsx(A4,{row:o})}):a.jsx("div",{"data-testid":`library-row-${e}-${o.id}`,className:"px-3 py-2",children:a.jsx(A4,{row:o})})},o.id))}):a.jsx("div",{className:"px-3 py-4 font-mono text-[10px] text-stone-500",children:s?"Loading...":r??"No entries."})]})}function A4({row:e}){return a.jsxs("div",{className:"flex items-baseline justify-between gap-3 font-mono",children:[a.jsx("span",{className:"truncate text-xs font-bold text-stone-900",children:e.label}),a.jsxs("span",{className:"flex shrink-0 items-center gap-2 text-[9px] uppercase tracking-[0.08em] text-stone-500",children:[e.metaNode,a.jsx("span",{children:e.meta})]})]})}function vle({skills:e,isLoading:t}){return a.jsxs("section",{id:"library-skills","data-testid":"library-section-skills",className:"border border-outline-variant bg-white/25 hard-shadow",children:[a.jsxs("header",{className:"flex items-baseline justify-between border-b border-outline-variant bg-white/30 px-3 py-2",children:[a.jsx(rt,{tone:"default",children:"Skills"}),a.jsx("span",{className:"shrink-0 font-mono text-[9px] uppercase tracking-[0.12em] text-stone-500",children:t?"loading":`${e.length} folders`})]}),e.length===0?a.jsx("div",{className:"px-3 py-4",children:a.jsx(Xe,{label:t?"LOADING":"NO SKILLS FOUND",description:t?"Loading skill folders...":"No .openrig/skills or packaged OpenRig skill folders are visible through configured file roots.",variant:"card",testId:"library-skills-empty"})}):a.jsx("ul",{className:"divide-y divide-outline-variant",children:e.map(n=>a.jsx("li",{children:a.jsxs("a",{href:gU(n.id),"data-testid":`library-skill-${n.name}`,className:"flex items-center justify-between gap-3 px-3 py-2 font-mono hover:bg-stone-100/50",children:[a.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[a.jsx(Pe,{tool:"skill",title:`${n.name} skill`,size:"xs",decorative:!0}),a.jsx("span",{className:"truncate text-xs font-bold text-stone-900",children:n.name})]}),a.jsxs("span",{className:"shrink-0 text-[9px] uppercase tracking-[0.08em] text-stone-500",children:[n.files.length," files"]})]})},n.id))})]})}function G$(){const{data:e=[],isLoading:t}=Wl(),{data:n=[],isLoading:s}=$j(),{data:r=[],isLoading:o}=zj(),{data:c=[],isLoading:u}=Bj(),f=R.useMemo(()=>{const p=e.filter(b=>b.kind==="rig"&&!b.hasServices).map(Eh),g=e.filter(b=>b.kind==="workflow").map(Eh),x=e.filter(b=>b.kind==="agent").map(Eh),v=e.filter(b=>b.kind==="rig"&&b.hasServices).map(Eh);return{rigSpecs:p,workflowSpecs:g,agentSpecs:x,applications:v}},[e]),h=f.rigSpecs.length+f.workflowSpecs.length+f.agentSpecs.length+f.applications.length+n.length+r.length+c.length;return a.jsxs("div",{"data-testid":"specs-library-page",className:"h-full overflow-y-auto bg-paper-grid px-6 py-5 lg:pl-[var(--workspace-left-offset,0px)] lg:pr-[var(--workspace-right-offset,0px)]",children:[a.jsxs("header",{className:"mb-5 flex items-start justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx(rt,{tone:"muted",children:"Library"}),a.jsx("h1",{className:"mt-1 font-headline text-2xl font-bold tracking-tight text-stone-900",children:"Library"}),a.jsx("p",{className:"mt-1 max-w-3xl text-sm text-stone-600",children:"Specs, context packs, agent images, applications, and skill folders."})]}),a.jsx("nav",{"aria-label":"Library actions",className:"flex flex-wrap justify-end gap-2",children:mle.map(p=>a.jsx(Ye,{to:p.to,"data-testid":p.testId,className:"border border-outline-variant bg-white/25 px-3 py-1.5 font-mono text-[10px] uppercase tracking-[0.12em] text-stone-700 hard-shadow hover:bg-white/40",children:p.label},p.testId))})]}),a.jsxs("div",{className:"mb-4 font-mono text-[10px] uppercase tracking-[0.14em] text-stone-500",children:[h," library entries visible through current sources"]}),a.jsxs("div",{className:"grid gap-4 xl:grid-cols-2",children:[a.jsx(Sa,{id:"rig-specs",title:"Rig Specs",rows:f.rigSpecs,isLoading:t,emptyLabel:"No rig specs found."}),a.jsx(Sa,{id:"workspace-specs",title:"Workspace Specs",rows:[],emptyLabel:"No workspace specs source is wired yet."}),a.jsx(Sa,{id:"workflow-specs",title:"Workflow Specs",rows:f.workflowSpecs,isLoading:t,emptyLabel:"No workflow specs found."}),a.jsx(Sa,{id:"context-packs",title:"Context Packs",rows:n.map(gle),isLoading:s,emptyLabel:"No context packs found."}),a.jsx(Sa,{id:"agent-specs",title:"Agent Specs",rows:f.agentSpecs,isLoading:t,emptyLabel:"No agent specs found."}),a.jsx(Sa,{id:"agent-images",title:"Agent Images",rows:r.map(xle),isLoading:o,emptyLabel:"No agent images found."}),a.jsx(Sa,{id:"applications",title:"Applications",rows:f.applications,isLoading:t,emptyLabel:"No application specs found."})]}),a.jsx("div",{className:"mt-4",children:a.jsx(vle,{skills:c,isLoading:u})})]})}function yle(e){return e.find(t=>t.name.toLowerCase()==="skill.md")??null}function K$({skillToken:e,fileToken:t}){const{data:n=[],isLoading:s}=Bj(),r=kL(e),o=t?RL(t):null,c=r?n.find(h=>h.id===r)??null:null,u=c?yle(c.files):null,f=c?c.files.find(h=>h.path===o)??(o?null:u):null;return s?a.jsx("div",{className:"h-full bg-paper-grid px-6 py-5 lg:pl-[var(--workspace-left-offset,0px)] lg:pr-[var(--workspace-right-offset,0px)]",children:a.jsx(Xe,{label:"LOADING SKILL",description:"Loading skill files from configured library roots.",variant:"card",testId:"skill-detail-loading"})}):c?f?a.jsx("div",{"data-testid":"skill-detail-page",className:"h-full bg-paper-grid px-6 py-5 lg:pl-[var(--workspace-left-offset,0px)] lg:pr-[var(--workspace-right-offset,0px)]",children:a.jsx("div",{className:"h-full border border-outline-variant bg-white/25 hard-shadow",children:a.jsx(KL,{path:`${c.name}/${f.name}`,root:c.root,readPath:f.path,kind:"markdown"})})}):a.jsx("div",{className:"h-full bg-paper-grid px-6 py-5 lg:pl-[var(--workspace-left-offset,0px)] lg:pr-[var(--workspace-right-offset,0px)]",children:a.jsx(Xe,{label:o?"FILE NOT FOUND":"SKILL.md NOT FOUND",description:o?"That file is not present in this skill folder.":"This skill does not include a SKILL.md file. Pick another file from the Library explorer.",variant:"card",testId:"skill-detail-file-missing"})}):a.jsx("div",{className:"h-full bg-paper-grid px-6 py-5 lg:pl-[var(--workspace-left-offset,0px)] lg:pr-[var(--workspace-right-offset,0px)]",children:a.jsx(Xe,{label:"SKILL NOT FOUND",description:"The selected skill is not visible through the configured library roots.",variant:"card",testId:"skill-detail-not-found"})})}const T4={active:"bg-success",running:"bg-success",stopped:"bg-stone-400",warning:"bg-warning",error:"bg-tertiary",info:"bg-secondary"},ble={active:"border-success text-success",running:"border-success text-success",stopped:"border-stone-400 text-stone-500",warning:"border-warning text-warning",error:"border-tertiary text-tertiary",info:"border-secondary text-secondary"};function jp({status:e,label:t,variant:n="dot",className:s,testId:r}){return n==="pill"?a.jsxs("span",{"data-testid":r,className:he("inline-flex items-center gap-1 px-1.5 py-0.5 border font-mono text-[9px] uppercase tracking-wide",ble[e],s),role:"status","aria-label":t??e,children:[a.jsx("span",{className:he("w-1.5 h-1.5 rounded-full",T4[e]),"aria-hidden":"true"}),t??e]}):a.jsxs("span",{"data-testid":r,className:he("inline-flex items-center gap-1.5",s),role:"status","aria-label":t??e,children:[a.jsx("span",{className:he("w-2 h-2 rounded-full",T4[e]),"aria-hidden":"true"}),t?a.jsx("span",{className:"font-mono text-[9px] uppercase tracking-wide text-on-surface-variant",children:t}):null]})}async function wle(){if(!(await fetch("/healthz")).ok)throw new Error("unhealthy");return!0}async function Sle(){const e=await fetch("/api/adapters/cmux/status");if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}function jle(){var x;const e=Ze({queryKey:["daemon","health"],queryFn:wle,refetchInterval:1e4,retry:!1}),t=Ze({queryKey:["daemon","cmux"],queryFn:Sle,refetchInterval:3e4,retry:!1}),{data:n,isLoading:s,error:r}=Ts(),{data:o}=ad(),c=e.isSuccess,u=c?((x=t.data)==null?void 0:x.available)??null:null,f=(n==null?void 0:n.length)??0,h=(o==null?void 0:o.filter(v=>v.runningCount>0).length)??0,p=c?"active":e.isError?"error":e.isLoading?"info":"stopped",g=u===!0?"active":u===!1?"warning":"info";return a.jsxs("div",{"data-testid":"settings-status-panel",className:"space-y-4",children:[a.jsxs("section",{children:[a.jsx(rt,{tone:"muted",children:"Daemon"}),a.jsxs("div",{className:"mt-2 flex items-center justify-between font-mono text-xs",children:[a.jsx("span",{className:"text-on-surface-variant",children:"Reachable"}),a.jsx(jp,{status:p,label:c?"OK":e.isError?"ERROR":e.isLoading?"LOADING":"DISCONNECTED",variant:"pill",testId:"status-daemon"})]})]}),a.jsxs("section",{children:[a.jsx(rt,{tone:"muted",children:"Cmux control"}),a.jsxs("div",{className:"mt-2 flex items-center justify-between font-mono text-xs",children:[a.jsx("span",{className:"text-on-surface-variant",children:"Adapter"}),a.jsx(jp,{status:g,label:u===!0?"AVAILABLE":u===!1?"UNAVAILABLE":"UNKNOWN",variant:"pill",testId:"status-cmux"})]}),a.jsx("div",{className:"mt-1 font-mono text-[10px] text-on-surface-variant",children:"OpenRig can control cmux surfaces for node open-or-focus."})]}),a.jsxs("section",{children:[a.jsx(rt,{tone:"muted",children:"Rigs"}),a.jsxs("div",{className:"mt-2 space-y-1.5 font-mono text-xs",children:[a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-on-surface-variant",children:"Total"}),a.jsx("span",{className:"text-stone-900 font-bold","data-testid":"status-rigs-total",children:f})]}),a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-on-surface-variant",children:"Running"}),a.jsx("span",{className:"text-stone-900 font-bold","data-testid":"status-rigs-running",children:h})]})]})]})]})}const Nle=[{id:"settings",label:"Settings"},{id:"log",label:"Log"},{id:"status",label:"Status"}];function _le(){const{events:e}=Pp();return e.length===0?a.jsx(Xe,{label:"LOG IS QUIET",description:"Activity events from rigs will stream here.",variant:"card",testId:"settings-log-empty"}):a.jsx("ul",{"data-testid":"settings-log-stream",className:"divide-y divide-outline-variant border border-outline-variant max-h-[60vh] overflow-y-auto",children:e.slice(0,100).map(t=>a.jsxs("li",{className:"px-3 py-2 flex items-baseline gap-3 font-mono text-xs",children:[a.jsx("span",{className:"text-on-surface-variant text-[10px] uppercase tracking-wide w-32 shrink-0 truncate",children:t.type}),a.jsx("span",{className:"text-stone-900 truncate",title:Sp(t.payload),children:Sp(t.payload)})]},t.seq))})}function Cle(){const[e,t]=R.useState("settings");return a.jsxs("div",{"data-testid":"settings-center",className:"mx-auto w-full max-w-[960px] px-6 py-8",children:[a.jsxs("div",{className:"border-b border-outline-variant pb-4 mb-4",children:[a.jsx(rt,{tone:"muted",children:"Configuration"}),a.jsx("h1",{className:"font-headline text-headline-md font-bold tracking-tight uppercase text-stone-900 mt-1",children:"Settings"})]}),a.jsx("div",{"data-testid":"settings-tab-nav",role:"tablist","aria-label":"Settings sections",className:"flex gap-1 mb-6 border-b border-outline-variant",children:Nle.map(n=>a.jsx("button",{type:"button",role:"tab","aria-selected":e===n.id,"data-testid":`settings-tab-${n.id}`,"data-active":e===n.id,onClick:()=>t(n.id),className:he("px-3 py-2 font-mono text-[10px] uppercase tracking-[0.18em] border-b-2 -mb-px",e===n.id?"border-stone-900 text-stone-900":"border-transparent text-on-surface-variant hover:text-stone-900"),children:n.label},n.id))}),a.jsxs("div",{"data-testid":"settings-active-panel",role:"tabpanel",children:[e==="settings"?a.jsx(DL,{}):null,e==="log"?a.jsx(_le,{}):null,e==="status"?a.jsx(jle,{}):null]})]})}function f_({tabs:e,active:t,onSelect:n,testIdPrefix:s="topology-view-mode"}){return a.jsx("div",{role:"tablist","aria-label":"Topology view modes","data-testid":`${s}-tabs`,className:"flex gap-6",children:e.map(r=>a.jsx("button",{type:"button",role:"tab","aria-selected":t===r.id,"data-testid":`${s}-tab-${r.id}`,"data-active":t===r.id,onClick:()=>n(r.id),className:he("py-3 font-mono text-[10px] uppercase tracking-[0.18em] border-b-2",t===r.id?"border-stone-900 text-stone-900":"border-transparent text-on-surface-variant hover:text-stone-900"),children:r.label},r.id))})}const kle=[{id:"graph",label:"Graph"},{id:"table",label:"Table"},{id:"terminal",label:"Terminal"}],Y$=[{id:"graph",label:"Graph"},{id:"table",label:"Table"},{id:"terminal",label:"Terminal"},{id:"overview",label:"Overview"}];/**
385
+ * table-core
386
+ *
387
+ * Copyright (c) TanStack
388
+ *
389
+ * This source code is licensed under the MIT license found in the
390
+ * LICENSE.md file in the root directory of this source tree.
391
+ *
392
+ * @license MIT
393
+ */function Fi(e,t){return typeof e=="function"?e(t):e}function ns(e,t){return n=>{t.setState(s=>({...s,[e]:Fi(n,s[e])}))}}function _m(e){return e instanceof Function}function Rle(e){return Array.isArray(e)&&e.every(t=>typeof t=="number")}function Ele(e,t){const n=[],s=r=>{r.forEach(o=>{n.push(o);const c=t(o);c!=null&&c.length&&s(c)})};return s(e),n}function Me(e,t,n){let s=[],r;return o=>{let c;n.key&&n.debug&&(c=Date.now());const u=e(o);if(!(u.length!==s.length||u.some((p,g)=>s[g]!==p)))return r;s=u;let h;if(n.key&&n.debug&&(h=Date.now()),r=t(...u),n==null||n.onChange==null||n.onChange(r),n.key&&n.debug&&n!=null&&n.debug()){const p=Math.round((Date.now()-c)*100)/100,g=Math.round((Date.now()-h)*100)/100,x=g/16,v=(b,w)=>{for(b=String(b);b.length<w;)b=" "+b;return b};console.info(`%c⏱ ${v(g,5)} /${v(p,5)} ms`,`
394
+ font-size: .6rem;
395
+ font-weight: bold;
396
+ color: hsl(${Math.max(0,Math.min(120-120*x,120))}deg 100% 31%);`,n==null?void 0:n.key)}return r}}function Ie(e,t,n,s){return{debug:()=>{var r;return(r=e==null?void 0:e.debugAll)!=null?r:e[t]},key:!1,onChange:s}}function Ale(e,t,n,s){const r=()=>{var c;return(c=o.getValue())!=null?c:e.options.renderFallbackValue},o={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(s),renderValue:r,getContext:Me(()=>[e,n,t,o],(c,u,f,h)=>({table:c,column:u,row:f,cell:h,getValue:h.getValue,renderValue:h.renderValue}),Ie(e.options,"debugCells"))};return e._features.forEach(c=>{c.createCell==null||c.createCell(o,n,t,e)},{}),o}function Tle(e,t,n,s){var r,o;const u={...e._getDefaultColumnDef(),...t},f=u.accessorKey;let h=(r=(o=u.id)!=null?o:f?typeof String.prototype.replaceAll=="function"?f.replaceAll(".","_"):f.replace(/\./g,"_"):void 0)!=null?r:typeof u.header=="string"?u.header:void 0,p;if(u.accessorFn?p=u.accessorFn:f&&(f.includes(".")?p=x=>{let v=x;for(const w of f.split(".")){var b;v=(b=v)==null?void 0:b[w]}return v}:p=x=>x[u.accessorKey]),!h)throw new Error;let g={id:`${String(h)}`,accessorFn:p,parent:s,depth:n,columnDef:u,columns:[],getFlatColumns:Me(()=>[!0],()=>{var x;return[g,...(x=g.columns)==null?void 0:x.flatMap(v=>v.getFlatColumns())]},Ie(e.options,"debugColumns")),getLeafColumns:Me(()=>[e._getOrderColumnsFn()],x=>{var v;if((v=g.columns)!=null&&v.length){let b=g.columns.flatMap(w=>w.getLeafColumns());return x(b)}return[g]},Ie(e.options,"debugColumns"))};for(const x of e._features)x.createColumn==null||x.createColumn(g,e);return g}const un="debugHeaders";function M4(e,t,n){var s;let o={id:(s=n.id)!=null?s:t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const c=[],u=f=>{f.subHeaders&&f.subHeaders.length&&f.subHeaders.map(u),c.push(f)};return u(o),c},getContext:()=>({table:e,header:o,column:t})};return e._features.forEach(c=>{c.createHeader==null||c.createHeader(o,e)}),o}const Mle={createTable:e=>{e.getHeaderGroups=Me(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,s,r)=>{var o,c;const u=(o=s==null?void 0:s.map(g=>n.find(x=>x.id===g)).filter(Boolean))!=null?o:[],f=(c=r==null?void 0:r.map(g=>n.find(x=>x.id===g)).filter(Boolean))!=null?c:[],h=n.filter(g=>!(s!=null&&s.includes(g.id))&&!(r!=null&&r.includes(g.id)));return Ah(t,[...u,...h,...f],e)},Ie(e.options,un)),e.getCenterHeaderGroups=Me(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,s,r)=>(n=n.filter(o=>!(s!=null&&s.includes(o.id))&&!(r!=null&&r.includes(o.id))),Ah(t,n,e,"center")),Ie(e.options,un)),e.getLeftHeaderGroups=Me(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,s)=>{var r;const o=(r=s==null?void 0:s.map(c=>n.find(u=>u.id===c)).filter(Boolean))!=null?r:[];return Ah(t,o,e,"left")},Ie(e.options,un)),e.getRightHeaderGroups=Me(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,s)=>{var r;const o=(r=s==null?void 0:s.map(c=>n.find(u=>u.id===c)).filter(Boolean))!=null?r:[];return Ah(t,o,e,"right")},Ie(e.options,un)),e.getFooterGroups=Me(()=>[e.getHeaderGroups()],t=>[...t].reverse(),Ie(e.options,un)),e.getLeftFooterGroups=Me(()=>[e.getLeftHeaderGroups()],t=>[...t].reverse(),Ie(e.options,un)),e.getCenterFooterGroups=Me(()=>[e.getCenterHeaderGroups()],t=>[...t].reverse(),Ie(e.options,un)),e.getRightFooterGroups=Me(()=>[e.getRightHeaderGroups()],t=>[...t].reverse(),Ie(e.options,un)),e.getFlatHeaders=Me(()=>[e.getHeaderGroups()],t=>t.map(n=>n.headers).flat(),Ie(e.options,un)),e.getLeftFlatHeaders=Me(()=>[e.getLeftHeaderGroups()],t=>t.map(n=>n.headers).flat(),Ie(e.options,un)),e.getCenterFlatHeaders=Me(()=>[e.getCenterHeaderGroups()],t=>t.map(n=>n.headers).flat(),Ie(e.options,un)),e.getRightFlatHeaders=Me(()=>[e.getRightHeaderGroups()],t=>t.map(n=>n.headers).flat(),Ie(e.options,un)),e.getCenterLeafHeaders=Me(()=>[e.getCenterFlatHeaders()],t=>t.filter(n=>{var s;return!((s=n.subHeaders)!=null&&s.length)}),Ie(e.options,un)),e.getLeftLeafHeaders=Me(()=>[e.getLeftFlatHeaders()],t=>t.filter(n=>{var s;return!((s=n.subHeaders)!=null&&s.length)}),Ie(e.options,un)),e.getRightLeafHeaders=Me(()=>[e.getRightFlatHeaders()],t=>t.filter(n=>{var s;return!((s=n.subHeaders)!=null&&s.length)}),Ie(e.options,un)),e.getLeafHeaders=Me(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(t,n,s)=>{var r,o,c,u,f,h;return[...(r=(o=t[0])==null?void 0:o.headers)!=null?r:[],...(c=(u=n[0])==null?void 0:u.headers)!=null?c:[],...(f=(h=s[0])==null?void 0:h.headers)!=null?f:[]].map(p=>p.getLeafHeaders()).flat()},Ie(e.options,un))}};function Ah(e,t,n,s){var r,o;let c=0;const u=function(x,v){v===void 0&&(v=1),c=Math.max(c,v),x.filter(b=>b.getIsVisible()).forEach(b=>{var w;(w=b.columns)!=null&&w.length&&u(b.columns,v+1)},0)};u(e);let f=[];const h=(x,v)=>{const b={depth:v,id:[s,`${v}`].filter(Boolean).join("_"),headers:[]},w=[];x.forEach(S=>{const N=[...w].reverse()[0],C=S.column.depth===b.depth;let k,_=!1;if(C&&S.column.parent?k=S.column.parent:(k=S.column,_=!0),N&&(N==null?void 0:N.column)===k)N.subHeaders.push(S);else{const E=M4(n,k,{id:[s,v,k.id,S==null?void 0:S.id].filter(Boolean).join("_"),isPlaceholder:_,placeholderId:_?`${w.filter(M=>M.column===k).length}`:void 0,depth:v,index:w.length});E.subHeaders.push(S),w.push(E)}b.headers.push(S),S.headerGroup=b}),f.push(b),v>0&&h(w,v-1)},p=t.map((x,v)=>M4(n,x,{depth:c,index:v}));h(p,c-1),f.reverse();const g=x=>x.filter(b=>b.column.getIsVisible()).map(b=>{let w=0,S=0,N=[0];b.subHeaders&&b.subHeaders.length?(N=[],g(b.subHeaders).forEach(k=>{let{colSpan:_,rowSpan:E}=k;w+=_,N.push(E)})):w=1;const C=Math.min(...N);return S=S+C,b.colSpan=w,b.rowSpan=S,{colSpan:w,rowSpan:S}});return g((r=(o=f[0])==null?void 0:o.headers)!=null?r:[]),f}const h_=(e,t,n,s,r,o,c)=>{let u={id:t,index:s,original:n,depth:r,parentId:c,_valuesCache:{},_uniqueValuesCache:{},getValue:f=>{if(u._valuesCache.hasOwnProperty(f))return u._valuesCache[f];const h=e.getColumn(f);if(h!=null&&h.accessorFn)return u._valuesCache[f]=h.accessorFn(u.original,s),u._valuesCache[f]},getUniqueValues:f=>{if(u._uniqueValuesCache.hasOwnProperty(f))return u._uniqueValuesCache[f];const h=e.getColumn(f);if(h!=null&&h.accessorFn)return h.columnDef.getUniqueValues?(u._uniqueValuesCache[f]=h.columnDef.getUniqueValues(u.original,s),u._uniqueValuesCache[f]):(u._uniqueValuesCache[f]=[u.getValue(f)],u._uniqueValuesCache[f])},renderValue:f=>{var h;return(h=u.getValue(f))!=null?h:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>Ele(u.subRows,f=>f.subRows),getParentRow:()=>u.parentId?e.getRow(u.parentId,!0):void 0,getParentRows:()=>{let f=[],h=u;for(;;){const p=h.getParentRow();if(!p)break;f.push(p),h=p}return f.reverse()},getAllCells:Me(()=>[e.getAllLeafColumns()],f=>f.map(h=>Ale(e,u,h,h.id)),Ie(e.options,"debugRows")),_getAllCellsByColumnId:Me(()=>[u.getAllCells()],f=>f.reduce((h,p)=>(h[p.column.id]=p,h),{}),Ie(e.options,"debugRows"))};for(let f=0;f<e._features.length;f++){const h=e._features[f];h==null||h.createRow==null||h.createRow(u,e)}return u},Ile={createColumn:(e,t)=>{e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},W$=(e,t,n)=>{var s,r;const o=n==null||(s=n.toString())==null?void 0:s.toLowerCase();return!!(!((r=e.getValue(t))==null||(r=r.toString())==null||(r=r.toLowerCase())==null)&&r.includes(o))};W$.autoRemove=e=>Rs(e);const Q$=(e,t,n)=>{var s;return!!(!((s=e.getValue(t))==null||(s=s.toString())==null)&&s.includes(n))};Q$.autoRemove=e=>Rs(e);const X$=(e,t,n)=>{var s;return((s=e.getValue(t))==null||(s=s.toString())==null?void 0:s.toLowerCase())===(n==null?void 0:n.toLowerCase())};X$.autoRemove=e=>Rs(e);const Z$=(e,t,n)=>{var s;return(s=e.getValue(t))==null?void 0:s.includes(n)};Z$.autoRemove=e=>Rs(e);const J$=(e,t,n)=>!n.some(s=>{var r;return!((r=e.getValue(t))!=null&&r.includes(s))});J$.autoRemove=e=>Rs(e)||!(e!=null&&e.length);const e6=(e,t,n)=>n.some(s=>{var r;return(r=e.getValue(t))==null?void 0:r.includes(s)});e6.autoRemove=e=>Rs(e)||!(e!=null&&e.length);const t6=(e,t,n)=>e.getValue(t)===n;t6.autoRemove=e=>Rs(e);const n6=(e,t,n)=>e.getValue(t)==n;n6.autoRemove=e=>Rs(e);const p_=(e,t,n)=>{let[s,r]=n;const o=e.getValue(t);return o>=s&&o<=r};p_.resolveFilterValue=e=>{let[t,n]=e,s=typeof t!="number"?parseFloat(t):t,r=typeof n!="number"?parseFloat(n):n,o=t===null||Number.isNaN(s)?-1/0:s,c=n===null||Number.isNaN(r)?1/0:r;if(o>c){const u=o;o=c,c=u}return[o,c]};p_.autoRemove=e=>Rs(e)||Rs(e[0])&&Rs(e[1]);const kr={includesString:W$,includesStringSensitive:Q$,equalsString:X$,arrIncludes:Z$,arrIncludesAll:J$,arrIncludesSome:e6,equals:t6,weakEquals:n6,inNumberRange:p_};function Rs(e){return e==null||e===""}const Ole={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:ns("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{const n=t.getCoreRowModel().flatRows[0],s=n==null?void 0:n.getValue(e.id);return typeof s=="string"?kr.includesString:typeof s=="number"?kr.inNumberRange:typeof s=="boolean"||s!==null&&typeof s=="object"?kr.equals:Array.isArray(s)?kr.arrIncludes:kr.weakEquals},e.getFilterFn=()=>{var n,s;return _m(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(n=(s=t.options.filterFns)==null?void 0:s[e.columnDef.filterFn])!=null?n:kr[e.columnDef.filterFn]},e.getCanFilter=()=>{var n,s,r;return((n=e.columnDef.enableColumnFilter)!=null?n:!0)&&((s=t.options.enableColumnFilters)!=null?s:!0)&&((r=t.options.enableFilters)!=null?r:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var n;return(n=t.getState().columnFilters)==null||(n=n.find(s=>s.id===e.id))==null?void 0:n.value},e.getFilterIndex=()=>{var n,s;return(n=(s=t.getState().columnFilters)==null?void 0:s.findIndex(r=>r.id===e.id))!=null?n:-1},e.setFilterValue=n=>{t.setColumnFilters(s=>{const r=e.getFilterFn(),o=s==null?void 0:s.find(p=>p.id===e.id),c=Fi(n,o?o.value:void 0);if(I4(r,c,e)){var u;return(u=s==null?void 0:s.filter(p=>p.id!==e.id))!=null?u:[]}const f={id:e.id,value:c};if(o){var h;return(h=s==null?void 0:s.map(p=>p.id===e.id?f:p))!=null?h:[]}return s!=null&&s.length?[...s,f]:[f]})}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=t=>{const n=e.getAllLeafColumns(),s=r=>{var o;return(o=Fi(t,r))==null?void 0:o.filter(c=>{const u=n.find(f=>f.id===c.id);if(u){const f=u.getFilterFn();if(I4(f,c.value,u))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(s)},e.resetColumnFilters=t=>{var n,s;e.setColumnFilters(t?[]:(n=(s=e.initialState)==null?void 0:s.columnFilters)!=null?n:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function I4(e,t,n){return(e&&e.autoRemove?e.autoRemove(t,n):!1)||typeof t>"u"||typeof t=="string"&&!t}const Lle=(e,t,n)=>n.reduce((s,r)=>{const o=r.getValue(e);return s+(typeof o=="number"?o:0)},0),Ple=(e,t,n)=>{let s;return n.forEach(r=>{const o=r.getValue(e);o!=null&&(s>o||s===void 0&&o>=o)&&(s=o)}),s},Dle=(e,t,n)=>{let s;return n.forEach(r=>{const o=r.getValue(e);o!=null&&(s<o||s===void 0&&o>=o)&&(s=o)}),s},qle=(e,t,n)=>{let s,r;return n.forEach(o=>{const c=o.getValue(e);c!=null&&(s===void 0?c>=c&&(s=r=c):(s>c&&(s=c),r<c&&(r=c)))}),[s,r]},$le=(e,t)=>{let n=0,s=0;if(t.forEach(r=>{let o=r.getValue(e);o!=null&&(o=+o)>=o&&(++n,s+=o)}),n)return s/n},zle=(e,t)=>{if(!t.length)return;const n=t.map(o=>o.getValue(e));if(!Rle(n))return;if(n.length===1)return n[0];const s=Math.floor(n.length/2),r=n.sort((o,c)=>o-c);return n.length%2!==0?r[s]:(r[s-1]+r[s])/2},Ble=(e,t)=>Array.from(new Set(t.map(n=>n.getValue(e))).values()),Fle=(e,t)=>new Set(t.map(n=>n.getValue(e))).size,Hle=(e,t)=>t.length,W1={sum:Lle,min:Ple,max:Dle,extent:qle,mean:$le,median:zle,unique:Ble,uniqueCount:Fle,count:Hle},Ule={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,n;return(t=(n=e.getValue())==null||n.toString==null?void 0:n.toString())!=null?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:ns("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping(n=>n!=null&&n.includes(e.id)?n.filter(s=>s!==e.id):[...n??[],e.id])},e.getCanGroup=()=>{var n,s;return((n=e.columnDef.enableGrouping)!=null?n:!0)&&((s=t.options.enableGrouping)!=null?s:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var n;return(n=t.getState().grouping)==null?void 0:n.includes(e.id)},e.getGroupedIndex=()=>{var n;return(n=t.getState().grouping)==null?void 0:n.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const n=e.getCanGroup();return()=>{n&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const n=t.getCoreRowModel().flatRows[0],s=n==null?void 0:n.getValue(e.id);if(typeof s=="number")return W1.sum;if(Object.prototype.toString.call(s)==="[object Date]")return W1.extent},e.getAggregationFn=()=>{var n,s;if(!e)throw new Error;return _m(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(n=(s=t.options.aggregationFns)==null?void 0:s[e.columnDef.aggregationFn])!=null?n:W1[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{var n,s;e.setGrouping(t?[]:(n=(s=e.initialState)==null?void 0:s.grouping)!=null?n:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];const s=t.getColumn(n);return s!=null&&s.columnDef.getGroupingValue?(e._groupingValuesCache[n]=s.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},e._groupingValuesCache={}},createCell:(e,t,n,s)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===n.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var r;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((r=n.subRows)!=null&&r.length)}}};function Vle(e,t,n){if(!(t!=null&&t.length)||!n)return e;const s=e.filter(o=>!t.includes(o.id));return n==="remove"?s:[...t.map(o=>e.find(c=>c.id===o)).filter(Boolean),...s]}const Gle={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:ns("columnOrder",e)}),createColumn:(e,t)=>{e.getIndex=Me(n=>[Nu(t,n)],n=>n.findIndex(s=>s.id===e.id),Ie(t.options,"debugColumns")),e.getIsFirstColumn=n=>{var s;return((s=Nu(t,n)[0])==null?void 0:s.id)===e.id},e.getIsLastColumn=n=>{var s;const r=Nu(t,n);return((s=r[r.length-1])==null?void 0:s.id)===e.id}},createTable:e=>{e.setColumnOrder=t=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{var n;e.setColumnOrder(t?[]:(n=e.initialState.columnOrder)!=null?n:[])},e._getOrderColumnsFn=Me(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(t,n,s)=>r=>{let o=[];if(!(t!=null&&t.length))o=r;else{const c=[...t],u=[...r];for(;u.length&&c.length;){const f=c.shift(),h=u.findIndex(p=>p.id===f);h>-1&&o.push(u.splice(h,1)[0])}o=[...o,...u]}return Vle(o,n,s)},Ie(e.options,"debugTable"))}},Q1=()=>({left:[],right:[]}),Kle={getInitialState:e=>({columnPinning:Q1(),...e}),getDefaultOptions:e=>({onColumnPinningChange:ns("columnPinning",e)}),createColumn:(e,t)=>{e.pin=n=>{const s=e.getLeafColumns().map(r=>r.id).filter(Boolean);t.setColumnPinning(r=>{var o,c;if(n==="right"){var u,f;return{left:((u=r==null?void 0:r.left)!=null?u:[]).filter(g=>!(s!=null&&s.includes(g))),right:[...((f=r==null?void 0:r.right)!=null?f:[]).filter(g=>!(s!=null&&s.includes(g))),...s]}}if(n==="left"){var h,p;return{left:[...((h=r==null?void 0:r.left)!=null?h:[]).filter(g=>!(s!=null&&s.includes(g))),...s],right:((p=r==null?void 0:r.right)!=null?p:[]).filter(g=>!(s!=null&&s.includes(g)))}}return{left:((o=r==null?void 0:r.left)!=null?o:[]).filter(g=>!(s!=null&&s.includes(g))),right:((c=r==null?void 0:r.right)!=null?c:[]).filter(g=>!(s!=null&&s.includes(g)))}})},e.getCanPin=()=>e.getLeafColumns().some(s=>{var r,o,c;return((r=s.columnDef.enablePinning)!=null?r:!0)&&((o=(c=t.options.enableColumnPinning)!=null?c:t.options.enablePinning)!=null?o:!0)}),e.getIsPinned=()=>{const n=e.getLeafColumns().map(u=>u.id),{left:s,right:r}=t.getState().columnPinning,o=n.some(u=>s==null?void 0:s.includes(u)),c=n.some(u=>r==null?void 0:r.includes(u));return o?"left":c?"right":!1},e.getPinnedIndex=()=>{var n,s;const r=e.getIsPinned();return r?(n=(s=t.getState().columnPinning)==null||(s=s[r])==null?void 0:s.indexOf(e.id))!=null?n:-1:0}},createRow:(e,t)=>{e.getCenterVisibleCells=Me(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(n,s,r)=>{const o=[...s??[],...r??[]];return n.filter(c=>!o.includes(c.column.id))},Ie(t.options,"debugRows")),e.getLeftVisibleCells=Me(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left],(n,s)=>(s??[]).map(o=>n.find(c=>c.column.id===o)).filter(Boolean).map(o=>({...o,position:"left"})),Ie(t.options,"debugRows")),e.getRightVisibleCells=Me(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(n,s)=>(s??[]).map(o=>n.find(c=>c.column.id===o)).filter(Boolean).map(o=>({...o,position:"right"})),Ie(t.options,"debugRows"))},createTable:e=>{e.setColumnPinning=t=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>{var n,s;return e.setColumnPinning(t?Q1():(n=(s=e.initialState)==null?void 0:s.columnPinning)!=null?n:Q1())},e.getIsSomeColumnsPinned=t=>{var n;const s=e.getState().columnPinning;if(!t){var r,o;return!!((r=s.left)!=null&&r.length||(o=s.right)!=null&&o.length)}return!!((n=s[t])!=null&&n.length)},e.getLeftLeafColumns=Me(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(t,n)=>(n??[]).map(s=>t.find(r=>r.id===s)).filter(Boolean),Ie(e.options,"debugColumns")),e.getRightLeafColumns=Me(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(t,n)=>(n??[]).map(s=>t.find(r=>r.id===s)).filter(Boolean),Ie(e.options,"debugColumns")),e.getCenterLeafColumns=Me(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,s)=>{const r=[...n??[],...s??[]];return t.filter(o=>!r.includes(o.id))},Ie(e.options,"debugColumns"))}};function Yle(e){return e||(typeof document<"u"?document:null)}const Th={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},X1=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),Wle={getDefaultColumnDef:()=>Th,getInitialState:e=>({columnSizing:{},columnSizingInfo:X1(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:ns("columnSizing",e),onColumnSizingInfoChange:ns("columnSizingInfo",e)}),createColumn:(e,t)=>{e.getSize=()=>{var n,s,r;const o=t.getState().columnSizing[e.id];return Math.min(Math.max((n=e.columnDef.minSize)!=null?n:Th.minSize,(s=o??e.columnDef.size)!=null?s:Th.size),(r=e.columnDef.maxSize)!=null?r:Th.maxSize)},e.getStart=Me(n=>[n,Nu(t,n),t.getState().columnSizing],(n,s)=>s.slice(0,e.getIndex(n)).reduce((r,o)=>r+o.getSize(),0),Ie(t.options,"debugColumns")),e.getAfter=Me(n=>[n,Nu(t,n),t.getState().columnSizing],(n,s)=>s.slice(e.getIndex(n)+1).reduce((r,o)=>r+o.getSize(),0),Ie(t.options,"debugColumns")),e.resetSize=()=>{t.setColumnSizing(n=>{let{[e.id]:s,...r}=n;return r})},e.getCanResize=()=>{var n,s;return((n=e.columnDef.enableResizing)!=null?n:!0)&&((s=t.options.enableColumnResizing)!=null?s:!0)},e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let n=0;const s=r=>{if(r.subHeaders.length)r.subHeaders.forEach(s);else{var o;n+=(o=r.column.getSize())!=null?o:0}};return s(e),n},e.getStart=()=>{if(e.index>0){const n=e.headerGroup.headers[e.index-1];return n.getStart()+n.getSize()}return 0},e.getResizeHandler=n=>{const s=t.getColumn(e.column.id),r=s==null?void 0:s.getCanResize();return o=>{if(!s||!r||(o.persist==null||o.persist(),Z1(o)&&o.touches&&o.touches.length>1))return;const c=e.getSize(),u=e?e.getLeafHeaders().map(N=>[N.column.id,N.column.getSize()]):[[s.id,s.getSize()]],f=Z1(o)?Math.round(o.touches[0].clientX):o.clientX,h={},p=(N,C)=>{typeof C=="number"&&(t.setColumnSizingInfo(k=>{var _,E;const M=t.options.columnResizeDirection==="rtl"?-1:1,A=(C-((_=k==null?void 0:k.startOffset)!=null?_:0))*M,O=Math.max(A/((E=k==null?void 0:k.startSize)!=null?E:0),-.999999);return k.columnSizingStart.forEach(L=>{let[P,I]=L;h[P]=Math.round(Math.max(I+I*O,0)*100)/100}),{...k,deltaOffset:A,deltaPercentage:O}}),(t.options.columnResizeMode==="onChange"||N==="end")&&t.setColumnSizing(k=>({...k,...h})))},g=N=>p("move",N),x=N=>{p("end",N),t.setColumnSizingInfo(C=>({...C,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},v=Yle(n),b={moveHandler:N=>g(N.clientX),upHandler:N=>{v==null||v.removeEventListener("mousemove",b.moveHandler),v==null||v.removeEventListener("mouseup",b.upHandler),x(N.clientX)}},w={moveHandler:N=>(N.cancelable&&(N.preventDefault(),N.stopPropagation()),g(N.touches[0].clientX),!1),upHandler:N=>{var C;v==null||v.removeEventListener("touchmove",w.moveHandler),v==null||v.removeEventListener("touchend",w.upHandler),N.cancelable&&(N.preventDefault(),N.stopPropagation()),x((C=N.touches[0])==null?void 0:C.clientX)}},S=Qle()?{passive:!1}:!1;Z1(o)?(v==null||v.addEventListener("touchmove",w.moveHandler,S),v==null||v.addEventListener("touchend",w.upHandler,S)):(v==null||v.addEventListener("mousemove",b.moveHandler,S),v==null||v.addEventListener("mouseup",b.upHandler,S)),t.setColumnSizingInfo(N=>({...N,startOffset:f,startSize:c,deltaOffset:0,deltaPercentage:0,columnSizingStart:u,isResizingColumn:s.id}))}}},createTable:e=>{e.setColumnSizing=t=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{var n;e.setColumnSizing(t?{}:(n=e.initialState.columnSizing)!=null?n:{})},e.resetHeaderSizeInfo=t=>{var n;e.setColumnSizingInfo(t?X1():(n=e.initialState.columnSizingInfo)!=null?n:X1())},e.getTotalSize=()=>{var t,n;return(t=(n=e.getHeaderGroups()[0])==null?void 0:n.headers.reduce((s,r)=>s+r.getSize(),0))!=null?t:0},e.getLeftTotalSize=()=>{var t,n;return(t=(n=e.getLeftHeaderGroups()[0])==null?void 0:n.headers.reduce((s,r)=>s+r.getSize(),0))!=null?t:0},e.getCenterTotalSize=()=>{var t,n;return(t=(n=e.getCenterHeaderGroups()[0])==null?void 0:n.headers.reduce((s,r)=>s+r.getSize(),0))!=null?t:0},e.getRightTotalSize=()=>{var t,n;return(t=(n=e.getRightHeaderGroups()[0])==null?void 0:n.headers.reduce((s,r)=>s+r.getSize(),0))!=null?t:0}}};let Mh=null;function Qle(){if(typeof Mh=="boolean")return Mh;let e=!1;try{const t={get passive(){return e=!0,!1}},n=()=>{};window.addEventListener("test",n,t),window.removeEventListener("test",n)}catch{e=!1}return Mh=e,Mh}function Z1(e){return e.type==="touchstart"}const Xle={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:ns("columnVisibility",e)}),createColumn:(e,t)=>{e.toggleVisibility=n=>{e.getCanHide()&&t.setColumnVisibility(s=>({...s,[e.id]:n??!e.getIsVisible()}))},e.getIsVisible=()=>{var n,s;const r=e.columns;return(n=r.length?r.some(o=>o.getIsVisible()):(s=t.getState().columnVisibility)==null?void 0:s[e.id])!=null?n:!0},e.getCanHide=()=>{var n,s;return((n=e.columnDef.enableHiding)!=null?n:!0)&&((s=t.options.enableHiding)!=null?s:!0)},e.getToggleVisibilityHandler=()=>n=>{e.toggleVisibility==null||e.toggleVisibility(n.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=Me(()=>[e.getAllCells(),t.getState().columnVisibility],n=>n.filter(s=>s.column.getIsVisible()),Ie(t.options,"debugRows")),e.getVisibleCells=Me(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(n,s,r)=>[...n,...s,...r],Ie(t.options,"debugRows"))},createTable:e=>{const t=(n,s)=>Me(()=>[s(),s().filter(r=>r.getIsVisible()).map(r=>r.id).join("_")],r=>r.filter(o=>o.getIsVisible==null?void 0:o.getIsVisible()),Ie(e.options,"debugColumns"));e.getVisibleFlatColumns=t("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=t("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=t("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=t("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=t("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=n=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(n),e.resetColumnVisibility=n=>{var s;e.setColumnVisibility(n?{}:(s=e.initialState.columnVisibility)!=null?s:{})},e.toggleAllColumnsVisible=n=>{var s;n=(s=n)!=null?s:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((r,o)=>({...r,[o.id]:n||!(o.getCanHide!=null&&o.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(n=>!(n.getIsVisible!=null&&n.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(n=>n.getIsVisible==null?void 0:n.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>n=>{var s;e.toggleAllColumnsVisible((s=n.target)==null?void 0:s.checked)}}};function Nu(e,t){return t?t==="center"?e.getCenterVisibleLeafColumns():t==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const Zle={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},Jle={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:ns("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var n;const s=(n=e.getCoreRowModel().flatRows[0])==null||(n=n._getAllCellsByColumnId()[t.id])==null?void 0:n.getValue();return typeof s=="string"||typeof s=="number"}}),createColumn:(e,t)=>{e.getCanGlobalFilter=()=>{var n,s,r,o;return((n=e.columnDef.enableGlobalFilter)!=null?n:!0)&&((s=t.options.enableGlobalFilter)!=null?s:!0)&&((r=t.options.enableFilters)!=null?r:!0)&&((o=t.options.getColumnCanGlobalFilter==null?void 0:t.options.getColumnCanGlobalFilter(e))!=null?o:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>kr.includesString,e.getGlobalFilterFn=()=>{var t,n;const{globalFilterFn:s}=e.options;return _m(s)?s:s==="auto"?e.getGlobalAutoFilterFn():(t=(n=e.options.filterFns)==null?void 0:n[s])!=null?t:kr[s]},e.setGlobalFilter=t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},ece={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:ns("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;e._autoResetExpanded=()=>{var s,r;if(!t){e._queue(()=>{t=!0});return}if((s=(r=e.options.autoResetAll)!=null?r:e.options.autoResetExpanded)!=null?s:!e.options.manualExpanding){if(n)return;n=!0,e._queue(()=>{e.resetExpanded(),n=!1})}},e.setExpanded=s=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(s),e.toggleAllRowsExpanded=s=>{s??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=s=>{var r,o;e.setExpanded(s?{}:(r=(o=e.initialState)==null?void 0:o.expanded)!=null?r:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(s=>s.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>s=>{s.persist==null||s.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const s=e.getState().expanded;return s===!0||Object.values(s).some(Boolean)},e.getIsAllRowsExpanded=()=>{const s=e.getState().expanded;return typeof s=="boolean"?s===!0:!(!Object.keys(s).length||e.getRowModel().flatRows.some(r=>!r.getIsExpanded()))},e.getExpandedDepth=()=>{let s=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(o=>{const c=o.split(".");s=Math.max(s,c.length)}),s},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,t)=>{e.toggleExpanded=n=>{t.setExpanded(s=>{var r;const o=s===!0?!0:!!(s!=null&&s[e.id]);let c={};if(s===!0?Object.keys(t.getRowModel().rowsById).forEach(u=>{c[u]=!0}):c=s,n=(r=n)!=null?r:!o,!o&&n)return{...c,[e.id]:!0};if(o&&!n){const{[e.id]:u,...f}=c;return f}return s})},e.getIsExpanded=()=>{var n;const s=t.getState().expanded;return!!((n=t.options.getIsRowExpanded==null?void 0:t.options.getIsRowExpanded(e))!=null?n:s===!0||s!=null&&s[e.id])},e.getCanExpand=()=>{var n,s,r;return(n=t.options.getRowCanExpand==null?void 0:t.options.getRowCanExpand(e))!=null?n:((s=t.options.enableExpanding)!=null?s:!0)&&!!((r=e.subRows)!=null&&r.length)},e.getIsAllParentsExpanded=()=>{let n=!0,s=e;for(;n&&s.parentId;)s=t.getRow(s.parentId,!0),n=s.getIsExpanded();return n},e.getToggleExpandedHandler=()=>{const n=e.getCanExpand();return()=>{n&&e.toggleExpanded()}}}},aj=0,oj=10,J1=()=>({pageIndex:aj,pageSize:oj}),tce={getInitialState:e=>({...e,pagination:{...J1(),...e==null?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:ns("pagination",e)}),createTable:e=>{let t=!1,n=!1;e._autoResetPageIndex=()=>{var s,r;if(!t){e._queue(()=>{t=!0});return}if((s=(r=e.options.autoResetAll)!=null?r:e.options.autoResetPageIndex)!=null?s:!e.options.manualPagination){if(n)return;n=!0,e._queue(()=>{e.resetPageIndex(),n=!1})}},e.setPagination=s=>{const r=o=>Fi(s,o);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(r)},e.resetPagination=s=>{var r;e.setPagination(s?J1():(r=e.initialState.pagination)!=null?r:J1())},e.setPageIndex=s=>{e.setPagination(r=>{let o=Fi(s,r.pageIndex);const c=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return o=Math.max(0,Math.min(o,c)),{...r,pageIndex:o}})},e.resetPageIndex=s=>{var r,o;e.setPageIndex(s?aj:(r=(o=e.initialState)==null||(o=o.pagination)==null?void 0:o.pageIndex)!=null?r:aj)},e.resetPageSize=s=>{var r,o;e.setPageSize(s?oj:(r=(o=e.initialState)==null||(o=o.pagination)==null?void 0:o.pageSize)!=null?r:oj)},e.setPageSize=s=>{e.setPagination(r=>{const o=Math.max(1,Fi(s,r.pageSize)),c=r.pageSize*r.pageIndex,u=Math.floor(c/o);return{...r,pageIndex:u,pageSize:o}})},e.setPageCount=s=>e.setPagination(r=>{var o;let c=Fi(s,(o=e.options.pageCount)!=null?o:-1);return typeof c=="number"&&(c=Math.max(-1,c)),{...r,pageCount:c}}),e.getPageOptions=Me(()=>[e.getPageCount()],s=>{let r=[];return s&&s>0&&(r=[...new Array(s)].fill(null).map((o,c)=>c)),r},Ie(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:s}=e.getState().pagination,r=e.getPageCount();return r===-1?!0:r===0?!1:s<r-1},e.previousPage=()=>e.setPageIndex(s=>s-1),e.nextPage=()=>e.setPageIndex(s=>s+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var s;return(s=e.options.pageCount)!=null?s:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var s;return(s=e.options.rowCount)!=null?s:e.getPrePaginationRowModel().rows.length}}},eS=()=>({top:[],bottom:[]}),nce={getInitialState:e=>({rowPinning:eS(),...e}),getDefaultOptions:e=>({onRowPinningChange:ns("rowPinning",e)}),createRow:(e,t)=>{e.pin=(n,s,r)=>{const o=s?e.getLeafRows().map(f=>{let{id:h}=f;return h}):[],c=r?e.getParentRows().map(f=>{let{id:h}=f;return h}):[],u=new Set([...c,e.id,...o]);t.setRowPinning(f=>{var h,p;if(n==="bottom"){var g,x;return{top:((g=f==null?void 0:f.top)!=null?g:[]).filter(w=>!(u!=null&&u.has(w))),bottom:[...((x=f==null?void 0:f.bottom)!=null?x:[]).filter(w=>!(u!=null&&u.has(w))),...Array.from(u)]}}if(n==="top"){var v,b;return{top:[...((v=f==null?void 0:f.top)!=null?v:[]).filter(w=>!(u!=null&&u.has(w))),...Array.from(u)],bottom:((b=f==null?void 0:f.bottom)!=null?b:[]).filter(w=>!(u!=null&&u.has(w)))}}return{top:((h=f==null?void 0:f.top)!=null?h:[]).filter(w=>!(u!=null&&u.has(w))),bottom:((p=f==null?void 0:f.bottom)!=null?p:[]).filter(w=>!(u!=null&&u.has(w)))}})},e.getCanPin=()=>{var n;const{enableRowPinning:s,enablePinning:r}=t.options;return typeof s=="function"?s(e):(n=s??r)!=null?n:!0},e.getIsPinned=()=>{const n=[e.id],{top:s,bottom:r}=t.getState().rowPinning,o=n.some(u=>s==null?void 0:s.includes(u)),c=n.some(u=>r==null?void 0:r.includes(u));return o?"top":c?"bottom":!1},e.getPinnedIndex=()=>{var n,s;const r=e.getIsPinned();if(!r)return-1;const o=(n=r==="top"?t.getTopRows():t.getBottomRows())==null?void 0:n.map(c=>{let{id:u}=c;return u});return(s=o==null?void 0:o.indexOf(e.id))!=null?s:-1}},createTable:e=>{e.setRowPinning=t=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>{var n,s;return e.setRowPinning(t?eS():(n=(s=e.initialState)==null?void 0:s.rowPinning)!=null?n:eS())},e.getIsSomeRowsPinned=t=>{var n;const s=e.getState().rowPinning;if(!t){var r,o;return!!((r=s.top)!=null&&r.length||(o=s.bottom)!=null&&o.length)}return!!((n=s[t])!=null&&n.length)},e._getPinnedRows=(t,n,s)=>{var r;return((r=e.options.keepPinnedRows)==null||r?(n??[]).map(c=>{const u=e.getRow(c,!0);return u.getIsAllParentsExpanded()?u:null}):(n??[]).map(c=>t.find(u=>u.id===c))).filter(Boolean).map(c=>({...c,position:s}))},e.getTopRows=Me(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(t,n)=>e._getPinnedRows(t,n,"top"),Ie(e.options,"debugRows")),e.getBottomRows=Me(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(t,n)=>e._getPinnedRows(t,n,"bottom"),Ie(e.options,"debugRows")),e.getCenterRows=Me(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(t,n,s)=>{const r=new Set([...n??[],...s??[]]);return t.filter(o=>!r.has(o.id))},Ie(e.options,"debugRows"))}},sce={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:ns("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>{var n;return e.setRowSelection(t?{}:(n=e.initialState.rowSelection)!=null?n:{})},e.toggleAllRowsSelected=t=>{e.setRowSelection(n=>{t=typeof t<"u"?t:!e.getIsAllRowsSelected();const s={...n},r=e.getPreGroupedRowModel().flatRows;return t?r.forEach(o=>{o.getCanSelect()&&(s[o.id]=!0)}):r.forEach(o=>{delete s[o.id]}),s})},e.toggleAllPageRowsSelected=t=>e.setRowSelection(n=>{const s=typeof t<"u"?t:!e.getIsAllPageRowsSelected(),r={...n};return e.getRowModel().rows.forEach(o=>{lj(r,o.id,s,!0,e)}),r}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=Me(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?tS(e,n):{rows:[],flatRows:[],rowsById:{}},Ie(e.options,"debugTable")),e.getFilteredSelectedRowModel=Me(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?tS(e,n):{rows:[],flatRows:[],rowsById:{}},Ie(e.options,"debugTable")),e.getGroupedSelectedRowModel=Me(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?tS(e,n):{rows:[],flatRows:[],rowsById:{}},Ie(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState();let s=!!(t.length&&Object.keys(n).length);return s&&t.some(r=>r.getCanSelect()&&!n[r.id])&&(s=!1),s},e.getIsAllPageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows.filter(r=>r.getCanSelect()),{rowSelection:n}=e.getState();let s=!!t.length;return s&&t.some(r=>!n[r.id])&&(s=!1),s},e.getIsSomeRowsSelected=()=>{var t;const n=Object.keys((t=e.getState().rowSelection)!=null?t:{}).length;return n>0&&n<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:t.filter(n=>n.getCanSelect()).some(n=>n.getIsSelected()||n.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(n,s)=>{const r=e.getIsSelected();t.setRowSelection(o=>{var c;if(n=typeof n<"u"?n:!r,e.getCanSelect()&&r===n)return o;const u={...o};return lj(u,e.id,n,(c=s==null?void 0:s.selectChildren)!=null?c:!0,t),u})},e.getIsSelected=()=>{const{rowSelection:n}=t.getState();return m_(e,n)},e.getIsSomeSelected=()=>{const{rowSelection:n}=t.getState();return cj(e,n)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:n}=t.getState();return cj(e,n)==="all"},e.getCanSelect=()=>{var n;return typeof t.options.enableRowSelection=="function"?t.options.enableRowSelection(e):(n=t.options.enableRowSelection)!=null?n:!0},e.getCanSelectSubRows=()=>{var n;return typeof t.options.enableSubRowSelection=="function"?t.options.enableSubRowSelection(e):(n=t.options.enableSubRowSelection)!=null?n:!0},e.getCanMultiSelect=()=>{var n;return typeof t.options.enableMultiRowSelection=="function"?t.options.enableMultiRowSelection(e):(n=t.options.enableMultiRowSelection)!=null?n:!0},e.getToggleSelectedHandler=()=>{const n=e.getCanSelect();return s=>{var r;n&&e.toggleSelected((r=s.target)==null?void 0:r.checked)}}}},lj=(e,t,n,s,r)=>{var o;const c=r.getRow(t,!0);n?(c.getCanMultiSelect()||Object.keys(e).forEach(u=>delete e[u]),c.getCanSelect()&&(e[t]=!0)):delete e[t],s&&(o=c.subRows)!=null&&o.length&&c.getCanSelectSubRows()&&c.subRows.forEach(u=>lj(e,u.id,n,s,r))};function tS(e,t){const n=e.getState().rowSelection,s=[],r={},o=function(c,u){return c.map(f=>{var h;const p=m_(f,n);if(p&&(s.push(f),r[f.id]=f),(h=f.subRows)!=null&&h.length&&(f={...f,subRows:o(f.subRows)}),p)return f}).filter(Boolean)};return{rows:o(t.rows),flatRows:s,rowsById:r}}function m_(e,t){var n;return(n=t[e.id])!=null?n:!1}function cj(e,t,n){var s;if(!((s=e.subRows)!=null&&s.length))return!1;let r=!0,o=!1;return e.subRows.forEach(c=>{if(!(o&&!r)&&(c.getCanSelect()&&(m_(c,t)?o=!0:r=!1),c.subRows&&c.subRows.length)){const u=cj(c,t);u==="all"?o=!0:(u==="some"&&(o=!0),r=!1)}}),r?"all":o?"some":!1}const uj=/([0-9]+)/gm,rce=(e,t,n)=>s6(Qi(e.getValue(n)).toLowerCase(),Qi(t.getValue(n)).toLowerCase()),ice=(e,t,n)=>s6(Qi(e.getValue(n)),Qi(t.getValue(n))),ace=(e,t,n)=>g_(Qi(e.getValue(n)).toLowerCase(),Qi(t.getValue(n)).toLowerCase()),oce=(e,t,n)=>g_(Qi(e.getValue(n)),Qi(t.getValue(n))),lce=(e,t,n)=>{const s=e.getValue(n),r=t.getValue(n);return s>r?1:s<r?-1:0},cce=(e,t,n)=>g_(e.getValue(n),t.getValue(n));function g_(e,t){return e===t?0:e>t?1:-1}function Qi(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function s6(e,t){const n=e.split(uj).filter(Boolean),s=t.split(uj).filter(Boolean);for(;n.length&&s.length;){const r=n.shift(),o=s.shift(),c=parseInt(r,10),u=parseInt(o,10),f=[c,u].sort();if(isNaN(f[0])){if(r>o)return 1;if(o>r)return-1;continue}if(isNaN(f[1]))return isNaN(c)?-1:1;if(c>u)return 1;if(u>c)return-1}return n.length-s.length}const fu={alphanumeric:rce,alphanumericCaseSensitive:ice,text:ace,textCaseSensitive:oce,datetime:lce,basic:cce},uce={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:ns("sorting",e),isMultiSortEvent:t=>t.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{const n=t.getFilteredRowModel().flatRows.slice(10);let s=!1;for(const r of n){const o=r==null?void 0:r.getValue(e.id);if(Object.prototype.toString.call(o)==="[object Date]")return fu.datetime;if(typeof o=="string"&&(s=!0,o.split(uj).length>1))return fu.alphanumeric}return s?fu.text:fu.basic},e.getAutoSortDir=()=>{const n=t.getFilteredRowModel().flatRows[0];return typeof(n==null?void 0:n.getValue(e.id))=="string"?"asc":"desc"},e.getSortingFn=()=>{var n,s;if(!e)throw new Error;return _m(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(n=(s=t.options.sortingFns)==null?void 0:s[e.columnDef.sortingFn])!=null?n:fu[e.columnDef.sortingFn]},e.toggleSorting=(n,s)=>{const r=e.getNextSortingOrder(),o=typeof n<"u"&&n!==null;t.setSorting(c=>{const u=c==null?void 0:c.find(v=>v.id===e.id),f=c==null?void 0:c.findIndex(v=>v.id===e.id);let h=[],p,g=o?n:r==="desc";if(c!=null&&c.length&&e.getCanMultiSort()&&s?u?p="toggle":p="add":c!=null&&c.length&&f!==c.length-1?p="replace":u?p="toggle":p="replace",p==="toggle"&&(o||r||(p="remove")),p==="add"){var x;h=[...c,{id:e.id,desc:g}],h.splice(0,h.length-((x=t.options.maxMultiSortColCount)!=null?x:Number.MAX_SAFE_INTEGER))}else p==="toggle"?h=c.map(v=>v.id===e.id?{...v,desc:g}:v):p==="remove"?h=c.filter(v=>v.id!==e.id):h=[{id:e.id,desc:g}];return h})},e.getFirstSortDir=()=>{var n,s;return((n=(s=e.columnDef.sortDescFirst)!=null?s:t.options.sortDescFirst)!=null?n:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=n=>{var s,r;const o=e.getFirstSortDir(),c=e.getIsSorted();return c?c!==o&&((s=t.options.enableSortingRemoval)==null||s)&&(!(n&&(r=t.options.enableMultiRemove)!=null)||r)?!1:c==="desc"?"asc":"desc":o},e.getCanSort=()=>{var n,s;return((n=e.columnDef.enableSorting)!=null?n:!0)&&((s=t.options.enableSorting)!=null?s:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var n,s;return(n=(s=e.columnDef.enableMultiSort)!=null?s:t.options.enableMultiSort)!=null?n:!!e.accessorFn},e.getIsSorted=()=>{var n;const s=(n=t.getState().sorting)==null?void 0:n.find(r=>r.id===e.id);return s?s.desc?"desc":"asc":!1},e.getSortIndex=()=>{var n,s;return(n=(s=t.getState().sorting)==null?void 0:s.findIndex(r=>r.id===e.id))!=null?n:-1},e.clearSorting=()=>{t.setSorting(n=>n!=null&&n.length?n.filter(s=>s.id!==e.id):[])},e.getToggleSortingHandler=()=>{const n=e.getCanSort();return s=>{n&&(s.persist==null||s.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?t.options.isMultiSortEvent==null?void 0:t.options.isMultiSortEvent(s):!1))}}},createTable:e=>{e.setSorting=t=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{var n,s;e.setSorting(t?[]:(n=(s=e.initialState)==null?void 0:s.sorting)!=null?n:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},dce=[Mle,Xle,Gle,Kle,Ile,Ole,Zle,Jle,uce,Ule,ece,tce,nce,sce,Wle];function fce(e){var t,n;const s=[...dce,...(t=e._features)!=null?t:[]];let r={_features:s};const o=r._features.reduce((x,v)=>Object.assign(x,v.getDefaultOptions==null?void 0:v.getDefaultOptions(r)),{}),c=x=>r.options.mergeOptions?r.options.mergeOptions(o,x):{...o,...x};let f={...{},...(n=e.initialState)!=null?n:{}};r._features.forEach(x=>{var v;f=(v=x.getInitialState==null?void 0:x.getInitialState(f))!=null?v:f});const h=[];let p=!1;const g={_features:s,options:{...o,...e},initialState:f,_queue:x=>{h.push(x),p||(p=!0,Promise.resolve().then(()=>{for(;h.length;)h.shift()();p=!1}).catch(v=>setTimeout(()=>{throw v})))},reset:()=>{r.setState(r.initialState)},setOptions:x=>{const v=Fi(x,r.options);r.options=c(v)},getState:()=>r.options.state,setState:x=>{r.options.onStateChange==null||r.options.onStateChange(x)},_getRowId:(x,v,b)=>{var w;return(w=r.options.getRowId==null?void 0:r.options.getRowId(x,v,b))!=null?w:`${b?[b.id,v].join("."):v}`},getCoreRowModel:()=>(r._getCoreRowModel||(r._getCoreRowModel=r.options.getCoreRowModel(r)),r._getCoreRowModel()),getRowModel:()=>r.getPaginationRowModel(),getRow:(x,v)=>{let b=(v?r.getPrePaginationRowModel():r.getRowModel()).rowsById[x];if(!b&&(b=r.getCoreRowModel().rowsById[x],!b))throw new Error;return b},_getDefaultColumnDef:Me(()=>[r.options.defaultColumn],x=>{var v;return x=(v=x)!=null?v:{},{header:b=>{const w=b.header.column.columnDef;return w.accessorKey?w.accessorKey:w.accessorFn?w.id:null},cell:b=>{var w,S;return(w=(S=b.renderValue())==null||S.toString==null?void 0:S.toString())!=null?w:null},...r._features.reduce((b,w)=>Object.assign(b,w.getDefaultColumnDef==null?void 0:w.getDefaultColumnDef()),{}),...x}},Ie(e,"debugColumns")),_getColumnDefs:()=>r.options.columns,getAllColumns:Me(()=>[r._getColumnDefs()],x=>{const v=function(b,w,S){return S===void 0&&(S=0),b.map(N=>{const C=Tle(r,N,S,w),k=N;return C.columns=k.columns?v(k.columns,C,S+1):[],C})};return v(x)},Ie(e,"debugColumns")),getAllFlatColumns:Me(()=>[r.getAllColumns()],x=>x.flatMap(v=>v.getFlatColumns()),Ie(e,"debugColumns")),_getAllFlatColumnsById:Me(()=>[r.getAllFlatColumns()],x=>x.reduce((v,b)=>(v[b.id]=b,v),{}),Ie(e,"debugColumns")),getAllLeafColumns:Me(()=>[r.getAllColumns(),r._getOrderColumnsFn()],(x,v)=>{let b=x.flatMap(w=>w.getLeafColumns());return v(b)},Ie(e,"debugColumns")),getColumn:x=>r._getAllFlatColumnsById()[x]};Object.assign(r,g);for(let x=0;x<r._features.length;x++){const v=r._features[x];v==null||v.createTable==null||v.createTable(r)}return r}function hce(){return e=>Me(()=>[e.options.data],t=>{const n={rows:[],flatRows:[],rowsById:{}},s=function(r,o,c){o===void 0&&(o=0);const u=[];for(let h=0;h<r.length;h++){const p=h_(e,e._getRowId(r[h],h,c),r[h],h,o,void 0,c==null?void 0:c.id);if(n.flatRows.push(p),n.rowsById[p.id]=p,u.push(p),e.options.getSubRows){var f;p.originalSubRows=e.options.getSubRows(r[h],h),(f=p.originalSubRows)!=null&&f.length&&(p.subRows=s(p.originalSubRows,o+1,p))}}return u};return n.rows=s(t),n},Ie(e.options,"debugTable","getRowModel",()=>e._autoResetPageIndex()))}function pce(e,t,n){return n.options.filterFromLeafRows?mce(e,t,n):gce(e,t,n)}function mce(e,t,n){var s;const r=[],o={},c=(s=n.options.maxLeafRowFilterDepth)!=null?s:100,u=function(f,h){h===void 0&&(h=0);const p=[];for(let x=0;x<f.length;x++){var g;let v=f[x];const b=h_(n,v.id,v.original,v.index,v.depth,void 0,v.parentId);if(b.columnFilters=v.columnFilters,(g=v.subRows)!=null&&g.length&&h<c){if(b.subRows=u(v.subRows,h+1),v=b,t(v)&&!b.subRows.length){p.push(v),o[v.id]=v,r.push(v);continue}if(t(v)||b.subRows.length){p.push(v),o[v.id]=v,r.push(v);continue}}else v=b,t(v)&&(p.push(v),o[v.id]=v,r.push(v))}return p};return{rows:u(e),flatRows:r,rowsById:o}}function gce(e,t,n){var s;const r=[],o={},c=(s=n.options.maxLeafRowFilterDepth)!=null?s:100,u=function(f,h){h===void 0&&(h=0);const p=[];for(let x=0;x<f.length;x++){let v=f[x];if(t(v)){var g;if((g=v.subRows)!=null&&g.length&&h<c){const w=h_(n,v.id,v.original,v.index,v.depth,void 0,v.parentId);w.subRows=u(v.subRows,h+1),v=w}p.push(v),r.push(v),o[v.id]=v}}return p};return{rows:u(e),flatRows:r,rowsById:o}}function xce(){return e=>Me(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(t,n,s)=>{if(!t.rows.length||!(n!=null&&n.length)&&!s){for(let x=0;x<t.flatRows.length;x++)t.flatRows[x].columnFilters={},t.flatRows[x].columnFiltersMeta={};return t}const r=[],o=[];(n??[]).forEach(x=>{var v;const b=e.getColumn(x.id);if(!b)return;const w=b.getFilterFn();w&&r.push({id:x.id,filterFn:w,resolvedValue:(v=w.resolveFilterValue==null?void 0:w.resolveFilterValue(x.value))!=null?v:x.value})});const c=(n??[]).map(x=>x.id),u=e.getGlobalFilterFn(),f=e.getAllLeafColumns().filter(x=>x.getCanGlobalFilter());s&&u&&f.length&&(c.push("__global__"),f.forEach(x=>{var v;o.push({id:x.id,filterFn:u,resolvedValue:(v=u.resolveFilterValue==null?void 0:u.resolveFilterValue(s))!=null?v:s})}));let h,p;for(let x=0;x<t.flatRows.length;x++){const v=t.flatRows[x];if(v.columnFilters={},r.length)for(let b=0;b<r.length;b++){h=r[b];const w=h.id;v.columnFilters[w]=h.filterFn(v,w,h.resolvedValue,S=>{v.columnFiltersMeta[w]=S})}if(o.length){for(let b=0;b<o.length;b++){p=o[b];const w=p.id;if(p.filterFn(v,w,p.resolvedValue,S=>{v.columnFiltersMeta[w]=S})){v.columnFilters.__global__=!0;break}}v.columnFilters.__global__!==!0&&(v.columnFilters.__global__=!1)}}const g=x=>{for(let v=0;v<c.length;v++)if(x.columnFilters[c[v]]===!1)return!1;return!0};return pce(t.rows,g,e)},Ie(e.options,"debugTable","getFilteredRowModel",()=>e._autoResetPageIndex()))}function vce(){return e=>Me(()=>[e.getState().sorting,e.getPreSortedRowModel()],(t,n)=>{if(!n.rows.length||!(t!=null&&t.length))return n;const s=e.getState().sorting,r=[],o=s.filter(f=>{var h;return(h=e.getColumn(f.id))==null?void 0:h.getCanSort()}),c={};o.forEach(f=>{const h=e.getColumn(f.id);h&&(c[f.id]={sortUndefined:h.columnDef.sortUndefined,invertSorting:h.columnDef.invertSorting,sortingFn:h.getSortingFn()})});const u=f=>{const h=f.map(p=>({...p}));return h.sort((p,g)=>{for(let v=0;v<o.length;v+=1){var x;const b=o[v],w=c[b.id],S=w.sortUndefined,N=(x=b==null?void 0:b.desc)!=null?x:!1;let C=0;if(S){const k=p.getValue(b.id),_=g.getValue(b.id),E=k===void 0,M=_===void 0;if(E||M){if(S==="first")return E?-1:1;if(S==="last")return E?1:-1;C=E&&M?0:E?S:-S}}if(C===0&&(C=w.sortingFn(p,g,b.id)),C!==0)return N&&(C*=-1),w.invertSorting&&(C*=-1),C}return p.index-g.index}),h.forEach(p=>{var g;r.push(p),(g=p.subRows)!=null&&g.length&&(p.subRows=u(p.subRows))}),h};return{rows:u(n.rows),flatRows:r,rowsById:n.rowsById}},Ie(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}/**
397
+ * react-table
398
+ *
399
+ * Copyright (c) TanStack
400
+ *
401
+ * This source code is licensed under the MIT license found in the
402
+ * LICENSE.md file in the root directory of this source tree.
403
+ *
404
+ * @license MIT
405
+ */function O4(e,t){return e?yce(e)?R.createElement(e,t):e:null}function yce(e){return bce(e)||typeof e=="function"||wce(e)}function bce(e){return typeof e=="function"&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function wce(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function Sce(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=R.useState(()=>({current:fce(t)})),[s,r]=R.useState(()=>n.current.initialState);return n.current.setOptions(o=>({...o,...e,state:{...s,...e.state},onStateChange:c=>{r(c),e.onStateChange==null||e.onStateChange(c)}})),n.current}const r6=R.forwardRef(({className:e,testId:t,...n},s)=>a.jsx("input",{ref:s,"data-testid":t,className:he("block w-full border border-stone-300 bg-white px-2 py-1 font-mono text-xs text-stone-900","hover:bg-stone-50 focus:border-stone-900 focus:bg-white focus:outline-none","disabled:bg-stone-100 disabled:text-stone-400 disabled:cursor-not-allowed",e),...n}));r6.displayName="VellumInput";async function jce(e){const t=await fetch(`/api/rigs/${encodeURIComponent(e)}/nodes`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}function Nce(e){return e==="running"||e==="ready"?"running":e==="active"?"active":e==="stopped"?"stopped":e==="attention_required"||e==="warning"?"warning":e==="failed"||e==="error"?"error":"info"}function _ce({row:e}){const t=u_();return a.jsxs("button",{type:"button","data-testid":`topology-table-cmux-${e.logicalId}`,onClick:n=>{n.stopPropagation(),t.mutate({rigId:e.rigId,logicalId:e.logicalId})},"aria-label":`Open ${e.logicalId} in cmux`,title:"Open in cmux",className:"inline-flex h-7 w-7 items-center justify-center border border-outline-variant bg-white/65 text-stone-700 opacity-0 shadow-[1px_1px_0_rgba(46,52,46,0.12)] transition-opacity hover:bg-stone-100 hover:text-stone-950 focus:!opacity-100 focus:opacity-100 focus:outline-none focus:ring-2 focus:ring-stone-900/20 group-hover:!opacity-100 group-hover:opacity-100 group-focus-within:!opacity-100 group-focus-within:opacity-100",children:[a.jsx(Pe,{tool:"cmux",size:"sm"}),a.jsx("span",{className:"sr-only",children:"CMUX"})]})}function Cce({row:e}){const t=e.contextUsage,n=(t==null?void 0:t.availability)==="known"&&typeof t.usedPercentage=="number";return a.jsx("span",{"data-testid":`topology-table-context-${e.logicalId}`,className:`font-mono text-xs font-bold ${FD(t==null?void 0:t.usedPercentage,t==null?void 0:t.fresh,t==null?void 0:t.availability)}`,title:n?(t==null?void 0:t.fresh)===!1?"Context usage (stale sample)":"Context usage (fresh)":"Context sample unavailable",children:n?`${t.usedPercentage}%`:"--"})}function kce({row:e}){const t=e.contextUsage,n=Za(t==null?void 0:t.totalInputTokens,t==null?void 0:t.totalOutputTokens),s=tm(n),r=nm(t==null?void 0:t.totalInputTokens,t==null?void 0:t.totalOutputTokens);return a.jsx("span",{"data-testid":`topology-table-tokens-${e.logicalId}`,className:`font-mono text-xs font-bold ${s?"text-stone-500":"text-stone-300"}`,title:r??"Token sample unavailable",children:s??"--"})}function Rce(){return[{accessorKey:"rigName",header:"Rig",cell:({getValue:e})=>a.jsx("span",{className:"font-mono text-xs",children:String(e())})},{accessorKey:"podName",header:"Pod",cell:({getValue:e})=>a.jsx("span",{className:"font-mono text-xs",children:String(e())})},{accessorKey:"logicalId",header:"Agent",cell:({row:e})=>{var t,n;return a.jsx(wN,{as:"span",state:((t=e.original.activityRing)==null?void 0:t.state)??"idle",flash:((n=e.original.activityRing)==null?void 0:n.flash)??null,reducedMotion:e.original.reducedMotion,testId:`topology-table-activity-ring-${e.original.logicalId}`,className:"inline-flex rounded-sm",ringClassName:"-inset-1",children:a.jsx("span",{className:"inline-flex min-w-0 items-center gap-1.5 font-mono text-xs",children:a.jsx("span",{className:"truncate",children:e.original.logicalId})})})}},{accessorKey:"runtime",header:"Runtime",cell:({getValue:e})=>a.jsx(_n,{runtime:String(e()??""),size:"xs",compact:!0,variant:"inline"})},{id:"context",header:"Context",sortingFn:(e,t)=>{var n,s;return(((n=e.original.contextUsage)==null?void 0:n.usedPercentage)??-1)-(((s=t.original.contextUsage)==null?void 0:s.usedPercentage)??-1)},cell:({row:e})=>a.jsx(Cce,{row:e.original})},{id:"tokens",header:"Tokens",sortingFn:(e,t)=>{var r,o,c,u;const n=Za((r=e.original.contextUsage)==null?void 0:r.totalInputTokens,(o=e.original.contextUsage)==null?void 0:o.totalOutputTokens)??-1,s=Za((c=t.original.contextUsage)==null?void 0:c.totalInputTokens,(u=t.original.contextUsage)==null?void 0:u.totalOutputTokens)??-1;return n-s},cell:({row:e})=>a.jsx(kce,{row:e.original})},{accessorKey:"status",header:"Status",cell:({getValue:e})=>a.jsx(jp,{status:Nce(String(e())),label:String(e()),variant:"pill"})},{id:"actions",header:"",enableSorting:!1,cell:({row:e})=>a.jsx(_ce,{row:e.original})}]}function x_({rigIdScope:e,podNameScope:t}){const n=Ot(),{data:s}=Ts(),r=GN(),o=R.useMemo(()=>e?(s==null?void 0:s.filter(N=>N.id===e))??[]:s??[],[s,e]),c=Ep({queries:o.map(N=>({queryKey:["rig",N.id,"nodes"],queryFn:()=>jce(N.id),refetchInterval:3e4}))}),u=R.useMemo(()=>{const N=[];for(let C=0;C<o.length;C++){const k=o[C],_=c[C];if(!k||!_)continue;const E=_.data??[],M=t?E.filter(A=>(A.podNamespace??A.podId)===t):E;for(const A of M)N.push({rigId:k.id,rigName:k.name,podName:Ys(A.logicalId)??"default",logicalId:A.logicalId,sessionName:A.canonicalSessionName??A.logicalId,runtime:A.runtime??"-",status:A.sessionStatus??"unknown",startupStatus:A.startupStatus??null,contextUsage:A.contextUsage??null,agentActivity:A.agentActivity??null,currentQitems:A.currentQitems??[]})}return N},[o,c,t]),f=R.useMemo(()=>UN(u.map(N=>({nodeId:`${N.rigId}::${N.logicalId}`,rigId:N.rigId,rigName:N.rigName,logicalId:N.logicalId,canonicalSessionName:N.sessionName,agentActivity:N.agentActivity??null,currentQitems:N.currentQitems??null,startupStatus:N.startupStatus}))),[u]),h=VN(f),p=R.useMemo(()=>u.map(N=>({...N,activityRing:h.getNodeActivity(`${N.rigId}::${N.logicalId}`,N),reducedMotion:r})),[u,h,r]),[g,x]=R.useState([]),[v,b]=R.useState(""),w=R.useMemo(()=>Rce(),[]),S=Sce({data:p,columns:w,state:{sorting:g,globalFilter:v},onSortingChange:x,onGlobalFilterChange:b,getCoreRowModel:hce(),getSortedRowModel:vce(),getFilteredRowModel:xce(),globalFilterFn:(N,C,k)=>{const _=String(k??"").toLowerCase();if(!_)return!0;const E=N.original;return E.rigName.toLowerCase().includes(_)||E.podName.toLowerCase().includes(_)||E.logicalId.toLowerCase().includes(_)||E.runtime.toLowerCase().includes(_)||E.status.toLowerCase().includes(_)}});return a.jsxs("div",{"data-testid":"topology-table-view",className:"space-y-3 mt-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(r6,{placeholder:"Filter agents...",value:v,onChange:N=>b(N.target.value),className:"max-w-xs",testId:"topology-table-search"}),a.jsxs("span",{className:"font-mono text-[10px] uppercase tracking-wide text-on-surface-variant ml-auto",children:[S.getFilteredRowModel().rows.length," of ",p.length]})]}),a.jsx("div",{className:"border border-outline-variant overflow-x-auto",children:a.jsxs("table",{className:"w-full text-left",children:[a.jsx("thead",{className:"bg-stone-50 border-b border-outline-variant",children:S.getHeaderGroups().map(N=>a.jsx("tr",{children:N.headers.map(C=>a.jsxs("th",{onClick:C.column.getToggleSortingHandler(),className:"px-3 py-2 font-mono text-[10px] uppercase tracking-[0.18em] text-on-surface-variant cursor-pointer select-none",children:[O4(C.column.columnDef.header,C.getContext()),{asc:" ↑",desc:" ↓"}[C.column.getIsSorted()]??null]},C.id))},N.id))}),a.jsx("tbody",{children:S.getRowModel().rows.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:w.length,className:"px-3 py-6 text-center font-mono text-xs text-on-surface-variant",children:"No agents match."})}):S.getRowModel().rows.map(N=>a.jsx("tr",{"data-testid":`topology-table-row-${N.original.logicalId}`,onClick:()=>n({to:"/topology/seat/$rigId/$logicalId",params:{rigId:N.original.rigId,logicalId:encodeURIComponent(N.original.logicalId)}}),className:"group border-b border-outline-variant last:border-b-0 hover:bg-surface-low focus-within:bg-surface-low cursor-pointer",children:N.getVisibleCells().map(C=>a.jsx("td",{className:"px-3 py-2",children:O4(C.column.columnDef.cell,C.getContext())},C.id))},N.id))})]})})]})}const nS=12;function Ece(e){var t;return((t=e.agentActivity)==null?void 0:t.state)==="running"}function Ace({seat:e}){const t=e.contextUsage,n=(t==null?void 0:t.availability)==="known"&&typeof t.usedPercentage=="number";return a.jsx("span",{"data-testid":`terminal-card-context-${e.rigId}-${e.logicalId}`,className:`font-mono text-[8px] font-bold uppercase tracking-wide ${FD(t==null?void 0:t.usedPercentage,t==null?void 0:t.fresh,t==null?void 0:t.availability)}`,title:n?(t==null?void 0:t.fresh)===!1?"Context usage (stale sample)":"Context usage (fresh)":"Context sample unavailable",children:n?`${t.usedPercentage}%`:"--"})}function Tce({seat:e}){const t=e.contextUsage,n=Za(t==null?void 0:t.totalInputTokens,t==null?void 0:t.totalOutputTokens),s=tm(n),r=nm(t==null?void 0:t.totalInputTokens,t==null?void 0:t.totalOutputTokens);return a.jsx("span",{"data-testid":`terminal-card-tokens-${e.rigId}-${e.logicalId}`,className:`font-mono text-[8px] font-bold uppercase tracking-wide ${s?"text-stone-500":"text-stone-300"}`,title:r??"Token sample unavailable",children:s??"--"})}function Mce({seat:e}){const t=e.canonicalSessionName??e.logicalId,n=Ece(e),s=Op(e.logicalId);return a.jsxs("div",{"data-testid":`terminal-card-${e.rigId}-${e.logicalId}`,"data-active":n?"true":"false",className:he("border bg-white/40 p-2 flex flex-col gap-2",n?"border-secondary terminal-card-active":"border-outline-variant"),children:[a.jsxs("header",{className:"flex items-center justify-between gap-2",children:[a.jsx("span",{className:"font-mono text-[10px] font-semibold uppercase tracking-[0.10em] text-stone-900 truncate",children:s}),a.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1",children:[a.jsx(_n,{runtime:e.runtime,size:"xs",compact:!0,variant:"inline"}),a.jsx(Ace,{seat:e}),a.jsx(Tce,{seat:e})]})]}),a.jsx(em,{sessionName:t,lines:20,testIdPrefix:`terminal-preview-${e.rigId}-${e.logicalId}`})]})}function i6({seats:e,emptyLabel:t,emptyDescription:n}){const[s,r]=R.useState(!1),o=s?e:e.slice(0,nS),c=e.length>nS;return e.length===0?a.jsx(Xe,{label:t,description:n,variant:"card",testId:"topology-terminal-empty"}):a.jsxs("div",{"data-testid":"topology-terminal-grid",className:"space-y-3",children:[a.jsxs("div",{className:"font-mono text-[9px] text-on-surface-variant flex items-center justify-between",children:[a.jsxs("span",{"data-testid":"topology-terminal-count",children:["showing ",o.length," of ",e.length," terminal",e.length===1?"":"s"]}),c?a.jsx("button",{type:"button","data-testid":"topology-terminal-show-toggle",onClick:()=>r(u=>!u),className:"px-2 py-0.5 border border-outline-variant font-mono text-[9px] uppercase tracking-wide text-stone-700 hover:bg-stone-100/60",children:s?`show first ${nS}`:`show all ${e.length}`}):null]}),a.jsx("div",{className:"grid gap-3 grid-cols-1 md:grid-cols-2 lg:grid-cols-3",children:o.map(u=>a.jsx(Mce,{seat:u},`${u.rigId}-${u.logicalId}`))})]})}function Ice({rigId:e,rigName:t}){const{data:n}=Gj(e),s=R.useMemo(()=>(n??[]).filter(r=>r.nodeKind!=="infrastructure"),[n]);return s.length===0?null:a.jsxs("section",{"data-testid":`topology-terminal-rig-${e}`,className:"border-t border-outline-variant pt-4 first:border-t-0 first:pt-0",children:[a.jsx(rt,{tone:"muted",children:t}),a.jsx("div",{className:"mt-2",children:a.jsx(i6,{seats:s,emptyLabel:"NO SEATS",emptyDescription:`No agent seats in ${t}.`})})]})}function v_({scope:e,rigId:t,podName:n}){const{data:s}=Ts(),{data:r}=Gj(e!=="host"?t??null:null);if(e==="host")return!s||s.length===0?a.jsx("div",{className:"p-6",children:a.jsx(Xe,{label:"NO RIGS",description:"No rigs registered. Register a rig to see terminals at host scope.",variant:"card",testId:"topology-terminal-empty"})}):a.jsx("div",{"data-testid":"topology-terminal-host",className:"p-6 space-y-6",children:s.map(u=>a.jsx(Ice,{rigId:u.id,rigName:u.name},u.id))});const o=(r??[]).filter(u=>u.nodeKind!=="infrastructure"),c=e==="pod"&&n?o.filter(u=>(u.podNamespace??u.podId)===n):o;return a.jsx("div",{"data-testid":`topology-terminal-${e}`,className:"p-6",children:a.jsx(i6,{seats:c,emptyLabel:"NO SEATS",emptyDescription:e==="pod"?`No agent seats in pod ${n}.`:"No agent seats in this rig."})})}const sS=1024;function y_(){const[e,t]=R.useState(()=>typeof window>"u"?{isWideLayout:!0,innerWidth:sS}:{isWideLayout:window.innerWidth>=sS,innerWidth:window.innerWidth});return R.useEffect(()=>{const n=()=>{t({isWideLayout:window.innerWidth>=sS,innerWidth:window.innerWidth})};return n(),window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),e}function Oce(e){return e==="running"?"running":e==="stopped"?"stopped":"warning"}function Lce({data:e}){const{rigId:t,rigName:n,collapsed:s,status:r,nodeCount:o,runningCount:c,podCount:u,recentActivity:f,onToggle:h}=e;return a.jsxs("div",{"data-testid":`rig-group-node-${t}`,"data-collapsed":s?"true":"false",onClick:p=>{p.stopPropagation(),h(t)},className:he("w-full h-full relative flex flex-col cursor-pointer select-none overflow-visible",s?"border border-outline-variant bg-white/40 backdrop-blur-[8px] hard-shadow hover:bg-white/50":"border border-outline-variant/70 bg-white/40 backdrop-blur-[8px] shadow-[0_0_0_1px_rgba(84,96,115,0.06)]",f&&"rig-activity-frame-pulse"),children:[a.jsx(Dp,{testIdPrefix:`rig-group-${t}`}),a.jsxs("header",{className:"absolute -top-8 left-4 z-10 flex items-center gap-2 border border-outline-variant/70 bg-background px-3 py-1.5 font-mono text-[10px] uppercase tracking-[0.10em] text-stone-900 shadow-[2px_2px_0_rgba(46,52,46,0.10)]",children:[a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[a.jsx(Xs,{className:he("h-3 w-3 text-on-surface-variant shrink-0 transition-transform",s?"":"rotate-90"),"aria-hidden":"true"}),a.jsx("span",{"data-testid":`rig-group-name-${t}`,className:"font-mono text-[11px] font-bold uppercase tracking-[0.10em] text-stone-900 truncate",children:n})]}),a.jsx(jp,{status:Oce(r),label:r,variant:"pill",testId:`rig-group-status-${t}`}),a.jsx(Ye,{to:"/topology/rig/$rigId",params:{rigId:t},onClick:p=>p.stopPropagation(),"data-testid":`rig-group-drill-${t}`,className:"shrink-0 p-0.5 text-on-surface-variant hover:text-stone-900 hover:bg-stone-200/60","aria-label":`Open ${n} rig page`,children:a.jsx(vF,{className:"h-3 w-3","aria-hidden":"true"})})]}),s?a.jsx("div",{className:"px-3 pt-8 pb-3 flex items-center justify-between gap-2 flex-1",children:a.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0",children:[a.jsxs("div",{className:"font-mono text-[9px] uppercase tracking-wider text-on-surface-variant",children:[u!==void 0?`${u} pods / `:"",o," agent",o===1?"":"s"]}),a.jsxs("div",{className:"font-mono text-[9px] text-on-surface-variant",children:[c," active"]})]})}):a.jsxs("div",{className:"absolute right-3 top-3 flex items-center gap-2 font-mono text-[8px] uppercase tracking-[0.12em] text-stone-500","data-testid":`rig-group-expanded-counts-${t}`,children:[a.jsx("span",{children:u!==void 0?`${u} pods`:""}),u!==void 0?a.jsx("span",{children:"/"}):null,a.jsxs("span",{children:[o," agents"]}),a.jsx("span",{children:"/"}),a.jsxs("span",{children:[c," active"]})]}),a.jsx(gn,{type:"target",position:ve.Top,className:"opacity-0 pointer-events-none"}),a.jsx(gn,{type:"source",position:ve.Bottom,className:"opacity-0 pointer-events-none"})]})}function Pce(e){return e==="architect"||e==="lead"||e==="orchestrator"}function Dce(e,t){if(typeof e!="number")return"text-stone-300";const n=e>=80?"text-red-600":e>=60?"text-amber-600":"text-green-700";return t===!1?`${n} opacity-50`:n}function qce({data:e}){const t=e.podDisplayName??e.podNamespace??Ys(e.logicalId??null)??e.podId??"pod";return a.jsxs("div",{"data-testid":"hybrid-pod-group-node",className:"relative h-full w-full border border-dashed border-stone-400/55 bg-stone-50/25",children:[a.jsxs("div",{className:"absolute left-2 top-2 flex items-center gap-2 font-mono text-[9px] lowercase tracking-[0.02em] text-stone-600",children:[a.jsx("span",{children:t}),typeof e.agentCount=="number"?a.jsx("span",{className:"text-stone-400",children:e.agentCount}):null]}),a.jsx(gn,{type:"target",position:ve.Left,className:"opacity-0 pointer-events-none"}),a.jsx(gn,{type:"source",position:ve.Right,className:"opacity-0 pointer-events-none"})]})}function $ce({data:e}){var N,C;const t=u_(),n=Pce(e.role),s=e.nodeKind==="infrastructure",r=Ij(e.agentActivity),o=Oj(r),c=pL(r),u=mL(r),f=Lj(e.agentActivity),h=HD({activityRing:e.activityRing,activityState:r}),p=e.runtime||e.model?EL(e.runtime,e.model):null,g=e.contextAvailability==="known"&&typeof e.contextUsedPercentage=="number",x=Za(e.contextTotalInputTokens,e.contextTotalOutputTokens),v=tm(x),b=nm(e.contextTotalInputTokens,e.contextTotalOutputTokens),w="inline-flex h-6 w-6 items-center justify-center border border-outline-variant bg-white/90 text-stone-700 opacity-0 shadow-[1px_1px_0_rgba(46,52,46,0.14)] transition-opacity hover:bg-stone-100 hover:text-stone-950 focus:!opacity-100 focus:opacity-100 focus:outline-none focus:ring-2 focus:ring-stone-900/20 group-hover:!opacity-100 group-hover:opacity-100 group-focus-within:!opacity-100 group-focus-within:opacity-100",S=a.jsxs("div",{"data-testid":"hybrid-agent-node",title:[e.canonicalSessionName,`activity: ${o}${f?" (stale)":""}`,p,b].filter(Boolean).join(`
406
+ `),"data-activity-card-state":h.state,"data-activity-card-flash":h.flash??"none",className:he("group relative h-full w-full select-none border bg-white/40 backdrop-blur-[8px] hard-shadow transition-[background-color,border-color,box-shadow] duration-300",UD({state:h.state,flash:h.flash,reducedMotion:e.reducedMotion}),e.startupStatus==="failed"?"border-red-700":e.startupStatus==="attention_required"?"border-amber-700":"border-stone-900"),children:[a.jsx(gn,{type:"target",position:ve.Left,className:"opacity-0"}),a.jsxs("div",{className:he("flex items-center justify-between gap-1 px-2 py-1 font-mono text-[8px]",s?"bg-stone-500 text-white border-b border-stone-900":n?"bg-stone-900 text-white":"border-b border-stone-900 bg-stone-200 text-stone-900"),children:[a.jsx("span",{className:"truncate font-bold",children:Op(e.logicalId)}),a.jsx("span",{className:he("inline-flex h-2 w-2 shrink-0 rounded-full border border-white/60",c,u),"data-testid":`hybrid-activity-dot-${e.logicalId}`,"data-activity-state":r,"aria-label":`activity: ${o}`})]}),e.rigId?a.jsx(VD,{rigId:e.rigId,logicalId:e.logicalId,sessionName:e.canonicalSessionName??null,reducedMotion:e.reducedMotion,testIdPrefix:`hybrid-${e.logicalId}`,wrapperClassName:"absolute right-8 top-6 z-20",buttonClassName:w}):null,e.rigId?a.jsx("button",{type:"button","data-testid":`hybrid-cmux-open-${e.logicalId}`,"aria-label":`Open ${e.logicalId} in cmux`,title:"Open in cmux",onClick:k=>{k.stopPropagation(),t.mutate({rigId:e.rigId,logicalId:e.logicalId})},className:he("absolute right-1.5 top-6 z-10",w),children:a.jsx(Pe,{tool:"cmux",size:"sm"})}):null,a.jsxs("div",{className:"space-y-1 px-2 py-1.5",children:[a.jsx("div",{className:"truncate font-mono text-[8px] leading-tight text-stone-500",children:e.canonicalSessionName??e.logicalId}),a.jsxs("div",{className:"min-w-0",children:[a.jsx(_n,{runtime:e.runtime,model:e.model,size:"xs",compact:!0,variant:"inline",className:"max-w-full"}),!p&&(e.resolvedSpecName||e.profile)?a.jsx("span",{className:"ml-1 font-mono text-[7px] uppercase tracking-[0.12em] text-stone-400",children:e.resolvedSpecName||e.profile}):null]}),a.jsxs("div",{className:"flex items-end justify-between gap-2 pt-0.5",children:[a.jsx("div",{className:he("font-mono text-[14px] font-bold leading-none",Dce(e.contextUsedPercentage,e.contextFresh)),"data-testid":"hybrid-context-badge",children:g?`${e.contextUsedPercentage}%`:"--"}),a.jsx("div",{className:he("font-mono text-[13px] font-bold leading-none tracking-[0.02em]",v?"text-stone-500":"text-stone-300"),"data-testid":"hybrid-token-total",title:b??"Token sample unavailable",children:v??"--"})]})]}),a.jsx(gn,{type:"source",position:ve.Right,className:"opacity-0"})]});return a.jsx(wN,{state:((N=e.activityRing)==null?void 0:N.state)??"idle",flash:((C=e.activityRing)==null?void 0:C.flash)??null,reducedMotion:e.reducedMotion,testId:`hybrid-activity-ring-${e.logicalId}`,className:"h-full w-full rounded-none",children:S})}async function zce(e){const t=await fetch(`/api/rigs/${encodeURIComponent(e)}/graph`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}const Bce={rigGroup:Lce,podGroup:qce,rigNode:$ce},Fce={hotPotato:GD},Hce=!0,Uce=.03,Vce=2,a6=.08;function Gce(){const e=Ot(),{data:t}=ad(),n=GN(),{expandedRigs:s,setRigExpanded:r}=tN(),o=R.useCallback(_=>s.get(_)??Hce,[s]),c=R.useCallback(_=>{r(_,!o(_))},[o,r]),u=t??[],f=Ep({queries:u.map(_=>({queryKey:["rig",_.rigId,"graph"],queryFn:()=>zce(_.rigId),enabled:o(_.rigId),refetchInterval:3e4}))}),h=R.useMemo(()=>u.filter(_=>o(_.rigId)).length,[u,o]),p=R.useCallback(()=>{for(const _ of u)r(_.rigId,!0)},[u,r]),g=R.useCallback(()=>{for(const _ of u)r(_.rigId,!1)},[u,r]),{mergedNodes:x,mergedEdges:v}=R.useMemo(()=>{var O,L;const _=[];for(let P=0;P<u.length;P++){const I=u[P],B=o(I.rigId),F=f[P];let z=[],Y=[],$=Gq,V=ZS,G;const Z=((O=F==null?void 0:F.data)==null?void 0:O.nodes)??[],J=((L=F==null?void 0:F.data)==null?void 0:L.edges)??[],D=pse({rigId:I.rigId,rigName:I.name,nodes:Z,edges:J,collapsed:!B});$=D.width,V=D.height,B&&(z=D.nodes,Y=D.edges,G=D.podCount),_.push({rigId:I.rigId,rigName:I.name,status:I.status,nodeCount:I.nodeCount,runningCount:I.runningCount,podCount:G,isExpanded:B,childNodes:z,childEdges:Y,width:$,height:V})}const E=mse(_.map(P=>({rigId:P.rigId,width:P.width,height:P.height}))),M=[],A=[];for(let P=0;P<_.length;P++){const I=_[P],B=E[P],F={rigId:I.rigId,rigName:I.rigName,collapsed:!I.isExpanded,status:I.status,nodeCount:I.nodeCount,runningCount:I.runningCount,podCount:I.podCount,onToggle:c};M.push({id:`rig-${I.rigId}`,type:"rigGroup",position:B.position,data:F,style:{width:B.width,height:B.height},draggable:!1,zIndex:0}),I.isExpanded&&(M.push(...I.childNodes),A.push(...I.childEdges))}return{mergedNodes:M,mergedEdges:A}},[u,o,f]),b=R.useMemo(()=>UN(x.filter(_=>_.type==="rigNode").map(_=>{const E=_.data;return{nodeId:_.id,rigId:(E==null?void 0:E.rigId)??null,rigName:(E==null?void 0:E.rigName)??null,logicalId:(E==null?void 0:E.logicalId)??null,canonicalSessionName:(E==null?void 0:E.canonicalSessionName)??null,agentActivity:(E==null?void 0:E.agentActivity)??null,currentQitems:(E==null?void 0:E.currentQitems)??null,startupStatus:(E==null?void 0:E.startupStatus)??null}})),[x]),w=VN(b),S=R.useMemo(()=>x.map(_=>{if(_.type==="rigGroup"){const M=_.data;return{..._,data:{...M,recentActivity:w.isRigRecentlyActive(M.rigId)}}}if(_.type!=="rigNode")return _;const E=_.data;return{..._,data:{..._.data??{},activityRing:w.getNodeActivity(_.id,E),reducedMotion:n}}}),[x,w,n]),N=R.useMemo(()=>Yq(v,w.packets,{reducedMotion:n}),[v,w.packets,n]),C=R.useMemo(()=>x.map(_=>{const E=_.style;return[_.id,Math.round(_.position.x),Math.round(_.position.y),(E==null?void 0:E.width)??"",(E==null?void 0:E.height)??"",_.parentId??""].join(":")}).join("|"),[x]),k=(_,E)=>{const M=E.data,A=M==null?void 0:M.rigId;if(A&&E.type!=="rigGroup"){if(E.type==="podGroup"||E.type==="group"){const O=(M==null?void 0:M.podNamespace)??(M==null?void 0:M.podId);if(!O)return;e({to:"/topology/pod/$rigId/$podName",params:{rigId:A,podName:O}});return}M!=null&&M.logicalId&&e({to:"/topology/seat/$rigId/$logicalId",params:{rigId:A,logicalId:encodeURIComponent(M.logicalId)}})}};return u.length===0?a.jsxs("div",{"data-testid":"host-multi-rig-graph-empty",className:"flex flex-col items-center justify-center h-full font-mono text-[10px] text-on-surface-variant",children:["No rigs registered. Run ",a.jsx("code",{className:"ml-1 text-stone-700",children:"rig up"})," to start one."]}):a.jsx("div",{"data-testid":"host-multi-rig-graph",className:"w-full h-full relative",children:a.jsxs(gd,{nodes:S,edges:N,nodeTypes:Bce,edgeTypes:Fce,onNodeClick:k,nodesDraggable:!1,fitView:!0,fitViewOptions:{padding:a6,includeHiddenNodes:!1},minZoom:Uce,maxZoom:Vce,proOptions:{hideAttribution:!0},children:[a.jsx(Kce,{layoutSignature:C}),a.jsx(pd,{position:"top-right",className:"!m-3",children:a.jsxs("div",{className:"flex items-center gap-1 border border-outline-variant bg-background/80 px-1.5 py-1 shadow-[2px_2px_0_rgba(46,52,46,0.10)] backdrop-blur-sm",children:[a.jsxs("button",{type:"button","data-testid":"topology-expand-all-rigs",onClick:p,disabled:h===u.length,title:"Expand all rigs",className:"inline-flex h-7 items-center gap-1 border border-transparent px-2 font-mono text-[9px] uppercase tracking-[0.08em] text-stone-700 hover:border-outline-variant hover:bg-white/70 hover:text-stone-950 disabled:pointer-events-none disabled:opacity-35",children:[a.jsx(JF,{className:"h-3.5 w-3.5","aria-hidden":"true"}),"Expand all"]}),a.jsxs("button",{type:"button","data-testid":"topology-collapse-all-rigs",onClick:g,disabled:h===0,title:"Collapse all rigs",className:"inline-flex h-7 items-center gap-1 border border-transparent px-2 font-mono text-[9px] uppercase tracking-[0.08em] text-stone-700 hover:border-outline-variant hover:bg-white/70 hover:text-stone-950 disabled:pointer-events-none disabled:opacity-35",children:[a.jsx(nH,{className:"h-3.5 w-3.5","aria-hidden":"true"}),"Collapse all"]})]})}),a.jsx(xd,{position:"bottom-right",showInteractive:!1,className:"!bg-white/40 !border !border-outline-variant"})]})})}function Kce({layoutSignature:e}){const{fitView:t}=Zp(),n=R.useRef(null);return R.useEffect(()=>{if(!e||n.current===e)return;n.current=e;const s=window.setTimeout(()=>{t({padding:a6,includeHiddenNodes:!1,duration:250})},50);return()=>window.clearTimeout(s)},[t,e]),null}function b_(e){const{setMode:t}=tN();R.useEffect(()=>(t(e==="graph"?"overlay":"opaque"),()=>{t("opaque")}),[e,t])}function w_({tabsNav:e,children:t}){return a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsx("div",{className:"relative z-30 px-6 pt-4",style:{marginLeft:"var(--header-anchor-offset, 0px)"},children:e}),a.jsx("div",{className:"flex-1 min-h-0 flex flex-col",children:t})]})}function Yce(){const[e,t]=R.useState("graph"),{data:n}=Ts(),{isWideLayout:s}=y_();b_(e);const r=!s&&e==="graph"?"table":e;return a.jsxs(w_,{eyebrow:"Topology · Host",title:"localhost",tabsNav:a.jsx(f_,{tabs:kle,active:e,onSelect:t,testIdPrefix:"topology-host"}),children:[r==="graph"?a.jsx("div",{className:"flex-1 min-h-0 relative",children:a.jsx(Gce,{})}):null,r==="table"?a.jsxs("div",{className:"px-6 pb-6",children:[!s&&e==="graph"?a.jsx("p",{"data-testid":"topology-mobile-graph-degraded",className:"font-mono text-[9px] text-on-surface-variant italic mb-2",children:"Graph view degrades to table on narrow viewports."}):null,a.jsx(x_,{})]}):null,r==="terminal"?a.jsx(v_,{scope:"host"}):null]})}function Wce(){const{rigId:e}=Cn({from:"/topology/rig/$rigId"}),{data:t}=Ts(),n=t==null?void 0:t.find(u=>u.id===e),[s,r]=R.useState("graph"),{isWideLayout:o}=y_();b_(s);const c=!o&&s==="graph"?"table":s;return a.jsxs(w_,{eyebrow:"Topology · Rig",title:(n==null?void 0:n.name)??e,tabsNav:a.jsx(f_,{tabs:Y$,active:s,onSelect:r,testIdPrefix:"topology-rig"}),children:[c==="graph"?a.jsx("div",{className:"flex-1 min-h-0 relative",children:a.jsx(KN,{rigId:e,rigName:(n==null?void 0:n.name)??null,showDiscovered:!1})}):null,c==="table"?a.jsxs("div",{className:"px-6 pb-6",children:[!o&&s==="graph"?a.jsx("p",{"data-testid":"topology-mobile-graph-degraded",className:"font-mono text-[9px] text-on-surface-variant italic mb-2",children:"Graph view degrades to table on narrow viewports."}):null,a.jsx(x_,{rigIdScope:e})]}):null,c==="terminal"?a.jsx(v_,{scope:"rig",rigId:e}):null,s==="overview"?a.jsx(Qce,{rigId:e,rigName:(n==null?void 0:n.name)??null}):null]})}function Qce({rigId:e,rigName:t}){const{data:n=[],isLoading:s}=Wl("rig"),r=t?n.filter(h=>h.name===t):[],o=r.length===1?r[0].id:null,{data:c,isLoading:u}=qj(o);if(s||u)return a.jsx("div",{className:"p-6",children:a.jsx("div",{className:"font-mono text-[10px] text-stone-400",children:"Loading rig spec…"})});if(r.length===0)return a.jsx("div",{className:"p-6",children:a.jsx(Xe,{label:"NO RIG SPEC",description:`No rig spec entry found for "${t??e}". Author one via /specs.`,variant:"card",testId:"topology-rig-overview-no-spec"})});if(r.length>1)return a.jsx("div",{className:"p-6",children:a.jsx(Xe,{label:"AMBIGUOUS RIG SPEC",description:`${r.length} rig spec entries match "${t??e}". Disambiguate at /specs.`,variant:"card"})});if(!c||c.kind!=="rig")return a.jsx("div",{className:"p-6",children:a.jsx(Xe,{label:"RIG SPEC UNAVAILABLE",description:"Rig spec failed to load.",variant:"card"})});const f=c;return a.jsx("div",{className:"px-6 pb-6","data-testid":"topology-rig-overview",children:a.jsx(o_,{review:f,yaml:f.raw,testIdPrefix:"topology-rig-overview-"})})}function Xce(){const{rigId:e,podName:t}=Cn({from:"/topology/pod/$rigId/$podName"}),[n,s]=R.useState("graph"),{isWideLayout:r}=y_();b_(n);const o=!r&&n==="graph"?"table":n;return a.jsxs(w_,{eyebrow:"Topology · Pod",title:`${e} / ${t}`,tabsNav:a.jsx(f_,{tabs:Y$,active:n,onSelect:s,testIdPrefix:"topology-pod"}),children:[o==="graph"?a.jsx("div",{className:"flex-1 min-h-0 relative",children:a.jsx(KN,{rigId:e,rigName:null,showDiscovered:!1,podScope:t})}):null,o==="table"?a.jsxs("div",{className:"px-6 pb-6",children:[!r&&n==="graph"?a.jsx("p",{"data-testid":"topology-mobile-graph-degraded",className:"font-mono text-[9px] text-on-surface-variant italic mb-2",children:"Graph view degrades to table on narrow viewports."}):null,a.jsx(x_,{rigIdScope:e,podNameScope:t})]}):null,o==="terminal"?a.jsx(v_,{scope:"pod",rigId:e,podName:t}):null,n==="overview"?a.jsx("div",{className:"p-6",children:a.jsx(Xe,{label:"POD OVERVIEW",description:"Pod detail (Phase 5).",variant:"card"})}):null]})}function Zce(){const{rigId:e,logicalId:t}=Cn({from:"/topology/seat/$rigId/$logicalId"}),n=decodeURIComponent(t);return a.jsx("div",{"data-testid":"seat-scope-page",className:"flex flex-col h-full",children:a.jsx(q$,{rigId:e,logicalId:n})})}const L4=["bg-amber-100 text-amber-800 border-amber-300","bg-violet-100 text-violet-800 border-violet-300","bg-emerald-100 text-emerald-800 border-emerald-300","bg-sky-100 text-sky-800 border-sky-300","bg-rose-100 text-rose-800 border-rose-300","bg-fuchsia-100 text-fuchsia-800 border-fuchsia-300","bg-cyan-100 text-cyan-800 border-cyan-300","bg-orange-100 text-orange-800 border-orange-300"],Jce="bg-stone-100 text-stone-700 border-stone-300",Ih=12;function o6({events:e,phaseDefinitions:t,queueItemsById:n}){const[s,r]=R.useState(0),o=R.useMemo(()=>{const p=new Map;return t&&t.forEach((g,x)=>{p.set(g.id,{label:g.label,colorClass:L4[x%L4.length],token:{label:g.label,tone:["warning","info","success","neutral"][x%4]}})}),p},[t]),c=R.useMemo(()=>[...e].sort((p,g)=>P4(g.ts)-P4(p.ts)),[e]),u=Math.max(1,Math.ceil(c.length/Ih)),f=Math.min(s,u-1),h=c.slice(f*Ih,f*Ih+Ih);return e.length===0?a.jsx("div",{className:"p-4 font-mono text-[10px] text-stone-400","data-testid":"story-empty",children:"No events captured for this slice yet."}):a.jsxs("div",{"data-testid":"story-tab",className:"space-y-0",children:[a.jsx("div",{"data-testid":"story-step-tree","data-order":"newest-first",className:"relative border border-outline-variant bg-white/35 p-3 backdrop-blur-sm",children:h.map((p,g)=>a.jsx(nue,{event:p,phaseMeta:o,isLast:g===h.length-1,queueItem:p.qitemId?n==null?void 0:n.get(p.qitemId):void 0},`${p.ts}-${p.kind}-${g}`))}),u>1?a.jsxs("div",{className:"mt-3 flex items-center justify-between border border-outline-variant bg-white/35 px-3 py-2 font-mono text-[10px] uppercase tracking-[0.12em] text-stone-600",children:[a.jsx("button",{type:"button","data-testid":"story-page-prev",disabled:f===0,onClick:()=>r(p=>Math.max(0,p-1)),className:"border border-outline-variant px-2 py-1 disabled:opacity-40",children:"Newer"}),a.jsxs("span",{"data-testid":"story-page-status",children:["Page ",f+1," / ",u]}),a.jsx("button",{type:"button","data-testid":"story-page-next",disabled:f>=u-1,onClick:()=>r(p=>Math.min(u-1,p+1)),className:"border border-outline-variant px-2 py-1 disabled:opacity-40",children:"Older"})]}):null]})}function P4(e){const t=Date.parse(e);return Number.isFinite(t)?t:0}function Wu(e,t){if(!e)return null;for(const n of t){const s=e[n];if(typeof s=="string"&&s.length>0)return s}return null}function dj(e){const t=Wu(e.detail,["fromSession","sourceSession","source","actorSession"])??e.actorSession,n=Wu(e.detail,["toSession","destinationSession","targetSession","target"]);return{source:t,target:n}}function l6(e,t){const n=Wu(e.detail,["body","content","message"]);return(t==null?void 0:t.body)??n??e.summary}function eue(e,t){return{qitemId:e.qitemId??(t==null?void 0:t.qitemId)??"",source:(t==null?void 0:t.sourceSession)??dj(e).source??void 0,destination:(t==null?void 0:t.destinationSession)??dj(e).target??void 0,state:(t==null?void 0:t.state)??Wu(e.detail,["state","toState","fromState"])??void 0,tags:(t==null?void 0:t.tags)??void 0,createdAt:(t==null?void 0:t.tsCreated)??e.ts,body:(t==null?void 0:t.body)??l6(e,t)}}function tue(e,t=12){const n=e.split(`
407
+ `);return n.length<=t?e:`${n.slice(0,t).join(`
408
+ `)}
409
+ ... ${n.length-t} more lines`}function nue({event:e,phaseMeta:t,isLast:n,queueItem:s}){var w;const r=e.phase?t.get(e.phase):void 0,o=(r==null?void 0:r.label)??e.phase??"untagged",c=(r==null?void 0:r.colorClass)??Jce,u=(r==null?void 0:r.token)??{label:o,tone:"neutral"},f=dj(e),h=Wu(e.detail,["sliceLabel","sliceName"]),p=l6(e,s),g=!!(s!=null&&s.body),v=Qj(e.kind).icon,b=a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx("span",{"data-testid":`story-row-phase-${e.kind}`,"data-phase-id":e.phase??"untagged",className:`sr-only ${c}`,children:o}),a.jsx(Nn,{token:u,compact:!0}),h?a.jsx(Nn,{token:{label:h,tone:"neutral"},compact:!0}):null,a.jsx(Zj,{kind:e.kind,compact:!0}),a.jsx(oo,{value:e.ts})]}),a.jsx("pre",{"data-testid":`story-row-body-${e.kind}`,"data-source":g?"qitem":"event",className:"mt-2 whitespace-pre-wrap break-words font-mono text-[11px] leading-relaxed text-stone-950",children:tue(p)}),a.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[e.qitemId?a.jsx(Wi,{tag:e.qitemId}):null,(w=s==null?void 0:s.tags)==null?void 0:w.slice(0,4).map(S=>a.jsx(Wi,{tag:S},S))]}),g&&e.summary!==p?a.jsx("div",{"data-testid":`story-row-summary-${e.kind}`,className:"mt-2 truncate font-mono text-[9px] text-stone-500",children:e.summary}):null,(f.source||f.target)&&a.jsx("div",{"data-testid":`story-step-flow-${e.kind}`,className:"mt-2",children:a.jsx(zp,{source:f.source,destination:f.target,muted:!0})})]});return a.jsxs("div",{className:"relative pl-9 pb-3 last:pb-0",children:[!n&&a.jsx("div",{"data-testid":`story-step-connector-${e.kind}`,className:"absolute left-[14px] top-7 bottom-0 w-px bg-outline-variant"}),a.jsx("div",{"data-testid":`story-step-dot-${e.kind}`,className:"absolute left-[5px] top-3.5 flex h-5 w-5 items-center justify-center border border-outline-variant bg-white text-stone-600 shadow-[1px_1px_0_rgba(46,52,46,0.12)]",children:v?a.jsx(v,{className:"h-3 w-3",strokeWidth:1.7}):null}),e.qitemId?a.jsx(Nm,{data:eue(e,s),testId:`story-row-${e.kind}`,className:"block w-full border border-outline-variant bg-white/45 px-3 py-2 text-left hard-shadow backdrop-blur-sm hover:bg-white/60",children:b}):a.jsx("div",{"data-testid":`story-row-${e.kind}`,className:"w-full border border-outline-variant bg-white/45 px-3 py-2 text-left hard-shadow backdrop-blur-sm",children:b}),e.detail&&a.jsxs("details",{className:"mt-1",children:[a.jsx("summary",{className:"cursor-pointer font-mono text-[9px] uppercase tracking-[0.12em] text-stone-500",children:"Event detail"}),a.jsx("pre",{"data-testid":`story-row-detail-${e.kind}`,className:"mt-1 overflow-x-auto bg-stone-50 p-2 font-mono text-[9px] text-stone-700",children:JSON.stringify(e.detail,null,2)})]})]})}const sue=["all","active","done","blocked"];function rue({acceptance:e}){const{totalItems:t,doneItems:n,percentage:s,items:r,closureCallout:o,currentStep:c}=e,[u,f]=R.useState("all"),h=R.useMemo(()=>oue(r,u),[r,u]);return a.jsxs("div",{"data-testid":"acceptance-tab",className:"p-4",children:[c&&a.jsx(iue,{currentStep:c}),a.jsxs("header",{className:"mb-4",children:[a.jsxs("div",{className:"flex items-baseline justify-between",children:[a.jsx("div",{className:"font-mono text-[11px] uppercase tracking-[0.12em] text-stone-700",children:"Acceptance"}),a.jsxs("div",{className:"font-mono text-[10px] text-stone-500",children:[n," / ",t," (",s,"%)"]})]}),a.jsx("div",{className:"mt-2 h-2 w-full bg-stone-100","data-testid":"acceptance-progress-bar",children:a.jsx("div",{className:"h-2 bg-emerald-500 transition-all","data-testid":"acceptance-progress-fill","data-percentage":s,style:{width:`${s}%`}})}),o&&a.jsx("div",{"data-testid":"acceptance-closure-callout",className:"mt-3 border border-emerald-300 bg-emerald-50 px-3 py-2 font-mono text-[10px] text-emerald-900",children:o}),r.length>0&&a.jsx("div",{className:"mt-3 flex gap-1","data-testid":"acceptance-filter-row",children:sue.map(p=>a.jsx("button",{type:"button","data-testid":`acceptance-filter-${p}`,"data-active":u===p,onClick:()=>f(p),className:`border px-2 py-1 font-mono text-[9px] uppercase tracking-[0.10em] ${u===p?"border-stone-700 bg-stone-700 text-white":"border-stone-300 text-stone-700 hover:bg-stone-100"}`,children:p},p))})]}),r.length===0?a.jsx("div",{className:"font-mono text-[10px] text-stone-400","data-testid":"acceptance-empty",children:"No acceptance items found in slice docs (looks for `[ ]` / `[x]` checkbox lines in README / IMPLEMENTATION-PRD / PROGRESS / IMPLEMENTATION)."}):h.length===0?a.jsxs("div",{className:"font-mono text-[10px] text-stone-400","data-testid":"acceptance-filter-empty",children:["No items match filter '",u,"'."]}):a.jsx("ul",{className:"space-y-1","data-testid":"acceptance-list",children:h.map((p,g)=>a.jsx(aue,{item:p,idx:g},`${p.source.file}:${p.source.line}`))})]})}function iue({currentStep:e}){return a.jsxs("section",{"data-testid":"acceptance-current-step","data-step-id":e.stepId,className:"mb-6 border border-stone-300 bg-stone-50 p-3",children:[a.jsxs("div",{className:"flex items-baseline justify-between",children:[a.jsx("div",{className:"font-mono text-[11px] uppercase tracking-[0.12em] text-stone-700",children:"Current step"}),a.jsxs("div",{className:"font-mono text-[9px] text-stone-500",children:["hop ",e.hopCount," · ",e.instanceStatus]})]}),a.jsxs("div",{className:"mt-2 flex items-baseline gap-2",children:[a.jsx("span",{"data-testid":"acceptance-current-step-id",className:"font-mono text-[12px] font-bold text-stone-900",children:e.stepId}),a.jsxs("span",{className:"font-mono text-[9px] uppercase tracking-[0.10em] text-stone-500",children:["role: ",e.role]})]}),e.objective&&a.jsx("div",{"data-testid":"acceptance-current-step-objective",className:"mt-2 whitespace-pre-line font-mono text-[10px] text-stone-700",children:e.objective}),a.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-3",children:[a.jsxs("div",{"data-testid":"acceptance-current-step-allowed-exits",children:[a.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.10em] text-stone-500",children:"Allowed exits"}),a.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:e.allowedExits.length===0?a.jsx("span",{className:"font-mono text-[9px] text-stone-400",children:"(none)"}):e.allowedExits.map(t=>a.jsx("span",{className:"border border-stone-300 bg-white px-1.5 py-0.5 font-mono text-[9px] uppercase tracking-[0.10em] text-stone-700",children:t},t))})]}),a.jsxs("div",{"data-testid":"acceptance-current-step-allowed-next-steps",children:[a.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.10em] text-stone-500",children:"Allowed next steps"}),a.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:e.allowedNextSteps.length===0?a.jsxs("span",{className:"inline-flex items-center gap-1 font-mono text-[9px] uppercase tracking-[0.10em] text-stone-500",children:[a.jsx(Pe,{tool:"terminal",size:"xs"}),"terminal"]}):e.allowedNextSteps.map(t=>a.jsx("span",{"data-testid":`acceptance-next-step-${t.stepId}`,className:"border border-emerald-300 bg-emerald-50 px-1.5 py-0.5 font-mono text-[9px] text-emerald-900",title:`role: ${t.role}`,children:t.stepId},t.stepId))})]})]})]})}function aue({item:e,idx:t}){const[n,s]=R.useState(!1),{pillClass:r,pillIcon:o,pillLabel:c}=lue(e.done);return a.jsxs("li",{"data-testid":`acceptance-item-${t}`,"data-done":e.done,className:"border-b border-stone-100",children:[a.jsxs("button",{type:"button",onClick:()=>s(u=>!u),"data-testid":`acceptance-item-${t}-toggle`,className:"flex w-full items-start gap-2 py-1.5 text-left hover:bg-stone-50",children:[a.jsxs("span",{"data-testid":`acceptance-pill-${t}`,className:`inline-flex shrink-0 items-center gap-1 rounded-full border px-2 py-0.5 font-mono text-[9px] uppercase tracking-[0.10em] ${r}`,"aria-label":c,children:[a.jsx("span",{"aria-hidden":"true",children:o}),a.jsx("span",{children:c})]}),a.jsx("span",{className:"flex-1 font-mono text-[10px] text-stone-800",children:e.text}),a.jsxs("span",{className:"font-mono text-[8px] text-stone-400",title:`${e.source.file}:${e.source.line}`,children:[e.source.file,":",e.source.line]})]}),n&&a.jsxs("div",{"data-testid":`acceptance-item-${t}-detail`,className:"ml-2 mt-1 border-l-2 border-stone-300 bg-stone-50 px-3 py-2 font-mono text-[9px] text-stone-700",children:[a.jsxs("div",{children:[a.jsx("span",{className:"font-bold",children:"Source:"})," ",a.jsxs("span",{"data-testid":`acceptance-item-${t}-citation`,children:[e.source.file,":",e.source.line]})]}),a.jsxs("div",{className:"mt-1",children:[a.jsx("span",{className:"font-bold",children:"Status:"})," ",c]}),a.jsx("div",{className:"mt-2 whitespace-pre-line text-stone-800",children:e.text})]})]})}function oue(e,t){return t==="all"?e:t==="done"?e.filter(n=>n.done):t==="active"?e.filter(n=>!n.done):t==="blocked"?e.filter(n=>/\b(blocked|blocker|parked|park)\b/i.test(n.text)):e}function lue(e){return e?{pillClass:"border-emerald-400 bg-emerald-50 text-emerald-900",pillIcon:"✓",pillLabel:"done"}:{pillClass:"border-stone-400 bg-stone-50 text-stone-700",pillIcon:"◯",pillLabel:"active"}}function cue({sliceName:e,tree:t}){var c,u,f;const n=((c=t.find(h=>h.type==="file"&&h.name==="README.md"))==null?void 0:c.relPath)??((u=t.find(h=>h.type==="file"&&h.name==="IMPLEMENTATION-PRD.md"))==null?void 0:u.relPath)??((f=t.find(h=>h.type==="file"))==null?void 0:f.relPath)??null,[s,r]=R.useState(n),o=_7(e,s);return a.jsxs("div",{"data-testid":"docs-tab",className:"flex h-full",children:[a.jsxs("aside",{className:"w-56 shrink-0 overflow-y-auto border-r border-stone-200 bg-stone-50 p-2","data-testid":"docs-tree",children:[t.length===0&&a.jsx("div",{className:"font-mono text-[10px] text-stone-400",children:"Empty slice folder."}),t.map(h=>a.jsx("button",{type:"button","data-testid":`docs-tree-${h.relPath}`,"data-selected":h.relPath===s,disabled:h.type==="dir",onClick:()=>h.type==="file"&&r(h.relPath),className:`block w-full text-left font-mono text-[10px] ${h.type==="dir"?"py-1 text-stone-400":`cursor-pointer py-1 hover:bg-stone-100 ${h.relPath===s?"bg-stone-200/80 text-stone-900":"text-stone-700"}`}`,style:{paddingLeft:`${(h.relPath.split("/").length-1)*.75+.25}rem`},children:a.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1.5",children:[h.type==="dir"?a.jsx(Pe,{tool:"folder",size:"xs",decorative:!0}):a.jsx(Pe,{tool:h.name,size:"xs",decorative:!0}),a.jsx("span",{className:"truncate",children:h.name})]})},h.relPath))]}),a.jsxs("main",{className:"flex-1 min-w-0 overflow-y-auto bg-white","data-testid":"docs-viewer",children:[!s&&a.jsx("div",{className:"m-auto p-4 font-mono text-[10px] text-stone-400",children:"Select a file from the tree"}),s&&o.isLoading&&a.jsx("div",{className:"p-4 font-mono text-[10px] text-stone-400",children:"Loading…"}),s&&o.isError&&a.jsx("div",{className:"p-4 font-mono text-[10px] text-red-600",children:"Error loading doc."}),s&&o.data&&a.jsx("div",{"data-testid":"docs-viewer-content",className:"p-4",children:s.toLowerCase().endsWith(".md")?a.jsx(UL,{content:o.data.content}):a.jsx("pre",{className:"whitespace-pre-wrap break-words font-mono text-[11px] text-stone-800",children:o.data.content})})]})]})}function uue({rows:e}){const[t,n]=R.useState("all"),[s,r]=R.useState("all"),[o,c]=R.useState(""),u=R.useMemo(()=>{const p=new Set(e.map(g=>g.verb));return["all",...Array.from(p).sort()]},[e]),f=R.useMemo(()=>{const p=new Set(e.map(g=>g.actor));return["all",...Array.from(p).sort()]},[e]),h=R.useMemo(()=>{const p=o.trim().toLowerCase();return e.filter(g=>t!=="all"&&g.verb!==t||s!=="all"&&g.actor!==s?!1:p?g.verb.toLowerCase().includes(p)||g.qitemId.toLowerCase().includes(p)||(g.reason??"").toLowerCase().includes(p):!0)},[e,t,s,o]);return e.length===0?a.jsx("div",{className:"p-4 font-mono text-[10px] text-stone-400","data-testid":"decisions-empty",children:"No mission_control_actions rows found for this slice's qitem chain."}):a.jsxs("div",{"data-testid":"decisions-tab",className:"flex h-full flex-col",children:[a.jsxs("div",{className:"flex flex-wrap gap-2 border-b border-stone-200 bg-stone-50 p-3","data-testid":"decisions-filters",children:[a.jsx("select",{"data-testid":"decisions-verb-filter",value:t,onChange:p=>n(p.target.value),className:"border border-stone-300 bg-white px-2 py-1 font-mono text-[10px]",children:u.map(p=>a.jsx("option",{value:p,children:p},p))}),a.jsx("select",{"data-testid":"decisions-actor-filter",value:s,onChange:p=>r(p.target.value),className:"border border-stone-300 bg-white px-2 py-1 font-mono text-[10px]",children:f.map(p=>a.jsx("option",{value:p,children:p},p))}),a.jsx("input",{"data-testid":"decisions-search",type:"text",placeholder:"search verb / qitem / reason",value:o,onChange:p=>c(p.target.value),className:"flex-1 min-w-32 border border-stone-300 bg-white px-2 py-1 font-mono text-[10px]"}),a.jsxs("span",{className:"font-mono text-[10px] text-stone-500","data-testid":"decisions-result-count",children:[h.length," / ",e.length]})]}),a.jsx("div",{className:"flex-1 overflow-y-auto","data-testid":"decisions-list",children:h.map(p=>a.jsx(due,{row:p},p.actionId))})]})}function due({row:e}){const[t,n]=R.useState(!1);return a.jsxs("div",{className:"border-b border-stone-100 px-4 py-2 hover:bg-stone-50",children:[a.jsxs("button",{type:"button","data-testid":`decision-row-${e.actionId}`,onClick:()=>n(s=>!s),className:"w-full text-left",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"font-mono text-[9px] text-stone-500 shrink-0",children:e.ts.slice(0,19)}),a.jsx("span",{className:"font-mono text-[10px] font-bold text-stone-900 shrink-0",children:e.verb}),a.jsx("span",{className:"font-mono text-[9px] text-stone-500 shrink-0",children:e.actor}),a.jsx("span",{className:"font-mono text-[9px] text-stone-400 truncate",children:e.qitemId})]}),e.reason&&a.jsx("div",{className:"ml-[120px] font-mono text-[10px] text-stone-700",children:e.reason})]}),t&&a.jsxs("div",{className:"ml-[120px] mt-1 grid grid-cols-2 gap-2","data-testid":`decision-row-detail-${e.actionId}`,children:[a.jsxs("pre",{className:"overflow-x-auto bg-stone-50 p-2 font-mono text-[9px] text-stone-700",children:[a.jsx("div",{className:"text-stone-500",children:"before:"}),e.beforeState??"null"]}),a.jsxs("pre",{className:"overflow-x-auto bg-stone-50 p-2 font-mono text-[9px] text-stone-700",children:[a.jsx("div",{className:"text-stone-500",children:"after:"}),e.afterState??"null"]})]})]})}const fue={pass:"text-emerald-900",fail:"text-red-900",partial:"text-amber-900",unknown:"text-stone-700"};function hue({sliceName:e,tests:t,qitemCount:n,docsCount:s,lastActivityAt:r}){return t.proofPackets.length===0?a.jsxs("div",{className:"border border-outline-variant bg-white/20 p-4 font-mono","data-testid":"tests-empty",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-[0.14em] text-stone-500",children:"No proof packet matched"}),a.jsx("p",{"data-testid":"tests-empty-reason",className:"mt-2 max-w-2xl text-[11px] leading-relaxed text-stone-700",children:"The proof matcher did not find a dogfood-evidence directory whose name contains this slice id. Evidence may still exist under the configured evidence root or under a related mission folder."}),a.jsxs("div",{"data-testid":"tests-empty-diagnostics",className:"mt-3 grid gap-2 text-[10px] text-stone-600 sm:grid-cols-3",children:[a.jsx(rS,{label:"Qitems",value:n??0}),a.jsx(rS,{label:"Indexed files",value:s??0}),a.jsx(rS,{label:"Last activity",value:pue(r??null)})]}),a.jsxs("ul",{"data-testid":"tests-empty-next-steps",className:"mt-3 list-disc space-y-1 pl-4 text-[10px] leading-relaxed text-stone-600",children:[a.jsx("li",{children:"Check Artifacts for slice-local files and commit refs."}),a.jsx("li",{children:"Check the evidence root for dogfood screenshots or proof notes with related names."}),a.jsx("li",{children:"When a proof packet is added with a matching directory name, this tab will render it inline."})]})]}):a.jsxs("div",{"data-testid":"tests-tab",className:"p-4 space-y-4",children:[a.jsxs("header",{className:"flex items-center justify-between border-b border-stone-200 pb-2",children:[a.jsxs("div",{className:"inline-flex items-center gap-1.5 font-mono text-[11px] uppercase tracking-[0.12em] text-stone-700",children:[a.jsx(Pe,{tool:"proof",size:"xs"}),"Tests / Verification"]}),a.jsxs("div",{className:"font-mono text-[10px] text-stone-500","data-testid":"tests-aggregate",children:[t.aggregate.passCount," pass, ",t.aggregate.failCount," fail"," · ",t.proofPackets.length," packet",t.proofPackets.length===1?"":"s"]})]}),t.proofPackets.map(o=>a.jsx(mue,{sliceName:e,packet:o},o.dirName))]})}function rS({label:e,value:t}){return a.jsxs("div",{className:"border border-outline-variant bg-white/30 px-2 py-1",children:[a.jsx("div",{className:"text-[8px] uppercase tracking-[0.12em] text-stone-400",children:e}),a.jsx("div",{className:"mt-0.5 truncate text-stone-900",children:t})]})}function pue(e){if(!e)return"unknown";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function mue({sliceName:e,packet:t}){const[n,s]=R.useState(null);return a.jsxs("article",{className:"border border-stone-200 bg-white","data-testid":`tests-packet-${t.dirName}`,children:[a.jsx("header",{className:"flex items-center justify-between border-b border-stone-200 bg-stone-50 px-3 py-2",children:a.jsx("div",{className:`min-w-0 flex-1 ${fue[t.passFailBadge]}`,"data-testid":`tests-packet-badge-${t.dirName}`,children:a.jsx(Bp,{title:t.dirName,badge:t.passFailBadge})})}),a.jsxs("div",{className:"p-3 space-y-3",children:[t.primaryMarkdown&&a.jsxs("div",{"data-testid":`tests-packet-primary-md-${t.dirName}`,children:[a.jsxs("div",{className:"mb-1 font-mono text-[8px] uppercase tracking-[0.12em] text-stone-500",children:[a.jsx(Pe,{tool:t.primaryMarkdown.relPath,size:"xs",className:"mr-1 inline-block align-[-2px]",decorative:!0}),t.primaryMarkdown.relPath]}),a.jsx("pre",{className:"whitespace-pre-wrap break-words bg-stone-50 p-3 font-mono text-[10px] text-stone-800",children:t.primaryMarkdown.content})]}),t.screenshots.length>0&&a.jsxs("section",{"data-testid":`tests-packet-screenshots-${t.dirName}`,children:[a.jsxs("div",{className:"mb-1 font-mono text-[8px] uppercase tracking-[0.12em] text-stone-500",children:[a.jsx(Pe,{tool:"screenshot",size:"xs",className:"mr-1 inline-block align-[-2px]",decorative:!0}),"Screenshots (",t.screenshots.length,")"]}),a.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:t.screenshots.map(r=>a.jsxs("figure",{className:"border border-stone-200",children:[a.jsx("button",{type:"button","data-testid":`tests-packet-screenshot-open-${r}`,onClick:()=>s(r),className:"block w-full text-left",children:a.jsx("img",{"data-testid":`tests-packet-screenshot-${r}`,src:yu(e,r),alt:r,loading:"lazy",className:"block w-full bg-stone-100"})}),a.jsxs("figcaption",{className:"bg-stone-50 px-2 py-1 font-mono text-[9px] text-stone-500 truncate",children:[a.jsx(Pe,{tool:r,size:"xs",className:"mr-1 inline-block align-[-2px]",decorative:!0}),r]})]},r))})]}),a.jsx(d_,{sliceName:e,relPath:n,onClose:()=>s(null),testId:"tests-screenshot-viewer",imageTestId:"tests-screenshot-viewer-image",closeTestId:"tests-screenshot-viewer-close"}),t.videos.length>0&&a.jsxs("section",{"data-testid":`tests-packet-videos-${t.dirName}`,children:[a.jsxs("div",{className:"mb-1 font-mono text-[8px] uppercase tracking-[0.12em] text-stone-500",children:[a.jsx(Pe,{tool:"video",size:"xs",className:"mr-1 inline-block align-[-2px]",decorative:!0}),"Videos (",t.videos.length,")"]}),a.jsx("div",{className:"space-y-3",children:t.videos.map(r=>a.jsxs("figure",{className:"border border-stone-200",children:[a.jsx("video",{"data-testid":`tests-packet-video-${r}`,src:yu(e,r),controls:!0,preload:"metadata",className:"block w-full bg-black"}),a.jsx("figcaption",{className:"bg-stone-50 px-2 py-1 font-mono text-[9px] text-stone-500 truncate",children:r})]},r))})]}),t.traces.length>0&&a.jsxs("section",{"data-testid":`tests-packet-traces-${t.dirName}`,children:[a.jsxs("div",{className:"mb-1 font-mono text-[8px] uppercase tracking-[0.12em] text-stone-500",children:[a.jsx(Pe,{tool:"trace",size:"xs",className:"mr-1 inline-block align-[-2px]",decorative:!0}),"Traces (download)"]}),a.jsx("ul",{className:"font-mono text-[10px]",children:t.traces.map(r=>a.jsx("li",{children:a.jsxs("a",{href:yu(e,r),download:!0,className:"inline-flex items-center gap-1 text-blue-700 hover:underline",children:[a.jsx(Pe,{tool:r,size:"xs",decorative:!0}),r]})},r))})]}),t.additionalMarkdown.length>0&&a.jsxs("details",{children:[a.jsxs("summary",{className:"cursor-pointer font-mono text-[10px] text-stone-700","data-testid":`tests-packet-additional-md-toggle-${t.dirName}`,children:["Additional markdown (",t.additionalMarkdown.length,")"]}),a.jsx("div",{className:"mt-2 space-y-2",children:t.additionalMarkdown.map(r=>a.jsxs("div",{children:[a.jsxs("div",{className:"inline-flex items-center gap-1 font-mono text-[8px] uppercase tracking-[0.12em] text-stone-500",children:[a.jsx(Pe,{tool:r.relPath,size:"xs",decorative:!0}),r.relPath]}),a.jsx("pre",{className:"whitespace-pre-wrap break-words bg-stone-50 p-2 font-mono text-[9px] text-stone-700",children:r.content})]},r.relPath))})]})]})]})}const Yh=200,Wh=112,gue={sliceWorkflowStep:yue};function xue({specGraph:e}){const{nodes:t,edges:n}=R.useMemo(()=>vue(e),[e]);return a.jsxs("section",{"data-testid":"topology-spec-graph","data-spec-name":e.specName,"data-spec-version":e.specVersion,"data-layout":"react-flow-dagre",className:"border border-outline-variant bg-white/20",children:[a.jsxs("header",{className:"flex items-center justify-between border-b border-outline-variant bg-white/20 px-3 py-2",children:[a.jsxs("div",{className:"font-mono text-[10px] uppercase tracking-[0.10em] text-stone-500",children:["Workflow graph - ",e.specName," v",e.specVersion]}),a.jsxs("div",{className:"font-mono text-[9px] uppercase tracking-[0.10em] text-stone-400",children:[e.nodes.length," steps / ",e.edges.length," edges"]})]}),a.jsx("div",{"data-testid":"slice-workflow-graph",className:"h-[420px] bg-[radial-gradient(circle_at_1px_1px,rgba(87,83,78,0.22)_1px,transparent_0)] [background-size:18px_18px]",children:a.jsxs(gd,{nodes:t,edges:n,nodeTypes:gue,fitView:!0,minZoom:.2,maxZoom:1.5,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,proOptions:{hideAttribution:!0},children:[a.jsx(bN,{gap:18,size:.5,color:"#d6d3cd"}),a.jsx(xd,{showInteractive:!1})]})}),a.jsx("div",{className:"sr-only","data-testid":"slice-workflow-edge-metadata",children:e.edges.map(s=>a.jsxs("span",{"data-testid":`spec-edge-${s.fromStepId}-${s.toStepId}`,"data-routing-type":s.routingType,"data-is-loop-back":s.isLoopBack,children:[s.fromStepId," to ",s.toStepId]},`${s.fromStepId}-${s.toStepId}`))})]})}function vue(e){const t=new bp.graphlib.Graph;t.setDefaultEdgeLabel(()=>({})),t.setGraph({rankdir:"LR",nodesep:80,ranksep:110,marginx:24,marginy:24}),e.nodes.forEach(r=>{t.setNode(r.stepId,{width:Yh,height:Wh})}),e.edges.forEach(r=>{t.setEdge(r.fromStepId,r.toStepId)}),bp.layout(t);const n=e.nodes.map(r=>{const o=t.node(r.stepId);return{id:r.stepId,type:"sliceWorkflowStep",position:{x:((o==null?void 0:o.x)??0)-Yh/2,y:((o==null?void 0:o.y)??0)-Wh/2},data:{step:r},sourcePosition:ve.Right,targetPosition:ve.Left,width:Yh,height:Wh}}),s=e.edges.map(r=>({id:`spec-edge-${r.fromStepId}-${r.toStepId}`,source:r.fromStepId,target:r.toStepId,type:"smoothstep",markerEnd:{type:Ul.ArrowClosed,color:r.isLoopBack?"#b45309":"#57534e"},style:{stroke:r.isLoopBack?"#b45309":"#57534e",strokeWidth:r.isLoopBack?1.5:1.25,strokeDasharray:r.isLoopBack?"6 5":void 0},label:r.isLoopBack?"loop":r.routingType,labelStyle:{fill:r.isLoopBack?"#b45309":"#78716c",fontSize:9,fontFamily:"monospace",textTransform:"uppercase"}}));return{nodes:n,edges:s}}function yue({data:e}){const t=e.step;return a.jsxs("div",{"data-testid":`spec-node-${t.stepId}`,"data-is-current":t.isCurrent,"data-is-entry":t.isEntry,"data-is-terminal":t.isTerminal,style:{width:Yh,height:Wh},className:`relative border border-outline-variant bg-white/30 p-3 font-mono hard-shadow ${t.isCurrent?"ring-2 ring-emerald-500/50 bg-emerald-50/60":""}`,children:[a.jsx(Dp,{testIdPrefix:`slice-workflow-${t.stepId}`}),a.jsx(gn,{type:"target",position:ve.Left,className:"!h-2 !w-2 !border-outline-variant !bg-stone-500"}),a.jsx(gn,{type:"source",position:ve.Right,className:"!h-2 !w-2 !border-outline-variant !bg-stone-500"}),a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-[11px] font-bold uppercase tracking-[0.04em] text-stone-950",children:t.stepId}),a.jsx("div",{className:"mt-0.5 text-[9px] uppercase tracking-[0.10em] text-stone-500",children:t.role})]}),a.jsxs("div",{className:"flex flex-col items-end gap-1",children:[t.isEntry&&a.jsx("span",{"data-testid":`spec-node-${t.stepId}-entry-badge`,className:"border border-blue-300 bg-blue-50 px-1 text-[8px] uppercase tracking-[0.10em] text-blue-900",children:"entry"}),t.isCurrent&&a.jsx("span",{"data-testid":`spec-node-${t.stepId}-current-badge`,className:"border border-emerald-400 bg-emerald-100 px-1 text-[8px] uppercase tracking-[0.10em] text-emerald-900",children:"current"}),t.isTerminal&&a.jsxs("span",{"data-testid":`spec-node-${t.stepId}-terminal-badge`,className:"inline-flex items-center gap-1 border border-stone-300 bg-stone-100 px-1 text-[8px] uppercase tracking-[0.10em] text-stone-700",children:[a.jsx(Pe,{tool:"terminal",size:"xs"}),"terminal"]})]})]}),a.jsx("div",{className:"mt-3 text-[10px] leading-4 text-stone-800",children:t.label}),t.preferredTarget&&a.jsx("div",{className:"mt-2 truncate text-[9px] text-stone-500",children:t.preferredTarget})]})}function c6({topology:e}){const{affectedRigs:t,totalSeats:n,specGraph:s}=e,r=s??bue(t);return t.length>0||s!==null?a.jsxs("div",{"data-testid":"topology-tab",className:"p-4 space-y-4",children:[a.jsxs("header",{className:"flex items-center justify-between border-b border-stone-200 pb-2",children:[a.jsx("div",{className:"font-mono text-[11px] uppercase tracking-[0.12em] text-stone-700",children:"Topology"}),a.jsxs("div",{className:"font-mono text-[10px] text-stone-500","data-testid":"topology-aggregate",children:[n," seat",n===1?"":"s"," · ",t.length," rig",t.length===1?"":"s",s&&a.jsxs(a.Fragment,{children:[" · spec ",a.jsx("span",{"data-testid":"topology-spec-name",children:s.specName})," v",s.specVersion]})]})]}),r&&a.jsx(xue,{specGraph:r}),t.length>0&&a.jsxs("div",{"data-testid":"topology-rig-listing",className:"space-y-3",children:[r&&a.jsx("div",{className:"font-mono text-[10px] uppercase tracking-[0.10em] text-stone-500",children:"Active seats"}),t.map(c=>a.jsxs("section",{"data-testid":`topology-rig-${c.rigName}`,className:"border border-stone-200 bg-white",children:[a.jsxs("header",{className:"flex items-center justify-between border-b border-stone-200 bg-stone-50 px-3 py-2",children:[a.jsx("div",{className:"font-mono text-[10px] font-bold text-stone-900",children:c.rigName}),a.jsx(Ye,{to:"/rigs/$rigId",params:{rigId:c.rigId},"data-testid":`topology-rig-${c.rigName}-open`,className:"font-mono text-[9px] uppercase tracking-[0.10em] text-blue-700 hover:underline",children:"Open topology →"})]}),a.jsx("ul",{className:"divide-y divide-stone-100",children:c.sessionNames.map(u=>a.jsx(wue,{session:u},u))})]},c.rigName))]})]}):a.jsx("div",{className:"p-4 font-mono text-[10px] text-stone-400","data-testid":"topology-empty",children:"No seats found for this slice's qitem chain."})}function bue(e){if(e.length===0)return null;const t=e.map((n,s)=>({stepId:n.rigName||n.rigId||`rig-${s+1}`,label:n.rigName||n.rigId||`Rig ${s+1}`,role:`${n.sessionNames.length} seat${n.sessionNames.length===1?"":"s"}`,preferredTarget:n.sessionNames[0]??null,isEntry:s===0,isCurrent:s===e.length-1,isTerminal:s===e.length-1}));return{specName:"runtime-handoff-map",specVersion:"derived",nodes:t,edges:t.slice(0,-1).map((n,s)=>({fromStepId:n.stepId,toStepId:t[s+1].stepId,routingType:"direct",isLoopBack:!1}))}}function wue({session:e}){const[t,n]=R.useState(!1);return a.jsxs("li",{"data-testid":`topology-seat-${e}`,"data-open":t?"true":"false",className:"px-3 py-1",children:[a.jsxs("button",{type:"button","data-testid":`topology-seat-${e}-toggle`,onClick:()=>n(s=>!s),className:"flex w-full items-baseline gap-2 text-left font-mono text-[10px] text-stone-700 hover:bg-stone-50 -mx-3 px-3 py-0.5",children:[a.jsx("span",{className:"flex-1 truncate",children:e}),a.jsx("span",{className:"text-stone-400 shrink-0",children:t?"▾":"▸"})]}),t&&a.jsx("div",{"data-testid":`topology-seat-${e}-preview`,className:"mt-1",children:a.jsx(em,{sessionName:e,testIdPrefix:`topology-preview-${e}`})})]})}const u6=[{id:"overview",label:"Overview"},{id:"story",label:"Story"},{id:"progress",label:"Progress"},{id:"artifacts",label:"Artifacts"},{id:"tests",label:"Tests"},{id:"queue",label:"Queue"},{id:"topology",label:"Topology"}],iS=[{id:"story",label:"Story"},{id:"overview",label:"Overview"},{id:"progress",label:"Progress"},{id:"artifacts",label:"Artifacts"},{id:"tests",label:"Tests"},{id:"queue",label:"Queue"},{id:"topology",label:"Topology"}];function Sue({tabs:e,active:t,onSelect:n}){return a.jsx("div",{role:"tablist","data-testid":"project-tab-nav",className:"flex gap-1 border-b border-outline-variant mb-6 overflow-x-auto",children:e.map(s=>a.jsx("button",{type:"button",role:"tab","aria-selected":t===s.id,"data-testid":`project-tab-${s.id}`,"data-active":t===s.id,onClick:()=>n(s.id),className:he("px-3 py-2 font-mono text-[10px] uppercase tracking-[0.18em] border-b-2 -mb-px shrink-0",t===s.id?"border-stone-900 text-stone-900":"border-transparent text-on-surface-variant hover:text-stone-900"),children:s.label},s.id))})}function _u({eyebrow:e,title:t,tabs:n,active:s,onSelect:r,children:o}){return a.jsxs("div",{className:"mx-auto w-full max-w-[1200px] px-6 py-8",children:[a.jsxs("header",{className:"border-b border-outline-variant pb-4 mb-4",children:[a.jsx(rt,{tone:"muted",children:e}),a.jsx("h1",{className:"font-headline text-headline-md font-bold tracking-tight uppercase text-stone-900 mt-1",children:t})]}),a.jsx(Sue,{tabs:n,active:s,onSelect:r}),a.jsx("div",{role:"tabpanel","data-testid":"project-tab-panel",children:o})]})}function S_({label:e,description:t}){return a.jsx(Xe,{label:e,description:t??"Phase 5 polish.",variant:"card",testId:`project-tab-placeholder-${e.toLowerCase()}`})}function jue(e){return e<=0?"no recent activity":new Date(e).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function Nue(e){return e.missionId??e.railItem??"unsorted"}function _ue(e,t){return t?e.filter(n=>Nue(n)===t):e}function d6(e,t){const n=Mp("all"),s=R.useMemo(()=>!n.data||"unavailable"in n.data?[]:_ue(n.data.slices,e),[n.data,e]),r=xL(t?s.map(u=>u.name):[]),o=R.useMemo(()=>{const u=new Set;for(const f of r.itemsByName.values())Array.isArray(f.qitemIds)&&f.qitemIds.forEach(h=>u.add(h));return Array.from(u).sort()},[r.itemsByName]),c=Pj(t?o:[]);return{list:n,rows:s,details:r,qitemIds:o,queueItems:c}}function f6({rows:e,detailsByName:t,isLoading:n}){return n&&e.length===0?a.jsx(S_,{label:"LOADING PROGRESS",description:"Reading scoped slice progress."}):e.length===0?a.jsx(Xe,{label:"NO SCOPED SLICES",description:"No slices are indexed for this scope.",variant:"card",testId:"scope-progress-empty"}):a.jsx("div",{"data-testid":"scope-progress-rollup",className:"space-y-3",children:e.map(s=>{const r=t.get(s.name);return a.jsxs("article",{className:"border border-outline-variant bg-white/35 p-3 backdrop-blur-sm",children:[a.jsx("div",{className:"flex items-start justify-between gap-3 border-b border-outline-variant pb-2",children:a.jsxs("div",{className:"min-w-0",children:[a.jsx(Ye,{to:"/project/slice/$sliceId",params:{sliceId:s.name},className:"font-mono text-[12px] uppercase tracking-[0.12em] text-stone-900 hover:underline",children:s.displayName}),a.jsxs("div",{className:"mt-2 flex flex-wrap gap-1.5",children:[a.jsx(Nn,{token:qp(),compact:!0}),a.jsx(Nn,{token:{label:s.status,tone:$p(s.status)},compact:!0}),a.jsx(oo,{value:s.lastActivityAt})]})]})}),a.jsxs("div",{className:"mt-3 grid gap-2 font-mono text-[10px] text-stone-700 sm:grid-cols-4",children:[a.jsx(pn,{label:"Qitems",value:(r==null?void 0:r.qitemIds.length)??s.qitemCount}),a.jsx(pn,{label:"Proof",value:r?r.tests.proofPackets.length:s.hasProofPacket?1:0}),a.jsx(pn,{label:"Progress",value:r?`${r.acceptance.percentage}%`:"unknown"}),a.jsx(pn,{label:"Last activity",value:j_(s.lastActivityAt)})]})]},s.name)})})}function h6({qitemIds:e,queueItemsById:t,isFetching:n}){return e.length===0?a.jsx(Xe,{label:"NO QITEMS",description:"No queue items are indexed for this scope.",variant:"card",testId:"scope-queue-empty"}):a.jsxs("div",{"data-testid":"scope-queue-rollup",children:[n?a.jsx("div",{className:"mb-2 font-mono text-[10px] uppercase tracking-[0.12em] text-stone-400",children:"Loading queue bodies..."}):null,a.jsx("ul",{className:"divide-y divide-outline-variant border border-outline-variant",children:e.map(s=>{const r=t.get(s);return a.jsx("li",{className:"bg-white/35 backdrop-blur-sm",children:a.jsxs(Nm,{data:y6(s,r),testId:`scope-queue-trigger-${s}`,className:"block w-full px-3 py-2 text-left font-mono text-xs transition-colors hover:bg-white/55",children:[a.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[r!=null&&r.state?a.jsx(Jj,{state:r.state,compact:!0}):a.jsx(Zj,{kind:"queue.item",compact:!0}),a.jsx(oo,{value:r==null?void 0:r.tsCreated})]}),a.jsx("span",{className:"mt-2 block whitespace-pre-wrap break-words text-stone-900",children:b6(s,r)}),r?a.jsxs("span",{className:"mt-2 block space-y-2",children:[a.jsx(zp,{source:r.sourceSession,destination:r.destinationSession,muted:!0}),a.jsx("span",{className:"flex flex-wrap gap-1.5",children:(r.tags??[]).slice(0,5).map(o=>a.jsx(Wi,{tag:o},o))})]}):null]})},s)})})]})}function p6({rows:e,detailsByName:t}){return e.length===0?a.jsx(Xe,{label:"NO ARTIFACTS",description:"No slices are indexed for this scope.",variant:"card",testId:"scope-artifacts-empty"}):a.jsx("div",{"data-testid":"scope-artifacts-rollup",className:"space-y-3",children:e.map(n=>{const s=t.get(n.name),r=(s==null?void 0:s.tests.proofPackets.length)??(n.hasProofPacket?1:0),o=(s==null?void 0:s.tests.proofPackets.reduce((c,u)=>c+u.screenshots.length,0))??0;return a.jsxs("article",{className:"border border-outline-variant bg-white/35 p-3 backdrop-blur-sm",children:[a.jsx(Ye,{to:"/project/slice/$sliceId",params:{sliceId:n.name},className:"font-mono text-[12px] uppercase tracking-[0.12em] text-stone-900 hover:underline",children:n.displayName}),a.jsxs("div",{className:"mt-2 flex flex-wrap gap-1.5",children:[a.jsx(Nn,{token:qp(),compact:!0}),a.jsx(Nn,{token:{label:n.status,tone:$p(n.status)},compact:!0})]}),a.jsxs("div",{className:"mt-3 grid gap-2 font-mono text-[10px] text-stone-700 sm:grid-cols-4",children:[a.jsx(pn,{label:"Files",value:(s==null?void 0:s.docs.tree.length)??"unknown"}),a.jsx(pn,{label:"Commits",value:(s==null?void 0:s.commitRefs.length)??"unknown"}),a.jsx(pn,{label:"Proof packets",value:r}),a.jsx(pn,{label:"Screenshots",value:o})]})]},n.name)})})}function m6({rows:e,detailsByName:t,queueItemsById:n,isFetching:s}){const r=R.useMemo(()=>new Map(e.map(c=>[c.name,c])),[e]),o=R.useMemo(()=>Array.from(t.values()).flatMap(c=>{const u=r.get(c.name),f=(u==null?void 0:u.displayName)??c.displayName??c.name;return g6(c).map(h=>({...h,detail:{...h.detail??{},sliceLabel:f,sliceName:c.name}}))}),[t,r]);return s&&o.length===0?a.jsx(S_,{label:"LOADING STORY",description:"Reading scoped story events."}):o.length===0?a.jsx(Xe,{label:"NO STORY EVENTS",description:"No story events are indexed for this scope.",variant:"card",testId:"scope-story-empty"}):a.jsx("div",{"data-testid":"scope-story-rollup",children:a.jsx(o6,{events:o,phaseDefinitions:null,queueItemsById:n})})}function g6(e){const t=new Set(e.qitemIds);return e.story.events.filter(n=>!n.qitemId||t.has(n.qitemId))}function x6({rows:e,detailsByName:t,isFetching:n}){const[s,r]=R.useState(null),c=e.map(u=>({row:u,detail:t.get(u.name)})).filter(({detail:u})=>u&&u.tests.proofPackets.length>0);return n&&t.size===0?a.jsx(S_,{label:"LOADING TESTS",description:"Reading scoped proof packets."}):c.length===0?a.jsx(Xe,{label:"NO PROOF PACKETS",description:"No proof evidence is indexed for this scope.",variant:"card",testId:"scope-tests-empty"}):a.jsxs("div",{"data-testid":"scope-tests-rollup",className:"space-y-3",children:[c.map(({row:u,detail:f})=>{if(!f)return null;const h=f.tests.proofPackets.reduce((p,g)=>p+g.screenshots.length,0);return a.jsxs("article",{className:"border border-outline-variant bg-white/35 p-3 backdrop-blur-sm",children:[a.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3 border-b border-outline-variant pb-2",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx(Ye,{to:"/project/slice/$sliceId",params:{sliceId:u.name},className:"font-mono text-[12px] uppercase tracking-[0.12em] text-stone-900 hover:underline",children:u.displayName}),a.jsxs("div",{className:"mt-2 flex flex-wrap gap-1.5",children:[a.jsx(Nn,{token:qp(),compact:!0}),a.jsx(Nn,{token:{label:`${f.tests.proofPackets.length} packets`,tone:"info"},compact:!0}),a.jsx(Nn,{token:{label:`${h} screenshots`,tone:"success"},compact:!0})]})]}),a.jsx(oo,{value:u.lastActivityAt})]}),a.jsx("div",{className:"mt-3 space-y-3",children:f.tests.proofPackets.map(p=>{var g;return a.jsxs("div",{className:"border border-outline-variant bg-white/30 p-2 backdrop-blur-sm",children:[a.jsx(Bp,{title:p.dirName,badge:p.passFailBadge}),(g=p.primaryMarkdown)!=null&&g.content?a.jsx("p",{className:"mt-2 line-clamp-3 font-mono text-[10px] leading-relaxed text-stone-700",children:p.primaryMarkdown.content}):null,p.screenshots.length>0?a.jsx("div",{className:"mt-2",children:a.jsx(HL,{sliceName:f.name,screenshots:p.screenshots,onSelect:x=>r({sliceName:f.name,relPath:x}),testIdPrefix:`scope-proof-screenshot-${f.name}`})}):null]},p.dirName)})})]},u.name)}),a.jsx(d_,{sliceName:(s==null?void 0:s.sliceName)??"",relPath:(s==null?void 0:s.relPath)??null,onClose:()=>r(null)})]})}function Cue(e){const t=new Map;for(const s of e.values())if(!(!s.topology||!Array.isArray(s.topology.affectedRigs)))for(const r of s.topology.affectedRigs){const o=r.rigName||r.rigId;t.has(o)||t.set(o,{rigId:r.rigId,rigName:r.rigName,sessionNames:new Set});const c=t.get(o);r.sessionNames.forEach(u=>c.sessionNames.add(u))}const n=Array.from(t.values()).map(s=>({rigId:s.rigId,rigName:s.rigName,sessionNames:Array.from(s.sessionNames).sort()}));return{affectedRigs:n,totalSeats:n.reduce((s,r)=>s+r.sessionNames.length,0),specGraph:null}}function v6({detailsByName:e}){return a.jsx("div",{"data-testid":"scope-topology-rollup",children:a.jsx(c6,{topology:Cue(e)})})}function kue(){const{data:e,isLoading:t}=Mp("all"),n=R.useMemo(()=>{if(!e||"unavailable"in e)return[];const o=new Map;for(const c of e.slices){const u=wL(c),f=u.missionId??u.railItem??"unsorted";o.has(f)||o.set(f,[]),o.get(f).push(u)}return Array.from(o.entries()).map(([c,u])=>({id:c,label:c==="unsorted"?"Unsorted":c,status:$h(u),slices:u}))},[e]),s=R.useMemo(()=>SL(n),[n]);if(t)return a.jsx(Xe,{label:"LOADING WORKSPACE",description:"Reading slice index.",variant:"card",testId:"workspace-overview-loading"});if(e&&"unavailable"in e)return a.jsx(Xe,{label:"WORKSPACE INDEX UNAVAILABLE",description:e.hint??"Slice index is not available from the configured workspace.",variant:"card",testId:"workspace-overview-unavailable"});const r=(o,c)=>a.jsxs("article",{"data-testid":`workspace-overview-mission-${o.id}`,"data-mission-bucket":c,className:"border border-outline-variant bg-white/20 px-3 py-3",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3 border-b border-outline-variant pb-2",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("h3",{className:"font-mono text-[12px] uppercase tracking-[0.12em] text-stone-900 truncate",children:o.label}),a.jsxs("p",{className:"font-mono text-[9px] uppercase tracking-[0.12em] text-stone-500",children:[o.slices.length," slice",o.slices.length===1?"":"s"," ·"," ",jue(LS(o))]})]}),a.jsx("span",{className:"font-mono text-[9px] uppercase tracking-[0.12em] text-stone-500",children:o.status})]}),a.jsx("ul",{className:"mt-2 space-y-1",children:o.slices.map(u=>a.jsx("li",{children:a.jsxs(Ye,{to:"/project/slice/$sliceId",params:{sliceId:u.name},"data-testid":`workspace-overview-slice-${u.name}`,className:"block px-2 py-1 font-mono text-[11px] text-on-surface hover:bg-surface-low hover:text-stone-900",children:[a.jsx("span",{className:"block truncate",children:u.displayName}),a.jsx("span",{className:"block truncate text-[9px] uppercase tracking-[0.12em] text-stone-500",children:jL(u)})]})},u.name))})]},o.id);return a.jsxs("div",{"data-testid":"workspace-overview-panel",className:"grid gap-4 lg:grid-cols-2",children:[a.jsxs("section",{"data-testid":"workspace-overview-current",className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between border-b border-outline-variant pb-2",children:[a.jsx("h2",{className:"font-mono text-[11px] uppercase tracking-[0.16em] text-stone-900",children:"Current Work"}),a.jsx("span",{className:"font-mono text-[10px] text-stone-500",children:s.current.length})]}),s.current.length>0?s.current.map(o=>r(o,"current")):a.jsx(Xe,{label:"NO CURRENT WORK",description:"No live qitem-backed or recent active slices are indexed.",variant:"card",testId:"workspace-overview-current-empty"})]}),a.jsxs("section",{"data-testid":"workspace-overview-archive",className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between border-b border-outline-variant pb-2",children:[a.jsx("h2",{className:"font-mono text-[11px] uppercase tracking-[0.16em] text-stone-900",children:"Archive"}),a.jsx("span",{className:"font-mono text-[10px] text-stone-500",children:s.archive.length})]}),s.archive.length>0?s.archive.map(o=>r(o,"archive")):a.jsx(Xe,{label:"NO ARCHIVE",description:"No archived slices are indexed.",variant:"card",testId:"workspace-overview-archive-empty"})]})]})}function Rue(){const[e,t]=R.useState("overview"),n=Dj(),s=d6(null,e!=="overview");return!n.isLoading&&n.name===null?a.jsx("div",{className:"mx-auto w-full max-w-[960px] px-6 py-12",children:a.jsx(Xe,{label:"NO WORKSPACE CONNECTED",description:"Configure a workspace root to browse missions and slices in this destination.",variant:"card",testId:"workspace-scope-no-workspace",action:{label:"Open settings",href:"/settings"}})}):a.jsxs(_u,{eyebrow:"Workspace",title:n.name??"loading…",tabs:u6,active:e,onSelect:r=>t(r),children:[e==="overview"?a.jsx(kue,{}):null,e==="story"?a.jsx(m6,{rows:s.rows,detailsByName:s.details.itemsByName,queueItemsById:s.queueItems.itemsById,isFetching:s.details.isFetching||s.queueItems.isFetching}):null,e==="progress"?a.jsx(f6,{rows:s.rows,detailsByName:s.details.itemsByName,isLoading:s.list.isLoading||s.details.isFetching}):null,e==="artifacts"?a.jsx(p6,{rows:s.rows,detailsByName:s.details.itemsByName}):null,e==="tests"?a.jsx(x6,{rows:s.rows,detailsByName:s.details.itemsByName,isFetching:s.details.isFetching}):null,e==="queue"?a.jsx(h6,{qitemIds:s.qitemIds,queueItemsById:s.queueItems.itemsById,isFetching:s.details.isFetching||s.queueItems.isFetching}):null,e==="topology"?a.jsx(v6,{detailsByName:s.details.itemsByName}):null]})}function Eue(){const{missionId:e}=Cn({from:"/project/mission/$missionId"}),[t,n]=R.useState("overview"),s=d6(e,t!=="overview");return a.jsxs(_u,{eyebrow:"Mission",title:e,tabs:u6,active:t,onSelect:r=>n(r),children:[t==="overview"?a.jsx("div",{"data-testid":"mission-overview-panel",className:"space-y-3",children:s.rows.length>0?s.rows.map(r=>a.jsxs("article",{className:"border border-outline-variant bg-white/35 p-3 backdrop-blur-sm",children:[a.jsx(Ye,{to:"/project/slice/$sliceId",params:{sliceId:r.name},className:"font-mono text-[12px] uppercase tracking-[0.12em] text-stone-900 hover:underline",children:r.displayName}),a.jsxs("div",{className:"mt-2 flex flex-wrap gap-1.5",children:[a.jsx(Nn,{token:qp(),compact:!0}),a.jsx(Nn,{token:{label:r.status,tone:$p(r.status)},compact:!0}),a.jsx(oo,{value:r.lastActivityAt})]}),a.jsxs("div",{className:"mt-2 grid gap-2 font-mono text-[10px] text-stone-700 sm:grid-cols-4",children:[a.jsx(pn,{label:"Status",value:r.status}),a.jsx(pn,{label:"Qitems",value:r.qitemCount}),a.jsx(pn,{label:"Proof",value:r.hasProofPacket?"yes":"no"}),a.jsx(pn,{label:"Last activity",value:j_(r.lastActivityAt)})]})]},r.name)):a.jsx(Xe,{label:"NO SLICES",description:"No indexed slices are attached to this mission.",variant:"card",testId:"mission-overview-empty"})}):null,t==="story"?a.jsx(m6,{rows:s.rows,detailsByName:s.details.itemsByName,queueItemsById:s.queueItems.itemsById,isFetching:s.details.isFetching||s.queueItems.isFetching}):null,t==="progress"?a.jsx(f6,{rows:s.rows,detailsByName:s.details.itemsByName,isLoading:s.list.isLoading||s.details.isFetching}):null,t==="artifacts"?a.jsx(p6,{rows:s.rows,detailsByName:s.details.itemsByName}):null,t==="tests"?a.jsx(x6,{rows:s.rows,detailsByName:s.details.itemsByName,isFetching:s.details.isFetching}):null,t==="queue"?a.jsx(h6,{qitemIds:s.qitemIds,queueItemsById:s.queueItems.itemsById,isFetching:s.details.isFetching||s.queueItems.isFetching}):null,t==="topology"?a.jsx(v6,{detailsByName:s.details.itemsByName}):null]})}function y6(e,t){return{qitemId:e,source:t==null?void 0:t.sourceSession,destination:t==null?void 0:t.destinationSession,state:t==null?void 0:t.state,tags:(t==null?void 0:t.tags)??void 0,createdAt:t==null?void 0:t.tsCreated,body:t==null?void 0:t.body}}function b6(e,t){if(!(t!=null&&t.body))return e;const n=t.body.split(`
410
+ `);return n.length<=8?t.body:`${n.slice(0,8).join(`
411
+ `)}
412
+ ... ${n.length-8} more lines`}function Aue({qitemIds:e,queueItemsById:t,queueItemsFetching:n}){return e.length===0?a.jsx(Xe,{label:"NO QITEMS",description:"No queue items associated with this slice.",variant:"card",testId:"slice-queue-empty"}):a.jsxs("div",{children:[n?a.jsx("div",{"data-testid":"slice-queue-fetching",className:"mb-2 font-mono text-[10px] uppercase tracking-[0.12em] text-stone-400",children:"Loading queue bodies..."}):null,a.jsx("ul",{"data-testid":"slice-queue-list",className:"divide-y divide-outline-variant border border-outline-variant",children:e.map(s=>{const r=t.get(s);return a.jsx("li",{className:"bg-white/35 backdrop-blur-sm",children:a.jsxs(Nm,{data:y6(s,r),testId:`slice-queue-trigger-${s}`,className:"block w-full px-3 py-2 text-left hover:bg-white/55 transition-colors font-mono text-xs",children:[a.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[r!=null&&r.state?a.jsx(Jj,{state:r.state,compact:!0}):a.jsx(Zj,{kind:"queue.item",compact:!0}),a.jsx(oo,{value:r==null?void 0:r.tsCreated})]}),a.jsx("span",{className:"mt-2 block whitespace-pre-wrap break-words text-stone-900",children:b6(s,r)}),r?a.jsxs("span",{"data-testid":`slice-queue-meta-${s}`,className:"mt-2 block space-y-2 text-[10px] text-stone-500",children:[a.jsx(zp,{source:r.sourceSession,destination:r.destinationSession,muted:!0}),a.jsxs("span",{className:"flex flex-wrap gap-1.5",children:[a.jsx(Wi,{tag:s}),(r.tags??[]).slice(0,5).map(o=>a.jsx(Wi,{tag:o},o))]})]}):null]})},s)})})]})}function j_(e){return Xj(e)}function pn({label:e,value:t}){return a.jsxs("div",{className:"border border-outline-variant bg-white/35 p-3 backdrop-blur-sm",children:[a.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.14em] text-on-surface-variant",children:e}),a.jsx("div",{className:"mt-1 font-mono text-sm font-bold text-stone-900",children:t})]})}function Tue({detail:e}){const t=e.docs.tree,n=e.tests.proofPackets;return a.jsxs("div",{"data-testid":"slice-artifacts-tab",className:"space-y-6",children:[a.jsxs("section",{"data-testid":"slice-artifacts-files",className:"border border-outline-variant bg-white/20 p-4",children:[a.jsx(rt,{tone:"muted",children:"Files"}),t.length>0?a.jsx("ul",{className:"mt-3 divide-y divide-outline-variant border border-outline-variant bg-white/30",children:t.map(s=>a.jsxs("li",{className:"grid grid-cols-[1fr_auto_auto] gap-3 px-3 py-2 font-mono text-[10px]",children:[a.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1.5 text-stone-900",children:[a.jsx(Pe,{tool:s.relPath,size:"xs"}),a.jsx("span",{className:"truncate",children:s.relPath})]}),a.jsx("span",{className:"uppercase tracking-[0.10em] text-stone-500",children:s.type}),a.jsx("span",{className:"text-stone-400",children:s.size==null?"-":`${s.size}b`})]},s.relPath))}):a.jsx("div",{className:"mt-3 font-mono text-[10px] text-stone-400",children:"No slice files indexed."})]}),a.jsxs("section",{"data-testid":"slice-artifacts-commits",className:"border border-outline-variant bg-white/20 p-4",children:[a.jsx(rt,{tone:"muted",children:"Commits"}),e.commitRefs.length>0?a.jsx("ul",{className:"mt-3 divide-y divide-outline-variant border border-outline-variant bg-white/30",children:e.commitRefs.map(s=>a.jsx("li",{className:"px-3 py-2 font-mono text-[10px] text-stone-900",children:a.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1.5",children:[a.jsx(Pe,{tool:"commit",size:"xs",decorative:!0}),a.jsx("span",{className:"truncate",children:s})]})},s))}):a.jsx("div",{className:"mt-3 font-mono text-[10px] text-stone-400",children:"No commit refs indexed for this slice."})]}),a.jsxs("section",{"data-testid":"slice-artifacts-proof",className:"border border-outline-variant bg-white/20 p-4",children:[a.jsx(rt,{tone:"muted",children:"Proof Packets"}),n.length>0?a.jsx("ul",{className:"mt-3 divide-y divide-outline-variant border border-outline-variant bg-white/30",children:n.map(s=>a.jsxs("li",{className:"px-3 py-2 font-mono text-[10px] text-stone-700",children:[a.jsx(Bp,{title:s.dirName,badge:s.passFailBadge}),a.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-stone-500",children:[a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx(Pe,{tool:"screenshot",size:"xs",decorative:!0}),s.screenshots.length," screenshots"]}),a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx(Pe,{tool:"video",size:"xs",decorative:!0}),s.videos.length," videos"]}),a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx(Pe,{tool:"trace",size:"xs",decorative:!0}),s.traces.length," traces"]})]})]},s.dirName))}):a.jsx("div",{className:"mt-3 font-mono text-[10px] text-stone-400",children:"No proof packets indexed."})]}),a.jsxs("section",{"data-testid":"slice-artifacts-docs",children:[a.jsx(rt,{tone:"muted",children:"Docs Browser"}),a.jsx("div",{className:"mt-2 border border-outline-variant",children:a.jsx(cue,{sliceName:e.name,tree:t})})]}),a.jsxs("section",{"data-testid":"slice-artifacts-decisions",children:[a.jsx(rt,{tone:"muted",children:"Decisions"}),a.jsx("div",{className:"mt-2 border border-outline-variant",children:a.jsx(uue,{rows:e.decisions.rows})})]})]})}function Mue({detail:e}){const t=e.acceptance.currentStep,n=e.docs.tree.filter(s=>s.type==="file"&&/(^|\/)(README|IMPLEMENTATION-PRD|PROGRESS)\.md$/i.test(s.relPath));return a.jsxs("div",{"data-testid":"slice-overview-tab",className:"space-y-6",children:[a.jsxs("section",{"data-testid":"slice-overview-summary",className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-4",children:[a.jsx(pn,{label:"Status",value:e.status}),a.jsx(pn,{label:"Progress",value:`${e.acceptance.percentage}%`}),a.jsx(pn,{label:"Qitems",value:e.qitemIds.length}),a.jsx(pn,{label:"Last Activity",value:j_(e.lastActivityAt)})]}),a.jsxs("section",{"data-testid":"slice-overview-current-step",className:"border border-outline-variant bg-white/20 p-4",children:[a.jsx(rt,{tone:"muted",children:"Current Step"}),t?a.jsxs("div",{className:"mt-3 grid gap-2 font-mono text-[10px] text-stone-700 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-[8px] uppercase tracking-[0.14em] text-stone-400",children:"Step"}),a.jsx("div",{className:"font-bold text-stone-900",children:t.stepId})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-[8px] uppercase tracking-[0.14em] text-stone-400",children:"Role"}),a.jsx("div",{className:"font-bold text-stone-900",children:t.role})]}),a.jsxs("div",{className:"sm:col-span-2",children:[a.jsx("div",{className:"text-[8px] uppercase tracking-[0.14em] text-stone-400",children:"Objective"}),a.jsx("div",{children:t.objective??"No objective declared."})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-[8px] uppercase tracking-[0.14em] text-stone-400",children:"Allowed exits"}),a.jsx("div",{children:t.allowedExits.join(", ")||"-"})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-[8px] uppercase tracking-[0.14em] text-stone-400",children:"Hop count"}),a.jsx("div",{children:t.hopCount})]})]}):a.jsx("div",{className:"mt-3 font-mono text-[10px] text-stone-400",children:"No workflow step is currently bound."})]}),a.jsxs("section",{"data-testid":"slice-overview-readiness",className:"border border-outline-variant bg-white/20 p-4",children:[a.jsx(rt,{tone:"muted",children:"Readiness"}),a.jsxs("div",{className:"mt-3 space-y-2 font-mono text-[10px] text-stone-700",children:[a.jsxs("div",{children:[e.acceptance.doneItems," of ",e.acceptance.totalItems," acceptance items complete."]}),a.jsxs("div",{children:[e.tests.aggregate.passCount," proof packets passing / ",e.tests.aggregate.failCount," failing."]}),e.acceptance.closureCallout&&a.jsx("div",{className:"border border-amber-300 bg-amber-50 px-2 py-1 text-amber-800",children:e.acceptance.closureCallout}),e.workflowBinding&&a.jsxs("div",{className:"text-stone-500",children:["Workflow: ",e.workflowBinding.workflowName," v",e.workflowBinding.workflowVersion]})]})]}),a.jsxs("section",{"data-testid":"slice-overview-docs",className:"border border-outline-variant bg-white/20 p-4",children:[a.jsx(rt,{tone:"muted",children:"Primary Docs"}),n.length>0?a.jsx("ul",{className:"mt-3 divide-y divide-outline-variant border border-outline-variant bg-white/30",children:n.map(s=>a.jsx("li",{className:"px-3 py-2 font-mono text-[10px] text-stone-900",children:a.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1.5",children:[a.jsx(Pe,{tool:s.relPath,size:"xs"}),a.jsx("span",{className:"truncate",children:s.relPath})]})},s.relPath))}):a.jsx("div",{className:"mt-3 font-mono text-[10px] text-stone-400",children:"No README, implementation PRD, or progress file indexed."})]})]})}function Iue(){var u;const{sliceId:e}=Cn({from:"/project/slice/$sliceId"}),[t,n]=R.useState("story"),s=j7(e),r=Pj(((u=s.data)==null?void 0:u.qitemIds)??[]),o=R.useMemo(()=>r.itemsById,[r.itemsById]);if(s.isLoading)return a.jsx(_u,{eyebrow:"Slice",title:e,tabs:iS,active:t,onSelect:f=>n(f),children:a.jsx(Xe,{label:"LOADING",description:`Fetching /api/slices/${e}…`,variant:"card",testId:"slice-scope-loading"})});if(s.isError||!s.data)return a.jsx(_u,{eyebrow:"Slice",title:e,tabs:iS,active:t,onSelect:f=>n(f),children:a.jsx(Xe,{label:"SLICE NOT AVAILABLE",description:s.error instanceof Error?s.error.message:`Could not load slice "${e}". The slices indexer may not be configured (rig config get workspace.slices_root).`,variant:"card",testId:"slice-scope-error"})});const c=s.data;return a.jsxs(_u,{eyebrow:"Slice",title:c.displayName||c.name,tabs:iS,active:t,onSelect:f=>n(f),children:[t==="story"?a.jsx(o6,{events:g6(c),phaseDefinitions:c.story.phaseDefinitions,queueItemsById:o}):null,t==="overview"?a.jsx(Mue,{detail:c}):null,t==="progress"?a.jsx(rue,{acceptance:c.acceptance}):null,t==="artifacts"?a.jsx(Tue,{detail:c}):null,t==="tests"?a.jsx(hue,{sliceName:c.name,tests:c.tests,qitemCount:c.qitemIds.length,docsCount:c.docs.tree.length,lastActivityAt:c.lastActivityAt}):null,t==="queue"?a.jsx(Aue,{qitemIds:c.qitemIds,queueItemsById:o,queueItemsFetching:r.isFetching}):null,t==="topology"?a.jsx(c6,{topology:c.topology}):null]})}const Oue={neutral:"border-stone-300 bg-white/65 text-stone-700",info:"border-sky-300 bg-sky-50/70 text-sky-800",success:"border-emerald-300 bg-emerald-50/70 text-emerald-800",warning:"border-amber-300 bg-amber-50/80 text-amber-800",danger:"border-rose-300 bg-rose-50/75 text-rose-800"},Ki=[{label:"Queue created",tone:"info",icon:GO},{label:"Handoff",tone:"neutral",icon:Tp},{label:"Claimed",tone:"warning",icon:Ou},{label:"Completed",tone:"success",icon:Iu},{label:"Human action",tone:"danger",icon:Pr},{label:"Shipped",tone:"success",icon:Ej}],w6=[{label:"idea-ledger",tone:"neutral"},{label:"cycle-4",tone:"info"},{label:"proof",tone:"success"},{label:"urgent",tone:"danger"},{label:"human-review",tone:"warning"}];function Gs({token:e,compact:t=!1}){const n=e.icon;return a.jsxs("span",{className:he("inline-flex items-center gap-1 border font-mono uppercase tracking-[0.10em]",t?"px-1.5 py-0.5 text-[8px]":"px-2 py-1 text-[9px]",Oue[e.tone]),children:[n?a.jsx(n,{className:t?"h-2.5 w-2.5":"h-3 w-3",strokeWidth:1.6}):null,e.label]})}function Va({kind:e,label:t,muted:n}){const s=e==="human"?SH:wF;return a.jsxs("span",{className:he("inline-flex min-w-0 items-center gap-1 border px-1.5 py-0.5 font-mono text-[9px]",n?"border-stone-200 bg-white/45 text-stone-600":"border-stone-300 bg-white/45 text-stone-800"),children:[a.jsx(s,{className:"h-3 w-3 shrink-0",strokeWidth:1.5}),a.jsx("span",{className:"truncate",children:t})]})}function S6({label:e}){return a.jsxs("span",{className:"inline-flex items-center gap-1 border border-stone-200 bg-white/55 px-1.5 py-0.5 font-mono text-[9px] text-stone-600",children:[a.jsx(Cj,{className:"h-3 w-3",strokeWidth:1.5}),e]})}function Lue(){return a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[a.jsx(Va,{kind:"agent",label:"orch.lead@openrig-velocity"}),a.jsx(np,{className:"h-3.5 w-3.5 text-stone-400",strokeWidth:1.4}),a.jsx(Va,{kind:"agent",label:"driver@openrig-velocity"}),a.jsx(np,{className:"h-3.5 w-3.5 text-stone-400",strokeWidth:1.4}),a.jsx(Va,{kind:"human",label:"human@host"})]})}function Pue(){return a.jsx("div",{className:"grid grid-cols-3 gap-2",children:["for-you-human-and-shipped.png","project-overview-missions.png","project-triage-slice.png"].map(e=>a.jsxs("div",{className:"border border-stone-200 bg-stone-100/80",children:[a.jsx("div",{className:"flex aspect-[4/3] items-center justify-center bg-white/65 text-stone-400",children:a.jsx(qF,{className:"h-7 w-7",strokeWidth:1.2})}),a.jsx("div",{className:"truncate border-t border-stone-200 px-1 py-0.5 font-mono text-[8px] text-stone-600",children:e})]},e))})}function aS({label:e,description:t,children:n}){return a.jsx(Es,{as:"section",className:"bg-white/65 backdrop-blur-sm",header:a.jsx("span",{className:"uppercase tracking-[0.16em]",children:e}),children:a.jsxs("div",{className:"space-y-4 p-4",children:[a.jsx("p",{className:"font-mono text-[10px] leading-relaxed text-stone-700",children:t}),n]})})}function D4({dense:e=!1}){return a.jsxs("article",{className:he("border border-outline-variant bg-white/60 backdrop-blur-sm hard-shadow",e?"p-3":"p-4"),children:[a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(Gs,{token:{label:"Action required",tone:"danger",icon:Pr},compact:e}),a.jsx("h3",{className:"font-mono text-sm text-stone-950",children:"Review demo-seed triage proof packet"})]}),a.jsx(S6,{label:"Today 4:18 PM"})]}),a.jsx("p",{className:"mt-3 whitespace-pre-line font-mono text-[11px] leading-relaxed text-stone-700",children:"Review the proof packet screenshots, confirm the shipped slice is ready, then approve or route back with notes."}),a.jsx("div",{className:"mt-3",children:a.jsx(Lue,{})}),a.jsx("div",{className:"mt-3 flex flex-wrap gap-1.5",children:w6.slice(0,4).map(t=>a.jsx(Gs,{token:t,compact:!0},t.label))})]})}function Due(){return a.jsxs("article",{className:"relative border border-outline-variant bg-white/60 p-4 hard-shadow backdrop-blur-sm",children:[a.jsx("div",{className:"absolute left-5 top-12 bottom-5 w-px bg-stone-300"}),a.jsx("div",{className:"relative space-y-5 pl-8",children:[{token:Ki[5],title:"Slice shipped with proof packet",body:"The triage slice closed with screenshots, queue context, and verification notes attached."},{token:Ki[3],title:"Implementation completed",body:"Driver finished the UI pass and handed verification to guard and QA."},{token:Ki[1],title:"Work routed for review",body:"The queue item moved from driver to guard with targeted checks."}].map(e=>{const t=e.token.icon??yl;return a.jsxs("div",{className:"relative",children:[a.jsx("span",{className:"absolute -left-[38px] top-0 flex h-5 w-5 items-center justify-center border border-stone-300 bg-white text-stone-700",children:a.jsx(t,{className:"h-3 w-3",strokeWidth:1.5})}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx(Gs,{token:e.token,compact:!0}),a.jsx(S6,{label:"12 min ago"})]}),a.jsx("h4",{className:"mt-2 font-mono text-[12px] text-stone-950",children:e.title}),a.jsx("p",{className:"mt-1 font-mono text-[10px] leading-relaxed text-stone-700",children:e.body})]},e.title)})})]})}function que(){return a.jsx("div",{className:"divide-y divide-outline-variant border border-outline-variant bg-white/55 backdrop-blur-sm",children:[{token:Ki[4],title:"Approval needed",body:"Review proof screenshots and approve release-readiness.",actor:"human@host"},{token:Ki[2],title:"Claimed by QA",body:"VM verification is in progress with current worktree source.",actor:"velocity-qa"},{token:Ki[1],title:"Route to guard",body:"Run narrow advisory on UI-only diff and source scans.",actor:"redo3-guard-3"}].map(e=>a.jsxs("div",{className:"grid gap-3 p-3 sm:grid-cols-[auto_1fr_auto]",children:[a.jsx(Gs,{token:e.token,compact:!0}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"font-mono text-[12px] text-stone-950",children:e.title}),a.jsx("div",{className:"mt-1 font-mono text-[10px] leading-relaxed text-stone-700",children:e.body})]}),a.jsx(Va,{kind:e.actor.includes("human")?"human":"agent",label:e.actor,muted:!0})]},e.title))})}function $ue(){return a.jsx("div",{className:"paper-grid min-h-full p-8",children:a.jsxs("div",{className:"mx-auto max-w-7xl space-y-8",children:[a.jsxs("header",{className:"border border-outline-variant bg-white/60 p-4 font-mono backdrop-blur-sm hard-shadow",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-[0.18em] text-stone-600",children:"Project graphics package preview"}),a.jsx("h1",{className:"mt-2 text-xl uppercase tracking-[0.14em] text-stone-950",children:"Queue, story, and proof card language"}),a.jsx("p",{className:"mt-2 max-w-3xl text-[11px] leading-relaxed text-stone-700",children:"Hidden preview route for choosing metadata badges, action chips, flow arrows, and proof-card density before applying the system to For You, Story, Queue, and scope rollups."})]}),a.jsxs("section",{className:"grid gap-4 lg:grid-cols-3",children:[a.jsxs(aS,{label:"A / Compact Ledger",description:"Small pills and restrained icons. Best when density matters and queue cards need to scan like a work ledger.",children:[a.jsx(D4,{dense:!0}),a.jsx(que,{})]}),a.jsxs(aS,{label:"B / Narrative Rail",description:"Story-first layout with event icons on a vertical rail. Best for showing how work moved from idea to proof.",children:[a.jsx(Due,{}),a.jsx(Pue,{})]}),a.jsxs(aS,{label:"C / Action Board",description:"Bolder cards with explicit status, actors, and proof thumbnails. Best for For You and approval surfaces.",children:[a.jsx(D4,{}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:Ki.map(e=>a.jsx(Gs,{token:e},e.label))})]})]}),a.jsxs("section",{className:"grid gap-4 lg:grid-cols-[1.2fr_0.8fr]",children:[a.jsx(Es,{as:"section",className:"bg-white/65 backdrop-blur-sm",header:"EVENT BADGE VOCABULARY",children:a.jsx("div",{className:"grid gap-3 p-4 sm:grid-cols-2 lg:grid-cols-3",children:Ki.map(e=>a.jsxs("div",{className:"border border-outline-variant bg-white/55 p-3",children:[a.jsx(Gs,{token:e}),a.jsxs("div",{className:"mt-2 font-mono text-[10px] leading-relaxed text-stone-700",children:[e.label==="Queue created"?"A work item entered the system.":null,e.label==="Handoff"?"Ownership moved from one actor to another.":null,e.label==="Claimed"?"An actor is actively working the item.":null,e.label==="Completed"?"The assigned work item closed.":null,e.label==="Human action"?"A person needs to approve, deny, or route.":null,e.label==="Shipped"?"The slice closed with evidence attached.":null]})]},e.label))})}),a.jsx(Es,{as:"section",className:"bg-white/65 backdrop-blur-sm",header:"SUPPORTING CHIPS",children:a.jsxs("div",{className:"space-y-4 p-4",children:[a.jsxs("div",{children:[a.jsx("div",{className:"mb-2 font-mono text-[9px] uppercase tracking-[0.14em] text-stone-600",children:"Tags"}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:w6.map(e=>a.jsx(Gs,{token:e},e.label))})]}),a.jsxs("div",{children:[a.jsx("div",{className:"mb-2 font-mono text-[9px] uppercase tracking-[0.14em] text-stone-600",children:"Actors"}),a.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[a.jsx(Va,{kind:"human",label:"human@host"}),a.jsx(Va,{kind:"agent",label:"driver@openrig-velocity"}),a.jsx(Va,{kind:"agent",label:"guard@openrig-velocity",muted:!0})]})]}),a.jsxs("div",{children:[a.jsx("div",{className:"mb-2 font-mono text-[9px] uppercase tracking-[0.14em] text-stone-600",children:"Scope"}),a.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[a.jsx(Gs,{token:{label:"Workspace",tone:"neutral",icon:WO}}),a.jsx(Gs,{token:{label:"Mission",tone:"info",icon:UF}}),a.jsx(Gs,{token:{label:"Slice",tone:"success",icon:Ap}})]})]})]})})]})]})})}const Be=gB({component:()=>a.jsx(rF,{client:cF,children:a.jsx(wG,{children:a.jsx(_O,{})})})}),zue=He({getParentRoute:()=>Be,path:"/",component:Toe}),Bue=He({getParentRoute:()=>Be,path:"/topology",component:Yce}),Fue=He({getParentRoute:()=>Be,path:"/topology/rig/$rigId",component:Wce}),Hue=He({getParentRoute:()=>Be,path:"/topology/pod/$rigId/$podName",component:Xce}),Uue=He({getParentRoute:()=>Be,path:"/topology/seat/$rigId/$logicalId",component:Zce}),Vue=He({getParentRoute:()=>Be,path:"/for-you",component:ple}),Gue=He({getParentRoute:()=>Be,path:"/project",component:Rue}),Kue=He({getParentRoute:()=>Be,path:"/project/mission/$missionId",component:Eue}),Yue=He({getParentRoute:()=>Be,path:"/project/slice/$sliceId",component:Iue}),Wue=He({getParentRoute:()=>Be,path:"/specs",component:G$}),Que=He({getParentRoute:()=>Be,path:"/specs/applications",component:G$}),Xue=He({getParentRoute:()=>Be,path:"/specs/skills/$skillToken",component:()=>{const{skillToken:e}=Cn({from:"/specs/skills/$skillToken"});return a.jsx(K$,{skillToken:e})}}),Zue=He({getParentRoute:()=>Be,path:"/specs/skills/$skillToken/file/$fileToken",component:()=>{const{skillToken:e,fileToken:t}=Cn({from:"/specs/skills/$skillToken/file/$fileToken"});return a.jsx(K$,{skillToken:e,fileToken:t})}}),Jue=He({getParentRoute:()=>Be,path:"/specs/$specKind/$specName",component:()=>{const{specName:e}=Cn({from:"/specs/$specKind/$specName"});return a.jsx(to,{to:"/specs/library/$entryId",params:{entryId:e}})}}),ede=He({getParentRoute:()=>Be,path:"/settings",component:Cle}),tde=He({getParentRoute:()=>Be,path:"/search",component:goe}),nde=He({getParentRoute:()=>Be,path:"/lab/project-graphics-preview",component:$ue});function sde(){var s;const{rigId:e}=Cn({from:"/rigs/$rigId"}),{data:t}=Ts(),n=(s=t==null?void 0:t.find(r=>r.id===e))==null?void 0:s.name;return a.jsx("div",{className:"flex flex-col flex-1 h-full",children:a.jsx("div",{className:"flex-1 min-h-[400px] relative",children:a.jsx(KN,{rigId:e,rigName:n??null,showDiscovered:!1})})})}const rde=He({getParentRoute:()=>Be,path:"/rigs/$rigId",component:sde}),ide=He({getParentRoute:()=>Be,path:"/rigs/$rigId/nodes/$logicalId",component:()=>{const{rigId:e,logicalId:t}=Cn({from:"/rigs/$rigId/nodes/$logicalId"});return a.jsx(q$,{rigId:e,logicalId:decodeURIComponent(t)})}}),ade=He({getParentRoute:()=>Be,path:"/import",component:Use}),ode=He({getParentRoute:()=>Be,path:"/packages",component:Qse}),lde=He({getParentRoute:()=>Be,path:"/packages/install",component:nre}),cde=He({getParentRoute:()=>Be,path:"/packages/$packageId",component:Kie}),ude=He({getParentRoute:()=>Be,path:"/bootstrap",component:nae}),dde=He({getParentRoute:()=>Be,path:"/agents/validate",component:sae}),fde=He({getParentRoute:()=>Be,path:"/specs/rig",component:gae}),hde=He({getParentRoute:()=>Be,path:"/specs/agent",component:vae}),pde=He({getParentRoute:()=>Be,path:"/specs/library/$entryId",component:()=>{const{entryId:e}=Cn({from:"/specs/library/$entryId"});return a.jsx(kae,{entryId:e})}}),mde=He({getParentRoute:()=>Be,path:"/discovery",component:()=>a.jsx("div",{className:"flex h-full w-full items-center justify-center p-8",children:a.jsx(Xe,{label:"DISCOVERY",description:"Discovery surface preserved; redesign deferred per code-map.",variant:"card",testId:"discovery-placeholder"})})}),gde=He({getParentRoute:()=>Be,path:"/discovery/inventory",component:coe}),xde=He({getParentRoute:()=>Be,path:"/bundles/inspect",component:wae}),vde=He({getParentRoute:()=>Be,path:"/bundles/install",component:Sae}),yde=He({getParentRoute:()=>Be,path:"/context",component:()=>a.jsx(to,{to:"/topology"})}),bde=He({getParentRoute:()=>Be,path:"/mission-control",component:()=>a.jsx(to,{to:"/for-you"})}),wde=He({getParentRoute:()=>Be,path:"/slices",component:()=>a.jsx(to,{to:"/project"})}),Sde=He({getParentRoute:()=>Be,path:"/slices/$name",component:()=>{const{name:e}=Cn({from:"/slices/$name"});return a.jsx(to,{to:"/project/slice/$sliceId",params:{sliceId:e}})}}),jde=He({getParentRoute:()=>Be,path:"/progress",component:()=>a.jsx(to,{to:"/project"})}),Nde=He({getParentRoute:()=>Be,path:"/steering",component:()=>a.jsx(to,{to:"/project"})}),_de=Be.addChildren([zue,Bue,Fue,Hue,Uue,Vue,Gue,Kue,Yue,Wue,Que,Xue,Zue,Jue,ede,tde,nde,rde,ide,ade,ode,lde,cde,ude,dde,fde,hde,pde,mde,gde,xde,vde,yde,bde,wde,Sde,jde,Nde]),Cde=kB({routeTree:_de});function kde(){return a.jsx(AB,{router:Cde})}const q4=document.getElementById("root");q4&&$z.createRoot(q4).render(a.jsx(R.StrictMode,{children:a.jsx(kde,{})}));