@wjarka/cezarion 0.15.1 → 0.16.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 (462) hide show
  1. package/README.md +167 -46
  2. package/dist/agent-config/catalog.d.ts +6 -2
  3. package/dist/agent-config/catalog.js +78 -3
  4. package/dist/agent-config/catalog.js.map +1 -1
  5. package/dist/agent-config/model-settings/shared.js +6 -3
  6. package/dist/agent-config/model-settings/shared.js.map +1 -1
  7. package/dist/agent-config/models.js +4 -0
  8. package/dist/agent-config/models.js.map +1 -1
  9. package/dist/agent-config/validate.js +6 -0
  10. package/dist/agent-config/validate.js.map +1 -1
  11. package/dist/artifacts/cli.js +10 -2
  12. package/dist/artifacts/cli.js.map +1 -1
  13. package/dist/automations/coordinator.d.ts +7 -0
  14. package/dist/automations/coordinator.js +22 -2
  15. package/dist/automations/coordinator.js.map +1 -1
  16. package/dist/automations/github-poller.d.ts +4 -4
  17. package/dist/automations/github-poller.js.map +1 -1
  18. package/dist/automations/schedule-runner.d.ts +130 -0
  19. package/dist/automations/schedule-runner.js +326 -0
  20. package/dist/automations/schedule-runner.js.map +1 -0
  21. package/dist/automations/scheduler.d.ts +38 -7
  22. package/dist/automations/scheduler.js +90 -22
  23. package/dist/automations/scheduler.js.map +1 -1
  24. package/dist/automations/store.d.ts +80 -3
  25. package/dist/automations/store.js +208 -16
  26. package/dist/automations/store.js.map +1 -1
  27. package/dist/automations/task-template.d.ts +42 -6
  28. package/dist/automations/task-template.js +152 -24
  29. package/dist/automations/task-template.js.map +1 -1
  30. package/dist/automations/types.d.ts +142 -6
  31. package/dist/automations/types.js +64 -6
  32. package/dist/automations/types.js.map +1 -1
  33. package/dist/autosave-holders.js +8 -12
  34. package/dist/autosave-holders.js.map +1 -1
  35. package/dist/ci-wait/client.d.ts +8 -1
  36. package/dist/ci-wait/client.js +43 -1
  37. package/dist/ci-wait/client.js.map +1 -1
  38. package/dist/ci-wait/controller.d.ts +83 -4
  39. package/dist/ci-wait/controller.js +76 -11
  40. package/dist/ci-wait/controller.js.map +1 -1
  41. package/dist/ci-wait/errors.d.ts +7 -1
  42. package/dist/ci-wait/errors.js +36 -0
  43. package/dist/ci-wait/errors.js.map +1 -1
  44. package/dist/ci-wait/github.d.ts +2 -0
  45. package/dist/ci-wait/github.js +3 -1
  46. package/dist/ci-wait/github.js.map +1 -1
  47. package/dist/ci-wait/mcp.d.ts +2 -98
  48. package/dist/ci-wait/mcp.js +11 -25
  49. package/dist/ci-wait/mcp.js.map +1 -1
  50. package/dist/ci-wait/supervisor.d.ts +2 -1
  51. package/dist/ci-wait/supervisor.js +2 -1
  52. package/dist/ci-wait/supervisor.js.map +1 -1
  53. package/dist/ci-wait/tools.d.ts +307 -0
  54. package/dist/ci-wait/tools.js +63 -0
  55. package/dist/ci-wait/tools.js.map +1 -0
  56. package/dist/config.d.ts +3 -0
  57. package/dist/config.js +7 -0
  58. package/dist/config.js.map +1 -1
  59. package/dist/contract/agent-config.d.ts +5 -0
  60. package/dist/contract/agent-profiles.d.ts +15 -0
  61. package/dist/contract/automation-schedule.d.ts +60 -0
  62. package/dist/contract/automations.d.ts +208 -36
  63. package/dist/contract/delegation.d.ts +96 -0
  64. package/dist/contract/discovery.d.ts +7 -0
  65. package/dist/contract/github.d.ts +1 -0
  66. package/dist/contract/health.d.ts +6 -0
  67. package/dist/contract/index.d.ts +3 -0
  68. package/dist/contract/index.js +1445 -745
  69. package/dist/contract/preview.d.ts +508 -0
  70. package/dist/contract/runs.d.ts +716 -15
  71. package/dist/contract/skills.d.ts +39 -0
  72. package/dist/contract/workflows.d.ts +6 -0
  73. package/dist/contract/workspace.d.ts +65 -0
  74. package/dist/contract/zoned-time.d.ts +35 -0
  75. package/dist/core/agent-env.d.ts +11 -0
  76. package/dist/core/agent-env.js +27 -5
  77. package/dist/core/agent-env.js.map +1 -1
  78. package/dist/core/agent-profiles.js +7 -0
  79. package/dist/core/agent-profiles.js.map +1 -1
  80. package/dist/core/agent-runner.d.ts +49 -1
  81. package/dist/core/agent-runner.js +2 -1
  82. package/dist/core/agent-runner.js.map +1 -1
  83. package/dist/core/backend-detect.d.ts +3 -2
  84. package/dist/core/backend-detect.js +27 -1
  85. package/dist/core/backend-detect.js.map +1 -1
  86. package/dist/core/claude-cli-runner.d.ts +1 -0
  87. package/dist/core/claude-cli-runner.js +69 -19
  88. package/dist/core/claude-cli-runner.js.map +1 -1
  89. package/dist/core/codex-app-server-runner.d.ts +1 -0
  90. package/dist/core/codex-app-server-runner.js +200 -25
  91. package/dist/core/codex-app-server-runner.js.map +1 -1
  92. package/dist/core/codex-app-server-transport.d.ts +7 -3
  93. package/dist/core/codex-app-server-transport.js +11 -9
  94. package/dist/core/codex-app-server-transport.js.map +1 -1
  95. package/dist/core/cursor-acp-runner.d.ts +1 -0
  96. package/dist/core/cursor-acp-runner.js +24 -9
  97. package/dist/core/cursor-acp-runner.js.map +1 -1
  98. package/dist/core/host-model-catalog.js +2 -0
  99. package/dist/core/host-model-catalog.js.map +1 -1
  100. package/dist/core/managed-session.js +2 -0
  101. package/dist/core/managed-session.js.map +1 -1
  102. package/dist/core/model-identity.js +2 -0
  103. package/dist/core/model-identity.js.map +1 -1
  104. package/dist/core/model-presets.js +3 -0
  105. package/dist/core/model-presets.js.map +1 -1
  106. package/dist/core/omp-model-catalog.d.ts +43 -0
  107. package/dist/core/omp-model-catalog.js +205 -0
  108. package/dist/core/omp-model-catalog.js.map +1 -0
  109. package/dist/core/omp-runner.d.ts +73 -0
  110. package/dist/core/omp-runner.js +990 -0
  111. package/dist/core/omp-runner.js.map +1 -0
  112. package/dist/core/omp-ui-mapper.d.ts +106 -0
  113. package/dist/core/omp-ui-mapper.js +882 -0
  114. package/dist/core/omp-ui-mapper.js.map +1 -0
  115. package/dist/core/opencode-server-runner.d.ts +18 -4
  116. package/dist/core/opencode-server-runner.js +337 -96
  117. package/dist/core/opencode-server-runner.js.map +1 -1
  118. package/dist/core/opencode-session-error.d.ts +11 -0
  119. package/dist/core/opencode-session-error.js +26 -0
  120. package/dist/core/opencode-session-error.js.map +1 -0
  121. package/dist/core/opencode-ui-mapper.js +4 -36
  122. package/dist/core/opencode-ui-mapper.js.map +1 -1
  123. package/dist/core/pi-runner.d.ts +1 -0
  124. package/dist/core/pi-runner.js +75 -12
  125. package/dist/core/pi-runner.js.map +1 -1
  126. package/dist/core/provider-auth.d.ts +9 -2
  127. package/dist/core/provider-auth.js +43 -6
  128. package/dist/core/provider-auth.js.map +1 -1
  129. package/dist/core/runner-factory.js +3 -0
  130. package/dist/core/runner-factory.js.map +1 -1
  131. package/dist/core/runner-model-catalog.js +1 -0
  132. package/dist/core/runner-model-catalog.js.map +1 -1
  133. package/dist/core/runner-stderr.d.ts +2 -0
  134. package/dist/core/runner-stderr.js +20 -0
  135. package/dist/core/runner-stderr.js.map +1 -0
  136. package/dist/core/session-process.d.ts +22 -0
  137. package/dist/core/session-process.js +202 -0
  138. package/dist/core/session-process.js.map +1 -0
  139. package/dist/core/ui-events.d.ts +1 -1
  140. package/dist/core/usage-limit.js +3 -60
  141. package/dist/core/usage-limit.js.map +1 -1
  142. package/dist/data-gitignore.d.ts +6 -0
  143. package/dist/data-gitignore.js +57 -0
  144. package/dist/data-gitignore.js.map +1 -0
  145. package/dist/delegation/capacity.d.ts +19 -0
  146. package/dist/delegation/capacity.js +34 -0
  147. package/dist/delegation/capacity.js.map +1 -0
  148. package/dist/delegation/cli.js +13 -4
  149. package/dist/delegation/cli.js.map +1 -1
  150. package/dist/delegation/conversations.d.ts +4 -2
  151. package/dist/delegation/conversations.js +8 -12
  152. package/dist/delegation/conversations.js.map +1 -1
  153. package/dist/delegation/credentials.d.ts +2 -0
  154. package/dist/delegation/credentials.js +10 -0
  155. package/dist/delegation/credentials.js.map +1 -1
  156. package/dist/delegation/destroy-observation.d.ts +42 -0
  157. package/dist/delegation/destroy-observation.js +115 -0
  158. package/dist/delegation/destroy-observation.js.map +1 -0
  159. package/dist/delegation/execution-identity.d.ts +6 -0
  160. package/dist/delegation/execution-identity.js +1 -1
  161. package/dist/delegation/execution-identity.js.map +1 -1
  162. package/dist/delegation/policy.d.ts +3 -2
  163. package/dist/delegation/policy.js +7 -5
  164. package/dist/delegation/policy.js.map +1 -1
  165. package/dist/delegation/process-liveness.d.ts +57 -20
  166. package/dist/delegation/process-liveness.js +114 -92
  167. package/dist/delegation/process-liveness.js.map +1 -1
  168. package/dist/delegation/provision.js +6 -6
  169. package/dist/delegation/provision.js.map +1 -1
  170. package/dist/delegation/results.js +4 -2
  171. package/dist/delegation/results.js.map +1 -1
  172. package/dist/delegation/retry-backoff.d.ts +23 -0
  173. package/dist/delegation/retry-backoff.js +18 -0
  174. package/dist/delegation/retry-backoff.js.map +1 -0
  175. package/dist/delegation/routes.d.ts +64 -58
  176. package/dist/delegation/scratch-cleanup.d.ts +29 -0
  177. package/dist/delegation/scratch-cleanup.js +143 -0
  178. package/dist/delegation/scratch-cleanup.js.map +1 -0
  179. package/dist/delegation/service.d.ts +20 -1
  180. package/dist/delegation/service.js +233 -70
  181. package/dist/delegation/service.js.map +1 -1
  182. package/dist/delegation/transport.d.ts +12 -6
  183. package/dist/delegation/workspace.d.ts +23 -4
  184. package/dist/delegation/workspace.js +147 -31
  185. package/dist/delegation/workspace.js.map +1 -1
  186. package/dist/git-worktree-lock-helper.js +8 -3
  187. package/dist/git-worktree-lock-helper.js.map +1 -1
  188. package/dist/git-worktree-lock.d.ts +6 -1
  189. package/dist/git-worktree-lock.js +10 -4
  190. package/dist/git-worktree-lock.js.map +1 -1
  191. package/dist/git-worktree-release.d.ts +20 -0
  192. package/dist/git-worktree-release.js +27 -0
  193. package/dist/git-worktree-release.js.map +1 -0
  194. package/dist/git-worktree.d.ts +8 -2
  195. package/dist/git-worktree.js +19 -2
  196. package/dist/git-worktree.js.map +1 -1
  197. package/dist/handoff.d.ts +2 -2
  198. package/dist/handoff.js +1 -1
  199. package/dist/index.js +109 -76
  200. package/dist/index.js.map +1 -1
  201. package/dist/paths.d.ts +1 -1
  202. package/dist/paths.js +5 -1
  203. package/dist/paths.js.map +1 -1
  204. package/dist/preview/cdp.d.ts +13 -0
  205. package/dist/preview/cdp.js +69 -0
  206. package/dist/preview/cdp.js.map +1 -0
  207. package/dist/preview/chromium.d.ts +75 -0
  208. package/dist/preview/chromium.js +394 -0
  209. package/dist/preview/chromium.js.map +1 -0
  210. package/dist/preview/dev-server.d.ts +68 -0
  211. package/dist/preview/dev-server.js +341 -0
  212. package/dist/preview/dev-server.js.map +1 -0
  213. package/dist/preview/host.d.ts +154 -0
  214. package/dist/preview/host.js +681 -0
  215. package/dist/preview/host.js.map +1 -0
  216. package/dist/preview/registration.d.ts +63 -0
  217. package/dist/preview/registration.js +109 -0
  218. package/dist/preview/registration.js.map +1 -0
  219. package/dist/preview/session.d.ts +73 -0
  220. package/dist/preview/session.js +347 -0
  221. package/dist/preview/session.js.map +1 -0
  222. package/dist/preview/url.d.ts +6 -0
  223. package/dist/preview/url.js +17 -0
  224. package/dist/preview/url.js.map +1 -0
  225. package/dist/runs/agent-tmpdir-removal.d.ts +15 -0
  226. package/dist/runs/agent-tmpdir-removal.js +60 -0
  227. package/dist/runs/agent-tmpdir-removal.js.map +1 -0
  228. package/dist/runs/agent-tmpdir.d.ts +12 -1
  229. package/dist/runs/agent-tmpdir.js +123 -34
  230. package/dist/runs/agent-tmpdir.js.map +1 -1
  231. package/dist/runs/delegation-state.d.ts +5 -1
  232. package/dist/runs/delegation-state.js +9 -0
  233. package/dist/runs/delegation-state.js.map +1 -1
  234. package/dist/runs/event-history.d.ts +4 -4
  235. package/dist/runs/event-history.js +97 -117
  236. package/dist/runs/event-history.js.map +1 -1
  237. package/dist/runs/history-compressor.d.ts +29 -0
  238. package/dist/runs/history-compressor.js +116 -0
  239. package/dist/runs/history-compressor.js.map +1 -0
  240. package/dist/runs/history-file.d.ts +36 -0
  241. package/dist/runs/history-file.js +463 -0
  242. package/dist/runs/history-file.js.map +1 -0
  243. package/dist/runs/human-ask-summary.js +18 -13
  244. package/dist/runs/human-ask-summary.js.map +1 -1
  245. package/dist/runs/legacy-index.d.ts +62 -0
  246. package/dist/runs/legacy-index.js +168 -0
  247. package/dist/runs/legacy-index.js.map +1 -0
  248. package/dist/runs/raw-record.d.ts +52 -0
  249. package/dist/runs/raw-record.js +145 -0
  250. package/dist/runs/raw-record.js.map +1 -0
  251. package/dist/runs/retention.d.ts +13 -6
  252. package/dist/runs/retention.js +42 -13
  253. package/dist/runs/retention.js.map +1 -1
  254. package/dist/runs/run-claims.d.ts +23 -0
  255. package/dist/runs/run-claims.js +24 -0
  256. package/dist/runs/run-claims.js.map +1 -0
  257. package/dist/runs/run-database.d.ts +385 -0
  258. package/dist/runs/run-database.js +930 -0
  259. package/dist/runs/run-database.js.map +1 -0
  260. package/dist/runs/run-index.d.ts +35 -9
  261. package/dist/runs/run-index.js +200 -25
  262. package/dist/runs/run-index.js.map +1 -1
  263. package/dist/runs/run-row.d.ts +44 -0
  264. package/dist/runs/run-row.js +84 -0
  265. package/dist/runs/run-row.js.map +1 -0
  266. package/dist/runs/run-search.d.ts +29 -0
  267. package/dist/runs/run-search.js +63 -0
  268. package/dist/runs/run-search.js.map +1 -0
  269. package/dist/runs/store-open-error.d.ts +24 -0
  270. package/dist/runs/store-open-error.js +61 -0
  271. package/dist/runs/store-open-error.js.map +1 -0
  272. package/dist/runs/store.d.ts +667 -32
  273. package/dist/runs/store.js +2153 -324
  274. package/dist/runs/store.js.map +1 -1
  275. package/dist/runs/transcript-facts.d.ts +77 -0
  276. package/dist/runs/transcript-facts.js +302 -0
  277. package/dist/runs/transcript-facts.js.map +1 -0
  278. package/dist/runs/webhook.js +5 -4
  279. package/dist/runs/webhook.js.map +1 -1
  280. package/dist/runs/worker-execution.d.ts +22 -0
  281. package/dist/runs/worker-execution.js +30 -0
  282. package/dist/runs/worker-execution.js.map +1 -0
  283. package/dist/server/capabilities.d.ts +1 -0
  284. package/dist/server/capabilities.js +2 -0
  285. package/dist/server/capabilities.js.map +1 -1
  286. package/dist/server/cockpit-ownership.d.ts +8 -0
  287. package/dist/server/cockpit-ownership.js +19 -0
  288. package/dist/server/cockpit-ownership.js.map +1 -1
  289. package/dist/server/forge/github.d.ts +1 -4
  290. package/dist/server/forge/github.js +47 -23
  291. package/dist/server/forge/github.js.map +1 -1
  292. package/dist/server/git.js +1 -1
  293. package/dist/server/git.js.map +1 -1
  294. package/dist/server/open-in-app.js +1 -0
  295. package/dist/server/open-in-app.js.map +1 -1
  296. package/dist/server/preview-socket.d.ts +36 -0
  297. package/dist/server/preview-socket.js +126 -0
  298. package/dist/server/preview-socket.js.map +1 -0
  299. package/dist/server/project-context.d.ts +31 -4
  300. package/dist/server/project-context.js +73 -9
  301. package/dist/server/project-context.js.map +1 -1
  302. package/dist/server/provider-action-gate.js +1 -0
  303. package/dist/server/provider-action-gate.js.map +1 -1
  304. package/dist/server/repo-branches.d.ts +4 -3
  305. package/dist/server/repo-branches.js +5 -4
  306. package/dist/server/repo-branches.js.map +1 -1
  307. package/dist/server/server.d.ts +4500 -2727
  308. package/dist/server/server.js +651 -202
  309. package/dist/server/server.js.map +1 -1
  310. package/dist/server/upgrade-router.d.ts +23 -0
  311. package/dist/server/upgrade-router.js +53 -0
  312. package/dist/server/upgrade-router.js.map +1 -0
  313. package/dist/server/validators.d.ts +6 -1
  314. package/dist/server/validators.js +4 -4
  315. package/dist/server/validators.js.map +1 -1
  316. package/dist/server/ws.d.ts +16 -16
  317. package/dist/server/ws.js +56 -54
  318. package/dist/server/ws.js.map +1 -1
  319. package/dist/skills-remote.d.ts +14 -0
  320. package/dist/skills-remote.js +91 -15
  321. package/dist/skills-remote.js.map +1 -1
  322. package/dist/task-cli/cli.js +40 -16
  323. package/dist/task-cli/cli.js.map +1 -1
  324. package/dist/task-cli/discovery.d.ts +4 -3
  325. package/dist/task-cli/discovery.js +4 -3
  326. package/dist/task-cli/discovery.js.map +1 -1
  327. package/dist/task-cli/http.d.ts +2 -0
  328. package/dist/task-cli/http.js +10 -4
  329. package/dist/task-cli/http.js.map +1 -1
  330. package/dist/task-cli/projections.d.ts +5 -2
  331. package/dist/task-cli/projections.js +13 -0
  332. package/dist/task-cli/projections.js.map +1 -1
  333. package/dist/task-cli/watch.d.ts +15 -2
  334. package/dist/task-cli/watch.js +31 -9
  335. package/dist/task-cli/watch.js.map +1 -1
  336. package/dist/ui-state.d.ts +4 -3
  337. package/dist/ui-state.js +8 -3
  338. package/dist/ui-state.js.map +1 -1
  339. package/dist/workflows/grouped-command.d.ts +31 -0
  340. package/dist/workflows/grouped-command.js +143 -0
  341. package/dist/workflows/grouped-command.js.map +1 -0
  342. package/dist/workflows/run.d.ts +223 -42
  343. package/dist/workflows/run.js +1316 -398
  344. package/dist/workflows/run.js.map +1 -1
  345. package/dist/workflows/types.d.ts +12 -0
  346. package/dist/workflows/types.js +20 -0
  347. package/dist/workflows/types.js.map +1 -1
  348. package/dist/workspace/agent-accounts.d.ts +5 -1
  349. package/dist/workspace/agent-accounts.js +1 -0
  350. package/dist/workspace/agent-accounts.js.map +1 -1
  351. package/dist/workspace/agent-profiles.js +1 -1
  352. package/dist/workspace/agent-profiles.js.map +1 -1
  353. package/dist/workspace/config.d.ts +3 -1
  354. package/dist/workspace/config.js +1 -0
  355. package/dist/workspace/config.js.map +1 -1
  356. package/dist/worktree-setup.d.ts +85 -0
  357. package/dist/worktree-setup.js +164 -0
  358. package/dist/worktree-setup.js.map +1 -0
  359. package/package.json +7 -5
  360. package/scripts/benchmark-run-store-fixture.ts +428 -0
  361. package/scripts/benchmark-run-store.ts +743 -0
  362. package/scripts/benchmark-stuck-destroys.ts +143 -0
  363. package/scripts/mock-autonomous.mjs +11 -0
  364. package/scripts/mock-ci-tool.mjs +20 -5
  365. package/scripts/mock-claude.mjs +110 -1
  366. package/scripts/mock-codex-app-server.mjs +117 -2
  367. package/scripts/mock-codex-coalesce-steer.mjs +59 -0
  368. package/scripts/mock-codex-reverse-steer.mjs +130 -0
  369. package/scripts/mock-cursor-acp.mjs +75 -1
  370. package/scripts/mock-omp-rpc.mjs +605 -0
  371. package/scripts/mock-opencode-serve.mjs +312 -22
  372. package/scripts/mock-pi-rpc.mjs +109 -3
  373. package/scripts/mock-runner-crash.mjs +42 -0
  374. package/scripts/mock-silent-tail.mjs +78 -0
  375. package/scripts/mock-turn-messages.mjs +5 -0
  376. package/scripts/omp-ci-wait.mjs +29 -0
  377. package/scripts/omp-restrict-delegation.yml +4 -0
  378. package/scripts/pi-ci-wait.mjs +12 -9
  379. package/scripts/seed-archive-profile.ts +3 -3
  380. package/web/dist/assets/agent-accounts-CFOBMVHc.js +1 -0
  381. package/web/dist/assets/alert-dialog-BrpNUwMt.js +1 -0
  382. package/web/dist/assets/app-window-CSHwDX9N.js +1 -0
  383. package/web/dist/assets/button-C_rd7CPp.js +43 -0
  384. package/web/dist/assets/compare-variants-D6WXhvXA.js +1 -0
  385. package/web/dist/assets/diff-DrEARXTV.js +3 -0
  386. package/web/dist/assets/diff-controls-B1-j7nFg.js +1 -0
  387. package/web/dist/assets/{diff-view-DPn6bQ5W.js → diff-view-DvGLjdTk.js} +3 -3
  388. package/web/dist/assets/dropdown-menu-BegOZFrj.js +1 -0
  389. package/web/dist/assets/format-DpNe3S0A.js +1 -0
  390. package/web/dist/assets/git-toolbar-Cw4ljmhB.js +1 -0
  391. package/web/dist/assets/github-CfV5sqL0.js +1 -0
  392. package/web/dist/assets/{image-preview-DJ8cgb1Z.js → image-preview-FOEfqpZP.js} +1 -1
  393. package/web/dist/assets/index-DgWWlOLy.js +13 -0
  394. package/web/dist/assets/index-fBFnuvxu.css +1 -0
  395. package/web/dist/assets/{nav-row-styles-3j64kH5s.js → nav-row-styles-vp2JbhuJ.js} +1 -1
  396. package/web/dist/assets/play-CmVAj_fu.js +1 -0
  397. package/web/dist/assets/popover-BohP6WTx.js +1 -0
  398. package/web/dist/assets/preview-pane-connected-qTA5KNoJ.js +3 -0
  399. package/web/dist/assets/preview-state-vuMviq6q.js +1 -0
  400. package/web/dist/assets/prompt-templates-Cubdut_C.js +15 -0
  401. package/web/dist/assets/repo-git-Cf4t5PD0.js +1 -0
  402. package/web/dist/assets/{run-diff-5-RRdcVz.js → run-diff-BpkUW37Z.js} +3 -3
  403. package/web/dist/assets/run-header-68WHf9wV.js +1 -0
  404. package/web/dist/assets/skills-DiVIgKeU.js +1 -0
  405. package/web/dist/assets/square-terminal-B6RYYieR.js +1 -0
  406. package/web/dist/assets/status-dot-CqTJHSP9.js +1 -0
  407. package/web/dist/assets/{tab-link-K0hjzEXR.js → tab-link-B07Hu4QX.js} +1 -1
  408. package/web/dist/assets/task-changes--lQF6EYf.js +1 -0
  409. package/web/dist/assets/task-commits-Cx0qy4DN.js +1 -0
  410. package/web/dist/assets/task-files-D50s-gKW.js +2 -0
  411. package/web/dist/assets/task-github-item-DaqmSwYT.js +1 -0
  412. package/web/dist/assets/task-thread-BPQ64lui.js +7 -0
  413. package/web/dist/assets/{task-thread-Bw_nQuTx.css → task-thread-zNE2Q9E-.css} +1 -1
  414. package/web/dist/assets/textarea-D20O4Pw0.js +1 -0
  415. package/web/dist/assets/thread-state-DWcFMrvb.js +4 -0
  416. package/web/dist/assets/use-hand-to-agent-state-BLIGmwbd.css +1 -0
  417. package/web/dist/assets/use-hand-to-agent-state-Cy9eyyfL.js +1 -0
  418. package/web/dist/assets/{utils-fzNfbPzA.js → utils-JsL3ZsJf.js} +1 -1
  419. package/web/dist/assets/workflows-jwG7uxqi.js +11 -0
  420. package/web/dist/assets/{zoomable-image-CDmZ_Rtl.js → zoomable-image-BJJ64KGc.js} +1 -1
  421. package/web/dist/cezarion-lockup-dark.svg +1 -13
  422. package/web/dist/cezarion-lockup-light.svg +1 -13
  423. package/web/dist/cezarion-mark-dark.svg +1 -12
  424. package/web/dist/cezarion-mark-light.svg +1 -12
  425. package/web/dist/index.html +16 -21
  426. package/web/dist/assets/agent-accounts-CU2ZDv24.js +0 -1
  427. package/web/dist/assets/alert-dialog-C-xYE_dg.js +0 -43
  428. package/web/dist/assets/chevron-right-BENZ-1ZN.js +0 -1
  429. package/web/dist/assets/collapsible-DD9J91Iv.js +0 -1
  430. package/web/dist/assets/compare-variants-5FmqpFSN.js +0 -1
  431. package/web/dist/assets/diff-controls-Bj0YrioE.js +0 -1
  432. package/web/dist/assets/diff-rE8rm75J2.js +0 -3
  433. package/web/dist/assets/diff-stat-BKDCSVfJ.js +0 -1
  434. package/web/dist/assets/dropdown-menu-Ch5BYQh_.js +0 -1
  435. package/web/dist/assets/format-dBiNDNVe.js +0 -1
  436. package/web/dist/assets/git-toolbar-ClVvf5iF.js +0 -1
  437. package/web/dist/assets/github-BkNOyour.css +0 -1
  438. package/web/dist/assets/github-DeZMeMwJ.js +0 -1
  439. package/web/dist/assets/github-item-detail-W5F6GVjF.js +0 -1
  440. package/web/dist/assets/github-sidebar-model-DcMu-IK2.js +0 -1
  441. package/web/dist/assets/highlighter-CdHqIwFr.js +0 -3
  442. package/web/dist/assets/index-CatemBEL.js +0 -8
  443. package/web/dist/assets/index-MvfD8bZJ.css +0 -1
  444. package/web/dist/assets/markdown-zdKeLIYA.js +0 -2
  445. package/web/dist/assets/mobile-run-bar-BCfmFi8V.js +0 -1
  446. package/web/dist/assets/prompt-templates-CBPp39IU.js +0 -15
  447. package/web/dist/assets/reference-chip-D6owncJT.js +0 -1
  448. package/web/dist/assets/repo-git-CtdkZFey.js +0 -1
  449. package/web/dist/assets/run-header-BcjoDi0W.js +0 -1
  450. package/web/dist/assets/sheet-ChnYVrp1.js +0 -1
  451. package/web/dist/assets/skills-C8YKp2vr.js +0 -1
  452. package/web/dist/assets/task-changes-BW8YdWG8.js +0 -1
  453. package/web/dist/assets/task-commits-q2kB2y6L.js +0 -1
  454. package/web/dist/assets/task-files-pPL6_3Cr.js +0 -2
  455. package/web/dist/assets/task-github-item-BXF5R52U.js +0 -1
  456. package/web/dist/assets/task-thread-DtkFL3EC.js +0 -10
  457. package/web/dist/assets/textarea-DxlkE-Yd.js +0 -1
  458. package/web/dist/assets/token-metrics-DIAjrPlM.js +0 -1
  459. package/web/dist/assets/use-desktop-CrDny2uG.js +0 -1
  460. package/web/dist/assets/use-submit-shortcut-KWJsC906.js +0 -1
  461. package/web/dist/assets/workflows-TmcPEj2K.js +0 -11
  462. /package/web/dist/assets/{lib-BQXq3kEf2.js → lib-BQXq3kEf.js} +0 -0
@@ -1,8 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/task-thread-DtkFL3EC.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-runtime-CCIEwYL0.js","assets/alert-dialog-C-xYE_dg.js","assets/utils-fzNfbPzA.js","assets/bundle-mjs-BT31bpU6.js","assets/createLucideIcon-BHp8sXmF.js","assets/mobile-run-bar-BCfmFi8V.js","assets/reference-chip-D6owncJT.js","assets/use-desktop-CrDny2uG.js","assets/dropdown-menu-Ch5BYQh_.js","assets/run-header-BcjoDi0W.js","assets/info-DA1x_4bz.js","assets/format-dBiNDNVe.js","assets/tab-link-K0hjzEXR.js","assets/agent-accounts-CU2ZDv24.js","assets/collapsible-DD9J91Iv.js","assets/textarea-DxlkE-Yd.js","assets/markdown-zdKeLIYA.js","assets/chunk-BO2N2NFS-DE6qKn3r.js","assets/lib-BxQXEXDF.js","assets/highlighter-CdHqIwFr.js","assets/diff-stat-BKDCSVfJ.js","assets/token-metrics-DIAjrPlM.js","assets/run-header-8GObNx6F.css","assets/prompt-templates-CBPp39IU.js","assets/search-x-I9Q8pgUa.js","assets/sheet-ChnYVrp1.js","assets/skills-DFBiAuJG.js","assets/use-submit-shortcut-KWJsC906.js","assets/lib-BQXq3kEf2.js","assets/zoomable-image-CDmZ_Rtl.js","assets/run-diff-5-RRdcVz.js","assets/chevron-right-BENZ-1ZN.js","assets/task-thread-Bw_nQuTx.css","assets/compare-variants-5FmqpFSN.js","assets/task-changes-BW8YdWG8.js","assets/git-toolbar-ClVvf5iF.js","assets/diff-controls-Bj0YrioE.js","assets/diff-rE8rm75J2.js","assets/image-preview-DJ8cgb1Z.js","assets/task-files-pPL6_3Cr.js","assets/task-commits-q2kB2y6L.js","assets/task-github-item-BXF5R52U.js","assets/github-item-detail-W5F6GVjF.js","assets/github-sidebar-model-DcMu-IK2.js","assets/repo-git-CtdkZFey.js","assets/nav-row-styles-3j64kH5s.js","assets/repo-git-CoKp-g9K.css","assets/github-DeZMeMwJ.js","assets/github-BkNOyour.css","assets/workflows-TmcPEj2K.js","assets/skill-empty-hint-oOtzR3v0.js","assets/skills-C8YKp2vr.js"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,n,t as r}from"./react-runtime-CCIEwYL0.js";import{$ as i,$a as a,$i as o,$n as s,$r as c,$t as l,A as u,Aa as d,Ar as f,B as p,Ba as m,Bn as h,Br as g,Bt as _,Ci as v,Co as y,Cr as b,Ct as x,D as S,Do as C,Dr as w,Dt as T,E,Ea as ee,Er as D,Et as O,Fa as k,Fi as te,Fn as ne,Ga as A,Gi as re,Gn as ie,H as ae,Ha as oe,Hn as se,Hr as j,Ht as ce,I as le,Ia as ue,In as de,Ir as fe,It as pe,J as me,Ja as he,Ji as M,Jn as ge,Ka as _e,Kn as ve,Kr as ye,Kt as N,La as be,Li as xe,Lr as Se,Lt as Ce,M as we,Ma as Te,Mn as Ee,Mr as De,Mt as Oe,Na as ke,Ni as Ae,Nt as je,O as Me,Oa as Ne,Oi as Pe,On as P,Or as Fe,Ot as Ie,P as Le,Pa as F,Pi as Re,Pr as I,Qi as ze,Qr as Be,R as Ve,Ra as He,Rn as Ue,Rt as We,S as Ge,Si as Ke,So as qe,St as Je,Ta as Ye,To as Xe,Tr as Ze,Tt as Qe,U as $e,Ua as L,Ui as et,Un as tt,Ur as nt,Ut as rt,V as it,Va as at,Vn as ot,Vr as st,Vt as ct,W as lt,Wa as ut,Wi as dt,Wr as ft,X as pt,Xa as mt,Xn as ht,Xr as gt,Y as _t,Ya as vt,Yn as yt,Yr as bt,Yt as xt,Z as St,Za as Ct,Zi as wt,Zn as Tt,Zt as Et,_i as Dt,_n as Ot,_o as kt,_r as At,_t as jt,a as Mt,aa as Nt,ai as Pt,an as Ft,ar as It,at as Lt,ba as Rt,bi as zt,bn as Bt,bo as Vt,br as Ht,c as Ut,ca as Wt,ci as Gt,cn as Kt,co as qt,cr as Jt,di as Yt,dt as Xt,ea as Zt,ei as Qt,en as $t,eo as en,er as tn,fi as nn,ft as rn,ga as an,gi as on,go as sn,gt as cn,ha as ln,hn as un,ho as dn,ht as fn,i as pn,in as R,ir as mn,it as hn,j as gn,ja as _n,ji as vn,jn as yn,jr as bn,ka as xn,kn as Sn,kr as Cn,l as z,li as wn,ln as Tn,lt as En,mn as Dn,mo as On,mt as kn,n as An,ni as jn,nn as Mn,no as Nn,nr as Pn,nt as Fn,o as In,oa as Ln,oi as Rn,on as zn,oo as Bn,ot as Vn,pa as Hn,pi as Un,pn as Wn,po as Gn,pt as Kn,q as qn,qa as B,qn as V,qr as Jn,qt as Yn,r as Xn,ri as Zn,rn as Qn,ro as H,s as $n,si as er,sn as tr,so as U,st as nr,t as rr,ta as ir,ti as ar,tn as or,to as sr,tr as cr,tt as lr,u as ur,ui as dr,un as fr,uo as pr,va as mr,vi as hr,vo as gr,vr as _r,w as vr,wo as yr,wr as br,wt as xr,xa as Sr,xn as Cr,xo as wr,xr as Tr,xt as Er,ya as Dr,yi as Or,yo as kr,yr as Ar,z as W,za as jr,zn as Mr,zr as Nr,zt as Pr}from"./alert-dialog-C-xYE_dg.js";import{A as Fr,E as Ir,O as Lr,f as Rr,i as zr,k as Br,l as Vr,n as Hr,o as Ur,r as Wr,s as Gr,t as G}from"./utils-fzNfbPzA.js";import{i as Kr}from"./bundle-mjs-BT31bpU6.js";import{t as K}from"./createLucideIcon-BHp8sXmF.js";import{A as qr,C as Jr,D as Yr,E as Xr,F as Zr,I as Qr,L as $r,M as ei,N as ti,O as ni,S as ri,T as ii,b as ai,j as oi,k as si,n as ci,o as li,s as ui,w as di,x as fi}from"./mobile-run-bar-BCfmFi8V.js";import{a as pi,c as q,i as mi,t as hi}from"./reference-chip-D6owncJT.js";import{a as gi,c as _i,d as vi,h as yi,i as bi,l as xi,m as Si,n as Ci,o as wi,p as Ti,r as Ei,s as Di,u as Oi,v as ki}from"./github-sidebar-model-DcMu-IK2.js";import{t as Ai}from"./chevron-right-BENZ-1ZN.js";import{_ as ji,a as Mi,c as Ni,d as Pi,f as Fi,g as Ii,h as Li,i as Ri,m as zi,o as Bi,p as Vi,r as Hi,s as Ui,u as Wi,y as Gi}from"./nav-row-styles-3j64kH5s.js";import{a as Ki,c as qi,i as Ji,n as Yi,r as Xi,s as Zi,t as Qi}from"./use-desktop-CrDny2uG.js";import{A as $i,C as ea,D as ta,E as na,F as ra,I as ia,L as aa,M as oa,N as sa,O as ca,P as la,R as ua,S as da,T as fa,_ as pa,a as ma,b as ha,c as ga,d as J,f as _a,g as va,h as ya,i as ba,j as xa,k as Sa,l as Ca,m as wa,n as Ta,o as Ea,p as Y,r as Da,t as Oa,u as ka,v as Aa,w as ja,x as Ma,y as Na}from"./prompt-templates-CBPp39IU.js";import{a as Pa,c as Fa,d as Ia,f as La,i as Ra,l as za,n as Ba,o as Va,r as X,s as Ha,u as Ua}from"./format-dBiNDNVe.js";import{t as Wa}from"./search-x-I9Q8pgUa.js";import{n as Ga,t as Ka}from"./agent-accounts-CU2ZDv24.js";import{C as qa,S as Ja,_ as Ya,a as Xa,b as Za,c as Qa,d as $a,f as eo,g as to,h as no,i as ro,l as io,m as ao,o as oo,p as so,r as co,s as lo,t as uo,u as fo,v as po,x as mo,y as ho}from"./dropdown-menu-Ch5BYQh_.js";import{a as go,i as _o,n as vo,o as yo,r as bo,s as xo,t as So}from"./textarea-DxlkE-Yd.js";import{a as Co,c as wo,d as To,f as Eo,i as Do,o as Oo,s as ko,t as Ao,u as jo}from"./skills-DFBiAuJG.js";import{c as Mo,d as No,f as Po,l as Fo,n as Io,o as Lo,p as Ro,r as zo,s as Bo,t as Vo,u as Ho}from"./sheet-ChnYVrp1.js";import{n as Uo}from"./use-submit-shortcut-KWJsC906.js";import{t as Wo}from"./markdown-zdKeLIYA.js";import{i as Go,n as Ko,r as qo}from"./highlighter-CdHqIwFr.js";import{t as Jo}from"./diff-stat-BKDCSVfJ.js";import{i as Yo,n as Xo,r as Zo,t as Qo}from"./token-metrics-DIAjrPlM.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var $o=class extends Xe{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new qt({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=es(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=es(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=es(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=es(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){On.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>gr(t,e))}findAll(e={}){return this.getAll().filter(t=>gr(e,t))}notify(e){On.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return On.batch(()=>Promise.all(e.map(e=>e.continue().catch(Vt))))}};function es(e){return e.options.scope?.id}var ts=class extends Xe{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??kt(r,t),a=this.get(i);return a||(a=new pr({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){On.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>kr(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>kr(e,t)):t}notify(e){On.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){On.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){On.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},ns=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new ts,this.#t=e.mutationCache||new $o,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=yr.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Gn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(qe(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=dn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return On.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;On.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return On.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=On.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(Vt).catch(Vt)}invalidateQueries(e,t={}){return On.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=On.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(Vt)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(Vt)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(qe(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Vt).catch(Vt)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Vt).catch(Vt)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Gn.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(sn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{wr(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(sn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{wr(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=kt(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===y&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Z=e(t(),1),rs=n();function is(e,t){if(e===`ping`)return{project:null,event:{type:`ping`}};let n;try{n=JSON.parse(t)}catch{return null}if(!as(n))return null;let r=n.project;if(typeof r!=`string`||r===``)return null;switch(e){case`run`:{let{project:e,...t}=n;return os(t)?{project:r,event:{type:`run`,run:t}}:null}case`run-deleted`:{let e=n.id;return typeof e==`string`&&e?{project:r,event:{type:`run-deleted`,id:e}}:null}case`todos`:return Array.isArray(n.items)?{project:r,event:{type:`todos`,items:n.items}}:null;case`usage`:return as(n.usage)?{project:r,event:{type:`usage`,usage:n.usage}}:null;default:return null}}function as(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function os(e){return as(e)&&typeof e.id==`string`&&e.id!==``}function ss(e,t){if(!e)return;let n=e.findIndex(e=>e.id===t.id);if(n>=0){let r=[...e];return r[n]=ls(e[n],t),r}let r=t.createdAt??``,i=e.findIndex(e=>(e.createdAt??``).localeCompare(r)<0),a=[...e];return a.splice(i<0?e.length:i,0,t),a}function cs(e,t){if(!e)return;let n=e.filter(e=>e.id!==t);return n.length===e.length?e:n}function ls(e,t){return e?.usage?{...t,usage:e.usage}:t}var us=Object.freeze({});function ds(){let e=us,t=new Set;return{subscribe(e){return t.add(e),()=>t.delete(e)},get:()=>e,set(n){e=n;for(let e of t)e()}}}var Q=r(),fs=zr(`/workspace/events`),ps=2,ms=3e3,hs=[`run`,`run-deleted`,`todos`,`usage`,`ping`],gs=[`project-added`,`project-removed`,`checkout-progress`,`automation-change`],_s=new Set;function vs(e){return _s.add(e),()=>{_s.delete(e)}}var ys=400;function bs(e){let t;return{onEvent(n){n.type!==`run`&&n.type!==`run-deleted`||t===void 0&&(t=setTimeout(()=>{t=void 0,e.invalidateQueries({queryKey:I.runsIndex})},ys))},cancel(){clearTimeout(t),t=void 0}}}function xs(e){return e[1]===`runs`&&e[2]===`list`}function Ss(e,t){return e.cancelQueries({queryKey:t}).then(()=>e.invalidateQueries({queryKey:t}))}function Cs(e){at(()=>[e.invalidateQueries({queryKey:R.runs.all}),e.invalidateQueries({predicate:e=>xs(e.queryKey)}),e.invalidateQueries({queryKey:I.runsIndex}),e.invalidateQueries({queryKey:R.todos}),Ss(e,R.health),e.invalidateQueries({queryKey:R.worktrees}),e.invalidateQueries({queryKey:R.repoBranches}),e.invalidateQueries({queryKey:I.providerStatus}),Ss(e,I.models(`cursor`)),e.invalidateQueries({predicate:({queryKey:e})=>e.length===3&&e[1]===`github`&&(e[2]===null||typeof e[2]==`number`)})])}function ws(e){return Ur()??Ts(e)}function Ts(e){let t=e.getQueryData(I.projects)?.bootProject;return typeof t==`string`&&t!==``?t:e.getQueryData(R.health)?.bootProject??e.getQueryData([`default`,`health`])?.bootProject}function Es(e,t){return[e===t?`default`:e,`runs`,`list`]}function Ds(e){let t=new Map,n=new Map,r=t=>{let r=n.get(JSON.stringify(t));if(!r)return;let i=e.getQueryCache().find({queryKey:t,exact:!0}),a=i?.promise;r.phase=`awaiting-fetch`,r.dirty=!1,e.invalidateQueries({queryKey:t,exact:!0}),i?.promise&&i.promise!==a&&(r.phase=`fetching`)},i=e.getQueryCache().subscribe(t=>{if(!n.size||t.type!==`updated`)return;let i=JSON.stringify(t.query.queryKey),a=n.get(i);if(a){if(t.action.type===`setState`){t.query.state.isInvalidated||e.invalidateQueries({queryKey:a.key,exact:!0,refetchType:`none`});return}if(t.action.type===`fetch`){a.phase===`awaiting-fetch`&&(a.phase=`fetching`),a.dirty=!1;return}if(t.action.type===`success`){if(!t.action.manual){a.phase===`fetching`&&!a.dirty?n.delete(i):r(a.key);return}a.phase!==`needs-start`&&(a.phase===`fetching`&&(a.dirty=!0),e.invalidateQueries({queryKey:a.key,exact:!0},{cancelRefetch:!1}))}}}),a,o,s=(i=!1)=>{o!==void 0&&clearTimeout(o),o=void 0,a!==void 0&&cancelAnimationFrame(a),a=void 0;let s=[];for(let{key:r,baseList:i,baseQuery:a,baseUpdateCount:o,runs:c}of t.values()){let t=e.getQueryCache().find({queryKey:r,exact:!0});if(t!==a||t?.state.dataUpdateCount!==o||t?.state.data!==i){s.push(r),n.set(JSON.stringify(r),{key:r,phase:`needs-start`,dirty:!1});continue}e.setQueryData(r,e=>{let t=e;for(let e of c.values())t=ss(t,e);return t})}if(t.clear(),!i)for(let e of s)r(e);return s},c=t=>{let n=Es(t,Ts(e)),r=t===ws(e)?R.runs.list():void 0;return r&&JSON.stringify(r)!==JSON.stringify(n)?[n,r]:[n]};return{onEvent(n,i){let l=c(n);if(i.type===`run`&&i.run.archived&&l.every(t=>!e.getQueryData(t)?.find(e=>e.id===i.run.id)?.archived)&&i.type===`run`){for(let n of l){let r=JSON.stringify(n),a=t.get(r);if(!a){let i=e.getQueryCache().find({queryKey:n,exact:!0});a={key:n,baseList:i?.state.data,baseQuery:i,baseUpdateCount:i?.state.dataUpdateCount,runs:new Map},t.set(r,a)}a.runs.set(i.run.id,i.run)}o===void 0&&(o=setTimeout(()=>{s()},50),typeof requestAnimationFrame==`function`&&(a=requestAnimationFrame(()=>{s()})));return}let u=s(!0);for(let t of l)i.type===`run`?e.setQueryData(t,e=>ss(e,i.run)):e.setQueryData(t,e=>cs(e,i.id));for(let e of u)r(e)},flush:s,cancel(){i(),n.clear()}}}function Os(e){let t=new Map;return{refresh(n){let r=R.runs.detail(n);if(!e.getQueryState(r))return;let i=JSON.stringify(r);clearTimeout(t.get(i)),e.cancelQueries({queryKey:r}),t.set(i,setTimeout(()=>{t.delete(i),e.invalidateQueries({queryKey:r})},400))},cancel(){for(let e of t.values())clearTimeout(e);t.clear()}}}var ks=400;function As(e){return JSON.stringify([e.status,e.currentStepId,e.activity,e.delegation])}function js(e){let t=new Map,n=new Map,r=(t,r)=>{if(r&&!e.getQueryState(t))return;let i=JSON.stringify(t);n.has(i)||n.set(i,setTimeout(()=>{n.delete(i),e.invalidateQueries({queryKey:t})},ks))};return{onRun(e){let n=e.delegation?.role===`worker`?e.delegation.parentRunId:void 0,i=As(e),a=t.get(e.id);t.set(e.id,n===void 0?{shape:i}:{shape:i,parentRunId:n}),a?.shape!==i&&(r(R.runs.relationships(e.id),!0),n!==void 0&&r(R.runs.relationships(n),!0))},onDeleted(n){let i=t.get(n);t.delete(n),e.removeQueries({queryKey:R.runs.relationships(n)}),i?.parentRunId===void 0?r([...R.runs.all,`relationships`],!1):r(R.runs.relationships(i.parentRunId),!0)},cancel(){for(let e of n.values())clearTimeout(e);n.clear(),t.clear()}}}function Ms(e,t,n,r,i){switch(n.type){case`run`:{i.onRun(n.run);let t=R.runs.detail(n.run.id);if(e.getQueryData(t)!==void 0&&e.setQueryData(t,e=>ls(e,n.run)),r(n.run.id),n.run.delegation?.role===`worker`){let t=R.runs.detail(n.run.delegation.parentRunId);e.setQueryData(t,e=>{if(!e)return e;let{finishBlocked:t,...n}=e;return n}),r(n.run.delegation.parentRunId)}let a=R.runs.changes(n.run.id);e.getQueryData(a)!==void 0&&e.invalidateQueries({queryKey:a}),e.invalidateQueries({queryKey:R.worktrees}),e.invalidateQueries({queryKey:R.repoBranches});return}case`run-deleted`:i.onDeleted(n.id),e.removeQueries({queryKey:R.runs.detail(n.id)}),e.removeQueries({queryKey:R.runs.diff(n.id)}),e.invalidateQueries({queryKey:R.worktrees}),e.invalidateQueries({queryKey:R.repoBranches});return;case`todos`:e.setQueryData(R.todos,n.items);return;case`usage`:t.set(n.usage);return;case`ping`:return}}function Ns(e,t=fs){let n=U();(0,Z.useEffect)(()=>{let r=globalThis.EventSource;if(typeof r!=`function`)return;let i=null,a=bs(n),o=Os(n),s=Ds(n),c=js(n),l,u=!1,d=!1,f=!1,p=!1,m=()=>{f=!0,p=!1;let e=I.providerStatus;n.cancelQueries({queryKey:e,exact:!0}).then(()=>n.invalidateQueries({queryKey:e,exact:!0,refetchType:`active`})).finally(()=>{if(d||!p){f=!1;return}m()})},h=()=>{d||l!==void 0||(l=setTimeout(()=>{l=void 0,d||g()},ms))},g=()=>{i?.close(),i=new r(t,{withCredentials:!0}),i.addEventListener(`open`,()=>{if(u&&(s.flush(),Cs(n)),!u)for(let e of[R.health,I.models(`cursor`)])n.cancelQueries({queryKey:e}).then(()=>{d||n.invalidateQueries({queryKey:e})});u=!0});for(let t of hs)i.addEventListener(t,r=>{let i=is(t,r.data);i&&(a.onEvent(i.event),i.project!==null&&(i.event.type===`run`||i.event.type===`run-deleted`)&&s.onEvent(i.project,i.event),!(i.project!==null&&i.project!==ws(n))&&Ms(n,e,i.event,o.refresh,c))});for(let e of gs)i.addEventListener(e,t=>{let r;try{r=JSON.parse(t.data)}catch{return}e!==`checkout-progress`&&e!==`automation-change`&&n.invalidateQueries({queryKey:I.projects});for(let t of[..._s])t(e,r)});i.addEventListener(`health`,e=>{let t;try{t=JSON.parse(e.data)}catch{return}let r=Fr.safeParse(t);r.success&&(n.cancelQueries({queryKey:R.health}),n.setQueryData(R.health,r.data))}),i.addEventListener(`model-catalog`,e=>{let t;try{t=JSON.parse(e.data)}catch{return}let r=Br.safeParse(t);if(!r.success||r.data.runner!==`cursor`)return;let i=I.models(`cursor`);n.cancelQueries({queryKey:i}),n.setQueryData(i,r.data)}),i.addEventListener(`provider-status`,e=>{let t;try{t=JSON.parse(e.data)}catch{return}let r=ue(t);if(!r)return;let i=I.providerStatus,a=k(n.getQueryData(i),r);if(a!==void 0){n.setQueryData(i,a);return}if(f){p=!0;return}m()}),i.addEventListener(`error`,()=>{i?.readyState===ps&&h()})},_=()=>{document.visibilityState===`visible`&&(s.flush(),Cs(n),(!i||i.readyState===ps)&&(clearTimeout(l),l=void 0,g()))},v=()=>{clearTimeout(l),l=void 0,s.flush(),i?.close()},y=e=>{e.persisted&&(Cs(n),g())};return document.addEventListener(`visibilitychange`,_),window.addEventListener(`pagehide`,v),window.addEventListener(`pageshow`,y),g(),()=>{d=!0,clearTimeout(l),s.flush(),s.cancel(),a.cancel(),o.cancel(),c.cancel(),document.removeEventListener(`visibilitychange`,_),window.removeEventListener(`pagehide`,v),window.removeEventListener(`pageshow`,y),i?.close(),i=null}},[n,e,t])}var Ps=(0,Z.createContext)(null);function Fs({children:e}){let[t]=(0,Z.useState)(ds);return Ns(t),Sn(),(0,Q.jsx)(Ps.Provider,{value:t,children:e})}function Is(e){let t=(0,Z.useContext)(Ps),n=t?t.get:Rs;return(0,Z.useSyncExternalStore)(t?t.subscribe:Ls,()=>e?n()[e]:void 0,()=>void 0)}var Ls=()=>()=>void 0,Rs=()=>us;function zs(){return new ns({defaultOptions:{queries:{refetchInterval:!1,staleTime:5*6e4,gcTime:30*6e4,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:(e,t)=>t instanceof Or&&t.status>=400&&t.status<500?!1:e<1},mutations:{retry:!1}}})}var Bs=class extends Z.Component{state={error:null};static getDerivedStateFromError(e){return{error:e instanceof Error?e:Error(String(e))}}componentDidCatch(e,t){console.error(`cezar cockpit: uncaught render error`,e,t.componentStack)}render(){let{error:e}=this.state;return e?(0,Q.jsxs)(`div`,{"data-slot":`app-error`,role:`alert`,style:{display:`flex`,minHeight:`100dvh`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:`12px`,padding:`24px`,textAlign:`center`,font:`14px/1.5 system-ui, sans-serif`},children:[(0,Q.jsx)(`h1`,{style:{fontSize:`20px`,fontWeight:600,margin:0},children:`The cockpit hit an error`}),(0,Q.jsxs)(`p`,{style:{margin:0,maxWidth:`52ch`},children:[`Reload to carry on. Nothing on disk changed — cezar’s state lives in`,` `,(0,Q.jsx)(`code`,{children:`.ai/cezar/`}),`, and this page never wrote to it.`]}),(0,Q.jsx)(`pre`,{"data-slot":`app-error-detail`,style:{margin:0,maxWidth:`100%`,overflowX:`auto`,textAlign:`left`,opacity:.75},children:e.message}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>location.reload(),style:{padding:`6px 14px`,cursor:`pointer`},children:`Reload`})]}):this.props.children}},Vs=K(`bookmark`,[[`path`,{d:`M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z`,key:`oz39mx`}]]),Hs=K(`brush`,[[`path`,{d:`m11 10 3 3`,key:`fzmg1i`}],[`path`,{d:`M6.5 21A3.5 3.5 0 1 0 3 17.5a2.62 2.62 0 0 1-.708 1.792A1 1 0 0 0 3 21z`,key:`p4q2r7`}],[`path`,{d:`M9.969 17.031 21.378 5.624a1 1 0 0 0-3.002-3.002L6.967 14.031`,key:`wy6l02`}]]),Us=K(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),Ws=K(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Gs=K(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Ks=K(`chevrons-left`,[[`path`,{d:`m11 17-5-5 5-5`,key:`13zhaf`}],[`path`,{d:`m18 17-5-5 5-5`,key:`h8a8et`}]]),qs=K(`chevrons-right`,[[`path`,{d:`m6 17 5-5-5-5`,key:`xnjwq`}],[`path`,{d:`m13 17 5-5-5-5`,key:`17xmmf`}]]),Js=K(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]),Ys=K(`coins`,[[`path`,{d:`M13.744 17.736a6 6 0 1 1-7.48-7.48`,key:`bq4yh3`}],[`path`,{d:`M15 6h1v4`,key:`11y1tn`}],[`path`,{d:`m6.134 14.768.866-.5 2 3.464`,key:`17snzx`}],[`circle`,{cx:`16`,cy:`8`,r:`6`,key:`14bfc9`}]]),Xs=K(`compass`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}]]),Zs=K(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),Qs=K(`corner-left-up`,[[`path`,{d:`M14 9 9 4 4 9`,key:`1af5af`}],[`path`,{d:`M20 20h-7a4 4 0 0 1-4-4V4`,key:`1blwi3`}]]),$s=K(`dollar-sign`,[[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`22`,key:`7eqyqh`}],[`path`,{d:`M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6`,key:`1b0p4s`}]]),ec=K(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),tc=K(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),nc=K(`file-cog`,[[`path`,{d:`M15 8a1 1 0 0 1-1-1V2a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8z`,key:`1ckgky`}],[`path`,{d:`M20 8v12a2 2 0 0 1-2 2h-4.182`,key:`1726p0`}],[`path`,{d:`m3.305 19.53.923-.382`,key:`ao1pio`}],[`path`,{d:`M4 10.592V4a2 2 0 0 1 2-2h8`,key:`1foop0`}],[`path`,{d:`m4.228 16.852-.924-.383`,key:`1fv9zy`}],[`path`,{d:`m5.852 15.228-.383-.923`,key:`1a9hc2`}],[`path`,{d:`m5.852 20.772-.383.924`,key:`1sh9ke`}],[`path`,{d:`m8.148 15.228.383-.923`,key:`4yu6lf`}],[`path`,{d:`m8.53 21.696-.382-.924`,key:`18b0s9`}],[`path`,{d:`m9.773 16.852.922-.383`,key:`ti6xop`}],[`path`,{d:`m9.773 19.148.922.383`,key:`rws47d`}],[`circle`,{cx:`7`,cy:`18`,r:`3`,key:`lvkj7j`}]]),rc=K(`folder-git-2`,[[`path`,{d:`M18 19a5 5 0 0 1-5-5v8`,key:`sz5oeg`}],[`path`,{d:`M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5`,key:`1w6njk`}],[`circle`,{cx:`13`,cy:`12`,r:`2`,key:`1j92g6`}],[`circle`,{cx:`20`,cy:`19`,r:`2`,key:`1obnsp`}]]),ic=K(`folder-search`,[[`path`,{d:`M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1`,key:`1bw5m7`}],[`path`,{d:`m21 21-1.9-1.9`,key:`1g2n9r`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}]]),ac=K(`git-pull-request-arrow`,[[`circle`,{cx:`5`,cy:`6`,r:`3`,key:`1qnov2`}],[`path`,{d:`M5 9v12`,key:`ih889a`}],[`circle`,{cx:`19`,cy:`18`,r:`3`,key:`1qljk2`}],[`path`,{d:`m15 9-3-3 3-3`,key:`1lwv8l`}],[`path`,{d:`M12 6h5a2 2 0 0 1 2 2v7`,key:`1yj91y`}]]),oc=K(`id-card`,[[`path`,{d:`M16 10h2`,key:`8sgtl7`}],[`path`,{d:`M16 14h2`,key:`epxaof`}],[`path`,{d:`M6.17 15a3 3 0 0 1 5.66 0`,key:`n6f512`}],[`circle`,{cx:`9`,cy:`11`,r:`2`,key:`yxgjnd`}],[`rect`,{x:`2`,y:`5`,width:`20`,height:`14`,rx:`2`,key:`qneu4z`}]]),sc=K(`keyboard`,[[`path`,{d:`M10 8h.01`,key:`1r9ogq`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M14 8h.01`,key:`1primd`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}],[`path`,{d:`M18 8h.01`,key:`emo2bl`}],[`path`,{d:`M6 8h.01`,key:`x9i8wu`}],[`path`,{d:`M7 16h10`,key:`wp8him`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}]]),cc=K(`link`,[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]),lc=K(`list-checks`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]),uc=K(`memory-stick`,[[`path`,{d:`M12 12v-2`,key:`fwoke6`}],[`path`,{d:`M12 18v-2`,key:`qj6yno`}],[`path`,{d:`M16 12v-2`,key:`heuere`}],[`path`,{d:`M16 18v-2`,key:`s1ct0w`}],[`path`,{d:`M2 11h1.5`,key:`15p63e`}],[`path`,{d:`M20 18v-2`,key:`12ehxp`}],[`path`,{d:`M20.5 11H22`,key:`khsy7a`}],[`path`,{d:`M4 18v-2`,key:`1c3oqr`}],[`path`,{d:`M8 12v-2`,key:`1mwtfd`}],[`path`,{d:`M8 18v-2`,key:`qcmpov`}],[`rect`,{x:`2`,y:`6`,width:`20`,height:`10`,rx:`2`,key:`1qcswk`}]]),dc=K(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),fc=K(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),pc=K(`package-check`,[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`m16 17 2 2 4-4`,key:`uh5qu3`}],[`path`,{d:`M21 11.127V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.32-.753`,key:`kpkbpo`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}]]),mc=K(`panel-left-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m16 15-3-3 3-3`,key:`14y99z`}]]),hc=K(`panel-left-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]]),gc=K(`pin`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]),_c=K(`scale`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`m19 8 3 8a5 5 0 0 1-6 0zV7`,key:`zcdpyk`}],[`path`,{d:`M3 7h1a17 17 0 0 0 8-2 17 17 0 0 0 8 2h1`,key:`1yorad`}],[`path`,{d:`m5 8 3 8a5 5 0 0 1-6 0zV7`,key:`eua70x`}],[`path`,{d:`M7 21h10`,key:`1b0cd5`}]]),vc=K(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),yc=K(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),bc=K(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),xc=`cez-last-location`;function Sc(){try{let e=localStorage.getItem(xc);return e===null?null:JSON.parse(e)}catch{return null}}function Cc(e){try{localStorage.setItem(xc,JSON.stringify(e))}catch{}}var wc=new Set([`projectId`,`pathname`,`search`,`hash`]);function Tc(e){if(typeof e!=`object`||!e||Array.isArray(e))return null;let t=e;if(Object.keys(t).some(e=>!wc.has(e))||typeof t.projectId!=`string`||t.projectId.length<1||t.projectId.length>64||typeof t.pathname!=`string`||t.pathname.length<1||t.pathname.length>2048||!t.pathname.startsWith(`/p/`)||t.search!==void 0&&(typeof t.search!=`string`||t.search.length>4096||!t.search.startsWith(`?`))||t.hash!==void 0&&(typeof t.hash!=`string`||t.hash.length>2048||!t.hash.startsWith(`#`)))return null;try{if(Va(t.pathname)!==t.projectId)return null}catch{return null}return{projectId:t.projectId,pathname:t.pathname,...t.search===void 0?{}:{search:t.search},...t.hash===void 0?{}:{hash:t.hash}}}function Ec(e,t){let n=t.projects.find(t=>t.id===e);return n!==void 0&&n.status!==`missing`}function Dc(e,t){if(t===void 0)return null;let n;try{n=Va(e.pathname)}catch{return null}return n===null||!Ec(n,t)?null:Tc({projectId:n,pathname:e.pathname,...e.search===``?{}:{search:e.search},...e.hash===``?{}:{hash:e.hash}})}function Oc(e,t,n){let r=Tc(e);return r===null||!(t===void 0?n!==void 0&&r.projectId===n:Ec(r.projectId,t))?null:`${r.pathname}${r.search??``}${r.hash??``}`}function kc(e,t){let n=Tc(e);return n!==null&&n.projectId===t.projectId&&n.pathname===t.pathname&&(n.search??``)===(t.search??``)&&(n.hash??``)===(t.hash??``)}var Ac=`cez-project-locations`;function jc(){try{let e=localStorage.getItem(Ac),t=e===null?null:JSON.parse(e);return typeof t==`object`&&t&&!Array.isArray(t)?t:{}}catch{return{}}}function Mc(e){let t=jc()[e];return t===void 0?null:t}function Nc(e){try{localStorage.setItem(Ac,JSON.stringify({...jc(),[e.projectId]:e}))}catch{}}function Pc(e,t,n){let r=Tc(t);return r===null||r.projectId!==e||n===void 0||!Ec(e,n)?null:`${r.pathname}${r.search??``}${r.hash??``}`}function Fc(){return(0,Q.jsx)(`div`,{"data-route":`compare`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(W,{icon:(0,Q.jsx)(La,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading variants…`,subtitle:`Fetching every variant's status, spend and diff summary.`})})}function Ic(){return(0,Q.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(W,{icon:(0,Q.jsx)(La,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading GitHub…`,subtitle:`Fetching open issues and pull requests.`})})}var Lc=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),Rc=`VisuallyHidden`,zc=Z.forwardRef((e,t)=>(0,Q.jsx)(we.span,{...e,ref:t,style:{...Lc,...e.style}}));zc.displayName=Rc;var Bc=zc;function Vc(e){let t=Z.useRef({value:e,previous:e});return Z.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Hc=`Label`,Uc=Z.forwardRef((e,t)=>(0,Q.jsx)(we.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));Uc.displayName=Hc;var Wc=Uc,Gc=`Switch`,[Kc,qc]=gn(Gc),[Jc,Yc]=Kc(Gc);function Xc(e){let{__scopeSwitch:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=Me({prop:n,defaultProp:i??!1,onChange:c,caller:Gc}),[m,h]=Z.useState(null),[g,_]=Z.useState(null),v={checked:f,setChecked:p,disabled:a,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:Z.useRef(!1),required:l,defaultChecked:i,isFormControl:!m||!!o||!!m.closest(`form`),bubbleInput:g,setBubbleInput:_};return(0,Q.jsx)(Jc,{scope:t,...v,children:il(d)?d(v):r})}var Zc=`SwitchTrigger`,Qc=Z.forwardRef(({__scopeSwitch:e,onClick:t,...n},r)=>{let{control:i,form:a,value:o,disabled:s,checked:c,required:l,setControl:d,setChecked:f,hasConsumerStoppedPropagationRef:p,isFormControl:m,bubbleInput:h}=Yc(Zc,e),g=Ve(r,d),_=Z.useRef(c);return Z.useEffect(()=>{let e=a?i?.ownerDocument.getElementById(a):i?.form;if(e instanceof HTMLFormElement){let t=()=>f(_.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[i,a,f]),(0,Q.jsx)(we.button,{type:`button`,role:`switch`,"aria-checked":c,"aria-required":l,"data-state":al(c),"data-disabled":s?``:void 0,disabled:s,value:o,...n,ref:g,onClick:u(t,e=>{f(e=>!e),h&&m&&(p.current=e.isPropagationStopped(),p.current||e.stopPropagation())})})});Qc.displayName=Zc;var $c=Z.forwardRef((e,t)=>{let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,Q.jsx)(Xc,{__scopeSwitch:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Qc,{...d,ref:t,__scopeSwitch:n}),e&&(0,Q.jsx)(rl,{__scopeSwitch:n})]})})});$c.displayName=Gc;var el=`SwitchThumb`,tl=Z.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=Yc(el,n);return(0,Q.jsx)(we.span,{"data-state":al(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});tl.displayName=el;var nl=`SwitchBubbleInput`,rl=Z.forwardRef(({__scopeSwitch:e,...t},n)=>{let{control:r,hasConsumerStoppedPropagationRef:i,checked:a,defaultChecked:o,required:s,disabled:c,name:l,value:u,form:d,bubbleInput:f,setBubbleInput:p}=Yc(nl,e),m=Ve(n,p),h=Vc(a),g=Ja(r);Z.useEffect(()=>{let e=f;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!i.current;if(h!==a&&n){let t=new Event(`click`,{bubbles:r});n.call(e,a),e.dispatchEvent(t)}},[f,h,a,i]);let _=Z.useRef(a);return(0,Q.jsx)(we.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:o??_.current,required:s,disabled:c,name:l,value:u,form:d,...t,tabIndex:-1,ref:m,style:{...t.style,...g,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});rl.displayName=nl;function il(e){return typeof e==`function`}function al(e){return e?`checked`:`unchecked`}var ol=`Tabs`,[sl,cl]=gn(ol,[to]),ll=to(),[ul,dl]=sl(ol),fl=Z.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=qa(s),[d,f]=Me({prop:r,onChange:i,defaultProp:a??``,caller:ol});return(0,Q.jsx)(ul,{scope:n,baseId:E(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,Q.jsx)(we.div,{dir:u,"data-orientation":o,...l,ref:t})})});fl.displayName=ol;var pl=`TabsList`,ml=Z.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=dl(pl,n),o=ll(n);return(0,Q.jsx)(no,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,Q.jsx)(we.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});ml.displayName=pl;var hl=`TabsTrigger`,gl=Z.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=dl(hl,n),s=ll(n),c=yl(o.baseId,r),l=bl(o.baseId,r),d=r===o.value;return(0,Q.jsx)(ao,{asChild:!0,...s,focusable:!i,active:d,children:(0,Q.jsx)(we.button,{type:`button`,role:`tab`,"aria-selected":d,"aria-controls":l,"data-state":d?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:u(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:u(e.onKeyDown,e=>{i||e.target!==e.currentTarget||[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:u(e.onFocus,()=>{let e=o.activationMode!==`manual`;!d&&!i&&e&&o.onValueChange(r)})})})});gl.displayName=hl;var _l=`TabsContent`,vl=Z.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=dl(_l,n),c=yl(s.baseId,r),l=bl(s.baseId,r),u=r===s.value,d=Z.useRef(u);return Z.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,Q.jsx)(S,{present:i||u,children:({present:n})=>(0,Q.jsx)(we.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})});vl.displayName=_l;function yl(e,t){return`${e}-trigger-${t}`}function bl(e,t){return`${e}-content-${t}`}var xl=fl,Sl=ml,Cl=gl,wl=vl,[Tl,El]=gn(`Tooltip`,[mo]),Dl=mo(),Ol=`TooltipProvider`,kl=700,Al=`tooltip.open`,[jl,Ml]=Tl(Ol),Nl=e=>{let{__scopeTooltip:t,delayDuration:n=kl,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=Z.useRef(!0),s=Z.useRef(!1),c=Z.useRef(0);return Z.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,Q.jsx)(jl,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:Z.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:Z.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:Z.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};Nl.displayName=Ol;var Pl=`Tooltip`,[Fl,Il]=Tl(Pl),Ll=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=Ml(Pl,e.__scopeTooltip),l=Dl(t),[u,d]=Z.useState(null),f=E(),p=Z.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=Z.useRef(!1),[_,v]=Me({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(Al))):c.onClose(),a?.(e)},caller:Pl}),y=Z.useMemo(()=>_?g.current?`delayed-open`:`instant-open`:`closed`,[_]),b=Z.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,v(!0)},[v]),x=Z.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),S=Z.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,v(!0),p.current=0},h)},[h,v]);return Z.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,Q.jsx)(Za,{...l,children:(0,Q.jsx)(Fl,{scope:t,contentId:f,open:_,stateAttribute:y,trigger:u,onTriggerChange:d,onTriggerEnter:Z.useCallback(()=>{c.isOpenDelayedRef.current?S():b()},[c.isOpenDelayedRef,S,b]),onTriggerLeave:Z.useCallback(()=>{m?x():(window.clearTimeout(p.current),p.current=0)},[x,m]),onOpen:b,onClose:x,disableHoverableContent:m,children:n})})};Ll.displayName=Pl;var Rl=`TooltipTrigger`,zl=Z.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Il(Rl,n),a=Ml(Rl,n),o=Dl(n),s=Ve(t,Z.useRef(null),i.onTriggerChange),c=Z.useRef(!1),l=Z.useRef(!1),d=Z.useCallback(()=>c.current=!1,[]);return Z.useEffect(()=>()=>document.removeEventListener(`pointerup`,d),[d]),(0,Q.jsx)(Ya,{asChild:!0,...o,children:(0,Q.jsx)(we.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:u(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:u(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:u(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,d,{once:!0})}),onFocus:u(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:u(e.onBlur,i.onClose),onClick:u(e.onClick,i.onClose)})})});zl.displayName=Rl;var Bl=`TooltipPortal`,[Vl,Hl]=Tl(Bl,{forceMount:void 0}),Ul=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=Il(Bl,t);return(0,Q.jsx)(Vl,{scope:t,forceMount:n,children:(0,Q.jsx)(S,{present:n||a.open,children:(0,Q.jsx)(Ge,{asChild:!0,container:i,children:r})})})};Ul.displayName=Bl;var Wl=`TooltipContent`,Gl=Z.forwardRef((e,t)=>{let n=Hl(Wl,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=Il(Wl,e.__scopeTooltip);return(0,Q.jsx)(S,{present:r||o.open,children:o.disableHoverableContent?(0,Q.jsx)(Xl,{side:i,...a,ref:t}):(0,Q.jsx)(Kl,{side:i,...a,ref:t})})}),Kl=Z.forwardRef((e,t)=>{let n=Il(Wl,e.__scopeTooltip),r=Ml(Wl,e.__scopeTooltip),i=Z.useRef(null),a=Ve(t,i),[o,s]=Z.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=Z.useCallback(()=>{s(null),d(!1)},[d]),p=Z.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=eu(r,$l(r,n.getBoundingClientRect())),a=tu(t.getBoundingClientRect()),o=ru([...i,...a]);s(o),d(!0)},[d]);return Z.useEffect(()=>()=>f(),[f]),Z.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),Z.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!nu(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,Q.jsx)(Xl,{...e,ref:a})}),[ql,Jl]=Tl(Pl,{isInside:!1}),Yl=le(`TooltipContent`),Xl=Z.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=Il(Wl,n),l=Dl(n),{onClose:u}=c;return Z.useEffect(()=>(document.addEventListener(Al,u),()=>document.removeEventListener(Al,u)),[u]),Z.useEffect(()=>{if(c.trigger){let e=e=>{e.target instanceof Node&&e.target.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,Q.jsx)(vr,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,Q.jsxs)(ho,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,Q.jsx)(Yl,{children:r}),(0,Q.jsx)(ql,{scope:n,isInside:!0,children:(0,Q.jsx)(Bc,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});Gl.displayName=Wl;var Zl=`TooltipArrow`,Ql=Z.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Dl(n);return Jl(Zl,n).isInside?null:(0,Q.jsx)(po,{...i,...r,ref:t})});Ql.displayName=Zl;function $l(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function eu(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function tu(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function nu(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function ru(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),iu(t)}function iu(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var au=Nl,ou=Ll,su=zl,cu=Ul,lu=Gl,uu=Ql;function du(e){let t=ge(),n=Dn(),r=jr(t.data),i=n.data?.defaultRunner,a=oa(e.runner,r,i??r[0]??`claude`),o=_r(a),s=n.data?.modelsLocked===!0,{accounts:c,repoAccount:l}=Ga(),u=c.some(t=>t.provider===a&&t.id===e.account)?e.account:null,d=xa(s?null:e.model,a,n.data?.defaultModels,o.data),f=na(a,d,o.data);return{runner:a,runnerExplicit:e.runner!==null,model:d,effort:s?``:$i(e.effort,f),effortOptions:f,runners:r,defaultRunner:i,canRun:t.isSuccess&&r.length>0,modelsLocked:s,providerPending:t.isPending,providerError:t.isError,accounts:c,account:u,repoAccount:l}}function fu(e){return{runner:la(e.runner,e.defaultRunner,e.runnerExplicit),model:e.modelsLocked?void 0:e.model||void 0,effort:e.modelsLocked?void 0:e.effort||void 0}}function pu(e){return{...fu(e),...e.account?{agentProfile:e.account}:{}}}function mu({pick:e,onChange:t,disabled:n=!1,accounts:r=!1}){let i=du(e),{runner:a,model:o,effort:s,effortOptions:c,runners:l,canRun:u,modelsLocked:d}=i,f=Dn(),p=_r(a),m=ca(a,p.data,[e.model,f.data?.defaultModels?.[a]]),h=n||!u,g=r?i.accounts:[];return(0,Q.jsxs)(Aa,{children:[l.length>1||l.some(e=>Ka(g,e))?(0,Q.jsx)(Na,{icon:(0,Q.jsx)(Yn,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,runners:l,value:a,accounts:g,account:r?i.account:null,repoAccount:r?i.repoAccount:void 0,disabled:h,onPick:(n,i)=>t(r?{runner:n,account:i,model:n===a?e.model:null,effort:e.effort}:{runner:n,account:null,model:null,effort:e.effort})}):null,(0,Q.jsx)(pa,{icon:(0,Q.jsx)(Lt,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`model-pill`,ariaLabel:`Model`,label:o===``?`Default`:m.find(e=>e.id===o).label,value:o,disabled:h,readOnly:d===!0,disabledHint:d?`Model selection is locked to native coding-agent settings.`:void 0,onPick:n=>{let r=na(a,n,p.data);t({...e,model:n,effort:e.effort===null?null:$i(e.effort,r)})},options:m.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:ta(a,p.data,p.isError,p.isFetching)}),(0,Q.jsx)(pa,{icon:(0,Q.jsx)(fn,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`effort-pill`,ariaLabel:`Effort`,label:c.find(e=>e.value===s)?.label??`auto`,value:s,disabled:h,readOnly:d===!0,disabledHint:d?`Effort selection is locked to native coding-agent settings.`:void 0,onPick:n=>t({...e,effort:n}),options:c.map(e=>({value:e.value,label:e.label,desc:e.desc}))})]})}function hu({templates:e,onInsert:t,triggerClassName:n,disabled:r,iconOnly:i=!1,label:a=`Template`}){let[o,s]=(0,Z.useState)(!1),c=(0,Z.useRef)(null),l=Ua();return e.length===0?null:(0,Q.jsxs)(Yi,{open:o,onOpenChange:s,children:[(0,Q.jsx)(Ki,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`prompt-template-trigger`,"aria-label":`Insert a prompt template`,title:`Insert a prompt template`,disabled:r,className:G(`inline-flex h-[26px] items-center gap-1.5 rounded-full border border-border bg-card text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-50`,i?`w-[26px] justify-center px-0`:`h-11 gap-2 rounded-lg px-3 text-foreground`,n),children:[(0,Q.jsx)(Oe,{"aria-hidden":`true`,className:i?`size-3 shrink-0 text-accent-icon`:`size-[18px] shrink-0 text-muted-foreground`}),i?null:(0,Q.jsxs)(Q.Fragment,{children:[a,(0,Q.jsx)(pt,{"aria-hidden":`true`,className:`size-[13px] shrink-0 text-soft-foreground`})]})]})}),(0,Q.jsx)(Ji,{align:`start`,sideOffset:8,"data-slot":`prompt-template-menu`,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,onCloseAutoFocus:e=>e.preventDefault(),children:(0,Q.jsxs)(ga,{filter:Co,children:[(0,Q.jsx)(_a,{placeholder:`search templates…`,onInput:()=>c.current?.scrollTo(0,0)}),(0,Q.jsxs)(wa,{ref:c,"data-slot":`prompt-template-list-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,Q.jsx)(ka,{children:`Nothing matches.`}),(0,Q.jsx)(J,{heading:`Insert a template`,children:e.map(e=>(0,Q.jsxs)(Y,{value:`template ${e.label} ${e.id}`,keywords:[e.text,...e.skills??[]],"data-slot":`prompt-template-option`,"data-template":e.id,title:e.text,className:`flex-col items-start gap-0.5`,onSelect:()=>{t(e.text),s(!1)},children:[(0,Q.jsxs)(`span`,{className:`flex w-full items-center gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] font-medium text-foreground`,children:e.label}),e.skills&&e.skills.length>0?(0,Q.jsxs)(`span`,{"data-slot":`prompt-template-assigned`,title:`Applied automatically with: ${e.skills.join(`, `)}`,className:`inline-flex shrink-0 items-center gap-0.5 text-[12px] font-medium text-accent-text`,children:[(0,Q.jsx)(rt,{"aria-hidden":`true`,className:`size-2.5`}),e.skills.length]}):null]}),(0,Q.jsx)(`span`,{className:`line-clamp-1 text-[11px] text-soft-foreground`,children:e.text})]},e.id))}),(0,Q.jsx)(ya,{}),(0,Q.jsx)(J,{children:(0,Q.jsx)(Y,{value:`edit prompt templates settings`,"data-slot":`prompt-template-settings`,className:`text-[12px] text-muted-foreground`,onSelect:()=>{s(!1),l(`/settings/prompt-templates`)},children:`Edit templates…`})})]})]})})]})}function gu(e){return e.filter(e=>!e.startedTaskId)}function _u(e){return e.runnable??!!(e.suggestedSkill||e.suggestedPrompt)}function vu(){let e=P(),t=e.data?.capabilities.followups===!0,n=e.data!==void 0&&!t,r=D(!n),i=Ar(),a=Tt(),o=V().data?.projects?.find(e=>e.id===a)?.name,s=r.data===void 0?void 0:gu(r.data);return(0,Q.jsxs)(`div`,{"data-route":`inbox`,"data-inbox-empty":s?.length===0&&!n,className:`task-flow-page flex min-h-full flex-col`,children:[(0,Q.jsxs)(`header`,{className:`flex shrink-0 flex-col gap-5`,children:[(0,Q.jsx)(`h1`,{className:`text-[28px] font-medium`,children:`Inbox`}),(0,Q.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:n?`Disabled for this server; per-task Notes still run.`:`Follow-ups from your agents. Review the suggestion, then start a new task.`})]}),(0,Q.jsx)(`div`,{className:`flex flex-1 flex-col`,children:n?(0,Q.jsx)(W,{icon:(0,Q.jsx)(xr,{}),tone:`neutral`,title:`Inbox is off`,subtitle:`Agents are not asked to leave follow-ups. Set CEZ_FOLLOWUPS=1 and restart Cezarion to enable Inbox.`,heading:`h2`}):s===void 0?r.isError?(0,Q.jsx)(W,{icon:(0,Q.jsx)(xt,{}),tone:`danger`,title:`Could not load the inbox`,subtitle:r.error.message,actions:(0,Q.jsx)(z,{variant:`outline`,onClick:()=>void r.refetch(),children:`Retry`}),heading:`h2`}):(0,Q.jsx)(`div`,{role:`status`,className:`rounded-xl border border-border bg-card p-6 text-sm text-muted-foreground`,children:`Loading follow-ups…`}):s.length===0?e.isPending?null:(0,Q.jsx)(W,{icon:(0,Q.jsx)(xr,{}),tone:`neutral`,title:`You’re all caught up`,subtitle:`No follow-ups to review. New suggestions and notes from your agents will appear here.`,heading:`h2`}):(0,Q.jsx)(`ul`,{"data-slot":`todo-list`,className:`flex w-full flex-col gap-5`,children:s.map(e=>(0,Q.jsx)(yu,{todo:e,projectName:o,sourceTaskExists:e.taskId===void 0?null:i.data?.some(t=>t.id===e.taskId)??!1},e.id))})})]})}function yu({todo:e,projectName:t,sourceTaskExists:n}){let r=Ua(),i=U(),a=w(),[o,s]=(0,Z.useState)({runner:null,model:null,effort:null,account:null}),c=du(o),[l,u]=(0,Z.useState)(!1),[d,f]=(0,Z.useState)(``),p=(0,Z.useRef)(null),m=ma(a.data?.promptTemplates),h=e=>{let t=p.current?.selectionStart??d.length,n=Da(d,t,e);f(n.text),requestAnimationFrame(()=>{p.current?.focus(),p.current?.setSelectionRange(n.caret,n.caret)})},g=H({mutationFn:async()=>c.canRun?_n(e.id,{...fu(c),prompt:d.trim()||void 0}):null,onSuccess:e=>{if(e===null)return;let{run:t}=e;i.invalidateQueries({queryKey:R.todos}),i.invalidateQueries({queryKey:R.runs.all}),r(`/tasks/${t.id}`)},onError:e=>F(e.message,{tone:`danger`})}),_=H({mutationFn:()=>Ye(e.id),onSuccess:()=>{i.setQueryData(R.todos,t=>t?.filter(t=>t.id!==e.id)),i.invalidateQueries({queryKey:R.todos})},onError:e=>F(e.message,{tone:`danger`})}),v=g.isPending||_.isPending,y=_u(e);return(0,Q.jsxs)(`li`,{"data-slot":`todo-card`,"data-runnable":y,"data-id":e.id,className:`flex flex-col gap-2.5 rounded-lg border border-border bg-card p-4 shadow-xs`,children:[(0,Q.jsx)(`div`,{className:`flex items-start gap-3`,children:(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`p`,{"data-slot":`todo-summary`,className:`text-sm leading-snug font-medium text-foreground`,children:e.summary}),(0,Q.jsxs)(`div`,{"data-slot":`todo-meta`,className:`mt-1.5 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-soft-foreground`,children:[t?(0,Q.jsx)(`span`,{children:t}):null,(0,Q.jsx)(`span`,{children:y?`Runnable follow-up`:`Note only`}),e.ts?(0,Q.jsxs)(`span`,{children:[Ba(e.ts),` ago`]}):null,e.action?(0,Q.jsx)(`span`,{children:e.action}):null,e.taskId===void 0?null:n?(0,Q.jsxs)(X,{to:`/tasks/${e.taskId}`,"data-slot":`todo-source`,className:`text-muted-foreground underline decoration-border underline-offset-2 hover:text-foreground`,children:[`Source task `,(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:`↗`})]}):(0,Q.jsx)(`span`,{"data-slot":`todo-source-gone`,children:`source task deleted`}),Hr(e.prUrl)?(0,Q.jsx)(`a`,{href:e.prUrl,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`todo-pr`,className:`text-muted-foreground underline decoration-border underline-offset-2 hover:text-foreground`,children:`PR`}):null,e.suggestedSkill?(0,Q.jsxs)(`span`,{"data-slot":`todo-skill`,className:`font-mono`,children:[`skill: `,e.suggestedSkill]}):null]})]})}),y&&e.suggestedPrompt&&e.suggestedPrompt!==e.summary?(0,Q.jsx)(`p`,{"data-slot":`todo-prompt`,className:`whitespace-pre-wrap break-words text-[13px] leading-relaxed text-muted-foreground`,children:e.suggestedPrompt}):null,y?(0,Q.jsxs)(`div`,{"data-slot":`todo-engine`,className:`flex flex-wrap items-center gap-2 pl-5`,children:[(0,Q.jsx)(mu,{pick:o,onChange:s,disabled:v||!c.canRun}),!c.providerPending&&!c.canRun?(0,Q.jsxs)(`span`,{"data-slot":`todo-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[c.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this follow-up.`,(0,Q.jsx)(X,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null]}):null,y?l?(0,Q.jsxs)(`div`,{"data-slot":`todo-instructions`,className:`flex flex-col gap-2 pl-5`,children:[(0,Q.jsx)(`label`,{htmlFor:`todo-instructions-${e.id}`,className:`text-xs text-muted-foreground`,children:`Additional instructions`}),(0,Q.jsx)(So,{ref:p,id:`todo-instructions-${e.id}`,"data-slot":`todo-instructions-input`,"aria-label":`Extra instructions for this follow-up`,value:d,onChange:e=>f(e.target.value),placeholder:`Add instructions for the agent… (appended to the suggestion above)`,maxLength:2e4,className:`min-h-11 text-[13px]`})]}):(0,Q.jsx)(`button`,{type:`button`,"data-slot":`todo-instructions-toggle`,onClick:()=>u(!0),className:`self-start pl-5 text-xs font-medium text-muted-foreground underline decoration-border underline-offset-2 hover:text-foreground`,children:d.trim()?`Edit instructions (added)`:`+ Add instructions`}):null,(0,Q.jsxs)(`div`,{"data-slot":`todo-actions`,className:`flex flex-wrap items-center gap-3`,children:[y&&l?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(hu,{templates:m,onInsert:h}),(0,Q.jsx)(z,{type:`button`,variant:`outline`,"data-slot":`todo-instructions-hide`,onClick:()=>u(!1),children:`Hide instructions`})]}):null,y?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(z,{type:`button`,variant:`primary`,size:`sm`,"data-action":`todo-run`,title:`Start a task from this follow-up`,disabled:v||!c.canRun,onClick:()=>g.mutate(),children:`Run follow-up`}),(0,Q.jsx)(z,{type:`button`,variant:`outline`,size:`sm`,"data-action":`todo-dismiss`,title:`Check off (remove)`,disabled:v,onClick:()=>_.mutate(),children:`Dismiss`})]}):(0,Q.jsx)(z,{type:`button`,variant:`outline`,size:`sm`,"data-action":`todo-acknowledge`,title:`Acknowledge and remove this note`,disabled:v,onClick:()=>_.mutate(),children:`Acknowledge`})]})]})}function bu({source:e,className:t}){return(0,Q.jsx)(`span`,{"data-slot":`skill-source`,"data-source":e,className:G(`shrink-0 rounded bg-accent-strong/10 px-2 py-1 text-[12px]`,Do({source:e})?`font-semibold text-foreground`:`text-soft-foreground`,t),children:e===`team`?`Team`:e})}function xu({skill:e,usedBy:t,heading:n=`h2`}){return(0,Q.jsxs)(`div`,{"data-slot":`skill-detail`,className:`min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col items-start gap-4`,children:[(0,Q.jsxs)(`span`,{className:`sw-detail-source text-[12px]`,children:[(0,Q.jsx)(bu,{source:e.source}),` skill`]}),(0,Q.jsx)(n,{className:`min-w-0 text-[19px] font-normal md:text-2xl break-words [overflow-wrap:anywhere]`,children:e.name})]}),(0,Q.jsxs)(`p`,{"data-slot":`skill-path`,className:`mt-4 text-[12px] break-all text-soft-foreground`,children:[e.path,e.team?` · from ${e.team.repo}`:``]}),e.description?(0,Q.jsx)(`p`,{"data-slot":`skill-description`,className:`mt-2.5 text-[13px] text-muted-foreground`,children:e.description}):null,t===void 0?null:(0,Q.jsxs)(`section`,{"data-slot":`skill-used-by`,className:`mt-5`,children:[(0,Q.jsx)(`h3`,{className:`text-[13px] font-semibold`,children:`Used by`}),t.length>0?(0,Q.jsx)(`ul`,{className:`mt-1.5 flex flex-col gap-1`,children:t.map(e=>(0,Q.jsxs)(`li`,{className:`flex items-center gap-1.5 font-mono text-xs text-muted-foreground`,children:[(0,Q.jsx)(lt,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),e]},e))}):(0,Q.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:`Not referenced by a workflow yet. quick-task can use it when the task mentions it.`})]}),(0,Q.jsx)(`section`,{className:`mt-5`,children:(0,Q.jsx)(`div`,{"data-slot":`skill-body`,className:`mt-2 text-sm`,children:(0,Q.jsx)(Wo,{children:e.body})})})]})}function Su({skill:e,onClose:t}){return(0,Q.jsx)(vo,{open:e!==null,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsx)(bo,{"data-slot":`skill-preview`,className:`block max-h-[80dvh] overflow-y-auto sm:max-w-2xl`,children:e?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(xo,{className:`sr-only`,children:e.name}),(0,Q.jsx)(_o,{className:`sr-only`,children:`Read-only skill preview`}),(0,Q.jsx)(xu,{skill:e,heading:`h3`}),(0,Q.jsx)(`p`,{className:`mt-5`,children:(0,Q.jsx)(X,{to:`/skills?skill=${encodeURIComponent(e.name)}`,"data-slot":`skill-preview-manage`,onClick:t,className:`text-xs font-semibold text-accent-text hover:underline`,children:`Open in the Skills catalog`})})]}):null})})}function Cu(e,t,n){let r=e.skill===``?{source:`workflow`,ref:`quick-task`}:{source:`skill`,ref:e.skill};return fa({task:e.ref,source:r,model:``,runner:t,defaultRunner:n,variants:1,images:[],todoId:e.todo})}function wu(e,t){return e.kind===`failed`?{message:`Auto-start failed: ${e.message} — review and press Start`,tone:`danger`}:e.kind===`blocked`?{message:`Auto-start blocked (bad key) — review and press Start`,tone:`danger`}:t===``?{message:`Prefilled from link — review and press Start`,tone:`default`}:{message:`Unknown skill "${t}" — prefilled for quick-task; review and press Start`,tone:`danger`}}function Tu(e,t){return`Use the "${e}" skill on: ${t}`}function Eu(e){let t=e.configuredAutonomous===`source-dependent`?e.source===`skill`:e.configuredAutonomous,n=e.interactive!==!0&&void 0;return{autonomous:e.planFirst?!1:e.explicitAutonomous??n??t,worktree:e.hasGit?e.variants>1?!0:e.explicitWorktree??n??e.configuredWorktree:!1}}function Du(e){return e.worktree?`Runs in an isolated worktree — review everything before it lands.`:e.hasGit?`Runs in the repo working tree — your checkout is modified directly.`:`Runs in place — no git repository detected, so there is no worktree to isolate in.`}var Ou={text:``,source:null,runner:null,agentProfile:null,model:null,effort:null,variants:1,planFirst:!1,worktree:null,autonomous:null,generateFollowups:null},ku=`cez-new-task-draft`;function Au(e){return e===null?ku:`${ku}:${e}`}function ju(e){let t=e&&typeof e==`object`?e:{};return{text:typeof t.text==`string`?t.text:``,source:Mu(t.source)?t.source:null,runner:typeof t.runner==`string`?t.runner:null,agentProfile:typeof t.agentProfile==`string`?t.agentProfile:null,model:typeof t.model==`string`?t.model:null,effort:typeof t.effort==`string`?t.effort:null,variants:t.variants===2||t.variants===3?t.variants:1,planFirst:t.planFirst===!0,worktree:typeof t.worktree==`boolean`?t.worktree:null,autonomous:typeof t.autonomous==`boolean`?t.autonomous:null,generateFollowups:typeof t.generateFollowups==`boolean`?t.generateFollowups:null}}function Mu(e){return!!e&&typeof e==`object`&&(e.source===`skill`||e.source===`workflow`)&&typeof e.ref==`string`}var Nu=new Map,Pu=new Map;function Fu(e=null){return Pu.get(Au(e))??0}function Iu(e=null){let t=Au(e),n=Nu.get(t);if(n)return{...n};let r;try{let e=localStorage.getItem(t);r=e?ju(JSON.parse(e)):{...Ou}}catch{r={...Ou}}return Nu.set(t,r),{...r}}function Lu(e,t=null){let n=Au(t);Pu.set(n,Fu(t)+1),Nu.set(n,{...e});try{localStorage.setItem(n,JSON.stringify(e))}catch{}}function Ru(e=null,t){t!==void 0&&Fu(e)!==t||Lu({...Iu(e),text:``,source:null},e)}function zu(e){let t=typeof e==`string`?new URLSearchParams(e):e;return{skill:(t.get(`skill`)??``).trim(),ref:(t.get(`ref`)??t.get(`task`)??``).trim(),auto:t.get(`auto`)===`1`,key:t.get(`key`)??``,todo:(t.get(`todo`)??``).trim()}}function Bu(e,t,n){return{task:e,steps:[...n.steps],rationale:n.rationale,fallback:n.fallback,images:[...t]}}function Vu(e,t){return!Number.isInteger(t)||t<0||t>=e.length?[...e]:e.filter((e,n)=>n!==t)}function Hu(e,t,n){let r=[...e];if(!Number.isInteger(t)||t<0||t>=r.length)return r;let i=Math.max(0,Math.min(r.length-1,n));if(i===t)return r;let[a]=r.splice(t,1);return r.splice(i,0,a),r}function Uu(e){return e.command??e.prompt??``}function Wu(e,t=120){let n=e.split(`
3
- `)[0]??``;return n.length>t?`${n.slice(0,t-1)}…`:n}function Gu(e){let{task:t,steps:n,model:r,modelsLocked:i,effort:a,runner:o,runnerExplicit:s,defaultRunner:c,variants:l,images:u,generateFollowups:d,todoId:f}=e;return{task:t,steps:[...n],model:i?void 0:r||void 0,effort:i?void 0:a||void 0,runner:la(o,c,s),variants:l>1?l:void 0,images:u.length>0?[...u]:void 0,generateFollowups:d!==!1&&void 0,todoId:f||void 0}}function Ku({className:e,type:t,...n}){return(0,Q.jsx)(`input`,{type:t,"data-slot":`input`,className:G(`h-11 w-full min-w-0 rounded-md border border-input bg-[var(--task-brand-bg)] px-3 py-1 text-base shadow-none transition-[color,box-shadow] outline-none selection:bg-accent-strong selection:text-accent-strong-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-soft-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm`,`focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,`aria-invalid:border-destructive aria-invalid:ring-destructive/20`,e),...n})}function qu({plan:e,starting:t,startAvailable:n,startUnavailableReason:r,startUnavailableAction:i,onStepsChange:a,onStart:o,onDiscard:s}){let[c,l]=(0,Z.useState)(null),[u,d]=(0,Z.useState)(null),f=(0,Z.useRef)(null),p=(0,Z.useId)();(0,Z.useEffect)(()=>{f.current?.focus({preventScroll:!0});let e=f.current?.closest(`[data-slot="main"]`);e&&(e.scrollTop=0)},[]);let m=()=>{l(null),d(null)},h=(t,n)=>{t.preventDefault(),c!==null&&c!==n&&a(Hu(e.steps,c,n)),m()},g=e.steps.length===0;return(0,Q.jsxs)(`div`,{"data-slot":`plan-page`,children:[(0,Q.jsxs)(`header`,{"data-slot":`plan-page-header`,children:[(0,Q.jsx)(`h1`,{children:`New task / Plan first`}),(0,Q.jsx)(`p`,{children:`Review the proposed chain before launching.`})]}),(0,Q.jsx)(`div`,{"data-slot":`plan-canvas`,children:(0,Q.jsxs)(`section`,{ref:f,tabIndex:-1,"aria-labelledby":p,"data-slot":`plan-review`,className:`flex flex-col outline-none`,onKeyDown:e=>{e.key!==`Escape`||e.defaultPrevented||e.target.closest(`[role="dialog"], [role="alertdialog"]`)||(e.preventDefault(),s())},children:[(0,Q.jsxs)(`header`,{"data-slot":`dialog-header`,className:`flex flex-col gap-1 px-5 pt-4 pb-3.5 text-left`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Q.jsx)(`h2`,{id:p,"data-slot":`dialog-title`,className:`text-[11px] font-semibold tracking-[0.08em] text-muted-foreground uppercase`,children:`Proposed chain`}),(0,Q.jsx)(`button`,{type:`button`,onClick:s,"aria-label":`Discard the plan`,className:`-mt-1 -mr-1 rounded-md p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:(0,Q.jsx)(or,{"aria-hidden":`true`,className:`size-4`})})]}),(0,Q.jsx)(`p`,{"data-slot":`plan-task`,title:e.task,className:`text-[18px] font-medium text-foreground`,children:Wu(e.task)}),e.fallback?(0,Q.jsx)(`p`,{"data-slot":`plan-fallback`,className:`text-xs text-soft-foreground italic`,children:`planner unavailable — single-step plan`}):e.rationale===``?null:(0,Q.jsx)(`p`,{"data-slot":`plan-rationale`,className:`text-xs text-muted-foreground`,children:e.rationale})]}),(0,Q.jsx)(`ol`,{"data-slot":`plan-steps`,className:`flex-1 space-y-2 overflow-y-auto px-5 py-4`,children:g?(0,Q.jsx)(`li`,{className:`py-6 text-center text-sm text-muted-foreground`,children:`(no steps left — discard and plan again)`}):e.steps.map((t,n)=>(0,Q.jsxs)(`li`,{"data-slot":`plan-step`,"data-step-id":t.id,draggable:!0,onDragStart:()=>l(n),onDragOver:e=>{e.preventDefault(),d(n)},onDragLeave:()=>d(e=>e===n?null:e),onDrop:e=>h(e,n),onDragEnd:m,className:G(`flex items-center gap-2.5 rounded-lg border border-border bg-card-2 px-3 py-2.5`,c===n&&`opacity-50`,u===n&&c!==null&&c!==n&&`border-ring`),children:[(0,Q.jsx)(x,{"aria-hidden":`true`,className:`size-3.5 shrink-0 cursor-grab text-soft-foreground`}),(0,Q.jsx)(`span`,{className:`w-5 shrink-0 font-mono text-[11px] text-soft-foreground tabular-nums`,children:String(n+1).padStart(2,`0`)}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`text-[13px] font-medium`,children:t.name??t.id}),t.skill?(0,Q.jsx)(`span`,{"data-slot":`plan-badge-skill`,title:`skill`,className:`shrink-0 rounded-full bg-accent-strong/15 px-1.5 py-px font-mono text-[11px] font-medium text-accent-text`,children:t.skill}):null,t.command?(0,Q.jsx)(`span`,{"data-slot":`plan-badge-check`,className:`shrink-0 rounded-full bg-muted px-1.5 py-px text-[11px] font-medium text-muted-foreground`,children:`check`}):null]}),(0,Q.jsx)(`p`,{className:`mt-3 whitespace-pre-wrap break-words font-mono text-[11px] text-muted-foreground`,children:Uu(t)})]}),(0,Q.jsxs)(`span`,{"data-slot":`plan-step-actions`,className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(z,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-slot":`plan-step-up`,"aria-label":`Move step ${n+1} up`,disabled:n===0,className:`size-7 text-muted-foreground`,onClick:()=>a(Hu(e.steps,n,n-1)),children:`Move up`}),(0,Q.jsx)(z,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-slot":`plan-step-down`,"aria-label":`Move step ${n+1} down`,disabled:n===e.steps.length-1,className:`size-7 text-muted-foreground`,onClick:()=>a(Hu(e.steps,n,n+1)),children:`Move down`}),(0,Q.jsx)(z,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-slot":`plan-step-remove`,"aria-label":`Remove step ${n+1}`,className:`size-7 text-muted-foreground hover:text-danger`,onClick:()=>a(Vu(e.steps,n)),children:`Remove`})]})]},t.id))}),!n&&r?(0,Q.jsxs)(`p`,{id:`plan-start-guidance`,className:`flex flex-wrap items-center gap-1.5 border-t border-border px-5 pt-3 text-xs text-muted-foreground`,children:[(0,Q.jsx)(`span`,{children:r}),i]}):null,(0,Q.jsxs)(`div`,{"data-slot":`plan-actions`,className:`flex flex-wrap items-center gap-3 px-6 pt-3 pb-6`,children:[(0,Q.jsxs)(z,{type:`button`,"data-slot":`plan-start`,disabled:g||t||!n,title:n?void 0:r,"aria-describedby":!n&&r?`plan-start-guidance`:void 0,onClick:o,children:[(0,Q.jsx)(aa,{"aria-hidden":`true`,className:`size-3.5`}),t?`Starting…`:`Start`]}),(0,Q.jsx)(Ju,{steps:e.steps,disabled:g}),(0,Q.jsx)(z,{type:`button`,variant:`outline`,onClick:s,children:`Discard`})]}),(0,Q.jsx)(`p`,{className:`px-6 pb-6 text-xs text-muted-foreground`,children:`No steps left? Start is disabled. A planner failure shows a single-step fallback.`})]})})]})}function Ju({steps:e,disabled:t}){let n=U(),[r,i]=(0,Z.useState)(!1),[a,o]=(0,Z.useState)(``),[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(!1),d=async t=>{let r=a.trim();if(!(r===``||l)){u(!0);try{let a=await xe({name:r,steps:e,...t?{overwrite:!0}:{}});F(`Saved — ${a.path.split(`/`).pop()??a.path}`),n.invalidateQueries({queryKey:R.workflows}),c(!1),i(!1),o(``)}catch(e){e instanceof Or&&e.exists===!0?c(!0):F(e instanceof Error?e.message:String(e),{tone:`danger`})}finally{u(!1)}}};return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(z,{type:`button`,variant:`outline`,"data-slot":`plan-save`,disabled:t,onClick:()=>i(!0),children:`Save as chain`}),(0,Q.jsx)(vo,{open:r,onOpenChange:e=>i(!!e),children:(0,Q.jsxs)(bo,{"data-slot":`plan-save-dialog`,className:`sm:max-w-sm`,showCloseButton:!1,children:[(0,Q.jsxs)(yo,{children:[(0,Q.jsx)(xo,{children:`Save as chain`}),(0,Q.jsx)(_o,{children:`Saves these steps as a reusable workflow — it joins the picker like any other chain.`})]}),(0,Q.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),d(!1)},children:[(0,Q.jsx)(`label`,{htmlFor:`plan-chain-name`,className:`mb-2 block text-[11px] text-muted-foreground`,children:`Chain name`}),(0,Q.jsx)(Ku,{id:`plan-chain-name`,value:a,onChange:e=>o(e.target.value),"aria-label":`Chain name`,placeholder:`e.g. fix-and-verify-v2`,maxLength:80,autoFocus:!0}),(0,Q.jsxs)(go,{className:`mt-4`,children:[(0,Q.jsx)(z,{type:`button`,variant:`outline`,onClick:()=>i(!1),children:`Cancel`}),(0,Q.jsx)(z,{type:`submit`,disabled:a.trim()===``||l,children:l?`Saving…`:`Save chain`})]})]})]})}),(0,Q.jsx)(rr,{open:s,onOpenChange:e=>e?void 0:c(!1),children:(0,Q.jsxs)(pn,{"data-slot":`plan-overwrite-dialog`,children:[(0,Q.jsxs)($n,{children:[(0,Q.jsxs)(Ut,{children:[`Overwrite “`,a.trim(),`”?`]}),(0,Q.jsx)(Mt,{children:`A chain with this name already exists. Overwriting replaces its steps with this plan.`})]}),(0,Q.jsxs)(In,{children:[(0,Q.jsx)(Xn,{children:`Cancel`}),(0,Q.jsx)(An,{onClick:()=>void d(!0),children:`Overwrite chain`})]})]})})]})}function Yu(){let[e]=Nn(),t=Ua(),n=U(),r=(0,Z.useRef)(null),[i,a]=(0,Z.useState)(()=>typeof window<`u`&&window.innerWidth<=767),{projectId:o}=sr(),s=hr().projectId,c=V(),[l]=(0,Z.useState)(()=>zu(e)),u=P(),d=f(),m=b(),h=mn(),g=w(),_=Dn(),v=bn(),[y,x]=(0,Z.useState)(()=>({...Iu(s),...l.ref===``?{}:{text:l.ref},...l.skill===``?{}:{source:{source:`skill`,ref:l.skill}}})),S=(0,Z.useRef)(y);(0,Z.useEffect)(()=>{Lu(S.current,s)},[s]);let C=(0,Z.useRef)(!1),T=(0,Z.useRef)(!0);(0,Z.useEffect)(()=>(T.current=!0,()=>{T.current=!1}),[]);let E=e=>{if(!T.current||C.current)return;let t={...S.current,...e};S.current=t,Lu(t,s),x(t)},ee=g.data?.recentSources,D=m.data,O=g.data?.skillUsage,k=(0,Z.useMemo)(()=>ko(D??[],O),[D,O]),ne=d.data?.workflows??[],A=c.data?.projects??[],re=A.find(e=>e.id===(o??c.data?.bootProject))?.webhook?.url,[ie,ae]=(0,Z.useState)(!1),oe=re!==void 0&&ie,se=m.data!==void 0&&d.data!==void 0&&!g.isPending,j=sa(y.source,k,ne),le=j?.source===`skill`?k.find(e=>e.name===j.ref):void 0,ue=(0,Z.useRef)(null),de=(0,Z.useRef)(null),fe=(0,Z.useMemo)(()=>ma(g.data?.promptTemplates),[g.data?.promptTemplates]),pe=Ta(fe,j?.source===`skill`?[j.ref]:[]),me=(0,Z.useRef)(y.text);me.current=y.text;let he=(0,Z.useRef)(``);(0,Z.useEffect)(()=>{if(!se||C.current)return;let e=Ea(me.current,he.current,pe);he.current=e.applied,e.text!==me.current&&E({text:e.text})},[pe,se]);let M=ge(),_e=jr(M.data),ve=_.data?.defaultRunner,ye=ve??`claude`,N=_e.length>0?oa(y.runner,_e,ye):null,be=N??ye,xe=M.isSuccess&&_e.length>0,Se=_r(be),Ce=_.data?.modelsLocked===!0,we=N===null?[]:ca(N,Se.data,[y.model,_.data?.defaultModels?.[N]]),Te=N===null?``:xa(Ce?null:y.model,N,_.data?.defaultModels,Se.data),Ee=na(be,Te,Se.data),De=Ce?``:$i(y.effort,Ee),{accounts:Oe,repoAccount:ke}=Ga(),Ae=Oe.some(e=>e.provider===be&&e.id===y.agentProfile)?y.agentProfile:null,je=(0,Z.useRef)(!1);(0,Z.useEffect)(()=>{let e=xe&&!je.current;je.current=xe,e&&document.activeElement===document.body&&document.querySelector(`textarea[aria-label="Describe a task for the agent"]`)?.focus()},[xe]);let Me=h.data===void 0||h.data.info!==null,Ne=Me?y.variants:1,Pe=Me,Fe=Ne>1,Ie=Eu({hasGit:Me,variants:Ne,planFirst:y.planFirst,explicitAutonomous:y.autonomous,explicitWorktree:y.worktree,interactive:le?.interactive,configuredAutonomous:v.data?.composerDefaults?.autonomous??v.data?.composerDefaults?.inheritedAutonomous??`source-dependent`,configuredWorktree:v.data?.composerDefaults?.worktree??v.data?.composerDefaults?.inheritedWorktree??!0,source:j?.source??`workflow`}),Le=Ie.worktree,Re=Ie.autonomous,I=u.data===void 0||u.data.capabilities.followups,Be=I?y.generateFollowups??g.data?.lastGenerateFollowups??!0:!1,[Ve,He]=(0,Z.useState)(null),[Ue,We]=(0,Z.useState)(!1),[Ge,Ke]=(0,Z.useState)(!1),[qe,Je]=(0,Z.useState)(()=>l.auto&&l.ref!==``);(0,Z.useLayoutEffect)(()=>{let e=r.current;if(!e)return;let t=()=>a(window.innerWidth<=767||e.getBoundingClientRect().width<550);t();let n=typeof ResizeObserver>`u`?null:new ResizeObserver(t);return n?.observe(e),window.addEventListener(`resize`,t),()=>{n?.disconnect(),window.removeEventListener(`resize`,t)}},[qe]);let[Ye,Xe]=(0,Z.useState)(()=>!l.auto&&l.ref!==``?{kind:`prefill`}:null),Ze=(0,Z.useRef)(!1),Qe=(0,Z.useRef)(!1);(0,Z.useEffect)(()=>{Ze.current||(Ze.current=!0,e.toString()!==``&&t(`/new`,{replace:!0}))},[]),(0,Z.useEffect)(()=>{if(Qe.current||!l.auto||l.ref===``||M.isPending)return;if(!xe||N===null){Qe.current=!0,Xe({kind:`prefill`}),Je(!1);return}if(_.isPending)return;if(Qe.current=!0,ve===void 0){Xe({kind:`prefill`}),Je(!1);return}let e=Fu(s);(async()=>{let r=``;try{r=(await ze()).key}catch{}if(r!==``&&l.key===r)try{let r=await te(Cu(l,N,ve));Ru(s,e),n.invalidateQueries({queryKey:R.runs.all}),T.current&&t(ra(r));return}catch(e){Xe({kind:`failed`,message:e instanceof Error?e.message:String(e)})}else Xe({kind:`blocked`});Je(!1)})()},[_.isPending,ve,M.isPending,xe,N]),(0,Z.useEffect)(()=>{if(Ye===null||!se)return;Xe(null);let e=l.skill!==``&&!k.some(e=>e.name===l.skill)?l.skill:``;e!==``&&E({text:Tu(l.skill,l.ref),source:null});let{message:t,tone:n}=wu(Ye,e);F(t,{tone:n}),document.querySelector(`[data-slot="composer"] button[aria-label="Start task"], [data-slot="composer"] button[aria-label="Plan task"]`)?.focus()},[Ye,se]);let $e=async(e,r)=>{let i=Fu(s);if(!xe||N===null)throw Error(M.isPending?`Checking agent providers…`:M.isError?`Provider authentication could not be verified.`:`Connect an agent provider before starting a task.`);if(!se)throw Error(`Still loading workflows and skills — try again in a second.`);if(y.planFirst){We(!0);try{let t=await ln(e);T.current&&He(Bu(e,r,t))}finally{We(!1)}return}let a=await te(ia(fa({task:e,source:j,model:Te,modelsLocked:Ce,effort:De,runner:N,runnerExplicit:y.runner!==null,agentProfile:Ae,defaultRunner:ve,variants:Ne,images:r,worktree:Le,autonomous:Re,generateFollowups:Be,todoId:l.todo}),oe));Dr({lastTask:j,...j?{recentSources:Sa(ee,j)}:{},...I?{lastGenerateFollowups:Be}:{},...j?.source===`skill`&&g.data!==void 0?{skillUsage:Ao(g.data.skillUsage,j.ref)}:{}}).then(()=>n.invalidateQueries({queryKey:R.uiState})).catch(()=>{}),Ru(s,i),n.invalidateQueries({queryKey:R.runs.all}),T.current&&t(ra(a))},L=async()=>{if(Ve===null||Ve.steps.length===0||Ge||!xe||N===null)return;let e=Fu(s);Ke(!0);try{let r=await te(ia(Gu({task:Ve.task,steps:Ve.steps,model:Te,modelsLocked:Ce,effort:De,runner:N,runnerExplicit:y.runner!==null,defaultRunner:ve,variants:Ne,images:Ve.images,generateFollowups:Be,todoId:l.todo}),oe));I&&Dr({lastGenerateFollowups:Be}).then(()=>n.invalidateQueries({queryKey:R.uiState})).catch(()=>{}),Ru(s,e),He(null),n.invalidateQueries({queryKey:R.runs.all}),T.current&&t(ra(r))}catch(e){F(e instanceof Error?e.message:String(e),{tone:`danger`})}finally{Ke(!1)}};if(qe)return(0,Q.jsxs)(`div`,{"data-route":`new`,className:`relative isolate flex min-h-full flex-col items-center justify-center overflow-x-clip px-6`,children:[(0,Q.jsx)(p,{}),(0,Q.jsxs)(`div`,{"data-slot":`auto-starting`,role:`status`,className:`text-center`,children:[(0,Q.jsx)(`h1`,{className:`animate-pulse text-lg font-semibold tracking-tight`,children:`Starting task…`}),(0,Q.jsx)(`p`,{className:`mt-1.5 text-[14px] text-muted-foreground`,children:`Launched from a bookmarklet — taking you to the run.`})]})]});let et=_e.length>1||_e.some(e=>Ka(Oe,e))?(0,Q.jsx)(Na,{icon:(0,Q.jsx)(Yn,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,runners:_e,value:be,accounts:Oe,account:Ae,repoAccount:ke,onPick:(e,t)=>E({runner:e,agentProfile:t,...e===be?{}:{model:null}}),disabled:!xe},`runner`):null,tt=(0,Q.jsx)(pa,{icon:(0,Q.jsx)(Lt,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`model-pill`,ariaLabel:`Model`,label:we.find(e=>e.id===Te)?.label??`auto`,value:Te,disabled:!xe,readOnly:Ce,disabledHint:Ce?`Model selection is locked to native coding-agent settings.`:void 0,onPick:e=>{let t=na(be,e,Se.data);E({model:e,effort:y.effort===null?null:$i(y.effort,t)})},options:we.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:ta(be,Se.data,Se.isError,Se.isFetching)},`model`),nt=(0,Q.jsx)(pa,{icon:(0,Q.jsx)(fn,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`effort-pill`,ariaLabel:`Effort`,label:Ee.find(e=>e.value===De)?.label??`auto`,value:De,disabled:!xe,readOnly:Ce,disabledHint:Ce?`Effort selection is locked to native coding-agent settings.`:void 0,onPick:e=>E({effort:e}),options:Ee.map(e=>({value:e.value,label:e.label,desc:e.desc}))},`effort`);return(0,Q.jsxs)(`div`,{"data-route":`new`,"data-plan-review":Ve===null?void 0:`true`,className:`relative isolate flex min-h-full flex-col overflow-x-clip pb-16`,children:[(0,Q.jsxs)(`div`,{ref:de,style:Ve===null?void 0:{display:`none`},className:`relative z-[1] mx-auto w-full max-w-none px-11 pt-12 max-md:px-[18px] max-md:pt-[22px]`,children:[(0,Q.jsxs)(`header`,{className:`mb-7 max-md:mb-5`,children:[(0,Q.jsx)(`p`,{"data-slot":`page-eyebrow`,className:`mb-2 text-[11px] font-semibold tracking-[0.16em] text-[var(--accent-text)] uppercase`,children:`NEW TASK`}),(0,Q.jsx)(`h1`,{className:`text-[30px] leading-[normal] font-semibold tracking-[-0.9px] max-md:text-[22px] max-md:leading-[29px] max-md:tracking-[-0.6px]`,children:`What should the agent work on?`}),(0,Q.jsx)(`p`,{"data-slot":`page-description`,className:`mt-2 hidden text-[13px] text-muted-foreground md:block`,children:`Describe the outcome. Configure the run. Review everything before it lands.`})]}),(0,Q.jsx)(Fo,{ref:ue,onSubmit:$e,retainDraftUntilSuccess:!0,idleFeedback:(0,Q.jsxs)(`div`,{"data-slot":`new-task-mode-note`,className:`flex items-center justify-between gap-3 text-[11px] text-muted-foreground`,children:[(0,Q.jsx)(`span`,{children:y.planFirst?`Review the plan before starting the task.`:`Start immediately with the selected configuration.`}),(0,Q.jsx)(`kbd`,{className:`hidden font-sans md:inline`,children:Uo()})]}),pendingLabel:y.planFirst?`Planning task…`:`Starting task…`,failureHint:y.planFirst?`Could not create the plan. Your draft is kept. Please retry.`:void 0,clearOnSuccess:!y.planFirst,onPendingChange:e=>{C.current=e},value:y.text,onValueChange:e=>E({text:e}),autoFocus:!0,placeholder:`Describe a task for the agent — / for skills…`,ariaLabel:`Describe a task for the agent`,sendAriaLabel:y.planFirst?`Plan task`:`Start task`,disabled:!xe||Ge,disabledReason:M.isPending?`Checking agent providers…`:M.isError?`Provider authentication could not be verified.`:`Connect an agent provider before starting a task.`,autocompleteSkills:!0,footerStart:(0,Q.jsxs)(Q.Fragment,{children:[A.length>1&&o!==void 0?(0,Q.jsx)(td,{projects:A,projectId:o,onPick:e=>t(`/p/${encodeURIComponent(e)}/new`,{replace:!0})}):null,(0,Q.jsx)(hu,{label:`Template`,templates:fe,onInsert:e=>ue.current?.insertAtCaret(e)}),(0,Q.jsx)(nd,{source:j,ready:se,skills:k,skillUsage:O,workflows:ne,onPick:e=>E({source:e})})]}),agentOptions:(0,Q.jsx)(`div`,{ref:r,"data-slot":`agent-options`,role:`group`,"aria-label":`Agent settings`,className:`new-task-agent-options`,children:(0,Q.jsx)(Aa,{children:i?[et,nt,tt]:[et,tt,nt]})}),executionOptions:(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,Q.jsxs)(`details`,{"data-slot":`execution-options`,open:!0,className:`group rounded-xl border border-border bg-card xl:self-start`,children:[(0,Q.jsxs)(`summary`,{className:`flex min-h-[44px] cursor-pointer list-none flex-wrap items-center gap-x-2 gap-y-1 px-3 py-2 text-xs text-muted-foreground hover:bg-muted/50 focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-foreground [&::-webkit-details-marker]:hidden`,children:[(0,Q.jsx)(ce,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),(0,Q.jsx)(`span`,{className:`font-medium text-foreground`,children:`Execution settings`}),(0,Q.jsxs)(`span`,{"data-slot":`execution-summary`,hidden:!0,className:`min-w-0 basis-full truncate pl-5 xl:ml-auto xl:basis-auto xl:pl-0`,children:[ea.find(e=>e.id===be)?.label??be,` · `,we.find(e=>e.id===Te)?.label??`auto`]})]}),(0,Q.jsxs)(`div`,{className:`space-y-3 border-t border-border px-5 pt-3 pb-5`,children:[(0,Q.jsx)(`p`,{className:`hidden text-[11px] text-muted-foreground xl:block`,children:`Control where and how this task runs.`}),(0,Q.jsxs)(`div`,{role:`group`,"aria-label":`Run settings`,className:`new-task-run-settings`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(`span`,{children:`Parallel variants`}),(0,Q.jsx)(pa,{slot:`variants-pill`,ariaLabel:`Parallel variants`,label:Ne>1?`×${Ne} variants`:`×1`,value:String(Ne),onPick:e=>E({variants:Number(e)}),disabled:!Me,hint:`How many times to run this task in parallel — each variant gets its own worktree, and you pick the diff you keep. ×1 runs it once.`,disabledHint:`Parallel variants need a git repository — each variant runs in its own worktree.`,options:[{value:`1`,label:`×1`,desc:`One run`},{value:`2`,label:`×2 variants`,desc:`Two competing runs — pick the diff you keep`},{value:`3`,label:`×3 variants`,desc:`Three competing runs — pick the diff you keep`}]})]}),Pe?(0,Q.jsx)(Xu,{on:Le,disabled:Fe,disabledReason:`Parallel variants always use isolated worktrees`,onChange:e=>E({worktree:e})}):null,(0,Q.jsx)(Zu,{on:Re,disabled:y.planFirst,onChange:e=>E({autonomous:e})}),re===void 0?null:(0,Q.jsx)(Qu,{on:oe,url:re,onChange:ae}),le?.interactive&&(y.autonomous===null||y.worktree===null)?(0,Q.jsx)(`p`,{className:`basis-full text-xs text-muted-foreground`,"data-slot":`interactive-skill-hint`,children:`This skill recommends an interactive run in the current checkout. You can change either setting.`}):null,h.data?(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(`span`,{children:`Base branch`}),(0,Q.jsx)(rd,{repo:h.data})]}):null]}),(0,Q.jsxs)(`p`,{"data-slot":`execution-tip`,className:`hidden rounded-lg bg-background p-3 text-[11px] leading-5 text-muted-foreground xl:block`,children:[(0,Q.jsx)(cn,{"aria-hidden":`true`,className:`mb-2 size-[18px] text-accent-text`}),Le&&Me?`Changes stay in their own worktree, separate from your working directory.`:`Changes are made in the current working directory.`]})]})]}),I?(0,Q.jsx)(`section`,{"data-slot":`followups-options`,"aria-label":`Follow-ups preference`,className:`rounded-xl border border-border bg-card p-4`,children:(0,Q.jsx)($u,{on:Be,onChange:e=>E({generateFollowups:e})})}):null]}),footerEnd:(0,Q.jsxs)(Q.Fragment,{children:[!xe&&!M.isPending?(0,Q.jsx)(X,{to:`/settings/agents#providers`,className:`text-xs font-medium text-foreground underline underline-offset-4`,children:`Configure providers`}):null,(0,Q.jsx)(id,{planFirst:y.planFirst,planning:Ue,onModeChange:e=>E({planFirst:e})}),(0,Q.jsx)(`kbd`,{"aria-hidden":`true`,className:`hidden rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-[11px] font-medium text-muted-foreground md:inline`,children:Uo()})]})}),(0,Q.jsx)(`p`,{"data-slot":`run-mode-note`,className:`mt-2.5 text-[13px] text-muted-foreground`,children:Du({worktree:Le,hasGit:Me})})]}),Ve===null?null:(0,Q.jsx)(qu,{plan:Ve,starting:Ge,startAvailable:xe,startUnavailableReason:M.isPending?`Checking agent providers…`:M.isError?`Provider authentication could not be verified.`:`Connect an agent provider before starting a task.`,startUnavailableAction:M.isPending?void 0:(0,Q.jsx)(X,{to:`/settings/agents#providers`,children:`Configure providers`}),onStepsChange:e=>He(t=>t&&{...t,steps:e}),onStart:()=>void L(),onDiscard:()=>{He(null),requestAnimationFrame(()=>de.current?.querySelector(`textarea`)?.focus())}})]})}function Xu({on:e,disabled:t,disabledReason:n,onChange:r}){return(0,Q.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,disabled:t,"aria-label":`Worktree`,"data-slot":`worktree-toggle`,onClick:()=>r(!e),title:t?n:e?`Runs in an isolated worktree — uncheck to run in the repo working tree`:`Runs in the repo working tree — check to isolate in a worktree`,className:`flex items-center justify-between gap-3 px-0 py-3 text-left`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(`span`,{className:`block text-[13px] font-medium`,children:`Worktree`}),(0,Q.jsx)(`span`,{className:`block text-[12px] text-muted-foreground`,children:`Run in an isolated working copy`})]}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:G(`flex h-6 w-10 shrink-0 items-center rounded-full border p-0.5`,e?`border-accent-strong bg-accent-strong`:`border-muted-foreground bg-muted`),children:(0,Q.jsx)(`span`,{className:G(`size-[18px] rounded-full`,e?`ml-auto bg-accent-strong-foreground`:`bg-foreground`)})})]})}function Zu({on:e,disabled:t,onChange:n}){return(0,Q.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,disabled:t,"aria-label":`Autonomous`,"data-slot":`autonomous-toggle`,onClick:()=>n(!e),title:t?`Plan-first runs are interactive — autonomous is unavailable`:e?`Autonomous — the agent runs to completion without pausing for you`:`Runs interactively — check to let the agent finish without pausing for you`,className:`flex items-center justify-between gap-3 px-0 py-3 text-left disabled:opacity-50`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(`span`,{className:`block text-[13px] font-medium`,children:`Autonomous`}),(0,Q.jsx)(`span`,{className:`block text-[12px] text-muted-foreground`,children:`Let the agent proceed without prompts`})]}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:G(`flex h-6 w-10 shrink-0 items-center rounded-full border p-0.5`,e?`border-accent-strong bg-accent-strong`:`border-muted-foreground bg-muted`),children:(0,Q.jsx)(`span`,{className:G(`size-[18px] rounded-full`,e?`ml-auto bg-accent-strong-foreground`:`bg-foreground`)})})]})}function Qu({on:e,url:t,onChange:n}){return(0,Q.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,"aria-label":`Notify webhook`,"data-slot":`notify-webhook-toggle`,onClick:()=>n(!e),title:e?`Status changes go to ${oi(t)}`:`Check to send this task's status changes to ${oi(t)}`,className:`flex min-h-11 items-center justify-between gap-3 px-0 py-3 text-left`,children:[(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsx)(`span`,{className:`block text-[13px] font-medium`,children:`Notify webhook`}),(0,Q.jsx)(`span`,{"data-slot":`notify-webhook-subtitle`,className:`block truncate text-[12px] text-muted-foreground`,children:`Send status changes`})]}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:G(`flex h-6 w-10 shrink-0 items-center rounded-full border p-0.5`,e?`border-accent-strong bg-accent-strong`:`border-muted-foreground bg-muted`),children:(0,Q.jsx)(`span`,{className:G(`size-[18px] rounded-full`,e?`ml-auto bg-accent-strong-foreground`:`bg-foreground`)})})]})}function $u({on:e,onChange:t}){return(0,Q.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,"data-slot":`generate-followups-toggle`,onClick:()=>t(!e),title:e?`Agents can add newly discovered follow-up work to the task inbox`:`Follow-up generation is off; agents still maintain the handoff journal`,"aria-label":`Follow-ups`,className:`flex min-h-11 w-full items-center justify-between gap-4 text-left text-foreground`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(`span`,{className:`block text-[16px]`,children:`Follow-ups`}),(0,Q.jsx)(`span`,{className:`mt-1 block text-xs leading-[1.5] text-muted-foreground`,children:`Generate suggestions in Inbox after this task. Enabled by default; your choice is remembered.`})]}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:G(`flex h-6 w-10 shrink-0 items-center rounded-full border p-0.5`,e?`border-accent-strong bg-accent-strong`:`border-muted-foreground bg-muted`),children:(0,Q.jsx)(`span`,{className:G(`size-[18px] rounded-full`,e?`ml-auto bg-accent-strong-foreground`:`bg-foreground`)})})]})}function ed(e,t){let n=t.trim().toLowerCase();if(n===``)return[...e];let r=e=>{let t=e.name.toLowerCase(),r=e.id.toLowerCase();return t.startsWith(n)||r.startsWith(n)?0:t.includes(n)||r.includes(n)?1:2};return e.map((e,t)=>({project:e,rank:r(e),index:t})).filter(e=>e.rank<2).sort((e,t)=>e.rank-t.rank||e.index-t.index).map(e=>e.project)}function td({projects:e,projectId:t,onPick:n}){let[r,i]=(0,Z.useState)(!1),[a,o]=(0,Z.useState)(``),s=e.find(e=>e.id===t),c=ed(e,a);return(0,Q.jsxs)(Yi,{open:r,onOpenChange:e=>{i(e),e||o(``)},children:[(0,Q.jsx)(Ki,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`project-pill`,"aria-label":`Project`,title:`Which project this task runs in — its skills, workflows, settings and draft`,className:G(Ma,`border-foreground/60 font-semibold text-foreground`),children:[(0,Q.jsx)(rn,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),(0,Q.jsx)(`span`,{className:`max-w-40 truncate`,children:s?.name??t}),ha]})}),(0,Q.jsx)(Ji,{align:`start`,sideOffset:8,className:`w-[300px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Q.jsxs)(ga,{shouldFilter:!1,children:[(0,Q.jsx)(_a,{placeholder:`search projects…`,value:a,onValueChange:o}),(0,Q.jsxs)(wa,{"data-slot":`project-menu`,className:`max-h-[min(18rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[c.length===0?(0,Q.jsx)(ka,{children:`Nothing matches.`}):null,c.map(e=>(0,Q.jsxs)(Y,{value:e.id,keywords:[e.name],"data-slot":`project-option`,"data-project-id":e.id,disabled:e.status===`missing`,onSelect:()=>{n(e.id),i(!1)},children:[(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs font-medium`,children:e.name}),e.status===`missing`?(0,Q.jsx)(`span`,{className:`shrink-0 text-[11px] text-soft-foreground`,children:`folder not found`}):e.branch===void 0?null:(0,Q.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-soft-foreground`,children:e.branch}),e.id===t?(0,Q.jsx)(_t,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e.id))]}),(0,Q.jsx)(`p`,{className:`border-t border-border px-3 py-2 text-[11px] leading-snug text-soft-foreground`,children:`Skills, workflows, settings and the draft re-resolve against the selected project.`})]})})]})}function nd({source:e,ready:t,skills:n,skillUsage:r,workflows:i,onPick:a}){let[o,s]=(0,Z.useState)(!1),[c,u]=(0,Z.useState)(``),[d,f]=(0,Z.useState)(null),p=(0,Z.useRef)(null),{mostUsed:m,project:h,global:g,ranked:_}=jo(n,c,r),v=i.find(e=>e.name===da),y=To(i,c).filter(e=>e.name!==da),b=i.some(e=>e.name!==da),x=wo(`no skill`,`none plain ${da} ${v?.description??``}`,c)>0,S=!x&&(_?_.length===0:m.length===0&&h.length===0&&g.length===0)&&y.length===0,C=e=>{a(e),s(!1)},w=t=>C(e?.source===t.source&&e.ref===t.ref?null:t),T=(t,n)=>{let r=e?.source===`skill`&&e.ref===t.name;return(0,Q.jsxs)(Y,{value:`skill ${t.name} ${t.path}`,keywords:Eo(t.name,t.description),"data-slot":`source-option`,"data-source-kind":`skill`,"data-source-ref":t.name,onSelect:()=>w({source:`skill`,ref:t.name}),children:[(0,Q.jsx)(`span`,{className:G(`shrink-0 font-mono text-xs`,n&&`font-semibold`),children:t.name}),t.description?(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:t.description}):null,(0,Q.jsx)(`button`,{type:`button`,"data-slot":`source-skill-view`,"aria-label":`View skill ${t.name}`,title:`View skill`,onClick:e=>{e.preventDefault(),e.stopPropagation(),f(t)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,Q.jsx)(ua,{"aria-hidden":`true`,className:`size-3.5`})}),r?(0,Q.jsx)(_t,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},t.path)},E=e===null||e.source===`skill`?rt:l,ee=(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`source-pill`,"data-source-kind":e?.source??`none`,"aria-label":`Choose a skill or workflow`,title:e===null?`No skill — the task runs as one plain agent step. Pick a skill or workflow to change that.`:`Runs the ${e.source} "${e.ref}" — pick it again, or press ✕, to run without it`,disabled:!t,onKeyDown:t=>{e===null||t.metaKey||t.ctrlKey||t.altKey||t.key!==`Backspace`&&t.key!==`Delete`||(t.preventDefault(),a(null))},className:G(Ma,`font-mono text-[11px]`,e===null?`text-muted-foreground`:`rounded-r-none border-r-0 border-foreground/60 pr-1.5 font-semibold text-foreground`),children:[(0,Q.jsx)(E,{"aria-hidden":`true`,className:G(`size-3 shrink-0`,e===null?`text-muted-foreground`:`text-accent-icon`)}),(0,Q.jsx)(`span`,{className:`max-w-44 truncate`,children:t?e?.ref??(b?`Skill or workflow`:`Skill`):`…`}),ha]});return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Su,{skill:d,onClose:()=>f(null)}),(0,Q.jsxs)(Yi,{open:o,onOpenChange:e=>{s(e),e||u(``)},children:[(0,Q.jsxs)(`span`,{className:`inline-flex items-center`,children:[(0,Q.jsx)(Ki,{asChild:!0,children:ee}),e!==null&&t?(0,Q.jsx)(`button`,{type:`button`,"data-slot":`source-pill-clear`,"aria-label":`Clear the ${e.source} ${e.ref}`,title:`Run without it`,onClick:()=>a(null),className:G(Ma,`rounded-l-none border-foreground/60 pl-1.5 pr-2 text-soft-foreground hover:text-foreground`),children:(0,Q.jsx)(or,{"aria-hidden":`true`,className:`size-3`})}):null]}),(0,Q.jsx)(Ji,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Q.jsxs)(ga,{shouldFilter:!1,children:[(0,Q.jsx)(_a,{placeholder:`search skills & workflows…`,value:c,onValueChange:u,onInput:()=>p.current?.scrollTo(0,0)}),(0,Q.jsxs)(wa,{ref:p,"data-slot":`source-menu`,className:`max-h-[min(18rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[S?(0,Q.jsx)(ka,{children:`Nothing matches.`}):null,x?(0,Q.jsx)(J,{children:(0,Q.jsxs)(Y,{value:`none no-skill`,keywords:[`none`,`plain`,...Eo(da)],"data-slot":`source-option`,"data-source-kind":`none`,onSelect:()=>C(null),children:[(0,Q.jsx)(lr,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-soft-foreground`}),(0,Q.jsx)(`span`,{className:`shrink-0 text-xs font-medium`,children:`No skill`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:v?.description??`One agent run on your task — no ceremony.`}),e===null?(0,Q.jsx)(_t,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]})}):null,_?_.length>0?(0,Q.jsx)(J,{children:_.map(e=>T(e,Do(e)))}):null:(0,Q.jsxs)(Q.Fragment,{children:[m.length>0?(0,Q.jsx)(J,{heading:`Most used`,children:m.map(e=>T(e,Do(e)))}):null,h.length>0?(0,Q.jsx)(J,{heading:`Project skills`,children:h.map(e=>T(e,!0))}):null]}),y.length>0?(0,Q.jsx)(J,{heading:`Workflows`,children:y.map(t=>{let n=e?.source===`workflow`&&e.ref===t.name;return(0,Q.jsxs)(Y,{value:`workflow ${t.name}`,keywords:Eo(t.name,t.description),"data-slot":`source-option`,"data-source-kind":`workflow`,"data-source-ref":t.name,onSelect:()=>w({source:`workflow`,ref:t.name}),children:[(0,Q.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:t.name}),t.description?(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:t.description}):null,n?(0,Q.jsx)(_t,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},t.name)})}):null,g.length>0?(0,Q.jsx)(J,{heading:`Global`,children:g.map(e=>T(e,!1))}):null]})]})})]})]})}function rd({repo:e}){let t=U(),n=H({mutationFn:e=>mr({baseBranch:e}),onSuccess:e=>{t.invalidateQueries({queryKey:R.repo}),F(e.baseBranch?`New tasks will branch off "${e.baseBranch}" (PRs target it too).`:`Base branch cleared — new tasks fork from the checked-out branch.`)},onError:e=>F(e.message,{tone:`danger`})});return e.info?(0,Q.jsx)(pa,{searchPlaceholder:`Search branches…`,slot:`base-pill`,ariaLabel:`Base branch`,label:(0,Q.jsx)(`span`,{className:`text-[11px]`,children:e.baseBranch??e.info.branch}),value:e.baseBranch??``,onPick:e=>n.mutate(e===``?null:e),options:[{value:``,label:`follow checked-out branch (${e.info.branch})`,desc:`New task worktrees fork from whatever branch is checked out`},...e.branches.map(e=>({value:e,label:e}))]}):null}function id({planFirst:e,planning:t,onModeChange:n}){return(0,Q.jsxs)(`div`,{"data-slot":`mode-seg`,role:`radiogroup`,"aria-label":`Run mode`,className:`inline-flex items-center gap-0.5 rounded-lg bg-muted p-[3px]`,children:[(0,Q.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":!e,onClick:()=>n(!1),className:G(`h-6 rounded-md px-2 text-xs transition-colors`,e?`font-medium text-muted-foreground hover:text-foreground`:`bg-card font-semibold text-foreground shadow-xs`),children:[e?null:(0,Q.jsx)(_t,{"aria-hidden":`true`,className:`size-3.5`}),`Start`]}),(0,Q.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":e,"aria-busy":t||void 0,"data-slot":`mode-plan`,onClick:()=>n(!0),className:G(`h-6 rounded-md px-2 text-xs transition-colors`,e?`bg-contrast font-semibold text-contrast-foreground ring-2 ring-ring/55`:`font-medium text-muted-foreground hover:text-foreground`,t&&`animate-pulse`),children:t?`Planning…`:`Plan first`})]})}function ad(){return(0,Q.jsx)(`div`,{"data-route":`not-found`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(W,{icon:(0,Q.jsx)(Xs,{}),tone:`neutral`,title:`Page not found`,subtitle:`Nothing lives at this address. The link may be mistyped, or it points at something that is gone.`,actions:(0,Q.jsx)(z,{asChild:!0,variant:`outline`,children:(0,Q.jsx)(X,{to:`/`,children:`Back to tasks`})})})})}function od(){return(0,Q.jsx)(`div`,{className:`px-[18px] pt-2 md:hidden`,children:(0,Q.jsxs)(X,{to:`/git`,"data-slot":`git-back`,className:`inline-flex min-h-11 items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground`,children:[(0,Q.jsx)($e,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to Git`]})})}function sd(){let{pathname:e,search:t}=a();return(0,Q.jsxs)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:[Fa(e)!==`/git`||new URLSearchParams(t).get(`view`)===`repo`?(0,Q.jsx)(od,{}):null,(0,Q.jsx)(W,{icon:(0,Q.jsx)(La,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading repository…`,subtitle:`Fetching the repo's git state.`})]})}function cd(){return(0,Q.jsxs)(`div`,{"data-route":`skills`,"aria-busy":`true`,className:`mx-auto min-h-full w-full px-[18px] py-6 md:p-9`,children:[(0,Q.jsx)(`h1`,{className:`text-[30px] font-semibold tracking-tight`,children:`Skills`}),(0,Q.jsx)(`p`,{className:`mt-1 text-[13px] text-muted-foreground`,children:`Markdown playbooks your agents can follow.`}),(0,Q.jsx)(`p`,{"data-slot":`skills-loading`,role:`status`,className:`mt-6 text-xs text-muted-foreground`,children:`Loading skills…`}),(0,Q.jsxs)(`div`,{"aria-hidden":`true`,className:`mt-4 flex flex-col gap-[22px] motion-safe:animate-pulse`,children:[(0,Q.jsx)(`div`,{className:`h-11 rounded-lg border border-border bg-card`}),(0,Q.jsx)(`div`,{className:`h-80 rounded-xl border border-border bg-card`})]})]})}function ld({projectId:e,registry:t}){let n=t.projects.length?t.projects:[{id:t.bootProject,name:t.bootProject}];return(0,Q.jsx)(`div`,{"data-route":`unknown-project`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(W,{icon:(0,Q.jsx)(ic,{}),tone:`neutral`,title:`“${e}” isn’t registered here`,subtitle:`This cezar doesn’t serve a project by that id. The link may come from another machine’s workspace — these are the projects registered on this one:`,children:(0,Q.jsx)(`ul`,{"data-slot":`registered-projects`,className:`mx-auto flex w-full max-w-xs flex-col gap-1.5 text-left`,children:n.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(L,{to:`/p/${encodeURIComponent(e.id)}/`,className:`flex items-baseline gap-2 rounded-md border border-border bg-card px-3 py-2 text-sm font-medium text-foreground shadow-xs transition-colors hover:bg-card-2`,children:[e.name||e.id,(0,Q.jsxs)(`span`,{className:`font-mono text-[11px] font-normal text-soft-foreground`,children:[`/p/`,e.id]})]})},e.id))})})})}function ud(){return(0,Q.jsxs)(`div`,{"data-route":`workflows`,"aria-busy":`true`,className:`mx-auto min-h-full w-full px-[18px] py-6 md:p-9`,children:[(0,Q.jsx)(`h1`,{className:`text-[30px] font-semibold tracking-tight`,children:`Workflows`}),(0,Q.jsx)(`p`,{className:`mt-1 text-[13px] text-muted-foreground`,children:`Portable skill chains. Steps run from top to bottom.`}),(0,Q.jsx)(`p`,{"data-slot":`workflows-loading`,role:`status`,className:`mt-6 text-xs text-muted-foreground`,children:`Loading workflows…`}),(0,Q.jsxs)(`div`,{"aria-hidden":`true`,className:`mt-4 flex flex-col gap-[22px] motion-safe:animate-pulse`,children:[(0,Q.jsx)(`div`,{className:`h-11 rounded-lg border border-border bg-card`}),(0,Q.jsx)(`div`,{className:`h-80 rounded-xl border border-border bg-card`})]})]})}function dd({tab:e}){return(0,Q.jsx)(`div`,{"data-route":`task-${e}`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(W,{icon:(0,Q.jsx)(La,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:e===`changes`?`Loading changes…`:`Loading files…`,subtitle:`Fetching the run record.`})})}function fd({tab:e,error:t}){let n=t instanceof Or&&t.status===404;return(0,Q.jsx)(`div`,{"data-route":`task-${e}`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(W,{icon:n?(0,Q.jsx)(Wa,{}):(0,Q.jsx)(xt,{size:16}),tone:n?`neutral`:`danger`,title:n?`Task not found`:`Could not load this task`,subtitle:n?`No run has this id. It may have been deleted, or the link is from another machine.`:t.message,actions:(0,Q.jsx)(z,{asChild:!0,variant:`outline`,children:(0,Q.jsx)(X,{to:`/`,children:`Back to tasks`})})})})}var pd={issue:`issue`,pr:`pull request`};function md({kind:e,number:t,heading:n=`h1`}){let r=(0,Q.jsx)(`div`,{"data-slot":`task-github-loading`,className:`flex min-h-full flex-1 flex-col`,children:(0,Q.jsx)(W,{icon:(0,Q.jsx)(La,{className:`motion-safe:animate-spin`}),tone:`neutral`,heading:n,title:`Loading ${pd[e]}${t===void 0?``:` #${t}`}…`,subtitle:t===void 0?`Fetching the run record.`:`Asking GitHub.`})});return n===`h2`?r:(0,Q.jsx)(`div`,{"data-route":`task-github-item`,className:`flex min-h-full flex-col`,children:r})}var hd=ur(`inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 [&>svg]:pointer-events-none [&>svg]:size-3`,{variants:{variant:{default:`bg-accent-strong text-accent-strong-foreground [a&]:hover:bg-accent-strong/90`,secondary:`bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90`,destructive:`bg-destructive text-destructive-foreground focus-visible:ring-destructive/20 [a&]:hover:bg-destructive/90`,outline:`border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,ghost:`[a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,link:`text-link-foreground underline-offset-4 [a&]:hover:underline`}},defaultVariants:{variant:`default`}});function gd({className:e,variant:t=`default`,asChild:n=!1,...r}){return(0,Q.jsx)(n?Le:`span`,{"data-slot":`badge`,"data-variant":t,className:G(hd({variant:t}),e),...r})}function _d({className:e,orientation:t=`horizontal`,...n}){return(0,Q.jsx)(xl,{"data-slot":`tabs`,"data-orientation":t,orientation:t,className:G(`group/tabs flex gap-2 data-[orientation=horizontal]:flex-col`,e),...n})}var vd=ur(`group/tabs-list inline-flex w-fit items-center justify-center rounded-md p-[3px] text-muted-foreground group-data-[orientation=horizontal]/tabs:h-9 group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function yd({className:e,variant:t=`default`,...n}){return(0,Q.jsx)(Sl,{"data-slot":`tabs-list`,"data-variant":t,className:G(vd({variant:t}),e),...n})}function bd({className:e,...t}){return(0,Q.jsx)(Cl,{"data-slot":`tabs-trigger`,className:G(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-sm border border-transparent px-3 py-1 text-[13px] font-medium whitespace-nowrap text-muted-foreground transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 group-data-[variant=default]/tabs-list:data-[state=active]:shadow-xs group-data-[variant=line]/tabs-list:data-[state=active]:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent`,`data-[state=active]:bg-card data-[state=active]:font-semibold data-[state=active]:text-foreground`,`after:absolute after:bg-accent-strong after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-[state=active]:after:opacity-100`,e),...t})}function xd({className:e,...t}){return(0,Q.jsx)(wl,{"data-slot":`tabs-content`,className:G(`flex-1 outline-none`,e),...t})}function Sd(e){return ea.flatMap(t=>{let n=e.filter(e=>e.provider===t.id);return n.length<2?[{runner:t,account:null,label:t.label,desc:t.desc,missing:!1}]:n.map(e=>({runner:t,account:e.isDefault?null:e.id,label:`${t.label} · ${e.label}`,desc:e.exists?e.configDir:`${e.configDir} — folder not created yet`,missing:!e.exists}))})}var Cd=e=>e.length>ea.length;function wd({rows:e,runner:t,accountFor:n,providerStatus:r,disabled:i=!1,accountDisabled:a=!1,onPick:o}){let s=Cd(e);return(0,Q.jsx)(`div`,{role:`radiogroup`,"aria-label":`Default runner`,"data-slot":`agents-runner`,className:G(`gap-0.5 rounded-md border border-border bg-card p-0.5`,s?`flex max-w-md flex-col`:`inline-flex w-fit`),children:e.map(c=>{let l=He(r.data,c.runner.id),u=!r.isPending&&!r.isError&&l?.enabled===!0&&l.status===`connected`,d=r.isPending?`Checking provider authentication…`:r.isError?`Provider authentication could not be verified.`:l?.enabled===!1?`This provider is disabled. Enable it above or choose another provider.`:u?void 0:`Connect this provider before selecting it.`,f=e.filter(e=>e.runner.id===c.runner.id).length>1,p=c.runner.id===t&&c.account===n(c.runner.id);return(0,Q.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":p,"data-value":c.runner.id,"data-account":c.account??``,title:d??c.desc,disabled:i||!u||f&&a,onClick:()=>o(c.runner.id,c.account,f),className:G(`rounded-sm px-3 py-1.5 text-left font-mono text-[13px] font-medium transition-colors disabled:opacity-50`,p?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:[c.label,s?(0,Q.jsx)(`span`,{"data-slot":c.missing?`agents-account-missing`:`agents-account-dir`,"data-runner":c.runner.id,className:`ml-2 font-sans text-[11px] text-soft-foreground`,children:c.desc}):null]},`${c.runner.id}:${c.account??``}`)})})}function Td({path:e,selected:t,onSelect:n,onEnter:r,decorate:i,emptyHint:a,showHidden:o=!1}){let s=Bt(e,o),c=s.data?.parent??null;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{"data-slot":`fs-breadcrumb`,className:`truncate font-mono text-[11px] text-soft-foreground`,title:s.data?.path??void 0,children:s.data?.path??(s.isError?``:`Loading…`)}),s.isError?(0,Q.jsx)(`p`,{"data-slot":`fs-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:s.error instanceof Error?s.error.message:`could not list that folder`}):(0,Q.jsxs)(`ul`,{"data-slot":`fs-listing`,className:`max-h-64 divide-y divide-border/60 overflow-y-auto overscroll-contain rounded-md border border-border`,children:[c===null?null:(0,Q.jsx)(`li`,{className:`flex`,children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`fs-up`,onClick:()=>r(c),className:`flex flex-1 items-center gap-2 px-3 py-2 text-left text-[13px] hover:bg-muted`,children:[(0,Q.jsx)(Qs,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),`Up one level`]})}),(s.data?.dirs??[]).map(e=>(0,Q.jsxs)(`li`,{className:`flex items-stretch`,children:[(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`fs-dir`,"aria-pressed":t?.path===e.path,onClick:()=>n(e),onDoubleClick:()=>r(e.path),className:G(`flex min-w-0 flex-1 items-center gap-2 px-3 py-2 text-left text-[13px] hover:bg-muted`,t?.path===e.path&&`bg-muted`),children:[(0,Q.jsx)(Zr,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`truncate`,children:e.name}),i?.(e)]}),(0,Q.jsx)(`button`,{type:`button`,"data-slot":`fs-enter`,"aria-label":`Open ${e.name}`,onClick:()=>r(e.path),className:`flex shrink-0 items-center px-2.5 text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,Q.jsx)(Ai,{className:`size-3.5`,"aria-hidden":`true`})})]},e.path)),s.data&&s.data.dirs.length===0?(0,Q.jsx)(`li`,{className:`px-3 py-2 text-[13px] text-muted-foreground`,children:a}):null]}),s.data?.truncated?(0,Q.jsx)(`p`,{"data-slot":`fs-truncated`,className:`text-[11px] text-muted-foreground`,children:`Too many folders to list — only the first ones are shown.`}):null]})}function Ed(e,t,n=!1){let r=Bt(e,n);return t?.path??r.data?.path??null}function Dd({open:e,onOpenChange:t,providers:n,initialProvider:r}){let[i,a]=(0,Z.useState)(null),[o,s]=(0,Z.useState)(null),[c,l]=(0,Z.useState)(r??n[0]??`claude`),[u,d]=(0,Z.useState)(``),[f,p]=(0,Z.useState)(``),[m,h]=(0,Z.useState)(!1),g=Ot(),_=f.trim();return(0,Q.jsx)(vo,{open:e,onOpenChange:t,children:(0,Q.jsxs)(bo,{"data-slot":`add-account-dialog`,className:`sm:max-w-lg`,children:[(0,Q.jsxs)(yo,{children:[(0,Q.jsx)(xo,{children:`Add agent account`}),(0,Q.jsx)(_o,{children:`The config folder this account uses. It does not have to exist yet — Connect signs in and the CLI creates it.`})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-[13px]`,children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:`Agent`}),(0,Q.jsx)(`select`,{"aria-label":`Agent`,"data-slot":`add-account-provider`,value:c,onChange:e=>l(e.target.value),className:`rounded-md border border-input bg-card px-2 py-1 text-[13px] outline-none focus-visible:border-ring`,children:n.map(e=>(0,Q.jsx)(`option`,{value:e,children:e},e))})]}),(0,Q.jsxs)(`label`,{className:`flex min-w-0 flex-1 items-center gap-2 text-[13px]`,children:[(0,Q.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Name`}),(0,Q.jsx)(`input`,{type:`text`,"aria-label":`Account name`,"data-slot":`add-account-label`,value:u,placeholder:`Work`,onChange:e=>d(e.target.value),className:`min-w-0 flex-1 rounded-md border border-input bg-card px-2 py-1 text-[13px] outline-none focus-visible:border-ring`})]})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Q.jsxs)(`label`,{className:`flex min-w-0 items-center gap-2 text-[13px]`,children:[(0,Q.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Folder`}),(0,Q.jsx)(`input`,{type:`text`,spellCheck:!1,autoComplete:`off`,"aria-label":`Config folder`,"data-slot":`add-account-dir`,value:f,placeholder:c===`codex`?`~/.codex-second`:`~/.claude-second`,onChange:e=>{p(e.target.value),s(null),g.reset()},className:`min-w-0 flex-1 rounded-md border border-input bg-card px-2 py-1 font-mono text-[13px] outline-none focus-visible:border-ring`}),(0,Q.jsx)(z,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`add-account-browse`,"aria-expanded":m,onClick:()=>h(e=>!e),children:m?`Hide folders`:`Browse…`})]}),(0,Q.jsxs)(`p`,{className:`text-[11px] text-soft-foreground`,children:[`A `,(0,Q.jsx)(`code`,{children:`~`}),` is kept as written and expanded when the agent runs.`]})]}),m?(0,Q.jsx)(Td,{path:i,selected:o,onSelect:e=>{s(e),p(e.path),g.reset()},onEnter:e=>{a(e),s(null),g.reset()},showHidden:!0,emptyHint:`No subfolders here — pick this folder by typing its path above.`}):null,g.isError?(0,Q.jsx)(`p`,{"data-slot":`add-account-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:g.error instanceof Error?g.error.message:`could not add that folder`}):null,(0,Q.jsxs)(go,{className:`min-w-0 sm:items-center sm:justify-end`,children:[(0,Q.jsx)(z,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,Q.jsx)(z,{"data-slot":`add-account-confirm`,disabled:_===``||g.isPending,onClick:()=>{_===``||g.isPending||g.mutate({provider:c,configDir:_,...u.trim()?{label:u.trim()}:{}},{onSuccess:()=>{t(!1),d(``),p(``),s(null),h(!1),F(`Account added — use Connect to sign in`)}})},children:g.isPending?`Adding…`:`Add account`})]})]})})}function Od(e){let t=(0,Z.useRef)(null),n=e.rows.find(t=>t.runner.id===e.runner&&t.account===e.accountFor(t.runner.id));return(0,Q.jsxs)(`details`,{ref:t,className:`settings-agent-picker`,children:[(0,Q.jsxs)(`summary`,{children:[(0,Q.jsx)(Yn,{"aria-hidden":`true`,className:`size-4 text-accent-text`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1`,children:(n?.label??e.runner).replace(/^codex/,`Codex`).replace(/^claude/,`Claude Code`)}),(0,Q.jsx)(pt,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`})]}),(0,Q.jsx)(wd,{...e,onPick:(...n)=>{e.onPick(...n),t.current&&(t.current.open=!1)}})]})}var kd={claude:`Claude Code`,codex:`Codex`,opencode:`OpenCode`,pi:`pi`,cursor:`Cursor`},Ad={claude:`npm i -g @anthropic-ai/claude-code`,codex:`npm i -g @openai/codex`,opencode:`https://opencode.ai`,pi:`https://github.com/badlogic/pi-mono`,cursor:`https://cursor.com/docs/cli/installation`},jd={connected:{label:`Connected`,tone:`success`},disconnected:{label:`Not connected`,tone:`pending`},"not-installed":{label:`Not installed`,tone:`neutral`},unknown:{label:`Could not verify`,tone:`danger`}};function Md(){let e=fr();return e.isPending?(0,Q.jsx)(`p`,{"data-slot":`accounts-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent accounts…`}):e.isError?(0,Q.jsx)(W,{icon:(0,Q.jsx)(oc,{}),tone:`danger`,title:`Agent accounts did not load`,subtitle:e.error.message,heading:`h2`}):(0,Q.jsx)(Nd,{data:e.data})}function Nd({data:e}){let t=P(),[n,r]=(0,Z.useState)(null),[i,a]=(0,Z.useState)(null),o=cr(),s=[`claude`,`codex`,`opencode`,`pi`,`cursor`];return e.editable?(0,Q.jsxs)(`div`,{"data-slot":`accounts-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-5 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,Q.jsx)(`div`,{children:(0,Q.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Manage runner installations, logins and defaults for new projects.`})}),(0,Q.jsxs)(_d,{defaultValue:`claude`,children:[(0,Q.jsx)(yd,{variant:`line`,"data-slot":`accounts-tabs`,children:s.map(e=>(0,Q.jsx)(bd,{value:e,"data-provider":e,children:kd[e]},e))}),s.map(n=>(0,Q.jsx)(xd,{value:n,className:`pt-4`,children:(0,Q.jsx)(Pd,{provider:n,check:t.data?.checks?.find(e=>e.name===n),accounts:e.profiles.filter(e=>e.provider===n),canCarryAccounts:e.profileCapableProviders.includes(n),defaultAccountId:e.defaults[n]??null,onAdd:()=>r(n),onRemove:a})},n))]}),(0,Q.jsx)(Fd,{profiles:e}),n===null?null:(0,Q.jsx)(Dd,{open:!0,onOpenChange:e=>!e&&r(null),providers:e.profileCapableProviders,initialProvider:n},n),(0,Q.jsx)(rr,{open:i!==null,onOpenChange:e=>!e&&a(null),children:(0,Q.jsxs)(pn,{"data-slot":`accounts-remove-confirm`,children:[(0,Q.jsxs)($n,{children:[(0,Q.jsxs)(Ut,{children:[`Remove “`,i?.label,`”?`]}),(0,Q.jsxs)(Mt,{children:[`This only forgets the account. Nothing in `,i?.configDir,` is deleted — not your login, not your sessions. Projects using it fall back to the default account, and tasks that ran under it can no longer be resumed from here.`]})]}),(0,Q.jsxs)(In,{children:[(0,Q.jsx)(Xn,{children:`Cancel`}),(0,Q.jsx)(An,{"data-action":`accounts-remove-confirm`,disabled:o.isPending,onClick:()=>{let e=i;e&&o.mutate(e.id,{onSuccess:()=>{a(null),F(`Removed ${e.label}`)},onError:e=>F(e.message,{tone:`danger`})})},children:`Remove`})]})]})})]}):(0,Q.jsx)(`div`,{"data-slot":`accounts-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-4 p-4 md:p-6`,children:(0,Q.jsx)(`p`,{"data-slot":`accounts-hosted`,className:`text-[13px] text-soft-foreground`,children:`Agent accounts are managed from the machine that owns the checkout — this cockpit runs in hosted mode.`})})}function Pd({provider:e,check:t,accounts:n,canCarryAccounts:r,defaultAccountId:i,onAdd:a,onRemove:o}){let s=t?.available===!0,c=n.filter(e=>e.isDefault).length;return(0,Q.jsxs)(`div`,{"data-slot":`accounts-provider`,"data-provider":e,className:`flex flex-col gap-4`,children:[(0,Q.jsx)(`h3`,{className:`settings-account-provider-title`,children:kd[e]}),(0,Q.jsxs)(`div`,{className:`settings-account-installation settings-readout`,children:[t===void 0?(0,Q.jsx)(`span`,{children:`Checking…`}):s?(0,Q.jsx)(`span`,{"data-slot":`agent-installed`,children:`Installed`}):(0,Q.jsxs)(`span`,{"data-slot":`agent-installed`,children:[`Not installed — `,(0,Q.jsx)(`code`,{children:Ad[e]})]}),s&&t?.version?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:` · `}),(0,Q.jsx)(`span`,{"data-slot":`agent-version`,children:t.version})]}):null,(0,Q.jsxs)(`span`,{className:`settings-account-count`,children:[n.length,` `,n.length===1?`account`:`accounts`,` (`,c,` discovered, `,n.length-c,` added)`]})]}),(0,Q.jsx)(`ul`,{className:`bg-card`,children:[...n].sort((e,t)=>Number(t.id===i)-Number(e.id===i)).map(e=>(0,Q.jsx)(Id,{account:e,isMachineDefault:i===e.id||i===null&&e.isDefault,onRemove:()=>o(e)},e.id))}),r?(0,Q.jsx)(`div`,{className:`settings-account-add-row`,children:(0,Q.jsx)(z,{type:`button`,variant:`outline`,size:`sm`,"data-action":`accounts-add`,"data-provider":e,onClick:a,children:`Add account`})}):null,r?null:(0,Q.jsxs)(`p`,{"data-slot":`accounts-single-only`,className:`text-[11px] text-soft-foreground`,children:[kd[e],` can only hold one account here: it keeps its credentials outside its config folder, so a second folder would change settings without changing the login — which would say “work account” while billing the other one.`]})]})}function Fd({profiles:e}){let[t,n]=(0,Z.useState)(null),r=U(),i=bn(),a=ge(),o=At(),s=Tr(),c=H({mutationFn:e=>Rt(e),onSuccess:e=>r.setQueryData(I.config,e),onError:e=>F(e.message,{tone:`danger`})});if(i.data===void 0)return null;let l=Sd(e.profiles),u=i.data.agentDefaults.runner??`claude`,d=i.data.agentDefaults.models??{};return(0,Q.jsxs)(`section`,{"data-slot":`accounts-defaults`,className:`flex flex-col gap-3 rounded-lg border border-border bg-card/40 p-3.5`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:`Defaults for new projects`}),(0,Q.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`What a project runs when it has not chosen for itself — set once instead of per repository. A project that has chosen keeps its own.`})]}),(0,Q.jsx)(Od,{rows:l,runner:u,accountFor:t=>e.defaults[t]??null,providerStatus:a,disabled:c.isPending,accountDisabled:s.isPending,onPick:(e,t,n)=>{e!==u&&c.mutate({agentDefaults:{runner:e}}),n&&s.mutate({projectId:null,provider:e,profileId:t},{onError:e=>F(e.message,{tone:`danger`})})}}),(0,Q.jsxs)(`div`,{className:`settings-account-models flex flex-col gap-2`,children:[(0,Q.jsxs)(`label`,{className:`settings-model-agent-choice`,children:[(0,Q.jsx)(`span`,{children:`Default model for`}),(0,Q.jsx)(`select`,{"aria-label":`Model agent`,value:t??u,onChange:e=>n(e.target.value),children:ea.map(e=>(0,Q.jsx)(`option`,{value:e.id,children:kd[e.id]},e.id))})]}),ea.filter(e=>e.id===(t??u)).map(e=>(0,Q.jsxs)(`label`,{className:`settings-account-model flex items-center gap-3`,children:[(0,Q.jsx)(Lt,{className:`size-4 text-accent-icon shrink-0`}),(0,Q.jsx)(`span`,{className:`w-24 shrink-0 text-xs text-muted-foreground`,children:kd[e.id]}),(0,Q.jsxs)(`select`,{"aria-label":`Default model for ${e.label}`,"data-slot":`accounts-default-model`,"data-runner":e.id,value:d[e.id]??``,disabled:c.isPending,onChange:t=>c.mutate({agentDefaults:{models:{[e.id]:t.target.value||null}}}),className:`block w-full max-w-xs rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[ca(e.id,o[e.id].data,[d[e.id]]).map(e=>(0,Q.jsx)(`option`,{value:e.id,children:e.id===``?`Native default`:e.label},e.id)),ta(e.id,o[e.id].data,o[e.id].isError,o[e.id].isFetching)?(0,Q.jsx)(`option`,{disabled:!0,children:ta(e.id,o[e.id].data,o[e.id].isError,o[e.id].isFetching)}):null]})]},e.id))]})]})}function Id({account:e,isMachineDefault:t,onRemove:n}){let[r,i]=(0,Z.useState)(!1),a=Rr(e),o=un(),s=ht(),c=tr(a,e.status===void 0),l=e.status??c.data?.status,u=l?jd[l.status]:void 0;return(0,Q.jsxs)(`li`,{"data-slot":`account-row`,"data-account":e.id,className:`flex flex-col gap-2 px-3.5 py-3`,children:[(0,Q.jsxs)(`div`,{className:`settings-account-card`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-[13px] font-medium text-foreground`,children:e.label}),e.isDefault?(0,Q.jsx)(gd,{variant:`ghost`,className:`shrink-0 text-[12px] text-muted-foreground`,children:`discovered`}):null]}),t&&(0,Q.jsx)(`p`,{className:`settings-account-default-note`,children:`Default account for new projects. Credentials are not displayed.`}),(0,Q.jsxs)(`div`,{className:`settings-account-readout settings-readout`,children:[(0,Q.jsx)(`p`,{"data-slot":`account-path`,className:`mt-0.5 truncate font-mono text-[11px] text-soft-foreground`,title:e.path,children:e.configDir}),(0,Q.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(q,{tone:u?.tone??`neutral`,pulse:u===void 0}),(0,Q.jsx)(`span`,{"data-slot":`account-status`,children:u?.label??`Checking…`}),e.exists?e.looksValid?null:(0,Q.jsxs)(`span`,{"data-slot":`account-unrecognised`,children:[`— this folder does not look like `,kd[e.provider],` config yet`]}):(0,Q.jsx)(`span`,{"data-slot":`account-missing`,children:`— folder not created yet; Connect will make it`})]})]})]}),(0,Q.jsxs)(`div`,{className:`settings-account-actions`,children:[l?.status===`connected`?null:(0,Q.jsx)(z,{type:`button`,size:`sm`,"data-action":`account-connect`,disabled:o.isPending,onClick:()=>o.mutate({provider:e.provider,...e.isDefault?{}:{profileId:e.id}},{onSuccess:e=>F(e.opened?`Finish signing in in the terminal, then Check again.`:`This account is already connected.`),onError:e=>F(e instanceof Or&&e.command?`${e.message} — run: ${e.command}`:e.message,{tone:`danger`})}),children:`Connect`}),(0,Q.jsx)(z,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-recheck`,disabled:s.isPending,title:`Re-probe this account's login now, instead of waiting for the cached answer`,onClick:()=>s.mutate(a,{onError:e=>F(e.message,{tone:`danger`})}),children:`Check again`}),(0,Q.jsx)(Rd,{account:e,onRemove:n}),(0,Q.jsx)(z,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-details-toggle`,"aria-expanded":r,onClick:()=>i(e=>!e),children:r?`Hide details`:`Show details`})]})]}),r?(0,Q.jsx)(Ld,{account:e,routeId:a}):null]})}function Ld({account:e,routeId:t}){let n=zn(t,!0),r=ne(),i=de().data?.targets??[],a=i.filter(e=>si(e.id)===void 0&&e.id!==`terminal`&&e.id!==`finder`).map(e=>({target:e})),o=i.filter(e=>si(e.id)===void 0).map(e=>({target:e})),s=(e,n,i)=>r.mutate({routeId:t,file:e,...i?{target:i}:{}},{onError:e=>F(e.message,{tone:`danger`}),onSuccess:()=>F(`Opened ${n}`)});return(0,Q.jsxs)(`div`,{"data-slot":`account-details`,className:`rounded-md border border-border/60 bg-muted/30 p-3`,children:[n.isPending?(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Reading account details…`}):n.isError?(0,Q.jsx)(`p`,{"data-slot":`account-details-error`,className:`text-xs text-danger`,children:n.error.message}):n.data.available?(0,Q.jsx)(`dl`,{"data-slot":`account-identity`,className:`grid grid-cols-[7rem_minmax(0,1fr)] gap-x-3 gap-y-1 text-xs`,children:n.data.fields.map(e=>(0,Q.jsxs)(Z.Fragment,{children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:e.label}),(0,Q.jsx)(`dd`,{className:`min-w-0 truncate text-foreground`,title:e.value,children:e.value})]},e.label))}):(0,Q.jsx)(`p`,{"data-slot":`account-identity-unavailable`,className:`text-xs text-muted-foreground`,children:n.data.reason??`No account details to show.`}),(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5 border-t border-border/60 pt-2.5`,children:[(0,Q.jsx)(`span`,{className:`mr-1 text-xs text-muted-foreground`,children:`Config files`}),e.files.map(e=>(0,Q.jsx)(ni,{slot:`account-open-file`,label:e.label,triggerVariant:`outline`,disabled:r.isPending,title:e.exists?e.path:`${e.path} — not created yet`,choices:a,onPick:t=>s(e.id,e.label,t),leading:(0,Q.jsxs)(ro,{"data-target":`system`,onSelect:()=>s(e.id,e.label),children:[(0,Q.jsx)(qi,{"aria-hidden":`true`}),`System default`]})},e.id)),(0,Q.jsx)(ni,{slot:`account-open-folder`,label:`Folder`,disabled:r.isPending,title:e.path,choices:o,onPick:e=>s(`folder`,`folder`,e),leading:(0,Q.jsxs)(ro,{"data-target":`system`,onSelect:()=>s(`folder`,`folder`),children:[(0,Q.jsx)(qi,{"aria-hidden":`true`}),`System default`]})})]})]})}function Rd({account:e,onRemove:t}){let[n,r]=(0,Z.useState)(!1),[i,a]=(0,Z.useState)(e.label),o=Fe();return(0,Q.jsx)(Q.Fragment,{children:e.isDefault?null:(0,Q.jsx)(`div`,{"data-slot":`account-manage`,className:`settings-account-management`,children:n?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`input`,{type:`text`,autoFocus:!0,"aria-label":`Name for ${e.label}`,"data-slot":`account-rename-input`,value:i,onChange:e=>a(e.target.value),className:`w-48 rounded-md border border-input bg-card px-2 py-1 text-xs outline-none focus-visible:border-ring`}),(0,Q.jsx)(z,{type:`button`,size:`sm`,"data-action":`account-rename-save`,disabled:o.isPending||i.trim()===``||i.trim()===e.label,onClick:()=>o.mutate({id:e.id,label:i.trim()},{onSuccess:()=>r(!1),onError:e=>F(e.message,{tone:`danger`})}),children:`Save`}),(0,Q.jsx)(z,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{a(e.label),r(!1)},children:`Cancel`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(z,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-rename`,onClick:()=>r(!0),children:`Rename`}),(0,Q.jsx)(z,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-remove`,onClick:t,children:`Remove account`}),(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Renaming changes what cezar calls this account, not its folder.`})]})})})}var zd=1500;function Bd(e,t){let n=(0,Z.useMemo)(()=>e.split(`
4
- `).map(e=>[{content:e}]),[e]),r=(0,Z.useMemo)(()=>Ko(t),[t]),i=n.length>zd,[a,o]=(0,Z.useState)(null);return(0,Z.useEffect)(()=>{if(r===null||i)return;let t=!1;return qo(e,r).then(n=>{t||o({key:e,tokens:n.tokens})}),()=>{t=!0}},[e,r,i]),r===null||i?n:a?.key===e?a.tokens:Go(e,r)?.tokens??n}var Vd=`m-0 min-h-full w-full whitespace-pre font-mono text-xs leading-[1.7] px-3 py-2 [tab-size:2]`;function Hd({value:e,onChange:t,language:n,readOnly:r,className:i,...a}){let o=Bd(e,n),s=(0,Z.useRef)(null),c=(0,Z.useRef)(null),l=()=>{let e=c.current,t=s.current;!e||!t||(t.scrollTop=e.scrollTop,t.scrollLeft=e.scrollLeft)};return(0,Z.useLayoutEffect)(l,[e]),(0,Q.jsxs)(`div`,{"data-slot":`code-editor`,className:G(`relative overflow-hidden rounded-md border border-input bg-card`,i),children:[(0,Q.jsx)(`pre`,{ref:s,"aria-hidden":`true`,className:G(Vd,`pointer-events-none absolute inset-0 overflow-auto text-soft-foreground`),children:o.map((e,t)=>(0,Q.jsx)(`span`,{className:`block`,children:e.length===0?`
5
- `:(0,Q.jsxs)(Q.Fragment,{children:[e.map((e,t)=>(0,Q.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t)),`
6
- `]})},t))}),(0,Q.jsx)(`textarea`,{ref:c,"data-slot":`code-editor-input`,value:e,readOnly:r,onChange:e=>t?.(e.target.value),onScroll:l,spellCheck:!1,autoCorrect:`off`,autoCapitalize:`off`,autoComplete:`off`,wrap:`off`,className:G(Vd,`relative block resize-none overflow-auto bg-transparent text-transparent caret-foreground outline-none`,`selection:bg-accent-strong/30 focus-visible:ring-0`,r&&`cursor-default`),...a})]})}var Ud=`An editor-plus-commit: a saved change reaches a run after you commit it to the base branch.`;function Wd(e){return t=>t.runners.includes(e)}function Gd(e,t,n,r,i){let a=Wd(e),o=t===`mcp`?e=>a(e)&&(e.holdsMcp===!0||e.kind===`mcp`):e=>a(e)&&e.kind===t;return{id:t,label:n,note:r,...i?{empty:i}:{},files:o}}var Kd=[{id:`claude`,label:`Claude`,groups:[Gd(`claude`,`settings`,`Settings`),Gd(`claude`,`mcp`,`MCP`,`A dedicated .mcp.json (key: mcpServers), shared via version control.`),Gd(`claude`,`memory`,`Memory & instructions`)]},{id:`codex`,label:`Codex`,note:Ud,groups:[Gd(`codex`,`settings`,`Settings`),Gd(`codex`,`mcp`,`MCP`,`Inside config.toml under [mcp_servers.<id>] — the same file as Codex’s settings.`),Gd(`codex`,`memory`,`Memory & instructions`)]},{id:`opencode`,label:`OpenCode`,note:Ud,groups:[Gd(`opencode`,`settings`,`Settings`),Gd(`opencode`,`mcp`,`MCP`,`Under the "mcp" key in opencode.json — the same file as OpenCode’s settings.`),Gd(`opencode`,`memory`,`Memory & instructions`)]},{id:`pi`,label:`Pi`,note:Ud,groups:[Gd(`pi`,`settings`,`Settings`),Gd(`pi`,`mcp`,`MCP`,`Pi ships no MCP client, so it has no MCP file to edit.`,`Nothing to list: Pi’s README says "No MCP." Give Pi tools as CLI programs with a README (Pi skills), or install a Pi extension that adds MCP support and configure servers there.`),Gd(`pi`,`memory`,`Memory & instructions`)]},{id:`cursor`,label:`Cursor`,note:Ud,groups:[Gd(`cursor`,`settings`,`Settings`),Gd(`cursor`,`mcp`,`MCP`,`Cursor CLI uses the editor’s MCP configuration.`),Gd(`cursor`,`memory`,`Memory & instructions`,`Cursor also reads CLAUDE.md and .cursor/rules.`)]}];function qd(e){let t=Kd.find(t=>t.id===e);if(!t)throw Error(`no agent descriptor for ${e}`);return t}function Jd(e){return e.seeded?`Copied into each run’s worktree — takes effect on your next run.`:e.tracked===`tracked`?`Runs read the committed copy — this edit applies after you commit it.`:e.tracked===`outside-repo`?`Applies to every session on this machine.`:`Personal, git-ignored.`}function Yd(){let e=Kt(),t=P(),n=(0,Z.useMemo)(()=>t.data?ja(t.data.checks):Kd.map(e=>e.id),[t.data]);return e.isPending?(0,Q.jsx)(`p`,{"data-slot":`agent-config-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent config…`}):e.isError?(0,Q.jsx)(W,{icon:(0,Q.jsx)(nc,{}),tone:`danger`,title:`Agent config did not load`,subtitle:e.error.message,heading:`h2`}):(0,Q.jsx)(Xd,{listing:e.data,installed:n})}function Xd({listing:e,installed:t}){let[n,r]=(0,Z.useState)(`claude`),[i,a]=(0,Z.useState)(null),o=qd(n),s=e.files.find(e=>e.id===i)??null,c=e=>{r(e),a(null)};return(0,Q.jsxs)(`div`,{"data-slot":`agent-config`,className:`flex flex-col gap-5 p-4 md:p-6`,children:[(0,Q.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Edit agent instructions and MCP configuration for this project.`}),!e.editable&&(0,Q.jsx)(`div`,{"data-slot":`agent-config-readonly`,className:`rounded-md border border-border bg-muted/40 px-3 py-2 text-[13px] text-soft-foreground`,children:`Read-only: agent config is edited from the machine that owns the checkout (this cockpit runs in hosted mode). You can still see every file and which one wins.`}),(0,Q.jsx)(`div`,{"data-slot":`agent-config-agents`,role:`tablist`,className:`flex flex-wrap gap-1`,children:Kd.map(e=>(0,Q.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":e.id===o.id,"data-slot":`agent-config-agent`,"data-agent":e.id,"data-selected":e.id===o.id,onClick:()=>c(e.id),className:G(`flex min-w-11 items-center justify-center gap-2 rounded-md px-3 py-1.5 text-[13px] transition-colors`,e.id===o.id?`bg-background font-semibold shadow-sm`:`hover:bg-muted/60`),children:[e.label,!t.includes(e.id)&&(0,Q.jsx)(gd,{variant:`outline`,className:`text-[12px] text-soft-foreground`,children:`not installed`})]},e.id))}),o.note&&(0,Q.jsx)(`p`,{"data-slot":`agent-config-agent-note`,className:`text-[12px] text-soft-foreground`,children:o.note}),(0,Q.jsxs)(`div`,{className:`grid min-w-0 gap-6 lg:grid-cols-[minmax(0,20rem)_minmax(0,1fr)]`,children:[(0,Q.jsx)(`nav`,{"data-slot":`agent-config-nav`,className:`flex min-w-0 flex-col gap-5`,children:(0,Q.jsx)(Zd,{agent:o,listing:e,selectedId:i,onSelect:a})}),(0,Q.jsx)(`div`,{"data-slot":`agent-config-editor-pane`,className:`min-w-0`,children:s?(0,Q.jsx)($d,{file:s},s.id):(0,Q.jsx)(`div`,{className:`flex h-full min-h-40 items-center justify-center rounded-md border border-dashed border-border text-[13px] text-soft-foreground`,children:`Select a config file to view or edit it.`})})]})]})}function Zd({agent:e,listing:t,selectedId:n,onSelect:r}){return(0,Q.jsx)(Q.Fragment,{children:e.groups.map(i=>{let a=t.files.filter(i.files),o=e.id===`claude`&&i.id===`mcp`;return a.length===0&&!(o&&t.userMcp)&&!i.empty?null:(0,Q.jsxs)(`section`,{"data-slot":`agent-config-group`,"data-group":i.id,"data-agent":e.id,children:[(0,Q.jsx)(`p`,{className:`mb-1 text-[11px] font-medium uppercase tracking-wide text-soft-foreground`,children:i.label}),i.note&&(0,Q.jsx)(`p`,{className:`mb-2 text-[12px] text-soft-foreground`,children:i.note}),a.length===0&&i.empty&&(0,Q.jsx)(`p`,{"data-slot":`agent-config-group-empty`,className:`rounded-md border border-dashed border-border px-3 py-2 text-[12px] text-soft-foreground`,children:i.empty}),(0,Q.jsx)(`ul`,{className:`flex flex-col gap-1`,children:a.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`agent-config-file`,"data-selected":e.id===n,onClick:()=>r(e.id),className:G(`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-[13px] transition-colors`,e.id===n?`bg-accent-strong/15 text-foreground`:`hover:bg-muted/60`),children:[(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[12px]`,children:e.label}),e.seeded&&(0,Q.jsx)(gd,{variant:`outline`,className:`shrink-0 text-[12px]`,children:`seeded`}),!e.exists&&(0,Q.jsx)(`span`,{className:`shrink-0 text-[11px] text-soft-foreground`,children:`absent`})]})},e.id))}),o&&t.userMcp&&(0,Q.jsx)(Qd,{userMcp:t.userMcp})]},i.id)})})}function Qd({userMcp:e}){return(0,Q.jsxs)(`div`,{"data-slot":`agent-config-user-mcp`,className:`mt-3`,children:[(0,Q.jsx)(`h4`,{className:`mb-1 text-[12px] font-semibold`,children:`User & local scopes`}),(0,Q.jsxs)(`p`,{className:`mb-2 text-[12px] text-soft-foreground`,children:[`Managed by `,(0,Q.jsx)(`code`,{className:`font-mono`,children:`claude mcp add`}),` in `,e.path,` — cezar does not edit Claude’s state file.`]}),e.readable?e.servers.length>0?(0,Q.jsx)(`ul`,{className:`flex flex-wrap gap-1`,children:e.servers.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsx)(gd,{variant:`outline`,className:`font-mono text-[11px]`,children:e})},e))}):(0,Q.jsx)(`p`,{className:`text-[12px] text-soft-foreground`,children:`No user-scoped MCP servers.`}):(0,Q.jsx)(`p`,{className:`text-[12px] text-soft-foreground`,children:`Could not read the file.`})]})}function $d({file:e}){let t=Tn(e.id),n=yt(e.id),[r,i]=(0,Z.useState)(null),[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(null),l=t.data?.version??null;(0,Z.useEffect)(()=>{t.data&&(i(t.data.content),o(!1),c(null))},[t.data?.version,t.data]);let u=r??t.data?.content??``,d=t.data?u!==t.data.content:!1,f=e.writable;return(0,Q.jsxs)(`div`,{"data-slot":`settings-config-editor`,className:`flex flex-col gap-3`,children:[(0,Q.jsx)(`h3`,{className:`text-sm`,children:`Configuration file`}),(0,Q.jsxs)(`p`,{"data-slot":`agent-config-scope`,title:e.path,className:`text-[12px] text-muted-foreground break-words`,children:[e.scope.charAt(0).toUpperCase()+e.scope.slice(1),` scope · `,e.path]}),(0,Q.jsxs)(`div`,{className:`settings-readout flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.label}),(0,Q.jsx)(gd,{variant:`outline`,className:`text-[12px] uppercase`,children:e.format}),(0,Q.jsx)(`a`,{href:e.docsUrl,target:`_blank`,rel:`noreferrer`,className:`text-[12px] text-soft-foreground underline hover:text-foreground`,children:`docs`})]}),(0,Q.jsxs)(`div`,{className:`settings-config-content-heading`,children:[(0,Q.jsx)(`h3`,{children:e.kind===`mcp`||e.holdsMcp?`MCP configuration`:`File contents`}),(e.kind===`mcp`||e.holdsMcp)&&(0,Q.jsx)(`p`,{children:`Review server commands before saving. MCP servers execute locally.`})]}),t.isPending?(0,Q.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:`Loading file…`}):t.isError?(0,Q.jsx)(`p`,{className:`text-[13px] text-destructive`,children:t.error.message}):(0,Q.jsx)(Hd,{value:u,language:e.format,readOnly:!f,onChange:i,"aria-label":`${e.label} contents`,className:`h-[210px]`}),s&&(0,Q.jsx)(`p`,{"data-slot":`agent-config-format-error`,className:`text-[12px] text-destructive`,children:s}),a&&(0,Q.jsxs)(`div`,{"data-slot":`agent-config-conflict`,className:`flex items-center justify-between gap-2 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-[12px]`,children:[(0,Q.jsx)(`span`,{children:`The file changed on disk since you opened it.`}),(0,Q.jsx)(z,{size:`sm`,variant:`outline`,onClick:()=>void t.refetch(),children:`Reload from disk`})]}),f&&(0,Q.jsxs)(`div`,{className:`settings-form-actions`,children:[(0,Q.jsx)(z,{size:`sm`,onClick:()=>{c(null),o(!1),n.mutate({content:u,version:l},{onSuccess:()=>{i(null),F(`${e.exists?`Saved`:`Created`} ${e.label}`)},onError:e=>{e instanceof Or&&e.status===409?o(!0):e instanceof Or&&e.status===400?c(e.message):F(e.message,{tone:`danger`})}})},disabled:!d||n.isPending,children:e.exists?`Save file`:`Create file`}),(0,Q.jsx)(z,{size:`sm`,variant:`outline`,onClick:()=>i(null),disabled:!d||n.isPending,children:`Reset`}),d&&(0,Q.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:`Unsaved changes`})]}),(0,Q.jsxs)(`div`,{className:`settings-config-save-help`,children:[(0,Q.jsx)(`p`,{"data-slot":`agent-config-precedence`,className:`text-[12px] text-soft-foreground`,children:e.precedence}),(0,Q.jsxs)(`p`,{"data-slot":`agent-config-effect`,className:`text-[12px] text-foreground/80`,children:[Jd(e),e.hotReload?` ${e.hotReload}`:``]}),e.readOnlyReason&&(0,Q.jsx)(`p`,{children:e.readOnlyReason})]})]})}function ef({className:e,size:t=`default`,...n}){return(0,Q.jsx)($c,{"data-slot":`switch`,"data-size":t,className:G(`peer group/switch inline-flex shrink-0 items-center rounded-full border border-transparent shadow-none transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-6 data-[size=default]:w-10 data-[size=sm]:h-3.5 data-[size=sm]:w-6 data-[state=checked]:bg-accent-strong data-[state=unchecked]:bg-input`,e),...n,children:(0,Q.jsx)(tl,{"data-slot":`switch-thumb`,className:G(`pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-[18px] group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-[state=checked]:translate-x-5 group-data-[size=default]/switch:data-[state=unchecked]:translate-x-0.5 group-data-[size=sm]/switch:data-[state=checked]:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-[state=unchecked]:translate-x-0`)})})}var tf=[{id:`claude`,label:`Claude Code`,login:`claude auth login`},{id:`codex`,label:`Codex`,login:`codex login`},{id:`opencode`,label:`OpenCode`,login:`opencode auth login`},{id:`pi`,label:`pi`,login:`pi /login`},{id:`cursor`,label:`Cursor`,login:`agent login`}],nf=e=>({claude:e,codex:e,opencode:e,pi:e,cursor:e}),rf={connected:{label:`Credentials found`,tone:`success`},disconnected:{label:`Not connected`,tone:`pending`},"not-installed":{label:`Not installed`,tone:`neutral`},unknown:{label:`Could not verify`,tone:`danger`}};function af(e,t,n){return{providers:e.providers.map(e=>e.provider===t?{...e,enabled:n}:e)}}function of(){let e=ge(),t=s(),n=Jt(),r=U(),[i,a]=(0,Z.useState)(null),o=(0,Z.useRef)(Promise.resolve()),c=(0,Z.useRef)(nf(0)),l=(0,Z.useRef)(nf(0)),u=(0,Z.useRef)(e.data);(0,Z.useEffect)(()=>{i&&He(e.data,i.provider)?.status===`connected`&&a(null)},[i,e.data]),(0,Z.useEffect)(()=>{if(e.data){if(Object.values(l.current).every(e=>e===0)||!u.current){u.current=e.data;return}u.current={providers:e.data.providers.map(e=>({...e,enabled:l.current[e.provider]>0?He(u.current,e.provider)?.enabled??e.enabled:e.enabled}))}}},[e.data]);let f=(0,Z.useCallback)((e,t)=>{let n=I.providerStatus,i=r.getQueryData(n);if(!i)return;u.current||=i;let a=af(i,e,t);l.current[e]+=1,r.setQueryData(n,a);let s=++c.current[e];o.current=o.current.then(async()=>{try{let i=await d(e,t),a=He(i,e)?.enabled;if(a===void 0)return;if(u.current=af(u.current??i,e,a),s===c.current[e]){let t=r.getQueryData(n);r.setQueryData(n,t?af(t,e,a):i)}}catch(t){if(s===c.current[e]){let i=He(u.current,e)?.enabled,a=r.getQueryData(n);a&&i!==void 0?r.setQueryData(n,af(a,e,i)):u.current?r.setQueryData(n,u.current):r.removeQueries({queryKey:n,exact:!0}),F(t instanceof Error?t.message:String(t),{tone:`danger`})}}finally{--l.current[e]}})},[r]),p=H({mutationFn:e=>vn(e),onSuccess:async(e,t)=>{a(null),F(e.opened?`Finish signing in in the terminal, then check again.`:`Provider is already connected.`),await r.invalidateQueries({queryKey:I.providerStatus}),Lr(t)&&await Qn(r,t,`none`)},onError:(e,t)=>{if(e instanceof Or&&e.command){let n=tf.find(e=>e.id===t)?.label??t;a({provider:t,label:n,message:e.message,command:e.command});return}F(e.message,{tone:`danger`})}}),m=async e=>{try{await navigator.clipboard.writeText(e),F(`Command copied`)}catch{F(`Could not copy the command`,{tone:`danger`})}};return(0,Q.jsxs)(`section`,{id:`providers`,"data-slot":`provider-settings`,className:`scroll-mt-20`,children:[(0,Q.jsxs)(`div`,{className:`mb-2`,children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Providers`}),(0,Q.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Connect the coding agents available on this computer.`})]}),e.isError?(0,Q.jsxs)(`div`,{role:`alert`,className:`mb-3 flex flex-wrap items-center justify-between gap-2 rounded-md border border-danger/30 bg-danger/5 px-3 py-2.5`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-[13px] font-medium text-foreground`,children:`Provider status could not be loaded`}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.error.message})]}),(0,Q.jsx)(z,{type:`button`,variant:`outline`,size:`sm`,disabled:e.isFetching,onClick:()=>void e.refetch(),children:`Retry`})]}):null,(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:tf.map(r=>{let a=He(e.data,r.id),o=a?.status,s=o?rf[o]:e.isPending?{label:`Checking…`,tone:`neutral`}:rf.unknown,c=p.isPending&&p.variables===r.id,l=o===`disconnected`||o===`unknown`,u=a?.authFailureId;return(0,Q.jsxs)(Z.Fragment,{children:[(0,Q.jsxs)(`div`,{"data-slot":`provider-card`,"data-provider":r.id,className:`rounded-md border border-border bg-card px-3.5 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:r.label}),(0,Q.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(q,{tone:s.tone,pulse:e.isPending}),(0,Q.jsx)(`span`,{children:s.label}),a?.enabled===!1?(0,Q.jsx)(`span`,{children:`Disabled`}):null]}),o===`not-installed`?(0,Q.jsxs)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:[`Install `,r.label,`, then run `,(0,Q.jsx)(`code`,{children:r.login}),`.`]}):o===`unknown`||e.isError&&!o?(0,Q.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:`Verification failed. Check again when the provider is available.`}):a?.hint?(0,Q.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:a.hint}):null]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[o===`not-installed`?null:(0,Q.jsx)(ef,{checked:a?.enabled??!0,"aria-label":`Use ${r.label}`,onCheckedChange:e=>f(r.id,e)}),l?(0,Q.jsx)(z,{type:`button`,variant:`ghost`,size:`sm`,disabled:t.isPending,onClick:()=>t.mutate(void 0,{onError:e=>F(e.message,{tone:`danger`})}),children:`Check again`}):null,o===`disconnected`?(0,Q.jsx)(z,{type:`button`,variant:`outline`,size:`sm`,disabled:p.isPending,onClick:()=>p.mutate(r.id),children:c?`Opening…`:`Connect`}):null,u===void 0?null:(0,Q.jsx)(z,{type:`button`,variant:`outline`,size:`sm`,disabled:n.isPending,onClick:()=>n.mutate({provider:r.id,authFailureId:u},{onSuccess:()=>F(`${r.label} can be tried again.`),onError:e=>F(e.message,{tone:`danger`})}),children:`Try again`})]})]}),u===void 0?null:(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`Use this after completing the provider sign-in flow. cezar cannot validate the credential without a task/model request; it will verify it on the next task.`})]}),i?.provider===r.id&&o!==`connected`?(0,Q.jsxs)(`div`,{role:`region`,"aria-label":`${i.label} manual sign-in`,className:`rounded-md border border-pending/40 bg-pending/5 px-3.5 py-3`,children:[(0,Q.jsx)(`p`,{className:`text-[13px] text-foreground`,children:i.message}),(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`code`,{className:`min-w-0 flex-1 overflow-x-auto rounded-sm bg-muted px-2 py-1.5 text-xs`,children:i.command}),(0,Q.jsx)(z,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void m(i.command),children:`Copy command`})]})]}):null]},r.id)})})]})}var sf=2e4;function cf(){let e=Dn(),t=At(),n=ge();return e.isPending?(0,Q.jsx)(`p`,{"data-slot":`agents-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent settings…`}):e.isError?(0,Q.jsx)(W,{icon:(0,Q.jsx)(me,{}),tone:`danger`,title:`Agent settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,Q.jsx)(lf,{config:e.data,catalogs:t,providerStatus:n})}function lf({config:e,catalogs:t,providerStatus:n}){let r=mn(),i=U(),a=H({mutationFn:e=>mr(e),onSuccess:e=>{i.setQueryData(R.config,e),i.invalidateQueries({queryKey:R.health}),i.invalidateQueries({queryKey:R.repo})},onError:e=>F(e.message,{tone:`danger`})}),[o,s]=(0,Z.useState)(e.systemPrompt??``),c=o.trim(),l=c===(e.systemPrompt??``),u=c.length>sf;return(0,Q.jsxs)(`div`,{"data-slot":`agents-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,Q.jsx)(uf,{defaultRunner:e.defaultRunner,providerStatus:n,saving:a.isPending,onPick:e=>a.mutate({defaultRunner:e})}),(0,Q.jsx)(df,{title:`Default model`,hint:e.modelsLocked?`Models are locked to the defaults configured in the native coding-agent settings.`:`The model preselected in the composer for each runner. Auto lets the runner decide per task.`,children:(0,Q.jsx)(`div`,{className:`flex flex-col gap-4`,children:ea.map(r=>{let i=He(n.data,r.id),o=!n.isPending&&!n.isError&&i?.enabled===!0&&i.status===`connected`,s=n.isPending?`Checking provider authentication…`:n.isError?`Provider authentication could not be verified.`:i?.enabled===!1?`This provider is disabled. Enable it above or choose another provider.`:o?void 0:`Connect this provider before selecting it.`,c=t[r.id],l=ta(r.id,c.data,c.isError,c.isFetching),u=ca(r.id,c.data,[e.defaultModels[r.id]]),d=e.defaultModels[r.id]??``,f=u.find(e=>e.id===d)?.label??d??`auto (default)`;return(0,Q.jsxs)(`label`,{className:`settings-option-row`,children:[(0,Q.jsx)(`div`,{children:(0,Q.jsx)(`h3`,{children:r.label})}),e.modelsLocked?(0,Q.jsx)(`output`,{"aria-label":`Default model for ${r.label}`,"data-slot":`agents-model`,"data-runner":r.id,title:`Model selection is locked to native coding-agent settings.`,className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs`,children:f}):(0,Q.jsxs)(`select`,{"aria-label":`Default model for ${r.label}`,"data-slot":`agents-model`,"data-runner":r.id,value:d,title:s??r.desc,disabled:a.isPending||!o,onChange:e=>a.mutate({defaultModels:{[r.id]:e.target.value||null}}),className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[u.map(e=>(0,Q.jsx)(`option`,{value:e.id,children:e.id===``?`Native agent default`:e.label},e.id)),l?(0,Q.jsx)(`option`,{disabled:!0,children:l}):null]})]},r.id)})})}),(0,Q.jsxs)(df,{title:`System prompt`,hint:`Extra instructions for every run in this project.`,children:[(0,Q.jsx)(So,{"aria-label":`System prompt`,"data-slot":`agents-system-prompt`,value:o,onChange:e=>s(e.target.value),placeholder:`Extra rules for every agent run — conventions, tone, review requirements…`,className:`min-h-48 w-full`}),(0,Q.jsxs)(`div`,{className:`settings-form-actions`,children:[(0,Q.jsx)(z,{type:`button`,variant:`primary`,size:`sm`,"data-action":`agents-save-prompt`,disabled:l||u||a.isPending,onClick:()=>a.mutate({systemPrompt:c===``?null:c},{onSuccess:()=>F(c===``?`System prompt cleared`:`System prompt saved`)}),children:`Save prompt`}),u?(0,Q.jsxs)(`p`,{"data-slot":`agents-prompt-limit`,className:`text-[11px] text-danger`,children:[c.length.toLocaleString(),` characters — the limit is`,` `,sf.toLocaleString(),`.`]}):(0,Q.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Leave empty and save to clear. Applied to new runs only.`})]})]}),(0,Q.jsxs)(`section`,{"data-slot":`agents-task-runs`,className:`settings-field flex flex-col gap-5`,children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Task runs`}),(0,Q.jsx)(ff,{title:`Live title updates`,hint:`Refresh a task's short title through the namer model as the run progresses. A manual rename always wins and stops updates for that task.`,children:(0,Q.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,Q.jsx)(ef,{"aria-label":`Live title updates`,"data-slot":`agents-live-title-updates`,checked:e.liveTitleUpdates??!0,disabled:a.isPending,onCheckedChange:e=>a.mutate({liveTitleUpdates:e},{onSuccess:()=>F(e?`Live title updates on`:`Live title updates off`)})}),(0,Q.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.liveTitleUpdates??!0?`On`:`Off`,e.liveTitleUpdates===null&&` (default)`]})]})}),(0,Q.jsx)(ff,{title:`Review changes before finishing`,hint:`When on, a task with changes pauses so you can Accept, Send back, or open a Draft PR. Autonomous tasks always skip this and finish on their own. Default: off — tasks finish without asking.`,children:(0,Q.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,Q.jsx)(ef,{"aria-label":`Review changes before finishing`,"data-slot":`agents-review-gate`,checked:e.reviewGate??!1,disabled:a.isPending,onCheckedChange:e=>a.mutate({reviewGate:e},{onSuccess:()=>F(e?`Review gate on`:`Review gate off`)})}),(0,Q.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.reviewGate??!1?`On`:`Off`,e.reviewGate===null&&` (default)`]})]})}),(0,Q.jsx)(ff,{title:`Base branch`,hint:`New task worktrees branch from this and draft PRs target it. Also settable from the Git view.`,children:r.data?.info?(0,Q.jsxs)(`select`,{"aria-label":`Base branch`,"data-slot":`agents-base-branch`,value:e.baseBranch??``,disabled:a.isPending,onChange:e=>a.mutate({baseBranch:e.target.value||null}),className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[(0,Q.jsx)(`option`,{value:``,children:`follow checked-out branch (default)`}),r.data.branches.map(e=>(0,Q.jsx)(`option`,{value:e,children:e},e))]}):(0,Q.jsx)(`p`,{"data-slot":`agents-base-branch-unavailable`,className:`text-[13px] text-soft-foreground`,children:r.isPending?`Loading branches…`:`Not a git repository — tasks run in place, no branching.`})})]}),(0,Q.jsxs)(`details`,{className:`settings-disclosure`,children:[(0,Q.jsx)(`summary`,{children:`Provider connections`}),(0,Q.jsx)(of,{})]})]})}function uf({defaultRunner:e,providerStatus:t,saving:n,onPick:r}){let i=fr(),a=V(),o=hr(),s=mn(),c=Tr(),l=o.projectId??`default`,u=s.data?.info?.root,d=u?i.data?.selections[u]:void 0,f=i.data?.defaults,p=Sd(i.data?.profiles??[]),m=Cd(p);return(0,Q.jsxs)(df,{title:`Default runner`,hint:`Project defaults. A task can override these choices.`,children:[(0,Q.jsx)(Od,{rows:p,runner:e,accountFor:e=>d?.[e]??f?.[e]??null,providerStatus:t,disabled:n,accountDisabled:c.isPending||a.data===void 0,onPick:(t,n,i)=>{t!==e&&r(t),i&&c.mutate({projectId:l,provider:t,profileId:n},{onError:e=>F(e.message,{tone:`danger`})})}}),!t.isPending&&!t.isError&&He(t.data,e)?.enabled===!1?(0,Q.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`This provider is disabled. Enable it above or choose another provider.`}):null,m?(0,Q.jsx)(`p`,{className:`max-w-md text-[13px] text-muted-foreground`,children:`The account is personal and never committed. Tasks already started under another account can’t be resumed here — their sessions live in that account’s folder.`}):null]})}function df({title:e,hint:t,children:n}){return(0,Q.jsxs)(`section`,{className:`settings-field flex flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,Q.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}function ff({title:e,hint:t,children:n}){return(0,Q.jsxs)(`section`,{className:`settings-option-row`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h3`,{children:e}),(0,Q.jsx)(`p`,{children:t})]}),n]})}var pf=`cez-accent`,mf=`cez-density`,hf=`cez-width`,gf=`cezarion`,_f=`comfortable`,vf=`narrow`;function yf(e){return gf}function bf(e){return e===`comfortable`||e===`compact`||e===`ultra`?e:_f}function xf(e){return e===`narrow`||e===`wide`?e:vf}function Sf(e){let t=e&&typeof e==`object`?e:{};return{accent:yf(t.accent),density:bf(t.density),width:xf(t.width)}}function Cf(){try{return{accent:yf(localStorage.getItem(pf)),density:bf(localStorage.getItem(mf)),width:xf(localStorage.getItem(hf))}}catch{return{accent:gf,density:_f,width:vf}}}function wf(e){try{localStorage.setItem(pf,e.accent),localStorage.setItem(mf,e.density),localStorage.setItem(hf,e.width)}catch{}}function Tf(e,t){t.accent===`cezarion`?delete e.dataset.accent:e.dataset.accent=t.accent,t.density===`comfortable`?delete e.dataset.density:e.dataset.density=t.density,t.width===`narrow`?delete e.dataset.width:e.dataset.width=t.width}var Ef=Z.createContext(null);function Df({children:e}){let t=U(),n=De(),[r,i]=Z.useState(Cf),a=n.data;Z.useEffect(()=>{if(a===void 0)return;let e=Sf(a.appearance);i(e),wf(e)},[a]),Z.useLayoutEffect(()=>{Tf(document.documentElement,r)},[r]);let o=Z.useCallback(e=>{i(e),wf(e),Sr({appearance:e}).then(e=>t.setQueryData(I.uiState,e)).catch(e=>{F(e instanceof Error?e.message:String(e),{tone:`danger`}),t.invalidateQueries({queryKey:I.uiState})})},[t]),s=Z.useCallback(e=>o({...r,accent:e}),[o,r]),c=Z.useCallback(e=>o({...r,density:e}),[o,r]),l=Z.useCallback(e=>o({...r,width:e}),[o,r]),u=Z.useMemo(()=>({accent:r.accent,density:r.density,width:r.width,setAccent:s,setDensity:c,setWidth:l}),[r,s,c,l]);return(0,Q.jsx)(Ef.Provider,{value:u,children:e})}function Of(){let e=Z.useContext(Ef);if(!e)throw Error(`cezar: useAppearance() must be called inside <AppearanceProvider>`);return e}var kf=`cez-theme`,Af=`(prefers-color-scheme: light)`,jf=`dark`;function Mf(e){return e===`light`||e===`dark`||e===`system`?e:jf}function Nf(e,t){return e===`light`||e===`system`&&t?`light`:`dark`}function Pf(){try{return Mf(localStorage.getItem(kf))}catch{return jf}}function Ff(e){try{localStorage.setItem(kf,e)}catch{}}function If(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(Af).matches}function Lf(e,t){e.classList.toggle(`light`,t===`light`),e.style.colorScheme=t}function Rf(e){return`/cezarion-mark-${e}.svg`}function zf(e){let t=document.querySelector(`link[rel="icon"]`);t&&(t.href=Rf(e))}var Bf=Z.createContext(null);function Vf({children:e}){let[t,n]=Z.useState(Pf),[r,i]=Z.useState(If);Z.useEffect(()=>{let e=window.matchMedia?.(Af);if(!e)return;i(e.matches);let t=e=>i(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let a=Nf(t,r);Z.useLayoutEffect(()=>{Lf(document.documentElement,a),zf(a)},[a]);let o=Z.useCallback(e=>{n(e),Ff(e)},[]),s=Z.useMemo(()=>({theme:t,resolvedTheme:a,setTheme:o}),[t,a,o]);return(0,Q.jsx)(Bf.Provider,{value:s,children:e})}function Hf(){let e=Z.useContext(Bf);if(!e)throw Error(`cezar: useTheme() must be called inside <ThemeProvider>`);return e}var Uf=[{value:`system`,label:`System`,icon:dc},{value:`light`,label:`Light`,icon:yc},{value:`dark`,label:`Dark`,icon:fc}],Wf=[{value:`cezarion`,label:`Cezarion`,swatch:`var(--accent-strong)`}],Gf=[{value:`comfortable`,label:`Comfortable`},{value:`compact`,label:`Compact`},{value:`ultra`,label:`Compact for real`}],Kf=[{value:`narrow`,label:`Narrow`},{value:`wide`,label:`Wide`}];function qf({slot:e,label:t,value:n,options:r,onChange:i}){return(0,Q.jsx)(`div`,{role:`radiogroup`,"aria-label":t,"data-slot":e,className:`inline-flex w-fit gap-0.5 rounded-md border border-border bg-card p-0.5 max-md:max-w-full max-md:flex-wrap`,children:r.map(e=>{let t=e.value===n;return(0,Q.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t,"data-value":e.value,onClick:()=>i(e.value),className:G(`flex min-h-11 items-center gap-2 rounded-sm px-3 py-1.5 text-[13px] font-medium transition-colors`,t?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:[e.icon?(0,Q.jsx)(e.icon,{"aria-hidden":`true`,className:`size-3.5`}):null,e.swatch?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`size-3 rounded-full border border-border`,style:{background:e.swatch}}):null,e.label]},e.value)})})}function Jf({title:e,hint:t,children:n}){return(0,Q.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,Q.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}function Yf(){let{theme:e,setTheme:t}=Hf(),{accent:n,density:r,width:i,setAccent:a,setDensity:o,setWidth:s}=Of();return(0,Q.jsxs)(`div`,{"data-slot":`appearance-section`,className:`flex w-full flex-col gap-7 rounded-lg border border-border bg-card p-5`,children:[(0,Q.jsx)(Jf,{title:`Theme`,hint:`System follows your OS preference. Applies to this browser.`,children:(0,Q.jsx)(qf,{slot:`appearance-theme`,label:`Theme`,value:e,options:Uf,onChange:t})}),Wf.length>1?(0,Q.jsx)(Jf,{title:`Accent`,hint:`The cockpit brand accent. Saved with your workspace appearance.`,children:(0,Q.jsx)(qf,{slot:`appearance-accent`,label:`Accent`,value:n,options:Wf,onChange:a})}):null,(0,Q.jsx)(Jf,{title:`Density`,hint:`Compact tightens spacing across the cockpit — text stays the same size.`,children:(0,Q.jsx)(qf,{slot:`appearance-density`,label:`Density`,value:r,options:Gf,onChange:o})}),(0,Q.jsx)(Jf,{title:`Reading width`,hint:`Wide lets a task's session and commits use more of the screen. Narrow keeps a comfortable reading column. The Changes tab is always full-width.`,children:(0,Q.jsx)(qf,{slot:`appearance-width`,label:`Reading width`,value:i,options:Kf,onChange:s})}),(0,Q.jsxs)(`div`,{className:`settings-appearance-preview settings-readout`,children:[(0,Q.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:`PREVIEW`}),(0,Q.jsx)(`p`,{className:`mt-3 text-base`,children:`Review finalization retries`}),(0,Q.jsxs)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:[`Needs you · cezar · Task `,`#`,`227`]}),(0,Q.jsx)(`span`,{className:`mt-3 inline-flex rounded-md border border-accent-strong/30 bg-accent-strong/10 px-4 py-3 text-xs text-accent-text`,children:`Open task`})]}),(0,Q.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:`Changes apply immediately. Theme is browser-local; density and reading width are saved with your workspace.`})]})}var Xf=`http://localhost:4321`;function Zf(e,t,n,r=Xf,i=null){let a=e=>encodeURIComponent(e).replaceAll(`'`,`%27`),o=`(()=>{const m=location.href.match(/^https:\\/\\/github\\.com\\/([^\\/]+)\\/([^\\/]+)\\/(pull|issues)\\/\\d+/);if(!m){alert('Open a GitHub PR or issue first');return;}const q='${`${e?`skill=${a(e)}&`:``}auto=${t?`1`:`0`}&key=${a(n)}&ref=`}'+encodeURIComponent(location.href);open('${r.replaceAll(`'`,`%27`)}${i===null||i===``?`/new`:`/p/${a(i)}/new`}?'+q,'_blank');})();`;return`javascript:${encodeURIComponent(o)}`}function Qf(){let e=b();return e.isPending?(0,Q.jsx)(`p`,{"data-slot":`bookmarklets-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading bookmarklets…`}):e.isError?(0,Q.jsx)(W,{icon:(0,Q.jsx)(xt,{}),tone:`danger`,heading:`h2`,title:`Could not load bookmarklets`,subtitle:e.error.message}):(0,Q.jsx)(`div`,{className:`flex min-h-full flex-1 overflow-y-auto`,children:(0,Q.jsx)($f,{skills:Oo(e.data??[])})})}function $f({skills:e}){let t=yn(),n=P(),r=V(),[i,a]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(``),c=t.data?.key??``,l=window.location.origin,u=za()??n.data?.bootProject??null,d=r.data?.projects.find(e=>e.id===u)?.name??Zy(n.data)?.name??null,f=o.trim().toLowerCase(),p=e.filter(e=>e.name.toLowerCase().includes(f));return(0,Q.jsxs)(`div`,{"data-slot":`bookmarklet-panel`,className:`flex w-full min-w-0 flex-col gap-[18px] p-5`,children:[(0,Q.jsx)(`h2`,{className:`text-xl font-semibold`,children:`Run from GitHub`}),(0,Q.jsxs)(`p`,{className:`text-[13px] leading-relaxed text-muted-foreground`,children:[`Drag a launcher to your browser's bookmarks bar. Then open a GitHub PR or issue and click that bookmark. Cezar must be running: `,(0,Q.jsx)(`span`,{className:`font-mono`,children:`npx cezarion`}),`.`]}),(0,Q.jsxs)(`div`,{className:`settings-bookmarklet-project rounded-lg bg-background p-3.5`,children:[(0,Q.jsxs)(`p`,{className:`text-[13px]`,children:[`Project`,d?` · ${d}`:``]}),(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`Launchers target this cockpit and this project. Keep Cezarion running.`})]}),(0,Q.jsxs)(`label`,{className:`flex min-h-11 items-center gap-2.5 text-[13px] font-medium`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,"data-slot":`bm-auto`,checked:i,onChange:e=>a(e.target.checked),className:`size-[18px] shrink-0`}),`One-click launch (auto-submit)`]}),(0,Q.jsx)(`p`,{className:`text-xs leading-relaxed text-soft-foreground`,children:`Off by default. Re-drag the launchers after changing this option.`}),(0,Q.jsx)(`div`,{"data-slot":`bm-generic`,className:`rounded-lg border border-border bg-muted/30 p-3.5`,children:(0,Q.jsx)(ep,{label:d?`cezar (${d}): this PR/issue`:`cezar: this PR/issue`,url:Zf(``,!1,c,l,u),generic:!0,hint:`Prefills the form only—never auto-starts, even when auto-submit is on.`})}),(0,Q.jsx)(Ku,{"data-slot":`bm-filter`,placeholder:`Filter bookmarklet skills…`,"aria-label":`Filter bookmarklet skills`,value:o,onChange:e=>s(e.target.value),className:`h-11 text-[13px]`}),(0,Q.jsx)(`div`,{"data-slot":`bm-list`,className:`flex flex-col divide-y divide-border [&>[data-slot=bm-row]]:py-3.5`,children:p.length>0?p.map(e=>(0,Q.jsx)(ep,{label:d?`/${e.name} (${d})`:`/${e.name}`,url:Zf(e.name,i,c,l,u)},e.path)):(0,Q.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:e.length>0?`(no skills match)`:`(no skills yet — the generic launcher above still works)`})}),(0,Q.jsx)(`p`,{className:`text-xs leading-relaxed text-soft-foreground`,children:`These are bookmarklet drag sources, not run buttons. Clicking one here explains installation; it does not start a task.`}),(0,Q.jsx)(`p`,{className:`text-xs leading-relaxed text-soft-foreground md:hidden`,children:`No drag-and-drop? Copy the URL for manual bookmark setup where your browser allows it, or install using a desktop browser.`})]})}function ep({label:e,url:t,hint:n,generic:r=!1}){let i=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{i.current?.setAttribute(`href`,t)},[t]);let a=async()=>{try{await navigator.clipboard.writeText(t),F(`Bookmarklet URL copied.`)}catch{F(`Copy failed — drag the button instead.`,{tone:`danger`})}};return(0,Q.jsxs)(`div`,{"data-slot":`bm-row`,className:`flex min-w-0 flex-col gap-2.5`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`a`,{ref:i,draggable:!0,"data-slot":`bm-link`,title:`Drag me to your bookmarks bar`,"aria-label":`${r?`Drag to bookmarks`:`Drag launcher`}: ${e}`,onClick:e=>{e.preventDefault(),F(`Drag me to your bookmarks bar`)},className:`inline-flex min-h-11 min-w-0 items-center rounded-md border border-border px-3 text-xs font-medium transition-colors hover:bg-muted ${r?`bg-accent-strong/10 text-accent-text`:`bg-card text-foreground`}`,children:(0,Q.jsx)(`span`,{className:`break-words`,children:e})}),(0,Q.jsx)(`button`,{type:`button`,"data-slot":`bm-copy`,title:`Copy the bookmarklet URL`,onClick:()=>void a(),className:`min-h-11 shrink-0 rounded-md border border-border px-3 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:`Copy URL`})]}),n?(0,Q.jsx)(`p`,{className:`text-xs leading-relaxed text-soft-foreground`,children:n}):null]})}function tp(e){return{enabled:(e&&typeof e==`object`?e:{}).enabled===!0}}function np(){let e=globalThis.Notification;if(typeof e!=`function`)return`unsupported`;let t=e.permission;return t===`granted`||t===`denied`?t:`default`}function rp(e,t){let n=new Map,r=[];for(let i of t??[]){let t={status:i.status,wantsAttention:Un(i)};n.set(i.id,t);let a=e.get(i.id);a!==void 0&&(a.status===t.status&&a.wantsAttention===t.wantsAttention||t.wantsAttention&&r.push(i))}return{entering:r,statuses:n}}function ip(e){return e.enabled&&e.hidden&&e.permission===`granted`}function ap(e){let t=C(e).label;return{title:e.titleSummary??e.title,body:`Task ${t}`,tag:`cezar-run-${e.id}`}}function op(){let e=U(),t=De(),[n,r]=Z.useState(!1),[i,a]=Z.useState(np),o=t.data;Z.useEffect(()=>{o!==void 0&&r(tp(o.notifications).enabled)},[o]);let s=Z.useCallback(t=>{r(t),Sr({notifications:{enabled:t}}).then(t=>e.setQueryData(I.uiState,t)).catch(t=>{F(t instanceof Error?t.message:String(t),{tone:`danger`}),e.invalidateQueries({queryKey:I.uiState})})},[e]),c=Z.useCallback(e=>{if(!e){s(!1);return}if(np()!=="default"){s(!0);return}s(!0),Notification.requestPermission().then(e=>a(e)).catch(()=>a(np()))},[s]),l=i===`unsupported`;return(0,Q.jsx)(`div`,{"data-slot":`notifications-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:(0,Q.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:(0,Q.jsx)(`label`,{htmlFor:`notifications-enabled`,children:`Notify when an agent needs you`})}),(0,Q.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`A browser notification when a task starts waiting, asks for review, or fails — only while this tab is in the background. Off by default.`})]}),(0,Q.jsx)(ef,{id:`notifications-enabled`,"data-slot":`notifications-toggle`,checked:n,disabled:l,onCheckedChange:c})]}),l?null:(0,Q.jsxs)(`p`,{"data-slot":`notifications-permission`,"data-permission":i,className:`mt-4 text-[13px] text-muted-foreground`,children:[`Browser permission · `,i===`granted`?`Allowed`:i===`denied`?`Blocked`:`Not requested`]}),(0,Q.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Permission is requested only when you enable notifications.`}),l?(0,Q.jsx)(`p`,{"data-slot":`notifications-unsupported`,className:`text-[13px] text-muted-foreground`,children:`This browser does not support notifications, so the toggle is unavailable here.`}):null,!l&&n&&i===`denied`?(0,Q.jsxs)(`div`,{"data-slot":`notifications-denied`,className:`mt-5 flex flex-col gap-2`,children:[(0,Q.jsx)(`h3`,{className:`text-sm`,children:`Allow notifications in your browser`}),(0,Q.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`This browser is blocking notifications. Your preference is saved. Allow notifications in the browser’s site settings to receive them.`}),(0,Q.jsx)(`p`,{className:`settings-readout`,children:`Notifications are blocked for this site.`})]}):null]})})}function sp({open:e,onOpenChange:t}){let[n,r]=(0,Z.useState)(null),[i,a]=(0,Z.useState)(null),o=V(),s=tn(),c=en(),l=new Set((o.data?.projects??[]).map(e=>e.root)),u=e=>{r(e),a(null),s.reset()},d=Ed(n,i);return(0,Q.jsx)(vo,{open:e,onOpenChange:t,children:(0,Q.jsxs)(bo,{"data-slot":`add-project-dialog`,className:`sm:max-w-lg`,children:[(0,Q.jsxs)(yo,{children:[(0,Q.jsx)(xo,{children:`Open local folder`}),(0,Q.jsx)(_o,{children:`Pick the folder cezar should run in. Git repos are marked; any folder works.`})]}),(0,Q.jsx)(Td,{path:n,selected:i,onSelect:a,onEnter:u,emptyHint:`No subfolders here — “Add project” registers this folder.`,decorate:e=>(0,Q.jsxs)(Q.Fragment,{children:[e.isRepo?(0,Q.jsx)(gd,{variant:`outline`,className:`shrink-0 text-[12px]`,children:`git`}):null,l.has(e.path)?(0,Q.jsx)(gd,{variant:`ghost`,className:`shrink-0 text-[12px] text-muted-foreground`,children:`already added`}):null]})}),s.isError?(0,Q.jsx)(`p`,{"data-slot":`add-project-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:s.error instanceof Error?s.error.message:`could not add that folder`}):null,(0,Q.jsxs)(go,{className:`min-w-0 sm:items-center sm:justify-between`,children:[(0,Q.jsx)(`span`,{"data-slot":`add-project-target`,className:`min-w-0 truncate font-mono text-[11px] text-muted-foreground`,title:d??void 0,children:d??``}),(0,Q.jsxs)(`span`,{className:`flex shrink-0 gap-2`,children:[(0,Q.jsx)(z,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,Q.jsx)(z,{"data-slot":`add-project-confirm`,disabled:d===null||s.isPending,onClick:()=>{d===null||s.isPending||s.mutate(d,{onSuccess:({project:e})=>{t(!1),c(`/p/${encodeURIComponent(e.id)}/`)}})},children:s.isPending?`Adding…`:`Add project`})]})]})]})})}function cp(){let e=Pn();return{isPending:e.isPending,confirm:(t,n)=>e.mutate(t.id,{onSuccess:()=>{F(`${t.name} removed from the workspace — its files are untouched`),n?.()},onError:e=>F(e.message,{tone:`danger`})})}}function lp({project:e,onOpenChange:t,onConfirm:n}){return(0,Q.jsx)(rr,{open:e!==null,onOpenChange:t,children:(0,Q.jsxs)(pn,{children:[(0,Q.jsxs)($n,{children:[(0,Q.jsxs)(Ut,{children:[`Remove `,e?.name,` from the workspace?`]}),(0,Q.jsxs)(Mt,{children:[`This only unregisters the project — `,(0,Q.jsx)(`strong`,{children:`nothing on disk is deleted`}),`. The folder, its git history and its task history all stay exactly where they are, and opening it again re-registers it with everything intact.`,(0,Q.jsx)(`span`,{className:`mt-1 block truncate font-mono text-[11px] text-foreground`,title:e?.root,children:e?.root})]})]}),(0,Q.jsxs)(In,{children:[(0,Q.jsx)(Xn,{children:`Keep it`}),(0,Q.jsx)(An,{"data-action":`projects-confirm-remove`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:n,children:`Remove from list`})]})]})})}function up({title:e,hint:t,children:n}){return(0,Q.jsxs)(`section`,{className:`settings-field flex flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,Q.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}var dp=1,fp={ok:`ok`,"not-git":`no git repo`,missing:`folder not found`};function pp(e){let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function mp(){let e=bn(),t=V();return e.isPending||t.isPending?(0,Q.jsx)(`p`,{"data-slot":`projects-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading projects…`}):e.isError||t.isError?(0,Q.jsx)(W,{icon:(0,Q.jsx)(kn,{}),tone:`danger`,title:`Project settings did not load`,subtitle:(e.error??t.error)?.message,heading:`h2`}):(0,Q.jsx)(hp,{config:e.data,registry:t.data})}function hp({config:e,registry:t}){let[n,r]=(0,Z.useState)(!1);return(0,Q.jsxs)(`div`,{"data-slot":`projects-section`,className:`mx-auto flex w-full max-w-4xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,Q.jsx)(gp,{configKey:`browseRoot`,value:e.browseRoot,title:`Default browse folder`,hint:`Where “Open local folder…” starts. The picker cannot navigate above this folder.`,placeholder:`~/`,slot:`browse`,savedLabel:`Browse folder`,footer:`Only affects folder browsing; GitHub checkouts use the separate checkout folder.`}),(0,Q.jsx)(gp,{configKey:`projectsDir`,value:e.projectsDir,title:`Default checkout folder`,hint:`Where “Clone from GitHub” puts new projects: <folder>/<project name>.`,placeholder:`~/cezar/projects`,slot:`checkout`,savedLabel:`Checkout folder`,footer:`Only affects new checkouts; projects already registered keep their location.`,refreshProjects:!0}),(0,Q.jsx)(_p,{registry:t,workspaceMax:e.resources.maxParallel}),(0,Q.jsx)(z,{className:`self-start`,onClick:()=>r(!0),children:`Add project`}),n?(0,Q.jsx)(sp,{open:!0,onOpenChange:r}):null]})}function gp({configKey:e,value:t,title:n,hint:r,placeholder:i,slot:a,savedLabel:o,footer:s,refreshProjects:c=!1}){let l=U(),u=H({mutationFn:t=>Rt(e===`browseRoot`?{browseRoot:t}:{projectsDir:t}),onSuccess:t=>{l.setQueryData(I.config,t),e===`browseRoot`?l.invalidateQueries({queryKey:I.fsBrowseRoot}):c&&l.invalidateQueries({queryKey:I.projects})}}),[d,f]=(0,Z.useState)(t),p=d.trim(),m=p===t,h=u.isError?u.error.message:null;return(0,Q.jsxs)(up,{title:n,hint:`${r} ${e===`browseRoot`?`Choose an existing folder; it is verified writable before saving.`:`The folder is created recursively if needed, then verified writable before saving.`}`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`input`,{type:`text`,spellCheck:!1,"aria-label":n,"aria-invalid":h!==null,"data-slot":`projects-${a}-root`,value:d,disabled:u.isPending,placeholder:i,onChange:e=>{f(e.target.value),u.isError&&u.reset()},className:`block w-full max-w-sm rounded-md border border-input bg-card px-3 py-1.5 font-mono text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-danger disabled:opacity-50`}),(0,Q.jsx)(z,{type:`button`,variant:`outline`,size:`sm`,"data-action":`projects-save-${a}-root`,disabled:m||p===``||u.isPending,onClick:()=>u.mutate(p,{onSuccess:()=>F(`${o} set to ${p}`)}),children:`Save`})]}),h===null?(0,Q.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:s}):(0,Q.jsxs)(`p`,{"data-slot":`projects-${a}-root-error`,role:`alert`,className:`text-[11px] text-danger`,children:[h,` — setting unchanged`]})]})}function _p({registry:e,workspaceMax:t}){let[n,r]=(0,Z.useState)(null),i=cp(),a=(0,Z.useMemo)(()=>fe(e.projects),[e.projects]);return(0,Q.jsxs)(up,{title:`Registered projects`,hint:`Connected repositories. Removing a project only unregisters it — no files on disk are deleted.`,children:[e.projects.length===0?(0,Q.jsx)(`p`,{"data-slot":`projects-empty`,className:`text-[13px] text-soft-foreground`,children:`No projects registered yet.`}):(0,Q.jsx)(`div`,{className:`overflow-x-auto rounded-md border border-border`,children:(0,Q.jsxs)(`table`,{className:`w-full border-collapse text-sm`,children:[(0,Q.jsx)(`caption`,{className:`sr-only`,children:`Projects registered in this workspace`}),(0,Q.jsxs)(`colgroup`,{children:[(0,Q.jsx)(`col`,{}),(0,Q.jsx)(`col`,{style:{width:`104px`}}),(0,Q.jsx)(`col`,{style:{width:`260px`}}),(0,Q.jsx)(`col`,{style:{width:`150px`}}),(0,Q.jsx)(`col`,{style:{width:`72px`}}),(0,Q.jsx)(`col`,{style:{width:`92px`}})]}),(0,Q.jsx)(`thead`,{children:(0,Q.jsxs)(`tr`,{className:`border-b border-border text-left text-[12px] text-soft-foreground`,children:[(0,Q.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Project`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Status`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Tags`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Max parallel`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Added`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium text-right`,children:`Actions`})]})}),(0,Q.jsx)(`tbody`,{children:e.projects.map(n=>(0,Q.jsx)(vp,{project:n,isBoot:n.id===e.bootProject,workspaceMax:t,vocabulary:a,disabled:i.isPending,onRemove:()=>r(n)},n.id))})]})}),(0,Q.jsx)(lp,{project:n,onOpenChange:e=>!e&&r(null),onConfirm:()=>{if(!n)return;let e=n;r(null),i.confirm(e)}})]})}function vp({project:e,isBoot:t,workspaceMax:n,vocabulary:r,disabled:i,onRemove:a}){return(0,Q.jsxs)(`tr`,{"data-slot":`project-row`,"data-project":e.id,className:`border-b border-border last:border-0`,children:[(0,Q.jsxs)(`th`,{scope:`row`,className:`max-w-0 px-3 py-2 text-left font-normal`,children:[(0,Q.jsx)(`span`,{className:`block truncate text-foreground`,children:e.name}),(0,Q.jsx)(`span`,{className:`block truncate font-mono text-[11px] text-soft-foreground`,title:e.root,children:e.root})]}),(0,Q.jsxs)(`td`,{className:`px-3 py-2`,children:[(0,Q.jsx)(`span`,{"data-slot":`project-status`,className:e.status===`missing`?`text-[12px] text-danger`:`text-[12px] text-soft-foreground`,children:fp[e.status]}),e.status===`missing`?null:(0,Q.jsxs)(`span`,{className:`ml-1 text-[11px] text-soft-foreground`,children:[`· `,e.source]})]}),(0,Q.jsx)(`td`,{className:`px-3 py-2`,children:(0,Q.jsx)(yp,{project:e,vocabulary:r})}),(0,Q.jsx)(`td`,{className:`px-3 py-2`,children:(0,Q.jsx)(bp,{project:e,workspaceMax:n})}),(0,Q.jsx)(`td`,{className:`px-3 py-2 tabular-nums text-soft-foreground`,children:pp(e.addedAt)}),(0,Q.jsxs)(`td`,{className:`px-3 py-2 text-right`,children:[e.status===`missing`?null:(0,Q.jsx)(z,{asChild:!0,variant:`outline`,className:`mr-2`,children:(0,Q.jsx)(L,{to:`/p/${encodeURIComponent(e.id)}`,children:`Open`})}),(0,Q.jsx)(z,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`project-remove`,"aria-label":`Remove ${e.name} from the workspace — unregisters it, no files are deleted`,title:t?`cezar is serving this project — it re-registers itself at every start`:void 0,disabled:i||t,onClick:a,children:`Remove`})]})]})}function yp({project:e,vocabulary:t}){let n=Cn(),[r,i]=(0,Z.useState)(``),[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(-1),l=(0,Z.useRef)(null),u=e.tags??[],d=Se(t,u,r),f=a&&d.length>0,p=(t,r)=>{n.mutate({id:e.id,tags:t},{onSuccess:()=>F(r),onError:e=>F(e.message,{tone:`danger`})})},m=t=>{let n=t.trim().slice(0,32);if(c(-1),n){if(u.some(e=>e.toLowerCase()===n.toLowerCase())){i(``);return}if(u.length>=20){F(`${e.name} already has the maximum of 20 tags`,{tone:`danger`});return}i(``),p([...u,n],`${e.name} tagged \u201c${n}\u201d`)}},h=t=>{p(u.filter(e=>e!==t),`\u201c${t}\u201d removed from ${e.name}`)},g=`project-tag-suggestions-${e.id}`;return(0,Q.jsxs)(`div`,{"data-slot":`project-tags`,className:`flex flex-wrap items-center gap-1`,children:[u.map(t=>(0,Q.jsxs)(`span`,{"data-slot":`project-tag`,className:`inline-flex max-w-full items-center gap-1 rounded-full bg-accent-strong/15 py-px pr-1 pl-2 text-[11px] font-medium whitespace-nowrap text-accent-text`,children:[t,(0,Q.jsx)(`button`,{type:`button`,"data-action":`project-tag-remove`,"aria-label":`Remove tag ${t} from ${e.name}`,disabled:n.isPending,onClick:()=>h(t),className:`rounded-full p-0.5 hover:bg-accent-strong/25 disabled:opacity-50`,children:(0,Q.jsx)(or,{className:`size-3`,"aria-hidden":`true`})})]},t)),(0,Q.jsxs)(Yi,{open:f,onOpenChange:o,children:[(0,Q.jsx)(Xi,{asChild:!0,children:(0,Q.jsx)(`input`,{ref:l,type:`text`,"data-slot":`project-tag-input`,"aria-label":`Add a tag to ${e.name}`,role:`combobox`,"aria-expanded":f,"aria-controls":f?g:void 0,"aria-autocomplete":`list`,"aria-activedescendant":f&&s>=0?`${g}-${s}`:void 0,placeholder:u.length===0?`Add tag…`:`+`,value:r,maxLength:32,disabled:n.isPending,onFocus:()=>o(!0),onBlur:()=>o(!1),onChange:e=>{if(o(!0),c(-1),e.target.value.includes(`,`)){i(e.target.value.replace(/,/g,``));return}i(e.target.value)},onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(d.length===0)return;e.preventDefault(),o(!0);let t=e.key===`ArrowDown`?1:-1,n=s+t;c(n>=d.length?-1:n<-1?d.length-1:n);return}if(e.key===`Escape`&&f){e.preventDefault(),o(!1),c(-1);return}if(e.key===`Enter`||e.key===`,`){e.preventDefault(),m(s>=0?d[s]??r:r);return}if(e.key===`Tab`){o(!1);return}if(e.key===`Backspace`&&r===``&&u.length>0){e.preventDefault();let t=u[u.length-1];t!==void 0&&h(t)}},className:`h-6 w-16 min-w-0 flex-1 rounded-md border border-input bg-card px-1.5 text-[12px] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`})}),(0,Q.jsxs)(Ji,{align:`start`,sideOffset:4,id:g,role:`listbox`,"data-slot":`project-tag-suggestions`,className:`w-56 p-1`,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,Q.jsx)(`p`,{className:`px-2 pt-1 pb-1.5 text-[11px] text-soft-foreground`,children:`Tags used in this workspace`}),d.map((e,t)=>(0,Q.jsx)(`button`,{type:`button`,id:`${g}-${t}`,role:`option`,"aria-selected":t===s,"data-slot":`project-tag-suggestion`,onMouseDown:e=>e.preventDefault(),onClick:()=>{m(e),l.current?.focus()},onMouseEnter:()=>c(t),className:G(`flex w-full items-center rounded-sm px-2 py-1 text-left text-[12px] font-medium text-accent-text`,t===s&&`bg-muted`),children:e},e))]})]})]})}function bp({project:e,workspaceMax:t}){let n=Cn(),r=e.maxParallel===void 0?``:String(e.maxParallel);return(0,Q.jsxs)(`select`,{"aria-label":`Max parallel tasks for ${e.name}`,"data-slot":`project-max-parallel`,value:r,disabled:n.isPending,onChange:r=>{let i=r.target.value,a=i===``?null:Number(i);n.mutate({id:e.id,maxParallel:a},{onSuccess:()=>F(a===null?`${e.name} inherits the workspace limit (${t})`:`${e.name} runs at most ${a} task${a===1?``:`s`} at a time`),onError:e=>F(e.message,{tone:`danger`})})},className:`block w-44 rounded-md border border-input bg-card px-2 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[(0,Q.jsxs)(`option`,{value:``,children:[`Inherit workspace (`,t,`)`]}),Array.from({length:16},(e,t)=>t+dp).map(e=>(0,Q.jsx)(`option`,{value:e,children:e},e))]})}function xp(){let e=w();return e.isPending?(0,Q.jsx)(`p`,{"data-slot":`prompt-templates-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading prompt templates…`}):e.isError?(0,Q.jsx)(W,{icon:(0,Q.jsx)(Oe,{}),tone:`danger`,title:`Prompt templates did not load`,subtitle:e.error.message,heading:`h2`}):(0,Q.jsx)(Sp,{initial:ma(e.data.promptTemplates)})}function Sp({initial:e}){let t=U(),n=b(),r=w(),[i,a]=(0,Z.useState)(e),[o,s]=(0,Z.useState)(``),[c,l]=(0,Z.useState)(``),u=H({mutationFn:e=>Dr({promptTemplates:e}),onSuccess:e=>{t.setQueryData(R.uiState,e),F(`Prompt templates saved`)},onError:e=>F(e.message,{tone:`danger`})}),d=JSON.stringify(i)!==JSON.stringify(e),f=i.some(e=>e.label.trim()===``||e.text.trim()===``),p=(e,t)=>a(n=>n.map(n=>n.id===e?{...n,...t}:n)),m=(e,t)=>a(n=>n.map(n=>{if(n.id!==e)return n;let r=n.skills??[],i=r.includes(t)?r.filter(e=>e!==t):[...r,t],{skills:a,...o}=n;return i.length>0?{...o,skills:i}:o})),h=e=>a(t=>t.filter(t=>t.id!==e));return(0,Q.jsx)(`div`,{"data-slot":`prompt-templates-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:(0,Q.jsxs)(wp,{title:`Reusable instructions`,hint:`Insert templates from task composers, or apply them automatically with selected skills when the prompt is empty.`,children:[(0,Q.jsx)(`div`,{"data-slot":`prompt-template-list`,className:`flex flex-col gap-3`,children:i.length===0?(0,Q.jsx)(`p`,{"data-slot":`prompt-templates-empty`,className:`text-[13px] text-soft-foreground`,children:`No templates. Add one below, or reset to the built-ins.`}):i.map(e=>(0,Q.jsxs)(`div`,{"data-slot":`prompt-template-row`,"data-template":e.id,className:`flex flex-col gap-1.5 rounded-md border border-border bg-card p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`label`,{htmlFor:`template-label-${e.id}`,className:`text-sm`,children:`Template label`}),(0,Q.jsx)(Ku,{id:`template-label-${e.id}`,"aria-label":`Label for ${e.label||`this template`}`,"data-slot":`prompt-template-label-input`,value:e.label,maxLength:80,onChange:t=>p(e.id,{label:t.target.value}),className:`flex-1`})]}),(0,Q.jsx)(`label`,{htmlFor:`template-text-${e.id}`,className:`text-sm`,children:`Instructions`}),(0,Q.jsx)(So,{id:`template-text-${e.id}`,"aria-label":`Text for ${e.label||`this template`}`,"data-slot":`prompt-template-text-input`,value:e.text,maxLength:2e3,onChange:t=>p(e.id,{text:t.target.value}),className:`min-h-14 text-[13px]`}),(0,Q.jsx)(`p`,{className:`mt-3 text-sm`,children:`Apply automatically with skills`}),(0,Q.jsxs)(`div`,{className:`mt-0.5 flex flex-wrap items-center gap-1.5`,children:[(0,Q.jsx)(Cp,{label:e.label,skills:n.data??[],skillUsage:r.data?.skillUsage,selected:e.skills??[],onToggle:t=>m(e.id,t)}),(e.skills??[]).map(t=>(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`prompt-template-skill-chip`,"data-skill":t,title:`Stop applying “${e.label}” automatically with ${t}`,onClick:()=>m(e.id,t),className:`inline-flex items-center gap-1 rounded-full border border-border bg-muted px-2 py-px font-mono text-[11px] font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[t,(0,Q.jsx)(or,{"aria-hidden":`true`,className:`size-3`})]},t))]}),(0,Q.jsx)(z,{type:`button`,className:`self-start`,variant:`outline`,size:`sm`,"data-action":`prompt-template-remove`,title:`Remove this template`,onClick:()=>h(e.id),children:`Delete template`})]},e.id))}),(0,Q.jsxs)(`div`,{"data-slot":`prompt-template-new`,className:`flex flex-col gap-1.5 rounded-md border border-dashed border-border p-3`,children:[(0,Q.jsx)(`h3`,{className:`text-lg`,children:`New template`}),(0,Q.jsx)(`label`,{htmlFor:`new-template-label`,className:`text-sm`,children:`Label`}),(0,Q.jsx)(Ku,{id:`new-template-label`,"aria-label":`New template label`,"data-slot":`prompt-template-new-label`,placeholder:`e.g. Review security`,value:o,maxLength:80,onChange:e=>s(e.target.value)}),(0,Q.jsx)(`label`,{htmlFor:`new-template-text`,className:`text-sm`,children:`Instructions to insert`}),(0,Q.jsx)(So,{id:`new-template-text`,"aria-label":`New template text`,"data-slot":`prompt-template-new-text`,placeholder:`Enter reusable instructions…`,value:c,maxLength:2e3,onChange:e=>l(e.target.value),className:`min-h-14 text-[13px]`}),(0,Q.jsxs)(z,{type:`button`,variant:`outline`,size:`sm`,"data-action":`prompt-template-add`,disabled:!o.trim()||!c.trim(),onClick:()=>{let e=o.trim(),t=c.trim();!e||!t||(a(n=>[...n,{id:ba(),label:e,text:t}]),s(``),l(``))},className:`self-start`,children:[(0,Q.jsx)(pe,{"aria-hidden":`true`,className:`size-3.5`}),`Add template`]})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(z,{type:`button`,variant:`primary`,size:`sm`,"data-action":`prompt-templates-save`,disabled:!d||f||u.isPending,onClick:()=>u.mutate(i),children:`Save`}),(0,Q.jsx)(z,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`prompt-templates-reset`,disabled:u.isPending,onClick:()=>a(Oa.map(e=>({...e}))),children:`Reset to defaults`}),f?(0,Q.jsx)(`p`,{"data-slot":`prompt-templates-invalid`,className:`text-[11px] text-danger`,children:`Every template needs both a label and text.`}):null]})]})})}function Cp({label:e,skills:t,skillUsage:n,selected:r,onToggle:i}){let[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(``),l=(0,Z.useRef)(null),{mostUsed:u,project:d,global:f,ranked:p}=jo(t,s,n),m=(e,t)=>{let n=r.includes(e.name);return(0,Q.jsxs)(Y,{value:`skill ${e.name} ${e.path}`,keywords:Eo(e.name,e.description),"data-slot":`prompt-template-skill-option`,"data-skill":e.name,"data-selected":n?`true`:void 0,onSelect:()=>i(e.name),children:[(0,Q.jsx)(`span`,{className:G(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.description?(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,n?(0,Q.jsx)(_t,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},e.path)};return(0,Q.jsxs)(Yi,{open:a,onOpenChange:e=>{o(e),e||c(``)},children:[(0,Q.jsx)(Ki,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`prompt-template-skills-trigger`,"aria-label":`Apply ${e||`this template`} automatically with a skill`,title:`Pick the skills this template applies itself to`,disabled:t.length===0,className:G(`inline-flex h-[26px] items-center gap-1.5 rounded-full border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-50`,r.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,Q.jsx)(rt,{"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),t.length===0?`no skills found`:`apply with…`,(0,Q.jsx)(pt,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Q.jsx)(Ji,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Q.jsxs)(ga,{shouldFilter:!1,children:[(0,Q.jsx)(_a,{placeholder:`search skills…`,value:s,onValueChange:c,onInput:()=>l.current?.scrollTo(0,0)}),(0,Q.jsxs)(wa,{ref:l,"data-slot":`prompt-template-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(p?p.length===0:u.length===0&&d.length===0&&f.length===0)?(0,Q.jsx)(ka,{children:`Nothing matches.`}):null,p?p.length>0?(0,Q.jsx)(J,{children:p.map(e=>m(e,Do(e)))}):null:(0,Q.jsxs)(Q.Fragment,{children:[u.length>0?(0,Q.jsx)(J,{heading:`Most used`,children:u.map(e=>m(e,Do(e)))}):null,d.length>0?(0,Q.jsx)(J,{heading:`Project skills`,children:d.map(e=>m(e,!0))}):null,f.length>0?(0,Q.jsx)(J,{heading:`Global`,children:f.map(e=>m(e,!1))}):null]})]})]})})]})}function wp({title:e,hint:t,children:n}){return(0,Q.jsxs)(`section`,{className:`settings-field flex flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,Q.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}var Tp=1,Ep=1,Dp=60,Op=256;function kp(){let e=bn();return e.isPending?(0,Q.jsx)(`p`,{"data-slot":`resources-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading resource settings…`}):e.isError?(0,Q.jsx)(W,{icon:(0,Q.jsx)(fn,{}),tone:`danger`,title:`Resource settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,Q.jsx)(Ap,{config:e.data})}function Ap({config:e}){let t=U(),n=H({mutationFn:e=>Rt(e),onSuccess:e=>t.setQueryData(I.config,e),onError:e=>F(e.message,{tone:`danger`})}),[r,i]=(0,Z.useState)(e.resources.memoryLimitMb?String(e.resources.memoryLimitMb):``),a=e.resources.monitoringWakeIntervalMinutes??null,[o,s]=(0,Z.useState)(a===null?`park`:`interval`),[c,l]=(0,Z.useState)(String(a??5)),u=Number(c),d=!Number.isInteger(u)||u<Ep||u>Dp,f=o===`park`?a===null:!d&&a===u,p=()=>n.mutate({resources:{monitoringWakeIntervalMinutes:o===`park`?null:u}},{onSuccess:()=>F(o===`park`?`Monitoring will stay parked`:`Monitoring will re-check every ${u} minutes`)}),m=e.resources.autoResumeOnUsageLimit??!0,h=e=>n.mutate({resources:{autoResumeOnUsageLimit:e}},{onSuccess:()=>F(e?`Tasks stopped by a usage limit will resume themselves`:`Tasks stopped by a usage limit will stay failed`)}),g=r.trim()===``?0:Number(r),_=r.trim()!==``&&(!Number.isInteger(g)||g<Op),v=(e.resources.memoryLimitMb??0)===(_?-1:g),y=()=>n.mutate({resources:{memoryLimitMb:g===0?null:g}},{onSuccess:()=>F(g===0?`Memory limit cleared`:`Memory limit set to ${g} MiB`)}),b=e.composerDefaults??{autonomous:null,worktree:null,inheritedAutonomous:`source-dependent`,inheritedWorktree:!0},x=(e,t)=>n.mutate({composerDefaults:{[e]:t===`inherit`?null:t===`on`}});return(0,Q.jsxs)(`div`,{"data-slot":`resources-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,Q.jsxs)(up,{title:`Max parallel tasks`,hint:`Limit simultaneously running tasks.`,children:[(0,Q.jsx)(`select`,{"aria-label":`Max parallel tasks`,"data-slot":`resources-max-parallel`,value:e.resources.maxParallel,disabled:n.isPending,onChange:e=>n.mutate({resources:{maxParallel:Number(e.target.value)}}),className:`block w-28 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:Array.from({length:16},(e,t)=>t+Tp).map(e=>(0,Q.jsx)(`option`,{value:e,children:e},e))}),(0,Q.jsxs)(`p`,{className:`text-[11px] text-soft-foreground`,children:[`Need a different limit for one project?`,` `,(0,Q.jsx)(L,{to:`/settings/global/projects`,"data-slot":`resources-project-limits-link`,className:`font-medium text-foreground underline decoration-border underline-offset-2 hover:decoration-foreground`,children:`Configure per-project limits`}),`.`]})]}),(0,Q.jsxs)(up,{title:`Extra monitoring sessions`,hint:`Additional capacity reserved for monitoring.`,children:[(0,Q.jsx)(`select`,{"aria-label":`Extra monitoring sessions`,"data-slot":`resources-max-monitoring`,value:e.resources.maxMonitoringSessions??2,disabled:n.isPending,onChange:e=>n.mutate({resources:{maxMonitoringSessions:Number(e.target.value)}}),className:`block w-28 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:Array.from({length:17},(e,t)=>(0,Q.jsx)(`option`,{value:t,children:t},t))}),(0,Q.jsxs)(`p`,{className:`text-[11px] text-soft-foreground`,children:[`Capacity: `,e.resources.maxParallel,` active + `,e.resources.maxMonitoringSessions??2,` monitoring. Set 0 to make monitoring share active slots.`]})]}),(0,Q.jsxs)(up,{title:`Monitoring wake-up`,hint:`Wake monitoring sessions periodically.`,children:[(0,Q.jsxs)(`div`,{className:`settings-resource-controls flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(ef,{"aria-label":`Monitoring wake-up`,"data-slot":`resources-monitoring-wake-mode`,checked:o===`interval`,disabled:n.isPending,onCheckedChange:e=>s(e?`interval`:`park`)}),o===`interval`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`label`,{htmlFor:`monitoring-wake-interval`,className:`w-full text-sm`,children:`Wake interval`}),(0,Q.jsx)(`input`,{id:`monitoring-wake-interval`,type:`number`,min:Ep,max:Dp,"aria-label":`Wake interval in minutes`,"data-slot":`resources-monitoring-wake-interval`,value:c,disabled:n.isPending,onChange:e=>l(e.target.value),className:`block w-24 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,Q.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`minutes`})]}):null,(0,Q.jsx)(z,{type:`button`,variant:`outline`,size:`sm`,"data-action":`resources-save-monitoring-wake`,disabled:f||o===`interval`&&d||n.isPending,onClick:p,children:`Save`})]}),o===`interval`&&d?(0,Q.jsx)(`p`,{"data-slot":`resources-monitoring-wake-invalid`,className:`text-[11px] text-danger`,children:`Enter a whole number from 1 to 60 minutes.`}):(0,Q.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Applied consistently to Claude, Codex and OpenCode.`})]}),(0,Q.jsxs)(up,{title:`Auto-resume after a usage limit`,hint:`Resume eligible tasks once the provider usage limit resets.`,children:[(0,Q.jsx)(ef,{"aria-label":`Auto-resume after a usage limit`,"data-slot":`resources-auto-resume`,checked:m,disabled:n.isPending,onCheckedChange:h}),(0,Q.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Applies to Claude, Codex and OpenCode — whenever the provider says when the limit lifts.`})]}),(0,Q.jsxs)(up,{title:`Per-task memory limit`,hint:`Leave blank for no limit.`,children:[(0,Q.jsxs)(`div`,{className:`settings-resource-controls flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:Op,step:256,"aria-label":`Per-task memory limit in MiB`,"data-slot":`resources-memory-limit`,value:r,disabled:n.isPending,placeholder:`no limit`,onChange:e=>i(e.target.value),className:`block w-32 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,Q.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`MiB`}),(0,Q.jsx)(z,{type:`button`,variant:`outline`,size:`sm`,"data-action":`resources-save-memory`,disabled:v||_||n.isPending,onClick:y,children:`Save`})]}),_?(0,Q.jsxs)(`p`,{"data-slot":`resources-memory-invalid`,className:`text-[11px] text-danger`,children:[`Enter a whole number of at least `,Op,` MiB, or leave empty for no limit.`]}):(0,Q.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Applies to newly started tasks.`})]}),(0,Q.jsxs)(up,{title:`New task defaults`,hint:`Apply to new tasks unless overridden.`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,"data-slot":`resources-composer-defaults`,children:[(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:`Autonomous by default`}),(0,Q.jsxs)(`select`,{"aria-label":`Autonomous by default`,value:b.autonomous===null?`inherit`:b.autonomous?`on`:`off`,disabled:n.isPending,onChange:e=>x(`autonomous`,e.target.value),className:`rounded-md border border-input bg-card px-3 py-1.5 shadow-xs outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[(0,Q.jsx)(`option`,{value:`inherit`,children:`Inherit environment`}),(0,Q.jsx)(`option`,{value:`on`,children:`On`}),(0,Q.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,Q.jsxs)(`span`,{className:`text-[11px] text-soft-foreground`,children:[`Inherited: `,b.inheritedAutonomous===`source-dependent`?`Source-dependent — skills on, workflows off`:b.inheritedAutonomous?`On`:`Off`]})]}),(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:`Use a worktree by default`}),(0,Q.jsxs)(`select`,{"aria-label":`Use a worktree by default`,value:b.worktree===null?`inherit`:b.worktree?`on`:`off`,disabled:n.isPending,onChange:e=>x(`worktree`,e.target.value),className:`rounded-md border border-input bg-card px-3 py-1.5 shadow-xs outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[(0,Q.jsx)(`option`,{value:`inherit`,children:`Inherit environment`}),(0,Q.jsx)(`option`,{value:`on`,children:`On`}),(0,Q.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,Q.jsxs)(`span`,{className:`text-[11px] text-soft-foreground`,children:[`Inherited: `,b.inheritedWorktree?`On`:`Off`]})]})]}),(0,Q.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Interactive skills may recommend both off. Multi-step and parallel runs remain isolated.`})]})]})}function jp(){let e=bn(),t=V().data?.bootProject??``,n=br(t,!!t);return e.isPending?(0,Q.jsx)(`p`,{"data-slot":`skills-settings-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading skill settings…`}):e.isError?(0,Q.jsx)(W,{icon:(0,Q.jsx)(pc,{}),tone:`danger`,title:`Skill settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,Q.jsx)(Mp,{projectId:t,config:e.data,update:n.data,updateError:n.error})}function Mp({projectId:e,config:t,update:n,updateError:r}){let i=U(),a=H({mutationFn:e=>Rt(e),onSuccess:e=>i.setQueryData(I.config,e),onError:e=>F(e.message,{tone:`danger`})}),o=t.skillsAutoUpdate===null,s=(()=>{if(r)return`Installation status is unavailable right now.`;if(!n)return`Checking tracked Open Mercato installations…`;if(n.status===`unavailable`)return n.scopes.find(e=>e.reason)?.reason??`Automatic skill updates are unavailable.`;if(n.scopes.every(e=>e.skills.length===0))return`No tracked Open Mercato installation found.`;let e=new Set(n.scopes.flatMap(e=>e.skills)).size;return n.status===`current`?`${e} tracked skill${e===1?``:`s`} · Up to date`:`${e} tracked Open Mercato skill${e===1?``:`s`} found.`})();return(0,Q.jsx)(`div`,{"data-slot":`skills-settings-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-4 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:(0,Q.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:(0,Q.jsx)(`label`,{htmlFor:`skills-auto-update`,children:`Update Open Mercato skills automatically`})}),(0,Q.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Checks installed Open Mercato skills in the background and applies available updates. Other skills and untracked folders are never changed.`})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-1`,children:[(0,Q.jsx)(ef,{id:`skills-auto-update`,"data-slot":`skills-auto-update`,checked:t.effectiveSkillsAutoUpdate,disabled:a.isPending,onCheckedChange:e=>a.mutate({skillsAutoUpdate:e})}),(0,Q.jsxs)(`span`,{className:`text-[11px] text-soft-foreground`,children:[t.effectiveSkillsAutoUpdate?`On`:`Off`,o?` (default)`:``]})]})]}),(0,Q.jsx)(`h3`,{className:`mt-4 text-lg`,children:`Installation status`}),(0,Q.jsx)(`p`,{"data-slot":`skills-installation-status`,role:r||n?.status===`unavailable`?`status`:void 0,className:n?.status===`current`&&n.scopes.some(e=>e.skills.length>0)?`text-[13px] text-success`:`text-[13px] text-soft-foreground`,children:s}),(0,Q.jsx)(`p`,{className:`mt-3 text-[13px] text-muted-foreground`,children:`Manage installed skills and sources from the Skills catalog.`}),e?(0,Q.jsx)(z,{asChild:!0,variant:`outline`,className:`mt-2 self-start`,children:(0,Q.jsx)(L,{to:`/p/${encodeURIComponent(e)}/skills`,children:`Open Skills`})}):null,(0,Q.jsxs)(`details`,{className:`settings-disclosure`,children:[(0,Q.jsx)(`summary`,{children:`Update preference inheritance`}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 rounded-md border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(`span`,{children:o?`No override is saved. CEZ_SKILLS_AUTO_UPDATE supplies the inherited default when set; otherwise it is on.`:`An explicit workspace override is saved.`}),(0,Q.jsx)(z,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`skills-use-default`,disabled:o||a.isPending,onClick:()=>a.mutate({skillsAutoUpdate:null}),children:`Use default`})]})]})]})})}var Np=0,Pp=1e3;function Fp(){let e=Dn();return e.isPending?(0,Q.jsx)(`p`,{"data-slot":`worktrees-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading worktree settings…`}):e.isError?(0,Q.jsx)(W,{icon:(0,Q.jsx)(rc,{}),tone:`danger`,title:`Worktree settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,Q.jsx)(Ip,{config:e.data})}function Ip({config:e}){let t=U(),n=H({mutationFn:e=>mr(e),onSuccess:e=>t.setQueryData(R.config,e),onError:e=>F(e.message,{tone:`danger`})}),[r,i]=(0,Z.useState)(String(e.worktreeRetention)),a=Number(r),o=r.trim()===``||!Number.isInteger(a)||a<Np||a>Pp,s=e.worktreeRetention===(o?-1:a);return(0,Q.jsxs)(`div`,{"data-slot":`worktrees-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,Q.jsxs)(up,{title:`Keep N finished worktrees`,hint:`Older finished worktrees are reclaimed to free disk; their branch is kept so the work stays recoverable. 0 = unlimited. In-review and running tasks are never reclaimed, so the count on disk can exceed this.`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:Np,max:Pp,step:1,"aria-label":`Keep last N finished worktrees`,"data-slot":`resources-worktree-retention`,value:r,disabled:n.isPending,onChange:e=>i(e.target.value),className:`block w-32 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,Q.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`worktrees`}),(0,Q.jsx)(z,{type:`button`,variant:`primary`,size:`sm`,className:`self-start`,"data-action":`resources-save-retention`,disabled:s||o||n.isPending,onClick:()=>n.mutate({worktreeRetention:a},{onSuccess:()=>{t.invalidateQueries({queryKey:R.worktrees}),F(a===0?`Keeping all worktrees (unlimited)`:`Keeping the last ${a} finished worktree${a===1?``:`s`}`)}}),children:`Save retention`})]}),o?(0,Q.jsxs)(`p`,{"data-slot":`resources-retention-invalid`,className:`text-[11px] text-danger`,children:[`Enter a whole number from `,Np,` to `,Pp,` (0 = unlimited).`]}):(0,Q.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:a===0?`Keeping every finished worktree.`:`Keeping the last ${a} finished worktree${a===1?``:`s`} on disk.`})]}),(0,Q.jsxs)(X,{to:`/git/cleanup`,"data-slot":`worktrees-manage-link`,className:`inline-flex min-h-11 items-center gap-1 self-start text-[13px] font-medium text-link-foreground hover:underline focus-visible:outline-2 focus-visible:outline-ring md:min-h-0`,children:[`Manage worktrees on Git`,(0,Q.jsx)(St,{"aria-hidden":`true`,className:`size-[14px]`})]})]})}function Lp(e,t){return function(){return(0,Q.jsx)(W,{icon:(0,Q.jsx)(t,{}),tone:`neutral`,title:e,subtitle:`This section arrives in a later phase of the redesign.`,heading:`h2`})}}var Rp=[{id:`agents`,title:`Agents`,description:`Default runner, models and system prompt.`,icon:me,component:cf,scope:`project`},{id:`agent-config`,title:`Agent config`,description:`Edit the coding agents’ own config files, per scope.`,icon:nc,component:Yd,scope:`project`},{id:`worktrees`,title:`Worktrees`,description:`How many finished task worktrees this project keeps on disk.`,icon:rc,component:Fp,scope:`project`},{id:`bookmarklets`,title:`Bookmarklets`,description:`Launch skills from a GitHub PR or issue.`,icon:Vs,component:Qf,scope:`project`},{id:`prompt-templates`,title:`Prompt templates`,description:`Reusable snippets for follow-up instructions.`,icon:Qr,component:xp,scope:`project`},{id:`appearance`,title:`Appearance`,description:`Theme, accent and density.`,icon:je,component:Yf,scope:`global`},{id:`notifications`,title:`Notifications`,description:`Browser notifications when an agent needs you.`,icon:qn,component:op,scope:`global`},{id:`resources`,title:`Resources`,description:`Parallel tasks and per-task memory limit, across every project.`,icon:fn,component:kp,scope:`global`},{id:`skills`,title:`Skills`,description:`Updates for skills installed on this machine.`,icon:rt,component:jp,scope:`global`},{id:`accounts`,title:`Agent accounts`,description:`Second logins, and the agent and models a project uses when it has chosen none.`,icon:Qe,component:Md,scope:`global`},{id:`projects`,title:`Projects`,description:`The workspace registry and where GitHub checkouts land.`,icon:kn,component:mp,scope:`global`},{id:`keyboard`,title:`Keyboard`,description:`Shortcuts.`,icon:sc,component:Lp(`Keyboard`,sc),scope:`global`,hidden:!0}];function zp(e,t){return Rp.filter(n=>!n.hidden&&n.scope===e&&!(t?.singleProject===!0&&n.id===`projects`))}var Bp={needsYou:0,failedUnread:0,inMotion:0,finishedUnread:0};function Vp(e){let t={...Bp};for(let n of e){if(n.archived||Pt(n))continue;let e=C(n);e.bucket===`waiting`?t.needsYou+=1:e.tone===`running`?t.inMotion+=1:ii(n)&&(n.status===`failed`?t.failedUnread+=1:n.status===`done`&&(t.finishedUnread+=1))}return t}function Hp(e){let t=new Map;for(let n of e){let e=t.get(n.projectId);e?e.push(n):t.set(n.projectId,[n])}return new Map([...t].map(([e,t])=>[e,Vp(t)]))}function Up(e,t,n={}){if(n.unknown)return`${e} · activity unknown`;let r=Wp(t).map(e=>e.text);return[e,r.length>0?r.join(` · `):`idle`,...n.truncated?[`recent runs only`]:[]].join(` · `)}function Wp(e){let{needsYou:t,failedUnread:n,inMotion:r,finishedUnread:i}=e??Bp,a=[];return t>0&&a.push({tone:`amber`,text:`${t} needs you`}),n>0&&a.push({tone:`red`,text:`${n} failed`}),r>0&&a.push({tone:`violet`,text:`${r} working`}),i>0&&a.push({tone:`green`,text:`${i} finished`}),a}function Gp(e){let t={...Bp};for(let n of e)n&&(t.needsYou+=n.needsYou,t.failedUnread+=n.failedUnread,t.inMotion+=n.inMotion,t.finishedUnread+=n.finishedUnread);return t}function Kp(e){let t=e.split(/[-_ .]+/).filter(e=>e!==``);return(t.length>=2?[t[0],t[1]].map(e=>[...e][0]):[...t[0]??``].slice(0,2)).join(``).toLowerCase()}var qp=`w-[228px] rounded-[10px] border-border bg-sidebar p-[5px] text-foreground shadow-[0_10px_28px_#00000047] motion-reduce:animate-none`,Jp=`h-8 gap-2.5 rounded-[6px] px-[9px] py-0 text-[13px] focus:bg-sidebar-row-hover focus:text-foreground [&_svg]:size-[15px] [&_svg]:text-soft-foreground focus:[&_svg]:text-foreground max-md:min-h-11`;function Yp(){let e=za(),t=P(),n=V(),r=n.data?.bootProject??t.data?.bootProject,i=e??r??null,a=n.data?.projects.find(e=>e.id===i),o=i===r?t.data?.repo:void 0,s=a?.root??o?.root;return{health:t,registry:n,projectId:i,project:a,root:s,name:a?.name??s?.split(/[\\/]/).filter(Boolean).at(-1),branch:o?.branch??a?.branch}}function Xp({onNavigate:e}={}){let t=(0,Z.useRef)(null),n=(0,Z.useRef)(null),[r,i]=(0,Z.useState)(0),{health:a,registry:o,projectId:s,project:c,root:l,name:u,branch:d}=Yp(),f=a.data?.capabilities.localHandoff===!0,p=u??(o.isPending?`Loading project…`:`Project unavailable`),m=[f?l:void 0,d].filter(Boolean).join(` · `);return(0,Q.jsxs)(`div`,{"data-slot":`project-header`,className:`flex min-w-0 items-center gap-2.5 px-[14px] pt-[14px] pb-2.5`,children:[(0,Q.jsx)(`span`,{ref:t,"aria-hidden":`true`,"data-slot":`project-header-mark`,className:`flex size-7 shrink-0 items-center justify-center rounded-[7px] border border-soft-foreground bg-sidebar-row-selected text-[11px] leading-none font-semibold text-foreground`,children:u?Kp(u):`…`}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-px`,children:[(0,Q.jsx)(`div`,{"data-slot":`project-header-name`,className:`truncate text-[14px] font-semibold text-foreground`,title:p,children:p}),(0,Q.jsx)(`div`,{"data-slot":`project-header-detail`,dir:`rtl`,className:`truncate text-left font-mono text-[10.5px] text-soft-foreground`,title:m||void 0,children:(0,Q.jsx)(`bdi`,{dir:`ltr`,children:m||(o.isPending?`Loading…`:`Branch unavailable`)})})]}),(0,Q.jsx)(Zp,{projectId:s,onNavigate:e,triggerRef:n,triggerClassName:`size-7 max-md:size-11`,align:`start`,alignOffset:r,onOpenChange:e=>{e&&t.current&&n.current&&i(t.current.getBoundingClientRect().left-n.current.getBoundingClientRect().left)}})]})}function Zp({projectId:e,onNavigate:t,triggerRef:n,triggerClassName:r,align:i=`start`,alignOffset:a,side:o,onOpenChange:s}){let c=V_(),l=P(),u=V(),[d,f]=(0,Z.useState)(!1),p=u.data?.bootProject??l.data?.bootProject,m=ie(e??`default`,e!==null,e===p),h=Ee(e??`default`,e===p?`default`:e??`default`),g=(0,Z.useRef)(e);g.current=e;let _=u.data?.projects.find(t=>t.id===e),v=e===p?l.data?.repo:void 0,y=_?.root??v?.root,b=l.data?.capabilities.localHandoff===!0,x=(m.data??[]).filter(e=>!Pt(e)&&ii(e)),S=m.isError?`Unavailable`:m.data===void 0?`Loading…`:`${x.length} unread`;async function C(){f(!0);let t=0;try{for(let n of x){if(g.current!==e)break;try{await h.mutateAsync(n.id)}catch{t+=1}}t>0&&F(`Could not mark ${t} task${t===1?``:`s`} read. Try again.`,{tone:`danger`})}finally{f(!1)}}async function w(){if(y)try{await navigator.clipboard.writeText(y),F(`Project folder copied`)}catch{F(`Could not copy path: ${y}`,{tone:`danger`})}}return(0,Q.jsxs)(uo,{onOpenChange:s,children:[(0,Q.jsx)(so,{asChild:!0,children:(0,Q.jsx)(`button`,{"data-slot":`project-menu-trigger`,ref:n,type:`button`,"aria-label":`Project menu`,className:G(`flex shrink-0 items-center justify-center rounded-[6px] text-soft-foreground hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring data-[state=open]:bg-sidebar-row-selected data-[state=open]:text-foreground`,r),children:(0,Q.jsx)(ec,{"aria-hidden":`true`,className:`size-[15px]`})})}),(0,Q.jsxs)(co,{align:i,alignOffset:a,side:o,sideOffset:4,className:qp,children:[(0,Q.jsxs)(ro,{className:Jp,disabled:d||m.isError||m.data===void 0||x.length===0||e===null,onSelect:()=>{C()},children:[(0,Q.jsx)(Us,{"aria-hidden":`true`}),` Mark all read`,(0,Q.jsx)(`span`,{className:`ml-auto text-[11.5px] text-soft-foreground`,children:d?`Marking…`:S})]}),(0,Q.jsx)(io,{className:`mx-0`}),b&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Qp,{projectId:e??`default`,disabled:!y||_?.status===`missing`}),(0,Q.jsxs)(ro,{className:Jp,disabled:!y,onSelect:()=>{w()},children:[(0,Q.jsx)(Zs,{"aria-hidden":`true`}),` Copy path`]}),(0,Q.jsx)(io,{className:`mx-0`})]}),(0,Q.jsx)(ro,{asChild:!0,className:Jp,children:(0,Q.jsxs)(X,{to:`/settings`,onClick:t??c,children:[(0,Q.jsx)(vc,{"aria-hidden":`true`}),` Project settings`]})})]})]})}function Qp({disabled:e,projectId:t}){let n=de(),r=H({mutationFn:e=>Wt(e,t),onError:e=>F(e.message,{tone:`danger`}),onSuccess:()=>F(`Opening project folder`)}),i=(n.data?.targets??[]).filter(e=>si(e.id)===void 0);return(0,Q.jsxs)(fo,{children:[(0,Q.jsxs)(eo,{className:Jp,disabled:e||r.isPending,children:[(0,Q.jsx)(qi,{"aria-hidden":`true`}),` Open in`]}),(0,Q.jsx)(oo,{children:(0,Q.jsxs)($a,{className:qp,children:[i.map(e=>{let t=qr(e);return(0,Q.jsxs)(ro,{className:Jp,"data-target":e.id,onSelect:()=>r.mutate(e.id),children:[(0,Q.jsx)(t,{"aria-hidden":`true`}),e.label]},e.id)}),i.length===0&&(0,Q.jsx)(ro,{className:Jp,disabled:!0,children:n.isError?`Apps unavailable`:n.isPending?`Loading apps…`:`No apps available`})]})})]})}function $p(){let e=za(),t=V().data;return e===null?null:t?.projects.find(t=>t.id===e)?.root??null}function em(e){navigator.clipboard.writeText(e).then(()=>F(`Project folder copied`)).catch(()=>F(e))}function tm(){let e=$p();return e===null?null:(0,Q.jsx)(up,{title:`Project folder`,hint:`Where this project lives on disk. Every task worktree, git command and agent run resolves against it.`,children:(0,Q.jsxs)(`div`,{"data-slot":`project-location`,"data-variant":`field`,className:`flex flex-col gap-3`,children:[(0,Q.jsx)(`span`,{"data-slot":`project-location-path`,className:`w-full min-w-0 rounded-md border border-border bg-background p-3 text-[13px] break-all text-foreground`,children:e}),(0,Q.jsxs)(`div`,{className:`flex w-full flex-wrap items-center gap-2 border-t border-border pt-4`,children:[(0,Q.jsxs)(`button`,{type:`button`,"data-action":`project-location-copy`,title:`Copy the project folder path`,onClick:()=>em(e),className:`inline-flex min-h-11 items-center gap-2 rounded-md border border-border bg-card px-3 text-xs text-foreground transition-colors hover:bg-muted`,children:[(0,Q.jsx)(hn,{"aria-hidden":`true`,className:`size-4`}),`Copy path`]}),(0,Q.jsx)(nm,{root:e})]})]})})}function nm({root:e}){let t=de(),n=H({mutationFn:e=>Wt(e),onError:e=>F(e.message,{tone:`danger`})}),r=(t.data?.targets??[]).filter(e=>si(e.id)===void 0).map(e=>({target:e}));return r.length===0?null:(0,Q.jsx)(ni,{slot:`project-location-open`,label:`Open with`,triggerVariant:`outline`,title:e,disabled:n.isPending,choices:r,onPick:e=>n.mutate(e,{onSuccess:()=>F(`Opening the project folder in ${r.find(t=>t.target.id===e)?.target.label??e}`)})})}function rm({project:e}){let t=Cn(),n=Ze(),r=(0,Z.useId)(),i=(0,Z.useId)(),a=(0,Z.useId)(),[o,s]=(0,Z.useState)(e.webhook?.url??``),[c,l]=(0,Z.useState)(``),[u,d]=(0,Z.useState)(null),f=e.webhook,p=o.trim(),m=p!==(f?.url??``)||c!==``,h=t.isPending||n.isPending,g=n=>{p&&t.mutate({id:e.id,webhook:{url:p,...c?{token:c}:{}}},{onSuccess:()=>{l(``),n?n():F(`Task webhook saved`)},onError:e=>F(e.message,{tone:`danger`})})},_=()=>n.mutate(e.id,{onSuccess:e=>d(e.dryRun?{ok:!0,text:`Dry run: nothing was sent.`}:e.ok?{ok:!0,text:`Delivered (HTTP ${e.status??200}).`}:{ok:!1,text:`Not delivered: ${e.error??`unknown error`}.`}),onError:e=>d({ok:!1,text:e.message})});return(0,Q.jsx)(up,{title:`Task webhook`,hint:`Tasks you hand off, or start with notify on, POST their status changes here with the token as a Bearer header.`,children:(0,Q.jsxs)(`form`,{"data-slot":`task-webhook`,className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),d(null),g()},children:[(0,Q.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{htmlFor:r,className:`flex flex-col gap-1 text-[13px]`,children:[(0,Q.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`URL`}),(0,Q.jsx)(Ku,{id:r,"data-slot":`task-webhook-url`,type:`url`,inputMode:`url`,autoComplete:`off`,spellCheck:!1,placeholder:`https://bot.example/hooks/cez`,value:o,onChange:e=>s(e.target.value)})]}),(0,Q.jsxs)(`label`,{htmlFor:i,className:`flex flex-col gap-1 text-[13px]`,children:[(0,Q.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`Token`}),(0,Q.jsx)(Ku,{id:i,"data-slot":`task-webhook-token`,type:`password`,autoComplete:`new-password`,spellCheck:!1,"aria-describedby":a,placeholder:f?.tokenSet?`Token set — type to replace`:`Optional Bearer token`,value:c,onChange:e=>l(e.target.value)})]})]}),(0,Q.jsx)(`p`,{id:a,className:`-mt-1 text-[11px] text-soft-foreground`,children:f?.tokenSet?`The token is stored in ~/.cezar and never shown again. Leave it empty to keep it.`:`The token is stored in ~/.cezar, never in the repo.`}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(z,{type:`submit`,size:`sm`,className:`max-sm:h-11`,"data-action":`task-webhook-save`,disabled:h||!p||!m,children:`Save`}),(0,Q.jsx)(z,{type:`button`,size:`sm`,className:`max-sm:h-11`,variant:`outline`,"data-action":`task-webhook-test`,disabled:h||!p,onClick:()=>{d(null),m?g(_):_()},children:`Send test`}),f?.tokenSet?(0,Q.jsx)(z,{type:`button`,size:`sm`,className:`max-sm:h-11`,variant:`ghost`,"data-action":`task-webhook-clear-token`,disabled:h,onClick:()=>t.mutate({id:e.id,webhook:{url:f.url,token:``}},{onSuccess:()=>F(`Webhook token cleared`),onError:e=>F(e.message,{tone:`danger`})}),children:`Clear token`}):null,f?(0,Q.jsx)(z,{type:`button`,size:`sm`,className:`max-sm:h-11`,variant:`danger-ghost`,"data-action":`task-webhook-remove`,disabled:h,onClick:()=>t.mutate({id:e.id,webhook:null},{onSuccess:()=>{s(``),l(``),d(null),F(`Task webhook removed`)},onError:e=>F(e.message,{tone:`danger`})}),children:`Remove`}):null]}),u?(0,Q.jsx)(`p`,{"data-slot":`task-webhook-result`,role:`status`,className:u.ok?`text-[13px] text-muted-foreground`:`text-[13px] text-danger`,children:u.text}):null]})})}function im(e){let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleDateString(void 0,{year:`numeric`,month:`short`,day:`numeric`})}function am({capabilities:e}){let t=za(),n=V(),r=bn();if(n.isPending)return(0,Q.jsx)(`p`,{"data-slot":`project-general-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading project…`});if(n.isError)return(0,Q.jsxs)(`p`,{"data-slot":`project-general-error`,className:`text-[13px] text-danger`,children:[`Could not read the project registry — `,n.error.message]});let i=n.data,a=i?.projects.find(e=>e.id===t);if(!i||!a)return null;let o=e?.singleProject!==!0;return(0,Q.jsxs)(`div`,{"data-slot":`project-general`,className:`flex w-full flex-col gap-5`,children:[(0,Q.jsxs)(`section`,{className:`flex flex-col gap-5 rounded-lg border border-border bg-card p-5 [&_select]:min-h-11 [&_select]:w-full`,children:[(0,Q.jsx)(`h2`,{className:`text-lg font-semibold`,children:`General`}),(0,Q.jsx)(tm,{}),(0,Q.jsx)(om,{project:a,canRemove:o}),o?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(up,{title:`Max parallel tasks`,hint:r.data?`The workspace limit (${r.data.resources.maxParallel}) still applies as an overall ceiling.`:`How many of this project's tasks may run at once. The workspace limit still applies as an overall ceiling.`,children:r.data?(0,Q.jsx)(bp,{project:a,workspaceMax:r.data.resources.maxParallel}):(0,Q.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:`Loading the workspace limit…`})}),(0,Q.jsx)(rm,{project:a},a.id)]}):null]}),o?(0,Q.jsx)(`section`,{className:`rounded-lg border border-border bg-card p-5`,children:(0,Q.jsx)(sm,{project:a,bootProject:i.bootProject})}):null]})}function om({project:e,canRemove:t}){return(0,Q.jsxs)(`dl`,{"data-slot":`project-facts`,className:`grid grid-cols-1 gap-4 text-[13px] sm:grid-cols-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-[11px] text-muted-foreground`,children:`Project`}),(0,Q.jsx)(`dd`,{className:`mt-1 font-medium`,children:e.name})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-[11px] text-muted-foreground`,children:`Branch`}),(0,Q.jsx)(`dd`,{className:`mt-1 break-all`,children:e.branch??`—`})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-[11px] text-muted-foreground`,children:`Status`}),(0,Q.jsxs)(`dd`,{"data-slot":`project-general-status`,className:e.status===`missing`?`mt-1 text-danger`:`mt-1`,children:[fp[e.status],e.status===`missing`?t?` — remove it below, or restore the folder`:` — restore the folder at the path above`:null]})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-[11px] text-muted-foreground`,children:`Added`}),(0,Q.jsxs)(`dd`,{className:`mt-1`,children:[im(e.addedAt),(0,Q.jsx)(`span`,{className:`text-soft-foreground`,children:e.source===`checkout`?` · cloned from GitHub`:` · opened locally`})]})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-[11px] text-muted-foreground`,children:`Last opened`}),(0,Q.jsx)(`dd`,{className:`mt-1`,children:im(e.lastOpenedAt)})]})]})}function sm({project:e,bootProject:t}){let[n,r]=(0,Z.useState)(null),i=cp(),a=en(),o=e.id===t;return(0,Q.jsxs)(up,{title:`Remove from workspace`,hint:`Unregisters this project so it leaves the sidebar and the project list. Nothing on disk is deleted — the folder, its git history and its task history all stay, and opening it again re-registers it.`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsxs)(z,{type:`button`,variant:`outline`,size:`sm`,"data-action":`project-general-remove`,"aria-label":`Remove ${e.name} from the workspace — unregisters it, no files are deleted`,title:o?`cezar is serving this project — it re-registers itself at every start`:void 0,disabled:o||i.isPending,onClick:()=>r(e),className:`text-danger`,children:[`Remove `,e.name]}),o?(0,Q.jsx)(`span`,{"data-slot":`project-general-remove-boot`,className:`text-[11px] text-soft-foreground`,children:`cezar is serving this project — it re-registers itself at every start.`}):null]}),(0,Q.jsx)(lp,{project:n,onOpenChange:e=>!e&&r(null),onConfirm:()=>{r(null),i.confirm(e,()=>void a(`/p/${encodeURIComponent(t)}`))}})]})}function cm(e,t){return e===`global`?`/settings/global/${t}`:`/settings/${t}`}var lm=cm(`global`,`appearance`);function um(e){return e===`global`?{Link:L,NavLink:ut}:{Link:X,NavLink:Ra}}function dm({scope:e,title:t,mobileTitle:n}){let r=Yp().name;return(0,Q.jsxs)(`header`,{"data-slot":`settings-main-header`,className:`settings-route-header flex shrink-0 flex-col gap-2`,children:[(0,Q.jsxs)(`h1`,{className:`text-[15px] font-semibold tracking-normal max-md:text-[24px] max-md:font-normal`,children:[(0,Q.jsx)(`span`,{className:`md:hidden`,children:n}),(0,Q.jsxs)(`span`,{className:`max-md:hidden`,children:[t,` · `,e===`global`?`every project`:r??`this project`]})]}),e===`global`?(0,Q.jsx)(`span`,{"data-slot":`settings-scope-chip`,className:`sr-only`,children:`Global settings`}):null]})}function fm({scope:e,activeId:t,capabilities:n}){let{NavLink:r}=um(e),i=zp(e,n);return(0,Q.jsxs)(`details`,{className:`settings-section-picker md:hidden`,children:[(0,Q.jsxs)(`summary`,{children:[i.find(e=>e.id===t)?.title??`General`,(0,Q.jsx)(pt,{"aria-hidden":`true`,className:`size-5 text-muted-foreground`})]}),(0,Q.jsxs)(`nav`,{"aria-label":`Settings sections`,"data-slot":`settings-nav-mobile`,"data-scope":e,children:[e===`project`?(0,Q.jsx)(r,{to:`/settings`,end:!0,"data-slot":`settings-nav-index`,children:`General`}):null,i.map(t=>(0,Q.jsx)(r,{to:cm(e,t.id),"data-section":t.id,children:t.title},t.id))]})]},`${e}-${t}`)}function pm({section:e,scope:t,capabilities:n}){let r=e.component;return(0,Q.jsxs)(`div`,{"data-route":t===`global`?`settings-global-${e.id}`:`settings-${e.id}`,className:`settings-route mx-auto flex min-h-full w-full flex-col`,children:[(0,Q.jsx)(dm,{scope:t,title:e.title,mobileTitle:t===`global`?`Global settings`:`Project settings`}),(0,Q.jsxs)(`div`,{className:`settings-route-body flex min-w-0 flex-1 flex-col md:flex-row`,children:[(0,Q.jsx)(fm,{scope:t,activeId:e.id,capabilities:n}),(0,Q.jsxs)(`section`,{className:`settings-panel min-w-0 self-start md:flex-1`,"aria-label":e.title,children:[(0,Q.jsx)(`h2`,{className:`settings-panel-title`,children:e.title}),(0,Q.jsx)(r,{})]})]})]})}function mm({capabilities:e}){return(0,Q.jsxs)(`div`,{"data-route":`settings`,className:`settings-route mx-auto flex min-h-full w-full flex-col`,children:[(0,Q.jsx)(dm,{scope:`project`,title:`General`,mobileTitle:`Project settings`}),(0,Q.jsxs)(`div`,{className:`settings-route-body flex min-w-0 flex-1 flex-col md:flex-row`,children:[(0,Q.jsx)(fm,{scope:`project`,activeId:null,capabilities:e}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Q.jsx)(am,{capabilities:e}),(0,Q.jsx)(`h2`,{className:`settings-other-title mt-6 rounded-t-lg border border-b-0 border-border bg-card px-5 pt-5 text-base font-semibold md:hidden`,children:`Other project settings`}),(0,Q.jsx)(`ul`,{"data-slot":`settings-index`,className:`mt-7 flex w-full flex-col gap-5 md:hidden`,children:zp(`project`,e).map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(X,{to:cm(`project`,e.id),"data-section":e.id,className:`flex items-center gap-3.5 rounded-lg border border-border bg-card p-4 transition-colors hover:bg-card-2`,children:[(0,Q.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center text-accent-text`,children:(0,Q.jsx)(e.icon,{"aria-hidden":`true`,className:`size-4`})}),(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:e.title}),(0,Q.jsx)(`span`,{className:`block text-xs text-soft-foreground`,children:e.description})]}),(0,Q.jsx)(St,{"aria-hidden":`true`,className:`size-4 shrink-0 text-soft-foreground`})]})},e.id))}),(0,Q.jsxs)(`p`,{className:`mt-5 w-full text-[12px] text-soft-foreground`,children:[`Appearance, notifications, host resources and the project registry live in`,` `,(0,Q.jsx)(L,{to:lm,"data-slot":`settings-global-link`,className:`underline underline-offset-2 hover:text-foreground`,children:`Global settings`}),`.`]})]})]})]})}function hm({pinned:e,onToggle:t,className:n}){return(0,Q.jsx)(`button`,{type:`button`,"data-slot":`pin-toggle`,"data-pinned":e?`true`:void 0,"aria-pressed":e,"aria-label":e?`Unpin task`:`Pin task`,title:e?`Unpin from the top of the list`:`Pin to the top of the list`,onClick:n=>{n.stopPropagation(),t(!e)},className:G(`inline-flex size-5 shrink-0 items-center justify-center rounded-sm text-soft-foreground transition-colors motion-reduce:transition-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,n,`max-md:min-h-11 max-md:min-w-11 no-hover:min-h-11 no-hover:min-w-11`),children:(0,Q.jsx)(gc,{"data-slot":`pin-icon`,className:`size-[12px]`,fill:e?`currentColor`:`none`,"aria-hidden":`true`})})}function gm({delayDuration:e=0,...t}){return(0,Q.jsx)(au,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function _m({...e}){return(0,Q.jsx)(ou,{"data-slot":`tooltip`,...e})}function vm({...e}){return(0,Q.jsx)(su,{"data-slot":`tooltip-trigger`,...e})}function ym({className:e,sideOffset:t=0,children:n,...r}){return(0,Q.jsx)(cu,{children:(0,Q.jsxs)(lu,{"data-slot":`tooltip-content`,sideOffset:t,className:G(`z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-contrast px-3 py-1.5 text-xs text-balance text-contrast-foreground fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95`,e),...r,children:[n,(0,Q.jsx)(uu,{className:`z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-contrast fill-contrast`})]})})}var bm=[{id:`status`,label:`Status`,canFold:!1,defaultExpanded:!0,align:`left`,width:`120px`},{id:`task`,label:`Task`,canFold:!1,defaultExpanded:!0,align:`left`,width:`320px`},{id:`workflow`,label:`Workflow`,canFold:!0,defaultExpanded:!0,align:`left`,width:`84px`,icon:`workflow`},{id:`branch`,label:`Branch`,canFold:!0,defaultExpanded:!1,align:`left`,width:`120px`,icon:`branch`},{id:`diff`,label:`±`,canFold:!0,defaultExpanded:!0,align:`left`,width:`84px`,icon:`diff`},{id:`reference`,label:`Ref`,canFold:!0,defaultExpanded:!0,align:`left`,width:`104px`,icon:`reference`},{id:`tokens`,label:`IN / OUT`,canFold:!0,defaultExpanded:!0,align:`right`,width:`112px`,icon:`tokens`,capability:`tokens`},{id:`cost`,label:`Cost`,canFold:!0,defaultExpanded:!0,align:`right`,width:`64px`,icon:`cost`,capability:`cost`},{id:`cpu`,label:`CPU`,canFold:!0,defaultExpanded:!0,align:`right`,width:`60px`,icon:`cpu`},{id:`memory`,label:`Mem`,canFold:!0,defaultExpanded:!0,align:`right`,width:`80px`,icon:`memory`},{id:`started`,label:`Started`,canFold:!0,defaultExpanded:!0,align:`right`,width:`68px`,icon:`started`}],xm=new Map(bm.map(e=>[e.id,e]));function Sm(e){return typeof e!=`object`||!e||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`boolean`))}function Cm(e){let t={};for(let[n,r]of Object.entries(Sm(e))){let e=xm.get(n);e?.canFold&&(t[e.id]=r)}return t}function wm(e,t){let n=xm.get(e);return!n||!n.canFold?!0:t[e]??n.defaultExpanded}function Tm(e,t){let n=Sm(e);return xm.get(t)?.canFold?{...n,[t]:!wm(t,Cm(e))}:n}function Em(e){return bm.filter(t=>t.capability===void 0||e[t.capability])}function Dm(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function Om(){let e=U(),t=De(),n=Z.useRef(0),r=Z.useRef(0),i=Z.useRef(Promise.resolve()),a=Z.useMemo(()=>Cm(t.data?.taskTable?.expandedColumns),[t.data?.taskTable?.expandedColumns]),o=Z.useCallback(t=>{if(!bm.find(e=>e.id===t)?.canFold)return;let a=e.getQueryData(I.uiState);if(a===void 0)return;let o=Dm(a?.taskTable),s={...o,expandedColumns:Tm(o.expandedColumns,t)};e.setQueryData(I.uiState,{...a,taskTable:s});let c=++n.current;r.current=c;let l=i.current.then(async()=>{let t=await Sr({taskTable:s},{keepalive:!0});c===r.current&&e.setQueryData(I.uiState,t)});i.current=l.catch(t=>{F(t instanceof Error?t.message:String(t),{tone:`danger`}),c===r.current&&e.invalidateQueries({queryKey:I.uiState})})},[e]);return{expandedColumns:a,isExpanded:Z.useCallback(e=>wm(e,a),[a]),toggleColumn:o,isPending:t.isPending}}function km({runs:e,view:t,onViewChange:n,onArchiveFinished:r,archivePending:i=!1,onMarkAllRead:a,onRename:o,onTogglePin:s,now:c=Date.now(),showTokens:l=!0,showCost:u=!0,expandedColumns:d=Cm(void 0),onToggleColumn:f=()=>void 0,columnsPending:p=!1,projectName:m,error:h,onRetry:_}){let[v,y]=Z.useState(``),[b,x]=Z.useState(!1),S=Z.useRef(null),C=Z.useRef(!1),[w,T]=Z.useState(!1);Z.useEffect(()=>{let e=window.matchMedia?.(`(min-width: 768px)`);if(!e)return;let t=()=>{e.matches&&T(!1)};return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let E=e??[],ee=Rn(E),D=Yt(g(E,v),t),O=er(E),k=Nr(g(E,v),t),te=st(E),ne=Em({tokens:l,cost:u}),A=Xr(E),re=t===`archived`?void 0:s;return(0,Q.jsxs)(`div`,{"data-route":`tasks`,"data-presentation":b?`resources`:`summary`,className:`flex min-h-full flex-col gap-[22px] px-[18px] pt-6 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-9`,children:[(0,Q.jsxs)(`header`,{ref:S,className:`flex shrink-0 flex-col gap-[22px]`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`h1`,{className:`text-[30px] font-semibold tracking-tight`,children:`Project tasks`}),(0,Q.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[m?`${m} · `:``,b?`Every resource column shown. Fold columns without losing the saved view.`:`Review runs, pull requests and resource usage.`]})]}),(0,Q.jsxs)(`div`,{className:`flex gap-6 border-b border-border`,children:[(0,Q.jsx)(Nm,{view:`active`,current:t,onSelect:n,count:ee.active,children:`Active`}),(0,Q.jsx)(Nm,{view:`archived`,current:t,onSelect:n,count:ee.archived,children:`Archived`})]}),(0,Q.jsxs)(`div`,{"data-slot":`tasks-toolbar`,className:`flex flex-wrap items-center gap-2.5`,children:[A>0?(0,Q.jsxs)(z,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`mark-all-read`,className:`hidden md:inline-flex`,onClick:a,children:[(0,Q.jsx)(Us,{className:`size-3.5`,"aria-hidden":`true`}),`Mark all read`]}):null,t===`active`&&te>0?(0,Q.jsxs)(z,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`archive-finished`,className:`inline-flex`,disabled:i,"aria-busy":i,onClick:r,children:[(0,Q.jsx)(it,{className:`size-3.5`,"aria-hidden":`true`}),`Archive finished`]}):null,t===`active`&&(te>0||i)?(0,Q.jsxs)(uo,{open:w,onOpenChange:T,children:[(0,Q.jsx)(so,{asChild:!0,children:(0,Q.jsx)(z,{type:`button`,variant:`ghost`,size:`icon`,className:`md:hidden`,"aria-label":`Task actions`,"aria-busy":i,children:(0,Q.jsx)(ec,{"aria-hidden":`true`})})}),(0,Q.jsx)(co,{align:`end`,className:`md:hidden`,onCloseAutoFocus:e=>{(C.current||window.matchMedia?.(`(min-width: 768px)`).matches)&&(e.preventDefault(),C.current=!1,S.current?.querySelector(`[data-view="active"]`)?.focus())},children:(0,Q.jsxs)(ro,{disabled:i||te===0,onSelect:()=>{C.current=!0,r()},children:[(0,Q.jsx)(it,{"aria-hidden":`true`}),i?`Archiving…`:`Archive finished`]})})]}):null,(0,Q.jsxs)(`div`,{className:`relative order-first w-full md:w-auto md:flex-1`,children:[(0,Q.jsx)(We,{className:`pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2 text-soft-foreground`,"aria-hidden":`true`}),(0,Q.jsx)(`input`,{type:`text`,value:v,onChange:e=>y(e.target.value),placeholder:`Search tasks…`,"aria-label":`Search tasks`,className:`h-11 w-full rounded-md border border-input bg-card pr-3 pl-8 text-[13px] text-foreground outline-none placeholder:text-soft-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]}),(0,Q.jsxs)(Yi,{children:[(0,Q.jsx)(Ki,{asChild:!0,children:(0,Q.jsx)(z,{"data-slot":`task-columns-trigger`,variant:`outline`,className:`hidden min-h-11 md:inline-flex`,children:`Columns`})}),(0,Q.jsxs)(Ji,{align:`end`,className:`w-72`,children:[(0,Q.jsx)(`h2`,{className:`mb-2 text-base font-medium`,children:`Visible columns`}),(0,Q.jsx)(`p`,{className:`mb-4 text-xs text-muted-foreground`,children:`Status and Task · Always visible`}),(0,Q.jsx)(`div`,{className:`grid grid-cols-2 gap-3`,children:ne.filter(e=>e.canFold).map(e=>(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,Q.jsx)(`input`,{"data-column-toggle":e.id,type:`checkbox`,checked:wm(e.id,d),disabled:p,onChange:()=>f(e.id)}),e.id===`diff`?`Diff`:e.id===`reference`?`Reference`:e.id===`memory`?`Memory`:e.label]},e.id))}),(0,Q.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`Saved automatically. Tokens and cost appear only when supported.`}),(0,Q.jsx)(z,{variant:`outline`,className:`mt-4`,onClick:()=>x(e=>!e),children:b?`Summary view`:`Resource columns`})]})]}),(0,Q.jsx)(z,{asChild:!0,"data-slot":`new-task-inline`,className:`min-h-11 inline-flex max-md:hidden`,children:(0,Q.jsxs)(X,{to:`/new`,children:[(0,Q.jsx)(pe,{"aria-hidden":`true`}),`New task`]})})]})]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[e===void 0?h?(0,Q.jsxs)(`div`,{role:`alert`,className:`rounded-xl border border-border bg-card p-6`,children:[(0,Q.jsx)(`h2`,{className:`text-lg`,children:`Could not load tasks`}),(0,Q.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:h}),(0,Q.jsx)(z,{variant:`outline`,className:`mt-4`,onClick:_,children:`Retry`})]}):(0,Q.jsx)(`div`,{role:`status`,"aria-label":`Loading tasks`,className:`rounded-xl border border-border bg-card p-6 text-sm text-muted-foreground`,children:`Loading tasks…`}):D.length===0?(0,Q.jsx)(Am,{view:t,query:v}):(0,Q.jsxs)(Q.Fragment,{children:[b?null:(0,Q.jsx)(jm,{projectName:m,runs:D,positions:O,onRename:o,onTogglePin:re,now:c,showTokens:l,showCost:u}),(0,Q.jsx)(`div`,{"data-slot":`tasks-table`,hidden:!b,className:G(`hidden overflow-x-auto rounded-lg border border-border bg-card`,b&&`md:block`),children:(0,Q.jsx)(gm,{children:(0,Q.jsxs)(`table`,{className:`w-full table-fixed border-collapse`,children:[(0,Q.jsx)(`colgroup`,{children:ne.map(e=>{let t=wm(e.id,d);return(0,Q.jsx)(`col`,{"data-column-id":e.id,"data-expanded":t,style:{width:t?e.width:`42px`}},e.id)})}),(0,Q.jsx)(`thead`,{children:(0,Q.jsx)(`tr`,{children:ne.map(e=>(0,Q.jsx)(Fm,{column:e,expanded:wm(e.id,d),onToggle:f,disabled:p},e.id))})}),(0,Q.jsx)(`tbody`,{className:`[&>tr:last-child>td]:border-b-0`,children:D.map(e=>(0,Q.jsx)(Rm,{run:e,queuePosition:e.status===`queued`?O.get(e.id)??null:null,onRename:o,onTogglePin:re,now:c,columns:ne,expandedColumns:d},e.id))})]})})}),(0,Q.jsx)(`div`,{"data-slot":`task-cards`,className:`flex flex-col rounded-lg border border-border bg-card p-5 md:hidden`,children:D.map(e=>(0,Q.jsx)(Gm,{run:e,projectName:m,queuePosition:e.status===`queued`?O.get(e.id)??null:null,now:c,showTokens:l,showCost:u,onTogglePin:re},e.id))}),(0,Q.jsx)(`p`,{className:`mt-[22px] text-[11px] text-muted-foreground md:hidden`,children:`Resource details—including tokens, cost, CPU and peak memory—are available when a task row is expanded.`})]}),k.map(e=>(0,Q.jsxs)(`div`,{"data-slot":`compare-strip`,"data-group-id":e.groupId,className:`mt-3.5 flex flex-wrap items-center gap-2.5 rounded-lg border border-border bg-card px-3.5 py-2.5 text-[13px] text-muted-foreground shadow-xs`,children:[(0,Q.jsx)(_c,{className:`size-[15px] shrink-0 text-soft-foreground`,"aria-hidden":`true`}),(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(`strong`,{className:`font-semibold text-foreground`,children:e.title}),` — `,e.count,` variants finished`]}),(0,Q.jsx)(z,{asChild:!0,variant:`outline`,size:`sm`,className:`md:ml-auto`,children:(0,Q.jsx)(X,{to:`/compare/${e.groupId}`,children:`Compare`})})]},e.groupId))]})]})}function Am({view:e,query:t}){let n=t.trim(),r=n?`search-miss`:e===`archived`?`archive`:`no-tasks`;return(0,Q.jsx)(`div`,{"data-slot":`tasks-empty`,"data-empty-kind":r,className:`flex flex-1 flex-col`,children:r===`search-miss`?(0,Q.jsx)(W,{heading:`h2`,icon:(0,Q.jsx)(Wa,{}),tone:`neutral`,title:`No matching tasks`,subtitle:`No tasks match “${n}”.`}):r===`archive`?(0,Q.jsx)(W,{heading:`h2`,icon:(0,Q.jsx)(it,{}),tone:`neutral`,title:`Nothing archived yet`,subtitle:`Finished tasks you archive land here.`}):(0,Q.jsx)(W,{heading:`h2`,icon:(0,Q.jsx)(lc,{}),tone:`primary`,backdrop:!0,title:`No tasks yet`,subtitle:`Describe a task to get started.`,actions:(0,Q.jsx)(z,{asChild:!0,children:(0,Q.jsxs)(X,{to:`/new`,children:[(0,Q.jsx)(pe,{"aria-hidden":`true`}),`New task`]})})})})}function jm({projectName:e,runs:t,positions:n,onRename:r,onTogglePin:i,now:a,showTokens:o,showCost:s}){let[c,l]=Z.useState(()=>new Set);return(0,Q.jsxs)(`div`,{"data-slot":`tasks-summary`,className:`hidden md:block`,children:[(0,Q.jsx)(`div`,{className:`rounded-lg border border-border bg-card p-5`,children:(0,Q.jsxs)(`table`,{className:`w-full table-fixed border-collapse`,children:[(0,Q.jsxs)(`colgroup`,{children:[(0,Q.jsx)(`col`,{}),(0,Q.jsx)(`col`,{className:`w-[136px]`}),(0,Q.jsx)(`col`,{className:`w-[106px]`}),(0,Q.jsx)(`col`,{className:`w-[116px]`}),(0,Q.jsx)(`col`,{className:`w-[70px]`})]}),(0,Q.jsx)(`thead`,{children:(0,Q.jsx)(`tr`,{children:[`Task`,`Workflow`,`Changes`,`Pull request`,`Started`].map(e=>(0,Q.jsx)(`th`,{className:`h-8 border-b border-border text-left text-[12px] font-medium uppercase text-muted-foreground`,children:e},e))})}),(0,Q.jsx)(`tbody`,{children:t.map(t=>{let u=C(t),d=Jn(t),f=Be(t),p=c.has(t.id),m=`task-resources-${t.id}`;return(0,Q.jsxs)(Z.Fragment,{children:[(0,Q.jsxs)(`tr`,{"data-status":t.status,"data-slot":`task-summary-row`,className:`group/row border-b border-border last:border-0`,children:[(0,Q.jsxs)(`td`,{className:`py-5 pr-4 align-top`,children:[(0,Q.jsx)(Vm,{run:t,to:`/tasks/${t.id}`,onRename:r,onTogglePin:i}),(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`button`,{type:`button`,"aria-label":`${p?`Hide`:`Show`} resources for ${wn(t)}`,"aria-expanded":p,"aria-controls":m,"aria-describedby":`summary-status-${t.id}`,onClick:()=>l(e=>{let n=new Set(e);return p?n.delete(t.id):n.add(t.id),n}),className:`inline-flex min-h-[26px] items-center gap-1 rounded-md p-0 text-[11px] text-muted-foreground hover:bg-muted focus-visible:outline-2 focus-visible:outline-ring`,children:(0,Q.jsxs)(ai,{id:`summary-status-${t.id}`,dot:u.tone,shape:u.shape,pulse:u.pulse,children:[u.label,d?` ${d.label}`:``]})}),e?(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e}):null,t.status===`queued`?(0,Q.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`#`,n.get(t.id),` in queue`]}):null]})]}),(0,Q.jsx)(`td`,{className:`truncate pr-3 text-xs text-muted-foreground`,title:ar(t),children:ar(t)}),(0,Q.jsx)(`td`,{className:`pr-2 text-xs`,children:t.diffStat?(0,Q.jsx)(Jo,{stat:t.diffStat}):(0,Q.jsx)(qm,{})}),(0,Q.jsx)(`td`,{className:`pr-2`,children:f?(0,Q.jsx)(ui,{run:t,reference:f,compact:!0}):(0,Q.jsx)(qm,{})}),(0,Q.jsx)(`td`,{className:`text-xs text-muted-foreground`,children:Ba(t.startedAt??t.createdAt,a)})]}),p?(0,Q.jsx)(`tr`,{children:(0,Q.jsx)(`td`,{colSpan:5,className:`border-b border-border pb-5`,children:(0,Q.jsx)(`div`,{id:m,className:`rounded-md bg-muted/50 p-4`,children:(0,Q.jsx)(Mm,{run:t,showTokens:o,showCost:s})})})}):null]},t.id)})})]})}),(0,Q.jsx)(`p`,{className:`mt-[22px] text-[11px] text-muted-foreground`,children:`Resource details—including tokens, cost, CPU and peak memory—are available when a task row is expanded.`})]})}function Mm({run:e,showTokens:t,showCost:n}){let r=Qt(e,Is(e.id));return(0,Q.jsxs)(`dl`,{className:`grid grid-cols-2 gap-4 text-xs md:grid-cols-4`,children:[t?(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Tokens in / out`}),(0,Q.jsx)(`dd`,{className:`mt-1`,children:(0,Q.jsx)(Xo,{inputTokens:e.inputTokens,outputTokens:e.outputTokens,omitWhenUnknown:!1})})]}):null,n?(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Cost`}),(0,Q.jsx)(`dd`,{className:`mt-1`,children:j(e.costUsd)||`—`})]}):null,(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`CPU`}),(0,Q.jsx)(`dd`,{className:`mt-1`,title:r.cpu.title,children:r.cpu.text||`—`})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Memory`}),(0,Q.jsx)(`dd`,{className:`mt-1`,title:r.mem.title,children:r.mem.text||`—`})]}),e.branch?(0,Q.jsxs)(`div`,{className:`col-span-2`,children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Branch`}),(0,Q.jsx)(`dd`,{className:`mt-1 break-all`,children:e.branch})]}):null]})}function Nm({view:e,current:t,onSelect:n,count:r,children:i}){let a=e===t;return(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`overview-tab`,"data-view":e,"aria-pressed":a,onClick:()=>n(e),className:G(`flex min-h-11 items-center justify-center gap-1.5 border-b-2 border-transparent text-[13px] font-medium text-muted-foreground`,a&&`border-accent-strong font-semibold text-accent-text`),children:[i,r>0?(0,Q.jsxs)(`span`,{className:`tabular-nums`,children:[` · `,r]}):null]})}function Pm({children:e,right:t=!1,columnId:n,folded:r=!1}){return(0,Q.jsx)(`th`,{scope:`col`,"data-column-id":n,"data-folded":r||void 0,className:G(`h-[38px] border-b border-border px-2.5 text-left text-[11px] font-semibold tracking-[0.05em] whitespace-nowrap text-supporting-foreground uppercase first:pl-4 last:pr-4`,t&&`text-right`,r&&`px-0 first:pl-0 last:pr-0`),children:e})}function Fm({column:e,expanded:t,onToggle:n,disabled:r}){if(!e.canFold)return(0,Q.jsx)(Pm,{columnId:e.id,right:e.align===`right`,children:e.label});let i=t?`Fold`:`Expand`;return(0,Q.jsx)(Pm,{columnId:e.id,right:e.align===`right`,folded:!t,children:(0,Q.jsxs)(_m,{children:[(0,Q.jsx)(vm,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,"aria-label":`${i} ${e.label} column`,"aria-pressed":t,disabled:r,onClick:()=>n(e.id),className:G(`inline-flex h-8 w-full items-center gap-1 rounded-sm px-0.5 text-inherit outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-wait disabled:opacity-60`,e.align===`right`?`justify-end`:`justify-start`,!t&&`justify-center px-0`),children:t?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{children:e.label}),(0,Q.jsx)(Ks,{className:`size-3 opacity-55`,"aria-hidden":`true`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Im,{icon:e.icon}),(0,Q.jsx)(qs,{className:`size-3 opacity-70`,"aria-hidden":`true`})]})})}),(0,Q.jsxs)(ym,{side:`top`,children:[e.label,` · `,i,` column`]})]})})}function Im({icon:e}){let t=`size-3.5`;switch(e){case`workflow`:return(0,Q.jsx)(l,{className:t,"aria-hidden":`true`});case`branch`:return(0,Q.jsx)(cn,{className:t,"aria-hidden":`true`});case`diff`:return(0,Q.jsx)(En,{className:t,"aria-hidden":`true`});case`reference`:return(0,Q.jsx)(cc,{className:t,"aria-hidden":`true`});case`tokens`:return(0,Q.jsx)(Ys,{className:t,"aria-hidden":`true`});case`cost`:return(0,Q.jsx)($s,{className:t,"aria-hidden":`true`});case`cpu`:return(0,Q.jsx)(Lt,{className:t,"aria-hidden":`true`});case`memory`:return(0,Q.jsx)(uc,{className:t,"aria-hidden":`true`});case`started`:return(0,Q.jsx)(Js,{className:t,"aria-hidden":`true`});default:return null}}var Lm=`h-[88px] border-b border-border px-2.5 whitespace-nowrap first:pl-4 last:pr-4`;function Rm({run:e,queuePosition:t,onRename:n,onTogglePin:r,now:i,columns:a,expandedColumns:o}){let s=Ua(),c=C(e),l=Jn(e),u=`/tasks/${e.id}`,d=j(e.costUsd),f=Be(e);return(0,Q.jsx)(`tr`,{"data-slot":`task-table-row`,"data-run-id":e.id,onClick:e=>{e.target.closest(`a, button, input`)||s(u)},className:`group/row cursor-pointer hover:bg-muted`,children:a.map(a=>{if(a.id===`memory`)return null;if(a.id===`cpu`){let n=wm(`cpu`,o),r=wm(`memory`,o);return t!==null&&(n||r)?(0,Q.jsxs)(`td`,{"data-slot":`queue-note`,"data-column-id":`cpu-memory`,colSpan:2,className:G(Lm,`text-right font-mono text-[11px] text-supporting-foreground`),children:[`#`,t,` in queue`]},a.id):(0,Q.jsx)(Hm,{run:e,cpuExpanded:n,memoryExpanded:r},a.id)}return(0,Q.jsx)(zm,{column:a,expanded:wm(a.id,o),run:e,attention:c,scheduled:l,reference:f,cost:d,to:u,onRename:n,onTogglePin:r,now:i},a.id)})})}function zm({column:e,expanded:t,run:n,attention:r,scheduled:i,reference:a,cost:o,to:s,onRename:c,onTogglePin:l,now:u}){if(!t)return(0,Q.jsx)(Bm,{column:e.id});switch(e.id){case`status`:return(0,Q.jsx)(`td`,{"data-column-id":e.id,className:G(Lm,`overflow-hidden`),children:(0,Q.jsx)(ai,{dot:r.tone,shape:r.shape,pulse:r.pulse,title:i?.title??r.label,className:`w-full max-w-full overflow-hidden`,children:(0,Q.jsxs)(`span`,{className:`min-w-0 truncate`,children:[r.label,i?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(`span`,{className:`tabular-nums`,children:i.label})]}):null]})})});case`task`:return(0,Q.jsx)(`td`,{"data-column-id":e.id,className:G(Lm,`min-w-[320px] max-w-0 whitespace-normal`),children:(0,Q.jsx)(Vm,{run:n,to:s,onRename:c,onTogglePin:l})});case`workflow`:return(0,Q.jsx)(`td`,{"data-column-id":e.id,className:G(Lm,`max-w-0 truncate text-[13px] text-muted-foreground`),children:ar(n)});case`branch`:return(0,Q.jsx)(`td`,{"data-column-id":e.id,className:G(Lm,`max-w-0 overflow-hidden`),children:n.branch?(0,Q.jsx)(Jm,{branch:n.branch}):(0,Q.jsx)(qm,{})});case`diff`:return(0,Q.jsx)(`td`,{"data-column-id":e.id,className:G(Lm,`overflow-hidden`),children:n.diffStat?(0,Q.jsx)(Jo,{stat:n.diffStat,compact:!0,className:`block max-w-full`}):(0,Q.jsx)(qm,{})});case`reference`:return(0,Q.jsx)(`td`,{"data-column-id":e.id,className:G(Lm,`overflow-hidden`),children:a?(0,Q.jsx)(ui,{run:n,reference:a,compact:!0,className:`max-w-full overflow-hidden`}):(0,Q.jsx)(qm,{})});case`tokens`:let t=Zo(n.inputTokens,n.outputTokens);return(0,Q.jsx)(`td`,{"data-column-id":e.id,className:G(Lm,`text-right text-xs text-muted-foreground`),children:(0,Q.jsx)(Xo,{inputTokens:n.inputTokens,outputTokens:n.outputTokens,variant:`table`,omitWhenUnknown:!1,title:t,className:`block max-w-full overflow-hidden text-ellipsis`})});case`cost`:return(0,Q.jsx)(`td`,{"data-column-id":e.id,className:G(Lm,`text-right font-mono text-xs text-muted-foreground tabular-nums`),children:o?(0,Q.jsx)(Wm,{text:o,accessibleText:`$${n.costUsd}`}):(0,Q.jsx)(qm,{})});case`started`:return(0,Q.jsx)(`td`,{"data-column-id":e.id,className:G(Lm,`text-right text-xs text-supporting-foreground tabular-nums`),children:Ba(n.startedAt??n.createdAt,u)});case`cpu`:case`memory`:return null}}function Bm({column:e}){return(0,Q.jsx)(`td`,{role:`presentation`,"aria-hidden":`true`,"data-column-id":e,"data-folded":`true`,className:G(Lm,`px-0 first:pl-0 last:pr-0`)})}function Vm({run:e,to:t,onRename:n,onTogglePin:r}){let i=wn(e),a=ri(i,t=>n(e.id,t)),o=ii(e),s=di(e);return a.editing?(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,"data-slot":`table-title-editor`,children:[(0,Q.jsx)(fi,{editor:a,className:`basis-full text-[13px] font-medium`}),(0,Q.jsx)(z,{size:`sm`,"aria-label":`Save title`,onMouseDown:e=>e.preventDefault(),onClick:a.commit,children:`Save`}),(0,Q.jsx)(z,{size:`sm`,variant:`outline`,"aria-label":`Cancel rename`,onMouseDown:e=>e.preventDefault(),onClick:a.cancel,children:`Cancel`})]}):(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[e.delegation?.role===`worker`?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:`Worker`}):null,(0,Q.jsx)(X,{to:t,title:i,className:G(`line-clamp-2 min-w-0 flex-1 whitespace-normal rounded-sm text-[13px] leading-[18px] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground`,o?`font-semibold text-foreground`:s?`font-normal text-foreground`:`font-medium`),children:i}),o?(0,Q.jsx)(q,{tone:Yr(e),role:`img`,"aria-label":`unread`,title:`Unread — not opened since it finished`,className:`shrink-0`}):null,(0,Q.jsx)(`button`,{type:`button`,"data-slot":`row-rename`,"aria-label":`Rename task`,onClick:a.begin,className:`shrink-0 rounded-sm p-0.5 text-soft-foreground opacity-0 transition-opacity group-hover/row:opacity-100 hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,Q.jsx)(ti,{className:`size-3`,"aria-hidden":`true`})}),r?(0,Q.jsx)(hm,{pinned:!!e.pinned,onToggle:t=>r(e,t),className:`size-[19px] opacity-0 group-hover/row:opacity-100 focus-visible:opacity-100 no-hover:opacity-100 data-[pinned=true]:opacity-100`}):null]})}function Hm({run:e,cpuExpanded:t,memoryExpanded:n}){let r=Qt(e,Is(e.id));return(0,Q.jsxs)(Q.Fragment,{children:[t?(0,Q.jsx)(Um,{column:`cpu`,cell:r.cpu}):(0,Q.jsx)(Bm,{column:`cpu`}),n?(0,Q.jsx)(Um,{column:`memory`,cell:r.mem}):(0,Q.jsx)(Bm,{column:`memory`})]})}function Um({column:e,cell:t}){let n=t.text&&t.title?`${t.text}; ${t.title}`:t.text;return(0,Q.jsx)(`td`,{"data-usage":e===`memory`?`mem`:e,"data-column-id":e,"data-usage-kind":t.kind,className:G(Lm,`overflow-hidden`,`text-right font-mono tabular-nums`,t.kind===`live`&&`bg-accent-strong/5 text-xs font-medium text-foreground`,t.kind===`peak`&&`text-[11px] text-supporting-foreground`,t.kind===`none`&&`text-xs text-soft-foreground`),children:(0,Q.jsx)(Wm,{text:t.text||`—`,accessibleText:n||void 0})})}function Wm({text:e,accessibleText:t}){return(0,Q.jsx)(`span`,{"data-slot":`bounded-metric`,...t?{"aria-label":t,title:t}:{},className:`block max-w-full overflow-hidden text-ellipsis`,children:e})}function Gm({run:e,projectName:t,queuePosition:n,now:r,showTokens:i,showCost:a,onTogglePin:o}){let s=Ua(),[c,l]=Z.useState(!1),u=C(e),d=Jn(e),f=`/tasks/${e.id}`,p=Be(e),m=ii(e),h=di(e);return(0,Q.jsxs)(`div`,{"data-slot":`task-card`,"data-status":e.status,"data-run-id":e.id,onClick:e=>{e.target.closest(`a, button`)||s(f)},className:`cursor-pointer border-b border-border py-5 first:pt-0 last:border-0 last:pb-0`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start gap-2.5`,children:[(0,Q.jsx)(`button`,{"data-slot":`mobile-resources-toggle`,type:`button`,"aria-controls":`mobile-resources-${e.id}`,"aria-describedby":`mobile-status-${e.id}`,"aria-label":c?`Hide resources`:`Show resources`,title:c?`Hide resources`:`Show resources`,"aria-expanded":c,onClick:()=>l(e=>!e),children:(0,Q.jsxs)(ai,{id:`mobile-status-${e.id}`,dot:u.tone,shape:u.shape,pulse:u.pulse,className:`mt-px shrink-0`,title:d?.title,children:[u.label,d?(0,Q.jsx)(`span`,{className:`tabular-nums`,children:d.label}):null]})}),(0,Q.jsxs)(X,{to:f,className:G(`order-first w-full min-w-0 rounded-sm text-[14px] leading-[1.35] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground`,m?`font-semibold text-foreground`:h?`font-normal text-foreground`:`font-medium`),children:[e.delegation?.role===`worker`?(0,Q.jsx)(`span`,{className:`mr-2 text-xs text-muted-foreground`,children:`Worker`}):null,wn(e)]}),m?(0,Q.jsx)(q,{tone:Yr(e),role:`img`,"aria-label":`unread`,title:`Unread — not opened since it finished`,className:`mt-1.5 shrink-0`}):null,t?(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t}):null,o?(0,Q.jsx)(hm,{pinned:!!e.pinned,onToggle:t=>o(e,t),className:`-mr-1 mt-px`}):null]}),(0,Q.jsxs)(`div`,{"data-slot":`mobile-task-meta`,className:`mt-4 grid grid-cols-[minmax(0,1fr)_auto_auto] items-center gap-3 text-xs text-muted-foreground`,children:[(0,Q.jsx)(`span`,{children:ar(e)}),n===null?e.diffStat?(0,Q.jsx)(Jo,{stat:e.diffStat}):(0,Q.jsx)(qm,{}):(0,Q.jsxs)(`span`,{"data-slot":`queue-note`,children:[`#`,n,` in queue`]}),(0,Q.jsx)(`span`,{children:Ba(e.startedAt??e.createdAt,r)})]}),p?(0,Q.jsx)(`div`,{className:`mt-3`,children:(0,Q.jsx)(ui,{run:e,reference:p})}):null,c?(0,Q.jsx)(Km,{run:e,showTokens:i,showCost:a}):null]})}function Km({run:e,showTokens:t,showCost:n}){let r=Qt(e,Is(e.id));return(0,Q.jsxs)(`dl`,{id:`mobile-resources-${e.id}`,className:`mt-3 grid grid-cols-2 gap-3 rounded-md bg-muted p-3 text-xs`,children:[e.branch?(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{children:`Branch`}),(0,Q.jsx)(`dd`,{children:e.branch})]}):null,(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{children:`CPU`}),(0,Q.jsx)(`dd`,{children:r.cpu.text||`—`})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{children:`Memory`}),(0,Q.jsx)(`dd`,{children:r.mem.text||`—`})]}),t?(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{children:`IN / OUT`}),(0,Q.jsx)(`dd`,{children:(0,Q.jsx)(Xo,{inputTokens:e.inputTokens,outputTokens:e.outputTokens})})]}):null,n?(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{children:`Cost`}),(0,Q.jsx)(`dd`,{children:j(e.costUsd)||`—`})]}):null]})}function qm(){return(0,Q.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`—`})}function Jm({branch:e}){return(0,Q.jsx)(`span`,{title:e,className:`block truncate rounded-[6px] bg-muted px-1.5 py-0.5 font-mono text-[11px] font-medium text-muted-foreground`,children:e})}function Ym(){let e=Ar(),t=Qo(P().data),[n,r]=Z.useState(`active`),i=U(),a=H({mutationFn:Ke,onSuccess:()=>i.invalidateQueries({queryKey:R.runs.all}),onError:e=>F(e.message,{tone:`danger`})}),o=H({mutationFn:Ln,onSuccess:()=>i.invalidateQueries({queryKey:R.runs.all}),onError:e=>F(e.message,{tone:`danger`})}),s=H({mutationFn:({id:e,title:t})=>Hn(e,{title:t}),onSuccess:()=>i.invalidateQueries({queryKey:R.runs.all}),onError:e=>F(e.message,{tone:`danger`})}),c=Ue(),l=Ho(3e4),u=Om(),d=Tt(),f=se(void 0,{retryOnMount:!1}),p=V({retryOnMount:!1}).data?.projects?.find(e=>e.id===d)?.name;return(0,Q.jsx)(mi,{projectId:d,repoBase:f,requests:Z.useMemo(()=>d===void 0?[]:(e.data??[]).flatMap(e=>{let t=Be(e);return t?[{projectId:d,kind:t.kind,number:t.number}]:[]}),[e.data,d]),children:(0,Q.jsx)(km,{runs:e.data,projectName:p,error:e.error?.message,onRetry:()=>void e.refetch(),view:n,onViewChange:r,onArchiveFinished:()=>{a.isPending||a.mutate()},archivePending:a.isPending,onMarkAllRead:()=>o.mutate(),onRename:(e,t)=>s.mutate({id:e,title:t}),onTogglePin:(e,t)=>c.mutate({id:e.id,pinned:t}),now:l,showTokens:t.tokens,showCost:t.cost,expandedColumns:u.expandedColumns,onToggleColumn:u.toggleColumn,columnsPending:u.isPending})})}function Xm({slot:e,label:t,options:n,selected:r,onToggle:i,onClear:a,searchPlaceholder:o,emptyLabel:s=`Nothing to filter by`}){let[c,l]=Z.useState(!1),u=r.length>0,d=r.length===1?n.find(e=>e.value===r[0])?.label??r[0]:`${r.length} selected`;return(0,Q.jsxs)(Yi,{open:c,onOpenChange:l,children:[(0,Q.jsx)(Ki,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`facet-${e}`,"data-active":u?`true`:void 0,"aria-label":`Filter by ${t.toLowerCase()}`,className:G(`inline-flex h-7 items-center gap-1.5 rounded-full border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,u&&`border-accent-strong/40 bg-accent-strong/10 text-foreground`),children:[(0,Q.jsx)(`span`,{className:G(u&&`text-soft-foreground`),children:t}),u?(0,Q.jsx)(`span`,{className:`max-w-[140px] truncate font-semibold`,children:d}):null,(0,Q.jsx)(Gs,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Q.jsxs)(Ji,{align:`start`,className:`w-64 p-0`,"data-testid":`facet-${e}-menu`,children:[(0,Q.jsxs)(ga,{children:[(0,Q.jsx)(_a,{placeholder:o??`Search ${t.toLowerCase()}…`}),(0,Q.jsxs)(wa,{children:[(0,Q.jsx)(ka,{children:s}),(0,Q.jsx)(J,{children:n.map(e=>{let t=r.includes(e.value);return(0,Q.jsxs)(Y,{value:e.label,onSelect:()=>i(e.value),"data-slot":`facet-option`,"data-value":e.value,"aria-checked":t,role:`option`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:G(`flex size-4 shrink-0 items-center justify-center rounded-[4px] border`,t?`border-accent-strong bg-accent-strong text-accent-strong-foreground`:`border-input`),children:t?(0,Q.jsx)(Ws,{className:`size-3`}):null}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),e.count===void 0?null:(0,Q.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-soft-foreground tabular-nums`,children:e.count})]},e.value)})})]})]}),u?(0,Q.jsx)(`div`,{className:`border-t border-border p-1`,children:(0,Q.jsxs)(`button`,{type:`button`,"data-action":`facet-${e}-clear`,onClick:()=>a(),className:`w-full rounded-sm px-2 py-1.5 text-left text-xs font-medium text-muted-foreground hover:bg-muted hover:text-foreground`,children:[`Clear `,t.toLowerCase()]})}):null]})]})}function Zm({label:e,count:t,selected:n,onToggle:r,slot:i,tone:a=`neutral`}){return(0,Q.jsxs)(`button`,{type:`button`,"data-slot":i,"data-selected":n?`true`:void 0,"aria-pressed":n,onClick:r,className:G(`inline-flex h-7 items-center gap-1.5 rounded-full border px-2.5 text-xs font-medium transition-colors`,a===`tag`?`border-accent-strong/25 bg-accent-strong/10 text-accent-text hover:bg-accent-strong/20`:`border-border bg-card text-muted-foreground hover:bg-muted hover:text-foreground`,n&&`border-accent-strong bg-accent-strong text-accent-strong-foreground hover:bg-accent-strong`),children:[e,t===void 0?null:(0,Q.jsx)(`span`,{className:G(`font-mono text-[11px] tabular-nums`,!n&&`text-soft-foreground`),children:t})]})}function Qm({slot:e,label:t,value:n,options:r,onChange:i}){return(0,Q.jsx)(`div`,{"data-slot":e,role:`group`,"aria-label":t,className:`inline-flex gap-0.5 rounded-md bg-muted p-[3px]`,children:r.map(e=>{let t=e.value===n;return(0,Q.jsx)(`button`,{type:`button`,"data-value":e.value,"aria-pressed":t,onClick:()=>i(e.value),className:G(`flex h-6 items-center justify-center rounded-[6px] px-2.5 text-[12px] font-medium text-muted-foreground transition-colors hover:text-foreground`,t&&`bg-card font-semibold text-foreground shadow-xs`),children:e.label},e.value)})})}var $m=` untagged`,eh=[{value:`project`,label:`Project`},{value:`tag`,label:`Tag`},{value:`status`,label:`Status`},{value:`workflow`,label:`Workflow`}];function th(e,t){return e===t?`none`:t}var nh={query:``,tags:[],statuses:[],workflows:[]};function rh(e,t){return e.includes(t)?e.filter(e=>e!==t):[...e,t]}function ih(e){return(e.projects?.length??0)+e.tags.length+e.statuses.length+e.workflows.length}function ah(e){return e.query.trim()!==``||ih(e)>0}function oh(e){return ih(e.filters)+(e.filters.query.trim()===``?0:1)+(e.groupBy===`none`?0:1)}function sh(e){return oh(e)>0}function ch(e,t){let n=new Map(t.map(e=>[e.id,e]));return e.filter(e=>!Pt(e)).map(e=>{let t=n.get(e.projectId);return{run:e,project:t,projectName:t?.name||e.projectId,tags:t?.tags??[]}})}function lh(e){let t=new Set;for(let n of e)t.add(n.run.workflow);return[...t].sort((e,t)=>e.localeCompare(t))}function uh(e){let t=new Set;for(let n of e)t.add(n.run.status);return[...t].sort((e,t)=>e.localeCompare(t))}function dh(e,t){let n=new Map;for(let r of e)for(let e of t(r))n.set(e,(n.get(e)??0)+1);return n}var fh=e=>e.tags.length===0?[$m]:e.tags,ph=(e,t)=>e.length===0||t.some(t=>e.includes(t)),mh=(e,t)=>{if(t.length===0)return!0;let n=fh(e).map(e=>e.toLowerCase());return t.some(e=>n.includes(e.toLowerCase()))};function hh(e){return[wn(e.run),e.projectName,e.run.workflow,e.run.branch??``,...e.tags].join(`
7
- `).toLowerCase()}function gh(e,t,n){let r=t.query.trim().toLowerCase().split(/\s+/).filter(Boolean);return e.filter(e=>{if((n===`archived`?!e.run.archived:e.run.archived)||!ph(t.projects??[],[e.run.projectId])||!ph(t.statuses,[e.run.status])||!ph(t.workflows,[e.run.workflow])||!mh(e,t.tags))return!1;if(r.length===0)return!0;let i=hh(e);return r.every(e=>i.includes(e))})}function _h(e,t,n,r){return gh(e,{...t,[r]:[]},n)}function vh(e,t){if(t===`none`)return[{key:`all`,label:``,tasks:[...e]}];let n=new Map,r=(e,t,r)=>{let i=n.get(e);i?i.tasks.push(r):n.set(e,{key:e,label:t,tasks:[r]})};for(let n of e)if(t===`project`)r(n.run.projectId,n.projectName,n);else if(t===`status`)r(n.run.status,n.run.status,n);else if(t===`workflow`)r(n.run.workflow,n.run.workflow,n);else if(n.tags.length===0)r($m,`Untagged`,n);else for(let e of n.tags)r(e.toLowerCase(),e,n);return[...n.values()].sort((e,t)=>e.key===` untagged`?1:t.key===` untagged`?-1:t.tasks.length-e.tasks.length||e.label.localeCompare(t.label))}function yh(e,t){let n=new Map(t.map(e=>[e.id,e.name]));return e.map(e=>n.get(e)||e)}var $={query:`q`,project:`project`,tag:`tag`,untagged:`untagged`,status:`status`,workflow:`workflow`,groupBy:`group`,archived:`archived`},bh=new Set(eh.map(e=>e.value));function xh(e){let t=new URLSearchParams,n=e.filters.query.trim();n!==``&&t.set($.query,n);for(let n of e.filters.tags)n===` untagged`?t.set($.untagged,`1`):t.append($.tag,n);for(let n of e.filters.projects??[])t.append($.project,n);for(let n of e.filters.statuses)t.append($.status,n);for(let n of e.filters.workflows)t.append($.workflow,n);return e.groupBy!==`none`&&t.set($.groupBy,e.groupBy),e.view===`archived`&&t.set($.archived,`1`),t}function Sh(e){let t=e.getAll($.tag).filter(e=>e!==``);e.get($.untagged)===`1`&&t.push($m);let n=e.get($.groupBy)??``;return{filters:{query:e.get($.query)??``,...e.has($.project)?{projects:e.getAll($.project).filter(Boolean)}:{},tags:t,statuses:e.getAll($.status).filter(e=>e!==``),workflows:e.getAll($.workflow).filter(e=>e!==``)},groupBy:bh.has(n)?n:`none`,view:e.get($.archived)===`1`?`archived`:`active`}}var Ch=15e3,wh=250,Th=1,Eh=220,Dh=new Set([`done`,`failed`,`cancelled`]);function Oh(){return Ah({request:({task:e,archived:t})=>v(e.run.projectId,e.run.id,t),patch:({archived:e})=>t=>({...t,archived:e})})}function kh(){return Ah({request:({task:e,read:t})=>xn(e.run.projectId,e.run.id,t),patch:({read:e})=>t=>{if(e)return{...t,seenAt:new Date().toISOString()};let{seenAt:n,...r}=t;return r}})}function Ah({request:e,patch:t}){let n=U();return H({mutationFn:e,onMutate:async e=>{await n.cancelQueries({queryKey:I.runsIndex});let r=n.getQueryData(I.runsIndex),i=t(e),{task:a}=e;return n.setQueryData(I.runsIndex,e=>e===void 0?e:{...e,runs:e.runs.map(e=>e.projectId===a.run.projectId&&e.id===a.run.id?i(e):e)}),{previous:r}},onError:(e,t,r)=>{r?.previous&&n.setQueryData(I.runsIndex,r.previous),F(e.message,{tone:`danger`})},onSettled:(e,t,{task:r})=>{n.invalidateQueries({queryKey:I.runsIndex}),n.invalidateQueries({queryKey:R.runs.all}),n.invalidateQueries({queryKey:[r.run.projectId,`runs`,`list`]})}})}function jh(){let e=V(),t=Qo(P().data),n=Ht(!0,Ch),[r,i]=Nn(),{filters:a,groupBy:o,view:s}=Z.useMemo(()=>Sh(r),[r]),l=Ho(3e4),u=e=>i(t=>xh(e(Sh(t))),{replace:!0}),d=e=>u(t=>({...t,filters:e(t.filters)})),f=e=>u(t=>({...t,groupBy:e})),p=e=>u(t=>({...t,view:e})),[m,h]=Z.useState(o!==`none`||a.tags.length>0),[g,_]=Z.useState(a.query),v=Z.useRef(a.query);Z.useEffect(()=>{a.query!==v.current&&_(a.query),v.current=a.query},[a.query]),Z.useEffect(()=>{if(g===v.current)return;let e=setTimeout(()=>{v.current=g,d(e=>({...e,query:g}))},wh);return()=>clearTimeout(e)},[g]);let y=n.data?.referenceStatuses;Z.useEffect(()=>{y&&Ft(y)},[y]);let b=Z.useMemo(()=>e.data?.projects??[],[e.data]),x=Z.useMemo(()=>ch(n.data?.runs??[],b),[n.data,b]),S=Z.useMemo(()=>gh(x,a,s),[x,a,s]),C=Z.useMemo(()=>vh(S,o),[S,o]),w=Z.useMemo(()=>S.flatMap(e=>c(e.run,e.project?.repoUrl).map(t=>({projectId:e.run.projectId,kind:t.kind,number:t.number}))),[S]),T=yh(n.data?.truncated??[],b),E=(e,t)=>d(n=>({...n,[e]:rh(n[e]??[],t)})),ee=e=>d(t=>({...t,[e]:[]})),D=Oh(),k=kh();if(n.isError||e.isError)return(0,Q.jsx)(`div`,{"data-route":`global-tasks`,"data-presentation":o===`none`?`summary`:`cards`,"data-filter-details":m,className:`flex min-h-full flex-col gap-[22px] px-[18px] pt-6 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-9`,children:(0,Q.jsx)(W,{icon:(0,Q.jsx)(O,{}),tone:`danger`,title:`Tasks across projects did not load`,subtitle:(n.error??e.error)?.message,actions:(0,Q.jsx)(z,{variant:`outline`,onClick:()=>{n.refetch(),e.refetch()},children:`Retry`})})});let te=(0,Q.jsxs)(`div`,{className:`relative w-full`,children:[(0,Q.jsx)(We,{className:`pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2 text-soft-foreground`,"aria-hidden":`true`}),(0,Q.jsx)(`input`,{type:`text`,value:g,onChange:e=>_(e.target.value),placeholder:`Search every project…`,"aria-label":`Search tasks across projects`,className:`h-11 w-full rounded-md border border-input bg-card pr-3 pl-8 text-[13px] text-foreground outline-none placeholder:text-soft-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]});return(0,Q.jsxs)(`div`,{"data-route":`global-tasks`,"data-presentation":o===`none`?`summary`:`cards`,"data-filter-details":m,className:`flex min-h-full flex-col gap-[22px] px-[18px] pt-6 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-9`,children:[(0,Q.jsxs)(`header`,{className:`flex shrink-0 flex-col gap-[22px]`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`h1`,{className:`text-[30px] font-semibold tracking-tight`,children:`All tasks`}),(0,Q.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:o===`none`?`Every project. One place to review what your agents have shipped.`:`Filter across projects and act on each run without opening the session.`})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-6 border-b border-border`,children:[(0,Q.jsx)(Mh,{view:`active`,current:s,onSelect:p,children:`Active`}),(0,Q.jsx)(Mh,{view:`archived`,current:s,onSelect:p,children:`Archived`}),(0,Q.jsxs)(`span`,{"data-slot":`global-tasks-count`,className:`ml-auto text-[13px] text-soft-foreground tabular-nums`,children:[S.length,` of `,x.length]})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2.5`,children:[(0,Q.jsx)(`div`,{className:`min-w-0 basis-full md:flex-1 md:basis-auto`,children:te}),(0,Q.jsxs)(z,{variant:`outline`,"aria-expanded":m,onClick:()=>h(e=>!e),children:[(0,Q.jsx)(ce,{"aria-hidden":`true`}),`Filters`]}),(0,Q.jsx)(z,{asChild:!0,className:`min-h-11`,children:(0,Q.jsxs)(L,{to:Ha(e.data?.bootProject??`default`,`/new`),children:[(0,Q.jsx)(pe,{"aria-hidden":`true`}),`New task`]})})]})]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[22px]`,children:[(0,Q.jsx)(Nh,{filters:a,onToggle:E,onClearFacet:ee,onClearAll:()=>{_(``),u(e=>({...e,filters:nh,groupBy:`none`}))},groupBy:o,onGroupByChange:f,projects:b,tasks:x,view:s}),T.length>0?(0,Q.jsxs)(`p`,{"data-slot":`global-tasks-truncated`,className:`text-[11px] text-soft-foreground`,children:[`Showing the newest `,n.data?.perProjectLimit,` tasks per project — older ones in`,` `,T.join(`, `),` are only in that project’s own Tasks page.`]}):null,n.data===void 0?(0,Q.jsx)(`div`,{role:`status`,className:`rounded-xl border border-border bg-card p-6 text-sm text-muted-foreground`,children:`Loading tasks…`}):S.length===0?(0,Q.jsx)(Hh,{view:s,filtered:ah(a)}):(0,Q.jsx)(mi,{requests:w,children:C.map(e=>(0,Q.jsxs)(`section`,{"data-slot":`task-group`,"data-group-key":e.key,children:[o===`none`?null:(0,Q.jsxs)(`h2`,{className:`mb-1.5 flex items-center gap-2 text-[12px] font-semibold tracking-[0.04em] text-soft-foreground uppercase`,children:[o===`project`?(0,Q.jsx)(L,{to:Ha(e.key,`/`),"data-slot":`group-project-link`,className:`hover:text-foreground hover:underline`,children:e.label}):e.label,(0,Q.jsx)(`span`,{className:`font-mono text-[11px] font-medium tabular-nums`,children:e.tasks.length})]}),(0,Q.jsx)(Ph,{tasks:e.tasks,now:l,showProject:o!==`project`,onArchive:(e,t)=>D.mutate({task:e,archived:t}),onSetRead:(e,t)=>k.mutate({task:e,read:t}),busy:D.isPending||k.isPending,showCost:t.cost})]},e.key))}),o===`none`&&S.length>0?(0,Q.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Resource details—including tokens, cost, CPU and peak memory—are available when a task row is expanded.`}):null,b.length>1?(0,Q.jsxs)(`section`,{"data-slot":`other-projects`,className:`rounded-lg border border-border bg-card p-5`,children:[(0,Q.jsx)(`h2`,{className:`text-base font-semibold`,children:`Other projects`}),(0,Q.jsx)(`div`,{className:`mt-3 flex flex-col divide-y divide-border`,children:b.map(e=>(0,Q.jsxs)(`div`,{className:`flex min-h-14 items-center justify-between gap-3`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-[13px]`,children:e.name}),(0,Q.jsxs)(L,{to:Ha(e.id,`/`),className:`inline-flex min-h-11 shrink-0 items-center rounded-md px-3 text-xs text-accent-text hover:bg-accent-strong/10`,children:[`View tasks`,(0,Q.jsxs)(`span`,{className:`sr-only`,children:[` for `,e.name]})]})]},e.id))})]}):null]})]})}function Mh({view:e,current:t,onSelect:n,children:r}){let i=e===t;return(0,Q.jsx)(`button`,{type:`button`,"data-slot":`overview-tab`,"data-view":e,"aria-pressed":i,onClick:()=>n(e),className:G(`flex min-h-11 items-center justify-center border-b-2 border-transparent text-[13px] font-medium text-muted-foreground`,i&&`border-accent-strong font-semibold text-accent-text`),children:r})}function Nh({filters:e,onToggle:t,onClearFacet:n,onClearAll:r,groupBy:i,onGroupByChange:a,projects:o,tasks:s,view:c}){let l=Z.useMemo(()=>fe(o),[o]),u=Z.useMemo(()=>{let t=(t,n)=>dh(_h(s,e,c,t),n);return{projects:t(`projects`,e=>[e.run.projectId]),tags:t(`tags`,fh),statuses:t(`statuses`,e=>[e.run.status]),workflows:t(`workflows`,e=>[e.run.workflow])}},[s,e,c]),d=e=>t=>({...t,count:e.get(t.value)??0});return(0,Q.jsxs)(`div`,{"data-slot":`global-tasks-filters`,className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,Q.jsx)(Xm,{slot:`project`,label:`Project`,selected:e.projects??[],onToggle:e=>t(`projects`,e),onClear:()=>n(`projects`),options:[...new Map(s.map(e=>[e.run.projectId,e.projectName])).entries()].map(([e,t])=>({value:e,label:t})).map(d(u.projects)),emptyLabel:`No tasks to filter`}),(0,Q.jsx)(Xm,{slot:`status`,label:`Status`,selected:e.statuses,onToggle:e=>t(`statuses`,e),onClear:()=>n(`statuses`),options:uh(s).map(e=>({value:e,label:e})).map(d(u.statuses)),emptyLabel:`No tasks to filter`}),(0,Q.jsx)(Xm,{slot:`workflow`,label:`Workflow`,selected:e.workflows,onToggle:e=>t(`workflows`,e),onClear:()=>n(`workflows`),options:lh(s).map(e=>({value:e,label:e})).map(d(u.workflows)),emptyLabel:`No tasks to filter`}),(0,Q.jsxs)(`div`,{"data-slot":`group-controls`,className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`mx-1 h-5 w-px bg-border`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`text-[11px] font-medium text-soft-foreground`,children:`Group by`}),(0,Q.jsx)(Qm,{slot:`group-by`,label:`Group tasks by`,value:i,options:eh,onChange:e=>a(th(i,e))})]}),sh({filters:e,groupBy:i})?(0,Q.jsxs)(`button`,{type:`button`,"data-action":`clear-filters`,onClick:r,className:`ml-auto inline-flex h-7 items-center gap-1 rounded-full px-2 text-xs font-medium text-muted-foreground hover:bg-muted hover:text-foreground`,children:[(0,Q.jsx)(or,{className:`size-3`,"aria-hidden":`true`}),`Clear`,` (${oh({filters:e,groupBy:i})})`]}):null]}),l.length>0?(0,Q.jsxs)(`div`,{"data-slot":`tag-filters`,className:`flex flex-wrap items-center gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`text-[11px] font-medium text-soft-foreground`,children:`Tags`}),l.map(n=>(0,Q.jsx)(Zm,{slot:`tag-filter`,tone:`tag`,label:n,count:u.tags.get(n)??0,selected:e.tags.some(e=>e.toLowerCase()===n.toLowerCase()),onToggle:()=>t(`tags`,n)},n)),(0,Q.jsx)(Zm,{slot:`tag-filter`,label:`Untagged`,count:u.tags.get(` untagged`)??0,selected:e.tags.includes($m),onToggle:()=>t(`tags`,$m)})]}):(0,Q.jsxs)(`p`,{"data-slot":`no-tags-hint`,className:`text-[11px] text-soft-foreground`,children:[`Tag connected repositories in`,` `,(0,Q.jsx)(L,{to:`/settings/global/projects`,className:`font-medium text-accent-text hover:underline`,children:`Settings → Projects`}),` `,`to group their tasks together here.`]})]})}function Ph({tasks:e,now:t,showProject:n,onArchive:r,onSetRead:i,busy:a,showCost:o}){return(0,Q.jsxs)(`div`,{"data-slot":`global-tasks-table`,className:`overflow-x-auto rounded-lg border border-border bg-card p-5`,children:[(0,Q.jsx)(`div`,{"data-slot":`global-summary-head`,className:`text-[12px]`,"aria-hidden":`true`,children:[`Task`,`Workflow`,`Changes`,`Pull request`,`Started`].map(e=>(0,Q.jsx)(`span`,{children:e},e))}),(0,Q.jsx)(gm,{children:e.map(e=>(0,Q.jsx)(Fh,{task:e,now:t,showProject:n,onArchive:r,onSetRead:i,busy:a,showCost:o},`${e.run.projectId}/${e.run.id}`))})]})}function Fh({task:e,now:t,showProject:n,onArchive:r,onSetRead:i,busy:a,showCost:o}){let{run:s}=e,[l,u]=Z.useState(!1),d=C(s),f=Ha(s.projectId,`/tasks/${s.id}`),p=ii(s),m=di(s),h=c(s,e.project?.repoUrl),g=Qt(s,s.usage);return(0,Q.jsxs)(`article`,{"data-status":s.status,"data-expanded":l,"data-slot":`global-task-row`,"data-run-id":s.id,"data-project":s.projectId,className:`hover:bg-muted max-md:flex max-md:flex-wrap max-md:items-center max-md:gap-x-3 max-md:gap-y-2 max-md:border-b max-md:border-border max-md:py-5 max-md:first:pt-0 max-md:last:border-0 max-md:last:pb-0`,children:[(0,Q.jsxs)(`div`,{"data-slot":`global-task-title`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[s.delegation?.role===`worker`?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:`Worker`}):null,(0,Q.jsx)(L,{to:f,title:wn(s),className:G(`min-w-0 truncate text-[14px] md:text-[13px]`,p?`font-semibold text-foreground`:m?`font-medium text-muted-foreground`:`font-medium`),children:wn(s)}),p?(0,Q.jsx)(q,{tone:Yr(s),role:`img`,"aria-label":`unread`,title:`Unread — not opened since it finished`,className:`shrink-0`}):null]}),(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`button`,{type:`button`,"aria-expanded":l,"aria-label":`${l?`Hide`:`Show`} resources for ${wn(s)}`,onClick:()=>u(e=>!e),"aria-describedby":`global-status-${s.projectId}-${s.id}`,title:`Resources and actions`,className:`min-h-[26px] rounded-md p-0 text-[11px] text-muted-foreground hover:bg-muted`,children:(0,Q.jsx)(ai,{id:`global-status-${s.projectId}-${s.id}`,dot:d.tone,shape:d.shape,pulse:d.pulse,children:d.label})}),n?(0,Q.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:(0,Q.jsx)(L,{to:Ha(s.projectId,`/`),className:`truncate hover:text-foreground`,children:e.projectName})}):null,(0,Q.jsx)(`span`,{children:e.tags.length>0?(0,Q.jsx)(`span`,{className:`flex flex-wrap items-center gap-1`,children:e.tags.map(e=>(0,Q.jsx)(Bh,{tag:e},e))}):null})]})]}),(0,Q.jsx)(`div`,{"data-slot":`global-task-references`,children:h.length>0?(0,Q.jsx)(Rh,{references:h,run:s,repoBase:e.project?.repoUrl}):(0,Q.jsx)(Vh,{})}),(0,Q.jsx)(`div`,{"data-slot":`global-task-workflow`,className:`text-[13px] text-muted-foreground`,children:s.workflow}),(0,Q.jsx)(`div`,{"data-slot":`global-task-diff`,className:`text-xs text-muted-foreground`,children:(0,Q.jsx)(`span`,{title:`Change totals are available in the project task list`,children:`—`})}),(0,Q.jsx)(`div`,{"data-slot":`global-task-age`,className:`text-right text-xs text-soft-foreground tabular-nums`,children:Ba(s.startedAt??s.createdAt,t)}),(0,Q.jsx)(`div`,{"data-slot":`global-task-actions`,children:(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,Q.jsx)(Ih,{task:e,busy:a,onSetRead:i}),(0,Q.jsx)(Lh,{task:e,busy:a,onArchive:r}),(0,Q.jsx)(z,{asChild:!0,variant:`outline`,children:(0,Q.jsx)(L,{to:f,children:`Open task`})})]})}),l?(0,Q.jsx)(`div`,{"data-slot":`global-task-resources`,className:`col-span-full`,children:(0,Q.jsxs)(`dl`,{className:`grid grid-cols-2 gap-4 rounded-md bg-muted/50 p-4 text-xs md:grid-cols-3`,children:[o?(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Cost`}),(0,Q.jsx)(`dd`,{className:`mt-1`,children:j(s.costUsd)||`—`})]}):null,(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`CPU`}),(0,Q.jsx)(`dd`,{"data-usage":`cpu`,"data-usage-kind":g.cpu.kind,title:g.cpu.title,className:`mt-1`,children:g.cpu.text||`—`})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Memory`}),(0,Q.jsx)(`dd`,{"data-usage":`mem`,"data-usage-kind":g.mem.kind,title:g.mem.title,className:`mt-1`,children:g.mem.text||`—`})]})]})}):null]})}function Ih({task:e,busy:t,onSetRead:n}){if(!Jr(e.run))return null;let r=ii(e.run),i=wn(e.run),a=r?`Mark ${i} read`:`Mark ${i} unread`,o=r?ua:tc;return(0,Q.jsxs)(_m,{children:[(0,Q.jsx)(vm,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-action":r?`mark-read`:`mark-unread`,"aria-label":a,disabled:t,onClick:()=>n(e,r),className:G(`inline-flex size-11 items-center justify-center md:size-8 rounded-md transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none disabled:cursor-wait disabled:opacity-50`,r?`text-accent-icon`:`text-soft-foreground`),children:[(0,Q.jsx)(o,{className:`size-3.5`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{children:r?`Mark read`:`Mark unread`})]})}),(0,Q.jsx)(ym,{side:`left`,children:r?`Mark read`:`Mark unread`})]})}function Lh({task:e,busy:t,onArchive:n}){let r=e.run.archived;if(!r&&!Dh.has(e.run.status))return null;let i=r?`Restore ${wn(e.run)} to the active list`:`Archive ${wn(e.run)}`;return(0,Q.jsxs)(_m,{children:[(0,Q.jsx)(vm,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-action":r?`unarchive-run`:`archive-run`,"aria-label":i,disabled:t,onClick:()=>n(e,!r),className:`inline-flex size-11 items-center justify-center md:size-8 rounded-md text-soft-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none disabled:cursor-wait disabled:opacity-50`,children:[(0,Q.jsx)(r?$r:it,{className:`size-3.5`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{children:r?`Unarchive`:`Archive`})]})}),(0,Q.jsx)(ym,{side:`left`,children:r?`Restore`:`Archive`})]})}function Rh({references:e,run:t,repoBase:n}){let r=e.slice(0,Th),i=e.length-r.length,a=wn(t);return(0,Q.jsxs)(`span`,{className:`flex flex-nowrap items-center gap-1`,children:[r.map(e=>(0,Q.jsx)(hi,{reference:e,taskTitle:a,projectId:t.projectId,to:bt(t.projectId,t.id,e,n),conflictAction:(0,Q.jsx)(li,{projectId:t.projectId,runId:t.id,prNumber:e.number}),className:`shrink-0`},ye(e))),i>0?(0,Q.jsx)(zh,{references:e,taskTitle:a,hidden:i,projectId:t.projectId,runId:t.id,repoBase:n}):null]})}function zh({references:e,taskTitle:t,hidden:n,projectId:r,runId:i,repoBase:a}){let[o,s]=Z.useState(!1),c=Z.useRef(!1),l=Z.useRef(void 0);Z.useEffect(()=>()=>clearTimeout(l.current),[]);let u=e=>e.pointerType!==`touch`,d=()=>clearTimeout(l.current),f=e=>{u(e)&&(d(),c.current=!0,s(!0))},p=e=>{u(e)&&(d(),l.current=setTimeout(()=>s(!1),Eh))};return(0,Q.jsxs)(Yi,{open:o,onOpenChange:s,children:[(0,Q.jsx)(Ki,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`reference-overflow`,"aria-label":`Show all ${e.length} references for ${t}`,onPointerEnter:f,onPointerLeave:p,onPointerDown:()=>{c.current=!1},onClick:()=>{c.current=!1},className:`shrink-0 rounded-full px-1 text-[11px] font-medium text-soft-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:[`+`,n]})}),(0,Q.jsxs)(Ji,{align:`start`,className:`w-auto min-w-40 p-1.5`,"data-slot":`reference-overflow-list`,onPointerEnter:f,onPointerLeave:p,onOpenAutoFocus:e=>{c.current&&e.preventDefault()},onCloseAutoFocus:e=>{c.current&&e.preventDefault()},children:[(0,Q.jsx)(`p`,{className:`px-1 pb-1.5 text-[11px] text-soft-foreground`,children:`References`}),(0,Q.jsx)(`span`,{className:`flex flex-col items-start gap-1`,children:e.map(e=>(0,Q.jsx)(hi,{reference:e,taskTitle:t,projectId:r,to:bt(r,i,e,a)},ye(e)))})]})]})}function Bh({tag:e,className:t}){return(0,Q.jsx)(`span`,{"data-slot":`project-tag`,className:G(`inline-flex max-w-full items-center truncate rounded-full bg-muted px-1.5 py-px text-[11px] font-medium text-muted-foreground`,t),children:e})}function Vh(){return(0,Q.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`—`})}function Hh({view:e,filtered:t}){return t?(0,Q.jsx)(W,{heading:`h2`,icon:(0,Q.jsx)(Wa,{}),tone:`neutral`,title:`No matching tasks`,subtitle:`No task in any project matches these filters.`}):e===`archived`?(0,Q.jsx)(W,{heading:`h2`,icon:(0,Q.jsx)(it,{}),tone:`neutral`,title:`Nothing archived yet`,subtitle:`Finished tasks you archive land here, from every project.`}):(0,Q.jsx)(W,{heading:`h2`,icon:(0,Q.jsx)(lc,{}),tone:`neutral`,title:`No tasks yet`,subtitle:`Start a task in any project and it shows up here.`})}function Uh({className:e,...t}){return(0,Q.jsx)(Wc,{"data-slot":`label`,className:G(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}function Wh({mode:e=`list`}){let{automationId:t}=sr(),n=Ua(),r=za(),[i,a]=(0,Z.useState)(),[o,s]=(0,Z.useState)(``),[c,l]=(0,Z.useState)({}),u=P(),d=u.data!==void 0,f=d&&u.data.capabilities?.automations!==!0,p=()=>re().then(e=>{a(e),s(``)}).catch(e=>s(String(e)));if((0,Z.useEffect)(()=>{d&&!f&&p()},[d,f]),(0,Z.useEffect)(()=>vs((e,t)=>{if(e!==`automation-change`)return;let n=t;typeof n.project==`string`&&(r===null||n.project===r)&&p()}),[r]),!d)return(0,Q.jsx)(`div`,{"data-route":`automations`,className:`task-flow-page flex min-h-full flex-col`,children:(0,Q.jsx)(Yh,{text:`Loading automations…`})});if(f)return(0,Q.jsx)(`div`,{"data-route":`automations`,className:`task-flow-page flex min-h-full flex-col`,children:(0,Q.jsx)(W,{icon:(0,Q.jsx)(Mn,{}),tone:`neutral`,title:`GitHub automations are off`,subtitle:`This server does not poll GitHub or launch tasks from it. Set CEZ_AUTOMATIONS=1 and restart cezar to turn automations on.`,heading:`h2`})});if(e===`new`)return(0,Q.jsx)(qh,{onSaved:()=>{n(`/automations`),p()}});if(e===`edit`){let e=i?.automations.find(e=>e.id===t);return o?(0,Q.jsxs)(Jh,{title:`Edit automation`,subtitle:`Could not load this automation.`,children:[(0,Q.jsx)(Yh,{text:o}),(0,Q.jsx)(z,{variant:`outline`,onClick:()=>void p(),children:`Retry`})]}):i&&!e?(0,Q.jsx)(Jh,{title:`Automation not found`,subtitle:`This automation may have been removed.`,children:(0,Q.jsx)(z,{asChild:!0,variant:`outline`,children:(0,Q.jsx)(X,{to:`/automations`,children:`Back to automations`})})}):e?(0,Q.jsx)(qh,{automation:e,onSaved:()=>{n(`/automations`),p()}}):(0,Q.jsx)(Yh,{text:`Loading automation…`})}if(e===`log`){let e=i?.automations.find(e=>e.id===t);return t?(0,Q.jsx)(Kh,{automationId:t,automationName:e?.name}):(0,Q.jsx)(Yh,{text:`Automation not found.`})}let m=async e=>{l(t=>({...t,[e.id]:`Checking…`}));try{let{checkId:t}=await Pe(e.id,`preview`);for(let n=0;n<60;n+=1){let n=await et(t);if(n.status===`complete`){l(t=>({...t,[e.id]:`${n.matches??0} match${n.matches===1?``:`es`} found; no tasks launched.`})),p();return}if(n.status===`error`)throw Error(n.error??`Preview failed`);await new Promise(e=>setTimeout(e,500))}throw Error(`Preview is still running`)}catch(t){l(n=>({...n,[e.id]:t instanceof Error?t.message:String(t)}))}};return(0,Q.jsx)(Jh,{title:`Automations`,subtitle:`Checks run while Cezarion is open. No webhook or public URL required.`,action:(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsx)(z,{asChild:!0,children:(0,Q.jsx)(X,{to:`/automations/new`,children:`New automation`})}),(0,Q.jsx)(z,{variant:`outline`,asChild:!0,children:(0,Q.jsx)(X,{to:`/github`,children:`GitHub`})})]}),children:o?(0,Q.jsxs)(`div`,{className:`grid gap-3`,children:[(0,Q.jsx)(Yh,{text:o}),(0,Q.jsx)(z,{variant:`outline`,onClick:()=>void p(),children:`Retry`})]}):i?(0,Q.jsxs)(Q.Fragment,{children:[i.automations.length===0?(0,Q.jsxs)(`section`,{className:`rounded-xl border border-border bg-card p-6`,children:[(0,Q.jsx)(`h2`,{className:`text-xl font-normal`,children:`No automations yet`}),(0,Q.jsx)(`p`,{className:`mt-5 text-sm text-muted-foreground`,children:`Create a bounded trigger to start ordinary tasks from new GitHub issues.`})]}):(0,Q.jsx)(`div`,{className:`grid gap-3`,children:i.automations.map(e=>(0,Q.jsxs)(`article`,{className:`rounded-xl border bg-card p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`font-semibold`,children:e.name}),(0,Q.jsxs)(`p`,{className:`mt-6 text-[13px] text-muted-foreground`,children:[e.events.join(`, `),` · every `,Math.round(e.intervalSeconds/60),` min`]})]}),(0,Q.jsx)(`span`,{className:`rounded-lg border px-4 py-3 text-xs`,children:e.enabled?`Enabled`:`Paused`})]}),(0,Q.jsx)(Gh,{data:i}),(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-3`,children:[(0,Q.jsx)(z,{variant:`outline`,asChild:!0,children:(0,Q.jsx)(X,{to:`/automations/${e.id}`,children:`Edit`})}),(0,Q.jsx)(z,{variant:`outline`,asChild:!0,children:(0,Q.jsx)(X,{to:`/automations/${e.id}/log`,children:`Execution log`})}),(0,Q.jsx)(z,{variant:`outline`,onClick:()=>void Ne(e.id,!e.enabled).then(p),children:e.enabled?`Pause`:`Enable`}),(0,Q.jsx)(z,{variant:`outline`,onClick:()=>void m(e),disabled:c[e.id]===`Checking…`,children:`Test filter`})]}),c[e.id]&&(0,Q.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,role:`status`,children:c[e.id]})]},e.id))}),i.automations.length===0?(0,Q.jsx)(Gh,{data:i}):null,i.automations.map(e=>(0,Q.jsx)(Kh,{automationId:e.id,automationName:e.name,showName:i.automations.length>1,inline:!0},e.id))]}):(0,Q.jsx)(Yh,{text:`Loading automations…`})})}function Gh({data:e}){return(0,Q.jsxs)(`p`,{"data-slot":`automation-scheduler`,className:`mt-4 text-xs ${e.available?e.scheduler.state===`scheduled`?`text-success`:`text-muted-foreground`:`text-destructive`}`,children:[`Scheduler `,e.scheduler.state,` · GitHub `,e.available?`available`:`unavailable`,e.reason?` · ${e.reason}`:``]})}function Kh({automationId:e,automationName:t,inline:n=!1,showName:r=!1}){let[i,a]=(0,Z.useState)(),[o,s]=(0,Z.useState)(``),c=()=>dt(e).then(({records:e})=>{a(e),s(``)}).catch(e=>s(String(e)));(0,Z.useEffect)(()=>{c()},[e]),(0,Z.useEffect)(()=>vs((t,n)=>{t===`automation-change`&&n.automationId===e&&c()}),[e]);let l=(0,Q.jsx)(Q.Fragment,{children:o?(0,Q.jsxs)(`div`,{className:`grid gap-3`,children:[(0,Q.jsx)(Yh,{text:o}),(0,Q.jsx)(z,{variant:`outline`,onClick:()=>void c(),children:`Retry`})]}):i?i.length===0?(0,Q.jsx)(Yh,{text:`No checks have run yet.`}):(0,Q.jsx)(`ol`,{className:`grid gap-3`,"aria-label":`Automation execution log`,children:(n?i.slice(0,5):i).map(e=>(0,Q.jsxs)(`li`,{className:`rounded-xl border bg-card p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsx)(`span`,{className:`font-medium capitalize`,children:e.result.replace(`-`,` `)}),(0,Q.jsx)(`time`,{className:`text-xs text-muted-foreground`,dateTime:e.ts,children:new Date(e.ts).toLocaleString()})]}),e.reason&&(0,Q.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:e.reason}),(e.githubUrl||e.runId)&&(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-3 text-sm`,children:[e.githubUrl&&(0,Q.jsx)(`a`,{className:`underline underline-offset-4`,href:e.githubUrl,target:`_blank`,rel:`noreferrer`,children:e.githubTitle??`GitHub #${e.githubNumber??``}`}),e.runId&&(0,Q.jsx)(X,{className:`underline underline-offset-4`,to:`/tasks/${e.runId}`,children:`Open task`})]})]},e.seq))}):(0,Q.jsx)(Yh,{text:`Loading execution log…`})});return n?(0,Q.jsxs)(`section`,{"data-slot":`automation-inline-log`,className:`mt-5 rounded-xl border border-border bg-card p-6`,children:[(0,Q.jsxs)(`h2`,{className:`mb-4 text-lg font-medium`,children:[`Recent activity`,r?` · ${t}`:``]}),l]}):(0,Q.jsx)(Jh,{title:`Execution log`,subtitle:t??`Automation activity`,action:(0,Q.jsx)(z,{variant:`outline`,asChild:!0,children:(0,Q.jsx)(X,{to:`/automations`,children:`Back to automations`})}),children:l})}function qh({automation:e,onSaved:t}){let[n,r]=(0,Z.useState)(e?.name??``),[i,a]=(0,Z.useState)(e?.task.prompt??`Review {{github.url}}`),[o,s]=(0,Z.useState)(!1),[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(``);return(0,Q.jsx)(Jh,{title:e?`Edit automation`:`New automation`,subtitle:`Define a bounded GitHub trigger and the ordinary task it launches.`,children:(0,Q.jsxs)(`form`,{className:`automation-editor grid gap-5`,onSubmit:async r=>{if(r.preventDefault(),!c){l(!0),d(``);try{e?(await Te(e.id,{name:n,description:e.description,events:e.events,intervalSeconds:e.intervalSeconds,filters:e.filters,task:{...e.task,prompt:i},enabled:e.enabled,expectedRevision:e.revision}),o&&!e.enabled&&await Ne(e.id,!0)):await Ae({name:n,events:[`issue.opened`],intervalSeconds:300,filters:{lookbackDays:7,maxRecords:25},task:{prompt:i,workflow:`quick-task`},enable:o}),t()}catch(e){d(String(e))}finally{l(!1)}}},children:[(0,Q.jsxs)(`fieldset`,{className:`grid gap-4 rounded-xl border p-5`,children:[(0,Q.jsx)(`legend`,{className:`px-2 font-semibold`,children:`When GitHub changes`}),(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(Uh,{htmlFor:`automation-name`,children:`Name`}),(0,Q.jsx)(Ku,{id:`automation-name`,value:n,onChange:e=>r(e.target.value),required:!0})]}),(0,Q.jsx)(`div`,{className:`flex items-center gap-2 text-sm`,children:e?`Saved trigger · ${e.events.join(`, `)} · Every ${Math.round(e.intervalSeconds/60)} minutes`:`New issue · every 5 minutes · last 7 days · maximum 25 records`})]}),(0,Q.jsxs)(`fieldset`,{className:`grid gap-4 rounded-xl border p-5`,children:[(0,Q.jsx)(`legend`,{className:`px-2 font-semibold`,children:`What task to run`}),(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(Uh,{htmlFor:`automation-prompt`,children:`Prompt`}),(0,Q.jsx)(So,{id:`automation-prompt`,value:i,onChange:e=>a(e.target.value),rows:2,required:!0})]}),(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Available: `,`{{github.number}}`,` `,`{{github.title}}`,` `,`{{github.url}}`,` `,`{{github.labels}}`]}),(0,Q.jsx)(`p`,{className:`text-xs text-pending-strong`,children:`GitHub content is appended as untrusted context.`})]}),e?.enabled?null:(0,Q.jsxs)(`fieldset`,{className:`relative rounded-xl border p-5`,children:[(0,Q.jsx)(`legend`,{className:`sr-only`,children:`Review and enable`}),(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:o,onChange:e=>s(e.target.checked)}),`Save and enable from a current-time baseline`]}),(0,Q.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Existing matches will not launch tasks.`})]}),u&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:u}),(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(z,{type:`submit`,disabled:c,children:c?`Saving…`:`Save automation`}),(0,Q.jsx)(z,{type:`button`,variant:`outline`,onClick:t,children:`Cancel`})]})]})})}function Jh({title:e,subtitle:t,action:n,children:r}){return(0,Q.jsxs)(`main`,{"data-route":`automations`,className:`task-flow-page w-full`,children:[(0,Q.jsxs)(`header`,{className:`mb-6 flex flex-col items-start gap-5`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`mb-2 flex items-center gap-2`,children:(0,Q.jsx)(`h1`,{className:`text-[28px] font-medium`,children:e})}),(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t})]}),n]}),r]})}function Yh({text:e}){return(0,Q.jsx)(`div`,{role:`status`,className:`rounded-xl border bg-card p-6 text-sm text-muted-foreground`,children:e})}function Xh(e){return e instanceof Error?e.message.match(/https:\/\/github\.com\/orgs\/[A-Za-z0-9._-]+\/sso\?authorization_request=[A-Za-z0-9._~-]+(?![^\s'"<>])/)?.[0]??null:null}function Zh({open:e,onOpenChange:t}){let[n,r]=(0,Z.useState)(``),[i,a]=(0,Z.useState)(``),[o,s]=(0,Z.useState)(null),[c,l]=(0,Z.useState)(!1),u=(0,Z.useRef)(!1),d=V(),f=Wn(),{mutate:p,isPending:m}=f,h=en(),g=Xh(f.error),v=(0,Z.useMemo)(()=>`co-${Math.random().toString(36).slice(2)}-${Date.now().toString(36)}`,[]),y=(0,Z.useRef)(v);y.current=v,(0,Z.useEffect)(()=>vs((e,t)=>{if(e!==`checkout-progress`)return;let n=t;n?.checkoutId===y.current&&(n.phase===`cloning`&&n.line?s(n.line):n.phase!==`cloning`&&s(null))}),[]);let b=(0,Z.useMemo)(()=>{let e=n.trim().replace(/\/+$/,``).replace(/\.git$/,``).split(`/`).pop()??``;return e.includes(`:`)?e.split(`:`).pop()??``:e},[n]),x=i.trim()===``?b:i.trim(),S=d.data?.projectsDir??``,C=x===``?``:`${S.replace(/\/+$/,``)}/${x}`,w=(0,Z.useCallback)(()=>{n.trim()===``||m||(u.current=!1,l(!1),s(null),p({url:n.trim(),checkoutId:v,...i.trim()===``?{}:{name:i.trim()}},{onSuccess:({project:e})=>{t(!1),h(`/p/${encodeURIComponent(e.id)}/`)}}))},[p,m,v,i,h,t,n]);return(0,Z.useEffect)(()=>{if(!c)return;let e=()=>{u.current&&(u.current=!1,l(!1),w())},t=()=>{document.visibilityState===`visible`&&e()};return window.addEventListener(`focus`,e),document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`focus`,e),document.removeEventListener(`visibilitychange`,t)}},[c,w]),(0,Q.jsx)(vo,{open:e,onOpenChange:e=>f.isPending?void 0:t(e),children:(0,Q.jsxs)(bo,{"data-slot":`clone-project-dialog`,className:`min-w-0 max-h-[calc(100dvh-2rem)] overflow-x-hidden overflow-y-auto sm:max-w-lg`,children:[(0,Q.jsxs)(yo,{children:[(0,Q.jsx)(xo,{children:`Clone from GitHub`}),(0,Q.jsxs)(_o,{children:[`cezar clones with `,(0,Q.jsx)(`code`,{children:`gh`}),` into your checkout root and adds the result as a project.`]})]}),(0,Q.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,Q.jsx)(Uh,{htmlFor:`clone-url`,children:`Repository`}),(0,Q.jsx)(Ku,{id:`clone-url`,"data-slot":`clone-url`,autoFocus:!0,placeholder:`owner/repo or https://github.com/owner/repo`,value:n,disabled:f.isPending,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&w()}})]}),(0,Q.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,Q.jsx)(Uh,{htmlFor:`clone-name`,children:`Folder name`}),(0,Q.jsx)(Ku,{id:`clone-name`,"data-slot":`clone-name`,placeholder:b===``?`repo`:b,value:i,disabled:f.isPending,onChange:e=>a(e.target.value)}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,Q.jsx)(`p`,{"data-slot":`clone-target`,className:`min-w-0 flex-1 truncate font-mono text-[11px] text-soft-foreground`,title:C,children:C}),f.isPending?(0,Q.jsx)(z,{"data-slot":`clone-root-settings`,variant:`ghost`,size:`icon-sm`,className:`size-7`,"aria-label":`Edit checkout root`,title:`Edit checkout root`,disabled:!0,children:(0,Q.jsx)(_,{className:`size-3.5`,"aria-hidden":`true`})}):(0,Q.jsx)(z,{asChild:!0,variant:`ghost`,size:`icon-sm`,className:`size-7`,children:(0,Q.jsx)(L,{to:`/settings/global/projects`,"data-slot":`clone-root-settings`,"aria-label":`Edit checkout root`,title:`Edit checkout root`,children:(0,Q.jsx)(_,{className:`size-3.5`,"aria-hidden":`true`})})})]})]}),f.isPending?(0,Q.jsx)(`p`,{"data-slot":`clone-progress`,className:`truncate font-mono text-[11px] text-muted-foreground`,children:o??`Starting the clone…`}):null,f.isError?(0,Q.jsx)(`div`,{"data-slot":`clone-error`,className:`grid min-w-0 gap-1.5 text-[13px] text-danger`,children:g?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{children:`GitHub requires SAML authorization for this organization.`}),(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`a`,{"data-slot":`clone-sso-link`,className:`inline-flex min-h-11 items-center font-medium underline underline-offset-2`,href:g,target:`_blank`,rel:`noreferrer`,onClick:()=>{u.current=!0,l(!0)},children:`Authorize this GitHub organization`}),c?` — return here after authorizing, or choose Retry clone.`:` — return to this tab to retry, or choose Retry clone.`]}),(0,Q.jsxs)(`details`,{className:`min-w-0`,children:[(0,Q.jsx)(`summary`,{className:`min-h-11 content-center`,children:`Error details`}),(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap break-all`,children:f.error instanceof Error?f.error.message:null})]})]}):(0,Q.jsx)(`p`,{className:`min-w-0 whitespace-pre-wrap break-all`,children:f.error instanceof Error?f.error.message:`could not clone that repository`})}):null,(0,Q.jsxs)(go,{children:[(0,Q.jsx)(z,{variant:`outline`,disabled:f.isPending,onClick:()=>t(!1),children:`Cancel`}),(0,Q.jsx)(z,{"data-slot":`clone-confirm`,disabled:n.trim()===``||x===``||f.isPending,onClick:w,children:f.isPending?`Cloning…`:f.isError?`Retry clone`:`Clone`})]})]})})}var Qh=e=>e.available?`success`:`danger`,$h=e=>e.available?`Installed`:`Not installed`,eg=e=>e.available?null:e.hint??null,tg=`/settings/agents`,ng=`inline-flex items-center rounded-sm text-xs font-medium text-foreground hover:underline focus-visible:underline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring max-md:min-h-11 no-hover:min-h-11`;function rg(){let e=P(),t=V(),n=ft(e.data?.repo?.remote),[r,i]=(0,Z.useState)(null),[a,o]=(0,Z.useState)(!1),s=async()=>{if(!(!e.data||a)){o(!0);try{await navigator.clipboard.writeText(JSON.stringify({version:e.data.version,checks:e.data.checks},null,2)),F(`Diagnostics copied`)}catch{F(`Could not copy diagnostics. Please try again.`,{tone:`danger`})}finally{o(!1)}}};return(0,Q.jsxs)(`div`,{"data-route":`workspace-tools`,className:`w-full space-y-[22px] px-9 py-9 max-md:px-[18px] max-md:py-6`,children:[(0,Q.jsx)(`h1`,{className:`text-[28px] font-normal leading-[1.5] max-md:text-[24px]`,children:`Workspace tools`}),e.data?.capabilities.singleProject===!0?null:(0,Q.jsxs)(`section`,{className:`space-y-4 rounded-xl border border-border bg-card p-6 max-md:p-4`,"aria-labelledby":`add-project-heading`,children:[(0,Q.jsx)(`h2`,{id:`add-project-heading`,className:`text-lg font-normal leading-[1.5]`,children:`Add project`}),(0,Q.jsx)(`p`,{className:`text-[13px] leading-[1.5] text-muted-foreground`,children:`Open an existing local folder or clone a GitHub repository.`}),(0,Q.jsxs)(`dl`,{className:`space-y-4 text-[13px] leading-[1.5] text-muted-foreground`,children:[e.data?.repoRoot?(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-x-3`,children:[(0,Q.jsx)(`dt`,{children:`Local folder`}),(0,Q.jsx)(`dd`,{className:`min-w-0 break-all`,children:e.data.repo?.root??e.data.repoRoot})]}):null,n?(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-x-3`,children:[(0,Q.jsx)(`dt`,{children:`Repository`}),(0,Q.jsx)(`dd`,{className:`min-w-0 break-all`,children:n.replace(/^https:\/\//,``)})]}):null,t.data?.projectsDir?(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-x-3`,children:[(0,Q.jsx)(`dt`,{children:`Checkout folder`}),(0,Q.jsx)(`dd`,{className:`min-w-0 break-all`,children:t.data.projectsDir})]}):null]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,Q.jsx)(z,{variant:`outline`,className:`h-10 rounded-lg px-[15px] text-xs font-normal leading-[18px]`,onClick:()=>i(`local`),children:`Open local folder`}),(0,Q.jsx)(z,{variant:`outline`,className:`h-10 rounded-lg px-[15px] text-xs font-normal leading-[18px]`,onClick:()=>i(`clone`),children:`Clone from GitHub`})]})]}),(0,Q.jsxs)(`section`,{className:`space-y-4 rounded-xl border border-border bg-card p-6 max-md:p-4`,"aria-labelledby":`tools-heading`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsx)(`h2`,{id:`tools-heading`,className:`text-lg font-normal leading-[1.5]`,children:`Tools diagnostics`}),(0,Q.jsx)(X,{to:tg,"data-slot":`tools-settings`,className:ng,children:`Tool settings ›`})]}),(0,Q.jsx)(`p`,{className:`text-[13px] leading-[1.5] text-muted-foreground`,children:`Check the tools available to this local workspace.`}),e.isError?(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:`Could not refresh tool diagnostics. Recheck to retry.`}):null,!e.data&&!e.isError?(0,Q.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`Checking installed tools…`}):null,e.data?(0,Q.jsx)(`dl`,{className:`space-y-4 text-[13px] leading-[1.5] text-muted-foreground`,children:e.data.checks.map(e=>{let t=eg(e);return(0,Q.jsxs)(`div`,{"data-slot":`tool-row`,"data-tool":e.name,"data-available":e.available,className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,Q.jsxs)(`dt`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(q,{tone:Qh(e)}),(0,Q.jsx)(`span`,{className:`font-mono text-[13px] font-medium text-foreground`,children:e.name})]}),(0,Q.jsxs)(`dd`,{className:`flex min-w-0 flex-1 items-center gap-x-3 text-muted-foreground`,children:[(0,Q.jsxs)(`span`,{className:`min-w-0 break-words`,children:[$h(e),e.version?` · ${e.version}`:``]}),e.available?null:(0,Q.jsx)(X,{to:tg,"data-slot":`tool-setup`,className:`${ng} ml-auto`,children:`Set up ›`})]}),t?(0,Q.jsx)(`dd`,{"data-slot":`tool-hint`,className:`basis-full min-w-0 break-words pl-[15px] text-xs leading-snug text-muted-foreground`,children:t}):null]},e.name)})}):null,e.data?.checks.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No tool diagnostics reported by this server.`}):null,(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,Q.jsx)(z,{variant:`outline`,className:`h-10 rounded-lg px-[15px] text-xs font-normal leading-[18px]`,disabled:e.isFetching,onClick:()=>void e.refetch(),children:e.isFetching?`Checking tools…`:`Recheck tools`}),(0,Q.jsx)(z,{variant:`outline`,className:`h-10 rounded-lg px-[15px] text-xs font-normal leading-[18px]`,disabled:!e.data||a,onClick:()=>void s(),children:a?`Copying…`:`Copy diagnostics`})]})]}),r===`local`?(0,Q.jsx)(sp,{open:!0,onOpenChange:e=>{e||i(null)}}):null,r===`clone`?(0,Q.jsx)(Zh,{open:!0,onOpenChange:e=>{e||i(null)}}):null]})}var ig=(0,Z.lazy)(()=>Kr(()=>import(`./task-thread-DtkFL3EC.js`).then(e=>({default:e.TaskThreadRoute})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34]))),ag=(0,Z.lazy)(()=>Kr(()=>import(`./compare-variants-5FmqpFSN.js`).then(e=>({default:e.CompareVariantsRoute})),__vite__mapDeps([35,1,2,3,4,5,13,6,26,16,18,19,20,21,23,32,33]))),og=(0,Z.lazy)(()=>Kr(()=>import(`./task-changes-BW8YdWG8.js`).then(e=>({default:e.TaskChangesRoute})),__vite__mapDeps([36,1,2,3,4,5,7,6,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,37,38,29,39,40,31]))),sg=(0,Z.lazy)(()=>Kr(()=>import(`./task-files-pPL6_3Cr.js`).then(e=>({default:e.TaskFilesRoute})),__vite__mapDeps([41,1,2,3,4,5,6,11,7,8,9,10,12,13,14,15,16,17,18,19,20,21,22,23,24]))),cg=(0,Z.lazy)(()=>Kr(()=>import(`./task-commits-q2kB2y6L.js`).then(e=>({default:e.TaskCommitsRoute})),__vite__mapDeps([42,1,2,3,4,5,7,6,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,38,26,30,39,40,31]))),lg=(0,Z.lazy)(()=>Kr(()=>import(`./task-github-item-BXF5R52U.js`).then(e=>({default:e.TaskGithubItemRoute})),__vite__mapDeps([43,2,1,3,4,5,11,6,7,8,9,10,12,13,14,15,16,17,18,19,20,21,22,23,24,26,44,45,39,40,31]))),ug=(0,Z.lazy)(()=>Kr(()=>import(`./repo-git-CtdkZFey.js`).then(e=>({default:e.RepoGitRoute})),__vite__mapDeps([46,1,2,3,4,5,6,8,9,10,47,38,37,22,12,13,26,39,40,31,48]))),dg=(0,Z.lazy)(()=>Kr(()=>import(`./github-DeZMeMwJ.js`).then(e=>({default:e.GithubRoute})),__vite__mapDeps([49,1,2,3,4,5,45,6,47,9,10,25,17,13,14,28,29,44,18,19,20,21,39,22,40,31,50]))),fg=(0,Z.lazy)(()=>Kr(()=>import(`./workflows-TmcPEj2K.js`).then(e=>({default:e.WorkflowsRoute})),__vite__mapDeps([51,1,2,3,4,5,10,17,28,52]))),pg=(0,Z.lazy)(()=>Kr(()=>import(`./skills-C8YKp2vr.js`).then(e=>({default:e.SkillsRoute})),__vite__mapDeps([53,1,2,3,4,5,25,6,10,17,13,28,52])));function mg(){let e=a();return(0,Q.jsx)(Pa,{to:{pathname:`/skills`,search:e.search,hash:e.hash},replace:!0})}function hg({sectionId:e}){let t=a();return(0,Q.jsx)(A,{to:{pathname:cm(`global`,e),search:t.search,hash:t.hash},replace:!0})}function gg(){return(0,Q.jsx)(`div`,{"data-route":`scope-resolving`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(`p`,{className:`px-4 py-6 text-center text-xs text-soft-foreground`,children:`Loading…`})})}function _g(){let{projectId:e=``}=sr(),t=a(),n=V(),r=P();if(e==="default"){let e=n.data?.bootProject??(n.isError?r.data?.bootProject:void 0);if(e!==void 0){let n=t.pathname.replace(/^\/p\/default(?=\/|$)/,``);return(0,Q.jsx)(A,{to:`/p/${encodeURIComponent(e)}${n||`/`}${t.search}${t.hash}`,replace:!0})}if(!n.isError)return(0,Q.jsx)(gg,{})}if(n.data){if(!(n.data.bootProject===e||n.data.projects.some(t=>t.id===e)))return(0,Q.jsx)(ld,{projectId:e,registry:n.data})}else if(!n.isError)return(0,Q.jsx)(gg,{});return(0,Q.jsx)(Dt,{projectId:n.data?.bootProject===e?null:e,children:(0,Q.jsx)(_e,{},e)})}function vg(){let{projectId:e=``}=sr();return(0,Q.jsx)(Yu,{},e)}function yg(){let e=a(),t=P(),n=V(),r=t.data?.bootProject??n.data?.bootProject,i=(t.data!==void 0||t.isError)&&(n.data!==void 0||n.isError);if(r===void 0&&!i)return(0,Q.jsx)(gg,{});let o=r??`default`;if(e.pathname===`/`&&e.search===``&&e.hash===``){if(n.data===void 0&&!n.isError)return(0,Q.jsx)(gg,{});let e=Oc(Sc(),n.data,r);if(e!==null)return(0,Q.jsx)(A,{to:e,replace:!0})}let s=e.pathname===`/p`||e.pathname===`/p/`?`/`:e.pathname;return(0,Q.jsx)(A,{to:`/p/${encodeURIComponent(o)}${s}${e.search}${e.hash}`,replace:!0})}var bg=[{pattern:`/`,pageLabel:`Tasks`},{pattern:`/tasks`,pageLabel:`All tasks`},{pattern:`/tools`,pageLabel:`Workspace tools`},{pattern:`/new`,pageLabel:`New task`},{pattern:`/compare/:groupId`,pageLabel:`Compare`},{pattern:`/git/*`,pageLabel:`Git`},{pattern:`/github/*`,pageLabel:`GitHub`},{pattern:`/automations/*`,pageLabel:`Automations`},{pattern:`/skills`,pageLabel:`Skills`},{pattern:`/inbox`,pageLabel:`Inbox`},{pattern:`/workflows/*`,pageLabel:`Workflows`},{pattern:`/settings/*`,pageLabel:`Settings`}];function xg(e){let t=Fa(e),n=mt({path:`/tasks/:id/*`,end:!0},t);return n?{pageLabel:null,taskId:n.params.id??null}:{pageLabel:bg.find(({pattern:e})=>mt({path:e,end:!0},t))?.pageLabel??null,taskId:null}}function Sg(e){return(0,Q.jsxs)(B,{path:`/p/:projectId`,element:(0,Q.jsx)(_g,{}),children:[(0,Q.jsx)(B,{index:!0,element:(0,Q.jsx)(Ym,{})}),(0,Q.jsx)(B,{path:`new`,element:(0,Q.jsx)(vg,{})}),(0,Q.jsx)(B,{path:`tasks/:id`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Mo,{}),children:(0,Q.jsx)(ig,{})})}),(0,Q.jsx)(B,{path:`tasks/:id/changes`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(dd,{tab:`changes`}),children:(0,Q.jsx)(og,{})})}),(0,Q.jsx)(B,{path:`tasks/:id/files`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(dd,{tab:`files`}),children:(0,Q.jsx)(sg,{})})}),(0,Q.jsx)(B,{path:`tasks/:id/commits`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(dd,{tab:`changes`}),children:(0,Q.jsx)(cg,{})})}),(0,Q.jsx)(B,{path:`tasks/:id/commits/:sha`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(dd,{tab:`changes`}),children:(0,Q.jsx)(cg,{})})}),(0,Q.jsx)(B,{path:`tasks/:id/issue/:n`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(md,{kind:`issue`}),children:(0,Q.jsx)(lg,{kind:`issue`})})}),(0,Q.jsx)(B,{path:`tasks/:id/pr/:n`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(md,{kind:`pr`}),children:(0,Q.jsx)(lg,{kind:`pr`})})}),(0,Q.jsx)(B,{path:`compare/:groupId`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Fc,{}),children:(0,Q.jsx)(ag,{})})}),(0,Q.jsx)(B,{path:`git`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(sd,{}),children:(0,Q.jsx)(ug,{section:`main`,index:!0})})}),(0,Q.jsx)(B,{path:`git/commits`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(sd,{}),children:(0,Q.jsx)(ug,{section:`main`})})}),(0,Q.jsx)(B,{path:`git/commits/:sha`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(sd,{}),children:(0,Q.jsx)(ug,{section:`main`})})}),(0,Q.jsx)(B,{path:`git/not-landed`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(sd,{}),children:(0,Q.jsx)(ug,{section:`not-landed`})})}),(0,Q.jsx)(B,{path:`git/cleanup`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(sd,{}),children:(0,Q.jsx)(ug,{section:`cleanup`})})}),(0,Q.jsx)(B,{path:`git/branches`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(sd,{}),children:(0,Q.jsx)(ug,{section:`branches`})})}),(0,Q.jsx)(B,{path:`git/changes`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(sd,{}),children:(0,Q.jsx)(ug,{section:`changes`})})}),(0,Q.jsx)(B,{path:`github`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Ic,{}),children:(0,Q.jsx)(dg,{view:`issues`,index:!0})})}),(0,Q.jsx)(B,{path:`github/prs`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Ic,{}),children:(0,Q.jsx)(dg,{view:`prs`})})}),(0,Q.jsx)(B,{path:`github/issues/:n`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Ic,{}),children:(0,Q.jsx)(dg,{view:`issues`})})}),(0,Q.jsx)(B,{path:`github/prs/:n`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Ic,{}),children:(0,Q.jsx)(dg,{view:`prs`})})}),(0,Q.jsx)(B,{path:`github/prs/:n/changes`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Ic,{}),children:(0,Q.jsx)(dg,{view:`prs`,changes:!0})})}),(0,Q.jsx)(B,{path:`automations`,element:(0,Q.jsx)(Wh,{})}),(0,Q.jsx)(B,{path:`automations/new`,element:(0,Q.jsx)(Wh,{mode:`new`})}),(0,Q.jsx)(B,{path:`automations/:automationId`,element:(0,Q.jsx)(Wh,{mode:`edit`})}),(0,Q.jsx)(B,{path:`automations/:automationId/log`,element:(0,Q.jsx)(Wh,{mode:`log`})}),(0,Q.jsx)(B,{path:`skills`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(cd,{}),children:(0,Q.jsx)(pg,{})})}),(0,Q.jsx)(B,{path:`inbox`,element:(0,Q.jsx)(vu,{})}),(0,Q.jsx)(B,{path:`workflows`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(ud,{}),children:(0,Q.jsx)(fg,{})})}),(0,Q.jsx)(B,{path:`workflows/:name`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(ud,{}),children:(0,Q.jsx)(fg,{})})}),(0,Q.jsx)(B,{path:`settings`,element:(0,Q.jsx)(mm,{capabilities:e})}),(0,Q.jsx)(B,{path:`settings/skills`,element:(0,Q.jsx)(mg,{})}),zp(`project`,e).map(t=>(0,Q.jsx)(B,{path:`settings/${t.id}`,element:(0,Q.jsx)(pm,{section:t,scope:`project`,capabilities:e})},t.id)),zp(`global`,e).map(e=>(0,Q.jsx)(B,{path:`settings/${e.id}`,element:(0,Q.jsx)(hg,{sectionId:e.id})},e.id)),(0,Q.jsx)(B,{path:`*`,element:(0,Q.jsx)(ad,{})})]})}function Cg(e,t){let n=Ct(vt(Sg(t)),e),r=n?.at(-1);return!n||!r||r.route.path===`*`?null:{pattern:`/${n.slice(1).map(e=>e.route.path).filter(e=>e!==void 0).join(`/`)}`.replace(/\/$/,``)||`/`,params:r.params}}function wg(){let e=P().data?.capabilities;return(0,Q.jsxs)(he,{children:[Sg(e),(0,Q.jsx)(B,{path:`/tasks`,element:(0,Q.jsx)(jh,{})}),(0,Q.jsx)(B,{path:`/tools`,element:(0,Q.jsx)(rg,{})}),(0,Q.jsx)(B,{path:`/settings/global`,element:(0,Q.jsx)(A,{to:lm,replace:!0})}),zp(`global`,e).map(t=>(0,Q.jsx)(B,{path:cm(`global`,t.id),element:(0,Q.jsx)(pm,{section:t,scope:`global`,capabilities:e})},t.id)),(0,Q.jsx)(B,{path:`*`,element:(0,Q.jsx)(yg,{})})]})}var Tg=2500,Eg=e=>String(Ha(e,`/`));function Dg(e,t,n){let r={href:Eg(e),verify:!1},i=Pc(e,t,n.registry);if(i===null)return r;try{let e=Cg(i.replace(/[?#].*$/,``),n.capabilities);return e===null?r:{href:i,verify:Object.keys(e.params).some(e=>e!==`projectId`)}}catch{return r}}async function Og(e,t,n,r,i){let a={projectId:e,signal:r},s=``;try{let c=Cg(t,n);if(c===null)return!1;let{params:l}=c;if(s=c.pattern,s.startsWith(`/tasks/:id`)){let t=await o(e,l.id??``,{signal:r});if(s===`/tasks/:id/commits/:sha`)await ir(l.id??``,l.sha??``,a);else if(s===`/tasks/:id/issue/:n`||s===`/tasks/:id/pr/:n`){let e=Number(l.n);if(!Number.isSafeInteger(e)||e<1)return!1;let n=s.endsWith(`/issue/:n`)?`issue`:`pr`;if(!gt(t,i).some(t=>t.kind===n&&t.number===e))return i===void 0&&null;let r=await M(s.endsWith(`/issue/:n`)?`issue`:`pr`,e,{},a);return r.available?r.item!==null:null}}else if(s===`/compare/:groupId`)await wt(l.groupId??``,a);else if(s===`/git/commits/:sha`)await Zt(l.sha??``,a);else if(s===`/github/issues/:n`||s.startsWith(`/github/prs/:n`)){let e=Number(l.n);if(!Number.isSafeInteger(e)||e<1)return!1;let t=await M(s.startsWith(`/github/issues`)?`issue`:`pr`,e,{},a);return t.available?t.item!==null:null}else if(s===`/workflows/:name`){let{workflows:e,issues:t}=await Nt(a);return e.some(e=>e.name===l.name)?!0:t.length>0&&null}else if(s.startsWith(`/automations/:automationId`)){let e=await re(a);return e.available?e.automations.some(e=>e.id===l.automationId):null}else return null;return!0}catch(e){return!Ag(e,s)&&null}}var kg=/unknown revision|bad object|bad revision|unknown commit|not a commit hash|needed a single revision/i;function Ag(e,t){return e instanceof Or?e.status===404||(t===`/git/commits/:sha`||t===`/tasks/:id/commits/:sha`)&&e.status===409&&kg.test(e.message):!1}async function jg(e,t,n){let r=Dg(e,t,n);if(!r.verify)return r.href;let i=new AbortController,a=setTimeout(()=>i.abort(),Tg);try{return await Og(e,r.href.replace(/[?#].*$/,``),n.capabilities,i.signal,n.repoBaseOf?.(e))===!1?Eg(e):r.href}finally{clearTimeout(a)}}var Mg={key:``,navigate:null,ticket:0};function Ng(e,t){e!==Mg.key&&Mg.ticket++,Mg.key=e,Mg.navigate=t}function Pg(){Mg.ticket++}async function Fg(e,t,n){let r=++Mg.ticket,i=Mg.key,a=await jg(e,t,n);r===Mg.ticket&&i===Mg.key&&Mg.navigate?.(a)}function Ig(){let e=en(),t=a();Z.useLayoutEffect(()=>{Ng(`${t.key}|${t.pathname}${t.search}${t.hash}`,e)},[e,t.key,t.pathname,t.search,t.hash])}function Lg(){let e=V().data,t=P().data,n=t?.capabilities,r=Z.useCallback(n=>e?.projects.find(e=>e.id===n)?.repoUrl??(n===(t?.bootProject??e?.bootProject)?ft(t?.repo?.remote):void 0),[e,t]);Ig();let{pathname:i,search:o,hash:s}=a(),c=Va(i),l=`${i}${o}${s}`;return{target:Z.useCallback(t=>t===c?{href:l,verify:!1}:Dg(t,Mc(t),{registry:e,capabilities:n}),[e,n,c,l]),go:Z.useCallback(async t=>{if(t===c)return Pg();await Fg(t,Mc(t),{registry:e,capabilities:n,repoBaseOf:r})},[e,n,r,c])}}var Rg=[{to:`/`,label:`Tasks`,icon:T,match:[`/`,`/tasks`,`/compare`],badge:`tasks-unread`},{to:`/inbox`,label:`Inbox`,icon:xr,match:[`/inbox`],badge:`inbox-count`,inbox:!0},{to:`/git`,label:`Git`,icon:cn,match:[`/git`]},{to:`/github`,label:`GitHub`,icon:Je,match:[`/github`],forge:!0},{to:`/automations`,label:`Automations`,icon:Mn,match:[`/automations`],forge:!0,automations:!0},{to:`/skills`,label:`Skills`,icon:rt,match:[`/skills`],badge:`skills-update`},{to:`/workflows`,label:`Workflows`,icon:l,match:[`/workflows`]},{to:`/settings`,label:`Settings`,icon:_,match:[`/settings`]}];function zg({forge:e=!1,inbox:t=!1,automations:n=!1}={}){return Rg.filter(r=>(!r.forge||e)&&(!r.inbox||t)&&(!r.automations||n))}function Bg(e,t){return t===`/`?e===`/`:e===t||e.startsWith(t+`/`)}function Vg(e){let t=null;for(let n of Rg)for(let r of n.match)Bg(e,r)&&(t===null||r.length>t.length)&&(t={to:n.to,length:r.length});return t?.to??null}function Hg(e){let t=Vg(e);return Rg.find(e=>e.to===t)??null}function Ug(e){return/^\/(?:tasks|compare)\/[^/]+(?:\/|$)/.test(Fa(e))}function Wg(e,t){let n=Fa(e);return/^\/git\/?$/.test(n)?new URLSearchParams(t).get(`view`)===`repo`:/^\/git\//.test(n)}var Gg=[`/`,`/git`,`/github`],Kg=[`/skills`,`/workflows`,`/settings`,`/inbox`,`/automations`],qg={light:`dark`,dark:`system`,system:`light`},Jg={light:`light`,dark:`dark`,system:`system`};function Yg({className:e,showLabel:t=!1,labelClassName:n}){let{theme:r,setTheme:i}=Hf(),a=qg[r],o=N;return(0,Q.jsxs)(z,{type:`button`,variant:`ghost`,size:`icon-sm`,className:e,"data-slot":`theme-toggle`,"data-theme-pref":r,title:`Theme: ${Jg[r]}`,"aria-label":`Theme: ${Jg[r]}. Switch to ${Jg[a]}.`,onClick:()=>i(a),children:[(0,Q.jsx)(o,{"aria-hidden":`true`}),t?(0,Q.jsxs)(`span`,{className:n,children:[`Theme · `,r.charAt(0).toUpperCase()+r.slice(1)]}):null]})}var Xg=`cezar:open-command-palette`;function Zg(){window.dispatchEvent(new Event(Xg))}function Qg(e){return[...e].sort((e,t)=>Date.parse(t.createdAt)-Date.parse(e.createdAt))}function $g(e,t,n){let r=t.trim().toLowerCase();if(r===``)return 1;let i=(n?.length?`${e} ${n.join(` `)}`:e).toLowerCase(),a=r.split(/\s+/),o=0;for(let e of a){let t=i.indexOf(e);if(t===-1)return 0;let n=t===0||!/[a-z0-9]/.test(i[t-1]??``);o+=(n?1:.5)/(1+t/48)}return o/a.length}function e_(e,t,n){let r=Qg(e.filter(e=>!Pt(e))).map(e=>({projectId:t,id:e.id,title:e.title,titleSummary:e.titleSummary,titleOrigin:e.titleOrigin,status:e.status,activity:e.activity,createdAt:e.createdAt,finishedAt:e.finishedAt,seenAt:e.seenAt,archived:e.archived,autoResumeAt:e.autoResumeAt,...e.hasPendingHumanAsk===void 0?{}:{hasPendingHumanAsk:e.hasPendingHumanAsk},...e.delegation?{delegation:Ir.parse(e.delegation)}:{},workflow:e.workflow,branch:e.branch,startedAt:e.startedAt})),i=new Set(r.map(t_)),a=(n??[]).filter(e=>!Pt(e)&&!i.has(t_(e))).sort((e,t)=>t.createdAt.localeCompare(e.createdAt));return[...r,...a]}var t_=e=>`${e.projectId??``}/${e.id}`;function n_(e){let t=e.filter(e=>ii(e)).sort((e,t)=>(t.finishedAt??``).localeCompare(e.finishedAt??``)),n=new Set(t.map(t_));return{recentlyFinished:t,otherTasks:e.filter(e=>!n.has(t_(e)))}}function r_(e,t){return[...e].sort((e,n)=>Number(e.id===t)-Number(n.id===t)||n.lastOpenedAt.localeCompare(e.lastOpenedAt))}function i_(){let[e,t]=Z.useState(!1),n=Ua();Po(`k`,()=>t(e=>!e));let r=Z.useCallback(()=>{t(!1),n(`/new`)},[n]);return Po(`n`,r),Ro(`c`,r),Z.useEffect(()=>{let e=()=>t(!0);return window.addEventListener(Xg,e),()=>window.removeEventListener(Xg,e)},[]),(0,Q.jsx)(Ca,{open:e,onOpenChange:t,title:`Command palette`,description:`Search projects, tasks, views, actions, and skills`,showCloseButton:!1,filter:$g,className:`top-[10vh] translate-y-0 sm:max-w-2xl lg:max-w-3xl xl:max-w-4xl`,children:(0,Q.jsx)(o_,{close:()=>t(!1)})})}function a_({task:e,projectName:t,showProject:n,now:r,onSelect:i}){let a=C(e),o=wn(e);return(0,Q.jsxs)(Y,{value:`task ${o} ${e.id}`,keywords:t?[t]:void 0,"data-slot":`palette-task`,"data-run-id":e.id,"data-project-id":e.projectId??void 0,onSelect:()=>i(e),children:[(0,Q.jsx)(q,{tone:a.tone,shape:a.shape,pulse:a.pulse,"aria-label":a.label,role:`img`}),e.delegation?.role===`worker`?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:`Worker`}):null,(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:o}),n&&t?(0,Q.jsx)(`span`,{"data-slot":`palette-task-project`,className:`shrink-0 truncate text-xs text-soft-foreground`,children:t}):null,(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-soft-foreground tabular-nums`,children:Ba(e.finishedAt??e.createdAt,r)})]})}function o_({close:e}){let t=Ua(),n=en(),[r,i]=Z.useState(``),a=r.trim()!==``,o=za(),{theme:s,setTheme:c}=Hf(),l=Ar(),u=b(),d=V(),f=w(),p=P(),m=Date.now(),h=d.data,g=h!==void 0&&h.projects.length>1,_=Ht(g),v=Z.useMemo(()=>g?r_(h.projects,o):[],[g,h,o]),y=Z.useMemo(()=>new Map((h?.projects??[]).map(e=>[e.id,e.name])),[h]),x=o??h?.bootProject??null,S=Z.useMemo(()=>e_(l.data??[],x,_.data?.runs),[l.data,x,_.data]),C=Z.useMemo(()=>n_(S),[S]),T=a?[]:C.recentlyFinished,E=a?S:C.otherTasks,ee=g,D=e=>e.projectId===null?null:y.get(e.projectId)??null,k=f.data?.skillUsage,te=Z.useMemo(()=>ko(u.data??[],k),[u.data,k]),ne=n=>{e(),t(n)},A=t=>{e(),n(t)},re=Lg(),ie=t=>{e(),re.go(t)},ae=n=>{e(),t(n.projectId===null?`/tasks/${n.id}`:Ha(n.projectId,`/tasks/${n.id}`))},oe=qg[s];return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(_a,{placeholder:`Search projects, tasks, views, actions, skills…`,value:r,onValueChange:i}),(0,Q.jsxs)(wa,{className:`max-h-[55vh] min-h-[14rem] sm:max-h-[60vh] lg:max-h-[68vh]`,children:[(0,Q.jsx)(ka,{children:`Nothing matches.`}),(0,Q.jsx)(J,{children:(0,Q.jsxs)(Y,{value:`new task`,"data-slot":`palette-view`,"data-nav-to":`/new`,onSelect:()=>ne(`/new`),children:[(0,Q.jsx)(pe,{"aria-hidden":`true`}),`New task`,(0,Q.jsx)(va,{children:`C`})]})}),!a&&T.length>0?(0,Q.jsx)(J,{heading:`Recently finished`,children:T.map(e=>(0,Q.jsx)(a_,{task:e,projectName:D(e),showProject:ee,now:m,onSelect:ae},t_(e)))}):null,(0,Q.jsxs)(J,{heading:`Views`,children:[g?(0,Q.jsxs)(Y,{value:`view All tasks`,"data-slot":`palette-view`,"data-nav-to":`/tasks`,onSelect:()=>A(`/tasks`),children:[(0,Q.jsx)(O,{"aria-hidden":`true`}),`All tasks`]}):null,zg({forge:p.data?.forge?.available===!0,inbox:p.data?.capabilities.followups===!0,automations:p.data?.capabilities.automations===!0}).map(e=>{let t=e.icon;return(0,Q.jsxs)(Y,{value:`view ${e.label}`,"data-slot":`palette-view`,"data-nav-to":e.to,onSelect:()=>ne(e.to),children:[(0,Q.jsx)(t,{"aria-hidden":`true`}),e.label]},e.to)})]}),v.length>0?(0,Q.jsx)(J,{heading:`Projects`,children:v.map(e=>{let t=e.id===o,n=e.status===`missing`;return(0,Q.jsxs)(Y,{value:`project ${e.name} ${e.id}`,keywords:[e.root],"data-slot":`palette-project`,"data-project-id":e.id,disabled:n,onSelect:()=>ie(e.id),children:[(0,Q.jsx)(rn,{"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),n?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-soft-foreground`,children:`folder not found`}):e.branch===void 0?null:(0,Q.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-soft-foreground`,children:e.branch}),t?(0,Q.jsx)(_t,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e.id)})}):null,E.length>0?(0,Q.jsx)(J,{heading:`Tasks`,children:E.map(e=>(0,Q.jsx)(a_,{task:e,projectName:D(e),showProject:ee,now:m,onSelect:ae},t_(e)))}):null,(0,Q.jsx)(J,{heading:`Actions`,children:(0,Q.jsxs)(Y,{value:`action toggle theme`,"data-slot":`palette-action`,"data-action":`toggle-theme`,onSelect:()=>{c(oe),e()},children:[(0,Q.jsx)(N,{"aria-hidden":`true`}),`Toggle theme`,(0,Q.jsxs)(va,{className:`tracking-normal`,children:[s,` → `,oe]})]})}),te.length>0?(0,Q.jsx)(J,{heading:`Skills`,children:te.map(e=>(0,Q.jsxs)(Y,{value:`skill ${e.name} ${e.path}`,keywords:e.description?[e.description]:void 0,"data-slot":`palette-skill`,"data-skill":e.name,onSelect:()=>ne(`/new?skill=${encodeURIComponent(e.name)}`),children:[(0,Q.jsx)(`span`,{className:`shrink-0 font-medium`,children:e.name}),e.description?(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null]},e.path))}):null]})]})}function s_({triggerClassName:e,icon:t=Kn,iconClassName:n=`size-4`,side:r,origin:i,label:a,iconFrameClassName:o}={}){let[s,c]=Z.useState(!1),[l,u]=Z.useState(!1);return(0,Q.jsxs)(uo,{children:[(0,Q.jsx)(so,{asChild:!0,children:(0,Q.jsxs)(z,{variant:`ghost`,"aria-label":`Add project`,title:`Add project`,"data-origin":i,className:G(`size-9 p-0 text-muted-foreground`,e),children:[o?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:o,children:(0,Q.jsx)(t,{className:n,"aria-hidden":`true`})}):(0,Q.jsx)(t,{className:n,"aria-hidden":`true`}),a?(0,Q.jsx)(`span`,{children:a}):(0,Q.jsx)(`span`,{className:`sr-only`,children:`Add project`})]})}),(0,Q.jsxs)(co,{align:`start`,side:r,className:`w-56`,children:[(0,Q.jsx)(Xa,{className:`text-xs text-soft-foreground`,children:`Add project`}),(0,Q.jsxs)(ro,{"data-slot":`add-project-local`,onSelect:()=>c(!0),children:[(0,Q.jsx)(Xt,{"aria-hidden":`true`}),`Open local folder…`]}),(0,Q.jsxs)(ro,{"data-slot":`add-project-clone`,onSelect:()=>u(!0),children:[(0,Q.jsx)(Je,{"aria-hidden":`true`}),`Clone from GitHub…`]})]}),s?(0,Q.jsx)(sp,{open:!0,onOpenChange:c}):null,l?(0,Q.jsx)(Zh,{open:!0,onOpenChange:u}):null]})}function c_(e,t){let n=e=>e.split(`.`).slice(0,3).map(e=>Number.parseInt(e,10)||0),r=n(e),i=n(t);for(let e=0;e<3;e++){let t=(r[e]??0)-(i[e]??0);if(t!==0)return t>0}return!1}function l_({version:e,latestVersion:t,state:n,onApplyUpdate:r,onRestart:i,error:a,busy:o=!1,offline:s=!1}){let[c,l]=Z.useState(!1),u=Z.useRef(null),d=Z.useRef(!1),f=n?.status===`ready`,p=n?.status===`preparing`,m=n?.status===`restarting`,h=!!(e&&t&&c_(t,e)),g=n?.supported&&f&&!!i,_=n?.supported&&h&&!!r,v=n?.supported?f||m?`restart`:p||_?`update`:null:null,y=o||p||m,b=v===`restart`?`Restart required`:p?`Preparing update`:`Update from v${e} to v${t}`;return v?(0,Q.jsxs)(rr,{open:c,onOpenChange:l,children:[(0,Q.jsx)(`div`,{"data-slot":`application-update-action`,className:`flex size-11 shrink-0 items-center justify-center`,children:v?(0,Q.jsx)(gm,{children:(0,Q.jsxs)(_m,{children:[(0,Q.jsx)(vm,{asChild:!0,children:v===`update`?(0,Q.jsx)(z,{variant:`ghost`,size:`icon`,className:`size-11 motion-safe:transition-transform motion-safe:duration-[var(--app-duration-1)] motion-safe:active:scale-[0.97]`,"aria-label":p?`Preparing update`:`Update application`,"aria-busy":y,disabled:!_||y||s,title:b,onClick:()=>{!_||y||s||d.current||(d.current=!0,r?.().finally(()=>{d.current=!1}))},children:(0,Q.jsx)(Vn,{"aria-hidden":`true`,className:`size-[18px]`})}):(0,Q.jsx)(z,{ref:u,variant:`ghost`,size:`icon`,className:`size-11 motion-safe:transition-transform motion-safe:duration-[var(--app-duration-1)] motion-safe:active:scale-[0.97]`,"aria-label":m?`Reconnecting after restart`:`Restart application`,"aria-busy":y,disabled:!g||y||s,title:b,onClick:()=>l(!0),children:(0,Q.jsx)(Ce,{"aria-hidden":`true`,className:`size-[18px]`})})}),(0,Q.jsx)(ym,{side:`bottom`,children:b})]})}):null}),(0,Q.jsxs)(pn,{onCloseAutoFocus:e=>{e.preventDefault(),u.current?.focus()},children:[(0,Q.jsxs)($n,{children:[(0,Q.jsx)(Ut,{children:`Restart Cezarion?`}),(0,Q.jsx)(Mt,{children:`Running tasks will be recovered after restart. The cockpit will reconnect when the new version is ready.`})]}),(0,Q.jsxs)(In,{children:[(0,Q.jsx)(Xn,{children:`Restart Later`}),(0,Q.jsx)(An,{onClick:()=>{!g||y||s||d.current||(d.current=!0,l(!1),i?.().finally(()=>{d.current=!1}))},children:`Restart Now`})]})]})]}):null}function u_({version:e,latestVersion:t,state:n,error:r,offline:i=!1,busy:a=!1}){let o=r??(n?.status===`error`?n.message??`Update failed.`:null),s=n&&!n.supported&&e&&t&&c_(t,e),c=n?.message&&n.message!==`Update this installation manually.`?n.message:`Install the newer release using your original installation method, then restart Cezarion.`,l=o?null:i?`Connection lost. Reconnect to continue.`:n?.status===`preparing`||a&&n?.status!==`ready`?`Preparing update.`:n?.status===`restarting`?`Restarting. Reconnecting to the cockpit.`:a&&n?.status===`ready`?`Checking update status.`:s?`In-app updates are unavailable for this installation. ${c}`:null;return!o&&!l?null:(0,Q.jsx)(`div`,{"data-slot":`application-update-feedback`,className:`px-4 pb-2 text-[11px] leading-4 text-muted-foreground`,children:o?(0,Q.jsxs)(`p`,{role:`status`,children:[(0,Q.jsx)(`span`,{className:`block truncate`,title:o,children:o}),(0,Q.jsx)(`span`,{className:`block`,children:`Retry or update manually.`})]}):l?(0,Q.jsx)(`p`,{role:`status`,title:l,children:l}):null})}var d_={amber:`text-signal-word-amber`,red:`text-signal-word-red`,violet:`text-status-running`,green:`text-success`};function f_({signal:e,known:t,truncated:n,current:r,maxParts:i,slot:a,className:o}){let s=Wp(e).slice(0,i);return(0,Q.jsxs)(`span`,{"data-slot":a,className:G(`flex min-w-0 items-center font-medium`,r?`text-muted-foreground`:`text-soft-foreground`,o),children:[t?s.length===0?`idle`:s.map((e,t)=>(0,Q.jsxs)(`span`,{className:`flex items-center gap-x-[inherit]`,children:[t>0?(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:`·`}):null,(0,Q.jsx)(`span`,{"data-tone":e.tone,className:d_[e.tone],children:e.text})]},e.tone)):`activity unknown`,t&&n?(0,Q.jsx)(`span`,{children:`· recent runs only`}):null]})}var p_={amber:`bg-pending text-signal-ink-amber`,red:`bg-danger text-signal-ink`,violet:`bg-status-running text-signal-ink`,green:`bg-success text-signal-ink`};function m_(e,t,n){return e>9&&!(n&&t>1)?22:t===1?18:14}function h_({position:e,segments:t,className:n,compact:r=!1}){let i=t.filter(e=>e.count>0);return i.length===0?null:(0,Q.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`rail-pill-${e}`,className:G(`pointer-events-none absolute -right-[4px] box-border flex h-[17px] overflow-hidden rounded-[9px] border-2 border-background`,e===`top`?`-top-[6px]`:`top-[25px]`,n),children:i.map(({tone:e,count:t})=>(0,Q.jsx)(`span`,{"data-segment":e,"data-count":t,style:{width:m_(t,i.length,r)},className:G(`flex items-center justify-center text-[10px] leading-[13px] font-bold tabular-nums`,p_[e]),children:t>9?`9+`:t},e))})}function g_(e){return{top:[{tone:`amber`,count:e?.needsYou??0},{tone:`red`,count:e?.failedUnread??0}],bottom:[{tone:`violet`,count:e?.inMotion??0},{tone:`green`,count:e?.finishedUnread??0}]}}function __(e,t){if(!e?.signals)return null;let n=e.signals;return Gp(e.projects.filter(e=>e.id!==t).map(e=>n.get(e.id)))}function v_(e){let t=Wp(e??void 0).map(e=>e.text);return t.length>0?`Open projects. Elsewhere: ${t.join(`, `)}`:`Open projects`}function y_({elsewhere:e}){if(!e)return null;let{top:t,bottom:n}=g_(e),r=`right-[2px] border-card`;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(h_,{position:`top`,segments:t,compact:!0,className:G(r,`top-[3px]`)}),(0,Q.jsx)(h_,{position:`bottom`,segments:n,compact:!0,className:G(r,`top-[24px]`)})]})}function b_({version:e}){let{resolvedTheme:t}=Hf();return(0,Q.jsxs)(`div`,{"data-slot":`drawer-identity`,className:`flex shrink-0 items-center gap-[12px] border-b border-border pt-[env(safe-area-inset-top)] pr-[14px] pb-[14px] pl-[18px]`,children:[(0,Q.jsx)(`img`,{src:`/cezarion-mark-${t}.svg`,alt:``,"aria-hidden":`true`,className:`mt-[14px] size-[32px] rounded-lg`}),(0,Q.jsx)(`span`,{className:`mt-[14px] text-[18px] leading-none font-bold tracking-[-0.02em] text-foreground`,children:`Cezarion`}),e?(0,Q.jsxs)(`span`,{"data-slot":`drawer-version`,title:`v${e}`,className:`mt-[14px] min-w-0 truncate text-[11px] leading-none text-soft-foreground`,children:[`v`,e]}):null,(0,Q.jsx)(Io,{asChild:!0,children:(0,Q.jsx)(z,{variant:`ghost`,size:`icon`,"aria-label":`Close menu`,className:`mt-[14px] ml-auto size-[44px] text-foreground`,children:(0,Q.jsx)(or,{className:`size-[19px]`,"aria-hidden":`true`})})})]})}function x_({version:e,latestVersion:t,...n}){let r=n.state?.status===`ready`||n.state?.status===`preparing`||n.state?.status===`restarting`;if(!(e&&t&&c_(t,e))&&!r)return null;let i=n.state?.status,a=i===`preparing`?`Preparing update…`:i===`ready`||i===`restarting`?`Restart to finish updating`:`Update available · v${t}`;return(0,Q.jsxs)(`div`,{"data-slot":`drawer-update`,className:`shrink-0 border-b border-border px-[18px] py-[6px]`,children:[(0,Q.jsxs)(`div`,{className:`flex min-h-[44px] items-center gap-[8px]`,children:[(0,Q.jsx)(q,{tone:`pending`,className:`size-[6px] shrink-0`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] font-medium text-foreground`,children:a}),(0,Q.jsx)(l_,{version:e,latestVersion:t,...n})]}),(0,Q.jsx)(u_,{version:e,latestVersion:t,state:n.state,error:n.error,offline:n.offline,busy:n.busy})]})}function S_({project:e,signal:t,known:n,truncated:r,current:i,onNavigate:a}){let{top:o,bottom:s}=g_(t),c=i?`border-sidebar-row-selected`:`border-sidebar`,l=`right-[-4px]`,u=(0,Q.jsxs)(L,{to:Ha(e.id,`/`),onClick:a,"data-slot":`drawer-project`,"data-project-id":e.id,"aria-current":i?`page`:void 0,className:G(`flex h-[64px] min-w-0 items-center gap-[12px] rounded-[10px] px-[10px] text-foreground hover:bg-sidebar-row-hover focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,i&&`flex-1 hover:bg-sidebar-row-selected`),children:[(0,Q.jsxs)(`span`,{"aria-hidden":`true`,className:G(`relative flex size-[40px] shrink-0 items-center justify-center rounded-[10px] border text-[13px] leading-none font-semibold`,i?`border-soft-foreground bg-sidebar text-foreground`:`border-transparent bg-muted text-muted-foreground`),children:[Kp(e.name),(0,Q.jsx)(h_,{position:`top`,segments:o,className:G(l,c)}),(0,Q.jsx)(h_,{position:`bottom`,segments:s,className:G(l,c,`top-[29px]`)})]}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,Q.jsx)(`span`,{className:`truncate text-[14.5px] leading-tight font-semibold`,children:e.name}),(0,Q.jsx)(f_,{signal:t,known:n,truncated:r,current:i,slot:`drawer-project-state`,className:`flex-wrap gap-x-[6px] text-[11.5px] leading-tight`})]}),i?(0,Q.jsx)(_t,{"aria-hidden":`true`,className:`size-[16px] shrink-0 text-foreground`}):null]});return i?(0,Q.jsxs)(`div`,{"data-slot":`drawer-project-current`,className:`flex items-center rounded-[10px] bg-sidebar-row-selected pr-[4px]`,children:[u,(0,Q.jsx)(Zp,{projectId:e.id,onNavigate:a,triggerClassName:`size-[44px]`,align:`end`})]}):u}var C_=`flex h-[48px] w-full items-center gap-[12px] rounded-[10px] px-[10px] text-[14.5px] font-normal text-foreground hover:bg-sidebar-row-hover focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring [&_svg]:size-[18px] [&_svg]:shrink-0 [&_svg]:text-soft-foreground`;function w_({nav:e,currentProjectId:t,onNavigate:n}){return(0,Q.jsxs)(`div`,{"data-slot":`drawer-projects`,className:`shrink-0`,children:[(0,Q.jsx)(`div`,{className:`px-[18px] pt-[14px] pb-[6px] text-[12px] font-medium text-soft-foreground`,id:`drawer-projects-label`,children:`Projects`}),(0,Q.jsx)(`div`,{role:`group`,"data-slot":`drawer-projects-group`,"aria-labelledby":`drawer-projects-label`,className:`flex flex-col gap-[2px] px-[8px] pb-[8px]`,children:e.projects.map(r=>(0,Q.jsx)(S_,{project:r,signal:e.signals?.get(r.id),known:e.signals!==null,truncated:e.truncated.has(r.id),current:r.id===t,onNavigate:n},r.id))}),e.singleProject?null:(0,Q.jsxs)(`div`,{"data-slot":`drawer-workspace`,className:`flex flex-col gap-[2px] border-t border-border px-[8px] py-[8px]`,children:[(0,Q.jsxs)(L,{to:`/tasks`,onClick:n,"data-slot":`drawer-all-projects`,className:C_,children:[(0,Q.jsx)(O,{"aria-hidden":`true`}),`All projects · task overview`]}),(0,Q.jsx)(s_,{origin:`mobile`,icon:Kn,iconClassName:`size-[18px]`,label:`Add project`,triggerClassName:G(C_,`h-[48px] justify-start p-0 px-[10px] text-foreground`)})]})]})}function T_({onNavigate:e,tools:t}){let{theme:n,setTheme:r}=Hf(),i=qg[n],a=n.charAt(0).toUpperCase()+n.slice(1);return(0,Q.jsxs)(`div`,{"data-slot":`drawer-global`,className:`flex shrink-0 flex-col gap-[2px] border-t border-border px-[8px] pt-[8px] pb-[max(8px,env(safe-area-inset-bottom))]`,children:[t?(0,Q.jsxs)(L,{to:`/tools`,onClick:e,"data-slot":`drawer-tools`,"aria-label":t.blocked?`Tools, needs setup`:void 0,"aria-describedby":t.blocked&&t.note?`drawer-tools-note`:void 0,className:G(C_,t.note&&`h-auto min-h-[48px] py-[6px]`),children:[(0,Q.jsxs)(`span`,{className:`relative flex shrink-0`,children:[(0,Q.jsx)($t,{"aria-hidden":`true`}),t.blocked?(0,Q.jsx)(q,{tone:`pending`,"data-slot":`drawer-tools-dot`,className:`absolute -top-[2px] -right-[3px] ring-[1.5px] ring-sidebar`}):null]}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Q.jsx)(`span`,{children:`Tools`}),t.note?(0,Q.jsx)(`span`,{id:`drawer-tools-note`,"data-slot":`drawer-tools-note`,className:`text-[11.5px] leading-tight text-soft-foreground`,children:t.note}):null]})]}):null,(0,Q.jsxs)(L,{to:`/settings/global/appearance`,onClick:e,"data-slot":`drawer-global-settings`,className:C_,children:[(0,Q.jsx)(Pr,{"aria-hidden":`true`}),`Global settings`]}),(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`theme-toggle`,"data-theme-pref":n,"aria-label":`Theme: ${n.toLowerCase()}. Switch to ${i}.`,onClick:()=>r(i),className:C_,children:[(0,Q.jsx)(N,{"aria-hidden":`true`}),`Theme · `,a]})]})}var E_=5;function D_({items:e,activeTo:t,needsYou:n=!1,inboxCount:r,skillsUpdateAvailable:i,onNavigate:a}){let[o,s]=(0,Z.useState)(!1),c=(0,Z.useRef)(null),l=e.filter(e=>e.to===`/inbox`||e.to===`/automations`),u=l.length>0&&e.length-l.length>E_?e.filter(e=>e.to===`/workflows`||l.includes(e)):l,d=e.filter(e=>!u.includes(e)),f=u.some(e=>e.to===t);return(0,Q.jsx)(gm,{children:(0,Q.jsxs)(`nav`,{ref:c,"aria-label":`Main`,"data-slot":`view-tabs`,onKeyDown:e=>{if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key))return;let t=Array.from(c.current?.querySelectorAll(`[data-view-tab]`)??[]),n=t.indexOf(document.activeElement);n<0||(e.preventDefault(),t[e.key===`Home`?0:e.key===`End`?t.length-1:(n+(e.key===`ArrowRight`?1:-1)+t.length)%t.length]?.focus())},className:`flex shrink-0 items-center justify-between max-md:justify-start max-md:gap-1 max-md:overflow-x-auto border-b border-border px-3 pt-2.5 pb-2`,children:[d.map(e=>{let r=e.to===t,o=e.icon,s=e.to===`/`&&n&&!r?`bg-pending-strong`:e.to===`/skills`&&i?`bg-info`:null;return(0,Q.jsxs)(_m,{children:[(0,Q.jsx)(vm,{asChild:!0,children:(0,Q.jsxs)(X,{to:e.to,onClick:a,"data-view-tab":!0,"aria-label":e.label,"aria-current":r?`page`:void 0,className:G(`relative flex h-[30px] min-w-0 items-center justify-center rounded-[7px] text-soft-foreground hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11 max-md:min-w-11`,r?`shrink-0 gap-1.5 bg-sidebar-row-selected px-[9px] text-[12px] font-semibold text-foreground`:`w-7 shrink-0`),children:[(0,Q.jsxs)(`span`,{className:`relative`,children:[(0,Q.jsx)(o,{className:`size-[15px] shrink-0`,"aria-hidden":`true`}),s?(0,Q.jsx)(`span`,{"aria-label":e.to===`/`?`Tasks need you`:`Skills update available`,"data-slot":e.to===`/`?`nav-needs-you-dot`:`nav-update-marker`,className:G(`absolute -top-1 -right-1 size-[7px] rounded-full border-[1.5px] border-sidebar`,s)}):null]}),r?(0,Q.jsx)(`span`,{className:`truncate`,children:e.label}):null]})}),(0,Q.jsx)(ym,{side:`bottom`,sideOffset:6,style:{pointerEvents:`none`},children:e.label})]},e.to)}),u.length?(0,Q.jsxs)(uo,{open:o,onOpenChange:s,children:[(0,Q.jsxs)(_m,{children:[(0,Q.jsx)(vm,{asChild:!0,children:(0,Q.jsx)(so,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-view-tab":!0,"aria-label":`More views`,"data-active":f?`true`:void 0,className:G(`relative flex h-[30px] w-7 shrink-0 items-center justify-center rounded-[7px] text-soft-foreground hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11 max-md:min-w-11`,(o||f)&&`bg-sidebar-row-selected text-foreground`),children:[(0,Q.jsx)(ec,{className:`size-[15px]`,"aria-hidden":`true`}),r&&u.some(e=>e.to===`/inbox`)?(0,Q.jsx)(`span`,{"data-slot":`overflow-inbox-dot`,className:`absolute top-1 right-0.5 size-[7px] rounded-full border-[1.5px] border-sidebar bg-pending-strong`}):null]})})}),(0,Q.jsx)(ym,{side:`bottom`,sideOffset:6,style:{pointerEvents:`none`},children:`More views`})]}),(0,Q.jsx)(co,{align:`end`,sideOffset:4,className:`w-48 rounded-[10px] border-border bg-sidebar p-[5px] shadow-[0_10px_28px_#00000047]`,children:u.map(e=>{let n=e.icon,i=e.to===t;return(0,Q.jsx)(ro,{asChild:!0,className:G(`h-8 max-md:min-h-11 gap-2.5 rounded-md px-[9px] text-[13px] text-foreground focus:bg-sidebar-row-hover`,i&&`bg-sidebar-row-selected font-medium`),children:(0,Q.jsxs)(X,{to:e.to,onClick:a,"aria-current":i?`page`:void 0,children:[(0,Q.jsx)(n,{className:`size-[15px] text-soft-foreground`}),e.label,e.to===`/inbox`&&r?(0,Q.jsx)(`span`,{"data-slot":`inbox-count`,className:`ml-auto rounded-full bg-inbox-count px-1.5 text-[11px] font-semibold text-inbox-count-foreground`,children:r}):null]})},e.to)})})]}):null]})})}var O_=[{to:`/skills`,label:`Skills`},{to:`/workflows`,label:`Workflows`},{to:`/settings`,label:`Project settings`}],k_=[`/inbox`,`/automations`],A_=`flex h-[50px] min-h-11 w-full items-center gap-[14px] rounded-[10px] px-[10px] text-[14.5px] text-foreground hover:bg-sidebar-row-hover focus-visible:outline-2 focus-visible:outline-ring [&_svg]:size-[18px] [&_svg]:shrink-0 [&_svg]:text-muted-foreground`;function j_({open:e,onOpenChange:t,onCloseAutoFocus:n,projectName:r,items:i,activeTo:a,inboxCount:o=null,skillsUpdateAvailable:s=!1}){let c=new Map(i.map(e=>[e.to,e])),l=O_.flatMap(({to:e,label:t})=>{let n=c.get(e);return n?[{to:e,label:t,icon:n.icon}]:[]}),u=k_.flatMap(e=>{let t=c.get(e);return t?[{to:e,label:t.label,icon:t.icon}]:[]}),d=()=>t(!1),f=({to:e,label:t,icon:n})=>{let r=e===a;return(0,Q.jsxs)(X,{to:e,onClick:d,"data-slot":`more-row`,"data-more-row":e,"aria-current":r?`page`:void 0,className:G(A_,r&&`bg-sidebar-row-selected hover:bg-sidebar-row-selected`),children:[(0,Q.jsx)(n,{"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t}),e===`/skills`&&s?(0,Q.jsx)(`span`,{"data-slot":`skills-update`,className:`shrink-0 rounded-full bg-muted px-[10px] py-[3px] text-[12.5px] font-medium text-foreground`,children:`1 update`}):null,e===`/inbox`&&o?(0,Q.jsx)(`span`,{"data-slot":`inbox-count`,className:`shrink-0 rounded-full bg-inbox-count px-[10px] py-[3px] text-[12.5px] font-semibold text-inbox-count-foreground`,children:o}):null,(0,Q.jsx)(St,{"aria-hidden":`true`,className:`!size-[15px]`})]},e)};return(0,Q.jsx)(Vo,{open:e,onOpenChange:t,children:(0,Q.jsxs)(zo,{side:`bottom`,"data-slot":`more-sheet`,showCloseButton:!1,onCloseAutoFocus:n,"aria-describedby":void 0,className:`gap-0 rounded-t-[20px] border-border bg-sidebar px-[14px] pt-[10px] pb-[max(14px,env(safe-area-inset-bottom))] md:hidden`,children:[(0,Q.jsx)(`div`,{"aria-hidden":`true`,className:`mx-auto mb-[14px] h-[5px] w-[36px] rounded-[3px] bg-border`}),(0,Q.jsxs)(`div`,{className:`flex items-baseline gap-[10px] px-[10px] pb-[6px]`,children:[(0,Q.jsx)(Lo,{className:`text-[17px] leading-tight font-bold`,children:`More`}),r?(0,Q.jsx)(`span`,{"data-slot":`more-project`,className:`min-w-0 truncate text-[12.5px] text-soft-foreground`,children:r}):null]}),(0,Q.jsx)(`div`,{className:`flex flex-col gap-[2px]`,children:l.map(f)}),u.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{role:`separator`,className:`mx-[10px] mt-[8px] border-t border-border`}),(0,Q.jsx)(`div`,{className:`px-[10px] pt-[12px] pb-[4px] text-[12px] font-medium text-soft-foreground`,children:`Shown when their flag is on`}),(0,Q.jsx)(`div`,{className:`flex flex-col gap-[2px]`,children:u.map(f)})]}):null]})})}var M_=`(min-width: 768px)`;function N_({items:e,activeTo:t,signal:n,projectName:r,inboxCount:i,skillsUpdateAvailable:o,showNewTask:s=!0}){let[c,l]=Z.useState(!1),u=Z.useRef(null),{pathname:d}=a();Z.useEffect(()=>{l(!1)},[d]),Z.useEffect(()=>{let e=window.matchMedia?.(M_);if(!e)return;e.matches&&l(!1);let t=e=>{e.matches&&l(!1)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let f=e.filter(e=>Gg.includes(e.to)),p=t!==null&&Kg.includes(t),{top:m}=g_(n),h=m.some(e=>e.count>0),g=e=>G(`relative flex h-full min-h-11 min-w-11 flex-1 flex-col items-center justify-center gap-[3px] text-[10.5px] leading-none focus-visible:outline-2 focus-visible:outline-ring`,e?`font-semibold text-foreground`:`font-medium text-soft-foreground`);return(0,Q.jsxs)(Q.Fragment,{children:[s?(0,Q.jsxs)(X,{to:`/new`,"data-slot":`mobile-new-task`,className:`absolute right-4 bottom-full z-30 mb-4 flex h-12 items-center gap-2 rounded-[24px] bg-foreground px-[18px] text-[14px] font-semibold text-background shadow-[0_8px_24px_#00000055] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,children:[(0,Q.jsx)(pe,{"aria-hidden":`true`,className:`size-[18px]`}),`New task`]}):null,(0,Q.jsxs)(`nav`,{"aria-label":`Views`,"data-slot":`mobile-tab-bar`,className:`flex h-[54px] items-stretch`,children:[f.map(e=>{let n=e.to===t,r=e.icon,i=e.to===`/`&&h;return(0,Q.jsxs)(X,{to:e.to,"data-tab":e.to,"aria-current":n?`page`:void 0,className:g(n),children:[(0,Q.jsxs)(`span`,{className:`relative`,children:[(0,Q.jsx)(r,{"aria-hidden":`true`,className:`size-[21px]`}),i?(0,Q.jsx)(h_,{position:`top`,segments:m,className:`-top-[6px] -right-[10px] border-sidebar`}):null]}),e.label]},e.to)}),(0,Q.jsxs)(`button`,{ref:u,type:`button`,"data-tab":`more`,"aria-haspopup":`dialog`,"aria-expanded":c,"data-active":p?`true`:void 0,onClick:()=>l(!0),className:g(p),children:[(0,Q.jsx)(`span`,{className:`relative`,children:(0,Q.jsx)(nr,{"aria-hidden":`true`,className:`size-[21px]`})}),`More`]})]}),(0,Q.jsx)(j_,{open:c,onOpenChange:l,onCloseAutoFocus:e=>{u.current?.isConnected&&(e.preventDefault(),u.current.focus())},projectName:r,items:e,activeTo:t,inboxCount:i,skillsUpdateAvailable:o})]})}var P_=`cez-sidebar-width`;function F_(e){let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?Math.min(420,Math.max(264,Math.round(t))):264}function I_(){try{let e=localStorage.getItem(P_);return e===null?264:F_(e)}catch{return 264}}function L_(e){try{localStorage.setItem(P_,String(F_(e)))}catch{}}var R_=`(min-width: 768px)`,z_=Z.createContext(264),B_=Z.createContext(void 0);function V_(){return Z.useContext(B_)}function H_(e){return mt({path:`/tasks/:id`,end:!0},Fa(e))!==null}function U_(e){let t=Fa(e);return t===`/github`||t.startsWith(`/github/`)}function W_({children:e,breadcrumb:t,repo:n=null,inboxCount:r=null,skillsUpdateAvailable:i=!1,version:o=null,latestVersion:s=null,applicationUpdate:c,onApplyUpdate:l,onRestart:u,applicationUpdateError:d,applicationUpdateBusy:f,applicationUpdateOffline:p,sidebarList:m,taskQuickList:h,sessionScope:g,toolsMenu:_,forgeAvailable:v=!0,inboxAvailable:y=!0,automationsAvailable:b=!0,banner:x,mobileProjects:S,projectHeader:C,sidebarProjectId:w,needsYou:T,projectRail:E,toolsStatus:ee}){let{pathname:D,search:O}=a(),k=Fa(D),te=k===`/new`?`/new`:Vg(k),ne=Hg(k),A=Va(D),re=Zi(),ie=!Ug(D)&&!Wg(D,O)&&!re,ae=A===null?void 0:S?.signals?.get(A),[oe,se]=Z.useState(!1),j=Ug(D),[ce,le]=Z.useState(null),ue=Z.useRef(null),de=Z.useRef(null),fe=Z.useRef(null),pe=H_(D),me=k===`/git`&&new URLSearchParams(O).get(`view`)===`repo`,[he,M]=Z.useState(I_),ge=Z.useCallback(e=>{let t=F_(e);M(t),L_(t)},[]);Z.useLayoutEffect(()=>{let e=fe.current;if(fe.current=D,pe||e!==null&&Va(e)===Va(D)&&U_(e)&&U_(D))return;let t=de.current;t&&(t.scrollTop=0)},[D,pe,me]),Z.useEffect(()=>{se(!1)},[D]),Z.useEffect(()=>{let e=window.matchMedia?.(R_);if(!e)return;e.matches&&se(!1);let t=e=>{e.matches&&se(!1)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let _e={activeTo:te,items:zg({forge:v,inbox:y,automations:b}),repo:n,inboxCount:y?r:null,skillsUpdateAvailable:i,version:o,latestVersion:s,applicationUpdate:c,onApplyUpdate:l,onRestart:u,applicationUpdateError:d,applicationUpdateBusy:f,applicationUpdateOffline:p,sidebarList:m,taskQuickList:h,sessionScope:g,toolsMenu:_,projectHeader:C,sidebarProjectId:w,needsYou:T};return(0,Q.jsx)(Vo,{open:oe,onOpenChange:se,children:(0,Q.jsxs)(`div`,{"data-slot":`app-shell`,className:`flex h-dvh overflow-hidden bg-background text-foreground pl-[env(safe-area-inset-left)] pr-[env(safe-area-inset-right)]`,children:[(0,Q.jsx)(z_.Provider,{value:he,children:E}),(0,Q.jsx)(G_,{..._e,width:he,onWidthChange:ge}),(0,Q.jsx)(q_,{..._e,mobileProjects:S,currentProjectId:A,toolsStatus:ee,onNavigate:()=>se(!1),onCloseAutoFocus:e=>{ue.current?.isConnected&&(e.preventDefault(),ue.current.focus())}}),(0,Q.jsxs)(`div`,{className:`grid min-w-0 flex-1 grid-rows-[auto_auto_1fr_auto] overflow-hidden`,children:[(0,Q.jsx)(Z_,{title:ne?.label??`cezar`,pushed:j?{compare:k.startsWith(`/compare/`),onSlot:le}:null,repo:n,elsewhere:__(S,A),onTrigger:e=>{ue.current=e}}),(0,Q.jsxs)(`header`,{"data-slot":`desktop-breadcrumb`,className:G(`row-start-1 hidden min-w-0 items-center gap-3 border-b border-border text-[13px] text-muted-foreground md:flex`,k===`/new`?`h-[72px] px-11`:`h-16 px-9`),children:[(0,Q.jsx)(Xt,{"aria-hidden":`true`,className:`size-4 shrink-0`}),t?.project??n?.name?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`truncate font-medium text-foreground`,children:t?.project??n?.name}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:`/`})]}):null,(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:t?.page??ne?.label??`Cezarion`}),t?.branch??n?.branch?(0,Q.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2 text-[11px]`,children:[(0,Q.jsx)(ct,{"aria-hidden":`true`,className:`size-4 text-accent-text`}),t?.branch??n?.branch]}):null]}),x?(0,Q.jsx)(`div`,{"data-slot":`banner-slot`,className:`row-start-2`,children:x}):null,(0,Q.jsx)(`main`,{ref:de,"data-slot":`main`,className:G(`row-start-3 min-h-0 overflow-y-auto overscroll-contain`,ie&&k!==`/new`&&`max-md:pb-20`),children:(0,Q.jsx)(ci.Provider,{value:j?ce:null,children:e})}),(0,Q.jsx)(`div`,{"data-slot":`composer`,className:G(`row-start-4 pb-[max(env(safe-area-inset-bottom),var(--kb,0px))]`,ie&&`relative max-md:border-t max-md:border-border max-md:bg-sidebar`),children:ie?(0,Q.jsx)(`div`,{className:`md:hidden`,children:(0,Q.jsx)(N_,{items:_e.items,activeTo:te,signal:ae,projectName:S?.projects.find(e=>e.id===A)?.name??n?.name??null,inboxCount:_e.inboxCount,skillsUpdateAvailable:i,showNewTask:k!==`/new`})}):null})]})]})})}function G_({width:e,onWidthChange:t,...n}){return(0,Q.jsxs)(`aside`,{"data-slot":`sidebar`,style:{width:e},className:`relative hidden shrink-0 flex-col border-r border-border bg-sidebar md:flex`,children:[(0,Q.jsx)(J_,{...n}),(0,Q.jsx)(K_,{width:e,onWidthChange:t})]})}function K_({width:e,onWidthChange:t}){let n=Z.useRef(null),r=t=>{t.button===0&&(n.current={x:t.clientX,width:e},t.currentTarget.setPointerCapture(t.pointerId),t.preventDefault(),t.currentTarget.focus())},i=e=>{let r=n.current;r&&t(F_(r.width+(e.clientX-r.x)))},a=e=>{n.current&&(n.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))};return(0,Q.jsx)(`div`,{"data-slot":`sidebar-resize-handle`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize the sidebar`,"aria-valuenow":e,"aria-valuemin":264,"aria-valuemax":420,tabIndex:0,onPointerDown:r,onPointerMove:i,onPointerUp:a,onPointerCancel:a,onKeyDown:n=>{let r=n.key===`ArrowLeft`?e-16:n.key===`ArrowRight`?e+16:n.key===`Home`?264:n.key===`End`?420:null;r!==null&&(n.preventDefault(),t(F_(r)))},onDoubleClick:()=>t(264),title:`Drag to resize the sidebar — double-click to reset`,className:`absolute inset-y-0 -right-[2px] z-20 w-[5px] cursor-col-resize touch-none bg-transparent transition-colors hover:bg-[var(--composer-border)] focus-visible:bg-[var(--composer-border)] focus-visible:outline-none`})}function q_({onNavigate:e,onCloseAutoFocus:t,mobileProjects:n,currentProjectId:r,toolsStatus:i,version:a,latestVersion:o,applicationUpdate:s,onApplyUpdate:c,onRestart:l,applicationUpdateError:u,applicationUpdateBusy:d,applicationUpdateOffline:f}){return(0,Q.jsxs)(zo,{side:`left`,"data-slot":`mobile-nav-drawer`,onCloseAutoFocus:t,overlayClassName:`bg-[var(--nav-scrim)]`,showCloseButton:!1,className:`w-[calc(100%-68px)] max-w-[334px] gap-0 border-border bg-sidebar p-0 sm:max-w-[334px] md:hidden`,"aria-describedby":void 0,children:[(0,Q.jsx)(Lo,{className:`sr-only`,children:`Navigation`}),(0,Q.jsx)(b_,{version:a}),(0,Q.jsx)(x_,{version:a,latestVersion:o,state:s,onApplyUpdate:c,onRestart:l,error:u,busy:d,offline:f}),(0,Q.jsx)(`div`,{"data-slot":`drawer-scroll`,className:`flex min-h-0 flex-1 flex-col overflow-y-auto overscroll-contain`,children:n?(0,Q.jsx)(w_,{nav:n,currentProjectId:r,onNavigate:e}):null}),(0,Q.jsx)(T_,{onNavigate:e,tools:i})]})}function J_({activeTo:e,items:t,repo:n,inboxCount:r,skillsUpdateAvailable:i,version:a,latestVersion:o,applicationUpdate:s,onApplyUpdate:c,onRestart:l,applicationUpdateError:u,applicationUpdateBusy:d,applicationUpdateOffline:f,sidebarList:p,taskQuickList:m,sessionScope:h,toolsMenu:g,projectHeader:_,sidebarProjectId:v,needsYou:y,onNavigate:b}){let x=hr(),S=v===void 0?x:{projectId:v,apiBase:`${Wr}/p/${encodeURIComponent(v)}`};return(0,Q.jsx)(on.Provider,{value:S,children:(0,Q.jsx)(B_.Provider,{value:b,children:(0,Q.jsxs)(`div`,{"data-slot":`sidebar-content`,className:`@container/sidebar flex min-h-0 flex-1 flex-col pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)]`,children:[(0,Q.jsx)(`div`,{"data-slot":`sidebar-header`,className:`shrink-0`,children:_??(n?(0,Q.jsxs)(`div`,{className:`px-[14px] pt-[14px] pb-2.5`,children:[(0,Q.jsx)(`div`,{className:`truncate text-sm font-semibold`,children:n.name}),(0,Q.jsx)(`div`,{className:`truncate font-mono text-[10.5px] text-soft-foreground`,children:n.branch})]}):null)}),(0,Q.jsxs)(`div`,{"data-slot":`sidebar-actions`,className:`flex flex-col gap-2 px-3`,children:[(0,Q.jsx)(Y_,{}),(0,Q.jsx)(z,{asChild:!0,variant:`ghost`,className:G(`relative h-[32px] max-md:min-h-11 rounded-[7px] bg-muted w-full min-w-0 justify-start gap-2 px-2.5 text-[12.5px] font-medium text-foreground hover:bg-sidebar-row-hover hover:text-foreground`,e===`/new`&&`bg-sidebar-row-selected text-foreground font-medium hover:bg-sidebar-row-selected`),children:(0,Q.jsxs)(X,{to:`/new`,onClick:b,"data-sidebar-item":`new-task`,"aria-current":e===`/new`?`page`:void 0,children:[(0,Q.jsx)(pe,{className:`size-[15px]`,"aria-hidden":`true`}),`New task`,(0,Q.jsx)(`kbd`,{"aria-hidden":`true`,className:`sr-only`,children:`C`})]})})]}),h?(0,Q.jsx)(`div`,{className:`shrink-0 px-3 pt-2`,children:h}):null,(0,Q.jsx)(D_,{items:t,activeTo:e,needsYou:y,inboxCount:r,skillsUpdateAvailable:i,onNavigate:b}),(0,Q.jsx)(`div`,{"data-slot":`project-task-navigation`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-3`,children:(0,Q.jsx)(B_.Provider,{value:b,children:p??(0,Q.jsx)(`div`,{"data-slot":`task-quick-list`,children:m})})}),(0,Q.jsxs)(`div`,{"data-slot":`sidebar-footer`,className:`shrink-0`,children:[(0,Q.jsxs)(`div`,{"data-slot":`sidebar-footer-controls`,className:`flex h-11 items-center justify-between gap-1 border-t border-border px-3`,children:[(0,Q.jsx)(`div`,{"data-slot":`tools-menu`,className:`shrink-0`,children:g}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,"data-slot":`version-action`,children:[a?(0,Q.jsx)(X_,{version:a,latestVersion:o}):null,(0,Q.jsx)(l_,{version:a,latestVersion:o,state:s,onApplyUpdate:c,onRestart:l,error:u,busy:d,offline:f})]})]}),(0,Q.jsx)(u_,{version:a,latestVersion:o,state:s,error:u,offline:f,busy:d})]})]})})})}function Y_(){return(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`command-palette-hint`,title:`Search — command palette (⌘K / Ctrl+K)`,onClick:()=>Zg(),className:`flex h-[32px] max-md:min-h-11 w-full items-center gap-2 rounded-[7px] border border-border bg-background px-2.5 text-left text-[12.5px] font-normal text-soft-foreground transition-colors hover:border-border hover:text-foreground`,children:[(0,Q.jsx)(We,{className:`size-[14px] shrink-0`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`truncate`,children:`Search…`}),(0,Q.jsx)(`kbd`,{"aria-hidden":`true`,className:`ml-auto shrink-0 font-sans text-[11px] font-normal text-soft-foreground`,children:No(`k`)})]})}function X_({version:e,latestVersion:t}){let n=!!(t&&c_(t,e));return(0,Q.jsxs)(`span`,{"data-slot":`version-chip`,"data-update-available":n?`true`:void 0,title:n?`v${e} — update available: v${t}`:`v${e}`,className:`flex min-w-0 items-center gap-1 font-mono text-[11px] text-soft-foreground`,children:[n?(0,Q.jsx)(q,{tone:`pending`,className:`size-[5px] shrink-0`}):null,(0,Q.jsxs)(`span`,{className:`truncate`,children:[`v`,e]})]})}function Z_({title:e,pushed:t,repo:n,elsewhere:r,onTrigger:i}){return t?(0,Q.jsx)(Q_,{compare:t.compare,onSlot:t.onSlot}):(0,Q.jsx)(`header`,{"data-slot":`mobile-top-bar`,className:`row-start-1 min-w-0 border-b border-border bg-card pt-[env(safe-area-inset-top)] md:hidden`,children:(0,Q.jsxs)(`div`,{className:`flex h-[56px] min-w-0 items-center gap-[8px] px-[8px]`,children:[(0,Q.jsx)(Bo,{asChild:!0,children:(0,Q.jsxs)(z,{variant:`ghost`,"aria-label":v_(r),onClick:e=>i(e.currentTarget),className:`relative h-[44px] w-[64px] shrink-0 justify-start rounded-md p-0 pl-[10px] text-foreground`,children:[(0,Q.jsx)(Ie,{className:`size-[20px]`,"aria-hidden":`true`}),(0,Q.jsx)(y_,{elsewhere:r})]})}),n?(0,Q.jsx)(Bo,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`mobile-project-picker`,"aria-label":`Switch project: ${n.name}`,onClick:e=>i(e.currentTarget),className:`flex h-[44px] min-w-0 flex-1 items-center justify-start gap-[10px] rounded-md text-left focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`flex size-[28px] shrink-0 items-center justify-center rounded-[8px] border border-soft-foreground bg-sidebar-row-selected text-[11px] leading-none font-semibold text-foreground`,children:Kp(n.name)}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Q.jsx)(`span`,{className:`truncate text-[15px] leading-tight font-semibold text-foreground`,children:n.name}),n.branch?(0,Q.jsx)(`span`,{className:`truncate font-mono text-[10.5px] leading-tight text-soft-foreground`,children:n.branch}):null]}),(0,Q.jsx)(pt,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-soft-foreground`})]})}):null,e===`cezar`?n?null:(0,Q.jsx)(`span`,{className:`flex-1`}):(0,Q.jsx)(`span`,{"data-slot":`mobile-route-title`,className:G(`truncate text-[15px] font-semibold text-foreground`,n?`sr-only`:`min-w-0 flex-1 pl-[8px]`),children:e}),(0,Q.jsx)(z,{variant:`ghost`,"aria-label":`Search`,"data-slot":`mobile-search`,onClick:()=>Zg(),className:`ml-auto size-[44px] shrink-0 p-0 text-foreground`,children:(0,Q.jsx)(We,{className:`size-[19px]`,"aria-hidden":`true`})})]})})}function Q_({compare:e,onSlot:t}){let n=Ua();return(0,Q.jsx)(`header`,{"data-slot":`mobile-top-bar`,"data-mode":`task`,className:`row-start-1 min-w-0 border-b border-border bg-card pt-[env(safe-area-inset-top)] md:hidden`,children:(0,Q.jsxs)(`div`,{className:`flex h-[56px] min-w-0 items-center gap-[4px] px-[8px]`,children:[(0,Q.jsx)(z,{variant:`ghost`,"aria-label":`Back`,"data-slot":`mobile-back`,onClick:()=>{let e=window.history.state?.idx;n(typeof e==`number`&&e>0?-1:`/`)},className:`size-[44px] shrink-0 p-0 text-foreground`,children:(0,Q.jsx)(ki,{className:`size-[22px]`,"aria-hidden":`true`})}),e?(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[15px] font-semibold text-foreground`,children:`Compare variants`}):null,(0,Q.jsx)(`div`,{"data-slot":`mobile-run-bar`,ref:t,className:G(`flex min-w-0 items-center gap-[4px]`,e?`shrink-0`:`flex-1`)})]})})}var $_=`cez:application-restart-from`,ev=24e4,tv=3e4,nv=`The response was lost; update status is unknown. Reconnect or check the current state before retrying.`;function rv(e,t){let n=t?.applicationUpdate;return!!(n&&(n.status===`error`||e.kind===`apply`&&n.status===`ready`||e.kind===`restart`&&(n.status===`restarting`||n.status===`idle`&&e.initialVersion&&t.version!==e.initialVersion)))}function iv(e,t=()=>window.location.reload()){let n=U(),r=Z.useRef(null),i=Z.useRef(e);i.current=e;let[a,o]=Z.useState(!1),[s,c]=Z.useState(null),[l,u]=Z.useState(()=>!navigator.onLine),d=Z.useRef(e?.version??null),f=Z.useRef(!1),[p,m]=Z.useState(()=>{try{return window.sessionStorage.getItem($_)}catch{return null}});Z.useEffect(()=>{let e=()=>u(!navigator.onLine);return window.addEventListener(`online`,e),window.addEventListener(`offline`,e),()=>{window.removeEventListener(`online`,e),window.removeEventListener(`offline`,e)}},[]),Z.useEffect(()=>{(e?.applicationUpdate?.status===`ready`||e?.applicationUpdate?.status===`restarting`)&&c(null)},[e?.applicationUpdate?.status]),Z.useEffect(()=>{if(!e?.version)return;d.current||=e.version;let n=d.current!==e.version,r=!!(p&&e.version!==p);if(n||r||p&&e.applicationUpdate?.status===`error`){try{window.sessionStorage.removeItem($_)}catch{}m(null)}(n||r)&&!f.current&&(f.current=!0,t())},[e?.version,e?.applicationUpdate?.status,p,t]);let h=Z.useCallback(e=>{n.setQueryData(R.health,t=>t&&{...t,applicationUpdate:e})},[n]),g=Z.useCallback((e,t)=>{if(r.current===e){if(e.reconciledRestart&&(t.source===`timeout`||t.source===`failure`&&t.cause instanceof Or&&t.cause.status===0)&&(t={source:`health`,state:e.reconciledRestart}),r.current=null,clearTimeout(e.timer),t.source!==`response`&&e.controller.abort(),o(!1),t.source===`response`&&t.state&&h(t.state),t.source===`timeout`?c(nv):t.source===`failure`?c(t.cause instanceof Error?t.cause.message:`The request failed.`):c(null),t.source===`failure`&&e.kind===`restart`){try{window.sessionStorage.removeItem($_)}catch{}m(null)}(t.source===`timeout`||t.source===`failure`)&&n.invalidateQueries({queryKey:R.health}),e.resolve(t.state)}},[n,h]);Z.useEffect(()=>{let t=r.current,n=e?.applicationUpdate;if(t&&!(n===t.initialState&&e?.version===t.initialVersion||!rv(t,e))){if(t.kind===`restart`&&n?.status===`restarting`){t.reconciledRestart=n,o(!1),c(null),t.resolve(n);return}g(t,{source:`health`,state:n})}},[e?.applicationUpdate,e?.version,g]),Z.useEffect(()=>()=>{let e=r.current;e&&(r.current=null,clearTimeout(e.timer),e.controller.abort(),e.resolve(void 0))},[]);let _=Z.useCallback((e,t)=>{if(r.current)return Promise.resolve(void 0);let a=new AbortController,s=i.current?.applicationUpdate,l=i.current?.version,u=n.getQueryData(R.health)?.applicationUpdate;return o(!0),c(null),new Promise(o=>{let c={controller:a,initialState:s,initialCacheState:u,initialVersion:l,kind:e,resolve:o,timer:setTimeout(()=>g(c,{source:`timeout`}),e===`apply`?ev:tv)};r.current=c,t(a.signal).then(e=>{if(r.current!==c)return;let t=n.getQueryData(R.health),a=i.current,o=t?.applicationUpdate!==u&&rv(c,t)?t.applicationUpdate:a?.applicationUpdate!==s&&rv(c,a)?a.applicationUpdate:void 0;g(c,o?{source:`health`,state:o}:{source:`response`,state:e.state})},e=>g(c,{source:`failure`,cause:e}))})},[g,n]);return{apply:Z.useCallback(async()=>{await _(`apply`,zt)},[_]),restart:Z.useCallback(async()=>{if(r.current)return;let e=i.current?.version,t=await _(`restart`,ee);if(e&&t?.status===`restarting`){try{window.sessionStorage.setItem($_,e)}catch{}m(e)}},[_]),busy:a,error:s,offline:l}}var av=Z.createContext(null);function ov({children:e}){let[t,n]=Z.useState(`active`),r=Z.useMemo(()=>[t,n],[t]);return(0,Q.jsx)(av.Provider,{value:r,children:e})}function sv(){let e=Z.useContext(av);if(!e)throw Error(`useListView must be used inside a <ListViewProvider>`);return e}var cv=[`claude`,`codex`,`opencode`,`pi`,`cursor`],lv={claude:`Claude Code`,codex:`Codex`,opencode:`OpenCode`,pi:`pi`,cursor:`Cursor`};function uv(e){if(typeof e!=`object`||!e||Array.isArray(e))return{};let t=e,n={};for(let e of cv){let r=t[e];typeof r==`string`&&r.length>0&&r.length<=128&&(n[e]=r)}return n}function dv(e,t){if(!e)return[];let n=new Map(e.providers.map(e=>[e.provider,e]));return cv.flatMap(e=>{let r=n.get(e);return r?.status!==`disconnected`||!r.authFailureId||t[e]===r.authFailureId?[]:[{provider:e,label:lv[e],authFailureId:r.authFailureId}]})}function fv(e,t){return{...e,...Object.fromEntries(t.map(({provider:e,authFailureId:t})=>[e,t]))}}function pv({status:e,pending:t,error:n,dismissals:r,onDismissAuthFailures:i}){if(t||!e)return null;let a;try{a=be(e)}catch{return null}let o=dv(a,r);if(o.length>0)return(0,Q.jsxs)(`div`,{"data-slot":`provider-banner`,role:`alert`,className:`flex min-h-9 items-center gap-2 border-b border-border bg-destructive/10 px-4 text-sm text-foreground`,children:[(0,Q.jsx)(q,{tone:`danger`}),(0,Q.jsxs)(`span`,{children:[`Provider authentication failed during a task:`,` `,o.map(({label:e})=>e).join(`, `),`.`]}),(0,Q.jsx)(X,{to:`/settings/agents#providers`,className:`ml-auto shrink-0 font-medium underline underline-offset-4 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:`Open agent settings`}),(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Dismiss provider authentication alert`,onClick:()=>i(o),className:`shrink-0 rounded-sm p-1 text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:(0,Q.jsx)(bc,{className:`size-4`,"aria-hidden":`true`})})]});if(n||a.providers.some(e=>e.enabled&&e.status===`connected`))return null;let s=a.providers.some(e=>e.status===`connected`),c=a.providers.some(e=>e.status===`unknown`);return(0,Q.jsxs)(`div`,{"data-slot":`provider-banner`,role:`status`,className:`flex min-h-9 items-center gap-2 border-b border-border bg-muted/50 px-4 text-sm text-muted-foreground`,children:[(0,Q.jsx)(q,{tone:c?`danger`:`pending`}),(0,Q.jsx)(`span`,{children:s?`No agent provider is enabled.`:c?`No connected provider could be verified.`:`No agent provider credentials were found.`}),(0,Q.jsx)(X,{to:`/settings/agents#providers`,className:`ml-auto shrink-0 font-medium text-foreground underline underline-offset-4 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:`Configure providers`})]})}function mv(e){if(!(typeof e!=`object`||!e||Array.isArray(e)))return e}function hv(){let e=ge(),t=De(),n=U(),r=(0,Z.useRef)(Promise.resolve()),i=(0,Z.useRef)(0),a=(0,Z.useRef)(0),o=(0,Z.useRef)(mv(t.data));(0,Z.useEffect)(()=>{a.current===0&&(o.current=mv(t.data))},[t.data]);let s=(0,Z.useCallback)(e=>{let t=I.uiState,s=mv(n.getQueryData(t)),c=fv(uv(s?.dismissedProviderAuthFailures),e),l={...s,dismissedProviderAuthFailures:c};a.current+=1,n.setQueryData(t,l);let u=++i.current;r.current=r.current.then(async()=>{try{let e=await Sr({dismissedProviderAuthFailures:c});o.current=mv(e),u===i.current&&n.setQueryData(t,e)}catch(e){u===i.current&&(o.current===void 0?n.removeQueries({queryKey:t,exact:!0}):n.setQueryData(t,o.current),n.invalidateQueries({queryKey:t}),F(e instanceof Error?e.message:String(e),{tone:`danger`}))}finally{--a.current}})},[n]);return(0,Q.jsx)(pv,{status:e.data,pending:e.isPending,error:e.isError,dismissals:uv(mv(t.data)?.dismissedProviderAuthFailures),onDismissAuthFailures:s})}var gv=`cez-project-rail-expanded`;function _v(e,t){return e-232-t>=640}function vv(){try{return localStorage.getItem(gv)===`1`}catch{return!1}}function yv(e){try{localStorage.setItem(gv,e?`1`:`0`)}catch{}}function bv({project:e,signal:t,known:n,truncated:r,current:i,target:a,onSwitchProject:o,onSelectProject:s}){let c=Up(e.name,t,{truncated:r,unknown:!n});return(0,Q.jsxs)(`div`,{"data-slot":`rail-project`,"data-project-id":e.id,className:`relative flex h-[52px] w-full shrink-0 items-center justify-center`,children:[i?(0,Q.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`rail-current-bar`,className:`absolute top-1/2 left-0 h-5 w-[3px] -translate-y-1/2 rounded-r-[2px] bg-foreground`}):null,(0,Q.jsxs)(`div`,{className:`relative size-9`,children:[(0,Q.jsx)(L,{to:a.href,onClick:t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||(s?.(e.id),a.verify&&o&&(t.preventDefault(),o(e.id)))},"aria-label":c,title:c,"aria-current":i?`page`:void 0,className:G(`flex size-full items-center justify-center rounded-[9px] border text-[12px] leading-none font-semibold focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,i?`border-soft-foreground bg-sidebar-row-selected text-foreground`:`border-transparent bg-muted text-muted-foreground hover:text-foreground`),children:Kp(e.name)}),(0,Q.jsx)(h_,{position:`top`,segments:g_(t).top}),(0,Q.jsx)(h_,{position:`bottom`,segments:g_(t).bottom})]})]})}var xv=`motion-safe:rail-text-in`;function Sv({project:e,signal:t,known:n,truncated:r,current:i,target:a,onSwitchProject:o,onSelectProject:s}){let c=Up(e.name,t,{truncated:r,unknown:!n}),{top:l,bottom:u}=g_(t),d=i?`border-sidebar-row-selected`:`border-background group-hover:border-sidebar-row-hover`;return(0,Q.jsx)(`div`,{"data-slot":`rail-project`,"data-project-id":e.id,className:`w-full shrink-0`,children:(0,Q.jsxs)(L,{to:a.href,onClick:t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||(s?.(e.id),a.verify&&o&&(t.preventDefault(),o(e.id)))},"aria-label":c,title:n&&r?`Counts cover recent runs only`:void 0,"aria-current":i?`page`:void 0,className:G(`group flex h-[52px] w-full items-center gap-[10px] rounded-[8px] px-[6px] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,i?`bg-sidebar-row-selected`:`hover:bg-sidebar-row-hover`),children:[(0,Q.jsxs)(`span`,{"aria-hidden":`true`,"data-slot":`rail-mark`,className:G(`relative flex size-9 shrink-0 items-center justify-center rounded-[9px] border text-[12px] leading-none font-semibold`,i?`border-soft-foreground bg-sidebar text-foreground`:`border-transparent bg-muted text-muted-foreground`),children:[Kp(e.name),(0,Q.jsx)(h_,{position:`top`,segments:l,className:d}),(0,Q.jsx)(h_,{position:`bottom`,segments:u,className:d})]}),(0,Q.jsxs)(`span`,{className:G(`flex min-w-0 flex-1 flex-col gap-px`,xv),children:[(0,Q.jsx)(`span`,{"data-slot":`rail-project-name`,className:G(`truncate text-[13.5px] leading-[18px] font-semibold`,i?`text-foreground`:`text-muted-foreground`),children:e.name}),(0,Q.jsx)(f_,{signal:t,known:n,truncated:!1,current:i,maxParts:2,slot:`rail-project-state`,className:`h-4 gap-x-[4px] overflow-hidden text-[11px] leading-4 whitespace-nowrap`})]})]})})}function Cv(e){return G(`flex shrink-0 items-center rounded-[8px] text-soft-foreground hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,e?`size-auto h-9 w-full justify-start gap-3 px-2.5 text-[13px] font-normal`:`size-9 justify-center`)}var wv=G(`truncate text-muted-foreground group-hover:text-foreground`,xv);function Tv({to:e,label:t,slot:n,active:r,expanded:i,children:a}){return(0,Q.jsxs)(L,{to:e,"data-slot":n,"aria-label":t,title:i?void 0:t,"aria-current":r?`page`:void 0,className:G(`group`,Cv(i),r&&`bg-sidebar-row-selected text-foreground hover:bg-sidebar-row-selected`),children:[a,i?(0,Q.jsx)(`span`,{className:wv,children:t}):null]})}function Ev(e){let[t,n]=Z.useState(()=>window.innerWidth);return Z.useEffect(()=>{let e=()=>n(window.innerWidth);return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),_v(t,e)}var Dv=e=>({href:String(Ha(e,`/`)),verify:!1});function Ov({projects:e,signals:t,truncated:n,version:r,singleProject:i,projectTarget:o=Dv,onSwitchProject:s,onSelectProject:c}){let{pathname:l}=a(),{resolvedTheme:u}=Hf(),d=Z.useContext(z_),[f,p]=Z.useState(vv),m=Ev(d),h=f&&m,g=()=>{let e=!h;p(e),yv(e)},_=Va(l),v=l===`/tasks`,y=l===`/settings/global`||l.startsWith(`/settings/global/`),b=r?`Cezarion v${r}`:`Cezarion`,x=Z.useId();return(0,Q.jsxs)(`nav`,{id:x,"aria-label":`Projects`,"data-slot":`project-rail`,"data-expanded":h?`true`:`false`,style:{width:h?232:60},className:G(`hidden shrink-0 flex-col overflow-hidden border-r border-border bg-background pt-3 pb-3.5 transition-[width] duration-[160ms] ease-out motion-reduce:transition-none md:flex`,h?`items-stretch px-2.5`:`items-center`),children:[h?(0,Q.jsxs)(`div`,{"data-slot":`rail-identity`,className:`flex shrink-0 flex-col gap-0.5`,children:[(0,Q.jsxs)(`div`,{className:`flex h-[34px] items-center gap-[10px] px-0.5`,children:[(0,Q.jsx)(`img`,{src:`/cezarion-mark-${u}.svg`,alt:``,"aria-hidden":`true`,"data-slot":`rail-app-mark`,className:`size-[34px] shrink-0 rounded-[8px]`}),(0,Q.jsxs)(`span`,{className:G(`flex min-w-0 items-baseline gap-[10px] whitespace-nowrap`,xv),"aria-label":b,children:[(0,Q.jsx)(`span`,{className:`text-[15px] leading-none font-bold text-foreground`,children:`Cezarion`}),r?(0,Q.jsxs)(`span`,{"data-slot":`rail-version`,title:`v${r}`,className:`min-w-0 truncate text-[11px] leading-none text-soft-foreground`,children:[`v`,r]}):null]})]}),(0,Q.jsx)(`div`,{"aria-hidden":`true`,className:`h-px w-full bg-border`}),(0,Q.jsx)(`div`,{className:G(`px-1 pt-2.5 pb-1 text-[11px] font-medium text-soft-foreground`,xv),children:`Projects`})]}):(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-col items-center gap-0.5`,children:[(0,Q.jsx)(`img`,{src:`/cezarion-mark-${u}.svg`,alt:b,title:b,"data-slot":`rail-app-mark`,className:`size-[34px] rounded-[9px]`}),(0,Q.jsx)(`div`,{"aria-hidden":`true`,className:`mt-0.5 mb-1.5 h-px w-6 bg-border`})]}),(0,Q.jsxs)(`div`,{"data-slot":`rail-projects`,className:G(`flex min-h-0 w-full flex-1 flex-col gap-0.5 overflow-y-auto overscroll-contain [scrollbar-width:none]`,h?`items-stretch`:`items-center`),children:[e.map(e=>{let r={project:e,signal:t?.get(e.id),known:t!==null,truncated:n.has(e.id),current:e.id===_,target:o(e.id),onSwitchProject:s,onSelectProject:c};return h?(0,Q.jsx)(Sv,{...r},e.id):(0,Q.jsx)(bv,{...r},e.id)}),i?null:h?(0,Q.jsx)(s_,{origin:`rail`,icon:pe,iconClassName:`size-[15px] text-soft-foreground`,iconFrameClassName:`flex size-9 shrink-0 items-center justify-center rounded-[9px] border border-border`,label:`Add project`,side:`right`,triggerClassName:G(`h-[44px] w-full shrink-0 justify-start gap-[10px] rounded-[8px] px-[6px] text-[13px] font-normal text-muted-foreground hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring motion-safe:[&>span:last-child]:rail-text-in`)}):(0,Q.jsx)(s_,{origin:`rail`,icon:pe,iconClassName:`size-[15px]`,side:`right`,triggerClassName:`shrink-0 rounded-[9px] border border-border text-soft-foreground hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`})]}),(0,Q.jsxs)(`div`,{"data-slot":`rail-bottom`,className:G(`flex shrink-0 flex-col gap-0.5 pt-2`,h?`items-stretch`:`items-center`),children:[m?(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`rail-expand-toggle`,"aria-expanded":h,"aria-controls":x,"aria-label":h?`Collapse projects`:`Expand projects`,title:h?void 0:`Expand projects`,onClick:g,className:G(`group`,Cv(h)),children:[h?(0,Q.jsx)(mc,{className:`size-4 shrink-0`,"aria-hidden":`true`}):(0,Q.jsx)(hc,{className:`size-4 shrink-0`,"aria-hidden":`true`}),h?(0,Q.jsx)(`span`,{className:wv,children:`Collapse`}):null]}):null,i?null:(0,Q.jsx)(Tv,{to:`/tasks`,label:`All projects`,slot:`rail-all-projects`,active:v,expanded:h,children:(0,Q.jsx)(O,{className:`size-4 shrink-0`,"aria-hidden":`true`})}),(0,Q.jsx)(Tv,{to:`/settings/global/appearance`,label:`Global settings`,slot:`rail-global-settings`,active:y,expanded:h,children:(0,Q.jsx)(Pr,{className:`size-4 shrink-0`,"aria-hidden":`true`})}),(0,Q.jsx)(Yg,{showLabel:h,labelClassName:wv,className:G(`group`,Cv(h),`[&_svg]:size-4`)})]})]})}function kv(){let e=U(),t=V().data?.projects,n=Ht().data,r=P().data?.capabilities.singleProject===!0,i=Z.useMemo(()=>n?Hp(n.runs):null,[n]),a=Z.useMemo(()=>new Set(n?.truncated??[]),[n?.truncated]),o=t?.map(e=>e.id).join(`
8
- `),s=Z.useRef(void 0);return Z.useEffect(()=>{o!==void 0&&(s.current!==void 0&&s.current!==o&&e.invalidateQueries({queryKey:I.runsIndex}),s.current=o)},[e,o]),Z.useMemo(()=>t?{projects:t,signals:i,truncated:a,singleProject:r}:null,[t,i,a,r])}var Av=[`needs you`,`needs permission`,`needs review`,`failed`,`working`,`queued`,`scheduled`,`done`,`cancelled`];function jv(e){switch(e){case`needs you`:return`needs you`;case`needs permission`:return`needs permission`;case`needs review`:return`needs review`;case`failed`:return`failed`;case`queued`:return`queued`;case`scheduled`:return`scheduled`;case`done`:return`done`;case`cancelled`:return`cancelled`;default:return`working`}}function Mv(e,t=2){return Nv(e.map(e=>C(e).label),t)}function Nv(e,t=2){let n=new Map;for(let t of e){let e=jv(t);n.set(e,(n.get(e)??0)+1)}return Av.filter(e=>n.has(e)).slice(0,t).map(e=>`${n.get(e)} ${e}`)}function Pv(e,t){let[n,...r]=e;if(!n)return new Set;let i=new Set(c(n,void 0,t).map(ye));for(let e of r){let n=new Set(c(e,void 0,t).map(ye));for(let e of i)n.has(e)||i.delete(e)}return i}function Fv(e,t){let n,r=-1/0;for(let t of e){let e=t.finishedAt??t.createdAt,i=Date.parse(e);Number.isFinite(i)&&i>r&&(n=e,r=i)}return Ba(n,t)}function Iv(e,t,n){return{families:Mv(e),shared:Pv(e,n),age:Fv(e,t)}}function Lv(e,t){let n=e?Date.parse(e):NaN;if(!Number.isFinite(n)||n<=t)return`scheduled`;let r=Math.max(1,Math.floor((n-t)/6e4));if(r<60)return`resumes in ${r}m`;let i=new Date(n),a=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`}).format(i);return n-t<864e5?`resumes ${a}`:`resumes ${new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`}).format(i)} ${a}`}var Rv=`(hover: none)`;function zv(){let[e,t]=(0,Z.useState)(()=>typeof window.matchMedia==`function`&&window.matchMedia(Rv).matches);return(0,Z.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia(Rv);t(e.matches);let n=e=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function Bv({runs:e,view:t,onViewChange:n,currentRunId:r=null,currentGroupId:i=null,now:a=Date.now(),showTokens:o=!0,showCost:s=!0,onTogglePin:c,showViewControls:l=!0,rowLimit:u}){let d=Rn(e),f=u===void 0?Zn(e,t):jn(Zn(e,t),u),p=t===`archived`?void 0:c;return(0,Q.jsxs)(`div`,{"data-slot":`quick-list`,children:[(0,Q.jsxs)(`div`,{"data-slot":`quick-list-header`,className:`flex min-h-11 items-center gap-1.5 pr-[6px] pl-[10px] md:min-h-[26px]`,children:[(0,Q.jsx)(`h2`,{className:`text-[13px] font-semibold text-foreground`,children:`Tasks`}),(0,Q.jsx)(`span`,{className:`text-[11.5px] text-soft-foreground`,children:d[t]}),(0,Q.jsxs)(X,{to:`/`,className:`ml-auto flex min-h-11 items-center gap-0.5 text-[12px] text-soft-foreground hover:text-foreground md:min-h-[26px]`,children:[`All`,(0,Q.jsx)(St,{className:`size-[13px]`,"aria-hidden":`true`})]})]}),l?(0,Q.jsx)(`div`,{className:`sticky top-0 z-10 bg-sidebar pt-2 pb-1`,children:(0,Q.jsxs)(`div`,{className:`inline-flex w-full gap-0.5 rounded-md bg-muted p-[2px]`,children:[(0,Q.jsxs)(Hv,{view:`active`,current:t,onSelect:n,count:d.active,children:[`Active`,d.waiting>0&&t!==`active`?(0,Q.jsx)(q,{tone:`pending`,pulse:!0,"data-slot":`waiting-dot`,"aria-label":`needs you`}):null]}),(0,Q.jsx)(Hv,{view:`archived`,current:t,onSelect:n,count:d.archived,children:`Archived`})]})}):null,f.length===0?(0,Q.jsx)(`p`,{className:`px-3 py-3.5 text-xs text-soft-foreground`,children:t===`archived`?`Nothing archived yet.`:`No tasks yet — describe one.`}):(0,Q.jsx)(Vv,{buckets:f,currentRunId:dr(r,e),currentGroupId:i,now:a,showTokens:o,showCost:s,onTogglePin:p})]})}function Vv({buckets:e,currentRunId:t=null,currentGroupId:n=null,now:r=Date.now(),scope:i=null,showTokens:a=!0,showCost:o=!0,onTogglePin:s}){let[c,l]=Z.useState(()=>new Set),u=e=>l(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n}),d=e=>(0,Q.jsx)(Uv,{row:e,currentRunId:t,currentGroupId:n,now:r,scope:i,showTokens:a,showCost:o,expanded:e.kind===`group`&&c.has(e.groupId),onToggle:u,onTogglePin:s});return(0,Q.jsx)(`div`,{className:`flex flex-col gap-3`,children:e.map(e=>(0,Q.jsxs)(`div`,{"data-slot":`quick-list-bucket`,"data-bucket":e.label,children:[(0,Q.jsxs)(`h2`,{className:`px-[10px] pt-[2px] pb-[4px] text-[11px] font-medium text-soft-foreground`,children:[e.label,` `,(0,Q.jsx)(`span`,{className:`text-[11px] font-normal tabular-nums`,children:e.rows.length})]}),e.rows.map(e=>(0,Q.jsx)(`div`,{children:d(e)},e.kind===`group`?e.groupId:e.run.id))]},e.label))})}function Hv({view:e,current:t,onSelect:n,count:r,children:i}){let a=e===t;return(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`view-tab`,"data-view":e,"aria-pressed":a,onClick:()=>n(e),className:G(`flex min-h-11 min-w-0 flex-1 items-center justify-center gap-1.5 rounded-[7px] text-[11px] font-medium text-muted-foreground md:min-h-[22px]`,a&&`bg-card font-semibold text-foreground shadow-xs`),children:[i,r>0?(0,Q.jsx)(`span`,{className:`font-mono text-[11px] tabular-nums`,children:r}):null]})}function Uv({row:e,currentRunId:t,currentGroupId:n,now:r,scope:i,expanded:a,onToggle:o,showTokens:s,showCost:c,onTogglePin:l}){return e.kind===`run`?(0,Q.jsx)(ey,{run:e.run,queuePosition:e.queuePosition,currentRunId:t,now:r,scope:i,showTokens:s,showCost:c,onTogglePin:l}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Gv,{row:e,now:r,scope:i,expanded:a,onToggle:o,active:n===e.groupId||!a&&e.members.some(e=>e.id===t)}),a?(0,Q.jsx)(Kv,{members:e.members,currentRunId:t,now:r,scope:i,showTokens:s,showCost:c,onTogglePin:l}):null]})}function Wv(){let e=zv(),t=Qi();return e||!t}function Gv({row:e,now:t,scope:n,expanded:r,onToggle:i,active:a}){let o=C(e.lead),s=n??void 0,{families:l,shared:u,age:d}=Iv(e.members,t,s),f=Wv(),p=e.members[0],m=c(p,void 0,s).filter(e=>u.has(ye(e))),h=[...l.map(e=>(0,Q.jsx)(`span`,{children:e},`family-${e}`)),...m.map(e=>(0,Q.jsx)(ui,{run:p,reference:e,plain:!0,inert:f},`${e.kind}-${e.number}-${e.url}`)),...d?[(0,Q.jsx)(`span`,{className:`tabular-nums`,children:d},`age`)]:[]],g=r?pt:St,_=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{"data-slot":`group-title`,className:G(`min-w-0 truncate text-[13px] leading-[1.45] font-medium text-muted-foreground`,a&&`text-foreground`),children:e.title}),(0,Q.jsxs)(`span`,{"data-slot":`group-count`,className:`shrink-0 rounded-[9px] bg-muted px-1.5 py-px font-mono text-[11px] leading-[1.3] font-semibold tabular-nums text-muted-foreground`,children:[`×`,e.members.length]})]}),v=G(`block h-[16px] w-full min-w-0 truncate text-[11.5px] leading-[1.4] font-normal text-soft-foreground`,a&&`text-muted-foreground`),y=h.length?h.flatMap((e,t)=>t?[(0,Q.jsx)($v,{},`sep-${t}`),e]:[e]):`\xA0`,b=`w-full min-w-0 rounded-[2px] text-left focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground`;return(0,Q.jsxs)(`div`,{"data-slot":`group-row`,"data-group-id":e.groupId,"data-active":a?`true`:void 0,"data-structure":f?`touch`:`pointer`,onClick:t=>{t.currentTarget.contains(t.target)&&(t.target.closest(`a, button`)||i(e.groupId))},className:G(`selection-row flex cursor-pointer items-start gap-2.5 rounded-[6px] py-1.5 pr-2 pl-2.5 hover:bg-sidebar-row-hover`,f&&`py-0`,a&&`bg-sidebar-row-selected hover:bg-sidebar-row-selected`),children:[(0,Q.jsx)(`span`,{"data-slot":`task-row-dot`,className:G(`flex h-[19px] w-[12px] shrink-0 items-center justify-center`,f&&`mt-1.5`),children:(0,Q.jsx)(q,{tone:o.tone,shape:o.shape,pulse:o.pulse,"aria-label":o.label,title:o.label,role:`img`})}),f?(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`group-tile`,"data-group-id":e.groupId,"aria-expanded":r,onClick:()=>i(e.groupId),className:G(`flex flex-1 flex-col py-1.5`,b),children:[(0,Q.jsx)(`span`,{className:`flex h-[19px] w-full min-w-0 items-center gap-1.5`,children:_}),(0,Q.jsx)(`span`,{"data-slot":`group-meta`,className:v,children:y})]}):(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Q.jsx)(`button`,{type:`button`,"data-slot":`group-tile`,"data-group-id":e.groupId,"aria-expanded":r,onClick:()=>i(e.groupId),className:G(`flex h-[19px] items-center gap-1.5`,b),children:_}),(0,Q.jsx)(`div`,{"data-slot":`group-meta`,className:v,children:y})]}),(0,Q.jsxs)(`span`,{"data-slot":`group-trailing`,className:G(`flex h-[19px] w-[36px] shrink-0 items-center justify-end gap-0.5 no-hover:h-auto no-hover:w-[60px] no-hover:self-stretch`,f&&`mt-1.5 no-hover:mt-0`),children:[(0,Q.jsx)(X,{to:Ha(n,`/compare/${e.groupId}`),"data-slot":`group-compare`,title:`Compare the variants`,"aria-label":`Compare the variants of ${e.title}`,className:`inline-flex size-[18px] shrink-0 items-center justify-center rounded-sm text-soft-foreground hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-link-foreground no-hover:size-[44px] no-hover:min-h-[44px] no-hover:min-w-[44px]`,children:(0,Q.jsx)(_c,{className:`size-[14px]`,"aria-hidden":`true`})}),(0,Q.jsx)(`span`,{"data-slot":`group-disclosure`,"data-expanded":r?`true`:`false`,"aria-hidden":`true`,className:`inline-flex size-[14px] shrink-0 items-center justify-center text-soft-foreground`,children:(0,Q.jsx)(g,{className:`size-[14px]`})})]})]})}function Kv({members:e,currentRunId:t,now:n,scope:r,showTokens:i,showCost:a,onTogglePin:o}){let s=Pv(e,r??void 0),l=(0,Q.jsx)(`div`,{"data-slot":`variant-list`,className:`ml-[15.5px] border-l border-border pl-[6px]`,children:e.map(e=>(0,Q.jsx)(ey,{run:e,queuePosition:null,currentRunId:t,now:n,scope:r,variant:!0,groupReferences:s,showTokens:i,showCost:a,onTogglePin:o},e.id))});return r?(0,Q.jsx)(mi,{projectId:r,requests:e.flatMap(e=>c(e).map(e=>({projectId:r,kind:e.kind,number:e.number}))),children:l}):l}var qv=`opacity-0 group-hover/task-row:opacity-100 focus-visible:opacity-100 group-has-[:focus-visible]/task-row:opacity-100 no-hover:opacity-100`,Jv=`transition-opacity motion-reduce:transition-none group-hover/task-row:opacity-0 group-has-[:focus-visible]/task-row:opacity-0 max-md:absolute max-md:top-1/2 max-md:left-0 max-md:-translate-y-1/2 max-md:opacity-100 no-hover:absolute no-hover:top-1/2 no-hover:left-0 no-hover:-translate-y-1/2 no-hover:opacity-100`;function Yv(e,t,n){let[r,i]=Z.useState(!1);return Z.useLayoutEffect(()=>{let n=e.current;if(!t||!n||typeof ResizeObserver>`u`)return;let r=()=>i(n.scrollWidth>n.clientWidth);r();let a=new ResizeObserver(r);return a.observe(n),document.fonts?.ready.then(r),()=>a.disconnect()},[e,t,n]),r}function Xv(e){let t=document.createRange();t.selectNodeContents(e);let n=t.getBoundingClientRect?.().width;return n?Math.ceil(n):e.scrollWidth}function Zv(e,t,n){let[r,i]=Z.useState(!1),[a,o]=Z.useState(0),s=Z.useRef(!1),c=Z.useRef(!1),l=Z.useRef(null),u=Z.useCallback(e=>{s.current=e,i(e)},[]);return Z.useLayoutEffect(()=>{let r=e.current;if(!t||!r||typeof ResizeObserver>`u`){l.current=null,u(!1);return}let i=!0,a=()=>{if(i){if(l.current?.key!==n){if(s.current){u(!1),o(e=>e+1);return}l.current={key:n,width:Xv(r)}}u(l.current.width>r.clientWidth)}};a();let d=new ResizeObserver(a);d.observe(r);let f=new WeakMap,p=new ResizeObserver(e=>{let t=!1;for(let n of e??[]){let e=n.borderBoxSize?.[0]?.inlineSize??n.contentRect.width,r=f.get(n.target);f.set(n.target,e),r!==void 0&&r!==e&&(t=!0)}!t||!i||(l.current=null,a())}),m=new Set,h=()=>{let e=!1;for(let t of Array.from(r.children)){let{slot:n}=t.dataset;n===`task-row-age`||t.getAttribute(`aria-hidden`)===`true`||m.has(t)||(m.add(t),f.set(t,t.getBoundingClientRect().width),p.observe(t),e=!0)}return e};h();let g=typeof MutationObserver>`u`?null:new MutationObserver(()=>{!h()||!i||(l.current=null,a())});return g?.observe(r,{childList:!0}),document.fonts&&document.fonts.status!==`loaded`&&!c.current&&document.fonts.ready.then(()=>{c.current=!0,i&&(l.current=null,a())}),()=>{i=!1,d.disconnect(),p.disconnect(),g?.disconnect()}},[e,t,n,a,u]),t&&r}function Qv(e,t,n,r){let{label:i}=e;if(i===`queued`)return t===null?i:`queued #${t}`;if(!(i===`needs you`||i===`done`||i===`cancelled`))return i===`scheduled`?Lv(n.autoResumeAt,r):i}function $v(){return(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:` · `})}function ey({run:e,queuePosition:t,currentRunId:n,now:r,scope:i,variant:a=!1,groupReferences:o,showTokens:s,showCost:l,onTogglePin:u}){let d=Ua(),f=Wv(),p=Ha(i,`/tasks/${e.id}`),m=C(e),h=e.id===n,g=Be(e),_=c(e,void 0,i??void 0).filter(e=>!o?.has(ye(e))),v=wn(e),y=Gt(v,g?.number)?nn(v).rest:v,b=ii(e),x=a||t!==null?``:Ba(e.finishedAt??e.createdAt,r),S=Qv(m,t,e,r),w=a&&s&&(e.inputTokens!==void 0||e.outputTokens!==void 0)?Yo(e.inputTokens,e.outputTokens):``,T=a&&l?j(e.costUsd):``,E=Z.useRef(null),ee=Yv(E,a,`${e.runner}|${T}`),D=Z.useRef(null),O=Zv(D,!!x,`${x}|${S??``}|${_.map(e=>`${e.kind}-${e.number}-${e.url}`).join(`,`)}|${+!!e.notify}`),k=[];S&&k.push((0,Q.jsx)(`span`,{"data-slot":`task-row-state`,children:S},`state`));for(let t of _)k.push((0,Q.jsx)(ui,{run:e,reference:t,plain:!0,inert:f},`${t.kind}-${t.number}-${t.url}`));return x&&!O&&k.push((0,Q.jsx)(`span`,{"data-slot":`task-row-age`,className:`tabular-nums`,children:x},`age`)),w&&!ee&&k.push((0,Q.jsx)(`span`,{"data-slot":`task-row-tokens`,className:`tabular-nums`,children:w},`tokens`)),a&&!k.length&&m.label===`needs you`&&k.push((0,Q.jsx)(`span`,{"data-slot":`task-row-state`,children:m.label},`state`)),(0,Q.jsxs)(`div`,{"data-slot":`task-row`,"data-run-id":e.id,"data-active":h?`true`:void 0,onClick:e=>{e.currentTarget.contains(e.target)&&(e.target.closest(`a, button, input`)||d(p))},className:G(`selection-row group/task-row flex cursor-pointer items-start gap-2.5 rounded-[6px] py-1.5 pr-2 pl-2.5 hover:bg-sidebar-row-hover`,h&&`bg-sidebar-row-selected hover:bg-sidebar-row-selected`),children:[(0,Q.jsx)(`span`,{"data-slot":`task-row-dot`,className:`flex h-[19px] w-[12px] shrink-0 items-center justify-center`,children:(0,Q.jsx)(q,{tone:m.tone,shape:m.shape,pulse:m.pulse,"aria-label":m.label,title:m.label,role:`img`})}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Q.jsxs)(X,{to:p,title:v,"aria-current":h?`page`:void 0,className:`flex h-[19px] min-w-0 items-center gap-2 rounded-[2px] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground`,children:[a?(0,Q.jsx)(`span`,{"data-slot":`task-row-variant-letter`,className:G(`inline-flex size-[16px] shrink-0 items-center justify-center rounded-full bg-muted font-mono text-[10.5px] font-semibold text-muted-foreground`,h&&`bg-sidebar text-foreground`),children:e.variant??`?`}):null,(0,Q.jsx)(`span`,{ref:a?E:void 0,"data-slot":`task-row-title`,className:G(`min-w-[7rem] flex-1 truncate text-[13px] leading-[1.45] font-medium text-muted-foreground`,a&&`min-w-0`,b&&`font-semibold text-foreground`,h&&`text-foreground`),children:a?(0,Q.jsxs)(Q.Fragment,{children:[e.runner??`claude`,T?(0,Q.jsxs)(Q.Fragment,{children:[` · `,(0,Q.jsx)(`span`,{"data-slot":`variant-cost`,children:T})]}):null]}):y}),e.diffStat?(0,Q.jsx)(Jo,{stat:e.diffStat,className:`hidden shrink-0 text-[12px] @min-[23rem]/sidebar:inline`}):null]}),(0,Q.jsxs)(`div`,{ref:D,"data-slot":`task-row-meta`,className:G(`h-[16px] min-w-0 truncate text-[11.5px] leading-[1.4] font-normal text-soft-foreground`,h&&`text-muted-foreground`),children:[e.notify===!0?(0,Q.jsx)(`span`,{"data-slot":`task-row-notify`,role:`img`,"aria-label":`Notifying the task webhook`,title:`Notifying the task webhook`,className:`mr-[4px] inline-block shrink-0 align-[-1px]`,children:(0,Q.jsx)(ei,{"aria-hidden":`true`,className:`size-[10px]`})}):null,k.length?k.flatMap((e,t)=>t?[(0,Q.jsx)($v,{},`sep-${t}`),e]:[e]):e.notify===!0?null:`\xA0`]})]}),e.delegation?.role===`worker`?(0,Q.jsxs)(`span`,{className:`sr-only`,children:[`Worker · `,m.label]}):null,(0,Q.jsxs)(`span`,{"data-slot":`task-row-trailing`,className:`relative flex h-[19px] w-[16px] shrink-0 items-center justify-center max-md:h-auto max-md:w-11 max-md:self-stretch no-hover:h-auto no-hover:w-11 no-hover:self-stretch`,children:[b?(0,Q.jsx)(q,{tone:Yr(e),role:`img`,"aria-label":`unread`,title:`Unread — not opened since it finished`,"data-slot":`unread-marker`,className:u?Jv:void 0}):null,u?(0,Q.jsx)(hm,{pinned:!!e.pinned,onToggle:t=>u(e,t),className:G(`absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2`,qv)}):null]})]})}function ty({showViewControls:e=!0,projectId:t,boot:n=!1}){let r=t??Gr(),i=ie(r,!0,n),a=Ue(r,n?`default`:r),o=Qo(P().data),[s,l]=sv(),u=Ia(`/tasks/:id/*`),d=Ia(`/tasks/:id`),f=Ia(`/compare/:groupId`),p=Ho(3e4),m=Tt(),h=t??m,g=se(h),_=jn(Zn(i.data??[],s),10),v=h===void 0?[]:_.flatMap(e=>e.rows.flatMap(e=>c(e.kind===`run`?e.run:e.members[0]).map(e=>({projectId:h,kind:e.kind,number:e.number}))));return i.data?(0,Q.jsx)(mi,{projectId:h,repoBase:g,requests:v,children:(0,Q.jsx)(Bv,{showViewControls:e,rowLimit:10,runs:i.data,view:s,onViewChange:l,currentRunId:u?.params.id??d?.params.id??null,currentGroupId:f?.params.groupId??null,now:p,showTokens:o.tokens,showCost:o.cost,onTogglePin:(e,t)=>a.mutate({id:e.id,pinned:t})})}):null}var ny={claude:!0,codex:!0,opencode:!0,pi:!0,cursor:!0},ry=e=>Object.hasOwn(ny,e.name);function iy(e){let t=e.checks.filter(ry);if(t.length&&!t.some(e=>e.available))return`no agent CLI found — install one to run tasks`;let n=t.find(t=>t.name===e.defaultRunner);return n&&!n.available?`default runner (${e.defaultRunner}) not found`:null}function ay(e){let t=`cezar v${e.version}`,n=iy(e);if(n)return`${t} · ${n}`;let r=e.checks.filter(e=>!e.available).map(e=>e.name);return r.length?`${t} · optional: ${r.join(`, `)} not installed`:t}function oy(e){return e.forge?.available?null:e.forge?`GitHub is unreachable — ${e.forge.reason??`unknown reason`}. The GitHub tab is hidden until it comes back.`:`No GitHub remote detected — the GitHub tab is hidden. Every plain-git feature still works.`}function sy({health:e,sessionScope:t}){if(!e)return null;let n=iy(e);return(0,Q.jsxs)(uo,{children:[(0,Q.jsx)(so,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`tools-menu-trigger`,"aria-label":`Tools`,title:ay(e),className:`relative flex items-center gap-1.5 rounded-[6px] px-2 py-1.5 text-[12px] font-normal text-soft-foreground transition-colors hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring data-[state=open]:bg-sidebar-row-selected data-[state=open]:text-foreground`,children:[(0,Q.jsx)($t,{className:`size-[15px]`,"aria-hidden":`true`}),n?(0,Q.jsx)(q,{tone:`pending`,className:`absolute top-1 left-5 size-1.5`}):null,`Tools`]})}),(0,Q.jsxs)(co,{side:`top`,align:`start`,"data-slot":`tools-menu-content`,className:`w-[240px]`,children:[t?(0,Q.jsx)(`div`,{className:`px-2 py-2`,children:t}):null,(0,Q.jsx)(Xa,{className:`text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:`Installed tools`}),e.checks.map(e=>e.available?(0,Q.jsx)(cy,{check:e},e.name):(0,Q.jsx)(ly,{check:e},e.name)),oy(e)?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(io,{}),(0,Q.jsx)(`p`,{"data-slot":`forge-note`,className:`px-2 py-1.5 text-[11px] leading-snug text-muted-foreground`,children:oy(e)})]}):null,(0,Q.jsx)(io,{}),(0,Q.jsx)(ro,{asChild:!0,children:(0,Q.jsx)(L,{to:`/tools`,children:`Tools diagnostics`})}),(0,Q.jsx)(ro,{asChild:!0,children:(0,Q.jsxs)(X,{to:tg,"data-slot":`tools-settings`,className:`gap-2 text-[13px] text-muted-foreground`,children:[(0,Q.jsx)(_,{className:`size-3.5`,"aria-hidden":`true`}),`Tool settings`]})})]})]})}function cy({check:e}){return(0,Q.jsxs)(`div`,{"data-slot":`tool-row`,"data-tool":e.name,"data-available":`true`,className:`flex items-center gap-2 rounded-sm px-2 py-1.5`,children:[(0,Q.jsx)(q,{tone:Qh(e)}),(0,Q.jsx)(`span`,{className:`font-mono text-[13px] font-medium`,children:e.name}),(0,Q.jsx)(`span`,{"data-slot":`tool-version`,className:`ml-auto font-mono text-[11px] font-medium text-muted-foreground tabular-nums`,children:e.version??`not found`})]})}function ly({check:e}){let t=eg(e);return(0,Q.jsx)(ro,{asChild:!0,children:(0,Q.jsxs)(X,{to:tg,"data-slot":`tool-row`,"data-tool":e.name,"data-available":`false`,className:`flex-col items-stretch gap-1`,children:[(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(q,{tone:Qh(e)}),(0,Q.jsx)(`span`,{className:`font-mono text-[13px] font-medium`,children:e.name}),(0,Q.jsx)(`span`,{"data-slot":`tool-version`,className:`ml-auto font-mono text-[11px] font-medium text-muted-foreground`,children:`not found`})]}),(0,Q.jsxs)(`span`,{className:`flex items-end justify-between gap-3 pl-[15px]`,children:[t?(0,Q.jsx)(`span`,{"data-slot":`tool-hint`,className:`min-w-0 text-[11px] leading-snug text-muted-foreground`,children:t}):null,(0,Q.jsx)(`span`,{"data-slot":`tool-setup`,className:`ml-auto shrink-0 text-[11px] font-semibold text-accent-text`,children:`Set up →`})]})]})})}function uy(e){return e?.trim()||null}function dy({projectName:e,pageLabel:t}){let n=uy(e),r=uy(t);return n&&r?`${n} — ${r} · cezar`:n?`${n} · cezar`:r?`${r} · cezar`:`cezar`}function fy(e){let t=dy(e);(0,Z.useEffect)(()=>{document.title=t},[t])}function py(e){let t=Fa(e);return/^\/git\/branches(?:\/|$)/.test(t)?`branches`:/^\/git\/not-landed(?:\/|$)/.test(t)?`not-landed`:/^\/git\/cleanup(?:\/|$)/.test(t)?`cleanup`:/^\/git\/changes(?:\/|$)/.test(t)?`changes`:/^\/git(?:\/commits(?:\/[^/]+)?)?\/?$/.test(t)?`main`:null}var my={main:`/git`,"not-landed":`/git/not-landed`,cleanup:`/git/cleanup`,branches:`/git/branches`,changes:`/git/changes`},hy=`/git?view=repo`,gy={second:`s`,minute:`m`,hour:`h`,day:`d`,week:`w`,month:`mo`,year:`y`};function _y(e){let t=/^(\d+) (second|minute|hour|day|week|month|year)s? ago$/.exec(e.trim());return t?`${t[1]}${gy[t[2]]}`:e}function vy(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}var yy=new Intl.DateTimeFormat(`en-US`,{weekday:`short`,month:`short`,day:`numeric`}),by=new Intl.DateTimeFormat(`en-US`,{month:`short`,day:`numeric`,year:`numeric`});function xy(e,t){let n=Date.parse(e);if(Number.isNaN(n))return`Earlier`;let r=vy(t);if(n>=r)return`Today`;if(n>=vy(r-1))return`Yesterday`;let i=new Date(n);return(i.getFullYear()===new Date(t).getFullYear()?yy:by).format(i)}function Sy(e,t=Date.now()){let n=[];for(let r of e){let e=xy(r.at,t),i=n.at(-1);i?.label===e?i.commits.push(r):n.push({label:e,commits:[r]})}return n}function Cy(e,t=Date.now()){return e.filter(e=>xy(e.at,t)===`Today`).length}function wy(e,t){return(e.baseBranch??t.branch)===t.branch?e.tracking:null}function Ty(e,t=Date.now()){let n=e.fetchedAt?Ba(e.fetchedAt,t):``;return n?`fetched ${n} ago`:`never fetched`}function Ey(e,t){let n=U(),r=[e,`repo`],i=[e,`health`],[a,o]=(0,Z.useState)(null),s=e=>F(e.message,{tone:`danger`}),c=()=>Promise.all([n.invalidateQueries({queryKey:r}),n.invalidateQueries({queryKey:i}),n.invalidateQueries({queryKey:I.projects})]),l=H({mutationFn:t=>an(t,e)}),u=async(e=!1)=>{let n=a?.branch??t.branch;try{let t=await l.mutateAsync(e?{branch:n,confirm:!0}:{branch:n});if(`risks`in t){o(t);return}o(null),F(t.summary),await c()}catch(e){o(null),F(e instanceof Error?e.message:String(e),{tone:`danger`}),await c()}},d=H({mutationFn:t=>Re({name:t},e),onSuccess:async e=>{F(e.created?`Created and switched to ${e.branch}`:`Switched to ${e.branch}`),await c(),n.setQueryData(r,t=>t?.info?{...t,info:{...t.info,branch:e.branch}}:t),n.setQueryData(i,n=>n?.repo?.root===t.root?{...n,repo:{...n.repo,branch:e.branch}}:n)},onError:s}),f=H({mutationFn:t=>mr({baseBranch:t},e),onSuccess:t=>{F(t.baseBranch?`New tasks now start from ${t.baseBranch}`:`New tasks now start from the checked-out branch`),n.invalidateQueries({queryKey:r}),n.invalidateQueries({queryKey:[e,`config`]})},onError:s});return{hasRemote:!!t.remote,pull:u,pulling:l.isPending,confirmation:a,dismissConfirmation:()=>{l.isPending||o(null)},switchBranch:d,setBase:f}}var Dy={sidebar:{card:`gap-[8px] rounded-[8px] p-[10px]`,branchRow:`gap-[6px]`,branchIcon:`size-[14px]`,branch:`text-[12.5px]`,chevron:`size-[12px]`,pull:`h-[24px] gap-[4px] rounded-[6px] px-[8px] text-[11.5px] [&>svg]:size-[12px]`,line:`text-[11px]`,lineChevron:`size-[11px]`,dirty:`gap-[6px] pt-[6px] text-[11px] [&>svg]:size-[12px]`},screen:{card:`gap-[10px] rounded-[10px] p-[12px]`,branchRow:`gap-[8px]`,branchIcon:`size-[16px]`,branch:`text-[14px]`,chevron:`size-[14px]`,pull:`h-[36px] gap-[6px] rounded-[8px] px-[14px] text-[13px] [&>svg]:size-[14px]`,line:`text-[12px]`,lineChevron:`size-[12px]`,dirty:`h-[40px] gap-[8px] pt-[4px] text-[13px] [&>svg:first-child]:size-[14px] [&>svg:last-child]:size-[15px]`}};function Oy({scope:e,repo:t,info:n,variant:r,onNavigate:i}){let a=Dy[r],o=Ey(e,n),s=t.baseBranch??n.branch,c=t.status.length,l=wy(t,n),u=o.switchBranch.isPending,d=(0,Z.useRef)(null);return(0,Q.jsxs)(`section`,{"aria-label":`Checkout`,"data-slot":`git-checkout`,"data-variant":r,className:G(`flex flex-col border border-border`,a.card),children:[(0,Q.jsxs)(`div`,{className:G(`flex min-w-0 items-center`,a.branchRow),children:[(0,Q.jsxs)(uo,{children:[(0,Q.jsxs)(so,{"data-slot":`git-branch-menu`,"aria-label":`Branch ${n.branch}. Switch branch`,disabled:u,className:G(`group flex min-w-0 flex-1 items-center rounded-[4px] text-left outline-none focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-60`,a.branchRow,r===`screen`&&`min-h-11`),children:[(0,Q.jsx)(cn,{"aria-hidden":`true`,className:G(`shrink-0 text-muted-foreground`,a.branchIcon)}),(0,Q.jsx)(`span`,{"data-slot":`git-checkout-branch`,className:G(`min-w-0 flex-1 truncate font-mono font-semibold text-foreground`,a.branch),children:n.branch}),(0,Q.jsx)(pt,{"aria-hidden":`true`,className:G(`shrink-0 text-soft-foreground group-hover:text-foreground`,a.chevron)})]}),(0,Q.jsxs)(co,{align:`start`,className:`w-64`,children:[(0,Q.jsx)(Xa,{className:`text-xs text-soft-foreground`,children:`Switch branch`}),(0,Q.jsx)(lo,{value:n.branch,onValueChange:e=>{e!==n.branch&&o.switchBranch.mutate(e)},children:t.branches.map(e=>(0,Q.jsx)(Qa,{value:e,"data-branch":e,className:`font-mono text-[12.5px]`,children:(0,Q.jsx)(`span`,{className:`truncate`,children:e})},e))}),(0,Q.jsx)(io,{}),(0,Q.jsx)(ro,{asChild:!0,children:(0,Q.jsx)(X,{to:my.branches,"data-slot":`git-branch-menu-all`,onClick:i,children:`Create or find a branch…`})})]})]}),(0,Q.jsxs)(`button`,{ref:d,type:`button`,"data-action":`repo-pull`,disabled:!o.hasRemote||o.pulling,title:o.hasRemote?`Pull ${n.branch}`:`No remote configured. Add a Git remote before pulling.`,onClick:()=>void o.pull(),className:G(`inline-flex shrink-0 items-center bg-muted font-medium text-foreground hover:brightness-110 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 disabled:hover:brightness-100`,a.pull),children:[o.pulling?(0,Q.jsx)(La,{"aria-hidden":`true`,className:`motion-safe:animate-spin`}):(0,Q.jsx)(ae,{"aria-hidden":`true`}),`Pull`]})]}),l?(0,Q.jsx)(ky,{tracking:l,className:a.line}):null,(0,Q.jsxs)(uo,{children:[(0,Q.jsxs)(so,{"data-slot":`base-branch-picker`,"aria-label":`New tasks start from ${s}. Change the base branch`,disabled:o.setBase.isPending,className:G(`group flex min-w-0 items-center gap-[4px] self-start rounded-[4px] text-soft-foreground outline-none hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-60`,a.line,r===`screen`&&`min-h-[32px]`),children:[(0,Q.jsx)(`span`,{className:`shrink-0`,children:`New tasks start from`}),(0,Q.jsx)(`span`,{"data-slot":`base-branch`,className:`min-w-0 truncate font-mono text-muted-foreground group-hover:text-foreground`,children:s}),(0,Q.jsx)(pt,{"aria-hidden":`true`,className:G(`shrink-0`,a.lineChevron)})]}),(0,Q.jsxs)(co,{align:`start`,className:`w-64`,children:[(0,Q.jsx)(Xa,{className:`text-xs text-soft-foreground`,children:`New tasks start from`}),(0,Q.jsxs)(lo,{value:t.baseBranch??``,onValueChange:e=>o.setBase.mutate(e===``?null:e),children:[(0,Q.jsx)(Qa,{value:``,"data-branch":``,className:`text-[12.5px]`,children:`The checked-out branch (default)`}),t.branches.map(e=>(0,Q.jsx)(Qa,{value:e,"data-branch":e,className:`font-mono text-[12.5px]`,children:(0,Q.jsx)(`span`,{className:`truncate`,children:e})},e))]})]})]}),c>0?(0,Q.jsxs)(X,{to:my.changes,"data-slot":`git-uncommitted`,onClick:i,className:G(`flex min-w-0 items-center border-t border-border text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,a.dirty),children:[(0,Q.jsx)(xt,{"aria-hidden":`true`,className:`shrink-0 text-inbox-count-foreground`}),(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[c,` uncommitted file`,c===1?``:`s`]}),(0,Q.jsx)(St,{"aria-hidden":`true`,className:`shrink-0 text-soft-foreground`})]}):null,(0,Q.jsx)(Ay,{checkout:o,returnFocus:d})]})}function ky({tracking:e,className:t}){let n=e.ref.split(`/`)[0]||e.ref,r=Ty(e);return(0,Q.jsx)(`p`,{"data-slot":`git-freshness`,className:G(`flex min-w-0 items-center gap-[4px] text-soft-foreground`,t),children:e.behind>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`span`,{"data-slot":`git-behind`,className:`shrink-0 font-medium text-inbox-count-foreground`,children:[e.behind,` behind `,n]}),(0,Q.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`· `,r]})]}):(0,Q.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`up to date · `,r]})})}function Ay({checkout:e,returnFocus:t}){return(0,Q.jsx)(rr,{open:e.confirmation!==null,onOpenChange:t=>!t&&e.dismissConfirmation(),children:(0,Q.jsxs)(pn,{onCloseAutoFocus:e=>{e.preventDefault(),t.current?.focus()},children:[(0,Q.jsxs)($n,{children:[(0,Q.jsxs)(Ut,{children:[`Pull `,e.confirmation?.branch,` anyway?`]}),(0,Q.jsx)(Mt,{asChild:!0,children:(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[e.confirmation?.risks.includes(`active_runs`)?(0,Q.jsx)(`p`,{children:`An active session is using this repository. Pulling can change files while it works.`}):null,e.confirmation?.risks.includes(`dirty_tree`)?(0,Q.jsx)(`p`,{children:`The checkout has dirty files. Git may refuse the pull to protect them.`}):null]})})]}),(0,Q.jsxs)(In,{children:[(0,Q.jsx)(Xn,{className:`h-11`,disabled:e.pulling,children:`Cancel`}),(0,Q.jsx)(An,{className:`h-11`,disabled:e.pulling||e.confirmation===null,onClick:t=>{t.preventDefault(),e.pull(!0)},children:e.pulling?`Pulling…`:`Pull anyway`})]})]})})}var jy={main:jt,"not-landed":ac,cleanup:Hs,branches:cn};function My(e,t){switch(e){case`main`:return t?`Recently on ${t}`:`Recent commits`;case`not-landed`:return`Not landed`;case`cleanup`:return`Cleanup`;case`branches`:return`All branches`;case`changes`:return`Uncommitted changes`}}var Ny=[`main`,`not-landed`,`cleanup`,`branches`];function Py({branch:e,counts:t,variant:n,active:r,onNavigate:i}){let a=n===`screen`;return(0,Q.jsx)(`nav`,{"aria-label":`Git sections`,"data-slot":`git-sections`,className:a?Mi:ji,children:Ny.map(n=>{let o=jy[n],s=!a&&r===n,c=t[n];return(0,Q.jsxs)(X,{to:a&&n===`main`?hy:my[n],"data-git-section":n,"aria-current":s?`page`:void 0,onClick:i,className:G(a?Ni:G(Li,`text-[12.5px]`),Ii,s&&`bg-sidebar-row-selected text-foreground font-medium hover:bg-sidebar-row-selected`),children:[(0,Q.jsx)(o,{"aria-hidden":`true`,className:a?Ui:zi}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:My(n,e)}),c?(0,Q.jsx)(`span`,{"data-slot":`git-section-count`,className:a?Ri:Pi,children:c}):null,a?(0,Q.jsx)(St,{"aria-hidden":`true`,className:Hi}):null]},n)})})}function Fy({repo:e,info:t}){let n=P(),r=It(),i=new Map((r.data?.branches??[]).map(e=>[e.name,e])),a=U(),o=H({mutationFn:e=>Re({name:e}),onSuccess:async e=>{F(e.created?`Created and switched to ${e.branch}`:`Switched to ${e.branch}`),await Promise.all([a.invalidateQueries({queryKey:R.repo}),a.invalidateQueries({queryKey:R.health})]),a.setQueryData(R.repo,t=>t?.info?{...t,info:{...t.info,branch:e.branch}}:t),a.setQueryData(R.health,n=>n?.repo?.root===t.root?{...n,repo:{...n.repo,branch:e.branch}}:n)},onError:e=>F(e.message,{tone:`danger`})}),[s,c]=(0,Z.useState)(``),[l,u]=(0,Z.useState)(``),d=l.trim().toLowerCase(),f=Vy(e,r.data?.branches),p=d?f.filter(e=>e.toLowerCase().includes(d)):f;return(0,Q.jsxs)(`section`,{"data-slot":`repo-branches`,className:`grid min-w-0 grid-cols-1 gap-5 px-[18px] py-[22px] md:grid-cols-[minmax(0,1fr)_290px] md:px-9`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,Q.jsx)(`h2`,{className:`sr-only`,children:`Branches`}),(0,Q.jsxs)(`label`,{className:`relative block`,children:[(0,Q.jsx)(We,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,Q.jsx)(Ku,{"aria-label":`Filter branches`,placeholder:`Filter branches…`,value:l,onChange:e=>u(e.target.value),className:`h-11 pl-10`})]}),(0,Q.jsxs)(`ul`,{"data-slot":`repo-branch-list`,className:`mt-4 flex min-w-0 flex-col divide-y divide-border border-t border-border md:max-h-[40rem] md:overflow-y-auto md:overscroll-contain`,children:[p.map(e=>{let n=e===t.branch,r=i.get(e);return(0,Q.jsxs)(`li`,{"data-slot":`branch-row`,"data-branch":e,"data-branch-class":r?.class,className:`flex min-h-20 flex-col items-start justify-center gap-2 py-3 md:flex-row md:items-center md:justify-start md:py-2.5`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-[8px]`,children:[r?.runId?(0,Q.jsx)(X,{to:`/tasks/${r.runId}`,"data-slot":`branch-task-link`,title:r.title?`Open the task ${r.title}`:`Open the task`,className:`min-w-0 truncate rounded-[2px] text-[13px] underline-offset-2 hover:underline focus-visible:outline-2 focus-visible:outline-ring`,children:e}):(0,Q.jsx)(`span`,{className:G(`min-w-0 truncate text-[13px]`,n&&`font-normal`),children:e}),r?(0,Q.jsx)(By,{entry:r}):null]}),e.startsWith(`cez/`)&&!n?null:n?(0,Q.jsx)(`span`,{"data-slot":`branch-current`,className:`md:ml-auto flex shrink-0 items-center rounded-md bg-accent-strong/10 px-2 py-1.5 text-[12px] font-medium text-accent-text`,children:`Current`}):(0,Q.jsxs)(z,{variant:`outline`,size:`sm`,"data-action":`switch-branch`,className:`md:ml-auto h-11`,disabled:o.isPending,onClick:()=>o.mutate(e),children:[(0,Q.jsx)(cn,{size:16,"aria-hidden":`true`}),`Switch`]})]},e)}),p.length===0?(0,Q.jsxs)(`li`,{"data-slot":`branch-empty`,className:`py-3 text-xs text-soft-foreground`,children:[`No branches match “`,l.trim(),`”.`]}):null]})]}),(0,Q.jsxs)(`div`,{className:`min-w-0 self-start rounded-xl border border-border bg-card p-5`,children:[(0,Q.jsx)(`h2`,{className:`text-base font-semibold`,children:`Create a branch`}),(0,Q.jsxs)(`form`,{"data-slot":`branch-create`,className:`mt-7 flex flex-col items-stretch gap-3`,onSubmit:e=>{e.preventDefault();let t=s.trim();t&&o.mutate(t,{onSuccess:()=>c(``)})},children:[(0,Q.jsx)(`label`,{htmlFor:`new-branch-name`,className:`text-sm font-medium`,children:`Branch name`}),(0,Q.jsx)(`p`,{className:`-mt-1 text-xs text-muted-foreground`,children:`Create from the selected base.`}),(0,Q.jsx)(Ku,{id:`new-branch-name`,"aria-label":`New branch name`,placeholder:`new-branch-name`,className:`h-11 bg-background`,value:s,onChange:e=>c(e.target.value)}),(0,Q.jsxs)(z,{type:`submit`,variant:`primary`,size:`sm`,className:`min-h-11 self-start`,"data-action":`create-branch`,disabled:!s.trim()||o.isPending,children:[(0,Q.jsx)(pe,{size:16,"aria-hidden":`true`}),`Create branch`]})]}),(0,Q.jsx)(`p`,{className:`mt-3 border-t border-border pt-4 text-xs leading-relaxed text-muted-foreground`,children:`Switching branches changes your working tree. Review uncommitted changes first.`})]}),n.data?.forge?.available?(0,Q.jsx)(Iy,{}):null]})}function Iy(){let e=Cr({limit:20});return(0,Q.jsxs)(`div`,{"data-slot":`repo-prs`,className:`max-w-xl`,children:[(0,Q.jsx)(`h2`,{className:`text-xs font-semibold tracking-wide text-soft-foreground uppercase`,children:`Open pull requests`}),e.isPending?(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`Loading pull requests…`}):e.isError?(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:e.error.message}):e.data.available?e.data.prs.length===0?(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`No open pull requests.`}):(0,Q.jsx)(`ul`,{className:`mt-2 flex flex-col divide-y divide-border`,children:e.data.prs.map(e=>(0,Q.jsx)(Ly,{pr:e},e.number))}):(0,Q.jsx)(`p`,{"data-slot":`repo-prs-unavailable`,className:`mt-2 text-xs text-soft-foreground`,children:e.data.reason??`The forge is unreachable right now.`})]})}function Ly({pr:e}){let t=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Er,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Q.jsxs)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:[`#`,e.number]}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px]`,children:e.title}),e.checks?(0,Q.jsx)(Ry,{checks:e.checks}):null]}),n=`flex min-w-0 items-center gap-2 rounded-sm px-1.5 py-2`;return(0,Q.jsx)(`li`,{"data-slot":`pr-row`,"data-number":e.number,children:Hr(e.url)?(0,Q.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:G(n,`hover:bg-muted`),children:t}):(0,Q.jsx)(`span`,{className:n,children:t})})}function Ry({checks:e}){return(0,Q.jsx)(`span`,{"data-slot":`pr-checks`,"data-checks":e,className:G(`shrink-0 text-[12px] font-medium`,e===`passing`&&`text-success`,e===`failing`&&`text-danger`,e===`pending`&&`text-muted-foreground`),children:e})}var zy={active:`in use`,"not-landed":`not landed`,orphan:`not landed`,merged:`merged`,empty:`empty`,other:`yours`};function By({entry:e}){return(0,Q.jsx)(`span`,{"data-slot":`branch-class`,className:G(`shrink-0 rounded-[4px] border px-[5px] py-[1px] text-[10.5px] leading-[14px]`,e.class===`active`?`border-status-running/40 text-status-running`:e.class===`not-landed`||e.class===`orphan`?`border-inbox-count-foreground/40 text-inbox-count-foreground`:`border-border text-soft-foreground`),children:zy[e.class]})}function Vy(e,t){let n=new Set(e.branches);for(let e of t??[])n.add(e.name);return[...n].sort((e,t)=>e.localeCompare(t))}function Hy(e,t,n){let r=ve(e),i=tt(e),a=r.data?.totalBytes??null,o=i.data?.counts??null,s=t&&n===`screen`?Cy(t.log):0;return{main:s>0?`${s} today`:null,"not-landed":o?.notLanded?String(o.notLanded):null,cleanup:a?nt(a):r.data&&a===null&&o?.cleanup?String(o.cleanup):null,branches:t?String(Vy(t,i.data?.branches).length):null}}function Uy({scope:e}){let t=ot(e),{pathname:n}=a(),r=V_(),i=t.data?.info?t.data:null,o=Hy(e,i,`sidebar`);return(0,Q.jsxs)(`div`,{"data-slot":`git-sidebar`,role:`region`,"aria-label":`Git`,className:Wi,children:[i?.info?(0,Q.jsx)(Oy,{scope:e,repo:i,info:i.info,variant:`sidebar`,onNavigate:r},e):t.isPending?(0,Q.jsx)(`div`,{"data-slot":`git-checkout-placeholder`,"aria-hidden":`true`,className:`h-[94px] rounded-[8px] border border-border`}):null,t.isPending?null:(0,Q.jsx)(Py,{branch:i?.info?.branch??null,counts:o,variant:`sidebar`,active:py(n),onNavigate:r})]})}var Wy={assigned:Et,"no-task":Gi,"has-task":me,all:i,review:ua,mine:Er,failing:Fn,"all-prs":i};function Gy(e,t){return e===`assigned`||e===`mine`?t.identity:e===`no-task`||e===`has-task`?t.tasks:null}function Ky({model:e,variant:t,activeId:n,onNavigate:r}){let i=t===`screen`;return(0,Q.jsx)(Q.Fragment,{children:[{key:`issues`,label:`Issues`,rows:bi},{key:`prs`,label:`Pull requests`,rows:gi}].map(t=>(0,Q.jsxs)(`nav`,{"aria-label":t.label,"data-slot":`github-filter-group`,"data-group":t.key,className:i?Mi:G(Fi,t.key===`prs`&&`pt-[6px]`),children:[(0,Q.jsx)(`h3`,{className:i?Bi:Vi,children:t.label}),t.rows.map(({id:t,label:a})=>{let o=Wy[t],s=n===t,c=Gy(t,e.blocked),l=e.counts[t],u=Oi(l),d=G(i?Ni:G(Li,`text-[12.5px]`),c?`cursor-not-allowed opacity-60`:Ii,s&&`bg-sidebar-row-selected text-foreground font-medium hover:bg-sidebar-row-selected`),f=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(o,{"aria-hidden":`true`,className:i?Ui:zi}),(0,Q.jsx)(`span`,{className:`truncate`,children:a}),u?(0,Q.jsx)(`span`,{"data-slot":`gh-filter-count`,title:Di(t,l),className:i?Ri:Pi,children:u}):null,i?(0,Q.jsx)(St,{"aria-hidden":`true`,className:G(Hi,!u&&`ml-auto`)}):null]});if(c)return(0,Q.jsxs)(`div`,{"data-gh-filter":t,"aria-disabled":`true`,title:c,className:d,children:[f,(0,Q.jsx)(`span`,{className:`sr-only`,children:c})]},t);let{view:p,filter:m}=xi(t);return(0,Q.jsx)(X,{to:vi(p,m),"data-gh-filter":t,"aria-current":s?`page`:void 0,onClick:r,className:d,children:f},t)})]},t.key))})}function qy(e){let t=Mr(e,{limit:Ei}).data,n=t?.available===!0,r=ie(e,!0,e==="default"),i=h(e,`pr`,wi,n),a=h(e,`pr`,Ci,n),o=(0,Z.useMemo)(()=>r.data?Ti(r.data,t?.repo,e):null,[r.data,t?.repo,e]);return{gh:t,counts:(0,Z.useMemo)(()=>_i({gh:t,tasks:o,review:i.data,failing:a.data}),[t,o,i.data,a.data]),blocked:{identity:t?.available===!0&&!t.viewerLogin?`GitHub login unavailable.`:null,tasks:r.isError&&!r.data?`Task list unavailable.`:null}}}function Jy(e){return/^\/github\/prs(?:\/|$)/.test(Fa(e))?`prs`:`issues`}function Yy({scope:e}){let t=qy(e),{pathname:n}=a(),[r]=Nn(),i=V_(),o=Jy(n);return(0,Q.jsx)(`div`,{"data-slot":`github-sidebar`,role:`region`,"aria-label":`GitHub`,className:Wi,children:(0,Q.jsx)(Ky,{model:t,variant:`sidebar`,activeId:yi(o,Si(o,r.get(`filter`))),onNavigate:i})})}function Xy({projectId:e,projectName:t,capabilities:n}){return(0,Q.jsx)(`div`,{"data-slot":`settings-sidebar`,className:Wi,children:[`project`,`global`].map(r=>{let i=r===`project`?`This project${t?` · ${t}`:``}`:`Global · every project`,a=r===`project`?`/p/${encodeURIComponent(e)}/settings`:`/settings/global`,o=zp(r,n).map(e=>({id:e.id,title:e.title,icon:e.icon,to:`${a}/${e.id}`})),s=r===`project`?[{id:`general`,title:`General`,icon:_,to:a},...o]:o;return(0,Q.jsxs)(`nav`,{"aria-label":i,"data-slot":`settings-nav`,"data-scope":r,className:G(`flex flex-col gap-px`,r===`global`&&`pt-[6px]`),children:[(0,Q.jsx)(`h3`,{title:i,className:Vi,children:i}),s.map(({id:e,title:t,icon:n,to:r})=>(0,Q.jsxs)(ut,{to:r,end:!0,"data-section":e,className:({isActive:e})=>G(Li,Ii,e&&`bg-sidebar-row-selected text-foreground font-medium hover:bg-sidebar-row-selected`),children:[(0,Q.jsx)(n,{"aria-hidden":`true`,className:zi}),(0,Q.jsx)(`span`,{className:`truncate`,children:t})]},e))]},r)})})}function Zy(e){let t=e?.repo;if(!t)return null;let n=t.root.replace(/[\\/]+$/,``).split(/[\\/]/).pop();return n?{name:n,branch:t.branch}:null}function Qy(e){return e?.available===!0&&(e.status===`available`||e.status===`error`)}function $y({children:e}){let{pathname:t}=a(),n=za(),r=P(),i=(0,Z.useRef)(void 0);r.data&&(i.current=r.data);let o=r.data??i.current,s=iv(o),c=r.data?.capabilities.followups===!0,l=r.data?.capabilities.automations===!0,u=D(c),d=Qy(br(n??``,n!==null).data),f=V().data,p=kv(),m=Lg(),h=xg(t),g=f?.bootProject??r.data?.bootProject??null,_=n??g??`default`,v=_===g,y=ie(_,!0,v),b=n!==null&&n===g,x=f?.projects.find(e=>e.id===n),S=ie(n??``,x!==void 0&&h.taskId!==null,f?.bootProject===n).data,C=t===`/tools`||t===`/settings/global`||t.startsWith(`/settings/global/`),w=C?null:x?.name??(b?Zy(r.data)?.name??null:null),T=h.taskId?S?.find(e=>e.id===h.taskId):void 0,E=T?wn(T):h.pageLabel;fy({projectName:w,pageLabel:E});let ee=x?x.forge===`github`:r.data?.forge?.available===!0,O=Fa(t),k=/^\/settings(?:\/|$)/.test(O)?(0,Q.jsx)(Xy,{projectId:_,projectName:f?.projects.find(e=>e.id===_)?.name??(v?Zy(r.data)?.name??null:null),capabilities:r.data?.capabilities}):/^\/github(?:\/|$)/.test(O)&&ee?(0,Q.jsx)(Yy,{scope:v?`default`:_}):/^\/git(?:\/|$)/.test(O)?(0,Q.jsx)(Uy,{scope:v?`default`:_}):void 0;return(0,Q.jsxs)(ov,{children:[(0,Q.jsx)(W_,{repo:t===`/tools`?Zy(r.data):C?null:x?{name:x.name,branch:x.id===g?r.data?.repo?.branch??``:``}:Zy(r.data),breadcrumb:{project:t===`/tools`?`Workspace`:w,page:T?`Tasks / ${E}`:E??`Cezarion`,branch:T?.worktreePath?`Isolated worktree`:void 0},version:o?.version??null,latestVersion:o?.latestVersion??null,applicationUpdate:o?.applicationUpdate,onApplyUpdate:s.apply,onRestart:s.restart,applicationUpdateError:s.error,applicationUpdateBusy:s.busy,applicationUpdateOffline:s.offline||r.isError,inboxCount:u.data?.length??null,skillsUpdateAvailable:d,forgeAvailable:ee,inboxAvailable:c,automationsAvailable:l,banner:(0,Q.jsx)(hv,{}),sidebarList:k,taskQuickList:(0,Q.jsx)(ty,{projectId:_,boot:v}),sidebarProjectId:_,projectHeader:(0,Q.jsx)(Xp,{}),mobileProjects:p,needsYou:Rn(y.data??[]).waiting>0,toolsMenu:(0,Q.jsx)(sy,{health:r.data}),toolsStatus:r.data?{blocked:iy(r.data)!==null,note:oy(r.data)}:null,projectRail:p?(0,Q.jsx)(Ov,{...p,projectTarget:m.target,onSwitchProject:e=>void m.go(e),version:o?.version??null}):null,children:e}),(0,Q.jsx)(i_,{})]})}function eb(){let e=a(),t=V();return Ig(),(0,Z.useEffect)(()=>{let n=Dc(e,t.data);n!==null&&(kc(Sc(),n)||Cc(n),kc(Mc(n.projectId),n)||Nc(n))},[e.hash,e.pathname,e.search,t.data]),null}function tb(){let e=U(),t=tp(De().data?.notifications).enabled,n=(0,Z.useRef)(t);return n.current=t,(0,Z.useEffect)(()=>{let t=e.getQueryCache(),r=new Map,i=new Map,a=new Map,o=new Set,s=new Map,c=0,l=e=>e.length===3&&typeof e[0]==`string`&&e[1]===`runs`&&e[2]===`list`,u=()=>{let e=new Set([...r.values()].flatMap(e=>[...e.keys()]));for(let t of i.keys())e.has(t)||(i.delete(t),a.delete(t),o.delete(t))},d=(e,t,s=!1,l=1/0)=>{let d=r.get(e),{statuses:f}=rp(new Map,t),p=t.filter(e=>{if((a.get(e.id)??0)>l)return!1;let t=d?.get(e.id),n=f.get(e.id),r=l===1/0?t:i.get(e.id);return t!==void 0&&r!==void 0&&(r.status!==n.status||r.wantsAttention!==n.wantsAttention)}),{entering:m,statuses:h}=rp(i,p);for(let[e,t]of f)!d?.has(e)&&!o.has(e)&&(a.get(e)??0)<=l&&(i.set(e,t),a.set(e,++c));for(let[e,t]of h){let n=i.get(e);n?.status===t.status&&n.wantsAttention===t.wantsAttention||(i.set(e,t),a.set(e,++c),o.add(e))}if(r.set(e,f),u(),!s&&m.length!==0&&ip({enabled:n.current,hidden:document.visibilityState===`hidden`,permission:np()}))for(let e of m)nb(e)};for(let e of t.getAll().sort((e,t)=>e.state.dataUpdatedAt-t.state.dataUpdatedAt))l(e.queryKey)&&Array.isArray(e.state.data)&&d(e.queryHash,e.state.data,!0);return t.subscribe(e=>{if(l(e.query.queryKey)){if(e.type===`removed`)r.delete(e.query.queryHash),s.delete(e.query.queryHash),u();else if(e.type===`updated`&&(e.action.type===`fetch`&&s.set(e.query.queryHash,c),e.action.type===`success`&&Array.isArray(e.query.state.data))){let t=e.action.manual?1/0:s.get(e.query.queryHash)??0;d(e.query.queryHash,e.query.state.data,!1,t),e.action.manual||s.delete(e.query.queryHash)}}})},[e]),null}function nb(e){let t=globalThis.Notification;if(typeof t!=`function`)return;let n=ap(e);try{new t(n.title,{body:n.body,tag:n.tag})}catch{}}function rb(){let[e]=(0,Z.useState)(zs);return(0,Z.useEffect)(()=>m(e),[e]),(0,Q.jsx)(Bs,{children:(0,Q.jsx)(Bn,{client:e,children:(0,Q.jsxs)(Fs,{children:[(0,Q.jsx)(tb,{}),(0,Q.jsx)(Vf,{children:(0,Q.jsx)(Df,{children:(0,Q.jsxs)(oe,{children:[(0,Q.jsx)(eb,{}),(0,Q.jsx)(pi,{children:(0,Q.jsx)($y,{children:(0,Q.jsx)(wg,{})})}),(0,Q.jsx)(ke,{})]})})})]})})})}function ib(){return(document.querySelector(`meta[name="cez-api-base"]`)?.getAttribute(`content`))?.trim()||``}Vr(ib());var ab=document.getElementById(`root`);if(!ab)throw Error(`cezar: #root container is missing from index.html`);(0,rs.createRoot)(ab).render((0,Q.jsx)(Z.StrictMode,{children:(0,Q.jsx)(rb,{})}));export{pu as A,od as C,bu as D,Su as E,cc as F,ac as I,Hs as L,Ic as M,Fc as N,hu as O,_c as P,sd as S,xu as T,$f as _,Vy as a,dd as b,Oy as c,hy as d,my as f,_y as g,Sy as h,Fy as i,du as j,mu as k,Ay as l,Ty as m,Ky as n,Py as o,wy as p,Hy as r,My as s,qy as t,Ey as u,md as v,Ku as w,ud as x,fd as y};