commandmate 0.12.1 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (221) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-build-manifest.json +157 -157
  3. package/.next/app-path-routes-manifest.json +29 -29
  4. package/.next/build-manifest.json +2 -2
  5. package/.next/prerender-manifest.json +9 -9
  6. package/.next/required-server-files.json +1 -1
  7. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  8. package/.next/server/app/api/app/update/route_client-reference-manifest.js +1 -1
  9. package/.next/server/app/api/app/update-check/route.js +1 -1
  10. package/.next/server/app/api/app/update-check/route_client-reference-manifest.js +1 -1
  11. package/.next/server/app/api/assistant/conversation/route_client-reference-manifest.js +1 -1
  12. package/.next/server/app/api/assistant/current-output/route_client-reference-manifest.js +1 -1
  13. package/.next/server/app/api/assistant/messages/route_client-reference-manifest.js +1 -1
  14. package/.next/server/app/api/assistant/session/route_client-reference-manifest.js +1 -1
  15. package/.next/server/app/api/assistant/start/route_client-reference-manifest.js +1 -1
  16. package/.next/server/app/api/assistant/terminal/route_client-reference-manifest.js +1 -1
  17. package/.next/server/app/api/assistant/tools/route_client-reference-manifest.js +1 -1
  18. package/.next/server/app/api/auth/login/route_client-reference-manifest.js +1 -1
  19. package/.next/server/app/api/auth/logout/route_client-reference-manifest.js +1 -1
  20. package/.next/server/app/api/auth/status/route_client-reference-manifest.js +1 -1
  21. package/.next/server/app/api/daily-summary/route.js +1 -1
  22. package/.next/server/app/api/daily-summary/route.js.nft.json +1 -1
  23. package/.next/server/app/api/daily-summary/route_client-reference-manifest.js +1 -1
  24. package/.next/server/app/api/daily-summary/status/route.js +1 -1
  25. package/.next/server/app/api/daily-summary/status/route.js.nft.json +1 -1
  26. package/.next/server/app/api/daily-summary/status/route_client-reference-manifest.js +1 -1
  27. package/.next/server/app/api/external-apps/[id]/health/route_client-reference-manifest.js +1 -1
  28. package/.next/server/app/api/external-apps/[id]/route_client-reference-manifest.js +1 -1
  29. package/.next/server/app/api/external-apps/route_client-reference-manifest.js +1 -1
  30. package/.next/server/app/api/hooks/claude-done/route_client-reference-manifest.js +1 -1
  31. package/.next/server/app/api/ollama/models/route_client-reference-manifest.js +1 -1
  32. package/.next/server/app/api/push/subscriptions/route_client-reference-manifest.js +1 -1
  33. package/.next/server/app/api/push/vapid/route_client-reference-manifest.js +1 -1
  34. package/.next/server/app/api/repositories/[id]/route_client-reference-manifest.js +1 -1
  35. package/.next/server/app/api/repositories/[id]/todos/[todoId]/route_client-reference-manifest.js +1 -1
  36. package/.next/server/app/api/repositories/[id]/todos/route_client-reference-manifest.js +1 -1
  37. package/.next/server/app/api/repositories/clone/[jobId]/route.js +1 -1
  38. package/.next/server/app/api/repositories/clone/[jobId]/route.js.nft.json +1 -1
  39. package/.next/server/app/api/repositories/clone/[jobId]/route_client-reference-manifest.js +1 -1
  40. package/.next/server/app/api/repositories/clone/route.js +1 -1
  41. package/.next/server/app/api/repositories/clone/route.js.nft.json +1 -1
  42. package/.next/server/app/api/repositories/clone/route_client-reference-manifest.js +1 -1
  43. package/.next/server/app/api/repositories/excluded/route_client-reference-manifest.js +1 -1
  44. package/.next/server/app/api/repositories/restore/route_client-reference-manifest.js +1 -1
  45. package/.next/server/app/api/repositories/route_client-reference-manifest.js +1 -1
  46. package/.next/server/app/api/repositories/scan/route_client-reference-manifest.js +1 -1
  47. package/.next/server/app/api/repositories/sync/route_client-reference-manifest.js +1 -1
  48. package/.next/server/app/api/sidebar/group-order/route_client-reference-manifest.js +1 -1
  49. package/.next/server/app/api/skills/[id]/route_client-reference-manifest.js +1 -1
  50. package/.next/server/app/api/skills/route_client-reference-manifest.js +1 -1
  51. package/.next/server/app/api/slash-commands/route.js +1 -1
  52. package/.next/server/app/api/slash-commands/route.js.nft.json +1 -1
  53. package/.next/server/app/api/slash-commands/route_client-reference-manifest.js +1 -1
  54. package/.next/server/app/api/templates/[id]/route_client-reference-manifest.js +1 -1
  55. package/.next/server/app/api/templates/route_client-reference-manifest.js +1 -1
  56. package/.next/server/app/api/todos/route_client-reference-manifest.js +1 -1
  57. package/.next/server/app/api/worktrees/[id]/auto-yes/route_client-reference-manifest.js +1 -1
  58. package/.next/server/app/api/worktrees/[id]/capture/route_client-reference-manifest.js +1 -1
  59. package/.next/server/app/api/worktrees/[id]/cli-tool/route_client-reference-manifest.js +1 -1
  60. package/.next/server/app/api/worktrees/[id]/cmate/schedules/route_client-reference-manifest.js +1 -1
  61. package/.next/server/app/api/worktrees/[id]/current-output/route_client-reference-manifest.js +1 -1
  62. package/.next/server/app/api/worktrees/[id]/execution-logs/[logId]/route_client-reference-manifest.js +1 -1
  63. package/.next/server/app/api/worktrees/[id]/execution-logs/route_client-reference-manifest.js +1 -1
  64. package/.next/server/app/api/worktrees/[id]/files/[...path]/route_client-reference-manifest.js +1 -1
  65. package/.next/server/app/api/worktrees/[id]/git/branch/create/route.js +1 -1
  66. package/.next/server/app/api/worktrees/[id]/git/branch/create/route.js.nft.json +1 -1
  67. package/.next/server/app/api/worktrees/[id]/git/branch/create/route_client-reference-manifest.js +1 -1
  68. package/.next/server/app/api/worktrees/[id]/git/branch/delete/route.js +1 -1
  69. package/.next/server/app/api/worktrees/[id]/git/branch/delete/route.js.nft.json +1 -1
  70. package/.next/server/app/api/worktrees/[id]/git/branch/delete/route_client-reference-manifest.js +1 -1
  71. package/.next/server/app/api/worktrees/[id]/git/branches/route.js +1 -1
  72. package/.next/server/app/api/worktrees/[id]/git/branches/route.js.nft.json +1 -1
  73. package/.next/server/app/api/worktrees/[id]/git/branches/route_client-reference-manifest.js +1 -1
  74. package/.next/server/app/api/worktrees/[id]/git/checkout/route.js +1 -1
  75. package/.next/server/app/api/worktrees/[id]/git/checkout/route.js.nft.json +1 -1
  76. package/.next/server/app/api/worktrees/[id]/git/checkout/route_client-reference-manifest.js +1 -1
  77. package/.next/server/app/api/worktrees/[id]/git/commit/route.js +1 -1
  78. package/.next/server/app/api/worktrees/[id]/git/commit/route.js.nft.json +1 -1
  79. package/.next/server/app/api/worktrees/[id]/git/commit/route_client-reference-manifest.js +1 -1
  80. package/.next/server/app/api/worktrees/[id]/git/diff/route.js +1 -1
  81. package/.next/server/app/api/worktrees/[id]/git/diff/route.js.nft.json +1 -1
  82. package/.next/server/app/api/worktrees/[id]/git/diff/route_client-reference-manifest.js +1 -1
  83. package/.next/server/app/api/worktrees/[id]/git/fetch/route.js +1 -1
  84. package/.next/server/app/api/worktrees/[id]/git/fetch/route.js.nft.json +1 -1
  85. package/.next/server/app/api/worktrees/[id]/git/fetch/route_client-reference-manifest.js +1 -1
  86. package/.next/server/app/api/worktrees/[id]/git/log/route.js +1 -1
  87. package/.next/server/app/api/worktrees/[id]/git/log/route.js.nft.json +1 -1
  88. package/.next/server/app/api/worktrees/[id]/git/log/route_client-reference-manifest.js +1 -1
  89. package/.next/server/app/api/worktrees/[id]/git/pull/route.js +1 -1
  90. package/.next/server/app/api/worktrees/[id]/git/pull/route.js.nft.json +1 -1
  91. package/.next/server/app/api/worktrees/[id]/git/pull/route_client-reference-manifest.js +1 -1
  92. package/.next/server/app/api/worktrees/[id]/git/push/route.js +1 -1
  93. package/.next/server/app/api/worktrees/[id]/git/push/route.js.nft.json +1 -1
  94. package/.next/server/app/api/worktrees/[id]/git/push/route_client-reference-manifest.js +1 -1
  95. package/.next/server/app/api/worktrees/[id]/git/reset/route.js +1 -1
  96. package/.next/server/app/api/worktrees/[id]/git/reset/route.js.nft.json +1 -1
  97. package/.next/server/app/api/worktrees/[id]/git/reset/route_client-reference-manifest.js +1 -1
  98. package/.next/server/app/api/worktrees/[id]/git/revert/route.js +1 -1
  99. package/.next/server/app/api/worktrees/[id]/git/revert/route.js.nft.json +1 -1
  100. package/.next/server/app/api/worktrees/[id]/git/revert/route_client-reference-manifest.js +1 -1
  101. package/.next/server/app/api/worktrees/[id]/git/show/[commitHash]/route.js +1 -1
  102. package/.next/server/app/api/worktrees/[id]/git/show/[commitHash]/route.js.nft.json +1 -1
  103. package/.next/server/app/api/worktrees/[id]/git/show/[commitHash]/route_client-reference-manifest.js +1 -1
  104. package/.next/server/app/api/worktrees/[id]/git/stage/route.js +1 -1
  105. package/.next/server/app/api/worktrees/[id]/git/stage/route.js.nft.json +1 -1
  106. package/.next/server/app/api/worktrees/[id]/git/stage/route_client-reference-manifest.js +1 -1
  107. package/.next/server/app/api/worktrees/[id]/git/staged/route.js +1 -1
  108. package/.next/server/app/api/worktrees/[id]/git/staged/route.js.nft.json +1 -1
  109. package/.next/server/app/api/worktrees/[id]/git/staged/route_client-reference-manifest.js +1 -1
  110. package/.next/server/app/api/worktrees/[id]/git/stash/[index]/route.js +1 -1
  111. package/.next/server/app/api/worktrees/[id]/git/stash/[index]/route.js.nft.json +1 -1
  112. package/.next/server/app/api/worktrees/[id]/git/stash/[index]/route_client-reference-manifest.js +1 -1
  113. package/.next/server/app/api/worktrees/[id]/git/stash/apply/route.js +1 -1
  114. package/.next/server/app/api/worktrees/[id]/git/stash/apply/route.js.nft.json +1 -1
  115. package/.next/server/app/api/worktrees/[id]/git/stash/apply/route_client-reference-manifest.js +1 -1
  116. package/.next/server/app/api/worktrees/[id]/git/stash/pop/route.js +1 -1
  117. package/.next/server/app/api/worktrees/[id]/git/stash/pop/route.js.nft.json +1 -1
  118. package/.next/server/app/api/worktrees/[id]/git/stash/pop/route_client-reference-manifest.js +1 -1
  119. package/.next/server/app/api/worktrees/[id]/git/stash/push/route.js +1 -1
  120. package/.next/server/app/api/worktrees/[id]/git/stash/push/route.js.nft.json +1 -1
  121. package/.next/server/app/api/worktrees/[id]/git/stash/push/route_client-reference-manifest.js +1 -1
  122. package/.next/server/app/api/worktrees/[id]/git/stash/route.js +1 -1
  123. package/.next/server/app/api/worktrees/[id]/git/stash/route.js.nft.json +1 -1
  124. package/.next/server/app/api/worktrees/[id]/git/stash/route_client-reference-manifest.js +1 -1
  125. package/.next/server/app/api/worktrees/[id]/git/status/route.js +1 -1
  126. package/.next/server/app/api/worktrees/[id]/git/status/route.js.nft.json +1 -1
  127. package/.next/server/app/api/worktrees/[id]/git/status/route_client-reference-manifest.js +1 -1
  128. package/.next/server/app/api/worktrees/[id]/git/unstage/route.js +1 -1
  129. package/.next/server/app/api/worktrees/[id]/git/unstage/route.js.nft.json +1 -1
  130. package/.next/server/app/api/worktrees/[id]/git/unstage/route_client-reference-manifest.js +1 -1
  131. package/.next/server/app/api/worktrees/[id]/git/working-diff/route.js +1 -1
  132. package/.next/server/app/api/worktrees/[id]/git/working-diff/route.js.nft.json +1 -1
  133. package/.next/server/app/api/worktrees/[id]/git/working-diff/route_client-reference-manifest.js +1 -1
  134. package/.next/server/app/api/worktrees/[id]/interrupt/route_client-reference-manifest.js +1 -1
  135. package/.next/server/app/api/worktrees/[id]/kill-session/route_client-reference-manifest.js +1 -1
  136. package/.next/server/app/api/worktrees/[id]/logs/[filename]/route_client-reference-manifest.js +1 -1
  137. package/.next/server/app/api/worktrees/[id]/logs/route_client-reference-manifest.js +1 -1
  138. package/.next/server/app/api/worktrees/[id]/marp-render/route.js +1 -1
  139. package/.next/server/app/api/worktrees/[id]/marp-render/route_client-reference-manifest.js +1 -1
  140. package/.next/server/app/api/worktrees/[id]/memos/[memoId]/route_client-reference-manifest.js +1 -1
  141. package/.next/server/app/api/worktrees/[id]/memos/route_client-reference-manifest.js +1 -1
  142. package/.next/server/app/api/worktrees/[id]/messages/route_client-reference-manifest.js +1 -1
  143. package/.next/server/app/api/worktrees/[id]/prompt-response/route_client-reference-manifest.js +1 -1
  144. package/.next/server/app/api/worktrees/[id]/respond/route_client-reference-manifest.js +1 -1
  145. package/.next/server/app/api/worktrees/[id]/route.js +1 -1
  146. package/.next/server/app/api/worktrees/[id]/route.js.nft.json +1 -1
  147. package/.next/server/app/api/worktrees/[id]/route_client-reference-manifest.js +1 -1
  148. package/.next/server/app/api/worktrees/[id]/schedules/[scheduleId]/route_client-reference-manifest.js +1 -1
  149. package/.next/server/app/api/worktrees/[id]/schedules/active/route_client-reference-manifest.js +1 -1
  150. package/.next/server/app/api/worktrees/[id]/schedules/route_client-reference-manifest.js +1 -1
  151. package/.next/server/app/api/worktrees/[id]/search/route_client-reference-manifest.js +1 -1
  152. package/.next/server/app/api/worktrees/[id]/send/route.js +1 -1
  153. package/.next/server/app/api/worktrees/[id]/send/route.js.nft.json +1 -1
  154. package/.next/server/app/api/worktrees/[id]/send/route_client-reference-manifest.js +1 -1
  155. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/install/route_client-reference-manifest.js +1 -1
  156. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/plan/route_client-reference-manifest.js +1 -1
  157. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/uninstall/route_client-reference-manifest.js +1 -1
  158. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/uninstall-plan/route_client-reference-manifest.js +1 -1
  159. package/.next/server/app/api/worktrees/[id]/skills/route_client-reference-manifest.js +1 -1
  160. package/.next/server/app/api/worktrees/[id]/slash-commands/route.js +1 -1
  161. package/.next/server/app/api/worktrees/[id]/slash-commands/route.js.nft.json +1 -1
  162. package/.next/server/app/api/worktrees/[id]/slash-commands/route_client-reference-manifest.js +1 -1
  163. package/.next/server/app/api/worktrees/[id]/special-keys/route_client-reference-manifest.js +1 -1
  164. package/.next/server/app/api/worktrees/[id]/start-polling/route_client-reference-manifest.js +1 -1
  165. package/.next/server/app/api/worktrees/[id]/terminal/route_client-reference-manifest.js +1 -1
  166. package/.next/server/app/api/worktrees/[id]/timers/history/route_client-reference-manifest.js +1 -1
  167. package/.next/server/app/api/worktrees/[id]/timers/route_client-reference-manifest.js +1 -1
  168. package/.next/server/app/api/worktrees/[id]/todos/[todoId]/route_client-reference-manifest.js +1 -1
  169. package/.next/server/app/api/worktrees/[id]/todos/route_client-reference-manifest.js +1 -1
  170. package/.next/server/app/api/worktrees/[id]/tree/[...path]/route_client-reference-manifest.js +1 -1
  171. package/.next/server/app/api/worktrees/[id]/tree/route_client-reference-manifest.js +1 -1
  172. package/.next/server/app/api/worktrees/[id]/upload/[...path]/route_client-reference-manifest.js +1 -1
  173. package/.next/server/app/api/worktrees/[id]/viewed/route_client-reference-manifest.js +1 -1
  174. package/.next/server/app/api/worktrees/route_client-reference-manifest.js +1 -1
  175. package/.next/server/app/chat/page_client-reference-manifest.js +1 -1
  176. package/.next/server/app/login/page_client-reference-manifest.js +1 -1
  177. package/.next/server/app/manifest.webmanifest/route_client-reference-manifest.js +1 -1
  178. package/.next/server/app/more/page_client-reference-manifest.js +1 -1
  179. package/.next/server/app/offline/page_client-reference-manifest.js +1 -1
  180. package/.next/server/app/page.js +1 -1
  181. package/.next/server/app/page_client-reference-manifest.js +1 -1
  182. package/.next/server/app/proxy/[...path]/route_client-reference-manifest.js +1 -1
  183. package/.next/server/app/repositories/page.js +1 -1
  184. package/.next/server/app/repositories/page_client-reference-manifest.js +1 -1
  185. package/.next/server/app/review/page_client-reference-manifest.js +1 -1
  186. package/.next/server/app/sessions/page_client-reference-manifest.js +1 -1
  187. package/.next/server/app/skills/[skillId]/page_client-reference-manifest.js +1 -1
  188. package/.next/server/app/skills/page_client-reference-manifest.js +1 -1
  189. package/.next/server/app/worktrees/[id]/files/[...path]/page_client-reference-manifest.js +1 -1
  190. package/.next/server/app/worktrees/[id]/page.js +3 -3
  191. package/.next/server/app/worktrees/[id]/page_client-reference-manifest.js +1 -1
  192. package/.next/server/app/worktrees/[id]/terminal/page_client-reference-manifest.js +1 -1
  193. package/.next/server/app-paths-manifest.json +29 -29
  194. package/.next/server/chunks/186.js +1 -1
  195. package/.next/server/chunks/2119.js +1 -1
  196. package/.next/server/chunks/2404.js +2 -1
  197. package/.next/server/chunks/2445.js +1 -1
  198. package/.next/server/chunks/3270.js +1 -1
  199. package/.next/server/chunks/3543.js +1 -1
  200. package/.next/server/chunks/3945.js +1 -1
  201. package/.next/server/chunks/5381.js +1 -1
  202. package/.next/server/chunks/5959.js +1 -1
  203. package/.next/server/chunks/6130.js +1 -1
  204. package/.next/server/chunks/9123.js +1 -1
  205. package/.next/server/chunks/9192.js +1 -0
  206. package/.next/server/middleware-manifest.json +5 -5
  207. package/.next/server/pages/500.html +1 -1
  208. package/.next/server/server-reference-manifest.json +1 -1
  209. package/.next/static/chunks/1668-e703b8b55775844b.js +1 -0
  210. package/.next/static/chunks/{6488-624d4b6d2d4cc236.js → 6488-1a37ccee1d444c10.js} +1 -1
  211. package/.next/static/chunks/app/page-a34d26812f085b6c.js +1 -0
  212. package/.next/static/chunks/app/repositories/{page-75f0d70452c6b6c0.js → page-70d4b997492884b8.js} +1 -1
  213. package/.next/static/chunks/app/worktrees/[id]/page-f2801662a721faab.js +1 -0
  214. package/.next/trace +11 -11
  215. package/package.json +3 -2
  216. package/.next/server/chunks/5312.js +0 -1
  217. package/.next/static/chunks/1668-7484081c45a44f89.js +0 -1
  218. package/.next/static/chunks/app/page-af457ca5876ed616.js +0 -1
  219. package/.next/static/chunks/app/worktrees/[id]/page-7dd929bfc978742e.js +0 -1
  220. /package/.next/static/{ZYti9g9gICKnjtmkfvvB2 → Etea8LidpB8eWOTac-R8b}/_buildManifest.js +0 -0
  221. /package/.next/static/{ZYti9g9gICKnjtmkfvvB2 → Etea8LidpB8eWOTac-R8b}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1668],{34380:(e,s,l)=>{l.d(s,{B:()=>T});var t=l(95155),n=l(12115),a=l(18955),r=l(744),i=l(54014),d=l(74385),o=l(37381);function c(e){var s,l,t,n,a;let r=e.agentInstances&&e.agentInstances.length>0?e.agentInstances.map(e=>e.alias||e.cliTool):null!=(l=e.selectedAgents)?l:e.cliToolId?[e.cliToolId]:[];return{id:e.id,name:e.name,repositoryName:null!=(t=e.repositoryDisplayName)?t:e.repositoryName,syncedBranch:null!=(n=e.branch)?n:null,liveBranch:null!=(a=null==(s=e.gitStatus)?void 0:s.currentBranch)?a:null,dirty:e.gitStatus?e.gitStatus.isDirty:null,agents:[...new Set(r)],sessionRunning:!0===e.isSessionRunning}}let u={status:"loading",options:[]};async function x(e){let s=await fetch("/api/worktrees",{signal:e,headers:{Accept:"application/json"}});if(!s.ok)throw Error("HTTP ".concat(s.status));let l=await s.json(),t=null==l?void 0:l.worktrees;if(!Array.isArray(t))throw Error("Malformed worktree list");return t.map(c)}function m(e){let{selectedWorktreeId:s,onSelect:l,disabled:i=!1}=e,d=(0,a.c)("skills"),[c,m]=(0,n.useState)(u),[g,h]=(0,n.useState)(0);(0,n.useEffect)(()=>{let e=new AbortController;return m(u),x(e.signal).then(s=>{e.signal.aborted||m({status:"loaded",options:s})}).catch(()=>{e.signal.aborted||m({status:"error",options:[]})}),()=>e.abort()},[g]);let k=(0,n.useCallback)(()=>h(e=>e+1),[]);return"loading"===c.status?(0,t.jsxs)("div",{className:"space-y-2","data-testid":"skill-target-loading",children:[(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:d("target.loading")}),(0,t.jsx)(r.EA,{className:"h-24 w-full rounded-lg"})]}):"error"===c.status?(0,t.jsxs)(r.Zp,{className:"space-y-3","data-testid":"skill-target-error",children:[(0,t.jsx)(o.u,{tone:"danger",children:d("target.errorNotice")}),(0,t.jsx)(r.$n,{variant:"secondary",size:"sm",onClick:k,"data-testid":"skill-target-retry",children:d("target.retry")})]}):0===c.options.length?(0,t.jsx)(r.Zp,{"data-testid":"skill-target-empty",children:(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:d("target.empty")})}):(0,t.jsxs)("div",{className:"space-y-3","data-testid":"skill-target-selector",children:[(0,t.jsx)("div",{role:"radiogroup","aria-label":d("target.heading"),className:"space-y-2",children:c.options.map(e=>(0,t.jsx)(p,{option:e,selected:e.id===s,disabled:i,onSelect:l},e.id))}),(0,t.jsx)(o.u,{tone:"neutral","data-testid":"skill-target-branch-notice",children:d("target.branchFreshnessNotice")})]})}function p(e){var s;let{option:l,selected:n,disabled:i,onSelect:d}=e,o=(0,a.c)("skills"),c=null!=(s=l.liveBranch)?s:l.syncedBranch;return(0,t.jsxs)("button",{type:"button",role:"radio","aria-checked":n,disabled:i,onClick:()=>d(l.id),"data-testid":"skill-target-option-".concat(l.id),className:"w-full rounded-lg border px-3 py-2.5 text-left transition-colors disabled:cursor-not-allowed disabled:opacity-60 ".concat(n?"border-accent-500 bg-accent-50 dark:bg-accent-950/40":"border-border bg-card hover:bg-muted"),children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)("span",{className:"text-sm font-semibold text-foreground break-all",children:l.name}),n&&(0,t.jsx)(r.Ex,{variant:"info",children:o("target.selected")})]}),(0,t.jsxs)("dl",{className:"mt-1.5 grid grid-cols-1 gap-x-4 gap-y-1 sm:grid-cols-2",children:[(0,t.jsx)(g,{label:o("target.repository"),children:l.repositoryName}),(0,t.jsx)(g,{label:o("target.branch"),children:null!=c?c:o("target.branchUnknown")}),(0,t.jsx)(g,{label:o("target.agents"),children:l.agents.length>0?l.agents.join(", "):o("target.agentsNone")}),(0,t.jsx)(g,{label:o("target.workingTree"),children:o(null===l.dirty?"target.workingTreeUnknown":l.dirty?"target.workingTreeDirty":"target.workingTreeClean")})]}),l.sessionRunning&&(0,t.jsx)("p",{className:"mt-1.5 text-xs text-muted-foreground","data-testid":"skill-target-session-".concat(l.id),children:o("target.sessionRunning")})]})}function g(e){let{label:s,children:l}=e;return(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("dt",{className:"text-xs font-medium text-muted-foreground",children:s}),(0,t.jsx)("dd",{className:"text-xs text-foreground break-words",children:l})]})}var h=l(95584);function k(e){let{label:s,children:l}=e;return(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("dt",{className:"text-xs font-medium text-muted-foreground",children:s}),(0,t.jsx)("dd",{className:"mt-0.5 break-words text-sm text-foreground",children:l})]})}function f(e){let{level:s,kind:l,label:n}=e,i=(0,a.c)("skills");return(0,t.jsxs)(r.Ex,{variant:h.eK[s],"data-testid":"skill-plan-risk-".concat(l,"-").concat(s),children:[n,": ",i(h.pP[s])]})}function j(e){let{entry:s}=e,l=(0,a.c)("skills"),n=h.KL[s.reason];return(0,t.jsxs)("li",{className:"space-y-1.5 rounded-md border border-border px-3 py-2","data-testid":"skill-plan-file-".concat(s.path),children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)(r.Ex,{variant:h.tC[s.change],children:l(h.AS[s.change])}),(0,t.jsx)("span",{className:"break-all font-mono text-xs text-foreground",children:s.path}),s.generated&&(0,t.jsx)(r.Ex,{variant:"gray",children:l("plan.fileGenerated")})]}),n&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:l(n)}),s.gitIgnored&&(0,t.jsx)("p",{className:"text-xs text-warning-foreground",children:l("plan.gitIgnored")}),s.binary?(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:l("plan.diffBinary")}):s.diff?(0,t.jsxs)("details",{children:[(0,t.jsx)("summary",{className:"cursor-pointer text-xs text-accent-600 dark:text-accent-400",children:l("plan.diffToggle",{additions:s.additions,deletions:s.deletions})}),(0,t.jsx)("pre",{className:"mt-1 overflow-x-auto rounded bg-muted p-2 font-mono text-[11px] leading-snug text-foreground",children:s.diff}),s.diffTruncated&&(0,t.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:l("plan.diffTruncated")})]}):null]})}function b(e){var s,l,n;let{plan:i}=e,d=(0,a.c)("skills"),{target:c,skill:u}=i,x=u.compatibility.commandmate;return(0,t.jsxs)(r.Zp,{className:"space-y-4","data-testid":"skill-install-plan",children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:d("plan.heading")}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:d("plan.expiresAt",{timestamp:i.expiresAt})})]}),(0,t.jsxs)("section",{className:"space-y-2",children:[(0,t.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:d("plan.targetHeading")}),(0,t.jsxs)("dl",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[(0,t.jsx)(k,{label:d("target.repository"),children:c.repositoryName}),(0,t.jsx)(k,{label:d("target.heading"),children:c.worktreeName}),(0,t.jsx)(k,{label:d("target.branch"),children:null!=(s=c.branch)?s:d("target.branchUnknown")}),(0,t.jsx)(k,{label:d("plan.headStateLabel"),children:d(null!=(l=h.kF[c.headState])?l:"plan.headState.unknown")}),(0,t.jsx)(k,{label:d("target.workingTree"),children:c.workingTreeDirty?d("target.workingTreeDirty"):d("target.workingTreeClean")}),(0,t.jsx)(k,{label:d("plan.installRoot"),children:(0,t.jsx)("span",{className:"break-all font-mono text-xs",children:(c.installRoots&&c.installRoots.length>0?c.installRoots:[c.installRoot]).map(e=>(0,t.jsx)("span",{className:"block",children:e},e))})}),(0,t.jsx)(k,{label:d("plan.existingInstall"),children:c.existingInstall?d("plan.existingInstallVersion",{version:c.existingInstall.version}):d("plan.existingInstallNone")}),(0,t.jsx)(k,{label:d("detail.recommendedVersion"),children:(0,t.jsx)("span",{className:"font-mono text-xs",children:u.version})})]})]}),(0,t.jsxs)("section",{className:"space-y-2","data-testid":"skill-plan-risk-section",children:[(0,t.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:d("plan.riskHeading")}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[(0,t.jsx)(f,{level:u.declaredRisk,kind:"declared",label:d("plan.riskDeclared")}),(0,t.jsx)(f,{level:u.computedRisk,kind:"computed",label:d("plan.riskComputed")}),(0,t.jsx)(f,{level:u.effectiveRisk,kind:"effective",label:d("plan.riskEffective")})]}),(0,t.jsx)("p",{className:"break-words text-sm text-foreground",children:u.riskRationale}),(0,t.jsx)(o.u,{tone:"neutral",children:d("plan.riskNotice")})]}),(0,t.jsxs)("section",{className:"space-y-2","data-testid":"skill-plan-permissions",children:[(0,t.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:d("permissions.heading")}),u.declaredPermissions.length>0?(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:u.declaredPermissions.map(e=>(0,t.jsx)(r.Ex,{variant:"warning",children:h.z2[e]?d(h.z2[e]):e},e))}):(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:d("plan.permissionsNone")}),(0,t.jsx)(o.u,{tone:"warning",children:d("permissions.declarationOnlyNotice")})]}),(0,t.jsxs)("section",{className:"space-y-2","data-testid":"skill-plan-requirements",children:[(0,t.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:d("requirements.heading")}),0===u.requirements.commands.length&&0===u.requirements.networkHosts.length?(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:d("plan.requirementsNone")}):(0,t.jsxs)("dl",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[u.requirements.commands.length>0&&(0,t.jsx)(k,{label:d("plan.requirementsCommands"),children:u.requirements.commands.map(e=>{var s;return"".concat(e.name," ").concat(null!=(s=e.versionRange)?s:d("plan.commandAnyVersion"))}).join(", ")}),u.requirements.networkHosts.length>0&&(0,t.jsx)(k,{label:d("plan.requirementsHosts"),children:u.requirements.networkHosts.join(", ")})]})]}),(0,t.jsxs)("section",{className:"space-y-2","data-testid":"skill-plan-scripts",children:[(0,t.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:d("plan.scriptsHeading")}),0===u.executablePaths.length&&0===u.scriptPaths.length?(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:d("plan.scriptsNone")}):(0,t.jsx)("ul",{className:"space-y-1",children:[...new Set([...u.scriptPaths,...u.executablePaths])].map(e=>(0,t.jsx)("li",{className:"break-all font-mono text-xs text-foreground",children:e},e))})]}),"compatible"!==x.status&&(0,t.jsx)(o.u,{tone:"warning","data-testid":"skill-plan-compatibility-notice",children:d((0,h.e5)(x.messageKey),{range:x.requiredRange,currentVersion:null!=(n=x.currentVersion)?n:""})}),i.warnings.length>0&&(0,t.jsxs)("section",{className:"space-y-2","data-testid":"skill-plan-warnings",children:[(0,t.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:d("plan.warningsHeading")}),(0,t.jsx)("ul",{className:"space-y-1",children:i.warnings.map(e=>(0,t.jsx)("li",{className:"text-xs text-warning-foreground",children:h.RO[e]?d(h.RO[e]):e},e))})]}),(0,t.jsxs)("section",{className:"space-y-2","data-testid":"skill-plan-files",children:[(0,t.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:d("plan.filesHeading")}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"skill-plan-stats",children:d("plan.stats",{added:i.stats.added,modified:i.stats.modified,unchanged:i.stats.unchanged,conflicted:i.stats.conflicted,unmanaged:i.stats.unmanaged})}),0===i.files.length?(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:d("plan.filesEmpty")}):(0,t.jsx)("ul",{className:"space-y-2",children:i.files.map(e=>(0,t.jsx)(j,{entry:e},e.path))})]}),i.blockers.length>0&&(0,t.jsxs)("section",{className:"space-y-2","data-testid":"skill-install-blockers",children:[(0,t.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wide text-danger-foreground",children:d("plan.blockersHeading")}),(0,t.jsx)("ul",{className:"space-y-1",children:i.blockers.map(e=>{var s,l;return(0,t.jsxs)("li",{className:"text-xs text-danger-foreground",children:[e.path&&(0,t.jsx)("span",{className:"mr-1 break-all font-mono",children:e.path}),e.code.startsWith("skills.")?d((0,h.e5)(e.code),{range:x.requiredRange,currentVersion:null!=(s=x.currentVersion)?s:""}):h.KL[e.code]?d(h.KL[e.code]):e.code]},"".concat(e.code,":").concat(null!=(l=e.path)?l:""))})}),(0,t.jsx)(o.u,{tone:"danger",children:d("plan.blockedNotice")})]})]})}function y(e){let{entry:s}=e,l=(0,a.c)("skills"),n=h.Mj[s.disposition],i=h.hJ[s.reason];return(0,t.jsxs)("li",{className:"flex flex-wrap items-center gap-2","data-testid":"skill-uninstall-file-".concat(s.path),children:[(0,t.jsx)(r.Ex,{variant:"remove"===s.disposition?"info":"warning",children:n?l(n):s.disposition}),(0,t.jsx)("span",{className:"break-all font-mono text-xs text-foreground",children:s.path}),i&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:l(i)})]})}function N(e){var s;let{plan:l}=e,n=(0,a.c)("skills"),{target:d,skill:c}=l;return(0,t.jsxs)(r.Zp,{className:"space-y-4","data-testid":"skill-uninstall-plan",children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:n("uninstall.heading")}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:n("uninstall.expiresAt",{timestamp:l.expiresAt})})]}),(0,t.jsxs)("dl",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[(0,t.jsx)(k,{label:n("target.repository"),children:d.repositoryName}),(0,t.jsx)(k,{label:n("target.heading"),children:d.worktreeName}),(0,t.jsx)(k,{label:n("target.branch"),children:null!=(s=d.branch)?s:n("target.branchUnknown")}),(0,t.jsx)(k,{label:n("uninstall.installedVersion"),children:(0,t.jsx)("span",{className:"font-mono text-xs",children:c.version||n("uninstall.versionUnknown")})}),(0,t.jsx)(k,{label:n("plan.installRoot"),children:(0,t.jsx)("span",{className:"break-all font-mono text-xs",children:d.installRoot})}),(0,t.jsx)(k,{label:n("target.workingTree"),children:d.workingTreeDirty?n("target.workingTreeDirty"):n("target.workingTreeClean")})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"skill-uninstall-stats",children:n("uninstall.stats",{removable:l.stats.removable,modified:l.stats.modified,missing:l.stats.missing,unknown:l.stats.unknown,irregular:l.stats.irregular})}),(0,t.jsxs)("section",{className:"space-y-2",children:[(0,t.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:n("uninstall.removalsHeading")}),0===l.removals.length?(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:n("uninstall.removalsEmpty")}):(0,t.jsx)("ul",{className:"space-y-1.5",children:l.removals.map(e=>(0,t.jsx)(y,{entry:e},e.path))})]}),(0,t.jsxs)("section",{className:"space-y-2",children:[(0,t.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:n("uninstall.retainedHeading")}),0===l.retained.length?(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:n("uninstall.retainedEmpty")}):(0,t.jsx)("ul",{className:"space-y-1.5",children:l.retained.map(e=>(0,t.jsx)(y,{entry:e},e.path))})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[l.skill.agents.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5","data-testid":"skill-uninstall-agents",children:l.skill.agents.map(e=>(0,t.jsx)(r.Ex,{variant:"gray",children:(0,i.f_)(e.agent)},e.agent))}),(0,t.jsx)(o.u,{tone:"neutral",children:n((0,h.e5)(l.nextActionKey))})]}),l.blockers.length>0&&(0,t.jsxs)("section",{className:"space-y-2","data-testid":"skill-uninstall-blockers",children:[(0,t.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wide text-danger-foreground",children:n("uninstall.blockersHeading")}),(0,t.jsx)("ul",{className:"space-y-1",children:l.blockers.map(e=>{var s;return(0,t.jsxs)("li",{className:"text-xs text-danger-foreground",children:[e.path&&(0,t.jsx)("span",{className:"mr-1 break-all font-mono",children:e.path}),n((0,h.e5)(e.messageKey))]},"".concat(e.code,":").concat(null!=(s=e.path)?s:""))})})]})]})}var w=l(80130);let v={worktreeId:null,busy:null,installPlan:null,uninstallPlan:null,installResult:null,uninstallResult:null,riskAcknowledged:!1,failure:null};function R(e){return{...e,installPlan:null,uninstallPlan:null,installResult:null,uninstallResult:null,riskAcknowledged:!1,failure:null}}function C(e,s){return"".concat(e,"-").concat(s)}function I(e){let{failure:s}=e,l=(0,a.c)("skills");return(0,t.jsxs)("div",{className:"space-y-2","data-testid":"skill-operation-error",children:[(0,t.jsxs)(o.u,{tone:"danger",children:[(0,t.jsx)("p",{className:"font-medium",children:l("operation.errorHeading")}),(0,t.jsx)("p",{className:"mt-1",children:l((0,h.FW)(s.code))}),(0,t.jsx)("p",{className:"mt-1 break-words",children:l("state.errorCode",{code:s.code})})]}),s.nextActionKey&&(0,t.jsx)(o.u,{tone:"warning",children:l((0,h.e5)(s.nextActionKey))}),s.blockers&&s.blockers.length>0&&(0,t.jsx)("ul",{className:"space-y-1","data-testid":"skill-operation-error-blockers",children:s.blockers.map(e=>{var s;return(0,t.jsxs)("li",{className:"text-xs text-danger-foreground",children:[e.path&&(0,t.jsx)("span",{className:"mr-1 break-all font-mono",children:e.path}),l((0,h.e5)(e.messageKey))]},"".concat(e.code,":").concat(null!=(s=e.path)?s:""))})})]})}function A(e){let{agents:s,skillId:l,version:n}=e,r=(0,a.c)("skills");return 0===s.length?null:(0,t.jsxs)("div",{className:"space-y-1","data-testid":"skill-operation-reload",children:[(0,t.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:r("operation.reloadHeading")}),(0,t.jsx)("ul",{className:"space-y-1",children:s.map(e=>(0,t.jsx)("li",{className:"text-xs text-muted-foreground",children:r((0,h.e5)(e.messageKey),{agent:(0,i.f_)(e.agent),skillId:l,version:n})},e.agent))})]})}function T(e){var s;let{skillId:l,version:i,blockedReason:c,worktreeId:u}=e,x=(0,a.c)("skills"),[p,g]=(0,n.useState)(()=>u?{...v,worktreeId:u}:v),k=(0,n.useCallback)(e=>{g(s=>s.worktreeId===e?s:R({...s,worktreeId:e,busy:null}))},[]);(0,n.useEffect)(()=>{u&&k(u)},[u,k]);let f=(0,n.useCallback)(async()=>{let e=p.worktreeId;if(!e)return;g(e=>({...R(e),busy:"install-plan"}));let s=await (0,w.Q6)(e,l,{version:null!=i?i:void 0});g(e=>({...e,busy:null,installPlan:s.ok?s.data.plan:null,failure:s.ok?null:s.failure}))},[l,p.worktreeId,i]),j=(0,n.useCallback)(async()=>{let e=p.worktreeId,s=p.installPlan;if(!e||!s||s.requiresRiskAcknowledgement&&!p.riskAcknowledged)return;g(e=>({...e,busy:"install-apply",failure:null}));let t=await (0,w.Xi)(e,l,{planToken:s.token,version:s.skill.version,acknowledgeRisk:!!s.requiresRiskAcknowledgement||void 0,idempotencyKey:C("skill-install",s.token)});t.ok&&(0,d.k)(e),g(e=>({...e,busy:null,installPlan:t.ok?null:e.installPlan,installResult:t.ok?t.data:null,failure:t.ok?null:t.failure}))},[l,p.installPlan,p.riskAcknowledged,p.worktreeId]),y=(0,n.useCallback)(async()=>{let e=p.worktreeId;if(!e)return;g(e=>({...R(e),busy:"uninstall-plan"}));let s=await (0,w.hN)(e,l);g(e=>({...e,busy:null,uninstallPlan:s.ok?s.data.plan:null,failure:s.ok?null:s.failure}))},[l,p.worktreeId]),T=(0,n.useCallback)(async()=>{let e=p.worktreeId,s=p.uninstallPlan;if(!e||!s)return;g(e=>({...e,busy:"uninstall-apply",failure:null}));let t=await (0,w.E)(e,l,{planToken:s.token,idempotencyKey:C("skill-uninstall",s.token)});g(e=>({...e,busy:null,uninstallPlan:t.ok?null:e.uninstallPlan,uninstallResult:t.ok?t.data:null,failure:t.ok?null:t.failure}))},[l,p.uninstallPlan,p.worktreeId]),P=(0,n.useCallback)(()=>{g(e=>R(e))},[]),E=null!==p.busy,H=p.installPlan,q=p.uninstallPlan,S=null!=c?c:x(p.worktreeId?"plan.ready":"plan.chooseTarget"),K=null!==H&&H.requiresRiskAcknowledgement&&!p.riskAcknowledged;return(0,t.jsxs)("div",{className:"space-y-3","data-testid":"skill-install-panel",children:[!u&&(0,t.jsx)(m,{selectedWorktreeId:p.worktreeId,onSelect:k,disabled:E}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsx)(r.$n,{variant:"primary",disabled:E||null!==c||!p.worktreeId,onClick:f,"data-testid":"skill-install-action","aria-describedby":"skill-install-reason",children:x("install-plan"===p.busy?"plan.building":"plan.build")}),(0,t.jsx)(r.$n,{variant:"secondary",disabled:E||!p.worktreeId,onClick:y,"data-testid":"skill-uninstall-action",children:x("uninstall-plan"===p.busy?"uninstall.building":"uninstall.build")})]}),(0,t.jsx)("p",{id:"skill-install-reason",className:"text-sm text-muted-foreground","data-testid":"skill-install-reason",children:S}),p.failure&&(0,t.jsx)(I,{failure:p.failure}),H&&(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)(b,{plan:H}),H.requiresRiskAcknowledgement&&(0,t.jsxs)(r.Zp,{className:"space-y-3","data-testid":"skill-install-risk-acknowledgement",children:[(0,t.jsx)(o.u,{tone:"danger",children:x((0,h.e5)(null!=(s=H.riskAcknowledgementMessageKey)?s:"skills.plan.highRiskAcknowledgement"))}),(0,t.jsxs)("label",{className:"flex items-start gap-2 text-sm text-foreground",children:[(0,t.jsx)(r.Sc,{checked:p.riskAcknowledged,onCheckedChange:e=>g(s=>({...s,riskAcknowledged:!0===e})),disabled:E,"data-testid":"skill-install-risk-checkbox",className:"mt-0.5"}),(0,t.jsx)("span",{children:x("plan.acknowledgeLabel")})]})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsx)(r.$n,{variant:H.requiresRiskAcknowledgement?"danger":"primary",disabled:E||!H.installable||K,onClick:j,"data-testid":"skill-install-confirm",children:x("install-apply"===p.busy?"plan.confirming":"plan.confirm")}),(0,t.jsx)(r.$n,{variant:"ghost",disabled:E,onClick:P,"data-testid":"skill-install-discard",children:x("plan.discard")})]})]}),q&&(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)(N,{plan:q}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsx)(r.$n,{variant:"danger",disabled:E||!q.removable,onClick:T,"data-testid":"skill-uninstall-confirm",children:x("uninstall-apply"===p.busy?"uninstall.confirming":"uninstall.confirm")}),(0,t.jsx)(r.$n,{variant:"ghost",disabled:E,onClick:P,"data-testid":"skill-uninstall-discard",children:x("plan.discard")})]})]}),p.installResult&&(0,t.jsxs)(r.Zp,{className:"space-y-3","data-testid":"skill-install-result",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:x("operation.installedHeading")}),(0,t.jsx)(o.u,{tone:"info",children:x((0,h.e5)(p.installResult.operation.nextActionKey))}),p.installResult.operation.replayed&&(0,t.jsx)(o.u,{tone:"neutral","data-testid":"skill-operation-replayed",children:x("operation.replayNotice")}),p.installResult.install&&"files"in p.installResult.install&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:x("operation.filesWritten",{count:p.installResult.install.files.length})}),"reload"in p.installResult&&(0,t.jsx)(A,{agents:p.installResult.reload.agents,skillId:p.installResult.reload.skillId,version:p.installResult.reload.version}),(0,t.jsx)(r.$n,{variant:"secondary",size:"sm",onClick:P,"data-testid":"skill-operation-reset",children:x("operation.startOver")})]}),p.uninstallResult&&(0,t.jsxs)(r.Zp,{className:"space-y-3","data-testid":"skill-uninstall-result",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:x("operation.uninstalledHeading")}),(0,t.jsx)(o.u,{tone:"info",children:x((0,h.e5)(p.uninstallResult.operation.nextActionKey))}),p.uninstallResult.operation.replayed&&(0,t.jsx)(o.u,{tone:"neutral","data-testid":"skill-operation-replayed",children:x("operation.replayNotice")}),p.uninstallResult.uninstall&&"removedFiles"in p.uninstallResult.uninstall&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:x("operation.filesRemoved",{count:p.uninstallResult.uninstall.removedFiles.length})}),"reload"in p.uninstallResult&&(0,t.jsx)(A,{agents:p.uninstallResult.reload.agents,skillId:p.uninstallResult.reload.skillId,version:p.uninstallResult.reload.version}),(0,t.jsx)(r.$n,{variant:"secondary",size:"sm",onClick:P,"data-testid":"skill-operation-reset",children:x("operation.startOver")})]})]})}},53482:(e,s,l)=>{l.d(s,{i:()=>o});var t=l(95155),n=l(12115),a=l(60322),r=l(9900);function i(){return(0,t.jsx)("svg",{className:"h-3.5 w-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}function d(){return(0,t.jsx)("svg",{className:"h-3.5 w-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}function o(e){let{text:s,className:l="",label:o="Copy"}=e,[c,u]=(0,n.useState)(!1),x=(0,n.useRef)(null);(0,n.useEffect)(()=>()=>{x.current&&clearTimeout(x.current)},[]);let m=(0,n.useCallback)(async()=>{try{await (0,a.l)(s),u(!0),x.current&&clearTimeout(x.current),x.current=setTimeout(()=>u(!1),r.s7)}catch(e){}},[s]);return(0,t.jsxs)("button",{type:"button",onClick:m,className:"inline-flex items-center gap-1 rounded border border-border bg-surface px-2 py-0.5 text-[11px] font-medium text-foreground transition-colors hover:bg-muted ".concat(l),"aria-label":c?"Copied":o,title:c?"Copied!":o,children:[c?(0,t.jsx)(d,{}):(0,t.jsx)(i,{}),(0,t.jsx)("span",{children:c?"Copied":o})]})}},60322:(e,s,l)=>{l.d(s,{l:()=>n});let t=/\x1b\[[0-9;]*[a-zA-Z]|\x1b\][^\x07]*\x07|\[[0-9;]*m/g;async function n(e){var s;if(!e||0===e.trim().length)return;let l=e.replace(t,"");if(null==(s=navigator.clipboard)?void 0:s.writeText)try{await navigator.clipboard.writeText(l);return}catch(e){}let n=document.createElement("textarea");n.value=l,n.style.position="fixed",n.style.left="-9999px",n.style.top="-9999px",n.style.opacity="0",document.body.appendChild(n),n.focus(),n.select();try{document.execCommand("copy")}finally{document.body.removeChild(n)}}},74385:(e,s,l)=>{l.d(s,{I:()=>t,k:()=>n});let t="skill:installed";function n(e){window.dispatchEvent(new CustomEvent(t,{detail:{worktreeId:e}}))}},76246:(e,s,l)=>{l.d(s,{o:()=>t});function t(e){return e?e.split("/").map(encodeURIComponent).join("/"):""}}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6488],{2317:(e,t,r)=>{r.d(t,{V:()=>a});var n=r(12115);function o(){try{let e="__localStorage_test__";return window.localStorage.setItem(e,"test"),window.localStorage.removeItem(e),!0}catch(e){return!1}}function a(e){let{key:t,defaultValue:r,validate:a,serialize:s=JSON.stringify,deserialize:i=JSON.parse}=e,c=(0,n.useRef)(r),l=(0,n.useRef)(a),u=(0,n.useRef)(s),d=(0,n.useRef)(i);c.current=r,l.current=a,u.current=s,d.current=i;let[f,p]=(0,n.useState)(!1),[y,m]=(0,n.useState)(r),w=(0,n.useCallback)(()=>{if(!o())return c.current;try{let e=window.localStorage.getItem(t);if(null===e)return c.current;let r=d.current(e);if(l.current)return l.current(r)?r:c.current;return r}catch(e){return c.current}},[t]),g=(0,n.useCallback)(e=>{if(o())try{let r=u.current(e);window.localStorage.setItem(t,r)}catch(e){}},[t]),h=(0,n.useCallback)(e=>{m(t=>{let r="function"==typeof e?e(t):e;return g(r),r})},[g]),S=(0,n.useCallback)(()=>{if(o())try{window.localStorage.removeItem(t)}catch(e){}m(c.current)},[t]);return(0,n.useEffect)(()=>{p(o()),m(w())},[w]),{value:y,setValue:h,removeValue:S,isAvailable:f}}},7636:(e,t,r)=>{r.d(t,{LV:()=>c,Si:()=>o,UZ:()=>s,Xn:()=>u,_s:()=>d,nO:()=>l,s6:()=>i});let n=["updatedAt","repositoryName","branchName","status","lastSent"],o=e=>n.includes(e),a={waiting:0,ready:1,running:2,generating:3,idle:4};function s(e){let t=new Set;for(let r of e)!1===r.visible&&t.add(r.path);return t}function i(e,t){return 0===t.size?e.slice():e.filter(e=>{let r=e.repositoryPath;return!r||!t.has(r)})}function c(e){let t=function(e){let t=5381;for(let r=0;r<e.length;r++)t=(t<<5)+t+e.charCodeAt(r)|0;return Math.abs(t)}(e)%360;return"hsl(".concat(t,", ").concat(65,"%, ").concat(60,"%)")}function l(e,t){if(!e&&!t)return 0;if(!e)return 1;if(!t)return -1;let r=e instanceof Date?e.getTime():new Date(e).getTime();return(t instanceof Date?t.getTime():new Date(t).getTime())-r}function u(e,t,r){let n=[...e];return n.sort((e,n)=>{let o=0;switch(t){case"updatedAt":{let t=e=>e?e instanceof Date?e.getTime():new Date(e).getTime():0,r=t(e.lastActivity);o=t(n.lastActivity)-r;break}case"repositoryName":{let t=e.repositoryName.toLowerCase(),r=n.repositoryName.toLowerCase();o=t.localeCompare(r);break}case"branchName":{let t=e.name.toLowerCase(),r=n.name.toLowerCase();o=t.localeCompare(r);break}case"status":o=a[e.status]-a[n.status];break;case"lastSent":{let t=l(e.lastActivity,n.lastActivity);if(!e.lastActivity&&!n.lastActivity){o=0;break}if(!e.lastActivity)return 1;if(!n.lastActivity)return -1;o=t;break}default:o=0}return("updatedAt"===t||"lastSent"===t?"desc"===r:"asc"===r)?o:-o}),n}function d(e,t,r){let n=new Map;for(let t of e){let e=t.repositoryName;n.has(e)||n.set(e,[]),n.get(e).push(t)}return[...n.keys()].sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase())).map(e=>({repositoryName:e,branches:u(n.get(e),t,r)}))}},22592:(e,t,r)=>{r.d(t,{Ps:()=>d,W5:()=>u});var n=r(95155),o=r(12115),a=r(38218),s=r(68704);let i="data-pc-size",c={size:s.r5,setSize:()=>{},isMobile:!1,factor:s.d8[s.r5].factor,isAvailable:!1},l=(0,o.createContext)(c);function u(e){let{children:t}=e,{size:r,setSize:c,isAvailable:u}=(0,s.of)(),d=(0,a.a)();(0,o.useEffect)(()=>{if("undefined"==typeof document)return;let e=document.documentElement;return d?void e.removeAttribute(i):(e.setAttribute(i,r),()=>{e.removeAttribute(i)})},[r,d]);let f=(0,o.useMemo)(()=>({size:r,setSize:c,isMobile:d,factor:s.d8[r].factor,isAvailable:u}),[r,c,d,u]);return(0,n.jsx)(l.Provider,{value:f,children:t})}function d(){return(0,o.useContext)(l)}},32916:(e,t,r)=>{r.d(t,{GB:()=>u,VF:()=>d});var n=r(95155),o=r(12115),a=r(7636);let s="updatedAt",i=(0,o.createContext)(null);function c(e,t,r,n){let a=(0,o.useRef)(!0);(0,o.useEffect)(()=>{try{let t=localStorage.getItem(e);t&&n(t)}catch(e){}},[]),(0,o.useEffect)(()=>{if(a.current){a.current=!1;return}try{localStorage.setItem(e,r())}catch(e){}},[t])}function l(e,t){switch(t.type){case"TOGGLE":return{...e,isOpen:!e.isOpen};case"SET_WIDTH":return{...e,width:t.width};case"OPEN_MOBILE_DRAWER":return{...e,isMobileDrawerOpen:!0};case"CLOSE_MOBILE_DRAWER":return{...e,isMobileDrawerOpen:!1};case"SET_SORT_KEY":return{...e,sortKey:t.sortKey};case"SET_SORT_DIRECTION":return{...e,sortDirection:t.sortDirection};case"LOAD_SORT_SETTINGS":return{...e,sortKey:t.sortKey,sortDirection:t.sortDirection};case"SET_VIEW_MODE":return{...e,viewMode:t.viewMode};default:return e}}function u(e){let{children:t,initialOpen:r=!0,initialWidth:u=224}=e,[d,f]=(0,o.useReducer)(l,{isOpen:r,width:u,isMobileDrawerOpen:!1,sortKey:s,sortDirection:"desc",viewMode:"grouped"});c("mcbd-sidebar-sort","".concat(d.sortKey,":").concat(d.sortDirection),()=>JSON.stringify({sortKey:d.sortKey,sortDirection:d.sortDirection}),e=>{try{let t=JSON.parse(e),r=t.sortDirection,n=(0,a.Si)(t.sortKey)?t.sortKey:s;n&&("asc"===r||"desc"===r)&&f({type:"LOAD_SORT_SETTINGS",sortKey:n,sortDirection:r})}catch(e){}}),c("mcbd-sidebar-view-mode",d.viewMode,()=>d.viewMode,e=>{("grouped"===e||"flat"===e)&&f({type:"SET_VIEW_MODE",viewMode:e})}),c("mcbd-sidebar-width",d.width,()=>String(d.width),e=>{let t=Number(e);!isNaN(t)&&t>0&&f({type:"SET_WIDTH",width:288===t?224:t})});let p=(0,o.useCallback)(()=>{f({type:"TOGGLE"})},[]),y=(0,o.useCallback)(e=>{f({type:"SET_WIDTH",width:e})},[]),m=(0,o.useCallback)(()=>{f({type:"OPEN_MOBILE_DRAWER"})},[]),w=(0,o.useCallback)(()=>{f({type:"CLOSE_MOBILE_DRAWER"})},[]),g=(0,o.useCallback)(e=>{f({type:"SET_SORT_KEY",sortKey:e})},[]),h=(0,o.useCallback)(e=>{f({type:"SET_SORT_DIRECTION",sortDirection:e})},[]),S=(0,o.useCallback)(e=>{f({type:"SET_VIEW_MODE",viewMode:e})},[]),b=(0,o.useMemo)(()=>({isOpen:d.isOpen,width:d.width,isMobileDrawerOpen:d.isMobileDrawerOpen,sortKey:d.sortKey,sortDirection:d.sortDirection,toggle:p,setWidth:y,openMobileDrawer:m,closeMobileDrawer:w,setSortKey:g,setSortDirection:h,viewMode:d.viewMode,setViewMode:S}),[d.isOpen,d.width,d.isMobileDrawerOpen,d.sortKey,d.sortDirection,d.viewMode,p,y,m,w,g,h,S]);return(0,n.jsx)(i.Provider,{value:b,children:t})}function d(){let e=(0,o.useContext)(i);if(!e)throw Error("useSidebarContext must be used within a SidebarProvider");return e}},38218:(e,t,r)=>{r.d(t,{D:()=>a,a:()=>s});var n=r(12115);let o=n.useLayoutEffect,a=768;function s(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{breakpoint:t=a}=e,[r,s]=(0,n.useState)(!1);return o(()=>{let e=window.matchMedia("(max-width: ".concat(t-1,"px)"));s(e.matches);let r=e=>{s(e.matches)};return e.addEventListener("change",r),()=>{e.removeEventListener("change",r)}},[t]),r}},39649:(e,t,r)=>{r.d(t,{$f:()=>d,H8:()=>u});var n=r(95155),o=r(12115),a=r(80344);let s={PROCESSING:2e3,SESSION_RUNNING:5e3,IDLE:1e4},i=(0,o.createContext)(null),c={selectedWorktreeId:null,worktrees:[],repositories:[],selectedWorktreeDetail:null,isLoading:!0,isLoadingDetail:!1,error:null};function l(e,t){switch(t.type){case"SET_WORKTREES":return{...e,worktrees:t.worktrees,isLoading:!1};case"SET_REPOSITORIES":return{...e,repositories:t.repositories};case"SELECT_WORKTREE":{var r;let n=null!=(r=e.worktrees.find(e=>e.id===t.id))?r:null;return{...e,selectedWorktreeId:t.id,selectedWorktreeDetail:null!=n?n:e.selectedWorktreeDetail,isLoadingDetail:null===n}}case"SET_WORKTREE_DETAIL":return{...e,selectedWorktreeDetail:t.detail};case"SET_LOADING":return{...e,isLoading:t.isLoading};case"SET_LOADING_DETAIL":return{...e,isLoadingDetail:t.isLoadingDetail};case"SET_ERROR":return{...e,error:t.error,isLoading:!1};default:return e}}function u(e){let{children:t,externalWorktrees:r,externalRepositories:u}=e,d=void 0!==r,[f,p]=(0,o.useReducer)(l,c);(0,o.useEffect)(()=>{d&&r&&p({type:"SET_WORKTREES",worktrees:r})},[d,r]),(0,o.useEffect)(()=>{d&&u&&p({type:"SET_REPOSITORIES",repositories:u})},[d,u]);let y=(0,o.useCallback)(async()=>{if(!d){p({type:"SET_LOADING",isLoading:!0}),p({type:"SET_ERROR",error:null});try{var e;let t=await a.y.getAll();p({type:"SET_WORKTREES",worktrees:t.worktrees}),p({type:"SET_REPOSITORIES",repositories:null!=(e=t.repositories)?e:[]})}catch(e){p({type:"SET_ERROR",error:e instanceof Error?e.message:"Failed to fetch worktrees"})}}},[d]),m=(0,o.useCallback)(async e=>{p({type:"SELECT_WORKTREE",id:e}),p({type:"SET_ERROR",error:null});try{a.y.markAsViewed(e).catch(e=>{console.warn("[WorktreeSelectionContext] Failed to mark as viewed:",e)});let t=await a.y.getById(e);p({type:"SET_WORKTREE_DETAIL",detail:t})}catch(e){p({type:"SET_ERROR",error:e instanceof Error?e.message:"Failed to fetch worktree detail"})}finally{p({type:"SET_LOADING_DETAIL",isLoadingDetail:!1})}},[]),w=(0,o.useCallback)(async()=>{await y()},[y]);(0,o.useEffect)(()=>{d||y()},[y,d]),(0,o.useEffect)(()=>{if(d)return;let e=null,t=!0,r=async()=>{if(t)try{var n,o;let i=await a.y.getAll();p({type:"SET_WORKTREES",worktrees:i.worktrees}),p({type:"SET_REPOSITORIES",repositories:null!=(n=i.repositories)?n:[]});let c=(o=i.worktrees).some(e=>e.isProcessing||e.isWaitingForResponse)?s.PROCESSING:o.some(e=>e.isSessionRunning)?s.SESSION_RUNNING:s.IDLE;t&&(e=setTimeout(r,c))}catch(n){if(n instanceof a.hD&&401===n.status)return;console.error("[WorktreeSelectionContext] Polling error:",n),t&&(e=setTimeout(r,s.SESSION_RUNNING))}};return r(),()=>{t=!1,e&&clearTimeout(e)}},[d]);let g={selectedWorktreeId:f.selectedWorktreeId,worktrees:f.worktrees,repositories:f.repositories,selectedWorktreeDetail:f.selectedWorktreeDetail,isLoadingDetail:f.isLoadingDetail,error:f.error,selectWorktree:m,refreshWorktrees:w};return(0,n.jsx)(i.Provider,{value:g,children:t})}function d(){let e=(0,o.useContext)(i);if(!e)throw Error("useWorktreeSelection must be used within a WorktreeSelectionProvider");return e}},52703:(e,t,r)=>{r.d(t,{Oo:()=>o,ST:()=>n,zS:()=>a});let n="client_version",o="version_mismatch";function a(e){let t;try{t=JSON.parse(e)}catch(e){return null}if(!t||"object"!=typeof t)return null;let r=t;if("broadcast"===r.type){let e=r.data;return e&&"object"==typeof e?"string"!=typeof e.type?null:(void 0===e.worktreeId&&"string"==typeof r.worktreeId&&(e.worktreeId=r.worktreeId),e):null}return"string"==typeof r.type?r:null}},63365:(e,t,r)=>{r.d(t,{tS:()=>u,xM:()=>d,T3:()=>f});var n=r(95155),o=r(12115),a=r(52703);function s(){return"undefined"!=typeof globalThis&&"function"==typeof globalThis.WebSocket?globalThis.WebSocket:null}let i=()=>{},c={status:"disconnected",connected:!1,subscribe:i,unsubscribe:i,addListener:()=>i},l=(0,o.createContext)(null);function u(e){let{children:t,enabled:r=!0}=e,i=(0,o.useRef)(new Set),c=(0,o.useRef)(new Map),{status:u,subscribe:d,unsubscribe:f}=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{onEvent:t,onStatusChange:r,autoReconnect:n=!0,reconnectBaseDelay:i=1e3,reconnectMaxDelay:c=3e4,enabled:l=!0}=e,[u,d]=(0,o.useState)("disconnected"),f=(0,o.useRef)(null),p=(0,o.useRef)(null),y=(0,o.useRef)(0),m=(0,o.useRef)(new Set),w=(0,o.useRef)(!1),g=(0,o.useRef)(t);g.current=t;let h=(0,o.useRef)(r);h.current=r;let S=(0,o.useCallback)(e=>{var t;d(e),null==(t=h.current)||t.call(h,e)},[]),b=(0,o.useCallback)(()=>{null!==p.current&&(clearTimeout(p.current),p.current=null)},[]),E=(0,o.useCallback)(()=>{if(!l)return;let e=s();if(!e||f.current&&(f.current.readyState===e.OPEN||f.current.readyState===e.CONNECTING))return;b(),w.current=!1,S("connecting");let t="https:"===window.location.protocol?"wss:":"ws:",r=new e("".concat(t,"//").concat(window.location.host));f.current=r,r.onopen=()=>{y.current=0,S("connected");try{r.send(JSON.stringify({type:a.ST,version:"0.12.1"}))}catch(e){}m.current.forEach(e=>{try{r.send(JSON.stringify({type:"subscribe",worktreeId:e}))}catch(e){}})},r.onmessage=e=>{var t;let r="string"==typeof e.data?e.data:String(e.data),n=(0,a.zS)(r);n&&(null==(t=g.current)||t.call(g,n))},r.onerror=()=>{S("error")},r.onclose=()=>{var e;if(f.current=null,S("disconnected"),w.current||!n||"undefined"!=typeof document&&"hidden"===document.visibilityState)return;let t=(e=y.current,Math.min(i*2**Math.max(0,e),c));y.current+=1,p.current=setTimeout(()=>{p.current=null,E()},t)}},[l,n,i,c,S,b]),T=(0,o.useCallback)(()=>{if(b(),w.current=!0,f.current){try{f.current.close(1e3,"Client disconnect")}catch(e){}f.current=null}},[b]),C=(0,o.useCallback)(e=>{let t=f.current,r=s();if(t&&r&&t.readyState===r.OPEN)try{t.send(JSON.stringify(e))}catch(e){}},[]),k=(0,o.useCallback)(e=>{m.current.has(e)||(m.current.add(e),C({type:"subscribe",worktreeId:e}))},[C]),v=(0,o.useCallback)(e=>{m.current.has(e)&&(m.current.delete(e),C({type:"unsubscribe",worktreeId:e}))},[C]);return(0,o.useEffect)(()=>{if(l)return E(),()=>{T()}},[l,E,T]),(0,o.useEffect)(()=>{if(!l||"undefined"==typeof document)return;let e=()=>{"visible"===document.visibilityState&&(f.current||(y.current=0,E()))};return document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[l,E]),{status:u,subscribe:k,unsubscribe:v,send:C}}({enabled:r,onEvent:(0,o.useCallback)(e=>{i.current.forEach(t=>{try{t(e)}catch(e){}})},[])}),p=(0,o.useCallback)(e=>{var t;let r=c.current,n=null!=(t=r.get(e))?t:0;r.set(e,n+1),0===n&&d(e)},[d]),y=(0,o.useCallback)(e=>{var t;let r=c.current,n=null!=(t=r.get(e))?t:0;n<=1?(r.delete(e),f(e)):r.set(e,n-1)},[f]),m=(0,o.useCallback)(e=>(i.current.add(e),()=>{i.current.delete(e)}),[]),w=(0,o.useMemo)(()=>({status:u,connected:"connected"===u,subscribe:p,unsubscribe:y,addListener:m}),[u,p,y,m]);return(0,n.jsx)(l.Provider,{value:w,children:t})}function d(){var e;return null!=(e=(0,o.useContext)(l))?e:c}function f(e){let{addListener:t}=d(),r=(0,o.useRef)(e);r.current=e,(0,o.useEffect)(()=>t(e=>r.current(e)),[t])}},65380:(e,t,r)=>{r.d(t,{H:()=>i,O:()=>s});var n=r(95155),o=r(12115);let a=(0,o.createContext)(!1);function s(e){let{children:t,authEnabled:r}=e;return(0,n.jsx)(a.Provider,{value:r,children:t})}function i(){return(0,o.useContext)(a)}},66966:(e,t,r)=>{r.d(t,{g7:()=>c,rC:()=>u,Fn:()=>l});var n=r(95155),o=r(12115),a=r(63365),s=r(39649);let i=(0,o.createContext)(null);function c(e){let{children:t}=e,{worktrees:r,repositories:c,isLoading:l,error:u,refresh:d}=function(){let[e,t]=(0,o.useState)([]),[r,n]=(0,o.useState)([]),[s,i]=(0,o.useState)(!0),[c,l]=(0,o.useState)(null),u=(0,o.useRef)(null),d=(0,o.useRef)([]),f=(0,o.useRef)(null),{connected:p,subscribe:y,unsubscribe:m,addListener:w}=(0,a.xM)(),g=(0,o.useRef)(p);g.current=p;let h=(0,o.useCallback)(async()=>{try{var e,r;l(null);let a=await fetch("/api/worktrees");if(!a.ok)throw Error("Failed to fetch worktrees: ".concat(a.status));let s=await a.json(),i=null!=(e=s.worktrees)?e:[],c=null!=(r=s.repositories)?r:[];(0,o.startTransition)(()=>{t(i),n(c)}),d.current=i}catch(e){l(e instanceof Error?e:Error(String(e)))}finally{i(!1)}},[]);(0,o.useEffect)(()=>{h()},[h]);let S=(0,o.useCallback)(()=>d.current.some(e=>!0===e.isSessionRunning),[]),b=(0,o.useCallback)(()=>{let e=S();return g.current?e?2e4:6e4:e?5e3:3e4},[S]),E=(0,o.useCallback)(()=>{null!==u.current&&(clearInterval(u.current),u.current=null),f.current=null},[]),T=(0,o.useCallback)(()=>{E();let e=b();f.current=e,u.current=setInterval(()=>{h()},e)},[b,h,E]);(0,o.useEffect)(()=>{let e=()=>{document.hidden?E():(h(),T())},t=setTimeout(()=>{T()},0);return document.addEventListener("visibilitychange",e),()=>{clearTimeout(t),E(),document.removeEventListener("visibilitychange",e)}},[h,T,E]),(0,o.useEffect)(()=>{if(d.current=e,"undefined"!=typeof document&&document.hidden||null===f.current)return;let t=b();f.current!==t&&T()},[e,p,b,T]);let C=e.map(e=>e.id).sort().join(" ");return(0,o.useEffect)(()=>{let e=C.length>0?C.split(" "):[];return e.forEach(e=>y(e)),()=>{e.forEach(e=>m(e))}},[C,y,m]),(0,o.useEffect)(()=>w(e=>{if("session_status_changed"===e.type&&"string"==typeof e.worktreeId){let r=e.worktreeId,n=e.isRunning;if("boolean"==typeof n){if((null!=e.cliTool||null!=e.instance)&&!1===n)return void h();(0,o.startTransition)(()=>{t(e=>{let t=!1,o=e.map(e=>e.id===r&&e.isSessionRunning!==n?(t=!0,{...e,isSessionRunning:n}):e);return t?o:e})})}}else("message"===e.type||"message_updated"===e.type)&&h()}),[w,h]),{worktrees:e,repositories:r,isLoading:s,error:c,refresh:h}}(),f=(0,o.useMemo)(()=>({worktrees:r,repositories:c,isLoading:l,error:u,refresh:d}),[r,c,l,u,d]);return(0,n.jsx)(i.Provider,{value:f,children:(0,n.jsx)(s.H8,{externalWorktrees:r,externalRepositories:c,children:t})})}function l(){let e=(0,o.useContext)(i);if(null===e)throw Error("useWorktreesCacheContext must be used within a WorktreesCacheProvider");return e}function u(){return(0,o.useContext)(i)}},68704:(e,t,r)=>{r.d(t,{Uf:()=>a,d8:()=>s,fM:()=>i,of:()=>l,r5:()=>o,rq:()=>c});var n=r(2317);let o="medium",a=["large","medium","small","xsmall"],s={large:{value:"large",rootFontSizePx:18,factor:1.125,terminalFontSize:16},medium:{value:"medium",rootFontSizePx:16,factor:1,terminalFontSize:14},small:{value:"small",rootFontSizePx:14,factor:.875,terminalFontSize:12},xsmall:{value:"xsmall",rootFontSizePx:12.5,factor:.78,terminalFontSize:11}};function i(e){return"string"==typeof e&&Object.prototype.hasOwnProperty.call(s,e)}function c(e){return s[e].terminalFontSize}function l(){let{value:e,setValue:t,isAvailable:r}=(0,n.V)({key:"mcbd-pc-display-size",defaultValue:o,validate:i});return{size:e,setSize:t,isAvailable:r}}},70628:(e,t,r)=>{r.d(t,{K:()=>i,S:()=>s});var n=r(95155),o=r(12115);let a=(0,o.createContext)({open:!1,setOpen:()=>{},toggle:()=>{}});function s(e){let{children:t}=e,[r,s]=(0,o.useState)(!1),i=(0,o.useCallback)(()=>s(e=>!e),[]),c=(0,o.useMemo)(()=>({open:r,setOpen:s,toggle:i}),[r,i]);return(0,n.jsx)(a.Provider,{value:c,children:t})}function i(){return(0,o.useContext)(a)}},80344:(e,t,r)=>{r.d(t,{$T:()=>c,GQ:()=>u,Rx:()=>i,hD:()=>n,hS:()=>l,y:()=>s});class n extends Error{constructor(e,t,r){super(e),this.status=t,this.data=r,this.name="ApiError"}}async function o(e,t,r){if(!(e.headers.get("content-type")||"").includes("application/json"))return t;try{return await e.json()}catch(e){return t}}async function a(e,t){try{let r=new Headers(null==t?void 0:t.headers);r.set("Content-Type","application/json");let a=await fetch(e,{...t,headers:r}),s=a.headers.get("content-type")||"";if(a.redirected&&a.url.includes("/login"))throw new n("Authentication required",401);if(!a.ok){let e=await o(a,{},"error-body");throw new n(e.error||"HTTP error ".concat(a.status),a.status,e)}if(!s.includes("application/json"))throw new n("Unexpected response format",a.status);return a.json()}catch(e){if(e instanceof n)throw e;throw new n(e instanceof Error?e.message:"Unknown error",0,e)}}let s={getAll:async()=>a("/api/worktrees"),getById:async e=>a("/api/worktrees/".concat(e)),updateDescription:async(e,t)=>a("/api/worktrees/".concat(e),{method:"PATCH",body:JSON.stringify({description:t})}),updateLink:async(e,t)=>a("/api/worktrees/".concat(e),{method:"PATCH",body:JSON.stringify({link:t})}),toggleFavorite:async(e,t)=>a("/api/worktrees/".concat(e),{method:"PATCH",body:JSON.stringify({favorite:t})}),updateStatus:async(e,t)=>a("/api/worktrees/".concat(e),{method:"PATCH",body:JSON.stringify({status:t})}),updateCliTool:async(e,t)=>a("/api/worktrees/".concat(e),{method:"PATCH",body:JSON.stringify({cliToolId:t})}),markAsViewed:async e=>a("/api/worktrees/".concat(e,"/viewed"),{method:"PATCH"}),async getMessages(e,t,r,n){let o=new URLSearchParams;return t&&o.append("cliTool",t),r&&o.append("includeArchived","true"),"number"==typeof n&&Number.isFinite(n)&&o.append("limit",String(n)),a("/api/worktrees/".concat(e,"/messages").concat(o.toString()?"?".concat(o.toString()):""))},async sendMessage(e,t,r){let n={content:t};return(null==r?void 0:r.cliToolId)&&(n.cliToolId=r.cliToolId),(null==r?void 0:r.instanceId)&&(n.instanceId=r.instanceId),(null==r?void 0:r.imagePath)&&(n.imagePath=r.imagePath),a("/api/worktrees/".concat(e,"/send"),{method:"POST",body:JSON.stringify(n)})},async uploadImageFile(e,t){let r=Date.now(),n="".concat(r,"-").concat(t.name),a=".commandmate/attachments",s=new FormData;s.append("file",new File([t],n,{type:t.type}));let i=await fetch("/api/worktrees/".concat(e,"/upload/").concat(a),{method:"POST",body:s});if(!i.ok){var c;let e=await o(i,{},"error-body");throw Error((null==e||null==(c=e.error)?void 0:c.message)||"Upload failed (HTTP ".concat(i.status,")"))}return{path:(await o(i,{},"response-body")).path||"".concat(a,"/").concat(n)}},getLogs:async e=>a("/api/worktrees/".concat(e,"/logs")),async getLogFile(e,t,r){let n=(null==r?void 0:r.sanitize)?"?sanitize=true":"";return a("/api/worktrees/".concat(e,"/logs/").concat(t).concat(n))},async killSession(e,t,r){let n=new URLSearchParams;t&&n.set("cliTool",t),r&&n.set("instance",r);let o=n.toString();return a("/api/worktrees/".concat(e,"/kill-session").concat(o?"?".concat(o):""),{method:"POST"})}},i={scan:async e=>a("/api/repositories/scan",{method:"POST",body:JSON.stringify({repositoryPath:e})}),sync:async()=>a("/api/repositories/sync",{method:"POST"}),delete:async e=>a("/api/repositories",{method:"DELETE",body:JSON.stringify({repositoryPath:e})}),clone:async e=>a("/api/repositories/clone",{method:"POST",body:JSON.stringify({cloneUrl:e})}),getCloneStatus:async e=>a("/api/repositories/clone/".concat(e)),getExcluded:async()=>a("/api/repositories/excluded"),restore:async e=>a("/api/repositories/restore",{method:"PUT",body:JSON.stringify({repositoryPath:e})}),list:async()=>a("/api/repositories"),updateDisplayName:async(e,t)=>a("/api/repositories/".concat(encodeURIComponent(e)),{method:"PUT",body:JSON.stringify({displayName:t})}),updateVisibility:async(e,t)=>a("/api/repositories/".concat(encodeURIComponent(e)),{method:"PUT",body:JSON.stringify({visible:t})})},c={getAll:async e=>(await a("/api/worktrees/".concat(e,"/memos"))).memos,create:async(e,t)=>(await a("/api/worktrees/".concat(e,"/memos"),{method:"POST",body:JSON.stringify(t||{})})).memo,update:async(e,t,r)=>(await a("/api/worktrees/".concat(e,"/memos/").concat(t),{method:"PUT",body:JSON.stringify(r)})).memo,delete:async(e,t)=>a("/api/worktrees/".concat(e,"/memos/").concat(t),{method:"DELETE"}),async reorder(e,t){await a("/api/worktrees/".concat(e,"/memos"),{method:"PATCH",body:JSON.stringify({memoIds:t})})}};function l(e){return e instanceof n||e instanceof Error?e.message:"An unknown error occurred"}let u={checkForUpdate:async()=>a("/api/app/update-check",{method:"GET"}),startUpdate:async()=>a("/api/app/update",{method:"POST"}),async ping(){try{return(await fetch("/api/auth/status",{cache:"no-store"})).ok}catch(e){return!1}}}},89275:(e,t,r)=>{r.d(t,{Bo:()=>u,Hq:()=>c});var n=r(95155),o=r(12115),a=r(20063);let s={startTransition:e=>e()},i=(0,o.createContext)(null);function c(){var e;let t=(0,a.useRouter)(),{startTransition:r}=null!=(e=(0,o.useContext)(i))?e:s;return(0,o.useMemo)(()=>({push:e=>r(()=>t.push(e)),replace:e=>r(()=>t.replace(e))}),[t,r])}function l(e){let{onCommit:t}=e,r=(0,a.usePathname)(),n=(0,o.useRef)(!1);return(0,o.useEffect)(()=>{if(!n.current){n.current=!0;return}t()},[r,t]),null}function u(e){let{children:t}=e,r=(0,o.useRef)(null),a=(0,o.useCallback)(()=>{var e;null==(e=r.current)||e.call(r)},[]),s=(0,o.useCallback)(e=>{var t;t=()=>new Promise(t=>{let n=!1,o=()=>{n||(n=!0,t())};r.current=o,e(),window.setTimeout(o,500)}),"undefined"==typeof document||"function"!=typeof document.startViewTransition||"function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches?t():document.startViewTransition(t)},[]),c=(0,o.useMemo)(()=>({startTransition:s}),[s]);return(0,n.jsxs)(i.Provider,{value:c,children:[(0,n.jsx)(l,{onCommit:a}),t]})}},92614:(e,t,r)=>{r.d(t,{C:()=>i,E:()=>s});var n=r(95155),o=r(12115);let a=(0,o.createContext)({open:!1,setOpen:()=>{},toggle:()=>{}});function s(e){let{children:t}=e,[r,s]=(0,o.useState)(!1),i=(0,o.useCallback)(()=>s(e=>!e),[]),c=(0,o.useMemo)(()=>({open:r,setOpen:s,toggle:i}),[r,i]);return(0,n.jsx)(a.Provider,{value:c,children:t})}function i(){return(0,o.useContext)(a)}},94442:(e,t,r)=>{r.d(t,{dj:()=>E,tE:()=>b});var n=r(95155),o=r(12115),a=r(47650),s=r(18955),i=r(42529),c=r(78874),l=r(52056),u=r(23327),d=r(65229),f=r(59854),p=r(9900),y=r(9286);function m(e){let{type:t,iconColor:r}=e,o="h-5 w-5 ".concat(r);switch(t){case"success":return(0,n.jsx)(i.A,{className:o,"data-testid":"toast-icon-success"});case"error":return(0,n.jsx)(c.A,{className:o,"data-testid":"toast-icon-error"});case"warning":return(0,n.jsx)(l.A,{className:o,"data-testid":"toast-icon-warning"});default:return(0,n.jsx)(u.A,{className:o,"data-testid":"toast-icon-info"})}}function w(e){let{id:t,message:r,type:a,onClose:i,duration:c=3e3}=e,l=(0,s.c)("common"),u=(0,o.useRef)(null),f=function(e){switch(e){case"success":return{bgColor:"bg-success-subtle",borderColor:"border-success-border",textColor:"text-success-foreground",iconColor:"text-success-foreground"};case"error":return{bgColor:"bg-danger-subtle",borderColor:"border-danger-border",textColor:"text-danger-foreground",iconColor:"text-danger-foreground"};case"warning":return{bgColor:"bg-warning-subtle",borderColor:"border-warning-border",textColor:"text-warning-foreground",iconColor:"text-warning-foreground"};default:return{bgColor:"bg-info-subtle",borderColor:"border-info-border",textColor:"text-info-foreground",iconColor:"text-info-foreground"}}}(a),[w,g]=(0,o.useState)(!0),{shouldRender:h,isExiting:S}=(0,y.O)(w,p.Ys),b=(0,o.useRef)(i);b.current=i,(0,o.useEffect)(()=>{h||b.current(t)},[h,t]),(0,o.useEffect)(()=>(c>0&&(u.current=setTimeout(()=>{g(!1)},c)),()=>{u.current&&clearTimeout(u.current)}),[c]);let E=(0,o.useCallback)(()=>{u.current&&clearTimeout(u.current),g(!1)},[]);return(0,n.jsxs)("div",{"data-testid":"toast-".concat(t),role:"alert",className:"\n ".concat(f.bgColor,"\n ").concat(f.borderColor,"\n ").concat(f.textColor,"\n border rounded-lg shadow-lg p-4 min-w-[300px] max-w-[400px]\n flex items-start gap-3\n ").concat(S?"animate-out fade-out-0 slide-out-to-right-full duration-200 fill-mode-forwards pointer-events-none":"animate-slide-in","\n "),children:[(0,n.jsx)(m,{type:a,iconColor:f.iconColor}),(0,n.jsx)("p",{className:"flex-1 text-sm font-medium",children:r}),(0,n.jsx)("button",{"data-testid":"toast-close-button",onClick:E,"aria-label":l("closeNotification"),className:"\n ".concat(f.textColor,"\n hover:opacity-70\n focus:outline-none focus:ring-2 focus:ring-offset-2\n transition-opacity\n "),children:(0,n.jsx)(d.A,{className:"h-4 w-4"})})]})}function g(e){let{toasts:t,onClose:r}=e,[s,i]=(0,o.useState)(!1);(0,o.useEffect)(()=>{i(!0)},[]);let c=(0,n.jsx)("div",{"data-testid":"toast-container","aria-live":"polite",className:"fixed bottom-4 right-4 flex flex-col gap-2",style:{zIndex:f.M.TOAST},children:t.map(e=>(0,n.jsx)(w,{id:e.id,message:e.message,type:e.type,onClose:r,duration:e.duration},e.id))});return s?(0,a.createPortal)(c,document.body):null}function h(){let[e,t]=(0,o.useState)([]),r=(0,o.useRef)(0),n=(0,o.useCallback)(function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info",o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3e3,a="toast-".concat(++r.current,"-").concat(Date.now()),s={id:a,message:e,type:n,duration:o};return t(e=>[...e,s]),a},[]),a=(0,o.useCallback)(e=>{t(t=>t.filter(t=>t.id!==e))},[]),s=(0,o.useCallback)(()=>{t([])},[]);return(0,o.useMemo)(()=>({toasts:e,showToast:n,removeToast:a,clearToasts:s}),[e,n,a,s])}let S=(0,o.createContext)(null);function b(e){let{children:t}=e,r=h();return(0,n.jsxs)(S.Provider,{value:r,children:[t,(0,n.jsx)(g,{toasts:r.toasts,onClose:r.removeToast})]})}function E(){let e=(0,o.useContext)(S),t=h();return null!=e?e:t}}}]);
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6488],{2317:(e,t,r)=>{r.d(t,{V:()=>a});var n=r(12115);function o(){try{let e="__localStorage_test__";return window.localStorage.setItem(e,"test"),window.localStorage.removeItem(e),!0}catch(e){return!1}}function a(e){let{key:t,defaultValue:r,validate:a,serialize:s=JSON.stringify,deserialize:i=JSON.parse}=e,c=(0,n.useRef)(r),l=(0,n.useRef)(a),u=(0,n.useRef)(s),d=(0,n.useRef)(i);c.current=r,l.current=a,u.current=s,d.current=i;let[f,p]=(0,n.useState)(!1),[y,m]=(0,n.useState)(r),w=(0,n.useCallback)(()=>{if(!o())return c.current;try{let e=window.localStorage.getItem(t);if(null===e)return c.current;let r=d.current(e);if(l.current)return l.current(r)?r:c.current;return r}catch(e){return c.current}},[t]),g=(0,n.useCallback)(e=>{if(o())try{let r=u.current(e);window.localStorage.setItem(t,r)}catch(e){}},[t]),h=(0,n.useCallback)(e=>{m(t=>{let r="function"==typeof e?e(t):e;return g(r),r})},[g]),S=(0,n.useCallback)(()=>{if(o())try{window.localStorage.removeItem(t)}catch(e){}m(c.current)},[t]);return(0,n.useEffect)(()=>{p(o()),m(w())},[w]),{value:y,setValue:h,removeValue:S,isAvailable:f}}},7636:(e,t,r)=>{r.d(t,{LV:()=>c,Si:()=>o,UZ:()=>s,Xn:()=>u,_s:()=>d,nO:()=>l,s6:()=>i});let n=["updatedAt","repositoryName","branchName","status","lastSent"],o=e=>n.includes(e),a={waiting:0,ready:1,running:2,generating:3,idle:4};function s(e){let t=new Set;for(let r of e)!1===r.visible&&t.add(r.path);return t}function i(e,t){return 0===t.size?e.slice():e.filter(e=>{let r=e.repositoryPath;return!r||!t.has(r)})}function c(e){let t=function(e){let t=5381;for(let r=0;r<e.length;r++)t=(t<<5)+t+e.charCodeAt(r)|0;return Math.abs(t)}(e)%360;return"hsl(".concat(t,", ").concat(65,"%, ").concat(60,"%)")}function l(e,t){if(!e&&!t)return 0;if(!e)return 1;if(!t)return -1;let r=e instanceof Date?e.getTime():new Date(e).getTime();return(t instanceof Date?t.getTime():new Date(t).getTime())-r}function u(e,t,r){let n=[...e];return n.sort((e,n)=>{let o=0;switch(t){case"updatedAt":{let t=e=>e?e instanceof Date?e.getTime():new Date(e).getTime():0,r=t(e.lastActivity);o=t(n.lastActivity)-r;break}case"repositoryName":{let t=e.repositoryName.toLowerCase(),r=n.repositoryName.toLowerCase();o=t.localeCompare(r);break}case"branchName":{let t=e.name.toLowerCase(),r=n.name.toLowerCase();o=t.localeCompare(r);break}case"status":o=a[e.status]-a[n.status];break;case"lastSent":{let t=l(e.lastActivity,n.lastActivity);if(!e.lastActivity&&!n.lastActivity){o=0;break}if(!e.lastActivity)return 1;if(!n.lastActivity)return -1;o=t;break}default:o=0}return("updatedAt"===t||"lastSent"===t?"desc"===r:"asc"===r)?o:-o}),n}function d(e,t,r){let n=new Map;for(let t of e){let e=t.repositoryName;n.has(e)||n.set(e,[]),n.get(e).push(t)}return[...n.keys()].sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase())).map(e=>({repositoryName:e,branches:u(n.get(e),t,r)}))}},22592:(e,t,r)=>{r.d(t,{Ps:()=>d,W5:()=>u});var n=r(95155),o=r(12115),a=r(38218),s=r(68704);let i="data-pc-size",c={size:s.r5,setSize:()=>{},isMobile:!1,factor:s.d8[s.r5].factor,isAvailable:!1},l=(0,o.createContext)(c);function u(e){let{children:t}=e,{size:r,setSize:c,isAvailable:u}=(0,s.of)(),d=(0,a.a)();(0,o.useEffect)(()=>{if("undefined"==typeof document)return;let e=document.documentElement;return d?void e.removeAttribute(i):(e.setAttribute(i,r),()=>{e.removeAttribute(i)})},[r,d]);let f=(0,o.useMemo)(()=>({size:r,setSize:c,isMobile:d,factor:s.d8[r].factor,isAvailable:u}),[r,c,d,u]);return(0,n.jsx)(l.Provider,{value:f,children:t})}function d(){return(0,o.useContext)(l)}},32916:(e,t,r)=>{r.d(t,{GB:()=>u,VF:()=>d});var n=r(95155),o=r(12115),a=r(7636);let s="updatedAt",i=(0,o.createContext)(null);function c(e,t,r,n){let a=(0,o.useRef)(!0);(0,o.useEffect)(()=>{try{let t=localStorage.getItem(e);t&&n(t)}catch(e){}},[]),(0,o.useEffect)(()=>{if(a.current){a.current=!1;return}try{localStorage.setItem(e,r())}catch(e){}},[t])}function l(e,t){switch(t.type){case"TOGGLE":return{...e,isOpen:!e.isOpen};case"SET_WIDTH":return{...e,width:t.width};case"OPEN_MOBILE_DRAWER":return{...e,isMobileDrawerOpen:!0};case"CLOSE_MOBILE_DRAWER":return{...e,isMobileDrawerOpen:!1};case"SET_SORT_KEY":return{...e,sortKey:t.sortKey};case"SET_SORT_DIRECTION":return{...e,sortDirection:t.sortDirection};case"LOAD_SORT_SETTINGS":return{...e,sortKey:t.sortKey,sortDirection:t.sortDirection};case"SET_VIEW_MODE":return{...e,viewMode:t.viewMode};default:return e}}function u(e){let{children:t,initialOpen:r=!0,initialWidth:u=224}=e,[d,f]=(0,o.useReducer)(l,{isOpen:r,width:u,isMobileDrawerOpen:!1,sortKey:s,sortDirection:"desc",viewMode:"grouped"});c("mcbd-sidebar-sort","".concat(d.sortKey,":").concat(d.sortDirection),()=>JSON.stringify({sortKey:d.sortKey,sortDirection:d.sortDirection}),e=>{try{let t=JSON.parse(e),r=t.sortDirection,n=(0,a.Si)(t.sortKey)?t.sortKey:s;n&&("asc"===r||"desc"===r)&&f({type:"LOAD_SORT_SETTINGS",sortKey:n,sortDirection:r})}catch(e){}}),c("mcbd-sidebar-view-mode",d.viewMode,()=>d.viewMode,e=>{("grouped"===e||"flat"===e)&&f({type:"SET_VIEW_MODE",viewMode:e})}),c("mcbd-sidebar-width",d.width,()=>String(d.width),e=>{let t=Number(e);!isNaN(t)&&t>0&&f({type:"SET_WIDTH",width:288===t?224:t})});let p=(0,o.useCallback)(()=>{f({type:"TOGGLE"})},[]),y=(0,o.useCallback)(e=>{f({type:"SET_WIDTH",width:e})},[]),m=(0,o.useCallback)(()=>{f({type:"OPEN_MOBILE_DRAWER"})},[]),w=(0,o.useCallback)(()=>{f({type:"CLOSE_MOBILE_DRAWER"})},[]),g=(0,o.useCallback)(e=>{f({type:"SET_SORT_KEY",sortKey:e})},[]),h=(0,o.useCallback)(e=>{f({type:"SET_SORT_DIRECTION",sortDirection:e})},[]),S=(0,o.useCallback)(e=>{f({type:"SET_VIEW_MODE",viewMode:e})},[]),b=(0,o.useMemo)(()=>({isOpen:d.isOpen,width:d.width,isMobileDrawerOpen:d.isMobileDrawerOpen,sortKey:d.sortKey,sortDirection:d.sortDirection,toggle:p,setWidth:y,openMobileDrawer:m,closeMobileDrawer:w,setSortKey:g,setSortDirection:h,viewMode:d.viewMode,setViewMode:S}),[d.isOpen,d.width,d.isMobileDrawerOpen,d.sortKey,d.sortDirection,d.viewMode,p,y,m,w,g,h,S]);return(0,n.jsx)(i.Provider,{value:b,children:t})}function d(){let e=(0,o.useContext)(i);if(!e)throw Error("useSidebarContext must be used within a SidebarProvider");return e}},38218:(e,t,r)=>{r.d(t,{D:()=>a,a:()=>s});var n=r(12115);let o=n.useLayoutEffect,a=768;function s(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{breakpoint:t=a}=e,[r,s]=(0,n.useState)(!1);return o(()=>{let e=window.matchMedia("(max-width: ".concat(t-1,"px)"));s(e.matches);let r=e=>{s(e.matches)};return e.addEventListener("change",r),()=>{e.removeEventListener("change",r)}},[t]),r}},39649:(e,t,r)=>{r.d(t,{$f:()=>d,H8:()=>u});var n=r(95155),o=r(12115),a=r(80344);let s={PROCESSING:2e3,SESSION_RUNNING:5e3,IDLE:1e4},i=(0,o.createContext)(null),c={selectedWorktreeId:null,worktrees:[],repositories:[],selectedWorktreeDetail:null,isLoading:!0,isLoadingDetail:!1,error:null};function l(e,t){switch(t.type){case"SET_WORKTREES":return{...e,worktrees:t.worktrees,isLoading:!1};case"SET_REPOSITORIES":return{...e,repositories:t.repositories};case"SELECT_WORKTREE":{var r;let n=null!=(r=e.worktrees.find(e=>e.id===t.id))?r:null;return{...e,selectedWorktreeId:t.id,selectedWorktreeDetail:null!=n?n:e.selectedWorktreeDetail,isLoadingDetail:null===n}}case"SET_WORKTREE_DETAIL":return{...e,selectedWorktreeDetail:t.detail};case"SET_LOADING":return{...e,isLoading:t.isLoading};case"SET_LOADING_DETAIL":return{...e,isLoadingDetail:t.isLoadingDetail};case"SET_ERROR":return{...e,error:t.error,isLoading:!1};default:return e}}function u(e){let{children:t,externalWorktrees:r,externalRepositories:u}=e,d=void 0!==r,[f,p]=(0,o.useReducer)(l,c);(0,o.useEffect)(()=>{d&&r&&p({type:"SET_WORKTREES",worktrees:r})},[d,r]),(0,o.useEffect)(()=>{d&&u&&p({type:"SET_REPOSITORIES",repositories:u})},[d,u]);let y=(0,o.useCallback)(async()=>{if(!d){p({type:"SET_LOADING",isLoading:!0}),p({type:"SET_ERROR",error:null});try{var e;let t=await a.y.getAll();p({type:"SET_WORKTREES",worktrees:t.worktrees}),p({type:"SET_REPOSITORIES",repositories:null!=(e=t.repositories)?e:[]})}catch(e){p({type:"SET_ERROR",error:e instanceof Error?e.message:"Failed to fetch worktrees"})}}},[d]),m=(0,o.useCallback)(async e=>{p({type:"SELECT_WORKTREE",id:e}),p({type:"SET_ERROR",error:null});try{a.y.markAsViewed(e).catch(e=>{console.warn("[WorktreeSelectionContext] Failed to mark as viewed:",e)});let t=await a.y.getById(e);p({type:"SET_WORKTREE_DETAIL",detail:t})}catch(e){p({type:"SET_ERROR",error:e instanceof Error?e.message:"Failed to fetch worktree detail"})}finally{p({type:"SET_LOADING_DETAIL",isLoadingDetail:!1})}},[]),w=(0,o.useCallback)(async()=>{await y()},[y]);(0,o.useEffect)(()=>{d||y()},[y,d]),(0,o.useEffect)(()=>{if(d)return;let e=null,t=!0,r=async()=>{if(t)try{var n,o;let i=await a.y.getAll();p({type:"SET_WORKTREES",worktrees:i.worktrees}),p({type:"SET_REPOSITORIES",repositories:null!=(n=i.repositories)?n:[]});let c=(o=i.worktrees).some(e=>e.isProcessing||e.isWaitingForResponse)?s.PROCESSING:o.some(e=>e.isSessionRunning)?s.SESSION_RUNNING:s.IDLE;t&&(e=setTimeout(r,c))}catch(n){if(n instanceof a.hD&&401===n.status)return;console.error("[WorktreeSelectionContext] Polling error:",n),t&&(e=setTimeout(r,s.SESSION_RUNNING))}};return r(),()=>{t=!1,e&&clearTimeout(e)}},[d]);let g={selectedWorktreeId:f.selectedWorktreeId,worktrees:f.worktrees,repositories:f.repositories,selectedWorktreeDetail:f.selectedWorktreeDetail,isLoadingDetail:f.isLoadingDetail,error:f.error,selectWorktree:m,refreshWorktrees:w};return(0,n.jsx)(i.Provider,{value:g,children:t})}function d(){let e=(0,o.useContext)(i);if(!e)throw Error("useWorktreeSelection must be used within a WorktreeSelectionProvider");return e}},52703:(e,t,r)=>{r.d(t,{Oo:()=>o,ST:()=>n,zS:()=>a});let n="client_version",o="version_mismatch";function a(e){let t;try{t=JSON.parse(e)}catch(e){return null}if(!t||"object"!=typeof t)return null;let r=t;if("broadcast"===r.type){let e=r.data;return e&&"object"==typeof e?"string"!=typeof e.type?null:(void 0===e.worktreeId&&"string"==typeof r.worktreeId&&(e.worktreeId=r.worktreeId),e):null}return"string"==typeof r.type?r:null}},63365:(e,t,r)=>{r.d(t,{tS:()=>u,xM:()=>d,T3:()=>f});var n=r(95155),o=r(12115),a=r(52703);function s(){return"undefined"!=typeof globalThis&&"function"==typeof globalThis.WebSocket?globalThis.WebSocket:null}let i=()=>{},c={status:"disconnected",connected:!1,subscribe:i,unsubscribe:i,addListener:()=>i},l=(0,o.createContext)(null);function u(e){let{children:t,enabled:r=!0}=e,i=(0,o.useRef)(new Set),c=(0,o.useRef)(new Map),{status:u,subscribe:d,unsubscribe:f}=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{onEvent:t,onStatusChange:r,autoReconnect:n=!0,reconnectBaseDelay:i=1e3,reconnectMaxDelay:c=3e4,enabled:l=!0}=e,[u,d]=(0,o.useState)("disconnected"),f=(0,o.useRef)(null),p=(0,o.useRef)(null),y=(0,o.useRef)(0),m=(0,o.useRef)(new Set),w=(0,o.useRef)(!1),g=(0,o.useRef)(t);g.current=t;let h=(0,o.useRef)(r);h.current=r;let S=(0,o.useCallback)(e=>{var t;d(e),null==(t=h.current)||t.call(h,e)},[]),b=(0,o.useCallback)(()=>{null!==p.current&&(clearTimeout(p.current),p.current=null)},[]),E=(0,o.useCallback)(()=>{if(!l)return;let e=s();if(!e||f.current&&(f.current.readyState===e.OPEN||f.current.readyState===e.CONNECTING))return;b(),w.current=!1,S("connecting");let t="https:"===window.location.protocol?"wss:":"ws:",r=new e("".concat(t,"//").concat(window.location.host));f.current=r,r.onopen=()=>{y.current=0,S("connected");try{r.send(JSON.stringify({type:a.ST,version:"0.14.0"}))}catch(e){}m.current.forEach(e=>{try{r.send(JSON.stringify({type:"subscribe",worktreeId:e}))}catch(e){}})},r.onmessage=e=>{var t;let r="string"==typeof e.data?e.data:String(e.data),n=(0,a.zS)(r);n&&(null==(t=g.current)||t.call(g,n))},r.onerror=()=>{S("error")},r.onclose=()=>{var e;if(f.current=null,S("disconnected"),w.current||!n||"undefined"!=typeof document&&"hidden"===document.visibilityState)return;let t=(e=y.current,Math.min(i*2**Math.max(0,e),c));y.current+=1,p.current=setTimeout(()=>{p.current=null,E()},t)}},[l,n,i,c,S,b]),T=(0,o.useCallback)(()=>{if(b(),w.current=!0,f.current){try{f.current.close(1e3,"Client disconnect")}catch(e){}f.current=null}},[b]),k=(0,o.useCallback)(e=>{let t=f.current,r=s();if(t&&r&&t.readyState===r.OPEN)try{t.send(JSON.stringify(e))}catch(e){}},[]),C=(0,o.useCallback)(e=>{m.current.has(e)||(m.current.add(e),k({type:"subscribe",worktreeId:e}))},[k]),v=(0,o.useCallback)(e=>{m.current.has(e)&&(m.current.delete(e),k({type:"unsubscribe",worktreeId:e}))},[k]);return(0,o.useEffect)(()=>{if(l)return E(),()=>{T()}},[l,E,T]),(0,o.useEffect)(()=>{if(!l||"undefined"==typeof document)return;let e=()=>{"visible"===document.visibilityState&&(f.current||(y.current=0,E()))};return document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[l,E]),{status:u,subscribe:C,unsubscribe:v,send:k}}({enabled:r,onEvent:(0,o.useCallback)(e=>{i.current.forEach(t=>{try{t(e)}catch(e){}})},[])}),p=(0,o.useCallback)(e=>{var t;let r=c.current,n=null!=(t=r.get(e))?t:0;r.set(e,n+1),0===n&&d(e)},[d]),y=(0,o.useCallback)(e=>{var t;let r=c.current,n=null!=(t=r.get(e))?t:0;n<=1?(r.delete(e),f(e)):r.set(e,n-1)},[f]),m=(0,o.useCallback)(e=>(i.current.add(e),()=>{i.current.delete(e)}),[]),w=(0,o.useMemo)(()=>({status:u,connected:"connected"===u,subscribe:p,unsubscribe:y,addListener:m}),[u,p,y,m]);return(0,n.jsx)(l.Provider,{value:w,children:t})}function d(){var e;return null!=(e=(0,o.useContext)(l))?e:c}function f(e){let{addListener:t}=d(),r=(0,o.useRef)(e);r.current=e,(0,o.useEffect)(()=>t(e=>r.current(e)),[t])}},65380:(e,t,r)=>{r.d(t,{H:()=>i,O:()=>s});var n=r(95155),o=r(12115);let a=(0,o.createContext)(!1);function s(e){let{children:t,authEnabled:r}=e;return(0,n.jsx)(a.Provider,{value:r,children:t})}function i(){return(0,o.useContext)(a)}},66966:(e,t,r)=>{r.d(t,{g7:()=>c,rC:()=>u,Fn:()=>l});var n=r(95155),o=r(12115),a=r(63365),s=r(39649);let i=(0,o.createContext)(null);function c(e){let{children:t}=e,{worktrees:r,repositories:c,isLoading:l,error:u,refresh:d}=function(){let[e,t]=(0,o.useState)([]),[r,n]=(0,o.useState)([]),[s,i]=(0,o.useState)(!0),[c,l]=(0,o.useState)(null),u=(0,o.useRef)(null),d=(0,o.useRef)([]),f=(0,o.useRef)(null),{connected:p,subscribe:y,unsubscribe:m,addListener:w}=(0,a.xM)(),g=(0,o.useRef)(p);g.current=p;let h=(0,o.useCallback)(async()=>{try{var e,r;l(null);let a=await fetch("/api/worktrees");if(!a.ok)throw Error("Failed to fetch worktrees: ".concat(a.status));let s=await a.json(),i=null!=(e=s.worktrees)?e:[],c=null!=(r=s.repositories)?r:[];(0,o.startTransition)(()=>{t(i),n(c)}),d.current=i}catch(e){l(e instanceof Error?e:Error(String(e)))}finally{i(!1)}},[]);(0,o.useEffect)(()=>{h()},[h]);let S=(0,o.useCallback)(()=>d.current.some(e=>!0===e.isSessionRunning),[]),b=(0,o.useCallback)(()=>{let e=S();return g.current?e?2e4:6e4:e?5e3:3e4},[S]),E=(0,o.useCallback)(()=>{null!==u.current&&(clearInterval(u.current),u.current=null),f.current=null},[]),T=(0,o.useCallback)(()=>{E();let e=b();f.current=e,u.current=setInterval(()=>{h()},e)},[b,h,E]);(0,o.useEffect)(()=>{let e=()=>{document.hidden?E():(h(),T())},t=setTimeout(()=>{T()},0);return document.addEventListener("visibilitychange",e),()=>{clearTimeout(t),E(),document.removeEventListener("visibilitychange",e)}},[h,T,E]),(0,o.useEffect)(()=>{if(d.current=e,"undefined"!=typeof document&&document.hidden||null===f.current)return;let t=b();f.current!==t&&T()},[e,p,b,T]);let k=e.map(e=>e.id).sort().join(" ");return(0,o.useEffect)(()=>{let e=k.length>0?k.split(" "):[];return e.forEach(e=>y(e)),()=>{e.forEach(e=>m(e))}},[k,y,m]),(0,o.useEffect)(()=>w(e=>{if("session_status_changed"===e.type&&"string"==typeof e.worktreeId){let r=e.worktreeId,n=e.isRunning;if("boolean"==typeof n){if((null!=e.cliTool||null!=e.instance)&&!1===n)return void h();(0,o.startTransition)(()=>{t(e=>{let t=!1,o=e.map(e=>e.id===r&&e.isSessionRunning!==n?(t=!0,{...e,isSessionRunning:n}):e);return t?o:e})})}}else("message"===e.type||"message_updated"===e.type)&&h()}),[w,h]),{worktrees:e,repositories:r,isLoading:s,error:c,refresh:h}}(),f=(0,o.useMemo)(()=>({worktrees:r,repositories:c,isLoading:l,error:u,refresh:d}),[r,c,l,u,d]);return(0,n.jsx)(i.Provider,{value:f,children:(0,n.jsx)(s.H8,{externalWorktrees:r,externalRepositories:c,children:t})})}function l(){let e=(0,o.useContext)(i);if(null===e)throw Error("useWorktreesCacheContext must be used within a WorktreesCacheProvider");return e}function u(){return(0,o.useContext)(i)}},68704:(e,t,r)=>{r.d(t,{Uf:()=>a,d8:()=>s,fM:()=>i,of:()=>l,r5:()=>o,rq:()=>c});var n=r(2317);let o="medium",a=["large","medium","small","xsmall"],s={large:{value:"large",rootFontSizePx:18,factor:1.125,terminalFontSize:16},medium:{value:"medium",rootFontSizePx:16,factor:1,terminalFontSize:14},small:{value:"small",rootFontSizePx:14,factor:.875,terminalFontSize:12},xsmall:{value:"xsmall",rootFontSizePx:12.5,factor:.78,terminalFontSize:11}};function i(e){return"string"==typeof e&&Object.prototype.hasOwnProperty.call(s,e)}function c(e){return s[e].terminalFontSize}function l(){let{value:e,setValue:t,isAvailable:r}=(0,n.V)({key:"mcbd-pc-display-size",defaultValue:o,validate:i});return{size:e,setSize:t,isAvailable:r}}},70628:(e,t,r)=>{r.d(t,{K:()=>i,S:()=>s});var n=r(95155),o=r(12115);let a=(0,o.createContext)({open:!1,setOpen:()=>{},toggle:()=>{}});function s(e){let{children:t}=e,[r,s]=(0,o.useState)(!1),i=(0,o.useCallback)(()=>s(e=>!e),[]),c=(0,o.useMemo)(()=>({open:r,setOpen:s,toggle:i}),[r,i]);return(0,n.jsx)(a.Provider,{value:c,children:t})}function i(){return(0,o.useContext)(a)}},80344:(e,t,r)=>{r.d(t,{$T:()=>c,GQ:()=>u,Rx:()=>i,hD:()=>n,hS:()=>l,y:()=>s});class n extends Error{constructor(e,t,r){super(e),this.status=t,this.data=r,this.name="ApiError"}}async function o(e,t,r){if(!(e.headers.get("content-type")||"").includes("application/json"))return t;try{return await e.json()}catch(e){return t}}async function a(e,t){try{let r=new Headers(null==t?void 0:t.headers);r.set("Content-Type","application/json");let a=await fetch(e,{...t,headers:r}),s=a.headers.get("content-type")||"";if(a.redirected&&a.url.includes("/login"))throw new n("Authentication required",401);if(!a.ok){let e=await o(a,{},"error-body");throw new n(e.error||"HTTP error ".concat(a.status),a.status,e)}if(!s.includes("application/json"))throw new n("Unexpected response format",a.status);return a.json()}catch(e){if(e instanceof n)throw e;throw new n(e instanceof Error?e.message:"Unknown error",0,e)}}let s={getAll:async()=>a("/api/worktrees"),getById:async e=>a("/api/worktrees/".concat(e)),updateDescription:async(e,t)=>a("/api/worktrees/".concat(e),{method:"PATCH",body:JSON.stringify({description:t})}),updateLink:async(e,t)=>a("/api/worktrees/".concat(e),{method:"PATCH",body:JSON.stringify({link:t})}),toggleFavorite:async(e,t)=>a("/api/worktrees/".concat(e),{method:"PATCH",body:JSON.stringify({favorite:t})}),updateStatus:async(e,t)=>a("/api/worktrees/".concat(e),{method:"PATCH",body:JSON.stringify({status:t})}),updateCliTool:async(e,t)=>a("/api/worktrees/".concat(e),{method:"PATCH",body:JSON.stringify({cliToolId:t})}),markAsViewed:async e=>a("/api/worktrees/".concat(e,"/viewed"),{method:"PATCH"}),async getMessages(e,t,r,n){let o=new URLSearchParams;return t&&o.append("cliTool",t),r&&o.append("includeArchived","true"),"number"==typeof n&&Number.isFinite(n)&&o.append("limit",String(n)),a("/api/worktrees/".concat(e,"/messages").concat(o.toString()?"?".concat(o.toString()):""))},async sendMessage(e,t,r){let n={content:t};return(null==r?void 0:r.cliToolId)&&(n.cliToolId=r.cliToolId),(null==r?void 0:r.instanceId)&&(n.instanceId=r.instanceId),(null==r?void 0:r.imagePath)&&(n.imagePath=r.imagePath),a("/api/worktrees/".concat(e,"/send"),{method:"POST",body:JSON.stringify(n)})},async uploadImageFile(e,t){let r=Date.now(),n="".concat(r,"-").concat(t.name),a=".commandmate/attachments",s=new FormData;s.append("file",new File([t],n,{type:t.type}));let i=await fetch("/api/worktrees/".concat(e,"/upload/").concat(a),{method:"POST",body:s});if(!i.ok){var c;let e=await o(i,{},"error-body");throw Error((null==e||null==(c=e.error)?void 0:c.message)||"Upload failed (HTTP ".concat(i.status,")"))}return{path:(await o(i,{},"response-body")).path||"".concat(a,"/").concat(n)}},getLogs:async e=>a("/api/worktrees/".concat(e,"/logs")),async getLogFile(e,t,r){let n=(null==r?void 0:r.sanitize)?"?sanitize=true":"";return a("/api/worktrees/".concat(e,"/logs/").concat(t).concat(n))},async killSession(e,t,r){let n=new URLSearchParams;t&&n.set("cliTool",t),r&&n.set("instance",r);let o=n.toString();return a("/api/worktrees/".concat(e,"/kill-session").concat(o?"?".concat(o):""),{method:"POST"})}},i={scan:async e=>a("/api/repositories/scan",{method:"POST",body:JSON.stringify({repositoryPath:e})}),sync:async()=>a("/api/repositories/sync",{method:"POST"}),delete:async e=>a("/api/repositories",{method:"DELETE",body:JSON.stringify({repositoryPath:e})}),async clone(e,t){var r;return a("/api/repositories/clone",{method:"POST",body:JSON.stringify({cloneUrl:e,fork:null!=(r=null==t?void 0:t.fork)&&r})})},getCloneStatus:async e=>a("/api/repositories/clone/".concat(e)),getExcluded:async()=>a("/api/repositories/excluded"),restore:async e=>a("/api/repositories/restore",{method:"PUT",body:JSON.stringify({repositoryPath:e})}),list:async()=>a("/api/repositories"),updateDisplayName:async(e,t)=>a("/api/repositories/".concat(encodeURIComponent(e)),{method:"PUT",body:JSON.stringify({displayName:t})}),updateVisibility:async(e,t)=>a("/api/repositories/".concat(encodeURIComponent(e)),{method:"PUT",body:JSON.stringify({visible:t})})},c={getAll:async e=>(await a("/api/worktrees/".concat(e,"/memos"))).memos,create:async(e,t)=>(await a("/api/worktrees/".concat(e,"/memos"),{method:"POST",body:JSON.stringify(t||{})})).memo,update:async(e,t,r)=>(await a("/api/worktrees/".concat(e,"/memos/").concat(t),{method:"PUT",body:JSON.stringify(r)})).memo,delete:async(e,t)=>a("/api/worktrees/".concat(e,"/memos/").concat(t),{method:"DELETE"}),async reorder(e,t){await a("/api/worktrees/".concat(e,"/memos"),{method:"PATCH",body:JSON.stringify({memoIds:t})})}};function l(e){return e instanceof n||e instanceof Error?e.message:"An unknown error occurred"}let u={checkForUpdate:async()=>a("/api/app/update-check",{method:"GET"}),startUpdate:async()=>a("/api/app/update",{method:"POST"}),async ping(){try{return(await fetch("/api/auth/status",{cache:"no-store"})).ok}catch(e){return!1}}}},89275:(e,t,r)=>{r.d(t,{Bo:()=>u,Hq:()=>c});var n=r(95155),o=r(12115),a=r(20063);let s={startTransition:e=>e()},i=(0,o.createContext)(null);function c(){var e;let t=(0,a.useRouter)(),{startTransition:r}=null!=(e=(0,o.useContext)(i))?e:s;return(0,o.useMemo)(()=>({push:e=>r(()=>t.push(e)),replace:e=>r(()=>t.replace(e))}),[t,r])}function l(e){let{onCommit:t}=e,r=(0,a.usePathname)(),n=(0,o.useRef)(!1);return(0,o.useEffect)(()=>{if(!n.current){n.current=!0;return}t()},[r,t]),null}function u(e){let{children:t}=e,r=(0,o.useRef)(null),a=(0,o.useCallback)(()=>{var e;null==(e=r.current)||e.call(r)},[]),s=(0,o.useCallback)(e=>{var t;t=()=>new Promise(t=>{let n=!1,o=()=>{n||(n=!0,t())};r.current=o,e(),window.setTimeout(o,500)}),"undefined"==typeof document||"function"!=typeof document.startViewTransition||"function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches?t():document.startViewTransition(t)},[]),c=(0,o.useMemo)(()=>({startTransition:s}),[s]);return(0,n.jsxs)(i.Provider,{value:c,children:[(0,n.jsx)(l,{onCommit:a}),t]})}},92614:(e,t,r)=>{r.d(t,{C:()=>i,E:()=>s});var n=r(95155),o=r(12115);let a=(0,o.createContext)({open:!1,setOpen:()=>{},toggle:()=>{}});function s(e){let{children:t}=e,[r,s]=(0,o.useState)(!1),i=(0,o.useCallback)(()=>s(e=>!e),[]),c=(0,o.useMemo)(()=>({open:r,setOpen:s,toggle:i}),[r,i]);return(0,n.jsx)(a.Provider,{value:c,children:t})}function i(){return(0,o.useContext)(a)}},94442:(e,t,r)=>{r.d(t,{dj:()=>E,tE:()=>b});var n=r(95155),o=r(12115),a=r(47650),s=r(18955),i=r(42529),c=r(78874),l=r(52056),u=r(23327),d=r(65229),f=r(59854),p=r(9900),y=r(9286);function m(e){let{type:t,iconColor:r}=e,o="h-5 w-5 ".concat(r);switch(t){case"success":return(0,n.jsx)(i.A,{className:o,"data-testid":"toast-icon-success"});case"error":return(0,n.jsx)(c.A,{className:o,"data-testid":"toast-icon-error"});case"warning":return(0,n.jsx)(l.A,{className:o,"data-testid":"toast-icon-warning"});default:return(0,n.jsx)(u.A,{className:o,"data-testid":"toast-icon-info"})}}function w(e){let{id:t,message:r,type:a,onClose:i,duration:c=3e3}=e,l=(0,s.c)("common"),u=(0,o.useRef)(null),f=function(e){switch(e){case"success":return{bgColor:"bg-success-subtle",borderColor:"border-success-border",textColor:"text-success-foreground",iconColor:"text-success-foreground"};case"error":return{bgColor:"bg-danger-subtle",borderColor:"border-danger-border",textColor:"text-danger-foreground",iconColor:"text-danger-foreground"};case"warning":return{bgColor:"bg-warning-subtle",borderColor:"border-warning-border",textColor:"text-warning-foreground",iconColor:"text-warning-foreground"};default:return{bgColor:"bg-info-subtle",borderColor:"border-info-border",textColor:"text-info-foreground",iconColor:"text-info-foreground"}}}(a),[w,g]=(0,o.useState)(!0),{shouldRender:h,isExiting:S}=(0,y.O)(w,p.Ys),b=(0,o.useRef)(i);b.current=i,(0,o.useEffect)(()=>{h||b.current(t)},[h,t]),(0,o.useEffect)(()=>(c>0&&(u.current=setTimeout(()=>{g(!1)},c)),()=>{u.current&&clearTimeout(u.current)}),[c]);let E=(0,o.useCallback)(()=>{u.current&&clearTimeout(u.current),g(!1)},[]);return(0,n.jsxs)("div",{"data-testid":"toast-".concat(t),role:"alert",className:"\n ".concat(f.bgColor,"\n ").concat(f.borderColor,"\n ").concat(f.textColor,"\n border rounded-lg shadow-lg p-4 min-w-[300px] max-w-[400px]\n flex items-start gap-3\n ").concat(S?"animate-out fade-out-0 slide-out-to-right-full duration-200 fill-mode-forwards pointer-events-none":"animate-slide-in","\n "),children:[(0,n.jsx)(m,{type:a,iconColor:f.iconColor}),(0,n.jsx)("p",{className:"flex-1 text-sm font-medium",children:r}),(0,n.jsx)("button",{"data-testid":"toast-close-button",onClick:E,"aria-label":l("closeNotification"),className:"\n ".concat(f.textColor,"\n hover:opacity-70\n focus:outline-none focus:ring-2 focus:ring-offset-2\n transition-opacity\n "),children:(0,n.jsx)(d.A,{className:"h-4 w-4"})})]})}function g(e){let{toasts:t,onClose:r}=e,[s,i]=(0,o.useState)(!1);(0,o.useEffect)(()=>{i(!0)},[]);let c=(0,n.jsx)("div",{"data-testid":"toast-container","aria-live":"polite",className:"fixed bottom-4 right-4 flex flex-col gap-2",style:{zIndex:f.M.TOAST},children:t.map(e=>(0,n.jsx)(w,{id:e.id,message:e.message,type:e.type,onClose:r,duration:e.duration},e.id))});return s?(0,a.createPortal)(c,document.body):null}function h(){let[e,t]=(0,o.useState)([]),r=(0,o.useRef)(0),n=(0,o.useCallback)(function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info",o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3e3,a="toast-".concat(++r.current,"-").concat(Date.now()),s={id:a,message:e,type:n,duration:o};return t(e=>[...e,s]),a},[]),a=(0,o.useCallback)(e=>{t(t=>t.filter(t=>t.id!==e))},[]),s=(0,o.useCallback)(()=>{t([])},[]);return(0,o.useMemo)(()=>({toasts:e,showToast:n,removeToast:a,clearToasts:s}),[e,n,a,s])}let S=(0,o.createContext)(null);function b(e){let{children:t}=e,r=h();return(0,n.jsxs)(S.Provider,{value:r,children:[t,(0,n.jsx)(g,{toasts:r.toasts,onClose:r.removeToast})]})}function E(){let e=(0,o.useContext)(S),t=h();return null!=e?e:t}}}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8974],{6473:(e,t,s)=>{"use strict";s.d(t,{Lc:()=>n,qz:()=>a});let a="animate-in fade-in-0 slide-in-from-bottom-2 fill-mode-backwards duration-300";function n(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:40,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;if(Number.isFinite(e)&&!(e<=0)&&!(e>=s))return"".concat(e*t,"ms")}},53292:(e,t,s)=>{"use strict";s.d(t,{Ll:()=>a,bu:()=>n});let a=2e3,n=4e3},54799:(e,t,s)=>{Promise.resolve().then(s.bind(s,75590))},75590:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>P});var a=s(95155),n=s(4560),o=s(66966),i=s(12115),r=s(18955);function d(e){let{worktrees:t}=e,s=(0,r.c)("home"),{runningCount:n,waitingCount:o}=(0,i.useMemo)(()=>{let e=0,s=0;for(let a of t)a.isSessionRunning&&(e++,a.isWaitingForResponse&&s++);return{runningCount:e,waitingCount:s}},[t]);return(0,a.jsxs)("div",{className:"mb-8",children:[(0,a.jsx)("h1",{className:"text-2xl font-semibold text-foreground",children:s("title")}),(0,a.jsxs)("p",{className:"mt-1 text-sm text-muted-foreground","data-testid":"home-subline",children:[(0,a.jsx)("span",{className:"tabular-nums","data-testid":"subline-running",children:n})," ",s("running"),(0,a.jsx)("span",{"aria-hidden":"true",children:" \xb7 "}),(0,a.jsx)("span",{className:"tabular-nums","data-testid":"subline-waiting",children:o})," ",s("waiting")]})]})}var l=s(52619),c=s.n(l),m=s(65229),u=s(61362),h=s(99051),x=s(744),g=s(2317);function f(e){return"boolean"==typeof e}let p=[{key:"registerRepository",href:"/repositories"},{key:"sendFirstMessage",href:"/sessions"}];function j(e){let{worktrees:t,repositories:s,isLoading:n=!1,error:o=null}=e,d=(0,r.c)("home"),{value:l,setValue:j}=(0,g.V)({key:"commandmate:onboarding-dismissed",defaultValue:!1,validate:f}),[b,v]=(0,i.useState)(!1);(0,i.useEffect)(()=>v(!0),[]);let y=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return{hasRepository:(null!=t?t:[]).length>0,hasSentMessage:(null!=e?e:[]).some(e=>!!e.lastUserMessageAt)}}(t,s),N=y.hasRepository&&y.hasSentMessage,w=b&&!n&&null===o;return((0,i.useEffect)(()=>{w&&N&&!l&&j(!0)},[w,N,l,j]),!w||N||l)?null:(0,a.jsx)("div",{className:"mb-8",children:(0,a.jsxs)(x.Zp,{variant:"elevated","data-testid":"onboarding-checklist",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:d("onboarding.title")}),(0,a.jsx)(x.$n,{variant:"ghost",size:"sm","aria-label":d("onboarding.dismiss"),"data-testid":"onboarding-dismiss",onClick:()=>j(!0),children:(0,a.jsx)(m.A,{size:16,"aria-hidden":"true"})})]}),(0,a.jsx)("ol",{className:"mt-3 space-y-3",children:p.map(e=>{let{key:t,href:s}=e,n="registerRepository"===t?y.hasRepository:y.hasSentMessage;return(0,a.jsxs)("li",{className:"flex items-center gap-3","data-testid":"onboarding-step-".concat(t),"data-complete":n,children:[n?(0,a.jsx)(u.A,{size:20,className:"shrink-0 text-success-foreground","aria-hidden":"true"}):(0,a.jsx)(h.A,{size:20,className:"shrink-0 text-muted-foreground","aria-hidden":"true"}),(0,a.jsx)("span",{className:"min-w-0 flex-1 text-sm ".concat(n?"text-muted-foreground line-through":"text-foreground"),children:d("onboarding.steps.".concat(t))}),!n&&(0,a.jsx)(c(),{href:s,"data-testid":"onboarding-action-".concat(t),className:"shrink-0 rounded-md bg-accent-600 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring dark:bg-accent-500 dark:hover:bg-accent-600",children:d("onboarding.actions.".concat(t))})]},t)})})]})})}var b=s(87531);function v(e){let{worktrees:t,isLoading:s=!1}=e,n=(0,r.c)("home"),{runningCount:o,waitingCount:d}=(0,i.useMemo)(()=>{let e=0,s=0;for(let a of t)a.isSessionRunning&&(e++,a.isWaitingForResponse&&s++);return{runningCount:e,waitingCount:s}},[t]);return s?(0,a.jsx)("div",{className:"grid grid-cols-2 gap-3","data-testid":"home-session-summary-loading",role:"status","aria-label":n("sessionSummary.loading"),children:[0,1].map(e=>(0,a.jsxs)("div",{className:"rounded-lg border border-border bg-surface-2 px-3 py-2",children:[(0,a.jsx)("div",{className:"flex h-4 items-center",children:(0,a.jsx)(x.EA,{className:"h-3 w-16"})}),(0,a.jsx)("div",{className:"flex h-9 items-center",children:(0,a.jsx)(x.EA,{className:"h-7 w-10"})})]},e))}):(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-3","data-testid":"home-session-summary",children:[(0,a.jsxs)("div",{className:"rounded-lg border border-border bg-surface-2 px-3 py-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,a.jsx)(x.md,{status:o>0?"running":"idle",size:"sm",label:n("sessionSummary.running")}),n("sessionSummary.running")]}),(0,a.jsx)("div",{className:(0,b.cn)("text-3xl font-bold tabular-nums",o>0?"text-foreground":"text-muted-foreground"),"data-testid":"running-count",children:o})]}),(0,a.jsxs)("div",{className:"rounded-lg border border-border bg-surface-2 px-3 py-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,a.jsx)(x.md,{status:d>0?"waiting":"idle",size:"sm",label:n("sessionSummary.waiting")}),n("sessionSummary.waiting")]}),(0,a.jsx)("div",{className:(0,b.cn)("text-3xl font-bold tabular-nums",d>0?"text-foreground":"text-muted-foreground"),"data-testid":"waiting-count",children:d})]})]})}var y=s(7636),N=s(83012);function w(e){var t;return null!=(t=e.lastUserMessageAt)?t:e.updatedAt}function k(e){let{worktrees:t,limit:s=5,isLoading:n=!1}=e,o=(0,r.c)("home"),d=(0,i.useMemo)(()=>[...t].sort((e,t)=>(0,y.nO)(w(e),w(t))).slice(0,s),[t,s]);return n?(0,a.jsx)("ul",{className:"space-y-1","data-testid":"recent-sessions-loading",role:"status","aria-label":o("recentSessions.loading"),children:Array.from({length:s},(e,t)=>(0,a.jsxs)("li",{className:"flex items-center gap-2 rounded-md px-2 py-1.5",children:[(0,a.jsx)(x.EA,{className:"h-2 w-2 shrink-0 rounded-full"}),(0,a.jsxs)("span",{className:"min-w-0 flex-1 space-y-1",children:[(0,a.jsx)(x.EA,{className:"h-4 w-2/5"}),(0,a.jsx)(x.EA,{className:"h-3 w-3/5"})]}),(0,a.jsx)(x.EA,{className:"h-3 w-8 shrink-0"})]},t))}):0===d.length?(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"recent-sessions-empty",children:o("recentSessions.empty")}),(0,a.jsx)(c(),{href:"/repositories","data-testid":"recent-sessions-cta",className:"inline-block text-sm font-medium text-accent-600 transition-colors hover:text-accent-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring dark:text-accent-400 dark:hover:text-accent-300",children:o("recentSessions.cta")})]}):(0,a.jsx)("ul",{className:"space-y-1","data-testid":"recent-sessions",children:d.map(e=>{var t;let s=w(e),n=s?(0,N.Fx)(String(s)):"";return(0,a.jsx)("li",{children:(0,a.jsxs)(c(),{href:"/worktrees/".concat(e.id),"data-testid":"recent-session-".concat(e.id),className:"flex items-center gap-2 rounded-md px-2 py-1.5 transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[(0,a.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full ".concat(e.isWaitingForResponse?"bg-warning":e.isSessionRunning?"bg-success":"bg-muted-foreground"),"aria-hidden":"true"}),(0,a.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,a.jsx)("span",{className:"block truncate text-sm font-medium text-foreground",children:null!=(t=e.repositoryDisplayName)?t:e.repositoryName}),(0,a.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:e.name})]}),n&&(0,a.jsx)("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:n})]})},e.id)})})}function C(e){let{worktrees:t,isLoading:s=!1}=e,n=(0,r.c)("home");return(0,a.jsxs)(x.Zp,{variant:"elevated",className:"h-full","data-testid":"session-overview-tile",children:[(0,a.jsx)("h2",{className:"mb-3 text-lg font-semibold text-foreground",children:n("sessionOverview.title")}),(0,a.jsx)(v,{worktrees:t,isLoading:s}),(0,a.jsxs)("div",{className:"mt-4 flex items-center justify-between",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:n("sessionOverview.recentSessions")}),(0,a.jsx)(c(),{href:"/sessions",className:"text-xs text-accent-600 hover:underline dark:text-accent-400 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded","data-testid":"session-overview-view-all",children:n("sessionOverview.viewAll")})]}),(0,a.jsx)("div",{className:"mt-2",children:(0,a.jsx)(k,{worktrees:t,isLoading:s})})]})}var S=s(36402),A=s(85872),E=s(53292);let R="commandmate-home-todo-repo";function F(e){var t;return(null==(t=e.repositoryDisplayName)?void 0:t.trim())||e.repositoryName||""}function M(){let e=(0,r.c)("home"),t=(0,r.c)("common"),s=(0,S.SC)(),[n,o]=(0,i.useState)([]),[d,l]=(0,i.useState)(""),[c,m]=(0,i.useState)([]),[u,h]=(0,i.useState)(""),[g,f]=(0,i.useState)(!1),[p,j]=(0,i.useState)(!1),[b,v]=(0,i.useState)(null),y=(0,i.useRef)(!1),N=(0,i.useMemo)(()=>c.filter(e=>!e.done).length,[c]);(0,i.useEffect)(()=>{!async function(){try{var e;let t=await fetch("/api/worktrees");if(!t.ok)return;let s=(null!=(e=(await t.json()).repositories)?e:[]).map(e=>({id:e.id,path:e.path,name:e.name,displayName:e.displayName}));if(o(s),s.length>0){let e=localStorage.getItem(R),t=e&&s.some(t=>t.id===e)?e:s[0].id;l(t)}}catch(e){}finally{y.current=!0}}()},[]);let w=(0,i.useCallback)(async()=>{f(!0),v(null);try{let e=await A.$C.listAll();m(e)}catch(t){v(t instanceof Error?t.message:e("todo.errors.load")),m([])}finally{f(!1)}},[e]);(0,i.useEffect)(()=>{w()},[w]),(0,i.useEffect)(()=>{d&&localStorage.setItem(R,d)},[d]);let k=(0,i.useCallback)(async()=>{let t=u.trim();if(t&&d&&!p){j(!0),v(null);try{await A.$C.create(d,t),h(""),await w()}catch(t){v(t instanceof Error?t.message:e("todo.errors.add"))}finally{j(!1)}}},[u,d,p,w,e]),C=(0,i.useCallback)(async t=>{m(e=>e.map(e=>e.id===t.id?{...e,done:!e.done}:e)),v(null);try{await A.$C.update(t.repositoryId,t.id,{done:!t.done})}catch(t){v(t instanceof Error?t.message:e("todo.errors.update")),w()}},[w,e]),M=(0,i.useCallback)(async a=>{if(await s({description:t("confirmDelete",{name:a.content}),variant:"danger"})){v(null);try{await A.$C.remove(a.repositoryId,a.id),m(e=>e.filter(e=>e.id!==a.id))}catch(t){v(t instanceof Error?t.message:e("todo.errors.delete"))}}},[e,s,t]),I=(0,i.useCallback)(e=>{"Enter"!==e.key||e.nativeEvent.isComposing||(e.preventDefault(),k())},[k]),T=n.length>0;return(0,a.jsxs)(x.Zp,{className:"h-full","data-testid":"home-todo-widget",children:[(0,a.jsx)("h2",{className:"mb-3 text-lg font-semibold text-foreground",children:e("todo.title")}),(0,a.jsxs)("div",{className:"flex flex-col gap-2 mb-3 sm:flex-row sm:items-center sm:justify-between sm:gap-3","data-testid":"todo-selector-row",children:[(0,a.jsxs)("label",{className:"flex items-center gap-2 text-sm text-muted-foreground min-w-0",children:[(0,a.jsx)("span",{className:"shrink-0",children:e("todo.repository")}),(0,a.jsx)("select",{value:d,onChange:e=>l(e.target.value),disabled:!T,"data-testid":"todo-repo-select",className:"min-w-0 flex-1 truncate rounded-md border border-input bg-surface dark:bg-surface-2 px-2 py-1 text-sm text-surface-foreground disabled:opacity-50 sm:flex-initial sm:max-w-[16rem]",children:n.map(e=>{var t;return(0,a.jsx)("option",{value:e.id,children:(null==(t=e.displayName)?void 0:t.trim())||e.name},e.id)})})]}),T&&(0,a.jsx)("span",{className:"shrink-0 text-xs text-muted-foreground","data-testid":"todo-remaining",children:e("todo.open",{count:N})})]}),T?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,a.jsx)(x.pd,{type:"text",value:u,onChange:e=>h(e.target.value),onKeyDown:I,maxLength:E.Ll,placeholder:e("todo.inputPlaceholder"),"data-testid":"todo-input",className:"w-auto flex-1 min-w-0"}),(0,a.jsx)(x.$n,{type:"button",variant:"primary",size:"sm",onClick:k,disabled:p||0===u.trim().length,"data-testid":"todo-add-button",className:"shrink-0",children:e("todo.add")})]}),b&&(0,a.jsx)("p",{className:"mb-2 text-xs text-danger-foreground","data-testid":"todo-error",children:b}),g&&0===c.length?(0,a.jsx)("ul",{className:"space-y-1","data-testid":"todo-loading",role:"status","aria-label":e("todo.loading"),children:[0,1,2].map(e=>(0,a.jsxs)("li",{className:"flex items-center gap-2 rounded-md px-1 py-1",children:[(0,a.jsx)(x.EA,{className:"h-4 w-4 shrink-0 rounded"}),(0,a.jsx)(x.EA,{className:"h-4 ".concat(1===e?"w-2/3":"w-5/6")})]},e))}):0===c.length?(0,a.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"todo-empty",children:e("todo.empty")}):(0,a.jsx)("ul",{className:"space-y-1","data-testid":"todo-list",children:c.map(t=>(0,a.jsxs)("li",{className:"flex flex-col gap-1 rounded-md px-1 py-1 hover:bg-muted group sm:flex-row sm:items-center sm:gap-2","data-testid":"todo-item",children:[(0,a.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[(0,a.jsx)("label",{className:"shrink-0 inline-flex min-h-[44px] min-w-[44px] cursor-pointer items-center justify-center sm:min-h-0 sm:min-w-0",children:(0,a.jsx)(x.Sc,{checked:t.done,onCheckedChange:()=>C(t),"data-testid":"todo-checkbox","aria-label":t.done?e("todo.markAsNotDone"):e("todo.markAsDone")})}),(0,a.jsx)("span",{className:"min-w-0 flex-1 break-words text-sm ".concat(t.done?"line-through text-muted-foreground":"text-foreground"),children:t.content})]}),(0,a.jsxs)("div",{className:"flex shrink-0 items-center justify-end gap-2",children:[F(t)&&(0,a.jsx)("span",{className:"shrink-0 max-w-[8rem] truncate rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground","data-testid":"todo-repo-badge",title:F(t),children:F(t)}),(0,a.jsx)("button",{type:"button",onClick:()=>M(t),"aria-label":e("todo.delete"),"data-testid":"todo-delete",className:"inline-flex min-h-[44px] min-w-[44px] shrink-0 items-center justify-center text-muted-foreground opacity-100 transition-opacity hover:text-danger-foreground sm:min-h-0 sm:min-w-0 sm:opacity-0 sm:group-hover:opacity-100",children:(0,a.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]},t.id))})]}):(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:e("todo.noRepositories")})]})}var I=s(37586),T=s(66685),U=s(24533),z=s(37772),D=s(6473);let L=[{key:"chat",href:"/chat",icon:(0,a.jsx)(I.A,{size:20,"aria-hidden":"true"})},{key:"sessions",href:"/sessions",icon:(0,a.jsx)(T.A,{size:20,"aria-hidden":"true"})},{key:"repositories",href:"/repositories",icon:(0,a.jsx)(U.A,{size:20,"aria-hidden":"true"})},{key:"review",href:"/review",icon:(0,a.jsx)(u.A,{size:20,"aria-hidden":"true"})},{key:"more",href:"/more",icon:(0,a.jsx)(z.A,{size:20,"aria-hidden":"true"})}];function O(){let e=(0,r.c)("common");return(0,a.jsx)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3 md:grid-cols-5","data-testid":"home-quick-actions",children:L.map((t,s)=>{let n=e("nav.".concat(t.key));return(0,a.jsx)(c(),{href:t.href,"aria-label":n,className:"group block rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","data-testid":"quick-action-".concat(t.key),children:(0,a.jsxs)(x.Zp,{interactive:!0,padding:"sm",style:{animationDelay:(0,D.Lc)(s)},className:"flex h-full flex-col items-center justify-center gap-1.5 py-3 text-center hover:border-accent-300 dark:hover:border-accent-700 ".concat(D.qz),children:[(0,a.jsx)("span",{className:"text-muted-foreground group-hover:text-accent-600 dark:group-hover:text-accent-400 transition-colors",children:t.icon}),(0,a.jsx)("span",{className:"text-xs font-medium text-foreground",children:n})]})},t.href)})})}function P(){let{worktrees:e,repositories:t,isLoading:s,error:i}=(0,o.Fn)(),r=s&&0===e.length;return(0,a.jsx)(n.GV,{children:(0,a.jsxs)("div",{className:"container-custom py-8 overflow-auto h-full",children:[(0,a.jsx)(d,{worktrees:e}),(0,a.jsx)(j,{worktrees:e,repositories:t,isLoading:r,error:i}),(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-12","data-testid":"home-bento-grid",children:[(0,a.jsx)("div",{className:"md:col-span-8",children:(0,a.jsx)(C,{worktrees:e,isLoading:r})}),(0,a.jsx)("div",{className:"md:col-span-4",children:(0,a.jsx)(M,{})}),(0,a.jsx)("div",{className:"md:col-span-12",children:(0,a.jsx)(O,{})})]})]})})}},83012:(e,t,s)=>{"use strict";s.d(t,{Fx:()=>i,bg:()=>r,fw:()=>o});var a=s(53298),n=s(73683);function o(e,t){let s=new Date(e);return isNaN(s.getTime())?"":(0,a.m)(s,{addSuffix:!0,...t?{locale:t}:{}})}function i(e){let t=new Date(e);if(isNaN(t.getTime()))return"";let s=Math.round((Date.now()-t.getTime())/1e3);if(s<45)return"now";let a=Math.round(s/60);if(a<60)return"".concat(a,"m ago");let n=Math.round(a/60);if(n<24)return"".concat(n,"h ago");let o=Math.round(n/24);return o<7?"".concat(o,"d ago"):o<30?"".concat(Math.round(o/7),"w ago"):o<365?"".concat(Math.round(o/30),"mo ago"):"".concat(Math.round(o/365),"y ago")}function r(e,t){return!(e instanceof Date)||isNaN(e.getTime())?"":(0,n.GP)(e,"PPp",t?{locale:t}:void 0)}},85872:(e,t,s)=>{"use strict";async function a(e,t){throw Error((await e.json().catch(()=>({}))).error||"".concat(t," (").concat(e.status,")"))}s.d(t,{$C:()=>n,Ar:()=>i,KG:()=>o});let n={async list(e){var t;let s=await fetch("/api/repositories/".concat(encodeURIComponent(e),"/todos"));return s.ok?null!=(t=(await s.json()).todos)?t:[]:a(s,"Failed to load todos")},async listAll(){var e;let t=await fetch("/api/todos");return t.ok?null!=(e=(await t.json()).todos)?e:[]:a(t,"Failed to load todos")},async create(e,t){let s=await fetch("/api/repositories/".concat(encodeURIComponent(e),"/todos"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:t})});return s.ok?(await s.json()).todo:a(s,"Failed to create todo")},async update(e,t,s){let n=await fetch("/api/repositories/".concat(encodeURIComponent(e),"/todos/").concat(encodeURIComponent(t)),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});return n.ok?(await n.json()).todo:a(n,"Failed to update todo")},async remove(e,t){let s=await fetch("/api/repositories/".concat(encodeURIComponent(e),"/todos/").concat(encodeURIComponent(t)),{method:"DELETE"});s.ok||await a(s,"Failed to delete todo")}},o=["todo","doing","done"],i={async list(e){var t;let s=await fetch("/api/worktrees/".concat(encodeURIComponent(e),"/todos"));return s.ok?null!=(t=(await s.json()).todos)?t:[]:a(s,"Failed to load todos")},async create(e,t,s){let n=await fetch("/api/worktrees/".concat(encodeURIComponent(e),"/todos"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(void 0!==s?{content:t,detail:s}:{content:t})});return n.ok?(await n.json()).todo:a(n,"Failed to create todo")},async update(e,t,s){let n=await fetch("/api/worktrees/".concat(encodeURIComponent(e),"/todos/").concat(encodeURIComponent(t)),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});return n.ok?(await n.json()).todo:a(n,"Failed to update todo")},async remove(e,t){let s=await fetch("/api/worktrees/".concat(encodeURIComponent(e),"/todos/").concat(encodeURIComponent(t)),{method:"DELETE"});s.ok||await a(s,"Failed to delete todo")},async reorder(e,t){let s=await fetch("/api/worktrees/".concat(encodeURIComponent(e),"/todos"),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({todoIds:t})});s.ok||await a(s,"Failed to reorder todos")}}}},e=>{e.O(0,[6809,4909,2770,790,4974,9948,6402,744,6488,4560,8441,1255,7358],()=>e(e.s=54799)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3135],{540:(e,t,s)=>{Promise.resolve().then(s.bind(s,22743))},9219:(e,t,s)=>{"use strict";s.d(t,{k:()=>i});var r=s(95155),a=s(12115),l=s(744),n=s(87531);function i(e){let{onRefresh:t,enabled:s=!0,className:i,children:o}=e,{containerRef:c,pullDistance:d,isRefreshing:u,isPulling:m}=function(e){let{onRefresh:t,enabled:s=!0,threshold:r=64,maxPull:l=96,resistance:n=.5}=e,i=(0,a.useRef)(null),[o,c]=(0,a.useState)(0),[d,u]=(0,a.useState)(!1),[m,p]=(0,a.useState)(!1),x=(0,a.useRef)(null),h=(0,a.useRef)(0),g=(0,a.useRef)(!1);g.current=d;let f=(0,a.useCallback)(()=>{x.current=null,h.current=0,c(0),p(!1)},[]),b=(0,a.useCallback)(e=>{if(!s||g.current)return;let t=i.current;t&&!(t.scrollTop>0)&&(x.current=e.touches[0].clientY,h.current=0)},[s]),v=(0,a.useCallback)(e=>{if(null===x.current)return;let t=i.current;if(!t)return;if(t.scrollTop>0)return void f();let s=e.touches[0].clientY-x.current;if(s<=0){0!==h.current&&(h.current=0,c(0),p(!1));return}e.cancelable&&e.preventDefault();let r=Math.min(s*n,l);h.current=r,c(r),p(!0)},[n,l,f]),y=(0,a.useCallback)(async()=>{u(!0),p(!1),c(r);try{await Promise.resolve(t())}finally{u(!1),c(0)}},[t,r]),j=(0,a.useCallback)(()=>{if(null===x.current)return;let e=h.current>=r&&!g.current;x.current=null,h.current=0,e?y():(c(0),p(!1))},[r,y]);return(0,a.useEffect)(()=>{let e=i.current;if(e)return e.addEventListener("touchstart",b,{passive:!0}),e.addEventListener("touchmove",v,{passive:!1}),e.addEventListener("touchend",j,{passive:!0}),e.addEventListener("touchcancel",j,{passive:!0}),()=>{e.removeEventListener("touchstart",b),e.removeEventListener("touchmove",v),e.removeEventListener("touchend",j),e.removeEventListener("touchcancel",j)}},[b,v,j]),{containerRef:i,pullDistance:o,isRefreshing:d,isPulling:m}}({onRefresh:t,enabled:s,threshold:64}),p=u||d>0,x=u?1:Math.min(d/64,1);return(0,r.jsxs)("div",{ref:c,className:(0,n.cn)("relative overflow-auto",i),style:{overscrollBehaviorY:"contain"},"data-testid":"pull-to-refresh",children:[(0,r.jsx)("div",{className:"pointer-events-none absolute inset-x-0 top-0 z-10 flex justify-center",style:{transform:"translateY(".concat(p?Math.max(d-24,8):-32,"px)"),opacity:x,transition:m?"none":"transform 0.2s ease-out, opacity 0.2s ease-out"},"data-testid":"pull-to-refresh-indicator",role:"status","aria-hidden":!u,children:(0,r.jsx)(l.y$,{size:"sm",variant:"accent"})}),(0,r.jsx)("div",{style:{transform:p?"translateY(".concat(d,"px)"):void 0,transition:m?"none":"transform 0.2s ease-out"},children:o})]})}},18514:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(71847).A)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]])},22743:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>v});var r=s(95155),a=s(12115),l=s(4560),n=s(9219),i=s(38218),o=s(18955),c=s(744),d=s(80344);class u{static getInstance(){return u.instance||(u.instance=new u),u.instance}normalize(e){let t=e.match(/^ssh:\/\/git@([^:\/]+)(:\d+)?\/(.+?)(\.git)?$/);if(t)return"https://".concat(t[1],"/").concat(t[3]).toLowerCase().replace(/\/$/,"");let s=e.match(/^git@([^:]+):(.+?)(\.git)?$/);return s?"https://".concat(s[1],"/").concat(s[2]).toLowerCase().replace(/\/$/,""):e.replace(/\.git\/?$/,"").replace(/\/$/,"").toLowerCase()}isSameRepository(e,t){return this.normalize(e)===this.normalize(t)}extractRepoName(e){let t=e.match(/^ssh:\/\/git@[^\/]+\/(.+?)(\.git)?$/);if(t){let e=t[1].split("/");return e[e.length-1]}let s=e.match(/:(.+?)(\.git)?$/);if(s&&e.startsWith("git@")){let e=s[1].split("/");return e[e.length-1]}let r=e.match(/\/([^\/]+?)(\.git)?$/);return r?r[1]:""}getUrlType(e){return e.startsWith("https://")?"https":e.startsWith("git@")||e.startsWith("ssh://")?"ssh":null}validate(e){if(!e||"string"!=typeof e||""===e.trim())return{valid:!1,error:"EMPTY_URL"};let t=e.trim();return t.startsWith("https://")?/^https:\/\/[^\/]+\/[^\/]+\/[^\/]+(\.git)?$/.test(t)?{valid:!0}:{valid:!1,error:"INVALID_URL_FORMAT"}:t.startsWith("git@")?/^git@[^:]+:.+\/.+(\.git)?$/.test(t)?{valid:!0}:{valid:!1,error:"INVALID_URL_FORMAT"}:t.startsWith("ssh://")?/^ssh:\/\/git@[^\/]+(:\d+)?\/[^\/]+\/.+(\.git)?$/.test(t)?{valid:!0}:{valid:!1,error:"INVALID_URL_FORMAT"}:{valid:!1,error:"INVALID_URL_FORMAT"}}constructor(){}}function m(e){let{onRepositoryAdded:t}=e,s=(0,o.c)("common"),[l,n]=(0,a.useState)(!1),[i,m]=(0,a.useState)("local"),[p,x]=(0,a.useState)(""),[h,g]=(0,a.useState)(""),[f,b]=(0,a.useState)(!1),[v,y]=(0,a.useState)(!1),[j,N]=(0,a.useState)(!1),[w,k]=(0,a.useState)(null),[S,C]=(0,a.useState)(null),[E,R]=(0,a.useState)(null),L=u.getInstance(),$=(0,a.useCallback)(async e=>{try{let a=await d.Rx.getCloneStatus(e);if("completed"===a.status)R(s("repositories.cloneSuccess")),N(!1),k(null),g(""),n(!1),t&&t();else if("failed"===a.status){var r;C((null==(r=a.error)?void 0:r.message)||s("repositories.cloneFailed")),N(!1),k(null)}else("running"===a.status||"pending"===a.status)&&setTimeout(()=>$(e),2e3)}catch(e){C((0,d.hS)(e)),N(!1),k(null)}},[t,s]);(0,a.useEffect)(()=>{w&&j&&$(w)},[w,j]);let A=async e=>{if(e.preventDefault(),!p.trim())return void C(s("repositories.pathRequired"));C(null),R(null),b(!0);try{let e=await d.Rx.scan(p);R(e.message),x(""),n(!1),t&&t()}catch(e){C((0,d.hS)(e))}finally{b(!1)}},D=async e=>{if(e.preventDefault(),!h.trim())return void C(s("repositories.urlRequired"));let t=L.validate(h.trim());if(!t.valid)return void("EMPTY_URL"===t.error?C(s("repositories.urlRequired")):C(s("repositories.urlInvalid")));C(null),R(null),N(!0);try{let e=await d.Rx.clone(h.trim());k(e.jobId)}catch(e){C((0,d.hS)(e)),N(!1)}},_=async()=>{C(null),R(null),y(!0);try{let e=await d.Rx.sync();R(e.message),t&&t()}catch(e){C((0,d.hS)(e))}finally{y(!1)}},z=()=>{n(!1),x(""),g(""),C(null),m("local")};return(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{className:"flex gap-2 flex-wrap",children:[!l&&(0,r.jsxs)(c.$n,{variant:"primary",size:"sm",onClick:()=>n(!0),children:["+ ",s("repositories.add")]}),(0,r.jsx)(c.$n,{variant:"secondary",size:"sm",onClick:_,disabled:v,children:v?s("repositories.syncing"):s("repositories.syncAll")})]}),l&&(0,r.jsx)(c.Zp,{padding:"lg",children:(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)("div",{children:(0,r.jsx)("h3",{className:"text-lg font-semibold mb-2 text-foreground",children:s("repositories.addNewTitle")})}),(0,r.jsxs)(c.tU,{value:i,onValueChange:e=>m(e),children:[(0,r.jsxs)(c.j7,{className:"w-full",children:[(0,r.jsx)(c.Xi,{value:"local",children:s("repositories.localPathTab")}),(0,r.jsx)(c.Xi,{value:"url",children:s("repositories.cloneUrlTab")})]}),(0,r.jsx)(c.av,{value:"local",children:(0,r.jsxs)("form",{onSubmit:A,className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:s("repositories.localPathDescription")}),(0,r.jsx)("label",{htmlFor:"repositoryPath",className:"block text-sm font-medium text-foreground mb-2",children:s("repositories.localPathLabel")}),(0,r.jsx)(c.pd,{id:"repositoryPath",type:"text",value:p,onChange:e=>x(e.target.value),placeholder:"/absolute/path/to/repository",className:"font-mono",disabled:f}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:s("repositories.localPathExample")})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(c.$n,{type:"submit",variant:"primary",disabled:f||!p.trim(),children:f?s("repositories.scanning"):s("repositories.scan")}),(0,r.jsx)(c.$n,{type:"button",variant:"ghost",onClick:z,disabled:f,children:s("cancel")})]})]})}),(0,r.jsx)(c.av,{value:"url",children:(0,r.jsxs)("form",{onSubmit:D,className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:s("repositories.cloneUrlDescription")}),(0,r.jsx)("label",{htmlFor:"cloneUrl",className:"block text-sm font-medium text-foreground mb-2",children:s("repositories.cloneUrlLabel")}),(0,r.jsx)(c.pd,{id:"cloneUrl",type:"text",value:h,onChange:e=>g(e.target.value),placeholder:"https://github.com/user/repo.git",className:"font-mono",disabled:j}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:s("repositories.cloneUrlHelp")})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(c.$n,{type:"submit",variant:"primary",disabled:j||!h.trim(),children:j?s("repositories.cloning"):s("repositories.clone")}),(0,r.jsx)(c.$n,{type:"button",variant:"ghost",onClick:z,disabled:j,children:s("cancel")})]})]})})]})]})}),E&&(0,r.jsx)("div",{className:"p-4 bg-success-subtle border border-success-border rounded-lg",children:(0,r.jsx)("p",{className:"text-sm text-success-foreground",children:E})}),S&&(0,r.jsx)("div",{className:"p-4 bg-danger-subtle border border-danger-border rounded-lg",children:(0,r.jsx)("p",{className:"text-sm text-danger-foreground",children:S})})]})}var p=s(18514),x=s(87531);let h={id:null,value:"",error:null,saving:!1};function g(){return(0,r.jsx)("thead",{className:"bg-muted border-b border-border",children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{className:"px-4 py-2 text-left font-medium text-foreground",children:"Name"}),(0,r.jsx)("th",{className:"px-4 py-2 text-left font-medium text-foreground",children:"Display name"}),(0,r.jsx)("th",{className:"px-4 py-2 text-left font-medium text-foreground",children:"Visibility"}),(0,r.jsx)("th",{className:"px-4 py-2 text-left font-medium text-foreground",children:"Path"}),(0,r.jsx)("th",{className:"px-4 py-2 text-left font-medium text-foreground",children:"Worktrees"}),(0,r.jsx)("th",{className:"px-4 py-2 text-left font-medium text-foreground",children:"Status"}),(0,r.jsx)("th",{className:"px-4 py-2 text-left font-medium text-foreground",children:"Actions"})]})})}function f(e){let{repo:t,pending:s,onToggle:a}=e,l=t.visible;return(0,r.jsxs)("button",{type:"button",role:"switch","aria-checked":l,"aria-label":l?"Hide ".concat(t.name," from sidebar"):"Show ".concat(t.name," in sidebar"),"data-testid":"visibility-toggle-".concat(t.id),onClick:()=>a(t),disabled:s,className:(0,x.cn)("inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-xs font-medium","text-muted-foreground transition-colors","hover:bg-muted hover:text-foreground","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:opacity-60 disabled:cursor-not-allowed"),children:[(0,r.jsx)(c.md,{status:l?"ready":"idle",size:"sm",label:l?"Visible":"Hidden","aria-hidden":"true"}),l?"Visible":"Hidden"]})}let b=(0,a.memo)(function(e){let{refreshKey:t,onChanged:s}=e,l=(0,o.c)("common"),[n,i]=(0,a.useState)([]),[u,m]=(0,a.useState)(!0),[x,b]=(0,a.useState)(null),[v,y]=(0,a.useState)(h),[j,N]=(0,a.useState)(null),[w,k]=(0,a.useState)(new Set),S=(0,a.useCallback)(async()=>{m(!0),b(null);try{let e=await d.Rx.list();i(e.repositories)}catch(e){b((0,d.hS)(e))}finally{m(!1)}},[]);(0,a.useEffect)(()=>{S()},[S,t]);let C=(0,a.useCallback)(e=>{var t;y({id:e.id,value:null!=(t=e.displayName)?t:"",error:null,saving:!1}),N(null)},[]),E=(0,a.useCallback)(()=>{y(h)},[]),R=(0,a.useCallback)(e=>{y(t=>{if(null===t.id)return t;let s=e.length>100?"Display name must be ".concat(100," characters or less"):null;return{...t,value:e,error:s}})},[]),L=(0,a.useCallback)(async e=>{let t=v.value.trim();if(t.length>100)return void y(e=>({...e,error:"Display name must be ".concat(100," characters or less")}));y(e=>({...e,saving:!0,error:null}));try{let r=0===t.length?null:t,a=await d.Rx.updateDisplayName(e.id,r);i(t=>t.map(t=>t.id===e.id?{...t,...a.repository}:t)),y(h),N({type:"success",message:"Display name updated"}),s&&s()}catch(t){let e=(0,d.hS)(t);y(t=>({...t,saving:!1,error:e})),N({type:"error",message:e})}},[v.value,s]),$=(0,a.useCallback)((e,t)=>{"Enter"===e.key?(e.preventDefault(),L(t)):"Escape"===e.key&&(e.preventDefault(),E())},[E,L]),A=(0,a.useCallback)(async e=>{if(w.has(e.id))return;let t=!e.visible;k(t=>{let s=new Set(t);return s.add(e.id),s}),i(s=>s.map(s=>s.id===e.id?{...s,visible:t}:s)),N(null);try{let r=await d.Rx.updateVisibility(e.id,t);i(t=>t.map(t=>t.id===e.id?{...t,...r.repository}:t)),s&&s()}catch(t){i(t=>t.map(t=>t.id===e.id?{...e}:t)),N({type:"error",message:(0,d.hS)(t)})}finally{k(t=>{let s=new Set(t);return s.delete(e.id),s})}},[s,w]);return u&&0===n.length?(0,r.jsx)(c.Zp,{padding:"none",children:(0,r.jsx)("div",{className:"overflow-x-auto","data-testid":"repository-list-loading",role:"status","aria-label":l("repositories.loading"),children:(0,r.jsxs)("table",{className:"min-w-full text-sm",children:[(0,r.jsx)(g,{}),(0,r.jsx)("tbody",{children:[0,1,2].map(e=>(0,r.jsxs)("tr",{className:"border-b border-border",children:[(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsx)(c.EA,{className:"h-4 w-24"})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsx)(c.EA,{className:"h-4 w-20"})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsx)(c.EA,{className:"h-4 w-16"})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsx)(c.EA,{className:"h-4 w-48"})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsx)(c.EA,{className:"h-4 w-10"})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsx)(c.EA,{className:"h-4 w-14"})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsx)(c.EA,{className:"h-4 w-20"})})]},e))})]})})}):x?(0,r.jsx)(c.Zp,{padding:"lg",children:(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("p",{className:"text-sm text-danger-foreground",children:["Failed to load repositories: ",x]}),(0,r.jsx)(c.$n,{variant:"secondary",size:"sm",onClick:()=>void S(),children:"Retry"})]})}):(0,r.jsxs)("div",{className:"space-y-3",children:[j&&(0,r.jsx)("div",{role:"status",className:"p-3 rounded-lg text-sm ".concat("success"===j.type?"bg-success-subtle border border-success-border text-success-foreground":"bg-danger-subtle border border-danger-border text-danger-foreground"),children:j.message}),(0,r.jsx)(c.Zp,{padding:"none",children:(0,r.jsx)("div",{className:"overflow-x-auto",children:(0,r.jsxs)("table",{className:"min-w-full text-sm",children:[(0,r.jsx)(g,{}),(0,r.jsxs)("tbody",{children:[0===n.length&&(0,r.jsx)("tr",{children:(0,r.jsx)("td",{colSpan:7,className:"px-4 py-6 text-center text-muted-foreground",children:l("repositories.empty")})}),n.map(e=>{let t=v.id===e.id;return(0,r.jsxs)("tr",{className:"border-b border-border","data-testid":"repository-row-".concat(e.id),children:[(0,r.jsx)("td",{className:"px-4 py-3 align-top text-foreground",children:e.name}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:t?(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)(c.pd,{"aria-label":"Edit display name for ".concat(e.name),type:"text",value:v.value,disabled:v.saving,maxLength:101,onChange:e=>R(e.target.value),onKeyDown:t=>$(t,e)}),v.error&&(0,r.jsx)("p",{className:"text-xs text-danger-foreground",children:v.error})]}):e.displayName?(0,r.jsx)("span",{className:"text-foreground",children:e.displayName}):(0,r.jsx)("span",{className:"text-muted-foreground","aria-hidden":"true",children:"—"})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsx)(f,{repo:e,pending:w.has(e.id),onToggle:A})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsx)("span",{className:"block max-w-[240px] truncate font-mono text-xs text-muted-foreground",title:e.path,children:e.path})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top text-foreground",children:e.worktreeCount}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground",children:[(0,r.jsx)(c.md,{status:e.enabled?"ready":"idle",size:"sm",label:e.enabled?"Enabled":"Disabled","aria-hidden":"true"}),e.enabled?"Enabled":"Disabled"]})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:t?(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(c.$n,{variant:"primary",size:"sm",onClick:()=>void L(e),disabled:v.saving||null!==v.error,children:v.saving?"Saving...":"Save"}),(0,r.jsx)(c.$n,{variant:"ghost",size:"sm",onClick:E,disabled:v.saving,children:"Cancel"})]}):(0,r.jsx)(c.$n,{variant:"ghost",size:"sm",className:"px-2",onClick:()=>C(e),"aria-label":"Edit display name for ".concat(e.name),children:(0,r.jsx)(p.A,{className:"h-4 w-4","aria-hidden":"true"})})})]},e.id)})]})]})})})]})});function v(){let e=(0,i.a)(),[t,s]=(0,a.useState)(0),o=(0,a.useCallback)(()=>{s(e=>e+1)},[]),c=(0,a.useCallback)(async()=>{s(e=>e+1),await new Promise(e=>setTimeout(e,500))},[]);return(0,r.jsx)(l.GV,{children:(0,r.jsxs)(n.k,{onRefresh:c,enabled:e,className:"container-custom py-8 h-full",children:[(0,r.jsxs)("div",{className:"mb-6",children:[(0,r.jsx)("h1",{className:"text-2xl font-bold text-foreground mb-2",children:"Repositories"}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"Manage repositories and worktrees."})]}),(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsx)(m,{onRepositoryAdded:o}),(0,r.jsx)(b,{refreshKey:t,onChanged:o})]})]})})}}},e=>{e.O(0,[6809,4909,2770,790,4974,6402,744,6488,4560,8441,1255,7358],()=>e(e.s=540)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3135],{540:(e,t,s)=>{Promise.resolve().then(s.bind(s,22743))},9219:(e,t,s)=>{"use strict";s.d(t,{k:()=>n});var r=s(95155),a=s(12115),l=s(744),i=s(87531);function n(e){let{onRefresh:t,enabled:s=!0,className:n,children:o}=e,{containerRef:c,pullDistance:d,isRefreshing:u,isPulling:m}=function(e){let{onRefresh:t,enabled:s=!0,threshold:r=64,maxPull:l=96,resistance:i=.5}=e,n=(0,a.useRef)(null),[o,c]=(0,a.useState)(0),[d,u]=(0,a.useState)(!1),[m,p]=(0,a.useState)(!1),x=(0,a.useRef)(null),h=(0,a.useRef)(0),g=(0,a.useRef)(!1);g.current=d;let f=(0,a.useCallback)(()=>{x.current=null,h.current=0,c(0),p(!1)},[]),b=(0,a.useCallback)(e=>{if(!s||g.current)return;let t=n.current;t&&!(t.scrollTop>0)&&(x.current=e.touches[0].clientY,h.current=0)},[s]),v=(0,a.useCallback)(e=>{if(null===x.current)return;let t=n.current;if(!t)return;if(t.scrollTop>0)return void f();let s=e.touches[0].clientY-x.current;if(s<=0){0!==h.current&&(h.current=0,c(0),p(!1));return}e.cancelable&&e.preventDefault();let r=Math.min(s*i,l);h.current=r,c(r),p(!0)},[i,l,f]),j=(0,a.useCallback)(async()=>{u(!0),p(!1),c(r);try{await Promise.resolve(t())}finally{u(!1),c(0)}},[t,r]),y=(0,a.useCallback)(()=>{if(null===x.current)return;let e=h.current>=r&&!g.current;x.current=null,h.current=0,e?j():(c(0),p(!1))},[r,j]);return(0,a.useEffect)(()=>{let e=n.current;if(e)return e.addEventListener("touchstart",b,{passive:!0}),e.addEventListener("touchmove",v,{passive:!1}),e.addEventListener("touchend",y,{passive:!0}),e.addEventListener("touchcancel",y,{passive:!0}),()=>{e.removeEventListener("touchstart",b),e.removeEventListener("touchmove",v),e.removeEventListener("touchend",y),e.removeEventListener("touchcancel",y)}},[b,v,y]),{containerRef:n,pullDistance:o,isRefreshing:d,isPulling:m}}({onRefresh:t,enabled:s,threshold:64}),p=u||d>0,x=u?1:Math.min(d/64,1);return(0,r.jsxs)("div",{ref:c,className:(0,i.cn)("relative overflow-auto",n),style:{overscrollBehaviorY:"contain"},"data-testid":"pull-to-refresh",children:[(0,r.jsx)("div",{className:"pointer-events-none absolute inset-x-0 top-0 z-10 flex justify-center",style:{transform:"translateY(".concat(p?Math.max(d-24,8):-32,"px)"),opacity:x,transition:m?"none":"transform 0.2s ease-out, opacity 0.2s ease-out"},"data-testid":"pull-to-refresh-indicator",role:"status","aria-hidden":!u,children:(0,r.jsx)(l.y$,{size:"sm",variant:"accent"})}),(0,r.jsx)("div",{style:{transform:p?"translateY(".concat(d,"px)"):void 0,transition:m?"none":"transform 0.2s ease-out"},children:o})]})}},18514:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(71847).A)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]])},22743:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>v});var r=s(95155),a=s(12115),l=s(4560),i=s(9219),n=s(38218),o=s(18955),c=s(744),d=s(80344);class u{static getInstance(){return u.instance||(u.instance=new u),u.instance}normalize(e){let t=e.match(/^ssh:\/\/git@([^:\/]+)(:\d+)?\/(.+?)(\.git)?$/);if(t)return"https://".concat(t[1],"/").concat(t[3]).toLowerCase().replace(/\/$/,"");let s=e.match(/^git@([^:]+):(.+?)(\.git)?$/);return s?"https://".concat(s[1],"/").concat(s[2]).toLowerCase().replace(/\/$/,""):e.replace(/\.git\/?$/,"").replace(/\/$/,"").toLowerCase()}isSameRepository(e,t){return this.normalize(e)===this.normalize(t)}extractRepoName(e){let t=e.match(/^ssh:\/\/git@[^\/]+\/(.+?)(\.git)?$/);if(t){let e=t[1].split("/");return e[e.length-1]}let s=e.match(/:(.+?)(\.git)?$/);if(s&&e.startsWith("git@")){let e=s[1].split("/");return e[e.length-1]}let r=e.match(/\/([^\/]+?)(\.git)?$/);return r?r[1]:""}getUrlType(e){return e.startsWith("https://")?"https":e.startsWith("git@")||e.startsWith("ssh://")?"ssh":null}validate(e){if(!e||"string"!=typeof e||""===e.trim())return{valid:!1,error:"EMPTY_URL"};let t=e.trim();return t.startsWith("https://")?/^https:\/\/[^\/]+\/[^\/]+\/[^\/]+(\.git)?$/.test(t)?{valid:!0}:{valid:!1,error:"INVALID_URL_FORMAT"}:t.startsWith("git@")?/^git@[^:]+:.+\/.+(\.git)?$/.test(t)?{valid:!0}:{valid:!1,error:"INVALID_URL_FORMAT"}:t.startsWith("ssh://")?/^ssh:\/\/git@[^\/]+(:\d+)?\/[^\/]+\/.+(\.git)?$/.test(t)?{valid:!0}:{valid:!1,error:"INVALID_URL_FORMAT"}:{valid:!1,error:"INVALID_URL_FORMAT"}}constructor(){}}function m(e){let{onRepositoryAdded:t}=e,s=(0,o.c)("common"),[l,i]=(0,a.useState)(!1),[n,m]=(0,a.useState)("local"),[p,x]=(0,a.useState)(""),[h,g]=(0,a.useState)(""),[f,b]=(0,a.useState)(!1),[v,j]=(0,a.useState)(!1),[y,N]=(0,a.useState)(!1),[k,w]=(0,a.useState)(!1),[C,S]=(0,a.useState)(null),[E,R]=(0,a.useState)(null),[L,$]=(0,a.useState)(null),A=u.getInstance(),D=(0,a.useCallback)(async e=>{try{let a=await d.Rx.getCloneStatus(e);if("completed"===a.status)$(s("repositories.cloneSuccess")),w(!1),S(null),g(""),b(!1),i(!1),t&&t();else if("failed"===a.status){var r;R((null==(r=a.error)?void 0:r.message)||s("repositories.cloneFailed")),w(!1),S(null)}else("running"===a.status||"pending"===a.status)&&setTimeout(()=>D(e),2e3)}catch(e){R((0,d.hS)(e)),w(!1),S(null)}},[t,s]);(0,a.useEffect)(()=>{C&&k&&D(C)},[C,k]);let _=async e=>{if(e.preventDefault(),!p.trim())return void R(s("repositories.pathRequired"));R(null),$(null),j(!0);try{let e=await d.Rx.scan(p);$(e.message),x(""),i(!1),t&&t()}catch(e){R((0,d.hS)(e))}finally{j(!1)}},z=async e=>{if(e.preventDefault(),!h.trim())return void R(s("repositories.urlRequired"));let t=A.validate(h.trim());if(!t.valid)return void("EMPTY_URL"===t.error?R(s("repositories.urlRequired")):R(s("repositories.urlInvalid")));R(null),$(null),w(!0);try{let e=await d.Rx.clone(h.trim(),{fork:f});S(e.jobId)}catch(e){R((0,d.hS)(e)),w(!1)}},T=async()=>{R(null),$(null),N(!0);try{let e=await d.Rx.sync();$(e.message),t&&t()}catch(e){R((0,d.hS)(e))}finally{N(!1)}},U=()=>{i(!1),x(""),g(""),b(!1),R(null),m("local")};return(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{className:"flex gap-2 flex-wrap",children:[!l&&(0,r.jsxs)(c.$n,{variant:"primary",size:"sm",onClick:()=>i(!0),children:["+ ",s("repositories.add")]}),(0,r.jsx)(c.$n,{variant:"secondary",size:"sm",onClick:T,disabled:y,children:y?s("repositories.syncing"):s("repositories.syncAll")})]}),l&&(0,r.jsx)(c.Zp,{padding:"lg",children:(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)("div",{children:(0,r.jsx)("h3",{className:"text-lg font-semibold mb-2 text-foreground",children:s("repositories.addNewTitle")})}),(0,r.jsxs)(c.tU,{value:n,onValueChange:e=>m(e),children:[(0,r.jsxs)(c.j7,{className:"w-full",children:[(0,r.jsx)(c.Xi,{value:"local",children:s("repositories.localPathTab")}),(0,r.jsx)(c.Xi,{value:"url",children:s("repositories.cloneUrlTab")})]}),(0,r.jsx)(c.av,{value:"local",children:(0,r.jsxs)("form",{onSubmit:_,className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:s("repositories.localPathDescription")}),(0,r.jsx)("label",{htmlFor:"repositoryPath",className:"block text-sm font-medium text-foreground mb-2",children:s("repositories.localPathLabel")}),(0,r.jsx)(c.pd,{id:"repositoryPath",type:"text",value:p,onChange:e=>x(e.target.value),placeholder:"/absolute/path/to/repository",className:"font-mono",disabled:v}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:s("repositories.localPathExample")})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(c.$n,{type:"submit",variant:"primary",disabled:v||!p.trim(),children:v?s("repositories.scanning"):s("repositories.scan")}),(0,r.jsx)(c.$n,{type:"button",variant:"ghost",onClick:U,disabled:v,children:s("cancel")})]})]})}),(0,r.jsx)(c.av,{value:"url",children:(0,r.jsxs)("form",{onSubmit:z,className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:s("repositories.cloneUrlDescription")}),(0,r.jsx)("label",{htmlFor:"cloneUrl",className:"block text-sm font-medium text-foreground mb-2",children:s("repositories.cloneUrlLabel")}),(0,r.jsx)(c.pd,{id:"cloneUrl",type:"text",value:h,onChange:e=>g(e.target.value),placeholder:"https://github.com/user/repo.git",className:"font-mono",disabled:k}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:s("repositories.cloneUrlHelp")})]}),(0,r.jsxs)("div",{className:"flex items-start gap-2",children:[(0,r.jsx)("input",{id:"forkBeforeClone",type:"checkbox",checked:f,onChange:e=>b(e.target.checked),disabled:k,className:"mt-1"}),(0,r.jsxs)("label",{htmlFor:"forkBeforeClone",className:"text-sm text-foreground",children:[s("repositories.forkOptionLabel"),(0,r.jsx)("span",{className:"block text-xs text-muted-foreground",children:s("repositories.forkOptionHelp")})]})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(c.$n,{type:"submit",variant:"primary",disabled:k||!h.trim(),children:k?s("repositories.cloning"):f?s("repositories.forkAndClone"):s("repositories.clone")}),(0,r.jsx)(c.$n,{type:"button",variant:"ghost",onClick:U,disabled:k,children:s("cancel")})]})]})})]})]})}),L&&(0,r.jsx)("div",{className:"p-4 bg-success-subtle border border-success-border rounded-lg",children:(0,r.jsx)("p",{className:"text-sm text-success-foreground",children:L})}),E&&(0,r.jsx)("div",{className:"p-4 bg-danger-subtle border border-danger-border rounded-lg",children:(0,r.jsx)("p",{className:"text-sm text-danger-foreground",children:E})})]})}var p=s(18514),x=s(87531);let h={id:null,value:"",error:null,saving:!1};function g(){return(0,r.jsx)("thead",{className:"bg-muted border-b border-border",children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{className:"px-4 py-2 text-left font-medium text-foreground",children:"Name"}),(0,r.jsx)("th",{className:"px-4 py-2 text-left font-medium text-foreground",children:"Display name"}),(0,r.jsx)("th",{className:"px-4 py-2 text-left font-medium text-foreground",children:"Visibility"}),(0,r.jsx)("th",{className:"px-4 py-2 text-left font-medium text-foreground",children:"Path"}),(0,r.jsx)("th",{className:"px-4 py-2 text-left font-medium text-foreground",children:"Worktrees"}),(0,r.jsx)("th",{className:"px-4 py-2 text-left font-medium text-foreground",children:"Status"}),(0,r.jsx)("th",{className:"px-4 py-2 text-left font-medium text-foreground",children:"Actions"})]})})}function f(e){let{repo:t,pending:s,onToggle:a}=e,l=t.visible;return(0,r.jsxs)("button",{type:"button",role:"switch","aria-checked":l,"aria-label":l?"Hide ".concat(t.name," from sidebar"):"Show ".concat(t.name," in sidebar"),"data-testid":"visibility-toggle-".concat(t.id),onClick:()=>a(t),disabled:s,className:(0,x.cn)("inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-xs font-medium","text-muted-foreground transition-colors","hover:bg-muted hover:text-foreground","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:opacity-60 disabled:cursor-not-allowed"),children:[(0,r.jsx)(c.md,{status:l?"ready":"idle",size:"sm",label:l?"Visible":"Hidden","aria-hidden":"true"}),l?"Visible":"Hidden"]})}let b=(0,a.memo)(function(e){let{refreshKey:t,onChanged:s}=e,l=(0,o.c)("common"),[i,n]=(0,a.useState)([]),[u,m]=(0,a.useState)(!0),[x,b]=(0,a.useState)(null),[v,j]=(0,a.useState)(h),[y,N]=(0,a.useState)(null),[k,w]=(0,a.useState)(new Set),C=(0,a.useCallback)(async()=>{m(!0),b(null);try{let e=await d.Rx.list();n(e.repositories)}catch(e){b((0,d.hS)(e))}finally{m(!1)}},[]);(0,a.useEffect)(()=>{C()},[C,t]);let S=(0,a.useCallback)(e=>{var t;j({id:e.id,value:null!=(t=e.displayName)?t:"",error:null,saving:!1}),N(null)},[]),E=(0,a.useCallback)(()=>{j(h)},[]),R=(0,a.useCallback)(e=>{j(t=>{if(null===t.id)return t;let s=e.length>100?"Display name must be ".concat(100," characters or less"):null;return{...t,value:e,error:s}})},[]),L=(0,a.useCallback)(async e=>{let t=v.value.trim();if(t.length>100)return void j(e=>({...e,error:"Display name must be ".concat(100," characters or less")}));j(e=>({...e,saving:!0,error:null}));try{let r=0===t.length?null:t,a=await d.Rx.updateDisplayName(e.id,r);n(t=>t.map(t=>t.id===e.id?{...t,...a.repository}:t)),j(h),N({type:"success",message:"Display name updated"}),s&&s()}catch(t){let e=(0,d.hS)(t);j(t=>({...t,saving:!1,error:e})),N({type:"error",message:e})}},[v.value,s]),$=(0,a.useCallback)((e,t)=>{"Enter"===e.key?(e.preventDefault(),L(t)):"Escape"===e.key&&(e.preventDefault(),E())},[E,L]),A=(0,a.useCallback)(async e=>{if(k.has(e.id))return;let t=!e.visible;w(t=>{let s=new Set(t);return s.add(e.id),s}),n(s=>s.map(s=>s.id===e.id?{...s,visible:t}:s)),N(null);try{let r=await d.Rx.updateVisibility(e.id,t);n(t=>t.map(t=>t.id===e.id?{...t,...r.repository}:t)),s&&s()}catch(t){n(t=>t.map(t=>t.id===e.id?{...e}:t)),N({type:"error",message:(0,d.hS)(t)})}finally{w(t=>{let s=new Set(t);return s.delete(e.id),s})}},[s,k]);return u&&0===i.length?(0,r.jsx)(c.Zp,{padding:"none",children:(0,r.jsx)("div",{className:"overflow-x-auto","data-testid":"repository-list-loading",role:"status","aria-label":l("repositories.loading"),children:(0,r.jsxs)("table",{className:"min-w-full text-sm",children:[(0,r.jsx)(g,{}),(0,r.jsx)("tbody",{children:[0,1,2].map(e=>(0,r.jsxs)("tr",{className:"border-b border-border",children:[(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsx)(c.EA,{className:"h-4 w-24"})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsx)(c.EA,{className:"h-4 w-20"})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsx)(c.EA,{className:"h-4 w-16"})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsx)(c.EA,{className:"h-4 w-48"})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsx)(c.EA,{className:"h-4 w-10"})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsx)(c.EA,{className:"h-4 w-14"})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsx)(c.EA,{className:"h-4 w-20"})})]},e))})]})})}):x?(0,r.jsx)(c.Zp,{padding:"lg",children:(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("p",{className:"text-sm text-danger-foreground",children:["Failed to load repositories: ",x]}),(0,r.jsx)(c.$n,{variant:"secondary",size:"sm",onClick:()=>void C(),children:"Retry"})]})}):(0,r.jsxs)("div",{className:"space-y-3",children:[y&&(0,r.jsx)("div",{role:"status",className:"p-3 rounded-lg text-sm ".concat("success"===y.type?"bg-success-subtle border border-success-border text-success-foreground":"bg-danger-subtle border border-danger-border text-danger-foreground"),children:y.message}),(0,r.jsx)(c.Zp,{padding:"none",children:(0,r.jsx)("div",{className:"overflow-x-auto",children:(0,r.jsxs)("table",{className:"min-w-full text-sm",children:[(0,r.jsx)(g,{}),(0,r.jsxs)("tbody",{children:[0===i.length&&(0,r.jsx)("tr",{children:(0,r.jsx)("td",{colSpan:7,className:"px-4 py-6 text-center text-muted-foreground",children:l("repositories.empty")})}),i.map(e=>{let t=v.id===e.id;return(0,r.jsxs)("tr",{className:"border-b border-border","data-testid":"repository-row-".concat(e.id),children:[(0,r.jsx)("td",{className:"px-4 py-3 align-top text-foreground",children:e.name}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:t?(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)(c.pd,{"aria-label":"Edit display name for ".concat(e.name),type:"text",value:v.value,disabled:v.saving,maxLength:101,onChange:e=>R(e.target.value),onKeyDown:t=>$(t,e)}),v.error&&(0,r.jsx)("p",{className:"text-xs text-danger-foreground",children:v.error})]}):e.displayName?(0,r.jsx)("span",{className:"text-foreground",children:e.displayName}):(0,r.jsx)("span",{className:"text-muted-foreground","aria-hidden":"true",children:"—"})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsx)(f,{repo:e,pending:k.has(e.id),onToggle:A})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsx)("span",{className:"block max-w-[240px] truncate font-mono text-xs text-muted-foreground",title:e.path,children:e.path})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top text-foreground",children:e.worktreeCount}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground",children:[(0,r.jsx)(c.md,{status:e.enabled?"ready":"idle",size:"sm",label:e.enabled?"Enabled":"Disabled","aria-hidden":"true"}),e.enabled?"Enabled":"Disabled"]})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:t?(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(c.$n,{variant:"primary",size:"sm",onClick:()=>void L(e),disabled:v.saving||null!==v.error,children:v.saving?"Saving...":"Save"}),(0,r.jsx)(c.$n,{variant:"ghost",size:"sm",onClick:E,disabled:v.saving,children:"Cancel"})]}):(0,r.jsx)(c.$n,{variant:"ghost",size:"sm",className:"px-2",onClick:()=>S(e),"aria-label":"Edit display name for ".concat(e.name),children:(0,r.jsx)(p.A,{className:"h-4 w-4","aria-hidden":"true"})})})]},e.id)})]})]})})})]})});function v(){let e=(0,n.a)(),[t,s]=(0,a.useState)(0),o=(0,a.useCallback)(()=>{s(e=>e+1)},[]),c=(0,a.useCallback)(async()=>{s(e=>e+1),await new Promise(e=>setTimeout(e,500))},[]);return(0,r.jsx)(l.GV,{children:(0,r.jsxs)(i.k,{onRefresh:c,enabled:e,className:"container-custom py-8 h-full",children:[(0,r.jsxs)("div",{className:"mb-6",children:[(0,r.jsx)("h1",{className:"text-2xl font-bold text-foreground mb-2",children:"Repositories"}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"Manage repositories and worktrees."})]}),(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsx)(m,{onRepositoryAdded:o}),(0,r.jsx)(b,{refreshKey:t,onChanged:o})]})]})})}}},e=>{e.O(0,[6809,4909,2770,790,4974,6402,744,6488,4560,8441,1255,7358],()=>e(e.s=540)),_N_E=e.O()}]);