tower-studio 0.2.41 → 0.2.42

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 (282) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/app-path-routes-manifest.json +2 -0
  3. package/.next/standalone/.next/build-manifest.json +3 -3
  4. package/.next/standalone/.next/prerender-manifest.json +3 -3
  5. package/.next/standalone/.next/routes-manifest.json +16 -0
  6. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  7. package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
  8. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  9. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  10. package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  11. package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  12. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  13. package/.next/standalone/.next/server/app/_not-found/page/react-loadable-manifest.json +2 -2
  14. package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +27 -27
  15. package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
  16. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  17. package/.next/standalone/.next/server/app/api/adapters/test/route.js +2 -2
  18. package/.next/standalone/.next/server/app/api/adapters/test/route.js.nft.json +1 -1
  19. package/.next/standalone/.next/server/app/api/browse-fs/route.js.nft.json +1 -1
  20. package/.next/standalone/.next/server/app/api/files/assets/[projectId]/[filename]/route.js.nft.json +1 -1
  21. package/.next/standalone/.next/server/app/api/git/route.js.nft.json +1 -1
  22. package/.next/standalone/.next/server/app/api/internal/assets/[projectId]/[filename]/route.js.nft.json +1 -1
  23. package/.next/standalone/.next/server/app/api/internal/assets/reveal/route.js.nft.json +1 -1
  24. package/.next/standalone/.next/server/app/api/internal/assistant/attachments/route.js +1 -1
  25. package/.next/standalone/.next/server/app/api/internal/assistant/attachments/route.js.nft.json +1 -1
  26. package/.next/standalone/.next/server/app/api/internal/assistant/chat/route.js +1 -1
  27. package/.next/standalone/.next/server/app/api/internal/assistant/chat/route.js.nft.json +1 -1
  28. package/.next/standalone/.next/server/app/api/internal/assistant/route.js +1 -1
  29. package/.next/standalone/.next/server/app/api/internal/assistant/route.js.nft.json +1 -1
  30. package/.next/standalone/.next/server/app/api/internal/assistant/sessions/route.js +1 -1
  31. package/.next/standalone/.next/server/app/api/internal/assistant/sessions/route.js.nft.json +1 -1
  32. package/.next/standalone/.next/server/app/api/internal/backup/import/route.js +1 -1
  33. package/.next/standalone/.next/server/app/api/internal/backup/import/route.js.nft.json +1 -1
  34. package/.next/standalone/.next/server/app/api/internal/cache/[...segments]/route.js.nft.json +1 -1
  35. package/.next/standalone/.next/server/app/api/internal/hooks/install/route.js +2 -3
  36. package/.next/standalone/.next/server/app/api/internal/hooks/install/route.js.nft.json +1 -1
  37. package/.next/standalone/.next/server/app/api/internal/hooks/stop/route.js +1 -1
  38. package/.next/standalone/.next/server/app/api/internal/hooks/stop/route.js.nft.json +1 -1
  39. package/.next/standalone/.next/server/app/api/internal/hooks/upload/route.js +1 -1
  40. package/.next/standalone/.next/server/app/api/internal/hooks/upload/route.js.nft.json +1 -1
  41. package/.next/standalone/.next/server/app/api/internal/monaco/[...path]/route.js.nft.json +1 -1
  42. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/resume/route/app-paths-manifest.json +3 -0
  43. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/resume/route/build-manifest.json +9 -0
  44. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/resume/route/server-reference-manifest.json +4 -0
  45. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/resume/route.js +11 -0
  46. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/resume/route.js.nft.json +1 -0
  47. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/resume/route_client-reference-manifest.js +3 -0
  48. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/start/route.js +5 -5
  49. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/start/route.js.nft.json +1 -1
  50. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/stop/route/app-paths-manifest.json +3 -0
  51. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/stop/route/build-manifest.json +9 -0
  52. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/stop/route/server-reference-manifest.json +4 -0
  53. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/stop/route.js +11 -0
  54. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/stop/route.js.nft.json +1 -0
  55. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/stop/route_client-reference-manifest.js +3 -0
  56. package/.next/standalone/.next/server/app/api/tasks/[taskId]/diff/route.js +1 -1
  57. package/.next/standalone/.next/server/app/api/tasks/[taskId]/diff/route.js.nft.json +1 -1
  58. package/.next/standalone/.next/server/app/api/tasks/[taskId]/diff-patch/route.js +1 -1
  59. package/.next/standalone/.next/server/app/api/tasks/[taskId]/diff-patch/route.js.nft.json +1 -1
  60. package/.next/standalone/.next/server/app/api/tasks/[taskId]/merge/route.js +1 -1
  61. package/.next/standalone/.next/server/app/api/tasks/[taskId]/merge/route.js.nft.json +1 -1
  62. package/.next/standalone/.next/server/app/missions/page/react-loadable-manifest.json +1 -1
  63. package/.next/standalone/.next/server/app/missions/page/server-reference-manifest.json +116 -116
  64. package/.next/standalone/.next/server/app/missions/page.js +2 -3
  65. package/.next/standalone/.next/server/app/missions/page.js.nft.json +1 -1
  66. package/.next/standalone/.next/server/app/missions/page_client-reference-manifest.js +1 -1
  67. package/.next/standalone/.next/server/app/onboarding/page/react-loadable-manifest.json +2 -2
  68. package/.next/standalone/.next/server/app/onboarding/page/server-reference-manifest.json +27 -27
  69. package/.next/standalone/.next/server/app/onboarding/page.js.nft.json +1 -1
  70. package/.next/standalone/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
  71. package/.next/standalone/.next/server/app/page/react-loadable-manifest.json +2 -2
  72. package/.next/standalone/.next/server/app/page/server-reference-manifest.json +27 -27
  73. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  74. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  75. package/.next/standalone/.next/server/app/settings/page/react-loadable-manifest.json +2 -2
  76. package/.next/standalone/.next/server/app/settings/page/server-reference-manifest.json +44 -44
  77. package/.next/standalone/.next/server/app/settings/page.js.nft.json +1 -1
  78. package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  79. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page/react-loadable-manifest.json +2 -2
  80. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page/server-reference-manifest.json +112 -100
  81. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page.js.nft.json +1 -1
  82. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page_client-reference-manifest.js +1 -1
  83. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page/react-loadable-manifest.json +2 -2
  84. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page/server-reference-manifest.json +91 -79
  85. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page.js.nft.json +1 -1
  86. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page_client-reference-manifest.js +1 -1
  87. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page/react-loadable-manifest.json +2 -2
  88. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page/server-reference-manifest.json +80 -68
  89. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page.js.nft.json +1 -1
  90. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page_client-reference-manifest.js +1 -1
  91. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page/react-loadable-manifest.json +2 -2
  92. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page/server-reference-manifest.json +69 -69
  93. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page.js.nft.json +1 -1
  94. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page_client-reference-manifest.js +1 -1
  95. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page/react-loadable-manifest.json +2 -2
  96. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page/server-reference-manifest.json +27 -27
  97. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page.js.nft.json +1 -1
  98. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page_client-reference-manifest.js +1 -1
  99. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page/react-loadable-manifest.json +2 -2
  100. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page/server-reference-manifest.json +71 -71
  101. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page.js.nft.json +1 -1
  102. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page_client-reference-manifest.js +1 -1
  103. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page/react-loadable-manifest.json +3 -3
  104. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page/server-reference-manifest.json +88 -76
  105. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page.js.nft.json +1 -1
  106. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
  107. package/.next/standalone/.next/server/app/workspaces/page/react-loadable-manifest.json +2 -2
  108. package/.next/standalone/.next/server/app/workspaces/page/server-reference-manifest.json +57 -45
  109. package/.next/standalone/.next/server/app/workspaces/page.js.nft.json +1 -1
  110. package/.next/standalone/.next/server/app/workspaces/page_client-reference-manifest.js +1 -1
  111. package/.next/standalone/.next/server/app-paths-manifest.json +2 -0
  112. package/.next/standalone/.next/server/chunks/0se9_next_dist_esm_build_templates_app-route_0eh8dj_.js +5 -5
  113. package/.next/standalone/.next/server/chunks/0zjb_server_app_api_internal_terminal_[taskId]_resume_route_actions_0uascj..js +3 -0
  114. package/.next/standalone/.next/server/chunks/0zjb_server_app_api_internal_terminal_[taskId]_stop_route_actions_0r3bvc-.js +3 -0
  115. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0.tbb~k._.js +3 -0
  116. package/.next/standalone/.next/server/chunks/[root-of-the-server]__05zlbau._.js +4 -0
  117. package/.next/standalone/.next/server/chunks/[root-of-the-server]__06qz5fz._.js +4 -0
  118. package/.next/standalone/.next/server/chunks/[root-of-the-server]__075f7rs._.js +4 -0
  119. package/.next/standalone/.next/server/chunks/[root-of-the-server]__08b~~wj._.js +3 -0
  120. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__037x-0a._.js → [root-of-the-server]__0askhfg._.js} +4 -4
  121. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__04u7b2g._.js → [root-of-the-server]__0bo_6v~._.js} +2 -2
  122. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0e~6fr~._.js +3 -0
  123. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0kexk71._.js → [root-of-the-server]__0fxmnch._.js} +3 -3
  124. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0gr~8aq._.js +3 -0
  125. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0hd.0to._.js +3 -0
  126. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0g2lv9x._.js → [root-of-the-server]__0j3l3l4._.js} +2 -2
  127. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0fp8qv9._.js → [root-of-the-server]__0obk~80._.js} +2 -2
  128. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__05nz.tg._.js → [root-of-the-server]__0skk0fd._.js} +2 -2
  129. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0ag-i9m._.js → [root-of-the-server]__0v2nkck._.js} +2 -2
  130. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0~6py0f._.js +4 -0
  131. package/.next/standalone/.next/server/chunks/[root-of-the-server]__126b53k._.js +4 -0
  132. package/.next/standalone/.next/server/chunks/_0aflzks._.js +7 -0
  133. package/.next/standalone/.next/server/chunks/_0b~hjvi._.js +7 -0
  134. package/.next/standalone/.next/server/chunks/_0qk_esg._.js +4 -0
  135. package/.next/standalone/.next/server/chunks/src_02ruq-1._.js +1 -1
  136. package/.next/standalone/.next/server/chunks/src_07gek7k._.js +3 -0
  137. package/.next/standalone/.next/server/chunks/src_0mqkaid._.js +3 -0
  138. package/.next/standalone/.next/server/chunks/src_actions_agent-actions_ts_10q9r5b._.js +4 -0
  139. package/.next/standalone/.next/server/chunks/ssr/0iu._[workspaceId]_projects_[projectId]_versions_version-timeline-client_tsx_07o_kyi._.js +1 -1
  140. package/.next/standalone/.next/server/chunks/ssr/{0ws9_lucide-react_dist_esm_icons_10_90yo._.js → 0ws9_lucide-react_dist_esm_icons_0pkla8j._.js} +2 -2
  141. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0.-z9ts._.js +1 -1
  142. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__038u_kv._.js +3 -3
  143. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__045k323._.js +3 -0
  144. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__04wbr9x._.js +1 -1
  145. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__058rbx5._.js +3 -3
  146. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__05xg05r._.js +1 -1
  147. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__087pocz._.js +3 -0
  148. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0c2mh1c._.js +47 -0
  149. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0ce3fpq._.js +3 -3
  150. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0dsaqeq._.js +3 -0
  151. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0gt5dbj._.js +3 -0
  152. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0h-se8t._.js +3 -0
  153. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0h589~0._.js +3 -3
  154. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0jymb~t._.js +1 -1
  155. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0oq-j16._.js +3 -3
  156. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0whlq2_._.js +4 -0
  157. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0z7je5_._.js +1 -1
  158. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__10s67lq._.js +3 -3
  159. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__12w35bx._.js +3 -3
  160. package/.next/standalone/.next/server/chunks/ssr/_0-~9em3._.js +1 -1
  161. package/.next/standalone/.next/server/chunks/ssr/_03lt1_x._.js +3 -3
  162. package/.next/standalone/.next/server/chunks/ssr/_04~zqvy._.js +3 -3
  163. package/.next/standalone/.next/server/chunks/ssr/_070t_mh._.js +2 -2
  164. package/.next/standalone/.next/server/chunks/ssr/{_0_z-t6g._.js → _08bq4g8._.js} +2 -2
  165. package/.next/standalone/.next/server/chunks/ssr/{_0t863nl._.js → _09z2zmm._.js} +1 -1
  166. package/.next/standalone/.next/server/chunks/ssr/_0_5abui._.js +3 -0
  167. package/.next/standalone/.next/server/chunks/ssr/_0axcfvf._.js +3 -0
  168. package/.next/standalone/.next/server/chunks/ssr/_0c2gong._.js +3 -0
  169. package/.next/standalone/.next/server/chunks/ssr/_0cj9a7y._.js +1 -1
  170. package/.next/standalone/.next/server/chunks/ssr/{_0ecu98s._.js → _0dye20y._.js} +2 -2
  171. package/.next/standalone/.next/server/chunks/ssr/{_0dzx554._.js → _0f~l8kv._.js} +3 -3
  172. package/.next/standalone/.next/server/chunks/ssr/{_04mn9go._.js → _0m.wslt._.js} +2 -2
  173. package/.next/standalone/.next/server/chunks/ssr/_0o2tntr._.js +3 -0
  174. package/.next/standalone/.next/server/chunks/ssr/_0p6p_68._.js +3 -3
  175. package/.next/standalone/.next/server/chunks/ssr/{_0u_uywm._.js → _0q2mf9q._.js} +1 -1
  176. package/.next/standalone/.next/server/chunks/ssr/_0rdyrfd._.js +1 -1
  177. package/.next/standalone/.next/server/chunks/ssr/{_0_6ss3p._.js → _0rq68d8._.js} +2 -2
  178. package/.next/standalone/.next/server/chunks/ssr/{_0hh17jg._.js → _0rxeqmo._.js} +2 -2
  179. package/.next/standalone/.next/server/chunks/ssr/{_0tsu0gq._.js → _0u.n7v8._.js} +2 -2
  180. package/.next/standalone/.next/server/chunks/ssr/_0u7c6bz._.js +3 -3
  181. package/.next/standalone/.next/server/chunks/ssr/_0wbcp88._.js +1 -1
  182. package/.next/standalone/.next/server/chunks/ssr/_0whlnt7._.js +3 -0
  183. package/.next/standalone/.next/server/chunks/ssr/_0~oc5bl._.js +3 -0
  184. package/.next/standalone/.next/server/chunks/ssr/_116-_2z._.js +3 -0
  185. package/.next/standalone/.next/server/chunks/ssr/_12ca88g._.js +3 -3
  186. package/.next/standalone/.next/server/chunks/ssr/src_0djxlqx._.js +1 -1
  187. package/.next/standalone/.next/server/chunks/ssr/src_0eufeyj._.js +1 -1
  188. package/.next/standalone/.next/server/chunks/ssr/src_actions_agent-actions_ts_0~wc.sy._.js +2 -2
  189. package/.next/standalone/.next/server/chunks/ssr/src_actions_file-actions_ts_0gcvqwm._.js +1 -1
  190. package/.next/standalone/.next/server/chunks/ssr/src_app_missions_missions-client_tsx_11429lj._.js +1 -1
  191. package/.next/standalone/.next/server/chunks/ssr/src_app_onboarding_page_tsx_0xf7hpz._.js +1 -1
  192. package/.next/standalone/.next/server/chunks/ssr/src_app_settings_page_tsx_0h9v7dr._.js +1 -1
  193. package/.next/standalone/.next/server/chunks/ssr/src_app_workspaces_[workspaceId]_assets_assets-page-client_tsx_0wyzpam._.js +1 -1
  194. package/.next/standalone/.next/server/chunks/ssr/src_app_workspaces_[workspaceId]_board-page-client_tsx_0gips66._.js +1 -1
  195. package/.next/standalone/.next/server/chunks/ssr/src_app_workspaces_[workspaceId]_notes_notes-page-client_tsx_10gyo3v._.js +1 -1
  196. package/.next/standalone/.next/server/chunks/ssr/src_app_workspaces_[workspaceId]_tasks_[taskId]_task-page-client_tsx_02t7blt._.js +1 -1
  197. package/.next/standalone/.next/server/chunks/ssr/src_components_ui_select_tsx_0d2ra01._.js +1 -1
  198. package/.next/standalone/.next/server/chunks/ssr/{src_lib_11w~.ge._.js → src_lib_0x6grav._.js} +1 -1
  199. package/.next/standalone/.next/server/functions-config-manifest.json +2 -0
  200. package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
  201. package/.next/standalone/.next/server/pages/500.html +1 -1
  202. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  203. package/.next/standalone/.next/server/server-reference-manifest.json +345 -303
  204. package/.next/standalone/.next/static/chunks/0-efd~h5j2ufi.js +1 -0
  205. package/.next/standalone/.next/static/chunks/{0fz47g1x5o2xj.js → 0.onaugl2w8ci.js} +1 -1
  206. package/.next/standalone/.next/static/chunks/{0ad0ou7l2.r6e.js → 0.wxa05y455w7.js} +1 -1
  207. package/.next/standalone/.next/static/chunks/0.z171pzeg-.7.js +1 -0
  208. package/.next/standalone/.next/static/chunks/01zlxs4rl~h_o.js +1 -0
  209. package/.next/standalone/.next/static/chunks/{05zm_-7x0fubq.js → 02f8-ju2se8qw.js} +1 -1
  210. package/.next/standalone/.next/static/chunks/{03sdutmq6~3v-.js → 035a_v6g7ioyw.js} +1 -1
  211. package/.next/standalone/.next/static/chunks/{02o~o8tgt860j.js → 040j8d.w8mkyn.js} +1 -1
  212. package/.next/standalone/.next/static/chunks/0_d04kox03m72.css +1 -0
  213. package/.next/standalone/.next/static/chunks/0af7afat3acfx.js +1 -0
  214. package/.next/standalone/.next/static/chunks/0ais32-8.3wlj.js +1 -0
  215. package/.next/standalone/.next/static/chunks/{12rj7-g8lxjew.js → 0bdwzhoelky9-.js} +1 -1
  216. package/.next/standalone/.next/static/chunks/{0.65.u3zhwau~.js → 0clewc5ifaruu.js} +1 -1
  217. package/.next/standalone/.next/static/chunks/0dewfthzwmcwb.js +1 -0
  218. package/.next/standalone/.next/static/chunks/0f43x~jzb70f4.js +1 -0
  219. package/.next/standalone/.next/static/chunks/{0v.l5.sqos562.js → 0i-x__600fys6.js} +1 -1
  220. package/.next/standalone/.next/static/chunks/0lyq0-a32.15m.js +1 -0
  221. package/.next/standalone/.next/static/chunks/{06s-d8my6b9t7.js → 0m~m1~si.ot17.js} +1 -1
  222. package/.next/standalone/.next/static/chunks/{0tfmi08mzcieh.js → 0rozlwh3y46l0.js} +1 -1
  223. package/.next/standalone/.next/static/chunks/0t8lz62rmr801.js +2 -0
  224. package/.next/standalone/.next/static/chunks/0utrquxfg25b2.js +1 -0
  225. package/.next/standalone/.next/static/chunks/0wcdxs4sl-gjf.js +1 -0
  226. package/.next/standalone/.next/static/chunks/0wcwdbtpm0~r6.js +1 -0
  227. package/.next/standalone/.next/static/chunks/{0i2soupf1735z.js → 0x-ug4iz~~qr2.js} +1 -1
  228. package/.next/standalone/.next/static/chunks/0xj6v_80hlyv0.js +1 -0
  229. package/.next/standalone/.next/static/chunks/0xl7h5fsfc7zk.js +1 -0
  230. package/.next/standalone/.next/static/chunks/{11sqt~58g35be.js → 0ypd9eqm_pj-o.js} +1 -1
  231. package/.next/standalone/.next/static/chunks/115ae91fq~slq.js +1 -0
  232. package/.next/standalone/.next/static/chunks/{1195ux3t_r-rb.js → 13.3woq55msp..js} +1 -1
  233. package/.next/standalone/.next/static/chunks/17fug-zaik-v~.js +1 -0
  234. package/.next/standalone/.next/static/chunks/{0v8apmh_d7lz3.js → 17m4o~gdsvuo3.js} +1 -1
  235. package/.next/standalone/package.json +1 -1
  236. package/README.md +25 -3
  237. package/README.zh.md +25 -3
  238. package/dist/mcp-server.cjs +115 -0
  239. package/package.json +1 -1
  240. package/.next/standalone/.next/server/chunks/0se9_next_dist_esm_build_templates_app-route_0hrprmi.js +0 -4
  241. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0.z8.oi._.js +0 -4
  242. package/.next/standalone/.next/server/chunks/[root-of-the-server]__02jy80j._.js +0 -4
  243. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0az764e._.js +0 -3
  244. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0giry~0._.js +0 -3
  245. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0kuo6q5._.js +0 -4
  246. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0np.553._.js +0 -4
  247. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0u_-4~7._.js +0 -3
  248. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__08w4.zf._.js +0 -3
  249. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0da~mv~._.js +0 -47
  250. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0dn90me._.js +0 -3
  251. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0gtqd5o._.js +0 -4
  252. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0nwisa8._.js +0 -3
  253. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0w--i~y._.js +0 -3
  254. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0zkpwjj._.js +0 -3
  255. package/.next/standalone/.next/server/chunks/ssr/_0-_yznx._.js +0 -43
  256. package/.next/standalone/.next/server/chunks/ssr/_03v~rg0._.js +0 -3
  257. package/.next/standalone/.next/server/chunks/ssr/_0_9i_x2._.js +0 -3
  258. package/.next/standalone/.next/server/chunks/ssr/_0b.qjaj._.js +0 -3
  259. package/.next/standalone/.next/server/chunks/ssr/_0mdqhxi._.js +0 -3
  260. package/.next/standalone/.next/server/chunks/ssr/_0r-flc_._.js +0 -3
  261. package/.next/standalone/.next/server/chunks/ssr/_0rkdyad._.js +0 -3
  262. package/.next/standalone/.next/server/chunks/ssr/_0z6ji0d._.js +0 -3
  263. package/.next/standalone/.next/static/chunks/0-x5eie9u3i_2.js +0 -1
  264. package/.next/standalone/.next/static/chunks/00w9dd4fooyic.js +0 -1
  265. package/.next/standalone/.next/static/chunks/04zy.uc7eru64.js +0 -1
  266. package/.next/standalone/.next/static/chunks/05~2gwcex7hv0.js +0 -1
  267. package/.next/standalone/.next/static/chunks/062.w.nsp3886.js +0 -1
  268. package/.next/standalone/.next/static/chunks/0651zmy-w~saj.js +0 -1
  269. package/.next/standalone/.next/static/chunks/06lla3jtd~xb4.js +0 -1
  270. package/.next/standalone/.next/static/chunks/0babmd83h6ejs.js +0 -1
  271. package/.next/standalone/.next/static/chunks/0c8c6pcmlzgmi.js +0 -1
  272. package/.next/standalone/.next/static/chunks/0c~~56wny5m2u.js +0 -1
  273. package/.next/standalone/.next/static/chunks/0ev98toavtr6..js +0 -1
  274. package/.next/standalone/.next/static/chunks/0lnsj7fwkprxe.js +0 -1
  275. package/.next/standalone/.next/static/chunks/0oz8sw6j078vm.js +0 -2
  276. package/.next/standalone/.next/static/chunks/0umi7ddtiv8sw.js +0 -1
  277. package/.next/standalone/.next/static/chunks/0w33dj~dfamnr.css +0 -1
  278. package/.next/standalone/.next/static/chunks/0y3a2-c-i9t~t.js +0 -1
  279. package/.next/standalone/.next/static/chunks/10qltt-r5q91p.js +0 -1
  280. /package/.next/standalone/.next/static/{zSKVtiYaR_yWxx7AopTMR → LCBoYZWhXzs8PjuBmxw7g}/_buildManifest.js +0 -0
  281. /package/.next/standalone/.next/static/{zSKVtiYaR_yWxx7AopTMR → LCBoYZWhXzs8PjuBmxw7g}/_clientMiddlewareManifest.js +0 -0
  282. /package/.next/standalone/.next/static/{zSKVtiYaR_yWxx7AopTMR → LCBoYZWhXzs8PjuBmxw7g}/_ssgManifest.js +0 -0
@@ -1,3 +1,3 @@
1
- module.exports=[473935,a=>{"use strict";var b=a.i(728778),c=a.i(374637),d=a.i(553798),e=a.i(634910),f=a.i(774881),g=a.i(573242),h=a.i(577565),i=a.i(283857),j=a.i(699570),k=a.i(866718),l=a.i(580701),m=a.i(785259),n=a.i(951192);function o({searchQuery:a,onSearchChange:c,versions:d=[],versionFilter:p="all",onVersionFilterChange:q,versionsHref:r,onCreateTask:s}){let t,{t:u}=(0,n.useI18n)(),v="all"===p?u("board.allVersions"):"backlog"===p?u("board.backlogFilter"):(t=d.find(a=>a.id===p))?`${t.number} ${t.name}`:u("board.allVersions");return(0,b.jsxs)("div",{className:"flex items-center gap-2 px-6 py-2",children:[q&&(0,b.jsxs)(l.Select,{value:p,onValueChange:a=>q(a||"all"),children:[(0,b.jsxs)(l.SelectTrigger,{className:"h-8 w-44 shrink-0 gap-1.5 text-xs text-muted-foreground",children:[(0,b.jsx)(h.GitBranch,{className:"h-3.5 w-3.5 shrink-0"}),(0,b.jsx)("span",{className:"truncate",children:v})]}),(0,b.jsxs)(l.SelectContent,{children:[(0,b.jsx)(l.SelectItem,{value:"all",children:u("board.allVersions")}),(0,b.jsx)(l.SelectItem,{value:"backlog",children:u("board.backlogFilter")}),d.map(a=>(0,b.jsxs)(l.SelectItem,{value:a.id,children:[(0,b.jsx)("span",{className:"font-mono",children:a.number})," ",a.name]},a.id))]})]}),(0,b.jsxs)("div",{className:"relative flex-1 max-w-xs",children:[(0,b.jsx)(g.Search,{className:"absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"}),(0,b.jsx)(k.Input,{type:"text",value:a,onChange:a=>c(a.target.value),placeholder:u("board.searchPlaceholder"),className:"pl-8 pr-3 text-xs"})]}),(0,b.jsxs)("div",{className:"ml-auto flex items-center gap-2",children:[(0,b.jsxs)(m.Tooltip,{children:[(0,b.jsx)(m.TooltipTrigger,{render:(0,b.jsx)(j.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground",children:(0,b.jsx)(i.Lightbulb,{className:"h-4 w-4"})})}),(0,b.jsx)(m.TooltipContent,{side:"bottom",className:"max-w-xs",children:u("board.tipText")})]}),r&&(0,b.jsx)(e.default,{href:r,children:(0,b.jsxs)(j.Button,{variant:"outline",className:"h-8 gap-1.5 text-xs text-muted-foreground",children:[(0,b.jsx)(h.GitBranch,{className:"h-3.5 w-3.5"}),u("version.timeline")]})}),(0,b.jsxs)(j.Button,{"data-tour":"create-task",variant:"outline",className:"gap-1.5 border-border text-xs text-muted-foreground hover:border-primary/30 hover:text-primary",onClick:s,children:[(0,b.jsx)(f.Plus,{className:"h-3.5 w-3.5"}),u("board.newTask")]})]})]})}var p=a.i(986099),q=a.i(668116),r=a.i(521007);function s({x:a,y:e,taskId:f,currentStatus:g,hasExecutions:h,workspaceId:i,onClose:j,onStatusChange:k,onLaunch:l}){let{t:m}=(0,n.useI18n)(),o=(0,d.useRouter)(),t=(0,c.useRef)(null);(0,c.useEffect)(()=>{let a=a=>{t.current&&!t.current.contains(a.target)&&j()},b=a=>{"Escape"===a.key&&j()};return document.addEventListener("mousedown",a),document.addEventListener("keydown",b),()=>{document.removeEventListener("mousedown",a),document.removeEventListener("keydown",b)}},[j]);let u="flex items-center px-3 py-1.5 text-xs cursor-pointer hover:bg-accent rounded-sm w-full text-left",v=(0,b.jsxs)("div",{ref:t,style:{position:"fixed",top:e,left:a,zIndex:9999},className:"bg-popover border border-border rounded-md shadow-md py-1 min-w-[180px]",children:[(0,b.jsx)("div",{className:"px-3 py-1 text-[10px] text-muted-foreground uppercase tracking-wider",children:m("board.contextMenu.changeStatus")}),r.BOARD_COLUMNS.map(a=>(0,b.jsxs)("button",{type:"button",className:u,onClick:()=>{k(f,a.id),j()},children:[g===a.id?(0,b.jsx)(q.Check,{className:"h-3 w-3 mr-2 flex-shrink-0"}):(0,b.jsx)("span",{className:"w-5 flex-shrink-0"}),a.label]},a.id)),(0,b.jsx)("hr",{className:"my-1 border-border"}),(0,b.jsx)("button",{type:"button",className:`${u} ${h?"opacity-50 cursor-not-allowed":""}`,disabled:h,onClick:()=>{h||(l(f),j())},children:m("board.contextMenu.launch")}),"DONE"!==g&&"CANCELLED"!==g&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("hr",{className:"my-1 border-border"}),(0,b.jsx)("button",{type:"button",className:u,onClick:()=>{o.push(`/workspaces/${i}/tasks/${f}`),j()},children:m("board.contextMenu.goToDetail")})]})]});return"u"<typeof document?null:(0,p.createPortal)(v,document.body)}var t=a.i(643228),u=a.i(859103),v=a.i(651571),w=a.i(514126),x=a.i(336771),y=a.i(690251),z=a.i(975231),A=a.i(711796);let B=(0,A.default)("pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]);var C=a.i(786304),D=a.i(335732),E=a.i(551578);function F({task:a,onClick:c,onEdit:d,onDelete:e,onTogglePin:f,onContextMenu:g}){let{t:i}=(0,n.useI18n)(),{attributes:k,listeners:l,setNodeRef:o,transform:p,transition:q,isDragging:s}=(0,u.useSortable)({id:a.id,data:{type:"task",task:a}}),t={transform:w.CSS.Transform.toString(p),transition:q,opacity:s?.4:1},v=r.PRIORITY_CONFIG[a.priority],A=!!a.baseBranch;return(0,b.jsxs)("div",{ref:o,style:t,...k,...l,className:"group cursor-grab rounded-lg border border-border bg-card p-3 transition-all hover:border-primary/20 hover:bg-accent/50 active:cursor-grabbing",onClick:c,onContextMenu:b=>{b.preventDefault(),b.stopPropagation(),g?.(a,b.clientX,b.clientY)},"data-testid":"task-card",children:[(0,b.jsxs)("div",{className:"flex items-start justify-between",children:[(0,b.jsx)("h4",{className:"text-sm font-medium text-foreground",children:a.title}),(0,b.jsxs)("div",{className:"flex items-center gap-0.5 shrink-0",children:[(0,b.jsx)(j.Button,{variant:"ghost",size:"icon-xs",className:`transition-all ${a.pinned?"text-primary opacity-100":"text-muted-foreground opacity-0 group-hover:opacity-100"}`,onClick:b=>{b.stopPropagation(),f?.(a.id)},"aria-label":i(a.pinned?"board.unpin":"board.pin"),children:(0,b.jsx)(B,{className:`h-3.5 w-3.5 ${a.pinned?"-rotate-45":""}`})}),(0,b.jsxs)(D.DropdownMenu,{children:[(0,b.jsx)(D.DropdownMenuTrigger,{render:(0,b.jsx)("button",{className:"rounded-md p-0.5 text-muted-foreground opacity-0 transition-all hover:bg-background hover:text-foreground group-hover:opacity-100",onClick:a=>a.stopPropagation()}),children:(0,b.jsx)(x.MoreHorizontal,{className:"h-4 w-4"})}),(0,b.jsxs)(D.DropdownMenuContent,{align:"end",children:[(0,b.jsxs)(D.DropdownMenuItem,{onClick:b=>{b.stopPropagation(),d?.(a)},children:[(0,b.jsx)(y.Pencil,{className:"mr-2 h-3.5 w-3.5"}),i("common.edit")]}),(0,b.jsxs)(D.DropdownMenuItem,{className:"text-rose-400",onClick:b=>{b.stopPropagation(),e?.(a.id)},children:[(0,b.jsx)(z.Trash2,{className:"mr-2 h-3.5 w-3.5"}),i("common.delete")]})]})]})]})]}),a.description&&(0,b.jsx)("p",{className:"mt-1.5 line-clamp-3 text-xs leading-relaxed text-muted-foreground",children:a.description}),(0,b.jsxs)("div",{className:"mt-2.5 flex flex-wrap items-center gap-1.5",children:[(0,b.jsx)(C.Badge,{variant:"secondary",className:`text-[10px] font-semibold ${v.color}`,children:v.label}),a.labels?.map(a=>(0,b.jsx)("span",{className:"rounded-full px-1.5 py-0.5 text-[10px] font-medium",style:{backgroundColor:a.label.color+"20",color:a.label.color},children:a.label.name},a.label.id)),(A||a.version)&&(0,b.jsxs)("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:[A&&(0,b.jsxs)(m.Tooltip,{disableHoverablePopup:!0,children:[(0,b.jsx)(m.TooltipTrigger,{render:(0,b.jsx)("span",{className:"inline-flex cursor-default items-center rounded-md border border-border bg-muted px-1 py-0.5 text-muted-foreground",onPointerDown:a=>a.stopPropagation(),children:(0,b.jsx)(h.GitBranch,{className:"h-2.5 w-2.5 shrink-0"})})}),(0,b.jsx)(m.TooltipContent,{side:"top",children:i("board.card.worktree",{branch:a.baseBranch??""})})]}),a.version&&(0,b.jsxs)(m.Tooltip,{disableHoverablePopup:!0,children:[(0,b.jsx)(m.TooltipTrigger,{render:(0,b.jsx)("span",{className:"cursor-default",onPointerDown:a=>a.stopPropagation(),children:(0,b.jsx)(E.TaskVersionTag,{number:a.version.number,title:""})})}),(0,b.jsx)(m.TooltipContent,{side:"top",children:i("board.card.version",{number:a.version.number,name:a.version.name})})]})]})]})]})}var G=a.i(814574),H=a.i(269876);function I({open:a,onOpenChange:c,columnLabel:d,columnColor:e,tasks:f,onTaskClick:g}){let{t:h}=(0,n.useI18n)();return(0,b.jsx)(G.Dialog,{open:a,onOpenChange:c,children:(0,b.jsxs)(G.DialogContent,{className:"sm:max-w-6xl max-h-[80vh]",children:[(0,b.jsx)(G.DialogHeader,{children:(0,b.jsxs)(G.DialogTitle,{className:"flex items-center gap-2",children:[(0,b.jsx)("div",{className:`h-2.5 w-2.5 rounded-full ${e}`}),(0,b.jsx)("span",{children:d}),(0,b.jsx)("span",{className:"rounded-md bg-muted px-1.5 py-0.5 text-xs font-mono font-medium text-muted-foreground",children:f.length})]})}),(0,b.jsx)(H.ScrollArea,{className:"max-h-[680px]",children:(0,b.jsxs)("div",{className:"grid grid-cols-4 gap-3 pr-3",children:[f.map(a=>{let d=r.PRIORITY_CONFIG[a.priority];return(0,b.jsxs)("div",{className:"cursor-pointer rounded-lg border border-border bg-card p-3 transition-all hover:border-primary/20 hover:bg-accent/50",onClick:()=>{g?.(a),c(!1)},children:[(0,b.jsx)("h4",{className:"text-sm font-medium text-foreground line-clamp-2",children:a.title}),a.description&&(0,b.jsx)("p",{className:"mt-1.5 line-clamp-2 text-xs leading-relaxed text-muted-foreground",children:a.description}),(0,b.jsxs)("div",{className:"mt-2 flex items-center gap-1.5 flex-wrap",children:[(0,b.jsx)(C.Badge,{variant:"secondary",className:`text-[10px] font-semibold ${d.color}`,children:d.label}),a.labels?.map(a=>(0,b.jsx)("span",{className:"rounded-full px-1.5 py-0.5 text-[10px] font-medium",style:{backgroundColor:a.label.color+"20",color:a.label.color},children:a.label.name},a.label.id))]})]},a.id)}),0===f.length&&(0,b.jsx)("div",{className:"col-span-4 py-8 text-center text-sm text-muted-foreground",children:h("board.noTasks")})]})})]})})}function J({id:a,label:d,color:e,tasks:g,onTaskClick:h,onEditTask:i,onAddTask:k,onDeleteTask:l,onTogglePin:m,onContextMenu:o}){let{setNodeRef:p,isOver:q}=(0,t.useDroppable)({id:a}),[r,s]=(0,c.useState)(!1),{t:w}=(0,n.useI18n)();return(0,b.jsxs)("div",{className:`flex w-0 min-w-[220px] flex-1 flex-col min-h-0 border-r border-border/50 last:border-r-0 transition-colors ${q?"bg-primary/[0.06]":""}`,children:[(0,b.jsxs)("div",{className:"flex items-center justify-between px-3 py-2.5 border-b border-border/30",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("div",{className:`h-2 w-2 rounded-full ${e}`}),(0,b.jsx)("span",{className:"text-xs font-semibold tracking-wide text-secondary-foreground",children:d}),(0,b.jsx)("span",{className:"rounded-md bg-muted px-1.5 py-0.5 text-[10px] font-mono font-medium text-muted-foreground",children:g.length})]}),(0,b.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,b.jsx)(j.Button,{variant:"ghost",size:"icon-xs",onClick:()=>s(!0),className:"text-muted-foreground","aria-label":w("board.viewAll"),children:(0,b.jsx)(v.LayoutGrid,{className:"h-3.5 w-3.5"})}),(0,b.jsx)(j.Button,{variant:"ghost",size:"icon-xs",onClick:k,className:"text-muted-foreground","aria-label":"add",children:(0,b.jsx)(f.Plus,{className:"h-3.5 w-3.5"})})]})]}),(0,b.jsx)(I,{open:r,onOpenChange:s,columnLabel:d,columnColor:e,tasks:g,onTaskClick:h}),(0,b.jsx)(H.ScrollArea,{className:"flex-1 min-h-0",children:(0,b.jsx)("div",{ref:p,className:"flex flex-col gap-2 p-2",children:(0,b.jsx)(u.SortableContext,{items:g.map(a=>a.id),strategy:u.verticalListSortingStrategy,children:g.map(a=>(0,b.jsx)(F,{task:a,onClick:()=>h?.(a),onEdit:i,onDelete:l,onTogglePin:m,onContextMenu:o},a.id))})})})]})}function K({initialTasks:a,onTaskMove:d,onTaskClick:e,onEditTask:f,onAddTask:g,onDeleteTask:h,onTogglePin:i,onContextMenuStatusChange:j,onContextMenuLaunch:k,workspaceId:l}){let[m,n]=(0,c.useState)(a),[o,p]=(0,c.useState)(null),[q,u]=(0,c.useState)(null);(0,c.useEffect)(()=>{n(a)},[a]);let v=(0,t.useSensors)((0,t.useSensor)(t.PointerSensor,{activationConstraint:{distance:8}})),w=(0,c.useCallback)((a,b,c)=>{u({task:a,x:b,y:c})},[]),x=(0,c.useCallback)(a=>{let b=m.find(b=>b.id===a.active.id);b&&p(b)},[m]),y=(0,c.useCallback)(a=>{let b,{active:c,over:e}=a;if(p(null),!e)return;let f=c.id,g=e.id;if(r.BOARD_COLUMNS.some(a=>a.id===g))b=g;else{let a=m.find(a=>a.id===g);b=a?.status}b&&(n(a=>a.map(a=>a.id===f?{...a,status:b}:a)),d?.(f,b))},[m,d]);return(0,b.jsxs)(t.DndContext,{id:"kanban-board",sensors:v,collisionDetection:t.closestCorners,onDragStart:x,onDragEnd:y,children:[(0,b.jsx)("div",{className:"mx-2 flex h-full overflow-x-auto rounded-xl border border-border bg-card/50",children:r.BOARD_COLUMNS.map(a=>(0,b.jsx)(J,{id:a.id,label:a.label,color:a.color,tasks:m.filter(b=>b.status===a.id),onTaskClick:e,onEditTask:f,onAddTask:()=>g?.(a.id),onDeleteTask:h,onTogglePin:i,onContextMenu:w},a.id))}),(0,b.jsx)(t.DragOverlay,{children:o?(0,b.jsx)("div",{className:"rotate-3 scale-105",children:(0,b.jsx)(F,{task:o})}):null}),q&&(0,b.jsx)(s,{x:q.x,y:q.y,taskId:q.task.id,currentStatus:q.task.status,hasExecutions:(q.task._count?.executions??0)>0,workspaceId:l??"",onClose:()=>u(null),onStatusChange:(a,b)=>{j?.(a,b),u(null)},onLaunch:a=>{k?.(a),u(null)}})]})}var L=a.i(445798);function M(a,b,c){return Math.min(Math.max(a,b),c)}var N=a.i(442620),O=a.i(10390),P=a.i(350739),Q=a.i(347165);let R=(0,A.default)("git-commit-vertical",[["path",{d:"M12 3v6",key:"1holv5"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M12 15v6",key:"a9ows0"}]]);var S=a.i(616335),T=a.i(704494),U=a.i(394259),V=a.i(625892),W=a.i(939859),X=a.i(648512),Y=a.i(22761),Z=a.i(429246),$=a.i(780410);let _=(0,$.createServerReference)("6003577e48fd962be00945ff10daa9981d32b2202b",$.callServer,void 0,$.findSourceMapURL,"updateProject");var aa=a.i(50051);let ab=(0,$.createServerReference)("40445abf522459e32d24d5b2876a7ab05fbf8c8e71",$.callServer,void 0,$.findSourceMapURL,"deleteProject"),ac=(0,$.createServerReference)("402adc0e89ad342a58c66d2faeaa0644b72363ba94",$.callServer,void 0,$.findSourceMapURL,"getRecentLocalProjects"),ad=(0,$.createServerReference)("40789341eba87d31b0db974f1d4e0a1bceae079293",$.callServer,void 0,$.findSourceMapURL,"getOrCreateTowerTaskId");var ae=a.i(207040),af=a.i(468855),ag=a.i(788086),ah=a.i(194519),ai=a.i(952313),aj=a.i(43775),ak=a.i(487410);function al({commits:a}){let{t:d}=(0,n.useI18n)(),[e,f]=(0,c.useState)(!1);return 0===a.length?null:(0,b.jsxs)("div",{className:"border-b border-border",children:[(0,b.jsxs)("button",{onClick:()=>f(!e),className:"flex w-full items-center gap-1 px-2 py-1.5 hover:bg-accent/50 transition-colors",children:[e?(0,b.jsx)(N.ChevronDown,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):(0,b.jsx)(O.ChevronRight,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),(0,b.jsxs)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:[d("git.commitLog")," (",a.length,")"]})]}),e&&(0,b.jsx)("div",{className:"mt-0.5 mb-1.5 space-y-0.5 max-h-64 overflow-y-auto",children:a.map(a=>(0,b.jsxs)("div",{className:"group flex items-start gap-2 rounded-md px-2 py-1.5 hover:bg-accent transition-colors",children:[(0,b.jsx)(R,{className:"h-3 w-3 shrink-0 text-muted-foreground mt-0.5"}),(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("p",{className:"text-xs text-foreground line-clamp-1",children:a.message}),(0,b.jsxs)("div",{className:"flex items-center gap-2 mt-0.5",children:[(0,b.jsxs)("button",{onClick:()=>{navigator.clipboard.writeText(a.shortHash),ai.toast.success(`Copied ${a.shortHash}`)},className:"flex items-center gap-0.5 font-mono text-[10px] text-primary/70 hover:text-primary transition-colors",children:[a.shortHash,(0,b.jsx)(Y.Copy,{className:"h-2.5 w-2.5 opacity-0 group-hover:opacity-100 transition-opacity"})]}),(0,b.jsx)("span",{className:"text-[10px] text-muted-foreground",children:a.author}),(0,b.jsx)("span",{className:"text-[10px] text-muted-foreground",children:function(a){let b=Math.floor((Date.now()-new Date(a).getTime())/6e4);if(b<1)return"just now";if(b<60)return`${b}m`;let c=Math.floor(b/60);if(c<24)return`${c}h`;let d=Math.floor(c/24);return d<30?`${d}d`:`${Math.floor(d/30)}mo`}(a.date)})]})]})]},a.hash))})]})}var am=a.i(607219),an=a.i(324263),ao=a.i(7285);function ap({localPath:a,stashes:d,hasChanges:e,onRefresh:f}){let{t:g}=(0,n.useI18n)(),[h,i]=(0,c.useState)(!1),[l,m]=(0,c.useState)(!1),[o,p]=(0,c.useState)(""),[q,r]=(0,c.useState)(null),s=async()=>{m(!0);try{await (0,ao.gitAction)(a,"stash-save",{message:o}),p(""),ai.toast.success(g("git.stashSaved")),await f()}catch(a){ai.toast.error(a instanceof Error?a.message:String(a))}finally{m(!1)}},t=async b=>{r(b);try{await (0,ao.gitAction)(a,"stash-pop",{index:b}),ai.toast.success(g("git.stashApplied")),await f()}catch(a){ai.toast.error(a instanceof Error?a.message:String(a))}finally{r(null)}},u=async b=>{r(b);try{await (0,ao.gitAction)(a,"stash-drop",{index:b}),ai.toast.success(g("git.stashDropped")),await f()}catch(a){ai.toast.error(a instanceof Error?a.message:String(a))}finally{r(null)}};return e||0!==d.length?(0,b.jsxs)("div",{className:"border-b border-border",children:[(0,b.jsxs)("button",{onClick:()=>i(!h),className:"flex w-full items-center gap-1 px-2 py-1.5 hover:bg-accent/50 transition-colors",children:[h?(0,b.jsx)(N.ChevronDown,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):(0,b.jsx)(O.ChevronRight,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),(0,b.jsxs)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:[g("git.stash")," ",d.length>0&&`(${d.length})`]})]}),h&&(0,b.jsxs)("div",{className:"mt-0.5 mb-1.5 space-y-2",children:[e&&(0,b.jsxs)("div",{className:"flex gap-1.5",children:[(0,b.jsx)(k.Input,{value:o,onChange:a=>p(a.target.value),placeholder:g("git.stashMsgPlaceholder"),className:"h-7 text-xs flex-1",onKeyDown:a=>"Enter"===a.key&&s()}),(0,b.jsx)(j.Button,{variant:"outline",size:"icon-sm",onClick:s,disabled:l,className:"shrink-0",children:l?(0,b.jsx)(T.Loader2,{className:"h-3 w-3 animate-spin"}):(0,b.jsx)(am.Archive,{className:"h-3 w-3"})})]}),d.length>0&&(0,b.jsx)("div",{className:"space-y-0.5",children:d.map(a=>(0,b.jsxs)("div",{className:"group flex items-center gap-2 rounded-md px-2 py-1.5 hover:bg-accent transition-colors",children:[(0,b.jsx)(am.Archive,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),(0,b.jsx)("span",{className:"flex-1 min-w-0 truncate text-xs text-foreground",children:a.message||`stash@{${a.index}}`}),(0,b.jsxs)("div",{className:"flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,b.jsx)(j.Button,{variant:"ghost",size:"icon-xs",onClick:()=>t(a.index),disabled:q===a.index,className:"text-muted-foreground","aria-label":g("git.stashApply"),children:q===a.index?(0,b.jsx)(T.Loader2,{className:"h-3 w-3 animate-spin"}):(0,b.jsx)(an.ArrowUpFromLine,{className:"h-3 w-3"})}),(0,b.jsx)(j.Button,{variant:"ghost",size:"icon-xs",onClick:()=>u(a.index),disabled:q===a.index,className:"text-rose-400","aria-label":g("git.stashDrop"),children:(0,b.jsx)(z.Trash2,{className:"h-3 w-3"})})]})]},a.index))})]})]}):null}var aq=a.i(985716);function ar({value:a,ariaLabel:d}){let{t:e}=(0,n.useI18n)(),[f,g]=(0,c.useState)(!1),h=async()=>{try{if(navigator.clipboard)await navigator.clipboard.writeText(a);else{let b=document.createElement("textarea");b.value=a,document.body.appendChild(b),b.select(),document.execCommand("copy"),document.body.removeChild(b)}g(!0),ai.toast.success(e("common.copied")),setTimeout(()=>g(!1),1500)}catch{ai.toast.error(e("common.copyFailed"))}};return(0,b.jsxs)("div",{className:"flex items-center gap-1 rounded-md border border-border bg-muted/50 pl-3 pr-1 py-1.5",children:[(0,b.jsx)("span",{className:"min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground",title:a,children:a}),(0,b.jsxs)(m.Tooltip,{children:[(0,b.jsx)(m.TooltipTrigger,{render:(0,b.jsx)(j.Button,{variant:"ghost",size:"icon-xs",className:"shrink-0 text-muted-foreground","aria-label":d,onClick:h,children:f?(0,b.jsx)(q.Check,{className:"h-3 w-3 text-emerald-400"}):(0,b.jsx)(Y.Copy,{className:"h-3 w-3"})})}),(0,b.jsx)(m.TooltipContent,{children:f?e("common.copied"):e("common.copy")})]})]})}function as({project:a,workspaceId:e}){let{t:f,locale:g}=(0,n.useI18n)(),i=(0,d.useRouter)(),{width:l,isDragging:o,startResize:p}=function(a){let{storageKey:b,defaultWidth:d,minWidth:e,maxWidth:f,edge:g="left"}=a,[h,i]=(0,c.useState)(d),[j,k]=(0,c.useState)(!1),l=(0,c.useRef)(null);(0,c.useEffect)(()=>{try{let a=window.localStorage.getItem(b),c=null==a?NaN:Number(a);Number.isFinite(c)&&i(M(c,e,f))}catch{}},[b,e,f]);let m=(0,c.useCallback)(a=>{let b=l.current;b&&i(function(a,b,c,d,e,f="left"){return M(a+("left"===f?b-c:c-b),d,e)}(b.width,b.x,a.clientX,e,f,g))},[e,f,g]),n=(0,c.useCallback)(()=>{l.current&&(l.current=null,k(!1),window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",n),i(a=>{try{window.localStorage.setItem(b,String(a))}catch{}return a}))},[m,b]),o=(0,c.useCallback)(a=>{a.preventDefault(),l.current={x:a.clientX,width:h},k(!0),window.addEventListener("pointermove",m),window.addEventListener("pointerup",n)},[h,m,n]);return(0,c.useEffect)(()=>()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",n)},[m,n]),{width:h,isDragging:j,startResize:o}}({storageKey:"tower:repo-sidebar-width",defaultWidth:288,minWidth:240,maxWidth:560,edge:"left"}),[q,r]=(0,c.useState)(!0),[s,t]=(0,c.useState)(!0),[u,v]=(0,c.useState)(!1),[w,x]=(0,c.useState)(!1),[A,B]=(0,c.useState)(""),[C,D]=(0,c.useState)(!1),[E,F]=(0,c.useState)(!1),[H,I]=(0,c.useState)(!1),[J,K]=(0,c.useState)(a.name),[L,Y]=(0,c.useState)(a.alias??""),[$,am]=(0,c.useState)(a.description??""),[an,ao]=(0,c.useState)(a.localPath??""),[at,au]=(0,c.useState)(a.projectType??"FRONTEND"),[av,aw]=(0,c.useState)([]);(0,c.useEffect)(()=>{ac(100).then(aw)},[]);let[ax,ay]=(0,c.useState)(!1),[az,aA]=(0,c.useState)(""),[aB,aC]=(0,c.useState)(""),[aD,aE]=(0,c.useState)(""),[aF,aG]=(0,c.useState)(""),[aH,aI]=(0,c.useState)("FRONTEND"),[aJ,aK]=(0,c.useState)(!1),[aL,aM]=(0,c.useState)(!1),[aN,aO]=(0,c.useState)(null),[aP,aQ]=(0,c.useState)(!1),[aR,aS]=(0,c.useState)(!1),aT=a=>{ai.toast.info(a)},aU=(0,c.useCallback)(async()=>{if(a.localPath){aQ(!0);try{let b=await fetch(`/api/git?path=${encodeURIComponent(a.localPath)}`);b.ok&&aO(await b.json())}catch{}finally{aQ(!1)}}},[a.localPath]);(0,c.useEffect)(()=>{aU()},[aU]);let aV=async()=>{if(a.localPath){aS(!0);try{(await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"init",path:a.localPath})})).ok?(aT(f("git.initSuccess")),await aU()):aT(f("git.initFailed"))}catch{aT(f("git.initFailed"))}finally{aS(!1)}}},aW=(a,b)=>{i.push(`/workspaces/${a}?projectId=${b}`,{scroll:!1}),i.refresh()},aX=async()=>{if(aB.trim()){aK(!0);try{let a=await (0,aa.createProject)({name:aB.trim(),alias:aD.trim()||void 0,description:aF.trim()||void 0,localPath:az,projectType:aH,workspaceId:e});ay(!1),aW(e,a.id)}catch(a){ai.toast.error(a instanceof Error?a.message:String(a))}finally{aK(!1)}}},aY=async()=>{if(an&&!aL){aM(!0);try{let a=await (0,ah.analyzeProjectDirectory)(an.trim(),g);am(a)}catch{ai.toast.error(f("project.analyzeError"))}finally{aM(!1)}}},aZ=async()=>{try{await _(a.id,{name:J.trim(),alias:L.trim()||void 0,description:$.trim()||void 0,localPath:an.trim()||void 0,projectType:at}),i.refresh(),v(!1)}catch(a){ai.toast.error(a instanceof Error?a.message:String(a))}};return(0,b.jsxs)("aside",{className:"relative flex-shrink-0 border-l border-border bg-sidebar",style:{width:l},children:[(0,b.jsx)("div",{onPointerDown:p,className:`absolute left-0 top-0 z-20 h-full w-1 -translate-x-1/2 cursor-col-resize transition-colors hover:bg-primary/20 ${o?"bg-primary/40":"bg-transparent"}`,role:"separator","aria-orientation":"vertical","aria-label":f("sidebar.right.resize")}),(0,b.jsxs)("div",{className:"h-full overflow-y-auto",children:[(0,b.jsxs)("div",{className:"border-b border-border p-4",children:[(0,b.jsxs)("div",{className:"flex items-start justify-between",children:[(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("h2",{className:"text-base font-semibold text-foreground",children:a.name}),a.alias&&(0,b.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:a.alias})]}),(0,b.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,b.jsx)(j.Button,{variant:"ghost",size:"icon-sm",onClick:()=>{K(a.name),Y(a.alias??""),am(a.description??""),ao(a.localPath??""),v(!0)},className:"text-muted-foreground",children:(0,b.jsx)(y.Pencil,{className:"h-3.5 w-3.5"})}),(0,b.jsx)(j.Button,{variant:"ghost",size:"icon-sm",onClick:()=>{B(""),x(!0)},className:"text-muted-foreground hover:text-rose-400",children:(0,b.jsx)(z.Trash2,{className:"h-3.5 w-3.5"})})]})]}),a.description&&(0,b.jsx)("p",{className:"mt-2 text-sm text-secondary-foreground leading-relaxed line-clamp-4",children:a.description}),(0,b.jsx)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:(0,b.jsx)("span",{className:`inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-[11px] font-medium ${"GIT"===a.type?"bg-sky-500/15 text-sky-300 ring-1 ring-sky-500/20":"bg-muted text-muted-foreground ring-1 ring-border"}`,children:"GIT"===a.type?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(h.GitBranch,{className:"h-3 w-3"}),f("sidebar.right.gitType")]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(P.FileText,{className:"h-3 w-3"}),f("sidebar.right.normalType")]})})}),a.gitUrl&&(0,b.jsx)("div",{className:"mt-3 space-y-1.5",children:(0,b.jsx)(ar,{value:a.gitUrl,ariaLabel:f("project.gitUrl")})}),a.localPath&&(0,b.jsxs)("div",{className:"mt-3 space-y-1.5",children:[(0,b.jsxs)("div",{className:"flex items-center gap-1",children:[(0,b.jsxs)(m.Tooltip,{children:[(0,b.jsx)(m.TooltipTrigger,{render:(0,b.jsx)(j.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground",onClick:async()=>{try{await (0,ae.openInFileManager)(a.localPath)}catch(a){console.error("openInFileManager failed:",a),ai.toast.error(f("git.openInFileManagerFailed"))}},children:(0,b.jsx)(V.FolderSearch,{className:"h-4 w-4"})})}),(0,b.jsx)(m.TooltipContent,{children:f("git.openInFileManager")})]}),(0,b.jsxs)(m.Tooltip,{children:[(0,b.jsx)(m.TooltipTrigger,{render:(0,b.jsx)(j.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground",onClick:async()=>{try{await (0,af.openInEditor)(a.localPath)}catch(a){console.error("openInEditor failed:",a),ai.toast.error(f("git.openInEditorFailed"))}},children:(0,b.jsx)(W.Code,{className:"h-4 w-4"})})}),(0,b.jsx)(m.TooltipContent,{children:f("git.openInEditor")})]}),(0,b.jsxs)(m.Tooltip,{children:[(0,b.jsx)(m.TooltipTrigger,{render:(0,b.jsx)(j.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground",onClick:async()=>{try{await (0,ag.openInTerminal)(a.localPath)}catch(a){console.error("openInTerminal failed:",a),ai.toast.error(f("git.openInTerminalFailed"))}},children:(0,b.jsx)(X.Terminal,{className:"h-4 w-4"})})}),(0,b.jsx)(m.TooltipContent,{children:f("git.openInTerminal")})]})]}),(0,b.jsxs)(j.Button,{variant:"outline",className:"w-full h-9 gap-1.5 text-xs",disabled:E,onClick:async()=>{F(!0);try{let b=await ad(a.id);i.push(`/workspaces/${e}/tasks/${b}`)}catch{ai.toast.error(f("git.openStudioFailed"))}finally{F(!1)}},children:[E?(0,b.jsx)(T.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):(0,b.jsx)(Q.FolderOpen,{className:"h-3.5 w-3.5"}),f("git.openStudio")]})]})]}),(0,b.jsxs)("div",{className:"border-b border-border p-4",children:[(0,b.jsxs)(j.Button,{variant:"ghost",onClick:()=>r(!q),className:"flex w-full cursor-pointer justify-between px-2 py-2",children:[(0,b.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:f("git.section")}),q?(0,b.jsx)(N.ChevronDown,{className:"h-3.5 w-3.5 text-muted-foreground"}):(0,b.jsx)(O.ChevronRight,{className:"h-3.5 w-3.5 text-muted-foreground"})]}),q&&(0,b.jsx)("div",{className:"mt-3",children:a.localPath?aP?(0,b.jsxs)("div",{className:"flex items-center justify-center py-4 text-muted-foreground",children:[(0,b.jsx)(T.Loader2,{className:"h-4 w-4 animate-spin"}),(0,b.jsx)("span",{className:"ml-2 text-xs",children:f("git.loading")})]}):aN&&!aN.isGit?(0,b.jsxs)("div",{className:"rounded-lg border border-border bg-muted/50 p-3",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,b.jsx)(S.AlertCircle,{className:"h-3.5 w-3.5"}),(0,b.jsx)("p",{className:"text-xs",children:f("git.notInitialized")})]}),(0,b.jsxs)(j.Button,{className:"mt-3 h-7 w-full gap-1.5 bg-primary/10 text-xs text-primary ring-1 ring-primary/20 hover:bg-primary/15",onClick:aV,disabled:aR,children:[aR?(0,b.jsx)(T.Loader2,{className:"h-3 w-3 animate-spin"}):(0,b.jsx)(R,{className:"h-3 w-3"}),f("git.initRepo")]})]}):aN?.isGit?(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"flex flex-col",children:(0,b.jsx)(aq.EditorGitPanel,{localPath:a.localPath,mode:"project"})}),(0,b.jsx)(al,{commits:aN.commits??[]}),(0,b.jsx)(ap,{localPath:a.localPath,stashes:aN.stashes??[],hasChanges:(aN.changedFiles??[]).length>0,onRefresh:aU})]}):null:(0,b.jsx)("div",{className:"rounded-lg border border-border bg-muted/50 p-3",children:(0,b.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,b.jsx)(S.AlertCircle,{className:"h-3.5 w-3.5"}),(0,b.jsx)("p",{className:"text-xs",children:f("git.noLocalPath")})]})})})]}),(0,b.jsxs)("div",{className:"p-4",children:[(0,b.jsxs)(j.Button,{variant:"ghost",onClick:()=>t(!s),className:"flex w-full cursor-pointer justify-between px-2 py-2",children:[(0,b.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:f("sidebar.right.browseRepo")}),s?(0,b.jsx)(N.ChevronDown,{className:"h-3.5 w-3.5 text-muted-foreground"}):(0,b.jsx)(O.ChevronRight,{className:"h-3.5 w-3.5 text-muted-foreground"})]}),s&&(0,b.jsxs)("div",{className:"mt-3 space-y-3",children:[(0,b.jsxs)(j.Button,{variant:"outline",className:"w-full h-8 gap-1.5 text-xs",onClick:()=>I(!0),children:[(0,b.jsx)(Q.FolderOpen,{className:"h-3.5 w-3.5"}),f("sidebar.right.browseRepo")]}),av.length>0&&(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground mb-1.5 px-1",children:f("sidebar.right.recent")}),(0,b.jsx)("div",{className:"space-y-0.5",children:av.map(c=>(0,b.jsxs)("button",{onClick:()=>{c.id!==a.id&&aW(c.workspaceId,c.id)},className:`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left transition-colors ${c.id===a.id?"bg-primary/10 text-primary cursor-default":"hover:bg-accent cursor-pointer"}`,children:["GIT"===c.type?(0,b.jsx)(h.GitBranch,{className:"h-3 w-3 shrink-0 text-emerald-400"}):(0,b.jsx)(Q.FolderOpen,{className:"h-3 w-3 shrink-0 text-primary/70"}),(0,b.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,b.jsx)("p",{className:"truncate text-xs font-medium text-foreground",children:c.name}),c.localPath&&(0,b.jsx)("p",{className:"truncate text-[10px] font-mono text-muted-foreground",children:c.localPath})]})]},c.id))})]})]})]})]}),(0,b.jsx)(G.Dialog,{open:u,onOpenChange:v,children:(0,b.jsxs)(G.DialogContent,{style:{maxWidth:"32rem"},children:[(0,b.jsx)(G.DialogHeader,{children:(0,b.jsx)(G.DialogTitle,{children:f("project.edit")})}),(0,b.jsxs)("div",{className:"space-y-3 py-2",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.name")}),(0,b.jsx)(k.Input,{value:J,onChange:a=>K(a.target.value),className:"mt-1.5"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.type.label")}),(0,b.jsx)("div",{className:"mt-1.5",children:(0,b.jsx)(ak.SegmentedControl,{options:[{value:"FRONTEND",label:f("project.type.frontend")},{value:"BACKEND",label:f("project.type.backend")}],value:at,onChange:au})})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.alias")}),(0,b.jsx)(k.Input,{value:L,onChange:a=>Y(a.target.value),className:"mt-1.5"})]}),(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.description")}),(0,b.jsxs)(j.Button,{type:"button",variant:"ghost",onClick:aY,className:`h-6 gap-1 px-2 text-[11px] text-muted-foreground hover:text-foreground ${!an||aL?"opacity-50":""}`,children:[aL?(0,b.jsx)(T.Loader2,{className:"h-3 w-3 animate-spin"}):(0,b.jsx)(U.Sparkles,{className:"h-3 w-3"}),aL?f("project.analyzing"):f("project.genDesc")]})]}),(0,b.jsx)(Z.Textarea,{value:$,onChange:a=>am(a.target.value),rows:2,className:"mt-1.5 w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder-muted-foreground outline-none transition-colors focus:border-ring focus:ring-1 focus:ring-ring resize-none max-h-[200px] overflow-y-auto"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.localPath")}),(0,b.jsx)("div",{className:"mt-1.5 break-all rounded-md border border-border bg-muted/50 px-3 py-2 font-mono text-xs text-muted-foreground",children:an||"—"})]})]}),(0,b.jsxs)(G.DialogFooter,{children:[(0,b.jsx)(j.Button,{variant:"outline",onClick:()=>v(!1),children:f("common.cancel")}),(0,b.jsx)(j.Button,{onClick:aZ,disabled:!J.trim()||aL,className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:f("common.save")})]})]})}),(0,b.jsx)(aj.FolderBrowserDialog,{open:H,onOpenChange:I,onSelect:a=>{u?ao(a):(a=>{let b=av.find(b=>b.localPath===a);if(b)return aW(b.workspaceId,b.id);let c=a.replace(/[\\/]+$/,"").split(/[\\/]/).filter(Boolean).pop()??"";aA(a),aC(c),aE(""),aG(""),ay(!0)})(a)}}),(0,b.jsx)(G.Dialog,{open:ax,onOpenChange:ay,children:(0,b.jsxs)(G.DialogContent,{className:"sm:max-w-md",children:[(0,b.jsx)(G.DialogHeader,{children:(0,b.jsx)(G.DialogTitle,{children:f("topbar.newProject")})}),(0,b.jsxs)("div",{className:"space-y-3 py-2",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.localPath")}),(0,b.jsx)("div",{className:"mt-1.5 rounded-md border border-border bg-muted/50 px-3 py-2 font-mono text-xs text-muted-foreground",children:az})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.name")}),(0,b.jsx)(k.Input,{value:aB,onChange:a=>aC(a.target.value),placeholder:f("project.namePlaceholder"),className:"mt-1.5"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.type.label")}),(0,b.jsx)("div",{className:"mt-1.5",children:(0,b.jsx)(ak.SegmentedControl,{options:[{value:"FRONTEND",label:f("project.type.frontend")},{value:"BACKEND",label:f("project.type.backend")}],value:aH,onChange:aI})})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.alias")}),(0,b.jsx)(k.Input,{value:aD,onChange:a=>aE(a.target.value),placeholder:f("project.aliasPlaceholder"),className:"mt-1.5"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.description")}),(0,b.jsx)(Z.Textarea,{value:aF,onChange:a=>aG(a.target.value),placeholder:f("project.descPlaceholder"),rows:2,className:"mt-1.5 w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder-muted-foreground outline-none transition-colors focus:border-ring focus:ring-1 focus:ring-ring resize-none"})]})]}),(0,b.jsxs)(G.DialogFooter,{children:[(0,b.jsx)(j.Button,{variant:"outline",onClick:()=>ay(!1),children:f("common.cancel")}),(0,b.jsxs)(j.Button,{onClick:aX,disabled:!aB.trim()||aJ,className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:[aJ?(0,b.jsx)(T.Loader2,{className:"h-3 w-3 animate-spin mr-1"}):null,f("common.create")]})]})]})}),(0,b.jsx)(G.Dialog,{open:w,onOpenChange:a=>{x(a),a||B("")},children:(0,b.jsxs)(G.DialogContent,{className:"sm:max-w-md",children:[(0,b.jsx)(G.DialogHeader,{children:(0,b.jsx)(G.DialogTitle,{className:"text-rose-400",children:f("project.deleteTitle")})}),(0,b.jsxs)("div",{className:"space-y-3 py-2",children:[(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:f("project.deleteWarning",{name:a.name})}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:f("project.deleteIrreversible")}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.deleteConfirmLabel")}),(0,b.jsx)(k.Input,{value:A,onChange:a=>B(a.target.value),placeholder:f("project.deleteConfirmPlaceholder"),className:"mt-1.5",autoFocus:!0})]})]}),(0,b.jsxs)(G.DialogFooter,{children:[(0,b.jsx)(j.Button,{variant:"outline",onClick:()=>x(!1),children:f("common.cancel")}),(0,b.jsxs)(j.Button,{variant:"destructive",disabled:A!==f("project.deleteConfirmText")||C,onClick:async()=>{D(!0);try{await ab(a.id),ai.toast.success(f("project.deleteSuccess")),i.push(`/workspaces/${e}`)}catch{ai.toast.error(f("project.deleteFailed"))}finally{D(!1),x(!1)}},children:[C&&(0,b.jsx)(T.Loader2,{className:"h-3 w-3 animate-spin mr-1"}),f("project.deleteButton")]})]})]})})]})}var at=a.i(963326),au=a.i(300141),av=a.i(913284),aw=a.i(269280),ax=a.i(368114);function ay({title:a,description:c,branch:d,baseBranch:e,version:f,hasConversation:g,updatedAt:i,openDir:k,onBack:l}){let{t:o}=(0,n.useI18n)();return(0,b.jsxs)("div",{className:"border-b border-border px-4 py-3",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(U.Sparkles,{className:"h-3.5 w-3.5 text-primary"}),(0,b.jsx)("span",{className:"text-xs font-semibold text-primary",children:o("taskDetail.title")})]}),(0,b.jsxs)(j.Button,{variant:"ghost",onClick:l,className:"flex items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground h-auto px-2 py-1",children:[(0,b.jsx)(aw.ArrowLeft,{className:"h-3.5 w-3.5"}),o("taskDetail.back")]})]}),(0,b.jsx)("h2",{className:"mt-2.5 text-lg font-bold tracking-tight text-foreground",children:a}),c&&(0,b.jsx)("p",{className:"mt-1 text-xs text-muted-foreground line-clamp-2",children:c}),(0,b.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[e?(0,b.jsxs)(C.Badge,{variant:"secondary",className:"bg-muted text-muted-foreground text-[10px] font-mono border border-border",children:[(0,b.jsx)(h.GitBranch,{className:"mr-1 h-3 w-3"}),e," · worktree"]}):d?(0,b.jsx)(C.Badge,{variant:"secondary",className:"bg-muted text-muted-foreground text-[10px] font-mono border border-border",children:o("taskDetail.directMode")}):null,f&&(0,b.jsx)(E.TaskVersionTag,{number:f.number,name:f.name,showName:!0}),g&&(0,b.jsx)(C.Badge,{variant:"secondary",className:"bg-emerald-500/10 text-emerald-400 text-[10px] border border-emerald-500/20",children:o("taskDetail.hasConversation")}),(0,b.jsxs)("span",{className:"text-[11px] text-muted-foreground",children:[o("taskDetail.updatedAt")," ",(0,ax.formatRelativeTime)(i)]}),k&&(0,b.jsxs)("div",{className:"ml-auto flex items-center gap-0.5",children:[(0,b.jsxs)(m.Tooltip,{children:[(0,b.jsx)(m.TooltipTrigger,{render:(0,b.jsx)(j.Button,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:async()=>{try{await (0,ae.openInFileManager)(k)}catch(a){console.error("openInFileManager failed:",a),ai.toast.error(o("git.openInFileManagerFailed"))}},children:(0,b.jsx)(V.FolderSearch,{className:"h-3.5 w-3.5"})})}),(0,b.jsx)(m.TooltipContent,{side:"bottom",children:o("git.openInFileManager")})]}),(0,b.jsxs)(m.Tooltip,{children:[(0,b.jsx)(m.TooltipTrigger,{render:(0,b.jsx)(j.Button,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:async()=>{try{await (0,af.openInEditor)(k)}catch(a){console.error("openInEditor failed:",a),ai.toast.error(o("git.openInEditorFailed"))}},children:(0,b.jsx)(W.Code,{className:"h-3.5 w-3.5"})})}),(0,b.jsx)(m.TooltipContent,{side:"bottom",children:o("git.openInEditor")})]}),(0,b.jsxs)(m.Tooltip,{children:[(0,b.jsx)(m.TooltipTrigger,{render:(0,b.jsx)(j.Button,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:async()=>{try{await (0,ag.openInTerminal)(k)}catch(a){console.error("openInTerminal failed:",a),ai.toast.error(o("git.openInTerminalFailed"))}},children:(0,b.jsx)(X.Terminal,{className:"h-3.5 w-3.5"})})}),(0,b.jsx)(m.TooltipContent,{side:"bottom",children:o("git.openInTerminal")})]})]})]})]})}var az=a.i(639138),aA=a.i(88757),aB=a.i(347872),aC=a.i(648818),aD=a.i(684474),aE=a.i(271797),aF=a.i(289354),aG=a.i(476745),aH=a.i(393976),aI=a.i(976781),aJ=a.i(62892),aK=a.i(613802),aL=a.i(715525),aM=a.i(324954),aN=a.i(87339),aO=a.i(54384),aP=a.i(509405),aQ=a.i(12558),aR=a.i(4914),aS=a.i(658880),aT=a.i(264237),aU=a.i(660063),aV=a.i(523079),aW=a.i(532615),aX=a.i(894148),aY=a.i(510650),aZ=a.i(161181);let a$=/\.(txt|md|json)$/i;function a_({taskId:a,projectId:d}){let{t:e}=(0,n.useI18n)(),g=(0,c.useRef)(null),[h,i]=(0,c.useState)([]),[k,l]=(0,c.useState)([]),[m,o]=(0,c.useState)(!1),[p,q]=(0,c.useState)(""),[r,s]=(0,c.useState)(""),[t,u]=(0,c.useState)(!1),[v,w]=(0,c.useState)(null),[x,y]=(0,c.useState)(null);async function A(){p.trim()&&(await (0,aQ.createNote)({title:p.trim(),content:r.trim(),projectId:d,taskId:a,category:"task"}),q(""),s(""),o(!1),(0,aR.getTaskNotes)(a).then(i))}async function B(a){await (0,aS.deleteNote)(a),i(b=>b.filter(b=>b.id!==a))}async function C(b){let c=b.target.files?.[0];if(c){u(!0);try{let b=new FormData;b.set("file",c),b.set("projectId",d),b.set("taskId",a),await (0,aU.uploadAsset)(b),(0,aT.getTaskAssets)(a).then(l)}finally{u(!1),g.current&&(g.current.value="")}}}async function D(a){await (0,aV.deleteAsset)(a),l(b=>b.filter(b=>b.id!==a))}function E(a){return(0,aZ.isImageAsset)(a.filename,a.mimeType)||a$.test(a.filename)}function F(a){E(a)?w(a):ai.toast.info(e("assets.previewNotSupported"))}async function G(a){try{let b=await fetch("/api/internal/assets/reveal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:a.path})});if(!b.ok){let a=await b.json().catch(()=>({}));ai.toast.error(a.error||"Failed to reveal file")}}catch{ai.toast.error("Failed to reveal file")}}(0,c.useEffect)(()=>{(0,aR.getTaskNotes)(a).then(i),(0,aT.getTaskAssets)(a).then(l)},[a]);let I=v?(0,aZ.isImageAsset)(v.filename,v.mimeType)?"image":a$.test(v.filename)?"text":null:null,J=k.filter(a=>(0,aZ.isImageAsset)(a.filename,a.mimeType)).map(a=>({id:a.id,url:(0,aZ.localPathToApiUrl)(a.path),filename:a.filename})),K=v?J.findIndex(a=>a.id===v.id):-1;return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(H.ScrollArea,{className:"h-full",children:(0,b.jsxs)("div",{className:"flex flex-col",children:[(0,b.jsxs)("div",{className:"border-b border-border px-4 py-3",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsxs)("h3",{className:"flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:[(0,b.jsx)(P.FileText,{className:"h-3.5 w-3.5"}),e("taskPage.notes")]}),(0,b.jsxs)(j.Button,{variant:"ghost",className:"h-6 gap-1 px-2 text-xs",onClick:()=>o(!m),children:[m?(0,b.jsx)(aO.X,{className:"h-3 w-3"}):(0,b.jsx)(f.Plus,{className:"h-3 w-3"}),m?"":e("taskPage.addNote")]})]}),m&&(0,b.jsxs)("div",{className:"mt-3 space-y-2",children:[(0,b.jsx)("input",{type:"text",value:p,onChange:a=>q(a.target.value),placeholder:e("taskPage.noteTitle"),className:"h-8 w-full rounded-md border border-border bg-background px-3 text-sm focus:outline-none focus:ring-1 focus:ring-primary",autoFocus:!0}),(0,b.jsx)("textarea",{value:r,onChange:a=>s(a.target.value),placeholder:e("taskPage.noteContent"),rows:3,className:"w-full rounded-md border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-primary resize-none"}),(0,b.jsx)(j.Button,{className:"text-xs",onClick:A,disabled:!p.trim(),children:e("taskPage.addNote")})]}),(0,b.jsxs)("div",{className:"mt-2 space-y-2",children:[0===h.length&&!m&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground py-2",children:e("taskPage.noNotes")}),h.map(a=>(0,b.jsx)("div",{className:"group rounded-md border border-border bg-card p-3",children:(0,b.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,b.jsxs)("button",{type:"button",onClick:()=>y(a),className:"min-w-0 flex-1 cursor-pointer text-left",title:e("taskPage.previewNote"),children:[(0,b.jsx)("h4",{className:"text-sm font-medium truncate hover:underline",children:a.title}),a.content&&(0,b.jsx)("p",{className:"mt-1 text-xs text-muted-foreground line-clamp-3 whitespace-pre-wrap",children:a.content}),(0,b.jsx)("p",{className:"mt-1 text-[10px] text-muted-foreground",children:new Date(a.createdAt).toLocaleString()})]}),(0,b.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5",children:[(0,b.jsx)(j.Button,{variant:"ghost",size:"icon-xs",onClick:()=>y(a),className:"text-muted-foreground hover:bg-accent",title:e("taskPage.previewNote"),children:(0,b.jsx)(aP.Eye,{className:"h-3.5 w-3.5"})}),(0,b.jsx)(j.Button,{variant:"ghost",size:"icon-xs",onClick:()=>B(a.id),className:"text-muted-foreground hover:bg-destructive/10 hover:text-destructive",title:e("taskPage.deleteNote"),children:(0,b.jsx)(z.Trash2,{className:"h-3.5 w-3.5"})})]})]})},a.id))]})]}),(0,b.jsxs)("div",{className:"px-4 py-3",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsxs)("h3",{className:"flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:[(0,b.jsx)(aN.Paperclip,{className:"h-3.5 w-3.5"}),e("taskPage.attachments")]}),(0,b.jsxs)(j.Button,{variant:"ghost",className:"h-6 gap-1 px-2 text-xs",onClick:()=>g.current?.click(),disabled:t,children:[(0,b.jsx)(aM.Upload,{className:"h-3 w-3"}),e("taskPage.uploadFile")]}),(0,b.jsx)("input",{ref:g,type:"file",className:"hidden",onChange:C})]}),(0,b.jsxs)("div",{className:"mt-2 space-y-1.5",children:[0===k.length&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground py-2",children:e("taskPage.noAttachments")}),k.map(a=>{var c;let d=E(a);return(0,b.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-border bg-card px-3 py-2",children:[(0,b.jsx)(aN.Paperclip,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),(0,b.jsx)("button",{type:"button",onClick:()=>F(a),disabled:!d,className:`min-w-0 flex-1 truncate text-left text-sm ${d?"cursor-pointer hover:underline":"cursor-default"}`,title:d?e("assets.preview"):a.filename,children:a.filename}),(0,b.jsx)("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:(c=a.size)?c<1024?`${c} B`:c<1048576?`${(c/1024).toFixed(1)} KB`:`${(c/1024/1024).toFixed(1)} MB`:""}),(0,b.jsxs)("div",{className:"flex items-center gap-0.5",children:[d&&(0,b.jsx)(j.Button,{variant:"ghost",size:"icon-xs",onClick:()=>F(a),className:"shrink-0 text-muted-foreground hover:bg-accent",title:e("assets.preview"),children:(0,b.jsx)(aP.Eye,{className:"h-3 w-3"})}),(0,b.jsx)(j.Button,{variant:"ghost",size:"icon-xs",onClick:()=>G(a),className:"shrink-0 text-muted-foreground hover:bg-accent",title:e("assets.revealInFinder"),children:(0,b.jsx)(Q.FolderOpen,{className:"h-3 w-3"})}),(0,b.jsx)(j.Button,{variant:"ghost",size:"icon-xs",onClick:()=>D(a.id),className:"shrink-0 text-muted-foreground hover:bg-destructive/10 hover:text-destructive",title:e("taskPage.deleteAttachment"),children:(0,b.jsx)(z.Trash2,{className:"h-3 w-3"})})]})]},a.id)})]})]})]})}),(0,b.jsx)(aW.ImageLightbox,{imageUrl:"image"===I&&K>=0?J[K].url:null,filename:"image"===I&&K>=0?J[K].filename:"",open:"image"===I,onOpenChange:a=>{a||w(null)},assets:J.map(({url:a,filename:b})=>({url:a,filename:b})),currentIndex:K>=0?K:void 0,onIndexChange:a=>{let b=J[a];if(!b)return;let c=k.find(a=>a.id===b.id);c&&w(c)}}),(0,b.jsx)(aX.TextPreviewDialog,{url:"text"===I&&v?(0,aZ.localPathToApiUrl)(v.path):null,filename:v?.filename??"",open:"text"===I,onOpenChange:a=>{a||w(null)}}),(0,b.jsx)(aY.NotePreviewDialog,{note:x,open:null!==x,onOpenChange:a=>{a||y(null)}})]})}function a0({task:a,workspaceId:e,projectLocalPath:f,onClose:g}){let{t:h}=(0,n.useI18n)(),i=(0,d.useRouter)(),{removePortal:k}=(0,aB.useTerminalPortal)(),[o,p]=(0,c.useState)("terminal"),[q,r]=(0,c.useState)(null),[s,t]=(0,c.useState)(!1),[u,v]=(0,c.useState)(a.status);(0,c.useEffect)(()=>{v(a.status)},[a.status]);let[w,x]=(0,c.useState)(null),[y,z]=(0,c.useState)(!1),[A,B]=(0,c.useState)(!1),[C,D]=(0,c.useState)([]);(0,c.useEffect)(()=>{x(null),z(!1),B(!1),D([]),r(null),p("terminal")},[a.id]);let[E,F]=(0,c.useState)([]),[G,I]=(0,c.useState)(null);(0,c.useEffect)(()=>{let a=!1;return(0,aK.getPrompts)().then(b=>{if(a)return;F(b.map(a=>({id:a.id,name:a.name,isDefault:a.isDefault})));let c=b.find(a=>a.isDefault);c&&I(c.id)}),()=>{a=!0}},[]),(0,c.useEffect)(()=>{x(null),B(!1);let b=!1;return(0,aC.getTaskExecutions)(a.id).then(a=>{if(b)return;let c=a[0];if(c?.status==="RUNNING"){let a=c.worktreePath||f||null;a&&x(a)}D(a.filter(a=>"RUNNING"!==a.status)),B(!0)}),()=>{b=!0}},[a.id]),(0,c.useEffect)(()=>{if("changes"!==o||"TODO"===u||"CANCELLED"===u)return;let b=!1;return t(!0),fetch(`/api/tasks/${a.id}/diff`).then(a=>{if(!a.ok)throw Error(`HTTP ${a.status}`);return a.json()}).then(a=>{b||r(a?.files||a?.branchDeleted?a:null)}).catch(()=>{b||r(null)}).finally(()=>{b||t(!1)}),()=>{b=!0}},[o,u,a.id]);let J=(0,c.useCallback)(async()=>{if(!y){z(!0),k(a.id);try{let b=await (0,aD.startPtyExecutionSafe)(a.id,"",G);if(!b.ok){z(!1),ai.toast.error(b.error||h("terminal.startFailed"));return}x(b.worktreePath??null),v("IN_PROGRESS")}catch(a){z(!1),ai.toast.error(a instanceof Error&&a.message?a.message:h("terminal.startFailed"))}}},[a.id,y,G,h]),K=(0,c.useCallback)(b=>{z(!1),x(null),k(a.id),0===b&&v("IN_REVIEW"),(0,aC.getTaskExecutions)(a.id).then(a=>{D(a.filter(a=>"RUNNING"!==a.status))}),i.refresh()},[i,a.id]),L=(0,c.useCallback)(async()=>{await (0,aE.stopPtyExecution)(a.id),z(!1),k(a.id),x(null),v("IN_REVIEW"),(0,aC.getTaskExecutions)(a.id).then(a=>{D(a.filter(a=>"RUNNING"!==a.status))}),i.refresh()},[a.id,i]),M=(0,c.useCallback)(async b=>{z(!0),k(a.id),x(null);try{let{worktreePath:c}=await (0,aF.resumePtyExecution)(a.id,b);x(c),v("IN_PROGRESS")}catch{z(!1)}},[a.id,k]),N=(0,c.useCallback)(async()=>{z(!0),k(a.id),x(null);try{let{worktreePath:b}=await (0,aG.continueLatestPtyExecution)(a.id);x(b),v("IN_PROGRESS")}catch(a){z(!1),ai.toast.error(a instanceof Error?a.message:String(a))}},[a.id,k]),[O,Q]=(0,c.useState)(!1),[R,S]=(0,c.useState)([]),U=(0,c.useCallback)(async()=>{try{let b=await (0,aI.checkWorktreeClean)(a.id);if(b.hasWorktree&&!b.clean)return void ai.toast.error(h("taskPage.uncommittedChanges",{count:String(b.files.length)}));if(b.hasWorktree&&b.clean&&!b.hasCommits)return void ai.toast.error(h("taskPage.noChangesToComplete"),{action:{label:h("taskPage.markAsCancelled"),onClick:()=>{(0,aH.updateTaskStatus)(a.id,"CANCELLED").then(()=>{v("CANCELLED"),ai.toast.success(h("taskPage.taskCancelled")),i.refresh()}).catch(()=>ai.toast.error("Failed to cancel task"))}}});if(b.hasWorktree&&b.hasCommits){S(b.commitLog),Q(!0);return}await (0,aH.updateTaskStatus)(a.id,"DONE"),v("DONE"),ai.toast.success(h("taskPage.taskCompleted")),i.refresh()}catch{ai.toast.error("Failed to complete task")}},[a.id,i,h]),V=(0,c.useCallback)(()=>{v("DONE"),Q(!1),ai.toast.success(h("taskPage.taskCompleted")),i.refresh()},[i,h]),W=(0,c.useCallback)(async b=>{try{let{hash:c}=await (0,aJ.commitWorktreeChanges)(a.id,b);ai.toast.success(h("diff.commitSuccess",{hash:c})),i.refresh();let d=await fetch(`/api/tasks/${a.id}/diff`);if(d.ok){let a=await d.json();r(a?.files?a:null)}}catch(a){ai.toast.error(a instanceof Error?a.message:"Commit failed")}},[a.id,i,h]);return(0,b.jsxs)("div",{className:"flex h-full w-[600px] flex-shrink-0 flex-col border-l border-border bg-sidebar","data-testid":"task-detail-panel",children:[(0,b.jsx)(ay,{title:a.title,description:h("taskDetail.panelDescription"),branch:`task/${a.id}`,baseBranch:a.baseBranch,version:a.version??null,hasConversation:!1,updatedAt:a.updatedAt,openDir:w??(f?a.subPath?`${f}/${a.subPath}`:f:null),onBack:g}),(0,b.jsxs)("div",{className:"flex items-center justify-between border-b border-border px-4 py-2",children:[(0,b.jsxs)("div",{className:"flex gap-1",children:[(0,b.jsxs)("button",{onClick:()=>p("terminal"),className:`flex items-center gap-1.5 px-3 py-1 text-xs font-medium rounded-md ${"terminal"===o?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,b.jsx)(X.Terminal,{className:"h-3 w-3"}),h("terminal.execute")]}),(0,b.jsx)("button",{onClick:()=>p("changes"),className:`px-3 py-1 text-xs font-medium rounded-md ${"changes"===o?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:h("taskPage.changes")}),(0,b.jsxs)("button",{onClick:()=>p("notes"),className:`flex items-center gap-1.5 px-3 py-1 text-xs font-medium rounded-md ${"notes"===o?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,b.jsx)(P.FileText,{className:"h-3 w-3"}),h("taskPage.notes")]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:["IN_REVIEW"===u&&(0,b.jsxs)(j.Button,{size:"sm",onClick:U,className:"bg-emerald-500/15 text-emerald-400 ring-1 ring-emerald-500/20 hover:bg-emerald-500/25",children:[(0,b.jsx)(av.CheckCircle2,{className:"h-3 w-3"}),h("taskPage.completeTask")]}),"DONE"!==u&&"CANCELLED"!==u&&(0,b.jsxs)(j.Button,{variant:"ghost",size:"sm",onClick:()=>i.push(`/workspaces/${e}/tasks/${a.id}`),className:"text-muted-foreground",children:[(0,b.jsx)(at.ExternalLink,{className:"h-3 w-3"}),h("taskPage.viewDetails")]})]})]}),"terminal"===o?(0,b.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:A?w?(0,b.jsxs)("div",{className:"flex h-full flex-col overflow-hidden",children:[(0,b.jsxs)("div",{className:"shrink-0 flex items-center justify-between border-b border-neutral-800 px-3 py-2 bg-[#0f1419]",children:[(0,b.jsxs)("span",{className:"flex items-center gap-1.5 text-xs text-emerald-400",children:[(0,b.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"}),h("execution.running")]}),(0,b.jsxs)(m.Tooltip,{children:[(0,b.jsxs)(m.TooltipTrigger,{onClick:L,className:"flex items-center gap-1.5 rounded-md bg-red-500/15 px-3 py-1 text-xs font-medium text-red-400 hover:bg-red-500/25 transition-colors",children:[(0,b.jsx)(au.Square,{className:"h-3 w-3"}),h("terminal.stopExecution")]}),(0,b.jsx)(m.TooltipContent,{side:"bottom",children:h("terminal.stopHint")})]})]}),(0,b.jsx)("div",{className:"flex-1 min-h-0",children:(0,b.jsx)(aB.TerminalOutlet,{taskId:a.id,worktreePath:w,onSessionEnd:K})})]}):"DONE"===u||"CANCELLED"===u?(0,b.jsx)("div",{className:"flex h-full flex-col overflow-hidden",children:(0,b.jsx)(H.ScrollArea,{className:"flex-1 min-h-0",children:(0,b.jsx)(aL.ExecutionTimeline,{executions:C})})}):(0,b.jsxs)("div",{className:"flex h-full flex-col overflow-hidden",children:[(0,b.jsxs)("div",{className:"shrink-0 flex items-center gap-2 border-b border-border px-4 py-3",children:[E.length>0&&(0,b.jsxs)(l.Select,{defaultValue:G??"none",onValueChange:a=>I("none"===a?null:a),children:[(0,b.jsx)(l.SelectTrigger,{size:"sm",className:"min-w-[120px]",children:(0,b.jsx)("span",{className:"text-left truncate",children:G?E.find(a=>a.id===G)?.name??h("terminal.noPrompt"):h("terminal.noPrompt")})}),(0,b.jsxs)(l.SelectContent,{className:"min-w-[200px]",children:[(0,b.jsx)(l.SelectItem,{value:"none",children:h("terminal.noPrompt")}),E.map(a=>(0,b.jsxs)(l.SelectItem,{value:a.id,children:[a.name,a.isDefault?" ★":""]},a.id))]})]},`prompt-${E.length}`),(0,b.jsxs)(j.Button,{onClick:J,disabled:y,size:"sm",className:"gap-2 px-4",children:[y?(0,b.jsx)(T.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):(0,b.jsx)(X.Terminal,{className:"h-3.5 w-3.5"}),y?h("terminal.executing"):h("terminal.launch")]})]}),(0,b.jsx)(H.ScrollArea,{className:"flex-1 min-h-0",children:(0,b.jsx)(aL.ExecutionTimeline,{executions:C,onResume:M,onContinueLatest:N})})]}):(0,b.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-2 bg-[#0f1419]",children:[(0,b.jsx)(T.Loader2,{className:"size-5 animate-spin text-neutral-500"}),(0,b.jsx)("span",{className:"text-xs text-neutral-500",children:h("execution.loading")})]})}):"changes"===o?(0,b.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:s?(0,b.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:h("taskPage.loadingDiff")})}):q?.branchDeleted?(0,b.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:h("taskPage.branchDeleted")})}):q?(0,b.jsx)(az.TaskDiffView,{taskId:a.id,files:q.files,totalAdded:q.totalAdded,totalRemoved:q.totalRemoved,hasConflicts:q.hasConflicts,conflictFiles:q.conflictFiles,onCommit:W,hasUncommitted:q.hasUncommitted}):(0,b.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:h("taskPage.noChanges")})})}):"notes"===o?(0,b.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:(0,b.jsx)(a_,{taskId:a.id,projectId:a.projectId})}):null,(0,b.jsx)(aA.TaskMergeConfirmDialog,{open:O,onOpenChange:Q,taskId:a.id,taskTitle:a.title,baseBranch:a.baseBranch??"main",fileCount:q?.files?.length??0,commitCount:q?.commitCount??0,commitLog:R,onMergeComplete:V})]})}var a1=a.i(811798),a2=a.i(172352);let a3=(0,$.createServerReference)("40de22d9973e5a79f1d75c29904032b409b0bc31be",$.callServer,void 0,$.findSourceMapURL,"deleteTask"),a4=(0,$.createServerReference)("40c266072a0932b3fd728d4249eee6876bf21339c7",$.callServer,void 0,$.findSourceMapURL,"toggleTaskPinned");var a5=a.i(848193);let a6=(0,$.createServerReference)("40e1112b183f39ba7ff7bd200f6300e6bb6ad1d783",$.callServer,void 0,$.findSourceMapURL,"getVersionsForPicker");var a7=a.i(258815),a8=a.i(912868);function a9({project:a,isActive:e,workspaceId:f,onSelect:g}){let{t:h}=(0,n.useI18n)(),i=(0,d.useRouter)(),k=a.totalTasks,l=a.runningTasks,o=k>0?Math.round(l/k*100):0,[p,q]=(0,c.useState)(!1),[r,s]=(0,c.useState)(!1),t=async()=>{s(!0);try{let b=await ad(a.id);i.push(`/workspaces/${f}/tasks/${b}`)}catch{ai.toast.error(h("git.openStudioFailed"))}finally{s(!1)}},u=(0,b.jsxs)("button",{onClick:()=>{e||g(a.id)},className:`group flex w-[212px] shrink-0 items-center gap-2 rounded-lg border-b-2 px-3 py-1.5 text-left transition-colors ${e?"border-primary bg-primary/10 ring-1 ring-primary/20 cursor-default":`border-transparent cursor-pointer ${p?"bg-accent":"hover:bg-accent"}`}`,children:[(0,b.jsxs)("span",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[(0,b.jsx)("span",{className:`w-full truncate text-sm font-medium leading-tight ${e?"text-primary":p?"text-foreground":"text-muted-foreground group-hover:text-foreground"}`,children:a.name}),a.alias&&(0,b.jsx)("span",{className:"w-full truncate text-[11px] font-normal leading-tight text-muted-foreground/70",children:a.alias})]}),(0,b.jsxs)("span",{className:"flex shrink-0 items-baseline rounded-md border border-border bg-card px-1.5 py-0.5 font-mono text-[11px] font-semibold leading-none",children:[(0,b.jsx)("span",{className:"text-amber-500 dark:text-amber-400",children:l}),(0,b.jsx)("span",{className:"mx-px text-muted-foreground/50",children:"/"}),(0,b.jsx)("span",{className:"text-muted-foreground",children:k})]})]});return(0,b.jsxs)(m.Tooltip,{onOpenChange:q,children:[(0,b.jsx)(m.TooltipTrigger,{render:u}),(0,b.jsxs)(m.TooltipContent,{side:"bottom",hideArrow:!0,className:"flex w-[268px] max-w-none flex-col items-stretch gap-0 rounded-xl border border-border bg-card p-3.5 text-foreground shadow-lg",children:[(0,b.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,b.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,b.jsx)("div",{className:"text-[13px] font-bold leading-snug break-words",children:a.name}),a.alias&&(0,b.jsx)("div",{className:"mt-0.5 text-[11.5px] leading-relaxed text-muted-foreground break-words",children:a.alias})]}),(0,b.jsxs)(j.Button,{variant:"outline",disabled:r,onClick:t,className:"h-7 shrink-0 gap-1 px-2 text-[11px]",children:[r?(0,b.jsx)(T.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):(0,b.jsx)(Q.FolderOpen,{className:"h-3.5 w-3.5"}),h("git.openStudio")]})]}),(0,b.jsx)("div",{className:"my-2.5 h-px bg-border"}),(0,b.jsxs)("div",{className:"mb-2 flex items-center gap-2",children:[(0,b.jsx)("span",{className:"size-2 shrink-0 rounded-full bg-amber-500 dark:bg-amber-400"}),(0,b.jsx)("span",{className:"text-[13px] font-semibold",children:h("board.running")}),(0,b.jsx)("span",{className:"text-[11px] text-muted-foreground",children:h("board.runningDesc")}),(0,b.jsx)("span",{className:"ml-auto font-mono text-[15px] font-bold text-amber-500 dark:text-amber-400",children:l})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:"size-2 shrink-0 rounded-full bg-sky-500 dark:bg-sky-400"}),(0,b.jsx)("span",{className:"text-[13px] font-semibold",children:h("board.overview")}),(0,b.jsx)("span",{className:"text-[11px] text-muted-foreground",children:h("board.totalDesc")}),(0,b.jsx)("span",{className:"ml-auto font-mono text-[15px] font-bold",children:k})]}),(0,b.jsx)("div",{className:"mt-2.5 h-[5px] overflow-hidden rounded-full bg-sky-500/15 dark:bg-sky-400/15",children:(0,b.jsx)("div",{className:"h-full rounded-full bg-amber-500 dark:bg-amber-400",style:{width:`${o}%`}})}),(0,b.jsx)("div",{className:"mt-2.5 text-[10px] text-muted-foreground",children:h("board.badgeFormatHint")})]})]})}function ba({projects:a,activeProjectId:d,workspaceId:e,onSelect:f}){let g=(0,c.useRef)(null),[h,i]=(0,c.useState)(!1),[j,k]=(0,c.useState)(!1),l=()=>{let a=g.current;a&&(i(a.scrollLeft>0),k(a.scrollLeft<a.scrollWidth-a.clientWidth-1))};(0,c.useEffect)(()=>{l();let a=g.current;if(a){a.addEventListener("scroll",l);let b=new ResizeObserver(l);return b.observe(a),()=>{a.removeEventListener("scroll",l),b.disconnect()}}},[a]);let m=a=>{let b=g.current;b&&b.scrollBy({left:"left"===a?-150:150,behavior:"smooth"})};return(0,b.jsxs)("div",{className:"relative flex items-center",children:[h&&(0,b.jsx)("button",{onClick:()=>m("left"),className:"absolute left-0 z-10 flex h-8 w-8 items-center justify-center rounded-md bg-background/90 text-muted-foreground shadow-sm ring-1 ring-border backdrop-blur-sm transition-colors hover:text-foreground",children:(0,b.jsx)(a8.ChevronLeft,{className:"h-4 w-4"})}),(0,b.jsx)("div",{ref:g,className:"flex items-center gap-1.5 overflow-x-auto scrollbar-none px-1 py-1",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:a.map(a=>(0,b.jsx)(a9,{project:a,isActive:d===a.id,workspaceId:e,onSelect:f},a.id))}),j&&(0,b.jsx)("button",{onClick:()=>m("right"),className:"absolute right-0 z-10 flex h-8 w-8 items-center justify-center rounded-md bg-background/90 text-muted-foreground shadow-sm ring-1 ring-border backdrop-blur-sm transition-colors hover:text-foreground",children:(0,b.jsx)(O.ChevronRight,{className:"h-4 w-4"})})]})}var bb=a.i(811344);function bc({open:a,onOpenChange:c,taskTitle:d,uncommittedFiles:e,commitLog:f,onConfirm:g}){let{t:h}=(0,n.useI18n)(),i=e.length,k=f.length,l=0===i&&0===k;return(0,b.jsx)(G.Dialog,{open:a,onOpenChange:c,children:(0,b.jsxs)(G.DialogContent,{showCloseButton:!0,className:"sm:max-w-md",children:[(0,b.jsx)(G.DialogHeader,{children:(0,b.jsxs)(G.DialogTitle,{className:"flex items-center gap-2",children:[(0,b.jsx)(bb.AlertTriangle,{className:"h-4 w-4 text-amber-400"}),h("taskCancel.title")]})}),(0,b.jsxs)("div",{className:"space-y-3 py-2",children:[(0,b.jsxs)("div",{className:"rounded-lg border border-amber-500/20 bg-amber-500/10 p-3 space-y-1.5",children:[(0,b.jsx)("p",{className:"text-xs text-foreground",children:h("taskCancel.intro",{title:d})}),(0,b.jsx)("p",{className:"text-xs text-amber-300",children:h("taskCancel.irreversible")})]}),l?(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:h("taskCancel.cleanNotice")}):(0,b.jsxs)("div",{className:"rounded-lg border border-border bg-muted/30 p-3 space-y-2.5",children:[(0,b.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,b.jsx)("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:h("taskCancel.uncommittedFiles")}),(0,b.jsx)("span",{className:"text-xs font-medium text-foreground",children:i})]}),(0,b.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,b.jsx)("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:h("taskCancel.unmergedCommits")}),(0,b.jsx)("span",{className:"text-xs font-medium text-foreground",children:k})]})]}),i>0&&(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"text-xs text-muted-foreground mb-1 block",children:h("taskCancel.filesList")}),(0,b.jsx)("div",{className:"rounded-md border border-border bg-muted/30 p-2 space-y-1 max-h-32 overflow-y-auto",children:e.map((a,c)=>(0,b.jsx)("div",{className:"text-xs font-mono text-foreground/80",children:a},c))})]}),k>0&&(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"text-xs text-muted-foreground mb-1 block",children:h("taskCancel.commitsList")}),(0,b.jsx)("div",{className:"rounded-md border border-border bg-muted/30 p-2 space-y-1 max-h-32 overflow-y-auto",children:f.map((a,c)=>(0,b.jsx)("div",{className:"text-xs font-mono text-foreground/80",children:a},c))}),(0,b.jsx)("p",{className:"text-[10px] text-muted-foreground mt-1.5",children:h("taskCancel.reflogHint")})]})]}),(0,b.jsxs)(G.DialogFooter,{children:[(0,b.jsx)(j.Button,{variant:"outline",onClick:()=>c(!1),children:h("taskCancel.keep")}),(0,b.jsxs)(j.Button,{variant:"destructive",onClick:g,className:"gap-2",children:[(0,b.jsx)(bb.AlertTriangle,{className:"h-4 w-4"}),h("taskCancel.confirm")]})]})]})})}a.s(["BoardPageClient",0,function({workspaceId:a,projectId:e,project:f,projects:g,initialTasks:h,labels:i,openTaskId:j}){let k=(0,d.useRouter)(),{t:l}=(0,n.useI18n)(),[,m]=(0,c.useTransition)(),[p,q]=(0,c.useState)(""),[s,t]=(0,c.useState)("all"),[u,v]=(0,c.useState)(!1),[w,x]=(0,c.useState)("TODO"),[y,z]=(0,c.useState)(j??null),[A,B]=(0,c.useState)([]),C=y?h.find(a=>a.id===y)??null:null,[D,E]=(0,c.useState)(null),[F,G]=(0,c.useState)(null),[H,I]=(0,c.useState)(null);(0,c.useEffect)(()=>{a6(e).then(B).catch(()=>B([]))},[e]),(0,c.useEffect)(()=>{(0,a7.setLastProjectId)(a,e)},[a,e]);let J=A.find(a=>a.isCurrent)?.id??null,M=(0,c.useCallback)(()=>{m(()=>{k.refresh()})},[k]);(0,c.useEffect)(()=>{if(u)return;let a=setInterval(()=>{m(()=>{k.refresh()})},5e3);return()=>clearInterval(a)},[k,u]);let N=(0,c.useCallback)(a=>{q(a)},[]),O=(0,c.useCallback)(async a=>{let b=h.find(b=>b.id===a);if(b)try{let c=await (0,aI.checkWorktreeClean)(a);if(c.hasWorktree&&!c.clean){ai.toast.error(l("taskPage.uncommittedChanges",{count:String(c.files.length)})),M();return}if(c.hasWorktree&&c.clean&&!c.hasCommits){ai.toast.error(l("taskPage.noChangesToComplete"),{action:{label:l("taskPage.markAsCancelled"),onClick:()=>{(0,aH.updateTaskStatus)(a,"CANCELLED").then(()=>{ai.toast.success(l("taskPage.taskCancelled")),M()}).catch(()=>ai.toast.error("Failed to cancel task"))}}}),M();return}if(c.hasWorktree&&c.hasCommits){G({task:b,commitLog:c.commitLog,commitCount:c.commitLog.length}),M();return}await (0,aH.updateTaskStatus)(a,"DONE"),ai.toast.success(l("taskPage.taskCompleted")),M()}catch{ai.toast.error("Failed to complete task"),M()}},[h,M,l]),P=(0,c.useCallback)(async a=>{let b=h.find(b=>b.id===a);if(b)try{let c=await (0,aI.checkWorktreeClean)(a);if(!c.hasWorktree){await (0,aH.updateTaskStatus)(a,"CANCELLED"),ai.toast.success(l("taskPage.taskCancelled")),M();return}I({task:b,files:c.files,commitLog:c.commitLog}),M()}catch{ai.toast.error("Failed to cancel task"),M()}},[h,M,l]),Q=(0,c.useCallback)(async(a,b)=>{"DONE"===b?await O(a):"CANCELLED"===b?await P(a):(await (0,aH.updateTaskStatus)(a,b),M())},[M,O,P]),R=(0,c.useCallback)(async a=>{let b=await (0,a1.createTask)({title:a.title,description:a.description,projectId:e,priority:a.priority,status:a.status,labelIds:a.labelIds,baseBranch:a.baseBranch,subPath:a.subPath,versionId:a.versionId??void 0});if(a.autoStart&&b?.id)try{await (0,a5.startPtyExecution)(b.id,""),z(b.id)}catch(a){ai.toast.error(a instanceof Error?a.message:String(a))}M()},[e,M]),S=(0,c.useCallback)(async(a,b)=>{await (0,a2.updateTask)(a,{...b,labelIds:b.labelIds}),E(null),M()},[M]),T=(0,c.useCallback)(async a=>{await a3(a),y===a&&z(null),M()},[M,y]),U=(0,c.useCallback)(async a=>{await a4(a),M()},[M]),V=(0,c.useCallback)(async b=>{try{await (0,a5.startPtyExecution)(b,"")}catch(a){ai.toast.error(a instanceof Error?a.message:String(a))}k.push(`/workspaces/${a}/tasks/${b}`)},[k,a]),W=(0,c.useCallback)(async(a,b)=>{"DONE"===b?await O(a):"CANCELLED"===b?await P(a):(await (0,aH.updateTaskStatus)(a,b),M())},[M,O,P]),X=(0,c.useCallback)(a=>{x(a),E(null),v(!0)},[]),Y=(0,c.useCallback)(a=>{E(a),v(!0)},[]),Z=h.filter(a=>!a.labels?.some(a=>a.label.name===r.TOWER_LABEL_NAME&&a.label.isBuiltin)).filter(a=>{if("backlog"===s){if(a.versionId)return!1}else if("all"!==s&&a.versionId!==s)return!1;if(p.trim()){let b=p.toLowerCase();if(!a.title.toLowerCase().includes(b)&&!a.description?.toLowerCase().includes(b))return!1}return!0});return(0,b.jsxs)("div",{className:"flex h-full",children:[(0,b.jsxs)("div",{className:"flex flex-1 flex-col overflow-hidden",children:[(0,b.jsx)("div",{className:"px-6 pt-3 pb-1",children:(0,b.jsx)(ba,{projects:g,activeProjectId:e,workspaceId:a,onSelect:b=>k.push(`/workspaces/${a}?projectId=${b}`,{scroll:!1})})}),(0,b.jsx)(o,{searchQuery:p,onSearchChange:N,versions:A,versionFilter:s,onVersionFilterChange:t,versionsHref:`/workspaces/${a}/projects/${e}/versions`,onCreateTask:()=>{E(null),v(!0)}}),(0,b.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden p-4",children:(0,b.jsx)(K,{initialTasks:Z,onTaskMove:Q,onTaskClick:a=>{z(a.id)},onEditTask:Y,onAddTask:X,onDeleteTask:T,onTogglePin:U,workspaceId:a,onContextMenuStatusChange:W,onContextMenuLaunch:V})}),(0,b.jsx)(L.CreateTaskDialog,{open:u,onOpenChange:a=>{v(a),a||E(null)},onSubmit:R,onUpdate:S,defaultStatus:w,editTask:D,editTaskLabelIds:D?.labels?D.labels.map(a=>a.labelId):[],labels:i.filter(a=>!(a.name===r.TOWER_LABEL_NAME&&a.isBuiltin)),projectType:f.type,projectLocalPath:f.localPath,versions:A,defaultVersionId:J})]}),C?(0,b.jsx)(a0,{task:C,workspaceId:a,projectLocalPath:f.localPath,onClose:()=>z(null)}):(0,b.jsx)(as,{project:f,workspaceId:a}),F&&(0,b.jsx)(aA.TaskMergeConfirmDialog,{open:!0,onOpenChange:a=>{a||G(null)},taskId:F.task.id,taskTitle:F.task.title,baseBranch:F.task.baseBranch??"main",fileCount:0,commitCount:F.commitCount,commitLog:F.commitLog,onMergeComplete:()=>{G(null),ai.toast.success(l("taskPage.taskCompleted")),M()}}),H&&(0,b.jsx)(bc,{open:!0,onOpenChange:a=>{a||I(null)},taskTitle:H.task.title,uncommittedFiles:H.files,commitLog:H.commitLog,onConfirm:()=>{let a=H.task.id;I(null),(0,aH.updateTaskStatus)(a,"CANCELLED").then(()=>{ai.toast.success(l("taskPage.taskCancelled")),M()}).catch(()=>ai.toast.error("Failed to cancel task"))}})]})}],473935)}];
1
+ module.exports=[473935,a=>{"use strict";var b=a.i(728778),c=a.i(374637),d=a.i(553798),e=a.i(634910),f=a.i(774881),g=a.i(573242),h=a.i(577565),i=a.i(283857),j=a.i(699570),k=a.i(866718),l=a.i(580701),m=a.i(785259),n=a.i(951192);function o({searchQuery:a,onSearchChange:c,versions:d=[],versionFilter:p="all",onVersionFilterChange:q,versionsHref:r,onCreateTask:s}){let t,{t:u}=(0,n.useI18n)(),v="all"===p?u("board.allVersions"):"backlog"===p?u("board.backlogFilter"):(t=d.find(a=>a.id===p))?`${t.number} ${t.name}`:u("board.allVersions");return(0,b.jsxs)("div",{className:"flex items-center gap-2 px-6 py-2",children:[q&&(0,b.jsxs)(l.Select,{value:p,onValueChange:a=>q(a||"all"),children:[(0,b.jsxs)(l.SelectTrigger,{className:"h-8 w-44 shrink-0 gap-1.5 text-xs text-muted-foreground",children:[(0,b.jsx)(h.GitBranch,{className:"h-3.5 w-3.5 shrink-0"}),(0,b.jsx)("span",{className:"truncate",children:v})]}),(0,b.jsxs)(l.SelectContent,{children:[(0,b.jsx)(l.SelectItem,{value:"all",children:u("board.allVersions")}),(0,b.jsx)(l.SelectItem,{value:"backlog",children:u("board.backlogFilter")}),d.map(a=>(0,b.jsxs)(l.SelectItem,{value:a.id,children:[(0,b.jsx)("span",{className:"font-mono",children:a.number})," ",a.name]},a.id))]})]}),(0,b.jsxs)("div",{className:"relative flex-1 max-w-xs",children:[(0,b.jsx)(g.Search,{className:"absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"}),(0,b.jsx)(k.Input,{type:"text",value:a,onChange:a=>c(a.target.value),placeholder:u("board.searchPlaceholder"),className:"pl-8 pr-3 text-xs"})]}),(0,b.jsxs)("div",{className:"ml-auto flex items-center gap-2",children:[(0,b.jsxs)(m.Tooltip,{children:[(0,b.jsx)(m.TooltipTrigger,{render:(0,b.jsx)(j.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground",children:(0,b.jsx)(i.Lightbulb,{className:"h-4 w-4"})})}),(0,b.jsx)(m.TooltipContent,{side:"bottom",className:"max-w-xs",children:u("board.tipText")})]}),r&&(0,b.jsx)(e.default,{href:r,children:(0,b.jsxs)(j.Button,{variant:"outline",className:"h-8 gap-1.5 text-xs text-muted-foreground",children:[(0,b.jsx)(h.GitBranch,{className:"h-3.5 w-3.5"}),u("version.timeline")]})}),(0,b.jsxs)(j.Button,{"data-tour":"create-task",variant:"outline",className:"gap-1.5 border-border text-xs text-muted-foreground hover:border-primary/30 hover:text-primary",onClick:s,children:[(0,b.jsx)(f.Plus,{className:"h-3.5 w-3.5"}),u("board.newTask")]})]})]})}var p=a.i(986099),q=a.i(668116),r=a.i(521007);function s({x:a,y:e,taskId:f,currentStatus:g,hasExecutions:h,workspaceId:i,onClose:j,onStatusChange:k,onLaunch:l}){let{t:m}=(0,n.useI18n)(),o=(0,d.useRouter)(),t=(0,c.useRef)(null);(0,c.useEffect)(()=>{let a=a=>{t.current&&!t.current.contains(a.target)&&j()},b=a=>{"Escape"===a.key&&j()};return document.addEventListener("mousedown",a),document.addEventListener("keydown",b),()=>{document.removeEventListener("mousedown",a),document.removeEventListener("keydown",b)}},[j]);let u="flex items-center px-3 py-1.5 text-xs cursor-pointer hover:bg-accent rounded-sm w-full text-left",v=(0,b.jsxs)("div",{ref:t,style:{position:"fixed",top:e,left:a,zIndex:9999},className:"bg-popover border border-border rounded-md shadow-md py-1 min-w-[180px]",children:[(0,b.jsx)("div",{className:"px-3 py-1 text-[10px] text-muted-foreground uppercase tracking-wider",children:m("board.contextMenu.changeStatus")}),r.BOARD_COLUMNS.map(a=>(0,b.jsxs)("button",{type:"button",className:u,onClick:()=>{k(f,a.id),j()},children:[g===a.id?(0,b.jsx)(q.Check,{className:"h-3 w-3 mr-2 flex-shrink-0"}):(0,b.jsx)("span",{className:"w-5 flex-shrink-0"}),a.label]},a.id)),(0,b.jsx)("hr",{className:"my-1 border-border"}),(0,b.jsx)("button",{type:"button",className:`${u} ${h?"opacity-50 cursor-not-allowed":""}`,disabled:h,onClick:()=>{h||(l(f),j())},children:m("board.contextMenu.launch")}),"DONE"!==g&&"CANCELLED"!==g&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("hr",{className:"my-1 border-border"}),(0,b.jsx)("button",{type:"button",className:u,onClick:()=>{o.push(`/workspaces/${i}/tasks/${f}`),j()},children:m("board.contextMenu.goToDetail")})]})]});return"u"<typeof document?null:(0,p.createPortal)(v,document.body)}var t=a.i(643228),u=a.i(859103),v=a.i(651571),w=a.i(514126),x=a.i(336771),y=a.i(690251),z=a.i(975231),A=a.i(711796);let B=(0,A.default)("pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]);var C=a.i(786304),D=a.i(335732),E=a.i(551578);function F({task:a,onClick:c,onEdit:d,onDelete:e,onTogglePin:f,onContextMenu:g}){let{t:i}=(0,n.useI18n)(),{attributes:k,listeners:l,setNodeRef:o,transform:p,transition:q,isDragging:s}=(0,u.useSortable)({id:a.id,data:{type:"task",task:a}}),t={transform:w.CSS.Transform.toString(p),transition:q,opacity:s?.4:1},v=r.PRIORITY_CONFIG[a.priority],A=!!a.baseBranch;return(0,b.jsxs)("div",{ref:o,style:t,...k,...l,className:"group cursor-grab rounded-lg border border-border bg-card p-3 transition-all hover:border-primary/20 hover:bg-accent/50 active:cursor-grabbing",onClick:c,onContextMenu:b=>{b.preventDefault(),b.stopPropagation(),g?.(a,b.clientX,b.clientY)},"data-testid":"task-card",children:[(0,b.jsxs)("div",{className:"flex items-start justify-between",children:[(0,b.jsx)("h4",{className:"text-sm font-medium text-foreground",children:a.title}),(0,b.jsxs)("div",{className:"flex items-center gap-0.5 shrink-0",children:[(0,b.jsx)(j.Button,{variant:"ghost",size:"icon-xs",className:`transition-all ${a.pinned?"text-primary opacity-100":"text-muted-foreground opacity-0 group-hover:opacity-100"}`,onClick:b=>{b.stopPropagation(),f?.(a.id)},"aria-label":i(a.pinned?"board.unpin":"board.pin"),children:(0,b.jsx)(B,{className:`h-3.5 w-3.5 ${a.pinned?"-rotate-45":""}`})}),(0,b.jsxs)(D.DropdownMenu,{children:[(0,b.jsx)(D.DropdownMenuTrigger,{render:(0,b.jsx)("button",{className:"rounded-md p-0.5 text-muted-foreground opacity-0 transition-all hover:bg-background hover:text-foreground group-hover:opacity-100",onClick:a=>a.stopPropagation()}),children:(0,b.jsx)(x.MoreHorizontal,{className:"h-4 w-4"})}),(0,b.jsxs)(D.DropdownMenuContent,{align:"end",children:[(0,b.jsxs)(D.DropdownMenuItem,{onClick:b=>{b.stopPropagation(),d?.(a)},children:[(0,b.jsx)(y.Pencil,{className:"mr-2 h-3.5 w-3.5"}),i("common.edit")]}),(0,b.jsxs)(D.DropdownMenuItem,{className:"text-rose-400",onClick:b=>{b.stopPropagation(),e?.(a.id)},children:[(0,b.jsx)(z.Trash2,{className:"mr-2 h-3.5 w-3.5"}),i("common.delete")]})]})]})]})]}),a.description&&(0,b.jsx)("p",{className:"mt-1.5 line-clamp-3 text-xs leading-relaxed text-muted-foreground",children:a.description}),(0,b.jsxs)("div",{className:"mt-2.5 flex flex-wrap items-center gap-1.5",children:[(0,b.jsx)(C.Badge,{variant:"secondary",className:`text-[10px] font-semibold ${v.color}`,children:v.label}),a.labels?.map(a=>(0,b.jsx)("span",{className:"rounded-full px-1.5 py-0.5 text-[10px] font-medium",style:{backgroundColor:a.label.color+"20",color:a.label.color},children:a.label.name},a.label.id)),(A||a.version)&&(0,b.jsxs)("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:[A&&(0,b.jsxs)(m.Tooltip,{disableHoverablePopup:!0,children:[(0,b.jsx)(m.TooltipTrigger,{render:(0,b.jsx)("span",{className:"inline-flex cursor-default items-center rounded-md border border-border bg-muted px-1 py-0.5 text-muted-foreground",onPointerDown:a=>a.stopPropagation(),children:(0,b.jsx)(h.GitBranch,{className:"h-2.5 w-2.5 shrink-0"})})}),(0,b.jsx)(m.TooltipContent,{side:"top",children:i("board.card.worktree",{branch:a.baseBranch??""})})]}),a.version&&(0,b.jsxs)(m.Tooltip,{disableHoverablePopup:!0,children:[(0,b.jsx)(m.TooltipTrigger,{render:(0,b.jsx)("span",{className:"cursor-default",onPointerDown:a=>a.stopPropagation(),children:(0,b.jsx)(E.TaskVersionTag,{number:a.version.number,title:""})})}),(0,b.jsx)(m.TooltipContent,{side:"top",children:i("board.card.version",{number:a.version.number,name:a.version.name})})]})]})]})]})}var G=a.i(814574),H=a.i(269876);function I({open:a,onOpenChange:c,columnLabel:d,columnColor:e,tasks:f,onTaskClick:g}){let{t:h}=(0,n.useI18n)();return(0,b.jsx)(G.Dialog,{open:a,onOpenChange:c,children:(0,b.jsxs)(G.DialogContent,{className:"sm:max-w-6xl max-h-[80vh]",children:[(0,b.jsx)(G.DialogHeader,{children:(0,b.jsxs)(G.DialogTitle,{className:"flex items-center gap-2",children:[(0,b.jsx)("div",{className:`h-2.5 w-2.5 rounded-full ${e}`}),(0,b.jsx)("span",{children:d}),(0,b.jsx)("span",{className:"rounded-md bg-muted px-1.5 py-0.5 text-xs font-mono font-medium text-muted-foreground",children:f.length})]})}),(0,b.jsx)(H.ScrollArea,{className:"max-h-[680px]",children:(0,b.jsxs)("div",{className:"grid grid-cols-4 gap-3 pr-3",children:[f.map(a=>{let d=r.PRIORITY_CONFIG[a.priority];return(0,b.jsxs)("div",{className:"cursor-pointer rounded-lg border border-border bg-card p-3 transition-all hover:border-primary/20 hover:bg-accent/50",onClick:()=>{g?.(a),c(!1)},children:[(0,b.jsx)("h4",{className:"text-sm font-medium text-foreground line-clamp-2",children:a.title}),a.description&&(0,b.jsx)("p",{className:"mt-1.5 line-clamp-2 text-xs leading-relaxed text-muted-foreground",children:a.description}),(0,b.jsxs)("div",{className:"mt-2 flex items-center gap-1.5 flex-wrap",children:[(0,b.jsx)(C.Badge,{variant:"secondary",className:`text-[10px] font-semibold ${d.color}`,children:d.label}),a.labels?.map(a=>(0,b.jsx)("span",{className:"rounded-full px-1.5 py-0.5 text-[10px] font-medium",style:{backgroundColor:a.label.color+"20",color:a.label.color},children:a.label.name},a.label.id))]})]},a.id)}),0===f.length&&(0,b.jsx)("div",{className:"col-span-4 py-8 text-center text-sm text-muted-foreground",children:h("board.noTasks")})]})})]})})}function J({id:a,label:d,color:e,tasks:g,onTaskClick:h,onEditTask:i,onAddTask:k,onDeleteTask:l,onTogglePin:m,onContextMenu:o}){let{setNodeRef:p,isOver:q}=(0,t.useDroppable)({id:a}),[r,s]=(0,c.useState)(!1),{t:w}=(0,n.useI18n)();return(0,b.jsxs)("div",{className:`flex w-0 min-w-[220px] flex-1 flex-col min-h-0 border-r border-border/50 last:border-r-0 transition-colors ${q?"bg-primary/[0.06]":""}`,children:[(0,b.jsxs)("div",{className:"flex items-center justify-between px-3 py-2.5 border-b border-border/30",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("div",{className:`h-2 w-2 rounded-full ${e}`}),(0,b.jsx)("span",{className:"text-xs font-semibold tracking-wide text-secondary-foreground",children:d}),(0,b.jsx)("span",{className:"rounded-md bg-muted px-1.5 py-0.5 text-[10px] font-mono font-medium text-muted-foreground",children:g.length})]}),(0,b.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,b.jsx)(j.Button,{variant:"ghost",size:"icon-xs",onClick:()=>s(!0),className:"text-muted-foreground","aria-label":w("board.viewAll"),children:(0,b.jsx)(v.LayoutGrid,{className:"h-3.5 w-3.5"})}),(0,b.jsx)(j.Button,{variant:"ghost",size:"icon-xs",onClick:k,className:"text-muted-foreground","aria-label":"add",children:(0,b.jsx)(f.Plus,{className:"h-3.5 w-3.5"})})]})]}),(0,b.jsx)(I,{open:r,onOpenChange:s,columnLabel:d,columnColor:e,tasks:g,onTaskClick:h}),(0,b.jsx)(H.ScrollArea,{className:"flex-1 min-h-0",children:(0,b.jsx)("div",{ref:p,className:"flex flex-col gap-2 p-2",children:(0,b.jsx)(u.SortableContext,{items:g.map(a=>a.id),strategy:u.verticalListSortingStrategy,children:g.map(a=>(0,b.jsx)(F,{task:a,onClick:()=>h?.(a),onEdit:i,onDelete:l,onTogglePin:m,onContextMenu:o},a.id))})})})]})}function K({initialTasks:a,onTaskMove:d,onTaskClick:e,onEditTask:f,onAddTask:g,onDeleteTask:h,onTogglePin:i,onContextMenuStatusChange:j,onContextMenuLaunch:k,workspaceId:l}){let[m,n]=(0,c.useState)(a),[o,p]=(0,c.useState)(null),[q,u]=(0,c.useState)(null);(0,c.useEffect)(()=>{n(a)},[a]);let v=(0,t.useSensors)((0,t.useSensor)(t.PointerSensor,{activationConstraint:{distance:8}})),w=(0,c.useCallback)((a,b,c)=>{u({task:a,x:b,y:c})},[]),x=(0,c.useCallback)(a=>{let b=m.find(b=>b.id===a.active.id);b&&p(b)},[m]),y=(0,c.useCallback)(a=>{let b,{active:c,over:e}=a;if(p(null),!e)return;let f=c.id,g=e.id;if(r.BOARD_COLUMNS.some(a=>a.id===g))b=g;else{let a=m.find(a=>a.id===g);b=a?.status}b&&(n(a=>a.map(a=>a.id===f?{...a,status:b}:a)),d?.(f,b))},[m,d]);return(0,b.jsxs)(t.DndContext,{id:"kanban-board",sensors:v,collisionDetection:t.closestCorners,onDragStart:x,onDragEnd:y,children:[(0,b.jsx)("div",{className:"mx-2 flex h-full overflow-x-auto rounded-xl border border-border bg-card/50",children:r.BOARD_COLUMNS.map(a=>(0,b.jsx)(J,{id:a.id,label:a.label,color:a.color,tasks:m.filter(b=>b.status===a.id),onTaskClick:e,onEditTask:f,onAddTask:()=>g?.(a.id),onDeleteTask:h,onTogglePin:i,onContextMenu:w},a.id))}),(0,b.jsx)(t.DragOverlay,{children:o?(0,b.jsx)("div",{className:"rotate-3 scale-105",children:(0,b.jsx)(F,{task:o})}):null}),q&&(0,b.jsx)(s,{x:q.x,y:q.y,taskId:q.task.id,currentStatus:q.task.status,hasExecutions:(q.task._count?.executions??0)>0,workspaceId:l??"",onClose:()=>u(null),onStatusChange:(a,b)=>{j?.(a,b),u(null)},onLaunch:a=>{k?.(a),u(null)}})]})}var L=a.i(445798);function M(a,b,c){return Math.min(Math.max(a,b),c)}var N=a.i(442620),O=a.i(10390),P=a.i(350739),Q=a.i(347165);let R=(0,A.default)("git-commit-vertical",[["path",{d:"M12 3v6",key:"1holv5"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M12 15v6",key:"a9ows0"}]]);var S=a.i(616335),T=a.i(704494),U=a.i(394259),V=a.i(625892),W=a.i(939859),X=a.i(648512),Y=a.i(22761),Z=a.i(429246),$=a.i(780410);let _=(0,$.createServerReference)("608aac1637b86613ba60424496283123c9a2a5de0b",$.callServer,void 0,$.findSourceMapURL,"updateProject");var aa=a.i(68222);let ab=(0,$.createServerReference)("40f16c9bf878ed8da769bf0b0f991bce6a98c60409",$.callServer,void 0,$.findSourceMapURL,"deleteProject"),ac=(0,$.createServerReference)("40ebfe2e4d860bd1f880950a57713cfba603ebe8cb",$.callServer,void 0,$.findSourceMapURL,"getRecentLocalProjects"),ad=(0,$.createServerReference)("4054b75c148f6c4fd80843f786e74e0da8e3622d60",$.callServer,void 0,$.findSourceMapURL,"getOrCreateTowerTaskId");var ae=a.i(231780),af=a.i(441143),ag=a.i(123248),ah=a.i(150895),ai=a.i(952313),aj=a.i(43775),ak=a.i(487410);function al({commits:a}){let{t:d}=(0,n.useI18n)(),[e,f]=(0,c.useState)(!1);return 0===a.length?null:(0,b.jsxs)("div",{className:"border-b border-border",children:[(0,b.jsxs)("button",{onClick:()=>f(!e),className:"flex w-full items-center gap-1 px-2 py-1.5 hover:bg-accent/50 transition-colors",children:[e?(0,b.jsx)(N.ChevronDown,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):(0,b.jsx)(O.ChevronRight,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),(0,b.jsxs)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:[d("git.commitLog")," (",a.length,")"]})]}),e&&(0,b.jsx)("div",{className:"mt-0.5 mb-1.5 space-y-0.5 max-h-64 overflow-y-auto",children:a.map(a=>(0,b.jsxs)("div",{className:"group flex items-start gap-2 rounded-md px-2 py-1.5 hover:bg-accent transition-colors",children:[(0,b.jsx)(R,{className:"h-3 w-3 shrink-0 text-muted-foreground mt-0.5"}),(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("p",{className:"text-xs text-foreground line-clamp-1",children:a.message}),(0,b.jsxs)("div",{className:"flex items-center gap-2 mt-0.5",children:[(0,b.jsxs)("button",{onClick:()=>{navigator.clipboard.writeText(a.shortHash),ai.toast.success(`Copied ${a.shortHash}`)},className:"flex items-center gap-0.5 font-mono text-[10px] text-primary/70 hover:text-primary transition-colors",children:[a.shortHash,(0,b.jsx)(Y.Copy,{className:"h-2.5 w-2.5 opacity-0 group-hover:opacity-100 transition-opacity"})]}),(0,b.jsx)("span",{className:"text-[10px] text-muted-foreground",children:a.author}),(0,b.jsx)("span",{className:"text-[10px] text-muted-foreground",children:function(a){let b=Math.floor((Date.now()-new Date(a).getTime())/6e4);if(b<1)return"just now";if(b<60)return`${b}m`;let c=Math.floor(b/60);if(c<24)return`${c}h`;let d=Math.floor(c/24);return d<30?`${d}d`:`${Math.floor(d/30)}mo`}(a.date)})]})]})]},a.hash))})]})}var am=a.i(607219),an=a.i(324263),ao=a.i(7285);function ap({localPath:a,stashes:d,hasChanges:e,onRefresh:f}){let{t:g}=(0,n.useI18n)(),[h,i]=(0,c.useState)(!1),[l,m]=(0,c.useState)(!1),[o,p]=(0,c.useState)(""),[q,r]=(0,c.useState)(null),s=async()=>{m(!0);try{await (0,ao.gitAction)(a,"stash-save",{message:o}),p(""),ai.toast.success(g("git.stashSaved")),await f()}catch(a){ai.toast.error(a instanceof Error?a.message:String(a))}finally{m(!1)}},t=async b=>{r(b);try{await (0,ao.gitAction)(a,"stash-pop",{index:b}),ai.toast.success(g("git.stashApplied")),await f()}catch(a){ai.toast.error(a instanceof Error?a.message:String(a))}finally{r(null)}},u=async b=>{r(b);try{await (0,ao.gitAction)(a,"stash-drop",{index:b}),ai.toast.success(g("git.stashDropped")),await f()}catch(a){ai.toast.error(a instanceof Error?a.message:String(a))}finally{r(null)}};return e||0!==d.length?(0,b.jsxs)("div",{className:"border-b border-border",children:[(0,b.jsxs)("button",{onClick:()=>i(!h),className:"flex w-full items-center gap-1 px-2 py-1.5 hover:bg-accent/50 transition-colors",children:[h?(0,b.jsx)(N.ChevronDown,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):(0,b.jsx)(O.ChevronRight,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),(0,b.jsxs)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:[g("git.stash")," ",d.length>0&&`(${d.length})`]})]}),h&&(0,b.jsxs)("div",{className:"mt-0.5 mb-1.5 space-y-2",children:[e&&(0,b.jsxs)("div",{className:"flex gap-1.5",children:[(0,b.jsx)(k.Input,{value:o,onChange:a=>p(a.target.value),placeholder:g("git.stashMsgPlaceholder"),className:"h-7 text-xs flex-1",onKeyDown:a=>"Enter"===a.key&&s()}),(0,b.jsx)(j.Button,{variant:"outline",size:"icon-sm",onClick:s,disabled:l,className:"shrink-0",children:l?(0,b.jsx)(T.Loader2,{className:"h-3 w-3 animate-spin"}):(0,b.jsx)(am.Archive,{className:"h-3 w-3"})})]}),d.length>0&&(0,b.jsx)("div",{className:"space-y-0.5",children:d.map(a=>(0,b.jsxs)("div",{className:"group flex items-center gap-2 rounded-md px-2 py-1.5 hover:bg-accent transition-colors",children:[(0,b.jsx)(am.Archive,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),(0,b.jsx)("span",{className:"flex-1 min-w-0 truncate text-xs text-foreground",children:a.message||`stash@{${a.index}}`}),(0,b.jsxs)("div",{className:"flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,b.jsx)(j.Button,{variant:"ghost",size:"icon-xs",onClick:()=>t(a.index),disabled:q===a.index,className:"text-muted-foreground","aria-label":g("git.stashApply"),children:q===a.index?(0,b.jsx)(T.Loader2,{className:"h-3 w-3 animate-spin"}):(0,b.jsx)(an.ArrowUpFromLine,{className:"h-3 w-3"})}),(0,b.jsx)(j.Button,{variant:"ghost",size:"icon-xs",onClick:()=>u(a.index),disabled:q===a.index,className:"text-rose-400","aria-label":g("git.stashDrop"),children:(0,b.jsx)(z.Trash2,{className:"h-3 w-3"})})]})]},a.index))})]})]}):null}var aq=a.i(985716);function ar({value:a,ariaLabel:d}){let{t:e}=(0,n.useI18n)(),[f,g]=(0,c.useState)(!1),h=async()=>{try{if(navigator.clipboard)await navigator.clipboard.writeText(a);else{let b=document.createElement("textarea");b.value=a,document.body.appendChild(b),b.select(),document.execCommand("copy"),document.body.removeChild(b)}g(!0),ai.toast.success(e("common.copied")),setTimeout(()=>g(!1),1500)}catch{ai.toast.error(e("common.copyFailed"))}};return(0,b.jsxs)("div",{className:"flex items-center gap-1 rounded-md border border-border bg-muted/50 pl-3 pr-1 py-1.5",children:[(0,b.jsx)("span",{className:"min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground",title:a,children:a}),(0,b.jsxs)(m.Tooltip,{children:[(0,b.jsx)(m.TooltipTrigger,{render:(0,b.jsx)(j.Button,{variant:"ghost",size:"icon-xs",className:"shrink-0 text-muted-foreground","aria-label":d,onClick:h,children:f?(0,b.jsx)(q.Check,{className:"h-3 w-3 text-emerald-400"}):(0,b.jsx)(Y.Copy,{className:"h-3 w-3"})})}),(0,b.jsx)(m.TooltipContent,{children:f?e("common.copied"):e("common.copy")})]})]})}function as({project:a,workspaceId:e}){let{t:f,locale:g}=(0,n.useI18n)(),i=(0,d.useRouter)(),{width:l,isDragging:o,startResize:p}=function(a){let{storageKey:b,defaultWidth:d,minWidth:e,maxWidth:f,edge:g="left"}=a,[h,i]=(0,c.useState)(d),[j,k]=(0,c.useState)(!1),l=(0,c.useRef)(null);(0,c.useEffect)(()=>{try{let a=window.localStorage.getItem(b),c=null==a?NaN:Number(a);Number.isFinite(c)&&i(M(c,e,f))}catch{}},[b,e,f]);let m=(0,c.useCallback)(a=>{let b=l.current;b&&i(function(a,b,c,d,e,f="left"){return M(a+("left"===f?b-c:c-b),d,e)}(b.width,b.x,a.clientX,e,f,g))},[e,f,g]),n=(0,c.useCallback)(()=>{l.current&&(l.current=null,k(!1),window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",n),i(a=>{try{window.localStorage.setItem(b,String(a))}catch{}return a}))},[m,b]),o=(0,c.useCallback)(a=>{a.preventDefault(),l.current={x:a.clientX,width:h},k(!0),window.addEventListener("pointermove",m),window.addEventListener("pointerup",n)},[h,m,n]);return(0,c.useEffect)(()=>()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",n)},[m,n]),{width:h,isDragging:j,startResize:o}}({storageKey:"tower:repo-sidebar-width",defaultWidth:288,minWidth:240,maxWidth:560,edge:"left"}),[q,r]=(0,c.useState)(!0),[s,t]=(0,c.useState)(!0),[u,v]=(0,c.useState)(!1),[w,x]=(0,c.useState)(!1),[A,B]=(0,c.useState)(""),[C,D]=(0,c.useState)(!1),[E,F]=(0,c.useState)(!1),[H,I]=(0,c.useState)(!1),[J,K]=(0,c.useState)(a.name),[L,Y]=(0,c.useState)(a.alias??""),[$,am]=(0,c.useState)(a.description??""),[an,ao]=(0,c.useState)(a.localPath??""),[at,au]=(0,c.useState)(a.projectType??"FRONTEND"),[av,aw]=(0,c.useState)([]);(0,c.useEffect)(()=>{ac(100).then(aw)},[]);let[ax,ay]=(0,c.useState)(!1),[az,aA]=(0,c.useState)(""),[aB,aC]=(0,c.useState)(""),[aD,aE]=(0,c.useState)(""),[aF,aG]=(0,c.useState)(""),[aH,aI]=(0,c.useState)("FRONTEND"),[aJ,aK]=(0,c.useState)(!1),[aL,aM]=(0,c.useState)(!1),[aN,aO]=(0,c.useState)(null),[aP,aQ]=(0,c.useState)(!1),[aR,aS]=(0,c.useState)(!1),aT=a=>{ai.toast.info(a)},aU=(0,c.useCallback)(async()=>{if(a.localPath){aQ(!0);try{let b=await fetch(`/api/git?path=${encodeURIComponent(a.localPath)}`);b.ok&&aO(await b.json())}catch{}finally{aQ(!1)}}},[a.localPath]);(0,c.useEffect)(()=>{aU()},[aU]);let aV=async()=>{if(a.localPath){aS(!0);try{(await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"init",path:a.localPath})})).ok?(aT(f("git.initSuccess")),await aU()):aT(f("git.initFailed"))}catch{aT(f("git.initFailed"))}finally{aS(!1)}}},aW=(a,b)=>{i.push(`/workspaces/${a}?projectId=${b}`,{scroll:!1}),i.refresh()},aX=async()=>{if(aB.trim()){aK(!0);try{let a=await (0,aa.createProject)({name:aB.trim(),alias:aD.trim()||void 0,description:aF.trim()||void 0,localPath:az,projectType:aH,workspaceId:e});ay(!1),aW(e,a.id)}catch(a){ai.toast.error(a instanceof Error?a.message:String(a))}finally{aK(!1)}}},aY=async()=>{if(an&&!aL){aM(!0);try{let a=await (0,ah.analyzeProjectDirectory)(an.trim(),g);am(a)}catch{ai.toast.error(f("project.analyzeError"))}finally{aM(!1)}}},aZ=async()=>{try{await _(a.id,{name:J.trim(),alias:L.trim()||void 0,description:$.trim()||void 0,localPath:an.trim()||void 0,projectType:at}),i.refresh(),v(!1)}catch(a){ai.toast.error(a instanceof Error?a.message:String(a))}};return(0,b.jsxs)("aside",{className:"relative flex-shrink-0 border-l border-border bg-sidebar",style:{width:l},children:[(0,b.jsx)("div",{onPointerDown:p,className:`absolute left-0 top-0 z-20 h-full w-1 -translate-x-1/2 cursor-col-resize transition-colors hover:bg-primary/20 ${o?"bg-primary/40":"bg-transparent"}`,role:"separator","aria-orientation":"vertical","aria-label":f("sidebar.right.resize")}),(0,b.jsxs)("div",{className:"h-full overflow-y-auto",children:[(0,b.jsxs)("div",{className:"border-b border-border p-4",children:[(0,b.jsxs)("div",{className:"flex items-start justify-between",children:[(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("h2",{className:"text-base font-semibold text-foreground",children:a.name}),a.alias&&(0,b.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:a.alias})]}),(0,b.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,b.jsx)(j.Button,{variant:"ghost",size:"icon-sm",onClick:()=>{K(a.name),Y(a.alias??""),am(a.description??""),ao(a.localPath??""),v(!0)},className:"text-muted-foreground",children:(0,b.jsx)(y.Pencil,{className:"h-3.5 w-3.5"})}),(0,b.jsx)(j.Button,{variant:"ghost",size:"icon-sm",onClick:()=>{B(""),x(!0)},className:"text-muted-foreground hover:text-rose-400",children:(0,b.jsx)(z.Trash2,{className:"h-3.5 w-3.5"})})]})]}),a.description&&(0,b.jsx)("p",{className:"mt-2 text-sm text-secondary-foreground leading-relaxed line-clamp-4",children:a.description}),(0,b.jsx)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:(0,b.jsx)("span",{className:`inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-[11px] font-medium ${"GIT"===a.type?"bg-sky-500/15 text-sky-300 ring-1 ring-sky-500/20":"bg-muted text-muted-foreground ring-1 ring-border"}`,children:"GIT"===a.type?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(h.GitBranch,{className:"h-3 w-3"}),f("sidebar.right.gitType")]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(P.FileText,{className:"h-3 w-3"}),f("sidebar.right.normalType")]})})}),a.gitUrl&&(0,b.jsx)("div",{className:"mt-3 space-y-1.5",children:(0,b.jsx)(ar,{value:a.gitUrl,ariaLabel:f("project.gitUrl")})}),a.localPath&&(0,b.jsxs)("div",{className:"mt-3 space-y-1.5",children:[(0,b.jsxs)("div",{className:"flex items-center gap-1",children:[(0,b.jsxs)(m.Tooltip,{children:[(0,b.jsx)(m.TooltipTrigger,{render:(0,b.jsx)(j.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground",onClick:async()=>{try{await (0,ae.openInFileManager)(a.localPath)}catch(a){console.error("openInFileManager failed:",a),ai.toast.error(f("git.openInFileManagerFailed"))}},children:(0,b.jsx)(V.FolderSearch,{className:"h-4 w-4"})})}),(0,b.jsx)(m.TooltipContent,{children:f("git.openInFileManager")})]}),(0,b.jsxs)(m.Tooltip,{children:[(0,b.jsx)(m.TooltipTrigger,{render:(0,b.jsx)(j.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground",onClick:async()=>{try{await (0,af.openInEditor)(a.localPath)}catch(a){console.error("openInEditor failed:",a),ai.toast.error(f("git.openInEditorFailed"))}},children:(0,b.jsx)(W.Code,{className:"h-4 w-4"})})}),(0,b.jsx)(m.TooltipContent,{children:f("git.openInEditor")})]}),(0,b.jsxs)(m.Tooltip,{children:[(0,b.jsx)(m.TooltipTrigger,{render:(0,b.jsx)(j.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground",onClick:async()=>{try{await (0,ag.openInTerminal)(a.localPath)}catch(a){console.error("openInTerminal failed:",a),ai.toast.error(f("git.openInTerminalFailed"))}},children:(0,b.jsx)(X.Terminal,{className:"h-4 w-4"})})}),(0,b.jsx)(m.TooltipContent,{children:f("git.openInTerminal")})]})]}),(0,b.jsxs)(j.Button,{variant:"outline",className:"w-full h-9 gap-1.5 text-xs",disabled:E,onClick:async()=>{F(!0);try{let b=await ad(a.id);i.push(`/workspaces/${e}/tasks/${b}`)}catch{ai.toast.error(f("git.openStudioFailed"))}finally{F(!1)}},children:[E?(0,b.jsx)(T.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):(0,b.jsx)(Q.FolderOpen,{className:"h-3.5 w-3.5"}),f("git.openStudio")]})]})]}),(0,b.jsxs)("div",{className:"border-b border-border p-4",children:[(0,b.jsxs)(j.Button,{variant:"ghost",onClick:()=>r(!q),className:"flex w-full cursor-pointer justify-between px-2 py-2",children:[(0,b.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:f("git.section")}),q?(0,b.jsx)(N.ChevronDown,{className:"h-3.5 w-3.5 text-muted-foreground"}):(0,b.jsx)(O.ChevronRight,{className:"h-3.5 w-3.5 text-muted-foreground"})]}),q&&(0,b.jsx)("div",{className:"mt-3",children:a.localPath?aP?(0,b.jsxs)("div",{className:"flex items-center justify-center py-4 text-muted-foreground",children:[(0,b.jsx)(T.Loader2,{className:"h-4 w-4 animate-spin"}),(0,b.jsx)("span",{className:"ml-2 text-xs",children:f("git.loading")})]}):aN&&!aN.isGit?(0,b.jsxs)("div",{className:"rounded-lg border border-border bg-muted/50 p-3",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,b.jsx)(S.AlertCircle,{className:"h-3.5 w-3.5"}),(0,b.jsx)("p",{className:"text-xs",children:f("git.notInitialized")})]}),(0,b.jsxs)(j.Button,{className:"mt-3 h-7 w-full gap-1.5 bg-primary/10 text-xs text-primary ring-1 ring-primary/20 hover:bg-primary/15",onClick:aV,disabled:aR,children:[aR?(0,b.jsx)(T.Loader2,{className:"h-3 w-3 animate-spin"}):(0,b.jsx)(R,{className:"h-3 w-3"}),f("git.initRepo")]})]}):aN?.isGit?(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"flex flex-col",children:(0,b.jsx)(aq.EditorGitPanel,{localPath:a.localPath,mode:"project"})}),(0,b.jsx)(al,{commits:aN.commits??[]}),(0,b.jsx)(ap,{localPath:a.localPath,stashes:aN.stashes??[],hasChanges:(aN.changedFiles??[]).length>0,onRefresh:aU})]}):null:(0,b.jsx)("div",{className:"rounded-lg border border-border bg-muted/50 p-3",children:(0,b.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,b.jsx)(S.AlertCircle,{className:"h-3.5 w-3.5"}),(0,b.jsx)("p",{className:"text-xs",children:f("git.noLocalPath")})]})})})]}),(0,b.jsxs)("div",{className:"p-4",children:[(0,b.jsxs)(j.Button,{variant:"ghost",onClick:()=>t(!s),className:"flex w-full cursor-pointer justify-between px-2 py-2",children:[(0,b.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:f("sidebar.right.browseRepo")}),s?(0,b.jsx)(N.ChevronDown,{className:"h-3.5 w-3.5 text-muted-foreground"}):(0,b.jsx)(O.ChevronRight,{className:"h-3.5 w-3.5 text-muted-foreground"})]}),s&&(0,b.jsxs)("div",{className:"mt-3 space-y-3",children:[(0,b.jsxs)(j.Button,{variant:"outline",className:"w-full h-8 gap-1.5 text-xs",onClick:()=>I(!0),children:[(0,b.jsx)(Q.FolderOpen,{className:"h-3.5 w-3.5"}),f("sidebar.right.browseRepo")]}),av.length>0&&(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground mb-1.5 px-1",children:f("sidebar.right.recent")}),(0,b.jsx)("div",{className:"space-y-0.5",children:av.map(c=>(0,b.jsxs)("button",{onClick:()=>{c.id!==a.id&&aW(c.workspaceId,c.id)},className:`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left transition-colors ${c.id===a.id?"bg-primary/10 text-primary cursor-default":"hover:bg-accent cursor-pointer"}`,children:["GIT"===c.type?(0,b.jsx)(h.GitBranch,{className:"h-3 w-3 shrink-0 text-emerald-400"}):(0,b.jsx)(Q.FolderOpen,{className:"h-3 w-3 shrink-0 text-primary/70"}),(0,b.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,b.jsx)("p",{className:"truncate text-xs font-medium text-foreground",children:c.name}),c.localPath&&(0,b.jsx)("p",{className:"truncate text-[10px] font-mono text-muted-foreground",children:c.localPath})]})]},c.id))})]})]})]})]}),(0,b.jsx)(G.Dialog,{open:u,onOpenChange:v,children:(0,b.jsxs)(G.DialogContent,{style:{maxWidth:"32rem"},children:[(0,b.jsx)(G.DialogHeader,{children:(0,b.jsx)(G.DialogTitle,{children:f("project.edit")})}),(0,b.jsxs)("div",{className:"space-y-3 py-2",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.name")}),(0,b.jsx)(k.Input,{value:J,onChange:a=>K(a.target.value),className:"mt-1.5"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.type.label")}),(0,b.jsx)("div",{className:"mt-1.5",children:(0,b.jsx)(ak.SegmentedControl,{options:[{value:"FRONTEND",label:f("project.type.frontend")},{value:"BACKEND",label:f("project.type.backend")}],value:at,onChange:au})})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.alias")}),(0,b.jsx)(k.Input,{value:L,onChange:a=>Y(a.target.value),className:"mt-1.5"})]}),(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.description")}),(0,b.jsxs)(j.Button,{type:"button",variant:"ghost",onClick:aY,className:`h-6 gap-1 px-2 text-[11px] text-muted-foreground hover:text-foreground ${!an||aL?"opacity-50":""}`,children:[aL?(0,b.jsx)(T.Loader2,{className:"h-3 w-3 animate-spin"}):(0,b.jsx)(U.Sparkles,{className:"h-3 w-3"}),aL?f("project.analyzing"):f("project.genDesc")]})]}),(0,b.jsx)(Z.Textarea,{value:$,onChange:a=>am(a.target.value),rows:2,className:"mt-1.5 w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder-muted-foreground outline-none transition-colors focus:border-ring focus:ring-1 focus:ring-ring resize-none max-h-[200px] overflow-y-auto"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.localPath")}),(0,b.jsx)("div",{className:"mt-1.5 break-all rounded-md border border-border bg-muted/50 px-3 py-2 font-mono text-xs text-muted-foreground",children:an||"—"})]})]}),(0,b.jsxs)(G.DialogFooter,{children:[(0,b.jsx)(j.Button,{variant:"outline",onClick:()=>v(!1),children:f("common.cancel")}),(0,b.jsx)(j.Button,{onClick:aZ,disabled:!J.trim()||aL,className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:f("common.save")})]})]})}),(0,b.jsx)(aj.FolderBrowserDialog,{open:H,onOpenChange:I,onSelect:a=>{u?ao(a):(a=>{let b=av.find(b=>b.localPath===a);if(b)return aW(b.workspaceId,b.id);let c=a.replace(/[\\/]+$/,"").split(/[\\/]/).filter(Boolean).pop()??"";aA(a),aC(c),aE(""),aG(""),ay(!0)})(a)}}),(0,b.jsx)(G.Dialog,{open:ax,onOpenChange:ay,children:(0,b.jsxs)(G.DialogContent,{className:"sm:max-w-md",children:[(0,b.jsx)(G.DialogHeader,{children:(0,b.jsx)(G.DialogTitle,{children:f("topbar.newProject")})}),(0,b.jsxs)("div",{className:"space-y-3 py-2",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.localPath")}),(0,b.jsx)("div",{className:"mt-1.5 rounded-md border border-border bg-muted/50 px-3 py-2 font-mono text-xs text-muted-foreground",children:az})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.name")}),(0,b.jsx)(k.Input,{value:aB,onChange:a=>aC(a.target.value),placeholder:f("project.namePlaceholder"),className:"mt-1.5"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.type.label")}),(0,b.jsx)("div",{className:"mt-1.5",children:(0,b.jsx)(ak.SegmentedControl,{options:[{value:"FRONTEND",label:f("project.type.frontend")},{value:"BACKEND",label:f("project.type.backend")}],value:aH,onChange:aI})})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.alias")}),(0,b.jsx)(k.Input,{value:aD,onChange:a=>aE(a.target.value),placeholder:f("project.aliasPlaceholder"),className:"mt-1.5"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.description")}),(0,b.jsx)(Z.Textarea,{value:aF,onChange:a=>aG(a.target.value),placeholder:f("project.descPlaceholder"),rows:2,className:"mt-1.5 w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder-muted-foreground outline-none transition-colors focus:border-ring focus:ring-1 focus:ring-ring resize-none"})]})]}),(0,b.jsxs)(G.DialogFooter,{children:[(0,b.jsx)(j.Button,{variant:"outline",onClick:()=>ay(!1),children:f("common.cancel")}),(0,b.jsxs)(j.Button,{onClick:aX,disabled:!aB.trim()||aJ,className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:[aJ?(0,b.jsx)(T.Loader2,{className:"h-3 w-3 animate-spin mr-1"}):null,f("common.create")]})]})]})}),(0,b.jsx)(G.Dialog,{open:w,onOpenChange:a=>{x(a),a||B("")},children:(0,b.jsxs)(G.DialogContent,{className:"sm:max-w-md",children:[(0,b.jsx)(G.DialogHeader,{children:(0,b.jsx)(G.DialogTitle,{className:"text-rose-400",children:f("project.deleteTitle")})}),(0,b.jsxs)("div",{className:"space-y-3 py-2",children:[(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:f("project.deleteWarning",{name:a.name})}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:f("project.deleteIrreversible")}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.deleteConfirmLabel")}),(0,b.jsx)(k.Input,{value:A,onChange:a=>B(a.target.value),placeholder:f("project.deleteConfirmPlaceholder"),className:"mt-1.5",autoFocus:!0})]})]}),(0,b.jsxs)(G.DialogFooter,{children:[(0,b.jsx)(j.Button,{variant:"outline",onClick:()=>x(!1),children:f("common.cancel")}),(0,b.jsxs)(j.Button,{variant:"destructive",disabled:A!==f("project.deleteConfirmText")||C,onClick:async()=>{D(!0);try{await ab(a.id),ai.toast.success(f("project.deleteSuccess")),i.push(`/workspaces/${e}`)}catch{ai.toast.error(f("project.deleteFailed"))}finally{D(!1),x(!1)}},children:[C&&(0,b.jsx)(T.Loader2,{className:"h-3 w-3 animate-spin mr-1"}),f("project.deleteButton")]})]})]})})]})}var at=a.i(963326),au=a.i(300141),av=a.i(913284),aw=a.i(269280),ax=a.i(368114);function ay({title:a,description:c,branch:d,baseBranch:e,version:f,hasConversation:g,updatedAt:i,openDir:k,onBack:l}){let{t:o}=(0,n.useI18n)();return(0,b.jsxs)("div",{className:"border-b border-border px-4 py-3",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(U.Sparkles,{className:"h-3.5 w-3.5 text-primary"}),(0,b.jsx)("span",{className:"text-xs font-semibold text-primary",children:o("taskDetail.title")})]}),(0,b.jsxs)(j.Button,{variant:"ghost",onClick:l,className:"flex items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground h-auto px-2 py-1",children:[(0,b.jsx)(aw.ArrowLeft,{className:"h-3.5 w-3.5"}),o("taskDetail.back")]})]}),(0,b.jsx)("h2",{className:"mt-2.5 text-lg font-bold tracking-tight text-foreground",children:a}),c&&(0,b.jsx)("p",{className:"mt-1 text-xs text-muted-foreground line-clamp-2",children:c}),(0,b.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[e?(0,b.jsxs)(C.Badge,{variant:"secondary",className:"bg-muted text-muted-foreground text-[10px] font-mono border border-border",children:[(0,b.jsx)(h.GitBranch,{className:"mr-1 h-3 w-3"}),e," · worktree"]}):d?(0,b.jsx)(C.Badge,{variant:"secondary",className:"bg-muted text-muted-foreground text-[10px] font-mono border border-border",children:o("taskDetail.directMode")}):null,f&&(0,b.jsx)(E.TaskVersionTag,{number:f.number,name:f.name,showName:!0}),g&&(0,b.jsx)(C.Badge,{variant:"secondary",className:"bg-emerald-500/10 text-emerald-400 text-[10px] border border-emerald-500/20",children:o("taskDetail.hasConversation")}),(0,b.jsxs)("span",{className:"text-[11px] text-muted-foreground",children:[o("taskDetail.updatedAt")," ",(0,ax.formatRelativeTime)(i)]}),k&&(0,b.jsxs)("div",{className:"ml-auto flex items-center gap-0.5",children:[(0,b.jsxs)(m.Tooltip,{children:[(0,b.jsx)(m.TooltipTrigger,{render:(0,b.jsx)(j.Button,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:async()=>{try{await (0,ae.openInFileManager)(k)}catch(a){console.error("openInFileManager failed:",a),ai.toast.error(o("git.openInFileManagerFailed"))}},children:(0,b.jsx)(V.FolderSearch,{className:"h-3.5 w-3.5"})})}),(0,b.jsx)(m.TooltipContent,{side:"bottom",children:o("git.openInFileManager")})]}),(0,b.jsxs)(m.Tooltip,{children:[(0,b.jsx)(m.TooltipTrigger,{render:(0,b.jsx)(j.Button,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:async()=>{try{await (0,af.openInEditor)(k)}catch(a){console.error("openInEditor failed:",a),ai.toast.error(o("git.openInEditorFailed"))}},children:(0,b.jsx)(W.Code,{className:"h-3.5 w-3.5"})})}),(0,b.jsx)(m.TooltipContent,{side:"bottom",children:o("git.openInEditor")})]}),(0,b.jsxs)(m.Tooltip,{children:[(0,b.jsx)(m.TooltipTrigger,{render:(0,b.jsx)(j.Button,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:async()=>{try{await (0,ag.openInTerminal)(k)}catch(a){console.error("openInTerminal failed:",a),ai.toast.error(o("git.openInTerminalFailed"))}},children:(0,b.jsx)(X.Terminal,{className:"h-3.5 w-3.5"})})}),(0,b.jsx)(m.TooltipContent,{side:"bottom",children:o("git.openInTerminal")})]})]})]})]})}var az=a.i(639138),aA=a.i(88757),aB=a.i(347872),aC=a.i(375942),aD=a.i(803726),aE=a.i(938813),aF=a.i(388795),aG=a.i(879203),aH=a.i(32105),aI=a.i(362822),aJ=a.i(75414),aK=a.i(692448),aL=a.i(715525),aM=a.i(324954),aN=a.i(87339),aO=a.i(54384),aP=a.i(509405),aQ=a.i(846889),aR=a.i(226758),aS=a.i(556570),aT=a.i(958726),aU=a.i(930170),aV=a.i(75340),aW=a.i(532615),aX=a.i(894148),aY=a.i(510650),aZ=a.i(161181);let a$=/\.(txt|md|json)$/i;function a_({taskId:a,projectId:d}){let{t:e}=(0,n.useI18n)(),g=(0,c.useRef)(null),[h,i]=(0,c.useState)([]),[k,l]=(0,c.useState)([]),[m,o]=(0,c.useState)(!1),[p,q]=(0,c.useState)(""),[r,s]=(0,c.useState)(""),[t,u]=(0,c.useState)(!1),[v,w]=(0,c.useState)(null),[x,y]=(0,c.useState)(null);async function A(){p.trim()&&(await (0,aQ.createNote)({title:p.trim(),content:r.trim(),projectId:d,taskId:a,category:"task"}),q(""),s(""),o(!1),(0,aR.getTaskNotes)(a).then(i))}async function B(a){await (0,aS.deleteNote)(a),i(b=>b.filter(b=>b.id!==a))}async function C(b){let c=b.target.files?.[0];if(c){u(!0);try{let b=new FormData;b.set("file",c),b.set("projectId",d),b.set("taskId",a),await (0,aU.uploadAsset)(b),(0,aT.getTaskAssets)(a).then(l)}finally{u(!1),g.current&&(g.current.value="")}}}async function D(a){await (0,aV.deleteAsset)(a),l(b=>b.filter(b=>b.id!==a))}function E(a){return(0,aZ.isImageAsset)(a.filename,a.mimeType)||a$.test(a.filename)}function F(a){E(a)?w(a):ai.toast.info(e("assets.previewNotSupported"))}async function G(a){try{let b=await fetch("/api/internal/assets/reveal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:a.path})});if(!b.ok){let a=await b.json().catch(()=>({}));ai.toast.error(a.error||"Failed to reveal file")}}catch{ai.toast.error("Failed to reveal file")}}(0,c.useEffect)(()=>{(0,aR.getTaskNotes)(a).then(i),(0,aT.getTaskAssets)(a).then(l)},[a]);let I=v?(0,aZ.isImageAsset)(v.filename,v.mimeType)?"image":a$.test(v.filename)?"text":null:null,J=k.filter(a=>(0,aZ.isImageAsset)(a.filename,a.mimeType)).map(a=>({id:a.id,url:(0,aZ.localPathToApiUrl)(a.path),filename:a.filename})),K=v?J.findIndex(a=>a.id===v.id):-1;return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(H.ScrollArea,{className:"h-full",children:(0,b.jsxs)("div",{className:"flex flex-col",children:[(0,b.jsxs)("div",{className:"border-b border-border px-4 py-3",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsxs)("h3",{className:"flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:[(0,b.jsx)(P.FileText,{className:"h-3.5 w-3.5"}),e("taskPage.notes")]}),(0,b.jsxs)(j.Button,{variant:"ghost",className:"h-6 gap-1 px-2 text-xs",onClick:()=>o(!m),children:[m?(0,b.jsx)(aO.X,{className:"h-3 w-3"}):(0,b.jsx)(f.Plus,{className:"h-3 w-3"}),m?"":e("taskPage.addNote")]})]}),m&&(0,b.jsxs)("div",{className:"mt-3 space-y-2",children:[(0,b.jsx)("input",{type:"text",value:p,onChange:a=>q(a.target.value),placeholder:e("taskPage.noteTitle"),className:"h-8 w-full rounded-md border border-border bg-background px-3 text-sm focus:outline-none focus:ring-1 focus:ring-primary",autoFocus:!0}),(0,b.jsx)("textarea",{value:r,onChange:a=>s(a.target.value),placeholder:e("taskPage.noteContent"),rows:3,className:"w-full rounded-md border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-primary resize-none"}),(0,b.jsx)(j.Button,{className:"text-xs",onClick:A,disabled:!p.trim(),children:e("taskPage.addNote")})]}),(0,b.jsxs)("div",{className:"mt-2 space-y-2",children:[0===h.length&&!m&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground py-2",children:e("taskPage.noNotes")}),h.map(a=>(0,b.jsx)("div",{className:"group rounded-md border border-border bg-card p-3",children:(0,b.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,b.jsxs)("button",{type:"button",onClick:()=>y(a),className:"min-w-0 flex-1 cursor-pointer text-left",title:e("taskPage.previewNote"),children:[(0,b.jsx)("h4",{className:"text-sm font-medium truncate hover:underline",children:a.title}),a.content&&(0,b.jsx)("p",{className:"mt-1 text-xs text-muted-foreground line-clamp-3 whitespace-pre-wrap",children:a.content}),(0,b.jsx)("p",{className:"mt-1 text-[10px] text-muted-foreground",children:new Date(a.createdAt).toLocaleString()})]}),(0,b.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5",children:[(0,b.jsx)(j.Button,{variant:"ghost",size:"icon-xs",onClick:()=>y(a),className:"text-muted-foreground hover:bg-accent",title:e("taskPage.previewNote"),children:(0,b.jsx)(aP.Eye,{className:"h-3.5 w-3.5"})}),(0,b.jsx)(j.Button,{variant:"ghost",size:"icon-xs",onClick:()=>B(a.id),className:"text-muted-foreground hover:bg-destructive/10 hover:text-destructive",title:e("taskPage.deleteNote"),children:(0,b.jsx)(z.Trash2,{className:"h-3.5 w-3.5"})})]})]})},a.id))]})]}),(0,b.jsxs)("div",{className:"px-4 py-3",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsxs)("h3",{className:"flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:[(0,b.jsx)(aN.Paperclip,{className:"h-3.5 w-3.5"}),e("taskPage.attachments")]}),(0,b.jsxs)(j.Button,{variant:"ghost",className:"h-6 gap-1 px-2 text-xs",onClick:()=>g.current?.click(),disabled:t,children:[(0,b.jsx)(aM.Upload,{className:"h-3 w-3"}),e("taskPage.uploadFile")]}),(0,b.jsx)("input",{ref:g,type:"file",className:"hidden",onChange:C})]}),(0,b.jsxs)("div",{className:"mt-2 space-y-1.5",children:[0===k.length&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground py-2",children:e("taskPage.noAttachments")}),k.map(a=>{var c;let d=E(a);return(0,b.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-border bg-card px-3 py-2",children:[(0,b.jsx)(aN.Paperclip,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),(0,b.jsx)("button",{type:"button",onClick:()=>F(a),disabled:!d,className:`min-w-0 flex-1 truncate text-left text-sm ${d?"cursor-pointer hover:underline":"cursor-default"}`,title:d?e("assets.preview"):a.filename,children:a.filename}),(0,b.jsx)("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:(c=a.size)?c<1024?`${c} B`:c<1048576?`${(c/1024).toFixed(1)} KB`:`${(c/1024/1024).toFixed(1)} MB`:""}),(0,b.jsxs)("div",{className:"flex items-center gap-0.5",children:[d&&(0,b.jsx)(j.Button,{variant:"ghost",size:"icon-xs",onClick:()=>F(a),className:"shrink-0 text-muted-foreground hover:bg-accent",title:e("assets.preview"),children:(0,b.jsx)(aP.Eye,{className:"h-3 w-3"})}),(0,b.jsx)(j.Button,{variant:"ghost",size:"icon-xs",onClick:()=>G(a),className:"shrink-0 text-muted-foreground hover:bg-accent",title:e("assets.revealInFinder"),children:(0,b.jsx)(Q.FolderOpen,{className:"h-3 w-3"})}),(0,b.jsx)(j.Button,{variant:"ghost",size:"icon-xs",onClick:()=>D(a.id),className:"shrink-0 text-muted-foreground hover:bg-destructive/10 hover:text-destructive",title:e("taskPage.deleteAttachment"),children:(0,b.jsx)(z.Trash2,{className:"h-3 w-3"})})]})]},a.id)})]})]})]})}),(0,b.jsx)(aW.ImageLightbox,{imageUrl:"image"===I&&K>=0?J[K].url:null,filename:"image"===I&&K>=0?J[K].filename:"",open:"image"===I,onOpenChange:a=>{a||w(null)},assets:J.map(({url:a,filename:b})=>({url:a,filename:b})),currentIndex:K>=0?K:void 0,onIndexChange:a=>{let b=J[a];if(!b)return;let c=k.find(a=>a.id===b.id);c&&w(c)}}),(0,b.jsx)(aX.TextPreviewDialog,{url:"text"===I&&v?(0,aZ.localPathToApiUrl)(v.path):null,filename:v?.filename??"",open:"text"===I,onOpenChange:a=>{a||w(null)}}),(0,b.jsx)(aY.NotePreviewDialog,{note:x,open:null!==x,onOpenChange:a=>{a||y(null)}})]})}function a0({task:a,workspaceId:e,projectLocalPath:f,onClose:g}){let{t:h}=(0,n.useI18n)(),i=(0,d.useRouter)(),{removePortal:k}=(0,aB.useTerminalPortal)(),[o,p]=(0,c.useState)("terminal"),[q,r]=(0,c.useState)(null),[s,t]=(0,c.useState)(!1),[u,v]=(0,c.useState)(a.status);(0,c.useEffect)(()=>{v(a.status)},[a.status]);let[w,x]=(0,c.useState)(null),[y,z]=(0,c.useState)(!1),[A,B]=(0,c.useState)(!1),[C,D]=(0,c.useState)([]);(0,c.useEffect)(()=>{x(null),z(!1),B(!1),D([]),r(null),p("terminal")},[a.id]);let[E,F]=(0,c.useState)([]),[G,I]=(0,c.useState)(null);(0,c.useEffect)(()=>{let a=!1;return(0,aK.getPrompts)().then(b=>{if(a)return;F(b.map(a=>({id:a.id,name:a.name,isDefault:a.isDefault})));let c=b.find(a=>a.isDefault);c&&I(c.id)}),()=>{a=!0}},[]),(0,c.useEffect)(()=>{x(null),B(!1);let b=!1;return(0,aC.getTaskExecutions)(a.id).then(a=>{if(b)return;let c=a[0];if(c?.status==="RUNNING"){let a=c.worktreePath||f||null;a&&x(a)}D(a.filter(a=>"RUNNING"!==a.status)),B(!0)}),()=>{b=!0}},[a.id]),(0,c.useEffect)(()=>{if("changes"!==o||"TODO"===u||"CANCELLED"===u)return;let b=!1;return t(!0),fetch(`/api/tasks/${a.id}/diff`).then(a=>{if(!a.ok)throw Error(`HTTP ${a.status}`);return a.json()}).then(a=>{b||r(a?.files||a?.branchDeleted?a:null)}).catch(()=>{b||r(null)}).finally(()=>{b||t(!1)}),()=>{b=!0}},[o,u,a.id]);let J=(0,c.useCallback)(async()=>{if(!y){z(!0),k(a.id);try{let b=await (0,aD.startPtyExecutionSafe)(a.id,"",G);if(!b.ok){z(!1),ai.toast.error(b.error||h("terminal.startFailed"));return}x(b.worktreePath??null),v("IN_PROGRESS")}catch(a){z(!1),ai.toast.error(a instanceof Error&&a.message?a.message:h("terminal.startFailed"))}}},[a.id,y,G,h]),K=(0,c.useCallback)(b=>{z(!1),x(null),k(a.id),0===b&&v("IN_REVIEW"),(0,aC.getTaskExecutions)(a.id).then(a=>{D(a.filter(a=>"RUNNING"!==a.status))}),i.refresh()},[i,a.id]),L=(0,c.useCallback)(async()=>{await (0,aE.stopPtyExecution)(a.id),z(!1),k(a.id),x(null),v("IN_REVIEW"),(0,aC.getTaskExecutions)(a.id).then(a=>{D(a.filter(a=>"RUNNING"!==a.status))}),i.refresh()},[a.id,i]),M=(0,c.useCallback)(async b=>{z(!0),k(a.id),x(null);try{let{worktreePath:c}=await (0,aF.resumePtyExecution)(a.id,b);x(c),v("IN_PROGRESS")}catch{z(!1)}},[a.id,k]),N=(0,c.useCallback)(async()=>{z(!0),k(a.id),x(null);try{let{worktreePath:b}=await (0,aG.continueLatestPtyExecution)(a.id);x(b),v("IN_PROGRESS")}catch(a){z(!1),ai.toast.error(a instanceof Error?a.message:String(a))}},[a.id,k]),[O,Q]=(0,c.useState)(!1),[R,S]=(0,c.useState)([]),U=(0,c.useCallback)(async()=>{try{let b=await (0,aI.checkWorktreeClean)(a.id);if(b.hasWorktree&&!b.clean)return void ai.toast.error(h("taskPage.uncommittedChanges",{count:String(b.files.length)}));if(b.hasWorktree&&b.clean&&!b.hasCommits)return void ai.toast.error(h("taskPage.noChangesToComplete"),{action:{label:h("taskPage.markAsCancelled"),onClick:()=>{(0,aH.updateTaskStatus)(a.id,"CANCELLED").then(()=>{v("CANCELLED"),ai.toast.success(h("taskPage.taskCancelled")),i.refresh()}).catch(()=>ai.toast.error("Failed to cancel task"))}}});if(b.hasWorktree&&b.hasCommits){S(b.commitLog),Q(!0);return}await (0,aH.updateTaskStatus)(a.id,"DONE"),v("DONE"),ai.toast.success(h("taskPage.taskCompleted")),i.refresh()}catch{ai.toast.error("Failed to complete task")}},[a.id,i,h]),V=(0,c.useCallback)(()=>{v("DONE"),Q(!1),ai.toast.success(h("taskPage.taskCompleted")),i.refresh()},[i,h]),W=(0,c.useCallback)(async b=>{try{let{hash:c}=await (0,aJ.commitWorktreeChanges)(a.id,b);ai.toast.success(h("diff.commitSuccess",{hash:c})),i.refresh();let d=await fetch(`/api/tasks/${a.id}/diff`);if(d.ok){let a=await d.json();r(a?.files?a:null)}}catch(a){ai.toast.error(a instanceof Error?a.message:"Commit failed")}},[a.id,i,h]);return(0,b.jsxs)("div",{className:"flex h-full w-[600px] flex-shrink-0 flex-col border-l border-border bg-sidebar","data-testid":"task-detail-panel",children:[(0,b.jsx)(ay,{title:a.title,description:h("taskDetail.panelDescription"),branch:`task/${a.id}`,baseBranch:a.baseBranch,version:a.version??null,hasConversation:!1,updatedAt:a.updatedAt,openDir:w??(f?a.subPath?`${f}/${a.subPath}`:f:null),onBack:g}),(0,b.jsxs)("div",{className:"flex items-center justify-between border-b border-border px-4 py-2",children:[(0,b.jsxs)("div",{className:"flex gap-1",children:[(0,b.jsxs)("button",{onClick:()=>p("terminal"),className:`flex items-center gap-1.5 px-3 py-1 text-xs font-medium rounded-md ${"terminal"===o?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,b.jsx)(X.Terminal,{className:"h-3 w-3"}),h("terminal.execute")]}),(0,b.jsx)("button",{onClick:()=>p("changes"),className:`px-3 py-1 text-xs font-medium rounded-md ${"changes"===o?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:h("taskPage.changes")}),(0,b.jsxs)("button",{onClick:()=>p("notes"),className:`flex items-center gap-1.5 px-3 py-1 text-xs font-medium rounded-md ${"notes"===o?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,b.jsx)(P.FileText,{className:"h-3 w-3"}),h("taskPage.notes")]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:["IN_REVIEW"===u&&(0,b.jsxs)(j.Button,{size:"sm",onClick:U,className:"bg-emerald-500/15 text-emerald-400 ring-1 ring-emerald-500/20 hover:bg-emerald-500/25",children:[(0,b.jsx)(av.CheckCircle2,{className:"h-3 w-3"}),h("taskPage.completeTask")]}),"DONE"!==u&&"CANCELLED"!==u&&(0,b.jsxs)(j.Button,{variant:"ghost",size:"sm",onClick:()=>i.push(`/workspaces/${e}/tasks/${a.id}`),className:"text-muted-foreground",children:[(0,b.jsx)(at.ExternalLink,{className:"h-3 w-3"}),h("taskPage.viewDetails")]})]})]}),"terminal"===o?(0,b.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:A?w?(0,b.jsxs)("div",{className:"flex h-full flex-col overflow-hidden",children:[(0,b.jsxs)("div",{className:"shrink-0 flex items-center justify-between border-b border-neutral-800 px-3 py-2 bg-[#0f1419]",children:[(0,b.jsxs)("span",{className:"flex items-center gap-1.5 text-xs text-emerald-400",children:[(0,b.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"}),h("execution.running")]}),(0,b.jsxs)(m.Tooltip,{children:[(0,b.jsxs)(m.TooltipTrigger,{onClick:L,className:"flex items-center gap-1.5 rounded-md bg-red-500/15 px-3 py-1 text-xs font-medium text-red-400 hover:bg-red-500/25 transition-colors",children:[(0,b.jsx)(au.Square,{className:"h-3 w-3"}),h("terminal.stopExecution")]}),(0,b.jsx)(m.TooltipContent,{side:"bottom",children:h("terminal.stopHint")})]})]}),(0,b.jsx)("div",{className:"flex-1 min-h-0",children:(0,b.jsx)(aB.TerminalOutlet,{taskId:a.id,worktreePath:w,onSessionEnd:K})})]}):"DONE"===u||"CANCELLED"===u?(0,b.jsx)("div",{className:"flex h-full flex-col overflow-hidden",children:(0,b.jsx)(H.ScrollArea,{className:"flex-1 min-h-0",children:(0,b.jsx)(aL.ExecutionTimeline,{executions:C})})}):(0,b.jsxs)("div",{className:"flex h-full flex-col overflow-hidden",children:[(0,b.jsxs)("div",{className:"shrink-0 flex items-center gap-2 border-b border-border px-4 py-3",children:[E.length>0&&(0,b.jsxs)(l.Select,{defaultValue:G??"none",onValueChange:a=>I("none"===a?null:a),children:[(0,b.jsx)(l.SelectTrigger,{size:"sm",className:"min-w-[120px]",children:(0,b.jsx)("span",{className:"text-left truncate",children:G?E.find(a=>a.id===G)?.name??h("terminal.noPrompt"):h("terminal.noPrompt")})}),(0,b.jsxs)(l.SelectContent,{className:"min-w-[200px]",children:[(0,b.jsx)(l.SelectItem,{value:"none",children:h("terminal.noPrompt")}),E.map(a=>(0,b.jsxs)(l.SelectItem,{value:a.id,children:[a.name,a.isDefault?" ★":""]},a.id))]})]},`prompt-${E.length}`),(0,b.jsxs)(j.Button,{onClick:J,disabled:y,size:"sm",className:"gap-2 px-4",children:[y?(0,b.jsx)(T.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):(0,b.jsx)(X.Terminal,{className:"h-3.5 w-3.5"}),y?h("terminal.executing"):h("terminal.launch")]})]}),(0,b.jsx)(H.ScrollArea,{className:"flex-1 min-h-0",children:(0,b.jsx)(aL.ExecutionTimeline,{executions:C,onResume:M,onContinueLatest:N})})]}):(0,b.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-2 bg-[#0f1419]",children:[(0,b.jsx)(T.Loader2,{className:"size-5 animate-spin text-neutral-500"}),(0,b.jsx)("span",{className:"text-xs text-neutral-500",children:h("execution.loading")})]})}):"changes"===o?(0,b.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:s?(0,b.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:h("taskPage.loadingDiff")})}):q?.branchDeleted?(0,b.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:h("taskPage.branchDeleted")})}):q?(0,b.jsx)(az.TaskDiffView,{taskId:a.id,files:q.files,totalAdded:q.totalAdded,totalRemoved:q.totalRemoved,hasConflicts:q.hasConflicts,conflictFiles:q.conflictFiles,onCommit:W,hasUncommitted:q.hasUncommitted}):(0,b.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:h("taskPage.noChanges")})})}):"notes"===o?(0,b.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:(0,b.jsx)(a_,{taskId:a.id,projectId:a.projectId})}):null,(0,b.jsx)(aA.TaskMergeConfirmDialog,{open:O,onOpenChange:Q,taskId:a.id,taskTitle:a.title,baseBranch:a.baseBranch??"main",fileCount:q?.files?.length??0,commitCount:q?.commitCount??0,commitLog:R,onMergeComplete:V})]})}var a1=a.i(374531),a2=a.i(583590);let a3=(0,$.createServerReference)("40039292e6f13a93220735ef7737a5b7a36712cf05",$.callServer,void 0,$.findSourceMapURL,"deleteTask"),a4=(0,$.createServerReference)("405ed7de6cb31552d1f1b993f720cead3c04731221",$.callServer,void 0,$.findSourceMapURL,"toggleTaskPinned");var a5=a.i(189076);let a6=(0,$.createServerReference)("40ba368a4474ca9b032e17613ca34770c7bc685a69",$.callServer,void 0,$.findSourceMapURL,"getVersionsForPicker");var a7=a.i(258815),a8=a.i(912868);function a9({project:a,isActive:e,workspaceId:f,onSelect:g}){let{t:h}=(0,n.useI18n)(),i=(0,d.useRouter)(),k=a.totalTasks,l=a.runningTasks,o=k>0?Math.round(l/k*100):0,[p,q]=(0,c.useState)(!1),[r,s]=(0,c.useState)(!1),t=async()=>{s(!0);try{let b=await ad(a.id);i.push(`/workspaces/${f}/tasks/${b}`)}catch{ai.toast.error(h("git.openStudioFailed"))}finally{s(!1)}},u=(0,b.jsxs)("button",{onClick:()=>{e||g(a.id)},className:`group flex w-[212px] shrink-0 items-center gap-2 rounded-lg border-b-2 px-3 py-1.5 text-left transition-colors ${e?"border-primary bg-primary/10 ring-1 ring-primary/20 cursor-default":`border-transparent cursor-pointer ${p?"bg-accent":"hover:bg-accent"}`}`,children:[(0,b.jsxs)("span",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[(0,b.jsx)("span",{className:`w-full truncate text-sm font-medium leading-tight ${e?"text-primary":p?"text-foreground":"text-muted-foreground group-hover:text-foreground"}`,children:a.name}),a.alias&&(0,b.jsx)("span",{className:"w-full truncate text-[11px] font-normal leading-tight text-muted-foreground/70",children:a.alias})]}),(0,b.jsxs)("span",{className:"flex shrink-0 items-baseline rounded-md border border-border bg-card px-1.5 py-0.5 font-mono text-[11px] font-semibold leading-none",children:[(0,b.jsx)("span",{className:"text-amber-500 dark:text-amber-400",children:l}),(0,b.jsx)("span",{className:"mx-px text-muted-foreground/50",children:"/"}),(0,b.jsx)("span",{className:"text-muted-foreground",children:k})]})]});return(0,b.jsxs)(m.Tooltip,{onOpenChange:q,children:[(0,b.jsx)(m.TooltipTrigger,{render:u}),(0,b.jsxs)(m.TooltipContent,{side:"bottom",hideArrow:!0,className:"flex w-[268px] max-w-none flex-col items-stretch gap-0 rounded-xl border border-border bg-card p-3.5 text-foreground shadow-lg",children:[(0,b.jsx)("div",{className:"text-[13px] font-bold leading-snug break-words",children:a.name}),a.alias&&(0,b.jsx)("div",{className:"mt-0.5 text-[11.5px] leading-relaxed text-muted-foreground break-words",children:a.alias}),(0,b.jsx)("div",{className:"my-2.5 h-px bg-border"}),(0,b.jsxs)("div",{className:"mb-2 flex items-center gap-2",children:[(0,b.jsx)("span",{className:"size-2 shrink-0 rounded-full bg-amber-500 dark:bg-amber-400"}),(0,b.jsx)("span",{className:"text-[13px] font-semibold",children:h("board.running")}),(0,b.jsx)("span",{className:"text-[11px] text-muted-foreground",children:h("board.runningDesc")}),(0,b.jsx)("span",{className:"ml-auto font-mono text-[15px] font-bold text-amber-500 dark:text-amber-400",children:l})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:"size-2 shrink-0 rounded-full bg-sky-500 dark:bg-sky-400"}),(0,b.jsx)("span",{className:"text-[13px] font-semibold",children:h("board.overview")}),(0,b.jsx)("span",{className:"text-[11px] text-muted-foreground",children:h("board.totalDesc")}),(0,b.jsx)("span",{className:"ml-auto font-mono text-[15px] font-bold",children:k})]}),(0,b.jsx)("div",{className:"mt-2.5 h-[5px] overflow-hidden rounded-full bg-sky-500/15 dark:bg-sky-400/15",children:(0,b.jsx)("div",{className:"h-full rounded-full bg-amber-500 dark:bg-amber-400",style:{width:`${o}%`}})}),(0,b.jsxs)("div",{className:"mt-2.5 flex items-center justify-between gap-2",children:[(0,b.jsx)("span",{className:"text-[10px] text-muted-foreground",children:h("board.badgeFormatHint")}),(0,b.jsxs)(j.Button,{variant:"outline",disabled:r,onClick:t,className:"h-6 shrink-0 gap-1 px-2 text-[11px]",children:[r?(0,b.jsx)(T.Loader2,{className:"h-3 w-3 animate-spin"}):(0,b.jsx)(Q.FolderOpen,{className:"h-3 w-3"}),h("git.openStudio")]})]})]})]})}function ba({projects:a,activeProjectId:d,workspaceId:e,onSelect:f}){let g=(0,c.useRef)(null),[h,i]=(0,c.useState)(!1),[j,k]=(0,c.useState)(!1),l=()=>{let a=g.current;a&&(i(a.scrollLeft>0),k(a.scrollLeft<a.scrollWidth-a.clientWidth-1))};(0,c.useEffect)(()=>{l();let a=g.current;if(a){a.addEventListener("scroll",l);let b=new ResizeObserver(l);return b.observe(a),()=>{a.removeEventListener("scroll",l),b.disconnect()}}},[a]);let m=a=>{let b=g.current;b&&b.scrollBy({left:"left"===a?-150:150,behavior:"smooth"})};return(0,b.jsxs)("div",{className:"relative flex items-center",children:[h&&(0,b.jsx)("button",{onClick:()=>m("left"),className:"absolute left-0 z-10 flex h-8 w-8 items-center justify-center rounded-md bg-background/90 text-muted-foreground shadow-sm ring-1 ring-border backdrop-blur-sm transition-colors hover:text-foreground",children:(0,b.jsx)(a8.ChevronLeft,{className:"h-4 w-4"})}),(0,b.jsx)("div",{ref:g,className:"flex items-center gap-1.5 overflow-x-auto scrollbar-none px-1 py-1",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:a.map(a=>(0,b.jsx)(a9,{project:a,isActive:d===a.id,workspaceId:e,onSelect:f},a.id))}),j&&(0,b.jsx)("button",{onClick:()=>m("right"),className:"absolute right-0 z-10 flex h-8 w-8 items-center justify-center rounded-md bg-background/90 text-muted-foreground shadow-sm ring-1 ring-border backdrop-blur-sm transition-colors hover:text-foreground",children:(0,b.jsx)(O.ChevronRight,{className:"h-4 w-4"})})]})}var bb=a.i(811344);function bc({open:a,onOpenChange:c,taskTitle:d,uncommittedFiles:e,commitLog:f,onConfirm:g}){let{t:h}=(0,n.useI18n)(),i=e.length,k=f.length,l=0===i&&0===k;return(0,b.jsx)(G.Dialog,{open:a,onOpenChange:c,children:(0,b.jsxs)(G.DialogContent,{showCloseButton:!0,className:"sm:max-w-md",children:[(0,b.jsx)(G.DialogHeader,{children:(0,b.jsxs)(G.DialogTitle,{className:"flex items-center gap-2",children:[(0,b.jsx)(bb.AlertTriangle,{className:"h-4 w-4 text-amber-400"}),h("taskCancel.title")]})}),(0,b.jsxs)("div",{className:"space-y-3 py-2",children:[(0,b.jsxs)("div",{className:"rounded-lg border border-amber-500/20 bg-amber-500/10 p-3 space-y-1.5",children:[(0,b.jsx)("p",{className:"text-xs text-foreground",children:h("taskCancel.intro",{title:d})}),(0,b.jsx)("p",{className:"text-xs text-amber-300",children:h("taskCancel.irreversible")})]}),l?(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:h("taskCancel.cleanNotice")}):(0,b.jsxs)("div",{className:"rounded-lg border border-border bg-muted/30 p-3 space-y-2.5",children:[(0,b.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,b.jsx)("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:h("taskCancel.uncommittedFiles")}),(0,b.jsx)("span",{className:"text-xs font-medium text-foreground",children:i})]}),(0,b.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,b.jsx)("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:h("taskCancel.unmergedCommits")}),(0,b.jsx)("span",{className:"text-xs font-medium text-foreground",children:k})]})]}),i>0&&(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"text-xs text-muted-foreground mb-1 block",children:h("taskCancel.filesList")}),(0,b.jsx)("div",{className:"rounded-md border border-border bg-muted/30 p-2 space-y-1 max-h-32 overflow-y-auto",children:e.map((a,c)=>(0,b.jsx)("div",{className:"text-xs font-mono text-foreground/80",children:a},c))})]}),k>0&&(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"text-xs text-muted-foreground mb-1 block",children:h("taskCancel.commitsList")}),(0,b.jsx)("div",{className:"rounded-md border border-border bg-muted/30 p-2 space-y-1 max-h-32 overflow-y-auto",children:f.map((a,c)=>(0,b.jsx)("div",{className:"text-xs font-mono text-foreground/80",children:a},c))}),(0,b.jsx)("p",{className:"text-[10px] text-muted-foreground mt-1.5",children:h("taskCancel.reflogHint")})]})]}),(0,b.jsxs)(G.DialogFooter,{children:[(0,b.jsx)(j.Button,{variant:"outline",onClick:()=>c(!1),children:h("taskCancel.keep")}),(0,b.jsxs)(j.Button,{variant:"destructive",onClick:g,className:"gap-2",children:[(0,b.jsx)(bb.AlertTriangle,{className:"h-4 w-4"}),h("taskCancel.confirm")]})]})]})})}a.s(["BoardPageClient",0,function({workspaceId:a,projectId:e,project:f,projects:g,initialTasks:h,labels:i,openTaskId:j}){let k=(0,d.useRouter)(),{t:l}=(0,n.useI18n)(),[,m]=(0,c.useTransition)(),[p,q]=(0,c.useState)(""),[s,t]=(0,c.useState)("all"),[u,v]=(0,c.useState)(!1),[w,x]=(0,c.useState)("TODO"),[y,z]=(0,c.useState)(j??null),[A,B]=(0,c.useState)([]),C=y?h.find(a=>a.id===y)??null:null,[D,E]=(0,c.useState)(null),[F,G]=(0,c.useState)(null),[H,I]=(0,c.useState)(null);(0,c.useEffect)(()=>{a6(e).then(B).catch(()=>B([]))},[e]),(0,c.useEffect)(()=>{(0,a7.setLastProjectId)(a,e)},[a,e]);let J=A.find(a=>a.isCurrent)?.id??null,M=(0,c.useCallback)(()=>{m(()=>{k.refresh()})},[k]);(0,c.useEffect)(()=>{if(u)return;let a=setInterval(()=>{m(()=>{k.refresh()})},5e3);return()=>clearInterval(a)},[k,u]);let N=(0,c.useCallback)(a=>{q(a)},[]),O=(0,c.useCallback)(async a=>{let b=h.find(b=>b.id===a);if(b)try{let c=await (0,aI.checkWorktreeClean)(a);if(c.hasWorktree&&!c.clean){ai.toast.error(l("taskPage.uncommittedChanges",{count:String(c.files.length)})),M();return}if(c.hasWorktree&&c.clean&&!c.hasCommits){ai.toast.error(l("taskPage.noChangesToComplete"),{action:{label:l("taskPage.markAsCancelled"),onClick:()=>{(0,aH.updateTaskStatus)(a,"CANCELLED").then(()=>{ai.toast.success(l("taskPage.taskCancelled")),M()}).catch(()=>ai.toast.error("Failed to cancel task"))}}}),M();return}if(c.hasWorktree&&c.hasCommits){G({task:b,commitLog:c.commitLog,commitCount:c.commitLog.length}),M();return}await (0,aH.updateTaskStatus)(a,"DONE"),ai.toast.success(l("taskPage.taskCompleted")),M()}catch{ai.toast.error("Failed to complete task"),M()}},[h,M,l]),P=(0,c.useCallback)(async a=>{let b=h.find(b=>b.id===a);if(b)try{let c=await (0,aI.checkWorktreeClean)(a);if(!c.hasWorktree){await (0,aH.updateTaskStatus)(a,"CANCELLED"),ai.toast.success(l("taskPage.taskCancelled")),M();return}I({task:b,files:c.files,commitLog:c.commitLog}),M()}catch{ai.toast.error("Failed to cancel task"),M()}},[h,M,l]),Q=(0,c.useCallback)(async(a,b)=>{"DONE"===b?await O(a):"CANCELLED"===b?await P(a):(await (0,aH.updateTaskStatus)(a,b),M())},[M,O,P]),R=(0,c.useCallback)(async a=>{let b=await (0,a1.createTask)({title:a.title,description:a.description,projectId:e,priority:a.priority,status:a.status,labelIds:a.labelIds,baseBranch:a.baseBranch,subPath:a.subPath,versionId:a.versionId??void 0});if(a.autoStart&&b?.id)try{await (0,a5.startPtyExecution)(b.id,""),z(b.id)}catch(a){ai.toast.error(a instanceof Error?a.message:String(a))}M()},[e,M]),S=(0,c.useCallback)(async(a,b)=>{await (0,a2.updateTask)(a,{...b,labelIds:b.labelIds}),E(null),M()},[M]),T=(0,c.useCallback)(async a=>{await a3(a),y===a&&z(null),M()},[M,y]),U=(0,c.useCallback)(async a=>{await a4(a),M()},[M]),V=(0,c.useCallback)(async b=>{try{await (0,a5.startPtyExecution)(b,"")}catch(a){ai.toast.error(a instanceof Error?a.message:String(a))}k.push(`/workspaces/${a}/tasks/${b}`)},[k,a]),W=(0,c.useCallback)(async(a,b)=>{"DONE"===b?await O(a):"CANCELLED"===b?await P(a):(await (0,aH.updateTaskStatus)(a,b),M())},[M,O,P]),X=(0,c.useCallback)(a=>{x(a),E(null),v(!0)},[]),Y=(0,c.useCallback)(a=>{E(a),v(!0)},[]),Z=h.filter(a=>!a.labels?.some(a=>a.label.name===r.TOWER_LABEL_NAME&&a.label.isBuiltin)).filter(a=>{if("backlog"===s){if(a.versionId)return!1}else if("all"!==s&&a.versionId!==s)return!1;if(p.trim()){let b=p.toLowerCase();if(!a.title.toLowerCase().includes(b)&&!a.description?.toLowerCase().includes(b))return!1}return!0});return(0,b.jsxs)("div",{className:"flex h-full",children:[(0,b.jsxs)("div",{className:"flex flex-1 flex-col overflow-hidden",children:[(0,b.jsx)("div",{className:"px-6 pt-3 pb-1",children:(0,b.jsx)(ba,{projects:g,activeProjectId:e,workspaceId:a,onSelect:b=>k.push(`/workspaces/${a}?projectId=${b}`,{scroll:!1})})}),(0,b.jsx)(o,{searchQuery:p,onSearchChange:N,versions:A,versionFilter:s,onVersionFilterChange:t,versionsHref:`/workspaces/${a}/projects/${e}/versions`,onCreateTask:()=>{E(null),v(!0)}}),(0,b.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden p-4",children:(0,b.jsx)(K,{initialTasks:Z,onTaskMove:Q,onTaskClick:a=>{z(a.id)},onEditTask:Y,onAddTask:X,onDeleteTask:T,onTogglePin:U,workspaceId:a,onContextMenuStatusChange:W,onContextMenuLaunch:V})}),(0,b.jsx)(L.CreateTaskDialog,{open:u,onOpenChange:a=>{v(a),a||E(null)},onSubmit:R,onUpdate:S,defaultStatus:w,editTask:D,editTaskLabelIds:D?.labels?D.labels.map(a=>a.labelId):[],labels:i.filter(a=>!(a.name===r.TOWER_LABEL_NAME&&a.isBuiltin)),projectType:f.type,projectLocalPath:f.localPath,versions:A,defaultVersionId:J})]}),C?(0,b.jsx)(a0,{task:C,workspaceId:a,projectLocalPath:f.localPath,onClose:()=>z(null)}):(0,b.jsx)(as,{project:f,workspaceId:a}),F&&(0,b.jsx)(aA.TaskMergeConfirmDialog,{open:!0,onOpenChange:a=>{a||G(null)},taskId:F.task.id,taskTitle:F.task.title,baseBranch:F.task.baseBranch??"main",fileCount:0,commitCount:F.commitCount,commitLog:F.commitLog,onMergeComplete:()=>{G(null),ai.toast.success(l("taskPage.taskCompleted")),M()}}),H&&(0,b.jsx)(bc,{open:!0,onOpenChange:a=>{a||I(null)},taskTitle:H.task.title,uncommittedFiles:H.files,commitLog:H.commitLog,onConfirm:()=>{let a=H.task.id;I(null),(0,aH.updateTaskStatus)(a,"CANCELLED").then(()=>{ai.toast.success(l("taskPage.taskCancelled")),M()}).catch(()=>ai.toast.error("Failed to cancel task"))}})]})}],473935)}];
2
2
 
3
3
  //# sourceMappingURL=src_app_workspaces_%5BworkspaceId%5D_board-page-client_tsx_0gips66._.js.map
@@ -1,3 +1,3 @@
1
- module.exports=[778772,a=>{"use strict";var b=a.i(728778),c=a.i(374637),d=a.i(774881),e=a.i(704494),f=a.i(573242),g=a.i(865011),h=a.i(951192),i=a.i(521007),j=a.i(12558),k=a.i(780410);let l=(0,k.createServerReference)("60097af7fbfd06a6695f71593a604b76dc597e1cab",k.callServer,void 0,k.findSourceMapURL,"updateNote");var m=a.i(658880);let n=(0,k.createServerReference)("60c5266b461e31af19cd3da88a3bf16008ca81519d",k.callServer,void 0,k.findSourceMapURL,"getProjectNotes");var o=a.i(368114);function p({active:a,onSelect:c}){let{t:d}=(0,h.useI18n)();return(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,b.jsx)("button",{onClick:()=>c("all"),className:(0,o.cn)("rounded-lg px-3 py-1 text-xs font-medium transition-colors","all"===a?"bg-primary/15 text-primary ring-1 ring-primary/20":"text-muted-foreground hover:bg-accent"),children:d("notes.allCategories")}),i.NOTE_CATEGORIES_PRESET.map(d=>(0,b.jsx)("button",{onClick:()=>c(d),className:(0,o.cn)("rounded-lg px-3 py-1 text-xs font-medium transition-colors",a===d?"bg-primary/15 text-primary ring-1 ring-primary/20":"text-muted-foreground hover:bg-accent"),children:d},d))]})}var q=a.i(699570),r=a.i(580701),s=a.i(350739),t=a.i(579834),u=a.i(690251),v=a.i(975231);let w=(0,a.i(711796).default)("link-2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);a.i(757942);var x=a.i(950314);function y({note:a,onEdit:c,onDelete:d,onPreview:e,onTaskClick:f}){let{t:g}=(0,h.useI18n)(),i=a.content.slice(0,300);return(0,b.jsxs)("div",{className:"group relative rounded-lg border border-border bg-card p-4 transition-colors hover:border-border/80 hover:bg-accent/20",children:[(0,b.jsxs)("div",{className:"absolute right-3 top-3 flex items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100",children:[(0,b.jsx)(q.Button,{variant:"ghost",size:"icon-sm",onClick:()=>c(a),className:"text-muted-foreground","aria-label":g("notes.edit"),children:(0,b.jsx)(u.Pencil,{className:"h-3.5 w-3.5"})}),(0,b.jsx)(q.Button,{variant:"ghost",size:"icon-sm",onClick:()=>d(a.id),className:"text-muted-foreground hover:text-rose-400","aria-label":g("notes.delete"),children:(0,b.jsx)(v.Trash2,{className:"h-3.5 w-3.5"})})]}),(0,b.jsx)("div",{className:"mb-2 pr-16",children:(0,b.jsx)("h3",{className:"truncate text-sm font-semibold text-foreground",children:a.title})}),(0,b.jsxs)("div",{className:"mb-3 flex flex-wrap items-center gap-1.5",children:[(0,b.jsx)("span",{className:"inline-block rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground",children:a.category}),a.taskId&&a.taskTitle&&(0,b.jsxs)("button",{type:"button",onClick:()=>a.taskId&&f?.(a.taskId),disabled:!f,className:`inline-flex max-w-[160px] items-center gap-1 rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium text-primary ${f?"cursor-pointer hover:bg-primary/15":"cursor-default"}`,title:a.taskTitle,children:[(0,b.jsx)(w,{className:"h-2.5 w-2.5 shrink-0"}),(0,b.jsx)("span",{className:"truncate",children:a.taskTitle})]})]}),(0,b.jsx)("button",{type:"button",onClick:()=>e?.(a),disabled:!e,className:`block w-full text-left ${e?"cursor-pointer":"cursor-default"}`,title:e?g("notes.previewNote"):void 0,children:(0,b.jsx)("div",{className:"max-h-24 overflow-hidden text-sm leading-relaxed text-muted-foreground",children:(0,b.jsx)(x.Streamdown,{children:i})})})]})}function z({notes:a,onEdit:c,onDelete:d,onPreview:e,onTaskClick:f}){let{t:g}=(0,h.useI18n)();return 0===a.length?(0,b.jsx)(t.EmptyState,{icon:s.FileText,title:g("notes.empty"),description:g("notes.emptyHint")}):(0,b.jsx)("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:a.map(a=>(0,b.jsx)(y,{note:a,onEdit:c,onDelete:d,onPreview:e,onTaskClick:f},a.id))})}var A=a.i(429246);function B({value:a,onChange:c}){return(0,b.jsxs)("div",{className:"relative grid grid-cols-2 gap-4 flex-1 min-h-64",children:[(0,b.jsx)(A.Textarea,{value:a,onChange:a=>c(a.target.value),className:"absolute inset-0 w-1/2 pr-2 resize-none font-mono text-sm border rounded-md p-3 bg-background text-foreground border-border focus:outline-none focus:ring-1 focus:ring-ring",placeholder:"Write Markdown here..."}),(0,b.jsx)("div",{className:"absolute inset-0 left-1/2 pl-2",children:(0,b.jsx)("div",{className:"h-full overflow-y-auto border rounded-md p-3 border-border text-sm leading-relaxed",children:(0,b.jsx)(x.Streamdown,{children:a})})})]})}var C=a.i(510650),D=a.i(269876),E=a.i(972420);a.s(["NotesPageClient",0,function({allWorkspaces:a,initialWorkspaceId:k,initialProjectId:o,initialNotes:s}){let t,u,{t:v}=(0,h.useI18n)(),[w,x]=(0,c.useTransition)(),[y,A]=(0,c.useState)(k),[F,G]=(0,c.useState)(o),[H,I]=(0,c.useState)(s),[J,K]=(0,c.useState)("all"),[L,M]=(0,c.useState)(""),[N,O]=(0,c.useState)(null),[P,Q]=(0,c.useState)(null),[R,S]=(0,c.useState)(null),[T,U]=(0,c.useState)(!1),[V,W]=(0,c.useState)(""),[X,Y]=(0,c.useState)(""),[Z,$]=(0,c.useState)(i.NOTE_CATEGORIES_PRESET[3]),[_,aa]=(0,c.useState)(k),[ab,ac]=(0,c.useState)(o),ad=a.find(a=>a.id===y),ae=ad?.projects??[],af=a.find(a=>a.id===_),ag=af?.projects??[],ah=(0,c.useCallback)(a=>{a?x(async()=>{I(await n(a))}):I([])},[x]),ai=async()=>{ab&&V.trim()&&(await (0,j.createNote)({title:V.trim(),content:X,category:Z,projectId:ab}),U(!1),ab===F&&ah(F))},aj=async()=>{R&&V.trim()&&(await l(R.id,{title:V.trim(),content:X,category:Z}),S(null),ah(F))},ak=async a=>{let b=H.find(b=>b.id===a);!b||confirm(v("notes.deleteConfirm",{title:b.title}))&&(await (0,m.deleteNote)(a),ah(F))},al=L.trim().toLowerCase(),am=H.filter(a=>"all"===J||a.category===J).filter(a=>!al||a.title.toLowerCase().includes(al)).map(a=>({id:a.id,title:a.title,content:a.content,category:a.category,updatedAt:new Date(a.updatedAt),taskId:a.taskId,taskTitle:a.task?.title??null})),an=T||null!==R;return(0,b.jsxs)("div",{className:"flex h-full flex-col overflow-hidden",children:[(0,b.jsx)(g.SubPageNav,{workspaceId:y}),(0,b.jsxs)("div",{className:"header-sm flex items-center gap-3 px-6 py-2",children:[(0,b.jsxs)(r.Select,{value:y,onValueChange:b=>b&&(b=>{if(b===y)return;A(b);let c=a.find(a=>a.id===b),d=c?.projects[0]??null;G(d?.id??null),K("all"),ah(d?.id??null)})(b),children:[(0,b.jsx)(r.SelectTrigger,{className:"h-8 w-auto min-w-[120px]",children:(0,b.jsx)("span",{className:"truncate",children:a.find(a=>a.id===y)?.name??y})}),(0,b.jsx)(r.SelectContent,{children:a.map(a=>(0,b.jsx)(r.SelectItem,{value:a.id,children:a.name},a.id))})]}),ae.length>0&&(0,b.jsxs)(r.Select,{value:F??"",onValueChange:a=>a&&void(a!==F&&(G(a),K("all"),ah(a))),children:[(0,b.jsx)(r.SelectTrigger,{className:"h-8 w-auto min-w-[140px]",children:(0,b.jsx)("span",{className:"truncate",children:(t=ae.find(a=>a.id===F))?t.alias?`${t.name} (${t.alias})`:t.name:""})}),(0,b.jsx)(r.SelectContent,{children:ae.map(a=>(0,b.jsxs)(r.SelectItem,{value:a.id,children:[a.name,a.alias?` (${a.alias})`:""]},a.id))})]}),!an&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("div",{className:"relative ml-auto",children:[(0,b.jsx)(f.Search,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"}),(0,b.jsx)("input",{type:"text",value:L,onChange:a=>M(a.target.value),placeholder:v("notes.searchPlaceholder"),className:"h-8 w-48 rounded-md border border-border bg-background pl-8 pr-3 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"})]}),(0,b.jsxs)(q.Button,{onClick:()=>{W(""),Y(""),$(i.NOTE_CATEGORIES_PRESET[3]),aa(y),ac(F),S(null),U(!0)},className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:[(0,b.jsx)(d.Plus,{className:"h-3.5 w-3.5"}),(0,b.jsx)("span",{children:v("notes.newNote")})]})]})]}),(0,b.jsx)("div",{className:"flex-1 overflow-hidden px-6 py-4 flex flex-col",children:an?(0,b.jsxs)("div",{className:"flex flex-col gap-4 flex-1 min-h-0",children:[(0,b.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[!R&&(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("label",{className:"text-xs text-muted-foreground whitespace-nowrap",children:v("notes.workspace")}),(0,b.jsxs)(r.Select,{value:_,onValueChange:b=>b&&(b=>{if(b===_)return;aa(b);let c=a.find(a=>a.id===b),d=c?.projects[0]??null;ac(d?.id??null)})(b),children:[(0,b.jsx)(r.SelectTrigger,{className:"min-w-[140px] text-xs",children:(0,b.jsx)("span",{className:"truncate",children:a.find(a=>a.id===_)?.name??_})}),(0,b.jsx)(r.SelectContent,{children:a.map(a=>(0,b.jsx)(r.SelectItem,{value:a.id,children:a.name},a.id))})]})]}),!R&&ag.length>0&&(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("label",{className:"text-xs text-muted-foreground whitespace-nowrap",children:v("notes.project")}),(0,b.jsxs)(r.Select,{value:ab??"",onValueChange:a=>a&&ac(a),children:[(0,b.jsx)(r.SelectTrigger,{className:"min-w-[160px] text-xs",children:(0,b.jsx)("span",{className:"truncate",children:(u=ag.find(a=>a.id===ab))?u.alias?`${u.name} (${u.alias})`:u.name:""})}),(0,b.jsx)(r.SelectContent,{children:ag.map(a=>(0,b.jsxs)(r.SelectItem,{value:a.id,children:[a.name,a.alias?` (${a.alias})`:""]},a.id))})]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("label",{className:"text-xs text-muted-foreground whitespace-nowrap",children:v("notes.categoryLabel")}),(0,b.jsxs)(r.Select,{value:Z,onValueChange:a=>a&&$(a),children:[(0,b.jsx)(r.SelectTrigger,{className:"min-w-[120px] text-xs",children:(0,b.jsx)("span",{className:"truncate",children:Z})}),(0,b.jsx)(r.SelectContent,{children:i.NOTE_CATEGORIES_PRESET.map(a=>(0,b.jsx)(r.SelectItem,{value:a,children:a},a))})]})]})]}),(0,b.jsx)("input",{type:"text",value:V,onChange:a=>W(a.target.value),placeholder:v("notes.titlePlaceholder"),className:"w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"}),(0,b.jsx)(B,{value:X,onChange:Y}),(0,b.jsxs)("div",{className:"flex items-center gap-2 justify-end",children:[(0,b.jsx)(q.Button,{variant:"outline",onClick:()=>{U(!1),S(null)},children:v("notes.cancel")}),(0,b.jsx)(q.Button,{onClick:R?aj:ai,disabled:!V.trim()||!R&&!ab,className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:v("notes.save")})]})]}):(0,b.jsxs)("div",{className:"flex flex-col flex-1 min-h-0 gap-4",children:[(0,b.jsx)(p,{active:J,onSelect:K}),(0,b.jsx)(D.ScrollArea,{className:"flex-1 min-h-0",children:(0,b.jsxs)("div",{className:`relative ${w?"opacity-40 pointer-events-none":""} transition-opacity`,children:[w&&(0,b.jsx)("div",{className:"absolute inset-0 z-10 flex items-center justify-center",children:(0,b.jsx)(e.Loader2,{className:"size-5 animate-spin text-muted-foreground"})}),0===ae.length?(0,b.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 py-16 text-center",children:[(0,b.jsx)("p",{className:"text-sm font-medium text-muted-foreground",children:v("notes.noProject")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground/60",children:v("notes.noProjectHint")})]}):(0,b.jsx)(z,{notes:am,onEdit:a=>{W(a.title),Y(a.content),$(a.category),S(a),U(!1)},onDelete:ak,onPreview:O,onTaskClick:Q})]})})]})}),(0,b.jsx)(C.NotePreviewDialog,{note:N,open:null!==N,onOpenChange:a=>{a||O(null)}}),(0,b.jsx)(E.TaskOverviewDrawer,{open:null!==P,onOpenChange:a=>{a||Q(null)},taskId:P})]})}],778772)}];
1
+ module.exports=[778772,a=>{"use strict";var b=a.i(728778),c=a.i(374637),d=a.i(774881),e=a.i(704494),f=a.i(573242),g=a.i(865011),h=a.i(951192),i=a.i(521007),j=a.i(846889),k=a.i(780410);let l=(0,k.createServerReference)("6054880192c3edbaeac4f53e527cb974cfab8f1f32",k.callServer,void 0,k.findSourceMapURL,"updateNote");var m=a.i(556570);let n=(0,k.createServerReference)("608f95689eae64ccef8d597748a553d906c9689285",k.callServer,void 0,k.findSourceMapURL,"getProjectNotes");var o=a.i(368114);function p({active:a,onSelect:c}){let{t:d}=(0,h.useI18n)();return(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,b.jsx)("button",{onClick:()=>c("all"),className:(0,o.cn)("rounded-lg px-3 py-1 text-xs font-medium transition-colors","all"===a?"bg-primary/15 text-primary ring-1 ring-primary/20":"text-muted-foreground hover:bg-accent"),children:d("notes.allCategories")}),i.NOTE_CATEGORIES_PRESET.map(d=>(0,b.jsx)("button",{onClick:()=>c(d),className:(0,o.cn)("rounded-lg px-3 py-1 text-xs font-medium transition-colors",a===d?"bg-primary/15 text-primary ring-1 ring-primary/20":"text-muted-foreground hover:bg-accent"),children:d},d))]})}var q=a.i(699570),r=a.i(580701),s=a.i(350739),t=a.i(579834),u=a.i(690251),v=a.i(975231);let w=(0,a.i(711796).default)("link-2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);a.i(757942);var x=a.i(950314);function y({note:a,onEdit:c,onDelete:d,onPreview:e,onTaskClick:f}){let{t:g}=(0,h.useI18n)(),i=a.content.slice(0,300);return(0,b.jsxs)("div",{className:"group relative rounded-lg border border-border bg-card p-4 transition-colors hover:border-border/80 hover:bg-accent/20",children:[(0,b.jsxs)("div",{className:"absolute right-3 top-3 flex items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100",children:[(0,b.jsx)(q.Button,{variant:"ghost",size:"icon-sm",onClick:()=>c(a),className:"text-muted-foreground","aria-label":g("notes.edit"),children:(0,b.jsx)(u.Pencil,{className:"h-3.5 w-3.5"})}),(0,b.jsx)(q.Button,{variant:"ghost",size:"icon-sm",onClick:()=>d(a.id),className:"text-muted-foreground hover:text-rose-400","aria-label":g("notes.delete"),children:(0,b.jsx)(v.Trash2,{className:"h-3.5 w-3.5"})})]}),(0,b.jsx)("div",{className:"mb-2 pr-16",children:(0,b.jsx)("h3",{className:"truncate text-sm font-semibold text-foreground",children:a.title})}),(0,b.jsxs)("div",{className:"mb-3 flex flex-wrap items-center gap-1.5",children:[(0,b.jsx)("span",{className:"inline-block rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground",children:a.category}),a.taskId&&a.taskTitle&&(0,b.jsxs)("button",{type:"button",onClick:()=>a.taskId&&f?.(a.taskId),disabled:!f,className:`inline-flex max-w-[160px] items-center gap-1 rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium text-primary ${f?"cursor-pointer hover:bg-primary/15":"cursor-default"}`,title:a.taskTitle,children:[(0,b.jsx)(w,{className:"h-2.5 w-2.5 shrink-0"}),(0,b.jsx)("span",{className:"truncate",children:a.taskTitle})]})]}),(0,b.jsx)("button",{type:"button",onClick:()=>e?.(a),disabled:!e,className:`block w-full text-left ${e?"cursor-pointer":"cursor-default"}`,title:e?g("notes.previewNote"):void 0,children:(0,b.jsx)("div",{className:"max-h-24 overflow-hidden text-sm leading-relaxed text-muted-foreground",children:(0,b.jsx)(x.Streamdown,{children:i})})})]})}function z({notes:a,onEdit:c,onDelete:d,onPreview:e,onTaskClick:f}){let{t:g}=(0,h.useI18n)();return 0===a.length?(0,b.jsx)(t.EmptyState,{icon:s.FileText,title:g("notes.empty"),description:g("notes.emptyHint")}):(0,b.jsx)("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:a.map(a=>(0,b.jsx)(y,{note:a,onEdit:c,onDelete:d,onPreview:e,onTaskClick:f},a.id))})}var A=a.i(429246);function B({value:a,onChange:c}){return(0,b.jsxs)("div",{className:"relative grid grid-cols-2 gap-4 flex-1 min-h-64",children:[(0,b.jsx)(A.Textarea,{value:a,onChange:a=>c(a.target.value),className:"absolute inset-0 w-1/2 pr-2 resize-none font-mono text-sm border rounded-md p-3 bg-background text-foreground border-border focus:outline-none focus:ring-1 focus:ring-ring",placeholder:"Write Markdown here..."}),(0,b.jsx)("div",{className:"absolute inset-0 left-1/2 pl-2",children:(0,b.jsx)("div",{className:"h-full overflow-y-auto border rounded-md p-3 border-border text-sm leading-relaxed",children:(0,b.jsx)(x.Streamdown,{children:a})})})]})}var C=a.i(510650),D=a.i(269876),E=a.i(972420);a.s(["NotesPageClient",0,function({allWorkspaces:a,initialWorkspaceId:k,initialProjectId:o,initialNotes:s}){let t,u,{t:v}=(0,h.useI18n)(),[w,x]=(0,c.useTransition)(),[y,A]=(0,c.useState)(k),[F,G]=(0,c.useState)(o),[H,I]=(0,c.useState)(s),[J,K]=(0,c.useState)("all"),[L,M]=(0,c.useState)(""),[N,O]=(0,c.useState)(null),[P,Q]=(0,c.useState)(null),[R,S]=(0,c.useState)(null),[T,U]=(0,c.useState)(!1),[V,W]=(0,c.useState)(""),[X,Y]=(0,c.useState)(""),[Z,$]=(0,c.useState)(i.NOTE_CATEGORIES_PRESET[3]),[_,aa]=(0,c.useState)(k),[ab,ac]=(0,c.useState)(o),ad=a.find(a=>a.id===y),ae=ad?.projects??[],af=a.find(a=>a.id===_),ag=af?.projects??[],ah=(0,c.useCallback)(a=>{a?x(async()=>{I(await n(a))}):I([])},[x]),ai=async()=>{ab&&V.trim()&&(await (0,j.createNote)({title:V.trim(),content:X,category:Z,projectId:ab}),U(!1),ab===F&&ah(F))},aj=async()=>{R&&V.trim()&&(await l(R.id,{title:V.trim(),content:X,category:Z}),S(null),ah(F))},ak=async a=>{let b=H.find(b=>b.id===a);!b||confirm(v("notes.deleteConfirm",{title:b.title}))&&(await (0,m.deleteNote)(a),ah(F))},al=L.trim().toLowerCase(),am=H.filter(a=>"all"===J||a.category===J).filter(a=>!al||a.title.toLowerCase().includes(al)).map(a=>({id:a.id,title:a.title,content:a.content,category:a.category,updatedAt:new Date(a.updatedAt),taskId:a.taskId,taskTitle:a.task?.title??null})),an=T||null!==R;return(0,b.jsxs)("div",{className:"flex h-full flex-col overflow-hidden",children:[(0,b.jsx)(g.SubPageNav,{workspaceId:y}),(0,b.jsxs)("div",{className:"header-sm flex items-center gap-3 px-6 py-2",children:[(0,b.jsxs)(r.Select,{value:y,onValueChange:b=>b&&(b=>{if(b===y)return;A(b);let c=a.find(a=>a.id===b),d=c?.projects[0]??null;G(d?.id??null),K("all"),ah(d?.id??null)})(b),children:[(0,b.jsx)(r.SelectTrigger,{className:"h-8 w-auto min-w-[120px]",children:(0,b.jsx)("span",{className:"truncate",children:a.find(a=>a.id===y)?.name??y})}),(0,b.jsx)(r.SelectContent,{children:a.map(a=>(0,b.jsx)(r.SelectItem,{value:a.id,children:a.name},a.id))})]}),ae.length>0&&(0,b.jsxs)(r.Select,{value:F??"",onValueChange:a=>a&&void(a!==F&&(G(a),K("all"),ah(a))),children:[(0,b.jsx)(r.SelectTrigger,{className:"h-8 w-auto min-w-[140px]",children:(0,b.jsx)("span",{className:"truncate",children:(t=ae.find(a=>a.id===F))?t.alias?`${t.name} (${t.alias})`:t.name:""})}),(0,b.jsx)(r.SelectContent,{children:ae.map(a=>(0,b.jsxs)(r.SelectItem,{value:a.id,children:[a.name,a.alias?` (${a.alias})`:""]},a.id))})]}),!an&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("div",{className:"relative ml-auto",children:[(0,b.jsx)(f.Search,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"}),(0,b.jsx)("input",{type:"text",value:L,onChange:a=>M(a.target.value),placeholder:v("notes.searchPlaceholder"),className:"h-8 w-48 rounded-md border border-border bg-background pl-8 pr-3 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"})]}),(0,b.jsxs)(q.Button,{onClick:()=>{W(""),Y(""),$(i.NOTE_CATEGORIES_PRESET[3]),aa(y),ac(F),S(null),U(!0)},className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:[(0,b.jsx)(d.Plus,{className:"h-3.5 w-3.5"}),(0,b.jsx)("span",{children:v("notes.newNote")})]})]})]}),(0,b.jsx)("div",{className:"flex-1 overflow-hidden px-6 py-4 flex flex-col",children:an?(0,b.jsxs)("div",{className:"flex flex-col gap-4 flex-1 min-h-0",children:[(0,b.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[!R&&(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("label",{className:"text-xs text-muted-foreground whitespace-nowrap",children:v("notes.workspace")}),(0,b.jsxs)(r.Select,{value:_,onValueChange:b=>b&&(b=>{if(b===_)return;aa(b);let c=a.find(a=>a.id===b),d=c?.projects[0]??null;ac(d?.id??null)})(b),children:[(0,b.jsx)(r.SelectTrigger,{className:"min-w-[140px] text-xs",children:(0,b.jsx)("span",{className:"truncate",children:a.find(a=>a.id===_)?.name??_})}),(0,b.jsx)(r.SelectContent,{children:a.map(a=>(0,b.jsx)(r.SelectItem,{value:a.id,children:a.name},a.id))})]})]}),!R&&ag.length>0&&(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("label",{className:"text-xs text-muted-foreground whitespace-nowrap",children:v("notes.project")}),(0,b.jsxs)(r.Select,{value:ab??"",onValueChange:a=>a&&ac(a),children:[(0,b.jsx)(r.SelectTrigger,{className:"min-w-[160px] text-xs",children:(0,b.jsx)("span",{className:"truncate",children:(u=ag.find(a=>a.id===ab))?u.alias?`${u.name} (${u.alias})`:u.name:""})}),(0,b.jsx)(r.SelectContent,{children:ag.map(a=>(0,b.jsxs)(r.SelectItem,{value:a.id,children:[a.name,a.alias?` (${a.alias})`:""]},a.id))})]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("label",{className:"text-xs text-muted-foreground whitespace-nowrap",children:v("notes.categoryLabel")}),(0,b.jsxs)(r.Select,{value:Z,onValueChange:a=>a&&$(a),children:[(0,b.jsx)(r.SelectTrigger,{className:"min-w-[120px] text-xs",children:(0,b.jsx)("span",{className:"truncate",children:Z})}),(0,b.jsx)(r.SelectContent,{children:i.NOTE_CATEGORIES_PRESET.map(a=>(0,b.jsx)(r.SelectItem,{value:a,children:a},a))})]})]})]}),(0,b.jsx)("input",{type:"text",value:V,onChange:a=>W(a.target.value),placeholder:v("notes.titlePlaceholder"),className:"w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"}),(0,b.jsx)(B,{value:X,onChange:Y}),(0,b.jsxs)("div",{className:"flex items-center gap-2 justify-end",children:[(0,b.jsx)(q.Button,{variant:"outline",onClick:()=>{U(!1),S(null)},children:v("notes.cancel")}),(0,b.jsx)(q.Button,{onClick:R?aj:ai,disabled:!V.trim()||!R&&!ab,className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:v("notes.save")})]})]}):(0,b.jsxs)("div",{className:"flex flex-col flex-1 min-h-0 gap-4",children:[(0,b.jsx)(p,{active:J,onSelect:K}),(0,b.jsx)(D.ScrollArea,{className:"flex-1 min-h-0",children:(0,b.jsxs)("div",{className:`relative ${w?"opacity-40 pointer-events-none":""} transition-opacity`,children:[w&&(0,b.jsx)("div",{className:"absolute inset-0 z-10 flex items-center justify-center",children:(0,b.jsx)(e.Loader2,{className:"size-5 animate-spin text-muted-foreground"})}),0===ae.length?(0,b.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 py-16 text-center",children:[(0,b.jsx)("p",{className:"text-sm font-medium text-muted-foreground",children:v("notes.noProject")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground/60",children:v("notes.noProjectHint")})]}):(0,b.jsx)(z,{notes:am,onEdit:a=>{W(a.title),Y(a.content),$(a.category),S(a),U(!1)},onDelete:ak,onPreview:O,onTaskClick:Q})]})})]})}),(0,b.jsx)(C.NotePreviewDialog,{note:N,open:null!==N,onOpenChange:a=>{a||O(null)}}),(0,b.jsx)(E.TaskOverviewDrawer,{open:null!==P,onOpenChange:a=>{a||Q(null)},taskId:P})]})}],778772)}];
2
2
 
3
3
  //# sourceMappingURL=src_app_workspaces_%5BworkspaceId%5D_notes_notes-page-client_tsx_10gyo3v._.js.map