@qodeca/xezar 0.10.1

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 (481) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +810 -0
  3. package/dist/agent-config/account-identity.d.ts +44 -0
  4. package/dist/agent-config/account-identity.js +128 -0
  5. package/dist/agent-config/account-identity.js.map +1 -0
  6. package/dist/agent-config/catalog.d.ts +71 -0
  7. package/dist/agent-config/catalog.js +223 -0
  8. package/dist/agent-config/catalog.js.map +1 -0
  9. package/dist/agent-config/files.d.ts +46 -0
  10. package/dist/agent-config/files.js +119 -0
  11. package/dist/agent-config/files.js.map +1 -0
  12. package/dist/agent-config/model-settings/claude.d.ts +2 -0
  13. package/dist/agent-config/model-settings/claude.js +11 -0
  14. package/dist/agent-config/model-settings/claude.js.map +1 -0
  15. package/dist/agent-config/model-settings/codex.d.ts +2 -0
  16. package/dist/agent-config/model-settings/codex.js +16 -0
  17. package/dist/agent-config/model-settings/codex.js.map +1 -0
  18. package/dist/agent-config/model-settings/opencode.d.ts +2 -0
  19. package/dist/agent-config/model-settings/opencode.js +8 -0
  20. package/dist/agent-config/model-settings/opencode.js.map +1 -0
  21. package/dist/agent-config/model-settings/pi.d.ts +12 -0
  22. package/dist/agent-config/model-settings/pi.js +18 -0
  23. package/dist/agent-config/model-settings/pi.js.map +1 -0
  24. package/dist/agent-config/model-settings/shared.d.ts +9 -0
  25. package/dist/agent-config/model-settings/shared.js +93 -0
  26. package/dist/agent-config/model-settings/shared.js.map +1 -0
  27. package/dist/agent-config/model-settings/types.d.ts +9 -0
  28. package/dist/agent-config/model-settings/types.js +2 -0
  29. package/dist/agent-config/model-settings/types.js.map +1 -0
  30. package/dist/agent-config/models.d.ts +9 -0
  31. package/dist/agent-config/models.js +32 -0
  32. package/dist/agent-config/models.js.map +1 -0
  33. package/dist/agent-config/seed.d.ts +7 -0
  34. package/dist/agent-config/seed.js +90 -0
  35. package/dist/agent-config/seed.js.map +1 -0
  36. package/dist/agent-config/service.d.ts +44 -0
  37. package/dist/agent-config/service.js +71 -0
  38. package/dist/agent-config/service.js.map +1 -0
  39. package/dist/agent-config/validate.d.ts +21 -0
  40. package/dist/agent-config/validate.js +76 -0
  41. package/dist/agent-config/validate.js.map +1 -0
  42. package/dist/automations/coordinator.d.ts +26 -0
  43. package/dist/automations/coordinator.js +66 -0
  44. package/dist/automations/coordinator.js.map +1 -0
  45. package/dist/automations/github-poller.d.ts +74 -0
  46. package/dist/automations/github-poller.js +234 -0
  47. package/dist/automations/github-poller.js.map +1 -0
  48. package/dist/automations/scheduler.d.ts +42 -0
  49. package/dist/automations/scheduler.js +192 -0
  50. package/dist/automations/scheduler.js.map +1 -0
  51. package/dist/automations/store.d.ts +65 -0
  52. package/dist/automations/store.js +298 -0
  53. package/dist/automations/store.js.map +1 -0
  54. package/dist/automations/task-template.d.ts +18 -0
  55. package/dist/automations/task-template.js +95 -0
  56. package/dist/automations/task-template.js.map +1 -0
  57. package/dist/automations/types.d.ts +255 -0
  58. package/dist/automations/types.js +159 -0
  59. package/dist/automations/types.js.map +1 -0
  60. package/dist/config.d.ts +77 -0
  61. package/dist/config.js +242 -0
  62. package/dist/config.js.map +1 -0
  63. package/dist/contract/agent-config.d.ts +153 -0
  64. package/dist/contract/agent-profiles.d.ts +347 -0
  65. package/dist/contract/automations.d.ts +935 -0
  66. package/dist/contract/events.d.ts +104 -0
  67. package/dist/contract/github.d.ts +597 -0
  68. package/dist/contract/health.d.ts +102 -0
  69. package/dist/contract/index.d.ts +16 -0
  70. package/dist/contract/index.js +1953 -0
  71. package/dist/contract/projects.d.ts +210 -0
  72. package/dist/contract/repo.d.ts +234 -0
  73. package/dist/contract/runs.d.ts +1527 -0
  74. package/dist/contract/skills.d.ts +234 -0
  75. package/dist/contract/workflows.d.ts +218 -0
  76. package/dist/contract/workspace.d.ts +579 -0
  77. package/dist/core/agent-env.d.ts +31 -0
  78. package/dist/core/agent-env.js +371 -0
  79. package/dist/core/agent-env.js.map +1 -0
  80. package/dist/core/agent-model-policy.d.ts +10 -0
  81. package/dist/core/agent-model-policy.js +36 -0
  82. package/dist/core/agent-model-policy.js.map +1 -0
  83. package/dist/core/agent-profiles.d.ts +62 -0
  84. package/dist/core/agent-profiles.js +90 -0
  85. package/dist/core/agent-profiles.js.map +1 -0
  86. package/dist/core/agent-runner.d.ts +211 -0
  87. package/dist/core/agent-runner.js +68 -0
  88. package/dist/core/agent-runner.js.map +1 -0
  89. package/dist/core/ask.d.ts +115 -0
  90. package/dist/core/ask.js +256 -0
  91. package/dist/core/ask.js.map +1 -0
  92. package/dist/core/backend-detect.d.ts +16 -0
  93. package/dist/core/backend-detect.js +155 -0
  94. package/dist/core/backend-detect.js.map +1 -0
  95. package/dist/core/claude-cli-runner.d.ts +65 -0
  96. package/dist/core/claude-cli-runner.js +479 -0
  97. package/dist/core/claude-cli-runner.js.map +1 -0
  98. package/dist/core/claude-model-catalog.d.ts +24 -0
  99. package/dist/core/claude-model-catalog.js +208 -0
  100. package/dist/core/claude-model-catalog.js.map +1 -0
  101. package/dist/core/claude-ui-mapper.d.ts +79 -0
  102. package/dist/core/claude-ui-mapper.js +597 -0
  103. package/dist/core/claude-ui-mapper.js.map +1 -0
  104. package/dist/core/codex-app-server-runner.d.ts +41 -0
  105. package/dist/core/codex-app-server-runner.js +584 -0
  106. package/dist/core/codex-app-server-runner.js.map +1 -0
  107. package/dist/core/codex-app-server-transport.d.ts +35 -0
  108. package/dist/core/codex-app-server-transport.js +150 -0
  109. package/dist/core/codex-app-server-transport.js.map +1 -0
  110. package/dist/core/codex-model-catalog.d.ts +10 -0
  111. package/dist/core/codex-model-catalog.js +110 -0
  112. package/dist/core/codex-model-catalog.js.map +1 -0
  113. package/dist/core/codex-ui-mapper.d.ts +109 -0
  114. package/dist/core/codex-ui-mapper.js +764 -0
  115. package/dist/core/codex-ui-mapper.js.map +1 -0
  116. package/dist/core/model-identity.d.ts +125 -0
  117. package/dist/core/model-identity.js +132 -0
  118. package/dist/core/model-identity.js.map +1 -0
  119. package/dist/core/model-presets.d.ts +21 -0
  120. package/dist/core/model-presets.js +91 -0
  121. package/dist/core/model-presets.js.map +1 -0
  122. package/dist/core/ndjson.d.ts +6 -0
  123. package/dist/core/ndjson.js +23 -0
  124. package/dist/core/ndjson.js.map +1 -0
  125. package/dist/core/opencode-model-catalog.d.ts +32 -0
  126. package/dist/core/opencode-model-catalog.js +153 -0
  127. package/dist/core/opencode-model-catalog.js.map +1 -0
  128. package/dist/core/opencode-server-runner.d.ts +32 -0
  129. package/dist/core/opencode-server-runner.js +535 -0
  130. package/dist/core/opencode-server-runner.js.map +1 -0
  131. package/dist/core/opencode-ui-mapper.d.ts +111 -0
  132. package/dist/core/opencode-ui-mapper.js +668 -0
  133. package/dist/core/opencode-ui-mapper.js.map +1 -0
  134. package/dist/core/pi-runner.d.ts +24 -0
  135. package/dist/core/pi-runner.js +349 -0
  136. package/dist/core/pi-runner.js.map +1 -0
  137. package/dist/core/pi-ui-mapper.d.ts +34 -0
  138. package/dist/core/pi-ui-mapper.js +270 -0
  139. package/dist/core/pi-ui-mapper.js.map +1 -0
  140. package/dist/core/process-usage.d.ts +66 -0
  141. package/dist/core/process-usage.js +193 -0
  142. package/dist/core/process-usage.js.map +1 -0
  143. package/dist/core/provider-auth.d.ts +154 -0
  144. package/dist/core/provider-auth.js +509 -0
  145. package/dist/core/provider-auth.js.map +1 -0
  146. package/dist/core/provider-availability.d.ts +3 -0
  147. package/dist/core/provider-availability.js +14 -0
  148. package/dist/core/provider-availability.js.map +1 -0
  149. package/dist/core/runner-factory.d.ts +8 -0
  150. package/dist/core/runner-factory.js +25 -0
  151. package/dist/core/runner-factory.js.map +1 -0
  152. package/dist/core/runner-model-catalog.d.ts +28 -0
  153. package/dist/core/runner-model-catalog.js +62 -0
  154. package/dist/core/runner-model-catalog.js.map +1 -0
  155. package/dist/core/secret-redaction.d.ts +37 -0
  156. package/dist/core/secret-redaction.js +115 -0
  157. package/dist/core/secret-redaction.js.map +1 -0
  158. package/dist/core/shell-env.d.ts +28 -0
  159. package/dist/core/shell-env.js +56 -0
  160. package/dist/core/shell-env.js.map +1 -0
  161. package/dist/core/tool-display.d.ts +31 -0
  162. package/dist/core/tool-display.js +179 -0
  163. package/dist/core/tool-display.js.map +1 -0
  164. package/dist/core/ui-events.d.ts +332 -0
  165. package/dist/core/ui-events.js +22 -0
  166. package/dist/core/ui-events.js.map +1 -0
  167. package/dist/core/usage-limit.d.ts +42 -0
  168. package/dist/core/usage-limit.js +209 -0
  169. package/dist/core/usage-limit.js.map +1 -0
  170. package/dist/core/usage.d.ts +11 -0
  171. package/dist/core/usage.js +15 -0
  172. package/dist/core/usage.js.map +1 -0
  173. package/dist/core/v1-text-coalescer.d.ts +36 -0
  174. package/dist/core/v1-text-coalescer.js +72 -0
  175. package/dist/core/v1-text-coalescer.js.map +1 -0
  176. package/dist/git-diff-base.d.ts +85 -0
  177. package/dist/git-diff-base.js +180 -0
  178. package/dist/git-diff-base.js.map +1 -0
  179. package/dist/git-refs.d.ts +11 -0
  180. package/dist/git-refs.js +14 -0
  181. package/dist/git-refs.js.map +1 -0
  182. package/dist/git-worktree.d.ts +161 -0
  183. package/dist/git-worktree.js +508 -0
  184. package/dist/git-worktree.js.map +1 -0
  185. package/dist/handoff.d.ts +62 -0
  186. package/dist/handoff.js +154 -0
  187. package/dist/handoff.js.map +1 -0
  188. package/dist/index.d.ts +2 -0
  189. package/dist/index.js +684 -0
  190. package/dist/index.js.map +1 -0
  191. package/dist/install-as-command.d.ts +40 -0
  192. package/dist/install-as-command.js +52 -0
  193. package/dist/install-as-command.js.map +1 -0
  194. package/dist/pack-check.d.ts +17 -0
  195. package/dist/pack-check.js +27 -0
  196. package/dist/pack-check.js.map +1 -0
  197. package/dist/paths.d.ts +140 -0
  198. package/dist/paths.js +192 -0
  199. package/dist/paths.js.map +1 -0
  200. package/dist/planner.d.ts +27 -0
  201. package/dist/planner.js +268 -0
  202. package/dist/planner.js.map +1 -0
  203. package/dist/release/manifests.d.ts +78 -0
  204. package/dist/release/manifests.js +57 -0
  205. package/dist/release/manifests.js.map +1 -0
  206. package/dist/release/snapshot.d.ts +67 -0
  207. package/dist/release/snapshot.js +97 -0
  208. package/dist/release/snapshot.js.map +1 -0
  209. package/dist/release/stable.d.ts +33 -0
  210. package/dist/release/stable.js +50 -0
  211. package/dist/release/stable.js.map +1 -0
  212. package/dist/runs/agent-tmpdir.d.ts +41 -0
  213. package/dist/runs/agent-tmpdir.js +183 -0
  214. package/dist/runs/agent-tmpdir.js.map +1 -0
  215. package/dist/runs/arm-repo-handle.d.ts +17 -0
  216. package/dist/runs/arm-repo-handle.js +24 -0
  217. package/dist/runs/arm-repo-handle.js.map +1 -0
  218. package/dist/runs/auto-name.d.ts +75 -0
  219. package/dist/runs/auto-name.js +179 -0
  220. package/dist/runs/auto-name.js.map +1 -0
  221. package/dist/runs/event-history.d.ts +50 -0
  222. package/dist/runs/event-history.js +613 -0
  223. package/dist/runs/event-history.js.map +1 -0
  224. package/dist/runs/retention.d.ts +60 -0
  225. package/dist/runs/retention.js +86 -0
  226. package/dist/runs/retention.js.map +1 -0
  227. package/dist/runs/review-gate.d.ts +18 -0
  228. package/dist/runs/review-gate.js +21 -0
  229. package/dist/runs/review-gate.js.map +1 -0
  230. package/dist/runs/run-index.d.ts +19 -0
  231. package/dist/runs/run-index.js +43 -0
  232. package/dist/runs/run-index.js.map +1 -0
  233. package/dist/runs/store.d.ts +490 -0
  234. package/dist/runs/store.js +1283 -0
  235. package/dist/runs/store.js.map +1 -0
  236. package/dist/runs/task-markers.d.ts +28 -0
  237. package/dist/runs/task-markers.js +74 -0
  238. package/dist/runs/task-markers.js.map +1 -0
  239. package/dist/runs/task-refs.d.ts +25 -0
  240. package/dist/runs/task-refs.js +74 -0
  241. package/dist/runs/task-refs.js.map +1 -0
  242. package/dist/runs/ui-event-sink.d.ts +80 -0
  243. package/dist/runs/ui-event-sink.js +209 -0
  244. package/dist/runs/ui-event-sink.js.map +1 -0
  245. package/dist/server/app-type.d.ts +21 -0
  246. package/dist/server/app-type.js +2 -0
  247. package/dist/server/app-type.js.map +1 -0
  248. package/dist/server/capabilities.d.ts +70 -0
  249. package/dist/server/capabilities.js +152 -0
  250. package/dist/server/capabilities.js.map +1 -0
  251. package/dist/server/checkout.d.ts +128 -0
  252. package/dist/server/checkout.js +296 -0
  253. package/dist/server/checkout.js.map +1 -0
  254. package/dist/server/forge/github.d.ts +535 -0
  255. package/dist/server/forge/github.js +2544 -0
  256. package/dist/server/forge/github.js.map +1 -0
  257. package/dist/server/forge/index.d.ts +40 -0
  258. package/dist/server/forge/index.js +72 -0
  259. package/dist/server/forge/index.js.map +1 -0
  260. package/dist/server/forge/types.d.ts +267 -0
  261. package/dist/server/forge/types.js +2 -0
  262. package/dist/server/forge/types.js.map +1 -0
  263. package/dist/server/fs-browse.d.ts +105 -0
  264. package/dist/server/fs-browse.js +182 -0
  265. package/dist/server/fs-browse.js.map +1 -0
  266. package/dist/server/git-changes.d.ts +213 -0
  267. package/dist/server/git-changes.js +555 -0
  268. package/dist/server/git-changes.js.map +1 -0
  269. package/dist/server/git.d.ts +28 -0
  270. package/dist/server/git.js +112 -0
  271. package/dist/server/git.js.map +1 -0
  272. package/dist/server/github.d.ts +9 -0
  273. package/dist/server/github.js +8 -0
  274. package/dist/server/github.js.map +1 -0
  275. package/dist/server/launch-key.d.ts +7 -0
  276. package/dist/server/launch-key.js +33 -0
  277. package/dist/server/launch-key.js.map +1 -0
  278. package/dist/server/open-in-app.d.ts +66 -0
  279. package/dist/server/open-in-app.js +211 -0
  280. package/dist/server/open-in-app.js.map +1 -0
  281. package/dist/server/open-in-terminal.d.ts +70 -0
  282. package/dist/server/open-in-terminal.js +179 -0
  283. package/dist/server/open-in-terminal.js.map +1 -0
  284. package/dist/server/pr.d.ts +7 -0
  285. package/dist/server/pr.js +7 -0
  286. package/dist/server/pr.js.map +1 -0
  287. package/dist/server/project-context.d.ts +120 -0
  288. package/dist/server/project-context.js +192 -0
  289. package/dist/server/project-context.js.map +1 -0
  290. package/dist/server/provider-action-gate.d.ts +8 -0
  291. package/dist/server/provider-action-gate.js +56 -0
  292. package/dist/server/provider-action-gate.js.map +1 -0
  293. package/dist/server/provider-auth-runtime.d.ts +21 -0
  294. package/dist/server/provider-auth-runtime.js +66 -0
  295. package/dist/server/provider-auth-runtime.js.map +1 -0
  296. package/dist/server/server.d.ts +13578 -0
  297. package/dist/server/server.js +5284 -0
  298. package/dist/server/server.js.map +1 -0
  299. package/dist/server/static-ui.d.ts +49 -0
  300. package/dist/server/static-ui.js +92 -0
  301. package/dist/server/static-ui.js.map +1 -0
  302. package/dist/server/validators.d.ts +97 -0
  303. package/dist/server/validators.js +86 -0
  304. package/dist/server/validators.js.map +1 -0
  305. package/dist/server/ws.d.ts +83 -0
  306. package/dist/server/ws.js +216 -0
  307. package/dist/server/ws.js.map +1 -0
  308. package/dist/server/wsl.d.ts +25 -0
  309. package/dist/server/wsl.js +92 -0
  310. package/dist/server/wsl.js.map +1 -0
  311. package/dist/server-install/engine.d.ts +50 -0
  312. package/dist/server-install/engine.js +324 -0
  313. package/dist/server-install/engine.js.map +1 -0
  314. package/dist/server-install/platforms/macosx-ngrok.d.ts +6 -0
  315. package/dist/server-install/platforms/macosx-ngrok.js +348 -0
  316. package/dist/server-install/platforms/macosx-ngrok.js.map +1 -0
  317. package/dist/server-install/platforms/ubuntu-vps.d.ts +63 -0
  318. package/dist/server-install/platforms/ubuntu-vps.js +997 -0
  319. package/dist/server-install/platforms/ubuntu-vps.js.map +1 -0
  320. package/dist/server-install/state.d.ts +52 -0
  321. package/dist/server-install/state.js +182 -0
  322. package/dist/server-install/state.js.map +1 -0
  323. package/dist/server-install/steps.d.ts +109 -0
  324. package/dist/server-install/steps.js +334 -0
  325. package/dist/server-install/steps.js.map +1 -0
  326. package/dist/server-install/strategies.d.ts +4 -0
  327. package/dist/server-install/strategies.js +20 -0
  328. package/dist/server-install/strategies.js.map +1 -0
  329. package/dist/server-install/types.d.ts +287 -0
  330. package/dist/server-install/types.js +121 -0
  331. package/dist/server-install/types.js.map +1 -0
  332. package/dist/server-install/ui.d.ts +42 -0
  333. package/dist/server-install/ui.js +130 -0
  334. package/dist/server-install/ui.js.map +1 -0
  335. package/dist/skills-banner.d.ts +22 -0
  336. package/dist/skills-banner.js +41 -0
  337. package/dist/skills-banner.js.map +1 -0
  338. package/dist/skills-remote.d.ts +84 -0
  339. package/dist/skills-remote.js +468 -0
  340. package/dist/skills-remote.js.map +1 -0
  341. package/dist/skills-update.d.ts +88 -0
  342. package/dist/skills-update.js +392 -0
  343. package/dist/skills-update.js.map +1 -0
  344. package/dist/skills.d.ts +82 -0
  345. package/dist/skills.js +251 -0
  346. package/dist/skills.js.map +1 -0
  347. package/dist/todos.d.ts +48 -0
  348. package/dist/todos.js +201 -0
  349. package/dist/todos.js.map +1 -0
  350. package/dist/ui-state.d.ts +26 -0
  351. package/dist/ui-state.js +38 -0
  352. package/dist/ui-state.js.map +1 -0
  353. package/dist/update-check.d.ts +12 -0
  354. package/dist/update-check.js +41 -0
  355. package/dist/update-check.js.map +1 -0
  356. package/dist/workflows/load.d.ts +15 -0
  357. package/dist/workflows/load.js +56 -0
  358. package/dist/workflows/load.js.map +1 -0
  359. package/dist/workflows/run.d.ts +803 -0
  360. package/dist/workflows/run.js +3483 -0
  361. package/dist/workflows/run.js.map +1 -0
  362. package/dist/workflows/types.d.ts +145 -0
  363. package/dist/workflows/types.js +194 -0
  364. package/dist/workflows/types.js.map +1 -0
  365. package/dist/workspace/agent-accounts.d.ts +153 -0
  366. package/dist/workspace/agent-accounts.js +304 -0
  367. package/dist/workspace/agent-accounts.js.map +1 -0
  368. package/dist/workspace/agent-profiles.d.ts +78 -0
  369. package/dist/workspace/agent-profiles.js +115 -0
  370. package/dist/workspace/agent-profiles.js.map +1 -0
  371. package/dist/workspace/config.d.ts +169 -0
  372. package/dist/workspace/config.js +379 -0
  373. package/dist/workspace/config.js.map +1 -0
  374. package/dist/workspace/migrations.d.ts +45 -0
  375. package/dist/workspace/migrations.js +147 -0
  376. package/dist/workspace/migrations.js.map +1 -0
  377. package/dist/workspace/projects-cli.d.ts +25 -0
  378. package/dist/workspace/projects-cli.js +172 -0
  379. package/dist/workspace/projects-cli.js.map +1 -0
  380. package/dist/workspace/projects.d.ts +109 -0
  381. package/dist/workspace/projects.js +250 -0
  382. package/dist/workspace/projects.js.map +1 -0
  383. package/dist/workspace/semaphore.d.ts +179 -0
  384. package/dist/workspace/semaphore.js +195 -0
  385. package/dist/workspace/semaphore.js.map +1 -0
  386. package/dist/workspace/ui-state.d.ts +34 -0
  387. package/dist/workspace/ui-state.js +53 -0
  388. package/dist/workspace/ui-state.js.map +1 -0
  389. package/package.json +85 -0
  390. package/scripts/check-pack.mjs +46 -0
  391. package/scripts/inline-contract.mjs +112 -0
  392. package/scripts/install-as-command.mjs +120 -0
  393. package/scripts/mock-claude.mjs +524 -0
  394. package/scripts/mock-pi-rpc.mjs +83 -0
  395. package/scripts/sync-readme.mjs +20 -0
  396. package/scripts/test-process-usage.mjs +47 -0
  397. package/web/dist/assets/alert-dialog-CGskMvgc.js +1 -0
  398. package/web/dist/assets/arrow-down-G8adPhbu.js +1 -0
  399. package/web/dist/assets/arrow-left-BJsIW6A0.js +1 -0
  400. package/web/dist/assets/bundle-mjs-BT31bpU6.js +1 -0
  401. package/web/dist/assets/centered-state-B_V_Ai2h.js +43 -0
  402. package/web/dist/assets/chevron-right-CFzn-von.js +1 -0
  403. package/web/dist/assets/chunk-BO2N2NFS-DE6qKn3r.js +131 -0
  404. package/web/dist/assets/collapsible-B_8uYwHb.js +1 -0
  405. package/web/dist/assets/commit-list-C4Dv6vUL.js +1 -0
  406. package/web/dist/assets/compare-variants-SR2zZfZq.js +1 -0
  407. package/web/dist/assets/core-BCsw8oQw.js +12 -0
  408. package/web/dist/assets/css-BsVw1vtW.js +1 -0
  409. package/web/dist/assets/diff-CbozNUJq.js +3 -0
  410. package/web/dist/assets/diff-stat-btAmKFJr.js +1 -0
  411. package/web/dist/assets/diff-view-BpFTcG3R.js +6 -0
  412. package/web/dist/assets/diff-woXpYk--.js +1 -0
  413. package/web/dist/assets/dropdown-menu-Z80KMInL.js +1 -0
  414. package/web/dist/assets/editable-title-wS5NWwob.js +1 -0
  415. package/web/dist/assets/ellipsis-vertical-Bmi2u2TG.js +1 -0
  416. package/web/dist/assets/engine-javascript-FQvzRocB.js +141 -0
  417. package/web/dist/assets/file-DKoYWRsv.js +1 -0
  418. package/web/dist/assets/folder-u01HScRT.js +1 -0
  419. package/web/dist/assets/git-toolbar-DZlZjTGz.js +1 -0
  420. package/web/dist/assets/github-CFURo9kf.js +1 -0
  421. package/web/dist/assets/go-rLFTqkRN.js +1 -0
  422. package/web/dist/assets/highlighted-body-OFNGDK62-BL-MfFgl.js +1 -0
  423. package/web/dist/assets/highlighter-C8DK1_sG.js +3 -0
  424. package/web/dist/assets/html-BY76lXLH.js +1 -0
  425. package/web/dist/assets/image-preview-BR3iIIhf.js +1 -0
  426. package/web/dist/assets/index-BcI5hug3.css +2 -0
  427. package/web/dist/assets/index-DlC81_GI.js +7 -0
  428. package/web/dist/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
  429. package/web/dist/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
  430. package/web/dist/assets/javascript-BgS3c2Ky.js +1 -0
  431. package/web/dist/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
  432. package/web/dist/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
  433. package/web/dist/assets/json-qhed-kSA.js +1 -0
  434. package/web/dist/assets/jsonc-CYpm1nAK.js +1 -0
  435. package/web/dist/assets/jsx-Bz0zcwM4.js +1 -0
  436. package/web/dist/assets/lib-BQXq3kEf.js +1 -0
  437. package/web/dist/assets/lib-BxQXEXDF.js +1 -0
  438. package/web/dist/assets/markdown-5FuCZDA4.js +2 -0
  439. package/web/dist/assets/markdown-BYOwaDjH.js +1 -0
  440. package/web/dist/assets/mermaid-GHXKKRXX-C4jxqUUb.js +1 -0
  441. package/web/dist/assets/new-task-form-BydHBbef.js +1 -0
  442. package/web/dist/assets/pill-vNzaaYxj.js +1 -0
  443. package/web/dist/assets/project-router-BbCzrHKs.js +1 -0
  444. package/web/dist/assets/prompt-templates-B7Fs2b1S.js +15 -0
  445. package/web/dist/assets/python-gzcpVVnB.js +1 -0
  446. package/web/dist/assets/react-runtime-CCIEwYL0.js +9 -0
  447. package/web/dist/assets/refresh-cw-DGliez3E.js +1 -0
  448. package/web/dist/assets/repo-git-CJFDMauC.js +1 -0
  449. package/web/dist/assets/rolldown-runtime-QTnfLwEv.js +1 -0
  450. package/web/dist/assets/run-diff-Bq9vkSNK.js +3 -0
  451. package/web/dist/assets/run-header-Cd8mSKBG.js +1 -0
  452. package/web/dist/assets/rust-Cfkwpbl8.js +1 -0
  453. package/web/dist/assets/search-x-69n_672Y.js +1 -0
  454. package/web/dist/assets/shellscript-CLZ0U2zV.js +1 -0
  455. package/web/dist/assets/skill-empty-hint-DTu0LzaJ.js +1 -0
  456. package/web/dist/assets/skills-Cs-auniL.js +1 -0
  457. package/web/dist/assets/skills-D4P-Hgey.js +1 -0
  458. package/web/dist/assets/sparkles-B8agSxBZ.js +1 -0
  459. package/web/dist/assets/sql-BsFa4tDR.js +1 -0
  460. package/web/dist/assets/square-terminal-Cf4Og6ct.js +1 -0
  461. package/web/dist/assets/tab-link-Cp2-CJS8.js +1 -0
  462. package/web/dist/assets/task-changes-DYgNXOyY.js +1 -0
  463. package/web/dist/assets/task-commits-BRpZSz1G.js +1 -0
  464. package/web/dist/assets/task-files-pKOwSyLh.js +2 -0
  465. package/web/dist/assets/task-thread-Bfyqqy-t.js +9 -0
  466. package/web/dist/assets/textarea--cpYshee.js +1 -0
  467. package/web/dist/assets/thread-loading-GyH2Atwo.js +1 -0
  468. package/web/dist/assets/toml-CcmNWLt0.js +1 -0
  469. package/web/dist/assets/trash-2--ZtrzUx3.js +1 -0
  470. package/web/dist/assets/triangle-alert-D5tJwRD2.js +1 -0
  471. package/web/dist/assets/tsx-udAQXfEw.js +1 -0
  472. package/web/dist/assets/typescript-bsJCZSQ-.js +1 -0
  473. package/web/dist/assets/upload-SnwVxKOA.js +1 -0
  474. package/web/dist/assets/use-desktop-C31lOFUD.js +1 -0
  475. package/web/dist/assets/use-submit-shortcut-JY8M_MPL.js +1 -0
  476. package/web/dist/assets/utils-Bb8ohcr3.js +64 -0
  477. package/web/dist/assets/workflows-BmOehP-A.js +11 -0
  478. package/web/dist/assets/yaml-rwi0_p6S.js +1 -0
  479. package/web/dist/assets/zoomable-image-0G3IBXWC.js +1 -0
  480. package/web/dist/index.html +80 -0
  481. package/web/dist/xezar.svg +14 -0
@@ -0,0 +1,7 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/task-thread-Bfyqqy-t.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-runtime-CCIEwYL0.js","assets/centered-state-B_V_Ai2h.js","assets/utils-Bb8ohcr3.js","assets/bundle-mjs-BT31bpU6.js","assets/editable-title-wS5NWwob.js","assets/new-task-form-BydHBbef.js","assets/dropdown-menu-Z80KMInL.js","assets/folder-u01HScRT.js","assets/sparkles-B8agSxBZ.js","assets/square-terminal-Cf4Og6ct.js","assets/triangle-alert-D5tJwRD2.js","assets/pill-vNzaaYxj.js","assets/markdown-5FuCZDA4.js","assets/alert-dialog-CGskMvgc.js","assets/chunk-BO2N2NFS-DE6qKn3r.js","assets/lib-BxQXEXDF.js","assets/highlighter-C8DK1_sG.js","assets/arrow-down-G8adPhbu.js","assets/thread-loading-GyH2Atwo.js","assets/prompt-templates-B7Fs2b1S.js","assets/use-submit-shortcut-JY8M_MPL.js","assets/textarea--cpYshee.js","assets/skills-D4P-Hgey.js","assets/chevron-right-CFzn-von.js","assets/run-header-Cd8mSKBG.js","assets/trash-2--ZtrzUx3.js","assets/ellipsis-vertical-Bmi2u2TG.js","assets/collapsible-B_8uYwHb.js","assets/project-router-BbCzrHKs.js","assets/diff-stat-btAmKFJr.js","assets/tab-link-Cp2-CJS8.js","assets/search-x-69n_672Y.js","assets/lib-BQXq3kEf.js","assets/zoomable-image-0G3IBXWC.js","assets/run-diff-Bq9vkSNK.js","assets/compare-variants-SR2zZfZq.js","assets/task-changes-DYgNXOyY.js","assets/use-desktop-C31lOFUD.js","assets/diff-CbozNUJq.js","assets/image-preview-BR3iIIhf.js","assets/git-toolbar-DZlZjTGz.js","assets/file-DKoYWRsv.js","assets/upload-SnwVxKOA.js","assets/task-files-pKOwSyLh.js","assets/task-commits-BRpZSz1G.js","assets/arrow-left-BJsIW6A0.js","assets/commit-list-C4Dv6vUL.js","assets/repo-git-CJFDMauC.js","assets/github-CFURo9kf.js","assets/refresh-cw-DGliez3E.js","assets/workflows-BmOehP-A.js","assets/skill-empty-hint-DTu0LzaJ.js","assets/skills-Cs-auniL.js"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,n,t as r}from"./react-runtime-CCIEwYL0.js";import{$r as i,$t as a,A as o,Ar as s,B as c,Bn as l,Br as u,Bt as d,C as f,Cn as p,Cr as m,D as h,Dn as g,Dr as _,En as v,Er as y,F as b,Fr as x,Ft as S,Gn as ee,Gt as C,H as te,Hr as ne,Ht as re,I as w,In as ie,Ir as T,It as ae,Jr as oe,Jt as E,Kn as se,Kr as D,Kt as ce,L as le,Lr as ue,M as O,Mr as k,Mt as A,N as de,Nr as fe,Nt as pe,O as me,Or as he,P as ge,Pn as _e,Pr as ve,Pt as ye,Q as be,Qt as xe,R as Se,Rn as Ce,Rr as we,Rt as Te,Sn as Ee,Sr as De,T as Oe,Tr as ke,Ur as j,Ut as Ae,Vr as je,Vt as Me,W as Ne,Wn as Pe,Wt as Fe,Xr as Ie,Xt as Le,Yt as Re,Z as M,Zn as ze,_ as Be,_n as N,_t as Ve,a as P,ai as He,b as Ue,ci as We,cn as Ge,cr as Ke,di as qe,dn as Je,dt as Ye,ei as F,en as Xe,et as Ze,f as Qe,fn as $e,fr as et,ft as tt,g as nt,gn as rt,gr as it,gt as at,h as ot,hn as st,hr as ct,i as I,ii as lt,in as ut,it as dt,j as L,jn as ft,jr as pt,k as mt,kr as ht,li as gt,ln as _t,lt as vt,mn as yt,mr as bt,mt as xt,n as St,ni as Ct,nn as wt,oi as Tt,ot as Et,pr as Dt,pt as Ot,qr as R,qt as kt,r as At,ri as jt,rr as Mt,rt as Nt,si as Pt,sn as Ft,t as z,ti as It,tn as Lt,tr as Rt,u as zt,ui as Bt,un as Vt,ur as Ht,ut as B,vn as Ut,vr as Wt,vt as Gt,wn as Kt,wr as qt,wt as Jt,x as Yt,xr as Xt,xt as Zt,y as Qt,yn as $t,yr as en,yt as tn,z as nn,zr as rn,zt as an}from"./centered-state-B_V_Ai2h.js";import{a as on,n as sn,p as cn,r as V,s as ln,t as H,u as un}from"./utils-Bb8ohcr3.js";import{i as dn}from"./bundle-mjs-BT31bpU6.js";import{A as fn,C as pn,D as mn,O as hn,S as gn,T as _n,_ as vn,a as yn,b as bn,h as xn,i as Sn,j as Cn,k as wn,m as Tn,n as En,t as Dn,v as On,w as kn,x as An,y as jn}from"./editable-title-wS5NWwob.js";import{t as Mn}from"./arrow-down-G8adPhbu.js";import{a as Nn,d as Pn,f as Fn,h as In,i as Ln,l as Rn,n as zn,o as Bn,p as Vn,r as Hn,t as Un,u as Wn}from"./thread-loading-GyH2Atwo.js";import{C as Gn,a as Kn,c as qn,d as Jn,f as Yn,g as Xn,h as Zn,i as Qn,l as $n,m as er,n as tr,o as nr,p as rr,r as ir,s as ar,t as or,u as sr,v as cr,y as lr}from"./new-task-form-BydHBbef.js";import{t as ur}from"./chevron-right-CFzn-von.js";import{_ as dr,b as fr,c as pr,d as mr,f as hr,g as gr,h as _r,i as vr,l as yr,m as br,n as xr,p as Sr,r as Cr,s as wr,t as Tr,u as Er,v as Dr}from"./dropdown-menu-Z80KMInL.js";import{C as Or,S as kr,_ as Ar,a as jr,b as Mr,c as Nr,d as Pr,f as Fr,g as U,h as Ir,i as Lr,l as Rr,m as zr,n as Br,o as Vr,p as Hr,r as Ur,s as Wr,t as Gr,u as Kr,v as W,x as qr,y as Jr}from"./prompt-templates-B7Fs2b1S.js";import{t as Yr}from"./folder-u01HScRT.js";import{t as Xr}from"./search-x-69n_672Y.js";import{t as Zr}from"./sparkles-B8agSxBZ.js";import{t as Qr}from"./triangle-alert-D5tJwRD2.js";import{n as $r,t as ei}from"./textarea--cpYshee.js";import{a as ti,c as ni,i as ri,n as ii,o as ai,r as oi,s as si,t as ci}from"./alert-dialog-CGskMvgc.js";import{a as li,c as ui,i as di,l as fi,n as pi,o as mi,r as hi,s as gi}from"./use-submit-shortcut-JY8M_MPL.js";import{a as _i,c as vi,i as yi,l as bi,n as xi,o as Si,r as Ci,s as wi,t as G}from"./project-router-BbCzrHKs.js";import{a as Ti,c as K,i as Ei,n as Di,o as Oi,r as ki,s as Ai,t as ji}from"./pill-vNzaaYxj.js";import{r as Mi,t as Ni}from"./markdown-5FuCZDA4.js";import{a as Pi,c as Fi,d as Ii,f as Li,i as Ri,l as zi,o as Bi,s as Vi,t as Hi,u as Ui}from"./skills-D4P-Hgey.js";import{t as Wi}from"./diff-stat-btAmKFJr.js";import{i as Gi,n as Ki,r as qi}from"./highlighter-C8DK1_sG.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 Ji=class extends qe{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 oe({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=Yi(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=Yi(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=Yi(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=Yi(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){F.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=>lt(t,e))}findAll(e={}){return this.getAll().filter(t=>lt(e,t))}notify(e){F.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return F.batch(()=>Promise.all(e.map(e=>e.continue().catch(Tt))))}};function Yi(e){return e.options.scope?.id}var Xi=class extends qe{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??jt(r,t),a=this.get(i);return a||(a=new Ie({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(){F.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=>He(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>He(e,t)):t}notify(e){F.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){F.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){F.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Zi=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Xi,this.#t=e.mutationCache||new Ji,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Bt.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=i.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(We(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=It(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return F.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;F.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return F.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=F.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(Tt).catch(Tt)}invalidateQueries(e,t={}){return F.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=F.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(Tt)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(Tt)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(We(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Tt).catch(Tt)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Tt).catch(Tt)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return i.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(Ct(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Pt(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Ct(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Pt(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||=jt(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===gt&&(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()}},q=e(t(),1),Qi=n();function $i(e,t){if(e===`ping`)return{project:null,event:{type:`ping`}};let n;try{n=JSON.parse(t)}catch{return null}if(!ea(n))return null;let r=n.project;if(typeof r!=`string`||r===``)return null;switch(e){case`run`:{let{project:e,...t}=n;return ta(t)?{project:r,event:{type:`run`,run:t}}:null}case`run-deleted`:{let e=n.id;return typeof e==`string`&&e?{project:r,event:{type:`run-deleted`,id:e}}:null}case`todos`:return Array.isArray(n.items)?{project:r,event:{type:`todos`,items:n.items}}:null;case`usage`:return ea(n.usage)?{project:r,event:{type:`usage`,usage:n.usage}}:null;default:return null}}function ea(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ta(e){return ea(e)&&typeof e.id==`string`&&e.id!==``}function na(e,t){if(!e)return;let n=e.findIndex(e=>e.id===t.id);if(n>=0){let r=[...e];return r[n]=ia(e[n],t),r}let r=t.createdAt??``,i=e.findIndex(e=>(e.createdAt??``).localeCompare(r)<0),a=[...e];return a.splice(i<0?e.length:i,0,t),a}function ra(e,t){if(!e)return;let n=e.filter(e=>e.id!==t);return n.length===e.length?e:n}function ia(e,t){return e?.usage?{...t,usage:e.usage}:t}var aa=Object.freeze({});function oa(){let e=aa,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 J=r(),sa=on(`/workspace/events`),ca=2,la=3e3,ua=[`run`,`run-deleted`,`todos`,`usage`,`ping`],da=[`project-added`,`project-removed`,`checkout-progress`,`automation-change`],fa=new Set;function pa(e){return fa.add(e),()=>{fa.delete(e)}}var ma=400;function ha(e){let t;return{onEvent(n){n.type!==`run`&&n.type!==`run-deleted`||t===void 0&&(t=setTimeout(()=>{t=void 0,e.invalidateQueries({queryKey:E.runsIndex})},ma))},cancel(){clearTimeout(t),t=void 0}}}function ga(e){e.invalidateQueries({queryKey:L.runs.all}),e.invalidateQueries({queryKey:E.runsIndex}),e.invalidateQueries({queryKey:L.todos}),e.invalidateQueries({queryKey:L.health}),e.invalidateQueries({queryKey:L.worktrees}),e.invalidateQueries({queryKey:E.providerStatus})}function _a(e){return ln()??e.getQueryData(L.health)?.bootProject}function va(e,t,n){switch(n.type){case`run`:{e.setQueryData(L.runs.list(),e=>na(e,n.run));let t=L.runs.detail(n.run.id);e.getQueryData(t)!==void 0&&e.setQueryData(t,e=>ia(e,n.run));let r=L.runs.changes(n.run.id);e.getQueryData(r)!==void 0&&e.invalidateQueries({queryKey:r}),e.invalidateQueries({queryKey:L.worktrees});return}case`run-deleted`:e.setQueryData(L.runs.list(),e=>ra(e,n.id)),e.removeQueries({queryKey:L.runs.detail(n.id)}),e.removeQueries({queryKey:L.runs.diff(n.id)}),e.invalidateQueries({queryKey:L.worktrees});return;case`todos`:e.setQueryData(L.todos,n.items);return;case`usage`:t.set(n.usage);return;case`ping`:return}}function ya(e,t=sa){let n=R();(0,q.useEffect)(()=>{let r=globalThis.EventSource;if(typeof r!=`function`)return;let i=null,a=ha(n),o,s=!1,c=!1,l=!1,u=!1,d=()=>{l=!0,u=!1;let e=E.providerStatus;n.cancelQueries({queryKey:e,exact:!0}).then(()=>n.invalidateQueries({queryKey:e,exact:!0,refetchType:`active`})).finally(()=>{if(c||!u){l=!1;return}d()})},f=()=>{c||o!==void 0||(o=setTimeout(()=>{o=void 0,c||p()},la))},p=()=>{i?.close(),i=new r(t,{withCredentials:!0}),i.addEventListener(`open`,()=>{s&&ga(n),s=!0});for(let t of ua)i.addEventListener(t,r=>{let i=$i(t,r.data);i&&(a.onEvent(i.event),!(i.project!==null&&i.project!==_a(n))&&va(n,e,i.event))});for(let e of da)i.addEventListener(e,t=>{let r;try{r=JSON.parse(t.data)}catch{return}e!==`checkout-progress`&&e!==`automation-change`&&n.invalidateQueries({queryKey:E.projects});for(let t of[...fa])t(e,r)});i.addEventListener(`provider-status`,e=>{let t;try{t=JSON.parse(e.data)}catch{return}let r=_(t);if(!r)return;let i=E.providerStatus,a=y(n.getQueryData(i),r);if(a!==void 0){n.setQueryData(i,a);return}if(l){u=!0;return}d()}),i.addEventListener(`error`,()=>{i?.readyState===ca&&f()})},m=()=>{document.visibilityState===`visible`&&(ga(n),(!i||i.readyState===ca)&&(clearTimeout(o),o=void 0,p()))},h=()=>{clearTimeout(o),o=void 0,i?.close()},g=e=>{e.persisted&&(ga(n),p())};return document.addEventListener(`visibilitychange`,m),window.addEventListener(`pagehide`,h),window.addEventListener(`pageshow`,g),p(),()=>{c=!0,clearTimeout(o),a.cancel(),document.removeEventListener(`visibilitychange`,m),window.removeEventListener(`pagehide`,h),window.removeEventListener(`pageshow`,g),i?.close(),i=null}},[n,e,t])}var ba=(0,q.createContext)(null);function xa({children:e}){let[t]=(0,q.useState)(oa);return ya(t),be(),(0,J.jsx)(ba.Provider,{value:t,children:e})}function Sa(e){let t=(0,q.useContext)(ba),n=t?t.get:wa;return(0,q.useSyncExternalStore)(t?t.subscribe:Ca,()=>e?n()[e]:void 0,()=>void 0)}var Ca=()=>()=>void 0,wa=()=>aa;function Ta(){return new Zi({defaultOptions:{queries:{refetchInterval:!1,staleTime:5*6e4,gcTime:30*6e4,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:(e,t)=>t instanceof Kt&&t.status>=400&&t.status<500?!1:e<1},mutations:{retry:!1}}})}var Ea=V(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),Da=V(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),Oa=V(`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`}]]),ka=V(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),Aa=V(`chevrons-left`,[[`path`,{d:`m11 17-5-5 5-5`,key:`13zhaf`}],[`path`,{d:`m18 17-5-5 5-5`,key:`h8a8et`}]]),ja=V(`chevrons-right`,[[`path`,{d:`m6 17 5-5-5-5`,key:`xnjwq`}],[`path`,{d:`m13 17 5-5-5-5`,key:`17xmmf`}]]),Ma=V(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]),Na=V(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),Pa=V(`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`}]]),Fa=V(`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`}]]),Ia=V(`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`}]]),La=V(`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`}]]),Ra=V(`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`}]]),za=V(`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`}]]),Ba=V(`file-diff`,[[`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:`M9 10h6`,key:`9gxzsh`}],[`path`,{d:`M12 13V7`,key:`h0r20n`}],[`path`,{d:`M9 17h6`,key:`r8uit2`}]]),Va=V(`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`}]]),Ha=V(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 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.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),Ua=V(`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`}]]),Wa=V(`folders`,[[`path`,{d:`M20 5a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h2.5a1.5 1.5 0 0 1 1.2.6l.6.8a1.5 1.5 0 0 0 1.2.6z`,key:`a4852j`}],[`path`,{d:`M3 8.268a2 2 0 0 0-1 1.738V19a2 2 0 0 0 2 2h11a2 2 0 0 0 1.732-1`,key:`yxbcw3`}]]),Ga=V(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),Ka=V(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),qa=V(`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`}]]),Ja=V(`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`}]]),Ya=V(`inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),Xa=V(`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`}]]),Za=V(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),Qa=V(`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`}]]),$a=V(`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`}]]),eo=V(`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`}]]),to=V(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),no=V(`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`}]]),ro=V(`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`}]]),io=V(`notebook-pen`,[[`path`,{d:`M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4`,key:`re6nr2`}],[`path`,{d:`M2 6h4`,key:`aawbzj`}],[`path`,{d:`M2 10h4`,key:`l0bgd4`}],[`path`,{d:`M2 14h4`,key:`1gsvsf`}],[`path`,{d:`M2 18h4`,key:`1bu2t1`}],[`path`,{d:`M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z`,key:`pqwjuv`}]]),ao=V(`package-check`,[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`m16 17 2 2 4-4`,key:`uh5qu3`}],[`path`,{d:`M21 11.127V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.32-.753`,key:`kpkbpo`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}]]),oo=V(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),so=V(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),co=V(`scale`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`m19 8 3 8a5 5 0 0 1-6 0zV7`,key:`zcdpyk`}],[`path`,{d:`M3 7h1a17 17 0 0 0 8-2 17 17 0 0 0 8 2h1`,key:`1yorad`}],[`path`,{d:`m5 8 3 8a5 5 0 0 1-6 0zV7`,key:`eua70x`}],[`path`,{d:`M7 21h10`,key:`1b0cd5`}]]),lo=V(`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`}]]),uo=V(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),fo=V(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),po=V(`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`}]]),mo=V(`workflow`,[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]),ho=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`}),go=`VisuallyHidden`,_o=q.forwardRef((e,t)=>(0,J.jsx)(Yt.span,{...e,ref:t,style:{...ho,...e.style}}));_o.displayName=go;var vo=_o;function yo(e){let t=q.useRef({value:e,previous:e});return q.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var bo=`Label`,xo=q.forwardRef((e,t)=>(0,J.jsx)(Yt.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));xo.displayName=bo;var So=xo,Co=`Switch`,[wo,To]=Ue(Co),[Eo,Do]=wo(Co);function Oo(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]=Be({prop:n,defaultProp:i??!1,onChange:c,caller:Co}),[m,h]=q.useState(null),[g,_]=q.useState(null),v={checked:f,setChecked:p,disabled:a,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:q.useRef(!1),required:l,defaultChecked:i,isFormControl:!m||!!o||!!m.closest(`form`),bubbleInput:g,setBubbleInput:_};return(0,J.jsx)(Eo,{scope:t,...v,children:Io(d)?d(v):r})}var ko=`SwitchTrigger`,Ao=q.forwardRef(({__scopeSwitch:e,onClick:t,...n},r)=>{let{control:i,form:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,isFormControl:p,bubbleInput:m}=Do(ko,e),g=h(r,u),_=q.useRef(c);return q.useEffect(()=>{let e=a?i?.ownerDocument.getElementById(a):i?.form;if(e instanceof HTMLFormElement){let t=()=>d(_.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[i,a,d]),(0,J.jsx)(Yt.button,{type:`button`,role:`switch`,"aria-checked":c,"aria-required":l,"data-state":Lo(c),"data-disabled":s?``:void 0,disabled:s,value:o,...n,ref:g,onClick:Qt(t,e=>{d(e=>!e),m&&p&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})});Ao.displayName=ko;var jo=q.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,J.jsx)(Oo,{__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,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Ao,{...d,ref:t,__scopeSwitch:n}),e&&(0,J.jsx)(Fo,{__scopeSwitch:n})]})})});jo.displayName=Co;var Mo=`SwitchThumb`,No=q.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=Do(Mo,n);return(0,J.jsx)(Yt.span,{"data-state":Lo(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});No.displayName=Mo;var Po=`SwitchBubbleInput`,Fo=q.forwardRef(({__scopeSwitch:e,...t},n)=>{let{control:r,hasConsumerStoppedPropagationRef:i,checked:a,defaultChecked:o,required:s,disabled:c,name:l,value:u,form:d,bubbleInput:f,setBubbleInput:p}=Do(Po,e),m=h(n,p),g=yo(a),_=dr(r);q.useEffect(()=>{let e=f;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!i.current;if(g!==a&&n){let t=new Event(`click`,{bubbles:r});n.call(e,a),e.dispatchEvent(t)}},[f,g,a,i]);let v=q.useRef(a);return(0,J.jsx)(Yt.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:o??v.current,required:s,disabled:c,name:l,value:u,form:d,...t,tabIndex:-1,ref:m,style:{...t.style,..._,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});Fo.displayName=Po;function Io(e){return typeof e==`function`}function Lo(e){return e?`checked`:`unchecked`}var Ro=`Tabs`,[zo,Bo]=Ue(Ro,[mr]),Vo=mr(),[Ho,Uo]=zo(Ro),Wo=q.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=Dr(s),[d,f]=Be({prop:r,onChange:i,defaultProp:a??``,caller:Ro});return(0,J.jsx)(Ho,{scope:n,baseId:ot(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,J.jsx)(Yt.div,{dir:u,"data-orientation":o,...l,ref:t})})});Wo.displayName=Ro;var Go=`TabsList`,Ko=q.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=Uo(Go,n),o=Vo(n);return(0,J.jsx)(Er,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,J.jsx)(Yt.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});Ko.displayName=Go;var qo=`TabsTrigger`,Jo=q.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=Uo(qo,n),s=Vo(n),c=Zo(o.baseId,r),l=Qo(o.baseId,r),u=r===o.value;return(0,J.jsx)(yr,{asChild:!0,...s,focusable:!i,active:u,children:(0,J.jsx)(Yt.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:Qt(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:Qt(e.onKeyDown,e=>{i||e.target!==e.currentTarget||[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:Qt(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});Jo.displayName=qo;var Yo=`TabsContent`,Xo=q.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=Uo(Yo,n),c=Zo(s.baseId,r),l=Qo(s.baseId,r),u=r===s.value,d=q.useRef(u);return q.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,J.jsx)(nt,{present:i||u,children:({present:n})=>(0,J.jsx)(Yt.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})})});Xo.displayName=Yo;function Zo(e,t){return`${e}-trigger-${t}`}function Qo(e,t){return`${e}-content-${t}`}var $o=Wo,es=Ko,ts=Jo,ns=Xo,[rs,is]=Ue(`Tooltip`,[gr]),as=gr(),os=`TooltipProvider`,ss=700,cs=`tooltip.open`,[ls,us]=rs(os),ds=e=>{let{__scopeTooltip:t,delayDuration:n=ss,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=q.useRef(!0),s=q.useRef(!1),c=q.useRef(0);return q.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,J.jsx)(ls,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:q.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:q.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:q.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};ds.displayName=os;var fs=`Tooltip`,[ps,ms]=rs(fs),hs=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=us(fs,e.__scopeTooltip),l=as(t),[u,d]=q.useState(null),f=ot(),p=q.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=q.useRef(!1),[_,v]=Be({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(cs))):c.onClose(),a?.(e)},caller:fs}),y=q.useMemo(()=>_?g.current?`delayed-open`:`instant-open`:`closed`,[_]),b=q.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,v(!0)},[v]),x=q.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),S=q.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,v(!0),p.current=0},h)},[h,v]);return q.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,J.jsx)(_r,{...l,children:(0,J.jsx)(ps,{scope:t,contentId:f,open:_,stateAttribute:y,trigger:u,onTriggerChange:d,onTriggerEnter:q.useCallback(()=>{c.isOpenDelayedRef.current?S():b()},[c.isOpenDelayedRef,S,b]),onTriggerLeave:q.useCallback(()=>{m?x():(window.clearTimeout(p.current),p.current=0)},[x,m]),onOpen:b,onClose:x,disableHoverableContent:m,children:n})})};hs.displayName=fs;var gs=`TooltipTrigger`,_s=q.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=ms(gs,n),a=us(gs,n),o=as(n),s=h(t,q.useRef(null),i.onTriggerChange),c=q.useRef(!1),l=q.useRef(!1),u=q.useCallback(()=>c.current=!1,[]);return q.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,J.jsx)(hr,{asChild:!0,...o,children:(0,J.jsx)(Yt.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:Qt(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:Qt(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:Qt(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:Qt(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:Qt(e.onBlur,i.onClose),onClick:Qt(e.onClick,i.onClose)})})});_s.displayName=gs;var vs=`TooltipPortal`,[ys,bs]=rs(vs,{forceMount:void 0}),xs=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=ms(vs,t);return(0,J.jsx)(ys,{scope:t,forceMount:n,children:(0,J.jsx)(nt,{present:n||a.open,children:(0,J.jsx)(zt,{asChild:!0,container:i,children:r})})})};xs.displayName=vs;var Ss=`TooltipContent`,Cs=q.forwardRef((e,t)=>{let n=bs(Ss,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=ms(Ss,e.__scopeTooltip);return(0,J.jsx)(nt,{present:r||o.open,children:o.disableHoverableContent?(0,J.jsx)(Os,{side:i,...a,ref:t}):(0,J.jsx)(ws,{side:i,...a,ref:t})})}),ws=q.forwardRef((e,t)=>{let n=ms(Ss,e.__scopeTooltip),r=us(Ss,e.__scopeTooltip),i=q.useRef(null),a=h(t,i),[o,s]=q.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=q.useCallback(()=>{s(null),d(!1)},[d]),p=q.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=Ms(r,js(r,n.getBoundingClientRect())),a=Ns(t.getBoundingClientRect()),o=Fs([...i,...a]);s(o),d(!0)},[d]);return q.useEffect(()=>()=>f(),[f]),q.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),q.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!Ps(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,J.jsx)(Os,{...e,ref:a})}),[Ts,Es]=rs(fs,{isInside:!1}),Ds=Oe(`TooltipContent`),Os=q.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=ms(Ss,n),l=as(n),{onClose:u}=c;return q.useEffect(()=>(document.addEventListener(cs,u),()=>document.removeEventListener(cs,u)),[u]),q.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,J.jsx)(Qe,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,J.jsxs)(br,{"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,J.jsx)(Ds,{children:r}),(0,J.jsx)(Ts,{scope:n,isInside:!0,children:(0,J.jsx)(vo,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});Cs.displayName=Ss;var ks=`TooltipArrow`,As=q.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=as(n);return Es(ks,n).isInside?null:(0,J.jsx)(Sr,{...i,...r,ref:t})});As.displayName=ks;function js(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 Ms(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 Ns(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 Ps(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 Fs(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)),Is(t)}function Is(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 Ls=ds,Rs=hs,zs=_s,Bs=xs,Vs=Cs,Hs=As,Us=me(`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-primary text-primary-foreground [a&]:hover:bg-primary/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-primary underline-offset-4 [a&]:hover:underline`}},defaultVariants:{variant:`default`}});function Ws({className:e,variant:t=`default`,asChild:n=!1,...r}){return(0,J.jsx)(n?f:`span`,{"data-slot":`badge`,"data-variant":t,className:H(Us({variant:t}),e),...r})}function Gs({path:e,selected:t,onSelect:n,onEnter:r,decorate:i,emptyHint:a,showHidden:o=!1}){let s=Ne(e,o),c=s.data?.parent??null;return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{"data-slot":`fs-breadcrumb`,className:`truncate font-mono text-[11.5px] text-soft-foreground`,title:s.data?.path??void 0,children:s.data?.path??(s.isError?``:`Loading…`)}),s.isError?(0,J.jsx)(`p`,{"data-slot":`fs-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:s.error instanceof Error?s.error.message:`could not list that folder`}):(0,J.jsxs)(`ul`,{"data-slot":`fs-listing`,className:`max-h-64 divide-y divide-border/60 overflow-y-auto overscroll-contain rounded-md border border-border`,children:[c===null?null:(0,J.jsx)(`li`,{className:`flex`,children:(0,J.jsxs)(`button`,{type:`button`,"data-slot":`fs-up`,onClick:()=>r(c),className:`flex flex-1 items-center gap-2 px-3 py-2 text-left text-[13px] hover:bg-muted`,children:[(0,J.jsx)(Ia,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),`Up one level`]})}),(s.data?.dirs??[]).map(e=>(0,J.jsxs)(`li`,{className:`flex items-stretch`,children:[(0,J.jsxs)(`button`,{type:`button`,"data-slot":`fs-dir`,"aria-pressed":t?.path===e.path,onClick:()=>n(e),onDoubleClick:()=>r(e.path),className:H(`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,J.jsx)(Yr,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`truncate`,children:e.name}),i?.(e)]}),(0,J.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,J.jsx)(ur,{className:`size-3.5`,"aria-hidden":`true`})})]},e.path)),s.data&&s.data.dirs.length===0?(0,J.jsx)(`li`,{className:`px-3 py-2 text-[13px] text-muted-foreground`,children:a}):null]}),s.data?.truncated?(0,J.jsx)(`p`,{"data-slot":`fs-truncated`,className:`text-[11.5px] text-muted-foreground`,children:`Too many folders to list — only the first ones are shown.`}):null]})}function Ks(e,t,n=!1){let r=Ne(e,n);return t?.path??r.data?.path??null}function qs({open:e,onOpenChange:t}){let[n,r]=(0,q.useState)(null),[i,a]=(0,q.useState)(null),o=B(),s=Ve(),c=u(),l=new Set((o.data?.projects??[]).map(e=>e.root)),d=e=>{r(e),a(null),s.reset()},f=Ks(n,i);return(0,J.jsx)(hi,{open:e,onOpenChange:t,children:(0,J.jsxs)(li,{"data-slot":`add-project-dialog`,className:`sm:max-w-lg`,children:[(0,J.jsxs)(ui,{children:[(0,J.jsx)(fi,{children:`Open local folder`}),(0,J.jsx)(mi,{children:`Pick the folder xezar should run in. Git repos are marked; any folder works.`})]}),(0,J.jsx)(Gs,{path:n,selected:i,onSelect:a,onEnter:d,emptyHint:`No subfolders here — “Add project” registers this folder.`,decorate:e=>(0,J.jsxs)(J.Fragment,{children:[e.isRepo?(0,J.jsx)(Ws,{variant:`outline`,className:`shrink-0 text-[10px]`,children:`git`}):null,l.has(e.path)?(0,J.jsx)(Ws,{variant:`ghost`,className:`shrink-0 text-[10px] text-muted-foreground`,children:`already added`}):null]})}),s.isError?(0,J.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,J.jsxs)(gi,{className:`min-w-0 sm:items-center sm:justify-between`,children:[(0,J.jsx)(`span`,{"data-slot":`add-project-target`,className:`min-w-0 truncate font-mono text-[11.5px] text-muted-foreground`,title:f??void 0,children:f??``}),(0,J.jsxs)(`span`,{className:`flex shrink-0 gap-2`,children:[(0,J.jsx)(P,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,J.jsx)(P,{"data-slot":`add-project-confirm`,disabled:f===null||s.isPending,onClick:()=>{f===null||s.isPending||s.mutate(f,{onSuccess:({project:e})=>{t(!1),c(`/p/${encodeURIComponent(e.id)}/`)}})},children:s.isPending?`Adding…`:`Add project`})]})]})]})})}function Js({className:e,type:t,...n}){return(0,J.jsx)(`input`,{type:t,"data-slot":`input`,className:H(`h-9 w-full min-w-0 rounded-md border border-input bg-card px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-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 Ys({className:e,...t}){return(0,J.jsx)(So,{"data-slot":`label`,className:H(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}function Xs({open:e,onOpenChange:t}){let[n,r]=(0,q.useState)(``),[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(null),c=B(),l=Se(),d=u(),f=(0,q.useMemo)(()=>`co-${Math.random().toString(36).slice(2)}-${Date.now().toString(36)}`,[]),p=(0,q.useRef)(f);p.current=f,(0,q.useEffect)(()=>pa((e,t)=>{if(e!==`checkout-progress`)return;let n=t;n?.checkoutId===p.current&&(n.phase===`cloning`&&n.line?s(n.line):n.phase!==`cloning`&&s(null))}),[]);let m=(0,q.useMemo)(()=>{let e=n.trim().replace(/\/+$/,``).replace(/\.git$/,``).split(`/`).pop()??``;return e.includes(`:`)?e.split(`:`).pop()??``:e},[n]),h=i.trim()===``?m:i.trim(),g=c.data?.projectsDir??``,_=h===``?``:`${g.replace(/\/+$/,``)}/${h}`,v=()=>{n.trim()===``||l.isPending||(s(null),l.mutate({url:n.trim(),checkoutId:f,...i.trim()===``?{}:{name:i.trim()}},{onSuccess:({project:e})=>{t(!1),d(`/p/${encodeURIComponent(e.id)}/`)}}))};return(0,J.jsx)(hi,{open:e,onOpenChange:e=>l.isPending?void 0:t(e),children:(0,J.jsxs)(li,{"data-slot":`clone-project-dialog`,className:`sm:max-w-lg`,children:[(0,J.jsxs)(ui,{children:[(0,J.jsx)(fi,{children:`Clone from GitHub`}),(0,J.jsxs)(mi,{children:[`xezar clones with `,(0,J.jsx)(`code`,{children:`gh`}),` into your checkout root and adds the result as a project.`]})]}),(0,J.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,J.jsx)(Ys,{htmlFor:`clone-url`,children:`Repository`}),(0,J.jsx)(Js,{id:`clone-url`,"data-slot":`clone-url`,autoFocus:!0,placeholder:`owner/repo or https://github.com/owner/repo`,value:n,disabled:l.isPending,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&v()}})]}),(0,J.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,J.jsx)(Ys,{htmlFor:`clone-name`,children:`Folder name`}),(0,J.jsx)(Js,{id:`clone-name`,"data-slot":`clone-name`,placeholder:m===``?`repo`:m,value:i,disabled:l.isPending,onChange:e=>a(e.target.value)}),(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,J.jsx)(`p`,{"data-slot":`clone-target`,className:`min-w-0 flex-1 truncate font-mono text-[11.5px] text-soft-foreground`,title:_,children:_}),l.isPending?(0,J.jsx)(P,{"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,J.jsx)(lo,{className:`size-3.5`,"aria-hidden":`true`})}):(0,J.jsx)(P,{asChild:!0,variant:`ghost`,size:`icon-sm`,className:`size-7`,children:(0,J.jsx)(k,{to:`/settings/global/projects`,"data-slot":`clone-root-settings`,"aria-label":`Edit checkout root`,title:`Edit checkout root`,children:(0,J.jsx)(lo,{className:`size-3.5`,"aria-hidden":`true`})})})]})]}),l.isPending?(0,J.jsx)(`p`,{"data-slot":`clone-progress`,className:`truncate font-mono text-[11.5px] text-muted-foreground`,children:o??`Starting the clone…`}):null,l.isError?(0,J.jsx)(`p`,{"data-slot":`clone-error`,className:`text-[13px] text-danger`,children:l.error instanceof Error?l.error.message:`could not clone that repository`}):null,(0,J.jsxs)(gi,{children:[(0,J.jsx)(P,{variant:`outline`,disabled:l.isPending,onClick:()=>t(!1),children:`Cancel`}),(0,J.jsx)(P,{"data-slot":`clone-confirm`,disabled:n.trim()===``||h===``||l.isPending,onClick:v,children:l.isPending?`Cloning…`:`Clone`})]})]})})}function Zs(e){return(0,J.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,...e,children:(0,J.jsx)(`path`,{d:`M12 1.9a10.1 10.1 0 0 0-3.2 19.7c.5.1.7-.2.7-.5v-1.8c-2.8.6-3.4-1.2-3.4-1.2-.5-1.2-1.1-1.5-1.1-1.5-.9-.6.1-.6.1-.6 1 .1 1.5 1 1.5 1 .9 1.6 2.4 1.1 3 .9.1-.7.4-1.1.6-1.4-2.2-.3-4.6-1.1-4.6-5 0-1.1.4-2 1-2.7-.1-.3-.4-1.3.1-2.7 0 0 .9-.3 2.8 1a9.6 9.6 0 0 1 5 0c1.9-1.3 2.8-1 2.8-1 .5 1.4.2 2.4.1 2.7.6.7 1 1.6 1 2.7 0 3.9-2.4 4.7-4.6 5 .4.3.7.9.7 1.9v2.8c0 .3.2.6.7.5A10.1 10.1 0 0 0 12 1.9z`})})}var Qs=[{to:`/`,label:`Tasks`,icon:$a,match:[`/`,`/tasks`,`/compare`],badge:`tasks-unread`},{to:`/inbox`,label:`Inbox`,icon:Ya,match:[`/inbox`],badge:`inbox-count`,inbox:!0},{to:`/git`,label:`Git`,icon:Ka,match:[`/git`]},{to:`/github`,label:`GitHub`,icon:Zs,match:[`/github`],forge:!0},{to:`/automations`,label:`Automations`,icon:cr,match:[`/automations`],forge:!0,automations:!0},{to:`/skills`,label:`Skills`,icon:Zr,match:[`/skills`],badge:`skills-update`},{to:`/workflows`,label:`Workflows`,icon:mo,match:[`/workflows`]},{to:`/settings`,label:`Settings`,icon:lo,match:[`/settings`]}];function $s({forge:e=!1,inbox:t=!1,automations:n=!1}={}){return Qs.filter(r=>(!r.forge||e)&&(!r.inbox||t)&&(!r.automations||n))}function ec(e,t){return t===`/`?e===`/`:e===t||e.startsWith(t+`/`)}function tc(e){let t=null;for(let n of Qs)for(let r of n.match)ec(e,r)&&(t===null||r.length>t.length)&&(t={to:n.to,length:r.length});return t?.to??null}function nc(e){let t=tc(e);return Qs.find(e=>e.to===t)??null}var rc=`xez-theme`,ic=`(prefers-color-scheme: light)`,ac=`dark`;function oc(e){return e===`light`||e===`dark`||e===`system`?e:ac}function sc(e,t){return e===`light`||e===`system`&&t?`light`:`dark`}function cc(){try{return oc(localStorage.getItem(rc))}catch{return ac}}function lc(e){try{localStorage.setItem(rc,e)}catch{}}function uc(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(ic).matches}function dc(e,t){e.classList.toggle(`light`,t===`light`),e.style.colorScheme=t}var fc=q.createContext(null);function pc({children:e}){let[t,n]=q.useState(cc),[r,i]=q.useState(uc);q.useEffect(()=>{let e=window.matchMedia?.(ic);if(!e)return;i(e.matches);let t=e=>i(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let a=sc(t,r);q.useLayoutEffect(()=>{dc(document.documentElement,a)},[a]);let o=q.useCallback(e=>{n(e),lc(e)},[]),s=q.useMemo(()=>({theme:t,resolvedTheme:a,setTheme:o}),[t,a,o]);return(0,J.jsx)(fc.Provider,{value:s,children:e})}function mc(){let e=q.useContext(fc);if(!e)throw Error(`xezar: useTheme() must be called inside <ThemeProvider>`);return e}var hc={light:`dark`,dark:`system`,system:`light`},gc={light:po,dark:ro,system:no},_c={light:`light`,dark:`dark`,system:`system`};function vc({className:e}){let{theme:t,setTheme:n}=mc(),r=hc[t],i=gc[t];return(0,J.jsx)(P,{type:`button`,variant:`ghost`,size:`icon-sm`,className:e,"data-slot":`theme-toggle`,"data-theme-pref":t,title:`Theme: ${_c[t]}`,"aria-label":`Theme: ${_c[t]}. Switch to ${_c[r]}.`,onClick:()=>n(r),children:(0,J.jsx)(i,{"aria-hidden":`true`})})}var yc=`xezar:open-command-palette`;function bc(){window.dispatchEvent(new Event(yc))}function xc(e){return[...e].sort((e,t)=>Date.parse(t.createdAt)-Date.parse(e.createdAt))}function Sc(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 Cc(e,t,n){let r=xc(e).map(e=>({projectId:t,id:e.id,title:e.title,titleSummary:e.titleSummary,titleOrigin:e.titleOrigin,status:e.status,activity:e.activity,createdAt:e.createdAt,finishedAt:e.finishedAt,seenAt:e.seenAt,archived:e.archived,autoResumeAt:e.autoResumeAt,workflow:e.workflow,branch:e.branch,startedAt:e.startedAt})),i=new Set(r.map(wc)),a=(n??[]).filter(e=>!i.has(wc(e))).sort((e,t)=>t.createdAt.localeCompare(e.createdAt));return[...r,...a]}var wc=e=>`${e.projectId??``}/${e.id}`;function Tc(e){let t=e.filter(e=>gn(e)).sort((e,t)=>(t.finishedAt??``).localeCompare(e.finishedAt??``)),n=new Set(t.map(wc));return{recentlyFinished:t,otherTasks:e.filter(e=>!n.has(wc(e)))}}function Ec(e,t){return[...e].sort((e,n)=>Number(e.id===t)-Number(n.id===t)||n.lastOpenedAt.localeCompare(e.lastOpenedAt))}function Dc(){let[e,t]=q.useState(!1),n=vi();Fn(`k`,()=>t(e=>!e));let r=q.useCallback(()=>{t(!1),n(`/new`)},[n]);return Fn(`n`,r),Vn(`c`,r),q.useEffect(()=>{let e=()=>t(!0);return window.addEventListener(yc,e),()=>window.removeEventListener(yc,e)},[]),(0,J.jsx)(zr,{open:e,onOpenChange:t,title:`Command palette`,description:`Search projects, tasks, views, actions, and skills`,showCloseButton:!1,filter:Sc,className:`top-[10vh] translate-y-0 sm:max-w-2xl lg:max-w-3xl xl:max-w-4xl`,children:(0,J.jsx)(kc,{close:()=>t(!1)})})}function Oc({task:e,projectName:t,showProject:n,now:r,onSelect:i}){let a=Oi(e),o=N(e);return(0,J.jsxs)(W,{value:`task ${o} ${e.id}`,keywords:t?[t]:void 0,"data-slot":`palette-task`,"data-run-id":e.id,"data-project-id":e.projectId??void 0,onSelect:()=>i(e),children:[(0,J.jsx)(K,{tone:a.tone,pulse:a.pulse,"aria-label":a.label,role:`img`}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:o}),n&&t?(0,J.jsx)(`span`,{"data-slot":`palette-task-project`,className:`shrink-0 truncate text-xs text-soft-foreground`,children:t}):null,(0,J.jsx)(`span`,{className:`shrink-0 text-xs text-soft-foreground tabular-nums`,children:Mi(e.finishedAt??e.createdAt,r)})]})}function kc({close:e}){let t=vi(),n=u(),[r,i]=q.useState(``),a=r.trim()!==``,s=wi(),{theme:c,setTheme:l}=mc(),d=ye(),f=Te(),p=B(),m=Me(),h=M(),g=Date.now(),_=p.data,v=_!==void 0&&_.projects.length>1,y=S(v),b=q.useMemo(()=>v?Ec(_.projects,s):[],[v,_,s]),x=q.useMemo(()=>new Map((_?.projects??[]).map(e=>[e.id,e.name])),[_]),ee=s??_?.bootProject??null,C=q.useMemo(()=>Cc(d.data??[],ee,y.data?.runs),[d.data,ee,y.data]),te=q.useMemo(()=>Tc(C),[C]),ne=a?[]:te.recentlyFinished,re=a?C:te.otherTasks,w=v,ie=e=>e.projectId===null?null:x.get(e.projectId)??null,T=m.data?.skillUsage,ae=q.useMemo(()=>Vi(f.data??[],T),[f.data,T]),oe=n=>{e(),t(n)},E=t=>{e(),n(t)},se=n=>{e(),t(_i(n,`/`))},D=n=>{e(),t(n.projectId===null?`/tasks/${n.id}`:_i(n.projectId,`/tasks/${n.id}`))},ce=hc[c];return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Ar,{placeholder:`Search projects, tasks, views, actions, skills…`,value:r,onValueChange:i}),(0,J.jsxs)(Jr,{className:`max-h-[55vh] min-h-[14rem] sm:max-h-[60vh] lg:max-h-[68vh]`,children:[(0,J.jsx)(Ir,{children:`Nothing matches.`}),(0,J.jsx)(U,{children:(0,J.jsxs)(W,{value:`new task`,"data-slot":`palette-view`,"data-nav-to":`/new`,onSelect:()=>oe(`/new`),children:[(0,J.jsx)(so,{"aria-hidden":`true`}),`New task`,(0,J.jsx)(qr,{children:`C`})]})}),!a&&ne.length>0?(0,J.jsx)(U,{heading:`Recently finished`,children:ne.map(e=>(0,J.jsx)(Oc,{task:e,projectName:ie(e),showProject:w,now:g,onSelect:D},wc(e)))}):null,(0,J.jsxs)(U,{heading:`Views`,children:[v?(0,J.jsxs)(W,{value:`view All tasks`,"data-slot":`palette-view`,"data-nav-to":`/tasks`,onSelect:()=>E(`/tasks`),children:[(0,J.jsx)(Za,{"aria-hidden":`true`}),`All tasks`]}):null,$s({forge:h.data?.forge?.available===!0,inbox:h.data?.capabilities.followups===!0,automations:h.data?.capabilities.automations===!0}).map(e=>{let t=e.icon;return(0,J.jsxs)(W,{value:`view ${e.label}`,"data-slot":`palette-view`,"data-nav-to":e.to,onSelect:()=>oe(e.to),children:[(0,J.jsx)(t,{"aria-hidden":`true`}),e.label]},e.to)})]}),b.length>0?(0,J.jsx)(U,{heading:`Projects`,children:b.map(e=>{let t=e.id===s,n=e.status===`missing`;return(0,J.jsxs)(W,{value:`project ${e.name} ${e.id}`,keywords:[e.root],"data-slot":`palette-project`,"data-project-id":e.id,disabled:n,onSelect:()=>se(e.id),children:[(0,J.jsx)(Ha,{"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),n?(0,J.jsx)(`span`,{className:`shrink-0 text-xs text-soft-foreground`,children:`folder not found`}):e.branch===void 0?null:(0,J.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-soft-foreground`,children:e.branch}),t?(0,J.jsx)(o,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e.id)})}):null,re.length>0?(0,J.jsx)(U,{heading:`Tasks`,children:re.map(e=>(0,J.jsx)(Oc,{task:e,projectName:ie(e),showProject:w,now:g,onSelect:D},wc(e)))}):null,(0,J.jsx)(U,{heading:`Actions`,children:(0,J.jsxs)(W,{value:`action toggle theme`,"data-slot":`palette-action`,"data-action":`toggle-theme`,onSelect:()=>{l(ce),e()},children:[(0,J.jsx)(ro,{"aria-hidden":`true`}),`Toggle theme`,(0,J.jsxs)(qr,{className:`tracking-normal`,children:[c,` → `,ce]})]})}),ae.length>0?(0,J.jsx)(U,{heading:`Skills`,children:ae.map(e=>(0,J.jsxs)(W,{value:`skill ${e.name} ${e.path}`,keywords:e.description?[e.description]:void 0,"data-slot":`palette-skill`,"data-skill":e.name,onSelect:()=>oe(`/new?skill=${encodeURIComponent(e.name)}`),children:[(0,J.jsx)(`span`,{className:`shrink-0 font-medium`,children:e.name}),e.description?(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null]},e.path))}):null]})]})}var Ac=`xez-sidebar-width`;function jc(e){let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?Math.min(420,Math.max(264,Math.round(t))):264}function Mc(){try{let e=localStorage.getItem(Ac);return e===null?264:jc(e)}catch{return 264}}function Nc(e){try{localStorage.setItem(Ac,String(jc(e)))}catch{}}var Pc=`/xezar.svg`,Fc=`(min-width: 768px)`,Ic=q.createContext(void 0);function Lc(){return q.useContext(Ic)}function Rc(e){return we({path:`/tasks/:id`,end:!0},Si(e))!==null}function zc({children:e,repo:t=null,inboxCount:n=null,unreadCount:r=null,skillsUpdateAvailable:i=!1,version:a=null,latestVersion:o=null,taskQuickList:s,toolsMenu:c,forgeAvailable:l=!0,inboxAvailable:u=!0,automationsAvailable:d=!0,singleProject:f=!1,banner:p,projectGroups:m}){let{pathname:h}=rn(),g=Si(h),_=tc(g),v=nc(g),[y,b]=q.useState(!1),x=q.useRef(null),S=Rc(h),[ee,C]=q.useState(Mc),te=q.useCallback(e=>{let t=jc(e);C(t),Nc(t)},[]);q.useLayoutEffect(()=>{if(S)return;let e=x.current;e&&(e.scrollTop=0)},[h,S]),q.useEffect(()=>{b(!1)},[h]),q.useEffect(()=>{let e=window.matchMedia?.(Fc);if(!e)return;e.matches&&b(!1);let t=e=>{e.matches&&b(!1)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let ne={activeTo:_,items:$s({forge:l,inbox:u,automations:d}),repo:t,inboxCount:u?n:null,unreadCount:r,skillsUpdateAvailable:i,version:a,latestVersion:o,taskQuickList:s,toolsMenu:c,projectGroups:m,singleProject:f};return(0,J.jsx)(Ln,{open:y,onOpenChange:b,children:(0,J.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,J.jsx)(Bc,{...ne,width:ee,onWidthChange:te}),(0,J.jsx)(Hc,{...ne,onNavigate:()=>b(!1)}),(0,J.jsxs)(`div`,{className:`grid min-w-0 flex-1 grid-rows-[auto_auto_1fr_auto] overflow-hidden`,children:[(0,J.jsx)(Xc,{title:v?.label??`xezar`}),p?(0,J.jsx)(`div`,{"data-slot":`banner-slot`,className:`row-start-2`,children:p}):null,(0,J.jsx)(`main`,{ref:x,"data-slot":`main`,className:`row-start-3 min-h-0 overflow-y-auto overscroll-contain`,children:e}),(0,J.jsx)(`div`,{"data-slot":`composer`,className:`row-start-4 pb-[env(safe-area-inset-bottom)]`})]})]})})}function Bc({width:e,onWidthChange:t,...n}){return(0,J.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,J.jsx)(Uc,{...n}),(0,J.jsx)(Vc,{width:e,onWidthChange:t})]})}function Vc({width:e,onWidthChange:t}){let n=q.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(jc(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,J.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(jc(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-violet/40 focus-visible:bg-violet/60 focus-visible:outline-none`})}function Hc({onNavigate:e,...t}){return(0,J.jsxs)(Bn,{side:`left`,"data-slot":`mobile-nav-drawer`,showCloseButton:!1,className:`w-[264px] gap-0 border-border bg-sidebar p-0 sm:max-w-none md:hidden`,"aria-describedby":void 0,children:[(0,J.jsx)(Rn,{className:`sr-only`,children:`Navigation`}),(0,J.jsx)(Uc,{...t,onNavigate:e,headerAction:(0,J.jsx)(Nn,{asChild:!0,children:(0,J.jsx)(P,{variant:`ghost`,size:`icon`,"aria-label":`Close menu`,className:`-mr-2 size-11`,children:(0,J.jsx)($r,{className:`size-[17px]`,"aria-hidden":`true`})})})})]})}function Uc({activeTo:e,items:t,repo:n,inboxCount:r,unreadCount:i,skillsUpdateAvailable:a,version:o,latestVersion:s,taskQuickList:c,toolsMenu:l,projectGroups:u,singleProject:d,onNavigate:f,headerAction:p}){return(0,J.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,J.jsxs)(`div`,{className:`flex items-center gap-[9px] px-3.5 pt-3.5 pb-2.5`,children:[(0,J.jsx)(Yc,{}),(0,J.jsx)(`span`,{className:`text-[15px] font-semibold`,children:`xezar`}),n&&!u?(0,J.jsxs)(`span`,{"data-slot":`repo-chip`,className:`ml-auto truncate font-mono text-[11px] font-medium text-soft-foreground`,children:[n.name,` / `,n.branch]}):null,p?(0,J.jsx)(`div`,{className:H(`shrink-0`,(!n||u)&&`ml-auto`),children:p}):null]}),(0,J.jsxs)(`div`,{className:`flex gap-1.5 px-2.5 pt-1 pb-2`,children:[(0,J.jsx)(P,{asChild:!0,variant:`contrast`,className:`relative min-w-0 flex-1 justify-center`,children:(0,J.jsxs)(G,{to:`/new`,onClick:f,children:[(0,J.jsx)(so,{className:`size-[15px]`,"aria-hidden":`true`}),`New task`,(0,J.jsx)(`kbd`,{"aria-hidden":`true`,className:`absolute right-2.5 rounded-[5px] border border-b-2 border-contrast-foreground/25 bg-transparent px-[5px] py-px font-mono text-[10.5px] font-medium text-contrast-foreground/60`,children:`C`})]})}),d?null:(0,J.jsx)(Kc,{})]}),u?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`shrink-0 border-b border-border px-1.5 pt-0.5 pb-2`,children:(0,J.jsx)(Wc,{onNavigate:f})}),(0,J.jsx)(`div`,{"data-slot":`project-groups`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-1.5 pt-1.5 pb-2`,children:(0,J.jsx)(Ic.Provider,{value:f,children:u})})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`nav`,{"aria-label":`Main`,className:`px-2.5 py-1.5`,children:t.map(t=>{let n=t.to===e,o=t.icon;return(0,J.jsxs)(G,{to:t.to,onClick:f,"aria-current":n?`page`:void 0,className:H(`flex h-11 w-full items-center gap-2.5 rounded-md px-2.5 text-[13.5px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground md:h-[34px]`,n&&`bg-muted font-semibold text-foreground`),children:[(0,J.jsx)(o,{className:`size-4 shrink-0`,"aria-hidden":`true`}),t.label,t.badge===`inbox-count`&&r?(0,J.jsx)(`span`,{"data-slot":`nav-badge`,className:`ml-auto rounded-full bg-violet px-1.5 py-px text-[10.5px] font-semibold text-violet-foreground`,children:r}):null,t.badge===`tasks-unread`&&i?(0,J.jsx)(`span`,{"data-slot":`nav-unread-badge`,title:`${i} unread finished ${i===1?`task`:`tasks`}`,className:`ml-auto rounded-full bg-violet px-1.5 py-px text-[10.5px] font-semibold text-violet-foreground`,children:i}):null,t.badge===`skills-update`&&a?(0,J.jsxs)(`span`,{"data-slot":`nav-update-marker`,className:`ml-auto flex items-center`,children:[(0,J.jsx)(`span`,{className:`size-1.5 rounded-full bg-violet`,"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`sr-only`,children:`Skills update available`})]}):null]},t.to)})}),(0,J.jsx)(`div`,{"data-slot":`task-quick-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-2.5 pb-2`,children:c})]}),(0,J.jsxs)(`div`,{"data-slot":`sidebar-footer`,className:`flex flex-col gap-1.5 border-t border-border px-3.5 py-2.5`,children:[(0,J.jsx)(qc,{}),(0,J.jsxs)(`div`,{"data-slot":`sidebar-footer-controls`,className:`flex items-center gap-2`,children:[(0,J.jsx)(`div`,{"data-slot":`tools-menu`,className:`shrink-0`,children:l}),o?(0,J.jsx)(Jc,{version:o,latestVersion:s}):null,(0,J.jsx)(Gc,{onNavigate:f,className:`ml-auto`}),(0,J.jsx)(vc,{})]})]})]})}function Wc({onNavigate:e}){let{pathname:t}=rn(),n=t===`/tasks`;return(0,J.jsxs)(k,{to:`/tasks`,"data-slot":`all-tasks-link`,onClick:e,"aria-current":n?`page`:void 0,className:H(`flex h-11 w-full items-center gap-2.5 rounded-md px-2.5 text-[13.5px] font-semibold text-foreground transition-colors hover:bg-muted md:h-9`,n&&`bg-muted`),children:[(0,J.jsx)(Za,{className:H(`size-4 shrink-0`,n?`text-violet`:`text-violet/70`),"aria-hidden":`true`}),`All tasks`]})}function Gc({className:e,onNavigate:t}){return(0,J.jsx)(P,{asChild:!0,variant:`ghost`,size:`icon`,className:H(`size-7`,e),children:(0,J.jsx)(k,{to:`/settings/global`,"data-slot":`global-settings-link`,"aria-label":`Global settings`,title:`Global settings`,onClick:t,children:(0,J.jsx)(lo,{className:`size-4`,"aria-hidden":`true`})})})}function Kc(){let[e,t]=q.useState(!1),[n,r]=q.useState(!1);return(0,J.jsxs)(Tr,{children:[(0,J.jsx)(pr,{asChild:!0,children:(0,J.jsx)(P,{variant:`outline`,size:`icon`,"aria-label":`Add project`,title:`Add project`,className:`size-11 shrink-0 md:size-9`,children:(0,J.jsx)(Ha,{className:`size-4`,"aria-hidden":`true`})})}),(0,J.jsxs)(xr,{align:`start`,className:`w-56`,children:[(0,J.jsx)(vr,{className:`text-xs text-soft-foreground`,children:`Add project`}),(0,J.jsxs)(Cr,{"data-slot":`add-project-local`,onSelect:()=>t(!0),children:[(0,J.jsx)(Yr,{"aria-hidden":`true`}),`Open local folder…`]}),(0,J.jsxs)(Cr,{"data-slot":`add-project-clone`,onSelect:()=>r(!0),children:[(0,J.jsx)(Zs,{"aria-hidden":`true`}),`Clone from GitHub…`]})]}),e?(0,J.jsx)(qs,{open:!0,onOpenChange:t}):null,n?(0,J.jsx)(Xs,{open:!0,onOpenChange:r}):null]})}function qc(){return(0,J.jsxs)(`button`,{type:`button`,"data-slot":`command-palette-hint`,title:`Search — command palette (⌘K / Ctrl+K)`,onClick:()=>bc(),className:`flex w-full items-center gap-1.5 rounded-md border border-border bg-muted/30 px-2 py-1 text-left text-xs font-medium text-soft-foreground transition-colors hover:bg-muted hover:text-foreground`,children:[(0,J.jsx)(kr,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`truncate`,children:`Search…`}),(0,J.jsx)(`kbd`,{"aria-hidden":`true`,className:`ml-auto shrink-0 rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-[10.5px] font-medium text-muted-foreground`,children:Pn(`k`)})]})}function Jc({version:e,latestVersion:t}){let n=!!(t&&t!==e);return(0,J.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 rounded-full border border-border px-1.5 py-px font-mono text-[10px] font-medium text-soft-foreground`,children:[n?(0,J.jsx)(K,{tone:`pending`,pulse:!0,className:`size-[5px] shrink-0`}):null,(0,J.jsxs)(`span`,{className:`truncate`,children:[`v`,e]})]})}function Yc(){return(0,J.jsx)(`img`,{src:Pc,alt:``,"aria-hidden":`true`,"data-slot":`brand-tile`,className:`size-[26px] shrink-0 rounded-sm`})}function Xc({title:e}){return(0,J.jsx)(`header`,{"data-slot":`mobile-top-bar`,className:`row-start-1 border-b border-border bg-card pt-[env(safe-area-inset-top)] md:hidden`,children:(0,J.jsxs)(`div`,{className:`flex h-11 items-center gap-2.5 px-3`,children:[(0,J.jsx)(Wn,{asChild:!0,children:(0,J.jsx)(P,{variant:`ghost`,size:`icon`,"aria-label":`Open menu`,className:`-ml-1.5 size-11`,children:(0,J.jsx)(to,{className:`size-[17px]`,"aria-hidden":`true`})})}),(0,J.jsx)(`span`,{className:`truncate text-[14.5px] font-semibold`,children:e}),(0,J.jsx)(`div`,{"data-slot":`mobile-status`,className:`ml-auto flex items-center gap-2`})]})})}var Zc=q.createContext(null);function Qc({children:e}){let[t,n]=q.useState(`active`),r=q.useMemo(()=>[t,n],[t]);return(0,J.jsx)(Zc.Provider,{value:r,children:e})}function $c(){let e=q.useContext(Zc);if(!e)throw Error(`useListView must be used inside a <ListViewProvider>`);return e}var el=[`claude`,`codex`,`opencode`,`pi`],tl={claude:`Claude Code`,codex:`Codex`,opencode:`OpenCode`,pi:`pi`};function nl(e){if(typeof e!=`object`||!e||Array.isArray(e))return{};let t=e,n={};for(let e of el){let r=t[e];typeof r==`string`&&r.length>0&&r.length<=128&&(n[e]=r)}return n}function rl(e,t){if(!e)return[];let n=new Map(e.providers.map(e=>[e.provider,e]));return el.flatMap(e=>{let r=n.get(e);return r?.status!==`disconnected`||!r.authFailureId||t[e]===r.authFailureId?[]:[{provider:e,label:tl[e],authFailureId:r.authFailureId}]})}function il(e,t){return{...e,...Object.fromEntries(t.map(({provider:e,authFailureId:t})=>[e,t]))}}function al({status:e,pending:t,error:n,dismissals:r,onDismissAuthFailures:i}){if(t||!e)return null;let a;try{a=he(e)}catch{return null}let o=rl(a,r);if(o.length>0)return(0,J.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,J.jsx)(K,{tone:`danger`}),(0,J.jsxs)(`span`,{children:[`Provider authentication failed during a task:`,` `,o.map(({label:e})=>e).join(`, `),`.`]}),(0,J.jsx)(G,{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,J.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,J.jsx)($r,{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,J.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,J.jsx)(K,{tone:c?`danger`:`pending`}),(0,J.jsx)(`span`,{children:s?`No agent provider is enabled.`:c?`No connected provider could be verified.`:`No agent provider credentials were found.`}),(0,J.jsx)(G,{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 ol(e){if(!(typeof e!=`object`||!e||Array.isArray(e)))return e}function sl(){let e=Ye(),t=ce(),n=R(),r=(0,q.useRef)(Promise.resolve()),i=(0,q.useRef)(0),a=(0,q.useRef)(0),o=(0,q.useRef)(ol(t.data));(0,q.useEffect)(()=>{a.current===0&&(o.current=ol(t.data))},[t.data]);let s=(0,q.useCallback)(e=>{let t=E.uiState,s=ol(n.getQueryData(t)),c=il(nl(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 ct({dismissedProviderAuthFailures:c});o.current=ol(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}),I(e instanceof Error?e.message:String(e),{tone:`danger`}))}finally{--a.current}})},[n]);return(0,J.jsx)(al,{status:e.data,pending:e.isPending,error:e.isError,dismissals:nl(ol(t.data)?.dismissedProviderAuthFailures),onDismissAuthFailures:s})}function cl({pinned:e,onToggle:t,className:n}){return(0,J.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:H(`inline-flex size-5 shrink-0 items-center justify-center rounded-sm text-soft-foreground transition-colors hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,e&&`text-violet hover:text-violet`,n),children:(0,J.jsx)(kn,{className:H(`size-3`,e&&`fill-current`),"aria-hidden":`true`})})}function ll({runs:e,view:t,onViewChange:n,currentRunId:r=null,now:i=Date.now(),showTokens:a=!0,showCost:o=!0,onTogglePin:s}){let c=yt(e),l=$e(e,t),u=t===`archived`?void 0:s;return(0,J.jsxs)(`div`,{"data-slot":`quick-list`,children:[(0,J.jsx)(`div`,{className:`sticky top-0 z-10 bg-sidebar pt-2 pb-1`,children:(0,J.jsxs)(`div`,{className:`inline-flex w-full gap-0.5 rounded-md bg-muted p-[3px]`,children:[(0,J.jsxs)(dl,{view:`active`,current:t,onSelect:n,count:c.active,children:[`Active`,c.waiting>0&&t!==`active`?(0,J.jsx)(K,{tone:`pending`,pulse:!0,"data-slot":`waiting-dot`,"aria-label":`needs you`}):null]}),(0,J.jsx)(dl,{view:`archived`,current:t,onSelect:n,count:c.archived,children:`Archived`})]})}),l.length===0?(0,J.jsx)(`p`,{className:`px-3 py-3.5 text-xs text-soft-foreground`,children:t===`archived`?`Nothing archived yet.`:`No tasks yet — describe one.`}):(0,J.jsx)(ul,{buckets:l,currentRunId:r,now:i,showTokens:a,showCost:o,onTogglePin:u})]})}function ul({buckets:e,currentRunId:t=null,now:n=Date.now(),scope:r=null,showTokens:i=!0,showCost:a=!0,onTogglePin:o}){let[s,c]=q.useState(()=>new Set),l=e=>c(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n});return(0,J.jsx)(J.Fragment,{children:e.map(e=>(0,J.jsxs)(`div`,{"data-slot":`quick-list-bucket`,"data-bucket":e.label,children:[(0,J.jsx)(`h2`,{className:`px-3 pt-2.5 pb-1 text-[11px] font-semibold tracking-[0.04em] text-soft-foreground uppercase`,children:e.label}),e.rows.map(e=>(0,J.jsx)(fl,{row:e,currentRunId:t,now:n,scope:r,showTokens:i,showCost:a,expanded:e.kind===`group`&&s.has(e.groupId),onToggle:l,onTogglePin:o},e.kind===`group`?e.groupId:e.run.id))]},e.label))})}function dl({view:e,current:t,onSelect:n,count:r,children:i}){let a=e===t;return(0,J.jsxs)(`button`,{type:`button`,"data-slot":`view-tab`,"data-view":e,"aria-pressed":a,onClick:()=>n(e),className:H(`flex h-7 flex-1 items-center justify-center gap-1.5 rounded-[7px] text-[12.5px] font-medium text-muted-foreground`,a&&`bg-card font-semibold text-foreground shadow-xs`),children:[i,r>0?(0,J.jsx)(`span`,{className:`font-mono text-[11px] tabular-nums`,children:r}):null]})}function fl({row:e,currentRunId:t,now:n,scope:r,expanded:i,onToggle:a,showTokens:o,showCost:s,onTogglePin:c}){return e.kind===`run`?(0,J.jsx)(ml,{run:e.run,queuePosition:e.queuePosition,currentRunId:t,now:n,scope:r,showTokens:o,showCost:s,onTogglePin:c}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`flex items-center rounded-sm hover:bg-muted`,children:[(0,J.jsxs)(`button`,{type:`button`,"data-slot":`group-tile`,"data-group-id":e.groupId,"aria-expanded":i,onClick:()=>a(e.groupId),className:`flex min-w-0 flex-1 items-center gap-2 px-2.5 py-[7px] text-left`,children:[(0,J.jsx)(Gn,{className:H(`size-3 shrink-0 text-soft-foreground transition-transform`,!i&&`-rotate-90`),"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`min-w-[7rem] flex-1 truncate text-[13px] font-medium`,children:e.title}),(0,J.jsxs)(`span`,{className:`shrink-0 rounded-full bg-muted px-1.5 py-px font-mono text-[10.5px] font-semibold text-muted-foreground`,children:[`×`,e.members.length]})]}),(0,J.jsx)(G,{to:_i(r,`/compare/${e.groupId}`),"data-slot":`group-compare`,title:`Compare the variants`,"aria-label":`Compare the variants of ${e.title}`,className:`mr-1.5 inline-flex size-6 shrink-0 items-center justify-center rounded-sm text-soft-foreground hover:bg-violet/10 hover:text-violet`,children:(0,J.jsx)(co,{className:`size-3.5`,"aria-hidden":`true`})})]}),i?e.members.map(e=>(0,J.jsx)(ml,{run:e,queuePosition:null,currentRunId:t,now:n,scope:r,variant:!0,showTokens:o,showCost:s,onTogglePin:c},e.id)):null]})}var pl=`w-0 overflow-hidden opacity-0 group-hover/task-row:mr-1 group-hover/task-row:w-5 group-hover/task-row:opacity-100 group-focus-within/task-row:mr-1 group-focus-within/task-row:w-5 group-focus-within/task-row:opacity-100 no-hover:mr-1 no-hover:size-7 no-hover:opacity-100 data-[pinned=true]:mr-1 data-[pinned=true]:w-5 data-[pinned=true]:opacity-100`;function ml({run:e,queuePosition:t,currentRunId:n,now:r,scope:i,variant:a=!1,showTokens:o,showCost:s,onTogglePin:c}){let l=Oi(e),u=e.id===n,d=Ft(e),f=N(e),p=rt(f,d?.number)?$t(f).rest:f,m=gn(e),h=An(e),g=a?``:t===null?Mi(e.finishedAt??e.createdAt,r):`#${t}`;return(0,J.jsxs)(`div`,{"data-slot":`task-row`,"data-run-id":e.id,"data-active":u?`true`:void 0,className:H(`group/task-row flex items-center gap-2 rounded-sm pl-2.5 hover:bg-muted`,u&&`bg-muted`,a&&`pl-[26px]`),children:[(0,J.jsx)(K,{tone:l.tone,pulse:l.pulse,"aria-label":l.label,role:`img`}),d?(0,J.jsx)(yn,{run:e,reference:d,compact:!0,className:`h-auto shrink-0 gap-[2px] px-1.5 py-px text-[10.5px]`}):null,(0,J.jsxs)(G,{to:_i(i,`/tasks/${e.id}`),title:f,"aria-current":u?`page`:void 0,className:`flex min-w-0 flex-1 items-center gap-2 py-[7px] pr-2.5`,children:[a?(0,J.jsx)(`span`,{className:`inline-flex size-[15px] shrink-0 items-center justify-center rounded-full bg-violet/15 font-mono text-[9.5px] font-semibold text-violet`,children:e.variant??`?`}):null,(0,J.jsx)(`span`,{"data-slot":`task-row-title`,className:H(`min-w-[7rem] flex-1 truncate text-[13px]`,m?`font-semibold text-foreground`:h?`font-medium text-muted-foreground`:`font-medium`),children:a?hl(e,o,s):p}),e.diffStat?(0,J.jsx)(Wi,{stat:e.diffStat,className:`hidden shrink-0 text-[10.5px] @min-[23rem]/sidebar:inline`}):null,g&&(t!==null||!d)?(0,J.jsx)(`span`,{className:`shrink-0 text-[11px] text-soft-foreground tabular-nums`,children:g}):null,m?(0,J.jsx)(K,{tone:`violet`,role:`img`,"aria-label":`unread`,title:`Unread — not opened since it finished`,className:`ml-0.5 shrink-0`}):null]}),c?(0,J.jsx)(cl,{pinned:!!e.pinned,onToggle:t=>c(e,t),className:pl}):null]})}function hl(e,t,n){let r=[e.runner??`claude`];t&&(e.inputTokens!==void 0||e.outputTokens!==void 0)?r.push(Ei(e.inputTokens,e.outputTokens)):t&&e.tokensUsed&&r.push(Ti(e.tokensUsed,!1));let i=Lt(e.costUsd);return n&&i&&r.push(i),r.join(` · `)}function gl(){let e=ye(),t=Et(),n=Di(M().data),[r,i]=$c(),a=bi(`/tasks/:id/*`),o=bi(`/tasks/:id`),s=Hn(3e4),c=xt(),l=q.useMemo(()=>c===void 0?[]:(e.data??[]).flatMap(e=>{let t=Ft(e);return t?[{projectId:c,kind:t.kind,number:t.number}]:[]}),[e.data,c]);return e.data?(0,J.jsx)(On,{projectId:c,requests:l,children:(0,J.jsx)(ll,{runs:e.data,view:r,onViewChange:i,currentRunId:a?.params.id??o?.params.id??null,now:s,showTokens:n.tokens,showCost:n.cost,onTogglePin:(e,n)=>t.mutate({id:e.id,pinned:n},{onError:e=>I(e.message,{tone:`danger`})})})}):null}var _l=`xez-sidebar-collapsed`;function vl(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 yl(){try{let e=localStorage.getItem(_l);return e===null?{}:vl(JSON.parse(e))}catch{return{}}}function bl(e){try{localStorage.setItem(_l,JSON.stringify(e))}catch{}}function xl(e,t,n){let r=e?.[t];return r===void 0?t!==n:r}var Sl=10;function Cl(e){let[t,n]=q.useState(yl),r=q.useRef(t);return{collapsed:t,toggle:q.useCallback(t=>{let i={...r.current,[t]:!xl(r.current,t,e)};r.current=i,bl(i),n(i)},[e])}}function wl({projects:e,bootProjectId:t,inboxAvailable:n=!1,automationsAvailable:r=!1,inboxCount:i=null,skillsUpdateAvailable:a=!1}){let{pathname:o}=rn(),s=yi(o),c=s??t,{collapsed:l,toggle:u}=Cl(c),[d]=$c(),f=tc(Si(o)),p=bi(`/tasks/:id/*`),m=bi(`/tasks/:id`),h=p?.params.id??m?.params.id??null,g=Hn(3e4),_=Di(M().data);return(0,J.jsx)(`div`,{"data-slot":`project-group-list`,children:q.useMemo(()=>[...e].sort((e,t)=>t.lastOpenedAt.localeCompare(e.lastOpenedAt)),[e]).map(e=>(0,J.jsx)(Tl,{project:e,boot:e.id===t,active:e.id===s,collapsed:xl(l,e.id,c),onToggle:u,view:d,activeTo:f,currentRunId:h,now:g,inboxAvailable:n,automationsAvailable:r,inboxCount:i,skillsUpdateAvailable:a,showTokens:_.tokens,showCost:_.cost},e.id))})}function Tl({project:e,boot:t,active:n,collapsed:r,onToggle:i,view:a,activeTo:o,currentRunId:s,now:c,inboxAvailable:l,automationsAvailable:u,inboxCount:d,skillsUpdateAvailable:f,showTokens:p,showCost:m}){let h=e.status===`missing`,g=vt(e.id,!r&&!h,t),_=Lc(),v=Et(e.id,t?`default`:e.id),y=g.data?yt(g.data).waiting:0,b=g.data?Je($e(g.data,a),Sl):[],x=b.flatMap(t=>t.rows.flatMap(t=>{let n=Ft(t.kind===`run`?t.run:t.members[0]);return n?[{projectId:e.id,kind:n.kind,number:n.number}]:[]}));if(h)return(0,J.jsx)(`div`,{"data-slot":`project-group`,"data-project":e.id,"data-status":`missing`,className:`mb-1`,children:(0,J.jsxs)(`div`,{"data-slot":`project-group-header`,title:`${e.root} is gone — remove it in Global settings → Projects`,className:`flex h-11 w-full items-center gap-[7px] rounded-lg px-2 text-[13px] font-semibold opacity-55 md:h-[34px]`,children:[(0,J.jsx)(`span`,{className:`w-3 shrink-0`,"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`truncate`,children:e.name}),(0,J.jsx)(`span`,{"data-slot":`project-missing`,className:`ml-auto shrink-0 rounded-full bg-danger/15 px-[7px] py-px text-[10px] font-medium text-danger`,children:`folder not found`})]})});let S=`project-group-${e.id}`;return(0,J.jsxs)(`div`,{"data-slot":`project-group`,"data-project":e.id,"data-status":e.status,"data-collapsed":r?``:void 0,"data-active":n?``:void 0,className:`mb-1`,children:[(0,J.jsxs)(`button`,{type:`button`,onClick:()=>i(e.id),"aria-expanded":!r,"aria-controls":S,"data-slot":`project-group-header`,className:H(`flex h-11 w-full items-center gap-[7px] rounded-lg px-2 text-left text-[13px] font-semibold transition-colors hover:bg-muted md:h-[34px]`,n&&`bg-muted`),children:[(0,J.jsx)(Gn,{className:H(`size-3 shrink-0 text-muted-foreground transition-transform`,r&&`-rotate-90`),"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`truncate`,children:e.name}),y?(0,J.jsx)(`span`,{"data-slot":`project-attention`,title:`${y} task${y===1?``:`s`} need${y===1?`s`:``} you`,className:`shrink-0 rounded-full bg-violet px-1.5 py-px text-[10.5px] font-semibold text-violet-foreground`,children:y}):null,e.branch?(0,J.jsx)(`span`,{"data-slot":`project-branch`,className:`ml-auto max-w-[92px] truncate font-mono text-[10.5px] font-medium text-soft-foreground`,children:e.branch}):null]}),r?null:(0,J.jsxs)(`div`,{id:S,"data-slot":`project-group-body`,className:`mt-1 ml-[14px] border-l border-border pl-2`,children:[(0,J.jsx)(`nav`,{"aria-label":`${e.name} navigation`,children:$s({forge:e.forge===`github`,inbox:l,automations:u}).map(t=>{let r=n&&t.to===o,i=t.icon;return(0,J.jsxs)(G,{to:_i(e.id,t.to),onClick:_,"aria-current":r?`page`:void 0,className:H(`flex h-11 w-full items-center gap-2.5 rounded-md px-2.5 text-[13px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground md:h-[30px]`,r&&`bg-muted font-semibold text-foreground`),children:[(0,J.jsx)(i,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),t.label,t.badge===`inbox-count`&&n&&d?(0,J.jsx)(`span`,{"data-slot":`nav-badge`,className:`ml-auto rounded-full bg-violet px-1.5 py-px text-[10.5px] font-semibold text-violet-foreground`,children:d}):null,t.badge===`skills-update`&&n&&f?(0,J.jsxs)(`span`,{"data-slot":`nav-update-marker`,className:`ml-auto flex items-center`,children:[(0,J.jsx)(`span`,{className:`size-1.5 rounded-full bg-violet`,"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`sr-only`,children:`Skills update available`})]}):null]},t.to)})}),(0,J.jsx)(On,{projectId:e.id,requests:x,children:(0,J.jsx)(ul,{buckets:b,currentRunId:n?s:null,now:c,scope:e.id,showTokens:p,showCost:m,onTogglePin:a===`archived`?void 0:(e,t)=>v.mutate({id:e.id,pinned:t},{onError:e=>I(e.message,{tone:`danger`})})})}),(0,J.jsx)(G,{to:_i(e.id,`/`),onClick:_,"data-slot":`project-group-more`,className:`flex h-9 items-center rounded-md px-3 text-[12px] text-muted-foreground transition-colors hover:text-foreground md:h-7`,children:`More…`})]})]})}var El={claude:!0,codex:!0,opencode:!0,pi:!0},Dl=e=>Object.hasOwn(El,e.name);function Ol(e){let t=e.checks.filter(Dl);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 kl(e){let t=`xezar v${e.version}`,n=Ol(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 Al(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 jl({health:e}){if(!e)return null;let t=Ol(e);return(0,J.jsxs)(Tr,{children:[(0,J.jsx)(pr,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,"data-slot":`tools-menu-trigger`,title:kl(e),className:`flex items-center gap-1.5 rounded-full border border-border px-2 py-0.5 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:[(0,J.jsx)(K,{tone:t?`pending`:`success`}),`Tools`,(0,J.jsx)(Gn,{className:`size-[11px]`,"aria-hidden":`true`})]})}),(0,J.jsxs)(xr,{side:`top`,align:`start`,"data-slot":`tools-menu-content`,className:`w-[240px]`,children:[(0,J.jsx)(vr,{className:`text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:`Installed tools`}),e.checks.map(e=>e.available?(0,J.jsx)(Ml,{check:e},e.name):(0,J.jsx)(Nl,{check:e},e.name)),Al(e)?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(wr,{}),(0,J.jsx)(`p`,{"data-slot":`forge-note`,className:`px-2 py-1.5 text-[11px] leading-snug text-muted-foreground`,children:Al(e)})]}):null,(0,J.jsx)(wr,{}),(0,J.jsx)(Cr,{asChild:!0,children:(0,J.jsxs)(G,{to:`/settings/agents`,"data-slot":`tools-settings`,className:`gap-2 text-[12.5px] text-muted-foreground`,children:[(0,J.jsx)(lo,{className:`size-3.5`,"aria-hidden":`true`}),`Tool settings`]})})]})]})}function Ml({check:e}){return(0,J.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,J.jsx)(K,{tone:`success`}),(0,J.jsx)(`span`,{className:`font-mono text-[12.5px] font-medium`,children:e.name}),(0,J.jsx)(`span`,{"data-slot":`tool-version`,className:`ml-auto font-mono text-[11.5px] font-medium text-muted-foreground tabular-nums`,children:e.version??`not found`})]})}function Nl({check:e}){return(0,J.jsx)(Cr,{asChild:!0,children:(0,J.jsxs)(G,{to:`/settings/agents`,"data-slot":`tool-row`,"data-tool":e.name,"data-available":`false`,className:`flex-col items-stretch gap-1`,children:[(0,J.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(K,{tone:`danger`}),(0,J.jsx)(`span`,{className:`font-mono text-[12.5px] font-medium`,children:e.name}),(0,J.jsx)(`span`,{"data-slot":`tool-version`,className:`ml-auto font-mono text-[11.5px] font-medium text-muted-foreground`,children:`not found`})]}),(0,J.jsxs)(`span`,{className:`flex items-end justify-between gap-3 pl-[15px]`,children:[e.hint?(0,J.jsx)(`span`,{"data-slot":`tool-hint`,className:`min-w-0 text-[11px] leading-snug text-muted-foreground`,children:e.hint}):null,(0,J.jsx)(`span`,{"data-slot":`tool-setup`,className:`ml-auto shrink-0 text-[11.5px] font-semibold text-violet`,children:`Set up →`})]})]})})}function Pl(e){return e?.trim()||null}function Fl({projectName:e,pageLabel:t}){let n=Pl(e),r=Pl(t);return n&&r?`${n} — ${r} · xezar`:n?`${n} · xezar`:r?`${r} · xezar`:`xezar`}function Il(e){let t=Fl(e);(0,q.useEffect)(()=>{document.title=t},[t])}var Ll=`xez-last-location`;function Rl(){try{let e=localStorage.getItem(Ll);return e===null?null:JSON.parse(e)}catch{return null}}function zl(e){try{localStorage.setItem(Ll,JSON.stringify(e))}catch{}}var Bl=new Set([`projectId`,`pathname`,`search`,`hash`]);function Vl(e){if(typeof e!=`object`||!e||Array.isArray(e))return null;let t=e;if(Object.keys(t).some(e=>!Bl.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(yi(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 Hl(e,t){let n=t.projects.find(t=>t.id===e);return n!==void 0&&n.status!==`missing`}function Ul(e,t){if(t===void 0)return null;let n;try{n=yi(e.pathname)}catch{return null}return n===null||!Hl(n,t)?null:Vl({projectId:n,pathname:e.pathname,...e.search===``?{}:{search:e.search},...e.hash===``?{}:{hash:e.hash}})}function Wl(e,t,n){let r=Vl(e);return r===null||!(t===void 0?n!==void 0&&r.projectId===n:Hl(r.projectId,t))?null:`${r.pathname}${r.search??``}${r.hash??``}`}function Gl(e,t){let n=Vl(e);return n!==null&&n.projectId===t.projectId&&n.pathname===t.pathname&&(n.search??``)===(t.search??``)&&(n.hash??``)===(t.hash??``)}function Kl(){return(0,J.jsx)(`div`,{"data-route":`compare`,className:`flex min-h-full flex-col`,children:(0,J.jsx)(z,{icon:(0,J.jsx)(mt,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading variants…`,subtitle:`Fetching every variant's status, spend and diff summary.`})})}function ql(){return(0,J.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,J.jsx)(z,{icon:(0,J.jsx)(mt,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading GitHub…`,subtitle:`Fetching open issues and pull requests.`})})}function Jl(e){let t=Ye(),n=nn(),r=s(t.data),i=n.data?.defaultRunner,a=$n(e.runner,r,i??r[0]??`claude`),o=pe(a),c=n.data?.modelsLocked===!0,{accounts:l,repoAccount:u}=Fr(),d=l.some(t=>t.provider===a&&t.id===e.account)?e.account:null;return{runner:a,runnerExplicit:e.runner!==null,model:qn(c?null:e.model,a,n.data?.defaultModels,o.data),runners:r,defaultRunner:i,canRun:t.isSuccess&&r.length>0,modelsLocked:c,providerPending:t.isPending,providerError:t.isError,accounts:l,account:d,repoAccount:u}}function Yl(e){return{runner:Jn(e.runner,e.defaultRunner,e.runnerExplicit),model:e.modelsLocked?void 0:e.model||void 0}}function Xl(e){return{...Yl(e),...e.account?{agentProfile:e.account}:{}}}function Zl({pick:e,onChange:t,disabled:n=!1,accounts:r=!1}){let i=Jl(e),{runner:a,model:o,runners:s,canRun:c,modelsLocked:l}=i,u=nn(),d=pe(a),f=nr(a,d.data,[e.model,u.data?.defaultModels?.[a]]),p=n||!c,m=r?i.accounts:[];return(0,J.jsxs)(J.Fragment,{children:[s.length>1||s.some(e=>Pr(m,e))?(0,J.jsx)(Nr,{runners:s,value:a,accounts:m,account:r?i.account:null,repoAccount:r?i.repoAccount:void 0,disabled:p,onPick:(n,i)=>t(r?{runner:n,account:i,model:n===a?e.model:null}:{runner:n,account:null,model:null})}):null,(0,J.jsx)(Wr,{slot:`model-pill`,ariaLabel:`Model`,label:f.find(e=>e.id===o).label,value:o,disabled:p,readOnly:l===!0,disabledHint:l?`Model selection is locked to native coding-agent settings.`:void 0,onPick:n=>t({...e,model:n}),options:f.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:Kn(a,d.data,d.isError)})]})}function Ql({templates:e,onInsert:t,triggerClassName:n,disabled:r,iconOnly:i=!1}){let[a,o]=(0,q.useState)(!1),s=(0,q.useRef)(null),c=vi();return e.length===0?null:(0,J.jsxs)(rr,{open:a,onOpenChange:o,children:[(0,J.jsx)(Xn,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,"data-slot":`prompt-template-trigger`,"aria-label":`Insert a prompt template`,title:`Insert a prompt template`,disabled:r,className:H(`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`:`px-2.5`,n),children:[(0,J.jsx)(io,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),i?null:(0,J.jsxs)(J.Fragment,{children:[`templates`,(0,J.jsx)(Gn,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})]})}),(0,J.jsx)(Zn,{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,J.jsxs)(Hr,{filter:Pi,children:[(0,J.jsx)(Ar,{placeholder:`search templates…`,onInput:()=>s.current?.scrollTo(0,0)}),(0,J.jsxs)(Jr,{ref:s,"data-slot":`prompt-template-list-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,J.jsx)(Ir,{children:`Nothing matches.`}),(0,J.jsx)(U,{heading:`Insert a template`,children:e.map(e=>(0,J.jsxs)(W,{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),o(!1)},children:[(0,J.jsxs)(`span`,{className:`flex w-full items-center gap-1.5`,children:[(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[12.5px] font-medium text-foreground`,children:e.label}),e.skills&&e.skills.length>0?(0,J.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-[10px] font-medium text-violet`,children:[(0,J.jsx)(Zr,{"aria-hidden":`true`,className:`size-2.5`}),e.skills.length]}):null]}),(0,J.jsx)(`span`,{className:`line-clamp-1 text-[11px] text-soft-foreground`,children:e.text})]},e.id))}),(0,J.jsx)(Mr,{}),(0,J.jsx)(U,{children:(0,J.jsx)(W,{value:`edit prompt templates settings`,"data-slot":`prompt-template-settings`,className:`text-[12px] text-muted-foreground`,onSelect:()=>{o(!1),c(`/settings/prompt-templates`)},children:`Edit templates…`})})]})]})})]})}var $l=Oi({status:`waiting`});function eu(e){return e.filter(e=>!e.startedTaskId)}function tu(e){return e.runnable??!!(e.suggestedSkill||e.suggestedPrompt)}function nu(){let e=M(),t=e.data?.capabilities.followups===!0,n=e.data!==void 0&&!t,r=d(!n),i=ye(),a=r.data===void 0?void 0:eu(r.data);return(0,J.jsxs)(`div`,{"data-route":`inbox`,className:`flex min-h-full flex-col`,children:[(0,J.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,J.jsx)(`h1`,{className:`text-base font-semibold`,children:`Inbox`}),(0,J.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:n?`Disabled for this server; per-task Notes still run.`:`Follow-ups agents suggested when they finished a task.`})]}),(0,J.jsx)(`div`,{className:`flex flex-1 flex-col p-3 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-5 md:pb-5`,children:n?(0,J.jsx)(z,{icon:(0,J.jsx)(Ya,{}),tone:`neutral`,title:`The follow-up inbox is off`,subtitle:`Agents are not asked to leave follow-ups. Set XEZ_FOLLOWUPS=1 and restart xezar to turn the inbox on.`,heading:`h2`}):a===void 0?r.isError?(0,J.jsx)(z,{icon:(0,J.jsx)(Qr,{}),tone:`danger`,title:`Could not load the inbox`,subtitle:r.error.message,heading:`h2`}):null:a.length===0?e.isPending?null:(0,J.jsx)(z,{icon:(0,J.jsx)(Ya,{}),tone:`neutral`,title:`Inbox empty`,subtitle:`Agents drop follow-up suggestions here when they finish a task.`,heading:`h2`}):(0,J.jsx)(`ul`,{"data-slot":`todo-list`,className:`mx-auto flex w-full max-w-3xl flex-col gap-2.5`,children:a.map(e=>(0,J.jsx)(ru,{todo:e,sourceTaskExists:e.taskId===void 0?null:i.data?.some(t=>t.id===e.taskId)??!1},e.id))})})]})}function ru({todo:e,sourceTaskExists:t}){let n=vi(),r=R(),i=Me(),[a,s]=(0,q.useState)({runner:null,model:null,account:null}),c=Jl(a),[l,u]=(0,q.useState)(!1),[d,f]=(0,q.useState)(``),p=(0,q.useRef)(null),m=jr(i.data?.promptTemplates),h=e=>{let t=p.current?.selectionStart??d.length,n=Ur(d,t,e);f(n.text),requestAnimationFrame(()=>{p.current?.focus(),p.current?.setSelectionRange(n.caret,n.caret)})},g=j({mutationFn:async()=>c.canRun?qt(e.id,{...Yl(c),prompt:d.trim()||void 0}):null,onSuccess:e=>{if(e===null)return;let{run:t}=e;r.invalidateQueries({queryKey:L.todos}),r.invalidateQueries({queryKey:L.runs.all}),n(`/tasks/${t.id}`)},onError:e=>I(e.message,{tone:`danger`})}),_=j({mutationFn:()=>en(e.id),onSuccess:()=>{r.setQueryData(L.todos,t=>t?.filter(t=>t.id!==e.id)),r.invalidateQueries({queryKey:L.todos})},onError:e=>I(e.message,{tone:`danger`})}),v=g.isPending||_.isPending,y=tu(e);return(0,J.jsxs)(`li`,{"data-slot":`todo-card`,"data-id":e.id,className:`flex flex-col gap-2.5 rounded-lg border border-border bg-card p-4 shadow-xs`,children:[(0,J.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,J.jsx)(K,{tone:$l.tone,pulse:$l.pulse,title:$l.label,className:`mt-[5px]`}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`p`,{"data-slot":`todo-summary`,className:`text-sm leading-snug font-medium text-foreground`,children:e.summary}),(0,J.jsxs)(`div`,{"data-slot":`todo-meta`,className:`mt-1.5 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-soft-foreground`,children:[e.ts?(0,J.jsxs)(`span`,{children:[Mi(e.ts),` ago`]}):null,e.action?(0,J.jsx)(`span`,{children:e.action}):null,e.taskId===void 0?null:t?(0,J.jsx)(G,{to:`/tasks/${e.taskId}`,"data-slot":`todo-source`,className:`text-muted-foreground underline decoration-border underline-offset-2 hover:text-foreground`,children:`source task`}):(0,J.jsx)(`span`,{"data-slot":`todo-source-gone`,children:`source task deleted`}),sn(e.prUrl)?(0,J.jsx)(`a`,{href:e.prUrl,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`todo-pr`,className:`text-muted-foreground underline decoration-border underline-offset-2 hover:text-foreground`,children:`PR`}):null,e.suggestedSkill?(0,J.jsxs)(`span`,{"data-slot":`todo-skill`,className:`font-mono`,children:[`skill: `,e.suggestedSkill]}):null]})]}),(0,J.jsx)(`div`,{className:`flex shrink-0 items-center gap-1.5 self-center`,children:y?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(P,{type:`button`,variant:`contrast`,size:`sm`,"data-action":`todo-run`,title:`Start a task from this follow-up`,disabled:v||!c.canRun,onClick:()=>g.mutate(),children:[(0,J.jsx)(lr,{"aria-hidden":`true`,className:`size-3`}),`Run`]}),(0,J.jsx)(P,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`todo-dismiss`,title:`Check off (remove)`,disabled:v,onClick:()=>_.mutate(),children:`Dismiss`})]}):(0,J.jsxs)(P,{type:`button`,variant:`contrast`,size:`sm`,"data-action":`todo-acknowledge`,title:`Acknowledge and remove this note`,disabled:v,onClick:()=>_.mutate(),children:[(0,J.jsx)(o,{"aria-hidden":`true`,className:`size-3`}),`Acknowledge`]})})]}),y?(0,J.jsxs)(`div`,{"data-slot":`todo-engine`,className:`flex flex-wrap items-center gap-2 pl-5`,children:[(0,J.jsx)(Zl,{pick:a,onChange:s,disabled:v||!c.canRun}),!c.providerPending&&!c.canRun?(0,J.jsxs)(`span`,{"data-slot":`todo-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[c.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this follow-up.`,(0,J.jsx)(G,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null]}):null,y?l?(0,J.jsxs)(`div`,{"data-slot":`todo-instructions`,className:`flex flex-col gap-2 pl-5`,children:[(0,J.jsx)(ei,{ref:p,"data-slot":`todo-instructions-input`,"aria-label":`Extra instructions for this follow-up`,value:d,onChange:e=>f(e.target.value),placeholder:`Add instructions for the agent… (appended to the suggestion above)`,maxLength:2e4,className:`min-h-16 text-[13px]`}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(Ql,{templates:m,onInsert:h}),(0,J.jsx)(`button`,{type:`button`,"data-slot":`todo-instructions-hide`,onClick:()=>u(!1),className:`text-xs font-medium text-muted-foreground underline decoration-border underline-offset-2 hover:text-foreground`,children:`Hide`})]})]}):(0,J.jsx)(`button`,{type:`button`,"data-slot":`todo-instructions-toggle`,onClick:()=>u(!0),className:`self-start pl-5 text-xs font-medium text-muted-foreground underline decoration-border underline-offset-2 hover:text-foreground`,children:d.trim()?`Edit instructions (added)`:`+ Add instructions`}):null]})}var iu=38,au=280,ou=900,su=600,cu=5500,lu=1400,Y=e=>({text:e,tone:`key`}),uu=e=>({text:e,tone:`str`}),X=e=>({text:e,tone:`fn`}),du=e=>({text:e,tone:`com`}),fu=e=>({text:e,tone:`num`}),Z=e=>({text:e}),pu=[[[du(`// task accepted — isolating a worktree`)],[Y(`const`),Z(` tree = `),Y(`await`),Z(` git.`),X(`worktree`),Z(`(task.branch)`)],[Y(`const`),Z(` agent = `),X(`spawn`),Z(`(runner, { tree, skills })`)],[Y(`for await`),Z(` (`),Y(`const`),Z(` event `),Y(`of`),Z(` agent.`),X(`stream`),Z(`()) {`)],[Z(` cockpit.`),X(`render`),Z(`(event)`)],[Z(`}`)]],[[Z(`$ xezar run `),uu(`--worktree --autonomous`)],[uu(`✓`),Z(` worktree ready · base `),uu(`main`)],[uu(`✓`),Z(` agent started`)],[du(`… editing src/routes/new-task.tsx`)],[uu(`✓`),Z(` tests green · `),fu(`+42 −7`)],[uu(`✓`),Z(` pull request opened`)]],[[du(`# flaky: replay before touching code`)],[Y(`def`),Z(` `),X(`stabilize`),Z(`(test):`)],[Z(` `),Y(`for`),Z(` attempt `),Y(`in`),Z(` `),X(`range`),Z(`(`),fu(`3`),Z(`):`)],[Z(` `),Y(`if`),Z(` `),X(`run`),Z(`(test).ok:`)],[Z(` `),Y(`return`),Z(` `),uu(`'green'`)],[Z(` `),Y(`return`),Z(` `),X(`quarantine`),Z(`(test)`)]],[[du(`// apply the reviewed plan, step by step`)],[Y(`let`),Z(` diff = worktree.`),X(`diff`),Z(`()?;`)],[Y(`match`),Z(` `),X(`review`),Z(`(diff) {`)],[Z(` Ok(pr) => gh::`),X(`open`),Z(`(pr),`)],[Z(` Err(e) => `),X(`retry`),Z(`(e, backoff),`)],[Z(`}`)]],[[du(`// merge when every check is green`)],[Y(`func`),Z(` `),X(`merge`),Z(`(pr *PullRequest) `),Y(`error`),Z(` {`)],[Z(` `),Y(`if`),Z(` err := ci.`),X(`Wait`),Z(`(pr); err != `),Y(`nil`),Z(` {`)],[Z(` `),Y(`return`),Z(` err`)],[Z(` }`)],[Z(` `),Y(`return`),Z(` gh.`),X(`Merge`),Z(`(pr)`)],[Z(`}`)]],[[du(`-- which branches ship the most?`)],[Y(`select`),Z(` branch, `),X(`count`),Z(`(*) `),Y(`as`),Z(` runs`)],[Y(`from`),Z(` tasks`)],[Y(`where`),Z(` status = `),uu(`'green'`)],[Y(`group by`),Z(` branch`)],[Y(`order by`),Z(` runs `),Y(`desc`),Z(`;`)]],[[du(`/* the composer glow, one token deep */`)],[Z(`.composer`),Y(`:focus-within`),Z(` {`)],[Z(` border-color: `),X(`var`),Z(`(--primary);`)],[Z(` box-shadow: `),fu(`0 0 0 3px`),Z(` `),X(`var`),Z(`(--ring);`)],[Z(` transition: box-shadow `),fu(`120ms`),Z(` ease;`)],[Z(`}`)]]],mu=[[`left-[3%] top-[12%]`,`left-[5%] top-[36%]`,`left-[8%] top-[58%]`],[`right-[3%] top-[14%]`,`right-[6%] top-[40%]`,`right-[4%] top-[62%]`],[`left-[28%] top-[66%]`,`left-[45%] top-[72%]`,`right-[26%] top-[70%]`]],hu={key:`var(--syn-key)`,str:`var(--syn-str)`,fn:`var(--syn-fn)`,com:`var(--syn-com)`,num:`var(--syn-num)`},gu=e=>e.reduce((e,t)=>e+t.text.length,0),_u=e=>e.reduce((e,t)=>e+gu(t)*iu+au,0);function vu(e){let t=[...e];for(let e=t.length-1;e>0;e--){let n=Math.floor(Math.random()*(e+1)),r=t[e];t[e]=t[n],t[n]=r}return t}function yu(){let e=vu(pu).slice(0,mu.length),t=vu(mu.map(e=>e[Math.floor(Math.random()*e.length)]??``)),n=su;return{blocks:e.map((e,r)=>{let i=n;return n+=_u(e)+ou,{lines:e,slot:t[r]??``,startMs:i}}),cycleMs:n-ou+cu+lu}}function bu({block:e,cycleMs:t}){let n=e.startMs;return(0,J.jsx)(`div`,{className:H(`ghost-code-block absolute font-mono text-[11.5px] leading-[1.9] text-soft-foreground`,e.slot),style:{"--cycle":`${t}ms`},children:e.lines.map((e,t)=>{let r=gu(e),i=n;return n+=r*iu+au,(0,J.jsx)(`div`,{className:`ghost-code-line`,style:{"--n":r,"--t":`${r*iu}ms`,"--d":`${i}ms`},children:e.map((e,t)=>(0,J.jsx)(`span`,{style:e.tone?{color:hu[e.tone]}:void 0,children:e.text},t))},t)})})}var xu=`(prefers-reduced-motion: reduce)`;function Su(){let[e,t]=(0,q.useState)(()=>typeof window.matchMedia==`function`&&!window.matchMedia(xu).matches);return(0,q.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia(xu),n=e=>t(!e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function Cu(){let[e,t]=(0,q.useState)(0),n=Su(),r=(0,q.useMemo)(()=>yu(),[e]);return(0,q.useEffect)(()=>{if(!n)return;let e=window.setTimeout(()=>t(e=>e+1),r.cycleMs);return()=>window.clearTimeout(e)},[e,n,r.cycleMs]),(0,J.jsx)(`div`,{"data-slot":`ghost-code-backdrop`,"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 -z-10 overflow-hidden max-xl:hidden [mask-image:linear-gradient(to_bottom,black_30%,transparent_96%)]`,children:(0,J.jsx)(`div`,{className:`contents`,children:r.blocks.map((e,t)=>(0,J.jsx)(bu,{block:e,cycleMs:r.cycleMs},t))},e)})}function wu({source:e,className:t}){return(0,J.jsx)(`span`,{"data-slot":`skill-source`,"data-source":e,className:H(`shrink-0 rounded-full border border-border px-2 py-px font-mono text-[10.5px]`,Ri({source:e})?`font-semibold text-foreground`:`text-soft-foreground`,t),children:e})}function Tu({skill:e,usedBy:t,heading:n=`h2`}){return(0,J.jsxs)(`div`,{"data-slot":`skill-detail`,className:`min-w-0`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2.5`,children:[(0,J.jsx)(n,{className:`min-w-0 font-mono text-lg font-semibold break-all`,children:e.name}),(0,J.jsx)(wu,{source:e.source})]}),(0,J.jsxs)(`p`,{"data-slot":`skill-path`,className:`mt-1 font-mono text-[10.5px] break-all text-soft-foreground`,children:[e.path,e.team?` · from ${e.team.repo}`:``]}),e.description?(0,J.jsx)(`p`,{"data-slot":`skill-description`,className:`mt-2.5 text-[13px] text-muted-foreground`,children:e.description}):null,t===void 0?null:(0,J.jsxs)(`section`,{"data-slot":`skill-used-by`,className:`mt-5`,children:[(0,J.jsx)(`h3`,{className:`text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:`Used by`}),t.length>0?(0,J.jsx)(`ul`,{className:`mt-1.5 flex flex-col gap-1`,children:t.map(e=>(0,J.jsxs)(`li`,{className:`flex items-center gap-1.5 font-mono text-xs text-muted-foreground`,children:[(0,J.jsx)(Ea,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),e]},e))}):(0,J.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:`Not referenced by any workflow yet — quick-task picks it up when the task mentions it.`})]}),(0,J.jsxs)(`section`,{className:`mt-5`,children:[(0,J.jsx)(`h3`,{className:`text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:`Content`}),(0,J.jsx)(`div`,{"data-slot":`skill-body`,className:`mt-2 text-sm`,children:(0,J.jsx)(Ni,{children:e.body})})]})]})}function Eu({skill:e,onClose:t}){return(0,J.jsx)(hi,{open:e!==null,onOpenChange:e=>e?void 0:t(),children:(0,J.jsx)(li,{"data-slot":`skill-preview`,className:`block max-h-[80dvh] overflow-y-auto sm:max-w-2xl`,children:e?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(fi,{className:`sr-only`,children:e.name}),(0,J.jsx)(mi,{className:`sr-only`,children:`Read-only skill preview`}),(0,J.jsx)(Tu,{skill:e,heading:`h3`}),(0,J.jsx)(`p`,{className:`mt-5`,children:(0,J.jsx)(G,{to:`/skills?skill=${encodeURIComponent(e.name)}`,"data-slot":`skill-preview-manage`,onClick:t,className:`text-xs font-semibold text-violet hover:underline`,children:`Open in the Skills catalog`})})]}):null})})}function Du(e,t,n){let r=e.skill===``?{source:`workflow`,ref:`quick-task`}:{source:`skill`,ref:e.skill};return Qn({task:e.ref,source:r,model:``,runner:t,defaultRunner:n,variants:1,images:[],todoId:e.todo})}function Ou(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 ku(e,t){return`Use the "${e}" skill on: ${t}`}function Au(e){let t=e.configuredAutonomous===`source-dependent`?e.source===`skill`:e.configuredAutonomous,n=e.interactive!==!0&&void 0;return{autonomous:e.planFirst?!1:e.explicitAutonomous??n??t,worktree:e.hasGit?e.variants>1?!0:e.explicitWorktree??n??e.configuredWorktree:!1}}function ju(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 Mu={text:``,source:null,runner:null,agentProfile:null,model:null,variants:1,planFirst:!1,worktree:null,autonomous:null,generateFollowups:null},Nu=`xez-new-task-draft`;function Pu(e){return e===null?Nu:`${Nu}:${e}`}function Fu(e){let t=e&&typeof e==`object`?e:{};return{text:typeof t.text==`string`?t.text:``,source:Iu(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,variants:t.variants===2||t.variants===3?t.variants:1,planFirst:t.planFirst===!0,worktree:typeof t.worktree==`boolean`?t.worktree:null,autonomous:typeof t.autonomous==`boolean`?t.autonomous:null,generateFollowups:typeof t.generateFollowups==`boolean`?t.generateFollowups:null}}function Iu(e){return!!e&&typeof e==`object`&&(e.source===`skill`||e.source===`workflow`)&&typeof e.ref==`string`}var Lu=new Map;function Ru(e=null){let t=Pu(e),n=Lu.get(t);if(n)return{...n};let r;try{let e=localStorage.getItem(t);r=e?Fu(JSON.parse(e)):{...Mu}}catch{r={...Mu}}return Lu.set(t,r),{...r}}function zu(e,t=null){let n=Pu(t);Lu.set(n,{...e});try{localStorage.setItem(n,JSON.stringify(e))}catch{}}function Bu(e=null){zu({...Ru(e),text:``,source:null},e)}function Vu(e){let t=typeof e==`string`?new URLSearchParams(e):e;return{skill:(t.get(`skill`)??``).trim(),ref:(t.get(`ref`)??t.get(`task`)??``).trim(),auto:t.get(`auto`)===`1`,key:t.get(`key`)??``,todo:(t.get(`todo`)??``).trim()}}function Hu(e,t,n){return{task:e,steps:[...n.steps],rationale:n.rationale,fallback:n.fallback,images:[...t]}}function Uu(e,t){return!Number.isInteger(t)||t<0||t>=e.length?[...e]:e.filter((e,n)=>n!==t)}function Wu(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 Gu(e){return e.command??e.prompt??``}function Ku(e,t=120){let n=e.split(`
3
+ `)[0]??``;return n.length>t?`${n.slice(0,t-1)}…`:n}function qu(e){let{task:t,steps:n,model:r,modelsLocked:i,runner:a,runnerExplicit:o,defaultRunner:s,variants:c,images:l,generateFollowups:u,todoId:d}=e;return{task:t,steps:[...n],model:i?void 0:r||void 0,runner:Jn(a,s,o),variants:c>1?c:void 0,images:l.length>0?[...l]:void 0,generateFollowups:u!==!1&&void 0,todoId:d||void 0}}function Ju({plan:e,starting:t,startAvailable:n,startUnavailableReason:r,startUnavailableAction:i,onStepsChange:a,onStart:o,onDiscard:s}){let[c,l]=(0,q.useState)(null),[u,d]=(0,q.useState)(null),f=()=>{l(null),d(null)},p=(t,n)=>{t.preventDefault(),c!==null&&c!==n&&a(Wu(e.steps,c,n)),f()},m=e.steps.length===0;return(0,J.jsx)(hi,{open:!0,onOpenChange:e=>e?void 0:s(),children:(0,J.jsxs)(li,{"data-slot":`plan-review`,showCloseButton:!1,className:H(`top-0 left-0 flex h-dvh w-full max-w-full translate-x-0 translate-y-0 flex-col gap-0 rounded-none p-0`,`sm:top-1/2 sm:left-1/2 sm:h-auto sm:max-h-[85dvh] sm:max-w-[680px] sm:-translate-x-1/2 sm:-translate-y-1/2 sm:rounded-xl`),children:[(0,J.jsxs)(ui,{className:`gap-1 border-b border-border px-5 pt-4 pb-3.5 text-left sm:text-left`,children:[(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,J.jsx)(fi,{className:`text-[11px] font-semibold tracking-[0.08em] text-muted-foreground uppercase`,children:`Proposed chain`}),(0,J.jsx)(di,{"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,J.jsx)($r,{"aria-hidden":`true`,className:`size-4`})})]}),(0,J.jsx)(mi,{"data-slot":`plan-task`,title:e.task,className:`truncate text-[13.5px] font-medium text-foreground`,children:Ku(e.task)}),e.fallback?(0,J.jsx)(`p`,{"data-slot":`plan-fallback`,className:`text-xs text-soft-foreground italic`,children:`planner unavailable — single-step plan`}):e.rationale===``?null:(0,J.jsx)(`p`,{"data-slot":`plan-rationale`,className:`text-xs text-muted-foreground`,children:e.rationale})]}),(0,J.jsx)(`ol`,{"data-slot":`plan-steps`,className:`flex-1 space-y-2 overflow-y-auto px-5 py-4`,children:m?(0,J.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,J.jsxs)(`li`,{"data-slot":`plan-step`,"data-step-id":t.id,draggable:!0,onDragStart:()=>l(n),onDragOver:e=>{e.preventDefault(),d(n)},onDragLeave:()=>d(e=>e===n?null:e),onDrop:e=>p(e,n),onDragEnd:f,className:H(`flex items-center gap-2.5 rounded-lg border border-border bg-card-2 px-3 py-2.5`,c===n&&`opacity-50`,u===n&&c!==null&&c!==n&&`border-ring`),children:[(0,J.jsx)(qa,{"aria-hidden":`true`,className:`size-3.5 shrink-0 cursor-grab text-soft-foreground`}),(0,J.jsx)(`span`,{className:`w-5 shrink-0 font-mono text-[11px] text-soft-foreground tabular-nums`,children:String(n+1).padStart(2,`0`)}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,J.jsx)(`span`,{className:`truncate text-[13px] font-semibold`,children:t.name??t.id}),t.skill?(0,J.jsx)(`span`,{"data-slot":`plan-badge-skill`,title:`skill`,className:`shrink-0 rounded-full bg-violet/15 px-1.5 py-px font-mono text-[10.5px] font-medium text-violet`,children:t.skill}):null,t.command?(0,J.jsx)(`span`,{"data-slot":`plan-badge-check`,className:`shrink-0 rounded-full bg-muted px-1.5 py-px text-[10.5px] font-medium text-muted-foreground`,children:`check`}):null]}),(0,J.jsx)(`p`,{className:`truncate font-mono text-[11.5px] text-muted-foreground`,children:Gu(t)})]}),(0,J.jsxs)(`span`,{className:`flex shrink-0 items-center`,children:[(0,J.jsx)(P,{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(Wu(e.steps,n,n-1)),children:(0,J.jsx)(In,{"aria-hidden":`true`,className:`size-3.5`})}),(0,J.jsx)(P,{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(Wu(e.steps,n,n+1)),children:(0,J.jsx)(Mn,{"aria-hidden":`true`,className:`size-3.5`})}),(0,J.jsx)(P,{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(Uu(e.steps,n)),children:(0,J.jsx)($r,{"aria-hidden":`true`,className:`size-3.5`})})]})]},t.id))}),!n&&r?(0,J.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,J.jsx)(`span`,{children:r}),i]}):null,(0,J.jsxs)(`div`,{className:`flex items-center gap-2 px-5 py-3.5 pb-[max(14px,env(safe-area-inset-bottom))]`,children:[(0,J.jsxs)(P,{type:`button`,"data-slot":`plan-start`,disabled:m||t||!n,title:n?void 0:r,"aria-describedby":!n&&r?`plan-start-guidance`:void 0,onClick:o,children:[(0,J.jsx)(lr,{"aria-hidden":`true`,className:`size-3.5`}),t?`Starting…`:`Start`]}),(0,J.jsx)(Yu,{steps:e.steps,disabled:m}),(0,J.jsx)(P,{type:`button`,variant:`ghost`,className:`ml-auto`,onClick:s,children:`Discard`})]})]})})}function Yu({steps:e,disabled:t}){let n=R(),[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(``),[s,c]=(0,q.useState)(!1),[u,d]=(0,q.useState)(!1),f=async t=>{let r=a.trim();if(!(r===``||u)){d(!0);try{let a=await l({name:r,steps:e,...t?{overwrite:!0}:{}});I(`Saved — ${a.path.split(`/`).pop()??a.path}`),n.invalidateQueries({queryKey:L.workflows}),c(!1),i(!1),o(``)}catch(e){e instanceof Kt&&e.exists===!0?c(!0):I(e instanceof Error?e.message:String(e),{tone:`danger`})}finally{d(!1)}}};return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(P,{type:`button`,variant:`outline`,"data-slot":`plan-save`,disabled:t,onClick:()=>i(!0),children:`Save as chain`}),(0,J.jsx)(hi,{open:r,onOpenChange:e=>i(!!e),children:(0,J.jsxs)(li,{"data-slot":`plan-save-dialog`,className:`sm:max-w-sm`,showCloseButton:!1,children:[(0,J.jsxs)(ui,{children:[(0,J.jsx)(fi,{children:`Save as chain`}),(0,J.jsx)(mi,{children:`Saves these steps as a reusable workflow — it joins the picker like any other chain.`})]}),(0,J.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),f(!1)},children:[(0,J.jsx)(Js,{value:a,onChange:e=>o(e.target.value),"aria-label":`Chain name`,placeholder:`e.g. fix-and-verify-v2`,maxLength:80,autoFocus:!0}),(0,J.jsxs)(gi,{className:`mt-4`,children:[(0,J.jsx)(P,{type:`button`,variant:`outline`,onClick:()=>i(!1),children:`Cancel`}),(0,J.jsx)(P,{type:`submit`,disabled:a.trim()===``||u,children:u?`Saving…`:`Save`})]})]})]})}),(0,J.jsx)(ci,{open:s,onOpenChange:e=>e?void 0:c(!1),children:(0,J.jsxs)(ri,{"data-slot":`plan-overwrite-dialog`,children:[(0,J.jsxs)(si,{children:[(0,J.jsxs)(ni,{children:[`Overwrite “`,a.trim(),`”?`]}),(0,J.jsx)(ti,{children:`A chain with this name already exists. Overwriting replaces its steps with this plan.`})]}),(0,J.jsxs)(ai,{children:[(0,J.jsx)(oi,{children:`Keep the existing chain`}),(0,J.jsx)(ii,{onClick:()=>void f(!0),children:`Overwrite`})]})]})})]})}function Xu(){let[e]=ne(),t=vi(),n=R(),{projectId:r}=je(),i=p().projectId,a=B(),[o]=(0,q.useState)(()=>Vu(e)),c=M(),l=Fe(),u=Te(),d=Zt(),f=Me(),m=nn(),h=C(),[g,_]=(0,q.useState)(()=>({...Ru(i),...o.ref===``?{}:{text:o.ref},...o.skill===``?{}:{source:{source:`skill`,ref:o.skill}}}));(0,q.useEffect)(()=>{zu(g,i)},[g,i]);let v=e=>_(t=>({...t,...e})),y=f.data?.recentSources,b=u.data,x=f.data?.skillUsage,S=(0,q.useMemo)(()=>Vi(b??[],x),[b,x]),ee=l.data?.workflows??[],te=a.data?.projects??[],re=u.data!==void 0&&l.data!==void 0&&!f.isPending,w=sr(g.source,S,ee),ie=w?.source===`skill`?S.find(e=>e.name===w.ref):void 0,T=(0,q.useRef)(null),ae=(0,q.useMemo)(()=>jr(f.data?.promptTemplates),[f.data?.promptTemplates]),oe=Br(ae,w?.source===`skill`?[w.ref]:[]),E=(0,q.useRef)(g.text);E.current=g.text;let se=(0,q.useRef)(``);(0,q.useEffect)(()=>{if(!re)return;let e=Vr(E.current,se.current,oe);se.current=e.applied,e.text!==E.current&&v({text:e.text})},[oe,re]);let D=Ye(),ce=s(D.data),le=m.data?.defaultRunner,ue=le??`claude`,O=ce.length>0?$n(g.runner,ce,ue):null,k=O??ue,A=D.isSuccess&&ce.length>0,de=pe(k),fe=m.data?.modelsLocked===!0,me=O===null?[]:nr(O,de.data,[g.model,m.data?.defaultModels?.[O]]),he=O===null?``:qn(fe?null:g.model,O,m.data?.defaultModels,de.data),{accounts:ge,repoAccount:_e}=Fr(),ve=ge.some(e=>e.provider===k&&e.id===g.agentProfile)?g.agentProfile:null,ye=(0,q.useRef)(!1);(0,q.useEffect)(()=>{let e=A&&!ye.current;ye.current=A,e&&document.activeElement===document.body&&document.querySelector(`textarea[aria-label="Describe a task for the agent"]`)?.focus()},[A]);let be=d.data===void 0||d.data.info!==null,xe=be?g.variants:1,Se=be,we=xe>1,Ee=Au({hasGit:be,variants:xe,planFirst:g.planFirst,explicitAutonomous:g.autonomous,explicitWorktree:g.worktree,interactive:ie?.interactive,configuredAutonomous:h.data?.composerDefaults?.autonomous??h.data?.composerDefaults?.inheritedAutonomous??`source-dependent`,configuredWorktree:h.data?.composerDefaults?.worktree??h.data?.composerDefaults?.inheritedWorktree??!0,source:w?.source??`workflow`}),De=Ee.worktree,Oe=Ee.autonomous,ke=c.data===void 0||c.data.capabilities.followups,j=ke?g.generateFollowups??f.data?.lastGenerateFollowups??!0:!1,[Ae,Ne]=(0,q.useState)(null),[Pe,Ie]=(0,q.useState)(!1),[Le,Re]=(0,q.useState)(!1),[Be,N]=(0,q.useState)(()=>o.auto&&o.ref!==``),[Ve,P]=(0,q.useState)(()=>!o.auto&&o.ref!==``?{kind:`prefill`}:null),He=(0,q.useRef)(!1),Ue=(0,q.useRef)(!1);(0,q.useEffect)(()=>{He.current||(He.current=!0,e.toString()!==``&&t(`/new`,{replace:!0}))},[]),(0,q.useEffect)(()=>{if(!Ue.current&&!(!o.auto||o.ref===``)&&!D.isPending){if(!A||O===null){Ue.current=!0,P({kind:`prefill`}),N(!1);return}if(!m.isPending){if(Ue.current=!0,le===void 0){P({kind:`prefill`}),N(!1);return}(async()=>{let e=``;try{e=(await ze()).key}catch{}if(e!==``&&o.key===e)try{let e=await Ce(Du(o,O,le));Bu(i),n.invalidateQueries({queryKey:L.runs.all}),t(Yn(e));return}catch(e){P({kind:`failed`,message:e instanceof Error?e.message:String(e)})}else P({kind:`blocked`});N(!1)})()}}},[m.isPending,le,D.isPending,A,O]),(0,q.useEffect)(()=>{if(Ve===null||!re)return;P(null);let e=o.skill!==``&&!S.some(e=>e.name===o.skill)?o.skill:``;e!==``&&v({text:ku(o.skill,o.ref),source:null});let{message:t,tone:n}=Ou(Ve,e);I(t,{tone:n}),document.querySelector(`[data-slot="composer"] button[aria-label="Start task"], [data-slot="composer"] button[aria-label="Plan task"]`)?.focus()},[Ve,re]);let We=async(e,r)=>{if(!A||O===null)throw Error(D.isPending?`Checking agent providers…`:D.isError?`Provider authentication could not be verified.`:`Connect an agent provider before starting a task.`);if(!re)throw Error(`Still loading workflows and skills — try again in a second.`);if(g.planFirst){Ie(!0);try{Ne(Hu(e,r,await Ht(e))),v({text:e})}finally{Ie(!1)}return}let a=await Ce(Qn({task:e,source:w,model:he,modelsLocked:fe,runner:O,runnerExplicit:g.runner!==null,agentProfile:ve,defaultRunner:le,variants:xe,images:r,worktree:De,autonomous:Oe,generateFollowups:j,todoId:o.todo}));Dt({lastTask:w,...w?{recentSources:ar(y,w)}:{},...ke?{lastGenerateFollowups:j}:{},...w?.source===`skill`&&f.data!==void 0?{skillUsage:Hi(f.data.skillUsage,w.ref)}:{}}).then(()=>n.invalidateQueries({queryKey:L.uiState})).catch(()=>{}),Bu(i),n.invalidateQueries({queryKey:L.runs.all}),t(Yn(a))},Ge=async()=>{if(!(Ae===null||Ae.steps.length===0||Le||!A||O===null)){Re(!0);try{let e=await Ce(qu({task:Ae.task,steps:Ae.steps,model:he,modelsLocked:fe,runner:O,runnerExplicit:g.runner!==null,defaultRunner:le,variants:xe,images:Ae.images,generateFollowups:j,todoId:o.todo}));ke&&Dt({lastGenerateFollowups:j}).then(()=>n.invalidateQueries({queryKey:L.uiState})).catch(()=>{}),Bu(i),Ne(null),n.invalidateQueries({queryKey:L.runs.all}),t(Yn(e))}catch(e){I(e instanceof Error?e.message:String(e),{tone:`danger`})}finally{Re(!1)}}};return Be?(0,J.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,J.jsx)(St,{}),(0,J.jsxs)(`div`,{"data-slot":`auto-starting`,role:`status`,className:`text-center`,children:[(0,J.jsx)(`h1`,{className:`animate-pulse text-lg font-semibold tracking-tight`,children:`Starting task…`}),(0,J.jsx)(`p`,{className:`mt-1.5 text-[13.5px] text-muted-foreground`,children:`Launched from a bookmarklet — taking you to the run.`})]})]}):(0,J.jsxs)(`div`,{"data-route":`new`,className:`relative isolate flex min-h-full flex-col items-center overflow-x-clip px-6 pt-[clamp(32px,7vh,84px)] pb-16 max-md:px-3.5 max-md:pt-7`,children:[(0,J.jsx)(St,{}),(0,J.jsx)(Cu,{}),(0,J.jsxs)(`div`,{className:`w-full max-w-[720px]`,children:[(0,J.jsxs)(`header`,{className:`mb-6 text-center max-md:mb-4`,children:[(0,J.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight max-md:text-base`,children:`What should the agent work on?`}),(0,J.jsx)(`p`,{"data-slot":`run-mode-note`,className:`mt-1.5 text-[13.5px] text-muted-foreground max-md:text-xs`,children:ju({worktree:De,hasGit:be})})]}),(0,J.jsx)(zn,{ref:T,onSubmit:We,value:g.text,onValueChange:e=>v({text:e}),autoFocus:!0,placeholder:`Describe a task for the agent — / for skills…`,ariaLabel:`Describe a task for the agent`,sendAriaLabel:g.planFirst?`Plan task`:`Start task`,disabled:!A||Le,disabledReason:D.isPending?`Checking agent providers…`:D.isError?`Provider authentication could not be verified.`:`Connect an agent provider before starting a task.`,autocompleteSkills:!0,footerStart:(0,J.jsxs)(J.Fragment,{children:[te.length>1&&r!==void 0?(0,J.jsx)(td,{projects:te,projectId:r,onPick:e=>t(`/p/${encodeURIComponent(e)}/new`,{replace:!0})}):null,(0,J.jsx)(nd,{source:w,ready:re,skills:S,skillUsage:x,workflows:ee,onPick:e=>v({source:e})}),(0,J.jsx)(Ql,{templates:ae,iconOnly:!0,onInsert:e=>T.current?.insertAtCaret(e)}),ce.length>1||ce.some(e=>Pr(ge,e))?(0,J.jsx)(Nr,{runners:ce,value:k,accounts:ge,account:ve,repoAccount:_e,onPick:(e,t)=>v({runner:e,agentProfile:t,...e===k?{}:{model:null}}),disabled:!A}):null,(0,J.jsx)(Wr,{slot:`model-pill`,ariaLabel:`Model`,label:me.find(e=>e.id===he)?.label??`auto`,value:he,disabled:!A,readOnly:fe,disabledHint:fe?`Model selection is locked to native coding-agent settings.`:void 0,onPick:e=>v({model:e}),options:me.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:Kn(k,de.data,de.isError)}),(0,J.jsx)(Wr,{slot:`variants-pill`,ariaLabel:`Parallel variants`,label:xe>1?`×${xe} variants`:`×1`,value:String(xe),onPick:e=>v({variants:Number(e)}),disabled:!be,hint:`How many times to run this task in parallel — each variant gets its own worktree, and you pick the diff you keep. ×1 runs it once.`,disabledHint:`Parallel variants need a git repository — each variant runs in its own worktree.`,options:[{value:`1`,label:`×1`,desc:`One run`},{value:`2`,label:`×2 variants`,desc:`Two competing runs — pick the diff you keep`},{value:`3`,label:`×3 variants`,desc:`Three competing runs — pick the diff you keep`}]}),Se?(0,J.jsx)(Zu,{on:De,disabled:we,disabledReason:`Parallel variants always use isolated worktrees`,onChange:e=>v({worktree:e})}):null,(0,J.jsx)(Qu,{on:Oe,disabled:g.planFirst,onChange:e=>v({autonomous:e})}),ie?.interactive&&(g.autonomous===null||g.worktree===null)?(0,J.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,ke?(0,J.jsx)($u,{on:j,onChange:e=>v({generateFollowups:e})}):null,d.data?(0,J.jsx)(rd,{repo:d.data}):null]}),footerEnd:(0,J.jsxs)(J.Fragment,{children:[!A&&!D.isPending?(0,J.jsx)(G,{to:`/settings/agents#providers`,className:`text-xs font-medium text-foreground underline underline-offset-4`,children:`Configure providers`}):null,(0,J.jsx)(id,{planFirst:g.planFirst,planning:Pe,onModeChange:e=>v({planFirst:e})}),(0,J.jsx)(`kbd`,{"aria-hidden":`true`,className:`rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-[10.5px] font-medium text-muted-foreground`,children:pi()})]})}),(0,J.jsx)(od,{onPick:e=>v({text:e})})]}),Ae===null?null:(0,J.jsx)(Ju,{plan:Ae,starting:Le,startAvailable:A,startUnavailableReason:D.isPending?`Checking agent providers…`:D.isError?`Provider authentication could not be verified.`:`Connect an agent provider before starting a task.`,startUnavailableAction:D.isPending?void 0:(0,J.jsx)(G,{to:`/settings/agents#providers`,children:`Configure providers`}),onStepsChange:e=>Ne(t=>t&&{...t,steps:e}),onStart:()=>void Ge(),onDiscard:()=>Ne(null)})]})}function Zu({on:e,disabled:t,disabledReason:n,onChange:r}){return(0,J.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,disabled:t,"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:H(Kr,e&&`border-primary/60 text-foreground`),children:[e?(0,J.jsx)(o,{"aria-hidden":`true`,className:`size-3 shrink-0 text-primary`}):(0,J.jsx)(fo,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),`Worktree`]})}function Qu({on:e,disabled:t,onChange:n}){return(0,J.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,disabled:t,"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:H(Kr,e&&!t&&`border-primary/60 text-foreground`),children:[e?(0,J.jsx)(o,{"aria-hidden":`true`,className:`size-3 shrink-0 text-primary`}):(0,J.jsx)(fo,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),`Autonomous`]})}function $u({on:e,onChange:t}){return(0,J.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,"data-slot":`generate-followups-toggle`,onClick:()=>t(!e),title:e?`Agents can add newly discovered follow-up work to the task inbox`:`Follow-up generation is off; agents still maintain the handoff journal`,className:H(Kr,e&&`border-primary/60 text-foreground`),children:[e?(0,J.jsx)(o,{"aria-hidden":`true`,className:`size-3 shrink-0 text-primary`}):(0,J.jsx)(fo,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),`Follow-ups`]})}function ed(e,t){let n=t.trim().toLowerCase();if(n===``)return[...e];let r=e=>{let t=e.name.toLowerCase(),r=e.id.toLowerCase();return t.startsWith(n)||r.startsWith(n)?0:t.includes(n)||r.includes(n)?1:2};return e.map((e,t)=>({project:e,rank:r(e),index:t})).filter(e=>e.rank<2).sort((e,t)=>e.rank-t.rank||e.index-t.index).map(e=>e.project)}function td({projects:e,projectId:t,onPick:n}){let[r,i]=(0,q.useState)(!1),[a,s]=(0,q.useState)(``),c=e.find(e=>e.id===t),l=ed(e,a);return(0,J.jsxs)(rr,{open:r,onOpenChange:e=>{i(e),e||s(``)},children:[(0,J.jsx)(Xn,{asChild:!0,children:(0,J.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:H(Kr,`border-foreground/60 font-semibold text-foreground`),children:[(0,J.jsx)(Ha,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),(0,J.jsx)(`span`,{className:`max-w-40 truncate`,children:c?.name??t}),Rr]})}),(0,J.jsx)(Zn,{align:`start`,sideOffset:8,className:`w-[300px] max-w-[calc(100vw-2rem)] p-0`,children:(0,J.jsxs)(Hr,{shouldFilter:!1,children:[(0,J.jsx)(Ar,{placeholder:`search projects…`,value:a,onValueChange:s}),(0,J.jsxs)(Jr,{"data-slot":`project-menu`,className:`max-h-[min(18rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[l.length===0?(0,J.jsx)(Ir,{children:`Nothing matches.`}):null,l.map(e=>(0,J.jsxs)(W,{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,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs font-medium`,children:e.name}),e.status===`missing`?(0,J.jsx)(`span`,{className:`shrink-0 text-[11px] text-soft-foreground`,children:`folder not found`}):e.branch===void 0?null:(0,J.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-soft-foreground`,children:e.branch}),e.id===t?(0,J.jsx)(o,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e.id))]}),(0,J.jsx)(`p`,{className:`border-t border-border px-3 py-2 text-[11px] leading-snug text-soft-foreground`,children:`Skills, workflows, settings and the draft re-resolve against the selected project.`})]})})]})}function nd({source:e,ready:t,skills:n,skillUsage:r,workflows:i,onPick:a}){let[s,c]=(0,q.useState)(!1),[l,u]=(0,q.useState)(``),[d,f]=(0,q.useState)(null),p=(0,q.useRef)(null),{mostUsed:m,project:h,global:g}=Fi(Ui(n,l,r),r),_=i.find(e=>e.name===or),v=Ii(i,l).filter(e=>e.name!==or),y=zi(`no skill`,`none plain ${or} ${_?.description??``}`,l)>0,b=!y&&m.length===0&&h.length===0&&g.length===0&&v.length===0,x=e=>{a(e),c(!1)},S=t=>x(e?.source===t.source&&e.ref===t.ref?null:t),ee=(t,n)=>{let r=e?.source===`skill`&&e.ref===t.name;return(0,J.jsxs)(W,{value:`skill ${t.name} ${t.path}`,keywords:Li(t.name,t.description),"data-slot":`source-option`,"data-source-kind":`skill`,"data-source-ref":t.name,onSelect:()=>S({source:`skill`,ref:t.name}),children:[(0,J.jsx)(`span`,{className:H(`shrink-0 font-mono text-xs`,n&&`font-semibold`),children:t.name}),t.description?(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:t.description}):null,(0,J.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,J.jsx)(Or,{"aria-hidden":`true`,className:`size-3.5`})}),r?(0,J.jsx)(o,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},t.path)},C=e===null?so:e.source===`skill`?Zr:mo,te=(0,J.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:H(Kr,`font-mono text-[11.5px]`,e===null?`border-dashed text-soft-foreground`:`rounded-r-none border-r-0 border-foreground/60 pr-1.5 font-semibold text-foreground`),children:[(0,J.jsx)(C,{"aria-hidden":`true`,className:H(`size-3 shrink-0`,e===null?`text-soft-foreground`:`text-violet`)}),(0,J.jsx)(`span`,{className:`max-w-44 truncate`,children:t?e?.ref??`Skill`:`…`}),Rr]});return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Eu,{skill:d,onClose:()=>f(null)}),(0,J.jsxs)(rr,{open:s,onOpenChange:e=>{c(e),e||u(``)},children:[(0,J.jsxs)(`span`,{className:`inline-flex items-center`,children:[(0,J.jsx)(Xn,{asChild:!0,children:te}),e!==null&&t?(0,J.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:H(Kr,`rounded-l-none border-foreground/60 pl-1.5 pr-2 text-soft-foreground hover:text-foreground`),children:(0,J.jsx)($r,{"aria-hidden":`true`,className:`size-3`})}):null]}),(0,J.jsx)(Zn,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,J.jsxs)(Hr,{shouldFilter:!1,children:[(0,J.jsx)(Ar,{placeholder:`search skills & workflows…`,value:l,onValueChange:u,onInput:()=>p.current?.scrollTo(0,0)}),(0,J.jsxs)(Jr,{ref:p,"data-slot":`source-menu`,className:`max-h-[min(18rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[b?(0,J.jsx)(Ir,{children:`Nothing matches.`}):null,y?(0,J.jsx)(U,{children:(0,J.jsxs)(W,{value:`none no-skill`,keywords:[`none`,`plain`,...Li(or)],"data-slot":`source-option`,"data-source-kind":`none`,onSelect:()=>x(null),children:[(0,J.jsx)(hn,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-soft-foreground`}),(0,J.jsx)(`span`,{className:`shrink-0 text-xs font-medium`,children:`No skill`}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:_?.description??`One agent run on your task — no ceremony.`}),e===null?(0,J.jsx)(o,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-primary`}):null]})}):null,m.length>0?(0,J.jsx)(U,{heading:`Most used`,children:m.map(e=>ee(e,Ri(e)))}):null,h.length>0?(0,J.jsx)(U,{heading:`Project skills`,children:h.map(e=>ee(e,!0))}):null,v.length>0?(0,J.jsx)(U,{heading:`Workflows`,children:v.map(t=>{let n=e?.source===`workflow`&&e.ref===t.name;return(0,J.jsxs)(W,{value:`workflow ${t.name}`,keywords:Li(t.name,t.description),"data-slot":`source-option`,"data-source-kind":`workflow`,"data-source-ref":t.name,onSelect:()=>S({source:`workflow`,ref:t.name}),children:[(0,J.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:t.name}),t.description?(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:t.description}):null,n?(0,J.jsx)(o,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-primary`}):null]},t.name)})}):null,g.length>0?(0,J.jsx)(U,{heading:`Global`,children:g.map(e=>ee(e,!1))}):null]})]})})]})]})}function rd({repo:e}){let t=R(),n=j({mutationFn:e=>et({baseBranch:e}),onSuccess:e=>{t.invalidateQueries({queryKey:L.repo}),I(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=>I(e.message,{tone:`danger`})});return e.info?(0,J.jsx)(Wr,{slot:`base-pill`,ariaLabel:`Base branch`,label:(0,J.jsxs)(`span`,{className:`font-mono text-[11.5px]`,children:[`base: `,e.baseBranch??e.info.branch]}),value:e.baseBranch??``,onPick:e=>n.mutate(e===``?null:e),options:[{value:``,label:`follow checked-out branch (${e.info.branch})`,desc:`New task worktrees fork from whatever branch is checked out`},...e.branches.map(e=>({value:e,label:e}))]}):null}function id({planFirst:e,planning:t,onModeChange:n}){return(0,J.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,J.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":!e,onClick:()=>n(!1),className:H(`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:`Start`}),(0,J.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":e,"aria-busy":t||void 0,"data-slot":`mode-plan`,onClick:()=>n(!0),className:H(`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`})]})}var ad=[`Fix a failing or flaky test`,`Summarize recent commits on this branch`,`Update the README for recent changes`];function od({onPick:e}){return(0,J.jsx)(`div`,{className:`mt-7 flex flex-wrap justify-center gap-2 max-md:justify-start`,children:ad.map(t=>(0,J.jsxs)(`button`,{type:`button`,"data-slot":`suggested-chip`,onClick:()=>e(t),className:`inline-flex h-[30px] items-center gap-1.5 rounded-full border border-border px-3 text-[12.5px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:[(0,J.jsx)(Zr,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),t]},t))})}function sd(){return(0,J.jsx)(`div`,{"data-route":`not-found`,className:`flex min-h-full flex-col`,children:(0,J.jsx)(z,{icon:(0,J.jsx)(Fa,{}),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,J.jsx)(P,{asChild:!0,variant:`outline`,children:(0,J.jsx)(G,{to:`/`,children:`Back to tasks`})})})})}function cd(){return(0,J.jsx)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:(0,J.jsx)(z,{icon:(0,J.jsx)(mt,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading repository…`,subtitle:`Fetching the repo's git state.`})})}function ld(){return(0,J.jsxs)(`div`,{"data-route":`skills`,className:`flex min-h-full flex-col`,children:[(0,J.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,J.jsx)(`h1`,{className:`text-base font-semibold`,children:`Skills`}),(0,J.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Markdown playbooks agents can follow.`})]}),(0,J.jsx)(`p`,{"data-slot":`skills-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading skills…`})]})}function ud({projectId:e,registry:t}){let n=t.projects.length?t.projects:[{id:t.bootProject,name:t.bootProject}];return(0,J.jsx)(`div`,{"data-route":`unknown-project`,className:`flex min-h-full flex-col`,children:(0,J.jsx)(z,{icon:(0,J.jsx)(Ua,{}),tone:`neutral`,title:`“${e}” isn’t registered here`,subtitle:`This xezar 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,J.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,J.jsx)(`li`,{children:(0,J.jsxs)(k,{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,J.jsxs)(`span`,{className:`font-mono text-[11px] font-normal text-soft-foreground`,children:[`/p/`,e.id]})]})},e.id))})})})}function dd(){return(0,J.jsx)(`div`,{"data-route":`workflows`,className:`flex min-h-full flex-col`,children:(0,J.jsx)(z,{icon:(0,J.jsx)(mt,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading workflows…`,subtitle:`Fetching the saved chains and the skills palette.`})})}function fd({tab:e}){return(0,J.jsx)(`div`,{"data-route":`task-${e}`,className:`flex min-h-full flex-col`,children:(0,J.jsx)(z,{icon:(0,J.jsx)(mt,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:e===`changes`?`Loading changes…`:`Loading files…`,subtitle:`Fetching the run record.`})})}function pd({tab:e,error:t}){let n=t instanceof Kt&&t.status===404;return(0,J.jsx)(`div`,{"data-route":`task-${e}`,className:`flex min-h-full flex-col`,children:(0,J.jsx)(z,{icon:n?(0,J.jsx)(Xr,{}):(0,J.jsx)(Qr,{}),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,J.jsx)(P,{asChild:!0,variant:`outline`,children:(0,J.jsx)(G,{to:`/`,children:`Back to tasks`})})})})}function md({className:e,orientation:t=`horizontal`,...n}){return(0,J.jsx)($o,{"data-slot":`tabs`,"data-orientation":t,orientation:t,className:H(`group/tabs flex gap-2 data-[orientation=horizontal]:flex-col`,e),...n})}var hd=me(`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 gd({className:e,variant:t=`default`,...n}){return(0,J.jsx)(es,{"data-slot":`tabs-list`,"data-variant":t,className:H(hd({variant:t}),e),...n})}function _d({className:e,...t}){return(0,J.jsx)(ts,{"data-slot":`tabs-trigger`,className:H(`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-[12.5px] font-medium whitespace-nowrap text-muted-foreground transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 group-data-[variant=default]/tabs-list:data-[state=active]:shadow-xs group-data-[variant=line]/tabs-list:data-[state=active]:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent`,`data-[state=active]:bg-card data-[state=active]:font-semibold data-[state=active]:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-[state=active]:after:opacity-100`,e),...t})}function vd({className:e,...t}){return(0,J.jsx)(ns,{"data-slot":`tabs-content`,className:H(`flex-1 outline-none`,e),...t})}function yd(e){return tr.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 bd=e=>e.length>tr.length;function xd({rows:e,runner:t,accountFor:n,providerStatus:r,disabled:i=!1,accountDisabled:a=!1,onPick:o}){let s=bd(e);return(0,J.jsx)(`div`,{role:`radiogroup`,"aria-label":`Default runner`,"data-slot":`agents-runner`,className:H(`gap-0.5 rounded-md border border-border bg-card p-0.5`,s?`flex max-w-md flex-col`:`inline-flex w-fit`),children:e.map(c=>{let l=ht(r.data,c.runner.id),u=!r.isPending&&!r.isError&&l?.enabled===!0&&l.status===`connected`,d=r.isPending?`Checking provider authentication…`:r.isError?`Provider authentication could not be verified.`:l?.enabled===!1?`This provider is disabled. Enable it above or choose another provider.`:u?void 0:`Connect this provider before selecting it.`,f=e.filter(e=>e.runner.id===c.runner.id).length>1,p=c.runner.id===t&&c.account===n(c.runner.id);return(0,J.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":p,"data-value":c.runner.id,"data-account":c.account??``,title:d??c.desc,disabled:i||!u||f&&a,onClick:()=>o(c.runner.id,c.account,f),className:H(`rounded-sm px-3 py-1.5 text-left font-mono text-[13px] font-medium transition-colors disabled:opacity-50`,p?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:[c.label,s?(0,J.jsx)(`span`,{"data-slot":c.missing?`agents-account-missing`:`agents-account-dir`,"data-runner":c.runner.id,className:`ml-2 font-sans text-[11.5px] text-soft-foreground`,children:c.desc}):null]},`${c.runner.id}:${c.account??``}`)})})}function Sd({open:e,onOpenChange:t,providers:n,initialProvider:r}){let[i,a]=(0,q.useState)(null),[o,s]=(0,q.useState)(null),[c,l]=(0,q.useState)(r??n[0]??`claude`),[u,d]=(0,q.useState)(``),[f,p]=(0,q.useState)(``),[m,h]=(0,q.useState)(!1),g=te(),_=f.trim();return(0,J.jsx)(hi,{open:e,onOpenChange:t,children:(0,J.jsxs)(li,{"data-slot":`add-account-dialog`,className:`sm:max-w-lg`,children:[(0,J.jsxs)(ui,{children:[(0,J.jsx)(fi,{children:`Add agent account`}),(0,J.jsx)(mi,{children:`The config folder this account uses. It does not have to exist yet — Connect signs in and the CLI creates it.`})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`label`,{className:`flex items-center gap-2 text-[13px]`,children:[(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`Agent`}),(0,J.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,J.jsx)(`option`,{value:e,children:e},e))})]}),(0,J.jsxs)(`label`,{className:`flex min-w-0 flex-1 items-center gap-2 text-[13px]`,children:[(0,J.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Name`}),(0,J.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,J.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,J.jsxs)(`label`,{className:`flex min-w-0 items-center gap-2 text-[13px]`,children:[(0,J.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Folder`}),(0,J.jsx)(`input`,{type:`text`,spellCheck:!1,autoComplete:`off`,"aria-label":`Config folder`,"data-slot":`add-account-dir`,value:f,placeholder:c===`codex`?`~/.codex-second`:`~/.claude-second`,onChange:e=>{p(e.target.value),s(null),g.reset()},className:`min-w-0 flex-1 rounded-md border border-input bg-card px-2 py-1 font-mono text-[12.5px] outline-none focus-visible:border-ring`}),(0,J.jsx)(P,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`add-account-browse`,"aria-expanded":m,onClick:()=>h(e=>!e),children:m?`Hide folders`:`Browse…`})]}),(0,J.jsxs)(`p`,{className:`text-[11.5px] text-soft-foreground`,children:[`A `,(0,J.jsx)(`code`,{children:`~`}),` is kept as written and expanded when the agent runs.`]})]}),m?(0,J.jsx)(Gs,{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,J.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,J.jsxs)(gi,{className:`min-w-0 sm:items-center sm:justify-end`,children:[(0,J.jsx)(P,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,J.jsx)(P,{"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),I(`Account added — use Connect to sign in`)}})},children:g.isPending?`Adding…`:`Add account`})]})]})})}var Cd={claude:`Claude Code`,codex:`Codex`,opencode:`OpenCode`,pi:`pi`},wd={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`},Td={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 Ed(){let e=le();return e.isPending?(0,J.jsx)(`p`,{"data-slot":`accounts-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent accounts…`}):e.isError?(0,J.jsx)(z,{icon:(0,J.jsx)(Ja,{}),tone:`danger`,title:`Agent accounts did not load`,subtitle:e.error.message,heading:`h2`}):(0,J.jsx)(Dd,{data:e.data})}function Dd({data:e}){let t=M(),[n,r]=(0,q.useState)(null),[i,a]=(0,q.useState)(null),o=Gt(),s=[`claude`,`codex`,`opencode`,`pi`];return e.editable?(0,J.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,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Agent accounts`}),(0,J.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`One agent per tab: whether it is installed, and which logins you have. Add a second config folder to keep a work account beside a personal one; each project picks which it uses in its own Agents settings.`})]}),(0,J.jsx)(kd,{profiles:e}),(0,J.jsxs)(md,{defaultValue:`claude`,children:[(0,J.jsx)(gd,{variant:`line`,"data-slot":`accounts-tabs`,children:s.map(e=>(0,J.jsx)(_d,{value:e,"data-provider":e,children:Cd[e]},e))}),s.map(n=>(0,J.jsx)(vd,{value:n,className:`pt-4`,children:(0,J.jsx)(Od,{provider:n,check:t.data?.checks?.find(e=>e.name===n),accounts:e.profiles.filter(e=>e.provider===n),canCarryAccounts:e.profileCapableProviders.includes(n),onAdd:()=>r(n),onRemove:a})},n))]}),n===null?null:(0,J.jsx)(Sd,{open:!0,onOpenChange:e=>!e&&r(null),providers:e.profileCapableProviders,initialProvider:n},n),(0,J.jsx)(ci,{open:i!==null,onOpenChange:e=>!e&&a(null),children:(0,J.jsxs)(ri,{"data-slot":`accounts-remove-confirm`,children:[(0,J.jsxs)(si,{children:[(0,J.jsxs)(ni,{children:[`Remove “`,i?.label,`”?`]}),(0,J.jsxs)(ti,{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,J.jsxs)(ai,{children:[(0,J.jsx)(oi,{children:`Cancel`}),(0,J.jsx)(ii,{"data-action":`accounts-remove-confirm`,disabled:o.isPending,onClick:()=>{let e=i;e&&o.mutate(e.id,{onSuccess:()=>{a(null),I(`Removed ${e.label}`)},onError:e=>I(e.message,{tone:`danger`})})},children:`Remove`})]})]})})]}):(0,J.jsxs)(`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,J.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Agent accounts`}),(0,J.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 Od({provider:e,check:t,accounts:n,canCarryAccounts:r,onAdd:i,onRemove:a}){let o=t?.available===!0;return(0,J.jsxs)(`div`,{"data-slot":`accounts-provider`,"data-provider":e,className:`flex flex-col gap-4`,children:[(0,J.jsxs)(`dl`,{className:`divide-y divide-border/60 overflow-hidden rounded-md border border-border bg-card text-[13px]`,children:[(0,J.jsx)(Ad,{label:`Installed`,children:t===void 0?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`Checking…`}):o?(0,J.jsx)(`span`,{"data-slot":`agent-installed`,children:`Yes`}):(0,J.jsxs)(`span`,{"data-slot":`agent-installed`,className:`text-muted-foreground`,children:[`No — `,(0,J.jsx)(`code`,{className:`text-[12px]`,children:wd[e]})]})}),o&&t?.version?(0,J.jsx)(Ad,{label:`Version`,children:(0,J.jsx)(`span`,{"data-slot":`agent-version`,className:`font-mono text-[12.5px]`,children:t.version})}):null,(0,J.jsx)(Ad,{label:`Accounts`,children:(0,J.jsx)(`span`,{children:n.length===1?`the discovered one`:`${n.length} (1 discovered, ${n.length-1} added)`})})]}),(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:`Logins`}),r?(0,J.jsx)(P,{type:`button`,variant:`outline`,size:`sm`,"data-action":`accounts-add`,"data-provider":e,onClick:i,children:`Add account`}):null]}),(0,J.jsx)(`ul`,{className:`divide-y divide-border/60 rounded-md border border-border bg-card`,children:n.map(e=>(0,J.jsx)(jd,{account:e,onRemove:()=>a(e)},e.id))}),r?null:(0,J.jsxs)(`p`,{"data-slot":`accounts-single-only`,className:`text-[11.5px] text-soft-foreground`,children:[Cd[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 kd({profiles:e}){let t=R(),n=C(),r=Ye(),i=A(),a=ae(),o=j({mutationFn:e=>bt(e),onSuccess:e=>t.setQueryData(E.config,e),onError:e=>I(e.message,{tone:`danger`})});if(n.data===void 0)return null;let s=yd(e.profiles),c=n.data.agentDefaults.runner??`claude`,l=n.data.agentDefaults.models??{};return(0,J.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,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:`Defaults for new projects`}),(0,J.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,J.jsx)(xd,{rows:s,runner:c,accountFor:t=>e.defaults[t]??null,providerStatus:r,disabled:o.isPending,accountDisabled:a.isPending,onPick:(e,t,n)=>{e!==c&&o.mutate({agentDefaults:{runner:e}}),n&&a.mutate({projectId:null,provider:e,profileId:t},{onError:e=>I(e.message,{tone:`danger`})})}}),(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Default model per agent`}),tr.map(e=>(0,J.jsxs)(`label`,{className:`flex items-center gap-3`,children:[(0,J.jsx)(`span`,{className:`w-24 shrink-0 font-mono text-xs text-muted-foreground`,children:e.label}),(0,J.jsxs)(`select`,{"aria-label":`Default model for ${e.label}`,"data-slot":`accounts-default-model`,"data-runner":e.id,value:l[e.id]??``,disabled:o.isPending,onChange:t=>o.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:[nr(e.id,i[e.id].data,[l[e.id]]).map(e=>(0,J.jsx)(`option`,{value:e.id,children:e.id===``?`auto (default)`:e.label},e.id)),Kn(e.id,i[e.id].data,i[e.id].isError)?(0,J.jsx)(`option`,{disabled:!0,children:Kn(e.id,i[e.id].data,i[e.id].isError)}):null]})]},e.id))]})]})}function Ad({label:e,children:t}){return(0,J.jsxs)(`div`,{className:`flex items-baseline gap-3 px-3.5 py-2.5`,children:[(0,J.jsx)(`dt`,{className:`w-28 shrink-0 text-muted-foreground`,children:e}),(0,J.jsx)(`dd`,{className:`min-w-0 flex-1`,children:t})]})}function jd({account:e,onRemove:t}){let[n,r]=(0,q.useState)(!1),i=cn(e),a=c(),o=Ot(),s=ge(i,e.status===void 0),l=e.status??s.data?.status,u=l?Td[l.status]:void 0;return(0,J.jsxs)(`li`,{"data-slot":`account-row`,"data-account":e.id,className:`flex flex-col gap-2 px-3.5 py-3`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`text-[13px] font-medium text-foreground`,children:e.label}),e.isDefault?(0,J.jsx)(Ws,{variant:`ghost`,className:`shrink-0 text-[10px] text-muted-foreground`,children:`discovered`}):null]}),(0,J.jsx)(`p`,{"data-slot":`account-path`,className:`mt-0.5 truncate font-mono text-[11.5px] text-soft-foreground`,title:e.path,children:e.configDir}),(0,J.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-xs text-muted-foreground`,children:[(0,J.jsx)(K,{tone:u?.tone??`neutral`,pulse:u===void 0}),(0,J.jsx)(`span`,{"data-slot":`account-status`,children:u?.label??`Checking…`}),e.exists?e.looksValid?null:(0,J.jsxs)(`span`,{"data-slot":`account-unrecognised`,children:[`— this folder does not look like `,Cd[e.provider],` config yet`]}):(0,J.jsx)(`span`,{"data-slot":`account-missing`,children:`— folder not created yet; Connect will make it`})]})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[l?.status===`connected`?null:(0,J.jsx)(P,{type:`button`,size:`sm`,"data-action":`account-connect`,disabled:a.isPending,onClick:()=>a.mutate({provider:e.provider,...e.isDefault?{}:{profileId:e.id}},{onSuccess:e=>I(e.opened?`Finish signing in in the terminal, then Check again.`:`This account is already connected.`),onError:e=>I(e instanceof Kt&&e.command?`${e.message} — run: ${e.command}`:e.message,{tone:`danger`})}),children:`Connect`}),(0,J.jsx)(P,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`account-recheck`,disabled:o.isPending,title:`Re-probe this account's login now, instead of waiting for the cached answer`,onClick:()=>o.mutate(i,{onError:e=>I(e.message,{tone:`danger`})}),children:`Check again`}),(0,J.jsx)(P,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`account-details-toggle`,"aria-expanded":n,onClick:()=>r(e=>!e),children:n?`Hide details`:`Show details`})]})]}),n?(0,J.jsx)(Md,{account:e,routeId:i,onRemove:t}):null]})}function Md({account:e,routeId:t,onRemove:n}){let r=de(t,!0),i=Nt(),a=dt(),[o,s]=(0,q.useState)(!1),[c,l]=(0,q.useState)(e.label),u=re(),d=a.data?.targets??[],f=d.filter(e=>xn(e.id)===void 0&&e.id!==`terminal`&&e.id!==`finder`).map(e=>({target:e})),p=d.filter(e=>xn(e.id)===void 0).map(e=>({target:e})),m=(e,n,r)=>i.mutate({routeId:t,file:e,...r?{target:r}:{}},{onError:e=>I(e.message,{tone:`danger`}),onSuccess:()=>I(`Opened ${n}`)});return(0,J.jsxs)(`div`,{"data-slot":`account-details`,className:`rounded-md border border-border/60 bg-muted/30 p-3`,children:[r.isPending?(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Reading account details…`}):r.isError?(0,J.jsx)(`p`,{"data-slot":`account-details-error`,className:`text-xs text-danger`,children:r.error.message}):r.data.available?(0,J.jsx)(`dl`,{"data-slot":`account-identity`,className:`grid grid-cols-[7rem_minmax(0,1fr)] gap-x-3 gap-y-1 text-xs`,children:r.data.fields.map(e=>(0,J.jsxs)(q.Fragment,{children:[(0,J.jsx)(`dt`,{className:`text-muted-foreground`,children:e.label}),(0,J.jsx)(`dd`,{className:`min-w-0 truncate text-foreground`,title:e.value,children:e.value})]},e.label))}):(0,J.jsx)(`p`,{"data-slot":`account-identity-unavailable`,className:`text-xs text-muted-foreground`,children:r.data.reason??`No account details to show.`}),(0,J.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5 border-t border-border/60 pt-2.5`,children:[(0,J.jsx)(`span`,{className:`mr-1 text-xs text-muted-foreground`,children:`Config files`}),e.files.map(e=>(0,J.jsx)(Tn,{slot:`account-open-file`,label:e.label,triggerVariant:`outline`,disabled:i.isPending,title:e.exists?e.path:`${e.path} — not created yet`,choices:f,onPick:t=>m(e.id,e.label,t),leading:(0,J.jsxs)(Cr,{"data-target":`system`,onSelect:()=>m(e.id,e.label),children:[(0,J.jsx)(fr,{"aria-hidden":`true`}),`System default`]})},e.id)),(0,J.jsx)(Tn,{slot:`account-open-folder`,label:`Folder`,disabled:i.isPending,title:e.path,choices:p,onPick:e=>m(`folder`,`folder`,e),leading:(0,J.jsxs)(Cr,{"data-target":`system`,onSelect:()=>m(`folder`,`folder`),children:[(0,J.jsx)(fr,{"aria-hidden":`true`}),`System default`]})})]}),e.isDefault?null:(0,J.jsxs)(`div`,{"data-slot":`account-manage`,className:`mt-3 flex flex-wrap items-center gap-2 border-t border-border/60 pt-2.5`,children:[(0,J.jsx)(`span`,{className:`mr-1 text-xs text-muted-foreground`,children:`Account`}),o?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`input`,{type:`text`,autoFocus:!0,"aria-label":`Name for ${e.label}`,"data-slot":`account-rename-input`,value:c,onChange:e=>l(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,J.jsx)(P,{type:`button`,size:`sm`,"data-action":`account-rename-save`,disabled:u.isPending||c.trim()===``||c.trim()===e.label,onClick:()=>u.mutate({id:e.id,label:c.trim()},{onSuccess:()=>s(!1),onError:e=>I(e.message,{tone:`danger`})}),children:`Save`}),(0,J.jsx)(P,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{l(e.label),s(!1)},children:`Cancel`})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(P,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-rename`,onClick:()=>s(!0),children:`Rename`}),(0,J.jsx)(P,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-remove`,onClick:n,children:`Remove`}),(0,J.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Renaming changes what xezar calls this account, not its folder.`})]})]})]})}var Nd=1500;function Pd(e,t){let n=(0,q.useMemo)(()=>e.split(`
4
+ `).map(e=>[{content:e}]),[e]),r=(0,q.useMemo)(()=>Ki(t),[t]),i=n.length>Nd,[a,o]=(0,q.useState)(null);return(0,q.useEffect)(()=>{if(r===null||i)return;let t=!1;return qi(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:Gi(e,r)?.tokens??n}var Fd=`m-0 min-h-full w-full whitespace-pre font-mono text-xs leading-[1.7] px-3 py-2 [tab-size:2]`;function Id({value:e,onChange:t,language:n,readOnly:r,className:i,...a}){let o=Pd(e,n),s=(0,q.useRef)(null),c=(0,q.useRef)(null),l=()=>{let e=c.current,t=s.current;!e||!t||(t.scrollTop=e.scrollTop,t.scrollLeft=e.scrollLeft)};return(0,q.useLayoutEffect)(l,[e]),(0,J.jsxs)(`div`,{"data-slot":`code-editor`,className:H(`relative overflow-hidden rounded-md border border-input bg-card`,i),children:[(0,J.jsx)(`pre`,{ref:s,"aria-hidden":`true`,className:H(Fd,`pointer-events-none absolute inset-0 overflow-auto text-soft-foreground`),children:o.map((e,t)=>(0,J.jsx)(`span`,{className:`block`,children:e.length===0?`
5
+ `:(0,J.jsxs)(J.Fragment,{children:[e.map((e,t)=>(0,J.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t)),`
6
+ `]})},t))}),(0,J.jsx)(`textarea`,{ref:c,"data-slot":`code-editor-input`,value:e,readOnly:r,onChange:e=>t?.(e.target.value),onScroll:l,spellCheck:!1,autoCorrect:`off`,autoCapitalize:`off`,autoComplete:`off`,wrap:`off`,className:H(Fd,`relative block resize-none overflow-auto bg-transparent text-transparent caret-foreground outline-none`,`selection:bg-primary/30 focus-visible:ring-0`,r&&`cursor-default`),...a})]})}var Ld=`An editor-plus-commit: a saved change reaches a run after you commit it to the base branch.`;function Rd(e){return t=>t.runners.includes(e)}function zd(e,t,n,r){let i=Rd(e);return{id:t,label:n,note:r,files:t===`mcp`?e=>i(e)&&(e.holdsMcp===!0||e.kind===`mcp`):e=>i(e)&&e.kind===t}}var Bd=[{id:`claude`,label:`Claude`,groups:[zd(`claude`,`settings`,`Settings`),zd(`claude`,`mcp`,`MCP`,`A dedicated .mcp.json (key: mcpServers), shared via version control.`),zd(`claude`,`memory`,`Memory & instructions`)]},{id:`codex`,label:`Codex`,note:Ld,groups:[zd(`codex`,`settings`,`Settings`),zd(`codex`,`mcp`,`MCP`,`Inside config.toml under [mcp_servers.<id>] — the same file as Codex’s settings.`),zd(`codex`,`memory`,`Memory & instructions`)]},{id:`opencode`,label:`OpenCode`,note:Ld,groups:[zd(`opencode`,`settings`,`Settings`),zd(`opencode`,`mcp`,`MCP`,`Under the "mcp" key in opencode.json — the same file as OpenCode’s settings.`),zd(`opencode`,`memory`,`Memory & instructions`)]}];function Vd(e){let t=Bd.find(t=>t.id===e);if(!t)throw Error(`no agent descriptor for ${e}`);return t}function Hd(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 Ud(){let e=b(),t=M(),n=(0,q.useMemo)(()=>t.data?ir(t.data.checks):Bd.map(e=>e.id),[t.data]);return e.isPending?(0,J.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,J.jsx)(z,{icon:(0,J.jsx)(za,{}),tone:`danger`,title:`Agent config did not load`,subtitle:e.error.message,heading:`h2`}):(0,J.jsx)(Wd,{listing:e.data,installed:n})}function Wd({listing:e,installed:t}){let[n,r]=(0,q.useState)(`claude`),[i,a]=(0,q.useState)(null),o=Vd(n),s=e.files.find(e=>e.id===i)??null,c=e=>{r(e),a(null)};return(0,J.jsxs)(`div`,{"data-slot":`agent-config`,className:`flex flex-col gap-4 p-4 md:p-6`,children:[!e.editable&&(0,J.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,J.jsx)(`div`,{"data-slot":`agent-config-agents`,role:`tablist`,className:`flex flex-wrap gap-1 rounded-md bg-muted/40 p-1`,children:Bd.map(e=>(0,J.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":e.id===o.id,"data-slot":`agent-config-agent`,"data-agent":e.id,"data-selected":e.id===o.id,onClick:()=>c(e.id),className:H(`flex items-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,J.jsx)(Ws,{variant:`outline`,className:`text-[10px] text-soft-foreground`,children:`not installed`})]},e.id))}),o.note&&(0,J.jsx)(`p`,{"data-slot":`agent-config-agent-note`,className:`text-[12px] text-soft-foreground`,children:o.note}),(0,J.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[minmax(0,20rem)_minmax(0,1fr)]`,children:[(0,J.jsx)(`nav`,{"data-slot":`agent-config-nav`,className:`flex flex-col gap-5`,children:(0,J.jsx)(Gd,{agent:o,listing:e,selectedId:i,onSelect:a})}),(0,J.jsx)(`div`,{"data-slot":`agent-config-editor-pane`,children:s?(0,J.jsx)(qd,{file:s},s.id):(0,J.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 Gd({agent:e,listing:t,selectedId:n,onSelect:r}){return(0,J.jsx)(J.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)?null:(0,J.jsxs)(`section`,{"data-slot":`agent-config-group`,"data-group":i.id,"data-agent":e.id,children:[(0,J.jsx)(`p`,{className:`mb-1 text-[11px] font-medium uppercase tracking-wide text-soft-foreground`,children:i.label}),i.note&&(0,J.jsx)(`p`,{className:`mb-2 text-[12px] text-soft-foreground`,children:i.note}),(0,J.jsx)(`ul`,{className:`flex flex-col gap-1`,children:a.map(e=>(0,J.jsx)(`li`,{children:(0,J.jsxs)(`button`,{type:`button`,"data-slot":`agent-config-file`,"data-selected":e.id===n,onClick:()=>r(e.id),className:H(`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-[13px] transition-colors`,e.id===n?`bg-primary/15 text-foreground`:`hover:bg-muted/60`),children:[(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[12px]`,children:e.label}),e.seeded&&(0,J.jsx)(Ws,{variant:`outline`,className:`shrink-0 text-[10px]`,children:`seeded`}),!e.exists&&(0,J.jsx)(`span`,{className:`shrink-0 text-[11px] text-soft-foreground`,children:`absent`})]})},e.id))}),o&&t.userMcp&&(0,J.jsx)(Kd,{userMcp:t.userMcp})]},i.id)})})}function Kd({userMcp:e}){return(0,J.jsxs)(`div`,{"data-slot":`agent-config-user-mcp`,className:`mt-3`,children:[(0,J.jsx)(`h4`,{className:`mb-1 text-[12px] font-semibold`,children:`User & local scopes`}),(0,J.jsxs)(`p`,{className:`mb-2 text-[12px] text-soft-foreground`,children:[`Managed by `,(0,J.jsx)(`code`,{className:`font-mono`,children:`claude mcp add`}),` in `,e.path,` — xezar does not edit Claude’s state file.`]}),e.readable?e.servers.length>0?(0,J.jsx)(`ul`,{className:`flex flex-wrap gap-1`,children:e.servers.map(e=>(0,J.jsx)(`li`,{children:(0,J.jsx)(Ws,{variant:`outline`,className:`font-mono text-[11px]`,children:e})},e))}):(0,J.jsx)(`p`,{className:`text-[12px] text-soft-foreground`,children:`No user-scoped MCP servers.`}):(0,J.jsx)(`p`,{className:`text-[12px] text-soft-foreground`,children:`Could not read the file.`})]})}function qd({file:e}){let t=w(e.id),n=tt(e.id),[r,i]=(0,q.useState)(null),[a,o]=(0,q.useState)(!1),[s,c]=(0,q.useState)(null),l=t.data?.version??null;(0,q.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,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.label}),(0,J.jsx)(Ws,{variant:`outline`,className:`text-[10px] uppercase`,children:e.format}),(0,J.jsx)(`a`,{href:e.docsUrl,target:`_blank`,rel:`noreferrer`,className:`text-[12px] text-soft-foreground underline hover:text-foreground`,children:`docs`})]}),(0,J.jsx)(`p`,{"data-slot":`agent-config-precedence`,className:`text-[12px] text-soft-foreground`,children:e.precedence}),(0,J.jsxs)(`p`,{"data-slot":`agent-config-effect`,className:`text-[12px] text-foreground/80`,children:[Hd(e),e.hotReload?` ${e.hotReload}`:``]}),t.isPending?(0,J.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:`Loading file…`}):t.isError?(0,J.jsx)(`p`,{className:`text-[13px] text-destructive`,children:t.error.message}):(0,J.jsx)(Id,{value:u,language:e.format,readOnly:!f,onChange:i,"aria-label":`${e.label} contents`,className:`h-[26rem]`}),s&&(0,J.jsx)(`p`,{"data-slot":`agent-config-format-error`,className:`text-[12px] text-destructive`,children:s}),a&&(0,J.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,J.jsx)(`span`,{children:`The file changed on disk since you opened it.`}),(0,J.jsx)(P,{size:`sm`,variant:`outline`,onClick:()=>void t.refetch(),children:`Reload from disk`})]}),f&&(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(P,{size:`sm`,onClick:()=>{c(null),o(!1),n.mutate({content:u,version:l},{onSuccess:()=>{i(null),I(`${e.exists?`Saved`:`Created`} ${e.label}`)},onError:e=>{e instanceof Kt&&e.status===409?o(!0):e instanceof Kt&&e.status===400?c(e.message):I(e.message,{tone:`danger`})}})},disabled:!d||n.isPending,children:e.exists?`Save`:`Create`}),(0,J.jsx)(P,{size:`sm`,variant:`ghost`,onClick:()=>i(null),disabled:!d||n.isPending,children:`Revert`}),d&&(0,J.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:`Unsaved changes`})]})]})}function Jd({className:e,size:t=`default`,...n}){return(0,J.jsx)(jo,{"data-slot":`switch`,"data-size":t,className:H(`peer group/switch inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-[1.15rem] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input`,e),...n,children:(0,J.jsx)(No,{"data-slot":`switch-thumb`,className:H(`pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0`)})})}var Yd=[{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`}],Xd=e=>({claude:e,codex:e,opencode:e,pi:e}),Zd={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 Qd(e,t,n){return{providers:e.providers.map(e=>e.provider===t?{...e,enabled:n}:e)}}function $d(){let e=Ye(),t=at(),n=Jt(),r=R(),[i,a]=(0,q.useState)(null),o=(0,q.useRef)(Promise.resolve()),s=(0,q.useRef)(Xd(0)),c=(0,q.useRef)(Xd(0)),l=(0,q.useRef)(e.data);(0,q.useEffect)(()=>{i&&ht(e.data,i.provider)?.status===`connected`&&a(null)},[i,e.data]),(0,q.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?ht(l.current,e.provider)?.enabled??e.enabled:e.enabled}))}}},[e.data]);let u=(0,q.useCallback)((e,t)=>{let n=E.providerStatus,i=r.getQueryData(n);if(!i)return;l.current||=i;let a=Qd(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 m(e,t),a=ht(i,e)?.enabled;if(a===void 0)return;if(l.current=Qd(l.current??i,e,a),u===s.current[e]){let t=r.getQueryData(n);r.setQueryData(n,t?Qd(t,e,a):i)}}catch(t){if(u===s.current[e]){let i=ht(l.current,e)?.enabled,a=r.getQueryData(n);a&&i!==void 0?r.setQueryData(n,Qd(a,e,i)):l.current?r.setQueryData(n,l.current):r.removeQueries({queryKey:n,exact:!0}),I(t instanceof Error?t.message:String(t),{tone:`danger`})}}finally{--c.current[e]}})},[r]),d=j({mutationFn:e=>_e(e),onSuccess:async e=>{a(null),I(e.opened?`Finish signing in in the terminal, then check again.`:`Provider is already connected.`),await r.invalidateQueries({queryKey:E.providerStatus})},onError:(e,t)=>{if(e instanceof Kt&&e.command){let n=Yd.find(e=>e.id===t)?.label??t;a({provider:t,label:n,message:e.message,command:e.command});return}I(e.message,{tone:`danger`})}}),f=async e=>{try{await navigator.clipboard.writeText(e),I(`Command copied`)}catch{I(`Could not copy the command`,{tone:`danger`})}};return(0,J.jsxs)(`section`,{id:`providers`,"data-slot":`provider-settings`,className:`scroll-mt-20`,children:[(0,J.jsxs)(`div`,{className:`mb-2`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Providers`}),(0,J.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Connect the coding agents available on this computer.`})]}),e.isError?(0,J.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,J.jsxs)(`div`,{children:[(0,J.jsx)(`p`,{className:`text-[13px] font-medium text-foreground`,children:`Provider status could not be loaded`}),(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.error.message})]}),(0,J.jsx)(P,{type:`button`,variant:`outline`,size:`sm`,disabled:e.isFetching,onClick:()=>void e.refetch(),children:`Retry`})]}):null,(0,J.jsx)(`div`,{className:`flex flex-col gap-2`,children:Yd.map(r=>{let a=ht(e.data,r.id),o=a?.status,s=o?Zd[o]:e.isPending?{label:`Checking…`,tone:`neutral`}:Zd.unknown,c=d.isPending&&d.variables===r.id,l=o===`disconnected`||o===`unknown`,p=a?.authFailureId;return(0,J.jsxs)(q.Fragment,{children:[(0,J.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,J.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:r.label}),(0,J.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,J.jsx)(K,{tone:s.tone,pulse:e.isPending}),(0,J.jsx)(`span`,{children:s.label}),a?.enabled===!1?(0,J.jsx)(`span`,{children:`Disabled`}):null]}),o===`not-installed`?(0,J.jsxs)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:[`Install `,r.label,`, then run `,(0,J.jsx)(`code`,{children:r.login}),`.`]}):o===`unknown`||e.isError&&!o?(0,J.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:`Verification failed. Check again when the provider is available.`}):a?.hint?(0,J.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:a.hint}):null]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[o===`not-installed`?null:(0,J.jsx)(Jd,{checked:a?.enabled??!0,"aria-label":`Use ${r.label}`,onCheckedChange:e=>u(r.id,e)}),l?(0,J.jsx)(P,{type:`button`,variant:`ghost`,size:`sm`,disabled:t.isPending,onClick:()=>t.mutate(void 0,{onError:e=>I(e.message,{tone:`danger`})}),children:`Check again`}):null,o===`disconnected`?(0,J.jsx)(P,{type:`button`,variant:`outline`,size:`sm`,disabled:d.isPending,onClick:()=>d.mutate(r.id),children:c?`Opening…`:`Connect`}):null,p===void 0?null:(0,J.jsx)(P,{type:`button`,variant:`outline`,size:`sm`,disabled:n.isPending,onClick:()=>n.mutate({provider:r.id,authFailureId:p},{onSuccess:()=>I(`${r.label} can be tried again.`),onError:e=>I(e.message,{tone:`danger`})}),children:`Try again`})]})]}),p===void 0?null:(0,J.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`Use this after completing the provider sign-in flow. xezar cannot validate the credential without a task/model request; it will verify it on the next task.`})]}),i?.provider===r.id&&o!==`connected`?(0,J.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,J.jsx)(`p`,{className:`text-[13px] text-foreground`,children:i.message}),(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,J.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,J.jsx)(P,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void f(i.command),children:`Copy command`})]})]}):null]},r.id)})})]})}var ef=2e4;function tf(){let e=nn(),t=A(),n=Ye();return e.isPending?(0,J.jsx)(`p`,{"data-slot":`agents-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent settings…`}):e.isError?(0,J.jsx)(z,{icon:(0,J.jsx)(wn,{}),tone:`danger`,title:`Agent settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,J.jsx)(nf,{config:e.data,catalogs:t,providerStatus:n})}function nf({config:e,catalogs:t,providerStatus:n}){let r=Zt(),i=R(),a=j({mutationFn:e=>et(e),onSuccess:e=>{i.setQueryData(L.config,e),i.invalidateQueries({queryKey:L.health}),i.invalidateQueries({queryKey:L.repo})},onError:e=>I(e.message,{tone:`danger`})}),[o,s]=(0,q.useState)(e.systemPrompt??``),c=o.trim(),l=c===(e.systemPrompt??``),u=c.length>ef;return(0,J.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,J.jsx)($d,{}),(0,J.jsx)(rf,{defaultRunner:e.defaultRunner,providerStatus:n,saving:a.isPending,onPick:e=>a.mutate({defaultRunner:e})}),(0,J.jsx)(af,{title:`Default models`,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,J.jsx)(`div`,{className:`flex max-w-md flex-col gap-2`,children:tr.map(r=>{let i=ht(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=Kn(r.id,c.data,c.isError),u=nr(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,J.jsxs)(`label`,{className:`flex items-center gap-3`,children:[(0,J.jsx)(`span`,{className:`w-24 shrink-0 font-mono text-xs text-muted-foreground`,children:r.label}),e.modelsLocked?(0,J.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 w-full rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs`,children:f}):(0,J.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 w-full 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,J.jsx)(`option`,{value:e.id,children:e.id===``?`auto (default)`:e.label},e.id)),l?(0,J.jsx)(`option`,{disabled:!0,children:l}):null]})]},r.id)})})}),(0,J.jsxs)(af,{title:`System prompt`,hint:`Extra instructions appended to every run, whichever runner executes it. This is the only place it is edited.`,children:[(0,J.jsx)(ei,{"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-32 max-w-xl`}),(0,J.jsxs)(`div`,{className:`flex max-w-xl items-center gap-3`,children:[(0,J.jsx)(P,{type:`button`,variant:`outline`,size:`sm`,"data-action":`agents-save-prompt`,disabled:l||u||a.isPending,onClick:()=>a.mutate({systemPrompt:c===``?null:c},{onSuccess:()=>I(c===``?`System prompt cleared`:`System prompt saved`)}),children:`Save`}),u?(0,J.jsxs)(`p`,{"data-slot":`agents-prompt-limit`,className:`text-[11px] text-danger`,children:[c.length.toLocaleString(),` characters — the limit is`,` `,ef.toLocaleString(),`.`]}):(0,J.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Leave empty and save to clear. Applied to new runs only.`})]})]}),(0,J.jsx)(af,{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,J.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,J.jsx)(Jd,{"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:()=>I(e?`Live title updates on`:`Live title updates off`)})}),(0,J.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.liveTitleUpdates??!0?`On`:`Off`,e.liveTitleUpdates===null&&` (default)`]})]})}),(0,J.jsx)(af,{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,J.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,J.jsx)(Jd,{"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:()=>I(e?`Review gate on`:`Review gate off`)})}),(0,J.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.reviewGate??!1?`On`:`Off`,e.reviewGate===null&&` (default)`]})]})}),(0,J.jsx)(af,{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,J.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 w-full max-w-md 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,J.jsx)(`option`,{value:``,children:`follow checked-out branch (default)`}),r.data.branches.map(e=>(0,J.jsx)(`option`,{value:e,children:e},e))]}):(0,J.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.`})})]})}function rf({defaultRunner:e,providerStatus:t,saving:n,onPick:r}){let i=le(),a=B(),o=p(),s=Zt(),c=ae(),l=o.projectId??`default`,u=s.data?.info?.root,d=u?i.data?.selections[u]:void 0,f=i.data?.defaults,m=yd(i.data?.profiles??[]),h=bd(m);return(0,J.jsxs)(af,{title:h?`Default agent`:`Default runner`,hint:h?`Preselected for new tasks in THIS repo, and used by the chain planner. Each task can still pick another agent or account. The account is stored on this machine only — it is never committed, so a teammate keeps their own.`:`Preselected for new tasks in THIS repo, and used by the chain planner. Each task can still pick another runner.`,children:[(0,J.jsx)(xd,{rows:m,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=>I(e.message,{tone:`danger`})})}}),!t.isPending&&!t.isError&&ht(t.data,e)?.enabled===!1?(0,J.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`This provider is disabled. Enable it above or choose another provider.`}):null,h?(0,J.jsx)(`p`,{className:`max-w-md text-[13px] text-muted-foreground`,children:`Tasks already started under another account can’t be resumed here — their sessions live in that account’s folder.`}):null]})}function af({title:e,hint:t,children:n}){return(0,J.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,J.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}var of=`xez-accent`,sf=`xez-density`,cf=`xez-width`,lf=`lime`,uf=`comfortable`,df=`narrow`;function ff(e){return e===`lime`||e===`violet`?e:lf}function pf(e){return e===`comfortable`||e===`compact`||e===`ultra`?e:uf}function mf(e){return e===`narrow`||e===`wide`?e:df}function hf(e){let t=e&&typeof e==`object`?e:{};return{accent:ff(t.accent),density:pf(t.density),width:mf(t.width)}}function gf(){try{return{accent:ff(localStorage.getItem(of)),density:pf(localStorage.getItem(sf)),width:mf(localStorage.getItem(cf))}}catch{return{accent:lf,density:uf,width:df}}}function _f(e){try{localStorage.setItem(of,e.accent),localStorage.setItem(sf,e.density),localStorage.setItem(cf,e.width)}catch{}}function vf(e,t){t.accent===`lime`?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 yf=q.createContext(null);function bf({children:e}){let t=R(),n=ce(),[r,i]=q.useState(gf),a=n.data;q.useEffect(()=>{if(a===void 0)return;let e=hf(a.appearance);i(e),_f(e)},[a]),q.useLayoutEffect(()=>{vf(document.documentElement,r)},[r]);let o=q.useCallback(e=>{i(e),_f(e),ct({appearance:e}).then(e=>t.setQueryData(E.uiState,e)).catch(e=>{I(e instanceof Error?e.message:String(e),{tone:`danger`}),t.invalidateQueries({queryKey:E.uiState})})},[t]),s=q.useCallback(e=>o({...r,accent:e}),[o,r]),c=q.useCallback(e=>o({...r,density:e}),[o,r]),l=q.useCallback(e=>o({...r,width:e}),[o,r]),u=q.useMemo(()=>({accent:r.accent,density:r.density,width:r.width,setAccent:s,setDensity:c,setWidth:l}),[r,s,c,l]);return(0,J.jsx)(yf.Provider,{value:u,children:e})}function xf(){let e=q.useContext(yf);if(!e)throw Error(`xezar: useAppearance() must be called inside <AppearanceProvider>`);return e}var Sf=[{value:`system`,label:`System`,icon:no},{value:`light`,label:`Light`,icon:po},{value:`dark`,label:`Dark`,icon:ro}],Cf=[{value:`lime`,label:`Lime`,swatch:`var(--accent-lime)`},{value:`violet`,label:`Violet`,swatch:`var(--violet)`}],wf=[{value:`comfortable`,label:`Comfortable`},{value:`compact`,label:`Compact`},{value:`ultra`,label:`Compact for real`}],Tf=[{value:`narrow`,label:`Narrow`},{value:`wide`,label:`Wide`}];function Ef({slot:e,label:t,value:n,options:r,onChange:i}){return(0,J.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`,children:r.map(e=>{let t=e.value===n;return(0,J.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t,"data-value":e.value,onClick:()=>i(e.value),className:H(`flex 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,J.jsx)(e.icon,{"aria-hidden":`true`,className:`size-3.5`}):null,e.swatch?(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`size-3 rounded-full border border-border`,style:{background:e.swatch}}):null,e.label]},e.value)})})}function Df({title:e,hint:t,children:n}){return(0,J.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,J.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}function Of(){let{theme:e,setTheme:t}=mc(),{accent:n,density:r,width:i,setAccent:a,setDensity:o,setWidth:s}=xf();return(0,J.jsxs)(`div`,{"data-slot":`appearance-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,J.jsx)(Df,{title:`Theme`,hint:`System follows your OS preference. Applies to this browser.`,children:(0,J.jsx)(Ef,{slot:`appearance-theme`,label:`Theme`,value:e,options:Sf,onChange:t})}),(0,J.jsx)(Df,{title:`Accent`,hint:`The primary action color. Saved with this repo's cockpit state.`,children:(0,J.jsx)(Ef,{slot:`appearance-accent`,label:`Accent`,value:n,options:Cf,onChange:a})}),(0,J.jsx)(Df,{title:`Density`,hint:`Compact tightens spacing across the cockpit — text stays the same size.`,children:(0,J.jsx)(Ef,{slot:`appearance-density`,label:`Density`,value:r,options:wf,onChange:o})}),(0,J.jsx)(Df,{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,J.jsx)(Ef,{slot:`appearance-width`,label:`Reading width`,value:i,options:Tf,onChange:s})})]})}var kf=`http://localhost:4321`;function Af(e,t,n,r=kf,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 jf(){let e=Te();return e.isPending?(0,J.jsx)(`p`,{"data-slot":`bookmarklets-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading bookmarklets…`}):e.isError?(0,J.jsx)(z,{icon:(0,J.jsx)(Qr,{}),tone:`danger`,heading:`h2`,title:`Could not load bookmarklets`,subtitle:e.error.message}):(0,J.jsx)(`div`,{className:`flex min-h-full flex-1 overflow-y-auto px-4 py-5 md:px-7`,children:(0,J.jsx)(Mf,{skills:Bi(e.data??[])})})}function Mf({skills:e}){let t=Ze(),n=M(),r=B(),[i,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(``),c=t.data?.key??``,l=window.location.origin,u=wi()??n.data?.bootProject??null,d=r.data?.projects.find(e=>e.id===u)?.name??jh(n.data)?.name??null,f=o.trim().toLowerCase(),p=e.filter(e=>e.name.toLowerCase().includes(f));return(0,J.jsxs)(`div`,{"data-slot":`bookmarklet-panel`,className:`mx-auto w-full max-w-2xl`,children:[(0,J.jsx)(`h2`,{className:`text-base font-semibold`,children:`Run from GitHub`}),(0,J.jsxs)(`p`,{className:`mt-2 text-[13px] leading-relaxed text-muted-foreground`,children:[`Drag a button below to your browser's bookmarks bar. On any GitHub PR or issue, click it to open this cockpit directly. The cockpit must be running: `,(0,J.jsx)(`span`,{className:`font-mono`,children:`npx xezar`}),`.`]}),(0,J.jsxs)(`label`,{className:`mt-4 flex items-center gap-2 text-[13px] font-medium`,children:[(0,J.jsx)(`input`,{type:`checkbox`,"data-slot":`bm-auto`,checked:i,onChange:e=>a(e.target.checked),className:`size-3.5`}),`One-click launch (auto-submit)`,` `,(0,J.jsx)(`span`,{className:`font-normal text-soft-foreground`,children:`— re-drag the buttons after changing this`})]}),(0,J.jsx)(`div`,{"data-slot":`bm-generic`,className:`mt-4`,children:(0,J.jsx)(Nf,{label:d?`xezar (${d}): this PR/issue`:`xezar: this PR/issue`,url:Af(``,!1,c,l,u),hint:`prefills the form — nothing starts by itself`})}),(0,J.jsx)(Js,{"data-slot":`bm-filter`,placeholder:`Filter skills…`,"aria-label":`Filter bookmarklet skills`,value:o,onChange:e=>s(e.target.value),className:`mt-5 h-8 text-[13px]`}),(0,J.jsx)(`div`,{"data-slot":`bm-list`,className:`mt-3 flex flex-col gap-2`,children:p.length>0?p.map(e=>(0,J.jsx)(Nf,{label:d?`/${e.name} (${d})`:`/${e.name}`,url:Af(e.name,i,c,l,u),hint:e.source},e.path)):(0,J.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:e.length>0?`(no skills match)`:`(no skills yet — the generic launcher above still works)`})})]})}function Nf({label:e,url:t,hint:n}){let r=(0,q.useRef)(null);(0,q.useEffect)(()=>{r.current?.setAttribute(`href`,t)},[t]);let i=async()=>{try{await navigator.clipboard.writeText(t),I(`Bookmarklet URL copied.`)}catch{I(`Copy failed — drag the button instead.`,{tone:`danger`})}};return(0,J.jsxs)(`div`,{"data-slot":`bm-row`,className:`flex min-w-0 items-center gap-2.5`,children:[(0,J.jsxs)(`a`,{ref:r,draggable:!0,"data-slot":`bm-link`,title:`Drag me to your bookmarks bar`,onClick:e=>{e.preventDefault(),I(`Drag me to your bookmarks bar`)},className:`inline-flex shrink-0 items-center gap-1.5 rounded-md border border-border bg-card px-2.5 py-1 font-mono text-xs font-medium text-foreground shadow-xs transition-colors hover:bg-muted`,children:[(0,J.jsx)(cr,{"aria-hidden":`true`,className:`size-3 text-primary`}),e]}),(0,J.jsx)(`button`,{type:`button`,"data-slot":`bm-copy`,title:`Copy the bookmarklet URL`,onClick:()=>void i(),className:`shrink-0 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground`,children:`Copy`}),n?(0,J.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-soft-foreground`,children:n}):null]})}function Pf(e){return{enabled:(e&&typeof e==`object`?e:{}).enabled===!0}}function Ff(){let e=globalThis.Notification;if(typeof e!=`function`)return`unsupported`;let t=e.permission;return t===`granted`||t===`denied`?t:`default`}function If(e,t){let n=new Map,r=[];for(let i of t??[]){n.set(i.id,i.status);let t=e.get(i.id);t===void 0||t===i.status||Ai(i)&&r.push(i)}return{entering:r,statuses:n}}function Lf(e){return e.enabled&&e.hidden&&e.permission===`granted`}function Rf(e){let t=Oi(e).label;return{title:e.titleSummary??e.title,body:`Task ${t}`,tag:`xezar-run-${e.id}`}}function zf(){let e=R(),t=ce(),[n,r]=q.useState(!1),[i,a]=q.useState(Ff),o=t.data;q.useEffect(()=>{o!==void 0&&r(Pf(o.notifications).enabled)},[o]);let s=q.useCallback(t=>{r(t),ct({notifications:{enabled:t}}).then(t=>e.setQueryData(E.uiState,t)).catch(t=>{I(t instanceof Error?t.message:String(t),{tone:`danger`}),e.invalidateQueries({queryKey:E.uiState})})},[e]),c=q.useCallback(e=>{if(!e){s(!1);return}if(Ff()!=="default"){s(!0);return}s(!0),Notification.requestPermission().then(e=>a(e)).catch(()=>a(Ff()))},[s]),l=i===`unsupported`;return(0,J.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,J.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:(0,J.jsx)(`label`,{htmlFor:`notifications-enabled`,children:`Notify when an agent needs you`})}),(0,J.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,J.jsx)(Jd,{id:`notifications-enabled`,"data-slot":`notifications-toggle`,checked:n,disabled:l,onCheckedChange:c})]}),l?(0,J.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,J.jsx)(`p`,{"data-slot":`notifications-denied`,className:`text-[13px] text-danger`,children:`This browser is blocking notifications for the cockpit. The preference is saved, but nothing will be delivered here until you allow notifications in the browser's site settings.`}):null]})})}function Bf(){let e=tn();return{isPending:e.isPending,confirm:(t,n)=>e.mutate(t.id,{onSuccess:()=>{I(`${t.name} removed from the workspace — its files are untouched`),n?.()},onError:e=>I(e.message,{tone:`danger`})})}}function Vf({project:e,onOpenChange:t,onConfirm:n}){return(0,J.jsx)(ci,{open:e!==null,onOpenChange:t,children:(0,J.jsxs)(ri,{children:[(0,J.jsxs)(si,{children:[(0,J.jsxs)(ni,{children:[`Remove `,e?.name,` from the workspace?`]}),(0,J.jsxs)(ti,{children:[`This only unregisters the project — `,(0,J.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,J.jsx)(`span`,{className:`mt-1 block truncate font-mono text-[11px] text-foreground`,title:e?.root,children:e?.root})]})]}),(0,J.jsxs)(ai,{children:[(0,J.jsx)(oi,{children:`Keep it`}),(0,J.jsx)(ii,{"data-action":`projects-confirm-remove`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:n,children:`Remove from list`})]})]})})}function Q({title:e,hint:t,children:n}){return(0,J.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,J.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}var Hf=1,Uf={ok:`ok`,"not-git":`no git repo`,missing:`folder not found`};function Wf(e){let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function Gf(){let e=C(),t=B();return e.isPending||t.isPending?(0,J.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,J.jsx)(z,{icon:(0,J.jsx)(Wa,{}),tone:`danger`,title:`Project settings did not load`,subtitle:(e.error??t.error)?.message,heading:`h2`}):(0,J.jsx)(Kf,{config:e.data,registry:t.data})}function Kf({config:e,registry:t}){return(0,J.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,J.jsx)(qf,{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,J.jsx)(qf,{configKey:`projectsDir`,value:e.projectsDir,title:`Default checkout folder`,hint:`Where “Clone from GitHub” puts new projects: <folder>/<project name>.`,placeholder:`~/xezar/projects`,slot:`checkout`,savedLabel:`Checkout folder`,footer:`Only affects new checkouts; projects already registered keep their location.`,refreshProjects:!0}),(0,J.jsx)(Jf,{registry:t,workspaceMax:e.resources.maxParallel})]})}function qf({configKey:e,value:t,title:n,hint:r,placeholder:i,slot:a,savedLabel:o,footer:s,refreshProjects:c=!1}){let l=R(),u=j({mutationFn:t=>bt(e===`browseRoot`?{browseRoot:t}:{projectsDir:t}),onSuccess:t=>{l.setQueryData(E.config,t),e===`browseRoot`?l.invalidateQueries({queryKey:E.fsBrowseRoot}):c&&l.invalidateQueries({queryKey:E.projects})}}),[d,f]=(0,q.useState)(t),p=d.trim(),m=p===t,h=u.isError?u.error.message:null;return(0,J.jsxs)(Q,{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,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.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,J.jsx)(P,{type:`button`,variant:`outline`,size:`sm`,"data-action":`projects-save-${a}-root`,disabled:m||p===``||u.isPending,onClick:()=>u.mutate(p,{onSuccess:()=>I(`${o} set to ${p}`)}),children:`Save`})]}),h===null?(0,J.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:s}):(0,J.jsxs)(`p`,{"data-slot":`projects-${a}-root-error`,role:`alert`,className:`text-[11px] text-danger`,children:[h,` — setting unchanged`]})]})}function Jf({registry:e,workspaceMax:t}){let[n,r]=(0,q.useState)(null),i=Bf(),a=(0,q.useMemo)(()=>Re(e.projects),[e.projects]);return(0,J.jsxs)(Q,{title:`Registered projects`,hint:`Every folder xezar has run in, plus the ones added from the GUI. “Tags” group connected repositories — give the API, the web app and the design system a shared “storefront” tag and the global Tasks page can show all three as one piece of work. “Max parallel” caps how many of that project's tasks run at once; the workspace limit (${t}) still applies as an overall ceiling, so a per-project value above it has no extra effect until the workspace limit is raised. Removing a project only unregisters it — no files on disk are deleted.`,children:[e.projects.length===0?(0,J.jsx)(`p`,{"data-slot":`projects-empty`,className:`text-[13px] text-soft-foreground`,children:`No projects registered yet.`}):(0,J.jsx)(`div`,{className:`overflow-x-auto rounded-md border border-border`,children:(0,J.jsxs)(`table`,{className:`w-full border-collapse text-sm`,children:[(0,J.jsx)(`caption`,{className:`sr-only`,children:`Projects registered in this workspace`}),(0,J.jsxs)(`colgroup`,{children:[(0,J.jsx)(`col`,{}),(0,J.jsx)(`col`,{style:{width:`104px`}}),(0,J.jsx)(`col`,{style:{width:`260px`}}),(0,J.jsx)(`col`,{style:{width:`150px`}}),(0,J.jsx)(`col`,{style:{width:`72px`}}),(0,J.jsx)(`col`,{style:{width:`92px`}})]}),(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{className:`border-b border-border text-left text-[12px] text-soft-foreground`,children:[(0,J.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Project`}),(0,J.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Status`}),(0,J.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Tags`}),(0,J.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Max parallel`}),(0,J.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Added`}),(0,J.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium text-right`,children:`Actions`})]})}),(0,J.jsx)(`tbody`,{children:e.projects.map(n=>(0,J.jsx)(Yf,{project:n,isBoot:n.id===e.bootProject,workspaceMax:t,vocabulary:a,disabled:i.isPending,onRemove:()=>r(n)},n.id))})]})}),(0,J.jsx)(Vf,{project:n,onOpenChange:e=>!e&&r(null),onConfirm:()=>{if(!n)return;let e=n;r(null),i.confirm(e)}})]})}function Yf({project:e,isBoot:t,workspaceMax:n,vocabulary:r,disabled:i,onRemove:a}){return(0,J.jsxs)(`tr`,{"data-slot":`project-row`,"data-project":e.id,className:`border-b border-border last:border-0`,children:[(0,J.jsxs)(`th`,{scope:`row`,className:`max-w-0 px-3 py-2 text-left font-normal`,children:[(0,J.jsx)(`span`,{className:`block truncate text-foreground`,children:e.name}),(0,J.jsx)(`span`,{className:`block truncate font-mono text-[11px] text-soft-foreground`,title:e.root,children:e.root})]}),(0,J.jsxs)(`td`,{className:`px-3 py-2`,children:[(0,J.jsx)(`span`,{"data-slot":`project-status`,className:e.status===`missing`?`text-[12px] text-danger`:`text-[12px] text-soft-foreground`,children:Uf[e.status]}),e.status===`missing`?null:(0,J.jsxs)(`span`,{className:`ml-1 text-[11px] text-soft-foreground`,children:[`· `,e.source]})]}),(0,J.jsx)(`td`,{className:`px-3 py-2`,children:(0,J.jsx)(Xf,{project:e,vocabulary:r})}),(0,J.jsx)(`td`,{className:`px-3 py-2`,children:(0,J.jsx)(Zf,{project:e,workspaceMax:n})}),(0,J.jsx)(`td`,{className:`px-3 py-2 tabular-nums text-soft-foreground`,children:Wf(e.addedAt)}),(0,J.jsx)(`td`,{className:`px-3 py-2 text-right`,children:(0,J.jsx)(P,{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?`xezar is serving this project — it re-registers itself at every start`:void 0,disabled:i||t,onClick:a,children:`Remove`})})]})}function Xf({project:e,vocabulary:t}){let n=Ae(),[r,i]=(0,q.useState)(``),[a,o]=(0,q.useState)(!1),[s,c]=(0,q.useState)(-1),l=(0,q.useRef)(null),u=e.tags??[],d=Le(t,u,r),f=a&&d.length>0,p=(t,r)=>{n.mutate({id:e.id,tags:t},{onSuccess:()=>I(r),onError:e=>I(e.message,{tone:`danger`})})},m=t=>{let n=t.trim().slice(0,32);if(c(-1),n){if(u.some(e=>e.toLowerCase()===n.toLowerCase())){i(``);return}if(u.length>=20){I(`${e.name} already has the maximum of 20 tags`,{tone:`danger`});return}i(``),p([...u,n],`${e.name} tagged \u201c${n}\u201d`)}},h=t=>{p(u.filter(e=>e!==t),`\u201c${t}\u201d removed from ${e.name}`)},g=`project-tag-suggestions-${e.id}`;return(0,J.jsxs)(`div`,{"data-slot":`project-tags`,className:`flex flex-wrap items-center gap-1`,children:[u.map(t=>(0,J.jsxs)(`span`,{"data-slot":`project-tag`,className:`inline-flex max-w-full items-center gap-1 rounded-full bg-violet/15 py-px pr-1 pl-2 text-[11px] font-medium whitespace-nowrap text-violet`,children:[t,(0,J.jsx)(`button`,{type:`button`,"data-action":`project-tag-remove`,"aria-label":`Remove tag ${t} from ${e.name}`,disabled:n.isPending,onClick:()=>h(t),className:`rounded-full p-0.5 hover:bg-violet/25 disabled:opacity-50`,children:(0,J.jsx)($r,{className:`size-3`,"aria-hidden":`true`})})]},t)),(0,J.jsxs)(rr,{open:f,onOpenChange:o,children:[(0,J.jsx)(er,{asChild:!0,children:(0,J.jsx)(`input`,{ref:l,type:`text`,"data-slot":`project-tag-input`,"aria-label":`Add a tag to ${e.name}`,role:`combobox`,"aria-expanded":f,"aria-controls":f?g:void 0,"aria-autocomplete":`list`,"aria-activedescendant":f&&s>=0?`${g}-${s}`:void 0,placeholder:u.length===0?`Add tag…`:`+`,value:r,maxLength:32,disabled:n.isPending,onFocus:()=>o(!0),onBlur:()=>o(!1),onChange:e=>{if(o(!0),c(-1),e.target.value.includes(`,`)){i(e.target.value.replace(/,/g,``));return}i(e.target.value)},onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(d.length===0)return;e.preventDefault(),o(!0);let t=e.key===`ArrowDown`?1:-1,n=s+t;c(n>=d.length?-1:n<-1?d.length-1:n);return}if(e.key===`Escape`&&f){e.preventDefault(),o(!1),c(-1);return}if(e.key===`Enter`||e.key===`,`){e.preventDefault(),m(s>=0?d[s]??r:r);return}if(e.key===`Tab`){o(!1);return}if(e.key===`Backspace`&&r===``&&u.length>0){e.preventDefault();let t=u[u.length-1];t!==void 0&&h(t)}},className:`h-6 w-16 min-w-0 flex-1 rounded-md border border-input bg-card px-1.5 text-[12px] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`})}),(0,J.jsxs)(Zn,{align:`start`,sideOffset:4,id:g,role:`listbox`,"data-slot":`project-tag-suggestions`,className:`w-56 p-1`,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,J.jsx)(`p`,{className:`px-2 pt-1 pb-1.5 text-[10.5px] text-soft-foreground`,children:`Tags used in this workspace`}),d.map((e,t)=>(0,J.jsx)(`button`,{type:`button`,id:`${g}-${t}`,role:`option`,"aria-selected":t===s,"data-slot":`project-tag-suggestion`,onMouseDown:e=>e.preventDefault(),onClick:()=>{m(e),l.current?.focus()},onMouseEnter:()=>c(t),className:H(`flex w-full items-center rounded-sm px-2 py-1 text-left text-[12px] font-medium text-violet`,t===s&&`bg-muted`),children:e},e))]})]})]})}function Zf({project:e,workspaceMax:t}){let n=Ae(),r=e.maxParallel===void 0?``:String(e.maxParallel);return(0,J.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:()=>I(a===null?`${e.name} inherits the workspace limit (${t})`:`${e.name} runs at most ${a} task${a===1?``:`s`} at a time`),onError:e=>I(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,J.jsxs)(`option`,{value:``,children:[`Inherit workspace (`,t,`)`]}),Array.from({length:16},(e,t)=>t+Hf).map(e=>(0,J.jsx)(`option`,{value:e,children:e},e))]})}function Qf(){let e=Me();return e.isPending?(0,J.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,J.jsx)(z,{icon:(0,J.jsx)(io,{}),tone:`danger`,title:`Prompt templates did not load`,subtitle:e.error.message,heading:`h2`}):(0,J.jsx)($f,{initial:jr(e.data.promptTemplates)})}function $f({initial:e}){let t=R(),n=Te(),r=Me(),[i,a]=(0,q.useState)(e),[o,s]=(0,q.useState)(``),[c,l]=(0,q.useState)(``),u=j({mutationFn:e=>Dt({promptTemplates:e}),onSuccess:e=>{t.setQueryData(L.uiState,e),I(`Prompt templates saved`)},onError:e=>I(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,J.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,J.jsxs)(tp,{title:`Prompt templates`,hint:`Reusable snippets you can insert into a prompt — the new-task composer, the GitHub hand-over, and the Inbox's “Add instructions” box all offer this list. Assign a template to a skill and it fills the prompt in for you when you pick that skill, as long as you have not typed anything yet.`,children:[(0,J.jsx)(`div`,{"data-slot":`prompt-template-list`,className:`flex flex-col gap-3`,children:i.length===0?(0,J.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,J.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,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(Js,{"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,J.jsx)(P,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`prompt-template-remove`,title:`Remove this template`,onClick:()=>h(e.id),children:(0,J.jsx)($r,{"aria-hidden":`true`,className:`size-3.5`})})]}),(0,J.jsx)(ei,{"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,J.jsxs)(`div`,{className:`mt-0.5 flex flex-wrap items-center gap-1.5`,children:[(0,J.jsx)(ep,{label:e.label,skills:n.data??[],skillUsage:r.data?.skillUsage,selected:e.skills??[],onToggle:t=>m(e.id,t)}),(e.skills??[]).map(t=>(0,J.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,J.jsx)($r,{"aria-hidden":`true`,className:`size-3`})]},t))]})]},e.id))}),(0,J.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,J.jsx)(Js,{"aria-label":`New template label`,"data-slot":`prompt-template-new-label`,placeholder:`Label (e.g. "Add tests")`,value:o,maxLength:80,onChange:e=>s(e.target.value)}),(0,J.jsx)(ei,{"aria-label":`New template text`,"data-slot":`prompt-template-new-text`,placeholder:`The instructions to insert…`,value:c,maxLength:2e3,onChange:e=>l(e.target.value),className:`min-h-14 text-[13px]`}),(0,J.jsxs)(P,{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:Lr(),label:e,text:t}]),s(``),l(``))},className:`self-start`,children:[(0,J.jsx)(so,{"aria-hidden":`true`,className:`size-3.5`}),`Add template`]})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,J.jsx)(P,{type:`button`,variant:`contrast`,size:`sm`,"data-action":`prompt-templates-save`,disabled:!d||f||u.isPending,onClick:()=>u.mutate(i),children:`Save`}),(0,J.jsx)(P,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`prompt-templates-reset`,disabled:u.isPending,onClick:()=>a(Gr.map(e=>({...e}))),children:`Reset to defaults`}),f?(0,J.jsx)(`p`,{"data-slot":`prompt-templates-invalid`,className:`text-[11px] text-danger`,children:`Every template needs both a label and text.`}):null]})]})})}function ep({label:e,skills:t,skillUsage:n,selected:r,onToggle:i}){let[a,s]=(0,q.useState)(!1),[c,l]=(0,q.useState)(``),u=(0,q.useRef)(null),{mostUsed:d,project:f,global:p}=Fi(Ui(t,c,n),n),m=(e,t)=>{let n=r.includes(e.name);return(0,J.jsxs)(W,{value:`skill ${e.name} ${e.path}`,keywords:Li(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,J.jsx)(`span`,{className:H(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.description?(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,n?(0,J.jsx)(o,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-primary`}):null]},e.path)};return(0,J.jsxs)(rr,{open:a,onOpenChange:e=>{s(e),e||l(``)},children:[(0,J.jsx)(Xn,{asChild:!0,children:(0,J.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:H(`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,J.jsx)(Zr,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),t.length===0?`no skills found`:`apply with…`,(0,J.jsx)(Gn,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,J.jsx)(Zn,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,J.jsxs)(Hr,{shouldFilter:!1,children:[(0,J.jsx)(Ar,{placeholder:`search skills…`,value:c,onValueChange:l,onInput:()=>u.current?.scrollTo(0,0)}),(0,J.jsxs)(Jr,{ref:u,"data-slot":`prompt-template-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[d.length===0&&f.length===0&&p.length===0?(0,J.jsx)(Ir,{children:`Nothing matches.`}):null,d.length>0?(0,J.jsx)(U,{heading:`Most used`,children:d.map(e=>m(e,Ri(e)))}):null,f.length>0?(0,J.jsx)(U,{heading:`Project skills`,children:f.map(e=>m(e,!0))}):null,p.length>0?(0,J.jsx)(U,{heading:`Global`,children:p.map(e=>m(e,!1))}):null]})]})})]})}function tp({title:e,hint:t,children:n}){return(0,J.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,J.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}var np=1,rp=1,ip=60,ap=256;function op(){let e=C();return e.isPending?(0,J.jsx)(`p`,{"data-slot":`resources-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading resource settings…`}):e.isError?(0,J.jsx)(z,{icon:(0,J.jsx)(Ga,{}),tone:`danger`,title:`Resource settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,J.jsx)(sp,{config:e.data})}function sp({config:e}){let t=R(),n=j({mutationFn:e=>bt(e),onSuccess:e=>t.setQueryData(E.config,e),onError:e=>I(e.message,{tone:`danger`})}),[r,i]=(0,q.useState)(e.resources.memoryLimitMb?String(e.resources.memoryLimitMb):``),a=e.resources.monitoringWakeIntervalMinutes??null,[o,s]=(0,q.useState)(a===null?`park`:`interval`),[c,l]=(0,q.useState)(String(a??5)),u=Number(c),d=!Number.isInteger(u)||u<rp||u>ip,f=o===`park`?a===null:!d&&a===u,p=()=>n.mutate({resources:{monitoringWakeIntervalMinutes:o===`park`?null:u}},{onSuccess:()=>I(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:()=>I(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<ap),v=(e.resources.memoryLimitMb??0)===(_?-1:g),y=()=>n.mutate({resources:{memoryLimitMb:g===0?null:g}},{onSuccess:()=>I(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,J.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,J.jsxs)(Q,{title:`Max parallel tasks`,hint:`How many tasks run at once across every project. The rest wait in the queue. A non-git directory always runs one at a time.`,children:[(0,J.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+np).map(e=>(0,J.jsx)(`option`,{value:e,children:e},e))}),(0,J.jsxs)(`p`,{className:`text-[11px] text-soft-foreground`,children:[`Need a different limit for one project?`,` `,(0,J.jsx)(k,{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,J.jsxs)(Q,{title:`Extra monitoring sessions`,hint:`How many agent sessions may wait on CI, sub-agents, or monitored commands without using an active task slot. Extra sessions stay alive but pause the queue.`,children:[(0,J.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,J.jsx)(`option`,{value:t,children:t},t))}),(0,J.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,J.jsxs)(Q,{title:`Monitoring wake-up`,hint:`Park uses no model turns. Re-check sends the same agent a follow-up on this cadence until work completes or the 40-wakeup safety cap is reached.`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`select`,{"aria-label":`Monitoring wake-up`,"data-slot":`resources-monitoring-wake-mode`,value:o,disabled:n.isPending,onChange:e=>s(e.target.value),className:`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,J.jsx)(`option`,{value:`park`,children:`Park until resumed`}),(0,J.jsx)(`option`,{value:`interval`,children:`Re-check on an interval`})]}),o===`interval`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`input`,{type:`number`,min:rp,max:ip,"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,J.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`minutes`})]}):null,(0,J.jsx)(P,{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,J.jsx)(`p`,{"data-slot":`resources-monitoring-wake-invalid`,className:`text-[11px] text-danger`,children:`Enter a whole number from 1 to 60 minutes.`}):(0,J.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Applied consistently to Claude, Codex and OpenCode.`})]}),(0,J.jsxs)(Q,{title:`Auto-resume after a usage limit`,hint:`When an agent stops because its provider usage limit is reached, xezar waits for the reset the provider named and continues the task 30 seconds later — up to 12 times in a row without you. Off leaves the task failed with its Continue button.`,children:[(0,J.jsxs)(`select`,{"aria-label":`Auto-resume after a usage limit`,"data-slot":`resources-auto-resume`,value:m?`on`:`off`,disabled:n.isPending,onChange:e=>h(e.target.value===`on`),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:[(0,J.jsx)(`option`,{value:`on`,children:`On`}),(0,J.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,J.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Applies to Claude, Codex and OpenCode — whenever the provider says when the limit lifts.`})]}),(0,J.jsxs)(Q,{title:`Per-task memory limit`,hint:`When a task's whole process tree crosses this, the engine pauses it with a warning and starts the next queued task. Leave empty for no limit.`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:ap,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,J.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`MiB`}),(0,J.jsx)(P,{type:`button`,variant:`outline`,size:`sm`,"data-action":`resources-save-memory`,disabled:v||_||n.isPending,onClick:y,children:`Save`})]}),_?(0,J.jsxs)(`p`,{"data-slot":`resources-memory-invalid`,className:`text-[11px] text-danger`,children:[`Enter a whole number of at least `,ap,` MiB, or leave empty for no limit.`]}):(0,J.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Applies to newly started tasks.`})]}),(0,J.jsxs)(Q,{title:`New task defaults`,hint:`Set stable composer defaults across projects. Explicit choices and run-shape constraints still win.`,children:[(0,J.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,"data-slot":`resources-composer-defaults`,children:[(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium`,children:`Autonomous by default`}),(0,J.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,J.jsx)(`option`,{value:`inherit`,children:`Inherit environment`}),(0,J.jsx)(`option`,{value:`on`,children:`On`}),(0,J.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,J.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,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium`,children:`Use a worktree by default`}),(0,J.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,J.jsx)(`option`,{value:`inherit`,children:`Inherit environment`}),(0,J.jsx)(`option`,{value:`on`,children:`On`}),(0,J.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,J.jsxs)(`span`,{className:`text-[11px] text-soft-foreground`,children:[`Inherited: `,b.inheritedWorktree?`On`:`Off`]})]})]}),(0,J.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Interactive skills may recommend both off. Multi-step and parallel runs remain isolated.`})]})]})}function cp(){let e=C(),t=B().data?.bootProject??``,n=an(t,!!t);return e.isPending?(0,J.jsx)(`p`,{"data-slot":`skills-settings-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading skill settings…`}):e.isError?(0,J.jsx)(z,{icon:(0,J.jsx)(ao,{}),tone:`danger`,title:`Skill settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,J.jsx)(lp,{config:e.data,update:n.data,updateError:n.error})}function lp({config:e,update:t,updateError:n}){let r=R(),i=j({mutationFn:e=>bt(e),onSuccess:e=>r.setQueryData(E.config,e),onError:e=>I(e.message,{tone:`danger`})}),a=e.skillsAutoUpdate===null,o=(()=>{if(n)return`Installation status is unavailable right now.`;if(!t)return`Checking tracked Open Mercato installations…`;if(t.status===`unavailable`)return t.scopes.find(e=>e.reason)?.reason??`Automatic skill updates are unavailable.`;if(t.scopes.every(e=>e.skills.length===0))return`No tracked Open Mercato installation found.`;let e=new Set(t.scopes.flatMap(e=>e.skills)).size;return`${e} tracked Open Mercato skill${e===1?``:`s`} found.`})();return(0,J.jsx)(`div`,{"data-slot":`skills-settings-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-4 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:(0,J.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:(0,J.jsx)(`label`,{htmlFor:`skills-auto-update`,children:`Update Open Mercato skills automatically`})}),(0,J.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Checks installed Open Mercato skills in the background and applies available updates. Other skills and untracked folders are never changed.`})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-1`,children:[(0,J.jsx)(Jd,{id:`skills-auto-update`,"data-slot":`skills-auto-update`,checked:e.effectiveSkillsAutoUpdate,disabled:i.isPending,onCheckedChange:e=>i.mutate({skillsAutoUpdate:e})}),(0,J.jsxs)(`span`,{className:`text-[11px] text-soft-foreground`,children:[e.effectiveSkillsAutoUpdate?`On`:`Off`,a?` (default)`:``]})]})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 rounded-md border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground`,children:[(0,J.jsx)(`span`,{children:a?`No override is saved. XEZ_SKILLS_AUTO_UPDATE supplies the inherited default when set; otherwise it is on.`:`An explicit workspace override is saved.`}),(0,J.jsx)(P,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`skills-use-default`,disabled:a||i.isPending,onClick:()=>i.mutate({skillsAutoUpdate:null}),children:`Use default`})]}),(0,J.jsx)(`p`,{"data-slot":`skills-installation-status`,role:n||t?.status===`unavailable`?`status`:void 0,className:`text-[13px] text-soft-foreground`,children:o})]})})}function up(){let e=kt(),t=R(),[n,r]=(0,q.useState)(null),i=()=>t.invalidateQueries({queryKey:L.worktrees}),a=j({mutationFn:()=>it(),onSuccess:e=>{i(),I(e.reclaimed.length===0?`Nothing to reclaim — all worktrees are within the limit`:`Reclaimed ${e.reclaimed.length} worktree${e.reclaimed.length===1?``:`s`} (branch kept)`)},onError:e=>I(e.message,{tone:`danger`})}),o=j({mutationFn:e=>Wt(e),onSuccess:()=>{i(),I(`Worktree removed`)},onError:e=>I(e.message,{tone:`danger`})});if(e.isPending)return(0,J.jsx)(`p`,{"data-slot":`worktrees-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading worktrees…`});if(e.isError)return(0,J.jsxs)(`p`,{"data-slot":`worktrees-error`,className:`text-[13px] text-danger`,children:[`Worktrees did not load: `,e.error.message]});let{worktrees:s,totalBytes:c,keep:l}=e.data,u=a.isPending||o.isPending;return(0,J.jsxs)(`div`,{"data-slot":`worktrees-panel`,className:`flex flex-col gap-3`,children:[s.length===0?(0,J.jsx)(`p`,{"data-slot":`worktrees-empty`,className:`text-[13px] text-soft-foreground`,children:`No task worktrees on disk.`}):(0,J.jsx)(`div`,{className:`overflow-x-auto rounded-md border border-border`,children:(0,J.jsxs)(`table`,{className:`w-full border-collapse text-sm`,children:[(0,J.jsx)(`caption`,{className:`sr-only`,children:`Task worktrees currently materialized on disk`}),(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{className:`border-b border-border text-left text-[12px] text-soft-foreground`,children:[(0,J.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Task`}),(0,J.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Status`}),(0,J.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Size`}),(0,J.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Age`}),(0,J.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium text-right`,children:`Actions`})]})}),(0,J.jsx)(`tbody`,{children:s.map(e=>(0,J.jsx)(dp,{worktree:e,disabled:u,onDelete:()=>r({kind:`delete`,runId:e.runId,title:e.title})},e.runId))})]})}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,J.jsxs)(`p`,{"data-slot":`worktrees-footer`,className:`text-[12px] text-soft-foreground`,children:[s.length,` worktree`,s.length===1?``:`s`,c===null?` · size unavailable`:` · ${wt(c)||`0 kB`} on disk`,` · `,l===0?`keeping all (unlimited)`:`keeping the last ${l}`]}),(0,J.jsx)(P,{type:`button`,variant:`outline`,size:`sm`,"data-action":`worktrees-reclaim-now`,disabled:u,onClick:()=>r({kind:`reclaim`}),children:`Reclaim now`})]}),(0,J.jsx)(ci,{open:n!==null,onOpenChange:e=>!e&&r(null),children:(0,J.jsxs)(ri,{children:[(0,J.jsxs)(si,{children:[(0,J.jsx)(ni,{children:n?.kind===`delete`?`Delete this worktree?`:`Reclaim old worktrees?`}),(0,J.jsx)(ti,{children:n?.kind===`delete`?(0,J.jsxs)(J.Fragment,{children:[`This removes the worktree directory and its branch — the local-only work is not recoverable afterwards.`,(0,J.jsx)(`span`,{className:`mt-1 block truncate font-medium text-foreground`,title:n.title,children:n.title})]}):`Finished worktrees beyond the keep-limit are reclaimed now (directory only). Their branches are kept, so the work stays recoverable.`})]}),(0,J.jsxs)(ai,{children:[(0,J.jsx)(oi,{children:`Keep it`}),(0,J.jsx)(ii,{"data-action":`worktrees-confirm`,className:n?.kind===`delete`?`bg-danger text-danger-foreground hover:brightness-[0.96]`:void 0,onClick:()=>{n?.kind===`reclaim`?a.mutate():n?.kind===`delete`&&o.mutate(n.runId),r(null)},children:n?.kind===`delete`?`Delete`:`Reclaim now`})]})]})})]})}function dp({worktree:e,disabled:t,onDelete:n}){return(0,J.jsxs)(`tr`,{"data-slot":`worktree-row`,"data-run":e.runId,className:`border-b border-border last:border-0`,children:[(0,J.jsxs)(`th`,{scope:`row`,className:`max-w-[220px] px-3 py-2 text-left font-normal`,children:[(0,J.jsx)(`span`,{className:`block truncate text-foreground`,title:e.title,children:e.title}),(0,J.jsx)(`span`,{className:`block truncate font-mono text-[11px] text-soft-foreground`,children:e.branch??e.runId.slice(0,8)})]}),(0,J.jsxs)(`td`,{className:`px-3 py-2`,children:[(0,J.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:e.status}),e.reclaimable?(0,J.jsx)(`span`,{"data-slot":`worktree-reclaimable`,className:`ml-1 text-[11px] text-soft-foreground`,children:`(reclaimable)`}):null]}),(0,J.jsx)(`td`,{className:`px-3 py-2 tabular-nums text-soft-foreground`,children:e.sizeBytes===null?`—`:wt(e.sizeBytes)||`0 kB`}),(0,J.jsx)(`td`,{className:`px-3 py-2 tabular-nums text-soft-foreground`,children:Mi(e.finishedAt??void 0)||`—`}),(0,J.jsx)(`td`,{className:`px-3 py-2 text-right`,children:(0,J.jsx)(P,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`worktree-delete`,"aria-label":`Delete the worktree for ${e.title}`,disabled:t,onClick:n,children:`Delete`})})]})}var fp=0,pp=1e3;function mp(){let e=nn();return e.isPending?(0,J.jsx)(`p`,{"data-slot":`worktrees-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading worktree settings…`}):e.isError?(0,J.jsx)(z,{icon:(0,J.jsx)(Va,{}),tone:`danger`,title:`Worktree settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,J.jsx)(hp,{config:e.data})}function hp({config:e}){let t=R(),n=j({mutationFn:e=>et(e),onSuccess:e=>t.setQueryData(L.config,e),onError:e=>I(e.message,{tone:`danger`})}),[r,i]=(0,q.useState)(String(e.worktreeRetention)),a=Number(r),o=r.trim()===``||!Number.isInteger(a)||a<fp||a>pp,s=e.worktreeRetention===(o?-1:a);return(0,J.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,J.jsxs)(Q,{title:`Keep last N 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,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:fp,max:pp,step:1,"aria-label":`Keep last N finished worktrees`,"data-slot":`resources-worktree-retention`,value:r,disabled:n.isPending,onChange:e=>i(e.target.value),className:`block w-32 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,J.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`worktrees`}),(0,J.jsx)(P,{type:`button`,variant:`outline`,size:`sm`,"data-action":`resources-save-retention`,disabled:s||o||n.isPending,onClick:()=>n.mutate({worktreeRetention:a},{onSuccess:()=>{t.invalidateQueries({queryKey:L.worktrees}),I(a===0?`Keeping all worktrees (unlimited)`:`Keeping the last ${a} finished worktree${a===1?``:`s`}`)}}),children:`Save`})]}),o?(0,J.jsxs)(`p`,{"data-slot":`resources-retention-invalid`,className:`text-[11px] text-danger`,children:[`Enter a whole number from `,fp,` to `,pp,` (0 = unlimited).`]}):(0,J.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,J.jsx)(Q,{title:`Worktrees`,hint:`Task worktrees currently on disk. Delete one to reclaim its space now, or reclaim everything past the keep-limit at once. Branches are always kept, so the work stays recoverable.`,children:(0,J.jsx)(up,{})})]})}function gp(e,t){return function(){return(0,J.jsx)(z,{icon:(0,J.jsx)(t,{}),tone:`neutral`,title:e,subtitle:`This section arrives in a later phase of the redesign.`,heading:`h2`})}}var _p=[{id:`agents`,title:`Agents`,description:`Default runner, models and system prompt.`,icon:wn,component:tf,scope:`project`},{id:`agent-config`,title:`Agent config`,description:`Edit the coding agents’ own config files, per scope.`,icon:za,component:Ud,scope:`project`},{id:`worktrees`,title:`Worktrees`,description:`How many finished task worktrees this project keeps on disk.`,icon:Va,component:mp,scope:`project`},{id:`bookmarklets`,title:`Bookmarklets`,description:`Launch skills from a GitHub PR or issue.`,icon:Oa,component:jf,scope:`project`},{id:`prompt-templates`,title:`Prompt templates`,description:`Reusable snippets for follow-up instructions.`,icon:io,component:Qf,scope:`project`},{id:`appearance`,title:`Appearance`,description:`Theme, accent and density.`,icon:oo,component:Of,scope:`global`},{id:`notifications`,title:`Notifications`,description:`Browser notifications when an agent needs you.`,icon:Da,component:zf,scope:`global`},{id:`resources`,title:`Resources`,description:`Parallel tasks and per-task memory limit, across every project.`,icon:Ga,component:op,scope:`global`},{id:`skills`,title:`Skills`,description:`Updates for skills installed on this machine.`,icon:ao,component:cp,scope:`global`},{id:`accounts`,title:`Agent accounts`,description:`Second logins, and the agent and models a project uses when it has chosen none.`,icon:Ja,component:Ed,scope:`global`},{id:`projects`,title:`Projects`,description:`The workspace registry and where GitHub checkouts land.`,icon:Wa,component:Gf,scope:`global`},{id:`keyboard`,title:`Keyboard`,description:`Shortcuts.`,icon:Xa,component:gp(`Keyboard`,Xa),scope:`global`,hidden:!0}];function vp(e,t){return _p.filter(n=>!n.hidden&&n.scope===e&&!(t?.singleProject===!0&&n.id===`projects`))}function yp(){let e=wi(),t=B().data;return e===null?null:t?.projects.find(t=>t.id===e)?.root??null}function bp(e){navigator.clipboard.writeText(e).then(()=>I(`Project folder copied`)).catch(()=>I(e))}function xp(){let e=yp();return e===null?null:(0,J.jsx)(Q,{title:`Project folder`,hint:`Where this project lives on disk. Every task worktree, git command and agent run resolves against it.`,children:(0,J.jsxs)(`div`,{"data-slot":`project-location`,"data-variant":`field`,className:`flex items-start gap-3 rounded-md border border-border bg-card p-3`,children:[(0,J.jsx)(`span`,{"data-slot":`project-location-path`,className:`min-w-0 flex-1 font-mono text-xs break-all text-foreground`,children:e}),(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,J.jsx)(`button`,{type:`button`,"data-action":`project-location-copy`,title:`Copy the project folder path`,onClick:()=>bp(e),className:`text-xs font-medium text-muted-foreground transition-colors hover:text-foreground`,children:`Copy`}),(0,J.jsx)(Cp,{root:e})]})]})})}function Sp(){let e=yp();return e===null?null:(0,J.jsxs)(`div`,{"data-slot":`project-location`,"data-variant":`nav`,className:`mt-auto px-2.5 pt-3`,children:[(0,J.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Project folder`}),(0,J.jsx)(`button`,{type:`button`,"data-action":`project-location-copy`,title:`${e} — click to copy`,onClick:()=>bp(e),className:`block w-full truncate text-left font-mono text-[11px] text-muted-foreground transition-colors hover:text-foreground`,children:e})]})}function Cp({root:e}){let t=dt(),n=j({mutationFn:e=>Mt(e),onError:e=>I(e.message,{tone:`danger`})}),r=(t.data?.targets??[]).filter(e=>xn(e.id)===void 0).map(e=>({target:e}));return r.length===0?null:(0,J.jsx)(Tn,{slot:`project-location-open`,label:`Open with`,triggerVariant:`outline`,title:e,disabled:n.isPending,choices:r,onPick:e=>n.mutate(e,{onSuccess:()=>I(`Opening the project folder in ${r.find(t=>t.target.id===e)?.target.label??e}`)})})}function wp(e){let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleDateString(void 0,{year:`numeric`,month:`short`,day:`numeric`})}function Tp({capabilities:e}){let t=wi(),n=B(),r=C();if(n.isPending)return(0,J.jsx)(`p`,{"data-slot":`project-general-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading project…`});if(n.isError)return(0,J.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,J.jsxs)(`div`,{"data-slot":`project-general`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7`,children:[(0,J.jsx)(xp,{}),(0,J.jsx)(Ep,{project:a,canRemove:o}),o?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Q,{title:`Max parallel tasks`,hint:r.data?`How many of this project's tasks may run at once. The workspace limit (${r.data.resources.maxParallel}) still applies as an overall ceiling, so a higher value here has no extra effect until that one is raised.`:`How many of this project's tasks may run at once. The workspace limit still applies as an overall ceiling.`,children:r.data?(0,J.jsx)(Zf,{project:a,workspaceMax:r.data.resources.maxParallel}):(0,J.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:`Loading the workspace limit…`})}),(0,J.jsx)(Dp,{project:a,bootProject:i.bootProject})]}):null]})}function Ep({project:e,canRemove:t}){return(0,J.jsx)(Q,{title:`Project`,hint:`The registry entry for this checkout — re-probed every time the project list is read.`,children:(0,J.jsxs)(`dl`,{"data-slot":`project-facts`,className:`grid grid-cols-[8rem_minmax(0,1fr)] gap-x-3 gap-y-1.5 rounded-md border border-border bg-card p-3 text-[13px]`,children:[(0,J.jsx)(`dt`,{className:`text-muted-foreground`,children:`Name`}),(0,J.jsx)(`dd`,{className:`min-w-0 truncate text-foreground`,children:e.name}),(0,J.jsx)(`dt`,{className:`text-muted-foreground`,children:`Status`}),(0,J.jsxs)(`dd`,{"data-slot":`project-general-status`,className:e.status===`missing`?`text-danger`:`text-foreground`,children:[Uf[e.status],e.status===`missing`?t?` — remove it below, or restore the folder`:` — restore the folder at the path above`:null]}),e.branch===void 0?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`dt`,{className:`text-muted-foreground`,children:`Branch`}),(0,J.jsx)(`dd`,{className:`min-w-0 truncate font-mono text-xs text-foreground`,children:e.branch})]}),(0,J.jsx)(`dt`,{className:`text-muted-foreground`,children:`Added`}),(0,J.jsxs)(`dd`,{className:`text-foreground`,children:[wp(e.addedAt),(0,J.jsx)(`span`,{className:`text-soft-foreground`,children:e.source===`checkout`?` · cloned from GitHub`:` · opened locally`})]}),(0,J.jsx)(`dt`,{className:`text-muted-foreground`,children:`Last opened`}),(0,J.jsx)(`dd`,{className:`text-foreground`,children:wp(e.lastOpenedAt)})]})})}function Dp({project:e,bootProject:t}){let[n,r]=(0,q.useState)(null),i=Bf(),a=u(),o=e.id===t;return(0,J.jsxs)(Q,{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,J.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,J.jsxs)(P,{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?`xezar 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,J.jsx)(`span`,{"data-slot":`project-general-remove-boot`,className:`text-[11px] text-soft-foreground`,children:`xezar is serving this project — it re-registers itself at every start.`}):null]}),(0,J.jsx)(Vf,{project:n,onOpenChange:e=>!e&&r(null),onConfirm:()=>{r(null),i.confirm(e,()=>void a(`/p/${encodeURIComponent(t)}`))}})]})}function Op(e,t){return e===`global`?`/settings/global/${t}`:`/settings/${t}`}function kp(e){return e===`global`?`/settings/global`:`/settings`}function Ap(e){return e===`global`?{Link:k,NavLink:fe}:{Link:G,NavLink:xi}}function jp({scope:e,activeId:t,capabilities:n}){let{NavLink:r}=Ap(e);return(0,J.jsxs)(`nav`,{"aria-label":`Settings sections`,"data-slot":`settings-nav`,"data-scope":e,className:`hidden w-52 shrink-0 flex-col gap-1 border-r border-border p-3 md:flex`,children:[(0,J.jsxs)(r,{to:kp(e),end:!0,"data-slot":`settings-nav-index`,"aria-current":t===null?`page`:void 0,className:H(`flex items-center gap-2.5 rounded-md px-2.5 py-2 text-[13px] font-medium transition-colors`,t===null?`bg-muted text-foreground`:`text-muted-foreground hover:bg-muted/60 hover:text-foreground`),children:[(0,J.jsx)(uo,{"aria-hidden":`true`,className:`size-4 shrink-0`}),`General`]}),vp(e,n).map(n=>(0,J.jsxs)(r,{to:Op(e,n.id),"data-section":n.id,"aria-current":n.id===t?`page`:void 0,className:H(`flex items-center gap-2.5 rounded-md px-2.5 py-2 text-[13px] font-medium transition-colors`,n.id===t?`bg-muted text-foreground`:`text-muted-foreground hover:bg-muted/60 hover:text-foreground`),children:[(0,J.jsx)(n.icon,{"aria-hidden":`true`,className:`size-4 shrink-0`}),n.title]},n.id)),e===`global`?(0,J.jsx)(`p`,{className:`mt-auto px-2.5 pt-3 text-[11px] text-soft-foreground`,children:`Stored in ~/.xezar`}):(0,J.jsx)(Sp,{})]})}function Mp({scope:e,activeId:t,capabilities:n}){let{NavLink:r}=Ap(e);return(0,J.jsxs)(`nav`,{"aria-label":`Settings sections`,"data-slot":`settings-nav-mobile`,className:`flex shrink-0 gap-1.5 overflow-x-auto border-b border-border px-3 py-2.5 md:hidden`,children:[(0,J.jsx)(r,{to:kp(e),end:!0,"data-slot":`settings-nav-index`,className:`rounded-full border border-border bg-card px-3 py-1.5 text-[13px] font-medium whitespace-nowrap text-muted-foreground transition-colors`,children:`General`}),vp(e,n).map(n=>(0,J.jsx)(r,{to:Op(e,n.id),"data-section":n.id,"aria-current":n.id===t?`page`:void 0,className:H(`rounded-full border px-3 py-1.5 text-[13px] font-medium whitespace-nowrap transition-colors`,n.id===t?`border-transparent bg-contrast text-contrast-foreground`:`border-border bg-card text-muted-foreground`),children:n.title},n.id))]})}function Np({section:e,scope:t,capabilities:n}){let r=e.component;return(0,J.jsxs)(`div`,{"data-route":t===`global`?`settings-global-${e.id}`:`settings-${e.id}`,className:`flex min-h-full flex-col`,children:[(0,J.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,J.jsx)(`h1`,{className:`text-base font-semibold`,children:e.title}),(0,J.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:e.description}),t===`global`?(0,J.jsx)(`span`,{"data-slot":`settings-scope-chip`,className:`ml-auto text-[11px] text-soft-foreground`,children:`Global settings`}):null]}),(0,J.jsxs)(`div`,{className:`flex flex-1 flex-col md:flex-row`,children:[(0,J.jsx)(jp,{scope:t,activeId:e.id,capabilities:n}),(0,J.jsx)(Mp,{scope:t,activeId:e.id,capabilities:n}),(0,J.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:(0,J.jsx)(r,{})})]})]})}function Pp({scope:e,capabilities:t}){let{Link:n}=Ap(e),r=e===`global`;return(0,J.jsxs)(`div`,{"data-route":r?`settings-global`:`settings`,className:`flex min-h-full flex-col`,children:[(0,J.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,J.jsx)(`h1`,{className:`text-base font-semibold`,children:r?`Global settings`:`Settings`}),(0,J.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:r?`Preferences for you and this machine, shared by every project.`:`Configure this project and its agents.`})]}),(0,J.jsxs)(`div`,{className:`flex flex-1 flex-col md:flex-row`,children:[(0,J.jsx)(jp,{scope:e,activeId:null,capabilities:t}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col p-3 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-5 md:pb-5`,children:[r?null:(0,J.jsx)(Tp,{capabilities:t}),(0,J.jsx)(`ul`,{"data-slot":`settings-index`,className:H(`mx-auto flex w-full max-w-2xl flex-col gap-2.5`,r?null:`mt-7 md:hidden`),children:vp(e,t).map(t=>(0,J.jsx)(`li`,{children:(0,J.jsxs)(n,{to:Op(e,t.id),"data-section":t.id,className:`flex items-center gap-3.5 rounded-lg border border-border bg-card p-4 shadow-xs transition-colors hover:bg-card-2`,children:[(0,J.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-md border border-border bg-muted text-muted-foreground`,children:(0,J.jsx)(t.icon,{"aria-hidden":`true`,className:`size-4`})}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:t.title}),(0,J.jsx)(`span`,{className:`block text-xs text-soft-foreground`,children:t.description})]}),(0,J.jsx)(ur,{"aria-hidden":`true`,className:`size-4 shrink-0 text-soft-foreground`})]})},t.id))}),(0,J.jsx)(`p`,{className:`mx-auto mt-4 w-full max-w-2xl text-[12px] text-soft-foreground`,children:r?(0,J.jsx)(J.Fragment,{children:`Agents, worktrees, bookmarklets and prompt templates are per project.`}):(0,J.jsxs)(J.Fragment,{children:[`Appearance, notifications, host resources and the project registry live in`,` `,(0,J.jsx)(k,{to:kp(`global`),"data-slot":`settings-global-link`,className:`underline underline-offset-2 hover:text-foreground`,children:`Global settings`}),`.`]})})]})]})]})}function Fp({delayDuration:e=0,...t}){return(0,J.jsx)(Ls,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function Ip({...e}){return(0,J.jsx)(Rs,{"data-slot":`tooltip`,...e})}function Lp({...e}){return(0,J.jsx)(zs,{"data-slot":`tooltip-trigger`,...e})}function Rp({className:e,sideOffset:t=0,children:n,...r}){return(0,J.jsx)(Bs,{children:(0,J.jsxs)(Vs,{"data-slot":`tooltip-content`,sideOffset:t,className:H(`z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-contrast px-3 py-1.5 text-xs text-balance text-contrast-foreground fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95`,e),...r,children:[n,(0,J.jsx)(Hs,{className:`z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-contrast fill-contrast`})]})})}var zp=[{id:`status`,label:`Status`,canFold:!1,defaultExpanded:!0,align:`left`,width:`116px`},{id:`task`,label:`Task`,canFold:!1,defaultExpanded:!0,align:`left`},{id:`workflow`,label:`Workflow`,canFold:!0,defaultExpanded:!0,align:`left`,width:`124px`,icon:`workflow`},{id:`branch`,label:`Branch`,canFold:!0,defaultExpanded:!1,align:`left`,width:`128px`,icon:`branch`},{id:`diff`,label:`±`,canFold:!0,defaultExpanded:!0,align:`left`,width:`78px`,icon:`diff`},{id:`reference`,label:`Ref`,canFold:!0,defaultExpanded:!0,align:`left`,width:`76px`,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:`76px`,icon:`cost`,capability:`cost`},{id:`cpu`,label:`CPU`,canFold:!0,defaultExpanded:!0,align:`right`,width:`68px`,icon:`cpu`},{id:`memory`,label:`Mem`,canFold:!0,defaultExpanded:!0,align:`right`,width:`88px`,icon:`memory`},{id:`started`,label:`Started`,canFold:!0,defaultExpanded:!0,align:`right`,width:`82px`,icon:`started`}],Bp=new Map(zp.map(e=>[e.id,e]));function Vp(e){return typeof e!=`object`||!e||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`boolean`))}function Hp(e){let t={};for(let[n,r]of Object.entries(Vp(e))){let e=Bp.get(n);e?.canFold&&(t[e.id]=r)}return t}function Up(e,t){let n=Bp.get(e);return!n||!n.canFold?!0:t[e]??n.defaultExpanded}function Wp(e,t){let n=Vp(e);return Bp.get(t)?.canFold?{...n,[t]:!Up(t,Hp(e))}:n}function Gp(e){return zp.filter(t=>t.capability===void 0||e[t.capability])}function Kp(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function qp(){let e=R(),t=ce(),n=q.useRef(0),r=q.useRef(0),i=q.useRef(Promise.resolve()),a=q.useMemo(()=>Hp(t.data?.taskTable?.expandedColumns),[t.data?.taskTable?.expandedColumns]),o=q.useCallback(t=>{if(!zp.find(e=>e.id===t)?.canFold)return;let a=e.getQueryData(E.uiState);if(a===void 0)return;let o=Kp(a?.taskTable),s={...o,expandedColumns:Wp(o.expandedColumns,t)};e.setQueryData(E.uiState,{...a,taskTable:s});let c=++n.current;r.current=c;let l=i.current.then(async()=>{let t=await ct({taskTable:s},{keepalive:!0});c===r.current&&e.setQueryData(E.uiState,t)});i.current=l.catch(t=>{I(t instanceof Error?t.message:String(t),{tone:`danger`}),c===r.current&&e.invalidateQueries({queryKey:E.uiState})})},[e]);return{expandedColumns:a,isExpanded:q.useCallback(e=>Up(e,a),[a]),toggleColumn:o,isPending:t.isPending}}function Jp({runs:e,view:t,onViewChange:n,onArchiveFinished:r,onMarkAllRead:i,onRename:o,onTogglePin:s,now:c=Date.now(),showTokens:l=!0,showCost:u=!0,expandedColumns:d=Hp(void 0),onToggleColumn:f=()=>void 0,columnsPending:p=!1}){let[m,h]=q.useState(``),g=e??[],_=yt(g),v=Ut(a(g,m),t),y=st(g),b=xe(a(g,m),t),x=Xe(g),S=Gp({tokens:l,cost:u}),ee=pn(g),C=t===`archived`?void 0:s;return(0,J.jsxs)(`div`,{"data-route":`tasks`,className:`flex min-h-full flex-col`,children:[(0,J.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,J.jsx)(`h1`,{className:`text-base font-semibold`,children:`Tasks`}),(0,J.jsxs)(`div`,{className:`inline-flex gap-0.5 rounded-md bg-muted p-[3px]`,children:[(0,J.jsx)(Xp,{view:`active`,current:t,onSelect:n,count:_.active,children:`Active`}),(0,J.jsx)(Xp,{view:`archived`,current:t,onSelect:n,count:_.archived,children:`Archived`})]}),(0,J.jsx)(`div`,{className:`flex-1`}),ee>0?(0,J.jsxs)(P,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`mark-all-read`,onClick:i,children:[(0,J.jsx)(ka,{className:`size-3.5`,"aria-hidden":`true`}),`Mark all read`]}):null,t===`active`&&x>0?(0,J.jsxs)(P,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`archive-finished`,onClick:r,children:[(0,J.jsx)(fn,{className:`size-3.5`,"aria-hidden":`true`}),`Archive finished`]}):null,(0,J.jsxs)(`div`,{className:`relative w-60`,children:[(0,J.jsx)(kr,{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,J.jsx)(`input`,{type:`text`,value:m,onChange:e=>h(e.target.value),placeholder:`Search tasks…`,"aria-label":`Search tasks`,className:`h-9 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,J.jsxs)(`div`,{className:`flex flex-1 flex-col p-3 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-5 md:pb-5`,children:[e===void 0?null:v.length===0?(0,J.jsx)(Yp,{view:t,query:m}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{"data-slot":`tasks-table`,className:`hidden overflow-x-auto rounded-lg border border-border bg-card shadow-xs md:block`,children:(0,J.jsx)(Fp,{children:(0,J.jsxs)(`table`,{className:`w-full border-collapse`,children:[(0,J.jsx)(`colgroup`,{children:S.map(e=>{let t=Up(e.id,d);return(0,J.jsx)(`col`,{"data-column-id":e.id,"data-expanded":t,style:{width:t?e.width:`42px`}},e.id)})}),(0,J.jsx)(`thead`,{children:(0,J.jsx)(`tr`,{children:S.map(e=>(0,J.jsx)(Qp,{column:e,expanded:Up(e.id,d),onToggle:f,disabled:p},e.id))})}),(0,J.jsx)(`tbody`,{className:`[&>tr:last-child>td]:border-b-0`,children:v.map(e=>(0,J.jsx)(tm,{run:e,queuePosition:e.status===`queued`?y.get(e.id)??null:null,onRename:o,onTogglePin:C,now:c,columns:S,expandedColumns:d},e.id))})]})})}),(0,J.jsx)(`div`,{"data-slot":`task-cards`,className:`flex flex-col gap-2.5 md:hidden`,children:v.map(e=>(0,J.jsx)(sm,{run:e,queuePosition:e.status===`queued`?y.get(e.id)??null:null,now:c,showTokens:l,showCost:u,onTogglePin:C},e.id))})]}),b.map(e=>(0,J.jsxs)(`div`,{"data-slot":`compare-strip`,"data-group-id":e.groupId,className:`mt-3.5 flex flex-wrap items-center gap-2.5 rounded-lg border border-border bg-card px-3.5 py-2.5 text-[12.5px] text-muted-foreground shadow-xs`,children:[(0,J.jsx)(co,{className:`size-[15px] shrink-0 text-soft-foreground`,"aria-hidden":`true`}),(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`strong`,{className:`font-semibold text-foreground`,children:e.title}),` — `,e.count,` variants finished`]}),(0,J.jsx)(P,{asChild:!0,variant:`outline`,size:`sm`,className:`md:ml-auto`,children:(0,J.jsx)(G,{to:`/compare/${e.groupId}`,children:`Compare`})})]},e.groupId))]}),(0,J.jsx)(G,{to:`/new`,"data-slot":`new-task-fab`,"aria-label":`New task`,className:`fixed right-4 bottom-[calc(16px+env(safe-area-inset-bottom))] z-20 inline-flex size-14 items-center justify-center rounded-full bg-primary text-primary-foreground shadow-modal md:hidden`,children:(0,J.jsx)(so,{className:`size-[22px]`,"aria-hidden":`true`})})]})}function Yp({view:e,query:t}){let n=t.trim(),r=n?`search-miss`:e===`archived`?`archive`:`no-tasks`;return(0,J.jsx)(`div`,{"data-slot":`tasks-empty`,"data-empty-kind":r,className:`flex flex-1 flex-col`,children:r===`search-miss`?(0,J.jsx)(z,{heading:`h2`,icon:(0,J.jsx)(Xr,{}),tone:`neutral`,title:`No matching tasks`,subtitle:`No tasks match “${n}”.`}):r===`archive`?(0,J.jsx)(z,{heading:`h2`,icon:(0,J.jsx)(fn,{}),tone:`neutral`,title:`Nothing archived yet`,subtitle:`Finished tasks you archive land here.`}):(0,J.jsx)(z,{heading:`h2`,icon:(0,J.jsx)($a,{}),tone:`primary`,backdrop:!0,title:`No tasks yet`,subtitle:`Describe a task to get started.`,actions:(0,J.jsx)(P,{asChild:!0,children:(0,J.jsxs)(G,{to:`/new`,children:[(0,J.jsx)(so,{"aria-hidden":`true`}),`New task`]})})})})}function Xp({view:e,current:t,onSelect:n,count:r,children:i}){let a=e===t;return(0,J.jsxs)(`button`,{type:`button`,"data-slot":`overview-tab`,"data-view":e,"aria-pressed":a,onClick:()=>n(e),className:H(`flex h-7 items-center justify-center gap-1.5 rounded-[7px] px-3 text-[12.5px] font-medium text-muted-foreground`,a&&`bg-card font-semibold text-foreground shadow-xs`),children:[i,r>0?(0,J.jsx)(`span`,{className:`font-mono text-[11px] tabular-nums`,children:r}):null]})}function Zp({children:e,right:t=!1,columnId:n,folded:r=!1}){return(0,J.jsx)(`th`,{scope:`col`,"data-column-id":n,"data-folded":r||void 0,className:H(`h-[38px] border-b border-border px-2.5 text-left text-[11px] font-semibold tracking-[0.05em] whitespace-nowrap text-soft-foreground uppercase first:pl-4 last:pr-4`,t&&`text-right`,r&&`px-0 first:pl-0 last:pr-0`),children:e})}function Qp({column:e,expanded:t,onToggle:n,disabled:r}){if(!e.canFold)return(0,J.jsx)(Zp,{columnId:e.id,right:e.align===`right`,children:e.label});let i=t?`Fold`:`Expand`;return(0,J.jsx)(Zp,{columnId:e.id,right:e.align===`right`,folded:!t,children:(0,J.jsxs)(Ip,{children:[(0,J.jsx)(Lp,{asChild:!0,children:(0,J.jsx)(`button`,{type:`button`,"aria-label":`${i} ${e.label} column`,"aria-pressed":t,disabled:r,onClick:()=>n(e.id),className:H(`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,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{children:e.label}),(0,J.jsx)(Aa,{className:`size-3 opacity-55`,"aria-hidden":`true`})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)($p,{icon:e.icon}),(0,J.jsx)(ja,{className:`size-3 opacity-70`,"aria-hidden":`true`})]})})}),(0,J.jsxs)(Rp,{side:`top`,children:[e.label,` · `,i,` column`]})]})})}function $p({icon:e}){let t=`size-3.5`;switch(e){case`workflow`:return(0,J.jsx)(mo,{className:t,"aria-hidden":`true`});case`branch`:return(0,J.jsx)(Ka,{className:t,"aria-hidden":`true`});case`diff`:return(0,J.jsx)(Ba,{className:t,"aria-hidden":`true`});case`reference`:return(0,J.jsx)(Qa,{className:t,"aria-hidden":`true`});case`tokens`:return(0,J.jsx)(Pa,{className:t,"aria-hidden":`true`});case`cost`:return(0,J.jsx)(La,{className:t,"aria-hidden":`true`});case`cpu`:return(0,J.jsx)(mn,{className:t,"aria-hidden":`true`});case`memory`:return(0,J.jsx)(eo,{className:t,"aria-hidden":`true`});case`started`:return(0,J.jsx)(Ma,{className:t,"aria-hidden":`true`});default:return null}}var em=`h-11 border-b border-border px-2.5 whitespace-nowrap first:pl-4 last:pr-4`;function tm({run:e,queuePosition:t,onRename:n,onTogglePin:r,now:i,columns:a,expandedColumns:o}){let s=vi(),c=Oi(e),l=ut(e),u=`/tasks/${e.id}`,d=Lt(e.costUsd),f=Ft(e);return(0,J.jsx)(`tr`,{"data-slot":`task-table-row`,"data-run-id":e.id,onClick:e=>{e.target.closest(`a, button, input`)||s(u)},className:`group/row cursor-pointer hover:bg-muted`,children:a.map(a=>a.id===`memory`?null:a.id===`cpu`?t===null?(0,J.jsx)(am,{run:e,cpuExpanded:Up(`cpu`,o),memoryExpanded:Up(`memory`,o)},a.id):(0,J.jsxs)(`td`,{"data-slot":`queue-note`,"data-column-id":`cpu-memory`,colSpan:2,className:H(em,`text-right font-mono text-[11.5px] text-soft-foreground`),children:[`#`,t,` in queue`]},a.id):(0,J.jsx)(nm,{column:a,expanded:Up(a.id,o),run:e,attention:c,scheduled:l,reference:f,cost:d,to:u,onRename:n,onTogglePin:r,now:i},a.id))})}function nm({column:e,expanded:t,run:n,attention:r,scheduled:i,reference:a,cost:o,to:s,onRename:c,onTogglePin:l,now:u}){if(!t)return(0,J.jsx)(rm,{column:e.id});switch(e.id){case`status`:return(0,J.jsx)(`td`,{"data-column-id":e.id,className:em,children:(0,J.jsxs)(ji,{dot:r.tone,pulse:r.pulse,title:i?.title,children:[r.label,i?(0,J.jsx)(`span`,{className:`tabular-nums`,children:i.label}):null]})});case`task`:return(0,J.jsx)(`td`,{"data-column-id":e.id,className:H(em,`min-w-[220px] max-w-0`),children:(0,J.jsx)(im,{run:n,to:s,onRename:c,onTogglePin:l})});case`workflow`:return(0,J.jsx)(`td`,{"data-column-id":e.id,className:H(em,`text-[12.5px] text-muted-foreground`),children:Vt(n)});case`branch`:return(0,J.jsx)(`td`,{"data-column-id":e.id,className:em,children:n.branch?(0,J.jsx)(um,{branch:n.branch}):(0,J.jsx)(cm,{})});case`diff`:return(0,J.jsx)(`td`,{"data-column-id":e.id,className:em,children:n.diffStat?(0,J.jsx)(Wi,{stat:n.diffStat}):(0,J.jsx)(cm,{})});case`reference`:return(0,J.jsx)(`td`,{"data-column-id":e.id,className:em,children:a?(0,J.jsx)(yn,{run:n,reference:a}):(0,J.jsx)(cm,{})});case`tokens`:return(0,J.jsx)(`td`,{"data-column-id":e.id,className:H(em,`text-right text-xs text-muted-foreground`),children:(0,J.jsx)(ki,{inputTokens:n.inputTokens,outputTokens:n.outputTokens,totalTokens:n.tokensUsed||void 0,variant:`table`,omitWhenUnknown:!1})});case`cost`:return(0,J.jsx)(`td`,{"data-column-id":e.id,className:H(em,`text-right font-mono text-xs text-muted-foreground tabular-nums`),children:o||(0,J.jsx)(cm,{})});case`started`:return(0,J.jsx)(`td`,{"data-column-id":e.id,className:H(em,`text-right text-xs text-soft-foreground tabular-nums`),children:Mi(n.startedAt??n.createdAt,u)});case`cpu`:case`memory`:return null}}function rm({column:e}){return(0,J.jsx)(`td`,{role:`presentation`,"aria-hidden":`true`,"data-column-id":e,"data-folded":`true`,className:H(em,`px-0 first:pl-0 last:pr-0`)})}function im({run:e,to:t,onRename:n,onTogglePin:r}){let i=N(e),a=En(i,t=>n(e.id,t)),o=gn(e),s=An(e);return a.editing?(0,J.jsx)(Dn,{editor:a,className:`text-[13px] font-medium`}):(0,J.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,J.jsx)(G,{to:t,title:i,className:H(`min-w-0 truncate text-[13px]`,o?`font-semibold text-foreground`:s?`font-medium text-muted-foreground`:`font-medium`),children:i}),o?(0,J.jsx)(K,{tone:`violet`,role:`img`,"aria-label":`unread`,title:`Unread — not opened since it finished`,className:`shrink-0`}):null,(0,J.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,J.jsx)(_n,{className:`size-3`,"aria-hidden":`true`})}),r?(0,J.jsx)(cl,{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 am({run:e,cpuExpanded:t,memoryExpanded:n}){let r=_t(e,Sa(e.id));return(0,J.jsxs)(J.Fragment,{children:[t?(0,J.jsx)(om,{column:`cpu`,cell:r.cpu}):(0,J.jsx)(rm,{column:`cpu`}),n?(0,J.jsx)(om,{column:`memory`,cell:r.mem}):(0,J.jsx)(rm,{column:`memory`})]})}function om({column:e,cell:t}){return(0,J.jsx)(`td`,{"data-usage":e===`memory`?`mem`:e,"data-column-id":e,"data-usage-kind":t.kind,title:t.title,className:H(em,`text-right font-mono tabular-nums`,t.kind===`live`&&`bg-violet/5 text-xs font-medium text-foreground`,t.kind===`peak`&&`text-[11.5px] text-soft-foreground`,t.kind===`none`&&`text-xs text-soft-foreground`),children:t.text||`—`})}function sm({run:e,queuePosition:t,now:n,showTokens:r,showCost:i,onTogglePin:a}){let o=vi(),s=Oi(e),c=ut(e),l=`/tasks/${e.id}`,u=Ft(e),d=gn(e),f=An(e),p=Lt(e.costUsd),m=e.inputTokens!==void 0||e.outputTokens!==void 0;return(0,J.jsxs)(`div`,{"data-slot":`task-card`,"data-run-id":e.id,onClick:e=>{e.target.closest(`a, button`)||o(l)},className:`cursor-pointer rounded-lg border border-border bg-card px-3.5 py-3 shadow-xs`,children:[(0,J.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,J.jsxs)(ji,{dot:s.tone,pulse:s.pulse,className:`mt-px shrink-0`,title:c?.title,children:[s.label,c?(0,J.jsx)(`span`,{className:`tabular-nums`,children:c.label}):null]}),(0,J.jsx)(G,{to:l,className:H(`min-w-0 flex-1 text-[13.5px] leading-[1.35]`,d?`font-semibold text-foreground`:f?`font-medium text-muted-foreground`:`font-medium`),children:N(e)}),d?(0,J.jsx)(K,{tone:`violet`,role:`img`,"aria-label":`unread`,title:`Unread — not opened since it finished`,className:`mt-1.5 shrink-0`}):null,(0,J.jsx)(`span`,{className:`mt-0.5 shrink-0 text-[11.5px] text-soft-foreground tabular-nums`,children:Mi(e.finishedAt??e.createdAt,n)}),a?(0,J.jsx)(cl,{pinned:!!e.pinned,onToggle:t=>a(e,t),className:`-mr-1 mt-px`}):null]}),(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5 font-mono text-[11.5px] font-medium text-muted-foreground tabular-nums`,children:[(0,J.jsx)(`span`,{children:Vt(e)}),t===null?(0,J.jsxs)(J.Fragment,{children:[e.branch?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(lm,{}),(0,J.jsx)(`span`,{children:e.branch})]}):null,e.diffStat?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(lm,{}),(0,J.jsx)(Wi,{stat:e.diffStat,className:`text-[11.5px]`})]}):null,r&&m?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(lm,{}),(0,J.jsx)(ki,{inputTokens:e.inputTokens,outputTokens:e.outputTokens})]}):null,i&&p?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(lm,{}),(0,J.jsx)(`span`,{children:p})]}):null]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(lm,{}),(0,J.jsxs)(`span`,{"data-slot":`queue-note`,children:[`#`,t,` in queue`]})]}),u?(0,J.jsx)(yn,{run:e,reference:u,className:`h-5`}):null]})]})}function cm(){return(0,J.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`—`})}function lm(){return(0,J.jsx)(`span`,{className:`text-soft-foreground`,"aria-hidden":`true`,children:`·`})}function um({branch:e}){return(0,J.jsx)(`span`,{className:`rounded-[6px] bg-muted px-1.5 py-0.5 font-mono text-[11.5px] font-medium text-muted-foreground`,children:e})}function dm(){let e=ye(),t=Di(M().data),[n,r]=$c(),i=R(),a=j({mutationFn:v,onSuccess:()=>i.invalidateQueries({queryKey:L.runs.all})}),o=j({mutationFn:Rt,onSuccess:()=>i.invalidateQueries({queryKey:L.runs.all}),onError:e=>I(e.message,{tone:`danger`})}),s=j({mutationFn:({id:e,title:t})=>Ke(e,{title:t}),onSuccess:()=>i.invalidateQueries({queryKey:L.runs.all}),onError:e=>I(e.message,{tone:`danger`})}),c=Et(),l=Hn(3e4),u=qp(),d=xt();return(0,J.jsx)(On,{projectId:d,requests:q.useMemo(()=>d===void 0?[]:(e.data??[]).flatMap(e=>{let t=Ft(e);return t?[{projectId:d,kind:t.kind,number:t.number}]:[]}),[e.data,d]),children:(0,J.jsx)(Jp,{runs:e.data,view:n,onViewChange:r,onArchiveFinished:()=>a.mutate(),onMarkAllRead:()=>o.mutate(),onRename:(e,t)=>s.mutate({id:e,title:t}),onTogglePin:(e,t)=>c.mutate({id:e.id,pinned:t},{onError:e=>I(e.message,{tone:`danger`})}),now:l,showTokens:t.tokens,showCost:t.cost,expandedColumns:u.expandedColumns,onToggleColumn:u.toggleColumn,columnsPending:u.isPending})})}function fm({slot:e,label:t,options:n,selected:r,onToggle:i,onClear:a,searchPlaceholder:s,emptyLabel:c=`Nothing to filter by`}){let[l,u]=q.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,J.jsxs)(rr,{open:l,onOpenChange:u,children:[(0,J.jsx)(Xn,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,"data-slot":`facet-${e}`,"data-active":d?`true`:void 0,"aria-label":`Filter by ${t.toLowerCase()}`,className:H(`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-violet/40 bg-violet/10 text-foreground`),children:[(0,J.jsx)(`span`,{className:H(d&&`text-soft-foreground`),children:t}),d?(0,J.jsx)(`span`,{className:`max-w-[140px] truncate font-semibold`,children:f}):null,(0,J.jsx)(Gn,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,J.jsxs)(Zn,{align:`start`,className:`w-64 p-0`,"data-testid":`facet-${e}-menu`,children:[(0,J.jsxs)(Hr,{children:[(0,J.jsx)(Ar,{placeholder:s??`Search ${t.toLowerCase()}…`}),(0,J.jsxs)(Jr,{children:[(0,J.jsx)(Ir,{children:c}),(0,J.jsx)(U,{children:n.map(e=>{let t=r.includes(e.value);return(0,J.jsxs)(W,{value:e.label,onSelect:()=>i(e.value),"data-slot":`facet-option`,"data-value":e.value,"aria-checked":t,role:`option`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:H(`flex size-4 shrink-0 items-center justify-center rounded-[4px] border`,t?`border-violet bg-violet text-violet-foreground`:`border-input`),children:t?(0,J.jsx)(o,{className:`size-3`}):null}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),e.count===void 0?null:(0,J.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-soft-foreground tabular-nums`,children:e.count})]},e.value)})})]})]}),d?(0,J.jsx)(`div`,{className:`border-t border-border p-1`,children:(0,J.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 pm({label:e,count:t,selected:n,onToggle:r,slot:i,tone:a=`neutral`}){return(0,J.jsxs)(`button`,{type:`button`,"data-slot":i,"data-selected":n?`true`:void 0,"aria-pressed":n,onClick:r,className:H(`inline-flex h-7 items-center gap-1.5 rounded-full border px-2.5 text-xs font-medium transition-colors`,a===`tag`?`border-violet/25 bg-violet/10 text-violet hover:bg-violet/20`:`border-border bg-card text-muted-foreground hover:bg-muted hover:text-foreground`,n&&`border-violet bg-violet text-violet-foreground hover:bg-violet`),children:[e,t===void 0?null:(0,J.jsx)(`span`,{className:H(`font-mono text-[11px] tabular-nums`,!n&&`text-soft-foreground`),children:t})]})}function mm({slot:e,label:t,value:n,options:r,onChange:i}){return(0,J.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,J.jsx)(`button`,{type:`button`,"data-value":e.value,"aria-pressed":t,onClick:()=>i(e.value),className:H(`flex h-6 items-center justify-center rounded-[6px] px-2.5 text-[12px] font-medium text-muted-foreground transition-colors hover:text-foreground`,t&&`bg-card font-semibold text-foreground shadow-xs`),children:e.label},e.value)})})}var hm=` untagged`,gm=[{value:`project`,label:`Project`},{value:`tag`,label:`Tag`},{value:`status`,label:`Status`},{value:`workflow`,label:`Workflow`}];function _m(e,t){return e===t?`none`:t}var vm={query:``,tags:[],statuses:[],workflows:[]};function ym(e,t){return e.includes(t)?e.filter(e=>e!==t):[...e,t]}function bm(e){return e.tags.length+e.statuses.length+e.workflows.length}function xm(e){return e.query.trim()!==``||bm(e)>0}function Sm(e){return bm(e.filters)+(e.filters.query.trim()===``?0:1)+(e.groupBy===`none`?0:1)}function Cm(e){return Sm(e)>0}function wm(e,t){let n=new Map(t.map(e=>[e.id,e]));return e.map(e=>{let t=n.get(e.projectId);return{run:e,project:t,projectName:t?.name||e.projectId,tags:t?.tags??[]}})}function Tm(e){let t=new Set;for(let n of e)t.add(n.run.workflow);return[...t].sort((e,t)=>e.localeCompare(t))}function Em(e){let t=new Set;for(let n of e)t.add(n.run.status);return[...t].sort((e,t)=>e.localeCompare(t))}function Dm(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 Om=e=>e.tags.length===0?[hm]:e.tags,km=(e,t)=>e.length===0||t.some(t=>e.includes(t)),Am=(e,t)=>{if(t.length===0)return!0;let n=Om(e).map(e=>e.toLowerCase());return t.some(e=>n.includes(e.toLowerCase()))};function jm(e){return[N(e.run),e.projectName,e.run.workflow,e.run.branch??``,...e.tags].join(`
7
+ `).toLowerCase()}function Mm(e,t,n){let r=t.query.trim().toLowerCase().split(/\s+/).filter(Boolean);return e.filter(e=>{if((n===`archived`?!e.run.archived:e.run.archived)||!km(t.statuses,[e.run.status])||!km(t.workflows,[e.run.workflow])||!Am(e,t.tags))return!1;if(r.length===0)return!0;let i=jm(e);return r.every(e=>i.includes(e))})}function Nm(e,t,n,r){return Mm(e,{...t,[r]:[]},n)}function Pm(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(hm,`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 Fm(e,t){let n=new Map(t.map(e=>[e.id,e.name]));return e.map(e=>n.get(e)||e)}var $={query:`q`,tag:`tag`,untagged:`untagged`,status:`status`,workflow:`workflow`,groupBy:`group`,archived:`archived`},Im=new Set(gm.map(e=>e.value));function Lm(e){let t=new URLSearchParams,n=e.filters.query.trim();n!==``&&t.set($.query,n);for(let n of e.filters.tags)n===` untagged`?t.set($.untagged,`1`):t.append($.tag,n);for(let n of e.filters.statuses)t.append($.status,n);for(let n of e.filters.workflows)t.append($.workflow,n);return e.groupBy!==`none`&&t.set($.groupBy,e.groupBy),e.view===`archived`&&t.set($.archived,`1`),t}function Rm(e){let t=e.getAll($.tag).filter(e=>e!==``);e.get($.untagged)===`1`&&t.push(hm);let n=e.get($.groupBy)??``;return{filters:{query:e.get($.query)??``,tags:t,statuses:e.getAll($.status).filter(e=>e!==``),workflows:e.getAll($.workflow).filter(e=>e!==``)},groupBy:Im.has(n)?n:`none`,view:e.get($.archived)===`1`?`archived`:`active`}}var zm=15e3,Bm=250,Vm=1,Hm=220,Um=new Set([`done`,`failed`,`cancelled`]);function Wm(){return Km({request:({task:e,archived:t})=>g(e.run.projectId,e.run.id,t),patch:({archived:e})=>t=>({...t,archived:e})})}function Gm(){return Km({request:({task:e,read:t})=>De(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 Km({request:e,patch:t}){let n=R();return j({mutationFn:e,onMutate:async e=>{await n.cancelQueries({queryKey:E.runsIndex});let r=n.getQueryData(E.runsIndex),i=t(e),{task:a}=e;return n.setQueryData(E.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(E.runsIndex,r.previous),I(e.message,{tone:`danger`})},onSettled:(e,t,{task:r})=>{n.invalidateQueries({queryKey:E.runsIndex}),n.invalidateQueries({queryKey:L.runs.all}),n.invalidateQueries({queryKey:[r.run.projectId,`runs`,`list`]})}})}function qm(){let e=B(),t=Di(M().data),n=S(!0,zm),[r,i]=ne(),{filters:a,groupBy:o,view:s}=q.useMemo(()=>Rm(r),[r]),[c,l]=$c();q.useEffect(()=>{c!==s&&l(s)},[s,c,l]);let u=Hn(3e4),d=e=>i(t=>Lm(e(Rm(t))),{replace:!0}),f=e=>d(t=>({...t,filters:e(t.filters)})),p=e=>d(t=>({...t,groupBy:e})),m=e=>d(t=>({...t,view:e})),[h,g]=q.useState(a.query),_=q.useRef(a.query);q.useEffect(()=>{a.query!==_.current&&g(a.query),_.current=a.query},[a.query]),q.useEffect(()=>{if(h===_.current)return;let e=setTimeout(()=>{_.current=h,f(e=>({...e,query:h}))},Bm);return()=>clearTimeout(e)},[h]);let v=n.data?.referenceStatuses;q.useEffect(()=>{v&&O(v)},[v]);let y=q.useMemo(()=>e.data?.projects??[],[e.data]),b=q.useMemo(()=>wm(n.data?.runs??[],y),[n.data,y]),x=q.useMemo(()=>Mm(b,a,s),[b,a,s]),ee=q.useMemo(()=>Pm(x,o),[x,o]),C=q.useMemo(()=>x.flatMap(e=>Ge(e.run,e.project?.repoUrl).map(t=>({projectId:e.run.projectId,kind:t.kind,number:t.number}))),[x]),te=Fm(n.data?.truncated??[],y),re=(e,t)=>f(n=>({...n,[e]:ym(n[e],t)})),w=e=>f(t=>({...t,[e]:[]})),ie=Wm(),T=Gm();if(n.isError||e.isError)return(0,J.jsx)(`div`,{"data-route":`global-tasks`,className:`flex min-h-full flex-col`,children:(0,J.jsx)(z,{icon:(0,J.jsx)(Za,{}),tone:`danger`,title:`Tasks across projects did not load`,subtitle:(n.error??e.error)?.message})});let ae=(0,J.jsxs)(`div`,{className:`relative w-full md:w-60`,children:[(0,J.jsx)(kr,{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,J.jsx)(`input`,{type:`text`,value:h,onChange:e=>g(e.target.value),placeholder:`Search every project…`,"aria-label":`Search tasks across projects`,className:`h-9 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,J.jsxs)(`div`,{"data-route":`global-tasks`,className:`flex min-h-full flex-col`,children:[(0,J.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,J.jsx)(`h1`,{className:`text-base font-semibold`,children:`All tasks`}),(0,J.jsxs)(`div`,{className:`inline-flex gap-0.5 rounded-md bg-muted p-[3px]`,children:[(0,J.jsx)(Jm,{view:`active`,current:s,onSelect:m,children:`Active`}),(0,J.jsx)(Jm,{view:`archived`,current:s,onSelect:m,children:`Archived`})]}),(0,J.jsx)(`div`,{className:`flex-1`}),(0,J.jsxs)(`span`,{"data-slot":`global-tasks-count`,className:`text-[12.5px] text-soft-foreground tabular-nums`,children:[x.length,` of `,b.length]}),ae]}),(0,J.jsxs)(`div`,{className:`flex flex-1 flex-col gap-3 p-3 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-5 md:pb-5`,children:[(0,J.jsx)(`div`,{className:`md:hidden`,children:ae}),(0,J.jsx)(Ym,{filters:a,onToggle:re,onClearFacet:w,onClearAll:()=>{g(``),d(e=>({...e,filters:vm,groupBy:`none`}))},groupBy:o,onGroupByChange:p,projects:y,tasks:b,view:s}),te.length>0?(0,J.jsxs)(`p`,{"data-slot":`global-tasks-truncated`,className:`text-[11.5px] text-soft-foreground`,children:[`Showing the newest `,n.data?.perProjectLimit,` tasks per project — older ones in`,` `,te.join(`, `),` are only in that project’s own Tasks page.`]}):null,n.data===void 0?null:x.length===0?(0,J.jsx)(sh,{view:s,filtered:xm(a)}):(0,J.jsx)(On,{requests:C,children:ee.map(e=>(0,J.jsxs)(`section`,{"data-slot":`task-group`,"data-group-key":e.key,children:[o===`none`?null:(0,J.jsxs)(`h2`,{className:`mb-1.5 flex items-center gap-2 text-[12px] font-semibold tracking-[0.04em] text-soft-foreground uppercase`,children:[o===`project`?(0,J.jsx)(k,{to:_i(e.key,`/`),"data-slot":`group-project-link`,className:`hover:text-foreground hover:underline`,children:e.label}):e.label,(0,J.jsx)(`span`,{className:`font-mono text-[11px] font-medium tabular-nums`,children:e.tasks.length})]}),(0,J.jsx)(Xm,{tasks:e.tasks,now:u,showProject:o!==`project`,onArchive:(e,t)=>ie.mutate({task:e,archived:t}),onSetRead:(e,t)=>T.mutate({task:e,read:t}),busy:ie.isPending||T.isPending,showCost:t.cost})]},e.key))})]})]})}function Jm({view:e,current:t,onSelect:n,children:r}){let i=e===t;return(0,J.jsx)(`button`,{type:`button`,"data-slot":`overview-tab`,"data-view":e,"aria-pressed":i,onClick:()=>n(e),className:H(`flex h-7 items-center justify-center rounded-[7px] px-3 text-[12.5px] font-medium text-muted-foreground`,i&&`bg-card font-semibold text-foreground shadow-xs`),children:r})}function Ym({filters:e,onToggle:t,onClearFacet:n,onClearAll:r,groupBy:i,onGroupByChange:a,projects:o,tasks:s,view:c}){let l=q.useMemo(()=>Re(o),[o]),u=q.useMemo(()=>{let t=(t,n)=>Dm(Nm(s,e,c,t),n);return{tags:t(`tags`,Om),statuses:t(`statuses`,e=>[e.run.status]),workflows:t(`workflows`,e=>[e.run.workflow])}},[s,e,c]),d=e=>t=>({...t,count:e.get(t.value)??0});return(0,J.jsxs)(`div`,{"data-slot":`global-tasks-filters`,className:`flex flex-col gap-2 rounded-lg border border-border bg-card p-2.5 shadow-xs`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,J.jsx)(fm,{slot:`status`,label:`Status`,selected:e.statuses,onToggle:e=>t(`statuses`,e),onClear:()=>n(`statuses`),options:Em(s).map(e=>({value:e,label:e})).map(d(u.statuses)),emptyLabel:`No tasks to filter`}),(0,J.jsx)(fm,{slot:`workflow`,label:`Workflow`,selected:e.workflows,onToggle:e=>t(`workflows`,e),onClear:()=>n(`workflows`),options:Tm(s).map(e=>({value:e,label:e})).map(d(u.workflows)),emptyLabel:`No tasks to filter`}),(0,J.jsx)(`span`,{className:`mx-1 h-5 w-px bg-border`,"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`text-[11px] font-medium text-soft-foreground`,children:`Group by`}),(0,J.jsx)(mm,{slot:`group-by`,label:`Group tasks by`,value:i,options:gm,onChange:e=>a(_m(i,e))}),Cm({filters:e,groupBy:i})?(0,J.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,J.jsx)($r,{className:`size-3`,"aria-hidden":`true`}),`Clear`,` (${Sm({filters:e,groupBy:i})})`]}):null]}),l.length>0?(0,J.jsxs)(`div`,{"data-slot":`tag-filters`,className:`flex flex-wrap items-center gap-1.5`,children:[(0,J.jsx)(`span`,{className:`text-[11px] font-medium text-soft-foreground`,children:`Tags`}),l.map(n=>(0,J.jsx)(pm,{slot:`tag-filter`,tone:`tag`,label:n,count:u.tags.get(n)??0,selected:e.tags.some(e=>e.toLowerCase()===n.toLowerCase()),onToggle:()=>t(`tags`,n)},n)),(0,J.jsx)(pm,{slot:`tag-filter`,label:`Untagged`,count:u.tags.get(` untagged`)??0,selected:e.tags.includes(hm),onToggle:()=>t(`tags`,hm)})]}):(0,J.jsxs)(`p`,{"data-slot":`no-tags-hint`,className:`text-[11px] text-soft-foreground`,children:[`Tag connected repositories in`,` `,(0,J.jsx)(k,{to:`/settings/global/projects`,className:`font-medium text-violet hover:underline`,children:`Settings → Projects`}),` `,`to group their tasks together here.`]})]})}function Xm({tasks:e,now:t,showProject:n,onArchive:r,onSetRead:i,busy:a,showCost:o}){return(0,J.jsx)(`div`,{"data-slot":`global-tasks-table`,className:`overflow-x-auto rounded-lg border border-border bg-card shadow-xs`,children:(0,J.jsx)(Fp,{children:(0,J.jsxs)(`table`,{className:`w-full border-collapse`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(Zm,{className:`w-[104px]`,children:`Status`}),(0,J.jsx)(Zm,{children:`Task`}),n?(0,J.jsx)(Zm,{className:`w-[124px]`,children:`Project`}):null,(0,J.jsx)(Zm,{className:`hidden w-[120px] xl:table-cell`,children:`Tags`}),(0,J.jsx)(Zm,{className:`w-[84px]`,children:`Ref`}),(0,J.jsx)(Zm,{className:`hidden w-[108px] xl:table-cell`,children:`Workflow`}),o?(0,J.jsx)(Zm,{className:`hidden w-[64px] text-right lg:table-cell`,children:`Cost`}):null,(0,J.jsx)(Zm,{className:`hidden w-[56px] text-right xl:table-cell`,children:`CPU`}),(0,J.jsx)(Zm,{className:`hidden w-[84px] text-right xl:table-cell`,children:`Mem`}),(0,J.jsx)(Zm,{className:`w-[56px] text-right`,children:`Age`}),(0,J.jsx)(Zm,{className:`w-[64px] text-right`,children:(0,J.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]})}),(0,J.jsx)(`tbody`,{className:`[&>tr:last-child>td]:border-b-0`,children:e.map(e=>(0,J.jsx)($m,{task:e,now:t,showProject:n,onArchive:r,onSetRead:i,busy:a,showCost:o},`${e.run.projectId}/${e.run.id}`))})]})})})}function Zm({children:e,className:t}){return(0,J.jsx)(`th`,{scope:`col`,className:H(`h-[38px] border-b border-border px-2.5 text-left text-[11px] font-semibold tracking-[0.05em] whitespace-nowrap text-soft-foreground uppercase first:pl-4 last:pr-4`,t),children:e})}var Qm=`h-11 border-b border-border px-2.5 whitespace-nowrap first:pl-4 last:pr-4`;function $m({task:e,now:t,showProject:n,onArchive:r,onSetRead:i,busy:a,showCost:o}){let{run:s}=e,c=Oi(s),l=_i(s.projectId,`/tasks/${s.id}`),u=gn(s),d=An(s),f=Ge(s,e.project?.repoUrl),p=_t(s,s.usage);return(0,J.jsxs)(`tr`,{"data-slot":`global-task-row`,"data-run-id":s.id,"data-project":s.projectId,className:`hover:bg-muted`,children:[(0,J.jsx)(`td`,{className:Qm,children:(0,J.jsx)(ji,{dot:c.tone,pulse:c.pulse,children:c.label})}),(0,J.jsx)(`td`,{className:H(Qm,`min-w-[320px] max-w-0`),children:(0,J.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,J.jsx)(k,{to:l,title:N(s),className:H(`min-w-0 truncate text-[13px]`,u?`font-semibold text-foreground`:d?`font-medium text-muted-foreground`:`font-medium`),children:N(s)}),u?(0,J.jsx)(K,{tone:`violet`,role:`img`,"aria-label":`unread`,title:`Unread — not opened since it finished`,className:`shrink-0`}):null]})}),n?(0,J.jsx)(`td`,{className:H(Qm,`text-[12.5px] text-muted-foreground`),children:(0,J.jsx)(k,{to:_i(s.projectId,`/`),className:`truncate hover:text-foreground`,children:e.projectName})}):null,(0,J.jsx)(`td`,{className:H(Qm,`hidden xl:table-cell`),children:e.tags.length>0?(0,J.jsx)(`span`,{className:`flex flex-wrap items-center gap-1`,children:e.tags.map(e=>(0,J.jsx)(ih,{tag:e},e))}):(0,J.jsx)(oh,{})}),(0,J.jsx)(`td`,{className:Qm,children:f.length>0?(0,J.jsx)(nh,{references:f,run:s}):(0,J.jsx)(oh,{})}),(0,J.jsx)(`td`,{className:H(Qm,`hidden text-[12.5px] text-muted-foreground xl:table-cell`),children:s.workflow}),o?(0,J.jsx)(`td`,{className:H(Qm,`hidden text-right font-mono text-xs text-muted-foreground tabular-nums lg:table-cell`),children:Lt(s.costUsd)||(0,J.jsx)(oh,{})}):null,(0,J.jsx)(ah,{column:`cpu`,cell:p.cpu}),(0,J.jsx)(ah,{column:`memory`,cell:p.mem}),(0,J.jsx)(`td`,{className:H(Qm,`text-right text-xs text-soft-foreground tabular-nums`),children:Mi(s.startedAt??s.createdAt,t)}),(0,J.jsx)(`td`,{className:H(Qm,`text-right`),children:(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,J.jsx)(eh,{task:e,busy:a,onSetRead:i}),(0,J.jsx)(th,{task:e,busy:a,onArchive:r})]})})]})}function eh({task:e,busy:t,onSetRead:n}){if(!bn(e.run))return null;let r=gn(e.run),i=N(e.run),a=r?`Mark ${i} read`:`Mark ${i} unread`,o=r?Or:Ra;return(0,J.jsxs)(Ip,{children:[(0,J.jsx)(Lp,{asChild:!0,children:(0,J.jsx)(`button`,{type:`button`,"data-action":r?`mark-read`:`mark-unread`,"aria-label":a,disabled:t,onClick:()=>n(e,r),className:H(`inline-flex size-7 items-center justify-center 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-violet`:`text-soft-foreground`),children:(0,J.jsx)(o,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,J.jsx)(Rp,{side:`left`,children:r?`Mark read`:`Mark unread`})]})}function th({task:e,busy:t,onArchive:n}){let r=e.run.archived;if(!r&&!Um.has(e.run.status))return null;let i=r?`Restore ${N(e.run)} to the active list`:`Archive ${N(e.run)}`;return(0,J.jsxs)(Ip,{children:[(0,J.jsx)(Lp,{asChild:!0,children:(0,J.jsx)(`button`,{type:`button`,"data-action":r?`unarchive-run`:`archive-run`,"aria-label":i,disabled:t,onClick:()=>n(e,!r),className:`inline-flex size-7 items-center justify-center 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,J.jsx)(r?Cn:fn,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,J.jsx)(Rp,{side:`left`,children:r?`Restore`:`Archive`})]})}function nh({references:e,run:t}){let n=e.slice(0,Vm),r=e.length-n.length,i=N(t);return(0,J.jsxs)(`span`,{className:`flex flex-nowrap items-center gap-1`,children:[n.map(e=>(0,J.jsx)(vn,{reference:e,taskTitle:i,projectId:t.projectId,conflictAction:(0,J.jsx)(Sn,{projectId:t.projectId,runId:t.id,prNumber:e.number}),className:`shrink-0`},`${e.kind}#${e.number}`)),r>0?(0,J.jsx)(rh,{references:e,taskTitle:i,hidden:r,projectId:t.projectId}):null]})}function rh({references:e,taskTitle:t,hidden:n,projectId:r}){let[i,a]=q.useState(!1),o=q.useRef(!1),s=q.useRef(void 0);q.useEffect(()=>()=>clearTimeout(s.current),[]);let c=e=>e.pointerType!==`touch`,l=()=>clearTimeout(s.current),u=e=>{c(e)&&(l(),o.current=!0,a(!0))},d=e=>{c(e)&&(l(),s.current=setTimeout(()=>a(!1),Hm))};return(0,J.jsxs)(rr,{open:i,onOpenChange:a,children:[(0,J.jsx)(Xn,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,"data-slot":`reference-overflow`,"aria-label":`Show all ${e.length} references for ${t}`,onPointerEnter:u,onPointerLeave:d,onPointerDown:()=>{o.current=!1},onClick:()=>{o.current=!1},className:`shrink-0 rounded-full px-1 text-[11px] font-medium text-soft-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:[`+`,n]})}),(0,J.jsxs)(Zn,{align:`start`,className:`w-auto min-w-40 p-1.5`,"data-slot":`reference-overflow-list`,onPointerEnter:u,onPointerLeave:d,onOpenAutoFocus:e=>{o.current&&e.preventDefault()},onCloseAutoFocus:e=>{o.current&&e.preventDefault()},children:[(0,J.jsx)(`p`,{className:`px-1 pb-1.5 text-[10.5px] text-soft-foreground`,children:`References`}),(0,J.jsx)(`span`,{className:`flex flex-col items-start gap-1`,children:e.map(e=>(0,J.jsx)(vn,{reference:e,taskTitle:t,projectId:r},`${e.kind}#${e.number}`))})]})]})}function ih({tag:e,className:t}){return(0,J.jsx)(`span`,{"data-slot":`project-tag`,className:H(`inline-flex max-w-full items-center truncate rounded-full bg-muted px-1.5 py-px text-[10.5px] font-medium text-muted-foreground`,t),children:e})}function ah({column:e,cell:t}){return(0,J.jsx)(`td`,{"data-usage":e===`memory`?`mem`:e,"data-usage-kind":t.kind,title:t.title,className:H(Qm,`hidden text-right font-mono tabular-nums xl:table-cell`,t.kind===`live`&&`bg-violet/5 text-xs font-medium text-foreground`,t.kind===`peak`&&`text-[11.5px] text-soft-foreground`,t.kind===`none`&&`text-xs text-soft-foreground`),children:t.text||`—`})}function oh(){return(0,J.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`—`})}function sh({view:e,filtered:t}){return t?(0,J.jsx)(z,{heading:`h2`,icon:(0,J.jsx)(Xr,{}),tone:`neutral`,title:`No matching tasks`,subtitle:`No task in any project matches these filters.`}):e===`archived`?(0,J.jsx)(z,{heading:`h2`,icon:(0,J.jsx)(fn,{}),tone:`neutral`,title:`Nothing archived yet`,subtitle:`Finished tasks you archive land here, from every project.`}):(0,J.jsx)(z,{heading:`h2`,icon:(0,J.jsx)($a,{}),tone:`neutral`,title:`No tasks yet`,subtitle:`Start a task in any project and it shows up here.`})}function ch({mode:e=`list`}){let{automationId:t}=je(),n=vi(),r=wi(),[i,a]=(0,q.useState)(),[o,s]=(0,q.useState)(``),[c,l]=(0,q.useState)({}),u=M(),d=u.data!==void 0,f=d&&u.data.capabilities?.automations!==!0,p=()=>se().then(a).catch(e=>s(String(e)));if((0,q.useEffect)(()=>{d&&!f&&p()},[d,f]),(0,q.useEffect)(()=>pa((e,t)=>{if(e!==`automation-change`)return;let n=t;typeof n.project==`string`&&(r===null||n.project===r)&&p()}),[r]),!d)return(0,J.jsx)(`div`,{"data-route":`automations`,className:`flex min-h-full flex-col p-3 md:p-5`,children:(0,J.jsx)(fh,{text:`Loading automations…`})});if(f)return(0,J.jsx)(`div`,{"data-route":`automations`,className:`flex min-h-full flex-col p-3 md:p-5`,children:(0,J.jsx)(z,{icon:(0,J.jsx)(cr,{}),tone:`neutral`,title:`GitHub automations are off`,subtitle:`This server does not poll GitHub or launch tasks from it. Set XEZ_AUTOMATIONS=1 and restart xezar to turn automations on.`,heading:`h2`})});if(e===`new`)return(0,J.jsx)(uh,{onSaved:()=>{n(`/automations`),p()}});if(e===`edit`){let e=i?.automations.find(e=>e.id===t);return e?(0,J.jsx)(uh,{automation:e,onSaved:()=>{n(`/automations`),p()}}):(0,J.jsx)(fh,{text:`Loading automation…`})}if(e===`log`){let e=i?.automations.find(e=>e.id===t);return t?(0,J.jsx)(lh,{automationId:t,automationName:e?.name}):(0,J.jsx)(fh,{text:`Automation not found.`})}let m=async e=>{l(t=>({...t,[e.id]:`Checking…`}));try{let{checkId:t}=await ft(e.id,`preview`);for(let n=0;n<60;n+=1){let n=await Pe(t);if(n.status===`complete`){l(t=>({...t,[e.id]:`${n.matches??0} match${n.matches===1?``:`es`} found; no tasks launched.`})),p();return}if(n.status===`error`)throw Error(n.error??`Preview failed`);await new Promise(e=>setTimeout(e,500))}throw Error(`Preview is still running`)}catch(t){l(n=>({...n,[e.id]:t instanceof Error?t.message:String(t)}))}};return(0,J.jsx)(dh,{title:`Automations`,subtitle:`Checks run while xezar is open. No webhook or public URL required.`,action:(0,J.jsx)(P,{asChild:!0,children:(0,J.jsxs)(G,{to:`/automations/new`,children:[(0,J.jsx)(so,{}),`New automation`]})}),children:o?(0,J.jsx)(fh,{text:o}):i?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`mb-4 rounded-lg border bg-muted/30 px-4 py-3 text-sm`,children:[(0,J.jsxs)(`span`,{className:`font-medium`,children:[`GitHub `,i.available?`available`:`unavailable`]}),(0,J.jsxs)(`span`,{className:`text-muted-foreground`,children:[` · Scheduler `,i.scheduler.state,i.reason?` · ${i.reason}`:``]})]}),i.automations.length===0?(0,J.jsx)(fh,{text:`No automations yet. Create one paused, test its bounded filter, then enable it from a current-time baseline.`}):(0,J.jsx)(`div`,{className:`grid gap-3`,children:i.automations.map(e=>(0,J.jsxs)(`article`,{className:`rounded-xl border bg-card p-4`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`font-semibold`,children:e.name}),(0,J.jsxs)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:[e.events.join(`, `),` · every `,Math.round(e.intervalSeconds/60),` min`]})]}),(0,J.jsx)(`span`,{className:`rounded-full border px-2 py-1 text-xs`,children:e.enabled?`Enabled`:`Paused`})]}),(0,J.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,J.jsxs)(P,{size:`sm`,variant:`outline`,onClick:()=>void m(e),disabled:c[e.id]===`Checking…`,children:[(0,J.jsx)(lr,{}),`Test filter`]}),(0,J.jsx)(P,{size:`sm`,variant:`outline`,onClick:()=>void Xt(e.id,!e.enabled).then(p),children:e.enabled?`Pause`:`Enable`}),(0,J.jsx)(P,{size:`sm`,variant:`ghost`,asChild:!0,children:(0,J.jsx)(G,{to:`/automations/${e.id}`,children:`Edit`})}),(0,J.jsx)(P,{size:`sm`,variant:`ghost`,asChild:!0,children:(0,J.jsx)(G,{to:`/automations/${e.id}/log`,children:`View log`})})]}),c[e.id]&&(0,J.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,role:`status`,children:c[e.id]})]},e.id))})]}):(0,J.jsx)(fh,{text:`Loading automations…`})})}function lh({automationId:e,automationName:t}){let[n,r]=(0,q.useState)(),[i,a]=(0,q.useState)(``),o=()=>ee(e).then(({records:e})=>r(e)).catch(e=>a(String(e)));return(0,q.useEffect)(()=>{o()},[e]),(0,q.useEffect)(()=>pa((t,n)=>{t===`automation-change`&&n.automationId===e&&o()}),[e]),(0,J.jsx)(dh,{title:`Execution log`,subtitle:t??`Automation activity`,action:(0,J.jsx)(P,{variant:`outline`,asChild:!0,children:(0,J.jsx)(G,{to:`/automations`,children:`Back to automations`})}),children:i?(0,J.jsx)(fh,{text:i}):n?n.length===0?(0,J.jsx)(fh,{text:`No checks have run yet.`}):(0,J.jsx)(`ol`,{className:`grid gap-3`,"aria-label":`Automation execution log`,children:n.map(e=>(0,J.jsxs)(`li`,{className:`rounded-xl border bg-card p-4`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,J.jsx)(`span`,{className:`font-medium capitalize`,children:e.result.replace(`-`,` `)}),(0,J.jsx)(`time`,{className:`text-xs text-muted-foreground`,dateTime:e.ts,children:new Date(e.ts).toLocaleString()})]}),e.reason&&(0,J.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:e.reason}),(e.githubUrl||e.runId)&&(0,J.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-3 text-sm`,children:[e.githubUrl&&(0,J.jsx)(`a`,{className:`underline underline-offset-4`,href:e.githubUrl,target:`_blank`,rel:`noreferrer`,children:e.githubTitle??`GitHub #${e.githubNumber??``}`}),e.runId&&(0,J.jsx)(G,{className:`underline underline-offset-4`,to:`/runs/${e.runId}`,children:`Open task`})]})]},e.seq))}):(0,J.jsx)(fh,{text:`Loading execution log…`})})}function uh({automation:e,onSaved:t}){let[n,r]=(0,q.useState)(e?.name??``),[i,a]=(0,q.useState)(e?.task.prompt??`Review {{github.url}}`),[o,s]=(0,q.useState)(!1),[c,l]=(0,q.useState)(``);return(0,J.jsx)(dh,{title:e?`Edit automation`:`New automation`,subtitle:`Define a bounded GitHub trigger and the ordinary xezar task it launches.`,children:(0,J.jsxs)(`form`,{className:`grid max-w-3xl gap-6`,onSubmit:async r=>{r.preventDefault(),l(``);try{e?await ke(e.id,{name:n,description:e.description,events:e.events,intervalSeconds:e.intervalSeconds,filters:e.filters,task:{...e.task,prompt:i},enabled:e.enabled,expectedRevision:e.revision}):await ie({name:n,events:[`issue.opened`],intervalSeconds:300,filters:{lookbackDays:7,maxRecords:25},task:{prompt:i,workflow:`quick-task`},enable:o}),t()}catch(e){l(String(e))}},children:[(0,J.jsxs)(`fieldset`,{className:`grid gap-4 rounded-xl border p-5`,children:[(0,J.jsx)(`legend`,{className:`px-2 font-semibold`,children:`When GitHub changes`}),(0,J.jsxs)(`div`,{className:`grid gap-2`,children:[(0,J.jsx)(Ys,{htmlFor:`automation-name`,children:`Name`}),(0,J.jsx)(Js,{id:`automation-name`,value:n,onChange:e=>r(e.target.value),required:!0})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,J.jsx)(Na,{className:`size-4`}),`New issue · every 5 minutes · last 7 days · maximum 25 records`]})]}),(0,J.jsxs)(`fieldset`,{className:`grid gap-4 rounded-xl border p-5`,children:[(0,J.jsx)(`legend`,{className:`px-2 font-semibold`,children:`What task to run`}),(0,J.jsxs)(`div`,{className:`grid gap-2`,children:[(0,J.jsx)(Ys,{htmlFor:`automation-prompt`,children:`Prompt`}),(0,J.jsx)(ei,{id:`automation-prompt`,value:i,onChange:e=>a(e.target.value),rows:8,required:!0})]}),(0,J.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Placeholders include `,`{{github.number}}`,`, `,`{{github.title}}`,`, `,`{{github.url}}`,`, and `,`{{github.labels}}`,`. GitHub content is appended as untrusted context.`]})]}),(0,J.jsxs)(`fieldset`,{className:`rounded-xl border p-5`,children:[(0,J.jsx)(`legend`,{className:`px-2 font-semibold`,children:`Review and enable`}),(0,J.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:o,onChange:e=>s(e.target.checked)}),`Save and enable from a current-time baseline (existing matches will not launch)`]})]}),c&&(0,J.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:c}),(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsx)(P,{type:`submit`,children:`Save automation`}),(0,J.jsx)(P,{type:`button`,variant:`outline`,onClick:t,children:`Cancel`})]})]})})}function dh({title:e,subtitle:t,action:n,children:r}){return(0,J.jsxs)(`main`,{className:`mx-auto w-full max-w-6xl p-4 sm:p-6`,children:[(0,J.jsxs)(`header`,{className:`mb-6 flex flex-wrap items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,J.jsx)(mo,{className:`size-5`}),(0,J.jsx)(`h1`,{className:`text-2xl font-semibold`,children:e})]}),(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t})]}),n]}),r]})}function fh({text:e}){return(0,J.jsx)(`div`,{className:`rounded-xl border border-dashed p-8 text-center text-sm text-muted-foreground`,children:e})}var ph=(0,q.lazy)(()=>dn(()=>import(`./task-thread-Bfyqqy-t.js`).then(e=>({default:e.TaskThreadRoute})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36]))),mh=(0,q.lazy)(()=>dn(()=>import(`./compare-variants-SR2zZfZq.js`).then(e=>({default:e.CompareVariantsRoute})),__vite__mapDeps([37,1,2,3,4,5,25,33,29,15,30,13,14,16,17,18,36]))),hh=(0,q.lazy)(()=>dn(()=>import(`./task-changes-DYgNXOyY.js`).then(e=>({default:e.TaskChangesRoute})),__vite__mapDeps([38,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,26,27,28,29,30,31,32,39,23,22,40,41,35,42,25,43,44]))),gh=(0,q.lazy)(()=>dn(()=>import(`./task-files-pKOwSyLh.js`).then(e=>({default:e.TaskFilesRoute})),__vite__mapDeps([45,1,2,3,4,5,25,26,6,7,8,9,10,11,12,13,14,15,16,17,18,27,28,29,30,31,32,43]))),_h=(0,q.lazy)(()=>dn(()=>import(`./task-commits-BRpZSz1G.js`).then(e=>({default:e.TaskCommitsRoute})),__vite__mapDeps([46,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,47,26,27,28,29,30,31,32,39,33,40,41,35,48,34]))),vh=(0,q.lazy)(()=>dn(()=>import(`./repo-git-CJFDMauC.js`).then(e=>({default:e.RepoGitRoute})),__vite__mapDeps([49,1,2,3,4,5,47,8,39,33,12,30,31,40,41,35,32,42,25,28,43,9,11,44,48,34]))),yh=(0,q.lazy)(()=>dn(()=>import(`./github-CFURo9kf.js`).then(e=>({default:e.GithubRoute})),__vite__mapDeps([50,1,2,3,4,5,47,7,8,25,21,15,22,23,51,10,12,30,14,16,17,18,24,40,31,41,35,32]))),bh=(0,q.lazy)(()=>dn(()=>import(`./workflows-BmOehP-A.js`).then(e=>({default:e.WorkflowsRoute})),__vite__mapDeps([52,1,2,3,4,5,19,27,53,10,11,12,44,23,15,24]))),xh=(0,q.lazy)(()=>dn(()=>import(`./skills-Cs-auniL.js`).then(e=>({default:e.SkillsRoute})),__vite__mapDeps([54,1,2,3,4,5,47,7,8,53,51,10,12,22,23,15,30,24])));function Sh(){let e=rn();return(0,J.jsx)(Ci,{to:{pathname:`/skills`,search:e.search,hash:e.hash},replace:!0})}function Ch({sectionId:e}){let t=rn();return(0,J.jsx)(ve,{to:{pathname:Op(`global`,e),search:t.search,hash:t.hash},replace:!0})}function wh(){return(0,J.jsx)(`div`,{"data-route":`scope-resolving`,className:`flex min-h-full flex-col`,children:(0,J.jsx)(`p`,{className:`px-4 py-6 text-center text-xs text-soft-foreground`,children:`Loading…`})})}function Th(){let{projectId:e=``}=je(),t=rn(),n=B(),r=M();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,J.jsx)(ve,{to:`/p/${encodeURIComponent(e)}${n||`/`}${t.search}${t.hash}`,replace:!0})}if(!n.isError)return(0,J.jsx)(wh,{})}if(n.data){if(!(n.data.bootProject===e||n.data.projects.some(t=>t.id===e)))return(0,J.jsx)(ud,{projectId:e,registry:n.data})}else if(!n.isError)return(0,J.jsx)(wh,{});return(0,J.jsx)(Ee,{projectId:n.data?.bootProject===e?null:e,children:(0,J.jsx)(x,{},e)})}function Eh(){let{projectId:e=``}=je();return(0,J.jsx)(Xu,{},e)}function Dh(){let e=rn(),t=M(),n=B(),r=t.data?.bootProject??n.data?.bootProject,i=(t.data!==void 0||t.isError)&&(n.data!==void 0||n.isError);if(r===void 0&&!i)return(0,J.jsx)(wh,{});let a=r??`default`;if(e.pathname===`/`&&e.search===``&&e.hash===``){if(n.data===void 0&&!n.isError)return(0,J.jsx)(wh,{});let e=Wl(Rl(),n.data,r);if(e!==null)return(0,J.jsx)(ve,{to:e,replace:!0})}let o=e.pathname===`/p`||e.pathname===`/p/`?`/`:e.pathname;return(0,J.jsx)(ve,{to:`/p/${encodeURIComponent(a)}${o}${e.search}${e.hash}`,replace:!0})}var Oh=[{pattern:`/`,pageLabel:`Tasks`},{pattern:`/tasks`,pageLabel:`All tasks`},{pattern:`/new`,pageLabel:`New task`},{pattern:`/compare/:groupId`,pageLabel:`Compare`},{pattern:`/git/*`,pageLabel:`Git`},{pattern:`/github/*`,pageLabel:`GitHub`},{pattern:`/automations/*`,pageLabel:`Automations`},{pattern:`/skills`,pageLabel:`Skills`},{pattern:`/inbox`,pageLabel:`Inbox`},{pattern:`/workflows/*`,pageLabel:`Workflows`},{pattern:`/settings/*`,pageLabel:`Settings`}];function kh(e){let t=Si(e),n=we({path:`/tasks/:id/*`,end:!0},t);return n?{pageLabel:null,taskId:n.params.id??null}:{pageLabel:Oh.find(({pattern:e})=>we({path:e,end:!0},t))?.pageLabel??null,taskId:null}}function Ah(){let e=M().data?.capabilities;return(0,J.jsxs)(ue,{children:[(0,J.jsxs)(T,{path:`/p/:projectId`,element:(0,J.jsx)(Th,{}),children:[(0,J.jsx)(T,{index:!0,element:(0,J.jsx)(dm,{})}),(0,J.jsx)(T,{path:`new`,element:(0,J.jsx)(Eh,{})}),(0,J.jsx)(T,{path:`tasks/:id`,element:(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(Un,{}),children:(0,J.jsx)(ph,{})})}),(0,J.jsx)(T,{path:`tasks/:id/changes`,element:(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(fd,{tab:`changes`}),children:(0,J.jsx)(hh,{})})}),(0,J.jsx)(T,{path:`tasks/:id/files`,element:(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(fd,{tab:`files`}),children:(0,J.jsx)(gh,{})})}),(0,J.jsx)(T,{path:`tasks/:id/commits`,element:(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(fd,{tab:`changes`}),children:(0,J.jsx)(_h,{})})}),(0,J.jsx)(T,{path:`tasks/:id/commits/:sha`,element:(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(fd,{tab:`changes`}),children:(0,J.jsx)(_h,{})})}),(0,J.jsx)(T,{path:`compare/:groupId`,element:(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(Kl,{}),children:(0,J.jsx)(mh,{})})}),(0,J.jsx)(T,{path:`git`,element:(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(cd,{}),children:(0,J.jsx)(vh,{tab:`changes`})})}),(0,J.jsx)(T,{path:`git/commits`,element:(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(cd,{}),children:(0,J.jsx)(vh,{tab:`commits`})})}),(0,J.jsx)(T,{path:`git/commits/:sha`,element:(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(cd,{}),children:(0,J.jsx)(vh,{tab:`commits`})})}),(0,J.jsx)(T,{path:`git/branches`,element:(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(cd,{}),children:(0,J.jsx)(vh,{tab:`branches`})})}),(0,J.jsx)(T,{path:`github`,element:(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(ql,{}),children:(0,J.jsx)(yh,{view:`issues`,index:!0})})}),(0,J.jsx)(T,{path:`github/prs`,element:(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(ql,{}),children:(0,J.jsx)(yh,{view:`prs`})})}),(0,J.jsx)(T,{path:`github/issues/:n`,element:(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(ql,{}),children:(0,J.jsx)(yh,{view:`issues`})})}),(0,J.jsx)(T,{path:`github/prs/:n`,element:(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(ql,{}),children:(0,J.jsx)(yh,{view:`prs`})})}),(0,J.jsx)(T,{path:`github/prs/:n/changes`,element:(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(ql,{}),children:(0,J.jsx)(yh,{view:`prs`,changes:!0})})}),(0,J.jsx)(T,{path:`automations`,element:(0,J.jsx)(ch,{})}),(0,J.jsx)(T,{path:`automations/new`,element:(0,J.jsx)(ch,{mode:`new`})}),(0,J.jsx)(T,{path:`automations/:automationId`,element:(0,J.jsx)(ch,{mode:`edit`})}),(0,J.jsx)(T,{path:`automations/:automationId/log`,element:(0,J.jsx)(ch,{mode:`log`})}),(0,J.jsx)(T,{path:`skills`,element:(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(ld,{}),children:(0,J.jsx)(xh,{})})}),(0,J.jsx)(T,{path:`inbox`,element:(0,J.jsx)(nu,{})}),(0,J.jsx)(T,{path:`workflows`,element:(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(dd,{}),children:(0,J.jsx)(bh,{})})}),(0,J.jsx)(T,{path:`workflows/:name`,element:(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(dd,{}),children:(0,J.jsx)(bh,{})})}),(0,J.jsx)(T,{path:`settings`,element:(0,J.jsx)(Pp,{scope:`project`,capabilities:e})}),(0,J.jsx)(T,{path:`settings/skills`,element:(0,J.jsx)(Sh,{})}),vp(`project`,e).map(t=>(0,J.jsx)(T,{path:`settings/${t.id}`,element:(0,J.jsx)(Np,{section:t,scope:`project`,capabilities:e})},t.id)),vp(`global`,e).map(e=>(0,J.jsx)(T,{path:`settings/${e.id}`,element:(0,J.jsx)(Ch,{sectionId:e.id})},e.id)),(0,J.jsx)(T,{path:`*`,element:(0,J.jsx)(sd,{})})]}),(0,J.jsx)(T,{path:`/tasks`,element:(0,J.jsx)(qm,{})}),(0,J.jsx)(T,{path:`/settings/global`,element:(0,J.jsx)(Pp,{scope:`global`,capabilities:e})}),vp(`global`,e).map(t=>(0,J.jsx)(T,{path:Op(`global`,t.id),element:(0,J.jsx)(Np,{section:t,scope:`global`,capabilities:e})},t.id)),(0,J.jsx)(T,{path:`*`,element:(0,J.jsx)(Dh,{})})]})}function jh(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 Mh(e){return e?.available===!0&&(e.status===`available`||e.status===`error`)}function Nh({children:e}){let{pathname:t}=rn(),n=wi(),r=M(),i=r.data?.capabilities.followups===!0,a=r.data?.capabilities.automations===!0,o=d(i),s=Mh(an(n??``,n!==null).data),c=ye(),l=B().data,u=kh(t),f=l?.bootProject??r.data?.bootProject??null,p=n!==null&&n===f,m=l?.projects.find(e=>e.id===n),h=vt(n??``,m!==void 0&&u.taskId!==null,l?.bootProject===n).data,g=t===`/settings/global`||t.startsWith(`/settings/global/`)?null:m?.name??(p?jh(r.data)?.name??null:null),_=u.taskId?h?.find(e=>e.id===u.taskId):void 0;Il({projectName:g,pageLabel:_?N(_):u.pageLabel});let v=l&&l.projects.length>1?l:null;return(0,J.jsxs)(Qc,{children:[(0,J.jsx)(zc,{repo:jh(r.data),version:r.data?.version??null,latestVersion:r.data?.latestVersion??null,inboxCount:o.data?.length??null,unreadCount:c.data?pn(c.data):null,skillsUpdateAvailable:s,forgeAvailable:r.data?.forge?.available===!0,inboxAvailable:i,automationsAvailable:a,banner:(0,J.jsx)(sl,{}),singleProject:r.data?.capabilities.singleProject===!0,taskQuickList:(0,J.jsx)(gl,{}),projectGroups:v?(0,J.jsx)(wl,{projects:v.projects,bootProjectId:v.bootProject,inboxAvailable:i,automationsAvailable:a,inboxCount:o.data?.length??null,skillsUpdateAvailable:s}):void 0,toolsMenu:(0,J.jsx)(jl,{health:r.data}),children:e}),(0,J.jsx)(Dc,{})]})}function Ph(){let e=rn(),t=B();return(0,q.useEffect)(()=>{let n=Ul(e,t.data);n!==null&&(Gl(Rl(),n)||zl(n))},[e.hash,e.pathname,e.search,t.data]),null}function Fh(){let e=R(),t=Pf(ce().data?.notifications).enabled,n=(0,q.useRef)(t);n.current=t;let r=(0,q.useRef)(new Map);return(0,q.useEffect)(()=>{let t=Ct(L.runs.list()),i=e=>{let{entering:t,statuses:i}=If(r.current,e);if(r.current=i,t.length!==0&&Lf({enabled:n.current,hidden:document.visibilityState===`hidden`,permission:Ff()}))for(let e of t)Ih(e)};return i(e.getQueryData(L.runs.list())),e.getQueryCache().subscribe(e=>{e.query.queryHash!==t||e.type!==`updated`||i(e.query.state.data)})},[e]),null}function Ih(e){let t=globalThis.Notification;if(typeof t!=`function`)return;let n=Rf(e);try{new t(n.title,{body:n.body,tag:n.tag})}catch{}}function Lh(){let[e]=(0,q.useState)(Ta);return(0,J.jsx)(D,{client:e,children:(0,J.jsxs)(xa,{children:[(0,J.jsx)(Fh,{}),(0,J.jsx)(pc,{children:(0,J.jsx)(bf,{children:(0,J.jsxs)(pt,{children:[(0,J.jsx)(Ph,{}),(0,J.jsx)(jn,{children:(0,J.jsx)(Nh,{children:(0,J.jsx)(Ah,{})})}),(0,J.jsx)(At,{})]})})})]})})}function Rh(){return(document.querySelector(`meta[name="xez-api-base"]`)?.getAttribute(`content`))?.trim()||``}un(Rh());var zh=document.getElementById(`root`);if(!zh)throw Error(`xezar: #root container is missing from index.html`);(0,Qi.createRoot)(zh).render((0,J.jsx)(q.StrictMode,{children:(0,J.jsx)(Lh,{})}));export{Ba as S,mo as _,cd as a,qa as b,wu as c,Xl as d,Jl as f,Js as g,Zs as h,dd as i,Ql as l,Kl as m,pd as n,Tu as o,ql as p,fd as r,Eu as s,Mf as t,Zl as u,co as v,Ka as x,so as y};