@specship/specship-win32-arm64 0.24.0 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (341) hide show
  1. package/bin/specship.cmd +31 -1
  2. package/lib/dist/activation/cheatsheet.d.ts +17 -1
  3. package/lib/dist/activation/cheatsheet.d.ts.map +1 -1
  4. package/lib/dist/activation/cheatsheet.js +47 -3
  5. package/lib/dist/activation/cheatsheet.js.map +1 -1
  6. package/lib/dist/activation/hook-output.d.ts +80 -0
  7. package/lib/dist/activation/hook-output.d.ts.map +1 -0
  8. package/lib/dist/activation/hook-output.js +103 -0
  9. package/lib/dist/activation/hook-output.js.map +1 -0
  10. package/lib/dist/activation/search-intercept.d.ts +60 -29
  11. package/lib/dist/activation/search-intercept.d.ts.map +1 -1
  12. package/lib/dist/activation/search-intercept.js +159 -55
  13. package/lib/dist/activation/search-intercept.js.map +1 -1
  14. package/lib/dist/activation/steering.d.ts +11 -13
  15. package/lib/dist/activation/steering.d.ts.map +1 -1
  16. package/lib/dist/activation/steering.js +25 -10
  17. package/lib/dist/activation/steering.js.map +1 -1
  18. package/lib/dist/behaviour/behaviour-surface.d.ts +47 -0
  19. package/lib/dist/behaviour/behaviour-surface.d.ts.map +1 -1
  20. package/lib/dist/behaviour/behaviour-surface.js +108 -2
  21. package/lib/dist/behaviour/behaviour-surface.js.map +1 -1
  22. package/lib/dist/bin/node-version-check.d.ts +22 -7
  23. package/lib/dist/bin/node-version-check.d.ts.map +1 -1
  24. package/lib/dist/bin/node-version-check.js +39 -9
  25. package/lib/dist/bin/node-version-check.js.map +1 -1
  26. package/lib/dist/bin/specship.js +989 -116
  27. package/lib/dist/bin/specship.js.map +1 -1
  28. package/lib/dist/commands/specship/learn.md +27 -3
  29. package/lib/dist/commands/specship/spec.md +85 -15
  30. package/lib/dist/db/spec-queries.d.ts +73 -3
  31. package/lib/dist/db/spec-queries.d.ts.map +1 -1
  32. package/lib/dist/db/spec-queries.js +139 -5
  33. package/lib/dist/db/spec-queries.js.map +1 -1
  34. package/lib/dist/db/sqlite-adapter.d.ts +7 -5
  35. package/lib/dist/db/sqlite-adapter.d.ts.map +1 -1
  36. package/lib/dist/db/sqlite-adapter.js +11 -9
  37. package/lib/dist/db/sqlite-adapter.js.map +1 -1
  38. package/lib/dist/enforce/changed-files.d.ts +39 -0
  39. package/lib/dist/enforce/changed-files.d.ts.map +1 -0
  40. package/lib/dist/enforce/changed-files.js +114 -0
  41. package/lib/dist/enforce/changed-files.js.map +1 -0
  42. package/lib/dist/enforce/enforce.d.ts +53 -2
  43. package/lib/dist/enforce/enforce.d.ts.map +1 -1
  44. package/lib/dist/enforce/enforce.js +95 -8
  45. package/lib/dist/enforce/enforce.js.map +1 -1
  46. package/lib/dist/enforce/mutation.d.ts +46 -0
  47. package/lib/dist/enforce/mutation.d.ts.map +1 -0
  48. package/lib/dist/enforce/mutation.js +104 -0
  49. package/lib/dist/enforce/mutation.js.map +1 -0
  50. package/lib/dist/enforce/suppressions.d.ts +33 -0
  51. package/lib/dist/enforce/suppressions.d.ts.map +1 -0
  52. package/lib/dist/enforce/suppressions.js +159 -0
  53. package/lib/dist/enforce/suppressions.js.map +1 -0
  54. package/lib/dist/extraction/grammars.d.ts +10 -0
  55. package/lib/dist/extraction/grammars.d.ts.map +1 -1
  56. package/lib/dist/extraction/grammars.js +32 -3
  57. package/lib/dist/extraction/grammars.js.map +1 -1
  58. package/lib/dist/extraction/index.d.ts +7 -0
  59. package/lib/dist/extraction/index.d.ts.map +1 -1
  60. package/lib/dist/extraction/index.js.map +1 -1
  61. package/lib/dist/extraction/specs/markdown-spec-extractor.d.ts +7 -0
  62. package/lib/dist/extraction/specs/markdown-spec-extractor.d.ts.map +1 -1
  63. package/lib/dist/extraction/specs/markdown-spec-extractor.js +97 -10
  64. package/lib/dist/extraction/specs/markdown-spec-extractor.js.map +1 -1
  65. package/lib/dist/extraction/wasm/tree-sitter-pascal.wasm.gz +0 -0
  66. package/lib/dist/extraction/wasm/tree-sitter-scala.wasm.gz +0 -0
  67. package/lib/dist/graph/spec-coverage.d.ts +142 -0
  68. package/lib/dist/graph/spec-coverage.d.ts.map +1 -0
  69. package/lib/dist/graph/spec-coverage.js +276 -0
  70. package/lib/dist/graph/spec-coverage.js.map +1 -0
  71. package/lib/dist/health/smoke-check.js +2 -2
  72. package/lib/dist/health/smoke-check.js.map +1 -1
  73. package/lib/dist/index.d.ts +75 -7
  74. package/lib/dist/index.d.ts.map +1 -1
  75. package/lib/dist/index.js +191 -23
  76. package/lib/dist/index.js.map +1 -1
  77. package/lib/dist/installer/gemini-commands.d.ts +107 -0
  78. package/lib/dist/installer/gemini-commands.d.ts.map +1 -0
  79. package/lib/dist/installer/gemini-commands.js +264 -0
  80. package/lib/dist/installer/gemini-commands.js.map +1 -0
  81. package/lib/dist/installer/index.d.ts +55 -8
  82. package/lib/dist/installer/index.d.ts.map +1 -1
  83. package/lib/dist/installer/index.js +72 -53
  84. package/lib/dist/installer/index.js.map +1 -1
  85. package/lib/dist/installer/init-offer.d.ts +14 -9
  86. package/lib/dist/installer/init-offer.d.ts.map +1 -1
  87. package/lib/dist/installer/init-offer.js +13 -9
  88. package/lib/dist/installer/init-offer.js.map +1 -1
  89. package/lib/dist/installer/install-defaults.d.ts +81 -0
  90. package/lib/dist/installer/install-defaults.d.ts.map +1 -0
  91. package/lib/dist/installer/install-defaults.js +95 -0
  92. package/lib/dist/installer/install-defaults.js.map +1 -0
  93. package/lib/dist/installer/instructions-template.d.ts +22 -0
  94. package/lib/dist/installer/instructions-template.d.ts.map +1 -1
  95. package/lib/dist/installer/instructions-template.js +37 -1
  96. package/lib/dist/installer/instructions-template.js.map +1 -1
  97. package/lib/dist/installer/targets/claude.d.ts +18 -0
  98. package/lib/dist/installer/targets/claude.d.ts.map +1 -1
  99. package/lib/dist/installer/targets/claude.js +70 -23
  100. package/lib/dist/installer/targets/claude.js.map +1 -1
  101. package/lib/dist/installer/targets/gemini.d.ts +85 -12
  102. package/lib/dist/installer/targets/gemini.d.ts.map +1 -1
  103. package/lib/dist/installer/targets/gemini.js +527 -30
  104. package/lib/dist/installer/targets/gemini.js.map +1 -1
  105. package/lib/dist/installer/targets/shared.d.ts +13 -0
  106. package/lib/dist/installer/targets/shared.d.ts.map +1 -1
  107. package/lib/dist/installer/targets/shared.js +22 -4
  108. package/lib/dist/installer/targets/shared.js.map +1 -1
  109. package/lib/dist/installer/targets/types.d.ts +12 -0
  110. package/lib/dist/installer/targets/types.d.ts.map +1 -1
  111. package/lib/dist/jira/auto-publish.d.ts +71 -4
  112. package/lib/dist/jira/auto-publish.d.ts.map +1 -1
  113. package/lib/dist/jira/auto-publish.js +186 -17
  114. package/lib/dist/jira/auto-publish.js.map +1 -1
  115. package/lib/dist/jira/reconcile.d.ts +24 -1
  116. package/lib/dist/jira/reconcile.d.ts.map +1 -1
  117. package/lib/dist/jira/reconcile.js +46 -2
  118. package/lib/dist/jira/reconcile.js.map +1 -1
  119. package/lib/dist/jira/repo-config.d.ts +9 -0
  120. package/lib/dist/jira/repo-config.d.ts.map +1 -1
  121. package/lib/dist/jira/repo-config.js +11 -0
  122. package/lib/dist/jira/repo-config.js.map +1 -1
  123. package/lib/dist/jira/types.d.ts +7 -0
  124. package/lib/dist/jira/types.d.ts.map +1 -1
  125. package/lib/dist/jira/types.js.map +1 -1
  126. package/lib/dist/knowledge/enforce.d.ts +75 -0
  127. package/lib/dist/knowledge/enforce.d.ts.map +1 -0
  128. package/lib/dist/knowledge/enforce.js +250 -0
  129. package/lib/dist/knowledge/enforce.js.map +1 -0
  130. package/lib/dist/knowledge/facts.d.ts +33 -0
  131. package/lib/dist/knowledge/facts.d.ts.map +1 -0
  132. package/lib/dist/knowledge/facts.js +117 -0
  133. package/lib/dist/knowledge/facts.js.map +1 -0
  134. package/lib/dist/knowledge/proposals.d.ts +88 -0
  135. package/lib/dist/knowledge/proposals.d.ts.map +1 -0
  136. package/lib/dist/knowledge/proposals.js +360 -0
  137. package/lib/dist/knowledge/proposals.js.map +1 -0
  138. package/lib/dist/knowledge/stale.d.ts +64 -0
  139. package/lib/dist/knowledge/stale.d.ts.map +1 -0
  140. package/lib/dist/knowledge/stale.js +174 -0
  141. package/lib/dist/knowledge/stale.js.map +1 -0
  142. package/lib/dist/mcp/fitness-tool.d.ts +5 -6
  143. package/lib/dist/mcp/fitness-tool.d.ts.map +1 -1
  144. package/lib/dist/mcp/fitness-tool.js +0 -16
  145. package/lib/dist/mcp/fitness-tool.js.map +1 -1
  146. package/lib/dist/mcp/gemini-session.d.ts +50 -0
  147. package/lib/dist/mcp/gemini-session.d.ts.map +1 -0
  148. package/lib/dist/mcp/gemini-session.js +159 -0
  149. package/lib/dist/mcp/gemini-session.js.map +1 -0
  150. package/lib/dist/mcp/health-tool.d.ts +26 -0
  151. package/lib/dist/mcp/health-tool.d.ts.map +1 -0
  152. package/lib/dist/mcp/health-tool.js +50 -0
  153. package/lib/dist/mcp/health-tool.js.map +1 -0
  154. package/lib/dist/mcp/jira-tools.d.ts.map +1 -1
  155. package/lib/dist/mcp/jira-tools.js +25 -0
  156. package/lib/dist/mcp/jira-tools.js.map +1 -1
  157. package/lib/dist/mcp/maintainability-tool.d.ts +5 -7
  158. package/lib/dist/mcp/maintainability-tool.d.ts.map +1 -1
  159. package/lib/dist/mcp/maintainability-tool.js +0 -16
  160. package/lib/dist/mcp/maintainability-tool.js.map +1 -1
  161. package/lib/dist/mcp/model-context.d.ts +31 -7
  162. package/lib/dist/mcp/model-context.d.ts.map +1 -1
  163. package/lib/dist/mcp/model-context.js +70 -21
  164. package/lib/dist/mcp/model-context.js.map +1 -1
  165. package/lib/dist/mcp/proxy.d.ts.map +1 -1
  166. package/lib/dist/mcp/proxy.js +5 -2
  167. package/lib/dist/mcp/proxy.js.map +1 -1
  168. package/lib/dist/mcp/server-instructions.d.ts +16 -15
  169. package/lib/dist/mcp/server-instructions.d.ts.map +1 -1
  170. package/lib/dist/mcp/server-instructions.js +72 -5
  171. package/lib/dist/mcp/server-instructions.js.map +1 -1
  172. package/lib/dist/mcp/session.js +1 -1
  173. package/lib/dist/mcp/session.js.map +1 -1
  174. package/lib/dist/mcp/spec-tools.d.ts +9 -1
  175. package/lib/dist/mcp/spec-tools.d.ts.map +1 -1
  176. package/lib/dist/mcp/spec-tools.js +282 -49
  177. package/lib/dist/mcp/spec-tools.js.map +1 -1
  178. package/lib/dist/mcp/tools.d.ts +49 -9
  179. package/lib/dist/mcp/tools.d.ts.map +1 -1
  180. package/lib/dist/mcp/tools.js +210 -58
  181. package/lib/dist/mcp/tools.js.map +1 -1
  182. package/lib/dist/pulse/pulse.d.ts +93 -0
  183. package/lib/dist/pulse/pulse.d.ts.map +1 -0
  184. package/lib/dist/pulse/pulse.js +401 -0
  185. package/lib/dist/pulse/pulse.js.map +1 -0
  186. package/lib/dist/reflect/apply.d.ts.map +1 -1
  187. package/lib/dist/reflect/apply.js +38 -3
  188. package/lib/dist/reflect/apply.js.map +1 -1
  189. package/lib/dist/reflect/auto-sweep.d.ts +26 -0
  190. package/lib/dist/reflect/auto-sweep.d.ts.map +1 -0
  191. package/lib/dist/reflect/auto-sweep.js +90 -0
  192. package/lib/dist/reflect/auto-sweep.js.map +1 -0
  193. package/lib/dist/reflect/cli.d.ts +62 -0
  194. package/lib/dist/reflect/cli.d.ts.map +1 -0
  195. package/lib/dist/reflect/cli.js +163 -0
  196. package/lib/dist/reflect/cli.js.map +1 -0
  197. package/lib/dist/reflect/miner.d.ts.map +1 -1
  198. package/lib/dist/reflect/miner.js +119 -0
  199. package/lib/dist/reflect/miner.js.map +1 -1
  200. package/lib/dist/reflect/sweep.d.ts +1 -0
  201. package/lib/dist/reflect/sweep.d.ts.map +1 -1
  202. package/lib/dist/reflect/sweep.js +62 -13
  203. package/lib/dist/reflect/sweep.js.map +1 -1
  204. package/lib/dist/reflect/targets.d.ts +2 -0
  205. package/lib/dist/reflect/targets.d.ts.map +1 -1
  206. package/lib/dist/reflect/targets.js +33 -0
  207. package/lib/dist/reflect/targets.js.map +1 -1
  208. package/lib/dist/reflect/types.d.ts +19 -2
  209. package/lib/dist/reflect/types.d.ts.map +1 -1
  210. package/lib/dist/resolution/spec-link-resolver.d.ts +44 -2
  211. package/lib/dist/resolution/spec-link-resolver.d.ts.map +1 -1
  212. package/lib/dist/resolution/spec-link-resolver.js +132 -0
  213. package/lib/dist/resolution/spec-link-resolver.js.map +1 -1
  214. package/lib/dist/resolution/test-title-links.d.ts +62 -0
  215. package/lib/dist/resolution/test-title-links.d.ts.map +1 -0
  216. package/lib/dist/resolution/test-title-links.js +97 -0
  217. package/lib/dist/resolution/test-title-links.js.map +1 -0
  218. package/lib/dist/search/query-parser.d.ts.map +1 -1
  219. package/lib/dist/search/query-parser.js +6 -1
  220. package/lib/dist/search/query-parser.js.map +1 -1
  221. package/lib/dist/server/project-registry.js +1 -1
  222. package/lib/dist/server/routes/claude.js +24 -43
  223. package/lib/dist/server/routes/graph.js +53 -7
  224. package/lib/dist/server/routes/knowledge.js +118 -0
  225. package/lib/dist/server/routes/mcp.js +4 -3
  226. package/lib/dist/server/routes/projects.js +4 -4
  227. package/lib/dist/server/routes/spec.js +49 -7
  228. package/lib/dist/server/server.js +31 -17
  229. package/lib/dist/skills/spec-author/SKILL.md +164 -0
  230. package/lib/dist/skills/spec-author/references/format.md +210 -0
  231. package/lib/dist/skills/spec-author/references/gap-questions.md +152 -0
  232. package/lib/dist/skills/spec-author/references/quality-rubric.md +125 -0
  233. package/lib/dist/skills/spec-author/references/review-checklist.md +175 -0
  234. package/lib/dist/spec-lint/lint.d.ts +82 -0
  235. package/lib/dist/spec-lint/lint.d.ts.map +1 -0
  236. package/lib/dist/spec-lint/lint.js +491 -0
  237. package/lib/dist/spec-lint/lint.js.map +1 -0
  238. package/lib/dist/spec-quality/criterion-ids.d.ts +13 -0
  239. package/lib/dist/spec-quality/criterion-ids.d.ts.map +1 -0
  240. package/lib/dist/spec-quality/criterion-ids.js +38 -0
  241. package/lib/dist/spec-quality/criterion-ids.js.map +1 -0
  242. package/lib/dist/spec-quality/evidence-kind.d.ts +54 -0
  243. package/lib/dist/spec-quality/evidence-kind.d.ts.map +1 -0
  244. package/lib/dist/spec-quality/evidence-kind.js +183 -0
  245. package/lib/dist/spec-quality/evidence-kind.js.map +1 -0
  246. package/lib/dist/spec-quality/link-persist.d.ts +65 -0
  247. package/lib/dist/spec-quality/link-persist.d.ts.map +1 -0
  248. package/lib/dist/spec-quality/link-persist.js +249 -0
  249. package/lib/dist/spec-quality/link-persist.js.map +1 -0
  250. package/lib/dist/spec-quality/plan-scope.d.ts +38 -0
  251. package/lib/dist/spec-quality/plan-scope.d.ts.map +1 -0
  252. package/lib/dist/spec-quality/plan-scope.js +129 -0
  253. package/lib/dist/spec-quality/plan-scope.js.map +1 -0
  254. package/lib/dist/spec-quality/postcheck.d.ts +85 -0
  255. package/lib/dist/spec-quality/postcheck.d.ts.map +1 -0
  256. package/lib/dist/spec-quality/postcheck.js +390 -0
  257. package/lib/dist/spec-quality/postcheck.js.map +1 -0
  258. package/lib/dist/spec-quality/readiness.d.ts +72 -0
  259. package/lib/dist/spec-quality/readiness.d.ts.map +1 -0
  260. package/lib/dist/spec-quality/readiness.js +226 -0
  261. package/lib/dist/spec-quality/readiness.js.map +1 -0
  262. package/lib/dist/statusline/index.js.map +1 -1
  263. package/lib/dist/statusline/render.d.ts +1 -1
  264. package/lib/dist/statusline/render.d.ts.map +1 -1
  265. package/lib/dist/statusline/render.js +3 -1
  266. package/lib/dist/statusline/render.js.map +1 -1
  267. package/lib/dist/ui/assets/index-BzuUWUAE.js +50 -0
  268. package/lib/dist/ui/index.html +1 -1
  269. package/lib/dist/verify/report-ingest.d.ts +88 -0
  270. package/lib/dist/verify/report-ingest.d.ts.map +1 -0
  271. package/lib/dist/verify/report-ingest.js +269 -0
  272. package/lib/dist/verify/report-ingest.js.map +1 -0
  273. package/lib/dist/workflows/agents/claude.d.ts +16 -0
  274. package/lib/dist/workflows/agents/claude.d.ts.map +1 -0
  275. package/lib/dist/workflows/agents/claude.js +82 -0
  276. package/lib/dist/workflows/agents/claude.js.map +1 -0
  277. package/lib/dist/workflows/agents/gemini.d.ts +21 -0
  278. package/lib/dist/workflows/agents/gemini.d.ts.map +1 -0
  279. package/lib/dist/workflows/agents/gemini.js +124 -0
  280. package/lib/dist/workflows/agents/gemini.js.map +1 -0
  281. package/lib/dist/workflows/agents/index.d.ts +28 -0
  282. package/lib/dist/workflows/agents/index.d.ts.map +1 -0
  283. package/lib/dist/workflows/agents/index.js +104 -0
  284. package/lib/dist/workflows/agents/index.js.map +1 -0
  285. package/lib/dist/workflows/agents/types.d.ts +55 -0
  286. package/lib/dist/workflows/agents/types.d.ts.map +1 -0
  287. package/lib/dist/workflows/agents/types.js +46 -0
  288. package/lib/dist/workflows/agents/types.js.map +1 -0
  289. package/lib/dist/workflows/batch.d.ts +63 -0
  290. package/lib/dist/workflows/batch.d.ts.map +1 -0
  291. package/lib/dist/workflows/batch.js +151 -0
  292. package/lib/dist/workflows/batch.js.map +1 -0
  293. package/lib/dist/workflows/defaults/claude-design-implement.yaml +3 -4
  294. package/lib/dist/workflows/defaults/spec-author.yaml +11 -9
  295. package/lib/dist/workflows/defaults/spec-fix.yaml +103 -12
  296. package/lib/dist/workflows/defaults/spec-implement-mixed.yaml +21 -193
  297. package/lib/dist/workflows/defaults/spec-implement.yaml +701 -41
  298. package/lib/dist/workflows/defaults/spec-verify.yaml +60 -9
  299. package/lib/dist/workflows/discovery.d.ts +13 -0
  300. package/lib/dist/workflows/discovery.d.ts.map +1 -1
  301. package/lib/dist/workflows/discovery.js +79 -17
  302. package/lib/dist/workflows/discovery.js.map +1 -1
  303. package/lib/dist/workflows/executor.d.ts +18 -0
  304. package/lib/dist/workflows/executor.d.ts.map +1 -1
  305. package/lib/dist/workflows/executor.js +130 -33
  306. package/lib/dist/workflows/executor.js.map +1 -1
  307. package/lib/dist/workflows/gc.d.ts +50 -0
  308. package/lib/dist/workflows/gc.d.ts.map +1 -0
  309. package/lib/dist/workflows/gc.js +120 -0
  310. package/lib/dist/workflows/gc.js.map +1 -0
  311. package/lib/dist/workflows/merge-queue.d.ts +64 -0
  312. package/lib/dist/workflows/merge-queue.d.ts.map +1 -0
  313. package/lib/dist/workflows/merge-queue.js +162 -0
  314. package/lib/dist/workflows/merge-queue.js.map +1 -0
  315. package/lib/dist/workflows/runners/approval.d.ts +1 -1
  316. package/lib/dist/workflows/runners/approval.d.ts.map +1 -1
  317. package/lib/dist/workflows/runners/approval.js +11 -2
  318. package/lib/dist/workflows/runners/approval.js.map +1 -1
  319. package/lib/dist/workflows/runners/bash.d.ts +15 -0
  320. package/lib/dist/workflows/runners/bash.d.ts.map +1 -1
  321. package/lib/dist/workflows/runners/bash.js +50 -1
  322. package/lib/dist/workflows/runners/bash.js.map +1 -1
  323. package/lib/dist/workflows/runners/prompt.d.ts +16 -41
  324. package/lib/dist/workflows/runners/prompt.d.ts.map +1 -1
  325. package/lib/dist/workflows/runners/prompt.js +55 -120
  326. package/lib/dist/workflows/runners/prompt.js.map +1 -1
  327. package/lib/dist/workflows/runners/types.d.ts +12 -0
  328. package/lib/dist/workflows/runners/types.d.ts.map +1 -1
  329. package/lib/dist/workflows/schemas/workflow.d.ts +17 -0
  330. package/lib/dist/workflows/schemas/workflow.d.ts.map +1 -1
  331. package/lib/dist/workflows/schemas/workflow.js +27 -0
  332. package/lib/dist/workflows/schemas/workflow.js.map +1 -1
  333. package/lib/node_modules/.package-lock.json +1 -1
  334. package/lib/package.json +8 -4
  335. package/package.json +5 -3
  336. package/lib/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
  337. package/lib/dist/extraction/wasm/tree-sitter-scala.wasm +0 -0
  338. package/lib/dist/server/ingest/impact-query.js +0 -343
  339. package/lib/dist/server/routes/events.js +0 -152
  340. package/lib/dist/ui/assets/index-CjjaftDw.js +0 -50
  341. package/node.exe +0 -4
@@ -1,50 +0,0 @@
1
- (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))s(l);new MutationObserver(l=>{for(const o of l)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&s(a)}).observe(document,{childList:!0,subtree:!0});function n(l){const o={};return l.integrity&&(o.integrity=l.integrity),l.referrerPolicy&&(o.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?o.credentials="include":l.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(l){if(l.ep)return;l.ep=!0;const o=n(l);fetch(l.href,o)}})();function Mp(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Kc={exports:{}},ol={},Qc={exports:{}},B={};/**
2
- * @license React
3
- * react.production.min.js
4
- *
5
- * Copyright (c) Facebook, Inc. and its affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var Ar=Symbol.for("react.element"),Rp=Symbol.for("react.portal"),Pp=Symbol.for("react.fragment"),Lp=Symbol.for("react.strict_mode"),Dp=Symbol.for("react.profiler"),Ip=Symbol.for("react.provider"),Op=Symbol.for("react.context"),Ap=Symbol.for("react.forward_ref"),Bp=Symbol.for("react.suspense"),Wp=Symbol.for("react.memo"),$p=Symbol.for("react.lazy"),xi=Symbol.iterator;function Fp(e){return e===null||typeof e!="object"?null:(e=xi&&e[xi]||e["@@iterator"],typeof e=="function"?e:null)}var Yc={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Gc=Object.assign,qc={};function Kn(e,t,n){this.props=e,this.context=t,this.refs=qc,this.updater=n||Yc}Kn.prototype.isReactComponent={};Kn.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Kn.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Xc(){}Xc.prototype=Kn.prototype;function da(e,t,n){this.props=e,this.context=t,this.refs=qc,this.updater=n||Yc}var ua=da.prototype=new Xc;ua.constructor=da;Gc(ua,Kn.prototype);ua.isPureReactComponent=!0;var gi=Array.isArray,Jc=Object.prototype.hasOwnProperty,pa={current:null},Zc={key:!0,ref:!0,__self:!0,__source:!0};function ed(e,t,n){var s,l={},o=null,a=null;if(t!=null)for(s in t.ref!==void 0&&(a=t.ref),t.key!==void 0&&(o=""+t.key),t)Jc.call(t,s)&&!Zc.hasOwnProperty(s)&&(l[s]=t[s]);var i=arguments.length-2;if(i===1)l.children=n;else if(1<i){for(var c=Array(i),d=0;d<i;d++)c[d]=arguments[d+2];l.children=c}if(e&&e.defaultProps)for(s in i=e.defaultProps,i)l[s]===void 0&&(l[s]=i[s]);return{$$typeof:Ar,type:e,key:o,ref:a,props:l,_owner:pa.current}}function Hp(e,t){return{$$typeof:Ar,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function fa(e){return typeof e=="object"&&e!==null&&e.$$typeof===Ar}function Up(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var vi=/\/+/g;function Ml(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Up(""+e.key):t.toString(36)}function js(e,t,n,s,l){var o=typeof e;(o==="undefined"||o==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(o){case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case Ar:case Rp:a=!0}}if(a)return a=e,l=l(a),e=s===""?"."+Ml(a,0):s,gi(l)?(n="",e!=null&&(n=e.replace(vi,"$&/")+"/"),js(l,t,n,"",function(d){return d})):l!=null&&(fa(l)&&(l=Hp(l,n+(!l.key||a&&a.key===l.key?"":(""+l.key).replace(vi,"$&/")+"/")+e)),t.push(l)),1;if(a=0,s=s===""?".":s+":",gi(e))for(var i=0;i<e.length;i++){o=e[i];var c=s+Ml(o,i);a+=js(o,t,n,c,l)}else if(c=Fp(e),typeof c=="function")for(e=c.call(e),i=0;!(o=e.next()).done;)o=o.value,c=s+Ml(o,i++),a+=js(o,t,n,c,l);else if(o==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return a}function Kr(e,t,n){if(e==null)return e;var s=[],l=0;return js(e,s,"","",function(o){return t.call(n,o,l++)}),s}function Vp(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var be={current:null},ws={transition:null},Kp={ReactCurrentDispatcher:be,ReactCurrentBatchConfig:ws,ReactCurrentOwner:pa};function td(){throw Error("act(...) is not supported in production builds of React.")}B.Children={map:Kr,forEach:function(e,t,n){Kr(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Kr(e,function(){t++}),t},toArray:function(e){return Kr(e,function(t){return t})||[]},only:function(e){if(!fa(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};B.Component=Kn;B.Fragment=Pp;B.Profiler=Dp;B.PureComponent=da;B.StrictMode=Lp;B.Suspense=Bp;B.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Kp;B.act=td;B.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var s=Gc({},e.props),l=e.key,o=e.ref,a=e._owner;if(t!=null){if(t.ref!==void 0&&(o=t.ref,a=pa.current),t.key!==void 0&&(l=""+t.key),e.type&&e.type.defaultProps)var i=e.type.defaultProps;for(c in t)Jc.call(t,c)&&!Zc.hasOwnProperty(c)&&(s[c]=t[c]===void 0&&i!==void 0?i[c]:t[c])}var c=arguments.length-2;if(c===1)s.children=n;else if(1<c){i=Array(c);for(var d=0;d<c;d++)i[d]=arguments[d+2];s.children=i}return{$$typeof:Ar,type:e.type,key:l,ref:o,props:s,_owner:a}};B.createContext=function(e){return e={$$typeof:Op,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:Ip,_context:e},e.Consumer=e};B.createElement=ed;B.createFactory=function(e){var t=ed.bind(null,e);return t.type=e,t};B.createRef=function(){return{current:null}};B.forwardRef=function(e){return{$$typeof:Ap,render:e}};B.isValidElement=fa;B.lazy=function(e){return{$$typeof:$p,_payload:{_status:-1,_result:e},_init:Vp}};B.memo=function(e,t){return{$$typeof:Wp,type:e,compare:t===void 0?null:t}};B.startTransition=function(e){var t=ws.transition;ws.transition={};try{e()}finally{ws.transition=t}};B.unstable_act=td;B.useCallback=function(e,t){return be.current.useCallback(e,t)};B.useContext=function(e){return be.current.useContext(e)};B.useDebugValue=function(){};B.useDeferredValue=function(e){return be.current.useDeferredValue(e)};B.useEffect=function(e,t){return be.current.useEffect(e,t)};B.useId=function(){return be.current.useId()};B.useImperativeHandle=function(e,t,n){return be.current.useImperativeHandle(e,t,n)};B.useInsertionEffect=function(e,t){return be.current.useInsertionEffect(e,t)};B.useLayoutEffect=function(e,t){return be.current.useLayoutEffect(e,t)};B.useMemo=function(e,t){return be.current.useMemo(e,t)};B.useReducer=function(e,t,n){return be.current.useReducer(e,t,n)};B.useRef=function(e){return be.current.useRef(e)};B.useState=function(e){return be.current.useState(e)};B.useSyncExternalStore=function(e,t,n){return be.current.useSyncExternalStore(e,t,n)};B.useTransition=function(){return be.current.useTransition()};B.version="18.3.1";Qc.exports=B;var z=Qc.exports;const Qp=Mp(z);/**
10
- * @license React
11
- * react-jsx-runtime.production.min.js
12
- *
13
- * Copyright (c) Facebook, Inc. and its affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */var Yp=z,Gp=Symbol.for("react.element"),qp=Symbol.for("react.fragment"),Xp=Object.prototype.hasOwnProperty,Jp=Yp.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Zp={key:!0,ref:!0,__self:!0,__source:!0};function nd(e,t,n){var s,l={},o=null,a=null;n!==void 0&&(o=""+n),t.key!==void 0&&(o=""+t.key),t.ref!==void 0&&(a=t.ref);for(s in t)Xp.call(t,s)&&!Zp.hasOwnProperty(s)&&(l[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)l[s]===void 0&&(l[s]=t[s]);return{$$typeof:Gp,type:e,key:o,ref:a,props:l,_owner:Jp.current}}ol.Fragment=qp;ol.jsx=nd;ol.jsxs=nd;Kc.exports=ol;var r=Kc.exports,uo={},rd={exports:{}},Ae={},sd={exports:{}},ld={};/**
18
- * @license React
19
- * scheduler.production.min.js
20
- *
21
- * Copyright (c) Facebook, Inc. and its affiliates.
22
- *
23
- * This source code is licensed under the MIT license found in the
24
- * LICENSE file in the root directory of this source tree.
25
- */(function(e){function t(k,E){var M=k.length;k.push(E);e:for(;0<M;){var L=M-1>>>1,I=k[L];if(0<l(I,E))k[L]=E,k[M]=I,M=L;else break e}}function n(k){return k.length===0?null:k[0]}function s(k){if(k.length===0)return null;var E=k[0],M=k.pop();if(M!==E){k[0]=M;e:for(var L=0,I=k.length,H=I>>>1;L<H;){var K=2*(L+1)-1,fe=k[K],ge=K+1,ze=k[ge];if(0>l(fe,M))ge<I&&0>l(ze,fe)?(k[L]=ze,k[ge]=M,L=ge):(k[L]=fe,k[K]=M,L=K);else if(ge<I&&0>l(ze,M))k[L]=ze,k[ge]=M,L=ge;else break e}}return E}function l(k,E){var M=k.sortIndex-E.sortIndex;return M!==0?M:k.id-E.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var a=Date,i=a.now();e.unstable_now=function(){return a.now()-i}}var c=[],d=[],u=1,f=null,m=3,g=!1,v=!1,p=!1,w=typeof setTimeout=="function"?setTimeout:null,h=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function j(k){for(var E=n(d);E!==null;){if(E.callback===null)s(d);else if(E.startTime<=k)s(d),E.sortIndex=E.expirationTime,t(c,E);else break;E=n(d)}}function y(k){if(p=!1,j(k),!v)if(n(c)!==null)v=!0,ut(S);else{var E=n(d);E!==null&&st(y,E.startTime-k)}}function S(k,E){v=!1,p&&(p=!1,h(_),_=-1),g=!0;var M=m;try{for(j(E),f=n(c);f!==null&&(!(f.expirationTime>E)||k&&!oe());){var L=f.callback;if(typeof L=="function"){f.callback=null,m=f.priorityLevel;var I=L(f.expirationTime<=E);E=e.unstable_now(),typeof I=="function"?f.callback=I:f===n(c)&&s(c),j(E)}else s(c);f=n(c)}if(f!==null)var H=!0;else{var K=n(d);K!==null&&st(y,K.startTime-E),H=!1}return H}finally{f=null,m=M,g=!1}}var b=!1,C=null,_=-1,W=5,O=-1;function oe(){return!(e.unstable_now()-O<W)}function nt(){if(C!==null){var k=e.unstable_now();O=k;var E=!0;try{E=C(!0,k)}finally{E?Qe():(b=!1,C=null)}}else b=!1}var Qe;if(typeof x=="function")Qe=function(){x(nt)};else if(typeof MessageChannel<"u"){var rt=new MessageChannel,pn=rt.port2;rt.port1.onmessage=nt,Qe=function(){pn.postMessage(null)}}else Qe=function(){w(nt,0)};function ut(k){C=k,b||(b=!0,Qe())}function st(k,E){_=w(function(){k(e.unstable_now())},E)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(k){k.callback=null},e.unstable_continueExecution=function(){v||g||(v=!0,ut(S))},e.unstable_forceFrameRate=function(k){0>k||125<k?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):W=0<k?Math.floor(1e3/k):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(k){switch(m){case 1:case 2:case 3:var E=3;break;default:E=m}var M=m;m=E;try{return k()}finally{m=M}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(k,E){switch(k){case 1:case 2:case 3:case 4:case 5:break;default:k=3}var M=m;m=k;try{return E()}finally{m=M}},e.unstable_scheduleCallback=function(k,E,M){var L=e.unstable_now();switch(typeof M=="object"&&M!==null?(M=M.delay,M=typeof M=="number"&&0<M?L+M:L):M=L,k){case 1:var I=-1;break;case 2:I=250;break;case 5:I=1073741823;break;case 4:I=1e4;break;default:I=5e3}return I=M+I,k={id:u++,callback:E,priorityLevel:k,startTime:M,expirationTime:I,sortIndex:-1},M>L?(k.sortIndex=M,t(d,k),n(c)===null&&k===n(d)&&(p?(h(_),_=-1):p=!0,st(y,M-L))):(k.sortIndex=I,t(c,k),v||g||(v=!0,ut(S))),k},e.unstable_shouldYield=oe,e.unstable_wrapCallback=function(k){var E=m;return function(){var M=m;m=E;try{return k.apply(this,arguments)}finally{m=M}}}})(ld);sd.exports=ld;var ef=sd.exports;/**
26
- * @license React
27
- * react-dom.production.min.js
28
- *
29
- * Copyright (c) Facebook, Inc. and its affiliates.
30
- *
31
- * This source code is licensed under the MIT license found in the
32
- * LICENSE file in the root directory of this source tree.
33
- */var tf=z,Oe=ef;function T(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var od=new Set,yr={};function dn(e,t){On(e,t),On(e+"Capture",t)}function On(e,t){for(yr[e]=t,e=0;e<t.length;e++)od.add(t[e])}var gt=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),po=Object.prototype.hasOwnProperty,nf=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,yi={},ji={};function rf(e){return po.call(ji,e)?!0:po.call(yi,e)?!1:nf.test(e)?ji[e]=!0:(yi[e]=!0,!1)}function sf(e,t,n,s){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return s?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function lf(e,t,n,s){if(t===null||typeof t>"u"||sf(e,t,n,s))return!0;if(s)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Ne(e,t,n,s,l,o,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=s,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=a}var xe={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){xe[e]=new Ne(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];xe[t]=new Ne(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){xe[e]=new Ne(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){xe[e]=new Ne(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){xe[e]=new Ne(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){xe[e]=new Ne(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){xe[e]=new Ne(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){xe[e]=new Ne(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){xe[e]=new Ne(e,5,!1,e.toLowerCase(),null,!1,!1)});var ha=/[\-:]([a-z])/g;function ma(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(ha,ma);xe[t]=new Ne(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(ha,ma);xe[t]=new Ne(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(ha,ma);xe[t]=new Ne(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){xe[e]=new Ne(e,1,!1,e.toLowerCase(),null,!1,!1)});xe.xlinkHref=new Ne("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){xe[e]=new Ne(e,1,!1,e.toLowerCase(),null,!0,!0)});function xa(e,t,n,s){var l=xe.hasOwnProperty(t)?xe[t]:null;(l!==null?l.type!==0:s||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(lf(t,n,l,s)&&(n=null),s||l===null?rf(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):l.mustUseProperty?e[l.propertyName]=n===null?l.type===3?!1:"":n:(t=l.attributeName,s=l.attributeNamespace,n===null?e.removeAttribute(t):(l=l.type,n=l===3||l===4&&n===!0?"":""+n,s?e.setAttributeNS(s,t,n):e.setAttribute(t,n))))}var wt=tf.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Qr=Symbol.for("react.element"),vn=Symbol.for("react.portal"),yn=Symbol.for("react.fragment"),ga=Symbol.for("react.strict_mode"),fo=Symbol.for("react.profiler"),ad=Symbol.for("react.provider"),id=Symbol.for("react.context"),va=Symbol.for("react.forward_ref"),ho=Symbol.for("react.suspense"),mo=Symbol.for("react.suspense_list"),ya=Symbol.for("react.memo"),kt=Symbol.for("react.lazy"),cd=Symbol.for("react.offscreen"),wi=Symbol.iterator;function Gn(e){return e===null||typeof e!="object"?null:(e=wi&&e[wi]||e["@@iterator"],typeof e=="function"?e:null)}var Z=Object.assign,Rl;function lr(e){if(Rl===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Rl=t&&t[1]||""}return`
34
- `+Rl+e}var Pl=!1;function Ll(e,t){if(!e||Pl)return"";Pl=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(d){var s=d}Reflect.construct(e,[],t)}else{try{t.call()}catch(d){s=d}e.call(t.prototype)}else{try{throw Error()}catch(d){s=d}e()}}catch(d){if(d&&s&&typeof d.stack=="string"){for(var l=d.stack.split(`
35
- `),o=s.stack.split(`
36
- `),a=l.length-1,i=o.length-1;1<=a&&0<=i&&l[a]!==o[i];)i--;for(;1<=a&&0<=i;a--,i--)if(l[a]!==o[i]){if(a!==1||i!==1)do if(a--,i--,0>i||l[a]!==o[i]){var c=`
37
- `+l[a].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=a&&0<=i);break}}}finally{Pl=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?lr(e):""}function of(e){switch(e.tag){case 5:return lr(e.type);case 16:return lr("Lazy");case 13:return lr("Suspense");case 19:return lr("SuspenseList");case 0:case 2:case 15:return e=Ll(e.type,!1),e;case 11:return e=Ll(e.type.render,!1),e;case 1:return e=Ll(e.type,!0),e;default:return""}}function xo(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case yn:return"Fragment";case vn:return"Portal";case fo:return"Profiler";case ga:return"StrictMode";case ho:return"Suspense";case mo:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case id:return(e.displayName||"Context")+".Consumer";case ad:return(e._context.displayName||"Context")+".Provider";case va:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ya:return t=e.displayName||null,t!==null?t:xo(e.type)||"Memo";case kt:t=e._payload,e=e._init;try{return xo(e(t))}catch{}}return null}function af(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return xo(t);case 8:return t===ga?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Bt(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function dd(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function cf(e){var t=dd(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),s=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var l=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(a){s=""+a,o.call(this,a)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return s},setValue:function(a){s=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Yr(e){e._valueTracker||(e._valueTracker=cf(e))}function ud(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),s="";return e&&(s=dd(e)?e.checked?"true":"false":e.value),e=s,e!==n?(t.setValue(e),!0):!1}function Ps(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function go(e,t){var n=t.checked;return Z({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Si(e,t){var n=t.defaultValue==null?"":t.defaultValue,s=t.checked!=null?t.checked:t.defaultChecked;n=Bt(t.value!=null?t.value:n),e._wrapperState={initialChecked:s,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function pd(e,t){t=t.checked,t!=null&&xa(e,"checked",t,!1)}function vo(e,t){pd(e,t);var n=Bt(t.value),s=t.type;if(n!=null)s==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(s==="submit"||s==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?yo(e,t.type,n):t.hasOwnProperty("defaultValue")&&yo(e,t.type,Bt(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function ki(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var s=t.type;if(!(s!=="submit"&&s!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function yo(e,t,n){(t!=="number"||Ps(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var or=Array.isArray;function Mn(e,t,n,s){if(e=e.options,t){t={};for(var l=0;l<n.length;l++)t["$"+n[l]]=!0;for(n=0;n<e.length;n++)l=t.hasOwnProperty("$"+e[n].value),e[n].selected!==l&&(e[n].selected=l),l&&s&&(e[n].defaultSelected=!0)}else{for(n=""+Bt(n),t=null,l=0;l<e.length;l++){if(e[l].value===n){e[l].selected=!0,s&&(e[l].defaultSelected=!0);return}t!==null||e[l].disabled||(t=e[l])}t!==null&&(t.selected=!0)}}function jo(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(T(91));return Z({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function bi(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(T(92));if(or(n)){if(1<n.length)throw Error(T(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Bt(n)}}function fd(e,t){var n=Bt(t.value),s=Bt(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),s!=null&&(e.defaultValue=""+s)}function Ni(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function hd(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function wo(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?hd(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Gr,md=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,s,l){MSApp.execUnsafeLocalFunction(function(){return e(t,n,s,l)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Gr=Gr||document.createElement("div"),Gr.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Gr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function jr(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var dr={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},df=["Webkit","ms","Moz","O"];Object.keys(dr).forEach(function(e){df.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),dr[t]=dr[e]})});function xd(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||dr.hasOwnProperty(e)&&dr[e]?(""+t).trim():t+"px"}function gd(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var s=n.indexOf("--")===0,l=xd(n,t[n],s);n==="float"&&(n="cssFloat"),s?e.setProperty(n,l):e[n]=l}}var uf=Z({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function So(e,t){if(t){if(uf[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(T(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(T(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(T(61))}if(t.style!=null&&typeof t.style!="object")throw Error(T(62))}}function ko(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var bo=null;function ja(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var No=null,Rn=null,Pn=null;function zi(e){if(e=$r(e)){if(typeof No!="function")throw Error(T(280));var t=e.stateNode;t&&(t=ul(t),No(e.stateNode,e.type,t))}}function vd(e){Rn?Pn?Pn.push(e):Pn=[e]:Rn=e}function yd(){if(Rn){var e=Rn,t=Pn;if(Pn=Rn=null,zi(e),t)for(e=0;e<t.length;e++)zi(t[e])}}function jd(e,t){return e(t)}function wd(){}var Dl=!1;function Sd(e,t,n){if(Dl)return e(t,n);Dl=!0;try{return jd(e,t,n)}finally{Dl=!1,(Rn!==null||Pn!==null)&&(wd(),yd())}}function wr(e,t){var n=e.stateNode;if(n===null)return null;var s=ul(n);if(s===null)return null;n=s[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(T(231,t,typeof n));return n}var zo=!1;if(gt)try{var qn={};Object.defineProperty(qn,"passive",{get:function(){zo=!0}}),window.addEventListener("test",qn,qn),window.removeEventListener("test",qn,qn)}catch{zo=!1}function pf(e,t,n,s,l,o,a,i,c){var d=Array.prototype.slice.call(arguments,3);try{t.apply(n,d)}catch(u){this.onError(u)}}var ur=!1,Ls=null,Ds=!1,Co=null,ff={onError:function(e){ur=!0,Ls=e}};function hf(e,t,n,s,l,o,a,i,c){ur=!1,Ls=null,pf.apply(ff,arguments)}function mf(e,t,n,s,l,o,a,i,c){if(hf.apply(this,arguments),ur){if(ur){var d=Ls;ur=!1,Ls=null}else throw Error(T(198));Ds||(Ds=!0,Co=d)}}function un(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function kd(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function Ci(e){if(un(e)!==e)throw Error(T(188))}function xf(e){var t=e.alternate;if(!t){if(t=un(e),t===null)throw Error(T(188));return t!==e?null:e}for(var n=e,s=t;;){var l=n.return;if(l===null)break;var o=l.alternate;if(o===null){if(s=l.return,s!==null){n=s;continue}break}if(l.child===o.child){for(o=l.child;o;){if(o===n)return Ci(l),e;if(o===s)return Ci(l),t;o=o.sibling}throw Error(T(188))}if(n.return!==s.return)n=l,s=o;else{for(var a=!1,i=l.child;i;){if(i===n){a=!0,n=l,s=o;break}if(i===s){a=!0,s=l,n=o;break}i=i.sibling}if(!a){for(i=o.child;i;){if(i===n){a=!0,n=o,s=l;break}if(i===s){a=!0,s=o,n=l;break}i=i.sibling}if(!a)throw Error(T(189))}}if(n.alternate!==s)throw Error(T(190))}if(n.tag!==3)throw Error(T(188));return n.stateNode.current===n?e:t}function bd(e){return e=xf(e),e!==null?Nd(e):null}function Nd(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Nd(e);if(t!==null)return t;e=e.sibling}return null}var zd=Oe.unstable_scheduleCallback,Ei=Oe.unstable_cancelCallback,gf=Oe.unstable_shouldYield,vf=Oe.unstable_requestPaint,re=Oe.unstable_now,yf=Oe.unstable_getCurrentPriorityLevel,wa=Oe.unstable_ImmediatePriority,Cd=Oe.unstable_UserBlockingPriority,Is=Oe.unstable_NormalPriority,jf=Oe.unstable_LowPriority,Ed=Oe.unstable_IdlePriority,al=null,it=null;function wf(e){if(it&&typeof it.onCommitFiberRoot=="function")try{it.onCommitFiberRoot(al,e,void 0,(e.current.flags&128)===128)}catch{}}var Ze=Math.clz32?Math.clz32:bf,Sf=Math.log,kf=Math.LN2;function bf(e){return e>>>=0,e===0?32:31-(Sf(e)/kf|0)|0}var qr=64,Xr=4194304;function ar(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Os(e,t){var n=e.pendingLanes;if(n===0)return 0;var s=0,l=e.suspendedLanes,o=e.pingedLanes,a=n&268435455;if(a!==0){var i=a&~l;i!==0?s=ar(i):(o&=a,o!==0&&(s=ar(o)))}else a=n&~l,a!==0?s=ar(a):o!==0&&(s=ar(o));if(s===0)return 0;if(t!==0&&t!==s&&!(t&l)&&(l=s&-s,o=t&-t,l>=o||l===16&&(o&4194240)!==0))return t;if(s&4&&(s|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=s;0<t;)n=31-Ze(t),l=1<<n,s|=e[n],t&=~l;return s}function Nf(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function zf(e,t){for(var n=e.suspendedLanes,s=e.pingedLanes,l=e.expirationTimes,o=e.pendingLanes;0<o;){var a=31-Ze(o),i=1<<a,c=l[a];c===-1?(!(i&n)||i&s)&&(l[a]=Nf(i,t)):c<=t&&(e.expiredLanes|=i),o&=~i}}function Eo(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Td(){var e=qr;return qr<<=1,!(qr&4194240)&&(qr=64),e}function Il(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Br(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ze(t),e[t]=n}function Cf(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var s=e.eventTimes;for(e=e.expirationTimes;0<n;){var l=31-Ze(n),o=1<<l;t[l]=0,s[l]=-1,e[l]=-1,n&=~o}}function Sa(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var s=31-Ze(n),l=1<<s;l&t|e[s]&t&&(e[s]|=t),n&=~l}}var V=0;function _d(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Md,ka,Rd,Pd,Ld,To=!1,Jr=[],Mt=null,Rt=null,Pt=null,Sr=new Map,kr=new Map,Nt=[],Ef="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Ti(e,t){switch(e){case"focusin":case"focusout":Mt=null;break;case"dragenter":case"dragleave":Rt=null;break;case"mouseover":case"mouseout":Pt=null;break;case"pointerover":case"pointerout":Sr.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":kr.delete(t.pointerId)}}function Xn(e,t,n,s,l,o){return e===null||e.nativeEvent!==o?(e={blockedOn:t,domEventName:n,eventSystemFlags:s,nativeEvent:o,targetContainers:[l]},t!==null&&(t=$r(t),t!==null&&ka(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,l!==null&&t.indexOf(l)===-1&&t.push(l),e)}function Tf(e,t,n,s,l){switch(t){case"focusin":return Mt=Xn(Mt,e,t,n,s,l),!0;case"dragenter":return Rt=Xn(Rt,e,t,n,s,l),!0;case"mouseover":return Pt=Xn(Pt,e,t,n,s,l),!0;case"pointerover":var o=l.pointerId;return Sr.set(o,Xn(Sr.get(o)||null,e,t,n,s,l)),!0;case"gotpointercapture":return o=l.pointerId,kr.set(o,Xn(kr.get(o)||null,e,t,n,s,l)),!0}return!1}function Dd(e){var t=Zt(e.target);if(t!==null){var n=un(t);if(n!==null){if(t=n.tag,t===13){if(t=kd(n),t!==null){e.blockedOn=t,Ld(e.priority,function(){Rd(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Ss(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=_o(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var s=new n.constructor(n.type,n);bo=s,n.target.dispatchEvent(s),bo=null}else return t=$r(n),t!==null&&ka(t),e.blockedOn=n,!1;t.shift()}return!0}function _i(e,t,n){Ss(e)&&n.delete(t)}function _f(){To=!1,Mt!==null&&Ss(Mt)&&(Mt=null),Rt!==null&&Ss(Rt)&&(Rt=null),Pt!==null&&Ss(Pt)&&(Pt=null),Sr.forEach(_i),kr.forEach(_i)}function Jn(e,t){e.blockedOn===t&&(e.blockedOn=null,To||(To=!0,Oe.unstable_scheduleCallback(Oe.unstable_NormalPriority,_f)))}function br(e){function t(l){return Jn(l,e)}if(0<Jr.length){Jn(Jr[0],e);for(var n=1;n<Jr.length;n++){var s=Jr[n];s.blockedOn===e&&(s.blockedOn=null)}}for(Mt!==null&&Jn(Mt,e),Rt!==null&&Jn(Rt,e),Pt!==null&&Jn(Pt,e),Sr.forEach(t),kr.forEach(t),n=0;n<Nt.length;n++)s=Nt[n],s.blockedOn===e&&(s.blockedOn=null);for(;0<Nt.length&&(n=Nt[0],n.blockedOn===null);)Dd(n),n.blockedOn===null&&Nt.shift()}var Ln=wt.ReactCurrentBatchConfig,As=!0;function Mf(e,t,n,s){var l=V,o=Ln.transition;Ln.transition=null;try{V=1,ba(e,t,n,s)}finally{V=l,Ln.transition=o}}function Rf(e,t,n,s){var l=V,o=Ln.transition;Ln.transition=null;try{V=4,ba(e,t,n,s)}finally{V=l,Ln.transition=o}}function ba(e,t,n,s){if(As){var l=_o(e,t,n,s);if(l===null)Kl(e,t,s,Bs,n),Ti(e,s);else if(Tf(l,e,t,n,s))s.stopPropagation();else if(Ti(e,s),t&4&&-1<Ef.indexOf(e)){for(;l!==null;){var o=$r(l);if(o!==null&&Md(o),o=_o(e,t,n,s),o===null&&Kl(e,t,s,Bs,n),o===l)break;l=o}l!==null&&s.stopPropagation()}else Kl(e,t,s,null,n)}}var Bs=null;function _o(e,t,n,s){if(Bs=null,e=ja(s),e=Zt(e),e!==null)if(t=un(e),t===null)e=null;else if(n=t.tag,n===13){if(e=kd(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Bs=e,null}function Id(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(yf()){case wa:return 1;case Cd:return 4;case Is:case jf:return 16;case Ed:return 536870912;default:return 16}default:return 16}}var Et=null,Na=null,ks=null;function Od(){if(ks)return ks;var e,t=Na,n=t.length,s,l="value"in Et?Et.value:Et.textContent,o=l.length;for(e=0;e<n&&t[e]===l[e];e++);var a=n-e;for(s=1;s<=a&&t[n-s]===l[o-s];s++);return ks=l.slice(e,1<s?1-s:void 0)}function bs(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Zr(){return!0}function Mi(){return!1}function Be(e){function t(n,s,l,o,a){this._reactName=n,this._targetInst=l,this.type=s,this.nativeEvent=o,this.target=a,this.currentTarget=null;for(var i in e)e.hasOwnProperty(i)&&(n=e[i],this[i]=n?n(o):o[i]);return this.isDefaultPrevented=(o.defaultPrevented!=null?o.defaultPrevented:o.returnValue===!1)?Zr:Mi,this.isPropagationStopped=Mi,this}return Z(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Zr)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Zr)},persist:function(){},isPersistent:Zr}),t}var Qn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},za=Be(Qn),Wr=Z({},Qn,{view:0,detail:0}),Pf=Be(Wr),Ol,Al,Zn,il=Z({},Wr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ca,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Zn&&(Zn&&e.type==="mousemove"?(Ol=e.screenX-Zn.screenX,Al=e.screenY-Zn.screenY):Al=Ol=0,Zn=e),Ol)},movementY:function(e){return"movementY"in e?e.movementY:Al}}),Ri=Be(il),Lf=Z({},il,{dataTransfer:0}),Df=Be(Lf),If=Z({},Wr,{relatedTarget:0}),Bl=Be(If),Of=Z({},Qn,{animationName:0,elapsedTime:0,pseudoElement:0}),Af=Be(Of),Bf=Z({},Qn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Wf=Be(Bf),$f=Z({},Qn,{data:0}),Pi=Be($f),Ff={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Hf={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Uf={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Vf(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Uf[e])?!!t[e]:!1}function Ca(){return Vf}var Kf=Z({},Wr,{key:function(e){if(e.key){var t=Ff[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=bs(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Hf[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ca,charCode:function(e){return e.type==="keypress"?bs(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?bs(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Qf=Be(Kf),Yf=Z({},il,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Li=Be(Yf),Gf=Z({},Wr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ca}),qf=Be(Gf),Xf=Z({},Qn,{propertyName:0,elapsedTime:0,pseudoElement:0}),Jf=Be(Xf),Zf=Z({},il,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),eh=Be(Zf),th=[9,13,27,32],Ea=gt&&"CompositionEvent"in window,pr=null;gt&&"documentMode"in document&&(pr=document.documentMode);var nh=gt&&"TextEvent"in window&&!pr,Ad=gt&&(!Ea||pr&&8<pr&&11>=pr),Di=" ",Ii=!1;function Bd(e,t){switch(e){case"keyup":return th.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Wd(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var jn=!1;function rh(e,t){switch(e){case"compositionend":return Wd(t);case"keypress":return t.which!==32?null:(Ii=!0,Di);case"textInput":return e=t.data,e===Di&&Ii?null:e;default:return null}}function sh(e,t){if(jn)return e==="compositionend"||!Ea&&Bd(e,t)?(e=Od(),ks=Na=Et=null,jn=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Ad&&t.locale!=="ko"?null:t.data;default:return null}}var lh={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Oi(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!lh[e.type]:t==="textarea"}function $d(e,t,n,s){vd(s),t=Ws(t,"onChange"),0<t.length&&(n=new za("onChange","change",null,n,s),e.push({event:n,listeners:t}))}var fr=null,Nr=null;function oh(e){Jd(e,0)}function cl(e){var t=kn(e);if(ud(t))return e}function ah(e,t){if(e==="change")return t}var Fd=!1;if(gt){var Wl;if(gt){var $l="oninput"in document;if(!$l){var Ai=document.createElement("div");Ai.setAttribute("oninput","return;"),$l=typeof Ai.oninput=="function"}Wl=$l}else Wl=!1;Fd=Wl&&(!document.documentMode||9<document.documentMode)}function Bi(){fr&&(fr.detachEvent("onpropertychange",Hd),Nr=fr=null)}function Hd(e){if(e.propertyName==="value"&&cl(Nr)){var t=[];$d(t,Nr,e,ja(e)),Sd(oh,t)}}function ih(e,t,n){e==="focusin"?(Bi(),fr=t,Nr=n,fr.attachEvent("onpropertychange",Hd)):e==="focusout"&&Bi()}function ch(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return cl(Nr)}function dh(e,t){if(e==="click")return cl(t)}function uh(e,t){if(e==="input"||e==="change")return cl(t)}function ph(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var tt=typeof Object.is=="function"?Object.is:ph;function zr(e,t){if(tt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;for(s=0;s<n.length;s++){var l=n[s];if(!po.call(t,l)||!tt(e[l],t[l]))return!1}return!0}function Wi(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function $i(e,t){var n=Wi(e);e=0;for(var s;n;){if(n.nodeType===3){if(s=e+n.textContent.length,e<=t&&s>=t)return{node:n,offset:t-e};e=s}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Wi(n)}}function Ud(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ud(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Vd(){for(var e=window,t=Ps();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ps(e.document)}return t}function Ta(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function fh(e){var t=Vd(),n=e.focusedElem,s=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Ud(n.ownerDocument.documentElement,n)){if(s!==null&&Ta(n)){if(t=s.start,e=s.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=n.textContent.length,o=Math.min(s.start,l);s=s.end===void 0?o:Math.min(s.end,l),!e.extend&&o>s&&(l=s,s=o,o=l),l=$i(n,o);var a=$i(n,s);l&&a&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),o>s?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var hh=gt&&"documentMode"in document&&11>=document.documentMode,wn=null,Mo=null,hr=null,Ro=!1;function Fi(e,t,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ro||wn==null||wn!==Ps(s)||(s=wn,"selectionStart"in s&&Ta(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),hr&&zr(hr,s)||(hr=s,s=Ws(Mo,"onSelect"),0<s.length&&(t=new za("onSelect","select",null,t,n),e.push({event:t,listeners:s}),t.target=wn)))}function es(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Sn={animationend:es("Animation","AnimationEnd"),animationiteration:es("Animation","AnimationIteration"),animationstart:es("Animation","AnimationStart"),transitionend:es("Transition","TransitionEnd")},Fl={},Kd={};gt&&(Kd=document.createElement("div").style,"AnimationEvent"in window||(delete Sn.animationend.animation,delete Sn.animationiteration.animation,delete Sn.animationstart.animation),"TransitionEvent"in window||delete Sn.transitionend.transition);function dl(e){if(Fl[e])return Fl[e];if(!Sn[e])return e;var t=Sn[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Kd)return Fl[e]=t[n];return e}var Qd=dl("animationend"),Yd=dl("animationiteration"),Gd=dl("animationstart"),qd=dl("transitionend"),Xd=new Map,Hi="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Ft(e,t){Xd.set(e,t),dn(t,[e])}for(var Hl=0;Hl<Hi.length;Hl++){var Ul=Hi[Hl],mh=Ul.toLowerCase(),xh=Ul[0].toUpperCase()+Ul.slice(1);Ft(mh,"on"+xh)}Ft(Qd,"onAnimationEnd");Ft(Yd,"onAnimationIteration");Ft(Gd,"onAnimationStart");Ft("dblclick","onDoubleClick");Ft("focusin","onFocus");Ft("focusout","onBlur");Ft(qd,"onTransitionEnd");On("onMouseEnter",["mouseout","mouseover"]);On("onMouseLeave",["mouseout","mouseover"]);On("onPointerEnter",["pointerout","pointerover"]);On("onPointerLeave",["pointerout","pointerover"]);dn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));dn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));dn("onBeforeInput",["compositionend","keypress","textInput","paste"]);dn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));dn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));dn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ir="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),gh=new Set("cancel close invalid load scroll toggle".split(" ").concat(ir));function Ui(e,t,n){var s=e.type||"unknown-event";e.currentTarget=n,mf(s,t,void 0,e),e.currentTarget=null}function Jd(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var s=e[n],l=s.event;s=s.listeners;e:{var o=void 0;if(t)for(var a=s.length-1;0<=a;a--){var i=s[a],c=i.instance,d=i.currentTarget;if(i=i.listener,c!==o&&l.isPropagationStopped())break e;Ui(l,i,d),o=c}else for(a=0;a<s.length;a++){if(i=s[a],c=i.instance,d=i.currentTarget,i=i.listener,c!==o&&l.isPropagationStopped())break e;Ui(l,i,d),o=c}}}if(Ds)throw e=Co,Ds=!1,Co=null,e}function Y(e,t){var n=t[Oo];n===void 0&&(n=t[Oo]=new Set);var s=e+"__bubble";n.has(s)||(Zd(t,e,2,!1),n.add(s))}function Vl(e,t,n){var s=0;t&&(s|=4),Zd(n,e,s,t)}var ts="_reactListening"+Math.random().toString(36).slice(2);function Cr(e){if(!e[ts]){e[ts]=!0,od.forEach(function(n){n!=="selectionchange"&&(gh.has(n)||Vl(n,!1,e),Vl(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ts]||(t[ts]=!0,Vl("selectionchange",!1,t))}}function Zd(e,t,n,s){switch(Id(t)){case 1:var l=Mf;break;case 4:l=Rf;break;default:l=ba}n=l.bind(null,t,n,e),l=void 0,!zo||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(l=!0),s?l!==void 0?e.addEventListener(t,n,{capture:!0,passive:l}):e.addEventListener(t,n,!0):l!==void 0?e.addEventListener(t,n,{passive:l}):e.addEventListener(t,n,!1)}function Kl(e,t,n,s,l){var o=s;if(!(t&1)&&!(t&2)&&s!==null)e:for(;;){if(s===null)return;var a=s.tag;if(a===3||a===4){var i=s.stateNode.containerInfo;if(i===l||i.nodeType===8&&i.parentNode===l)break;if(a===4)for(a=s.return;a!==null;){var c=a.tag;if((c===3||c===4)&&(c=a.stateNode.containerInfo,c===l||c.nodeType===8&&c.parentNode===l))return;a=a.return}for(;i!==null;){if(a=Zt(i),a===null)return;if(c=a.tag,c===5||c===6){s=o=a;continue e}i=i.parentNode}}s=s.return}Sd(function(){var d=o,u=ja(n),f=[];e:{var m=Xd.get(e);if(m!==void 0){var g=za,v=e;switch(e){case"keypress":if(bs(n)===0)break e;case"keydown":case"keyup":g=Qf;break;case"focusin":v="focus",g=Bl;break;case"focusout":v="blur",g=Bl;break;case"beforeblur":case"afterblur":g=Bl;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":g=Ri;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":g=Df;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":g=qf;break;case Qd:case Yd:case Gd:g=Af;break;case qd:g=Jf;break;case"scroll":g=Pf;break;case"wheel":g=eh;break;case"copy":case"cut":case"paste":g=Wf;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":g=Li}var p=(t&4)!==0,w=!p&&e==="scroll",h=p?m!==null?m+"Capture":null:m;p=[];for(var x=d,j;x!==null;){j=x;var y=j.stateNode;if(j.tag===5&&y!==null&&(j=y,h!==null&&(y=wr(x,h),y!=null&&p.push(Er(x,y,j)))),w)break;x=x.return}0<p.length&&(m=new g(m,v,null,n,u),f.push({event:m,listeners:p}))}}if(!(t&7)){e:{if(m=e==="mouseover"||e==="pointerover",g=e==="mouseout"||e==="pointerout",m&&n!==bo&&(v=n.relatedTarget||n.fromElement)&&(Zt(v)||v[vt]))break e;if((g||m)&&(m=u.window===u?u:(m=u.ownerDocument)?m.defaultView||m.parentWindow:window,g?(v=n.relatedTarget||n.toElement,g=d,v=v?Zt(v):null,v!==null&&(w=un(v),v!==w||v.tag!==5&&v.tag!==6)&&(v=null)):(g=null,v=d),g!==v)){if(p=Ri,y="onMouseLeave",h="onMouseEnter",x="mouse",(e==="pointerout"||e==="pointerover")&&(p=Li,y="onPointerLeave",h="onPointerEnter",x="pointer"),w=g==null?m:kn(g),j=v==null?m:kn(v),m=new p(y,x+"leave",g,n,u),m.target=w,m.relatedTarget=j,y=null,Zt(u)===d&&(p=new p(h,x+"enter",v,n,u),p.target=j,p.relatedTarget=w,y=p),w=y,g&&v)t:{for(p=g,h=v,x=0,j=p;j;j=fn(j))x++;for(j=0,y=h;y;y=fn(y))j++;for(;0<x-j;)p=fn(p),x--;for(;0<j-x;)h=fn(h),j--;for(;x--;){if(p===h||h!==null&&p===h.alternate)break t;p=fn(p),h=fn(h)}p=null}else p=null;g!==null&&Vi(f,m,g,p,!1),v!==null&&w!==null&&Vi(f,w,v,p,!0)}}e:{if(m=d?kn(d):window,g=m.nodeName&&m.nodeName.toLowerCase(),g==="select"||g==="input"&&m.type==="file")var S=ah;else if(Oi(m))if(Fd)S=uh;else{S=ch;var b=ih}else(g=m.nodeName)&&g.toLowerCase()==="input"&&(m.type==="checkbox"||m.type==="radio")&&(S=dh);if(S&&(S=S(e,d))){$d(f,S,n,u);break e}b&&b(e,m,d),e==="focusout"&&(b=m._wrapperState)&&b.controlled&&m.type==="number"&&yo(m,"number",m.value)}switch(b=d?kn(d):window,e){case"focusin":(Oi(b)||b.contentEditable==="true")&&(wn=b,Mo=d,hr=null);break;case"focusout":hr=Mo=wn=null;break;case"mousedown":Ro=!0;break;case"contextmenu":case"mouseup":case"dragend":Ro=!1,Fi(f,n,u);break;case"selectionchange":if(hh)break;case"keydown":case"keyup":Fi(f,n,u)}var C;if(Ea)e:{switch(e){case"compositionstart":var _="onCompositionStart";break e;case"compositionend":_="onCompositionEnd";break e;case"compositionupdate":_="onCompositionUpdate";break e}_=void 0}else jn?Bd(e,n)&&(_="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(_="onCompositionStart");_&&(Ad&&n.locale!=="ko"&&(jn||_!=="onCompositionStart"?_==="onCompositionEnd"&&jn&&(C=Od()):(Et=u,Na="value"in Et?Et.value:Et.textContent,jn=!0)),b=Ws(d,_),0<b.length&&(_=new Pi(_,e,null,n,u),f.push({event:_,listeners:b}),C?_.data=C:(C=Wd(n),C!==null&&(_.data=C)))),(C=nh?rh(e,n):sh(e,n))&&(d=Ws(d,"onBeforeInput"),0<d.length&&(u=new Pi("onBeforeInput","beforeinput",null,n,u),f.push({event:u,listeners:d}),u.data=C))}Jd(f,t)})}function Er(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Ws(e,t){for(var n=t+"Capture",s=[];e!==null;){var l=e,o=l.stateNode;l.tag===5&&o!==null&&(l=o,o=wr(e,n),o!=null&&s.unshift(Er(e,o,l)),o=wr(e,t),o!=null&&s.push(Er(e,o,l))),e=e.return}return s}function fn(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Vi(e,t,n,s,l){for(var o=t._reactName,a=[];n!==null&&n!==s;){var i=n,c=i.alternate,d=i.stateNode;if(c!==null&&c===s)break;i.tag===5&&d!==null&&(i=d,l?(c=wr(n,o),c!=null&&a.unshift(Er(n,c,i))):l||(c=wr(n,o),c!=null&&a.push(Er(n,c,i)))),n=n.return}a.length!==0&&e.push({event:t,listeners:a})}var vh=/\r\n?/g,yh=/\u0000|\uFFFD/g;function Ki(e){return(typeof e=="string"?e:""+e).replace(vh,`
38
- `).replace(yh,"")}function ns(e,t,n){if(t=Ki(t),Ki(e)!==t&&n)throw Error(T(425))}function $s(){}var Po=null,Lo=null;function Do(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Io=typeof setTimeout=="function"?setTimeout:void 0,jh=typeof clearTimeout=="function"?clearTimeout:void 0,Qi=typeof Promise=="function"?Promise:void 0,wh=typeof queueMicrotask=="function"?queueMicrotask:typeof Qi<"u"?function(e){return Qi.resolve(null).then(e).catch(Sh)}:Io;function Sh(e){setTimeout(function(){throw e})}function Ql(e,t){var n=t,s=0;do{var l=n.nextSibling;if(e.removeChild(n),l&&l.nodeType===8)if(n=l.data,n==="/$"){if(s===0){e.removeChild(l),br(t);return}s--}else n!=="$"&&n!=="$?"&&n!=="$!"||s++;n=l}while(n);br(t)}function Lt(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function Yi(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var Yn=Math.random().toString(36).slice(2),at="__reactFiber$"+Yn,Tr="__reactProps$"+Yn,vt="__reactContainer$"+Yn,Oo="__reactEvents$"+Yn,kh="__reactListeners$"+Yn,bh="__reactHandles$"+Yn;function Zt(e){var t=e[at];if(t)return t;for(var n=e.parentNode;n;){if(t=n[vt]||n[at]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Yi(e);e!==null;){if(n=e[at])return n;e=Yi(e)}return t}e=n,n=e.parentNode}return null}function $r(e){return e=e[at]||e[vt],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function kn(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(T(33))}function ul(e){return e[Tr]||null}var Ao=[],bn=-1;function Ht(e){return{current:e}}function G(e){0>bn||(e.current=Ao[bn],Ao[bn]=null,bn--)}function Q(e,t){bn++,Ao[bn]=e.current,e.current=t}var Wt={},we=Ht(Wt),Te=Ht(!1),sn=Wt;function An(e,t){var n=e.type.contextTypes;if(!n)return Wt;var s=e.stateNode;if(s&&s.__reactInternalMemoizedUnmaskedChildContext===t)return s.__reactInternalMemoizedMaskedChildContext;var l={},o;for(o in n)l[o]=t[o];return s&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function _e(e){return e=e.childContextTypes,e!=null}function Fs(){G(Te),G(we)}function Gi(e,t,n){if(we.current!==Wt)throw Error(T(168));Q(we,t),Q(Te,n)}function eu(e,t,n){var s=e.stateNode;if(t=t.childContextTypes,typeof s.getChildContext!="function")return n;s=s.getChildContext();for(var l in s)if(!(l in t))throw Error(T(108,af(e)||"Unknown",l));return Z({},n,s)}function Hs(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Wt,sn=we.current,Q(we,e),Q(Te,Te.current),!0}function qi(e,t,n){var s=e.stateNode;if(!s)throw Error(T(169));n?(e=eu(e,t,sn),s.__reactInternalMemoizedMergedChildContext=e,G(Te),G(we),Q(we,e)):G(Te),Q(Te,n)}var ft=null,pl=!1,Yl=!1;function tu(e){ft===null?ft=[e]:ft.push(e)}function Nh(e){pl=!0,tu(e)}function Ut(){if(!Yl&&ft!==null){Yl=!0;var e=0,t=V;try{var n=ft;for(V=1;e<n.length;e++){var s=n[e];do s=s(!0);while(s!==null)}ft=null,pl=!1}catch(l){throw ft!==null&&(ft=ft.slice(e+1)),zd(wa,Ut),l}finally{V=t,Yl=!1}}return null}var Nn=[],zn=0,Us=null,Vs=0,We=[],$e=0,ln=null,ht=1,mt="";function qt(e,t){Nn[zn++]=Vs,Nn[zn++]=Us,Us=e,Vs=t}function nu(e,t,n){We[$e++]=ht,We[$e++]=mt,We[$e++]=ln,ln=e;var s=ht;e=mt;var l=32-Ze(s)-1;s&=~(1<<l),n+=1;var o=32-Ze(t)+l;if(30<o){var a=l-l%5;o=(s&(1<<a)-1).toString(32),s>>=a,l-=a,ht=1<<32-Ze(t)+l|n<<l|s,mt=o+e}else ht=1<<o|n<<l|s,mt=e}function _a(e){e.return!==null&&(qt(e,1),nu(e,1,0))}function Ma(e){for(;e===Us;)Us=Nn[--zn],Nn[zn]=null,Vs=Nn[--zn],Nn[zn]=null;for(;e===ln;)ln=We[--$e],We[$e]=null,mt=We[--$e],We[$e]=null,ht=We[--$e],We[$e]=null}var Ie=null,De=null,q=!1,Je=null;function ru(e,t){var n=Fe(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function Xi(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,Ie=e,De=Lt(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Ie=e,De=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=ln!==null?{id:ht,overflow:mt}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Fe(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Ie=e,De=null,!0):!1;default:return!1}}function Bo(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Wo(e){if(q){var t=De;if(t){var n=t;if(!Xi(e,t)){if(Bo(e))throw Error(T(418));t=Lt(n.nextSibling);var s=Ie;t&&Xi(e,t)?ru(s,n):(e.flags=e.flags&-4097|2,q=!1,Ie=e)}}else{if(Bo(e))throw Error(T(418));e.flags=e.flags&-4097|2,q=!1,Ie=e}}}function Ji(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Ie=e}function rs(e){if(e!==Ie)return!1;if(!q)return Ji(e),q=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Do(e.type,e.memoizedProps)),t&&(t=De)){if(Bo(e))throw su(),Error(T(418));for(;t;)ru(e,t),t=Lt(t.nextSibling)}if(Ji(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(T(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){De=Lt(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}De=null}}else De=Ie?Lt(e.stateNode.nextSibling):null;return!0}function su(){for(var e=De;e;)e=Lt(e.nextSibling)}function Bn(){De=Ie=null,q=!1}function Ra(e){Je===null?Je=[e]:Je.push(e)}var zh=wt.ReactCurrentBatchConfig;function er(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(T(309));var s=n.stateNode}if(!s)throw Error(T(147,e));var l=s,o=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===o?t.ref:(t=function(a){var i=l.refs;a===null?delete i[o]:i[o]=a},t._stringRef=o,t)}if(typeof e!="string")throw Error(T(284));if(!n._owner)throw Error(T(290,e))}return e}function ss(e,t){throw e=Object.prototype.toString.call(t),Error(T(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Zi(e){var t=e._init;return t(e._payload)}function lu(e){function t(h,x){if(e){var j=h.deletions;j===null?(h.deletions=[x],h.flags|=16):j.push(x)}}function n(h,x){if(!e)return null;for(;x!==null;)t(h,x),x=x.sibling;return null}function s(h,x){for(h=new Map;x!==null;)x.key!==null?h.set(x.key,x):h.set(x.index,x),x=x.sibling;return h}function l(h,x){return h=At(h,x),h.index=0,h.sibling=null,h}function o(h,x,j){return h.index=j,e?(j=h.alternate,j!==null?(j=j.index,j<x?(h.flags|=2,x):j):(h.flags|=2,x)):(h.flags|=1048576,x)}function a(h){return e&&h.alternate===null&&(h.flags|=2),h}function i(h,x,j,y){return x===null||x.tag!==6?(x=to(j,h.mode,y),x.return=h,x):(x=l(x,j),x.return=h,x)}function c(h,x,j,y){var S=j.type;return S===yn?u(h,x,j.props.children,y,j.key):x!==null&&(x.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===kt&&Zi(S)===x.type)?(y=l(x,j.props),y.ref=er(h,x,j),y.return=h,y):(y=Ms(j.type,j.key,j.props,null,h.mode,y),y.ref=er(h,x,j),y.return=h,y)}function d(h,x,j,y){return x===null||x.tag!==4||x.stateNode.containerInfo!==j.containerInfo||x.stateNode.implementation!==j.implementation?(x=no(j,h.mode,y),x.return=h,x):(x=l(x,j.children||[]),x.return=h,x)}function u(h,x,j,y,S){return x===null||x.tag!==7?(x=rn(j,h.mode,y,S),x.return=h,x):(x=l(x,j),x.return=h,x)}function f(h,x,j){if(typeof x=="string"&&x!==""||typeof x=="number")return x=to(""+x,h.mode,j),x.return=h,x;if(typeof x=="object"&&x!==null){switch(x.$$typeof){case Qr:return j=Ms(x.type,x.key,x.props,null,h.mode,j),j.ref=er(h,null,x),j.return=h,j;case vn:return x=no(x,h.mode,j),x.return=h,x;case kt:var y=x._init;return f(h,y(x._payload),j)}if(or(x)||Gn(x))return x=rn(x,h.mode,j,null),x.return=h,x;ss(h,x)}return null}function m(h,x,j,y){var S=x!==null?x.key:null;if(typeof j=="string"&&j!==""||typeof j=="number")return S!==null?null:i(h,x,""+j,y);if(typeof j=="object"&&j!==null){switch(j.$$typeof){case Qr:return j.key===S?c(h,x,j,y):null;case vn:return j.key===S?d(h,x,j,y):null;case kt:return S=j._init,m(h,x,S(j._payload),y)}if(or(j)||Gn(j))return S!==null?null:u(h,x,j,y,null);ss(h,j)}return null}function g(h,x,j,y,S){if(typeof y=="string"&&y!==""||typeof y=="number")return h=h.get(j)||null,i(x,h,""+y,S);if(typeof y=="object"&&y!==null){switch(y.$$typeof){case Qr:return h=h.get(y.key===null?j:y.key)||null,c(x,h,y,S);case vn:return h=h.get(y.key===null?j:y.key)||null,d(x,h,y,S);case kt:var b=y._init;return g(h,x,j,b(y._payload),S)}if(or(y)||Gn(y))return h=h.get(j)||null,u(x,h,y,S,null);ss(x,y)}return null}function v(h,x,j,y){for(var S=null,b=null,C=x,_=x=0,W=null;C!==null&&_<j.length;_++){C.index>_?(W=C,C=null):W=C.sibling;var O=m(h,C,j[_],y);if(O===null){C===null&&(C=W);break}e&&C&&O.alternate===null&&t(h,C),x=o(O,x,_),b===null?S=O:b.sibling=O,b=O,C=W}if(_===j.length)return n(h,C),q&&qt(h,_),S;if(C===null){for(;_<j.length;_++)C=f(h,j[_],y),C!==null&&(x=o(C,x,_),b===null?S=C:b.sibling=C,b=C);return q&&qt(h,_),S}for(C=s(h,C);_<j.length;_++)W=g(C,h,_,j[_],y),W!==null&&(e&&W.alternate!==null&&C.delete(W.key===null?_:W.key),x=o(W,x,_),b===null?S=W:b.sibling=W,b=W);return e&&C.forEach(function(oe){return t(h,oe)}),q&&qt(h,_),S}function p(h,x,j,y){var S=Gn(j);if(typeof S!="function")throw Error(T(150));if(j=S.call(j),j==null)throw Error(T(151));for(var b=S=null,C=x,_=x=0,W=null,O=j.next();C!==null&&!O.done;_++,O=j.next()){C.index>_?(W=C,C=null):W=C.sibling;var oe=m(h,C,O.value,y);if(oe===null){C===null&&(C=W);break}e&&C&&oe.alternate===null&&t(h,C),x=o(oe,x,_),b===null?S=oe:b.sibling=oe,b=oe,C=W}if(O.done)return n(h,C),q&&qt(h,_),S;if(C===null){for(;!O.done;_++,O=j.next())O=f(h,O.value,y),O!==null&&(x=o(O,x,_),b===null?S=O:b.sibling=O,b=O);return q&&qt(h,_),S}for(C=s(h,C);!O.done;_++,O=j.next())O=g(C,h,_,O.value,y),O!==null&&(e&&O.alternate!==null&&C.delete(O.key===null?_:O.key),x=o(O,x,_),b===null?S=O:b.sibling=O,b=O);return e&&C.forEach(function(nt){return t(h,nt)}),q&&qt(h,_),S}function w(h,x,j,y){if(typeof j=="object"&&j!==null&&j.type===yn&&j.key===null&&(j=j.props.children),typeof j=="object"&&j!==null){switch(j.$$typeof){case Qr:e:{for(var S=j.key,b=x;b!==null;){if(b.key===S){if(S=j.type,S===yn){if(b.tag===7){n(h,b.sibling),x=l(b,j.props.children),x.return=h,h=x;break e}}else if(b.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===kt&&Zi(S)===b.type){n(h,b.sibling),x=l(b,j.props),x.ref=er(h,b,j),x.return=h,h=x;break e}n(h,b);break}else t(h,b);b=b.sibling}j.type===yn?(x=rn(j.props.children,h.mode,y,j.key),x.return=h,h=x):(y=Ms(j.type,j.key,j.props,null,h.mode,y),y.ref=er(h,x,j),y.return=h,h=y)}return a(h);case vn:e:{for(b=j.key;x!==null;){if(x.key===b)if(x.tag===4&&x.stateNode.containerInfo===j.containerInfo&&x.stateNode.implementation===j.implementation){n(h,x.sibling),x=l(x,j.children||[]),x.return=h,h=x;break e}else{n(h,x);break}else t(h,x);x=x.sibling}x=no(j,h.mode,y),x.return=h,h=x}return a(h);case kt:return b=j._init,w(h,x,b(j._payload),y)}if(or(j))return v(h,x,j,y);if(Gn(j))return p(h,x,j,y);ss(h,j)}return typeof j=="string"&&j!==""||typeof j=="number"?(j=""+j,x!==null&&x.tag===6?(n(h,x.sibling),x=l(x,j),x.return=h,h=x):(n(h,x),x=to(j,h.mode,y),x.return=h,h=x),a(h)):n(h,x)}return w}var Wn=lu(!0),ou=lu(!1),Ks=Ht(null),Qs=null,Cn=null,Pa=null;function La(){Pa=Cn=Qs=null}function Da(e){var t=Ks.current;G(Ks),e._currentValue=t}function $o(e,t,n){for(;e!==null;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,s!==null&&(s.childLanes|=t)):s!==null&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===n)break;e=e.return}}function Dn(e,t){Qs=e,Pa=Cn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Ee=!0),e.firstContext=null)}function Ve(e){var t=e._currentValue;if(Pa!==e)if(e={context:e,memoizedValue:t,next:null},Cn===null){if(Qs===null)throw Error(T(308));Cn=e,Qs.dependencies={lanes:0,firstContext:e}}else Cn=Cn.next=e;return t}var en=null;function Ia(e){en===null?en=[e]:en.push(e)}function au(e,t,n,s){var l=t.interleaved;return l===null?(n.next=n,Ia(t)):(n.next=l.next,l.next=n),t.interleaved=n,yt(e,s)}function yt(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var bt=!1;function Oa(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function iu(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function xt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Dt(e,t,n){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,$&2){var l=s.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),s.pending=t,yt(e,n)}return l=s.interleaved,l===null?(t.next=t,Ia(s)):(t.next=l.next,l.next=t),s.interleaved=t,yt(e,n)}function Ns(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,Sa(e,n)}}function ec(e,t){var n=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,n===s)){var l=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?l=o=a:o=o.next=a,n=n.next}while(n!==null);o===null?l=o=t:o=o.next=t}else l=o=t;n={baseState:s.baseState,firstBaseUpdate:l,lastBaseUpdate:o,shared:s.shared,effects:s.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Ys(e,t,n,s){var l=e.updateQueue;bt=!1;var o=l.firstBaseUpdate,a=l.lastBaseUpdate,i=l.shared.pending;if(i!==null){l.shared.pending=null;var c=i,d=c.next;c.next=null,a===null?o=d:a.next=d,a=c;var u=e.alternate;u!==null&&(u=u.updateQueue,i=u.lastBaseUpdate,i!==a&&(i===null?u.firstBaseUpdate=d:i.next=d,u.lastBaseUpdate=c))}if(o!==null){var f=l.baseState;a=0,u=d=c=null,i=o;do{var m=i.lane,g=i.eventTime;if((s&m)===m){u!==null&&(u=u.next={eventTime:g,lane:0,tag:i.tag,payload:i.payload,callback:i.callback,next:null});e:{var v=e,p=i;switch(m=t,g=n,p.tag){case 1:if(v=p.payload,typeof v=="function"){f=v.call(g,f,m);break e}f=v;break e;case 3:v.flags=v.flags&-65537|128;case 0:if(v=p.payload,m=typeof v=="function"?v.call(g,f,m):v,m==null)break e;f=Z({},f,m);break e;case 2:bt=!0}}i.callback!==null&&i.lane!==0&&(e.flags|=64,m=l.effects,m===null?l.effects=[i]:m.push(i))}else g={eventTime:g,lane:m,tag:i.tag,payload:i.payload,callback:i.callback,next:null},u===null?(d=u=g,c=f):u=u.next=g,a|=m;if(i=i.next,i===null){if(i=l.shared.pending,i===null)break;m=i,i=m.next,m.next=null,l.lastBaseUpdate=m,l.shared.pending=null}}while(!0);if(u===null&&(c=f),l.baseState=c,l.firstBaseUpdate=d,l.lastBaseUpdate=u,t=l.shared.interleaved,t!==null){l=t;do a|=l.lane,l=l.next;while(l!==t)}else o===null&&(l.shared.lanes=0);an|=a,e.lanes=a,e.memoizedState=f}}function tc(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var s=e[t],l=s.callback;if(l!==null){if(s.callback=null,s=n,typeof l!="function")throw Error(T(191,l));l.call(s)}}}var Fr={},ct=Ht(Fr),_r=Ht(Fr),Mr=Ht(Fr);function tn(e){if(e===Fr)throw Error(T(174));return e}function Aa(e,t){switch(Q(Mr,t),Q(_r,e),Q(ct,Fr),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:wo(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=wo(t,e)}G(ct),Q(ct,t)}function $n(){G(ct),G(_r),G(Mr)}function cu(e){tn(Mr.current);var t=tn(ct.current),n=wo(t,e.type);t!==n&&(Q(_r,e),Q(ct,n))}function Ba(e){_r.current===e&&(G(ct),G(_r))}var X=Ht(0);function Gs(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Gl=[];function Wa(){for(var e=0;e<Gl.length;e++)Gl[e]._workInProgressVersionPrimary=null;Gl.length=0}var zs=wt.ReactCurrentDispatcher,ql=wt.ReactCurrentBatchConfig,on=0,J=null,ae=null,de=null,qs=!1,mr=!1,Rr=0,Ch=0;function ve(){throw Error(T(321))}function $a(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!tt(e[n],t[n]))return!1;return!0}function Fa(e,t,n,s,l,o){if(on=o,J=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,zs.current=e===null||e.memoizedState===null?Mh:Rh,e=n(s,l),mr){o=0;do{if(mr=!1,Rr=0,25<=o)throw Error(T(301));o+=1,de=ae=null,t.updateQueue=null,zs.current=Ph,e=n(s,l)}while(mr)}if(zs.current=Xs,t=ae!==null&&ae.next!==null,on=0,de=ae=J=null,qs=!1,t)throw Error(T(300));return e}function Ha(){var e=Rr!==0;return Rr=0,e}function ot(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return de===null?J.memoizedState=de=e:de=de.next=e,de}function Ke(){if(ae===null){var e=J.alternate;e=e!==null?e.memoizedState:null}else e=ae.next;var t=de===null?J.memoizedState:de.next;if(t!==null)de=t,ae=e;else{if(e===null)throw Error(T(310));ae=e,e={memoizedState:ae.memoizedState,baseState:ae.baseState,baseQueue:ae.baseQueue,queue:ae.queue,next:null},de===null?J.memoizedState=de=e:de=de.next=e}return de}function Pr(e,t){return typeof t=="function"?t(e):t}function Xl(e){var t=Ke(),n=t.queue;if(n===null)throw Error(T(311));n.lastRenderedReducer=e;var s=ae,l=s.baseQueue,o=n.pending;if(o!==null){if(l!==null){var a=l.next;l.next=o.next,o.next=a}s.baseQueue=l=o,n.pending=null}if(l!==null){o=l.next,s=s.baseState;var i=a=null,c=null,d=o;do{var u=d.lane;if((on&u)===u)c!==null&&(c=c.next={lane:0,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null}),s=d.hasEagerState?d.eagerState:e(s,d.action);else{var f={lane:u,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null};c===null?(i=c=f,a=s):c=c.next=f,J.lanes|=u,an|=u}d=d.next}while(d!==null&&d!==o);c===null?a=s:c.next=i,tt(s,t.memoizedState)||(Ee=!0),t.memoizedState=s,t.baseState=a,t.baseQueue=c,n.lastRenderedState=s}if(e=n.interleaved,e!==null){l=e;do o=l.lane,J.lanes|=o,an|=o,l=l.next;while(l!==e)}else l===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Jl(e){var t=Ke(),n=t.queue;if(n===null)throw Error(T(311));n.lastRenderedReducer=e;var s=n.dispatch,l=n.pending,o=t.memoizedState;if(l!==null){n.pending=null;var a=l=l.next;do o=e(o,a.action),a=a.next;while(a!==l);tt(o,t.memoizedState)||(Ee=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,s]}function du(){}function uu(e,t){var n=J,s=Ke(),l=t(),o=!tt(s.memoizedState,l);if(o&&(s.memoizedState=l,Ee=!0),s=s.queue,Ua(hu.bind(null,n,s,e),[e]),s.getSnapshot!==t||o||de!==null&&de.memoizedState.tag&1){if(n.flags|=2048,Lr(9,fu.bind(null,n,s,l,t),void 0,null),pe===null)throw Error(T(349));on&30||pu(n,t,l)}return l}function pu(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=J.updateQueue,t===null?(t={lastEffect:null,stores:null},J.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function fu(e,t,n,s){t.value=n,t.getSnapshot=s,mu(t)&&xu(e)}function hu(e,t,n){return n(function(){mu(t)&&xu(e)})}function mu(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!tt(e,n)}catch{return!0}}function xu(e){var t=yt(e,1);t!==null&&et(t,e,1,-1)}function nc(e){var t=ot();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Pr,lastRenderedState:e},t.queue=e,e=e.dispatch=_h.bind(null,J,e),[t.memoizedState,e]}function Lr(e,t,n,s){return e={tag:e,create:t,destroy:n,deps:s,next:null},t=J.updateQueue,t===null?(t={lastEffect:null,stores:null},J.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(s=n.next,n.next=e,e.next=s,t.lastEffect=e)),e}function gu(){return Ke().memoizedState}function Cs(e,t,n,s){var l=ot();J.flags|=e,l.memoizedState=Lr(1|t,n,void 0,s===void 0?null:s)}function fl(e,t,n,s){var l=Ke();s=s===void 0?null:s;var o=void 0;if(ae!==null){var a=ae.memoizedState;if(o=a.destroy,s!==null&&$a(s,a.deps)){l.memoizedState=Lr(t,n,o,s);return}}J.flags|=e,l.memoizedState=Lr(1|t,n,o,s)}function rc(e,t){return Cs(8390656,8,e,t)}function Ua(e,t){return fl(2048,8,e,t)}function vu(e,t){return fl(4,2,e,t)}function yu(e,t){return fl(4,4,e,t)}function ju(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function wu(e,t,n){return n=n!=null?n.concat([e]):null,fl(4,4,ju.bind(null,t,e),n)}function Va(){}function Su(e,t){var n=Ke();t=t===void 0?null:t;var s=n.memoizedState;return s!==null&&t!==null&&$a(t,s[1])?s[0]:(n.memoizedState=[e,t],e)}function ku(e,t){var n=Ke();t=t===void 0?null:t;var s=n.memoizedState;return s!==null&&t!==null&&$a(t,s[1])?s[0]:(e=e(),n.memoizedState=[e,t],e)}function bu(e,t,n){return on&21?(tt(n,t)||(n=Td(),J.lanes|=n,an|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Ee=!0),e.memoizedState=n)}function Eh(e,t){var n=V;V=n!==0&&4>n?n:4,e(!0);var s=ql.transition;ql.transition={};try{e(!1),t()}finally{V=n,ql.transition=s}}function Nu(){return Ke().memoizedState}function Th(e,t,n){var s=Ot(e);if(n={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null},zu(e))Cu(t,n);else if(n=au(e,t,n,s),n!==null){var l=ke();et(n,e,s,l),Eu(n,t,s)}}function _h(e,t,n){var s=Ot(e),l={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null};if(zu(e))Cu(t,l);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var a=t.lastRenderedState,i=o(a,n);if(l.hasEagerState=!0,l.eagerState=i,tt(i,a)){var c=t.interleaved;c===null?(l.next=l,Ia(t)):(l.next=c.next,c.next=l),t.interleaved=l;return}}catch{}finally{}n=au(e,t,l,s),n!==null&&(l=ke(),et(n,e,s,l),Eu(n,t,s))}}function zu(e){var t=e.alternate;return e===J||t!==null&&t===J}function Cu(e,t){mr=qs=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Eu(e,t,n){if(n&4194240){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,Sa(e,n)}}var Xs={readContext:Ve,useCallback:ve,useContext:ve,useEffect:ve,useImperativeHandle:ve,useInsertionEffect:ve,useLayoutEffect:ve,useMemo:ve,useReducer:ve,useRef:ve,useState:ve,useDebugValue:ve,useDeferredValue:ve,useTransition:ve,useMutableSource:ve,useSyncExternalStore:ve,useId:ve,unstable_isNewReconciler:!1},Mh={readContext:Ve,useCallback:function(e,t){return ot().memoizedState=[e,t===void 0?null:t],e},useContext:Ve,useEffect:rc,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Cs(4194308,4,ju.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Cs(4194308,4,e,t)},useInsertionEffect:function(e,t){return Cs(4,2,e,t)},useMemo:function(e,t){var n=ot();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var s=ot();return t=n!==void 0?n(t):t,s.memoizedState=s.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},s.queue=e,e=e.dispatch=Th.bind(null,J,e),[s.memoizedState,e]},useRef:function(e){var t=ot();return e={current:e},t.memoizedState=e},useState:nc,useDebugValue:Va,useDeferredValue:function(e){return ot().memoizedState=e},useTransition:function(){var e=nc(!1),t=e[0];return e=Eh.bind(null,e[1]),ot().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var s=J,l=ot();if(q){if(n===void 0)throw Error(T(407));n=n()}else{if(n=t(),pe===null)throw Error(T(349));on&30||pu(s,t,n)}l.memoizedState=n;var o={value:n,getSnapshot:t};return l.queue=o,rc(hu.bind(null,s,o,e),[e]),s.flags|=2048,Lr(9,fu.bind(null,s,o,n,t),void 0,null),n},useId:function(){var e=ot(),t=pe.identifierPrefix;if(q){var n=mt,s=ht;n=(s&~(1<<32-Ze(s)-1)).toString(32)+n,t=":"+t+"R"+n,n=Rr++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=Ch++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Rh={readContext:Ve,useCallback:Su,useContext:Ve,useEffect:Ua,useImperativeHandle:wu,useInsertionEffect:vu,useLayoutEffect:yu,useMemo:ku,useReducer:Xl,useRef:gu,useState:function(){return Xl(Pr)},useDebugValue:Va,useDeferredValue:function(e){var t=Ke();return bu(t,ae.memoizedState,e)},useTransition:function(){var e=Xl(Pr)[0],t=Ke().memoizedState;return[e,t]},useMutableSource:du,useSyncExternalStore:uu,useId:Nu,unstable_isNewReconciler:!1},Ph={readContext:Ve,useCallback:Su,useContext:Ve,useEffect:Ua,useImperativeHandle:wu,useInsertionEffect:vu,useLayoutEffect:yu,useMemo:ku,useReducer:Jl,useRef:gu,useState:function(){return Jl(Pr)},useDebugValue:Va,useDeferredValue:function(e){var t=Ke();return ae===null?t.memoizedState=e:bu(t,ae.memoizedState,e)},useTransition:function(){var e=Jl(Pr)[0],t=Ke().memoizedState;return[e,t]},useMutableSource:du,useSyncExternalStore:uu,useId:Nu,unstable_isNewReconciler:!1};function qe(e,t){if(e&&e.defaultProps){t=Z({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Fo(e,t,n,s){t=e.memoizedState,n=n(s,t),n=n==null?t:Z({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var hl={isMounted:function(e){return(e=e._reactInternals)?un(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var s=ke(),l=Ot(e),o=xt(s,l);o.payload=t,n!=null&&(o.callback=n),t=Dt(e,o,l),t!==null&&(et(t,e,l,s),Ns(t,e,l))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var s=ke(),l=Ot(e),o=xt(s,l);o.tag=1,o.payload=t,n!=null&&(o.callback=n),t=Dt(e,o,l),t!==null&&(et(t,e,l,s),Ns(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=ke(),s=Ot(e),l=xt(n,s);l.tag=2,t!=null&&(l.callback=t),t=Dt(e,l,s),t!==null&&(et(t,e,s,n),Ns(t,e,s))}};function sc(e,t,n,s,l,o,a){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,o,a):t.prototype&&t.prototype.isPureReactComponent?!zr(n,s)||!zr(l,o):!0}function Tu(e,t,n){var s=!1,l=Wt,o=t.contextType;return typeof o=="object"&&o!==null?o=Ve(o):(l=_e(t)?sn:we.current,s=t.contextTypes,o=(s=s!=null)?An(e,l):Wt),t=new t(n,o),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=hl,e.stateNode=t,t._reactInternals=e,s&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=l,e.__reactInternalMemoizedMaskedChildContext=o),t}function lc(e,t,n,s){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,s),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,s),t.state!==e&&hl.enqueueReplaceState(t,t.state,null)}function Ho(e,t,n,s){var l=e.stateNode;l.props=n,l.state=e.memoizedState,l.refs={},Oa(e);var o=t.contextType;typeof o=="object"&&o!==null?l.context=Ve(o):(o=_e(t)?sn:we.current,l.context=An(e,o)),l.state=e.memoizedState,o=t.getDerivedStateFromProps,typeof o=="function"&&(Fo(e,t,o,n),l.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof l.getSnapshotBeforeUpdate=="function"||typeof l.UNSAFE_componentWillMount!="function"&&typeof l.componentWillMount!="function"||(t=l.state,typeof l.componentWillMount=="function"&&l.componentWillMount(),typeof l.UNSAFE_componentWillMount=="function"&&l.UNSAFE_componentWillMount(),t!==l.state&&hl.enqueueReplaceState(l,l.state,null),Ys(e,n,l,s),l.state=e.memoizedState),typeof l.componentDidMount=="function"&&(e.flags|=4194308)}function Fn(e,t){try{var n="",s=t;do n+=of(s),s=s.return;while(s);var l=n}catch(o){l=`
39
- Error generating stack: `+o.message+`
40
- `+o.stack}return{value:e,source:t,stack:l,digest:null}}function Zl(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Uo(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Lh=typeof WeakMap=="function"?WeakMap:Map;function _u(e,t,n){n=xt(-1,n),n.tag=3,n.payload={element:null};var s=t.value;return n.callback=function(){Zs||(Zs=!0,ea=s),Uo(e,t)},n}function Mu(e,t,n){n=xt(-1,n),n.tag=3;var s=e.type.getDerivedStateFromError;if(typeof s=="function"){var l=t.value;n.payload=function(){return s(l)},n.callback=function(){Uo(e,t)}}var o=e.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(n.callback=function(){Uo(e,t),typeof s!="function"&&(It===null?It=new Set([this]):It.add(this));var a=t.stack;this.componentDidCatch(t.value,{componentStack:a!==null?a:""})}),n}function oc(e,t,n){var s=e.pingCache;if(s===null){s=e.pingCache=new Lh;var l=new Set;s.set(t,l)}else l=s.get(t),l===void 0&&(l=new Set,s.set(t,l));l.has(n)||(l.add(n),e=Yh.bind(null,e,t,n),t.then(e,e))}function ac(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function ic(e,t,n,s,l){return e.mode&1?(e.flags|=65536,e.lanes=l,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=xt(-1,1),t.tag=2,Dt(n,t,1))),n.lanes|=1),e)}var Dh=wt.ReactCurrentOwner,Ee=!1;function Se(e,t,n,s){t.child=e===null?ou(t,null,n,s):Wn(t,e.child,n,s)}function cc(e,t,n,s,l){n=n.render;var o=t.ref;return Dn(t,l),s=Fa(e,t,n,s,o,l),n=Ha(),e!==null&&!Ee?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,jt(e,t,l)):(q&&n&&_a(t),t.flags|=1,Se(e,t,s,l),t.child)}function dc(e,t,n,s,l){if(e===null){var o=n.type;return typeof o=="function"&&!Za(o)&&o.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=o,Ru(e,t,o,s,l)):(e=Ms(n.type,null,s,t,t.mode,l),e.ref=t.ref,e.return=t,t.child=e)}if(o=e.child,!(e.lanes&l)){var a=o.memoizedProps;if(n=n.compare,n=n!==null?n:zr,n(a,s)&&e.ref===t.ref)return jt(e,t,l)}return t.flags|=1,e=At(o,s),e.ref=t.ref,e.return=t,t.child=e}function Ru(e,t,n,s,l){if(e!==null){var o=e.memoizedProps;if(zr(o,s)&&e.ref===t.ref)if(Ee=!1,t.pendingProps=s=o,(e.lanes&l)!==0)e.flags&131072&&(Ee=!0);else return t.lanes=e.lanes,jt(e,t,l)}return Vo(e,t,n,s,l)}function Pu(e,t,n){var s=t.pendingProps,l=s.children,o=e!==null?e.memoizedState:null;if(s.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Q(Tn,Le),Le|=n;else{if(!(n&1073741824))return e=o!==null?o.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Q(Tn,Le),Le|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},s=o!==null?o.baseLanes:n,Q(Tn,Le),Le|=s}else o!==null?(s=o.baseLanes|n,t.memoizedState=null):s=n,Q(Tn,Le),Le|=s;return Se(e,t,l,n),t.child}function Lu(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Vo(e,t,n,s,l){var o=_e(n)?sn:we.current;return o=An(t,o),Dn(t,l),n=Fa(e,t,n,s,o,l),s=Ha(),e!==null&&!Ee?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,jt(e,t,l)):(q&&s&&_a(t),t.flags|=1,Se(e,t,n,l),t.child)}function uc(e,t,n,s,l){if(_e(n)){var o=!0;Hs(t)}else o=!1;if(Dn(t,l),t.stateNode===null)Es(e,t),Tu(t,n,s),Ho(t,n,s,l),s=!0;else if(e===null){var a=t.stateNode,i=t.memoizedProps;a.props=i;var c=a.context,d=n.contextType;typeof d=="object"&&d!==null?d=Ve(d):(d=_e(n)?sn:we.current,d=An(t,d));var u=n.getDerivedStateFromProps,f=typeof u=="function"||typeof a.getSnapshotBeforeUpdate=="function";f||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(i!==s||c!==d)&&lc(t,a,s,d),bt=!1;var m=t.memoizedState;a.state=m,Ys(t,s,a,l),c=t.memoizedState,i!==s||m!==c||Te.current||bt?(typeof u=="function"&&(Fo(t,n,u,s),c=t.memoizedState),(i=bt||sc(t,n,i,s,m,c,d))?(f||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(t.flags|=4194308)):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=s,t.memoizedState=c),a.props=s,a.state=c,a.context=d,s=i):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{a=t.stateNode,iu(e,t),i=t.memoizedProps,d=t.type===t.elementType?i:qe(t.type,i),a.props=d,f=t.pendingProps,m=a.context,c=n.contextType,typeof c=="object"&&c!==null?c=Ve(c):(c=_e(n)?sn:we.current,c=An(t,c));var g=n.getDerivedStateFromProps;(u=typeof g=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(i!==f||m!==c)&&lc(t,a,s,c),bt=!1,m=t.memoizedState,a.state=m,Ys(t,s,a,l);var v=t.memoizedState;i!==f||m!==v||Te.current||bt?(typeof g=="function"&&(Fo(t,n,g,s),v=t.memoizedState),(d=bt||sc(t,n,d,s,m,v,c)||!1)?(u||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(s,v,c),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(s,v,c)),typeof a.componentDidUpdate=="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!="function"||i===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||i===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=v),a.props=s,a.state=v,a.context=c,s=d):(typeof a.componentDidUpdate!="function"||i===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||i===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),s=!1)}return Ko(e,t,n,s,o,l)}function Ko(e,t,n,s,l,o){Lu(e,t);var a=(t.flags&128)!==0;if(!s&&!a)return l&&qi(t,n,!1),jt(e,t,o);s=t.stateNode,Dh.current=t;var i=a&&typeof n.getDerivedStateFromError!="function"?null:s.render();return t.flags|=1,e!==null&&a?(t.child=Wn(t,e.child,null,o),t.child=Wn(t,null,i,o)):Se(e,t,i,o),t.memoizedState=s.state,l&&qi(t,n,!0),t.child}function Du(e){var t=e.stateNode;t.pendingContext?Gi(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Gi(e,t.context,!1),Aa(e,t.containerInfo)}function pc(e,t,n,s,l){return Bn(),Ra(l),t.flags|=256,Se(e,t,n,s),t.child}var Qo={dehydrated:null,treeContext:null,retryLane:0};function Yo(e){return{baseLanes:e,cachePool:null,transitions:null}}function Iu(e,t,n){var s=t.pendingProps,l=X.current,o=!1,a=(t.flags&128)!==0,i;if((i=a)||(i=e!==null&&e.memoizedState===null?!1:(l&2)!==0),i?(o=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(l|=1),Q(X,l&1),e===null)return Wo(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(a=s.children,e=s.fallback,o?(s=t.mode,o=t.child,a={mode:"hidden",children:a},!(s&1)&&o!==null?(o.childLanes=0,o.pendingProps=a):o=gl(a,s,0,null),e=rn(e,s,n,null),o.return=t,e.return=t,o.sibling=e,t.child=o,t.child.memoizedState=Yo(n),t.memoizedState=Qo,e):Ka(t,a));if(l=e.memoizedState,l!==null&&(i=l.dehydrated,i!==null))return Ih(e,t,a,s,i,l,n);if(o){o=s.fallback,a=t.mode,l=e.child,i=l.sibling;var c={mode:"hidden",children:s.children};return!(a&1)&&t.child!==l?(s=t.child,s.childLanes=0,s.pendingProps=c,t.deletions=null):(s=At(l,c),s.subtreeFlags=l.subtreeFlags&14680064),i!==null?o=At(i,o):(o=rn(o,a,n,null),o.flags|=2),o.return=t,s.return=t,s.sibling=o,t.child=s,s=o,o=t.child,a=e.child.memoizedState,a=a===null?Yo(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},o.memoizedState=a,o.childLanes=e.childLanes&~n,t.memoizedState=Qo,s}return o=e.child,e=o.sibling,s=At(o,{mode:"visible",children:s.children}),!(t.mode&1)&&(s.lanes=n),s.return=t,s.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=s,t.memoizedState=null,s}function Ka(e,t){return t=gl({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function ls(e,t,n,s){return s!==null&&Ra(s),Wn(t,e.child,null,n),e=Ka(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Ih(e,t,n,s,l,o,a){if(n)return t.flags&256?(t.flags&=-257,s=Zl(Error(T(422))),ls(e,t,a,s)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(o=s.fallback,l=t.mode,s=gl({mode:"visible",children:s.children},l,0,null),o=rn(o,l,a,null),o.flags|=2,s.return=t,o.return=t,s.sibling=o,t.child=s,t.mode&1&&Wn(t,e.child,null,a),t.child.memoizedState=Yo(a),t.memoizedState=Qo,o);if(!(t.mode&1))return ls(e,t,a,null);if(l.data==="$!"){if(s=l.nextSibling&&l.nextSibling.dataset,s)var i=s.dgst;return s=i,o=Error(T(419)),s=Zl(o,s,void 0),ls(e,t,a,s)}if(i=(a&e.childLanes)!==0,Ee||i){if(s=pe,s!==null){switch(a&-a){case 4:l=2;break;case 16:l=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:l=32;break;case 536870912:l=268435456;break;default:l=0}l=l&(s.suspendedLanes|a)?0:l,l!==0&&l!==o.retryLane&&(o.retryLane=l,yt(e,l),et(s,e,l,-1))}return Ja(),s=Zl(Error(T(421))),ls(e,t,a,s)}return l.data==="$?"?(t.flags|=128,t.child=e.child,t=Gh.bind(null,e),l._reactRetry=t,null):(e=o.treeContext,De=Lt(l.nextSibling),Ie=t,q=!0,Je=null,e!==null&&(We[$e++]=ht,We[$e++]=mt,We[$e++]=ln,ht=e.id,mt=e.overflow,ln=t),t=Ka(t,s.children),t.flags|=4096,t)}function fc(e,t,n){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),$o(e.return,t,n)}function eo(e,t,n,s,l){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:n,tailMode:l}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=s,o.tail=n,o.tailMode=l)}function Ou(e,t,n){var s=t.pendingProps,l=s.revealOrder,o=s.tail;if(Se(e,t,s.children,n),s=X.current,s&2)s=s&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&fc(e,n,t);else if(e.tag===19)fc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}s&=1}if(Q(X,s),!(t.mode&1))t.memoizedState=null;else switch(l){case"forwards":for(n=t.child,l=null;n!==null;)e=n.alternate,e!==null&&Gs(e)===null&&(l=n),n=n.sibling;n=l,n===null?(l=t.child,t.child=null):(l=n.sibling,n.sibling=null),eo(t,!1,l,n,o);break;case"backwards":for(n=null,l=t.child,t.child=null;l!==null;){if(e=l.alternate,e!==null&&Gs(e)===null){t.child=l;break}e=l.sibling,l.sibling=n,n=l,l=e}eo(t,!0,n,null,o);break;case"together":eo(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Es(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function jt(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),an|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(T(153));if(t.child!==null){for(e=t.child,n=At(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=At(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Oh(e,t,n){switch(t.tag){case 3:Du(t),Bn();break;case 5:cu(t);break;case 1:_e(t.type)&&Hs(t);break;case 4:Aa(t,t.stateNode.containerInfo);break;case 10:var s=t.type._context,l=t.memoizedProps.value;Q(Ks,s._currentValue),s._currentValue=l;break;case 13:if(s=t.memoizedState,s!==null)return s.dehydrated!==null?(Q(X,X.current&1),t.flags|=128,null):n&t.child.childLanes?Iu(e,t,n):(Q(X,X.current&1),e=jt(e,t,n),e!==null?e.sibling:null);Q(X,X.current&1);break;case 19:if(s=(n&t.childLanes)!==0,e.flags&128){if(s)return Ou(e,t,n);t.flags|=128}if(l=t.memoizedState,l!==null&&(l.rendering=null,l.tail=null,l.lastEffect=null),Q(X,X.current),s)break;return null;case 22:case 23:return t.lanes=0,Pu(e,t,n)}return jt(e,t,n)}var Au,Go,Bu,Wu;Au=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Go=function(){};Bu=function(e,t,n,s){var l=e.memoizedProps;if(l!==s){e=t.stateNode,tn(ct.current);var o=null;switch(n){case"input":l=go(e,l),s=go(e,s),o=[];break;case"select":l=Z({},l,{value:void 0}),s=Z({},s,{value:void 0}),o=[];break;case"textarea":l=jo(e,l),s=jo(e,s),o=[];break;default:typeof l.onClick!="function"&&typeof s.onClick=="function"&&(e.onclick=$s)}So(n,s);var a;n=null;for(d in l)if(!s.hasOwnProperty(d)&&l.hasOwnProperty(d)&&l[d]!=null)if(d==="style"){var i=l[d];for(a in i)i.hasOwnProperty(a)&&(n||(n={}),n[a]="")}else d!=="dangerouslySetInnerHTML"&&d!=="children"&&d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&d!=="autoFocus"&&(yr.hasOwnProperty(d)?o||(o=[]):(o=o||[]).push(d,null));for(d in s){var c=s[d];if(i=l?.[d],s.hasOwnProperty(d)&&c!==i&&(c!=null||i!=null))if(d==="style")if(i){for(a in i)!i.hasOwnProperty(a)||c&&c.hasOwnProperty(a)||(n||(n={}),n[a]="");for(a in c)c.hasOwnProperty(a)&&i[a]!==c[a]&&(n||(n={}),n[a]=c[a])}else n||(o||(o=[]),o.push(d,n)),n=c;else d==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,i=i?i.__html:void 0,c!=null&&i!==c&&(o=o||[]).push(d,c)):d==="children"?typeof c!="string"&&typeof c!="number"||(o=o||[]).push(d,""+c):d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&(yr.hasOwnProperty(d)?(c!=null&&d==="onScroll"&&Y("scroll",e),o||i===c||(o=[])):(o=o||[]).push(d,c))}n&&(o=o||[]).push("style",n);var d=o;(t.updateQueue=d)&&(t.flags|=4)}};Wu=function(e,t,n,s){n!==s&&(t.flags|=4)};function tr(e,t){if(!q)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var s=null;n!==null;)n.alternate!==null&&(s=n),n=n.sibling;s===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function ye(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,s=0;if(t)for(var l=e.child;l!==null;)n|=l.lanes|l.childLanes,s|=l.subtreeFlags&14680064,s|=l.flags&14680064,l.return=e,l=l.sibling;else for(l=e.child;l!==null;)n|=l.lanes|l.childLanes,s|=l.subtreeFlags,s|=l.flags,l.return=e,l=l.sibling;return e.subtreeFlags|=s,e.childLanes=n,t}function Ah(e,t,n){var s=t.pendingProps;switch(Ma(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ye(t),null;case 1:return _e(t.type)&&Fs(),ye(t),null;case 3:return s=t.stateNode,$n(),G(Te),G(we),Wa(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(e===null||e.child===null)&&(rs(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Je!==null&&(ra(Je),Je=null))),Go(e,t),ye(t),null;case 5:Ba(t);var l=tn(Mr.current);if(n=t.type,e!==null&&t.stateNode!=null)Bu(e,t,n,s,l),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!s){if(t.stateNode===null)throw Error(T(166));return ye(t),null}if(e=tn(ct.current),rs(t)){s=t.stateNode,n=t.type;var o=t.memoizedProps;switch(s[at]=t,s[Tr]=o,e=(t.mode&1)!==0,n){case"dialog":Y("cancel",s),Y("close",s);break;case"iframe":case"object":case"embed":Y("load",s);break;case"video":case"audio":for(l=0;l<ir.length;l++)Y(ir[l],s);break;case"source":Y("error",s);break;case"img":case"image":case"link":Y("error",s),Y("load",s);break;case"details":Y("toggle",s);break;case"input":Si(s,o),Y("invalid",s);break;case"select":s._wrapperState={wasMultiple:!!o.multiple},Y("invalid",s);break;case"textarea":bi(s,o),Y("invalid",s)}So(n,o),l=null;for(var a in o)if(o.hasOwnProperty(a)){var i=o[a];a==="children"?typeof i=="string"?s.textContent!==i&&(o.suppressHydrationWarning!==!0&&ns(s.textContent,i,e),l=["children",i]):typeof i=="number"&&s.textContent!==""+i&&(o.suppressHydrationWarning!==!0&&ns(s.textContent,i,e),l=["children",""+i]):yr.hasOwnProperty(a)&&i!=null&&a==="onScroll"&&Y("scroll",s)}switch(n){case"input":Yr(s),ki(s,o,!0);break;case"textarea":Yr(s),Ni(s);break;case"select":case"option":break;default:typeof o.onClick=="function"&&(s.onclick=$s)}s=l,t.updateQueue=s,s!==null&&(t.flags|=4)}else{a=l.nodeType===9?l:l.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=hd(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=a.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof s.is=="string"?e=a.createElement(n,{is:s.is}):(e=a.createElement(n),n==="select"&&(a=e,s.multiple?a.multiple=!0:s.size&&(a.size=s.size))):e=a.createElementNS(e,n),e[at]=t,e[Tr]=s,Au(e,t,!1,!1),t.stateNode=e;e:{switch(a=ko(n,s),n){case"dialog":Y("cancel",e),Y("close",e),l=s;break;case"iframe":case"object":case"embed":Y("load",e),l=s;break;case"video":case"audio":for(l=0;l<ir.length;l++)Y(ir[l],e);l=s;break;case"source":Y("error",e),l=s;break;case"img":case"image":case"link":Y("error",e),Y("load",e),l=s;break;case"details":Y("toggle",e),l=s;break;case"input":Si(e,s),l=go(e,s),Y("invalid",e);break;case"option":l=s;break;case"select":e._wrapperState={wasMultiple:!!s.multiple},l=Z({},s,{value:void 0}),Y("invalid",e);break;case"textarea":bi(e,s),l=jo(e,s),Y("invalid",e);break;default:l=s}So(n,l),i=l;for(o in i)if(i.hasOwnProperty(o)){var c=i[o];o==="style"?gd(e,c):o==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&md(e,c)):o==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&jr(e,c):typeof c=="number"&&jr(e,""+c):o!=="suppressContentEditableWarning"&&o!=="suppressHydrationWarning"&&o!=="autoFocus"&&(yr.hasOwnProperty(o)?c!=null&&o==="onScroll"&&Y("scroll",e):c!=null&&xa(e,o,c,a))}switch(n){case"input":Yr(e),ki(e,s,!1);break;case"textarea":Yr(e),Ni(e);break;case"option":s.value!=null&&e.setAttribute("value",""+Bt(s.value));break;case"select":e.multiple=!!s.multiple,o=s.value,o!=null?Mn(e,!!s.multiple,o,!1):s.defaultValue!=null&&Mn(e,!!s.multiple,s.defaultValue,!0);break;default:typeof l.onClick=="function"&&(e.onclick=$s)}switch(n){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}}s&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return ye(t),null;case 6:if(e&&t.stateNode!=null)Wu(e,t,e.memoizedProps,s);else{if(typeof s!="string"&&t.stateNode===null)throw Error(T(166));if(n=tn(Mr.current),tn(ct.current),rs(t)){if(s=t.stateNode,n=t.memoizedProps,s[at]=t,(o=s.nodeValue!==n)&&(e=Ie,e!==null))switch(e.tag){case 3:ns(s.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&ns(s.nodeValue,n,(e.mode&1)!==0)}o&&(t.flags|=4)}else s=(n.nodeType===9?n:n.ownerDocument).createTextNode(s),s[at]=t,t.stateNode=s}return ye(t),null;case 13:if(G(X),s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(q&&De!==null&&t.mode&1&&!(t.flags&128))su(),Bn(),t.flags|=98560,o=!1;else if(o=rs(t),s!==null&&s.dehydrated!==null){if(e===null){if(!o)throw Error(T(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(T(317));o[at]=t}else Bn(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;ye(t),o=!1}else Je!==null&&(ra(Je),Je=null),o=!0;if(!o)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(s=s!==null,s!==(e!==null&&e.memoizedState!==null)&&s&&(t.child.flags|=8192,t.mode&1&&(e===null||X.current&1?ie===0&&(ie=3):Ja())),t.updateQueue!==null&&(t.flags|=4),ye(t),null);case 4:return $n(),Go(e,t),e===null&&Cr(t.stateNode.containerInfo),ye(t),null;case 10:return Da(t.type._context),ye(t),null;case 17:return _e(t.type)&&Fs(),ye(t),null;case 19:if(G(X),o=t.memoizedState,o===null)return ye(t),null;if(s=(t.flags&128)!==0,a=o.rendering,a===null)if(s)tr(o,!1);else{if(ie!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=Gs(e),a!==null){for(t.flags|=128,tr(o,!1),s=a.updateQueue,s!==null&&(t.updateQueue=s,t.flags|=4),t.subtreeFlags=0,s=n,n=t.child;n!==null;)o=n,e=s,o.flags&=14680066,a=o.alternate,a===null?(o.childLanes=0,o.lanes=e,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=a.childLanes,o.lanes=a.lanes,o.child=a.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=a.memoizedProps,o.memoizedState=a.memoizedState,o.updateQueue=a.updateQueue,o.type=a.type,e=a.dependencies,o.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return Q(X,X.current&1|2),t.child}e=e.sibling}o.tail!==null&&re()>Hn&&(t.flags|=128,s=!0,tr(o,!1),t.lanes=4194304)}else{if(!s)if(e=Gs(a),e!==null){if(t.flags|=128,s=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),tr(o,!0),o.tail===null&&o.tailMode==="hidden"&&!a.alternate&&!q)return ye(t),null}else 2*re()-o.renderingStartTime>Hn&&n!==1073741824&&(t.flags|=128,s=!0,tr(o,!1),t.lanes=4194304);o.isBackwards?(a.sibling=t.child,t.child=a):(n=o.last,n!==null?n.sibling=a:t.child=a,o.last=a)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=re(),t.sibling=null,n=X.current,Q(X,s?n&1|2:n&1),t):(ye(t),null);case 22:case 23:return Xa(),s=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==s&&(t.flags|=8192),s&&t.mode&1?Le&1073741824&&(ye(t),t.subtreeFlags&6&&(t.flags|=8192)):ye(t),null;case 24:return null;case 25:return null}throw Error(T(156,t.tag))}function Bh(e,t){switch(Ma(t),t.tag){case 1:return _e(t.type)&&Fs(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return $n(),G(Te),G(we),Wa(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Ba(t),null;case 13:if(G(X),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(T(340));Bn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return G(X),null;case 4:return $n(),null;case 10:return Da(t.type._context),null;case 22:case 23:return Xa(),null;case 24:return null;default:return null}}var os=!1,je=!1,Wh=typeof WeakSet=="function"?WeakSet:Set,R=null;function En(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(s){te(e,t,s)}else n.current=null}function qo(e,t,n){try{n()}catch(s){te(e,t,s)}}var hc=!1;function $h(e,t){if(Po=As,e=Vd(),Ta(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var s=n.getSelection&&n.getSelection();if(s&&s.rangeCount!==0){n=s.anchorNode;var l=s.anchorOffset,o=s.focusNode;s=s.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var a=0,i=-1,c=-1,d=0,u=0,f=e,m=null;t:for(;;){for(var g;f!==n||l!==0&&f.nodeType!==3||(i=a+l),f!==o||s!==0&&f.nodeType!==3||(c=a+s),f.nodeType===3&&(a+=f.nodeValue.length),(g=f.firstChild)!==null;)m=f,f=g;for(;;){if(f===e)break t;if(m===n&&++d===l&&(i=a),m===o&&++u===s&&(c=a),(g=f.nextSibling)!==null)break;f=m,m=f.parentNode}f=g}n=i===-1||c===-1?null:{start:i,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Lo={focusedElem:e,selectionRange:n},As=!1,R=t;R!==null;)if(t=R,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,R=e;else for(;R!==null;){t=R;try{var v=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var p=v.memoizedProps,w=v.memoizedState,h=t.stateNode,x=h.getSnapshotBeforeUpdate(t.elementType===t.type?p:qe(t.type,p),w);h.__reactInternalSnapshotBeforeUpdate=x}break;case 3:var j=t.stateNode.containerInfo;j.nodeType===1?j.textContent="":j.nodeType===9&&j.documentElement&&j.removeChild(j.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(T(163))}}catch(y){te(t,t.return,y)}if(e=t.sibling,e!==null){e.return=t.return,R=e;break}R=t.return}return v=hc,hc=!1,v}function xr(e,t,n){var s=t.updateQueue;if(s=s!==null?s.lastEffect:null,s!==null){var l=s=s.next;do{if((l.tag&e)===e){var o=l.destroy;l.destroy=void 0,o!==void 0&&qo(t,n,o)}l=l.next}while(l!==s)}}function ml(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var s=n.create;n.destroy=s()}n=n.next}while(n!==t)}}function Xo(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function $u(e){var t=e.alternate;t!==null&&(e.alternate=null,$u(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[at],delete t[Tr],delete t[Oo],delete t[kh],delete t[bh])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Fu(e){return e.tag===5||e.tag===3||e.tag===4}function mc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Fu(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Jo(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=$s));else if(s!==4&&(e=e.child,e!==null))for(Jo(e,t,n),e=e.sibling;e!==null;)Jo(e,t,n),e=e.sibling}function Zo(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(s!==4&&(e=e.child,e!==null))for(Zo(e,t,n),e=e.sibling;e!==null;)Zo(e,t,n),e=e.sibling}var he=null,Xe=!1;function St(e,t,n){for(n=n.child;n!==null;)Hu(e,t,n),n=n.sibling}function Hu(e,t,n){if(it&&typeof it.onCommitFiberUnmount=="function")try{it.onCommitFiberUnmount(al,n)}catch{}switch(n.tag){case 5:je||En(n,t);case 6:var s=he,l=Xe;he=null,St(e,t,n),he=s,Xe=l,he!==null&&(Xe?(e=he,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):he.removeChild(n.stateNode));break;case 18:he!==null&&(Xe?(e=he,n=n.stateNode,e.nodeType===8?Ql(e.parentNode,n):e.nodeType===1&&Ql(e,n),br(e)):Ql(he,n.stateNode));break;case 4:s=he,l=Xe,he=n.stateNode.containerInfo,Xe=!0,St(e,t,n),he=s,Xe=l;break;case 0:case 11:case 14:case 15:if(!je&&(s=n.updateQueue,s!==null&&(s=s.lastEffect,s!==null))){l=s=s.next;do{var o=l,a=o.destroy;o=o.tag,a!==void 0&&(o&2||o&4)&&qo(n,t,a),l=l.next}while(l!==s)}St(e,t,n);break;case 1:if(!je&&(En(n,t),s=n.stateNode,typeof s.componentWillUnmount=="function"))try{s.props=n.memoizedProps,s.state=n.memoizedState,s.componentWillUnmount()}catch(i){te(n,t,i)}St(e,t,n);break;case 21:St(e,t,n);break;case 22:n.mode&1?(je=(s=je)||n.memoizedState!==null,St(e,t,n),je=s):St(e,t,n);break;default:St(e,t,n)}}function xc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Wh),t.forEach(function(s){var l=qh.bind(null,e,s);n.has(s)||(n.add(s),s.then(l,l))})}}function Ge(e,t){var n=t.deletions;if(n!==null)for(var s=0;s<n.length;s++){var l=n[s];try{var o=e,a=t,i=a;e:for(;i!==null;){switch(i.tag){case 5:he=i.stateNode,Xe=!1;break e;case 3:he=i.stateNode.containerInfo,Xe=!0;break e;case 4:he=i.stateNode.containerInfo,Xe=!0;break e}i=i.return}if(he===null)throw Error(T(160));Hu(o,a,l),he=null,Xe=!1;var c=l.alternate;c!==null&&(c.return=null),l.return=null}catch(d){te(l,t,d)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Uu(t,e),t=t.sibling}function Uu(e,t){var n=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Ge(t,e),lt(e),s&4){try{xr(3,e,e.return),ml(3,e)}catch(p){te(e,e.return,p)}try{xr(5,e,e.return)}catch(p){te(e,e.return,p)}}break;case 1:Ge(t,e),lt(e),s&512&&n!==null&&En(n,n.return);break;case 5:if(Ge(t,e),lt(e),s&512&&n!==null&&En(n,n.return),e.flags&32){var l=e.stateNode;try{jr(l,"")}catch(p){te(e,e.return,p)}}if(s&4&&(l=e.stateNode,l!=null)){var o=e.memoizedProps,a=n!==null?n.memoizedProps:o,i=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{i==="input"&&o.type==="radio"&&o.name!=null&&pd(l,o),ko(i,a);var d=ko(i,o);for(a=0;a<c.length;a+=2){var u=c[a],f=c[a+1];u==="style"?gd(l,f):u==="dangerouslySetInnerHTML"?md(l,f):u==="children"?jr(l,f):xa(l,u,f,d)}switch(i){case"input":vo(l,o);break;case"textarea":fd(l,o);break;case"select":var m=l._wrapperState.wasMultiple;l._wrapperState.wasMultiple=!!o.multiple;var g=o.value;g!=null?Mn(l,!!o.multiple,g,!1):m!==!!o.multiple&&(o.defaultValue!=null?Mn(l,!!o.multiple,o.defaultValue,!0):Mn(l,!!o.multiple,o.multiple?[]:"",!1))}l[Tr]=o}catch(p){te(e,e.return,p)}}break;case 6:if(Ge(t,e),lt(e),s&4){if(e.stateNode===null)throw Error(T(162));l=e.stateNode,o=e.memoizedProps;try{l.nodeValue=o}catch(p){te(e,e.return,p)}}break;case 3:if(Ge(t,e),lt(e),s&4&&n!==null&&n.memoizedState.isDehydrated)try{br(t.containerInfo)}catch(p){te(e,e.return,p)}break;case 4:Ge(t,e),lt(e);break;case 13:Ge(t,e),lt(e),l=e.child,l.flags&8192&&(o=l.memoizedState!==null,l.stateNode.isHidden=o,!o||l.alternate!==null&&l.alternate.memoizedState!==null||(Ga=re())),s&4&&xc(e);break;case 22:if(u=n!==null&&n.memoizedState!==null,e.mode&1?(je=(d=je)||u,Ge(t,e),je=d):Ge(t,e),lt(e),s&8192){if(d=e.memoizedState!==null,(e.stateNode.isHidden=d)&&!u&&e.mode&1)for(R=e,u=e.child;u!==null;){for(f=R=u;R!==null;){switch(m=R,g=m.child,m.tag){case 0:case 11:case 14:case 15:xr(4,m,m.return);break;case 1:En(m,m.return);var v=m.stateNode;if(typeof v.componentWillUnmount=="function"){s=m,n=m.return;try{t=s,v.props=t.memoizedProps,v.state=t.memoizedState,v.componentWillUnmount()}catch(p){te(s,n,p)}}break;case 5:En(m,m.return);break;case 22:if(m.memoizedState!==null){vc(f);continue}}g!==null?(g.return=m,R=g):vc(f)}u=u.sibling}e:for(u=null,f=e;;){if(f.tag===5){if(u===null){u=f;try{l=f.stateNode,d?(o=l.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none"):(i=f.stateNode,c=f.memoizedProps.style,a=c!=null&&c.hasOwnProperty("display")?c.display:null,i.style.display=xd("display",a))}catch(p){te(e,e.return,p)}}}else if(f.tag===6){if(u===null)try{f.stateNode.nodeValue=d?"":f.memoizedProps}catch(p){te(e,e.return,p)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break e;for(;f.sibling===null;){if(f.return===null||f.return===e)break e;u===f&&(u=null),f=f.return}u===f&&(u=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:Ge(t,e),lt(e),s&4&&xc(e);break;case 21:break;default:Ge(t,e),lt(e)}}function lt(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(Fu(n)){var s=n;break e}n=n.return}throw Error(T(160))}switch(s.tag){case 5:var l=s.stateNode;s.flags&32&&(jr(l,""),s.flags&=-33);var o=mc(e);Zo(e,o,l);break;case 3:case 4:var a=s.stateNode.containerInfo,i=mc(e);Jo(e,i,a);break;default:throw Error(T(161))}}catch(c){te(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Fh(e,t,n){R=e,Vu(e)}function Vu(e,t,n){for(var s=(e.mode&1)!==0;R!==null;){var l=R,o=l.child;if(l.tag===22&&s){var a=l.memoizedState!==null||os;if(!a){var i=l.alternate,c=i!==null&&i.memoizedState!==null||je;i=os;var d=je;if(os=a,(je=c)&&!d)for(R=l;R!==null;)a=R,c=a.child,a.tag===22&&a.memoizedState!==null?yc(l):c!==null?(c.return=a,R=c):yc(l);for(;o!==null;)R=o,Vu(o),o=o.sibling;R=l,os=i,je=d}gc(e)}else l.subtreeFlags&8772&&o!==null?(o.return=l,R=o):gc(e)}}function gc(e){for(;R!==null;){var t=R;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:je||ml(5,t);break;case 1:var s=t.stateNode;if(t.flags&4&&!je)if(n===null)s.componentDidMount();else{var l=t.elementType===t.type?n.memoizedProps:qe(t.type,n.memoizedProps);s.componentDidUpdate(l,n.memoizedState,s.__reactInternalSnapshotBeforeUpdate)}var o=t.updateQueue;o!==null&&tc(t,o,s);break;case 3:var a=t.updateQueue;if(a!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}tc(t,a,n)}break;case 5:var i=t.stateNode;if(n===null&&t.flags&4){n=i;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var d=t.alternate;if(d!==null){var u=d.memoizedState;if(u!==null){var f=u.dehydrated;f!==null&&br(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(T(163))}je||t.flags&512&&Xo(t)}catch(m){te(t,t.return,m)}}if(t===e){R=null;break}if(n=t.sibling,n!==null){n.return=t.return,R=n;break}R=t.return}}function vc(e){for(;R!==null;){var t=R;if(t===e){R=null;break}var n=t.sibling;if(n!==null){n.return=t.return,R=n;break}R=t.return}}function yc(e){for(;R!==null;){var t=R;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{ml(4,t)}catch(c){te(t,n,c)}break;case 1:var s=t.stateNode;if(typeof s.componentDidMount=="function"){var l=t.return;try{s.componentDidMount()}catch(c){te(t,l,c)}}var o=t.return;try{Xo(t)}catch(c){te(t,o,c)}break;case 5:var a=t.return;try{Xo(t)}catch(c){te(t,a,c)}}}catch(c){te(t,t.return,c)}if(t===e){R=null;break}var i=t.sibling;if(i!==null){i.return=t.return,R=i;break}R=t.return}}var Hh=Math.ceil,Js=wt.ReactCurrentDispatcher,Qa=wt.ReactCurrentOwner,He=wt.ReactCurrentBatchConfig,$=0,pe=null,le=null,me=0,Le=0,Tn=Ht(0),ie=0,Dr=null,an=0,xl=0,Ya=0,gr=null,Ce=null,Ga=0,Hn=1/0,pt=null,Zs=!1,ea=null,It=null,as=!1,Tt=null,el=0,vr=0,ta=null,Ts=-1,_s=0;function ke(){return $&6?re():Ts!==-1?Ts:Ts=re()}function Ot(e){return e.mode&1?$&2&&me!==0?me&-me:zh.transition!==null?(_s===0&&(_s=Td()),_s):(e=V,e!==0||(e=window.event,e=e===void 0?16:Id(e.type)),e):1}function et(e,t,n,s){if(50<vr)throw vr=0,ta=null,Error(T(185));Br(e,n,s),(!($&2)||e!==pe)&&(e===pe&&(!($&2)&&(xl|=n),ie===4&&zt(e,me)),Me(e,s),n===1&&$===0&&!(t.mode&1)&&(Hn=re()+500,pl&&Ut()))}function Me(e,t){var n=e.callbackNode;zf(e,t);var s=Os(e,e===pe?me:0);if(s===0)n!==null&&Ei(n),e.callbackNode=null,e.callbackPriority=0;else if(t=s&-s,e.callbackPriority!==t){if(n!=null&&Ei(n),t===1)e.tag===0?Nh(jc.bind(null,e)):tu(jc.bind(null,e)),wh(function(){!($&6)&&Ut()}),n=null;else{switch(_d(s)){case 1:n=wa;break;case 4:n=Cd;break;case 16:n=Is;break;case 536870912:n=Ed;break;default:n=Is}n=Zu(n,Ku.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Ku(e,t){if(Ts=-1,_s=0,$&6)throw Error(T(327));var n=e.callbackNode;if(In()&&e.callbackNode!==n)return null;var s=Os(e,e===pe?me:0);if(s===0)return null;if(s&30||s&e.expiredLanes||t)t=tl(e,s);else{t=s;var l=$;$|=2;var o=Yu();(pe!==e||me!==t)&&(pt=null,Hn=re()+500,nn(e,t));do try{Kh();break}catch(i){Qu(e,i)}while(!0);La(),Js.current=o,$=l,le!==null?t=0:(pe=null,me=0,t=ie)}if(t!==0){if(t===2&&(l=Eo(e),l!==0&&(s=l,t=na(e,l))),t===1)throw n=Dr,nn(e,0),zt(e,s),Me(e,re()),n;if(t===6)zt(e,s);else{if(l=e.current.alternate,!(s&30)&&!Uh(l)&&(t=tl(e,s),t===2&&(o=Eo(e),o!==0&&(s=o,t=na(e,o))),t===1))throw n=Dr,nn(e,0),zt(e,s),Me(e,re()),n;switch(e.finishedWork=l,e.finishedLanes=s,t){case 0:case 1:throw Error(T(345));case 2:Xt(e,Ce,pt);break;case 3:if(zt(e,s),(s&130023424)===s&&(t=Ga+500-re(),10<t)){if(Os(e,0)!==0)break;if(l=e.suspendedLanes,(l&s)!==s){ke(),e.pingedLanes|=e.suspendedLanes&l;break}e.timeoutHandle=Io(Xt.bind(null,e,Ce,pt),t);break}Xt(e,Ce,pt);break;case 4:if(zt(e,s),(s&4194240)===s)break;for(t=e.eventTimes,l=-1;0<s;){var a=31-Ze(s);o=1<<a,a=t[a],a>l&&(l=a),s&=~o}if(s=l,s=re()-s,s=(120>s?120:480>s?480:1080>s?1080:1920>s?1920:3e3>s?3e3:4320>s?4320:1960*Hh(s/1960))-s,10<s){e.timeoutHandle=Io(Xt.bind(null,e,Ce,pt),s);break}Xt(e,Ce,pt);break;case 5:Xt(e,Ce,pt);break;default:throw Error(T(329))}}}return Me(e,re()),e.callbackNode===n?Ku.bind(null,e):null}function na(e,t){var n=gr;return e.current.memoizedState.isDehydrated&&(nn(e,t).flags|=256),e=tl(e,t),e!==2&&(t=Ce,Ce=n,t!==null&&ra(t)),e}function ra(e){Ce===null?Ce=e:Ce.push.apply(Ce,e)}function Uh(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var s=0;s<n.length;s++){var l=n[s],o=l.getSnapshot;l=l.value;try{if(!tt(o(),l))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function zt(e,t){for(t&=~Ya,t&=~xl,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Ze(t),s=1<<n;e[n]=-1,t&=~s}}function jc(e){if($&6)throw Error(T(327));In();var t=Os(e,0);if(!(t&1))return Me(e,re()),null;var n=tl(e,t);if(e.tag!==0&&n===2){var s=Eo(e);s!==0&&(t=s,n=na(e,s))}if(n===1)throw n=Dr,nn(e,0),zt(e,t),Me(e,re()),n;if(n===6)throw Error(T(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Xt(e,Ce,pt),Me(e,re()),null}function qa(e,t){var n=$;$|=1;try{return e(t)}finally{$=n,$===0&&(Hn=re()+500,pl&&Ut())}}function cn(e){Tt!==null&&Tt.tag===0&&!($&6)&&In();var t=$;$|=1;var n=He.transition,s=V;try{if(He.transition=null,V=1,e)return e()}finally{V=s,He.transition=n,$=t,!($&6)&&Ut()}}function Xa(){Le=Tn.current,G(Tn)}function nn(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,jh(n)),le!==null)for(n=le.return;n!==null;){var s=n;switch(Ma(s),s.tag){case 1:s=s.type.childContextTypes,s!=null&&Fs();break;case 3:$n(),G(Te),G(we),Wa();break;case 5:Ba(s);break;case 4:$n();break;case 13:G(X);break;case 19:G(X);break;case 10:Da(s.type._context);break;case 22:case 23:Xa()}n=n.return}if(pe=e,le=e=At(e.current,null),me=Le=t,ie=0,Dr=null,Ya=xl=an=0,Ce=gr=null,en!==null){for(t=0;t<en.length;t++)if(n=en[t],s=n.interleaved,s!==null){n.interleaved=null;var l=s.next,o=n.pending;if(o!==null){var a=o.next;o.next=l,s.next=a}n.pending=s}en=null}return e}function Qu(e,t){do{var n=le;try{if(La(),zs.current=Xs,qs){for(var s=J.memoizedState;s!==null;){var l=s.queue;l!==null&&(l.pending=null),s=s.next}qs=!1}if(on=0,de=ae=J=null,mr=!1,Rr=0,Qa.current=null,n===null||n.return===null){ie=1,Dr=t,le=null;break}e:{var o=e,a=n.return,i=n,c=t;if(t=me,i.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var d=c,u=i,f=u.tag;if(!(u.mode&1)&&(f===0||f===11||f===15)){var m=u.alternate;m?(u.updateQueue=m.updateQueue,u.memoizedState=m.memoizedState,u.lanes=m.lanes):(u.updateQueue=null,u.memoizedState=null)}var g=ac(a);if(g!==null){g.flags&=-257,ic(g,a,i,o,t),g.mode&1&&oc(o,d,t),t=g,c=d;var v=t.updateQueue;if(v===null){var p=new Set;p.add(c),t.updateQueue=p}else v.add(c);break e}else{if(!(t&1)){oc(o,d,t),Ja();break e}c=Error(T(426))}}else if(q&&i.mode&1){var w=ac(a);if(w!==null){!(w.flags&65536)&&(w.flags|=256),ic(w,a,i,o,t),Ra(Fn(c,i));break e}}o=c=Fn(c,i),ie!==4&&(ie=2),gr===null?gr=[o]:gr.push(o),o=a;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var h=_u(o,c,t);ec(o,h);break e;case 1:i=c;var x=o.type,j=o.stateNode;if(!(o.flags&128)&&(typeof x.getDerivedStateFromError=="function"||j!==null&&typeof j.componentDidCatch=="function"&&(It===null||!It.has(j)))){o.flags|=65536,t&=-t,o.lanes|=t;var y=Mu(o,i,t);ec(o,y);break e}}o=o.return}while(o!==null)}qu(n)}catch(S){t=S,le===n&&n!==null&&(le=n=n.return);continue}break}while(!0)}function Yu(){var e=Js.current;return Js.current=Xs,e===null?Xs:e}function Ja(){(ie===0||ie===3||ie===2)&&(ie=4),pe===null||!(an&268435455)&&!(xl&268435455)||zt(pe,me)}function tl(e,t){var n=$;$|=2;var s=Yu();(pe!==e||me!==t)&&(pt=null,nn(e,t));do try{Vh();break}catch(l){Qu(e,l)}while(!0);if(La(),$=n,Js.current=s,le!==null)throw Error(T(261));return pe=null,me=0,ie}function Vh(){for(;le!==null;)Gu(le)}function Kh(){for(;le!==null&&!gf();)Gu(le)}function Gu(e){var t=Ju(e.alternate,e,Le);e.memoizedProps=e.pendingProps,t===null?qu(e):le=t,Qa.current=null}function qu(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=Bh(n,t),n!==null){n.flags&=32767,le=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{ie=6,le=null;return}}else if(n=Ah(n,t,Le),n!==null){le=n;return}if(t=t.sibling,t!==null){le=t;return}le=t=e}while(t!==null);ie===0&&(ie=5)}function Xt(e,t,n){var s=V,l=He.transition;try{He.transition=null,V=1,Qh(e,t,n,s)}finally{He.transition=l,V=s}return null}function Qh(e,t,n,s){do In();while(Tt!==null);if($&6)throw Error(T(327));n=e.finishedWork;var l=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(T(177));e.callbackNode=null,e.callbackPriority=0;var o=n.lanes|n.childLanes;if(Cf(e,o),e===pe&&(le=pe=null,me=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||as||(as=!0,Zu(Is,function(){return In(),null})),o=(n.flags&15990)!==0,n.subtreeFlags&15990||o){o=He.transition,He.transition=null;var a=V;V=1;var i=$;$|=4,Qa.current=null,$h(e,n),Uu(n,e),fh(Lo),As=!!Po,Lo=Po=null,e.current=n,Fh(n),vf(),$=i,V=a,He.transition=o}else e.current=n;if(as&&(as=!1,Tt=e,el=l),o=e.pendingLanes,o===0&&(It=null),wf(n.stateNode),Me(e,re()),t!==null)for(s=e.onRecoverableError,n=0;n<t.length;n++)l=t[n],s(l.value,{componentStack:l.stack,digest:l.digest});if(Zs)throw Zs=!1,e=ea,ea=null,e;return el&1&&e.tag!==0&&In(),o=e.pendingLanes,o&1?e===ta?vr++:(vr=0,ta=e):vr=0,Ut(),null}function In(){if(Tt!==null){var e=_d(el),t=He.transition,n=V;try{if(He.transition=null,V=16>e?16:e,Tt===null)var s=!1;else{if(e=Tt,Tt=null,el=0,$&6)throw Error(T(331));var l=$;for($|=4,R=e.current;R!==null;){var o=R,a=o.child;if(R.flags&16){var i=o.deletions;if(i!==null){for(var c=0;c<i.length;c++){var d=i[c];for(R=d;R!==null;){var u=R;switch(u.tag){case 0:case 11:case 15:xr(8,u,o)}var f=u.child;if(f!==null)f.return=u,R=f;else for(;R!==null;){u=R;var m=u.sibling,g=u.return;if($u(u),u===d){R=null;break}if(m!==null){m.return=g,R=m;break}R=g}}}var v=o.alternate;if(v!==null){var p=v.child;if(p!==null){v.child=null;do{var w=p.sibling;p.sibling=null,p=w}while(p!==null)}}R=o}}if(o.subtreeFlags&2064&&a!==null)a.return=o,R=a;else e:for(;R!==null;){if(o=R,o.flags&2048)switch(o.tag){case 0:case 11:case 15:xr(9,o,o.return)}var h=o.sibling;if(h!==null){h.return=o.return,R=h;break e}R=o.return}}var x=e.current;for(R=x;R!==null;){a=R;var j=a.child;if(a.subtreeFlags&2064&&j!==null)j.return=a,R=j;else e:for(a=x;R!==null;){if(i=R,i.flags&2048)try{switch(i.tag){case 0:case 11:case 15:ml(9,i)}}catch(S){te(i,i.return,S)}if(i===a){R=null;break e}var y=i.sibling;if(y!==null){y.return=i.return,R=y;break e}R=i.return}}if($=l,Ut(),it&&typeof it.onPostCommitFiberRoot=="function")try{it.onPostCommitFiberRoot(al,e)}catch{}s=!0}return s}finally{V=n,He.transition=t}}return!1}function wc(e,t,n){t=Fn(n,t),t=_u(e,t,1),e=Dt(e,t,1),t=ke(),e!==null&&(Br(e,1,t),Me(e,t))}function te(e,t,n){if(e.tag===3)wc(e,e,n);else for(;t!==null;){if(t.tag===3){wc(t,e,n);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(It===null||!It.has(s))){e=Fn(n,e),e=Mu(t,e,1),t=Dt(t,e,1),e=ke(),t!==null&&(Br(t,1,e),Me(t,e));break}}t=t.return}}function Yh(e,t,n){var s=e.pingCache;s!==null&&s.delete(t),t=ke(),e.pingedLanes|=e.suspendedLanes&n,pe===e&&(me&n)===n&&(ie===4||ie===3&&(me&130023424)===me&&500>re()-Ga?nn(e,0):Ya|=n),Me(e,t)}function Xu(e,t){t===0&&(e.mode&1?(t=Xr,Xr<<=1,!(Xr&130023424)&&(Xr=4194304)):t=1);var n=ke();e=yt(e,t),e!==null&&(Br(e,t,n),Me(e,n))}function Gh(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Xu(e,n)}function qh(e,t){var n=0;switch(e.tag){case 13:var s=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:s=e.stateNode;break;default:throw Error(T(314))}s!==null&&s.delete(t),Xu(e,n)}var Ju;Ju=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Te.current)Ee=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Ee=!1,Oh(e,t,n);Ee=!!(e.flags&131072)}else Ee=!1,q&&t.flags&1048576&&nu(t,Vs,t.index);switch(t.lanes=0,t.tag){case 2:var s=t.type;Es(e,t),e=t.pendingProps;var l=An(t,we.current);Dn(t,n),l=Fa(null,t,s,e,l,n);var o=Ha();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,_e(s)?(o=!0,Hs(t)):o=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,Oa(t),l.updater=hl,t.stateNode=l,l._reactInternals=t,Ho(t,s,e,n),t=Ko(null,t,s,!0,o,n)):(t.tag=0,q&&o&&_a(t),Se(null,t,l,n),t=t.child),t;case 16:s=t.elementType;e:{switch(Es(e,t),e=t.pendingProps,l=s._init,s=l(s._payload),t.type=s,l=t.tag=Jh(s),e=qe(s,e),l){case 0:t=Vo(null,t,s,e,n);break e;case 1:t=uc(null,t,s,e,n);break e;case 11:t=cc(null,t,s,e,n);break e;case 14:t=dc(null,t,s,qe(s.type,e),n);break e}throw Error(T(306,s,""))}return t;case 0:return s=t.type,l=t.pendingProps,l=t.elementType===s?l:qe(s,l),Vo(e,t,s,l,n);case 1:return s=t.type,l=t.pendingProps,l=t.elementType===s?l:qe(s,l),uc(e,t,s,l,n);case 3:e:{if(Du(t),e===null)throw Error(T(387));s=t.pendingProps,o=t.memoizedState,l=o.element,iu(e,t),Ys(t,s,null,n);var a=t.memoizedState;if(s=a.element,o.isDehydrated)if(o={element:s,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){l=Fn(Error(T(423)),t),t=pc(e,t,s,n,l);break e}else if(s!==l){l=Fn(Error(T(424)),t),t=pc(e,t,s,n,l);break e}else for(De=Lt(t.stateNode.containerInfo.firstChild),Ie=t,q=!0,Je=null,n=ou(t,null,s,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Bn(),s===l){t=jt(e,t,n);break e}Se(e,t,s,n)}t=t.child}return t;case 5:return cu(t),e===null&&Wo(t),s=t.type,l=t.pendingProps,o=e!==null?e.memoizedProps:null,a=l.children,Do(s,l)?a=null:o!==null&&Do(s,o)&&(t.flags|=32),Lu(e,t),Se(e,t,a,n),t.child;case 6:return e===null&&Wo(t),null;case 13:return Iu(e,t,n);case 4:return Aa(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=Wn(t,null,s,n):Se(e,t,s,n),t.child;case 11:return s=t.type,l=t.pendingProps,l=t.elementType===s?l:qe(s,l),cc(e,t,s,l,n);case 7:return Se(e,t,t.pendingProps,n),t.child;case 8:return Se(e,t,t.pendingProps.children,n),t.child;case 12:return Se(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(s=t.type._context,l=t.pendingProps,o=t.memoizedProps,a=l.value,Q(Ks,s._currentValue),s._currentValue=a,o!==null)if(tt(o.value,a)){if(o.children===l.children&&!Te.current){t=jt(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var i=o.dependencies;if(i!==null){a=o.child;for(var c=i.firstContext;c!==null;){if(c.context===s){if(o.tag===1){c=xt(-1,n&-n),c.tag=2;var d=o.updateQueue;if(d!==null){d=d.shared;var u=d.pending;u===null?c.next=c:(c.next=u.next,u.next=c),d.pending=c}}o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),$o(o.return,n,t),i.lanes|=n;break}c=c.next}}else if(o.tag===10)a=o.type===t.type?null:o.child;else if(o.tag===18){if(a=o.return,a===null)throw Error(T(341));a.lanes|=n,i=a.alternate,i!==null&&(i.lanes|=n),$o(a,n,t),a=o.sibling}else a=o.child;if(a!==null)a.return=o;else for(a=o;a!==null;){if(a===t){a=null;break}if(o=a.sibling,o!==null){o.return=a.return,a=o;break}a=a.return}o=a}Se(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,s=t.pendingProps.children,Dn(t,n),l=Ve(l),s=s(l),t.flags|=1,Se(e,t,s,n),t.child;case 14:return s=t.type,l=qe(s,t.pendingProps),l=qe(s.type,l),dc(e,t,s,l,n);case 15:return Ru(e,t,t.type,t.pendingProps,n);case 17:return s=t.type,l=t.pendingProps,l=t.elementType===s?l:qe(s,l),Es(e,t),t.tag=1,_e(s)?(e=!0,Hs(t)):e=!1,Dn(t,n),Tu(t,s,l),Ho(t,s,l,n),Ko(null,t,s,!0,e,n);case 19:return Ou(e,t,n);case 22:return Pu(e,t,n)}throw Error(T(156,t.tag))};function Zu(e,t){return zd(e,t)}function Xh(e,t,n,s){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Fe(e,t,n,s){return new Xh(e,t,n,s)}function Za(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Jh(e){if(typeof e=="function")return Za(e)?1:0;if(e!=null){if(e=e.$$typeof,e===va)return 11;if(e===ya)return 14}return 2}function At(e,t){var n=e.alternate;return n===null?(n=Fe(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Ms(e,t,n,s,l,o){var a=2;if(s=e,typeof e=="function")Za(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case yn:return rn(n.children,l,o,t);case ga:a=8,l|=8;break;case fo:return e=Fe(12,n,t,l|2),e.elementType=fo,e.lanes=o,e;case ho:return e=Fe(13,n,t,l),e.elementType=ho,e.lanes=o,e;case mo:return e=Fe(19,n,t,l),e.elementType=mo,e.lanes=o,e;case cd:return gl(n,l,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ad:a=10;break e;case id:a=9;break e;case va:a=11;break e;case ya:a=14;break e;case kt:a=16,s=null;break e}throw Error(T(130,e==null?e:typeof e,""))}return t=Fe(a,n,t,l),t.elementType=e,t.type=s,t.lanes=o,t}function rn(e,t,n,s){return e=Fe(7,e,s,t),e.lanes=n,e}function gl(e,t,n,s){return e=Fe(22,e,s,t),e.elementType=cd,e.lanes=n,e.stateNode={isHidden:!1},e}function to(e,t,n){return e=Fe(6,e,null,t),e.lanes=n,e}function no(e,t,n){return t=Fe(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Zh(e,t,n,s,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Il(0),this.expirationTimes=Il(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Il(0),this.identifierPrefix=s,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function ei(e,t,n,s,l,o,a,i,c){return e=new Zh(e,t,n,i,c),t===1?(t=1,o===!0&&(t|=8)):t=0,o=Fe(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:s,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Oa(o),e}function em(e,t,n){var s=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:vn,key:s==null?null:""+s,children:e,containerInfo:t,implementation:n}}function ep(e){if(!e)return Wt;e=e._reactInternals;e:{if(un(e)!==e||e.tag!==1)throw Error(T(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(_e(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(T(171))}if(e.tag===1){var n=e.type;if(_e(n))return eu(e,n,t)}return t}function tp(e,t,n,s,l,o,a,i,c){return e=ei(n,s,!0,e,l,o,a,i,c),e.context=ep(null),n=e.current,s=ke(),l=Ot(n),o=xt(s,l),o.callback=t??null,Dt(n,o,l),e.current.lanes=l,Br(e,l,s),Me(e,s),e}function vl(e,t,n,s){var l=t.current,o=ke(),a=Ot(l);return n=ep(n),t.context===null?t.context=n:t.pendingContext=n,t=xt(o,a),t.payload={element:e},s=s===void 0?null:s,s!==null&&(t.callback=s),e=Dt(l,t,a),e!==null&&(et(e,l,a,o),Ns(e,l,a)),a}function nl(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function Sc(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ti(e,t){Sc(e,t),(e=e.alternate)&&Sc(e,t)}function tm(){return null}var np=typeof reportError=="function"?reportError:function(e){console.error(e)};function ni(e){this._internalRoot=e}yl.prototype.render=ni.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(T(409));vl(e,t,null,null)};yl.prototype.unmount=ni.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;cn(function(){vl(null,e,null,null)}),t[vt]=null}};function yl(e){this._internalRoot=e}yl.prototype.unstable_scheduleHydration=function(e){if(e){var t=Pd();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Nt.length&&t!==0&&t<Nt[n].priority;n++);Nt.splice(n,0,e),n===0&&Dd(e)}};function ri(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function jl(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function kc(){}function nm(e,t,n,s,l){if(l){if(typeof s=="function"){var o=s;s=function(){var d=nl(a);o.call(d)}}var a=tp(t,s,e,0,null,!1,!1,"",kc);return e._reactRootContainer=a,e[vt]=a.current,Cr(e.nodeType===8?e.parentNode:e),cn(),a}for(;l=e.lastChild;)e.removeChild(l);if(typeof s=="function"){var i=s;s=function(){var d=nl(c);i.call(d)}}var c=ei(e,0,!1,null,null,!1,!1,"",kc);return e._reactRootContainer=c,e[vt]=c.current,Cr(e.nodeType===8?e.parentNode:e),cn(function(){vl(t,c,n,s)}),c}function wl(e,t,n,s,l){var o=n._reactRootContainer;if(o){var a=o;if(typeof l=="function"){var i=l;l=function(){var c=nl(a);i.call(c)}}vl(t,a,e,l)}else a=nm(n,t,e,l,s);return nl(a)}Md=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=ar(t.pendingLanes);n!==0&&(Sa(t,n|1),Me(t,re()),!($&6)&&(Hn=re()+500,Ut()))}break;case 13:cn(function(){var s=yt(e,1);if(s!==null){var l=ke();et(s,e,1,l)}}),ti(e,1)}};ka=function(e){if(e.tag===13){var t=yt(e,134217728);if(t!==null){var n=ke();et(t,e,134217728,n)}ti(e,134217728)}};Rd=function(e){if(e.tag===13){var t=Ot(e),n=yt(e,t);if(n!==null){var s=ke();et(n,e,t,s)}ti(e,t)}};Pd=function(){return V};Ld=function(e,t){var n=V;try{return V=e,t()}finally{V=n}};No=function(e,t,n){switch(t){case"input":if(vo(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var s=n[t];if(s!==e&&s.form===e.form){var l=ul(s);if(!l)throw Error(T(90));ud(s),vo(s,l)}}}break;case"textarea":fd(e,n);break;case"select":t=n.value,t!=null&&Mn(e,!!n.multiple,t,!1)}};jd=qa;wd=cn;var rm={usingClientEntryPoint:!1,Events:[$r,kn,ul,vd,yd,qa]},nr={findFiberByHostInstance:Zt,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},sm={bundleType:nr.bundleType,version:nr.version,rendererPackageName:nr.rendererPackageName,rendererConfig:nr.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:wt.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=bd(e),e===null?null:e.stateNode},findFiberByHostInstance:nr.findFiberByHostInstance||tm,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var is=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!is.isDisabled&&is.supportsFiber)try{al=is.inject(sm),it=is}catch{}}Ae.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=rm;Ae.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!ri(t))throw Error(T(200));return em(e,t,null,n)};Ae.createRoot=function(e,t){if(!ri(e))throw Error(T(299));var n=!1,s="",l=np;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onRecoverableError!==void 0&&(l=t.onRecoverableError)),t=ei(e,1,!1,null,null,n,!1,s,l),e[vt]=t.current,Cr(e.nodeType===8?e.parentNode:e),new ni(t)};Ae.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(T(188)):(e=Object.keys(e).join(","),Error(T(268,e)));return e=bd(t),e=e===null?null:e.stateNode,e};Ae.flushSync=function(e){return cn(e)};Ae.hydrate=function(e,t,n){if(!jl(t))throw Error(T(200));return wl(null,e,t,!0,n)};Ae.hydrateRoot=function(e,t,n){if(!ri(e))throw Error(T(405));var s=n!=null&&n.hydratedSources||null,l=!1,o="",a=np;if(n!=null&&(n.unstable_strictMode===!0&&(l=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(a=n.onRecoverableError)),t=tp(t,null,e,1,n??null,l,!1,o,a),e[vt]=t.current,Cr(e),s)for(e=0;e<s.length;e++)n=s[e],l=n._getVersion,l=l(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,l]:t.mutableSourceEagerHydrationData.push(n,l);return new yl(t)};Ae.render=function(e,t,n){if(!jl(t))throw Error(T(200));return wl(null,e,t,!1,n)};Ae.unmountComponentAtNode=function(e){if(!jl(e))throw Error(T(40));return e._reactRootContainer?(cn(function(){wl(null,null,e,!1,function(){e._reactRootContainer=null,e[vt]=null})}),!0):!1};Ae.unstable_batchedUpdates=qa;Ae.unstable_renderSubtreeIntoContainer=function(e,t,n,s){if(!jl(n))throw Error(T(200));if(e==null||e._reactInternals===void 0)throw Error(T(38));return wl(e,t,n,!1,s)};Ae.version="18.3.1-next-f1338f8080-20240426";function rp(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(rp)}catch(e){console.error(e)}}rp(),rd.exports=Ae;var lm=rd.exports,bc=lm;uo.createRoot=bc.createRoot,uo.hydrateRoot=bc.hydrateRoot;class sp extends Error{constructor(t,n,s){super(s),this.status=t,this.code=n}}function Vt(e){return e instanceof sp&&e.status===409&&e.code==="no_project"}async function Sl(e,t){const n=await fetch(e,t);if(!n.ok){let s=null,l=`${n.status} ${n.statusText}`;try{const o=await n.json();o.code&&(s=o.code),o.error&&(l=o.error)}catch{}throw new sp(n.status,s,l)}return n.json()}const F=e=>Sl(e),hn=(e,t)=>Sl(e,t===void 0?{method:"POST"}:{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),Nc=(e,t)=>Sl(e,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),om=(e,t)=>Sl(e,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});function ee(e,t){return t?e+(e.includes("?")?"&":"?")+"project="+encodeURIComponent(t):e}const P={status:e=>F(ee("/api/status",e)),refresh:e=>hn(ee("/api/refresh",e)),graphFull:(e,t=250)=>F(ee(`/api/graph/full?limit=${t}`,e)),graphNode:(e,t)=>F(ee(`/api/graph/node?id=${encodeURIComponent(e)}`,t)),graphHealth:e=>F(ee("/api/graph/health",e)),specs:e=>F(ee("/api/specs",e)),spec:(e,t)=>F(ee(`/api/spec/${encodeURIComponent(e)}`,t)),specSave:(e,t,n)=>Nc(ee(`/api/spec/${encodeURIComponent(e)}`,n),{content:t}),drift:e=>F(ee("/api/drift",e)),runs:e=>F(ee("/api/workflows/runs",e)),workflows:e=>F(ee("/api/workflows",e)),launchRun:(e,t,n)=>hn(ee("/api/workflows/runs",n),{workflowName:e,inputs:t}),run:(e,t)=>F(ee(`/api/workflows/runs/${encodeURIComponent(e)}`,t)),runArtifacts:(e,t)=>F(ee(`/api/workflows/runs/${encodeURIComponent(e)}/artifacts`,t)),runAction:(e,t,n,s)=>hn(ee(`/api/workflows/runs/${encodeURIComponent(e)}/${t}`,s),n),projects:()=>F("/api/projects"),graphSearch:(e,t,n=10)=>F(ee(`/api/graph/search?q=${encodeURIComponent(e)}&limit=${n}`,t)),recentPrompts:(e,t=20)=>F(ee(`/api/claude/prompts/recent?limit=${t}`,e)),claudeStats:(e="week")=>F(`/api/claude/stats?range=${e}`),claudeCosts:(e="week",t,n)=>F(ee(`/api/claude/costs?range=${e}${n?`&model=${encodeURIComponent(n)}`:""}`,t)),claudeCache:(e="week")=>F(`/api/claude/cache?range=${e}`),claudeHeatmap:(e="week",t)=>F(ee(`/api/claude/heatmap?range=${e}`,t)),claudeHeatmapFile:(e,t="week")=>F(`/api/claude/heatmap/file?path=${encodeURIComponent(e)}&range=${t}`),claudeHeatmapTool:(e,t="week")=>F(`/api/claude/heatmap/tool?name=${encodeURIComponent(e)}&range=${t}`),claudeHeatmapSubagent:(e,t="week")=>F(`/api/claude/heatmap/subagent?type=${encodeURIComponent(e)}&range=${t}`),claudeTips:()=>F("/api/claude/tips"),setTipState:(e,t)=>hn("/api/claude/tips/state",{id:e,state:t}),claudeSessions:(e,t=10,n="week",s)=>F(ee(`/api/claude/sessions?limit=${t}&range=${n}${s?`&model=${encodeURIComponent(s)}`:""}`,e)),claudeSession:e=>F(`/api/claude/session/${encodeURIComponent(e)}`),claudeSessionSummary:e=>F(`/api/claude/session/${encodeURIComponent(e)}/summary`),claudeProjects:()=>F("/api/claude/projects"),claudeCompare:()=>F("/api/claude/compare"),specshipImpact:(e="week")=>F(`/api/claude/specship-impact?range=${e}`),ingestNow:()=>hn("/api/claude/ingest"),memory:e=>F(ee("/api/memory",e)),mcpServers:()=>F("/api/mcp/servers"),setMcpServerEnabled:(e,t)=>om(`/api/mcp/servers/${encodeURIComponent(e)}`,{enabled:t}),addMcpServer:e=>hn("/api/mcp/servers",e),config:{get:()=>F("/api/config"),set:e=>Nc("/api/config",e)}};function am(e,t,n){const s=`/api/workflows/runs/${encodeURIComponent(e)}/events${t?`?since=${t}`:""}`;return ee(s,n)}const sa="ss-navigate";function zc(){const e=location.pathname.split("/").filter(Boolean);return{route:e[0]||"dashboard",param:e.slice(1).join("/")||void 0,query:Object.fromEntries(new URLSearchParams(location.search))}}function A(e,t={}){let n="/"+e;t.param&&(n+="/"+t.param),t.query&&Object.keys(t.query).length&&(n+="?"+new URLSearchParams(t.query).toString()),n!==location.pathname+location.search&&history.pushState(null,"",n),window.dispatchEvent(new Event(sa))}function im(){const[e,t]=z.useState(zc);return z.useEffect(()=>{const n=()=>t(zc());return window.addEventListener("popstate",n),window.addEventListener(sa,n),()=>{window.removeEventListener("popstate",n),window.removeEventListener(sa,n)}},[]),e}const cm={dashboard:'<rect x="3" y="3" width="7" height="9"/><rect x="14" y="3" width="7" height="5"/><rect x="14" y="12" width="7" height="9"/><rect x="3" y="16" width="7" height="5"/>',graph:'<circle cx="5" cy="6" r="2.5"/><circle cx="19" cy="6" r="2.5"/><circle cx="12" cy="18" r="2.5"/><path d="M7 7.5 10.5 16M16.5 7.5 13.5 16M7 6h10"/>',book:'<path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20"/><path d="M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"/>',drift:'<path d="M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h16.9a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z"/><path d="M12 9v4M12 17h.01"/>',workflow:'<rect x="3" y="3" width="6" height="6" rx="1"/><rect x="15" y="15" width="6" height="6" rx="1"/><path d="M6 9v3a3 3 0 0 0 3 3h6"/>',play:'<polygon points="6 3 20 12 6 21 6 3"/>',wrench:'<path d="M14.7 6.3a4 4 0 0 0-5.4 5.3L3 18v3h3l6.4-6.3a4 4 0 0 0 5.3-5.4l-2.9 2.9-2.1-2.1z"/>',database:'<ellipse cx="12" cy="5" rx="8" ry="3"/><path d="M4 5v6c0 1.7 3.6 3 8 3s8-1.3 8-3V5"/><path d="M4 11v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6"/>',bot:'<rect x="4" y="8" width="16" height="12" rx="2"/><path d="M12 4v4M9 14h.01M15 14h.01M2 13h2M20 13h2"/>',folder:'<path d="M20 10V7a2 2 0 0 0-2-2h-6l-2-2H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2h7"/><path d="M12 10v11M16 14l-4-4-4 4M21 19h-6"/>',chat:'<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/>',sessions:'<path d="M3 3v18h18"/><path d="M7 14l3-4 3 3 4-6"/>',heatmap:'<rect x="3" y="3" width="7" height="7" rx="1"/><rect x="14" y="3" width="7" height="7" rx="1"/><rect x="3" y="14" width="7" height="7" rx="1"/><rect x="14" y="14" width="7" height="7" rx="1"/>',dollar:'<line x1="12" y1="1" x2="12" y2="23"/><path d="M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"/>',compare:'<path d="M16 3h5v5M21 3l-7 7M8 21H3v-5M3 21l7-7"/>',tips:'<path d="M9 18h6M10 22h4M12 2a7 7 0 0 0-4 12.7c.6.5 1 1.3 1 2.1V18h6v-1.2c0-.8.4-1.6 1-2.1A7 7 0 0 0 12 2z"/>',settings:'<circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.6 1.6 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.6 1.6 0 0 0-1.8-.3 1.6 1.6 0 0 0-1 1.5V21a2 2 0 0 1-4 0v-.1a1.6 1.6 0 0 0-1-1.5 1.6 1.6 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.6 1.6 0 0 0 .3-1.8 1.6 1.6 0 0 0-1.5-1H3a2 2 0 0 1 0-4h.1a1.6 1.6 0 0 0 1.5-1 1.6 1.6 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.6 1.6 0 0 0 1.8.3H9a1.6 1.6 0 0 0 1-1.5V3a2 2 0 0 1 4 0v.1a1.6 1.6 0 0 0 1 1.5 1.6 1.6 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.6 1.6 0 0 0-.3 1.8V9a1.6 1.6 0 0 0 1.5 1H21a2 2 0 0 1 0 4h-.1a1.6 1.6 0 0 0-1.5 1z"/>',box:'<path d="M21 16V8a2 2 0 0 0-1-1.7l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.7l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"/><path d="m3.3 7 8.7 5 8.7-5M12 22V12"/>',search:'<circle cx="11" cy="11" r="7"/><line x1="21" y1="21" x2="16.7" y2="16.7"/>',command:'<path d="M15 6a3 3 0 1 1 3 3h-3V6zM9 6a3 3 0 1 0-3 3h3V6zM15 18a3 3 0 1 0 3-3h-3v3zM9 18a3 3 0 1 1-3-3h3v3zM9 9h6v6H9z"/>',chevronRight:'<polyline points="9 6 15 12 9 18"/>',chevronDown:'<polyline points="6 9 12 15 18 9"/>',chevronLeft:'<polyline points="15 6 9 12 15 18"/>',x:'<line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/>',check:'<polyline points="20 6 9 17 4 12"/>',copy:'<rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/>',arrowRight:'<line x1="5" y1="12" x2="19" y2="12"/><polyline points="12 5 19 12 12 19"/>',plus:'<line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/>',grip:'<circle cx="9" cy="6" r="1.4"/><circle cx="15" cy="6" r="1.4"/><circle cx="9" cy="12" r="1.4"/><circle cx="15" cy="12" r="1.4"/><circle cx="9" cy="18" r="1.4"/><circle cx="15" cy="18" r="1.4"/>',trash:'<polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/><line x1="10" y1="11" x2="10" y2="17"/><line x1="14" y1="11" x2="14" y2="17"/>',minus:'<line x1="5" y1="12" x2="19" y2="12"/>',maximize:'<path d="M8 3H5a2 2 0 0 0-2 2v3M21 8V5a2 2 0 0 0-2-2h-3M16 21h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"/>',recenter:'<circle cx="12" cy="12" r="3"/><path d="M12 2v4M12 18v4M2 12h4M18 12h4"/>',refresh:'<path d="M21 2v6h-6M3 22v-6h6"/><path d="M3.5 9a9 9 0 0 1 14.8-3.4L21 8M21 15a9 9 0 0 1-14.8 3.4L3 16"/>',filter:'<polygon points="22 3 2 3 10 12.5 10 19 14 21 14 12.5 22 3"/>',pause:'<rect x="6" y="4" width="4" height="16"/><rect x="14" y="4" width="4" height="16"/>',external:'<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/>',zap:'<polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/>',clock:'<circle cx="12" cy="12" r="9"/><polyline points="12 7 12 12 15 14"/>',trendUp:'<polyline points="22 7 13.5 15.5 8.5 10.5 2 17"/><polyline points="16 7 22 7 22 13"/>',trendDown:'<polyline points="22 17 13.5 8.5 8.5 13.5 2 7"/><polyline points="16 17 22 17 22 11"/>',circle:'<circle cx="12" cy="12" r="9"/>',dot:'<circle cx="12" cy="12" r="5"/>',reveal:'<path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7z"/><circle cx="12" cy="12" r="3"/>',sparkles:'<path d="M12 3v4M12 17v4M3 12h4M17 12h4"/><path d="m6 6 2.5 2.5M15.5 15.5 18 18M18 6l-2.5 2.5M8.5 15.5 6 18"/>',menu:'<line x1="4" y1="6" x2="20" y2="6"/><line x1="4" y1="12" x2="20" y2="12"/><line x1="4" y1="18" x2="20" y2="18"/>',send:'<line x1="22" y1="2" x2="11" y2="13"/><polygon points="22 2 15 22 11 13 2 9 22 2"/>',paperclip:'<path d="M21.4 11.05 12.25 20.2a5 5 0 0 1-7.07-7.07l9.19-9.19a3 3 0 0 1 4.24 4.24l-9.2 9.19a1 1 0 0 1-1.41-1.41l8.48-8.49"/>',sortAsc:'<path d="M11 5h10M11 9h7M11 13h4M3 17l3 3 3-3M6 6v14"/>',flame:'<path d="M12 2c1 4 5 5 5 9a5 5 0 0 1-10 0c0-1.5.5-2.5 1.2-3.4C9 9 9.5 8 9.5 6.5c1 .5 2 1.5 2.5 2.5C13 7 12.5 4 12 2z"/>',coins:'<circle cx="8" cy="8" r="5"/><path d="M18.1 6.3a5 5 0 0 1 0 9.4M14.4 18.6a5 5 0 0 1-3.4 0"/>',cancel:'<circle cx="12" cy="12" r="9"/><line x1="9" y1="9" x2="15" y2="15"/><line x1="15" y1="9" x2="9" y2="15"/>',skip:'<polyline points="13 17 18 12 13 7"/><polyline points="6 17 11 12 6 7"/>',layers:'<polygon points="12 2 2 7 12 12 22 7 12 2"/><polyline points="2 12 12 17 22 12"/><polyline points="2 17 12 22 22 17"/>',sun:'<circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"/>',moon:'<path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z"/>',monitor:'<rect x="2" y="3" width="20" height="14" rx="2"/><line x1="8" y1="21" x2="16" y2="21"/><line x1="12" y1="17" x2="12" y2="21"/>',memory:'<rect x="4" y="6" width="16" height="12" rx="2"/><path d="M8 6V3M12 6V3M16 6V3M8 21v-3M12 21v-3M16 21v-3M2 10h2M2 14h2M20 10h2M20 14h2"/><rect x="8.5" y="10" width="7" height="4" rx="1"/>',lock:'<rect x="4" y="11" width="16" height="10" rx="2"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/>',plug:'<path d="M12 22v-5"/><path d="M9 8V2"/><path d="M15 8V2"/><path d="M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8z"/>',server:'<rect x="3" y="4" width="18" height="6" rx="2"/><rect x="3" y="14" width="18" height="6" rx="2"/><path d="M7 7h.01M7 17h.01"/>'};function N({name:e,size:t=16,stroke:n=2,fill:s="none",style:l,className:o}){return r.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:s,stroke:"currentColor",strokeWidth:n,strokeLinecap:"round",strokeLinejoin:"round",style:l,className:o,dangerouslySetInnerHTML:{__html:cm[e]||""}})}function dm({size:e=24,tile:t=!0,glow:n=!0}){return r.jsxs("svg",{width:e,height:e,viewBox:"0 0 32 32",fill:"none",style:{filter:n?"drop-shadow(0 0 9px rgba(91,147,242,0.35))":"none",flexShrink:0},children:[r.jsxs("defs",{children:[r.jsxs("linearGradient",{id:"ssTile",x1:0,y1:0,x2:32,y2:32,gradientUnits:"userSpaceOnUse",children:[r.jsx("stop",{stopColor:"#12161E"}),r.jsx("stop",{offset:1,stopColor:"#0B0D11"})]}),r.jsxs("linearGradient",{id:"ssLead",x1:18,y1:11,x2:26,y2:21,gradientUnits:"userSpaceOnUse",children:[r.jsx("stop",{stopColor:"#6FA0F6"}),r.jsx("stop",{offset:1,stopColor:"#5B93F2"})]})]}),t&&r.jsx("rect",{width:32,height:32,rx:7.2,fill:"url(#ssTile)"}),t&&r.jsx("rect",{x:.5,y:.5,width:31,height:31,rx:6.7,fill:"none",stroke:"rgba(255,255,255,0.08)"}),r.jsxs("g",{transform:"translate(4.6 4.6) scale(0.715)",children:[r.jsx("path",{d:"M5 16 H11 M11 9 L23 16 L11 23",stroke:"rgba(150,165,200,0.5)",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),r.jsx("line",{x1:11,y1:9,x2:11,y2:23,stroke:"rgba(150,165,200,0.4)",strokeWidth:1.9,strokeLinecap:"round"}),r.jsx("circle",{cx:23,cy:16,r:3.6,fill:"url(#ssLead)"}),r.jsx("circle",{cx:11,cy:9,r:2.9,fill:"#A586F5"}),r.jsx("circle",{cx:11,cy:23,r:2.9,fill:"#46C26B"}),r.jsx("circle",{cx:5,cy:16,r:2.1,fill:"#29D2BE"})]})]})}const um=8,pm=6,fm=6,hm=150,mm={page:"Page",node:"Node",spec:"Spec",prompt:"Prompt"},xm={fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-muted)",background:"var(--bg-canvas)",border:"1px solid var(--border-subtle)",borderRadius:4,padding:"2px 6px"};function gm({open:e,onClose:t,pages:n,project:s=null}){const[l,o]=z.useState(""),[a,i]=z.useState(0),[c,d]=z.useState([]),[u,f]=z.useState([]),[m,g]=z.useState([]),v=z.useRef(null),p=z.useRef(0);z.useEffect(()=>{e&&(o(""),i(0),g([]),setTimeout(()=>v.current?.focus(),30))},[e]),z.useEffect(()=>{e&&(P.specs(s).then(S=>d(S.specs??[]),()=>d([])),P.recentPrompts(s).then(S=>f(S.prompts??[]),()=>f([])))},[e,s]),z.useEffect(()=>{if(!e)return;const S=l.trim(),b=++p.current;if(S.length<2){g([]);return}const C=setTimeout(()=>{P.graphSearch(S,s,um).then(_=>{p.current===b&&g((_.results??[]).map(({node:W})=>({key:"node:"+W.id,label:W.name,sublabel:W.filePath,icon:"graph",type:"node",nav:()=>A("graph",{query:{focus:W.id}})})))},()=>{p.current===b&&g([])})},hm);return()=>clearTimeout(C)},[l,e,s]);const w=l.trim().toLowerCase(),h=(w?n.filter(S=>(S.label+" "+S.id).toLowerCase().includes(w)):n).map(S=>({key:"page:"+S.id,label:S.label,sublabel:"/"+S.id,icon:S.icon,type:"page",nav:()=>A(S.id)})),x=w?c.filter(S=>(S.id+" "+S.title).toLowerCase().includes(w)).slice(0,pm).map(S=>({key:"spec:"+S.id,label:S.id,sublabel:S.title,icon:"book",type:"spec",nav:()=>A("specs",{param:S.id})})):[],j=w?u.filter(S=>S.text.toLowerCase().includes(w)).slice(0,fm).map(S=>({key:"prompt:"+S.id,label:S.text,sublabel:new Date(S.ts).toLocaleString(),icon:"chat",type:"prompt",nav:()=>A("sessions",{param:S.session_id})})):[],y=[...h,...w?m:[],...x,...j];return z.useEffect(()=>{if(!e)return;const S=b=>{if(b.key==="ArrowDown")b.preventDefault(),i(C=>Math.min(y.length-1,C+1));else if(b.key==="ArrowUp")b.preventDefault(),i(C=>Math.max(0,C-1));else if(b.key==="Enter"){b.preventDefault();const C=y[a];C&&(C.nav(),t())}else b.key==="Escape"&&(b.preventDefault(),t())};return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[e,y,a,t]),e?r.jsx("div",{onMouseDown:t,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",backdropFilter:"blur(2px)",zIndex:100,display:"grid",placeItems:"start center",paddingTop:"12vh",animation:"fadeIn 100ms"},children:r.jsxs("div",{onMouseDown:S=>S.stopPropagation(),style:{width:560,maxWidth:"90vw",background:"var(--bg-elevated)",border:"1px solid var(--border-strong)",borderRadius:12,boxShadow:"var(--shadow-pop)",overflow:"hidden"},children:[r.jsxs("div",{className:"row gap-10",style:{padding:"12px 14px",borderBottom:"1px solid var(--border-subtle)"},children:[r.jsx(N,{name:"search",size:16,style:{color:"var(--text-muted)"}}),r.jsx("input",{ref:v,value:l,onChange:S=>{o(S.target.value),i(0)},placeholder:"Search pages, nodes, specs, prompts…",style:{flex:1,background:"transparent",border:"none",outline:"none",color:"var(--text-primary)",fontSize:15,fontFamily:"var(--font-ui)"}}),r.jsx("kbd",{style:xm,children:"esc"})]}),r.jsxs("div",{className:"scroll-y",role:"listbox",style:{maxHeight:380,padding:6},children:[y.length===0&&r.jsx("div",{className:"muted",style:{padding:24,textAlign:"center"},children:"No matches"}),y.map((S,b)=>r.jsxs("div",{role:"option","aria-selected":b===a,onMouseEnter:()=>i(b),onClick:()=>{S.nav(),t()},className:"row gap-10 list-row",style:{padding:"8px 10px",borderRadius:7,cursor:"pointer"},children:[r.jsx(N,{name:S.icon,size:15,style:{color:b===a?"var(--accent)":"var(--text-muted)",flexShrink:0}}),r.jsxs("div",{className:"grow",style:{minWidth:0},children:[r.jsx("div",{style:{fontSize:13,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:S.label}),r.jsx("div",{className:"mono muted",style:{fontSize:10.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:S.sublabel})]}),r.jsx("span",{className:"pill",style:{fontSize:9.5,color:"var(--text-muted)",background:"rgba(255,255,255,0.05)",flexShrink:0},children:mm[S.type]})]},S.key))]})]})}):null}const ro=new Map,vm=3e4;function D(e,t=[],n={}){const{cacheKey:s,ttlMs:l=vm}=n,o=s?ro.get(s):void 0,[a,i]=z.useState(o?o.data:null),[c,d]=z.useState(null),[u,f]=z.useState(!o),m=z.useRef(0),g=z.useCallback(v=>{const p=++m.current;if(s){const w=ro.get(s);if(w){if(i(w.data),d(null),f(!1),!v&&Date.now()-w.ts<l)return}else f(!0)}else f(!0);e().then(w=>{s&&ro.set(s,{data:w,ts:Date.now()}),m.current===p&&(i(w),d(null),f(!1))},w=>{m.current===p&&(d(w),f(!1))})},t);return z.useEffect(()=>{g(!1)},[g]),{data:a,error:c,loading:u,reload:()=>g(!0)}}function ym(){const e=D(()=>P.config.get(),[]),{reload:t}=e;return z.useEffect(()=>(window.addEventListener("specship-config",t),()=>window.removeEventListener("specship-config",t)),[t]),e}function Cc(e){if(!(e instanceof HTMLElement))return!1;const t=e.tagName;if(t==="INPUT"||t==="TEXTAREA"||t==="SELECT"||e.isContentEditable)return!0;const n=e.getAttribute("contenteditable");return n===""||n==="true"}const jm=1e3,wm={g:"graph",s:"specs",d:"drift"};function Sm({onTogglePalette:e,pageIds:t}){const n=z.useRef(!1),s=z.useRef(null);z.useEffect(()=>{const l=()=>{n.current=!1,s.current!==null&&(clearTimeout(s.current),s.current=null)},o=a=>{if((a.metaKey||a.ctrlKey)&&a.key.toLowerCase()==="k"){a.preventDefault(),e();return}if((a.metaKey||a.ctrlKey)&&!a.altKey&&/^[1-7]$/.test(a.key)){if(Cc(a.target))return;const i=t[parseInt(a.key,10)-1];i&&(a.preventDefault(),A(i));return}if(a.metaKey||a.ctrlKey||a.altKey){l();return}if(Cc(a.target)){l();return}if(n.current){l();const i=wm[a.key.toLowerCase()];i&&(a.preventDefault(),A(i));return}a.key==="g"&&(n.current=!0,s.current=window.setTimeout(l,jm))};return window.addEventListener("keydown",o),()=>{window.removeEventListener("keydown",o),l()}},[e,t])}const lp="specship-theme";function kl(){try{const e=localStorage.getItem(lp);if(e==="dark"||e==="light"||e==="system")return e}catch{}return"dark"}function km(e){return e==="system"?window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark":e}function bl(e){document.documentElement.setAttribute("data-theme",km(e));try{localStorage.setItem(lp,e)}catch{}window.dispatchEvent(new Event("specship-theme"))}function bm(){window.matchMedia("(prefers-color-scheme: light)").addEventListener("change",()=>{kl()==="system"&&bl("system")})}const ue={pending:{label:"Pending",color:"var(--text-muted)",bg:"rgba(255,255,255,0.05)"},running:{label:"Running",color:"var(--info)",bg:"var(--info-soft)"},paused:{label:"Paused",color:"var(--warn)",bg:"var(--warn-soft)"},completed:{label:"Completed",color:"var(--success)",bg:"var(--success-soft)"},failed:{label:"Failed",color:"var(--error)",bg:"var(--error-soft)"},cancelled:{label:"Cancelled",color:"var(--text-muted)",bg:"rgba(255,255,255,0.05)"},rejected:{label:"Rejected",color:"var(--warn)",bg:"var(--warn-soft)"},skipped:{label:"Skipped",color:"var(--text-muted)",bg:"rgba(255,255,255,0.05)"},drafted:{label:"Drafted",color:"var(--text-secondary)",bg:"rgba(255,255,255,0.05)"},implementing:{label:"Implementing",color:"var(--info)",bg:"var(--info-soft)"},implemented:{label:"Implemented",color:"var(--node-spec)",bg:"var(--node-spec-soft)"},verified:{label:"Verified",color:"var(--success)",bg:"var(--success-soft)"},drifted:{label:"Drifted",color:"var(--warn)",bg:"var(--warn-soft)"},broken:{label:"Broken",color:"var(--error)",bg:"var(--error-soft)"},orphaned:{label:"Orphaned",color:"var(--error)",bg:"var(--error-soft)"},success:{label:"Success",color:"var(--success)",bg:"var(--success-soft)"},warn:{label:"Warn",color:"var(--warn)",bg:"var(--warn-soft)"},error:{label:"Error",color:"var(--error)",bg:"var(--error-soft)"},info:{label:"Info",color:"var(--info)",bg:"var(--info-soft)"}},Nm={drifted:"drift",broken:"cancel",orphaned:"drift",failed:"cancel",verified:"check",completed:"check",paused:"pause",running:"circle"};function Ue({state:e,pulse:t,withDot:n}){const s=ue[e]??ue.info,l=Nm[e];return r.jsxs("span",{className:"pill",style:{color:s.color,background:s.bg,animation:t?"pulsePill 600ms ease-out":void 0},children:[n&&r.jsx("span",{className:"pill-dot",style:{background:s.color}}),l&&!n&&r.jsx(N,{name:l,size:11}),s.label]})}function ne({children:e,color:t,bg:n,dot:s}){return r.jsxs("span",{className:"pill",style:{color:t||"var(--text-secondary)",background:n||"rgba(255,255,255,0.05)"},children:[s&&r.jsx("span",{className:"pill-dot",style:{background:t}}),e]})}function zm({title:e}){return r.jsx("span",{className:"pill","data-sample-badge":!0,title:e??"Illustrative reference data — not from your project",style:{color:"var(--warn)",background:"var(--warn-soft)",fontWeight:700,letterSpacing:"0.04em"},children:"SAMPLE"})}function dt({text:e,label:t,ariaLabel:n}){const[s,l]=z.useState(!1);return r.jsxs("button",{className:"btn btn-ghost btn-xs",title:"Copy","aria-label":n??(t?void 0:"Copy "+e),onClick:o=>{o.stopPropagation(),navigator.clipboard?.writeText(e),l(!0),setTimeout(()=>l(!1),1100)},style:{color:s?"var(--success)":void 0},children:[r.jsx(N,{name:s?"check":"copy",size:12}),t||""]})}function si({value:e,suffix:t,invert:n}){const s=e>=0,l=n?!s:s;return r.jsxs("span",{className:"row gap-2 tabular",style:{color:l?"var(--success)":"var(--error)",fontSize:"var(--fs-xs)",fontWeight:600},children:[r.jsx(N,{name:s?"trendUp":"trendDown",size:12}),(s?"+":"")+(Math.abs(e)<1&&e!==0?Math.round(e*100)+"%":e)+(t||"")]})}function Pe({icon:e,title:t,sub:n,actions:s}){return r.jsxs("div",{className:"row",style:{gap:12,marginBottom:18,alignItems:"flex-start"},children:[e&&r.jsx("div",{style:{width:34,height:34,borderRadius:9,background:"var(--bg-panel)",border:"1px solid var(--border-subtle)",display:"grid",placeItems:"center",color:"var(--accent)",flexShrink:0},children:r.jsx(N,{name:e,size:18})}),r.jsxs("div",{className:"grow",style:{minWidth:0},children:[r.jsx("div",{style:{fontSize:"var(--fs-title)",fontWeight:600,letterSpacing:"-0.01em"},children:t}),n&&r.jsx("div",{className:"secondary",style:{marginTop:2},children:n})]}),s&&r.jsx("div",{className:"row gap-8",children:s})]})}function ce({icon:e,title:t,body:n,action:s}){return r.jsx("div",{style:{display:"grid",placeItems:"center",height:"100%",minHeight:280,textAlign:"center",padding:40},children:r.jsxs("div",{style:{maxWidth:360},children:[r.jsx("div",{style:{width:52,height:52,borderRadius:14,background:"var(--bg-panel)",border:"1px solid var(--border-subtle)",display:"grid",placeItems:"center",color:"var(--text-muted)",margin:"0 auto 16px"},children:r.jsx(N,{name:e||"box",size:24})}),r.jsx("div",{style:{fontSize:15,fontWeight:600,marginBottom:6},children:t}),n&&r.jsx("div",{className:"secondary",style:{lineHeight:1.55},children:n}),s&&r.jsx("div",{style:{marginTop:16},children:s})]})})}function Re({options:e,value:t,onChange:n,size:s,label:l,disabled:o}){const a=e.map(d=>typeof d=="string"?d:d.value),i=a.indexOf(t),c=(d,u)=>{const f=d.key==="ArrowRight"||d.key==="ArrowDown"?1:d.key==="ArrowLeft"||d.key==="ArrowUp"?-1:0;if(!f)return;d.preventDefault();const m=(u+f+a.length)%a.length;n(a[m]),d.currentTarget.parentElement?.children[m]?.focus()};return r.jsx("div",{className:"seg",role:"radiogroup","aria-label":l,children:e.map((d,u)=>{const f=typeof d=="string"?d:d.value,m=typeof d=="string"?d:d.label,g=f===t;return r.jsx("button",{role:"radio","aria-checked":g,tabIndex:g||i===-1&&u===0?0:-1,disabled:o,className:"seg-btn"+(s==="sm"?" sm":"")+(g?" active":""),onClick:()=>n(f),onKeyDown:v=>c(v,u),children:m},f)})})}function Nl({value:e,onChange:t}){return r.jsx(Re,{options:[{value:"today",label:"Today"},{value:"week",label:"This week"},{value:"month",label:"This month"},{value:"all",label:"All time"}],value:e,onChange:t,size:"sm",label:"Time range"})}function Hr({frac:e,color:t,height:n}){return r.jsx("div",{style:{height:n||4,background:"rgba(255,255,255,0.06)",borderRadius:999,overflow:"hidden",width:"100%"},children:r.jsx("div",{style:{width:Math.max(2,e*100)+"%",height:"100%",background:t||"var(--accent)",borderRadius:999}})})}function Ir(e){if(!e)return null;const t=Math.max(0,Math.floor((Date.now()-e)/1e3));return t<60?"now":t<3600?Math.floor(t/60)+"m":t<86400?Math.floor(t/3600)+"h":Math.floor(t/86400)+"d"}function $t(e,t){return e==="spec"?t==="drifted"?"var(--warn)":t==="broken"||t==="orphaned"?"var(--error)":"var(--node-spec)":e==="test"?"var(--node-test)":e==="route"?"var(--node-route)":"var(--node-code)"}function Un({onIngested:e}){const[t,n]=z.useState(!1),s=()=>{n(!0),P.ingestNow().catch(()=>{}).finally(()=>{n(!1),e?.()})};return r.jsx(ce,{icon:"database",title:"No Claude Code data ingested yet",body:"This screen lights up once SpecShip ingests your transcripts from ~/.claude/projects. Turn on transcript ingest in Settings, or run a one-shot pass now.",action:r.jsx("button",{className:"btn btn-secondary btn-sm",onClick:s,disabled:t,children:t?"Ingesting…":"Run ingest now"})})}function Ur(e){return e>=.7?"var(--success)":e>=.5?"var(--warn)":"var(--error)"}function op(e){const t=(e.total_input_tokens??0)+(e.total_cache_creation_tokens??0)+(e.total_cache_read_tokens??0);return t>0?(e.total_cache_read_tokens??0)/t:0}function zl(e){return e.replace(/^claude-/,"")}const Ec=["var(--node-spec)","var(--node-code)","var(--node-route)","var(--node-test)","var(--accent)","var(--warn)"];function la(e){return Ec[e%Ec.length]}function li(e){return e?new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):"—"}function ap(e){return e?new Date(e).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"—"}function Cm(e){const t=Math.round(e/1e3);if(t<60)return t+"s";const n=Math.floor(t/60);return n<60?n+"m":Math.floor(n/60)+"h "+n%60+"m"}function mn({label:e,value:t,color:n}){return r.jsxs("div",{children:[r.jsx("div",{className:"muted",style:{fontSize:10.5},children:e}),r.jsx("div",{className:"mono tabular",style:{fontSize:16,fontWeight:600,marginTop:2,color:n||"var(--text-primary)"},children:t})]})}function oi({data:e,color:t,w:n=80,h:s=24,fill:l}){if(!e||!e.length)return null;const o=Math.max(...e),a=Math.min(...e),i=o-a||1,d=e.map((f,m)=>[m/(e.length-1)*n,s-(f-a)/i*(s-4)-2]).map((f,m)=>(m?"L":"M")+f[0].toFixed(1)+" "+f[1].toFixed(1)).join(" "),u=d+` L${n} ${s} L0 ${s} Z`;return r.jsxs("svg",{width:n,height:s,style:{display:"block",overflow:"visible"},children:[l&&r.jsx("path",{d:u,fill:t,opacity:.12}),r.jsx("path",{d,fill:"none",stroke:t||"var(--accent)",strokeWidth:1.6,strokeLinejoin:"round",strokeLinecap:"round"})]})}function ip({series:e,w:t=640,h:n=200,color:s="var(--accent)",xTicks:l=6,onHover:o}){const[a,i]=z.useState(null),c={l:44,r:12,t:14,b:24},d=t-c.l-c.r,u=n-c.t-c.b,f=e.map(y=>y.cost),m=Math.max(...f)*1.12||1,g=0,v=y=>c.l+y/(e.length-1)*d,p=y=>c.t+u-(y-g)/(m-g)*u,w=e.map((y,S)=>(S?"L":"M")+v(S).toFixed(1)+" "+p(y.cost).toFixed(1)).join(" "),h=w+` L${v(e.length-1)} ${c.t+u} L${c.l} ${c.t+u} Z`,x=4,j=a!=null?e[a]:void 0;return r.jsxs("svg",{width:"100%",viewBox:`0 0 ${t} ${n}`,style:{display:"block"},onMouseLeave:()=>{i(null),o?.(null)},onMouseMove:y=>{const S=y.currentTarget.getBoundingClientRect(),b=(y.clientX-S.left)/S.width*t;let C=Math.round((b-c.l)/d*(e.length-1));C=Math.max(0,Math.min(e.length-1,C)),i(C),o?.(e[C]??null)},children:[Array.from({length:x+1}).map((y,S)=>{const b=m/x*S,C=p(b);return r.jsxs("g",{children:[r.jsx("line",{x1:c.l,x2:t-c.r,y1:C,y2:C,stroke:"rgba(255,255,255,0.05)"}),r.jsx("text",{x:c.l-8,y:C+3,textAnchor:"end",fontSize:10,fill:"var(--text-muted)",fontFamily:"var(--font-mono)",children:"$"+b.toFixed(0)})]},S)}),r.jsx("path",{d:h,fill:s,opacity:.1}),r.jsx("path",{d:w,fill:"none",stroke:s,strokeWidth:2,strokeLinejoin:"round"}),e.filter((y,S)=>S%Math.ceil(e.length/l)===0).map(y=>{const S=e.indexOf(y);return r.jsx("text",{x:v(S),y:n-6,textAnchor:"middle",fontSize:10,fill:"var(--text-muted)",fontFamily:"var(--font-mono)",children:y.day+"d"},S)}),a!=null&&j&&r.jsxs("g",{children:[r.jsx("line",{x1:v(a),x2:v(a),y1:c.t,y2:c.t+u,stroke:s,opacity:.4,strokeDasharray:"3 3"}),r.jsx("circle",{cx:v(a),cy:p(j.cost),r:4,fill:s,stroke:"var(--bg-canvas)",strokeWidth:2})]})]})}function cp({data:e,size:t=140,thickness:n=22,centerLabel:s,centerSub:l}){const o=e.reduce((f,m)=>f+m.cost,0)||1,a=(t-n)/2,i=t/2,c=t/2,d=2*Math.PI*a;let u=0;return r.jsxs("div",{style:{position:"relative",width:t,height:t},children:[r.jsxs("svg",{width:t,height:t,style:{transform:"rotate(-90deg)"},children:[r.jsx("circle",{cx:i,cy:c,r:a,fill:"none",stroke:"rgba(255,255,255,0.05)",strokeWidth:n}),e.map((f,m)=>{const v=f.cost/o*d,p=r.jsx("circle",{cx:i,cy:c,r:a,fill:"none",stroke:f.color,strokeWidth:n,strokeDasharray:`${v} ${d-v}`,strokeDashoffset:-u,strokeLinecap:"butt"},m);return u+=v,p})]}),s&&r.jsx("div",{style:{position:"absolute",inset:0,display:"grid",placeItems:"center",textAlign:"center"},children:r.jsxs("div",{children:[r.jsx("div",{style:{fontSize:18,fontWeight:700,fontVariantNumeric:"tabular-nums"},children:s}),l&&r.jsx("div",{className:"muted",style:{fontSize:10},children:l})]})})]})}function dp({rows:e,segments:t,fmt:n}){const s=Math.max(...e.map(l=>t.reduce((o,a)=>o+(l.values[a.key]||0),0)))||1;return r.jsx("div",{className:"col gap-10",children:e.map(l=>{const o=t.reduce((a,i)=>a+(l.values[i.key]||0),0);return r.jsxs("div",{className:"row gap-10",children:[r.jsx("div",{style:{width:110,fontSize:12,color:"var(--text-secondary)",textAlign:"right",flexShrink:0,fontFamily:"var(--font-mono)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l.label}),r.jsx("div",{className:"row",style:{flex:1,height:18,background:"var(--bg-hover)",borderRadius:4,overflow:"hidden"},children:t.map(a=>{const i=l.values[a.key]||0;return i?r.jsx("div",{title:`${a.label}: ${n?n(i):i}`,style:{width:i/s*100+"%",height:"100%",background:a.color}},a.key):null})}),r.jsx("div",{className:"tabular",style:{width:64,fontSize:12,textAlign:"right",flexShrink:0,fontFamily:"var(--font-mono)"},children:n?n(o):o})]},l.label)})})}function ai({items:e,max:t,color:n,fmt:s,labelKey:l="name",valueKey:o="calls",onItemClick:a,selectedKey:i}){const c=t||Math.max(...e.map(d=>Number(d[o])||0))||1;return r.jsx("div",{className:"col gap-6",children:e.map(d=>{const u=String(d[l]),f=Number(d[o])||0,m=i!=null&&u===i;return r.jsxs("div",{className:"row gap-10",onClick:a?()=>a(d):void 0,style:{cursor:a?"pointer":"default",borderRadius:5,padding:a?"2px 4px":0,margin:a?"0 -4px":0,background:m?"var(--accent-soft)":"transparent"},onMouseEnter:a?g=>{m||(g.currentTarget.style.background="var(--bg-hover)")}:void 0,onMouseLeave:a?g=>{m||(g.currentTarget.style.background="transparent")}:void 0,children:[r.jsx("div",{style:{width:116,fontSize:12,fontFamily:"var(--font-mono)",color:m?"var(--accent)":"var(--text-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flexShrink:0},children:u}),r.jsx("div",{className:"grow",style:{height:16,background:"var(--bg-hover)",borderRadius:4,overflow:"hidden"},children:r.jsx("div",{style:{width:f/c*100+"%",height:"100%",background:typeof n=="function"?n(d):n||"var(--accent)",borderRadius:4}})}),r.jsx("div",{className:"tabular",style:{width:52,textAlign:"right",fontSize:12,fontFamily:"var(--font-mono)",flexShrink:0},children:s?s(f):f}),a&&r.jsx(N,{name:"chevronRight",size:12,style:{color:m?"var(--accent)":"var(--text-faint)",flexShrink:0}})]},u)})})}function Em(e,t,n,s,l){const o=e.reduce((g,v)=>g+v.value,0)||1,a=e.map(g=>({d:g,area:g.value/o*(s*l)})),i=[];let c={x:t,y:n,w:s,h:l},d=[];const u=g=>g.reduce((v,p)=>v+p.area,0),f=(g,v)=>{if(!g.length)return 1/0;const p=u(g),w=Math.max(...g.map(x=>x.area)),h=Math.min(...g.map(x=>x.area));return Math.max(v*v*w/(p*p),p*p/(v*v*h))},m=()=>{const g=Math.min(c.w,c.h),p=u(d)/(g||1);let w=0;const h=c.w>=c.h;d.forEach(x=>{const j=x.area/(p||1);h?i.push({...x.d,x:c.x,y:c.y+w,w:p,h:j}):i.push({...x.d,x:c.x+w,y:c.y,w:j,h:p}),w+=j}),h?c={x:c.x+p,y:c.y,w:c.w-p,h:c.h}:c={x:c.x,y:c.y+p,w:c.w,h:c.h-p},d=[]};return a.forEach(g=>{const v=Math.min(c.w,c.h);d.length&&f([...d,g],v)>f(d,v)&&m(),d.push(g)}),d.length&&m(),i}function ii({items:e,height:t=120,onPick:n,selKey:s}){const l=z.useRef(null),[o,a]=z.useState(0);z.useEffect(()=>{if(!l.current||typeof ResizeObserver>"u")return;const u=new ResizeObserver(f=>a(f[0].contentRect.width));return u.observe(l.current),()=>u.disconnect()},[]);const i=o||600,c=[...e].sort((u,f)=>f.value-u.value),d=Em(c,0,0,i,t);return r.jsx("div",{ref:l,style:{position:"relative",width:"100%",height:t,borderRadius:7,overflow:"hidden",background:"var(--bg-canvas)"},children:d.map(u=>{const f=Math.max(0,Math.min(1,u.intensity||0)),g=`color-mix(in srgb, ${f>.66?"var(--error)":f>.33?"var(--warn)":"var(--node-route)"} ${Math.round(20+f*58)}%, var(--bg-elevated))`,v=s===u.key,p=u.w>52&&u.h>26,w=u.w>36&&u.h>15,h={position:"absolute",left:u.x+1.5,top:u.y+1.5,width:Math.max(0,u.w-3),height:Math.max(0,u.h-3),background:g,borderRadius:4,cursor:n?"pointer":"default",overflow:"hidden",padding:p?"5px 7px":"0 5px",display:"flex",flexDirection:"column",justifyContent:p?"flex-start":"center",border:v?"1.5px solid var(--accent)":"1px solid rgba(0,0,0,0.26)"};return r.jsxs("div",{onClick:n?()=>n(u):void 0,title:u.title||u.label,style:h,children:[w&&r.jsx("span",{className:"mono",style:{fontSize:p?10:9,fontWeight:500,color:f>.45?"#fff":"var(--text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",lineHeight:1.25},children:u.label}),p&&u.sub&&r.jsx("span",{className:"mono tabular",style:{fontSize:9,color:f>.45?"rgba(255,255,255,0.8)":"var(--text-muted)",marginTop:1},children:u.sub})]},u.key)})})}function Vr(e,t){return e==="route"?"route":/\.(test|spec)\.|__tests__\//.test(t)?"test":"code"}function up(e){return e.map((t,n)=>{const s=46*Math.sqrt(n+.6),l=n*2.399963229728653;return{id:t.id,label:t.name,kind:Vr(t.kind,t.filePath),x:Math.round(s*Math.cos(l)*2.2),y:Math.round(s*Math.sin(l)),file:t.filePath}})}const Tc=120,Tm=600;function _m(e,t){const n=up(e),s=n.length;if(s<2)return n;const l=new Map;n.forEach((d,u)=>l.set(d.id,u));const o=n.map(d=>d.x),a=n.map(d=>d.y),i=110,c=s<=Tm;for(let d=0;d<Tc;d++){const f=3+26*(1-d/Tc),m=new Array(s).fill(0),g=new Array(s).fill(0);if(c)for(let v=0;v<s;v++)for(let p=v+1;p<s;p++){let w=o[v]-o[p],h=a[v]-a[p];if(w===0&&h===0){const y=(v*7+p)%12*(Math.PI/6);w=Math.cos(y),h=Math.sin(y)}const x=w*w+h*h,j=i*i/x;m[v]+=w*j,g[v]+=h*j,m[p]-=w*j,g[p]-=h*j}for(const v of t){const p=l.get(v.from),w=l.get(v.to);if(p===void 0||w===void 0||p===w)continue;const h=o[p]-o[w],x=a[p]-a[w],j=(Math.hypot(h,x)||1)/i;m[p]-=h*j,g[p]-=x*j,m[w]+=h*j,g[w]+=x*j}for(let v=0;v<s;v++){const p=Math.hypot(m[v],g[v]);if(!p)continue;const w=Math.min(p,f);o[v]+=m[v]/p*w,a[v]+=g[v]/p*w}}return n.map((d,u)=>({...d,x:Math.round(o[u]*1.35),y:Math.round(a[u])}))}function Mm(e,t){const n=new Set(e.map(p=>p.id)),s=new Map,l=new Map;e.forEach(p=>{s.set(p.id,0),l.set(p.id,[])}),t.forEach(p=>{p.from===p.to||!n.has(p.from)||!n.has(p.to)||(l.get(p.from).push(p.to),s.set(p.to,(s.get(p.to)??0)+1))});const o=new Map,a=[];let i=0;const c=()=>{for(;i<a.length;){const p=a[i++],w=o.get(p);for(const h of l.get(p)??[])o.has(h)||(o.set(h,w+1),a.push(h))}};e.forEach(p=>{s.get(p.id)===0&&(o.set(p.id,0),a.push(p.id))}),c();for(const p of e)o.has(p.id)||(o.set(p.id,0),a.push(p.id),c());const d=new Map;e.forEach(p=>{const w=o.get(p.id);d.has(w)||d.set(w,[]),d.get(w).push(p.id)});const u=250,f=58,m=20,g=new Map;let v=0;for(const[,p]of[...d.entries()].sort((w,h)=>w[0]-h[0])){const w=Math.ceil(p.length/m),h=Math.ceil(p.length/w);p.forEach((x,j)=>{const y=Math.floor(j/h),S=j%h;g.set(x,{x:v+y*u,y:Math.round((S-(h-1)/2)*f)})}),v+=w*u+40}return e.map(p=>({id:p.id,label:p.name,kind:Vr(p.kind,p.filePath),x:g.get(p.id).x,y:g.get(p.id).y,file:p.filePath}))}function Rm(e,t,n){return n==="synth"?"synth":e.kind==="spec"||t.kind==="spec"?"implements":e.kind==="test"||t.kind==="test"?"tests":"calls"}const _c={position:"absolute",top:34,left:"50%",transform:"translateX(-50%)",background:"var(--bg-elevated)",border:"1px solid var(--border-strong)",borderRadius:5,padding:"3px 7px",fontSize:10.5,fontFamily:"var(--font-mono)",color:"var(--text-secondary)",whiteSpace:"nowrap",pointerEvents:"none",boxShadow:"var(--shadow-pop)",zIndex:5};function ci({nodes:e,edges:t,selectedId:n,onSelect:s,hiddenIds:l,hiddenEdgeKinds:o,height:a="100%",interactive:i=!0,fitKey:c,focusId:d,dotGrid:u=!0}){const[f,m]=z.useState(e),[g,v]=z.useState({tx:0,ty:0,k:1}),[p,w]=z.useState(null),[h,x]=z.useState({w:0,h:0}),j=z.useRef(null),y=z.useRef(null),S=z.useRef(!1);z.useEffect(()=>{const k=j.current;if(!k||typeof ResizeObserver>"u")return;const E=new ResizeObserver(M=>x({w:M[0].contentRect.width,h:M[0].contentRect.height}));return E.observe(k),()=>E.disconnect()},[]),z.useEffect(()=>{m(e),S.current=!1},[e]);const b=z.useCallback(()=>{const k=j.current;if(!k||!f.length)return;const E=k.clientWidth,M=k.clientHeight,L=f.map(Qt=>Qt.x),I=f.map(Qt=>Qt.y),H=Math.min(...L)-60,K=Math.max(...L)+140,fe=Math.min(...I)-40,ge=Math.max(...I)+80,ze=K-H,Kt=ge-fe,Ye=Math.min(E/ze,M/Kt,1.4)*.92;v({k:Ye,tx:(E-ze*Ye)/2-H*Ye,ty:(M-Kt*Ye)/2-fe*Ye})},[f]);z.useEffect(()=>{!S.current&&j.current&&(b(),S.current=!0)},[f,b]),z.useEffect(()=>{c!==void 0&&b()},[c]);const C=z.useRef(null);z.useEffect(()=>{if(!d){C.current=null;return}if(C.current===d)return;const k=f.find(K=>K.id===d),E=j.current;if(!k||!E)return;C.current=d;const{cx:M,cy:L}=ut(k),I=E.clientWidth,H=E.clientHeight;v(K=>{const fe=Math.min(1.4,Math.max(.6,K.k));return{k:fe,tx:I/2-M*fe,ty:H/2-L*fe}})},[d,f]);const _=k=>{if(!i)return;k.preventDefault();const E=j.current.getBoundingClientRect(),M=k.clientX-E.left,L=k.clientY-E.top,I=-k.deltaY*.0016;v(H=>{const K=Math.min(2.4,Math.max(.25,H.k*(1+I))),fe=K/H.k;return{k:K,tx:M-(M-H.tx)*fe,ty:L-(L-H.ty)*fe}})},W=k=>{i&&(k.target.closest("[data-node]")||(y.current={type:"pan",sx:k.clientX,sy:k.clientY,ox:g.tx,oy:g.ty},k.currentTarget.style.cursor="grabbing"))},O=(k,E)=>{i&&(k.stopPropagation(),y.current={type:"node",id:E.id,sx:k.clientX,sy:k.clientY,ox:E.x,oy:E.y,moved:!1})},oe=k=>{const E=y.current;if(E)if(E.type==="pan")v(M=>({...M,tx:E.ox+(k.clientX-E.sx),ty:E.oy+(k.clientY-E.sy)}));else{const M=(k.clientX-E.sx)/g.k,L=(k.clientY-E.sy)/g.k;Math.abs(k.clientX-E.sx)+Math.abs(k.clientY-E.sy)>3&&(E.moved=!0),m(I=>I.map(H=>H.id===E.id?{...H,x:E.ox+M,y:E.oy+L}:H))}},nt=()=>{const k=y.current;k&&k.type==="node"&&!k.moved&&s?.(k.id),j.current&&(j.current.style.cursor="grab"),y.current=null},Qe={};f.forEach(k=>Qe[k.id]=k);const rt={};t.forEach(k=>{rt[k.from]=(rt[k.from]||0)+1,rt[k.to]=(rt[k.to]||0)+1});function pn(k){return k.kind==="route"?{w:18,h:18,shape:"dot"}:{w:Math.max(64,k.label.length*(k.kind==="spec"?7.6:7.2)+26),h:30,shape:k.kind==="spec"?"rect":"pill"}}function ut(k){const E=pn(k);return{cx:k.x+E.w/2,cy:k.y+E.h/2,b:E}}const st=new Set;return n&&t.forEach(k=>{k.from===n&&st.add(k.to),k.to===n&&st.add(k.from)}),r.jsxs("div",{ref:j,onWheel:_,onMouseDown:W,onMouseMove:oe,onMouseUp:nt,onMouseLeave:nt,style:{position:"relative",width:"100%",height:a,overflow:"hidden",cursor:"grab",background:u?"var(--bg-canvas-2)":"transparent",backgroundImage:u?"radial-gradient(circle, var(--dot-grid) 1px, transparent 1px)":"none",backgroundSize:`${22*g.k}px ${22*g.k}px`,backgroundPosition:`${g.tx}px ${g.ty}px`,userSelect:"none"},children:[r.jsxs("svg",{width:"100%",height:"100%",style:{position:"absolute",inset:0,pointerEvents:"none"},children:[r.jsxs("defs",{children:[r.jsx("marker",{id:"arrow",viewBox:"0 0 10 10",refX:8,refY:5,markerWidth:6,markerHeight:6,orient:"auto-start-reverse",children:r.jsx("path",{d:"M0 0 L10 5 L0 10 z",fill:"rgba(160,170,190,0.5)"})}),r.jsx("marker",{id:"arrowHi",viewBox:"0 0 10 10",refX:8,refY:5,markerWidth:7,markerHeight:7,orient:"auto-start-reverse",children:r.jsx("path",{d:"M0 0 L10 5 L0 10 z",fill:"var(--accent)"})})]}),r.jsx("g",{transform:`translate(${g.tx} ${g.ty}) scale(${g.k})`,children:t.map((k,E)=>{const M=Qe[k.from],L=Qe[k.to];if(!M||!L)return null;const I=Rm(M,L,k.kind);if(o?.has(I))return null;const H=ut(M),K=ut(L),fe=l&&(l.has(k.from)||l.has(k.to)),ge=n&&(k.from===n||k.to===n),ze=I==="implements"?"var(--node-spec)":I==="tests"?"var(--node-test)":null,Kt=ze?`color-mix(in srgb, ${ze} 62%, transparent)`:"rgba(150,160,180,0.32)",Ye=(H.cx+K.cx)/2,Qt=`M ${H.cx} ${H.cy} C ${Ye} ${H.cy}, ${Ye} ${K.cy}, ${K.cx} ${K.cy}`;return r.jsx("path",{d:Qt,fill:"none",stroke:ge?"var(--accent)":Kt,strokeWidth:ge?2:ze?1.5:1.2,opacity:fe?.12:ge?.95:.72,strokeDasharray:k.kind==="synth"?"5 4":"none",markerEnd:ge?"url(#arrowHi)":"url(#arrow)"},E)})})]}),r.jsx("div",{style:{position:"absolute",inset:0,transform:`translate(${g.tx}px, ${g.ty}px) scale(${g.k})`,transformOrigin:"0 0",pointerEvents:"none"},children:f.map(k=>{const E=pn(k),M=$t(k.kind,k.state),L=l&&l.has(k.id),I=k.id===n,H=st.has(k.id),K=p===k.id,fe=L?.2:n&&!I&&!H?.55:1,ge=rt[k.id]||0,ze=1+Math.min(.24,ge*.045),Kt={"data-node":k.id,onMouseDown:Qt=>O(Qt,k),onMouseEnter:()=>w(k.id),onMouseLeave:()=>w(null),style:{position:"absolute",left:k.x,top:k.y,pointerEvents:"auto",cursor:"pointer",opacity:fe,transition:"opacity 120ms"}};if(E.shape==="dot")return r.jsxs("div",{...Kt,children:[r.jsx("div",{style:{width:18,height:18,borderRadius:"50%",background:M,transform:`scale(${ze})`,boxShadow:I?`0 0 0 4px ${M}44, 0 0 14px ${M}`:K?`0 0 0 3px ${M}33`:`0 0 8px ${M}66`,border:"2px solid var(--bg-canvas-2)"}}),(K||I)&&r.jsx("div",{style:_c,children:k.label})]},k.id);const Ye=k.kind==="spec"&&(k.state==="drifted"||k.state==="broken"||k.state==="orphaned");return r.jsxs("div",{...Kt,children:[r.jsxs("div",{style:{minWidth:E.w,height:E.h,padding:"0 12px",display:"flex",alignItems:"center",gap:7,borderRadius:E.shape==="rect"?7:999,transform:`scale(${ze})`,transformOrigin:"center",background:`color-mix(in srgb, ${M} 16%, var(--bg-panel))`,border:`1.5px solid ${I||Ye?M:`color-mix(in srgb, ${M} 45%, transparent)`}`,color:"var(--node-text)",fontSize:12.5,fontWeight:500,whiteSpace:"nowrap",fontFamily:"var(--font-mono)",boxShadow:I?`0 0 0 4px ${M}33, 0 4px 16px ${M}44`:K?`0 0 0 3px ${M}22`:"0 2px 8px rgba(0,0,0,0.4)"},children:[r.jsx("span",{style:{width:7,height:7,borderRadius:E.shape==="rect"?2:"50%",background:M,flexShrink:0,boxShadow:`0 0 6px ${M}`}}),k.label,Ye&&r.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:k.state==="drifted"?"var(--warn)":"var(--error)",marginLeft:2}})]}),K&&r.jsx("div",{style:{..._c,top:-22},children:k.file||k.sub})]},k.id)})}),i&&r.jsxs("div",{style:{position:"absolute",right:14,bottom:14,display:"flex",flexDirection:"column",gap:6},children:[r.jsx(so,{icon:"plus",onClick:()=>v(k=>({...k,k:Math.min(2.4,k.k*1.2)}))}),r.jsx(so,{icon:"minus",onClick:()=>v(k=>({...k,k:Math.max(.25,k.k/1.2)}))}),r.jsx(so,{icon:"maximize",onClick:b,title:"Fit"})]}),i&&r.jsxs("div",{style:{position:"absolute",left:14,bottom:14,display:"flex",flexDirection:"column",gap:6},children:[r.jsx(Pm,{nodes:f,view:g,size:h}),r.jsx("div",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-muted)",background:"rgba(0,0,0,0.4)",padding:"2px 7px",borderRadius:5,alignSelf:"flex-start"},children:Math.round(g.k*100)+"%"})]})]})}function Pm({nodes:e,view:t,size:n}){if(!e.length)return null;const s=138,l=88,o=6,a=e.map(C=>C.x),i=e.map(C=>C.y),c=Math.min(...a)-30,d=Math.max(...a)+120,u=Math.min(...i)-20,f=Math.max(...i)+50,m=d-c||1,g=f-u||1,v=Math.min((s-o*2)/m,(l-o*2)/g),p=o+(s-o*2-m*v)/2,w=o+(l-o*2-g*v)/2,h=C=>p+(C-c)*v,x=C=>w+(C-u)*v,j=-t.tx/t.k,y=-t.ty/t.k,S=n.w/t.k,b=n.h/t.k;return r.jsxs("svg",{width:s,height:l,style:{background:"color-mix(in srgb, var(--bg-canvas-2) 92%, transparent)",border:"1px solid var(--border-subtle)",borderRadius:7,boxShadow:"0 4px 12px rgba(0,0,0,0.4)",backdropFilter:"blur(4px)"},children:[e.map(C=>r.jsx("circle",{cx:h(C.x),cy:x(C.y),r:C.kind==="route"?1.6:2.1,fill:$t(C.kind,C.state),opacity:.9},C.id)),n.w>0&&r.jsx("rect",{x:Math.max(0,h(j)),y:Math.max(0,x(y)),width:Math.min(s,S*v),height:Math.min(l,b*v),fill:"var(--accent)",fillOpacity:.12,stroke:"var(--accent)",strokeWidth:1,rx:2})]})}function so({icon:e,onClick:t,title:n}){return r.jsx("button",{onClick:t,title:n,className:"btn btn-secondary",style:{width:30,height:30,padding:0,justifyContent:"center",borderRadius:7},children:r.jsx(N,{name:e,size:15})})}const U=e=>e>=1e6?(e/1e6).toFixed(1)+"M":e>=1e3?(e/1e3).toFixed(1)+"k":String(e),Lm=e=>e.split("/").filter(Boolean).slice(-2).join("/"),Cl=e=>e.replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim();function se({state:e,label:t,minHeight:n,children:s}){if(e.data==null&&e.loading)return r.jsx("div",{className:"skel",style:{minHeight:n,borderRadius:10},"aria-label":`Loading ${t}`});if(e.data==null&&e.error!=null){const l=e.error instanceof Error?e.error.message:String(e.error);return r.jsx("div",{className:"card card-pad",style:{minHeight:n,display:"grid",placeItems:"center"},children:r.jsxs("div",{style:{textAlign:"center",maxWidth:300},children:[r.jsxs("div",{className:"row gap-8",style:{justifyContent:"center",color:"var(--error)"},children:[r.jsx(N,{name:"cancel",size:14}),r.jsxs("span",{style:{fontSize:12.5,fontWeight:600},children:["Couldn't load ",t]})]}),r.jsx("div",{className:"muted",style:{fontSize:11.5,marginTop:4,overflowWrap:"anywhere"},children:l}),r.jsx("button",{className:"btn btn-secondary btn-xs",style:{marginTop:10},onClick:e.reload,children:"Retry"})]})})}return e.data==null?null:r.jsx(r.Fragment,{children:s(e.data)})}function El({onIngested:e}){const[t,n]=z.useState(!1),s=()=>{n(!0),P.ingestNow().catch(()=>{}).finally(()=>{n(!1),e?.()})};return r.jsx("div",{style:{flex:1,display:"grid",placeItems:"center",padding:18,textAlign:"center"},children:r.jsxs("div",{style:{maxWidth:320},children:[r.jsx("div",{style:{color:"var(--text-muted)",marginBottom:8},children:r.jsx(N,{name:"database",size:18})}),r.jsx("div",{style:{fontSize:12.5,fontWeight:600,marginBottom:4},children:"No Claude Code data ingested yet"}),r.jsx("div",{className:"muted",style:{fontSize:11.5,lineHeight:1.5},children:"Usage modules light up once SpecShip ingests your transcripts from ~/.claude/projects — run an ingest pass now, or use Refresh in the status strip."}),r.jsx("button",{className:"btn btn-secondary btn-xs",style:{marginTop:10},onClick:s,disabled:t,children:t?"Ingesting…":"Run ingest now"})]})})}function Tl({label:e,page:t,arrow:n}){return r.jsxs("a",{href:"/"+t,className:"btn btn-ghost btn-xs",onClick:s=>{s.metaKey||s.ctrlKey||s.shiftKey||(s.preventDefault(),A(t))},children:[e,n&&r.jsx(N,{name:"arrowRight",size:11})]})}function di({icon:e,iconColor:t,title:n,sub:s,action:l,pad:o}){return r.jsxs("div",{className:"row",style:{justifyContent:"space-between",padding:o?"11px 13px":void 0,marginBottom:o?0:10,borderBottom:o?"1px solid var(--border-subtle)":void 0},children:[r.jsxs("div",{className:"row gap-8",children:[r.jsx(N,{name:e,size:14,style:{color:t}}),r.jsx("span",{style:{fontWeight:600,fontSize:12.5},children:n}),s&&r.jsx("span",{className:"muted",style:{fontSize:11},children:s})]}),l]})}function cs({icon:e,label:t,value:n,delta:s,deltaInvert:l,spark:o,sparkColor:a,color:i,note:c,onClick:d}){return r.jsxs("button",{onClick:d,className:"card card-btn",style:{textAlign:"left",padding:"11px 13px",display:"flex",flexDirection:"column",gap:6},children:[r.jsxs("div",{className:"row gap-8",style:{color:"var(--text-muted)"},children:[r.jsx(N,{name:e,size:13,style:{color:i||"var(--text-muted)"}}),r.jsx("span",{className:"eyebrow",style:{letterSpacing:"0.04em"},children:t})]}),r.jsxs("div",{className:"row",style:{justifyContent:"space-between",alignItems:"flex-end",gap:8},children:[r.jsx("div",{className:"tabular",style:{fontSize:23,fontWeight:650,letterSpacing:"-0.02em",lineHeight:1},children:n}),o&&o.length>1&&r.jsx(oi,{data:o,color:a||i||"var(--accent)",fill:!0,w:64,h:22})]}),c?r.jsx("div",{className:"muted",style:{fontSize:10.5},children:c}):s!==void 0&&r.jsx(si,{value:s,invert:l})]})}function Dm(e,t){if(!e.nodes.length)return{nodes:[],edges:[]};const n=12,s=[],l=new Set;for(const c of t){for(const d of e.nodes){if(s.length>=n)break;l.has(d.id)||(c.path===d.filePath||c.path.endsWith("/"+d.filePath))&&(s.push(d),l.add(d.id))}if(s.length>=n)break}const o=s.length>=3?s:e.nodes.slice(0,n),a=new Set(o.map(c=>c.id)),i=e.edges.filter(c=>a.has(c.from)&&a.has(c.to)).map(c=>({from:c.from,to:c.to,kind:c.provenance==="heuristic"?"synth":c.kind}));return{nodes:up(o),edges:i}}function Im({graph:e,heatFiles:t}){const{nodes:n,edges:s}=z.useMemo(()=>Dm(e,t),[e,t]);return r.jsxs("div",{className:"card",style:{overflow:"hidden",height:340,display:"flex",flexDirection:"column"},children:[r.jsx(di,{icon:"graph",iconColor:"var(--accent)",title:"Recent neighborhood",sub:"· last edited files",pad:!0,action:r.jsx(Tl,{label:"Open graph",page:"graph",arrow:!0})}),r.jsx("div",{style:{flex:1,minHeight:0},children:n.length?r.jsx(ci,{nodes:n,edges:s,onSelect:l=>A("graph",{query:{focus:l}}),interactive:!0}):r.jsx("div",{style:{display:"grid",placeItems:"center",height:"100%"},children:r.jsx("div",{className:"muted",style:{fontSize:12},children:"Nothing indexed yet — run specship index."})})})]})}function Om({tip:e,onApply:t,onDismiss:n}){const s=e.severity==="error"?"var(--error)":e.severity==="warn"?"var(--warn)":"var(--info)",l=e.state==="applied";return r.jsxs("div",{onClick:()=>A("tips",{query:{sel:e.id}}),title:"View in Tips",onAnimationEnd:o=>{o.currentTarget.style.animation="none"},style:{display:"flex",gap:10,padding:"10px 12px",borderRadius:8,background:"var(--bg-panel-2)",border:"1px solid var(--border-subtle)",borderLeft:`2.5px solid ${s}`,animation:"slideInRight 200ms ease",cursor:"pointer",opacity:l?.65:1},children:[r.jsx("div",{style:{color:s,flexShrink:0,marginTop:1},children:r.jsx(N,{name:e.icon,size:14})}),r.jsxs("div",{className:"grow",style:{minWidth:0},children:[r.jsx("div",{style:{fontSize:12.5,fontWeight:550,lineHeight:1.35,textWrap:"pretty"},children:e.title}),r.jsxs("div",{className:"row gap-8",style:{marginTop:7},children:[r.jsx("code",{className:"mono",style:{fontSize:10.5,color:"var(--text-secondary)",background:"var(--bg-canvas)",padding:"2px 6px",borderRadius:4,border:"1px solid var(--border-subtle)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:220},children:e.fix}),r.jsx("span",{className:"grow"}),r.jsx("span",{className:"pill",style:{fontSize:10,color:s,background:"transparent"},children:e.saving})]})]}),r.jsxs("div",{className:"row gap-4",style:{flexShrink:0},children:[l?r.jsxs("span",{className:"pill",style:{color:"var(--success)",background:"var(--success-soft)"},children:[r.jsx(N,{name:"check",size:11}),"Applied"]}):r.jsx("button",{className:"btn btn-secondary btn-xs",onClick:o=>{o.stopPropagation(),t()},title:"Mark applied",children:"Apply"}),r.jsx("button",{className:"btn btn-ghost btn-xs",onClick:o=>{o.stopPropagation(),n()},title:"Dismiss",children:r.jsx(N,{name:"x",size:12})})]})]})}function Am({tips:e,onSetState:t,noIngest:n,onIngested:s}){const l=e.filter(o=>o.severity==="error"&&o.state!=="applied").length;return r.jsxs("div",{className:"card",style:{display:"flex",flexDirection:"column",height:340},children:[r.jsxs("div",{className:"row",style:{justifyContent:"space-between",padding:"11px 13px",borderBottom:"1px solid var(--border-subtle)"},children:[r.jsxs("div",{className:"row gap-8",children:[r.jsx(N,{name:"tips",size:14,style:{color:"var(--warn)"}}),r.jsx("span",{style:{fontWeight:600,fontSize:12.5},children:"Tips"}),l>0&&r.jsxs("span",{className:"pill",style:{fontSize:10,background:"var(--error-soft)",color:"var(--error)"},children:[l," urgent"]})]}),r.jsx(Tl,{label:"All",page:"tips"})]}),n&&!e.length?r.jsx(El,{onIngested:s}):r.jsxs("div",{className:"scroll-y",style:{flex:1,padding:10,display:"flex",flexDirection:"column",gap:8},children:[e.slice(0,4).map(o=>r.jsx(Om,{tip:o,onApply:()=>t(o.id,"applied"),onDismiss:()=>t(o.id,"dismissed")},o.id)),!e.length&&r.jsx("div",{className:"muted",style:{fontSize:12,padding:8},children:"No tips — nothing wasteful in your recent sessions."})]})]})}function Bm({files:e,noIngest:t,onIngested:n}){const s=e.slice(0,14).map(a=>{const i=a.resultBytes??0;return{path:a.path,calls:a.calls,tokens:i,tpc:a.calls>0?i/a.calls:0}}),l=Math.max(...s.map(a=>a.tpc),0)||1,o=s.map(a=>({key:a.path,label:Lm(a.path),value:a.calls,intensity:a.tpc/l,sub:a.calls+" calls",title:`${a.path}
41
- ${a.calls} calls · ${U(a.tokens)} tokens · ${U(Math.round(a.tpc))}/call`}));return r.jsxs("div",{className:"card card-pad",style:{display:"flex",flexDirection:"column"},children:[r.jsx(di,{icon:"flame",iconColor:"var(--warn)",title:"Tool-call heatmap",sub:"· area = calls, color = tokens / call",action:r.jsx(Tl,{label:"Open heatmap",page:"heatmap",arrow:!0})}),t||!o.length?t?r.jsx(El,{onIngested:n}):r.jsx("div",{className:"muted",style:{fontSize:12,padding:"18px 4px"},children:"No file-touching tool calls in this range."}):r.jsxs(r.Fragment,{children:[r.jsx(ii,{items:o,height:116,selKey:null,onPick:()=>A("heatmap")}),r.jsxs("div",{className:"row gap-10",style:{marginTop:9,alignItems:"center"},children:[r.jsx("span",{className:"muted",style:{fontSize:10},children:"tokens / call"}),r.jsx("div",{style:{width:96,height:6,borderRadius:999,background:"linear-gradient(90deg, var(--node-route), var(--warn), var(--error))"}}),r.jsx("span",{className:"muted",style:{fontSize:9.5},children:"efficient → wasteful"})]})]})]})}function Wm({p:e,max:t}){const n=e.input_tokens+e.output_tokens+e.cache_creation_tokens+e.cache_read_tokens,s=e.input_tokens+e.cache_creation_tokens+e.cache_read_tokens,l=s>0?e.cache_read_tokens/s:0,o=e.cost_usd/t;return r.jsxs("div",{onClick:()=>A("sessions",{query:{sel:e.session_id}}),role:"button",tabIndex:0,onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),A("sessions",{query:{sel:e.session_id}}))},className:"row gap-10 list-row",style:{padding:"7px 4px",borderRadius:6,cursor:"pointer"},children:[r.jsxs("div",{className:"grow",style:{minWidth:0},children:[r.jsxs("div",{style:{fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[!!e.is_sidechain&&r.jsx(N,{name:"bot",size:11,style:{color:"var(--node-code)",marginRight:5,verticalAlign:"-1px"}}),Cl(e.text)]}),r.jsx("div",{style:{marginTop:4,width:"70%"},children:r.jsx(Hr,{frac:o,color:o>.7?"var(--error)":"var(--accent)"})})]}),r.jsxs("div",{style:{textAlign:"right",flexShrink:0},children:[r.jsxs("div",{className:"mono tabular",style:{fontSize:12,fontWeight:600,color:o>.7?"var(--error)":"var(--text-primary)"},children:["$",e.cost_usd.toFixed(2)]}),r.jsxs("div",{className:"mono muted",style:{fontSize:10},children:[U(n)," · ",Math.round(l*100),"%"]})]})]})}function $m({prompts:e,noIngest:t,onIngested:n}){const s=[...e].sort((o,a)=>a.ts-o.ts).slice(0,8),l=Math.max(...s.map(o=>o.cost_usd),0)||1;return r.jsxs("div",{className:"card card-pad",style:{display:"flex",flexDirection:"column"},children:[r.jsx(di,{icon:"coins",iconColor:"var(--accent)",title:"Recent prompts",sub:"· by cost",action:r.jsx(Tl,{label:"Cost ranking",page:"costs"})}),t?r.jsx(El,{onIngested:n}):r.jsxs("div",{className:"col",children:[s.map(o=>r.jsx(Wm,{p:o,max:l},o.id)),!s.length&&r.jsx("div",{className:"muted",style:{fontSize:12,padding:"10px 4px"},children:"No prompt spend in this range."})]})]})}function ds(e,t,n,s){return r.jsxs("div",{children:[r.jsx("div",{className:"muted",style:{fontSize:10.5},children:e}),r.jsx("div",{className:"mono tabular",style:{fontSize:15,fontWeight:600,color:s||"var(--text-primary)"},children:t}),n&&r.jsx("div",{className:"mono muted",style:{fontSize:9.5},children:n})]})}const Fm={today:"Saved today",week:"Saved this week",month:"Saved this month",all:"Saved all time"};function pp({cache:e,range:t,noIngest:n,onIngested:s}){const l=Math.round(e.wowDelta*100);return r.jsxs("div",{className:"card card-pad",style:{display:"flex",flexDirection:"column",gap:12},children:[r.jsxs("div",{className:"row gap-8",children:[r.jsx(N,{name:"database",size:14,style:{color:"var(--node-route)"}}),r.jsx("span",{style:{fontWeight:600,fontSize:12.5},children:"Cache analytics"})]}),n?r.jsx(El,{onIngested:s}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"row",style:{alignItems:"flex-end",gap:10},children:[r.jsxs("div",{className:"tabular",style:{fontSize:38,fontWeight:700,letterSpacing:"-0.03em",lineHeight:.9,color:"var(--node-route)"},children:[Math.round(e.readRate*100),"%"]}),r.jsxs("div",{style:{paddingBottom:3},children:[r.jsx("div",{className:"muted",style:{fontSize:11},children:"cache read rate"}),r.jsx(si,{value:e.wowDelta})]})]}),r.jsx("div",{style:{height:1,background:"var(--border-subtle)"}}),r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"10px 14px"},children:[ds("Creation tokens",U(e.creationTokens),"written to cache"),ds("Read tokens",U(e.readTokens),"charged at ~10%"),ds(Fm[t]??"Saved this week","$"+e.dollarsSaved.toFixed(0),"vs no cache — est.","var(--success)"),ds("WoW",(l>=0?"+":"")+l+"%",l>=0?"more reuse":"less reuse",l>=0?"var(--success)":"var(--error)")]})]})]})}const us=e=>{const t=e.name||e.path;return t.split("/").filter(Boolean).pop()??t};function Hm(e){const t=D(()=>P.claudeStats(),[]),n=D(()=>P.claudeCompare(),[]),[s,l]=z.useState(new Set),o=t.data?.sessionCount===0,a=()=>{t.reload(),n.reload()},i=c=>l(d=>{const u=new Set(d);return u.has(c)?u.delete(c):u.add(c),u});return r.jsxs("div",{className:"scroll-y",style:{flex:1,padding:18},children:[r.jsx(Pe,{icon:"compare",title:"Compare projects",sub:"Which projects are cost-efficient vs hungry"}),o?r.jsx(Un,{onIngested:a}):r.jsx(se,{state:n,label:"project comparison",minHeight:280,children:c=>c.projects.length?r.jsx(Um,{projects:c.projects,off:s,onToggle:i}):r.jsx(Un,{onIngested:a})})]})}function Um({projects:e,off:t,onToggle:n}){const s=e.filter(u=>!t.has(u.path)),l=[...s].sort((u,f)=>f.cacheHit-f.avgCost/100-(u.cacheHit-u.avgCost/100))[0],o=new Map;for(const u of s)for(const f of u.byModel)o.set(f.model,(o.get(f.model)??0)+f.cost);const a=[...o.entries()].sort((u,f)=>f[1]-u[1]).slice(0,5).map(([u],f)=>({key:u,label:zl(u),color:la(f)})),i=s.map(u=>({label:us(u),values:Object.fromEntries(u.byModel.map(f=>[f.model,f.cost]))})),c=(u,f=70)=>r.jsx("span",{style:{width:f,textAlign:"right"},children:u}),d=(u,f=70)=>r.jsx("span",{className:"mono tabular",style:{width:f,textAlign:"right",fontSize:12},children:u});return r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"row gap-6",style:{marginBottom:14,flexWrap:"wrap"},children:e.map(u=>{const f=!t.has(u.path);return r.jsx("button",{onClick:()=>n(u.path),"aria-pressed":f,title:u.path,style:{height:28,padding:"0 12px",borderRadius:999,fontSize:12,cursor:"pointer",fontFamily:"var(--font-mono)",border:"1px solid "+(f?"transparent":"var(--border-subtle)"),background:f?"var(--accent-soft)":"var(--bg-panel)",color:f?"var(--accent)":"var(--text-muted)"},children:us(u)},u.path)})}),l&&r.jsxs("div",{className:"card card-pad",style:{marginBottom:14,borderColor:"rgba(70,194,107,0.3)",background:"var(--success-soft)",display:"flex",gap:12,alignItems:"center"},children:[r.jsx("div",{style:{color:"var(--success)"},children:r.jsx(N,{name:"sparkles",size:18})}),r.jsxs("div",{className:"grow",children:[r.jsx("span",{style:{fontWeight:600,fontSize:13},children:"Most efficient: "}),r.jsx("span",{className:"mono",style:{color:"var(--success)"},children:us(l)}),r.jsxs("span",{className:"secondary",style:{fontSize:12.5},children:[" ","— ",Math.round(l.cacheHit*100),"% cache hit, $",l.avgCost.toFixed(2)," avg/session",l.drift?`, ${l.drift} drifted links`:", no drifted links","."]})]})]}),r.jsxs("div",{className:"card",style:{overflow:"hidden",marginBottom:14},children:[r.jsxs("div",{className:"row",style:{padding:"9px 14px",fontSize:10.5,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.05em",fontWeight:600,borderBottom:"1px solid var(--border-subtle)"},children:[r.jsx("span",{className:"grow",children:"Project"}),c("Cost"),c("Sessions"),c("Avg"),c("Cache"),r.jsx("span",{style:{width:60,textAlign:"right"},children:"Drift"}),r.jsx("span",{style:{width:150,textAlign:"right"},children:"Top tools"})]}),s.map(u=>r.jsxs("div",{className:"row",style:{padding:"11px 14px",borderTop:"1px solid var(--border-subtle)"},children:[r.jsx("span",{className:"mono grow",style:{fontSize:12.5,color:l&&u.path===l.path?"var(--success)":"var(--text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",paddingRight:8},title:u.path,children:us(u)}),d("$"+u.cost.toFixed(0)),d(u.sessions),d("$"+u.avgCost.toFixed(2)),r.jsxs("span",{className:"mono tabular",style:{width:70,textAlign:"right",fontSize:12,color:Ur(u.cacheHit)},children:[Math.round(u.cacheHit*100),"%"]}),r.jsx("span",{className:"mono tabular",style:{width:60,textAlign:"right",fontSize:12,color:u.drift>10?"var(--warn)":"var(--text-secondary)"},children:u.drift}),r.jsx("span",{className:"row gap-4",style:{width:150,justifyContent:"flex-end",overflow:"hidden"},children:u.topTools.map(f=>r.jsx("code",{className:"mono",style:{fontSize:9.5,background:"var(--bg-canvas)",padding:"1px 5px",borderRadius:3,color:"var(--text-secondary)",whiteSpace:"nowrap"},children:f},f))})]},u.path)),!s.length&&r.jsx("div",{className:"muted",style:{fontSize:12,padding:"14px"},children:"Every project is toggled off — pick at least one above."})]}),s.length>0&&a.length>0&&r.jsxs("div",{className:"card card-pad",children:[r.jsxs("div",{className:"row",style:{justifyContent:"space-between",marginBottom:14},children:[r.jsxs("div",{className:"row gap-8",children:[r.jsx(N,{name:"dollar",size:14,style:{color:"var(--accent)"}}),r.jsx("span",{style:{fontWeight:600,fontSize:12.5},children:"Cost by model per project"})]}),r.jsx("div",{className:"row gap-12",children:a.map(u=>r.jsxs("span",{className:"row gap-4 muted",style:{fontSize:10.5},children:[r.jsx("span",{style:{width:9,height:9,borderRadius:3,background:u.color}}),u.label]},u.key))})]}),r.jsx(dp,{rows:i,segments:a,fmt:u=>"$"+u.toFixed(0)})]})]})}const Vm={today:"today",week:"7 days",month:"30 days",all:"all time"};function Km(e){const[t,n]=z.useState("month"),[s,l]=z.useState(""),[o,a]=z.useState(null),i=D(()=>P.claudeStats(),[]),c=D(()=>P.claudeCosts(t,null,s||null),[t,s]),d=D(()=>P.claudeCache(t),[t]),[u,f]=z.useState([]);z.useEffect(()=>{s||!c.data||f(c.data.byModel.map(v=>v.model).filter(v=>!!v))},[s,c.data]);const m=i.data?.sessionCount===0,g=()=>{i.reload(),c.reload(),d.reload()};return r.jsxs("div",{className:"scroll-y",style:{flex:1,padding:18},children:[r.jsx(Pe,{icon:"dollar",title:"Costs",sub:"Where the money goes",actions:r.jsxs(r.Fragment,{children:[!m&&r.jsxs("select",{className:"input","aria-label":"Model filter",value:s,onChange:v=>l(v.target.value),style:{fontSize:12,padding:"4px 8px"},children:[r.jsx("option",{value:"",children:"All models"}),u.map(v=>r.jsx("option",{value:v,children:zl(v)},v))]}),r.jsx(Nl,{value:t,onChange:n})]})}),m?r.jsx(Un,{onIngested:g}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1.3fr 1fr",gap:14,marginBottom:14},children:[r.jsx(se,{state:c,label:"cost series",minHeight:280,children:v=>r.jsxs("div",{className:"card card-pad",children:[r.jsxs("div",{className:"row",style:{justifyContent:"space-between",alignItems:"flex-start",marginBottom:10},children:[r.jsxs("div",{children:[r.jsxs("div",{className:"tabular",style:{fontSize:34,fontWeight:700,letterSpacing:"-0.02em"},children:["$",v.total.toFixed(2)]}),r.jsxs("div",{className:"row gap-8",style:{marginTop:2},children:[r.jsxs("span",{className:"muted",style:{fontSize:11.5},children:["total · ",Vm[t]??t]}),r.jsx(si,{value:v.wowDelta,invert:!0})]}),(v.unpricedSessions??0)>0&&r.jsxs("div",{style:{marginTop:4,fontSize:11,color:"var(--warn)"},title:"Sessions whose model has no pricing row — their cost is unknown and excluded from this total, not $0",children:["⚠ excludes ",v.unpricedSessions," unpriced session",v.unpricedSessions===1?"":"s"]})]}),o&&r.jsxs("div",{style:{textAlign:"right"},children:[r.jsxs("div",{className:"mono",style:{fontSize:13,fontWeight:600},children:["$",o.cost.toFixed(2)]}),r.jsxs("div",{className:"muted",style:{fontSize:10.5},children:[String(o.prompts??0)," prompts · ",o.day,"d ago"]})]})]}),r.jsx(ip,{series:v.series,color:"var(--accent)",onHover:a,h:200})]})}),r.jsx(se,{state:c,label:"cost by model",minHeight:280,children:v=>r.jsx(Qm,{c:v})})]}),r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1.4fr 1fr",gap:14},children:[r.jsx(se,{state:c,label:"expensive prompts",minHeight:280,children:v=>r.jsx(Ym,{prompts:v.topPrompts})}),r.jsx(se,{state:d,label:"cache analytics",minHeight:280,children:v=>r.jsx(pp,{cache:v,range:t,noIngest:!1,onIngested:g})})]})]})]})}function Qm({c:e}){const t=e.byModel.reduce((s,l)=>s+(l.cost??0),0),n=e.byModel.map((s,l)=>({label:zl(s.model??"unknown"),cost:s.cost??0,color:la(l)}));return r.jsxs("div",{className:"card card-pad",style:{display:"flex",flexDirection:"column",alignItems:"center"},children:[r.jsxs("div",{className:"row gap-8",style:{alignSelf:"flex-start",marginBottom:8},children:[r.jsx(N,{name:"layers",size:14,style:{color:"var(--node-code)"}}),r.jsx("span",{style:{fontWeight:600,fontSize:12.5},children:"By model"})]}),n.length?r.jsxs(r.Fragment,{children:[r.jsx(cp,{data:n,size:150,centerLabel:"$"+t.toFixed(0),centerSub:"in range"}),r.jsx("div",{className:"col gap-6",style:{marginTop:14,width:"100%"},children:n.map((s,l)=>r.jsxs("div",{className:"row gap-8",children:[r.jsx("span",{style:{width:9,height:9,borderRadius:3,background:la(l),flexShrink:0}}),r.jsx("span",{className:"mono grow",style:{fontSize:11.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.label}),r.jsxs("span",{className:"mono tabular",style:{fontSize:11.5},children:["$",s.cost.toFixed(1)]}),r.jsxs("span",{className:"mono tabular muted",style:{fontSize:10.5,width:38,textAlign:"right"},children:[t>0?Math.round(s.cost/t*100):0,"%"]})]},s.label))})]}):r.jsx("div",{className:"muted",style:{fontSize:12,padding:"18px 0"},children:"No model-attributed spend in this range."})]})}function Ym({prompts:e}){const t=e.slice(0,8),n=Math.max(...t.map(s=>s.cost_usd),0)||1;return r.jsxs("div",{className:"card card-pad",children:[r.jsxs("div",{className:"row gap-8",style:{marginBottom:12},children:[r.jsx(N,{name:"sortAsc",size:14,style:{color:"var(--accent)"}}),r.jsx("span",{style:{fontWeight:600,fontSize:12.5},children:"Most expensive prompts"}),r.jsxs("span",{className:"muted",style:{fontSize:11},children:["· top ",t.length]})]}),t.map((s,l)=>{const o=s.input_tokens+s.output_tokens+s.cache_creation_tokens+s.cache_read_tokens,a=s.input_tokens+s.cache_creation_tokens+s.cache_read_tokens,i=a>0?s.cache_read_tokens/a:0,c=s.cost_usd/n;return r.jsxs("div",{className:"row gap-12 list-row",role:"button",tabIndex:0,onClick:()=>A("sessions",{query:{sel:s.session_id}}),onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),A("sessions",{query:{sel:s.session_id}}))},style:{padding:"9px 0",borderTop:l?"1px solid var(--border-subtle)":"none",cursor:"pointer"},children:[r.jsx("span",{className:"mono muted tabular",style:{width:16,fontSize:11},children:l+1}),r.jsxs("div",{className:"grow",style:{minWidth:0},children:[r.jsxs("div",{style:{fontSize:12.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[!!s.is_sidechain&&r.jsx(N,{name:"bot",size:11,style:{color:"var(--node-code)",marginRight:5,verticalAlign:"-1px"}}),Cl(s.text)]}),r.jsx("div",{style:{marginTop:4,maxWidth:280},children:r.jsx(Hr,{frac:c,color:c>.66?"var(--error)":"var(--accent)"})})]}),r.jsx("span",{className:"mono muted",style:{fontSize:10.5,width:84,textAlign:"right",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.model?zl(s.model):"—"}),r.jsx("span",{className:"mono tabular muted",style:{fontSize:11,width:56,textAlign:"right"},children:U(o)}),r.jsxs("span",{className:"mono tabular",style:{fontSize:11,width:40,textAlign:"right",color:Ur(i)},children:[Math.round(i*100),"%"]}),r.jsxs("span",{className:"mono tabular",style:{fontSize:13,fontWeight:600,width:52,textAlign:"right"},children:["$",s.cost_usd.toFixed(2)]})]},s.id)}),!t.length&&r.jsx("div",{className:"muted",style:{fontSize:12,padding:"10px 0"},children:"No prompt spend in this range."})]})}const xn=e=>e.toLocaleString();function Gm({project:e}){const[t,n]=z.useState("week"),s=e??"_",l=D(()=>P.status(e),[e],{cacheKey:`status:${s}`}),o=D(()=>P.claudeStats(t),[t],{cacheKey:`stats:${s}:${t}`}),a=D(()=>P.claudeCosts(t),[t],{cacheKey:`costs:${s}:${t}`}),i=D(()=>P.claudeCache(t),[t],{cacheKey:`cache:${s}:${t}`}),c=D(()=>P.claudeHeatmap(t),[t],{cacheKey:`heatmap:${s}:${t}`}),d=D(()=>P.claudeTips(),[],{cacheKey:`tips:${s}`}),u=D(()=>P.graphFull(e),[e],{cacheKey:`graphfull:${s}`});if(Vt(l.error))return r.jsx(ce,{icon:"folder",title:"No project selected",body:"Pick an indexed project from the switcher in the status strip."});const f=o.data?.sessionCount===0,m=()=>{o.reload(),a.reload(),i.reload(),c.reload(),d.reload()},g=(y,S)=>{P.setTipState(y,S).catch(()=>{}).finally(()=>d.reload())},v=l.data,p=v?v.projectPath.split("/").filter(Boolean).pop()??v.projectPath:"",w=!f&&o.data?(o.data.lastSessionCost.unpricedTokens??0)>0?" · last session unpriced ⚠":" · last session $"+o.data.lastSessionCost.value.toFixed(2):"",h=o.data?.ingest,x=!f&&h?` · ingest ${xn(h.linesParsed)}/${xn(h.linesParsed+h.linesSkipped)} parsed${h.linesSkipped>0?" ⚠":""}`:"",j=v?`${p} · ${xn(v.nodeCount)} nodes${w}${x}`:"Loading project status…";return r.jsxs("div",{className:"scroll-y",style:{flex:1,padding:18},children:[r.jsx(Pe,{icon:"dashboard",title:"Dashboard",sub:j,actions:r.jsx(Nl,{value:t,onChange:n})}),r.jsx("div",{style:{marginBottom:14},children:r.jsx(se,{state:o,label:"usage stats",minHeight:86,children:y=>r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:10},children:[r.jsx(cs,{icon:"coins",color:"var(--accent)",label:"Last session cost",value:f||(y.lastSessionCost.unpricedTokens??0)>0?"—":"$"+y.lastSessionCost.value.toFixed(2),delta:f||(y.lastSessionCost.unpricedTokens??0)>0?void 0:y.lastSessionCost.delta,deltaInvert:!0,spark:f?void 0:y.lastSessionCost.series,sparkColor:"var(--accent)",note:f?"no transcript data — enable ingest":(y.lastSessionCost.unpricedTokens??0)>0?`${xn(y.lastSessionCost.unpricedTokens)} unpriced tokens ⚠ — model has no pricing row`:void 0,onClick:()=>A("sessions")}),r.jsx(cs,{icon:"wrench",color:"var(--node-spec)",label:"Tool calls · 7d",value:f?"—":xn(y.toolCalls.value),delta:f?void 0:y.toolCalls.delta,deltaInvert:!0,spark:f?void 0:y.toolCalls.series,sparkColor:"var(--node-spec)",note:f?"no transcript data — enable ingest":void 0,onClick:()=>A("heatmap")}),r.jsx(cs,{icon:"bot",color:"var(--node-code)",label:"Subagent spend",value:f?"—":y.subagentPct.value+"%",delta:f?void 0:y.subagentPct.delta,deltaInvert:!0,spark:f?void 0:y.subagentPct.series,sparkColor:"var(--node-code)",note:f?"no transcript data — enable ingest":void 0,onClick:()=>A("heatmap")}),r.jsx(cs,{icon:"drift",color:"var(--warn)",label:"Drift queue",value:xn(y.drift.value),delta:y.drift.delta,deltaInvert:!0,sparkColor:"var(--warn)",onClick:()=>A("drift")})]})})}),r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"2fr 1fr",gap:12,marginBottom:14},children:[r.jsx(se,{state:u,label:"recent neighborhood",minHeight:340,children:y=>r.jsx(Im,{graph:y,heatFiles:c.data?.files??[]})}),r.jsx(se,{state:d,label:"tips",minHeight:340,children:y=>r.jsx(Am,{tips:y.tips,onSetState:g,noIngest:f,onIngested:m})})]}),r.jsx("div",{style:{marginBottom:14},children:r.jsx(se,{state:c,label:"tool-call heatmap",minHeight:180,children:y=>r.jsx(Bm,{files:y.files,noIngest:f,onIngested:m})})}),r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1.4fr 1fr",gap:12},children:[r.jsx(se,{state:a,label:"recent prompts",minHeight:300,children:y=>r.jsx($m,{prompts:y.topPrompts,noIngest:f,onIngested:m})}),r.jsx(se,{state:i,label:"cache analytics",minHeight:300,children:y=>r.jsx(pp,{cache:y,range:t,noIngest:f,onIngested:m})})]})]})}const qm=[{name:"bg/canvas",varName:"--bg-canvas"},{name:"bg/panel",varName:"--bg-panel"},{name:"bg/elevated",varName:"--bg-elevated"},{name:"text/primary",varName:"--text-primary"},{name:"text/secondary",varName:"--text-secondary"},{name:"text/muted",varName:"--text-muted"},{name:"accent/primary",varName:"--accent"}],Xm=[{name:"node/code",varName:"--node-code"},{name:"node/spec",varName:"--node-spec"},{name:"node/test",varName:"--node-test"},{name:"node/route",varName:"--node-route"}],Jm=[{state:"success",varName:"--success",softVar:"--success-soft"},{state:"warn",varName:"--warn",softVar:"--warn-soft"},{state:"error",varName:"--error",softVar:"--error-soft"},{state:"info",varName:"--info",softVar:"--info-soft"}],Zm=[{label:"Big number",varName:"--fs-big",sample:"$1,184.42"},{label:"Page title",varName:"--fs-title",sample:"Page title"},{label:"Body & labels",varName:"--fs-base",sample:"Body & labels — Geist"},{label:"Secondary",varName:"--fs-sm",sample:"Secondary text"},{label:"Caption / pills",varName:"--fs-xs",sample:"CAPTIONS & PILLS"},{label:"Mono",varName:"--fs-sm",sample:"validateSession()",mono:!0}],ex=[{label:"Primary",className:"btn-primary",states:["default","hover","disabled","loading"]},{label:"Secondary",className:"btn-secondary",states:["default","hover","pressed","disabled","loading"]},{label:"Ghost",className:"btn-ghost",states:["default","hover","pressed","disabled"]},{label:"Destructive",className:"btn-destructive",states:["default","hover","disabled"]}],tx={hover:"is-hover",pressed:"is-active"},nx=[{label:"Spec link states",states:["drafted","implementing","implemented","verified","drifted","broken","orphaned"]},{label:"Run states",states:["pending","running","paused","completed","failed","cancelled","skipped"]},{label:"Semantic",states:["success","warn","error","info"]}];function Yt({title:e,children:t,span:n}){return r.jsxs("div",{className:"card card-pad",style:n?{gridColumn:"1 / -1"}:void 0,children:[r.jsx("div",{className:"eyebrow",style:{marginBottom:12},children:e}),t]})}function Mc({tok:e}){return r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,minWidth:96},children:[r.jsx("div",{style:{height:40,borderRadius:8,background:`var(${e.varName})`,border:"1px solid var(--border-subtle)"}}),r.jsx("div",{style:{fontSize:11,fontWeight:500},children:e.name}),r.jsx("div",{className:"mono muted",style:{fontSize:10},children:e.varName})]})}function rx(){return r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(280px, 1fr))",gap:12},children:[r.jsx(Yt,{title:"Surfaces & text",children:r.jsx("div",{className:"row gap-10",style:{flexWrap:"wrap"},children:qm.map(e=>r.jsx(Mc,{tok:e},e.varName))})}),r.jsx(Yt,{title:"Node colors · distinct at 4px",children:r.jsx("div",{className:"row gap-10",style:{flexWrap:"wrap"},children:Xm.map(e=>r.jsx(Mc,{tok:e},e.varName))})}),r.jsx(Yt,{title:"Semantic states",children:r.jsx("div",{className:"row gap-10",style:{flexWrap:"wrap"},children:Jm.map(e=>r.jsxs("div",{style:{minWidth:96},children:[r.jsxs("div",{style:{display:"flex",gap:4},children:[r.jsx("div",{style:{flex:1,height:40,borderRadius:"8px 0 0 8px",background:`var(${e.varName})`}}),r.jsx("div",{style:{flex:1,height:40,borderRadius:"0 8px 8px 0",background:`var(${e.softVar})`}})]}),r.jsx("div",{style:{fontSize:11,fontWeight:500,marginTop:4},children:e.state}),r.jsx("div",{className:"mono muted",style:{fontSize:10},children:e.varName})]},e.varName))})}),r.jsx(Yt,{title:"Typography",children:r.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:Zm.map(e=>r.jsxs("div",{children:[r.jsx("span",{className:e.mono?"mono":void 0,style:{fontSize:`var(${e.varName})`,fontWeight:500},children:e.sample}),r.jsx("span",{className:"muted",style:{fontSize:10.5,marginLeft:8},children:e.label})]},e.label+e.sample))})}),r.jsx(Yt,{title:"Buttons · every state",children:r.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:ex.map(e=>r.jsx("div",{className:"row gap-6",style:{flexWrap:"wrap"},children:e.states.map(t=>{const n=tx[t];return r.jsxs("button",{className:`btn ${e.className} btn-sm${n?" "+n:""}`,disabled:t==="disabled"||t==="loading","aria-busy":t==="loading","aria-label":`${e.label} ${t}`,children:[e.label," · ",t]},t)})},e.className))})}),nx.map(e=>r.jsx(Yt,{title:e.label,children:r.jsx("div",{className:"row gap-8",style:{flexWrap:"wrap"},children:e.states.map(t=>r.jsx(Ue,{state:t},t))})},e.label)),r.jsx(Yt,{title:"Pills & badges",children:r.jsxs("div",{className:"row gap-8",style:{flexWrap:"wrap"},children:[r.jsx(ne,{color:"var(--accent)",bg:"var(--accent-soft)",dot:!0,children:"custom"}),r.jsx(ne,{color:"var(--node-code)",bg:"var(--node-code-soft)",children:"code"}),r.jsx(ne,{color:"var(--text-secondary)",bg:"var(--bg-elevated)",children:"neutral"})]})})]})}const sx=[4,6,5,8,7,10,9,12,11,14],lx=Array.from({length:14},(e,t)=>({day:t+1,cost:4+Math.sin(t/2)*2+t*.6})),ox=[{label:"verified",cost:12,color:"var(--success)"},{label:"implemented",cost:7,color:"var(--node-spec)"},{label:"drifted",cost:2,color:"var(--warn)"}],ax=[{label:"specship",values:{a:14,b:6}},{label:"web-ng",values:{a:9,b:3}}],ix=[{key:"a",label:"Fable",color:"var(--accent)"},{key:"b",label:"Haiku",color:"var(--node-route)"}],cx=[{name:"specship_explore",calls:42},{name:"specship_node",calls:17},{name:"specship_search",calls:9}],dx=[{key:"a",label:"server.ts",value:42,intensity:.8,sub:"42 edits"},{key:"b",label:"tools.ts",value:28,intensity:.5,sub:"28 edits"},{key:"c",label:"index.ts",value:12,intensity:.2,sub:"12 edits"},{key:"d",label:"schema.sql",value:8,intensity:.1,sub:"8 edits"}],ux=[{id:"spec",label:"REQ-DESKTOP-017",kind:"spec",x:0,y:40},{id:"fn",label:"createServer",kind:"code",x:260,y:0},{id:"test",label:"ui-build-guard",kind:"test",x:260,y:90},{id:"route",label:"/api/status",kind:"route",x:520,y:40}],px=[{from:"spec",to:"fn"},{from:"spec",to:"test"},{from:"fn",to:"route",kind:"synth"}];function fx(){const[e,t]=z.useState("week");return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"row gap-8",style:{margin:"20px 0 8px"},children:[r.jsx("div",{className:"eyebrow",children:"Chart & graph primitives"}),r.jsx(zm,{title:"Illustrative reference data — these primitives have no backend; every data screen binds to your live project."})]}),r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(300px, 1fr))",gap:12},children:[r.jsxs("div",{className:"card card-pad",children:[r.jsx("div",{className:"eyebrow",style:{marginBottom:12},children:"Segmented"}),r.jsx(Re,{options:[{value:"today",label:"Today"},{value:"week",label:"This week"},{value:"month",label:"This month"}],value:e,onChange:t,size:"sm"})]}),r.jsxs("div",{className:"card card-pad",children:[r.jsx("div",{className:"eyebrow",style:{marginBottom:12},children:"Sparkline + line"}),r.jsx(oi,{data:sx,fill:!0}),r.jsx("div",{style:{marginTop:10},children:r.jsx(ip,{series:lx,h:140})})]}),r.jsxs("div",{className:"card card-pad",children:[r.jsx("div",{className:"eyebrow",style:{marginBottom:12},children:"Donut + stacked bars"}),r.jsxs("div",{className:"row gap-16",children:[r.jsx(cp,{data:ox,centerLabel:"21",centerSub:"links"}),r.jsx("div",{className:"grow",children:r.jsx(dp,{rows:ax,segments:ix,fmt:n=>"$"+n.toFixed(0)})})]})]}),r.jsxs("div",{className:"card card-pad",children:[r.jsx("div",{className:"eyebrow",style:{marginBottom:12},children:"Bars + treemap"}),r.jsx(ai,{items:cx}),r.jsx("div",{style:{marginTop:12},children:r.jsx(ii,{items:dx,height:110})})]}),r.jsxs("div",{className:"card",style:{gridColumn:"1 / -1",overflow:"hidden"},children:[r.jsx("div",{className:"eyebrow",style:{padding:"12px 14px 0"},children:"Graph canvas"}),r.jsx("div",{style:{height:220},children:r.jsx(ci,{nodes:ux,edges:px})})]})]})]})}function hx(){return r.jsxs("div",{className:"scroll-y",style:{flex:1,padding:22},children:[r.jsx(Pe,{icon:"layers",title:"Design system",sub:"Tokens, components and states — rendered live in both themes, WCAG AA."}),["dark","light"].map(e=>r.jsxs("div",{"data-theme":e,style:{marginBottom:20,borderRadius:12,background:"var(--bg-canvas)",padding:16,border:"1px solid var(--border-subtle)"},children:[r.jsxs("div",{className:"eyebrow","data-testid":`theme-${e}`,style:{marginBottom:12,color:"var(--text-secondary)"},children:[e," theme"]}),r.jsx(rx,{})]},e)),r.jsx(fx,{})]})}const mx=["drifted","broken","orphaned"];function xx({project:e}){const t=D(()=>P.drift(e),[e]),[n,s]=z.useState(new Set);if(Vt(t.error))return r.jsx(ce,{icon:"folder",title:"No project selected",body:"Pick an indexed project from the switcher in the status strip."});const l=t.data?.links??[],o={};for(const c of l)o[c.state]=(o[c.state]??0)+1;const a=l.filter(c=>!n.has(c.state)),i=c=>s(d=>{const u=new Set(d);return u.has(c)?u.delete(c):u.add(c),u});return r.jsxs("div",{className:"col",style:{flex:1,minHeight:0},children:[r.jsx("div",{style:{padding:"16px 18px 0"},children:r.jsx(Pe,{icon:"drift",title:"Drift queue",sub:t.data?`${l.length} links need attention`:"Loading drift…"})}),r.jsxs("div",{className:"row gap-8",style:{padding:"0 18px 12px",flexWrap:"wrap"},children:[r.jsx(N,{name:"filter",size:13,style:{color:"var(--text-muted)"}}),mx.map(c=>{const d=!n.has(c),u=ue[c];return r.jsxs("button",{onClick:()=>i(c),className:"row gap-6",style:{height:26,padding:"0 10px",borderRadius:999,fontSize:11.5,fontWeight:500,cursor:"pointer",textTransform:"capitalize",border:"1px solid "+(d?"transparent":"var(--border-subtle)"),background:d?u.bg:"var(--bg-panel)",color:d?u.color:"var(--text-muted)"},children:[c,r.jsx("span",{className:"tabular",style:{opacity:.7},children:o[c]??0})]},c)})]}),t.data&&!l.length?r.jsx(ce,{icon:"check",title:"Nothing drifted",body:"Every spec link is intact — the graph matches the specs."}):r.jsx("div",{className:"scroll-y",style:{flex:1,borderTop:"1px solid var(--border-subtle)"},children:a.map((c,d)=>r.jsx(gx,{link:c},c.id!=null?String(c.id):d))})]})}function rr(e,t){return r.jsxs("div",{children:[r.jsx("div",{className:"muted",style:{fontSize:10.5},children:e}),r.jsx("div",{className:"mono",style:{fontSize:12.5,marginTop:1},children:t})]})}function gx({link:e}){const[t,n]=z.useState(!1),s=[e.targetFilePath,e.targetQualifiedName].filter(Boolean).join(":")||"—",l=e.provenance||"—",o=Ir(e.updatedAt)??"—";return r.jsxs("div",{style:{borderBottom:"1px solid var(--border-subtle)"},children:[r.jsxs("div",{className:"row gap-10 list-row",role:"button","aria-expanded":t,tabIndex:0,onClick:()=>n(!t),onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),n(!t))},style:{padding:"10px 14px",cursor:"pointer"},children:[r.jsx("div",{style:{width:92,flexShrink:0},children:r.jsx(Ue,{state:e.state})}),r.jsx("span",{className:"mono",style:{fontSize:12,color:"var(--node-spec)",flexShrink:0,width:130,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.specId}),r.jsx("span",{className:"secondary",style:{fontSize:12.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:"0 1 220px"},children:e.specTitle}),r.jsx(N,{name:"arrowRight",size:13,style:{color:"var(--text-muted)",flexShrink:0}}),r.jsx("span",{className:"mono grow",style:{fontSize:11.5,color:"var(--text-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s}),e.driftAxis&&r.jsx(ne,{color:"var(--warn)",bg:"var(--warn-soft)",children:e.driftAxis}),r.jsx("span",{className:"mono muted",style:{fontSize:11,flexShrink:0,maxWidth:96,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",textAlign:"right"},children:e.provenance||""}),r.jsx("span",{className:"mono muted tabular",style:{fontSize:11,flexShrink:0,width:32,textAlign:"right"},children:o}),r.jsx(N,{name:t?"chevronDown":"chevronRight",size:13,style:{color:"var(--text-muted)",flexShrink:0}})]}),t&&r.jsxs("div",{style:{padding:"0 14px 14px 36px",background:"var(--bg-canvas)"},children:[r.jsxs("div",{className:"row",style:{gap:22,padding:"10px 0",flexWrap:"wrap"},children:[rr("Spec",e.specId),rr("Target",s),rr("Provenance",l),rr("Drift axis",e.driftAxis??"—"),rr("Age",o)]}),r.jsxs("div",{className:"row gap-8",children:[e.state==="drifted"&&r.jsxs("button",{className:"btn btn-primary btn-sm",disabled:!0,title:"Run automatically by the drift-repair workflow — fixes are workflow-owned",children:[r.jsx(N,{name:"wrench",size:12}),"Fix"]}),e.state==="broken"&&r.jsxs("button",{className:"btn btn-primary btn-sm",disabled:!0,title:"Run automatically by the verification workflow",children:[r.jsx(N,{name:"refresh",size:12}),"Re-verify"]}),e.state==="orphaned"&&r.jsxs("button",{className:"btn btn-primary btn-sm",disabled:!0,title:"Run automatically by the relink workflow — re-attach is workflow-owned",children:[r.jsx(N,{name:"graph",size:12}),"Re-attach"]}),r.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>A("specs",{query:{sel:e.specId}}),children:"Open spec"}),r.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>A("graph",{query:{focus:"spec:"+e.specId}}),children:"Show in graph"})]})]})]})}const oa={height:"100%",display:"flex",flexDirection:"column"},aa={gap:8,padding:"13px 14px",borderBottom:"1px solid var(--border-subtle)"},fp={flex:1,padding:14,display:"flex",flexDirection:"column",gap:16},_n={overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function rl({onClick:e,children:t,bordered:n}){return r.jsx("div",{onClick:e,role:e?"button":void 0,tabIndex:e?0:void 0,onKeyDown:e?s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),e())}:void 0,className:"row gap-8"+(e?" list-row":""),style:{padding:n?"6px 8px":"5px 8px",borderRadius:6,cursor:e?"pointer":"default",fontSize:12,border:n?"1px solid var(--border-subtle)":"none",marginBottom:n?5:0},children:t})}function Ct({children:e}){return r.jsx("div",{className:"eyebrow",style:{marginBottom:6},children:e})}function Rc({n:e,onSelect:t}){const n=Vr(e.kind,e.filePath);return r.jsxs(rl,{onClick:()=>t(e.id),children:[r.jsx("span",{style:{width:7,height:7,borderRadius:n==="spec"?2:"50%",background:$t(n),flexShrink:0}}),r.jsx("span",{className:"mono grow",style:{fontSize:12,..._n},children:e.name}),r.jsxs("span",{className:"mono tabular muted",style:{fontSize:10.5},children:[e.degree," edges"]}),r.jsx(N,{name:"chevronRight",size:12,style:{color:"var(--text-faint)"}})]})}function ps({color:e,label:t,count:n,dashed:s}){return r.jsxs("div",{className:"row gap-8",style:{padding:"4px 0"},children:[r.jsx("svg",{width:20,height:8,style:{flexShrink:0},children:r.jsx("line",{x1:0,y1:4,x2:20,y2:4,stroke:e,strokeWidth:1.8,strokeDasharray:s?"4 3":"none"})}),r.jsx("span",{className:"grow secondary",style:{fontSize:12},children:t}),n!=null&&r.jsx("span",{className:"mono tabular muted",style:{fontSize:11},children:n})]})}const vx=[{kind:"code",label:"Code"},{kind:"spec",label:"Spec"},{kind:"test",label:"Test"},{kind:"route",label:"Route"}],Pc=["verified","drifted","broken"];function yx({project:e,counts:t,shown:n,onSelect:s}){const l=D(()=>P.graphHealth(e),[e]),o=l.data?.linkHealth??{},a=l.data?.edgeKinds??{},i={verified:o.verified??0,drifted:o.drifted??0,broken:(o.broken??0)+(o.orphaned??0)},c=Pc.some(d=>i[d]>0);return r.jsxs("div",{style:oa,children:[r.jsxs("div",{className:"row",style:aa,children:[r.jsx(N,{name:"graph",size:15,style:{color:"var(--accent)"}}),r.jsx("span",{style:{fontWeight:600,fontSize:13.5},children:"Graph overview"}),r.jsx("span",{className:"grow"}),r.jsxs("span",{className:"mono muted",style:{fontSize:11},children:[n," shown"]})]}),r.jsxs("div",{className:"scroll-y",style:fp,children:[r.jsx("div",{className:"secondary",style:{fontSize:12,lineHeight:1.55},children:"Click any node to inspect its signature, links, callers and callees — without leaving this view."}),r.jsxs("div",{children:[r.jsx(Ct,{children:"Nodes by kind"}),vx.filter(d=>t[d.kind]).map(d=>r.jsxs("div",{className:"row gap-8",style:{padding:"5px 0"},children:[r.jsx("span",{style:{width:9,height:9,borderRadius:d.kind==="spec"?2:"50%",background:$t(d.kind),flexShrink:0,boxShadow:`0 0 6px ${$t(d.kind)}`}}),r.jsx("span",{className:"grow",style:{fontSize:12.5},children:d.label}),r.jsx("span",{className:"mono tabular",style:{fontSize:12.5,fontWeight:600},children:t[d.kind]})]},d.kind))]}),r.jsxs("div",{children:[r.jsx(Ct,{children:"Spec link health"}),c?r.jsx("div",{className:"row gap-6",style:{flexWrap:"wrap"},children:Pc.filter(d=>i[d]>0).map(d=>r.jsxs("span",{className:"row gap-6",children:[r.jsx(Ue,{state:d}),r.jsx("span",{className:"mono tabular muted",style:{fontSize:11,alignSelf:"center"},children:i[d]})]},d))}):r.jsx("div",{className:"muted",style:{fontSize:12},children:"No spec links yet"})]}),r.jsxs("div",{children:[r.jsx(Ct,{children:"Edge types"}),r.jsx(ps,{color:"var(--text-muted)",label:"calls",count:a.calls??0}),r.jsx(ps,{color:"var(--node-spec)",label:"implements / documents",count:a.implements??0}),r.jsx(ps,{color:"var(--node-test)",label:"tests",count:a.tests??0}),r.jsx(ps,{color:"var(--text-muted)",label:"synthesized (heuristic)",count:a.synth??0,dashed:!0})]}),r.jsxs("div",{children:[r.jsx(Ct,{children:"Most connected"}),(l.data?.hubs??[]).map(d=>r.jsx(Rc,{n:d,onSelect:s},d.id)),l.data&&!l.data.hubs.length&&r.jsx("div",{className:"muted",style:{fontSize:12,padding:"4px 8px"},children:"No connected nodes yet"})]}),r.jsxs("div",{children:[r.jsx(Ct,{children:"Anchored"}),(l.data?.anchored??[]).map(d=>r.jsx(Rc,{n:d,onSelect:s},d.id)),l.data&&!l.data.anchored.length&&r.jsx("div",{className:"muted",style:{fontSize:12,padding:"4px 8px"},children:"No spec-linked code yet"})]})]})]})}function Lc({title:e,items:t,empty:n,onSelect:s}){return r.jsxs("div",{children:[r.jsxs("div",{className:"eyebrow",style:{marginBottom:4},children:[e,r.jsx("span",{className:"muted",style:{marginLeft:6,fontWeight:400},children:t.length})]}),t.length?t.slice(0,10).map(l=>r.jsxs(rl,{onClick:()=>s(l.id),children:[r.jsx(N,{name:"box",size:12,style:{color:$t(Vr(l.kind,l.filePath)),flexShrink:0}}),r.jsx("span",{className:"mono grow",style:_n,children:l.name}),r.jsx("span",{className:"mono muted",style:{fontSize:10,flexShrink:0},children:l.filePath.split("/").pop()})]},l.id)):r.jsx("div",{className:"muted",style:{fontSize:12,padding:"4px 8px"},children:n})]})}function jx({id:e,project:t,onSelect:n,onClose:s}){const l=D(()=>P.graphNode(e,t),[e,t]),o=l.data?.matches[0];if(!o)return r.jsxs("div",{style:oa,children:[r.jsxs("div",{className:"row",style:aa,children:[r.jsx("span",{className:"grow",style:{fontWeight:600,fontSize:13.5},children:"Node"}),r.jsx("button",{className:"btn btn-ghost btn-xs","aria-label":"Close node detail",onClick:s,children:r.jsx(N,{name:"x",size:14})})]}),r.jsx("div",{className:"muted",style:{padding:14,fontSize:12},children:l.loading?"Loading node…":"Node not found — it may have been re-indexed away."})]});const a=Vr(o.kind,o.filePath),i=a==="spec"||o.kind==="spec",c=$t(a);return r.jsxs("div",{style:oa,children:[r.jsxs("div",{className:"row",style:{...aa,padding:"12px 14px"},children:[r.jsx("span",{style:{width:9,height:9,borderRadius:i?2:"50%",background:c,flexShrink:0,marginTop:5,boxShadow:`0 0 8px ${c}`,alignSelf:"flex-start"}}),r.jsxs("div",{className:"grow",style:{minWidth:0},children:[r.jsx("div",{className:"mono",style:{fontSize:14,fontWeight:600,..._n},children:o.name}),r.jsx("div",{className:"row gap-6",style:{marginTop:3},children:r.jsx(ne,{color:c,bg:`color-mix(in srgb, ${c} 14%, transparent)`,children:o.kind})})]}),r.jsx("button",{className:"btn btn-ghost btn-xs","aria-label":"Close node detail",onClick:s,children:r.jsx(N,{name:"x",size:14})})]}),r.jsxs("div",{className:"scroll-y",style:fp,children:[r.jsxs("div",{className:"row gap-6",style:{fontSize:11.5},children:[r.jsx(N,{name:"folder",size:12,style:{color:"var(--text-muted)"}}),r.jsx("span",{className:"mono secondary",style:_n,children:o.filePath}),r.jsx(dt,{text:o.filePath,ariaLabel:"Copy file path"})]}),!i&&o.signature&&r.jsxs("div",{children:[r.jsx(Ct,{children:"Signature"}),r.jsx("pre",{className:"mono",style:{margin:0,fontSize:11.5,lineHeight:1.6,color:"var(--text-secondary)",background:"var(--bg-canvas)",border:"1px solid var(--border-subtle)",borderRadius:7,padding:10,overflowX:"auto",whiteSpace:"pre-wrap"},children:o.signature})]}),!i&&r.jsxs("div",{children:[r.jsx(Ct,{children:"Linked specs"}),o.linkedSpecs.length?o.linkedSpecs.map((d,u)=>r.jsxs(rl,{bordered:!0,onClick:()=>A("specs",{param:d.specId}),children:[r.jsx("span",{className:"mono grow",style:{fontSize:11.5,..._n},children:d.specId}),r.jsx(Ue,{state:d.state})]},u)):r.jsx("div",{className:"muted",style:{fontSize:12,padding:"4px 8px"},children:"No linked specs"})]}),!i&&r.jsx(Lc,{title:"Callers",items:o.callers,empty:"No callers",onSelect:n}),!i&&r.jsx(Lc,{title:"Callees",items:o.callees,empty:"No callees",onSelect:n}),i&&r.jsxs("div",{children:[r.jsx(Ct,{children:"Linked code"}),o.linkedSpecs.length?o.linkedSpecs.map((d,u)=>r.jsxs(rl,{bordered:!0,children:[r.jsx(Ue,{state:d.state}),r.jsx("span",{className:"mono grow",style:{fontSize:11,..._n},children:d.targetQualifiedName??d.targetFilePath})]},u)):r.jsx("div",{className:"muted",style:{fontSize:12,padding:8,border:"1px dashed var(--border-subtle)",borderRadius:6,textAlign:"center"},children:"No linked code — orphaned"})]})]}),r.jsxs("div",{className:"row gap-8",style:{padding:12,borderTop:"1px solid var(--border-subtle)"},children:[r.jsxs("button",{className:"btn btn-primary btn-sm grow",style:{justifyContent:"center"},disabled:!0,title:"Run automatically by the implementation workflow once Drafted",children:[r.jsx(N,{name:"play",size:13}),"Implement"]}),r.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>A("drift"),children:"View drift"})]})]})}function Dc({label:e,count:t,active:n,onClick:s,color:l}){return r.jsxs("button",{onClick:s,className:"row gap-6",style:{height:26,padding:"0 10px",borderRadius:999,fontSize:11.5,fontWeight:500,cursor:"pointer",border:"1px solid "+(n?"transparent":"var(--border-subtle)"),background:n?l?`color-mix(in srgb, ${l} 22%, var(--bg-panel))`:"var(--accent-soft)":"var(--bg-panel)",color:n?l||"var(--accent)":"var(--text-secondary)",transition:"background var(--motion-fast), color var(--motion-fast), border-color var(--motion-fast)"},children:[l&&r.jsx("span",{style:{width:7,height:7,borderRadius:"50%",background:l}}),e,t!=null&&r.jsx("span",{className:"tabular muted",style:{fontSize:10.5},children:t})]})}const wx=[{kind:"code",label:"Code"},{kind:"spec",label:"Spec"},{kind:"test",label:"Test"},{kind:"route",label:"Route"}],Sx=[{key:"calls",label:"calls"},{key:"implements",label:"implements"},{key:"tests",label:"tests"},{key:"synth",label:"synth"}];function kx({project:e,query:t}){const n=D(()=>P.graphFull(e),[e]),s=t.focus??null,[l,o]=z.useState(s),[a,i]=z.useState("hierarchical"),[c,d]=z.useState(new Set),[u,f]=z.useState(new Set),[m,g]=z.useState(0);z.useEffect(()=>{s&&o(s)},[s]);const v=z.useMemo(()=>[...n.data?.nodes??[]].sort((y,S)=>S.degree-y.degree),[n.data]),p=z.useMemo(()=>(n.data?.edges??[]).map(y=>({from:y.from,to:y.to,kind:y.provenance==="heuristic"?"synth":y.kind})),[n.data]),w=z.useMemo(()=>a==="force"?_m(v,p):Mm(v,p),[v,p,a]),h=z.useMemo(()=>{const y={};return w.forEach(S=>{y[S.kind]=(y[S.kind]??0)+1}),y},[w]),x=z.useMemo(()=>{const y=new Set;return c.size&&w.forEach(S=>{c.has(S.kind)&&y.add(S.id)}),y},[w,c]),j=(y,S,b)=>{const C=new Set(y);C.has(S)?C.delete(S):C.add(S),b(C)};return Vt(n.error)?r.jsx(ce,{icon:"folder",title:"No project selected",body:"Pick an indexed project from the switcher in the status strip."}):r.jsxs("div",{style:{flex:1,minHeight:0,display:"flex"},children:[r.jsxs("div",{className:"col",style:{flex:1,minWidth:0,display:"flex",flexDirection:"column"},children:[r.jsxs("div",{className:"row",style:{gap:10,padding:"9px 14px",borderBottom:"1px solid var(--border-subtle)",background:"var(--bg-panel-2)",flexWrap:"wrap"},children:[r.jsx(Re,{size:"sm",value:a,onChange:y=>{i(y),g(S=>S+1)},options:[{value:"hierarchical",label:"Hierarchical"},{value:"force",label:"Force"}],label:"Graph layout"}),r.jsx("div",{style:{width:1,height:20,background:"var(--border-subtle)"}}),wx.filter(y=>h[y.kind]).map(y=>r.jsx(Dc,{label:y.label,count:h[y.kind],color:$t(y.kind),active:!c.has(y.kind),onClick:()=>j(c,y.kind,d)},y.kind)),r.jsx("div",{style:{width:1,height:20,background:"var(--border-subtle)"}}),Sx.map(y=>r.jsx(Dc,{label:y.label,active:!u.has(y.key),onClick:()=>j(u,y.key,f)},y.key)),r.jsx("div",{className:"grow"}),r.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:()=>g(y=>y+1),children:[r.jsx(N,{name:"recenter",size:13}),"Recenter"]})]}),r.jsxs("div",{style:{flex:1,minHeight:0,position:"relative"},children:[w.length>0&&r.jsx(ci,{nodes:w,edges:p,selectedId:l,onSelect:o,hiddenIds:x,hiddenEdgeKinds:u,fitKey:m,focusId:s}),n.data&&!w.length&&r.jsx(ce,{icon:"graph",title:"Nothing indexed yet",body:"Run specship index to populate the graph."})]})]}),r.jsx("div",{style:{width:360,flexShrink:0,borderLeft:"1px solid var(--border-subtle)",background:"var(--bg-panel)",minHeight:0},children:l?r.jsx(jx,{id:l,project:e,onSelect:o,onClose:()=>o(null)}):r.jsx(yx,{project:e,counts:h,shown:n.data?.shown??0,onSelect:o})})]})}const Ic=e=>e.split("/").filter(Boolean).slice(-2).join("/");function bx(e){const[t,n]=z.useState("week"),[s,l]=z.useState("calls"),[o,a]=z.useState(null),i=D(()=>P.claudeStats(),[]),c=D(()=>P.claudeHeatmap(t),[t]),d=i.data?.sessionCount===0,u=()=>{i.reload(),c.reload()},f=(m,g)=>a(v=>v&&v.type===m&&v.key===g?null:{type:m,key:g});return d?r.jsxs("div",{className:"scroll-y",style:{flex:1,padding:18},children:[r.jsx(Pe,{icon:"heatmap",title:"Heatmap",sub:"Where tool calls land — files, tools, subagents"}),r.jsx(Un,{onIngested:u})]}):r.jsxs("div",{style:{flex:1,display:"flex",minHeight:0},children:[r.jsxs("div",{className:"scroll-y",style:{flex:1,padding:18,minWidth:0},children:[r.jsx(Pe,{icon:"heatmap",title:"Heatmap",sub:"Where tool calls land — files, tools, subagents",actions:r.jsx(Nl,{value:t,onChange:n})}),r.jsx(se,{state:c,label:"heatmap",minHeight:320,children:m=>r.jsx(Nx,{h:m,range:t,metric:s,onMetric:l,sel:o,pick:f})})]}),o?.type==="file"&&r.jsx("div",{style:oo,children:r.jsx(Cx,{path:o.key,range:t,files:c.data?.files??[],onClose:()=>a(null)})}),o?.type==="tool"&&r.jsx("div",{style:oo,children:r.jsx(Ex,{name:o.key,range:t,onClose:()=>a(null)})}),o?.type==="subagent"&&r.jsx("div",{style:oo,children:r.jsx(Tx,{type:o.key,range:t,onClose:()=>a(null)})})]})}function Nx({h:e,range:t,metric:n,onMetric:s,sel:l,pick:o}){const a=e.tools.reduce((p,w)=>p+w.calls,0),i=e.tools.reduce((p,w)=>p+(w.resultBytes??0),0);if(!a)return r.jsx("div",{className:"muted",style:{fontSize:12,padding:"14px 4px"},children:"No tool calls in this range."});const c=[...e.files].sort((p,w)=>w.calls-p.calls)[0],d=[...e.tools].sort((p,w)=>(w.resultBytes??0)-(p.resultBytes??0))[0],u=[...e.tools].sort((p,w)=>(w.resultBytes??0)-(p.resultBytes??0)),f=Math.max(...e.tools.map(p=>p.resultBytes??0),0)||1,m=e.files.map(p=>{const w=p.resultBytes??0;return{...p,tokens:w,tpc:p.calls>0?w/p.calls:0}}),g=Math.max(...m.map(p=>p.tpc),0)||1,v=m.map(p=>({key:p.path,label:Ic(p.path),value:n==="tokens"?p.tokens:p.calls,intensity:p.tpc/g,sub:n==="tokens"?U(p.tokens):p.calls+" calls",title:`${p.path}
42
- ${p.calls} calls · ${U(p.tokens)} result tokens · ${U(Math.round(p.tpc))}/call`}));return r.jsxs(r.Fragment,{children:[r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:10,marginBottom:14},children:[r.jsx(fs,{label:"Tool calls",value:a.toLocaleString(),icon:"wrench",color:"var(--node-spec)",sub:"this "+t}),r.jsx(fs,{label:"Result tokens",value:U(i),icon:"database",color:"var(--node-route)",sub:"returned to context"}),r.jsx(fs,{label:"Busiest file",value:c?Ic(c.path):"—",icon:"box",color:"var(--warn)",sub:c?c.calls+" calls":""}),r.jsx(fs,{label:"Heaviest tool",value:d?.name??"—",icon:"flame",color:"var(--error)",sub:d?U(d.resultBytes??0)+" tokens":""})]}),r.jsxs("div",{className:"card card-pad",style:{marginBottom:14},children:[r.jsxs("div",{className:"row gap-8",style:{marginBottom:12},children:[r.jsx(N,{name:"box",size:14,style:{color:"var(--warn)"}}),r.jsx("span",{style:{fontWeight:600,fontSize:12.5},children:"Files"}),r.jsxs("span",{className:"muted",style:{fontSize:11},children:["· area = ",n==="tokens"?"result tokens":"tool calls",", color = tokens / call"]}),r.jsx("div",{className:"grow"}),r.jsx(Re,{size:"sm",label:"Treemap metric",value:n,onChange:s,options:[{value:"calls",label:"Calls"},{value:"tokens",label:"Tokens"}]})]}),v.length?r.jsx(ii,{items:v,height:268,selKey:l?.type==="file"?l.key:null,onPick:p=>o("file",p.key)}):r.jsx("div",{className:"muted",style:{fontSize:12,padding:"14px 4px"},children:"No file-touching tool calls in this range."}),r.jsxs("div",{className:"row gap-12",style:{marginTop:10,alignItems:"center"},children:[r.jsx("span",{className:"muted",style:{fontSize:10.5},children:"tokens / call"}),r.jsx("div",{style:{width:120,height:7,borderRadius:999,overflow:"hidden",background:"linear-gradient(90deg, var(--node-route), var(--warn), var(--error))"}}),r.jsx("span",{className:"muted",style:{fontSize:10},children:"efficient → wasteful"}),r.jsx("div",{className:"grow"}),r.jsx("span",{className:"muted",style:{fontSize:10.5},children:"click a tile to drill in"})]})]}),r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:14},children:[r.jsxs("div",{className:"card card-pad",children:[r.jsxs("div",{className:"row gap-8",style:{marginBottom:4},children:[r.jsx(N,{name:"wrench",size:14,style:{color:"var(--node-code)"}}),r.jsx("span",{style:{fontWeight:600,fontSize:12.5},children:"Tools"}),r.jsx("span",{className:"muted",style:{fontSize:11},children:"· by result tokens, ranked"})]}),r.jsxs("div",{className:"row",style:{padding:"8px 0 4px",fontSize:9.5,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.05em",fontWeight:600},children:[r.jsx("span",{style:{width:116},children:"Tool"}),r.jsx("span",{className:"grow",children:"Result tokens"}),r.jsx("span",{style:{width:36,textAlign:"right"},children:"Calls"}),r.jsx("span",{style:{width:64,textAlign:"right"},children:"Per call"}),r.jsx("span",{style:{width:48,textAlign:"right"},children:"Total"}),r.jsx("span",{style:{width:14}})]}),r.jsx("div",{className:"col gap-2",children:u.map(p=>r.jsx(zx,{name:p.name,calls:p.calls,tokens:p.resultBytes??0,maxTok:f,selected:l?.type==="tool"&&l.key===p.name,onClick:()=>o("tool",p.name)},p.name))}),r.jsxs("div",{className:"muted",style:{fontSize:10.5,marginTop:10,display:"flex",gap:12},children:[r.jsx(lo,{color:"var(--error)",label:">20k / call"}),r.jsx(lo,{color:"var(--warn)",label:">8k"}),r.jsx(lo,{color:"var(--success)",label:"lean"})]})]}),r.jsxs("div",{className:"card card-pad",children:[r.jsxs("div",{className:"row gap-8",style:{marginBottom:14},children:[r.jsx(N,{name:"bot",size:14,style:{color:"var(--node-route)"}}),r.jsx("span",{style:{fontWeight:600,fontSize:12.5},children:"Subagents"}),r.jsx("span",{className:"muted",style:{fontSize:11},children:"· Task calls by subagent_type"})]}),e.subagentByName.length?r.jsx(ai,{items:e.subagentByName,valueKey:"calls",labelKey:"name",color:"var(--node-route)",onItemClick:p=>o("subagent",String(p.name)),selectedKey:l?.type==="subagent"?l.key:null}):r.jsx("div",{className:"muted",style:{fontSize:12},children:"No subagent invocations in this range."})]})]})]})}function fs({label:e,value:t,icon:n,color:s,sub:l}){return r.jsxs("div",{className:"card",style:{padding:"10px 13px",display:"flex",flexDirection:"column",gap:3},children:[r.jsxs("div",{className:"row gap-6",style:{color:"var(--text-muted)",whiteSpace:"nowrap"},children:[r.jsx(N,{name:n,size:12,style:{color:s,flexShrink:0}}),r.jsx("span",{className:"eyebrow",style:{letterSpacing:"0.03em",overflow:"hidden",textOverflow:"ellipsis"},children:e})]}),r.jsx("div",{className:"mono tabular",style:{fontSize:18,fontWeight:650,letterSpacing:"-0.01em",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t}),l&&r.jsx("div",{className:"mono muted",style:{fontSize:10,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l})]})}function zx({name:e,calls:t,tokens:n,maxTok:s,selected:l,onClick:o}){const a=n/Math.max(1,t),i=a>2e4?"var(--error)":a>8e3?"var(--warn)":"var(--success)";return r.jsxs("div",{onClick:o,role:"button",tabIndex:0,onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),o())},className:"row gap-8 list-row",style:{padding:"6px 8px",margin:"0 -8px",borderRadius:6,cursor:"pointer",background:l?"var(--accent-soft)":void 0},children:[r.jsx("span",{className:"mono",style:{width:116,flexShrink:0,fontSize:11.5,color:l?"var(--accent)":"var(--text-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e}),r.jsx("div",{className:"grow",style:{height:16,background:"var(--bg-hover)",borderRadius:4,overflow:"hidden"},children:r.jsx("div",{style:{width:n/s*100+"%",height:"100%",background:i,borderRadius:4}})}),r.jsxs("span",{className:"mono tabular muted",style:{width:36,textAlign:"right",fontSize:10.5,flexShrink:0},children:["×",t]}),r.jsxs("span",{className:"mono tabular",style:{width:64,textAlign:"right",fontSize:10.5,color:i,flexShrink:0},children:[U(Math.round(a)),"/call"]}),r.jsx("span",{className:"mono tabular",style:{width:48,textAlign:"right",fontSize:11.5,fontWeight:600,flexShrink:0},children:U(n)}),r.jsx(N,{name:"chevronRight",size:12,style:{color:"var(--text-faint)",flexShrink:0}})]})}function lo({color:e,label:t}){return r.jsxs("span",{className:"row gap-4",children:[r.jsx("span",{style:{width:8,height:8,borderRadius:2,background:e}}),t]})}const oo={width:360,flexShrink:0,borderLeft:"1px solid var(--border-subtle)",background:"var(--bg-panel)",overflow:"hidden",display:"flex",flexDirection:"column",height:"100%"};function ui({icon:e,color:t,title:n,copy:s,onClose:l}){return r.jsxs("div",{className:"row gap-8",style:{padding:"12px 14px",borderBottom:"1px solid var(--border-subtle)",flexShrink:0},children:[r.jsx(N,{name:e,size:14,style:{color:t,flexShrink:0}}),r.jsx("span",{className:"mono grow",style:{fontSize:13,fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n}),s&&r.jsx(dt,{text:s}),r.jsx("button",{className:"btn btn-ghost btn-xs",onClick:l,"aria-label":"Close drill-down",children:r.jsx(N,{name:"x",size:14})})]})}function hp({id:e,meta:t}){return r.jsxs("div",{onClick:()=>A("sessions",{query:{sel:e}}),role:"button",tabIndex:0,onKeyDown:n=>{(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),A("sessions",{query:{sel:e}}))},className:"row gap-8 list-row",style:{padding:"7px 9px",borderRadius:7,border:"1px solid var(--border-subtle)",cursor:"pointer"},children:[r.jsx("span",{className:"mono",style:{fontSize:11.5,flexShrink:0},children:e.slice(0,8)}),r.jsx("span",{className:"muted grow",style:{fontSize:10.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t}),r.jsx(N,{name:"chevronRight",size:12,style:{color:"var(--text-muted)",flexShrink:0}})]})}function pi({state:e,children:t}){return r.jsx("div",{className:"scroll-y",style:{flex:1,padding:14},children:r.jsx(se,{state:e,label:"drill-down",minHeight:120,children:t})})}function Cx({path:e,range:t,files:n,onClose:s}){const l=D(()=>P.claudeHeatmapFile(e,t),[e,t]),o=n.find(a=>a.path===e);return r.jsxs("div",{className:"col",style:{height:"100%"},children:[r.jsx(ui,{icon:"box",color:"var(--warn)",title:e,copy:e,onClose:s}),r.jsx(pi,{state:l,children:a=>{const i=a.byTool.reduce((d,u)=>d+u.bytes,0)||1,c=a.byTool.find(d=>d.bytes>4e4);return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"row",style:{gap:20,marginBottom:16},children:[r.jsxs("div",{children:[r.jsx("div",{className:"muted",style:{fontSize:10.5},children:"Tool calls"}),r.jsx("div",{className:"tabular",style:{fontSize:26,fontWeight:700,lineHeight:1},children:o?.calls??a.byTool.reduce((d,u)=>d+u.calls,0)})]}),o&&o.trend.some(d=>d>0)&&r.jsxs("div",{className:"grow",children:[r.jsx("div",{className:"muted",style:{fontSize:10.5,marginBottom:4},children:"7-day trend"}),r.jsx(oi,{data:o.trend,color:"var(--warn)",fill:!0,w:150,h:30})]})]}),c&&r.jsxs("div",{style:{background:"var(--warn-soft)",border:"1px solid rgba(229,165,10,0.25)",borderRadius:8,padding:"9px 11px",marginBottom:16,display:"flex",gap:9},children:[r.jsx(N,{name:"flame",size:14,style:{color:"var(--warn)",flexShrink:0,marginTop:1}}),r.jsxs("div",{style:{fontSize:11.5,lineHeight:1.5},children:[r.jsx("span",{className:"mono",style:{color:"var(--warn)"},children:c.name})," returned ",r.jsx("span",{className:"mono",children:U(c.bytes)})," tokens here. A structural query would cover it in a fraction."]})]}),r.jsx("div",{className:"eyebrow",style:{marginBottom:8},children:"Tool breakdown"}),r.jsxs("div",{className:"col gap-8",style:{marginBottom:18},children:[a.byTool.map(d=>r.jsxs("div",{className:"row gap-10",children:[r.jsx("span",{className:"mono",style:{fontSize:11.5,width:92,flexShrink:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.name}),r.jsx("div",{className:"grow",children:r.jsx(Hr,{frac:d.bytes/i,color:d.bytes>4e4?"var(--error)":d.bytes>12e3?"var(--warn)":"var(--node-code)"})}),r.jsxs("span",{className:"mono tabular muted",style:{fontSize:10.5,width:22,textAlign:"right"},children:["×",d.calls]}),r.jsx("span",{className:"mono tabular",style:{fontSize:10.5,width:44,textAlign:"right"},children:U(d.bytes)})]},d.name)),r.jsx("div",{className:"muted",style:{fontSize:10},children:"bar = result tokens · × = call count"})]}),r.jsxs("div",{className:"eyebrow",style:{marginBottom:8},children:["Touched in ",a.sessions.length," session",a.sessions.length===1?"":"s"]}),r.jsx("div",{className:"col gap-6",children:a.sessions.map(d=>r.jsx(hp,{id:d.session_id,meta:`${d.calls} calls · ${U(d.bytes)} tokens${d.last_model?" · "+d.last_model:""}`},d.session_id))})]})}})]})}function Ex({name:e,range:t,onClose:n}){const s=D(()=>P.claudeHeatmapTool(e,t),[e,t]);return r.jsxs("div",{className:"col",style:{height:"100%"},children:[r.jsx(ui,{icon:"wrench",color:"var(--node-code)",title:e,copy:e,onClose:n}),r.jsx(pi,{state:s,children:l=>{const o=l.totals.calls>0?Math.round(l.totals.bytes/l.totals.calls):0,a=Math.max(...l.inputs.map(i=>i.bytes),0)||1;return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"row",style:{gap:16,marginBottom:16},children:[r.jsxs("div",{children:[r.jsx("div",{className:"muted",style:{fontSize:10.5},children:"Calls"}),r.jsx("div",{className:"tabular",style:{fontSize:24,fontWeight:700,lineHeight:1},children:l.totals.calls})]}),r.jsxs("div",{children:[r.jsx("div",{className:"muted",style:{fontSize:10.5},children:"Result tokens"}),r.jsx("div",{className:"tabular",style:{fontSize:24,fontWeight:700,lineHeight:1,color:l.totals.bytes>1e6?"var(--error)":"var(--text-primary)"},children:U(l.totals.bytes)})]}),r.jsxs("div",{children:[r.jsx("div",{className:"muted",style:{fontSize:10.5},children:"Sessions"}),r.jsx("div",{className:"tabular",style:{fontSize:24,fontWeight:700,lineHeight:1},children:l.totals.sessions})]})]}),r.jsxs("div",{className:"row gap-8",style:{marginBottom:16},children:[r.jsx("span",{className:"muted",style:{fontSize:11},children:"avg per call"}),r.jsxs("span",{className:"mono tabular",style:{fontSize:12,color:o>3e4?"var(--error)":o>8e3?"var(--warn)":"var(--text-secondary)"},children:[U(o)," tokens"]})]}),r.jsx("div",{className:"eyebrow",style:{marginBottom:8},children:"Top inputs"}),r.jsxs("div",{className:"col gap-7",style:{marginBottom:18},children:[l.inputs.slice(0,8).map(i=>r.jsxs("div",{className:"row gap-8",children:[r.jsx("span",{className:"mono",style:{fontSize:11,width:150,flexShrink:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"var(--text-secondary)"},title:i.input,children:i.input}),r.jsx("div",{className:"grow",children:r.jsx(Hr,{frac:i.bytes/a,color:i.bytes>4e4?"var(--error)":"var(--node-code)"})}),r.jsxs("span",{className:"mono tabular muted",style:{fontSize:10,width:20,textAlign:"right"},children:["×",i.calls]}),r.jsx("span",{className:"mono tabular",style:{fontSize:10,width:40,textAlign:"right"},children:U(i.bytes)})]},i.input)),!l.inputs.length&&r.jsx("div",{className:"muted",style:{fontSize:11.5},children:"No recorded inputs."})]}),r.jsxs("div",{className:"eyebrow",style:{marginBottom:8},children:["Used in ",l.totals.sessions," session",l.totals.sessions===1?"":"s"]}),r.jsx("div",{className:"col gap-6",children:l.recentSessions.map(i=>r.jsx(hp,{id:i.session_id,meta:`${i.calls} calls${i.last_model?" · "+i.last_model:""}`},i.session_id))})]})}})]})}function Tx({type:e,range:t,onClose:n}){const s=D(()=>P.claudeHeatmapSubagent(e,t),[e,t]);return r.jsxs("div",{className:"col",style:{height:"100%"},children:[r.jsx(ui,{icon:"bot",color:"var(--node-route)",title:e,copy:e,onClose:n}),r.jsx(pi,{state:s,children:l=>r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"row",style:{gap:16,marginBottom:16},children:[r.jsxs("div",{children:[r.jsx("div",{className:"muted",style:{fontSize:10.5},children:"Invocations"}),r.jsx("div",{className:"tabular",style:{fontSize:22,fontWeight:700,lineHeight:1},children:l.totals.calls})]}),r.jsxs("div",{children:[r.jsx("div",{className:"muted",style:{fontSize:10.5},children:"Sessions"}),r.jsx("div",{className:"tabular",style:{fontSize:22,fontWeight:700,lineHeight:1},children:l.totals.sessions})]})]}),r.jsx("div",{className:"eyebrow",style:{marginBottom:8},children:"Recent invocations"}),r.jsxs("div",{className:"col gap-6",style:{marginBottom:16},children:[l.invocations.slice(0,12).map((o,a)=>r.jsxs("div",{style:{border:"1px solid var(--border-subtle)",borderRadius:7,padding:"8px 10px"},children:[r.jsx("div",{style:{fontSize:11.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o.description||o.prompt.slice(0,90)||"(no description)"}),r.jsxs("div",{className:"row gap-8",style:{marginTop:5},children:[r.jsx("button",{className:"btn btn-ghost btn-xs mono",onClick:()=>A("sessions",{query:{sel:o.session_id}}),children:o.session_id.slice(0,8)}),o.last_model&&r.jsx("span",{className:"mono muted",style:{fontSize:10},children:o.last_model})]})]},o.session_id+":"+o.ts+":"+a)),!l.invocations.length&&r.jsx("div",{className:"muted",style:{fontSize:11.5},children:"No invocations in this range."})]}),r.jsxs("button",{className:"btn btn-secondary btn-sm",style:{width:"100%",justifyContent:"center"},onClick:()=>A("tips"),children:[r.jsx(N,{name:"tips",size:13}),"See related tips"]})]})})]})}const fi={active:{color:"var(--success)",label:"Active",dot:!0,pulse:!0},connected:{color:"var(--node-spec)",label:"Connected",dot:!0},idle:{color:"var(--text-muted)",label:"Idle",dot:!1},failed:{color:"var(--error)",label:"Failed",dot:!0},disabled:{color:"var(--text-muted)",label:"Disabled",dot:!1}},Or={user:{color:"var(--node-route)",label:"Global",hint:"~/.claude.json",icon:"database"},project:{color:"var(--accent)",label:"Project",hint:".mcp.json",icon:"folder"},unknown:{color:"var(--text-muted)",label:"Usage only",hint:"seen in transcripts, not configured",icon:"sessions"}},hi=e=>`color-mix(in srgb, ${e} 14%, transparent)`;function _x({state:e}){const t=fi[e];return r.jsxs("span",{className:"pill",style:{color:t.color,background:hi(t.color),width:92,justifyContent:"center"},children:[t.dot&&r.jsx("span",{className:"pill-dot",style:{background:t.color,animation:t.pulse?"pulsePill 1.6s ease-out infinite":void 0}}),t.label]})}function mp({scope:e}){const t=Or[e];return r.jsxs(ne,{color:t.color,bg:hi(t.color),children:[r.jsx(N,{name:t.icon,size:10}),t.label]})}function Mx(e){return e.exampleCall?`${e.exampleCall.tool} ${JSON.stringify(e.exampleCall.args)}`:null}function _t(e,t,n,s,l){return r.jsxs("div",{className:"card",style:{padding:"11px 13px",display:"flex",flexDirection:"column",gap:3},children:[r.jsxs("div",{className:"row gap-6",style:{color:"var(--text-muted)"},children:[r.jsx(N,{name:e,size:12,style:{color:l||"var(--accent)",flexShrink:0}}),r.jsx("span",{className:"eyebrow",style:{letterSpacing:"0.03em"},children:t})]}),r.jsx("div",{className:"mono tabular",style:{fontSize:19,fontWeight:650,letterSpacing:"-0.01em"},children:n}),r.jsx("div",{className:"mono muted",style:{fontSize:10},children:s})]})}function hs(e,t){return r.jsxs("div",{className:"row gap-6",style:{flexShrink:0},children:[r.jsx("span",{className:"muted",style:{fontSize:11},children:e}),r.jsx("span",{className:"mono tabular",style:{fontSize:12,color:"var(--text-secondary)"},children:t})]})}function Rx({srv:e,onOpen:t}){const n=fi[e.state];return r.jsxs("div",{onClick:()=>t(e.id),className:"card",style:{padding:"12px 14px",cursor:"pointer",display:"flex",alignItems:"center",gap:12,transition:"background var(--motion-fast), border-color var(--motion-fast)"},onMouseEnter:s=>{s.currentTarget.style.background="var(--bg-panel-2)",s.currentTarget.style.borderColor="var(--border-strong)"},onMouseLeave:s=>{s.currentTarget.style.background="var(--bg-panel)",s.currentTarget.style.borderColor="var(--border-subtle)"},children:[r.jsxs("div",{style:{position:"relative",width:36,height:36,borderRadius:9,background:hi(Or[e.scope].color),color:Or[e.scope].color,display:"grid",placeItems:"center",flexShrink:0},children:[r.jsx(N,{name:"plug",size:18}),r.jsx("span",{style:{position:"absolute",right:-2,bottom:-2,width:11,height:11,borderRadius:"50%",background:n.color,border:"2px solid var(--bg-panel)",boxShadow:e.state==="active"?`0 0 6px ${n.color}`:"none"}})]}),r.jsxs("div",{className:"grow",style:{minWidth:0},children:[r.jsxs("div",{className:"row gap-8",children:[r.jsx("span",{className:"mono",style:{fontSize:13.5,fontWeight:600},children:e.name}),r.jsx(mp,{scope:e.scope})]}),r.jsx("div",{className:"mono muted",style:{fontSize:11,marginTop:3,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.command||"no config entry — usage only"})]}),r.jsxs("div",{className:"row gap-16",style:{flexShrink:0},children:[r.jsxs("div",{style:{textAlign:"right",width:56},children:[r.jsx("div",{className:"mono tabular",style:{fontSize:14,fontWeight:600,color:e.calls?"var(--text-primary)":"var(--text-muted)"},children:e.calls.toLocaleString()}),r.jsx("div",{className:"muted",style:{fontSize:10},children:"calls"})]}),r.jsx(_x,{state:e.state}),r.jsx(N,{name:"chevronRight",size:15,style:{color:"var(--text-muted)"}})]})]})}function Px({servers:e,onOpen:t,onReload:n,onAdd:s}){const l=e.filter(c=>c.state==="active"||c.state==="connected").length,o=e.reduce((c,d)=>c+d.tools.length,0),a=e.filter(c=>c.state==="failed"),i=["user","project","unknown"].map(c=>[c,e.filter(d=>d.scope===c)]);return r.jsxs("div",{className:"scroll-y",style:{flex:1,padding:18},children:[r.jsx(Pe,{icon:"plug",title:"MCP servers",sub:"Model Context Protocol servers Claude Code is configured to load",actions:r.jsxs("div",{className:"row gap-6",children:[r.jsxs("button",{className:"btn btn-ghost btn-sm",onClick:n,children:[r.jsx(N,{name:"refresh",size:13}),"Reload"]}),r.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:s,children:[r.jsx(N,{name:"plus",size:13}),"Add server"]})]})}),r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(150px, 1fr))",gap:10,marginBottom:18},children:[_t("plug","Servers",String(e.length),"global + project"),_t("circle","Connected",`${l} / ${e.length}`,"answering now","var(--success)"),_t("wrench","Tools",String(o),"seen in transcripts","var(--node-code)"),_t("drift","Needs attention",String(a.length),a.length?a.map(c=>c.name).join(", "):"all healthy",a.length?"var(--error)":"var(--success)")]}),i.map(([c,d])=>{if(!d.length)return null;const u=Or[c];return r.jsxs("div",{style:{marginBottom:18},children:[r.jsxs("div",{className:"row gap-8",style:{marginBottom:9},children:[r.jsx(N,{name:u.icon,size:13,style:{color:u.color}}),r.jsx("span",{className:"eyebrow",children:u.label}),r.jsx("span",{className:"mono muted",style:{fontSize:11},children:u.hint}),r.jsxs("span",{className:"muted",style:{fontSize:11},children:["· ",d.length]})]}),r.jsx("div",{className:"col gap-8",children:d.map(f=>r.jsx(Rx,{srv:f,onOpen:t},f.id))})]},c)}),r.jsx("div",{style:{height:20}})]})}function Lx({tool:e}){const t=e.calls?Math.round(e.resultBytes/e.calls):0;return r.jsxs("div",{className:"card row gap-10",style:{padding:"11px 13px"},children:[r.jsx("div",{style:{width:30,height:30,borderRadius:8,background:"var(--node-code-soft)",color:"var(--node-code)",display:"grid",placeItems:"center",flexShrink:0},children:r.jsx(N,{name:"wrench",size:15})}),r.jsx("span",{className:"mono grow",style:{fontSize:13,fontWeight:600,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),r.jsxs("div",{style:{textAlign:"right",flexShrink:0},children:[r.jsxs("div",{className:"mono tabular",style:{fontSize:13,fontWeight:600},children:["×",e.calls.toLocaleString()]}),r.jsx("div",{className:"mono tabular muted",style:{fontSize:10},children:"calls"})]}),r.jsxs("div",{style:{textAlign:"right",width:64,flexShrink:0},children:[r.jsx("div",{className:"mono tabular",style:{fontSize:13,fontWeight:600,color:t>8e3?"var(--warn)":"var(--success)"},children:U(t)}),r.jsx("div",{className:"mono tabular muted",style:{fontSize:10},children:"bytes / call"})]})]})}function Dx({srv:e,onBack:t,onChanged:n}){const[s,l]=z.useState(!1),o=fi[e.state],a=Or[e.scope],i=Mx(e),c=e.lastUsed?Date.parse(e.lastUsed):0,d=e.entry?JSON.stringify({mcpServers:{[e.name]:e.entry}},null,2):null,u=e.configFile!=null;return r.jsxs("div",{className:"scroll-y",style:{flex:1,padding:18},children:[r.jsxs("div",{className:"row gap-10",style:{marginBottom:14},children:[r.jsxs("button",{className:"btn btn-ghost btn-sm",onClick:t,children:[r.jsx(N,{name:"chevronLeft",size:14}),"MCP servers"]}),r.jsx("span",{className:"mono",style:{fontSize:16,fontWeight:600},children:e.name}),r.jsx(mp,{scope:e.scope}),e.configFile&&r.jsx("span",{className:"mono muted",style:{fontSize:11.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.configFile})]}),r.jsxs("div",{className:"card",style:{padding:0,overflow:"hidden",marginBottom:14,display:"flex"},children:[r.jsx("div",{style:{width:3,background:o.color,flexShrink:0}}),r.jsxs("div",{style:{flex:1,padding:"13px 16px"},children:[r.jsxs("div",{className:"row gap-16",style:{flexWrap:"wrap"},children:[r.jsxs("div",{className:"row gap-8",style:{flexShrink:0},children:[r.jsx("span",{style:{width:9,height:9,borderRadius:"50%",background:o.color,boxShadow:e.state==="active"?`0 0 8px ${o.color}`:"none",animation:e.state==="active"?"pulsePill 1.6s ease-out infinite":void 0}}),r.jsx("span",{style:{fontWeight:600,fontSize:13.5},children:o.label})]}),hs("Transport",e.transport),hs("Calls",e.calls.toLocaleString()),hs("Last used",c?Ir(c)??"—":"never"),hs("Tools",String(e.tools.length)),r.jsx("div",{className:"grow"}),e.command&&r.jsxs("div",{className:"row gap-8",style:{background:"var(--bg-canvas)",border:"1px solid var(--border-subtle)",borderRadius:7,padding:"6px 10px",maxWidth:360},children:[r.jsx(N,{name:"command",size:12,style:{color:"var(--text-muted)",flexShrink:0}}),r.jsx("span",{className:"mono",style:{fontSize:11.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.command}),r.jsx(dt,{text:e.command})]}),u&&r.jsxs("button",{className:e.disabled?"btn btn-primary btn-sm":"btn btn-secondary btn-sm",onClick:()=>l(!0),children:[r.jsx(N,{name:e.disabled?"play":"pause",size:12}),e.disabled?"Enable server":"Disable server"]})]}),e.state==="failed"&&r.jsxs("div",{className:"row gap-8",style:{marginTop:11,padding:"8px 11px",background:"var(--error-soft)",border:"1px solid rgba(242,85,90,0.25)",borderRadius:7},children:[r.jsx(N,{name:"drift",size:14,style:{color:"var(--error)",flexShrink:0}}),r.jsx("span",{style:{fontSize:12,color:"var(--text-secondary)",flex:1},children:"The server didn't answer an MCP initialize — it may be crashing, unreachable, or mis-configured. Check the command and credentials, then reload."})]}),e.disabled&&r.jsxs("div",{className:"muted",style:{marginTop:11,fontSize:11.5},children:["Disabled in ",e.configFile," — Claude Code won't load this server until it's enabled again."]})]})]}),r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(150px, 1fr))",gap:10,marginBottom:16},children:[_t("wrench","Tools",String(e.tools.length),"seen in transcripts"),_t("plug","Calls",e.calls.toLocaleString(),"all time","var(--node-code)"),_t("database","Result bytes",U(e.resultBytes),"returned to context","var(--node-route)"),_t("clock","Last used",c?Ir(c)??"—":"never",c?new Date(c).toLocaleString():"no calls recorded","var(--success)")]}),r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(300px, 1fr))",gap:16,alignItems:"start"},children:[r.jsxs("div",{style:{minWidth:0,gridColumn:"1 / -1"},children:[r.jsxs("div",{className:"row gap-8",style:{marginBottom:10},children:[r.jsxs("span",{className:"eyebrow",children:["Tools · ",e.tools.length]}),r.jsx("span",{className:"muted",style:{fontSize:11},children:"call counts from ingested transcripts"})]}),e.tools.length?r.jsx("div",{className:"col gap-8",children:e.tools.map(f=>r.jsx(Lx,{tool:f},f.name))}):r.jsx("div",{className:"card card-pad muted",style:{fontSize:12},children:"No tool calls recorded yet — statistics appear after Claude Code uses this server."})]}),r.jsxs("div",{className:"card card-pad",style:{minWidth:0},children:[r.jsxs("div",{className:"row gap-8",style:{marginBottom:12},children:[r.jsx(N,{name:"command",size:14,style:{color:"var(--node-code)"}}),r.jsx("span",{style:{fontWeight:600,fontSize:12.5},children:"Example call"}),i&&r.jsx("span",{className:"muted",style:{fontSize:10.5},children:"latest recorded input"})]}),i?r.jsxs("div",{className:"row gap-8",style:{background:"var(--bg-canvas)",border:"1px solid var(--border-subtle)",borderRadius:7,padding:"8px 11px"},children:[r.jsx("span",{className:"mono grow",style:{fontSize:11.5,color:"var(--text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i}),r.jsx(dt,{text:i})]}):r.jsx("div",{className:"muted",style:{fontSize:11.5},children:"No calls recorded yet."})]}),r.jsxs("div",{className:"card card-pad",style:{minWidth:0},children:[r.jsxs("div",{className:"row gap-8",style:{marginBottom:12},children:[r.jsx(N,{name:"settings",size:14,style:{color:"var(--accent)"}}),r.jsx("span",{className:"grow",style:{fontWeight:600,fontSize:12.5},children:"Configuration"}),r.jsx("span",{className:"mono muted",style:{fontSize:10.5},children:e.configFile??a.hint}),d&&r.jsx(dt,{text:d})]}),d?r.jsx("pre",{className:"mono scroll-y",style:{margin:0,fontSize:11.5,lineHeight:1.65,color:"var(--text-secondary)",background:"var(--bg-canvas)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:"11px 13px",overflowX:"auto",whiteSpace:"pre"},children:d}):r.jsx("div",{className:"muted",style:{fontSize:11.5},children:"This server appears in transcripts but isn't in any config file — it was likely removed, or belongs to another machine's setup."})]})]}),s&&r.jsx(Ix,{srv:e,onClose:()=>l(!1),onDone:()=>{l(!1),n()}}),r.jsx("div",{style:{height:24}})]})}function Ix({srv:e,onClose:t,onDone:n}){const s=e.disabled,[l,o]=z.useState(!1),[a,i]=z.useState(null),c=s?"Enable":"Disable",d=()=>{l||(o(!0),i(null),P.setMcpServerEnabled(e.name,s).then(()=>n(),u=>{i(u instanceof Error?u.message:String(u)),o(!1)}))};return r.jsx("div",{onMouseDown:t,role:"dialog","aria-label":`${c} ${e.name}`,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",zIndex:90,display:"grid",placeItems:"center"},children:r.jsxs("div",{onMouseDown:u=>u.stopPropagation(),style:{width:440,maxWidth:"90vw",background:"var(--bg-elevated)",border:"1px solid var(--border-strong)",borderRadius:12,boxShadow:"var(--shadow-pop)"},children:[r.jsxs("div",{className:"row gap-10",style:{padding:"14px 16px",borderBottom:"1px solid var(--border-subtle)"},children:[r.jsx(N,{name:s?"play":"pause",size:16,style:{color:s?"var(--success)":"var(--warn)"}}),r.jsxs("span",{className:"grow",style:{fontWeight:600},children:[c," ",e.name,"?"]}),r.jsx("button",{className:"btn btn-ghost btn-xs",onClick:t,"aria-label":"Close",children:r.jsx(N,{name:"x",size:14})})]}),r.jsxs("div",{style:{padding:16},children:[r.jsxs("div",{className:"secondary",style:{fontSize:12.5,lineHeight:1.55},children:["This writes to ",r.jsx("code",{className:"mono",style:{fontSize:11.5},children:e.configFile}),"."," ",s?"Claude Code loads the server again on its next start.":"Claude Code stops loading the server (and its tools) on its next start."]}),a&&r.jsxs("div",{className:"row gap-8",style:{marginTop:10,padding:"8px 10px",borderRadius:7,background:"var(--error-soft)",color:"var(--error)",fontSize:12},children:[r.jsx(N,{name:"cancel",size:13,style:{flexShrink:0}}),r.jsx("span",{children:a})]})]}),r.jsxs("div",{className:"row gap-8",style:{padding:"12px 16px",borderTop:"1px solid var(--border-subtle)",justifyContent:"flex-end"},children:[r.jsx("button",{className:"btn btn-ghost btn-sm",onClick:t,children:"Cancel"}),r.jsx("button",{className:"btn btn-primary btn-sm",onClick:d,disabled:l,children:l?`${c.slice(0,-1)}ing…`:`${c} server`})]})]})})}function Ox({onClose:e,onAdded:t}){const[n,s]=z.useState(""),[l,o]=z.useState("user"),[a,i]=z.useState("stdio"),[c,d]=z.useState(""),[u,f]=z.useState(""),[m,g]=z.useState(!1),[v,p]=z.useState(null),w=!!n.trim()&&!/\s/.test(n.trim()),h=a==="stdio"?!!c.trim():!!u.trim(),x=w&&h,j=()=>{if(m||!x)return;g(!0),p(null);const y={name:n.trim(),scope:l};if(a==="stdio"){const[S,...b]=c.trim().split(/\s+/);y.command=S,b.length&&(y.args=b)}else y.url=u.trim();P.addMcpServer(y).then(()=>t(),S=>{p(S instanceof Error?S.message:String(S)),g(!1)})};return r.jsx("div",{onMouseDown:e,role:"dialog","aria-label":"Add MCP server",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",zIndex:90,display:"grid",placeItems:"center"},children:r.jsxs("div",{onMouseDown:y=>y.stopPropagation(),style:{width:460,maxWidth:"90vw",background:"var(--bg-elevated)",border:"1px solid var(--border-strong)",borderRadius:12,boxShadow:"var(--shadow-pop)"},children:[r.jsxs("div",{className:"row gap-10",style:{padding:"14px 16px",borderBottom:"1px solid var(--border-subtle)"},children:[r.jsx(N,{name:"plus",size:16,style:{color:"var(--accent)"}}),r.jsx("span",{className:"grow",style:{fontWeight:600},children:"Add MCP server"}),r.jsx("button",{className:"btn btn-ghost btn-xs",onClick:e,"aria-label":"Close",children:r.jsx(N,{name:"x",size:14})})]}),r.jsxs("div",{style:{padding:16},children:[r.jsxs("div",{style:{marginBottom:12},children:[r.jsx("label",{className:"eyebrow",style:{display:"block",marginBottom:5},htmlFor:"mcp-add-name",children:"Name"}),r.jsx("input",{id:"mcp-add-name",className:"input mono",style:{width:"100%"},placeholder:"github",value:n,onChange:y=>s(y.target.value),onKeyDown:y=>{y.key==="Enter"&&j()}})]}),r.jsxs("div",{style:{marginBottom:12},children:[r.jsx("div",{className:"eyebrow",style:{marginBottom:5},children:"Scope"}),r.jsx(Re,{value:l,onChange:y=>o(y),size:"sm",label:"Server scope",options:[{value:"user",label:"Global · ~/.claude.json"},{value:"project",label:"Project · .mcp.json"}]})]}),r.jsxs("div",{style:{marginBottom:12},children:[r.jsx("div",{className:"eyebrow",style:{marginBottom:5},children:"Transport"}),r.jsx(Re,{value:a,onChange:i,size:"sm",label:"Server transport",options:[{value:"stdio",label:"stdio · command"},{value:"http",label:"http · url"}]})]}),a==="stdio"?r.jsxs("div",{style:{marginBottom:4},children:[r.jsx("label",{className:"eyebrow",style:{display:"block",marginBottom:5},htmlFor:"mcp-add-command",children:"Command"}),r.jsx("input",{id:"mcp-add-command",className:"input mono",style:{width:"100%"},placeholder:"npx -y @modelcontextprotocol/server-github",value:c,onChange:y=>d(y.target.value),onKeyDown:y=>{y.key==="Enter"&&j()}})]}):r.jsxs("div",{style:{marginBottom:4},children:[r.jsx("label",{className:"eyebrow",style:{display:"block",marginBottom:5},htmlFor:"mcp-add-url",children:"URL"}),r.jsx("input",{id:"mcp-add-url",className:"input mono",style:{width:"100%"},placeholder:"https://<host>/sse",value:u,onChange:y=>f(y.target.value),onKeyDown:y=>{y.key==="Enter"&&j()}})]}),v&&r.jsxs("div",{className:"row gap-8",style:{marginTop:10,padding:"8px 10px",borderRadius:7,background:"var(--error-soft)",color:"var(--error)",fontSize:12},children:[r.jsx(N,{name:"cancel",size:13,style:{flexShrink:0}}),r.jsx("span",{children:v})]})]}),r.jsxs("div",{className:"row gap-8",style:{padding:"12px 16px",borderTop:"1px solid var(--border-subtle)",justifyContent:"flex-end"},children:[r.jsx("button",{className:"btn btn-ghost btn-sm",onClick:e,children:"Cancel"}),r.jsxs("button",{className:"btn btn-primary btn-sm",onClick:j,disabled:m||!x,children:[r.jsx(N,{name:"plus",size:13}),m?"Adding…":"Add server"]})]})]})})}function Ax({onAdd:e,onReload:t}){return r.jsx(ce,{icon:"plug",title:"No MCP servers configured",body:r.jsxs(r.Fragment,{children:["Claude Code loads MCP servers from ",r.jsx("code",{className:"mono",children:"~/.claude.json"})," and the project's ",r.jsx("code",{className:"mono",children:".mcp.json"}),". Add one here, or run"," ",r.jsx("code",{className:"mono",children:"specship install"})," to register SpecShip's own server."]}),action:r.jsxs("div",{className:"row gap-8",style:{justifyContent:"center"},children:[r.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:e,children:[r.jsx(N,{name:"plus",size:13}),"Add server"]}),r.jsxs("button",{className:"btn btn-ghost btn-sm",onClick:t,children:[r.jsx(N,{name:"refresh",size:13}),"Reload"]})]})})}function Bx({query:e}){const t=D(()=>P.mcpServers(),[]),[n,s]=z.useState(e?.server??null),[l,o]=z.useState(!1);return r.jsxs("div",{className:"col",style:{flex:1,minHeight:0},children:[r.jsx(se,{state:t,label:"MCP servers",minHeight:320,children:a=>{const i=n?a.servers.find(c=>c.id===n):void 0;return i?r.jsx(Dx,{srv:i,onBack:()=>s(null),onChanged:t.reload}):a.servers.length?r.jsx(Px,{servers:a.servers,onOpen:s,onReload:t.reload,onAdd:()=>o(!0)}):r.jsx(Ax,{onAdd:()=>o(!0),onReload:t.reload})}}),l&&r.jsx(Ox,{onClose:()=>o(!1),onAdded:()=>{o(!1),t.reload()}})]})}const Vn={enterprise:{label:"Managed",color:"#E5A50A",soft:"rgba(229,165,10,0.14)",desc:"Organization policy · cannot be overridden"},user:{label:"User",color:"#29D2BE",soft:"rgba(41,210,190,0.14)",desc:"Personal · applies to every project"},project:{label:"Project",color:"#5B93F2",soft:"rgba(91,147,242,0.14)",desc:"Team-shared · checked into the repo"},subdir:{label:"Directory",color:"#A586F5",soft:"rgba(165,134,245,0.14)",desc:"Scoped to a subtree · loaded when cwd is inside"},import:{label:"Import",color:"#7B8696",soft:"rgba(123,134,150,0.12)",desc:"Pulled in via @path reference"},note:{label:"Notes",color:"#46C26B",soft:"rgba(70,194,107,0.14)",desc:"Agent-written · memory tool"}},ia={instruction:{label:"Instructions",color:"#5B93F2",soft:"rgba(91,147,242,0.14)",icon:"memory",desc:"Directives & rules from CLAUDE.md"},note:{label:"Notes",color:"#46C26B",soft:"rgba(70,194,107,0.14)",icon:"tips",desc:"Facts the agent saved via the memory tool"},import:{label:"Imports",color:"#29D2BE",soft:"rgba(41,210,190,0.14)",icon:"external",desc:"Files pulled in via @path"}};function xp(e){const t=l=>l.replace(/&/g,"&amp;").replace(/</g,"&lt;"),n=l=>t(l).replace(/\*\*(.+?)\*\*/g,"<strong style='color:var(--text-primary)'>$1</strong>").replace(/`(.+?)`/g,"<code class='mono' style='font-size:11.5px;background:var(--bg-canvas);padding:1px 5px;border-radius:4px;border:1px solid var(--border-subtle);color:var(--node-spec)'>$1</code>"),s=[];return e.split(`
43
- `).forEach(l=>{l.startsWith("## ")?s.push(`<div style='font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:0.06em;color:var(--text-muted);margin:14px 0 6px'>${n(l.slice(3))}</div>`):l.startsWith("# ")?s.push(`<div style='font-size:14px;font-weight:650;margin:0 0 8px'>${n(l.slice(2))}</div>`):l.startsWith("@")?s.push(`<div class='mono' style='font-size:12px;color:var(--node-route);background:var(--node-route-soft);display:block;width:fit-content;padding:2px 8px;border-radius:5px;margin:3px 0'>${t(l)}</div>`):/^\s*- /.test(l)?s.push(`<div style='display:flex;gap:8px;font-size:12.5px;line-height:1.6;color:var(--text-secondary);padding:1px 0'><span style='color:var(--text-faint)'>•</span><span>${n(l.replace(/^\s*- /,""))}</span></div>`):l.trim()===""?s.push("<div style='height:6px'></div>"):s.push(`<div style='font-size:12.5px;line-height:1.6;color:var(--text-secondary)'>${n(l)}</div>`)}),s.join("")}function gp({level:e}){const t=Vn[e];return r.jsx(ne,{color:t.color,bg:t.soft,children:t.label})}function Wx({type:e}){const t=ia[e];return r.jsxs(ne,{color:t.color,bg:t.soft,children:[r.jsx(N,{name:t.icon,size:10}),t.label]})}function $x({text:e}){const[t,n]=z.useState(!1);return r.jsxs("button",{className:"btn btn-secondary btn-sm",title:"Copy file contents",onClick:()=>{navigator.clipboard?.writeText(e),n(!0),setTimeout(()=>n(!1),1100)},style:{color:t?"var(--success)":void 0},children:[r.jsx(N,{name:t?"check":"copy",size:13}),t?"Copied":"Copy contents"]})}function Oc({file:e,selId:t,onSel:n,indent:s}){const l=t===e.id,o=e.level==="import"||e.level==="note",a=e.level==="import"?"external":e.level==="note"?"tips":"memory";return r.jsxs("div",{onClick:()=>n(e.id),className:"row gap-8",style:{padding:"8px 10px",paddingLeft:s?26:10,borderRadius:7,cursor:"pointer",background:l?"var(--accent-soft)":"transparent"},onMouseEnter:i=>{l||(i.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:i=>{l||(i.currentTarget.style.background="transparent")},children:[r.jsx("span",{className:"pill-dot",style:{background:Vn[e.level].color,flexShrink:0}}),r.jsx(N,{name:a,size:13,style:{color:l?"var(--accent)":"var(--text-muted)",flexShrink:0}}),r.jsxs("div",{className:"grow",style:{minWidth:0},children:[r.jsxs("div",{className:"row gap-6",children:[r.jsx("span",{className:"mono",style:{fontSize:12,color:l?"var(--accent)":"var(--text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o?e.name:e.scope}),e.readOnly&&r.jsx(N,{name:"lock",size:10,style:{color:"var(--warn)"}})]}),r.jsx("div",{className:"mono muted",style:{fontSize:10,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.path})]}),r.jsx("span",{className:"mono tabular muted",style:{fontSize:10.5,flexShrink:0},children:U(e.tokens)})]})}function ms(e,t){return r.jsxs("div",{children:[r.jsx("div",{className:"muted",style:{fontSize:10.5},children:e}),r.jsx("div",{className:"mono tabular",style:{fontSize:13,fontWeight:600,marginTop:1,whiteSpace:"nowrap"},children:t})]})}function Fx({file:e,files:t}){const n=Vn[e.level],s=e.type==="note",l=(e.imports??[]).map(o=>t.find(a=>a.id===o)).filter(o=>!!o);return r.jsxs("div",{className:"scroll-y",style:{flex:1,padding:20},children:[r.jsxs("div",{className:"row gap-8",style:{marginBottom:6},children:[r.jsx(Wx,{type:e.type}),r.jsx(gp,{level:e.level}),r.jsx("span",{className:"secondary",style:{fontSize:11.5},children:n.desc}),r.jsx("div",{className:"grow"}),e.readOnly&&r.jsxs(ne,{color:"var(--warn)",bg:"var(--warn-soft)",children:[r.jsx(N,{name:"lock",size:10}),"read-only"]})]}),r.jsxs("div",{className:"row gap-8",style:{marginBottom:14},children:[r.jsx("span",{className:"mono",style:{fontSize:13.5,fontWeight:600},children:e.path}),r.jsx(dt,{text:e.path})]}),r.jsxs("div",{className:"row",style:{gap:22,padding:"10px 0",borderTop:"1px solid var(--border-subtle)",borderBottom:"1px solid var(--border-subtle)",marginBottom:16,flexWrap:"wrap"},children:[ms("Tokens",U(e.tokens)),ms("Lines",String(e.lines)),ms("Scope",n.label),ms("Modified",e.modified),s&&e.session&&r.jsxs("div",{children:[r.jsx("div",{className:"muted",style:{fontSize:10.5},children:"Saved in"}),r.jsx("button",{onClick:()=>A("sessions",{query:{sel:e.session}}),className:"mono",style:{fontSize:13,fontWeight:600,marginTop:1,color:"var(--accent)",background:"none",border:"none",padding:0,cursor:"pointer"},children:e.session})]})]}),s&&e.tags&&r.jsx("div",{className:"row gap-6",style:{marginBottom:14,flexWrap:"wrap"},children:e.tags.map(o=>r.jsxs("span",{className:"mono",style:{fontSize:10.5,color:"var(--node-test)",background:"var(--node-test-soft)",padding:"2px 8px",borderRadius:5,whiteSpace:"nowrap"},children:["#",o]},o))}),r.jsx("div",{className:"card card-pad",style:{background:"var(--bg-panel)",marginBottom:16},dangerouslySetInnerHTML:{__html:xp(e.body)}}),l.length>0&&r.jsxs("div",{children:[r.jsxs("div",{className:"eyebrow",style:{marginBottom:8},children:["Imports · ",l.length]}),r.jsx("div",{className:"col gap-6",children:l.map(o=>r.jsxs("div",{className:"row gap-8",style:{padding:"7px 10px",borderRadius:7,border:"1px solid var(--border-subtle)"},children:[r.jsx(N,{name:"external",size:12,style:{color:"var(--node-route)"}}),r.jsx("span",{className:"mono grow",style:{fontSize:11.5},children:o.path}),r.jsx("span",{className:"mono tabular muted",style:{fontSize:10.5},children:U(o.tokens)})]},o.id))})]}),r.jsx("div",{className:"row gap-8",style:{marginTop:16},children:r.jsx($x,{text:e.body})})]})}function Hx({files:e,typeF:t}){const n=e.filter(a=>a.type!=="note"&&(t==="all"||a.type===t)),s=e.filter(a=>a.type==="note"&&(t==="all"||t==="note")),l=[...n,...s].map(a=>a.body).join(`
44
-
45
- `),o=(a,i)=>{const c=Vn[a.level];return r.jsxs("div",{className:"card",style:{overflow:"hidden",display:"flex"},children:[r.jsx("div",{style:{width:3,background:c.color,flexShrink:0}}),r.jsxs("div",{style:{flex:1,minWidth:0,padding:"12px 14px"},children:[r.jsxs("div",{className:"row gap-8",style:{marginBottom:8},children:[i!=null&&r.jsx("span",{className:"mono tabular muted",style:{fontSize:10.5,width:16},children:i+1}),r.jsx(gp,{level:a.level}),r.jsx("span",{className:"mono",style:{fontSize:11.5,color:"var(--text-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.path}),r.jsx("div",{className:"grow"}),a.readOnly&&r.jsx(N,{name:"lock",size:11,style:{color:"var(--warn)"}}),r.jsx("span",{className:"mono tabular muted",style:{fontSize:10.5},children:U(a.tokens)})]}),r.jsx("div",{style:{paddingLeft:i!=null?24:0},dangerouslySetInnerHTML:{__html:xp(a.body)}})]})]},a.id)};return r.jsxs("div",{className:"scroll-y",style:{flex:1,padding:20},children:[r.jsxs("div",{className:"row gap-8",style:{marginBottom:6},children:[r.jsx(N,{name:"layers",size:15,style:{color:"var(--accent)"}}),r.jsx("span",{style:{fontWeight:600,fontSize:14},children:"Effective memory"}),r.jsx("span",{className:"secondary",style:{fontSize:12},children:"· everything the agent loads"}),r.jsx("div",{className:"grow"}),r.jsx(dt,{text:l,label:"Copy all",ariaLabel:"Copy effective memory"})]}),r.jsx("div",{className:"secondary",style:{fontSize:12,lineHeight:1.55,marginBottom:16},children:"Instructions compose in load order — later files layer onto earlier ones, and @imports load with the file that references them. Saved notes are appended as retrieved context."}),n.length>0&&r.jsxs("div",{children:[r.jsx("div",{className:"eyebrow",style:{marginBottom:8},children:"Instructions · load order"}),r.jsx("div",{className:"col gap-10",children:n.map((a,i)=>o(a,i))})]}),s.length>0&&r.jsxs("div",{style:{marginTop:n.length?20:0},children:[r.jsxs("div",{className:"row gap-6",style:{marginBottom:8},children:[r.jsx("span",{className:"eyebrow",children:"Notes · memory tool"}),r.jsx("span",{className:"muted",style:{fontSize:10.5},children:"retrieved facts, not precedence-ranked"})]}),r.jsx("div",{className:"col gap-10",children:s.map(a=>o(a,null))})]})]})}function xs(e,t,n,s){return r.jsxs("div",{className:"row gap-8",style:{padding:"8px 12px",background:"var(--bg-panel)",border:"1px solid var(--border-subtle)",borderRadius:9,flexShrink:0},children:[r.jsx(N,{name:e,size:14,style:{color:s,flexShrink:0}}),r.jsxs("div",{children:[r.jsx("div",{className:"muted",style:{fontSize:10},children:t}),r.jsx("div",{className:"mono tabular",style:{fontSize:13,fontWeight:600,whiteSpace:"nowrap"},children:n})]})]})}function Ux({onReload:e}){return r.jsx(ce,{icon:"memory",title:"No memory files found",body:r.jsxs(r.Fragment,{children:["Claude Code reads ",r.jsx("code",{className:"mono",children:"~/.claude/CLAUDE.md"}),", a"," ",r.jsx("code",{className:"mono",children:"CLAUDE.md"})," at the project root (and one level of subdirectories), and saved notes under ",r.jsx("code",{className:"mono",children:"~/.claude/memory/"}),". Create one, then reload."]}),action:r.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:e,children:[r.jsx(N,{name:"refresh",size:13}),"Reload memory"]})})}function Vx({data:e,view:t,typeF:n,onTypeF:s,sel:l,onSel:o,onReload:a}){const i=e.files,c=i.find(p=>p.id===l)??i.find(p=>p.level==="project")??i[0],d=p=>i.find(w=>w.id===p),u=p=>n==="all"||p.type===n,f=p=>(p.imports??[]).map(d).filter(w=>!!w&&u(w)),m=[{key:"enterprise",items:i.filter(p=>p.level==="enterprise")},{key:"user",items:i.filter(p=>p.level==="user")},{key:"project",items:i.filter(p=>p.level==="project"||p.level==="subdir")},{key:"note",items:i.filter(p=>p.level==="note")}],g=p=>p.items.some(w=>u(w)||f(w).length>0),v=(p,w)=>{const h=n===p,x=p==="all"?{label:"All",color:"var(--text-secondary)",soft:""}:ia[p];return r.jsxs("button",{onClick:()=>s(p),className:"row gap-6",style:{height:26,padding:"0 11px",borderRadius:999,fontSize:11.5,fontWeight:500,cursor:"pointer",border:"1px solid "+(h?"transparent":"var(--border-subtle)"),background:h?p==="all"?"var(--bg-active)":x.soft:"var(--bg-panel)",color:h?p==="all"?"var(--text-primary)":x.color:"var(--text-muted)"},children:[p!=="all"&&r.jsx("span",{style:{width:7,height:7,borderRadius:"50%",background:x.color}}),x.label,w!=null&&r.jsx("span",{className:"tabular",style:{opacity:.7},children:w})]})};return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"row gap-10",style:{padding:"0 18px 12px",flexWrap:"wrap"},children:[xs("memory","Loaded",U(e.totalTokens)+" tokens","var(--accent)"),xs("memory","Instructions",String(e.instructionCount),"var(--node-spec)"),xs("tips","Notes",String(e.noteCount),"var(--node-test)"),xs("external","Imports",String(e.importCount),"var(--node-route)"),r.jsx("div",{className:"grow"}),r.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:a,title:"Re-read memory files from disk",children:[r.jsx(N,{name:"refresh",size:13}),"Reload memory"]})]}),r.jsxs("div",{className:"row gap-6",style:{padding:"0 18px 14px",flexWrap:"wrap"},children:[r.jsx(N,{name:"filter",size:13,style:{color:"var(--text-muted)"}}),v("all"),v("instruction",e.instructionCount),v("note",e.noteCount),v("import",e.importCount),r.jsx("span",{className:"grow"}),r.jsx("span",{className:"muted",style:{fontSize:11},children:n!=="all"?ia[n].desc:""})]}),t==="effective"?r.jsx(Hx,{files:i,typeF:n}):r.jsxs("div",{style:{flex:1,display:"flex",minHeight:0,borderTop:"1px solid var(--border-subtle)"},children:[r.jsx("div",{className:"col",style:{width:300,flexShrink:0,borderRight:"1px solid var(--border-subtle)",background:"var(--bg-panel)"},children:r.jsx("div",{className:"scroll-y",style:{flex:1,padding:8},children:m.filter(g).map(p=>r.jsxs("div",{style:{marginBottom:10},children:[r.jsxs("div",{className:"row gap-6",style:{padding:"8px 8px 4px"},children:[r.jsx("span",{className:"eyebrow",children:Vn[p.key].label}),r.jsx("span",{className:"muted",style:{fontSize:10},children:Vn[p.key].desc})]}),p.items.filter(w=>u(w)||f(w).length>0).map(w=>r.jsxs(z.Fragment,{children:[u(w)&&r.jsx(Oc,{file:w,selId:c?.id??"",onSel:o}),f(w).map(h=>r.jsx(Oc,{file:h,selId:c?.id??"",onSel:o,indent:!0},h.id))]},w.id))]},p.key))})}),r.jsx("div",{className:"col",style:{flex:1,minWidth:0},children:c&&r.jsx(Fx,{file:c,files:i})})]})]})}function Kx({project:e}){const t=D(()=>P.memory(e),[e]),[n,s]=z.useState("sources"),[l,o]=z.useState("all"),[a,i]=z.useState(null);return r.jsxs("div",{className:"col",style:{flex:1,minHeight:0},children:[r.jsx("div",{style:{padding:"16px 18px 0"},children:r.jsx(Pe,{icon:"memory",title:"Memory",sub:"Everything the agent remembers — across levels and types",actions:r.jsx(Re,{value:n,onChange:s,size:"sm",label:"Memory view",options:[{value:"sources",label:"Sources"},{value:"effective",label:"Effective"}]})})}),r.jsx(se,{state:t,label:"memory",minHeight:320,children:c=>c.files.length===0?r.jsx(Ux,{onReload:t.reload}):r.jsx(Vx,{data:c,view:n,typeF:l,onTypeF:o,sel:a,onSel:i,onReload:t.reload})})]})}function Qx({title:e,req:t}){return r.jsx(ce,{icon:"box",title:e,body:t?`This screen lands with ${t}. The SSR dashboard still serves it today.`:"This screen is not wired yet."})}const Yx=new Set(["completed","failed","cancelled","rejected"]);function ca(e){return e.stepId??(typeof e.data?.stepId=="string"?e.data.stepId:void 0)}function Gx(e){const t=new Set(e.map(i=>i.id)),n=new Map(e.map(i=>[i.id,(i.depends_on??[]).filter(c=>t.has(c)).length])),s=new Map;for(const i of e)for(const c of i.depends_on??[])t.has(c)&&s.set(c,[...s.get(c)??[],i.id]);const l=new Map(e.map(i=>[i.id,i])),o=e.filter(i=>n.get(i.id)===0).map(i=>i.id),a=[];for(;o.length;){const i=o.shift();a.push(l.get(i));for(const c of s.get(i)??[]){const d=n.get(c)-1;n.set(c,d),d===0&&o.push(c)}}return a.length===e.length?a:e}function qx(e,t,n){const s=t?.metadata?.nodeStates??{},l=new Map,o=[],a=new Set,i=(f,m)=>{a.has(f)||(a.add(f),o.push(f)),m&&!l.get(f)&&l.set(f,m)};if(e?.length)for(const f of Gx(e))i(f.id,f.kind);else{for(const f of Object.keys(s))i(f);for(const f of n){const m=ca(f);m&&i(m,typeof f.data?.stepKind=="string"?f.data.stepKind:void 0)}}const c=new Map(o.map(f=>[f,s[f]??"pending"])),d=new Map;for(const f of n){const m=ca(f);if(!(!m||!a.has(m))&&(f.eventType==="step_started"?c.set(m,"running"):f.eventType==="step_completed"?c.set(m,"completed"):f.eventType==="step_failed"?c.set(m,"failed"):f.eventType==="step_skipped"&&c.set(m,"skipped"),f.eventType==="step_completed")){const g=f.data?.stats;typeof g?.costUsd=="number"&&d.set(m,g.costUsd)}}const u=t?.metadata?.approval;return t?.status==="paused"&&u?.nodeId&&c.get(u.nodeId)!=="completed"&&c.set(u.nodeId,"paused"),o.map(f=>({id:f,kind:l.get(f)??"prompt",state:c.get(f)??"pending",costUsd:d.get(f)}))}function Xx(e){let t=null,n=null;for(const s of e){if(s.eventType!=="step_completed")continue;const l=s.data?.stats;typeof l?.costUsd=="number"&&(t=(t??0)+l.costUsd),typeof l?.model=="string"&&!n&&(n=l.model)}return{costUsd:t,model:n}}function vp(e){if(e==null||!Number.isFinite(e)||e<0)return"—";const t=Math.round(e/1e3);return t<60?t+"s":t<3600?Math.floor(t/60)+"m "+t%60+"s":Math.floor(t/3600)+"h "+Math.floor(t%3600/60)+"m"}function _l(e){return typeof e=="number"?"$"+e.toFixed(2):"—"}const Jx={pending:"var(--text-muted)",running:"var(--info)",completed:"var(--success)",failed:"var(--error)",paused:"var(--warn)",skipped:"var(--text-muted)"};function Zx({nodes:e}){return r.jsx("div",{className:"row",style:{gap:6,padding:"14px 16px",flexWrap:"wrap",alignItems:"center",borderBottom:"1px solid var(--border-subtle)",background:"var(--bg-canvas-2)"},children:e.map((t,n)=>{const s=Jx[t.state]??"var(--text-muted)";return r.jsxs("div",{className:"row",style:{gap:6,alignItems:"center"},children:[n>0&&r.jsx(N,{name:"arrowRight",size:12,style:{color:"var(--text-muted)",flexShrink:0}}),r.jsxs("div",{"data-node-id":t.id,"data-node-state":t.state,className:"row gap-8",style:{padding:"5px 11px",borderRadius:8,background:t.state==="running"?"var(--info-soft)":"var(--bg-panel)",border:`1.5px ${t.state==="skipped"?"dotted":"solid"} ${t.state==="pending"?"var(--border-subtle)":s}`,opacity:t.state==="pending"?.65:1},children:[r.jsxs("span",{style:{width:16,height:16,borderRadius:"50%",display:"grid",placeItems:"center",flexShrink:0,background:t.state==="completed"?"var(--success)":t.state==="failed"?"var(--error)":t.state==="paused"?"var(--warn)":"transparent",border:t.state==="completed"||t.state==="failed"||t.state==="paused"?"none":`1.5px solid ${s}`,animation:t.state==="running"?"spin 1.4s linear infinite":"none",borderTopColor:t.state==="running"?"transparent":void 0},children:[t.state==="completed"&&r.jsx(N,{name:"check",size:10,style:{color:"#fff"}}),t.state==="failed"&&r.jsx(N,{name:"x",size:10,style:{color:"#fff"}}),t.state==="paused"&&r.jsx(N,{name:"pause",size:9,style:{color:"#fff"}})]}),r.jsxs("div",{style:{minWidth:0},children:[r.jsx("div",{style:{fontSize:12,fontWeight:500,whiteSpace:"nowrap"},children:t.id}),r.jsxs("div",{className:"mono muted",style:{fontSize:9},children:[t.kind,t.costUsd!==void 0&&r.jsxs("span",{className:"tabular",children:[" · ",_l(t.costUsd)]})]})]})]})]},t.id)})})}const yp={step_started:"var(--info)",step_completed:"var(--success)",step_failed:"var(--error)",step_skipped:"var(--text-muted)",tool_called:"var(--node-code)",agent_message:"var(--text-secondary)",artifact_created:"var(--node-route)",approval_requested:"var(--warn)",approval_granted:"var(--success)",approval_rejected:"var(--error)",run_started:"var(--info)",run_completed:"var(--success)",run_failed:"var(--error)",run_cancelled:"var(--text-muted)",run_paused:"var(--warn)"};function eg(e){const t=e.data??{};if(typeof t.name=="string")return t.name+(typeof t.input=="string"&&t.input?` · ${t.input}`:"");if(typeof t.text=="string")return t.text;if(typeof t.error=="string")return t.error;if(typeof t.message=="string")return t.message;if(typeof t.reason=="string")return t.reason;if(e.eventType==="step_completed"){const n=t.stats;return typeof n?.costUsd=="number"?_l(n.costUsd):""}return""}function tg(e){const t=new Date(e);return Number.isNaN(t.getTime())?"":t.toLocaleTimeString()}function ng({events:e,live:t}){const n=z.useRef(null),[s,l]=z.useState(!0);return z.useEffect(()=>{s&&n.current&&(n.current.scrollTop=n.current.scrollHeight)},[e.length,s]),r.jsxs("div",{ref:n,className:"scroll-y","aria-live":"polite",onScroll:o=>{const a=o.currentTarget;l(a.scrollHeight-a.scrollTop-a.clientHeight<30)},style:{flex:1,padding:"8px 14px",fontFamily:"var(--font-mono)",fontSize:11.5},children:[e.map(o=>r.jsxs("div",{className:"row gap-10",style:{padding:"4px 0",borderBottom:"1px solid var(--border-subtle)"},children:[r.jsx("span",{className:"muted tabular",style:{flexShrink:0,width:70},children:tg(o.createdAt)}),r.jsx("span",{style:{color:yp[o.eventType]??"var(--text-secondary)",width:140,flexShrink:0},children:o.eventType}),r.jsx("span",{className:"muted",style:{flexShrink:0,width:90,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ca(o)??""}),r.jsx("span",{className:"secondary",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:eg(o)})]},o.id)),!e.length&&r.jsx("div",{className:"muted",style:{padding:"8px 0"},children:"No events yet."}),t&&r.jsxs("div",{className:"row gap-6 muted",style:{padding:"6px 0"},children:[r.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:"var(--info)",animation:"skeleton 1s infinite"}}),"streaming…"]})]})}function rg({artifacts:e,loading:t}){const[n,s]=z.useState(0),l=e[Math.min(n,e.length-1)];return t?r.jsx("div",{className:"muted",style:{padding:16,fontSize:12},children:"Loading artifacts…"}):e.length?r.jsxs("div",{className:"row",style:{flex:1,minHeight:0},children:[r.jsx("div",{className:"scroll-y",style:{width:190,borderRight:"1px solid var(--border-subtle)",padding:8,flexShrink:0},children:e.map((o,a)=>r.jsxs("div",{role:"button",tabIndex:0,onClick:()=>s(a),onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),s(a))},className:"row gap-8 list-row",style:{padding:"7px 9px",borderRadius:6,cursor:"pointer",background:n===a?"var(--bg-hover)":"transparent"},children:[r.jsx(N,{name:"box",size:13,style:{color:"var(--node-route)",flexShrink:0}}),r.jsxs("div",{style:{minWidth:0},children:[r.jsx("div",{className:"mono",style:{fontSize:11.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o.name}),r.jsxs("div",{className:"muted",style:{fontSize:9.5},children:[o.nodeId,o.outputType?" · "+o.outputType:""]})]})]},o.name))}),r.jsx("div",{className:"scroll-y",style:{flex:1,padding:16},children:r.jsx("pre",{className:"mono",style:{margin:0,fontSize:12,lineHeight:1.65,color:"var(--text-secondary)",whiteSpace:"pre-wrap"},children:l?.body})})]}):r.jsx("div",{className:"muted",style:{padding:16,fontSize:12},children:"No artifacts — only completed nodes write output files."})}function sg({id:e,project:t}){const n=D(()=>P.run(e,t),[e,t]),s=D(()=>P.workflows(t),[t]),[l,o]=z.useState([]),[a,i]=z.useState("events"),[c,d]=z.useState(!1),[u,f]=z.useState(""),[m,g]=z.useState(!1),[v,p]=z.useState(null),w=n.data?.run??null,h=w?.status??"",x=!!w&&!Yx.has(h),j=z.useMemo(()=>{const E=n.data?.events??[],M=new Set(E.map(L=>L.id));return[...E,...l.filter(L=>!M.has(L.id))]},[n.data,l]),y=n.data?.events.length?n.data.events[n.data.events.length-1].id:0,S=n.reload;z.useEffect(()=>{if(!x||typeof EventSource>"u")return;const E=new EventSource(am(e,y,t)),M=L=>{try{const I=JSON.parse(L.data);o(H=>H.some(K=>K.id===I.id)?H:[...H,I])}catch{}};for(const L of Object.keys(yp))E.addEventListener(L,M);return E.addEventListener("done",()=>{E.close(),S()}),E.onerror=()=>{},()=>E.close()},[e,t,x,y,S]);const b=z.useMemo(()=>{const E=s.data?.workflows.find(M=>M.workflow.name===w?.workflowName)?.workflow;return qx(E?.nodes,w,j)},[s.data,w,j]),C=z.useMemo(()=>Xx(j),[j]),_=typeof w?.startedAt=="number"?w.startedAt:null,W=typeof w?.completedAt=="number"?w.completedAt:typeof w?.lastActivityAt=="number"?w.lastActivityAt:null,O=_&&W?W-_:null,oe=E=>{g(!0),p(null),E().then(()=>{g(!1),d(!1),o([]),n.reload()},M=>{g(!1),p(M instanceof Error?M.message:String(M))})},nt=()=>oe(async()=>{await P.runAction(e,"approve",void 0,t),await P.runAction(e,"resume",void 0,t)}),Qe=()=>oe(()=>P.runAction(e,"reject",u.trim()?{reason:u.trim()}:void 0,t)),rt=()=>oe(()=>P.runAction(e,"cancel",void 0,t)),pn=()=>oe(()=>P.runAction(e,"resume",void 0,t)),ut=()=>oe(()=>P.runAction(e,"purge",void 0,t)),st=D(()=>a==="artifacts"?P.runArtifacts(e,t):Promise.resolve({artifacts:[]}),[e,t,a,h]),k=w?.metadata?.approval;return r.jsxs("div",{className:"col",style:{flex:1,minHeight:0},children:[r.jsxs("div",{className:"row gap-10",style:{padding:"12px 16px",borderBottom:"1px solid var(--border-subtle)",flexWrap:"wrap"},children:[r.jsxs("button",{className:"btn btn-ghost btn-sm",onClick:()=>A("runs"),children:[r.jsx(N,{name:"chevronLeft",size:14}),"Runs"]}),r.jsx("span",{className:"mono",style:{fontWeight:600,fontSize:14},children:w?.workflowName??"…"}),r.jsx("span",{className:"mono muted",style:{fontSize:11.5},children:e}),w&&r.jsx(Ue,{state:h}),r.jsx("span",{className:"grow"}),r.jsxs("span",{className:"mono muted tabular",style:{fontSize:11.5},title:"Duration",children:[r.jsx(N,{name:"clock",size:11,style:{verticalAlign:-1,marginRight:4}}),vp(O)]}),C.costUsd!==null&&r.jsx("span",{className:"mono tabular",style:{fontSize:11.5},title:"Run-total cost",children:_l(C.costUsd)}),C.model&&r.jsx("span",{className:"mono muted",style:{fontSize:11.5},title:"Model",children:C.model}),(h==="running"||h==="paused")&&r.jsxs("button",{className:"btn btn-destructive btn-sm",onClick:rt,disabled:m,children:[r.jsx(N,{name:"cancel",size:12}),"Cancel"]}),h==="completed"&&r.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:()=>i("artifacts"),children:[r.jsx(N,{name:"box",size:12}),"Inspect artifacts"]})]}),h==="failed"&&w?.errorMessage&&r.jsxs("div",{className:"row gap-12",style:{padding:"12px 16px",background:"var(--error-soft)",borderBottom:"1px solid var(--border-subtle)"},children:[r.jsx("span",{style:{color:"var(--error)",flexShrink:0},children:r.jsx(N,{name:"cancel",size:16})}),r.jsxs("div",{className:"grow",children:[r.jsx("div",{style:{fontWeight:600,fontSize:13,color:"var(--error)"},children:"Run failed"}),r.jsx("div",{className:"secondary mono",style:{fontSize:12,marginTop:1,whiteSpace:"pre-wrap"},children:w.errorMessage})]})]}),h==="rejected"&&r.jsxs("div",{className:"row gap-12",style:{padding:"12px 16px",background:"var(--warn-soft)",borderBottom:"1px solid var(--border-subtle)",flexWrap:"wrap"},children:[r.jsx("span",{style:{color:"var(--warn)",flexShrink:0},children:r.jsx(N,{name:"drift",size:18})}),r.jsxs("div",{className:"grow",style:{minWidth:220},children:[r.jsx("div",{style:{fontWeight:600,fontSize:13},children:"Rejected — parked with worktree and artifacts kept"}),r.jsx("div",{className:"secondary",style:{fontSize:12,marginTop:1},children:w?.errorMessage??"Rejected at the approval gate."})]}),r.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>i("artifacts"),children:"Inspect artifacts"}),r.jsx("button",{className:"btn btn-destructive btn-sm",onClick:ut,disabled:m,title:"Removes the worktree — the only destructive action. Artifacts and the run record are kept.",children:"Purge worktree"}),r.jsxs("button",{className:"btn btn-primary btn-sm",onClick:pn,disabled:m,title:"Runs the gate's on_reject revise prompt with your feedback, then re-pauses for review.",children:[r.jsx(N,{name:"circle",size:12}),"Resume & revise"]})]}),h==="paused"&&r.jsxs("div",{className:"row gap-12",style:{padding:"12px 16px",background:"var(--warn-soft)",borderBottom:"1px solid var(--border-subtle)",flexWrap:"wrap"},children:[r.jsx("span",{style:{color:"var(--warn)",flexShrink:0},children:r.jsx(N,{name:"pause",size:18})}),r.jsxs("div",{className:"grow",style:{minWidth:220},children:[r.jsx("div",{style:{fontWeight:600,fontSize:13},children:"Approval required"}),r.jsx("div",{className:"secondary",style:{fontSize:12,marginTop:1},children:k?.message??"The run paused at an approval gate."})]}),c?r.jsxs(r.Fragment,{children:[r.jsx("input",{className:"input",autoFocus:!0,placeholder:"Reason (optional)…","aria-label":"Rejection reason",value:u,onChange:E=>f(E.target.value),style:{width:200}}),r.jsx("button",{className:"btn btn-destructive btn-sm",onClick:Qe,disabled:m,children:"Confirm reject"}),r.jsx("button",{className:"btn btn-ghost btn-sm",onClick:()=>d(!1),children:"Back"})]}):r.jsxs(r.Fragment,{children:[r.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>i("artifacts"),children:"Inspect artifacts"}),r.jsx("button",{className:"btn btn-destructive btn-sm",onClick:()=>d(!0),disabled:m,children:"Reject"}),r.jsxs("button",{className:"btn btn-primary btn-sm",onClick:nt,disabled:m,children:[r.jsx(N,{name:"check",size:13}),"Approve"]})]})]}),v&&r.jsxs("div",{className:"row gap-8",style:{padding:"8px 16px",background:"var(--error-soft)",color:"var(--error)",fontSize:12,borderBottom:"1px solid var(--border-subtle)"},children:[r.jsx(N,{name:"cancel",size:13,style:{flexShrink:0}}),r.jsx("span",{children:v})]}),b.length>0&&r.jsx(Zx,{nodes:b}),r.jsxs("div",{className:"col",style:{flex:1,minHeight:0},children:[r.jsx("div",{className:"row gap-2",style:{padding:"8px 14px 0",borderBottom:"1px solid var(--border-subtle)"},children:["events","artifacts"].map(E=>r.jsxs("button",{onClick:()=>i(E),style:{padding:"7px 13px",border:"none",background:"transparent",cursor:"pointer",fontSize:12.5,fontWeight:500,textTransform:"capitalize",color:a===E?"var(--text-primary)":"var(--text-muted)",borderBottom:`2px solid ${a===E?"var(--accent)":"transparent"}`,marginBottom:-1},children:[E,E==="events"&&x&&r.jsx("span",{className:"pill",style:{marginLeft:6,fontSize:9,background:"var(--info-soft)",color:"var(--info)"},children:"live"})]},E))}),a==="events"&&r.jsx(ng,{events:j,live:x}),a==="artifacts"&&r.jsx(rg,{artifacts:st.data?.artifacts??[],loading:st.loading})]})]})}const lg=["running","paused","rejected","completed","failed","cancelled"];function cr(e){if(e==null)return null;const t=typeof e=="number"?e:new Date(String(e)).getTime();return Number.isFinite(t)?t:null}function og(e){const t=cr(e.startedAt);if(!t)return"—";const n=cr(e.completedAt)??cr(e.finishedAt)??cr(e.lastActivityAt);return vp(n!==null?n-t:null)}function ag({project:e,param:t}){return t?r.jsx(sg,{id:t,project:e}):r.jsx(ig,{project:e})}function ig({project:e}){const t=D(()=>P.runs(e),[e]),[n,s]=z.useState(null);if(Vt(t.error))return r.jsx(ce,{icon:"folder",title:"No project selected",body:"Pick an indexed project from the switcher in the status strip."});const l=t.data?.runs??[],o=n?l.filter(a=>a.status===n):l;return r.jsxs("div",{className:"col",style:{flex:1,minHeight:0},children:[r.jsx("div",{style:{padding:"16px 18px 0"},children:r.jsx(Pe,{icon:"play",title:"Runs",sub:t.data?`${l.length} workflow runs`:"Loading runs…",actions:r.jsxs("button",{className:"btn btn-primary btn-sm",onClick:()=>A("workflows"),children:[r.jsx(N,{name:"play",size:13}),"Launch run"]})})}),r.jsx("div",{className:"row gap-6",style:{padding:"0 18px 12px"},children:r.jsx(Re,{size:"sm",label:"Run status filter",value:n??"all",onChange:a=>s(a==="all"?null:a),options:[{value:"all",label:"All"},...lg.map(a=>({value:a,label:a[0].toUpperCase()+a.slice(1)}))]})}),t.data&&!l.length?r.jsx(ce,{icon:"play",title:"No runs yet",body:"Workflow runs started from the CLI or dashboard land here.",action:r.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>A("workflows"),children:"Browse workflows"})}):r.jsx("div",{className:"scroll-y",style:{padding:"0 18px 18px"},children:r.jsxs("div",{className:"card",style:{overflow:"hidden"},children:[r.jsxs("div",{className:"row",style:{padding:"8px 14px",fontSize:10.5,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.05em",fontWeight:600},children:[r.jsx("span",{style:{width:100},children:"Status"}),r.jsx("span",{className:"grow",children:"Workflow"}),r.jsx("span",{style:{width:90},children:"Duration"}),r.jsx("span",{style:{width:130},children:"Model"}),r.jsx("span",{style:{width:70,textAlign:"right"},children:"Cost"}),r.jsx("span",{style:{width:60,textAlign:"right"},children:"When"})]}),o.map(a=>r.jsxs("div",{role:"button",tabIndex:0,className:"row list-row",onClick:()=>A("runs",{param:a.id}),onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),A("runs",{param:a.id}))},style:{padding:"11px 14px",borderTop:"1px solid var(--border-subtle)",cursor:"pointer"},children:[r.jsx("span",{style:{width:100,flexShrink:0},children:r.jsx(Ue,{state:a.status})}),r.jsxs("div",{className:"grow row gap-8",style:{minWidth:0},children:[r.jsx("span",{className:"mono",style:{fontSize:12.5},children:String(a.workflowName??a.workflowId??"—")}),r.jsx("span",{className:"mono muted",style:{fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.id})]}),r.jsx("span",{className:"mono tabular muted",style:{width:90,flexShrink:0,fontSize:11.5},children:og(a)}),r.jsx("span",{className:"mono muted",style:{width:130,flexShrink:0,fontSize:10.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.model??"—"}),r.jsx("span",{className:"mono tabular",style:{width:70,flexShrink:0,textAlign:"right",fontSize:12},children:_l(a.totalCostUsd)}),r.jsx("span",{className:"mono muted tabular",style:{width:60,flexShrink:0,textAlign:"right",fontSize:11},children:Ir(cr(a.startedAt)??void 0)??"—"})]},a.id)),t.data&&!o.length&&r.jsx("div",{className:"muted",style:{padding:"14px",fontSize:12,borderTop:"1px solid var(--border-subtle)"},children:"No runs match this filter."})]})})]})}const sl=e=>e.split("/").filter(Boolean).pop()??e;function jp(e){return e>=85?{label:"Excellent",color:"var(--success)"}:e>=70?{label:"Good",color:"var(--node-route)"}:e>=50?{label:"Fair",color:"var(--warn)"}:{label:"Needs work",color:"var(--error)"}}function wp(e,t){const n=Cl(e.text??""),s=/REQ-[A-Z]+-\d+|[a-z][a-zA-Z]+[A-Z][a-zA-Z]+|[\w/]+\.(ts|tsx|js|jsx|md|py|rs|go)/.test(n),l=/^(read |grep |look |check |explain |tell me|why |what )/i.test(n.trim()),o=n.length>=45&&!l||n.length>=72,a=e.input_tokens+e.cache_creation_tokens+e.cache_read_tokens,i=a>0&&e.cache_read_tokens/a>=.5,c=t.some(f=>["Bash","Grep","Read"].includes(f.tool_name)&&(f.result_length??0)>3e4),d=t.some(f=>f.tool_name.includes("specship_"));let u=62;return u+=s?12:-10,u+=o?10:-9,u+=i?8:-10,u+=d||!c?9:-13,u=Math.max(14,Math.min(98,Math.round(u))),{score:u,...jp(u)}}const gs=[{key:"input",label:"Input",color:"var(--node-spec)"},{key:"output",label:"Output",color:"var(--node-code)"},{key:"cacheCreate",label:"Cache write",color:"var(--warn)"},{key:"cacheRead",label:"Cache read",color:"var(--node-route)"}],cg=e=>({input:e.input_tokens,output:e.output_tokens,cacheCreate:e.cache_creation_tokens,cacheRead:e.cache_read_tokens});function dg({query:e}){const[t,n]=z.useState(e.sel||null);return t?r.jsx(fg,{id:t,onBack:()=>n(null)}):r.jsx(ug,{onOpen:n})}function ug({onOpen:e}){const[t,n]=z.useState("week"),[s,l]=z.useState(""),[o,a]=z.useState(""),[i,c]=z.useState("cost"),d=D(()=>P.claudeStats(),[]),u=D(()=>P.claudeProjects(),[]),f=D(()=>P.claudeSessions(s||null,200,t,o||null),[s,o,t]),[m,g]=z.useState([]);z.useEffect(()=>{if(o||!f.data)return;const w=new Set;for(const h of f.data.sessions)h.last_model&&w.add(h.last_model);g([...w].sort())},[o,f.data]);const v=d.data?.sessionCount===0,p=()=>{d.reload(),f.reload(),u.reload()};return r.jsxs("div",{className:"col",style:{flex:1,minHeight:0},children:[r.jsx("div",{style:{padding:"16px 18px 12px"},children:r.jsx(Pe,{icon:"sessions",title:"Sessions",sub:f.data?`${f.data.sessions.length} sessions · ${s?sl(s):"across all projects"}`:"Loading sessions…",actions:r.jsx(Nl,{value:t,onChange:n})})}),v?r.jsx(Un,{onIngested:p}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"row gap-8",style:{padding:"0 18px 12px"},children:[r.jsx(N,{name:"filter",size:13,style:{color:"var(--text-muted)"}}),r.jsxs("select",{className:"input","aria-label":"Project filter",value:s,onChange:w=>l(w.target.value),style:{fontSize:12,padding:"4px 8px"},children:[r.jsx("option",{value:"",children:"All projects"}),(u.data?.projects??[]).map(w=>r.jsx("option",{value:w.path,children:w.name||sl(w.path)},w.path))]}),r.jsxs("select",{className:"input","aria-label":"Model filter",value:o,onChange:w=>a(w.target.value),style:{fontSize:12,padding:"4px 8px"},children:[r.jsx("option",{value:"",children:"All models"}),m.map(w=>r.jsx("option",{value:w,children:w},w))]}),r.jsx("div",{className:"grow"}),r.jsx("span",{className:"muted",style:{fontSize:11.5},children:"sort"}),r.jsx(Re,{size:"sm",label:"Sort sessions",value:i,onChange:c,options:[{value:"cost",label:"Cost"},{value:"prompts",label:"Prompts"}]})]}),r.jsx("div",{className:"scroll-y",style:{flex:1,padding:"0 18px 18px"},children:r.jsx(se,{state:f,label:"sessions",minHeight:220,children:w=>r.jsx(pg,{sessions:w.sessions,sort:i,onOpen:e})})})]})]})}function pg({sessions:e,sort:t,onOpen:n}){const s=[...e].sort((o,a)=>t==="prompts"?(a.prompt_count??0)-(o.prompt_count??0):(a.total_cost_usd??0)-(o.total_cost_usd??0));if(!s.length)return r.jsx("div",{className:"muted",style:{fontSize:12,padding:"14px 4px"},children:"No sessions in this range for these filters."});const l={fontSize:10.5,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.05em",fontWeight:600};return r.jsxs("div",{className:"card",style:{overflow:"hidden"},children:[r.jsxs("div",{className:"row",style:{padding:"8px 14px",borderBottom:"1px solid var(--border-subtle)",...l},children:[r.jsx("span",{style:{width:90},children:"Session"}),r.jsx("span",{style:{width:110},children:"Project"}),r.jsx("span",{className:"grow",children:"Window"}),r.jsx("span",{style:{width:70,textAlign:"right"},children:"Prompts"}),r.jsx("span",{style:{width:70,textAlign:"right"},children:"Cache"}),r.jsx("span",{style:{width:70,textAlign:"right"},children:"Cost"})]}),s.map(o=>{const a=op(o);return r.jsxs("div",{className:"row list-row",role:"button",tabIndex:0,onClick:()=>n(o.id),onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),n(o.id))},style:{padding:"11px 14px",borderTop:"1px solid var(--border-subtle)",cursor:"pointer"},children:[r.jsx("span",{className:"mono",style:{width:90,fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",paddingRight:8},children:o.id.slice(0,8)}),r.jsx("span",{style:{width:110,overflow:"hidden"},children:r.jsx(ne,{children:sl(o.project_path)})}),r.jsxs("span",{className:"mono muted grow",style:{fontSize:11.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[ap(o.started_at)," – ",li(o.ended_at)," · ",o.last_model?o.last_model:"—"]}),r.jsx("span",{className:"mono tabular",style:{width:70,textAlign:"right",fontSize:12},children:o.prompt_count??0}),r.jsxs("span",{className:"mono tabular",style:{width:70,textAlign:"right",fontSize:12,color:Ur(a)},children:[Math.round(a*100),"%"]}),(o.unpriced_tokens??0)>0?r.jsx("span",{className:"mono tabular",style:{width:70,textAlign:"right",fontSize:12.5,fontWeight:600,color:"var(--warn)"},title:`${o.unpriced_tokens} tokens on a model with no pricing row — cost unknown, not $0 (add pricing to heal)`,children:"unpriced ⚠"}):r.jsxs("span",{className:"mono tabular",style:{width:70,textAlign:"right",fontSize:12.5,fontWeight:600},children:["$",(o.total_cost_usd??0).toFixed(2)]})]},o.id)})]})}function fg({id:e,onBack:t}){const n=D(()=>P.claudeSession(e),[e]),s=D(()=>P.claudeSessionSummary(e),[e]);return r.jsx(se,{state:n,label:"session detail",minHeight:320,children:l=>{const o=l.session,a=new Map;for(const p of l.toolCalls){if(!p.prompt_id)continue;const w=a.get(p.prompt_id)??[];w.push(p),a.set(p.prompt_id,w)}const i=op(o),c=l.prompts.filter(p=>p.is_sidechain).reduce((p,w)=>p+(w.cost_usd??0),0);Math.max(...l.prompts.map(p=>p.cost_usd??0),0);const d={input:0,output:0,cacheCreate:0,cacheRead:0};for(const p of l.prompts){const w=cg(p);for(const h of gs)d[h.key]+=w[h.key]}const u=gs.reduce((p,w)=>p+d[w.key],0)||1,f=l.prompts.map(p=>wp(p,a.get(p.id)??[]).score),m=f.length?Math.round(f.reduce((p,w)=>p+w,0)/f.length):0,g=jp(m),v=f.filter(p=>p<60).length;return r.jsxs("div",{style:{flex:1,display:"flex",minHeight:0},children:[r.jsxs("div",{className:"scroll-y",style:{flex:1,padding:18,minWidth:0},children:[r.jsxs("div",{className:"row gap-10",style:{marginBottom:14},children:[r.jsxs("button",{className:"btn btn-ghost btn-sm",onClick:t,children:[r.jsx(N,{name:"chevronLeft",size:14}),"Sessions"]}),r.jsx("span",{className:"mono",style:{fontSize:16,fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o.id.slice(0,12)}),r.jsx(ne,{color:"var(--node-spec)",bg:"var(--node-spec-soft)",children:sl(o.project_path)}),o.last_model&&r.jsx(ne,{children:o.last_model})]}),r.jsxs("div",{className:"row",style:{gap:24,padding:"12px 0",borderTop:"1px solid var(--border-subtle)",borderBottom:"1px solid var(--border-subtle)",marginBottom:16,flexWrap:"wrap"},children:[(o.total_cost_usd??0)===0&&(o.total_input_tokens??0)+(o.total_output_tokens??0)+(o.total_cache_creation_tokens??0)+(o.total_cache_read_tokens??0)>0?r.jsx(mn,{label:"Cost",value:"unpriced ⚠",color:"var(--warn)"}):r.jsx(mn,{label:"Cost",value:"$"+(o.total_cost_usd??0).toFixed(2)}),r.jsx(mn,{label:"Prompts",value:o.prompt_count??l.prompts.length}),r.jsx(mn,{label:"Cache hit",value:Math.round(i*100)+"%",color:Ur(i)}),r.jsx(mn,{label:"Subagent $",value:"$"+c.toFixed(2),color:"var(--node-code)"}),r.jsx(mn,{label:"Window",value:ap(o.started_at)+" – "+li(o.ended_at)})]}),r.jsxs("div",{className:"row",style:{justifyContent:"space-between",marginBottom:8},children:[r.jsxs("div",{className:"eyebrow",children:["Prompt timeline · ",l.prompts.length]}),r.jsx("span",{className:"muted",style:{fontSize:11},children:"dot = prompt quality"})]}),r.jsxs("div",{className:"col gap-6",children:[l.prompts.map(p=>r.jsx(hg,{p,tools:a.get(p.id)??[]},p.id)),!l.prompts.length&&r.jsx("div",{className:"muted",style:{fontSize:12,padding:8},children:"No prompts recorded for this session."})]}),r.jsx("div",{style:{height:20}})]}),r.jsxs("div",{className:"scroll-y",style:{width:290,flexShrink:0,borderLeft:"1px solid var(--border-subtle)",background:"var(--bg-panel)",padding:16},children:[r.jsx("div",{className:"eyebrow",style:{marginBottom:10},children:"Token mix"}),r.jsx("div",{className:"row",style:{height:10,borderRadius:999,overflow:"hidden",marginBottom:10},children:gs.map(p=>r.jsx("div",{style:{width:d[p.key]/u*100+"%",height:"100%",background:p.color}},p.key))}),r.jsx("div",{className:"col gap-6",style:{marginBottom:20},children:gs.map(p=>r.jsxs("div",{className:"row gap-8",children:[r.jsx("span",{style:{width:9,height:9,borderRadius:2,background:p.color,flexShrink:0}}),r.jsx("span",{className:"muted grow",style:{fontSize:11.5},children:p.label}),r.jsx("span",{className:"mono tabular",style:{fontSize:11.5},children:U(d[p.key])}),r.jsxs("span",{className:"mono tabular muted",style:{fontSize:10,width:32,textAlign:"right"},children:[Math.round(d[p.key]/u*100),"%"]})]},p.key))}),r.jsxs("div",{style:{background:"var(--success-soft)",border:"1px solid rgba(70,194,107,0.25)",borderRadius:8,padding:"10px 12px",marginBottom:20},children:[r.jsxs("div",{className:"row gap-8",children:[r.jsx(N,{name:"database",size:13,style:{color:"var(--success)"}}),r.jsx("span",{className:"muted",style:{fontSize:10.5},children:"Cache effectiveness"})]}),r.jsxs("div",{className:"row",style:{alignItems:"baseline",gap:8,marginTop:4},children:[r.jsxs("span",{className:"tabular",style:{fontSize:24,fontWeight:700,color:"var(--success)"},children:[Math.round(i*100),"%"]}),r.jsx("span",{className:"muted",style:{fontSize:10.5},children:"of input served from cache"})]})]}),f.length>0&&r.jsxs("div",{style:{background:`color-mix(in srgb, ${g.color} 7%, var(--bg-canvas))`,border:`1px solid color-mix(in srgb, ${g.color} 30%, transparent)`,borderRadius:8,padding:"10px 12px",marginBottom:20},children:[r.jsxs("div",{className:"row gap-8",style:{marginBottom:8},children:[r.jsx(N,{name:"sparkles",size:13,style:{color:g.color}}),r.jsx("span",{className:"muted",style:{fontSize:10.5},children:"Avg prompt quality"})]}),r.jsxs("div",{className:"row",style:{alignItems:"baseline",gap:8},children:[r.jsx("span",{className:"tabular",style:{fontSize:24,fontWeight:700,color:g.color},children:m}),r.jsxs("span",{className:"muted",style:{fontSize:10.5},children:["/100 · ",g.label]})]}),r.jsx("div",{style:{margin:"8px 0 2px"},children:r.jsx(Hr,{frac:m/100,color:g.color,height:5})}),v>0&&r.jsxs("div",{className:"muted",style:{fontSize:10.5,marginTop:7},children:[r.jsxs("span",{style:{color:"var(--warn)"},children:[v," prompt",v>1?"s":""]})," could be improved — name a symbol, file or REQ id"]})]}),r.jsx(mg,{summaryState:s})]})]})}})}function hg({p:e,tools:t}){const n=wp(e,t),s=e.input_tokens+e.output_tokens+e.cache_creation_tokens+e.cache_read_tokens,l=e.input_tokens+e.cache_creation_tokens+e.cache_read_tokens,o=l>0?e.cache_read_tokens/l:0,a=(e.cost_usd??0)>2.5;return r.jsxs("div",{className:"row gap-10 list-row",style:{padding:"11px 12px",borderRadius:8,background:"var(--bg-panel)",border:"1px solid var(--border-subtle)"},children:[r.jsx("span",{className:"mono muted",style:{fontSize:10.5,width:52,flexShrink:0},children:li(e.ts)}),r.jsx("span",{title:`Prompt quality: ${n.label} (${n.score}/100)`,style:{width:8,height:8,borderRadius:"50%",background:n.color,flexShrink:0,boxShadow:`0 0 6px ${n.color}66`}}),r.jsxs("span",{className:"grow",style:{fontSize:12.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[!!e.is_sidechain&&r.jsxs(ne,{color:"var(--node-code)",bg:"var(--node-code-soft)",children:[r.jsx(N,{name:"bot",size:10}),"subagent"]}),!!e.is_sidechain&&" ",Cl(e.text??"")||r.jsx("span",{className:"muted",children:"(no text)"})]}),r.jsxs("span",{className:"row gap-4",style:{flexShrink:0},children:[r.jsx(N,{name:"wrench",size:11,style:{color:"var(--text-muted)"}}),r.jsx("span",{className:"mono tabular muted",style:{fontSize:11},children:t.length})]}),r.jsx("span",{className:"mono tabular muted",style:{fontSize:11,width:50,textAlign:"right",flexShrink:0},children:U(s)}),r.jsxs("span",{className:"mono tabular",style:{fontSize:11,width:38,textAlign:"right",flexShrink:0,color:Ur(o)},children:[Math.round(o*100),"%"]}),r.jsxs("span",{className:"mono tabular",style:{fontSize:13,fontWeight:600,width:54,textAlign:"right",flexShrink:0,color:a?"var(--error)":"var(--text-primary)"},children:["$",(e.cost_usd??0).toFixed(2)]})]})}function mg({summaryState:e}){return r.jsx(se,{state:e,label:"session summary",minHeight:120,children:t=>{const n=t.byTool.map(s=>({name:s.name,calls:s.calls,totalBytes:s.totalBytes}));return r.jsxs(r.Fragment,{children:[(t.slashCommands.length>0||t.skills.length>0)&&r.jsxs("div",{style:{marginBottom:20},children:[r.jsx("div",{className:"eyebrow",style:{marginBottom:10},children:"Commands & skills"}),r.jsxs("div",{className:"row gap-6",style:{flexWrap:"wrap"},children:[t.slashCommands.map(s=>r.jsxs("span",{className:"pill",style:{color:"var(--node-code)",background:"var(--node-code-soft)",fontFamily:"var(--font-mono)",fontWeight:500},children:[r.jsx(N,{name:"command",size:10}),s.name,s.count>1&&r.jsxs("span",{style:{opacity:.7},children:["×",s.count]})]},s.name)),t.skills.map(s=>r.jsxs("span",{className:"pill",style:{color:"var(--node-test)",background:"var(--node-test-soft)",fontFamily:"var(--font-mono)",fontWeight:500},children:[r.jsx(N,{name:"sparkles",size:10}),s.name,s.count>1&&r.jsxs("span",{style:{opacity:.7},children:["×",s.count]})]},s.name))]})]}),r.jsxs("div",{className:"eyebrow",style:{marginBottom:10},children:["Tools used · ",t.byTool.length]}),t.byTool.length?r.jsxs(r.Fragment,{children:[r.jsx(ai,{items:n,valueKey:"totalBytes",labelKey:"name",fmt:s=>U(s),color:s=>Number(s.totalBytes)>6e4?"var(--error)":Number(s.totalBytes)>2e4?"var(--warn)":"var(--node-code)"}),r.jsx("div",{className:"muted",style:{fontSize:10,marginTop:8},children:"bar = result tokens returned"})]}):r.jsx("div",{className:"muted",style:{fontSize:11.5},children:"No tool calls recorded."}),t.filesTouched.length>0&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"eyebrow",style:{margin:"20px 0 10px"},children:["Files touched · ",t.filesTouched.length]}),r.jsx("div",{className:"col gap-5",children:t.filesTouched.slice(0,10).map(s=>r.jsxs("div",{className:"row gap-8",children:[r.jsx("span",{className:"mono",style:{fontSize:10.5,color:"var(--text-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",direction:"rtl",textAlign:"left",flex:1},title:s.path,children:s.path}),r.jsxs("span",{className:"mono tabular muted",style:{fontSize:10,flexShrink:0},children:["×",s.ops]}),r.jsx("span",{className:"pill",style:{fontSize:9.5,flexShrink:0},children:s.lastOp})]},s.path))})]}),t.durationMs>0&&r.jsxs("div",{className:"row gap-8",style:{marginTop:20},children:[r.jsx(N,{name:"clock",size:12,style:{color:"var(--text-muted)"}}),r.jsx("span",{className:"muted",style:{fontSize:11},children:"duration"}),r.jsx("span",{className:"mono tabular",style:{fontSize:11.5},children:Cm(t.durationMs)})]})]})}})}const Sp="specship-density",kp="specship-boot-anim",bp="specship-editor",xg="specship-booted";function Np(){try{if(localStorage.getItem(Sp)==="compact")return"compact"}catch{}return"comfortable"}function zp(e){document.documentElement.setAttribute("data-density",e);try{localStorage.setItem(Sp,e)}catch{}window.dispatchEvent(new Event("specship-density"))}function gg(){try{return localStorage.getItem(kp)!=="0"}catch{}return!0}function vg(e){try{localStorage.setItem(kp,e?"1":"0")}catch{}window.dispatchEvent(new Event("specship-prefs"))}const Cp=[{value:"code",label:"code (VS Code)"},{value:"subl",label:"subl (Sublime)"},{value:"cursor",label:"cursor"},{value:"nvim",label:"nvim"}];function yg(){try{const e=localStorage.getItem(bp);if(Cp.some(t=>t.value===e))return e}catch{}return"code"}function jg(e){try{localStorage.setItem(bp,e)}catch{}window.dispatchEvent(new Event("specship-prefs"))}function sr({icon:e,title:t,children:n}){return r.jsxs("div",{className:"card card-pad",style:{marginBottom:14},children:[r.jsxs("div",{className:"row gap-8",style:{marginBottom:12},children:[r.jsx(N,{name:e,size:15,style:{color:"var(--text-secondary)"}}),r.jsx("div",{style:{fontSize:13,fontWeight:600},children:t})]}),n]})}function ao({label:e,hint:t,children:n}){return r.jsxs("div",{style:{padding:"8px 0"},children:[r.jsxs("div",{className:"row",style:{justifyContent:"space-between",alignItems:"baseline",marginBottom:6},children:[r.jsx("div",{style:{fontSize:12.5,fontWeight:500},children:e}),t&&r.jsx("div",{className:"muted",style:{fontSize:11},children:t})]}),n]})}function Ac({label:e,desc:t,on:n,onClick:s,busy:l}){return r.jsxs("div",{className:"row",style:{justifyContent:"space-between",padding:"8px 0"},children:[r.jsxs("div",{children:[r.jsx("div",{style:{fontSize:12.5,fontWeight:500},children:e}),r.jsx("div",{className:"muted",style:{fontSize:11},children:t})]}),r.jsx("button",{role:"switch","aria-checked":n,"aria-label":e,disabled:l,onClick:s,style:{width:38,height:22,borderRadius:11,border:"none",cursor:l?"wait":"pointer",background:n?"var(--accent)":"var(--bg-elevated)",position:"relative",flexShrink:0,transition:"background var(--motion-fast)",opacity:l?.6:1},children:r.jsx("span",{style:{position:"absolute",top:2,left:n?18:2,width:18,height:18,borderRadius:"50%",background:"#fff",transition:"left var(--motion-fast)"}})})]})}function Gt({label:e,value:t,color:n}){return r.jsxs("div",{className:"row",style:{justifyContent:"space-between",padding:"6px 0",fontSize:12.5},children:[r.jsx("span",{className:"muted",children:e}),r.jsx("span",{className:"mono",style:{color:n??"var(--text-primary)"},children:t})]})}function wg(e){const[t,n]=z.useState(kl),[s,l]=z.useState(Np),[o,a]=z.useState(gg),[i,c]=z.useState(yg),d=D(()=>P.status(e.project),[e.project]),u=ym(),[f,m]=z.useState(!1),[g,v]=z.useState(null),p=S=>{const b=S;n(b),bl(b)},w=S=>{const b=S;l(b),zp(b)},h=()=>{const S=!o;a(S),vg(S)},x=S=>{const b=S;c(b),jg(b)},j=async()=>{const S=!(u.data?.ingestEnabled??!1);m(!0),v(null);try{await P.config.set({ingestEnabled:S}),u.reload()}catch(b){v(b instanceof Error?b.message:"Failed to save")}finally{m(!1)}},y=()=>{try{sessionStorage.removeItem(xg)}catch{}location.reload()};return r.jsxs("div",{className:"scroll-y",style:{flex:1,padding:22},children:[r.jsx(Pe,{icon:"settings",title:"Settings"}),r.jsxs("div",{style:{maxWidth:640},children:[r.jsxs(sr,{icon:"sparkles",title:"Appearance",children:[r.jsx(ao,{label:"Theme",hint:"Dark, light, or follow your OS",children:r.jsx(Re,{value:t,onChange:p,options:[{value:"dark",label:"Dark"},{value:"light",label:"Light"},{value:"system",label:"System"}]})}),r.jsx(ao,{label:"Density",hint:"Row height & padding",children:r.jsx(Re,{value:s,onChange:w,options:[{value:"comfortable",label:"Comfortable"},{value:"compact",label:"Compact"}]})}),r.jsx(Ac,{label:"Boot animation",desc:"The graph-assembly splash on app launch",on:o,onClick:h}),!o&&r.jsx("div",{style:{paddingTop:4},children:r.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:y,children:[r.jsx(N,{name:"refresh",size:13})," Replay intro"]})})]}),r.jsxs(sr,{icon:"sessions",title:"Claude Code",children:[r.jsx(Ac,{label:"Enable transcript ingest",desc:"Read JSONL transcripts from ~/.claude/projects for analytics",on:u.data?.ingestEnabled??!1,onClick:j,busy:f||u.loading}),g&&r.jsx("div",{style:{fontSize:11.5,color:"var(--error)",padding:"4px 0"},children:g}),f&&r.jsx("div",{className:"muted",style:{fontSize:11.5,padding:"4px 0"},children:"Saving…"})]}),r.jsx(sr,{icon:"reveal",title:"Editor",children:r.jsx(ao,{label:"Open files with",hint:"Used by Reveal / Open in editor",children:r.jsx(Re,{value:i,onChange:x,options:Cp.map(S=>({value:S.value,label:S.label}))})})}),r.jsx(sr,{icon:"database",title:"Backend",children:r.jsx(se,{state:d,label:"Backend",minHeight:120,children:S=>r.jsxs(r.Fragment,{children:[r.jsx(Gt,{label:"Database backend",value:S.backend}),r.jsx(Gt,{label:"Journal mode",value:S.journalMode}),r.jsx(Gt,{label:"Project root",value:r.jsx("span",{title:S.projectPath,children:S.projectPath})}),r.jsx(Gt,{label:"Indexed files",value:S.fileCount.toLocaleString()})]})})}),r.jsx(sr,{icon:"graph",title:"About",children:r.jsx(se,{state:d,label:"About",minHeight:90,children:S=>r.jsxs(r.Fragment,{children:[r.jsx(Gt,{label:"Version",value:`v${S.version}`}),r.jsx(Gt,{label:"Backend",value:S.backend,color:"var(--success)"}),r.jsx(Gt,{label:"MCP server",value:"running",color:"var(--success)"})]})})})]})]})}const Ep=/^\s*<!--\s*id\s*:\s*([^\s-][^\s]*)\s*-->\s*$/,vs=/^(#{1,6})\s+(.+?)\s*$/,Bc=/^\s*[-*]\s+(.*\S)\s*$/,Jt=e=>e.replace(/\r$/,""),ys=e=>Jt(e).match(Ep)?.[1]??null;function Tp(e,t){const n=e.findIndex(p=>ys(p)===t);if(n===-1)return null;let s=-1,l=2,o="";for(let p=n+1;p<e.length;p++){const w=Jt(e[p]);if(w.trim()==="")continue;const h=w.match(vs);h&&h[1]&&h[2]&&(s=p,l=h[1].length,o=h[2]);break}if(s===-1)return null;let a=e.length;for(let p=s+1;p<e.length;p++){const w=ys(e[p]);if(w&&w!==t&&!w.startsWith(t+".")){a=p;break}}let i=-1,c=-1;for(let p=s+1;p<a;p++){const w=Jt(e[p]),h=w.match(vs);if(h&&h[2]&&h[2].trim().toLowerCase()==="acceptance"||ys(e[p])){i=p;break}c===-1&&w.trim().startsWith("implementations:")&&(c=p)}const d=c!==-1?c:i!==-1?i:a,u=e.slice(s+1,d).map(Jt).join(`
46
- `).trim(),f=i!==-1?i:a,m=c!==-1?e.slice(c,f):[];for(;m.length&&Jt(m[m.length-1]).trim()==="";)m.pop();const g=[];let v=null;if(i!==-1){let p=null;for(let w=i;w<a;w++){const h=Jt(e[w]),x=ys(e[w]);if(x){p=x;continue}const j=h.match(vs);if(j&&j[2]&&j[2].trim().toLowerCase()==="acceptance"){v===null&&(v=h);continue}const y=h.match(Bc);if(y&&y[1]){const S=[y[1].trim()];for(;w+1<a;){const b=Jt(e[w+1]);if(b.trim()===""||Ep.test(b)||vs.test(b)||Bc.test(b))break;S.push(b.trim()),w++}g.push({id:p??"",text:S.join(" ").trim()}),p=null}}}return{start:n,end:a,headingIdx:s,headingLevel:l,title:o,statement:u,middle:m,acceptanceHeading:v,criteria:g}}function _p(e,t){const n=Tp(e.split(`
47
- `),t);if(!n)return null;const{title:s,headingLevel:l,statement:o,criteria:a}=n;return{title:s,headingLevel:l,statement:o,criteria:a}}function Sg(e){return{title:e.title.trim(),statement:e.statement.trim(),criteria:e.criteria.map(t=>({text:t.text.trim()})).filter(t=>t.text.length>0)}}function kg(e,t,n){const s=e.split(`
48
- `),l=Tp(s,t);if(!l)return null;const o=[s[l.start],"#".repeat(l.headingLevel)+" "+n.title,""];return n.statement&&o.push(...n.statement.split(`
49
- `),""),l.middle.length&&o.push(...l.middle,""),n.criteria.length&&(o.push(l.acceptanceHeading??"## Acceptance"),n.criteria.forEach((a,i)=>{o.push(`<!-- id: ${t}.A${i+1} -->`,`- ${a.text}`)}),o.push("")),[...s.slice(0,l.start),...o,...s.slice(l.end)].join(`
50
- `)}function Rs(e){let t=String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");return t=t.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),t=t.replace(/`([^`]+?)`/g,"<code class='sp-code'>$1</code>"),t=t.replace(/\b(MUST NOT|MUST|SHALL NOT|SHALL|REQUIRED)\b/g,"<span class='sp-kw sp-kw-must'>$1</span>"),t=t.replace(/\b(SHOULD NOT|SHOULD|RECOMMENDED)\b/g,"<span class='sp-kw sp-kw-should'>$1</span>"),t=t.replace(/\b(MAY|OPTIONAL)\b/g,"<span class='sp-kw sp-kw-may'>$1</span>"),t}const bg=new Set(["verified","implemented","completed"]);function ll(e,t){if(!e||!e.length)return t;const n=e.map(s=>s.state);return n.includes("broken")?"broken":n.includes("orphaned")?"orphaned":n.includes("drifted")?"drifted":n.every(s=>s==="verified")?"verified":"implemented"}const Ng={verified:"check",implemented:"check",completed:"check",drifted:"drift",broken:"cancel",orphaned:"cancel",failed:"cancel"};function zg({state:e}){const t=ue[e]??ue.info,n=Ng[e];return r.jsx("div",{className:"sp-crit-mark",style:{background:t.bg,color:t.color},children:n?r.jsx(N,{name:n,size:12}):r.jsx("span",{style:{width:7,height:7,borderRadius:"50%",border:"1.6px solid "+t.color,boxSizing:"border-box"}})})}function Wc(e){const t=e.lastIndexOf(".");return t===-1?e:e.slice(t+1)}function Cg(e){return ue[e]?.label??e}function Eg({id:e,project:t,cache:n}){return e?r.jsx(_g,{id:e,project:t,cache:n}):r.jsx(Tg,{})}function Tg(){return r.jsx(ce,{icon:"book",title:"Pick a spec from the tree",body:"Or run specship init -i to index your specs/ folder if you haven’t yet.",action:r.jsxs("span",{className:"row gap-6",style:{justifyContent:"center"},children:[r.jsx("code",{className:"mono",style:{fontSize:11.5,color:"var(--accent)",background:"var(--bg-canvas)",padding:"5px 10px",borderRadius:6,border:"1px solid var(--border-subtle)"},children:"specship init -i"}),r.jsx(dt,{text:"specship init -i"})]})})}function _g({id:e,project:t,cache:n}){const s=(t??"")+"|"+e,l=D(async()=>{const u=await P.spec(e,t);return n?.set(s,u),u},[e,t]),o=l.data??n?.get(s)??null,[a,i]=z.useState(!1),[c,d]=z.useState(null);return z.useEffect(()=>{i(!1),d(null)},[e]),o?a?r.jsx(Fg,{data:o,project:t,onCancel:()=>i(!1),onSaved:u=>{i(!1),d(u),l.reload()}}):r.jsx(Rg,{data:o,notice:c,onEdit:()=>{d(null),i(!0)}}):l.loading?r.jsx(Mg,{}):Vt(l.error)?r.jsx(ce,{icon:"folder",title:"No project selected",body:"Pick an indexed project from the switcher in the status strip."}):r.jsx(ce,{icon:"drift",title:`Couldn’t load ${e}`,body:l.error instanceof Error?l.error.message:"The spec detail request failed.",action:r.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:l.reload,children:[r.jsx(N,{name:"refresh",size:13}),"Retry"]})})}function Mg(){return r.jsx("div",{className:"scroll-y",style:{flex:1,padding:"28px 32px 56px"},"data-testid":"spec-skeleton",children:r.jsxs("div",{className:"sp-doc",children:[r.jsx("div",{className:"skel",style:{width:230,height:12,marginBottom:20}}),r.jsx("div",{className:"skel",style:{width:"72%",height:28,marginBottom:16}}),r.jsx("div",{className:"skel",style:{width:340,height:20,marginBottom:32}}),r.jsx("div",{className:"skel",style:{width:"100%",height:96,marginBottom:30}}),r.jsx("div",{className:"skel",style:{width:"100%",height:132,marginBottom:30}}),r.jsx("div",{className:"skel",style:{width:"100%",height:56}})]})})}function Rg({data:e,notice:t,onEdit:n}){const{spec:s,parent:l,children:o,links:a,childLinks:i}=e,c=l?.sourcePath??s.sourcePath??"",d=e.source!=null&&_p(e.source,s.id)!=null,u=d?"Edit this requirement in place":e.source==null?"Source file not available":"Couldn’t locate this requirement’s section in the source file",f=o.filter(b=>b.kind==="acceptance"),m=b=>ll(i[b.id],"pending"),g=ll(a,"drafted"),v=f.filter(b=>bg.has(m(b))).length,p=(ue[g]??ue.info).color,w=g==="verified"?Ir(a.reduce((b,C)=>Math.max(b,C.updatedAt??0),0)||void 0):null,h=g==="verified"?"var(--success)":g==="broken"||g==="drifted"||g==="orphaned"?"var(--warn)":"var(--text-secondary)",x=typeof s.metadata?.rationale=="string"?s.metadata.rationale:typeof s.rationale=="string"?s.rationale:null,j=b=>[b.targetFilePath,b.targetQualifiedName].filter(Boolean).join(":")||"—",y=b=>A("graph",{query:{focus:b.resolvedNodeId||"spec:"+s.id}}),S=r.jsx("span",{className:"sep"});return r.jsx("div",{className:"scroll-y",style:{flex:1,padding:"28px 32px 56px"},children:r.jsxs("div",{className:"sp-doc",children:[t!=null&&r.jsxs("div",{className:"card card-pad row gap-8",style:{color:"var(--warn)",borderColor:"var(--warn)",marginBottom:20,fontSize:12.5},children:[r.jsx(N,{name:"drift",size:14,style:{flexShrink:0}}),r.jsxs("span",{children:["Saved, but not yet indexed — re-sync failed (",t,"). The file is on disk; the next sync picks it up."]})]}),r.jsxs("div",{className:"sp-breadcrumb",children:[r.jsx(N,{name:"book",size:13,style:{color:"var(--node-spec)",flexShrink:0}}),r.jsx("span",{className:"mono sp-path",style:{color:"var(--text-secondary)"},children:c}),r.jsx(N,{name:"chevronRight",size:11,style:{flexShrink:0}}),r.jsx("span",{className:"mono",style:{color:"var(--node-spec)",fontWeight:600,flexShrink:0},children:s.id}),r.jsx(dt,{text:s.id,ariaLabel:"Copy spec id"})]}),r.jsx("h1",{className:"sp-title",children:s.title}),r.jsxs("div",{className:"sp-metaline",style:{marginBottom:32},children:[r.jsx(Ue,{state:g,pulse:g==="broken"||g==="drifted"}),r.jsx(ne,{children:s.priority||"—"}),S,r.jsx("span",{className:"fact",children:r.jsx("b",{children:s.kind||"requirement"})}),S,r.jsxs("span",{className:"fact",children:["owned by ",r.jsx("b",{className:"mono",children:s.owner||"—"})]}),S,r.jsxs("span",{className:"fact",children:[g==="verified"?"verified ":null,r.jsx("b",{style:{color:h},children:w?w+" ago":"—"})]})]}),r.jsxs("div",{className:"sp-sec",children:[r.jsx("div",{className:"sp-label",children:"Requirement"}),r.jsx("div",{className:"sp-statement lead",style:{"--sp-accent":p},children:s.body?.trim()?r.jsx("div",{className:"sp-prose",dangerouslySetInnerHTML:{__html:Rs(s.body)}}):r.jsx("div",{className:"muted",style:{fontSize:13},children:"No normative statement recorded."})})]}),x&&r.jsxs("div",{className:"sp-sec",children:[r.jsx("div",{className:"sp-label",children:"Why it matters"}),r.jsx("div",{className:"sp-rationale",dangerouslySetInnerHTML:{__html:Rs(x)}})]}),f.length>0&&r.jsxs("div",{className:"sp-sec",children:[r.jsxs("div",{className:"sp-label",children:["Acceptance criteria",r.jsx("span",{className:"ct tabular",style:{color:v===f.length?"var(--success)":"var(--text-muted)"},children:v+" / "+f.length+" met"})]}),r.jsx("div",{className:"row gap-4",style:{marginBottom:12},children:f.map(b=>{const C=m(b),_=ue[C]??ue.info;return r.jsx("div",{title:Wc(b.id)+" · "+Cg(C),style:{flex:1,height:4,borderRadius:999,background:_.color,opacity:C==="pending"?.25:.9}},b.id)})}),r.jsx("div",{className:"card",style:{overflow:"hidden"},children:f.map(b=>r.jsxs("div",{className:"sp-crit",children:[r.jsx(zg,{state:m(b)}),r.jsx("span",{className:"sp-crit-id",children:Wc(b.id)}),r.jsx("span",{className:"sp-crit-text",dangerouslySetInnerHTML:{__html:Rs(b.body||b.title)}})]},b.id))})]}),r.jsxs("div",{className:"sp-sec",children:[r.jsxs("div",{className:"sp-label",children:["Linked code",a.length>0&&r.jsx("span",{className:"ct",children:a.length+(a.length===1?" symbol":" symbols")})]}),a.length?r.jsx("div",{className:"card",style:{overflow:"hidden"},children:a.map((b,C)=>r.jsxs("div",{className:"row gap-10",style:{padding:"11px 14px",borderTop:C?"1px solid var(--border-subtle)":"none"},children:[r.jsx(Ue,{state:b.state}),b.driftAxis&&r.jsx(ne,{color:"var(--warn)",bg:"var(--warn-soft)",children:b.driftAxis+" drift"}),r.jsx("span",{className:"mono grow",style:{fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:j(b)}),r.jsx(ne,{children:b.provenance||"—"}),r.jsxs("button",{className:"btn btn-ghost btn-xs",onClick:()=>y(b),title:"Reveal in the graph",children:[r.jsx(N,{name:"reveal",size:12}),"Reveal"]})]},C))}):r.jsxs("div",{className:"card card-pad",style:{textAlign:"center",color:"var(--error)",borderColor:"rgba(242,85,90,0.3)"},children:[r.jsx(N,{name:"drift",size:16}),r.jsx("div",{style:{marginTop:6,fontSize:12.5},children:"Orphaned — no code implements this requirement yet"})]})]}),r.jsxs("div",{className:"row gap-8",style:{flexWrap:"wrap",marginTop:4},children:[r.jsxs("button",{className:"btn btn-primary btn-sm",disabled:!0,title:"Run automatically by the implementation workflow once Drafted",children:[r.jsx(N,{name:"play",size:13}),"Implement"]}),r.jsxs("button",{className:"btn btn-secondary btn-sm",disabled:!0,title:"Run automatically by the verification workflow",children:[r.jsx(N,{name:"check",size:13}),"Verify"]}),r.jsxs("button",{className:"btn btn-secondary btn-sm",disabled:!d,title:u,onClick:d?n:void 0,children:[r.jsx(N,{name:"reveal",size:13}),"Edit spec"]}),r.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:()=>A("graph",{query:{focus:"spec:"+s.id}}),children:[r.jsx(N,{name:"graph",size:13}),"Show in graph"]})]})]})})}const Pg=["pending","implementing","implemented","verified","drifted","broken"],Lg=["P0","P1","P2","P3"],Dg=["requirement","constraint","guideline","invariant","non-functional"];function Ig(e,t){const{spec:n,childLinks:s}=e,l=typeof n.metadata?.rationale=="string"?n.metadata.rationale:typeof n.rationale=="string"?n.rationale:"";return{title:t.title,priority:n.priority??"",kind:n.kind??"requirement",owner:n.owner??"",statement:t.statement,rationale:l,criteria:t.criteria.map(o=>({id:o.id,state:ll(s[o.id],"pending"),text:o.text}))}}const Og={title:"",priority:"",kind:"requirement",owner:"",statement:"",rationale:"",criteria:[]};function gn({label:e,hint:t,children:n}){return r.jsxs("div",{style:{marginBottom:22},children:[r.jsx("label",{className:"sp-fl",children:e}),n,t&&r.jsx("div",{className:"muted",style:{fontSize:11,marginTop:6},children:t})]})}function Ag({value:e,onChange:t,options:n,label:s}){const l=n.includes(e)?n:[e,...n];return r.jsx("select",{className:"input sp-select","aria-label":s,value:e,onChange:o=>t(o.target.value),style:{width:"100%",textTransform:"capitalize"},children:l.map(o=>r.jsx("option",{value:o,children:o},o))})}function Bg({value:e,onChange:t,options:n,width:s,label:l}){const o=ue[e]??ue.info;return r.jsxs("div",{className:"row",style:{position:"relative",width:s??"auto",flexShrink:0},children:[r.jsx("span",{className:"pill-dot","data-testid":"crit-state-dot",style:{background:o.color,position:"absolute",left:11,pointerEvents:"none",zIndex:1}}),r.jsx("select",{className:"input sp-select","aria-label":l,value:e,onChange:a=>t(a.target.value),style:{width:"100%",paddingLeft:26,textTransform:"capitalize"},children:n.map(a=>r.jsx("option",{value:a,children:ue[a]?.label??a},a))})]})}function Wg({state:e}){return r.jsxs("div",{className:"sp-status-auto",children:[e==="drafted"?r.jsxs(r.Fragment,{children:[r.jsx(Ue,{state:"drafted"}),r.jsx("span",{className:"muted",style:{fontSize:12},children:"queued for implementation"})]}):r.jsxs(r.Fragment,{children:[r.jsx(Ue,{state:e}),r.jsx(N,{name:"arrowRight",size:13,style:{color:"var(--text-muted)",flexShrink:0}}),r.jsx(Ue,{state:"drafted"})]}),r.jsx("span",{className:"grow"}),r.jsx(N,{name:"lock",size:12,style:{color:"var(--text-faint)",flexShrink:0}})]})}function $g({criteria:e,onChange:t}){const n=(s,l)=>t(e.map((o,a)=>a===s?{...o,...l}:o));return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"row",style:{marginBottom:10,gap:10},children:[r.jsx("span",{className:"eyebrow",children:"Acceptance criteria"}),r.jsx("span",{style:{flex:1,height:1,background:"var(--border-subtle)"}}),r.jsx("span",{className:"mono tabular muted",style:{fontSize:11.5},children:e.length+" total"})]}),r.jsx("div",{className:"card",style:{overflow:"hidden",marginBottom:12},children:e.length===0?r.jsx("div",{className:"muted",style:{fontSize:12.5,textAlign:"center",padding:"18px 14px"},children:"No criteria yet — add one below."}):e.map((s,l)=>r.jsxs("div",{className:"sp-crit-edit",children:[r.jsx("span",{className:"sp-crit-grip",children:r.jsx(N,{name:"grip",size:14})}),r.jsx("span",{className:"sp-crit-num",children:"A"+(l+1)}),r.jsx(Bg,{value:s.state,onChange:o=>n(l,{state:o}),options:Pg,width:156,label:"Criterion A"+(l+1)+" state"}),r.jsx("input",{className:"input grow",style:{fontSize:13},value:s.text,"aria-label":"Criterion A"+(l+1)+" text",placeholder:"Observable, testable condition…",onChange:o=>n(l,{text:o.target.value})}),r.jsx("button",{className:"sp-icon-btn",title:"Remove criterion","aria-label":"Remove criterion A"+(l+1),onClick:()=>t(e.filter((o,a)=>a!==l)),children:r.jsx(N,{name:"trash",size:14})})]},l))}),r.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:()=>t([...e,{id:"",state:"pending",text:""}]),children:[r.jsx(N,{name:"plus",size:13}),"Add criterion"]})]})}function Fg({data:e,project:t,onCancel:n,onSaved:s}){const{spec:l}=e,o=e.parent?.sourcePath??l.sourcePath??"",a=z.useMemo(()=>_p(e.source??"",l.id),[e.source,l.id]),[i,c]=z.useState(()=>a?Ig(e,a):Og),d=z.useRef(JSON.stringify(i)),u=JSON.stringify(i)!==d.current,[f,m]=z.useState("write"),[g,v]=z.useState(!1),[p,w]=z.useState(null),h=b=>c(C=>({...C,...b})),x=ll(e.links,"drafted"),j=(ue[x]??ue.info).color;if(!a)return r.jsx(ce,{icon:"drift",title:"Can’t edit this spec",body:"Its requirement section couldn’t be located in the source file."});const y=async()=>{if(!u||g)return;const b=Sg({title:i.title,statement:i.statement,criteria:i.criteria}),C=kg(e.source??"",l.id,b);if(C===null){w("Could not locate this requirement’s section in the source file.");return}v(!0),w(null);try{const _=await P.specSave(l.id,C,t);s(_.syncError??null)}catch(_){w(_ instanceof Error?_.message:String(_)),v(!1)}},S=r.jsxs("button",{className:"btn btn-primary btn-sm",disabled:!u||g,onClick:y,children:[r.jsx(N,{name:"check",size:13}),g?"Saving…":"Save changes"]});return r.jsxs("div",{className:"col",style:{flex:1,minHeight:0},children:[r.jsxs("div",{className:"sp-edit-bar",children:[r.jsx(N,{name:"reveal",size:15,style:{color:"var(--accent)",flexShrink:0}}),r.jsxs("div",{className:"col",style:{gap:1,minWidth:0},children:[r.jsx("div",{style:{fontSize:13,fontWeight:600},children:"Editing spec"}),r.jsx("div",{className:"mono muted",style:{fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o+" · "+l.id})]}),r.jsx("div",{className:"grow"}),u&&r.jsxs("div",{className:"row gap-6",style:{marginRight:4},children:[r.jsx("span",{className:"sp-dirty-dot"}),r.jsx("span",{className:"muted",style:{fontSize:11.5},children:"Unsaved changes"})]}),r.jsxs("button",{className:"btn btn-ghost btn-sm",onClick:n,children:[r.jsx(N,{name:"x",size:13}),"Cancel"]}),S]}),r.jsx("div",{className:"scroll-y",style:{flex:1,padding:"24px 28px 56px"},children:r.jsxs("div",{style:{maxWidth:780},children:[p&&r.jsxs("div",{className:"card card-pad row gap-8",role:"alert",style:{color:"var(--error)",borderColor:"rgba(242,85,90,0.35)",marginBottom:18,fontSize:12.5},children:[r.jsx(N,{name:"cancel",size:14,style:{flexShrink:0}}),r.jsxs("span",{children:["Save failed — ",p," Your draft is intact."]})]}),r.jsx(gn,{label:"Title",children:r.jsx("input",{className:"input sp-input-lg",value:i.title,"aria-label":"Title",placeholder:"Short, imperative requirement title",onChange:b=>h({title:b.target.value})})}),r.jsxs("div",{className:"sp-edit-grid",children:[r.jsx(gn,{label:"Status",hint:"Set automatically — saving re-queues this spec as Drafted so the implementation workflow picks it up.",children:r.jsx(Wg,{state:x})}),r.jsx(gn,{label:"Priority",children:r.jsx(Re,{options:Lg,value:i.priority,onChange:b=>h({priority:b}),label:"Priority"})}),r.jsx(gn,{label:"Kind",children:r.jsx(Ag,{value:i.kind,onChange:b=>h({kind:b}),options:Dg,label:"Kind"})}),r.jsx(gn,{label:"Owner",children:r.jsx("input",{className:"input mono",style:{width:"100%"},value:i.owner,"aria-label":"Owner",placeholder:"unassigned",onChange:b=>h({owner:b.target.value})})})]}),r.jsx("div",{className:"muted",style:{fontSize:11,margin:"-8px 0 22px"},children:"Priority, kind, and owner are document-level in the current spec format — they render from available data but aren’t persisted per-requirement yet."}),r.jsxs("div",{style:{marginBottom:22},children:[r.jsxs("div",{className:"row",style:{marginBottom:7},children:[r.jsx("label",{className:"sp-fl",style:{marginBottom:0},children:"Normative statement"}),r.jsx("div",{className:"grow"}),r.jsx(Re,{size:"sm",options:[{value:"write",label:"Write"},{value:"preview",label:"Preview"}],value:f,onChange:m,label:"Statement editor mode"})]}),f==="write"?r.jsx("textarea",{className:"input sp-textarea",value:i.statement,spellCheck:!1,"aria-label":"Normative statement",placeholder:"The server MUST validate … (use MUST / SHOULD / MAY, **bold**, and `code`)",onChange:b=>h({statement:b.target.value})}):r.jsx("div",{className:"sp-statement",style:{"--sp-accent":j},children:i.statement.trim()?r.jsx("div",{className:"sp-prose",dangerouslySetInnerHTML:{__html:Rs(i.statement)}}):r.jsx("div",{className:"muted",style:{fontSize:13},children:"Nothing to preview yet."})}),r.jsxs("div",{className:"sp-kw-legend",children:[r.jsx("span",{className:"label",children:"Keywords:"}),r.jsx("span",{className:"sp-kw sp-kw-must",children:"MUST"}),r.jsx("span",{className:"sp-kw sp-kw-should",children:"SHOULD"}),r.jsx("span",{className:"sp-kw sp-kw-may",children:"MAY"}),r.jsx("span",{className:"label",style:{marginLeft:4},children:"auto-highlight as you type"})]})]}),r.jsx(gn,{label:"Rationale",hint:"Optional — why this requirement exists. Presentation-only today: the spec format carries no per-requirement rationale field.",children:r.jsx("textarea",{className:"input sp-textarea",value:i.rationale,spellCheck:!1,style:{minHeight:84},"aria-label":"Rationale",placeholder:"Why does this matter? What breaks without it?",onChange:b=>h({rationale:b.target.value})})}),r.jsx($g,{criteria:i.criteria,onChange:b=>h({criteria:b})}),r.jsxs("div",{className:"row",style:{gap:10,marginTop:32,paddingTop:20,borderTop:"1px solid var(--border-subtle)"},children:[S,r.jsx("button",{className:"btn btn-ghost btn-sm",onClick:n,children:"Cancel"}),r.jsx("div",{className:"grow"}),r.jsx("span",{className:"mono muted",style:{fontSize:11},children:u?"edited":"no changes"})]})]})})]})}function $c(e){return t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),e())}}function Hg(e){const t=new Map,n=new Map(e.map(l=>[l.id,l])),s=(l,o)=>{let a=t.get(l);return a||(a={doc:o,path:l,reqs:[]},t.set(l,a)),o&&!a.doc&&(a.doc=o),a};for(const l of e)l.kind==="document"&&s(l.sourcePath??l.id,l);for(const l of e){if(l.kind!=="requirement")continue;const o=l.parentId?n.get(l.parentId):void 0,a=o?.sourcePath??l.sourcePath??"(unknown)";s(a,o?.kind==="document"?o:null).reqs.push(l)}return[...t.values()]}const Ug=["verified","implemented","drifted","broken","orphaned"];function Vg({project:e,param:t,query:n}){const s=D(()=>P.specs(e),[e]),[l,o]=z.useState(t??n.sel??null);z.useEffect(()=>{const p=t??n.sel;p&&o(p)},[t,n.sel]);const[a,i]=z.useState(new Set),c=z.useRef(new Map).current,d=z.useMemo(()=>Hg(s.data?.specs??[]),[s.data]),u=s.data?.linkStates??{};if(Vt(s.error))return r.jsx(ce,{icon:"folder",title:"No project selected",body:"Pick an indexed project from the switcher in the status strip."});const f=d.reduce((p,w)=>p+w.reqs.length,0),m={};for(const p of d)for(const w of p.reqs){const h=u[w.id];h&&(m[h]=(m[h]??0)+1)}const g=p=>{const w=u[p.id];return!!w&&a.has(w)},v=p=>i(w=>{const h=new Set(w);return h.has(p)?h.delete(p):h.add(p),h});return r.jsxs("div",{style:{flex:1,display:"flex",minHeight:0},children:[r.jsxs("div",{className:"col",style:{width:280,flexShrink:0,borderRight:"1px solid var(--border-subtle)",background:"var(--bg-panel)"},children:[r.jsxs("div",{className:"row",style:{gap:8,padding:"11px 12px",borderBottom:"1px solid var(--border-subtle)"},children:[r.jsx(N,{name:"book",size:15,style:{color:"var(--accent)"}}),r.jsx("span",{style:{fontWeight:600,fontSize:13},children:"Specs"}),r.jsx("span",{className:"grow"}),r.jsx("span",{className:"muted tabular",style:{fontSize:11},children:s.data?f+" reqs":"…"})]}),r.jsxs("div",{className:"row",style:{gap:5,padding:"8px 10px",flexWrap:"wrap",borderBottom:"1px solid var(--border-subtle)"},children:[r.jsx(N,{name:"filter",size:12,style:{color:"var(--text-muted)",flexShrink:0}}),Ug.map(p=>{const w=!a.has(p),h=ue[p];return r.jsxs("button",{onClick:()=>v(p),className:"row gap-4",style:{height:22,padding:"0 8px",borderRadius:999,fontSize:10.5,fontWeight:500,cursor:"pointer",textTransform:"capitalize",border:"1px solid "+(w?"transparent":"var(--border-subtle)"),background:w?h.bg:"var(--bg-panel)",color:w?h.color:"var(--text-muted)"},children:[p,r.jsx("span",{className:"tabular",style:{opacity:.7},children:m[p]??0})]},p)})]}),r.jsxs("div",{className:"scroll-y",style:{flex:1,padding:6},role:d.length?"tree":void 0,"aria-label":d.length?"Spec tree":void 0,children:[s.data&&!d.length&&r.jsx(ce,{icon:"book",title:"No specs yet",body:"Author one with the spec-author skill — specs/*.md index on sync."}),d.map(p=>r.jsx(Kg,{group:p,linkStates:u,selId:l,hidden:g,onSel:o},p.path))]})]}),r.jsx("div",{className:"col",style:{flex:1,minWidth:0},children:r.jsx(Eg,{id:l,project:e,cache:c},l??"")})]})}function Kg({group:e,linkStates:t,selId:n,hidden:s,onSel:l}){const[o,a]=z.useState(!0),i=e.reqs.filter(d=>!s(d)),c=e.reqs.filter(d=>["drifted","broken","orphaned"].includes(t[d.id]??"")).length;return r.jsxs("div",{children:[r.jsxs("div",{onClick:()=>a(!o),onKeyDown:$c(()=>a(!o)),role:"treeitem","aria-expanded":o,tabIndex:0,className:"row gap-6 list-row",style:{padding:"6px 8px",borderRadius:6,cursor:"pointer",color:"var(--text-secondary)"},children:[r.jsx(N,{name:o?"chevronDown":"chevronRight",size:12,style:{color:"var(--text-muted)"}}),r.jsx(N,{name:"book",size:13,style:{color:"var(--node-spec)"}}),r.jsx("span",{className:"mono grow",style:{fontSize:12,color:"var(--text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.path.replace(/^specs\//,"")}),c>0&&r.jsx("span",{className:"pill",style:{fontSize:9.5,color:"var(--warn)",background:"var(--warn-soft)"},children:c})]}),o&&i.length>0&&r.jsx("div",{role:"group",style:{marginLeft:14,borderLeft:"1px solid var(--border-subtle)",paddingLeft:6},children:i.map(d=>{const u=n===d.id,f=ue[t[d.id]??""]??ue.drafted;return r.jsxs("div",{onClick:()=>l(d.id),onKeyDown:$c(()=>l(d.id)),role:"treeitem","aria-selected":u,tabIndex:0,className:"row gap-6 list-row"+(u?" selected":""),style:{padding:"5px 8px",borderRadius:6,cursor:"pointer"},children:[r.jsx("span",{className:"pill-dot",style:{background:f.color,flexShrink:0}}),r.jsxs("div",{className:"grow",style:{minWidth:0},children:[r.jsx("div",{className:"mono",style:{fontSize:11,color:u?"var(--accent)":"var(--text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.id}),r.jsx("div",{className:"muted",style:{fontSize:10.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.title})]})]},d.id)})})]})}const Fc={error:0,warn:1,info:2},Qg=e=>e==="error"?"var(--error)":e==="warn"?"var(--warn)":"var(--info)";function Yg({query:e,tips:t,onSetTipState:n}){const s=D(()=>P.claudeStats(),[]),l=s.data?.sessionCount===0,o=e.sel,a=t.data?.tips??[],i=[...a].sort((d,u)=>(Fc[d.severity]??9)-(Fc[u.severity]??9)),c=d=>a.filter(u=>u.severity===d&&u.state!=="applied").length;return r.jsxs("div",{className:"scroll-y",style:{flex:1,padding:18},children:[r.jsx(Pe,{icon:"tips",title:"Tips",sub:"A senior teammate reviewed your transcripts",actions:a.length>0&&r.jsxs("div",{className:"row gap-6",children:[r.jsxs(ne,{color:"var(--error)",bg:"var(--error-soft)",children:[c("error")," urgent"]}),r.jsxs(ne,{color:"var(--warn)",bg:"var(--warn-soft)",children:[c("warn")," warn"]}),r.jsxs(ne,{color:"var(--info)",bg:"var(--info-soft)",children:[c("info")," info"]})]})}),l&&!a.length?r.jsx(Un,{onIngested:()=>{s.reload(),t.reload()}}):r.jsx(se,{state:t,label:"tips",minHeight:240,children:d=>d.tips.length?r.jsx("div",{className:"col gap-12",style:{maxWidth:860},children:i.map(u=>r.jsx(Gg,{tip:u,focus:u.id===o,onApply:()=>n(u.id,"applied"),onDismiss:()=>n(u.id,"dismissed")},u.id))}):r.jsx("div",{className:"muted",style:{fontSize:12.5,padding:8},children:"No tips — nothing wasteful in your recent sessions."})})]})}function Gg({tip:e,focus:t,onApply:n,onDismiss:s}){const[l,o]=z.useState(!1),a=z.useRef(null);z.useEffect(()=>{if(!t||!a.current)return;const d=a.current,u=d.closest(".scroll-y");u&&(u.scrollTop=Math.max(0,d.offsetTop-20)),o(!0);const f=setTimeout(()=>o(!1),1800);return()=>clearTimeout(f)},[t]);const i=Qg(e.severity),c=e.state==="applied";return r.jsxs("div",{ref:a,className:"card",style:{display:"flex",opacity:c?.7:1,transition:"box-shadow var(--motion-fast), border-color var(--motion-fast)",boxShadow:l?`0 0 0 2px ${i}`:"none",borderColor:l?i:void 0},children:[r.jsx("div",{style:{width:3,background:i,flexShrink:0,borderRadius:"9px 0 0 9px"}}),r.jsxs("div",{style:{padding:"14px 16px",flex:1,minWidth:0},children:[r.jsxs("div",{className:"row gap-10",style:{marginBottom:10},children:[r.jsx("div",{style:{width:28,height:28,borderRadius:8,background:`color-mix(in srgb, ${i} 16%, transparent)`,display:"grid",placeItems:"center",color:i,flexShrink:0},children:r.jsx(N,{name:e.icon,size:15})}),r.jsx("div",{className:"grow",style:{minWidth:0},children:r.jsx("div",{style:{fontSize:14,fontWeight:600,letterSpacing:"-0.01em",textWrap:"pretty"},children:e.title})}),r.jsx(ne,{color:i,bg:`color-mix(in srgb, ${i} 14%, transparent)`,children:e.severity})]}),r.jsx("div",{className:"secondary",style:{fontSize:12.5,lineHeight:1.6,marginBottom:12},children:e.why}),r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10,marginBottom:14},children:[r.jsxs("div",{onClick:()=>A("sessions",{query:{sel:e.evidence.session}}),role:"button",tabIndex:0,onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),A("sessions",{query:{sel:e.evidence.session}}))},title:"Open session "+e.evidence.session,className:"list-row",style:{background:"var(--bg-canvas)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:10,cursor:"pointer"},children:[r.jsxs("div",{className:"row gap-6",style:{marginBottom:5},children:[r.jsx("span",{className:"eyebrow",children:"Evidence"}),r.jsx("span",{className:"grow"}),r.jsx(N,{name:"arrowRight",size:11,style:{color:"var(--text-muted)"}})]}),r.jsxs("div",{className:"row gap-6",style:{fontSize:11.5},children:[r.jsx(N,{name:"sessions",size:11,style:{color:"var(--text-muted)"}}),r.jsx("span",{className:"mono",style:{color:"var(--accent)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.evidence.session})]}),r.jsx("div",{className:"mono secondary",style:{fontSize:11,marginTop:4,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.evidence.detail})]}),r.jsxs("div",{style:{background:"var(--bg-canvas)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:10},children:[r.jsx("div",{className:"eyebrow",style:{marginBottom:5},children:"Impact"}),r.jsx("div",{className:"tabular",style:{fontSize:16,fontWeight:700,color:"var(--success)"},children:e.saving})]})]}),r.jsxs("div",{className:"row gap-8",style:{alignItems:"center"},children:[r.jsxs("div",{className:"row gap-8 grow",style:{background:"var(--bg-canvas)",border:"1px solid var(--border-subtle)",borderRadius:7,padding:"6px 10px",minWidth:0},children:[r.jsx("span",{className:"muted",style:{fontSize:10.5,flexShrink:0},children:"fix"}),r.jsx("code",{className:"mono grow",style:{fontSize:11.5,color:"var(--text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.fix}),r.jsx(dt,{text:e.fix})]}),c?r.jsxs("span",{className:"pill",style:{color:"var(--success)",background:"var(--success-soft)"},children:[r.jsx(N,{name:"check",size:11}),"Applied"]}):r.jsx("button",{className:"btn btn-primary btn-sm",onClick:n,title:"Mark applied",children:"Apply"}),r.jsx("button",{className:"btn btn-secondary btn-sm",onClick:s,title:"Dismiss — this tip won't come back",children:"Dismiss"})]})]})]})}const qg={bundled:"var(--node-spec)",global:"var(--node-code)",project:"var(--node-route)"};function Xg({project:e,query:t}){const n=D(()=>P.workflows(e),[e]),s=n.data?.workflows??[],[l,o]=z.useState(t.run??null);if(Vt(n.error))return r.jsx(ce,{icon:"folder",title:"No project selected",body:"Pick an indexed project from the switcher in the status strip."});const a=l?s.find(i=>i.workflow.name===l):void 0;return r.jsxs("div",{className:"scroll-y",style:{flex:1,padding:18},children:[r.jsx(Pe,{icon:"workflow",title:"Workflows",sub:n.data?"Run a YAML-defined DAG of agent, shell and approval steps":"Loading workflows…"}),n.data&&!s.length&&r.jsx(ce,{icon:"workflow",title:"No workflows found",body:"Add YAML definitions under .specship/workflows/ in this project or your home directory."}),r.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(340px, 1fr))",gap:12},children:s.map(({workflow:i,scope:c})=>{const d=qg[c]??"var(--text-secondary)";return r.jsxs("div",{className:"card card-pad",style:{display:"flex",flexDirection:"column",gap:10},children:[r.jsxs("div",{className:"row gap-8",children:[r.jsx("span",{className:"mono",style:{fontSize:13.5,fontWeight:600},children:i.name}),r.jsx(ne,{color:d,bg:`color-mix(in srgb, ${d} 14%, transparent)`,children:c}),r.jsx("span",{className:"grow"}),r.jsxs("span",{className:"mono muted tabular",style:{fontSize:10.5},children:[i.nodes.length," nodes"]})]}),r.jsx("div",{className:"secondary",style:{fontSize:12.5,lineHeight:1.5,minHeight:36},children:i.description||"No description."}),r.jsxs("div",{className:"row gap-6",style:{flexWrap:"wrap",borderTop:"1px solid var(--border-subtle)",paddingTop:10},children:[(i.requires??[]).length>0&&r.jsx("span",{className:"muted",style:{fontSize:10.5},children:"requires"}),(i.requires??[]).map(u=>r.jsx("code",{className:"mono",style:{fontSize:10.5,color:"var(--text-secondary)",background:"var(--bg-canvas)",padding:"1px 6px",borderRadius:4},children:u},u)),(i.inputs??[]).length>0&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"muted",style:{fontSize:10.5,marginLeft:6},children:"inputs"}),(i.inputs??[]).map(u=>r.jsxs("code",{className:"mono",style:{fontSize:10.5,color:"var(--node-spec)",background:"var(--node-spec-soft)",padding:"1px 6px",borderRadius:4},children:["$",u.name]},u.name))]}),r.jsx("span",{className:"grow"}),r.jsxs("button",{className:"btn btn-primary btn-sm",onClick:()=>o(i.name),children:[r.jsx(N,{name:"play",size:13}),"Launch"]})]})]},i.name)})}),a&&r.jsx(Jg,{wf:a.workflow,project:e,onClose:()=>o(null)})]})}function Jg({wf:e,project:t,onClose:n}){const s=e.inputs??[],[l,o]=z.useState(()=>Object.fromEntries(s.filter(m=>m.default).map(m=>[m.name,m.default]))),[a,i]=z.useState(!1),[c,d]=z.useState(null),u=s.filter(m=>m.required&&!(l[m.name]??"").trim()),f=()=>{if(a||u.length)return;i(!0),d(null);const m=Object.fromEntries(Object.entries(l).filter(([,g])=>g.trim()));P.launchRun(e.name,m,t).then(g=>A("runs",{param:g.runId}),g=>{d(g instanceof Error?g.message:String(g)),i(!1)})};return r.jsx("div",{onMouseDown:n,role:"dialog","aria-label":"Launch "+e.name,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",zIndex:90,display:"grid",placeItems:"center"},children:r.jsxs("div",{onMouseDown:m=>m.stopPropagation(),style:{width:460,maxWidth:"90vw",background:"var(--bg-elevated)",border:"1px solid var(--border-strong)",borderRadius:12,boxShadow:"var(--shadow-pop)"},children:[r.jsxs("div",{className:"row gap-10",style:{padding:"14px 16px",borderBottom:"1px solid var(--border-subtle)"},children:[r.jsx(N,{name:"workflow",size:16,style:{color:"var(--accent)"}}),r.jsx("span",{className:"mono grow",style:{fontWeight:600},children:e.name}),r.jsx("button",{className:"btn btn-ghost btn-xs",onClick:n,"aria-label":"Close",children:r.jsx(N,{name:"x",size:14})})]}),r.jsxs("div",{style:{padding:16},children:[r.jsx("div",{className:"secondary",style:{fontSize:12.5,marginBottom:16,lineHeight:1.55},children:e.description||"No description."}),s.length?s.map(m=>r.jsxs("div",{style:{marginBottom:12},children:[r.jsxs("label",{className:"eyebrow",style:{display:"block",marginBottom:5},htmlFor:"wf-input-"+m.name,children:[m.name,m.required&&r.jsx("span",{style:{color:"var(--error)"},children:" *"})]}),r.jsx("input",{id:"wf-input-"+m.name,className:"input mono",style:{width:"100%"},placeholder:m.description||(m.name==="SPEC_ID"?"REQ-AUTH-005":"value…"),value:l[m.name]||"",onChange:g=>o(v=>({...v,[m.name]:g.target.value})),onKeyDown:g=>{g.key==="Enter"&&f()}})]},m.name)):r.jsx("div",{className:"muted",style:{fontSize:12,padding:"8px 0"},children:"No inputs required."}),r.jsx("div",{className:"row gap-6",style:{marginTop:6,marginBottom:4},children:(e.requires??[]).map(m=>r.jsxs(ne,{children:[r.jsx(N,{name:"check",size:10}),m]},m))}),c&&r.jsxs("div",{className:"row gap-8",style:{marginTop:8,padding:"8px 10px",borderRadius:7,background:"var(--error-soft)",color:"var(--error)",fontSize:12},children:[r.jsx(N,{name:"cancel",size:13,style:{flexShrink:0}}),r.jsx("span",{children:c})]})]}),r.jsxs("div",{className:"row gap-8",style:{padding:"12px 16px",borderTop:"1px solid var(--border-subtle)",justifyContent:"flex-end"},children:[r.jsx("button",{className:"btn btn-ghost btn-sm",onClick:n,children:"Cancel"}),r.jsxs("button",{className:"btn btn-primary btn-sm",onClick:f,disabled:a||u.length>0,title:u.length?"Fill the required inputs: "+u.map(m=>m.name).join(", "):void 0,children:[r.jsx(N,{name:"play",size:13}),a?"Launching…":"Launch run"]})]})]})})}const mi=[{group:"Project",items:[{id:"dashboard",label:"Dashboard",icon:"dashboard"},{id:"graph",label:"Graph",icon:"graph"},{id:"specs",label:"Specs",icon:"book"},{id:"drift",label:"Drift queue",icon:"drift",badge:e=>e.drift},{id:"runs",label:"Runs",icon:"play",badge:e=>e.runs,badgeKind:"warn"}]},{group:"Claude Code",items:[{id:"sessions",label:"Sessions",icon:"sessions"},{id:"heatmap",label:"Heatmap",icon:"heatmap"},{id:"costs",label:"Costs",icon:"dollar"},{id:"compare",label:"Compare projects",icon:"compare"},{id:"memory",label:"Memory",icon:"memory"},{id:"mcp",label:"MCP",icon:"plug"},{id:"tips",label:"Tips",icon:"tips",badge:e=>e.tips,badgeKind:"error"}]}],Zg=[...mi.flatMap(e=>e.items.map(({id:t,label:n,icon:s})=>({id:t,label:n,icon:s}))),{id:"workflows",label:"Workflows",icon:"workflow"},{id:"designsystem",label:"Design system",icon:"layers"},{id:"settings",label:"Settings",icon:"settings"}],ev=mi.flatMap(e=>e.items.map(t=>t.id)).slice(0,7),tv={dashboard:Gm,graph:kx,specs:Vg,drift:xx,runs:ag,workflows:Xg,designsystem:()=>r.jsx(hx,{}),sessions:dg,heatmap:bx,costs:Km,compare:Hm,memory:Kx,mcp:Bx,settings:e=>r.jsx(wg,{...e})},io="ss_project",Hc="ss_nav_groups",Uc="ss_nav_collapsed";function nv(){const{route:e,param:t,query:n}=im(),[s,l]=z.useState(()=>{try{return localStorage.getItem(Uc)==="1"}catch{return!1}}),[o,a]=z.useState(()=>{try{return localStorage.getItem(io)}catch{return null}}),[i,c]=z.useState(!1),[d,u]=z.useState(!1),f=D(()=>P.status(o),[o,e]),m=D(()=>P.projects(),[]),g=D(()=>P.runs(o),[o,e]),v=D(()=>P.claudeTips(),[e]),p=D(()=>P.drift(o),[o,e]),w=z.useCallback(()=>u(_=>!_),[]);Sm({onTogglePalette:w,pageIds:ev});const h={drift:p.data?.links.length??f.data?.drift??0,runs:g.data?.runs.filter(_=>_.status==="running").length??0,tips:v.data?.tips.filter(_=>_.state!=="applied").length??0},x=z.useCallback(()=>u(!0),[]),j=z.useCallback((_,W)=>{P.setTipState(_,W).catch(()=>{}).finally(()=>v.reload())},[v.reload]),y=()=>l(_=>{try{localStorage.setItem(Uc,_?"0":"1")}catch{}return!_}),S=_=>{a(_);try{_?localStorage.setItem(io,_):localStorage.removeItem(io)}catch{}},b=()=>{c(!0),P.refresh(o).catch(()=>{}).finally(()=>{c(!1),f.reload()})},C=tv[e]??(()=>r.jsx(Qx,{title:"Not found"}));return r.jsxs("div",{style:{display:"flex",height:"100%",position:"relative"},children:[r.jsx(rv,{route:e,collapsed:s,counts:h,version:f.data?.version,onToggleCollapse:y}),r.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minWidth:0},children:[r.jsx(lv,{status:f.data,projectless:Vt(f.error),projects:m.data?.projects??[],project:o,onPick:S,onRefresh:b,refreshing:i}),r.jsx(av,{onToggle:y,onOpenPalette:x}),r.jsx("div",{"data-screen":e,style:{flex:1,minHeight:0,display:"flex",flexDirection:"column"},children:e==="tips"?r.jsx(Yg,{project:o,param:t,query:n,tips:v,onSetTipState:j}):r.jsx(C,{project:o,param:t,query:n})},e+(t??""))]}),r.jsx(gm,{open:d,onClose:()=>u(!1),pages:Zg,project:o})]})}function rv({route:e,collapsed:t,counts:n,version:s,onToggleCollapse:l}){const[o,a]=z.useState(()=>{try{return JSON.parse(localStorage.getItem(Hc)||"null")||{}}catch{return{}}}),i=d=>o[d]!==!1,c=d=>a(u=>{const f={...u,[d]:u[d]===!1};try{localStorage.setItem(Hc,JSON.stringify(f))}catch{}return f});return r.jsxs("nav",{style:{width:t?"var(--sidebar-w-collapsed)":"var(--sidebar-w)",flexShrink:0,background:"var(--bg-panel)",borderRight:"1px solid var(--border-subtle)",display:"flex",flexDirection:"column",transition:"width 120ms",overflow:"hidden"},children:[r.jsxs("div",{className:"row gap-8",onClick:l,title:t?"Expand menu":"Collapse menu",style:{padding:t?"14px 0":"15px 16px",justifyContent:t?"center":"flex-start",cursor:"pointer",userSelect:"none"},children:[r.jsx(dm,{size:26}),!t&&r.jsx("div",{className:"grow",style:{fontWeight:600,fontSize:13.5,letterSpacing:"-0.01em"},children:"SpecShip"})]}),r.jsx("div",{className:"scroll-y",style:{flex:1,padding:"4px 8px"},children:mi.map(d=>r.jsxs("div",{style:{marginBottom:t?10:4},children:[!t&&r.jsxs("button",{onClick:()=>c(d.group),className:"row gap-6",style:{width:"100%",padding:"8px 8px 4px",background:"none",border:"none",cursor:"pointer",textAlign:"left"},children:[r.jsx("span",{className:"eyebrow grow",children:d.group}),r.jsx(N,{name:i(d.group)?"chevronDown":"chevronRight",size:12,style:{color:"var(--text-muted)"}})]}),(t||i(d.group))&&d.items.map(u=>r.jsx(co,{item:u,active:e===u.id,collapsed:t,counts:n},u.id))]},d.group))}),r.jsxs("div",{style:{padding:8,borderTop:"1px solid var(--border-subtle)"},children:[r.jsx(co,{item:{id:"designsystem",label:"Design system",icon:"layers"},active:e==="designsystem",collapsed:t}),r.jsx(co,{item:{id:"settings",label:"Settings",icon:"settings"},active:e==="settings",collapsed:t}),s&&r.jsx("div",{className:"mono tabular",title:`SpecShip v${s}`,"data-testid":"app-version",style:{padding:t?"6px 0 2px":"6px 10px 2px",fontSize:10.5,color:"var(--text-muted)",textAlign:t?"center":"left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t?s:`v${s}`})]})]})}function co({item:e,active:t,collapsed:n,counts:s}){const l=i=>{i.metaKey||i.ctrlKey||i.shiftKey||i.button!==0||(i.preventDefault(),A(e.id))},o=e.badge&&s?e.badge(s):0,a=e.badgeKind;return r.jsxs("a",{href:"/"+e.id,onClick:l,title:n?e.label:void 0,className:"list-row",style:{display:"flex",alignItems:"center",gap:10,height:32,padding:n?0:"0 10px",justifyContent:n?"center":"flex-start",borderRadius:7,textDecoration:"none",marginBottom:1,color:t?"var(--text-primary)":"var(--text-secondary)",background:t?"var(--bg-active)":void 0,fontWeight:t?600:450,fontSize:13,position:"relative"},children:[t&&r.jsx("span",{style:{position:"absolute",left:0,top:7,bottom:7,width:2.5,borderRadius:2,background:"var(--accent)"}}),r.jsx(N,{name:e.icon,size:16,style:{color:t?"var(--accent)":"inherit",flexShrink:0}}),!n&&r.jsx("span",{className:"grow",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.label}),!n&&o>0&&r.jsx("span",{className:"pill tabular",style:{fontSize:10,fontWeight:700,padding:"1px 6px",minWidth:18,justifyContent:"center",color:a==="error"?"var(--error)":a==="warn"?"var(--warn)":"var(--text-secondary)",background:a==="error"?"var(--error-soft)":a==="warn"?"var(--warn-soft)":"rgba(255,255,255,0.06)"},children:o}),n&&o>0&&r.jsx("span",{style:{position:"absolute",top:5,right:9,width:6,height:6,borderRadius:"50%",background:a==="error"?"var(--error)":"var(--warn)"}})]})}function sv({projects:e,project:t,projectPath:n,onPick:s}){const[l,o]=z.useState(!1),a=z.useRef(null),[i,c]=z.useState(null),d=()=>{if(!l){const g=a.current?.getBoundingClientRect();c(g?{top:g.bottom+5,left:g.left}:null)}o(g=>!g)};z.useEffect(()=>{if(!l)return;const g=v=>{v.target.closest("[data-projsw]")||o(!1)};return window.addEventListener("mousedown",g),()=>window.removeEventListener("mousedown",g)},[l]);const u=e.filter(g=>g.initialized),f=t??"",m=n||(t??"pick a project");return r.jsxs("div",{"data-projsw":"1",style:{position:"relative",flexShrink:0},children:[r.jsxs("button",{ref:a,onClick:d,className:"row gap-6",title:"Switch project",style:{height:24,padding:"0 8px",borderRadius:6,cursor:"pointer",background:l?"var(--bg-hover)":"transparent",border:"1px solid "+(l?"var(--border-strong)":"transparent"),transition:"background var(--motion-fast), border-color var(--motion-fast)"},children:[r.jsx(N,{name:"folder",size:13,style:{color:"var(--text-muted)",flexShrink:0}}),r.jsx("span",{className:"mono",style:{fontSize:11.5,color:"var(--text-primary)",maxWidth:280,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:m}),r.jsx(N,{name:"chevronDown",size:12,style:{color:"var(--text-muted)",flexShrink:0}})]}),l&&r.jsxs("div",{style:{position:"fixed",top:i?.top??34,left:i?.left??8,minWidth:264,background:"var(--bg-elevated)",border:"1px solid var(--border-strong)",borderRadius:9,boxShadow:"var(--shadow-pop)",padding:5,zIndex:60},children:[r.jsx("div",{className:"eyebrow",style:{padding:"5px 8px 6px"},children:"Indexed projects"}),r.jsxs("button",{className:"row gap-8",onClick:()=>{s(null),o(!1)},style:Vc(f===""),children:[r.jsx(N,{name:"folder",size:13,style:{color:"var(--text-muted)",flexShrink:0}}),r.jsx("span",{className:"grow",style:{textAlign:"left",fontSize:12.5},children:"Primary project"}),f===""&&r.jsx(N,{name:"check",size:13,style:{color:"var(--accent)",flexShrink:0}})]}),u.map(g=>{const v=g.slug===f;return r.jsxs("button",{className:"row gap-8",onClick:()=>{s(g.slug),o(!1)},style:Vc(v),children:[r.jsx(N,{name:"folder",size:13,style:{color:v?"var(--accent)":"var(--text-muted)",flexShrink:0}}),r.jsx("span",{className:"grow mono",style:{textAlign:"left",fontSize:11.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:g.path}),(g.driftCount??0)>0&&r.jsxs("span",{className:"pill tabular",style:{fontSize:9.5,color:"var(--warn)",background:"var(--warn-soft)",flexShrink:0},children:[g.driftCount," drift"]}),v&&r.jsx(N,{name:"check",size:13,style:{color:"var(--accent)",flexShrink:0}})]},g.slug)}),!u.length&&r.jsx("div",{className:"muted",style:{padding:"6px 8px",fontSize:12},children:"No initialized projects found."})]})]})}function Vc(e){return{width:"100%",textAlign:"left",padding:"7px 8px",borderRadius:6,cursor:"pointer",border:"none",background:e?"var(--bg-active)":"transparent"}}function lv({status:e,projectless:t,projects:n,project:s,onPick:l,onRefresh:o,refreshing:a}){const i=(u,f,m)=>r.jsxs("div",{className:"row gap-6",style:{flexShrink:0},children:[r.jsx("span",{className:"muted",style:{fontSize:11},children:u}),r.jsx("span",{className:"mono tabular",style:{fontSize:11.5,color:m||"var(--text-secondary)"},children:f})]}),c=r.jsx("span",{style:{width:1,height:12,background:"var(--border-subtle)",flexShrink:0}}),d=e?.lastIndexed?new Date(e.lastIndexed).toLocaleString():"—";return r.jsxs("div",{style:{height:"var(--status-h)",flexShrink:0,display:"flex",alignItems:"center",gap:14,padding:"0 14px",borderBottom:"1px solid var(--border-subtle)",background:"var(--bg-panel-2)",overflow:"hidden",whiteSpace:"nowrap"},children:[r.jsx(sv,{projects:n,project:s,projectPath:e?.projectPath??null,onPick:l}),c,i("nodes",e?e.nodeCount.toLocaleString():t?"—":"…"),i("edges",e?e.edgeCount.toLocaleString():t?"—":"…"),c,i("drift",e?String(e.drift):"—",e?e.drift?"var(--warn)":"var(--success)":void 0),r.jsx("div",{className:"grow"}),i("indexed",d),r.jsx("button",{className:"btn btn-ghost btn-xs",onClick:o,title:"Refresh now","aria-label":"Refresh now",children:r.jsx(N,{name:"refresh",size:12,style:{animation:a?"spin 0.8s linear infinite":"none"}})})]})}const ov={fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-muted)",background:"var(--bg-canvas)",border:"1px solid var(--border-subtle)",borderRadius:4,padding:"2px 6px"};function av({onToggle:e,onOpenPalette:t}){return r.jsxs("div",{style:{height:44,flexShrink:0,display:"flex",alignItems:"center",gap:10,padding:"0 14px",borderBottom:"1px solid var(--border-subtle)",background:"var(--bg-canvas)"},children:[r.jsx("button",{className:"btn btn-ghost",onClick:e,style:{padding:6},title:"Toggle sidebar","aria-label":"Toggle sidebar",children:r.jsx(N,{name:"menu",size:16})}),r.jsxs("button",{onClick:t,className:"row gap-8",style:{flex:1,maxWidth:380,height:30,padding:"0 11px",background:"var(--bg-panel)",border:"1px solid var(--border-subtle)",borderRadius:8,cursor:"text",color:"var(--text-muted)",fontSize:12.5},children:[r.jsx(N,{name:"search",size:14}),r.jsx("span",{className:"grow",style:{textAlign:"left"},children:"Search or jump to…"}),r.jsx("kbd",{style:ov,children:"⌘K"})]}),r.jsx("div",{className:"grow"}),r.jsx(iv,{}),r.jsx("button",{className:"btn btn-ghost btn-sm",onClick:t,title:"Command palette","aria-label":"Command palette",children:r.jsx(N,{name:"command",size:14})})]})}function iv(){const[e,t]=z.useState(kl()),n={dark:"light",light:"system",system:"dark"},s={dark:"moon",light:"sun",system:"monitor"},l=n[e];return r.jsx("button",{className:"btn btn-ghost btn-sm",title:"Theme: "+e+" — switch to "+l,"aria-label":"Theme: "+e+" — switch to "+l,onClick:()=>{bl(l),t(l)},children:r.jsx(N,{name:s[e],size:15})})}bl(kl());bm();zp(Np());uo.createRoot(document.getElementById("root")).render(r.jsx(Qp.StrictMode,{children:r.jsx(nv,{})}));