@specship/specship-darwin-arm64 0.29.0 → 0.30.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 (289) hide show
  1. package/bin/specship +1 -1
  2. package/lib/dist/.claude-plugin/plugin.json +15 -3
  3. package/lib/dist/activation/cheatsheet.d.ts +10 -7
  4. package/lib/dist/activation/cheatsheet.d.ts.map +1 -1
  5. package/lib/dist/activation/cheatsheet.js +21 -5
  6. package/lib/dist/activation/cheatsheet.js.map +1 -1
  7. package/lib/dist/activation/hook-output.d.ts +75 -2
  8. package/lib/dist/activation/hook-output.d.ts.map +1 -1
  9. package/lib/dist/activation/hook-output.js +114 -3
  10. package/lib/dist/activation/hook-output.js.map +1 -1
  11. package/lib/dist/activation/search-intercept.d.ts +20 -7
  12. package/lib/dist/activation/search-intercept.d.ts.map +1 -1
  13. package/lib/dist/activation/search-intercept.js +27 -5
  14. package/lib/dist/activation/search-intercept.js.map +1 -1
  15. package/lib/dist/activation/steering.d.ts +7 -4
  16. package/lib/dist/activation/steering.d.ts.map +1 -1
  17. package/lib/dist/activation/steering.js +10 -8
  18. package/lib/dist/activation/steering.js.map +1 -1
  19. package/lib/dist/agents/detect.d.ts +32 -0
  20. package/lib/dist/agents/detect.d.ts.map +1 -0
  21. package/lib/dist/agents/detect.js +54 -0
  22. package/lib/dist/agents/detect.js.map +1 -0
  23. package/lib/dist/agents/recent-project.d.ts +18 -0
  24. package/lib/dist/agents/recent-project.d.ts.map +1 -0
  25. package/lib/dist/agents/recent-project.js +92 -0
  26. package/lib/dist/agents/recent-project.js.map +1 -0
  27. package/lib/dist/analytics/canonical-tools.d.ts +23 -0
  28. package/lib/dist/analytics/canonical-tools.d.ts.map +1 -0
  29. package/lib/dist/analytics/canonical-tools.js +36 -0
  30. package/lib/dist/analytics/canonical-tools.js.map +1 -0
  31. package/lib/dist/analytics/canonical-tools.json +16 -0
  32. package/lib/dist/analytics/specship-impact.d.ts +3 -2
  33. package/lib/dist/analytics/specship-impact.d.ts.map +1 -1
  34. package/lib/dist/analytics/specship-impact.js +6 -4
  35. package/lib/dist/analytics/specship-impact.js.map +1 -1
  36. package/lib/dist/bin/specship.js +215 -170
  37. package/lib/dist/bin/specship.js.map +1 -1
  38. package/lib/dist/bin/uninstall.js +2 -2
  39. package/lib/dist/bin/uninstall.js.map +1 -1
  40. package/lib/dist/claudemd/audit.d.ts +12 -3
  41. package/lib/dist/claudemd/audit.d.ts.map +1 -1
  42. package/lib/dist/claudemd/audit.js +65 -22
  43. package/lib/dist/claudemd/audit.js.map +1 -1
  44. package/lib/dist/commands/specship/spec.md +9 -0
  45. package/lib/dist/db/migrations.d.ts +1 -1
  46. package/lib/dist/db/migrations.d.ts.map +1 -1
  47. package/lib/dist/db/migrations.js +18 -4
  48. package/lib/dist/db/migrations.js.map +1 -1
  49. package/lib/dist/db/schema.sql +8 -0
  50. package/lib/dist/db/spec-queries.d.ts +13 -1
  51. package/lib/dist/db/spec-queries.d.ts.map +1 -1
  52. package/lib/dist/db/spec-queries.js +21 -0
  53. package/lib/dist/db/spec-queries.js.map +1 -1
  54. package/lib/dist/enforce/changed-files.d.ts +7 -0
  55. package/lib/dist/enforce/changed-files.d.ts.map +1 -1
  56. package/lib/dist/enforce/changed-files.js +17 -0
  57. package/lib/dist/enforce/changed-files.js.map +1 -1
  58. package/lib/dist/enforce/enforce.d.ts +35 -1
  59. package/lib/dist/enforce/enforce.d.ts.map +1 -1
  60. package/lib/dist/enforce/enforce.js +66 -2
  61. package/lib/dist/enforce/enforce.js.map +1 -1
  62. package/lib/dist/extraction/index.d.ts +50 -4
  63. package/lib/dist/extraction/index.d.ts.map +1 -1
  64. package/lib/dist/extraction/index.js +105 -13
  65. package/lib/dist/extraction/index.js.map +1 -1
  66. package/lib/dist/extraction/parse-warnings.d.ts +16 -0
  67. package/lib/dist/extraction/parse-warnings.d.ts.map +1 -0
  68. package/lib/dist/extraction/parse-warnings.js +30 -0
  69. package/lib/dist/extraction/parse-warnings.js.map +1 -0
  70. package/lib/dist/extraction/tree-sitter.d.ts +27 -0
  71. package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
  72. package/lib/dist/extraction/tree-sitter.js +168 -1
  73. package/lib/dist/extraction/tree-sitter.js.map +1 -1
  74. package/lib/dist/health/smoke-check.js +1 -1
  75. package/lib/dist/health/smoke-check.js.map +1 -1
  76. package/lib/dist/hooks/hooks.json +16 -1
  77. package/lib/dist/index.d.ts +63 -3
  78. package/lib/dist/index.d.ts.map +1 -1
  79. package/lib/dist/index.js +235 -9
  80. package/lib/dist/index.js.map +1 -1
  81. package/lib/dist/installer/agent-record.d.ts +80 -0
  82. package/lib/dist/installer/agent-record.d.ts.map +1 -0
  83. package/lib/dist/installer/agent-record.js +351 -0
  84. package/lib/dist/installer/agent-record.js.map +1 -0
  85. package/lib/dist/installer/auto-migrate.d.ts +56 -0
  86. package/lib/dist/installer/auto-migrate.d.ts.map +1 -0
  87. package/lib/dist/installer/auto-migrate.js +328 -0
  88. package/lib/dist/installer/auto-migrate.js.map +1 -0
  89. package/lib/dist/installer/index.d.ts +37 -8
  90. package/lib/dist/installer/index.d.ts.map +1 -1
  91. package/lib/dist/installer/index.js +156 -46
  92. package/lib/dist/installer/index.js.map +1 -1
  93. package/lib/dist/installer/install-defaults.d.ts +4 -3
  94. package/lib/dist/installer/install-defaults.d.ts.map +1 -1
  95. package/lib/dist/installer/install-defaults.js +6 -5
  96. package/lib/dist/installer/install-defaults.js.map +1 -1
  97. package/lib/dist/installer/{config-writer.d.ts → targets/claude-config-writer.d.ts} +1 -1
  98. package/lib/dist/installer/targets/claude-config-writer.d.ts.map +1 -0
  99. package/lib/dist/installer/{config-writer.js → targets/claude-config-writer.js} +7 -6
  100. package/lib/dist/installer/targets/claude-config-writer.js.map +1 -0
  101. package/lib/dist/installer/targets/claude-projects.d.ts +9 -0
  102. package/lib/dist/installer/targets/claude-projects.d.ts.map +1 -0
  103. package/lib/dist/installer/targets/claude-projects.js +151 -0
  104. package/lib/dist/installer/targets/claude-projects.js.map +1 -0
  105. package/lib/dist/installer/targets/claude.d.ts +28 -1
  106. package/lib/dist/installer/targets/claude.d.ts.map +1 -1
  107. package/lib/dist/installer/targets/claude.js +39 -20
  108. package/lib/dist/installer/targets/claude.js.map +1 -1
  109. package/lib/dist/installer/targets/feature-parity.d.ts +28 -0
  110. package/lib/dist/installer/targets/feature-parity.d.ts.map +1 -0
  111. package/lib/dist/installer/targets/feature-parity.js +32 -0
  112. package/lib/dist/installer/targets/feature-parity.js.map +1 -0
  113. package/lib/dist/installer/{gemini-commands.d.ts → targets/gemini-commands.d.ts} +7 -3
  114. package/lib/dist/installer/targets/gemini-commands.d.ts.map +1 -0
  115. package/lib/dist/installer/{gemini-commands.js → targets/gemini-commands.js} +35 -14
  116. package/lib/dist/installer/targets/gemini-commands.js.map +1 -0
  117. package/lib/dist/installer/targets/gemini-projects.d.ts +11 -0
  118. package/lib/dist/installer/targets/gemini-projects.d.ts.map +1 -0
  119. package/lib/dist/installer/targets/gemini-projects.js +84 -0
  120. package/lib/dist/installer/targets/gemini-projects.js.map +1 -0
  121. package/lib/dist/installer/targets/gemini.d.ts +94 -8
  122. package/lib/dist/installer/targets/gemini.d.ts.map +1 -1
  123. package/lib/dist/installer/targets/gemini.js +392 -33
  124. package/lib/dist/installer/targets/gemini.js.map +1 -1
  125. package/lib/dist/installer/targets/registry.d.ts +8 -1
  126. package/lib/dist/installer/targets/registry.d.ts.map +1 -1
  127. package/lib/dist/installer/targets/registry.js +14 -5
  128. package/lib/dist/installer/targets/registry.js.map +1 -1
  129. package/lib/dist/installer/targets/shared.d.ts +44 -1
  130. package/lib/dist/installer/targets/shared.d.ts.map +1 -1
  131. package/lib/dist/installer/targets/shared.js +130 -3
  132. package/lib/dist/installer/targets/shared.js.map +1 -1
  133. package/lib/dist/installer/targets/types.d.ts +23 -1
  134. package/lib/dist/installer/targets/types.d.ts.map +1 -1
  135. package/lib/dist/jira/auto-publish.d.ts +22 -2
  136. package/lib/dist/jira/auto-publish.d.ts.map +1 -1
  137. package/lib/dist/jira/auto-publish.js +54 -9
  138. package/lib/dist/jira/auto-publish.js.map +1 -1
  139. package/lib/dist/jira/board-first.d.ts +15 -2
  140. package/lib/dist/jira/board-first.d.ts.map +1 -1
  141. package/lib/dist/jira/board-first.js +16 -0
  142. package/lib/dist/jira/board-first.js.map +1 -1
  143. package/lib/dist/jira/ci-publish.d.ts +72 -0
  144. package/lib/dist/jira/ci-publish.d.ts.map +1 -0
  145. package/lib/dist/jira/ci-publish.js +162 -0
  146. package/lib/dist/jira/ci-publish.js.map +1 -0
  147. package/lib/dist/jira/publish.d.ts +23 -0
  148. package/lib/dist/jira/publish.d.ts.map +1 -1
  149. package/lib/dist/jira/publish.js +0 -0
  150. package/lib/dist/jira/publish.js.map +1 -1
  151. package/lib/dist/jira/regression-pack.d.ts.map +1 -1
  152. package/lib/dist/jira/regression-pack.js +7 -1
  153. package/lib/dist/jira/regression-pack.js.map +1 -1
  154. package/lib/dist/jira/repo-config.d.ts.map +1 -1
  155. package/lib/dist/jira/repo-config.js +8 -0
  156. package/lib/dist/jira/repo-config.js.map +1 -1
  157. package/lib/dist/jira/types.d.ts +8 -0
  158. package/lib/dist/jira/types.d.ts.map +1 -1
  159. package/lib/dist/jira/types.js.map +1 -1
  160. package/lib/dist/knowledge/enforce.d.ts.map +1 -1
  161. package/lib/dist/knowledge/enforce.js +6 -1
  162. package/lib/dist/knowledge/enforce.js.map +1 -1
  163. package/lib/dist/mcp/jira-tools.d.ts +5 -0
  164. package/lib/dist/mcp/jira-tools.d.ts.map +1 -1
  165. package/lib/dist/mcp/jira-tools.js +59 -4
  166. package/lib/dist/mcp/jira-tools.js.map +1 -1
  167. package/lib/dist/mcp/proxy.d.ts.map +1 -1
  168. package/lib/dist/mcp/proxy.js +2 -1
  169. package/lib/dist/mcp/proxy.js.map +1 -1
  170. package/lib/dist/mcp/server-instructions.d.ts +16 -10
  171. package/lib/dist/mcp/server-instructions.d.ts.map +1 -1
  172. package/lib/dist/mcp/server-instructions.js +69 -20
  173. package/lib/dist/mcp/server-instructions.js.map +1 -1
  174. package/lib/dist/mcp/session.d.ts +11 -0
  175. package/lib/dist/mcp/session.d.ts.map +1 -1
  176. package/lib/dist/mcp/session.js +43 -1
  177. package/lib/dist/mcp/session.js.map +1 -1
  178. package/lib/dist/mcp/tools.d.ts.map +1 -1
  179. package/lib/dist/mcp/tools.js +8 -0
  180. package/lib/dist/mcp/tools.js.map +1 -1
  181. package/lib/dist/reflect/apply.d.ts +2 -2
  182. package/lib/dist/reflect/apply.d.ts.map +1 -1
  183. package/lib/dist/reflect/apply.js +6 -5
  184. package/lib/dist/reflect/apply.js.map +1 -1
  185. package/lib/dist/reflect/miner.d.ts.map +1 -1
  186. package/lib/dist/reflect/miner.js +28 -15
  187. package/lib/dist/reflect/miner.js.map +1 -1
  188. package/lib/dist/reflect/session-outcomes.d.ts.map +1 -1
  189. package/lib/dist/reflect/session-outcomes.js +8 -3
  190. package/lib/dist/reflect/session-outcomes.js.map +1 -1
  191. package/lib/dist/reflect/targets.d.ts.map +1 -1
  192. package/lib/dist/reflect/targets.js +25 -5
  193. package/lib/dist/reflect/targets.js.map +1 -1
  194. package/lib/dist/reflect/types.d.ts +7 -0
  195. package/lib/dist/reflect/types.d.ts.map +1 -1
  196. package/lib/dist/resolution/spec-link-resolver.d.ts +14 -2
  197. package/lib/dist/resolution/spec-link-resolver.d.ts.map +1 -1
  198. package/lib/dist/resolution/spec-link-resolver.js +13 -3
  199. package/lib/dist/resolution/spec-link-resolver.js.map +1 -1
  200. package/lib/dist/server/canonical-tools.js +50 -0
  201. package/lib/dist/server/cli.js +2 -2
  202. package/lib/dist/server/host-profiles.js +39 -0
  203. package/lib/dist/server/ingest/index.js +2 -1
  204. package/lib/dist/server/ingest/ingestor.js +195 -76
  205. package/lib/dist/server/ingest/project-paths.js +8 -2
  206. package/lib/dist/server/ingest/recorded-projects.js +43 -0
  207. package/lib/dist/server/ingest/specship-classify.js +7 -2
  208. package/lib/dist/server/ingest/transcripts/claude-jsonl.js +54 -0
  209. package/lib/dist/server/ingest/transcripts/claude.js +64 -0
  210. package/lib/dist/server/ingest/transcripts/gemini.js +469 -0
  211. package/lib/dist/server/ingest/transcripts/index.js +14 -0
  212. package/lib/dist/server/ingest/{parser.js → transcripts/shared.js} +3 -49
  213. package/lib/dist/server/ingest/transcripts/types.js +4 -0
  214. package/lib/dist/server/ingest/watcher.js +31 -30
  215. package/lib/dist/server/routes/claude.js +27 -10
  216. package/lib/dist/server/routes/graph.js +64 -3
  217. package/lib/dist/server/routes/mcp.js +57 -15
  218. package/lib/dist/server/routes/memory.js +54 -35
  219. package/lib/dist/server/routes/projects.js +78 -7
  220. package/lib/dist/server/routes/spec.js +125 -0
  221. package/lib/dist/server/server.js +8 -2
  222. package/lib/dist/skills/spec-author/SKILL.md +1 -1
  223. package/lib/dist/skills/spec-author/references/gap-questions.md +1 -1
  224. package/lib/dist/spec-lint/lint.d.ts +26 -1
  225. package/lib/dist/spec-lint/lint.d.ts.map +1 -1
  226. package/lib/dist/spec-lint/lint.js +96 -7
  227. package/lib/dist/spec-lint/lint.js.map +1 -1
  228. package/lib/dist/sync/worktree.d.ts +48 -0
  229. package/lib/dist/sync/worktree.d.ts.map +1 -1
  230. package/lib/dist/sync/worktree.js +109 -0
  231. package/lib/dist/sync/worktree.js.map +1 -1
  232. package/lib/dist/ui/assets/bricolage-latin-C23fTOVi.woff2 +0 -0
  233. package/lib/dist/ui/assets/bricolage-latin-ext-B82pxkPf.woff2 +0 -0
  234. package/lib/dist/ui/assets/index-54vorjyq.css +1 -0
  235. package/lib/dist/ui/assets/index-BZQonCVb.js +52 -0
  236. package/lib/dist/ui/assets/space-grotesk-latin-DPT1xrvW.woff2 +0 -0
  237. package/lib/dist/ui/assets/space-grotesk-latin-ext-wJGaI8U0.woff2 +0 -0
  238. package/lib/dist/ui/index.html +2 -2
  239. package/lib/dist/update/updater.d.ts +6 -0
  240. package/lib/dist/update/updater.d.ts.map +1 -1
  241. package/lib/dist/update/updater.js +13 -1
  242. package/lib/dist/update/updater.js.map +1 -1
  243. package/lib/dist/workflows/agents/claude.d.ts +9 -0
  244. package/lib/dist/workflows/agents/claude.d.ts.map +1 -1
  245. package/lib/dist/workflows/agents/claude.js +22 -3
  246. package/lib/dist/workflows/agents/claude.js.map +1 -1
  247. package/lib/dist/workflows/agents/gemini-version.d.ts +18 -0
  248. package/lib/dist/workflows/agents/gemini-version.d.ts.map +1 -0
  249. package/lib/dist/workflows/agents/gemini-version.js +81 -0
  250. package/lib/dist/workflows/agents/gemini-version.js.map +1 -0
  251. package/lib/dist/workflows/agents/gemini.d.ts +1 -1
  252. package/lib/dist/workflows/agents/gemini.d.ts.map +1 -1
  253. package/lib/dist/workflows/agents/gemini.js +12 -2
  254. package/lib/dist/workflows/agents/gemini.js.map +1 -1
  255. package/lib/dist/workflows/agents/index.d.ts +2 -0
  256. package/lib/dist/workflows/agents/index.d.ts.map +1 -1
  257. package/lib/dist/workflows/agents/index.js +5 -0
  258. package/lib/dist/workflows/agents/index.js.map +1 -1
  259. package/lib/dist/workflows/agents/types.d.ts +13 -0
  260. package/lib/dist/workflows/agents/types.d.ts.map +1 -1
  261. package/lib/dist/workflows/agents/types.js.map +1 -1
  262. package/lib/dist/workflows/condition-evaluator.d.ts +8 -0
  263. package/lib/dist/workflows/condition-evaluator.d.ts.map +1 -1
  264. package/lib/dist/workflows/condition-evaluator.js +7 -0
  265. package/lib/dist/workflows/condition-evaluator.js.map +1 -1
  266. package/lib/dist/workflows/defaults/claude-design-implement.yaml +11 -11
  267. package/lib/dist/workflows/defaults/spec-author.yaml +9 -9
  268. package/lib/dist/workflows/defaults/spec-fix.yaml +8 -8
  269. package/lib/dist/workflows/defaults/spec-implement.yaml +38 -23
  270. package/lib/dist/workflows/defaults/spec-relink.yaml +5 -5
  271. package/lib/dist/workflows/defaults/spec-verify.yaml +3 -3
  272. package/lib/dist/workflows/executor.d.ts +7 -0
  273. package/lib/dist/workflows/executor.d.ts.map +1 -1
  274. package/lib/dist/workflows/executor.js +22 -5
  275. package/lib/dist/workflows/executor.js.map +1 -1
  276. package/lib/node_modules/.package-lock.json +1 -1
  277. package/lib/package.json +3 -2
  278. package/package.json +1 -1
  279. package/lib/dist/installer/config-writer.d.ts.map +0 -1
  280. package/lib/dist/installer/config-writer.js.map +0 -1
  281. package/lib/dist/installer/gemini-commands.d.ts.map +0 -1
  282. package/lib/dist/installer/gemini-commands.js.map +0 -1
  283. package/lib/dist/ui/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
  284. package/lib/dist/ui/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
  285. package/lib/dist/ui/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
  286. package/lib/dist/ui/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
  287. package/lib/dist/ui/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
  288. package/lib/dist/ui/assets/index-BzuUWUAE.js +0 -50
  289. package/lib/dist/ui/assets/index-ezwX2EfG.css +0 -1
@@ -0,0 +1,52 @@
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"]'))r(l);new MutationObserver(l=>{for(const i of l)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(l){const i={};return l.integrity&&(i.integrity=l.integrity),l.referrerPolicy&&(i.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?i.credentials="include":l.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(l){if(l.ep)return;l.ep=!0;const i=n(l);fetch(l.href,i)}})();function gf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Tc={exports:{}},Js={},_c={exports:{}},O={};/**
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 Or=Symbol.for("react.element"),xf=Symbol.for("react.portal"),yf=Symbol.for("react.fragment"),wf=Symbol.for("react.strict_mode"),jf=Symbol.for("react.profiler"),kf=Symbol.for("react.provider"),Sf=Symbol.for("react.context"),Nf=Symbol.for("react.forward_ref"),bf=Symbol.for("react.suspense"),Cf=Symbol.for("react.memo"),Ef=Symbol.for("react.lazy"),Jo=Symbol.iterator;function zf(e){return e===null||typeof e!="object"?null:(e=Jo&&e[Jo]||e["@@iterator"],typeof e=="function"?e:null)}var Lc={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Pc=Object.assign,Ic={};function Hn(e,t,n){this.props=e,this.context=t,this.refs=Ic,this.updater=n||Lc}Hn.prototype.isReactComponent={};Hn.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")};Hn.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Dc(){}Dc.prototype=Hn.prototype;function qi(e,t,n){this.props=e,this.context=t,this.refs=Ic,this.updater=n||Lc}var Zi=qi.prototype=new Dc;Zi.constructor=qi;Pc(Zi,Hn.prototype);Zi.isPureReactComponent=!0;var ea=Array.isArray,Oc=Object.prototype.hasOwnProperty,Ji={current:null},Ac={key:!0,ref:!0,__self:!0,__source:!0};function Fc(e,t,n){var r,l={},i=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(i=""+t.key),t)Oc.call(t,r)&&!Ac.hasOwnProperty(r)&&(l[r]=t[r]);var a=arguments.length-2;if(a===1)l.children=n;else if(1<a){for(var c=Array(a),u=0;u<a;u++)c[u]=arguments[u+2];l.children=c}if(e&&e.defaultProps)for(r in a=e.defaultProps,a)l[r]===void 0&&(l[r]=a[r]);return{$$typeof:Or,type:e,key:i,ref:o,props:l,_owner:Ji.current}}function Mf(e,t){return{$$typeof:Or,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function eo(e){return typeof e=="object"&&e!==null&&e.$$typeof===Or}function Rf(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var ta=/\/+/g;function vl(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Rf(""+e.key):t.toString(36)}function ps(e,t,n,r,l){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(i){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case Or:case xf:o=!0}}if(o)return o=e,l=l(o),e=r===""?"."+vl(o,0):r,ea(l)?(n="",e!=null&&(n=e.replace(ta,"$&/")+"/"),ps(l,t,n,"",function(u){return u})):l!=null&&(eo(l)&&(l=Mf(l,n+(!l.key||o&&o.key===l.key?"":(""+l.key).replace(ta,"$&/")+"/")+e)),t.push(l)),1;if(o=0,r=r===""?".":r+":",ea(e))for(var a=0;a<e.length;a++){i=e[a];var c=r+vl(i,a);o+=ps(i,t,n,c,l)}else if(c=zf(e),typeof c=="function")for(e=c.call(e),a=0;!(i=e.next()).done;)i=i.value,c=r+vl(i,a++),o+=ps(i,t,n,c,l);else if(i==="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 o}function Hr(e,t,n){if(e==null)return e;var r=[],l=0;return ps(e,r,"","",function(i){return t.call(n,i,l++)}),r}function Tf(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 Ce={current:null},hs={transition:null},_f={ReactCurrentDispatcher:Ce,ReactCurrentBatchConfig:hs,ReactCurrentOwner:Ji};function $c(){throw Error("act(...) is not supported in production builds of React.")}O.Children={map:Hr,forEach:function(e,t,n){Hr(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Hr(e,function(){t++}),t},toArray:function(e){return Hr(e,function(t){return t})||[]},only:function(e){if(!eo(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};O.Component=Hn;O.Fragment=yf;O.Profiler=jf;O.PureComponent=qi;O.StrictMode=wf;O.Suspense=bf;O.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=_f;O.act=$c;O.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=Pc({},e.props),l=e.key,i=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,o=Ji.current),t.key!==void 0&&(l=""+t.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(c in t)Oc.call(t,c)&&!Ac.hasOwnProperty(c)&&(r[c]=t[c]===void 0&&a!==void 0?a[c]:t[c])}var c=arguments.length-2;if(c===1)r.children=n;else if(1<c){a=Array(c);for(var u=0;u<c;u++)a[u]=arguments[u+2];r.children=a}return{$$typeof:Or,type:e.type,key:l,ref:i,props:r,_owner:o}};O.createContext=function(e){return e={$$typeof:Sf,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:kf,_context:e},e.Consumer=e};O.createElement=Fc;O.createFactory=function(e){var t=Fc.bind(null,e);return t.type=e,t};O.createRef=function(){return{current:null}};O.forwardRef=function(e){return{$$typeof:Nf,render:e}};O.isValidElement=eo;O.lazy=function(e){return{$$typeof:Ef,_payload:{_status:-1,_result:e},_init:Tf}};O.memo=function(e,t){return{$$typeof:Cf,type:e,compare:t===void 0?null:t}};O.startTransition=function(e){var t=hs.transition;hs.transition={};try{e()}finally{hs.transition=t}};O.unstable_act=$c;O.useCallback=function(e,t){return Ce.current.useCallback(e,t)};O.useContext=function(e){return Ce.current.useContext(e)};O.useDebugValue=function(){};O.useDeferredValue=function(e){return Ce.current.useDeferredValue(e)};O.useEffect=function(e,t){return Ce.current.useEffect(e,t)};O.useId=function(){return Ce.current.useId()};O.useImperativeHandle=function(e,t,n){return Ce.current.useImperativeHandle(e,t,n)};O.useInsertionEffect=function(e,t){return Ce.current.useInsertionEffect(e,t)};O.useLayoutEffect=function(e,t){return Ce.current.useLayoutEffect(e,t)};O.useMemo=function(e,t){return Ce.current.useMemo(e,t)};O.useReducer=function(e,t,n){return Ce.current.useReducer(e,t,n)};O.useRef=function(e){return Ce.current.useRef(e)};O.useState=function(e){return Ce.current.useState(e)};O.useSyncExternalStore=function(e,t,n){return Ce.current.useSyncExternalStore(e,t,n)};O.useTransition=function(){return Ce.current.useTransition()};O.version="18.3.1";_c.exports=O;var C=_c.exports;const Lf=gf(C);/**
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 Pf=C,If=Symbol.for("react.element"),Df=Symbol.for("react.fragment"),Of=Object.prototype.hasOwnProperty,Af=Pf.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Ff={key:!0,ref:!0,__self:!0,__source:!0};function Wc(e,t,n){var r,l={},i=null,o=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(o=t.ref);for(r in t)Of.call(t,r)&&!Ff.hasOwnProperty(r)&&(l[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)l[r]===void 0&&(l[r]=t[r]);return{$$typeof:If,type:e,key:i,ref:o,props:l,_owner:Af.current}}Js.Fragment=Df;Js.jsx=Wc;Js.jsxs=Wc;Tc.exports=Js;var s=Tc.exports,Yl={},Bc={exports:{}},$e={},Uc={exports:{}},Hc={};/**
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(w,S){var z=w.length;w.push(S);e:for(;0<z;){var L=z-1>>>1,I=w[L];if(0<l(I,S))w[L]=S,w[z]=I,z=L;else break e}}function n(w){return w.length===0?null:w[0]}function r(w){if(w.length===0)return null;var S=w[0],z=w.pop();if(z!==S){w[0]=z;e:for(var L=0,I=w.length,$=I>>>1;L<$;){var B=2*(L+1)-1,ue=w[B],me=B+1,Me=w[me];if(0>l(ue,z))me<I&&0>l(Me,ue)?(w[L]=Me,w[me]=z,L=me):(w[L]=ue,w[B]=z,L=B);else if(me<I&&0>l(Me,z))w[L]=Me,w[me]=z,L=me;else break e}}return S}function l(w,S){var z=w.sortIndex-S.sortIndex;return z!==0?z:w.id-S.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,a=o.now();e.unstable_now=function(){return o.now()-a}}var c=[],u=[],h=1,m=null,v=3,y=!1,x=!1,g=!1,b=typeof setTimeout=="function"?setTimeout:null,f=typeof clearTimeout=="function"?clearTimeout:null,d=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function p(w){for(var S=n(u);S!==null;){if(S.callback===null)r(u);else if(S.startTime<=w)r(u),S.sortIndex=S.expirationTime,t(c,S);else break;S=n(u)}}function j(w){if(g=!1,p(w),!x)if(n(c)!==null)x=!0,Xe(k);else{var S=n(u);S!==null&&ze(j,S.startTime-w)}}function k(w,S){x=!1,g&&(g=!1,f(T),T=-1),y=!0;var z=v;try{for(p(S),m=n(c);m!==null&&(!(m.expirationTime>S)||w&&!J());){var L=m.callback;if(typeof L=="function"){m.callback=null,v=m.priorityLevel;var I=L(m.expirationTime<=S);S=e.unstable_now(),typeof I=="function"?m.callback=I:m===n(c)&&r(c),p(S)}else r(c);m=n(c)}if(m!==null)var $=!0;else{var B=n(u);B!==null&&ze(j,B.startTime-S),$=!1}return $}finally{m=null,v=z,y=!1}}var N=!1,E=null,T=-1,A=5,P=-1;function J(){return!(e.unstable_now()-P<A)}function ce(){if(E!==null){var w=e.unstable_now();P=w;var S=!0;try{S=E(!0,w)}finally{S?je():(N=!1,E=null)}}else N=!1}var je;if(typeof d=="function")je=function(){d(ce)};else if(typeof MessageChannel<"u"){var Be=new MessageChannel,kt=Be.port2;Be.port1.onmessage=ce,je=function(){kt.postMessage(null)}}else je=function(){b(ce,0)};function Xe(w){E=w,N||(N=!0,je())}function ze(w,S){T=b(function(){w(e.unstable_now())},S)}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(w){w.callback=null},e.unstable_continueExecution=function(){x||y||(x=!0,Xe(k))},e.unstable_forceFrameRate=function(w){0>w||125<w?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):A=0<w?Math.floor(1e3/w):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(w){switch(v){case 1:case 2:case 3:var S=3;break;default:S=v}var z=v;v=S;try{return w()}finally{v=z}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(w,S){switch(w){case 1:case 2:case 3:case 4:case 5:break;default:w=3}var z=v;v=w;try{return S()}finally{v=z}},e.unstable_scheduleCallback=function(w,S,z){var L=e.unstable_now();switch(typeof z=="object"&&z!==null?(z=z.delay,z=typeof z=="number"&&0<z?L+z:L):z=L,w){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=z+I,w={id:h++,callback:S,priorityLevel:w,startTime:z,expirationTime:I,sortIndex:-1},z>L?(w.sortIndex=z,t(u,w),n(c)===null&&w===n(u)&&(g?(f(T),T=-1):g=!0,ze(j,z-L))):(w.sortIndex=I,t(c,w),x||y||(x=!0,Xe(k))),w},e.unstable_shouldYield=J,e.unstable_wrapCallback=function(w){var S=v;return function(){var z=v;v=S;try{return w.apply(this,arguments)}finally{v=z}}}})(Hc);Uc.exports=Hc;var $f=Uc.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 Wf=C,Fe=$f;function M(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 Vc=new Set,wr={};function dn(e,t){Dn(e,t),Dn(e+"Capture",t)}function Dn(e,t){for(wr[e]=t,e=0;e<t.length;e++)Vc.add(t[e])}var vt=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Xl=Object.prototype.hasOwnProperty,Bf=/^[: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]*$/,na={},ra={};function Uf(e){return Xl.call(ra,e)?!0:Xl.call(na,e)?!1:Bf.test(e)?ra[e]=!0:(na[e]=!0,!1)}function Hf(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Vf(e,t,n,r){if(t===null||typeof t>"u"||Hf(e,t,n,r))return!0;if(r)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 Ee(e,t,n,r,l,i,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=o}var he={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){he[e]=new Ee(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];he[t]=new Ee(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){he[e]=new Ee(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){he[e]=new Ee(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){he[e]=new Ee(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){he[e]=new Ee(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){he[e]=new Ee(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){he[e]=new Ee(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){he[e]=new Ee(e,5,!1,e.toLowerCase(),null,!1,!1)});var to=/[\-:]([a-z])/g;function no(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(to,no);he[t]=new Ee(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(to,no);he[t]=new Ee(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(to,no);he[t]=new Ee(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){he[e]=new Ee(e,1,!1,e.toLowerCase(),null,!1,!1)});he.xlinkHref=new Ee("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){he[e]=new Ee(e,1,!1,e.toLowerCase(),null,!0,!0)});function ro(e,t,n,r){var l=he.hasOwnProperty(t)?he[t]:null;(l!==null?l.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(Vf(t,n,l,r)&&(n=null),r||l===null?Uf(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,r=l.attributeNamespace,n===null?e.removeAttribute(t):(l=l.type,n=l===3||l===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var jt=Wf.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Vr=Symbol.for("react.element"),vn=Symbol.for("react.portal"),gn=Symbol.for("react.fragment"),so=Symbol.for("react.strict_mode"),ql=Symbol.for("react.profiler"),Kc=Symbol.for("react.provider"),Qc=Symbol.for("react.context"),lo=Symbol.for("react.forward_ref"),Zl=Symbol.for("react.suspense"),Jl=Symbol.for("react.suspense_list"),io=Symbol.for("react.memo"),bt=Symbol.for("react.lazy"),Gc=Symbol.for("react.offscreen"),sa=Symbol.iterator;function Gn(e){return e===null||typeof e!="object"?null:(e=sa&&e[sa]||e["@@iterator"],typeof e=="function"?e:null)}var Z=Object.assign,gl;function lr(e){if(gl===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);gl=t&&t[1]||""}return`
34
+ `+gl+e}var xl=!1;function yl(e,t){if(!e||xl)return"";xl=!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(u){var r=u}Reflect.construct(e,[],t)}else{try{t.call()}catch(u){r=u}e.call(t.prototype)}else{try{throw Error()}catch(u){r=u}e()}}catch(u){if(u&&r&&typeof u.stack=="string"){for(var l=u.stack.split(`
35
+ `),i=r.stack.split(`
36
+ `),o=l.length-1,a=i.length-1;1<=o&&0<=a&&l[o]!==i[a];)a--;for(;1<=o&&0<=a;o--,a--)if(l[o]!==i[a]){if(o!==1||a!==1)do if(o--,a--,0>a||l[o]!==i[a]){var c=`
37
+ `+l[o].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=o&&0<=a);break}}}finally{xl=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?lr(e):""}function Kf(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=yl(e.type,!1),e;case 11:return e=yl(e.type.render,!1),e;case 1:return e=yl(e.type,!0),e;default:return""}}function ei(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 gn:return"Fragment";case vn:return"Portal";case ql:return"Profiler";case so:return"StrictMode";case Zl:return"Suspense";case Jl:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Qc:return(e.displayName||"Context")+".Consumer";case Kc:return(e._context.displayName||"Context")+".Provider";case lo:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case io:return t=e.displayName||null,t!==null?t:ei(e.type)||"Memo";case bt:t=e._payload,e=e._init;try{return ei(e(t))}catch{}}return null}function Qf(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 ei(t);case 8:return t===so?"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 $t(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Yc(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Gf(e){var t=Yc(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var l=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(o){r=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Kr(e){e._valueTracker||(e._valueTracker=Gf(e))}function Xc(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Yc(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function bs(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 ti(e,t){var n=t.checked;return Z({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function la(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=$t(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function qc(e,t){t=t.checked,t!=null&&ro(e,"checked",t,!1)}function ni(e,t){qc(e,t);var n=$t(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?ri(e,t.type,n):t.hasOwnProperty("defaultValue")&&ri(e,t.type,$t(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function ia(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="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 ri(e,t,n){(t!=="number"||bs(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var ir=Array.isArray;function Mn(e,t,n,r){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&&r&&(e[n].defaultSelected=!0)}else{for(n=""+$t(n),t=null,l=0;l<e.length;l++){if(e[l].value===n){e[l].selected=!0,r&&(e[l].defaultSelected=!0);return}t!==null||e[l].disabled||(t=e[l])}t!==null&&(t.selected=!0)}}function si(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(M(91));return Z({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function oa(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(M(92));if(ir(n)){if(1<n.length)throw Error(M(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:$t(n)}}function Zc(e,t){var n=$t(t.value),r=$t(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function aa(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function Jc(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 li(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?Jc(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Qr,eu=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,l){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,l)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Qr=Qr||document.createElement("div"),Qr.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Qr.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 ur={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},Yf=["Webkit","ms","Moz","O"];Object.keys(ur).forEach(function(e){Yf.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ur[t]=ur[e]})});function tu(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||ur.hasOwnProperty(e)&&ur[e]?(""+t).trim():t+"px"}function nu(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=tu(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var Xf=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 ii(e,t){if(t){if(Xf[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(M(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(M(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(M(61))}if(t.style!=null&&typeof t.style!="object")throw Error(M(62))}}function oi(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 ai=null;function oo(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ci=null,Rn=null,Tn=null;function ca(e){if(e=$r(e)){if(typeof ci!="function")throw Error(M(280));var t=e.stateNode;t&&(t=sl(t),ci(e.stateNode,e.type,t))}}function ru(e){Rn?Tn?Tn.push(e):Tn=[e]:Rn=e}function su(){if(Rn){var e=Rn,t=Tn;if(Tn=Rn=null,ca(e),t)for(e=0;e<t.length;e++)ca(t[e])}}function lu(e,t){return e(t)}function iu(){}var wl=!1;function ou(e,t,n){if(wl)return e(t,n);wl=!0;try{return lu(e,t,n)}finally{wl=!1,(Rn!==null||Tn!==null)&&(iu(),su())}}function kr(e,t){var n=e.stateNode;if(n===null)return null;var r=sl(n);if(r===null)return null;n=r[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":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(M(231,t,typeof n));return n}var ui=!1;if(vt)try{var Yn={};Object.defineProperty(Yn,"passive",{get:function(){ui=!0}}),window.addEventListener("test",Yn,Yn),window.removeEventListener("test",Yn,Yn)}catch{ui=!1}function qf(e,t,n,r,l,i,o,a,c){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(h){this.onError(h)}}var dr=!1,Cs=null,Es=!1,di=null,Zf={onError:function(e){dr=!0,Cs=e}};function Jf(e,t,n,r,l,i,o,a,c){dr=!1,Cs=null,qf.apply(Zf,arguments)}function ep(e,t,n,r,l,i,o,a,c){if(Jf.apply(this,arguments),dr){if(dr){var u=Cs;dr=!1,Cs=null}else throw Error(M(198));Es||(Es=!0,di=u)}}function fn(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 au(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 ua(e){if(fn(e)!==e)throw Error(M(188))}function tp(e){var t=e.alternate;if(!t){if(t=fn(e),t===null)throw Error(M(188));return t!==e?null:e}for(var n=e,r=t;;){var l=n.return;if(l===null)break;var i=l.alternate;if(i===null){if(r=l.return,r!==null){n=r;continue}break}if(l.child===i.child){for(i=l.child;i;){if(i===n)return ua(l),e;if(i===r)return ua(l),t;i=i.sibling}throw Error(M(188))}if(n.return!==r.return)n=l,r=i;else{for(var o=!1,a=l.child;a;){if(a===n){o=!0,n=l,r=i;break}if(a===r){o=!0,r=l,n=i;break}a=a.sibling}if(!o){for(a=i.child;a;){if(a===n){o=!0,n=i,r=l;break}if(a===r){o=!0,r=i,n=l;break}a=a.sibling}if(!o)throw Error(M(189))}}if(n.alternate!==r)throw Error(M(190))}if(n.tag!==3)throw Error(M(188));return n.stateNode.current===n?e:t}function cu(e){return e=tp(e),e!==null?uu(e):null}function uu(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=uu(e);if(t!==null)return t;e=e.sibling}return null}var du=Fe.unstable_scheduleCallback,da=Fe.unstable_cancelCallback,np=Fe.unstable_shouldYield,rp=Fe.unstable_requestPaint,ne=Fe.unstable_now,sp=Fe.unstable_getCurrentPriorityLevel,ao=Fe.unstable_ImmediatePriority,fu=Fe.unstable_UserBlockingPriority,zs=Fe.unstable_NormalPriority,lp=Fe.unstable_LowPriority,pu=Fe.unstable_IdlePriority,el=null,at=null;function ip(e){if(at&&typeof at.onCommitFiberRoot=="function")try{at.onCommitFiberRoot(el,e,void 0,(e.current.flags&128)===128)}catch{}}var nt=Math.clz32?Math.clz32:cp,op=Math.log,ap=Math.LN2;function cp(e){return e>>>=0,e===0?32:31-(op(e)/ap|0)|0}var Gr=64,Yr=4194304;function or(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 Ms(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,i=e.pingedLanes,o=n&268435455;if(o!==0){var a=o&~l;a!==0?r=or(a):(i&=o,i!==0&&(r=or(i)))}else o=n&~l,o!==0?r=or(o):i!==0&&(r=or(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&l)&&(l=r&-r,i=t&-t,l>=i||l===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-nt(t),l=1<<n,r|=e[n],t&=~l;return r}function up(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 dp(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,l=e.expirationTimes,i=e.pendingLanes;0<i;){var o=31-nt(i),a=1<<o,c=l[o];c===-1?(!(a&n)||a&r)&&(l[o]=up(a,t)):c<=t&&(e.expiredLanes|=a),i&=~a}}function fi(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function hu(){var e=Gr;return Gr<<=1,!(Gr&4194240)&&(Gr=64),e}function jl(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ar(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-nt(t),e[t]=n}function fp(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 r=e.eventTimes;for(e=e.expirationTimes;0<n;){var l=31-nt(n),i=1<<l;t[l]=0,r[l]=-1,e[l]=-1,n&=~i}}function co(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-nt(n),l=1<<r;l&t|e[r]&t&&(e[r]|=t),n&=~l}}var W=0;function mu(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var vu,uo,gu,xu,yu,pi=!1,Xr=[],_t=null,Lt=null,Pt=null,Sr=new Map,Nr=new Map,Et=[],pp="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 fa(e,t){switch(e){case"focusin":case"focusout":_t=null;break;case"dragenter":case"dragleave":Lt=null;break;case"mouseover":case"mouseout":Pt=null;break;case"pointerover":case"pointerout":Sr.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Nr.delete(t.pointerId)}}function Xn(e,t,n,r,l,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[l]},t!==null&&(t=$r(t),t!==null&&uo(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,l!==null&&t.indexOf(l)===-1&&t.push(l),e)}function hp(e,t,n,r,l){switch(t){case"focusin":return _t=Xn(_t,e,t,n,r,l),!0;case"dragenter":return Lt=Xn(Lt,e,t,n,r,l),!0;case"mouseover":return Pt=Xn(Pt,e,t,n,r,l),!0;case"pointerover":var i=l.pointerId;return Sr.set(i,Xn(Sr.get(i)||null,e,t,n,r,l)),!0;case"gotpointercapture":return i=l.pointerId,Nr.set(i,Xn(Nr.get(i)||null,e,t,n,r,l)),!0}return!1}function wu(e){var t=Zt(e.target);if(t!==null){var n=fn(t);if(n!==null){if(t=n.tag,t===13){if(t=au(n),t!==null){e.blockedOn=t,yu(e.priority,function(){gu(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 ms(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=hi(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);ai=r,n.target.dispatchEvent(r),ai=null}else return t=$r(n),t!==null&&uo(t),e.blockedOn=n,!1;t.shift()}return!0}function pa(e,t,n){ms(e)&&n.delete(t)}function mp(){pi=!1,_t!==null&&ms(_t)&&(_t=null),Lt!==null&&ms(Lt)&&(Lt=null),Pt!==null&&ms(Pt)&&(Pt=null),Sr.forEach(pa),Nr.forEach(pa)}function qn(e,t){e.blockedOn===t&&(e.blockedOn=null,pi||(pi=!0,Fe.unstable_scheduleCallback(Fe.unstable_NormalPriority,mp)))}function br(e){function t(l){return qn(l,e)}if(0<Xr.length){qn(Xr[0],e);for(var n=1;n<Xr.length;n++){var r=Xr[n];r.blockedOn===e&&(r.blockedOn=null)}}for(_t!==null&&qn(_t,e),Lt!==null&&qn(Lt,e),Pt!==null&&qn(Pt,e),Sr.forEach(t),Nr.forEach(t),n=0;n<Et.length;n++)r=Et[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Et.length&&(n=Et[0],n.blockedOn===null);)wu(n),n.blockedOn===null&&Et.shift()}var _n=jt.ReactCurrentBatchConfig,Rs=!0;function vp(e,t,n,r){var l=W,i=_n.transition;_n.transition=null;try{W=1,fo(e,t,n,r)}finally{W=l,_n.transition=i}}function gp(e,t,n,r){var l=W,i=_n.transition;_n.transition=null;try{W=4,fo(e,t,n,r)}finally{W=l,_n.transition=i}}function fo(e,t,n,r){if(Rs){var l=hi(e,t,n,r);if(l===null)Tl(e,t,r,Ts,n),fa(e,r);else if(hp(l,e,t,n,r))r.stopPropagation();else if(fa(e,r),t&4&&-1<pp.indexOf(e)){for(;l!==null;){var i=$r(l);if(i!==null&&vu(i),i=hi(e,t,n,r),i===null&&Tl(e,t,r,Ts,n),i===l)break;l=i}l!==null&&r.stopPropagation()}else Tl(e,t,r,null,n)}}var Ts=null;function hi(e,t,n,r){if(Ts=null,e=oo(r),e=Zt(e),e!==null)if(t=fn(e),t===null)e=null;else if(n=t.tag,n===13){if(e=au(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 Ts=e,null}function ju(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(sp()){case ao:return 1;case fu:return 4;case zs:case lp:return 16;case pu:return 536870912;default:return 16}default:return 16}}var Rt=null,po=null,vs=null;function ku(){if(vs)return vs;var e,t=po,n=t.length,r,l="value"in Rt?Rt.value:Rt.textContent,i=l.length;for(e=0;e<n&&t[e]===l[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===l[i-r];r++);return vs=l.slice(e,1<r?1-r:void 0)}function gs(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 qr(){return!0}function ha(){return!1}function We(e){function t(n,r,l,i,o){this._reactName=n,this._targetInst=l,this.type=r,this.nativeEvent=i,this.target=o,this.currentTarget=null;for(var a in e)e.hasOwnProperty(a)&&(n=e[a],this[a]=n?n(i):i[a]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?qr:ha,this.isPropagationStopped=ha,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=qr)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=qr)},persist:function(){},isPersistent:qr}),t}var Vn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ho=We(Vn),Fr=Z({},Vn,{view:0,detail:0}),xp=We(Fr),kl,Sl,Zn,tl=Z({},Fr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:mo,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"?(kl=e.screenX-Zn.screenX,Sl=e.screenY-Zn.screenY):Sl=kl=0,Zn=e),kl)},movementY:function(e){return"movementY"in e?e.movementY:Sl}}),ma=We(tl),yp=Z({},tl,{dataTransfer:0}),wp=We(yp),jp=Z({},Fr,{relatedTarget:0}),Nl=We(jp),kp=Z({},Vn,{animationName:0,elapsedTime:0,pseudoElement:0}),Sp=We(kp),Np=Z({},Vn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),bp=We(Np),Cp=Z({},Vn,{data:0}),va=We(Cp),Ep={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},zp={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"},Mp={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Rp(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Mp[e])?!!t[e]:!1}function mo(){return Rp}var Tp=Z({},Fr,{key:function(e){if(e.key){var t=Ep[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=gs(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?zp[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:mo,charCode:function(e){return e.type==="keypress"?gs(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?gs(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),_p=We(Tp),Lp=Z({},tl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ga=We(Lp),Pp=Z({},Fr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:mo}),Ip=We(Pp),Dp=Z({},Vn,{propertyName:0,elapsedTime:0,pseudoElement:0}),Op=We(Dp),Ap=Z({},tl,{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}),Fp=We(Ap),$p=[9,13,27,32],vo=vt&&"CompositionEvent"in window,fr=null;vt&&"documentMode"in document&&(fr=document.documentMode);var Wp=vt&&"TextEvent"in window&&!fr,Su=vt&&(!vo||fr&&8<fr&&11>=fr),xa=" ",ya=!1;function Nu(e,t){switch(e){case"keyup":return $p.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function bu(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var xn=!1;function Bp(e,t){switch(e){case"compositionend":return bu(t);case"keypress":return t.which!==32?null:(ya=!0,xa);case"textInput":return e=t.data,e===xa&&ya?null:e;default:return null}}function Up(e,t){if(xn)return e==="compositionend"||!vo&&Nu(e,t)?(e=ku(),vs=po=Rt=null,xn=!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 Su&&t.locale!=="ko"?null:t.data;default:return null}}var Hp={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 wa(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Hp[e.type]:t==="textarea"}function Cu(e,t,n,r){ru(r),t=_s(t,"onChange"),0<t.length&&(n=new ho("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var pr=null,Cr=null;function Vp(e){Ou(e,0)}function nl(e){var t=jn(e);if(Xc(t))return e}function Kp(e,t){if(e==="change")return t}var Eu=!1;if(vt){var bl;if(vt){var Cl="oninput"in document;if(!Cl){var ja=document.createElement("div");ja.setAttribute("oninput","return;"),Cl=typeof ja.oninput=="function"}bl=Cl}else bl=!1;Eu=bl&&(!document.documentMode||9<document.documentMode)}function ka(){pr&&(pr.detachEvent("onpropertychange",zu),Cr=pr=null)}function zu(e){if(e.propertyName==="value"&&nl(Cr)){var t=[];Cu(t,Cr,e,oo(e)),ou(Vp,t)}}function Qp(e,t,n){e==="focusin"?(ka(),pr=t,Cr=n,pr.attachEvent("onpropertychange",zu)):e==="focusout"&&ka()}function Gp(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return nl(Cr)}function Yp(e,t){if(e==="click")return nl(t)}function Xp(e,t){if(e==="input"||e==="change")return nl(t)}function qp(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var st=typeof Object.is=="function"?Object.is:qp;function Er(e,t){if(st(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var l=n[r];if(!Xl.call(t,l)||!st(e[l],t[l]))return!1}return!0}function Sa(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Na(e,t){var n=Sa(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Sa(n)}}function Mu(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Mu(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ru(){for(var e=window,t=bs();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=bs(e.document)}return t}function go(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 Zp(e){var t=Ru(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Mu(n.ownerDocument.documentElement,n)){if(r!==null&&go(n)){if(t=r.start,e=r.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,i=Math.min(r.start,l);r=r.end===void 0?i:Math.min(r.end,l),!e.extend&&i>r&&(l=r,r=i,i=l),l=Na(n,i);var o=Na(n,r);l&&o&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.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 Jp=vt&&"documentMode"in document&&11>=document.documentMode,yn=null,mi=null,hr=null,vi=!1;function ba(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;vi||yn==null||yn!==bs(r)||(r=yn,"selectionStart"in r&&go(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),hr&&Er(hr,r)||(hr=r,r=_s(mi,"onSelect"),0<r.length&&(t=new ho("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=yn)))}function Zr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var wn={animationend:Zr("Animation","AnimationEnd"),animationiteration:Zr("Animation","AnimationIteration"),animationstart:Zr("Animation","AnimationStart"),transitionend:Zr("Transition","TransitionEnd")},El={},Tu={};vt&&(Tu=document.createElement("div").style,"AnimationEvent"in window||(delete wn.animationend.animation,delete wn.animationiteration.animation,delete wn.animationstart.animation),"TransitionEvent"in window||delete wn.transitionend.transition);function rl(e){if(El[e])return El[e];if(!wn[e])return e;var t=wn[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Tu)return El[e]=t[n];return e}var _u=rl("animationend"),Lu=rl("animationiteration"),Pu=rl("animationstart"),Iu=rl("transitionend"),Du=new Map,Ca="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 Bt(e,t){Du.set(e,t),dn(t,[e])}for(var zl=0;zl<Ca.length;zl++){var Ml=Ca[zl],eh=Ml.toLowerCase(),th=Ml[0].toUpperCase()+Ml.slice(1);Bt(eh,"on"+th)}Bt(_u,"onAnimationEnd");Bt(Lu,"onAnimationIteration");Bt(Pu,"onAnimationStart");Bt("dblclick","onDoubleClick");Bt("focusin","onFocus");Bt("focusout","onBlur");Bt(Iu,"onTransitionEnd");Dn("onMouseEnter",["mouseout","mouseover"]);Dn("onMouseLeave",["mouseout","mouseover"]);Dn("onPointerEnter",["pointerout","pointerover"]);Dn("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 ar="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(" "),nh=new Set("cancel close invalid load scroll toggle".split(" ").concat(ar));function Ea(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,ep(r,t,void 0,e),e.currentTarget=null}function Ou(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],l=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var o=r.length-1;0<=o;o--){var a=r[o],c=a.instance,u=a.currentTarget;if(a=a.listener,c!==i&&l.isPropagationStopped())break e;Ea(l,a,u),i=c}else for(o=0;o<r.length;o++){if(a=r[o],c=a.instance,u=a.currentTarget,a=a.listener,c!==i&&l.isPropagationStopped())break e;Ea(l,a,u),i=c}}}if(Es)throw e=di,Es=!1,di=null,e}function V(e,t){var n=t[ji];n===void 0&&(n=t[ji]=new Set);var r=e+"__bubble";n.has(r)||(Au(t,e,2,!1),n.add(r))}function Rl(e,t,n){var r=0;t&&(r|=4),Au(n,e,r,t)}var Jr="_reactListening"+Math.random().toString(36).slice(2);function zr(e){if(!e[Jr]){e[Jr]=!0,Vc.forEach(function(n){n!=="selectionchange"&&(nh.has(n)||Rl(n,!1,e),Rl(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Jr]||(t[Jr]=!0,Rl("selectionchange",!1,t))}}function Au(e,t,n,r){switch(ju(t)){case 1:var l=vp;break;case 4:l=gp;break;default:l=fo}n=l.bind(null,t,n,e),l=void 0,!ui||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(l=!0),r?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 Tl(e,t,n,r,l){var i=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var a=r.stateNode.containerInfo;if(a===l||a.nodeType===8&&a.parentNode===l)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===l||c.nodeType===8&&c.parentNode===l))return;o=o.return}for(;a!==null;){if(o=Zt(a),o===null)return;if(c=o.tag,c===5||c===6){r=i=o;continue e}a=a.parentNode}}r=r.return}ou(function(){var u=i,h=oo(n),m=[];e:{var v=Du.get(e);if(v!==void 0){var y=ho,x=e;switch(e){case"keypress":if(gs(n)===0)break e;case"keydown":case"keyup":y=_p;break;case"focusin":x="focus",y=Nl;break;case"focusout":x="blur",y=Nl;break;case"beforeblur":case"afterblur":y=Nl;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":y=ma;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":y=wp;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":y=Ip;break;case _u:case Lu:case Pu:y=Sp;break;case Iu:y=Op;break;case"scroll":y=xp;break;case"wheel":y=Fp;break;case"copy":case"cut":case"paste":y=bp;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":y=ga}var g=(t&4)!==0,b=!g&&e==="scroll",f=g?v!==null?v+"Capture":null:v;g=[];for(var d=u,p;d!==null;){p=d;var j=p.stateNode;if(p.tag===5&&j!==null&&(p=j,f!==null&&(j=kr(d,f),j!=null&&g.push(Mr(d,j,p)))),b)break;d=d.return}0<g.length&&(v=new y(v,x,null,n,h),m.push({event:v,listeners:g}))}}if(!(t&7)){e:{if(v=e==="mouseover"||e==="pointerover",y=e==="mouseout"||e==="pointerout",v&&n!==ai&&(x=n.relatedTarget||n.fromElement)&&(Zt(x)||x[gt]))break e;if((y||v)&&(v=h.window===h?h:(v=h.ownerDocument)?v.defaultView||v.parentWindow:window,y?(x=n.relatedTarget||n.toElement,y=u,x=x?Zt(x):null,x!==null&&(b=fn(x),x!==b||x.tag!==5&&x.tag!==6)&&(x=null)):(y=null,x=u),y!==x)){if(g=ma,j="onMouseLeave",f="onMouseEnter",d="mouse",(e==="pointerout"||e==="pointerover")&&(g=ga,j="onPointerLeave",f="onPointerEnter",d="pointer"),b=y==null?v:jn(y),p=x==null?v:jn(x),v=new g(j,d+"leave",y,n,h),v.target=b,v.relatedTarget=p,j=null,Zt(h)===u&&(g=new g(f,d+"enter",x,n,h),g.target=p,g.relatedTarget=b,j=g),b=j,y&&x)t:{for(g=y,f=x,d=0,p=g;p;p=pn(p))d++;for(p=0,j=f;j;j=pn(j))p++;for(;0<d-p;)g=pn(g),d--;for(;0<p-d;)f=pn(f),p--;for(;d--;){if(g===f||f!==null&&g===f.alternate)break t;g=pn(g),f=pn(f)}g=null}else g=null;y!==null&&za(m,v,y,g,!1),x!==null&&b!==null&&za(m,b,x,g,!0)}}e:{if(v=u?jn(u):window,y=v.nodeName&&v.nodeName.toLowerCase(),y==="select"||y==="input"&&v.type==="file")var k=Kp;else if(wa(v))if(Eu)k=Xp;else{k=Gp;var N=Qp}else(y=v.nodeName)&&y.toLowerCase()==="input"&&(v.type==="checkbox"||v.type==="radio")&&(k=Yp);if(k&&(k=k(e,u))){Cu(m,k,n,h);break e}N&&N(e,v,u),e==="focusout"&&(N=v._wrapperState)&&N.controlled&&v.type==="number"&&ri(v,"number",v.value)}switch(N=u?jn(u):window,e){case"focusin":(wa(N)||N.contentEditable==="true")&&(yn=N,mi=u,hr=null);break;case"focusout":hr=mi=yn=null;break;case"mousedown":vi=!0;break;case"contextmenu":case"mouseup":case"dragend":vi=!1,ba(m,n,h);break;case"selectionchange":if(Jp)break;case"keydown":case"keyup":ba(m,n,h)}var E;if(vo)e:{switch(e){case"compositionstart":var T="onCompositionStart";break e;case"compositionend":T="onCompositionEnd";break e;case"compositionupdate":T="onCompositionUpdate";break e}T=void 0}else xn?Nu(e,n)&&(T="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(T="onCompositionStart");T&&(Su&&n.locale!=="ko"&&(xn||T!=="onCompositionStart"?T==="onCompositionEnd"&&xn&&(E=ku()):(Rt=h,po="value"in Rt?Rt.value:Rt.textContent,xn=!0)),N=_s(u,T),0<N.length&&(T=new va(T,e,null,n,h),m.push({event:T,listeners:N}),E?T.data=E:(E=bu(n),E!==null&&(T.data=E)))),(E=Wp?Bp(e,n):Up(e,n))&&(u=_s(u,"onBeforeInput"),0<u.length&&(h=new va("onBeforeInput","beforeinput",null,n,h),m.push({event:h,listeners:u}),h.data=E))}Ou(m,t)})}function Mr(e,t,n){return{instance:e,listener:t,currentTarget:n}}function _s(e,t){for(var n=t+"Capture",r=[];e!==null;){var l=e,i=l.stateNode;l.tag===5&&i!==null&&(l=i,i=kr(e,n),i!=null&&r.unshift(Mr(e,i,l)),i=kr(e,t),i!=null&&r.push(Mr(e,i,l))),e=e.return}return r}function pn(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function za(e,t,n,r,l){for(var i=t._reactName,o=[];n!==null&&n!==r;){var a=n,c=a.alternate,u=a.stateNode;if(c!==null&&c===r)break;a.tag===5&&u!==null&&(a=u,l?(c=kr(n,i),c!=null&&o.unshift(Mr(n,c,a))):l||(c=kr(n,i),c!=null&&o.push(Mr(n,c,a)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var rh=/\r\n?/g,sh=/\u0000|\uFFFD/g;function Ma(e){return(typeof e=="string"?e:""+e).replace(rh,`
38
+ `).replace(sh,"")}function es(e,t,n){if(t=Ma(t),Ma(e)!==t&&n)throw Error(M(425))}function Ls(){}var gi=null,xi=null;function yi(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 wi=typeof setTimeout=="function"?setTimeout:void 0,lh=typeof clearTimeout=="function"?clearTimeout:void 0,Ra=typeof Promise=="function"?Promise:void 0,ih=typeof queueMicrotask=="function"?queueMicrotask:typeof Ra<"u"?function(e){return Ra.resolve(null).then(e).catch(oh)}:wi;function oh(e){setTimeout(function(){throw e})}function _l(e,t){var n=t,r=0;do{var l=n.nextSibling;if(e.removeChild(n),l&&l.nodeType===8)if(n=l.data,n==="/$"){if(r===0){e.removeChild(l),br(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=l}while(n);br(t)}function It(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 Ta(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 Kn=Math.random().toString(36).slice(2),ot="__reactFiber$"+Kn,Rr="__reactProps$"+Kn,gt="__reactContainer$"+Kn,ji="__reactEvents$"+Kn,ah="__reactListeners$"+Kn,ch="__reactHandles$"+Kn;function Zt(e){var t=e[ot];if(t)return t;for(var n=e.parentNode;n;){if(t=n[gt]||n[ot]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Ta(e);e!==null;){if(n=e[ot])return n;e=Ta(e)}return t}e=n,n=e.parentNode}return null}function $r(e){return e=e[ot]||e[gt],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function jn(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(M(33))}function sl(e){return e[Rr]||null}var ki=[],kn=-1;function Ut(e){return{current:e}}function K(e){0>kn||(e.current=ki[kn],ki[kn]=null,kn--)}function U(e,t){kn++,ki[kn]=e.current,e.current=t}var Wt={},we=Ut(Wt),_e=Ut(!1),sn=Wt;function On(e,t){var n=e.type.contextTypes;if(!n)return Wt;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},i;for(i in n)l[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function Le(e){return e=e.childContextTypes,e!=null}function Ps(){K(_e),K(we)}function _a(e,t,n){if(we.current!==Wt)throw Error(M(168));U(we,t),U(_e,n)}function Fu(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(M(108,Qf(e)||"Unknown",l));return Z({},n,r)}function Is(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Wt,sn=we.current,U(we,e),U(_e,_e.current),!0}function La(e,t,n){var r=e.stateNode;if(!r)throw Error(M(169));n?(e=Fu(e,t,sn),r.__reactInternalMemoizedMergedChildContext=e,K(_e),K(we),U(we,e)):K(_e),U(_e,n)}var ft=null,ll=!1,Ll=!1;function $u(e){ft===null?ft=[e]:ft.push(e)}function uh(e){ll=!0,$u(e)}function Ht(){if(!Ll&&ft!==null){Ll=!0;var e=0,t=W;try{var n=ft;for(W=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}ft=null,ll=!1}catch(l){throw ft!==null&&(ft=ft.slice(e+1)),du(ao,Ht),l}finally{W=t,Ll=!1}}return null}var Sn=[],Nn=0,Ds=null,Os=0,Ue=[],He=0,ln=null,pt=1,ht="";function Yt(e,t){Sn[Nn++]=Os,Sn[Nn++]=Ds,Ds=e,Os=t}function Wu(e,t,n){Ue[He++]=pt,Ue[He++]=ht,Ue[He++]=ln,ln=e;var r=pt;e=ht;var l=32-nt(r)-1;r&=~(1<<l),n+=1;var i=32-nt(t)+l;if(30<i){var o=l-l%5;i=(r&(1<<o)-1).toString(32),r>>=o,l-=o,pt=1<<32-nt(t)+l|n<<l|r,ht=i+e}else pt=1<<i|n<<l|r,ht=e}function xo(e){e.return!==null&&(Yt(e,1),Wu(e,1,0))}function yo(e){for(;e===Ds;)Ds=Sn[--Nn],Sn[Nn]=null,Os=Sn[--Nn],Sn[Nn]=null;for(;e===ln;)ln=Ue[--He],Ue[He]=null,ht=Ue[--He],Ue[He]=null,pt=Ue[--He],Ue[He]=null}var Ae=null,Oe=null,Y=!1,tt=null;function Bu(e,t){var n=Ve(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 Pa(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,Ae=e,Oe=It(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Ae=e,Oe=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=ln!==null?{id:pt,overflow:ht}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Ve(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Ae=e,Oe=null,!0):!1;default:return!1}}function Si(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Ni(e){if(Y){var t=Oe;if(t){var n=t;if(!Pa(e,t)){if(Si(e))throw Error(M(418));t=It(n.nextSibling);var r=Ae;t&&Pa(e,t)?Bu(r,n):(e.flags=e.flags&-4097|2,Y=!1,Ae=e)}}else{if(Si(e))throw Error(M(418));e.flags=e.flags&-4097|2,Y=!1,Ae=e}}}function Ia(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Ae=e}function ts(e){if(e!==Ae)return!1;if(!Y)return Ia(e),Y=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!yi(e.type,e.memoizedProps)),t&&(t=Oe)){if(Si(e))throw Uu(),Error(M(418));for(;t;)Bu(e,t),t=It(t.nextSibling)}if(Ia(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(M(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Oe=It(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Oe=null}}else Oe=Ae?It(e.stateNode.nextSibling):null;return!0}function Uu(){for(var e=Oe;e;)e=It(e.nextSibling)}function An(){Oe=Ae=null,Y=!1}function wo(e){tt===null?tt=[e]:tt.push(e)}var dh=jt.ReactCurrentBatchConfig;function Jn(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(M(309));var r=n.stateNode}if(!r)throw Error(M(147,e));var l=r,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(o){var a=l.refs;o===null?delete a[i]:a[i]=o},t._stringRef=i,t)}if(typeof e!="string")throw Error(M(284));if(!n._owner)throw Error(M(290,e))}return e}function ns(e,t){throw e=Object.prototype.toString.call(t),Error(M(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Da(e){var t=e._init;return t(e._payload)}function Hu(e){function t(f,d){if(e){var p=f.deletions;p===null?(f.deletions=[d],f.flags|=16):p.push(d)}}function n(f,d){if(!e)return null;for(;d!==null;)t(f,d),d=d.sibling;return null}function r(f,d){for(f=new Map;d!==null;)d.key!==null?f.set(d.key,d):f.set(d.index,d),d=d.sibling;return f}function l(f,d){return f=Ft(f,d),f.index=0,f.sibling=null,f}function i(f,d,p){return f.index=p,e?(p=f.alternate,p!==null?(p=p.index,p<d?(f.flags|=2,d):p):(f.flags|=2,d)):(f.flags|=1048576,d)}function o(f){return e&&f.alternate===null&&(f.flags|=2),f}function a(f,d,p,j){return d===null||d.tag!==6?(d=$l(p,f.mode,j),d.return=f,d):(d=l(d,p),d.return=f,d)}function c(f,d,p,j){var k=p.type;return k===gn?h(f,d,p.props.children,j,p.key):d!==null&&(d.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===bt&&Da(k)===d.type)?(j=l(d,p.props),j.ref=Jn(f,d,p),j.return=f,j):(j=Ns(p.type,p.key,p.props,null,f.mode,j),j.ref=Jn(f,d,p),j.return=f,j)}function u(f,d,p,j){return d===null||d.tag!==4||d.stateNode.containerInfo!==p.containerInfo||d.stateNode.implementation!==p.implementation?(d=Wl(p,f.mode,j),d.return=f,d):(d=l(d,p.children||[]),d.return=f,d)}function h(f,d,p,j,k){return d===null||d.tag!==7?(d=nn(p,f.mode,j,k),d.return=f,d):(d=l(d,p),d.return=f,d)}function m(f,d,p){if(typeof d=="string"&&d!==""||typeof d=="number")return d=$l(""+d,f.mode,p),d.return=f,d;if(typeof d=="object"&&d!==null){switch(d.$$typeof){case Vr:return p=Ns(d.type,d.key,d.props,null,f.mode,p),p.ref=Jn(f,null,d),p.return=f,p;case vn:return d=Wl(d,f.mode,p),d.return=f,d;case bt:var j=d._init;return m(f,j(d._payload),p)}if(ir(d)||Gn(d))return d=nn(d,f.mode,p,null),d.return=f,d;ns(f,d)}return null}function v(f,d,p,j){var k=d!==null?d.key:null;if(typeof p=="string"&&p!==""||typeof p=="number")return k!==null?null:a(f,d,""+p,j);if(typeof p=="object"&&p!==null){switch(p.$$typeof){case Vr:return p.key===k?c(f,d,p,j):null;case vn:return p.key===k?u(f,d,p,j):null;case bt:return k=p._init,v(f,d,k(p._payload),j)}if(ir(p)||Gn(p))return k!==null?null:h(f,d,p,j,null);ns(f,p)}return null}function y(f,d,p,j,k){if(typeof j=="string"&&j!==""||typeof j=="number")return f=f.get(p)||null,a(d,f,""+j,k);if(typeof j=="object"&&j!==null){switch(j.$$typeof){case Vr:return f=f.get(j.key===null?p:j.key)||null,c(d,f,j,k);case vn:return f=f.get(j.key===null?p:j.key)||null,u(d,f,j,k);case bt:var N=j._init;return y(f,d,p,N(j._payload),k)}if(ir(j)||Gn(j))return f=f.get(p)||null,h(d,f,j,k,null);ns(d,j)}return null}function x(f,d,p,j){for(var k=null,N=null,E=d,T=d=0,A=null;E!==null&&T<p.length;T++){E.index>T?(A=E,E=null):A=E.sibling;var P=v(f,E,p[T],j);if(P===null){E===null&&(E=A);break}e&&E&&P.alternate===null&&t(f,E),d=i(P,d,T),N===null?k=P:N.sibling=P,N=P,E=A}if(T===p.length)return n(f,E),Y&&Yt(f,T),k;if(E===null){for(;T<p.length;T++)E=m(f,p[T],j),E!==null&&(d=i(E,d,T),N===null?k=E:N.sibling=E,N=E);return Y&&Yt(f,T),k}for(E=r(f,E);T<p.length;T++)A=y(E,f,T,p[T],j),A!==null&&(e&&A.alternate!==null&&E.delete(A.key===null?T:A.key),d=i(A,d,T),N===null?k=A:N.sibling=A,N=A);return e&&E.forEach(function(J){return t(f,J)}),Y&&Yt(f,T),k}function g(f,d,p,j){var k=Gn(p);if(typeof k!="function")throw Error(M(150));if(p=k.call(p),p==null)throw Error(M(151));for(var N=k=null,E=d,T=d=0,A=null,P=p.next();E!==null&&!P.done;T++,P=p.next()){E.index>T?(A=E,E=null):A=E.sibling;var J=v(f,E,P.value,j);if(J===null){E===null&&(E=A);break}e&&E&&J.alternate===null&&t(f,E),d=i(J,d,T),N===null?k=J:N.sibling=J,N=J,E=A}if(P.done)return n(f,E),Y&&Yt(f,T),k;if(E===null){for(;!P.done;T++,P=p.next())P=m(f,P.value,j),P!==null&&(d=i(P,d,T),N===null?k=P:N.sibling=P,N=P);return Y&&Yt(f,T),k}for(E=r(f,E);!P.done;T++,P=p.next())P=y(E,f,T,P.value,j),P!==null&&(e&&P.alternate!==null&&E.delete(P.key===null?T:P.key),d=i(P,d,T),N===null?k=P:N.sibling=P,N=P);return e&&E.forEach(function(ce){return t(f,ce)}),Y&&Yt(f,T),k}function b(f,d,p,j){if(typeof p=="object"&&p!==null&&p.type===gn&&p.key===null&&(p=p.props.children),typeof p=="object"&&p!==null){switch(p.$$typeof){case Vr:e:{for(var k=p.key,N=d;N!==null;){if(N.key===k){if(k=p.type,k===gn){if(N.tag===7){n(f,N.sibling),d=l(N,p.props.children),d.return=f,f=d;break e}}else if(N.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===bt&&Da(k)===N.type){n(f,N.sibling),d=l(N,p.props),d.ref=Jn(f,N,p),d.return=f,f=d;break e}n(f,N);break}else t(f,N);N=N.sibling}p.type===gn?(d=nn(p.props.children,f.mode,j,p.key),d.return=f,f=d):(j=Ns(p.type,p.key,p.props,null,f.mode,j),j.ref=Jn(f,d,p),j.return=f,f=j)}return o(f);case vn:e:{for(N=p.key;d!==null;){if(d.key===N)if(d.tag===4&&d.stateNode.containerInfo===p.containerInfo&&d.stateNode.implementation===p.implementation){n(f,d.sibling),d=l(d,p.children||[]),d.return=f,f=d;break e}else{n(f,d);break}else t(f,d);d=d.sibling}d=Wl(p,f.mode,j),d.return=f,f=d}return o(f);case bt:return N=p._init,b(f,d,N(p._payload),j)}if(ir(p))return x(f,d,p,j);if(Gn(p))return g(f,d,p,j);ns(f,p)}return typeof p=="string"&&p!==""||typeof p=="number"?(p=""+p,d!==null&&d.tag===6?(n(f,d.sibling),d=l(d,p),d.return=f,f=d):(n(f,d),d=$l(p,f.mode,j),d.return=f,f=d),o(f)):n(f,d)}return b}var Fn=Hu(!0),Vu=Hu(!1),As=Ut(null),Fs=null,bn=null,jo=null;function ko(){jo=bn=Fs=null}function So(e){var t=As.current;K(As),e._currentValue=t}function bi(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Ln(e,t){Fs=e,jo=bn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Te=!0),e.firstContext=null)}function Ge(e){var t=e._currentValue;if(jo!==e)if(e={context:e,memoizedValue:t,next:null},bn===null){if(Fs===null)throw Error(M(308));bn=e,Fs.dependencies={lanes:0,firstContext:e}}else bn=bn.next=e;return t}var Jt=null;function No(e){Jt===null?Jt=[e]:Jt.push(e)}function Ku(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,No(t)):(n.next=l.next,l.next=n),t.interleaved=n,xt(e,r)}function xt(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 Ct=!1;function bo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Qu(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 mt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Dt(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,F&2){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,xt(e,n)}return l=r.interleaved,l===null?(t.next=t,No(r)):(t.next=l.next,l.next=t),r.interleaved=t,xt(e,n)}function xs(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,co(e,n)}}function Oa(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?l=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?l=i=t:i=i.next=t}else l=i=t;n={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function $s(e,t,n,r){var l=e.updateQueue;Ct=!1;var i=l.firstBaseUpdate,o=l.lastBaseUpdate,a=l.shared.pending;if(a!==null){l.shared.pending=null;var c=a,u=c.next;c.next=null,o===null?i=u:o.next=u,o=c;var h=e.alternate;h!==null&&(h=h.updateQueue,a=h.lastBaseUpdate,a!==o&&(a===null?h.firstBaseUpdate=u:a.next=u,h.lastBaseUpdate=c))}if(i!==null){var m=l.baseState;o=0,h=u=c=null,a=i;do{var v=a.lane,y=a.eventTime;if((r&v)===v){h!==null&&(h=h.next={eventTime:y,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var x=e,g=a;switch(v=t,y=n,g.tag){case 1:if(x=g.payload,typeof x=="function"){m=x.call(y,m,v);break e}m=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=g.payload,v=typeof x=="function"?x.call(y,m,v):x,v==null)break e;m=Z({},m,v);break e;case 2:Ct=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,v=l.effects,v===null?l.effects=[a]:v.push(a))}else y={eventTime:y,lane:v,tag:a.tag,payload:a.payload,callback:a.callback,next:null},h===null?(u=h=y,c=m):h=h.next=y,o|=v;if(a=a.next,a===null){if(a=l.shared.pending,a===null)break;v=a,a=v.next,v.next=null,l.lastBaseUpdate=v,l.shared.pending=null}}while(!0);if(h===null&&(c=m),l.baseState=c,l.firstBaseUpdate=u,l.lastBaseUpdate=h,t=l.shared.interleaved,t!==null){l=t;do o|=l.lane,l=l.next;while(l!==t)}else i===null&&(l.shared.lanes=0);an|=o,e.lanes=o,e.memoizedState=m}}function Aa(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],l=r.callback;if(l!==null){if(r.callback=null,r=n,typeof l!="function")throw Error(M(191,l));l.call(r)}}}var Wr={},ct=Ut(Wr),Tr=Ut(Wr),_r=Ut(Wr);function en(e){if(e===Wr)throw Error(M(174));return e}function Co(e,t){switch(U(_r,t),U(Tr,e),U(ct,Wr),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:li(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=li(t,e)}K(ct),U(ct,t)}function $n(){K(ct),K(Tr),K(_r)}function Gu(e){en(_r.current);var t=en(ct.current),n=li(t,e.type);t!==n&&(U(Tr,e),U(ct,n))}function Eo(e){Tr.current===e&&(K(ct),K(Tr))}var X=Ut(0);function Ws(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 Pl=[];function zo(){for(var e=0;e<Pl.length;e++)Pl[e]._workInProgressVersionPrimary=null;Pl.length=0}var ys=jt.ReactCurrentDispatcher,Il=jt.ReactCurrentBatchConfig,on=0,q=null,se=null,oe=null,Bs=!1,mr=!1,Lr=0,fh=0;function ve(){throw Error(M(321))}function Mo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!st(e[n],t[n]))return!1;return!0}function Ro(e,t,n,r,l,i){if(on=i,q=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,ys.current=e===null||e.memoizedState===null?vh:gh,e=n(r,l),mr){i=0;do{if(mr=!1,Lr=0,25<=i)throw Error(M(301));i+=1,oe=se=null,t.updateQueue=null,ys.current=xh,e=n(r,l)}while(mr)}if(ys.current=Us,t=se!==null&&se.next!==null,on=0,oe=se=q=null,Bs=!1,t)throw Error(M(300));return e}function To(){var e=Lr!==0;return Lr=0,e}function it(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return oe===null?q.memoizedState=oe=e:oe=oe.next=e,oe}function Ye(){if(se===null){var e=q.alternate;e=e!==null?e.memoizedState:null}else e=se.next;var t=oe===null?q.memoizedState:oe.next;if(t!==null)oe=t,se=e;else{if(e===null)throw Error(M(310));se=e,e={memoizedState:se.memoizedState,baseState:se.baseState,baseQueue:se.baseQueue,queue:se.queue,next:null},oe===null?q.memoizedState=oe=e:oe=oe.next=e}return oe}function Pr(e,t){return typeof t=="function"?t(e):t}function Dl(e){var t=Ye(),n=t.queue;if(n===null)throw Error(M(311));n.lastRenderedReducer=e;var r=se,l=r.baseQueue,i=n.pending;if(i!==null){if(l!==null){var o=l.next;l.next=i.next,i.next=o}r.baseQueue=l=i,n.pending=null}if(l!==null){i=l.next,r=r.baseState;var a=o=null,c=null,u=i;do{var h=u.lane;if((on&h)===h)c!==null&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:e(r,u.action);else{var m={lane:h,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(a=c=m,o=r):c=c.next=m,q.lanes|=h,an|=h}u=u.next}while(u!==null&&u!==i);c===null?o=r:c.next=a,st(r,t.memoizedState)||(Te=!0),t.memoizedState=r,t.baseState=o,t.baseQueue=c,n.lastRenderedState=r}if(e=n.interleaved,e!==null){l=e;do i=l.lane,q.lanes|=i,an|=i,l=l.next;while(l!==e)}else l===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Ol(e){var t=Ye(),n=t.queue;if(n===null)throw Error(M(311));n.lastRenderedReducer=e;var r=n.dispatch,l=n.pending,i=t.memoizedState;if(l!==null){n.pending=null;var o=l=l.next;do i=e(i,o.action),o=o.next;while(o!==l);st(i,t.memoizedState)||(Te=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function Yu(){}function Xu(e,t){var n=q,r=Ye(),l=t(),i=!st(r.memoizedState,l);if(i&&(r.memoizedState=l,Te=!0),r=r.queue,_o(Ju.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||oe!==null&&oe.memoizedState.tag&1){if(n.flags|=2048,Ir(9,Zu.bind(null,n,r,l,t),void 0,null),ae===null)throw Error(M(349));on&30||qu(n,t,l)}return l}function qu(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=q.updateQueue,t===null?(t={lastEffect:null,stores:null},q.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Zu(e,t,n,r){t.value=n,t.getSnapshot=r,ed(t)&&td(e)}function Ju(e,t,n){return n(function(){ed(t)&&td(e)})}function ed(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!st(e,n)}catch{return!0}}function td(e){var t=xt(e,1);t!==null&&rt(t,e,1,-1)}function Fa(e){var t=it();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=mh.bind(null,q,e),[t.memoizedState,e]}function Ir(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=q.updateQueue,t===null?(t={lastEffect:null,stores:null},q.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function nd(){return Ye().memoizedState}function ws(e,t,n,r){var l=it();q.flags|=e,l.memoizedState=Ir(1|t,n,void 0,r===void 0?null:r)}function il(e,t,n,r){var l=Ye();r=r===void 0?null:r;var i=void 0;if(se!==null){var o=se.memoizedState;if(i=o.destroy,r!==null&&Mo(r,o.deps)){l.memoizedState=Ir(t,n,i,r);return}}q.flags|=e,l.memoizedState=Ir(1|t,n,i,r)}function $a(e,t){return ws(8390656,8,e,t)}function _o(e,t){return il(2048,8,e,t)}function rd(e,t){return il(4,2,e,t)}function sd(e,t){return il(4,4,e,t)}function ld(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 id(e,t,n){return n=n!=null?n.concat([e]):null,il(4,4,ld.bind(null,t,e),n)}function Lo(){}function od(e,t){var n=Ye();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Mo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function ad(e,t){var n=Ye();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Mo(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function cd(e,t,n){return on&21?(st(n,t)||(n=hu(),q.lanes|=n,an|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Te=!0),e.memoizedState=n)}function ph(e,t){var n=W;W=n!==0&&4>n?n:4,e(!0);var r=Il.transition;Il.transition={};try{e(!1),t()}finally{W=n,Il.transition=r}}function ud(){return Ye().memoizedState}function hh(e,t,n){var r=At(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},dd(e))fd(t,n);else if(n=Ku(e,t,n,r),n!==null){var l=be();rt(n,e,r,l),pd(n,t,r)}}function mh(e,t,n){var r=At(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(dd(e))fd(t,l);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,a=i(o,n);if(l.hasEagerState=!0,l.eagerState=a,st(a,o)){var c=t.interleaved;c===null?(l.next=l,No(t)):(l.next=c.next,c.next=l),t.interleaved=l;return}}catch{}finally{}n=Ku(e,t,l,r),n!==null&&(l=be(),rt(n,e,r,l),pd(n,t,r))}}function dd(e){var t=e.alternate;return e===q||t!==null&&t===q}function fd(e,t){mr=Bs=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function pd(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,co(e,n)}}var Us={readContext:Ge,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},vh={readContext:Ge,useCallback:function(e,t){return it().memoizedState=[e,t===void 0?null:t],e},useContext:Ge,useEffect:$a,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,ws(4194308,4,ld.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ws(4194308,4,e,t)},useInsertionEffect:function(e,t){return ws(4,2,e,t)},useMemo:function(e,t){var n=it();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=it();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=hh.bind(null,q,e),[r.memoizedState,e]},useRef:function(e){var t=it();return e={current:e},t.memoizedState=e},useState:Fa,useDebugValue:Lo,useDeferredValue:function(e){return it().memoizedState=e},useTransition:function(){var e=Fa(!1),t=e[0];return e=ph.bind(null,e[1]),it().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=q,l=it();if(Y){if(n===void 0)throw Error(M(407));n=n()}else{if(n=t(),ae===null)throw Error(M(349));on&30||qu(r,t,n)}l.memoizedState=n;var i={value:n,getSnapshot:t};return l.queue=i,$a(Ju.bind(null,r,i,e),[e]),r.flags|=2048,Ir(9,Zu.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=it(),t=ae.identifierPrefix;if(Y){var n=ht,r=pt;n=(r&~(1<<32-nt(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Lr++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=fh++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},gh={readContext:Ge,useCallback:od,useContext:Ge,useEffect:_o,useImperativeHandle:id,useInsertionEffect:rd,useLayoutEffect:sd,useMemo:ad,useReducer:Dl,useRef:nd,useState:function(){return Dl(Pr)},useDebugValue:Lo,useDeferredValue:function(e){var t=Ye();return cd(t,se.memoizedState,e)},useTransition:function(){var e=Dl(Pr)[0],t=Ye().memoizedState;return[e,t]},useMutableSource:Yu,useSyncExternalStore:Xu,useId:ud,unstable_isNewReconciler:!1},xh={readContext:Ge,useCallback:od,useContext:Ge,useEffect:_o,useImperativeHandle:id,useInsertionEffect:rd,useLayoutEffect:sd,useMemo:ad,useReducer:Ol,useRef:nd,useState:function(){return Ol(Pr)},useDebugValue:Lo,useDeferredValue:function(e){var t=Ye();return se===null?t.memoizedState=e:cd(t,se.memoizedState,e)},useTransition:function(){var e=Ol(Pr)[0],t=Ye().memoizedState;return[e,t]},useMutableSource:Yu,useSyncExternalStore:Xu,useId:ud,unstable_isNewReconciler:!1};function Je(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 Ci(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:Z({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var ol={isMounted:function(e){return(e=e._reactInternals)?fn(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=be(),l=At(e),i=mt(r,l);i.payload=t,n!=null&&(i.callback=n),t=Dt(e,i,l),t!==null&&(rt(t,e,l,r),xs(t,e,l))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=be(),l=At(e),i=mt(r,l);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Dt(e,i,l),t!==null&&(rt(t,e,l,r),xs(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=be(),r=At(e),l=mt(n,r);l.tag=2,t!=null&&(l.callback=t),t=Dt(e,l,r),t!==null&&(rt(t,e,r,n),xs(t,e,r))}};function Wa(e,t,n,r,l,i,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,i,o):t.prototype&&t.prototype.isPureReactComponent?!Er(n,r)||!Er(l,i):!0}function hd(e,t,n){var r=!1,l=Wt,i=t.contextType;return typeof i=="object"&&i!==null?i=Ge(i):(l=Le(t)?sn:we.current,r=t.contextTypes,i=(r=r!=null)?On(e,l):Wt),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=ol,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=l,e.__reactInternalMemoizedMaskedChildContext=i),t}function Ba(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&ol.enqueueReplaceState(t,t.state,null)}function Ei(e,t,n,r){var l=e.stateNode;l.props=n,l.state=e.memoizedState,l.refs={},bo(e);var i=t.contextType;typeof i=="object"&&i!==null?l.context=Ge(i):(i=Le(t)?sn:we.current,l.context=On(e,i)),l.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(Ci(e,t,i,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&&ol.enqueueReplaceState(l,l.state,null),$s(e,n,l,r),l.state=e.memoizedState),typeof l.componentDidMount=="function"&&(e.flags|=4194308)}function Wn(e,t){try{var n="",r=t;do n+=Kf(r),r=r.return;while(r);var l=n}catch(i){l=`
39
+ Error generating stack: `+i.message+`
40
+ `+i.stack}return{value:e,source:t,stack:l,digest:null}}function Al(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function zi(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var yh=typeof WeakMap=="function"?WeakMap:Map;function md(e,t,n){n=mt(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Vs||(Vs=!0,Ai=r),zi(e,t)},n}function vd(e,t,n){n=mt(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var l=t.value;n.payload=function(){return r(l)},n.callback=function(){zi(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){zi(e,t),typeof r!="function"&&(Ot===null?Ot=new Set([this]):Ot.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),n}function Ua(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new yh;var l=new Set;r.set(t,l)}else l=r.get(t),l===void 0&&(l=new Set,r.set(t,l));l.has(n)||(l.add(n),e=Lh.bind(null,e,t,n),t.then(e,e))}function Ha(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 Va(e,t,n,r,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=mt(-1,1),t.tag=2,Dt(n,t,1))),n.lanes|=1),e)}var wh=jt.ReactCurrentOwner,Te=!1;function ke(e,t,n,r){t.child=e===null?Vu(t,null,n,r):Fn(t,e.child,n,r)}function Ka(e,t,n,r,l){n=n.render;var i=t.ref;return Ln(t,l),r=Ro(e,t,n,r,i,l),n=To(),e!==null&&!Te?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,yt(e,t,l)):(Y&&n&&xo(t),t.flags|=1,ke(e,t,r,l),t.child)}function Qa(e,t,n,r,l){if(e===null){var i=n.type;return typeof i=="function"&&!Wo(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,gd(e,t,i,r,l)):(e=Ns(n.type,null,r,t,t.mode,l),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&l)){var o=i.memoizedProps;if(n=n.compare,n=n!==null?n:Er,n(o,r)&&e.ref===t.ref)return yt(e,t,l)}return t.flags|=1,e=Ft(i,r),e.ref=t.ref,e.return=t,t.child=e}function gd(e,t,n,r,l){if(e!==null){var i=e.memoizedProps;if(Er(i,r)&&e.ref===t.ref)if(Te=!1,t.pendingProps=r=i,(e.lanes&l)!==0)e.flags&131072&&(Te=!0);else return t.lanes=e.lanes,yt(e,t,l)}return Mi(e,t,n,r,l)}function xd(e,t,n){var r=t.pendingProps,l=r.children,i=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},U(En,De),De|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,U(En,De),De|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,U(En,De),De|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,U(En,De),De|=r;return ke(e,t,l,n),t.child}function yd(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Mi(e,t,n,r,l){var i=Le(n)?sn:we.current;return i=On(t,i),Ln(t,l),n=Ro(e,t,n,r,i,l),r=To(),e!==null&&!Te?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,yt(e,t,l)):(Y&&r&&xo(t),t.flags|=1,ke(e,t,n,l),t.child)}function Ga(e,t,n,r,l){if(Le(n)){var i=!0;Is(t)}else i=!1;if(Ln(t,l),t.stateNode===null)js(e,t),hd(t,n,r),Ei(t,n,r,l),r=!0;else if(e===null){var o=t.stateNode,a=t.memoizedProps;o.props=a;var c=o.context,u=n.contextType;typeof u=="object"&&u!==null?u=Ge(u):(u=Le(n)?sn:we.current,u=On(t,u));var h=n.getDerivedStateFromProps,m=typeof h=="function"||typeof o.getSnapshotBeforeUpdate=="function";m||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==r||c!==u)&&Ba(t,o,r,u),Ct=!1;var v=t.memoizedState;o.state=v,$s(t,r,o,l),c=t.memoizedState,a!==r||v!==c||_e.current||Ct?(typeof h=="function"&&(Ci(t,n,h,r),c=t.memoizedState),(a=Ct||Wa(t,n,a,r,v,c,u))?(m||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),o.props=r,o.state=c,o.context=u,r=a):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,Qu(e,t),a=t.memoizedProps,u=t.type===t.elementType?a:Je(t.type,a),o.props=u,m=t.pendingProps,v=o.context,c=n.contextType,typeof c=="object"&&c!==null?c=Ge(c):(c=Le(n)?sn:we.current,c=On(t,c));var y=n.getDerivedStateFromProps;(h=typeof y=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==m||v!==c)&&Ba(t,o,r,c),Ct=!1,v=t.memoizedState,o.state=v,$s(t,r,o,l);var x=t.memoizedState;a!==m||v!==x||_e.current||Ct?(typeof y=="function"&&(Ci(t,n,y,r),x=t.memoizedState),(u=Ct||Wa(t,n,u,r,v,x,c)||!1)?(h||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,x,c),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,x,c)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===e.memoizedProps&&v===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&v===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=x),o.props=r,o.state=x,o.context=c,r=u):(typeof o.componentDidUpdate!="function"||a===e.memoizedProps&&v===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&v===e.memoizedState||(t.flags|=1024),r=!1)}return Ri(e,t,n,r,i,l)}function Ri(e,t,n,r,l,i){yd(e,t);var o=(t.flags&128)!==0;if(!r&&!o)return l&&La(t,n,!1),yt(e,t,i);r=t.stateNode,wh.current=t;var a=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Fn(t,e.child,null,i),t.child=Fn(t,null,a,i)):ke(e,t,a,i),t.memoizedState=r.state,l&&La(t,n,!0),t.child}function wd(e){var t=e.stateNode;t.pendingContext?_a(e,t.pendingContext,t.pendingContext!==t.context):t.context&&_a(e,t.context,!1),Co(e,t.containerInfo)}function Ya(e,t,n,r,l){return An(),wo(l),t.flags|=256,ke(e,t,n,r),t.child}var Ti={dehydrated:null,treeContext:null,retryLane:0};function _i(e){return{baseLanes:e,cachePool:null,transitions:null}}function jd(e,t,n){var r=t.pendingProps,l=X.current,i=!1,o=(t.flags&128)!==0,a;if((a=o)||(a=e!==null&&e.memoizedState===null?!1:(l&2)!==0),a?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(l|=1),U(X,l&1),e===null)return Ni(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):(o=r.children,e=r.fallback,i?(r=t.mode,i=t.child,o={mode:"hidden",children:o},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=o):i=ul(o,r,0,null),e=nn(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=_i(n),t.memoizedState=Ti,e):Po(t,o));if(l=e.memoizedState,l!==null&&(a=l.dehydrated,a!==null))return jh(e,t,o,r,a,l,n);if(i){i=r.fallback,o=t.mode,l=e.child,a=l.sibling;var c={mode:"hidden",children:r.children};return!(o&1)&&t.child!==l?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=Ft(l,c),r.subtreeFlags=l.subtreeFlags&14680064),a!==null?i=Ft(a,i):(i=nn(i,o,n,null),i.flags|=2),i.return=t,r.return=t,r.sibling=i,t.child=r,r=i,i=t.child,o=e.child.memoizedState,o=o===null?_i(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},i.memoizedState=o,i.childLanes=e.childLanes&~n,t.memoizedState=Ti,r}return i=e.child,e=i.sibling,r=Ft(i,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Po(e,t){return t=ul({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function rs(e,t,n,r){return r!==null&&wo(r),Fn(t,e.child,null,n),e=Po(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function jh(e,t,n,r,l,i,o){if(n)return t.flags&256?(t.flags&=-257,r=Al(Error(M(422))),rs(e,t,o,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,l=t.mode,r=ul({mode:"visible",children:r.children},l,0,null),i=nn(i,l,o,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&Fn(t,e.child,null,o),t.child.memoizedState=_i(o),t.memoizedState=Ti,i);if(!(t.mode&1))return rs(e,t,o,null);if(l.data==="$!"){if(r=l.nextSibling&&l.nextSibling.dataset,r)var a=r.dgst;return r=a,i=Error(M(419)),r=Al(i,r,void 0),rs(e,t,o,r)}if(a=(o&e.childLanes)!==0,Te||a){if(r=ae,r!==null){switch(o&-o){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&(r.suspendedLanes|o)?0:l,l!==0&&l!==i.retryLane&&(i.retryLane=l,xt(e,l),rt(r,e,l,-1))}return $o(),r=Al(Error(M(421))),rs(e,t,o,r)}return l.data==="$?"?(t.flags|=128,t.child=e.child,t=Ph.bind(null,e),l._reactRetry=t,null):(e=i.treeContext,Oe=It(l.nextSibling),Ae=t,Y=!0,tt=null,e!==null&&(Ue[He++]=pt,Ue[He++]=ht,Ue[He++]=ln,pt=e.id,ht=e.overflow,ln=t),t=Po(t,r.children),t.flags|=4096,t)}function Xa(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),bi(e.return,t,n)}function Fl(e,t,n,r,l){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:l}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=l)}function kd(e,t,n){var r=t.pendingProps,l=r.revealOrder,i=r.tail;if(ke(e,t,r.children,n),r=X.current,r&2)r=r&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&&Xa(e,n,t);else if(e.tag===19)Xa(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}r&=1}if(U(X,r),!(t.mode&1))t.memoizedState=null;else switch(l){case"forwards":for(n=t.child,l=null;n!==null;)e=n.alternate,e!==null&&Ws(e)===null&&(l=n),n=n.sibling;n=l,n===null?(l=t.child,t.child=null):(l=n.sibling,n.sibling=null),Fl(t,!1,l,n,i);break;case"backwards":for(n=null,l=t.child,t.child=null;l!==null;){if(e=l.alternate,e!==null&&Ws(e)===null){t.child=l;break}e=l.sibling,l.sibling=n,n=l,l=e}Fl(t,!0,n,null,i);break;case"together":Fl(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function js(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function yt(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(M(153));if(t.child!==null){for(e=t.child,n=Ft(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Ft(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function kh(e,t,n){switch(t.tag){case 3:wd(t),An();break;case 5:Gu(t);break;case 1:Le(t.type)&&Is(t);break;case 4:Co(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,l=t.memoizedProps.value;U(As,r._currentValue),r._currentValue=l;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(U(X,X.current&1),t.flags|=128,null):n&t.child.childLanes?jd(e,t,n):(U(X,X.current&1),e=yt(e,t,n),e!==null?e.sibling:null);U(X,X.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return kd(e,t,n);t.flags|=128}if(l=t.memoizedState,l!==null&&(l.rendering=null,l.tail=null,l.lastEffect=null),U(X,X.current),r)break;return null;case 22:case 23:return t.lanes=0,xd(e,t,n)}return yt(e,t,n)}var Sd,Li,Nd,bd;Sd=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}};Li=function(){};Nd=function(e,t,n,r){var l=e.memoizedProps;if(l!==r){e=t.stateNode,en(ct.current);var i=null;switch(n){case"input":l=ti(e,l),r=ti(e,r),i=[];break;case"select":l=Z({},l,{value:void 0}),r=Z({},r,{value:void 0}),i=[];break;case"textarea":l=si(e,l),r=si(e,r),i=[];break;default:typeof l.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Ls)}ii(n,r);var o;n=null;for(u in l)if(!r.hasOwnProperty(u)&&l.hasOwnProperty(u)&&l[u]!=null)if(u==="style"){var a=l[u];for(o in a)a.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(wr.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in r){var c=r[u];if(a=l?.[u],r.hasOwnProperty(u)&&c!==a&&(c!=null||a!=null))if(u==="style")if(a){for(o in a)!a.hasOwnProperty(o)||c&&c.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in c)c.hasOwnProperty(o)&&a[o]!==c[o]&&(n||(n={}),n[o]=c[o])}else n||(i||(i=[]),i.push(u,n)),n=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,a=a?a.__html:void 0,c!=null&&a!==c&&(i=i||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(i=i||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(wr.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&V("scroll",e),i||a===c||(i=[])):(i=i||[]).push(u,c))}n&&(i=i||[]).push("style",n);var u=i;(t.updateQueue=u)&&(t.flags|=4)}};bd=function(e,t,n,r){n!==r&&(t.flags|=4)};function er(e,t){if(!Y)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 r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function ge(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var l=e.child;l!==null;)n|=l.lanes|l.childLanes,r|=l.subtreeFlags&14680064,r|=l.flags&14680064,l.return=e,l=l.sibling;else for(l=e.child;l!==null;)n|=l.lanes|l.childLanes,r|=l.subtreeFlags,r|=l.flags,l.return=e,l=l.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Sh(e,t,n){var r=t.pendingProps;switch(yo(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ge(t),null;case 1:return Le(t.type)&&Ps(),ge(t),null;case 3:return r=t.stateNode,$n(),K(_e),K(we),zo(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(ts(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,tt!==null&&(Wi(tt),tt=null))),Li(e,t),ge(t),null;case 5:Eo(t);var l=en(_r.current);if(n=t.type,e!==null&&t.stateNode!=null)Nd(e,t,n,r,l),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(M(166));return ge(t),null}if(e=en(ct.current),ts(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[ot]=t,r[Rr]=i,e=(t.mode&1)!==0,n){case"dialog":V("cancel",r),V("close",r);break;case"iframe":case"object":case"embed":V("load",r);break;case"video":case"audio":for(l=0;l<ar.length;l++)V(ar[l],r);break;case"source":V("error",r);break;case"img":case"image":case"link":V("error",r),V("load",r);break;case"details":V("toggle",r);break;case"input":la(r,i),V("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},V("invalid",r);break;case"textarea":oa(r,i),V("invalid",r)}ii(n,i),l=null;for(var o in i)if(i.hasOwnProperty(o)){var a=i[o];o==="children"?typeof a=="string"?r.textContent!==a&&(i.suppressHydrationWarning!==!0&&es(r.textContent,a,e),l=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(i.suppressHydrationWarning!==!0&&es(r.textContent,a,e),l=["children",""+a]):wr.hasOwnProperty(o)&&a!=null&&o==="onScroll"&&V("scroll",r)}switch(n){case"input":Kr(r),ia(r,i,!0);break;case"textarea":Kr(r),aa(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=Ls)}r=l,t.updateQueue=r,r!==null&&(t.flags|=4)}else{o=l.nodeType===9?l:l.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=Jc(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=o.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[ot]=t,e[Rr]=r,Sd(e,t,!1,!1),t.stateNode=e;e:{switch(o=oi(n,r),n){case"dialog":V("cancel",e),V("close",e),l=r;break;case"iframe":case"object":case"embed":V("load",e),l=r;break;case"video":case"audio":for(l=0;l<ar.length;l++)V(ar[l],e);l=r;break;case"source":V("error",e),l=r;break;case"img":case"image":case"link":V("error",e),V("load",e),l=r;break;case"details":V("toggle",e),l=r;break;case"input":la(e,r),l=ti(e,r),V("invalid",e);break;case"option":l=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},l=Z({},r,{value:void 0}),V("invalid",e);break;case"textarea":oa(e,r),l=si(e,r),V("invalid",e);break;default:l=r}ii(n,l),a=l;for(i in a)if(a.hasOwnProperty(i)){var c=a[i];i==="style"?nu(e,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&eu(e,c)):i==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&jr(e,c):typeof c=="number"&&jr(e,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(wr.hasOwnProperty(i)?c!=null&&i==="onScroll"&&V("scroll",e):c!=null&&ro(e,i,c,o))}switch(n){case"input":Kr(e),ia(e,r,!1);break;case"textarea":Kr(e),aa(e);break;case"option":r.value!=null&&e.setAttribute("value",""+$t(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?Mn(e,!!r.multiple,i,!1):r.defaultValue!=null&&Mn(e,!!r.multiple,r.defaultValue,!0);break;default:typeof l.onClick=="function"&&(e.onclick=Ls)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return ge(t),null;case 6:if(e&&t.stateNode!=null)bd(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(M(166));if(n=en(_r.current),en(ct.current),ts(t)){if(r=t.stateNode,n=t.memoizedProps,r[ot]=t,(i=r.nodeValue!==n)&&(e=Ae,e!==null))switch(e.tag){case 3:es(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&es(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[ot]=t,t.stateNode=r}return ge(t),null;case 13:if(K(X),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Y&&Oe!==null&&t.mode&1&&!(t.flags&128))Uu(),An(),t.flags|=98560,i=!1;else if(i=ts(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(M(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(M(317));i[ot]=t}else An(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;ge(t),i=!1}else tt!==null&&(Wi(tt),tt=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||X.current&1?le===0&&(le=3):$o())),t.updateQueue!==null&&(t.flags|=4),ge(t),null);case 4:return $n(),Li(e,t),e===null&&zr(t.stateNode.containerInfo),ge(t),null;case 10:return So(t.type._context),ge(t),null;case 17:return Le(t.type)&&Ps(),ge(t),null;case 19:if(K(X),i=t.memoizedState,i===null)return ge(t),null;if(r=(t.flags&128)!==0,o=i.rendering,o===null)if(r)er(i,!1);else{if(le!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Ws(e),o!==null){for(t.flags|=128,er(i,!1),r=o.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)i=n,e=r,i.flags&=14680066,o=i.alternate,o===null?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=o.childLanes,i.lanes=o.lanes,i.child=o.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=o.memoizedProps,i.memoizedState=o.memoizedState,i.updateQueue=o.updateQueue,i.type=o.type,e=o.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return U(X,X.current&1|2),t.child}e=e.sibling}i.tail!==null&&ne()>Bn&&(t.flags|=128,r=!0,er(i,!1),t.lanes=4194304)}else{if(!r)if(e=Ws(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),er(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!Y)return ge(t),null}else 2*ne()-i.renderingStartTime>Bn&&n!==1073741824&&(t.flags|=128,r=!0,er(i,!1),t.lanes=4194304);i.isBackwards?(o.sibling=t.child,t.child=o):(n=i.last,n!==null?n.sibling=o:t.child=o,i.last=o)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=ne(),t.sibling=null,n=X.current,U(X,r?n&1|2:n&1),t):(ge(t),null);case 22:case 23:return Fo(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?De&1073741824&&(ge(t),t.subtreeFlags&6&&(t.flags|=8192)):ge(t),null;case 24:return null;case 25:return null}throw Error(M(156,t.tag))}function Nh(e,t){switch(yo(t),t.tag){case 1:return Le(t.type)&&Ps(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return $n(),K(_e),K(we),zo(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Eo(t),null;case 13:if(K(X),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(M(340));An()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return K(X),null;case 4:return $n(),null;case 10:return So(t.type._context),null;case 22:case 23:return Fo(),null;case 24:return null;default:return null}}var ss=!1,xe=!1,bh=typeof WeakSet=="function"?WeakSet:Set,_=null;function Cn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){te(e,t,r)}else n.current=null}function Pi(e,t,n){try{n()}catch(r){te(e,t,r)}}var qa=!1;function Ch(e,t){if(gi=Rs,e=Ru(),go(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,a=-1,c=-1,u=0,h=0,m=e,v=null;t:for(;;){for(var y;m!==n||l!==0&&m.nodeType!==3||(a=o+l),m!==i||r!==0&&m.nodeType!==3||(c=o+r),m.nodeType===3&&(o+=m.nodeValue.length),(y=m.firstChild)!==null;)v=m,m=y;for(;;){if(m===e)break t;if(v===n&&++u===l&&(a=o),v===i&&++h===r&&(c=o),(y=m.nextSibling)!==null)break;m=v,v=m.parentNode}m=y}n=a===-1||c===-1?null:{start:a,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(xi={focusedElem:e,selectionRange:n},Rs=!1,_=t;_!==null;)if(t=_,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,_=e;else for(;_!==null;){t=_;try{var x=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var g=x.memoizedProps,b=x.memoizedState,f=t.stateNode,d=f.getSnapshotBeforeUpdate(t.elementType===t.type?g:Je(t.type,g),b);f.__reactInternalSnapshotBeforeUpdate=d}break;case 3:var p=t.stateNode.containerInfo;p.nodeType===1?p.textContent="":p.nodeType===9&&p.documentElement&&p.removeChild(p.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(M(163))}}catch(j){te(t,t.return,j)}if(e=t.sibling,e!==null){e.return=t.return,_=e;break}_=t.return}return x=qa,qa=!1,x}function vr(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var i=l.destroy;l.destroy=void 0,i!==void 0&&Pi(t,n,i)}l=l.next}while(l!==r)}}function al(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 r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Ii(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 Cd(e){var t=e.alternate;t!==null&&(e.alternate=null,Cd(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ot],delete t[Rr],delete t[ji],delete t[ah],delete t[ch])),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 Ed(e){return e.tag===5||e.tag===3||e.tag===4}function Za(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Ed(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 Di(e,t,n){var r=e.tag;if(r===5||r===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=Ls));else if(r!==4&&(e=e.child,e!==null))for(Di(e,t,n),e=e.sibling;e!==null;)Di(e,t,n),e=e.sibling}function Oi(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Oi(e,t,n),e=e.sibling;e!==null;)Oi(e,t,n),e=e.sibling}var de=null,et=!1;function St(e,t,n){for(n=n.child;n!==null;)zd(e,t,n),n=n.sibling}function zd(e,t,n){if(at&&typeof at.onCommitFiberUnmount=="function")try{at.onCommitFiberUnmount(el,n)}catch{}switch(n.tag){case 5:xe||Cn(n,t);case 6:var r=de,l=et;de=null,St(e,t,n),de=r,et=l,de!==null&&(et?(e=de,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):de.removeChild(n.stateNode));break;case 18:de!==null&&(et?(e=de,n=n.stateNode,e.nodeType===8?_l(e.parentNode,n):e.nodeType===1&&_l(e,n),br(e)):_l(de,n.stateNode));break;case 4:r=de,l=et,de=n.stateNode.containerInfo,et=!0,St(e,t,n),de=r,et=l;break;case 0:case 11:case 14:case 15:if(!xe&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var i=l,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&Pi(n,t,o),l=l.next}while(l!==r)}St(e,t,n);break;case 1:if(!xe&&(Cn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){te(n,t,a)}St(e,t,n);break;case 21:St(e,t,n);break;case 22:n.mode&1?(xe=(r=xe)||n.memoizedState!==null,St(e,t,n),xe=r):St(e,t,n);break;default:St(e,t,n)}}function Ja(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new bh),t.forEach(function(r){var l=Ih.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function Ze(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var l=n[r];try{var i=e,o=t,a=o;e:for(;a!==null;){switch(a.tag){case 5:de=a.stateNode,et=!1;break e;case 3:de=a.stateNode.containerInfo,et=!0;break e;case 4:de=a.stateNode.containerInfo,et=!0;break e}a=a.return}if(de===null)throw Error(M(160));zd(i,o,l),de=null,et=!1;var c=l.alternate;c!==null&&(c.return=null),l.return=null}catch(u){te(l,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Md(t,e),t=t.sibling}function Md(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Ze(t,e),lt(e),r&4){try{vr(3,e,e.return),al(3,e)}catch(g){te(e,e.return,g)}try{vr(5,e,e.return)}catch(g){te(e,e.return,g)}}break;case 1:Ze(t,e),lt(e),r&512&&n!==null&&Cn(n,n.return);break;case 5:if(Ze(t,e),lt(e),r&512&&n!==null&&Cn(n,n.return),e.flags&32){var l=e.stateNode;try{jr(l,"")}catch(g){te(e,e.return,g)}}if(r&4&&(l=e.stateNode,l!=null)){var i=e.memoizedProps,o=n!==null?n.memoizedProps:i,a=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{a==="input"&&i.type==="radio"&&i.name!=null&&qc(l,i),oi(a,o);var u=oi(a,i);for(o=0;o<c.length;o+=2){var h=c[o],m=c[o+1];h==="style"?nu(l,m):h==="dangerouslySetInnerHTML"?eu(l,m):h==="children"?jr(l,m):ro(l,h,m,u)}switch(a){case"input":ni(l,i);break;case"textarea":Zc(l,i);break;case"select":var v=l._wrapperState.wasMultiple;l._wrapperState.wasMultiple=!!i.multiple;var y=i.value;y!=null?Mn(l,!!i.multiple,y,!1):v!==!!i.multiple&&(i.defaultValue!=null?Mn(l,!!i.multiple,i.defaultValue,!0):Mn(l,!!i.multiple,i.multiple?[]:"",!1))}l[Rr]=i}catch(g){te(e,e.return,g)}}break;case 6:if(Ze(t,e),lt(e),r&4){if(e.stateNode===null)throw Error(M(162));l=e.stateNode,i=e.memoizedProps;try{l.nodeValue=i}catch(g){te(e,e.return,g)}}break;case 3:if(Ze(t,e),lt(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{br(t.containerInfo)}catch(g){te(e,e.return,g)}break;case 4:Ze(t,e),lt(e);break;case 13:Ze(t,e),lt(e),l=e.child,l.flags&8192&&(i=l.memoizedState!==null,l.stateNode.isHidden=i,!i||l.alternate!==null&&l.alternate.memoizedState!==null||(Oo=ne())),r&4&&Ja(e);break;case 22:if(h=n!==null&&n.memoizedState!==null,e.mode&1?(xe=(u=xe)||h,Ze(t,e),xe=u):Ze(t,e),lt(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!h&&e.mode&1)for(_=e,h=e.child;h!==null;){for(m=_=h;_!==null;){switch(v=_,y=v.child,v.tag){case 0:case 11:case 14:case 15:vr(4,v,v.return);break;case 1:Cn(v,v.return);var x=v.stateNode;if(typeof x.componentWillUnmount=="function"){r=v,n=v.return;try{t=r,x.props=t.memoizedProps,x.state=t.memoizedState,x.componentWillUnmount()}catch(g){te(r,n,g)}}break;case 5:Cn(v,v.return);break;case 22:if(v.memoizedState!==null){tc(m);continue}}y!==null?(y.return=v,_=y):tc(m)}h=h.sibling}e:for(h=null,m=e;;){if(m.tag===5){if(h===null){h=m;try{l=m.stateNode,u?(i=l.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(a=m.stateNode,c=m.memoizedProps.style,o=c!=null&&c.hasOwnProperty("display")?c.display:null,a.style.display=tu("display",o))}catch(g){te(e,e.return,g)}}}else if(m.tag===6){if(h===null)try{m.stateNode.nodeValue=u?"":m.memoizedProps}catch(g){te(e,e.return,g)}}else if((m.tag!==22&&m.tag!==23||m.memoizedState===null||m===e)&&m.child!==null){m.child.return=m,m=m.child;continue}if(m===e)break e;for(;m.sibling===null;){if(m.return===null||m.return===e)break e;h===m&&(h=null),m=m.return}h===m&&(h=null),m.sibling.return=m.return,m=m.sibling}}break;case 19:Ze(t,e),lt(e),r&4&&Ja(e);break;case 21:break;default:Ze(t,e),lt(e)}}function lt(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(Ed(n)){var r=n;break e}n=n.return}throw Error(M(160))}switch(r.tag){case 5:var l=r.stateNode;r.flags&32&&(jr(l,""),r.flags&=-33);var i=Za(e);Oi(e,i,l);break;case 3:case 4:var o=r.stateNode.containerInfo,a=Za(e);Di(e,a,o);break;default:throw Error(M(161))}}catch(c){te(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Eh(e,t,n){_=e,Rd(e)}function Rd(e,t,n){for(var r=(e.mode&1)!==0;_!==null;){var l=_,i=l.child;if(l.tag===22&&r){var o=l.memoizedState!==null||ss;if(!o){var a=l.alternate,c=a!==null&&a.memoizedState!==null||xe;a=ss;var u=xe;if(ss=o,(xe=c)&&!u)for(_=l;_!==null;)o=_,c=o.child,o.tag===22&&o.memoizedState!==null?nc(l):c!==null?(c.return=o,_=c):nc(l);for(;i!==null;)_=i,Rd(i),i=i.sibling;_=l,ss=a,xe=u}ec(e)}else l.subtreeFlags&8772&&i!==null?(i.return=l,_=i):ec(e)}}function ec(e){for(;_!==null;){var t=_;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:xe||al(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!xe)if(n===null)r.componentDidMount();else{var l=t.elementType===t.type?n.memoizedProps:Je(t.type,n.memoizedProps);r.componentDidUpdate(l,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&Aa(t,i,r);break;case 3:var o=t.updateQueue;if(o!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}Aa(t,o,n)}break;case 5:var a=t.stateNode;if(n===null&&t.flags&4){n=a;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 u=t.alternate;if(u!==null){var h=u.memoizedState;if(h!==null){var m=h.dehydrated;m!==null&&br(m)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(M(163))}xe||t.flags&512&&Ii(t)}catch(v){te(t,t.return,v)}}if(t===e){_=null;break}if(n=t.sibling,n!==null){n.return=t.return,_=n;break}_=t.return}}function tc(e){for(;_!==null;){var t=_;if(t===e){_=null;break}var n=t.sibling;if(n!==null){n.return=t.return,_=n;break}_=t.return}}function nc(e){for(;_!==null;){var t=_;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{al(4,t)}catch(c){te(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var l=t.return;try{r.componentDidMount()}catch(c){te(t,l,c)}}var i=t.return;try{Ii(t)}catch(c){te(t,i,c)}break;case 5:var o=t.return;try{Ii(t)}catch(c){te(t,o,c)}}}catch(c){te(t,t.return,c)}if(t===e){_=null;break}var a=t.sibling;if(a!==null){a.return=t.return,_=a;break}_=t.return}}var zh=Math.ceil,Hs=jt.ReactCurrentDispatcher,Io=jt.ReactCurrentOwner,Ke=jt.ReactCurrentBatchConfig,F=0,ae=null,re=null,pe=0,De=0,En=Ut(0),le=0,Dr=null,an=0,cl=0,Do=0,gr=null,Re=null,Oo=0,Bn=1/0,dt=null,Vs=!1,Ai=null,Ot=null,ls=!1,Tt=null,Ks=0,xr=0,Fi=null,ks=-1,Ss=0;function be(){return F&6?ne():ks!==-1?ks:ks=ne()}function At(e){return e.mode&1?F&2&&pe!==0?pe&-pe:dh.transition!==null?(Ss===0&&(Ss=hu()),Ss):(e=W,e!==0||(e=window.event,e=e===void 0?16:ju(e.type)),e):1}function rt(e,t,n,r){if(50<xr)throw xr=0,Fi=null,Error(M(185));Ar(e,n,r),(!(F&2)||e!==ae)&&(e===ae&&(!(F&2)&&(cl|=n),le===4&&zt(e,pe)),Pe(e,r),n===1&&F===0&&!(t.mode&1)&&(Bn=ne()+500,ll&&Ht()))}function Pe(e,t){var n=e.callbackNode;dp(e,t);var r=Ms(e,e===ae?pe:0);if(r===0)n!==null&&da(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&da(n),t===1)e.tag===0?uh(rc.bind(null,e)):$u(rc.bind(null,e)),ih(function(){!(F&6)&&Ht()}),n=null;else{switch(mu(r)){case 1:n=ao;break;case 4:n=fu;break;case 16:n=zs;break;case 536870912:n=pu;break;default:n=zs}n=Ad(n,Td.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Td(e,t){if(ks=-1,Ss=0,F&6)throw Error(M(327));var n=e.callbackNode;if(Pn()&&e.callbackNode!==n)return null;var r=Ms(e,e===ae?pe:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=Qs(e,r);else{t=r;var l=F;F|=2;var i=Ld();(ae!==e||pe!==t)&&(dt=null,Bn=ne()+500,tn(e,t));do try{Th();break}catch(a){_d(e,a)}while(!0);ko(),Hs.current=i,F=l,re!==null?t=0:(ae=null,pe=0,t=le)}if(t!==0){if(t===2&&(l=fi(e),l!==0&&(r=l,t=$i(e,l))),t===1)throw n=Dr,tn(e,0),zt(e,r),Pe(e,ne()),n;if(t===6)zt(e,r);else{if(l=e.current.alternate,!(r&30)&&!Mh(l)&&(t=Qs(e,r),t===2&&(i=fi(e),i!==0&&(r=i,t=$i(e,i))),t===1))throw n=Dr,tn(e,0),zt(e,r),Pe(e,ne()),n;switch(e.finishedWork=l,e.finishedLanes=r,t){case 0:case 1:throw Error(M(345));case 2:Xt(e,Re,dt);break;case 3:if(zt(e,r),(r&130023424)===r&&(t=Oo+500-ne(),10<t)){if(Ms(e,0)!==0)break;if(l=e.suspendedLanes,(l&r)!==r){be(),e.pingedLanes|=e.suspendedLanes&l;break}e.timeoutHandle=wi(Xt.bind(null,e,Re,dt),t);break}Xt(e,Re,dt);break;case 4:if(zt(e,r),(r&4194240)===r)break;for(t=e.eventTimes,l=-1;0<r;){var o=31-nt(r);i=1<<o,o=t[o],o>l&&(l=o),r&=~i}if(r=l,r=ne()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*zh(r/1960))-r,10<r){e.timeoutHandle=wi(Xt.bind(null,e,Re,dt),r);break}Xt(e,Re,dt);break;case 5:Xt(e,Re,dt);break;default:throw Error(M(329))}}}return Pe(e,ne()),e.callbackNode===n?Td.bind(null,e):null}function $i(e,t){var n=gr;return e.current.memoizedState.isDehydrated&&(tn(e,t).flags|=256),e=Qs(e,t),e!==2&&(t=Re,Re=n,t!==null&&Wi(t)),e}function Wi(e){Re===null?Re=e:Re.push.apply(Re,e)}function Mh(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var l=n[r],i=l.getSnapshot;l=l.value;try{if(!st(i(),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&=~Do,t&=~cl,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-nt(t),r=1<<n;e[n]=-1,t&=~r}}function rc(e){if(F&6)throw Error(M(327));Pn();var t=Ms(e,0);if(!(t&1))return Pe(e,ne()),null;var n=Qs(e,t);if(e.tag!==0&&n===2){var r=fi(e);r!==0&&(t=r,n=$i(e,r))}if(n===1)throw n=Dr,tn(e,0),zt(e,t),Pe(e,ne()),n;if(n===6)throw Error(M(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Xt(e,Re,dt),Pe(e,ne()),null}function Ao(e,t){var n=F;F|=1;try{return e(t)}finally{F=n,F===0&&(Bn=ne()+500,ll&&Ht())}}function cn(e){Tt!==null&&Tt.tag===0&&!(F&6)&&Pn();var t=F;F|=1;var n=Ke.transition,r=W;try{if(Ke.transition=null,W=1,e)return e()}finally{W=r,Ke.transition=n,F=t,!(F&6)&&Ht()}}function Fo(){De=En.current,K(En)}function tn(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,lh(n)),re!==null)for(n=re.return;n!==null;){var r=n;switch(yo(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Ps();break;case 3:$n(),K(_e),K(we),zo();break;case 5:Eo(r);break;case 4:$n();break;case 13:K(X);break;case 19:K(X);break;case 10:So(r.type._context);break;case 22:case 23:Fo()}n=n.return}if(ae=e,re=e=Ft(e.current,null),pe=De=t,le=0,Dr=null,Do=cl=an=0,Re=gr=null,Jt!==null){for(t=0;t<Jt.length;t++)if(n=Jt[t],r=n.interleaved,r!==null){n.interleaved=null;var l=r.next,i=n.pending;if(i!==null){var o=i.next;i.next=l,r.next=o}n.pending=r}Jt=null}return e}function _d(e,t){do{var n=re;try{if(ko(),ys.current=Us,Bs){for(var r=q.memoizedState;r!==null;){var l=r.queue;l!==null&&(l.pending=null),r=r.next}Bs=!1}if(on=0,oe=se=q=null,mr=!1,Lr=0,Io.current=null,n===null||n.return===null){le=1,Dr=t,re=null;break}e:{var i=e,o=n.return,a=n,c=t;if(t=pe,a.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,h=a,m=h.tag;if(!(h.mode&1)&&(m===0||m===11||m===15)){var v=h.alternate;v?(h.updateQueue=v.updateQueue,h.memoizedState=v.memoizedState,h.lanes=v.lanes):(h.updateQueue=null,h.memoizedState=null)}var y=Ha(o);if(y!==null){y.flags&=-257,Va(y,o,a,i,t),y.mode&1&&Ua(i,u,t),t=y,c=u;var x=t.updateQueue;if(x===null){var g=new Set;g.add(c),t.updateQueue=g}else x.add(c);break e}else{if(!(t&1)){Ua(i,u,t),$o();break e}c=Error(M(426))}}else if(Y&&a.mode&1){var b=Ha(o);if(b!==null){!(b.flags&65536)&&(b.flags|=256),Va(b,o,a,i,t),wo(Wn(c,a));break e}}i=c=Wn(c,a),le!==4&&(le=2),gr===null?gr=[i]:gr.push(i),i=o;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var f=md(i,c,t);Oa(i,f);break e;case 1:a=c;var d=i.type,p=i.stateNode;if(!(i.flags&128)&&(typeof d.getDerivedStateFromError=="function"||p!==null&&typeof p.componentDidCatch=="function"&&(Ot===null||!Ot.has(p)))){i.flags|=65536,t&=-t,i.lanes|=t;var j=vd(i,a,t);Oa(i,j);break e}}i=i.return}while(i!==null)}Id(n)}catch(k){t=k,re===n&&n!==null&&(re=n=n.return);continue}break}while(!0)}function Ld(){var e=Hs.current;return Hs.current=Us,e===null?Us:e}function $o(){(le===0||le===3||le===2)&&(le=4),ae===null||!(an&268435455)&&!(cl&268435455)||zt(ae,pe)}function Qs(e,t){var n=F;F|=2;var r=Ld();(ae!==e||pe!==t)&&(dt=null,tn(e,t));do try{Rh();break}catch(l){_d(e,l)}while(!0);if(ko(),F=n,Hs.current=r,re!==null)throw Error(M(261));return ae=null,pe=0,le}function Rh(){for(;re!==null;)Pd(re)}function Th(){for(;re!==null&&!np();)Pd(re)}function Pd(e){var t=Od(e.alternate,e,De);e.memoizedProps=e.pendingProps,t===null?Id(e):re=t,Io.current=null}function Id(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=Nh(n,t),n!==null){n.flags&=32767,re=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{le=6,re=null;return}}else if(n=Sh(n,t,De),n!==null){re=n;return}if(t=t.sibling,t!==null){re=t;return}re=t=e}while(t!==null);le===0&&(le=5)}function Xt(e,t,n){var r=W,l=Ke.transition;try{Ke.transition=null,W=1,_h(e,t,n,r)}finally{Ke.transition=l,W=r}return null}function _h(e,t,n,r){do Pn();while(Tt!==null);if(F&6)throw Error(M(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(M(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(fp(e,i),e===ae&&(re=ae=null,pe=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||ls||(ls=!0,Ad(zs,function(){return Pn(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=Ke.transition,Ke.transition=null;var o=W;W=1;var a=F;F|=4,Io.current=null,Ch(e,n),Md(n,e),Zp(xi),Rs=!!gi,xi=gi=null,e.current=n,Eh(n),rp(),F=a,W=o,Ke.transition=i}else e.current=n;if(ls&&(ls=!1,Tt=e,Ks=l),i=e.pendingLanes,i===0&&(Ot=null),ip(n.stateNode),Pe(e,ne()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)l=t[n],r(l.value,{componentStack:l.stack,digest:l.digest});if(Vs)throw Vs=!1,e=Ai,Ai=null,e;return Ks&1&&e.tag!==0&&Pn(),i=e.pendingLanes,i&1?e===Fi?xr++:(xr=0,Fi=e):xr=0,Ht(),null}function Pn(){if(Tt!==null){var e=mu(Ks),t=Ke.transition,n=W;try{if(Ke.transition=null,W=16>e?16:e,Tt===null)var r=!1;else{if(e=Tt,Tt=null,Ks=0,F&6)throw Error(M(331));var l=F;for(F|=4,_=e.current;_!==null;){var i=_,o=i.child;if(_.flags&16){var a=i.deletions;if(a!==null){for(var c=0;c<a.length;c++){var u=a[c];for(_=u;_!==null;){var h=_;switch(h.tag){case 0:case 11:case 15:vr(8,h,i)}var m=h.child;if(m!==null)m.return=h,_=m;else for(;_!==null;){h=_;var v=h.sibling,y=h.return;if(Cd(h),h===u){_=null;break}if(v!==null){v.return=y,_=v;break}_=y}}}var x=i.alternate;if(x!==null){var g=x.child;if(g!==null){x.child=null;do{var b=g.sibling;g.sibling=null,g=b}while(g!==null)}}_=i}}if(i.subtreeFlags&2064&&o!==null)o.return=i,_=o;else e:for(;_!==null;){if(i=_,i.flags&2048)switch(i.tag){case 0:case 11:case 15:vr(9,i,i.return)}var f=i.sibling;if(f!==null){f.return=i.return,_=f;break e}_=i.return}}var d=e.current;for(_=d;_!==null;){o=_;var p=o.child;if(o.subtreeFlags&2064&&p!==null)p.return=o,_=p;else e:for(o=d;_!==null;){if(a=_,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:al(9,a)}}catch(k){te(a,a.return,k)}if(a===o){_=null;break e}var j=a.sibling;if(j!==null){j.return=a.return,_=j;break e}_=a.return}}if(F=l,Ht(),at&&typeof at.onPostCommitFiberRoot=="function")try{at.onPostCommitFiberRoot(el,e)}catch{}r=!0}return r}finally{W=n,Ke.transition=t}}return!1}function sc(e,t,n){t=Wn(n,t),t=md(e,t,1),e=Dt(e,t,1),t=be(),e!==null&&(Ar(e,1,t),Pe(e,t))}function te(e,t,n){if(e.tag===3)sc(e,e,n);else for(;t!==null;){if(t.tag===3){sc(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Ot===null||!Ot.has(r))){e=Wn(n,e),e=vd(t,e,1),t=Dt(t,e,1),e=be(),t!==null&&(Ar(t,1,e),Pe(t,e));break}}t=t.return}}function Lh(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=be(),e.pingedLanes|=e.suspendedLanes&n,ae===e&&(pe&n)===n&&(le===4||le===3&&(pe&130023424)===pe&&500>ne()-Oo?tn(e,0):Do|=n),Pe(e,t)}function Dd(e,t){t===0&&(e.mode&1?(t=Yr,Yr<<=1,!(Yr&130023424)&&(Yr=4194304)):t=1);var n=be();e=xt(e,t),e!==null&&(Ar(e,t,n),Pe(e,n))}function Ph(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Dd(e,n)}function Ih(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(M(314))}r!==null&&r.delete(t),Dd(e,n)}var Od;Od=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||_e.current)Te=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Te=!1,kh(e,t,n);Te=!!(e.flags&131072)}else Te=!1,Y&&t.flags&1048576&&Wu(t,Os,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;js(e,t),e=t.pendingProps;var l=On(t,we.current);Ln(t,n),l=Ro(null,t,r,e,l,n);var i=To();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,Le(r)?(i=!0,Is(t)):i=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,bo(t),l.updater=ol,t.stateNode=l,l._reactInternals=t,Ei(t,r,e,n),t=Ri(null,t,r,!0,i,n)):(t.tag=0,Y&&i&&xo(t),ke(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(js(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=Oh(r),e=Je(r,e),l){case 0:t=Mi(null,t,r,e,n);break e;case 1:t=Ga(null,t,r,e,n);break e;case 11:t=Ka(null,t,r,e,n);break e;case 14:t=Qa(null,t,r,Je(r.type,e),n);break e}throw Error(M(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Je(r,l),Mi(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Je(r,l),Ga(e,t,r,l,n);case 3:e:{if(wd(t),e===null)throw Error(M(387));r=t.pendingProps,i=t.memoizedState,l=i.element,Qu(e,t),$s(t,r,null,n);var o=t.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){l=Wn(Error(M(423)),t),t=Ya(e,t,r,n,l);break e}else if(r!==l){l=Wn(Error(M(424)),t),t=Ya(e,t,r,n,l);break e}else for(Oe=It(t.stateNode.containerInfo.firstChild),Ae=t,Y=!0,tt=null,n=Vu(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(An(),r===l){t=yt(e,t,n);break e}ke(e,t,r,n)}t=t.child}return t;case 5:return Gu(t),e===null&&Ni(t),r=t.type,l=t.pendingProps,i=e!==null?e.memoizedProps:null,o=l.children,yi(r,l)?o=null:i!==null&&yi(r,i)&&(t.flags|=32),yd(e,t),ke(e,t,o,n),t.child;case 6:return e===null&&Ni(t),null;case 13:return jd(e,t,n);case 4:return Co(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Fn(t,null,r,n):ke(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Je(r,l),Ka(e,t,r,l,n);case 7:return ke(e,t,t.pendingProps,n),t.child;case 8:return ke(e,t,t.pendingProps.children,n),t.child;case 12:return ke(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,i=t.memoizedProps,o=l.value,U(As,r._currentValue),r._currentValue=o,i!==null)if(st(i.value,o)){if(i.children===l.children&&!_e.current){t=yt(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var a=i.dependencies;if(a!==null){o=i.child;for(var c=a.firstContext;c!==null;){if(c.context===r){if(i.tag===1){c=mt(-1,n&-n),c.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var h=u.pending;h===null?c.next=c:(c.next=h.next,h.next=c),u.pending=c}}i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),bi(i.return,n,t),a.lanes|=n;break}c=c.next}}else if(i.tag===10)o=i.type===t.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(M(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),bi(o,n,t),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===t){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}ke(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,Ln(t,n),l=Ge(l),r=r(l),t.flags|=1,ke(e,t,r,n),t.child;case 14:return r=t.type,l=Je(r,t.pendingProps),l=Je(r.type,l),Qa(e,t,r,l,n);case 15:return gd(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Je(r,l),js(e,t),t.tag=1,Le(r)?(e=!0,Is(t)):e=!1,Ln(t,n),hd(t,r,l),Ei(t,r,l,n),Ri(null,t,r,!0,e,n);case 19:return kd(e,t,n);case 22:return xd(e,t,n)}throw Error(M(156,t.tag))};function Ad(e,t){return du(e,t)}function Dh(e,t,n,r){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=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ve(e,t,n,r){return new Dh(e,t,n,r)}function Wo(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Oh(e){if(typeof e=="function")return Wo(e)?1:0;if(e!=null){if(e=e.$$typeof,e===lo)return 11;if(e===io)return 14}return 2}function Ft(e,t){var n=e.alternate;return n===null?(n=Ve(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 Ns(e,t,n,r,l,i){var o=2;if(r=e,typeof e=="function")Wo(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case gn:return nn(n.children,l,i,t);case so:o=8,l|=8;break;case ql:return e=Ve(12,n,t,l|2),e.elementType=ql,e.lanes=i,e;case Zl:return e=Ve(13,n,t,l),e.elementType=Zl,e.lanes=i,e;case Jl:return e=Ve(19,n,t,l),e.elementType=Jl,e.lanes=i,e;case Gc:return ul(n,l,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Kc:o=10;break e;case Qc:o=9;break e;case lo:o=11;break e;case io:o=14;break e;case bt:o=16,r=null;break e}throw Error(M(130,e==null?e:typeof e,""))}return t=Ve(o,n,t,l),t.elementType=e,t.type=r,t.lanes=i,t}function nn(e,t,n,r){return e=Ve(7,e,r,t),e.lanes=n,e}function ul(e,t,n,r){return e=Ve(22,e,r,t),e.elementType=Gc,e.lanes=n,e.stateNode={isHidden:!1},e}function $l(e,t,n){return e=Ve(6,e,null,t),e.lanes=n,e}function Wl(e,t,n){return t=Ve(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Ah(e,t,n,r,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=jl(0),this.expirationTimes=jl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=jl(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function Bo(e,t,n,r,l,i,o,a,c){return e=new Ah(e,t,n,a,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Ve(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},bo(i),e}function Fh(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:vn,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function Fd(e){if(!e)return Wt;e=e._reactInternals;e:{if(fn(e)!==e||e.tag!==1)throw Error(M(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Le(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(M(171))}if(e.tag===1){var n=e.type;if(Le(n))return Fu(e,n,t)}return t}function $d(e,t,n,r,l,i,o,a,c){return e=Bo(n,r,!0,e,l,i,o,a,c),e.context=Fd(null),n=e.current,r=be(),l=At(n),i=mt(r,l),i.callback=t??null,Dt(n,i,l),e.current.lanes=l,Ar(e,l,r),Pe(e,r),e}function dl(e,t,n,r){var l=t.current,i=be(),o=At(l);return n=Fd(n),t.context===null?t.context=n:t.pendingContext=n,t=mt(i,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Dt(l,t,o),e!==null&&(rt(e,l,o,i),xs(e,l,o)),o}function Gs(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 lc(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Uo(e,t){lc(e,t),(e=e.alternate)&&lc(e,t)}function $h(){return null}var Wd=typeof reportError=="function"?reportError:function(e){console.error(e)};function Ho(e){this._internalRoot=e}fl.prototype.render=Ho.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(M(409));dl(e,t,null,null)};fl.prototype.unmount=Ho.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;cn(function(){dl(null,e,null,null)}),t[gt]=null}};function fl(e){this._internalRoot=e}fl.prototype.unstable_scheduleHydration=function(e){if(e){var t=xu();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Et.length&&t!==0&&t<Et[n].priority;n++);Et.splice(n,0,e),n===0&&wu(e)}};function Vo(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function pl(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function ic(){}function Wh(e,t,n,r,l){if(l){if(typeof r=="function"){var i=r;r=function(){var u=Gs(o);i.call(u)}}var o=$d(t,r,e,0,null,!1,!1,"",ic);return e._reactRootContainer=o,e[gt]=o.current,zr(e.nodeType===8?e.parentNode:e),cn(),o}for(;l=e.lastChild;)e.removeChild(l);if(typeof r=="function"){var a=r;r=function(){var u=Gs(c);a.call(u)}}var c=Bo(e,0,!1,null,null,!1,!1,"",ic);return e._reactRootContainer=c,e[gt]=c.current,zr(e.nodeType===8?e.parentNode:e),cn(function(){dl(t,c,n,r)}),c}function hl(e,t,n,r,l){var i=n._reactRootContainer;if(i){var o=i;if(typeof l=="function"){var a=l;l=function(){var c=Gs(o);a.call(c)}}dl(t,o,e,l)}else o=Wh(n,t,e,l,r);return Gs(o)}vu=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=or(t.pendingLanes);n!==0&&(co(t,n|1),Pe(t,ne()),!(F&6)&&(Bn=ne()+500,Ht()))}break;case 13:cn(function(){var r=xt(e,1);if(r!==null){var l=be();rt(r,e,1,l)}}),Uo(e,1)}};uo=function(e){if(e.tag===13){var t=xt(e,134217728);if(t!==null){var n=be();rt(t,e,134217728,n)}Uo(e,134217728)}};gu=function(e){if(e.tag===13){var t=At(e),n=xt(e,t);if(n!==null){var r=be();rt(n,e,t,r)}Uo(e,t)}};xu=function(){return W};yu=function(e,t){var n=W;try{return W=e,t()}finally{W=n}};ci=function(e,t,n){switch(t){case"input":if(ni(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 r=n[t];if(r!==e&&r.form===e.form){var l=sl(r);if(!l)throw Error(M(90));Xc(r),ni(r,l)}}}break;case"textarea":Zc(e,n);break;case"select":t=n.value,t!=null&&Mn(e,!!n.multiple,t,!1)}};lu=Ao;iu=cn;var Bh={usingClientEntryPoint:!1,Events:[$r,jn,sl,ru,su,Ao]},tr={findFiberByHostInstance:Zt,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Uh={bundleType:tr.bundleType,version:tr.version,rendererPackageName:tr.rendererPackageName,rendererConfig:tr.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:jt.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=cu(e),e===null?null:e.stateNode},findFiberByHostInstance:tr.findFiberByHostInstance||$h,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{el=is.inject(Uh),at=is}catch{}}$e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Bh;$e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Vo(t))throw Error(M(200));return Fh(e,t,null,n)};$e.createRoot=function(e,t){if(!Vo(e))throw Error(M(299));var n=!1,r="",l=Wd;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(l=t.onRecoverableError)),t=Bo(e,1,!1,null,null,n,!1,r,l),e[gt]=t.current,zr(e.nodeType===8?e.parentNode:e),new Ho(t)};$e.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(M(188)):(e=Object.keys(e).join(","),Error(M(268,e)));return e=cu(t),e=e===null?null:e.stateNode,e};$e.flushSync=function(e){return cn(e)};$e.hydrate=function(e,t,n){if(!pl(t))throw Error(M(200));return hl(null,e,t,!0,n)};$e.hydrateRoot=function(e,t,n){if(!Vo(e))throw Error(M(405));var r=n!=null&&n.hydratedSources||null,l=!1,i="",o=Wd;if(n!=null&&(n.unstable_strictMode===!0&&(l=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),t=$d(t,null,e,1,n??null,l,!1,i,o),e[gt]=t.current,zr(e),r)for(e=0;e<r.length;e++)n=r[e],l=n._getVersion,l=l(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,l]:t.mutableSourceEagerHydrationData.push(n,l);return new fl(t)};$e.render=function(e,t,n){if(!pl(t))throw Error(M(200));return hl(null,e,t,!1,n)};$e.unmountComponentAtNode=function(e){if(!pl(e))throw Error(M(40));return e._reactRootContainer?(cn(function(){hl(null,null,e,!1,function(){e._reactRootContainer=null,e[gt]=null})}),!0):!1};$e.unstable_batchedUpdates=Ao;$e.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!pl(n))throw Error(M(200));if(e==null||e._reactInternals===void 0)throw Error(M(38));return hl(e,t,n,!1,r)};$e.version="18.3.1-next-f1338f8080-20240426";function Bd(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Bd)}catch(e){console.error(e)}}Bd(),Bc.exports=$e;var Hh=Bc.exports,oc=Hh;Yl.createRoot=oc.createRoot,Yl.hydrateRoot=oc.hydrateRoot;class Ko extends Error{constructor(t,n,r){super(r),this.status=t,this.code=n}}function Qe(e){return e instanceof Ko&&e.status===409&&e.code==="no_project"}async function Qo(e,t){const n=await fetch(e,t);if(!n.ok){let r=null,l=`${n.status} ${n.statusText}`;try{const i=await n.json();i.code&&(r=i.code),i.error&&(l=i.error)}catch{}throw new Ko(n.status,r,l)}return n.json()}const ie=e=>Qo(e),os=(e,t)=>Qo(e,t===void 0?{method:"POST"}:{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),ac=(e,t)=>Qo(e,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});function ee(e,t){return t?e+(e.includes("?")?"&":"?")+"project="+encodeURIComponent(t):e}function Vh(e){const t=e.metadata?.agent;return typeof t=="string"&&t.trim()?t:null}const D={status:e=>ie(ee("/api/status",e)),refresh:e=>os(ee("/api/refresh",e)),graphFull:(e,t=250)=>ie(ee(`/api/graph/full?limit=${t}`,e)),graphNode:(e,t,n={})=>ie(ee(`/api/graph/node?id=${encodeURIComponent(e)}${n.includeCode?"&includeCode=1":""}`,t)),splitSearch:(e,t)=>ie(ee(`/api/graph/split-search?q=${encodeURIComponent(e)}`,t)),graphHealth:e=>ie(ee("/api/graph/health",e)),specs:e=>ie(ee("/api/specs",e)),spec:(e,t)=>ie(ee(`/api/spec/${encodeURIComponent(e)}`,t)),specSave:(e,t,n)=>ac(ee(`/api/spec/${encodeURIComponent(e)}`,n),{content:t}),specFunnel:e=>ie(ee("/api/spec/funnel",e)),specCoverage:(e,t)=>ie(ee("/api/spec/coverage"+(e?`?spec=${encodeURIComponent(e)}`:""),t)),specPlan:e=>ie(ee("/api/spec/plan",e)),linkVerify:(e,t)=>os(ee("/api/spec/link-verify",t),e),drift:(e,t={})=>{const n=new URLSearchParams;t.states?.length&&n.set("state",t.states.join(",")),t.limit&&n.set("limit",String(t.limit));const r=n.toString();return ie(ee("/api/drift"+(r?"?"+r:""),e))},runs:e=>ie(ee("/api/workflows/runs",e)),workflows:e=>ie(ee("/api/workflows",e)),launchRun:(e,t,n)=>os(ee("/api/workflows/runs",n),{workflowName:e,inputs:t}),run:(e,t)=>ie(ee(`/api/workflows/runs/${encodeURIComponent(e)}`,t)),runArtifacts:(e,t)=>ie(ee(`/api/workflows/runs/${encodeURIComponent(e)}/artifacts`,t)),runAction:(e,t,n,r)=>os(ee(`/api/workflows/runs/${encodeURIComponent(e)}/${t}`,r),n),projects:()=>ie("/api/projects"),graphSearch:(e,t,n=10)=>ie(ee(`/api/graph/search?q=${encodeURIComponent(e)}&limit=${n}`,t)),config:{get:()=>ie("/api/config"),set:e=>ac("/api/config",e)}};function Kh(e,t,n){const r=`/api/workflows/runs/${encodeURIComponent(e)}/events${t?`?since=${t}`:""}`;return ee(r,n)}const Bi="ss-navigate",Qh={sessions:{to:"dashboard",keepParam:!1},heatmap:{to:"dashboard",keepParam:!1},costs:{to:"dashboard",keepParam:!1},compare:{to:"dashboard",keepParam:!1},memory:{to:"dashboard",keepParam:!1},mcp:{to:"dashboard",keepParam:!1},tips:{to:"dashboard",keepParam:!1},specs:{to:"review",keepParam:!0},drift:{to:"review",keepParam:!0}};function Ud(e,t){const n=Qh[e];return n?{route:n.to,param:n.keepParam?t:void 0}:{route:e,param:t}}function Gh(e,t,n=""){return"/"+e+(t?"/"+t:"")+n}function cc(){const e=location.pathname.split("/").filter(Boolean),t=e[0]||"dashboard",n=e.slice(1).join("/")||void 0,{route:r,param:l}=Ud(t,n);return r!==t&&history.replaceState(history.state,"",Gh(r,l,location.search)),{route:r,param:l,query:Object.fromEntries(new URLSearchParams(location.search))}}function Q(e,t={}){const{route:n,param:r}=Ud(e,t.param);let l="/"+n;r&&(l+="/"+r),t.query&&Object.keys(t.query).length&&(l+="?"+new URLSearchParams(t.query).toString()),l!==location.pathname+location.search&&history.pushState(null,"",l),window.dispatchEvent(new Event(Bi))}function Yh(){const[e,t]=C.useState(cc);return C.useEffect(()=>{const n=()=>t(cc());return window.addEventListener("popstate",n),window.addEventListener(Bi,n),()=>{window.removeEventListener("popstate",n),window.removeEventListener(Bi,n)}},[]),e}const Xh={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"/>',matrix:'<rect x="3" y="3" width="18" height="18" rx="2"/><path d="M9 3v18M15 3v18M3 9h18M3 15h18"/>'};function R({name:e,size:t=16,stroke:n=2,fill:r="none",style:l,className:i}){return s.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:r,stroke:"currentColor",strokeWidth:n,strokeLinecap:"round",strokeLinejoin:"round",style:l,className:i,dangerouslySetInnerHTML:{__html:Xh[e]||""}})}function qh({size:e=24,tile:t=!0,glow:n=!0}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 32 32",fill:"none",style:{filter:n?"var(--glow-logo)":"none",flexShrink:0},children:[s.jsxs("defs",{children:[s.jsxs("linearGradient",{id:"ssTile",x1:0,y1:0,x2:32,y2:32,gradientUnits:"userSpaceOnUse",children:[s.jsx("stop",{stopColor:"var(--bg-panel)"}),s.jsx("stop",{offset:1,stopColor:"var(--bg-canvas-2)"})]}),s.jsxs("linearGradient",{id:"ssLead",x1:18,y1:11,x2:26,y2:21,gradientUnits:"userSpaceOnUse",children:[s.jsx("stop",{stopColor:"color-mix(in srgb, var(--node-spec) 85%, var(--on-strong))"}),s.jsx("stop",{offset:1,stopColor:"var(--node-spec)"})]})]}),t&&s.jsx("rect",{width:32,height:32,rx:7.2,fill:"url(#ssTile)"}),t&&s.jsx("rect",{x:.5,y:.5,width:31,height:31,rx:6.7,fill:"none",stroke:"var(--fill-strong)"}),s.jsxs("g",{transform:"translate(4.6 4.6) scale(0.715)",children:[s.jsx("path",{d:"M5 16 H11 M11 9 L23 16 L11 23",stroke:"var(--edge-arrow)",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),s.jsx("line",{x1:11,y1:9,x2:11,y2:23,stroke:"var(--edge-arrow)",strokeWidth:1.9,strokeLinecap:"round"}),s.jsx("circle",{cx:23,cy:16,r:3.6,fill:"url(#ssLead)"}),s.jsx("circle",{cx:11,cy:9,r:2.9,fill:"var(--node-code)"}),s.jsx("circle",{cx:11,cy:23,r:2.9,fill:"var(--node-test)"}),s.jsx("circle",{cx:5,cy:16,r:2.1,fill:"var(--node-route)"})]})]})}const Zh=8,Jh=6,em=150,tm={page:"Page",node:"Node",spec:"Spec"},nm={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 rm({open:e,onClose:t,pages:n,project:r=null}){const[l,i]=C.useState(""),[o,a]=C.useState(0),[c,u]=C.useState([]),[h,m]=C.useState([]),v=C.useRef(null),y=C.useRef(0);C.useEffect(()=>{e&&(i(""),a(0),m([]),setTimeout(()=>v.current?.focus(),30))},[e]),C.useEffect(()=>{e&&D.specs(r).then(d=>u(d.specs??[]),()=>u([]))},[e,r]),C.useEffect(()=>{if(!e)return;const d=l.trim(),p=++y.current;if(d.length<2){m([]);return}const j=setTimeout(()=>{D.graphSearch(d,r,Zh).then(k=>{y.current===p&&m((k.results??[]).map(({node:N})=>({key:"node:"+N.id,label:N.name,sublabel:N.filePath,icon:"graph",type:"node",nav:()=>Q("graph",{query:{focus:N.id}})})))},()=>{y.current===p&&m([])})},em);return()=>clearTimeout(j)},[l,e,r]);const x=l.trim().toLowerCase(),g=(x?n.filter(d=>(d.label+" "+d.id).toLowerCase().includes(x)):n).map(d=>({key:"page:"+d.id,label:d.label,sublabel:"/"+d.id,icon:d.icon,type:"page",nav:()=>Q(d.id)})),b=x?c.filter(d=>(d.id+" "+d.title).toLowerCase().includes(x)).slice(0,Jh).map(d=>({key:"spec:"+d.id,label:d.id,sublabel:d.title,icon:"book",type:"spec",nav:()=>Q("review",{param:d.id})})):[],f=[...g,...x?h:[],...b];return C.useEffect(()=>{if(!e)return;const d=p=>{if(p.key==="ArrowDown")p.preventDefault(),a(j=>Math.min(f.length-1,j+1));else if(p.key==="ArrowUp")p.preventDefault(),a(j=>Math.max(0,j-1));else if(p.key==="Enter"){p.preventDefault();const j=f[o];j&&(j.nav(),t())}else p.key==="Escape"&&(p.preventDefault(),t())};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[e,f,o,t]),e?s.jsx("div",{onMouseDown:t,style:{position:"fixed",inset:0,background:"var(--overlay)",backdropFilter:"blur(2px)",zIndex:100,display:"grid",placeItems:"start center",paddingTop:"12vh",animation:"fadeIn 100ms"},children:s.jsxs("div",{onMouseDown:d=>d.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:[s.jsxs("div",{className:"row gap-10",style:{padding:"12px 14px",borderBottom:"1px solid var(--border-subtle)"},children:[s.jsx(R,{name:"search",size:16,style:{color:"var(--text-muted)"}}),s.jsx("input",{ref:v,value:l,onChange:d=>{i(d.target.value),a(0)},placeholder:"Search pages, nodes, specs…",style:{flex:1,background:"transparent",border:"none",outline:"none",color:"var(--text-primary)",fontSize:15,fontFamily:"var(--font-ui)"}}),s.jsx("kbd",{style:nm,children:"esc"})]}),s.jsxs("div",{className:"scroll-y",role:"listbox",style:{maxHeight:380,padding:6},children:[f.length===0&&s.jsx("div",{className:"muted",style:{padding:24,textAlign:"center"},children:"No matches"}),f.map((d,p)=>s.jsxs("div",{role:"option","aria-selected":p===o,onMouseEnter:()=>a(p),onClick:()=>{d.nav(),t()},className:"row gap-10 list-row",style:{padding:"8px 10px",borderRadius:7,cursor:"pointer"},children:[s.jsx(R,{name:d.icon,size:15,style:{color:p===o?"var(--accent)":"var(--text-muted)",flexShrink:0}}),s.jsxs("div",{className:"grow",style:{minWidth:0},children:[s.jsx("div",{style:{fontSize:13,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label}),s.jsx("div",{className:"mono muted",style:{fontSize:10.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.sublabel})]}),s.jsx("span",{className:"pill",style:{fontSize:9.5,color:"var(--text-muted)",background:"var(--fill-soft)",flexShrink:0},children:tm[d.type]})]},d.key))]})]})}):null}const Bl=new Map,sm=3e4;function H(e,t=[],n={}){const{cacheKey:r,ttlMs:l=sm}=n,i=r?Bl.get(r):void 0,[o,a]=C.useState(i?i.data:null),[c,u]=C.useState(null),[h,m]=C.useState(!i),v=C.useRef(0),y=C.useCallback(x=>{const g=++v.current;if(r){const b=Bl.get(r);if(b){if(a(b.data),u(null),m(!1),!x&&Date.now()-b.ts<l)return}else m(!0)}else m(!0);e().then(b=>{r&&Bl.set(r,{data:b,ts:Date.now()}),v.current===g&&(a(b),u(null),m(!1))},b=>{v.current===g&&(u(b),m(!1))})},t);return C.useEffect(()=>{y(!1)},[y]),{data:o,error:c,loading:h,reload:()=>y(!0)}}function uc(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 lm=1e3,im={g:"graph",s:"review",d:"review"};function om({onTogglePalette:e,pageIds:t}){const n=C.useRef(!1),r=C.useRef(null);C.useEffect(()=>{const l=()=>{n.current=!1,r.current!==null&&(clearTimeout(r.current),r.current=null)},i=o=>{if((o.metaKey||o.ctrlKey)&&o.key.toLowerCase()==="k"){o.preventDefault(),e();return}if((o.metaKey||o.ctrlKey)&&!o.altKey&&/^[1-7]$/.test(o.key)){if(uc(o.target))return;const a=t[parseInt(o.key,10)-1];a&&(o.preventDefault(),Q(a));return}if(o.metaKey||o.ctrlKey||o.altKey){l();return}if(uc(o.target)){l();return}if(n.current){l();const a=im[o.key.toLowerCase()];a&&(o.preventDefault(),Q(a));return}o.key==="g"&&(n.current=!0,r.current=window.setTimeout(l,lm))};return window.addEventListener("keydown",i),()=>{window.removeEventListener("keydown",i),l()}},[e,t])}function Hd({data:e,color:t,w:n=80,h:r=24,fill:l}){if(!e||!e.length)return null;const i=Math.max(...e),o=Math.min(...e),a=i-o||1,u=e.map((m,v)=>[v/(e.length-1)*n,r-(m-o)/a*(r-4)-2]).map((m,v)=>(v?"L":"M")+m[0].toFixed(1)+" "+m[1].toFixed(1)).join(" "),h=u+` L${n} ${r} L0 ${r} Z`;return s.jsxs("svg",{width:n,height:r,style:{display:"block",overflow:"visible"},children:[l&&s.jsx("path",{d:h,fill:t,opacity:.12}),s.jsx("path",{d:u,fill:"none",stroke:t||"var(--accent)",strokeWidth:1.6,strokeLinejoin:"round",strokeLinecap:"round"})]})}function am({series:e,w:t=640,h:n=200,color:r="var(--accent)",xTicks:l=6,onHover:i}){const[o,a]=C.useState(null),c={l:44,r:12,t:14,b:24},u=t-c.l-c.r,h=n-c.t-c.b,m=e.map(j=>j.count),v=Math.max(...m)*1.12||1,y=0,x=j=>c.l+j/(e.length-1)*u,g=j=>c.t+h-(j-y)/(v-y)*h,b=e.map((j,k)=>(k?"L":"M")+x(k).toFixed(1)+" "+g(j.count).toFixed(1)).join(" "),f=b+` L${x(e.length-1)} ${c.t+h} L${c.l} ${c.t+h} Z`,d=4,p=o!=null?e[o]:void 0;return s.jsxs("svg",{width:"100%",viewBox:`0 0 ${t} ${n}`,style:{display:"block"},onMouseLeave:()=>{a(null),i?.(null)},onMouseMove:j=>{const k=j.currentTarget.getBoundingClientRect(),N=(j.clientX-k.left)/k.width*t;let E=Math.round((N-c.l)/u*(e.length-1));E=Math.max(0,Math.min(e.length-1,E)),a(E),i?.(e[E]??null)},children:[Array.from({length:d+1}).map((j,k)=>{const N=v/d*k,E=g(N);return s.jsxs("g",{children:[s.jsx("line",{x1:c.l,x2:t-c.r,y1:E,y2:E,stroke:"var(--fill-soft)"}),s.jsx("text",{x:c.l-8,y:E+3,textAnchor:"end",fontSize:10,fill:"var(--text-muted)",fontFamily:"var(--font-mono)",children:N.toFixed(0)})]},k)}),s.jsx("path",{d:f,fill:r,opacity:.1}),s.jsx("path",{d:b,fill:"none",stroke:r,strokeWidth:2,strokeLinejoin:"round"}),e.filter((j,k)=>k%Math.ceil(e.length/l)===0).map(j=>{const k=e.indexOf(j);return s.jsx("text",{x:x(k),y:n-6,textAnchor:"middle",fontSize:10,fill:"var(--text-muted)",fontFamily:"var(--font-mono)",children:j.day+"d"},k)}),o!=null&&p&&s.jsxs("g",{children:[s.jsx("line",{x1:x(o),x2:x(o),y1:c.t,y2:c.t+h,stroke:r,opacity:.4,strokeDasharray:"3 3"}),s.jsx("circle",{cx:x(o),cy:g(p.count),r:4,fill:r,stroke:"var(--bg-canvas)",strokeWidth:2})]})]})}function cm({data:e,size:t=140,thickness:n=22,centerLabel:r,centerSub:l}){const i=e.reduce((m,v)=>m+v.count,0)||1,o=(t-n)/2,a=t/2,c=t/2,u=2*Math.PI*o;let h=0;return s.jsxs("div",{style:{position:"relative",width:t,height:t},children:[s.jsxs("svg",{width:t,height:t,style:{transform:"rotate(-90deg)"},children:[s.jsx("circle",{cx:a,cy:c,r:o,fill:"none",stroke:"var(--fill-soft)",strokeWidth:n}),e.map((m,v)=>{const x=m.count/i*u,g=s.jsx("circle",{cx:a,cy:c,r:o,fill:"none",stroke:m.color,strokeWidth:n,strokeDasharray:`${x} ${u-x}`,strokeDashoffset:-h,strokeLinecap:"butt"},v);return h+=x,g})]}),r&&s.jsx("div",{style:{position:"absolute",inset:0,display:"grid",placeItems:"center",textAlign:"center"},children:s.jsxs("div",{children:[s.jsx("div",{style:{fontSize:18,fontWeight:700,fontVariantNumeric:"tabular-nums"},children:r}),l&&s.jsx("div",{className:"muted",style:{fontSize:10},children:l})]})})]})}function um({rows:e,segments:t,fmt:n}){const r=Math.max(...e.map(l=>t.reduce((i,o)=>i+(l.values[o.key]||0),0)))||1;return s.jsx("div",{className:"col gap-10",children:e.map(l=>{const i=t.reduce((o,a)=>o+(l.values[a.key]||0),0);return s.jsxs("div",{className:"row gap-10",children:[s.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}),s.jsx("div",{className:"row",style:{flex:1,height:18,background:"var(--bg-hover)",borderRadius:4,overflow:"hidden"},children:t.map(o=>{const a=l.values[o.key]||0;return a?s.jsx("div",{title:`${o.label}: ${n?n(a):a}`,style:{width:a/r*100+"%",height:"100%",background:o.color}},o.key):null})}),s.jsx("div",{className:"tabular",style:{width:64,fontSize:12,textAlign:"right",flexShrink:0,fontFamily:"var(--font-mono)"},children:n?n(i):i})]},l.label)})})}function dm({items:e,max:t,color:n,fmt:r,labelKey:l="name",valueKey:i="calls",onItemClick:o,selectedKey:a}){const c=t||Math.max(...e.map(u=>Number(u[i])||0))||1;return s.jsx("div",{className:"col gap-6",children:e.map(u=>{const h=String(u[l]),m=Number(u[i])||0,v=a!=null&&h===a;return s.jsxs("div",{className:"row gap-10",onClick:o?()=>o(u):void 0,style:{cursor:o?"pointer":"default",borderRadius:5,padding:o?"2px 4px":0,margin:o?"0 -4px":0,background:v?"var(--accent-soft)":"transparent"},onMouseEnter:o?y=>{v||(y.currentTarget.style.background="var(--bg-hover)")}:void 0,onMouseLeave:o?y=>{v||(y.currentTarget.style.background="transparent")}:void 0,children:[s.jsx("div",{style:{width:116,fontSize:12,fontFamily:"var(--font-mono)",color:v?"var(--accent)":"var(--text-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flexShrink:0},children:h}),s.jsx("div",{className:"grow",style:{height:16,background:"var(--bg-hover)",borderRadius:4,overflow:"hidden"},children:s.jsx("div",{style:{width:m/c*100+"%",height:"100%",background:typeof n=="function"?n(u):n||"var(--accent)",borderRadius:4}})}),s.jsx("div",{className:"tabular",style:{width:52,textAlign:"right",fontSize:12,fontFamily:"var(--font-mono)",flexShrink:0},children:r?r(m):m}),o&&s.jsx(R,{name:"chevronRight",size:12,style:{color:v?"var(--accent)":"var(--text-faint)",flexShrink:0}})]},h)})})}function fm(e,t,n,r,l){const i=e.reduce((y,x)=>y+x.value,0)||1,o=e.map(y=>({d:y,area:y.value/i*(r*l)})),a=[];let c={x:t,y:n,w:r,h:l},u=[];const h=y=>y.reduce((x,g)=>x+g.area,0),m=(y,x)=>{if(!y.length)return 1/0;const g=h(y),b=Math.max(...y.map(d=>d.area)),f=Math.min(...y.map(d=>d.area));return Math.max(x*x*b/(g*g),g*g/(x*x*f))},v=()=>{const y=Math.min(c.w,c.h),g=h(u)/(y||1);let b=0;const f=c.w>=c.h;u.forEach(d=>{const p=d.area/(g||1);f?a.push({...d.d,x:c.x,y:c.y+b,w:g,h:p}):a.push({...d.d,x:c.x+b,y:c.y,w:p,h:g}),b+=p}),f?c={x:c.x+g,y:c.y,w:c.w-g,h:c.h}:c={x:c.x,y:c.y+g,w:c.w,h:c.h-g},u=[]};return o.forEach(y=>{const x=Math.min(c.w,c.h);u.length&&m([...u,y],x)>m(u,x)&&v(),u.push(y)}),u.length&&v(),a}function pm({items:e,height:t=120,onPick:n,selKey:r}){const l=C.useRef(null),[i,o]=C.useState(0);C.useEffect(()=>{if(!l.current||typeof ResizeObserver>"u")return;const h=new ResizeObserver(m=>o(m[0].contentRect.width));return h.observe(l.current),()=>h.disconnect()},[]);const a=i||600,c=[...e].sort((h,m)=>m.value-h.value),u=fm(c,0,0,a,t);return s.jsx("div",{ref:l,style:{position:"relative",width:"100%",height:t,borderRadius:7,overflow:"hidden",background:"var(--bg-canvas)"},children:u.map(h=>{const m=Math.max(0,Math.min(1,h.intensity||0)),y=`color-mix(in srgb, ${m>.66?"var(--error)":m>.33?"var(--warn)":"var(--node-route)"} ${Math.round(20+m*58)}%, var(--bg-elevated))`,x=r===h.key,g=h.w>52&&h.h>26,b=h.w>36&&h.h>15,f={position:"absolute",left:h.x+1.5,top:h.y+1.5,width:Math.max(0,h.w-3),height:Math.max(0,h.h-3),background:y,borderRadius:4,cursor:n?"pointer":"default",overflow:"hidden",padding:g?"5px 7px":"0 5px",display:"flex",flexDirection:"column",justifyContent:g?"flex-start":"center",border:x?"1.5px solid var(--accent)":"1px solid var(--cell-border)"};return s.jsxs("div",{onClick:n?()=>n(h):void 0,title:h.title||h.label,style:f,children:[b&&s.jsx("span",{className:"mono",style:{fontSize:g?10:9,fontWeight:500,color:m>.45?"var(--on-strong)":"var(--text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",lineHeight:1.25},children:h.label}),g&&h.sub&&s.jsx("span",{className:"mono tabular",style:{fontSize:9,color:m>.45?"var(--on-strong-muted)":"var(--text-muted)",marginTop:1},children:h.sub})]},h.key)})})}const Ne={pending:{label:"Pending",color:"var(--warning)",bg:"var(--warning-soft)"},running:{label:"Running",color:"var(--info)",bg:"var(--info-soft)"},paused:{label:"Paused",color:"var(--warning)",bg:"var(--warning-soft)"},completed:{label:"Completed",color:"var(--accent)",bg:"var(--accent-soft)"},failed:{label:"Failed",color:"var(--danger)",bg:"var(--danger-soft)"},cancelled:{label:"Cancelled",color:"var(--text-muted)",bg:"var(--fill-soft)"},rejected:{label:"Rejected",color:"var(--warning)",bg:"var(--warning-soft)"},skipped:{label:"Skipped",color:"var(--text-muted)",bg:"var(--fill-soft)"},drafted:{label:"Drafted",color:"var(--text-secondary)",bg:"var(--fill-soft)"},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(--accent)",bg:"var(--accent-soft)"},drifted:{label:"Drifted",color:"var(--danger)",bg:"var(--danger-soft)"},broken:{label:"Broken",color:"var(--danger)",bg:"var(--danger-soft)"},orphaned:{label:"Orphaned",color:"var(--danger)",bg:"var(--danger-soft)"},success:{label:"Success",color:"var(--success)",bg:"var(--success-soft)"},warn:{label:"Warn",color:"var(--warning)",bg:"var(--warning-soft)"},error:{label:"Error",color:"var(--danger)",bg:"var(--danger-soft)"},info:{label:"Info",color:"var(--info)",bg:"var(--info-soft)"}},hm={drifted:"drift",broken:"cancel",orphaned:"drift",failed:"cancel",verified:"check",completed:"check",paused:"pause",running:"circle"};function ye({state:e,pulse:t,withDot:n}){const r=Ne[e]??Ne.info,l=hm[e];return s.jsxs("span",{className:"pill",style:{color:r.color,background:r.bg,animation:t?"pulsePill 600ms ease-out":void 0},children:[n&&s.jsx("span",{className:"pill-dot"}),l&&!n&&s.jsx(R,{name:l,size:11}),r.label]})}function fe({children:e,color:t,bg:n,dot:r}){return s.jsxs("span",{className:"pill",style:t||n?{color:t,background:n}:void 0,children:[r&&s.jsx("span",{className:"pill-dot"}),e]})}function mm({title:e}){return s.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 Ie({variant:e="outline",size:t="md",loading:n,disabled:r,className:l,children:i,type:o,...a}){const c="btn btn-"+e+(t==="md"?"":" btn-"+t)+(l?" "+l:"");return s.jsx("button",{...a,type:o??"button",className:c,disabled:r||n,"aria-busy":n||void 0,children:i})}function Go({text:e,label:t,ariaLabel:n}){const[r,l]=C.useState(!1);return s.jsxs(Ie,{variant:"ghost",size:"xs",title:"Copy","aria-label":n??(t?void 0:"Copy "+e),onClick:i=>{i.stopPropagation(),navigator.clipboard?.writeText(e),l(!0),setTimeout(()=>l(!1),1100)},style:{color:r?"var(--success)":void 0},children:[s.jsx(R,{name:r?"check":"copy",size:12}),t||""]})}function Ui({label:e,count:t,active:n,onClick:r,color:l,bg:i,dot:o,size:a,className:c,disabled:u}){const h={};return l&&(h["--chip-color"]=l),i&&(h["--chip-bg"]=i),s.jsxs("button",{type:"button",onClick:r,disabled:u,"aria-pressed":n,className:"chip"+(a==="sm"?" sm":"")+(n?" on":"")+(c?" "+c:""),style:Object.keys(h).length?h:void 0,children:[(o??!!l)&&s.jsx("span",{className:"chip-dot"}),e,t!=null&&s.jsx("span",{className:"chip-count",children:t})]})}function vm({checked:e,onChange:t,label:n,disabled:r,busy:l,className:i}){return s.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":n,"aria-busy":l||void 0,disabled:r||l,className:"switch"+(i?" "+i:""),onClick:t,children:s.jsx("span",{className:"switch-thumb"})})}function gm({value:e,suffix:t,invert:n}){if(e==null)return null;if(e===0)return s.jsxs("span",{className:"row gap-2 tabular muted",style:{fontSize:"var(--fs-xs)",fontWeight:600},children:[s.jsx(R,{name:"minus",size:12}),"no change"]});const r=e>=0,l=n?!r:r;return s.jsxs("span",{className:"row gap-2 tabular",style:{color:l?"var(--success)":"var(--error)",fontSize:"var(--fs-xs)",fontWeight:600},children:[s.jsx(R,{name:r?"trendUp":"trendDown",size:12}),(r?"+":"")+(Math.abs(e)<1&&e!==0?Math.round(e*100)+"%":e)+(t||"")]})}function Vt({icon:e,title:t,sub:n,actions:r}){return s.jsxs("div",{className:"row",style:{gap:12,marginBottom:18,alignItems:"flex-start"},children:[e&&s.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:s.jsx(R,{name:e,size:18})}),s.jsxs("div",{className:"grow",style:{minWidth:0},children:[s.jsx("div",{"data-page-title":"",style:{fontSize:"var(--fs-title)",fontWeight:600,letterSpacing:"-0.01em"},children:t}),n&&s.jsx("div",{className:"secondary",style:{marginTop:2},children:n})]}),r&&s.jsx("div",{className:"row gap-8",children:r})]})}function G({icon:e,title:t,body:n,action:r}){return s.jsx("div",{className:"empty",children:s.jsxs("div",{className:"empty-inner",children:[s.jsx("div",{className:"empty-icon",children:s.jsx(R,{name:e||"box",size:24})}),s.jsx("div",{className:"empty-title",children:t}),n&&s.jsx("div",{className:"empty-body",children:n}),r&&s.jsx("div",{className:"empty-action",children:r})]})})}function Qn({title:e,detail:t,action:n,icon:r}){return s.jsx("div",{className:"empty error-state",role:"alert",children:s.jsxs("div",{className:"empty-inner",children:[s.jsx("div",{className:"empty-icon",children:s.jsx(R,{name:r||"cancel",size:24})}),s.jsx("div",{className:"empty-title",children:e}),t&&s.jsx("div",{className:"error-state-detail",children:t}),n&&s.jsx("div",{className:"empty-action",children:n})]})})}function wt({options:e,value:t,onChange:n,size:r,label:l,disabled:i}){const o=e.map(u=>typeof u=="string"?u:u.value),a=o.indexOf(t),c=(u,h)=>{const m=u.key==="ArrowRight"||u.key==="ArrowDown"?1:u.key==="ArrowLeft"||u.key==="ArrowUp"?-1:0;if(!m)return;u.preventDefault();const v=(h+m+o.length)%o.length;n(o[v]),u.currentTarget.parentElement?.children[v]?.focus()};return s.jsx("div",{className:"seg",role:"radiogroup","aria-label":l,children:e.map((u,h)=>{const m=typeof u=="string"?u:u.value,v=typeof u=="string"?u:u.label,y=m===t;return s.jsx("button",{role:"radio","aria-checked":y,tabIndex:y||a===-1&&h===0?0:-1,disabled:i,className:"seg-btn"+(r==="sm"?" sm":"")+(y?" active":""),onClick:()=>n(m),onKeyDown:x=>c(x,h),children:v},m)})})}function Un(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 ut(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 yr({state:e,label:t,minHeight:n,children:r}){if(e.data==null&&e.loading)return s.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 s.jsx("div",{className:"card card-pad",style:{minHeight:n,display:"grid",placeItems:"center"},children:s.jsxs("div",{style:{textAlign:"center",maxWidth:300},children:[s.jsxs("div",{className:"row gap-8",style:{justifyContent:"center",color:"var(--error)"},children:[s.jsx(R,{name:"cancel",size:14}),s.jsxs("span",{style:{fontSize:12.5,fontWeight:600},children:["Couldn't load ",t]})]}),s.jsx("div",{className:"muted",style:{fontSize:11.5,marginTop:4,overflowWrap:"anywhere"},children:l}),s.jsx(Ie,{variant:"outline",size:"xs",style:{marginTop:10},onClick:e.reload,children:"Retry"})]})})}return e.data==null?null:s.jsx(s.Fragment,{children:r(e.data)})}function Vd({icon:e,label:t,value:n,delta:r,deltaInvert:l,spark:i,sparkColor:o,color:a,note:c,onClick:u,className:h,disabled:m}){return s.jsxs("button",{type:"button",onClick:u,disabled:m,className:"card card-btn stat-tile"+(h?" "+h:""),children:[s.jsxs("div",{className:"row gap-8 muted",children:[s.jsx(R,{name:e,size:13,style:{color:a||"var(--text-muted)"}}),s.jsx("span",{className:"eyebrow stat-tile-label",children:t})]}),s.jsxs("div",{className:"row",style:{justifyContent:"space-between",alignItems:"flex-end",gap:"var(--space-sm)"},children:[s.jsx("div",{className:"tabular display-num",children:n}),i&&i.length>1&&s.jsx(Hd,{data:i,color:o||a||"var(--accent)",fill:!0,w:64,h:22})]}),c?s.jsx("div",{className:"stat-tile-note",children:c}):r!==void 0&&s.jsx(gm,{value:r,invert:l})]})}const In=["drifted","pending","completed"],Br=["drifted","broken","orphaned"];function Kd(e,t){return e==="orphaned"?"update the spec's implementations: block, then run specship sync":`specship workflow run spec-fix --input SPEC_ID=${t}`}const xm=e=>Br.includes(e);function as(e){return e?Br.reduce((t,n)=>t+(e.states[n]??0),0):0}function ym(e,t){return t.specId===e||t.specId.startsWith(e+".")}function wm(e,t){const n=e.targetQualifiedName||e.targetFilePath||"(unknown target)",r=e.driftAxis==="spec"?"spec":e.kind==="tests"?"test":"code";return{state:e.state,target:n,changed:r,fix:Kd(e.state,t)}}function Qd(e,t){const n=t.filter(a=>xm(a.state)&&ym(e.specId,a)),r=as(e.implementsLinks)+as(e.testsLinks)+e.criteria.reduce((a,c)=>a+as(c.implementsLinks)+as(c.testsLinks),0);if(n.length||r>0){const a=n.map(c=>wm(c,e.specId));if(!a.length){const c=Br.find(u=>(e.implementsLinks.states[u]??0)+(e.testsLinks.states[u]??0)>0)??"drifted";a.push({state:c,target:`${r} link${r===1?"":"s"}`,changed:"code",fix:Kd(c,e.specId)})}return{group:"drifted",driftReasons:a}}const l=e.criteria;if(e.criteriaCount===0||l.length===0)return{group:"pending",tag:"no acceptance criteria",driftReasons:[]};const i=l.filter(a=>a.verdict==="verified").length;return i===l.length?{group:"completed",driftReasons:[]}:e.implementsLinks.count+l.reduce((a,c)=>a+c.implementsLinks.count,0)>0?i>0?{group:"pending",tag:"partly verified",driftReasons:[]}:{group:"pending",tag:"implemented, unverified",driftReasons:[]}:{group:"pending",tag:"unimplemented",driftReasons:[]}}function Gd(e,t){const n={drifted:[],pending:[],completed:[]};for(const r of e){const l=Qd(r,t);n[l.group].push({specId:r.specId,title:r.title,...l})}return n}const jm=5,km=500,Sm="Write your first spec as a Markdown file under specs/, then run specship sync.",Nm={drifted:"Drifted",pending:"Pending",completed:"Completed"},bm={drifted:"drift",pending:"circle",completed:"check"},Cm={drifted:"var(--danger)",pending:"var(--warning)",completed:"var(--accent)"},dc="var(--control-border-w) solid var(--border-subtle)",Em={overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},Hi=e=>{if(e==null||e==="")return null;const t=typeof e=="number"?e:new Date(String(e)).getTime();return Number.isFinite(t)?t:null};function zm(e){const t=e??"_",n=H(()=>D.status(e),[e],{cacheKey:`status:${t}`}),r=H(()=>D.specCoverage(null,e),[e],{cacheKey:`coverage:${t}`}),l=H(()=>D.drift(e,{states:Br,limit:km}),[e],{cacheKey:`drift:${t}`}),i=H(()=>D.runs(e),[e],{cacheKey:`runs:${t}`}),o={data:r.data&&l.data?{coverage:r.data,drift:l.data}:null,error:r.error??l.error,loading:r.loading||l.loading,reload:()=>{r.reload(),l.reload()}};return{status:n,review:o,runs:i}}function Mm({project:e}){const{status:t,review:n,runs:r}=zm(e);if(Qe(t.error)||Qe(n.error)||Qe(r.error))return s.jsx(G,{icon:"folder",title:"No project selected",body:"Pick an indexed project from the switcher in the status strip."});const l=t.data,i=l?l.projectPath.split("/").filter(Boolean).pop()??l.projectPath:"",o=n.data?.coverage.requirements.length,a=s.jsx(Vt,{icon:"dashboard",title:"Overview",sub:l?`${i}${o!=null?` · ${o} requirements`:""}`:"Loading project status…"});return o===0?s.jsxs("div",{className:"col",style:{flex:1,minHeight:0,padding:"var(--space-lg)"},children:[a,s.jsx(Lm,{})]}):s.jsxs("div",{"data-testid":"overview",style:{flex:1,minHeight:0,overflow:"hidden",padding:"var(--space-lg)",display:"grid",gridTemplateRows:"auto auto minmax(0, 1fr)",gap:"var(--space-md)"},children:[a,s.jsx(yr,{state:n,label:"requirement counts",minHeight:96,children:c=>s.jsx(Rm,{coverage:c.coverage,drift:c.drift})}),s.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 2fr",gap:"var(--space-md)",minHeight:0},children:[s.jsx(yr,{state:t,label:"index freshness",minHeight:160,children:c=>s.jsx(Tm,{status:c})}),s.jsx(yr,{state:r,label:"recent runs",minHeight:160,children:c=>s.jsx(_m,{runs:c.runs})})]})]})}function Rm({coverage:e,drift:t}){const n=C.useMemo(()=>Gd(e.requirements,t.links),[e,t]);return s.jsx("div",{style:{display:"grid",gridTemplateColumns:`repeat(${In.length}, 1fr)`,gap:"var(--space-md)"},children:In.map(r=>s.jsx("div",{"data-overview-count":r,style:{display:"grid"},children:s.jsx(Vd,{icon:bm[r],color:Cm[r],label:Nm[r],value:n[r].length.toLocaleString(),note:"Open in Review",onClick:()=>Q("review",{query:{group:r}})})},r))})}function Tm({status:e}){const t=Hi(e.lastIndexed),n=t!=null?Un(t):null,r=n==null?"Never indexed — run specship index":n==="now"?"Indexed just now":`Indexed ${n} ago`;return s.jsxs("div",{className:"card card-pad col gap-8","data-testid":"index-freshness",style:{height:"100%"},children:[s.jsxs("div",{className:"row gap-8",children:[s.jsx(R,{name:"refresh",size:14,style:{color:"var(--accent)"}}),s.jsx("span",{className:"eyebrow",children:"Index freshness"})]}),s.jsx("div",{"data-testid":"freshness-text",title:t!=null?new Date(t).toLocaleString():void 0,style:{fontSize:"var(--fs-lg)",fontWeight:600},children:r}),s.jsxs("div",{className:"muted tabular",style:{fontSize:"var(--fs-sm)"},children:[e.fileCount.toLocaleString()," files · ",e.nodeCount.toLocaleString()," symbols · ",e.edgeCount.toLocaleString()," edges"]})]})}function _m({runs:e}){const t=C.useMemo(()=>[...e].map((n,r)=>({r:n,i:r,at:Hi(n.startedAt)})).sort((n,r)=>(r.at??-1/0)-(n.at??-1/0)||n.i-r.i).slice(0,jm).map(n=>n.r),[e]);return s.jsxs("div",{className:"card col","data-testid":"recent-runs",style:{height:"100%",overflow:"hidden"},children:[s.jsxs("div",{className:"row gap-8",style:{padding:"var(--space-sm) var(--space-md)",borderBottom:dc},children:[s.jsx(R,{name:"play",size:14,style:{color:"var(--accent)"}}),s.jsx("span",{className:"eyebrow grow",children:"Recent runs"}),s.jsxs("button",{type:"button",className:"btn btn-ghost btn-xs",onClick:()=>Q("runs"),children:["All runs",s.jsx(R,{name:"arrowRight",size:11})]})]}),t.length===0?s.jsx("div",{className:"muted",style:{padding:"var(--space-md)",fontSize:"var(--fs-sm)"},children:"No workflow runs yet — start one with specship workflow run."}):s.jsx("div",{className:"col",children:t.map(n=>{const r=Vh(n);return s.jsxs("div",{role:"button",tabIndex:0,"data-run-row":n.id,className:"row gap-8 list-row",onClick:()=>Q("runs",{param:n.id}),onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),Q("runs",{param:n.id}))},style:{padding:"var(--space-sm) var(--space-md)",borderBottom:dc,cursor:"pointer",minWidth:0},children:[s.jsx("span",{"data-testid":"run-status",style:{flexShrink:0},children:s.jsx(ye,{state:n.status})}),s.jsx("span",{className:"mono grow",style:{...Em,fontSize:"var(--fs-sm)"},children:String(n.workflowName??n.workflowId??"—")}),s.jsx("span",{className:"mono muted","data-testid":"run-agent",title:"Agent",style:{flexShrink:0,fontSize:"var(--fs-xs)"},children:r??"—"}),s.jsx("span",{className:"mono muted tabular",style:{flexShrink:0,fontSize:"var(--fs-xs)"},children:Un(Hi(n.startedAt)??void 0)??"—"})]},n.id)})})]})}function Lm(){return s.jsx("div",{"data-testid":"overview-empty",style:{flex:1,display:"grid",placeItems:"center"},children:s.jsx(G,{icon:"book",title:"No specs yet",body:Sm})})}function Ur(e,t){return e==="route"?"route":/\.(test|spec)\.|__tests__\//.test(t)?"test":"code"}function Pm(e){return e.map((t,n)=>{const r=46*Math.sqrt(n+.6),l=n*2.399963229728653;return{id:t.id,label:t.name,kind:Ur(t.kind,t.filePath),x:Math.round(r*Math.cos(l)*2.2),y:Math.round(r*Math.sin(l)),file:t.filePath}})}const fc=120,Im=600;function Dm(e,t){const n=Pm(e),r=n.length;if(r<2)return n;const l=new Map;n.forEach((u,h)=>l.set(u.id,h));const i=n.map(u=>u.x),o=n.map(u=>u.y),a=110,c=r<=Im;for(let u=0;u<fc;u++){const m=3+26*(1-u/fc),v=new Array(r).fill(0),y=new Array(r).fill(0);if(c)for(let x=0;x<r;x++)for(let g=x+1;g<r;g++){let b=i[x]-i[g],f=o[x]-o[g];if(b===0&&f===0){const j=(x*7+g)%12*(Math.PI/6);b=Math.cos(j),f=Math.sin(j)}const d=b*b+f*f,p=a*a/d;v[x]+=b*p,y[x]+=f*p,v[g]-=b*p,y[g]-=f*p}for(const x of t){const g=l.get(x.from),b=l.get(x.to);if(g===void 0||b===void 0||g===b)continue;const f=i[g]-i[b],d=o[g]-o[b],p=(Math.hypot(f,d)||1)/a;v[g]-=f*p,y[g]-=d*p,v[b]+=f*p,y[b]+=d*p}for(let x=0;x<r;x++){const g=Math.hypot(v[x],y[x]);if(!g)continue;const b=Math.min(g,m);i[x]+=v[x]/g*b,o[x]+=y[x]/g*b}}return n.map((u,h)=>({...u,x:Math.round(i[h]*1.35),y:Math.round(o[h])}))}function Om(e,t){const n=new Set(e.map(g=>g.id)),r=new Map,l=new Map;e.forEach(g=>{r.set(g.id,0),l.set(g.id,[])}),t.forEach(g=>{g.from===g.to||!n.has(g.from)||!n.has(g.to)||(l.get(g.from).push(g.to),r.set(g.to,(r.get(g.to)??0)+1))});const i=new Map,o=[];let a=0;const c=()=>{for(;a<o.length;){const g=o[a++],b=i.get(g);for(const f of l.get(g)??[])i.has(f)||(i.set(f,b+1),o.push(f))}};e.forEach(g=>{r.get(g.id)===0&&(i.set(g.id,0),o.push(g.id))}),c();for(const g of e)i.has(g.id)||(i.set(g.id,0),o.push(g.id),c());const u=new Map;e.forEach(g=>{const b=i.get(g.id);u.has(b)||u.set(b,[]),u.get(b).push(g.id)});const h=250,m=58,v=20,y=new Map;let x=0;for(const[,g]of[...u.entries()].sort((b,f)=>b[0]-f[0])){const b=Math.ceil(g.length/v),f=Math.ceil(g.length/b);g.forEach((d,p)=>{const j=Math.floor(p/f),k=p%f;y.set(d,{x:x+j*h,y:Math.round((k-(f-1)/2)*m)})}),x+=b*h+40}return e.map(g=>({id:g.id,label:g.name,kind:Ur(g.kind,g.filePath),x:y.get(g.id).x,y:y.get(g.id).y,file:g.filePath}))}function Am(e,t,n){return n==="synth"?"synth":e.kind==="spec"||t.kind==="spec"?"implements":e.kind==="test"||t.kind==="test"?"tests":"calls"}const pc={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 Yd({nodes:e,edges:t,selectedId:n,onSelect:r,hiddenIds:l,hiddenEdgeKinds:i,height:o="100%",interactive:a=!0,fitKey:c,focusId:u,dotGrid:h=!0}){const[m,v]=C.useState(e),[y,x]=C.useState({tx:0,ty:0,k:1}),[g,b]=C.useState(null),[f,d]=C.useState({w:0,h:0}),p=C.useRef(null),j=C.useRef(null),k=C.useRef(!1);C.useEffect(()=>{const w=p.current;if(!w||typeof ResizeObserver>"u")return;const S=new ResizeObserver(z=>d({w:z[0].contentRect.width,h:z[0].contentRect.height}));return S.observe(w),()=>S.disconnect()},[]),C.useEffect(()=>{v(e),k.current=!1},[e]);const N=C.useCallback(()=>{const w=p.current;if(!w||!m.length)return;const S=w.clientWidth,z=w.clientHeight,L=m.map(Qt=>Qt.x),I=m.map(Qt=>Qt.y),$=Math.min(...L)-60,B=Math.max(...L)+140,ue=Math.min(...I)-40,me=Math.max(...I)+80,Me=B-$,Kt=me-ue,qe=Math.min(S/Me,z/Kt,1.4)*.92;x({k:qe,tx:(S-Me*qe)/2-$*qe,ty:(z-Kt*qe)/2-ue*qe})},[m]);C.useEffect(()=>{!k.current&&p.current&&(N(),k.current=!0)},[m,N]),C.useEffect(()=>{c!==void 0&&N()},[c]);const E=C.useRef(null);C.useEffect(()=>{if(!u){E.current=null;return}if(E.current===u)return;const w=m.find(B=>B.id===u),S=p.current;if(!w||!S)return;E.current=u;const{cx:z,cy:L}=Xe(w),I=S.clientWidth,$=S.clientHeight;x(B=>{const ue=Math.min(1.4,Math.max(.6,B.k));return{k:ue,tx:I/2-z*ue,ty:$/2-L*ue}})},[u,m]);const T=w=>{if(!a)return;w.preventDefault();const S=p.current.getBoundingClientRect(),z=w.clientX-S.left,L=w.clientY-S.top,I=-w.deltaY*.0016;x($=>{const B=Math.min(2.4,Math.max(.25,$.k*(1+I))),ue=B/$.k;return{k:B,tx:z-(z-$.tx)*ue,ty:L-(L-$.ty)*ue}})},A=w=>{a&&(w.target.closest("[data-node]")||(j.current={type:"pan",sx:w.clientX,sy:w.clientY,ox:y.tx,oy:y.ty},w.currentTarget.style.cursor="grabbing"))},P=(w,S)=>{a&&(w.stopPropagation(),j.current={type:"node",id:S.id,sx:w.clientX,sy:w.clientY,ox:S.x,oy:S.y,moved:!1})},J=w=>{const S=j.current;if(S)if(S.type==="pan")x(z=>({...z,tx:S.ox+(w.clientX-S.sx),ty:S.oy+(w.clientY-S.sy)}));else{const z=(w.clientX-S.sx)/y.k,L=(w.clientY-S.sy)/y.k;Math.abs(w.clientX-S.sx)+Math.abs(w.clientY-S.sy)>3&&(S.moved=!0),v(I=>I.map($=>$.id===S.id?{...$,x:S.ox+z,y:S.oy+L}:$))}},ce=()=>{const w=j.current;w&&w.type==="node"&&!w.moved&&r?.(w.id),p.current&&(p.current.style.cursor="grab"),j.current=null},je={};m.forEach(w=>je[w.id]=w);const Be={};t.forEach(w=>{Be[w.from]=(Be[w.from]||0)+1,Be[w.to]=(Be[w.to]||0)+1});function kt(w){return w.kind==="route"?{w:18,h:18,shape:"dot"}:{w:Math.max(64,w.label.length*(w.kind==="spec"?7.6:7.2)+26),h:30,shape:w.kind==="spec"?"rect":"pill"}}function Xe(w){const S=kt(w);return{cx:w.x+S.w/2,cy:w.y+S.h/2,b:S}}const ze=new Set;return n&&t.forEach(w=>{w.from===n&&ze.add(w.to),w.to===n&&ze.add(w.from)}),s.jsxs("div",{ref:p,onWheel:T,onMouseDown:A,onMouseMove:J,onMouseUp:ce,onMouseLeave:ce,style:{position:"relative",width:"100%",height:o,overflow:"hidden",cursor:"grab",background:h?"var(--bg-canvas-2)":"transparent",backgroundImage:h?"radial-gradient(circle, var(--dot-grid) 1px, transparent 1px)":"none",backgroundSize:`${22*y.k}px ${22*y.k}px`,backgroundPosition:`${y.tx}px ${y.ty}px`,userSelect:"none"},children:[s.jsxs("svg",{width:"100%",height:"100%",style:{position:"absolute",inset:0,pointerEvents:"none"},children:[s.jsxs("defs",{children:[s.jsx("marker",{id:"arrow",viewBox:"0 0 10 10",refX:8,refY:5,markerWidth:6,markerHeight:6,orient:"auto-start-reverse",children:s.jsx("path",{d:"M0 0 L10 5 L0 10 z",fill:"var(--edge-arrow)"})}),s.jsx("marker",{id:"arrowHi",viewBox:"0 0 10 10",refX:8,refY:5,markerWidth:7,markerHeight:7,orient:"auto-start-reverse",children:s.jsx("path",{d:"M0 0 L10 5 L0 10 z",fill:"var(--accent)"})})]}),s.jsx("g",{transform:`translate(${y.tx} ${y.ty}) scale(${y.k})`,children:t.map((w,S)=>{const z=je[w.from],L=je[w.to];if(!z||!L)return null;const I=Am(z,L,w.kind);if(i?.has(I))return null;const $=Xe(z),B=Xe(L),ue=l&&(l.has(w.from)||l.has(w.to)),me=n&&(w.from===n||w.to===n),Me=I==="implements"?"var(--node-spec)":I==="tests"?"var(--node-test)":null,Kt=Me?`color-mix(in srgb, ${Me} 62%, transparent)`:"var(--edge-line)",qe=($.cx+B.cx)/2,Qt=`M ${$.cx} ${$.cy} C ${qe} ${$.cy}, ${qe} ${B.cy}, ${B.cx} ${B.cy}`;return s.jsx("path",{d:Qt,fill:"none",stroke:me?"var(--accent)":Kt,strokeWidth:me?2:Me?1.5:1.2,opacity:ue?.12:me?.95:.72,strokeDasharray:w.kind==="synth"?"5 4":"none",markerEnd:me?"url(#arrowHi)":"url(#arrow)"},S)})})]}),s.jsx("div",{style:{position:"absolute",inset:0,transform:`translate(${y.tx}px, ${y.ty}px) scale(${y.k})`,transformOrigin:"0 0",pointerEvents:"none"},children:m.map(w=>{const S=kt(w),z=ut(w.kind,w.state),L=l&&l.has(w.id),I=w.id===n,$=ze.has(w.id),B=g===w.id,ue=L?.2:n&&!I&&!$?.55:1,me=Be[w.id]||0,Me=1+Math.min(.24,me*.045),Kt={"data-node":w.id,onMouseDown:Qt=>P(Qt,w),onMouseEnter:()=>b(w.id),onMouseLeave:()=>b(null),style:{position:"absolute",left:w.x,top:w.y,pointerEvents:"auto",cursor:"pointer",opacity:ue,transition:"opacity 120ms"}};if(S.shape==="dot")return s.jsxs("div",{...Kt,children:[s.jsx("div",{style:{width:18,height:18,borderRadius:"50%",background:z,transform:`scale(${Me})`,boxShadow:I?`0 0 0 4px color-mix(in srgb, ${z} 27%, transparent), 0 0 14px ${z}`:B?`0 0 0 3px color-mix(in srgb, ${z} 20%, transparent)`:`0 0 8px color-mix(in srgb, ${z} 40%, transparent)`,border:"2px solid var(--bg-canvas-2)"}}),(B||I)&&s.jsx("div",{style:pc,children:w.label})]},w.id);const qe=w.kind==="spec"&&(w.state==="drifted"||w.state==="broken"||w.state==="orphaned");return s.jsxs("div",{...Kt,children:[s.jsxs("div",{style:{minWidth:S.w,height:S.h,padding:"0 12px",display:"flex",alignItems:"center",gap:7,borderRadius:S.shape==="rect"?7:999,transform:`scale(${Me})`,transformOrigin:"center",background:`color-mix(in srgb, ${z} 16%, var(--bg-panel))`,border:`1.5px solid ${I||qe?z:`color-mix(in srgb, ${z} 45%, transparent)`}`,color:"var(--node-text)",fontSize:12.5,fontWeight:500,whiteSpace:"nowrap",fontFamily:"var(--font-mono)",boxShadow:I?`0 0 0 4px color-mix(in srgb, ${z} 20%, transparent), 0 4px 16px color-mix(in srgb, ${z} 27%, transparent)`:B?`0 0 0 3px color-mix(in srgb, ${z} 13%, transparent)`:"var(--shadow-node)"},children:[s.jsx("span",{style:{width:7,height:7,borderRadius:S.shape==="rect"?2:"50%",background:z,flexShrink:0,boxShadow:`0 0 6px ${z}`}}),w.label,qe&&s.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:w.state==="drifted"?"var(--warn)":"var(--error)",marginLeft:2}})]}),B&&s.jsx("div",{style:{...pc,top:-22},children:w.file||w.sub})]},w.id)})}),a&&s.jsxs("div",{style:{position:"absolute",right:14,bottom:14,display:"flex",flexDirection:"column",gap:6},children:[s.jsx(Ul,{icon:"plus",onClick:()=>x(w=>({...w,k:Math.min(2.4,w.k*1.2)}))}),s.jsx(Ul,{icon:"minus",onClick:()=>x(w=>({...w,k:Math.max(.25,w.k/1.2)}))}),s.jsx(Ul,{icon:"maximize",onClick:N,title:"Fit"})]}),a&&s.jsxs("div",{style:{position:"absolute",left:14,bottom:14,display:"flex",flexDirection:"column",gap:6},children:[s.jsx(Fm,{nodes:m,view:y,size:f}),s.jsx("div",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-muted)",background:"var(--inset)",padding:"2px 7px",borderRadius:5,alignSelf:"flex-start"},children:Math.round(y.k*100)+"%"})]})]})}function Fm({nodes:e,view:t,size:n}){if(!e.length)return null;const r=138,l=88,i=6,o=e.map(E=>E.x),a=e.map(E=>E.y),c=Math.min(...o)-30,u=Math.max(...o)+120,h=Math.min(...a)-20,m=Math.max(...a)+50,v=u-c||1,y=m-h||1,x=Math.min((r-i*2)/v,(l-i*2)/y),g=i+(r-i*2-v*x)/2,b=i+(l-i*2-y*x)/2,f=E=>g+(E-c)*x,d=E=>b+(E-h)*x,p=-t.tx/t.k,j=-t.ty/t.k,k=n.w/t.k,N=n.h/t.k;return s.jsxs("svg",{width:r,height:l,style:{background:"color-mix(in srgb, var(--bg-canvas-2) 92%, transparent)",border:"1px solid var(--border-subtle)",borderRadius:7,boxShadow:"var(--shadow-minimap)",backdropFilter:"blur(4px)"},children:[e.map(E=>s.jsx("circle",{cx:f(E.x),cy:d(E.y),r:E.kind==="route"?1.6:2.1,fill:ut(E.kind,E.state),opacity:.9},E.id)),n.w>0&&s.jsx("rect",{x:Math.max(0,f(p)),y:Math.max(0,d(j)),width:Math.min(r,k*x),height:Math.min(l,N*x),fill:"var(--accent)",fillOpacity:.12,stroke:"var(--accent)",strokeWidth:1,rx:2})]})}function Ul({icon:e,onClick:t,title:n}){return s.jsx("button",{onClick:t,title:n,className:"btn btn-secondary",style:{width:30,height:30,padding:0,justifyContent:"center",borderRadius:7},children:s.jsx(R,{name:e,size:15})})}const $m=[{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:"border/subtle",varName:"--border-subtle"},{name:"fill/soft",varName:"--fill-soft"},{name:"accent/primary",varName:"--accent"}],Wm=[{name:"node/code",varName:"--node-code"},{name:"node/spec",varName:"--node-spec"},{name:"node/test",varName:"--node-test"},{name:"node/route",varName:"--node-route"}],Bm=[{state:"accent",varName:"--accent",softVar:"--accent-soft"},{state:"warning",varName:"--warning",softVar:"--warning-soft"},{state:"danger",varName:"--danger",softVar:"--danger-soft"},{state:"info",varName:"--info",softVar:"--info-soft"}],Um=[{name:"space/xs",varName:"--space-xs"},{name:"space/sm",varName:"--space-sm"},{name:"space/md",varName:"--space-md"},{name:"space/lg",varName:"--space-lg"},{name:"space/xl",varName:"--space-xl"},{name:"space/2xl",varName:"--space-2xl"},{name:"space/gutter",varName:"--space-gutter"}],Hm=[{name:"radius/sm",varName:"--r-sm"},{name:"radius/md",varName:"--r-md"},{name:"radius/lg",varName:"--r-lg"},{name:"radius/xl",varName:"--r-xl"},{name:"radius/pill",varName:"--r-pill"}],Vm=[{label:"Big number",varName:"--fs-big",sample:"1,184"},{label:"Page title",varName:"--fs-title",sample:"Page title"},{label:"Body & labels",varName:"--fs-base",sample:"Body & labels — Space Grotesk"},{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}],nr=["default","hover","pressed","disabled","loading"],Km=[{label:"Primary",variant:"primary",states:nr},{label:"Ghost",variant:"ghost",states:nr},{label:"Outline",variant:"outline",states:nr},{label:"Secondary",variant:"secondary",states:nr},{label:"Destructive",variant:"destructive",states:nr}],rr={card:["default","hover","pressed","disabled"],"stat-tile":["default","hover","pressed","disabled","loading"],chip:["default","on","hover","pressed","disabled"],segmented:["default","hover","pressed","disabled"],switch:["default","on","hover","pressed","disabled","loading"]},Qm={hover:"is-hover",pressed:"is-active"},Gm=[{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 Se({title:e,children:t,span:n}){return s.jsxs("div",{className:"card card-pad",style:n?{gridColumn:"1 / -1"}:void 0,children:[s.jsx("div",{className:"eyebrow",style:{marginBottom:12},children:e}),t]})}function hc({tok:e}){return s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,minWidth:96},children:[s.jsx("div",{style:{height:40,borderRadius:8,background:`var(${e.varName})`,border:"1px solid var(--border-subtle)"}}),s.jsx("div",{style:{fontSize:11,fontWeight:500},children:e.name}),s.jsx("div",{className:"mono muted",style:{fontSize:10},children:e.varName})]})}function Nt({kit:e,state:t,children:n}){return s.jsxs("div",{"data-kit":e,"data-kit-state":t,style:{display:"flex",flexDirection:"column",gap:"var(--space-xs)",alignItems:"flex-start"},children:[n,s.jsx("div",{className:"mono muted",style:{fontSize:"var(--fs-xs)"},children:t})]})}const cs=()=>{},Gt=e=>Qm[e];function Ym(){return s.jsxs(s.Fragment,{children:[s.jsx(Se,{title:"Buttons · every state",span:!0,children:s.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-md)"},children:Km.map(e=>s.jsx("div",{className:"row gap-10",style:{flexWrap:"wrap",alignItems:"flex-start"},children:e.states.map(t=>s.jsx(Nt,{kit:"button",state:t,children:s.jsx(Ie,{variant:e.variant,size:"sm",className:Gt(t),disabled:t==="disabled",loading:t==="loading","aria-label":`${e.label} ${t}`,children:e.label})},t))},e.variant))})}),s.jsx(Se,{title:"Cards · every state",children:s.jsx("div",{className:"row gap-10",style:{flexWrap:"wrap",alignItems:"flex-start"},children:rr.card.map(e=>s.jsx(Nt,{kit:"card",state:e,children:e==="default"?s.jsx("div",{className:"card card-pad",children:"Card"}):s.jsx("button",{type:"button",className:"card card-btn card-pad"+(Gt(e)?" "+Gt(e):""),disabled:e==="disabled",children:"Clickable card"})},e))})}),s.jsx(Se,{title:"Stat tiles · every state",children:s.jsx("div",{className:"row gap-10",style:{flexWrap:"wrap",alignItems:"flex-start"},children:rr["stat-tile"].map(e=>s.jsx(Nt,{kit:"stat-tile",state:e,children:e==="loading"?s.jsx("div",{className:"skel","aria-busy":"true","aria-label":"Loading stat",style:{width:"var(--empty-icon)",height:"var(--empty-icon)"}}):s.jsx(Vd,{icon:"check",label:"Verified",value:"42",note:"links",className:Gt(e),disabled:e==="disabled",onClick:cs})},e))})}),s.jsx(Se,{title:"Chips · every state",children:s.jsx("div",{className:"row gap-10",style:{flexWrap:"wrap",alignItems:"flex-start"},children:rr.chip.map(e=>s.jsx(Nt,{kit:"chip",state:e,children:s.jsx(Ui,{label:"Spec",count:12,color:"var(--node-spec)",active:e==="on",className:Gt(e),disabled:e==="disabled",onClick:cs})},e))})}),s.jsx(Se,{title:"Segmented · every state",children:s.jsx("div",{className:"row gap-10",style:{flexWrap:"wrap",alignItems:"flex-start"},children:rr.segmented.map(e=>s.jsx(Nt,{kit:"segmented",state:e,children:e==="hover"||e==="pressed"?s.jsxs("div",{className:"seg",role:"radiogroup","aria-label":`Segmented ${e}`,children:[s.jsx("button",{type:"button",role:"radio","aria-checked":!0,className:"seg-btn active",tabIndex:-1,children:"Day"}),s.jsx("button",{type:"button",role:"radio","aria-checked":!1,className:"seg-btn "+Gt(e),tabIndex:-1,children:"Week"})]}):s.jsx(wt,{options:["Day","Week"],value:"Day",onChange:cs,disabled:e==="disabled",label:`Segmented ${e}`})},e))})}),s.jsx(Se,{title:"Switches · every state",children:s.jsx("div",{className:"row gap-10",style:{flexWrap:"wrap",alignItems:"flex-start"},children:rr.switch.map(e=>s.jsx(Nt,{kit:"switch",state:e,children:s.jsx(vm,{checked:e==="on",onChange:cs,label:`Switch ${e}`,className:Gt(e),disabled:e==="disabled",busy:e==="loading"})},e))})}),s.jsx(Se,{title:"Empty & error states",span:!0,children:s.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(240px, 1fr))",gap:"var(--space-md)"},children:[s.jsx(Nt,{kit:"empty",state:"default",children:s.jsx(G,{icon:"book",title:"No specs yet",body:"Author one with the spec-author skill.",action:s.jsx(Ie,{variant:"outline",size:"sm",children:"Learn how"})})}),s.jsx(Nt,{kit:"error",state:"default",children:s.jsx(Qn,{title:"Couldn't load specs",detail:"fetch failed: 503",action:s.jsx(Ie,{variant:"outline",size:"sm",children:"Retry"})})})]})})]})}function Xm(){return s.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(280px, 1fr))",gap:12},children:[s.jsx(Se,{title:"Surfaces & text",children:s.jsx("div",{className:"row gap-10",style:{flexWrap:"wrap"},children:$m.map(e=>s.jsx(hc,{tok:e},e.varName))})}),s.jsx(Se,{title:"Node colors · distinct at 4px",children:s.jsx("div",{className:"row gap-10",style:{flexWrap:"wrap"},children:Wm.map(e=>s.jsx(hc,{tok:e},e.varName))})}),s.jsx(Se,{title:"Semantic states",children:s.jsx("div",{className:"row gap-10",style:{flexWrap:"wrap"},children:Bm.map(e=>s.jsxs("div",{style:{minWidth:96},children:[s.jsxs("div",{style:{display:"flex",gap:4},children:[s.jsx("div",{style:{flex:1,height:40,borderRadius:"8px 0 0 8px",background:`var(${e.varName})`}}),s.jsx("div",{style:{flex:1,height:40,borderRadius:"0 8px 8px 0",background:`var(${e.softVar})`}})]}),s.jsx("div",{style:{fontSize:11,fontWeight:500,marginTop:4},children:e.state}),s.jsx("div",{className:"mono muted",style:{fontSize:10},children:e.varName})]},e.varName))})}),s.jsx(Se,{title:"Spacing",children:s.jsx("div",{className:"col",style:{gap:6},children:Um.map(e=>s.jsxs("div",{className:"row",style:{gap:10,alignItems:"center"},children:[s.jsx("div",{style:{width:`var(${e.varName})`,height:12,background:"var(--accent)",borderRadius:2,flexShrink:0}}),s.jsx("div",{style:{fontSize:11,fontWeight:500},children:e.name}),s.jsx("div",{className:"mono muted",style:{fontSize:10},children:e.varName})]},e.varName))})}),s.jsx(Se,{title:"Radius",children:s.jsx("div",{className:"row gap-10",style:{flexWrap:"wrap"},children:Hm.map(e=>s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,minWidth:72},children:[s.jsx("div",{style:{height:40,borderRadius:`var(${e.varName})`,background:"var(--fill)",border:"1px solid var(--border-strong)"}}),s.jsx("div",{style:{fontSize:11,fontWeight:500},children:e.name}),s.jsx("div",{className:"mono muted",style:{fontSize:10},children:e.varName})]},e.varName))})}),s.jsx(Se,{title:"Typography",children:s.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:Vm.map(e=>s.jsxs("div",{children:[s.jsx("span",{className:e.mono?"mono":void 0,style:{fontSize:`var(${e.varName})`,fontWeight:500},children:e.sample}),s.jsx("span",{className:"muted",style:{fontSize:10.5,marginLeft:8},children:e.label})]},e.label+e.sample))})}),s.jsx(Ym,{}),Gm.map(e=>s.jsx(Se,{title:e.label,children:s.jsx("div",{className:"row gap-8",style:{flexWrap:"wrap"},children:e.states.map(t=>s.jsx(ye,{state:t},t))})},e.label)),s.jsx(Se,{title:"Pills & badges",children:s.jsxs("div",{className:"row gap-8",style:{flexWrap:"wrap"},"data-kit":"badge","data-kit-state":"default",children:[s.jsx(fe,{color:"var(--accent)",bg:"var(--accent-soft)",dot:!0,children:"custom"}),s.jsx(fe,{color:"var(--node-code)",bg:"var(--node-code-soft)",children:"code"}),s.jsx(fe,{color:"var(--text-secondary)",bg:"var(--bg-elevated)",children:"neutral"})]})})]})}const qm=[4,6,5,8,7,10,9,12,11,14],Zm=Array.from({length:14},(e,t)=>({day:t+1,count:Math.round(4+Math.sin(t/2)*2+t*.6)})),Jm=[{label:"verified",count:12,color:"var(--success)"},{label:"implemented",count:7,color:"var(--node-spec)"},{label:"drifted",count:2,color:"var(--warn)"}],ev=[{label:"specship",values:{a:14,b:6}},{label:"web-ng",values:{a:9,b:3}}],tv=[{key:"a",label:"specs",color:"var(--accent)"},{key:"b",label:"tests",color:"var(--node-route)"}],nv=[{name:"specship_explore",calls:42},{name:"specship_node",calls:17},{name:"specship_search",calls:9}],rv=[{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"}],sv=[{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}],lv=[{from:"spec",to:"fn"},{from:"spec",to:"test"},{from:"fn",to:"route",kind:"synth"}];function iv(){const[e,t]=C.useState("week");return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"row gap-8",style:{margin:"20px 0 8px"},children:[s.jsx("div",{className:"eyebrow",children:"Chart & graph primitives"}),s.jsx(mm,{title:"Illustrative reference data — these primitives have no backend; every data screen binds to your live project."})]}),s.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(300px, 1fr))",gap:12},children:[s.jsxs("div",{className:"card card-pad",children:[s.jsx("div",{className:"eyebrow",style:{marginBottom:12},children:"Segmented"}),s.jsx(wt,{options:[{value:"today",label:"Today"},{value:"week",label:"This week"},{value:"month",label:"This month"}],value:e,onChange:t,size:"sm"})]}),s.jsxs("div",{className:"card card-pad",children:[s.jsx("div",{className:"eyebrow",style:{marginBottom:12},children:"Sparkline + line"}),s.jsx(Hd,{data:qm,fill:!0}),s.jsx("div",{style:{marginTop:10},children:s.jsx(am,{series:Zm,h:140})})]}),s.jsxs("div",{className:"card card-pad",children:[s.jsx("div",{className:"eyebrow",style:{marginBottom:12},children:"Donut + stacked bars"}),s.jsxs("div",{className:"row gap-16",children:[s.jsx(cm,{data:Jm,centerLabel:"21",centerSub:"links"}),s.jsx("div",{className:"grow",children:s.jsx(um,{rows:ev,segments:tv})})]})]}),s.jsxs("div",{className:"card card-pad",children:[s.jsx("div",{className:"eyebrow",style:{marginBottom:12},children:"Bars + treemap"}),s.jsx(dm,{items:nv}),s.jsx("div",{style:{marginTop:12},children:s.jsx(pm,{items:rv,height:110})})]}),s.jsxs("div",{className:"card",style:{gridColumn:"1 / -1",overflow:"hidden"},children:[s.jsx("div",{className:"eyebrow",style:{padding:"12px 14px 0"},children:"Graph canvas"}),s.jsx("div",{style:{height:220},children:s.jsx(Yd,{nodes:sv,edges:lv})})]})]})]})}function ov(){return s.jsxs("div",{className:"scroll-y",style:{flex:1,padding:22},children:[s.jsx(Vt,{icon:"layers",title:"Design system",sub:"Tokens, components and states — rendered live in the dark theme, WCAG AA."}),s.jsxs("div",{"data-theme":"dark",style:{marginBottom:20,borderRadius:12,background:"var(--bg-canvas)",padding:16,border:"1px solid var(--border-subtle)"},children:[s.jsx("div",{className:"eyebrow","data-testid":"theme-dark",style:{marginBottom:12,color:"var(--text-secondary)"},children:"dark theme"}),s.jsx(Xm,{})]}),s.jsx(iv,{})]})}const Vi={height:"100%",display:"flex",flexDirection:"column"},Ki={gap:8,padding:"13px 14px",borderBottom:"1px solid var(--border-subtle)"},Xd={flex:1,padding:14,display:"flex",flexDirection:"column",gap:16},zn={overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function Ys({onClick:e,children:t,bordered:n}){return s.jsx("div",{onClick:e,role:e?"button":void 0,tabIndex:e?0:void 0,onKeyDown:e?r=>{(r.key==="Enter"||r.key===" ")&&(r.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 Mt({children:e}){return s.jsx("div",{className:"eyebrow",style:{marginBottom:6},children:e})}function mc({n:e,onSelect:t}){const n=Ur(e.kind,e.filePath);return s.jsxs(Ys,{onClick:()=>t(e.id),children:[s.jsx("span",{style:{width:7,height:7,borderRadius:n==="spec"?2:"50%",background:ut(n),flexShrink:0}}),s.jsx("span",{className:"mono grow",style:{fontSize:12,...zn},children:e.name}),s.jsxs("span",{className:"mono tabular muted",style:{fontSize:10.5},children:[e.degree," edges"]}),s.jsx(R,{name:"chevronRight",size:12,style:{color:"var(--text-faint)"}})]})}function us({color:e,label:t,count:n,dashed:r}){return s.jsxs("div",{className:"row gap-8",style:{padding:"4px 0"},children:[s.jsx("svg",{width:20,height:8,style:{flexShrink:0},children:s.jsx("line",{x1:0,y1:4,x2:20,y2:4,stroke:e,strokeWidth:1.8,strokeDasharray:r?"4 3":"none"})}),s.jsx("span",{className:"grow secondary",style:{fontSize:12},children:t}),n!=null&&s.jsx("span",{className:"mono tabular muted",style:{fontSize:11},children:n})]})}const av=[{kind:"code",label:"Code"},{kind:"spec",label:"Spec"},{kind:"test",label:"Test"},{kind:"route",label:"Route"}],vc=["verified","drifted","broken"];function cv({project:e,counts:t,shown:n,onSelect:r}){const l=H(()=>D.graphHealth(e),[e]),i=l.data?.linkHealth??{},o=l.data?.edgeKinds??{},a={verified:i.verified??0,drifted:i.drifted??0,broken:(i.broken??0)+(i.orphaned??0)},c=vc.some(u=>a[u]>0);return s.jsxs("div",{style:Vi,children:[s.jsxs("div",{className:"row",style:Ki,children:[s.jsx(R,{name:"graph",size:15,style:{color:"var(--accent)"}}),s.jsx("span",{style:{fontWeight:600,fontSize:13.5},children:"Graph overview"}),s.jsx("span",{className:"grow"}),s.jsxs("span",{className:"mono muted",style:{fontSize:11},children:[n," shown"]})]}),s.jsxs("div",{className:"scroll-y",style:Xd,children:[s.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."}),s.jsxs("div",{children:[s.jsx(Mt,{children:"Nodes by kind"}),av.filter(u=>t[u.kind]).map(u=>s.jsxs("div",{className:"row gap-8",style:{padding:"5px 0"},children:[s.jsx("span",{style:{width:9,height:9,borderRadius:u.kind==="spec"?2:"50%",background:ut(u.kind),flexShrink:0,boxShadow:`0 0 6px ${ut(u.kind)}`}}),s.jsx("span",{className:"grow",style:{fontSize:12.5},children:u.label}),s.jsx("span",{className:"mono tabular",style:{fontSize:12.5,fontWeight:600},children:t[u.kind]})]},u.kind))]}),s.jsxs("div",{children:[s.jsx(Mt,{children:"Spec link health"}),c?s.jsx("div",{className:"row gap-6",style:{flexWrap:"wrap"},children:vc.filter(u=>a[u]>0).map(u=>s.jsxs("span",{className:"row gap-6",children:[s.jsx(ye,{state:u}),s.jsx("span",{className:"mono tabular muted",style:{fontSize:11,alignSelf:"center"},children:a[u]})]},u))}):s.jsx("div",{className:"muted",style:{fontSize:12},children:"No spec links yet"})]}),s.jsxs("div",{children:[s.jsx(Mt,{children:"Edge types"}),s.jsx(us,{color:"var(--text-muted)",label:"calls",count:o.calls??0}),s.jsx(us,{color:"var(--node-spec)",label:"implements / documents",count:o.implements??0}),s.jsx(us,{color:"var(--node-test)",label:"test evidence (links)",count:o.tests??0}),s.jsx(us,{color:"var(--text-muted)",label:"synthesized (heuristic)",count:o.synth??0,dashed:!0})]}),s.jsxs("div",{children:[s.jsx(Mt,{children:"Most connected"}),(l.data?.hubs??[]).map(u=>s.jsx(mc,{n:u,onSelect:r},u.id)),l.data&&!l.data.hubs.length&&s.jsx("div",{className:"muted",style:{fontSize:12,padding:"4px 8px"},children:"No connected nodes yet"})]}),s.jsxs("div",{children:[s.jsx(Mt,{children:"Anchored"}),(l.data?.anchored??[]).map(u=>s.jsx(mc,{n:u,onSelect:r},u.id)),l.data&&!l.data.anchored.length&&s.jsx("div",{className:"muted",style:{fontSize:12,padding:"4px 8px"},children:"No spec-linked code yet"})]})]})]})}function gc({title:e,items:t,empty:n,onSelect:r}){return s.jsxs("div",{children:[s.jsxs("div",{className:"eyebrow",style:{marginBottom:4},children:[e,s.jsx("span",{className:"muted",style:{marginLeft:6,fontWeight:400},children:t.length})]}),t.length?t.slice(0,10).map(l=>s.jsxs(Ys,{onClick:()=>r(l.id),children:[s.jsx(R,{name:"box",size:12,style:{color:ut(Ur(l.kind,l.filePath)),flexShrink:0}}),s.jsx("span",{className:"mono grow",style:zn,children:l.name}),s.jsx("span",{className:"mono muted",style:{fontSize:10,flexShrink:0},children:l.filePath.split("/").pop()})]},l.id)):s.jsx("div",{className:"muted",style:{fontSize:12,padding:"4px 8px"},children:n})]})}function uv({id:e,project:t,onSelect:n,onClose:r}){const l=H(()=>D.graphNode(e,t),[e,t]),i=l.data?.matches[0];if(!i)return s.jsxs("div",{style:Vi,children:[s.jsxs("div",{className:"row",style:Ki,children:[s.jsx("span",{className:"grow",style:{fontWeight:600,fontSize:13.5},children:"Node"}),s.jsx("button",{className:"btn btn-ghost btn-xs","aria-label":"Close node detail",onClick:r,children:s.jsx(R,{name:"x",size:14})})]}),s.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 o=Ur(i.kind,i.filePath),a=o==="spec"||i.kind==="spec",c=ut(o);return s.jsxs("div",{style:Vi,children:[s.jsxs("div",{className:"row",style:{...Ki,padding:"12px 14px"},children:[s.jsx("span",{style:{width:9,height:9,borderRadius:a?2:"50%",background:c,flexShrink:0,marginTop:5,boxShadow:`0 0 8px ${c}`,alignSelf:"flex-start"}}),s.jsxs("div",{className:"grow",style:{minWidth:0},children:[s.jsx("div",{className:"mono",style:{fontSize:14,fontWeight:600,...zn},children:i.name}),s.jsx("div",{className:"row gap-6",style:{marginTop:3},children:s.jsx(fe,{color:c,bg:`color-mix(in srgb, ${c} 14%, transparent)`,children:i.kind})})]}),s.jsx("button",{className:"btn btn-ghost btn-xs","aria-label":"Close node detail",onClick:r,children:s.jsx(R,{name:"x",size:14})})]}),s.jsxs("div",{className:"scroll-y",style:Xd,children:[s.jsxs("div",{className:"row gap-6",style:{fontSize:11.5},children:[s.jsx(R,{name:"folder",size:12,style:{color:"var(--text-muted)"}}),s.jsx("span",{className:"mono secondary",style:zn,children:i.filePath}),s.jsx(Go,{text:i.filePath,ariaLabel:"Copy file path"})]}),!a&&i.signature&&s.jsxs("div",{children:[s.jsx(Mt,{children:"Signature"}),s.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:i.signature})]}),!a&&s.jsxs("div",{children:[s.jsx(Mt,{children:"Linked specs"}),i.linkedSpecs.length?i.linkedSpecs.map((u,h)=>s.jsxs(Ys,{bordered:!0,onClick:()=>Q("specs",{param:u.specId}),children:[s.jsx("span",{className:"mono grow",style:{fontSize:11.5,...zn},children:u.specId}),s.jsx(ye,{state:u.state})]},h)):s.jsx("div",{className:"muted",style:{fontSize:12,padding:"4px 8px"},children:"No linked specs"})]}),!a&&s.jsx(gc,{title:"Callers",items:i.callers,empty:"No callers",onSelect:n}),!a&&s.jsx(gc,{title:"Callees",items:i.callees,empty:"No callees",onSelect:n}),a&&s.jsxs("div",{children:[s.jsx(Mt,{children:"Linked code"}),i.linkedSpecs.length?i.linkedSpecs.map((u,h)=>s.jsxs(Ys,{bordered:!0,children:[s.jsx(ye,{state:u.state}),s.jsx("span",{className:"mono grow",style:{fontSize:11,...zn},children:u.targetQualifiedName??u.targetFilePath})]},h)):s.jsx("div",{className:"muted",style:{fontSize:12,padding:8,border:"1px dashed var(--border-subtle)",borderRadius:6,textAlign:"center"},children:"No linked code — orphaned"})]})]}),s.jsxs("div",{className:"row gap-8",style:{padding:12,borderTop:"1px solid var(--border-subtle)"},children:[s.jsxs("button",{className:"btn btn-primary btn-sm grow",style:{justifyContent:"center"},disabled:!0,title:"Run automatically by the implementation workflow once Drafted",children:[s.jsx(R,{name:"play",size:13}),"Implement"]}),s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>Q("review",{query:{group:"drifted"}}),children:"View drift"})]})]})}const dv=/<!--\s*id:[\s\S]*?-->/g,Hl=/^\s*(```|~~~)/,fv=/^#{1,6}\s/,xc=/^#{1,6}\s+Acceptance\b/i,pv=/^(implementations|verifies):/,qd=/^\s*(?:[-*+]|\d+[.)])\s/;function hv(e){const t=[];let n=!1,r="none";for(const l of String(e??"").replace(/\r\n?/g,`
41
+ `).split(`
42
+ `)){if(n){r!=="acceptance"&&t.push(l),Hl.test(l)&&(n=!1);continue}if(r==="links"){if(l.trim()!==""&&(/^\s/.test(l)||qd.test(l)))continue;r="none"}if(r==="acceptance"){if(!fv.test(l)||xc.test(l)){Hl.test(l)&&(n=!0);continue}r="none"}if(xc.test(l)){r="acceptance";continue}if(pv.test(l)){r="links";continue}if(Hl.test(l)){n=!0,t.push(l);continue}const i=l.replace(dv,"");i.trim()===""&&l.trim()!==""||t.push(i.replace(/\s+$/,""))}return t.join(`
43
+ `).replace(/\n{3,}/g,`
44
+
45
+ `).trim()}function Zd(e){const t=hv(e);return t?t.split(/\n\s*\n/).map(n=>{const r=n.split(`
46
+ `);let l=r[0]??"";for(const i of r.slice(1))l+=qd.test(i)?`
47
+ `+i.trim():" "+i.trim();return l.trim()}):[]}const Jd=/^\s*<!--\s*id\s*:\s*([^\s-][^\s]*)\s*-->\s*$/,ds=/^(#{1,6})\s+(.+?)\s*$/,yc=/^\s*[-*]\s+(.*\S)\s*$/,qt=e=>e.replace(/\r$/,""),fs=e=>qt(e).match(Jd)?.[1]??null;function ef(e,t){const n=e.findIndex(g=>fs(g)===t);if(n===-1)return null;let r=-1,l=2,i="";for(let g=n+1;g<e.length;g++){const b=qt(e[g]);if(b.trim()==="")continue;const f=b.match(ds);f&&f[1]&&f[2]&&(r=g,l=f[1].length,i=f[2]);break}if(r===-1)return null;let o=e.length;for(let g=r+1;g<e.length;g++){const b=fs(e[g]);if(b&&b!==t&&!b.startsWith(t+".")){o=g;break}}let a=-1,c=-1;for(let g=r+1;g<o;g++){const b=qt(e[g]),f=b.match(ds);if(f&&f[2]&&f[2].trim().toLowerCase()==="acceptance"||fs(e[g])){a=g;break}c===-1&&b.trim().startsWith("implementations:")&&(c=g)}const u=c!==-1?c:a!==-1?a:o,h=e.slice(r+1,u).map(qt).join(`
48
+ `).trim(),m=a!==-1?a:o,v=c!==-1?e.slice(c,m):[];for(;v.length&&qt(v[v.length-1]).trim()==="";)v.pop();const y=[];let x=null;if(a!==-1){let g=null;for(let b=a;b<o;b++){const f=qt(e[b]),d=fs(e[b]);if(d){g=d;continue}const p=f.match(ds);if(p&&p[2]&&p[2].trim().toLowerCase()==="acceptance"){x===null&&(x=f);continue}const j=f.match(yc);if(j&&j[1]){const k=[j[1].trim()];for(;b+1<o;){const N=qt(e[b+1]);if(N.trim()===""||Jd.test(N)||ds.test(N)||yc.test(N))break;k.push(N.trim()),b++}y.push({id:g??"",text:k.join(" ").trim()}),g=null}}}return{start:n,end:o,headingIdx:r,headingLevel:l,title:i,statement:h,middle:v,acceptanceHeading:x,criteria:y}}function tf(e,t){const n=ef(e.split(`
49
+ `),t);if(!n)return null;const{title:r,headingLevel:l,statement:i,criteria:o}=n;return{title:r,headingLevel:l,statement:i,criteria:o}}function mv(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 vv(e,t,n){const r=e.split(`
50
+ `),l=ef(r,t);if(!l)return null;const i=[r[l.start],"#".repeat(l.headingLevel)+" "+n.title,""];return n.statement&&i.push(...n.statement.split(`
51
+ `),""),l.middle.length&&i.push(...l.middle,""),n.criteria.length&&(i.push(l.acceptanceHeading??"## Acceptance"),n.criteria.forEach((o,a)=>{i.push(`<!-- id: ${t}.A${a+1} -->`,`- ${o.text}`)}),i.push("")),[...r.slice(0,l.start),...i,...r.slice(l.end)].join(`
52
+ `)}function rn(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}function Qi(e){return e.kind==="tests"}function Gi(e){const t=(e??[]).filter(Qi);return t.length?t.some(n=>n.state==="broken")?"broken":t.every(n=>n.state==="verified")?"verified":"tested":"untested"}const gv={untested:{label:"Untested",color:"var(--warn)",bg:"var(--warn-soft)",title:"No proving test is linked — implementation alone is not evidence."},tested:{label:"Tested",color:"var(--info)",bg:"var(--info-soft)",title:"A proving test is linked but has not passed verification yet."},verified:{label:"Test-verified",color:"var(--success)",bg:"var(--success-soft)",title:"Every linked proving test is verified."},broken:{label:"Test broken",color:"var(--error)",bg:"var(--error-soft)",title:"A linked proving test is broken."}};function xv(e){return Gi(e)==="verified"}function Xs(e,t){if(!e||!e.length)return t;const n=e.map(r=>r.state);return n.includes("broken")?"broken":n.includes("orphaned")?"orphaned":n.includes("drifted")?"drifted":n.every(r=>r==="verified")?"verified":"implemented"}const yv={verified:"check",implemented:"check",completed:"check",drifted:"drift",broken:"cancel",orphaned:"cancel",failed:"cancel"};function wv({state:e}){const t=Ne[e]??Ne.info,n=yv[e];return s.jsx("div",{className:"sp-crit-mark",style:{background:t.bg,color:t.color},children:n?s.jsx(R,{name:n,size:12}):s.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 jv(e){return Ne[e]?.label??e}function kv({id:e,project:t,cache:n}){return e?s.jsx(Nv,{id:e,project:t,cache:n}):s.jsx(Sv,{})}function Sv(){return s.jsx(G,{icon:"book",title:"Pick a requirement to read it",body:"Choose a requirement from the list to see its acceptance criteria, links and drift."})}function Nv({id:e,project:t,cache:n}){const r=(t??"")+"|"+e,l=H(async()=>{const h=await D.spec(e,t);return n?.set(r,h),h},[e,t]),i=l.data??n?.get(r)??null,[o,a]=C.useState(!1),[c,u]=C.useState(null);return C.useEffect(()=>{a(!1),u(null)},[e]),i?i.spec.kind==="brief"?s.jsx(bv,{data:i}):o?s.jsx(Ov,{data:i,project:t,onCancel:()=>a(!1),onSaved:h=>{a(!1),u(h),l.reload()}}):s.jsx(Ev,{data:i,project:t,notice:c,onEdit:()=>{u(null),a(!0)},onReload:l.reload}):l.loading?s.jsx(Cv,{}):Qe(l.error)?s.jsx(G,{icon:"folder",title:"No project selected",body:"Pick an indexed project from the switcher in the status strip."}):s.jsx(G,{icon:"drift",title:`Couldn’t load ${e}`,body:l.error instanceof Error?l.error.message:"The spec detail request failed.",action:s.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:l.reload,children:[s.jsx(R,{name:"refresh",size:13}),"Retry"]})})}function bv({data:e}){const{spec:t}=e,n=typeof t.metadata?.spec=="string"?t.metadata.spec:null,r=typeof t.metadata?.created=="string"?t.metadata.created:null;return s.jsx("div",{className:"scroll-y",style:{flex:1,padding:"28px 32px 56px"},children:s.jsxs("div",{className:"sp-doc",children:[s.jsxs("div",{className:"sp-breadcrumb",children:[s.jsx(R,{name:"sparkles",size:13,style:{color:"var(--info)",flexShrink:0}}),s.jsx("span",{className:"mono sp-path",style:{color:"var(--text-secondary)"},children:t.sourcePath??""}),s.jsx(R,{name:"chevronRight",size:11,style:{flexShrink:0}}),s.jsx("span",{className:"mono",style:{color:"var(--info)",fontWeight:600,flexShrink:0},children:t.id}),s.jsx(Go,{text:t.id,ariaLabel:"Copy brief id"})]}),s.jsx("h1",{className:"sp-title",children:t.title}),s.jsxs("div",{className:"sp-metaline",style:{marginBottom:32},children:[s.jsx(fe,{color:"var(--info)",bg:"var(--info-soft)",dot:!0,children:"Idea"}),r&&s.jsxs("span",{className:"fact",children:["captured ",s.jsx("b",{children:r})]}),n&&s.jsxs("span",{className:"fact",children:["specified as ",s.jsx("b",{className:"mono",children:n})]}),!n&&s.jsx("span",{className:"fact muted",children:"not yet specified"})]}),s.jsxs("div",{className:"sp-sec",children:[s.jsx("div",{className:"sp-label",children:"Brief"}),t.body?.trim()?s.jsx("div",{className:"sp-prose",dangerouslySetInnerHTML:{__html:rn(t.body)}}):s.jsx("div",{className:"muted",style:{fontSize:13},children:"This brief has no body."})]})]})})}function Cv(){return s.jsx("div",{className:"scroll-y",style:{flex:1,padding:"28px 32px 56px"},"data-testid":"spec-skeleton",children:s.jsxs("div",{className:"sp-doc",children:[s.jsx("div",{className:"skel",style:{width:230,height:12,marginBottom:20}}),s.jsx("div",{className:"skel",style:{width:"72%",height:28,marginBottom:16}}),s.jsx("div",{className:"skel",style:{width:340,height:20,marginBottom:32}}),s.jsx("div",{className:"skel",style:{width:"100%",height:96,marginBottom:30}}),s.jsx("div",{className:"skel",style:{width:"100%",height:132,marginBottom:30}}),s.jsx("div",{className:"skel",style:{width:"100%",height:56}})]})})}function Ev({data:e,project:t,notice:n,onEdit:r,onReload:l}){const{spec:i,parent:o,children:a,links:c,childLinks:u}=e,h=o?.sourcePath??i.sourcePath??"",m=e.source!=null&&tf(e.source,i.id)!=null,v=m?"Edit this requirement in place":e.source==null?"Source file not available":"Couldn’t locate this requirement’s section in the source file",y=a.filter(S=>S.kind==="acceptance"),x=S=>Xs(u[S.id],"pending"),g=Xs(c,"drafted"),b=y.filter(S=>xv(u[S.id])).length,f=(Ne[g]??Ne.info).color,d=c.filter(Qi),p=c.filter(S=>!Qi(S)),j=Gi(c),k=gv[j],N=g==="verified"?Un(c.reduce((S,z)=>Math.max(S,z.updatedAt??0),0)||void 0):null,E=g==="verified"?"var(--success)":g==="broken"||g==="drifted"||g==="orphaned"?"var(--warn)":"var(--text-secondary)",T=typeof i.metadata?.rationale=="string"?i.metadata.rationale:typeof i.rationale=="string"?i.rationale:null,A=p.filter(S=>typeof S.id=="number"&&S.state!=="verified"),[P,J]=C.useState(!1),[ce,je]=C.useState(null),Be=async()=>{J(!0),je(null);try{for(const S of A)await D.linkVerify({link_id:S.id,result:"pass"},t);je({tone:"ok",text:`Verified ${A.length} link${A.length===1?"":"s"}.`}),l?.()}catch(S){const z=S instanceof Ko&&S.code==="no_test_evidence";je({tone:"error",text:z?"Declare a proving test first — add a `verifies:` block to this requirement (or an @verifies comment on the test) so there is evidence to promote against.":S instanceof Error?S.message:String(S)})}finally{J(!1)}},kt=S=>[S.targetFilePath,S.targetQualifiedName].filter(Boolean).join(":")||"—",Xe=S=>Q("graph",{query:{focus:S.resolvedNodeId||"spec:"+i.id}}),ze=s.jsx("span",{className:"sep"}),w=S=>s.jsx("div",{className:"card",style:{overflow:"hidden"},children:S.map((z,L)=>s.jsxs("div",{className:"row gap-10",style:{padding:"11px 14px",borderTop:L?"1px solid var(--border-subtle)":"none"},children:[s.jsx(ye,{state:z.state}),s.jsx(fe,{children:z.kind||"implements"}),z.driftAxis&&s.jsx(fe,{color:"var(--warn)",bg:"var(--warn-soft)",children:z.driftAxis+" drift"}),s.jsx("span",{className:"mono grow",style:{fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:kt(z)}),s.jsx("span",{className:"mono muted tabular",title:"Last state change",style:{fontSize:11,flexShrink:0},children:Un(z.updatedAt)??"—"}),s.jsx(fe,{children:z.provenance||"—"}),s.jsxs("button",{className:"btn btn-ghost btn-xs",onClick:()=>Xe(z),title:"Reveal in the graph",children:[s.jsx(R,{name:"reveal",size:12}),"Reveal"]})]},L))});return s.jsx("div",{className:"scroll-y",style:{flex:1,padding:"28px 32px 56px"},children:s.jsxs("div",{className:"sp-doc",children:[n!=null&&s.jsxs("div",{className:"card card-pad row gap-8",style:{color:"var(--warn)",borderColor:"var(--warn)",marginBottom:20,fontSize:12.5},children:[s.jsx(R,{name:"drift",size:14,style:{flexShrink:0}}),s.jsxs("span",{children:["Saved, but not yet indexed — re-sync failed (",n,"). The file is on disk; the next sync picks it up."]})]}),s.jsxs("div",{className:"sp-breadcrumb",children:[s.jsx(R,{name:"book",size:13,style:{color:"var(--node-spec)",flexShrink:0}}),s.jsx("span",{className:"mono sp-path",style:{color:"var(--text-secondary)"},children:h}),s.jsx(R,{name:"chevronRight",size:11,style:{flexShrink:0}}),s.jsx("span",{className:"mono",style:{color:"var(--node-spec)",fontWeight:600,flexShrink:0},children:i.id}),s.jsx(Go,{text:i.id,ariaLabel:"Copy spec id"})]}),s.jsx("h1",{className:"sp-title",children:i.title}),s.jsxs("div",{className:"sp-metaline",style:{marginBottom:32},children:[s.jsx(ye,{state:g,pulse:g==="broken"||g==="drifted"}),s.jsx("span",{"data-testid":"coverage-fact",title:k.title,children:s.jsx(fe,{color:k.color,bg:k.bg,dot:!0,children:k.label})}),s.jsx(fe,{children:i.priority||"—"}),ze,s.jsx("span",{className:"fact",children:s.jsx("b",{children:i.kind||"requirement"})}),ze,s.jsxs("span",{className:"fact",children:["owned by ",s.jsx("b",{className:"mono",children:i.owner||"—"})]}),ze,s.jsxs("span",{className:"fact",children:[g==="verified"?"verified ":null,s.jsx("b",{style:{color:E},children:N?N+" ago":"—"})]})]}),s.jsxs("div",{className:"sp-sec",children:[s.jsx("div",{className:"sp-label",children:"Requirement"}),s.jsx("div",{className:"sp-statement lead",style:{"--sp-accent":f},children:i.body?.trim()?s.jsx("div",{className:"sp-prose",dangerouslySetInnerHTML:{__html:rn(i.body)}}):s.jsx("div",{className:"muted",style:{fontSize:13},children:"No normative statement recorded."})})]}),T&&s.jsxs("div",{className:"sp-sec",children:[s.jsx("div",{className:"sp-label",children:"Why it matters"}),s.jsx("div",{className:"sp-rationale",dangerouslySetInnerHTML:{__html:rn(T)}})]}),y.length>0&&s.jsxs("div",{className:"sp-sec",children:[s.jsxs("div",{className:"sp-label",children:["Acceptance criteria",s.jsx("span",{className:"ct tabular",title:"Met = a linked proving test is verified. Implementation alone doesn’t count.",style:{color:b===y.length?"var(--success)":"var(--text-muted)"},children:b+" / "+y.length+" met"})]}),s.jsx("div",{className:"row gap-4",style:{marginBottom:12},children:y.map(S=>{const z=x(S),L=Ne[z]??Ne.info;return s.jsx("div",{title:wc(S.id)+" · "+jv(z),style:{flex:1,height:4,borderRadius:999,background:L.color,opacity:z==="pending"?.25:.9}},S.id)})}),s.jsx("div",{className:"card",style:{overflow:"hidden"},children:y.map(S=>s.jsxs("div",{className:"sp-crit",children:[s.jsx(wv,{state:x(S)}),s.jsx("span",{className:"sp-crit-id",children:wc(S.id)}),s.jsx("span",{className:"sp-crit-text",dangerouslySetInnerHTML:{__html:rn(S.body||S.title)}}),Gi(u[S.id])==="untested"&&s.jsx("span",{className:"muted",title:"No proving test links to this criterion",style:{fontSize:10.5,flexShrink:0},children:"untested"})]},S.id))})]}),s.jsxs("div",{className:"sp-sec",children:[s.jsxs("div",{className:"sp-label",children:["Linked code",p.length>0&&s.jsx("span",{className:"ct",children:p.length+(p.length===1?" symbol":" symbols")})]}),p.length?w(p):s.jsxs("div",{className:"card card-pad",style:{textAlign:"center",color:"var(--error)",borderColor:"var(--danger-line)"},children:[s.jsx(R,{name:"drift",size:16}),s.jsx("div",{style:{marginTop:6,fontSize:12.5},children:"Orphaned — no code implements this requirement yet"})]})]}),s.jsxs("div",{className:"sp-sec",children:[s.jsxs("div",{className:"sp-label",children:["Proving tests",d.length>0&&s.jsx("span",{className:"ct",children:d.length+(d.length===1?" test":" tests")})]}),d.length?w(d):s.jsxs("div",{className:"card card-pad",style:{textAlign:"center",color:"var(--warn)",borderColor:"var(--warning-line)"},children:[s.jsx(R,{name:"drift",size:16}),s.jsxs("div",{style:{marginTop:6,fontSize:12.5},children:["No proving test — declare one with a ",s.jsx("code",{className:"sp-code",children:"verifies:"})," block in the spec."]})]})]}),ce&&s.jsxs("div",{className:"card card-pad row gap-8",role:ce.tone==="error"?"alert":void 0,style:{marginBottom:14,fontSize:12.5,color:ce.tone==="error"?"var(--warn)":"var(--success)",borderColor:ce.tone==="error"?"var(--warn)":"var(--success)"},children:[s.jsx(R,{name:ce.tone==="error"?"drift":"check",size:14,style:{flexShrink:0}}),s.jsx("span",{children:ce.text})]}),s.jsxs("div",{className:"row gap-8",style:{flexWrap:"wrap",marginTop:4},children:[s.jsxs("button",{className:"btn btn-primary btn-sm",disabled:!0,title:"Run automatically by the implementation workflow once Drafted",children:[s.jsx(R,{name:"play",size:13}),"Implement"]}),s.jsxs("button",{className:"btn btn-secondary btn-sm",disabled:!A.length||P,title:A.length?"Promote this requirement’s implementation links to verified":"Nothing to verify — every implementation link is already verified",onClick:A.length?()=>{Be()}:void 0,children:[s.jsx(R,{name:"check",size:13}),P?"Verifying…":"Verify"]}),s.jsxs("button",{className:"btn btn-secondary btn-sm",disabled:!m,title:v,onClick:m?r:void 0,children:[s.jsx(R,{name:"reveal",size:13}),"Edit spec"]}),s.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:()=>Q("graph",{query:{focus:"spec:"+i.id}}),children:[s.jsx(R,{name:"graph",size:13}),"Show in graph"]})]})]})})}const zv=["pending","implementing","implemented","verified","drifted","broken"],Mv=["P0","P1","P2","P3"],Rv=["requirement","constraint","guideline","invariant","non-functional"];function Tv(e,t){const{spec:n,childLinks:r}=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(i=>({id:i.id,state:Xs(r[i.id],"pending"),text:i.text}))}}function jc(e){return{title:e.title,statement:e.statement,criteria:e.criteria}}const _v={title:"",priority:"",kind:"requirement",owner:"",statement:"",rationale:"",criteria:[]};function hn({label:e,hint:t,children:n}){return s.jsxs("div",{style:{marginBottom:22},children:[s.jsx("label",{className:"sp-fl",children:e}),n,t&&s.jsx("div",{className:"muted",style:{fontSize:11,marginTop:6},children:t})]})}function Lv({value:e,onChange:t,options:n,label:r,disabled:l}){const i=n.includes(e)?n:[e,...n];return s.jsx("select",{className:"input sp-select","aria-label":r,value:e,disabled:l,onChange:o=>t(o.target.value),style:{width:"100%",textTransform:"capitalize"},children:i.map(o=>s.jsx("option",{value:o,children:o},o))})}function Pv({value:e,onChange:t,options:n,width:r,label:l}){const i=Ne[e]??Ne.info;return s.jsxs("div",{className:"row",style:{position:"relative",width:r??"auto",flexShrink:0},children:[s.jsx("span",{className:"pill-dot","data-testid":"crit-state-dot",style:{background:i.color,position:"absolute",left:11,pointerEvents:"none",zIndex:1}}),s.jsx("select",{className:"input sp-select","aria-label":l,value:e,onChange:o=>t(o.target.value),style:{width:"100%",paddingLeft:26,textTransform:"capitalize"},children:n.map(o=>s.jsx("option",{value:o,children:Ne[o]?.label??o},o))})]})}function Iv({state:e}){return s.jsxs("div",{className:"sp-status-auto",children:[e==="drafted"?s.jsxs(s.Fragment,{children:[s.jsx(ye,{state:"drafted"}),s.jsx("span",{className:"muted",style:{fontSize:12},children:"queued for implementation"})]}):s.jsxs(s.Fragment,{children:[s.jsx(ye,{state:e}),s.jsx(R,{name:"arrowRight",size:13,style:{color:"var(--text-muted)",flexShrink:0}}),s.jsx(ye,{state:"drafted"})]}),s.jsx("span",{className:"grow"}),s.jsx(R,{name:"lock",size:12,style:{color:"var(--text-faint)",flexShrink:0}})]})}function Dv({criteria:e,onChange:t}){const n=(r,l)=>t(e.map((i,o)=>o===r?{...i,...l}:i));return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"row",style:{marginBottom:10,gap:10},children:[s.jsx("span",{className:"eyebrow",children:"Acceptance criteria"}),s.jsx("span",{style:{flex:1,height:1,background:"var(--border-subtle)"}}),s.jsx("span",{className:"mono tabular muted",style:{fontSize:11.5},children:e.length+" total"})]}),s.jsx("div",{className:"card",style:{overflow:"hidden",marginBottom:12},children:e.length===0?s.jsx("div",{className:"muted",style:{fontSize:12.5,textAlign:"center",padding:"18px 14px"},children:"No criteria yet — add one below."}):e.map((r,l)=>s.jsxs("div",{className:"sp-crit-edit",children:[s.jsx("span",{className:"sp-crit-grip",children:s.jsx(R,{name:"grip",size:14})}),s.jsx("span",{className:"sp-crit-num",children:"A"+(l+1)}),s.jsx(Pv,{value:r.state,onChange:i=>n(l,{state:i}),options:zv,width:156,label:"Criterion A"+(l+1)+" state"}),s.jsx("input",{className:"input grow",style:{fontSize:13},value:r.text,"aria-label":"Criterion A"+(l+1)+" text",placeholder:"Observable, testable condition…",onChange:i=>n(l,{text:i.target.value})}),s.jsx("button",{className:"sp-icon-btn",title:"Remove criterion","aria-label":"Remove criterion A"+(l+1),onClick:()=>t(e.filter((i,o)=>o!==l)),children:s.jsx(R,{name:"trash",size:14})})]},l))}),s.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:()=>t([...e,{id:"",state:"pending",text:""}]),children:[s.jsx(R,{name:"plus",size:13}),"Add criterion"]})]})}function Ov({data:e,project:t,onCancel:n,onSaved:r}){const{spec:l}=e,i=e.parent?.sourcePath??l.sourcePath??"",o=C.useMemo(()=>tf(e.source??"",l.id),[e.source,l.id]),[a,c]=C.useState(()=>o?Tv(e,o):_v),u=C.useRef(JSON.stringify(jc(a))),h=JSON.stringify(jc(a))!==u.current,[m,v]=C.useState("write"),[y,x]=C.useState(!1),[g,b]=C.useState(null),f=N=>c(E=>({...E,...N})),d=Xs(e.links,"drafted"),p=(Ne[d]??Ne.info).color;if(!o)return s.jsx(G,{icon:"drift",title:"Can’t edit this spec",body:"Its requirement section couldn’t be located in the source file."});const j=async()=>{if(!h||y)return;const N=mv({title:a.title,statement:a.statement,criteria:a.criteria}),E=vv(e.source??"",l.id,N);if(E===null){b("Could not locate this requirement’s section in the source file.");return}x(!0),b(null);try{const T=await D.specSave(l.id,E,t);r(T.syncError??null)}catch(T){b(T instanceof Error?T.message:String(T)),x(!1)}},k=s.jsxs("button",{className:"btn btn-primary btn-sm",disabled:!h||y,onClick:j,children:[s.jsx(R,{name:"check",size:13}),y?"Saving…":"Save changes"]});return s.jsxs("div",{className:"col",style:{flex:1,minHeight:0},children:[s.jsxs("div",{className:"sp-edit-bar",children:[s.jsx(R,{name:"reveal",size:15,style:{color:"var(--accent)",flexShrink:0}}),s.jsxs("div",{className:"col",style:{gap:1,minWidth:0},children:[s.jsx("div",{style:{fontSize:13,fontWeight:600},children:"Editing spec"}),s.jsx("div",{className:"mono muted",style:{fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i+" · "+l.id})]}),s.jsx("div",{className:"grow"}),h&&s.jsxs("div",{className:"row gap-6",style:{marginRight:4},children:[s.jsx("span",{className:"sp-dirty-dot"}),s.jsx("span",{className:"muted",style:{fontSize:11.5},children:"Unsaved changes"})]}),s.jsxs("button",{className:"btn btn-ghost btn-sm",onClick:n,children:[s.jsx(R,{name:"x",size:13}),"Cancel"]}),k]}),s.jsx("div",{className:"scroll-y",style:{flex:1,padding:"24px 28px 56px"},children:s.jsxs("div",{style:{maxWidth:780},children:[g&&s.jsxs("div",{className:"card card-pad row gap-8",role:"alert",style:{color:"var(--error)",borderColor:"var(--danger-line)",marginBottom:18,fontSize:12.5},children:[s.jsx(R,{name:"cancel",size:14,style:{flexShrink:0}}),s.jsxs("span",{children:["Save failed — ",g," Your draft is intact."]})]}),s.jsx(hn,{label:"Title",children:s.jsx("input",{className:"input sp-input-lg",value:a.title,"aria-label":"Title",placeholder:"Short, imperative requirement title",onChange:N=>f({title:N.target.value})})}),s.jsxs("div",{className:"sp-edit-grid",children:[s.jsx(hn,{label:"Status",hint:"Set automatically — saving re-queues this spec as Drafted so the implementation workflow picks it up.",children:s.jsx(Iv,{state:d})}),s.jsx(hn,{label:"Priority",children:s.jsx(wt,{options:Mv,value:a.priority,onChange:N=>f({priority:N}),label:"Priority",disabled:!0})}),s.jsx(hn,{label:"Kind",children:s.jsx(Lv,{value:a.kind,onChange:N=>f({kind:N}),options:Rv,label:"Kind",disabled:!0})}),s.jsx(hn,{label:"Owner",children:s.jsx("input",{className:"input mono",style:{width:"100%"},value:a.owner,"aria-label":"Owner",placeholder:"unassigned",disabled:!0,onChange:N=>f({owner:N.target.value})})})]}),s.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 and are read-only here, because Save can’t persist them per-requirement (REQ-TVIZ-009.A3)."}),s.jsxs("div",{style:{marginBottom:22},children:[s.jsxs("div",{className:"row",style:{marginBottom:7},children:[s.jsx("label",{className:"sp-fl",style:{marginBottom:0},children:"Normative statement"}),s.jsx("div",{className:"grow"}),s.jsx(wt,{size:"sm",options:[{value:"write",label:"Write"},{value:"preview",label:"Preview"}],value:m,onChange:v,label:"Statement editor mode"})]}),m==="write"?s.jsx("textarea",{className:"input sp-textarea",value:a.statement,spellCheck:!1,"aria-label":"Normative statement",placeholder:"The server MUST validate … (use MUST / SHOULD / MAY, **bold**, and `code`)",onChange:N=>f({statement:N.target.value})}):s.jsx("div",{className:"sp-statement",style:{"--sp-accent":p},children:a.statement.trim()?s.jsx("div",{className:"sp-prose",dangerouslySetInnerHTML:{__html:rn(a.statement)}}):s.jsx("div",{className:"muted",style:{fontSize:13},children:"Nothing to preview yet."})}),s.jsxs("div",{className:"sp-kw-legend",children:[s.jsx("span",{className:"label",children:"Keywords:"}),s.jsx("span",{className:"sp-kw sp-kw-must",children:"MUST"}),s.jsx("span",{className:"sp-kw sp-kw-should",children:"SHOULD"}),s.jsx("span",{className:"sp-kw sp-kw-may",children:"MAY"}),s.jsx("span",{className:"label",style:{marginLeft:4},children:"auto-highlight as you type"})]})]}),s.jsx(hn,{label:"Rationale",hint:"Read-only — the spec format carries no per-requirement rationale field, so Save can’t write one (REQ-TVIZ-009.A3).",children:s.jsx("textarea",{className:"input sp-textarea",value:a.rationale,spellCheck:!1,style:{minHeight:84},"aria-label":"Rationale",placeholder:"Why does this matter? What breaks without it?",disabled:!0,onChange:N=>f({rationale:N.target.value})})}),s.jsx(Dv,{criteria:a.criteria,onChange:N=>f({criteria:N})}),s.jsxs("div",{className:"row",style:{gap:10,marginTop:32,paddingTop:20,borderTop:"1px solid var(--border-subtle)"},children:[k,s.jsx("button",{className:"btn btn-ghost btn-sm",onClick:n,children:"Cancel"}),s.jsx("div",{className:"grow"}),s.jsx("span",{className:"mono muted",style:{fontSize:11},children:h?"edited":"no changes"})]})]})})]})}const un={overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},kc={flex:1,minWidth:0,minHeight:0,overflow:"auto",padding:16,display:"flex",flexDirection:"column",gap:14},Av={margin:0,padding:"10px 12px",borderRadius:6,border:"1px solid var(--border-subtle)",background:"var(--bg-canvas)",fontFamily:"var(--font-mono)",fontSize:12,lineHeight:1.5,overflow:"auto",whiteSpace:"pre"},nf=e=>Q("graph",{query:{req:e}}),Yo=e=>Q("graph",{query:{sym:e}});function qs({children:e}){return s.jsx("div",{className:"eyebrow",style:{marginBottom:6},children:e})}function Xo({onClick:e,children:t,testId:n}){return s.jsx("div",{role:"button",tabIndex:0,"data-testid":n,onClick:e,onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),e())},className:"row gap-8 list-row",style:{padding:"5px 8px",borderRadius:6,cursor:"pointer",fontSize:12},children:t})}function qo(e){return e instanceof Error?e.message:String(e)}function Fv({project:e}){const[t,n]=C.useState(""),[r,l]=C.useState(null),[i,o]=C.useState(!1),[a,c]=C.useState(0),u=C.useRef(0);C.useEffect(()=>{const x=t.trim(),g=++u.current;if(!x){l(null);return}const b=setTimeout(()=>{D.splitSearch(x,e).then(f=>{u.current===g&&(l(f),c(0))},()=>{u.current===g&&l({specs:[],symbols:[]})})},120);return()=>clearTimeout(b)},[t,e]);const h=[...(r?.specs??[]).map(x=>({key:"spec:"+x.id,group:"spec",label:x.id,sub:x.title,pick:()=>nf(x.id)})),...(r?.symbols??[]).map(x=>({key:"sym:"+x.id,group:"symbol",label:x.name,sub:x.filePath+(x.startLine?":"+x.startLine:""),pick:()=>Yo(x.id)}))],m=x=>{x.pick(),o(!1)},v=i&&r!==null&&t.trim().length>0,y=(x,g)=>{const b=h.filter(f=>f.group===x);return b.length?s.jsxs("div",{role:"group","aria-label":g,children:[s.jsx("div",{className:"eyebrow",style:{padding:"6px 10px 2px"},children:g}),b.map(f=>{const d=h.indexOf(f);return s.jsxs("div",{role:"option","aria-selected":d===a,"data-testid":"split-option-"+f.key,className:"row gap-8 list-row",onMouseDown:p=>{p.preventDefault(),m(f)},onMouseEnter:()=>c(d),style:{padding:"6px 10px",cursor:"pointer",fontSize:12,background:d===a?"var(--bg-panel-2)":void 0},children:[s.jsx("span",{className:"mono",style:{...un,flexShrink:0,maxWidth:"45%"},children:f.label}),s.jsx("span",{className:"muted grow",style:{...un,fontSize:11},children:f.sub})]},f.key)})]}):null};return s.jsxs("div",{style:{position:"relative",padding:"9px 14px",borderBottom:"1px solid var(--border-subtle)",background:"var(--bg-panel)"},children:[s.jsxs("div",{className:"row gap-8",children:[s.jsx(R,{name:"search",size:14,style:{color:"var(--text-muted)"}}),s.jsx("input",{role:"combobox","aria-label":"Search specs and code","aria-expanded":v,"aria-controls":"split-search-list",placeholder:"Search a requirement ID or a symbol name…",value:t,onChange:x=>{n(x.target.value),o(!0)},onFocus:()=>o(!0),onBlur:()=>o(!1),onKeyDown:x=>{x.key==="ArrowDown"?(x.preventDefault(),c(g=>Math.min(g+1,Math.max(h.length-1,0)))):x.key==="ArrowUp"?(x.preventDefault(),c(g=>Math.max(g-1,0))):x.key==="Enter"&&h[a]?(x.preventDefault(),m(h[a])):x.key==="Escape"&&o(!1)},className:"grow",style:{border:"none",outline:"none",background:"transparent",color:"var(--text-primary)",fontSize:13}})]}),v&&s.jsxs("div",{id:"split-search-list",role:"listbox","aria-label":"Search results",style:{position:"absolute",left:14,right:14,top:"100%",zIndex:20,maxHeight:360,overflow:"auto",background:"var(--bg-panel)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:"4px 0"},children:[h.length===0&&s.jsx("div",{className:"muted",style:{padding:"8px 10px",fontSize:12},children:"No matching spec or symbol"}),y("spec","Specs"),y("symbol","Symbols")]})]})}function rf({node:e}){return s.jsxs("div",{"data-testid":"split-code-"+e.id,children:[s.jsxs("div",{className:"row gap-8",style:{marginBottom:6},children:[s.jsx("span",{style:{width:7,height:7,borderRadius:"50%",background:ut(e.kind),flexShrink:0}}),s.jsx("span",{className:"mono",style:{fontSize:13,fontWeight:600,...un},children:e.name}),s.jsx(fe,{children:e.kind}),s.jsxs("span",{className:"mono muted grow",style:{fontSize:11,...un},children:[e.filePath,e.startLine?`:${e.startLine}`:""]})]}),e.code?s.jsx("pre",{style:Av,"data-testid":"split-source",children:e.code}):s.jsx("div",{className:"muted",style:{fontSize:12},children:"Source not available for this symbol."}),e.codeTruncated&&s.jsx("div",{className:"muted",style:{fontSize:11,marginTop:4},children:"Source truncated — open the file for the rest."})]})}function sf(e,t){return H(()=>D.graphNode(e,t,{includeCode:!0}),[e,t])}function $v({id:e,project:t}){const n=sf(e,t);if(n.error)return s.jsx(Qn,{title:"Couldn't load this symbol",detail:qo(n.error)});const r=n.data?.matches[0];return r?s.jsxs("div",{children:[s.jsx(rf,{node:r}),s.jsx("div",{style:{marginTop:4},children:s.jsxs(Xo,{onClick:()=>Yo(r.id),children:[s.jsxs("span",{className:"muted",children:["Step into ",r.name]}),s.jsx(R,{name:"chevronRight",size:12,style:{color:"var(--text-faint)"}})]})})]}):s.jsx("div",{className:"muted",style:{fontSize:12},children:"Loading…"})}function Sc({title:e,nodes:t,kind:n}){return s.jsxs("div",{children:[s.jsxs(qs,{children:[e," · ",t.length]}),t.length===0&&s.jsx("div",{className:"muted",style:{fontSize:12},children:"None"}),t.map(r=>s.jsxs(Xo,{onClick:()=>Yo(r.id),testId:`split-${n}-${r.name}`,children:[s.jsx("span",{style:{width:7,height:7,borderRadius:"50%",background:ut(r.kind),flexShrink:0}}),s.jsx("span",{className:"mono grow",style:un,children:r.name}),s.jsx("span",{className:"mono muted",style:{fontSize:10.5,...un,maxWidth:"50%"},children:r.filePath})]},r.id))]})}function Wv({spec:e,error:t}){return t?s.jsx(Qn,{title:"Couldn't load this requirement",detail:qo(t)}):e?s.jsxs("div",{"data-testid":"split-requirement",children:[s.jsx("div",{className:"mono muted",style:{fontSize:11},children:e.id}),s.jsx("h2",{style:{fontSize:16,margin:"4px 0 10px"},children:e.title}),s.jsx("div",{"data-testid":"split-requirement-body",style:{fontSize:13,lineHeight:1.6},children:Zd(e.body??"").map((n,r)=>s.jsx("p",{className:"sp-prose",style:{whiteSpace:"pre-line",margin:"0 0 10px"},dangerouslySetInnerHTML:{__html:rn(n)}},r))})]}):s.jsx("div",{className:"muted",style:{fontSize:12},children:"Loading…"})}function Bv({links:e}){const t=new Map;for(const n of e)t.has(n.specId)||t.set(n.specId,n);return t.size===0?s.jsxs("div",{"data-testid":"split-no-linked",children:[s.jsx(qs,{children:"Linked requirements"}),s.jsx("div",{className:"muted",style:{fontSize:13},children:"no linked requirement"})]}):s.jsxs("div",{"data-testid":"split-linked-specs",children:[s.jsxs(qs,{children:["Linked requirements · ",t.size]}),[...t.values()].map(n=>s.jsxs(Xo,{onClick:()=>nf(n.specId),testId:"split-linked-"+n.specId,children:[s.jsx("span",{className:"mono grow",style:un,children:n.specId}),s.jsx("span",{className:"muted",style:{fontSize:11},children:n.kind}),s.jsx(ye,{state:n.state})]},n.specId))]})}function lf({left:e,right:t}){return s.jsxs("div",{style:{flex:1,minHeight:0,display:"flex"},children:[s.jsx("section",{"aria-label":"Spec","data-testid":"split-left",style:{...kc,borderRight:"1px solid var(--border-subtle)",background:"var(--bg-panel)"},children:e}),s.jsx("section",{"aria-label":"Code","data-testid":"split-right",style:kc,children:t})]})}function Uv({id:e,project:t}){const n=H(()=>D.spec(e,t),[e,t]),r=[],l=[...n.data?.links??[]].sort((o,a)=>+(o.kind==="tests")-+(a.kind==="tests"));for(const o of l)o.resolvedNodeId&&!r.includes(o.resolvedNodeId)&&r.push(o.resolvedNodeId);const i=l.filter(o=>!o.resolvedNodeId);return s.jsx(lf,{left:s.jsx(Wv,{spec:n.data?.spec??null,error:n.error}),right:n.error?null:n.data?s.jsxs(s.Fragment,{children:[s.jsxs(qs,{children:["Linked code · ",r.length]}),r.length===0&&s.jsx("div",{className:"muted",style:{fontSize:13},children:"No code is linked to this requirement yet."}),r.map(o=>s.jsx($v,{id:o,project:t},o)),i.map((o,a)=>s.jsxs("div",{className:"muted mono",style:{fontSize:11},children:[o.targetFilePath,":",o.targetQualifiedName," — not resolved (",o.state,")"]},"u"+a))]}):s.jsx("div",{className:"muted",style:{fontSize:12},children:"Loading…"})})}function Hv({id:e,project:t}){const n=sf(e,t),r=n.data?.matches[0]??null,l=s.jsx("div",{className:"muted",style:{fontSize:12},children:"Loading…"});return s.jsx(lf,{left:n.error?null:r?s.jsx(Bv,{links:r.linkedSpecs??[]}):l,right:n.error?s.jsx(Qn,{title:"Couldn't load this symbol",detail:qo(n.error)}):r?s.jsxs(s.Fragment,{children:[s.jsx(rf,{node:r}),s.jsx(Sc,{title:"Callers",nodes:r.callers??[],kind:"caller"}),s.jsx(Sc,{title:"Callees",nodes:r.callees??[],kind:"callee"})]}):l})}function Vv({project:e,query:t}){return t.req?s.jsx(Uv,{id:t.req,project:e},"r:"+t.req):t.sym?s.jsx(Hv,{id:t.sym,project:e},"s:"+t.sym):s.jsx(G,{icon:"search",title:"Search a requirement or a symbol"})}const Kv=[{kind:"code",label:"Code"},{kind:"spec",label:"Spec"},{kind:"test",label:"Test"},{kind:"route",label:"Route"}],Qv=[{key:"calls",label:"calls"},{key:"implements",label:"implements"},{key:"tests",label:"tests"},{key:"synth",label:"synth"}];function Gv({project:e,query:t}){const n=H(()=>D.graphFull(e),[e]),r=t.focus??null,[l,i]=C.useState(r),[o,a]=C.useState("hierarchical"),[c,u]=C.useState(new Set),[h,m]=C.useState(new Set),[v,y]=C.useState(0);C.useEffect(()=>{r&&i(r)},[r]);const x=C.useMemo(()=>[...n.data?.nodes??[]].sort((k,N)=>N.degree-k.degree),[n.data]),g=C.useMemo(()=>(n.data?.edges??[]).map(k=>({from:k.from,to:k.to,kind:k.provenance==="heuristic"?"synth":k.kind})),[n.data]),b=C.useMemo(()=>o==="force"?Dm(x,g):Om(x,g),[x,g,o]),f=C.useMemo(()=>{const k={};return b.forEach(N=>{k[N.kind]=(k[N.kind]??0)+1}),k},[b]),d=C.useMemo(()=>{const k=new Set;return c.size&&b.forEach(N=>{c.has(N.kind)&&k.add(N.id)}),k},[b,c]),p=(k,N,E)=>{const T=new Set(k);T.has(N)?T.delete(N):T.add(N),E(T)};if(Qe(n.error))return s.jsx(G,{icon:"folder",title:"No project selected",body:"Pick an indexed project from the switcher in the status strip."});const j=!!(t.req||t.sym);return s.jsxs("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column"},children:[s.jsx(Fv,{project:e}),j?s.jsx(Vv,{project:e,query:t}):s.jsxs("div",{style:{flex:1,minHeight:0,display:"flex"},children:[s.jsxs("div",{className:"col",style:{flex:1,minWidth:0,display:"flex",flexDirection:"column"},children:[s.jsxs("div",{className:"row",style:{gap:10,padding:"9px 14px",borderBottom:"1px solid var(--border-subtle)",background:"var(--bg-panel-2)",flexWrap:"wrap"},children:[s.jsx(wt,{size:"sm",value:o,onChange:k=>{a(k),y(N=>N+1)},options:[{value:"hierarchical",label:"Hierarchical"},{value:"force",label:"Force"}],label:"Graph layout"}),s.jsx("div",{style:{width:1,height:20,background:"var(--border-subtle)"}}),Kv.filter(k=>f[k.kind]).map(k=>s.jsx(Ui,{label:k.label,count:f[k.kind],color:ut(k.kind),active:!c.has(k.kind),onClick:()=>p(c,k.kind,u)},k.kind)),s.jsx("div",{style:{width:1,height:20,background:"var(--border-subtle)"}}),Qv.map(k=>s.jsx(Ui,{label:k.label,active:!h.has(k.key),onClick:()=>p(h,k.key,m)},k.key)),s.jsx("div",{className:"grow"}),s.jsxs(Ie,{variant:"outline",size:"sm",onClick:()=>y(k=>k+1),children:[s.jsx(R,{name:"recenter",size:13}),"Recenter"]})]}),s.jsxs("div",{style:{flex:1,minHeight:0,position:"relative"},children:[b.length>0&&s.jsx(Yd,{nodes:b,edges:g,selectedId:l,onSelect:i,hiddenIds:d,hiddenEdgeKinds:h,fitKey:v,focusId:r}),n.data&&!b.length&&s.jsx(G,{icon:"graph",title:"Nothing indexed yet",body:"Run specship index to populate the graph."})]})]}),s.jsx("div",{"data-testid":"graph-rail",style:{width:360,flexShrink:0,borderLeft:"1px solid var(--border-subtle)",background:"var(--bg-panel)",minHeight:0},children:l?s.jsx(uv,{id:l,project:e,onSelect:i,onClose:()=>i(null)}):s.jsx(cv,{project:e,counts:f,shown:n.data?.shown??0,onSelect:i})})]})]})}function Yv({title:e,req:t}){return s.jsx(G,{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 of="specship-plan-level";function Xv(){try{const e=localStorage.getItem(of);if(e==="epics"||e==="stories"||e==="all")return e}catch{}return"all"}function qv(e){try{localStorage.setItem(of,e)}catch{}}const af="specship-density";function cf(){try{if(localStorage.getItem(af)==="compact")return"compact"}catch{}return"comfortable"}function uf(e){document.documentElement.setAttribute("data-density",e);try{localStorage.setItem(af,e)}catch{}window.dispatchEvent(new Event("specship-density"))}const df=[{value:"epics",label:"Epics only"},{value:"stories",label:"Epics + stories"},{value:"all",label:"Everything"}],Zv=e=>df.some(t=>t.value===e);function Jv(e,t){return e.coverage?Qd(e.coverage,t).group:"pending"}function eg(e,t){const n=t.trim().toLowerCase();if(!n)return e;const r=i=>(i??"").toLowerCase().includes(n),l=[];for(const i of e){if(r(i.title)||r(i.key)){l.push(i);continue}const o=i.docs.map(a=>({...a,stories:a.stories.flatMap(c=>{if(r(c.title)||r(c.specId))return[c];const u=c.tasks.filter(h=>r(h.title)||r(h.specId));return u.length?[{...c,tasks:u}]:[]})})).filter(a=>a.stories.length>0);o.length&&l.push({...i,docs:o})}return l}function ff(e){return"/review/"+encodeURIComponent(e)}function pf(e,t){e.metaKey||e.ctrlKey||e.shiftKey||e.button!==0||(e.preventDefault(),Q("review",{param:t}))}function tg(e){return e instanceof Error?e.message:String(e)}function ng({project:e}){const t=H(()=>D.specPlan(e),[e]),[n,r]=C.useState(()=>Xv()),[l,i]=C.useState(""),o=u=>{Zv(u)&&(r(u),qv(u))},a=C.useMemo(()=>eg(t.data?.epics??[],l),[t.data,l]);if(Qe(t.error))return s.jsx(G,{icon:"folder",title:"No project selected",body:"Pick an indexed project from the switcher in the status strip."});if(t.error)return s.jsx(Qn,{title:"Couldn’t load the plan",detail:tg(t.error),action:s.jsx(Ie,{variant:"primary",size:"sm",onClick:()=>t.reload(),children:"Retry"})});if(!t.data)return s.jsx(G,{icon:"refresh",title:"Loading the plan…"});const c=t.data.epics.reduce((u,h)=>u+h.docs.reduce((m,v)=>m+v.stories.length,0),0);return!t.data.epics.length||!c?s.jsx(G,{icon:"book",title:"No plan yet",body:"Author a spec under specs/ — its requirements show here once it is indexed."}):s.jsxs("div",{className:"scroll-y",style:{flex:1,minHeight:0},children:[s.jsx("div",{style:{padding:"var(--space-lg) var(--space-lg) 0"},children:s.jsx(Vt,{icon:"book",title:"Plan",sub:`${t.data.epics.length} epics · ${c} stories`,actions:s.jsxs("div",{className:"row gap-8",children:[s.jsx(wt,{options:df,value:n,onChange:o,size:"sm",label:"Plan depth"}),s.jsx("input",{className:"input",type:"search","aria-label":"Filter the plan",placeholder:"Filter epics, stories, tasks…",value:l,onChange:u=>i(u.target.value)})]})})}),a.length===0?s.jsx(G,{icon:"search",title:"Nothing matches the filter"}):s.jsx(rg,{plan:t.data,epics:a,level:n})]})}function rg({plan:e,epics:t,level:n}){return s.jsx("article",{className:"plan-reader","data-testid":"plan-reader","data-level":n,children:t.map(r=>s.jsx(sg,{epic:r,plan:e,level:n},(r.key??"")+r.title))})}function sg({epic:e,plan:t,level:n}){const r=e.docs.reduce((l,i)=>l+i.stories.length,0);return s.jsxs("section",{"data-plan-epic":e.key??e.title,children:[s.jsxs("h2",{children:[s.jsx(Zs,{text:e.title}),e.key&&s.jsxs(s.Fragment,{children:[" ",s.jsx(hf,{jiraKey:e.key,baseUrl:t.jiraBaseUrl})]})]}),n==="epics"?s.jsxs("p",{className:"muted",children:[r," ",r===1?"story":"stories"]}):e.docs.map(l=>s.jsxs("div",{"data-plan-doc":l.id,children:[e.docs.length>1&&s.jsx("p",{className:"eyebrow",children:s.jsx(Zs,{text:l.title})}),l.stories.map(i=>s.jsx(lg,{story:i,plan:t,showTasks:n==="all"},i.specId))]},l.id))]})}function lg({story:e,plan:t,showTasks:n}){const r=Jv(e,t.driftLinks);return s.jsxs("section",{"data-plan-story":e.specId,"data-status":r,children:[s.jsx("h3",{children:s.jsx("a",{href:ff(e.specId),onClick:l=>pf(l,e.specId),children:s.jsx(Zs,{text:e.title})})}),s.jsxs("p",{className:"row gap-6",style:{flexWrap:"wrap",fontSize:"var(--fs-sm)"},children:[s.jsx(ye,{state:r}),s.jsx("span",{className:"mono muted",children:e.specId}),e.jiraKey&&s.jsx(hf,{jiraKey:e.jiraKey,baseUrl:t.jiraBaseUrl})]}),n&&s.jsxs(s.Fragment,{children:[Zd(e.body).map((l,i)=>s.jsx("p",{className:"sp-prose",style:{whiteSpace:"pre-line"},dangerouslySetInnerHTML:{__html:rn(l)}},i)),e.tasks.length>0&&s.jsx("ul",{"aria-label":"Tasks of "+e.specId,children:e.tasks.map(l=>s.jsx(og,{task:l},l.specId))})]})]})}const ig={untested:{},tested:{color:"var(--info)",bg:"var(--info-soft)"},verified:{color:"var(--accent)",bg:"var(--accent-soft)"},broken:{color:"var(--danger)",bg:"var(--danger-soft)"}};function og({task:e}){const t=ig[e.verdict]??{};return s.jsxs("li",{"data-plan-task":e.specId,"data-verdict":e.verdict,children:[s.jsx("a",{href:ff(e.specId),onClick:n=>pf(n,e.specId),children:s.jsx(Zs,{text:e.title})})," ",s.jsx(fe,{color:t.color,bg:t.bg,children:e.verdict})]})}function Zs({text:e}){const t=String(e??"").split(/`([^`]+)`/);return s.jsx(s.Fragment,{children:t.map((n,r)=>r%2===1?s.jsx("code",{className:"sp-code",children:n},r):n)})}function hf({jiraKey:e,baseUrl:t}){return t?s.jsx("a",{className:"mono","data-jira-key":e,href:`${t}/browse/${encodeURIComponent(e)}`,target:"_blank",rel:"noreferrer noopener",children:e}):s.jsx("span",{className:"mono","data-jira-key":e,children:e})}const sr={drifted:"Drifted",pending:"Pending",completed:"Completed"},ag=500,Vl=e=>e==="all"||In.includes(e??""),Yi="var(--control-border-w) solid var(--border-subtle)",Nc={overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function bc(e,t){const n="/review"+(e?"/"+e:"")+(t!=="all"?"?group="+t:"");n!==location.pathname+location.search&&history.replaceState(history.state,"",n)}function cg(e){return e instanceof Error?e.message:String(e)}function ug({project:e,param:t,query:n}){const r=H(()=>D.specCoverage(null,e),[e]),l=H(()=>D.drift(e,{states:Br,limit:ag}),[e]),[i,o]=C.useState(Vl(n.group)?n.group:"all");C.useEffect(()=>{Vl(n.group)&&o(n.group)},[n.group]);const[a,c]=C.useState(t??n.sel??null);C.useEffect(()=>{const f=t??n.sel;f&&c(f)},[t,n.sel]);const u=C.useRef(new Map).current,h=C.useMemo(()=>Gd(r.data?.requirements??[],l.data?.links??[]),[r.data,l.data]),m=f=>{Vl(f)&&(o(f),bc(a,f))},v=f=>{c(f),bc(f,i)};if(Qe(r.error)||Qe(l.error))return s.jsx(G,{icon:"folder",title:"No project selected",body:"Pick an indexed project from the switcher in the status strip."});const y=r.error??l.error;if(y)return s.jsx(Qn,{title:"Couldn’t load the review queue",detail:(r.error?"Spec coverage: ":"Spec links: ")+cg(y),action:s.jsx(Ie,{variant:"primary",size:"sm",onClick:()=>{r.reload(),l.reload()},children:"Retry"})});if(!r.data||!l.data)return s.jsx(G,{icon:"refresh",title:"Loading the review queue…"});const x=In.reduce((f,d)=>f+h[d].length,0);if(!x)return s.jsx(G,{icon:"book",title:"No requirements yet",body:"Author a spec under specs/ — requirements show here once it is indexed."});const g=i==="all"?In:[i],b=[{value:"all",label:`All (${x})`},...In.map(f=>({value:f,label:`${sr[f]} (${h[f].length})`}))];return s.jsxs("div",{className:"row",style:{flex:1,minHeight:0,alignItems:"stretch"},children:[s.jsxs("div",{className:"col grow",style:{minWidth:0,borderRight:Yi},children:[s.jsxs("div",{style:{padding:"var(--space-lg) var(--space-lg) 0"},children:[s.jsx(Vt,{icon:"drift",title:"Review",sub:`${x} requirements · ${h.drifted.length} drifted · ${h.pending.length} pending · ${h.completed.length} completed`}),s.jsx("div",{style:{paddingBottom:"var(--space-md)"},children:s.jsx(wt,{options:b,value:i,onChange:m,size:"sm",label:"Review group"})})]}),s.jsx("div",{className:"scroll-y",style:{flex:1,borderTop:Yi},children:g.map(f=>s.jsxs("section",{"data-testid":"review-group-"+f,"aria-label":sr[f],children:[s.jsxs("div",{className:"eyebrow row gap-6",style:{padding:"var(--space-md) var(--space-lg) var(--space-xs)"},children:[sr[f],s.jsx("span",{className:"tabular",children:h[f].length})]}),h[f].length===0?s.jsxs("div",{className:"muted",style:{padding:"var(--space-xs) var(--space-lg) var(--space-md)",fontSize:"var(--fs-sm)"},children:["Nothing ",sr[f].toLowerCase(),"."]}):s.jsx("div",{role:"listbox","aria-label":sr[f]+" requirements",children:h[f].map(d=>s.jsx(dg,{row:d,active:a===d.specId,onOpen:v},d.specId))})]},f))})]}),s.jsx("div",{className:"col grow",style:{minWidth:0},children:s.jsx(kv,{id:a,project:e,cache:u},a??"")})]})}function dg({row:e,active:t,onOpen:n}){const r=l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),n(e.specId))};return s.jsxs("div",{role:"option","aria-selected":t,tabIndex:0,"data-review-row":e.specId,"data-group":e.group,className:"list-row"+(t?" selected":""),onClick:()=>n(e.specId),onKeyDown:r,style:{padding:"var(--space-sm) var(--space-lg)",borderBottom:Yi,cursor:"pointer"},children:[s.jsxs("div",{className:"row gap-8",style:{minWidth:0},children:[s.jsx(ye,{state:e.group}),s.jsx("span",{className:"mono",style:{...Nc,fontSize:"var(--fs-sm)",color:"var(--node-spec)"},children:e.specId}),s.jsx("span",{className:"secondary grow",style:{...Nc,fontSize:"var(--fs-sm)"},children:e.title}),e.tag&&s.jsx(fe,{children:e.tag})]}),e.driftReasons.length>0&&s.jsx("div",{className:"col gap-4","data-testid":"drift-reasons",style:{paddingTop:"var(--space-xs)"},children:e.driftReasons.map((l,i)=>s.jsxs("div",{className:"row gap-6",style:{flexWrap:"wrap",fontSize:"var(--fs-xs)"},children:[s.jsx(ye,{state:l.state}),s.jsx("span",{className:"mono","data-testid":"drift-target",children:l.target}),s.jsxs(fe,{children:[l.changed," changed"]}),s.jsx("span",{className:"muted",children:"fix:"}),s.jsx("code",{className:"mono","data-testid":"drift-fix",children:l.fix})]},i))})]})}const fg=new Set(["completed","failed","cancelled","rejected"]);function Xi(e){return e.stepId??(typeof e.data?.stepId=="string"?e.data.stepId:void 0)}function pg(e){const t=new Set(e.map(a=>a.id)),n=new Map(e.map(a=>[a.id,(a.depends_on??[]).filter(c=>t.has(c)).length])),r=new Map;for(const a of e)for(const c of a.depends_on??[])t.has(c)&&r.set(c,[...r.get(c)??[],a.id]);const l=new Map(e.map(a=>[a.id,a])),i=e.filter(a=>n.get(a.id)===0).map(a=>a.id),o=[];for(;i.length;){const a=i.shift();o.push(l.get(a));for(const c of r.get(a)??[]){const u=n.get(c)-1;n.set(c,u),u===0&&i.push(c)}}return o.length===e.length?o:e}function hg(e,t,n){const r=t?.metadata?.nodeStates??{},l=new Map,i=[],o=new Set,a=(m,v)=>{o.has(m)||(o.add(m),i.push(m)),v&&!l.get(m)&&l.set(m,v)};if(e?.length)for(const m of pg(e))a(m.id,m.kind);else{for(const m of Object.keys(r))a(m);for(const m of n){const v=Xi(m);v&&a(v,typeof m.data?.stepKind=="string"?m.data.stepKind:void 0)}}const c=new Map(i.map(m=>[m,r[m]??"pending"])),u=new Map;for(const m of n){const v=Xi(m);if(!(!v||!o.has(v))&&(m.eventType==="step_started"?c.set(v,"running"):m.eventType==="step_completed"?c.set(v,"completed"):m.eventType==="step_failed"?c.set(v,"failed"):m.eventType==="step_skipped"&&c.set(v,"skipped"),m.eventType==="step_completed")){const y=m.data?.stats;typeof y?.costUsd=="number"&&u.set(v,y.costUsd)}}const h=t?.metadata?.approval;return t?.status==="paused"&&h?.nodeId&&c.get(h.nodeId)!=="completed"&&c.set(h.nodeId,"paused"),i.map(m=>({id:m,kind:l.get(m)??"prompt",state:c.get(m)??"pending",costUsd:u.get(m)}))}function mg(e){let t=null,n=null;for(const r of e){if(r.eventType!=="step_completed")continue;const l=r.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 mf(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 ml(e){return typeof e=="number"?"$"+e.toFixed(2):"—"}const vg={pending:"var(--text-muted)",running:"var(--info)",completed:"var(--success)",failed:"var(--error)",paused:"var(--warn)",skipped:"var(--text-muted)"};function gg({nodes:e}){return s.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 r=vg[t.state]??"var(--text-muted)";return s.jsxs("div",{className:"row",style:{gap:6,alignItems:"center"},children:[n>0&&s.jsx(R,{name:"arrowRight",size:12,style:{color:"var(--text-muted)",flexShrink:0}}),s.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)":r}`,opacity:t.state==="pending"?.65:1},children:[s.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 ${r}`,animation:t.state==="running"?"spin 1.4s linear infinite":"none",borderTopColor:t.state==="running"?"transparent":void 0},children:[t.state==="completed"&&s.jsx(R,{name:"check",size:10,style:{color:"var(--on-accent)"}}),t.state==="failed"&&s.jsx(R,{name:"x",size:10,style:{color:"var(--on-accent)"}}),t.state==="paused"&&s.jsx(R,{name:"pause",size:9,style:{color:"var(--on-accent)"}})]}),s.jsxs("div",{style:{minWidth:0},children:[s.jsx("div",{style:{fontSize:12,fontWeight:500,whiteSpace:"nowrap"},children:t.id}),s.jsxs("div",{className:"mono muted",style:{fontSize:9},children:[t.kind,t.costUsd!==void 0&&s.jsxs("span",{className:"tabular",children:[" · ",ml(t.costUsd)]})]})]})]})]},t.id)})})}const vf={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 xg(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"?ml(n.costUsd):""}return""}function yg(e){const t=new Date(e);return Number.isNaN(t.getTime())?"":t.toLocaleTimeString()}function wg({events:e,live:t}){const n=C.useRef(null),[r,l]=C.useState(!0);return C.useEffect(()=>{r&&n.current&&(n.current.scrollTop=n.current.scrollHeight)},[e.length,r]),s.jsxs("div",{ref:n,className:"scroll-y","aria-live":"polite",onScroll:i=>{const o=i.currentTarget;l(o.scrollHeight-o.scrollTop-o.clientHeight<30)},style:{flex:1,padding:"8px 14px",fontFamily:"var(--font-mono)",fontSize:11.5},children:[e.map(i=>s.jsxs("div",{className:"row gap-10",style:{padding:"4px 0",borderBottom:"1px solid var(--border-subtle)"},children:[s.jsx("span",{className:"muted tabular",style:{flexShrink:0,width:70},children:yg(i.createdAt)}),s.jsx("span",{style:{color:vf[i.eventType]??"var(--text-secondary)",width:140,flexShrink:0},children:i.eventType}),s.jsx("span",{className:"muted",style:{flexShrink:0,width:90,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Xi(i)??""}),s.jsx("span",{className:"secondary",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:xg(i)})]},i.id)),!e.length&&s.jsx("div",{className:"muted",style:{padding:"8px 0"},children:"No events yet."}),t&&s.jsxs("div",{className:"row gap-6 muted",style:{padding:"6px 0"},children:[s.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:"var(--info)",animation:"skeleton 1s infinite"}}),"streaming…"]})]})}function jg({artifacts:e,loading:t}){const[n,r]=C.useState(0),l=e[Math.min(n,e.length-1)];return t?s.jsx("div",{className:"muted",style:{padding:16,fontSize:12},children:"Loading artifacts…"}):e.length?s.jsxs("div",{className:"row",style:{flex:1,minHeight:0},children:[s.jsx("div",{className:"scroll-y",style:{width:190,borderRight:"1px solid var(--border-subtle)",padding:8,flexShrink:0},children:e.map((i,o)=>s.jsxs("div",{role:"button",tabIndex:0,onClick:()=>r(o),onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),r(o))},className:"row gap-8 list-row",style:{padding:"7px 9px",borderRadius:6,cursor:"pointer",background:n===o?"var(--bg-hover)":"transparent"},children:[s.jsx(R,{name:"box",size:13,style:{color:"var(--node-route)",flexShrink:0}}),s.jsxs("div",{style:{minWidth:0},children:[s.jsx("div",{className:"mono",style:{fontSize:11.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i.name}),s.jsxs("div",{className:"muted",style:{fontSize:9.5},children:[i.nodeId,i.outputType?" · "+i.outputType:""]})]})]},i.name))}),s.jsx("div",{className:"scroll-y",style:{flex:1,padding:16},children:s.jsx("pre",{className:"mono",style:{margin:0,fontSize:12,lineHeight:1.65,color:"var(--text-secondary)",whiteSpace:"pre-wrap"},children:l?.body})})]}):s.jsx("div",{className:"muted",style:{padding:16,fontSize:12},children:"No artifacts — only completed nodes write output files."})}function kg({id:e,project:t}){const n=H(()=>D.run(e,t),[e,t]),r=H(()=>D.workflows(t),[t]),[l,i]=C.useState([]),[o,a]=C.useState("events"),[c,u]=C.useState(!1),[h,m]=C.useState(""),[v,y]=C.useState(!1),[x,g]=C.useState(null),b=n.data?.run??null,f=b?.status??"",d=!!b&&!fg.has(f),p=C.useMemo(()=>{const S=n.data?.events??[],z=new Set(S.map(L=>L.id));return[...S,...l.filter(L=>!z.has(L.id))]},[n.data,l]),j=n.data?.events.length?n.data.events[n.data.events.length-1].id:0,k=n.reload;C.useEffect(()=>{if(!d||typeof EventSource>"u")return;const S=new EventSource(Kh(e,j,t)),z=L=>{try{const I=JSON.parse(L.data);i($=>$.some(B=>B.id===I.id)?$:[...$,I])}catch{}};for(const L of Object.keys(vf))S.addEventListener(L,z);return S.addEventListener("done",()=>{S.close(),k()}),S.onerror=()=>{},()=>S.close()},[e,t,d,j,k]);const N=C.useMemo(()=>{const S=r.data?.workflows.find(z=>z.workflow.name===b?.workflowName)?.workflow;return hg(S?.nodes,b,p)},[r.data,b,p]),E=C.useMemo(()=>mg(p),[p]),T=typeof b?.startedAt=="number"?b.startedAt:null,A=typeof b?.completedAt=="number"?b.completedAt:typeof b?.lastActivityAt=="number"?b.lastActivityAt:null,P=T&&A?A-T:null,J=S=>{y(!0),g(null),S().then(()=>{y(!1),u(!1),i([]),n.reload()},z=>{y(!1),g(z instanceof Error?z.message:String(z))})},ce=()=>J(async()=>{await D.runAction(e,"approve",void 0,t),await D.runAction(e,"resume",void 0,t)}),je=()=>J(()=>D.runAction(e,"reject",h.trim()?{reason:h.trim()}:void 0,t)),Be=()=>J(()=>D.runAction(e,"cancel",void 0,t)),kt=()=>J(()=>D.runAction(e,"resume",void 0,t)),Xe=()=>J(()=>D.runAction(e,"purge",void 0,t)),ze=H(()=>o==="artifacts"?D.runArtifacts(e,t):Promise.resolve({artifacts:[]}),[e,t,o,f]),w=b?.metadata?.approval;return s.jsxs("div",{className:"col",style:{flex:1,minHeight:0},children:[s.jsxs("div",{className:"row gap-10",style:{padding:"12px 16px",borderBottom:"1px solid var(--border-subtle)",flexWrap:"wrap"},children:[s.jsxs("button",{className:"btn btn-ghost btn-sm",onClick:()=>Q("runs"),children:[s.jsx(R,{name:"chevronLeft",size:14}),"Runs"]}),s.jsx("span",{className:"mono",style:{fontWeight:600,fontSize:14},children:b?.workflowName??"…"}),s.jsx("span",{className:"mono muted",style:{fontSize:11.5},children:e}),b&&s.jsx(ye,{state:f}),s.jsx("span",{className:"grow"}),s.jsxs("span",{className:"mono muted tabular",style:{fontSize:11.5},title:"Duration",children:[s.jsx(R,{name:"clock",size:11,style:{verticalAlign:-1,marginRight:4}}),mf(P)]}),E.costUsd!==null&&s.jsx("span",{className:"mono tabular",style:{fontSize:11.5},title:"Run-total cost",children:ml(E.costUsd)}),E.model&&s.jsx("span",{className:"mono muted",style:{fontSize:11.5},title:"Model",children:E.model}),(f==="running"||f==="paused")&&s.jsxs("button",{className:"btn btn-destructive btn-sm",onClick:Be,disabled:v,children:[s.jsx(R,{name:"cancel",size:12}),"Cancel"]}),f==="completed"&&s.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:()=>a("artifacts"),children:[s.jsx(R,{name:"box",size:12}),"Inspect artifacts"]})]}),f==="failed"&&b?.errorMessage&&s.jsxs("div",{className:"row gap-12",style:{padding:"12px 16px",background:"var(--error-soft)",borderBottom:"1px solid var(--border-subtle)"},children:[s.jsx("span",{style:{color:"var(--error)",flexShrink:0},children:s.jsx(R,{name:"cancel",size:16})}),s.jsxs("div",{className:"grow",children:[s.jsx("div",{style:{fontWeight:600,fontSize:13,color:"var(--error)"},children:"Run failed"}),s.jsx("div",{className:"secondary mono",style:{fontSize:12,marginTop:1,whiteSpace:"pre-wrap"},children:b.errorMessage})]})]}),f==="rejected"&&s.jsxs("div",{className:"row gap-12",style:{padding:"12px 16px",background:"var(--warn-soft)",borderBottom:"1px solid var(--border-subtle)",flexWrap:"wrap"},children:[s.jsx("span",{style:{color:"var(--warn)",flexShrink:0},children:s.jsx(R,{name:"drift",size:18})}),s.jsxs("div",{className:"grow",style:{minWidth:220},children:[s.jsx("div",{style:{fontWeight:600,fontSize:13},children:"Rejected — parked with worktree and artifacts kept"}),s.jsx("div",{className:"secondary",style:{fontSize:12,marginTop:1},children:b?.errorMessage??"Rejected at the approval gate."})]}),s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>a("artifacts"),children:"Inspect artifacts"}),s.jsx("button",{className:"btn btn-destructive btn-sm",onClick:Xe,disabled:v,title:"Removes the worktree — the only destructive action. Artifacts and the run record are kept.",children:"Purge worktree"}),s.jsxs("button",{className:"btn btn-primary btn-sm",onClick:kt,disabled:v,title:"Runs the gate's on_reject revise prompt with your feedback, then re-pauses for review.",children:[s.jsx(R,{name:"circle",size:12}),"Resume & revise"]})]}),f==="paused"&&s.jsxs("div",{className:"row gap-12",style:{padding:"12px 16px",background:"var(--warn-soft)",borderBottom:"1px solid var(--border-subtle)",flexWrap:"wrap"},children:[s.jsx("span",{style:{color:"var(--warn)",flexShrink:0},children:s.jsx(R,{name:"pause",size:18})}),s.jsxs("div",{className:"grow",style:{minWidth:220},children:[s.jsx("div",{style:{fontWeight:600,fontSize:13},children:"Approval required"}),s.jsx("div",{className:"secondary",style:{fontSize:12,marginTop:1},children:w?.message??"The run paused at an approval gate."})]}),c?s.jsxs(s.Fragment,{children:[s.jsx("input",{className:"input",autoFocus:!0,placeholder:"Reason (optional)…","aria-label":"Rejection reason",value:h,onChange:S=>m(S.target.value),style:{width:200}}),s.jsx("button",{className:"btn btn-destructive btn-sm",onClick:je,disabled:v,children:"Confirm reject"}),s.jsx("button",{className:"btn btn-ghost btn-sm",onClick:()=>u(!1),children:"Back"})]}):s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>a("artifacts"),children:"Inspect artifacts"}),s.jsx("button",{className:"btn btn-destructive btn-sm",onClick:()=>u(!0),disabled:v,children:"Reject"}),s.jsxs("button",{className:"btn btn-primary btn-sm",onClick:ce,disabled:v,children:[s.jsx(R,{name:"check",size:13}),"Approve"]})]})]}),x&&s.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:[s.jsx(R,{name:"cancel",size:13,style:{flexShrink:0}}),s.jsx("span",{children:x})]}),N.length>0&&s.jsx(gg,{nodes:N}),s.jsxs("div",{className:"col",style:{flex:1,minHeight:0},children:[s.jsx("div",{className:"row gap-2",style:{padding:"8px 14px 0",borderBottom:"1px solid var(--border-subtle)"},children:["events","artifacts"].map(S=>s.jsxs("button",{onClick:()=>a(S),style:{padding:"7px 13px",border:"none",background:"transparent",cursor:"pointer",fontSize:12.5,fontWeight:500,textTransform:"capitalize",color:o===S?"var(--text-primary)":"var(--text-muted)",borderBottom:`2px solid ${o===S?"var(--accent)":"transparent"}`,marginBottom:-1},children:[S,S==="events"&&d&&s.jsx("span",{className:"pill",style:{marginLeft:6,fontSize:9,background:"var(--info-soft)",color:"var(--info)"},children:"live"})]},S))}),o==="events"&&s.jsx(wg,{events:p,live:d}),o==="artifacts"&&s.jsx(jg,{artifacts:ze.data?.artifacts??[],loading:ze.loading})]})]})}const Sg=["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 Ng(e){const t=cr(e.startedAt);if(!t)return"—";const n=cr(e.completedAt)??cr(e.finishedAt)??cr(e.lastActivityAt);return mf(n!==null?n-t:null)}function bg({project:e,param:t}){return t?s.jsx(kg,{id:t,project:e}):s.jsx(Cg,{project:e})}function Cg({project:e}){const t=H(()=>D.runs(e),[e]),[n,r]=C.useState(null);if(Qe(t.error))return s.jsx(G,{icon:"folder",title:"No project selected",body:"Pick an indexed project from the switcher in the status strip."});const l=t.data?.runs??[],i=n?l.filter(o=>o.status===n):l;return s.jsxs("div",{className:"col",style:{flex:1,minHeight:0},children:[s.jsx("div",{style:{padding:"16px 18px 0"},children:s.jsx(Vt,{icon:"play",title:"Runs",sub:t.data?`${l.length} workflow runs`:"Loading runs…",actions:s.jsxs(Ie,{variant:"primary",size:"sm",onClick:()=>Q("workflows"),children:[s.jsx(R,{name:"play",size:13}),"Launch run"]})})}),s.jsx("div",{className:"row gap-6",style:{padding:"0 18px 12px"},children:s.jsx(wt,{size:"sm",label:"Run status filter",value:n??"all",onChange:o=>r(o==="all"?null:o),options:[{value:"all",label:"All"},...Sg.map(o=>({value:o,label:o[0].toUpperCase()+o.slice(1)}))]})}),t.data&&!l.length?s.jsx(G,{icon:"play",title:"No runs yet",body:"Workflow runs started from the CLI or dashboard land here.",action:s.jsx(Ie,{variant:"outline",size:"sm",onClick:()=>Q("workflows"),children:"Browse workflows"})}):s.jsx("div",{className:"scroll-y",style:{padding:"0 18px 18px"},children:s.jsxs("div",{className:"card",style:{overflow:"hidden"},children:[s.jsxs("div",{className:"row",style:{padding:"8px 14px",fontSize:10.5,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.05em",fontWeight:600},children:[s.jsx("span",{style:{width:100},children:"Status"}),s.jsx("span",{className:"grow",children:"Workflow"}),s.jsx("span",{style:{width:90},children:"Duration"}),s.jsx("span",{style:{width:130},children:"Model"}),s.jsx("span",{style:{width:70,textAlign:"right"},children:"Cost"}),s.jsx("span",{style:{width:60,textAlign:"right"},children:"When"})]}),i.map(o=>s.jsxs("div",{role:"button",tabIndex:0,className:"row list-row",onClick:()=>Q("runs",{param:o.id}),onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),Q("runs",{param:o.id}))},style:{padding:"11px 14px",borderTop:"1px solid var(--border-subtle)",cursor:"pointer"},children:[s.jsx("span",{style:{width:100,flexShrink:0},children:s.jsx(ye,{state:o.status})}),s.jsxs("div",{className:"grow row gap-8",style:{minWidth:0},children:[s.jsx("span",{className:"mono",style:{fontSize:12.5},children:String(o.workflowName??o.workflowId??"—")}),s.jsx("span",{className:"mono muted",style:{fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o.id})]}),s.jsx("span",{className:"mono tabular muted",style:{width:90,flexShrink:0,fontSize:11.5},children:Ng(o)}),s.jsx("span",{className:"mono muted",style:{width:130,flexShrink:0,fontSize:10.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o.model??"—"}),s.jsx("span",{className:"mono tabular",style:{width:70,flexShrink:0,textAlign:"right",fontSize:12},children:ml(o.totalCostUsd)}),s.jsx("span",{className:"mono muted tabular",style:{width:60,flexShrink:0,textAlign:"right",fontSize:11},children:Un(cr(o.startedAt)??void 0)??"—"})]},o.id)),t.data&&!i.length&&s.jsx("div",{className:"muted",style:{padding:"14px",fontSize:12,borderTop:"1px solid var(--border-subtle)"},children:"No runs match this filter."})]})})]})}function Kl({icon:e,title:t,children:n}){return s.jsxs("div",{className:"card card-pad",style:{marginBottom:14},children:[s.jsxs("div",{className:"row gap-8",style:{marginBottom:12},children:[s.jsx(R,{name:e,size:15,style:{color:"var(--text-secondary)"}}),s.jsx("div",{style:{fontSize:13,fontWeight:600},children:t})]}),n]})}function Eg({label:e,hint:t,children:n}){return s.jsxs("div",{style:{padding:"8px 0"},children:[s.jsxs("div",{className:"row",style:{justifyContent:"space-between",alignItems:"baseline",marginBottom:6},children:[s.jsx("div",{style:{fontSize:12.5,fontWeight:500},children:e}),t&&s.jsx("div",{className:"muted",style:{fontSize:11},children:t})]}),n]})}function mn({label:e,value:t,color:n}){return s.jsxs("div",{className:"row",style:{justifyContent:"space-between",padding:"6px 0",fontSize:12.5},children:[s.jsx("span",{className:"muted",children:e}),s.jsx("span",{className:"mono",style:{color:n??"var(--text-primary)"},children:t})]})}function zg(e){const[t,n]=C.useState(cf),r=H(()=>D.status(e.project),[e.project]),l=i=>{const o=i;n(o),uf(o)};return s.jsxs("div",{className:"scroll-y",style:{flex:1,padding:22},children:[s.jsx(Vt,{icon:"settings",title:"Settings"}),s.jsxs("div",{style:{maxWidth:640},children:[s.jsx(Kl,{icon:"sparkles",title:"Appearance",children:s.jsx(Eg,{label:"Density",hint:"Row height & padding",children:s.jsx(wt,{value:t,onChange:l,options:[{value:"comfortable",label:"Comfortable"},{value:"compact",label:"Compact"}]})})}),s.jsx(Kl,{icon:"database",title:"Backend",children:s.jsx(yr,{state:r,label:"Backend",minHeight:120,children:i=>s.jsxs(s.Fragment,{children:[s.jsx(mn,{label:"Database backend",value:i.backend}),s.jsx(mn,{label:"Journal mode",value:i.journalMode}),s.jsx(mn,{label:"Project root",value:s.jsx("span",{title:i.projectPath,children:i.projectPath})}),s.jsx(mn,{label:"Indexed files",value:i.fileCount.toLocaleString()})]})})}),s.jsx(Kl,{icon:"graph",title:"About",children:s.jsx(yr,{state:r,label:"About",minHeight:90,children:i=>s.jsxs(s.Fragment,{children:[s.jsx(mn,{label:"Version",value:`v${i.version}`}),s.jsx(mn,{label:"Backend",value:i.backend,color:"var(--success)"})]})})})]})]})}const Cc={untested:{label:"Untested",color:"var(--warn)",bg:"var(--warn-soft)"},tested:{label:"Tested",color:"var(--info)",bg:"var(--info-soft)"},verified:{label:"Verified",color:"var(--success)",bg:"var(--success-soft)"},broken:{label:"Broken",color:"var(--error)",bg:"var(--error-soft)"}},Mg=["untested","tested","verified","broken"],Ec={broken:0,untested:1,tested:2,verified:3};function Rg(e,t,n,r,l){const i=e.map(c=>({specId:c.specId,title:c.title,doc:t.get(c.specId)??"—",code:c.implementsLinks.count,tests:c.testsLinks.count,criteriaWithTests:c.criteriaWithTests,criteriaCount:c.criteriaCount,verdict:c.verdict,driftAt:n.get(c.specId)??null})),o=l?1:-1,a={spec:(c,u)=>c.specId.localeCompare(u.specId),doc:(c,u)=>c.doc.localeCompare(u.doc)||c.specId.localeCompare(u.specId),code:(c,u)=>c.code-u.code,tests:(c,u)=>c.tests-u.tests,criteria:(c,u)=>(c.criteriaCount?c.criteriaWithTests/c.criteriaCount:0)-(u.criteriaCount?u.criteriaWithTests/u.criteriaCount:0),state:(c,u)=>Ec[c.verdict]-Ec[u.verdict],drift:(c,u)=>(c.driftAt??1/0)-(u.driftAt??1/0)};return i.sort((c,u)=>a[r](c,u)*o||c.specId.localeCompare(u.specId))}function Tg({project:e}){const t=H(()=>D.specCoverage(null,e),[e]),n=H(()=>D.specs(e),[e]),r=H(()=>D.drift(e),[e]),[l,i]=C.useState("spec"),[o,a]=C.useState(!0),[c,u]=C.useState(""),[h,m]=C.useState(""),v=C.useMemo(()=>{const p=n.data?.specs??[],j=new Map(p.map(N=>[N.id,N])),k=new Map;for(const N of p){if(N.kind!=="requirement")continue;const E=N.parentId?j.get(N.parentId):void 0;k.set(N.id,(E?.sourcePath??N.sourcePath??"—").replace(/^specs\//,""))}return k},[n.data]),y=C.useMemo(()=>{const p=new Map;for(const j of r.data?.links??[])j.updatedAt&&p.set(j.specId,Math.max(p.get(j.specId)??0,j.updatedAt));return p},[r.data]),x=C.useMemo(()=>Rg(t.data?.requirements??[],v,y,l,o),[t.data,v,y,l,o]),g=C.useMemo(()=>[...new Set(x.map(p=>p.doc))].sort(),[x]),b=x.filter(p=>(!c||p.doc===c)&&(!h||p.verdict===h));if(Qe(t.error))return s.jsx(G,{icon:"folder",title:"No project selected",body:"Pick an indexed project from the switcher in the status strip."});if(t.error)return s.jsx(G,{icon:"drift",title:"Coverage endpoint unavailable",body:"This view is backed by GET /api/spec/coverage, which this server didn’t answer. Update SpecShip and reload — the matrix will not guess at coverage from link states.",action:s.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:t.reload,children:[s.jsx(R,{name:"refresh",size:13}),"Retry"]})});const f=t.data?.totals,d=(p,j,k,N)=>s.jsxs("button",{onClick:()=>{l===p?a(!o):(i(p),a(!0))},className:"row gap-4 eyebrow","aria-label":"Sort by "+j,style:{background:"none",border:"none",cursor:"pointer",padding:0,width:k,flex:k?void 0:1,justifyContent:N?"flex-end":"flex-start",color:l===p?"var(--accent)":void 0},children:[j,l===p&&s.jsx(R,{name:o?"chevronDown":"chevronRight",size:10})]});return s.jsxs("div",{className:"col",style:{flex:1,minHeight:0},children:[s.jsx("div",{style:{padding:"16px 18px 0"},children:s.jsx(Vt,{icon:"matrix",title:"Traceability",sub:t.data?`${x.length} requirements · ${f?.criteriaWithTests??0} of ${f?.criteria??0} criteria have a proving test`:"Loading coverage…"})}),s.jsxs("div",{className:"row gap-8",style:{padding:"0 18px 12px",flexWrap:"wrap"},children:[s.jsx(R,{name:"filter",size:13,style:{color:"var(--text-muted)"}}),s.jsxs("select",{className:"input","aria-label":"Filter by document",value:c,onChange:p=>u(p.target.value),style:{height:26,fontSize:11.5},children:[s.jsx("option",{value:"",children:"All documents"}),g.map(p=>s.jsx("option",{value:p,children:p},p))]}),s.jsxs("select",{className:"input","aria-label":"Filter by state",value:h,onChange:p=>m(p.target.value),style:{height:26,fontSize:11.5},children:[s.jsx("option",{value:"",children:"All states"}),Mg.map(p=>s.jsx("option",{value:p,children:Cc[p].label},p))]}),s.jsxs("span",{className:"muted tabular",style:{fontSize:11},children:[b.length," shown"]})]}),s.jsxs("div",{className:"row gap-10",style:{padding:"6px 18px",borderTop:"1px solid var(--border-subtle)",borderBottom:"1px solid var(--border-subtle)"},children:[d("spec","Requirement",190),d("doc","Document",150),d("code","Code",54,!0),d("tests","Tests",54,!0),d("criteria","Criteria",74,!0),d("state","State",96),d("drift","Drift age",70,!0)]}),t.data&&!x.length?s.jsx(G,{icon:"book",title:"No requirements indexed",body:"Author a spec under specs/ and run a sync — the matrix fills from the coverage rollup."}):s.jsxs("div",{className:"scroll-y",style:{flex:1},role:"table","aria-label":"Traceability matrix",children:[b.map(p=>{const j=Cc[p.verdict],k=Un(p.driftAt??void 0);return s.jsxs("div",{role:"row",tabIndex:0,className:"row gap-10 list-row",onClick:()=>Q("specs",{query:{sel:p.specId}}),onKeyDown:N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),Q("specs",{query:{sel:p.specId}}))},style:{padding:"9px 18px",cursor:"pointer",borderBottom:"1px solid var(--border-subtle)"},children:[s.jsxs("div",{style:{width:190,flexShrink:0,minWidth:0},children:[s.jsx("div",{className:"mono",style:{fontSize:11.5,color:"var(--node-spec)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:p.specId}),s.jsx("div",{className:"muted",style:{fontSize:10.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:p.title})]}),s.jsx("span",{className:"mono muted",style:{width:150,flexShrink:0,fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:p.doc}),s.jsx("span",{className:"mono tabular",title:p.code+" code link(s)",style:{width:54,flexShrink:0,textAlign:"right",fontSize:12,color:p.code?"var(--node-spec)":"var(--text-faint)"},children:p.code}),s.jsx("span",{className:"mono tabular",title:p.tests+" proving test link(s)",style:{width:54,flexShrink:0,textAlign:"right",fontSize:12,color:p.tests?"var(--success)":"var(--warn)"},children:p.tests}),s.jsx("span",{className:"mono tabular muted",title:"Acceptance criteria with a proving test",style:{width:74,flexShrink:0,textAlign:"right",fontSize:12},children:p.criteriaWithTests+" / "+p.criteriaCount}),s.jsx("span",{style:{width:96,flexShrink:0},children:s.jsx(fe,{color:j.color,bg:j.bg,dot:!0,children:j.label})}),s.jsx("span",{className:"mono tabular",title:k?"Oldest unhealthy link, last changed":"No drifted, broken, or orphaned link",style:{width:70,flexShrink:0,textAlign:"right",fontSize:11,color:k?Ne.drifted.color:"var(--text-faint)"},children:k??"—"})]},p.specId)}),t.data&&x.length>0&&!b.length&&s.jsx("div",{className:"muted",style:{padding:"18px",textAlign:"center",fontSize:12.5},children:"No requirement matches these filters."})]})]})}const _g={bundled:"var(--node-spec)",global:"var(--node-code)",project:"var(--node-route)"};function Lg({project:e,query:t}){const n=H(()=>D.workflows(e),[e]),r=n.data?.workflows??[],[l,i]=C.useState(t.run??null);if(Qe(n.error))return s.jsx(G,{icon:"folder",title:"No project selected",body:"Pick an indexed project from the switcher in the status strip."});const o=l?r.find(a=>a.workflow.name===l):void 0;return s.jsxs("div",{className:"scroll-y",style:{flex:1,padding:18},children:[s.jsx(Vt,{icon:"workflow",title:"Workflows",sub:n.data?"Run a YAML-defined DAG of agent, shell and approval steps":"Loading workflows…"}),n.data&&!r.length&&s.jsx(G,{icon:"workflow",title:"No workflows found",body:"Add YAML definitions under .specship/workflows/ in this project or your home directory."}),s.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(340px, 1fr))",gap:12},children:r.map(({workflow:a,scope:c})=>{const u=_g[c]??"var(--text-secondary)";return s.jsxs("div",{className:"card card-pad",style:{display:"flex",flexDirection:"column",gap:10},children:[s.jsxs("div",{className:"row gap-8",children:[s.jsx("span",{className:"mono",style:{fontSize:13.5,fontWeight:600},children:a.name}),s.jsx(fe,{color:u,bg:`color-mix(in srgb, ${u} 14%, transparent)`,children:c}),s.jsx("span",{className:"grow"}),s.jsxs("span",{className:"mono muted tabular",style:{fontSize:10.5},children:[a.nodes.length," nodes"]})]}),s.jsx("div",{className:"secondary",style:{fontSize:12.5,lineHeight:1.5,minHeight:36},children:a.description||"No description."}),s.jsxs("div",{className:"row gap-6",style:{flexWrap:"wrap",borderTop:"1px solid var(--border-subtle)",paddingTop:10},children:[(a.requires??[]).length>0&&s.jsx("span",{className:"muted",style:{fontSize:10.5},children:"requires"}),(a.requires??[]).map(h=>s.jsx("code",{className:"mono",style:{fontSize:10.5,color:"var(--text-secondary)",background:"var(--bg-canvas)",padding:"1px 6px",borderRadius:4},children:h},h)),(a.inputs??[]).length>0&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"muted",style:{fontSize:10.5,marginLeft:6},children:"inputs"}),(a.inputs??[]).map(h=>s.jsxs("code",{className:"mono",style:{fontSize:10.5,color:"var(--node-spec)",background:"var(--node-spec-soft)",padding:"1px 6px",borderRadius:4},children:["$",h.name]},h.name))]}),s.jsx("span",{className:"grow"}),s.jsxs(Ie,{variant:"primary",size:"sm",onClick:()=>i(a.name),children:[s.jsx(R,{name:"play",size:13}),"Launch"]})]})]},a.name)})}),o&&s.jsx(Pg,{wf:o.workflow,project:e,onClose:()=>i(null)})]})}function Pg({wf:e,project:t,onClose:n}){const r=e.inputs??[],[l,i]=C.useState(()=>Object.fromEntries(r.filter(v=>v.default).map(v=>[v.name,v.default]))),[o,a]=C.useState(!1),[c,u]=C.useState(null),h=r.filter(v=>v.required&&!(l[v.name]??"").trim()),m=()=>{if(o||h.length)return;a(!0),u(null);const v=Object.fromEntries(Object.entries(l).filter(([,y])=>y.trim()));D.launchRun(e.name,v,t).then(y=>Q("runs",{param:y.runId}),y=>{u(y instanceof Error?y.message:String(y)),a(!1)})};return s.jsx("div",{onMouseDown:n,role:"dialog","aria-label":"Launch "+e.name,style:{position:"fixed",inset:0,background:"var(--overlay)",zIndex:90,display:"grid",placeItems:"center"},children:s.jsxs("div",{onMouseDown:v=>v.stopPropagation(),style:{width:460,maxWidth:"90vw",background:"var(--bg-elevated)",border:"1px solid var(--border-strong)",borderRadius:12,boxShadow:"var(--shadow-pop)"},children:[s.jsxs("div",{className:"row gap-10",style:{padding:"14px 16px",borderBottom:"1px solid var(--border-subtle)"},children:[s.jsx(R,{name:"workflow",size:16,style:{color:"var(--accent)"}}),s.jsx("span",{className:"mono grow",style:{fontWeight:600},children:e.name}),s.jsx(Ie,{variant:"ghost",size:"xs",onClick:n,"aria-label":"Close",children:s.jsx(R,{name:"x",size:14})})]}),s.jsxs("div",{style:{padding:16},children:[s.jsx("div",{className:"secondary",style:{fontSize:12.5,marginBottom:16,lineHeight:1.55},children:e.description||"No description."}),r.length?r.map(v=>s.jsxs("div",{style:{marginBottom:12},children:[s.jsxs("label",{className:"eyebrow",style:{display:"block",marginBottom:5},htmlFor:"wf-input-"+v.name,children:[v.name,v.required&&s.jsx("span",{style:{color:"var(--error)"},children:" *"})]}),s.jsx("input",{id:"wf-input-"+v.name,className:"input mono",style:{width:"100%"},placeholder:v.description||(v.name==="SPEC_ID"?"REQ-AUTH-005":"value…"),value:l[v.name]||"",onChange:y=>i(x=>({...x,[v.name]:y.target.value})),onKeyDown:y=>{y.key==="Enter"&&m()}})]},v.name)):s.jsx("div",{className:"muted",style:{fontSize:12,padding:"8px 0"},children:"No inputs required."}),s.jsx("div",{className:"row gap-6",style:{marginTop:6,marginBottom:4},children:(e.requires??[]).map(v=>s.jsxs(fe,{children:[s.jsx(R,{name:"check",size:10}),v]},v))}),c&&s.jsxs("div",{className:"row gap-8",style:{marginTop:8,padding:"8px 10px",borderRadius:7,background:"var(--error-soft)",color:"var(--error)",fontSize:12},children:[s.jsx(R,{name:"cancel",size:13,style:{flexShrink:0}}),s.jsx("span",{children:c})]})]}),s.jsxs("div",{className:"row gap-8",style:{padding:"12px 16px",borderTop:"1px solid var(--border-subtle)",justifyContent:"flex-end"},children:[s.jsx(Ie,{variant:"ghost",size:"sm",onClick:n,children:"Cancel"}),s.jsxs(Ie,{variant:"primary",size:"sm",onClick:m,loading:o,disabled:h.length>0,title:h.length?"Fill the required inputs: "+h.map(v=>v.name).join(", "):void 0,children:[!o&&s.jsx(R,{name:"play",size:13}),o?"Launching…":"Launch run"]})]})]})})}const Zo=[{group:"",items:[{id:"dashboard",label:"Overview",icon:"dashboard"},{id:"plan",label:"Plan",icon:"book"},{id:"review",label:"Review",icon:"drift",badge:e=>e.drift},{id:"graph",label:"Graph",icon:"graph"},{id:"traceability",label:"Traceability",icon:"matrix"},{id:"runs",label:"Runs",icon:"play",badge:e=>e.runs,badgeKind:"warn"}]}],Ig=[...Zo.flatMap(e=>e.items.map(({id:t,label:n,icon:r})=>({id:t,label:n,icon:r}))),{id:"workflows",label:"Workflows",icon:"workflow"},{id:"designsystem",label:"Design system",icon:"layers"},{id:"settings",label:"Settings",icon:"settings"}],Dg=Zo.flatMap(e=>e.items.map(t=>t.id)).slice(0,7),Og={dashboard:Mm,plan:ng,review:ug,graph:Gv,traceability:Tg,runs:bg,workflows:Lg,designsystem:()=>s.jsx(ov,{}),settings:e=>s.jsx(zg,{...e})},Ql="ss_project",zc="ss_nav_groups",Mc="ss_nav_collapsed";function Ag(){const{route:e,param:t,query:n}=Yh(),[r,l]=C.useState(()=>{try{return localStorage.getItem(Mc)==="1"}catch{return!1}}),[i,o]=C.useState(()=>{try{return localStorage.getItem(Ql)}catch{return null}}),[a,c]=C.useState(!1),[u,h]=C.useState(!1),m=H(()=>D.status(i),[i,e]),v=H(()=>D.projects(),[]),y=H(()=>D.runs(i),[i,e]),x=H(()=>D.drift(i),[i,e]),g=C.useCallback(()=>h(N=>!N),[]);om({onTogglePalette:g,pageIds:Dg});const b={drift:x.data?.links.length??m.data?.drift??0,runs:y.data?.runs.filter(N=>N.status==="running").length??0},f=C.useCallback(()=>h(!0),[]),d=()=>l(N=>{try{localStorage.setItem(Mc,N?"0":"1")}catch{}return!N}),p=N=>{o(N);try{N?localStorage.setItem(Ql,N):localStorage.removeItem(Ql)}catch{}},j=()=>{c(!0),D.refresh(i).catch(()=>{}).finally(()=>{c(!1),m.reload()})},k=Og[e]??(()=>s.jsx(Yv,{title:"Not found"}));return s.jsxs("div",{style:{display:"flex",height:"100%",position:"relative"},children:[s.jsx(Fg,{route:e,collapsed:r,counts:b,version:m.data?.version,onToggleCollapse:d}),s.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minWidth:0},children:[s.jsx(Wg,{status:m.data,projectless:Qe(m.error),projects:v.data?.projects??[],project:i,onPick:p,onRefresh:j,refreshing:a}),s.jsx(Ug,{onToggle:d,onOpenPalette:f}),s.jsx("div",{"data-screen":e,style:{flex:1,minHeight:0,display:"flex",flexDirection:"column"},children:s.jsx(k,{project:i,param:t,query:n})},e+(t??""))]}),s.jsx(rm,{open:u,onClose:()=>h(!1),pages:Ig,project:i})]})}function Fg({route:e,collapsed:t,counts:n,version:r,onToggleCollapse:l}){const[i,o]=C.useState(()=>{try{return JSON.parse(localStorage.getItem(zc)||"null")||{}}catch{return{}}}),a=u=>i[u]!==!1,c=u=>o(h=>{const m={...h,[u]:h[u]===!1};try{localStorage.setItem(zc,JSON.stringify(m))}catch{}return m});return s.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:[s.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:[s.jsx(qh,{size:26}),!t&&s.jsx("div",{className:"grow",style:{fontWeight:600,fontSize:13.5,letterSpacing:"-0.01em"},children:"SpecShip"})]}),s.jsx("div",{className:"scroll-y",style:{flex:1,padding:"4px 8px"},children:Zo.map(u=>s.jsxs("div",{style:{marginBottom:t?10:4},children:[!t&&u.group&&s.jsxs("button",{onClick:()=>c(u.group),className:"row gap-6",style:{width:"100%",padding:"8px 8px 4px",background:"none",border:"none",cursor:"pointer",textAlign:"left"},children:[s.jsx("span",{className:"eyebrow grow",children:u.group}),s.jsx(R,{name:a(u.group)?"chevronDown":"chevronRight",size:12,style:{color:"var(--text-muted)"}})]}),(t||!u.group||a(u.group))&&u.items.map(h=>s.jsx(Gl,{item:h,active:e===h.id,collapsed:t,counts:n},h.id))]},u.group||"main"))}),s.jsxs("div",{style:{padding:8,borderTop:"1px solid var(--border-subtle)"},children:[s.jsx(Gl,{item:{id:"settings",label:"Settings",icon:"settings"},active:e==="settings",collapsed:t}),s.jsx(Gl,{item:{id:"designsystem",label:"Design system",icon:"layers"},active:e==="designsystem",collapsed:t}),r&&s.jsx("div",{className:"mono tabular",title:`SpecShip v${r}`,"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?r:`v${r}`})]})]})}function Gl({item:e,active:t,collapsed:n,counts:r}){const l=a=>{a.metaKey||a.ctrlKey||a.shiftKey||a.button!==0||(a.preventDefault(),Q(e.id))},i=e.badge&&r?e.badge(r):0,o=e.badgeKind;return s.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&&s.jsx("span",{style:{position:"absolute",left:0,top:7,bottom:7,width:2.5,borderRadius:2,background:"var(--accent)"}}),s.jsx(R,{name:e.icon,size:16,style:{color:t?"var(--accent)":"inherit",flexShrink:0}}),!n&&s.jsx("span",{className:"grow",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.label}),!n&&i>0&&s.jsx("span",{className:"pill tabular",style:{fontSize:10,fontWeight:700,padding:"1px 6px",minWidth:18,justifyContent:"center",color:o==="error"?"var(--error)":o==="warn"?"var(--warn)":"var(--text-secondary)",background:o==="error"?"var(--error-soft)":o==="warn"?"var(--warn-soft)":"var(--fill)"},children:i}),n&&i>0&&s.jsx("span",{style:{position:"absolute",top:5,right:9,width:6,height:6,borderRadius:"50%",background:o==="error"?"var(--error)":"var(--warn)"}})]})}function $g({projects:e,project:t,projectPath:n,onPick:r}){const[l,i]=C.useState(!1),o=C.useRef(null),[a,c]=C.useState(null),u=()=>{if(!l){const y=o.current?.getBoundingClientRect();c(y?{top:y.bottom+5,left:y.left}:null)}i(y=>!y)};C.useEffect(()=>{if(!l)return;const y=x=>{x.target.closest("[data-projsw]")||i(!1)};return window.addEventListener("mousedown",y),()=>window.removeEventListener("mousedown",y)},[l]);const h=e.filter(y=>y.initialized),m=t??"",v=n||(t??"pick a project");return s.jsxs("div",{"data-projsw":"1",style:{position:"relative",flexShrink:0},children:[s.jsxs("button",{ref:o,onClick:u,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:[s.jsx(R,{name:"folder",size:13,style:{color:"var(--text-muted)",flexShrink:0}}),s.jsx("span",{className:"mono",style:{fontSize:11.5,color:"var(--text-primary)",maxWidth:280,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:v}),s.jsx(R,{name:"chevronDown",size:12,style:{color:"var(--text-muted)",flexShrink:0}})]}),l&&s.jsxs("div",{style:{position:"fixed",top:a?.top??34,left:a?.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:[s.jsx("div",{className:"eyebrow",style:{padding:"5px 8px 6px"},children:"Indexed projects"}),s.jsxs("button",{className:"row gap-8",onClick:()=>{r(null),i(!1)},style:Rc(m===""),children:[s.jsx(R,{name:"folder",size:13,style:{color:"var(--text-muted)",flexShrink:0}}),s.jsx("span",{className:"grow",style:{textAlign:"left",fontSize:12.5},children:"Primary project"}),m===""&&s.jsx(R,{name:"check",size:13,style:{color:"var(--accent)",flexShrink:0}})]}),h.map(y=>{const x=y.slug===m;return s.jsxs("button",{className:"row gap-8",onClick:()=>{r(y.slug),i(!1)},style:Rc(x),children:[s.jsx(R,{name:"folder",size:13,style:{color:x?"var(--accent)":"var(--text-muted)",flexShrink:0}}),s.jsx("span",{className:"grow mono",style:{textAlign:"left",fontSize:11.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:y.path}),(y.driftCount??0)>0&&s.jsxs("span",{className:"pill tabular",style:{fontSize:9.5,color:"var(--warn)",background:"var(--warn-soft)",flexShrink:0},children:[y.driftCount," drift"]}),x&&s.jsx(R,{name:"check",size:13,style:{color:"var(--accent)",flexShrink:0}})]},y.slug)}),!h.length&&s.jsx("div",{className:"muted",style:{padding:"6px 8px",fontSize:12},children:"No initialized projects found."})]})]})}function Rc(e){return{width:"100%",textAlign:"left",padding:"7px 8px",borderRadius:6,cursor:"pointer",border:"none",background:e?"var(--bg-active)":"transparent"}}function Wg({status:e,projectless:t,projects:n,project:r,onPick:l,onRefresh:i,refreshing:o}){const a=(h,m,v)=>s.jsxs("div",{className:"row gap-6",style:{flexShrink:0},children:[s.jsx("span",{className:"muted",style:{fontSize:11},children:h}),s.jsx("span",{className:"mono tabular",style:{fontSize:11.5,color:v||"var(--text-secondary)"},children:m})]}),c=s.jsx("span",{style:{width:1,height:12,background:"var(--border-subtle)",flexShrink:0}}),u=e?.lastIndexed?new Date(e.lastIndexed).toLocaleString():"—";return s.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:[s.jsx($g,{projects:n,project:r,projectPath:e?.projectPath??null,onPick:l}),c,a("nodes",e?e.nodeCount.toLocaleString():t?"—":"…"),a("edges",e?e.edgeCount.toLocaleString():t?"—":"…"),c,a("drift",e?String(e.drift):"—",e?e.drift?"var(--warn)":"var(--success)":void 0),s.jsx("div",{className:"grow"}),a("indexed",u),s.jsx("button",{className:"btn btn-ghost btn-xs",onClick:i,title:"Refresh now","aria-label":"Refresh now",children:s.jsx(R,{name:"refresh",size:12,style:{animation:o?"spin 0.8s linear infinite":"none"}})})]})}const Bg={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 Ug({onToggle:e,onOpenPalette:t}){return s.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:[s.jsx("button",{className:"btn btn-ghost",onClick:e,style:{padding:6},title:"Toggle sidebar","aria-label":"Toggle sidebar",children:s.jsx(R,{name:"menu",size:16})}),s.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:[s.jsx(R,{name:"search",size:14}),s.jsx("span",{className:"grow",style:{textAlign:"left"},children:"Search or jump to…"}),s.jsx("kbd",{style:Bg,children:"⌘K"})]}),s.jsx("div",{className:"grow"}),s.jsx("button",{className:"btn btn-ghost btn-sm",onClick:t,title:"Command palette","aria-label":"Command palette",children:s.jsx(R,{name:"command",size:14})})]})}const Hg="specship-theme";function Vg(){document.documentElement.setAttribute("data-theme","dark");try{localStorage.removeItem(Hg)}catch{}}Vg();uf(cf());Yl.createRoot(document.getElementById("root")).render(s.jsx(Lf.StrictMode,{children:s.jsx(Ag,{})}));