maestro-flow 0.3.15 → 0.3.17

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 (390) hide show
  1. package/.claude/agents/workflow-planner.md +24 -8
  2. package/.claude/commands/maestro-amend.md +300 -0
  3. package/.claude/commands/maestro-analyze.md +1 -49
  4. package/.claude/commands/maestro-execute.md +2 -56
  5. package/.claude/commands/maestro-fork.md +3 -50
  6. package/.claude/commands/maestro-merge.md +2 -26
  7. package/.claude/commands/maestro-milestone-audit.md +1 -5
  8. package/.claude/commands/maestro-milestone-complete.md +1 -7
  9. package/.claude/commands/maestro-plan.md +6 -127
  10. package/.claude/commands/maestro-roadmap.md +3 -101
  11. package/.claude/commands/maestro-spec-generate.md +1 -25
  12. package/.claude/commands/maestro-ui-design.md +14 -73
  13. package/.claude/commands/maestro-verify.md +1 -32
  14. package/.claude/commands/maestro.md +13 -30
  15. package/.claude/commands/manage-harvest.md +7 -44
  16. package/.claude/commands/manage-knowhow-capture.md +193 -0
  17. package/.claude/commands/{manage-memory.md → manage-knowhow.md} +77 -88
  18. package/.claude/commands/manage-learn.md +3 -28
  19. package/.claude/commands/manage-status.md +1 -20
  20. package/.claude/commands/manage-wiki.md +1 -1
  21. package/.claude/commands/quality-business-test.md +1 -1
  22. package/.claude/commands/quality-debug.md +3 -18
  23. package/.claude/commands/quality-integration-test.md +3 -23
  24. package/.claude/commands/quality-retrospective.md +1 -28
  25. package/.claude/commands/quality-review.md +3 -52
  26. package/.claude/commands/quality-test-gen.md +1 -10
  27. package/.claude/commands/quality-test.md +3 -25
  28. package/.claude/commands/spec-add.md +1 -21
  29. package/.claude/commands/spec-load.md +1 -16
  30. package/.claude/commands/wiki-connect.md +2 -112
  31. package/.claude/commands/wiki-digest.md +2 -141
  32. package/.codex/skills/learn-decompose/SKILL.md +2 -8
  33. package/.codex/skills/maestro/SKILL.md +60 -146
  34. package/.codex/skills/maestro-analyze/SKILL.md +52 -150
  35. package/.codex/skills/maestro-brainstorm/SKILL.md +36 -91
  36. package/.codex/skills/maestro-composer/SKILL.md +4 -76
  37. package/.codex/skills/maestro-execute/SKILL.md +46 -177
  38. package/.codex/skills/maestro-init/SKILL.md +7 -51
  39. package/.codex/skills/maestro-link-coordinate/SKILL.md +56 -229
  40. package/.codex/skills/maestro-milestone-audit/SKILL.md +7 -36
  41. package/.codex/skills/maestro-milestone-complete/SKILL.md +11 -93
  42. package/.codex/skills/maestro-overlay/SKILL.md +23 -92
  43. package/.codex/skills/maestro-plan/SKILL.md +70 -166
  44. package/.codex/skills/maestro-player/SKILL.md +24 -149
  45. package/.codex/skills/maestro-quick/SKILL.md +5 -48
  46. package/.codex/skills/maestro-roadmap/SKILL.md +21 -66
  47. package/.codex/skills/maestro-spec-generate/SKILL.md +20 -56
  48. package/.codex/skills/maestro-ui-design/SKILL.md +6 -53
  49. package/.codex/skills/maestro-verify/SKILL.md +39 -136
  50. package/.codex/skills/manage-codebase-rebuild/SKILL.md +25 -75
  51. package/.codex/skills/manage-codebase-refresh/SKILL.md +5 -32
  52. package/.codex/skills/manage-issue/SKILL.md +1 -6
  53. package/.codex/skills/manage-issue-discover/SKILL.md +33 -93
  54. package/.codex/skills/{manage-memory → manage-knowhow}/SKILL.md +95 -95
  55. package/.codex/skills/manage-knowhow-capture/SKILL.md +110 -0
  56. package/.codex/skills/manage-learn/SKILL.md +17 -71
  57. package/.codex/skills/manage-status/SKILL.md +4 -35
  58. package/.codex/skills/manage-wiki/SKILL.md +1 -1
  59. package/.codex/skills/quality-business-test/SKILL.md +2 -14
  60. package/.codex/skills/quality-debug/SKILL.md +41 -133
  61. package/.codex/skills/quality-integration-test/SKILL.md +36 -145
  62. package/.codex/skills/quality-refactor/SKILL.md +6 -59
  63. package/.codex/skills/quality-retrospective/SKILL.md +292 -531
  64. package/.codex/skills/quality-review/SKILL.md +30 -65
  65. package/.codex/skills/quality-sync/SKILL.md +2 -11
  66. package/.codex/skills/quality-test/SKILL.md +4 -45
  67. package/.codex/skills/quality-test-gen/SKILL.md +33 -121
  68. package/.codex/skills/spec-add/SKILL.md +2 -9
  69. package/.codex/skills/spec-load/SKILL.md +4 -14
  70. package/.codex/skills/spec-map/SKILL.md +4 -37
  71. package/.codex/skills/spec-remove/SKILL.md +3 -35
  72. package/.codex/skills/spec-setup/SKILL.md +2 -19
  73. package/.codex/skills/team-coordinate/SKILL.md +20 -132
  74. package/.codex/skills/team-coordinate/roles/coordinator/commands/monitor.md +61 -215
  75. package/.codex/skills/team-executor/SKILL.md +7 -66
  76. package/.codex/skills/team-executor/roles/executor/commands/monitor.md +60 -182
  77. package/.codex/skills/team-executor/specs/session-schema.md +22 -56
  78. package/.codex/skills/team-lifecycle-v4/SKILL.md +22 -143
  79. package/.codex/skills/team-lifecycle-v4/roles/coordinator/commands/monitor.md +31 -223
  80. package/.codex/skills/team-quality-assurance/SKILL.md +14 -88
  81. package/.codex/skills/team-quality-assurance/roles/coordinator/commands/monitor.md +46 -186
  82. package/.codex/skills/team-review/SKILL.md +12 -86
  83. package/.codex/skills/team-review/roles/coordinator/commands/monitor.md +49 -187
  84. package/.codex/skills/team-tech-debt/SKILL.md +11 -50
  85. package/.codex/skills/team-tech-debt/roles/coordinator/commands/monitor.md +50 -239
  86. package/.codex/skills/team-testing/SKILL.md +14 -99
  87. package/.codex/skills/team-testing/roles/coordinator/commands/monitor.md +52 -228
  88. package/.codex/skills/wiki-connect/SKILL.md +2 -5
  89. package/README.md +6 -0
  90. package/README.zh-CN.md +6 -0
  91. package/chains/_intent-map.json +7 -7
  92. package/chains/singles/{memory-capture.json → knowhow-capture.json} +5 -5
  93. package/chains/singles/{memory.json → knowhow.json} +6 -6
  94. package/dashboard/dist/assets/{ArtifactsPage-CUrrDGgN.js → ArtifactsPage-iJZtYsmR.js} +6 -6
  95. package/dashboard/dist/assets/ChatInput-DNnDLdQF.js +6 -0
  96. package/dashboard/dist/assets/ChatPage-BjBibfE4.js +22 -0
  97. package/dashboard/dist/assets/{CollabPage-DIUXeazv.js → CollabPage-8lUMUol_.js} +1 -1
  98. package/dashboard/dist/assets/{ExecutionPanel-VmYeADFj.js → ExecutionPanel-BKV3GZ7Q.js} +1 -1
  99. package/dashboard/dist/assets/{KanbanPage-DLq8v7hg.js → KanbanPage-diY3QmGd.js} +2 -2
  100. package/dashboard/dist/assets/{MarkdownRenderer-D7AehrnR.js → MarkdownRenderer-cYFfe1uX.js} +1 -1
  101. package/dashboard/dist/assets/McpPage-COjuIf7U.js +21 -0
  102. package/dashboard/dist/assets/MeetingRoomPage-wnvT7wlB.js +85 -0
  103. package/dashboard/dist/assets/{OutputPanel-B-Rjwgmv.js → OutputPanel-DDL90Idy.js} +1 -1
  104. package/dashboard/dist/assets/{ProblemsPanel-GEpF-oi4.js → ProblemsPanel-zFN9IIs0.js} +1 -1
  105. package/dashboard/dist/assets/{RequirementBoardPage-xs8uDM7I.js → RequirementBoardPage-DOPJoT0I.js} +2 -2
  106. package/dashboard/dist/assets/{RequirementPage-BKDSFwjA.js → RequirementPage-CEVquRgM.js} +1 -1
  107. package/dashboard/dist/assets/RoomsPage-D5USEWDh.js +1 -0
  108. package/dashboard/dist/assets/{SpecsPage-DLFb9ZH0.js → SpecsPage-BOwBin_o.js} +1 -1
  109. package/dashboard/dist/assets/{SupervisorPage-SOki_kgz.js → SupervisorPage-5iRyMU5T.js} +1 -1
  110. package/dashboard/dist/assets/TeamsPage-DlcEmr_Q.js +1 -0
  111. package/dashboard/dist/assets/{TreeBrowser-B9DHdULE.js → TreeBrowser-Y48Wz-QY.js} +1 -1
  112. package/dashboard/dist/assets/WorkflowPage-CmQaRVgL.js +6 -0
  113. package/dashboard/dist/assets/arrow-left-NCUOENvg.js +6 -0
  114. package/dashboard/dist/assets/{check-DJDk3A2a.js → check-o7nfGNHf.js} +1 -1
  115. package/dashboard/dist/assets/{chevron-right-C7bVDreZ.js → chevron-right-BXySK2fn.js} +1 -1
  116. package/dashboard/dist/assets/{circle-alert-Na1vf6qQ.js → circle-alert-DcSBokh4.js} +1 -1
  117. package/dashboard/dist/assets/{circle-check-CEGgy3NV.js → circle-check-Cd-jce4j.js} +1 -1
  118. package/dashboard/dist/assets/{circle-check-big-3JB8zRYj.js → circle-check-big-BN7Mdp4i.js} +1 -1
  119. package/dashboard/dist/assets/{circle-Qfgy4LB_.js → circle-cooAwnAR.js} +1 -1
  120. package/dashboard/dist/assets/{code-Ble63Idz.js → code-BQa9oL1n.js} +1 -1
  121. package/dashboard/dist/assets/{columns-3-BUcKlxve.js → columns-3-BzgxelGx.js} +1 -1
  122. package/dashboard/dist/assets/{download-CMqkfn8x.js → download-swRJnate.js} +1 -1
  123. package/dashboard/dist/assets/en-C_BD3UCD.js +1 -0
  124. package/dashboard/dist/assets/{folder-B9ewx9LL.js → folder-DbGbLNFN.js} +1 -1
  125. package/dashboard/dist/assets/index-BEUaOz_b.css +1 -0
  126. package/dashboard/dist/assets/{index-JTmGteaT.js → index-DIoMBMbv.js} +1 -1
  127. package/dashboard/dist/assets/index-DLBN_7fb.js +44 -0
  128. package/dashboard/dist/assets/index-uIqUCT8y.js +236 -0
  129. package/dashboard/dist/assets/{list-DI8Wn2aT.js → list-BTRAIvDq.js} +1 -1
  130. package/dashboard/dist/assets/loader-NHtB6Mdn.js +6 -0
  131. package/dashboard/dist/assets/{minus-Lp_BfctG.js → minus-BjMxRTET.js} +1 -1
  132. package/dashboard/dist/assets/{pen-line-Ch7sphzZ.js → pen-line-C4_O16H0.js} +1 -1
  133. package/dashboard/dist/assets/{pencil-_yRMHmGT.js → pencil-DTmKhyDY.js} +1 -1
  134. package/dashboard/dist/assets/{proxy-D72Y8a4Y.js → proxy-Dtx5p6IO.js} +1 -1
  135. package/dashboard/dist/assets/rows-2-GR1dZtRu.js +6 -0
  136. package/dashboard/dist/assets/{search-BS6fI6Bg.js → search-DVtgy2W7.js} +1 -1
  137. package/dashboard/dist/assets/{shallow-BXasQBvr.js → shallow-BOmvDNsv.js} +1 -1
  138. package/dashboard/dist/assets/{table-CeGlFjlP.js → table-DCzuJAFh.js} +1 -1
  139. package/dashboard/dist/assets/team-types-BPeOvVdA.js +6 -0
  140. package/dashboard/dist/assets/{terminal-BJic2yW-.js → terminal-CzogW4cl.js} +1 -1
  141. package/dashboard/dist/assets/{trash-2-Czz4X8Fb.js → trash-2-52LATVfW.js} +1 -1
  142. package/dashboard/dist/assets/users-DLFE2voE.js +6 -0
  143. package/dashboard/dist/assets/{zap-C3H0jVFA.js → zap-DhiYlgyZ.js} +1 -1
  144. package/dashboard/dist/assets/zh-CN-DvQKfow3.js +1 -0
  145. package/dashboard/dist/index.html +2 -2
  146. package/dashboard/dist-server/dashboard/src/server/agents/agent-manager.d.ts +2 -0
  147. package/dashboard/dist-server/dashboard/src/server/agents/agent-manager.js +19 -11
  148. package/dashboard/dist-server/dashboard/src/server/agents/agent-manager.js.map +1 -1
  149. package/dashboard/dist-server/dashboard/src/server/agents/agent-sdk-adapter.js +5 -0
  150. package/dashboard/dist-server/dashboard/src/server/agents/agent-sdk-adapter.js.map +1 -1
  151. package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.d.ts +1 -0
  152. package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.js +21 -4
  153. package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.js.map +1 -1
  154. package/dashboard/dist-server/dashboard/src/server/agents/env-cleanup.js +8 -0
  155. package/dashboard/dist-server/dashboard/src/server/agents/env-cleanup.js.map +1 -1
  156. package/dashboard/dist-server/dashboard/src/server/coordinator/chain-map.js +6 -6
  157. package/dashboard/dist-server/dashboard/src/server/coordinator/chain-map.js.map +1 -1
  158. package/dashboard/dist-server/dashboard/src/server/coordinator/chain-map.test.js +2 -2
  159. package/dashboard/dist-server/dashboard/src/server/coordinator/chain-map.test.js.map +1 -1
  160. package/dashboard/dist-server/dashboard/src/server/index.js +14 -3
  161. package/dashboard/dist-server/dashboard/src/server/index.js.map +1 -1
  162. package/dashboard/dist-server/dashboard/src/server/rooms/mcp-server/mcp-config-builder.d.ts +24 -0
  163. package/dashboard/dist-server/dashboard/src/server/rooms/mcp-server/mcp-config-builder.js +220 -0
  164. package/dashboard/dist-server/dashboard/src/server/rooms/mcp-server/mcp-config-builder.js.map +1 -0
  165. package/dashboard/dist-server/dashboard/src/server/rooms/mcp-server/mcp-config-builder.test.d.ts +1 -0
  166. package/dashboard/dist-server/dashboard/src/server/rooms/mcp-server/mcp-config-builder.test.js +115 -0
  167. package/dashboard/dist-server/dashboard/src/server/rooms/mcp-server/mcp-config-builder.test.js.map +1 -0
  168. package/dashboard/dist-server/dashboard/src/server/rooms/mcp-server/meeting-room-mcp-server.d.ts +44 -0
  169. package/dashboard/dist-server/dashboard/src/server/rooms/mcp-server/meeting-room-mcp-server.js +260 -0
  170. package/dashboard/dist-server/dashboard/src/server/rooms/mcp-server/meeting-room-mcp-server.js.map +1 -0
  171. package/dashboard/dist-server/dashboard/src/server/rooms/mcp-server/meeting-room-mcp-server.test.d.ts +1 -0
  172. package/dashboard/dist-server/dashboard/src/server/rooms/mcp-server/meeting-room-mcp-server.test.js +194 -0
  173. package/dashboard/dist-server/dashboard/src/server/rooms/mcp-server/meeting-room-mcp-server.test.js.map +1 -0
  174. package/dashboard/dist-server/dashboard/src/server/rooms/mcp-server/stdio-bridge.d.ts +2 -0
  175. package/dashboard/dist-server/dashboard/src/server/rooms/mcp-server/stdio-bridge.js +279 -0
  176. package/dashboard/dist-server/dashboard/src/server/rooms/mcp-server/stdio-bridge.js.map +1 -0
  177. package/dashboard/dist-server/dashboard/src/server/rooms/mcp-server/tcp-helpers.d.ts +14 -0
  178. package/dashboard/dist-server/dashboard/src/server/rooms/mcp-server/tcp-helpers.js +131 -0
  179. package/dashboard/dist-server/dashboard/src/server/rooms/mcp-server/tcp-helpers.js.map +1 -0
  180. package/dashboard/dist-server/dashboard/src/server/rooms/mcp-server/tcp-helpers.test.d.ts +1 -0
  181. package/dashboard/dist-server/dashboard/src/server/rooms/mcp-server/tcp-helpers.test.js +134 -0
  182. package/dashboard/dist-server/dashboard/src/server/rooms/mcp-server/tcp-helpers.test.js.map +1 -0
  183. package/dashboard/dist-server/dashboard/src/server/rooms/meeting-room-session.d.ts +51 -0
  184. package/dashboard/dist-server/dashboard/src/server/rooms/meeting-room-session.js +185 -0
  185. package/dashboard/dist-server/dashboard/src/server/rooms/meeting-room-session.js.map +1 -0
  186. package/dashboard/dist-server/dashboard/src/server/rooms/room-agent-registry.d.ts +29 -0
  187. package/dashboard/dist-server/dashboard/src/server/rooms/room-agent-registry.js +125 -0
  188. package/dashboard/dist-server/dashboard/src/server/rooms/room-agent-registry.js.map +1 -0
  189. package/dashboard/dist-server/dashboard/src/server/rooms/room-mailbox.d.ts +18 -0
  190. package/dashboard/dist-server/dashboard/src/server/rooms/room-mailbox.js +63 -0
  191. package/dashboard/dist-server/dashboard/src/server/rooms/room-mailbox.js.map +1 -0
  192. package/dashboard/dist-server/dashboard/src/server/rooms/room-session-manager.d.ts +19 -0
  193. package/dashboard/dist-server/dashboard/src/server/rooms/room-session-manager.js +45 -0
  194. package/dashboard/dist-server/dashboard/src/server/rooms/room-session-manager.js.map +1 -0
  195. package/dashboard/dist-server/dashboard/src/server/rooms/room-task-board.d.ts +25 -0
  196. package/dashboard/dist-server/dashboard/src/server/rooms/room-task-board.js +115 -0
  197. package/dashboard/dist-server/dashboard/src/server/rooms/room-task-board.js.map +1 -0
  198. package/dashboard/dist-server/dashboard/src/server/rooms/room-types.d.ts +53 -0
  199. package/dashboard/dist-server/dashboard/src/server/rooms/room-types.js +5 -0
  200. package/dashboard/dist-server/dashboard/src/server/rooms/room-types.js.map +1 -0
  201. package/dashboard/dist-server/dashboard/src/server/routes/agents.js +6 -0
  202. package/dashboard/dist-server/dashboard/src/server/routes/agents.js.map +1 -1
  203. package/dashboard/dist-server/dashboard/src/server/routes/cli-history.js +20 -1
  204. package/dashboard/dist-server/dashboard/src/server/routes/cli-history.js.map +1 -1
  205. package/dashboard/dist-server/dashboard/src/server/routes/index.d.ts +2 -1
  206. package/dashboard/dist-server/dashboard/src/server/routes/index.js +8 -1
  207. package/dashboard/dist-server/dashboard/src/server/routes/index.js.map +1 -1
  208. package/dashboard/dist-server/dashboard/src/server/routes/install.js +1 -1
  209. package/dashboard/dist-server/dashboard/src/server/routes/install.js.map +1 -1
  210. package/dashboard/dist-server/dashboard/src/server/routes/mcp.js +2 -2
  211. package/dashboard/dist-server/dashboard/src/server/routes/mcp.js.map +1 -1
  212. package/dashboard/dist-server/dashboard/src/server/routes/room-mcp.d.ts +3 -0
  213. package/dashboard/dist-server/dashboard/src/server/routes/room-mcp.js +246 -0
  214. package/dashboard/dist-server/dashboard/src/server/routes/room-mcp.js.map +1 -0
  215. package/dashboard/dist-server/dashboard/src/server/routes/rooms.d.ts +3 -0
  216. package/dashboard/dist-server/dashboard/src/server/routes/rooms.js +38 -0
  217. package/dashboard/dist-server/dashboard/src/server/routes/rooms.js.map +1 -0
  218. package/dashboard/dist-server/dashboard/src/server/routes/wiki.integration.test.js +7 -7
  219. package/dashboard/dist-server/dashboard/src/server/routes/wiki.integration.test.js.map +1 -1
  220. package/dashboard/dist-server/dashboard/src/server/routes/wiki.js +1 -1
  221. package/dashboard/dist-server/dashboard/src/server/routes/wiki.js.map +1 -1
  222. package/dashboard/dist-server/dashboard/src/server/state/event-bus.d.ts +39 -1
  223. package/dashboard/dist-server/dashboard/src/server/state/event-bus.js +12 -0
  224. package/dashboard/dist-server/dashboard/src/server/state/event-bus.js.map +1 -1
  225. package/dashboard/dist-server/dashboard/src/server/wiki/stress.test.js +1 -1
  226. package/dashboard/dist-server/dashboard/src/server/wiki/stress.test.js.map +1 -1
  227. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js +25 -14
  228. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js.map +1 -1
  229. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.test.js +6 -6
  230. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.test.js.map +1 -1
  231. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-types.d.ts +1 -1
  232. package/dashboard/dist-server/dashboard/src/server/wiki/writer-stress.test.js +17 -16
  233. package/dashboard/dist-server/dashboard/src/server/wiki/writer-stress.test.js.map +1 -1
  234. package/dashboard/dist-server/dashboard/src/server/wiki/writer.d.ts +1 -1
  235. package/dashboard/dist-server/dashboard/src/server/wiki/writer.js +18 -7
  236. package/dashboard/dist-server/dashboard/src/server/wiki/writer.js.map +1 -1
  237. package/dashboard/dist-server/dashboard/src/server/ws/handlers/agent-handler.d.ts +3 -1
  238. package/dashboard/dist-server/dashboard/src/server/ws/handlers/agent-handler.js +75 -1
  239. package/dashboard/dist-server/dashboard/src/server/ws/handlers/agent-handler.js.map +1 -1
  240. package/dashboard/dist-server/dashboard/src/server/ws/handlers/room-handler.d.ts +17 -0
  241. package/dashboard/dist-server/dashboard/src/server/ws/handlers/room-handler.js +192 -0
  242. package/dashboard/dist-server/dashboard/src/server/ws/handlers/room-handler.js.map +1 -0
  243. package/dashboard/dist-server/dashboard/src/server/ws/session-scoped-event-filter.d.ts +13 -0
  244. package/dashboard/dist-server/dashboard/src/server/ws/session-scoped-event-filter.js +37 -0
  245. package/dashboard/dist-server/dashboard/src/server/ws/session-scoped-event-filter.js.map +1 -0
  246. package/dashboard/dist-server/dashboard/src/server/ws/ws-manager.d.ts +7 -1
  247. package/dashboard/dist-server/dashboard/src/server/ws/ws-manager.js +39 -2
  248. package/dashboard/dist-server/dashboard/src/server/ws/ws-manager.js.map +1 -1
  249. package/dashboard/dist-server/dashboard/src/shared/constants.js +12 -0
  250. package/dashboard/dist-server/dashboard/src/shared/constants.js.map +1 -1
  251. package/dashboard/dist-server/dashboard/src/shared/room-leader-prompt.d.ts +1 -0
  252. package/dashboard/dist-server/dashboard/src/shared/room-leader-prompt.js +38 -0
  253. package/dashboard/dist-server/dashboard/src/shared/room-leader-prompt.js.map +1 -0
  254. package/dashboard/dist-server/dashboard/src/shared/team-types.d.ts +66 -0
  255. package/dashboard/dist-server/dashboard/src/shared/team-types.js.map +1 -1
  256. package/dashboard/dist-server/dashboard/src/shared/types.d.ts +24 -3
  257. package/dashboard/dist-server/dashboard/src/shared/ws-protocol.d.ts +76 -2
  258. package/dashboard/dist-server/dashboard/src/shared/ws-protocol.js.map +1 -1
  259. package/dashboard/dist-server/shared/agent-types.d.ts +2 -0
  260. package/dashboard/dist-server/src/commands/delegate.js +11 -8
  261. package/dashboard/dist-server/src/commands/delegate.js.map +1 -1
  262. package/dist/shared/agent-types.d.ts +2 -0
  263. package/dist/shared/agent-types.d.ts.map +1 -1
  264. package/dist/src/cli.js +2 -2
  265. package/dist/src/cli.js.map +1 -1
  266. package/dist/src/commands/delegate.d.ts.map +1 -1
  267. package/dist/src/commands/delegate.js +11 -8
  268. package/dist/src/commands/delegate.js.map +1 -1
  269. package/dist/src/commands/install-backend.d.ts +1 -1
  270. package/dist/src/commands/install-backend.d.ts.map +1 -1
  271. package/dist/src/commands/install-backend.js +1 -1
  272. package/dist/src/commands/install-backend.js.map +1 -1
  273. package/dist/src/commands/install-ui/ExecutionView.d.ts.map +1 -1
  274. package/dist/src/commands/install-ui/ExecutionView.js +4 -1
  275. package/dist/src/commands/install-ui/ExecutionView.js.map +1 -1
  276. package/dist/src/commands/install-ui/InstallExecution.d.ts.map +1 -1
  277. package/dist/src/commands/install-ui/InstallExecution.js +4 -1
  278. package/dist/src/commands/install-ui/InstallExecution.js.map +1 -1
  279. package/dist/src/commands/install.js +5 -5
  280. package/dist/src/commands/install.js.map +1 -1
  281. package/dist/src/commands/knowhow.d.ts +10 -0
  282. package/dist/src/commands/knowhow.d.ts.map +1 -0
  283. package/dist/src/commands/knowhow.js +217 -0
  284. package/dist/src/commands/knowhow.js.map +1 -0
  285. package/dist/src/commands/overlay-ui/OverlayList.d.ts +2 -0
  286. package/dist/src/commands/overlay-ui/OverlayList.d.ts.map +1 -1
  287. package/dist/src/commands/overlay-ui/OverlayList.js +6 -3
  288. package/dist/src/commands/overlay-ui/OverlayList.js.map +1 -1
  289. package/dist/src/commands/overlay-ui/index.d.ts.map +1 -1
  290. package/dist/src/commands/overlay-ui/index.js +70 -44
  291. package/dist/src/commands/overlay-ui/index.js.map +1 -1
  292. package/dist/src/commands/overlay.d.ts.map +1 -1
  293. package/dist/src/commands/overlay.js +4 -3
  294. package/dist/src/commands/overlay.js.map +1 -1
  295. package/dist/src/commands/update.d.ts.map +1 -1
  296. package/dist/src/commands/update.js +31 -21
  297. package/dist/src/commands/update.js.map +1 -1
  298. package/dist/src/core/manifest.d.ts +8 -1
  299. package/dist/src/core/manifest.d.ts.map +1 -1
  300. package/dist/src/core/manifest.js +3 -1
  301. package/dist/src/core/manifest.js.map +1 -1
  302. package/dist/src/core/overlay/applier.d.ts +1 -1
  303. package/dist/src/core/overlay/applier.d.ts.map +1 -1
  304. package/dist/src/core/overlay/applier.js +40 -13
  305. package/dist/src/core/overlay/applier.js.map +1 -1
  306. package/dist/src/core/overlay/loader.d.ts.map +1 -1
  307. package/dist/src/core/overlay/loader.js +6 -0
  308. package/dist/src/core/overlay/loader.js.map +1 -1
  309. package/dist/src/core/overlay/types.d.ts +5 -1
  310. package/dist/src/core/overlay/types.d.ts.map +1 -1
  311. package/dist/src/core/overlay/types.js +1 -1
  312. package/dist/src/core/overlay/types.js.map +1 -1
  313. package/dist/src/hooks/context-monitor.js +1 -1
  314. package/dist/src/hooks/context-monitor.js.map +1 -1
  315. package/dist/src/hooks/skill-context.js +1 -1
  316. package/dist/src/hooks/skill-context.js.map +1 -1
  317. package/dist/src/mcp/delegate-channel-relay.d.ts +4 -0
  318. package/dist/src/mcp/delegate-channel-relay.d.ts.map +1 -1
  319. package/dist/src/mcp/delegate-channel-relay.js +73 -4
  320. package/dist/src/mcp/delegate-channel-relay.js.map +1 -1
  321. package/dist/src/tools/index.js +2 -2
  322. package/dist/src/tools/index.js.map +1 -1
  323. package/dist/src/tools/store-knowhow.d.ts +21 -0
  324. package/dist/src/tools/store-knowhow.d.ts.map +1 -0
  325. package/dist/src/tools/store-knowhow.js +295 -0
  326. package/dist/src/tools/store-knowhow.js.map +1 -0
  327. package/package.json +1 -1
  328. package/shared/agent-types.ts +2 -0
  329. package/workflows/analyze.md +61 -185
  330. package/workflows/brainstorm.md +3 -23
  331. package/workflows/codebase-rebuild.md +79 -191
  332. package/workflows/codebase-refresh.md +26 -124
  333. package/workflows/debug.md +21 -141
  334. package/workflows/execute.md +183 -350
  335. package/workflows/fork.md +72 -230
  336. package/workflows/harvest.md +12 -79
  337. package/workflows/init.md +3 -17
  338. package/workflows/integration-test.md +21 -190
  339. package/workflows/issue-analyze.md +35 -153
  340. package/workflows/issue-discover.md +88 -263
  341. package/workflows/issue-execute.md +29 -208
  342. package/workflows/issue-plan.md +33 -154
  343. package/workflows/issue.md +44 -202
  344. package/workflows/knowhow.md +374 -0
  345. package/workflows/learn.md +30 -177
  346. package/workflows/maestro-coordinate.codex.md +77 -362
  347. package/workflows/maestro-link-coordinate.md +12 -61
  348. package/workflows/maestro.codex.md +124 -457
  349. package/workflows/maestro.md +562 -976
  350. package/workflows/map.md +16 -53
  351. package/workflows/merge.md +42 -197
  352. package/workflows/milestone-audit.md +5 -43
  353. package/workflows/milestone-complete.md +11 -60
  354. package/workflows/plan.md +188 -387
  355. package/workflows/quick.md +25 -174
  356. package/workflows/refactor.md +28 -221
  357. package/workflows/retrospective.md +104 -443
  358. package/workflows/review.md +87 -299
  359. package/workflows/roadmap.md +117 -97
  360. package/workflows/spec-generate.md +22 -118
  361. package/workflows/specs-add.md +5 -25
  362. package/workflows/specs-load.md +1 -5
  363. package/workflows/specs-remove.md +0 -11
  364. package/workflows/specs-setup.md +11 -47
  365. package/workflows/status.md +58 -200
  366. package/workflows/sync.md +28 -141
  367. package/workflows/test-gen.md +23 -100
  368. package/workflows/test.md +15 -125
  369. package/workflows/ui-design.md +139 -465
  370. package/workflows/ui-style.md +36 -228
  371. package/workflows/verify.md +52 -273
  372. package/workflows/wiki-connect.md +9 -46
  373. package/workflows/wiki-digest.md +7 -50
  374. package/workflows/wiki-manage.md +11 -108
  375. package/.claude/commands/maestro-coordinate.md +0 -63
  376. package/.claude/commands/manage-memory-capture.md +0 -59
  377. package/.codex/skills/maestro-coordinate/SKILL.md +0 -213
  378. package/.codex/skills/manage-memory-capture/SKILL.md +0 -93
  379. package/dashboard/dist/assets/ChatInput-pUOLJIKE.js +0 -49
  380. package/dashboard/dist/assets/ChatPage-B8Xqkt0v.js +0 -27
  381. package/dashboard/dist/assets/McpPage-BY0SjTgw.js +0 -21
  382. package/dashboard/dist/assets/TeamsPage-BO2kP70F.js +0 -11
  383. package/dashboard/dist/assets/WorkflowPage-C8hWbYim.js +0 -6
  384. package/dashboard/dist/assets/en-ZbRpfzuP.js +0 -1
  385. package/dashboard/dist/assets/index-C2Mcb4TJ.js +0 -231
  386. package/dashboard/dist/assets/index-DyBbPc18.css +0 -1
  387. package/dashboard/dist/assets/loader-B5F6PzFT.js +0 -11
  388. package/dashboard/dist/assets/zh-CN-CoXBFuny.js +0 -1
  389. package/workflows/maestro-coordinate.md +0 -582
  390. package/workflows/memory.md +0 -451
@@ -1,4 +1,4 @@
1
- import{d as W,r as d,A as J,j as e,F as C,o as xe,W as j,p as pe,V as ue,X as fe,n as Z,B as he}from"./index-C2Mcb4TJ.js";import{C as me}from"./code-Ble63Idz.js";import{S as X}from"./search-BS6fI6Bg.js";import{u as Q}from"./shallow-BXasQBvr.js";import{F as M,T as ge}from"./TreeBrowser-B9DHdULE.js";import{M as ve}from"./MarkdownRenderer-D7AehrnR.js";import{C as ee}from"./chevron-right-C7bVDreZ.js";import{D as te}from"./folder-B9ewx9LL.js";import{C as re}from"./circle-Qfgy4LB_.js";import{C as $}from"./circle-check-CEGgy3NV.js";import{A as be}from"./index-JTmGteaT.js";import{m as N}from"./proxy-D72Y8a4Y.js";/**
1
+ import{d as W,r as d,A as J,j as e,F as C,o as xe,W as j,p as pe,V as ue,X as fe,n as Z,B as he}from"./index-uIqUCT8y.js";import{C as me}from"./code-BQa9oL1n.js";import{S as X}from"./search-DVtgy2W7.js";import{u as Q}from"./shallow-BOmvDNsv.js";import{F as M,T as ge}from"./TreeBrowser-Y48Wz-QY.js";import{M as ve}from"./MarkdownRenderer-cYFfe1uX.js";import{C as ee}from"./chevron-right-BXySK2fn.js";import{D as te}from"./folder-DbGbLNFN.js";import{C as re}from"./circle-cooAwnAR.js";import{C as $}from"./circle-check-Cd-jce4j.js";import{A as be}from"./index-DIoMBMbv.js";import{m as N}from"./proxy-Dtx5p6IO.js";/**
2
2
  * @license lucide-react v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -13,9 +13,9 @@ import{d as W,r as d,A as J,j as e,F as C,o as xe,W as j,p as pe,V as ue,X as fe
13
13
  *
14
14
  * This source code is licensed under the ISC license.
15
15
  * See the LICENSE file in the root directory of this source tree.
16
- */const ke=[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]],Ce=W("library",ke);function Se(){const[t,r]=d.useState([]),[a,s]=d.useState(null),[i,l]=d.useState(null),[c,n]=d.useState(!1),[o,x]=d.useState(!0),[p,u]=d.useState(null),f=d.useCallback(async()=>{x(!0);try{const b=await fetch(`${J.ARTIFACTS}/?tree=true`);if(!b.ok){u(`Failed to load tree: ${b.status}`);return}const y=await b.json();r(y),u(null)}catch{u("Failed to connect to server")}finally{x(!1)}},[]);d.useEffect(()=>{f()},[f]);const g=d.useCallback(async b=>{s(b),n(!0),u(null);try{const y=await fetch(`${J.ARTIFACTS}/${b}`);if(!y.ok){u(`Failed to load file: ${y.status}`),l(null);return}const S=await y.text();l(S)}catch{u("Failed to fetch file content"),l(null)}finally{n(!1)}},[]);return{tree:t,selectedPath:a,content:i,loading:c,treeLoading:o,error:p,selectFile:g,refreshTree:f}}function se({data:t}){const[r,a]=d.useState(!1);return e.jsxs("div",{className:"font-mono text-[length:var(--font-size-sm)] leading-[var(--line-height-normal)]",role:"tree","aria-label":"JSON data viewer",children:[e.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)] mb-[var(--spacing-3)] pb-[var(--spacing-2)] border-b border-border bg-bg-secondary px-[var(--spacing-2)] py-[var(--spacing-1-5)] -mx-[var(--spacing-2)] -mt-[var(--spacing-1)]",children:[e.jsx("button",{type:"button",onClick:()=>a(s=>!s),"aria-label":r?"Expand all":"Collapse all",className:["px-[var(--spacing-2)] py-[var(--spacing-1)] text-[length:var(--font-size-xs)] rounded-[var(--radius-default)]","text-text-secondary hover:bg-bg-hover hover:text-text-primary","transition-colors duration-[var(--duration-fast)] ease-[var(--ease-notion)]","focus-visible:outline-none focus-visible:shadow-[var(--shadow-focus-ring)]","active:scale-[0.98] active:duration-[var(--duration-fast)]"].join(" "),children:r?"Expand All":"Collapse All"}),e.jsx("span",{className:"text-[length:var(--font-size-xs)] text-text-tertiary",children:"Click a value to copy"})]}),e.jsx(_,{value:t,path:"$",depth:0,forceCollapse:r})]})}function _({value:t,path:r,depth:a,keyName:s,forceCollapse:i}){const[l,c]=d.useState(a>2),n=i?!0:l,o=d.useCallback(u=>{navigator.clipboard.writeText(u).catch(()=>{})},[]),x=a*16;if(t===null)return e.jsxs("div",{className:"flex items-center gap-[var(--spacing-1)] hover:bg-bg-hover rounded-[var(--radius-default)] transition-colors duration-[var(--duration-fast)]",style:{paddingLeft:x},role:"treeitem",children:[s!==void 0&&e.jsx(w,{name:s}),e.jsx("span",{className:"text-text-tertiary cursor-pointer hover:opacity-70",onClick:()=>o("null"),title:`Copy: null | Path: ${r}`,children:"null"})]});if(typeof t!="object"){const{colorVar:u,display:f}=Ie(t);return e.jsxs("div",{className:"flex items-center gap-[var(--spacing-1)] hover:bg-bg-hover rounded-[var(--radius-default)] transition-colors duration-[var(--duration-fast)]",style:{paddingLeft:x},role:"treeitem",children:[s!==void 0&&e.jsx(w,{name:s}),e.jsx("span",{className:"cursor-pointer hover:opacity-70",style:{color:u},onClick:()=>o(String(t)),title:`Copy value | Path: ${r}`,children:f})]})}if(Array.isArray(t))return t.length===0?e.jsxs("div",{className:"flex items-center gap-[var(--spacing-1)]",style:{paddingLeft:x},role:"treeitem",children:[s!==void 0&&e.jsx(w,{name:s}),e.jsx("span",{className:"text-text-tertiary",children:"[]"})]}):e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-[var(--spacing-1)] cursor-pointer hover:bg-bg-hover rounded-[var(--radius-default)] px-[var(--spacing-1)] transition-colors duration-[var(--duration-fast)]",style:{paddingLeft:x},onClick:()=>c(u=>!u),role:"treeitem","aria-expanded":!n,children:[e.jsx(D,{open:!n}),s!==void 0&&e.jsx(w,{name:s}),e.jsxs("span",{className:"text-text-tertiary",children:["[",n?`${t.length} items`:""]})]}),!n&&e.jsxs(e.Fragment,{children:[t.map((u,f)=>e.jsx(_,{value:u,path:`${r}[${f}]`,depth:a+1,keyName:String(f),forceCollapse:i},f)),e.jsx("div",{style:{paddingLeft:x},children:e.jsx("span",{className:"text-text-tertiary",children:"]"})})]}),n&&e.jsx("span",{className:"text-text-tertiary",style:{paddingLeft:x},children:"]"})]});const p=Object.entries(t);return p.length===0?e.jsxs("div",{className:"flex items-center gap-[var(--spacing-1)]",style:{paddingLeft:x},role:"treeitem",children:[s!==void 0&&e.jsx(w,{name:s}),e.jsx("span",{className:"text-text-tertiary",children:"{}"})]}):e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-[var(--spacing-1)] cursor-pointer hover:bg-bg-hover rounded-[var(--radius-default)] px-[var(--spacing-1)] transition-colors duration-[var(--duration-fast)]",style:{paddingLeft:x},onClick:()=>c(u=>!u),role:"treeitem","aria-expanded":!n,children:[e.jsx(D,{open:!n}),s!==void 0&&e.jsx(w,{name:s}),e.jsxs("span",{className:"text-text-tertiary",children:["{",n?`${p.length} keys`:""]})]}),!n&&e.jsxs(e.Fragment,{children:[p.map(([u,f])=>e.jsx(_,{value:f,path:`${r}.${u}`,depth:a+1,keyName:u,forceCollapse:i},u)),e.jsx("div",{style:{paddingLeft:x},children:e.jsx("span",{className:"text-text-tertiary",children:"}"})})]}),n&&e.jsx("span",{className:"text-text-tertiary",style:{paddingLeft:x},children:"}"})]})}function w({name:t}){return e.jsxs("span",{className:"text-text-primary font-[var(--font-weight-medium)]",children:['"',t,'"',e.jsx("span",{className:"text-text-tertiary",children:": "})]})}function D({open:t}){return e.jsx("span",{className:["text-text-tertiary text-[length:var(--font-size-xs)] w-[var(--size-icon-sm)] inline-flex items-center justify-center select-none","transition-transform duration-[var(--duration-normal)] ease-[var(--ease-notion)]",t?"rotate-90":""].join(" "),children:"▸"})}function Ie(t){return typeof t=="string"?{colorVar:"var(--color-status-completed)",display:`"${t}"`}:typeof t=="number"?{colorVar:"var(--color-accent-blue)",display:String(t)}:typeof t=="boolean"?{colorVar:"var(--color-accent-yellow)",display:String(t)}:{colorVar:"var(--color-text-tertiary)",display:String(t)}}function ae({content:t,path:r,rawOverride:a}){const[s,i]=d.useState(!1),l=Ee(r),c=a!==void 0,n=c?a:s;return c?e.jsx("div",{role:"region","aria-label":"File content",children:n?e.jsx(I,{content:t}):e.jsx(K,{content:t,ext:l})}):e.jsxs("div",{className:"flex flex-col h-full",role:"region","aria-label":"File content",children:[e.jsxs("div",{className:"flex items-center justify-between px-[var(--spacing-3)] py-[var(--spacing-2)] border-b border-border bg-bg-secondary shrink-0 h-9",children:[e.jsx("span",{className:"text-[length:var(--font-size-sm)] text-text-secondary font-mono truncate",children:r}),e.jsx("button",{type:"button",onClick:()=>i(o=>!o),"aria-pressed":n,"aria-label":n?"Show rendered view":"Show raw view",className:["px-[var(--spacing-2)] py-[var(--spacing-1)] text-[length:var(--font-size-xs)] rounded-[var(--radius-default)]","transition-colors duration-[var(--duration-fast)] ease-[var(--ease-notion)]","focus-visible:outline-none focus-visible:shadow-[var(--shadow-focus-ring)]",n?"bg-bg-active text-accent-blue font-[var(--font-weight-medium)]":"text-text-secondary hover:bg-bg-hover hover:text-text-primary"].join(" "),children:n?"Rendered":"Raw"})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-[var(--spacing-4)] bg-bg-primary",children:n?e.jsx(I,{content:t}):e.jsx(K,{content:t,ext:l})})]})}function K({content:t,ext:r}){switch(r){case".md":return e.jsx(ve,{content:t});case".json":return e.jsx(Fe,{content:t});case".ndjson":return e.jsx(Le,{content:t});default:return e.jsx(I,{content:t})}}function Fe({content:t}){try{const r=JSON.parse(t);return e.jsx(se,{data:r})}catch{return e.jsxs("div",{children:[e.jsx("p",{className:"text-status-blocked text-[length:var(--font-size-sm)] mb-[var(--spacing-2)]",children:"Invalid JSON"}),e.jsx(I,{content:t})]})}}function Le({content:t}){const r=t.split(`
16
+ */const ke=[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]],Ce=W("library",ke);function Se(){const[t,r]=d.useState([]),[a,s]=d.useState(null),[i,o]=d.useState(null),[c,n]=d.useState(!1),[l,x]=d.useState(!0),[p,u]=d.useState(null),f=d.useCallback(async()=>{x(!0);try{const b=await fetch(`${J.ARTIFACTS}/?tree=true`);if(!b.ok){u(`Failed to load tree: ${b.status}`);return}const y=await b.json();r(y),u(null)}catch{u("Failed to connect to server")}finally{x(!1)}},[]);d.useEffect(()=>{f()},[f]);const g=d.useCallback(async b=>{s(b),n(!0),u(null);try{const y=await fetch(`${J.ARTIFACTS}/${b}`);if(!y.ok){u(`Failed to load file: ${y.status}`),o(null);return}const S=await y.text();o(S)}catch{u("Failed to fetch file content"),o(null)}finally{n(!1)}},[]);return{tree:t,selectedPath:a,content:i,loading:c,treeLoading:l,error:p,selectFile:g,refreshTree:f}}function se({data:t}){const[r,a]=d.useState(!1);return e.jsxs("div",{className:"font-mono text-[length:var(--font-size-sm)] leading-[var(--line-height-normal)]",role:"tree","aria-label":"JSON data viewer",children:[e.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)] mb-[var(--spacing-3)] pb-[var(--spacing-2)] border-b border-border bg-bg-secondary px-[var(--spacing-2)] py-[var(--spacing-1-5)] -mx-[var(--spacing-2)] -mt-[var(--spacing-1)]",children:[e.jsx("button",{type:"button",onClick:()=>a(s=>!s),"aria-label":r?"Expand all":"Collapse all",className:["px-[var(--spacing-2)] py-[var(--spacing-1)] text-[length:var(--font-size-xs)] rounded-[var(--radius-default)]","text-text-secondary hover:bg-bg-hover hover:text-text-primary","transition-colors duration-[var(--duration-fast)] ease-[var(--ease-notion)]","focus-visible:outline-none focus-visible:shadow-[var(--shadow-focus-ring)]","active:scale-[0.98] active:duration-[var(--duration-fast)]"].join(" "),children:r?"Expand All":"Collapse All"}),e.jsx("span",{className:"text-[length:var(--font-size-xs)] text-text-tertiary",children:"Click a value to copy"})]}),e.jsx(_,{value:t,path:"$",depth:0,forceCollapse:r})]})}function _({value:t,path:r,depth:a,keyName:s,forceCollapse:i}){const[o,c]=d.useState(a>2),n=i?!0:o,l=d.useCallback(u=>{navigator.clipboard.writeText(u).catch(()=>{})},[]),x=a*16;if(t===null)return e.jsxs("div",{className:"flex items-center gap-[var(--spacing-1)] hover:bg-bg-hover rounded-[var(--radius-default)] transition-colors duration-[var(--duration-fast)]",style:{paddingLeft:x},role:"treeitem",children:[s!==void 0&&e.jsx(w,{name:s}),e.jsx("span",{className:"text-text-tertiary cursor-pointer hover:opacity-70",onClick:()=>l("null"),title:`Copy: null | Path: ${r}`,children:"null"})]});if(typeof t!="object"){const{colorVar:u,display:f}=Ie(t);return e.jsxs("div",{className:"flex items-center gap-[var(--spacing-1)] hover:bg-bg-hover rounded-[var(--radius-default)] transition-colors duration-[var(--duration-fast)]",style:{paddingLeft:x},role:"treeitem",children:[s!==void 0&&e.jsx(w,{name:s}),e.jsx("span",{className:"cursor-pointer hover:opacity-70",style:{color:u},onClick:()=>l(String(t)),title:`Copy value | Path: ${r}`,children:f})]})}if(Array.isArray(t))return t.length===0?e.jsxs("div",{className:"flex items-center gap-[var(--spacing-1)]",style:{paddingLeft:x},role:"treeitem",children:[s!==void 0&&e.jsx(w,{name:s}),e.jsx("span",{className:"text-text-tertiary",children:"[]"})]}):e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-[var(--spacing-1)] cursor-pointer hover:bg-bg-hover rounded-[var(--radius-default)] px-[var(--spacing-1)] transition-colors duration-[var(--duration-fast)]",style:{paddingLeft:x},onClick:()=>c(u=>!u),role:"treeitem","aria-expanded":!n,children:[e.jsx(D,{open:!n}),s!==void 0&&e.jsx(w,{name:s}),e.jsxs("span",{className:"text-text-tertiary",children:["[",n?`${t.length} items`:""]})]}),!n&&e.jsxs(e.Fragment,{children:[t.map((u,f)=>e.jsx(_,{value:u,path:`${r}[${f}]`,depth:a+1,keyName:String(f),forceCollapse:i},f)),e.jsx("div",{style:{paddingLeft:x},children:e.jsx("span",{className:"text-text-tertiary",children:"]"})})]}),n&&e.jsx("span",{className:"text-text-tertiary",style:{paddingLeft:x},children:"]"})]});const p=Object.entries(t);return p.length===0?e.jsxs("div",{className:"flex items-center gap-[var(--spacing-1)]",style:{paddingLeft:x},role:"treeitem",children:[s!==void 0&&e.jsx(w,{name:s}),e.jsx("span",{className:"text-text-tertiary",children:"{}"})]}):e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-[var(--spacing-1)] cursor-pointer hover:bg-bg-hover rounded-[var(--radius-default)] px-[var(--spacing-1)] transition-colors duration-[var(--duration-fast)]",style:{paddingLeft:x},onClick:()=>c(u=>!u),role:"treeitem","aria-expanded":!n,children:[e.jsx(D,{open:!n}),s!==void 0&&e.jsx(w,{name:s}),e.jsxs("span",{className:"text-text-tertiary",children:["{",n?`${p.length} keys`:""]})]}),!n&&e.jsxs(e.Fragment,{children:[p.map(([u,f])=>e.jsx(_,{value:f,path:`${r}.${u}`,depth:a+1,keyName:u,forceCollapse:i},u)),e.jsx("div",{style:{paddingLeft:x},children:e.jsx("span",{className:"text-text-tertiary",children:"}"})})]}),n&&e.jsx("span",{className:"text-text-tertiary",style:{paddingLeft:x},children:"}"})]})}function w({name:t}){return e.jsxs("span",{className:"text-text-primary font-[var(--font-weight-medium)]",children:['"',t,'"',e.jsx("span",{className:"text-text-tertiary",children:": "})]})}function D({open:t}){return e.jsx("span",{className:["text-text-tertiary text-[length:var(--font-size-xs)] w-[var(--size-icon-sm)] inline-flex items-center justify-center select-none","transition-transform duration-[var(--duration-normal)] ease-[var(--ease-notion)]",t?"rotate-90":""].join(" "),children:"▸"})}function Ie(t){return typeof t=="string"?{colorVar:"var(--color-status-completed)",display:`"${t}"`}:typeof t=="number"?{colorVar:"var(--color-accent-blue)",display:String(t)}:typeof t=="boolean"?{colorVar:"var(--color-accent-yellow)",display:String(t)}:{colorVar:"var(--color-text-tertiary)",display:String(t)}}function ae({content:t,path:r,rawOverride:a}){const[s,i]=d.useState(!1),o=Ee(r),c=a!==void 0,n=c?a:s;return c?e.jsx("div",{role:"region","aria-label":"File content",children:n?e.jsx(I,{content:t}):e.jsx(K,{content:t,ext:o})}):e.jsxs("div",{className:"flex flex-col h-full",role:"region","aria-label":"File content",children:[e.jsxs("div",{className:"flex items-center justify-between px-[var(--spacing-3)] py-[var(--spacing-2)] border-b border-border bg-bg-secondary shrink-0 h-9",children:[e.jsx("span",{className:"text-[length:var(--font-size-sm)] text-text-secondary font-mono truncate",children:r}),e.jsx("button",{type:"button",onClick:()=>i(l=>!l),"aria-pressed":n,"aria-label":n?"Show rendered view":"Show raw view",className:["px-[var(--spacing-2)] py-[var(--spacing-1)] text-[length:var(--font-size-xs)] rounded-[var(--radius-default)]","transition-colors duration-[var(--duration-fast)] ease-[var(--ease-notion)]","focus-visible:outline-none focus-visible:shadow-[var(--shadow-focus-ring)]",n?"bg-bg-active text-accent-blue font-[var(--font-weight-medium)]":"text-text-secondary hover:bg-bg-hover hover:text-text-primary"].join(" "),children:n?"Rendered":"Raw"})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-[var(--spacing-4)] bg-bg-primary",children:n?e.jsx(I,{content:t}):e.jsx(K,{content:t,ext:o})})]})}function K({content:t,ext:r}){switch(r){case".md":return e.jsx(ve,{content:t});case".json":return e.jsx(Fe,{content:t});case".ndjson":return e.jsx(Le,{content:t});default:return e.jsx(I,{content:t})}}function Fe({content:t}){try{const r=JSON.parse(t);return e.jsx(se,{data:r})}catch{return e.jsxs("div",{children:[e.jsx("p",{className:"text-status-blocked text-[length:var(--font-size-sm)] mb-[var(--spacing-2)]",children:"Invalid JSON"}),e.jsx(I,{content:t})]})}}function Le({content:t}){const r=t.split(`
17
17
  `).filter(a=>a.trim().length>0);return r.length===0?e.jsx("p",{className:"text-text-secondary text-[length:var(--font-size-sm)] italic",children:"Empty NDJSON file"}):e.jsxs("div",{className:"space-y-[var(--spacing-3)]",children:[e.jsxs("p",{className:"text-[length:var(--font-size-xs)] text-text-secondary mb-[var(--spacing-2)]",children:[r.length," record",r.length!==1?"s":""]}),r.map((a,s)=>{try{const i=JSON.parse(a);return e.jsxs("div",{className:"border border-border rounded-[var(--radius-default)] p-[var(--spacing-2)] bg-bg-secondary",children:[e.jsxs("span",{className:"text-[length:var(--font-size-xs)] text-text-secondary mb-[var(--spacing-1)] block",children:["#",s+1]}),e.jsx(se,{data:i})]},s)}catch{return e.jsxs("div",{className:"border border-border rounded-[var(--radius-default)] p-[var(--spacing-2)] bg-bg-secondary",children:[e.jsxs("span",{className:"text-[length:var(--font-size-xs)] text-text-secondary",children:["#",s+1," (invalid)"]}),e.jsx("pre",{className:"text-[length:var(--font-size-sm)] font-mono text-text-primary whitespace-pre-wrap mt-[var(--spacing-1)]",children:a})]},s)}})]})}function I({content:t}){return e.jsx("pre",{className:"font-mono text-[length:var(--font-size-sm)] text-text-primary whitespace-pre-wrap break-words leading-[var(--line-height-relaxed)]",children:t})}function Ee(t){const r=t.lastIndexOf(".");return r===-1?"":t.slice(r).toLowerCase()}function ze(t){const r=t.lastIndexOf(".");return r===-1?"":t.slice(r).toLowerCase()}function Te(t){const r=[],a=t.split(`
18
- `);for(const s of a){const i=s.match(/^(#{1,4})\s+(.+)/);i&&r.push({level:i[1].length,text:i[2].trim()})}return r}function Oe(t){try{const r=JSON.parse(t);return typeof r!="object"||r===null||Array.isArray(r)?[]:Object.entries(r).map(([a,s])=>({key:a,type:Array.isArray(s)?"array":typeof s}))}catch{return[]}}function Ae({path:t,content:r}){if(!t)return e.jsx("div",{className:"w-[240px] bg-bg-primary border-l border-border shrink-0 flex items-center justify-center",children:e.jsx("p",{className:"text-[length:var(--font-size-xs)] text-text-tertiary",children:"No file selected"})});const a=ze(t),s=t.includes("/")?t.slice(t.lastIndexOf("/")+1):t,i=t.includes("/")?t.slice(0,t.lastIndexOf("/")):"/";return e.jsxs("div",{className:"w-[240px] bg-bg-primary border-l border-border shrink-0 flex flex-col overflow-hidden",children:[e.jsx("div",{className:"px-[14px] py-[10px] border-b border-border-divider text-[length:var(--font-size-sm)] font-[var(--font-weight-semibold)] text-text-primary shrink-0",children:"Properties"}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-[14px] py-[var(--spacing-3)]",children:[e.jsxs(F,{title:"File Info",defaultOpen:!0,children:[e.jsx(T,{label:"Name",value:s}),e.jsx(T,{label:"Type",value:a.replace(".","").toUpperCase()||"Unknown"}),e.jsx(T,{label:"Directory",value:i,mono:!0})]}),e.jsx(F,{title:"Tags",children:e.jsxs("div",{className:"flex flex-wrap gap-[var(--spacing-1)]",children:[e.jsx(O,{label:a.replace(".","")||"file",color:"blue"}),t.includes("phase")&&e.jsx(O,{label:"phase",color:"purple"}),t.includes("verification")&&e.jsx(O,{label:"verify",color:"green"})]})}),a===".md"&&r&&e.jsx($e,{content:r}),a===".json"&&r&&e.jsx(_e,{content:r})]})]})}function F({title:t,defaultOpen:r=!0,children:a}){const[s,i]=d.useState(r);return e.jsxs("div",{className:"mb-[var(--spacing-4)]",children:[e.jsxs("button",{type:"button",onClick:()=>i(l=>!l),className:["flex items-center gap-[var(--spacing-1)] w-full text-left mb-[var(--spacing-1-5)]","text-[9px] font-[var(--font-weight-semibold)] uppercase tracking-[0.06em] text-text-placeholder","hover:text-text-secondary transition-colors duration-[var(--duration-fast)]"].join(" "),children:[e.jsx(ee,{size:10,strokeWidth:2.5,className:["transition-transform duration-[var(--duration-fast)]",s?"rotate-90":""].join(" ")}),t]}),s&&a]})}function T({label:t,value:r,mono:a}){return e.jsxs("div",{className:"flex items-center justify-between py-[var(--spacing-1)] text-[length:var(--font-size-sm)]",children:[e.jsx("span",{className:"text-text-tertiary",children:t}),e.jsx("span",{className:`text-text-primary font-[var(--font-weight-medium)] ${a?"font-mono text-[11px]":""} truncate max-w-[140px]`,children:r})]})}function O({label:t,color:r}){const s={blue:{bg:"rgba(91,141,184,0.12)",text:"var(--color-accent-blue)"},purple:{bg:"rgba(145,120,181,0.12)",text:"var(--color-accent-purple, #9178B5)"},green:{bg:"rgba(90,158,120,0.12)",text:"var(--color-status-completed)"}}[r];return e.jsx("span",{className:"text-[10px] font-[var(--font-weight-semibold)] px-[var(--spacing-2)] py-[2px] rounded-full",style:{background:s.bg,color:s.text},children:t})}function $e({content:t}){const r=d.useMemo(()=>Te(t),[t]);return r.length===0?null:e.jsx(F,{title:"Outline",children:e.jsx("div",{className:"flex flex-col gap-[2px]",children:r.map((a,s)=>e.jsxs("button",{type:"button",className:["flex items-center gap-[var(--spacing-1-5)] px-[var(--spacing-2)] py-[3px] rounded-[var(--radius-sm)] text-[11px] w-full text-left","hover:bg-bg-hover hover:text-text-primary transition-colors duration-[var(--duration-fast)] cursor-pointer",s===0?"text-text-primary font-[var(--font-weight-semibold)]":"text-text-tertiary"].join(" "),style:{paddingLeft:(a.level-1)*10+8},children:[e.jsx("span",{className:"w-1 h-1 rounded-full shrink-0",style:{background:s===0?"var(--color-accent-purple)":"var(--color-text-placeholder)"}}),e.jsx("span",{className:"truncate",children:a.text})]},s))})})}function _e({content:t}){const r=d.useMemo(()=>Oe(t),[t]);return r.length===0?null:e.jsx(F,{title:"Structure",children:e.jsx("div",{className:"flex flex-col gap-0",children:r.map(a=>e.jsxs("div",{className:"flex items-center justify-between py-[var(--spacing-1)] text-[length:var(--font-size-sm)]",children:[e.jsx("span",{className:"text-text-primary font-mono text-[11px] truncate max-w-[120px]",children:a.key}),e.jsx("span",{className:"text-text-placeholder text-[10px]",children:a.type})]},a.key))})})}function We(t){switch(t.slice(t.lastIndexOf(".")).toLowerCase()){case".json":return{Icon:M,bg:"rgba(184,149,64,0.10)",color:"var(--color-accent-yellow)"};case".md":return{Icon:C,bg:"rgba(91,141,184,0.10)",color:"var(--color-accent-blue)"};case".ndjson":return{Icon:te,bg:"rgba(200,134,58,0.10)",color:"var(--color-accent-orange, #C8863A)"};default:return{Icon:C,bg:"rgba(160,157,151,0.10)",color:"var(--color-text-tertiary)"}}}function ne({content:t,path:r,onNavigate:a,loading:s,error:i,title:l,subtitle:c}){const[n,o]=d.useState(!1);if(i)return e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsx("div",{role:"alert",className:"px-[var(--spacing-3)] py-[var(--spacing-2)] text-[length:var(--font-size-xs)] rounded-[var(--radius-default)]",style:{backgroundColor:"var(--color-status-bg-blocked)",color:"var(--color-status-blocked)",borderColor:"var(--color-status-blocked)"},children:i})});if(s)return e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsx("p",{className:"text-text-secondary text-[length:var(--font-size-sm)] animate-pulse",children:"Loading..."})});if(!r||t===null)return e.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-text-secondary",children:[e.jsx("p",{className:"text-[length:var(--font-size-lg)] mb-[var(--spacing-2)]",children:"Select a file"}),e.jsx("p",{className:"text-[length:var(--font-size-sm)]",children:"Choose an artifact from the tree to view"})]});const x=r.includes("/")?r.slice(r.lastIndexOf("/")+1):r,{Icon:p,bg:u,color:f}=We(r);return e.jsxs("div",{className:"flex h-full overflow-hidden",children:[e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-[var(--spacing-3)] px-[24px] py-[10px] border-b border-border-divider shrink-0",children:[e.jsx("div",{className:"w-7 h-7 rounded-[var(--radius-default)] flex items-center justify-center shrink-0",style:{background:u,color:f},children:e.jsx(p,{size:14,strokeWidth:1.8})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[c&&e.jsx("div",{className:"text-[10px] uppercase tracking-wider text-text-tertiary font-medium truncate",children:c}),e.jsx("div",{className:"text-[14px] font-[var(--font-weight-bold)] text-text-primary truncate",children:l??x}),e.jsx("div",{className:"text-[10px] font-mono text-text-tertiary truncate",children:r})]}),e.jsxs("div",{className:"flex gap-[var(--spacing-1)]",children:[e.jsx("button",{type:"button",onClick:()=>o(!1),className:["px-[10px] py-[var(--spacing-1)] rounded-[var(--radius-default)] border text-[10px] font-[var(--font-weight-semibold)]","transition-all duration-[var(--duration-fast)] ease-[var(--ease-notion)]","focus-visible:outline-none focus-visible:shadow-[var(--shadow-focus-ring)]",n?"bg-bg-card text-text-secondary border-border hover:border-text-tertiary hover:text-text-primary":"bg-text-primary text-bg-primary border-text-primary"].join(" "),children:"Rendered"}),e.jsx("button",{type:"button",onClick:()=>o(!0),className:["px-[10px] py-[var(--spacing-1)] rounded-[var(--radius-default)] border text-[10px] font-[var(--font-weight-semibold)]","transition-all duration-[var(--duration-fast)] ease-[var(--ease-notion)]","focus-visible:outline-none focus-visible:shadow-[var(--shadow-focus-ring)]",n?"bg-text-primary text-bg-primary border-text-primary":"bg-bg-card text-text-secondary border-border hover:border-text-tertiary hover:text-text-primary"].join(" "),children:"Source"})]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsx("div",{className:"max-w-[720px] mx-auto px-[32px] py-[24px]",children:e.jsx(ae,{content:t,path:r,rawOverride:n})})})]}),e.jsx(Ae,{path:r,content:t})]})}function Me(t){const r=t.slice(t.lastIndexOf(".")).toLowerCase();switch(r){case".json":return"json";case".md":return"md";case".ndjson":return"jsonl";default:return r.replace(".","")||"file"}}function Re(t){switch(t){case"json":return{Icon:M,tintBg:"rgba(184,149,64,0.10)",iconColor:"var(--color-accent-yellow)",badgeBg:"rgba(184,149,64,0.12)",badgeColor:"var(--color-accent-yellow)"};case"md":return{Icon:C,tintBg:"rgba(91,141,184,0.10)",iconColor:"var(--color-accent-blue)",badgeBg:"rgba(91,141,184,0.12)",badgeColor:"var(--color-accent-blue)"};case"jsonl":return{Icon:te,tintBg:"rgba(200,134,58,0.10)",iconColor:"var(--color-accent-orange, #C8863A)",badgeBg:"rgba(200,134,58,0.12)",badgeColor:"var(--color-accent-orange, #C8863A)"};default:return{Icon:C,tintBg:"rgba(160,157,151,0.10)",iconColor:"var(--color-text-tertiary)",badgeBg:"rgba(160,157,151,0.12)",badgeColor:"var(--color-text-tertiary)"}}}function Pe({name:t,path:r,isSelected:a,onClick:s}){const i=Me(t),l=Re(i),{Icon:c}=l,n=r.includes("/")?r.slice(0,r.lastIndexOf("/")):"";return e.jsxs("button",{type:"button",onClick:s,className:["bg-bg-card border rounded-[var(--radius-lg)] p-[14px_16px] cursor-pointer text-left w-full","transition-all duration-[180ms] ease-[var(--ease-spring)]","flex flex-col gap-[var(--spacing-2)]","hover:-translate-y-[2px] hover:shadow-[0_6px_20px_rgba(0,0,0,0.06)]","focus-visible:outline-none focus-visible:shadow-[var(--shadow-focus-ring)]",a?"border-accent-purple shadow-[0_0_0_2px_rgba(145,120,181,0.2)]":"border-border-divider hover:border-border"].join(" "),children:[e.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)]",children:[e.jsx("div",{className:"w-8 h-8 rounded-[var(--radius-md)] flex items-center justify-center shrink-0",style:{background:l.tintBg,color:l.iconColor},children:e.jsx(c,{size:16,strokeWidth:1.8})}),e.jsx("span",{className:"text-[length:var(--font-size-sm)] font-[var(--font-weight-semibold)] text-text-primary flex-1 truncate",children:t}),e.jsx("span",{className:"text-[9px] font-[var(--font-weight-semibold)] px-[5px] py-[1px] rounded-[var(--radius-sm)] uppercase font-mono shrink-0",style:{background:l.badgeBg,color:l.badgeColor},children:i})]}),e.jsx("div",{className:"text-[length:var(--font-size-xs)] text-text-tertiary leading-[1.5] line-clamp-3 min-h-[48px]",children:r}),n&&e.jsx("div",{className:"flex items-center gap-[var(--spacing-1-5)] pt-[var(--spacing-1)] border-t border-border-divider",children:e.jsx("span",{className:"text-[10px] text-text-placeholder font-mono truncate",children:n})})]})}function ie(t,r=""){const a=[];for(const s of t)s.type==="file"?a.push({name:s.name,path:s.path,group:r||"root"}):s.children&&a.push(...ie(s.children,s.name));return a}function Ve(t){const r=new Map;for(const a of t){const s=r.get(a.group)||[];s.push(a),r.set(a.group,s)}return r}const Be=["All","json","md","jsonl"];function Je(t){if(t==="root"||!t.match(/^\d{2}-/))return{dotColor:"var(--color-text-tertiary)"};const r=t.toLowerCase();return r.includes("setup")||r.includes("complete")||r.includes("init")?{dotColor:"var(--color-status-completed)",statusLabel:"Done",statusBg:"var(--color-status-bg-completed)",statusColor:"var(--color-status-completed)"}:{dotColor:"var(--color-accent-yellow)",statusLabel:"Active",statusBg:"var(--color-status-bg-executing)",statusColor:"var(--color-status-executing)"}}function De({tree:t,onSelectFile:r,selectedPath:a}){const[s,i]=d.useState(""),[l,c]=d.useState("All"),n=d.useMemo(()=>ie(t),[t]),o=d.useMemo(()=>{let p=n;if(s.trim()){const u=s.toLowerCase();p=p.filter(f=>f.name.toLowerCase().includes(u)||f.path.toLowerCase().includes(u))}return l!=="All"&&(p=p.filter(u=>{const f=u.name.slice(u.name.lastIndexOf(".")).toLowerCase();return l==="json"?f===".json":l==="md"?f===".md":l==="jsonl"?f===".ndjson"||f===".jsonl":!0})),p},[n,s,l]),x=d.useMemo(()=>Ve(o),[o]);return e.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)] px-[24px] py-[10px] border-b border-border-divider shrink-0",children:[e.jsxs("div",{className:["flex items-center gap-[var(--spacing-1-5)] px-[var(--spacing-3)] py-[5px] rounded-[var(--radius-md)]","bg-bg-card border border-border w-[200px]","focus-within:border-accent-purple transition-colors duration-[var(--duration-fast)]"].join(" "),children:[e.jsx(X,{size:13,strokeWidth:2,className:"text-text-placeholder shrink-0"}),e.jsx("input",{type:"search",value:s,onChange:p=>i(p.target.value),placeholder:"Search artifacts...","aria-label":"Search artifacts",className:"border-none bg-transparent outline-none text-[12px] text-text-primary placeholder:text-text-placeholder w-full font-[inherit]"})]}),e.jsx("div",{className:"flex-1"}),Be.map(p=>e.jsx("button",{type:"button",onClick:()=>c(p),className:["text-[11px] font-[var(--font-weight-medium)] px-[var(--spacing-3)] py-[var(--spacing-1)] rounded-full","border transition-all duration-[var(--duration-fast)] ease-[var(--ease-notion)]","focus-visible:outline-none focus-visible:shadow-[var(--shadow-focus-ring)]",l===p?"bg-text-primary text-bg-primary border-text-primary":"bg-bg-card text-text-secondary border-border hover:border-text-tertiary hover:text-text-primary"].join(" "),children:p==="All"?"All":p.toUpperCase()},p))]}),e.jsx("div",{className:"flex-1 overflow-y-auto px-[24px] py-[var(--spacing-4)]",children:o.length===0?e.jsx("div",{className:"flex items-center justify-center h-full text-text-tertiary text-[length:var(--font-size-sm)]",children:"No artifacts found"}):Array.from(x.entries()).map(([p,u])=>{const f=Je(p);return e.jsxs("div",{className:"mb-[24px]",children:[e.jsxs("div",{className:"flex items-center gap-[10px] mb-[10px] pl-[var(--spacing-1)]",children:[e.jsx("span",{className:"w-[10px] h-[10px] rounded-full shrink-0",style:{background:f.dotColor}}),e.jsx("span",{className:"text-[13px] font-[var(--font-weight-bold)] text-text-primary",children:p==="root"?"Project":p}),f.statusLabel&&e.jsx("span",{className:"text-[10px] font-[var(--font-weight-semibold)] px-[var(--spacing-2)] py-[2px] rounded-full",style:{background:f.statusBg,color:f.statusColor},children:f.statusLabel}),e.jsxs("span",{className:"text-[11px] text-text-tertiary",children:[u.length," file",u.length!==1?"s":""]}),e.jsx("div",{className:"flex-1 h-px bg-border-divider ml-[var(--spacing-2)]"})]}),e.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(240px,1fr))] gap-[10px]",children:u.map(g=>e.jsx(Pe,{name:g.name,path:g.path,type:g.name.slice(g.name.lastIndexOf(".")),isSelected:g.path===a,onClick:()=>r(g.path)},g.path))})]},p)})})]})}function Ke({content:t,path:r}){const[a,s]=d.useState(!1);if(!r||t===null)return e.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-text-secondary",children:[e.jsx("p",{className:"text-[length:var(--font-size-lg)] mb-[var(--spacing-2)]",children:"Select a file"}),e.jsx("p",{className:"text-[length:var(--font-size-sm)]",children:"Choose a JSON artifact to view its structure"})]});const l=r.slice(r.lastIndexOf(".")).toLowerCase()===".json",c=r.includes("/")?r.slice(r.lastIndexOf("/")+1):r;return l?e.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[e.jsx(G,{fileName:c,path:r,isJson:!0,rawMode:a,onToggle:()=>s(n=>!n)}),e.jsx("div",{className:"flex-1 overflow-y-auto px-[24px] py-[20px]",children:e.jsx("div",{className:"max-w-[780px] mx-auto",children:a?e.jsx(oe,{content:t}):e.jsx(Ge,{content:t})})})]}):e.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[e.jsx(G,{fileName:c,path:r,isJson:!1,rawMode:!1,onToggle:()=>{}}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(ae,{content:t,path:r})})]})}function G({fileName:t,path:r,isJson:a,rawMode:s,onToggle:i}){const l=a?M:C,c=a?"rgba(184,149,64,0.10)":"rgba(91,141,184,0.10)",n=a?"var(--color-accent-yellow)":"var(--color-accent-blue)";return e.jsxs("div",{className:"flex items-center gap-[var(--spacing-3)] px-[24px] py-[10px] border-b border-border-divider shrink-0",children:[e.jsx("div",{className:"w-7 h-7 rounded-[var(--radius-default)] flex items-center justify-center shrink-0",style:{background:c,color:n},children:e.jsx(l,{size:14,strokeWidth:1.8})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-[14px] font-[var(--font-weight-bold)] text-text-primary truncate",children:t}),e.jsx("div",{className:"text-[10px] font-mono text-text-tertiary truncate",children:r})]}),a&&e.jsxs("div",{className:"flex gap-[var(--spacing-1)]",children:[e.jsx("button",{type:"button",onClick:i,className:["px-[10px] py-[var(--spacing-1)] rounded-[var(--radius-default)] border text-[10px] font-[var(--font-weight-semibold)]","transition-all duration-[var(--duration-fast)] ease-[var(--ease-notion)]","focus-visible:outline-none focus-visible:shadow-[var(--shadow-focus-ring)]",s?"bg-bg-card text-text-secondary border-border hover:border-text-tertiary hover:text-text-primary":"bg-text-primary text-bg-primary border-text-primary"].join(" "),children:"Structured"}),e.jsx("button",{type:"button",onClick:i,className:["px-[10px] py-[var(--spacing-1)] rounded-[var(--radius-default)] border text-[10px] font-[var(--font-weight-semibold)]","transition-all duration-[var(--duration-fast)] ease-[var(--ease-notion)]","focus-visible:outline-none focus-visible:shadow-[var(--shadow-focus-ring)]",s?"bg-text-primary text-bg-primary border-text-primary":"bg-bg-card text-text-secondary border-border hover:border-text-tertiary hover:text-text-primary"].join(" "),children:"Raw"})]})]})}function Ge({content:t}){const r=d.useMemo(()=>{try{return JSON.parse(t)}catch{return null}},[t]);if(!r||typeof r!="object")return e.jsx(oe,{content:t});if(Array.isArray(r))return e.jsx("div",{className:"flex flex-col gap-[var(--spacing-4)]",children:r.map((s,i)=>e.jsx(A,{title:`Item ${i+1}`,data:s},i))});const a=Object.entries(r);return e.jsxs("div",{className:"flex flex-col gap-[var(--spacing-4)]",children:[a.map(([s,i])=>Array.isArray(i)&&i.length>0&&typeof i[0]=="object"?e.jsxs("div",{children:[e.jsx(L,{title:s,badge:`${i.length}`}),e.jsx("div",{className:"flex flex-col gap-[var(--spacing-1-5)]",children:i.map((l,c)=>qe(l)?e.jsx(Ue,{data:l},c):Ye(l)?e.jsx(Ze,{data:l},c):e.jsx(A,{title:`#${c+1}`,data:l},c))})]},s):typeof i=="object"&&i!==null&&!Array.isArray(i)?e.jsx(A,{title:s,data:i},s):null),e.jsx(He,{data:r})]})}function L({title:t,badge:r}){return e.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)] mb-[var(--spacing-2)] pb-[var(--spacing-1-5)] border-b border-border-divider",children:[e.jsx("span",{className:"text-[11px] font-[var(--font-weight-bold)] uppercase tracking-[0.06em] text-text-tertiary",children:t}),r&&e.jsx("span",{className:"text-[10px] font-[var(--font-weight-semibold)] px-[var(--spacing-1-5)] py-[1px] rounded-full",style:{background:"rgba(91,141,184,0.12)",color:"var(--color-accent-blue)"},children:r})]})}function A({title:t,data:r}){if(typeof r!="object"||r===null)return e.jsxs("div",{children:[e.jsx(L,{title:t}),e.jsx("div",{className:"text-[13px] text-text-primary",children:String(r)})]});const a=Object.entries(r);return e.jsxs("div",{children:[e.jsx(L,{title:t}),e.jsx("div",{className:"flex flex-col",children:a.map(([s,i])=>e.jsxs("div",{className:"grid grid-cols-[140px_1fr] gap-[var(--spacing-3)] py-[var(--spacing-1-5)] border-b border-border-divider last:border-b-0 items-start",children:[e.jsx("span",{className:"text-[11px] font-[var(--font-weight-semibold)] text-text-tertiary font-mono pt-[1px]",children:s}),e.jsx(le,{value:i})]},s))})]})}function le({value:t}){return t==null?e.jsx("span",{className:"text-[13px] text-text-placeholder italic",children:"null"}):typeof t=="boolean"?e.jsxs("span",{className:"text-[10px] font-[var(--font-weight-semibold)] px-[var(--spacing-2)] py-[2px] rounded-full inline-flex items-center gap-[var(--spacing-1)]",style:{background:t?"rgba(90,158,120,0.12)":"rgba(160,157,151,0.12)",color:t?"var(--color-status-completed)":"var(--color-text-tertiary)"},children:[t?e.jsx($,{size:10,strokeWidth:2.5}):e.jsx(re,{size:10,strokeWidth:2.5}),String(t)]}):typeof t=="number"?e.jsx("span",{className:"text-[13px] font-mono text-accent-blue",children:t}):typeof t=="string"?/^(completed|done|passed|active|success)$/i.test(t)?e.jsxs("span",{className:"text-[10px] font-[var(--font-weight-semibold)] px-[var(--spacing-2)] py-[2px] rounded-full inline-flex items-center gap-[var(--spacing-1)]",style:{background:"rgba(90,158,120,0.12)",color:"var(--color-status-completed)"},children:[e.jsx($,{size:10,strokeWidth:2.5}),t]}):/^(blocked|failed|error)$/i.test(t)?e.jsx("span",{className:"text-[10px] font-[var(--font-weight-semibold)] px-[var(--spacing-2)] py-[2px] rounded-full",style:{background:"var(--color-status-bg-blocked)",color:"var(--color-status-blocked)"},children:t}):/^(in.?progress|running|executing)$/i.test(t)?e.jsx("span",{className:"text-[10px] font-[var(--font-weight-semibold)] px-[var(--spacing-2)] py-[2px] rounded-full",style:{background:"rgba(91,141,184,0.12)",color:"var(--color-accent-blue)"},children:t}):e.jsx("span",{className:"text-[13px] text-text-primary",children:t}):Array.isArray(t)?t.length===0?e.jsx("span",{className:"text-[13px] text-text-placeholder italic",children:"[]"}):t.every(r=>typeof r=="string")?e.jsx("div",{className:"flex flex-wrap gap-[var(--spacing-1)]",children:t.map((r,a)=>e.jsx("span",{className:"text-[11px] px-[var(--spacing-2)] py-[2px] rounded-[var(--radius-default)] bg-bg-secondary text-text-secondary",children:String(r)},a))}):e.jsxs("span",{className:"text-[13px] font-mono text-text-secondary",children:["[",t.length," items]"]}):typeof t=="object"?e.jsx("span",{className:"text-[13px] font-mono text-text-secondary",children:JSON.stringify(t)}):e.jsx("span",{className:"text-[13px] text-text-primary",children:String(t)})}function He({data:t}){const r=Object.entries(t).filter(([,a])=>typeof a!="object"||a===null);return r.length===0?null:e.jsxs("div",{children:[e.jsx(L,{title:"Properties"}),e.jsx("div",{className:"flex flex-col",children:r.map(([a,s])=>e.jsxs("div",{className:"grid grid-cols-[140px_1fr] gap-[var(--spacing-3)] py-[var(--spacing-1-5)] border-b border-border-divider last:border-b-0 items-start",children:[e.jsx("span",{className:"text-[11px] font-[var(--font-weight-semibold)] text-text-tertiary font-mono pt-[1px]",children:a}),e.jsx(le,{value:s})]},a))})]})}function qe(t){if(typeof t!="object"||t===null)return!1;const r=t;return"severity"in r||"gap_id"in r||"type"in r}function Ue({data:t}){const r=String(t.gap_id||t.id||""),a=String(t.severity||"medium"),s=String(t.type||""),i=String(t.description||t.claim||""),l=String(t.suggested_fix||t.fix||""),c={critical:{bg:"rgba(196,101,85,0.20)",color:"var(--color-status-blocked)"},high:{bg:"rgba(200,134,58,0.20)",color:"var(--color-accent-orange, #C8863A)"},medium:{bg:"rgba(184,149,64,0.20)",color:"var(--color-accent-yellow)"},low:{bg:"rgba(91,141,184,0.20)",color:"var(--color-accent-blue)"}},n=c[a.toLowerCase()]||c.medium;return e.jsxs("div",{className:"p-[10px_14px] rounded-[10px] border-l-[3px] mb-[var(--spacing-1-5)]",style:{borderLeftColor:"var(--color-status-blocked)",background:"var(--color-status-bg-blocked)"},children:[e.jsxs("div",{className:"flex items-center gap-[var(--spacing-1-5)] mb-[var(--spacing-1)]",children:[r&&e.jsx("span",{className:"text-[10px] font-[var(--font-weight-bold)] font-mono",style:{color:"var(--color-status-blocked)"},children:r}),e.jsx("span",{className:"text-[9px] font-[var(--font-weight-bold)] px-[5px] py-[1px] rounded-[var(--radius-sm)] uppercase",style:{background:n.bg,color:n.color},children:a}),s&&e.jsx("span",{className:"text-[10px] text-text-tertiary ml-auto font-mono",children:s})]}),i&&e.jsx("p",{className:"text-[13px] text-text-primary mb-[var(--spacing-1)]",children:i}),l&&e.jsxs("p",{className:"text-[length:var(--font-size-sm)] text-text-secondary italic",children:[e.jsx("strong",{className:"font-[var(--font-weight-semibold)] not-italic text-text-tertiary text-[10px] uppercase",children:"Fix: "}),l]})]})}function Ye(t){if(typeof t!="object"||t===null)return!1;const r=t;return("claim"in r||"check"in r)&&!("severity"in r)}function Ze({data:t}){const r=String(t.claim||t.check||t.description||""),a=String(t.evidence||t.detail||""),s=t.passed===!0||t.status==="passed"||t.status==="completed";return e.jsxs("div",{className:"flex items-start gap-[var(--spacing-2)] p-[var(--spacing-2)_var(--spacing-3)] rounded-[var(--radius-md)] bg-bg-card border border-border-divider",children:[s?e.jsx($,{size:16,strokeWidth:2,className:"shrink-0 mt-[1px]",style:{color:"var(--color-status-completed)"}}):e.jsx(re,{size:16,strokeWidth:2,className:"shrink-0 mt-[1px] text-text-placeholder"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"text-[13px] text-text-primary font-[var(--font-weight-medium)]",children:r}),a&&e.jsx("p",{className:"text-[11px] text-text-tertiary mt-[2px] italic",children:a})]})]})}function oe({content:t}){const r=d.useMemo(()=>{try{return JSON.stringify(JSON.parse(t),null,2)}catch{return t}},[t]);return e.jsx("pre",{className:["rounded-[10px] p-[16px_20px] font-mono text-[11px] leading-[1.6] overflow-x-auto","bg-[#2C2723] text-[#D9D0C4] border border-[#3D3731]"].join(" "),children:r})}const m=xe((t,r)=>({entries:[],byId:{},loading:!1,error:null,typeFilter:"all",tagFilter:"all",phaseFilter:null,statusFilter:"all",search:"",selectedId:null,backlinksCache:{},health:null,graph:null,setTypeFilter:a=>t({typeFilter:a}),setTagFilter:a=>t({tagFilter:a}),setPhaseFilter:a=>t({phaseFilter:a}),setStatusFilter:a=>t({statusFilter:a}),setSearch:a=>t({search:a}),setSelected:a=>{t({selectedId:a}),a&&!r().backlinksCache[a]&&r().fetchBacklinks(a)},fetchEntries:async()=>{t({loading:!0,error:null});try{const{search:a}=r(),s=a?`${j.WIKI}?q=${encodeURIComponent(a)}`:j.WIKI,i=await fetch(s);if(!i.ok)throw new Error(`Failed: ${i.status}`);const c=(await i.json()).entries??[],n={};for(const o of c)n[o.id]=o;t({entries:c,byId:n,loading:!1})}catch(a){t({loading:!1,error:String(a)})}},fetchBacklinks:async a=>{try{const s=j.WIKI_BACKLINKS.replace(":id",encodeURIComponent(a)),i=await fetch(s);if(!i.ok)return;const l=await i.json();t(c=>({backlinksCache:{...c.backlinksCache,[a]:l.backlinks??[]}}))}catch{}},fetchHealth:async()=>{try{const a=await fetch(j.WIKI_HEALTH);if(!a.ok)return;const s=await a.json();t({health:s})}catch{}},fetchGraph:async()=>{try{const a=await fetch(j.WIKI_GRAPH);if(!a.ok)return;const s=await a.json();t({graph:s})}catch{}},createEntry:async a=>{const s=await fetch(j.WIKI,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(a)});if(!s.ok){const l=await s.json().catch(()=>({}));throw new Error(l.error??`create failed: ${s.status}`)}const i=await s.json();return await r().fetchEntries(),i.entry},updateEntry:async(a,s)=>{const i=j.WIKI_DETAIL.replace(":id",encodeURIComponent(a)),l=await fetch(i,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify(s)});if(!l.ok){const n=await l.json().catch(()=>({}));throw new Error(n.error??`update failed: ${l.status}`)}const c=await l.json();return await r().fetchEntries(),c.entry},removeEntry:async a=>{const s=j.WIKI_DETAIL.replace(":id",encodeURIComponent(a)),i=await fetch(s,{method:"DELETE"});if(!i.ok){const l=await i.json().catch(()=>({}));throw new Error(l.error??`delete failed: ${i.status}`)}await r().fetchEntries()},filteredEntries:()=>{const{entries:a,typeFilter:s,tagFilter:i,phaseFilter:l,statusFilter:c}=r();return a.filter(n=>!(s!=="all"&&n.type!==s||i!=="all"&&!n.tags.includes(i)||l!==null&&n.phaseRef!==l||c!=="all"&&n.status!==c))},entriesByType:()=>{const a=r().filteredEntries(),s={project:[],roadmap:[],spec:[],phase:[],issue:[],lesson:[],memory:[],note:[]};for(const i of a)s[i.type].push(i);return s},allTags:()=>{const a=new Set;for(const s of r().entries)for(const i of s.tags)a.add(i);return Array.from(a).sort()}})),Xe={project:"Project",roadmap:"Roadmap",spec:"Specs",phase:"Phases",issue:"Issues",lesson:"Lessons",memory:"Memory",note:"Notes"},H={project:"var(--color-accent-blue, #3b82f6)",roadmap:"var(--color-accent-purple, #8b5cf6)",spec:"var(--color-accent-green, #16a34a)",phase:"var(--color-accent-orange, #ea580c)",issue:"var(--color-accent-red, #dc2626)",lesson:"var(--color-accent-yellow, #ca8a04)",memory:"var(--color-accent-cyan, #0891b2)",note:"var(--color-text-tertiary, #9ca3af)"},Qe=["project","roadmap","spec","phase","issue","lesson","memory","note"];function et(t){return t.replace(/^#{1,6}\s+/,"").trim()}function tt(){const t=m(o=>o.entries),r=m(o=>o.typeFilter),a=m(o=>o.tagFilter),s=m(o=>o.phaseFilter),i=m(o=>o.statusFilter),l=m(o=>o.selectedId),c=m(o=>o.setSelected),n=d.useMemo(()=>{const o={project:[],roadmap:[],spec:[],phase:[],issue:[],lesson:[],memory:[],note:[]};for(const x of t)r!=="all"&&x.type!==r||a!=="all"&&!x.tags.includes(a)||s!==null&&x.phaseRef!==s||i!=="all"&&x.status!==i||o[x.type].push(x);return o},[t,r,a,s,i]);return e.jsx("div",{className:"flex flex-col gap-1 py-1 overflow-y-auto h-full",children:Qe.map(o=>{const x=n[o];return!x||x.length===0?null:e.jsxs("section",{className:"px-2",children:[e.jsxs("h3",{className:"flex items-center gap-1.5 px-1 py-1.5 text-[10px] text-text-tertiary uppercase tracking-wider font-semibold",children:[e.jsx("span",{className:"inline-block w-[6px] h-[6px] rounded-full shrink-0",style:{backgroundColor:H[o]}}),Xe[o],e.jsx("span",{className:"text-text-quaternary font-normal ml-0.5",children:x.length})]}),e.jsx("ul",{className:"flex flex-col gap-px",children:x.map(p=>e.jsx(rt,{entry:p,typeColor:H[p.type],selected:p.id===l,onSelect:()=>c(p.id)},p.id))})]},o)})})}function rt({entry:t,typeColor:r,selected:a,onSelect:s}){return e.jsx("li",{children:e.jsx("button",{type:"button",onClick:s,className:`w-full text-left rounded-[var(--radius-md,6px)] px-2.5 py-2 transition-all ${a?"bg-bg-secondary shadow-[inset_0_0_0_1px_var(--color-border-strong)]":"hover:bg-bg-secondary"}`,style:a?{borderLeft:`2px solid ${r}`,paddingLeft:"8px"}:void 0,children:e.jsxs("div",{className:"flex items-start gap-1.5",children:[!a&&e.jsx("span",{className:"inline-block w-[5px] h-[5px] rounded-full shrink-0 mt-[5px]",style:{backgroundColor:r,opacity:.6}}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"font-medium text-text-primary text-[length:var(--font-size-sm)] truncate leading-snug",children:t.title}),t.summary&&e.jsx("div",{className:"text-text-tertiary text-[11px] line-clamp-1 mt-0.5 leading-snug",children:et(t.summary)}),t.tags.length>0&&e.jsxs("div",{className:"mt-1 flex flex-wrap gap-1",children:[t.tags.slice(0,3).map(i=>e.jsx("span",{className:"px-1 py-px text-[10px] rounded bg-bg-tertiary text-text-tertiary leading-snug",children:i},i)),t.tags.length>3&&e.jsxs("span",{className:"text-[10px] text-text-quaternary",children:["+",t.tags.length-3]})]})]})]})})})}function st(t){const r=t.split(`
19
- `);let a=!1;const s=[];for(const i of r){if(/^```/.test(i.trim())){a=!a,s.push(i);continue}if(a){s.push(i);continue}s.push(i.replace(/\[\[([^\]]+)\]\]/g,(l,c)=>`[${c}](wiki:${c})`))}return s.join(`
20
- `)}function at(t){return t.replace(/^#{1,6}\s+/,"").trim()}function nt(){const t=m(n=>n.selectedId),r=m(n=>n.byId),a=m(n=>n.backlinksCache);m(n=>n.setSelected);const s=t?r[t]:void 0,i=t?a[t]??[]:[],l=d.useMemo(()=>{if(!s)return null;const n=[];if(s.summary&&(n.push(`> ${at(s.summary)}`),n.push("")),s.tags.length>0&&(n.push(s.tags.map(o=>`\`${o}\``).join(" ")),n.push("")),s.phaseRef!==null&&(n.push(`**Phase:** ${s.phaseRef}`),n.push("")),n.push("---"),n.push(""),s.body&&s.source.kind==="file"&&(n.push(st(s.body)),n.push("")),s.source.kind==="virtual"&&s.raw!==void 0&&(n.push("## Raw"),n.push("```json"),n.push(JSON.stringify(s.raw,null,2)),n.push("```"),n.push("")),Object.keys(s.ext).length>0&&(n.push("## Metadata"),n.push("```json"),n.push(JSON.stringify(s.ext,null,2)),n.push("```"),n.push("")),i.length>0){n.push(`## Backlinks (${i.length})`);for(const o of i)n.push(`- **${o.title}** _${o.type}_`);n.push("")}return n.join(`
21
- `)},[s,i]);if(!t)return e.jsx("div",{className:"flex items-center justify-center h-full text-text-tertiary text-[length:var(--font-size-sm)]",children:"Select an entry"});if(!s)return e.jsx("div",{className:"p-4 text-text-tertiary text-[length:var(--font-size-sm)]",children:"Entry not found."});const c=s.source.path+(s.source.line!==void 0?`:${s.source.line}`:"");return e.jsx(ne,{content:l,path:c,onNavigate:()=>{},loading:!1,error:null,title:s.title,subtitle:`${s.type.toUpperCase()} · ${s.status.toUpperCase()}`})}function it(){const{health:t,fetchHealth:r,setSelected:a,byId:s}=m(Q(n=>({health:n.health,fetchHealth:n.fetchHealth,setSelected:n.setSelected,byId:n.byId}))),[i,l]=d.useState(!1);if(d.useEffect(()=>{r()},[r]),!t)return e.jsx("div",{className:"px-3 py-2 text-[length:var(--font-size-xs)] text-text-tertiary border-b border-border",children:"Loading health…"});const c=t.score>=80?"var(--color-accent-green, #16a34a)":t.score>=50?"var(--color-accent-yellow, #ca8a04)":"var(--color-accent-red, #dc2626)";return e.jsxs("div",{className:"border-b border-border",children:[e.jsxs("button",{type:"button",onClick:()=>l(!i),className:"w-full flex items-center gap-2 px-3 py-2 hover:bg-bg-secondary transition-colors",children:[e.jsx(ee,{size:12,strokeWidth:2,className:"text-text-tertiary transition-transform shrink-0",style:{transform:i?"rotate(90deg)":void 0}}),e.jsx(pe,{size:12,strokeWidth:2,className:"text-text-tertiary shrink-0"}),e.jsx("span",{className:"text-[length:var(--font-size-xs)] text-text-secondary font-medium",children:"Health"}),e.jsx("span",{className:"text-[length:var(--font-size-sm)] font-semibold ml-auto",style:{color:c},children:t.score}),e.jsxs("div",{className:"flex gap-2 text-[length:var(--font-size-xs)] text-text-tertiary",children:[e.jsxs("span",{children:[t.totals.entries," entries"]}),t.totals.orphans>0&&e.jsxs("span",{children:["· ",t.totals.orphans," orphans"]}),t.totals.brokenLinks>0&&e.jsxs("span",{className:"text-accent-red",children:["· ",t.totals.brokenLinks," broken"]})]})]}),i&&e.jsxs("div",{className:"px-3 pb-2 flex flex-col gap-2 text-[length:var(--font-size-xs)]",children:[t.hubs.length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"uppercase tracking-wider text-text-tertiary mb-1 text-[10px]",children:"Top hubs"}),e.jsx("ul",{className:"flex flex-col gap-0.5",children:t.hubs.slice(0,5).map(n=>{var o;return e.jsxs("li",{className:"flex justify-between gap-2",children:[e.jsx("button",{type:"button",onClick:()=>a(n.id),className:"truncate text-accent-blue hover:underline text-left",children:((o=s[n.id])==null?void 0:o.title)??n.id}),e.jsx("span",{className:"text-text-tertiary shrink-0",children:n.inDegree})]},n.id)})})]}),t.orphans.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"uppercase tracking-wider text-text-tertiary mb-1 text-[10px]",children:["Orphans (",t.orphans.length,")"]}),e.jsx("ul",{className:"flex flex-wrap gap-1 max-h-16 overflow-y-auto",children:t.orphans.slice(0,10).map(n=>{var o;return e.jsx("li",{children:e.jsx("button",{type:"button",onClick:()=>a(n),className:"px-1.5 py-0.5 rounded bg-bg-tertiary text-text-secondary hover:text-accent-blue hover:underline transition-colors",children:((o=s[n])==null?void 0:o.title)??n})},n)})})]}),t.brokenLinks.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"uppercase tracking-wider text-text-tertiary mb-1 text-[10px]",children:["Broken (",t.brokenLinks.length,")"]}),e.jsx("ul",{className:"flex flex-col gap-0.5 max-h-16 overflow-y-auto text-text-secondary",children:t.brokenLinks.slice(0,5).map((n,o)=>e.jsxs("li",{className:"truncate",children:[e.jsx("span",{className:"text-text-tertiary",children:n.sourceId})," → ",e.jsx("span",{className:"line-through",children:n.target})]},`${n.sourceId}-${o}`))})]})]})]})}const lt={project:"var(--color-accent-blue, #3b82f6)",roadmap:"var(--color-accent-purple, #8b5cf6)",spec:"var(--color-accent-green, #16a34a)",phase:"var(--color-accent-orange, #ea580c)",issue:"var(--color-accent-red, #dc2626)",lesson:"var(--color-accent-yellow, #ca8a04)",memory:"var(--color-accent-cyan, #0891b2)",note:"var(--color-text-tertiary, #9ca3af)"};function ot(t){return t.replace(/^#{1,6}\s+/,"").trim()}function ct(){const t=m(o=>o.entries),r=m(o=>o.typeFilter),a=m(o=>o.tagFilter),s=m(o=>o.phaseFilter),i=m(o=>o.statusFilter),l=m(o=>o.setSelected),c=m(o=>o.selectedId),n=d.useMemo(()=>t.filter(o=>!(r!=="all"&&o.type!==r||a!=="all"&&!o.tags.includes(a)||s!==null&&o.phaseRef!==s||i!=="all"&&o.status!==i)),[t,r,a,s,i]);return n.length===0?e.jsx("div",{className:"flex items-center justify-center h-full text-text-tertiary text-[length:var(--font-size-sm)]",children:"No entries match the current filters"}):e.jsx("div",{className:"p-4 overflow-y-auto h-full",children:e.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(260px,1fr))] gap-3",children:n.map(o=>e.jsx(dt,{entry:o,selected:o.id===c,onSelect:()=>l(o.id)},o.id))})})}function dt({entry:t,selected:r,onSelect:a}){const s=lt[t.type];return e.jsxs("button",{type:"button",onClick:a,className:`text-left rounded-[var(--radius-md,6px)] border p-3 transition-all flex flex-col gap-1.5 ${r?"border-border-strong bg-bg-secondary shadow-sm":"border-border bg-bg-primary hover:bg-bg-secondary hover:border-border-strong"}`,children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"inline-block w-[6px] h-[6px] rounded-full shrink-0",style:{backgroundColor:s}}),e.jsx("span",{className:"text-[10px] uppercase tracking-wider text-text-tertiary font-medium",children:t.type}),e.jsx("span",{className:"text-[10px] text-text-quaternary ml-auto",children:t.status})]}),e.jsx("div",{className:"font-medium text-text-primary text-[length:var(--font-size-sm)] leading-snug line-clamp-2",children:t.title}),t.summary&&e.jsx("div",{className:"text-text-tertiary text-[11px] line-clamp-2 leading-snug",children:ot(t.summary)}),t.tags.length>0&&e.jsxs("div",{className:"flex flex-wrap gap-1 mt-0.5",children:[t.tags.slice(0,4).map(i=>e.jsx("span",{className:"px-1 py-px text-[10px] rounded bg-bg-tertiary text-text-tertiary",children:i},i)),t.tags.length>4&&e.jsxs("span",{className:"text-[10px] text-text-quaternary",children:["+",t.tags.length-4]})]}),e.jsx("div",{className:"text-[10px] text-text-quaternary font-mono truncate mt-auto pt-1",children:t.source.path})]})}const xt={project:"#3b82f6",roadmap:"#8b5cf6",spec:"#16a34a",phase:"#ea580c",issue:"#dc2626",lesson:"#ca8a04",memory:"#0891b2",note:"#9ca3af"};function pt(){const t=m(l=>l.fetchGraph),r=m(l=>l.graph),a=m(l=>l.byId),s=m(l=>l.setSelected);d.useEffect(()=>{t()},[t]);const i=d.useMemo(()=>{if(!r)return[];const l=new Map;for(const[c,n]of Object.entries(r.forwardLinks)){l.has(c)||l.set(c,{out:0,in:0}),l.get(c).out=n.length;for(const o of n)l.has(o)||l.set(o,{out:0,in:0}),l.get(o).in+=1}return Array.from(l.entries()).map(([c,n])=>{var o,x;return{id:c,title:((o=a[c])==null?void 0:o.title)??c,type:(x=a[c])==null?void 0:x.type,outDegree:n.out,inDegree:n.in,total:n.out+n.in}}).sort((c,n)=>n.total-c.total)},[r,a]);return r?e.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-4 px-4 py-2.5 border-b border-border text-[length:var(--font-size-xs)] text-text-secondary",children:[e.jsxs("span",{children:[i.length," connected nodes"]}),e.jsx("span",{children:"·"}),e.jsxs("span",{children:[Object.values(r.forwardLinks).reduce((l,c)=>l+c.length,0)," links"]}),r.brokenLinks.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsxs("span",{className:"text-accent-red",children:[r.brokenLinks.length," broken"]})]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[e.jsxs("table",{className:"w-full text-[length:var(--font-size-sm)]",children:[e.jsx("thead",{className:"sticky top-0 bg-bg-primary z-10",children:e.jsxs("tr",{className:"border-b border-border text-[10px] uppercase tracking-wider text-text-tertiary",children:[e.jsx("th",{className:"text-left px-4 py-2 font-medium",children:"Entry"}),e.jsx("th",{className:"text-left px-3 py-2 font-medium w-16",children:"Type"}),e.jsx("th",{className:"text-center px-3 py-2 font-medium w-16",children:"Out"}),e.jsx("th",{className:"text-center px-3 py-2 font-medium w-16",children:"In"})]})}),e.jsx("tbody",{children:i.map(l=>e.jsxs("tr",{className:"border-b border-border hover:bg-bg-secondary transition-colors cursor-pointer",onClick:()=>s(l.id),children:[e.jsx("td",{className:"px-4 py-2",children:e.jsxs("div",{className:"flex items-center gap-2",children:[l.type&&e.jsx("span",{className:"inline-block w-[6px] h-[6px] rounded-full shrink-0",style:{backgroundColor:xt[l.type]??"#9ca3af"}}),e.jsx("span",{className:"text-text-primary truncate",children:l.title})]})}),e.jsx("td",{className:"px-3 py-2 text-text-tertiary text-[length:var(--font-size-xs)]",children:l.type??"—"}),e.jsx("td",{className:"px-3 py-2 text-center",children:l.outDegree>0?e.jsx("span",{className:"text-accent-blue font-medium",children:l.outDegree}):e.jsx("span",{className:"text-text-quaternary",children:"0"})}),e.jsx("td",{className:"px-3 py-2 text-center",children:l.inDegree>0?e.jsx("span",{className:"text-accent-green font-medium",children:l.inDegree}):e.jsx("span",{className:"text-text-quaternary",children:"0"})})]},l.id))})]}),r.brokenLinks.length>0&&e.jsxs("div",{className:"p-4 border-t border-border",children:[e.jsxs("h3",{className:"text-[10px] uppercase tracking-wider text-text-tertiary font-medium mb-2",children:["Broken Links (",r.brokenLinks.length,")"]}),e.jsx("ul",{className:"flex flex-col gap-1 text-[length:var(--font-size-xs)]",children:r.brokenLinks.map((l,c)=>{var n;return e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button",onClick:()=>s(l.sourceId),className:"text-accent-blue hover:underline truncate",children:((n=a[l.sourceId])==null?void 0:n.title)??l.sourceId}),e.jsx("span",{className:"text-text-quaternary",children:"→"}),e.jsx("span",{className:"text-text-tertiary line-through",children:l.target})]},`${l.sourceId}-${c}`)})})]})]})]}):e.jsx("div",{className:"flex items-center justify-center h-full text-text-tertiary text-[length:var(--font-size-sm)]",children:"Loading graph data…"})}const ut=[{label:"Reader",icon:e.jsx(C,{size:14,strokeWidth:2}),shortcut:"1"},{label:"Gallery",icon:e.jsx(Z,{size:14,strokeWidth:2}),shortcut:"2"},{label:"Structured",icon:e.jsx(me,{size:14,strokeWidth:2}),shortcut:"3"}],q=["reader","gallery","structured"],ft=[{label:"Reader",icon:e.jsx(he,{size:14,strokeWidth:2}),shortcut:"1"},{label:"Gallery",icon:e.jsx(Z,{size:14,strokeWidth:2}),shortcut:"2"},{label:"Graph",icon:e.jsx(we,{size:14,strokeWidth:2}),shortcut:"3"}],U=["reader","gallery","graph"],ht=[{value:"all",label:"All"},{value:"project",label:"Project"},{value:"roadmap",label:"Roadmap"},{value:"spec",label:"Specs"},{value:"phase",label:"Phases"},{value:"issue",label:"Issues"},{value:"lesson",label:"Lessons"},{value:"memory",label:"Memory"},{value:"note",label:"Notes"}],k={initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8}};function Ft(){const[t,r]=d.useState("files"),[a,s]=d.useState("reader"),[i,l]=d.useState("reader"),{tree:c,selectedPath:n,content:o,loading:x,treeLoading:p,error:u,selectFile:f}=Se(),{fetchEntries:g,loading:b,error:y,entries:S,search:E,setSearch:R,typeFilter:ce,setTypeFilter:de}=m(Q(h=>({fetchEntries:h.fetchEntries,loading:h.loading,error:h.error,entries:h.entries,search:h.search,setSearch:h.setSearch,typeFilter:h.typeFilter,setTypeFilter:h.setTypeFilter})));d.useEffect(()=>{t==="wiki"&&g()},[t,g]),d.useEffect(()=>{if(t!=="wiki")return;const h=setTimeout(()=>void g(),200);return()=>clearTimeout(h)},[E,g,t]);const{register:P,unregister:V}=d.useContext(ue),B=d.useCallback(h=>{t==="files"?s(q[h]):l(U[h])},[t]);return d.useEffect(()=>{const h=t==="files"?ut:ft,v=t==="files"?q.indexOf(a):U.indexOf(i);P({items:h.map(z=>({label:z.label,icon:z.icon,shortcut:z.shortcut})),activeIndex:v,onSwitch:B})},[t,a,i,P,B]),d.useEffect(()=>()=>V(),[V]),d.useEffect(()=>{function h(v){v.target instanceof HTMLInputElement||v.target instanceof HTMLTextAreaElement||(t==="files"?v.key==="1"?s("reader"):v.key==="2"?s("gallery"):v.key==="3"&&s("structured"):v.key==="1"?l("reader"):v.key==="2"?l("gallery"):v.key==="3"&&l("graph"))}return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[t]),e.jsxs("div",{className:"flex h-full overflow-hidden",children:[e.jsxs("div",{className:"w-[272px] shrink-0 border-r border-border overflow-hidden flex flex-col bg-bg-primary",children:[e.jsxs("div",{className:"flex items-center gap-1 px-2 py-2 border-b border-border shrink-0",children:[e.jsx(Y,{mode:"files",active:t==="files",icon:e.jsx(je,{size:13,strokeWidth:2}),label:"Files",onClick:()=>r("files")}),e.jsx(Y,{mode:"wiki",active:t==="wiki",icon:e.jsx(Ce,{size:13,strokeWidth:2}),label:"Wiki",onClick:()=>r("wiki")})]}),t==="files"?e.jsx(ge,{tree:c,selectedPath:n,onSelectFile:f,loading:p}):e.jsxs(e.Fragment,{children:[e.jsx(it,{}),e.jsxs("div",{className:"flex flex-col gap-2 px-3 py-2 border-b border-border",children:[e.jsxs("div",{className:"relative",children:[e.jsx(X,{size:13,strokeWidth:2,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-text-tertiary pointer-events-none"}),e.jsx("input",{type:"text",value:E,placeholder:"Search…",onChange:h=>R(h.target.value),className:"w-full pl-7 pr-7 py-1.5 bg-bg-secondary border border-border rounded-[var(--radius-md,6px)] text-[length:var(--font-size-sm)] text-text-primary placeholder:text-text-quaternary focus:outline-none focus:border-border-strong transition-colors"}),E&&e.jsx("button",{type:"button",onClick:()=>R(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-text-tertiary hover:text-text-secondary transition-colors",children:e.jsx(fe,{size:12,strokeWidth:2})})]}),e.jsx("div",{className:"flex flex-wrap gap-1",children:ht.map(h=>e.jsx("button",{type:"button",onClick:()=>de(h.value),className:`px-2 py-0.5 rounded-[var(--radius-full,999px)] text-[10px] font-medium transition-all ${ce===h.value?"bg-text-primary text-bg-primary":"text-text-tertiary hover:text-text-secondary hover:bg-bg-secondary"}`,children:h.label},h.value))}),e.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-text-quaternary",children:[e.jsxs("span",{children:[S.length," entr",S.length===1?"y":"ies"]}),b&&e.jsx("span",{className:"animate-pulse",children:"· loading…"}),y&&e.jsx("span",{className:"text-accent-red ml-1",children:y})]})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:e.jsx(tt,{})})]})]}),e.jsx("div",{className:"flex-1 overflow-hidden relative min-w-0",children:e.jsx(be,{mode:"wait",children:t==="files"?e.jsxs(e.Fragment,{children:[a==="reader"&&e.jsx(N.div,{className:"absolute inset-0 flex flex-col",variants:k,initial:"initial",animate:"animate",exit:"exit",transition:{duration:.25,ease:[.34,1.56,.64,1]},children:e.jsx(ne,{content:o,path:n,onNavigate:f,loading:x,error:u})},"file-reader"),a==="gallery"&&e.jsx(N.div,{className:"absolute inset-0 flex flex-col",variants:k,initial:"initial",animate:"animate",exit:"exit",transition:{duration:.25,ease:[.34,1.56,.64,1]},children:e.jsx(De,{tree:c,onSelectFile:f,selectedPath:n})},"file-gallery"),a==="structured"&&e.jsx(N.div,{className:"absolute inset-0 flex flex-col",variants:k,initial:"initial",animate:"animate",exit:"exit",transition:{duration:.25,ease:[.34,1.56,.64,1]},children:e.jsx(Ke,{content:o,path:n})},"file-structured")]}):e.jsxs(e.Fragment,{children:[i==="reader"&&e.jsx(N.div,{className:"absolute inset-0",variants:k,initial:"initial",animate:"animate",exit:"exit",transition:{duration:.2},children:e.jsx(nt,{})},"wiki-reader"),i==="gallery"&&e.jsx(N.div,{className:"absolute inset-0",variants:k,initial:"initial",animate:"animate",exit:"exit",transition:{duration:.2},children:e.jsx(ct,{})},"wiki-gallery"),i==="graph"&&e.jsx(N.div,{className:"absolute inset-0",variants:k,initial:"initial",animate:"animate",exit:"exit",transition:{duration:.2},children:e.jsx(pt,{})},"wiki-graph")]})})})]})}function Y({active:t,icon:r,label:a,onClick:s}){return e.jsxs("button",{type:"button",onClick:s,className:["flex-1 flex items-center justify-center gap-1.5 px-2 py-1.5 rounded-[var(--radius-md,6px)]","text-[length:var(--font-size-sm)] font-medium transition-all duration-150",t?"bg-bg-active text-text-primary shadow-sm":"text-text-tertiary hover:text-text-secondary hover:bg-bg-hover"].join(" "),children:[r,e.jsx("span",{children:a})]})}export{Ft as ArtifactsPage};
18
+ `);for(const s of a){const i=s.match(/^(#{1,4})\s+(.+)/);i&&r.push({level:i[1].length,text:i[2].trim()})}return r}function Oe(t){try{const r=JSON.parse(t);return typeof r!="object"||r===null||Array.isArray(r)?[]:Object.entries(r).map(([a,s])=>({key:a,type:Array.isArray(s)?"array":typeof s}))}catch{return[]}}function Ae({path:t,content:r}){if(!t)return e.jsx("div",{className:"w-[240px] bg-bg-primary border-l border-border shrink-0 flex items-center justify-center",children:e.jsx("p",{className:"text-[length:var(--font-size-xs)] text-text-tertiary",children:"No file selected"})});const a=ze(t),s=t.includes("/")?t.slice(t.lastIndexOf("/")+1):t,i=t.includes("/")?t.slice(0,t.lastIndexOf("/")):"/";return e.jsxs("div",{className:"w-[240px] bg-bg-primary border-l border-border shrink-0 flex flex-col overflow-hidden",children:[e.jsx("div",{className:"px-[14px] py-[10px] border-b border-border-divider text-[length:var(--font-size-sm)] font-[var(--font-weight-semibold)] text-text-primary shrink-0",children:"Properties"}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-[14px] py-[var(--spacing-3)]",children:[e.jsxs(F,{title:"File Info",defaultOpen:!0,children:[e.jsx(T,{label:"Name",value:s}),e.jsx(T,{label:"Type",value:a.replace(".","").toUpperCase()||"Unknown"}),e.jsx(T,{label:"Directory",value:i,mono:!0})]}),e.jsx(F,{title:"Tags",children:e.jsxs("div",{className:"flex flex-wrap gap-[var(--spacing-1)]",children:[e.jsx(O,{label:a.replace(".","")||"file",color:"blue"}),t.includes("phase")&&e.jsx(O,{label:"phase",color:"purple"}),t.includes("verification")&&e.jsx(O,{label:"verify",color:"green"})]})}),a===".md"&&r&&e.jsx($e,{content:r}),a===".json"&&r&&e.jsx(_e,{content:r})]})]})}function F({title:t,defaultOpen:r=!0,children:a}){const[s,i]=d.useState(r);return e.jsxs("div",{className:"mb-[var(--spacing-4)]",children:[e.jsxs("button",{type:"button",onClick:()=>i(o=>!o),className:["flex items-center gap-[var(--spacing-1)] w-full text-left mb-[var(--spacing-1-5)]","text-[9px] font-[var(--font-weight-semibold)] uppercase tracking-[0.06em] text-text-placeholder","hover:text-text-secondary transition-colors duration-[var(--duration-fast)]"].join(" "),children:[e.jsx(ee,{size:10,strokeWidth:2.5,className:["transition-transform duration-[var(--duration-fast)]",s?"rotate-90":""].join(" ")}),t]}),s&&a]})}function T({label:t,value:r,mono:a}){return e.jsxs("div",{className:"flex items-center justify-between py-[var(--spacing-1)] text-[length:var(--font-size-sm)]",children:[e.jsx("span",{className:"text-text-tertiary",children:t}),e.jsx("span",{className:`text-text-primary font-[var(--font-weight-medium)] ${a?"font-mono text-[11px]":""} truncate max-w-[140px]`,children:r})]})}function O({label:t,color:r}){const s={blue:{bg:"rgba(91,141,184,0.12)",text:"var(--color-accent-blue)"},purple:{bg:"rgba(145,120,181,0.12)",text:"var(--color-accent-purple, #9178B5)"},green:{bg:"rgba(90,158,120,0.12)",text:"var(--color-status-completed)"}}[r];return e.jsx("span",{className:"text-[10px] font-[var(--font-weight-semibold)] px-[var(--spacing-2)] py-[2px] rounded-full",style:{background:s.bg,color:s.text},children:t})}function $e({content:t}){const r=d.useMemo(()=>Te(t),[t]);return r.length===0?null:e.jsx(F,{title:"Outline",children:e.jsx("div",{className:"flex flex-col gap-[2px]",children:r.map((a,s)=>e.jsxs("button",{type:"button",className:["flex items-center gap-[var(--spacing-1-5)] px-[var(--spacing-2)] py-[3px] rounded-[var(--radius-sm)] text-[11px] w-full text-left","hover:bg-bg-hover hover:text-text-primary transition-colors duration-[var(--duration-fast)] cursor-pointer",s===0?"text-text-primary font-[var(--font-weight-semibold)]":"text-text-tertiary"].join(" "),style:{paddingLeft:(a.level-1)*10+8},children:[e.jsx("span",{className:"w-1 h-1 rounded-full shrink-0",style:{background:s===0?"var(--color-accent-purple)":"var(--color-text-placeholder)"}}),e.jsx("span",{className:"truncate",children:a.text})]},s))})})}function _e({content:t}){const r=d.useMemo(()=>Oe(t),[t]);return r.length===0?null:e.jsx(F,{title:"Structure",children:e.jsx("div",{className:"flex flex-col gap-0",children:r.map(a=>e.jsxs("div",{className:"flex items-center justify-between py-[var(--spacing-1)] text-[length:var(--font-size-sm)]",children:[e.jsx("span",{className:"text-text-primary font-mono text-[11px] truncate max-w-[120px]",children:a.key}),e.jsx("span",{className:"text-text-placeholder text-[10px]",children:a.type})]},a.key))})})}function We(t){switch(t.slice(t.lastIndexOf(".")).toLowerCase()){case".json":return{Icon:M,bg:"rgba(184,149,64,0.10)",color:"var(--color-accent-yellow)"};case".md":return{Icon:C,bg:"rgba(91,141,184,0.10)",color:"var(--color-accent-blue)"};case".ndjson":return{Icon:te,bg:"rgba(200,134,58,0.10)",color:"var(--color-accent-orange, #C8863A)"};default:return{Icon:C,bg:"rgba(160,157,151,0.10)",color:"var(--color-text-tertiary)"}}}function ne({content:t,path:r,onNavigate:a,loading:s,error:i,title:o,subtitle:c}){const[n,l]=d.useState(!1);if(i)return e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsx("div",{role:"alert",className:"px-[var(--spacing-3)] py-[var(--spacing-2)] text-[length:var(--font-size-xs)] rounded-[var(--radius-default)]",style:{backgroundColor:"var(--color-status-bg-blocked)",color:"var(--color-status-blocked)",borderColor:"var(--color-status-blocked)"},children:i})});if(s)return e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsx("p",{className:"text-text-secondary text-[length:var(--font-size-sm)] animate-pulse",children:"Loading..."})});if(!r||t===null)return e.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-text-secondary",children:[e.jsx("p",{className:"text-[length:var(--font-size-lg)] mb-[var(--spacing-2)]",children:"Select a file"}),e.jsx("p",{className:"text-[length:var(--font-size-sm)]",children:"Choose an artifact from the tree to view"})]});const x=r.includes("/")?r.slice(r.lastIndexOf("/")+1):r,{Icon:p,bg:u,color:f}=We(r);return e.jsxs("div",{className:"flex h-full overflow-hidden",children:[e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-[var(--spacing-3)] px-[24px] py-[10px] border-b border-border-divider shrink-0",children:[e.jsx("div",{className:"w-7 h-7 rounded-[var(--radius-default)] flex items-center justify-center shrink-0",style:{background:u,color:f},children:e.jsx(p,{size:14,strokeWidth:1.8})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[c&&e.jsx("div",{className:"text-[10px] uppercase tracking-wider text-text-tertiary font-medium truncate",children:c}),e.jsx("div",{className:"text-[14px] font-[var(--font-weight-bold)] text-text-primary truncate",children:o??x}),e.jsx("div",{className:"text-[10px] font-mono text-text-tertiary truncate",children:r})]}),e.jsxs("div",{className:"flex gap-[var(--spacing-1)]",children:[e.jsx("button",{type:"button",onClick:()=>l(!1),className:["px-[10px] py-[var(--spacing-1)] rounded-[var(--radius-default)] border text-[10px] font-[var(--font-weight-semibold)]","transition-all duration-[var(--duration-fast)] ease-[var(--ease-notion)]","focus-visible:outline-none focus-visible:shadow-[var(--shadow-focus-ring)]",n?"bg-bg-card text-text-secondary border-border hover:border-text-tertiary hover:text-text-primary":"bg-text-primary text-bg-primary border-text-primary"].join(" "),children:"Rendered"}),e.jsx("button",{type:"button",onClick:()=>l(!0),className:["px-[10px] py-[var(--spacing-1)] rounded-[var(--radius-default)] border text-[10px] font-[var(--font-weight-semibold)]","transition-all duration-[var(--duration-fast)] ease-[var(--ease-notion)]","focus-visible:outline-none focus-visible:shadow-[var(--shadow-focus-ring)]",n?"bg-text-primary text-bg-primary border-text-primary":"bg-bg-card text-text-secondary border-border hover:border-text-tertiary hover:text-text-primary"].join(" "),children:"Source"})]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsx("div",{className:"max-w-[720px] mx-auto px-[32px] py-[24px]",children:e.jsx(ae,{content:t,path:r,rawOverride:n})})})]}),e.jsx(Ae,{path:r,content:t})]})}function Me(t){const r=t.slice(t.lastIndexOf(".")).toLowerCase();switch(r){case".json":return"json";case".md":return"md";case".ndjson":return"jsonl";default:return r.replace(".","")||"file"}}function Re(t){switch(t){case"json":return{Icon:M,tintBg:"rgba(184,149,64,0.10)",iconColor:"var(--color-accent-yellow)",badgeBg:"rgba(184,149,64,0.12)",badgeColor:"var(--color-accent-yellow)"};case"md":return{Icon:C,tintBg:"rgba(91,141,184,0.10)",iconColor:"var(--color-accent-blue)",badgeBg:"rgba(91,141,184,0.12)",badgeColor:"var(--color-accent-blue)"};case"jsonl":return{Icon:te,tintBg:"rgba(200,134,58,0.10)",iconColor:"var(--color-accent-orange, #C8863A)",badgeBg:"rgba(200,134,58,0.12)",badgeColor:"var(--color-accent-orange, #C8863A)"};default:return{Icon:C,tintBg:"rgba(160,157,151,0.10)",iconColor:"var(--color-text-tertiary)",badgeBg:"rgba(160,157,151,0.12)",badgeColor:"var(--color-text-tertiary)"}}}function Ve({name:t,path:r,isSelected:a,onClick:s}){const i=Me(t),o=Re(i),{Icon:c}=o,n=r.includes("/")?r.slice(0,r.lastIndexOf("/")):"";return e.jsxs("button",{type:"button",onClick:s,className:["bg-bg-card border rounded-[var(--radius-lg)] p-[14px_16px] cursor-pointer text-left w-full","transition-all duration-[180ms] ease-[var(--ease-spring)]","flex flex-col gap-[var(--spacing-2)]","hover:-translate-y-[2px] hover:shadow-[0_6px_20px_rgba(0,0,0,0.06)]","focus-visible:outline-none focus-visible:shadow-[var(--shadow-focus-ring)]",a?"border-accent-purple shadow-[0_0_0_2px_rgba(145,120,181,0.2)]":"border-border-divider hover:border-border"].join(" "),children:[e.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)]",children:[e.jsx("div",{className:"w-8 h-8 rounded-[var(--radius-md)] flex items-center justify-center shrink-0",style:{background:o.tintBg,color:o.iconColor},children:e.jsx(c,{size:16,strokeWidth:1.8})}),e.jsx("span",{className:"text-[length:var(--font-size-sm)] font-[var(--font-weight-semibold)] text-text-primary flex-1 truncate",children:t}),e.jsx("span",{className:"text-[9px] font-[var(--font-weight-semibold)] px-[5px] py-[1px] rounded-[var(--radius-sm)] uppercase font-mono shrink-0",style:{background:o.badgeBg,color:o.badgeColor},children:i})]}),e.jsx("div",{className:"text-[length:var(--font-size-xs)] text-text-tertiary leading-[1.5] line-clamp-3 min-h-[48px]",children:r}),n&&e.jsx("div",{className:"flex items-center gap-[var(--spacing-1-5)] pt-[var(--spacing-1)] border-t border-border-divider",children:e.jsx("span",{className:"text-[10px] text-text-placeholder font-mono truncate",children:n})})]})}function ie(t,r=""){const a=[];for(const s of t)s.type==="file"?a.push({name:s.name,path:s.path,group:r||"root"}):s.children&&a.push(...ie(s.children,s.name));return a}function Pe(t){const r=new Map;for(const a of t){const s=r.get(a.group)||[];s.push(a),r.set(a.group,s)}return r}const Be=["All","json","md","jsonl"];function Je(t){if(t==="root"||!t.match(/^\d{2}-/))return{dotColor:"var(--color-text-tertiary)"};const r=t.toLowerCase();return r.includes("setup")||r.includes("complete")||r.includes("init")?{dotColor:"var(--color-status-completed)",statusLabel:"Done",statusBg:"var(--color-status-bg-completed)",statusColor:"var(--color-status-completed)"}:{dotColor:"var(--color-accent-yellow)",statusLabel:"Active",statusBg:"var(--color-status-bg-executing)",statusColor:"var(--color-status-executing)"}}function De({tree:t,onSelectFile:r,selectedPath:a}){const[s,i]=d.useState(""),[o,c]=d.useState("All"),n=d.useMemo(()=>ie(t),[t]),l=d.useMemo(()=>{let p=n;if(s.trim()){const u=s.toLowerCase();p=p.filter(f=>f.name.toLowerCase().includes(u)||f.path.toLowerCase().includes(u))}return o!=="All"&&(p=p.filter(u=>{const f=u.name.slice(u.name.lastIndexOf(".")).toLowerCase();return o==="json"?f===".json":o==="md"?f===".md":o==="jsonl"?f===".ndjson"||f===".jsonl":!0})),p},[n,s,o]),x=d.useMemo(()=>Pe(l),[l]);return e.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)] px-[24px] py-[10px] border-b border-border-divider shrink-0",children:[e.jsxs("div",{className:["flex items-center gap-[var(--spacing-1-5)] px-[var(--spacing-3)] py-[5px] rounded-[var(--radius-md)]","bg-bg-card border border-border w-[200px]","focus-within:border-accent-purple transition-colors duration-[var(--duration-fast)]"].join(" "),children:[e.jsx(X,{size:13,strokeWidth:2,className:"text-text-placeholder shrink-0"}),e.jsx("input",{type:"search",value:s,onChange:p=>i(p.target.value),placeholder:"Search artifacts...","aria-label":"Search artifacts",className:"border-none bg-transparent outline-none text-[12px] text-text-primary placeholder:text-text-placeholder w-full font-[inherit]"})]}),e.jsx("div",{className:"flex-1"}),Be.map(p=>e.jsx("button",{type:"button",onClick:()=>c(p),className:["text-[11px] font-[var(--font-weight-medium)] px-[var(--spacing-3)] py-[var(--spacing-1)] rounded-full","border transition-all duration-[var(--duration-fast)] ease-[var(--ease-notion)]","focus-visible:outline-none focus-visible:shadow-[var(--shadow-focus-ring)]",o===p?"bg-text-primary text-bg-primary border-text-primary":"bg-bg-card text-text-secondary border-border hover:border-text-tertiary hover:text-text-primary"].join(" "),children:p==="All"?"All":p.toUpperCase()},p))]}),e.jsx("div",{className:"flex-1 overflow-y-auto px-[24px] py-[var(--spacing-4)]",children:l.length===0?e.jsx("div",{className:"flex items-center justify-center h-full text-text-tertiary text-[length:var(--font-size-sm)]",children:"No artifacts found"}):Array.from(x.entries()).map(([p,u])=>{const f=Je(p);return e.jsxs("div",{className:"mb-[24px]",children:[e.jsxs("div",{className:"flex items-center gap-[10px] mb-[10px] pl-[var(--spacing-1)]",children:[e.jsx("span",{className:"w-[10px] h-[10px] rounded-full shrink-0",style:{background:f.dotColor}}),e.jsx("span",{className:"text-[13px] font-[var(--font-weight-bold)] text-text-primary",children:p==="root"?"Project":p}),f.statusLabel&&e.jsx("span",{className:"text-[10px] font-[var(--font-weight-semibold)] px-[var(--spacing-2)] py-[2px] rounded-full",style:{background:f.statusBg,color:f.statusColor},children:f.statusLabel}),e.jsxs("span",{className:"text-[11px] text-text-tertiary",children:[u.length," file",u.length!==1?"s":""]}),e.jsx("div",{className:"flex-1 h-px bg-border-divider ml-[var(--spacing-2)]"})]}),e.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(240px,1fr))] gap-[10px]",children:u.map(g=>e.jsx(Ve,{name:g.name,path:g.path,type:g.name.slice(g.name.lastIndexOf(".")),isSelected:g.path===a,onClick:()=>r(g.path)},g.path))})]},p)})})]})}function Ke({content:t,path:r}){const[a,s]=d.useState(!1);if(!r||t===null)return e.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-text-secondary",children:[e.jsx("p",{className:"text-[length:var(--font-size-lg)] mb-[var(--spacing-2)]",children:"Select a file"}),e.jsx("p",{className:"text-[length:var(--font-size-sm)]",children:"Choose a JSON artifact to view its structure"})]});const o=r.slice(r.lastIndexOf(".")).toLowerCase()===".json",c=r.includes("/")?r.slice(r.lastIndexOf("/")+1):r;return o?e.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[e.jsx(H,{fileName:c,path:r,isJson:!0,rawMode:a,onToggle:()=>s(n=>!n)}),e.jsx("div",{className:"flex-1 overflow-y-auto px-[24px] py-[20px]",children:e.jsx("div",{className:"max-w-[780px] mx-auto",children:a?e.jsx(le,{content:t}):e.jsx(He,{content:t})})})]}):e.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[e.jsx(H,{fileName:c,path:r,isJson:!1,rawMode:!1,onToggle:()=>{}}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(ae,{content:t,path:r})})]})}function H({fileName:t,path:r,isJson:a,rawMode:s,onToggle:i}){const o=a?M:C,c=a?"rgba(184,149,64,0.10)":"rgba(91,141,184,0.10)",n=a?"var(--color-accent-yellow)":"var(--color-accent-blue)";return e.jsxs("div",{className:"flex items-center gap-[var(--spacing-3)] px-[24px] py-[10px] border-b border-border-divider shrink-0",children:[e.jsx("div",{className:"w-7 h-7 rounded-[var(--radius-default)] flex items-center justify-center shrink-0",style:{background:c,color:n},children:e.jsx(o,{size:14,strokeWidth:1.8})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-[14px] font-[var(--font-weight-bold)] text-text-primary truncate",children:t}),e.jsx("div",{className:"text-[10px] font-mono text-text-tertiary truncate",children:r})]}),a&&e.jsxs("div",{className:"flex gap-[var(--spacing-1)]",children:[e.jsx("button",{type:"button",onClick:i,className:["px-[10px] py-[var(--spacing-1)] rounded-[var(--radius-default)] border text-[10px] font-[var(--font-weight-semibold)]","transition-all duration-[var(--duration-fast)] ease-[var(--ease-notion)]","focus-visible:outline-none focus-visible:shadow-[var(--shadow-focus-ring)]",s?"bg-bg-card text-text-secondary border-border hover:border-text-tertiary hover:text-text-primary":"bg-text-primary text-bg-primary border-text-primary"].join(" "),children:"Structured"}),e.jsx("button",{type:"button",onClick:i,className:["px-[10px] py-[var(--spacing-1)] rounded-[var(--radius-default)] border text-[10px] font-[var(--font-weight-semibold)]","transition-all duration-[var(--duration-fast)] ease-[var(--ease-notion)]","focus-visible:outline-none focus-visible:shadow-[var(--shadow-focus-ring)]",s?"bg-text-primary text-bg-primary border-text-primary":"bg-bg-card text-text-secondary border-border hover:border-text-tertiary hover:text-text-primary"].join(" "),children:"Raw"})]})]})}function He({content:t}){const r=d.useMemo(()=>{try{return JSON.parse(t)}catch{return null}},[t]);if(!r||typeof r!="object")return e.jsx(le,{content:t});if(Array.isArray(r))return e.jsx("div",{className:"flex flex-col gap-[var(--spacing-4)]",children:r.map((s,i)=>e.jsx(A,{title:`Item ${i+1}`,data:s},i))});const a=Object.entries(r);return e.jsxs("div",{className:"flex flex-col gap-[var(--spacing-4)]",children:[a.map(([s,i])=>Array.isArray(i)&&i.length>0&&typeof i[0]=="object"?e.jsxs("div",{children:[e.jsx(L,{title:s,badge:`${i.length}`}),e.jsx("div",{className:"flex flex-col gap-[var(--spacing-1-5)]",children:i.map((o,c)=>qe(o)?e.jsx(Ue,{data:o},c):Ye(o)?e.jsx(Ze,{data:o},c):e.jsx(A,{title:`#${c+1}`,data:o},c))})]},s):typeof i=="object"&&i!==null&&!Array.isArray(i)?e.jsx(A,{title:s,data:i},s):null),e.jsx(Ge,{data:r})]})}function L({title:t,badge:r}){return e.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)] mb-[var(--spacing-2)] pb-[var(--spacing-1-5)] border-b border-border-divider",children:[e.jsx("span",{className:"text-[11px] font-[var(--font-weight-bold)] uppercase tracking-[0.06em] text-text-tertiary",children:t}),r&&e.jsx("span",{className:"text-[10px] font-[var(--font-weight-semibold)] px-[var(--spacing-1-5)] py-[1px] rounded-full",style:{background:"rgba(91,141,184,0.12)",color:"var(--color-accent-blue)"},children:r})]})}function A({title:t,data:r}){if(typeof r!="object"||r===null)return e.jsxs("div",{children:[e.jsx(L,{title:t}),e.jsx("div",{className:"text-[13px] text-text-primary",children:String(r)})]});const a=Object.entries(r);return e.jsxs("div",{children:[e.jsx(L,{title:t}),e.jsx("div",{className:"flex flex-col",children:a.map(([s,i])=>e.jsxs("div",{className:"grid grid-cols-[140px_1fr] gap-[var(--spacing-3)] py-[var(--spacing-1-5)] border-b border-border-divider last:border-b-0 items-start",children:[e.jsx("span",{className:"text-[11px] font-[var(--font-weight-semibold)] text-text-tertiary font-mono pt-[1px]",children:s}),e.jsx(oe,{value:i})]},s))})]})}function oe({value:t}){return t==null?e.jsx("span",{className:"text-[13px] text-text-placeholder italic",children:"null"}):typeof t=="boolean"?e.jsxs("span",{className:"text-[10px] font-[var(--font-weight-semibold)] px-[var(--spacing-2)] py-[2px] rounded-full inline-flex items-center gap-[var(--spacing-1)]",style:{background:t?"rgba(90,158,120,0.12)":"rgba(160,157,151,0.12)",color:t?"var(--color-status-completed)":"var(--color-text-tertiary)"},children:[t?e.jsx($,{size:10,strokeWidth:2.5}):e.jsx(re,{size:10,strokeWidth:2.5}),String(t)]}):typeof t=="number"?e.jsx("span",{className:"text-[13px] font-mono text-accent-blue",children:t}):typeof t=="string"?/^(completed|done|passed|active|success)$/i.test(t)?e.jsxs("span",{className:"text-[10px] font-[var(--font-weight-semibold)] px-[var(--spacing-2)] py-[2px] rounded-full inline-flex items-center gap-[var(--spacing-1)]",style:{background:"rgba(90,158,120,0.12)",color:"var(--color-status-completed)"},children:[e.jsx($,{size:10,strokeWidth:2.5}),t]}):/^(blocked|failed|error)$/i.test(t)?e.jsx("span",{className:"text-[10px] font-[var(--font-weight-semibold)] px-[var(--spacing-2)] py-[2px] rounded-full",style:{background:"var(--color-status-bg-blocked)",color:"var(--color-status-blocked)"},children:t}):/^(in.?progress|running|executing)$/i.test(t)?e.jsx("span",{className:"text-[10px] font-[var(--font-weight-semibold)] px-[var(--spacing-2)] py-[2px] rounded-full",style:{background:"rgba(91,141,184,0.12)",color:"var(--color-accent-blue)"},children:t}):e.jsx("span",{className:"text-[13px] text-text-primary",children:t}):Array.isArray(t)?t.length===0?e.jsx("span",{className:"text-[13px] text-text-placeholder italic",children:"[]"}):t.every(r=>typeof r=="string")?e.jsx("div",{className:"flex flex-wrap gap-[var(--spacing-1)]",children:t.map((r,a)=>e.jsx("span",{className:"text-[11px] px-[var(--spacing-2)] py-[2px] rounded-[var(--radius-default)] bg-bg-secondary text-text-secondary",children:String(r)},a))}):e.jsxs("span",{className:"text-[13px] font-mono text-text-secondary",children:["[",t.length," items]"]}):typeof t=="object"?e.jsx("span",{className:"text-[13px] font-mono text-text-secondary",children:JSON.stringify(t)}):e.jsx("span",{className:"text-[13px] text-text-primary",children:String(t)})}function Ge({data:t}){const r=Object.entries(t).filter(([,a])=>typeof a!="object"||a===null);return r.length===0?null:e.jsxs("div",{children:[e.jsx(L,{title:"Properties"}),e.jsx("div",{className:"flex flex-col",children:r.map(([a,s])=>e.jsxs("div",{className:"grid grid-cols-[140px_1fr] gap-[var(--spacing-3)] py-[var(--spacing-1-5)] border-b border-border-divider last:border-b-0 items-start",children:[e.jsx("span",{className:"text-[11px] font-[var(--font-weight-semibold)] text-text-tertiary font-mono pt-[1px]",children:a}),e.jsx(oe,{value:s})]},a))})]})}function qe(t){if(typeof t!="object"||t===null)return!1;const r=t;return"severity"in r||"gap_id"in r||"type"in r}function Ue({data:t}){const r=String(t.gap_id||t.id||""),a=String(t.severity||"medium"),s=String(t.type||""),i=String(t.description||t.claim||""),o=String(t.suggested_fix||t.fix||""),c={critical:{bg:"rgba(196,101,85,0.20)",color:"var(--color-status-blocked)"},high:{bg:"rgba(200,134,58,0.20)",color:"var(--color-accent-orange, #C8863A)"},medium:{bg:"rgba(184,149,64,0.20)",color:"var(--color-accent-yellow)"},low:{bg:"rgba(91,141,184,0.20)",color:"var(--color-accent-blue)"}},n=c[a.toLowerCase()]||c.medium;return e.jsxs("div",{className:"p-[10px_14px] rounded-[10px] border-l-[3px] mb-[var(--spacing-1-5)]",style:{borderLeftColor:"var(--color-status-blocked)",background:"var(--color-status-bg-blocked)"},children:[e.jsxs("div",{className:"flex items-center gap-[var(--spacing-1-5)] mb-[var(--spacing-1)]",children:[r&&e.jsx("span",{className:"text-[10px] font-[var(--font-weight-bold)] font-mono",style:{color:"var(--color-status-blocked)"},children:r}),e.jsx("span",{className:"text-[9px] font-[var(--font-weight-bold)] px-[5px] py-[1px] rounded-[var(--radius-sm)] uppercase",style:{background:n.bg,color:n.color},children:a}),s&&e.jsx("span",{className:"text-[10px] text-text-tertiary ml-auto font-mono",children:s})]}),i&&e.jsx("p",{className:"text-[13px] text-text-primary mb-[var(--spacing-1)]",children:i}),o&&e.jsxs("p",{className:"text-[length:var(--font-size-sm)] text-text-secondary italic",children:[e.jsx("strong",{className:"font-[var(--font-weight-semibold)] not-italic text-text-tertiary text-[10px] uppercase",children:"Fix: "}),o]})]})}function Ye(t){if(typeof t!="object"||t===null)return!1;const r=t;return("claim"in r||"check"in r)&&!("severity"in r)}function Ze({data:t}){const r=String(t.claim||t.check||t.description||""),a=String(t.evidence||t.detail||""),s=t.passed===!0||t.status==="passed"||t.status==="completed";return e.jsxs("div",{className:"flex items-start gap-[var(--spacing-2)] p-[var(--spacing-2)_var(--spacing-3)] rounded-[var(--radius-md)] bg-bg-card border border-border-divider",children:[s?e.jsx($,{size:16,strokeWidth:2,className:"shrink-0 mt-[1px]",style:{color:"var(--color-status-completed)"}}):e.jsx(re,{size:16,strokeWidth:2,className:"shrink-0 mt-[1px] text-text-placeholder"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"text-[13px] text-text-primary font-[var(--font-weight-medium)]",children:r}),a&&e.jsx("p",{className:"text-[11px] text-text-tertiary mt-[2px] italic",children:a})]})]})}function le({content:t}){const r=d.useMemo(()=>{try{return JSON.stringify(JSON.parse(t),null,2)}catch{return t}},[t]);return e.jsx("pre",{className:["rounded-[10px] p-[16px_20px] font-mono text-[11px] leading-[1.6] overflow-x-auto","bg-[#2C2723] text-[#D9D0C4] border border-[#3D3731]"].join(" "),children:r})}const m=xe((t,r)=>({entries:[],byId:{},loading:!1,error:null,typeFilter:"all",tagFilter:"all",categoryFilter:"all",statusFilter:"all",search:"",selectedId:null,backlinksCache:{},health:null,graph:null,setTypeFilter:a=>t({typeFilter:a}),setTagFilter:a=>t({tagFilter:a}),setCategoryFilter:a=>t({categoryFilter:a}),setStatusFilter:a=>t({statusFilter:a}),setSearch:a=>t({search:a}),setSelected:a=>{t({selectedId:a}),a&&!r().backlinksCache[a]&&r().fetchBacklinks(a)},fetchEntries:async()=>{t({loading:!0,error:null});try{const{search:a}=r(),s=a?`${j.WIKI}?q=${encodeURIComponent(a)}`:j.WIKI,i=await fetch(s);if(!i.ok)throw new Error(`Failed: ${i.status}`);const c=(await i.json()).entries??[],n={};for(const l of c)n[l.id]=l;t({entries:c,byId:n,loading:!1})}catch(a){t({loading:!1,error:String(a)})}},fetchBacklinks:async a=>{try{const s=j.WIKI_BACKLINKS.replace(":id",encodeURIComponent(a)),i=await fetch(s);if(!i.ok)return;const o=await i.json();t(c=>({backlinksCache:{...c.backlinksCache,[a]:o.backlinks??[]}}))}catch{}},fetchHealth:async()=>{try{const a=await fetch(j.WIKI_HEALTH);if(!a.ok)return;const s=await a.json();t({health:s})}catch{}},fetchGraph:async()=>{try{const a=await fetch(j.WIKI_GRAPH);if(!a.ok)return;const s=await a.json();t({graph:s})}catch{}},createEntry:async a=>{const s=await fetch(j.WIKI,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(a)});if(!s.ok){const o=await s.json().catch(()=>({}));throw new Error(o.error??`create failed: ${s.status}`)}const i=await s.json();return await r().fetchEntries(),i.entry},updateEntry:async(a,s)=>{const i=j.WIKI_DETAIL.replace(":id",encodeURIComponent(a)),o=await fetch(i,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify(s)});if(!o.ok){const n=await o.json().catch(()=>({}));throw new Error(n.error??`update failed: ${o.status}`)}const c=await o.json();return await r().fetchEntries(),c.entry},removeEntry:async a=>{const s=j.WIKI_DETAIL.replace(":id",encodeURIComponent(a)),i=await fetch(s,{method:"DELETE"});if(!i.ok){const o=await i.json().catch(()=>({}));throw new Error(o.error??`delete failed: ${i.status}`)}await r().fetchEntries()},filteredEntries:()=>{const{entries:a,typeFilter:s,tagFilter:i,categoryFilter:o,statusFilter:c}=r();return a.filter(n=>!(s!=="all"&&n.type!==s||i!=="all"&&!n.tags.includes(i)||o!=="all"&&n.category!==o||c!=="all"&&n.status!==c))},entriesByType:()=>{const a=r().filteredEntries(),s={project:[],roadmap:[],spec:[],issue:[],lesson:[],knowhow:[],note:[]};for(const i of a)s[i.type].push(i);return s},allTags:()=>{const a=new Set;for(const s of r().entries)for(const i of s.tags)a.add(i);return Array.from(a).sort()}})),Xe={project:"Project",roadmap:"Roadmap",spec:"Specs",issue:"Issues",lesson:"Lessons",knowhow:"KnowHow",note:"Notes"},G={project:"var(--color-accent-blue, #3b82f6)",roadmap:"var(--color-accent-purple, #8b5cf6)",spec:"var(--color-accent-green, #16a34a)",issue:"var(--color-accent-red, #dc2626)",lesson:"var(--color-accent-yellow, #ca8a04)",knowhow:"var(--color-accent-cyan, #0891b2)",note:"var(--color-text-tertiary, #9ca3af)"},Qe=["project","roadmap","spec","issue","lesson","knowhow","note"];function et(t){return t.replace(/^#{1,6}\s+/,"").trim()}function tt(){const t=m(l=>l.entries),r=m(l=>l.typeFilter),a=m(l=>l.tagFilter),s=m(l=>l.categoryFilter),i=m(l=>l.statusFilter),o=m(l=>l.selectedId),c=m(l=>l.setSelected),n=d.useMemo(()=>{const l={project:[],roadmap:[],spec:[],issue:[],lesson:[],knowhow:[],note:[]};for(const x of t)r!=="all"&&x.type!==r||a!=="all"&&!x.tags.includes(a)||s!=="all"&&x.category!==s||i!=="all"&&x.status!==i||l[x.type].push(x);return l},[t,r,a,s,i]);return e.jsx("div",{className:"flex flex-col gap-1 py-1 overflow-y-auto h-full",children:Qe.map(l=>{const x=n[l];return!x||x.length===0?null:e.jsxs("section",{className:"px-2",children:[e.jsxs("h3",{className:"flex items-center gap-1.5 px-1 py-1.5 text-[10px] text-text-tertiary uppercase tracking-wider font-semibold",children:[e.jsx("span",{className:"inline-block w-[6px] h-[6px] rounded-full shrink-0",style:{backgroundColor:G[l]}}),Xe[l],e.jsx("span",{className:"text-text-quaternary font-normal ml-0.5",children:x.length})]}),e.jsx("ul",{className:"flex flex-col gap-px",children:x.map(p=>e.jsx(rt,{entry:p,typeColor:G[p.type],selected:p.id===o,onSelect:()=>c(p.id)},p.id))})]},l)})})}function rt({entry:t,typeColor:r,selected:a,onSelect:s}){return e.jsx("li",{children:e.jsx("button",{type:"button",onClick:s,className:`w-full text-left rounded-[var(--radius-md,6px)] px-2.5 py-2 transition-all ${a?"bg-bg-secondary shadow-[inset_0_0_0_1px_var(--color-border-strong)]":"hover:bg-bg-secondary"}`,style:a?{borderLeft:`2px solid ${r}`,paddingLeft:"8px"}:void 0,children:e.jsxs("div",{className:"flex items-start gap-1.5",children:[!a&&e.jsx("span",{className:"inline-block w-[5px] h-[5px] rounded-full shrink-0 mt-[5px]",style:{backgroundColor:r,opacity:.6}}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"font-medium text-text-primary text-[length:var(--font-size-sm)] truncate leading-snug",children:t.title}),t.summary&&e.jsx("div",{className:"text-text-tertiary text-[11px] line-clamp-1 mt-0.5 leading-snug",children:et(t.summary)}),t.tags.length>0&&e.jsxs("div",{className:"mt-1 flex flex-wrap gap-1",children:[t.tags.slice(0,3).map(i=>e.jsx("span",{className:"px-1 py-px text-[10px] rounded bg-bg-tertiary text-text-tertiary leading-snug",children:i},i)),t.tags.length>3&&e.jsxs("span",{className:"text-[10px] text-text-quaternary",children:["+",t.tags.length-3]})]})]})]})})})}function st(t){const r=t.split(`
19
+ `);let a=!1;const s=[];for(const i of r){if(/^```/.test(i.trim())){a=!a,s.push(i);continue}if(a){s.push(i);continue}s.push(i.replace(/\[\[([^\]]+)\]\]/g,(o,c)=>`[${c}](wiki:${c})`))}return s.join(`
20
+ `)}function at(t){return t.replace(/^#{1,6}\s+/,"").trim()}function nt(){const t=m(n=>n.selectedId),r=m(n=>n.byId),a=m(n=>n.backlinksCache);m(n=>n.setSelected);const s=t?r[t]:void 0,i=t?a[t]??[]:[],o=d.useMemo(()=>{if(!s)return null;const n=[];if(s.summary&&(n.push(`> ${at(s.summary)}`),n.push("")),s.tags.length>0&&(n.push(s.tags.map(l=>`\`${l}\``).join(" ")),n.push("")),s.category&&(n.push(`**Category:** ${s.category}`),n.push("")),n.push("---"),n.push(""),s.body&&s.source.kind==="file"&&(n.push(st(s.body)),n.push("")),s.source.kind==="virtual"&&s.raw!==void 0&&(n.push("## Raw"),n.push("```json"),n.push(JSON.stringify(s.raw,null,2)),n.push("```"),n.push("")),Object.keys(s.ext).length>0&&(n.push("## Metadata"),n.push("```json"),n.push(JSON.stringify(s.ext,null,2)),n.push("```"),n.push("")),i.length>0){n.push(`## Backlinks (${i.length})`);for(const l of i)n.push(`- **${l.title}** _${l.type}_`);n.push("")}return n.join(`
21
+ `)},[s,i]);if(!t)return e.jsx("div",{className:"flex items-center justify-center h-full text-text-tertiary text-[length:var(--font-size-sm)]",children:"Select an entry"});if(!s)return e.jsx("div",{className:"p-4 text-text-tertiary text-[length:var(--font-size-sm)]",children:"Entry not found."});const c=s.source.path+(s.source.line!==void 0?`:${s.source.line}`:"");return e.jsx(ne,{content:o,path:c,onNavigate:()=>{},loading:!1,error:null,title:s.title,subtitle:`${s.type.toUpperCase()} · ${s.status.toUpperCase()}`})}function it(){const{health:t,fetchHealth:r,setSelected:a,byId:s}=m(Q(n=>({health:n.health,fetchHealth:n.fetchHealth,setSelected:n.setSelected,byId:n.byId}))),[i,o]=d.useState(!1);if(d.useEffect(()=>{r()},[r]),!t)return e.jsx("div",{className:"px-3 py-2 text-[length:var(--font-size-xs)] text-text-tertiary border-b border-border",children:"Loading health…"});const c=t.score>=80?"var(--color-accent-green, #16a34a)":t.score>=50?"var(--color-accent-yellow, #ca8a04)":"var(--color-accent-red, #dc2626)";return e.jsxs("div",{className:"border-b border-border",children:[e.jsxs("button",{type:"button",onClick:()=>o(!i),className:"w-full flex items-center gap-2 px-3 py-2 hover:bg-bg-secondary transition-colors",children:[e.jsx(ee,{size:12,strokeWidth:2,className:"text-text-tertiary transition-transform shrink-0",style:{transform:i?"rotate(90deg)":void 0}}),e.jsx(pe,{size:12,strokeWidth:2,className:"text-text-tertiary shrink-0"}),e.jsx("span",{className:"text-[length:var(--font-size-xs)] text-text-secondary font-medium",children:"Health"}),e.jsx("span",{className:"text-[length:var(--font-size-sm)] font-semibold ml-auto",style:{color:c},children:t.score}),e.jsxs("div",{className:"flex gap-2 text-[length:var(--font-size-xs)] text-text-tertiary",children:[e.jsxs("span",{children:[t.totals.entries," entries"]}),t.totals.orphans>0&&e.jsxs("span",{children:["· ",t.totals.orphans," orphans"]}),t.totals.brokenLinks>0&&e.jsxs("span",{className:"text-accent-red",children:["· ",t.totals.brokenLinks," broken"]})]})]}),i&&e.jsxs("div",{className:"px-3 pb-2 flex flex-col gap-2 text-[length:var(--font-size-xs)]",children:[t.hubs.length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"uppercase tracking-wider text-text-tertiary mb-1 text-[10px]",children:"Top hubs"}),e.jsx("ul",{className:"flex flex-col gap-0.5",children:t.hubs.slice(0,5).map(n=>{var l;return e.jsxs("li",{className:"flex justify-between gap-2",children:[e.jsx("button",{type:"button",onClick:()=>a(n.id),className:"truncate text-accent-blue hover:underline text-left",children:((l=s[n.id])==null?void 0:l.title)??n.id}),e.jsx("span",{className:"text-text-tertiary shrink-0",children:n.inDegree})]},n.id)})})]}),t.orphans.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"uppercase tracking-wider text-text-tertiary mb-1 text-[10px]",children:["Orphans (",t.orphans.length,")"]}),e.jsx("ul",{className:"flex flex-wrap gap-1 max-h-16 overflow-y-auto",children:t.orphans.slice(0,10).map(n=>{var l;return e.jsx("li",{children:e.jsx("button",{type:"button",onClick:()=>a(n),className:"px-1.5 py-0.5 rounded bg-bg-tertiary text-text-secondary hover:text-accent-blue hover:underline transition-colors",children:((l=s[n])==null?void 0:l.title)??n})},n)})})]}),t.brokenLinks.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"uppercase tracking-wider text-text-tertiary mb-1 text-[10px]",children:["Broken (",t.brokenLinks.length,")"]}),e.jsx("ul",{className:"flex flex-col gap-0.5 max-h-16 overflow-y-auto text-text-secondary",children:t.brokenLinks.slice(0,5).map((n,l)=>e.jsxs("li",{className:"truncate",children:[e.jsx("span",{className:"text-text-tertiary",children:n.sourceId})," → ",e.jsx("span",{className:"line-through",children:n.target})]},`${n.sourceId}-${l}`))})]})]})]})}const ot={project:"var(--color-accent-blue, #3b82f6)",roadmap:"var(--color-accent-purple, #8b5cf6)",spec:"var(--color-accent-green, #16a34a)",issue:"var(--color-accent-red, #dc2626)",lesson:"var(--color-accent-yellow, #ca8a04)",knowhow:"var(--color-accent-cyan, #0891b2)",note:"var(--color-text-tertiary, #9ca3af)"};function lt(t){return t.replace(/^#{1,6}\s+/,"").trim()}function ct(){const t=m(l=>l.entries),r=m(l=>l.typeFilter),a=m(l=>l.tagFilter),s=m(l=>l.categoryFilter),i=m(l=>l.statusFilter),o=m(l=>l.setSelected),c=m(l=>l.selectedId),n=d.useMemo(()=>t.filter(l=>!(r!=="all"&&l.type!==r||a!=="all"&&!l.tags.includes(a)||s!=="all"&&l.category!==s||i!=="all"&&l.status!==i)),[t,r,a,s,i]);return n.length===0?e.jsx("div",{className:"flex items-center justify-center h-full text-text-tertiary text-[length:var(--font-size-sm)]",children:"No entries match the current filters"}):e.jsx("div",{className:"p-4 overflow-y-auto h-full",children:e.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(260px,1fr))] gap-3",children:n.map(l=>e.jsx(dt,{entry:l,selected:l.id===c,onSelect:()=>o(l.id)},l.id))})})}function dt({entry:t,selected:r,onSelect:a}){const s=ot[t.type];return e.jsxs("button",{type:"button",onClick:a,className:`text-left rounded-[var(--radius-md,6px)] border p-3 transition-all flex flex-col gap-1.5 ${r?"border-border-strong bg-bg-secondary shadow-sm":"border-border bg-bg-primary hover:bg-bg-secondary hover:border-border-strong"}`,children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"inline-block w-[6px] h-[6px] rounded-full shrink-0",style:{backgroundColor:s}}),e.jsx("span",{className:"text-[10px] uppercase tracking-wider text-text-tertiary font-medium",children:t.type}),e.jsx("span",{className:"text-[10px] text-text-quaternary ml-auto",children:t.status})]}),e.jsx("div",{className:"font-medium text-text-primary text-[length:var(--font-size-sm)] leading-snug line-clamp-2",children:t.title}),t.summary&&e.jsx("div",{className:"text-text-tertiary text-[11px] line-clamp-2 leading-snug",children:lt(t.summary)}),t.tags.length>0&&e.jsxs("div",{className:"flex flex-wrap gap-1 mt-0.5",children:[t.tags.slice(0,4).map(i=>e.jsx("span",{className:"px-1 py-px text-[10px] rounded bg-bg-tertiary text-text-tertiary",children:i},i)),t.tags.length>4&&e.jsxs("span",{className:"text-[10px] text-text-quaternary",children:["+",t.tags.length-4]})]}),e.jsx("div",{className:"text-[10px] text-text-quaternary font-mono truncate mt-auto pt-1",children:t.source.path})]})}const xt={project:"#3b82f6",roadmap:"#8b5cf6",spec:"#16a34a",issue:"#dc2626",lesson:"#ca8a04",knowhow:"#0891b2",note:"#9ca3af"};function pt(){const t=m(o=>o.fetchGraph),r=m(o=>o.graph),a=m(o=>o.byId),s=m(o=>o.setSelected);d.useEffect(()=>{t()},[t]);const i=d.useMemo(()=>{if(!r)return[];const o=new Map;for(const[c,n]of Object.entries(r.forwardLinks)){o.has(c)||o.set(c,{out:0,in:0}),o.get(c).out=n.length;for(const l of n)o.has(l)||o.set(l,{out:0,in:0}),o.get(l).in+=1}return Array.from(o.entries()).map(([c,n])=>{var l,x;return{id:c,title:((l=a[c])==null?void 0:l.title)??c,type:(x=a[c])==null?void 0:x.type,outDegree:n.out,inDegree:n.in,total:n.out+n.in}}).sort((c,n)=>n.total-c.total)},[r,a]);return r?e.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-4 px-4 py-2.5 border-b border-border text-[length:var(--font-size-xs)] text-text-secondary",children:[e.jsxs("span",{children:[i.length," connected nodes"]}),e.jsx("span",{children:"·"}),e.jsxs("span",{children:[Object.values(r.forwardLinks).reduce((o,c)=>o+c.length,0)," links"]}),r.brokenLinks.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsxs("span",{className:"text-accent-red",children:[r.brokenLinks.length," broken"]})]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[e.jsxs("table",{className:"w-full text-[length:var(--font-size-sm)]",children:[e.jsx("thead",{className:"sticky top-0 bg-bg-primary z-10",children:e.jsxs("tr",{className:"border-b border-border text-[10px] uppercase tracking-wider text-text-tertiary",children:[e.jsx("th",{className:"text-left px-4 py-2 font-medium",children:"Entry"}),e.jsx("th",{className:"text-left px-3 py-2 font-medium w-16",children:"Type"}),e.jsx("th",{className:"text-center px-3 py-2 font-medium w-16",children:"Out"}),e.jsx("th",{className:"text-center px-3 py-2 font-medium w-16",children:"In"})]})}),e.jsx("tbody",{children:i.map(o=>e.jsxs("tr",{className:"border-b border-border hover:bg-bg-secondary transition-colors cursor-pointer",onClick:()=>s(o.id),children:[e.jsx("td",{className:"px-4 py-2",children:e.jsxs("div",{className:"flex items-center gap-2",children:[o.type&&e.jsx("span",{className:"inline-block w-[6px] h-[6px] rounded-full shrink-0",style:{backgroundColor:xt[o.type]??"#9ca3af"}}),e.jsx("span",{className:"text-text-primary truncate",children:o.title})]})}),e.jsx("td",{className:"px-3 py-2 text-text-tertiary text-[length:var(--font-size-xs)]",children:o.type??"—"}),e.jsx("td",{className:"px-3 py-2 text-center",children:o.outDegree>0?e.jsx("span",{className:"text-accent-blue font-medium",children:o.outDegree}):e.jsx("span",{className:"text-text-quaternary",children:"0"})}),e.jsx("td",{className:"px-3 py-2 text-center",children:o.inDegree>0?e.jsx("span",{className:"text-accent-green font-medium",children:o.inDegree}):e.jsx("span",{className:"text-text-quaternary",children:"0"})})]},o.id))})]}),r.brokenLinks.length>0&&e.jsxs("div",{className:"p-4 border-t border-border",children:[e.jsxs("h3",{className:"text-[10px] uppercase tracking-wider text-text-tertiary font-medium mb-2",children:["Broken Links (",r.brokenLinks.length,")"]}),e.jsx("ul",{className:"flex flex-col gap-1 text-[length:var(--font-size-xs)]",children:r.brokenLinks.map((o,c)=>{var n;return e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button",onClick:()=>s(o.sourceId),className:"text-accent-blue hover:underline truncate",children:((n=a[o.sourceId])==null?void 0:n.title)??o.sourceId}),e.jsx("span",{className:"text-text-quaternary",children:"→"}),e.jsx("span",{className:"text-text-tertiary line-through",children:o.target})]},`${o.sourceId}-${c}`)})})]})]})]}):e.jsx("div",{className:"flex items-center justify-center h-full text-text-tertiary text-[length:var(--font-size-sm)]",children:"Loading graph data…"})}const ut=[{label:"Reader",icon:e.jsx(C,{size:14,strokeWidth:2}),shortcut:"1"},{label:"Gallery",icon:e.jsx(Z,{size:14,strokeWidth:2}),shortcut:"2"},{label:"Structured",icon:e.jsx(me,{size:14,strokeWidth:2}),shortcut:"3"}],q=["reader","gallery","structured"],ft=[{label:"Reader",icon:e.jsx(he,{size:14,strokeWidth:2}),shortcut:"1"},{label:"Gallery",icon:e.jsx(Z,{size:14,strokeWidth:2}),shortcut:"2"},{label:"Graph",icon:e.jsx(we,{size:14,strokeWidth:2}),shortcut:"3"}],U=["reader","gallery","graph"],ht=[{value:"all",label:"All"},{value:"project",label:"Project"},{value:"roadmap",label:"Roadmap"},{value:"spec",label:"Specs"},{value:"issue",label:"Issues"},{value:"lesson",label:"Lessons"},{value:"knowhow",label:"KnowHow"},{value:"note",label:"Notes"}],k={initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8}};function Ft(){const[t,r]=d.useState("files"),[a,s]=d.useState("reader"),[i,o]=d.useState("reader"),{tree:c,selectedPath:n,content:l,loading:x,treeLoading:p,error:u,selectFile:f}=Se(),{fetchEntries:g,loading:b,error:y,entries:S,search:E,setSearch:R,typeFilter:ce,setTypeFilter:de}=m(Q(h=>({fetchEntries:h.fetchEntries,loading:h.loading,error:h.error,entries:h.entries,search:h.search,setSearch:h.setSearch,typeFilter:h.typeFilter,setTypeFilter:h.setTypeFilter})));d.useEffect(()=>{t==="wiki"&&g()},[t,g]),d.useEffect(()=>{if(t!=="wiki")return;const h=setTimeout(()=>void g(),200);return()=>clearTimeout(h)},[E,g,t]);const{register:V,unregister:P}=d.useContext(ue),B=d.useCallback(h=>{t==="files"?s(q[h]):o(U[h])},[t]);return d.useEffect(()=>{const h=t==="files"?ut:ft,v=t==="files"?q.indexOf(a):U.indexOf(i);V({items:h.map(z=>({label:z.label,icon:z.icon,shortcut:z.shortcut})),activeIndex:v,onSwitch:B})},[t,a,i,V,B]),d.useEffect(()=>()=>P(),[P]),d.useEffect(()=>{function h(v){v.target instanceof HTMLInputElement||v.target instanceof HTMLTextAreaElement||(t==="files"?v.key==="1"?s("reader"):v.key==="2"?s("gallery"):v.key==="3"&&s("structured"):v.key==="1"?o("reader"):v.key==="2"?o("gallery"):v.key==="3"&&o("graph"))}return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[t]),e.jsxs("div",{className:"flex h-full overflow-hidden",children:[e.jsxs("div",{className:"w-[272px] shrink-0 border-r border-border overflow-hidden flex flex-col bg-bg-primary",children:[e.jsxs("div",{className:"flex items-center gap-1 px-2 py-2 border-b border-border shrink-0",children:[e.jsx(Y,{mode:"files",active:t==="files",icon:e.jsx(je,{size:13,strokeWidth:2}),label:"Files",onClick:()=>r("files")}),e.jsx(Y,{mode:"wiki",active:t==="wiki",icon:e.jsx(Ce,{size:13,strokeWidth:2}),label:"Wiki",onClick:()=>r("wiki")})]}),t==="files"?e.jsx(ge,{tree:c,selectedPath:n,onSelectFile:f,loading:p}):e.jsxs(e.Fragment,{children:[e.jsx(it,{}),e.jsxs("div",{className:"flex flex-col gap-2 px-3 py-2 border-b border-border",children:[e.jsxs("div",{className:"relative",children:[e.jsx(X,{size:13,strokeWidth:2,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-text-tertiary pointer-events-none"}),e.jsx("input",{type:"text",value:E,placeholder:"Search…",onChange:h=>R(h.target.value),className:"w-full pl-7 pr-7 py-1.5 bg-bg-secondary border border-border rounded-[var(--radius-md,6px)] text-[length:var(--font-size-sm)] text-text-primary placeholder:text-text-quaternary focus:outline-none focus:border-border-strong transition-colors"}),E&&e.jsx("button",{type:"button",onClick:()=>R(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-text-tertiary hover:text-text-secondary transition-colors",children:e.jsx(fe,{size:12,strokeWidth:2})})]}),e.jsx("div",{className:"flex flex-wrap gap-1",children:ht.map(h=>e.jsx("button",{type:"button",onClick:()=>de(h.value),className:`px-2 py-0.5 rounded-[var(--radius-full,999px)] text-[10px] font-medium transition-all ${ce===h.value?"bg-text-primary text-bg-primary":"text-text-tertiary hover:text-text-secondary hover:bg-bg-secondary"}`,children:h.label},h.value))}),e.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-text-quaternary",children:[e.jsxs("span",{children:[S.length," entr",S.length===1?"y":"ies"]}),b&&e.jsx("span",{className:"animate-pulse",children:"· loading…"}),y&&e.jsx("span",{className:"text-accent-red ml-1",children:y})]})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:e.jsx(tt,{})})]})]}),e.jsx("div",{className:"flex-1 overflow-hidden relative min-w-0",children:e.jsx(be,{mode:"wait",children:t==="files"?e.jsxs(e.Fragment,{children:[a==="reader"&&e.jsx(N.div,{className:"absolute inset-0 flex flex-col",variants:k,initial:"initial",animate:"animate",exit:"exit",transition:{duration:.25,ease:[.34,1.56,.64,1]},children:e.jsx(ne,{content:l,path:n,onNavigate:f,loading:x,error:u})},"file-reader"),a==="gallery"&&e.jsx(N.div,{className:"absolute inset-0 flex flex-col",variants:k,initial:"initial",animate:"animate",exit:"exit",transition:{duration:.25,ease:[.34,1.56,.64,1]},children:e.jsx(De,{tree:c,onSelectFile:f,selectedPath:n})},"file-gallery"),a==="structured"&&e.jsx(N.div,{className:"absolute inset-0 flex flex-col",variants:k,initial:"initial",animate:"animate",exit:"exit",transition:{duration:.25,ease:[.34,1.56,.64,1]},children:e.jsx(Ke,{content:l,path:n})},"file-structured")]}):e.jsxs(e.Fragment,{children:[i==="reader"&&e.jsx(N.div,{className:"absolute inset-0",variants:k,initial:"initial",animate:"animate",exit:"exit",transition:{duration:.2},children:e.jsx(nt,{})},"wiki-reader"),i==="gallery"&&e.jsx(N.div,{className:"absolute inset-0",variants:k,initial:"initial",animate:"animate",exit:"exit",transition:{duration:.2},children:e.jsx(ct,{})},"wiki-gallery"),i==="graph"&&e.jsx(N.div,{className:"absolute inset-0",variants:k,initial:"initial",animate:"animate",exit:"exit",transition:{duration:.2},children:e.jsx(pt,{})},"wiki-graph")]})})})]})}function Y({active:t,icon:r,label:a,onClick:s}){return e.jsxs("button",{type:"button",onClick:s,className:["flex-1 flex items-center justify-center gap-1.5 px-2 py-1.5 rounded-[var(--radius-md,6px)]","text-[length:var(--font-size-sm)] font-medium transition-all duration-150",t?"bg-bg-active text-text-primary shadow-sm":"text-text-tertiary hover:text-text-secondary hover:bg-bg-hover"].join(" "),children:[r,e.jsx("span",{children:a})]})}export{Ft as ArtifactsPage};
@@ -0,0 +1,6 @@
1
+ import{z as L,j as d,r as M,a2 as fn,i as Ne,c as mn,R as hn,P as pn,O as gn,f as xn,T as vn,h as so,k as tt,s as jt,w as io,a3 as lo,a4 as yn}from"./index-uIqUCT8y.js";import{A as bt,E as bn}from"./index-DLBN_7fb.js";import{Z as Cn}from"./zap-DhiYlgyZ.js";const It=0,Oe=1,Ye=2,zo=4;function ao(e){return()=>e}function Tn(e){e()}function Eo(e,t){return o=>e(t(o))}function co(e,t){return()=>e(t)}function In(e,t){return o=>e(t,o)}function _t(e){return e!==void 0}function wn(...e){return()=>{e.map(Tn)}}function Xe(){}function wt(e,t){return t(e),e}function Sn(e,t){return t(e)}function oe(...e){return e}function Q(e,t){return e(Oe,t)}function G(e,t){e(It,t)}function Ft(e){e(Ye)}function se(e){return e(zo)}function N(e,t){return Q(e,In(t,It))}function ke(e,t){const o=e(Oe,n=>{o(),t(n)});return o}function uo(e){let t,o;return n=>r=>{t=r,o&&clearTimeout(o),o=setTimeout(()=>{n(t)},e)}}function Bo(e,t){return e===t}function te(e=Bo){let t;return o=>n=>{e(t,n)||(t=n,o(n))}}function P(e){return t=>o=>{e(o)&&t(o)}}function H(e){return t=>Eo(t,e)}function He(e){return t=>()=>{t(e)}}function I(e,...t){const o=kn(...t);return((n,r)=>{switch(n){case Ye:Ft(e);return;case Oe:return Q(e,o(r))}})}function ze(e,t){return o=>n=>{o(t=e(t,n))}}function _e(e){return t=>o=>{e>0?e--:t(o)}}function Be(e){let t=null,o;return n=>r=>{t=r,!o&&(o=setTimeout(()=>{o=void 0,n(t)},e))}}function $(...e){const t=new Array(e.length);let o=0,n=null;const r=2**e.length-1;return e.forEach((s,i)=>{const a=2**i;Q(s,l=>{const u=o;o|=a,t[i]=l,u!==r&&o===r&&n&&(n(),n=null)})}),s=>i=>{const a=()=>{s([i].concat(t))};o===r?a():n=a}}function kn(...e){return t=>e.reduceRight(Sn,t)}function Rn(e){let t,o;const n=()=>t==null?void 0:t();return function(r,s){switch(r){case Oe:return s?o===s?void 0:(n(),o=s,t=Q(e,s),t):(n(),Xe);case Ye:n(),o=null;return}}}function S(e){let t=e;const o=K();return((n,r)=>{switch(n){case It:t=r;break;case Oe:{r(t);break}case zo:return t}return o(n,r)})}function ve(e,t){return wt(S(t),o=>N(e,o))}function K(){const e=[];return((t,o)=>{switch(t){case It:e.slice().forEach(n=>{n(o)});return;case Ye:e.splice(0,e.length);return;case Oe:return e.push(o),()=>{const n=e.indexOf(o);n>-1&&e.splice(n,1)}}})}function Ie(e){return wt(K(),t=>N(e,t))}function Y(e,t=[],{singleton:o}={singleton:!0}){return{constructor:e,dependencies:t,id:jn(),singleton:o}}const jn=()=>Symbol();function Hn(e){const t=new Map,o=({constructor:n,dependencies:r,id:s,singleton:i})=>{if(i&&t.has(s))return t.get(s);const a=n(r.map(l=>o(l)));return i&&t.set(s,a),a};return o(e)}function ue(...e){const t=K(),o=new Array(e.length);let n=0;const r=2**e.length-1;return e.forEach((s,i)=>{const a=2**i;Q(s,l=>{o[i]=l,n|=a,n===r&&G(t,o)})}),function(s,i){switch(s){case Ye:{Ft(t);return}case Oe:return n===r&&i(o),Q(t,i)}}}function W(e,t=Bo){return I(e,te(t))}function Mt(...e){return function(t,o){switch(t){case Ye:return;case Oe:return wn(...e.map(n=>Q(n,o)))}}}const he={DEBUG:0,INFO:1,WARN:2,ERROR:3},zn={[he.DEBUG]:"debug",[he.ERROR]:"error",[he.INFO]:"log",[he.WARN]:"warn"},En=()=>typeof globalThis>"u"?window:globalThis,Ae=Y(()=>{const e=S(he.ERROR);return{log:S((t,o,n=he.INFO)=>{const r=En().VIRTUOSO_LOG_LEVEL??se(e);n>=r&&console[zn[n]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,o)}),logLevel:e}},[],{singleton:!0});function Fe(e,t,o){return Vt(e,t,o).callbackRef}function Vt(e,t,o){const n=L.useRef(null);let r=i=>{};const s=L.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(i=>{const a=()=>{const l=i[0].target;l.offsetParent!==null&&e(l)};o?a():requestAnimationFrame(a)}):null,[e,o]);return r=i=>{i&&t?(s==null||s.observe(i),n.current=i):(n.current&&(s==null||s.unobserve(n.current)),n.current=null)},{callbackRef:r,ref:n}}function Bn(e,t,o,n,r,s,i,a,l){const u=L.useCallback(h=>{const v=Ln(h.children,t,a?"offsetWidth":"offsetHeight",r);let g=h.parentElement;for(;g.dataset.virtuosoScroller===void 0;)g=g.parentElement;const p=g.lastElementChild.dataset.viewportType==="window";let T;p&&(T=g.ownerDocument.defaultView);const y=i?a?i.scrollLeft:i.scrollTop:p?a?T.scrollX||T.document.documentElement.scrollLeft:T.scrollY||T.document.documentElement.scrollTop:a?g.scrollLeft:g.scrollTop,x=i?a?i.scrollWidth:i.scrollHeight:p?a?T.document.documentElement.scrollWidth:T.document.documentElement.scrollHeight:a?g.scrollWidth:g.scrollHeight,m=i?a?i.offsetWidth:i.offsetHeight:p?a?T.innerWidth:T.innerHeight:a?g.offsetWidth:g.offsetHeight;n({scrollHeight:x,scrollTop:Math.max(y,0),viewportHeight:m}),s==null||s(a?fo("column-gap",getComputedStyle(h).columnGap,r):fo("row-gap",getComputedStyle(h).rowGap,r)),v!==null&&e(v)},[e,t,r,s,i,n,a]);return Vt(u,o,l)}function Ln(e,t,o,n){const r=e.length;if(r===0)return null;const s=[];for(let i=0;i<r;i++){const a=e.item(i);if(a.dataset.index===void 0)continue;const l=parseInt(a.dataset.index),u=parseFloat(a.dataset.knownSize),h=t(a,o);if(h===0&&n("Zero-sized element, this should not happen",{child:a},he.ERROR),h===u)continue;const v=s[s.length-1];s.length===0||v.size!==h||v.endIndex!==l-1?s.push({endIndex:l,size:h,startIndex:l}):s[s.length-1].endIndex++}return s}function fo(e,t,o){return t!=="normal"&&(t==null?void 0:t.endsWith("px"))!==!0&&o(`${e} was not resolved to pixel value correctly`,t,he.WARN),t==="normal"?0:parseInt(t??"0",10)}function Lo(e,t,o){const n=L.useRef(null),r=L.useCallback(l=>{if(!(l!=null&&l.offsetParent))return;const u=l.getBoundingClientRect(),h=u.width;let v,g;if(t){const p=t.getBoundingClientRect(),T=u.top-p.top;g=p.height-Math.max(0,T),v=T+t.scrollTop}else{const p=i.current.ownerDocument.defaultView;g=p.innerHeight-Math.max(0,u.top),v=u.top+p.scrollY}n.current={listHeight:u.height,offsetTop:v,visibleHeight:g,visibleWidth:h},e(n.current)},[e,t]),{callbackRef:s,ref:i}=Vt(r,!0,o),a=L.useCallback(()=>{r(i.current)},[r,i]);return L.useEffect(()=>{var u;if(t){t.addEventListener("scroll",a);const h=new ResizeObserver(()=>{requestAnimationFrame(a)});return h.observe(t),()=>{t.removeEventListener("scroll",a),h.unobserve(t)}}const l=(u=i.current)==null?void 0:u.ownerDocument.defaultView;return l==null||l.addEventListener("scroll",a),l==null||l.addEventListener("resize",a),()=>{l==null||l.removeEventListener("scroll",a),l==null||l.removeEventListener("resize",a)}},[a,t,i]),s}const be=Y(()=>{const e=K(),t=K(),o=S(0),n=K(),r=S(0),s=K(),i=K(),a=S(0),l=S(0),u=S(0),h=S(0),v=K(),g=K(),p=S(!1),T=S(!1),y=S(!1);return N(I(e,H(({scrollTop:x})=>x)),t),N(I(e,H(({scrollHeight:x})=>x)),i),N(t,r),{deviation:o,fixedFooterHeight:u,fixedHeaderHeight:l,footerHeight:h,headerHeight:a,horizontalDirection:T,scrollBy:g,scrollContainerState:e,scrollHeight:i,scrollingInProgress:p,scrollTo:v,scrollTop:t,skipAnimationFrameInResizeObserver:y,smoothScrollTargetReached:n,statefulScrollTop:r,viewportHeight:s}},[],{singleton:!0}),ot={lvl:0};function No(e,t){const o=e.length;if(o===0)return[];let{index:n,value:r}=t(e[0]);const s=[];for(let i=1;i<o;i++){const{index:a,value:l}=t(e[i]);s.push({end:a-1,start:n,value:r}),n=a,r=l}return s.push({end:1/0,start:n,value:r}),s}function Z(e){return e===ot}function nt(e,t){if(!Z(e))return t===e.k?e.v:t<e.k?nt(e.l,t):nt(e.r,t)}function Re(e,t,o="k"){if(Z(e))return[-1/0,void 0];if(Number(e[o])===t)return[e.k,e.v];if(Number(e[o])<t){const n=Re(e.r,t,o);return n[0]===-1/0?[e.k,e.v]:n}return Re(e.l,t,o)}function Te(e,t,o){return Z(e)?Ao(t,o,1):t===e.k?me(e,{k:t,v:o}):t<e.k?mo(me(e,{l:Te(e.l,t,o)})):mo(me(e,{r:Te(e.r,t,o)}))}function Ue(){return ot}function Ke(e,t,o){if(Z(e))return[];const n=Re(e,t)[0];return Nn(At(e,n,o))}function Ot(e,t){if(Z(e))return ot;const{k:o,l:n,r}=e;if(t===o){if(Z(n))return r;if(Z(r))return n;const[s,i]=Oo(n);return vt(me(e,{k:s,l:Mo(n),v:i}))}return t<o?vt(me(e,{l:Ot(n,t)})):vt(me(e,{r:Ot(r,t)}))}function Pe(e){return Z(e)?[]:[...Pe(e.l),{k:e.k,v:e.v},...Pe(e.r)]}function At(e,t,o){if(Z(e))return[];const{k:n,l:r,r:s,v:i}=e;let a=[];return n>t&&(a=a.concat(At(r,t,o))),n>=t&&n<=o&&a.push({k:n,v:i}),n<=o&&(a=a.concat(At(s,t,o))),a}function vt(e){const{l:t,lvl:o,r:n}=e;if(n.lvl>=o-1&&t.lvl>=o-1)return e;if(o>n.lvl+1){if(Ht(t))return Do(me(e,{lvl:o-1}));if(!Z(t)&&!Z(t.r))return me(t.r,{l:me(t,{r:t.r.l}),lvl:o,r:me(e,{l:t.r.r,lvl:o-1})});throw new Error("Unexpected empty nodes")}if(Ht(e))return Dt(me(e,{lvl:o-1}));if(!Z(n)&&!Z(n.l)){const r=n.l,s=Ht(r)?n.lvl-1:n.lvl;return me(r,{l:me(e,{lvl:o-1,r:r.l}),lvl:r.lvl+1,r:Dt(me(n,{l:r.r,lvl:s}))})}throw new Error("Unexpected empty nodes")}function me(e,t){return Ao(t.k!==void 0?t.k:e.k,t.v!==void 0?t.v:e.v,t.lvl!==void 0?t.lvl:e.lvl,t.l!==void 0?t.l:e.l,t.r!==void 0?t.r:e.r)}function Mo(e){return Z(e.r)?e.l:vt(me(e,{r:Mo(e.r)}))}function Ht(e){return Z(e)||e.lvl>e.r.lvl}function Oo(e){return Z(e.r)?[e.k,e.v]:Oo(e.r)}function Ao(e,t,o,n=ot,r=ot){return{k:e,l:n,lvl:o,r,v:t}}function mo(e){return Dt(Do(e))}function Do(e){const{l:t}=e;return!Z(t)&&t.lvl===e.lvl?me(t,{r:me(e,{l:t.r})}):e}function Dt(e){const{lvl:t,r:o}=e;return!Z(o)&&!Z(o.r)&&o.lvl===t&&o.r.lvl===t?me(o,{l:me(e,{r:o.l}),lvl:t+1}):e}function Nn(e){return No(e,({k:t,v:o})=>({index:t,value:o}))}function Wo(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function rt(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}const Gt=Y(()=>({recalcInProgress:S(!1)}),[],{singleton:!0});function Po(e,t,o){return e[Ct(e,t,o)]}function Ct(e,t,o,n=0){let r=e.length-1;for(;n<=r;){const s=Math.floor((n+r)/2),i=e[s],a=o(i,t);if(a===0)return s;if(a===-1){if(r-n<2)return s-1;r=s-1}else{if(r===n)return s;n=s+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function Mn(e,t,o,n){const r=Ct(e,t,n),s=Ct(e,o,n,r);return e.slice(r,s+1)}function Me(e,t){return Math.round(e.getBoundingClientRect()[t])}function St(e){return!Z(e.groupOffsetTree)}function $t({index:e},t){return t===e?0:t<e?-1:1}function On(){return{groupIndices:[],groupOffsetTree:Ue(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:Ue()}}function An(e,t){let o=Z(e)?0:1/0;for(const n of t){const{endIndex:r,size:s,startIndex:i}=n;if(o=Math.min(o,i),Z(e)){e=Te(e,0,s);continue}const a=Ke(e,i-1,r+1);if(a.some(Gn(n)))continue;let l=!1,u=!1;for(const{end:h,start:v,value:g}of a)l?(r>=v||s===g)&&(e=Ot(e,v)):(u=g!==s,l=!0),h>r&&r>=v&&g!==s&&(e=Te(e,r+1,g));u&&(e=Te(e,i,s))}return[e,o]}function Dn(e){return typeof e.groupIndex<"u"}function Wn({offset:e},t){return t===e?0:t<e?-1:1}function st(e,t,o){if(t.length===0)return 0;const{index:n,offset:r,size:s}=Po(t,e,$t),i=e-n,a=s*i+(i-1)*o+r;return a>0?a+o:a}function _o(e,t){if(!St(t))return e;let o=0;for(;t.groupIndices[o]<=e+o;)o++;return e+o}function Fo(e,t,o){if(Dn(e))return t.groupIndices[e.groupIndex]+1;const n=e.index==="LAST"?o:e.index;let r=_o(n,t);return r=Math.max(0,r,Math.min(o,r)),r}function Pn(e,t,o,n=0){return n>0&&(t=Math.max(t,Po(e,n,$t).offset)),No(Mn(e,t,o,Wn),Vn)}function _n(e,[t,o,n,r]){t.length>0&&n("received item sizes",t,he.DEBUG);const s=e.sizeTree;let i=s,a=0;if(o.length>0&&Z(s)&&t.length===2){const g=t[0].size,p=t[1].size;i=o.reduce((T,y)=>Te(Te(T,y,g),y+1,p),i)}else[i,a]=An(i,t);if(i===s)return e;const{lastIndex:l,lastOffset:u,lastSize:h,offsetTree:v}=Wt(e.offsetTree,a,i,r);return{groupIndices:o,groupOffsetTree:o.reduce((g,p)=>Te(g,p,st(p,v,r)),Ue()),lastIndex:l,lastOffset:u,lastSize:h,offsetTree:v,sizeTree:i}}function Fn(e){return Pe(e).map(({k:t,v:o},n,r)=>{const s=r[n+1];return{endIndex:s!==void 0?s.k-1:1/0,size:o,startIndex:t}})}function ho(e,t){let o=0,n=0;for(;o<e;)o+=t[n+1]-t[n]-1,n++;return n-(o===e?0:1)}function Wt(e,t,o,n){let r=e,s=0,i=0,a=0,l=0;if(t!==0){l=Ct(r,t-1,$t),a=r[l].offset;const u=Re(o,t-1);s=u[0],i=u[1],r.length&&r[l].size===Re(o,t)[1]&&(l-=1),r=r.slice(0,l+1)}else r=[];for(const{start:u,value:h}of Ke(o,t,1/0)){const v=u-s,g=v*i+a+v*n;r.push({index:u,offset:g,size:h}),s=u,a=g,i=h}return{lastIndex:s,lastOffset:a,lastSize:i,offsetTree:r}}function Vn(e){return{index:e.index,value:e}}function Gn(e){const{endIndex:t,size:o,startIndex:n}=e;return r=>r.start===n&&(r.end===t||r.end===1/0)&&r.value===o}const $n={offsetHeight:"height",offsetWidth:"width"},Ee=Y(([{log:e},{recalcInProgress:t}])=>{const o=K(),n=K(),r=ve(n,0),s=K(),i=K(),a=S(0),l=S([]),u=S(void 0),h=S(void 0),v=S(void 0),g=S(void 0),p=S((c,b)=>Me(c,$n[b])),T=S(void 0),y=S(0),x=On(),m=ve(I(o,$(l,e,y),ze(_n,x),te()),x),f=ve(I(l,te(),ze((c,b)=>({current:b,prev:c.current}),{current:[],prev:[]}),H(({prev:c})=>c)),[]);N(I(l,P(c=>c.length>0),$(m,y),H(([c,b,k])=>{const B=c.reduce((E,F,V)=>Te(E,F,st(F,b.offsetTree,k)||V),Ue());return{...b,groupIndices:c,groupOffsetTree:B}})),m),N(I(n,$(m),P(([c,{lastIndex:b}])=>c<b),H(([c,{lastIndex:b,lastSize:k}])=>[{endIndex:b,size:k,startIndex:c}])),o),N(u,h);const w=ve(I(u,H(c=>c===void 0)),!0);N(I(h,P(c=>c!==void 0&&Z(se(m).sizeTree)),H(c=>{const b=se(v),k=se(l).length>0;return b!==void 0&&b!==0?k?[{endIndex:0,size:b,startIndex:0},{endIndex:1,size:c,startIndex:1}]:[]:[{endIndex:0,size:c,startIndex:0}]})),o),N(I(g,P(c=>c!==void 0&&c.length>0&&Z(se(m).sizeTree)),H(c=>{const b=[];let k=c[0],B=0;for(let E=1;E<c.length;E++){const F=c[E];F!==k&&(b.push({endIndex:E-1,size:k,startIndex:B}),k=F,B=E)}return b.push({endIndex:c.length-1,size:k,startIndex:B}),b})),o),N(I(l,$(v,h),P(([,c,b])=>c!==void 0&&b!==void 0),H(([c,b,k])=>{const B=[];for(let E=0;E<c.length;E++){const F=c[E],V=c[E+1];B.push({startIndex:F,endIndex:F,size:b}),V!==void 0&&B.push({startIndex:F+1,endIndex:V-1,size:k})}return B})),o);const z=Ie(I(o,$(m),ze(({sizes:c},[b,k])=>({changed:k!==c,sizes:k}),{changed:!1,sizes:x}),H(c=>c.changed)));Q(I(a,ze((c,b)=>({diff:c.prev-b,prev:b}),{diff:0,prev:0}),H(c=>c.diff)),c=>{const{groupIndices:b}=se(m);if(c>0)G(t,!0),G(s,c+ho(c,b));else if(c<0){const k=se(f);k.length>0&&(c-=ho(-c,k)),G(i,c)}}),Q(I(a,$(e)),([c,b])=>{c<0&&b("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:a},he.ERROR)});const R=Ie(s);N(I(s,$(m),H(([c,b])=>{const k=b.groupIndices.length>0,B=[],E=b.lastSize;if(k){const F=nt(b.sizeTree,0);let V=0,D=0;for(;V<c;){const C=b.groupIndices[D],O=b.groupIndices.length===D+1?1/0:b.groupIndices[D+1]-C-1;B.push({endIndex:C,size:F,startIndex:C}),B.push({endIndex:C+1+O-1,size:E,startIndex:C+1}),D++,V+=O+1}const U=Pe(b.sizeTree);return V!==c&&U.shift(),U.reduce((C,{k:O,v:q})=>{let pe=C.ranges;return C.prevSize!==0&&(pe=[...C.ranges,{endIndex:O+c-1,size:C.prevSize,startIndex:C.prevIndex}]),{prevIndex:O+c,prevSize:q,ranges:pe}},{prevIndex:c,prevSize:0,ranges:B}).ranges}return Pe(b.sizeTree).reduce((F,{k:V,v:D})=>({prevIndex:V+c,prevSize:D,ranges:[...F.ranges,{endIndex:V+c-1,size:F.prevSize,startIndex:F.prevIndex}]}),{prevIndex:0,prevSize:E,ranges:[]}).ranges})),o);const A=Ie(I(i,$(m,y),H(([c,{offsetTree:b},k])=>{const B=-c;return st(B,b,k)})));return N(I(i,$(m,y),H(([c,b,k])=>{if(b.groupIndices.length>0){if(Z(b.sizeTree))return b;let E=Ue();const F=se(f);let V=0,D=0,U=0;for(;V<-c;){U=F[D];const C=F[D+1]-U-1;D++,V+=C+1}if(E=Pe(b.sizeTree).reduce((C,{k:O,v:q})=>Te(C,Math.max(0,O+c),q),E),V!==-c){const C=nt(b.sizeTree,U);E=Te(E,0,C);const O=Re(b.sizeTree,-c+1)[1];E=Te(E,1,O)}return{...b,sizeTree:E,...Wt(b.offsetTree,0,E,k)}}const B=Pe(b.sizeTree).reduce((E,{k:F,v:V})=>Te(E,Math.max(0,F+c),V),Ue());return{...b,sizeTree:B,...Wt(b.offsetTree,0,B,k)}})),m),{beforeUnshiftWith:R,data:T,defaultItemSize:h,firstItemIndex:a,fixedItemSize:u,fixedGroupSize:v,gap:y,groupIndices:l,heightEstimates:g,itemSize:p,listRefresh:z,shiftWith:i,shiftWithOffset:A,sizeRanges:o,sizes:m,statefulTotalCount:r,totalCount:n,trackItemSizes:w,unshiftWith:s}},oe(Ae,Gt),{singleton:!0});function Un(e){return e.reduce((t,o)=>(t.groupIndices.push(t.totalCount),t.totalCount+=o+1,t),{groupIndices:[],totalCount:0})}const Vo=Y(([{groupIndices:e,sizes:t,totalCount:o},{headerHeight:n,scrollTop:r}])=>{const s=K(),i=K(),a=Ie(I(s,H(Un)));return N(I(a,H(l=>l.totalCount)),o),N(I(a,H(l=>l.groupIndices)),e),N(I(ue(r,t,n),P(([l,u])=>St(u)),H(([l,u,h])=>Re(u.groupOffsetTree,Math.max(l-h,0),"v")[0]),te(),H(l=>[l])),i),{groupCounts:s,topItemsIndexes:i}},oe(Ee,be)),De=Y(([{log:e}])=>{const t=S(!1),o=Ie(I(t,P(n=>n),te()));return Q(t,n=>{n&&se(e)("props updated",{},he.DEBUG)}),{didMount:o,propsReady:t}},oe(Ae),{singleton:!0}),Kn=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function Go(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!Kn)&&(t.behavior="auto"),t.offset===void 0&&(t.offset=0),t}const ct=Y(([{gap:e,listRefresh:t,sizes:o,totalCount:n},{fixedFooterHeight:r,fixedHeaderHeight:s,footerHeight:i,headerHeight:a,scrollingInProgress:l,scrollTo:u,smoothScrollTargetReached:h,viewportHeight:v},{log:g}])=>{const p=K(),T=K(),y=S(0);let x=null,m=null,f=null;function w(){x!==null&&(x(),x=null),f!==null&&(f(),f=null),m&&(clearTimeout(m),m=null),G(l,!1)}return N(I(p,$(o,v,n,y,a,i,g),$(e,s,r),H(([[z,R,A,c,b,k,B,E],F,V,D])=>{const U=Go(z),{align:C,behavior:O,offset:q}=U,pe=c-1,le=Fo(U,R,pe);let Ce=st(le,R.offsetTree,F)+k;C==="end"?(Ce+=V+Re(R.sizeTree,le)[1]-A+D,le===pe&&(Ce+=B)):C==="center"?Ce+=(V+Re(R.sizeTree,le)[1]-A+D)/2:Ce-=b,q!==void 0&&q!==0&&(Ce+=q);const Le=ge=>{w(),ge?(E("retrying to scroll to",{location:z},he.DEBUG),G(p,z)):(G(T,!0),E("list did not change, scroll successful",{},he.DEBUG))};if(w(),O==="smooth"){let ge=!1;f=Q(t,Ge=>{ge=ge||Ge}),x=ke(h,()=>{Le(ge)})}else x=ke(I(t,Yn(150)),Le);return m=setTimeout(()=>{w()},1200),G(l,!0),E("scrolling from index to",{behavior:O,index:le,top:Ce},he.DEBUG),{behavior:O,top:Ce}})),u),{scrollTargetReached:T,scrollToIndex:p,topListHeight:y}},oe(Ee,be,Ae),{singleton:!0});function Yn(e){return t=>{const o=setTimeout(()=>{t(!1)},e);return n=>{n&&(t(!0),clearTimeout(o))}}}function Ut(e,t){e===0?t():requestAnimationFrame(()=>{Ut(e-1,t)})}function Kt(e,t){const o=t-1;return typeof e=="number"?e:e.index==="LAST"?o:e.index}const ut=Y(([{defaultItemSize:e,listRefresh:t,sizes:o},{scrollTop:n},{scrollTargetReached:r,scrollToIndex:s},{didMount:i}])=>{const a=S(!0),l=S(0),u=S(!0);return N(I(i,$(l),P(([h,v])=>v!==0),He(!1)),a),N(I(i,$(l),P(([h,v])=>v!==0),He(!1)),u),Q(I(ue(t,i),$(a,o,e,u),P(([[,h],v,{sizeTree:g},p,T])=>h&&(!Z(g)||_t(p))&&!v&&!T),$(l)),([,h])=>{ke(r,()=>{G(u,!0)}),Ut(4,()=>{ke(n,()=>{G(a,!0)}),G(s,h)})}),{initialItemFinalLocationReached:u,initialTopMostItemIndex:l,scrolledToInitialItem:a}},oe(Ee,be,ct,De),{singleton:!0});function $o(e,t){return Math.abs(e-t)<1.01}const it="up",qe="down",Xn="none",Qn={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},Zn=0,dt=Y(([{footerHeight:e,headerHeight:t,scrollBy:o,scrollContainerState:n,scrollTop:r,viewportHeight:s}])=>{const i=S(!1),a=S(!0),l=K(),u=K(),h=S(4),v=S(Zn),g=ve(I(Mt(I(W(r),_e(1),He(!0)),I(W(r),_e(1),He(!1),uo(100))),te()),!1),p=ve(I(Mt(I(o,He(!0)),I(o,He(!1),uo(200))),te()),!1);N(I(ue(W(r),W(v)),H(([f,w])=>f<=w),te()),a),N(I(a,Be(50)),u);const T=Ie(I(ue(n,W(s),W(t),W(e),W(h)),ze((f,[{scrollHeight:w,scrollTop:z},R,A,c,b])=>{const k=z+R-w>-b,B={scrollHeight:w,scrollTop:z,viewportHeight:R};if(k){let F,V;return z>f.state.scrollTop?(F="SCROLLED_DOWN",V=f.state.scrollTop-z):(F="SIZE_DECREASED",V=f.state.scrollTop-z||f.scrollTopDelta),{atBottom:!0,atBottomBecause:F,scrollTopDelta:V,state:B}}let E;return B.scrollHeight>f.state.scrollHeight?E="SIZE_INCREASED":R<f.state.viewportHeight?E="VIEWPORT_HEIGHT_DECREASING":z<f.state.scrollTop?E="SCROLLING_UPWARDS":E="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:E,state:B}},Qn),te((f,w)=>f!==void 0&&f.atBottom===w.atBottom))),y=ve(I(n,ze((f,{scrollHeight:w,scrollTop:z,viewportHeight:R})=>{if(!$o(f.scrollHeight,w)){const A=w-(z+R)<1;return f.scrollTop!==z&&A?{changed:!0,jump:f.scrollTop-z,scrollHeight:w,scrollTop:z}:{changed:!0,jump:0,scrollHeight:w,scrollTop:z}}return{changed:!1,jump:0,scrollHeight:w,scrollTop:z}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),P(f=>f.changed),H(f=>f.jump)),0);N(I(T,H(f=>f.atBottom)),i),N(I(i,Be(50)),l);const x=S(qe);N(I(n,H(({scrollTop:f})=>f),te(),ze((f,w)=>se(p)?{direction:f.direction,prevScrollTop:w}:{direction:w<f.prevScrollTop?it:qe,prevScrollTop:w},{direction:qe,prevScrollTop:0}),H(f=>f.direction)),x),N(I(n,Be(50),He(Xn)),x);const m=S(0);return N(I(g,P(f=>!f),He(0)),m),N(I(r,Be(100),$(g),P(([f,w])=>w),ze(([f,w],[z])=>[w,z],[0,0]),H(([f,w])=>w-f)),m),{atBottomState:T,atBottomStateChange:l,atBottomThreshold:h,atTopStateChange:u,atTopThreshold:v,isAtBottom:i,isAtTop:a,isScrolling:g,lastJumpDueToItemResize:y,scrollDirection:x,scrollVelocity:m}},oe(be)),lt="top",at="bottom",po="none";function go(e,t,o){return typeof e=="number"?o===it&&t===lt||o===qe&&t===at?e:0:o===it?t===lt?e.main:e.reverse:t===at?e.main:e.reverse}function xo(e,t){return typeof e=="number"?e:e[t]??0}const Yt=Y(([{deviation:e,fixedHeaderHeight:t,headerHeight:o,scrollTop:n,viewportHeight:r}])=>{const s=K(),i=S(0),a=S(0),l=S(0),u=ve(I(ue(W(n),W(r),W(o),W(s,rt),W(l),W(i),W(t),W(e),W(a)),H(([h,v,g,[p,T],y,x,m,f,w])=>{const z=h-f,R=x+m,A=Math.max(g-z,0);let c=po;const b=xo(w,lt),k=xo(w,at);return p-=f,p+=g+m,T+=g+m,T-=f,p>h+R-b&&(c=it),T<h-A+v+k&&(c=qe),c!==po?[Math.max(z-g-go(y,lt,c)-b,0),z-A-m+v+go(y,at,c)+k]:null}),P(h=>h!==null),te(rt)),[0,0]);return{increaseViewportBy:a,listBoundary:s,overscan:l,topListHeight:i,visibleRange:u}},oe(be),{singleton:!0});function Jn(e,t,o){if(St(t)){const n=_o(e,t);return[{index:Re(t.groupOffsetTree,n)[0],offset:0,size:0},{data:o==null?void 0:o[0],index:n,offset:0,size:0}]}return[{data:o==null?void 0:o[0],index:e,offset:0,size:0}]}const zt={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function yt(e,t,o,n,r,s){const{lastIndex:i,lastOffset:a,lastSize:l}=r;let u=0,h=0;if(e.length>0){u=e[0].offset;const y=e[e.length-1];h=y.offset+y.size}const v=o-i,g=a+v*l+(v-1)*n,p=u,T=g-h;return{bottom:h,firstItemIndex:s,items:vo(e,r,s),offsetBottom:T,offsetTop:u,top:p,topItems:vo(t,r,s),topListHeight:t.reduce((y,x)=>x.size+y,0),totalCount:o}}function Uo(e,t,o,n,r,s){let i=0;if(o.groupIndices.length>0)for(const h of o.groupIndices){if(h-i>=e)break;i++}const a=e+i,l=Kt(t,a),u=Array.from({length:a}).map((h,v)=>({data:s[v+l],index:v+l,offset:0,size:0}));return yt(u,[],a,r,o,n)}function vo(e,t,o){if(e.length===0)return[];if(!St(t))return e.map(u=>({...u,index:u.index+o,originalIndex:u.index}));const n=e[0].index,r=e[e.length-1].index,s=[],i=Ke(t.groupOffsetTree,n,r);let a,l=0;for(const u of e){(!a||a.end<u.index)&&(a=i.shift(),l=t.groupIndices.indexOf(a.start));let h;u.index===a.start?h={index:l,type:"group"}:h={groupIndex:l,index:u.index-(l+1)+o},s.push({...h,data:u.data,offset:u.offset,originalIndex:u.index,size:u.size})}return s}function yo(e,t){return e===void 0?0:typeof e=="number"?e:e[t]??0}const Ve=Y(([{data:e,firstItemIndex:t,gap:o,sizes:n,totalCount:r},s,{listBoundary:i,topListHeight:a,visibleRange:l},{initialTopMostItemIndex:u,scrolledToInitialItem:h},{topListHeight:v},g,{didMount:p},{recalcInProgress:T}])=>{const y=S([]),x=S(0),m=K(),f=S(0);N(s.topItemsIndexes,y);const w=ve(I(ue(p,T,W(l,rt),W(r),W(n),W(u),h,W(y),W(t),W(o),W(f),e),P(([c,b,,k,,,,,,,,B])=>{const E=B!==void 0&&B.length!==k;return c&&!b&&!E}),H(([,,[c,b],k,B,E,F,V,D,U,C,O])=>{var X,de;const q=B,{offsetTree:pe,sizeTree:le}=q,Ce=se(x);if(k===0)return{...zt,totalCount:k};if(c===0&&b===0)return Ce===0?{...zt,totalCount:k}:Uo(Ce,E,B,D,U,O||[]);if(Z(le))return Ce>0?null:yt(Jn(Kt(E,k),q,O),[],k,U,q,D);const Le=[];if(V.length>0){const ee=V[0],ne=V[V.length-1];let fe=0;for(const ae of Ke(le,ee,ne)){const J=ae.value,ie=Math.max(ae.start,ee),ye=Math.min(ae.end,ne);for(let ce=ie;ce<=ye;ce++)Le.push({data:O==null?void 0:O[ce],index:ce,offset:fe,size:J}),fe+=J}}if(!F)return yt([],Le,k,U,q,D);const ge=V.length>0?V[V.length-1]+1:0,Ge=Pn(pe,c,b,ge);if(Ge.length===0)return null;const Qe=k-1,je=wt([],ee=>{for(const ne of Ge){const fe=ne.value;let ae=fe.offset,J=ne.start;const ie=fe.size;if(fe.offset<c){J+=Math.floor((c-fe.offset+U)/(ie+U));const ce=J-ne.start;ae+=ce*ie+ce*U}J<ge&&(ae+=(ge-J)*ie,J=ge);const ye=Math.min(ne.end,Qe);for(let ce=J;ce<=ye&&!(ae>=b);ce++)ee.push({data:O==null?void 0:O[ce],index:ce,offset:ae,size:ie}),ae+=ie+U}}),Ze=yo(C,lt),j=yo(C,at);if(je.length>0&&(Ze>0||j>0)){const ee=je[0],ne=je[je.length-1];if(Ze>0&&ee.index>ge){const fe=Math.min(Ze,ee.index-ge),ae=[];let J=ee.offset;for(let ie=ee.index-1;ie>=ee.index-fe;ie--){const ye=((X=Ke(le,ie,ie)[0])==null?void 0:X.value)??ee.size;J-=ye+U,ae.unshift({data:O==null?void 0:O[ie],index:ie,offset:J,size:ye})}je.unshift(...ae)}if(j>0&&ne.index<Qe){const fe=Math.min(j,Qe-ne.index);let ae=ne.offset+ne.size+U;for(let J=ne.index+1;J<=ne.index+fe;J++){const ie=((de=Ke(le,J,J)[0])==null?void 0:de.value)??ne.size;je.push({data:O==null?void 0:O[J],index:J,offset:ae,size:ie}),ae+=ie+U}}}return yt(je,Le,k,U,q,D)}),P(c=>c!==null),te()),zt);N(I(e,P(_t),H(c=>c==null?void 0:c.length)),r),N(I(w,H(c=>c.topListHeight)),v),N(v,a),N(I(w,H(c=>[c.top,c.bottom])),i),N(I(w,H(c=>c.items)),m);const z=Ie(I(w,P(({items:c})=>c.length>0),$(r,e),P(([{items:c},b])=>c[c.length-1].originalIndex===b-1),H(([,c,b])=>[c-1,b]),te(rt),H(([c])=>c))),R=Ie(I(w,Be(200),P(({items:c,topItems:b})=>c.length>0&&c[0].originalIndex===b.length),H(({items:c})=>c[0].index),te())),A=Ie(I(w,P(({items:c})=>c.length>0),H(({items:c})=>{let b=0,k=c.length-1;for(;c[b].type==="group"&&b<k;)b++;for(;c[k].type==="group"&&k>b;)k--;return{endIndex:c[k].index,startIndex:c[b].index}}),te(Wo)));return{endReached:z,initialItemCount:x,itemsRendered:m,listState:w,minOverscanItemCount:f,rangeChanged:A,startReached:R,topItemsIndexes:y,...g}},oe(Ee,Vo,Yt,ut,ct,dt,De,Gt),{singleton:!0}),Ko=Y(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:o,headerHeight:n},{listState:r}])=>{const s=K(),i=ve(I(ue(o,e,n,t,r),H(([a,l,u,h,v])=>a+l+u+h+v.offsetBottom+v.bottom)),0);return N(W(i),s),{totalListHeight:i,totalListHeightChanged:s}},oe(be,Ve),{singleton:!0}),qn=Y(([{viewportHeight:e},{totalListHeight:t}])=>{const o=S(!1),n=ve(I(ue(o,e,t),P(([r])=>r),H(([,r,s])=>Math.max(0,r-s)),Be(0),te()),0);return{alignToBottom:o,paddingTopAddition:n}},oe(be,Ko),{singleton:!0}),Yo=Y(()=>({context:S(null)})),er=({itemBottom:e,itemTop:t,locationParams:{align:o,behavior:n,...r},viewportBottom:s,viewportTop:i})=>t<i?{...r,align:o??"start",...n!==void 0?{behavior:n}:{}}:e>s?{...r,align:o??"end",...n!==void 0?{behavior:n}:{}}:null,Xo=Y(([{gap:e,sizes:t,totalCount:o},{fixedFooterHeight:n,fixedHeaderHeight:r,headerHeight:s,scrollingInProgress:i,scrollTop:a,viewportHeight:l},{scrollToIndex:u}])=>{const h=K();return N(I(h,$(t,l,o,s,r,n,a),$(e),H(([[v,g,p,T,y,x,m,f],w])=>{const{calculateViewLocation:z=er,done:R,...A}=v,c=Fo(v,g,T-1),b=st(c,g.offsetTree,w)+y+x,k=b+Re(g.sizeTree,c)[1],B=f+x,E=f+p-m,F=z({itemBottom:k,itemTop:b,locationParams:A,viewportBottom:E,viewportTop:B});return F!==null?R&&ke(I(i,P(V=>!V),_e(se(i)?1:2)),R):R==null||R(),F}),P(v=>v!==null)),u),{scrollIntoView:h}},oe(Ee,be,ct,Ve,Ae),{singleton:!0});function bo(e){return e===!1?!1:e==="smooth"?"smooth":"auto"}const tr=(e,t)=>typeof e=="function"?bo(e(t)):t&&bo(e),or=Y(([{listRefresh:e,totalCount:t,fixedItemSize:o,data:n},{atBottomState:r,isAtBottom:s},{scrollToIndex:i},{scrolledToInitialItem:a},{didMount:l,propsReady:u},{log:h},{scrollingInProgress:v},{context:g},{scrollIntoView:p}])=>{const T=S(!1),y=K();let x=null;function m(R){G(i,{align:"end",behavior:R,index:"LAST"})}Q(I(ue(I(W(t),_e(1)),l),$(W(T),s,a,v),H(([[R,A],c,b,k,B])=>{let E=A&&k,F="auto";return E&&(F=tr(c,b||B),E=E&&F!==!1),{followOutputBehavior:F,shouldFollow:E,totalCount:R}}),P(({shouldFollow:R})=>R)),({followOutputBehavior:R,totalCount:A})=>{x!==null&&(x(),x=null),se(o)!==void 0?requestAnimationFrame(()=>{se(h)("following output to ",{totalCount:A},he.DEBUG),m(R)}):x=ke(e,()=>{se(h)("following output to ",{totalCount:A},he.DEBUG),m(R),x=null})});function f(R){const A=ke(r,c=>{R&&!c.atBottom&&c.notAtBottomBecause==="SIZE_INCREASED"&&x===null&&(se(h)("scrolling to bottom due to increased size",{},he.DEBUG),m("auto"))});setTimeout(A,100)}Q(I(ue(W(T),t,u),P(([R,,A])=>R!==!1&&A),ze(({value:R},[,A])=>({refreshed:R===A,value:A}),{refreshed:!1,value:0}),P(({refreshed:R})=>R),$(T,t)),([,R])=>{se(a)&&f(R!==!1)}),Q(y,()=>{f(se(T)!==!1)}),Q(ue(W(T),r),([R,A])=>{R!==!1&&!A.atBottom&&A.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&m("auto")});const w=S(null),z=K();return N(Mt(I(W(n),H(R=>(R==null?void 0:R.length)??0)),I(W(t))),z),Q(I(ue(I(z,_e(1)),l),$(W(w),a,v,g),H(([[R,A],c,b,k,B])=>A&&b&&(c==null?void 0:c({context:B,totalCount:R,scrollingInProgress:k}))),P(R=>!!R),Be(0)),R=>{x!==null&&(x(),x=null),se(o)!==void 0?requestAnimationFrame(()=>{se(h)("scrolling into view",{}),G(p,R)}):x=ke(e,()=>{se(h)("scrolling into view",{}),G(p,R),x=null})}),{autoscrollToBottom:y,followOutput:T,scrollIntoViewOnChange:w}},oe(Ee,dt,ct,ut,De,Ae,be,Yo,Xo)),nr=Y(([{data:e,firstItemIndex:t,gap:o,sizes:n},{initialTopMostItemIndex:r},{initialItemCount:s,listState:i},{didMount:a}])=>(N(I(a,$(s),P(([,l])=>l!==0),$(r,n,t,o,e),H(([[,l],u,h,v,g,p=[]])=>Uo(l,u,h,v,g,p))),i),{}),oe(Ee,ut,Ve,De),{singleton:!0}),rr=Y(([{didMount:e},{scrollTo:t},{listState:o}])=>{const n=S(0);return Q(I(e,$(n),P(([,r])=>r!==0),H(([,r])=>({top:r}))),r=>{ke(I(o,_e(1),P(s=>s.items.length>1)),()=>{requestAnimationFrame(()=>{G(t,r)})})}),{initialScrollTop:n}},oe(De,be,Ve),{singleton:!0}),Qo=Y(([{scrollVelocity:e}])=>{const t=S(!1),o=K(),n=S(!1);return N(I(e,$(n,t,o),P(([r,s])=>s!==!1&&s!==void 0),H(([r,s,i,a])=>{const{enter:l,exit:u}=s;if(i){if(u(r,a))return!1}else if(l(r,a))return!0;return i}),te()),t),Q(I(ue(t,e,o),$(n)),([[r,s,i],a])=>{r&&a!==!1&&a!==void 0&&a.change&&a.change(s,i)}),{isSeeking:t,scrollSeekConfiguration:n,scrollSeekRangeChanged:o,scrollVelocity:e}},oe(dt),{singleton:!0}),Xt=Y(([{scrollContainerState:e,scrollTo:t}])=>{const o=K(),n=K(),r=K(),s=S(!1),i=S(void 0);return N(I(ue(o,n),H(([{scrollTop:a,viewportHeight:l},{offsetTop:u,listHeight:h}])=>({scrollHeight:h,scrollTop:Math.max(0,a-u),viewportHeight:l}))),e),N(I(t,$(n),H(([a,{offsetTop:l}])=>({...a,top:a.top+l}))),r),{customScrollParent:i,useWindowScroll:s,windowScrollContainerState:o,windowScrollTo:r,windowViewportRect:n}},oe(be)),sr=Y(([{sizeRanges:e,sizes:t},{headerHeight:o,scrollTop:n},{initialTopMostItemIndex:r},{didMount:s},{useWindowScroll:i,windowScrollContainerState:a,windowViewportRect:l}])=>{const u=K(),h=S(void 0),v=S(null),g=S(null);return N(a,v),N(l,g),Q(I(u,$(t,n,i,v,g,o)),([p,T,y,x,m,f,w])=>{const z=Fn(T.sizeTree);x&&m!==null&&f!==null&&(y=m.scrollTop-f.offsetTop),y-=w,p({ranges:z,scrollTop:y})}),N(I(h,P(_t),H(ir)),r),N(I(s,$(h),P(([,p])=>p!==void 0),te(),H(([,p])=>p.ranges)),e),{getState:u,restoreStateFrom:h}},oe(Ee,be,ut,De,Xt));function ir(e){return{align:"start",index:0,offset:e.scrollTop}}const lr=Y(([{topItemsIndexes:e}])=>{const t=S(0);return N(I(t,P(o=>o>=0),H(o=>Array.from({length:o}).map((n,r)=>r))),e),{topItemCount:t}},oe(Ve));function Zo(e){let t=!1,o;return(()=>(t||(t=!0,o=e()),o))}const ar=Zo(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),cr=Y(([{deviation:e,scrollBy:t,scrollingInProgress:o,scrollTop:n},{isAtBottom:r,isScrolling:s,lastJumpDueToItemResize:i,scrollDirection:a},{listState:l},{beforeUnshiftWith:u,gap:h,shiftWithOffset:v,sizes:g},{log:p},{recalcInProgress:T}])=>{const y=Ie(I(l,$(i),ze(([,m,f,w],[{bottom:z,items:R,offsetBottom:A,totalCount:c},b])=>{const k=z+A;let B=0;return f===c&&m.length>0&&R.length>0&&(R[0].originalIndex===0&&m[0].originalIndex===0||(B=k-w,B!==0&&(B+=b))),[B,R,c,k]},[0,[],0,0]),P(([m])=>m!==0),$(n,a,o,r,p,T),P(([,m,f,w,,,z])=>!z&&!w&&m!==0&&f===it),H(([[m],,,,,f])=>(f("Upward scrolling compensation",{amount:m},he.DEBUG),m))));function x(m){m>0?(G(t,{behavior:"auto",top:-m}),G(e,0)):(G(e,0),G(t,{behavior:"auto",top:-m}))}return Q(I(y,$(e,s)),([m,f,w])=>{w&&ar()?G(e,f-m):x(-m)}),Q(I(ue(ve(s,!1),e,T),P(([m,f,w])=>!m&&!w&&f!==0),H(([m,f])=>f),Be(1)),x),N(I(v,H(m=>({top:-m}))),t),Q(I(u,$(g,h),H(([m,{groupIndices:f,lastSize:w,sizeTree:z},R])=>{function A(E){return E*(w+R)}if(f.length===0)return A(m);let c=0;const b=nt(z,0);let k=0,B=0;for(;k<m;){k++,c+=b;let E=f.length===B+1?1/0:f[B+1]-f[B]-1;k+E>m&&(c-=b,E=m-k+1),k+=E,c+=A(E),B++}return c})),m=>{G(e,m),requestAnimationFrame(()=>{G(t,{top:m}),requestAnimationFrame(()=>{G(e,0),G(T,!1)})})}),{deviation:e}},oe(be,dt,Ve,Ee,Ae,Gt)),ur=Y(([e,t,o,n,r,s,i,a,l,u,h])=>({...e,...t,...o,...n,...r,...s,...i,...a,...l,...u,...h}),oe(Yt,nr,De,Qo,Ko,rr,qn,Xt,Xo,Ae,Yo)),Jo=Y(([{data:e,defaultItemSize:t,firstItemIndex:o,fixedItemSize:n,fixedGroupSize:r,gap:s,groupIndices:i,heightEstimates:a,itemSize:l,sizeRanges:u,sizes:h,statefulTotalCount:v,totalCount:g,trackItemSizes:p},{initialItemFinalLocationReached:T,initialTopMostItemIndex:y,scrolledToInitialItem:x},m,f,w,z,{scrollToIndex:R},A,{topItemCount:c},{groupCounts:b},k])=>{const{listState:B,minOverscanItemCount:E,topItemsIndexes:F,rangeChanged:V,...D}=z;return N(V,k.scrollSeekRangeChanged),N(I(k.windowViewportRect,H(U=>U.visibleHeight)),m.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:o,fixedItemHeight:n,fixedGroupHeight:r,gap:s,groupCounts:b,heightEstimates:a,initialItemFinalLocationReached:T,initialTopMostItemIndex:y,scrolledToInitialItem:x,sizeRanges:u,topItemCount:c,topItemsIndexes:F,totalCount:g,...w,groupIndices:i,itemSize:l,listState:B,minOverscanItemCount:E,scrollToIndex:R,statefulTotalCount:v,trackItemSizes:p,rangeChanged:V,...D,...k,...m,sizes:h,...f}},oe(Ee,ut,be,sr,or,Ve,ct,cr,lr,Vo,ur));function dr(e,t){const o={},n={};let r=0;const s=e.length;for(;r<s;)n[e[r]]=1,r+=1;for(const i in t)Object.hasOwn(n,i)||(o[i]=t[i]);return o}const ht=typeof document<"u"?L.useLayoutEffect:L.useEffect;function qo(e,t,o){const n=Object.keys(t.required||{}),r=Object.keys(t.optional||{}),s=Object.keys(t.methods||{}),i=Object.keys(t.events||{}),a=L.createContext({});function l(x,m){x.propsReady!==void 0&&G(x.propsReady,!1);for(const f of n){const w=x[t.required[f]];G(w,m[f])}for(const f of r)if(f in m){const w=x[t.optional[f]];G(w,m[f])}x.propsReady!==void 0&&G(x.propsReady,!0)}function u(x){return s.reduce((m,f)=>(m[f]=w=>{const z=x[t.methods[f]];G(z,w)},m),{})}function h(x){return i.reduce((m,f)=>(m[f]=Rn(x[t.events[f]]),m),{})}const v=L.forwardRef(function(x,m){const{children:f,...w}=x,[z]=L.useState(()=>wt(Hn(e),c=>{l(c,w)})),[R]=L.useState(co(h,z));ht(()=>{for(const c of i)c in w&&Q(R[c],w[c]);return()=>{Object.values(R).map(Ft)}},[w,R,z]),ht(()=>{l(z,w)}),L.useImperativeHandle(m,ao(u(z)));const A=o;return d.jsx(a.Provider,{value:z,children:o!==void 0?d.jsx(A,{...dr([...n,...r,...i],w),children:f}):f})}),g=x=>{const m=L.useContext(a);return L.useCallback(f=>{G(m[x],f)},[m,x])},p=x=>{const m=L.useContext(a)[x],f=L.useCallback(w=>Q(m,w),[m]);return L.useSyncExternalStore(f,()=>se(m),()=>se(m))},T=x=>{const m=L.useContext(a)[x],[f,w]=L.useState(co(se,m));return ht(()=>Q(m,z=>{z!==f&&w(ao(z))}),[m,f]),f},y=L.version.startsWith("18")?p:T;return{Component:v,useEmitter:(x,m)=>{const f=L.useContext(a)[x];ht(()=>Q(f,m),[m,f])},useEmitterValue:y,usePublisher:g}}const en=L.createContext(void 0),tn=L.createContext(void 0),Et="-webkit-sticky",Co="sticky",Qt=Zo(()=>{if(typeof document>"u")return Co;const e=document.createElement("div");return e.style.position=Et,e.style.position===Et?Et:Co}),on=typeof document<"u"?L.useLayoutEffect:L.useEffect;function Bt(e){return"self"in e}function fr(e){return"body"in e}function nn(e,t,o,n=Xe,r,s){const i=L.useRef(null),a=L.useRef(null),l=L.useRef(null),u=L.useCallback(g=>{let p,T,y;const x=g.target;if(fr(x)||Bt(x)){const f=Bt(x)?x:x.defaultView;y=s===!0?f.scrollX:f.scrollY,p=s===!0?f.document.documentElement.scrollWidth:f.document.documentElement.scrollHeight,T=s===!0?f.innerWidth:f.innerHeight}else y=s===!0?x.scrollLeft:x.scrollTop,p=s===!0?x.scrollWidth:x.scrollHeight,T=s===!0?x.offsetWidth:x.offsetHeight;const m=()=>{e({scrollHeight:p,scrollTop:Math.max(y,0),viewportHeight:T})};g.suppressFlushSync===!0?m():fn.flushSync(m),a.current!==null&&(y===a.current||y<=0||y===p-T)&&(a.current=null,t(!0),l.current&&(clearTimeout(l.current),l.current=null))},[e,t,s]);L.useEffect(()=>{const g=r||i.current;return n(r||i.current),u({suppressFlushSync:!0,target:g}),g.addEventListener("scroll",u,{passive:!0}),()=>{n(null),g.removeEventListener("scroll",u)}},[i,u,o,n,r]);function h(g){const p=i.current;if(!p||(s===!0?"offsetWidth"in p&&p.offsetWidth===0:"offsetHeight"in p&&p.offsetHeight===0))return;const T=g.behavior==="smooth";let y,x,m;Bt(p)?(x=Math.max(Me(p.document.documentElement,s===!0?"width":"height"),s===!0?p.document.documentElement.scrollWidth:p.document.documentElement.scrollHeight),y=s===!0?p.innerWidth:p.innerHeight,m=s===!0?window.scrollX:window.scrollY):(x=p[s===!0?"scrollWidth":"scrollHeight"],y=Me(p,s===!0?"width":"height"),m=p[s===!0?"scrollLeft":"scrollTop"]);const f=x-y;if(g.top=Math.ceil(Math.max(Math.min(f,g.top),0)),$o(y,x)||g.top===m){e({scrollHeight:x,scrollTop:m,viewportHeight:y}),T&&t(!0);return}T?(a.current=g.top,l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{l.current=null,a.current=null,t(!0)},1e3)):a.current=null,s===!0&&(g={...g.behavior!==void 0?{behavior:g.behavior}:{},left:g.top}),p.scrollTo(g)}function v(g){s===!0&&(g={...g.behavior!==void 0?{behavior:g.behavior}:{},...g.top!==void 0?{left:g.top}:{}}),i.current.scrollBy(g)}return{scrollByCallback:v,scrollerRef:i,scrollToCallback:h}}function Zt(e){return e}const mr=Y(()=>{const e=S(a=>`Item ${a}`),t=S(a=>`Group ${a}`),o=S({}),n=S(Zt),r=S("div"),s=S(Xe),i=(a,l=null)=>ve(I(o,H(u=>u[a]),te()),l);return{components:o,computeItemKey:n,EmptyPlaceholder:i("EmptyPlaceholder"),FooterComponent:i("Footer"),GroupComponent:i("Group","div"),groupContent:t,HeaderComponent:i("Header"),HeaderFooterTag:r,ItemComponent:i("Item","div"),itemContent:e,ListComponent:i("List","div"),ScrollerComponent:i("Scroller","div"),scrollerRef:s,ScrollSeekPlaceholder:i("ScrollSeekPlaceholder"),TopItemListComponent:i("TopItemList")}}),hr=Y(([e,t])=>({...e,...t}),oe(Jo,mr)),pr=({height:e})=>d.jsx("div",{style:{height:e}}),gr={overflowAnchor:"none",position:Qt(),zIndex:1},rn={overflowAnchor:"none"},xr={...rn,display:"inline-block",height:"100%"},To=L.memo(function({showTopList:e=!1}){const t=_("listState"),o=we("sizeRanges"),n=_("useWindowScroll"),r=_("customScrollParent"),s=we("windowScrollContainerState"),i=we("scrollContainerState"),a=r||n?s:i,l=_("itemContent"),u=_("context"),h=_("groupContent"),v=_("trackItemSizes"),g=_("itemSize"),p=_("log"),T=we("gap"),y=_("horizontalDirection"),{callbackRef:x}=Bn(o,g,v,e?Xe:a,p,T,r,y,_("skipAnimationFrameInResizeObserver")),[m,f]=L.useState(0);Jt("deviation",D=>{m!==D&&f(D)});const w=_("EmptyPlaceholder"),z=_("ScrollSeekPlaceholder")??pr,R=_("ListComponent"),A=_("ItemComponent"),c=_("GroupComponent"),b=_("computeItemKey"),k=_("isSeeking"),B=_("groupIndices").length>0,E=_("alignToBottom"),F=_("initialItemFinalLocationReached"),V=e?{}:{boxSizing:"border-box",...y?{display:"inline-block",height:"100%",marginLeft:m!==0?m:E?"auto":0,paddingLeft:t.offsetTop,paddingRight:t.offsetBottom,whiteSpace:"nowrap"}:{marginTop:m!==0?m:E?"auto":0,paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},...F?{}:{visibility:"hidden"}};return!e&&t.totalCount===0&&w!==null&&w!==void 0?d.jsx(w,{...xe(w,u)}):d.jsx(R,{...xe(R,u),"data-testid":e?"virtuoso-top-item-list":"virtuoso-item-list",ref:x,style:V,children:(e?t.topItems:t.items).map(D=>{const U=D.originalIndex,C=b(U+t.firstItemIndex,D.data,u);return k?M.createElement(z,{...xe(z,u),height:D.size,index:D.index,key:C,type:D.type||"item",...D.type==="group"?{}:{groupIndex:D.groupIndex}}):D.type==="group"?M.createElement(c,{...xe(c,u),"data-index":U,"data-item-index":D.index,"data-known-size":D.size,key:C,style:gr},h(D.index,u)):M.createElement(A,{...xe(A,u),...Cr(A,D.data),"data-index":U,"data-item-group-index":D.groupIndex,"data-item-index":D.index,"data-known-size":D.size,key:C,style:y?xr:rn},B?l(D.index,D.groupIndex,D.data,u):l(D.index,D.data,u))})})}),vr={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},yr={outline:"none",overflowX:"auto",position:"relative"},kt=e=>({height:"100%",position:"absolute",top:0,width:"100%",...e?{display:"flex",flexDirection:"column"}:void 0}),br={position:Qt(),top:0,width:"100%",zIndex:1};function xe(e,t){if(typeof e!="string")return{context:t}}function Cr(e,t){return{item:typeof e=="string"?void 0:t}}const Tr=L.memo(function(){const e=_("HeaderComponent"),t=we("headerHeight"),o=_("HeaderFooterTag"),n=Fe(L.useMemo(()=>s=>{t(Me(s,"height"))},[t]),!0,_("skipAnimationFrameInResizeObserver")),r=_("context");return e!=null?d.jsx(o,{ref:n,children:d.jsx(e,{...xe(e,r)})}):null}),Ir=L.memo(function(){const e=_("FooterComponent"),t=we("footerHeight"),o=_("HeaderFooterTag"),n=Fe(L.useMemo(()=>s=>{t(Me(s,"height"))},[t]),!0,_("skipAnimationFrameInResizeObserver")),r=_("context");return e!=null?d.jsx(o,{ref:n,children:d.jsx(e,{...xe(e,r)})}):null});function sn({useEmitter:e,useEmitterValue:t,usePublisher:o}){return L.memo(function({children:n,style:r,context:s,...i}){const a=o("scrollContainerState"),l=t("ScrollerComponent"),u=o("smoothScrollTargetReached"),h=t("scrollerRef"),v=t("horizontalDirection")||!1,{scrollByCallback:g,scrollerRef:p,scrollToCallback:T}=nn(a,u,l,h,void 0,v);return e("scrollTo",T),e("scrollBy",g),d.jsx(l,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:p,style:{...v?yr:vr,...r},tabIndex:0,...i,...xe(l,s),children:n})})}function ln({useEmitter:e,useEmitterValue:t,usePublisher:o}){return L.memo(function({children:n,style:r,context:s,...i}){const a=o("windowScrollContainerState"),l=t("ScrollerComponent"),u=o("smoothScrollTargetReached"),h=t("totalListHeight"),v=t("deviation"),g=t("customScrollParent"),p=L.useRef(null),T=t("scrollerRef"),{scrollByCallback:y,scrollerRef:x,scrollToCallback:m}=nn(a,u,l,T,g);return on(()=>{var f;return x.current=g||((f=p.current)==null?void 0:f.ownerDocument.defaultView),()=>{x.current=null}},[x,g]),e("windowScrollTo",m),e("scrollBy",y),d.jsx(l,{ref:p,"data-virtuoso-scroller":!0,style:{position:"relative",...r,...h!==0?{height:h+v}:void 0},...i,...xe(l,s),children:n})})}const wr=({children:e})=>{const t=L.useContext(en),o=we("viewportHeight"),n=we("fixedItemHeight"),r=_("alignToBottom"),s=_("horizontalDirection"),i=L.useMemo(()=>Eo(o,l=>Me(l,s?"width":"height")),[o,s]),a=Fe(i,!0,_("skipAnimationFrameInResizeObserver"));return L.useEffect(()=>{t&&(o(t.viewportHeight),n(t.itemHeight))},[t,o,n]),d.jsx("div",{"data-viewport-type":"element",ref:a,style:kt(r),children:e})},Sr=({children:e})=>{const t=L.useContext(en),o=we("windowViewportRect"),n=we("fixedItemHeight"),r=_("customScrollParent"),s=Lo(o,r,_("skipAnimationFrameInResizeObserver")),i=_("alignToBottom");return L.useEffect(()=>{t&&(n(t.itemHeight),o({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,o,n]),d.jsx("div",{"data-viewport-type":"window",ref:s,style:kt(i),children:e})},kr=({children:e})=>{const t=_("TopItemListComponent")??"div",o=_("headerHeight"),n={...br,marginTop:`${o}px`},r=_("context");return d.jsx(t,{style:n,...xe(t,r),children:e})},Rr=L.memo(function(e){const t=_("useWindowScroll"),o=_("topItemsIndexes").length>0,n=_("customScrollParent"),r=_("context");return d.jsxs(n||t?zr:Hr,{...e,context:r,children:[o&&d.jsx(kr,{children:d.jsx(To,{showTopList:!0})}),d.jsxs(n||t?Sr:wr,{children:[d.jsx(Tr,{}),d.jsx(To,{}),d.jsx(Ir,{})]})]})}),{Component:jr,useEmitter:Jt,useEmitterValue:_,usePublisher:we}=qo(hr,{optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",scrollIntoViewOnChange:"scrollIntoViewOnChange",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",minOverscanItemCount:"minOverscanItemCount",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedGroupHeight:"fixedGroupHeight",fixedItemHeight:"fixedItemHeight",heightEstimates:"heightEstimates",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"HeaderFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",horizontalDirection:"horizontalDirection",skipAnimationFrameInResizeObserver:"skipAnimationFrameInResizeObserver"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},Rr),Hr=sn({useEmitter:Jt,useEmitterValue:_,usePublisher:we}),zr=ln({useEmitter:Jt,useEmitterValue:_,usePublisher:we}),Er=jr,Br=Y(()=>{const e=S(u=>d.jsxs("td",{children:["Item $",u]})),t=S(null),o=S(u=>d.jsxs("td",{colSpan:1e3,children:["Group ",u]})),n=S(null),r=S(null),s=S({}),i=S(Zt),a=S(Xe),l=(u,h=null)=>ve(I(s,H(v=>v[u]),te()),h);return{components:s,computeItemKey:i,context:t,EmptyPlaceholder:l("EmptyPlaceholder"),FillerRow:l("FillerRow"),fixedFooterContent:r,fixedHeaderContent:n,itemContent:e,groupContent:o,ScrollerComponent:l("Scroller","div"),scrollerRef:a,ScrollSeekPlaceholder:l("ScrollSeekPlaceholder"),TableBodyComponent:l("TableBody","tbody"),TableComponent:l("Table","table"),TableFooterComponent:l("TableFoot","tfoot"),TableHeadComponent:l("TableHead","thead"),TableRowComponent:l("TableRow","tr"),GroupComponent:l("Group","tr")}});oe(Jo,Br);Qt();const Io={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},Lr={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:wo,floor:Tt,max:et,min:Lt,round:So}=Math;function ko(e,t,o){return Array.from({length:t-e+1}).map((n,r)=>({data:o===null?null:o[r+e],index:r+e}))}function Nr(e){return{...Lr,items:e}}function pt(e,t){return e!==void 0&&e.width===t.width&&e.height===t.height}function Mr(e,t){return e!==void 0&&e.column===t.column&&e.row===t.row}const Or=Y(([{increaseViewportBy:e,listBoundary:t,overscan:o,visibleRange:n},{footerHeight:r,headerHeight:s,scrollBy:i,scrollContainerState:a,scrollTo:l,scrollTop:u,smoothScrollTargetReached:h,viewportHeight:v},g,p,{didMount:T,propsReady:y},{customScrollParent:x,useWindowScroll:m,windowScrollContainerState:f,windowScrollTo:w,windowViewportRect:z},R])=>{const A=S(0),c=S(0),b=S(Io),k=S({height:0,width:0}),B=S({height:0,width:0}),E=K(),F=K(),V=S(0),D=S(null),U=S({column:0,row:0}),C=K(),O=K(),q=S(!1),pe=S(0),le=S(!0),Ce=S(!1),Le=S(!1);Q(I(T,$(pe),P(([j,X])=>X!==0)),()=>{G(le,!1)}),Q(I(ue(T,le,B,k,pe,Ce),P(([j,X,de,ee,,ne])=>j&&!X&&de.height!==0&&ee.height!==0&&!ne)),([,,,,j])=>{G(Ce,!0),Ut(1,()=>{G(E,j)}),ke(I(u),()=>{G(t,[0,0]),G(le,!0)})}),N(I(O,P(j=>j!=null&&j.scrollTop>0),He(0)),c),Q(I(T,$(O),P(([,j])=>j!=null)),([,j])=>{j&&(G(k,j.viewport),G(B,j.item),G(U,j.gap),j.scrollTop>0&&(G(q,!0),ke(I(u,_e(1)),X=>{G(q,!1)}),G(l,{top:j.scrollTop})))}),N(I(k,H(({height:j})=>j)),v),N(I(ue(W(k,pt),W(B,pt),W(U,(j,X)=>j!==void 0&&j.column===X.column&&j.row===X.row),W(u)),H(([j,X,de,ee])=>({gap:de,item:X,scrollTop:ee,viewport:j}))),C),N(I(ue(W(A),n,W(U,Mr),W(B,pt),W(k,pt),W(D),W(c),W(q),W(le),W(pe)),P(([,,,,,,,j])=>!j),H(([j,[X,de],ee,ne,fe,ae,J,,ie,ye])=>{const{column:ce,row:Je}=ee,{height:ft,width:Rt}=ne,{width:qt}=fe;if(J===0&&(j===0||qt===0))return Io;if(Rt===0){const ro=Kt(ye,j),dn=ro+Math.max(J-1,0);return Nr(ko(ro,dn,ae))}const mt=an(qt,Rt,ce);let $e,We;ie?X===0&&de===0&&J>0?($e=0,We=J-1):($e=mt*Tt((X+Je)/(ft+Je)),We=mt*wo((de+Je)/(ft+Je))-1,We=Lt(j-1,et(We,mt-1)),$e=Lt(We,et(0,$e))):($e=0,We=-1);const eo=ko($e,We,ae),{bottom:to,top:oo}=Ro(fe,ee,ne,eo),no=wo(j/mt),un=no*ft+(no-1)*Je-to;return{bottom:to,itemHeight:ft,items:eo,itemWidth:Rt,offsetBottom:un,offsetTop:oo,top:oo}})),b),N(I(D,P(j=>j!==null),H(j=>j.length)),A),N(I(ue(k,B,b,U),P(([j,X,{items:de}])=>de.length>0&&X.height!==0&&j.height!==0),H(([j,X,{items:de},ee])=>{const{bottom:ne,top:fe}=Ro(j,ee,X,de);return[fe,ne]}),te(rt)),t);const ge=S(!1);N(I(u,$(ge),H(([j,X])=>X||j!==0)),ge);const Ge=Ie(I(ue(b,A),P(([{items:j}])=>j.length>0),$(ge),P(([[j,X],de])=>{const ee=j.items[j.items.length-1].index===X-1;return(de||j.bottom>0&&j.itemHeight>0&&j.offsetBottom===0&&j.items.length===X)&&ee}),H(([[,j]])=>j-1),te())),Qe=Ie(I(W(b),P(({items:j})=>j.length>0&&j[0].index===0),He(0),te())),je=Ie(I(W(b),$(q),P(([{items:j},X])=>j.length>0&&!X),H(([{items:j}])=>({endIndex:j[j.length-1].index,startIndex:j[0].index})),te(Wo),Be(0)));N(je,p.scrollSeekRangeChanged),N(I(E,$(k,B,A,U),H(([j,X,de,ee,ne])=>{const fe=Go(j),{align:ae,behavior:J,offset:ie}=fe;let ye=fe.index;ye==="LAST"&&(ye=ee-1),ye=et(0,ye,Lt(ee-1,ye));let ce=Pt(X,ne,de,ye);return ae==="end"?ce=So(ce-X.height+de.height):ae==="center"&&(ce=So(ce-X.height/2+de.height/2)),ie!==void 0&&ie!==0&&(ce+=ie),{behavior:J,top:ce}})),l);const Ze=ve(I(b,H(j=>j.offsetBottom+j.bottom)),0);return N(I(z,H(j=>({height:j.visibleHeight,width:j.visibleWidth}))),k),{customScrollParent:x,data:D,deviation:V,footerHeight:r,gap:U,headerHeight:s,increaseViewportBy:e,initialItemCount:c,itemDimensions:B,overscan:o,restoreStateFrom:O,scrollBy:i,scrollContainerState:a,scrollHeight:F,scrollTo:l,scrollToIndex:E,scrollTop:u,smoothScrollTargetReached:h,totalCount:A,useWindowScroll:m,viewportDimensions:k,windowScrollContainerState:f,windowScrollTo:w,windowViewportRect:z,...p,gridState:b,horizontalDirection:Le,initialTopMostItemIndex:pe,totalListHeight:Ze,...g,endReached:Ge,propsReady:y,rangeChanged:je,startReached:Qe,stateChanged:C,stateRestoreInProgress:q,...R}},oe(Yt,be,dt,Qo,De,Xt,Ae));function an(e,t,o){return et(1,Tt((e+o)/(Tt(t)+o)))}function Ro(e,t,o,n){const{height:r}=o;if(r===void 0||n.length===0)return{bottom:0,top:0};const s=Pt(e,t,o,n[0].index);return{bottom:Pt(e,t,o,n[n.length-1].index)+r,top:s}}function Pt(e,t,o,n){const r=an(e.width,o.width,t.column),s=Tt(n/r),i=s*o.height+et(0,s-1)*t.row;return i>0?i+t.row:i}const Ar=Y(()=>{const e=S(v=>`Item ${v}`),t=S({}),o=S(null),n=S("virtuoso-grid-item"),r=S("virtuoso-grid-list"),s=S(Zt),i=S("div"),a=S(Xe),l=(v,g=null)=>ve(I(t,H(p=>p[v]),te()),g),u=S(!1),h=S(!1);return N(W(h),u),{components:t,computeItemKey:s,context:o,FooterComponent:l("Footer"),HeaderComponent:l("Header"),headerFooterTag:i,itemClassName:n,ItemComponent:l("Item","div"),itemContent:e,listClassName:r,ListComponent:l("List","div"),readyStateChanged:u,reportReadyState:h,ScrollerComponent:l("Scroller","div"),scrollerRef:a,ScrollSeekPlaceholder:l("ScrollSeekPlaceholder","div")}}),Dr=Y(([e,t])=>({...e,...t}),oe(Or,Ar)),Wr=L.memo(function(){const e=re("gridState"),t=re("listClassName"),o=re("itemClassName"),n=re("itemContent"),r=re("computeItemKey"),s=re("isSeeking"),i=Se("scrollHeight"),a=re("ItemComponent"),l=re("ListComponent"),u=re("ScrollSeekPlaceholder"),h=re("context"),v=Se("itemDimensions"),g=Se("gap"),p=re("log"),T=re("stateRestoreInProgress"),y=Se("reportReadyState"),x=Fe(L.useMemo(()=>m=>{const f=m.parentElement.parentElement.scrollHeight;i(f);const w=m.firstChild;if(w!==null){const{height:z,width:R}=w.getBoundingClientRect();v({height:z,width:R})}g({column:jo("column-gap",getComputedStyle(m).columnGap,p),row:jo("row-gap",getComputedStyle(m).rowGap,p)})},[i,v,g,p]),!0,!1);return on(()=>{e.itemHeight>0&&e.itemWidth>0&&y(!0)},[e]),T?null:d.jsx(l,{className:t,ref:x,...xe(l,h),"data-testid":"virtuoso-item-list",style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(m=>{const f=r(m.index,m.data,h);return s?d.jsx(u,{...xe(u,h),height:e.itemHeight,index:m.index,width:e.itemWidth},f):M.createElement(a,{...xe(a,h),className:o,"data-index":m.index,key:f},n(m.index,m.data,h))})})}),Pr=L.memo(function(){const e=re("HeaderComponent"),t=Se("headerHeight"),o=re("headerFooterTag"),n=Fe(L.useMemo(()=>s=>{t(Me(s,"height"))},[t]),!0,!1),r=re("context");return e!=null?d.jsx(o,{ref:n,children:d.jsx(e,{...xe(e,r)})}):null}),_r=L.memo(function(){const e=re("FooterComponent"),t=Se("footerHeight"),o=re("headerFooterTag"),n=Fe(L.useMemo(()=>s=>{t(Me(s,"height"))},[t]),!0,!1),r=re("context");return e!=null?d.jsx(o,{ref:n,children:d.jsx(e,{...xe(e,r)})}):null}),Fr=({children:e})=>{const t=L.useContext(tn),o=Se("itemDimensions"),n=Se("viewportDimensions"),r=Fe(L.useMemo(()=>s=>{n(s.getBoundingClientRect())},[n]),!0,!1);return L.useEffect(()=>{t&&(n({height:t.viewportHeight,width:t.viewportWidth}),o({height:t.itemHeight,width:t.itemWidth}))},[t,n,o]),d.jsx("div",{ref:r,style:kt(!1),children:e})},Vr=({children:e})=>{const t=L.useContext(tn),o=Se("windowViewportRect"),n=Se("itemDimensions"),r=re("customScrollParent"),s=Lo(o,r,!1);return L.useEffect(()=>{t&&(n({height:t.itemHeight,width:t.itemWidth}),o({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,o,n]),d.jsx("div",{ref:s,style:kt(!1),children:e})},Gr=L.memo(function({...e}){const t=re("useWindowScroll"),o=re("customScrollParent"),n=o||t?Ur:$r,r=o||t?Vr:Fr,s=re("context");return d.jsx(n,{...e,...xe(n,s),children:d.jsxs(r,{children:[d.jsx(Pr,{}),d.jsx(Wr,{}),d.jsx(_r,{})]})})}),{useEmitter:cn,useEmitterValue:re,usePublisher:Se}=qo(Dr,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex",increaseViewportBy:"increaseViewportBy"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged",readyStateChanged:"readyStateChanged"}},Gr),$r=sn({useEmitter:cn,useEmitterValue:re,usePublisher:Se}),Ur=ln({useEmitter:cn,useEmitterValue:re,usePublisher:Se});function jo(e,t,o){return t!=="normal"&&(t==null?void 0:t.endsWith("px"))!==!0&&o(`${e} was not resolved to pixel value correctly`,t,he.WARN),t==="normal"?0:parseInt(t??"0",10)}const Kr=150;function Yr({entries:e,itemCount:t}){const o=M.useRef(null),[n,r]=M.useState(!1),s=M.useRef(!1),i=M.useRef(0),a=M.useRef(e.length),l=M.useRef(0),u=M.useCallback((p="smooth")=>{o.current&&(l.current=Date.now(),o.current.scrollToIndex({index:t-1,behavior:p,align:"end"}))},[t]),h=M.useCallback(p=>s.current||!p?!1:"auto",[]),v=M.useCallback(p=>{r(!p),p&&(s.current=!1)},[]),g=M.useCallback(p=>{const y=p.target.scrollTop;if(Date.now()-l.current<Kr){i.current=y;return}y-i.current<-10&&(s.current=!0),i.current=y},[]);return M.useEffect(()=>{const p=e.length,T=a.current,y=p>T;if(a.current=p,!y)return;const x=e[e.length-1];(x==null?void 0:x.type)==="user_message"&&(s.current=!1,requestAnimationFrame(()=>{requestAnimationFrame(()=>{o.current&&(l.current=Date.now(),o.current.scrollToIndex({index:"LAST",behavior:"auto",align:"end"}))})}))},[e]),{virtuosoRef:o,handleScroll:g,handleAtBottomStateChange:v,handleFollowOutput:h,showScrollButton:n,scrollToBottom:u}}const Xr=new Set(["assistant_message","error","command_exec","tool_use"]);function Qr(e){const t={source_entry_id:e.id,source_process_id:e.processId};switch(e.type){case"assistant_message":return{...t,title:"Issue from assistant message",description:e.content.slice(0,2e3)};case"error":return{...t,title:`Error: ${e.message.slice(0,100)}`,description:e.message+(e.code?`
2
+ Code: ${e.code}`:""),type:"bug",priority:"high"};case"command_exec":return{...t,title:`Issue from command: ${e.command.slice(0,80)}`,description:[`Command: ${e.command}`,e.exitCode!==void 0?`Exit code: ${e.exitCode}`:"",e.output?`Output:
3
+ ${e.output.slice(0,1500)}`:""].filter(Boolean).join(`
4
+ `),type:e.exitCode!==0?"bug":"task"};case"tool_use":return{...t,title:`Issue from tool: ${e.name}`,description:[`Tool: ${e.name}`,`Status: ${e.status}`,`Input: ${JSON.stringify(e.input,null,2).slice(0,500)}`,e.result?`Result: ${e.result.slice(0,1e3)}`:""].filter(Boolean).join(`
5
+ `),type:e.status==="failed"?"bug":"task"};default:return t}}function Zr({entry:e,children:t,onCreateIssue:o}){const[n,r]=M.useState(null),s=M.useRef(null),i=Xr.has(e.type),a=M.useCallback(u=>{i&&(u.preventDefault(),r({x:u.clientX,y:u.clientY}))},[i]);M.useEffect(()=>{if(!n)return;function u(){r(null)}function h(v){v.key==="Escape"&&r(null)}return document.addEventListener("click",u),document.addEventListener("keydown",h),()=>{document.removeEventListener("click",u),document.removeEventListener("keydown",h)}},[n]);const l=M.useCallback(()=>{r(null),o(Qr(e))},[e,o]);return d.jsxs("div",{onContextMenu:a,className:"relative",children:[t,n&&d.jsx("div",{ref:s,className:Ne("fixed z-[100] min-w-[160px] rounded-[var(--radius-default)]","border border-border bg-bg-primary shadow-lg","py-[var(--spacing-1)]","animate-in fade-in-0 zoom-in-95"),style:{left:n.x,top:n.y},role:"menu",children:d.jsxs("button",{type:"button",role:"menuitem",onClick:l,className:Ne("flex items-center gap-[var(--spacing-2)] w-full px-[var(--spacing-3)] py-[var(--spacing-1-5)]","text-left text-[length:var(--font-size-sm)] text-text-secondary","hover:bg-bg-hover hover:text-text-primary","transition-colors duration-[var(--duration-fast)]"),children:[d.jsxs("svg",{className:"w-4 h-4 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[d.jsx("circle",{cx:"12",cy:"12",r:"10"}),d.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"16"}),d.jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]}),"Create Issue"]})})]})}const Jr=[{value:"bug",label:"Bug"},{value:"feature",label:"Feature"},{value:"improvement",label:"Improvement"},{value:"task",label:"Task"}],qr=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"urgent",label:"Urgent"}],gt=Ne("w-full px-[var(--spacing-3)] py-[var(--spacing-2)]","rounded-[var(--radius-default)] border border-border","bg-bg-secondary text-text-primary","text-[length:var(--font-size-sm)]","focus:outline-none focus:shadow-[var(--shadow-focus-ring)]","transition-shadow duration-[var(--duration-fast)]"),xt="block text-[length:var(--font-size-sm)] font-[var(--font-weight-medium)] text-text-secondary mb-[var(--spacing-1)]";function es({open:e,onOpenChange:t,prefill:o}){const n=mn(y=>y.createIssue),[r,s]=M.useState(""),[i,a]=M.useState(""),[l,u]=M.useState("task"),[h,v]=M.useState("medium"),[g,p]=M.useState(!1);M.useEffect(()=>{e&&o&&(s(o.title??""),a(o.description??""),u(o.type??"task"),v(o.priority??"medium")),e||(s(""),a(""),u("task"),v("medium"))},[e,o]);const T=M.useCallback(async()=>{if(!r.trim())return;p(!0);const y={title:r.trim(),description:i,type:l,priority:h};o!=null&&o.source_entry_id&&(y.source_entry_id=o.source_entry_id),o!=null&&o.source_process_id&&(y.source_process_id=o.source_process_id),await n(y),p(!1),t(!1)},[r,i,l,h,o,n,t]);return d.jsx(hn,{open:e,onOpenChange:t,children:d.jsxs(pn,{children:[d.jsx(gn,{className:"fixed inset-0 z-50 bg-black/50 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"}),d.jsxs(xn,{className:Ne("fixed left-1/2 top-1/2 z-50 -translate-x-1/2 -translate-y-1/2","w-[560px] max-w-[95vw] max-h-[85vh]","rounded-[var(--radius-lg)] border border-border bg-bg-primary shadow-lg","flex flex-col overflow-hidden","focus:outline-none","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95"),children:[d.jsxs("div",{className:"flex items-center justify-between px-[var(--spacing-6)] py-[var(--spacing-4)] border-b border-border shrink-0",children:[d.jsx(vn,{className:"text-[length:var(--font-size-lg)] font-[var(--font-weight-semibold)] text-text-primary",children:"Create Issue"}),d.jsx(so,{className:Ne("w-8 h-8 flex items-center justify-center rounded-[var(--radius-sm)]","text-text-secondary hover:text-text-primary hover:bg-bg-hover","transition-colors duration-[var(--duration-fast)]","focus-visible:outline-none focus-visible:shadow-[var(--shadow-focus-ring)]"),"aria-label":"Close",children:d.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[d.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),d.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),d.jsxs("div",{className:"flex-1 overflow-y-auto p-[var(--spacing-6)] space-y-[var(--spacing-4)]",children:[d.jsxs("div",{children:[d.jsx("label",{htmlFor:"issue-title",className:xt,children:"Title"}),d.jsx("input",{id:"issue-title",type:"text",value:r,onChange:y=>s(y.target.value),placeholder:"Brief summary of the issue",className:gt,autoFocus:!0})]}),d.jsxs("div",{children:[d.jsx("label",{htmlFor:"issue-desc",className:xt,children:"Description"}),d.jsx("textarea",{id:"issue-desc",value:i,onChange:y=>a(y.target.value),placeholder:"Detailed description...",rows:6,className:Ne(gt,"resize-y min-h-[120px]")})]}),d.jsxs("div",{className:"flex gap-[var(--spacing-4)]",children:[d.jsxs("div",{className:"flex-1",children:[d.jsx("label",{htmlFor:"issue-type",className:xt,children:"Type"}),d.jsx("select",{id:"issue-type",value:l,onChange:y=>u(y.target.value),className:gt,children:Jr.map(y=>d.jsx("option",{value:y.value,children:y.label},y.value))})]}),d.jsxs("div",{className:"flex-1",children:[d.jsx("label",{htmlFor:"issue-priority",className:xt,children:"Priority"}),d.jsx("select",{id:"issue-priority",value:h,onChange:y=>v(y.target.value),className:gt,children:qr.map(y=>d.jsx("option",{value:y.value,children:y.label},y.value))})]})]})]}),d.jsxs("div",{className:"flex items-center justify-end gap-[var(--spacing-3)] px-[var(--spacing-6)] py-[var(--spacing-4)] border-t border-border shrink-0",children:[d.jsx(so,{className:Ne("px-[var(--spacing-4)] py-[var(--spacing-2)]","rounded-[var(--radius-default)]","text-[length:var(--font-size-sm)] font-[var(--font-weight-medium)]","text-text-secondary hover:text-text-primary hover:bg-bg-hover","transition-colors duration-[var(--duration-fast)]"),children:"Cancel"}),d.jsx("button",{type:"button",disabled:!r.trim()||g,onClick:T,className:Ne("px-[var(--spacing-4)] py-[var(--spacing-2)]","rounded-[var(--radius-default)]","text-[length:var(--font-size-sm)] font-[var(--font-weight-medium)]","bg-[var(--color-accent-blue)] text-white","hover:opacity-90","disabled:opacity-50 disabled:cursor-not-allowed","transition-opacity duration-[var(--duration-fast)]"),children:g?"Creating...":"Create Issue"})]})]})]})})}const Ho=[];function ts({agentType:e}){const t=bt[e??"claude-code"]??bt["claude-code"];return d.jsx("div",{className:"max-w-[700px] mx-auto px-4",children:d.jsxs("div",{className:"flex gap-[8px]",style:{paddingTop:10,paddingBottom:10},children:[d.jsxs("div",{className:"relative shrink-0 w-6 h-6 rounded-[6px] flex items-center justify-center mt-[2px] text-[10px] font-bold",style:{backgroundColor:t.tint,color:t.color},children:[t.label,d.jsx("span",{className:"absolute inset-[-3px] rounded-[8px] pointer-events-none",style:{border:"1.5px solid currentColor",color:t.color,opacity:.3,animation:"avatar-pulse 2.5s ease-in-out infinite"}})]}),d.jsxs("div",{className:"flex items-center gap-[3px] pt-[6px]",children:[d.jsx("span",{className:"w-[5px] h-[5px] rounded-full animate-bounce",style:{backgroundColor:t.color,animationDelay:"0ms",opacity:.7}}),d.jsx("span",{className:"w-[5px] h-[5px] rounded-full animate-bounce",style:{backgroundColor:t.color,animationDelay:"150ms",opacity:.7}}),d.jsx("span",{className:"w-[5px] h-[5px] rounded-full animate-bounce",style:{backgroundColor:t.color,animationDelay:"300ms",opacity:.7}})]})]})})}function ys({processId:e}){const t=tt(f=>e?f.entries[e]??Ho:Ho),o=tt(f=>e?f.processes[e]:void 0),{virtuosoRef:n,handleScroll:r,handleFollowOutput:s,handleAtBottomStateChange:i,showScrollButton:a,scrollToBottom:l}=Yr({entries:t,itemCount:t.length}),[u,h]=M.useState(!1),[v,g]=M.useState(),p=M.useCallback(f=>{g(f),h(!0)},[]),T=o==null?void 0:o.status,x=!((e==null?void 0:e.startsWith("cli-history-"))??!1)&&(T==="running"||T==="spawning"),m=M.useMemo(()=>{if(!x||t.length===0)return!1;const f=t[t.length-1];return!(f.type==="assistant_message"&&f.partial)},[x,t]);if(!e)return d.jsx("div",{className:"flex-1 flex items-center justify-center text-text-tertiary text-[length:var(--font-size-sm)]",children:"Select a session or start a new conversation"});if(t.length===0){if(x){const f=bt[(o==null?void 0:o.type)??"claude-code"]??bt["claude-code"];return d.jsx("div",{className:"flex-1 flex items-center justify-center",children:d.jsxs("div",{className:"flex flex-col items-center gap-3",children:[d.jsxs("div",{className:"relative w-8 h-8 rounded-[8px] flex items-center justify-center text-[12px] font-bold",style:{backgroundColor:f.tint,color:f.color},children:[f.label,d.jsx("span",{className:"absolute inset-[-3px] rounded-[10px] pointer-events-none",style:{border:"1.5px solid currentColor",color:f.color,opacity:.3,animation:"avatar-pulse 2.5s ease-in-out infinite"}})]}),d.jsxs("div",{className:"flex gap-1",children:[d.jsx("span",{className:"w-[5px] h-[5px] rounded-full animate-bounce",style:{backgroundColor:f.color,animationDelay:"0ms",opacity:.7}}),d.jsx("span",{className:"w-[5px] h-[5px] rounded-full animate-bounce",style:{backgroundColor:f.color,animationDelay:"150ms",opacity:.7}}),d.jsx("span",{className:"w-[5px] h-[5px] rounded-full animate-bounce",style:{backgroundColor:f.color,animationDelay:"300ms",opacity:.7}})]}),d.jsx("span",{className:"text-[12px]",style:{color:"var(--color-text-tertiary)"},children:T==="spawning"?"Starting agent...":"Thinking..."})]})})}return d.jsx("div",{className:"flex-1 flex items-center justify-center text-text-tertiary text-[length:var(--font-size-sm)]",children:"No messages yet"})}return d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex-1 relative",style:{minHeight:0},children:[d.jsx(Er,{ref:n,data:t,followOutput:s,atBottomStateChange:i,onScroll:r,atBottomThreshold:60,className:"h-full",style:{height:"100%"},components:m?{Footer:()=>d.jsx(ts,{agentType:o==null?void 0:o.type})}:{},itemContent:(f,w)=>{let z=!1;if(w.type==="assistant_message"&&f>0)for(let R=f-1;R>=0;R--){const A=t[R];if(A.type==="assistant_message"){z=!0;break}if(A.type==="user_message")break}return d.jsx("div",{className:"max-w-[700px] mx-auto px-4",children:d.jsx(Zr,{entry:w,onCreateIssue:p,children:d.jsx(bn,{entry:w,isGroupContinuation:z})})})}}),a&&d.jsx("button",{type:"button",onClick:()=>l("smooth"),style:{position:"absolute",bottom:"16px",right:"16px",width:"36px",height:"36px",borderRadius:"50%",border:"1px solid var(--color-border)",background:"var(--color-bg-secondary)",color:"var(--color-text-secondary)",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 2px 8px rgba(0,0,0,0.15)",transition:"opacity 150ms ease",zIndex:10},"aria-label":"Scroll to bottom",children:d.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:d.jsx("path",{d:"M8 3v10M4 9l4 4 4-4"})})})]}),d.jsx(es,{open:u,onOpenChange:h,prefill:v})]})}const os=()=>{const e=M.useRef(!1);return{isComposing:e,compositionHandlers:{onCompositionStartCapture:()=>{e.current=!0},onCompositionEndCapture:()=>{e.current=!1}},createKeyDownHandler:(n,r)=>s=>{e.current||r!=null&&r(s)||s.key==="Enter"&&!s.shiftKey&&(s.preventDefault(),n())}}},ns=/^\/([a-zA-Z0-9_-]*)$/;function rs(e){const t=e.match(ns);return t?t[1]:null}function ss(e){const{input:t,commands:o,onSelect:n}=e,r=M.useMemo(()=>rs(t),[t]),[s,i]=M.useState(0),[a,l]=M.useState(!1);M.useEffect(()=>{i(0),l(!1)},[r]);const u=M.useMemo(()=>{if(r===null)return[];const p=r.trim().toLowerCase();return p?o.filter(T=>T.name.toLowerCase().startsWith("/"+p)||T.name.toLowerCase().startsWith(p)):o},[o,r]),h=r!==null&&!a&&u.length>0,v=M.useCallback(p=>{const T=u[p];return T?(n(T.name),l(!0),!0):!1},[u,n]),g=M.useCallback(p=>h?p.key==="Escape"?(p.preventDefault(),l(!0),!0):p.key==="ArrowDown"?(p.preventDefault(),i(T=>(T+1)%u.length),!0):p.key==="ArrowUp"?(p.preventDefault(),i(T=>(T-1+u.length)%u.length),!0):p.key==="Enter"&&!p.shiftKey?(p.preventDefault(),v(s)):!1:!1,[s,v,u.length,h]);return{isOpen:h,activeIndex:s,filteredCommands:u,onKeyDown:g,onSelectByIndex:v,setDismissed:l,setActiveIndex:i}}const is=30,ls=800;function as(e,t){const[o,n]=M.useState(!1),r=M.useRef(null),s=M.useRef(!1);return M.useEffect(()=>{if(e.includes(`
6
+ `)){s.current=!0,n(!0);return}if(e.length>=ls){s.current=!0,n(!0);return}if(!e){s.current=!1,n(!1);return}const i=t.current;if(!i)return;const a=requestAnimationFrame(()=>{r.current||(r.current=document.createElement("canvas"));const l=r.current.getContext("2d");if(!l)return;const u=i.querySelector("textarea");if(!u)return;const h=getComputedStyle(u);l.font=`${h.fontWeight} ${h.fontSize} ${h.fontFamily}`;const v=l.measureText(e).width,g=parseFloat(h.paddingLeft)||0,p=parseFloat(h.paddingRight)||0,T=u.clientWidth-g-p,y=s.current;let x;y?x=v>T-is:x=v>T,s.current=x,n(x)});return()=>cancelAnimationFrame(a)},[e,t]),{isMultiline:o}}const cs=2e5;function Nt(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toString()}function us(e){return e>=80?"var(--color-accent-red)":e>=50?"var(--color-accent-orange)":"var(--color-accent-green)"}function ds({processId:e,contextWindow:t=cs,size:o=24}){const n=tt(g=>e?g.processTokenUsage[e]??null:null),[r,s]=M.useState(!1),{percentage:i,ringColor:a,strokeDashoffset:l,circumference:u}=M.useMemo(()=>{const g=n??{input:0,output:0},p=g.input+g.output,T=Math.min(p/t*100,100),x=(o-2.5)/2,m=2*Math.PI*x;return{percentage:T,ringColor:us(T),strokeDashoffset:m-T/100*m,circumference:m}},[n,t,o]);if(!n)return null;const h=2.5,v=(o-h)/2;return d.jsxs("div",{className:"relative flex items-center justify-center cursor-default",style:{width:o,height:o},onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),children:[d.jsxs("svg",{width:o,height:o,viewBox:`0 0 ${o} ${o}`,style:{transform:"rotate(-90deg)"},children:[d.jsx("circle",{cx:o/2,cy:o/2,r:v,fill:"none",stroke:"var(--color-border-divider)",strokeWidth:h}),d.jsx("circle",{cx:o/2,cy:o/2,r:v,fill:"none",stroke:a,strokeWidth:h,strokeLinecap:"round",strokeDasharray:u,strokeDashoffset:l,style:{transition:"stroke-dashoffset 0.3s ease, stroke 0.3s ease"}})]}),r&&d.jsxs("div",{className:"absolute bottom-[calc(100%+8px)] left-1/2 -translate-x-1/2 px-[10px] py-[6px] rounded-[8px] text-[11px] font-medium whitespace-nowrap z-50 pointer-events-none",style:{backgroundColor:"var(--color-text-primary)",color:"#fff",boxShadow:"0 4px 12px rgba(0,0,0,0.15)"},children:[d.jsxs("div",{style:{marginBottom:2},children:[i.toFixed(1),"% context used"]}),d.jsxs("div",{className:"flex flex-col gap-[2px] text-[10px]",style:{opacity:.85},children:[d.jsxs("span",{children:["Input: ",Nt(n.input)]}),d.jsxs("span",{children:["Output: ",Nt(n.output)]}),(n.cacheRead>0||n.cacheWrite>0)&&d.jsxs("span",{children:["Cache: ",Nt(n.cacheRead+n.cacheWrite)]})]})]})]})}const fs=["claude-code","codex","gemini","qwen","opencode","agent-sdk"],ms={"claude-code":"C",codex:"Cx","codex-server":"Cs",gemini:"G","gemini-a2a":"Ga",qwen:"Q",opencode:"O","agent-sdk":"S"},hs=[{name:"/maestro-plan",desc:"Create detailed phase plan",color:"var(--color-accent-purple)",bg:"var(--color-tint-planning)"},{name:"/quality-review",desc:"Tiered code review",color:"var(--color-accent-green)",bg:"var(--color-tint-completed)"},{name:"/maestro-execute",desc:"Execute phase with parallelization",color:"var(--color-accent-orange)",bg:"var(--color-tint-verifying)"},{name:"/quality-debug",desc:"Parallel hypothesis debugging",color:"var(--color-accent-blue)",bg:"var(--color-tint-exploring)"}],ps=new Set(["claude-code"]);function bs({processId:e,executor:t}={}){const[o,n]=M.useState(""),[r,s]=M.useState("claude-code"),[i,a]=M.useState("inject"),l=M.useRef(null),u=M.useRef(null),h=M.useRef(null),v=M.useRef(null),{isMultiline:g}=as(o,u),p=tt(C=>C.activeProcessId),T=tt(C=>C.processes),y=e!==void 0?e:p,x=y?T[y]??null:null,m=!!(y&&y.startsWith("cli-history-")&&(x==null?void 0:x.interactive)===!0),f=x!=null?x.interactive===!1:t!=null&&!ps.has(t),w=e!=null&&!y||!m&&f,{compositionHandlers:z,createKeyDownHandler:R}=os(),A=M.useCallback(C=>{var O;n(C+" "),(O=l.current)==null||O.focus()},[]),c=ss({input:o,commands:hs,onSelect:A}),b=M.useCallback(()=>{const C=o.trim();C&&(y&&x?m?jt({action:"delegate:message",processId:y,content:C,delivery:i}):jt({action:"message",processId:y,content:C}):e==null&&jt({action:"spawn",config:{type:r,prompt:C,workDir:"."}}),n(""),c.setDismissed(!0),l.current&&(l.current.style.height="auto"))},[o,y,x,r,e,c,m,i]),k=R(b,c.onKeyDown),B=M.useCallback(()=>{const C=l.current;C&&(C.style.height="auto",C.style.height=`${Math.min(C.scrollHeight,200)}px`)},[]),E=M.useCallback(C=>{n(C.target.value)},[]),F=M.useCallback(C=>{var q,pe;const O=(q=C.target.files)==null?void 0:q[0];O&&(n(le=>le+(le?" ":"")+`@${O.name}`),(pe=l.current)==null||pe.focus()),C.target.value=""},[]),V=M.useCallback(C=>{var q,pe;const O=(q=C.target.files)==null?void 0:q[0];O&&(n(le=>le+(le?" ":"")+`@${O.name}`),(pe=l.current)==null||pe.focus()),C.target.value=""},[]),D=!y&&e==null,U=(x==null?void 0:x.type)??r;return d.jsxs("div",{className:"shrink-0 px-4 pb-[10px] pt-1",style:{backgroundColor:"var(--color-bg-primary)"},children:[d.jsx("input",{ref:h,type:"file",className:"hidden",onChange:F}),d.jsx("input",{ref:v,type:"file",accept:"image/*",className:"hidden",onChange:V}),d.jsxs("div",{className:"max-w-[700px] mx-auto relative",children:[c.isOpen&&d.jsx("div",{className:"absolute bottom-full left-0 right-0 mb-[6px] border rounded-[12px] p-[6px] max-h-[240px] overflow-y-auto z-50",style:{backgroundColor:"var(--color-bg-card)",borderColor:"var(--color-border)",boxShadow:"0 -4px 20px rgba(0,0,0,0.06)",backdropFilter:"blur(12px)"},children:c.filteredCommands.map((C,O)=>d.jsxs("button",{type:"button",onClick:()=>c.onSelectByIndex(O),onMouseEnter:()=>c.setActiveIndex(O),className:"flex items-center gap-[10px] w-full px-[10px] py-[7px] rounded-[8px] cursor-pointer transition-colors duration-100 text-left border-none",style:{backgroundColor:O===c.activeIndex?"var(--color-bg-hover)":"transparent"},children:[d.jsx("span",{className:"w-7 h-7 rounded-[6px] flex items-center justify-center shrink-0",style:{backgroundColor:C.bg},children:d.jsx(Cn,{size:14,strokeWidth:1.8,stroke:C.color})}),d.jsxs("div",{children:[d.jsx("div",{className:"text-[12px] font-semibold text-text-primary",children:C.name}),d.jsx("div",{className:"text-[11px]",style:{color:"var(--color-text-tertiary)"},children:C.desc})]})]},C.name))}),D&&d.jsxs("div",{className:"flex items-center justify-center gap-[3px] py-[4px]",children:[d.jsxs("div",{className:"flex items-center gap-[4px] px-[10px] py-[3px] rounded-full border text-[10px] font-semibold cursor-pointer transition-all duration-100",style:{borderColor:"var(--color-accent-orange)",backgroundColor:"var(--color-tint-verifying)",color:"var(--color-text-primary)"},children:[d.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[d.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),d.jsx("path",{d:"M2 17l10 5 10-5"}),d.jsx("path",{d:"M2 12l10 5 10-5"})]}),"Maestro"]}),d.jsx("div",{className:"flex gap-[1px] ml-[2px]",children:fs.map(C=>d.jsx("button",{type:"button",onClick:()=>s(C),title:io[C],className:"w-6 h-6 rounded-[4px] border-none flex items-center justify-center cursor-pointer text-[9px] font-bold transition-all duration-100",style:{backgroundColor:r===C?"var(--color-bg-active)":"transparent",color:r===C?"var(--color-text-primary)":"var(--color-text-tertiary)"},onMouseEnter:O=>{r!==C&&(O.currentTarget.style.backgroundColor="var(--color-bg-hover)")},onMouseLeave:O=>{r!==C&&(O.currentTarget.style.backgroundColor="transparent")},children:d.jsx("span",{className:"w-[14px] h-[14px] rounded-[3px] flex items-center justify-center text-[8px] font-bold text-white",style:{backgroundColor:lo[C]},children:ms[C]})},C))})]}),d.jsxs("div",{ref:u,className:"border transition-[border-color,box-shadow]",style:{borderColor:"var(--color-border)",backgroundColor:"var(--color-bg-card)",borderRadius:"10px",transitionDuration:"var(--duration-normal)"},onFocusCapture:C=>{const O=C.currentTarget;O.style.borderColor="var(--color-accent-blue)",O.style.boxShadow="0 0 0 3px rgba(74,144,217,0.08)"},onBlurCapture:C=>{if(!C.relatedTarget||!(C.relatedTarget instanceof Node)||!C.currentTarget.contains(C.relatedTarget)){const O=C.currentTarget;O.style.borderColor="var(--color-border)",O.style.boxShadow="none"}},children:[d.jsx("textarea",{ref:l,value:o,onChange:E,onInput:B,onKeyDown:k,...z,disabled:w,placeholder:m?"Queue a follow-up for this async delegate...":y?"Send a message...":"Send a message, / for commands...",rows:g?3:1,className:`w-full resize-none border-none leading-[1.5] bg-transparent outline-none disabled:opacity-40 disabled:cursor-not-allowed ${g?"min-h-[72px] max-h-[140px]":"min-h-[36px] max-h-[36px]"}`,style:{color:"var(--color-text-primary)",fontSize:"13px",padding:"8px 12px",fontFamily:"inherit"}}),d.jsxs("div",{className:"flex items-center gap-[4px] px-[5px] py-[3px]",style:{borderTop:"1px solid var(--color-border-divider)"},children:[d.jsx("button",{type:"button",onClick:()=>{var C;return(C=h.current)==null?void 0:C.click()},className:"w-[26px] h-[26px] rounded-[5px] border-none bg-transparent flex items-center justify-center cursor-pointer transition-all duration-100",style:{color:"var(--color-text-tertiary)"},onMouseEnter:C=>{C.currentTarget.style.backgroundColor="var(--color-bg-hover)",C.currentTarget.style.color="var(--color-text-primary)"},onMouseLeave:C=>{C.currentTarget.style.backgroundColor="transparent",C.currentTarget.style.color="var(--color-text-tertiary)"},children:d.jsx(yn,{size:13,strokeWidth:2})}),d.jsx("button",{type:"button",onClick:()=>{var C;c.isOpen?c.setDismissed(!0):(n("/"),(C=l.current)==null||C.focus())},className:"px-[7px] py-[2px] rounded-[4px] border-none bg-transparent text-[10px] font-medium cursor-pointer transition-all duration-100",style:{color:"var(--color-text-tertiary)",fontFamily:"inherit"},onMouseEnter:C=>{C.currentTarget.style.backgroundColor="var(--color-bg-hover)",C.currentTarget.style.color="var(--color-text-primary)"},onMouseLeave:C=>{C.currentTarget.style.backgroundColor="transparent",C.currentTarget.style.color="var(--color-text-tertiary)"},children:"Skills"}),d.jsx(ds,{processId:y}),m&&d.jsxs("div",{className:"flex items-center gap-[5px] px-[10px] py-[3px] text-[11px] font-medium",style:{border:"var(--style-btn-secondary-border)",backgroundColor:"var(--style-btn-secondary-bg)",borderRadius:"var(--style-btn-secondary-radius)",color:"var(--color-text-secondary)"},children:[d.jsx("span",{style:{color:"var(--color-text-tertiary)"},children:"Delivery"}),d.jsxs("select",{value:i,onChange:C=>a(C.target.value),className:"border-none bg-transparent cursor-pointer outline-none appearance-none text-[11px] font-medium",style:{color:"inherit"},children:[d.jsx("option",{value:"inject",children:"Inject"}),d.jsx("option",{value:"after_complete",children:"After Complete"})]})]}),!D&&d.jsxs("div",{className:"flex items-center gap-[5px] ml-auto px-[7px] py-[2px] text-[10px] font-medium",style:{color:"var(--color-text-tertiary)"},children:[d.jsx("span",{className:"w-[6px] h-[6px] rounded-full shrink-0",style:{backgroundColor:lo[U]}}),io[U]??U]}),d.jsx("div",{className:"flex-1"}),d.jsx("button",{type:"button",onClick:b,disabled:!o.trim()||w,className:"shrink-0 w-[28px] h-[28px] rounded-[7px] flex items-center justify-center transition-all disabled:opacity-40 disabled:cursor-not-allowed border-none cursor-pointer",style:{backgroundColor:"var(--color-accent-orange)",color:"#fff",transition:"all 150ms cubic-bezier(0.34,1.56,0.64,1)"},onMouseEnter:C=>{w||(C.currentTarget.style.transform="scale(1.06)")},onMouseLeave:C=>{C.currentTarget.style.transform="scale(1)"},"aria-label":"Send message",children:d.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[d.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),d.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]})]})]})]})}export{bs as C,ys as M};