@wjarka/cezarion 0.16.0 → 0.17.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 (907) hide show
  1. package/LICENSE +1 -0
  2. package/README.md +594 -207
  3. package/dist/agent-config/account-identity.d.ts +3 -19
  4. package/dist/agent-config/account-identity.js +8 -5
  5. package/dist/agent-config/account-identity.js.map +1 -1
  6. package/dist/agent-config/catalog.d.ts +3 -14
  7. package/dist/agent-config/catalog.js.map +1 -1
  8. package/dist/agent-config/files.d.ts +2 -6
  9. package/dist/agent-config/files.js +2 -6
  10. package/dist/agent-config/files.js.map +1 -1
  11. package/dist/agent-config/model-settings/types.d.ts +1 -1
  12. package/dist/agent-config/seed.d.ts +11 -3
  13. package/dist/agent-config/seed.js +52 -48
  14. package/dist/agent-config/seed.js.map +1 -1
  15. package/dist/agent-config/service.js +3 -2
  16. package/dist/agent-config/service.js.map +1 -1
  17. package/dist/agent-config/validate.d.ts +1 -4
  18. package/dist/agent-config/validate.js.map +1 -1
  19. package/dist/application-update/helper.d.ts +2 -2
  20. package/dist/application-update/helper.js +7 -12
  21. package/dist/application-update/helper.js.map +1 -1
  22. package/dist/application-update/launcher.d.ts +4 -0
  23. package/dist/application-update/launcher.js +18 -12
  24. package/dist/application-update/launcher.js.map +1 -1
  25. package/dist/application-update/service.d.ts +3 -3
  26. package/dist/application-update/service.js +1 -1
  27. package/dist/application-update/service.js.map +1 -1
  28. package/dist/archive-on-merge-setting.d.ts +15 -0
  29. package/dist/archive-on-merge-setting.js +14 -0
  30. package/dist/archive-on-merge-setting.js.map +1 -0
  31. package/dist/artifacts/cli.d.ts +8 -0
  32. package/dist/artifacts/cli.js +21 -2
  33. package/dist/artifacts/cli.js.map +1 -1
  34. package/dist/artifacts/resolve.js +2 -1
  35. package/dist/artifacts/resolve.js.map +1 -1
  36. package/dist/artifacts/store.js.map +1 -1
  37. package/dist/automations/automation-cli.d.ts +59 -0
  38. package/dist/automations/automation-cli.js +509 -0
  39. package/dist/automations/automation-cli.js.map +1 -0
  40. package/dist/automations/builtin-skill.d.ts +7 -0
  41. package/dist/automations/builtin-skill.js +14 -0
  42. package/dist/automations/builtin-skill.js.map +1 -0
  43. package/dist/automations/github-baseline.d.ts +3 -0
  44. package/dist/automations/github-baseline.js +17 -0
  45. package/dist/automations/github-baseline.js.map +1 -0
  46. package/dist/automations/github-poller.d.ts +23 -4
  47. package/dist/automations/github-poller.js +157 -88
  48. package/dist/automations/github-poller.js.map +1 -1
  49. package/dist/automations/prompts.d.ts +12 -0
  50. package/dist/automations/prompts.js +160 -0
  51. package/dist/automations/prompts.js.map +1 -0
  52. package/dist/automations/schedule-runner.d.ts +43 -24
  53. package/dist/automations/schedule-runner.js +207 -20
  54. package/dist/automations/schedule-runner.js.map +1 -1
  55. package/dist/automations/scheduler.d.ts +10 -2
  56. package/dist/automations/scheduler.js +200 -54
  57. package/dist/automations/scheduler.js.map +1 -1
  58. package/dist/automations/service.d.ts +777 -0
  59. package/dist/automations/service.js +444 -0
  60. package/dist/automations/service.js.map +1 -0
  61. package/dist/automations/store.d.ts +17 -7
  62. package/dist/automations/store.js +88 -17
  63. package/dist/automations/store.js.map +1 -1
  64. package/dist/automations/task-template.d.ts +7 -2
  65. package/dist/automations/task-template.js +93 -44
  66. package/dist/automations/task-template.js.map +1 -1
  67. package/dist/automations/tool-adapter.d.ts +6 -0
  68. package/dist/automations/tool-adapter.js +108 -0
  69. package/dist/automations/tool-adapter.js.map +1 -0
  70. package/dist/automations/types.d.ts +1 -405
  71. package/dist/automations/types.js +1 -218
  72. package/dist/automations/types.js.map +1 -1
  73. package/dist/autosave-cleanup.d.ts +26 -0
  74. package/dist/autosave-cleanup.js +87 -0
  75. package/dist/autosave-cleanup.js.map +1 -0
  76. package/dist/autosave-git.d.ts +3 -0
  77. package/dist/autosave-git.js +67 -35
  78. package/dist/autosave-git.js.map +1 -1
  79. package/dist/autosave-group.d.ts +8 -0
  80. package/dist/autosave-group.js +61 -0
  81. package/dist/autosave-group.js.map +1 -0
  82. package/dist/autosave-holders.d.ts +31 -4
  83. package/dist/autosave-holders.js +92 -7
  84. package/dist/autosave-holders.js.map +1 -1
  85. package/dist/autosave-windows.d.ts +14 -0
  86. package/dist/autosave-windows.js +36 -2
  87. package/dist/autosave-windows.js.map +1 -1
  88. package/dist/ci-wait/client.d.ts +20 -3
  89. package/dist/ci-wait/client.js +40 -44
  90. package/dist/ci-wait/client.js.map +1 -1
  91. package/dist/ci-wait/controller.d.ts +622 -36
  92. package/dist/ci-wait/controller.js +152 -20
  93. package/dist/ci-wait/controller.js.map +1 -1
  94. package/dist/ci-wait/errors.d.ts +19 -0
  95. package/dist/ci-wait/errors.js +180 -2
  96. package/dist/ci-wait/errors.js.map +1 -1
  97. package/dist/ci-wait/github.d.ts +25 -1
  98. package/dist/ci-wait/github.js +76 -9
  99. package/dist/ci-wait/github.js.map +1 -1
  100. package/dist/ci-wait/mcp.d.ts +0 -1
  101. package/dist/ci-wait/mcp.js +0 -2
  102. package/dist/ci-wait/mcp.js.map +1 -1
  103. package/dist/ci-wait/supervisor.d.ts +7 -0
  104. package/dist/ci-wait/supervisor.js +113 -17
  105. package/dist/ci-wait/supervisor.js.map +1 -1
  106. package/dist/ci-wait/tools.d.ts +536 -16
  107. package/dist/ci-wait/tools.js +165 -20
  108. package/dist/ci-wait/tools.js.map +1 -1
  109. package/dist/config.d.ts +3 -17
  110. package/dist/config.js +4 -60
  111. package/dist/config.js.map +1 -1
  112. package/dist/contract/active-provider.d.ts +12 -0
  113. package/dist/contract/agent-profiles.d.ts +2 -10
  114. package/dist/contract/ask-schema.d.ts +22 -4
  115. package/dist/contract/ask.d.ts +6 -4
  116. package/dist/contract/attachments.d.ts +35 -0
  117. package/dist/contract/attention.d.ts +46 -37
  118. package/dist/contract/automation-requests.d.ts +308 -0
  119. package/dist/contract/automation-schedule.d.ts +40 -11
  120. package/dist/contract/automation-storage.d.ts +512 -0
  121. package/dist/contract/automations.d.ts +421 -40
  122. package/dist/contract/ci-wait.d.ts +41 -4
  123. package/dist/contract/config-requests.d.ts +36 -0
  124. package/dist/contract/conversations.d.ts +24 -10
  125. package/dist/contract/defined.d.ts +8 -0
  126. package/dist/contract/delegation.d.ts +312 -8
  127. package/dist/contract/events.d.ts +24 -3
  128. package/dist/contract/github-requests.d.ts +26 -0
  129. package/dist/contract/github.d.ts +60 -27
  130. package/dist/contract/handoff.d.ts +43 -0
  131. package/dist/contract/health.d.ts +2 -2
  132. package/dist/contract/image-path.d.ts +6 -0
  133. package/dist/contract/index.d.ts +31 -0
  134. package/dist/contract/index.js +3756 -1525
  135. package/dist/contract/live-coordination.d.ts +158 -0
  136. package/dist/contract/live-limits.d.ts +8 -0
  137. package/dist/contract/live.d.ts +123 -0
  138. package/dist/contract/pending-ask.d.ts +58 -0
  139. package/dist/contract/permissions.d.ts +54 -0
  140. package/dist/contract/preview.d.ts +33 -0
  141. package/dist/contract/project-limits.d.ts +33 -0
  142. package/dist/contract/projects.d.ts +486 -20
  143. package/dist/contract/provider-requests.d.ts +77 -0
  144. package/dist/contract/query-requests.d.ts +52 -0
  145. package/dist/contract/repo-requests.d.ts +12 -0
  146. package/dist/contract/run-labels.d.ts +8 -0
  147. package/dist/contract/run-limits.d.ts +8 -0
  148. package/dist/contract/run-predicates.d.ts +32 -0
  149. package/dist/contract/run-requests.d.ts +33 -0
  150. package/dist/contract/run-search.d.ts +193 -0
  151. package/dist/contract/runs.d.ts +2232 -1894
  152. package/dist/contract/scheduled-tasks.d.ts +187 -0
  153. package/dist/contract/skills.d.ts +22 -772
  154. package/dist/contract/team-skill-ref.d.ts +10 -0
  155. package/dist/{core → contract}/tool-display.d.ts +4 -10
  156. package/dist/contract/ui-state-requests.d.ts +60 -0
  157. package/dist/contract/version.d.ts +3 -0
  158. package/dist/contract/voice.d.ts +213 -0
  159. package/dist/contract/waits.d.ts +1204 -0
  160. package/dist/contract/workflow-file.d.ts +37 -0
  161. package/dist/contract/workflow-requests.d.ts +7 -0
  162. package/dist/contract/workflows.d.ts +1 -2
  163. package/dist/contract/workspace.d.ts +34 -82
  164. package/dist/contract/zoned-time.d.ts +2 -11
  165. package/dist/core/agent-env.d.ts +4 -16
  166. package/dist/core/agent-env.js +14 -16
  167. package/dist/core/agent-env.js.map +1 -1
  168. package/dist/core/agent-profiles.d.ts +28 -40
  169. package/dist/core/agent-profiles.js +56 -51
  170. package/dist/core/agent-profiles.js.map +1 -1
  171. package/dist/core/agent-runner.d.ts +88 -44
  172. package/dist/core/agent-runner.js +17 -18
  173. package/dist/core/agent-runner.js.map +1 -1
  174. package/dist/core/ask.d.ts +3 -0
  175. package/dist/core/ask.js +12 -0
  176. package/dist/core/ask.js.map +1 -1
  177. package/dist/core/backend-detect.js +16 -2
  178. package/dist/core/backend-detect.js.map +1 -1
  179. package/dist/core/claude-cli-runner.d.ts +23 -4
  180. package/dist/core/claude-cli-runner.js +280 -76
  181. package/dist/core/claude-cli-runner.js.map +1 -1
  182. package/dist/core/claude-model-catalog.d.ts +2 -10
  183. package/dist/core/claude-model-catalog.js +2 -10
  184. package/dist/core/claude-model-catalog.js.map +1 -1
  185. package/dist/core/claude-ui-mapper.d.ts +2 -2
  186. package/dist/core/claude-ui-mapper.js +94 -2
  187. package/dist/core/claude-ui-mapper.js.map +1 -1
  188. package/dist/core/codex-app-server-runner.d.ts +3 -4
  189. package/dist/core/codex-app-server-runner.js +146 -51
  190. package/dist/core/codex-app-server-runner.js.map +1 -1
  191. package/dist/core/codex-app-server-transport.d.ts +4 -3
  192. package/dist/core/codex-app-server-transport.js +11 -7
  193. package/dist/core/codex-app-server-transport.js.map +1 -1
  194. package/dist/core/codex-approvals.d.ts +12 -0
  195. package/dist/core/codex-approvals.js +161 -0
  196. package/dist/core/codex-approvals.js.map +1 -0
  197. package/dist/core/codex-permissions.d.ts +1 -1
  198. package/dist/core/codex-ui-mapper.js +45 -1
  199. package/dist/core/codex-ui-mapper.js.map +1 -1
  200. package/dist/core/cursor-acp-runner.d.ts +1 -1
  201. package/dist/core/cursor-acp-runner.js +39 -15
  202. package/dist/core/cursor-acp-runner.js.map +1 -1
  203. package/dist/core/cursor-cli-flags.d.ts +19 -0
  204. package/dist/core/cursor-cli-flags.js +47 -0
  205. package/dist/core/cursor-cli-flags.js.map +1 -0
  206. package/dist/core/cursor-model-catalog.d.ts +22 -0
  207. package/dist/core/cursor-model-catalog.js +53 -24
  208. package/dist/core/cursor-model-catalog.js.map +1 -1
  209. package/dist/core/cursor-print-capabilities.d.ts +16 -0
  210. package/dist/core/cursor-print-capabilities.js +141 -0
  211. package/dist/core/cursor-print-capabilities.js.map +1 -0
  212. package/dist/core/cursor-print-process.d.ts +31 -0
  213. package/dist/core/cursor-print-process.js +117 -0
  214. package/dist/core/cursor-print-process.js.map +1 -0
  215. package/dist/core/cursor-print-runner.d.ts +31 -0
  216. package/dist/core/cursor-print-runner.js +555 -0
  217. package/dist/core/cursor-print-runner.js.map +1 -0
  218. package/dist/core/cursor-print-tool-catalog.d.ts +10 -0
  219. package/dist/core/cursor-print-tool-catalog.js +91 -0
  220. package/dist/core/cursor-print-tool-catalog.js.map +1 -0
  221. package/dist/core/cursor-print-ui-mapper.d.ts +47 -0
  222. package/dist/core/cursor-print-ui-mapper.js +553 -0
  223. package/dist/core/cursor-print-ui-mapper.js.map +1 -0
  224. package/dist/core/cursor-runner.d.ts +24 -0
  225. package/dist/core/cursor-runner.js +149 -0
  226. package/dist/core/cursor-runner.js.map +1 -0
  227. package/dist/core/cursor-ui-mapper.js +5 -2
  228. package/dist/core/cursor-ui-mapper.js.map +1 -1
  229. package/dist/core/defined.d.ts +1 -0
  230. package/dist/core/defined.js +2 -0
  231. package/dist/core/defined.js.map +1 -0
  232. package/dist/core/hook-items.d.ts +14 -0
  233. package/dist/core/hook-items.js +13 -0
  234. package/dist/core/hook-items.js.map +1 -0
  235. package/dist/core/host-model-catalog.d.ts +2 -9
  236. package/dist/core/host-model-catalog.js +2 -9
  237. package/dist/core/host-model-catalog.js.map +1 -1
  238. package/dist/core/managed-session.js +15 -3
  239. package/dist/core/managed-session.js.map +1 -1
  240. package/dist/core/model-identity.d.ts +4 -21
  241. package/dist/core/model-identity.js.map +1 -1
  242. package/dist/core/model-presets.d.ts +2 -13
  243. package/dist/core/model-presets.js +2 -13
  244. package/dist/core/model-presets.js.map +1 -1
  245. package/dist/core/omp-model-catalog.js.map +1 -1
  246. package/dist/core/omp-runner.d.ts +6 -7
  247. package/dist/core/omp-runner.js +92 -33
  248. package/dist/core/omp-runner.js.map +1 -1
  249. package/dist/core/omp-ui-mapper.js +1 -1
  250. package/dist/core/omp-ui-mapper.js.map +1 -1
  251. package/dist/core/opencode-model-catalog.js.map +1 -1
  252. package/dist/core/opencode-permissions.d.ts +52 -0
  253. package/dist/core/opencode-permissions.js +101 -0
  254. package/dist/core/opencode-permissions.js.map +1 -0
  255. package/dist/core/opencode-server-runner.d.ts +10 -9
  256. package/dist/core/opencode-server-runner.js +286 -28
  257. package/dist/core/opencode-server-runner.js.map +1 -1
  258. package/dist/core/opencode-session-error.d.ts +15 -7
  259. package/dist/core/opencode-session-error.js +25 -9
  260. package/dist/core/opencode-session-error.js.map +1 -1
  261. package/dist/core/opencode-ui-mapper.js +2 -2
  262. package/dist/core/opencode-ui-mapper.js.map +1 -1
  263. package/dist/core/pi-model-catalog.js.map +1 -1
  264. package/dist/core/pi-runner.d.ts +12 -4
  265. package/dist/core/pi-runner.js +171 -63
  266. package/dist/core/pi-runner.js.map +1 -1
  267. package/dist/core/pi-ui-mapper.js +1 -1
  268. package/dist/core/pi-ui-mapper.js.map +1 -1
  269. package/dist/core/process-usage.d.ts +5 -0
  270. package/dist/core/process-usage.js +24 -4
  271. package/dist/core/process-usage.js.map +1 -1
  272. package/dist/core/provider-auth.d.ts +16 -107
  273. package/dist/core/provider-auth.js +16 -132
  274. package/dist/core/provider-auth.js.map +1 -1
  275. package/dist/core/runner-factory.d.ts +4 -1
  276. package/dist/core/runner-factory.js +3 -3
  277. package/dist/core/runner-factory.js.map +1 -1
  278. package/dist/core/runner-runtime.d.ts +22 -0
  279. package/dist/core/runner-runtime.js +66 -5
  280. package/dist/core/runner-runtime.js.map +1 -1
  281. package/dist/core/runner-tool-grants.d.ts +21 -0
  282. package/dist/core/runner-tool-grants.js +64 -0
  283. package/dist/core/runner-tool-grants.js.map +1 -0
  284. package/dist/core/secret-redaction.d.ts +3 -20
  285. package/dist/core/secret-redaction.js +3 -20
  286. package/dist/core/secret-redaction.js.map +1 -1
  287. package/dist/core/session-process.d.ts +22 -2
  288. package/dist/core/session-process.js +170 -12
  289. package/dist/core/session-process.js.map +1 -1
  290. package/dist/core/shell-env.d.ts +2 -15
  291. package/dist/core/shell-env.js +2 -15
  292. package/dist/core/shell-env.js.map +1 -1
  293. package/dist/core/ui-events.d.ts +60 -47
  294. package/dist/core/ui-events.js +0 -23
  295. package/dist/core/ui-events.js.map +1 -1
  296. package/dist/core/usage-limit.js.map +1 -1
  297. package/dist/data-gitignore.js +3 -1
  298. package/dist/data-gitignore.js.map +1 -1
  299. package/dist/delegation/capacity.d.ts +4 -8
  300. package/dist/delegation/capacity.js +4 -8
  301. package/dist/delegation/capacity.js.map +1 -1
  302. package/dist/delegation/cli.js +123 -21
  303. package/dist/delegation/cli.js.map +1 -1
  304. package/dist/delegation/context.d.ts +19 -3
  305. package/dist/delegation/context.js +217 -22
  306. package/dist/delegation/context.js.map +1 -1
  307. package/dist/delegation/conversations.d.ts +4 -3
  308. package/dist/delegation/conversations.js +7 -5
  309. package/dist/delegation/conversations.js.map +1 -1
  310. package/dist/delegation/destroy-observation.d.ts +1 -1
  311. package/dist/delegation/destroy-observation.js.map +1 -1
  312. package/dist/delegation/effort.js.map +1 -1
  313. package/dist/delegation/execution-identity.d.ts +1 -1
  314. package/dist/delegation/execution-identity.js +41 -7
  315. package/dist/delegation/execution-identity.js.map +1 -1
  316. package/dist/delegation/idle-test-app.d.ts +4 -0
  317. package/dist/delegation/idle-test-app.js +174 -0
  318. package/dist/delegation/idle-test-app.js.map +1 -0
  319. package/dist/delegation/input.js.map +1 -1
  320. package/dist/delegation/park-notice.d.ts +42 -0
  321. package/dist/delegation/park-notice.js +71 -0
  322. package/dist/delegation/park-notice.js.map +1 -0
  323. package/dist/delegation/policy.d.ts +2 -0
  324. package/dist/delegation/policy.js +9 -1
  325. package/dist/delegation/policy.js.map +1 -1
  326. package/dist/delegation/process-liveness.d.ts +10 -15
  327. package/dist/delegation/process-liveness.js +11 -35
  328. package/dist/delegation/process-liveness.js.map +1 -1
  329. package/dist/delegation/provision.js +21 -19
  330. package/dist/delegation/provision.js.map +1 -1
  331. package/dist/delegation/questions.d.ts +3 -1
  332. package/dist/delegation/questions.js +10 -5
  333. package/dist/delegation/questions.js.map +1 -1
  334. package/dist/delegation/readiness.d.ts +2 -2
  335. package/dist/delegation/results.d.ts +4 -1
  336. package/dist/delegation/results.js +49 -18
  337. package/dist/delegation/results.js.map +1 -1
  338. package/dist/delegation/retry-backoff.d.ts +8 -0
  339. package/dist/delegation/retry-backoff.js +8 -0
  340. package/dist/delegation/retry-backoff.js.map +1 -1
  341. package/dist/delegation/routes.d.ts +114 -30
  342. package/dist/delegation/routes.js +4 -1
  343. package/dist/delegation/routes.js.map +1 -1
  344. package/dist/delegation/scratch-cleanup.d.ts +4 -5
  345. package/dist/delegation/scratch-cleanup.js +10 -8
  346. package/dist/delegation/scratch-cleanup.js.map +1 -1
  347. package/dist/delegation/service.d.ts +12 -4
  348. package/dist/delegation/service.js +76 -28
  349. package/dist/delegation/service.js.map +1 -1
  350. package/dist/delegation/transport.d.ts +154 -70
  351. package/dist/delegation/wait.d.ts +11 -0
  352. package/dist/delegation/wait.js +24 -0
  353. package/dist/delegation/wait.js.map +1 -1
  354. package/dist/delegation/windows-test-app.d.ts +5 -0
  355. package/dist/delegation/windows-test-app.js +63 -0
  356. package/dist/delegation/windows-test-app.js.map +1 -0
  357. package/dist/delegation/windows-workspace-identity.d.ts +3 -0
  358. package/dist/delegation/windows-workspace-identity.js +22 -0
  359. package/dist/delegation/windows-workspace-identity.js.map +1 -0
  360. package/dist/delegation/workspace.d.ts +5 -10
  361. package/dist/delegation/workspace.js +136 -75
  362. package/dist/delegation/workspace.js.map +1 -1
  363. package/dist/detached-process.d.ts +103 -0
  364. package/dist/detached-process.js +301 -0
  365. package/dist/detached-process.js.map +1 -0
  366. package/dist/discovery/catalog.d.ts +2 -1
  367. package/dist/discovery/catalog.js.map +1 -1
  368. package/dist/discovery/cli.js +3 -1
  369. package/dist/discovery/cli.js.map +1 -1
  370. package/dist/git-diff-base.d.ts +6 -61
  371. package/dist/git-diff-base.js +6 -70
  372. package/dist/git-diff-base.js.map +1 -1
  373. package/dist/git-index-copy.d.ts +4 -0
  374. package/dist/git-index-copy.js +10 -0
  375. package/dist/git-index-copy.js.map +1 -0
  376. package/dist/git-worktree-lock.d.ts +2 -4
  377. package/dist/git-worktree-lock.js +2 -4
  378. package/dist/git-worktree-lock.js.map +1 -1
  379. package/dist/git-worktree-release.d.ts +2 -2
  380. package/dist/git-worktree-release.js.map +1 -1
  381. package/dist/git-worktree.d.ts +47 -76
  382. package/dist/git-worktree.js +240 -94
  383. package/dist/git-worktree.js.map +1 -1
  384. package/dist/handoff.d.ts +51 -41
  385. package/dist/handoff.js +130 -78
  386. package/dist/handoff.js.map +1 -1
  387. package/dist/index.js +60 -39
  388. package/dist/index.js.map +1 -1
  389. package/dist/merge-observations.d.ts +13 -0
  390. package/dist/merge-observations.js +55 -0
  391. package/dist/merge-observations.js.map +1 -0
  392. package/dist/open-url.js +4 -14
  393. package/dist/open-url.js.map +1 -1
  394. package/dist/paths.d.ts +10 -13
  395. package/dist/paths.js +36 -17
  396. package/dist/paths.js.map +1 -1
  397. package/dist/planner.d.ts +2 -1
  398. package/dist/planner.js +9 -6
  399. package/dist/planner.js.map +1 -1
  400. package/dist/preview/agent-address.d.ts +34 -0
  401. package/dist/preview/agent-address.js +51 -0
  402. package/dist/preview/agent-address.js.map +1 -0
  403. package/dist/preview/agent-marker.d.ts +17 -0
  404. package/dist/preview/agent-marker.js +71 -0
  405. package/dist/preview/agent-marker.js.map +1 -0
  406. package/dist/preview/cdp-proxy.d.ts +54 -0
  407. package/dist/preview/cdp-proxy.js +151 -0
  408. package/dist/preview/cdp-proxy.js.map +1 -0
  409. package/dist/preview/cdp.d.ts +39 -3
  410. package/dist/preview/cdp.js +155 -57
  411. package/dist/preview/cdp.js.map +1 -1
  412. package/dist/preview/chromium.d.ts +18 -6
  413. package/dist/preview/chromium.js +112 -25
  414. package/dist/preview/chromium.js.map +1 -1
  415. package/dist/preview/dev-server.d.ts +1 -1
  416. package/dist/preview/dev-server.js +20 -44
  417. package/dist/preview/dev-server.js.map +1 -1
  418. package/dist/preview/host.d.ts +70 -3
  419. package/dist/preview/host.js +314 -28
  420. package/dist/preview/host.js.map +1 -1
  421. package/dist/preview/registration.d.ts +10 -5
  422. package/dist/preview/registration.js +2 -0
  423. package/dist/preview/registration.js.map +1 -1
  424. package/dist/preview/session.d.ts +2 -0
  425. package/dist/preview/session.js +10 -0
  426. package/dist/preview/session.js.map +1 -1
  427. package/dist/process-wait/exit-file.d.ts +29 -0
  428. package/dist/process-wait/exit-file.js +67 -0
  429. package/dist/process-wait/exit-file.js.map +1 -0
  430. package/dist/process-wait/supervisor.d.ts +30 -0
  431. package/dist/process-wait/supervisor.js +71 -0
  432. package/dist/process-wait/supervisor.js.map +1 -0
  433. package/dist/release/snapshot.d.ts +6 -6
  434. package/dist/runs/agent-tmpdir.d.ts +51 -36
  435. package/dist/runs/agent-tmpdir.js +389 -132
  436. package/dist/runs/agent-tmpdir.js.map +1 -1
  437. package/dist/runs/auto-name.d.ts +6 -6
  438. package/dist/runs/auto-name.js +1 -1
  439. package/dist/runs/auto-name.js.map +1 -1
  440. package/dist/runs/client-request.d.ts +3 -3
  441. package/dist/runs/client-request.js +3 -3
  442. package/dist/runs/client-request.js.map +1 -1
  443. package/dist/runs/delegation-state.d.ts +11 -2
  444. package/dist/runs/delegation-state.js.map +1 -1
  445. package/dist/runs/event-history-agent-context.d.ts +14 -0
  446. package/dist/runs/event-history-agent-context.js +105 -0
  447. package/dist/runs/event-history-agent-context.js.map +1 -0
  448. package/dist/runs/event-history-context.d.ts +15 -0
  449. package/dist/runs/event-history-context.js +109 -0
  450. package/dist/runs/event-history-context.js.map +1 -0
  451. package/dist/runs/event-history.d.ts +4 -1
  452. package/dist/runs/event-history.js +29 -130
  453. package/dist/runs/event-history.js.map +1 -1
  454. package/dist/runs/history-stream.d.ts +2 -0
  455. package/dist/runs/history-stream.js +62 -0
  456. package/dist/runs/history-stream.js.map +1 -0
  457. package/dist/runs/legacy-index.d.ts +6 -19
  458. package/dist/runs/legacy-index.js +6 -19
  459. package/dist/runs/legacy-index.js.map +1 -1
  460. package/dist/runs/live-item-snapshots.d.ts +13 -0
  461. package/dist/runs/live-item-snapshots.js +79 -0
  462. package/dist/runs/live-item-snapshots.js.map +1 -0
  463. package/dist/runs/loaded-run-healing.d.ts +3 -0
  464. package/dist/runs/loaded-run-healing.js +17 -0
  465. package/dist/runs/loaded-run-healing.js.map +1 -0
  466. package/dist/runs/outcome-commit.d.ts +98 -0
  467. package/dist/runs/outcome-commit.js +132 -0
  468. package/dist/runs/outcome-commit.js.map +1 -0
  469. package/dist/runs/pull-requests.d.ts +14 -0
  470. package/dist/runs/pull-requests.js +96 -0
  471. package/dist/runs/pull-requests.js.map +1 -0
  472. package/dist/runs/raw-record.d.ts +3 -15
  473. package/dist/runs/raw-record.js +3 -15
  474. package/dist/runs/raw-record.js.map +1 -1
  475. package/dist/runs/retention.d.ts +2 -2
  476. package/dist/runs/retention.js +7 -0
  477. package/dist/runs/retention.js.map +1 -1
  478. package/dist/runs/review-gate.d.ts +1 -1
  479. package/dist/runs/review-gate.js.map +1 -1
  480. package/dist/runs/run-claims.d.ts +2 -9
  481. package/dist/runs/run-claims.js.map +1 -1
  482. package/dist/runs/run-database.d.ts +29 -34
  483. package/dist/runs/run-database.js +124 -46
  484. package/dist/runs/run-database.js.map +1 -1
  485. package/dist/runs/run-index.d.ts +6 -25
  486. package/dist/runs/run-index.js +25 -38
  487. package/dist/runs/run-index.js.map +1 -1
  488. package/dist/runs/run-row.d.ts +5 -34
  489. package/dist/runs/run-row.js +13 -38
  490. package/dist/runs/run-row.js.map +1 -1
  491. package/dist/runs/store.d.ts +1597 -744
  492. package/dist/runs/store.js +1231 -739
  493. package/dist/runs/store.js.map +1 -1
  494. package/dist/runs/task-markers.d.ts +1 -0
  495. package/dist/runs/task-markers.js +5 -1
  496. package/dist/runs/task-markers.js.map +1 -1
  497. package/dist/runs/task-refs.d.ts +3 -3
  498. package/dist/runs/transcript-facts-fold.d.ts +64 -0
  499. package/dist/runs/transcript-facts-fold.js +109 -0
  500. package/dist/runs/transcript-facts-fold.js.map +1 -0
  501. package/dist/runs/transcript-facts-load.d.ts +11 -0
  502. package/dist/runs/transcript-facts-load.js +66 -0
  503. package/dist/runs/transcript-facts-load.js.map +1 -0
  504. package/dist/runs/transcript-facts-queue.d.ts +30 -0
  505. package/dist/runs/transcript-facts-queue.js +227 -0
  506. package/dist/runs/transcript-facts-queue.js.map +1 -0
  507. package/dist/runs/transcript-facts-worker.d.ts +15 -0
  508. package/dist/runs/transcript-facts-worker.js +26 -0
  509. package/dist/runs/transcript-facts-worker.js.map +1 -0
  510. package/dist/runs/transcript-facts.d.ts +13 -51
  511. package/dist/runs/transcript-facts.js +86 -202
  512. package/dist/runs/transcript-facts.js.map +1 -1
  513. package/dist/runs/ui-event-sink.d.ts +5 -30
  514. package/dist/runs/ui-event-sink.js +8 -30
  515. package/dist/runs/ui-event-sink.js.map +1 -1
  516. package/dist/runs/webhook.d.ts +104 -38
  517. package/dist/runs/webhook.js +180 -77
  518. package/dist/runs/webhook.js.map +1 -1
  519. package/dist/server/app-type.d.ts +2 -17
  520. package/dist/server/archive-on-merge.d.ts +35 -0
  521. package/dist/server/archive-on-merge.js +202 -0
  522. package/dist/server/archive-on-merge.js.map +1 -0
  523. package/dist/server/capabilities.d.ts +3 -15
  524. package/dist/server/capabilities.js +6 -19
  525. package/dist/server/capabilities.js.map +1 -1
  526. package/dist/server/checkout-progress.d.ts +10 -0
  527. package/dist/server/checkout-progress.js +27 -0
  528. package/dist/server/checkout-progress.js.map +1 -0
  529. package/dist/server/checkout.d.ts +10 -19
  530. package/dist/server/checkout.js +15 -45
  531. package/dist/server/checkout.js.map +1 -1
  532. package/dist/server/cockpit-ownership.d.ts +2 -0
  533. package/dist/server/cockpit-ownership.js +9 -0
  534. package/dist/server/cockpit-ownership.js.map +1 -1
  535. package/dist/server/cold-repo-handles.d.ts +2 -7
  536. package/dist/server/cold-repo-handles.js +2 -7
  537. package/dist/server/cold-repo-handles.js.map +1 -1
  538. package/dist/server/completion-actions.d.ts +30 -0
  539. package/dist/server/completion-actions.js +204 -0
  540. package/dist/server/completion-actions.js.map +1 -0
  541. package/dist/server/create-project.d.ts +71 -0
  542. package/dist/server/create-project.js +448 -0
  543. package/dist/server/create-project.js.map +1 -0
  544. package/dist/server/forge/github-filters.d.ts +7 -1
  545. package/dist/server/forge/github-filters.js +66 -51
  546. package/dist/server/forge/github-filters.js.map +1 -1
  547. package/dist/server/forge/github-merge-requirements.d.ts +18 -0
  548. package/dist/server/forge/github-merge-requirements.js +137 -0
  549. package/dist/server/forge/github-merge-requirements.js.map +1 -0
  550. package/dist/server/forge/github.d.ts +98 -111
  551. package/dist/server/forge/github.js +625 -306
  552. package/dist/server/forge/github.js.map +1 -1
  553. package/dist/server/forge/types.d.ts +25 -22
  554. package/dist/server/fs-browse.d.ts +3 -28
  555. package/dist/server/fs-browse.js.map +1 -1
  556. package/dist/server/git-changes.d.ts +5 -15
  557. package/dist/server/git-changes.js +3 -50
  558. package/dist/server/git-changes.js.map +1 -1
  559. package/dist/server/git.d.ts +3 -1
  560. package/dist/server/git.js +12 -0
  561. package/dist/server/git.js.map +1 -1
  562. package/dist/server/github.d.ts +1 -1
  563. package/dist/server/github.js +1 -1
  564. package/dist/server/github.js.map +1 -1
  565. package/dist/server/launch-key.d.ts +2 -4
  566. package/dist/server/launch-key.js +2 -4
  567. package/dist/server/launch-key.js.map +1 -1
  568. package/dist/server/live-routes.d.ts +68 -0
  569. package/dist/server/live-routes.js +147 -0
  570. package/dist/server/live-routes.js.map +1 -0
  571. package/dist/server/open-in-app.d.ts +4 -13
  572. package/dist/server/open-in-app.js +5 -41
  573. package/dist/server/open-in-app.js.map +1 -1
  574. package/dist/server/open-in-targets.d.ts +42 -0
  575. package/dist/server/open-in-targets.js +110 -0
  576. package/dist/server/open-in-targets.js.map +1 -0
  577. package/dist/server/open-in-terminal.d.ts +3 -0
  578. package/dist/server/open-in-terminal.js +6 -26
  579. package/dist/server/open-in-terminal.js.map +1 -1
  580. package/dist/server/preview-cdp-socket.d.ts +21 -0
  581. package/dist/server/preview-cdp-socket.js +112 -0
  582. package/dist/server/preview-cdp-socket.js.map +1 -0
  583. package/dist/server/preview-socket.d.ts +11 -11
  584. package/dist/server/preview-socket.js +22 -22
  585. package/dist/server/preview-socket.js.map +1 -1
  586. package/dist/server/preview-sockets.d.ts +14 -0
  587. package/dist/server/preview-sockets.js +18 -0
  588. package/dist/server/preview-sockets.js.map +1 -0
  589. package/dist/server/project-context.d.ts +54 -18
  590. package/dist/server/project-context.js +178 -5
  591. package/dist/server/project-context.js.map +1 -1
  592. package/dist/server/provider-action-gate.d.ts +0 -2
  593. package/dist/server/provider-action-gate.js +0 -21
  594. package/dist/server/provider-action-gate.js.map +1 -1
  595. package/dist/server/provider-auth-runtime.d.ts +3 -18
  596. package/dist/server/provider-auth-runtime.js +3 -18
  597. package/dist/server/provider-auth-runtime.js.map +1 -1
  598. package/dist/server/repo-branches.d.ts +3 -9
  599. package/dist/server/repo-branches.js +6 -22
  600. package/dist/server/repo-branches.js.map +1 -1
  601. package/dist/server/run-event-feed.d.ts +20 -0
  602. package/dist/server/run-event-feed.js +190 -0
  603. package/dist/server/run-event-feed.js.map +1 -0
  604. package/dist/server/server-deps.d.ts +37 -0
  605. package/dist/server/server-deps.js +114 -0
  606. package/dist/server/server-deps.js.map +1 -0
  607. package/dist/server/server.d.ts +14082 -11998
  608. package/dist/server/server.js +785 -1647
  609. package/dist/server/server.js.map +1 -1
  610. package/dist/server/start-run-options.d.ts +82 -0
  611. package/dist/server/start-run-options.js +111 -0
  612. package/dist/server/start-run-options.js.map +1 -0
  613. package/dist/server/validators.d.ts +3 -29
  614. package/dist/server/validators.js +1 -2
  615. package/dist/server/validators.js.map +1 -1
  616. package/dist/server/ws.d.ts +3 -23
  617. package/dist/server/ws.js +3 -23
  618. package/dist/server/ws.js.map +1 -1
  619. package/dist/server-install/engine.d.ts +6 -9
  620. package/dist/server-install/engine.js +2 -9
  621. package/dist/server-install/engine.js.map +1 -1
  622. package/dist/server-install/platforms/ubuntu-vps.d.ts +1 -1
  623. package/dist/server-install/state.d.ts +2 -4
  624. package/dist/server-install/state.js +2 -4
  625. package/dist/server-install/state.js.map +1 -1
  626. package/dist/server-install/steps.d.ts +2 -5
  627. package/dist/server-install/steps.js +3 -6
  628. package/dist/server-install/steps.js.map +1 -1
  629. package/dist/server-install/types.d.ts +3 -6
  630. package/dist/server-install/types.js +2 -5
  631. package/dist/server-install/types.js.map +1 -1
  632. package/dist/server-install/ui.d.ts +2 -8
  633. package/dist/server-install/ui.js +3 -3
  634. package/dist/server-install/ui.js.map +1 -1
  635. package/dist/session-context.d.ts +64 -0
  636. package/dist/session-context.js +264 -0
  637. package/dist/session-context.js.map +1 -0
  638. package/dist/skills-provision.d.ts +62 -0
  639. package/dist/skills-provision.js +325 -0
  640. package/dist/skills-provision.js.map +1 -0
  641. package/dist/skills-remote.d.ts +29 -27
  642. package/dist/skills-remote.js +236 -100
  643. package/dist/skills-remote.js.map +1 -1
  644. package/dist/skills.d.ts +25 -36
  645. package/dist/skills.js +43 -54
  646. package/dist/skills.js.map +1 -1
  647. package/dist/subcommands.d.ts +11 -0
  648. package/dist/subcommands.js +24 -0
  649. package/dist/subcommands.js.map +1 -0
  650. package/dist/task-cli/cli.js +78 -25
  651. package/dist/task-cli/cli.js.map +1 -1
  652. package/dist/task-cli/discovery.d.ts +4 -2
  653. package/dist/task-cli/discovery.js +14 -13
  654. package/dist/task-cli/discovery.js.map +1 -1
  655. package/dist/task-cli/hint.d.ts +20 -0
  656. package/dist/task-cli/hint.js +14 -0
  657. package/dist/task-cli/hint.js.map +1 -0
  658. package/dist/task-cli/http.d.ts +1 -0
  659. package/dist/task-cli/http.js +3 -1
  660. package/dist/task-cli/http.js.map +1 -1
  661. package/dist/task-cli/projections.d.ts +14 -11
  662. package/dist/task-cli/projections.js +15 -11
  663. package/dist/task-cli/projections.js.map +1 -1
  664. package/dist/task-cli/watch.d.ts +18 -10
  665. package/dist/task-cli/watch.js +128 -20
  666. package/dist/task-cli/watch.js.map +1 -1
  667. package/dist/ui-state.d.ts +17 -3
  668. package/dist/ui-state.js +56 -9
  669. package/dist/ui-state.js.map +1 -1
  670. package/dist/update-check.d.ts +0 -10
  671. package/dist/update-check.js +1 -16
  672. package/dist/update-check.js.map +1 -1
  673. package/dist/voice/decide.d.ts +32 -0
  674. package/dist/voice/decide.js +297 -0
  675. package/dist/voice/decide.js.map +1 -0
  676. package/dist/voice/decision-log.d.ts +52 -0
  677. package/dist/voice/decision-log.js +107 -0
  678. package/dist/voice/decision-log.js.map +1 -0
  679. package/dist/voice/engine.d.ts +119 -0
  680. package/dist/voice/engine.js +60 -0
  681. package/dist/voice/engine.js.map +1 -0
  682. package/dist/voice/fake-engine.d.ts +10 -0
  683. package/dist/voice/fake-engine.js +192 -0
  684. package/dist/voice/fake-engine.js.map +1 -0
  685. package/dist/voice/jev-engine.d.ts +17 -0
  686. package/dist/voice/jev-engine.js +110 -0
  687. package/dist/voice/jev-engine.js.map +1 -0
  688. package/dist/voice/pending-ask.d.ts +17 -0
  689. package/dist/voice/pending-ask.js +50 -0
  690. package/dist/voice/pending-ask.js.map +1 -0
  691. package/dist/voice/routes.d.ts +115 -0
  692. package/dist/voice/routes.js +91 -0
  693. package/dist/voice/routes.js.map +1 -0
  694. package/dist/voice/sentence.d.ts +21 -0
  695. package/dist/voice/sentence.js +61 -0
  696. package/dist/voice/sentence.js.map +1 -0
  697. package/dist/voice/thresholds.d.ts +28 -0
  698. package/dist/voice/thresholds.js +29 -0
  699. package/dist/voice/thresholds.js.map +1 -0
  700. package/dist/webhooks/cli.d.ts +18 -0
  701. package/dist/webhooks/cli.js +145 -0
  702. package/dist/webhooks/cli.js.map +1 -0
  703. package/dist/webhooks/prompt.d.ts +5 -0
  704. package/dist/webhooks/prompt.js +26 -0
  705. package/dist/webhooks/prompt.js.map +1 -0
  706. package/dist/workflows/active-run.d.ts +167 -0
  707. package/dist/workflows/active-run.js +21 -0
  708. package/dist/workflows/active-run.js.map +1 -0
  709. package/dist/workflows/continuation-admission.d.ts +913 -0
  710. package/dist/workflows/continuation-admission.js +265 -0
  711. package/dist/workflows/continuation-admission.js.map +1 -0
  712. package/dist/workflows/execution-account.d.ts +13 -0
  713. package/dist/workflows/execution-account.js +18 -0
  714. package/dist/workflows/execution-account.js.map +1 -0
  715. package/dist/workflows/input-acknowledgement.d.ts +152 -0
  716. package/dist/workflows/input-acknowledgement.js +38 -0
  717. package/dist/workflows/input-acknowledgement.js.map +1 -0
  718. package/dist/workflows/line-order.d.ts +5 -0
  719. package/dist/workflows/line-order.js +25 -0
  720. package/dist/workflows/line-order.js.map +1 -0
  721. package/dist/workflows/outcome-batches.d.ts +20 -0
  722. package/dist/workflows/outcome-batches.js +25 -0
  723. package/dist/workflows/outcome-batches.js.map +1 -0
  724. package/dist/workflows/question-routing.d.ts +8 -0
  725. package/dist/workflows/question-routing.js +18 -0
  726. package/dist/workflows/question-routing.js.map +1 -0
  727. package/dist/workflows/run-scheduling.d.ts +35 -0
  728. package/dist/workflows/run-scheduling.js +61 -0
  729. package/dist/workflows/run-scheduling.js.map +1 -0
  730. package/dist/workflows/run-states.d.ts +190 -0
  731. package/dist/workflows/run-states.js +295 -0
  732. package/dist/workflows/run-states.js.map +1 -0
  733. package/dist/workflows/run.d.ts +1296 -278
  734. package/dist/workflows/run.js +5730 -3265
  735. package/dist/workflows/run.js.map +1 -1
  736. package/dist/workflows/turn-end.d.ts +116 -0
  737. package/dist/workflows/turn-end.js +68 -0
  738. package/dist/workflows/turn-end.js.map +1 -0
  739. package/dist/workflows/types.d.ts +35 -130
  740. package/dist/workflows/types.js +47 -100
  741. package/dist/workflows/types.js.map +1 -1
  742. package/dist/workflows/waits.d.ts +74 -0
  743. package/dist/workflows/waits.js +197 -0
  744. package/dist/workflows/waits.js.map +1 -0
  745. package/dist/workspace/agent-accounts.d.ts +5 -38
  746. package/dist/workspace/agent-accounts.js +14 -40
  747. package/dist/workspace/agent-accounts.js.map +1 -1
  748. package/dist/workspace/agent-profiles.d.ts +40 -16
  749. package/dist/workspace/agent-profiles.js +77 -17
  750. package/dist/workspace/agent-profiles.js.map +1 -1
  751. package/dist/workspace/config.d.ts +48 -49
  752. package/dist/workspace/config.js +68 -72
  753. package/dist/workspace/config.js.map +1 -1
  754. package/dist/workspace/migrations.d.ts +3 -13
  755. package/dist/workspace/migrations.js.map +1 -1
  756. package/dist/workspace/projects-cli.d.ts +1 -1
  757. package/dist/workspace/projects-cli.js.map +1 -1
  758. package/dist/workspace/projects.d.ts +15 -18
  759. package/dist/workspace/projects.js +20 -16
  760. package/dist/workspace/projects.js.map +1 -1
  761. package/dist/workspace/semaphore.d.ts +11 -45
  762. package/dist/workspace/semaphore.js +6 -18
  763. package/dist/workspace/semaphore.js.map +1 -1
  764. package/dist/workspace/ui-state.d.ts +6 -4
  765. package/dist/workspace/ui-state.js +6 -4
  766. package/dist/workspace/ui-state.js.map +1 -1
  767. package/dist/workspace/webhooks.d.ts +40 -0
  768. package/dist/workspace/webhooks.js +146 -0
  769. package/dist/workspace/webhooks.js.map +1 -0
  770. package/dist/worktree-manifest.d.ts +165 -0
  771. package/dist/worktree-manifest.js +530 -0
  772. package/dist/worktree-manifest.js.map +1 -0
  773. package/dist/worktree-setup.js.map +1 -1
  774. package/package.json +6 -5
  775. package/scripts/benchmark-run-store-fixture.ts +7 -3
  776. package/scripts/check-pack.mjs +3 -1
  777. package/scripts/inline-contract.mjs +80 -27
  778. package/scripts/install-as-command.mjs +3 -1
  779. package/scripts/measure-transcript-facts-health.mjs +87 -0
  780. package/scripts/measure-transcript-facts-lag.mjs +68 -0
  781. package/scripts/mock-ci-tool.mjs +49 -6
  782. package/scripts/mock-claude-model-refusal.mjs +42 -0
  783. package/scripts/mock-claude.mjs +833 -591
  784. package/scripts/mock-codex-app-server.mjs +785 -418
  785. package/scripts/mock-cursor-acp.mjs +296 -125
  786. package/scripts/mock-cursor-print.mjs +256 -0
  787. package/scripts/mock-deferred-turn-start.mjs +16 -0
  788. package/scripts/mock-delivery-control.d.mts +23 -0
  789. package/scripts/mock-delivery-control.mjs +80 -0
  790. package/scripts/mock-env-record.mjs +11 -0
  791. package/scripts/mock-failure-control.d.mts +13 -0
  792. package/scripts/mock-failure-control.mjs +68 -0
  793. package/scripts/mock-multi-pr.mjs +7 -0
  794. package/scripts/mock-nudge.mjs +45 -0
  795. package/scripts/mock-omp-rpc.mjs +429 -255
  796. package/scripts/mock-opencode-serve.mjs +972 -557
  797. package/scripts/mock-pi-rpc.mjs +558 -331
  798. package/scripts/mock-runner-crash.mjs +18 -2
  799. package/scripts/mock-session-context.d.mts +5 -0
  800. package/scripts/mock-session-context.mjs +56 -0
  801. package/scripts/mock-silent-tail.mjs +10 -3
  802. package/scripts/pi-default-tools.mjs +22 -0
  803. package/scripts/pi-project-skills.mjs +59 -0
  804. package/scripts/probe-cursor-print.mjs +627 -0
  805. package/scripts/transcript-facts-fixture.mjs +53 -0
  806. package/scripts/voice-replay.ts +50 -0
  807. package/scripts/windows-workspace-identity.cs +208 -0
  808. package/scripts/windows-workspace-identity.ps1 +10 -0
  809. package/web/dist/assets/alert-dialog-DfctKUMw.js +1 -0
  810. package/web/dist/assets/button-CeupvoKG.js +41 -0
  811. package/web/dist/assets/centered-state-hDsyXrnH.js +1 -0
  812. package/web/dist/assets/cez-idle-D3aj_9lp.js +1 -0
  813. package/web/dist/assets/diff-BnIXZK3i2.js +3 -0
  814. package/web/dist/assets/diff-controls-GewpW9aF.js +1 -0
  815. package/web/dist/assets/diff-view-Byo7gpvW.js +11 -0
  816. package/web/dist/assets/dropdown-menu-COj_J5wd.js +6 -0
  817. package/web/dist/assets/eye-B8okNWXU.js +1 -0
  818. package/web/dist/assets/git-toolbar-DY0z0n4S.js +1 -0
  819. package/web/dist/assets/github-DwU6ALRK.js +1 -0
  820. package/web/dist/assets/{image-preview-FOEfqpZP.js → image-preview-C_t9q45f.js} +1 -1
  821. package/web/dist/assets/index-BOfE8pyD.js +34 -0
  822. package/web/dist/assets/index-D9HpsmdW.css +1 -0
  823. package/web/dist/assets/live-protocol-Uce2NwEX.js +64 -0
  824. package/web/dist/assets/live-worker-BizfZSoh.ts +33 -0
  825. package/web/dist/assets/markdown-BBDDg-4t.js +1 -0
  826. package/web/dist/assets/nav-row-styles-AoIhhIwf.js +1 -0
  827. package/web/dist/assets/popover-D56fhiXj.js +1 -0
  828. package/web/dist/assets/preview-pane-connected-BmVqfSU5.js +3 -0
  829. package/web/dist/assets/reference-chip-gQNk-4jc.js +1 -0
  830. package/web/dist/assets/repo-git-B5ECDUuv.js +1 -0
  831. package/web/dist/assets/{repo-git-CoKp-g9K.css → repo-git-DVXNOJDT.css} +1 -1
  832. package/web/dist/assets/run-header-C0Y1NvEM.js +2 -0
  833. package/web/dist/assets/run-header-CC7VUTg9.css +1 -0
  834. package/web/dist/assets/skills-DUeTkZ9z.js +1 -0
  835. package/web/dist/assets/status-dot-1PR0i69P.js +1 -0
  836. package/web/dist/assets/tab-link-DmWk4l5O.js +1 -0
  837. package/web/dist/assets/task-changes-DKZXuW89.js +1 -0
  838. package/web/dist/assets/task-commits-BZ6KxWdF.js +1 -0
  839. package/web/dist/assets/task-files-DlF7Apcn.js +2 -0
  840. package/web/dist/assets/task-github-item-CVPo3geZ.js +1 -0
  841. package/web/dist/assets/task-thread-DtQ6uGfQ.css +1 -0
  842. package/web/dist/assets/task-thread-mm4-ECyo.js +9 -0
  843. package/web/dist/assets/thread-state-CIw2BlhT.js +4 -0
  844. package/web/dist/assets/use-hand-to-agent-state-BCDjzHnG.js +1 -0
  845. package/web/dist/assets/use-hand-to-agent-state-C7esPJ-N.css +1 -0
  846. package/web/dist/assets/workflows-D8vYD-ql.js +7 -0
  847. package/web/dist/assets/zoomable-image-CxQSsfcn.js +1 -0
  848. package/web/dist/index.html +13 -17
  849. package/web/dist/live-worker.js +4 -0
  850. package/dist/core/tool-display.js +0 -179
  851. package/dist/core/tool-display.js.map +0 -1
  852. package/dist/runs/human-ask-summary.d.ts +0 -9
  853. package/dist/runs/human-ask-summary.js +0 -39
  854. package/dist/runs/human-ask-summary.js.map +0 -1
  855. package/dist/runs/run-search.d.ts +0 -29
  856. package/dist/runs/run-search.js +0 -63
  857. package/dist/runs/run-search.js.map +0 -1
  858. package/dist/skills-banner.d.ts +0 -22
  859. package/dist/skills-banner.js +0 -41
  860. package/dist/skills-banner.js.map +0 -1
  861. package/dist/skills-update.d.ts +0 -88
  862. package/dist/skills-update.js +0 -392
  863. package/dist/skills-update.js.map +0 -1
  864. package/dist/todos.d.ts +0 -48
  865. package/dist/todos.js +0 -201
  866. package/dist/todos.js.map +0 -1
  867. package/web/dist/assets/agent-accounts-CFOBMVHc.js +0 -1
  868. package/web/dist/assets/alert-dialog-BrpNUwMt.js +0 -1
  869. package/web/dist/assets/button-C_rd7CPp.js +0 -43
  870. package/web/dist/assets/compare-variants-D6WXhvXA.js +0 -1
  871. package/web/dist/assets/diff-DrEARXTV.js +0 -3
  872. package/web/dist/assets/diff-controls-B1-j7nFg.js +0 -1
  873. package/web/dist/assets/diff-view-DvGLjdTk.js +0 -6
  874. package/web/dist/assets/dropdown-menu-BegOZFrj.js +0 -1
  875. package/web/dist/assets/format-DpNe3S0A.js +0 -1
  876. package/web/dist/assets/git-toolbar-Cw4ljmhB.js +0 -1
  877. package/web/dist/assets/github-CfV5sqL0.js +0 -1
  878. package/web/dist/assets/index-DgWWlOLy.js +0 -13
  879. package/web/dist/assets/index-fBFnuvxu.css +0 -1
  880. package/web/dist/assets/nav-row-styles-vp2JbhuJ.js +0 -1
  881. package/web/dist/assets/popover-BohP6WTx.js +0 -1
  882. package/web/dist/assets/preview-pane-connected-qTA5KNoJ.js +0 -3
  883. package/web/dist/assets/preview-state-vuMviq6q.js +0 -1
  884. package/web/dist/assets/prompt-templates-Cubdut_C.js +0 -15
  885. package/web/dist/assets/repo-git-Cf4t5PD0.js +0 -1
  886. package/web/dist/assets/run-diff-BpkUW37Z.js +0 -3
  887. package/web/dist/assets/run-header-68WHf9wV.js +0 -1
  888. package/web/dist/assets/run-header-8GObNx6F.css +0 -1
  889. package/web/dist/assets/search-x-I9Q8pgUa.js +0 -1
  890. package/web/dist/assets/skills-DFBiAuJG.js +0 -1
  891. package/web/dist/assets/skills-DiVIgKeU.js +0 -1
  892. package/web/dist/assets/square-terminal-B6RYYieR.js +0 -1
  893. package/web/dist/assets/status-dot-CqTJHSP9.js +0 -1
  894. package/web/dist/assets/tab-link-B07Hu4QX.js +0 -1
  895. package/web/dist/assets/task-changes--lQF6EYf.js +0 -1
  896. package/web/dist/assets/task-commits-Cx0qy4DN.js +0 -1
  897. package/web/dist/assets/task-files-D50s-gKW.js +0 -2
  898. package/web/dist/assets/task-github-item-DaqmSwYT.js +0 -1
  899. package/web/dist/assets/task-thread-BPQ64lui.js +0 -7
  900. package/web/dist/assets/task-thread-zNE2Q9E-.css +0 -1
  901. package/web/dist/assets/textarea-D20O4Pw0.js +0 -1
  902. package/web/dist/assets/thread-state-DWcFMrvb.js +0 -4
  903. package/web/dist/assets/use-hand-to-agent-state-BLIGmwbd.css +0 -1
  904. package/web/dist/assets/use-hand-to-agent-state-Cy9eyyfL.js +0 -1
  905. package/web/dist/assets/utils-JsL3ZsJf.js +0 -64
  906. package/web/dist/assets/workflows-jwG7uxqi.js +0 -11
  907. package/web/dist/assets/zoomable-image-BJJ64KGc.js +0 -1
@@ -0,0 +1,34 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/html-BY76lXLH.js","assets/css-BsVw1vtW.js","assets/javascript-BgS3c2Ky.js","assets/core-BCsw8oQw.js","assets/lib-BxQXEXDF.js","assets/rolldown-runtime-QTnfLwEv.js","assets/preview-pane-connected-BmVqfSU5.js","assets/react-runtime-CCIEwYL0.js","assets/button-CeupvoKG.js","assets/bundle-mjs-BT31bpU6.js","assets/dropdown-menu-COj_J5wd.js","assets/live-protocol-Uce2NwEX.js","assets/createLucideIcon-BHp8sXmF.js","assets/status-dot-1PR0i69P.js","assets/info-DA1x_4bz.js","assets/play-CmVAj_fu.js","assets/thread-state-CIw2BlhT.js","assets/app-window-CSHwDX9N.js","assets/task-thread-mm4-ECyo.js","assets/centered-state-hDsyXrnH.js","assets/run-header-C0Y1NvEM.js","assets/popover-D56fhiXj.js","assets/tab-link-DmWk4l5O.js","assets/reference-chip-gQNk-4jc.js","assets/alert-dialog-DfctKUMw.js","assets/run-header-CC7VUTg9.css","assets/eye-B8okNWXU.js","assets/lib-BQXq3kEf.js","assets/zoomable-image-CxQSsfcn.js","assets/task-thread-DtQ6uGfQ.css","assets/task-changes-DKZXuW89.js","assets/git-toolbar-DY0z0n4S.js","assets/diff-controls-GewpW9aF.js","assets/markdown-BBDDg-4t.js","assets/diff-BnIXZK3i2.js","assets/image-preview-C_t9q45f.js","assets/task-files-DlF7Apcn.js","assets/task-commits-BZ6KxWdF.js","assets/task-github-item-CVPo3geZ.js","assets/use-hand-to-agent-state-BCDjzHnG.js","assets/use-hand-to-agent-state-C7esPJ-N.css","assets/repo-git-B5ECDUuv.js","assets/nav-row-styles-AoIhhIwf.js","assets/repo-git-DVXNOJDT.css","assets/github-DwU6ALRK.js","assets/workflows-D8vYD-ql.js","assets/skill-empty-hint-oOtzR3v0.js","assets/skills-DUeTkZ9z.js"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,n,r,t as i}from"./react-runtime-CCIEwYL0.js";import{C as a,D as o,E as s,M as c,O as l,P as u,S as d,T as f,_ as p,a as m,b as h,c as g,d as _,f as v,g as y,h as b,i as x,j as S,k as C,m as w,n as T,o as E,p as D,r as O,s as k,t as A,u as j,w as M,x as N,y as P}from"./button-CeupvoKG.js";import{$ as F,$a as I,$n as ee,Aa as L,Ai as R,At as te,B as ne,Br as z,Bt as re,C as B,Ca as ie,Ci as ae,Ct as oe,D as se,Da as ce,Dt as le,E as ue,Ea as de,Ei as fe,Et as pe,F as me,Fi as he,G as ge,Gt as _e,Ha as V,Hi as ve,Hr as ye,Ht as be,I as xe,Ii as Se,It as Ce,J as we,Ja as Te,Ji as Ee,Jr as De,Jt as Oe,K as ke,Kr as Ae,Kt as je,Li as Me,Lt as Ne,M as Pe,Ma as Fe,Mi as Ie,Mn as Le,Mt as Re,N as ze,Ni as H,Nn as Be,O as Ve,Oa as He,Oi as Ue,Or as We,Ot as Ge,P as Ke,Pi as qe,Pn as Je,Pr as Ye,Pt as Xe,Q as Ze,Qt as Qe,R as $e,Ri as et,Rt as tt,S as nt,Sa as rt,Si as it,St as at,T as ot,Ti as st,Tt as ct,U as lt,Ui as ut,Ur as dt,Ut as ft,V as pt,Va as mt,Vn as ht,Vr as gt,Vt as _t,W as vt,Wa as yt,Wt as bt,X as xt,Xa as St,Xi as Ct,Ya as wt,Yr as Tt,Z as Et,Za as Dt,Zi as Ot,Zn as kt,_ as At,_a as jt,_t as Mt,a as Nt,aa as Pt,ai as Ft,b as It,ba as U,bt as Lt,c as Rt,ca as zt,ci as Bt,co as Vt,ct as Ht,d as Ut,dn as Wt,dt as Gt,en as Kt,eo as qt,et as Jt,f as Yt,ft as Xt,g as Zt,ga as Qt,gi as $t,gr as en,gt as tn,h as nn,ha as rn,hi as an,hn as on,hr as sn,i as cn,ia as ln,ii as un,io as dn,j as fn,ja as pn,jn as mn,k as hn,ka as gn,ki as _n,kt as vn,l as yn,lo as bn,lt as xn,m as Sn,ma as Cn,mi as wn,mt as Tn,no as En,nt as Dn,o as On,oa as kn,oi as An,ot as jn,p as Mn,pn as Nn,qa as Pn,qi as Fn,qr as In,qt as Ln,r as Rn,ra as zn,rn as Bn,s as Vn,sn as Hn,so as Un,sr as Wn,st as Gn,t as Kn,ta as qn,to as Jn,tt as Yn,u as Xn,ua as Zn,un as Qn,ur as $n,ut as er,v as tr,va as nr,vt as rr,w as ir,wa as ar,wi as or,wr as sr,wt as cr,x as lr,xa as ur,xt as dr,y as fr,ya as pr,yi as mr,zi as hr,zr as gr,zt as _r}from"./dropdown-menu-COj_J5wd.js";import{$ as vr,$t as yr,An as br,At as xr,Bt as Sr,Cn as Cr,Dn as wr,Dt as Tr,E as Er,En as Dr,Et as Or,F as kr,Fn as Ar,Ft as jr,G as Mr,Gt as Nr,H as Pr,Ht as Fr,I as Ir,In as Lr,It as Rr,J as zr,Jt as Br,K as Vr,Kt as Hr,Ln as Ur,Lt as Wr,Mn as Gr,Mt as Kr,Nt as qr,On as Jr,Ot as Yr,Pt as Xr,Q as Zr,Qt as Qr,R as $r,Rt as ei,Sn as ti,T as ni,Tn as ri,U as ii,Vt as ai,Wt as W,X as oi,Xt as si,Y as ci,Yt as li,Z as ui,Zt as di,_ as fi,_n as pi,_t as mi,a as hi,at as gi,b as _i,bn as vi,c as yi,ct as bi,d as xi,dn as Si,dt as Ci,et as wi,fn as Ti,g as Ei,gn as Di,h as Oi,hn as ki,i as G,in as Ai,it as ji,j as Mi,jt as Ni,kn as Pi,kt as Fi,l as Ii,ln as Li,lt as Ri,m as zi,mn as Bi,mt as Vi,n as Hi,nn as Ui,nt as Wi,o as Gi,on as Ki,pn as qi,pt as Ji,q as Yi,qt as Xi,r as Zi,rn as Qi,rt as $i,s as ea,sn as ta,st as na,t as ra,tn as ia,tt as aa,u as oa,un as sa,ut as ca,v as la,vn as ua,vt as da,wn as fa,x as pa,xn as ma,y as ha,yn as ga,z as _a,zt as va}from"./centered-state-hDsyXrnH.js";import{i as ya}from"./bundle-mjs-BT31bpU6.js";import{$ as K,A as ba,F as xa,I as Sa,J as Ca,K as wa,M as Ta,N as Ea,P as Da,X as Oa,Y as ka,Z as Aa,b as ja,et as q,it as Ma,j as Na,k as Pa,nt as Fa,rt as J,st as Ia}from"./live-protocol-Uce2NwEX.js";import{i as La,r as Ra,t as za}from"./cez-idle-D3aj_9lp.js";import{t as Y}from"./createLucideIcon-BHp8sXmF.js";import{_ as Ba,a as Va,c as Ha,d as Ua,f as Wa,g as Ga,h as Ka,i as qa,l as Ja,m as Ya,n as Xa,o as X,p as Za,r as Qa,s as $a,t as eo,u as to}from"./status-dot-1PR0i69P.js";import{_ as no,a as ro,c as io,d as ao,f as oo,g as so,h as co,i as lo,m as uo,o as fo,p as po,r as mo,s as ho,u as go,y as _o}from"./nav-row-styles-AoIhhIwf.js";import{i as vo,n as yo,o as bo,r as xo,s as So,t as Co}from"./popover-D56fhiXj.js";import{t as wo}from"./eye-B8okNWXU.js";import{t as To}from"./play-CmVAj_fu.js";import{a as Eo,i as Do,l as Oo,r as ko,s as Ao,t as jo}from"./reference-chip-gQNk-4jc.js";import{a as Mo,c as No,d as Po,f as Fo,g as Io,h as Lo,i as Ro,l as zo,m as Bo,n as Vo,o as Ho,p as Uo,r as Wo,s as Go,t as Ko,u as qo}from"./alert-dialog-DfctKUMw.js";import{i as Jo,n as Yo}from"./chunk-BO2N2NFS-DE6qKn3r.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 Xo=class extends bn{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 Ur({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=Zo(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=Zo(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=Zo(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=Zo(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Te.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=>I(t,e))}findAll(e={}){return this.getAll().filter(t=>I(e,t))}notify(e){Te.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Te.batch(()=>Promise.all(e.map(e=>e.continue().catch(Jn))))}};function Zo(e){return e.options.scope?.id}var Qo=class extends bn{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??Dt(r,t),a=this.get(i);return a||(a=new yt({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(){Te.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=>qt(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>qt(e,t)):t}notify(e){Te.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Te.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Te.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},$o=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Qo,this.#t=e.mutationCache||new Xo,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Vt.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Pn.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(dn(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=wt(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Te.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;Te.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Te.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=Te.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(Jn).catch(Jn)}invalidateQueries(e,t={}){return Te.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=Te.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(Jn)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(Jn)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(dn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Jn).catch(Jn)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Jn).catch(Jn)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Pn.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(St(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{En(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(St(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{En(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||=Dt(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===Un&&(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),es=n(),ts=class extends EventTarget{readyState=0;release;constructor(e,t){super();let n=()=>queueMicrotask(()=>{this.readyState===0&&(this.readyState=1,this.dispatchEvent(new Event(`open`)))});this.release=Zn({kind:`workspace`},{ready:n,reset:()=>{this.readyState!==2&&(this.readyState=0,n())},frame:e=>{if(`data`in e&&e.event===`reconnect`){this.readyState=0,n();return}if(`data`in e&&e.event===`disconnect`){this.readyState===1&&(this.readyState=0,this.dispatchEvent(new Event(`error`)));return}`data`in e&&this.dispatchEvent(new MessageEvent(e.event,{data:e.data}))}})}close(){this.readyState=2,this.release()}};function ns(e,t){if(e===`ping`)return{project:null,event:{type:`ping`}};let n;try{n=JSON.parse(t)}catch{return null}if(!rs(n))return null;let r=n.project;if(typeof r!=`string`||r===``)return null;switch(e){case`run`:{let{project:e,...t}=n;return is(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`usage`:return rs(n.usage)?{project:r,event:{type:`usage`,usage:n.usage}}:null;default:return null}}function rs(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function is(e){return rs(e)&&typeof e.id==`string`&&e.id!==``}function as(e,t){if(!e)return;let n=e.findIndex(e=>e.id===t.id);if(n>=0){let r=[...e];return r[n]=cs(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,Me(t)),a}function os(e,t){if(!e)return;let n=e.filter(e=>e.id!==t);return n.length===e.length?e:n}function ss(e,t){return e?.usage?{...t,usage:e.usage}:t}function cs(e,t){return Me(e?.usage?{...t,usage:e.usage}:t)}var ls=Object.freeze({});function us(){let e=ls,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=i(),ds=C(`/workspace/events`),fs=2,ps=3e3,ms=[`run`,`run-deleted`,`usage`,`ping`],hs=[`project-added`,`project-removed`,`checkout-progress`,`automation-change`,`project-ready`],gs=new Set;function _s(e){return gs.add(e),()=>{gs.delete(e)}}var vs=400;function ys(e){let t,n=()=>{t===void 0&&(t=setTimeout(()=>{t=void 0,e.invalidateQueries({queryKey:W.runsIndex})},vs))};return{onEvent(e){(e.type===`run`||e.type===`run-deleted`)&&n()},refresh:n,cancel(){clearTimeout(t),t=void 0}}}function bs(e){return e[1]===`runs`&&e[2]===`list`}function xs(e,t){return e.cancelQueries({queryKey:t}).then(()=>e.invalidateQueries({queryKey:t}))}function Ss(e){return e.invalidateQueries({predicate:e=>bs(e.queryKey),refetchType:`none`}),e.getQueryCache().findAll({predicate:e=>bs(e.queryKey)&&(e.state.data!==void 0||e.state.fetchStatus!==`idle`)}).map(t=>xs(e,t.queryKey))}function Cs(e,t,n=!1){if(t?.aborted)return Promise.resolve();let r=[G.runs.all,W.runsIndex,W.projects,G.health,G.worktrees,G.repoBranches,W.providerStatus,W.models(`cursor`)],i=()=>{for(let t of r)e.cancelQueries({queryKey:t})};return t?.addEventListener(`abort`,i,{once:!0}),La(()=>{for(let t of e.getQueryCache().findAll({predicate:e=>bs(e.queryKey)}))t.state.data===void 0&&t.state.fetchStatus!==`idle`&&e.cancelQueries({queryKey:t.queryKey,exact:!0});return[e.invalidateQueries({queryKey:G.runs.all,...n?{predicate:e=>[`list`,`detail`,`relationships`,`archived`].includes(String(e.queryKey[2]))}:{}}),e.invalidateQueries({predicate:e=>bs(e.queryKey)}),e.invalidateQueries({queryKey:W.runsIndex}),e.invalidateQueries({queryKey:W.projects}),xs(e,G.health),e.invalidateQueries({queryKey:G.worktrees}),e.invalidateQueries({queryKey:G.repoBranches}),e.invalidateQueries({queryKey:W.providerStatus}),xs(e,W.models(`cursor`)),n?void 0:e.invalidateQueries({predicate:({queryKey:e})=>e.length===3&&e[1]===`github`&&(e[2]===null||typeof e[2]==`number`)})]}).finally(()=>t?.removeEventListener(`abort`,i))}function ws(e){return S()??Ts(e)}function Ts(e){let t=e.getQueryData(W.projects)?.bootProject;return typeof t==`string`&&t!==``?t:e.getQueryData(G.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=(t,r)=>{let i=JSON.stringify(t),a=e.getQueryCache().find({queryKey:t,exact:!0});if(!a)return;let o=n.get(i);!o&&(a.state.fetchStatus!==`idle`||a.state.isInvalidated)||o&&a.state.fetchStatus===`idle`?(n.set(i,{key:t,phase:`needs-start`,dirty:!1}),a.state.fetchStatus!==`idle`&&e.cancelQueries({queryKey:t,exact:!0}),r.some(e=>JSON.stringify(e)===i)||r.push(t)):o?.phase===`fetching`&&(o.dirty=!0)},o,s,c=(i=!1)=>{s!==void 0&&clearTimeout(s),s=void 0,o!==void 0&&cancelAnimationFrame(o),o=void 0;let c=[];for(let{key:r,baseList:i,baseQuery:o,baseUpdateCount:s,runs:l}of t.values()){let t=e.getQueryCache().find({queryKey:r,exact:!0});if(t!==o||t?.state.dataUpdateCount!==s||t?.state.data!==i){c.push(r),n.set(JSON.stringify(r),{key:r,phase:`needs-start`,dirty:!1}),e.cancelQueries({queryKey:r,exact:!0});continue}a(r,c),e.setQueryData(r,e=>{let t=e;for(let e of l.values())t=as(t,e);return t})}if(t.clear(),!i)for(let e of c)r(e);return c},l=t=>{let n=[Es(t,Ts(e))],r=[t,`runs`,`list`];return(t===ws(e)||e.getQueryState(r))&&n.push(r),t===ws(e)&&n.push(G.runs.list()),[...new Map(n.map(e=>[JSON.stringify(e),e])).values()]};return{onEvent(i,u){let d=l(i);if(u.type===`run`&&u.run.archived&&d.every(t=>!e.getQueryData(t)?.find(e=>e.id===u.run.id)?.archived)&&u.type===`run`){for(let r of d){let i=JSON.stringify(r),a=n.get(i);a?.phase===`fetching`&&(a.dirty=!0);let o=t.get(i);if(!o){let n=e.getQueryCache().find({queryKey:r,exact:!0});o={key:r,baseList:n?.state.data,baseQuery:n,baseUpdateCount:n?.state.dataUpdateCount,runs:new Map},t.set(i,o)}o.runs.set(u.run.id,u.run)}s===void 0&&(s=setTimeout(()=>{c()},50),typeof requestAnimationFrame==`function`&&(o=requestAnimationFrame(()=>{c()})));return}let f=c(!0);for(let t of d)a(t,f),u.type===`run`?e.setQueryData(t,e=>as(e,u.run)):e.setQueryData(t,e=>os(e,u.id));for(let e of f)r(e)},flush:c,cancel(){i(),n.clear()}}}function Os(e){let t=new Map;return{refresh(n){let r=G.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.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(G.runs.relationships(e.id),!0),n!==void 0&&r(G.runs.relationships(n),!0))},onDeleted(n){let i=t.get(n);t.delete(n),e.removeQueries({queryKey:G.runs.relationships(n)}),i?.parentRunId===void 0?r([...G.runs.all,`relationships`],!1):r(G.runs.relationships(i.parentRunId),!0)},cancel(){for(let e of n.values())clearTimeout(e);n.clear(),t.clear()}}}var Ms={predicate:e=>e.queryKey[1]===`runs`&&e.queryKey[2]===`archived`};function Ns(e,t){if(t.delegation?.role===`worker`)return;let n=!1;for(let r of e.getQueryCache().findAll(Ms)){let i=r.state.data;if(i)if(i.pages.some(e=>e.runs.some(e=>e.id===t.id))){let a=Me(t);e.setQueryData(r.queryKey,{...i,pages:i.pages.map(e=>({...e,runs:e.runs.map(e=>e.id===t.id?{...a,...e.usage?{usage:e.usage}:{}}:e)}))}),(!t.archived||r.queryKey[3]!==``)&&(n=!0)}else t.archived&&(n=!0)}n&&e.invalidateQueries(Ms)}function Ps(e,t,n,r,i){switch(n.type){case`run`:{Ns(e,n.run),i.onRun(n.run);let t=G.runs.detail(n.run.id);if(e.getQueryData(t)!==void 0&&e.setQueryData(t,e=>ss(e,n.run)),r(n.run.id),n.run.delegation?.role===`worker`){let t=G.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=G.runs.changes(n.run.id);e.getQueryData(a)!==void 0&&e.invalidateQueries({queryKey:a}),e.invalidateQueries({queryKey:G.worktrees}),e.invalidateQueries({queryKey:G.repoBranches});return}case`run-deleted`:i.onDeleted(n.id),e.removeQueries({queryKey:G.runs.detail(n.id)}),e.removeQueries({queryKey:G.runs.diff(n.id)}),e.setQueriesData(Ms,e=>e&&e.pages.some(e=>e.runs.some(e=>e.id===n.id))?{...e,pages:e.pages.map(e=>({...e,runs:e.runs.filter(e=>e.id!==n.id)}))}:e),e.invalidateQueries(Ms),e.invalidateQueries({queryKey:G.worktrees}),e.invalidateQueries({queryKey:G.repoBranches});return;case`usage`:t.set(n.usage);return;case`ping`:return}}function Fs(e,t=ds){let n=V();(0,Z.useEffect)(()=>{let r=ts;if(typeof r!=`function`)return;let i=null,a=ys(n),o=Os(n),s=Ds(n),c=js(n),l=!1,u,d=!1,f=!1,p=!1,m=!1,h=()=>{p=!0,m=!1;let e=W.providerStatus;n.cancelQueries({queryKey:e,exact:!0}).then(()=>n.invalidateQueries({queryKey:e,exact:!0,refetchType:`active`})).finally(()=>{if(f||!m){p=!1;return}h()})},g=()=>{f||u!==void 0||(u=setTimeout(()=>{u=void 0,f||_()},ps))},_=()=>{i?.close(),i=new r(t,{withCredentials:!0}),i.addEventListener(`open`,()=>{if(l=!0,Ra(!1),d&&(s.flush(),Cs(n)),!d){La(()=>Ss(n));for(let e of[G.health,W.models(`cursor`),W.runsIndex])n.cancelQueries({queryKey:e}).then(()=>{f||n.invalidateQueries({queryKey:e})})}d=!0});for(let t of ms)i.addEventListener(t,r=>{let i=ns(t,r.data);i&&(i.event.type===`ping`&&l&&(l=!1,La(()=>Ss(n)),Ra(!0)),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))&&Ps(n,e,i.event,o.refresh,c))});for(let e of hs)i.addEventListener(e,t=>{let r;try{r=JSON.parse(t.data)}catch{return}e===`project-ready`?a.refresh():e!==`checkout-progress`&&e!==`automation-change`&&n.invalidateQueries({queryKey:W.projects});for(let t of[...gs])t(e,r)});i.addEventListener(`health`,e=>{let t;try{t=JSON.parse(e.data)}catch{return}let r=Cn.safeParse(t);r.success&&(n.cancelQueries({queryKey:G.health}),n.setQueryData(G.health,r.data))}),i.addEventListener(`model-catalog`,e=>{let t;try{t=JSON.parse(e.data)}catch{return}let r=xa.safeParse(t);if(!r.success||r.data.runner!==`cursor`)return;let i=W.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=zn(t);if(!r)return;let i=W.providerStatus,a=qn(n.getQueryData(i),r);if(a!==void 0){n.setQueryData(i,a);return}if(p){m=!0;return}h()}),i.addEventListener(`error`,()=>{Ra(!1),i?.readyState===fs&&g()})},v=()=>{document.visibilityState===`visible`&&(s.flush(),(!i||i.readyState===fs)&&(clearTimeout(u),u=void 0,_()))},y=()=>{clearTimeout(u),u=void 0,s.flush()};document.addEventListener(`visibilitychange`,v),window.addEventListener(`pagehide`,y);let b=zt((e,t)=>(s.flush(),Cs(n,e,t)));return _(),()=>{b(),f=!0,Ra(!1),clearTimeout(u),s.flush(),s.cancel(),a.cancel(),o.cancel(),c.cancel(),document.removeEventListener(`visibilitychange`,v),window.removeEventListener(`pagehide`,y),i?.close(),i=null}},[n,e,t])}var Is=(0,Z.createContext)(null);function Ls({children:e}){let[t]=(0,Z.useState)(us);return Fs(t),Ir(),(0,Q.jsx)(Is.Provider,{value:t,children:e})}function Rs(e){let t=(0,Z.useContext)(Is),n=t?t.get:Bs;return(0,Z.useSyncExternalStore)(t?t.subscribe:zs,()=>e?n()[e]:void 0,()=>void 0)}var zs=()=>()=>void 0,Bs=()=>ls;function Vs(){return new $o({defaultOptions:{queries:{refetchInterval:!1,staleTime:5*6e4,gcTime:30*6e4,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:(e,t)=>t instanceof ft&&t.status>=400&&t.status<500?!1:e<1},mutations:{retry:!1}}})}var Hs=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}},Us=Y(`archive-restore`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h2`,key:`tvwodi`}],[`path`,{d:`M20 8v11a2 2 0 0 1-2 2h-2`,key:`1gkqxj`}],[`path`,{d:`m9 15 3-3 3 3`,key:`1pd0qc`}],[`path`,{d:`M12 12v9`,key:`192myk`}]]),Ws=Y(`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`}]]),Gs=Y(`boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),Ks=Y(`braces`,[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]]),qs=Y(`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`}]]),Js=Y(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),Ys=Y(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Xs=Y(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Zs=Y(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Qs=Y(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),$s=Y(`chevrons-left`,[[`path`,{d:`m11 17-5-5 5-5`,key:`13zhaf`}],[`path`,{d:`m18 17-5-5 5-5`,key:`h8a8et`}]]),ec=Y(`chevrons-right`,[[`path`,{d:`m6 17 5-5-5-5`,key:`xnjwq`}],[`path`,{d:`m13 17 5-5-5-5`,key:`17xmmf`}]]),tc=Y(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]),nc=Y(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),rc=Y(`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`}]]),ic=Y(`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`}]]),ac=Y(`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`}]]),oc=Y(`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`}]]),sc=Y(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),cc=Y(`diamond`,[[`path`,{d:`M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z`,key:`1f1r0c`}]]),lc=Y(`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`}]]),uc=Y(`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`}]]),dc=Y(`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`}]]),fc=Y(`feather`,[[`path`,{d:`M12.67 19a2 2 0 0 0 1.416-.588l6.154-6.172a6 6 0 0 0-8.49-8.49L5.586 9.914A2 2 0 0 0 5 11.328V18a1 1 0 0 0 1 1z`,key:`18jl4k`}],[`path`,{d:`M16 8 2 22`,key:`vp34q`}],[`path`,{d:`M17.5 15H9`,key:`1oz8nu`}]]),pc=Y(`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`}]]),mc=Y(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),hc=Y(`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`}]]),gc=Y(`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`}]]),_c=Y(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),vc=Y(`gem`,[[`path`,{d:`M10.5 3 8 9l4 13 4-13-2.5-6`,key:`b3dvk1`}],[`path`,{d:`M17 3a2 2 0 0 1 1.6.8l3 4a2 2 0 0 1 .013 2.382l-7.99 10.986a2 2 0 0 1-3.247 0l-7.99-10.986A2 2 0 0 1 2.4 7.8l2.998-3.997A2 2 0 0 1 7 3z`,key:`7w4byz`}],[`path`,{d:`M2 9h20`,key:`16fsjt`}]]),yc=Y(`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`}]]),bc=Y(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),xc=Y(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),Sc=Y(`hammer`,[[`path`,{d:`m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9`,key:`1hayfq`}],[`path`,{d:`m18 15 4-4`,key:`16gjal`}],[`path`,{d:`m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5`,key:`15ts47`}]]),Cc=Y(`hexagon`,[[`path`,{d:`M21 16V8a2 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.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z`,key:`yt0hxn`}]]),wc=Y(`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`}]]),Tc=Y(`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`}]]),Ec=Y(`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`}]]),Dc=Y(`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`}]]),Oc=Y(`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`}]]),kc=Y(`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`}]]),Ac=Y(`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`}]]),jc=Y(`mouse-pointer-2`,[[`path`,{d:`M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z`,key:`edeuup`}]]),Mc=Y(`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`}]]),Nc=Y(`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`}]]),Pc=Y(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),Fc=Y(`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`}]]),Ic=Y(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Lc=Y(`rocket`,[[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}],[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09`,key:`u4xsad`}],[`path`,{d:`M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z`,key:`676m9`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05`,key:`92ym6u`}]]),Rc=Y(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),zc=Y(`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`}]]),Bc=Y(`shapes`,[[`path`,{d:`M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z`,key:`1bo67w`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}],[`circle`,{cx:`17.5`,cy:`17.5`,r:`3.5`,key:`w3z12y`}]]),Vc=Y(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),Hc=Y(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),Uc=Y(`square-terminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),Wc=Y(`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`}]]),Gc=Y(`waves-horizontal`,[[`path`,{d:`M2 12q2.5 2 5 0t5 0 5 0 5 0`,key:`8ddzzs`}],[`path`,{d:`M2 19q2.5 2 5 0t5 0 5 0 5 0`,key:`1wj4st`}],[`path`,{d:`M2 5q2.5 2 5 0t5 0 5 0 5 0`,key:`69x50u`}]]),Kc=Y(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),qc=Y(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),Jc=`cez-last-location`;function Yc(){try{let e=localStorage.getItem(Jc);return e===null?null:JSON.parse(e)}catch{return null}}function Xc(e){try{localStorage.setItem(Jc,JSON.stringify(e))}catch{}}var Zc=new Set([`projectId`,`pathname`,`search`,`hash`]);function Qc(e){if(typeof e!=`object`||!e||Array.isArray(e))return null;let t=e;if(Object.keys(t).some(e=>!Zc.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(Ja(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 $c(e,t){let n=t.projects.find(t=>t.id===e);return n!==void 0&&n.status!==`missing`}function el(e,t){if(t===void 0)return null;let n;try{n=Ja(e.pathname)}catch{return null}return n===null||!$c(n,t)?null:Qc({projectId:n,pathname:e.pathname,...e.search===``?{}:{search:e.search},...e.hash===``?{}:{hash:e.hash}})}function tl(e,t,n){let r=Qc(e);return r===null||!(t===void 0?n!==void 0&&r.projectId===n:$c(r.projectId,t))?null:`${r.pathname}${r.search??``}${r.hash??``}`}function nl(e,t){let n=Qc(e);return n!==null&&n.projectId===t.projectId&&n.pathname===t.pathname&&(n.search??``)===(t.search??``)&&(n.hash??``)===(t.hash??``)}var rl=`cez-project-locations`;function il(){try{let e=localStorage.getItem(rl),t=e===null?null:JSON.parse(e);return typeof t==`object`&&t&&!Array.isArray(t)?t:{}}catch{return{}}}function al(e){let t=il()[e];return t===void 0?null:t}function ol(e){try{localStorage.setItem(rl,JSON.stringify({...il(),[e.projectId]:e}))}catch{}}function sl(e,t,n){let r=Qc(t);return r===null||r.projectId!==e||n===void 0||!$c(e,n)?null:`${r.pathname}${r.search??``}${r.hash??``}`}function cl(){return(0,Q.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(ra,{icon:(0,Q.jsx)(Ga,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading GitHub…`,subtitle:`Fetching open issues and pull requests.`})})}var ll=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`}),ul=`VisuallyHidden`,dl=Z.forwardRef((e,t)=>(0,Q.jsx)(p.span,{...e,ref:t,style:{...ll,...e.style}}));dl.displayName=ul;var fl=dl,pl=`Collapsible`,[ml,hl]=y(pl),[gl,_l]=ml(pl),vl=Z.forwardRef((e,t)=>{let{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:a,onOpenChange:o,...s}=e,[c,l]=D({prop:r,defaultProp:i??!1,onChange:o,caller:pl});return(0,Q.jsx)(gl,{scope:n,disabled:a,contentId:_(),open:c,onOpenToggle:Z.useCallback(()=>l(e=>!e),[l]),children:(0,Q.jsx)(p.div,{"data-state":wl(c),"data-disabled":a?``:void 0,...s,ref:t})})});vl.displayName=pl;var yl=`CollapsibleTrigger`,bl=Z.forwardRef((e,t)=>{let{__scopeCollapsible:n,...r}=e,i=_l(yl,n);return(0,Q.jsx)(p.button,{type:`button`,"aria-controls":i.open?i.contentId:void 0,"aria-expanded":i.open||!1,"data-state":wl(i.open),"data-disabled":i.disabled?``:void 0,disabled:i.disabled,...r,ref:t,onClick:b(e.onClick,i.onOpenToggle)})});bl.displayName=yl;var xl=`CollapsibleContent`,Sl=Z.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=_l(xl,e.__scopeCollapsible);return(0,Q.jsx)(v,{present:n||i.open,children:({present:e})=>(0,Q.jsx)(Cl,{...r,ref:t,present:e})})});Sl.displayName=xl;var Cl=Z.forwardRef((e,t)=>{let{__scopeCollapsible:n,present:r,children:i,...o}=e,s=_l(xl,n),[c,l]=Z.useState(r),u=Z.useRef(null),d=a(t,u),f=Z.useRef(0),m=f.current,h=Z.useRef(0),g=h.current,_=s.open||c,v=Z.useRef(_),y=Z.useRef(void 0);return Z.useEffect(()=>{let e=requestAnimationFrame(()=>v.current=!1);return()=>cancelAnimationFrame(e)},[]),w(()=>{let e=u.current;if(e){y.current=y.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();f.current=t.height,h.current=t.width,v.current||(e.style.transitionDuration=y.current.transitionDuration,e.style.animationName=y.current.animationName),l(r)}},[s.open,r]),(0,Q.jsx)(p.div,{"data-state":wl(s.open),"data-disabled":s.disabled?``:void 0,id:s.contentId,hidden:!_,...o,ref:d,style:{"--radix-collapsible-content-height":m?`${m}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...e.style},children:_&&i})});function wl(e){return e?`open`:`closed`}var Tl=vl;function El(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 Dl=`Label`,Ol=Z.forwardRef((e,t)=>(0,Q.jsx)(p.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));Ol.displayName=Dl;var kl=Ol;function Al(e,[t,n]){return Math.min(n,Math.max(t,e))}var jl=e(r(),1),Ml=[` `,`Enter`,`ArrowUp`,`ArrowDown`],Nl=[` `,`Enter`],Pl=`Select`,[Fl,Il,Ll]=ir(Pl),[Rl,zl]=y(Pl,[Ll,lr]),Bl=lr(),[Vl,Hl]=Rl(Pl),[Ul,Wl]=Rl(Pl),Gl=`SelectProvider`;function Kl(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m,internal_do_not_use_render:h}=e,g=Bl(t),[v,y]=Z.useState(null),[b,x]=Z.useState(null),[S,C]=Z.useState(!1),w=B(l),[T,E]=D({prop:r,defaultProp:i??!1,onChange:a,caller:Pl}),[O,k]=D({prop:o,defaultProp:s,onChange:c,caller:Pl}),A=Z.useRef(null),j=Z.useRef(O);Z.useEffect(()=>{let e=m?v?.ownerDocument.getElementById(m):v?.form;if(e instanceof HTMLFormElement){let t=()=>k(j.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[m,v,k]);let M=!v||!!m||!!v.closest(`form`),[N,P]=Z.useState(new Set),F=_(),I=Array.from(N).map(e=>e.props.value).join(`;`),ee=Z.useCallback(e=>{P(t=>new Set(t).add(e))},[]),L=Z.useCallback(e=>{P(t=>{let n=new Set(t);return n.delete(e),n})},[]),R={required:p,trigger:v,onTriggerChange:y,valueNode:b,onValueNodeChange:x,valueNodeHasChildren:S,onValueNodeHasChildrenChange:C,contentId:F,value:O,onValueChange:k,open:T,onOpenChange:E,dir:w,triggerPointerDownPosRef:A,disabled:f,name:u,autoComplete:d,form:m,nativeOptions:N,nativeSelectKey:I,isFormControl:M};return(0,Q.jsx)(It,{...g,children:(0,Q.jsx)(Vl,{scope:t,...R,children:(0,Q.jsx)(Fl.Provider,{scope:t,children:(0,Q.jsx)(Ul,{scope:t,onNativeOptionAdd:ee,onNativeOptionRemove:L,children:Ku(h)?h(R):n})})})})}Kl.displayName=Gl;var ql=e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,Q.jsx)(Kl,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,Q.jsxs)(Q.Fragment,{children:[n,e?(0,Q.jsx)(Gu,{__scopeSelect:t}):null]})})};ql.displayName=Pl;var Jl=`SelectTrigger`,Yl=Z.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,o=Bl(n),s=Hl(Jl,n),c=s.disabled||r,l=a(t,s.onTriggerChange),u=Il(n),d=Z.useRef(`touch`),[f,m,h]=Ju(e=>{let t=u().filter(e=>!e.disabled),n=Yu(t,e,t.find(e=>e.value===s.value));n!==void 0&&s.onValueChange(n.value)}),g=e=>{c||(s.onOpenChange(!0),h()),e&&(s.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,Q.jsx)(At,{asChild:!0,...o,children:(0,Q.jsx)(p.button,{type:`button`,role:`combobox`,"aria-controls":s.open?s.contentId:void 0,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":`none`,dir:s.dir,"data-state":s.open?`open`:`closed`,disabled:c,"data-disabled":c?``:void 0,"data-placeholder":qu(s.value)?``:void 0,...i,ref:l,onClick:b(i.onClick,e=>{e.currentTarget.focus(),d.current!==`mouse`&&g(e)}),onPointerDown:b(i.onPointerDown,e=>{d.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(g(e),e.preventDefault())}),onKeyDown:b(i.onKeyDown,e=>{let t=f.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&m(e.key),!(t&&e.key===` `)&&Ml.includes(e.key)&&(g(),e.preventDefault())})})})});Yl.displayName=Jl;var Xl=`SelectValue`,Zl=Z.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:o,placeholder:s=``,...c}=e,l=Hl(Xl,n),{onValueNodeHasChildrenChange:u}=l,d=o!==void 0,f=a(t,l.onValueNodeChange);w(()=>{u(d)},[u,d]);let m=qu(l.value);return(0,Q.jsx)(p.span,{...c,asChild:!m&&c.asChild,ref:f,style:{pointerEvents:`none`},children:(0,Q.jsx)(Z.Fragment,{children:m?s:o},m?`placeholder`:`value`)})});Zl.displayName=Xl;var Ql=`SelectIcon`,$l=Z.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,Q.jsx)(p.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});$l.displayName=Ql;var eu=`SelectPortal`,[tu,nu]=Rl(eu,{forceMount:void 0}),ru=e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,Q.jsx)(tu,{scope:e.__scopeSelect,forceMount:n,children:(0,Q.jsx)(E,{asChild:!0,...r})})};ru.displayName=eu;var iu=`SelectContent`,au=Z.forwardRef((e,t)=>{let n=nu(iu,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=Hl(iu,e.__scopeSelect),[o,s]=Z.useState();return w(()=>{s(new DocumentFragment)},[]),(0,Q.jsx)(v,{present:r||a.open,children:({present:e})=>e?(0,Q.jsx)(fu,{...i,ref:t}):(0,Q.jsx)(ou,{...i,fragment:o})})});au.displayName=iu;var ou=Z.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,fragment:i}=e;return i?jl.createPortal((0,Q.jsx)(cu,{scope:n,children:(0,Q.jsx)(Fl.Slot,{scope:n,children:(0,Q.jsx)(`div`,{ref:t,children:r})})}),i):null});ou.displayName=`SelectContentFragment`;var su=10,[cu,lu]=Rl(iu),uu=`SelectContentImpl`,du=h(`SelectContent.RemoveScroll`),fu=Z.forwardRef((e,t)=>{let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:o,onPointerDownOutside:s,side:c,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:p,collisionPadding:h,sticky:_,hideWhenDetached:v,avoidCollisions:y,...S}=e,C=Hl(iu,n),[w,T]=Z.useState(null),[E,D]=Z.useState(null),A=a(t,T),[j,M]=Z.useState(null),[N,P]=Z.useState(null),F=Il(n),[I,ee]=Z.useState(!1),L=Z.useRef(!1);Z.useEffect(()=>{if(w)return O(w)},[w]),m();let R=Z.useCallback(e=>{let[t,...n]=F().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&E&&(E.scrollTop=0),n===r&&E&&(E.scrollTop=E.scrollHeight),n?.focus(),document.activeElement!==i))return},[F,E]),te=Z.useCallback(()=>R([j,w]),[R,j,w]);Z.useEffect(()=>{I&&te()},[I,te]);let{onOpenChange:ne,triggerPointerDownPosRef:z}=C;Z.useEffect(()=>{if(w){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(z.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(z.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(w)||ne(!1),document.removeEventListener(`pointermove`,t),z.current=null};return z.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[w,ne,z]),Z.useEffect(()=>{let e=()=>ne(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[ne]);let[re,B]=Ju(e=>{let t=F().filter(e=>!e.disabled),n=Yu(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),ie=Z.useCallback((e,t,n)=>{let r=!L.current&&!n;(C.value!==void 0&&C.value===t||r)&&(M(e),r&&(L.current=!0))},[C.value]),ae=Z.useCallback(()=>w?.focus(),[w]),oe=Z.useCallback((e,t,n)=>{let r=!L.current&&!n;(C.value!==void 0&&C.value===t||r)&&P(e)},[C.value]),se=r===`popper`?gu:mu,ce=se===gu?{side:c,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:p,collisionPadding:h,sticky:_,hideWhenDetached:v,avoidCollisions:y}:{};return(0,Q.jsx)(cu,{scope:n,content:w,viewport:E,onViewportChange:D,itemRefCallback:ie,selectedItem:j,onItemLeave:ae,itemTextRefCallback:oe,focusSelectedItem:te,selectedItemText:N,position:r,isPositioned:I,searchRef:re,children:(0,Q.jsx)(x,{as:du,allowPinchZoom:!0,children:(0,Q.jsx)(k,{asChild:!0,trapped:C.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:b(i,e=>{C.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,Q.jsx)(g,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>C.onOpenChange(!1),children:(0,Q.jsx)(se,{role:`listbox`,id:C.contentId,"data-state":C.open?`open`:`closed`,dir:C.dir,onContextMenu:e=>e.preventDefault(),...S,...ce,onPlaced:()=>ee(!0),ref:A,style:{display:`flex`,flexDirection:`column`,outline:`none`,...S.style},onKeyDown:b(S.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&B(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=F().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>R(t)),e.preventDefault()}})})})})})})});fu.displayName=uu;var pu=`SelectItemAlignedPosition`,mu=Z.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,o=Hl(iu,n),s=lu(iu,n),[c,l]=Z.useState(null),[u,d]=Z.useState(null),f=a(t,d),m=Il(n),h=Z.useRef(!1),g=Z.useRef(!0),{viewport:_,selectedItem:v,selectedItemText:y,focusSelectedItem:b}=s,x=Z.useCallback(()=>{if(o.trigger&&o.valueNode&&c&&u&&_&&v&&y){let e=o.trigger.getBoundingClientRect(),t=u.getBoundingClientRect(),n=o.valueNode.getBoundingClientRect(),i=y.getBoundingClientRect();if(o.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-su,d=Al(a,[su,Math.max(su,u-l)]);c.style.minWidth=s+`px`,c.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-su,d=Al(a,[su,Math.max(su,u-l)]);c.style.minWidth=s+`px`,c.style.right=d+`px`}let a=m(),s=window.innerHeight-su*2,l=_.scrollHeight,d=window.getComputedStyle(u),f=parseInt(d.borderTopWidth,10),p=parseInt(d.paddingTop,10),g=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=f+p+l+b+g,S=Math.min(v.offsetHeight*5,x),C=window.getComputedStyle(_),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-su,D=s-E,O=v.offsetHeight/2,k=v.offsetTop+O,A=f+p+k,j=x-A;if(A<=E){let e=a.length>0&&v===a[a.length-1].ref.current;c.style.bottom=`0px`;let t=u.clientHeight-_.offsetTop-_.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+g);c.style.height=n+`px`}else{let e=a.length>0&&v===a[0].ref.current;c.style.top=`0px`;let t=Math.max(E,f+_.offsetTop+(e?w:0)+O)+j;c.style.height=t+`px`,_.scrollTop=A-E+_.offsetTop}c.style.margin=`${su}px 0`,c.style.minHeight=S+`px`,c.style.maxHeight=s+`px`,r?.(),requestAnimationFrame(()=>h.current=!0)}},[m,o.trigger,o.valueNode,c,u,_,v,y,o.dir,r]);w(()=>x(),[x]);let[S,C]=Z.useState();return w(()=>{u&&C(window.getComputedStyle(u).zIndex)},[u]),(0,Q.jsx)(_u,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:h,onScrollButtonChange:Z.useCallback(e=>{e&&g.current===!0&&(x(),b?.(),g.current=!1)},[x,b]),children:(0,Q.jsx)(`div`,{ref:l,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:S},children:(0,Q.jsx)(p.div,{...i,ref:f,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});mu.displayName=pu;var hu=`SelectPopperPosition`,gu=Z.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=su,...a}=e,o=Bl(n);return(0,Q.jsx)(fr,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});gu.displayName=hu;var[_u,vu]=Rl(iu,{}),yu=`SelectViewport`,bu=Z.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,o=lu(yu,n),s=vu(yu,n),c=a(t,o.onViewportChange),l=Z.useRef(0);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,Q.jsx)(Fl.Slot,{scope:n,children:(0,Q.jsx)(p.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:c,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:b(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=s;if(r?.current&&n){let e=Math.abs(l.current-t.scrollTop);if(e>0){let r=window.innerHeight-su*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}l.current=t.scrollTop})})})]})});bu.displayName=yu;var xu=`SelectGroup`,[Su,Cu]=Rl(xu),wu=Z.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=_();return(0,Q.jsx)(Su,{scope:n,id:i,children:(0,Q.jsx)(p.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});wu.displayName=xu;var Tu=`SelectLabel`,Eu=Z.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Cu(Tu,n);return(0,Q.jsx)(p.div,{id:i.id,...r,ref:t})});Eu.displayName=Tu;var Du=`SelectItem`,[Ou,ku]=Rl(Du),Au=Z.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:o,...s}=e,c=Hl(Du,n),l=lu(Du,n),u=c.value===r,[d,f]=Z.useState(o??``),[m,h]=Z.useState(!1),g=a(t,j(e=>l.itemRefCallback?.(e,r,i))),v=_(),y=Z.useRef(`touch`),x=()=>{i||(c.onValueChange(r),c.onOpenChange(!1))};return(0,Q.jsx)(Ou,{scope:n,value:r,disabled:i,textId:v,isSelected:u,onItemTextChange:Z.useCallback(e=>{f(t=>t||(e?.textContent??``).trim())},[]),children:(0,Q.jsx)(Fl.ItemSlot,{scope:n,value:r,disabled:i,textValue:d,children:(0,Q.jsx)(p.div,{role:`option`,"aria-labelledby":v,"data-highlighted":m?``:void 0,"aria-selected":u&&m,"data-state":u?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...s,ref:g,onFocus:b(s.onFocus,()=>h(!0)),onBlur:b(s.onBlur,()=>h(!1)),onClick:b(s.onClick,()=>{y.current!==`mouse`&&x()}),onPointerUp:b(s.onPointerUp,()=>{y.current===`mouse`&&x()}),onPointerDown:b(s.onPointerDown,e=>{y.current=e.pointerType}),onPointerMove:b(s.onPointerMove,e=>{y.current=e.pointerType,i?l.onItemLeave?.():y.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:b(s.onPointerLeave,e=>{e.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:b(s.onKeyDown,e=>{i||e.target!==e.currentTarget||l.searchRef?.current!==``&&e.key===` `||(Nl.includes(e.key)&&x(),e.key===` `&&e.preventDefault())})})})})});Au.displayName=Du;var ju=`SelectItemText`,Mu=Z.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...o}=e,s=Hl(ju,n),c=lu(ju,n),l=ku(ju,n),u=Wl(ju,n),[d,f]=Z.useState(null),m=j(e=>c.itemTextRefCallback?.(e,l.value,l.disabled)),h=a(t,f,l.onItemTextChange,m),g=d?.textContent,_=Z.useMemo(()=>(0,Q.jsx)(`option`,{value:l.value,disabled:l.disabled,children:g},l.value),[l.disabled,l.value,g]),{onNativeOptionAdd:v,onNativeOptionRemove:y}=u;return w(()=>(v(_),()=>y(_)),[v,y,_]),(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(p.span,{id:l.textId,...o,ref:h}),l.isSelected&&s.valueNode&&!s.valueNodeHasChildren&&!qu(s.value)?jl.createPortal(o.children,s.valueNode):null]})});Mu.displayName=ju;var Nu=`SelectItemIndicator`,Pu=Z.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return ku(Nu,n).isSelected?(0,Q.jsx)(p.span,{"aria-hidden":!0,...r,ref:t}):null});Pu.displayName=Nu;var Fu=`SelectScrollUpButton`,Iu=Z.forwardRef((e,t)=>{let n=lu(Fu,e.__scopeSelect),r=vu(Fu,e.__scopeSelect),[i,o]=Z.useState(!1),s=a(t,r.onScrollButtonChange);return w(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;o(e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,Q.jsx)(zu,{...e,ref:s,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});Iu.displayName=Fu;var Lu=`SelectScrollDownButton`,Ru=Z.forwardRef((e,t)=>{let n=lu(Lu,e.__scopeSelect),r=vu(Lu,e.__scopeSelect),[i,o]=Z.useState(!1),s=a(t,r.onScrollButtonChange);return w(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;o(n)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,Q.jsx)(zu,{...e,ref:s,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});Ru.displayName=Lu;var zu=Z.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=lu(`SelectScrollButton`,n),o=Z.useRef(null),s=Il(n),c=Z.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return Z.useEffect(()=>()=>c(),[c]),w(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,Q.jsx)(p.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:b(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:b(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:b(i.onPointerLeave,()=>{c()})})}),Bu=`SelectSeparator`,Vu=Z.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,Q.jsx)(p.div,{"aria-hidden":!0,...r,ref:t})});Vu.displayName=Bu;var Hu=`SelectArrow`,Uu=Z.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Bl(n);return lu(Hu,n).position===`popper`?(0,Q.jsx)(tr,{...i,...r,ref:t}):null});Uu.displayName=Hu;var Wu=`SelectBubbleInput`,Gu=Z.forwardRef(({__scopeSelect:e,...t},n)=>{let r=Hl(Wu,e),{value:i,onValueChange:o,required:s,disabled:c,name:l,autoComplete:u,form:d}=r,{nativeOptions:f,nativeSelectKey:m}=r,h=Z.useRef(null),g=a(n,h),_=i??``,v=El(_),y=Array.from(f).some(e=>(e.props.value??``)===``);return Z.useEffect(()=>{let e=h.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(v!==_&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,_),e.dispatchEvent(t)}},[v,_]),(0,Q.jsxs)(p.select,{"aria-hidden":!0,required:s,tabIndex:-1,name:l,autoComplete:u,disabled:c,form:d,onChange:e=>o(e.target.value),...t,style:{...ll,...t.style},ref:g,defaultValue:_,children:[qu(i)&&!y?(0,Q.jsx)(`option`,{value:``}):null,Array.from(f)]},m)});Gu.displayName=Wu;function Ku(e){return typeof e==`function`}function qu(e){return e===``||e===void 0}function Ju(e){let t=j(e),n=Z.useRef(``),r=Z.useRef(0),i=Z.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=Z.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return Z.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function Yu(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Xu(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function Xu(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Zu=`Switch`,[Qu,$u]=y(Zu),[ed,td]=Qu(Zu);function nd(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]=D({prop:n,defaultProp:i??!1,onChange:c,caller:Zu}),[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)(ed,{scope:t,...v,children:ud(d)?d(v):r})}var rd=`SwitchTrigger`,id=Z.forwardRef(({__scopeSwitch:e,onClick:t,...n},r)=>{let{control:i,form:o,value:s,disabled:c,checked:l,required:u,setControl:d,setChecked:f,hasConsumerStoppedPropagationRef:m,isFormControl:h,bubbleInput:g}=td(rd,e),_=a(r,d),v=Z.useRef(l);return Z.useEffect(()=>{let e=o?i?.ownerDocument.getElementById(o):i?.form;if(e instanceof HTMLFormElement){let t=()=>f(v.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[i,o,f]),(0,Q.jsx)(p.button,{type:`button`,role:`switch`,"aria-checked":l,"aria-required":u,"data-state":dd(l),"data-disabled":c?``:void 0,disabled:c,value:s,...n,ref:_,onClick:b(t,e=>{f(e=>!e),g&&h&&(m.current=e.isPropagationStopped(),m.current||e.stopPropagation())})})});id.displayName=rd;var ad=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)(nd,{__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)(id,{...d,ref:t,__scopeSwitch:n}),e&&(0,Q.jsx)(ld,{__scopeSwitch:n})]})})});ad.displayName=Zu;var od=`SwitchThumb`,sd=Z.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=td(od,n);return(0,Q.jsx)(p.span,{"data-state":dd(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});sd.displayName=od;var cd=`SwitchBubbleInput`,ld=Z.forwardRef(({__scopeSwitch:e,...t},n)=>{let{control:r,hasConsumerStoppedPropagationRef:i,checked:o,defaultChecked:s,required:c,disabled:l,name:u,value:d,form:f,bubbleInput:m,setBubbleInput:h}=td(cd,e),g=a(n,h),_=El(o),v=nt(r);Z.useEffect(()=>{let e=m;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!i.current;if(_!==o&&n){let t=new Event(`click`,{bubbles:r});n.call(e,o),e.dispatchEvent(t)}},[m,_,o,i]);let y=Z.useRef(o);return(0,Q.jsx)(p.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:s??y.current,required:c,disabled:l,name:u,value:d,form:f,...t,tabIndex:-1,ref:g,style:{...t.style,...v,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});ld.displayName=cd;function ud(e){return typeof e==`function`}function dd(e){return e?`checked`:`unchecked`}var fd=`Tabs`,[pd,md]=y(fd,[Zt]),hd=Zt(),[gd,_d]=pd(fd),vd=Z.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=B(s),[d,f]=D({prop:r,onChange:i,defaultProp:a??``,caller:fd});return(0,Q.jsx)(gd,{scope:n,baseId:_(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,Q.jsx)(p.div,{dir:u,"data-orientation":o,...l,ref:t})})});vd.displayName=fd;var yd=`TabsList`,bd=Z.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=_d(yd,n),o=hd(n);return(0,Q.jsx)(nn,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,Q.jsx)(p.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});bd.displayName=yd;var xd=`TabsTrigger`,Sd=Z.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=_d(xd,n),s=hd(n),c=Td(o.baseId,r),l=Ed(o.baseId,r),u=r===o.value;return(0,Q.jsx)(Sn,{asChild:!0,...s,focusable:!i,active:u,children:(0,Q.jsx)(p.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:b(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:b(e.onKeyDown,e=>{i||e.target!==e.currentTarget||[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:b(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});Sd.displayName=xd;var Cd=`TabsContent`,wd=Z.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=_d(Cd,n),c=Td(s.baseId,r),l=Ed(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)(v,{present:i||u,children:({present:n})=>(0,Q.jsx)(p.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})})});wd.displayName=Cd;function Td(e,t){return`${e}-trigger-${t}`}function Ed(e,t){return`${e}-content-${t}`}var Dd=vd,Od=bd,kd=Sd,Ad=wd,[jd,Md]=y(`Tooltip`,[lr]),Nd=lr(),Pd=`TooltipProvider`,Fd=700,Id=`tooltip.open`,[Ld,Rd]=jd(Pd),zd=e=>{let{__scopeTooltip:t,delayDuration:n=Fd,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)(Ld,{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})};zd.displayName=Pd;var Bd=`Tooltip`,[Vd,Hd]=jd(Bd),Ud=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=Rd(Bd,e.__scopeTooltip),l=Nd(t),[u,d]=Z.useState(null),f=_(),p=Z.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=Z.useRef(!1),[v,y]=D({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(Id))):c.onClose(),a?.(e)},caller:Bd}),b=Z.useMemo(()=>v?g.current?`delayed-open`:`instant-open`:`closed`,[v]),x=Z.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,y(!0)},[y]),S=Z.useCallback(()=>{window.clearTimeout(p.current),p.current=0,y(!1)},[y]),C=Z.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,y(!0),p.current=0},h)},[h,y]);return Z.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,Q.jsx)(It,{...l,children:(0,Q.jsx)(Vd,{scope:t,contentId:f,open:v,stateAttribute:b,trigger:u,onTriggerChange:d,onTriggerEnter:Z.useCallback(()=>{c.isOpenDelayedRef.current?C():x()},[c.isOpenDelayedRef,C,x]),onTriggerLeave:Z.useCallback(()=>{m?S():(window.clearTimeout(p.current),p.current=0)},[S,m]),onOpen:x,onClose:S,disableHoverableContent:m,children:n})})};Ud.displayName=Bd;var Wd=`TooltipTrigger`,Gd=Z.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Hd(Wd,n),o=Rd(Wd,n),s=Nd(n),c=a(t,Z.useRef(null),i.onTriggerChange),l=Z.useRef(!1),u=Z.useRef(!1),d=Z.useCallback(()=>l.current=!1,[]);return Z.useEffect(()=>()=>document.removeEventListener(`pointerup`,d),[d]),(0,Q.jsx)(At,{asChild:!0,...s,children:(0,Q.jsx)(p.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:c,onPointerMove:b(e.onPointerMove,e=>{e.pointerType!==`touch`&&!u.current&&!o.isPointerInTransitRef.current&&(i.onTriggerEnter(),u.current=!0)}),onPointerLeave:b(e.onPointerLeave,()=>{i.onTriggerLeave(),u.current=!1}),onPointerDown:b(e.onPointerDown,()=>{i.open&&i.onClose(),l.current=!0,document.addEventListener(`pointerup`,d,{once:!0})}),onFocus:b(e.onFocus,()=>{l.current||i.onOpen()}),onBlur:b(e.onBlur,i.onClose),onClick:b(e.onClick,i.onClose)})})});Gd.displayName=Wd;var Kd=`TooltipPortal`,[qd,Jd]=jd(Kd,{forceMount:void 0}),Yd=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=Hd(Kd,t);return(0,Q.jsx)(qd,{scope:t,forceMount:n,children:(0,Q.jsx)(v,{present:n||a.open,children:(0,Q.jsx)(E,{asChild:!0,container:i,children:r})})})};Yd.displayName=Kd;var Xd=`TooltipContent`,Zd=Z.forwardRef((e,t)=>{let n=Jd(Xd,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=Hd(Xd,e.__scopeTooltip);return(0,Q.jsx)(v,{present:r||o.open,children:o.disableHoverableContent?(0,Q.jsx)(nf,{side:i,...a,ref:t}):(0,Q.jsx)(Qd,{side:i,...a,ref:t})})}),Qd=Z.forwardRef((e,t)=>{let n=Hd(Xd,e.__scopeTooltip),r=Rd(Xd,e.__scopeTooltip),i=Z.useRef(null),o=a(t,i),[s,c]=Z.useState(null),{trigger:l,onClose:u}=n,d=i.current,{onPointerInTransitChange:f}=r,p=Z.useCallback(()=>{c(null),f(!1)},[f]),m=Z.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=sf(r,of(r,n.getBoundingClientRect())),a=cf(t.getBoundingClientRect()),o=uf([...i,...a]);c(o),f(!0)},[f]);return Z.useEffect(()=>()=>p(),[p]),Z.useEffect(()=>{if(l&&d){let e=e=>m(e,d),t=e=>m(e,l);return l.addEventListener(`pointerleave`,e),d.addEventListener(`pointerleave`,t),()=>{l.removeEventListener(`pointerleave`,e),d.removeEventListener(`pointerleave`,t)}}},[l,d,m,p]),Z.useEffect(()=>{if(s){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=l?.contains(t)||d?.contains(t),i=!lf(n,s);r?p():i&&(p(),u())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[l,d,s,u,p]),(0,Q.jsx)(nf,{...e,ref:o})}),[$d,ef]=jd(Bd,{isInside:!1}),tf=N(`TooltipContent`),nf=Z.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=Hd(Xd,n),l=Nd(n),{onClose:u}=c;return Z.useEffect(()=>(document.addEventListener(Id,u),()=>document.removeEventListener(Id,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)(g,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,Q.jsxs)(fr,{"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)(tf,{children:r}),(0,Q.jsx)($d,{scope:n,isInside:!0,children:(0,Q.jsx)(fl,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});Zd.displayName=Xd;var rf=`TooltipArrow`,af=Z.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Nd(n);return ef(rf,n).isInside?null:(0,Q.jsx)(tr,{...i,...r,ref:t})});af.displayName=rf;function of(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 sf(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 cf(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 lf(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 uf(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)),df(t)}function df(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 ff=zd,pf=Ud,mf=Gd,hf=Yd,gf=Zd,_f=af;function vf(){return(0,Q.jsxs)(`div`,{"data-route":`inbox`,className:`task-flow-page flex min-h-full flex-col gap-5`,children:[(0,Q.jsx)(`h1`,{className:`text-[28px] font-medium`,children:`Inbox has been removed`}),(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Agents no longer generate inbox suggestions. Create an ordinary task for work you want to run.`}),(0,Q.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Existing entries stay in `,(0,Q.jsx)(`code`,{children:`.ai/cezar/todos.json`}),` in the original project. To export them, run this command from that project:`]}),(0,Q.jsx)(`pre`,{className:`overflow-x-auto rounded-xl border border-border bg-card p-4 text-sm`,children:(0,Q.jsx)(`code`,{children:`cp .ai/cezar/todos.json ./cezar-followups-export.json`})}),(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`If the file is absent, there is nothing to export. Task Notes and Continue still work.`}),(0,Q.jsx)(X,{to:`/new`,className:T({className:`min-h-11 self-start`}),children:`New task`})]})}var yf=1,bf=.9,xf=.8,Sf=.17,Cf=.1,wf=.999,Tf=.9999,Ef=.99,Df=/[\\\/_+.#"@\[\(\{&]/,Of=/[\\\/_+.#"@\[\(\{&]/g,kf=/[\s-]/,Af=/[\s-]/g;function jf(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?yf:Ef;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=jf(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=yf:Df.test(e.charAt(l-1))?(d*=xf,p=e.slice(i,l-1).match(Of),p&&i>0&&(d*=wf**+p.length)):kf.test(e.charAt(l-1))?(d*=bf,m=e.slice(i,l-1).match(Af),m&&i>0&&(d*=wf**+m.length)):(d*=Sf,i>0&&(d*=wf**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=Tf)),(d<Cf&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=jf(e,t,n,r,l+1,a+2,o),f*Cf>d&&(d=f*Cf)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function Mf(e){return e.toLowerCase().replace(Af,` `)}function Nf(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,jf(e,t,Mf(e),Mf(t),0,0,{})}var Pf=`[cmdk-group=""]`,Ff=`[cmdk-group-items=""]`,If=`[cmdk-group-heading=""]`,Lf=`[cmdk-item=""]`,Rf=`${Lf}:not([aria-disabled="true"])`,zf=`cmdk-item-select`,Bf=`data-value`,Vf=(e,t,n)=>Nf(e,t,n),Hf=Z.createContext(void 0),Uf=()=>Z.useContext(Hf),Wf=Z.createContext(void 0),Gf=()=>Z.useContext(Wf),Kf=Z.createContext(void 0),qf=Z.forwardRef((e,t)=>{let n=sp(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=sp(()=>new Set),i=sp(()=>new Map),a=sp(()=>new Map),o=sp(()=>new Set),s=ap(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:m,loop:h,disablePointerSelection:g=!1,vimBindings:v=!0,...y}=e,b=_(),x=_(),S=_(),C=Z.useRef(null),w=up();op(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,T.emit()}},[u]),op(()=>{w(6,j)},[]);let T=Z.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)A(),O(),w(1,k);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(S);e?e.focus():(i=document.getElementById(b))==null||i.focus()}if(w(7,()=>{n.current.selectedItemId=M()?.id,T.emit()}),r||w(5,j),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}T.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),E=Z.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,D(t,r)),w(2,()=>{O(),T.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),w(3,()=>{A(),O(),n.current.value||k(),T.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=M();w(4,()=>{A(),t?.getAttribute(`id`)===e&&k(),T.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:b,inputId:S,labelId:x,listInnerRef:C}),[]);function D(e,t){let r=s.current?.filter??Vf;return e?r(e,n.current.search,t):0}function O(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=C.current;N().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(Ff);t?t.appendChild(e.parentElement===t?e:e.closest(`${Ff} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${Ff} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=C.current?.querySelector(`${Pf}[${Bf}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function k(){let e=N().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(Bf);T.setState(`value`,e||void 0)}function A(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=D(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function j(){var e;let t=M();t&&(t.parentElement?.firstChild===t&&((e=t.closest(Pf)?.querySelector(If))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function M(){return C.current?.querySelector(`${Lf}[aria-selected="true"]`)}function N(){return Array.from(C.current?.querySelectorAll(Rf)||[])}function P(e){let t=N()[e];t&&T.setState(`value`,t.getAttribute(Bf))}function F(e){var t;let n=M(),r=N(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&T.setState(`value`,a.getAttribute(Bf))}function I(e){let t=M()?.closest(Pf),n;for(;t&&!n;)t=e>0?rp(t,Pf):ip(t,Pf),n=t?.querySelector(Rf);n?T.setState(`value`,n.getAttribute(Bf)):F(e)}let ee=()=>P(N().length-1),L=e=>{e.preventDefault(),e.metaKey?ee():e.altKey?I(1):F(1)},R=e=>{e.preventDefault(),e.metaKey?P(0):e.altKey?I(-1):F(-1)};return Z.createElement(p.div,{ref:t,tabIndex:-1,...y,"cmdk-root":``,onKeyDown:e=>{var t;(t=y.onKeyDown)==null||t.call(y,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:v&&e.ctrlKey&&L(e);break;case`ArrowDown`:L(e);break;case`p`:case`k`:v&&e.ctrlKey&&R(e);break;case`ArrowUp`:R(e);break;case`Home`:e.preventDefault(),P(0);break;case`End`:e.preventDefault(),ee();break;case`Enter`:{e.preventDefault();let t=M();if(t){let e=new Event(zf);t.dispatchEvent(e)}}}}},Z.createElement(`label`,{"cmdk-label":``,htmlFor:E.inputId,id:E.labelId,style:pp},c),fp(e,e=>Z.createElement(Wf.Provider,{value:T},Z.createElement(Hf.Provider,{value:E},e))))}),Jf=Z.forwardRef((e,t)=>{let n=_(),r=Z.useRef(null),i=Z.useContext(Kf),a=Uf(),o=ap(e),s=o.current?.forceMount??i?.forceMount;op(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=lp(n,r,[e.value,e.children,r],e.keywords),l=Gf(),u=cp(e=>e.value&&e.value===c.current),f=cp(e=>s||a.filter()===!1?!0:!e.search||e.filtered.items.get(n)>0);Z.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(zf,m),()=>t.removeEventListener(zf,m)},[f,e.onSelect,e.disabled]);function m(){var e,t;h(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function h(){l.setState(`value`,c.current,!0)}if(!f)return null;let{disabled:g,value:v,onSelect:y,forceMount:b,keywords:x,...S}=e;return Z.createElement(p.div,{ref:d(r,t),...S,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!g,"aria-selected":!!u,"data-disabled":!!g,"data-selected":!!u,onPointerMove:g||a.getDisablePointerSelection()?void 0:h,onClick:g?void 0:m},e.children)}),Yf=Z.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=_(),s=Z.useRef(null),c=Z.useRef(null),l=_(),u=Uf(),f=cp(e=>i||u.filter()===!1?!0:!e.search||e.filtered.groups.has(o));op(()=>u.group(o),[]),lp(o,s,[e.value,e.heading,c]);let m=Z.useMemo(()=>({id:o,forceMount:i}),[i]);return Z.createElement(p.div,{ref:d(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:!f||void 0},n&&Z.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),fp(e,e=>Z.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},Z.createElement(Kf.Provider,{value:m},e))))}),Xf=Z.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=Z.useRef(null),a=cp(e=>!e.search);return!n&&!a?null:Z.createElement(p.div,{ref:d(i,t),...r,"cmdk-separator":``,role:`separator`})}),Zf=Z.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=Gf(),o=cp(e=>e.search),s=cp(e=>e.selectedItemId),c=Uf();return Z.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),Z.createElement(p.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),Qf=Z.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=Z.useRef(null),o=Z.useRef(null),s=cp(e=>e.selectedItemId),c=Uf();return Z.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),Z.createElement(p.div,{ref:d(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},fp(e,e=>Z.createElement(`div`,{ref:d(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),$f=Z.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return Z.createElement(zo,{open:n,onOpenChange:r},Z.createElement(Bo,{container:o},Z.createElement(Uo,{"cmdk-overlay":``,className:i}),Z.createElement(Po,{"aria-label":e.label,"cmdk-dialog":``,className:a},Z.createElement(qf,{ref:t,...s}))))}),ep=Z.forwardRef((e,t)=>cp(e=>e.filtered.count===0)?Z.createElement(p.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),tp=Z.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return Z.createElement(p.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},fp(e,e=>Z.createElement(`div`,{"aria-hidden":!0},e)))}),np=Object.assign(qf,{List:Qf,Item:Jf,Input:Zf,Group:Yf,Separator:Xf,Dialog:$f,Empty:ep,Loading:tp});function rp(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function ip(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function ap(e){let t=Z.useRef(e);return op(()=>{t.current=e}),t}var op=typeof window>`u`?Z.useEffect:Z.useLayoutEffect;function sp(e){let t=Z.useRef();return t.current===void 0&&(t.current=e()),t}function cp(e){let t=Gf(),n=()=>e(t.snapshot());return Z.useSyncExternalStore(t.subscribe,n,n)}function lp(e,t,n,r=[]){let i=Z.useRef(),a=Uf();return op(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(Bf,s),i.current=s}),i}var up=()=>{let[e,t]=Z.useState(),n=sp(()=>new Map);return op(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function dp(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function fp({asChild:e,children:t},n){return e&&Z.isValidElement(t)?Z.cloneElement(dp(t),{ref:t.ref},n(t.props.children)):n(t)}var pp={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`};function mp({...e}){return(0,Q.jsx)(zo,{"data-slot":`dialog`,...e})}function hp({...e}){return(0,Q.jsx)(Bo,{"data-slot":`dialog-portal`,...e})}function gp({className:e,...t}){return(0,Q.jsx)(Uo,{"data-slot":`dialog-overlay`,className:s(`fixed inset-0 z-50 bg-black/50 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function _p({className:e,children:t,showCloseButton:n=!0,overlayClassName:r,...i}){return(0,Q.jsxs)(hp,{"data-slot":`dialog-portal`,children:[(0,Q.jsx)(gp,{className:r}),(0,Q.jsxs)(Po,{"data-slot":`dialog-content`,className:s(`fixed inset-bs-[50%] start-[50%] z-50 grid max-h-[calc(100dvh-2rem)] overflow-y-auto overscroll-contain w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-card p-6 shadow-modal duration-200 outline-hidden motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0 motion-safe:data-[state=open]:zoom-in-95 sm:max-w-lg`,e),...i,children:[t,n&&(0,Q.jsxs)(qo,{"data-slot":`dialog-close`,className:`absolute inset-bs-4 end-4 rounded-sm opacity-70 ring-offset-background transition-opacity pointer-hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,Q.jsx)(tt,{}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function vp({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`dialog-header`,className:s(`flex shrink-0 flex-col gap-2 text-center sm:text-start`,e),...t})}function yp({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`dialog-body`,className:s(`min-h-0 min-w-0 overflow-y-auto overscroll-contain`,e),...t})}function bp({className:e,showCloseButton:t=!1,children:n,...r}){return(0,Q.jsxs)(`div`,{"data-slot":`dialog-footer`,className:s(`flex shrink-0 flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...r,children:[n,t&&(0,Q.jsx)(qo,{asChild:!0,children:(0,Q.jsx)(A,{variant:`outline`,children:`Close`})})]})}function xp({className:e,...t}){return(0,Q.jsx)(Lo,{"data-slot":`dialog-title`,className:s(`text-lg leading-none font-semibold`,e),...t})}function Sp({className:e,...t}){return(0,Q.jsx)(Fo,{"data-slot":`dialog-description`,className:s(`text-sm text-muted-foreground`,e),...t})}function Cp({className:e,...t}){return(0,Q.jsx)(np,{"data-slot":`command`,className:s(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,e),...t})}function wp({title:e=`Command Palette`,description:t=`Search for a command to run...`,children:n,className:r,showCloseButton:i=!0,filter:a,value:o,onValueChange:c,overlayClassName:l,contentProps:u,...d}){return(0,Q.jsxs)(mp,{...d,children:[(0,Q.jsxs)(vp,{className:`sr-only`,children:[(0,Q.jsx)(xp,{children:e}),(0,Q.jsx)(Sp,{children:t})]}),(0,Q.jsx)(_p,{...u,className:s(`overflow-hidden p-0`,r),showCloseButton:i,overlayClassName:l,children:(0,Q.jsx)(Cp,{...f({filter:a,value:o,onValueChange:c}),className:`**:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5`,children:n})})]})}function Tp({className:e,...t}){return(0,Q.jsxs)(`div`,{"data-slot":`command-input-wrapper`,className:`flex min-h-11 shrink-0 items-center gap-2 rounded-ss-[inherit] rounded-se-[inherit] border-b px-3`,children:[(0,Q.jsx)(at,{className:`size-4 shrink-0 opacity-50`}),(0,Q.jsx)(np.Input,{"data-slot":`command-input`,className:s(`flex h-11 min-w-0 flex-1 rounded-md bg-transparent py-3 text-base md:text-sm placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,e),...t})]})}function Ep({className:e,onPointerMoveCapture:t,...n}){return(0,Q.jsx)(np.List,{"data-slot":`command-list`,onPointerMoveCapture:e=>{t?.(e),e.pointerType===`touch`&&e.stopPropagation()},className:s(`max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto`,e),...n})}function Dp({...e}){return(0,Q.jsx)(np.Empty,{"data-slot":`command-empty`,className:`py-6 text-center text-sm`,...e})}function Op({className:e,...t}){return(0,Q.jsx)(np.Group,{"data-slot":`command-group`,className:s(`overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,e),...t})}function kp({className:e,...t}){return(0,Q.jsx)(np.Separator,{"data-slot":`command-separator`,className:s(`-mx-1 h-px bg-border`,e),...t})}function Ap({className:e,...t}){return(0,Q.jsx)(np.Item,{"data-slot":`command-item`,className:s(`relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...t})}function jp({className:e,...t}){return(0,Q.jsx)(`span`,{"data-slot":`command-shortcut`,className:s(`ml-auto text-xs tracking-widest text-muted-foreground`,e),...t})}var Mp=80,Np=2e3,Pp=50,Fp=200,Ip=50,Lp=[{id:`add-tests`,label:`Add tests`,text:`Also add or update tests covering this change.`},{id:`explain-change`,label:`Explain the change`,text:`Explain what changed and why before finishing.`},{id:`keep-minimal`,label:`Keep it minimal`,text:`Keep the change as small and targeted as possible — no unrelated refactors.`},{id:`update-docs`,label:`Update docs`,text:`Also update any relevant documentation or comments.`},{id:`check-edge-cases`,label:`Double-check edge cases`,text:`Double-check edge cases and error handling before finishing.`},{id:`create-automation`,label:`Create an automation`,skills:[`create-cezarion-automation`],text:`Create an automation for this repository.
3
+ Trigger: <a GitHub event or a schedule, e.g. every new pull request; every issue labelled \`needs-agent\`; every day at 04:00; weekdays at 07:30; every 6 hours>.
4
+ Task for each run: <what the launched task must do, e.g. review the diff, run the tests and post findings as a review comment>.
5
+ Leave it paused and, for a GitHub trigger, preview its matches so I can check the filter before enabling it.`}],Rp=new Set([`create-automation`]);function zp(e,t){return t.automations===!0?e:e.filter(e=>!Rp.has(e.id))}function Bp(e){return!!e&&typeof e==`object`}function Vp(e){if(e===void 0||!Array.isArray(e))return Lp.map(e=>({...e}));let t=new Set,n=[];for(let r of e){if(!Bp(r))continue;let e=typeof r.id==`string`?r.id.trim():``,i=typeof r.label==`string`?r.label.trim():``,a=typeof r.text==`string`?r.text.trim():``;if(!e||!i||!a||t.has(e))continue;t.add(e);let o=Hp(r.skills);if(n.push({id:e,label:i.slice(0,Mp),text:a.slice(0,Np),...o.length>0?{skills:o}:{}}),n.length>=Pp)break}return n}function Hp(e){if(!Array.isArray(e))return[];let t=new Set;for(let n of e){if(typeof n!=`string`)continue;let e=n.trim();if(!(!e||t.has(e))&&(t.add(e.slice(0,Fp)),t.size>=Ip))break}return[...t]}function Up(e,t){if(t.length===0)return[];let n=new Set(t);return e.filter(e=>e.skills?.some(e=>n.has(e)))}function Wp(e,t){return Up(e,t).map(e=>e.text).join(`
6
+
7
+ `)}function Gp(e,t,n,r=``){if(e===``||e===r||e===t){let e=r&&n?`${r}\n\n${n}`:r||n;return{text:e,applied:n?e:``}}return{text:e,applied:t}}function Kp(){return`tpl-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function qp(e,t,n){let r=Math.max(0,Math.min(t,e.length)),i=e.slice(0,r),a=e.slice(r),o=``;i.length>0&&(o=i.endsWith(`
8
+
9
+ `)?``:i.endsWith(`
10
+ `)?`
11
+ `:`
12
+
13
+ `);let s=a.replace(/^[ \t]+/,``),c=``;return s.length>0&&(c=s.startsWith(`
14
+
15
+ `)?``:s.startsWith(`
16
+ `)?`
17
+ `:`
18
+
19
+ `),{text:i+o+n+c+s,caret:i.length+o.length+n.length}}function Jp({prompt:e,base:t,selectionStart:n,focused:r,remembered:i}){return e===t?e.length:r&&n!=null||n!=null&&n>0?n:i??e.length}function Yp(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||e.isContentEditable?!0:e.closest(`[contenteditable=""], [contenteditable="true"]`)!==null}function Xp(e){return e instanceof HTMLElement&&e.closest(`[cmdk-input]`)!==null}function Zp(e,t){return!(typeof e.key!=`string`||e.key.toLowerCase()!==t.toLowerCase()||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||e.repeat||Yp(e.target)&&!Xp(e.target))}function Qp(e,t){let n=Z.useRef(t);Z.useLayoutEffect(()=>{n.current=t}),Z.useEffect(()=>{let t=t=>{Zp(t,e)&&(t.preventDefault(),n.current(t))};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}function $p(e,t){return!(typeof e.key!=`string`||e.key.toLowerCase()!==t.toLowerCase()||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.repeat||Yp(e.target))}function em(e,t=typeof navigator>`u`?``:navigator.platform){let n=e.toUpperCase();return/mac|iphone|ipad|ipod/i.test(t)?`⌘${n}`:`Ctrl+${n}`}function tm(e,t){let n=Z.useRef(t);Z.useLayoutEffect(()=>{n.current=t}),Z.useEffect(()=>{let t=t=>{$p(t,e)&&n.current(t)};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}var nm=new Set([`ai`,`cezar`,`agents`,`team`]);function rm(e){return nm.has(e.source)}function im(e){return[...e].sort((e,t)=>Number(!rm(e))-Number(!rm(t)))}var am=5;function om(e,t,{mostUsedLimit:n=am}={}){let r=e.map((e,n)=>({skill:e,index:n,count:cm(t,e.name)})).filter(e=>e.count>0).sort((e,t)=>t.count-e.count||Number(!rm(e.skill))-Number(!rm(t.skill))||e.index-t.index).slice(0,n).map(e=>e.skill),i=new Set(r),a=e.filter(e=>!i.has(e));return{mostUsed:r,project:a.filter(rm),global:a.filter(e=>!rm(e))}}function sm(e,t){let n=om(e,t);return[...n.mostUsed,...n.project,...n.global]}function cm(e,t){if(!e||!Object.hasOwn(e,t))return 0;let n=e[t];return typeof n==`number`?n:0}function lm(e,t){return{...e,[t]:cm(e,t)+1}}function um(e,t){if(t===``)return!0;let n=e.toLowerCase(),r=t.toLowerCase(),i=0;for(let e of r){if(i=n.indexOf(e,i),i===-1)return!1;i+=1}return!0}function dm(e,t){let n=[];for(let r of e)for(let e of r.steps??[])e.skill===t&&n.push(`${r.name} › ${e.name??e.id}`);return n}var fm=/[\s\-/_.]/;function pm(e,t){let n=0;for(let r=e.indexOf(t);r!==-1;r=e.indexOf(t,r+1)){let i=1,a=e[r-1];if(r===0||a!==void 0&&fm.test(a)){let n=e[r+t.length];i=n===void 0||fm.test(n)?3:2}if(i>n&&(n=i),n===3)break}return n}function mm(e,t,n){let r=t.toLowerCase().split(/\s+/).filter(Boolean);if(r.length===0)return 1;let i=[e,...n??[]].join(` `).toLowerCase(),a=0;for(let e of r){let t=pm(i,e);if(t===0)return 0;a+=t}return a/(r.length*3)}function hm(e,t){if(t===``)return 1;let n=e.toLowerCase(),r=t.toLowerCase();if(n===r)return 6;if(n.startsWith(r))return 5;let i=n.indexOf(r);if(i>0){let e=n[i-1];return e!==void 0&&fm.test(e)?4:3}return+!!um(n,r)}function gm(e,t){let n=e.split(`-`).filter(Boolean);return t?[...n,t]:n}var _m=10;function vm(e,t,n){let r=n.toLowerCase().split(/\s+/).filter(Boolean);if(r.length===0)return 1;let i=0;for(let n of r){let r=hm(e,n),a=t?hm(t,n):0;if(r===0&&a===0)return 0;i+=r>0?r+_m:a}return i}function ym(e,t){let n=t.toLowerCase().split(/\s+/).filter(Boolean),r=0;for(let t of n)r+=hm(e,t);return r}function bm(e,t,n){return t.trim()===``?[...e]:e.map((e,r)=>{let i=vm(e.name,e.description,t);return{item:e,index:r,count:cm(n,e.name),nameScore:ym(e.name,t),score:i}}).filter(e=>e.score>0).sort((e,t)=>t.nameScore-e.nameScore||t.score-e.score||t.count-e.count||e.index-t.index).map(e=>e.item)}function xm(e,t,n){return bm(e,t,n)}function Sm(e,t,n){return t.trim()===``?{...om(e,n),ranked:null}:{mostUsed:[],project:[],global:[],ranked:xm(im(e),t,n)}}function Cm(e,t){return bm(e,t)}function wm(e,t,n){return bm(sm(e,n),t,n)}function Tm(e){let[t,n]=Z.useState(()=>Date.now());return Z.useEffect(()=>{if(Ar())return;let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}var Em=`(hover: none) and (pointer: coarse)`;function Dm(){return typeof globalThis.matchMedia==`function`&&globalThis.matchMedia(Em).matches}function Om(e){return e.key!==`Enter`||e.shiftKey||e.altKey||e.repeat||e.isComposing?!1:e.metaKey||e.ctrlKey?!0:!Dm()}function km(e=typeof navigator>`u`?``:navigator.platform){return/mac|iphone|ipad|ipod/i.test(e)?`⌘↵`:`Ctrl+↵`}var Am={png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,webp:`image/webp`,svg:`image/svg+xml`,bmp:`image/bmp`,avif:`image/avif`,md:`text/markdown`,markdown:`text/markdown`,txt:`text/plain`,log:`text/plain`,pdf:`application/pdf`};function jm(e){return Ee(e.type)?e.type:Am[e.name.split(`.`).pop()?.toLowerCase()??``]??null}async function Mm(e){let t=new Uint8Array(await e.arrayBuffer()),n=``;for(let e=0;e<t.length;e+=32768)n+=String.fromCharCode(...t.subarray(e,e+32768));let r=btoa(n),i=jm(e)??`application/octet-stream`,a=Ct(i);return{mediaType:i,data:r,...a?{preview:`data:${i};base64,${r}`}:{},name:e.name||(a?`pasted image`:`pasted.${Fn(i)}`),isImage:a}}function Nm(e,t){let n=[],r=[],i=t;for(let t of e){let e=t.name||`attachment`;if(jm(t)===null){r.push(`${e} is not a supported attachment (images, PDF and plain-text files such as TXT or MD)`);continue}if(t.size>5242880){r.push(`${e} is too large (max 5 MB)`);continue}if(i>=4){r.push(`${e} skipped — max 4 attachments per message`);continue}n.push(t),i+=1}return{accepted:n,rejected:r}}var Pm=new Set([`/`,`@`]);function Fm(e,t){for(let n=t-1;n>=0;--n){let r=e[n];if(/\s/.test(r))return null;if(Pm.has(r))return n>0&&!/\s/.test(e[n-1])?null:{trigger:r,start:n,query:e.slice(n+1,t)}}return null}function Im(e,t,n,r){let i=`${t.trigger}${r} `;return{text:e.slice(0,t.start)+i+e.slice(n),caret:t.start+i.length}}function Lm(){let e=window;return e.SpeechRecognition??e.webkitSpeechRecognition}function Rm(e,t){let n=e,r=``;for(let e=t.resultIndex;e<t.results.length;e+=1){let i=t.results[e],a=i[0]?.transcript??``;i.isFinal?n+=a:r+=a}return{finalText:n,interim:r}}function zm(e,t){switch(e){case`aborted`:return null;case`network`:case`service-not-allowed`:return{message:`Dictation couldn't reach this browser's speech service. Some Chromium builds, such as Helium, block it. Use your system dictation instead (macOS: press Fn/Globe twice), or open the cockpit in Chrome or Safari.`,retryable:e===`network`};case`not-allowed`:return{message:`Microphone access is blocked. Allow it in this site's browser settings, then try again.`,retryable:!0};case`audio-capture`:return{message:`No microphone was found. Connect one, then try again.`,retryable:!0};case`language-not-supported`:return{message:`This browser can't recognize speech in ${t}. Use your system dictation instead (macOS: press Fn/Globe twice).`,retryable:!1};case`no-speech`:return{message:`No speech was heard. Check the microphone, then try again.`,retryable:!0};default:return{message:`Dictation failed${e?` — ${e}`:``}`,retryable:!0}}}function Bm(e){let[t,n]=Z.useState(null),r=Z.useRef(null),i=Z.useRef(``),a=Z.useRef(!1),o=Z.useRef(()=>{}),[s]=Z.useState(()=>Lm()!==void 0),c=Z.useCallback(()=>{let e=r.current;r.current=null,i.current=``,n(null),e&&(e.onresult=null,e.onerror=null,e.onend=null,e.abort())},[]);Z.useEffect(()=>(a.current=!0,()=>{a.current=!1,c()}),[c]);let l=Z.useCallback(()=>o.current(),[]),u=Z.useCallback(()=>{if(!a.current||r.current)return;let t=Lm();if(!t)return;let o;try{o=new t,o.lang=navigator.language||`en-US`,o.continuous=!0,o.interimResults=!0;let a=Date.now();o.onresult=e=>{let t=Rm(i.current,e);i.current=t.finalText,n({transcript:t.finalText+t.interim,startedAt:a})},o.onerror=t=>{console.warn(`[dictation] recognition error`,t.error,t.message);let n=zm(t.error,o.lang);c(),n&&e(n.message,n.retryable?l:void 0)},o.start(),r.current=o,n({transcript:``,startedAt:a})}catch{e(`Dictation failed — the microphone could not be started`,l),c()}},[e,l,c]);return o.current=u,{supported:s,recording:t,start:u,cancel:Z.useCallback(()=>c(),[c]),finish:Z.useCallback(()=>{let e=r.current,a=(i.current+``).trim()===``?``:i.current,o=t?.transcript??a;return e&&(e.onresult=null,e.onerror=null,e.onend=null,e.stop()),r.current=null,i.current=``,n(null),o.trim()},[t])}}function Vm(e,t){let n=Math.max(0,Math.floor((t-e)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,`0`)}`}var Hm=new Map,Um={KeyA:`Yes, approved.`,KeyC:`Continue.`};function Wm({onSubmit:e,retainDraftUntilSuccess:t=!1,onStop:n,onFinish:r,finishing:i=!1,secondaryAction:a,stopOnEmpty:o=!1,stopping:c=!1,emptySubmitLabel:l,compactFeedback:u=!1,idleFeedback:d,pendingLabel:f=`Starting task…`,failureHint:p=`Could not confirm submission. Check Tasks before you retry. Your draft is kept.`,clearOnSuccess:m=!0,onPendingChange:h,value:g,onValueChange:_,autoFocus:v=!1,mobileCollapsible:y=!1,mobileDisclosureKey:b,footerStart:x,footerEnd:S,sessionControls:C,executionOptions:w,agentOptions:T,sendAriaLabel:E=`Send`,disabled:D=!1,disabledReason:O=`Session closed — Continue to reopen.`,allowEmptySubmit:k=!1,placeholder:j=`Reply — / for skills, @ for files…`,ariaLabel:M=`Reply to the agent`,autocompleteSkills:N=!0,quickReplies:P=!1,getMentionCandidates:F,voiceProposal:I=!1,ref:ee}){let[L,R]=(0,Z.useState)(``),ne=g??L,z=(0,Z.useRef)(ne);z.current=ne;let re=(0,Z.useRef)(_);re.current=_;let B=(0,Z.useCallback)(e=>{let t=typeof e==`function`?e(z.current):e;R(t),re.current?.(t)},[]),[ie,ae]=(0,Z.useState)([]),oe=(0,Z.useRef)(ie);oe.current=ie;let[se,ce]=(0,Z.useState)(!1),le=c||se,ue=(0,Z.useRef)(le);ue.current=le;let de=ne.trim()!==``||ie.length>0,fe=!de&&(n!==void 0&&o||le),pe=!de&&!fe&&r!==void 0,me=fe||pe||!de&&l!==void 0,he=!de&&l?l:E,[ge,_e]=(0,Z.useState)(!1),ve=(0,Z.useRef)(!1),ye=(0,Z.useRef)(0),be=(0,Z.useRef)(!0);(0,Z.useEffect)(()=>(be.current=!0,()=>{be.current=!1}),[]);let[xe,Se]=(0,Z.useState)(null),Ce=le||t&&ge,we=()=>ue.current||t&&ve.current,[Te,Ee]=(0,Z.useState)(null),[De,Oe]=(0,Z.useState)(``),[ke,Ae]=(0,Z.useState)(!1),je=(0,Z.useRef)(null),Me=(0,Z.useId)(),Ne=(0,Z.useId)(),Pe=(0,Z.useRef)(new Map),Fe=b===void 0?Pe.current:Hm,Ie=b??`default`,[,Le]=(0,Z.useReducer)(e=>e+1,0),Re=Fe.get(Ie)??!1,Be=y&&!Re,Ve=(0,Z.useRef)(null),He=(0,Z.useRef)(null),Ue=(0,Z.useRef)(null),We=qr(N&&ke),qe=Rr(),Je=V(),Ye=(0,Z.useRef)(D);Ye.current=D;let Xe=Bm((e,t)=>H(e,{tone:`danger`,...t?{action:{label:`Try again`,onAction:()=>{!Ye.current&&!we()&&t()}}}:{}}));(0,Z.useEffect)(()=>{v&&je.current?.focus()},[]);let Ze=(0,Z.useCallback)(()=>{let e=je.current;if(!e||D||we()){Ee(null);return}let t=Fm(e.value,e.selectionStart??e.value.length);if(t?.trigger===`/`&&!N||t?.trigger===`@`&&F===void 0)return Ee(null);t?.trigger===`/`&&Ae(!0),Ee(t)},[N,D,F,t]),Qe=(0,Z.useMemo)(()=>Te===null?[]:Te.trigger===`/`?wm(We.data??[],Te.query,qe.data?.skillUsage).map(e=>({value:`${e.name} ${e.path}`,insert:e.name,label:e.name,description:e.description,emphasized:rm(e)})):(F?.()??[]).filter(e=>um(e,Te.query)).map(e=>({value:e,insert:e,label:e,emphasized:!1})),[F,We.data,Te,qe.data?.skillUsage]),$e=Qe.some(e=>e.value===De)?De:Qe[0]?.value,et=Te!==null;(0,Z.useLayoutEffect)(()=>{!et||!$e||[...He.current?.querySelectorAll(`[data-slot="composer-menu-item"]`)??[]].find(e=>e.getAttribute(`data-value`)===$e)?.scrollIntoView({block:`nearest`})},[$e,et]);let nt=(0,Z.useCallback)(()=>Ee(null),[]),rt=e=>{let t=je.current;if(!t||Te===null||we())return;let n=t.selectionStart??t.value.length,r=Im(t.value,Te,n,e.insert);Te.trigger===`/`&&qe.data!==void 0&&In({skillUsage:lm(qe.data.skillUsage,e.insert)}).then(()=>Je.invalidateQueries({queryKey:G.uiState})).catch(()=>{}),B(r.text),Ue.current=r.caret,Ee(null),t.focus()};(0,Z.useLayoutEffect)(()=>{let e=Ue.current,t=je.current;e!==null&&t&&(t.setSelectionRange(e,e),Ue.current=null)},[ne]),(0,Z.useLayoutEffect)(()=>{let e=je.current;if(!e||typeof CSS<`u`&&CSS.supports(`field-sizing`,`content`))return;let t=()=>{e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,220)}px`};t();let n=e.clientWidth,r=typeof ResizeObserver>`u`?null:new ResizeObserver(()=>{e.clientWidth!==n&&(n=e.clientWidth,t())});r?.observe(e);let i=!1;return document.fonts?.ready.then(()=>{i||t()}),()=>{i=!0,r?.disconnect()}},[ne,Re]);let it=(0,Z.useCallback)(e=>{if(D||we())return;let n=ye.current,r=Nm(e,oe.current.length);for(let e of r.rejected)H(e,{tone:`danger`});for(let e of r.accepted)Mm(e).then(e=>{!be.current||t&&ve.current&&!ue.current||n!==ye.current||ae(t=>t.length>=4?t:[...t,e])},()=>H(`${e.name||`Attachment`} could not be read — try attaching it again`,{tone:`danger`}))},[D,t]),at=e=>{let t=[...e.clipboardData?.items??[]].filter(e=>e.kind===`file`).map(e=>e.getAsFile()).filter(e=>e!==null);t.length!==0&&(e.preventDefault(),it(t))},ot=e=>{let t=[...e.dataTransfer?.files??[]];t.length!==0&&(e.preventDefault(),it(t))},st=(0,Z.useCallback)((e,t)=>D||c||ve.current||e.trim()===``&&t.length===0&&!k,[D,c,k]),ct=(0,Z.useCallback)(async(n,r,i)=>{let a=n.trim();if(!st(n,r)){ve.current=!0,t&&(ye.current+=1),_e(!0),Se(null),h?.(!0),Ee(null),i&&!t&&(B(``),ae([]));try{await e(a,r.map(({mediaType:e,data:t})=>({mediaType:e,data:t}))),be.current&&t&&m&&(z.current===n&&B(``),oe.current===r&&ae([]))}catch(e){if(!be.current&&t)return;let a=e instanceof Error?e.message:String(e);t?Se(a):(H(a,{tone:`danger`}),i&&(B(e=>e===``?n:`${n}\n${e}`),ae(e=>[...r,...e].slice(0,4))))}finally{ve.current=!1,be.current&&(h?.(!1),_e(!1))}}},[st,e,t,m,h,B]),lt=(0,Z.useCallback)(()=>st(z.current,oe.current)?!1:(ct(z.current,oe.current,!0),!0),[st,ct]);(0,Z.useImperativeHandle)(ee,()=>({insertAtCaret:e=>{if(we())return;let t=je.current,n=qp(z.current,t?.selectionStart??z.current.length,e);B(n.text),Ue.current=n.caret,t?.focus()},getDraft:()=>z.current,setDraft:e=>we()?!1:(B(e),!0),clearVoiceDraft:e=>z.current===``?!0:ve.current||z.current!==e?!1:(B(``),!0),submit:lt}),[B,t,lt]);let ut=async()=>{if(!(!n||c||ve.current)){ve.current=!0,_e(!0),ce(!0),Se(null);try{await n()}catch(e){be.current&&Se(e instanceof Error?e.message:String(e))}finally{ve.current=!1,be.current&&(_e(!1),ce(!1))}}},dt=e=>{if(et){if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),Qe.length===0)return;let t=Qe.findIndex(e=>e.value===$e),n=e.key===`ArrowDown`?1:-1,r=Qe[(t+n+Qe.length)%Qe.length];Oe(r.value);return}if(e.key===`Escape`){e.preventDefault(),nt();return}if((e.key===`Enter`||e.key===`Tab`)&&!e.shiftKey){let t=Qe.find(e=>e.value===$e);if(t){e.preventDefault(),rt(t);return}nt()}}Om({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.preventDefault(),lt())};(0,Z.useEffect)(()=>{if(!P||D)return;let e=e=>{if(!e.altKey||e.metaKey||e.ctrlKey||e.repeat||Yp(e.target))return;let t=Um[e.code];t!==void 0&&(e.preventDefault(),ct(t,[],!1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[D,P,ct]);let ft=e=>{if(D||ue.current||ve.current&&(e||t))return;let n=Xe.finish();if(n===``)return;let r=ne.trim()===``?n:`${ne.replace(/\s*$/,``)} ${n}`;if(e){t&&B(r),ct(r,ie,!0);return}B(r),Ue.current=r.length,je.current?.focus()},pt=Xe.recording,mt=Xe.supported?(0,Q.jsxs)(A,{type:`button`,variant:`ghost`,size:`sm`,disabled:D||Ce,"aria-label":`Start dictation`,title:`Dictation`,className:s(`h-11 gap-1.5 px-2.5 text-xs font-medium text-muted-foreground md:h-8`,Be&&`hidden md:inline-flex`),onClick:()=>{we()||Xe.start()},children:[(0,Q.jsx)(Tn,{"aria-hidden":`true`,className:`size-3.5`}),w||C?null:`Dictation`]}):null,ht=pe?(0,Q.jsxs)(A,{type:`button`,"data-slot":`composer-finish`,"aria-label":i?`Finishing…`:`Finish`,"aria-busy":i||void 0,title:`Close the session and mark this task done`,disabled:ge||le||i,className:`h-11 w-auto gap-[7px] px-5 active:opacity-80`,onClick:()=>void r?.(),children:[(0,Q.jsx)(ze,{"aria-hidden":`true`}),i?`Finishing…`:`Finish`]}):null,gt=n||le?(0,Q.jsxs)(A,{type:`button`,variant:`outline`,size:`icon-sm`,"aria-label":le?`Stopping…`:`Stop`,"aria-busy":le||void 0,title:le?`Waiting for execution to stop`:`Stop execution; keep existing work`,disabled:ge||le,className:s(`h-11 min-w-11 active:opacity-80`,me?`w-auto px-3`:`w-11`),onClick:()=>void ut(),children:[(0,Q.jsx)(Ge,{"aria-hidden":`true`,className:`size-3 fill-current`}),me?le?`Stopping…`:`Stop`:null]}):null,_t=le||ge||xe!==null||d!=null,vt=(0,Q.jsx)(Q.Fragment,{children:t||n||c?(0,Q.jsx)(`div`,{className:s(`overflow-y-auto text-xs leading-5 text-muted-foreground`,u&&!_t?`h-0`:`px-3 pbe-2 md:px-4`,u?_t&&`min-h-6`:`h-24 md:h-20`),children:(0,Q.jsx)(`div`,{id:`${Me}-submission`,role:xe===null?`status`:`alert`,"aria-atomic":`true`,tabIndex:xe===null?void 0:0,className:`break-words`,children:le?`Stopping execution. Your draft is kept.`:ge?f:xe===null?d??null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`font-medium text-foreground`,children:xe}),(0,Q.jsx)(`p`,{children:p})]})})}):null}),yt=(0,Q.jsxs)(`div`,{"data-slot":`composer-submit-row`,className:s(`ms-auto flex min-w-0 flex-wrap items-center justify-end gap-1 md:flex-nowrap`,w&&`new-task-submission`),children:[w||C?null:mt,S?(0,Q.jsx)(`div`,{id:Ne,"data-slot":`composer-footer-end`,className:s(`min-w-0 flex-wrap items-center gap-1.5 md:flex-nowrap`,w&&`me-auto`,y&&`max-md:[&_button]:min-h-11 max-md:[&_button]:min-w-11`,Be?`hidden md:flex`:`flex`),children:(0,Q.jsx)(`div`,{className:`contents`,inert:Ce||void 0,children:S})}):null,(0,Q.jsxs)(`div`,{className:`flex min-w-[100px] items-center justify-end gap-1`,"data-slot":`composer-actions`,children:[gt??a,ht,!fe&&!pe?(0,Q.jsxs)(A,{type:`button`,size:`icon-sm`,"aria-label":he,"aria-busy":ge&&!le||void 0,disabled:D||ge||le||!de&&!k,className:s(w?`h-12 w-full gap-2 px-6`:C?`h-11 w-auto gap-2 px-5`:`size-11`,!de&&l&&`w-auto px-3`,`active:opacity-80`),onClick:lt,children:[!C&&!de&&l?(0,Q.jsx)(To,{"aria-hidden":`true`}):null,w||C||!de&&l?he:null,C||de||!l?(0,Q.jsx)(hn,{"aria-hidden":`true`}):null]}):null]})]});return(0,Q.jsxs)(Co,{open:et,onOpenChange:e=>e?void 0:nt(),children:[(0,Q.jsx)(yo,{asChild:!0,children:(0,Q.jsxs)(`div`,{ref:Ve,"data-slot":`composer`,"data-disabled":D||void 0,"data-voice-proposal":I||void 0,onDrop:ot,onDragOver:e=>e.preventDefault(),className:s(w&&`new-task-composer`,C&&`session-composer`,D&&`opacity-80`),children:[(0,Q.jsxs)(`div`,{"data-slot":`composer-editor`,className:s(`rounded-xl border border-[var(--composer-border)] bg-card shadow-none transition-[border-color,box-shadow] focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/15`,w&&`new-task-editor`),children:[ie.length>0?(0,Q.jsx)(`div`,{"data-slot":`composer-thumbs`,className:`flex flex-nowrap items-center gap-2 overflow-x-auto px-4 pbs-3 md:flex-wrap md:overflow-visible`,children:ie.map((e,t)=>(0,Q.jsxs)(`button`,{type:`button`,"aria-label":`Remove ${e.name}`,title:Ce?`Attachment submitted`:`Click to remove`,disabled:Ce,className:s(`group relative shrink-0 overflow-hidden rounded-md border border-border`,e.isImage?`size-12`:`flex h-12 min-w-11 max-w-[200px] items-center gap-1.5 bg-muted/40 px-2.5 text-xs text-muted-foreground`),onClick:()=>{we()||ae(e=>e.filter((e,n)=>n!==t))},children:[e.isImage?(0,Q.jsx)(`img`,{src:e.preview,alt:``,className:`size-full object-cover`}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(rr,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Q.jsx)(`span`,{className:`truncate`,children:e.name})]}),(0,Q.jsx)(`span`,{className:`absolute inset-0 hidden items-center justify-center bg-background/70 group-hover:flex group-focus-visible:flex`,children:(0,Q.jsx)(tt,{"aria-hidden":`true`,className:`size-4`})})]},`${e.name}-${t}`))}):null,(0,Q.jsx)(`label`,{htmlFor:Me,className:w?`hidden px-5 pbs-5 text-xs text-muted-foreground md:block`:`sr-only`,children:w?`Task description`:M}),(0,Q.jsx)(`textarea`,{ref:je,id:Me,autoComplete:`off`,rows:1,value:ne,disabled:D,readOnly:Ce,"aria-busy":Ce||void 0,"aria-describedby":t?`${Me}-submission`:void 0,"aria-label":M,placeholder:D?O:j,className:s(`block field-sizing-content min-h-11 w-full overflow-y-auto resize-none bg-transparent px-3 pbs-2.5 pbe-1 text-base leading-normal outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed md:min-h-[54px] md:px-4 md:pbs-3 md:text-sm`,Be?`max-h-11 md:max-h-[220px]`:`max-h-[220px]`,w&&`md:text-base`),onChange:e=>{we()||(B(e.target.value),Ze())},onKeyDown:dt,onSelect:Ze,onPaste:at}),w?(0,Q.jsxs)(`p`,{"data-slot":`composer-skill-hint`,className:`flex items-center gap-2 px-5 pbs-3 pbe-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(te,{"aria-hidden":`true`,className:`size-[15px] shrink-0`}),`Type / for a skill or workflow`]}):null,C&&pt?(0,Q.jsx)(`div`,{"data-slot":`session-controls`,inert:Ce||void 0,children:C}):null,pt?(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(Km,{transcript:pt.transcript,startedAt:pt.startedAt,insertionDisabled:Ce,onCancel:Xe.cancel,onInsert:()=>ft(!1),onInsertAndSend:()=>ft(!0)}),gt?(0,Q.jsx)(`div`,{className:`flex justify-end px-2 pbe-2`,children:gt}):null]}):(0,Q.jsxs)(`div`,{"data-slot":`composer-toolbar`,className:`flex flex-wrap items-center gap-1 gap-y-1 px-1.5 pbs-1 pbe-1.5 md:gap-y-1.5 md:px-2 md:pbs-1.5 md:pbe-2`,children:[C?(0,Q.jsx)(`div`,{"data-slot":`session-controls`,inert:Ce||void 0,children:C}):null,(0,Q.jsxs)(`div`,{"data-slot":`composer-footer-start`,className:s(`flex min-w-0 flex-wrap items-center gap-1`,w&&`w-full`),children:[(0,Q.jsx)(Gm,{disabled:D||Ce,onFiles:it}),y?(0,Q.jsx)(A,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`size-11 md:hidden`,"aria-label":Re?`Collapse composer`:`Expand composer`,"aria-expanded":Re,"aria-controls":S?`${Me} ${Ne}`:Me,onClick:()=>{Fe.set(Ie,!Re),Le()},children:(0,Q.jsx)(Ke,{"aria-hidden":`true`,className:s(`transition-transform motion-reduce:transition-none`,!Re&&`rotate-180`)})}):null,(0,Q.jsx)(`div`,{className:`contents`,inert:Ce||void 0,children:x}),w||C?(0,Q.jsx)(`div`,{children:mt}):null]}),w?null:yt]}),w?null:vt]}),w?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{"data-slot":`composer-agent-options`,inert:Ce||void 0,children:T}),(0,Q.jsx)(`div`,{"data-slot":`composer-execution-panel`,inert:Ce||void 0,children:w}),yt,(0,Q.jsx)(`div`,{"data-slot":`composer-feedback`,children:vt})]}):null]})}),(0,Q.jsx)(xo,{side:`top`,align:`start`,sideOffset:8,className:`w-80 max-w-[calc(100vw-2rem)] p-0`,onOpenAutoFocus:e=>e.preventDefault(),onInteractOutside:e=>{Ve.current?.contains(e.target)&&e.preventDefault()},children:(0,Q.jsx)(Cp,{shouldFilter:!1,value:$e??``,onValueChange:Oe,children:(0,Q.jsx)(Ep,{ref:He,"data-slot":`composer-menu`,"data-trigger":Te?.trigger,className:`max-h-[min(16rem,var(--radix-popover-content-available-height))] p-1`,children:Qe.length===0?(0,Q.jsx)(`p`,{className:`px-3 py-4 text-center text-xs text-muted-foreground`,children:Te?.trigger===`@`?`No files seen in this session yet — full file search arrives with the Files tab.`:We.isPending?`Loading skills…`:`No matching skills.`}):Qe.map(e=>(0,Q.jsxs)(Ap,{value:e.value,"data-slot":`composer-menu-item`,"data-emphasized":e.emphasized||void 0,onSelect:()=>rt(e),children:[(0,Q.jsx)(`span`,{className:s(`shrink-0 truncate`,e.emphasized&&`font-semibold`,Te?.trigger===`@`&&`font-mono text-xs`),children:e.label}),e.description?(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null]},e.value))})})})]})}function Gm({disabled:e,onFiles:t}){let n=(0,Z.useRef)(null);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(A,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Attach files`,title:`Attach an image, PDF, TXT or MD file (or paste a screenshot)`,disabled:e,className:`size-11 text-muted-foreground`,onClick:()=>n.current?.click(),children:(0,Q.jsx)(rr,{"aria-hidden":`true`,className:`size-[15px]`})}),(0,Q.jsx)(`input`,{ref:n,type:`file`,accept:`image/*,application/pdf,text/plain,text/markdown,.pdf,.txt,.md,.markdown,.log`,multiple:!0,className:`hidden`,"aria-hidden":`true`,tabIndex:-1,onChange:e=>{t([...e.target.files??[]]),e.target.value=``}})]})}function Km({transcript:e,startedAt:t,insertionDisabled:n,onCancel:r,onInsert:i,onInsertAndSend:a}){let o=Tm(1e3);return(0,Q.jsxs)(`div`,{"data-slot":`dictation-overlay`,role:`status`,"aria-label":`Dictation in progress`,className:`flex items-center gap-2.5 rounded-b-xl border-bs border-border bg-muted/60 px-3 py-2`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 flex-none animate-pulse rounded-full bg-danger motion-reduce:animate-none`}),(0,Q.jsx)(`span`,{"data-slot":`dictation-timer`,className:`text-xs font-medium text-muted-foreground tabular-nums`,children:Vm(t,o)}),(0,Q.jsx)(`span`,{"data-slot":`dictation-transcript`,"aria-live":`polite`,className:`min-w-0 flex-1 truncate text-sm text-foreground`,children:e===``?(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:`Listening…`}):e}),(0,Q.jsx)(A,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Cancel dictation`,className:`size-11 text-muted-foreground md:size-8`,onClick:r,children:(0,Q.jsx)(tt,{"aria-hidden":`true`})}),(0,Q.jsx)(A,{type:`button`,variant:`outline`,size:`icon-sm`,disabled:n,"aria-label":`Insert transcription`,className:`size-11 md:size-8`,onClick:i,children:(0,Q.jsx)(ze,{"aria-hidden":`true`})}),(0,Q.jsx)(A,{type:`button`,size:`icon-sm`,disabled:n,"aria-label":`Insert transcription and send`,className:`size-11 md:size-8`,onClick:a,children:(0,Q.jsx)(hn,{"aria-hidden":`true`})})]})}var qm=`default`,Jm=q({id:J(),label:J(),path:J(),exists:ka()}),Ym=q({id:J(),provider:Ta,label:J(),configDir:J(),path:J(),exists:ka(),looksValid:ka(),isDefault:ka(),status:Ea.optional(),files:Ca(Jm)});function Xm(e){return e.isDefault?`default:${e.provider}`:e.id}var Zm=q({claude:J().optional(),codex:J().optional(),opencode:J().optional(),pi:J().optional(),cursor:J().optional(),omp:J().optional()});q({editable:ka(),profiles:Ca(Ym),profileCapableProviders:Ca(Ta),selections:Fa(J(),Zm),defaults:Zm}),q({projectId:J().min(1).max(64).nullable(),provider:Ta,profileId:J().max(64).nullable()}),q({selections:Fa(J(),Zm),defaults:Zm}),q({status:Ea}),q({available:ka(),reason:J().optional(),fields:Ca(q({label:J(),value:J()}))}),q({file:J().min(1).max(200),target:J().min(1).max(64).optional()}),q({opened:Aa(!0),path:J()}),q({provider:Ta,label:J().trim().max(200).optional(),configDir:J().trim().min(1).max(4096)}),q({profile:Ym}),q({label:J().trim().max(200).optional(),configDir:J().trim().min(1).max(4096).optional()}),q({removed:Aa(!0),id:J()});var Qm=`quick-task`;function $m(e,t,n=24){return[t,...(e??[]).filter(e=>!(e.source===t.source&&e.ref===t.ref))].slice(0,n)}var eh=[{id:`claude`,label:`claude`,desc:`Claude Code CLI`},{id:`codex`,label:`codex`,desc:`OpenAI Codex (app-server)`},{id:`opencode`,label:`opencode`,desc:`OpenCode (serve)`},{id:`pi`,label:`pi`,desc:`pi CLI (provider/model)`},{id:`cursor`,label:`Cursor`,desc:`Cursor CLI (ACP)`},{id:`omp`,label:`OMP`,desc:`Oh My Pi CLI (provider/model)`}],th={claude:[{id:``,label:`auto`,desc:`Pick the best model per step`},{id:`opus`,label:`opus`,desc:`Deep reasoning for hard tasks`},{id:`sonnet`,label:`sonnet`,desc:`Fast and cheap`},{id:`haiku`,label:`haiku`,desc:`Fastest — simple, scoped tasks`}],codex:[{id:``,label:`auto`,desc:`Use your Codex default model`}],opencode:[{id:``,label:`auto`,desc:`Use your OpenCode default model`}],cursor:[{id:``,label:`auto`,desc:`Use your Cursor default model`}],pi:[{id:``,label:`auto`,desc:`Use your pi default model`}],omp:[{id:``,label:`auto`,desc:`Use your OMP default model`}]},nh=[{value:``,label:`auto`,desc:`Harness default`},{value:`low`,label:`low`,desc:`Less reasoning, faster replies`},{value:`medium`,label:`medium`,desc:`Balanced reasoning`},{value:`high`,label:`high`,desc:`More reasoning for hard tasks`},{value:`xhigh`,label:`xhigh`,desc:`Extra-high reasoning`},{value:`max`,label:`max`,desc:`Maximum reasoning`}];function rh(e,t,n){let r=e===`cursor`?[nh[0]]:nh,i=Da(e)&&(e!==`cursor`||n?.runner===e)?n?.models.find(e=>e.id===t)?.effortLevels:void 0;if(!i?.length)return r;let a=[nh[0]],o=new Set;for(let e of i){if(o.has(e))continue;let t=nh.find(t=>t.value===e);t&&(o.add(e),a.push(t))}return a.length>1?a:r}function ih(e,t){let n=e??``;return t.some(e=>e.value===n)?n:``}var ah=[`opencode`,`pi`,`omp`];function oh(e,t){return t===`cursor`||!e||th[t].some(t=>t.id===e)?!1:t!==`claude`&&[`claude-fable-5`,`claude-opus-4-8`,`claude-sonnet-5`,`claude-haiku-4-5`].includes(e)?!0:Object.entries(th).some(([n,r])=>n!==t&&!ah.includes(n)&&r.some(t=>t.id!==``&&t.id===e))}function sh(e,t,n=[]){let r=t?.runner===e?t.models:[],i=th[e]??th.claude,a=[...r.length?i.slice(0,1):i],o=new Set(a.map(e=>e.id));if(Da(e))for(let e of r)!e.id||o.has(e.id)||(o.add(e.id),a.push({id:e.id,label:e.label||e.id,desc:e.description}));for(let t of n)!t||o.has(t)||oh(t,e)||(o.add(t),a.push({id:t,label:t,desc:`Custom or legacy model`}));return a}var ch={claude:`Claude`,codex:`Codex`,opencode:`OpenCode`,pi:`Pi`,cursor:`Cursor`,omp:`OMP`};function lh(e,t,n=!1,r=!1){if(!Da(e))return;let i=ch[e];if(t?.stale)return`Using cached ${i} model list`;if(n||t?.source===`unavailable`)return`Latest ${i} models unavailable`;if(r&&!t)return`Loading ${i} models…`}function uh(e){let t=eh.map(e=>e.id).filter(t=>e.some(e=>e.name===t&&e.available));return t.length>0?t:[`claude`]}function dh(e,t,n){return e!==null&&t.includes(e)?e:t.includes(n)?n:t[0]??`claude`}function fh(e,t,n=!1){return!n&&e===t?void 0:e}function ph(e,t,n,r){let i=sh(t,r,[e,n?.[t]]);if(e!==null&&i.some(t=>t.id===e))return e;let a=n?.[t];return a!==void 0&&i.some(e=>e.id===a)?a:``}function mh(e,t,n){return e.source===`skill`?t.some(t=>t.name===e.ref):n.some(t=>t.name===e.ref)}function hh(e,t,n){return e&&mh(e,t,n)?e:null}function gh(e){let{task:t,source:n,model:r,modelsLocked:i,effort:a,runner:o,runnerExplicit:s,defaultRunner:c,agentProfile:l,images:u,worktree:d,autonomous:f,archiveWhenDone:p,autoMergePr:m}=e;return{task:t,...n?.source===`skill`?{steps:[{id:`task`,name:n.ref,skill:n.ref,prompt:`{{task}}`}]}:{workflow:n?.ref??`quick-task`},model:i?void 0:r||void 0,effort:i?void 0:a||void 0,runner:fh(o,c,s),agentProfile:l||void 0,images:u.length>0?[...u]:void 0,worktree:d!==!1&&void 0,autonomous:f===!0||void 0,...p?{archiveWhenDone:!0}:{},...m?{autoMergePr:!0}:{}}}function _h(e,t){return t?{...e,notify:!0}:e}function vh(e){return`/tasks/${e.id}`}var yh=`inline-flex h-[26px] min-w-0 max-w-full items-center gap-1.5 rounded-full border border-control-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:border-dashed disabled:bg-muted`,bh=(0,Q.jsx)(Ke,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-supporting-foreground`}),xh=(0,Z.createContext)(null),Sh=e=>Number.parseFloat(e)||0;function Ch({pill:e,box:t,full:n}){let r=getComputedStyle(e),i=[...e.children].filter(e=>{if(e===t)return!1;let n=getComputedStyle(e);return n.display!==`none`&&n.position!==`absolute`});return i.reduce((e,t)=>e+t.getBoundingClientRect().width,0)+Sh(r.columnGap)*i.length+n.getBoundingClientRect().width+Sh(r.paddingLeft)+Sh(r.paddingRight)+Sh(r.borderLeftWidth)+Sh(r.borderRightWidth)}function wh(e){for(let t=e.parentElement;t;t=t.parentElement){if(t.dataset.slot===`picker-pill-disabled-wrapper`)continue;let e=getComputedStyle(t).display;if(e===`grid`||e===`flex`)return t}return e.parentElement}function Th(e){let t=new Map;for(let n of e){let e=wh(n.pill),r=t.get(e)??new Map,i=Math.round(n.pill.getBoundingClientRect().top);r.set(i,[...r.get(i)??[],n]),t.set(e,r)}for(let[e,n]of t){let t=getComputedStyle(e),r=e.clientWidth-Sh(t.paddingLeft)-Sh(t.paddingRight);for(let e of n.values())if(e.reduce((e,t)=>e+Ch(t),0)+Sh(t.columnGap)*(e.length-1)>r+.5)return!1}return!0}function Eh({children:e}){let t=(0,Z.useRef)(new Map),n=(0,Z.useRef)(null),[r,i]=(0,Z.useState)(!0),a=(0,Z.useCallback)(()=>i(Th([...t.current.values()])),[]),o=(0,Z.useCallback)((e,r)=>{if(t.current.set(e,r),typeof ResizeObserver<`u`){n.current??=new ResizeObserver(a);for(let e of[r.box,r.full,wh(r.pill)])n.current.observe(e)}return a(),()=>{if(t.current.delete(e),typeof ResizeObserver<`u`)for(let e of[r.box,r.full])n.current?.unobserve(e);a()}},[a]);(0,Z.useLayoutEffect)(()=>()=>n.current?.disconnect(),[]);let s=(0,Z.useMemo)(()=>({register:o,showPrefixes:r}),[o,r]);return(0,Q.jsx)(xh.Provider,{value:s,children:e})}function Dh({field:e,children:t}){let n=(0,Z.useRef)(null),r=(0,Z.useRef)(null),i=(0,Z.useContext)(xh),a=i?.register,o=(0,Z.useId)(),[c,l]=(0,Z.useState)(!0);(0,Z.useLayoutEffect)(()=>{let e=n.current,t=r.current;if(a){let n=e.closest(`[data-slot$="pill"]`);return n?a(o,{pill:n,box:e,full:t}):void 0}let i=()=>l(t.getBoundingClientRect().width<=e.getBoundingClientRect().width+.5);if(i(),typeof ResizeObserver>`u`)return;let s=new ResizeObserver(i);return s.observe(e),s.observe(t),()=>s.disconnect()},[e,t,o,a]);let u=i!==null,d=u?i.showPrefixes:c,f=u&&!d;return(0,Q.jsxs)(`span`,{ref:n,className:`relative min-w-0 overflow-hidden`,"aria-hidden":`true`,children:[(0,Q.jsxs)(`span`,{ref:r,className:s(`invisible w-max whitespace-nowrap`,f?`absolute left-0 top-0`:`block`),children:[e,` · `,t]}),(0,Q.jsxs)(`span`,{"data-slot":`picker-label`,className:s(`block truncate`,f?`relative`:`absolute inset-0`),children:[d?(0,Q.jsxs)(`span`,{className:`text-muted-foreground`,children:[e,` · `]}):null,t]})]})}function Oh({slot:e,ariaLabel:t,label:n,value:r,options:i,onPick:a,disabled:o=!1,readOnly:c=!1,hint:l,disabledHint:u,status:d,searchPlaceholder:f,icon:p,fieldLabel:m=!1}){let[h,g]=(0,Z.useState)(!1),[_,v]=(0,Z.useState)(``),y=(0,Z.useRef)(null),b=(0,Z.useRef)(null),x=f?i.filter(e=>e.label.toLowerCase().includes(_.trim().toLowerCase())):i;(0,Z.useEffect)(()=>{if(!h||!f)return;let e=window.setTimeout(()=>y.current?.focus());return()=>window.clearTimeout(e)},[h,f]);let S=e=>{y.current&&document.activeElement===y.current&&e.preventDefault()},C=p?` h-11 gap-2 rounded-lg border-border px-3 text-foreground`:``,w=m?`${t} · ${typeof n==`string`?n:i.find(e=>e.value===r)?.label??r}`:t,T=c?u??l:o?u:l,E=m?[w,T].filter(Boolean).join(` — `):T,D=(0,Q.jsxs)(Q.Fragment,{children:[p,m?(0,Q.jsx)(Dh,{field:t,children:n}):(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,title:typeof n==`string`?n:void 0,children:n})]});if(c)return(0,Q.jsxs)(`span`,{"data-slot":e,"aria-label":w,title:E,className:s(yh,C,`cursor-default hover:bg-card hover:text-muted-foreground`),children:[D,m?(0,Q.jsx)(`span`,{className:`sr-only`,children:w}):null]});let O=(0,Q.jsxs)(`button`,{type:`button`,"data-slot":e,"aria-label":w,disabled:o,title:E,className:s(yh,C),children:[D,p?(0,Q.jsx)(Ke,{"aria-hidden":`true`,className:`size-[13px] shrink-0 text-muted-foreground`}):bh]});return o?(0,Q.jsx)(`span`,{"data-slot":`picker-pill-disabled-wrapper`,title:E,className:`inline-flex min-w-0 max-w-full`,children:O}):(0,Q.jsxs)(Kn,{open:h,onOpenChange:e=>{g(e),e||v(``)},children:[(0,Q.jsx)(Mn,{asChild:!0,children:O}),(0,Q.jsxs)(Rn,{ref:b,align:`start`,"data-testid":`${e}-menu`,children:[f?(0,Q.jsxs)(`div`,{"data-slot":`picker-search`,className:`mbe-1 flex min-h-11 min-w-56 items-center gap-2 border-b border-border px-2`,children:[(0,Q.jsx)(at,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Q.jsx)(`input`,{ref:y,type:`search`,"aria-label":f,placeholder:f,value:_,onChange:e=>v(e.target.value),onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault(),e.stopPropagation();let t=b.current?.querySelectorAll(`[role="menuitemradio"]:not([data-disabled])`);(e.key===`ArrowDown`?t?.[0]:t?.[t.length-1])?.focus()}else e.key!==`Escape`&&e.stopPropagation()},className:`h-11 w-0 min-w-0 flex-1 bg-transparent text-sm placeholder:text-muted-foreground`})]}):null,(0,Q.jsx)(Vn,{value:r,onValueChange:a,children:x.map(e=>(0,Q.jsx)(Rt,{value:e.value,className:s(`gap-2.5`,f&&`min-h-11`),onPointerMove:S,onPointerLeave:S,onKeyDown:t=>{y.current&&(t.key===`ArrowUp`&&e===x[0]||t.key===`Tab`&&t.shiftKey)&&(t.preventDefault(),t.stopPropagation(),y.current.focus())},children:(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Q.jsx)(`span`,{className:`text-[13px] font-medium`,children:e.label}),e.desc?(0,Q.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:e.desc}):null]})},e.value))}),f&&x.length===0?(0,Q.jsx)(`p`,{role:`status`,className:`px-2 py-5 text-center text-xs text-muted-foreground`,children:`No matches found.`}):null,d?(0,Q.jsx)(cn,{disabled:!0,onPointerMove:S,onPointerLeave:S,className:`border-t border-border text-[11px] text-muted-foreground`,children:d}):null]})]})}var kh=(e,t)=>t===null?e:`${e}:${t}`;function Ah({runners:e,value:t,onPick:n,disabled:r=!1,accounts:i=[],account:a=null,repoAccount:o,icon:s,fieldLabel:c}){let l=eh.filter(t=>e.includes(t.id)).flatMap(e=>{let t=i.filter(t=>t.provider===e.id);return t.length<2?[{value:kh(e.id,null),label:e.id,desc:e.desc}]:t.map(t=>({value:kh(e.id,t.id),label:`${e.id} · ${t.label}`,desc:t.configDir}))}),u=a??o?.[t]??`default`,d=l.some(e=>e.value===kh(t,u))?kh(t,u):kh(t,null);return(0,Q.jsx)(Oh,{icon:s,fieldLabel:c,slot:`runner-pill`,ariaLabel:`Runner`,label:l.find(e=>e.value===d)?.label??t,value:d,disabled:r,onPick:e=>{let[t,r]=e.split(`:`);n(t,r??null)},options:l})}function jh({templates:e,onInsert:t,triggerClassName:n,disabled:r,iconOnly:i=!1,label:a=`Template`}){let[o,c]=(0,Z.useState)(!1),l=(0,Z.useRef)(null),u=Za();return e.length===0?null:(0,Q.jsxs)(Co,{open:o,onOpenChange:c,children:[(0,Q.jsx)(vo,{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:s(`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)(tn,{"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)(Ke,{"aria-hidden":`true`,className:`size-[13px] shrink-0 text-soft-foreground`})]})]})}),(0,Q.jsx)(xo,{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)(Cp,{filter:mm,children:[(0,Q.jsx)(Tp,{placeholder:`search templates…`,onInput:()=>l.current?.scrollTo(0,0)}),(0,Q.jsxs)(Ep,{ref:l,"data-slot":`prompt-template-list-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,Q.jsx)(Dp,{children:`Nothing matches.`}),(0,Q.jsx)(Op,{heading:`Insert a template`,children:e.map(e=>(0,Q.jsxs)(Ap,{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),c(!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)(le,{"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)(kp,{}),(0,Q.jsx)(Op,{children:(0,Q.jsx)(Ap,{value:`edit prompt templates settings`,"data-slot":`prompt-template-settings`,className:`text-[12px] text-muted-foreground`,onSelect:()=>{c(!1),u(`/settings/prompt-templates`)},children:`Edit templates…`})})]})]})})]})}function Mh({className:e,size:t=`default`,...n}){return(0,Q.jsx)(ad,{"data-slot":`switch`,"data-size":t,className:s(`peer group/switch inline-flex shrink-0 items-center rounded-full border border-transparent shadow-none transition-[color,background-color,border-color,box-shadow] outline-hidden 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)(sd,{"data-slot":`switch-thumb`,className:s(`pointer-events-none block rounded-full bg-background ring-0 motion-safe: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 Nh={name:`cezar-syn`,type:`dark`,fg:`var(--syn-var)`,bg:`transparent`,settings:[{scope:[`keyword`,`storage`,`constant.language`,`variable.language`,`entity.other.attribute-name`,`support.type.property-name`],settings:{foreground:`var(--syn-key)`}},{scope:[`string`,`punctuation.definition.string`],settings:{foreground:`var(--syn-str)`}},{scope:[`entity.name.function`,`support.function`,`entity.name.tag`,`entity.name.type`,`entity.name.class`,`support.class`,`support.type`],settings:{foreground:`var(--syn-fn)`}},{scope:[`comment`,`punctuation.definition.comment`],settings:{foreground:`var(--syn-com)`}},{scope:[`constant.numeric`,`constant.character`,`constant.other`,`support.constant`,`keyword.other.unit`],settings:{foreground:`var(--syn-num)`}},{scope:[`punctuation`,`keyword.operator`,`meta.brace`,`punctuation.separator`,`punctuation.terminator`],settings:{foreground:`var(--syn-punc)`}},{scope:[`variable`,`entity.name.variable`],settings:{foreground:`var(--syn-var)`}}]},Ph={typescript:()=>ya(()=>import(`./typescript-bsJCZSQ-.js`),[]),tsx:()=>ya(()=>import(`./tsx-udAQXfEw.js`),[]),javascript:()=>ya(()=>import(`./javascript-BgS3c2Ky.js`),[]),jsx:()=>ya(()=>import(`./jsx-Bz0zcwM4.js`),[]),json:()=>ya(()=>import(`./json-qhed-kSA.js`),[]),jsonc:()=>ya(()=>import(`./jsonc-CYpm1nAK.js`),[]),shellscript:()=>ya(()=>import(`./shellscript-CLZ0U2zV.js`),[]),python:()=>ya(()=>import(`./python-gzcpVVnB.js`),[]),markdown:()=>ya(()=>import(`./markdown-BYOwaDjH.js`),[]),css:()=>ya(()=>import(`./css-BsVw1vtW.js`),[]),html:()=>ya(()=>import(`./html-BY76lXLH.js`),__vite__mapDeps([0,1,2])),diff:()=>ya(()=>import(`./diff-woXpYk--.js`),[]),yaml:()=>ya(()=>import(`./yaml-rwi0_p6S.js`),[]),toml:()=>ya(()=>import(`./toml-CcmNWLt0.js`),[]),go:()=>ya(()=>import(`./go-rLFTqkRN.js`),[]),rust:()=>ya(()=>import(`./rust-Cfkwpbl8.js`),[]),sql:()=>ya(()=>import(`./sql-BsFa4tDR.js`),[])},Fh={ts:`typescript`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,bash:`shellscript`,sh:`shellscript`,shell:`shellscript`,zsh:`shellscript`,console:`shellscript`,py:`python`,md:`markdown`,yml:`yaml`,golang:`go`,rs:`rust`,vue:`html`,xml:`html`},Ih=new Set([``,`plaintext`,`text`,`txt`,`plain`]);function Lh(e){let t=e.trim().toLowerCase();return t in Ph?t:Fh[t]??null}function Rh(e){return Ih.has(e.trim().toLowerCase())}function zh(){return[...Object.keys(Ph),...Object.keys(Fh),...Ih].filter(e=>e!==``)}function Bh(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);if(n<=0)return null;let r=t.slice(n+1).toLowerCase();return Lh({mts:`typescript`,cts:`typescript`,htm:`html`}[r]??r)}var Vh=null,Hh=null,Uh=new Set,Wh=new Map;function Gh(){return Hh??=Promise.all([ya(()=>import(`./core-BCsw8oQw.js`),__vite__mapDeps([3,4,5])),ya(()=>import(`./engine-javascript-FQvzRocB.js`),[])]).then(async([{createHighlighterCore:e},{createJavaScriptRegexEngine:t}])=>(Vh=await e({themes:[Nh],langs:[],engine:t({forgiving:!0})}),Vh)),Hh}function Kh(e){let t=Lh(e);if(t===null||Uh.has(t))return Promise.resolve();let n=Wh.get(t);return n||(n=Gh().then(async e=>{await e.loadLanguage(await Ph[t]()),Uh.add(t)}).catch(()=>{Wh.delete(t)}),Wh.set(t,n)),n}function qh(e){return{tokens:e.split(`
20
+ `).map(e=>[{content:e}]),fg:`var(--syn-var)`,bg:`transparent`}}function Jh(e,t,n={}){if(Rh(t))return qh(e);let r=Lh(t);if(r===null)return qh(e);if(!Vh||!Uh.has(r))return null;try{let t=Vh.codeToTokens(e,{lang:r,theme:Nh.name,...f({tokenizeTimeLimit:n.tokenizeTimeLimit})});return{tokens:t.tokens.map(e=>e.map(({content:e,color:t})=>({content:e,...f({color:t})}))),fg:t.fg??`var(--syn-var)`,bg:`transparent`}}catch{return qh(e)}}async function Yh(e,t,n={}){return Jh(e,t,n)||(await Kh(t),Jh(e,t,n)??qh(e))}function Xh({isOpen:e,onClose:t,onConfirm:n,url:r}){return(0,Q.jsx)(Ko,{open:e,onOpenChange:e=>{e||t()},children:(0,Q.jsxs)(Ro,{"data-slot":`link-safety-dialog`,children:[(0,Q.jsxs)(Go,{children:[(0,Q.jsx)(No,{children:`Open this link?`}),(0,Q.jsxs)(Mo,{children:[`It leaves cezar in a new tab. The words of a link in a transcript are the agent's — the address below is where it actually goes.`,(0,Q.jsx)(`span`,{"data-slot":`link-safety-url`,className:`mt-3 block wrap-anywhere rounded-md border border-border bg-muted px-3 py-2 font-mono text-xs text-foreground`,children:r})]})]}),(0,Q.jsxs)(Ho,{children:[(0,Q.jsx)(Wo,{children:`Cancel`}),(0,Q.jsx)(Vo,{onClick:n,children:`Open link`})]})]})})}var Zh=(0,Z.createContext)(null),Qh=/^\/(?:api|p|tasks|new|settings|skills|workflows|git|github|inbox|automations)(?:\/|[?#]|$)/;function $h(e,t){if(!e||/[\u0000-\u001f]/.test(e)||e.startsWith(`#`)||e.startsWith(`//`))return null;let n=e.indexOf(`#`),r=n<0?e:e.slice(0,n),i=n<0?``:e.slice(n),a=t.projectId?`/p/${encodeURIComponent(t.projectId)}`:``,o=`/tasks/${encodeURIComponent(t.runId)}/files`;if(r.startsWith(`${o}?artifact=`)){let e=new URLSearchParams(r.slice(o.length+1));return[...e.keys()].length===1&&/^[0-9a-f-]{36}$/i.test(e.get(`artifact`)??``)?a+r+i:null}if(Qh.test(r))return null;let s=/^[a-z]:[\\/]/i.test(r);if(!s&&/^[a-z][a-z\d+.-]*:/i.test(r)&&!/^file:/i.test(r))return null;let c=/^file:/i.test(r)?r:decodeURIComponent(r);if(/[\u0000-\u001f]/.test(c))return null;if(t.basePath&&!c.startsWith(`/`)&&!s&&!/^file:/i.test(r)){let e=t.basePath.replaceAll(`\\`,`/`);c=e.slice(0,e.lastIndexOf(`/`)+1)+c}return`${a}${o}?path=${encodeURIComponent(c)}${i}`}function eg({href:e,children:t,internal:n,...r}){let[i,a]=(0,Z.useState)(!1);return e?n?(0,Q.jsx)(`a`,{...r,href:e,"data-streamdown":`link`,className:`text-accent-text underline underline-offset-2`,children:t}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`a`,{...r,href:e,"data-streamdown":`link`,className:`cursor-pointer text-accent-text underline underline-offset-2`,onClick:e=>{e.preventDefault(),a(!0)},children:t}),(0,Q.jsx)(Xh,{isOpen:i,url:e,onClose:()=>a(!1),onConfirm:()=>{window.open(e,`_blank`,`noreferrer`),a(!1)}})]}):(0,Q.jsx)(`span`,{children:t})}var tg={name:`shiki`,type:`code-highlighter`,getThemes:()=>[Nh,Nh],getSupportedLanguages:()=>zh(),supportsLanguage:e=>zh().includes(String(e).toLowerCase()),highlight:({code:e,language:t},n)=>Jh(e,String(t))||(Yh(e,String(t)).then(e=>n?.(e)),null)};function ng(){let e=t=>{if(!t.children)return;let n=[];for(let r of t.children)if(r.type===`text`&&r.value?.includes(`
21
+ `)){let e=r.value.split(/\r?\n/);e.forEach((t,r)=>{r>0&&!(t===``&&r===e.length-1)&&n.push({type:`break`}),t&&n.push({type:`text`,value:t})})}else e(r),n.push(r);t.children=n};return e}var rg=[...Object.values(Yo),ng],ig=[`p`,`strong`,`em`,`del`,`code`,`a`],ag={p:`span`,a:`span`},og={enabled:!0,renderModal:e=>(0,Q.jsx)(Xh,{...e})},sg=`https://refused.invalid/`,cg=0,lg=(0,Z.memo)(function({children:e,breaks:t=!1,inline:n=!1,document:r=!1,imageSrc:i}){let a=(0,Z.useContext)(Zh),o=(0,Z.useMemo)(()=>{let e={instance:++cg},n=new Set;function o(){let e=t=>{if((t.type===`link`||t.type===`definition`)&&t.url&&a){let e=$h(t.url,a);e&&(t.url=e,n.add(e))}t.children?.forEach(e)};return e}let s=new Set;function c(){let e=t=>{if(t.type===`image`&&t.url&&i){let e=i(t.url);t.url=e?new URL(e,window.location.href).href:sg,e&&s.add(t.url)}t.children?.forEach(e)};return e}let l=a?[[o,e]]:[],u=r&&i?[[c,e]]:[];return{remark:[...t?rg:Object.values(Yo),...l,...u],components:{...a||r?{a:({href:e,children:t})=>r&&!a&&!/^(?:https?:|mailto:|#)/i.test(e??``)?(0,Q.jsx)(`span`,{children:t}):(0,Q.jsx)(eg,{href:e,internal:n.has(e??``),children:t})}:{},...r?{img:({src:e,alt:t})=>typeof e==`string`&&s.has(e)?(0,Q.jsx)(`img`,{src:e,alt:t??``,loading:`lazy`}):(0,Q.jsxs)(`span`,{className:`text-muted-foreground`,children:[`[Image: `,t||`embedded image`,`]`]})}:{}}}},[a,t,r,i]);return(0,Q.jsx)(Jo,{className:n?`thread-markdown thread-markdown-inline`:`thread-markdown`,plugins:{code:tg},shikiTheme:[Nh,Nh],...f({remarkPlugins:a||r&&i?o.remark:t?rg:void 0,allowedElements:n?ig:void 0,unwrapDisallowed:n||void 0,components:n?ag:a||r?o.components:void 0}),linkSafety:og,controls:{code:{copy:!0,download:!1},table:!1,mermaid:!1},lineNumbers:!1,children:e})});function ug({source:e,className:t}){return(0,Q.jsx)(`span`,{"data-slot":`skill-source`,"data-source":e,className:s(`shrink-0 rounded bg-accent-strong/10 px-2 py-1 text-[12px]`,rm({source:e})?`font-semibold text-foreground`:`text-soft-foreground`,t),children:e===`team`?`Team`:e})}function dg({skill:e,activation:t}){return(0,Q.jsx)(`span`,{className:`inline-flex min-h-11 min-w-11 shrink-0 items-center justify-center`,children:(0,Q.jsx)(Mh,{"data-slot":`skill-switch`,"data-skill":e.name,"data-repo":e.team?.repo,"data-locked":t.locked||void 0,"aria-label":t.ariaLabel,checked:t.checked,disabled:t.disabled,onCheckedChange:()=>t.onCheckedChange(),className:`relative before:absolute before:-inset-x-1 before:-inset-y-2.5 before:content-[''] disabled:cursor-default`})})}function fg({skill:e,usedBy:t,activation:n,heading:r=`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)(ug,{source:e.source}),` skill`]}),(0,Q.jsxs)(`div`,{className:`flex w-full min-w-0 items-start justify-between gap-3`,children:[(0,Q.jsx)(r,{className:`min-w-0 text-[19px] font-normal md:text-2xl break-words [overflow-wrap:anywhere]`,children:e.name}),n?(0,Q.jsx)(dg,{skill:e,activation:n}):null]})]}),n&&!n.checked?(0,Q.jsx)(`p`,{"data-slot":`skill-inactive-notice`,className:`mt-4 rounded-md border border-border bg-background px-3 py-2 text-[13px] text-muted-foreground`,children:`Not enabled for this project — agents can’t pick it.`}):null,(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)(Ve,{"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)(lg,{children:e.body})})})]})}function pg({skill:e,onClose:t}){return(0,Q.jsx)(mp,{open:e!==null,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsx)(_p,{"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)(xp,{className:`sr-only`,children:e.name}),(0,Q.jsx)(Sp,{className:`sr-only`,children:`Read-only skill preview`}),(0,Q.jsx)(fg,{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 mg(){let e=oa(),t=Ji(),n=(e.data?.profiles??[]).map(e=>({provider:e.provider,id:e.id,label:e.label,configDir:e.configDir})),r=t.data?.info?.root;return{accounts:n,repoAccount:r?e.data?.selections?.[r]:void 0}}function hg(e,t){return e.filter(e=>e.provider===t).length>1}function gg(e){try{let t=new URL(e),n=t.pathname===`/`?``:t.pathname.replace(/\/$/,``);return`${t.host}${n}`||e}catch{return e}}function _g(e){return e?e.webhooks?e.webhooks.filter(e=>e.tasks).map(({id:e,name:t,url:n})=>({id:e,name:t,url:n})):e.webhook?[{id:`task-webhook`,name:`Task webhook`,url:e.webhook.url}]:[]:[]}function vg(e){let t=e.map(e=>e.name);return t.length<=2?t.join(` and `):t.length===3?`${t[0]}, ${t[1]} and ${t[2]}`:`${t[0]}, ${t[1]} and ${t.length-2} more`}function yg(e,t,n){let r=e.skill===``?{source:`workflow`,ref:`quick-task`}:{source:`skill`,ref:e.skill};return gh({task:e.ref,source:r,model:``,runner:t,defaultRunner:n,images:[]})}function bg(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 xg(e,t){return`Use the "${e}" skill on: ${t}`}function Sg(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.explicitWorktree??n??e.configuredWorktree:!1}}function Cg(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 wg={text:``,source:null,runner:null,agentProfile:null,model:null,effort:null,retiredVariants:!1,planFirst:!1,worktree:null,autonomous:null,archiveWhenDone:!1,autoMergePr:!1},Tg=`cez-new-task-draft`;function Eg(e){return e===null?Tg:`${Tg}:${e}`}function Dg(e){let t=e&&typeof e==`object`?e:{};return{text:typeof t.text==`string`?t.text:``,source:Og(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,retiredVariants:t.retiredVariants===!0||t.variants!==void 0&&t.variants!==1,planFirst:t.planFirst===!0,worktree:typeof t.worktree==`boolean`?t.worktree:null,autonomous:typeof t.autonomous==`boolean`?t.autonomous:null,archiveWhenDone:t.archiveWhenDone===!0,autoMergePr:t.autoMergePr===!0}}function Og(e){return!!e&&typeof e==`object`&&(e.source===`skill`||e.source===`workflow`)&&typeof e.ref==`string`}var kg=new Map,Ag=new Map;function jg(e=null){return Ag.get(Eg(e))??0}function Mg(e=null){let t=Eg(e),n=kg.get(t);if(n)return{...n};let r;try{let e=localStorage.getItem(t);r=e?Dg(JSON.parse(e)):{...wg}}catch{r={...wg}}return kg.set(t,r),{...r}}function Ng(e,t=null){let n=Eg(t);Ag.set(n,jg(t)+1),kg.set(n,{...e});try{localStorage.setItem(n,JSON.stringify(e))}catch{}}function Pg(e=null,t){t!==void 0&&jg(e)!==t||Ng({...Mg(e),text:``,source:null},e)}function Fg(e,t,n){return{task:e,steps:[...n.steps],rationale:n.rationale,fallback:n.fallback,images:[...t]}}function Ig(e,t){return!Number.isInteger(t)||t<0||t>=e.length?[...e]:e.filter((e,n)=>n!==t)}function Lg(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 Rg(e){return e.command??e.prompt??``}function zg(e,t=120){let n=e.split(`
22
+ `)[0]??``;return n.length>t?`${n.slice(0,t-1)}…`:n}function Bg(e){let{task:t,steps:n,model:r,modelsLocked:i,effort:a,runner:o,runnerExplicit:s,defaultRunner:c,images:l,archiveWhenDone:u,autoMergePr:d}=e;return{task:t,steps:[...n],model:i?void 0:r||void 0,effort:i?void 0:a||void 0,runner:fh(o,c,s),images:l.length>0?[...l]:void 0,...u?{archiveWhenDone:!0}:{},...d?{autoMergePr:!0}:{}}}function Vg(e,t){return{...Mg(e),...t.ref===``?{}:{text:t.ref},...t.skill===``?{}:{source:{source:`skill`,ref:t.skill}}}}function Hg(e,t){let[n,r]=(0,Z.useState)(()=>Vg(e,t)),i=(0,Z.useRef)(n);(0,Z.useEffect)(()=>{Ng(i.current,e)},[e]);let a=(0,Z.useRef)(!1),o=(0,Z.useRef)(!0);return(0,Z.useEffect)(()=>(o.current=!0,()=>{o.current=!1}),[]),{draft:n,update:t=>{if(!o.current||a.current)return;let n={...i.current,...t};i.current=n,Ng(n,e),r(n)},submissionPending:a,mounted:o}}function Ug(e,t){let n=Sr(),r=qr(),i=r.data,a=t.data?.skillUsage,o=(0,Z.useMemo)(()=>sm(i??[],a),[i,a]),s=n.data?.workflows??[],c=r.data!==void 0&&n.data!==void 0&&!t.isPending,l=hh(e,o,s);return{skillList:o,skillUsage:a,workflowList:s,sourcesReady:c,source:l,selectedSkill:l?.source===`skill`?o.find(e=>e.name===l.ref):void 0}}function Wg(e){let{uiState:t,source:n,sourcesReady:r,draftText:i,submissionPending:a,update:o}=e,s=kr().data?.capabilities.automations===!0,c=t.data?.promptTemplates,l=(0,Z.useMemo)(()=>zp(Vp(c),{automations:s}),[c,s]),u=Wp(l,n?.source===`skill`?[n.ref]:[]),d=(0,Z.useRef)(i);d.current=i;let f=(0,Z.useRef)(``);return(0,Z.useEffect)(()=>{if(!r||a.current)return;let e=Gp(d.current,f.current,u);f.current=e.applied,e.text!==d.current&&o({text:e.text})},[u,r]),l}function Gg(e,t){let n=Wi(),r=kn(n.data),i=t.data?.defaultRunner,a=i??`claude`,o=r.length>0?dh(e.runner,r,a):null,s=o??a,c=n.isSuccess&&r.length>0,l=Tr(s),u=t.data?.modelsLocked===!0,d=t.data?.defaultModels,f=o===null?[]:sh(o,l.data,[e.model,d?.[o]]),p=o===null?``:ph(u?null:e.model,o,d,l.data),m=rh(s,p,l.data);return{providers:n,runners:r,defaultRunner:i,runner:o,displayRunner:s,providersReady:c,catalog:l,modelsLocked:u,models:f,model:p,effortOptions:m,effort:u?``:ih(e.effort,m)}}function Kg(e,t){let{accounts:n,repoAccount:r}=mg();return{accountChoices:n,repoAccount:r,agentProfile:n.some(n=>n.provider===e&&n.id===t)?t:null}}function qg(e){let t=(0,Z.useRef)(!1);(0,Z.useEffect)(()=>{let n=e&&!t.current;t.current=e,n&&document.activeElement===document.body&&document.querySelector(`textarea[aria-label="Describe a task for the agent"]`)?.focus()},[e])}function Jg(e){let t=e.workspaceConfig.data?.composerDefaults;return Sg({hasGit:e.hasGit,planFirst:e.draft.planFirst,explicitAutonomous:e.draft.autonomous,explicitWorktree:e.draft.worktree,interactive:e.selectedSkill?.interactive,configuredAutonomous:t?.autonomous??t?.inheritedAutonomous??`source-dependent`,configuredWorktree:t?.worktree??t?.inheritedWorktree??!0,source:e.source?.source??`workflow`})}function Yg(e){let t=aa(),n=t.data?.projects??[],r=e??t.data?.bootProject,i=_g(n.find(e=>e.id===r)),[a,o]=(0,Z.useState)(!1);return{projectList:n,webhookTargets:i,notifyOn:i.length>0&&a,setNotifyChoice:o}}function Xg(e,t){let[n,r]=(0,Z.useState)(()=>typeof window<`u`&&window.innerWidth<=767);return(0,Z.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let n=()=>r(window.innerWidth<=767||t.getBoundingClientRect().width<550);n();let i=typeof ResizeObserver>`u`?null:new ResizeObserver(n);return i?.observe(t),window.addEventListener(`resize`,n),()=>{i?.disconnect(),window.removeEventListener(`resize`,n)}},[t]),n}async function Zg(e){let t=jg(e.draftProjectId),n=``;try{n=(await kt()).key}catch{}if(n===``||e.deepLink.key!==n)return{kind:`blocked`};try{let n=await Wt(yg(e.deepLink,e.runner,e.defaultRunner));return Pg(e.draftProjectId,t),e.queryClient.invalidateQueries({queryKey:G.runs.all}),e.mounted.current&&e.navigate(vh(n)),null}catch(e){return{kind:`failed`,message:e instanceof Error?e.message:String(e)}}}function Qg(e){let{deepLink:t}=e,n=Za(),r=V(),[i,a]=(0,Z.useState)(()=>t.auto&&t.ref!==``),[o,s]=(0,Z.useState)(()=>!t.auto&&t.ref!==``?{kind:`prefill`}:null);$g(e.search,n);let{providers:c,providersReady:l,runner:u,defaultRunner:d}=e.engine,f=(0,Z.useRef)(!1);return(0,Z.useEffect)(()=>{if(f.current||!t.auto||t.ref===``||c.isPending)return;let i=!l||u===null;if(!(!i&&e.config.isPending)){if(f.current=!0,i||d===void 0){s({kind:`prefill`}),a(!1);return}Zg({deepLink:t,runner:u,defaultRunner:d,draftProjectId:e.draftProjectId,queryClient:r,navigate:n,mounted:e.mounted}).then(e=>{e!==null&&(s(e),a(!1))})}},[e.config.isPending,d,c.isPending,l,u]),e_({notice:o,setNotice:s,deepLink:t,sourcesReady:e.sourcesReady,skillList:e.skillList,update:e.update}),i}function $g(e,t){let n=(0,Z.useRef)(!1);(0,Z.useEffect)(()=>{n.current||(n.current=!0,e.toString()!==``&&t(`/new`,{replace:!0}))},[])}function e_(e){let{notice:t,sourcesReady:n,deepLink:r}=e;(0,Z.useEffect)(()=>{if(t===null||!n)return;e.setNotice(null);let i=r.skill!==``&&!e.skillList.some(e=>e.name===r.skill)?r.skill:``;i!==``&&e.update({text:xg(r.skill,r.ref),source:null});let{message:a,tone:o}=bg(t,i);H(a,{tone:o}),document.querySelector(`[data-slot="composer"] button[aria-label="Start task"], [data-slot="composer"] button[aria-label="Plan task"]`)?.focus()},[t,n])}function t_(e){return e.isPending?`Checking agent providers…`:e.isError?`Provider authentication could not be verified.`:`Connect an agent provider before starting a task.`}function n_(e,t,n){In({lastTask:e,...e?{recentSources:$m(t.data?.recentSources,e)}:{},...e?.source===`skill`&&t.data!==void 0?{skillUsage:lm(t.data.skillUsage,e.ref)}:{}}).then(()=>n.invalidateQueries({queryKey:G.uiState})).catch(()=>{})}function r_(e){let t=Za(),n=V(),[r,i]=(0,Z.useState)(null),[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(!1),{draft:l,draftProjectId:u,engine:d,mounted:f}=e,{providers:p,providersReady:m,runner:h}=d,g=(e,r)=>{Pg(u,r),n.invalidateQueries({queryKey:G.runs.all}),f.current&&t(vh(e))};return{plan:r,setPlan:i,planning:a,starting:s,submit:async(t,r)=>{let a=jg(u);if(l.retiredVariants)throw Error(`Parallel variants are removed. Choose Use one task before starting this saved draft.`);if(!m||h===null)throw Error(t_(p));if(!e.sourcesReady)throw Error(`Still loading workflows and skills — try again in a second.`);if(l.planFirst){o(!0);try{let e=await ye(t);f.current&&i(Fg(t,r,e))}finally{o(!1)}return}let s=await Wt(_h(gh({task:t,source:e.source,model:d.model,modelsLocked:d.modelsLocked,effort:d.effort,runner:h,runnerExplicit:l.runner!==null,agentProfile:e.agentProfile,defaultRunner:d.defaultRunner,images:r,worktree:e.runMode.worktree,autonomous:e.runMode.autonomous,archiveWhenDone:l.archiveWhenDone,autoMergePr:l.autoMergePr}),e.notifyOn));n_(e.source,e.uiState,n),g(s,a)},startPlanned:async()=>{if(r===null||r.steps.length===0||s||!m||h===null)return;let t=jg(u);c(!0);try{let n=await Wt(_h(Bg({task:r.task,steps:r.steps,model:d.model,modelsLocked:d.modelsLocked,effort:d.effort,runner:h,runnerExplicit:l.runner!==null,defaultRunner:d.defaultRunner,images:r.images,archiveWhenDone:l.archiveWhenDone,autoMergePr:l.autoMergePr}),e.notifyOn));i(null),g(n,t)}catch(e){H(e instanceof Error?e.message:String(e),{tone:`danger`})}finally{c(!1)}}}}function i_(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`)??``}}function a_({archiveWhenDone:e,autoMergePr:t,onChange:n,disabled:r=!1,embedded:i=!1}){let a=(0,Z.useId)();return(0,Q.jsxs)(`fieldset`,{"data-slot":`completion-controls`,"data-embedded":i||void 0,className:`grid min-w-0 gap-3`,children:[(0,Q.jsx)(`legend`,{className:i?`sr-only`:`text-sm font-medium [margin-block-end:0.5rem]`,children:`After Done`}),(0,Q.jsxs)(`label`,{htmlFor:`${a}-archive`,className:`completion-control flex min-h-11 min-w-0 items-center justify-between gap-3 rounded-md text-sm`,children:[(0,Q.jsxs)(`span`,{className:`min-w-0 break-words`,children:[(0,Q.jsx)(`span`,{id:`${a}-archive-label`,children:`Archive when Done`}),i?(0,Q.jsx)(`span`,{id:`${a}-archive-help`,className:`completion-control-help`,children:`Move to Archived after Done, even without a PR. You can restore it later.`}):null]}),(0,Q.jsx)(Mh,{id:`${a}-archive`,className:`completion-switch`,checked:e,disabled:r,"aria-labelledby":`${a}-archive-label`,"aria-describedby":`${a}-archive-help`,onCheckedChange:e=>n({archiveWhenDone:e})})]}),i?null:(0,Q.jsx)(`p`,{id:`${a}-archive-help`,className:`text-xs break-words text-muted-foreground`,children:`Move the task to Archived after it reaches Done. You can restore it later.`}),(0,Q.jsxs)(`label`,{htmlFor:`${a}-merge`,className:`completion-control flex min-h-11 min-w-0 items-center justify-between gap-3 rounded-md text-sm`,children:[(0,Q.jsxs)(`span`,{className:`min-w-0 break-words`,children:[(0,Q.jsx)(`span`,{id:`${a}-merge-label`,children:`Auto-merge PR`}),i?(0,Q.jsx)(`span`,{id:`${a}-merge-help`,className:`completion-control-help`,children:`After Done, mark the PR ready and merge when current-head CI and GitHub rules allow.`}):null]}),(0,Q.jsx)(Mh,{id:`${a}-merge`,className:`completion-switch`,checked:t,disabled:r,"aria-labelledby":`${a}-merge-label`,"aria-describedby":`${a}-merge-help`,onCheckedChange:e=>n({autoMergePr:e})})]}),i?null:(0,Q.jsx)(`p`,{id:`${a}-merge-help`,className:`text-xs break-words text-muted-foreground`,children:`After Done, mark a draft PR ready and merge when current-head CI and GitHub rules allow it.`}),!i||e&&t?(0,Q.jsx)(`p`,{className:`completion-order-note text-xs break-words text-muted-foreground`,children:i?`Merge runs before archive when both are on.`:`When both are on, merge comes before archive. Without a PR, Archive when Done still archives the task.`}):null]})}function o_(){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)(Hi,{}),(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.`})]})]})}function s_(){return(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.`})]})}function c_({onUseOneTask:e}){return(0,Q.jsxs)(`section`,{role:`alert`,className:`flex flex-col items-start gap-3 rounded-xl border border-border bg-card p-4`,children:[(0,Q.jsx)(`p`,{children:`Parallel variants are removed. This saved draft requested multiple candidates. Use owned workers to compare approaches, or start one task.`}),(0,Q.jsx)(A,{variant:`outline`,className:`min-h-11`,onClick:e,children:`Use one task`})]})}function l_({groupRef:e,compact:t,engine:n,accounts:r,draftEffort:i,update:a}){let o=n.runners.length>1||n.runners.some(e=>hg(r.accountChoices,e))?(0,Q.jsx)(u_,{engine:n,accounts:r,update:a},`runner`):null,s=(0,Q.jsx)(d_,{engine:n,draftEffort:i,update:a},`model`),c=(0,Q.jsx)(f_,{engine:n,update:a},`effort`);return(0,Q.jsx)(`div`,{ref:e,"data-slot":`agent-options`,role:`group`,"aria-label":`Agent settings`,className:`new-task-agent-options`,children:(0,Q.jsx)(Eh,{children:t?[o,c,s]:[o,s,c]})})}function u_({engine:e,accounts:t,update:n}){return(0,Q.jsx)(Ah,{icon:(0,Q.jsx)(te,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,runners:e.runners,value:e.displayRunner,accounts:t.accountChoices,account:t.agentProfile,repoAccount:t.repoAccount,onPick:(t,r)=>n({runner:t,agentProfile:r,...t===e.displayRunner?{}:{model:null}}),disabled:!e.providersReady})}function d_({engine:e,draftEffort:t,update:n}){let{catalog:r,displayRunner:i}=e;return(0,Q.jsx)(Oh,{icon:(0,Q.jsx)(vt,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`model-pill`,ariaLabel:`Model`,label:e.models.find(t=>t.id===e.model)?.label??`auto`,value:e.model,disabled:!e.providersReady,readOnly:e.modelsLocked,disabledHint:e.modelsLocked?`Model selection is locked to native coding-agent settings.`:void 0,onPick:e=>{let a=rh(i,e,r.data);n({model:e,effort:t===null?null:ih(t,a)})},options:e.models.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:lh(i,r.data,r.isError,r.isFetching)})}function f_({engine:e,update:t}){return(0,Q.jsx)(Oh,{icon:(0,Q.jsx)(Jt,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`effort-pill`,ariaLabel:`Effort`,label:e.effortOptions.find(t=>t.value===e.effort)?.label??`auto`,value:e.effort,disabled:!e.providersReady,readOnly:e.modelsLocked,disabledHint:e.modelsLocked?`Effort selection is locked to native coding-agent settings.`:void 0,onPick:e=>t({effort:e}),options:e.effortOptions.map(e=>({value:e.value,label:e.label,desc:e.desc}))})}function p_({engine:e,draft:t,update:n,repo:r,hasGit:i,runMode:a,webhook:o,interactiveSkill:s,completionDisabled:c}){let{displayRunner:l}=e;return(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 pointer-hover:bg-muted/50 active:bg-muted/50 focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-foreground [&::-webkit-details-marker]:hidden`,children:[(0,Q.jsx)(pe,{"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:[eh.find(e=>e.id===l)?.label??l,` · `,e.models.find(t=>t.id===e.model)?.label??`auto`]}),(0,Q.jsx)(Ke,{"aria-hidden":`true`,className:`new-task-settings-chevron size-4 shrink-0`})]}),(0,Q.jsxs)(`div`,{className:`new-task-settings-body`,children:[(0,Q.jsx)(`p`,{className:`new-task-settings-description`,children:`Control this run and what happens after Done.`}),(0,Q.jsxs)(`div`,{role:`group`,"aria-label":`Run settings`,className:`new-task-run-settings`,children:[i?(0,Q.jsx)(h_,{on:a.worktree,onChange:e=>n({worktree:e})}):null,(0,Q.jsx)(v_,{repo:r}),(0,Q.jsx)(g_,{on:a.autonomous,disabled:t.planFirst,onChange:e=>n({autonomous:e})}),o.targets.length>0?(0,Q.jsx)(__,{on:o.on,targets:o.targets,onChange:o.onChange}):null,s&&(t.autonomous===null||t.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]}),(0,Q.jsx)(a_,{embedded:!0,archiveWhenDone:t.archiveWhenDone,autoMergePr:t.autoMergePr,onChange:n,disabled:c})]})]})}function m_({showConfigureProviders:e,planFirst:t,planning:n,onModeChange:r}){return(0,Q.jsxs)(Q.Fragment,{children:[e?(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)(b_,{planFirst:t,planning:n,onModeChange:r}),(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:km()})]})}function h_({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:e?`Changes stay in a separate working copy.`:`Changes are made in the current working directory.`})]}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:s(`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:s(`size-[18px] rounded-full`,e?`ml-auto bg-accent-strong-foreground`:`bg-foreground`)})})]})}function g_({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:s(`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:s(`size-[18px] rounded-full`,e?`ml-auto bg-accent-strong-foreground`:`bg-foreground`)})})]})}function __({on:e,targets: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`:`Check to send this task's status changes to`} ${vg(t)} (${t.map(e=>gg(e.url)).join(`, `)})`,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:s(`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:s(`size-[18px] rounded-full`,e?`ml-auto bg-accent-strong-foreground`:`bg-foreground`)})})]})}function v_({repo:e}){return(0,Q.jsxs)(`div`,{"data-slot":`base-branch-row`,className:`new-task-base-branch flex items-center justify-between gap-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(`span`,{children:`Base branch`}),e?(0,Q.jsx)(y_,{repo:e}):null]})}function y_({repo:e}){let t=V(),n=Lr({mutationFn:e=>Ae({baseBranch:e}),onSuccess:e=>{t.invalidateQueries({queryKey:G.repo}),H(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=>H(e.message,{tone:`danger`})});return e.info?(0,Q.jsx)(Oh,{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 b_({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:s(`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)(ze,{"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:s(`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 x_({className:e,type:t,...n}){return(0,Q.jsx)(`input`,{type:t,"data-slot":`input`,className:s(`h-11 w-full min-w-0 rounded-md border border-control-border bg-[var(--task-brand-bg)] px-3 py-1 text-base shadow-none transition-[color,box-shadow] outline-hidden 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 S_({plan:e,starting:t,startAvailable:n,startUnavailableReason:r,startUnavailableAction:i,onStepsChange:a,onStart:o,onDiscard:c}){let[l,u]=(0,Z.useState)(null),[d,f]=(0,Z.useState)(null),p=(0,Z.useRef)(null),m=(0,Z.useId)();(0,Z.useEffect)(()=>{p.current?.focus({preventScroll:!0});let e=p.current?.closest(`[data-slot="main"]`);e&&(e.scrollTop=0)},[]);let h=()=>{u(null),f(null)},g=(t,n)=>{t.preventDefault(),l!==null&&l!==n&&a(Lg(e.steps,l,n)),h()},_=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:p,tabIndex:-1,"aria-labelledby":m,"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(),c())},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:m,"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:c,"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)(tt,{"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:zg(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:_?(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:()=>u(n),onDragOver:e=>{e.preventDefault(),f(n)},onDragLeave:()=>f(e=>e===n?null:e),onDrop:e=>g(e,n),onDragEnd:h,className:s(`flex items-center gap-2.5 rounded-lg border border-border bg-card-2 px-3 py-2.5`,l===n&&`opacity-50`,d===n&&l!==null&&l!==n&&`border-ring`),children:[(0,Q.jsx)(Ht,{"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:Rg(t)})]}),(0,Q.jsxs)(`span`,{"data-slot":`plan-step-actions`,className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(A,{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(Lg(e.steps,n,n-1)),children:`Move up`}),(0,Q.jsx)(A,{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(Lg(e.steps,n,n+1)),children:`Move down`}),(0,Q.jsx)(A,{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(Ig(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)(A,{type:`button`,"data-slot":`plan-start`,disabled:_||t||!n,title:n?void 0:r,"aria-describedby":!n&&r?`plan-start-guidance`:void 0,onClick:o,children:[(0,Q.jsx)(To,{"aria-hidden":`true`,className:`size-3.5`}),t?`Starting…`:`Start`]}),(0,Q.jsx)(C_,{steps:e.steps,disabled:_}),(0,Q.jsx)(A,{type:`button`,variant:`outline`,onClick:c,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 C_({steps:e,disabled:t}){let n=V(),[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 Nn({name:r,steps:e,...t?{overwrite:!0}:{}});H(`Saved — ${a.path.split(`/`).pop()??a.path}`),n.invalidateQueries({queryKey:G.workflows}),c(!1),i(!1),o(``)}catch(e){e instanceof ft&&e.exists===!0?c(!0):H(e instanceof Error?e.message:String(e),{tone:`danger`})}finally{u(!1)}}};return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(A,{type:`button`,variant:`outline`,"data-slot":`plan-save`,disabled:t,onClick:()=>i(!0),children:`Save as chain`}),(0,Q.jsx)(mp,{open:r,onOpenChange:e=>i(!!e),children:(0,Q.jsxs)(_p,{"data-slot":`plan-save-dialog`,className:`sm:max-w-sm`,showCloseButton:!1,children:[(0,Q.jsxs)(vp,{children:[(0,Q.jsx)(xp,{children:`Save as chain`}),(0,Q.jsx)(Sp,{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)(x_,{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)(bp,{className:`mt-4`,children:[(0,Q.jsx)(A,{type:`button`,variant:`outline`,onClick:()=>i(!1),children:`Cancel`}),(0,Q.jsx)(A,{type:`submit`,disabled:a.trim()===``||l,children:l?`Saving…`:`Save chain`})]})]})]})}),(0,Q.jsx)(Ko,{open:s,onOpenChange:e=>e?void 0:c(!1),children:(0,Q.jsxs)(Ro,{"data-slot":`plan-overwrite-dialog`,children:[(0,Q.jsxs)(Go,{children:[(0,Q.jsxs)(No,{children:[`Overwrite “`,a.trim(),`”?`]}),(0,Q.jsx)(Mo,{children:`A chain with this name already exists. Overwriting replaces its steps with this plan.`})]}),(0,Q.jsxs)(Ho,{children:[(0,Q.jsx)(Wo,{children:`Cancel`}),(0,Q.jsx)(Vo,{onClick:()=>void d(!0),children:`Overwrite chain`})]})]})})]})}var w_={start:{note:`Start immediately with the selected configuration.`,pendingLabel:`Starting task…`,failureHint:void 0,clearOnSuccess:!0,sendAriaLabel:`Start task`},plan:{note:`Review the plan before starting the task.`,pendingLabel:`Planning task…`,failureHint:`Could not create the plan. Your draft is kept. Please retry.`,clearOnSuccess:!1,sendAriaLabel:`Plan task`}};function T_(){let[e]=L(),t=(0,Z.useRef)(null),n=(0,Z.useRef)(null),r=(0,Z.useRef)(null),{projectId:i}=gn(),a=be().projectId,[o]=(0,Z.useState)(()=>i_(e)),s=Ji(),c=Rr(),l=Ei(),u=ai(),{draft:d,update:f,submissionPending:p,mounted:m}=Hg(a,o),h=Ug(d.source,c),{source:g,sourcesReady:_,skillList:v}=h,y=Yg(i),b=Wg({uiState:c,source:g,sourcesReady:_,draftText:d.text,submissionPending:p,update:f}),x=Gg(d,l),S=Kg(x.displayRunner,d.agentProfile);qg(x.providersReady);let C=s.data===void 0||s.data.info!==null,w=Jg({hasGit:C,draft:d,selectedSkill:h.selectedSkill,workspaceConfig:u,source:g}),{plan:T,setPlan:E,planning:D,starting:O,submit:k,startPlanned:A}=r_({draft:d,draftProjectId:a,engine:x,agentProfile:S.agentProfile,sourcesReady:_,source:g,runMode:w,notifyOn:y.notifyOn,uiState:c,mounted:m}),j=Qg({deepLink:o,search:e,engine:x,config:l,draftProjectId:a,mounted:m,sourcesReady:_,skillList:v,update:f}),M=Xg(t,j);if(j)return(0,Q.jsx)(o_,{});let{providers:N,providersReady:P}=x,F=d.planFirst?w_.plan:w_.start,I=t_(N);return(0,Q.jsxs)(`div`,{"data-route":`new`,"data-plan-review":T===null?void 0:`true`,className:`relative isolate flex min-h-full flex-col overflow-x-clip pb-16`,children:[(0,Q.jsxs)(`div`,{"data-slot":`new-task-layout`,ref:r,style:T===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.jsx)(s_,{}),d.retiredVariants?(0,Q.jsx)(c_,{onUseOneTask:()=>f({retiredVariants:!1})}):null,(0,Q.jsx)(Wm,{ref:n,onSubmit:k,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:F.note}),(0,Q.jsx)(`kbd`,{className:`hidden font-sans md:inline`,children:km()})]}),pendingLabel:F.pendingLabel,failureHint:F.failureHint,clearOnSuccess:F.clearOnSuccess,onPendingChange:e=>{p.current=e},value:d.text,onValueChange:e=>f({text:e}),autoFocus:!0,placeholder:`Describe a task for the agent — / for skills…`,ariaLabel:`Describe a task for the agent`,sendAriaLabel:F.sendAriaLabel,disabled:!P||O,disabledReason:I,autocompleteSkills:!0,footerStart:(0,Q.jsx)(E_,{projects:y.projectList,urlProjectId:i,templates:b,onInsertTemplate:e=>n.current?.insertAtCaret(e),sources:h,onPickSource:e=>f({source:e})}),agentOptions:(0,Q.jsx)(l_,{groupRef:t,compact:M,engine:x,accounts:S,draftEffort:d.effort,update:f}),executionOptions:(0,Q.jsx)(p_,{engine:x,draft:d,update:f,repo:s.data,hasGit:C,runMode:w,webhook:{targets:y.webhookTargets,on:y.notifyOn,onChange:y.setNotifyChoice},interactiveSkill:h.selectedSkill?.interactive===!0,completionDisabled:O||D}),footerEnd:(0,Q.jsx)(m_,{showConfigureProviders:!P&&!N.isPending,planFirst:d.planFirst,planning:D,onModeChange:e=>f({planFirst:e})})}),(0,Q.jsx)(`p`,{"data-slot":`run-mode-note`,className:`mt-2.5 text-[13px] text-muted-foreground`,children:Cg({worktree:w.worktree,hasGit:C})})]}),T===null?null:(0,Q.jsx)(S_,{plan:T,starting:O,startAvailable:P,startUnavailableReason:I,startUnavailableAction:N.isPending?void 0:(0,Q.jsx)(X,{to:`/settings/agents#providers`,children:`Configure providers`}),onStepsChange:e=>E(t=>t&&{...t,steps:e}),onStart:()=>void A(),onDiscard:()=>{E(null),requestAnimationFrame(()=>r.current?.querySelector(`textarea`)?.focus())}})]})}function E_({projects:e,urlProjectId:t,templates:n,onInsertTemplate:r,sources:i,onPickSource:a}){let o=Za();return(0,Q.jsxs)(Q.Fragment,{children:[e.length>1&&t!==void 0?(0,Q.jsx)(O_,{projects:e,projectId:t,onPick:e=>o(`/p/${encodeURIComponent(e)}/new`,{replace:!0})}):null,(0,Q.jsx)(jh,{label:`Template`,templates:n,onInsert:r}),(0,Q.jsx)(k_,{source:i.source,ready:i.sourcesReady,skills:i.skillList,skillUsage:i.skillUsage,workflows:i.workflowList,onPick:a})]})}function D_(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 O_({projects:e,projectId:t,onPick:n}){let[r,i]=(0,Z.useState)(!1),[a,o]=(0,Z.useState)(``),c=e.find(e=>e.id===t),l=D_(e,a);return(0,Q.jsxs)(Co,{open:r,onOpenChange:e=>{i(e),e||o(``)},children:[(0,Q.jsx)(vo,{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:s(yh,`border-foreground/60 font-semibold text-foreground`),children:[(0,Q.jsx)(Et,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),(0,Q.jsx)(`span`,{className:`max-w-40 truncate`,children:c?.name??t}),bh]})}),(0,Q.jsx)(xo,{align:`start`,sideOffset:8,className:`w-[300px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Q.jsxs)(Cp,{shouldFilter:!1,children:[(0,Q.jsx)(Tp,{placeholder:`search projects…`,value:a,onValueChange:o}),(0,Q.jsxs)(Ep,{"data-slot":`project-menu`,className:`max-h-[min(18rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[l.length===0?(0,Q.jsx)(Dp,{children:`Nothing matches.`}):null,l.map(e=>(0,Q.jsxs)(Ap,{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)(ze,{"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 k_({source:e,ready:t,skills:n,skillUsage:r,workflows:i,onPick:a}){let[o,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(``),[d,f]=(0,Z.useState)(null),p=(0,Z.useRef)(null),{mostUsed:m,project:h,global:g,ranked:_}=Sm(n,l,r),v=i.find(e=>e.name===Qm),y=Cm(i,l).filter(e=>e.name!==Qm),b=i.some(e=>e.name!==Qm),x=vm(`no skill`,`none plain ${Qm} ${v?.description??``}`,l)>0,S=!x&&(_?_.length===0:m.length===0&&h.length===0&&g.length===0)&&y.length===0,C=e=>{a(e),c(!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)(Ap,{value:`skill ${t.name} ${t.path}`,keywords:gm(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:s(`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)(wo,{"aria-hidden":`true`,className:`size-3.5`})}),r?(0,Q.jsx)(ze,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},t.path)},E=e===null||e.source===`skill`?le:Ce,D=(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:s(yh,`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:s(`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`):`…`}),bh]});return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(pg,{skill:d,onClose:()=>f(null)}),(0,Q.jsxs)(Co,{open:o,onOpenChange:e=>{c(e),e||u(``)},children:[(0,Q.jsxs)(`span`,{className:`inline-flex items-center`,children:[(0,Q.jsx)(vo,{asChild:!0,children:D}),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:s(yh,`rounded-l-none border-foreground/60 pl-1.5 pr-2 text-soft-foreground hover:text-foreground`),children:(0,Q.jsx)(tt,{"aria-hidden":`true`,className:`size-3`})}):null]}),(0,Q.jsx)(xo,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Q.jsxs)(Cp,{shouldFilter:!1,children:[(0,Q.jsx)(Tp,{placeholder:`search skills & workflows…`,value:l,onValueChange:u,onInput:()=>p.current?.scrollTo(0,0)}),(0,Q.jsxs)(Ep,{ref:p,"data-slot":`source-menu`,className:`max-h-[min(18rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[S?(0,Q.jsx)(Dp,{children:`Nothing matches.`}):null,x?(0,Q.jsx)(Op,{children:(0,Q.jsxs)(Ap,{value:`none no-skill`,keywords:[`none`,`plain`,...gm(Qm)],"data-slot":`source-option`,"data-source-kind":`none`,onSelect:()=>C(null),children:[(0,Q.jsx)(ne,{"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)(ze,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]})}):null,_?_.length>0?(0,Q.jsx)(Op,{children:_.map(e=>T(e,rm(e)))}):null:(0,Q.jsxs)(Q.Fragment,{children:[m.length>0?(0,Q.jsx)(Op,{heading:`Most used`,children:m.map(e=>T(e,rm(e)))}):null,h.length>0?(0,Q.jsx)(Op,{heading:`Project skills`,children:h.map(e=>T(e,!0))}):null]}),y.length>0?(0,Q.jsx)(Op,{heading:`Workflows`,children:y.map(t=>{let n=e?.source===`workflow`&&e.ref===t.name;return(0,Q.jsxs)(Ap,{value:`workflow ${t.name}`,keywords:gm(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)(ze,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},t.name)})}):null,g.length>0?(0,Q.jsx)(Op,{heading:`Global`,children:g.map(e=>T(e,!1))}):null]})]})})]})]})}function A_(){return(0,Q.jsx)(`div`,{"data-route":`not-found`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(ra,{icon:(0,Q.jsx)(ic,{}),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)(A,{asChild:!0,variant:`outline`,children:(0,Q.jsx)(X,{to:`/`,children:`Back to tasks`})})})})}function j_(){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)(se,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to Git`]})})}function M_(){let{pathname:e,search:t}=de();return(0,Q.jsxs)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:[Ua(e)!==`/git`||new URLSearchParams(t).get(`view`)===`repo`?(0,Q.jsx)(j_,{}):null,(0,Q.jsx)(ra,{icon:(0,Q.jsx)(Ga,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading repository…`,subtitle:`Fetching the repo's git state.`})]})}function N_(){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 P_({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)(ra,{icon:(0,Q.jsx)(gc,{}),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)(Qt,{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 F_(){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 I_({tab:e}){return(0,Q.jsx)(`div`,{"data-route":`task-${e}`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(ra,{icon:(0,Q.jsx)(Ga,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:e===`changes`?`Loading changes…`:`Loading files…`,subtitle:`Fetching the run record.`})})}function L_({tab:e,error:t}){let n=t instanceof ft&&t.status===404;return(0,Q.jsx)(`div`,{"data-route":`task-${e}`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(ra,{icon:n?(0,Q.jsx)(Oo,{}):(0,Q.jsx)(Re,{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)(A,{asChild:!0,variant:`outline`,children:(0,Q.jsx)(X,{to:`/`,children:`Back to tasks`})})})})}var R_={issue:`issue`,pr:`pull request`};function z_({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)(ra,{icon:(0,Q.jsx)(Ga,{className:`motion-safe:animate-spin`}),tone:`neutral`,heading:n,title:`Loading ${R_[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})}function B_(){return(0,Q.jsx)(`div`,{"data-route":`task-thread`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(ra,{icon:(0,Q.jsx)(Ga,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading task…`,subtitle:`Fetching the run and its session transcript.`})})}var V_=class extends Z.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(e,t){console.error(`cezar cockpit: the preview pane crashed`,e,t.componentStack)}render(){return this.state.failed?(0,Q.jsxs)(`div`,{"data-slot":`preview-pane-error`,role:`alert`,className:`flex h-full flex-col items-center justify-center gap-3 p-6 text-center`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-semibold text-foreground`,children:`The preview hit an error`}),(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`The task is unaffected. Close the preview and open it again.`}),(0,Q.jsx)(A,{variant:`outline`,onClick:this.props.onClose,children:`Close preview`})]}):this.props.children}},H_=`(min-width: 1180px)`,U_=`(max-width: 767px)`;function W_(e,t){let[n,r]=(0,Z.useState)(()=>window.matchMedia?.(e).matches??t);return(0,Z.useEffect)(()=>{let t=window.matchMedia?.(e);if(!t)return;let n=()=>r(t.matches);return n(),t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)},[e]),n}var G_=(0,Z.lazy)(()=>ya(()=>import(`./preview-pane-connected-BmVqfSU5.js`).then(e=>({default:e.ConnectedPreviewPane})),__vite__mapDeps([6,5,7,8,9,10,11,12,13,14,15,16,17]))),K_=`cez.preview.pane-width`,q_=58,J_=30,Y_=75,X_=2,Z_=e=>Math.min(Y_,Math.max(J_,Math.round(e)));function Q_(){try{let e=Number(window.localStorage.getItem(K_));return e>0?Z_(e):q_}catch{return q_}}function $_(e){let[t,n]=(0,Z.useState)(void 0);return(0,Z.useEffect)(()=>{let t=e.current?.closest(`[data-slot="main"]`);if(!t)return;let r=()=>n(t.clientHeight||void 0);if(r(),typeof ResizeObserver>`u`)return;let i=new ResizeObserver(r);return i.observe(t),()=>i.disconnect()},[e]),t}function ev({run:e,state:t,children:n}){let r=W_(H_,!0),i=W_(U_,!1),a=(0,Z.useRef)(null),o=$_(a),[s,c]=(0,Z.useState)(Q_);(0,Z.useEffect)(()=>{try{window.localStorage.setItem(K_,String(s))}catch{}},[s]);let l=t.open&&e!==void 0,u=l&&!r,d=u&&!t.session,f=u&&t.session,p=e=>{let t=a.current?.getBoundingClientRect();!t||t.width===0||c(Z_((t.right-e)/t.width*100))},m=e=>{e.currentTarget.setPointerCapture?.(e.pointerId)},h=e=>{e.currentTarget.hasPointerCapture?.(e.pointerId)&&p(e.clientX)},g=e=>{if(e.key===`ArrowLeft`)c(e=>Z_(e+X_));else if(e.key===`ArrowRight`)c(e=>Z_(e-X_));else return;e.preventDefault()},_={"--preview-pane":`${s}%`,...o===void 0?{}:{"--preview-h":`${o}px`}};return(0,Q.jsxs)(`div`,{ref:a,"data-slot":`task-split`,"data-pane":l?`open`:`closed`,"data-takeover":d?``:void 0,className:`preview-split flex min-h-full`,style:_,children:[(0,Q.jsx)(`div`,{"data-slot":`task-main`,hidden:d&&i,"data-collapsed":d&&!i?``:void 0,className:`min-w-0 flex-1`,children:n}),l?(0,Q.jsxs)(Q.Fragment,{children:[r?(0,Q.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize preview`,"aria-valuemin":J_,"aria-valuemax":Y_,"aria-valuenow":s,tabIndex:0,"data-slot":`preview-divider`,className:`preview-divider`,onPointerDown:m,onPointerMove:h,onKeyDown:g}):null,(0,Q.jsx)(`aside`,{"data-slot":`preview-pane`,"data-phone":i?``:void 0,hidden:f,className:`preview-pane`,children:(0,Q.jsx)(V_,{onClose:t.closePane,children:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(`p`,{role:`status`,className:`p-6 text-sm text-muted-foreground`,children:`Opening the preview…`}),children:(0,Q.jsx)(G_,{run:e,servers:e.previewServers??[],request:t.request,onSession:d?t.showSession:void 0,onPort:t.setPort,onLive:t.setLive,onClose:t.closePane})})})})]}):null]})}function tv(e){if(!e.worktreePath||e.worktreeReclaimedAt)return!0;let t=e.delegation?.role===`worker`?e.delegation.destroy:void 0;return t!==void 0&&!t.remaining.includes(`worktree`)}function nv(e){let{state:t,server:n}=e,r=Va(e.stateAt);switch(t){case`registered`:return n.answeredAtRegistration?{tone:`neutral`,ring:!1,pulse:!1,text:`was running when registered`}:{tone:`neutral`,ring:!0,pulse:!1,text:`registered · not started`};case`adopted`:return{tone:`neutral`,ring:!1,pulse:!1,text:`was running when registered`};case`starting`:return{tone:`pending`,ring:!1,pulse:!0,text:`starting`};case`up`:return{tone:`success`,ring:!1,pulse:!1,text:r?`up · ${r}`:`up`};case`stalled`:return{tone:`pending`,ring:!1,pulse:!1,text:`stalled · port silent 2 min`};case`exited`:return{tone:`danger`,ring:!1,pulse:!1,text:e.exitCode===void 0?`exited`:`exited · code ${e.exitCode}`};case`stopped`:return{tone:`neutral`,ring:!0,pulse:!1,text:e.reason===`idle`?`stopped after 15 min idle`:`stopped`};case`unavailable`:return{tone:`neutral`,ring:!0,pulse:!1,text:`unavailable`}}}function rv(e){return{kind:`preview-server`,id:`preview-server:${e.port}`,server:e,state:`registered`,stateAt:e.registeredAt}}function iv(e,t){return t?.get(e.port)??rv(e)}function av(e){return e.state===`registered`?e.server.answeredAtRegistration:e.state===`up`||e.state===`starting`||e.state===`adopted`}function ov(e){return e.split(` -- `)[0].trim()}var sv=(0,Z.createContext)(null);function cv(){return(0,Z.useContext)(sv)}function lv(e){let[t,n]=(0,Z.useState)(!1),[r,i]=(0,Z.useState)(!1),[a,o]=(0,Z.useState)(void 0),[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(void 0),[d,f]=(0,Z.useState)(e);d!==e&&(f(e),n(!1),i(!1),o(void 0),c(!1),u(void 0));let p=(0,Z.useCallback)(e=>{u({...e}),e.port===void 0?e.agent&&o(void 0):o(e.port),c(!1),n(!0)},[]),m=(0,Z.useCallback)(()=>{n(!1),i(!1),c(!1),o(void 0)},[]),h=(0,Z.useCallback)(()=>c(!0),[]);return(0,Z.useMemo)(()=>({open:t,live:r,port:a,request:l,session:s,openPane:p,closePane:m,showSession:h,setLive:i,setPort:o}),[t,r,a,l,s,p,m,h])}function uv(e,t={}){let[n,r]=(0,Z.useState)([]),{cursor:i,afterSeq:a=0,maxEvents:o,compactAt:s,onCompact:l,onReset:u}=t;return(0,Z.useEffect)(()=>{if(r([]),!e)return;let t=a,n=!1,d=!1,f=c(),p=[],m,h,g=()=>{if(m!==void 0&&globalThis.cancelAnimationFrame?.(m),clearTimeout(h),m=void 0,h=void 0,n||p.length===0)return;let e=p;p=[],r(t=>{let r=[...t,...e];return!d&&s!==void 0&&r.length>=s&&(d=!0,queueMicrotask(()=>{n||l?.()})),o===void 0||r.length<=o?r:r.slice(-o)})},_=()=>{h===void 0&&(h=setTimeout(g,50),typeof globalThis.requestAnimationFrame==`function`&&(m=globalThis.requestAnimationFrame(g)))},v=Zn({kind:`run`,projectId:f,runId:e,afterSeq:a,...i?{cursor:i}:{}},{frame:e=>{!(`type`in e)||e.type!==`event`||e.event.seq<=t||(t=e.event.seq,p.push(e.event),_())},reset:async(e,n)=>{g();let r=await u?.(e,n);return r&&(t=Math.max(t,r.afterSeq)),r}});return()=>{n=!0,m!==void 0&&globalThis.cancelAnimationFrame?.(m),clearTimeout(h),v()}},[e,i,a,o,s,l,u]),n}var dv=5,fv=200,pv=5e3;function mv(...e){let t=new Map;for(let n of e)for(let e of n)t.set(e.seq,e);return[...t.values()].sort((e,t)=>e.seq-t.seq)}function hv(e,t,n){e.setQueryData(t,e=>{if(!e)return{pages:[n],pageParams:[void 0]};let t=[...e.pages],r=[...e.pageParams],i=-1;for(let e=0;e<t.length;e+=1)(i===-1||t[e].asOfSeq>t[i].asOfSeq)&&(i=e);if(i>=0&&t[i].asOfSeq>n.asOfSeq)return e;for(i>=0&&t[i].newerCursor===void 0?(t[i]=n,r[i]=void 0):(t.push(n),r.push(void 0));t.length>dv;)t.shift(),r.shift();return{pages:t,pageParams:r}})}function gv(e){let t=c(),n=V(),r=[`run-history`,t,e],i=[`run-history-context`,t,e],a=pn({queryKey:r,enabled:e!==void 0,initialPageParam:void 0,queryFn:({pageParam:t,signal:n})=>sn(e,t,{signal:n}),getPreviousPageParam:e=>e.olderCursor,getNextPageParam:e=>e.newerCursor,maxPages:dv,staleTime:1/0,retry:1}),o=Fe({queryKey:i,enabled:e!==void 0,queryFn:({signal:t})=>en(e,{signal:t}),retry:1}),s=(0,Z.useCallback)(async(r,i)=>{if(e===void 0)return;let[a,o]=await Promise.all([sn(e,void 0,{signal:i}),en(e,{signal:i})]);return i.throwIfAborted(),hv(n,[`run-history`,t,e],a),n.setQueryData([`run-history-context`,t,e],o),{cursor:a.liveCursor,afterSeq:a.asOfSeq}},[n,e,t]),l=a.isError||o.isError,u=uv(l?e:void 0,{onReset:s}),d=a.data?.pages??[],f=d.reduce((e,t)=>t.newerCursor===void 0?t:e??t,void 0),p=(0,Z.useRef)(!1),m=(0,Z.useCallback)(()=>{e===void 0||p.current||(p.current=!0,sn(e,void 0).then(r=>hv(n,[`run-history`,t,e],r)).catch(()=>{}).finally(()=>{p.current=!1}))},[n,e,t]),h=e=>e!==void 0&&n.getQueryData([`run-history`,t,e])!==void 0,[g,_]=(0,Z.useState)(()=>({runId:e,pending:h(e)})),v=g.pending;g.runId!==e&&(v=h(e),_({runId:e,pending:v})),(0,Z.useEffect)(()=>{if(!v||e===void 0)return;let r=!1,i=new AbortController;return sn(e,void 0,{signal:i.signal}).then(r=>hv(n,[`run-history`,t,e],r)).catch(()=>{}).finally(()=>{r||_({runId:e,pending:!1})}),()=>{r=!0,i.abort()}},[n,v,e,t]);let y=uv(!l&&f&&!v?e:void 0,{cursor:f?.liveCursor,afterSeq:f?.asOfSeq,maxEvents:pv,compactAt:fv,onCompact:m,onReset:s}),b=(0,Z.useRef)(0);b.current=y.length,(0,Z.useEffect)(()=>()=>{b.current>0&&m()},[m]);let x=(0,Z.useMemo)(()=>mv(...d.map(e=>e.events)),[d]),S=(0,Z.useMemo)(()=>l?u:mv(x,y),[l,u,x,y]),C=(0,Z.useMemo)(()=>{if(l)return u;let e=o.data?.contextEvents??[],t=o.data?.asOfSeq??0;return mv(e,S.filter(({seq:e})=>e>t))},[o.data,l,u,S]),w=(0,Z.useCallback)(async()=>{await a.fetchPreviousPage()},[a.fetchPreviousPage]),T=(0,Z.useCallback)(async()=>{l||await n.resetQueries({queryKey:r,exact:!0})},[l,r,n]);return{visibleEvents:S,currentEvents:C,isPending:!l&&a.isPending,contextPending:!l&&o.isPending,fallback:l,hasOlder:!l&&!!a.hasPreviousPage,isFetchingOlder:a.isFetchingPreviousPage,olderError:a.isFetchPreviousPageError?a.error instanceof Error?a.error.message:`Could not load earlier items`:void 0,loadOlder:w,jumpToLatest:T,retainedPages:d.length}}function _v(e){for(let t=e.length-1;t>=0;--t){let n=Ot.safeParse(e[t]);if(n.success)return n.data.state===`connected`}return!1}function vv(e){let{currentEvents:t}=gv(e);return(0,Z.useMemo)(()=>_v(t),[t])}function yv(){let{id:e}=gn(),t=da(e),n=kr().data?.capabilities?.preview===!0,r=lv(e);return n?(0,Q.jsx)(bv,{id:e,run:t.data,pane:r,children:(0,Q.jsx)(pr,{})}):(0,Q.jsx)(pr,{})}function bv({id:e,run:t,pane:n,children:r}){let i=t?tv(t):!1,a=vv(e),o=(0,Z.useMemo)(()=>({...n,worktreeRemoved:i,agentLive:a}),[n,i,a]);return(0,Q.jsx)(sv.Provider,{value:o,children:(0,Q.jsx)(ev,{run:t,state:n,children:r})})}function xv(){let e=Ei();return e.isPending?(0,Q.jsx)(`p`,{role:`status`,children:`Loading task settings…`}):e.isError?(0,Q.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Task settings did not load: `,e.error.message]}):(0,Q.jsx)(Cv,{config:e.data,scope:`project`})}function Sv(){let e=ai();return e.isPending?(0,Q.jsx)(`p`,{role:`status`,className:`p-4 text-sm`,children:`Loading task settings…`}):e.isError?(0,Q.jsxs)(`p`,{role:`alert`,className:`p-4 text-sm text-danger`,children:[`Task settings did not load: `,e.error.message]}):(0,Q.jsx)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col gap-4 p-4 md:p-6`,children:(0,Q.jsx)(Cv,{config:e.data,scope:`global`})})}function Cv({config:e,scope:t}){let n=(0,Z.useId)(),r=V(),i=Lr({mutationFn:async({archiveOnMerge:e,projectKey:n})=>t===`project`?Ae({archiveOnMerge:e},n[0]):De({archiveOnMerge:e}),onSuccess:(e,{projectKey:n})=>{t===`project`?r.setQueryData(n,e):(r.setQueryData(W.config,e),r.invalidateQueries({predicate:e=>e.queryKey.at(-1)===`config`&&e.queryKey!==W.config}))}});return(0,Q.jsxs)(`section`,{"data-slot":`archive-on-merge-field`,className:`flex min-w-0 flex-col gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`label`,{htmlFor:n,className:`text-sm font-semibold text-foreground`,children:`Archive tasks after PRs merge`}),(0,Q.jsx)(`p`,{id:`${n}-hint`,className:`text-[13px] text-muted-foreground`,children:`Automatically archive a settled task and its workers once all their associated pull requests merge. History stays available in Archived.`})]}),(0,Q.jsxs)(`select`,{id:n,"aria-describedby":`${n}-hint ${n}-effective`,className:`min-h-11 w-full rounded-md border border-input bg-background px-3 py-2 text-sm focus-visible:outline-2 focus-visible:outline-ring active:bg-muted disabled:opacity-50`,value:e.archiveOnMerge===null?`inherit`:e.archiveOnMerge?`enabled`:`disabled`,disabled:i.isPending,onChange:e=>i.mutate({archiveOnMerge:e.target.value===`inherit`?null:e.target.value===`enabled`,projectKey:G.config}),children:[(0,Q.jsx)(`option`,{value:`inherit`,children:t===`project`?`Inherit global setting`:`Use default`}),(0,Q.jsx)(`option`,{value:`enabled`,children:`Enabled`}),(0,Q.jsx)(`option`,{value:`disabled`,children:`Disabled`})]}),(0,Q.jsxs)(`p`,{id:`${n}-effective`,className:`text-[13px] text-muted-foreground`,children:[`Currently `,e.effectiveArchiveOnMerge?`enabled`:`disabled`,` · `,e.archiveOnMergeSource,` setting.`]}),(0,Q.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Unarchive restores the task. It stays visible until a later associated PR merges.`}),i.isPending?(0,Q.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`Saving…`}):null,i.isError?(0,Q.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Could not save: `,i.error.message]}):null]})}var wv=M(`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 Tv({className:e,variant:t=`default`,asChild:n=!1,...r}){return(0,Q.jsx)(n?P:`span`,{"data-slot":`badge`,"data-variant":t,className:s(wv({variant:t}),e),...r})}function Ev({className:e,orientation:t=`horizontal`,...n}){return(0,Q.jsx)(Dd,{"data-slot":`tabs`,"data-orientation":t,orientation:t,className:s(`group/tabs flex gap-2 data-[orientation=horizontal]:flex-col`,e),...n})}var Dv=M(`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 Ov({className:e,variant:t=`default`,...n}){return(0,Q.jsx)(Od,{"data-slot":`tabs-list`,"data-variant":t,className:s(Dv({variant:t}),e),...n})}function kv({className:e,...t}){return(0,Q.jsx)(kd,{"data-slot":`tabs-trigger`,className:s(`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-[color,background-color,border-color,box-shadow] group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start pointer-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:inset-be-[-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 Av({className:e,...t}){return(0,Q.jsx)(Ad,{"data-slot":`tabs-content`,className:s(`flex-1 outline-hidden`,e),...t})}var jv={folder:_c,terminal:Uc,vscode:nc,cursor:jc,zed:qc,windsurf:Gc,sublime:fc,idea:cc,pycharm:Cc,webstorm:bc,goland:Bc,rubymine:vc,phpstorm:Ks,clion:sc,rider:Gs,"android-studio":Vc,xcode:Sc,warp:Lc,claude:Ba,codex:Hc,opencode:Ba,pi:Ba,omp:Ba};function Mv(e){return e.icon&&jv[e.icon]||So}function Nv(e){let t=/^cli:(claude|codex|opencode|pi|cursor|omp)$/.exec(e);return t?t[1]:void 0}function Pv({choices:e,onPick:t,label:n=`Open in…`,title:r,triggerVariant:i=`ghost`,disabled:a=!1,leading:o,trailing:s,slot:c,className:l}){return(0,Q.jsxs)(Kn,{children:[(0,Q.jsx)(Mn,{asChild:!0,children:(0,Q.jsxs)(A,{variant:i,size:`sm`,title:r,disabled:a,"data-slot":c,className:l,children:[(0,Q.jsx)(So,{"aria-hidden":`true`}),n]})}),(0,Q.jsxs)(Rn,{align:`end`,children:[o,o&&e.length>0?(0,Q.jsx)(yn,{}):null,e.map(({target:e,suffix:n,title:r})=>{let i=Mv(e);return(0,Q.jsxs)(cn,{"data-target":e.id,title:r,onSelect:()=>t(e.id),children:[(0,Q.jsx)(i,{"aria-hidden":`true`}),e.label,n??``]},e.id)}),s]})]})}function Fv(e){return eh.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 Iv=e=>e.length>eh.length;function Lv({rows:e,runner:t,accountFor:n,providerStatus:r,disabled:i=!1,accountDisabled:a=!1,onPick:o}){let c=Iv(e);return(0,Q.jsx)(`div`,{role:`radiogroup`,"aria-label":`Default runner`,"data-slot":`agents-runner`,className:s(`gap-0.5 rounded-md border border-border bg-card p-0.5`,c?`flex max-w-md flex-col`:`inline-flex w-fit`),children:e.map(l=>{let u=Pt(r.data,l.runner.id),d=!r.isPending&&!r.isError&&u?.enabled===!0&&u.status===`connected`,f=r.isPending?`Checking provider authentication…`:r.isError?`Provider authentication could not be verified.`:u?.enabled===!1?`This provider is disabled. Enable it above or choose another provider.`:d?void 0:`Connect this provider before selecting it.`,p=e.filter(e=>e.runner.id===l.runner.id).length>1,m=l.runner.id===t&&l.account===n(l.runner.id);return(0,Q.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":m,"data-value":l.runner.id,"data-account":l.account??``,title:f??l.desc,disabled:i||!d||p&&a,onClick:()=>o(l.runner.id,l.account,p),className:s(`rounded-sm px-3 py-1.5 text-left font-mono text-[13px] font-medium transition-colors disabled:opacity-50`,m?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:[l.label,c?(0,Q.jsx)(`span`,{"data-slot":l.missing?`agents-account-missing`:`agents-account-dir`,"data-runner":l.runner.id,className:`ml-2 font-sans text-[11px] text-soft-foreground`,children:l.desc}):null]},`${l.runner.id}:${l.account??``}`)})})}function Rv({path:e,selected:t,onSelect:n,onEnter:r,decorate:i,emptyHint:a,showHidden:o=!1}){let c=ni(e,o),l=c.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:c.data?.path??void 0,children:c.data?.path??(c.isError?``:`Loading…`)}),c.isError?(0,Q.jsx)(`p`,{"data-slot":`fs-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:c.error instanceof Error?c.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:[l===null?null:(0,Q.jsx)(`li`,{className:`flex`,children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`fs-up`,onClick:()=>r(l),className:`flex flex-1 items-center gap-2 px-3 py-2 text-left text-[13px] hover:bg-muted`,children:[(0,Q.jsx)(oc,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),`Up one level`]})}),(c.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:s(`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)(_c,{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)(Qs,{className:`size-3.5`,"aria-hidden":`true`})})]},e.path)),c.data&&c.data.dirs.length===0?(0,Q.jsx)(`li`,{className:`px-3 py-2 text-[13px] text-muted-foreground`,children:a}):null]}),c.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 zv(e,t,n=!1){let r=ni(e,n);return t?.path??r.data?.path??null}var Bv={claude:`~/.claude-second`,codex:`~/.codex-second`,pi:`~/.pi-second/agent`,omp:`~/.omp/profiles/second`};function Vv({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=ha(),_=f.trim();return(0,Q.jsx)(mp,{open:e,onOpenChange:t,children:(0,Q.jsxs)(_p,{"data-slot":`add-account-dialog`,className:`sm:max-w-lg`,children:[(0,Q.jsxs)(vp,{children:[(0,Q.jsx)(xp,{children:`Add agent account`}),(0,Q.jsx)(Sp,{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:Bv[c]??`~/.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)(A,{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.`]}),c===`omp`?(0,Q.jsxs)(`p`,{"data-slot":`add-account-omp-hint`,className:`text-[11px] text-soft-foreground`,children:[`An omp account is an omp profile: use `,(0,Q.jsx)(`code`,{children:`~/.omp/profiles/<name>`}),`, with a lowercase name. The profile folder may link to a folder elsewhere.`]}):null]}),m?(0,Q.jsx)(Rv,{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)(bp,{className:`min-w-0 sm:items-center sm:justify-end`,children:[(0,Q.jsx)(A,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,Q.jsx)(A,{"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),H(`Account added — use Connect to sign in`)}})},children:g.isPending?`Adding…`:`Add account`})]})]})})}function Hv(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)(te,{"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)(Ke,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`})]}),(0,Q.jsx)(Lv,{...e,onPick:(...n)=>{e.onPick(...n),t.current&&(t.current.open=!1)}})]})}var Uv={claude:`Claude Code`,codex:`Codex`,opencode:`OpenCode`,pi:`pi`,cursor:`Cursor`,omp:`OMP`},Wv={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`,omp:`https://omp.sh`},Gv={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 Kv(){let e=oa();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)(ra,{icon:(0,Q.jsx)(wc,{}),tone:`danger`,title:`Agent accounts did not load`,subtitle:e.error.message,heading:`h2`}):(0,Q.jsx)(qv,{data:e.data})}function qv({data:e}){let t=kr(),[n,r]=(0,Z.useState)(null),[i,a]=(0,Z.useState)(null),o=Ri(),s=[`claude`,`codex`,`opencode`,`pi`,`cursor`,`omp`];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)(Ev,{defaultValue:`claude`,children:[(0,Q.jsx)(Ov,{variant:`line`,"data-slot":`accounts-tabs`,children:s.map(e=>(0,Q.jsx)(kv,{value:e,"data-provider":e,children:Uv[e]},e))}),s.map(n=>(0,Q.jsx)(Av,{value:n,className:`pt-4`,children:(0,Q.jsx)(Jv,{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)(Yv,{profiles:e}),n===null?null:(0,Q.jsx)(Vv,{open:!0,onOpenChange:e=>!e&&r(null),providers:e.profileCapableProviders,initialProvider:n},n),(0,Q.jsx)(Ko,{open:i!==null,onOpenChange:e=>!e&&a(null),children:(0,Q.jsxs)(Ro,{"data-slot":`accounts-remove-confirm`,children:[(0,Q.jsxs)(Go,{children:[(0,Q.jsxs)(No,{children:[`Remove “`,i?.label,`”?`]}),(0,Q.jsxs)(Mo,{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)(Ho,{children:[(0,Q.jsx)(Wo,{children:`Cancel`}),(0,Q.jsx)(Vo,{"data-action":`accounts-remove-confirm`,disabled:o.isPending,onClick:()=>{let e=i;e&&o.mutate(e.id,{onSuccess:()=>{a(null),H(`Removed ${e.label}`)},onError:e=>H(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 Jv({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:Uv[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:Wv[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)(Xv,{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)(A,{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:[Uv[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 Yv({profiles:e}){let[t,n]=(0,Z.useState)(null),r=V(),i=ai(),a=Wi(),o=Or(),s=Ni(),c=Lr({mutationFn:e=>De(e),onSuccess:e=>r.setQueryData(W.config,e),onError:e=>H(e.message,{tone:`danger`})});if(i.data===void 0)return null;let l=Fv(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)(Hv,{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=>H(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:eh.map(e=>(0,Q.jsx)(`option`,{value:e.id,children:Uv[e.id]},e.id))})]}),eh.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)(vt,{className:`size-4 text-accent-icon shrink-0`}),(0,Q.jsx)(`span`,{className:`w-24 shrink-0 text-xs text-muted-foreground`,children:Uv[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:[sh(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)),lh(e.id,o[e.id].data,o[e.id].isError,o[e.id].isFetching)?(0,Q.jsx)(`option`,{disabled:!0,children:lh(e.id,o[e.id].data,o[e.id].isError,o[e.id].isFetching)}):null]})]},e.id))]})]})}function Xv({account:e,isMachineDefault:t,onRemove:n}){let[r,i]=(0,Z.useState)(!1),a=Xm(e),o=fi(),s=ji(),c=ea(a,e.status===void 0),l=e.status??c.data?.status,u=l?Gv[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)(Tv,{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)(eo,{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 `,Uv[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)(A,{type:`button`,size:`sm`,"data-action":`account-connect`,disabled:o.isPending,onClick:()=>o.mutate({provider:e.provider,...e.isDefault?{}:{profileId:e.id}},{onSuccess:e=>H(e.opened?`Finish signing in in the terminal, then Check again.`:`This account is already connected.`),onError:e=>H(e instanceof ft&&e.command?`${e.message} — run: ${e.command}`:e.message,{tone:`danger`})}),children:`Connect`}),(0,Q.jsx)(A,{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=>H(e.message,{tone:`danger`})}),children:`Check again`}),(0,Q.jsx)(Qv,{account:e,onRemove:n}),(0,Q.jsx)(A,{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)(Zv,{account:e,routeId:a}):null]})}function Zv({account:e,routeId:t}){let n=Gi(t,!0),r=Pr(),i=ii().data?.targets??[],a=i.filter(e=>Nv(e.id)===void 0&&e.id!==`terminal`&&e.id!==`finder`).map(e=>({target:e})),o=i.filter(e=>Nv(e.id)===void 0).map(e=>({target:e})),s=(e,n,i)=>r.mutate({routeId:t,file:e,...i?{target:i}:{}},{onError:e=>H(e.message,{tone:`danger`}),onSuccess:()=>H(`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)(Pv,{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)(cn,{"data-target":`system`,onSelect:()=>s(e.id,e.label),children:[(0,Q.jsx)(So,{"aria-hidden":`true`}),`System default`]})},e.id)),(0,Q.jsx)(Pv,{slot:`account-open-folder`,label:`Folder`,disabled:r.isPending,title:e.path,choices:o,onPick:e=>s(`folder`,`folder`,e),leading:(0,Q.jsxs)(cn,{"data-target":`system`,onSelect:()=>s(`folder`,`folder`),children:[(0,Q.jsx)(So,{"aria-hidden":`true`}),`System default`]})})]})]})}function Qv({account:e,onRemove:t}){let[n,r]=(0,Z.useState)(!1),[i,a]=(0,Z.useState)(e.label),o=Wr();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)(A,{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=>H(e.message,{tone:`danger`})}),children:`Save`}),(0,Q.jsx)(A,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{a(e.label),r(!1)},children:`Cancel`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(A,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-rename`,onClick:()=>r(!0),children:`Rename`}),(0,Q.jsx)(A,{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 $v=1500;function ey(e,t){let n=(0,Z.useMemo)(()=>e.split(`
23
+ `).map(e=>[{content:e}]),[e]),r=(0,Z.useMemo)(()=>Lh(t),[t]),i=n.length>$v,[a,o]=(0,Z.useState)(null);return(0,Z.useEffect)(()=>{if(r===null||i)return;let t=!1;return Yh(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:Jh(e,r)?.tokens??n}var ty=`code-editor-surface m-0 min-h-full w-full whitespace-pre font-mono text-xs leading-[1.7] px-3 py-2 [tab-size:2]`;function ny({value:e,onChange:t,language:n,readOnly:r,className:i,...a}){let o=ey(e,n),c=(0,Z.useRef)(null),l=(0,Z.useRef)(null),u=()=>{let e=l.current,t=c.current;!e||!t||(t.scrollTop=e.scrollTop,t.scrollLeft=e.scrollLeft)};return(0,Z.useLayoutEffect)(u,[e]),(0,Q.jsxs)(`div`,{"data-slot":`code-editor`,className:s(`relative overflow-hidden rounded-md border border-input bg-card`,i),children:[(0,Q.jsx)(`pre`,{ref:c,"aria-hidden":`true`,className:s(ty,`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?`
24
+ `:(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)),`
25
+ `]})},t))}),(0,Q.jsx)(`textarea`,{ref:l,"data-slot":`code-editor-input`,value:e,readOnly:r,onChange:e=>t?.(e.target.value),onScroll:u,spellCheck:!1,autoCorrect:`off`,autoCapitalize:`off`,autoComplete:`off`,wrap:`off`,className:s(ty,`relative block resize-none overflow-auto bg-transparent text-transparent caret-foreground outline-hidden`,`selection:bg-accent-strong/30 focus-visible:ring-0`,r&&`cursor-default`),...a})]})}var ry=`An editor-plus-commit: a saved change reaches a run after you commit it to the base branch.`;function iy(e){return t=>t.runners.includes(e)}function ay(e,t,n,r,i){let a=iy(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 oy=[{id:`claude`,label:`Claude`,groups:[ay(`claude`,`settings`,`Settings`),ay(`claude`,`mcp`,`MCP`,`A dedicated .mcp.json (key: mcpServers), shared via version control.`),ay(`claude`,`memory`,`Memory & instructions`)]},{id:`codex`,label:`Codex`,note:ry,groups:[ay(`codex`,`settings`,`Settings`),ay(`codex`,`mcp`,`MCP`,`Inside config.toml under [mcp_servers.<id>] — the same file as Codex’s settings.`),ay(`codex`,`memory`,`Memory & instructions`)]},{id:`opencode`,label:`OpenCode`,note:ry,groups:[ay(`opencode`,`settings`,`Settings`),ay(`opencode`,`mcp`,`MCP`,`Under the "mcp" key in opencode.json — the same file as OpenCode’s settings.`),ay(`opencode`,`memory`,`Memory & instructions`)]},{id:`pi`,label:`Pi`,note:ry,groups:[ay(`pi`,`settings`,`Settings`),ay(`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.`),ay(`pi`,`memory`,`Memory & instructions`)]},{id:`cursor`,label:`Cursor`,note:ry,groups:[ay(`cursor`,`settings`,`Settings`),ay(`cursor`,`mcp`,`MCP`,`Cursor CLI uses the editor’s MCP configuration.`),ay(`cursor`,`memory`,`Memory & instructions`,`Cursor also reads CLAUDE.md and .cursor/rules.`)]},{id:`omp`,label:`OMP`,note:ry,groups:[ay(`omp`,`settings`,`Settings`),ay(`omp`,`mcp`,`MCP`,`A dedicated mcp.json (key: mcpServers) at ~/.omp/agent and in the project’s .omp/ folder.`),ay(`omp`,`memory`,`Memory & instructions`)]}];function sy(e){let t=oy.find(t=>t.id===e);if(!t)throw Error(`no agent descriptor for ${e}`);return t}function cy(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 ly(){let e=yi(),t=kr(),n=(0,Z.useMemo)(()=>t.data?uh(t.data.checks):oy.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)(ra,{icon:(0,Q.jsx)(pc,{}),tone:`danger`,title:`Agent config did not load`,subtitle:e.error.message,heading:`h2`}):(0,Q.jsx)(uy,{listing:e.data,installed:n})}function uy({listing:e,installed:t}){let[n,r]=(0,Z.useState)(`claude`),[i,a]=(0,Z.useState)(null),o=sy(n),c=e.files.find(e=>e.id===i)??null,l=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:oy.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:()=>l(e.id),className:s(`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)(Tv,{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)(dy,{agent:o,listing:e,selectedId:i,onSelect:a})}),(0,Q.jsx)(`div`,{"data-slot":`agent-config-editor-pane`,className:`min-w-0`,children:c?(0,Q.jsx)(py,{file:c},c.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 dy({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:s(`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)(Tv,{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)(fy,{userMcp:t.userMcp})]},i.id)})})}function fy({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)(Tv,{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 py({file:e}){let t=Ii(e.id),n=$i(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)(Tv,{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)(ny,{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)(A,{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)(A,{size:`sm`,onClick:()=>{c(null),o(!1),n.mutate({content:u,version:l},{onSuccess:()=>{i(null),H(`${e.exists?`Saved`:`Created`} ${e.label}`)},onError:e=>{e instanceof ft&&e.status===409?o(!0):e instanceof ft&&e.status===400?c(e.message):H(e.message,{tone:`danger`})}})},disabled:!d||n.isPending,children:e.exists?`Save file`:`Create file`}),(0,Q.jsx)(A,{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:[cy(e),e.hotReload?` ${e.hotReload}`:``]}),e.readOnlyReason&&(0,Q.jsx)(`p`,{children:e.readOnlyReason})]})]})}function my({className:e,...t}){return(0,Q.jsx)(`textarea`,{"data-slot":`textarea`,className:s(`flex field-sizing-content min-h-16 max-h-[min(24rem,60dvh)] overflow-y-auto w-full resize-none rounded-md border border-input bg-[var(--task-brand-bg)] px-3 py-2 text-base shadow-none transition-[color,box-shadow] outline-hidden placeholder:text-soft-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm`,e),...t})}var hy=[{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`},{id:`omp`,label:`OMP`,login:`omp login`}],gy=e=>({claude:e,codex:e,opencode:e,pi:e,cursor:e,omp:e}),_y={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 vy(e,t,n){return{providers:e.providers.map(e=>e.provider===t?{...e,enabled:n}:e)}}function yy(){let e=Wi(),t=na(),n=mi(),r=V(),[i,a]=(0,Z.useState)(null),o=(0,Z.useRef)(Promise.resolve()),s=(0,Z.useRef)(gy(0)),c=(0,Z.useRef)(gy(0)),l=(0,Z.useRef)(e.data);(0,Z.useEffect)(()=>{i&&Pt(e.data,i.provider)?.status===`connected`&&a(null)},[i,e.data]),(0,Z.useEffect)(()=>{if(e.data){if(Object.values(c.current).every(e=>e===0)||!l.current){l.current=e.data;return}l.current={providers:e.data.providers.map(e=>({...e,enabled:c.current[e.provider]>0?Pt(l.current,e.provider)?.enabled??e.enabled:e.enabled}))}}},[e.data]);let u=(0,Z.useCallback)((e,t)=>{let n=W.providerStatus,i=r.getQueryData(n);if(!i)return;l.current||=i;let a=vy(i,e,t);c.current[e]+=1,r.setQueryData(n,a);let u=++s.current[e];o.current=o.current.then(async()=>{try{let i=await $t(e,t),a=Pt(i,e)?.enabled;if(a===void 0)return;if(l.current=vy(l.current??i,e,a),u===s.current[e]){let t=r.getQueryData(n);r.setQueryData(n,t?vy(t,e,a):i)}}catch(t){if(u===s.current[e]){let i=Pt(l.current,e)?.enabled,a=r.getQueryData(n);a&&i!==void 0?r.setQueryData(n,vy(a,e,i)):l.current?r.setQueryData(n,l.current):r.removeQueries({queryKey:n,exact:!0}),H(t instanceof Error?t.message:String(t),{tone:`danger`})}}finally{--c.current[e]}})},[r]),d=Lr({mutationFn:e=>Bn(e),onSuccess:async(e,t)=>{a(null),H(e.opened?`Finish signing in in the terminal, then check again.`:`Provider is already connected.`),await r.invalidateQueries({queryKey:W.providerStatus}),Da(t)&&await Zi(r,t,`none`)},onError:(e,t)=>{if(e instanceof ft&&e.command){let n=hy.find(e=>e.id===t)?.label??t;a({provider:t,label:n,message:e.message,command:e.command});return}H(e.message,{tone:`danger`})}}),f=async e=>{try{await navigator.clipboard.writeText(e),H(`Command copied`)}catch{H(`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)(A,{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:hy.map(r=>{let a=Pt(e.data,r.id),o=a?.status,s=o?_y[o]:e.isPending?{label:`Checking…`,tone:`neutral`}:_y.unknown,c=d.isPending&&d.variables===r.id,l=o===`disconnected`||o===`unknown`,p=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)(eo,{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)(Mh,{checked:a?.enabled??!0,"aria-label":`Use ${r.label}`,onCheckedChange:e=>u(r.id,e)}),l?(0,Q.jsx)(A,{type:`button`,variant:`ghost`,size:`sm`,disabled:t.isPending,onClick:()=>t.mutate(void 0,{onError:e=>H(e.message,{tone:`danger`})}),children:`Check again`}):null,o===`disconnected`?(0,Q.jsx)(A,{type:`button`,variant:`outline`,size:`sm`,disabled:d.isPending,onClick:()=>d.mutate(r.id),children:c?`Opening…`:`Connect`}):null,p===void 0?null:(0,Q.jsx)(A,{type:`button`,variant:`outline`,size:`sm`,disabled:n.isPending,onClick:()=>n.mutate({provider:r.id,authFailureId:p},{onSuccess:()=>H(`${r.label} can be tried again.`),onError:e=>H(e.message,{tone:`danger`})}),children:`Try again`})]})]}),p===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)(A,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void f(i.command),children:`Copy command`})]})]}):null]},r.id)})})]})}var by=2e4;function xy(){let e=Ei(),t=Or(),n=Wi();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)(ra,{icon:(0,Q.jsx)(Pe,{}),tone:`danger`,title:`Agent settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,Q.jsx)(Sy,{config:e.data,catalogs:t,providerStatus:n})}function Sy({config:e,catalogs:t,providerStatus:n}){let r=Ji(),i=V(),a=Lr({mutationFn:e=>Ae(e),onSuccess:e=>{i.setQueryData(G.config,e),i.invalidateQueries({queryKey:G.health}),i.invalidateQueries({queryKey:G.repo})},onError:e=>H(e.message,{tone:`danger`})}),[o,s]=(0,Z.useState)(e.systemPrompt??``),c=o.trim(),l=c===(e.systemPrompt??``),u=c.length>by;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)(Cy,{defaultRunner:e.defaultRunner,providerStatus:n,saving:a.isPending,onPick:e=>a.mutate({defaultRunner:e})}),(0,Q.jsx)(wy,{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:eh.map(r=>{let i=Pt(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=lh(r.id,c.data,c.isError,c.isFetching),u=sh(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)(wy,{title:`System prompt`,hint:`Extra instructions for every run in this project.`,children:[(0,Q.jsx)(my,{"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)(A,{type:`button`,variant:`primary`,size:`sm`,"data-action":`agents-save-prompt`,disabled:l||u||a.isPending,onClick:()=>a.mutate({systemPrompt:c===``?null:c},{onSuccess:()=>H(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`,` `,by.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)(Ty,{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)(Mh,{"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:()=>H(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)(Ty,{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)(Mh,{"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:()=>H(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)(Ty,{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)(yy,{})]})]})}function Cy({defaultRunner:e,providerStatus:t,saving:n,onPick:r}){let i=oa(),a=aa(),o=be(),s=Ji(),c=Ni(),l=o.projectId??`default`,u=s.data?.info?.root,d=u?i.data?.selections[u]:void 0,f=i.data?.defaults,p=Fv(i.data?.profiles??[]),m=Iv(p);return(0,Q.jsxs)(wy,{title:`Default runner`,hint:`Project defaults. A task can override these choices.`,children:[(0,Q.jsx)(Hv,{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=>H(e.message,{tone:`danger`})})}}),!t.isPending&&!t.isError&&Pt(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 wy({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 Ty({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 Ey=`cez-accent`,Dy=`cez-density`,Oy=`cez-width`,ky=`cezarion`,Ay=`comfortable`,jy=`narrow`;function My(e){return ky}function Ny(e){return e===`comfortable`||e===`compact`||e===`ultra`?e:Ay}function Py(e){return e===`narrow`||e===`wide`?e:jy}function Fy(e){let t=e&&typeof e==`object`?e:{};return{accent:My(t.accent),density:Ny(t.density),width:Py(t.width)}}function Iy(){try{return{accent:My(localStorage.getItem(Ey)),density:Ny(localStorage.getItem(Dy)),width:Py(localStorage.getItem(Oy))}}catch{return{accent:ky,density:Ay,width:jy}}}function Ly(e){try{localStorage.setItem(Ey,e.accent),localStorage.setItem(Dy,e.density),localStorage.setItem(Oy,e.width)}catch{}}function Ry(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 zy=Z.createContext(null);function By({children:e}){let t=V(),n=Fr(),[r,i]=Z.useState(Iy),a=n.data;Z.useEffect(()=>{if(a===void 0)return;let e=Fy(a.appearance);i(e),Ly(e)},[a]),Z.useLayoutEffect(()=>{Ry(document.documentElement,r)},[r]);let o=Z.useCallback(e=>{i(e),Ly(e),Tt({appearance:e}).then(e=>t.setQueryData(W.uiState,e)).catch(e=>{H(e instanceof Error?e.message:String(e),{tone:`danger`}),t.invalidateQueries({queryKey:W.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)(zy.Provider,{value:u,children:e})}function Vy(){let e=Z.useContext(zy);if(!e)throw Error(`cezar: useAppearance() must be called inside <AppearanceProvider>`);return e}var Hy=`cez-theme`,Uy=`(prefers-color-scheme: light)`,Wy=`dark`;function Gy(e){return e===`light`||e===`dark`||e===`system`?e:Wy}function Ky(e,t){return e===`light`||e===`system`&&t?`light`:`dark`}function qy(){try{return Gy(localStorage.getItem(Hy))}catch{return Wy}}function Jy(e){try{localStorage.setItem(Hy,e)}catch{}}function Yy(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(Uy).matches}function Xy(e,t){e.classList.toggle(`light`,t===`light`),e.style.colorScheme=t}function Zy(e){return`/cezarion-mark-${e}.svg`}function Qy(e){let t=document.querySelector(`link[rel="icon"]`);t&&(t.href=Zy(e))}var $y=Z.createContext(null);function eb({children:e}){let[t,n]=Z.useState(qy),[r,i]=Z.useState(Yy);Z.useEffect(()=>{let e=window.matchMedia?.(Uy);if(!e)return;i(e.matches);let t=e=>i(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let a=Ky(t,r);Z.useLayoutEffect(()=>{Xy(document.documentElement,a),Qy(a)},[a]);let o=Z.useCallback(e=>{n(e),Jy(e)},[]),s=Z.useMemo(()=>({theme:t,resolvedTheme:a,setTheme:o}),[t,a,o]);return(0,Q.jsx)($y.Provider,{value:s,children:e})}function tb(){let e=Z.useContext($y);if(!e)throw Error(`cezar: useTheme() must be called inside <ThemeProvider>`);return e}function nb(){var e=[...arguments];return(0,Z.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var rb=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function ib(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function ab(e){return`nodeType`in e}function ob(e){return e?ib(e)?e:ab(e)?e.ownerDocument?.defaultView??window:window:window}function sb(e){let{Document:t}=ob(e);return e instanceof t}function cb(e){return!ib(e)&&e instanceof ob(e).HTMLElement}function lb(e){return e instanceof ob(e).SVGElement}function ub(e){return e?ib(e)?e.document:ab(e)?sb(e)?e:cb(e)||lb(e)?e.ownerDocument:document:document:document}var db=rb?Z.useLayoutEffect:Z.useEffect;function fb(e){let t=(0,Z.useRef)(e);return db(()=>{t.current=e}),(0,Z.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function pb(){let e=(0,Z.useRef)(null);return[(0,Z.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,Z.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function mb(e,t){t===void 0&&(t=[e]);let n=(0,Z.useRef)(e);return db(()=>{n.current!==e&&(n.current=e)},t),n}function hb(e,t){let n=(0,Z.useRef)();return(0,Z.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function gb(e){let t=fb(e),n=(0,Z.useRef)(null);return[n,(0,Z.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function _b(e){let t=(0,Z.useRef)();return(0,Z.useEffect)(()=>{t.current=e},[e]),t.current}var vb={};function yb(e,t){return(0,Z.useMemo)(()=>{if(t)return t;let n=vb[e]==null?0:vb[e]+1;return vb[e]=n,e+`-`+n},[e,t])}function bb(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var xb=bb(1),Sb=bb(-1);function Cb(e){return`clientX`in e&&`clientY`in e}function wb(e){if(!e)return!1;let{KeyboardEvent:t}=ob(e.target);return t&&e instanceof t}function Tb(e){if(!e)return!1;let{TouchEvent:t}=ob(e.target);return t&&e instanceof t}function Eb(e){if(Tb(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return Cb(e)?{x:e.clientX,y:e.clientY}:null}var Db=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[Db.Translate.toString(e),Db.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),Ob=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function kb(e){return e.matches(Ob)?e:e.querySelector(Ob)}var Ab={display:`none`};function jb(e){let{id:t,value:n}=e;return Z.createElement(`div`,{id:t,style:Ab},n)}function Mb(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return Z.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function Nb(){let[e,t]=(0,Z.useState)(``);return{announce:(0,Z.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var Pb=(0,Z.createContext)(null);function Fb(e){let t=(0,Z.useContext)(Pb);(0,Z.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function Ib(){let[e]=(0,Z.useState)(()=>new Set),t=(0,Z.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,Z.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var Lb={draggable:`
26
+ To pick up a draggable item, press the space bar.
27
+ While dragging, use the arrow keys to move the item.
28
+ Press space again to drop the item in its new position, or press escape to cancel.
29
+ `},Rb={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function zb(e){let{announcements:t=Rb,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=Lb}=e,{announce:a,announcement:o}=Nb(),s=yb(`DndLiveRegion`),[c,l]=(0,Z.useState)(!1);if((0,Z.useEffect)(()=>{l(!0)},[]),Fb((0,Z.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=Z.createElement(Z.Fragment,null,Z.createElement(jb,{id:r,value:i.draggable}),Z.createElement(Mb,{id:s,announcement:o}));return n?(0,jl.createPortal)(u,n):u}var Bb;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(Bb||={});function Vb(){}function Hb(e,t){return(0,Z.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function Ub(){var e=[...arguments];return(0,Z.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var Wb=Object.freeze({x:0,y:0});function Gb(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function Kb(e,t){let n=Eb(e);if(!n)return`0 0`;let r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+`% `+r.y+`%`}function qb(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Jb(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Yb(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function Xb(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function Zb(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var Qb=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=Zb(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=Gb(Zb(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(qb)},$b=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=Yb(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=Yb(r),o=i.reduce((e,t,r)=>e+Gb(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(qb)};function ex(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var tx=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=ex(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(Jb)};function nx(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function rx(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Wb}function ix(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var ax=ix(1);function ox(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function sx(e,t,n){let r=ox(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var cx={ignoreTransform:!1};function lx(e,t){t===void 0&&(t=cx);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=ob(e).getComputedStyle(e);t&&(n=sx(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function ux(e){return lx(e,{ignoreTransform:!0})}function dx(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function fx(e,t){return t===void 0&&(t=ob(e).getComputedStyle(e)),t.position===`fixed`}function px(e,t){t===void 0&&(t=ob(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`&&n.test(r)})}function mx(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(sb(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!cb(i)||lb(i)||n.includes(i))return n;let a=ob(e).getComputedStyle(i);return i!==e&&px(i,a)&&n.push(i),fx(i,a)?n:r(i.parentNode)}return e?r(e):n}function hx(e){let[t]=mx(e,1);return t??null}function gx(e){return!rb||!e?null:ib(e)?e:ab(e)?sb(e)||e===ub(e).scrollingElement?window:cb(e)?e:null:null}function _x(e){return ib(e)?e.scrollX:e.scrollLeft}function vx(e){return ib(e)?e.scrollY:e.scrollTop}function yx(e){return{x:_x(e),y:vx(e)}}var bx;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(bx||={});function xx(e){return!rb||!e?!1:e===document.scrollingElement}function Sx(e){let t={x:0,y:0},n=xx(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var Cx={x:.2,y:.2};function wx(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=Cx);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=Sx(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=bx.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=bx.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=bx.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=bx.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function Tx(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function Ex(e){return e.reduce((e,t)=>xb(e,yx(t)),Wb)}function Dx(e){return e.reduce((e,t)=>e+_x(t),0)}function Ox(e){return e.reduce((e,t)=>e+vx(t),0)}function kx(e,t){if(t===void 0&&(t=lx),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);hx(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var Ax=[[`x`,[`left`,`right`],Dx],[`y`,[`top`,`bottom`],Ox]],jx=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=mx(t),r=Ex(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of Ax)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},Mx=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function Nx(e){let{EventTarget:t}=ob(e);return e instanceof t?e:ub(e)}function Px(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t&&r>t.y}var Fx;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(Fx||={});function Ix(e){e.preventDefault()}function Lx(e){e.stopPropagation()}var $;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})($||={});var Rx={start:[$.Space,$.Enter],cancel:[$.Esc],end:[$.Space,$.Enter,$.Tab]},zx=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case $.Right:return{...n,x:n.x+25};case $.Left:return{...n,x:n.x-25};case $.Down:return{...n,y:n.y+25};case $.Up:return{...n,y:n.y-25}}},Bx=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new Mx(ub(t)),this.windowListeners=new Mx(ob(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Fx.Resize,this.handleCancel),this.windowListeners.add(Fx.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Fx.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&kx(n),t(Wb)}handleKeyDown(e){if(wb(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=Rx,coordinateGetter:a=zx,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:Wb;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=Sb(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=Sx(n),p=Tx(n),m={x:Math.min(i===$.Right?p.right-p.width/2:p.right,Math.max(i===$.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===$.Down?p.bottom-p.height/2:p.bottom,Math.max(i===$.Down?p.top:p.top+p.height/2,u.y))},h=i===$.Right&&!s||i===$.Left&&!c,g=i===$.Down&&!l||i===$.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===$.Right&&e<=d.x||i===$.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===$.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===$.Down&&e<=d.y||i===$.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===$.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,xb(Sb(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};Bx.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=Rx,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function Vx(e){return!!(e&&`distance`in e)}function Hx(e){return!!(e&&`delay`in e)}var Ux=class{constructor(e,t,n){n===void 0&&(n=Nx(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=ub(i),this.documentListeners=new Mx(this.document),this.listeners=new Mx(n),this.windowListeners=new Mx(ob(i)),this.initialCoordinates=Eb(r)??Wb,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Fx.Resize,this.handleCancel),this.windowListeners.add(Fx.DragStart,Ix),this.windowListeners.add(Fx.VisibilityChange,this.handleCancel),this.windowListeners.add(Fx.ContextMenu,Ix),this.documentListeners.add(Fx.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Hx(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(Vx(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(Fx.Click,Lx,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Fx.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=Eb(e)??Wb,s=Sb(n,o);if(!t&&a){if(Vx(a)){if(a.tolerance!=null&&Px(s,a.tolerance))return this.handleCancel();if(Px(s,a.distance))return this.handleStart()}if(Hx(a)&&Px(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===$.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},Wx={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},Gx=class extends Ux{constructor(e){let{event:t}=e,n=ub(t.target);super(e,Wx,n)}};Gx.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var Kx={move:{name:`mousemove`},end:{name:`mouseup`}},qx;(function(e){e[e.RightClick=2]=`RightClick`})(qx||={});var Jx=class extends Ux{constructor(e){super(e,Kx,ub(e.event.target))}};Jx.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===qx.RightClick?!1:(r?.({event:n}),!0)}}];var Yx={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},Xx=class extends Ux{constructor(e){super(e,Yx)}static setup(){return window.addEventListener(Yx.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Yx.move.name,e)};function e(){}}};Xx.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var Zx;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(Zx||={});var Qx;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(Qx||={});function $x(e){let{acceleration:t,activator:n=Zx.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=Qx.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=tS({delta:d,disabled:!a}),[m,h]=pb(),g=(0,Z.useRef)({x:0,y:0}),_=(0,Z.useRef)({x:0,y:0}),v=(0,Z.useMemo)(()=>{switch(n){case Zx.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Zx.DraggableRect:return i}},[n,i,c]),y=(0,Z.useRef)(null),b=(0,Z.useCallback)(()=>{let e=y.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),x=(0,Z.useMemo)(()=>s===Qx.TreeOrder?[...l].reverse():l,[s,l]);(0,Z.useEffect)(()=>{if(!a||!l.length||!v){h();return}for(let e of x){if(r?.(e)===!1)continue;let n=l.indexOf(e),i=u[n];if(!i)continue;let{direction:a,speed:s}=wx(e,i,v,t,f);for(let e of[`x`,`y`])p[e][a[e]]||(s[e]=0,a[e]=0);if(s.x>0||s.y>0){h(),y.current=e,m(b,o),g.current=s,_.current=a;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()},[t,b,r,h,a,o,JSON.stringify(v),JSON.stringify(p),m,l,x,u,JSON.stringify(f)])}var eS={x:{[bx.Backward]:!1,[bx.Forward]:!1},y:{[bx.Backward]:!1,[bx.Forward]:!1}};function tS(e){let{delta:t,disabled:n}=e,r=_b(t);return hb(e=>{if(n||!r||!e)return eS;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[bx.Backward]:e.x[bx.Backward]||i.x===-1,[bx.Forward]:e.x[bx.Forward]||i.x===1},y:{[bx.Backward]:e.y[bx.Backward]||i.y===-1,[bx.Forward]:e.y[bx.Forward]||i.y===1}}},[n,t,r])}function nS(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return hb(e=>t==null?null:r??e??null,[r,t])}function rS(e,t){return(0,Z.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var iS;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(iS||={});var aS;(function(e){e.Optimized=`optimized`})(aS||={});var oS=new Map;function sS(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,Z.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,Z.useRef)(e),d=g(),f=mb(d),p=(0,Z.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,Z.useRef)(null),h=hb(t=>{if(d&&!n)return oS;if(!t||t===oS||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new jx(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,Z.useEffect)(()=>{u.current=e},[e]),(0,Z.useEffect)(()=>{d||p()},[n,d]),(0,Z.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,Z.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case iS.Always:return!1;case iS.BeforeDragging:return n;default:return!n}}}function cS(e,t){return hb(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function lS(e,t){return cS(e,t)}function uS(e){let{callback:t,disabled:n}=e,r=fb(t),i=(0,Z.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,Z.useEffect)(()=>()=>i?.disconnect(),[i]),i}function dS(e){let{callback:t,disabled:n}=e,r=fb(t),i=(0,Z.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,Z.useEffect)(()=>()=>i?.disconnect(),[i]),i}function fS(e){return new jx(lx(e),e)}function pS(e,t,n){t===void 0&&(t=fS);let[r,i]=(0,Z.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=uS({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=dS({callback:a});return db(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function mS(e){return rx(e,cS(e))}var hS=[];function gS(e){let t=(0,Z.useRef)(e),n=hb(n=>e?n&&n!==hS&&e&&t.current&&e.parentNode===t.current.parentNode?n:mx(e):hS,[e]);return(0,Z.useEffect)(()=>{t.current=e},[e]),n}function _S(e){let[t,n]=(0,Z.useState)(null),r=(0,Z.useRef)(e),i=(0,Z.useCallback)(e=>{let t=gx(e.target);t&&n(e=>e?(e.set(t,yx(t)),new Map(e)):null)},[]);return(0,Z.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=gx(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,yx(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{gx(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,Z.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>xb(e,t),Wb):Ex(e):Wb,[e,t])}function vS(e,t){t===void 0&&(t=[]);let n=(0,Z.useRef)(null);return(0,Z.useEffect)(()=>{n.current=null},t),(0,Z.useEffect)(()=>{let t=e!==Wb;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?Sb(e,n.current):Wb}function yS(e){(0,Z.useEffect)(()=>{if(!rb)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function bS(e,t){return(0,Z.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function xS(e){return(0,Z.useMemo)(()=>e?dx(e):null,[e])}var SS=[];function CS(e,t){t===void 0&&(t=lx);let[n]=e,r=xS(n?ob(n):null),[i,a]=(0,Z.useState)(SS);function o(){a(()=>e.length?e.map(e=>xx(e)?r:new jx(t(e),e)):SS)}let s=dS({callback:o});return db(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function wS(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return cb(t)?t:e}function TS(e){let{measure:t}=e,[n,r]=(0,Z.useState)(null),i=dS({callback:(0,Z.useCallback)(e=>{for(let{target:n}of e)if(cb(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=gb((0,Z.useCallback)(e=>{let n=wS(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,Z.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var ES=[{sensor:Gx,options:{}},{sensor:Bx,options:{}}],DS={current:{}},OS={draggable:{measure:ux},droppable:{measure:ux,strategy:iS.WhileDragging,frequency:aS.Optimized},dragOverlay:{measure:lx}},kS=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},AS={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new kS,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Vb},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:OS,measureDroppableContainers:Vb,windowRect:null,measuringScheduled:!1},jS={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:Vb,draggableNodes:new Map,over:null,measureDroppableContainers:Vb},MS=(0,Z.createContext)(jS),NS=(0,Z.createContext)(AS);function PS(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new kS}}}function FS(e,t){switch(t.type){case Bb.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Bb.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Bb.DragEnd:case Bb.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Bb.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new kS(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case Bb.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new kS(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case Bb.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new kS(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function IS(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,Z.useContext)(MS),a=_b(r),o=_b(n?.id);return(0,Z.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!wb(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=kb(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function LS(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function RS(e){return(0,Z.useMemo)(()=>({draggable:{...OS.draggable,...e?.draggable},droppable:{...OS.droppable,...e?.droppable},dragOverlay:{...OS.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function zS(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,Z.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;db(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=rx(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=hx(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var BS=(0,Z.createContext)({...Wb,scaleX:1,scaleY:1}),VS;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(VS||={});var HS=(0,Z.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=ES,collisionDetection:o=tx,measuring:s,modifiers:c,...l}=e,[u,d]=(0,Z.useReducer)(FS,void 0,PS),[f,p]=Ib(),[m,h]=(0,Z.useState)(VS.Uninitialized),g=m===VS.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,x=_==null?null:v.get(_),S=(0,Z.useRef)({initial:null,translated:null}),C=(0,Z.useMemo)(()=>_==null?null:{id:_,data:x?.data??DS,rect:S},[_,x]),w=(0,Z.useRef)(null),[T,E]=(0,Z.useState)(null),[D,O]=(0,Z.useState)(null),k=mb(l,Object.values(l)),A=yb(`DndDescribedBy`,t),j=(0,Z.useMemo)(()=>b.getEnabled(),[b]),M=RS(s),{droppableRects:N,measureDroppableContainers:P,measuringScheduled:F}=sS(j,{dragging:g,dependencies:[y.x,y.y],config:M.droppable}),I=nS(v,_),ee=(0,Z.useMemo)(()=>D?Eb(D):null,[D]),L=De(),R=lS(I,M.draggable.measure);zS({activeNode:_==null?null:v.get(_),config:L.layoutShiftCompensation,initialRect:R,measure:M.draggable.measure});let te=pS(I,M.draggable.measure,R),ne=pS(I?I.parentElement:null),z=(0,Z.useRef)({activatorEvent:null,active:null,activeNode:I,collisionRect:null,collisions:null,droppableRects:N,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),re=b.getNodeFor(z.current.over?.id),B=TS({measure:M.dragOverlay.measure}),ie=B.nodeRef.current??I,ae=g?B.rect??te:null,oe=!!(B.nodeRef.current&&B.rect),se=mS(oe?null:te),ce=xS(ie?ob(ie):null),le=gS(g?re??I:null),ue=CS(le),de=LS(c,{transform:{x:y.x-se.x,y:y.y-se.y,scaleX:1,scaleY:1},activatorEvent:D,active:C,activeNodeRect:te,containerNodeRect:ne,draggingNodeRect:ae,over:z.current.over,overlayNodeRect:B.rect,scrollableAncestors:le,scrollableAncestorRects:ue,windowRect:ce}),fe=ee?xb(ee,y):null,pe=_S(le),me=vS(pe),he=vS(pe,[te]),ge=xb(de,me),_e=ae?ax(ae,de):null,V=C&&_e?o({active:C,collisionRect:_e,droppableRects:N,droppableContainers:j,pointerCoordinates:fe}):null,ve=Xb(V,`id`),[ye,be]=(0,Z.useState)(null),xe=nx(oe?de:xb(de,he),ye?.rect??null,te),Se=(0,Z.useRef)(null),Ce=(0,Z.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(w.current==null)return;let i=v.get(w.current);if(!i)return;let a=e.nativeEvent,o=new n({active:w.current,activeNode:i,event:a,options:r,context:z,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=k.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=k.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=w.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=k.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:S}};(0,jl.unstable_batchedUpdates)(()=>{r?.(i),h(VS.Initializing),d({type:Bb.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),E(Se.current),O(a)})},onMove(e){d({type:Bb.DragMove,coordinates:e})},onEnd:s(Bb.DragEnd),onCancel:s(Bb.DragCancel)});Se.current=o;function s(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=z.current,o=null;if(t&&i){let{cancelDrop:s}=k.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===Bb.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=Bb.DragCancel)}w.current=null,(0,jl.unstable_batchedUpdates)(()=>{d({type:e}),h(VS.Uninitialized),be(null),E(null),O(null),Se.current=null;let t=e===Bb.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=k.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),we=rS(a,(0,Z.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(w.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},w.current=r,Ce(n,t))},[v,Ce]));yS(a),db(()=>{te&&m===VS.Initializing&&h(VS.Initialized)},[te,m]),(0,Z.useEffect)(()=>{let{onDragMove:e}=k.current,{active:t,activatorEvent:n,collisions:r,over:i}=z.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:ge.x,y:ge.y},over:i};(0,jl.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[ge.x,ge.y]),(0,Z.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=z.current;if(!e||w.current==null||!t||!i)return;let{onDragOver:a}=k.current,o=r.get(ve),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,jl.unstable_batchedUpdates)(()=>{be(s),a?.(c),f({type:`onDragOver`,event:c})})},[ve]),db(()=>{z.current={activatorEvent:D,active:C,activeNode:I,collisionRect:_e,collisions:V,droppableRects:N,draggableNodes:v,draggingNode:ie,draggingNodeRect:ae,droppableContainers:b,over:ye,scrollableAncestors:le,scrollAdjustedTranslate:ge},S.current={initial:ae,translated:_e}},[C,I,V,_e,v,ie,ae,N,b,ye,le,ge]),$x({...L,delta:y,draggingRect:_e,pointerCoordinates:fe,scrollableAncestors:le,scrollableAncestorRects:ue});let Te=(0,Z.useMemo)(()=>({active:C,activeNode:I,activeNodeRect:te,activatorEvent:D,collisions:V,containerNodeRect:ne,dragOverlay:B,draggableNodes:v,droppableContainers:b,droppableRects:N,over:ye,measureDroppableContainers:P,scrollableAncestors:le,scrollableAncestorRects:ue,measuringConfiguration:M,measuringScheduled:F,windowRect:ce}),[C,I,te,D,V,ne,B,v,b,N,ye,P,le,ue,M,F,ce]),Ee=(0,Z.useMemo)(()=>({activatorEvent:D,activators:we,active:C,activeNodeRect:te,ariaDescribedById:{draggable:A},dispatch:d,draggableNodes:v,over:ye,measureDroppableContainers:P}),[D,we,C,te,d,A,v,ye,P]);return Z.createElement(Pb.Provider,{value:p},Z.createElement(MS.Provider,{value:Ee},Z.createElement(NS.Provider,{value:Te},Z.createElement(BS.Provider,{value:xe},i)),Z.createElement(IS,{disabled:n?.restoreFocus===!1})),Z.createElement(zb,{...n,hiddenTextDescribedById:A}));function De(){let e=T?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),US=(0,Z.createContext)(null),WS=`button`,GS=`Draggable`;function KS(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=yb(GS),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,Z.useContext)(MS),{role:p=WS,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,Z.useContext)(g?BS:US),[v,y]=gb(),[b,x]=gb(),S=bS(o,t),C=mb(n);return db(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:C}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,Z.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===WS?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:S,node:v,over:f,setNodeRef:y,setActivatorNodeRef:x,transform:_}}function qS(){return(0,Z.useContext)(NS)}var JS=`Droppable`,YS={timeout:25};function XS(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=yb(JS),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,Z.useContext)(MS),u=(0,Z.useRef)({disabled:n}),d=(0,Z.useRef)(!1),f=(0,Z.useRef)(null),p=(0,Z.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...YS,...i},_=mb(h??r),v=dS({callback:(0,Z.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[y,b]=gb((0,Z.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=mb(t);return(0,Z.useEffect)(()=>{!v||!y.current||(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,Z.useEffect)(()=>(s({type:Bb.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:Bb.UnregisterDroppable,key:a,id:r})),[r]),(0,Z.useEffect)(()=>{n!==u.current.disabled&&(s({type:Bb.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:y,over:c,setNodeRef:b}}function ZS(e){let{animation:t,children:n}=e,[r,i]=(0,Z.useState)(null),[a,o]=(0,Z.useState)(null),s=_b(n);return!n&&!r&&s&&i(s),db(()=>{if(!a)return;let e=r?.key,n=r?.props.id;if(e==null||n==null){i(null);return}Promise.resolve(t(n,a)).then(()=>{i(null)})},[t,r,a]),Z.createElement(Z.Fragment,null,n,r?(0,Z.cloneElement)(r,{ref:o}):null)}var QS={x:0,y:0,scaleX:1,scaleY:1};function $S(e){let{children:t}=e;return Z.createElement(MS.Provider,{value:jS},Z.createElement(BS.Provider,{value:QS},t))}var eC={position:`fixed`,touchAction:`none`},tC=e=>wb(e)?`transform 250ms ease`:void 0,nC=(0,Z.forwardRef)((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:a,className:o,rect:s,style:c,transform:l,transition:u=tC}=e;if(!s)return null;let d=i?l:{...l,scaleX:1,scaleY:1},f={...eC,width:s.width,height:s.height,top:s.top,left:s.left,transform:Db.Transform.toString(d),transformOrigin:i&&r?Kb(r,s):void 0,transition:typeof u==`function`?u(r):u,...c};return Z.createElement(n,{className:o,style:f,ref:t},a)}),rC={duration:250,easing:`ease`,keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:Db.Transform.toString(t)},{transform:Db.Transform.toString(n)}]},sideEffects:(e=>t=>{let{active:n,dragOverlay:r}=t,i={},{styles:a,className:o}=e;if(a!=null&&a.active)for(let[e,t]of Object.entries(a.active))t!==void 0&&(i[e]=n.node.style.getPropertyValue(e),n.node.style.setProperty(e,t));if(a!=null&&a.dragOverlay)for(let[e,t]of Object.entries(a.dragOverlay))t!==void 0&&r.node.style.setProperty(e,t);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&r.node.classList.add(o.dragOverlay),function(){for(let[e,t]of Object.entries(i))n.node.style.setProperty(e,t);o!=null&&o.active&&n.node.classList.remove(o.active)}})({styles:{active:{opacity:`0`}}})};function iC(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return fb((e,a)=>{if(t===null)return;let o=n.get(e);if(!o)return;let s=o.node.current;if(!s)return;let c=wS(a);if(!c)return;let{transform:l}=ob(a).getComputedStyle(a),u=ox(l);if(!u)return;let d=typeof t==`function`?t:aC(t);return kx(s,i.draggable.measure),d({active:{id:e,data:o.data,node:s,rect:i.draggable.measure(s)},draggableNodes:n,dragOverlay:{node:a,rect:i.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:i,transform:u})})}function aC(e){let{duration:t,easing:n,sideEffects:r,keyframes:i}={...rC,...e};return e=>{let{active:a,dragOverlay:o,transform:s,...c}=e;if(!t)return;let l={x:o.rect.left-a.rect.left,y:o.rect.top-a.rect.top},u={scaleX:s.scaleX===1?1:a.rect.width*s.scaleX/o.rect.width,scaleY:s.scaleY===1?1:a.rect.height*s.scaleY/o.rect.height},d={x:s.x-l.x,y:s.y-l.y,...u},f=i({...c,active:a,dragOverlay:o,transform:{initial:s,final:d}}),[p]=f,m=f[f.length-1];if(JSON.stringify(p)===JSON.stringify(m))return;let h=r?.({active:a,dragOverlay:o,...c}),g=o.node.animate(f,{duration:t,easing:n,fill:`forwards`});return new Promise(e=>{g.onfinish=()=>{h?.(),e()}})}}var oC=0;function sC(e){return(0,Z.useMemo)(()=>{if(e!=null)return oC++,oC},[e])}var cC=Z.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:a,modifiers:o,wrapperElement:s=`div`,className:c,zIndex:l=999}=e,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggableNodes:m,droppableContainers:h,dragOverlay:g,over:_,measuringConfiguration:v,scrollableAncestors:y,scrollableAncestorRects:b,windowRect:x}=qS(),S=(0,Z.useContext)(BS),C=sC(d?.id),w=LS(o,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggingNodeRect:g.rect,over:_,overlayNodeRect:g.rect,scrollableAncestors:y,scrollableAncestorRects:b,transform:S,windowRect:x}),T=cS(f),E=iC({config:r,draggableNodes:m,droppableContainers:h,measuringConfiguration:v}),D=T?g.setRef:void 0;return Z.createElement($S,null,Z.createElement(ZS,{animation:E},d&&C?Z.createElement(nC,{key:C,id:d.id,ref:D,as:s,activatorEvent:u,adjustScale:t,className:c,transition:a,rect:T,style:{zIndex:l,...i},transform:w},n):null))});function lC(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function uC(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function dC(e){return e!==null&&e>=0}function fC(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function pC(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var mC=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=lC(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},hC={scaleX:1,scaleY:1},gC=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...hC}:null}let s=_C(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...hC}:r<t&&r>=a?{x:0,y:o.height+s,...hC}:{x:0,y:0,...hC}};function _C(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var vC=`Sortable`,yC=Z.createContext({activeIndex:-1,containerId:vC,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:mC,disabled:{draggable:!1,droppable:!1}});function bC(e){let{children:t,id:n,items:r,strategy:i=mC,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=qS(),d=yb(vC,n),f=s.rect!==null,p=(0,Z.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,_=(0,Z.useRef)(p),v=!fC(p,_.current),y=g!==-1&&h===-1||v,b=pC(a);db(()=>{v&&m&&u(p)},[v,p,m,u]),(0,Z.useEffect)(()=>{_.current=p},[p]);let x=(0,Z.useMemo)(()=>({activeIndex:h,containerId:d,disabled:b,disableTransforms:y,items:p,overIndex:g,useDragOverlay:f,sortedRects:uC(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return Z.createElement(yC.Provider,{value:x},t)}var xC=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return lC(n,r,i).indexOf(t)},SC=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},CC={duration:200,easing:`ease`},wC=`transform`,TC=Db.Transition.toString({property:wC,duration:0,easing:`linear`}),EC={roleDescription:`sortable`};function DC(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,Z.useState)(null),s=(0,Z.useRef)(n);return db(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=lx(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,Z.useEffect)(()=>{a&&o(null)},[a]),a}function OC(e){let{animateLayoutChanges:t=SC,attributes:n,disabled:r,data:i,getNewIndex:a=xC,id:o,strategy:s,resizeObserverConfig:c,transition:l=CC}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,Z.useContext)(yC),y=kC(r,p),b=u.indexOf(o),x=(0,Z.useMemo)(()=>({sortable:{containerId:d,index:b,items:u},...i}),[d,i,b,u]),S=(0,Z.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:C,node:w,isOver:T,setNodeRef:E}=XS({id:o,data:x,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...c}}),{active:D,activatorEvent:O,activeNodeRect:k,attributes:A,setNodeRef:j,listeners:M,isDragging:N,over:P,setActivatorNodeRef:F,transform:I}=KS({id:o,data:x,attributes:{...EC,...n},disabled:y.draggable}),ee=nb(E,j),L=!!D,R=L&&!m&&dC(f)&&dC(g),te=!_&&N,ne=R?(te&&R?I:null)??(s??v)({rects:h,activeNodeRect:k,activeIndex:f,overIndex:g,index:b}):null,z=dC(f)&&dC(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):b,re=D?.id,B=(0,Z.useRef)({activeId:re,items:u,newIndex:z,containerId:d}),ie=u!==B.current.items,ae=t({active:D,containerId:d,isDragging:N,isSorting:L,id:o,index:b,items:u,newIndex:B.current.newIndex,previousItems:B.current.items,previousContainerId:B.current.containerId,transition:l,wasDragging:B.current.activeId!=null}),oe=DC({disabled:!ae,index:b,node:w,rect:C});return(0,Z.useEffect)(()=>{L&&B.current.newIndex!==z&&(B.current.newIndex=z),d!==B.current.containerId&&(B.current.containerId=d),u!==B.current.items&&(B.current.items=u)},[L,z,d,u]),(0,Z.useEffect)(()=>{if(re===B.current.activeId)return;if(re!=null&&B.current.activeId==null){B.current.activeId=re;return}let e=setTimeout(()=>{B.current.activeId=re},50);return()=>clearTimeout(e)},[re]),{active:D,activeIndex:f,attributes:A,data:x,rect:C,index:b,newIndex:z,items:u,isOver:T,isSorting:L,isDragging:N,listeners:M,node:w,overIndex:g,over:P,setNodeRef:ee,setActivatorNodeRef:F,setDroppableNodeRef:E,setDraggableNodeRef:j,transform:oe??ne,transition:se()};function se(){if(oe||ie&&B.current.newIndex===b)return TC;if(!(te&&!wb(O)||!l)&&(L||ae))return Db.Transition.toString({...l,property:wC})}}function kC(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function AC(e){if(!e)return!1;let t=e.data.current;return!!(t&&`sortable`in t&&typeof t.sortable==`object`&&`containerId`in t.sortable&&`items`in t.sortable&&`index`in t.sortable)}var jC=[$.Down,$.Right,$.Up,$.Left],MC=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(jC.includes(e.code)){if(e.preventDefault(),!n||!r)return;let t=[];a.getEnabled().forEach(n=>{if(!n||n!=null&&n.disabled)return;let a=i.get(n.id);if(a)switch(e.code){case $.Down:r.top<a.top&&t.push(n);break;case $.Up:r.top>a.top&&t.push(n);break;case $.Left:r.left>a.left&&t.push(n);break;case $.Right:r.left<a.left&&t.push(n);break}});let c=$b({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=Xb(c,`id`);if(l===o?.id&&c.length>1&&(l=c[1].id),l!=null){let e=a.get(n.id),t=a.get(l),o=t?i.get(t.id):null,c=t?.node.current;if(c&&o&&e&&t){let n=mx(c).some((e,t)=>s[t]!==e),i=NC(e,t),a=PC(e,t),l=n||!i?{x:0,y:0}:{x:a?r.width-o.width:0,y:a?r.height-o.height:0},u={x:o.left,y:o.top};return l.x&&l.y?u:Sb(u,l)}}}};function NC(e,t){return!AC(e)||!AC(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function PC(e,t){return!AC(e)||!AC(t)||!NC(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function FC(e){return e<=200}function IC(e){if(!Array.isArray(e))return[];let t=new Set;for(let n of e){if(typeof n!=`string`)continue;let e=n.trim();if(!(e===``||t.has(e))&&(t.add(e),t.size>=200))break}return[...t]}function LC(e,t){let n=IC(t);if(n.length===0)return[...e];let r=new Map(n.map((e,t)=>[e,t])),i=[],a=[];for(let t of e)r.has(t.id)?i.push(t):a.push(t);return i.sort((e,t)=>r.get(e.id)-r.get(t.id)),[...a,...i]}function RC(e,t,n){return t===n||t<0||n<0||t>=e.length||n>=e.length?[...e]:lC([...e],t,n)}function zC(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function BC(){let e=V(),t=Fr(),n=Z.useRef(0),r=Z.useRef(Promise.resolve()),i=Z.useMemo(()=>IC(t.data?.sidebar?.projectOrder),[t.data?.sidebar?.projectOrder]),a=Z.useCallback(t=>{let i=e.getQueryData(W.uiState);if(i===void 0)return;let{projectOrder:a,...o}=zC(i.sidebar),s=t===null?o:{...o,projectOrder:t};e.setQueryData(W.uiState,{...i,sidebar:s});let c=++n.current,l=r.current.then(async()=>{let t=await Tt({sidebar:s},{keepalive:!0});c===n.current&&e.setQueryData(W.uiState,t)});r.current=l.catch(t=>{H(t instanceof Error?t.message:String(t),{tone:`danger`}),c===n.current&&e.invalidateQueries({queryKey:W.uiState})})},[e]),o=Z.useCallback(e=>{let t=IC(e);t.length===0||!FC(e.length)||a(t)},[a]),s=Z.useCallback(()=>a(null),[a]);return{order:i,canReorder:t.data!==void 0,setOrder:o,reset:s}}var VC=[{value:`system`,label:`System`,icon:kc},{value:`light`,label:`Light`,icon:Wc},{value:`dark`,label:`Dark`,icon:Ac}],HC=[{value:`cezarion`,label:`Cezarion`,swatch:`var(--accent-strong)`}],UC=[{value:`comfortable`,label:`Comfortable`},{value:`compact`,label:`Compact`},{value:`ultra`,label:`Compact for real`}],WC=[{value:`narrow`,label:`Narrow`},{value:`wide`,label:`Wide`}];function GC({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:s(`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 KC({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 qC(){let e=aa(),{order:t,canReorder:n,reset:r}=BC();return!((e.data?.projects.length??0)>1)||t.length===0?null:(0,Q.jsx)(KC,{title:`Project order`,hint:`The project rail is in the order you dragged it into. Reset puts it back in the order the projects were added. Saved with your workspace, so every browser sees it.`,children:(0,Q.jsx)(A,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`appearance-project-order-reset`,disabled:!n,onClick:r,className:`w-fit`,children:`Reset order`})})}function JC(){let{theme:e,setTheme:t}=tb(),{accent:n,density:r,width:i,setAccent:a,setDensity:o,setWidth:s}=Vy();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)(KC,{title:`Theme`,hint:`System follows your OS preference. Applies to this browser.`,children:(0,Q.jsx)(GC,{slot:`appearance-theme`,label:`Theme`,value:e,options:VC,onChange:t})}),HC.length>1?(0,Q.jsx)(KC,{title:`Accent`,hint:`The cockpit brand accent. Saved with your workspace appearance.`,children:(0,Q.jsx)(GC,{slot:`appearance-accent`,label:`Accent`,value:n,options:HC,onChange:a})}):null,(0,Q.jsx)(KC,{title:`Density`,hint:`Compact tightens spacing across the cockpit — text stays the same size.`,children:(0,Q.jsx)(GC,{slot:`appearance-density`,label:`Density`,value:r,options:UC,onChange:o})}),(0,Q.jsx)(KC,{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)(GC,{slot:`appearance-width`,label:`Reading width`,value:i,options:WC,onChange:s})}),(0,Q.jsx)(qC,{}),(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 YC=`http://localhost:4321`;function XC(e,t,n,r=YC,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 ZC(){let e=qr();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)(ra,{icon:(0,Q.jsx)(Re,{}),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)(QC,{skills:im(e.data??[])})})}function QC({skills:e}){let t=$r(),n=kr(),r=aa(),[i,a]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(``),c=t.isError?``:t.data?.key||null,l=window.location.origin,u=Wa()??n.data?.bootProject??null,d=r.data?.projects.find(e=>e.id===u)?.name??XR(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.`}),c===null||t.isError?(0,Q.jsx)(`p`,{"data-slot":`bm-key-state`,role:t.isError?`alert`:`status`,className:`text-xs leading-relaxed ${t.isError?`text-destructive`:`text-soft-foreground`}`,children:t.isError?`Could not load this project's launch key, so these launchers only prefill the form and auto-start cannot arm: ${t.error.message}`:`Loading this project's launch key…`}):null,(0,Q.jsx)(`div`,{"data-slot":`bm-generic`,className:`rounded-lg border border-border bg-muted/30 p-3.5`,children:(0,Q.jsx)($C,{label:d?`cezar (${d}): this PR/issue`:`cezar: this PR/issue`,url:c===null?null:XC(``,!1,c,l,u),generic:!0,hint:`Prefills the form only—never auto-starts, even when auto-submit is on.`})}),(0,Q.jsx)(x_,{"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)($C,{label:d?`/${e.name} (${d})`:`/${e.name}`,url:c===null?null:XC(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 $C({label:e,url:t,hint:n,generic:r=!1}){let i=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{t===null?i.current?.removeAttribute(`href`):i.current?.setAttribute(`href`,t)},[t]);let a=t!==null,o=async()=>{if(t!==null)try{await navigator.clipboard.writeText(t),H(`Bookmarklet URL copied.`)}catch{H(`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:a,"data-slot":`bm-link`,"data-ready":a,"aria-disabled":!a||void 0,title:a?`Drag me to your bookmarks bar`:`Waiting for the launch key`,"aria-label":`${r?`Drag to bookmarks`:`Drag launcher`}: ${e}`,onClick:e=>{e.preventDefault(),H(a?`Drag me to your bookmarks bar`:`This launcher is not ready: it has no launch key yet.`)},className:`inline-flex aria-disabled:cursor-not-allowed aria-disabled:opacity-60 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`,disabled:!a,onClick:()=>void o(),className:`min-h-11 disabled:cursor-not-allowed disabled:opacity-60 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 ew(e){return{enabled:(e&&typeof e==`object`?e:{}).enabled===!0}}function tw(){let e=globalThis.Notification;if(typeof e!=`function`)return`unsupported`;let t=e.permission;return t===`granted`||t===`denied`?t:`default`}function nw(e,t){let n=new Map,r=[];for(let i of t??[]){let t={status:i.status,wantsAttention:Jr(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 rw(e){return e.enabled&&e.hidden&&e.permission===`granted`}function iw(e){let t=R(e).label;return{title:e.titleSummary??e.title,body:`Task ${t}`,tag:`cezar-run-${e.id}`}}function aw(){let e=V(),t=Fr(),[n,r]=Z.useState(!1),[i,a]=Z.useState(tw),o=t.data;Z.useEffect(()=>{o!==void 0&&r(ew(o.notifications).enabled)},[o]);let s=Z.useCallback(t=>{r(t),Tt({notifications:{enabled:t}}).then(t=>e.setQueryData(W.uiState,t)).catch(t=>{H(t instanceof Error?t.message:String(t),{tone:`danger`}),e.invalidateQueries({queryKey:W.uiState})})},[e]),c=Z.useCallback(e=>{if(!e){s(!1);return}if(tw()!=="default"){s(!0);return}s(!0),Notification.requestPermission().then(e=>a(e)).catch(()=>a(tw()))},[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)(Mh,{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 ow({open:e,onOpenChange:t}){let[n,r]=(0,Z.useState)(null),[i,a]=(0,Z.useState)(null),o=aa(),s=bi(),c=ce(),l=new Set((o.data?.projects??[]).map(e=>e.root)),u=e=>{r(e),a(null),s.reset()},d=zv(n,i);return(0,Q.jsx)(mp,{open:e,onOpenChange:t,children:(0,Q.jsxs)(_p,{"data-slot":`add-project-dialog`,className:`sm:max-w-lg`,children:[(0,Q.jsxs)(vp,{children:[(0,Q.jsx)(xp,{children:`Open local folder`}),(0,Q.jsx)(Sp,{children:`Pick the folder cezar should run in. Git repos are marked; any folder works.`})]}),(0,Q.jsxs)(yp,{className:`space-y-4`,children:[(0,Q.jsx)(Rv,{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)(Tv,{variant:`outline`,className:`shrink-0 text-[12px]`,children:`git`}):null,l.has(e.path)?(0,Q.jsx)(Tv,{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)(bp,{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)(A,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,Q.jsx)(A,{"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 sw(){let e=ca();return{isPending:e.isPending,confirm:(t,n)=>e.mutate(t.id,{onSuccess:()=>{H(`${t.name} removed from the workspace — its files are untouched`),n?.()},onError:e=>H(e.message,{tone:`danger`})})}}function cw({project:e,onOpenChange:t,onConfirm:n}){return(0,Q.jsx)(Ko,{open:e!==null,onOpenChange:t,children:(0,Q.jsxs)(Ro,{children:[(0,Q.jsxs)(Go,{children:[(0,Q.jsxs)(No,{children:[`Remove `,e?.name,` from the workspace?`]}),(0,Q.jsxs)(Mo,{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)(Ho,{children:[(0,Q.jsx)(Wo,{children:`Keep it`}),(0,Q.jsx)(Vo,{"data-action":`projects-confirm-remove`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:n,children:`Remove from list`})]})]})})}function lw({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 uw=1,dw={ok:`ok`,"not-git":`no git repo`,missing:`folder not found`};function fw(e){let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function pw(){let e=ai(),t=aa();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)(ra,{icon:(0,Q.jsx)(F,{}),tone:`danger`,title:`Project settings did not load`,subtitle:(e.error??t.error)?.message,heading:`h2`}):(0,Q.jsx)(mw,{config:e.data,registry:t.data})}function mw({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)(hw,{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)(hw,{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)(gw,{registry:t,workspaceMax:e.resources.maxParallel}),(0,Q.jsx)(A,{className:`self-start`,onClick:()=>r(!0),children:`Add project`}),n?(0,Q.jsx)(ow,{open:!0,onOpenChange:r}):null]})}function hw({configKey:e,value:t,title:n,hint:r,placeholder:i,slot:a,savedLabel:o,footer:s,refreshProjects:c=!1}){let l=V(),u=Lr({mutationFn:t=>De(e===`browseRoot`?{browseRoot:t}:{projectsDir:t}),onSuccess:t=>{l.setQueryData(W.config,t),e===`browseRoot`?l.invalidateQueries({queryKey:W.fsBrowseRoot}):c&&l.invalidateQueries({queryKey:W.projects})}}),[d,f]=(0,Z.useState)(t),p=d.trim(),m=p===t,h=u.isError?u.error.message:null;return(0,Q.jsxs)(lw,{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)(A,{type:`button`,variant:`outline`,size:`sm`,"data-action":`projects-save-${a}-root`,disabled:m||p===``||u.isPending,onClick:()=>u.mutate(p,{onSuccess:()=>H(`${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 gw({registry:e,workspaceMax:t}){let[n,r]=(0,Z.useState)(null),i=sw(),a=(0,Z.useMemo)(()=>Hr(e.projects),[e.projects]);return(0,Q.jsxs)(lw,{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)(_w,{project:n,isBoot:n.id===e.bootProject,workspaceMax:t,vocabulary:a,disabled:i.isPending,onRemove:()=>r(n)},n.id))})]})}),(0,Q.jsx)(cw,{project:n,onOpenChange:e=>!e&&r(null),onConfirm:()=>{if(!n)return;let e=n;r(null),i.confirm(e)}})]})}function _w({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:dw[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)(vw,{project:e,vocabulary:r})}),(0,Q.jsx)(`td`,{className:`px-3 py-2`,children:(0,Q.jsx)(yw,{project:e,workspaceMax:n})}),(0,Q.jsx)(`td`,{className:`px-3 py-2 tabular-nums text-soft-foreground`,children:fw(e.addedAt)}),(0,Q.jsxs)(`td`,{className:`px-3 py-2 text-right`,children:[e.status===`missing`?null:(0,Q.jsx)(A,{asChild:!0,variant:`outline`,className:`mr-2`,children:(0,Q.jsx)(Qt,{to:`/p/${encodeURIComponent(e.id)}`,children:`Open`})}),(0,Q.jsx)(A,{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 vw({project:e,vocabulary:t}){let n=ei(),[r,i]=(0,Z.useState)(``),[a,o]=(0,Z.useState)(!1),[c,l]=(0,Z.useState)(-1),u=(0,Z.useRef)(null),d=e.tags??[],f=Xi(t,d,r),p=a&&f.length>0,m=(t,r)=>{n.mutate({id:e.id,tags:t},{onSuccess:()=>H(r),onError:e=>H(e.message,{tone:`danger`})})},h=t=>{let n=t.trim().slice(0,32);if(l(-1),n){if(d.some(e=>e.toLowerCase()===n.toLowerCase())){i(``);return}if(d.length>=20){H(`${e.name} already has the maximum of 20 tags`,{tone:`danger`});return}i(``),m([...d,n],`${e.name} tagged \u201c${n}\u201d`)}},g=t=>{m(d.filter(e=>e!==t),`\u201c${t}\u201d removed from ${e.name}`)},_=`project-tag-suggestions-${e.id}`;return(0,Q.jsxs)(`div`,{"data-slot":`project-tags`,className:`flex flex-wrap items-center gap-1`,children:[d.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:()=>g(t),className:`rounded-full p-0.5 hover:bg-accent-strong/25 disabled:opacity-50`,children:(0,Q.jsx)(tt,{className:`size-3`,"aria-hidden":`true`})})]},t)),(0,Q.jsxs)(Co,{open:p,onOpenChange:o,children:[(0,Q.jsx)(yo,{asChild:!0,children:(0,Q.jsx)(`input`,{ref:u,type:`text`,"data-slot":`project-tag-input`,"aria-label":`Add a tag to ${e.name}`,role:`combobox`,"aria-expanded":p,"aria-controls":p?_:void 0,"aria-autocomplete":`list`,"aria-activedescendant":p&&c>=0?`${_}-${c}`:void 0,placeholder:d.length===0?`Add tag…`:`+`,value:r,maxLength:32,disabled:n.isPending,onFocus:()=>o(!0),onBlur:()=>o(!1),onChange:e=>{if(o(!0),l(-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(f.length===0)return;e.preventDefault(),o(!0);let t=e.key===`ArrowDown`?1:-1,n=c+t;l(n>=f.length?-1:n<-1?f.length-1:n);return}if(e.key===`Escape`&&p){e.preventDefault(),o(!1),l(-1);return}if(e.key===`Enter`||e.key===`,`){e.preventDefault(),h(c>=0?f[c]??r:r);return}if(e.key===`Tab`){o(!1);return}if(e.key===`Backspace`&&r===``&&d.length>0){e.preventDefault();let t=d[d.length-1];t!==void 0&&g(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)(xo,{align:`start`,sideOffset:4,id:_,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`}),f.map((e,t)=>(0,Q.jsx)(`button`,{type:`button`,id:`${_}-${t}`,role:`option`,"aria-selected":t===c,"data-slot":`project-tag-suggestion`,onMouseDown:e=>e.preventDefault(),onClick:()=>{h(e),u.current?.focus()},onMouseEnter:()=>l(t),className:s(`flex w-full items-center rounded-sm px-2 py-1 text-left text-[12px] font-medium text-accent-text`,t===c&&`bg-muted`),children:e},e))]})]})]})}function yw({project:e,workspaceMax:t}){let n=ei(),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:()=>H(a===null?`${e.name} inherits the workspace limit (${t})`:`${e.name} runs at most ${a} task${a===1?``:`s`} at a time`),onError:e=>H(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+uw).map(e=>(0,Q.jsx)(`option`,{value:e,children:e},e))]})}function bw(){let e=Rr();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)(ra,{icon:(0,Q.jsx)(tn,{}),tone:`danger`,title:`Prompt templates did not load`,subtitle:e.error.message,heading:`h2`}):(0,Q.jsx)(xw,{initial:Vp(e.data.promptTemplates)})}function xw({initial:e}){let t=V(),n=qr(),r=Rr(),[i,a]=(0,Z.useState)(e),[o,s]=(0,Z.useState)(``),[c,l]=(0,Z.useState)(``),u=Lr({mutationFn:e=>In({promptTemplates:e}),onSuccess:e=>{t.setQueryData(G.uiState,e),H(`Prompt templates saved`)},onError:e=>H(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)(Cw,{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)(x_,{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)(my,{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)(Sw,{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)(tt,{"aria-hidden":`true`,className:`size-3`})]},t))]}),(0,Q.jsx)(A,{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)(x_,{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)(my,{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)(A,{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:Kp(),label:e,text:t}]),s(``),l(``))},className:`self-start`,children:[(0,Q.jsx)(Lt,{"aria-hidden":`true`,className:`size-3.5`}),`Add template`]})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(A,{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)(A,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`prompt-templates-reset`,disabled:u.isPending,onClick:()=>a(Lp.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 Sw({label:e,skills:t,skillUsage:n,selected:r,onToggle:i}){let[a,o]=(0,Z.useState)(!1),[c,l]=(0,Z.useState)(``),u=(0,Z.useRef)(null),{mostUsed:d,project:f,global:p,ranked:m}=Sm(t,c,n),h=(e,t)=>{let n=r.includes(e.name);return(0,Q.jsxs)(Ap,{value:`skill ${e.name} ${e.path}`,keywords:gm(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:s(`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)(ze,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},e.path)};return(0,Q.jsxs)(Co,{open:a,onOpenChange:e=>{o(e),e||l(``)},children:[(0,Q.jsx)(vo,{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:s(`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)(le,{"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),t.length===0?`no skills found`:`apply with…`,(0,Q.jsx)(Ke,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Q.jsx)(xo,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Q.jsxs)(Cp,{shouldFilter:!1,children:[(0,Q.jsx)(Tp,{placeholder:`search skills…`,value:c,onValueChange:l,onInput:()=>u.current?.scrollTo(0,0)}),(0,Q.jsxs)(Ep,{ref:u,"data-slot":`prompt-template-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(m?m.length===0:d.length===0&&f.length===0&&p.length===0)?(0,Q.jsx)(Dp,{children:`Nothing matches.`}):null,m?m.length>0?(0,Q.jsx)(Op,{children:m.map(e=>h(e,rm(e)))}):null:(0,Q.jsxs)(Q.Fragment,{children:[d.length>0?(0,Q.jsx)(Op,{heading:`Most used`,children:d.map(e=>h(e,rm(e)))}):null,f.length>0?(0,Q.jsx)(Op,{heading:`Project skills`,children:f.map(e=>h(e,!0))}):null,p.length>0?(0,Q.jsx)(Op,{heading:`Global`,children:p.map(e=>h(e,!1))}):null]})]})]})})]})}function Cw({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 ww=1,Tw=1,Ew=60,Dw=256;function Ow(){let e=ai();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)(ra,{icon:(0,Q.jsx)(Jt,{}),tone:`danger`,title:`Resource settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,Q.jsx)(kw,{config:e.data})}function kw({config:e}){let t=V(),n=Lr({mutationFn:e=>De(e),onSuccess:e=>t.setQueryData(W.config,e),onError:e=>H(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<Tw||u>Ew,f=o===`park`?a===null:!d&&a===u,p=()=>n.mutate({resources:{monitoringWakeIntervalMinutes:o===`park`?null:u}},{onSuccess:()=>H(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:()=>H(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<Dw),v=(e.resources.memoryLimitMb??0)===(_?-1:g),y=()=>n.mutate({resources:{memoryLimitMb:g===0?null:g}},{onSuccess:()=>H(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)(lw,{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+ww).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)(Qt,{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)(lw,{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)(lw,{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)(Mh,{"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:Tw,max:Ew,"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)(A,{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)(lw,{title:`Auto-resume after a usage limit`,hint:`Resume eligible tasks once the provider usage limit resets.`,children:[(0,Q.jsx)(Mh,{"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)(lw,{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:Dw,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)(A,{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 `,Dw,` 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)(lw,{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.`})]})]})}var Aw=[[`overall`,`Overall`],[`needsYou`,`Needs You`],[`finished`,`Finished`],[`working`,`Working`]];function jw(){let e=c(),t=vr(e);return t.isPending?(0,Q.jsx)(`p`,{role:`status`,className:`p-4 text-sm text-muted-foreground`,children:`Loading sidebar settings…`}):t.isError?(0,Q.jsxs)(`div`,{className:`space-y-3 p-4`,children:[(0,Q.jsxs)(`p`,{role:`alert`,children:[`Sidebar settings did not load: `,t.error.message]}),(0,Q.jsx)(A,{className:`min-h-[44px]`,onClick:()=>void t.refetch(),children:`Retry`})]}):(0,Q.jsx)(Mw,{scope:e,initial:t.data.sidebarLimits??{}},e)}function Mw({scope:e,initial:t}){let n=V(),r=Na(void 0),i=Nw(t),[a,o]=(0,Z.useState)(()=>({values:i,saved:i,received:i})),{values:s,saved:c}=a,l=e=>o(t=>({...t,values:e})),u=Sa.safeParse(Object.fromEntries(Aw.map(([e])=>[e,s[e]===null?null:Number(s[e])]))),d=e=>s[e]!==null&&(s[e].trim()===``||!Number.isSafeInteger(Number(s[e]))||Number(s[e])<=0),f=Aw.some(([e])=>s[e]!==c[e]),p=Lr({onMutate:()=>n.cancelQueries({queryKey:[e,`ui-state`],exact:!0}),mutationFn:t=>In({sidebarLimits:t},e),onSuccess:async t=>{await n.cancelQueries({queryKey:[e,`ui-state`],exact:!0}),n.setQueryData([e,`ui-state`],t);let r=Nw(t.sidebarLimits);o({values:r,saved:r,received:r})}});return!p.isPending&&!Pw(a.received,i)&&o({values:f?s:i,saved:i,received:i}),(0,Q.jsxs)(`form`,{"data-slot":`sidebar-settings`,className:`flex w-full max-w-2xl flex-col gap-5 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6`,onSubmit:e=>{e.preventDefault(),u.success&&!Aw.some(([e])=>d(e))&&!p.isPending&&p.mutate(u.data)},children:[(0,Q.jsx)(`p`,{id:`sidebar-limits-help`,className:`text-sm text-muted-foreground`,children:`Limits apply to this project on desktop and mobile. The overall budget is shared in section order: Needs You, Finished, then Working. Each section also respects its own limit. Unlimited removes only that constraint.`}),(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Pinned tasks and groups containing a pin bypass both limits. A task group counts as one row. Archived uses only the overall limit; archived pins are not exempt.`}),Aw.map(([e,t])=>(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`label`,{htmlFor:`sidebar-${e}`,className:`text-sm font-medium`,children:t}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,Q.jsx)(`input`,{id:`sidebar-${e}`,type:`number`,inputMode:`numeric`,min:`1`,step:`1`,value:s[e]??``,disabled:s[e]===null||p.isPending,"aria-invalid":d(e),"aria-describedby":d(e)?`sidebar-${e}-error sidebar-limits-help`:`sidebar-limits-help`,onChange:t=>l({...s,[e]:t.target.value}),className:`min-h-[44px] w-28 rounded-md border border-input bg-card px-3 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50`}),(0,Q.jsxs)(`label`,{className:`flex min-h-[44px] cursor-pointer items-center gap-2 text-sm`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,"aria-label":`${t} Unlimited`,checked:s[e]===null,disabled:p.isPending,onChange:t=>l({...s,[e]:t.target.checked?null:String(r[e]??10)}),className:`size-4 accent-[var(--accent-strong)]`}),`Unlimited`]})]}),d(e)&&(0,Q.jsx)(`p`,{id:`sidebar-${e}-error`,className:`text-sm text-danger`,children:`Enter a positive whole number or choose Unlimited.`})]},e)),(0,Q.jsx)(A,{type:`submit`,className:`min-h-[44px] self-start`,variant:`primary`,disabled:!f||!u.success||Aw.some(([e])=>d(e))||p.isPending,children:p.isPending?`Saving…`:`Save sidebar limits`}),p.isError&&(0,Q.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Could not save sidebar limits: `,p.error.message]}),p.isSuccess&&!f&&(0,Q.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`Sidebar limits saved.`})]})}function Nw(e){let t=Na(e);return Object.fromEntries(Aw.map(([e])=>[e,t[e]===null?null:String(t[e])]))}function Pw(e,t){return Aw.every(([n])=>e[n]===t[n])}function Fw(){let e=Wa(),t=aa().data;return e===null?null:t?.projects.find(t=>t.id===e)?.root??null}function Iw(e){navigator.clipboard.writeText(e).then(()=>H(`Project folder copied`)).catch(()=>H(e))}function Lw(){let e=Fw();return e===null?null:(0,Q.jsx)(lw,{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:()=>Iw(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)(lt,{"aria-hidden":`true`,className:`size-4`}),`Copy path`]}),(0,Q.jsx)(Rw,{root:e})]})]})})}function Rw({root:e}){let t=ii(),n=Lr({mutationFn:e=>Ye(e),onError:e=>H(e.message,{tone:`danger`})}),r=(t.data?.targets??[]).filter(e=>Nv(e.id)===void 0).map(e=>({target:e}));return r.length===0?null:(0,Q.jsx)(Pv,{slot:`project-location-open`,label:`Open with`,triggerVariant:`outline`,title:e,disabled:n.isPending,choices:r,onPick:e=>n.mutate(e,{onSuccess:()=>H(`Opening the project folder in ${r.find(t=>t.target.id===e)?.target.label??e}`)})})}function zw({config:e}){let t=V(),n=kr(),r=Fw(),i=r===null?null:`${r.replace(/\/$/,``)}/.ai/cezar/config.json`,a=n.data?.capabilities?.localHandoff===!0,o=e.worktreeSetup?.commands??[],s=e.worktreeSetup?.timeoutSeconds??900,[c,l]=(0,Z.useState)(o.join(`
30
+ `)),[u,d]=(0,Z.useState)(String(s)),f=c.split(`
31
+ `).map(e=>e.trim()).filter(e=>e!==``),p=Number(u),m=f.length>20?`Enter at most 20 commands.`:f.some(e=>e.length>4e3)?`Keep each command under ${Pa.toLocaleString(`en-US`)} characters.`:u.trim()===``||!Number.isInteger(p)||p<1||p>7200?`Enter a whole number of seconds from 1 to ${ba}.`:null,h=e.worktreeSetupIssue===null&&f.length===o.length&&f.every((e,t)=>e===o[t])&&(f.length===0||p===s),g=Lr({mutationFn:e=>Ae(e),onSuccess:e=>{t.setQueryData(G.config,e),l(f.join(`
32
+ `)),H(f.length===0?`Worktree setup cleared`:`Worktree setup saved`)},onError:e=>H(e.message,{tone:`danger`})}),_=()=>g.mutate({worktreeSetup:f.length===0?null:{commands:f,...p===900?{}:{timeoutSeconds:p}}}),v=`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 read-only:bg-muted read-only:text-muted-foreground`;return(0,Q.jsxs)(lw,{title:`Prepare new worktrees`,hint:`Runs in every new task and worker worktree before the agent starts, in order, stopping at the first failure. Leave commands empty to skip setup.`,children:[o.length===0&&e.worktreeSetupIssue===null?(0,Q.jsx)(`p`,{"data-slot":`worktree-setup-empty`,className:`text-sm text-foreground`,children:`No setup commands configured. No commands will run in new worktrees.`}):null,(0,Q.jsx)(`textarea`,{"data-slot":`worktree-setup-commands`,"aria-label":`Worktree setup commands, one per line`,rows:4,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,value:c,readOnly:!a,disabled:g.isPending,onChange:e=>l(e.target.value),className:`${v} min-h-24 w-full resize-y font-mono text-[13px] leading-relaxed`}),(0,Q.jsxs)(`p`,{className:`text-xs text-soft-foreground`,children:[`Example only: `,(0,Q.jsx)(`code`,{children:`npm ci`}),`. Commands run only after they are saved.`]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-soft-foreground`,children:[(0,Q.jsx)(`span`,{children:`Timeout per command`}),(0,Q.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:1,max:ba,step:1,"data-slot":`worktree-setup-timeout`,value:u,readOnly:!a,disabled:g.isPending,onChange:e=>d(e.target.value),className:`${v} min-h-11 w-28 md:min-h-0`}),(0,Q.jsx)(`span`,{children:`seconds`})]}),(0,Q.jsx)(A,{type:`button`,variant:`primary`,size:`sm`,className:`min-h-11 self-start md:min-h-0`,"data-action":`worktree-setup-save`,disabled:!a||h||m!==null||g.isPending,onClick:_,children:`Save setup`})]}),n.data?.capabilities?.localHandoff===!1?(0,Q.jsxs)(`p`,{"data-slot":`worktree-setup-readonly`,className:`text-xs text-foreground`,children:[`Edit `,(0,Q.jsx)(`code`,{children:`worktreeSetup.commands`}),` in`,` `,i===null?(0,Q.jsxs)(Q.Fragment,{children:[`the project’s `,(0,Q.jsx)(`code`,{children:`.ai/cezar/config.json`})]}):(0,Q.jsx)(`code`,{className:`break-all`,children:i}),` `,`on the machine running Cezarion. Valid file edits apply to new worktrees; no restart is needed.`]}):null,e.worktreeSetupIssue===null?null:(0,Q.jsxs)(`p`,{"data-slot":`worktree-setup-issue`,className:`text-[11px] text-danger`,children:[`config.json has an invalid worktreeSetup (`,e.worktreeSetupIssue,`) — saving replaces it.`]}),m===null?null:(0,Q.jsx)(`p`,{"data-slot":`worktree-setup-invalid`,className:`text-[11px] text-danger`,children:m})]})}var Bw=0,Vw=1e3;function Hw(){let e=Ei();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)(ra,{icon:(0,Q.jsx)(hc,{}),tone:`danger`,title:`Worktree settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,Q.jsx)(Uw,{config:e.data})}function Uw({config:e}){let t=V(),n=Lr({mutationFn:e=>Ae(e),onSuccess:e=>t.setQueryData(G.config,e),onError:e=>H(e.message,{tone:`danger`})}),[r,i]=(0,Z.useState)(String(e.worktreeRetention)),a=Number(r),o=r.trim()===``||!Number.isInteger(a)||a<Bw||a>Vw,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)(lw,{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:Bw,max:Vw,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)(A,{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:G.worktrees}),H(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 `,Bw,` to `,Vw,` (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.jsx)(zw,{config:e}),(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)(me,{"aria-hidden":`true`,className:`size-[14px]`})]})]})}function Ww(e,t){return function(){return(0,Q.jsx)(ra,{icon:(0,Q.jsx)(t,{}),tone:`neutral`,title:e,subtitle:`This section arrives in a later phase of the redesign.`,heading:`h2`})}}var Gw=[{id:`sidebar`,title:`Sidebar`,description:`Overall and per-section task limits for this project.`,icon:Jt,component:jw,scope:`project`},{id:`agents`,title:`Agents`,description:`Default runner, models and system prompt.`,icon:Pe,component:xy,scope:`project`},{id:`agent-config`,title:`Agent config`,description:`Edit the coding agents’ own config files, per scope.`,icon:pc,component:ly,scope:`project`},{id:`worktrees`,title:`Worktrees`,description:`How many finished task worktrees this project keeps on disk.`,icon:hc,component:Hw,scope:`project`},{id:`bookmarklets`,title:`Bookmarklets`,description:`Launch skills from a GitHub PR or issue.`,icon:Ws,component:ZC,scope:`project`},{id:`prompt-templates`,title:`Prompt templates`,description:`Reusable snippets for follow-up instructions.`,icon:mc,component:bw,scope:`project`},{id:`appearance`,title:`Appearance`,description:`Theme, accent and density.`,icon:Mt,component:JC,scope:`global`},{id:`notifications`,title:`Notifications`,description:`Browser notifications when an agent needs you.`,icon:fn,component:aw,scope:`global`},{id:`resources`,title:`Resources`,description:`Parallel tasks and per-task memory limit, across every project.`,icon:Jt,component:Ow,scope:`global`},{id:`tasks`,title:`Tasks`,description:`Automatic task archiving after pull requests merge.`,icon:hc,component:Sv,scope:`global`},{id:`accounts`,title:`Agent accounts`,description:`Second logins, and the agent and models a project uses when it has chosen none.`,icon:xn,component:Kv,scope:`global`},{id:`projects`,title:`Projects`,description:`The workspace registry and where GitHub checkouts land.`,icon:F,component:pw,scope:`global`},{id:`keyboard`,title:`Keyboard`,description:`Shortcuts.`,icon:Tc,component:Ww(`Keyboard`,Tc),scope:`global`,hidden:!0}];function Kw(e,t){return Gw.filter(n=>!n.hidden&&n.scope===e&&!(t?.singleProject===!0&&n.id===`projects`))}var qw=[`done`,`failed`,`cancelled`],Jw=[`done`,`failed`];function Yw(e){return qw.includes(e)}function Xw(e){return e.archived||ve(e)||!Jw.includes(e.status)?!1:e.finishedAt!==void 0}function Zw(e){let t=e.finishedAt;return t===void 0||!Xw(e)?!1:e.seenAt===void 0||e.seenAt<t}function Qw(e){return!ve(e)&&Yw(e.status)&&!Zw(e)}function $w(e){return e.reduce((e,t)=>Di(t)||!Zw(t)?e:e+1,0)}function eT(e){return e.status===`failed`?`danger`:`success`}var tT={needsYou:0,failedUnread:0,inMotion:0,finishedUnread:0};function nT(e){let t={...tT};for(let n of e){if(n.archived||Di(n))continue;let e=R(n);e.bucket===`waiting`?t.needsYou+=1:e.tone===`running`?t.inMotion+=1:Zw(n)&&(n.status===`failed`?t.failedUnread+=1:n.status===`done`&&(t.finishedUnread+=1))}return t}function rT(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,nT(t)]))}function iT(e,t,n={}){if(n.unknown)return`${e} · activity unknown`;let r=aT(t).map(e=>e.text);return[e,r.length>0?r.join(` · `):`idle`].join(` · `)}function aT(e){let{needsYou:t,failedUnread:n,inMotion:r,finishedUnread:i}=e??tT,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 oT(e){let t={...tT};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 sT(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 cT=`w-[228px] rounded-[10px] border-border bg-sidebar p-[5px] text-foreground shadow-[0_10px_28px_#00000047] motion-reduce:animate-none`,lT=`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 uT(){let e=Wa(),t=kr(),n=aa(),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 dT({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}=uT(),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?sT(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)(fT,{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 fT({projectId:e,onNavigate:t,triggerRef:n,triggerClassName:r,align:i=`start`,alignOffset:a,side:o,onOpenChange:c}){let l=OF(),u=kr(),d=aa(),[p,m]=(0,Z.useState)(!1),h=d.data?.bootProject??u.data?.bootProject,g=Zr(e??`default`,e!==null,e===h),_=_a(e??`default`,e===h?`default`:e??`default`),v=(0,Z.useRef)(e);v.current=e;let y=d.data?.projects.find(t=>t.id===e),b=e===h?u.data?.repo:void 0,x=y?.root??b?.root,S=u.data?.capabilities.localHandoff===!0,C=(g.data??[]).filter(e=>!Di(e)&&Zw(e)),w=g.isError?`Unavailable`:g.data===void 0?`Loading…`:`${C.length} unread`;async function T(){m(!0);let t=0;try{for(let n of C){if(v.current!==e)break;try{await _.mutateAsync(n.id)}catch{t+=1}}t>0&&H(`Could not mark ${t} task${t===1?``:`s`} read. Try again.`,{tone:`danger`})}finally{m(!1)}}async function E(){if(x)try{await navigator.clipboard.writeText(x),H(`Project folder copied`)}catch{H(`Could not copy path: ${x}`,{tone:`danger`})}}return(0,Q.jsxs)(Kn,{...f({onOpenChange:c}),children:[(0,Q.jsx)(Mn,{asChild:!0,children:(0,Q.jsx)(`button`,{"data-slot":`project-menu-trigger`,ref:n,type:`button`,"aria-label":`Project menu`,className:s(`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)(uc,{"aria-hidden":`true`,className:`size-[15px]`})})}),(0,Q.jsxs)(Rn,{align:i,...f({alignOffset:a,side:o}),sideOffset:4,className:cT,children:[(0,Q.jsxs)(cn,{className:lT,disabled:p||g.isError||g.data===void 0||C.length===0||e===null,onSelect:()=>{T()},children:[(0,Q.jsx)(Js,{"aria-hidden":`true`}),` Mark all read`,(0,Q.jsx)(`span`,{className:`ml-auto text-[11.5px] text-soft-foreground`,children:p?`Marking…`:w})]}),(0,Q.jsx)(yn,{className:`mx-0`}),S&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(pT,{projectId:e??`default`,disabled:!x||y?.status===`missing`}),(0,Q.jsxs)(cn,{className:lT,disabled:!x,onSelect:()=>{E()},children:[(0,Q.jsx)(ac,{"aria-hidden":`true`}),` Copy path`]}),(0,Q.jsx)(yn,{className:`mx-0`})]}),(0,Q.jsx)(cn,{asChild:!0,className:lT,children:(0,Q.jsxs)(X,{to:`/settings`,onClick:t??l,children:[(0,Q.jsx)(zc,{"aria-hidden":`true`}),` Project settings`]})})]})]})}function pT({disabled:e,projectId:t}){let n=ii(),r=Lr({mutationFn:e=>Ye(e,t),onError:e=>H(e.message,{tone:`danger`}),onSuccess:()=>H(`Opening project folder`)}),i=(n.data?.targets??[]).filter(e=>Nv(e.id)===void 0);return(0,Q.jsxs)(Xn,{children:[(0,Q.jsxs)(Yt,{className:lT,disabled:e||r.isPending,children:[(0,Q.jsx)(So,{"aria-hidden":`true`}),` Open in`]}),(0,Q.jsx)(On,{children:(0,Q.jsxs)(Ut,{className:cT,children:[i.map(e=>{let t=Mv(e);return(0,Q.jsxs)(cn,{className:lT,"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)(cn,{className:lT,disabled:!0,children:n.isError?`Apps unavailable`:n.isPending?`Loading apps…`:`No apps available`})]})})]})}function mT({...e}){return(0,Q.jsx)(Tl,{"data-slot":`collapsible`,...e})}function hT({...e}){return(0,Q.jsx)(bl,{"data-slot":`collapsible-trigger`,...e})}function gT({...e}){return(0,Q.jsx)(Sl,{"data-slot":`collapsible-content`,...e})}var _T={"needs-you":{label:`Needs you`,hint:`Asks a question, asks for permission, or waits for review`},failed:{label:`Failed`,hint:`Failed, with no scheduled resume`},done:{label:`Done`,hint:`Finished`},cancelled:{label:`Cancelled`,hint:`Was cancelled`},running:{label:`Running`,hint:`Runs an agent turn`},"waiting-workers":{label:`Waiting for agents`,hint:`Waits on its workers or their replies`},"waiting-ci":{label:`Waiting on CI`,hint:`Waits on a pull request's checks`},"waiting-timer":{label:`Waiting`,hint:`Waits on a timer`},"waiting-other":{label:`Any other wait`,hint:`Waits on anything else, including wait types added later`}},vT=(e,t)=>e.length===t.length&&e.every(e=>t.includes(e)),yT={name:``,description:``,url:``,token:``,tasks:!0,triggers:Ue,agent:!1};function bT(e){return{name:e.name,description:e.description??``,url:e.url,token:``,tasks:e.tasks,triggers:e.triggers??Ue,agent:e.agent}}var xT=e=>_n.filter(t=>e.includes(t));function ST(e){let t=e.description.trim();return{name:e.name.trim(),url:e.url.trim(),...t?{description:t}:{},...e.token?{token:e.token}:{},tasks:e.tasks,...vT(e.triggers,Ue)?{}:{triggers:xT(e.triggers)},agent:e.agent}}function CT(e,t){let n={},r=e.name.trim(),i=e.description.trim(),a=e.url.trim();return r!==t.name&&(n.name=r),i!==(t.description??``)&&(n.description=i),a!==t.url&&(n.url=a),e.token&&(n.token=e.token),e.tasks!==t.tasks&&(n.tasks=e.tasks),vT(e.triggers,t.triggers??Ue)||(n.triggers=xT(e.triggers)),e.agent!==t.agent&&(n.agent=e.agent),n}var wT=`flex flex-col gap-1 text-[13px]`,TT=`text-[11px] text-muted-foreground`;function ET({draft:e,onChange:t,tokenSet:n}){let r=(0,Z.useId)(),i=(0,Z.useId)(),a=(0,Z.useId)(),o=(0,Z.useId)(),s=(0,Z.useId)(),c=(0,Z.useId)(),l=(0,Z.useId)(),u=(0,Z.useId)(),d=(0,Z.useId)(),f=(0,Z.useId)();return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(min(100%,14rem),1fr))] gap-3`,children:[(0,Q.jsxs)(`div`,{className:wT,children:[(0,Q.jsx)(`label`,{htmlFor:r,className:TT,children:`Name`}),(0,Q.jsx)(x_,{id:r,"data-slot":`webhook-name`,autoComplete:`off`,maxLength:80,placeholder:`e.g. Team bot`,value:e.name,onChange:e=>t({name:e.target.value})})]}),(0,Q.jsxs)(`div`,{className:wT,children:[(0,Q.jsx)(`label`,{htmlFor:o,className:TT,children:`URL`}),(0,Q.jsx)(x_,{id:o,"data-slot":`webhook-url`,type:`url`,inputMode:`url`,autoComplete:`off`,spellCheck:!1,maxLength:fe,placeholder:`https://bot.example/hooks/cez`,value:e.url,onChange:e=>t({url:e.target.value})})]})]}),(0,Q.jsxs)(`div`,{className:wT,children:[(0,Q.jsx)(`label`,{htmlFor:i,className:TT,children:`Description`}),(0,Q.jsx)(my,{id:i,"data-slot":`webhook-description`,"aria-describedby":a,rows:2,maxLength:or,placeholder:`e.g. Posts to the #releases channel. Use it for release notes.`,value:e.description,onChange:e=>t({description:e.target.value})}),(0,Q.jsx)(`span`,{id:a,className:`text-[11px] text-soft-foreground`,children:`Agents read the name and description to decide when to use this webhook.`})]}),(0,Q.jsxs)(`div`,{className:wT,children:[(0,Q.jsx)(`label`,{htmlFor:s,className:TT,children:`Token`}),(0,Q.jsx)(x_,{id:s,"data-slot":`webhook-token`,type:`password`,autoComplete:`new-password`,spellCheck:!1,maxLength:st,"aria-describedby":c,placeholder:n?`Token set — type to replace`:`Optional Bearer token`,value:e.token,onChange:e=>t({token:e.target.value})}),(0,Q.jsx)(`span`,{id:c,className:`text-[11px] text-soft-foreground`,children:n?`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. It is sent as a Bearer header.`})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsxs)(`div`,{className:`flex min-h-11 items-center gap-3`,children:[(0,Q.jsx)(Mh,{id:l,"aria-describedby":u,"data-slot":`webhook-tasks`,checked:e.tasks,onCheckedChange:e=>t({tasks:e})}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-col text-[13px]`,children:[(0,Q.jsx)(`label`,{htmlFor:l,className:`font-medium`,children:`Task notifications`}),(0,Q.jsx)(`span`,{id:u,className:`text-[11px] text-soft-foreground`,children:`Tasks you hand off, or start with notify on, send their status here.`})]})]}),e.tasks?(0,Q.jsxs)(`fieldset`,{"data-slot":`webhook-triggers`,className:`flex flex-col gap-1 sm:ps-[3.25rem]`,children:[(0,Q.jsx)(`legend`,{className:`pbe-1 text-[11px] text-muted-foreground`,children:`Send a delivery when a task enters`}),(0,Q.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(min(100%,15rem),1fr))] gap-x-3`,children:_n.map(n=>(0,Q.jsxs)(`label`,{className:`flex min-h-11 items-start gap-2.5 pbs-2 text-[13px]`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,"data-trigger":n,checked:e.triggers.includes(n),onChange:r=>t({triggers:r.target.checked?[...e.triggers,n]:e.triggers.filter(e=>e!==n)}),className:`mbs-0.5 size-[18px] shrink-0`}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:_T[n].label}),(0,Q.jsx)(`span`,{className:`text-[11px] text-soft-foreground`,children:_T[n].hint})]})]},n))}),(0,Q.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Handing a task off and Send test always deliver.`})]}):null]}),(0,Q.jsxs)(`div`,{className:`flex min-h-11 items-center gap-3`,children:[(0,Q.jsx)(Mh,{id:d,"aria-describedby":f,"data-slot":`webhook-agent`,checked:e.agent,onCheckedChange:e=>t({agent:e})}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-col text-[13px]`,children:[(0,Q.jsx)(`label`,{htmlFor:d,className:`font-medium`,children:`Let agents send reports`}),(0,Q.jsx)(`span`,{id:f,className:`text-[11px] text-soft-foreground`,children:`Agents in this project may post a report here when the task calls for it.`})]})]})]})}var DT=`max-sm:h-11`,OT=(e,t)=>({tone:`alert`,text:`Not saved: ${e.message}. Fix the field and select ${t} again.`}),kT=e=>e.dryRun?{tone:`ok`,text:`Dry run: nothing was sent.`}:e.ok?{tone:`ok`,text:`Delivered (HTTP ${e.status??200}).`}:{tone:`danger`,text:`Not delivered: ${e.error??`unknown error`}.`};function AT({feedback:e}){return e?(0,Q.jsx)(`p`,{"data-slot":e.tone===`alert`?`webhook-error`:`webhook-result`,role:e.tone===`alert`?`alert`:`status`,className:e.tone===`ok`?`text-[13px] text-muted-foreground`:`text-[13px] text-danger`,children:e.text}):null}var jT=`rounded-md border border-border bg-background`,MT=`flex flex-col gap-3 border-bs border-border p-3`;function NT({projectId:e,webhook:t,defaultOpen:n=!1}){let r=va(),i=Ci(),a=jr(),[o,s]=(0,Z.useState)(n),[c,l]=(0,Z.useState)(()=>bT(t)),[u,d]=(0,Z.useState)(null),f=CT(c,t),p=Object.keys(f).length>0,m=c.name.trim()!==``&&c.url.trim()!==``,h=r.isPending||i.isPending||a.isPending,g={projectId:e,webhookId:t.id},_=e=>r.mutate({...g,...f},{onSuccess:()=>{l(e=>({...e,token:``})),e?e():H(`${c.name.trim()} saved`)},onError:e=>d(OT(e,`Save`))}),v=()=>a.mutate(g,{onSuccess:e=>d(kT(e)),onError:e=>d({tone:`danger`,text:e.message})});return(0,Q.jsx)(`li`,{"data-slot":`webhook-card`,"data-webhook-id":t.id,className:jT,children:(0,Q.jsxs)(mT,{open:o,onOpenChange:s,children:[(0,Q.jsx)(hT,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-action":`webhook-toggle`,className:`group flex min-h-11 w-full items-center gap-3 rounded-md p-3 text-start focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-foreground pointer-hover:bg-muted/50 active:bg-muted/50`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,Q.jsx)(`span`,{"data-slot":`webhook-card-name`,className:`min-w-0 break-words text-[13px] font-medium`,children:t.name}),t.tasks?(0,Q.jsx)(Tv,{variant:`secondary`,"data-badge":`tasks`,children:`Task notifications`}):null,t.agent?(0,Q.jsx)(Tv,{variant:`secondary`,"data-badge":`agent`,children:`Agents`}):null]}),(0,Q.jsx)(`span`,{"data-slot":`webhook-card-url`,className:`truncate text-[12px] text-muted-foreground`,children:gg(t.url)})]}),(0,Q.jsx)(Ke,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground group-data-[state=open]:rotate-180`})]})}),(0,Q.jsx)(gT,{children:(0,Q.jsxs)(`form`,{"data-slot":`webhook-form`,className:MT,onSubmit:e=>{e.preventDefault(),d(null),m&&p&&_()},children:[(0,Q.jsx)(ET,{draft:c,tokenSet:t.tokenSet,onChange:e=>l(t=>({...t,...e}))}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(A,{type:`submit`,size:`sm`,className:DT,"data-action":`webhook-save`,disabled:h||!m||!p,children:`Save`}),(0,Q.jsx)(A,{type:`button`,size:`sm`,className:DT,variant:`outline`,"data-action":`webhook-test`,disabled:h||!m,onClick:()=>{d(null),p?_(v):v()},children:`Send test`}),t.tokenSet?(0,Q.jsx)(A,{type:`button`,size:`sm`,className:DT,variant:`ghost`,"data-action":`webhook-clear-token`,disabled:h,onClick:()=>r.mutate({...g,token:``},{onSuccess:()=>H(`Webhook token cleared`),onError:e=>d({tone:`danger`,text:`Token not cleared: ${e.message}.`})}),children:`Clear token`}):null,(0,Q.jsx)(A,{type:`button`,size:`sm`,className:DT,variant:`danger-ghost`,"data-action":`webhook-remove`,"aria-label":`Remove ${t.name}`,disabled:h,onClick:()=>i.mutate(g,{onSuccess:()=>H(`${t.name} removed`),onError:e=>d({tone:`danger`,text:`Not removed: ${e.message}.`})}),children:`Remove`})]}),(0,Q.jsx)(AT,{feedback:u})]})})]})})}function PT({projectId:e,onCreated:t,onCancel:n}){let r=pa(),[i,a]=(0,Z.useState)(yT),[o,s]=(0,Z.useState)(null),c=i.name.trim()!==``&&i.url.trim()!==``;return(0,Q.jsxs)(`li`,{"data-slot":`webhook-card`,"data-draft":``,className:jT,children:[(0,Q.jsx)(`p`,{className:`p-3 text-[13px] font-medium`,children:`New webhook`}),(0,Q.jsxs)(`form`,{"data-slot":`webhook-form`,"aria-label":`New webhook`,className:MT,onSubmit:n=>{n.preventDefault(),s(null),c&&r.mutate({projectId:e,...ST(i)},{onSuccess:({webhook:e})=>{H(`${e.name} created`),t(e)},onError:e=>s(OT(e,`Create`))})},children:[(0,Q.jsx)(ET,{draft:i,tokenSet:!1,onChange:e=>a(t=>({...t,...e}))}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(A,{type:`submit`,size:`sm`,className:DT,"data-action":`webhook-create`,disabled:r.isPending||!c,children:`Create`}),(0,Q.jsx)(A,{type:`button`,size:`sm`,className:DT,variant:`ghost`,"data-action":`webhook-cancel`,disabled:r.isPending,onClick:n,children:`Cancel`})]}),(0,Q.jsx)(AT,{feedback:o})]})]})}function FT({project:e}){let t=e.webhooks??[],[n,r]=(0,Z.useState)(!1),[i,a]=(0,Z.useState)(null),o=t.length>=16;return(0,Q.jsx)(lw,{title:`Webhooks`,hint:`A webhook gets a POST from cezar. Tasks can send their status to it, and agents can send it reports.`,children:(0,Q.jsxs)(`div`,{"data-slot":`project-webhooks`,className:`flex flex-col gap-3`,children:[t.length===0&&!n?(0,Q.jsx)(`p`,{"data-slot":`webhooks-empty`,className:`text-[13px] text-soft-foreground`,children:`No webhooks yet. Add one to send task updates to a bot, or to let agents post reports.`}):null,t.length>0||n?(0,Q.jsxs)(`ul`,{className:`flex flex-col gap-2`,children:[t.map(t=>(0,Q.jsx)(NT,{projectId:e.id,webhook:t,defaultOpen:t.id===i},t.id)),n?(0,Q.jsx)(PT,{projectId:e.id,onCancel:()=>r(!1),onCreated:e=>{a(e.id),r(!1)}}):null]}):null,n?null:(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsxs)(A,{type:`button`,size:`sm`,variant:`outline`,className:`max-sm:h-11`,"data-action":`webhook-add`,disabled:o,onClick:()=>r(!0),children:[(0,Q.jsx)(Ic,{"aria-hidden":`true`}),`Add webhook`]}),o?(0,Q.jsxs)(`span`,{className:`text-[11px] text-soft-foreground`,children:[`A project holds at most `,16,` webhooks.`]}):null]})]})})}function IT(e){let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleDateString(void 0,{year:`numeric`,month:`short`,day:`numeric`})}function LT({capabilities:e}){let t=Wa(),n=aa(),r=ai();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)(Lw,{}),(0,Q.jsx)(RT,{project:a,canRemove:o}),o?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(lw,{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)(yw,{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)(FT,{project:a},a.id)]}):null]}),o?(0,Q.jsx)(`section`,{className:`rounded-lg border border-border bg-card p-5`,children:(0,Q.jsx)(zT,{project:a,bootProject:i.bootProject})}):null]})}function RT({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:[dw[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:[IT(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:IT(e.lastOpenedAt)})]})]})}function zT({project:e,bootProject:t}){let[n,r]=(0,Z.useState)(null),i=sw(),a=ce(),o=e.id===t;return(0,Q.jsxs)(lw,{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)(A,{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)(cw,{project:n,onOpenChange:e=>!e&&r(null),onConfirm:()=>{r(null),i.confirm(e,()=>void a(`/p/${encodeURIComponent(t)}`))}})]})}function BT(e,t){return e===`global`?`/settings/global/${t}`:`/settings/${t}`}var VT=BT(`global`,`appearance`);function HT(e){return e===`global`?{Link:Qt,NavLink:jt}:{Link:X,NavLink:$a}}function UT({scope:e,title:t,mobileTitle:n}){let r=uT().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 WT({scope:e,activeId:t,capabilities:n}){let{NavLink:r}=HT(e),i=Kw(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)(Ke,{"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:BT(e,t.id),"data-section":t.id,children:t.title},t.id))]})]},`${e}-${t}`)}function GT({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)(UT,{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)(WT,{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 KT({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)(UT,{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)(WT,{scope:`project`,activeId:null,capabilities:e}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-5`,children:[(0,Q.jsx)(LT,{capabilities:e}),(0,Q.jsx)(`section`,{className:`rounded-lg border border-border bg-card p-5`,children:(0,Q.jsx)(xv,{})}),(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:Kw(`project`,e).map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(X,{to:BT(`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)(me,{"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)(Qt,{to:VT,"data-slot":`settings-global-link`,className:`underline underline-offset-2 hover:text-foreground`,children:`Global settings`}),`.`]})]})]})]})}function qT(e){if(e<1e3)return String(e);let t=[`k`,`M`,`B`,`T`],n=Math.floor(Math.log10(e)/3);return n>t.length?e.toExponential(0).replace(`+`,``):`${Math.floor(e/1e3**n)}${t[n-1]}`}function JT({stat:e,className:t,compact:n=!1}){let r=`+${e.adds} −${e.dels} across ${e.files} ${e.files===1?`file`:`files`}`,i=e.repointed?`${r} — measured against another branch checked out in this task's worktree, as this task found it`:void 0;return(0,Q.jsxs)(`span`,{"data-slot":`diff-stat`,...i?{"data-repointed":`true`,"aria-label":i}:{},...n&&!i?{"aria-label":r}:{},title:i??r,className:s(`font-mono text-xs font-semibold tabular-nums`,e.repointed&&`cursor-help underline decoration-dotted underline-offset-2`,t),children:[(0,Q.jsxs)(`span`,{className:`text-success`,children:[`+`,n?qT(e.adds):e.adds.toLocaleString(`en-US`)]}),` `,(0,Q.jsxs)(`span`,{className:`text-danger`,children:[`−`,n?qT(e.dels):e.dels.toLocaleString(`en-US`)]})]})}function YT(e){return e===void 0?`unknown`:new Intl.NumberFormat().format(e)}function XT(e,t){return`Input tokens: ${YT(e)}; output tokens: ${YT(t)}`}function ZT(e,t,n=`compact`){let r=e===void 0?`—`:Qa(e),i=t===void 0?`—`:Qa(t);return n===`table`?`${r} / ${i}`:`IN ${r} · OUT ${i}`}function QT({inputTokens:e,outputTokens:t,variant:n=`compact`,omitWhenUnknown:r=!0,className:i,title:a}){return r&&e===void 0&&t===void 0?null:(0,Q.jsx)(`span`,{"data-slot":`directional-usage`,"aria-label":XT(e,t),title:a,className:s(`font-mono tabular-nums`,i),children:ZT(e,t,n)})}function $T(e,t){let[n,r]=(0,Z.useState)(!1),[i,a]=(0,Z.useState)(``),o=(0,Z.useRef)(!1);return{editing:n,draft:i,setDraft:a,begin:()=>{a(e),o.current=!1,r(!0)},commit:()=>{if(o.current)return;o.current=!0,r(!1);let n=i.trim();n.length===0||n===e||t(n)},cancel:()=>{o.current=!0,r(!1)}}}function eE({editor:e,className:t}){return(0,Q.jsx)(`input`,{"data-slot":`title-input`,"aria-label":`Task title`,autoFocus:!0,value:e.draft,onChange:t=>e.setDraft(t.target.value),onBlur:e.commit,onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),e.commit()):t.key===`Escape`&&(t.preventDefault(),e.cancel())},className:s(`w-full min-w-0 rounded-sm border border-border bg-card px-1.5 py-0.5 outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,t)})}function tE({className:e,dot:t,shape:n=`filled`,pulse:r=!1,children:i,...a}){return(0,Q.jsxs)(`span`,{"data-slot":`pill`,className:s(`inline-flex items-center gap-1.5 rounded-full bg-muted px-2.5 py-[3px] text-xs font-medium whitespace-nowrap text-muted-foreground`,e),...a,children:[t?(0,Q.jsx)(eo,{tone:t,shape:n,pulse:r}):null,i]})}function nE({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:s(`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)(Fc,{"data-slot":`pin-icon`,className:`size-[12px]`,fill:e?`currentColor`:`none`,"aria-hidden":`true`})})}function rE(e){let t=e.currentStepId?e.steps.find(t=>t.id===e.currentStepId):void 0;if(t?.backend)return t.backend;if(e.runner)return e.runner;for(let t=e.steps.length-1;t>=0;--t){let n=e.steps[t]?.backend;if(n)return n}return`claude`}var iE={claude:`Claude Code`,codex:`Codex`,opencode:`OpenCode`,pi:`pi`,cursor:`Cursor`,omp:`OMP`};function aE(e){return e.runner??`claude`}function oE(e,t){let n=Pt(t,e);return n?.enabled===!1?{provider:e,usable:!1,reason:`${iE[e]} is disabled. Enable it in Settings → Agents → Providers.`}:n?.status===`connected`?{provider:e,usable:!0}:{provider:e,usable:!1,reason:`${iE[e]} credentials are unavailable. Authorize it in Settings → Agents → Providers.`}}function sE(e,t){return oE(rE(e),t)}function cE(e,t){return oE(aE(e),t)}function lE(e){let t=Wi(),n=rE(e);return t.isSuccess&&t.data?sE(e,t.data):{provider:n,usable:!0}}function uE(e){let t=Wi(),n=aE(e);return t.isSuccess&&t.data?cE(e,t.data):t.isError?{provider:n,usable:!1,reason:`Provider authentication could not be verified.`}:{provider:n,usable:!1,reason:`Checking agent providers…`}}function dE(e){return[...e.steps].reverse().find(e=>e.sessionId)?.sessionId}function fE(e){return[...e.steps].reverse().find(e=>e.sessionId)?.backend??e.runner??`claude`}var pE=/^[A-Za-z0-9._][A-Za-z0-9._-]{0,199}$/;function mE(e,t){if(pE.test(t))switch(e){case`codex`:return`codex resume ${t}`;case`cursor`:return;case`opencode`:return`opencode --session ${t}`;case`pi`:return`pi --session ${t}`;case`omp`:return;default:return`claude --resume ${t}`}}function hE(e){if(br(e))return;let t=dE(e);if(t===void 0||!pE.test(t))return;let n=fE(e),r=n===`cursor`||n===`omp`?e.cliResumeCommand:mE(n,t);if(r!==void 0)return e.worktreePath?`cd ${e.worktreePath} && ${r}`:r}function gE(e,t){let n=Nv(t);return!n||br(e)?!1:n===fE(e)&&dE(e)!==void 0}function _E(e){return(e.status===`failed`||ve(e))&&(e.waits?.length??0)>0}function vE(e){return e.status===`cancelled`&&e.startedAt===void 0&&e.workflowDef!==void 0&&e.steps.every(e=>e.status===`pending`&&e.startedAt===void 0&&!e.sessionId)}function yE(e){let t=br(e),n=dE(e)!==void 0;return{finish:e.status===`waiting`&&t||e.status===`review`,continueRun:!t&&!e.stopping&&e.delegation?.role!==`invalid`&&!(e.delegation?.role===`worker`&&e.delegation.destroy)&&(n||vE(e)),terminal:!t&&n,notes:!0,archive:!t,pin:!e.archived&&!Di(e),markUnread:Xw(e)&&!Zw(e),cancel:t||_E(e),deleteRun:!t}}function bE(e){let t=yE(e);return t.archive&&!t.cancel&&!e.archiveBlocker}function xE(e){return e.status===`waiting`&&e.finishBlocked===null&&R(e).bucket===`waiting`}function SE(e){return`Merge head branch and resolve conflicts in ${e?`PR number ${e}`:`this pull request`}`}function CE(e){return e===`review`?`Accept the changes without a PR`:`Close the session`}function wE(e,t){let n=e.filter(e=>!e.archived&&e.status===`queued`).sort((e,t)=>e.createdAt.localeCompare(t.createdAt)).findIndex(e=>e.id===t);return n>=0?n+1:void 0}var TE=[50,100,200,400,800,1e3,1e3,1e3,1e3],EE=e=>new Promise(t=>setTimeout(t,e));function DE(e){return e instanceof ft&&e.status===409&&e.message===`run is still active`}async function OE(e,t=EE){for(let n=0;;n+=1)try{return await e()}catch(e){let r=TE[n];if(!DE(e)||r===void 0)throw e;await t(r)}}function kE(e){return br(e)?`live`:yE(e).continueRun?`resume`:`unavailable`}function AE(e,t){let n=Kr(e.id,t),r=la(e.id,t),i=lE(e),a=uE(e),[o,s]=(0,Z.useState)(void 0),[c,l]=(0,Z.useState)(!1),u=(0,Z.useRef)(!1),d=kE(e),f=d===`resume`?!a.usable:d===`live`&&!i.usable,p=d===`unavailable`?`no-session`:f?`provider`:void 0,m=p===`no-session`?`This session has ended and no agent session was recorded, so the answer cannot be delivered.`:p===`provider`?d===`resume`?a.reason:i.reason:void 0,h=(e,t)=>a.usable?r.mutateAsync({text:e,...t===void 0?{}:{images:t}}):Promise.reject(Error(a.reason??`The run provider is unavailable.`));return{mode:d,blockedBy:p,reason:m,isPending:c||n.isPending||r.isPending,error:o,send:async(t,r)=>{if(p||u.current)return m;u.current=!0,l(!0),s(void 0);try{if(d===`resume`){await OE(()=>h(t,r));return}try{await n.mutateAsync({text:t,...r===void 0?{}:{images:r}})}catch(n){if(n instanceof ft&&n.status===409&&dE(e)!==void 0){try{await OE(()=>h(t,r))}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`Session closed. Retry to reopen the session. ${t}`)}return}throw n}return}catch(e){let t=e instanceof Error?e.message:String(e);return s(t),t}finally{u.current=!1,l(!1)}}}}function jE({run:e,projectId:t,prNumber:n}){let r=AE(e,t),i=ko(),[a,o]=(0,Z.useState)(!1),s=a||r.isPending,c=!!r.blockedBy,l=async()=>{if(s||c)return;let e=r.mode===`resume`;o(!0);try{let t=await r.send(SE(n));t?H(t,{tone:`danger`}):(H(`${e?`Task reopened`:`Sent to the task`} — resolving conflicts${n?` in PR #${n}`:``}`),i())}finally{o(!1)}};return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(A,{type:`button`,size:`sm`,"data-slot":`reference-conflict-action`,disabled:c||s,onClick:()=>void l(),className:`h-7 w-full text-xs`,children:s?`Sending…`:`Resolve conflicts`}),c&&r.reason?(0,Q.jsx)(`span`,{className:`block opacity-70`,children:r.reason}):null]})}function ME({projectId:e,runId:t,prNumber:n}){let r=ui(e,t);return r.data?(0,Q.jsx)(jE,{run:r.data,projectId:e,prNumber:n}):(0,Q.jsx)(A,{type:`button`,size:`sm`,disabled:!0,className:`h-7 w-full text-xs`,children:r.isError?`Unavailable`:`Loading…`})}function NE({runId:e,prNumber:t}){let{projectId:n}=Ao();return n===void 0?(0,Q.jsx)(PE,{runId:e,prNumber:t}):(0,Q.jsx)(ME,{projectId:n,runId:e,prNumber:t})}function PE({runId:e,prNumber:t}){let n=da(e);return n.data?(0,Q.jsx)(jE,{run:n.data,prNumber:t}):(0,Q.jsx)(A,{type:`button`,size:`sm`,disabled:!0,className:`h-7 w-full text-xs`,children:n.isError?`Unavailable`:`Loading…`})}function FE({run:e,reference:t,className:n,compact:r=!1,plain:i=!1,inert:a=!1}){let{projectId:o,repoBase:s}=Ao(),c=o!==void 0&&t.number!==void 0?Ki(o,e.id,{kind:t.kind,number:t.number,url:t.url},s):void 0;return(0,Q.jsx)(jo,{reference:t,taskTitle:ma(e),to:c,conflictAction:yr({...t,number:t.number??0},s)?(0,Q.jsx)(NE,{runId:e.id,prNumber:t.number}):void 0,className:n,compact:r,plain:i,inert:a})}var IE=[{value:`all`,label:`All`},{value:`direct`,label:`Direct tasks`},{value:`automations`,label:`Automations`}];function LE(e){return e===`direct`||e===`automations`?e:`all`}function RE(e,t){return t===`all`||he(e)===(t===`automations`)}function zE(e){return e===`all`?void 0:e===`automations`}function BE(e,t){let n={all:0,direct:0,automations:0};for(let r of e)Di(r)||r.archived!==(t===`archived`)||(n.all+=1,he(r)?n.automations+=1:n.direct+=1);return n}function VE(e){return e.rows.map(e=>e.run)}function HE(e,t){switch(e){case`Needs you`:return`pending`;case`Working`:return`running`;case`Archived`:return`neutral`;case`Finished`:return t.some(e=>R(e).bucket===`error`)?`danger`:`success`}}function UE(e,t,n){return ki(e,t,ga(n))}var WE=(e,t)=>JSON.stringify([e,t]);function GE(e,t,n){let r=new Map,i=e.map(e=>{let{run:t}=e,n=WE(t.projectId,t.id);r.set(n,e);let i=t.delegation;return{...t,id:n,...i&&`parentRunId`in i?{delegation:{...i,parentRunId:WE(t.projectId,i.parentRunId)}}:{}}}),a=new Map;for(let e of n){let t=a.get(e.projectId);t?t.push(e):a.set(e.projectId,[e])}let o=new Map;for(let[e,t]of a)for(let[n,r]of ga(t))o.set(WE(e,n),r);let s=e=>r.get(e.id);return ki(i,t,o).map(e=>({label:e.label,rows:e.rows.map(e=>({kind:`run`,run:s(e.run),queuePosition:e.queuePosition}))}))}function KE(e){return[e.run]}var qE=/^- \S+ — (?:(?:turn complete|step ".*" complete|step ".*" ended without done|session idle-closed) — |worktree setup (?:done in|failed —|skipped —) )/;function JE(e,t=3){let n=et(e,`## Progress log`);if(n<0)return[];let r=[];for(let i of e.slice(hr(e,n)).split(`
33
+ `)){if(r.length>=t||i.startsWith(`## `))break;let e=i.trim();!e||qE.test(e)||r.push(e.replace(/^[-*] /,``))}return r}function YE({origin:e,counts:t,onChange:n}){return(0,Q.jsx)(`div`,{role:`group`,"aria-label":`Task origin`,"data-slot":`origin-filter`,className:`flex flex-wrap items-center gap-1.5`,children:IE.map(r=>{let i=r.value===e;return(0,Q.jsxs)(`button`,{type:`button`,"data-origin":r.value,"aria-pressed":i,onClick:()=>n(r.value),className:s(`inline-flex min-h-11 items-center gap-1.5 rounded-full border border-border px-3 text-[13px] font-medium text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground`,i&&`border-accent-strong bg-accent-strong/10 text-accent-text`),children:[r.label,` `,(0,Q.jsx)(`span`,{className:`tabular-nums`,children:t[r.value]})]},r.value)})})}function XE({onExpand:e,onCollapse:t}){return(0,Q.jsxs)(`div`,{"data-slot":`group-fold-controls`,className:`hidden flex-wrap items-center gap-2 md:ml-auto md:flex`,children:[(0,Q.jsx)(A,{type:`button`,variant:`ghost`,className:`min-h-11`,"data-action":`expand-groups`,onClick:e,children:`Expand groups`}),(0,Q.jsx)(A,{type:`button`,variant:`ghost`,className:`min-h-11`,"data-action":`collapse-groups`,onClick:t,children:`Collapse groups`})]})}function ZE({origin:e,counts:t,onChange:n,labels:r,onSetAll:i}){return(0,Q.jsxs)(`div`,{"data-slot":`task-origin-row`,className:`flex flex-wrap items-center gap-2.5`,children:[(0,Q.jsx)(YE,{origin:e,counts:t,onChange:n}),r.length>0?(0,Q.jsx)(XE,{onExpand:()=>i(r,!1),onCollapse:()=>i(r,!0)}):null]})}var QE={pending:`needs you`,running:`working`,success:`finished`,danger:`contains failed tasks`,neutral:`archived`};function $E({id:e,label:t,count:n,tone:r,folded:i,collapsed:a,onToggle:o,children:s}){let c=a?me:Ke;return(0,Q.jsxs)(`section`,{"data-slot":`task-status-group`,"data-bucket":t,"data-folded":i,"data-tone":r,"aria-labelledby":`${e}-heading`,className:`flex flex-col gap-2.5`,children:[(0,Q.jsx)(`h2`,{id:`${e}-heading`,className:`text-[13px] font-semibold text-foreground`,children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`status-group-toggle`,"aria-expanded":!a,"aria-controls":`${e}-rows`,"aria-label":`${t} ${n}${r===`danger`?`, contains failed tasks`:``}`,onClick:o,className:`inline-flex min-h-11 items-center gap-2 rounded-md pr-2 hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground`,children:[(0,Q.jsx)(c,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Q.jsx)(eo,{tone:r,role:`img`,"aria-label":QE[r],title:QE[r]}),(0,Q.jsx)(`span`,{children:t}),` `,(0,Q.jsx)(`span`,{className:`font-normal tabular-nums text-muted-foreground`,children:n})]})}),(0,Q.jsx)(`div`,{id:`${e}-rows`,hidden:a,children:a?null:s})]})}function eD({automationId:e,automationName:t,project:n}){let r=e===void 0?`Direct task`:t??e;return(0,Q.jsxs)(`span`,{"data-slot":`task-origin`,"data-origin":e===void 0?`direct`:`automation`,className:`flex min-w-0 flex-wrap items-center gap-x-1.5 text-xs text-muted-foreground`,children:[n?(0,Q.jsxs)(Q.Fragment,{children:[n,(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:`·`})]}):null,(0,Q.jsx)(`span`,{className:`min-w-0 break-words`,title:e===void 0?void 0:`Automation ${e}`,children:r})]})}function tD({projectId:e,runId:t,status:n,error:r,open:i}){let a=Xr(e,t,!0),o=a.data===void 0?[]:JE(a.data);return(0,Q.jsxs)(`div`,{"data-slot":`task-preview`,className:`flex flex-col gap-3 rounded-md bg-muted/50 p-4 text-xs`,children:[(0,Q.jsx)(`p`,{className:`font-medium text-foreground first-letter:uppercase`,children:n}),r?(0,Q.jsx)(`p`,{"data-slot":`task-preview-error`,className:`break-words text-danger`,children:r}):null,a.isPending?(0,Q.jsx)(`p`,{role:`status`,className:`text-muted-foreground`,children:`Loading latest progress…`}):a.isError?(0,Q.jsx)(`p`,{"data-slot":`task-preview-unavailable`,className:`text-muted-foreground`,children:`Latest progress is unavailable.`}):o.length===0?(0,Q.jsx)(`p`,{className:`text-muted-foreground`,children:`No progress recorded yet.`}):(0,Q.jsx)(`ul`,{"aria-label":`Latest progress`,className:`flex flex-col gap-1 text-muted-foreground`,children:o.map((e,t)=>(0,Q.jsx)(`li`,{className:`break-words`,children:e},t))}),(0,Q.jsx)(`div`,{children:i})]})}function nD({delayDuration:e=0,...t}){return(0,Q.jsx)(ff,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function rD({...e}){return(0,Q.jsx)(pf,{"data-slot":`tooltip`,...e})}function iD({...e}){return(0,Q.jsx)(mf,{"data-slot":`tooltip-trigger`,...e})}function aD({className:e,sideOffset:t=0,children:n,...r}){return(0,Q.jsx)(hf,{children:(0,Q.jsxs)(gf,{"data-slot":`tooltip-content`,sideOffset:t,className:s(`z-50 w-fit origin-(--radix-tooltip-content-transform-origin) motion-safe:animate-in rounded-md bg-contrast px-3 py-1.5 text-xs text-balance text-contrast-foreground fade-in-0 motion-safe:zoom-in-95 motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=left]:slide-in-from-right-2 motion-safe:data-[side=right]:slide-in-from-left-2 motion-safe:data-[side=top]:slide-in-from-bottom-2 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95`,e),...r,children:[n,(0,Q.jsx)(_f,{className:`z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-contrast fill-contrast`})]})})}var oD=[{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`}],sD=new Map(oD.map(e=>[e.id,e]));function cD(e){return typeof e!=`object`||!e||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`boolean`))}function lD(e){let t={};for(let[n,r]of Object.entries(cD(e))){let e=sD.get(n);e?.canFold&&(t[e.id]=r)}return t}function uD(e,t){let n=sD.get(e);return!n||!n.canFold?!0:t[e]??n.defaultExpanded}function dD(e,t){let n=cD(e);return sD.get(t)?.canFold?{...n,[t]:!uD(t,lD(e))}:n}function fD(e){return oD.filter(t=>t.capability===void 0||e[t.capability])}function pD(){let[e]=L(),t=ce(),n=Z.useRef({rendered:e,next:e});return Z.useLayoutEffect(()=>{n.current.rendered!==e&&(n.current={rendered:e,next:e})},[e]),[e,Z.useCallback(e=>{let r=e(new URLSearchParams(n.current.next));r.toString()!==n.current.next.toString()&&(n.current={...n.current,next:r},t({search:`?${r}`},{replace:!0}))},[t])]}var mD=`cez-sidebar-collapsed`,hD=`cez-sidebar-sections-collapsed`;function gD(e){if(typeof e!=`object`||!e||Array.isArray(e))return{};let t={};for(let[n,r]of Object.entries(e))typeof r==`boolean`&&(t[n]=r);return t}function _D(e=mD){try{let t=localStorage.getItem(e);return t===null?{}:gD(JSON.parse(t))}catch{return{}}}function vD(e,t=mD){try{localStorage.setItem(t,JSON.stringify(e))}catch{}}var yD=`cez-task-list-folds`,bD=`cez-task-list-folds-changed`;function xD(e,t,n=new Set){let[r,i]=(0,Z.useState)(()=>_D(yD));(0,Z.useEffect)(()=>{let e=e=>{e instanceof StorageEvent&&e.key!==null&&e.key!==`cez-task-list-folds`||i(e instanceof CustomEvent?e.detail:_D(yD))};return window.addEventListener(`storage`,e),window.addEventListener(bD,e),()=>{window.removeEventListener(`storage`,e),window.removeEventListener(bD,e)}},[]);let a=(0,Z.useCallback)(n=>JSON.stringify([e,t,n]),[e,t]),o=(0,Z.useCallback)(e=>{i(t=>{let n=e(t);return vD(n,yD),queueMicrotask(()=>window.dispatchEvent(new CustomEvent(bD,{detail:n}))),n})},[]),s=e=>r[a(e)]===!0;return{isFolded:s,isCollapsed:e=>s(e)&&!n.has(e),toggle:e=>o(t=>({...t,[a(e)]:t[a(e)]!==!0})),setAll:(e,t)=>o(n=>({...n,...Object.fromEntries(e.map(e=>[a(e),t]))}))}}function SD(e){let t=e?.capabilities,n=t?.tokenMetrics!==!1;return{tokens:t?.tokenUsageMetrics??n,cost:t?.costMetrics??n}}function CD(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function wD(){let e=V(),t=Fr(),n=Z.useRef(0),r=Z.useRef(0),i=Z.useRef(Promise.resolve()),a=Z.useMemo(()=>lD(t.data?.taskTable?.expandedColumns),[t.data?.taskTable?.expandedColumns]),o=Z.useCallback(t=>{if(!oD.find(e=>e.id===t)?.canFold)return;let a=e.getQueryData(W.uiState);if(a===void 0)return;let o=CD(a?.taskTable),s={...o,expandedColumns:dD(o.expandedColumns,t)};e.setQueryData(W.uiState,{...a,taskTable:s});let c=++n.current;r.current=c;let l=i.current.then(async()=>{let t=await Tt({taskTable:s},{keepalive:!0});c===r.current&&e.setQueryData(W.uiState,t)});i.current=l.catch(t=>{H(t instanceof Error?t.message:String(t),{tone:`danger`}),c===r.current&&e.invalidateQueries({queryKey:W.uiState})})},[e]);return{expandedColumns:a,isExpanded:Z.useCallback(e=>uD(e,a),[a]),toggleColumn:o,isPending:t.isPending}}function TD({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=lD(void 0),onToggleColumn:f=()=>void 0,columnsPending:p=!1,projectName:m,error:h,onRetry:g,archivedPages:_,archivedTotal:v,onArchivedSearch:y,origin:b,onOriginChange:x,urlQuery:S=``,onQueryChange:C,foldScope:w=`project`,automationName:T=()=>void 0}){let[E,D]=ED(S,C);Z.useEffect(()=>{y?.(E.trim())},[y,E]);let[O,k]=OD(b,x),[j,M]=Z.useState(!1),N=Z.useRef(null);Z.useRef(!1);let P=kD({all:e??[],view:t,query:E,origin:O,archivedPages:_,archivedTotal:v,automationName:T}),{groups:F,needle:I}=P,ee=fD({tokens:l,cost:u}),L=xD(w,t,new Set(I?F.map(e=>e.label):[])),R=t===`archived`?void 0:s;return(0,Q.jsxs)(`div`,{"data-route":`tasks`,"data-presentation":j?`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:N,className:`flex shrink-0 flex-col gap-[22px]`,children:[(0,Q.jsx)(DD,{projectName:m,detailedTable:j}),(0,Q.jsxs)(`div`,{className:`flex gap-6 border-b border-border`,children:[(0,Q.jsx)(VD,{view:`active`,current:t,onSelect:n,count:P.activeCount,children:`Active`}),(0,Q.jsx)(VD,{view:`archived`,current:t,onSelect:n,count:P.archivedCount,children:`Archived`})]}),(0,Q.jsxs)(`div`,{"data-slot":`tasks-toolbar`,className:`flex flex-wrap items-center gap-2.5`,children:[(0,Q.jsx)(MD,{view:t,unread:P.unread,finished:P.finished,archivePending:i,headerRef:N,onMarkAllRead:()=>a(zE(O)),onArchiveFinished:()=>r(zE(O))}),(0,Q.jsxs)(`div`,{className:`relative order-first w-full md:w-auto md:flex-1`,children:[(0,Q.jsx)(at,{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:E,onChange:e=>D(e.target.value),placeholder:`Search tasks or automations…`,"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.jsx)(ND,{columns:ee,expandedColumns:d,columnsPending:p,onToggleColumn:f,detailedTable:j,onToggleDetailed:()=>M(e=>!e)}),(0,Q.jsx)(A,{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)(Lt,{"aria-hidden":`true`}),`New task`]})})]}),(0,Q.jsx)(ZE,{origin:O,counts:P.originTotals,onChange:k,labels:F.map(e=>e.label),onSetAll:L.setAll})]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[e===void 0?(0,Q.jsx)(FD,{error:h,onRetry:g}):(0,Q.jsx)(PD,{view:t,query:E,origin:O,onShowAll:()=>{D(``),k(`all`)},caption:jD(P.visibleCount,P.incomplete,I),captionOnPhones:I!==``||P.incomplete,groups:F,folds:L,grouped:{detailedTable:j,columns:ee,expandedColumns:d,onToggleColumn:f,columnsPending:p,onRename:o,onTogglePin:R,now:c,showTokens:l,showCost:u,automationName:T}}),t===`archived`&&_?(0,Q.jsx)(ID,{pages:_}):null]})]})}function ED(e,t){let[n,r]=Z.useState(e),i=Z.useRef(e),a=Z.useRef(e),o=Z.useRef([]);return Z.useEffect(()=>{if(e===i.current)return;i.current=e;let t=o.current.indexOf(e);o.current=t===-1?[]:o.current.slice(t+1),t===-1&&e!==a.current&&r(e)},[e]),Z.useEffect(()=>{a.current=n.trim(),t?.(n,e=>{o.current.push(e)})},[t,n]),[n,r]}function DD({projectName:e,detailedTable:t}){return(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:[e?`${e} · `:``,t?`Every resource column shown. Fold columns without losing the saved view.`:`Review runs, pull requests and resource usage.`]})]})}function OD(e,t){let[n,r]=Z.useState(`all`);return[e??n,t??r]}function kD({all:e,view:t,query:n,origin:r,archivedPages:i,archivedTotal:a,automationName:o}){let s=n.trim(),c=e=>e.automationId===void 0?``:o(e.automationId)??e.automationId,l=i?.query===s,u=new Set(l?i.runs.map(e=>e.id):[]),d=wr(e,l||s===``?i?.runs??[]:[]).slice(e.length),f=Br(e,n,c),p=new Set(f.map(e=>e.id)),m=Br(e.filter(e=>u.has(e.id)&&!p.has(e.id)),``),h=e=>RE(e,r),g=UE([...f,...m,...Br(d,``)].filter(h),t,e),_=wr(e,i?.query===``?i.runs:[]),v=pi(e).archived>=200,y=e.filter(h);return{groups:g,needle:s,visibleCount:g.reduce((e,t)=>e+VE(t).length,0),originTotals:BE(_,t),activeCount:BE(e,`active`)[r],archivedCount:AD(e,_,r,i,a),incomplete:t===`archived`&&v&&i?.hasMore!==!1,finished:li(y),unread:$w(y)}}function AD(e,t,n,r,i){let a=pi(e).archived,o=a>=200;if(n===`all`)return i??(o?`200+`:a);let s=BE(t,`archived`)[n];return o&&r?.plainHasMore!==!1?`${s}+`:s}function jD(e,t,n){return`${e} ${e===1?`task`:`tasks`}${t?` loaded`:``}${n?` matching “${n}”`:``}`}function MD({view:e,unread:t,finished:n,archivePending:r,headerRef:i,onMarkAllRead:a,onArchiveFinished:o}){let s=Z.useRef(!1),[c,l]=Z.useState(!1),u=n>0||r;return Z.useEffect(()=>{let e=window.matchMedia?.(`(min-width: 768px)`);if(!e)return;let t=()=>{e.matches&&l(!1)};return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),(0,Q.jsxs)(Q.Fragment,{children:[t>0?(0,Q.jsxs)(A,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`mark-all-read`,className:`hidden md:inline-flex`,onClick:a,children:[(0,Q.jsx)(Js,{className:`size-3.5`,"aria-hidden":`true`}),`Mark all read`,` `,(0,Q.jsx)(`span`,{className:`tabular-nums text-muted-foreground`,children:t})]}):null,e===`active`&&n>0?(0,Q.jsxs)(A,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`archive-finished`,className:`inline-flex`,disabled:r,"aria-busy":r,onClick:o,children:[(0,Q.jsx)(ot,{className:`size-3.5`,"aria-hidden":`true`}),`Archive finished`,` `,(0,Q.jsx)(`span`,{className:`tabular-nums text-muted-foreground`,children:n})]}):null,e===`active`&&(u||t>0)?(0,Q.jsxs)(Kn,{open:c,onOpenChange:l,children:[(0,Q.jsx)(Mn,{asChild:!0,children:(0,Q.jsx)(A,{type:`button`,variant:`ghost`,size:`icon`,className:`md:hidden`,"aria-label":`Task actions`,"aria-busy":r,children:(0,Q.jsx)(uc,{"aria-hidden":`true`})})}),(0,Q.jsxs)(Rn,{align:`end`,className:`md:hidden`,onCloseAutoFocus:e=>{(s.current||window.matchMedia?.(`(min-width: 768px)`).matches)&&(e.preventDefault(),s.current=!1,i.current?.querySelector(`[data-view="active"]`)?.focus())},children:[u?(0,Q.jsxs)(cn,{disabled:r||n===0,onSelect:()=>{s.current=!0,o()},children:[(0,Q.jsx)(ot,{"aria-hidden":`true`}),r?`Archiving…`:`Archive finished (${n})`]}):null,t>0?(0,Q.jsxs)(cn,{onSelect:a,children:[(0,Q.jsx)(Js,{"aria-hidden":`true`}),`Mark all read (${t})`]}):null]})]}):null]})}function ND({columns:e,expandedColumns:t,columnsPending:n,onToggleColumn:r,detailedTable:i,onToggleDetailed:a}){return(0,Q.jsxs)(Co,{children:[(0,Q.jsx)(vo,{asChild:!0,children:(0,Q.jsx)(A,{"data-slot":`task-columns-trigger`,variant:`outline`,className:`hidden min-h-11 md:inline-flex`,children:`Columns`})}),(0,Q.jsxs)(xo,{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:e.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:uD(e.id,t),disabled:n,onChange:()=>r(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)(A,{variant:`outline`,className:`mt-4`,onClick:a,children:i?`Summary view`:`Resource columns`})]})]})}function PD({view:e,query:t,origin:n,onShowAll:r,caption:i,captionOnPhones:a,groups:o,folds:c,grouped:l}){return o.length===0?(0,Q.jsx)(LD,{view:e,query:t,origin:n,onShowAll:r}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{"data-slot":`tasks-result-count`,className:s(`mb-3 text-[12px] text-muted-foreground tabular-nums`,!a&&`max-md:hidden`),children:i}),(0,Q.jsx)(`div`,{className:`flex flex-col gap-[22px]`,children:o.map(t=>{let n=VE(t);return(0,Q.jsx)($E,{id:`tasks-group-${e}-${t.label.replaceAll(` `,`-`)}`,label:t.label,count:n.length,tone:HE(t.label,n),folded:c.isFolded(t.label),collapsed:c.isCollapsed(t.label),onToggle:()=>c.toggle(t.label),children:(0,Q.jsx)(zD,{group:t,...l})},t.label)})}),(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 FD({error:e,onRetry:t}){return e?(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:e}),(0,Q.jsx)(A,{variant:`outline`,className:`mt-4`,onClick:t,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…`})}function ID({pages:e}){return e.failed?(0,Q.jsxs)(`p`,{role:`alert`,"data-slot":`archived-older-error`,className:`mt-3.5 flex items-center justify-center gap-2.5 text-[13px] text-muted-foreground`,children:[`Could not load older archived tasks.`,(0,Q.jsx)(A,{variant:`outline`,className:`min-h-11`,onClick:e.onLoadMore,children:`Retry`})]}):e.hasMore?(0,Q.jsx)(A,{"data-slot":`archived-older`,variant:`outline`,className:`mt-3.5 min-h-11 self-center`,disabled:e.loading,onClick:e.onLoadMore,children:e.loading?`Loading older archived…`:`Show older archived`}):null}function LD({view:e,query:t,origin:n=`all`,onShowAll:r}){let i=t.trim(),a=i||n!==`all`?`search-miss`:e===`archived`?`archive`:`no-tasks`;return(0,Q.jsx)(`div`,{"data-slot":`tasks-empty`,"data-empty-kind":a,className:`flex flex-1 flex-col`,children:a===`search-miss`?(0,Q.jsx)(ra,{heading:`h2`,icon:(0,Q.jsx)(Oo,{}),tone:`neutral`,title:`No matching tasks`,subtitle:i?`No tasks match “${i}”.`:n===`automations`?`No automation started a task here.`:`No task here was started directly.`,actions:r?(0,Q.jsx)(A,{variant:`outline`,className:`min-h-11`,"data-action":`clear-task-filters`,onClick:r,children:`Show all tasks`}):void 0}):a===`archive`?(0,Q.jsx)(ra,{heading:`h2`,icon:(0,Q.jsx)(ot,{}),tone:`neutral`,title:`Nothing archived yet`,subtitle:`Finished tasks you archive land here.`}):(0,Q.jsx)(ra,{heading:`h2`,icon:(0,Q.jsx)(Dc,{}),tone:`primary`,backdrop:!0,title:`No tasks yet`,subtitle:`Describe a task to get started.`,actions:(0,Q.jsx)(A,{asChild:!0,children:(0,Q.jsxs)(X,{to:`/new`,children:[(0,Q.jsx)(Lt,{"aria-hidden":`true`}),`New task`]})})})})}function RD({rows:e,onRename:t,onTogglePin:n,now:r,showTokens:i,showCost:a,automationName:o}){let[s,c]=Z.useState(()=>new Set);return(0,Q.jsx)(`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:e.map(({run:e,queuePosition:l})=>{let u=R(e),d=Ui(e),f=Li(e),p=s.has(e.id),m=`task-resources-${e.id}`;return(0,Q.jsxs)(Z.Fragment,{children:[(0,Q.jsxs)(`tr`,{"data-status":e.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)(XD,{run:e,to:`/tasks/${e.id}`,onRename:t,onTogglePin:n}),(0,Q.jsx)(`div`,{className:`mt-1`,children:(0,Q.jsx)(JD,{run:e,automationName:o})}),(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 ${ma(e)}`,"aria-expanded":p,"aria-controls":m,"aria-describedby":`summary-status-${e.id}`,onClick:()=>c(t=>{let n=new Set(t);return p?n.delete(e.id):n.add(e.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)(tE,{id:`summary-status-${e.id}`,dot:u.tone,shape:u.shape,pulse:u.pulse,children:[u.label,d?` ${d.label}`:``]})}),e.status===`queued`&&l!==null?(0,Q.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`#`,l,` in queue`]}):null]})]}),(0,Q.jsx)(`td`,{className:`truncate pr-3 text-xs text-muted-foreground`,title:Ti(e),children:Ti(e)}),(0,Q.jsx)(`td`,{className:`pr-2 text-xs`,children:e.diffStat?(0,Q.jsx)(JT,{stat:e.diffStat}):(0,Q.jsx)(nO,{})}),(0,Q.jsx)(`td`,{className:`pr-2`,children:f?(0,Q.jsx)(FE,{run:e,reference:f,compact:!0}):(0,Q.jsx)(nO,{})}),(0,Q.jsx)(`td`,{className:`text-xs text-muted-foreground`,children:Va(e.startedAt??e.createdAt,r)})]}),p?(0,Q.jsx)(`tr`,{children:(0,Q.jsx)(`td`,{colSpan:5,className:`border-b border-border pb-5`,children:(0,Q.jsxs)(`div`,{id:m,className:`flex flex-col gap-3`,children:[(0,Q.jsx)(tD,{runId:e.id,status:u.label,error:e.error,open:(0,Q.jsx)(A,{asChild:!0,variant:`outline`,className:`min-h-11`,children:(0,Q.jsxs)(X,{to:`/tasks/${e.id}`,children:[`Open task`,(0,Q.jsxs)(`span`,{className:`sr-only`,children:[`: `,ma(e)]})]})})}),(0,Q.jsx)(`div`,{className:`rounded-md bg-muted/50 p-4`,children:(0,Q.jsx)(BD,{run:e,showTokens:i,showCost:a})})]})})}):null]},e.id)})})]})})})}function zD({group:e,detailedTable:t,columns:n,expandedColumns:r,onToggleColumn:i,columnsPending:a,onRename:o,onTogglePin:c,now:l,showTokens:u,showCost:d,automationName:f}){let p=e.rows.flatMap(e=>KE(e).map(t=>({run:t,queuePosition:t.status===`queued`?e.queuePosition:null})));return(0,Q.jsxs)(Q.Fragment,{children:[t?null:(0,Q.jsx)(RD,{rows:p,onRename:o,onTogglePin:c,now:l,showTokens:u,showCost:d,automationName:f}),(0,Q.jsx)(`div`,{"data-slot":`tasks-table`,hidden:!t,className:s(`hidden overflow-x-auto rounded-lg border border-border bg-card`,t&&`md:block`),children:(0,Q.jsx)(nD,{children:(0,Q.jsxs)(`table`,{className:`w-full table-fixed border-collapse`,children:[(0,Q.jsx)(`colgroup`,{children:n.map(e=>{let t=uD(e.id,r);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:n.map(e=>(0,Q.jsx)(UD,{column:e,expanded:uD(e.id,r),onToggle:i,disabled:a},e.id))})}),(0,Q.jsx)(`tbody`,{className:`[&>tr:last-child>td]:border-b-0`,children:p.map(({run:e,queuePosition:t})=>(0,Q.jsx)(KD,{run:e,queuePosition:t,onRename:o,onTogglePin:c,now:l,columns:n,expandedColumns:r,automationName:f},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:p.map(({run:e,queuePosition:t})=>(0,Q.jsx)(eO,{run:e,queuePosition:t,now:l,showTokens:u,showCost:d,onTogglePin:c,automationName:f},e.id))})]})}function BD({run:e,showTokens:t,showCost:n}){let r=Si(e,Rs(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)(QT,{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:si(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 VD({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:s(`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?null:(0,Q.jsxs)(`span`,{className:`tabular-nums`,children:[` · `,r]})]})}function HD({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:s(`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 UD({column:e,expanded:t,onToggle:n,disabled:r}){if(!e.canFold)return(0,Q.jsx)(HD,{columnId:e.id,right:e.align===`right`,children:e.label});let i=t?`Fold`:`Expand`;return(0,Q.jsx)(HD,{columnId:e.id,right:e.align===`right`,folded:!t,children:(0,Q.jsxs)(rD,{children:[(0,Q.jsx)(iD,{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:s(`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)($s,{className:`size-3 opacity-55`,"aria-hidden":`true`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(WD,{icon:e.icon}),(0,Q.jsx)(ec,{className:`size-3 opacity-70`,"aria-hidden":`true`})]})})}),(0,Q.jsxs)(aD,{side:`top`,children:[e.label,` · `,i,` column`]})]})})}function WD({icon:e}){let t=`size-3.5`;switch(e){case`workflow`:return(0,Q.jsx)(Ce,{className:t,"aria-hidden":`true`});case`branch`:return(0,Q.jsx)(Yn,{className:t,"aria-hidden":`true`});case`diff`:return(0,Q.jsx)(we,{className:t,"aria-hidden":`true`});case`reference`:return(0,Q.jsx)(Ec,{className:t,"aria-hidden":`true`});case`tokens`:return(0,Q.jsx)(rc,{className:t,"aria-hidden":`true`});case`cost`:return(0,Q.jsx)(lc,{className:t,"aria-hidden":`true`});case`cpu`:return(0,Q.jsx)(vt,{className:t,"aria-hidden":`true`});case`memory`:return(0,Q.jsx)(Oc,{className:t,"aria-hidden":`true`});case`started`:return(0,Q.jsx)(tc,{className:t,"aria-hidden":`true`});default:return null}}var GD=`h-[88px] border-b border-border px-2.5 whitespace-nowrap first:pl-4 last:pr-4`;function KD({run:e,queuePosition:t,onRename:n,onTogglePin:r,now:i,columns:a,expandedColumns:o,automationName:c}){let l=Za(),u=R(e),d=Ui(e),f=`/tasks/${e.id}`,p=si(e.costUsd),m=Li(e);return(0,Q.jsx)(`tr`,{"data-slot":`task-table-row`,"data-run-id":e.id,onClick:e=>{e.target.closest(`a, button, input`)||l(f)},className:`group/row cursor-pointer hover:bg-muted`,children:a.map(a=>{if(a.id===`memory`)return null;if(a.id===`cpu`){let n=uD(`cpu`,o),r=uD(`memory`,o);return t!==null&&(n||r)?(0,Q.jsxs)(`td`,{"data-slot":`queue-note`,"data-column-id":`cpu-memory`,colSpan:2,className:s(GD,`text-right font-mono text-[11px] text-supporting-foreground`),children:[`#`,t,` in queue`]},a.id):(0,Q.jsx)(ZD,{run:e,cpuExpanded:n,memoryExpanded:r},a.id)}return(0,Q.jsx)(qD,{column:a,expanded:uD(a.id,o),run:e,attention:u,scheduled:d,reference:m,cost:p,to:f,onRename:n,onTogglePin:r,now:i,automationName:c},a.id)})})}function qD({column:e,expanded:t,run:n,attention:r,scheduled:i,reference:a,cost:o,to:c,onRename:l,onTogglePin:u,now:d,automationName:f}){if(!t)return(0,Q.jsx)(YD,{column:e.id});switch(e.id){case`status`:return(0,Q.jsx)(`td`,{"data-column-id":e.id,className:s(GD,`overflow-hidden`),children:(0,Q.jsx)(tE,{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.jsxs)(`td`,{"data-column-id":e.id,className:s(GD,`min-w-[320px] max-w-0 whitespace-normal`),children:[(0,Q.jsx)(XD,{run:n,to:c,onRename:l,onTogglePin:u}),(0,Q.jsx)(`div`,{className:`mt-1`,children:(0,Q.jsx)(JD,{run:n,automationName:f})})]});case`workflow`:return(0,Q.jsx)(`td`,{"data-column-id":e.id,className:s(GD,`max-w-0 truncate text-[13px] text-muted-foreground`),children:Ti(n)});case`branch`:return(0,Q.jsx)(`td`,{"data-column-id":e.id,className:s(GD,`max-w-0 overflow-hidden`),children:n.branch?(0,Q.jsx)(rO,{branch:n.branch}):(0,Q.jsx)(nO,{})});case`diff`:return(0,Q.jsx)(`td`,{"data-column-id":e.id,className:s(GD,`overflow-hidden`),children:n.diffStat?(0,Q.jsx)(JT,{stat:n.diffStat,compact:!0,className:`block max-w-full`}):(0,Q.jsx)(nO,{})});case`reference`:return(0,Q.jsx)(`td`,{"data-column-id":e.id,className:s(GD,`overflow-hidden`),children:a?(0,Q.jsx)(FE,{run:n,reference:a,compact:!0,className:`max-w-full overflow-hidden`}):(0,Q.jsx)(nO,{})});case`tokens`:let t=XT(n.inputTokens,n.outputTokens);return(0,Q.jsx)(`td`,{"data-column-id":e.id,className:s(GD,`text-right text-xs text-muted-foreground`),children:(0,Q.jsx)(QT,{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:s(GD,`text-right font-mono text-xs text-muted-foreground tabular-nums`),children:o?(0,Q.jsx)($D,{text:o,accessibleText:`$${n.costUsd}`}):(0,Q.jsx)(nO,{})});case`started`:return(0,Q.jsx)(`td`,{"data-column-id":e.id,className:s(GD,`text-right text-xs text-supporting-foreground tabular-nums`),children:Va(n.startedAt??n.createdAt,d)});default:return null}}function JD({run:e,automationName:t}){return(0,Q.jsx)(eD,{automationId:e.automationId,automationName:e.automationId===void 0?void 0:t(e.automationId)})}function YD({column:e}){return(0,Q.jsx)(`td`,{role:`presentation`,"aria-hidden":`true`,"data-column-id":e,"data-folded":`true`,className:s(GD,`px-0 first:pl-0 last:pr-0`)})}function XD({run:e,to:t,onRename:n,onTogglePin:r}){let i=ma(e),a=$T(i,t=>n(e.id,t)),o=Zw(e),c=Qw(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)(eE,{editor:a,className:`basis-full text-[13px] font-medium`}),(0,Q.jsx)(A,{size:`sm`,"aria-label":`Save title`,onMouseDown:e=>e.preventDefault(),onClick:a.commit,children:`Save`}),(0,Q.jsx)(A,{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:s(`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`:c?`font-normal text-foreground`:`font-medium`),children:i}),o?(0,Q.jsx)(eo,{tone:eT(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)(Pc,{className:`size-3`,"aria-hidden":`true`})}),r?(0,Q.jsx)(nE,{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 ZD({run:e,cpuExpanded:t,memoryExpanded:n}){let r=Si(e,Rs(e.id));return(0,Q.jsxs)(Q.Fragment,{children:[t?(0,Q.jsx)(QD,{column:`cpu`,cell:r.cpu}):(0,Q.jsx)(YD,{column:`cpu`}),n?(0,Q.jsx)(QD,{column:`memory`,cell:r.mem}):(0,Q.jsx)(YD,{column:`memory`})]})}function QD({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:s(GD,`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)($D,{text:t.text||`—`,accessibleText:n||void 0})})}function $D({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 eO({run:e,queuePosition:t,now:n,showTokens:r,showCost:i,onTogglePin:a,automationName:o}){let c=Za(),[l,u]=Z.useState(!1),d=R(e),f=Ui(e),p=`/tasks/${e.id}`,m=Li(e),h=Zw(e),g=Qw(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`)||c(p)},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":l?`Hide resources`:`Show resources`,title:l?`Hide resources`:`Show resources`,"aria-expanded":l,onClick:()=>u(e=>!e),children:(0,Q.jsxs)(tE,{id:`mobile-status-${e.id}`,dot:d.tone,shape:d.shape,pulse:d.pulse,className:`mt-px shrink-0`,title:f?.title,children:[d.label,f?(0,Q.jsx)(`span`,{className:`tabular-nums`,children:f.label}):null]})}),(0,Q.jsxs)(X,{to:p,className:s(`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`,h?`font-semibold text-foreground`:g?`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,ma(e)]}),h?(0,Q.jsx)(eo,{tone:eT(e),role:`img`,"aria-label":`unread`,title:`Unread — not opened since it finished`,className:`mt-1.5 shrink-0`}):null,(0,Q.jsx)(`div`,{className:`order-first w-full`,children:(0,Q.jsx)(JD,{run:e,automationName:o})}),a?(0,Q.jsx)(nE,{pinned:!!e.pinned,onToggle:t=>a(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:Ti(e)}),t===null?e.diffStat?(0,Q.jsx)(JT,{stat:e.diffStat}):(0,Q.jsx)(nO,{}):(0,Q.jsxs)(`span`,{"data-slot":`queue-note`,children:[`#`,t,` in queue`]}),(0,Q.jsx)(`span`,{children:Va(e.startedAt??e.createdAt,n)})]}),m?(0,Q.jsx)(`div`,{className:`mt-3`,children:(0,Q.jsx)(FE,{run:e,reference:m})}):null,l?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`mt-3`,children:(0,Q.jsx)(tD,{runId:e.id,status:d.label,error:e.error,open:(0,Q.jsx)(A,{asChild:!0,variant:`outline`,className:`min-h-11`,children:(0,Q.jsxs)(X,{to:p,children:[`Open task`,(0,Q.jsxs)(`span`,{className:`sr-only`,children:[`: `,ma(e)]})]})})})}),(0,Q.jsx)(tO,{run:e,showTokens:r,showCost:i})]}):null]})}function tO({run:e,showTokens:t,showCost:n}){let r=Si(e,Rs(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)(QT,{inputTokens:e.inputTokens,outputTokens:e.outputTokens})})]}):null,n?(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{children:`Cost`}),(0,Q.jsx)(`dd`,{children:si(e.costUsd)||`—`})]}):null]})}function nO(){return(0,Q.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`—`})}function rO({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 iO(){let e=Yr(),t=kr(),n=SD(t.data),{view:r,setView:i,origin:a,setOrigin:o,urlQuery:s,writeQuery:c}=oO(),l=V(),u=lO(e.data,r),d=Lr({mutationFn:e=>_e(void 0,e),onSuccess:()=>l.invalidateQueries({queryKey:G.runs.all}),onError:e=>H(e.message,{tone:`danger`})}),f=Lr({mutationFn:e=>We(e),onSuccess:()=>l.invalidateQueries({queryKey:G.runs.all}),onError:e=>H(e.message,{tone:`danger`})}),p=Lr({mutationFn:({id:e,title:t})=>gr(e,{title:t}),onSuccess:()=>l.invalidateQueries({queryKey:G.runs.all}),onError:e=>H(e.message,{tone:`danger`})}),m=Mr(),h=Tm(3e4),g=wD(),_=gi(),v=ci(void 0,{retryOnMount:!1}),y=aa({retryOnMount:!1}).data?.projects?.find(e=>e.id===_)?.name,b=[...e.data??[],...u.pages?.runs??[]].some(e=>e.automationId!==void 0),x=zi([void 0],t.data?.capabilities?.automations===!0&&b),S=Z.useCallback(e=>x(void 0,e),[x]);return(0,Q.jsx)(Do,{projectId:_,repoBase:v,requests:Z.useMemo(()=>_===void 0?[]:(e.data??[]).flatMap(e=>{let t=Li(e);return t?[{projectId:_,kind:t.kind,number:t.number}]:[]}),[e.data,_]),children:(0,Q.jsx)(TD,{runs:e.data,projectName:y,error:e.error?.message,onRetry:()=>void e.refetch(),view:r,onViewChange:i,origin:a,onOriginChange:o,urlQuery:s,onQueryChange:c,foldScope:`project:${_??`default`}`,automationName:S,onArchiveFinished:e=>{d.isPending||d.mutate(e)},archivePending:d.isPending,onMarkAllRead:e=>f.mutate(e),onRename:(e,t)=>p.mutate({id:e,title:t}),onTogglePin:(e,t)=>m.mutate({id:e.id,pinned:t}),now:h,showTokens:n.tokens,showCost:n.cost,expandedColumns:g.expandedColumns,onToggleColumn:g.toggleColumn,columnsPending:g.isPending,archivedPages:u.pages,archivedTotal:u.total,onArchivedSearch:u.search})})}function aO(e,t){return n=>(t===null?n.delete(e):n.set(e,t),n)}function oO(){let[e,t]=pD(),n=e.get(`archived`)===`1`?`archived`:`active`,r=LE(e.get(`origin`)),[i,a]=Z.useState(n),[o,s]=Z.useState(r);Z.useEffect(()=>a(n),[n]),Z.useEffect(()=>s(r),[r]);let c=e.get(`q`)??``,l=Z.useRef(void 0);return Z.useEffect(()=>{let e=l;return()=>clearTimeout(e.current)},[]),{view:i,setView:e=>{a(e),t(aO(`archived`,e===`archived`?`1`:null))},origin:o,setOrigin:e=>{s(e),t(aO(`origin`,e===`all`?null:e))},urlQuery:c,writeQuery:Z.useCallback((e,n)=>{clearTimeout(l.current);let r=e.trim();l.current=setTimeout(()=>t(e=>{let t=aO(`q`,r===``?null:r)(e);return t.get(`q`)!==e.get(`q`)&&n(r),t}),sO)},[t])}}var sO=250,cO=150;function lO(e,t){let n=V(),[r,i]=Z.useState(``),[a,o]=Z.useState(``);Z.useEffect(()=>{let e=setTimeout(()=>o(r),cO);return()=>clearTimeout(e)},[r]);let s=e!==void 0&&pi(e).archived>=200,c=xi(a,t===`archived`&&(a!==``||s)),l=c.data?.pages,u=Z.useMemo(()=>l||c.isError?{runs:(l??[]).flatMap(e=>e.runs),query:c.isPlaceholderData?null:a,hasMore:c.hasNextPage,loading:c.isFetchingNextPage,onLoadMore:()=>void(l?c.fetchNextPage():c.refetch()),failed:c.isError}:void 0,[l,c]),d=a===``?l:n.getQueryData(G.runs.archived(``))?.pages,f=d===void 0?void 0:d.at(-1)?.nextCursor!=null;return{pages:u&&{...u,plainHasMore:f},total:d?.[0]?.total,search:i}}function uO({slot:e,label:t,options:n,selected:r,onToggle:i,onClear:a,searchPlaceholder:o,emptyLabel:c=`Nothing to filter by`}){let[l,u]=Z.useState(!1),d=r.length>0,f=r.length===1?n.find(e=>e.value===r[0])?.label??r[0]:`${r.length} selected`;return(0,Q.jsxs)(Co,{open:l,onOpenChange:u,children:[(0,Q.jsx)(vo,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`facet-${e}`,"data-active":d?`true`:void 0,"aria-label":`Filter by ${t.toLowerCase()}`,className:s(`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`,d&&`border-accent-strong/40 bg-accent-strong/10 text-foreground`),children:[(0,Q.jsx)(`span`,{className:s(d&&`text-soft-foreground`),children:t}),d?(0,Q.jsx)(`span`,{className:`max-w-[140px] truncate font-semibold`,children:f}):null,(0,Q.jsx)(Zs,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Q.jsxs)(xo,{align:`start`,className:`w-64 p-0`,"data-testid":`facet-${e}-menu`,children:[(0,Q.jsxs)(Cp,{children:[(0,Q.jsx)(Tp,{placeholder:o??`Search ${t.toLowerCase()}…`}),(0,Q.jsxs)(Ep,{children:[(0,Q.jsx)(Dp,{children:c}),(0,Q.jsx)(Op,{children:n.map(e=>{let t=r.includes(e.value);return(0,Q.jsxs)(Ap,{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:s(`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)(Ys,{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)})})]})]}),d?(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 dO({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:s(`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:s(`font-mono text-[11px] tabular-nums`,!n&&`text-soft-foreground`),children:t})]})}function fO({slot:e,label:t,value:n,options:r,onChange:i,size:a=`compact`}){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,disabled:e.disabled,title:e.title,onClick:()=>i(e.value),className:s(`flex h-6 items-center justify-center rounded-[6px] px-2.5 text-[12px] font-medium text-muted-foreground transition-colors hover:text-foreground disabled:pointer-events-none disabled:opacity-50`,a===`touch`&&`h-11 px-4 text-[13px]`,t&&`bg-card font-semibold text-foreground shadow-xs`),children:e.label},e.value)})})}var pO=220;function mO({references:e,taskTitle:t,visibleCount:n,plain:r=!1,projectId:i,runId:a,repoBase:o}){let[s,c]=Z.useState(!1),l=Z.useRef(!1),u=Z.useRef(!1),d=Z.useRef(null),f=Z.useRef(void 0);Z.useEffect(()=>()=>clearTimeout(f.current),[]);let p=e=>e.pointerType!==`touch`,m=()=>clearTimeout(f.current),h=e=>{p(e)&&(m(),s||(l.current=!0),c(!0))},g=e=>{p(e)&&(m(),f.current=setTimeout(()=>c(!1),pO))},_=e.length-n,v=e.slice(n).map(t=>{let n=e.some(e=>e!==t&&e.kind===t.kind&&e.number===t.number)&&t.url?new URL(t.url).pathname.split(`/`).slice(1,3).join(`/`):``;return`${t.kind} #${t.number}${n?` (${n})`:``}`}).join(`, `);return _<=0?null:(0,Q.jsxs)(Co,{open:s,onOpenChange:c,children:[(0,Q.jsx)(vo,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`reference-overflow`,title:v,"aria-label":`Show all ${e.length} references for ${t}`,onPointerEnter:h,onPointerLeave:g,onPointerDown:e=>{e.stopPropagation(),u.current=s&&l.current,l.current=!1},onClick:e=>{e.stopPropagation(),s&&(u.current||l.current)&&(e.preventDefault(),m(),d.current?.focus()),u.current=!1,l.current=!1},className:`no-hover:min-h-[44px] no-hover:min-w-[44px] max-md:min-h-[44px] max-md:min-w-[44px] 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:[`+`,_]})}),(0,Q.jsxs)(xo,{ref:d,align:`start`,collisionPadding:8,className:`w-auto min-w-40 max-h-(--radix-popover-content-available-height) overflow-y-auto overscroll-contain p-1.5`,"data-slot":`reference-overflow-list`,onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),onPointerEnter:h,onPointerLeave:g,onOpenAutoFocus:e=>{e.preventDefault(),!l.current&&e.target instanceof HTMLElement&&e.target.focus()},onKeyDownCapture:e=>{e.key===`Escape`&&(e.preventDefault(),l.current=!1,c(!1))},onCloseAutoFocus:e=>{l.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)(jo,{reference:e,taskTitle:t,projectId:i,repoBase:o,to:i===void 0?void 0:Ki(i,a,e,o),plain:r,className:`no-hover:min-h-[44px] max-md:min-h-[44px]`,conflictAction:i&&yr(e,o)?(0,Q.jsx)(ME,{projectId:i,runId:a,prNumber:e.number}):void 0},ia(e)))})]})]})}function hO({references:e,maxVisible:t,taskTitle:n,projectId:r,runId:i,repoBase:a,plain:o=!1,compact:s=!1,inertInline:c=!1,fitContainer:l=!1,overflowContainer:u}){let d=Z.useRef(null),[f,p]=Z.useState(t),m=Z.useRef(new Map),h=e.map(ia).join(`|`);Z.useLayoutEffect(()=>{let n=d.current;if(!l||!n?.parentElement){p(t);return}let r=n.parentElement,i=()=>{[...n.querySelectorAll(`:scope > [data-slot="pr-chip"], :scope > [data-slot="issue-chip"]`)].forEach((t,n)=>{let r=t.getBoundingClientRect().width;r&&m.current.set(ia(e[n]),r)});let i=r.getBoundingClientRect();if(!i.width)return;let a=Math.min(t,e.length);n.dataset.referenceWidth=String(e.slice(0,a).reduce((e,t)=>e+(m.current.get(ia(t))??48),0)+Math.max(0,a-1)*4);let o=0;for(let e=n.nextElementSibling;e;e=e.nextElementSibling){if(e.getAttribute(`data-slot`)===`task-row-age`||e.getAttribute(`aria-hidden`)===`true`&&e.nextElementSibling?.getAttribute(`data-slot`)===`task-row-age`)continue;let t=getComputedStyle(e);o+=e.getBoundingClientRect().width+(parseFloat(t.marginLeft)||0)+(parseFloat(t.marginRight)||0)}let s=i.right-n.getBoundingClientRect().left-o,l=n.querySelector(`[data-slot="reference-overflow"]`)?.getBoundingClientRect().width||(c?44:26),d=Math.min(t,e.length);for(;d>0&&!(e.slice(0,d).reduce((e,t)=>e+(m.current.get(ia(t))??48)+4,0)+(u===void 0&&d<e.length?l:0)<=s+(d===e.length?u?.getBoundingClientRect().width??0:0));)d--;p(d)};if(i(),typeof ResizeObserver>`u`)return;let a=new ResizeObserver(i);return a.observe(r),a.observe(n),()=>a.disconnect()},[l,t,h,c,e,u]);let g=Math.min(f,t,e.length),_=(0,Q.jsx)(mO,{references:e,visibleCount:g,taskTitle:n,projectId:r,runId:i,repoBase:a,plain:o});return(0,Q.jsxs)(`span`,{ref:d,"data-slot":`reference-list`,className:`inline-flex max-w-full flex-nowrap items-center gap-1 align-middle`,children:[e.slice(0,g).map(e=>(0,Q.jsx)(jo,{reference:e,taskTitle:n,projectId:r,repoBase:a,to:r===void 0?void 0:Ki(r,i,e,a),plain:o,compact:s,inert:c,className:`shrink-0`,conflictAction:r&&yr(e,a)?(0,Q.jsx)(ME,{projectId:r,runId:i,prNumber:e.number}):void 0},ia(e))),u===void 0?_:u?(0,jl.createPortal)(_,u):null]})}var gO=` untagged`,_O=[{value:`project`,label:`Project`},{value:`tag`,label:`Tag`},{value:`status`,label:`Status`},{value:`workflow`,label:`Workflow`}];function vO(e,t){return e===t?`none`:t}var yO={query:``,tags:[],statuses:[],workflows:[]};function bO(e,t){let{origin:n,...r}=e;return t===`all`?r:{...r,origin:t}}function xO(e,t){return e.includes(t)?e.filter(e=>e!==t):[...e,t]}function SO(e){return(e.projects?.length??0)+e.tags.length+e.statuses.length+e.workflows.length+(e.origin===void 0||e.origin===`all`?0:1)}function CO(e){return e.query.trim()!==``||SO(e)>0}function wO(e){return SO(e.filters)+(e.filters.query.trim()===``?0:1)+(e.groupBy===`none`?0:1)}function TO(e){return wO(e)>0}function EO(e,t){let n=new Map(t.map(e=>[e.id,e]));return e.filter(e=>!Di(e)).map(e=>{let t=n.get(e.projectId);return{run:e,project:t,projectName:t?.name||e.projectId,tags:t?.tags??[]}})}function DO(e){let t=new Set;for(let n of e)t.add(n.run.workflow);return[...t].sort((e,t)=>e.localeCompare(t))}function OO(e){let t=new Set;for(let n of e)t.add(n.run.status);return[...t].sort((e,t)=>e.localeCompare(t))}function kO(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 AO=e=>e.tags.length===0?[gO]:e.tags,jO=(e,t)=>e.length===0||t.some(t=>e.includes(t)),MO=(e,t)=>{if(t.length===0)return!0;let n=AO(e).map(e=>e.toLowerCase());return t.some(e=>n.includes(e.toLowerCase()))};function NO(e,t){return{displayTitle:ma(e.run),projectName:e.projectName,tags:e.tags,automation:e.run.automationId===void 0?void 0:t(e)??e.run.automationId,references:()=>Qi(e.run)}}function PO(e,t,n,r=()=>void 0){let i=t.query.trim()!==``;return e.filter(e=>(n===`archived`?!e.run.archived:e.run.archived)||!RE(e.run,t.origin??`all`)||!jO(t.projects??[],[e.run.projectId])||!jO(t.statuses,[e.run.status])||!jO(t.workflows,[e.run.workflow])||!MO(e,t.tags)?!1:!i||Pi(e.run,t.query,{scope:`shown`,omit:[`workflowLabel`],extras:NO(e,r)}))}function FO(e,t,n,r,i){return PO(e,r===`origin`?{...t,origin:`all`}:{...t,[r]:[]},n,i)}function IO(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(gO,`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 LO(e,t){let n=new Map(t.map(e=>[e.id,e.name]));return e.map(e=>n.get(e)||e)}var RO={query:`q`,project:`project`,tag:`tag`,untagged:`untagged`,status:`status`,workflow:`workflow`,groupBy:`group`,archived:`archived`,origin:`origin`},zO=new Set(_O.map(e=>e.value));function BO(e){let t=new URLSearchParams,n=e.filters.query.trim();n!==``&&t.set(RO.query,n);for(let n of e.filters.tags)n===` untagged`?t.set(RO.untagged,`1`):t.append(RO.tag,n);for(let n of e.filters.projects??[])t.append(RO.project,n);for(let n of e.filters.statuses)t.append(RO.status,n);for(let n of e.filters.workflows)t.append(RO.workflow,n);return e.groupBy!==`none`&&t.set(RO.groupBy,e.groupBy),e.view===`archived`&&t.set(RO.archived,`1`),e.filters.origin!==void 0&&e.filters.origin!==`all`&&t.set(RO.origin,e.filters.origin),t}function VO(e){let t=e.getAll(RO.tag).filter(e=>e!==``);e.get(RO.untagged)===`1`&&t.push(gO);let n=e.get(RO.groupBy)??``,r=LE(e.get(RO.origin));return{filters:{query:e.get(RO.query)??``,...e.has(RO.project)?{projects:e.getAll(RO.project).filter(Boolean)}:{},tags:t,statuses:e.getAll(RO.status).filter(e=>e!==``),workflows:e.getAll(RO.workflow).filter(e=>e!==``),...r===`all`?{}:{origin:r}},groupBy:zO.has(n)?n:`none`,view:e.get(RO.archived)===`1`?`archived`:`active`}}var HO=15e3,UO=250,WO=1,GO=new Set([`done`,`failed`,`cancelled`]);function KO(){return JO({request:({task:e,archived:t})=>Ln(e.run.projectId,e.run.id,t),patch:({archived:e})=>t=>({...t,archived:e})})}function qO(){return JO({request:({task:e,read:t})=>an(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 JO({request:e,patch:t}){let n=V();return Lr({mutationFn:e,onMutate:async e=>{await n.cancelQueries({queryKey:W.runsIndex});let r=n.getQueryData(W.runsIndex),i=t(e),{task:a}=e;return n.setQueryData(W.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(W.runsIndex,r.previous),H(e.message,{tone:`danger`})},onSettled:(e,t,{task:r})=>{n.invalidateQueries({queryKey:W.runsIndex}),n.invalidateQueries({queryKey:G.runs.all}),n.invalidateQueries({queryKey:[r.run.projectId,`runs`,`list`]})}})}function YO(){let e=aa(),t=kr(),n=SD(t.data),r=Fi(!0,HO),[i,a]=pD(),{filters:o,groupBy:s,view:c}=Z.useMemo(()=>VO(i),[i]),l=Tm(3e4),u=e=>a(t=>BO(e(VO(t)))),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(s!==`none`||o.tags.length>0),[g,_]=tk(o.query,e=>d(t=>({...t,query:e}))),v=r.data?.referenceStatuses;Z.useEffect(()=>{v&&hi(v)},[v]);let y=Z.useMemo(()=>e.data?.projects??[],[e.data]),b=Z.useMemo(()=>r.data?.runs??[],[r.data]),x=Z.useMemo(()=>EO(b,y),[b,y]),{nameOf:S,visible:C,originTotals:w,statusGroups:T,folds:E}=nk({tasks:x,filters:o,view:c,groupBy:s,index:b,automationsOn:t.data?.capabilities?.automations===!0}),D=Z.useMemo(()=>IO(C,s),[C,s]),O=o.origin??`all`,k=e=>d(t=>bO(t,e)),j=Z.useMemo(()=>C.flatMap(e=>sa(e.run,e.project?.repoUrl).filter(t=>yr(t,e.project?.repoUrl)).map(t=>({projectId:e.run.projectId,kind:t.kind,number:t.number}))),[C]),M=LO(r.data?.truncated??[],y),N=(e,t)=>d(n=>({...n,[e]:xO(n[e]??[],t)})),P=e=>d(t=>({...t,[e]:[]})),F=KO(),I=qO(),ee=r.error??e.error;if(ee)return(0,Q.jsx)(XO,{groupBy:s,filterDetailsOpen:m,message:ee.message,onRetry:()=>{r.refetch(),e.refetch()}});let L=(0,Q.jsxs)(`div`,{className:`relative w-full`,children:[(0,Q.jsx)(at,{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":s===`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:s===`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)(rk,{view:`active`,current:c,onSelect:p,children:`Active`}),(0,Q.jsx)(rk,{view:`archived`,current:c,onSelect:p,children:`Archived`}),(0,Q.jsxs)(`span`,{"data-slot":`global-tasks-count`,className:`ml-auto text-[13px] text-soft-foreground tabular-nums`,children:[C.length,` of `,x.length,M.length>0?` loaded`:``]})]}),(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:L}),(0,Q.jsxs)(A,{variant:`outline`,"aria-expanded":m,onClick:()=>h(e=>!e),children:[(0,Q.jsx)(pe,{"aria-hidden":`true`}),`Filters`]}),(0,Q.jsx)(A,{asChild:!0,className:`min-h-11`,children:(0,Q.jsxs)(Qt,{to:to(e.data?.bootProject??`default`,`/new`),children:[(0,Q.jsx)(Lt,{"aria-hidden":`true`}),`New task`]})})]}),(0,Q.jsx)(ZE,{origin:O,counts:w,onChange:k,labels:T.map(e=>e.label),onSetAll:E.setAll})]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[22px]`,children:[(0,Q.jsx)(ik,{filters:o,onToggle:N,onClearFacet:P,onClearAll:()=>{_(``),u(e=>({...e,filters:yO,groupBy:`none`}))},groupBy:s,onGroupByChange:f,projects:y,tasks:x,view:c,automationName:S}),(0,Q.jsx)(QO,{projects:M,perProjectLimit:r.data?.perProjectLimit}),r.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…`}):(0,Q.jsx)(ZO,{view:c,filtered:CO(o),visibleCount:C.length,referenceRequests:j,lists:{groupBy:s,view:c,statusGroups:T,groups:D,folds:E,row:{now:l,onArchive:(e,t)=>F.mutate({task:e,archived:t}),onSetRead:(e,t)=>I.mutate({task:e,read:t}),busy:F.isPending||I.isPending,showCost:n.cost,automationName:S}}}),(0,Q.jsx)($O,{registry:y})]})]})}function XO({groupBy:e,filterDetailsOpen:t,message:n,onRetry:r}){return(0,Q.jsx)(`div`,{"data-route":`global-tasks`,"data-presentation":e===`none`?`summary`:`cards`,"data-filter-details":t,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)(ra,{icon:(0,Q.jsx)(er,{}),tone:`danger`,title:`Tasks across projects did not load`,subtitle:n,actions:(0,Q.jsx)(A,{variant:`outline`,onClick:r,children:`Retry`})})})}function ZO({view:e,filtered:t,visibleCount:n,referenceRequests:r,lists:i}){return n===0?(0,Q.jsx)(fk,{view:e,filtered:t}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Do,{requests:r,children:(0,Q.jsx)(ek,{...i})}),i.groupBy===`none`?(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]})}function QO({projects:e,perProjectLimit:t}){return e.length===0?null:(0,Q.jsxs)(`p`,{"data-slot":`global-tasks-truncated`,className:`text-[11px] text-soft-foreground`,children:[`Showing every active task and the newest `,t,` archived tasks per project — older archived tasks in`,` `,e.join(`, `),` are in that project’s own Tasks page.`]})}function $O({registry:e}){return e.length<=1?null:(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:e.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)(Qt,{to:to(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))})]})}function ek({groupBy:e,view:t,statusGroups:n,groups:r,folds:i,row:a}){return(0,Q.jsx)(Q.Fragment,{children:e===`none`?n.map(e=>{let n=VE(e);return(0,Q.jsx)($E,{id:`global-group-${t}-${e.label.replaceAll(` `,`-`)}`,label:e.label,count:n.length,tone:HE(e.label,n.map(e=>e.run)),folded:i.isFolded(e.label),collapsed:i.isCollapsed(e.label),onToggle:()=>i.toggle(e.label),children:(0,Q.jsx)(ak,{tasks:e.rows.flatMap(KE),showProject:!0,...a})},e.label)}):r.map(t=>(0,Q.jsxs)(`section`,{"data-slot":`task-group`,"data-group-key":t.key,children:[(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:[e===`project`?(0,Q.jsx)(Qt,{to:to(t.key,`/`),"data-slot":`group-project-link`,className:`hover:text-foreground hover:underline`,children:t.label}):t.label,(0,Q.jsx)(`span`,{className:`font-mono text-[11px] font-medium tabular-nums`,children:t.tasks.length})]}),(0,Q.jsx)(ak,{tasks:t.tasks,showProject:e!==`project`,...a})]},t.key))})}function tk(e,t){let[n,r]=Z.useState(e),i=Z.useRef(e);return Z.useEffect(()=>{e!==i.current&&r(e),i.current=e},[e]),Z.useEffect(()=>{if(n===i.current)return;let e=setTimeout(()=>{i.current=n,t(n)},UO);return()=>clearTimeout(e)},[n]),[n,r]}function nk({tasks:e,filters:t,view:n,groupBy:r,index:i,automationsOn:a}){let o=Z.useMemo(()=>[...new Set(e.filter(e=>e.run.automationId!==void 0).map(e=>e.run.projectId))],[e]),s=zi(o,a&&o.length>0),c=Z.useCallback(e=>e.run.automationId===void 0?void 0:s(e.run.projectId,e.run.automationId),[s]),l=Z.useMemo(()=>PO(e,t,n,c),[e,t,n,c]),u=BE(FO(e,t,n,`origin`,c).map(e=>e.run),n),d=r===`none`?GE(l,n,i):[];return{nameOf:c,visible:l,originTotals:u,statusGroups:d,folds:xD(`global`,n,new Set(t.query.trim()===``?[]:d.map(e=>e.label)))}}function rk({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:s(`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 ik({filters:e,onToggle:t,onClearFacet:n,onClearAll:r,groupBy:i,onGroupByChange:a,projects:o,tasks:s,view:c,automationName:l}){let u=Z.useMemo(()=>Hr(o),[o]),d=Z.useMemo(()=>{let t=(t,n)=>kO(FO(s,e,c,t,l),n);return{projects:t(`projects`,e=>[e.run.projectId]),tags:t(`tags`,AO),statuses:t(`statuses`,e=>[e.run.status]),workflows:t(`workflows`,e=>[e.run.workflow])}},[s,e,c,l]),f=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)(uO,{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(f(d.projects)),emptyLabel:`No tasks to filter`}),(0,Q.jsx)(uO,{slot:`status`,label:`Status`,selected:e.statuses,onToggle:e=>t(`statuses`,e),onClear:()=>n(`statuses`),options:OO(s).map(e=>({value:e,label:e})).map(f(d.statuses)),emptyLabel:`No tasks to filter`}),(0,Q.jsx)(uO,{slot:`workflow`,label:`Workflow`,selected:e.workflows,onToggle:e=>t(`workflows`,e),onClear:()=>n(`workflows`),options:DO(s).map(e=>({value:e,label:e})).map(f(d.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)(fO,{slot:`group-by`,label:`Group tasks by`,value:i,options:_O,onChange:e=>a(vO(i,e))})]}),TO({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)(tt,{className:`size-3`,"aria-hidden":`true`}),`Clear`,` (${wO({filters:e,groupBy:i})})`]}):null]}),u.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`}),u.map(n=>(0,Q.jsx)(dO,{slot:`tag-filter`,tone:`tag`,label:n,count:d.tags.get(n)??0,selected:e.tags.some(e=>e.toLowerCase()===n.toLowerCase()),onToggle:()=>t(`tags`,n)},n)),(0,Q.jsx)(dO,{slot:`tag-filter`,label:`Untagged`,count:d.tags.get(` untagged`)??0,selected:e.tags.includes(gO),onToggle:()=>t(`tags`,gO)})]}):(0,Q.jsxs)(`p`,{"data-slot":`no-tags-hint`,className:`text-[11px] text-soft-foreground`,children:[`Tag connected repositories in`,` `,(0,Q.jsx)(Qt,{to:`/settings/global/projects`,className:`font-medium text-accent-text hover:underline`,children:`Settings → Projects`}),` `,`to group their tasks together here.`]})]})}function ak({tasks:e,now:t,showProject:n,onArchive:r,onSetRead:i,busy:a,showCost:o,automationName:s}){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)(nD,{children:e.map(e=>(0,Q.jsx)(ok,{task:e,now:t,showProject:n,onArchive:r,onSetRead:i,busy:a,showCost:o,automationName:s(e)},`${e.run.projectId}/${e.run.id}`))})]})}function ok({task:e,now:t,showProject:n,onArchive:r,onSetRead:i,busy:a,showCost:o,automationName:c}){let{run:l}=e,[u,d]=Z.useState(!1),f=R(l),p=to(l.projectId,`/tasks/${l.id}`),m=Zw(l),h=Qw(l),g=sa(l,e.project?.repoUrl),_=Si(l,l.usage);return(0,Q.jsxs)(`article`,{"data-status":l.status,"data-expanded":u,"data-slot":`global-task-row`,"data-run-id":l.id,"data-project":l.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:[l.delegation?.role===`worker`?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:`Worker`}):null,(0,Q.jsx)(Qt,{to:p,title:ma(l),className:s(`min-w-0 truncate text-[14px] md:text-[13px]`,m?`font-semibold text-foreground`:h?`font-medium text-muted-foreground`:`font-medium`),children:ma(l)}),m?(0,Q.jsx)(eo,{tone:eT(l),role:`img`,"aria-label":`unread`,title:`Unread — not opened since it finished`,className:`shrink-0`}):null]}),(0,Q.jsx)(`div`,{className:`mt-1`,children:(0,Q.jsx)(eD,{automationId:l.automationId,automationName:c,project:n?(0,Q.jsx)(Qt,{to:to(l.projectId,`/`),"data-slot":`task-project`,className:`truncate hover:text-foreground`,children:e.projectName}):void 0})}),(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`button`,{type:`button`,"aria-expanded":u,"aria-label":`${u?`Hide`:`Show`} resources for ${ma(l)}`,onClick:()=>d(e=>!e),"aria-describedby":`global-status-${l.projectId}-${l.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)(tE,{id:`global-status-${l.projectId}-${l.id}`,dot:f.tone,shape:f.shape,pulse:f.pulse,children:f.label})}),(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)(uk,{tag:e},e))}):null})]})]}),(0,Q.jsx)(`div`,{"data-slot":`global-task-references`,children:g.length>0?(0,Q.jsx)(lk,{references:g,run:l,repoBase:e.project?.repoUrl}):(0,Q.jsx)(dk,{})}),(0,Q.jsx)(`div`,{"data-slot":`global-task-workflow`,className:`text-[13px] text-muted-foreground`,children:l.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:Va(l.startedAt??l.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)(sk,{task:e,busy:a,onSetRead:i}),(0,Q.jsx)(ck,{task:e,busy:a,onArchive:r}),(0,Q.jsx)(A,{asChild:!0,variant:`outline`,children:(0,Q.jsx)(Qt,{to:p,children:`Open task`})})]})}),u?(0,Q.jsxs)(`div`,{"data-slot":`global-task-resources`,className:`col-span-full flex flex-col gap-3`,children:[(0,Q.jsx)(tD,{projectId:l.projectId,runId:l.id,status:f.label,error:l.error,open:(0,Q.jsx)(A,{asChild:!0,variant:`outline`,className:`min-h-11`,children:(0,Q.jsxs)(Qt,{to:p,children:[`Open task`,(0,Q.jsxs)(`span`,{className:`sr-only`,children:[`: `,ma(l)]})]})})}),(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:si(l.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":_.cpu.kind,title:_.cpu.title,className:`mt-1`,children:_.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":_.mem.kind,title:_.mem.title,className:`mt-1`,children:_.mem.text||`—`})]})]})]}):null]})}function sk({task:e,busy:t,onSetRead:n}){if(!Xw(e.run))return null;let r=Zw(e.run),i=ma(e.run),a=r?`Mark ${i} read`:`Mark ${i} unread`,o=r?wo:dc;return(0,Q.jsxs)(rD,{children:[(0,Q.jsx)(iD,{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:s(`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)(aD,{side:`left`,children:r?`Mark read`:`Mark unread`})]})}function ck({task:e,busy:t,onArchive:n}){let r=e.run.archived;if(!r&&!GO.has(e.run.status))return null;let i=r?`Restore ${ma(e.run)} to the active list`:`Archive ${ma(e.run)}`;return(0,Q.jsxs)(rD,{children:[(0,Q.jsx)(iD,{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?Us:ot,{className:`size-3.5`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{children:r?`Unarchive`:`Archive`})]})}),(0,Q.jsx)(aD,{side:`left`,children:r?`Restore`:`Archive`})]})}function lk({references:e,run:t,repoBase:n}){return(0,Q.jsx)(hO,{references:e,maxVisible:WO,taskTitle:ma(t),projectId:t.projectId,runId:t.id,repoBase:n})}function uk({tag:e,className:t}){return(0,Q.jsx)(`span`,{"data-slot":`project-tag`,className:s(`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 dk(){return(0,Q.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`—`})}function fk({view:e,filtered:t}){return t?(0,Q.jsx)(ra,{heading:`h2`,icon:(0,Q.jsx)(Oo,{}),tone:`neutral`,title:`No matching tasks`,subtitle:`No task in any project matches these filters.`}):e===`archived`?(0,Q.jsx)(ra,{heading:`h2`,icon:(0,Q.jsx)(ot,{}),tone:`neutral`,title:`Nothing archived yet`,subtitle:`Finished tasks you archive land here, from every project.`}):(0,Q.jsx)(ra,{heading:`h2`,icon:(0,Q.jsx)(Dc,{}),tone:`neutral`,title:`No tasks yet`,subtitle:`Start a task in any project and it shows up here.`})}var pk=new Map;function mk(e){let t=pk.get(e);return t||(t=new Intl.DateTimeFormat(`en-CA`,{timeZone:e,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`}),pk.set(e,t)),t}function hk(e,t){try{let n=mk(t).formatToParts(new Date(e)),r=e=>Number(n.find(t=>t.type===e)?.value),i=r(`year`),a=r(`month`),o=r(`day`);return{year:i,month:a,day:o,hour:r(`hour`)%24,minute:r(`minute`),second:r(`second`),weekday:gk(i,a,o)}}catch{return null}}function gk(e,t,n){return(new Date(Date.UTC(e,t-1,n)).getUTCDay()+6)%7+1}function _k(e,t){let n=hk(t,e);return n?Date.UTC(n.year,n.month-1,n.day,n.hour,n.minute,n.second)-t:null}function vk(e,t,n,r,i,a){let o=Date.UTC(e,t-1,n,r,i,0,0),s=o;for(let e=0;e<3;e+=1){let e=_k(a,s);if(e===null)return null;let t=o-e;if(Math.abs(t-s)<1e3)return t;s=t}return s}function yk(e){if(!e)return!1;try{return mk(e).format(new Date(0)),!0}catch{return!1}}var bk=[`daily`,`weekdays`,`weekly`,`hours`,`once`],xk=[1,2,3,4,6,8,12],Sk=[`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sun`],Ck=[`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`,`Sunday`],wk=43200,Tk=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})$/,Ek=[`hour`,`minute`,`day`,`every`],Dk=[`at`,`timeZone`,`latestStartMinutes`],Ok=`the due time has passed; choose a later time or use Run now`;function kk(e){return`unknown time zone "${e}"; use an IANA name such as Europe/Warsaw`}var Ak=q({type:wa(bk),hour:K().int().min(0).max(23).optional(),minute:K().int().min(0).max(59).optional(),day:K().int().min(1).max(7).optional(),every:Ma([Aa(1),Aa(2),Aa(3),Aa(4),Aa(6),Aa(8),Aa(12)]).optional(),at:J().regex(Tk,`at must be YYYY-MM-DDTHH:MM`).optional(),timeZone:J().optional(),latestStartMinutes:K().int().min(10).max(wk).optional()}).superRefine((e,t)=>{let n=t=>e[t]!==void 0,r=(e,n)=>t.addIssue({code:`custom`,path:[e],message:n});if(e.type!==`once`){for(let e of Dk)n(e)&&r(e,`${e} applies only to a once schedule`);return}for(let e of Ek)n(e)&&r(e,`${e} does not apply to a once schedule`);e.at===void 0?r(`at`,`a once schedule needs at (YYYY-MM-DDTHH:MM)`):Tk.test(e.at)&&!Pk(e.at)&&r(`at`,`at is not a real date and time`),e.timeZone===void 0?r(`timeZone`,`a once schedule needs a timeZone`):yk(e.timeZone)||r(`timeZone`,kk(e.timeZone))});function jk(e){return{type:e.type,hour:e.hour??4,minute:e.minute??0,day:e.day??1,every:e.every??6,...e.at===void 0?{}:{at:e.at},...e.timeZone===void 0?{}:{timeZone:e.timeZone},...e.latestStartMinutes===void 0?{}:{latestStartMinutes:e.latestStartMinutes}}}function Mk(e){if(e.type!==`once`||!e.at||!e.timeZone)return null;let t=Nk(e.at);return t&&vk(t.year,t.month,t.day,t.hour,t.minute,e.timeZone)}function Nk(e){let t=Tk.exec(e);if(!t)return null;let[n,r,i,a,o]=t.slice(1).map(Number),s=new Date(Date.UTC(n,r,0)).getUTCDate();return r<1||r>12||i<1||i>s||a>23||o>59?null:{year:n,month:r,day:i,hour:a,minute:o}}var Pk=e=>Nk(e)!==null,Fk=e=>String(e).padStart(2,`0`);function Ik(e,t=0){return`${Fk(e)}:${Fk(t)}`}function Lk(e){let t=jk(e);switch(t.type){case`once`:return Rk(t);case`daily`:return`every day at ${Ik(t.hour,t.minute)}`;case`weekdays`:return`weekdays at ${Ik(t.hour,t.minute)}`;case`hours`:return t.every===1?`every hour`:`every ${t.every} hours`;case`weekly`:return`${Ck[t.day-1]}s at ${Ik(t.hour,t.minute)}`}}function Rk(e){let t=e.at?Nk(e.at):null;if(!t)return`once`;let{year:n,month:r,day:i,hour:a,minute:o}=t;return`once on ${Sk[gk(n,r,i)-1]} ${i} ${zk[r-1]} ${n} at ${Ik(a,o)} (${e.timeZone??`UTC`})`}var zk=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`];function Bk(e){let t=jk(e);switch(t.type){case`once`:throw Error(`a once schedule has no cron form`);case`daily`:return`${t.minute} ${t.hour} * * *`;case`weekdays`:return`${t.minute} ${t.hour} * * 1-5`;case`hours`:return`0 */${t.every} * * *`;case`weekly`:return`${t.minute} ${t.hour} * * ${t.day%7}`}}function Vk(e,t){switch(e.type){case`once`:return[];case`daily`:return[[e.hour,e.minute]];case`weekdays`:return t<=5?[[e.hour,e.minute]]:[];case`weekly`:return t===e.day?[[e.hour,e.minute]]:[];case`hours`:{let t=[];for(let n=0;n<24;n+=e.every)t.push([n,0]);return t}}}function Hk(e,t,n,r,i=1e3){if(e.type===`once`){let r=Mk(e);return r!==null&&r>=t&&r<n&&i>0?[r]:[]}let a=jk(e),o=hk(t,r);if(!o||n<=t)return[];let s=[],c=Math.ceil((n-t)/864e5)+2;for(let e=-1;e<=c;e+=1){let c=new Date(Date.UTC(o.year,o.month-1,o.day+e)),l=c.getUTCFullYear(),u=c.getUTCMonth()+1,d=c.getUTCDate();for(let[e,o]of Vk(a,gk(l,u,d))){let a=vk(l,u,d,e,o,r);if(a===null||a!==s.at(-1)&&a>=t&&a<n&&(s.push(a),s.length>=i))return s}}return s}function Uk(e,t){let n=t-e;if(n<=0)return`now`;let r=Math.floor(n/6e4);if(r<1)return`in <1m`;if(r<60)return`in ${r}m`;let i=Math.floor(r/60);return i<24?`in ${i}h`:`in ${Math.floor(i/24)}d`}var Wk=new Map;function Gk(e,t){if(!Number.isFinite(e))return null;let n=Wk.get(t);try{n??=new Intl.DateTimeFormat(`en-GB`,{timeZone:t,weekday:`short`,year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`})}catch{return null}Wk.set(t,n);let r={};for(let t of n.formatToParts(e))r[t.type]=t.value;let i=new Date(`${r.month} 1, ${r.year} UTC`).getUTCMonth();return{weekday:r.weekday,day:r.day,month:r.month,hour:r.hour,minute:r.minute,key:`${r.year}-${i}-${r.day}`,dayNumber:Math.floor(Date.UTC(Number(r.year),i,Number(r.day))/864e5)}}function Kk(e,t){let n=Gk(Date.parse(e),t);return n?`${n.weekday} ${n.hour}:${n.minute}`:e}function qk(e,t,n){let r=Gk(Date.parse(e),t),i=Gk(n,t);if(!r||!i)return e;let a=`${r.hour}:${r.minute}`,o=i.dayNumber-r.dayNumber;return o===0?`Today ${a}`:o===1?`Yesterday ${a}`:o>1&&o<7?`${r.weekday} ${a}`:`${r.day} ${r.month} ${a}`}var Jk=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],Yk=e=>String(e).padStart(2,`0`);function Xk(e){let t=e?Nk(e):null;if(!t)return null;let{year:n,month:r,day:i,hour:a,minute:o}=t;return{date:`${Sk[gk(n,r,i)-1]} ${i} ${Jk[r-1]} ${n}`,time:`${Yk(a)}:${Yk(o)}`}}var Zk=36e5;function Qk(e){let t=Mk(e),n=e.timeZone,r=Xk(e.at),i=t===null||!n?null:hk(t,n);if(t===null||!n||!r||!i)return null;let a={date:`${Sk[gk(i.year,i.month,i.day)-1]} ${i.day} ${Jk[i.month-1]} ${i.year}`,time:`${Yk(i.hour)}:${Yk(i.minute)}`};if(a.date!==r.date||a.time!==r.time)return{...a,note:`${r.time} does not exist on ${r.date} in ${n}.`};let o=e=>{let t=hk(e,n);return!!t&&t.day===i.day&&t.hour===i.hour&&t.minute===i.minute},s=(_k(n,t-12*Zk)??0)-(_k(n,t+12*Zk)??0);if(s<=0)return a;let c=o(t+s);if(!c&&!o(t-s))return a;let l=(_k(n,t)??0)/6e4,u=`UTC${l<0?`-`:`+`}${Yk(Math.floor(Math.abs(l)/60))}:${Yk(Math.abs(l)%60)}`;return{...a,note:`${r.time} happens twice that day; it runs at ${c?`the first`:`the second`} (${u}).`}}var $k=wa([`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`]),eA=q({includeExisting:ka().optional(),authors:Ca(J()).optional(),assignees:Ca(J()).optional(),requireCurrentLabels:ka().optional(),allLabels:Ca(J()).optional(),anyLabels:Ca(J()).optional(),excludeLabels:Ca(J()).optional(),changedLabels:Ca(J()).optional(),lookbackDays:K(),maxRecords:K()}),tA=wa([`github`,`schedule`]),nA=qe.omit({task:!0,images:!0,systemPrompt:!0}).extend({prompt:J(),variants:Ma([Aa(1),Aa(2),Aa(3)]).optional(),systemPrompt:J().optional()}),rA=q({at:J(),outcome:wa([`launched`,`cancelled`]),runId:J().optional(),receiptId:J().optional(),trigger:wa([`schedule`,`late`,`manual`,`retry`]).optional()}),iA=wa([`paused`,`waiting`,`failed`,`missed`,`archived`]),aA=q({id:J(),revision:K(),name:J(),description:J().optional(),enabled:ka(),kind:tA,events:Ca($k).optional(),intervalSeconds:K().optional(),filters:eA.optional(),schedule:Ak.optional(),task:nA,archived:rA.optional(),createdAt:J(),updatedAt:J()}),oA=q({timestamp:J(),tieBreaker:J().optional()}),sA=q({since:J().datetime(),until:J().datetime(),source:K().int().min(0).max(2),page:K().int().min(1).max(10),item:K().int().min(0).max(100),event:K().int().min(0).max(1e3),cursor:oA.optional()}),cA=q({revision:K().optional(),baselineAt:J().optional(),armedAt:J().optional(),historyScan:sA.optional(),cursor:oA.optional(),frozenHighWatermark:oA.extend({tieBreaker:J()}).optional(),backlogAfter:oA.extend({tieBreaker:J()}).optional(),nextCheckAt:J().optional(),lastSuccessAt:J().optional(),nextRunAt:J().optional(),lastRunAt:J().optional(),etags:Fa(J(),J()).optional(),backoffUntil:J().optional(),consecutiveFailures:K().optional(),onceOutcome:wa([`failed`,`missed`]).optional()}),lA=wa([`launched`,`no-match`,`duplicate`,`rate-limited`,`error`,`baseline`,`preview`,`skipped`,`manual`,`catch-up`,`failed`,`missed`]),uA=q({seq:K(),ts:J(),automationId:J(),revision:K(),event:$k.optional(),result:lA,reason:J().optional(),durationMs:K().optional(),receiptId:J().optional(),runId:J().optional(),githubNumber:K().optional(),githubTitle:J().optional(),githubUrl:J().optional(),rateLimit:q({bucket:wa([`core`,`search`]),remaining:K().optional(),resetAt:J().optional()}).optional()}),dA=q({matches:K(),launched:K(),duplicates:K(),errors:K()}),fA=aA.extend({state:cA.optional(),latestLog:uA.optional(),counts:dA,nextRunAt:J().optional(),onceStatus:iA.optional()});q({available:ka(),reason:J().optional(),timeZone:J(),scheduler:q({state:wa([`scheduled`,`idle`]),nextDue:J().optional()}),automations:Ca(fA)}),q({automation:aA}).extend({once:q({dueAt:J(),timeZone:J(),resolvedInstant:J(),note:J()}).optional()}),q({automation:aA,state:cA.optional(),latestLog:uA.optional(),onceStatus:iA.optional()}),q({id:J(),automationId:J(),mode:wa([`preview`,`execute`]),status:wa([`queued`,`running`,`complete`,`error`]),createdAt:J(),completedAt:J().optional(),matches:K().optional(),truncated:ka().optional(),error:J().optional()}),q({checkId:J()}),q({records:Ca(uA)}),q({receiptId:J(),runId:J()}),q({runId:J()}),aA.omit({id:!0,revision:!0,createdAt:!0,updatedAt:!0,enabled:!0,kind:!0,archived:!0}).extend({kind:tA.optional(),task:nA.extend({variants:Se}),enable:ka().optional()}).omit({enable:!0}).extend({enabled:ka().optional(),expectedRevision:K()}),q({archived:wa([`include`,`only`]).optional()}),q({mode:wa([`preview`,`execute`])});function pA({...e}){return(0,Q.jsx)(ql,{"data-slot":`select`,...e})}function mA({...e}){return(0,Q.jsx)(Zl,{"data-slot":`select-value`,...e})}function hA({className:e,size:t=`default`,children:n,...r}){return(0,Q.jsxs)(Yl,{"data-slot":`select-trigger`,"data-size":t,className:s(`flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-[var(--task-brand-bg)] px-3 py-2 text-sm whitespace-nowrap shadow-none transition-[color,box-shadow] outline-hidden focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-11 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 pointer-hover:bg-muted [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...r,children:[n,(0,Q.jsx)($l,{asChild:!0,children:(0,Q.jsx)(Ke,{className:`size-4 opacity-50`})})]})}function gA({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...i}){return(0,Q.jsx)(ru,{children:(0,Q.jsxs)(au,{"data-slot":`select-content`,className:s(`relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=left]:slide-in-from-right-2 motion-safe:data-[side=right]:slide-in-from-left-2 motion-safe:data-[side=top]:slide-in-from-bottom-2 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0 motion-safe:data-[state=open]:zoom-in-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...i,children:[(0,Q.jsx)(vA,{}),(0,Q.jsx)(bu,{className:s(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1`),children:t}),(0,Q.jsx)(yA,{})]})})}function _A({className:e,children:t,...n}){return(0,Q.jsxs)(Au,{"data-slot":`select-item`,className:s(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pe-8 ps-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,Q.jsx)(`span`,{"data-slot":`select-item-indicator`,className:`absolute end-2 flex size-3.5 items-center justify-center`,children:(0,Q.jsx)(Pu,{children:(0,Q.jsx)(ze,{className:`size-4`})})}),(0,Q.jsx)(Mu,{children:t})]})}function vA({className:e,...t}){return(0,Q.jsx)(Iu,{"data-slot":`select-scroll-up-button`,className:s(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,Q.jsx)(xe,{className:`size-4`})})}function yA({className:e,...t}){return(0,Q.jsx)(Ru,{"data-slot":`select-scroll-down-button`,className:s(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,Q.jsx)(Ke,{className:`size-4`})})}function bA({title:e,subtitle:t,action:n,children:r}){return(0,Q.jsxs)(`main`,{"data-route":`automations`,className:`task-flow-page w-full max-w-full min-w-0 max-md:p-4!`,children:[(0,Q.jsxs)(`header`,{className:`mb-6 flex flex-col items-start gap-5 max-md:mb-4 max-md:gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h1`,{className:`mb-2 text-[28px] font-medium max-md:text-[22px]`,children:e}),(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t})]}),n]}),r]})}function xA({text:e}){return(0,Q.jsx)(`div`,{role:`status`,className:`rounded-xl border bg-card p-6 text-sm text-muted-foreground`,children:e})}var SA={launched:`success`,manual:`success`,"catch-up":`success`,skipped:`neutral`,missed:`neutral`,"no-match":`neutral`,preview:`neutral`,baseline:`neutral`,duplicate:`neutral`,failed:`danger`,error:`danger`,"rate-limited":`danger`},CA={launched:`Launched`,manual:`Manual`,"catch-up":`Catch up`,skipped:`Skipped`,missed:`Missed`,"no-match":`No match`,preview:`Preview`,baseline:`Baseline`,duplicate:`Duplicate`,failed:`Failed`,error:`Error`,"rate-limited":`Rate limited`};function wA(e){let[t,n]=(0,Z.useState)(),[r,i]=(0,Z.useState)(``),a=(0,Z.useCallback)(t=>Le(e,{signal:t}).then(({records:e})=>{t?.aborted||(n(e),i(``))}).catch(e=>{t?.aborted||i(String(e))}),[e]);return(0,Z.useEffect)(()=>{a()},[a]),(0,Z.useEffect)(()=>zt(a),[a]),(0,Z.useEffect)(()=>_s((t,n)=>{t===`automation-change`&&n.automationId===e&&a()}),[e,a]),{records:t,error:r,refresh:a}}function TA(e,t){return e.result!==`failed`&&e.result!==`error`||!e.receiptId||e.runId?!1:!t.some(t=>t.receiptId===e.receiptId&&(t.runId||t.seq>e.seq))}function EA({records:e,all:t,timeZone:n,onRetried:r,readOnly:i=!1}){let a=e=>!i&&TA(e,t),[o,s]=(0,Z.useState)(),[c,l]=(0,Z.useState)(),u=Date.now(),d=async e=>{s(e),l(void 0);try{await An(e),r()}catch(t){l({receiptId:e,message:t instanceof Error?t.message:String(t)})}finally{s(void 0)}};return(0,Q.jsx)(`ol`,{className:`grid gap-3`,"aria-label":`Automation execution log`,children:e.map(e=>(0,Q.jsxs)(`li`,{className:`min-w-0 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)(tE,{dot:SA[e.result],children:CA[e.result]}),(0,Q.jsx)(`time`,{className:`text-xs text-muted-foreground`,dateTime:e.ts,title:e.ts,children:qk(e.ts,n,u)})]}),e.reason?(0,Q.jsx)(`p`,{className:`mt-2 text-sm break-words text-muted-foreground`,children:e.reason}):null,e.githubUrl||e.runId||a(e)?(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-4 gap-y-2 text-sm`,children:[e.githubUrl?(0,Q.jsx)(`a`,{className:`inline-flex min-h-11 items-center underline underline-offset-4 break-all`,href:e.githubUrl,target:`_blank`,rel:`noreferrer`,children:e.githubTitle??`GitHub #${e.githubNumber??``}`}):null,e.runId?(0,Q.jsx)(X,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${e.runId}`,children:`Open task`}):null,a(e)?(0,Q.jsx)(A,{variant:`outline`,disabled:o===e.receiptId,onClick:()=>void d(e.receiptId),children:`Retry task`}):null]}):null,c&&c.receiptId===e.receiptId?(0,Q.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm break-words text-destructive`,children:c.message}):null]},e.seq))})}var DA=`all`;function OA({label:e,value:t,onChange:n,options:r}){return(0,Q.jsxs)(pA,{value:t,onValueChange:n,children:[(0,Q.jsx)(hA,{"aria-label":e,className:`w-full sm:w-52`,children:(0,Q.jsx)(mA,{})}),(0,Q.jsx)(gA,{children:r.map(e=>(0,Q.jsx)(_A,{value:e.value,children:e.label},e.value))})]})}function kA({automationId:e,automationName:t,timeZone:n,readOnly:r=!1}){let{records:i,error:a,refresh:o}=wA(e),[s,c]=(0,Z.useState)(DA),[l,u]=(0,Z.useState)(DA),d=(0,Z.useMemo)(()=>(i??[]).filter(e=>(s===DA||e.result===s)&&(l===DA||e.event===l)),[i,s,l]),f=(i??[]).some(e=>e.event);return(0,Q.jsx)(bA,{title:`Execution log`,subtitle:t??`Automation activity`,action:(0,Q.jsx)(A,{variant:`outline`,asChild:!0,children:(0,Q.jsx)(X,{to:`/automations`,children:`Back to automations`})}),children:a&&!i?(0,Q.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,Q.jsx)(xA,{text:a}),(0,Q.jsx)(A,{variant:`outline`,onClick:()=>void o(),children:`Retry`})]}):i?i.length===0?(0,Q.jsx)(xA,{text:`Nothing has run yet.`}):(0,Q.jsxs)(`div`,{className:`grid gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsx)(OA,{label:`Result`,value:s,onChange:c,options:[{value:DA,label:`All results`},...lA.options.map(e=>({value:e,label:CA[e]}))]}),f?(0,Q.jsx)(OA,{label:`Event`,value:l,onChange:u,options:[{value:DA,label:`All events`},...$k.options.map(e=>({value:e,label:e}))]}):null]}),d.length===0?(0,Q.jsx)(xA,{text:`No rows match these filters.`}):(0,Q.jsx)(EA,{records:d,all:i,timeZone:n,onRetried:()=>void o(),readOnly:r})]}):(0,Q.jsx)(xA,{text:`Loading execution log…`})})}function AA({automationId:e,automationName:t,timeZone:n,showName:r=!1,readOnly:i=!1}){let{records:a,error:o,refresh:s}=wA(e);return(0,Q.jsxs)(`section`,{"data-slot":`automation-inline-log`,className:`mt-4 min-w-0 border-t pt-4`,children:[(0,Q.jsxs)(`h3`,{className:`mb-3 text-sm font-medium`,children:[`Recent activity`,r&&t?` · ${t}`:``]}),o&&!a?(0,Q.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,Q.jsx)(xA,{text:o}),(0,Q.jsx)(A,{variant:`outline`,onClick:()=>void s(),children:`Retry`})]}):a?a.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Nothing has run yet.`}):(0,Q.jsx)(EA,{records:a.slice(0,5),all:a,timeZone:n,onRetried:()=>void s(),readOnly:i}):(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading activity…`})]})}function jA({automation:e,timeZone:t,onDeleted:n}){let r=e.archived,i=e.schedule,a=i?Qk(i):null,[o,s]=(0,Z.useState)(!1),[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(``),f=(0,Z.useRef)(null),p=(0,Z.useRef)(null),m=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{let e=m.current===`keep`?p.current:m.current===`delete`?f.current:null;m.current=null,e?.focus()},[o]);let h=async()=>{l(!0);try{await on(e.id),n()}catch(e){d(e instanceof Error?e.message:String(e)),l(!1)}},g=[[`Workflow`,e.task.workflow],[`Runner`,e.task.runner],[`Model`,e.task.model],[`Effort`,e.task.effort]];return(0,Q.jsx)(bA,{title:e.name,subtitle:`Archived one-time schedule. It cannot change; delete it when you no longer need the record.`,children:(0,Q.jsxs)(`div`,{className:`grid min-w-0 max-w-3xl gap-5`,children:[(0,Q.jsxs)(`section`,{className:`min-w-0 rounded-xl border bg-card p-4`,children:[(0,Q.jsxs)(`p`,{className:`text-sm break-words`,children:[(0,Q.jsx)(`span`,{children:r.outcome===`launched`?`Started its task.`:`Cancelled — no task was started.`}),r.runId?(0,Q.jsxs)(Q.Fragment,{children:[` · `,(0,Q.jsx)(X,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${r.runId}`,children:`Open task`})]}):null]}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Archived ${Kk(r.at,t)} (${t}).`}),a&&i?.timeZone?(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Was due ${a.date} ${a.time} (${i.timeZone}).`}):null]}),(0,Q.jsxs)(`section`,{"aria-labelledby":`archived-inputs`,className:`min-w-0 rounded-xl border bg-card p-4`,children:[(0,Q.jsx)(`h2`,{id:`archived-inputs`,className:`mb-3 text-[15px] font-medium`,children:`What it ran with`}),(0,Q.jsxs)(`dl`,{className:`grid gap-3 text-sm`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-1`,children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Prompt`}),(0,Q.jsx)(`dd`,{className:`break-words whitespace-pre-wrap`,children:e.task.prompt})]}),g.filter(([,e])=>e).map(([e,t])=>(0,Q.jsxs)(`div`,{className:`grid gap-1`,children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,Q.jsx)(`dd`,{className:`break-words`,children:t})]},e))]})]}),(0,Q.jsxs)(`section`,{className:`min-w-0`,children:[(0,Q.jsx)(AA,{automationId:e.id,automationName:e.name,timeZone:t,readOnly:!0}),(0,Q.jsx)(A,{variant:`outline`,asChild:!0,className:`mt-3`,children:(0,Q.jsx)(X,{to:`/automations/${e.id}/log`,children:`Execution log`})})]}),(0,Q.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[o?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`text-sm break-words`,children:`Delete “${e.name}”? Its record and log are removed; the task stays.`}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsx)(A,{variant:`danger-ghost`,"data-action":`automation-delete-confirm`,disabled:c,onClick:()=>void h(),children:`Delete schedule`}),(0,Q.jsx)(A,{ref:p,variant:`outline`,disabled:c,onClick:()=>{m.current=`delete`,s(!1)},children:`Keep`})]})]}):(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsx)(A,{ref:f,variant:`outline`,"data-action":`automation-delete`,onClick:()=>{m.current=`keep`,s(!0)},children:`Delete`}),(0,Q.jsx)(A,{variant:`outline`,asChild:!0,children:(0,Q.jsx)(X,{to:`/automations`,children:`Back to automations`})})]}),u?(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:u}):null]})]})})}function MA({className:e,...t}){return(0,Q.jsx)(kl,{"data-slot":`label`,className:s(`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})}var NA=`quick-task`;function PA(e={}){let{prompt:t,workflow:n,runner:r,model:i,autonomous:a,archiveWhenDone:o,autoMergePr:s,variants:c,...l}=e.task??{prompt:``},u=e.task===void 0;return{retiredVariants:c!==void 0&&c!==1,name:e.name??``,description:e.description??``,kind:e.kind??`schedule`,schedule:jk(e.schedule??{type:`daily`}),events:e.events??[`issue.opened`],intervalSeconds:e.intervalSeconds??300,filters:e.filters??{lookbackDays:7,maxRecords:25},prompt:t,...n===void 0?u?{workflow:NA}:{}:{workflow:n},...r===void 0?{}:{runner:r},...i===void 0?{}:{model:i},autonomous:a??!0,archiveWhenDone:o??!1,autoMergePr:s??!1,enabled:e.enabled??e.enable??!1,taskExtra:l}}function FA(e){switch(e.type){case`daily`:case`weekdays`:return{type:e.type,hour:e.hour,minute:e.minute};case`weekly`:return{type:`weekly`,hour:e.hour,minute:e.minute,day:e.day};case`hours`:return{type:`hours`,every:e.every};case`once`:return{type:`once`,at:e.at??``,timeZone:e.timeZone??``,...e.latestStartMinutes===void 0?{}:{latestStartMinutes:e.latestStartMinutes}}}}function IA(e){if(e.retiredVariants)throw Error(`Parallel variants are removed. Choose Use one task before saving this automation.`);return{...e.taskExtra,prompt:e.prompt,...e.workflow?{workflow:e.workflow}:{},...e.runner?{runner:e.runner}:{},...e.model?{model:e.model}:{},autonomous:e.autonomous,...e.archiveWhenDone?{archiveWhenDone:!0}:{},...e.autoMergePr?{autoMergePr:!0}:{}}}function LA(e){return{name:e.name.trim(),...e.description.trim()?{description:e.description.trim()}:{},kind:e.kind,...e.kind===`schedule`?{schedule:FA(e.schedule)}:{events:e.events,intervalSeconds:e.intervalSeconds,filters:e.filters},task:IA(e)}}function RA(e){return{...LA(e),enable:e.enabled}}function zA(e,t){return{...LA(e),task:{...IA(e),archiveWhenDone:e.archiveWhenDone,autoMergePr:e.autoMergePr},enabled:e.enabled,expectedRevision:t}}function BA(e){return`'${e.replace(/'/g,`'\\''`)}'`}var VA=new Set([`prompt`,`workflow`,`runner`,`model`,`autonomous`,`worktree`,`archiveWhenDone`,`autoMergePr`]),HA=new Set([`anyLabels`,`authors`,`changedLabels`]);function UA(e){if(e.description!==void 0||!e.name.trim()||!e.task.prompt.trim())return!1;let t=e.task;if(Object.keys(t).some(e=>!VA.has(e))||t.archiveWhenDone===!1||t.autoMergePr===!1||t.worktree!==!0)return!1;if(e.kind===`schedule`)return e.schedule!==void 0;let{events:n,filters:r}=e;return!n?.length||n.some(e=>e.includes(`,`))||!r||r.lookbackDays!==7||r.maxRecords!==25?!1:Object.entries(r).every(([e,t])=>e===`lookbackDays`||e===`maxRecords`||e===`includeExisting`&&t===!0||HA.has(e)&&Array.isArray(t)&&t.length>0)}function WA(e){return e%3600==0?`${e/3600}h`:e%60==0?`${e/60}m`:`${e}s`}function GA(e){return e%1440==0?`${e/1440}d`:e%60==0?`${e/60}h`:`${e}m`}function KA(e,t){return t.startsWith(`-`)?`--${e}=${BA(t)}`:`--${e} ${BA(t)}`}function qA(e){let t=[`cez automation add`,KA(`name`,e.name)];if(e.schedule?.type===`once`)t.push(KA(`at`,e.schedule.at),KA(`tz`,e.schedule.timeZone)),e.schedule.latestStartMinutes!==void 0&&t.push(KA(`latest-start`,GA(e.schedule.latestStartMinutes)));else if(e.kind===`schedule`)t.push(KA(`cron`,Bk(e.schedule)));else{t.push(KA(`on`,e.events.join(`,`)),`--every ${WA(e.intervalSeconds??300)}`),e.filters?.includeExisting&&t.push(`--include-existing`);for(let n of e.filters?.anyLabels??[])t.push(KA(`label`,n));for(let n of e.filters?.authors??[])t.push(KA(`author`,n));for(let n of e.filters?.changedLabels??[])t.push(KA(`changed-label`,n))}let{task:n}=e;return n.workflow&&t.push(KA(`workflow`,n.workflow)),n.runner&&t.push(KA(`runner`,n.runner)),n.model&&t.push(KA(`model`,n.model)),n.autonomous===!1&&t.push(`--no-autonomous`),n.archiveWhenDone&&t.push(`--archive-when-done`),n.autoMergePr&&t.push(`--auto-merge-pr`),e.enable===!0&&t.push(`--enable`),t.push(KA(`prompt`,n.prompt)),t.join(` `)}function JA(e,t){let n=RA(e),r=UA(n)?qA(n):`cez automation create --json ${BA(JSON.stringify(n))}`;return t?`CEZ_COCKPIT_URL=${BA(t.origin)} CEZ_PROJECT_ID=${BA(t.projectId)} ${r}`:r}function YA({draft:e}){let t=Wa(),n=window.location.origin,r=(0,Z.useMemo)(()=>JA(e,t?{origin:n,projectId:t}:void 0),[e,n,t]),[i,a]=(0,Z.useState)(`idle`),o=(0,Z.useRef)(void 0);(0,Z.useEffect)(()=>()=>clearTimeout(o.current),[]),(0,Z.useEffect)(()=>a(`idle`),[r]);let s=async()=>{clearTimeout(o.current);try{await navigator.clipboard.writeText(r),a(`copied`),o.current=setTimeout(()=>a(`idle`),1600)}catch{a(`failed`)}};return(0,Q.jsxs)(`section`,{"aria-labelledby":`copy-as-cli-heading`,"data-slot":`copy-as-cli`,className:`mbs-4 rounded-xl border bg-card p-4`,children:[(0,Q.jsxs)(`div`,{className:`mbe-2 flex items-center gap-2`,children:[(0,Q.jsx)(`h2`,{id:`copy-as-cli-heading`,className:`text-[15px] font-medium`,children:`Copy as CLI`}),(0,Q.jsxs)(A,{type:`button`,variant:`ghost`,size:`sm`,className:`ms-auto`,onClick:()=>void s(),children:[i===`copied`?(0,Q.jsx)(Ys,{"aria-hidden":`true`}):(0,Q.jsx)(ac,{"aria-hidden":`true`}),i===`copied`?`Copied`:`Copy`]})]}),(0,Q.jsx)(`pre`,{className:`m-0 rounded-lg border bg-muted px-2.5 py-2 font-mono text-xs/relaxed break-words whitespace-pre-wrap text-muted-foreground`,children:r}),(0,Q.jsx)(`p`,{role:`status`,className:`mbs-2 text-xs break-words text-muted-foreground`,children:i===`failed`?`Could not copy — select the line and copy it by hand.`:(0,Q.jsxs)(Q.Fragment,{children:[`The definition Save would create. `,(0,Q.jsx)(`code`,{children:`cez automation schema`}),` prints its shape.`]})})]})}function XA({pressed:e,onClick:t,disabled:n,children:r}){return(0,Q.jsx)(`button`,{type:`button`,"aria-pressed":e,disabled:n,onClick:t,className:s(yh,`h-11 px-4 text-[13px]`,e&&`border-transparent bg-accent-strong text-accent-strong-foreground hover:bg-accent-strong hover:text-accent-strong-foreground`),children:r})}var ZA=$k.options,QA=[{seconds:60,label:`1 minute`},{seconds:300,label:`5 minutes`},{seconds:900,label:`15 minutes`},{seconds:1800,label:`30 minutes`},{seconds:3600,label:`1 hour`}],$A=[{key:`authors`,label:`Authors`},{key:`assignees`,label:`Assignees`},{key:`allLabels`,label:`Has all labels`},{key:`anyLabels`,label:`Has any label`},{key:`excludeLabels`,label:`Excludes labels`},{key:`changedLabels`,label:`Changed labels`,hint:`Required for the two label events.`}],ej=e=>(e??[]).join(`, `),tj=e=>e.split(`,`).map(e=>e.trim()).filter(Boolean);function nj(e){return e?`Existing matches within the lookback are eligible on the next check. Previously processed matches will not run again.`:`Enabling starts from a current-time baseline. Existing matches will not launch tasks.`}function rj(e){let t=Math.max(1,Math.round(e.intervalSeconds/60));return`Polls GitHub every ${t} minute${t===1?``:`s`} for ${e.events.join(`, `)||`no events`}. ${nj(e.filters.includeExisting)}`}function ij({draft:e,onChange:t,disabledReason:n}){let r=n=>{t({events:e.events.includes(n)?e.events.filter(e=>e!==n):[...e.events,n]})},i=n=>t({filters:{...e.filters,...n}}),a=(n,r)=>{let i=tj(r),{[n]:a,...o}=e.filters;t({filters:i.length?{...o,[n]:i}:o})},o=QA.some(t=>t.seconds===e.intervalSeconds)?QA:[...QA,{seconds:e.intervalSeconds,label:`${Math.round(e.intervalSeconds/60)} minutes`}].sort((e,t)=>e.seconds-t.seconds);return(0,Q.jsxs)(`div`,{className:`grid gap-4`,children:[n?(0,Q.jsx)(`p`,{className:`text-xs text-pending-strong`,children:`GitHub unavailable · ${n}`}):null,(0,Q.jsx)(`div`,{role:`group`,"aria-label":`GitHub events`,className:`flex flex-wrap gap-2`,children:ZA.map(t=>(0,Q.jsx)(XA,{pressed:e.events.includes(t),onClick:()=>r(t),children:t},t))}),(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(MA,{htmlFor:`automation-interval`,children:`Check every`}),(0,Q.jsxs)(pA,{value:String(e.intervalSeconds),onValueChange:e=>t({intervalSeconds:Number(e)}),children:[(0,Q.jsx)(hA,{id:`automation-interval`,className:`w-full sm:w-48`,"aria-label":`Check every`,children:(0,Q.jsx)(mA,{})}),(0,Q.jsx)(gA,{children:o.map(e=>(0,Q.jsx)(_A,{value:String(e.seconds),children:e.label},e.seconds))})]})]}),(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,Q.jsx)(Mh,{"aria-label":`Include existing items`,"aria-describedby":`automation-history-hint`,checked:e.filters.includeExisting??!1,onCheckedChange:e=>i({includeExisting:e})}),(0,Q.jsx)(`span`,{children:`Include existing items`})]}),(0,Q.jsx)(`p`,{id:`automation-history-hint`,className:`text-xs text-muted-foreground`,children:nj(e.filters.includeExisting)})]}),(0,Q.jsxs)(mT,{children:[(0,Q.jsxs)(hT,{className:`group flex min-h-11 items-center gap-2 text-sm font-medium`,children:[`Filters`,(0,Q.jsx)(Ke,{"aria-hidden":`true`,className:`size-4 text-soft-foreground transition-transform motion-reduce:transition-none group-data-[state=open]:rotate-180`})]}),(0,Q.jsx)(gT,{children:(0,Q.jsxs)(`div`,{className:`grid gap-4 pt-2 sm:grid-cols-2`,children:[$A.map(t=>(0,Q.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,Q.jsx)(MA,{htmlFor:`automation-filter-${t.key}`,children:t.label}),(0,Q.jsx)(x_,{id:`automation-filter-${t.key}`,placeholder:`comma separated`,value:ej(e.filters[t.key]),onChange:e=>a(t.key,e.target.value)}),t.hint?(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.hint}):null]},t.key)),(0,Q.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,Q.jsx)(MA,{htmlFor:`automation-filter-lookback`,children:`Look back (days)`}),(0,Q.jsx)(x_,{id:`automation-filter-lookback`,type:`number`,min:1,value:e.filters.lookbackDays,onChange:e=>i({lookbackDays:Math.max(1,Number(e.target.value)||1)})})]}),(0,Q.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,Q.jsx)(MA,{htmlFor:`automation-filter-max`,children:`Max records per check`}),(0,Q.jsx)(x_,{id:`automation-filter-max`,type:`number`,min:1,value:e.filters.maxRecords,onChange:e=>i({maxRecords:Math.max(1,Number(e.target.value)||1)})})]})]})})]})]})}var aj=[{minutes:void 0,label:`No limit`},{minutes:30,label:`30 minutes`},{minutes:120,label:`2 hours`},{minutes:360,label:`6 hours`},{minutes:1440,label:`1 day`},{minutes:10080,label:`7 days`}],oj=`none`,sj=e=>String(e).padStart(2,`0`);function cj(e,t=Date.now()){let n=hk(t,e)??hk(t,`UTC`),r=new Date(Date.UTC(n.year,n.month-1,n.day+1));return`${r.getUTCFullYear()}-${sj(r.getUTCMonth()+1)}-${sj(r.getUTCDate())}T09:00`}function lj(){let e=typeof Intl.supportedValuesOf==`function`?Intl.supportedValuesOf(`timeZone`):[];return e.includes(`UTC`)?e:[`UTC`,...e]}function uj({value:e,stored:t,onChange:n}){let r=t=>n({...e,...t}),i=e.at?Nk(e.at):null,a=e.at?.slice(0,10)??``,o=i?.hour??9,s=i?.minute??0,c=(e,t,n)=>r({at:`${e}T${sj(t)}:${sj(n)}`}),l=(0,Z.useRef)(null),u=(0,Z.useId)(),d=Mk(e),f=!(t?.type===`once`&&t.at===e.at&&t.timeZone===e.timeZone)&&d!==null&&d<=Date.now();(0,Z.useEffect)(()=>{l.current?.setCustomValidity(f?Ok:``)},[f]);let p=Qk(e);return(0,Q.jsxs)(`div`,{className:`grid gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-end gap-x-4 gap-y-3`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(MA,{htmlFor:`automation-once-date`,children:`Date`}),(0,Q.jsx)(x_,{ref:l,id:`automation-once-date`,type:`date`,className:`w-44 max-w-full`,value:a,"aria-invalid":f||void 0,"aria-describedby":f?u:void 0,onChange:e=>{/^\d{4}-\d{2}-\d{2}$/.test(e.target.value)&&c(e.target.value,o,s)},required:!0})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`at`}),(0,Q.jsx)(gj,{label:`Hour`,value:o,max:23,onCommit:e=>c(a,e,s)}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:`:`}),(0,Q.jsx)(gj,{label:`Minute`,value:s,max:59,onCommit:e=>c(a,o,e)})]})]}),f?(0,Q.jsx)(`p`,{id:u,className:`text-xs text-destructive`,children:Ok}):null,(0,Q.jsx)(fj,{value:e.timeZone??``,onCommit:e=>r({timeZone:e})}),(0,Q.jsx)(pj,{value:e.latestStartMinutes,onChange:t=>n(dj(e,t))}),p?(0,Q.jsx)(`p`,{className:`text-sm break-words`,children:`Runs once at ${p.time} on ${p.date} (${e.timeZone}). ${p.note?`${p.note} `:``}Cezarion must be running then.`}):null]})}function dj(e,t){let{latestStartMinutes:n,...r}=e;return t===void 0?r:{...r,latestStartMinutes:t}}function fj({value:e,onCommit:t}){let[n,r]=(0,Z.useState)(e),i=(0,Z.useRef)(null),a=(0,Z.useId)(),o=(0,Z.useId)(),[s]=(0,Z.useState)(lj),c=n!==e||!yk(n),l=kk(n);return(0,Z.useEffect)(()=>{i.current?.setCustomValidity(c?l:``)},[c,l]),(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(MA,{htmlFor:`automation-once-zone`,children:`Time zone`}),(0,Q.jsx)(x_,{ref:i,id:`automation-once-zone`,list:a,autoComplete:`off`,spellCheck:!1,className:`w-full sm:w-72`,value:n,"aria-invalid":c||void 0,"aria-describedby":c?o:void 0,onChange:e=>{r(e.target.value),yk(e.target.value)&&t(e.target.value)}}),(0,Q.jsx)(`datalist`,{id:a,children:s.map(e=>(0,Q.jsx)(`option`,{value:e},e))}),c?(0,Q.jsx)(`p`,{id:o,className:`text-xs break-words text-destructive`,children:l}):null]})}function pj({value:e,onChange:t}){let n=aj.some(t=>t.minutes===e)||e===void 0?aj:[...aj,{minutes:e,label:`${e} minutes`}];return(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(MA,{htmlFor:`automation-once-latest`,children:`Latest start`}),(0,Q.jsxs)(pA,{value:e===void 0?oj:String(e),onValueChange:e=>t(e===oj?void 0:Number(e)),children:[(0,Q.jsx)(hA,{id:`automation-once-latest`,className:`w-full sm:w-48`,"aria-label":`Latest start`,children:(0,Q.jsx)(mA,{})}),(0,Q.jsx)(gA,{children:n.map(e=>(0,Q.jsx)(_A,{value:e.minutes===void 0?oj:String(e.minutes),children:e.label},e.label))})]}),(0,Q.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`If Cezarion was not running at the time, it still starts the task this long afterwards; later, the schedule is marked missed.`})]})}var mj=[{type:`daily`,label:`Every day`},{type:`weekdays`,label:`Weekdays`},{type:`weekly`,label:`Weekly`},{type:`hours`,label:`Every N hours`},{type:`once`,label:`Once`}],hj=e=>String(e).padStart(2,`0`);function gj({label:e,value:t,max:n,onCommit:r}){let[i,a]=(0,Z.useState)(hj(t)),o=(0,Z.useRef)(null),s=!(/^\d{1,2}$/.test(i)&&Number(i)===t),c=`${e} must be 00–${hj(n)}.`,l=(0,Z.useId)();return(0,Z.useEffect)(()=>{o.current?.setCustomValidity(s?c:``)},[s,c]),(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(x_,{ref:o,"aria-label":e,"aria-invalid":s||void 0,"aria-describedby":s?l:void 0,inputMode:`numeric`,maxLength:2,className:`w-20 text-center tabular-nums`,value:i,onChange:e=>{a(e.target.value),/^\d{1,2}$/.test(e.target.value)&&Number(e.target.value)<=n&&r(Number(e.target.value))},onBlur:()=>a(hj(t))}),s?(0,Q.jsx)(`p`,{id:l,className:`order-last basis-full text-xs text-destructive`,children:c}):null]})}function _j({value:e,stored:t,onChange:n,timeZone:r}){let i=t=>n({...e,...t}),a=t=>i(t===`once`?{type:t,at:e.at??cj(r),timeZone:e.timeZone??r}:{type:t});return(0,Q.jsxs)(`div`,{className:`grid gap-4`,children:[(0,Q.jsx)(`div`,{role:`group`,"aria-label":`Repeat`,className:`flex flex-wrap gap-2`,children:mj.map(t=>(0,Q.jsx)(XA,{pressed:e.type===t.type,onClick:()=>a(t.type),children:t.label},t.type))}),e.type===`once`?(0,Q.jsx)(uj,{value:e,stored:t,onChange:n}):null,e.type===`weekly`?(0,Q.jsx)(`div`,{role:`group`,"aria-label":`Day of the week`,className:`flex flex-wrap gap-2`,children:Sk.map((t,n)=>(0,Q.jsx)(XA,{pressed:e.day===n+1,onClick:()=>i({day:n+1}),children:t},t))}):null,e.type===`once`?null:e.type===`hours`?(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(MA,{htmlFor:`automation-every`,children:`Run every`}),(0,Q.jsxs)(pA,{value:String(e.every),onValueChange:e=>i({every:Number(e)}),children:[(0,Q.jsx)(hA,{id:`automation-every`,className:`w-full sm:w-48`,"aria-label":`Run every`,children:(0,Q.jsx)(mA,{})}),(0,Q.jsx)(gA,{children:xk.map(e=>(0,Q.jsx)(_A,{value:String(e),children:e===1?`hour`:`${e} hours`},e))})]}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Counted from midnight, so “every 6 hours” runs at 00:00, 06:00, 12:00 and 18:00.`})]}):(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`at`}),(0,Q.jsx)(gj,{label:`Hour`,value:e.hour,max:23,onCommit:e=>i({hour:e})}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:`:`}),(0,Q.jsx)(gj,{label:`Minute`,value:e.minute,max:59,onCommit:e=>i({minute:e})}),(0,Q.jsx)(`span`,{className:`text-sm break-all text-muted-foreground`,children:r})]}),e.type===`once`?null:(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Cron: `,(0,Q.jsx)(`code`,{className:`font-mono text-foreground`,children:Bk(e)})]})]})}var vj=40*864e5,yj=5;function bj({schedule:e,timeZone:t,now:n=Date.now()}){if(e.type===`once`)return(0,Q.jsx)(xj,{schedule:e,now:n});let r=Hk(e,n+1,n+vj,t,yj);return(0,Q.jsxs)(`section`,{"aria-labelledby":`next-runs-heading`,className:`rounded-xl border bg-card p-4`,children:[(0,Q.jsx)(`h2`,{id:`next-runs-heading`,className:`mb-3 text-[15px] font-medium`,children:`Next 5 runs`}),r.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No runs in the next 40 days.`}):(0,Q.jsx)(`ol`,{"aria-label":`Next 5 runs`,className:`grid gap-1.5 text-sm`,children:r.map(e=>(0,Q.jsxs)(`li`,{className:`flex items-baseline justify-between gap-3`,children:[(0,Q.jsx)(`span`,{className:`font-medium tabular-nums`,children:Kk(new Date(e).toISOString(),t)}),(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:Uk(n,e)})]},e))}),(0,Q.jsxs)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:[`Times are in `,t,`, the zone this cezar runs in.`]})]})}function xj({schedule:e,now:t}){let n=Mk(e),r=Qk(e);return(0,Q.jsxs)(`section`,{"aria-labelledby":`next-runs-heading`,className:`rounded-xl border bg-card p-4`,children:[(0,Q.jsx)(`h2`,{id:`next-runs-heading`,className:`mb-3 text-[15px] font-medium`,children:`Runs once`}),n===null||!r?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Pick a date, a time and a time zone.`}):(0,Q.jsxs)(`p`,{className:`flex flex-wrap items-baseline justify-between gap-x-3 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium tabular-nums`,children:`${r.date} ${r.time}`}),n>t?(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:Uk(t,n)}):null]}),r?.note?(0,Q.jsx)(`p`,{className:`mt-2 text-sm break-words`,children:r.note}):null,n!==null&&n<=t?(0,Q.jsx)(`p`,{className:`mt-2 text-sm text-destructive`,children:`The due time has passed.`}):null,(0,Q.jsx)(`p`,{className:`mt-3 text-xs break-words text-muted-foreground`,children:`Times are in ${e.timeZone??`UTC`}. Cezarion must be running then; afterwards the schedule is archived with its task.`})]})}var Sj={schedule:`On a schedule`,github:`When GitHub changes`};function Cj(e){return/time zone|due time/i.test(e)?`when`:/placeholder|prompt|workflow|runner|model|task|autonomous/i.test(e)?`run`:/\bname\b/i.test(e)?`name`:/schedule|github|event|filter|label|interval|remote|forge|lookback|records?|hour|minute|poll|kind|archived/i.test(e)?`when`:`form`}function wj({title:e,failure:t,section:n,children:r}){return(0,Q.jsxs)(`fieldset`,{className:`grid min-w-0 gap-4 rounded-xl border p-5 max-md:p-4!`,children:[(0,Q.jsx)(`legend`,{className:`px-0`,children:e}),r,t?.section===n&&!t.conflict?(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:t.message}):null]})}function Tj({automation:e,forge:t,timeZone:n,onSaved:r,onReload:i}){let[a,o]=(0,Z.useState)(()=>PA(e)),[s,c]=(0,Z.useState)(e?.revision),[l,u]=(0,Z.useState)(),[d,f]=(0,Z.useState)(!1),[p,m]=(0,Z.useState)(!1),[h,g]=(0,Z.useState)(!1),[_,v]=(0,Z.useState)(``),y=e=>o(t=>({...t,...e})),b=async t=>{if(t.preventDefault(),d)return;let n=t.currentTarget;if(n instanceof HTMLFormElement&&!n.checkValidity()){n.reportValidity();return}f(!0),u(void 0);let i=`save`;try{if(e&&s!==void 0){let{automation:t}=await mr(e.id,zA({...a,enabled:e.enabled},s));c(t.revision),a.enabled!==e.enabled&&(i=`enable`,await wn(e.id,a.enabled))}else await Hn(RA(a));r()}catch(t){let n=t instanceof Error?t.message:String(t);i===`save`&&e&&t instanceof ft&&t.status===409&&/revision conflict/i.test(n)?u({section:`form`,message:`Edited elsewhere — reload to see the latest version`,conflict:!0}):u({section:i===`enable`?`enable`:Cj(n),message:n})}finally{f(!1)}},x=async()=>{if(!(!e||h)){g(!0),v(``);try{await on(e.id),r()}catch(e){v(e instanceof Error?e.message:String(e))}finally{g(!1)}}},S=e?`Save changes`:a.enabled?`Save and enable`:`Save paused`,C=a.kind===`schedule`;return(0,Q.jsx)(bA,{title:e?`Edit automation`:`New automation`,subtitle:`Define when it runs and the ordinary task it launches.`,children:(0,Q.jsxs)(`form`,{className:`automation-editor grid min-w-0 gap-5 md:grid-cols-[minmax(0,1fr)_320px] md:items-start`,onSubmit:b,children:[(0,Q.jsxs)(`div`,{className:`grid min-w-0 gap-5`,children:[a.retiredVariants?(0,Q.jsxs)(`section`,{role:`alert`,className:`flex flex-col items-start gap-3 rounded-xl border border-border bg-card p-4`,children:[(0,Q.jsx)(`p`,{children:`Parallel variants are removed. This automation requests multiple candidates and cannot launch. Use one task, or ask that task to compare approaches with owned workers.`}),(0,Q.jsx)(A,{type:`button`,variant:`outline`,className:`min-h-11`,onClick:()=>y({retiredVariants:!1}),children:`Use one task`})]}):null,(0,Q.jsx)(wj,{title:`Name`,section:`name`,failure:l,children:(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(MA,{htmlFor:`automation-name`,children:`Name`}),(0,Q.jsx)(x_,{id:`automation-name`,value:a.name,onChange:e=>y({name:e.target.value}),required:!0})]})}),(0,Q.jsxs)(wj,{title:`When`,section:`when`,failure:l,children:[e?(0,Q.jsxs)(`p`,{className:`text-sm`,children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:`Trigger · `}),Sj[a.kind]]}):(0,Q.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,Q.jsx)(fO,{slot:`automation-kind`,label:`Trigger`,size:`touch`,value:a.kind,onChange:e=>y({kind:e}),options:[{value:`schedule`,label:Sj.schedule},{value:`github`,label:Sj.github,disabled:!t.available,...t.available?{}:{title:t.reason??`GitHub is unavailable`}}]}),t.available?null:(0,Q.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`GitHub unavailable · ${t.reason??`no GitHub access`}`})]}),C?(0,Q.jsx)(_j,{value:a.schedule,stored:e?.schedule,onChange:e=>y({schedule:e}),timeZone:n}):(0,Q.jsx)(ij,{draft:a,onChange:y,...t.available?{}:{disabledReason:t.reason??`no GitHub access`}})]}),(0,Q.jsxs)(wj,{title:`What to run`,section:`run`,failure:l,children:[(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(MA,{htmlFor:`automation-prompt`,children:`Prompt`}),(0,Q.jsx)(my,{id:`automation-prompt`,value:a.prompt,onChange:e=>y({prompt:e.target.value}),rows:4,required:!0}),(0,Q.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:C?(0,Q.jsxs)(Q.Fragment,{children:[`Available: `,`{{date}}`,` `,`{{time}}`,` `,`{{project}}`,` `,`{{automation}}`,`. A run-context block is appended automatically.`]}):(0,Q.jsxs)(Q.Fragment,{children:[`Available: `,`{{github.number}}`,` `,`{{github.title}}`,` `,`{{github.url}}`,` `,`{{github.labels}}`,`. GitHub content is appended as untrusted context.`]})})]}),(0,Q.jsx)(Ej,{draft:a,patch:y}),(0,Q.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,Q.jsx)(Mh,{"aria-label":`Autonomous`,checked:a.autonomous,onCheckedChange:e=>y({autonomous:e})}),(0,Q.jsxs)(`span`,{children:[`Autonomous `,(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:`· runs without waiting for answers`})]})]}),(0,Q.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`Each run is an ordinary task in its own worktree, queued behind the parallel cap.`}),(0,Q.jsx)(a_,{archiveWhenDone:a.archiveWhenDone,autoMergePr:a.autoMergePr,onChange:y,disabled:d}),e?(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`These settings apply to future tasks. Existing tasks keep their settings.`}):null]}),(0,Q.jsxs)(wj,{title:`Enable`,section:`enable`,failure:l,children:[(0,Q.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,Q.jsx)(Mh,{"aria-label":e?`Enabled`:`Enable after saving`,checked:a.enabled,onCheckedChange:e=>y({enabled:e})}),(0,Q.jsx)(`span`,{children:e?`Enabled`:`Enable after saving`})]}),(0,Q.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:a.kind===`schedule`&&a.schedule.type===`once`?`It runs once at the time set above, then moves to Archived with its task.`:C?`The first run is the next occurrence shown beside the schedule.`:nj(a.filters.includeExisting)})]}),l?.section===`form`?(0,Q.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-3 text-sm text-destructive`,children:[(0,Q.jsx)(`span`,{className:`break-words`,children:l.message}),l.conflict&&i?(0,Q.jsx)(A,{type:`button`,variant:`outline`,onClick:i,children:`Reload`}):null]}):null,(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsx)(A,{type:`submit`,disabled:d,children:d?`Saving…`:S}),(0,Q.jsx)(A,{type:`button`,variant:`outline`,asChild:!0,children:(0,Q.jsx)(X,{to:`/automations`,children:`Cancel`})})]}),e?(0,Q.jsxs)(`div`,{className:`grid justify-items-start gap-2 border-t pt-4`,children:[p?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`text-sm break-words`,children:`Delete “${e.name}”? It will stop running and cannot be restored.`}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsx)(A,{type:`button`,variant:`danger-ghost`,"data-action":`automation-delete-confirm`,disabled:h,onClick:()=>void x(),children:`Delete automation`}),(0,Q.jsx)(A,{type:`button`,variant:`outline`,disabled:h,onClick:()=>{m(!1),v(``)},children:`Keep`})]})]}):(0,Q.jsx)(A,{type:`button`,variant:`outline`,"data-action":`automation-delete`,onClick:()=>m(!0),children:`Delete`}),_?(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:_}):null]}):null]}),(0,Q.jsxs)(`aside`,{className:`min-w-0 md:sticky md:top-4`,children:[C?(0,Q.jsx)(bj,{schedule:a.schedule,timeZone:n}):(0,Q.jsxs)(`section`,{className:`rounded-xl border bg-card p-4`,children:[(0,Q.jsx)(`h2`,{className:`mb-2 text-[15px] font-medium`,children:`How it polls`}),(0,Q.jsx)(`p`,{className:`text-sm break-words text-muted-foreground`,children:rj(a)})]}),a.retiredVariants?null:(0,Q.jsx)(YA,{draft:a})]})]})})}function Ej({draft:e,patch:t}){let n=Sr(),r=Wi(),i=Ei(),a=e.runner??i.data?.defaultRunner??`claude`,o=Tr(a),s=[...new Set([...(n.data?.workflows??[]).map(e=>e.name),...e.workflow?[e.workflow]:[]])],c=[...new Set([...kn(r.data),...e.runner?[e.runner]:[]])],l=sh(a,o.data,[e.model]),u=l.find(t=>t.id===(e.model??``))?.label??e.model??`auto`,d=e=>(0,Q.jsx)(e,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`});return(0,Q.jsx)(Eh,{children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsx)(Oh,{slot:`automation-workflow-pill`,icon:d(Ce),fieldLabel:!0,ariaLabel:`Workflow`,label:e.workflow??`inline steps`,value:e.workflow??``,disabled:e.workflow===void 0,disabledHint:`This automation carries its own steps.`,options:s.map(e=>({value:e,label:e})),onPick:e=>t({workflow:e})}),(0,Q.jsx)(Oh,{slot:`automation-runner-pill`,icon:d(te),fieldLabel:!0,ariaLabel:`Runner`,label:e.runner??`default`,value:e.runner??``,options:[{value:``,label:`default`,desc:`The project’s default runner`},...c.map(e=>({value:e,label:eh.find(t=>t.id===e)?.label??e}))],onPick:e=>{t({runner:e||void 0,model:void 0})}}),(0,Q.jsx)(Oh,{slot:`automation-model-pill`,icon:d(vt),fieldLabel:!0,ariaLabel:`Model`,label:u,value:e.model??``,options:l.map(e=>({value:e.id,label:e.label,desc:e.desc})),onPick:e=>t({model:e||void 0})})]})})}function Dj({data:e,error:t,refresh:n,archived:r=!1,onArchivedChange:i}){let[a,o]=(0,Z.useState)({}),[s,c]=(0,Z.useState)({}),l=(e,t)=>o(n=>{let{[e]:r,...i}=n;return t?{...i,[e]:t}:i}),u=async(e,t)=>{c(t=>({...t,[e]:!0}));try{await t()}catch(t){l(e,{text:t instanceof Error?t.message:String(t),tone:`error`})}finally{c(t=>({...t,[e]:!1}))}},d=e=>u(e.id,async()=>{l(e.id,{text:`Starting…`,tone:`info`});let{runId:t}=await Bt(e.id);l(e.id,{text:`Started task`,tone:`info`,runId:t}),n()}),f=e=>u(e.id,async()=>{l(e.id,void 0),await wn(e.id,!e.enabled),await n()}),p=e=>u(e.id,async()=>{l(e.id,void 0),await Qe(e.id),await n()}),m=e=>u(e.id,async()=>{l(e.id,{text:`Checking…`,tone:`info`});let{checkId:t}=await Kt(e.id,`preview`);for(let r=0;r<60;r+=1){let r=await mn(t);if(r.status===`complete`){l(e.id,{text:`${r.matches??0} filter match${r.matches===1?``:`es`} found; no tasks launched. Counts can include closed items and previously processed events.`,tone:`info`}),n();return}if(r.status===`error`)throw Error(r.error??`Preview failed`);await new Promise(e=>setTimeout(e,500))}throw Error(`Preview is still running`)});return(0,Q.jsx)(bA,{title:`Automations`,subtitle:`Schedules and GitHub checks run while Cezarion is open.`,action:(0,Q.jsx)(A,{asChild:!0,children:(0,Q.jsx)(X,{to:`/automations/new`,children:`New automation`})}),children:t&&!e?(0,Q.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,Q.jsx)(xA,{text:t}),(0,Q.jsx)(A,{variant:`outline`,onClick:()=>void n(),children:`Retry`})]}):e?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Oj,{data:e}),i?(0,Q.jsx)(`div`,{className:`mb-4 flex flex-wrap gap-2`,children:(0,Q.jsx)(XA,{pressed:r,onClick:()=>i(!r),children:`Archived`})}):null,r&&e.automations.length===0?(0,Q.jsx)(xA,{text:`No archived one-time schedules.`}):e.automations.length===0?(0,Q.jsx)(ra,{icon:(0,Q.jsx)(_r,{}),tone:`neutral`,title:`No automations yet`,subtitle:`Create one paused, preview it, then enable it.`,heading:`h2`,actions:(0,Q.jsx)(A,{asChild:!0,children:(0,Q.jsx)(X,{to:`/automations/new`,children:`New automation`})})}):(0,Q.jsx)(`ul`,{className:`grid gap-3`,"aria-label":`Automations`,children:e.automations.map(t=>(0,Q.jsx)(jj,{automation:t,timeZone:e.timeZone,note:a[t.id],busy:s[t.id]===!0,onRun:()=>void d(t),onToggle:()=>void f(t),onPreview:()=>void m(t),onCancel:()=>void p(t)},t.id))})]}):(0,Q.jsx)(xA,{text:`Loading automations…`})})}function Oj({data:e}){return(0,Q.jsx)(`p`,{"data-slot":`automation-scheduler`,className:s(`mb-4 text-xs break-words`,e.scheduler.state===`scheduled`?`text-success`:`text-muted-foreground`),children:`Scheduler ${e.scheduler.state===`scheduled`?`running`:`idle`} · GitHub ${e.available?`available`:`unavailable`}${e.reason?` · ${e.reason}`:``} · ${e.timeZone}`})}function kj(e){return e.kind===`schedule`&&e.schedule?Lk(e.schedule):`on ${(e.events??[]).join(`, `)} · every ${Math.round((e.intervalSeconds??300)/60)} min`}var Aj={waiting:{label:`Waiting`,dot:`success`},paused:{label:`Paused`,dot:`neutral`},failed:{label:`Failed`,dot:`danger`},missed:{label:`Missed`,dot:`pending`},archived:{label:`Archived`,dot:`neutral`}};function jj({automation:e,timeZone:t,note:n,busy:r,onRun:i,onToggle:a,onPreview:o,onCancel:c}){let[l,u]=(0,Z.useState)(!1),d=(0,Z.useRef)(null),f=(0,Z.useRef)(null),p=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{let e=p.current===`keep`?f.current:p.current===`cancel`?d.current:null;p.current=null,e?.focus()},[l]);let m=()=>{p.current=`keep`,u(!0)},h=()=>{p.current=`cancel`,u(!1)},g=e.kind===`schedule`,_=e.schedule?.type===`once`,v=_?Aj[e.onceStatus??(e.enabled?`waiting`:`paused`)]:void 0,y=e.archived,b=g?dr:Gn,x=e.enabled&&g?e.nextRunAt:void 0;return(0,Q.jsxs)(`li`,{"data-slot":`automation-card`,"data-kind":e.kind,className:`min-w-0 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`,{className:`min-w-0`,children:[(0,Q.jsxs)(`h2`,{className:`flex items-center gap-2 font-semibold break-words`,children:[(0,Q.jsx)(b,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),e.name]}),(0,Q.jsx)(`p`,{className:`mt-1.5 text-[13px] break-words text-muted-foreground`,children:kj(e)})]}),v?(0,Q.jsx)(tE,{dot:v.dot,children:v.label}):(0,Q.jsx)(tE,{dot:e.enabled?`success`:`neutral`,children:e.enabled?`Enabled`:`Paused`})]}),y?(0,Q.jsxs)(`p`,{className:`mt-3 text-sm break-words`,children:[y.outcome===`launched`?`Started its task.`:`Cancelled — no task was started.`,y.runId?(0,Q.jsxs)(Q.Fragment,{children:[` · `,(0,Q.jsx)(X,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${y.runId}`,children:`Open task`})]}):null]}):null,y?(0,Q.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:(0,Q.jsx)(A,{variant:`outline`,asChild:!0,children:(0,Q.jsx)(X,{to:`/automations/${e.id}`,children:`Details`})})}):null,y?null:(0,Q.jsx)(`p`,{className:`mt-3 text-sm`,children:!g&&e.enabled?(0,Q.jsx)(`span`,{children:`continuous`}):x?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{children:`Next run: ${Kk(x,t)}`}),(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:` · ${Uk(Date.now(),Date.parse(x))}`})]}):(0,Q.jsx)(`span`,{children:`Next run: —`})}),y?null:(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,Q.jsx)(A,{variant:`outline`,asChild:!0,children:(0,Q.jsx)(X,{to:`/automations/${e.id}`,children:`Edit`})}),(0,Q.jsx)(A,{variant:`outline`,asChild:!0,children:(0,Q.jsx)(X,{to:`/automations/${e.id}/log`,children:`Execution log`})}),(0,Q.jsx)(A,{variant:`outline`,"data-action":`automation-toggle`,disabled:r,onClick:a,children:e.enabled?`Pause`:`Enable`}),g?(0,Q.jsx)(A,{variant:`outline`,"data-action":`automation-run`,disabled:r,onClick:i,children:`Run now`}):(0,Q.jsx)(A,{variant:`outline`,"data-action":`automation-preview`,disabled:r,onClick:o,children:`Test filter`}),_&&!l?(0,Q.jsx)(A,{variant:`outline`,ref:d,"data-action":`automation-cancel`,disabled:r,onClick:m,children:`Cancel`}):null]}),_&&!y&&l?(0,Q.jsxs)(`div`,{className:`mt-3 grid justify-items-start gap-2`,children:[(0,Q.jsx)(`p`,{className:`text-sm break-words`,children:`Cancel “${e.name}”? It will never run, and it moves to Archived.`}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsx)(A,{variant:`danger-ghost`,"data-action":`automation-cancel-confirm`,disabled:r,onClick:()=>{u(!1),c()},children:`Cancel schedule`}),(0,Q.jsx)(A,{ref:f,variant:`outline`,disabled:r,onClick:h,children:`Keep`})]})]}):null,n?(0,Q.jsxs)(`p`,{role:n.tone===`error`?`alert`:`status`,className:s(`mt-3 text-sm break-words`,n.tone===`error`?`text-destructive`:`text-muted-foreground`),children:[n.text,n.runId?(0,Q.jsxs)(Q.Fragment,{children:[` · `,(0,Q.jsx)(X,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${n.runId}`,children:`Open task`})]}):null]}):null,(0,Q.jsx)(AA,{automationId:e.id,automationName:e.name,timeZone:t})]})}function Mj(e){let t=Wa(),n=kr(),r=n.data!==void 0,i=r&&n.data.capabilities?.automations!==!0,[a,o]=(0,Z.useState)(),[s,c]=(0,Z.useState)(``),l=(0,Z.useCallback)(t=>Be({signal:t,...e?{archived:e}:{}}).then(e=>{t?.aborted||(o(e),c(``))}).catch(e=>{t?.aborted||c(String(e))}),[e]);return(0,Z.useEffect)(()=>{r&&!i&&l()},[r,i,l]),(0,Z.useEffect)(()=>zt(async e=>{r&&!i&&await l(e)}),[r,i,l]),(0,Z.useEffect)(()=>_s((e,n)=>{if(e!==`automation-change`)return;let r=n;typeof r.project==`string`&&(t===null||r.project===t)&&l()}),[t,l]),{data:a,error:s,refresh:l}}function Nj({mode:e=`list`}){let{automationId:t}=gn(),n=Za(),[r,i]=(0,Z.useState)(!1),{data:a,error:o,refresh:s}=Mj(e===`list`?r?`only`:void 0:`include`),[c,l]=(0,Z.useState)(0),u=kr(),d=u.data!==void 0,f=d&&u.data.capabilities?.automations!==!0;if(!d)return(0,Q.jsx)(`div`,{"data-route":`automations`,className:`task-flow-page flex min-h-full flex-col`,children:(0,Q.jsx)(xA,{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)(ra,{icon:(0,Q.jsx)(_r,{}),tone:`neutral`,title:`Automations are off`,subtitle:`This server does not run schedules, poll GitHub or launch tasks from them. Set CEZ_AUTOMATIONS=1 and restart cezar to turn automations on.`,heading:`h2`})});let p=()=>{n(`/automations`),s()},m=a?.automations.find(e=>e.id===t);if(e===`list`)return(0,Q.jsx)(Dj,{data:a,error:o,refresh:s,archived:r,onArchivedChange:i});if(!a)return o?(0,Q.jsx)(bA,{title:`Automations`,subtitle:`Could not load automations.`,children:(0,Q.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,Q.jsx)(xA,{text:o}),(0,Q.jsx)(A,{variant:`outline`,onClick:()=>void s(),children:`Retry`})]})}):(0,Q.jsx)(`div`,{"data-route":`automations`,className:`task-flow-page flex min-h-full flex-col`,children:(0,Q.jsx)(xA,{text:`Loading automations…`})});let h={available:a.available,...a.reason?{reason:a.reason}:{}};return e===`new`?(0,Q.jsx)(Tj,{forge:h,timeZone:a.timeZone,onSaved:p}):e===`edit`?m?m.archived?(0,Q.jsx)(jA,{automation:m,timeZone:a.timeZone,onDeleted:p}):(0,Q.jsx)(Tj,{automation:m,forge:h,timeZone:a.timeZone,onSaved:p,onReload:()=>void s().then(()=>l(e=>e+1))},`${m.id}:${c}`):(0,Q.jsx)(bA,{title:`Automation not found`,subtitle:`This automation may have been removed.`,children:(0,Q.jsx)(A,{asChild:!0,variant:`outline`,children:(0,Q.jsx)(X,{to:`/automations`,children:`Back to automations`})})}):t?(0,Q.jsx)(kA,{automationId:t,automationName:m?.name,timeZone:a.timeZone,readOnly:!!m?.archived}):(0,Q.jsx)(xA,{text:`Automation not found.`})}function Pj(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 Fj({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=aa(),f=Oi(),{mutate:p,isPending:m}=f,h=ce(),g=Pj(f.error),_=(0,Z.useMemo)(()=>`co-${Math.random().toString(36).slice(2)}-${Date.now().toString(36)}`,[]),v=(0,Z.useRef)(_);v.current=_,(0,Z.useEffect)(()=>_s((e,t)=>{if(e!==`checkout-progress`)return;let n=t;n?.checkoutId===v.current&&(n.phase===`cloning`&&n.line?s(n.line):n.phase!==`cloning`&&s(null))}),[]),(0,Z.useEffect)(()=>zt(async e=>{if(!m)return;let t=await Je(_,{signal:e}).catch(()=>null);if(!t)return;let{progress:n}=t;e.aborted||n?.checkoutId!==v.current||s(n?.phase===`cloning`?n.line??null:null)}),[m,_]);let y=(0,Z.useMemo)(()=>{let e=n.trim().replace(/\/+$/,``).replace(/\.git$/,``).split(`/`).pop()??``;return e.includes(`:`)?e.split(`:`).pop()??``:e},[n]),b=i.trim()===``?y:i.trim(),x=d.data?.projectsDir??``,S=b===``?``:`${x.replace(/\/+$/,``)}/${b}`,C=(0,Z.useCallback)(()=>{n.trim()===``||m||(u.current=!1,l(!1),s(null),p({url:n.trim(),checkoutId:_,...i.trim()===``?{}:{name:i.trim()}},{onSuccess:({project:e})=>{t(!1),h(`/p/${encodeURIComponent(e.id)}/`)}}))},[p,m,_,i,h,t,n]);return(0,Z.useEffect)(()=>{if(!c)return;let e=()=>{u.current&&(u.current=!1,l(!1),C())},t=()=>{document.visibilityState===`visible`&&e()};return window.addEventListener(`focus`,e),document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`focus`,e),document.removeEventListener(`visibilitychange`,t)}},[c,C]),(0,Q.jsx)(mp,{open:e,onOpenChange:e=>f.isPending?void 0:t(e),children:(0,Q.jsxs)(_p,{"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)(vp,{children:[(0,Q.jsx)(xp,{children:`Clone from GitHub`}),(0,Q.jsxs)(Sp,{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)(MA,{htmlFor:`clone-url`,children:`Repository`}),(0,Q.jsx)(x_,{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`&&C()}})]}),(0,Q.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,Q.jsx)(MA,{htmlFor:`clone-name`,children:`Folder name`}),(0,Q.jsx)(x_,{id:`clone-name`,"data-slot":`clone-name`,placeholder:y===``?`repo`:y,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:S,children:S}),f.isPending?(0,Q.jsx)(A,{"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)(cr,{className:`size-3.5`,"aria-hidden":`true`})}):(0,Q.jsx)(A,{asChild:!0,variant:`ghost`,size:`icon-sm`,className:`size-7`,children:(0,Q.jsx)(Qt,{to:`/settings/global/projects`,"data-slot":`clone-root-settings`,"aria-label":`Edit checkout root`,title:`Edit checkout root`,children:(0,Q.jsx)(cr,{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)(bp,{children:[(0,Q.jsx)(A,{variant:`outline`,disabled:f.isPending,onClick:()=>t(!1),children:`Cancel`}),(0,Q.jsx)(A,{"data-slot":`clone-confirm`,disabled:n.trim()===``||b===``||f.isPending,onClick:C,children:f.isPending?`Cloning…`:f.isError?`Retry clone`:`Clone`})]})]})})}var Ij=[{slug:`github/codespaces-nextjs`,label:`Next.js`,description:`Minimal Next.js app (GitHub)`},{slug:`vercel/chatbot`,label:`Next.js AI chatbot`,description:`Full-featured AI chat app (Vercel)`},{slug:`vercel/nextjs-postgres-nextauth-tailwindcss-template`,label:`Next.js admin dashboard`,description:`Postgres, Auth.js and Tailwind (Vercel)`},{slug:`github/codespaces-react`,label:`React + Vite`,description:`React single-page app (GitHub)`},{slug:`antfu-collective/vitesse`,label:`Vue + Vite`,description:`Opinionated Vue starter (Vitesse)`},{slug:`nuxt-ui-templates/starter-vue`,label:`Vue + Nuxt UI`,description:`Vue + Vite with Nuxt UI (Nuxt)`},{slug:`mugnavo/cove`,label:`Vite+`,description:`TanStack Start on Vite+ (vp), Better Auth`},{slug:`w3cj/hono-open-api-starter`,label:`Hono`,description:`Type-safe JSON API with OpenAPI docs`},{slug:`github/codespaces-express`,label:`Express`,description:`Node.js web server (GitHub)`},{slug:`andrewmcodes/obsidian-beginner-vault-template`,label:`Obsidian vault`,description:`Your own knowledge base in Markdown`},{slug:`chibat/chrome-extension-typescript-starter`,label:`Chrome extension`,description:`TypeScript extension starter`},{slug:`actions/typescript-action`,label:`GitHub Action`,description:`TypeScript action with tests (GitHub)`},{slug:`microsoft/python-package-template`,label:`Python package`,description:`Packaging, tests and CI (Microsoft)`},{slug:`github/codespaces-flask`,label:`Flask`,description:`Python web app (GitHub)`},{slug:`github/codespaces-django`,label:`Django`,description:`Python web framework (GitHub)`},{slug:`github/codespaces-rails`,label:`Ruby on Rails`,description:`Rails app (GitHub)`},{slug:`github/codespaces-jupyter`,label:`Jupyter notebooks`,description:`Data science and ML (GitHub)`}];function Lj(e){let t=e.trim().toLowerCase();return t===``||Ij.some(e=>e.slug.toLowerCase()===t)?Ij:Ij.filter(e=>[e.label,e.slug,e.description].some(e=>e.toLowerCase().includes(t)))}function Rj({value:e,onChange:t,disabled:n,id:r}){let i=(0,Z.useId)(),a=Lj(e),[o,c]=(0,Z.useState)(-1),l=(0,Z.useRef)(null);(0,Z.useEffect)(()=>c(-1),[e]),(0,Z.useEffect)(()=>{o<0||l.current?.querySelector(`[data-index="${o}"]`)?.scrollIntoView?.({block:`nearest`})},[o]);let u=e=>`${i}-option-${e}`;return(0,Q.jsxs)(`div`,{className:`grid min-w-0 gap-1.5`,children:[(0,Q.jsx)(x_,{id:r,"data-slot":`create-project-template`,role:`combobox`,"aria-expanded":`true`,"aria-controls":i,"aria-autocomplete":`list`,"aria-activedescendant":o>=0?u(o):void 0,autoComplete:`off`,spellCheck:!1,placeholder:`owner/repo or https://github.com/owner/repo`,value:e,disabled:n,onChange:e=>t(e.target.value),onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),a.length===0)return;let t=e.key===`ArrowDown`;c(e=>e<0?t?0:a.length-1:(e+(t?1:-1)+a.length)%a.length)}else if(e.key===`Enter`&&o>=0){e.preventDefault(),e.stopPropagation();let n=a[o];n&&t(n.slug)}}}),(0,Q.jsx)(`ul`,{ref:l,id:i,role:`listbox`,"aria-label":`Suggested templates`,"data-slot":`create-project-template-list`,className:`max-h-48 min-h-0 overflow-y-auto overscroll-contain rounded-md border border-border`,children:a.length===0?(0,Q.jsx)(`li`,{className:`px-3 py-2 text-xs text-muted-foreground`,role:`presentation`,children:`No suggestion matches — any GitHub template repository works.`}):a.map((r,i)=>{let a=r.slug.toLowerCase()===e.trim().toLowerCase();return(0,Q.jsxs)(`li`,{id:u(i),role:`option`,"aria-selected":a,"data-index":i,"data-slot":`create-project-template-option`,onMouseDown:e=>e.preventDefault(),onClick:()=>{n||t(r.slug)},className:s(`grid min-h-11 cursor-pointer content-center gap-0.5 px-3 py-1.5 text-start`,`pointer-hover:hover:bg-accent`,i===o&&`bg-accent`,a&&`font-medium`),children:[(0,Q.jsxs)(`span`,{className:`truncate text-[13px]`,children:[r.label,` `,(0,Q.jsx)(`span`,{className:`font-mono text-[11px] text-soft-foreground`,children:r.slug})]}),(0,Q.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:r.description})]},r.slug)})})]})}function zj({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`skeleton`,className:s(`animate-pulse rounded-md bg-accent`,e),...t})}function Bj({open:e,onOpenChange:t}){let[n,r]=(0,Z.useState)(``),[i,a]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(null),[c,l]=(0,Z.useState)(`empty`),[u,d]=(0,Z.useState)(``),[f,p]=(0,Z.useState)(null),[m,h]=(0,Z.useState)(null),g=aa(),_=Mi({enabled:e}),v=_i(),{mutate:y,isPending:b}=v,x=ce(),S=(0,Z.useId)(),C=(0,Z.useRef)(!1),w=(0,Z.useMemo)(()=>`np-${Math.random().toString(36).slice(2)}-${Date.now().toString(36)}`,[]),T=(0,Z.useRef)(w);T.current=w,(0,Z.useEffect)(()=>_s((e,t)=>{if(e!==`checkout-progress`)return;let n=t;n?.checkoutId===T.current&&(n.phase===`cloning`&&n.line?p(n.line):n.phase!==`cloning`&&p(null))}),[]),(0,Z.useEffect)(()=>zt(async e=>{if(!b)return;let t=await Je(w,{signal:e}).catch(()=>null);if(!t)return;let{progress:n}=t;e.aborted||n?.checkoutId!==T.current||p(n?.phase===`cloning`?n.line??null:null)}),[b,w]);let E=_.data?.available?_.data.owners:null,D=_.isError?`GitHub is unavailable: ${_.error instanceof Error?_.error.message:`could not ask gh`}`:_.data&&!_.data.available?_.data.reason:null,O=i&&E!==null&&E.length>0,k=o??E?.[0]?.login??null,j=O?c:`empty`,M=n.trim(),N=ae.test(M),P=(g.data?.projectsDir??``).replace(/\/+$/,``),F=N&&!b&&m===null&&(!O||k!==null&&(j===`empty`||u.trim()!==``)),I=(0,Z.useCallback)(()=>{!F||C.current||(C.current=!0,p(null),y({name:M,checkoutId:w,...O&&k?{github:{owner:k,...j===`template`?{template:u.trim()}:{}}}:{}},{onSettled:()=>{C.current=!1},onSuccess:({project:e,warning:n})=>{if(n){h({projectId:e.id,warning:n});return}t(!1),x(`/p/${encodeURIComponent(e.id)}/`)}}))},[F,y,M,w,O,k,j,u,t,x]),ee=()=>{m&&(t(!1),x(`/p/${encodeURIComponent(m.projectId)}/`))},L=`${S}-name-hint`;return(0,Q.jsx)(mp,{open:e,onOpenChange:e=>b?void 0:t(e),children:(0,Q.jsxs)(_p,{"data-slot":`create-project-dialog`,className:`flex min-w-0 flex-col overflow-y-clip overflow-x-clip sm:max-w-2xl`,children:[(0,Q.jsxs)(vp,{className:`flex-none`,children:[(0,Q.jsx)(xp,{children:`New project`}),(0,Q.jsx)(Sp,{children:`cezar creates a git repository with one empty commit in your checkout root and adds it as a project.`})]}),m?(0,Q.jsxs)(`div`,{"data-slot":`create-project-warning`,role:`status`,className:`flex min-h-0 flex-1 gap-3 overflow-y-auto overscroll-contain rounded-md border border-border bg-muted p-4 text-[13px]`,children:[(0,Q.jsx)(Re,{"aria-hidden":`true`,className:`mbs-0.5 size-5 shrink-0 text-warning`}),(0,Q.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,Q.jsx)(`p`,{className:`font-medium`,children:`The project was created, but its GitHub repository is not finished.`}),(0,Q.jsx)(`p`,{className:`min-w-0 whitespace-pre-wrap break-words font-mono text-xs`,children:m.warning})]})]}):(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-wrap gap-6 overflow-y-auto overscroll-contain`,children:[(0,Q.jsxs)(`div`,{className:`grid min-w-[50%] grow-[999] basis-0 content-start gap-5`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,Q.jsx)(MA,{htmlFor:`${S}-name`,children:`Name`}),(0,Q.jsx)(x_,{id:`${S}-name`,"data-slot":`create-project-name`,autoFocus:!0,autoComplete:`off`,spellCheck:!1,placeholder:`my-project`,value:n,disabled:b,"aria-invalid":M!==``&&!N,"aria-describedby":M!==``&&!N?L:void 0,onChange:e=>r(e.target.value.replace(/\s/g,`-`)),onKeyDown:e=>{e.key===`Enter`&&I()}}),M!==``&&!N?(0,Q.jsx)(`p`,{id:L,"data-slot":`create-project-name-hint`,className:`text-xs text-danger`,children:`Use letters, digits, “.”, “-” and “_” only, starting with a letter or digit — it names the folder and the repository.`}):null,(0,Q.jsx)(`p`,{"data-slot":`create-project-path`,className:`min-w-0 truncate font-mono text-[11px] text-soft-foreground`,title:`${P}/${M}`,children:M===``?`${P}/…`:`${P}/${M}`})]}),(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsx)(Mh,{id:`${S}-github`,"data-slot":`create-project-github`,checked:O,disabled:b||E===null||E.length===0,onCheckedChange:a,className:`mbs-0.5`}),(0,Q.jsxs)(`div`,{className:`grid min-w-0 gap-0.5`,children:[(0,Q.jsx)(MA,{htmlFor:`${S}-github`,children:`Also create a private GitHub repository`}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Under the account you choose. You can change its visibility on GitHub later.`})]})]}),(0,Q.jsxs)(`fieldset`,{className:`grid gap-2`,disabled:b,children:[(0,Q.jsx)(`legend`,{className:`mbe-2 text-sm font-medium`,children:`Start with`}),(0,Q.jsx)(Vj,{slot:`create-project-start-empty`,name:`${S}-start`,checked:j===`empty`,disabled:b,onChange:()=>l(`empty`),title:`Empty repository`,detail:`One empty first commit, no files.`}),(0,Q.jsx)(Vj,{slot:`create-project-start-template`,name:`${S}-start`,checked:j===`template`,disabled:b||!O,onChange:()=>l(`template`),title:`From a template`,detail:O?`GitHub generates the repository from a template.`:`Needs the GitHub repository.`})]}),j===`template`?(0,Q.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,Q.jsx)(MA,{htmlFor:`${S}-template`,children:`Template`}),(0,Q.jsx)(Rj,{id:`${S}-template`,value:u,onChange:d,disabled:b})]}):null]}),(0,Q.jsx)(Hj,{owners:E,unavailableReason:D,enabled:O&&!b,chosen:k,onChoose:s,groupName:`${S}-owner`})]}),b?(0,Q.jsx)(`p`,{"data-slot":`create-project-progress`,className:`flex-none truncate font-mono text-[11px] text-muted-foreground`,children:f??`Starting…`}):null,v.isError?(0,Q.jsx)(`p`,{"data-slot":`create-project-error`,role:`alert`,className:`flex-none min-w-0 whitespace-pre-wrap break-words text-[13px] text-danger`,children:v.error instanceof Error?v.error.message:`could not create the project`}):null,(0,Q.jsx)(bp,{className:`flex-none`,children:m?(0,Q.jsx)(A,{"data-slot":`create-project-open`,onClick:ee,children:`Go to project`}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(A,{variant:`outline`,disabled:b,onClick:()=>t(!1),children:`Cancel`}),(0,Q.jsx)(A,{"data-slot":`create-project-submit`,disabled:!F,onClick:I,children:b?`Creating…`:v.isError?`Try again`:`Create project`})]})})]})})}function Vj({slot:e,name:t,checked:n,disabled:r,onChange:i,title:a,detail:o}){return(0,Q.jsxs)(`label`,{className:s(`flex min-h-11 items-start gap-3 rounded-md border border-border p-3`,`has-[:checked]:border-accent-strong has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-offset-2 has-[:focus-visible]:outline-ring`,r?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,Q.jsx)(`input`,{type:`radio`,"data-slot":e,name:t,checked:n,disabled:r,onChange:i,className:`mbs-0.5 size-4 accent-[var(--color-accent-strong)]`}),(0,Q.jsxs)(`span`,{className:`grid min-w-0 gap-0.5`,children:[(0,Q.jsx)(`span`,{className:`text-[13px] font-medium`,children:a}),(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:o})]})]})}function Hj({owners:e,unavailableReason:t,enabled:n,chosen:r,onChoose:i,groupName:a}){return(0,Q.jsxs)(`fieldset`,{"data-slot":`create-project-owners`,disabled:!n,className:`grid min-w-0 grow basis-56 content-start gap-2`,children:[(0,Q.jsx)(`legend`,{className:`mbe-2 text-sm font-medium`,children:`Repository owner`}),t===null?e===null?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(zj,{className:`h-14 w-full`}),(0,Q.jsx)(zj,{className:`h-14 w-full`})]}):e.map(e=>(0,Q.jsxs)(`label`,{"data-slot":`create-project-owner`,className:s(`flex min-h-11 min-w-0 items-center gap-3 rounded-md border border-border p-2.5`,`has-[:checked]:border-accent-strong has-[:checked]:bg-accent`,`has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-offset-2 has-[:focus-visible]:outline-ring`,n?`cursor-pointer pointer-hover:hover:bg-accent`:`cursor-not-allowed opacity-60`),children:[(0,Q.jsx)(`input`,{type:`radio`,name:a,value:e.login,checked:r===e.login,disabled:!n,onChange:()=>i(e.login),className:`sr-only`}),e.avatarUrl?(0,Q.jsx)(`img`,{src:e.avatarUrl,alt:``,className:`size-8 shrink-0 rounded-full object-cover`}):(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`grid size-8 shrink-0 place-items-center rounded-full bg-muted text-xs font-medium uppercase`,children:e.login.slice(0,1)}),(0,Q.jsxs)(`span`,{className:`grid min-w-0`,children:[(0,Q.jsx)(`span`,{className:`truncate text-[13px] font-medium`,children:e.login}),(0,Q.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:e.personal?`Personal account`:e.description??`Organization`})]})]},e.login)):(0,Q.jsxs)(`p`,{"data-slot":`create-project-github-unavailable`,className:`rounded-md border border-border bg-muted p-3 text-xs text-muted-foreground break-words`,children:[t,`. Local projects still work.`]})]})}var Uj=e=>e.available?`success`:`danger`,Wj=e=>e.available?`Installed`:`Not installed`,Gj=e=>e.available?null:e.hint??null,Kj=`/settings/agents`,qj=`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 Jj(){let e=kr(),t=aa(),n=Qr(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)),H(`Diagnostics copied`)}catch{H(`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:`Start a new repository, 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)(A,{variant:`outline`,className:`h-10 rounded-lg px-[15px] text-xs font-normal leading-[18px]`,"data-action":`new-project`,onClick:()=>i(`new`),children:`New project`}),(0,Q.jsx)(A,{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)(A,{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:Kj,"data-slot":`tools-settings`,className:qj,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=Gj(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)(eo,{tone:Uj(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:[Wj(e),e.version?` · ${e.version}`:``]}),e.available?null:(0,Q.jsx)(X,{to:Kj,"data-slot":`tool-setup`,className:`${qj} 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)(A,{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)(A,{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===`new`?(0,Q.jsx)(Bj,{open:!0,onOpenChange:e=>{e||i(null)}}):null,r===`local`?(0,Q.jsx)(ow,{open:!0,onOpenChange:e=>{e||i(null)}}):null,r===`clone`?(0,Q.jsx)(Fj,{open:!0,onOpenChange:e=>{e||i(null)}}):null]})}var Yj=(0,Z.lazy)(()=>ya(()=>import(`./task-thread-mm4-ECyo.js`).then(e=>({default:e.TaskThreadRoute})),__vite__mapDeps([18,5,7,8,9,10,11,19,12,20,17,13,21,14,22,23,24,25,26,16,15,27,28,29]))),Xj=(0,Z.lazy)(()=>ya(()=>import(`./task-changes-DKZXuW89.js`).then(e=>({default:e.TaskChangesRoute})),__vite__mapDeps([30,5,7,8,9,10,11,19,20,12,17,13,21,14,22,23,24,25,31,32,26,33,34,35,28]))),Zj=(0,Z.lazy)(()=>ya(()=>import(`./task-files-DlF7Apcn.js`).then(e=>({default:e.TaskFilesRoute})),__vite__mapDeps([36,5,7,8,9,10,11,19,12,20,17,13,21,14,22,23,24,25]))),Qj=(0,Z.lazy)(()=>ya(()=>import(`./task-commits-BZ6KxWdF.js`).then(e=>({default:e.TaskCommitsRoute})),__vite__mapDeps([37,5,7,8,9,10,11,19,20,12,17,13,21,14,22,23,24,25,32,26,27,34,35,28]))),$j=(0,Z.lazy)(()=>ya(()=>import(`./task-github-item-CVPo3geZ.js`).then(e=>({default:e.TaskGithubItemRoute})),__vite__mapDeps([38,7,5,8,9,10,11,19,20,12,17,13,21,14,22,23,24,25,39,26,15,34,35,28,40]))),eM=(0,Z.lazy)(()=>ya(()=>import(`./repo-git-B5ECDUuv.js`).then(e=>({default:e.RepoGitRoute})),__vite__mapDeps([41,5,7,8,9,10,11,19,12,13,42,32,26,31,21,14,23,24,33,34,35,28,43]))),tM=(0,Z.lazy)(()=>ya(()=>import(`./github-DwU6ALRK.js`).then(e=>({default:e.GithubRoute})),__vite__mapDeps([44,5,7,8,9,10,11,19,13,12,42,21,22,27,39,26,15,34,35,28,40]))),nM=(0,Z.lazy)(()=>ya(()=>import(`./workflows-D8vYD-ql.js`).then(e=>({default:e.WorkflowsRoute})),__vite__mapDeps([45,5,7,8,9,10,11,19,24,46]))),rM=(0,Z.lazy)(()=>ya(()=>import(`./skills-DUeTkZ9z.js`).then(e=>({default:e.SkillsRoute})),__vite__mapDeps([47,5,7,8,9,10,11,19,13,12,46])));function iM(){let e=de();return(0,Q.jsx)(Ha,{to:{pathname:`/skills`,search:e.search,hash:e.hash},replace:!0})}function aM({sectionId:e}){let t=de();return(0,Q.jsx)(nr,{to:{pathname:BT(`global`,e),search:t.search,hash:t.hash},replace:!0})}function oM(){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 sM(){let{projectId:e=``}=gn(),t=de(),n=aa(),r=kr();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)(nr,{to:`/p/${encodeURIComponent(e)}${n||`/`}${t.search}${t.hash}`,replace:!0})}if(!n.isError)return(0,Q.jsx)(oM,{})}if(n.data){if(!(n.data.bootProject===e||n.data.projects.some(t=>t.id===e)))return(0,Q.jsx)(P_,{projectId:e,registry:n.data})}else if(!n.isError)return(0,Q.jsx)(oM,{});return(0,Q.jsx)(_t,{projectId:n.data?.bootProject===e?null:e,children:(0,Q.jsx)(pr,{},e)})}function cM(){let{projectId:e=``}=gn();return(0,Q.jsx)(T_,{},e)}var lM=/^\/tasks\/([0-9a-f-]{36})(?=\/|$)/i;function uM(){let e=de(),t=kr(),n=aa(),r=lM.exec(e.pathname)?.[1]??null,i=Fi(r!==null),a=i.data!==void 0||i.isError,o=i.data!==void 0&&!i.data.runs.some(e=>e.id===r),s=xr(r!==null&&o?r:``),c=t.data?.bootProject??n.data?.bootProject,l=(t.data!==void 0||t.isError)&&(n.data!==void 0||n.isError);if(c===void 0&&!l)return(0,Q.jsx)(oM,{});let u=c??`default`;if(e.pathname===`/`&&e.search===``&&e.hash===``){if(n.data===void 0&&!n.isError)return(0,Q.jsx)(oM,{});let e=tl(Yc(),n.data,c);if(e!==null)return(0,Q.jsx)(nr,{to:e,replace:!0})}let d=u;if(r!==null){if(!a)return(0,Q.jsx)(oM,{});let e=i.data?.runs.find(e=>e.id===r)?.projectId;if(e!==void 0)d=e;else if(o){if(s.data===void 0&&!s.isError)return(0,Q.jsx)(oM,{});d=s.data?.runs.find(e=>e.id===r)?.projectId??u}}let f=e.pathname===`/p`||e.pathname===`/p/`?`/`:e.pathname;return(0,Q.jsx)(nr,{to:`/p/${encodeURIComponent(d)}${f}${e.search}${e.hash}`,replace:!0})}var dM=[{pattern:`/`,pageLabel:`Tasks`},{pattern:`/tasks`,pageLabel:`All tasks`},{pattern:`/tools`,pageLabel:`Workspace tools`},{pattern:`/new`,pageLabel:`New task`},{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 fM(e){let t=Ua(e),n=ie({path:`/tasks/:id/*`,end:!0},t);return n?{pageLabel:null,taskId:n.params.id??null}:{pageLabel:dM.find(({pattern:e})=>ie({path:e,end:!0},t))?.pageLabel??null,taskId:null}}function pM(e){return(0,Q.jsxs)(U,{path:`/p/:projectId`,element:(0,Q.jsx)(sM,{}),children:[(0,Q.jsx)(U,{index:!0,element:(0,Q.jsx)(iO,{})}),(0,Q.jsx)(U,{path:`new`,element:(0,Q.jsx)(cM,{})}),(0,Q.jsxs)(U,{path:`tasks/:id`,element:(0,Q.jsx)(yv,{}),children:[(0,Q.jsx)(U,{index:!0,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(B_,{}),children:(0,Q.jsx)(Yj,{})})}),(0,Q.jsx)(U,{path:`changes`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(I_,{tab:`changes`}),children:(0,Q.jsx)(Xj,{})})}),(0,Q.jsx)(U,{path:`files`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(I_,{tab:`files`}),children:(0,Q.jsx)(Zj,{})})}),(0,Q.jsx)(U,{path:`commits`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(I_,{tab:`changes`}),children:(0,Q.jsx)(Qj,{})})}),(0,Q.jsx)(U,{path:`commits/:sha`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(I_,{tab:`changes`}),children:(0,Q.jsx)(Qj,{})})}),(0,Q.jsx)(U,{path:`issue/:n`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(z_,{kind:`issue`}),children:(0,Q.jsx)($j,{kind:`issue`})})}),(0,Q.jsx)(U,{path:`pr/:n`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(z_,{kind:`pr`}),children:(0,Q.jsx)($j,{kind:`pr`})})})]}),(0,Q.jsx)(U,{path:`compare/:groupId`,element:(0,Q.jsx)(Ha,{to:`/`,replace:!0})}),(0,Q.jsx)(U,{path:`git`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(M_,{}),children:(0,Q.jsx)(eM,{section:`main`,index:!0})})}),(0,Q.jsx)(U,{path:`git/commits`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(M_,{}),children:(0,Q.jsx)(eM,{section:`main`})})}),(0,Q.jsx)(U,{path:`git/commits/:sha`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(M_,{}),children:(0,Q.jsx)(eM,{section:`main`})})}),(0,Q.jsx)(U,{path:`git/not-landed`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(M_,{}),children:(0,Q.jsx)(eM,{section:`not-landed`})})}),(0,Q.jsx)(U,{path:`git/cleanup`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(M_,{}),children:(0,Q.jsx)(eM,{section:`cleanup`})})}),(0,Q.jsx)(U,{path:`git/branches`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(M_,{}),children:(0,Q.jsx)(eM,{section:`branches`})})}),(0,Q.jsx)(U,{path:`git/changes`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(M_,{}),children:(0,Q.jsx)(eM,{section:`changes`})})}),(0,Q.jsx)(U,{path:`github`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(cl,{}),children:(0,Q.jsx)(tM,{view:`issues`,index:!0})})}),(0,Q.jsx)(U,{path:`github/prs`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(cl,{}),children:(0,Q.jsx)(tM,{view:`prs`})})}),(0,Q.jsx)(U,{path:`github/issues/:n`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(cl,{}),children:(0,Q.jsx)(tM,{view:`issues`})})}),(0,Q.jsx)(U,{path:`github/prs/:n`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(cl,{}),children:(0,Q.jsx)(tM,{view:`prs`})})}),(0,Q.jsx)(U,{path:`github/prs/:n/changes`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(cl,{}),children:(0,Q.jsx)(tM,{view:`prs`,changes:!0})})}),(0,Q.jsx)(U,{path:`automations`,element:(0,Q.jsx)(Nj,{})}),(0,Q.jsx)(U,{path:`automations/new`,element:(0,Q.jsx)(Nj,{mode:`new`})}),(0,Q.jsx)(U,{path:`automations/:automationId`,element:(0,Q.jsx)(Nj,{mode:`edit`})}),(0,Q.jsx)(U,{path:`automations/:automationId/log`,element:(0,Q.jsx)(Nj,{mode:`log`})}),(0,Q.jsx)(U,{path:`skills`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(N_,{}),children:(0,Q.jsx)(rM,{})})}),(0,Q.jsx)(U,{path:`inbox`,element:(0,Q.jsx)(vf,{})}),(0,Q.jsx)(U,{path:`workflows`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(F_,{}),children:(0,Q.jsx)(nM,{})})}),(0,Q.jsx)(U,{path:`workflows/:name`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(F_,{}),children:(0,Q.jsx)(nM,{})})}),(0,Q.jsx)(U,{path:`settings`,element:(0,Q.jsx)(KT,{capabilities:e})}),(0,Q.jsx)(U,{path:`settings/skills`,element:(0,Q.jsx)(iM,{})}),Kw(`project`,e).map(t=>(0,Q.jsx)(U,{path:`settings/${t.id}`,element:(0,Q.jsx)(GT,{section:t,scope:`project`,capabilities:e})},t.id)),Kw(`global`,e).map(e=>(0,Q.jsx)(U,{path:`settings/${e.id}`,element:(0,Q.jsx)(aM,{sectionId:e.id})},e.id)),(0,Q.jsx)(U,{path:`*`,element:(0,Q.jsx)(A_,{})})]})}function mM(e,t){let n=ar(rt(pM(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 hM(){let e=kr().data?.capabilities;return(0,Q.jsxs)(ur,{children:[pM(e),(0,Q.jsx)(U,{path:`/tasks`,element:(0,Q.jsx)(YO,{})}),(0,Q.jsx)(U,{path:`/tools`,element:(0,Q.jsx)(Jj,{})}),(0,Q.jsx)(U,{path:`/settings/global`,element:(0,Q.jsx)(nr,{to:VT,replace:!0})}),(0,Q.jsx)(U,{path:`/settings/global/skills`,element:(0,Q.jsx)(nr,{to:`/skills`,replace:!0})}),Kw(`global`,e).map(t=>(0,Q.jsx)(U,{path:BT(`global`,t.id),element:(0,Q.jsx)(GT,{section:t,scope:`global`,capabilities:e})},t.id)),(0,Q.jsx)(U,{path:`*`,element:(0,Q.jsx)(uM,{})})]})}var gM=2500,_M=e=>String(to(e,`/`));function vM(e,t,n){let r={href:_M(e),verify:!1},i=sl(e,t,n.registry);if(i===null)return r;try{let e=mM(i.replace(/[?#].*$/,``),n.capabilities);return e===null?r:{href:i,verify:Object.keys(e.params).some(e=>e!==`projectId`)}}catch{return r}}var yM=e=>ee(e.opts.projectId,e.params.id??``,{signal:e.opts.signal});function bM(e){let t=Number(e);return Number.isSafeInteger(t)&&t>=1?t:null}async function xM(e,t,n){let r=await ht(e,t,{},n.opts);return r.available?r.item!==null:null}var SM=async e=>(await yM(e),!0),CM=async e=>(await yM(e),await $n(e.params.id??``,e.params.sha??``,e.opts),!0);async function wM(e,t){let n=await yM(e),r=bM(e.params.n);return r===null?!1:ta(n,e.repoBase).some(e=>e.kind===t&&e.number===r)?xM(t,r,e):e.repoBase===void 0&&null}var TM=async e=>(await Wn(e.params.sha??``,e.opts),!0);async function EM(e,t){let n=bM(e.params.n);return n!==null&&xM(t,n,e)}var DM=[{matches:e=>e===`/tasks/:id/commits/:sha`,check:CM},{matches:e=>e===`/tasks/:id/issue/:n`,check:e=>wM(e,`issue`)},{matches:e=>e===`/tasks/:id/pr/:n`,check:e=>wM(e,`pr`)},{matches:e=>e.startsWith(`/tasks/:id`),check:SM},{matches:e=>e===`/git/commits/:sha`,check:TM},{matches:e=>e===`/github/issues/:n`,check:e=>EM(e,`issue`)},{matches:e=>e.startsWith(`/github/prs/:n`),check:e=>EM(e,`pr`)},{matches:e=>e===`/workflows/:name`,check:async e=>{let{workflows:t,issues:n}=await sr(e.opts);return t.some(t=>t.name===e.params.name)?!0:n.length>0&&null}},{matches:e=>e.startsWith(`/automations/:automationId`),check:async e=>{let t=await Be(e.opts);return t.available?t.automations.some(t=>t.id===e.params.automationId):null}}];async function OM(e,t,n,r,i){let a=``;try{let o=mM(t,n);if(o===null)return!1;a=o.pattern;let s=DM.find(e=>e.matches(o.pattern));return s===void 0?null:await s.check({projectId:e,pattern:a,params:o.params,repoBase:i,opts:{projectId:e,signal:r}})}catch(e){return!AM(e,a)&&null}}var kM=/unknown revision|bad object|bad revision|unknown commit|not a commit hash|needed a single revision/i;function AM(e,t){return e instanceof ft?e.status===404||(t===`/git/commits/:sha`||t===`/tasks/:id/commits/:sha`)&&e.status===409&&kM.test(e.message):!1}async function jM(e,t,n){let r=vM(e,t,n);if(!r.verify)return r.href;let i=new AbortController,a=setTimeout(()=>i.abort(),gM);try{return await OM(e,r.href.replace(/[?#].*$/,``),n.capabilities,i.signal,n.repoBaseOf?.(e))===!1?_M(e):r.href}finally{clearTimeout(a)}}var MM={key:``,navigate:null,ticket:0};function NM(e,t){e!==MM.key&&MM.ticket++,MM.key=e,MM.navigate=t}function PM(){MM.ticket++}async function FM(e,t,n){let r=++MM.ticket,i=MM.key,a=await jM(e,t,n);r===MM.ticket&&i===MM.key&&MM.navigate?.(a)}function IM(){let e=ce(),t=de();Z.useLayoutEffect(()=>{NM(`${t.key}|${t.pathname}${t.search}${t.hash}`,e)},[e,t.key,t.pathname,t.search,t.hash])}function LM(){let e=aa().data,t=kr().data,n=t?.capabilities,r=Z.useCallback(n=>e?.projects.find(e=>e.id===n)?.repoUrl??(n===(t?.bootProject??e?.bootProject)?Qr(t?.repo?.remote):void 0),[e,t]);IM();let{pathname:i,search:a,hash:o}=de(),s=Ja(i),c=`${i}${a}${o}`;return{target:Z.useCallback(t=>t===s?{href:c,verify:!1}:vM(t,al(t),{registry:e,capabilities:n}),[e,n,s,c]),go:Z.useCallback(async t=>{if(t===s)return PM();await FM(t,al(t),{registry:e,capabilities:n,repoBaseOf:r})},[e,n,r,s])}}var RM=[{to:`/`,label:`Tasks`,icon:Gt,match:[`/`,`/tasks`],badge:`tasks-unread`},{to:`/git`,label:`Git`,icon:Yn,match:[`/git`]},{to:`/github`,label:`GitHub`,icon:Gn,match:[`/github`],forge:!0},{to:`/automations`,label:`Automations`,icon:_r,match:[`/automations`],automations:!0},{to:`/skills`,label:`Skills`,icon:le,match:[`/skills`]},{to:`/workflows`,label:`Workflows`,icon:Ce,match:[`/workflows`]},{to:`/settings`,label:`Settings`,icon:cr,match:[`/settings`]}];function zM({forge:e=!1,automations:t=!1}={}){return RM.filter(n=>(!n.forge||e)&&(!n.automations||t))}function BM(e,t){return t===`/`?e===`/`:e===t||e.startsWith(t+`/`)}function VM(e){let t=null;for(let n of RM)for(let r of n.match)BM(e,r)&&(t===null||r.length>t.length)&&(t={to:n.to,length:r.length});return t?.to??null}function HM(e){let t=VM(e);return RM.find(e=>e.to===t)??null}function UM(e){return/^\/tasks\/[^/]+(?:\/|$)/.test(Ua(e))}function WM(e,t){let n=Ua(e);return/^\/git\/?$/.test(n)?new URLSearchParams(t).get(`view`)===`repo`:/^\/git\//.test(n)}var GM=[`/`,`/git`,`/github`],KM=[`/skills`,`/workflows`,`/settings`,`/automations`],qM={light:`dark`,dark:`system`,system:`light`},JM={light:`light`,dark:`dark`,system:`system`};function YM({className:e,showLabel:t=!1,labelClassName:n}){let{theme:r,setTheme:i}=tb(),a=qM[r],o=vn;return(0,Q.jsxs)(A,{type:`button`,variant:`ghost`,size:`icon-sm`,className:e,"data-slot":`theme-toggle`,"data-theme-pref":r,title:`Theme: ${JM[r]}`,"aria-label":`Theme: ${JM[r]}. Switch to ${JM[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 XM,ZM,QM,$M=new Map,eN=new Map,tN=new Map,nN=new Set,rN=(e,t)=>`${e}\u0000${t}`,iN=()=>nN.forEach(e=>e()),aN=e=>$M.get(rN(e.runId,e.askRequestId));function oN(e){e.kind===`answer`?(ZM&&aN(e)?.restore(ZM),ZM=void 0):eN.get(e.runId)?.clearVoiceDraft(e.text)}function sN(e,t){let n=new Map;for(let r of[...e,...t])n.set(r.question,r);return[...n.values()].sort((e,t)=>e.question-t.question)}function cN(e){let t=XM;if(e.kind===`answer`){let n=aN(e);if(!n)return{ok:!1,reason:`no-card`};if(t?.kind===`answer`&&t.askRequestId===e.askRequestId&&t.runId===e.runId){let r={...e,answers:sN(t.answers,e.answers)};return XM=r,QM=void 0,n.apply(r.answers),iN(),{ok:!0,replaced:t.decisionId}}return t&&oN(t),ZM=n.read(),XM=e,QM=void 0,n.apply(e.answers),iN(),t?{ok:!0,replaced:t.decisionId}:{ok:!0}}let n=eN.get(e.runId);if(!n)return{ok:!1,reason:`no-card`};let r=n.getDraft(),i=t?.kind===`tell`&&t.runId===e.runId&&r===t.text;return r.trim()!==``&&!i?{ok:!1,reason:`draft-not-empty`}:n.setDraft(e.text)?(t&&!(t.kind===`tell`&&t.runId===e.runId)&&oN(t),XM=e,QM=void 0,iN(),t?{ok:!0,replaced:t.decisionId}:{ok:!0}):{ok:!1,reason:`busy`}}function lN(){let e=XM;if(!e)return{ok:!1,reason:`no-target`};if(e.kind===`answer`){let t=aN(e);if(!t)return{ok:!1,reason:`no-target`};let n=t.unanswered();if(n.length>0)return{ok:!1,unanswered:n.map(e=>({index:e,header:t.headers[e]??``}))};if(!t.send())return{ok:!1,reason:`busy`};ZM=void 0}else{let t=eN.get(e.runId);if(!t)return{ok:!1,reason:`no-target`};if(!t.submit())return{ok:!1,reason:`busy`}}return XM=void 0,iN(),{ok:!0}}function uN(){let e=XM;e&&(oN(e),XM=void 0,iN())}function dN(e){XM=void 0,ZM=void 0,QM=e,iN()}var fN=e=>XM?.kind===`answer`&&XM.runId===e?XM:void 0,pN={getProposal:()=>XM,propose:cN,confirm:lN,cancel:uN,lastDrop:()=>QM,headersFor:(e,t)=>$M.get(rN(e,t))?.headers,registerAskCard(e){let t=rN(e.runId,e.requestId);return $M.set(t,e),XM?.kind===`answer`&&rN(XM.runId,XM.askRequestId)===t&&e.apply(XM.answers,{reveal:!1}),()=>{$M.get(t)===e&&$M.delete(t)}},syncPendingAsk(e,t){let n=fN(e);n&&n.askRequestId!==t&&dN(`question-closed`);let r=t??null;tN.get(e)!==r&&(tN.set(e,r),iN())},leaveTask(e){fN(e)&&dN(`task-closed`),tN.delete(e)&&iN()},pendingAskFor(e){return tN.get(e)},registerComposer(e){return eN.set(e.runId,e),()=>{eN.get(e.runId)===e&&(eN.delete(e.runId),XM?.kind===`tell`&&XM.runId===e.runId&&(e.clearVoiceDraft(XM.text),dN(`task-closed`)))}},subscribe(e){return nN.add(e),()=>{nN.delete(e)}}};function mN(){return(0,Z.useSyncExternalStore)(pN.subscribe,pN.getProposal,pN.getProposal)}function hN(e){let t=()=>e===void 0?void 0:pN.pendingAskFor(e);return(0,Z.useSyncExternalStore)(pN.subscribe,t,t)}var gN=Z.createContext(null);function _N({children:e}){let[t,n]=Z.useState(`active`),r=Z.useMemo(()=>[t,n],[t]);return(0,Q.jsx)(gN.Provider,{value:r,children:e})}function vN(){let e=Z.useContext(gN);if(!e)throw Error(`useListView must be used inside a <ListViewProvider>`);return e}var yN=[`one`,`two`,`three`,`four`,`five`,`six`,`seven`,`eight`,`nine`,`ten`],bN=[`first`,`second`,`third`,`fourth`,`fifth`,`sixth`,`seventh`,`eighth`,`ninth`,`tenth`],xN=RegExp(`^(?:the\\s+)?(?:number\\s+)?(\\d{1,2}|${[...yN,...bN].join(`|`)})(?:\\s+one)?$`);function SN(e,t){let n=xN.exec(e.toLowerCase().trim().replace(/[.!?]$/,``).trim())?.[1];if(n===void 0)return null;let r=/^\d+$/.test(n)?Number(n):Math.max(yN.indexOf(n),bN.indexOf(n))+1;return r>=1&&r<=Math.min(10,t)?r-1:null}var CN={"needs-permission":`needs-permission`,failed:`failed`,"needs-you":null,"needs-review":`needs-review`,running:`running`,"usage-limit":`scheduled`,"waiting-on-workers":`waiting-on-workers`,"waiting-for-ci":`waiting-for-ci`,"waiting-for-merge":null,"waiting-for-command":null,monitoring:`monitoring`,"waiting-for-capacity":`waiting-for-capacity`,queued:`queued`,done:`done`,cancelled:`cancelled`,unseen:null};function wN(e,t){switch(e){case`needs-you`:return qi(t,`active`)===`Needs you`;case`working`:return qi(t,`active`)===`Working`;case`finished`:return qi(t,`active`)===`Finished`;case`archived`:return t.archived===!0;case`needs-permission`:return R(t).bucket===`permission`;case`failed`:return R(t).bucket===`error`;case`needs-review`:case`running`:case`waiting-for-ci`:case`monitoring`:case`waiting-for-capacity`:case`queued`:case`scheduled`:case`waiting-on-workers`:return CN[R(t).rung]===e;case`done`:case`cancelled`:return t.status===e;case`unread`:return Zw(t)}}function TN(e,t,n){return n===`archived`?ri(e,`archived`).filter(e=>!Di(e)).slice(0,200).map(e=>({kind:`run`,run:e,queuePosition:null})):ki(fa(e,t),`active`).flatMap(e=>e.rows)}var EN=(e,t)=>wN(t,e.run),DN=(e,t)=>e.run.id===t,ON=e=>e===void 0?{kind:`past-end`}:{kind:`run`,runId:e.run.id};function kN(e){let{runs:t,sidebarView:n,openRunId:r,status:i,position:a}=e,o=TN(t,n,i).filter(e=>EN(e,i));if(o.length===0)return{kind:`empty`};if(typeof a==`number`)return ON(o[a-1]);if(a===`last`)return ON(o[o.length-1]);let s=ti(r,t),c=s===null?-1:o.findIndex(e=>DN(e,s));return ON(a===`next`?o[c+1]:c===-1?o[o.length-1]:o[c-1])}var AN=[[`/tasks`,`task`],[`/new`,`new-task`],[`/github`,`github`],[`/git`,`git`],[`/automations`,`automations`],[`/inbox`,`inbox`],[`/settings`,`settings`]];function jN(e){for(let[t,n]of AN)if(e===t||e.startsWith(`${t}/`))return n;return`other`}var MN=wa([`needs-you`,`working`,`finished`,`archived`,`needs-review`,`needs-permission`,`failed`,`running`,`waiting-for-ci`,`monitoring`,`waiting-for-capacity`,`queued`,`scheduled`,`waiting-on-workers`,`done`,`cancelled`,`unread`]),NN=Ma([wa([`next`,`previous`,`last`]),K().int().min(1).max(10)]),PN=wa([`active`,`automations`]),FN=wa([`task`,`new-task`,`github`,`git`,`automations`,`inbox`,`settings`,`other`]);q({text:J().trim().min(1).max(500),sidebarView:PN,openRunId:ja.shape.id.optional(),view:FN.optional(),askRequestId:J().min(1).max(200).nullable().optional(),proposal:q({decisionId:Ia(),action:wa([`answer`,`tell`])}).strict().optional()}).strict();var IN=Oa(`kind`,[q({question:K().int().min(0).max(3),kind:Aa(`option`),labels:Ca(J()).min(1).max(4)}),q({question:K().int().min(0).max(3),kind:Aa(`other`),text:J().min(1).max(500)})]),LN=Ia(),RN=K().min(0).max(1);Oa(`action`,[q({action:Aa(`open`),decisionId:LN,status:MN,position:NN,confidence:RN,alternatives:Ca(q({status:MN,position:NN})).max(3).optional()}),q({action:Aa(`answer`),decisionId:LN,runId:ja.shape.id,askRequestId:J(),answers:Ca(IN).min(1).max(4),confidence:RN}),q({action:Aa(`tell`),decisionId:LN,runId:ja.shape.id,text:J().min(1).max(500),confidence:RN}),q({action:Aa(`confirm`),decisionId:LN}),q({action:Aa(`cancel`),decisionId:LN}),q({action:Aa(`none`),decisionId:LN,reason:wa([`not-a-command`,`no-open-task`,`no-open-question`,`unclear`,`ambiguous`,`stale-context`,`unsupported`])})]);var zN=wa([`executed`,`confirmed`,`cancelled`,`replaced`,`abandoned`]);q({decisionId:Ia(),outcome:zN}).strict(),q({ok:Aa(!0)});var BN=[`first`,`second`,`third`,`fourth`,`fifth`,`sixth`,`seventh`,`eighth`,`ninth`,`tenth`];function VN(e){return typeof e==`number`?BN[e-1]??String(e):e}function HN(e){return e.split(`-`).map(e=>e===`ci`?`CI`:e).join(` `)}function UN(e,t,n){return`Open “${e}” — ${VN(n)} ${HN(t)}`}var WN=e=>`No ${HN(e)} tasks.`,GN=(e,t)=>`No ${VN(t)} ${HN(e)} task.`;function KN(e,t,n){return`Answer ${n?`“${n}”: `:``}${qN(e,t).join(`; `)}`}function qN(e,t){return e.map(e=>`${t?.[e.question]||`question ${e.question+1}`}: ${e.kind===`option`?e.labels.join(`, `):e.text}`)}function JN(e,t){return e===`answer`?t?`Answer “${t}”`:`Answer the question`:t?`Send to “${t}”`:`Send to this task`}var YN=(e,t)=>t?`Tell “${t}”: ${e}`:`Tell it: ${e}`,XN=`voice-will-do`,ZN=3e3,QN={timedOut:`Voice decision timed out.`,unavailable:`Voice decision unavailable.`,noCard:`This question is not open here.`,draftNotEmpty:`The message box already has text.`,busy:`The task is busy. Try again in a moment.`,noOpenTask:`Open a task first.`,noOpenQuestion:`This task has no open question.`,unclear:`Not sure what to do. Try again.`,questionClosed:`The question was answered or closed elsewhere.`,taskClosed:`The task is no longer open.`,scrollToQuestion:`Scroll to the question, then confirm.`,ambiguous:`Which question? Name it, for example “to question two”.`,staleContext:`The screen changed. Try again.`,unsupported:`Voice cannot do that yet.`},$N={"no-open-task":QN.noOpenTask,"no-open-question":QN.noOpenQuestion,unclear:QN.unclear,ambiguous:QN.ambiguous,"stale-context":QN.staleContext,unsupported:QN.unsupported};function eP(e){return e.trim().split(/\s+/).length>=2}var tP=e=>eP(e)&&e.length<=500,nP=e=>/^(?:no|cancel)$/.test(e.toLowerCase().replace(/[.!?]+$/,``).trim()),rP=(e,t)=>e.text===t.text&&e.projectId===t.projectId&&e.view===t.view&&e.openRunId===t.openRunId&&e.askRequestId===t.askRequestId&&e.proposalId===t.proposalId;function iP(e,t){let n=e=>{let n=t.runs.find(t=>t.id===e.runId);return n?ma(n):e.runId},r=(e,n)=>kN({...t,status:e,position:n}),i=r(e.status,e.position),a=[],o=new Set;for(let t of[{status:e.status,position:e.position},...e.alternatives??[]]){let e=r(t.status,t.position);if(e.kind!==`run`)continue;let i=`run:${e.runId}`;o.has(i)||(o.add(i),a.push({target:e,text:UN(n(e),t.status,t.position)}))}return{primary:i,choices:e.alternatives?.length?a:a.slice(0,1)}}function aP(e,t){let n=e.find(e=>e.id===t);return n?ma(n):void 0}function oP(e,t){let n=JN(e.kind,aP(t,e.runId));return e.kind===`answer`?{heading:n,lines:qN(e.answers,pN.headersFor(e.runId,e.askRequestId))}:{heading:n,lines:[e.text]}}function sP(){document.querySelector(`[cmdk-item]:not([data-slot^="voice-"]):not([data-disabled="true"])`)?.click()}var cP={row:void 0,confirm:void 0,mode:`idle`,onEnter:()=>!1,onClose:()=>{},onSelect:()=>{},onConfirm:()=>{}};function lP(e){let{enabled:t}=e,n=Yr().data,[r]=vN(),i=Ya(`/tasks/:id/*`)?.params.id??null,a=Wa(),o=jN(Ka()),s=hN(i??void 0),c=Za(),l=mN(),u=e.text.trim(),d=Z.useMemo(()=>({text:u,projectId:a,view:o,openRunId:i,askRequestId:s,proposalId:l?.decisionId??null}),[u,a,o,i,s,l?.decisionId]),[f,p]=Z.useState(),[m,h]=Z.useState(),[g,_]=Z.useState(),v=g!==void 0&&g.projectId===a&&g.view===o&&g.openRunId===i&&g.sidebarView===r?g:void 0,y=v?SN(u,v.choices.length):null,b=v!==void 0&&!(tP(u)&&y===null)?v:void 0,x=Z.useRef({...e,key:d,runs:n??[],sidebarView:r,openRunId:i,navigate:c,settled:f,choosing:b});x.current={...e,key:d,runs:n??[],sidebarView:r,openRunId:i,navigate:c,settled:f,choosing:b};let S=Z.useRef(void 0),C=Z.useRef(void 0),w=Z.useRef(!1),T=Z.useRef(new Set),E=Z.useRef(new Set),D=Z.useCallback((e,t)=>{E.current.has(e)||(E.current.add(e),un(e,t))},[]),O=Z.useCallback(e=>h({text:e,forText:x.current.key.text}),[]),k=Z.useCallback(e=>h({text:e,forText:x.current.key.text,forKey:x.current.key}),[]),A=Z.useCallback(e=>{let t=S.current;if(t&&rP(t.key,e)&&!t.failed)return t;t?.controller.abort();let n=new AbortController,r=pN.getProposal(),i={key:e,controller:n,failed:!1,result:it({text:e.text,sidebarView:x.current.sidebarView,view:e.view,...e.openRunId===null?{}:{openRunId:e.openRunId},...e.askRequestId===void 0?{}:{askRequestId:e.askRequestId},...r&&r.decisionId===e.proposalId?{proposal:{decisionId:r.decisionId,action:r.kind}}:{}},n.signal).then(e=>n.signal.aborted?{kind:`aborted`}:{kind:`decision`,decision:e},()=>n.signal.aborted?{kind:`aborted`}:{kind:`failed`})};return i.result.then(t=>{t.kind===`failed`&&(i.failed=!0),t.kind!==`aborted`&&w.current&&S.current===i&&p({key:e,result:t})}),S.current=i,i},[]),j=Z.useCallback((e,t)=>{D(e,`executed`);let n=pN.getProposal();n&&(pN.cancel(),D(n.decisionId,`abandoned`)),_(void 0),x.current.close(),x.current.navigate(`/tasks/${t.runId}`)},[D]),M=Z.useCallback(()=>{let e=pN.getProposal();if(!e)return;let t=pN.confirm();if(t.ok)D(e.decisionId,`confirmed`),x.current.close();else if(`unanswered`in t){let e=t.unanswered[0];e&&O(`Question ${e.index+1} (${e.header}) still needs an answer.`)}else t.reason===`busy`?O(QN.busy):e.kind===`answer`?O(QN.scrollToQuestion):(pN.cancel(),D(e.decisionId,`abandoned`),O(QN.taskClosed))},[D,O]),N=Z.useCallback((e,t)=>{T.current.add(e.decisionId);let{clearText:n,runs:r,sidebarView:i,openRunId:a}=x.current;switch(e.action){case`open`:{let{primary:o,choices:s}=iP(e,{runs:r,sidebarView:i,openRunId:a});if(s.length>=2){_({decisionId:e.decisionId,choices:s,projectId:t.key.projectId,view:t.key.view,openRunId:a,sidebarView:i}),n();return}let c=s[0];return c?j(e.decisionId,c.target):k(o.kind===`empty`?WN(e.status):GN(e.status,e.position))}case`answer`:case`tell`:{if(e.runId!==a)return;let t=pN.propose(e.action===`answer`?{kind:`answer`,decisionId:e.decisionId,runId:e.runId,askRequestId:e.askRequestId,answers:e.answers}:{kind:`tell`,decisionId:e.decisionId,runId:e.runId,text:e.text});if(t.ok){t.replaced&&D(t.replaced,`replaced`),_(void 0),n();return}return k(t.reason===`no-card`?QN.noCard:t.reason===`draft-not-empty`?QN.draftNotEmpty:QN.busy)}case`confirm`:case`cancel`:{let r=pN.getProposal();if(t.key.proposalId===null||r?.decisionId!==t.key.proposalId)return k(QN.unclear);if(e.action===`confirm`)return M();pN.cancel(),D(r.decisionId,`cancelled`),n();return}case`none`:return e.reason===`not-a-command`?sP():k($N[e.reason])}},[M,j,D,k]),P=Z.useCallback(async()=>{let e=x.current.key,t=A(e);if(C.current===t)return;C.current=t;let n,r=new Promise(e=>{n=setTimeout(()=>e(`timeout`),ZN)}),i=await Promise.race([t.result,r]);clearTimeout(n);let a=C.current===t;if(a&&(C.current=void 0),!(!a||!w.current)&&rP(x.current.key,e)){if(i===`timeout`)return t.controller.abort(),S.current===t&&(S.current=void 0),k(QN.timedOut),sP();if(i.kind!==`aborted`){if(i.kind===`failed`)return k(QN.unavailable),sP();N(i.decision,t)}}},[N,A,k]),F=Z.useCallback(e=>{let t=x.current;if(t.choosing){let n=t.choosing.choices[e];n&&j(t.choosing.decisionId,n.target);return}let n=t.settled;if(!n||!rP(n.key,t.key)||!tP(t.key.text)||n.result.kind!==`decision`||n.result.decision.action!==`open`)return;let{decision:r}=n.result,i=iP(r,t).choices[e];i&&(T.current.add(r.decisionId),j(r.decisionId,i.target))},[j]),{selected:I}=e;Z.useEffect(()=>{I!==`voice-will-do`&&(C.current=void 0)},[I]),Z.useEffect(()=>{let e=S.current;if(e&&!rP(e.key,d)&&(e.controller.abort(),S.current=void 0),!t||!tP(d.text)||y!==null||S.current)return;let n=setTimeout(()=>A(d),300);return()=>clearTimeout(n)},[t,d,y,A]);let ee=g!==void 0&&b===void 0;Z.useEffect(()=>{h(e=>e&&e.forText!==u?void 0:e)},[u]),Z.useEffect(()=>{ee&&_(void 0)},[ee]),Z.useEffect(()=>{let e=pN.getProposal();return pN.subscribe(()=>{let t=pN.getProposal(),n=pN.lastDrop();e&&!t&&n&&x.current.enabled&&(D(e.decisionId,`abandoned`),O(n===`question-closed`?QN.questionClosed:QN.taskClosed)),e=t})},[D,O]);let L=Z.useCallback(()=>{let e=x.current;if(!e.enabled)return;S.current?.controller.abort();let t=pN.getProposal();t&&(pN.cancel(),D(t.decisionId,`cancelled`));let n=e.settled;if(n&&rP(n.key,e.key)&&n.result.kind===`decision`){let{decision:e}=n.result;e.action!==`none`&&!T.current.has(e.decisionId)&&D(e.decisionId,`abandoned`)}e.choosing&&D(e.choosing.decisionId,`abandoned`)},[D]);Z.useEffect(()=>(w.current=!0,()=>{w.current=!1,L()}),[L]);let R=Z.useCallback(e=>{let t=x.current;if(!t.enabled)return!1;let n=t.key.text,r=()=>(e.preventDefault(),!0);if(e.repeat)return tP(n)||pN.getProposal()?r():!1;if(t.choosing){let e=SN(n,t.choosing.choices.length);if(e!==null)return F(e),r()}let i=pN.getProposal();return i&&nP(n)?(pN.cancel(),D(i.decisionId,`cancelled`),t.clearText(),r()):n===``&&i&&!t.choosing?(M(),r()):tP(n)&&t.selected===`voice-will-do`?(P(),r()):!1},[F,P,M,D]),te=Z.useCallback(e=>{if(e!==void 0)return F(e);tP(x.current.key.text)&&P()},[F,P]);if(!t)return cP;let ne;m&&m.forText===u&&(m.forKey===void 0||rP(m.forKey,d))?ne={kind:`notice`,text:m.text}:b?ne={kind:`will-do`,text:`Which one?`,choices:b.choices.map(e=>e.text)}:f&&rP(f.key,d)&&tP(u)?ne=uP(f.result,f.key,{runs:n??[],sidebarView:r,openRunId:i}):tP(u)&&y===null&&(ne={kind:`will-do`,text:`Reading…`,pending:!0});let z=l&&u===``&&!b?oP(l,n??[]):void 0,re=b?`choosing`:l?`proposal`:tP(u)?`preview`:`idle`;return{row:ne,confirm:z,mode:re,onEnter:R,onClose:L,onSelect:te,onConfirm:M}}function uP(e,t,n){if(e.kind===`aborted`)return;if(e.kind===`failed`)return{kind:`notice`,text:QN.unavailable};let{decision:r}=e;switch(r.action){case`open`:{let{primary:e,choices:t}=iP(r,n);if(t.length>=2)return{kind:`will-do`,text:`Which one?`,choices:t.map(e=>e.text)};let i=t[0];return i?{kind:`will-do`,text:i.text}:{kind:`notice`,text:e.kind===`empty`?WN(r.status):GN(r.status,r.position)}}case`answer`:return r.runId===n.openRunId?{kind:`will-do`,text:KN(r.answers,pN.headersFor(r.runId,r.askRequestId),aP(n.runs,r.runId))}:void 0;case`tell`:return r.runId===n.openRunId?{kind:`will-do`,text:YN(r.text,aP(n.runs,r.runId))}:void 0;case`confirm`:case`cancel`:return t.proposalId===null?{kind:`notice`,text:QN.unclear}:{kind:`will-do`,text:r.action===`confirm`?`Send it`:`Drop it`};case`none`:return r.reason===`not-a-command`?void 0:{kind:`notice`,text:$N[r.reason]}}}function dP({row:e,committable:t,onSelect:n}){return e?(0,Q.jsxs)(Op,{forceMount:!0,"data-slot":`voice-rows`,children:[(0,Q.jsxs)(Ap,{forceMount:!0,value:XN,"data-slot":`voice-row`,"data-voice-kind":e.kind,disabled:e.kind===`notice`||e.choices!==void 0||!t,onSelect:()=>n(),className:`data-[disabled=true]:opacity-100`,children:[e.kind===`will-do`?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-soft-foreground`,children:`Will do`}):null,(0,Q.jsx)(`span`,{role:e.kind===`notice`?`status`:void 0,className:e.pending?`min-w-0 flex-1 truncate text-muted-foreground`:`min-w-0 flex-1 truncate`,children:e.text})]}),e.choices?.map((e,t)=>(0,Q.jsxs)(Ap,{forceMount:!0,value:`voice-choice-${t+1}`,"data-slot":`voice-choice`,onSelect:()=>n(t),children:[(0,Q.jsx)(`span`,{className:`w-4 shrink-0 text-center text-xs text-soft-foreground tabular-nums`,children:t+1}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e})]},t))]}):null}var fP=`Say “yes, confirmed” or press Return to send…`;function pP({confirm:e,notice:t,onConfirm:n}){return(0,Q.jsxs)(Op,{forceMount:!0,"data-slot":`voice-confirm-panel`,children:[t?(0,Q.jsx)(`p`,{role:`status`,className:`px-2 py-1.5 text-sm text-foreground`,children:t}):null,(0,Q.jsxs)(Ap,{forceMount:!0,value:`voice-confirm`,"data-slot":`voice-confirm`,onSelect:n,className:`flex-col items-start gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:e.heading}),e.lines.map((e,t)=>(0,Q.jsx)(`span`,{className:`w-full whitespace-pre-wrap break-words`,children:e},t))]}),(0,Q.jsxs)(`div`,{"data-slot":`voice-confirm-hints`,className:`flex gap-4 px-2 pt-2 pb-1 text-xs text-muted-foreground`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(`kbd`,{className:`font-sans text-soft-foreground`,children:`↵`}),` Send`]}),(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(`kbd`,{className:`font-sans text-soft-foreground`,children:`Esc`}),` Cancel`]})]})]})}var mP=`cezar:open-command-palette`;function hP(){window.dispatchEvent(new Event(mP))}function gP(e){return[...e].sort((e,t)=>Date.parse(t.createdAt)-Date.parse(e.createdAt))}function _P(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 vP(e,t){if(t.trim()===``)return e;let n=e=>e.rows.reduce((e,n)=>Math.max(e,_P(n.value,t,n.keywords)),0);return e.map(e=>({group:e,score:n(e)})).sort((e,t)=>t.score-e.score).map(({group:e})=>e)}function yP(e,t){return{value:`task ${ma(e)} ${e.id}`,keywords:[...t?[t]:[],...EP(e),...[e.branch,e.workflow,e.workflowLabel,e.pullRequestUrl,e.referencedPullRequestUrl,e.referencedIssueUrl].filter(e=>!!e)]}}var bP=e=>({value:`view ${e}`}),xP=e=>({value:`project ${e.name} ${e.id}`,keywords:[e.root]}),SP=e=>({value:`skill ${e.name} ${e.path}`,...f({keywords:e.description?[e.description]:void 0})}),CP={value:`action toggle theme`},wP=150;function TP(e,t,n,r=[]){let i=gP(e.filter(e=>!Di(e))).map(e=>({...e,projectId:t})),a=new Set(i.map(DP)),o=[...n??[],...r].filter(e=>Di(e)||a.has(DP(e))?!1:(a.add(DP(e)),!0)).sort((e,t)=>t.createdAt.localeCompare(e.createdAt));return[...i,...o]}function EP(e){let t=new Set;for(let n of[e.pullRequestUrl,e.referencedPullRequestUrl,e.referencedIssueUrl]){let e=n?/\/(\d+)\/?$/.exec(n):null;e&&t.add(Number(e[1]))}for(let n of[e.prNumber,e.issueNumber,e.markerRefs?.pr,e.markerRefs?.issue])typeof n==`number`&&Number.isInteger(n)&&n>0&&t.add(n);return[...t].flatMap(e=>[String(e),`#${e}`])}var DP=e=>`${e.projectId??``}/${e.id}`;function OP(e){let t=e.filter(e=>Zw(e)).sort((e,t)=>(t.finishedAt??``).localeCompare(e.finishedAt??``)),n=new Set(t.map(DP));return{recentlyFinished:t,otherTasks:e.filter(e=>!n.has(DP(e)))}}function kP(e,t,n=[]){let r=LC(e,n);return[...r.filter(e=>e.id!==t),...r.filter(e=>e.id===t)]}function AP(){let[e,t]=Z.useState(!1),[n,r]=Z.useState(``);Z.useEffect(()=>{e||r(``)},[e]);let i=Za();Qp(`k`,()=>t(e=>!e));let a=Z.useCallback(()=>{t(!1),i(`/new`)},[i]);Qp(`n`,a),tm(`c`,a),Z.useEffect(()=>{let e=()=>t(!0);return window.addEventListener(mP,e),()=>window.removeEventListener(mP,e)},[]);let o=mN(),s=e&&o!==void 0;return(0,Q.jsx)(wp,{open:e,onOpenChange:t,title:`Command palette`,description:`Search projects, tasks, views, actions, and skills`,showCloseButton:!1,filter:_P,value:n,onValueChange:r,className:`${s?o?.kind===`tell`?`top-[2vh]`:`top-auto bottom-[2vh]`:`top-[10vh]`} translate-y-0 sm:max-w-2xl lg:max-w-3xl xl:max-w-4xl`,overlayClassName:s?`bg-transparent`:void 0,contentProps:s?{"data-voice-proposal":`true`}:void 0,children:(0,Q.jsx)(MP,{open:e,docked:s,selected:n,close:()=>t(!1)})})}function jP({task:e,projectName:t,showProject:n,now:r,onSelect:i}){let a=R(e),o=ma(e);return(0,Q.jsxs)(Ap,{...yP(e,t),"data-slot":`palette-task`,"data-run-id":e.id,"data-project-id":e.projectId??void 0,onSelect:()=>i(e),children:[(0,Q.jsx)(eo,{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:Va(e.finishedAt??e.createdAt,r)})]})}function MP({open:e,docked:t,selected:n,close:r}){let i=Za(),a=ce(),[o,s]=Z.useState(``),c=o.trim()!==``,l=Wa(),{theme:u,setTheme:d}=tb(),f=Yr(),p=qr(),m=aa(),h=Rr(),g=kr(),_=Date.now(),v=lP({enabled:g.data?.capabilities.voice===!0,text:o,selected:n,close:r,clearText:()=>s(``)}),{onClose:y}=v;Z.useEffect(()=>{e||y()},[e,y]);let b=m.data,x=b!==void 0&&b.projects.length>1,S=Fi(x),{order:C}=BC(),w=Z.useMemo(()=>x?kP(b.projects,l,C):[],[x,b,l,C]),T=Z.useMemo(()=>new Map((b?.projects??[]).map(e=>[e.id,e.name])),[b]),E=l??b?.bootProject??null,[D,O]=Z.useState(``);Z.useEffect(()=>{let e=setTimeout(()=>O(o),wP);return()=>clearTimeout(e)},[o]);let k=xr(D),A=c?k.data?.runs:void 0,j=c&&!k.isPlaceholderData?(k.data?.truncated??[]).map(e=>T.get(e)??e):[],M=Z.useMemo(()=>TP(f.data??[],E,S.data?.runs,A),[f.data,E,S.data,A]),N=Z.useMemo(()=>OP(M),[M]),P=c?[]:N.recentlyFinished,F=c?M:N.otherTasks,I=x,ee=e=>e.projectId===null?null:T.get(e.projectId)??null,L=h.data?.skillUsage,R=Z.useMemo(()=>sm(p.data??[],L),[p.data,L]),te=e=>{r(),i(e)},ne=e=>{r(),a(e)},z=LM(),re=e=>{r(),z.go(e)},B=e=>{r(),i(e.projectId===null?`/tasks/${e.id}`:to(e.projectId,`/tasks/${e.id}`))},ie=qM[u],ae=[...x?[{label:`All tasks`,to:`/tasks`,icon:er,global:!0}]:[],...zM({forge:g.data?.forge?.available===!0,automations:g.data?.capabilities.automations===!0}).map(e=>({label:e.label,to:e.to,icon:e.icon,global:!1}))],oe=[{rows:ae.map(e=>bP(e.label)),node:(0,Q.jsx)(Op,{heading:`Views`,children:ae.map(e=>{let t=e.icon;return(0,Q.jsxs)(Ap,{...bP(e.label),"data-slot":`palette-view`,"data-nav-to":e.to,onSelect:()=>e.global?ne(e.to):te(e.to),children:[(0,Q.jsx)(t,{"aria-hidden":`true`}),e.label]},e.to)})},`views`)}];return w.length>0&&oe.push({rows:w.map(xP),node:(0,Q.jsx)(Op,{heading:`Projects`,children:w.map(e=>{let t=e.id===l,n=e.status===`missing`;return(0,Q.jsxs)(Ap,{...xP(e),"data-slot":`palette-project`,"data-project-id":e.id,disabled:n,onSelect:()=>re(e.id),children:[(0,Q.jsx)(Et,{"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)(ze,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e.id)})},`projects`)}),F.length>0&&oe.push({rows:c?F.map(e=>yP(e,ee(e))):[],node:(0,Q.jsx)(Op,{heading:`Tasks`,children:F.map(e=>(0,Q.jsx)(jP,{task:e,projectName:ee(e),showProject:I,now:_,onSelect:B},DP(e)))},`tasks`)}),oe.push({rows:[CP],node:(0,Q.jsx)(Op,{heading:`Actions`,children:(0,Q.jsxs)(Ap,{...CP,"data-slot":`palette-action`,"data-action":`toggle-theme`,onSelect:()=>{d(ie),r()},children:[(0,Q.jsx)(vn,{"aria-hidden":`true`}),`Toggle theme`,(0,Q.jsxs)(jp,{className:`tracking-normal`,children:[u,` → `,ie]})]})},`actions`)}),R.length>0&&oe.push({rows:R.map(SP),node:(0,Q.jsx)(Op,{heading:`Skills`,children:R.map(e=>(0,Q.jsxs)(Ap,{...SP(e),"data-slot":`palette-skill`,"data-skill":e.name,onSelect:()=>te(`/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))},`skills`)}),(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Tp,{placeholder:v.confirm?fP:`Search projects, tasks, views, actions, skills…`,value:o,onValueChange:s,onKeyDown:e=>{e.key===`Enter`&&!e.nativeEvent.isComposing&&v.onEnter(e)}}),(0,Q.jsx)(Ep,{className:t?`max-h-[28vh]`:`max-h-[55vh] min-h-[14rem] sm:max-h-[60vh] lg:max-h-[68vh]`,children:v.confirm?(0,Q.jsx)(pP,{confirm:v.confirm,notice:v.row?.kind===`notice`?v.row.text:void 0,onConfirm:v.onConfirm}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(dP,{row:v.row,committable:o.trim()!==``,onSelect:v.onSelect}),v.row?null:(0,Q.jsx)(Dp,{children:`Nothing matches.`}),(0,Q.jsx)(Op,{children:(0,Q.jsxs)(Ap,{value:`new task`,"data-slot":`palette-view`,"data-nav-to":`/new`,onSelect:()=>te(`/new`),children:[(0,Q.jsx)(Lt,{"aria-hidden":`true`}),`New task`,(0,Q.jsx)(jp,{children:`C`})]})}),!c&&P.length>0?(0,Q.jsx)(Op,{heading:`Recently finished`,children:P.map(e=>(0,Q.jsx)(jP,{task:e,projectName:ee(e),showProject:I,now:_,onSelect:B},DP(e)))}):null,vP(oe,o).map(e=>e.node)]})}),j.length>0?(0,Q.jsxs)(`p`,{"data-slot":`palette-search-truncated`,role:`status`,className:`border-t border-border px-3 py-2 text-[11px] text-soft-foreground`,children:[`More matches in `,j.join(`, `),`. Type more to narrow them.`]}):null]})}function NP({triggerClassName:e,icon:t=Ze,iconClassName:n=`size-4`,side:r,origin:i,label:a,iconFrameClassName:o}={}){let[c,l]=Z.useState(!1),[u,d]=Z.useState(!1),[p,m]=Z.useState(!1);return(0,Q.jsxs)(Kn,{children:[(0,Q.jsx)(Mn,{asChild:!0,children:(0,Q.jsxs)(A,{variant:`ghost`,"aria-label":`Add project`,title:`Add project`,"data-origin":i,className:s(`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)(Rn,{align:`start`,...f({side:r}),className:`w-56`,children:[(0,Q.jsx)(Nt,{className:`text-xs text-soft-foreground`,children:`Add project`}),(0,Q.jsxs)(cn,{"data-slot":`add-project-new`,onSelect:()=>m(!0),children:[(0,Q.jsx)(Ze,{"aria-hidden":`true`}),`New project…`]}),(0,Q.jsxs)(cn,{"data-slot":`add-project-local`,onSelect:()=>l(!0),children:[(0,Q.jsx)(xt,{"aria-hidden":`true`}),`Open local folder…`]}),(0,Q.jsxs)(cn,{"data-slot":`add-project-clone`,onSelect:()=>d(!0),children:[(0,Q.jsx)(Gn,{"aria-hidden":`true`}),`Clone from GitHub…`]})]}),c?(0,Q.jsx)(ow,{open:!0,onOpenChange:l}):null,u?(0,Q.jsx)(Fj,{open:!0,onOpenChange:d}):null,p?(0,Q.jsx)(Bj,{open:!0,onOpenChange:m}):null]})}function PP(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 FP({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&&PP(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)(Ko,{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)(nD,{children:(0,Q.jsxs)(rD,{children:[(0,Q.jsx)(iD,{asChild:!0,children:v===`update`?(0,Q.jsx)(A,{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)(ge,{"aria-hidden":`true`,className:`size-[18px]`})}):(0,Q.jsx)(A,{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)(dr,{"aria-hidden":`true`,className:`size-[18px]`})})}),(0,Q.jsx)(aD,{side:`bottom`,children:b})]})}):null}),(0,Q.jsxs)(Ro,{onCloseAutoFocus:e=>{e.preventDefault(),u.current?.focus()},children:[(0,Q.jsxs)(Go,{children:[(0,Q.jsx)(No,{children:`Restart Cezarion?`}),(0,Q.jsx)(Mo,{children:`Running tasks will be recovered after restart. The cockpit will reconnect when the new version is ready.`})]}),(0,Q.jsxs)(Ho,{children:[(0,Q.jsx)(Wo,{children:`Restart Later`}),(0,Q.jsx)(Vo,{onClick:()=>{!g||y||s||d.current||(d.current=!0,l(!1),i?.().finally(()=>{d.current=!1}))},children:`Restart Now`})]})]})]}):null}function IP({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&&PP(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 LP={amber:`text-signal-word-amber`,red:`text-signal-word-red`,violet:`text-status-running`,green:`text-success`};function RP({signal:e,known:t,current:n,maxParts:r,slot:i,className:a}){let o=aT(e).slice(0,r);return(0,Q.jsx)(`span`,{"data-slot":i,className:s(`flex min-w-0 items-center font-medium`,n?`text-muted-foreground`:`text-soft-foreground`,a),children:t?o.length===0?`idle`:o.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:LP[e.tone],children:e.text})]},e.tone)):`activity unknown`})}var zP={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 BP(e,t,n){return e>9&&!(n&&t>1)?22:t===1?18:14}function VP({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:s(`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:BP(t,i.length,r)},className:s(`flex items-center justify-center text-[10px] leading-[13px] font-bold tabular-nums`,zP[e]),children:t>9?`9+`:t},e))})}function HP(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 UP({...e}){return(0,Q.jsx)(zo,{"data-slot":`sheet`,...e})}function WP({...e}){return(0,Q.jsx)(Io,{"data-slot":`sheet-trigger`,...e})}function GP({...e}){return(0,Q.jsx)(qo,{"data-slot":`sheet-close`,...e})}function KP({...e}){return(0,Q.jsx)(Bo,{"data-slot":`sheet-portal`,...e})}function qP({className:e,...t}){return(0,Q.jsx)(Uo,{"data-slot":`sheet-overlay`,className:s(`fixed inset-0 z-50 bg-black/50 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function JP({className:e,children:t,side:n=`right`,showCloseButton:r=!0,overlayClassName:i,...a}){return(0,Q.jsxs)(KP,{children:[(0,Q.jsx)(qP,{className:i}),(0,Q.jsxs)(Po,{"data-slot":`sheet-content`,className:s(`fixed z-50 flex flex-col gap-4 bg-background shadow-modal transition-colors ease-in-out motion-safe:data-[state=closed]:animate-out data-[state=closed]:duration-300 motion-safe:data-[state=open]:animate-in data-[state=open]:duration-500`,n===`right`&&`inset-y-0 end-0 h-full w-3/4 border-s motion-safe:data-[state=closed]:slide-out-to-right motion-safe:data-[state=open]:slide-in-from-right sm:max-w-sm`,n===`left`&&`inset-y-0 start-0 h-full w-3/4 border-e motion-safe:data-[state=closed]:slide-out-to-left motion-safe:data-[state=open]:slide-in-from-left sm:max-w-sm`,n===`top`&&`inset-x-0 inset-bs-0 h-auto border-be motion-safe:data-[state=closed]:slide-out-to-top motion-safe:data-[state=open]:slide-in-from-top`,n===`bottom`&&`inset-x-0 inset-be-0 h-auto border-bs motion-safe:data-[state=closed]:slide-out-to-bottom motion-safe:data-[state=open]:slide-in-from-bottom`,e),...a,children:[t,r&&(0,Q.jsxs)(qo,{className:`absolute inset-bs-4 end-4 rounded-sm opacity-70 ring-offset-background transition-opacity pointer-hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-secondary`,children:[(0,Q.jsx)(tt,{className:`size-4`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function YP({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`sheet-header`,className:s(`flex flex-col gap-1.5 p-4`,e),...t})}function XP({className:e,...t}){return(0,Q.jsx)(Lo,{"data-slot":`sheet-title`,className:s(`font-semibold text-foreground`,e),...t})}function ZP({className:e,...t}){return(0,Q.jsx)(Fo,{"data-slot":`sheet-description`,className:s(`text-sm text-muted-foreground`,e),...t})}function QP(e,t){if(!e?.signals)return null;let n=e.signals;return oT(e.projects.filter(e=>e.id!==t).map(e=>n.get(e.id)))}function $P(e){let t=aT(e??void 0).map(e=>e.text);return t.length>0?`Open projects. Elsewhere: ${t.join(`, `)}`:`Open projects`}function eF({elsewhere:e}){if(!e)return null;let{top:t,bottom:n}=HP(e),r=`right-[2px] border-card`;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(VP,{position:`top`,segments:t,compact:!0,className:s(r,`top-[3px]`)}),(0,Q.jsx)(VP,{position:`bottom`,segments:n,compact:!0,className:s(r,`top-[24px]`)})]})}function tF({version:e}){let{resolvedTheme:t}=tb();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)(GP,{asChild:!0,children:(0,Q.jsx)(A,{variant:`ghost`,size:`icon`,"aria-label":`Close menu`,className:`mt-[14px] ml-auto size-[44px] text-foreground`,children:(0,Q.jsx)(tt,{className:`size-[19px]`,"aria-hidden":`true`})})})]})}function nF({version:e,latestVersion:t,...n}){let r=n.state?.status===`ready`||n.state?.status===`preparing`||n.state?.status===`restarting`;if(!(e&&t&&PP(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)(eo,{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)(FP,{version:e,latestVersion:t,...n})]}),(0,Q.jsx)(IP,{version:e,latestVersion:t,state:n.state,error:n.error,offline:n.offline,busy:n.busy})]})}function rF({project:e,signal:t,known:n,current:r,onNavigate:i}){let{top:a,bottom:o}=HP(t),c=r?`border-sidebar-row-selected`:`border-sidebar`,l=`right-[-4px]`,u=(0,Q.jsxs)(Qt,{to:to(e.id,`/`),onClick:i,"data-slot":`drawer-project`,"data-project-id":e.id,"aria-current":r?`page`:void 0,className:s(`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`,r&&`flex-1 hover:bg-sidebar-row-selected`),children:[(0,Q.jsxs)(`span`,{"aria-hidden":`true`,className:s(`relative flex size-[40px] shrink-0 items-center justify-center rounded-[10px] border text-[13px] leading-none font-semibold`,r?`border-soft-foreground bg-sidebar text-foreground`:`border-transparent bg-muted text-muted-foreground`),children:[sT(e.name),(0,Q.jsx)(VP,{position:`top`,segments:a,className:s(l,c)}),(0,Q.jsx)(VP,{position:`bottom`,segments:o,className:s(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)(RP,{signal:t,known:n,current:r,slot:`drawer-project-state`,className:`flex-wrap gap-x-[6px] text-[11.5px] leading-tight`})]}),r?(0,Q.jsx)(ze,{"aria-hidden":`true`,className:`size-[16px] shrink-0 text-foreground`}):null]});return r?(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)(fT,{projectId:e.id,onNavigate:i,triggerClassName:`size-[44px]`,align:`end`})]}):u}var iF=`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 aF({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)(rF,{project:r,signal:e.signals?.get(r.id),known:e.signals!==null,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)(Qt,{to:`/tasks`,onClick:n,"data-slot":`drawer-all-projects`,className:iF,children:[(0,Q.jsx)(er,{"aria-hidden":`true`}),`All projects · task overview`]}),(0,Q.jsx)(NP,{origin:`mobile`,icon:Ze,iconClassName:`size-[18px]`,label:`Add project`,triggerClassName:s(iF,`h-[48px] justify-start p-0 px-[10px] text-foreground`)})]})]})}function oF({onNavigate:e,tools:t}){let{theme:n,setTheme:r}=tb(),i=qM[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)(Qt,{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:s(iF,t.note&&`h-auto min-h-[48px] py-[6px]`),children:[(0,Q.jsxs)(`span`,{className:`relative flex shrink-0`,children:[(0,Q.jsx)(Ne,{"aria-hidden":`true`}),t.blocked?(0,Q.jsx)(eo,{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)(Qt,{to:`/settings/global/appearance`,onClick:e,"data-slot":`drawer-global-settings`,className:iF,children:[(0,Q.jsx)(oe,{"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:iF,children:[(0,Q.jsx)(vn,{"aria-hidden":`true`}),`Theme · `,a]})]})}var sF=Z.createContext(null);function cF(){return Z.useContext(sF)}function lF({slot:e,children:t}){return(0,jl.createPortal)(t,e)}var uF=`(min-width: 768px)`;function dF(){let[e,t]=Z.useState(()=>window.matchMedia?.(uF).matches??!0);return Z.useEffect(()=>{let e=window.matchMedia?.(uF);if(!e)return;let n=()=>t(e.matches);return n(),e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}var fF=5;function pF({items:e,activeTo:t,needsYou:n=!1,onNavigate:r}){let[i,a]=(0,Z.useState)(!1),o=(0,Z.useRef)(null),c=e.filter(e=>e.to===`/automations`),l=c.length>0&&e.length-c.length>fF?e.filter(e=>e.to===`/workflows`||c.includes(e)):c,u=e.filter(e=>!l.includes(e)),d=l.some(e=>e.to===t);return(0,Q.jsx)(nD,{children:(0,Q.jsxs)(`nav`,{ref:o,"aria-label":`Main`,"data-slot":`view-tabs`,onKeyDown:e=>{if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key))return;let t=Array.from(o.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:[u.map(e=>{let i=e.to===t,a=e.icon,o=e.to===`/`&&n&&!i;return(0,Q.jsxs)(rD,{children:[(0,Q.jsx)(iD,{asChild:!0,children:(0,Q.jsxs)(X,{to:e.to,onClick:r,"data-view-tab":!0,"aria-label":e.label,"aria-current":i?`page`:void 0,className:s(`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`,i?`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)(a,{className:`size-[15px] shrink-0`,"aria-hidden":`true`}),o?(0,Q.jsx)(`span`,{"aria-label":`Tasks need you`,"data-slot":`nav-needs-you-dot`,className:`absolute -top-1 -right-1 size-[7px] rounded-full border-[1.5px] border-sidebar bg-pending-strong`}):null]}),i?(0,Q.jsx)(`span`,{className:`truncate`,children:e.label}):null]})}),(0,Q.jsx)(aD,{side:`bottom`,sideOffset:6,style:{pointerEvents:`none`},children:e.label})]},e.to)}),l.length?(0,Q.jsxs)(Kn,{open:i,onOpenChange:a,children:[(0,Q.jsxs)(rD,{children:[(0,Q.jsx)(iD,{asChild:!0,children:(0,Q.jsx)(Mn,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,"data-view-tab":!0,"aria-label":`More views`,"data-active":d?`true`:void 0,className:s(`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`,(i||d)&&`bg-sidebar-row-selected text-foreground`),children:(0,Q.jsx)(uc,{className:`size-[15px]`,"aria-hidden":`true`})})})}),(0,Q.jsx)(aD,{side:`bottom`,sideOffset:6,style:{pointerEvents:`none`},children:`More views`})]}),(0,Q.jsx)(Rn,{align:`end`,sideOffset:4,className:`w-48 rounded-[10px] border-border bg-sidebar p-[5px] shadow-[0_10px_28px_#00000047]`,children:l.map(e=>{let n=e.icon,i=e.to===t;return(0,Q.jsx)(cn,{asChild:!0,className:s(`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:r,"aria-current":i?`page`:void 0,children:[(0,Q.jsx)(n,{className:`size-[15px] text-soft-foreground`}),e.label]})},e.to)})})]}):null]})})}function mF(e,t,n){let r=Ua(e),i=r===`/new`,a=UM(e);return{activeTo:i?`/new`:VM(r),current:HM(r),currentProjectId:Ja(e),newTask:i,pushed:a,showTabBar:!a&&!WM(e,t)&&!n,gitRepositoryView:r===`/git`&&new URLSearchParams(t).get(`view`)===`repo`}}var hF=[{to:`/skills`,label:`Skills`},{to:`/workflows`,label:`Workflows`},{to:`/settings`,label:`Project settings`}],gF=[`/automations`],_F=`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 vF({open:e,onOpenChange:t,onCloseAutoFocus:n,projectName:r,items:i,activeTo:a}){let o=new Map(i.map(e=>[e.to,e])),c=hF.flatMap(({to:e,label:t})=>{let n=o.get(e);return n?[{to:e,label:t,icon:n.icon}]:[]}),l=gF.flatMap(e=>{let t=o.get(e);return t?[{to:e,label:t.label,icon:t.icon}]:[]}),u=()=>t(!1),d=({to:e,label:t,icon:n})=>{let r=e===a;return(0,Q.jsxs)(X,{to:e,onClick:u,"data-slot":`more-row`,"data-more-row":e,"aria-current":r?`page`:void 0,className:s(_F,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}),(0,Q.jsx)(me,{"aria-hidden":`true`,className:`!size-[15px]`})]},e)};return(0,Q.jsx)(UP,{open:e,onOpenChange:t,children:(0,Q.jsxs)(JP,{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)(XP,{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:c.map(d)}),l.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:l.map(d)})]}):null]})})}var yF=`(min-width: 768px)`;function bF({items:e,activeTo:t,signal:n,projectName:r,showNewTask:i=!0}){let[a,o]=Z.useState(!1),c=Z.useRef(null),{pathname:l}=de();Z.useEffect(()=>{o(!1)},[l]),Z.useEffect(()=>{let e=window.matchMedia?.(yF);if(!e)return;e.matches&&o(!1);let t=e=>{e.matches&&o(!1)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let u=e.filter(e=>GM.includes(e.to)),d=t!==null&&KM.includes(t),{top:f}=HP(n),p=f.some(e=>e.count>0),m=e=>s(`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:[i?(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)(Lt,{"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:[u.map(e=>{let n=e.to===t,r=e.icon,i=e.to===`/`&&p;return(0,Q.jsxs)(X,{to:e.to,"data-tab":e.to,"aria-current":n?`page`:void 0,className:m(n),children:[(0,Q.jsxs)(`span`,{className:`relative`,children:[(0,Q.jsx)(r,{"aria-hidden":`true`,className:`size-[21px]`}),i?(0,Q.jsx)(VP,{position:`top`,segments:f,className:`-top-[6px] -right-[10px] border-sidebar`}):null]}),e.label]},e.to)}),(0,Q.jsxs)(`button`,{ref:c,type:`button`,"data-tab":`more`,"aria-haspopup":`dialog`,"aria-expanded":a,"data-active":d?`true`:void 0,onClick:()=>o(!0),className:m(d),children:[(0,Q.jsx)(`span`,{className:`relative`,children:(0,Q.jsx)(ke,{"aria-hidden":`true`,className:`size-[21px]`})}),`More`]})]}),(0,Q.jsx)(vF,{open:a,onOpenChange:o,onCloseAutoFocus:e=>{c.current?.isConnected&&(e.preventDefault(),c.current.focus())},projectName:r,items:e,activeTo:t})]})}var xF=`cez-sidebar-width`;function SF(e){let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?Math.min(420,Math.max(264,Math.round(t))):264}function CF(){try{let e=localStorage.getItem(xF);return e===null?264:SF(e)}catch{return 264}}function wF(e){try{localStorage.setItem(xF,String(SF(e)))}catch{}}var TF=`(min-width: 768px)`,EF=Z.createContext(264),DF=Z.createContext(void 0);function OF(){return Z.useContext(DF)}function kF(e){return ie({path:`/tasks/:id`,end:!0},Ua(e))!==null}function AF(e){let t=Ua(e);return t===`/github`||t.startsWith(`/github/`)}function jF({children:e,breadcrumb:t,repo:n=null,version:r=null,latestVersion:i=null,applicationUpdate:a,onApplyUpdate:o,onRestart:c,applicationUpdateError:l,applicationUpdateBusy:u,applicationUpdateOffline:d,sidebarList:f,taskQuickList:p,sessionScope:m,toolsMenu:h,forgeAvailable:g=!0,automationsAvailable:_=!0,banner:v,mobileProjects:y,projectHeader:b,sidebarProjectId:x,needsYou:S,projectRail:C,toolsStatus:w}){let{pathname:T,search:E}=de(),{activeTo:D,current:O,currentProjectId:k,newTask:A,pushed:j,showTabBar:M,gitRepositoryView:N}=mF(T,E,bo()),[P,F]=Z.useState(!1),[I,ee]=Z.useState(null),L=Z.useRef(null),R=Z.useRef(null),te=Z.useRef(null),ne=kF(T);Z.useLayoutEffect(()=>{let e=te.current;if(te.current=T,ne||e!==null&&Ja(e)===Ja(T)&&AF(e)&&AF(T))return;let t=R.current;t&&(t.scrollTop=0)},[T,ne,N]);let z=He(),re=Z.useRef(T);Z.useEffect(()=>{let e=re.current;re.current=T,e!==T&&(z===`REPLACE`&&RF(e,T)||F(!1))},[T,z]),Z.useEffect(()=>{let e=window.matchMedia?.(TF);if(!e)return;e.matches&&F(!1);let t=e=>{e.matches&&F(!1)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let B=zM({forge:g,automations:_}),ie={version:r,latestVersion:i,state:a,onApplyUpdate:o,onRestart:c,error:l,busy:u,offline:d};return(0,Q.jsx)(UP,{open:P,onOpenChange:F,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)(PF,{projectRail:C,activeTo:D,items:B,repo:n,update:ie,sidebarList:f,taskQuickList:p,sessionScope:m,toolsMenu:h,projectHeader:b,sidebarProjectId:x,needsYou:S}),(0,Q.jsx)(LF,{update:ie,taskQuickList:p,sidebarProjectId:x,mobileProjects:y,currentProjectId:k,toolsStatus:w,onNavigate:()=>F(!1),onCloseAutoFocus:e=>{L.current?.isConnected&&(e.preventDefault(),L.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)(WF,{title:O?.label??`cezar`,pushed:j?{onSlot:ee}:null,repo:n,elsewhere:QP(y,k),onTrigger:e=>{L.current=e}}),(0,Q.jsx)(MF,{breadcrumb:t,repo:n,label:O?.label,newTask:A}),v?(0,Q.jsx)(`div`,{"data-slot":`banner-slot`,className:`row-start-2`,children:v}):null,(0,Q.jsx)(`main`,{ref:R,"data-slot":`main`,className:s(`row-start-3 min-h-0 overflow-y-auto overscroll-contain`,M&&!A&&`max-md:pb-20`),children:(0,Q.jsx)(sF.Provider,{value:j?I:null,children:e})}),(0,Q.jsx)(NF,{showTabBar:M,items:B,activeTo:D,mobileProjects:y,currentProjectId:k,repo:n,newTask:A})]})]})})}function MF({breadcrumb:e,repo:t,label:n,newTask:r}){let i=e?.project??t?.name,a=e?.branch??t?.branch;return(0,Q.jsxs)(`header`,{"data-slot":`desktop-breadcrumb`,className:s(`row-start-1 hidden min-w-0 items-center gap-3 border-b border-border text-[13px] text-muted-foreground md:flex`,r?`h-[72px] px-11`:`h-16 px-9`),children:[(0,Q.jsx)(xt,{"aria-hidden":`true`,className:`size-4 shrink-0`}),i?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`truncate font-medium text-foreground`,children:i}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:`/`})]}):null,(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:e?.page??n??`Cezarion`}),a?(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`}),a]}):null]})}function NF({showTabBar:e,items:t,activeTo:n,mobileProjects:r,currentProjectId:i,repo:a,newTask:o}){let c=i===null?void 0:r?.signals?.get(i);return(0,Q.jsx)(`div`,{"data-slot":`composer`,className:s(`row-start-4 pb-[max(env(safe-area-inset-bottom),var(--kb,0px))]`,e&&`relative max-md:border-t max-md:border-border max-md:bg-sidebar`),children:e?(0,Q.jsx)(`div`,{className:`md:hidden`,children:(0,Q.jsx)(bF,{items:t,activeTo:n,signal:c,projectName:r?.projects.find(e=>e.id===i)?.name??a?.name??null,showNewTask:!o})}):null})}function PF({projectRail:e,...t}){let[n,r]=Z.useState(CF),i=Z.useCallback(e=>{let t=SF(e);r(t),wF(t)},[]);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(EF.Provider,{value:n,children:e}),(0,Q.jsx)(FF,{...t,width:n,onWidthChange:i})]})}function FF({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)(BF,{...n}),(0,Q.jsx)(IF,{width:e,onWidthChange:t})]})}function IF({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(SF(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(SF(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 LF({onNavigate:e,onCloseAutoFocus:t,mobileProjects:n,currentProjectId:r,toolsStatus:i,update:a,taskQuickList:o,sidebarProjectId:s}){return(0,Q.jsxs)(JP,{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)(XP,{className:`sr-only`,children:`Navigation`}),(0,Q.jsx)(tF,{version:a.version}),(0,Q.jsx)(nF,{...a}),(0,Q.jsxs)(`div`,{"data-slot":`drawer-scroll`,className:`flex min-h-0 flex-1 flex-col overflow-y-auto overscroll-contain`,children:[n?(0,Q.jsx)(aF,{nav:n,currentProjectId:r,onNavigate:e}):null,o?(0,Q.jsx)(zF,{projectId:s,onNavigate:e,children:(0,Q.jsx)(`div`,{"data-slot":`drawer-tasks`,className:`border-t border-border px-[8px] py-[8px]`,children:o})}):null]}),(0,Q.jsx)(oF,{onNavigate:e,tools:i})]})}function RF(e,t){return Ja(e)==="default"&&Ja(t)!==null&&Ja(t)!=="default"&&Ua(e)===Ua(t)}function zF({projectId:e,onNavigate:t,children:n}){let r=be(),i=e===void 0?r:{projectId:e,apiBase:`${l}/p/${encodeURIComponent(e)}`};return(0,Q.jsx)(re.Provider,{value:i,children:(0,Q.jsx)(DF.Provider,{value:t,children:n})})}function BF({activeTo:e,items:t,repo:n,update:r,sidebarList:i,taskQuickList:a,sessionScope:o,toolsMenu:c,projectHeader:l,sidebarProjectId:u,needsYou:d,onNavigate:f}){return(0,Q.jsx)(zF,{projectId:u,onNavigate:f,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:l??(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)(HF,{}),(0,Q.jsx)(A,{asChild:!0,variant:`ghost`,className:s(`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:f,"data-sidebar-item":`new-task`,"aria-current":e===`/new`?`page`:void 0,children:[(0,Q.jsx)(Lt,{className:`size-[15px]`,"aria-hidden":`true`}),`New task`,(0,Q.jsx)(`kbd`,{"aria-hidden":`true`,className:`sr-only`,children:`C`})]})})]}),o?(0,Q.jsx)(`div`,{className:`shrink-0 px-3 pt-2`,children:o}):null,(0,Q.jsx)(pF,{items:t,activeTo:e,needsYou:d,onNavigate:f}),(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)(DF.Provider,{value:f,children:i??(0,Q.jsx)(`div`,{"data-slot":`task-quick-list`,children:a})})}),(0,Q.jsx)(VF,{toolsMenu:c,update:r})]})})}function VF({toolsMenu:e,update:t}){return(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:e}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,"data-slot":`version-action`,children:[t.version?(0,Q.jsx)(UF,{version:t.version,latestVersion:t.latestVersion}):null,(0,Q.jsx)(FP,{...t})]})]}),(0,Q.jsx)(IP,{...t})]})}function HF(){return(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`command-palette-hint`,title:`Search — command palette (⌘K / Ctrl+K)`,onClick:()=>hP(),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)(at,{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:em(`k`)})]})}function UF({version:e,latestVersion:t}){let n=!!(t&&PP(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)(eo,{tone:`pending`,className:`size-[5px] shrink-0`}):null,(0,Q.jsxs)(`span`,{className:`truncate`,children:[`v`,e]})]})}function WF({title:e,pushed:t,repo:n,elsewhere:r,onTrigger:i}){return t?(0,Q.jsx)(GF,{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)(WP,{asChild:!0,children:(0,Q.jsxs)(A,{variant:`ghost`,"aria-label":$P(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)(Xt,{className:`size-[20px]`,"aria-hidden":`true`}),(0,Q.jsx)(eF,{elsewhere:r})]})}),n?(0,Q.jsx)(WP,{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:sT(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)(Ke,{"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:s(`truncate text-[15px] font-semibold text-foreground`,n?`sr-only`:`min-w-0 flex-1 pl-[8px]`),children:e}),(0,Q.jsx)(A,{variant:`ghost`,"aria-label":`Search`,"data-slot":`mobile-search`,onClick:()=>hP(),className:`ml-auto size-[44px] shrink-0 p-0 text-foreground`,children:(0,Q.jsx)(at,{className:`size-[19px]`,"aria-hidden":`true`})})]})})}function GF({onSlot:e}){let t=Za();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)(A,{variant:`ghost`,"aria-label":`Back`,"data-slot":`mobile-back`,onClick:()=>{let e=window.history.state?.idx;t(typeof e==`number`&&e>0?-1:`/`)},className:`size-[44px] shrink-0 p-0 text-foreground`,children:(0,Q.jsx)(Xs,{className:`size-[22px]`,"aria-hidden":`true`})}),(0,Q.jsx)(`div`,{"data-slot":`mobile-run-bar`,ref:e,className:`flex min-w-0 flex-1 items-center gap-[4px]`})]})})}var KF=`cez:application-restart-from`,qF=24e4,JF=3e4,YF=`The response was lost; update status is unknown. Reconnect or check the current state before retrying.`;function XF(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 ZF(e,t=()=>window.location.reload()){let n=V(),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(KF)}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(KF)}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(G.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 ft&&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(YF):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(KF)}catch{}m(null)}(t.source===`timeout`||t.source===`failure`)&&n.invalidateQueries({queryKey:G.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||!XF(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(G.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`?qF:JF)};r.current=c,t(a.signal).then(e=>{if(r.current!==c)return;let t=n.getQueryData(G.health),a=i.current,o=t?.applicationUpdate!==u&&XF(c,t)?t.applicationUpdate:a?.applicationUpdate!==s&&XF(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`,bt)},[_]),restart:Z.useCallback(async()=>{if(r.current)return;let e=i.current?.version,t=await _(`restart`,Ft);if(e&&t?.status===`restarting`){try{window.sessionStorage.setItem(KF,e)}catch{}m(e)}},[_]),busy:a,error:s,offline:l}}var QF=[`claude`,`codex`,`opencode`,`pi`,`cursor`,`omp`],$F={claude:`Claude Code`,codex:`Codex`,opencode:`OpenCode`,pi:`pi`,cursor:`Cursor`,omp:`OMP`};function eI(e){if(typeof e!=`object`||!e||Array.isArray(e))return{};let t=e,n={};for(let e of QF){let r=t[e];typeof r==`string`&&r.length>0&&r.length<=128&&(n[e]=r)}return n}function tI(e,t){if(!e)return[];let n=new Map(e.providers.map(e=>[e.provider,e]));return QF.flatMap(e=>{let r=n.get(e);return r?.status!==`disconnected`||!r.authFailureId||t[e]===r.authFailureId?[]:[{provider:e,label:$F[e],authFailureId:r.authFailureId}]})}function nI(e,t){return{...e,...Object.fromEntries(t.map(({provider:e,authFailureId:t})=>[e,t]))}}function rI({status:e,pending:t,error:n,dismissals:r,onDismissAuthFailures:i}){if(t||!e)return null;let a;try{a=ln(e)}catch{return null}let o=tI(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)(eo,{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)(Kc,{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)(eo,{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 iI(e){if(!(typeof e!=`object`||!e||Array.isArray(e)))return e}function aI(){let e=Wi(),t=Fr(),n=V(),r=(0,Z.useRef)(Promise.resolve()),i=(0,Z.useRef)(0),a=(0,Z.useRef)(0),o=(0,Z.useRef)(iI(t.data));(0,Z.useEffect)(()=>{a.current===0&&(o.current=iI(t.data))},[t.data]);let s=(0,Z.useCallback)(e=>{let t=W.uiState,s=iI(n.getQueryData(t)),c=nI(eI(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 Tt({dismissedProviderAuthFailures:c});o.current=iI(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}),H(e instanceof Error?e.message:String(e),{tone:`danger`}))}finally{--a.current}})},[n]);return(0,Q.jsx)(rI,{status:e.data,pending:e.isPending,error:e.isError,dismissals:eI(iI(t.data)?.dismissedProviderAuthFailures),onDismissAuthFailures:s})}var oI=`cez-project-rail-expanded`;function sI(e,t){return e-232-t>=640}function cI(){try{return localStorage.getItem(oI)===`1`}catch{return!1}}function lI(e){try{localStorage.setItem(oI,e?`1`:`0`)}catch{}}function uI(e){if(e!==void 0)return e.isDragging?`relative z-10 opacity-40 [-webkit-touch-callout:none]`:`[-webkit-touch-callout:none]`}function dI({project:e,signal:t,known:n,current:r,target:i,onSwitchProject:a,onSelectProject:o,sort:c}){let l=iT(e.name,t,{unknown:!n});return(0,Q.jsxs)(`div`,{ref:c?.setNodeRef,style:c?.style,...c?.listeners,"data-slot":`rail-project`,"data-project-id":e.id,"data-dragging":c?.isDragging?``:void 0,className:s(`relative flex h-[52px] w-full shrink-0 items-center justify-center`,uI(c)),children:[r?(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)(Qt,{ref:c?.setActivatorNodeRef,"aria-describedby":c?.attributes[`aria-describedby`],to:i.href,onClick:t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||(o?.(e.id),i.verify&&a&&(t.preventDefault(),a(e.id)))},"aria-label":l,title:l,"aria-current":r?`page`:void 0,className:s(`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`,r?`border-soft-foreground bg-sidebar-row-selected text-foreground`:`border-transparent bg-muted text-muted-foreground hover:text-foreground`),children:sT(e.name)}),(0,Q.jsx)(VP,{position:`top`,segments:HP(t).top}),(0,Q.jsx)(VP,{position:`bottom`,segments:HP(t).bottom})]})]})}var fI=`motion-safe:rail-text-in`;function pI({project:e,signal:t,known:n,current:r,target:i,onSwitchProject:a,onSelectProject:o,sort:c}){let l=iT(e.name,t,{unknown:!n}),{top:u,bottom:d}=HP(t),f=r?`border-sidebar-row-selected`:`border-background group-hover:border-sidebar-row-hover`;return(0,Q.jsxs)(`div`,{ref:c?.setNodeRef,style:c?.style,...c?.listeners,"data-slot":`rail-project`,"data-project-id":e.id,"data-dragging":c?.isDragging?``:void 0,className:s(`group/row relative w-full shrink-0`,uI(c)),children:[(0,Q.jsxs)(Qt,{to:i.href,onClick:t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||(o?.(e.id),i.verify&&a&&(t.preventDefault(),a(e.id)))},"aria-label":l,"aria-current":r?`page`:void 0,className:s(`group flex h-[52px] w-full items-center gap-[10px] rounded-[8px] px-[6px] pr-6 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,r?`bg-sidebar-row-selected`:`hover:bg-sidebar-row-hover`),children:[(0,Q.jsxs)(`span`,{"aria-hidden":`true`,"data-slot":`rail-mark`,className:s(`relative flex size-9 shrink-0 items-center justify-center rounded-[9px] border text-[12px] leading-none font-semibold`,r?`border-soft-foreground bg-sidebar text-foreground`:`border-transparent bg-muted text-muted-foreground`),children:[sT(e.name),(0,Q.jsx)(VP,{position:`top`,segments:u,className:f}),(0,Q.jsx)(VP,{position:`bottom`,segments:d,className:f})]}),(0,Q.jsxs)(`span`,{className:s(`flex min-w-0 flex-1 flex-col gap-px`,fI),children:[(0,Q.jsx)(`span`,{"data-slot":`rail-project-name`,className:s(`truncate text-[13.5px] leading-[18px] font-semibold`,r?`text-foreground`:`text-muted-foreground`),children:e.name}),(0,Q.jsx)(RP,{signal:t,known:n,current:r,maxParts:2,slot:`rail-project-state`,className:`h-4 gap-x-[4px] overflow-hidden text-[11px] leading-4 whitespace-nowrap`})]})]}),c?(0,Q.jsx)(mI,{name:e.name,sort:c}):null]})}function mI({name:e,sort:t}){return(0,Q.jsx)(`button`,{type:`button`,ref:t.setActivatorNodeRef,"data-slot":`rail-project-grip`,...t.attributes,"aria-label":`Reorder ${e}, position ${t.position} of ${t.total}`,className:s(`absolute top-1/2 right-0.5 flex h-10 w-5 -translate-y-1/2 cursor-grab touch-none items-center justify-center rounded text-soft-foreground opacity-0 outline-none transition-opacity hover:text-foreground motion-reduce:transition-none`,`focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50`,`group-hover/row:opacity-100 group-focus-within/row:opacity-100 [@media(hover:none)]:opacity-100`),children:(0,Q.jsx)(xc,{"aria-hidden":`true`,className:`size-3.5`})})}function hI({expanded:e,position:t,total:n,sortable:r,...i}){let{attributes:a,listeners:o,setNodeRef:s,setActivatorNodeRef:c,transform:l,transition:u,isDragging:d}=OC({id:i.project.id,disabled:!r}),f=r?{setNodeRef:s,setActivatorNodeRef:c,style:{transform:Db.Translate.toString(l),transition:u},listeners:o,attributes:a,isDragging:d,position:t,total:n}:void 0;return e?(0,Q.jsx)(pI,{...i,sort:f}):(0,Q.jsx)(dI,{...i,sort:f})}var gI=({transform:e})=>({...e,x:0}),_I=class extends Gx{static activators=[{eventName:`onPointerDown`,handler:({nativeEvent:e},t)=>e.pointerType!==`touch`&&Gx.activators[0].handler({nativeEvent:e},t)}]},vI={delay:250,tolerance:5},yI={start:[$.Space],cancel:[$.Esc],end:[$.Space,$.Enter,$.Tab]},bI={droppable:{strategy:iS.Always}},xI={draggable:`To reorder projects, press Space to pick this project up. Use the up and down arrow keys to move it, Space to drop it, or Escape to cancel.`};function SI(e,t){let[n,r]=Z.useState(null),i=Z.useMemo(()=>{if(n===null||n.base!==e)return e;let t=new Map(e.map(e=>[e.id,e]));return n.ids.flatMap(e=>t.get(e)??[])},[n,e]),a=Z.useMemo(()=>i.map(e=>e.id),[i]),o=Ub(Hb(_I,{activationConstraint:{distance:6}}),Hb(Xx,{activationConstraint:vI}),Hb(Bx,{coordinateGetter:MC,keyboardCodes:yI})),s=Z.useRef(null),c=Z.useCallback(()=>{s.current?.();let e=e=>e.preventDefault();window.addEventListener(`click`,e,!0),s.current=()=>{window.removeEventListener(`click`,e,!0),s.current=null}},[]),l=Z.useCallback(()=>{let e=s.current;window.setTimeout(()=>e?.(),0)},[]);Z.useEffect(()=>()=>s.current?.(),[]);let u=Z.useCallback(n=>{l();let{active:i,over:o}=n;if(!t||o===null||o.id===i.id)return;let s=RC(a,a.indexOf(String(i.id)),a.indexOf(String(o.id)));s.some((e,t)=>e!==a[t])&&(r({base:e,ids:s}),t(s))},[l,e,a,t]);return{projects:i,ids:a,sensors:o,announcements:Z.useMemo(()=>{let e=e=>{let t=a.indexOf(String(e));return{name:i[t]?.name??String(e),position:`position ${t+1} of ${a.length}`}};return{onDragStart:({active:t})=>`Picked up ${e(t.id).name}, ${e(t.id).position}.`,onDragOver:({active:t,over:n})=>n?`${e(t.id).name} moved to ${e(n.id).position}.`:`${e(t.id).name} is not over a drop position.`,onDragEnd:({active:t,over:n})=>n?`${e(t.id).name} dropped at ${e(n.id).position}.`:`${e(t.id).name} dropped. The order is unchanged.`,onDragCancel:({active:t})=>`Reordering cancelled. ${e(t.id).name} returned to ${e(t.id).position}.`}},[a,i]),onDragStart:c,onDragEnd:u,onDragCancel:l}}function CI(e){return s(`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 wI=s(`truncate text-muted-foreground group-hover:text-foreground`,fI);function TI({to:e,label:t,slot:n,active:r,expanded:i,children:a}){return(0,Q.jsxs)(Qt,{to:e,"data-slot":n,"aria-label":t,title:i?void 0:t,"aria-current":r?`page`:void 0,className:s(`group`,CI(i),r&&`bg-sidebar-row-selected text-foreground hover:bg-sidebar-row-selected`),children:[a,i?(0,Q.jsx)(`span`,{className:wI,children:t}):null]})}function EI(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)},[]),sI(t,e)}function DI(){let e=EI(Z.useContext(EF));return(0,Q.jsx)(`div`,{"aria-hidden":`true`,"data-slot":`project-rail-placeholder`,style:{width:cI()&&e?232:60},className:`hidden shrink-0 border-r border-border bg-background md:block`})}var OI=e=>({href:String(to(e,`/`)),verify:!1});function kI({projects:e,signals:t,version:n,singleProject:r,projectTarget:i=OI,onSwitchProject:a,onSelectProject:o,canReorder:c=!1,onReorder:l}){let{pathname:u}=de(),{resolvedTheme:d}=tb(),f=Z.useContext(EF),[p,m]=Z.useState(cI),h=EI(f),g=p&&h,_=()=>{let e=!g;m(e),lI(e)},v=Ja(u),y=u===`/tasks`,b=u===`/settings/global`||u.startsWith(`/settings/global/`),x=n?`Cezarion v${n}`:`Cezarion`,S=Z.useId(),C=SI(e,l),w=c&&l!==void 0&&e.length>1;return(0,Q.jsxs)(`nav`,{id:S,"aria-label":`Projects`,"data-slot":`project-rail`,"data-expanded":g?`true`:`false`,style:{width:g?232:60},className:s(`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`,g?`items-stretch px-2.5`:`items-center`),children:[g?(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-${d}.svg`,alt:``,"aria-hidden":`true`,"data-slot":`rail-app-mark`,className:`size-[34px] shrink-0 rounded-[8px]`}),(0,Q.jsxs)(`span`,{className:s(`flex min-w-0 items-baseline gap-[10px] whitespace-nowrap`,fI),"aria-label":x,children:[(0,Q.jsx)(`span`,{className:`text-[15px] leading-none font-bold text-foreground`,children:`Cezarion`}),n?(0,Q.jsxs)(`span`,{"data-slot":`rail-version`,title:`v${n}`,className:`min-w-0 truncate text-[11px] leading-none text-soft-foreground`,children:[`v`,n]}):null]})]}),(0,Q.jsx)(`div`,{"aria-hidden":`true`,className:`h-px w-full bg-border`}),(0,Q.jsx)(`div`,{className:s(`px-1 pt-2.5 pb-1 text-[11px] font-medium text-soft-foreground`,fI),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-${d}.svg`,alt:x,title:x,"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:s(`flex min-h-0 w-full flex-1 flex-col gap-0.5 overflow-y-auto overscroll-contain [scrollbar-width:none]`,g?`items-stretch`:`items-center`),children:[(0,Q.jsx)(HS,{sensors:C.sensors,collisionDetection:Qb,measuring:bI,modifiers:[gI],accessibility:{announcements:C.announcements,screenReaderInstructions:xI},onDragStart:C.onDragStart,onDragEnd:C.onDragEnd,onDragCancel:C.onDragCancel,children:(0,Q.jsx)(bC,{items:C.ids,strategy:gC,disabled:!w,children:C.projects.map((e,n)=>(0,Q.jsx)(hI,{expanded:g,sortable:w,position:n+1,total:C.projects.length,project:e,signal:t?.get(e.id),known:t!==null,current:e.id===v,target:i(e.id),onSwitchProject:a,onSelectProject:o},e.id))})}),r?null:g?(0,Q.jsx)(NP,{origin:`rail`,icon:Lt,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:s(`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)(NP,{origin:`rail`,icon:Lt,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:s(`flex shrink-0 flex-col gap-0.5 pt-2`,g?`items-stretch`:`items-center`),children:[h?(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`rail-expand-toggle`,"aria-expanded":g,"aria-controls":S,"aria-label":g?`Collapse projects`:`Expand projects`,title:g?void 0:`Expand projects`,onClick:_,className:s(`group`,CI(g)),children:[g?(0,Q.jsx)(Mc,{className:`size-4 shrink-0`,"aria-hidden":`true`}):(0,Q.jsx)(Nc,{className:`size-4 shrink-0`,"aria-hidden":`true`}),g?(0,Q.jsx)(`span`,{className:wI,children:`Collapse`}):null]}):null,r?null:(0,Q.jsx)(TI,{to:`/tasks`,label:`All projects`,slot:`rail-all-projects`,active:y,expanded:g,children:(0,Q.jsx)(er,{className:`size-4 shrink-0`,"aria-hidden":`true`})}),(0,Q.jsx)(TI,{to:`/settings/global/appearance`,label:`Global settings`,slot:`rail-global-settings`,active:b,expanded:g,children:(0,Q.jsx)(oe,{className:`size-4 shrink-0`,"aria-hidden":`true`})}),(0,Q.jsx)(YM,{showLabel:g,labelClassName:wI,className:s(`group`,CI(g),`[&_svg]:size-4`)})]})]})}function AI(){let e=V(),t=aa().data?.projects,{order:n,canReorder:r,setOrder:i}=BC(),a=r&&t!==void 0&&FC(t.length),o=Z.useMemo(()=>t?LC(t,n):void 0,[t,n]),s=Fi().data,c=kr().data?.capabilities.singleProject===!0,l=Z.useMemo(()=>s?rT(s.runs):null,[s]),u=t?.map(e=>e.id).sort().join(`
34
+ `),d=Z.useRef(void 0);return Z.useEffect(()=>{u!==void 0&&(d.current!==void 0&&d.current!==u&&e.invalidateQueries({queryKey:W.runsIndex}),d.current=u)},[e,u]),Z.useMemo(()=>o?{projects:o,signals:l,singleProject:c,canReorder:a,onReorder:i}:null,[o,l,c,a,i])}var jI=60;function MI(e){return`title`in e?`Archived "${e.title.length>jI?`${e.title.slice(0,jI-1)}…`:e.title}"`:`Archived ${e.count} ${e.count===1?`task`:`tasks`}`}async function NI(e,t,n){let r=new Set(n),i=(await Promise.allSettled(t.map(async t=>{await(e===void 0?Oe(t,!1):Ln(e,t,!1)),r.has(t)&&await(e===void 0?gt(t,!0):z(e,t,!0))}))).find(e=>e.status===`rejected`);i&&H(i.reason instanceof Error?i.reason.message:`Could not undo the archive.`,{tone:`danger`})}function PI(){let e=document.activeElement;return!e||e===document.body||!e.isConnected}function FI(e,t){if(!e.isConnected)return t();let n=new MutationObserver(()=>{e.isConnected||(n.disconnect(),clearTimeout(r),t())}),r=setTimeout(()=>n.disconnect(),5e3);n.observe(document.body,{childList:!0,subtree:!0})}function II(e,t){if(!PI())return;let n=e?.isConnected?e:t?.isConnected?t:null;n instanceof HTMLElement&&(n.tabIndex<0&&!n.hasAttribute(`tabindex`)&&(n.tabIndex=-1),n.focus({preventScroll:!0}))}function LI(e,t,n){if(!e)return()=>{};let r=t(e);return()=>FI(e,()=>II(r,n))}function RI(e){let t=document.activeElement?.closest(`[data-slot="task-row"]`);return t?.getAttribute(`data-run-id`)===e?t:Array.from(document.querySelectorAll(`[data-slot="task-row"]`)).find(t=>t.getAttribute(`data-run-id`)===e)??null}var zI=e=>e?.querySelector(`a`)??null;function BI(e,t,n){let r=V(),[i,a]=Z.useState(null),o=e=>r.invalidateQueries({queryKey:[e,`runs`]}),s=(t,n,r,i)=>H(t,{action:{label:`Undo`,onAction:()=>void NI(e,r,i).finally(()=>void o(n))}}),l=Z.useRef(new Map);return{archiveOne:r=>{let i=l.current.get(r.id);if(i)return i;let a=t??c(),u=!!r.pinned,d=RI(r.id),f=LI(d,e=>{let t=Array.from(e.closest(`[data-slot="quick-list-bucket"]`)?.querySelectorAll(`[data-slot="task-row"]`)??[]),n=t.indexOf(e);return zI(t[n+1]??t[n-1])},d?.closest(`[data-slot="quick-list-bucket"]`)?.parentElement??null),p=(e===void 0?Oe(r.id,!0):Ln(e,r.id,!0)).then(()=>(o(a),s(MI({title:ma(r)}),a,[r.id],u?[r.id]:[]),f(),n?.(),!0),e=>(H(e.message,{tone:`danger`}),!1)).finally(()=>l.current.delete(r.id));return l.current.set(r.id,p),p},sweep:(r,i)=>{let l=t??c();a(r);let u=document.activeElement,d=u?.matches(`[data-action="archive-group"]`)?u:null,f=LI(d,e=>zI(e.closest(`[data-slot="quick-list-bucket"]`)?.nextElementSibling?.querySelector(`[data-slot="task-row"]`)??void 0),d?.closest(`[data-slot="quick-list-bucket"]`)?.parentElement??null);(e===void 0?_e(r,i):je(e,r,i)).then(({ids:e,pinnedIds:t})=>{o(l),e.length>0&&s(MI({count:e.length}),l,e,t),f(),e.length>0&&n?.()},e=>H(e.message,{tone:`danger`})).finally(()=>a(null))},sweeping:i}}var VI=.6,HI=300,UI=100,WI={offset:0,phase:`idle`,past:!1},GI=null;function KI(e,t){GI&&GI.id!==e&&GI.close(),GI={id:e,close:t}}function qI(e){GI?.id===e&&(GI=null)}function JI(){if(!(typeof navigator>`u`||typeof navigator.vibrate!=`function`))try{navigator.vibrate(10)}catch{}}function YI({id:e,enabled:t,onArchive:n}){let[r,i]=Z.useState(WI),a=Z.useRef(null),o=Z.useRef(null),s=Z.useRef(!1),c=Z.useRef(!1),l=Z.useRef(void 0),u=()=>{c.current=!0,clearTimeout(l.current),l.current=void 0},d=()=>{c.current&&(clearTimeout(l.current),l.current=setTimeout(()=>{c.current=!1},HI))};Z.useEffect(()=>()=>clearTimeout(l.current),[]);let f=Z.useRef(r);f.current=r;let p=Z.useRef(n);p.current=n;let m=Z.useCallback(()=>{o.current=null,s.current=!1,qI(e),i(WI)},[e]);Z.useEffect(()=>{!t&&f.current.phase!==`committing`&&m()},[t,m]),Z.useEffect(()=>()=>qI(e),[e]);let h=r.phase===`open`;Z.useEffect(()=>{if(!h)return;let e=()=>m(),t=e=>{let t=a.current;t&&e.target instanceof Node&&t.contains(e.target)||m()};return document.addEventListener(`scroll`,e,{capture:!0,passive:!0}),document.addEventListener(`pointerdown`,t,!0),()=>{document.removeEventListener(`scroll`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,!0)}},[h,m]);let g=t=>{qI(e),i({offset:-t,phase:`committing`,past:!0});let n=e=>{e===!1&&m()};try{let e=p.current();e&&typeof e.then==`function`&&e.then(n,m)}catch{m()}};return{offset:r.offset,phase:r.phase,past:r.past,surfaceRef:a,bind:{onPointerDown:e=>{if(c.current=!1,!t||f.current.phase===`committing`||e.pointerType===`mouse`&&e.button!==0)return;let n=(a.current??e.currentTarget).getBoundingClientRect();o.current={pointerId:e.pointerId,x0:e.clientX,y0:e.clientY,base:f.current.phase===`open`?-88:0,width:n.width>0?n.width:320,axis:null,wasOpen:f.current.phase===`open`,samples:[{x:e.clientX,t:Date.now()}]}},onPointerMove:t=>{let n=o.current;if(!n||t.pointerId!==n.pointerId)return;let r=t.clientX-n.x0,a=t.clientY-n.y0;if(n.axis===null){if(Math.max(Math.abs(r),Math.abs(a))<10||(n.axis=Math.abs(r)>Math.abs(a)?`x`:`y`,n.axis===`y`))return;try{t.currentTarget.setPointerCapture?.(t.pointerId)}catch{}KI(e,m),u()}if(n.axis!==`x`)return;let c=Math.min(0,Math.max(-n.width,n.base+r)),l=-c>=VI*n.width;l&&!s.current&&JI(),s.current=l,n.samples.push({x:t.clientX,t:Date.now()}),n.samples.length>8&&n.samples.shift(),i({offset:c,phase:`dragging`,past:l})},onPointerUp:t=>{let n=o.current;if(!n||t.pointerId!==n.pointerId)return;if(o.current=null,n.axis!==`x`){n.axis===null&&n.wasOpen&&(u(),d(),m());return}d();let r=f.current.offset,a=Date.now(),c={x:t.clientX,t:a},l=n.samples.find(e=>a-e.t<=UI&&e.t<a),p=l?(c.x-l.x)/(c.t-l.t):0;s.current=!1,f.current.past||p<=-1&&-r>=40?g(n.width):p<1&&-r>=40?(KI(e,m),i({offset:-88,phase:`open`,past:!1})):m()},onPointerCancel:e=>{let t=o.current;!t||e.pointerId!==t.pointerId||(o.current=null,d(),t.axis===`x`&&m())},onClickCapture:e=>{c.current&&(c.current=!1,e.preventDefault(),e.stopPropagation())},onKeyDownCapture:()=>{c.current=!1}},close:m}}var XI=`opacity-0 group-hover/task-row:opacity-100 focus-visible:opacity-100 group-has-[:focus-visible]/task-row:opacity-100 no-hover:opacity-100`,ZI=`opacity-0 group-hover/task-row:opacity-100 focus-visible:opacity-100 group-has-[:focus-visible]/task-row:opacity-100`,QI=`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 $I({run:e,title:t,unread:n,inertReferences:r,onTogglePin:i,onArchiveRun:a}){return(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:[n?(0,Q.jsx)(eo,{tone:eT(e),role:`img`,"aria-label":`unread`,title:`Unread — not opened since it finished`,"data-slot":`unread-marker`,className:i?QI:void 0}):null,i?(0,Q.jsx)(nE,{pinned:!!e.pinned,onToggle:t=>i(e,t),className:s(`absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2`,XI)}):null,a&&!r&&Gr(e)?(0,Q.jsx)(`button`,{type:`button`,"data-action":`archive-run`,"aria-label":`Archive ${t}`,title:`Archive task`,onClick:t=>{t.stopPropagation(),a(e)},className:s(`absolute top-[19.5px] left-1/2 inline-flex size-5 -translate-x-1/2 items-center justify-center rounded-sm text-muted-foreground transition-colors hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none motion-reduce:transition-none`,ZI),children:(0,Q.jsx)(ot,{className:`size-[12px] -translate-y-[2.5px]`,"aria-hidden":`true`})}):null]})}function eL({inertReferences:e,swipeable:t,swipe:n,title:r,onArchive:i,children:a}){return e?(0,Q.jsxs)(`div`,{ref:n.surfaceRef,"data-slot":`task-row-swipe`,"data-swipe":t?`on`:void 0,className:s(`relative rounded-[6px]`,t&&`touch-pan-y touch-pinch-zoom overflow-hidden`),children:[n.offset<0?(0,Q.jsx)(tL,{width:-n.offset,past:n.past,title:r,onArchive:i}):null,a]}):a}function tL({width:e,past:t,title:n,onArchive:r}){return(0,Q.jsx)(`div`,{"data-slot":`task-row-swipe-action`,"data-past":t?`true`:void 0,"aria-hidden":`true`,style:{width:e},className:s(`absolute inset-y-0 right-0 flex items-stretch justify-end overflow-hidden rounded-[6px]`,t?`bg-info text-signal-ink`:`bg-muted text-foreground`),children:t?(0,Q.jsxs)(`span`,{className:`flex w-full items-center justify-center gap-2 text-[12px] font-semibold whitespace-nowrap`,children:[(0,Q.jsx)(ot,{className:`size-[16px] shrink-0`,"aria-hidden":`true`}),`Release to archive`]}):(0,Q.jsxs)(`button`,{type:`button`,tabIndex:-1,"aria-label":`Archive ${n}`,onClick:e=>{e.stopPropagation(),r()},className:`flex w-[88px] shrink-0 flex-col items-center justify-center gap-1 text-[12px] font-semibold`,children:[(0,Q.jsx)(ot,{className:`size-[16px]`,"aria-hidden":`true`}),`Archive`]})})}var nL=`[&>[data-ellipsis-hidden]]:pointer-events-none`,rL=`data-ellipsis-hidden`,iL=new Map;function aL(e){let t=getComputedStyle(e),n=`${t.fontStyle} ${t.fontWeight} ${t.fontSize} ${t.fontFamily} ${t.letterSpacing}`,r=iL.get(n);if(r!==void 0)return r;let i=document.createElement(`span`);i.textContent=`…`,i.setAttribute(`aria-hidden`,`true`),Object.assign(i.style,{position:`absolute`,visibility:`hidden`,whiteSpace:`pre`,fontStyle:t.fontStyle,fontWeight:t.fontWeight,fontSize:t.fontSize,fontFamily:t.fontFamily,letterSpacing:t.letterSpacing}),document.body.appendChild(i);let a=i.getBoundingClientRect().width;i.remove();let o=a||parseFloat(t.fontSize)||12;return a&&(!document.fonts||document.fonts.status===`loaded`)&&iL.set(n,o),o}function oL(e,t){if(e.scrollWidth<=e.clientWidth)return[];let n=e.getBoundingClientRect(),r=parseFloat(getComputedStyle(e).paddingRight)||0,i=n.left+e.clientLeft+e.clientWidth-r-t+.5;return Array.from(e.children).filter(e=>e.getBoundingClientRect().right>i)}function sL(e,t,n){Z.useLayoutEffect(()=>{let n=e.current;if(!t||!n||typeof ResizeObserver>`u`)return;let r=!0,i=()=>{if(!r)return;let e=new Set(oL(n,aL(n)));for(let t of Array.from(n.children))t.hasAttribute(rL)!==e.has(t)&&t.toggleAttribute(rL,e.has(t))},a=new ResizeObserver(i),o=new Set,s=()=>{for(let e of Array.from(n.children))o.has(e)||(o.add(e),a.observe(e))};a.observe(n),s(),i();let c=typeof MutationObserver>`u`?null:new MutationObserver(()=>{s(),i()});return c?.observe(n,{childList:!0}),document.fonts&&document.fonts.status!==`loaded`&&document.fonts.ready.then(i),()=>{r=!1,a.disconnect(),c?.disconnect();for(let e of Array.from(n.children))e.removeAttribute(rL)}},[e,t,n])}var cL=`(hover: none)`;function lL(){let[e,t]=(0,Z.useState)(()=>typeof window.matchMedia==`function`&&window.matchMedia(cL).matches);return(0,Z.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia(cL);t(e.matches);let n=e=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function uL(){let[e,t]=(0,Z.useState)(()=>typeof window.matchMedia!=`function`||window.matchMedia(`(min-width: 768px)`).matches);return(0,Z.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia(`(min-width: 768px)`),n=e=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}var dL={"needs-permission":`label`,failed:`label`,"needs-you":`none`,"needs-review":`label`,running:`label`,"usage-limit":`resume`,"waiting-on-workers":`label`,"waiting-for-ci":`label`,"waiting-for-merge":`label`,"waiting-for-command":`until`,monitoring:`next-check`,"waiting-for-capacity":`label`,queued:`queue-position`,done:`none`,cancelled:`none`,unseen:`label`};function fL(e,t,n,r){let{label:i}=e;switch(dL[e.rung]){case`none`:return;case`queue-position`:return t===null?i:`queued #${t}`;case`resume`:{let e=qa(n.autoResumeAt,r);return e===`scheduled`?i:`${i}, ${e}`}case`next-check`:{let e=ut(n),t=e?.kind===`timer`?new Date(e.at):void 0;return t&&Number.isFinite(t.getTime())?`${i}, next check ${Xa(t,new Date(r))}`:i}case`until`:{let e=ut(n),t=e?.kind===`process`?new Date(e.deadline):void 0;return t&&Number.isFinite(t.getTime())?`${i}, until ${Xa(t,new Date(r))}`:i}case`label`:return i}}function pL({run:e,attention:t,queuePosition:n,inWorkingGroup:r,scope:i,now:a}){let o=sa(e,void 0,i??void 0),s=n===null?Va(e.finishedAt??e.createdAt,a):``,c=r&&t.rung===`running`?void 0:fL(t,n,e,a);return{stateWord:c,references:o,age:s,key:`${s}|${c??``}|${o.map(e=>`${e.kind}-${e.number}-${e.url}`).join(`,`)}|${+!!e.notify}`}}function mL(e){let t=ma(e);return{title:t,displayTitle:vi(t,Li(e)?.number)?Dr(t).rest:t}}var hL=`cez-sidebar-sections-changed`;function gL(e){let[t,n]=(0,Z.useState)(()=>_D(hD)),[r,i]=(0,Z.useState)({}),a=(0,Z.useRef)(t);(0,Z.useEffect)(()=>{let e=e=>{if(e instanceof StorageEvent&&e.key!==null&&e.key!==`cez-sidebar-sections-collapsed`)return;let t=e instanceof CustomEvent?e.detail:_D(hD);a.current=t,n(t)};return window.addEventListener(`storage`,e),window.addEventListener(hL,e),()=>{window.removeEventListener(`storage`,e),window.removeEventListener(hL,e)}},[]),(0,Z.useEffect)(()=>{if(e===null||Object.keys(r).length===0)return;let t={...a.current};for(let[n,i]of Object.entries(r))t[JSON.stringify([e,n])]=i;i({}),a.current=t,n(t),vD(t,hD),window.dispatchEvent(new CustomEvent(hL,{detail:t}))},[e,r]);let o=t=>JSON.stringify([e,t]);return{isCollapsed:e=>e!==`Archived`&&(r[e]??t[o(e)])===!0,toggle:t=>{if(e===null){i(e=>({...e,[t]:e[t]!==!0}));return}let r=o(t),s={...a.current,[r]:a.current[r]!==!0};a.current=s,n(s),vD(s,hD),window.dispatchEvent(new CustomEvent(hL,{detail:s}))}}}function _L({runs:e,view:t,onViewChange:n,currentRunId:r=null,now:i=Date.now(),onTogglePin:a,onArchiveRun:o,onSweep:s,sweeping:c=null,showViewControls:l=!0,rowLimit:u,sidebarLimits:d,projectId:f=null}){let p=OF(),m=Cr(e),h=fa(e,t),g=ki(h,`active`),_=Bi(g,d??u??{overall:null}),v=s?vL(h):void 0;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:m[t]}),(0,Q.jsxs)(X,{to:`/`,onClick:p,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)(me,{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.jsx)(`div`,{className:`inline-flex w-full gap-0.5 rounded-md bg-muted p-[2px]`,children:(0,Q.jsx)(AL,{view:t,onSelect:n,counts:m})})}):null,g.length===0?(0,Q.jsx)(`p`,{className:`px-3 py-3.5 text-xs text-soft-foreground`,children:t===`automations`?`No automation tasks.`:`No tasks yet — describe one.`}):(0,Q.jsx)(yL,{buckets:_,allBuckets:g,sectionProjectId:f,currentRunId:ti(r,e),now:i,onTogglePin:a,onArchiveRun:o,onSweep:s,sweeping:c,sweepCounts:v})]})}function vL(e){return{unpinned:Ai(e,`unpinned`),pinned:Ai(e,`pinned`)}}function yL({buckets:e,currentRunId:t=null,now:n=Date.now(),scope:r=null,onTogglePin:i,onArchiveRun:a,onSweep:o,sweeping:s=null,sweepCounts:c,projectName:l,allBuckets:u=e,sectionProjectId:d=r}){let f=Z.useId(),p=gL(d),m=Z.useRef(null),h=Z.useRef(null);Z.useLayoutEffect(()=>{let e=h.current;if(!e||e.element.isConnected||(h.current=null,document.activeElement!==document.body))return;let t=u.find(t=>t.rows.some(t=>t.run.id===e.id));if(!t)return;let n=Array.from(m.current?.children??[]).find(e=>e.dataset.bucket===t.label);(Array.from(n?.querySelectorAll(`[data-slot="task-row"]`)??[]).find(t=>t.dataset.runId===e.id)?.querySelector(`a`)??n?.querySelector(`[data-slot="section-toggle"]`))?.focus({preventScroll:!0})});let g=(e,o=!1)=>(0,Q.jsx)(TL,{inWorkingGroup:o,run:e.run,queuePosition:e.queuePosition,currentRunId:t,now:n,scope:r,onTogglePin:i,onArchiveRun:a});return(0,Q.jsx)(`div`,{ref:m,className:`flex flex-col gap-3`,onFocusCapture:e=>{let t=e.target.closest(`[data-slot="task-row"]`);h.current=t?.dataset.runId?{id:t.dataset.runId,element:e.target}:null},onBlurCapture:e=>{e.currentTarget.contains(e.relatedTarget)||(h.current=null)},children:u.map(t=>{let n=t.label===`Archived`,r=p.isCollapsed(t.label),i=e.find(({label:e})=>e===t.label)?.rows??[],a=t.rows.map(e=>e.run),u=n?t.rows.length:a.length,d=a.length?R(ua(a)):null,m=a.some(Zw),h=`${f}-${t.label.replaceAll(` `,`-`)}`,_=r?me:Ke;return(0,Q.jsxs)(`div`,{"data-slot":`quick-list-bucket`,"data-bucket":t.label,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2 pr-[6px]`,children:[(0,Q.jsx)(`h2`,{id:h,className:`min-w-0 flex-1 text-[11px] font-medium text-soft-foreground`,children:n?(0,Q.jsxs)(`span`,{className:`px-[10px] pt-[2px] pb-[4px]`,children:[t.label,` `,u]}):(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`section-toggle`,"aria-expanded":!r,"aria-controls":`${h}-rows`,"aria-label":`${t.label} ${u}`,onClick:()=>p.toggle(t.label),className:`flex min-h-[44px] w-full items-center gap-1.5 rounded-[4px] px-[10px] text-left hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-link-foreground md:min-h-[26px] no-hover:min-h-[44px]`,children:[(0,Q.jsx)(_,{className:`size-[12px] shrink-0`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{children:t.label}),` `,(0,Q.jsx)(`span`,{className:`font-normal tabular-nums`,children:u}),d&&(t.label===`Needs you`||r)?(0,Q.jsx)(eo,{tone:d.tone,shape:d.shape,pulse:d.pulse,role:`img`,"aria-label":d.label,title:d.label}):null,r&&m?(0,Q.jsx)(`span`,{role:`img`,"aria-label":`unread`,title:`Unread tasks`,className:`size-[5px] shrink-0 rounded-full bg-foreground`}):null]})}),o&&c?(0,Q.jsx)(OL,{label:t.label,headingId:h,projectName:l,counts:c,onSweep:o,sweeping:s}):null]}),(0,Q.jsx)(`div`,{id:`${h}-rows`,hidden:r,children:!r&&i.map(e=>(0,Q.jsx)(`div`,{children:g(e,t.label===`Working`)},e.run.id))})]},t.label)})})}function bL({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:s(`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 xL(){let e=lL(),t=uL();return e||!t}function SL(e){let t=document.createRange();t.selectNodeContents(e);let n=t.getBoundingClientRect?.().width,r=e.querySelector(`[data-reference-width]`),i=r?Math.max(0,Number(r.dataset.referenceWidth)-r.getBoundingClientRect().width):0;return Math.ceil((n||e.scrollWidth)+i)}function CL(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:SL(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[...r.children,...r.querySelectorAll(`[data-slot="reference-list"] [data-slot="pr-chip"], [data-slot="reference-list"] [data-slot="issue-chip"]`)]){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,subtree:!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 wL(){return(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:` · `})}function TL({run:e,queuePosition:t,currentRunId:n,now:r,scope:i,inWorkingGroup:a=!1,onTogglePin:o,onArchiveRun:c}){let l=Za(),u=OF(),d=xL(),f=!!c&&d&&Gr(e),p=YI({id:e.id,enabled:f,onArchive:()=>c?.(e)}),m=to(i,`/tasks/${e.id}`),h=R(e),g=e.id===n,{title:_,displayTitle:v}=mL(e),y=Zw(e),b=pL({run:e,attention:h,queuePosition:t,inWorkingGroup:a,scope:i,now:r}),[x,S]=Z.useState(null);return(0,Q.jsx)(eL,{inertReferences:d,swipeable:f,swipe:p,title:_,onArchive:()=>void c?.(e),children:(0,Q.jsxs)(`div`,{"data-slot":`task-row`,"data-run-id":e.id,"data-active":g?`true`:void 0,onClick:e=>{e.currentTarget.contains(e.target)&&(e.target.closest(`a, button, input`)||(l(m),u?.()))},...f?p.bind:{},style:p.offset?{transform:`translateX(${p.offset}px)`}:void 0,className:s(`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`,f&&`select-none`,f&&p.phase!==`dragging`&&`motion-safe:transition-transform motion-safe:duration-200 motion-safe:ease-out`,g&&`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)(eo,{tone:h.tone,shape:h.shape,pulse:h.pulse,"aria-label":h.label,title:h.label,role:`img`})}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Q.jsx)(EL,{run:e,to:m,title:_,displayTitle:v,isActive:g,unread:y,swipeable:f,onNavigate:u}),(0,Q.jsx)(DL,{run:e,meta:b,title:_,scope:i,isActive:g,inertReferences:d,overflowContainer:x})]}),b.references.length?(0,Q.jsx)(`span`,{ref:S,"data-slot":`protected-reference-overflow`,className:s(`shrink-0 self-end`,d&&`-my-1.5 self-center`)}):null,e.delegation?.role===`worker`?(0,Q.jsxs)(`span`,{className:`sr-only`,children:[`Worker · `,h.label]}):null,(0,Q.jsx)($I,{run:e,title:_,unread:y,inertReferences:d,onTogglePin:o,onArchiveRun:c})]})})}function EL({run:e,to:t,title:n,displayTitle:r,isActive:i,unread:a,swipeable:o,onNavigate:c}){return(0,Q.jsxs)(X,{to:t,onClick:c,title:n,"aria-current":i?`page`:void 0,draggable:!o&&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:[(0,Q.jsx)(`span`,{"data-slot":`task-row-title`,className:s(`min-w-[7rem] flex-1 truncate text-[13px] leading-[1.45] font-medium text-muted-foreground`,a&&`font-semibold text-foreground`,i&&`text-foreground`),children:r}),e.diffStat?(0,Q.jsx)(JT,{stat:e.diffStat,className:`hidden shrink-0 text-[12px] @min-[23rem]/sidebar:inline`}):null]})}function DL({run:e,meta:t,title:n,scope:r,isActive:i,inertReferences:a,overflowContainer:o}){let{stateWord:c,references:l,age:u,key:d}=t,f=Ao(),p=Z.useRef(null),m=CL(p,!!u,d);sL(p,!a&&l.length>0,`${d}|${+!!m}`);let h=[];return c&&h.push((0,Q.jsx)(`span`,{"data-slot":`task-row-state`,children:c},`state`)),l.length&&h.push((0,Q.jsx)(hO,{references:l,maxVisible:2,taskTitle:n,projectId:r??f.projectId,repoBase:f.repoBase,runId:e.id,plain:!0,compact:!0,inertInline:a,fitContainer:!0,overflowContainer:o},`references`)),u&&!m&&h.push((0,Q.jsx)(`span`,{"data-slot":`task-row-age`,className:`tabular-nums`,children:u},`age`)),(0,Q.jsxs)(`div`,{ref:p,"data-slot":`task-row-meta`,className:s(`h-[16px] min-w-0 truncate text-[11.5px] leading-[1.4] font-normal text-soft-foreground`,nL,i&&`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)(Rc,{"aria-hidden":`true`,className:`size-[10px]`})}):null,h.length?h.flatMap((e,t)=>t?[(0,Q.jsx)(wL,{},`sep-${t}`),e]:[e]):e.notify===!0?null:`\xA0`]})}function OL({label:e,headingId:t,projectName:n,counts:r,onSweep:i,sweeping:a}){let o=e===`Finished`?`unpinned`:null;if(!o||r[o]===0)return null;let s=a===o,c=`Archive all`;return(0,Q.jsxs)(`button`,{type:`button`,"data-action":`archive-group`,"data-scope":o,disabled:s,"aria-busy":s?`true`:void 0,"aria-label":n?`${c}, ${n}`:void 0,"aria-describedby":t,onClick:()=>i(o),className:`relative inline-flex shrink-0 items-center gap-1 rounded-[4px] px-1.5 py-0.5 font-sans text-[11px] leading-[1.4] text-muted-foreground hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-link-foreground disabled:opacity-60 max-md:before:absolute max-md:before:top-1/2 max-md:before:left-0 max-md:before:h-11 max-md:before:w-full max-md:before:-translate-y-1/2 max-md:before:content-[''] no-hover:before:absolute no-hover:before:top-1/2 no-hover:before:left-0 no-hover:before:h-11 no-hover:before:w-full no-hover:before:-translate-y-1/2 no-hover:before:content-['']`,children:[(0,Q.jsx)(ot,{className:`size-[11px]`,"aria-hidden":`true`}),c]})}function kL({showViewControls:e=!0,projectId:t,boot:n=!1}){let r=OF(),i=t??c(),a=Zr(i,!0,n),o=vr(i,!0,n).data?.sidebarLimits??{},s=Mr(i,n?`default`:i),l=BI(i,n?`default`:i,r),u=kr(),[d,f]=vN(),p=Ya(`/tasks/:id/*`),m=Ya(`/tasks/:id`),h=Tm(3e4),g=gi(),_=t??g,v=ci(_),y=Bi(ki(fa(a.data??[],d),`active`),o),b=_===void 0?[]:y.flatMap(e=>e.rows.flatMap(({run:e})=>sa(e,v).filter(e=>yr(e,v)).map(e=>({projectId:_,kind:e.kind,number:e.number}))));return a.data?(0,Q.jsx)(Do,{projectId:_,repoBase:v,requests:b,children:(0,Q.jsx)(_L,{showViewControls:e,sidebarLimits:o,projectId:_==="default"?u.data?.bootProject??null:_??null,runs:a.data,view:d,onViewChange:f,currentRunId:p?.params.id??m?.params.id??null,now:h,onTogglePin:(e,t)=>s.mutate({id:e.id,pinned:t}),onArchiveRun:l.archiveOne,onSweep:e=>l.sweep(e,d===`automations`),sweeping:l.sweeping})}):null}function AL({view:e,onSelect:t,counts:n}){let r=(0,Q.jsx)(eo,{tone:`pending`,pulse:!0,"data-slot":`waiting-dot`,"aria-label":`needs you`});return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(bL,{view:`active`,current:e,onSelect:t,count:n.active,children:[`Active`,n.activeWaiting>0&&e!==`active`?r:null]}),(0,Q.jsxs)(bL,{view:`automations`,current:e,onSelect:t,count:n.automations,children:[`Automations`,n.automationsWaiting>0&&e!==`automations`?r:null]})]})}var jL={claude:!0,codex:!0,opencode:!0,pi:!0,cursor:!0,omp:!0},ML=e=>Object.hasOwn(jL,e.name);function NL(e){let t=e.checks.filter(ML);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 PL(e){let t=`cezar v${e.version}`,n=NL(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 FL(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 IL({health:e,sessionScope:t}){if(!e)return null;let n=NL(e);return(0,Q.jsxs)(Kn,{children:[(0,Q.jsx)(Mn,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`tools-menu-trigger`,"aria-label":`Tools`,title:PL(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)(Ne,{className:`size-[15px]`,"aria-hidden":`true`}),n?(0,Q.jsx)(eo,{tone:`pending`,className:`absolute top-1 left-5 size-1.5`}):null,`Tools`]})}),(0,Q.jsxs)(Rn,{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)(Nt,{className:`text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:`Installed tools`}),e.checks.map(e=>e.available?(0,Q.jsx)(LL,{check:e},e.name):(0,Q.jsx)(RL,{check:e},e.name)),FL(e)?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(yn,{}),(0,Q.jsx)(`p`,{"data-slot":`forge-note`,className:`px-2 py-1.5 text-[11px] leading-snug text-muted-foreground`,children:FL(e)})]}):null,(0,Q.jsx)(yn,{}),(0,Q.jsx)(cn,{asChild:!0,children:(0,Q.jsx)(Qt,{to:`/tools`,children:`Tools diagnostics`})}),(0,Q.jsx)(cn,{asChild:!0,children:(0,Q.jsxs)(X,{to:Kj,"data-slot":`tools-settings`,className:`gap-2 text-[13px] text-muted-foreground`,children:[(0,Q.jsx)(cr,{className:`size-3.5`,"aria-hidden":`true`}),`Tool settings`]})})]})]})}function LL({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)(eo,{tone:Uj(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 RL({check:e}){let t=Gj(e);return(0,Q.jsx)(cn,{asChild:!0,children:(0,Q.jsxs)(X,{to:Kj,"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)(eo,{tone:Uj(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 zL(e){return e?.trim()||null}function BL({projectName:e,pageLabel:t}){let n=zL(e),r=zL(t);return n&&r?`${n} — ${r} · cezar`:n?`${n} · cezar`:r?`${r} · cezar`:`cezar`}function VL(e){let t=BL(e);(0,Z.useEffect)(()=>{document.title=t},[t])}function HL(e){let t=Ua(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 UL={main:`/git`,"not-landed":`/git/not-landed`,cleanup:`/git/cleanup`,branches:`/git/branches`,changes:`/git/changes`},WL=`/git?view=repo`,GL={second:`s`,minute:`m`,hour:`h`,day:`d`,week:`w`,month:`mo`,year:`y`};function KL(e){let t=/^(\d+) (second|minute|hour|day|week|month|year)s? ago$/.exec(e.trim());return t?`${t[1]}${GL[t[2]]}`:e}function qL(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}var JL=new Intl.DateTimeFormat(`en-US`,{weekday:`short`,month:`short`,day:`numeric`}),YL=new Intl.DateTimeFormat(`en-US`,{month:`short`,day:`numeric`,year:`numeric`});function XL(e,t){let n=Date.parse(e);if(Number.isNaN(n))return`Earlier`;let r=qL(t);if(n>=r)return`Today`;if(n>=qL(r-1))return`Yesterday`;let i=new Date(n);return(i.getFullYear()===new Date(t).getFullYear()?JL:YL).format(i)}function ZL(e,t=Date.now()){let n=[];for(let r of e){let e=XL(r.at,t),i=n.at(-1);i?.label===e?i.commits.push(r):n.push({label:e,commits:[r]})}return n}function QL(e,t=Date.now()){return e.filter(e=>XL(e.at,t)===`Today`).length}function $L(e,t){return(e.baseBranch??t.branch)===t.branch?e.tracking:null}function eR(e,t=Date.now()){let n=e.fetchedAt?Va(e.fetchedAt,t):``;return n?`fetched ${n} ago`:`never fetched`}function tR(e,t){let n=V(),r=[e,`repo`],i=[e,`health`],[a,o]=(0,Z.useState)(null),s=e=>H(e.message,{tone:`danger`}),c=()=>Promise.all([n.invalidateQueries({queryKey:r}),n.invalidateQueries({queryKey:i}),n.invalidateQueries({queryKey:W.projects})]),l=Lr({mutationFn:t=>dt(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),H(t.summary),await c()}catch(e){o(null),H(e instanceof Error?e.message:String(e),{tone:`danger`}),await c()}},d=Lr({mutationFn:t=>Qn({name:t},e),onSuccess:async e=>{H(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=Lr({mutationFn:t=>Ae({baseBranch:t},e),onSuccess:t=>{H(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 nR={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 rR({scope:e,repo:t,info:n,variant:r,onNavigate:i}){let a=nR[r],o=tR(e,n),c=t.baseBranch??n.branch,l=t.status.length,u=$L(t,n),d=o.switchBranch.isPending,f=(0,Z.useRef)(null);return(0,Q.jsxs)(`section`,{"aria-label":`Checkout`,"data-slot":`git-checkout`,"data-variant":r,className:s(`flex flex-col border border-border`,a.card),children:[(0,Q.jsxs)(`div`,{className:s(`flex min-w-0 items-center`,a.branchRow),children:[(0,Q.jsxs)(Kn,{children:[(0,Q.jsxs)(Mn,{"data-slot":`git-branch-menu`,"aria-label":`Branch ${n.branch}. Switch branch`,disabled:d,className:s(`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)(Yn,{"aria-hidden":`true`,className:s(`shrink-0 text-muted-foreground`,a.branchIcon)}),(0,Q.jsx)(`span`,{"data-slot":`git-checkout-branch`,className:s(`min-w-0 flex-1 truncate font-mono font-semibold text-foreground`,a.branch),children:n.branch}),(0,Q.jsx)(Ke,{"aria-hidden":`true`,className:s(`shrink-0 text-soft-foreground group-hover:text-foreground`,a.chevron)})]}),(0,Q.jsxs)(Rn,{align:`start`,className:`w-64`,children:[(0,Q.jsx)(Nt,{className:`text-xs text-soft-foreground`,children:`Switch branch`}),(0,Q.jsx)(Vn,{value:n.branch,onValueChange:e=>{e!==n.branch&&o.switchBranch.mutate(e)},children:t.branches.map(e=>(0,Q.jsx)(Rt,{value:e,"data-branch":e,className:`font-mono text-[12.5px]`,children:(0,Q.jsx)(`span`,{className:`truncate`,children:e})},e))}),(0,Q.jsx)(yn,{}),(0,Q.jsx)(cn,{asChild:!0,children:(0,Q.jsx)(X,{to:UL.branches,"data-slot":`git-branch-menu-all`,onClick:i,children:`Create or find a branch…`})})]})]}),(0,Q.jsxs)(`button`,{ref:f,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:s(`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)(Ga,{"aria-hidden":`true`,className:`motion-safe:animate-spin`}):(0,Q.jsx)(ue,{"aria-hidden":`true`}),`Pull`]})]}),u?(0,Q.jsx)(iR,{tracking:u,className:a.line}):null,(0,Q.jsxs)(Kn,{children:[(0,Q.jsxs)(Mn,{"data-slot":`base-branch-picker`,"aria-label":`New tasks start from ${c}. Change the base branch`,disabled:o.setBase.isPending,className:s(`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:c}),(0,Q.jsx)(Ke,{"aria-hidden":`true`,className:s(`shrink-0`,a.lineChevron)})]}),(0,Q.jsxs)(Rn,{align:`start`,className:`w-64`,children:[(0,Q.jsx)(Nt,{className:`text-xs text-soft-foreground`,children:`New tasks start from`}),(0,Q.jsxs)(Vn,{value:t.baseBranch??``,onValueChange:e=>o.setBase.mutate(e===``?null:e),children:[(0,Q.jsx)(Rt,{value:``,"data-branch":``,className:`text-[12.5px]`,children:`The checked-out branch (default)`}),t.branches.map(e=>(0,Q.jsx)(Rt,{value:e,"data-branch":e,className:`font-mono text-[12.5px]`,children:(0,Q.jsx)(`span`,{className:`truncate`,children:e})},e))]})]})]}),l>0?(0,Q.jsxs)(X,{to:UL.changes,"data-slot":`git-uncommitted`,onClick:i,className:s(`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)(Re,{"aria-hidden":`true`,className:`shrink-0 text-inbox-count-foreground`}),(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[l,` uncommitted file`,l===1?``:`s`]}),(0,Q.jsx)(me,{"aria-hidden":`true`,className:`shrink-0 text-soft-foreground`})]}):null,(0,Q.jsx)(aR,{checkout:o,returnFocus:f})]})}function iR({tracking:e,className:t}){let n=e.ref.split(`/`)[0]||e.ref,r=eR(e);return(0,Q.jsx)(`p`,{"data-slot":`git-freshness`,className:s(`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 aR({checkout:e,returnFocus:t}){return(0,Q.jsx)(Ko,{open:e.confirmation!==null,onOpenChange:t=>!t&&e.dismissConfirmation(),children:(0,Q.jsxs)(Ro,{onCloseAutoFocus:e=>{e.preventDefault(),t.current?.focus()},children:[(0,Q.jsxs)(Go,{children:[(0,Q.jsxs)(No,{children:[`Pull `,e.confirmation?.branch,` anyway?`]}),(0,Q.jsx)(Mo,{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)(Ho,{children:[(0,Q.jsx)(Wo,{className:`h-11`,disabled:e.pulling,children:`Cancel`}),(0,Q.jsx)(Vo,{className:`h-11`,disabled:e.pulling||e.confirmation===null,onClick:t=>{t.preventDefault(),e.pull(!0)},children:e.pulling?`Pulling…`:`Pull anyway`})]})]})})}var oR={main:Dn,"not-landed":yc,cleanup:qs,branches:Yn};function sR(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 cR=[`main`,`not-landed`,`cleanup`,`branches`];function lR({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?ro:no,children:cR.map(n=>{let o=oR[n],c=!a&&r===n,l=t[n];return(0,Q.jsxs)(X,{to:a&&n===`main`?WL:UL[n],"data-git-section":n,"aria-current":c?`page`:void 0,onClick:i,className:s(a?io:s(co,`text-[12.5px]`),so,c&&`bg-sidebar-row-selected text-foreground font-medium hover:bg-sidebar-row-selected`),children:[(0,Q.jsx)(o,{"aria-hidden":`true`,className:a?ho:uo}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:sR(n,e)}),l?(0,Q.jsx)(`span`,{"data-slot":`git-section-count`,className:a?lo:ao,children:l}):null,a?(0,Q.jsx)(me,{"aria-hidden":`true`,className:mo}):null]},n)})})}function uR({repo:e,info:t}){let n=kr(),r=Vi(),i=new Map((r.data?.branches??[]).map(e=>[e.name,e])),a=V(),o=Lr({mutationFn:e=>Qn({name:e}),onSuccess:async e=>{H(e.created?`Created and switched to ${e.branch}`:`Switched to ${e.branch}`),await Promise.all([a.invalidateQueries({queryKey:G.repo}),a.invalidateQueries({queryKey:G.health})]),a.setQueryData(G.repo,t=>t?.info?{...t,info:{...t.info,branch:e.branch}}:t),a.setQueryData(G.health,n=>n?.repo?.root===t.root?{...n,repo:{...n.repo,branch:e.branch}}:n)},onError:e=>H(e.message,{tone:`danger`})}),[c,l]=(0,Z.useState)(``),[u,d]=(0,Z.useState)(``),f=u.trim().toLowerCase(),p=gR(e,r.data?.branches),m=f?p.filter(e=>e.toLowerCase().includes(f)):p;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)(at,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,Q.jsx)(x_,{"aria-label":`Filter branches`,placeholder:`Filter branches…`,value:u,onChange:e=>d(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:[m.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:s(`min-w-0 truncate text-[13px]`,n&&`font-normal`),children:e}),r?(0,Q.jsx)(hR,{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)(A,{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)(Yn,{size:16,"aria-hidden":`true`}),`Switch`]})]},e)}),m.length===0?(0,Q.jsxs)(`li`,{"data-slot":`branch-empty`,className:`py-3 text-xs text-soft-foreground`,children:[`No branches match “`,u.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=c.trim();t&&o.mutate(t,{onSuccess:()=>l(``)})},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)(x_,{id:`new-branch-name`,"aria-label":`New branch name`,placeholder:`new-branch-name`,className:`h-11 bg-background`,value:c,onChange:e=>l(e.target.value)}),(0,Q.jsxs)(A,{type:`submit`,variant:`primary`,size:`sm`,className:`min-h-11 self-start`,"data-action":`create-branch`,disabled:!c.trim()||o.isPending,children:[(0,Q.jsx)(Lt,{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)(dR,{}):null]})}function dR(){let e=Er({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)(fR,{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 fR({pr:e}){let t=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(jn,{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)(pR,{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:o(e.url)?(0,Q.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:s(n,`hover:bg-muted`),children:t}):(0,Q.jsx)(`span`,{className:n,children:t})})}function pR({checks:e}){return(0,Q.jsx)(`span`,{"data-slot":`pr-checks`,"data-checks":e,className:s(`shrink-0 text-[12px] font-medium`,e===`passing`&&`text-success`,e===`failing`&&`text-danger`,e===`pending`&&`text-muted-foreground`),children:e})}var mR={active:`in use`,"not-landed":`not landed`,orphan:`not landed`,merged:`merged`,empty:`empty`,other:`yours`};function hR({entry:e}){return(0,Q.jsx)(`span`,{"data-slot":`branch-class`,className:s(`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:mR[e.class]})}function gR(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 _R(e,t,n){let r=wi(e),i=oi(e),a=r.data?.totalBytes??null,o=i.data?.counts??null,s=t&&n===`screen`?QL(t.log):0;return{main:s>0?`${s} today`:null,"not-landed":o?.notLanded?String(o.notLanded):null,cleanup:a?di(a):r.data&&a===null&&o?.cleanup?String(o.cleanup):null,branches:t?String(gR(t,i.data?.branches).length):null}}function vR({scope:e}){let t=zr(e),{pathname:n}=de(),r=OF(),i=t.data?.info?t.data:null,a=_R(e,i,`sidebar`);return(0,Q.jsxs)(`div`,{"data-slot":`git-sidebar`,role:`region`,"aria-label":`Git`,className:go,children:[i?.info?(0,Q.jsx)(rR,{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)(lR,{branch:i?.info?.branch??null,counts:a,variant:`sidebar`,active:HL(n),onNavigate:r})]})}var yR=[`assigned`,`no-task`,`has-task`,`all`],bR=[`review`,`mine`,`failing`,`all`],xR=50,SR=`is:open review-requested:@me`,CR=`is:open status:failure`;function wR(e,t){return e===`prs`&&(t===`review`||t===`failing`)}function TR(e){return e===`review`?SR:e===`failing`?CR:null}function ER(e,t){return t===null?null:(e===`issues`?yR:bR).includes(t)?t:`all`}function DR(e,t,n,r=``){let i=`${n===void 0?e===`issues`?`/github`:`/github/prs`:`${e===`issues`?`/github/issues`:`/github/prs`}/${n}`}${r}`;return t===null?i:`${i}?filter=${encodeURIComponent(t)}`}function OR(e,t){let n=t??`all`;return n===`all`?e===`issues`?`all`:`all-prs`:n}function kR(e){return e===`all`?{view:`issues`,filter:`all`}:e===`all-prs`?{view:`prs`,filter:`all`}:{view:e===`review`||e===`mine`||e===`failing`?`prs`:`issues`,filter:e}}var AR=[{id:`assigned`,label:`Assigned to me`},{id:`no-task`,label:`No task yet`},{id:`has-task`,label:`Has a task`},{id:`all`,label:`All open`}],jR=[{id:`review`,label:`Review requested`},{id:`mine`,label:`Mine`},{id:`failing`,label:`Checks failing`},{id:`all-prs`,label:`All open`}],MR=Object.fromEntries([...AR,...jR].map(e=>[e.id,e.label]));function NR(e){return e===null?``:`${e.value}${e.bound===`atLeast`?`+`:``}`}function PR(e,t){if(t?.bound===`atLeast`)return e===`review`||e===`failing`?`At least ${t.value}: GitHub search returns at most ${xR} results.`:`At least ${t.value}: only the loaded pages are counted. Scroll to load more.`}var FR=(e,t)=>e!==void 0&&t!==void 0&&e.toLowerCase()===t.toLowerCase();function IR(e){try{let t=new URL(e).pathname.split(`/`).filter(Boolean);return t.length>=2?`${t[0]}/${t[1]}`.toLowerCase():null}catch{return null}}function LR(e,t,n){return new Set(e.filter(e=>!e.archived).flatMap(e=>RR(e,t,n)))}function RR(e,t,n){let r=t?.toLowerCase();return sa(e,void 0,n).filter(e=>e.kind===`Issue`&&(!e.url||r!==void 0&&IR(e.url)===r)).map(e=>e.number)}function zR(e,t,n,r){let i=new Map;for(let a of e)!Di(a)&&RR(a,n,r).includes(t)&&i.set(a.id,a);return[...i.values()].sort((e,t)=>Date.parse(t.createdAt)-Date.parse(e.createdAt)||e.id.localeCompare(t.id))}function BR(e,t){let n=new Map(t.map(e=>[e.number,e]));return e.map(e=>n.get(e.number)??e)}function VR(e){return e?.available?{value:e.items.length,bound:e.truncated?`atLeast`:`exact`}:null}function HR({gh:e,tasks:t,review:n,failing:r}){let i={assigned:null,"no-task":null,"has-task":null,all:null,review:VR(n),mine:null,failing:VR(r),"all-prs":null};if(!e?.available)return i;let a=!Nr(e,`issues`),o=!Nr(e,`prs`),s=(e,t)=>({value:e,bound:t?`atLeast`:`exact`}),c=t?e.issues.filter(e=>t.has(e.number)).length:null;return{...i,all:s(e.issuesTotal??e.issues.length,!1),"all-prs":s(e.prsTotal??e.prs.length,!1),assigned:e.viewerLogin?s(e.issues.filter(t=>t.assignees?.some(t=>FR(t,e.viewerLogin))).length,a):null,mine:e.viewerLogin?s(e.prs.filter(t=>FR(t.author,e.viewerLogin)).length,o):null,"has-task":c===null?null:s(c,a),"no-task":c===null?null:s(e.issues.length-c,a)}}var UR={assigned:Xe,"no-task":_o,"has-task":Pe,all:$e,review:wo,mine:jn,failing:pt,"all-prs":$e};function WR(e,t){return e===`assigned`||e===`mine`?t.identity:e===`no-task`||e===`has-task`?t.tasks:null}function GR({model:e,variant:t,activeId:n,onNavigate:r}){let i=t===`screen`;return(0,Q.jsx)(Q.Fragment,{children:[{key:`issues`,label:`Issues`,rows:AR},{key:`prs`,label:`Pull requests`,rows:jR}].map(t=>(0,Q.jsxs)(`nav`,{"aria-label":t.label,"data-slot":`github-filter-group`,"data-group":t.key,className:i?ro:s(oo,t.key===`prs`&&`pt-[6px]`),children:[(0,Q.jsx)(`h3`,{className:i?fo:po,children:t.label}),t.rows.map(({id:t,label:a})=>{let o=UR[t],c=n===t,l=WR(t,e.blocked),u=e.counts[t],d=NR(u),f=s(i?io:s(co,`text-[12.5px]`),l?`cursor-not-allowed opacity-60`:so,c&&`bg-sidebar-row-selected text-foreground font-medium hover:bg-sidebar-row-selected`),p=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(o,{"aria-hidden":`true`,className:i?ho:uo}),(0,Q.jsx)(`span`,{className:`truncate`,children:a}),d?(0,Q.jsx)(`span`,{"data-slot":`gh-filter-count`,title:PR(t,u),className:i?lo:ao,children:d}):null,i?(0,Q.jsx)(me,{"aria-hidden":`true`,className:s(mo,!d&&`ml-auto`)}):null]});if(l)return(0,Q.jsxs)(`div`,{"data-gh-filter":t,"aria-disabled":`true`,title:l,className:f,children:[p,(0,Q.jsx)(`span`,{className:`sr-only`,children:l})]},t);let{view:m,filter:h}=kR(t);return(0,Q.jsx)(X,{to:DR(m,h),"data-gh-filter":t,"aria-current":c?`page`:void 0,onClick:r,className:f,children:p},t)})]},t.key))})}function KR(e){let t=Vr(e,50).data,n=t?.available===!0,r=Zr(e,!0,e==="default"),i=Yi(e,`pr`,SR,n),a=Yi(e,`pr`,CR,n),o=(0,Z.useMemo)(()=>r.data?LR(r.data,t?.repo,e):null,[r.data,t?.repo,e]);return{gh:t,counts:(0,Z.useMemo)(()=>HR({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 qR(e){return/^\/github\/prs(?:\/|$)/.test(Ua(e))?`prs`:`issues`}function JR({scope:e}){let t=KR(e),{pathname:n}=de(),[r]=L(),i=OF(),a=qR(n);return(0,Q.jsx)(`div`,{"data-slot":`github-sidebar`,role:`region`,"aria-label":`GitHub`,className:go,children:(0,Q.jsx)(GR,{model:t,variant:`sidebar`,activeId:OR(a,ER(a,r.get(`filter`))),onNavigate:i})})}function YR({projectId:e,projectName:t,capabilities:n}){return(0,Q.jsx)(`div`,{"data-slot":`settings-sidebar`,className:go,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=Kw(r,n).map(e=>({id:e.id,title:e.title,icon:e.icon,to:`${a}/${e.id}`})),c=r===`project`?[{id:`general`,title:`General`,icon:cr,to:a},...o]:o;return(0,Q.jsxs)(`nav`,{"aria-label":i,"data-slot":`settings-nav`,"data-scope":r,className:s(`flex flex-col gap-px`,r===`global`&&`pt-[6px]`),children:[(0,Q.jsx)(`h3`,{title:i,className:po,children:i}),c.map(({id:e,title:t,icon:n,to:r})=>(0,Q.jsxs)(jt,{to:r,end:!0,"data-section":e,className:({isActive:e})=>s(co,so,e&&`bg-sidebar-row-selected text-foreground font-medium hover:bg-sidebar-row-selected`),children:[(0,Q.jsx)(n,{"aria-hidden":`true`,className:uo}),(0,Q.jsx)(`span`,{className:`truncate`,children:t})]},e))]},r)})})}function XR(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 ZR({children:e}){let{pathname:t}=de(),n=Wa(),r=kr(),i=(0,Z.useRef)(void 0);r.data&&(i.current=r.data);let a=r.data??i.current,o=ZF(a),s=a?.capabilities.automations===!0,c=aa(),l=c.data,u=AI(),d=LM(),f=fM(t),p=l?.bootProject??r.data?.bootProject??null,m=n??p??`default`,h=m===p,g=Zr(m,!0,h),_=n!==null&&n===p,v=l?.projects.find(e=>e.id===n),y=Zr(n??``,v!==void 0&&f.taskId!==null,l?.bootProject===n).data,b=t===`/tools`||t===`/settings/global`||t.startsWith(`/settings/global/`),x=b?null:v?.name??(_?XR(r.data)?.name??null:null),S=f.taskId?y?.find(e=>e.id===f.taskId):void 0,C=S?ma(S):f.pageLabel;VL({projectName:x,pageLabel:C});let w=v?v.forge===`github`:r.data?.forge?.available===!0,T=Ua(t),E=/^\/settings(?:\/|$)/.test(T)?(0,Q.jsx)(YR,{projectId:m,projectName:l?.projects.find(e=>e.id===m)?.name??(h?XR(r.data)?.name??null:null),capabilities:r.data?.capabilities}):/^\/github(?:\/|$)/.test(T)&&w?(0,Q.jsx)(JR,{scope:h?`default`:m}):/^\/git(?:\/|$)/.test(T)?(0,Q.jsx)(vR,{scope:h?`default`:m}):void 0;return(0,Q.jsxs)(_N,{children:[(0,Q.jsx)(jF,{repo:t===`/tools`?XR(r.data):b?null:v?{name:v.name,branch:v.id===p?r.data?.repo?.branch??``:``}:XR(r.data),breadcrumb:{project:t===`/tools`?`Workspace`:x,page:S?`Tasks / ${C}`:C??`Cezarion`,branch:S?.worktreePath?`Isolated worktree`:void 0},version:a?.version??null,latestVersion:a?.latestVersion??null,applicationUpdate:a?.applicationUpdate,onApplyUpdate:o.apply,onRestart:o.restart,applicationUpdateError:o.error,applicationUpdateBusy:o.busy,applicationUpdateOffline:o.offline||r.isError,forgeAvailable:w,automationsAvailable:s,banner:(0,Q.jsx)(aI,{}),sidebarList:E,taskQuickList:(0,Q.jsx)(kL,{projectId:m,boot:h}),sidebarProjectId:m,projectHeader:(0,Q.jsx)(dT,{}),mobileProjects:u,needsYou:pi(g.data??[]).waiting>0,toolsMenu:(0,Q.jsx)(IL,{health:r.data}),toolsStatus:r.data?{blocked:NL(r.data)!==null,note:FL(r.data)}:null,projectRail:u?(0,Q.jsx)(kI,{...u,projectTarget:d.target,onSwitchProject:e=>void d.go(e),version:a?.version??null}):c.isPending?(0,Q.jsx)(DI,{}):null,children:e}),(0,Q.jsx)(AP,{})]})}function QR(){let e=de(),t=aa();return IM(),(0,Z.useEffect)(()=>{let n=el(e,t.data);n!==null&&(nl(Yc(),n)||Xc(n),nl(al(n.projectId),n)||ol(n))},[e.hash,e.pathname,e.search,t.data]),null}function $R(){let e=V(),t=ew(Fr().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}=nw(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}=nw(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&&rw({enabled:n.current,hidden:document.visibilityState===`hidden`,permission:tw()}))for(let e of m)ez(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 ez(e){let t=globalThis.Notification;if(typeof t!=`function`)return;let n=iw(e);try{new t(n.title,{body:n.body,tag:n.tag})}catch{}}function tz(){let[e]=(0,Z.useState)(Vs);return(0,Z.useEffect)(()=>za(e),[e]),(0,Q.jsx)(Hs,{children:(0,Q.jsx)(mt,{client:e,children:(0,Q.jsxs)(Ls,{children:[(0,Q.jsx)($R,{}),(0,Q.jsx)(eb,{children:(0,Q.jsx)(By,{children:(0,Q.jsxs)(rn,{children:[(0,Q.jsx)(QR,{}),(0,Q.jsx)(Eo,{children:(0,Q.jsx)(ZR,{children:(0,Q.jsx)(hM,{})})}),(0,Q.jsx)(Ie,{})]})})})]})})})}function nz(){return(document.querySelector(`meta[name="cez-api-base"]`)?.getAttribute(`content`))?.trim()||``}u(nz());var rz=document.getElementById(`root`);if(!rz)throw Error(`cezar: #root container is missing from index.html`);(0,es.createRoot)(rz).render((0,Q.jsx)(Z.StrictMode,{children:(0,Q.jsx)(tz,{})}));export{vE as $,Sp as $n,_g as $t,lF as A,rm as An,Db as At,zj as B,qp as Bn,nv as Bt,WL as C,fh as Cn,Bx as Ct,ZL as D,km as Dn,XS as Dt,eR as E,Om as En,KS as Et,ZP as F,Sm as Fn,vv as Ft,aD as G,Cp as Gn,B_ as Gt,SD as H,Gp as Hn,U_ as Ht,YP as I,Cm as In,gv as It,jE as J,Tp as Jn,I_ as Jt,nD as K,Dp as Kn,z_ as Kt,XP as L,gm as Ln,iv as Lt,cF as M,sm as Mn,Pv as Mt,UP as N,vm as Nn,Nv as Nt,KL as O,Tm as On,Hb as Ot,JP as P,xm as Pn,Mv as Pt,CE as Q,_p as Qn,x_ as Qt,mN as R,dm as Rn,av as Rt,tR as S,dh as Sn,Us as Sr,cC as St,$L as T,Wm as Tn,Qb as Tt,pD as U,Jp as Un,W_ as Ut,Uk as V,Vp as Vn,cv as Vt,rD as W,zp as Wn,V_ as Wt,bE as X,Ep as Xn,M_ as Xt,AE as Y,Ap as Yn,F_ as Yt,gE as Z,mp as Zn,j_ as Zt,gR as _,rh as _n,Qs as _r,bC as _t,AR as a,pg as an,Uc as ar,yE as at,rR as b,ih as bn,Ys as br,gC as bt,DR as c,Zh as cn,Pc as cr,eE as ct,zR as d,Bh as dn,Ec as dr,JT as dt,gg as en,bp as er,fE as et,ER as f,jh as fn,bc as fr,mT as ft,uR as g,yh as gn,ac as gr,QC as gt,_R as h,Ah as hn,uc as hr,Zw as ht,CR as i,fg as in,Kc as ir,hE as it,dF as j,im as jn,my as jt,uL as k,lm as kn,Ub as kt,wR as l,Yh as ln,Ac as lr,$T as lt,TR as m,Eh as mn,mc as mr,hT as mt,GR as n,hg as nn,xp as nr,xE as nt,jR as o,dg as on,Vc as or,lE as ot,BR as p,Oh as pn,yc as pr,gT as pt,iD as q,Op as qn,L_ as qt,MR as r,mg as rn,cl as rr,wE as rt,SR as s,lg as sn,Rc as sr,tE as st,KR as t,vg as tn,vp as tr,dE as tt,LR as u,Jh as un,kc as ur,QT as ut,lR as v,lh as vn,Zs as vr,MC as vt,UL as w,qm as wn,Gx as wt,aR as x,ph as xn,qs as xr,HS as xt,sR as y,sh as yn,Xs as yr,OC as yt,pN as z,Wp as zn,ov as zt};