tower-studio 0.1.18 → 0.1.20

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 (188) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +3 -3
  3. package/.next/cache/.previewinfo +1 -1
  4. package/.next/cache/.rscinfo +1 -1
  5. package/.next/cache/.tsbuildinfo +1 -1
  6. package/.next/diagnostics/route-bundle-stats.json +37 -37
  7. package/.next/fallback-build-manifest.json +3 -3
  8. package/.next/prerender-manifest.json +3 -3
  9. package/.next/server/app/_global-error.html +1 -1
  10. package/.next/server/app/_global-error.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  12. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  13. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  14. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  15. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  16. package/.next/server/app/_not-found/page/react-loadable-manifest.json +1 -1
  17. package/.next/server/app/_not-found/page/server-reference-manifest.json +25 -25
  18. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  19. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  20. package/.next/server/app/_not-found.html +1 -1
  21. package/.next/server/app/_not-found.rsc +13 -13
  22. package/.next/server/app/_not-found.segments/_full.segment.rsc +13 -13
  23. package/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
  24. package/.next/server/app/_not-found.segments/_index.segment.rsc +8 -8
  25. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  26. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
  27. package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  28. package/.next/server/app/api/files/assets/[projectId]/[filename]/route.js.nft.json +1 -1
  29. package/.next/server/app/api/internal/assets/[projectId]/[filename]/route.js.nft.json +1 -1
  30. package/.next/server/app/api/internal/assets/reveal/route.js.nft.json +1 -1
  31. package/.next/server/app/api/internal/assistant/chat/route.js.nft.json +1 -1
  32. package/.next/server/app/api/internal/assistant/images/route.js.nft.json +1 -1
  33. package/.next/server/app/api/internal/assistant/sessions/route.js.nft.json +1 -1
  34. package/.next/server/app/api/internal/cache/[...segments]/route.js.nft.json +1 -1
  35. package/.next/server/app/api/internal/hooks/upload/route.js.nft.json +1 -1
  36. package/.next/server/app/api/internal/terminal/[taskId]/start/route.js.nft.json +1 -1
  37. package/.next/server/app/api/tasks/[taskId]/merge/route.js.nft.json +1 -1
  38. package/.next/server/app/index.html +1 -1
  39. package/.next/server/app/index.rsc +13 -13
  40. package/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  41. package/.next/server/app/index.segments/_full.segment.rsc +13 -13
  42. package/.next/server/app/index.segments/_head.segment.rsc +4 -4
  43. package/.next/server/app/index.segments/_index.segment.rsc +8 -8
  44. package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  45. package/.next/server/app/missions/page/react-loadable-manifest.json +1 -1
  46. package/.next/server/app/missions/page/server-reference-manifest.json +47 -47
  47. package/.next/server/app/missions/page.js +2 -2
  48. package/.next/server/app/missions/page.js.nft.json +1 -1
  49. package/.next/server/app/missions/page_client-reference-manifest.js +1 -1
  50. package/.next/server/app/onboarding/page/react-loadable-manifest.json +1 -1
  51. package/.next/server/app/onboarding/page/server-reference-manifest.json +25 -25
  52. package/.next/server/app/onboarding/page.js.nft.json +1 -1
  53. package/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
  54. package/.next/server/app/onboarding.html +1 -1
  55. package/.next/server/app/onboarding.rsc +15 -15
  56. package/.next/server/app/onboarding.segments/_full.segment.rsc +15 -15
  57. package/.next/server/app/onboarding.segments/_head.segment.rsc +4 -4
  58. package/.next/server/app/onboarding.segments/_index.segment.rsc +8 -8
  59. package/.next/server/app/onboarding.segments/_tree.segment.rsc +1 -1
  60. package/.next/server/app/onboarding.segments/onboarding/__PAGE__.segment.rsc +4 -4
  61. package/.next/server/app/onboarding.segments/onboarding.segment.rsc +3 -3
  62. package/.next/server/app/page/react-loadable-manifest.json +1 -1
  63. package/.next/server/app/page/server-reference-manifest.json +25 -25
  64. package/.next/server/app/page.js.nft.json +1 -1
  65. package/.next/server/app/page_client-reference-manifest.js +1 -1
  66. package/.next/server/app/settings/page/react-loadable-manifest.json +1 -1
  67. package/.next/server/app/settings/page/server-reference-manifest.json +32 -32
  68. package/.next/server/app/settings/page.js.nft.json +1 -1
  69. package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  70. package/.next/server/app/settings.html +1 -1
  71. package/.next/server/app/settings.rsc +15 -15
  72. package/.next/server/app/settings.segments/_full.segment.rsc +15 -15
  73. package/.next/server/app/settings.segments/_head.segment.rsc +4 -4
  74. package/.next/server/app/settings.segments/_index.segment.rsc +8 -8
  75. package/.next/server/app/settings.segments/_tree.segment.rsc +1 -1
  76. package/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +4 -4
  77. package/.next/server/app/settings.segments/settings.segment.rsc +3 -3
  78. package/.next/server/app/workspaces/[workspaceId]/archive/page/react-loadable-manifest.json +1 -1
  79. package/.next/server/app/workspaces/[workspaceId]/archive/page/server-reference-manifest.json +71 -71
  80. package/.next/server/app/workspaces/[workspaceId]/archive/page.js +1 -1
  81. package/.next/server/app/workspaces/[workspaceId]/archive/page.js.nft.json +1 -1
  82. package/.next/server/app/workspaces/[workspaceId]/archive/page_client-reference-manifest.js +1 -1
  83. package/.next/server/app/workspaces/[workspaceId]/assets/page/react-loadable-manifest.json +1 -1
  84. package/.next/server/app/workspaces/[workspaceId]/assets/page/server-reference-manifest.json +68 -68
  85. package/.next/server/app/workspaces/[workspaceId]/assets/page.js.nft.json +1 -1
  86. package/.next/server/app/workspaces/[workspaceId]/assets/page_client-reference-manifest.js +1 -1
  87. package/.next/server/app/workspaces/[workspaceId]/notes/page/react-loadable-manifest.json +1 -1
  88. package/.next/server/app/workspaces/[workspaceId]/notes/page/server-reference-manifest.json +61 -61
  89. package/.next/server/app/workspaces/[workspaceId]/notes/page.js.nft.json +1 -1
  90. package/.next/server/app/workspaces/[workspaceId]/notes/page_client-reference-manifest.js +1 -1
  91. package/.next/server/app/workspaces/[workspaceId]/page/react-loadable-manifest.json +1 -1
  92. package/.next/server/app/workspaces/[workspaceId]/page/server-reference-manifest.json +53 -53
  93. package/.next/server/app/workspaces/[workspaceId]/page.js +2 -2
  94. package/.next/server/app/workspaces/[workspaceId]/page.js.nft.json +1 -1
  95. package/.next/server/app/workspaces/[workspaceId]/page_client-reference-manifest.js +1 -1
  96. package/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page/react-loadable-manifest.json +1 -1
  97. package/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page/server-reference-manifest.json +25 -25
  98. package/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page.js.nft.json +1 -1
  99. package/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page_client-reference-manifest.js +1 -1
  100. package/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page/react-loadable-manifest.json +1 -1
  101. package/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page/server-reference-manifest.json +58 -58
  102. package/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page.js +1 -1
  103. package/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page.js.nft.json +1 -1
  104. package/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
  105. package/.next/server/app/workspaces/page/react-loadable-manifest.json +1 -1
  106. package/.next/server/app/workspaces/page/server-reference-manifest.json +43 -43
  107. package/.next/server/app/workspaces/page.js.nft.json +1 -1
  108. package/.next/server/app/workspaces/page_client-reference-manifest.js +1 -1
  109. package/.next/server/chunks/0uz~_next_dist_esm_build_templates_app-route_05yec2y.js +1 -1
  110. package/.next/server/chunks/[root-of-the-server]__00~8_qz._.js +1 -1
  111. package/.next/server/chunks/[root-of-the-server]__05mc_xk._.js +1 -1
  112. package/.next/server/chunks/[root-of-the-server]__0bvqbq0._.js +1 -1
  113. package/.next/server/chunks/[root-of-the-server]__0p5iuez._.js +2 -2
  114. package/.next/server/chunks/[root-of-the-server]__0rb-ear._.js +2 -2
  115. package/.next/server/chunks/[root-of-the-server]__0u4~z7h._.js +1 -1
  116. package/.next/server/chunks/[root-of-the-server]__0ze75mm._.js +1 -1
  117. package/.next/server/chunks/project_f_tower_0n1s3ym._.js +1 -1
  118. package/.next/server/chunks/project_f_tower_src_11e.cv5._.js +1 -1
  119. package/.next/server/chunks/project_f_tower_src_lib_10p8sue._.js +1 -1
  120. package/.next/server/chunks/ssr/04uy_src_app_workspaces_[workspaceId]_tasks_[taskId]_task-page-client_tsx_01.s1p0._.js +1 -1
  121. package/.next/server/chunks/ssr/0y0r_f_tower_src_app_workspaces_[workspaceId]_assets_assets-page-client_tsx_0n4g3bn._.js +1 -1
  122. package/.next/server/chunks/ssr/[root-of-the-server]__06qzctf._.js +1 -1
  123. package/.next/server/chunks/ssr/[root-of-the-server]__0_47k-j._.js +1 -1
  124. package/.next/server/chunks/ssr/[root-of-the-server]__0aidehy._.js +1 -1
  125. package/.next/server/chunks/ssr/{[root-of-the-server]__00_.ri0._.js → [root-of-the-server]__0e6iflg._.js} +2 -2
  126. package/.next/server/chunks/ssr/[root-of-the-server]__0ffdrwp._.js +1 -1
  127. package/.next/server/chunks/ssr/[root-of-the-server]__0hiekzn._.js +1 -1
  128. package/.next/server/chunks/ssr/[root-of-the-server]__0i4rk9v._.js +3 -3
  129. package/.next/server/chunks/ssr/[root-of-the-server]__0o7o7z_._.js +3 -0
  130. package/.next/server/chunks/ssr/{[root-of-the-server]__0jpbiq_._.js → [root-of-the-server]__0uu_6~5._.js} +2 -2
  131. package/.next/server/chunks/ssr/[root-of-the-server]__0w7gbe7._.js +1 -1
  132. package/.next/server/chunks/ssr/[root-of-the-server]__0zaw-fl._.js +1 -1
  133. package/.next/server/chunks/ssr/[root-of-the-server]__13eo85g._.js +1 -1
  134. package/.next/server/chunks/ssr/project_f_tower_0.txwd8._.js +1 -1
  135. package/.next/server/chunks/ssr/{project_f_tower_09re1~6._.js → project_f_tower_07-hbsx._.js} +2 -2
  136. package/.next/server/chunks/ssr/{project_f_tower_13hdtgf._.js → project_f_tower_0866f0-._.js} +2 -2
  137. package/.next/server/chunks/ssr/{project_f_tower_006ysi2._.js → project_f_tower_0ad9933._.js} +2 -2
  138. package/.next/server/chunks/ssr/{project_f_tower_0m76uwh._.js → project_f_tower_0bd-exe._.js} +2 -2
  139. package/.next/server/chunks/ssr/project_f_tower_0cxt-u.._.js +3 -0
  140. package/.next/server/chunks/ssr/project_f_tower_0f0-wva._.js +1 -1
  141. package/.next/server/chunks/ssr/project_f_tower_0hgtev9._.js +1 -1
  142. package/.next/server/chunks/ssr/project_f_tower_0ivvjwd._.js +1 -1
  143. package/.next/server/chunks/ssr/project_f_tower_0jy~1uf._.js +1 -1
  144. package/.next/server/chunks/ssr/project_f_tower_0l6ssf8._.js +1 -1
  145. package/.next/server/chunks/ssr/project_f_tower_0o5.y1e._.js +1 -1
  146. package/.next/server/chunks/ssr/project_f_tower_0w01kgd._.js +1 -1
  147. package/.next/server/chunks/ssr/project_f_tower_0ym-aea._.js +1 -1
  148. package/.next/server/chunks/ssr/{project_f_tower_0vfw8sn._.js → project_f_tower_0~41x_-._.js} +2 -2
  149. package/.next/server/chunks/ssr/{project_f_tower_src_13jw2_q._.js → project_f_tower_src_0p8gi_2._.js} +2 -2
  150. package/.next/server/chunks/ssr/project_f_tower_src_actions_agent-actions_ts_0.s4~m-._.js +1 -1
  151. package/.next/server/chunks/ssr/project_f_tower_src_actions_file-actions_ts_02i742t._.js +1 -1
  152. package/.next/server/chunks/ssr/project_f_tower_src_app_missions_missions-client_tsx_0ums4qx._.js +1 -1
  153. package/.next/server/chunks/ssr/project_f_tower_src_app_onboarding_page_tsx_0_9_yoq._.js +1 -1
  154. package/.next/server/chunks/ssr/project_f_tower_src_app_settings_page_tsx_0oo06~d._.js +1 -1
  155. package/.next/server/chunks/ssr/project_f_tower_src_app_workspaces_[workspaceId]_board-page-client_tsx_0jmj1xz._.js +1 -1
  156. package/.next/server/instrumentation.js.nft.json +1 -1
  157. package/.next/server/middleware-build-manifest.js +3 -3
  158. package/.next/server/pages/404.html +1 -1
  159. package/.next/server/pages/500.html +1 -1
  160. package/.next/server/server-reference-manifest.js +1 -1
  161. package/.next/server/server-reference-manifest.json +198 -198
  162. package/.next/static/chunks/06kg_505w0jw1.js +1 -0
  163. package/.next/static/chunks/09byywt6bkrfa.js +1 -0
  164. package/.next/static/chunks/{0~wu849la7jq2.js → 09hk_t9sy5wux.js} +1 -1
  165. package/.next/static/chunks/{0j3ixh~tlr2~~.js → 0b-_zu1k~lyul.js} +2 -2
  166. package/.next/static/chunks/{0ejd72g7tekop.js → 0ci9m8jp27a9c.js} +1 -1
  167. package/.next/static/chunks/{163-h-672vjtc.js → 0dspkfgz.dhn1.js} +1 -1
  168. package/.next/static/chunks/{1068kwso1r._u.js → 0f1jt_izz4dt-.js} +1 -1
  169. package/.next/static/chunks/{0kjm.xm_~nzz0.js → 0i-71pxd663r9.js} +1 -1
  170. package/.next/static/chunks/{0jm.d2tvttdcy.js → 0l.3myaonfg1h.js} +1 -1
  171. package/.next/static/chunks/{0x2z0sza~9erw.js → 0llbf__idgh~l.js} +1 -1
  172. package/.next/static/chunks/{0a93fdjk-37r7.js → 0o0a2vel7_xs4.js} +1 -1
  173. package/.next/static/chunks/0r2hhrhsollsz.js +1 -0
  174. package/.next/static/chunks/{14ul.txcdkz4n.js → 0s6xs0.kd4j1c.js} +1 -1
  175. package/.next/static/chunks/{0x9x7bxnrbi1..js → 105b3mtl5gt1l.js} +1 -1
  176. package/.next/static/chunks/{0vhwphmq69i0d.js → 12rg2xcias_84.js} +1 -1
  177. package/.next/trace +2 -2
  178. package/.next/trace-build +1 -1
  179. package/package.json +3 -2
  180. package/scripts/fix-native-permissions.js +39 -0
  181. package/.next/server/chunks/ssr/[root-of-the-server]__0.yn90z._.js +0 -3
  182. package/.next/server/chunks/ssr/project_f_tower_0d9_kxc._.js +0 -3
  183. package/.next/static/chunks/09mbyvk8z.wx2.js +0 -1
  184. package/.next/static/chunks/0mf6fqi52ca~q.js +0 -1
  185. package/.next/static/chunks/17b4edxd7wg5~.js +0 -1
  186. /package/.next/static/{EMk0oZpCVYuq8amkRB5za → uPbfev-r-deeE_PmqOX1E}/_buildManifest.js +0 -0
  187. /package/.next/static/{EMk0oZpCVYuq8amkRB5za → uPbfev-r-deeE_PmqOX1E}/_clientMiddlewareManifest.js +0 -0
  188. /package/.next/static/{EMk0oZpCVYuq8amkRB5za → uPbfev-r-deeE_PmqOX1E}/_ssgManifest.js +0 -0
@@ -2,6 +2,6 @@ module.exports=[257179,a=>{"use strict";let b,c,d;var e,f,g,h,i,j,k,l,m,n,o=a.i(
2
2
 
3
3
  If you want to hide the \`${b.titleName}\`, you can wrap it with our VisuallyHidden component.
4
4
 
5
- For more information, see https://radix-ui.com/primitives/docs/components/${b.docsSlug}`;return p.useEffect(()=>{a&&(document.getElementById(a)||console.error(c))},[c,a]),null},c_=({contentRef:a,descriptionId:b})=>{let c=cZ("DialogDescriptionWarning"),d=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${c.contentName}}.`;return p.useEffect(()=>{let c=a.current?.getAttribute("aria-describedby");b&&c&&(document.getElementById(b)||console.warn(d))},[d,a,b]),null},c0=Symbol.for("react.lazy"),c1=p[" use ".trim().toString()];function c2(a){var b;return null!=a&&"object"==typeof a&&"$$typeof"in a&&a.$$typeof===c0&&"_payload"in a&&"object"==typeof(b=a._payload)&&null!==b&&"then"in b}var c3=Symbol("radix.slottable");function c4(a){return p.isValidElement(a)&&"function"==typeof a.type&&"__radixId"in a.type&&a.type.__radixId===c3}var c5=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((a,b)=>{var c,d;let e,f,g,h=(d=c=`Primitive.${b}`,(e=p.forwardRef((a,b)=>{let{children:c,...d}=a;if(c2(c)&&"function"==typeof c1&&(c=c1(c._payload)),p.isValidElement(c)){var e;let a,f,g=(e=c,(f=(a=Object.getOwnPropertyDescriptor(e.props,"ref")?.get)&&"isReactWarning"in a&&a.isReactWarning)?e.ref:(f=(a=Object.getOwnPropertyDescriptor(e,"ref")?.get)&&"isReactWarning"in a&&a.isReactWarning)?e.props.ref:e.props.ref||e.ref),h=function(a,b){let c={...b};for(let d in b){let e=a[d],f=b[d];/^on[A-Z]/.test(d)?e&&f?c[d]=(...a)=>{let b=f(...a);return e(...a),b}:e&&(c[d]=e):"style"===d?c[d]={...e,...f}:"className"===d&&(c[d]=[e,f].filter(Boolean).join(" "))}return{...a,...c}}(d,c.props);return c.type!==p.Fragment&&(h.ref=b?bs(b,g):g),p.cloneElement(c,h)}return p.Children.count(c)>1?p.Children.only(null):null})).displayName=`${d}.SlotClone`,f=e,(g=p.forwardRef((a,b)=>{let{children:c,...d}=a;c2(c)&&"function"==typeof c1&&(c=c1(c._payload));let e=p.Children.toArray(c),g=e.find(c4);if(g){let a=g.props.children,c=e.map(b=>b!==g?b:p.Children.count(a)>1?p.Children.only(null):p.isValidElement(a)?a.props.children:null);return(0,o.jsx)(f,{...d,ref:b,children:p.isValidElement(a)?p.cloneElement(a,void 0,c):null})}return(0,o.jsx)(f,{...d,ref:b,children:c})})).displayName=`${c}.Slot`,g),i=p.forwardRef((a,c)=>{let{asChild:d,...e}=a;return(0,o.jsx)(d?h:b,{...e,ref:c})});return i.displayName=`Primitive.${b}`,{...a,[b]:i}},{}),c6='[cmdk-group=""]',c7='[cmdk-group-items=""]',c8='[cmdk-item=""]',c9=`${c8}:not([aria-disabled="true"])`,da="cmdk-item-select",db="data-value",dc=(a,b,c)=>{var d;return d=a,function a(b,c,d,e,f,g,h){if(g===c.length)return f===b.length?1:.99;var i=`${f},${g}`;if(void 0!==h[i])return h[i];for(var j,k,l,m,n=e.charAt(g),o=d.indexOf(n,f),p=0;o>=0;)(j=a(b,c,d,e,o+1,g+1,h))>p&&(o===f?j*=1:bl.test(b.charAt(o-1))?(j*=.8,(l=b.slice(f,o-1).match(bm))&&f>0&&(j*=Math.pow(.999,l.length))):bn.test(b.charAt(o-1))?(j*=.9,(m=b.slice(f,o-1).match(bo))&&f>0&&(j*=Math.pow(.999,m.length))):(j*=.17,f>0&&(j*=Math.pow(.999,o-f))),b.charAt(o)!==c.charAt(g)&&(j*=.9999)),(j<.1&&d.charAt(o-1)===e.charAt(g+1)||e.charAt(g+1)===e.charAt(g)&&d.charAt(o-1)!==e.charAt(g))&&.1*(k=a(b,c,d,e,o+1,g+2,h))>j&&(j=.1*k),j>p&&(p=j),o=d.indexOf(n,o+1);return h[i]=p,p}(d=c&&c.length>0?`${d+" "+c.join(" ")}`:d,b,bp(d),bp(b),0,0,{})},dd=p.createContext(void 0),de=p.createContext(void 0),df=p.createContext(void 0),dg=p.forwardRef((a,b)=>{let c=dr(()=>{var b,c;return{search:"",value:null!=(c=null!=(b=a.value)?b:a.defaultValue)?c:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),d=dr(()=>new Set),e=dr(()=>new Map),f=dr(()=>new Map),g=dr(()=>new Set),h=dp(a),{label:i,children:j,value:k,onValueChange:l,filter:m,shouldFilter:n,loop:o,disablePointerSelection:q=!1,vimBindings:r=!0,...s}=a,t=bx(),u=bx(),v=bx(),w=p.useRef(null),x=du();dq(()=>{if(void 0!==k){let a=k.trim();c.current.value=a,y.emit()}},[k]),dq(()=>{x(6,E)},[]);let y=p.useMemo(()=>({subscribe:a=>(g.current.add(a),()=>g.current.delete(a)),snapshot:()=>c.current,setState:(a,b,d)=>{var e,f,g,i;if(!Object.is(c.current[a],b)){if(c.current[a]=b,"search"===a)D(),B(),x(1,C);else if("value"===a){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let a=document.getElementById(v);a?a.focus():null==(e=document.getElementById(t))||e.focus()}if(x(7,()=>{var a;c.current.selectedItemId=null==(a=F())?void 0:a.id,y.emit()}),d||x(5,E),(null==(f=h.current)?void 0:f.value)!==void 0){null==(i=(g=h.current).onValueChange)||i.call(g,null!=b?b:"");return}}y.emit()}},emit:()=>{g.current.forEach(a=>a())}}),[]),z=p.useMemo(()=>({value:(a,b,d)=>{var e;b!==(null==(e=f.current.get(a))?void 0:e.value)&&(f.current.set(a,{value:b,keywords:d}),c.current.filtered.items.set(a,A(b,d)),x(2,()=>{B(),y.emit()}))},item:(a,b)=>(d.current.add(a),b&&(e.current.has(b)?e.current.get(b).add(a):e.current.set(b,new Set([a]))),x(3,()=>{D(),B(),c.current.value||C(),y.emit()}),()=>{f.current.delete(a),d.current.delete(a),c.current.filtered.items.delete(a);let b=F();x(4,()=>{D(),(null==b?void 0:b.getAttribute("id"))===a&&C(),y.emit()})}),group:a=>(e.current.has(a)||e.current.set(a,new Set),()=>{f.current.delete(a),e.current.delete(a)}),filter:()=>h.current.shouldFilter,label:i||a["aria-label"],getDisablePointerSelection:()=>h.current.disablePointerSelection,listId:t,inputId:v,labelId:u,listInnerRef:w}),[]);function A(a,b){var d,e;let f=null!=(e=null==(d=h.current)?void 0:d.filter)?e:dc;return a?f(a,c.current.search,b):0}function B(){if(!c.current.search||!1===h.current.shouldFilter)return;let a=c.current.filtered.items,b=[];c.current.filtered.groups.forEach(c=>{let d=e.current.get(c),f=0;d.forEach(b=>{f=Math.max(a.get(b),f)}),b.push([c,f])});let d=w.current;G().sort((b,c)=>{var d,e;let f=b.getAttribute("id"),g=c.getAttribute("id");return(null!=(d=a.get(g))?d:0)-(null!=(e=a.get(f))?e:0)}).forEach(a=>{let b=a.closest(c7);b?b.appendChild(a.parentElement===b?a:a.closest(`${c7} > *`)):d.appendChild(a.parentElement===d?a:a.closest(`${c7} > *`))}),b.sort((a,b)=>b[1]-a[1]).forEach(a=>{var b;let c=null==(b=w.current)?void 0:b.querySelector(`${c6}[${db}="${encodeURIComponent(a[0])}"]`);null==c||c.parentElement.appendChild(c)})}function C(){let a=G().find(a=>"true"!==a.getAttribute("aria-disabled")),b=null==a?void 0:a.getAttribute(db);y.setState("value",b||void 0)}function D(){var a,b,g,i;if(!c.current.search||!1===h.current.shouldFilter){c.current.filtered.count=d.current.size;return}c.current.filtered.groups=new Set;let j=0;for(let e of d.current){let d=A(null!=(b=null==(a=f.current.get(e))?void 0:a.value)?b:"",null!=(i=null==(g=f.current.get(e))?void 0:g.keywords)?i:[]);c.current.filtered.items.set(e,d),d>0&&j++}for(let[a,b]of e.current)for(let d of b)if(c.current.filtered.items.get(d)>0){c.current.filtered.groups.add(a);break}c.current.filtered.count=j}function E(){var a,b,c;let d=F();d&&((null==(a=d.parentElement)?void 0:a.firstChild)===d&&(null==(c=null==(b=d.closest(c6))?void 0:b.querySelector('[cmdk-group-heading=""]'))||c.scrollIntoView({block:"nearest"})),d.scrollIntoView({block:"nearest"}))}function F(){var a;return null==(a=w.current)?void 0:a.querySelector(`${c8}[aria-selected="true"]`)}function G(){var a;return Array.from((null==(a=w.current)?void 0:a.querySelectorAll(c9))||[])}function H(a){let b=G()[a];b&&y.setState("value",b.getAttribute(db))}function I(a){var b;let c=F(),d=G(),e=d.findIndex(a=>a===c),f=d[e+a];null!=(b=h.current)&&b.loop&&(f=e+a<0?d[d.length-1]:e+a===d.length?d[0]:d[e+a]),f&&y.setState("value",f.getAttribute(db))}function J(a){let b=F(),c=null==b?void 0:b.closest(c6),d;for(;c&&!d;)d=null==(c=a>0?function(a,b){let c=a.nextElementSibling;for(;c;){if(c.matches(b))return c;c=c.nextElementSibling}}(c,c6):function(a,b){let c=a.previousElementSibling;for(;c;){if(c.matches(b))return c;c=c.previousElementSibling}}(c,c6))?void 0:c.querySelector(c9);d?y.setState("value",d.getAttribute(db)):I(a)}let K=()=>H(G().length-1),L=a=>{a.preventDefault(),a.metaKey?K():a.altKey?J(1):I(1)},M=a=>{a.preventDefault(),a.metaKey?H(0):a.altKey?J(-1):I(-1)};return p.createElement(c5.div,{ref:b,tabIndex:-1,...s,"cmdk-root":"",onKeyDown:a=>{var b;null==(b=s.onKeyDown)||b.call(s,a);let c=a.nativeEvent.isComposing||229===a.keyCode;if(!(a.defaultPrevented||c))switch(a.key){case"n":case"j":r&&a.ctrlKey&&L(a);break;case"ArrowDown":L(a);break;case"p":case"k":r&&a.ctrlKey&&M(a);break;case"ArrowUp":M(a);break;case"Home":a.preventDefault(),H(0);break;case"End":a.preventDefault(),K();break;case"Enter":{a.preventDefault();let b=F();if(b){let a=new Event(da);b.dispatchEvent(a)}}}}},p.createElement("label",{"cmdk-label":"",htmlFor:z.inputId,id:z.labelId,style:dw},i),dv(a,a=>p.createElement(de.Provider,{value:y},p.createElement(dd.Provider,{value:z},a))))}),dh=p.forwardRef((a,b)=>{var c,d;let e=bx(),f=p.useRef(null),g=p.useContext(df),h=p.useContext(dd),i=dp(a),j=null!=(d=null==(c=i.current)?void 0:c.forceMount)?d:null==g?void 0:g.forceMount;dq(()=>{if(!j)return h.item(e,null==g?void 0:g.id)},[j]);let k=dt(e,f,[a.value,a.children,f],a.keywords),l=p.useContext(de),m=ds(a=>a.value&&a.value===k.current),n=ds(a=>!!j||!1===h.filter()||!a.search||a.filtered.items.get(e)>0);function o(){var a,b;q(),null==(b=(a=i.current).onSelect)||b.call(a,k.current)}function q(){l.setState("value",k.current,!0)}if(p.useEffect(()=>{let b=f.current;if(!(!b||a.disabled))return b.addEventListener(da,o),()=>b.removeEventListener(da,o)},[n,a.onSelect,a.disabled]),!n)return null;let{disabled:r,value:s,onSelect:t,forceMount:u,keywords:v,...w}=a;return p.createElement(c5.div,{ref:bs(f,b),...w,id:e,"cmdk-item":"",role:"option","aria-disabled":!!r,"aria-selected":!!m,"data-disabled":!!r,"data-selected":!!m,onPointerMove:r||h.getDisablePointerSelection()?void 0:q,onClick:r?void 0:o},a.children)}),di=p.forwardRef((a,b)=>{let{heading:c,children:d,forceMount:e,...f}=a,g=bx(),h=p.useRef(null),i=p.useRef(null),j=bx(),k=p.useContext(dd),l=ds(a=>!!e||!1===k.filter()||!a.search||a.filtered.groups.has(g));dq(()=>k.group(g),[]),dt(g,h,[a.value,a.heading,i]);let m=p.useMemo(()=>({id:g,forceMount:e}),[e]);return p.createElement(c5.div,{ref:bs(h,b),...f,"cmdk-group":"",role:"presentation",hidden:!l||void 0},c&&p.createElement("div",{ref:i,"cmdk-group-heading":"","aria-hidden":!0,id:j},c),dv(a,a=>p.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":c?j:void 0},p.createElement(df.Provider,{value:m},a))))}),dj=p.forwardRef((a,b)=>{let{alwaysRender:c,...d}=a,e=p.useRef(null),f=ds(a=>!a.search);return c||f?p.createElement(c5.div,{ref:bs(e,b),...d,"cmdk-separator":"",role:"separator"}):null}),dk=p.forwardRef((a,b)=>{let{onValueChange:c,...d}=a,e=null!=a.value,f=p.useContext(de),g=ds(a=>a.search),h=ds(a=>a.selectedItemId),i=p.useContext(dd);return p.useEffect(()=>{null!=a.value&&f.setState("search",a.value)},[a.value]),p.createElement(c5.input,{ref:b,...d,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":i.listId,"aria-labelledby":i.labelId,"aria-activedescendant":h,id:i.inputId,type:"text",value:e?a.value:g,onChange:a=>{e||f.setState("search",a.target.value),null==c||c(a.target.value)}})}),dl=p.forwardRef((a,b)=>{let{children:c,label:d="Suggestions",...e}=a,f=p.useRef(null),g=p.useRef(null),h=ds(a=>a.selectedItemId),i=p.useContext(dd);return p.useEffect(()=>{if(g.current&&f.current){let a=g.current,b=f.current,c,d=new ResizeObserver(()=>{c=requestAnimationFrame(()=>{let c=a.offsetHeight;b.style.setProperty("--cmdk-list-height",c.toFixed(1)+"px")})});return d.observe(a),()=>{cancelAnimationFrame(c),d.unobserve(a)}}},[]),p.createElement(c5.div,{ref:bs(f,b),...e,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":h,"aria-label":d,id:i.listId},dv(a,a=>p.createElement("div",{ref:bs(g,i.listInnerRef),"cmdk-list-sizer":""},a)))}),dm=p.forwardRef((a,b)=>{let{open:c,onOpenChange:d,overlayClassName:e,contentClassName:f,container:g,...h}=a;return p.createElement(cE,{open:c,onOpenChange:d},p.createElement(cJ,{container:g},p.createElement(cL,{"cmdk-overlay":"",className:e}),p.createElement(cP,{"aria-label":a.label,"cmdk-dialog":"",className:f},p.createElement(dg,{ref:b,...h}))))}),dn=Object.assign(dg,{List:dl,Item:dh,Input:dk,Group:di,Separator:dj,Dialog:dm,Empty:p.forwardRef((a,b)=>ds(a=>0===a.filtered.count)?p.createElement(c5.div,{ref:b,...a,"cmdk-empty":"",role:"presentation"}):null),Loading:p.forwardRef((a,b)=>{let{progress:c,children:d,label:e="Loading...",...f}=a;return p.createElement(c5.div,{ref:b,...f,"cmdk-loading":"",role:"progressbar","aria-valuenow":c,"aria-valuemin":0,"aria-valuemax":100,"aria-label":e},dv(a,a=>p.createElement("div",{"aria-hidden":!0},a)))})});function dp(a){let b=p.useRef(a);return dq(()=>{b.current=a}),b}var dq=p.useEffect;function dr(a){let b=p.useRef();return void 0===b.current&&(b.current=a()),b}function ds(a){let b=p.useContext(de),c=()=>a(b.snapshot());return p.useSyncExternalStore(b.subscribe,c,c)}function dt(a,b,c,d=[]){let e=p.useRef(),f=p.useContext(dd);return dq(()=>{var g;let h=(()=>{var a;for(let b of c){if("string"==typeof b)return b.trim();if("object"==typeof b&&"current"in b)return b.current?null==(a=b.current.textContent)?void 0:a.trim():e.current}})(),i=d.map(a=>a.trim());f.value(a,h,i),null==(g=b.current)||g.setAttribute(db,h),e.current=h}),e}var du=()=>{let[a,b]=p.useState(),c=dr(()=>new Map);return dq(()=>{c.current.forEach(a=>a()),c.current=new Map},[a]),(a,d)=>{c.current.set(a,d),b({})}};function dv({asChild:a,children:b},c){let d;return a&&p.isValidElement(b)?p.cloneElement("function"==typeof(d=b.type)?d(b.props):"render"in d?d.render(b.props):b,{ref:b.ref},c(b.props.children)):c(b)}var dw={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"},dx=a.i(488137);function dy({className:a,...b}){return(0,o.jsx)("div",{"data-slot":"input-group",role:"group",className:(0,bh.cn)("group/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5",a),...b})}let dz=(0,dx.cva)("flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",{variants:{align:{"inline-start":"order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]","inline-end":"order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]","block-start":"order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2","block-end":"order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2"}},defaultVariants:{align:"inline-start"}});function dA({className:a,align:b="inline-start",...c}){return(0,o.jsx)("div",{role:"group","data-slot":"input-group-addon","data-align":b,className:(0,bh.cn)(dz({align:b}),a),onClick:a=>{a.target.closest("button")||a.currentTarget.parentElement?.querySelector("input")?.focus()},...c})}(0,dx.cva)("flex items-center gap-2 text-sm shadow-none",{variants:{size:{xs:"h-6 gap-1 rounded-[calc(var(--radius)-3px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5",sm:"","icon-xs":"size-6 rounded-[calc(var(--radius)-3px)] p-0 has-[>svg]:p-0","icon-sm":"size-8 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});var dB=a.i(458415),dB=dB,dC=a.i(659503);function dD({className:a,...b}){return(0,o.jsx)(dn,{"data-slot":"command",className:(0,bh.cn)("flex size-full flex-col overflow-hidden rounded-xl! bg-popover p-1 text-popover-foreground",a),...b})}function dE({className:a,...b}){return(0,o.jsx)("div",{"data-slot":"command-input-wrapper",className:"p-1 pb-0",children:(0,o.jsxs)(dy,{className:"h-8! rounded-lg! border-input/30 bg-input/30 shadow-none! *:data-[slot=input-group-addon]:pl-2!",children:[(0,o.jsx)(dn.Input,{"data-slot":"command-input",className:(0,bh.cn)("w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",a),...b}),(0,o.jsx)(dA,{children:(0,o.jsx)(dB.default,{className:"size-4 shrink-0 opacity-50"})})]})})}function dF({className:a,...b}){return(0,o.jsx)(dn.List,{"data-slot":"command-list",className:(0,bh.cn)("no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none",a),...b})}function dG({className:a,...b}){return(0,o.jsx)(dn.Empty,{"data-slot":"command-empty",className:(0,bh.cn)("py-6 text-center text-sm",a),...b})}function dH({className:a,...b}){return(0,o.jsx)(dn.Group,{"data-slot":"command-group",className:(0,bh.cn)("overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground",a),...b})}function dI({className:a,children:b,...c}){return(0,o.jsxs)(dn.Item,{"data-slot":"command-item",className:(0,bh.cn)("group/command-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none in-data-[slot=dialog-content]:rounded-lg! data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-muted data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-selected:*:[svg]:text-foreground",a),...c,children:[b,(0,o.jsx)(dC.CheckIcon,{className:"ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100"})]})}var dJ=a.i(879876);let dK=(0,dJ.createServerReference)("40558e0dce951137f6b678ce9191f92156ca2ad3bd",dJ.callServer,void 0,dJ.findSourceMapURL,"getProjectBranches"),dL=(0,dJ.createServerReference)("40db64abf4f57db8b07dc1e7abfb0d209aedb75f31",dJ.callServer,void 0,dJ.findSourceMapURL,"fetchRemoteBranches"),dM=(0,dJ.createServerReference)("40cc8e79b8987ce583c7af253be75329c6613b2b6e",dJ.callServer,void 0,dJ.findSourceMapURL,"getCurrentBranch");function dN({open:a,onOpenChange:b,onSubmit:c,onUpdate:d,defaultStatus:e="TODO",editTask:f,editTaskLabelIds:g,labels:h,projectType:i,projectLocalPath:j}){let[k,l]=(0,p.useState)(""),[m,n]=(0,p.useState)(""),[q,r]=(0,p.useState)("MEDIUM"),[s,t]=(0,p.useState)(""),[u,w]=(0,p.useState)([]),[x,y]=(0,p.useState)([]),[A,B]=(0,p.useState)(!1),[D,E]=(0,p.useState)(""),[F,G]=(0,p.useState)(!1),[H,I]=(0,p.useState)(!0),{t:J}=(0,v.useI18n)(),K=!!f,L=!!j;return(0,p.useEffect)(()=>{f?(l(f.title),n(f.description??""),r(f.priority),t(f.subPath??""),w(g??[])):(l(""),n(""),r("MEDIUM"),t(""),w([]))},[f,g]),(0,p.useEffect)(()=>{a||f||(l(""),n(""),r("MEDIUM"),t(""),w([]),y([]),E(""),G(!1))},[a,f]),(0,p.useEffect)(()=>{a&&L&&!f&&(B(!0),Promise.all([dK(j),dM(j)]).then(([a,b])=>{y(a),E(b&&a.includes(b)?b:a[0]??""),B(!1),dL(j).then(()=>{setTimeout(()=>{dK(j).then(a=>{y(a),E(b=>a.includes(b)?b:a[0]??"")}).catch(()=>{})},3e3)})}).catch(()=>{y([]),E(""),B(!1)}))},[a,L,j,f]),(0,o.jsx)(Q.Dialog,{open:a,onOpenChange:b,disablePointerDismissal:!0,children:(0,o.jsxs)(Q.DialogContent,{className:"sm:max-w-md",children:[(0,o.jsx)(Q.DialogHeader,{children:(0,o.jsx)(Q.DialogTitle,{children:K?J("task.edit"):J("task.create")})}),(0,o.jsxs)("div",{className:"space-y-4 py-2",children:[(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)(X.Label,{htmlFor:"title",children:J("task.title")}),(0,o.jsx)(V.Input,{id:"title","data-testid":"task-title",placeholder:J("task.titlePlaceholder"),value:k,onChange:a=>l(a.target.value),onKeyDown:a=>"Enter"===a.key&&a.preventDefault()})]}),(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)(X.Label,{htmlFor:"description",children:J("task.description")}),(0,o.jsx)(W.Textarea,{id:"description",placeholder:J("task.descPlaceholder"),rows:4,value:m,onChange:a=>n(a.target.value),className:"max-h-[200px] overflow-y-auto"})]}),(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)(X.Label,{htmlFor:"subPath",children:J("task.subPath")}),(0,o.jsx)(V.Input,{id:"subPath",placeholder:J("task.subPathPlaceholder"),value:s,onChange:a=>t(a.target.value)}),(0,o.jsx)("p",{className:"text-xs text-muted-foreground",children:J("task.subPathHint")})]}),(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)(X.Label,{children:J("task.priority")}),(0,o.jsx)("div",{className:"flex gap-1.5",children:["LOW","MEDIUM","HIGH","CRITICAL"].map(a=>{let b={LOW:{label:J("task.priorityLow"),style:"text-slate-300 border-slate-500/30 bg-slate-500/10"},MEDIUM:{label:J("task.priorityMedium"),style:"text-amber-300 border-amber-500/30 bg-amber-500/10"},HIGH:{label:J("task.priorityHigh"),style:"text-orange-300 border-orange-500/30 bg-orange-500/10"},CRITICAL:{label:J("task.priorityCritical"),style:"text-rose-300 border-rose-500/30 bg-rose-500/10"}}[a];return(0,o.jsx)("button",{type:"button",onClick:()=>r(a),className:`rounded-lg border px-3 py-1.5 text-xs font-medium transition-all ${q===a?`${b.style} ring-1 ring-current/20`:"border-border text-muted-foreground hover:bg-accent"}`,children:b.label},a)})})]}),L&&!K&&(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)(X.Label,{children:J("task.baseBranch")}),A?(0,o.jsx)("div",{className:"text-sm text-muted-foreground",children:J("task.branchLoading")}):x.length>0?(0,o.jsxs)(bi,{open:F,onOpenChange:G,children:[(0,o.jsxs)(bj,{className:"flex w-full items-center gap-2 rounded-md border border-input bg-background px-3 py-2 text-sm font-mono transition-colors hover:bg-accent focus:outline-none focus:ring-1 focus:ring-ring","data-testid":"branch-selector",children:[(0,o.jsx)(Y.GitBranch,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),(0,o.jsx)("span",{className:"flex-1 truncate text-left text-xs",children:D||J("task.branchNone")}),(0,o.jsx)(Z,{className:"h-3.5 w-3.5 shrink-0 opacity-50"})]}),(0,o.jsx)(bk,{className:"p-0",align:"start",children:(0,o.jsxs)(dD,{children:[(0,o.jsx)(dE,{placeholder:J("task.branchSearch")}),(0,o.jsxs)(dF,{children:[(0,o.jsx)(dG,{children:J("task.branchNone")}),(0,o.jsx)(dH,{children:x.map(a=>(0,o.jsxs)(dI,{value:a,onSelect:()=>{E(a),G(!1)},children:[(0,o.jsx)(Y.GitBranch,{className:"h-3 w-3 text-muted-foreground shrink-0 mr-2"}),(0,o.jsx)("span",{className:"flex-1 truncate font-mono",children:a}),a===D&&(0,o.jsx)(C.Check,{className:"h-3 w-3 text-primary shrink-0 ml-auto"})]},a))})]})]})})]}):(0,o.jsx)("div",{className:"text-sm text-muted-foreground",children:J("task.branchNone")}),(0,o.jsxs)("div",{className:"mt-3 flex items-center gap-2",children:[(0,o.jsx)(X.Label,{className:"text-xs text-muted-foreground",children:J("task.worktreeLabel")}),(0,o.jsx)("div",{className:"flex gap-1",children:[!0,!1].map(a=>(0,o.jsx)("button",{type:"button",onClick:()=>I(a),className:`rounded-md px-3 py-1 text-xs font-medium transition-colors ${H===a?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:text-foreground"}`,children:a?J("task.worktreeYes"):J("task.worktreeNo")},String(a)))})]})]}),h.length>0&&(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)(X.Label,{children:J("task.labels")}),(0,o.jsx)("div",{className:"flex flex-wrap gap-1.5",children:h.map(a=>{let b=u.includes(a.id);return(0,o.jsx)("button",{type:"button",onClick:()=>{w(c=>b?c.filter(b=>b!==a.id):[...c,a.id])},className:`rounded-full px-2.5 py-1 text-xs font-medium transition-all ${b?"ring-1 ring-current/30":"opacity-50 hover:opacity-80"}`,style:{backgroundColor:a.color+"20",color:a.color,borderColor:b?a.color+"40":"transparent",borderWidth:"1px"},children:a.name},a.id)})})]})]}),(0,o.jsxs)(Q.DialogFooter,{children:[(0,o.jsx)(z.Button,{variant:"outline",onClick:()=>b(!1),children:J("common.cancel")}),(0,o.jsx)(z.Button,{onClick:()=>{k.trim()&&(K&&d?d(f.id,{title:k,description:m,priority:q,labelIds:u,subPath:s.trim()||""}):c({title:k,description:m,priority:q,status:e,labelIds:u,...L&&H&&D?{baseBranch:D}:{},...s.trim()?{subPath:s.trim()}:{}}),l(""),n(""),r("MEDIUM"),t(""),w([]),y([]),E(""),I(!0),b(!1))},className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:K?J("common.save"):J("common.create")})]})]})})}var dO=a.i(354994),dP=a.i(506008),dQ=a.i(212765),dR=a.i(161604),dS=a.i(986379);let dT=(0,r.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 dU=a.i(467034),dV=a.i(109434),dW=a.i(938899),dX=a.i(145685),dY=a.i(760216),dZ=a.i(367848);let d$=(0,dJ.createServerReference)("4041fd6a243486060eb931237780ae3eeac30e101d",dJ.callServer,void 0,dJ.findSourceMapURL,"deleteProject"),d_=(0,dJ.createServerReference)("40105913bb5acaa20f5973651e9f371a844ed0bf80",dJ.callServer,void 0,dJ.findSourceMapURL,"getRecentLocalProjects"),d0=(0,dJ.createServerReference)("40aacb5874521e8e6e7a939bb37e9f74f72e20a8b8",dJ.callServer,void 0,dJ.findSourceMapURL,"getOrCreateTowerTaskId");var d1=a.i(264530),d2=a.i(942308),d3=a.i(563504),d4=a.i(845924),d5=a.i(929526);let d6=(0,r.default)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);function d7({commits:a}){let{t:b}=(0,v.useI18n)(),[c,d]=(0,p.useState)(!1);return 0===a.length?null:(0,o.jsxs)("div",{children:[(0,o.jsxs)("button",{onClick:()=>d(!c),className:"flex w-full items-center justify-between py-1",children:[(0,o.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:b("git.commitLog")}),c?(0,o.jsx)(dO.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,o.jsx)(dP.ChevronRight,{className:"h-3 w-3 text-muted-foreground"})]}),c&&(0,o.jsx)("div",{className:"mt-1.5 space-y-0.5 max-h-64 overflow-y-auto",children:a.map(a=>(0,o.jsxs)("div",{className:"group flex items-start gap-2 rounded-md px-2 py-1.5 hover:bg-accent transition-colors",children:[(0,o.jsx)(dT,{className:"h-3 w-3 shrink-0 text-muted-foreground mt-0.5"}),(0,o.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,o.jsx)("p",{className:"text-xs text-foreground line-clamp-1",children:a.message}),(0,o.jsxs)("div",{className:"flex items-center gap-2 mt-0.5",children:[(0,o.jsxs)("button",{onClick:()=>{navigator.clipboard.writeText(a.shortHash),d2.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,o.jsx)(d6,{className:"h-2.5 w-2.5 opacity-0 group-hover:opacity-100 transition-opacity"})]}),(0,o.jsx)("span",{className:"text-[10px] text-muted-foreground",children:a.author}),(0,o.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 d8=a.i(14180),d9=a.i(460143),ea=a.i(820838);function eb({localPath:a,stashes:b,hasChanges:c,onRefresh:d}){let{t:e}=(0,v.useI18n)(),[f,g]=(0,p.useState)(!1),[h,i]=(0,p.useState)(!1),[j,k]=(0,p.useState)(""),[l,m]=(0,p.useState)(null),n=async()=>{i(!0);try{await (0,ea.gitAction)(a,"stash-save",{message:j}),k(""),d2.toast.success(e("git.stashSaved")),await d()}catch(a){d2.toast.error(a instanceof Error?a.message:String(a))}finally{i(!1)}},q=async b=>{m(b);try{await (0,ea.gitAction)(a,"stash-pop",{index:b}),d2.toast.success(e("git.stashApplied")),await d()}catch(a){d2.toast.error(a instanceof Error?a.message:String(a))}finally{m(null)}},r=async b=>{m(b);try{await (0,ea.gitAction)(a,"stash-drop",{index:b}),d2.toast.success(e("git.stashDropped")),await d()}catch(a){d2.toast.error(a instanceof Error?a.message:String(a))}finally{m(null)}};return c||0!==b.length?(0,o.jsxs)("div",{children:[(0,o.jsxs)("button",{onClick:()=>g(!f),className:"flex w-full items-center justify-between py-1",children:[(0,o.jsxs)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:[e("git.stash")," ",b.length>0&&`(${b.length})`]}),f?(0,o.jsx)(dO.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,o.jsx)(dP.ChevronRight,{className:"h-3 w-3 text-muted-foreground"})]}),f&&(0,o.jsxs)("div",{className:"mt-1.5 space-y-2",children:[c&&(0,o.jsxs)("div",{className:"flex gap-1.5",children:[(0,o.jsx)(V.Input,{value:j,onChange:a=>k(a.target.value),placeholder:e("git.stashMsgPlaceholder"),className:"h-7 text-xs flex-1",onKeyDown:a=>"Enter"===a.key&&n()}),(0,o.jsx)(z.Button,{variant:"outline",size:"icon-sm",onClick:n,disabled:h,className:"shrink-0",children:h?(0,o.jsx)(dV.Loader2,{className:"h-3 w-3 animate-spin"}):(0,o.jsx)(d8.Archive,{className:"h-3 w-3"})})]}),b.length>0&&(0,o.jsx)("div",{className:"space-y-0.5",children:b.map(a=>(0,o.jsxs)("div",{className:"group flex items-center gap-2 rounded-md px-2 py-1.5 hover:bg-accent transition-colors",children:[(0,o.jsx)(d8.Archive,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),(0,o.jsx)("span",{className:"flex-1 min-w-0 truncate text-xs text-foreground",children:a.message||`stash@{${a.index}}`}),(0,o.jsxs)("div",{className:"flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,o.jsx)(z.Button,{variant:"ghost",size:"icon-xs",onClick:()=>q(a.index),disabled:l===a.index,className:"text-muted-foreground","aria-label":e("git.stashApply"),children:l===a.index?(0,o.jsx)(dV.Loader2,{className:"h-3 w-3 animate-spin"}):(0,o.jsx)(d9.ArrowUpFromLine,{className:"h-3 w-3"})}),(0,o.jsx)(z.Button,{variant:"ghost",size:"icon-xs",onClick:()=>r(a.index),disabled:l===a.index,className:"text-rose-400","aria-label":e("git.stashDrop"),children:(0,o.jsx)(L.Trash2,{className:"h-3 w-3"})})]})]},a.index))})]})]}):null}function ec({project:a,workspaceId:b}){let{t:c,locale:d}=(0,v.useI18n)(),e=(0,q.useRouter)(),[f,g]=(0,p.useState)(!0),[h,i]=(0,p.useState)(!0),[j,k]=(0,p.useState)(!1),[l,m]=(0,p.useState)(!1),[n,r]=(0,p.useState)(""),[s,t]=(0,p.useState)(!1),[u,w]=(0,p.useState)(!1),[x,y]=(0,p.useState)(!1),[A,B]=(0,p.useState)(a.name),[C,D]=(0,p.useState)(a.alias??""),[E,F]=(0,p.useState)(a.description??""),[G,H]=(0,p.useState)(a.localPath??""),[I,J]=(0,p.useState)(a.projectType??"FRONTEND"),[M,N]=(0,p.useState)([]);(0,p.useEffect)(()=>{d_(100).then(N)},[]);let[O,P]=(0,p.useState)(!1),[R,S]=(0,p.useState)(""),[T,U]=(0,p.useState)(""),[X,Z]=(0,p.useState)(""),[$,_]=(0,p.useState)(""),[aa,ab]=(0,p.useState)("FRONTEND"),[ac,ad]=(0,p.useState)(!1),[ae,af]=(0,p.useState)(!1),[ag,ah]=(0,p.useState)(null),[ai,aj]=(0,p.useState)(!1),[ak,al]=(0,p.useState)(!1),[am,an]=(0,p.useState)(!1),ao=a=>{d2.toast.info(a)},ap=(0,p.useCallback)(async()=>{if(a.localPath){aj(!0);try{let b=await fetch(`/api/git?path=${encodeURIComponent(a.localPath)}`);b.ok&&ah(await b.json())}catch{}finally{aj(!1)}}},[a.localPath]);(0,p.useEffect)(()=>{ap()},[ap]);let aq=async()=>{if(a.localPath){al(!0);try{(await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"init",path:a.localPath})})).ok?(ao(c("git.initSuccess")),await ap()):ao(c("git.initFailed"))}catch{ao(c("git.initFailed"))}finally{al(!1)}}},ar=async b=>{if(a.localPath)try{let d=await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"checkout",path:a.localPath,branch:b})});if(d.ok)ao(`${c("git.switchSuccess")} ${b}`),await ap();else{let a=await d.json();ao(`${c("git.switchFailed")}: ${a.error}`)}}catch{ao(c("git.switchFailed"))}},as=(a,b)=>{e.push(`/workspaces/${a}?projectId=${b}`,{scroll:!1}),e.refresh()},at=async()=>{if(T.trim()){ad(!0);try{let a=await (0,dZ.createProject)({name:T.trim(),alias:X.trim()||void 0,description:$.trim()||void 0,localPath:R,projectType:aa,workspaceId:b});P(!1),as(b,a.id)}catch(a){d2.toast.error(a instanceof Error?a.message:String(a))}finally{ad(!1)}}},au=async()=>{if(G&&!ae){af(!0);try{let a=await (0,d1.analyzeProjectDirectory)(G.trim(),d);F(a)}catch{d2.toast.error(c("project.analyzeError"))}finally{af(!1)}}},av=async()=>{try{await (0,dY.updateProject)(a.id,{name:A.trim(),alias:C.trim()||void 0,description:E.trim()||void 0,localPath:G.trim()||void 0,projectType:I}),e.refresh(),k(!1)}catch(a){d2.toast.error(a instanceof Error?a.message:String(a))}};return(0,o.jsxs)("aside",{className:"relative w-72 flex-shrink-0 overflow-y-auto border-l border-border bg-sidebar",children:[(0,o.jsxs)("div",{className:"border-b border-border p-4",children:[(0,o.jsxs)("div",{className:"flex items-start justify-between",children:[(0,o.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,o.jsx)("h2",{className:"text-base font-semibold text-foreground",children:a.name}),a.alias&&(0,o.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:a.alias})]}),(0,o.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,o.jsx)(z.Button,{variant:"ghost",size:"icon-sm",onClick:()=>{B(a.name),D(a.alias??""),F(a.description??""),H(a.localPath??""),k(!0)},className:"text-muted-foreground",children:(0,o.jsx)(K.Pencil,{className:"h-3.5 w-3.5"})}),(0,o.jsx)(z.Button,{variant:"ghost",size:"icon-sm",onClick:()=>{r(""),m(!0)},className:"text-muted-foreground hover:text-rose-400",children:(0,o.jsx)(L.Trash2,{className:"h-3.5 w-3.5"})})]})]}),a.description&&(0,o.jsx)("p",{className:"mt-2 text-sm text-secondary-foreground leading-relaxed line-clamp-4",children:a.description}),(0,o.jsx)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:(0,o.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,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Y.GitBranch,{className:"h-3 w-3"}),c("sidebar.right.gitType")]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(dR.FileText,{className:"h-3 w-3"}),c("sidebar.right.normalType")]})})}),a.localPath&&(0,o.jsxs)("div",{className:"mt-3 flex items-start gap-2 rounded-md bg-muted/50 px-2.5 py-2 text-xs",children:[(0,o.jsx)(dS.FolderOpen,{className:"mt-0.5 h-3 w-3 shrink-0 text-muted-foreground"}),(0,o.jsx)("span",{className:"break-all font-mono text-secondary-foreground",children:a.localPath})]}),a.gitUrl&&(0,o.jsxs)("div",{className:"mt-2 flex items-start gap-2 rounded-md bg-muted/50 px-2.5 py-2 text-xs",children:[(0,o.jsx)(dQ.Globe,{className:"mt-0.5 h-3 w-3 shrink-0 text-muted-foreground"}),(0,o.jsx)("span",{className:"break-all text-secondary-foreground",children:a.gitUrl})]}),a.localPath&&(0,o.jsxs)(z.Button,{variant:"outline",className:"mt-3 w-full h-8 gap-1.5 text-xs",disabled:u,onClick:async()=>{w(!0);try{let c=await d0(a.id);e.push(`/workspaces/${b}/tasks/${c}`)}catch{d2.toast.error(c("git.openStudioFailed"))}finally{w(!1)}},children:[u?(0,o.jsx)(dV.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):(0,o.jsx)(dS.FolderOpen,{className:"h-3.5 w-3.5"}),c("git.openStudio")]})]}),(0,o.jsxs)("div",{className:"border-b border-border p-4",children:[(0,o.jsxs)(z.Button,{variant:"ghost",onClick:()=>g(!f),className:"flex w-full cursor-pointer justify-between px-2 py-2",children:[(0,o.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:c("git.section")}),f?(0,o.jsx)(dO.ChevronDown,{className:"h-3.5 w-3.5 text-muted-foreground"}):(0,o.jsx)(dP.ChevronRight,{className:"h-3.5 w-3.5 text-muted-foreground"})]}),f&&(0,o.jsx)("div",{className:"mt-3",children:a.localPath?ai?(0,o.jsxs)("div",{className:"flex items-center justify-center py-4 text-muted-foreground",children:[(0,o.jsx)(dV.Loader2,{className:"h-4 w-4 animate-spin"}),(0,o.jsx)("span",{className:"ml-2 text-xs",children:c("git.loading")})]}):ag&&!ag.isGit?(0,o.jsxs)("div",{className:"rounded-lg border border-border bg-muted/50 p-3",children:[(0,o.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,o.jsx)(dU.AlertCircle,{className:"h-3.5 w-3.5"}),(0,o.jsx)("p",{className:"text-xs",children:c("git.notInitialized")})]}),(0,o.jsxs)(z.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:aq,disabled:ak,children:[ak?(0,o.jsx)(dV.Loader2,{className:"h-3 w-3 animate-spin"}):(0,o.jsx)(dT,{className:"h-3 w-3"}),c("git.initRepo")]})]}):ag?.isGit?(0,o.jsxs)("div",{className:"space-y-3",children:[(0,o.jsx)(ed,{localBranches:ag.branches??[],remoteBranches:(ag.remoteBranches??[]).filter(a=>!ag.branches?.includes(a)),currentBranch:ag.currentBranch??"",onSwitch:ar,onFetch:async()=>{a.localPath&&(await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"fetch",path:a.localPath})}),await ap())},onCreateBranch:()=>an(!0)}),(0,o.jsx)(d7,{commits:ag.commits??[]}),(0,o.jsx)(eb,{localPath:a.localPath,stashes:ag.stashes??[],hasChanges:(ag.changedFiles??[]).length>0,onRefresh:ap})]}):null:(0,o.jsx)("div",{className:"rounded-lg border border-border bg-muted/50 p-3",children:(0,o.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,o.jsx)(dU.AlertCircle,{className:"h-3.5 w-3.5"}),(0,o.jsx)("p",{className:"text-xs",children:c("git.noLocalPath")})]})})})]}),(0,o.jsxs)("div",{className:"p-4",children:[(0,o.jsxs)(z.Button,{variant:"ghost",onClick:()=>i(!h),className:"flex w-full cursor-pointer justify-between px-2 py-2",children:[(0,o.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:c("sidebar.right.browseRepo")}),h?(0,o.jsx)(dO.ChevronDown,{className:"h-3.5 w-3.5 text-muted-foreground"}):(0,o.jsx)(dP.ChevronRight,{className:"h-3.5 w-3.5 text-muted-foreground"})]}),h&&(0,o.jsxs)("div",{className:"mt-3 space-y-3",children:[(0,o.jsxs)(z.Button,{variant:"outline",className:"w-full h-8 gap-1.5 text-xs",onClick:()=>y(!0),children:[(0,o.jsx)(dS.FolderOpen,{className:"h-3.5 w-3.5"}),c("sidebar.right.browseRepo")]}),M.length>0&&(0,o.jsxs)("div",{children:[(0,o.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground mb-1.5 px-1",children:c("sidebar.right.recent")}),(0,o.jsx)("div",{className:"space-y-0.5",children:M.map(b=>(0,o.jsxs)("button",{onClick:()=>{b.id!==a.id&&as(b.workspaceId,b.id)},className:`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left transition-colors ${b.id===a.id?"bg-primary/10 text-primary cursor-default":"hover:bg-accent cursor-pointer"}`,children:["GIT"===b.type?(0,o.jsx)(Y.GitBranch,{className:"h-3 w-3 shrink-0 text-emerald-400"}):(0,o.jsx)(dS.FolderOpen,{className:"h-3 w-3 shrink-0 text-primary/70"}),(0,o.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,o.jsx)("p",{className:"truncate text-xs font-medium text-foreground",children:b.name}),b.localPath&&(0,o.jsx)("p",{className:"truncate text-[10px] font-mono text-muted-foreground",children:b.localPath})]})]},b.id))})]})]})]}),(0,o.jsx)(Q.Dialog,{open:j,onOpenChange:k,children:(0,o.jsxs)(Q.DialogContent,{style:{maxWidth:"32rem"},children:[(0,o.jsx)(Q.DialogHeader,{children:(0,o.jsx)(Q.DialogTitle,{children:c("project.edit")})}),(0,o.jsxs)("div",{className:"space-y-3 py-2",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:c("project.name")}),(0,o.jsx)(V.Input,{value:A,onChange:a=>B(a.target.value),className:"mt-1.5"})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:c("project.type.label")}),(0,o.jsx)("div",{className:"mt-1.5",children:(0,o.jsx)(d4.SegmentedControl,{options:[{value:"FRONTEND",label:c("project.type.frontend")},{value:"BACKEND",label:c("project.type.backend")}],value:I,onChange:J})})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:c("project.alias")}),(0,o.jsx)(V.Input,{value:C,onChange:a=>D(a.target.value),className:"mt-1.5"})]}),(0,o.jsxs)("div",{children:[(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:c("project.description")}),(0,o.jsxs)(z.Button,{type:"button",variant:"ghost",onClick:au,className:`h-6 gap-1 px-2 text-[11px] text-muted-foreground hover:text-foreground ${!G||ae?"opacity-50":""}`,children:[ae?(0,o.jsx)(dV.Loader2,{className:"h-3 w-3 animate-spin"}):(0,o.jsx)(dW.Sparkles,{className:"h-3 w-3"}),ae?c("project.analyzing"):c("project.genDesc")]})]}),(0,o.jsx)(W.Textarea,{value:E,onChange:a=>F(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,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:c("project.localPath")}),(0,o.jsxs)("div",{className:"mt-1.5 flex gap-2",children:[(0,o.jsx)(V.Input,{value:G,onChange:a=>H(a.target.value),placeholder:c("project.localPathPlaceholder"),className:"flex-1 font-mono text-xs"}),(0,o.jsx)(z.Button,{variant:"outline",onClick:()=>y(!0),className:"h-8 shrink-0",children:c("folder.browse")})]})]})]}),(0,o.jsxs)(Q.DialogFooter,{children:[(0,o.jsx)(z.Button,{variant:"outline",onClick:()=>k(!1),children:c("common.cancel")}),(0,o.jsx)(z.Button,{onClick:av,disabled:!A.trim()||ae,className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:c("common.save")})]})]})}),(0,o.jsx)(d3.FolderBrowserDialog,{open:x,onOpenChange:y,onSelect:a=>{j?H(a):(a=>{let b=M.find(b=>b.localPath===a);if(b)return as(b.workspaceId,b.id);let c=a.split("/").filter(Boolean).pop()??"";S(a),U(c),Z(""),_(""),P(!0)})(a)}}),(0,o.jsx)(Q.Dialog,{open:O,onOpenChange:P,children:(0,o.jsxs)(Q.DialogContent,{className:"sm:max-w-md",children:[(0,o.jsx)(Q.DialogHeader,{children:(0,o.jsx)(Q.DialogTitle,{children:c("topbar.newProject")})}),(0,o.jsxs)("div",{className:"space-y-3 py-2",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:c("project.localPath")}),(0,o.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:R})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:c("project.name")}),(0,o.jsx)(V.Input,{value:T,onChange:a=>U(a.target.value),placeholder:c("project.namePlaceholder"),className:"mt-1.5"})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:c("project.type.label")}),(0,o.jsx)("div",{className:"mt-1.5",children:(0,o.jsx)(d4.SegmentedControl,{options:[{value:"FRONTEND",label:c("project.type.frontend")},{value:"BACKEND",label:c("project.type.backend")}],value:aa,onChange:ab})})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:c("project.alias")}),(0,o.jsx)(V.Input,{value:X,onChange:a=>Z(a.target.value),placeholder:c("project.aliasPlaceholder"),className:"mt-1.5"})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:c("project.description")}),(0,o.jsx)(W.Textarea,{value:$,onChange:a=>_(a.target.value),placeholder:c("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,o.jsxs)(Q.DialogFooter,{children:[(0,o.jsx)(z.Button,{variant:"outline",onClick:()=>P(!1),children:c("common.cancel")}),(0,o.jsxs)(z.Button,{onClick:at,disabled:!T.trim()||ac,className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:[ac?(0,o.jsx)(dV.Loader2,{className:"h-3 w-3 animate-spin mr-1"}):null,c("common.create")]})]})]})}),ag?.isGit&&(0,o.jsx)(d5.CreateBranchDialog,{open:am,onOpenChange:an,branches:ag.branches??[],currentBranch:ag.currentBranch??"",localPath:a.localPath,onCreated:async()=>{await ap(),ao(c("git.createSuccess"))},onError:a=>ao(`${c("git.createFailed")}: ${a}`)}),(0,o.jsx)(Q.Dialog,{open:l,onOpenChange:a=>{m(a),a||r("")},children:(0,o.jsxs)(Q.DialogContent,{className:"sm:max-w-md",children:[(0,o.jsx)(Q.DialogHeader,{children:(0,o.jsx)(Q.DialogTitle,{className:"text-rose-400",children:c("project.deleteTitle")})}),(0,o.jsxs)("div",{className:"space-y-3 py-2",children:[(0,o.jsx)("p",{className:"text-sm text-muted-foreground",children:c("project.deleteWarning",{name:a.name})}),(0,o.jsx)("p",{className:"text-sm text-muted-foreground",children:c("project.deleteIrreversible")}),(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:c("project.deleteConfirmLabel")}),(0,o.jsx)(V.Input,{value:n,onChange:a=>r(a.target.value),placeholder:c("project.deleteConfirmPlaceholder"),className:"mt-1.5",autoFocus:!0})]})]}),(0,o.jsxs)(Q.DialogFooter,{children:[(0,o.jsx)(z.Button,{variant:"outline",onClick:()=>m(!1),children:c("common.cancel")}),(0,o.jsxs)(z.Button,{variant:"destructive",disabled:n!==c("project.deleteConfirmText")||s,onClick:async()=>{t(!0);try{await d$(a.id),d2.toast.success(c("project.deleteSuccess")),e.push(`/workspaces/${b}`)}catch{d2.toast.error(c("project.deleteFailed"))}finally{t(!1),m(!1)}},children:[s&&(0,o.jsx)(dV.Loader2,{className:"h-3 w-3 animate-spin mr-1"}),c("project.deleteButton")]})]})]})})]})}function ed({localBranches:a,remoteBranches:b,currentBranch:c,onSwitch:d,onFetch:e,onCreateBranch:f}){let{t:g}=(0,v.useI18n)(),[h,i]=(0,p.useState)(!1),[j,k]=(0,p.useState)(""),[l,m]=(0,p.useState)(!1),n=(0,p.useRef)(null);(0,p.useEffect)(()=>{if(h)return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a);function a(a){n.current&&!n.current.contains(a.target)&&i(!1)}},[h]);let q=j.toLowerCase(),r=a.filter(a=>a.toLowerCase().includes(q)),s=b.filter(a=>a.toLowerCase().includes(q)),t=r.length>0||s.length>0,u=async()=>{m(!0);try{await e()}finally{m(!1)}};return(0,o.jsxs)("div",{children:[(0,o.jsxs)("div",{className:"flex items-center justify-between mb-1.5",children:[(0,o.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:g("git.currentBranch")}),(0,o.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,o.jsx)(z.Button,{variant:"ghost",size:"icon-xs",onClick:u,disabled:l,className:"text-muted-foreground","aria-label":"Fetch",children:(0,o.jsx)(dX.RefreshCw,{className:`h-3 w-3 ${l?"animate-spin":""}`})}),(0,o.jsx)(z.Button,{variant:"ghost",size:"icon-xs",onClick:f,className:"text-muted-foreground","aria-label":g("git.createBranch"),children:(0,o.jsx)(x.Plus,{className:"h-3 w-3"})})]})]}),(0,o.jsxs)("div",{className:"relative",ref:n,children:[(0,o.jsxs)("button",{onClick:()=>{i(!h),k("")},className:"flex w-full items-center justify-between rounded-lg border border-border bg-muted/50 px-3 py-2 text-left transition-colors hover:bg-accent",children:[(0,o.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,o.jsx)(Y.GitBranch,{className:"h-3 w-3 shrink-0 text-emerald-400"}),(0,o.jsx)("span",{className:"truncate font-mono text-xs text-foreground",children:c||"—"})]}),(0,o.jsx)(dO.ChevronDown,{className:`h-3 w-3 shrink-0 text-muted-foreground transition-transform ${h?"rotate-180":""}`})]}),h&&(0,o.jsxs)("div",{className:"absolute left-0 right-0 top-full z-20 mt-1 rounded-lg border border-border bg-popover shadow-xl",children:[(0,o.jsx)("div",{className:"border-b border-border p-1.5",children:(0,o.jsxs)("div",{className:"relative",children:[(0,o.jsx)(y.Search,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3 w-3 text-muted-foreground"}),(0,o.jsx)("input",{value:j,onChange:a=>k(a.target.value),placeholder:"Filter...",autoFocus:!0,className:"h-7 w-full rounded-md bg-muted/50 pl-7 pr-2 text-xs text-foreground placeholder-muted-foreground outline-none focus:ring-1 focus:ring-ring"})]})}),(0,o.jsxs)("div",{className:"max-h-60 overflow-auto py-1",children:[!t&&(0,o.jsx)("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No branches found"}),r.length>0&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("p",{className:"px-3 pt-1.5 pb-1 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:g("git.localBranches")}),r.map(a=>{let b=a===c;return(0,o.jsxs)("button",{onClick:()=>{b||d(a),i(!1)},className:`flex w-full items-center gap-2 px-3 py-1.5 text-left transition-colors ${b?"bg-emerald-500/10 text-emerald-400":"text-secondary-foreground hover:bg-accent"}`,children:[(0,o.jsx)(Y.GitBranch,{className:"h-3 w-3 shrink-0"}),(0,o.jsx)("span",{className:"truncate font-mono text-xs",children:a}),b&&(0,o.jsx)(C.Check,{className:"h-3 w-3 ml-auto shrink-0"})]},`local-${a}`)})]}),s.length>0&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("p",{className:"px-3 pt-2.5 pb-1 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:g("git.remoteBranches")}),s.map(a=>(0,o.jsxs)("button",{onClick:()=>{d(a),i(!1)},className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-secondary-foreground transition-colors hover:bg-accent",children:[(0,o.jsx)(dQ.Globe,{className:"h-3 w-3 shrink-0 text-sky-400"}),(0,o.jsx)("span",{className:"truncate font-mono text-xs",children:a})]},`remote-${a}`))]})]})]})]})]})}let ee=(0,r.default)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);var ef=a.i(236413),eg=a.i(105916),eh=a.i(57726),ei=a.i(224372),ej=a.i(95446),ek=a.i(59711);function el({title:a,description:b,branch:c,baseBranch:d,hasConversation:e,updatedAt:f,onBack:g}){let{t:h}=(0,v.useI18n)();return(0,o.jsxs)("div",{className:"border-b border-border px-4 py-3",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsxs)("div",{className:"flex items-center gap-2",children:[(0,o.jsx)(dW.Sparkles,{className:"h-3.5 w-3.5 text-primary"}),(0,o.jsx)("span",{className:"text-xs font-semibold text-primary",children:h("taskDetail.title")})]}),(0,o.jsxs)(z.Button,{variant:"ghost",onClick:g,className:"flex items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground h-auto px-2 py-1",children:[(0,o.jsx)(ek.ArrowLeft,{className:"h-3.5 w-3.5"}),h("taskDetail.back")]})]}),(0,o.jsx)("h2",{className:"mt-2.5 text-lg font-bold tracking-tight text-foreground",children:a}),b&&(0,o.jsx)("p",{className:"mt-1 text-xs text-muted-foreground line-clamp-2",children:b}),(0,o.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[d?(0,o.jsxs)(N.Badge,{variant:"secondary",className:"bg-muted text-muted-foreground text-[10px] font-mono border border-border",children:[(0,o.jsx)(Y.GitBranch,{className:"mr-1 h-3 w-3"}),d," · worktree"]}):c?(0,o.jsx)(N.Badge,{variant:"secondary",className:"bg-muted text-muted-foreground text-[10px] font-mono border border-border",children:h("taskDetail.directMode")}):null,e&&(0,o.jsx)(N.Badge,{variant:"secondary",className:"bg-emerald-500/10 text-emerald-400 text-[10px] border border-emerald-500/20",children:h("taskDetail.hasConversation")}),(0,o.jsxs)("span",{className:"text-[11px] text-muted-foreground",children:[h("taskDetail.updatedAt")," ",(0,bh.formatRelativeTime)(f)]})]})]})}var em=a.i(641804),en=a.i(569720),eo=a.i(184083),ep=a.i(955154),eq=a.i(421113),er=a.i(499280),es=a.i(299638),et=a.i(676956),eu=a.i(63713),ev=a.i(790315),ew=a.i(271424),ex=a.i(535606),ey=a.i(884284),ez=a.i(208168);let eA=(0,r.default)("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]);var eB=a.i(54709),eC=a.i(674775);let eD=(0,dJ.createServerReference)("40f3201587849ea3cbadf6e659f4c878e17b615f87",dJ.callServer,void 0,dJ.findSourceMapURL,"getTaskNotes");var eE=a.i(22032);let eF=(0,dJ.createServerReference)("403bdae23725e2984e65c282e1ce2932a7611cd7b0",dJ.callServer,void 0,dJ.findSourceMapURL,"getTaskAssets");var eG=a.i(940623),eH=a.i(113778);function eI({taskId:a,projectId:b}){let{t:c}=(0,v.useI18n)(),d=(0,p.useRef)(null),[e,f]=(0,p.useState)([]),[g,h]=(0,p.useState)([]),[i,j]=(0,p.useState)(!1),[k,l]=(0,p.useState)(""),[m,n]=(0,p.useState)(""),[q,r]=(0,p.useState)(!1);async function s(){k.trim()&&(await (0,eC.createNote)({title:k.trim(),content:m.trim(),projectId:b,taskId:a,category:"task"}),l(""),n(""),j(!1),eD(a).then(f))}async function t(a){await (0,eE.deleteNote)(a),f(b=>b.filter(b=>b.id!==a))}async function u(c){let e=c.target.files?.[0];if(e){r(!0);try{let c=new FormData;c.set("file",e),c.set("projectId",b),c.set("taskId",a),await (0,eG.uploadAsset)(c),eF(a).then(h)}finally{r(!1),d.current&&(d.current.value="")}}}async function w(a){await (0,eH.deleteAsset)(a),h(b=>b.filter(b=>b.id!==a))}return(0,p.useEffect)(()=>{eD(a).then(f),eF(a).then(h)},[a]),(0,o.jsx)(R.ScrollArea,{className:"h-full",children:(0,o.jsxs)("div",{className:"flex flex-col",children:[(0,o.jsxs)("div",{className:"border-b border-border px-4 py-3",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsxs)("h3",{className:"flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:[(0,o.jsx)(dR.FileText,{className:"h-3.5 w-3.5"}),c("taskPage.notes")]}),(0,o.jsxs)(z.Button,{variant:"ghost",className:"h-6 gap-1 px-2 text-xs",onClick:()=>j(!i),children:[i?(0,o.jsx)(eB.X,{className:"h-3 w-3"}):(0,o.jsx)(x.Plus,{className:"h-3 w-3"}),i?"":c("taskPage.addNote")]})]}),i&&(0,o.jsxs)("div",{className:"mt-3 space-y-2",children:[(0,o.jsx)("input",{type:"text",value:k,onChange:a=>l(a.target.value),placeholder:c("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,o.jsx)("textarea",{value:m,onChange:a=>n(a.target.value),placeholder:c("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,o.jsx)(z.Button,{className:"text-xs",onClick:s,disabled:!k.trim(),children:c("taskPage.addNote")})]}),(0,o.jsxs)("div",{className:"mt-2 space-y-2",children:[0===e.length&&!i&&(0,o.jsx)("p",{className:"text-xs text-muted-foreground py-2",children:c("taskPage.noNotes")}),e.map(a=>(0,o.jsx)("div",{className:"group rounded-md border border-border bg-card p-3",children:(0,o.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,o.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,o.jsx)("h4",{className:"text-sm font-medium truncate",children:a.title}),a.content&&(0,o.jsx)("p",{className:"mt-1 text-xs text-muted-foreground line-clamp-3 whitespace-pre-wrap",children:a.content}),(0,o.jsx)("p",{className:"mt-1 text-[10px] text-muted-foreground",children:new Date(a.createdAt).toLocaleString()})]}),(0,o.jsx)(z.Button,{variant:"ghost",size:"icon-xs",onClick:()=>t(a.id),className:"shrink-0 text-muted-foreground opacity-0 hover:bg-destructive/10 hover:text-destructive group-hover:opacity-100",title:c("taskPage.deleteNote"),children:(0,o.jsx)(L.Trash2,{className:"h-3.5 w-3.5"})})]})},a.id))]})]}),(0,o.jsxs)("div",{className:"px-4 py-3",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsxs)("h3",{className:"flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:[(0,o.jsx)(eA,{className:"h-3.5 w-3.5"}),c("taskPage.attachments")]}),(0,o.jsxs)(z.Button,{variant:"ghost",className:"h-6 gap-1 px-2 text-xs",onClick:()=>d.current?.click(),disabled:q,children:[(0,o.jsx)(ez.Upload,{className:"h-3 w-3"}),c("taskPage.uploadFile")]}),(0,o.jsx)("input",{ref:d,type:"file",className:"hidden",onChange:u})]}),(0,o.jsxs)("div",{className:"mt-2 space-y-1.5",children:[0===g.length&&(0,o.jsx)("p",{className:"text-xs text-muted-foreground py-2",children:c("taskPage.noAttachments")}),g.map(a=>{var b;return(0,o.jsxs)("div",{className:"group flex items-center gap-2 rounded-md border border-border bg-card px-3 py-2",children:[(0,o.jsx)(eA,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),(0,o.jsx)("span",{className:"flex-1 truncate text-sm",children:a.filename}),(0,o.jsx)("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:(b=a.size)?b<1024?`${b} B`:b<1048576?`${(b/1024).toFixed(1)} KB`:`${(b/1024/1024).toFixed(1)} MB`:""}),(0,o.jsx)(z.Button,{variant:"ghost",size:"icon-xs",onClick:()=>w(a.id),className:"shrink-0 text-muted-foreground opacity-0 hover:bg-destructive/10 hover:text-destructive group-hover:opacity-100",title:c("taskPage.deleteAttachment"),children:(0,o.jsx)(L.Trash2,{className:"h-3 w-3"})})]},a.id)})]})]})]})})}function eJ({task:a,workspaceId:b,projectLocalPath:c,onClose:d}){let{t:e}=(0,v.useI18n)(),f=(0,q.useRouter)(),{removePortal:g}=(0,eo.useTerminalPortal)(),[h,i]=(0,p.useState)("terminal"),[j,k]=(0,p.useState)(null),[l,m]=(0,p.useState)(!1),[n,r]=(0,p.useState)(a.status);(0,p.useEffect)(()=>{r(a.status)},[a.status]);let[s,t]=(0,p.useState)(null),[u,w]=(0,p.useState)(!1),[x,y]=(0,p.useState)(!1),[A,B]=(0,p.useState)([]);(0,p.useEffect)(()=>{t(null),w(!1),y(!1),B([]),k(null),i("terminal")},[a.id]);let[C,D]=(0,p.useState)([]),[E,F]=(0,p.useState)(null);(0,p.useEffect)(()=>{let a=!1;return(0,ex.getPrompts)().then(b=>{if(a)return;D(b.map(a=>({id:a.id,name:a.name,isDefault:a.isDefault})));let c=b.find(a=>a.isDefault);c&&F(c.id)}),()=>{a=!0}},[]),(0,p.useEffect)(()=>{t(null),y(!1);let b=!1;return(0,ep.getTaskExecutions)(a.id).then(a=>{if(b)return;let d=a[0];if(d?.status==="RUNNING"){let a=d.worktreePath||c||null;a&&t(a)}B(a.filter(a=>"RUNNING"!==a.status)),y(!0)}),()=>{b=!0}},[a.id]),(0,p.useEffect)(()=>{if("changes"!==h||"TODO"===n||"CANCELLED"===n)return;let b=!1;return m(!0),fetch(`/api/tasks/${a.id}/diff`).then(a=>{if(!a.ok)throw Error(`HTTP ${a.status}`);return a.json()}).then(a=>{b||k(a?.files||a?.branchDeleted?a:null)}).catch(()=>{b||k(null)}).finally(()=>{b||m(!1)}),()=>{b=!0}},[h,n,a.id]);let G=(0,p.useCallback)(async()=>{if(!u){w(!0);try{let{worktreePath:b}=await (0,eq.startPtyExecution)(a.id,"",E);t(b),r("IN_PROGRESS")}catch(a){w(!1),d2.toast.error(a instanceof Error?a.message:String(a))}}},[a.id,u,E]),H=(0,p.useCallback)(b=>{w(!1),t(null),g(a.id),0===b&&r("IN_REVIEW"),(0,ep.getTaskExecutions)(a.id).then(a=>{B(a.filter(a=>"RUNNING"!==a.status))}),f.refresh()},[f,a.id]),I=(0,p.useCallback)(async()=>{await (0,er.stopPtyExecution)(a.id),w(!1),t(null),r("IN_REVIEW"),(0,ep.getTaskExecutions)(a.id).then(a=>{B(a.filter(a=>"RUNNING"!==a.status))}),f.refresh()},[a.id,f]),J=(0,p.useCallback)(async b=>{w(!0),g(a.id),t(null);try{let{worktreePath:c}=await (0,es.resumePtyExecution)(a.id,b);t(c),r("IN_PROGRESS")}catch{w(!1)}},[a.id,g]),K=(0,p.useCallback)(async()=>{w(!0),g(a.id),t(null);try{let{worktreePath:b}=await (0,et.continueLatestPtyExecution)(a.id);t(b),r("IN_PROGRESS")}catch(a){w(!1),d2.toast.error(a instanceof Error?a.message:String(a))}},[a.id,g]),[L,M]=(0,p.useState)(!1),[N,O]=(0,p.useState)([]),P=(0,p.useCallback)(async()=>{try{let b=await (0,ev.checkWorktreeClean)(a.id);if(b.hasWorktree&&!b.clean)return void d2.toast.error(e("taskPage.uncommittedChanges",{count:String(b.files.length)}));if(b.hasWorktree&&b.clean&&!b.hasCommits)return void d2.toast.error(e("taskPage.noChangesToComplete"));if(b.hasWorktree&&b.hasCommits){O(b.commitLog),M(!0);return}await (0,eu.updateTaskStatus)(a.id,"DONE"),r("DONE"),d2.toast.success(e("taskPage.taskCompleted")),f.refresh()}catch{d2.toast.error("Failed to complete task")}},[a.id,f,e]),Q=(0,p.useCallback)(()=>{r("DONE"),M(!1),d2.toast.success(e("taskPage.taskCompleted")),f.refresh()},[f,e]),S=(0,p.useCallback)(async b=>{try{let{hash:c}=await (0,ew.commitWorktreeChanges)(a.id,b);d2.toast.success(e("diff.commitSuccess",{hash:c})),f.refresh();let d=await fetch(`/api/tasks/${a.id}/diff`);if(d.ok){let a=await d.json();k(a?.files?a:null)}}catch(a){d2.toast.error(a instanceof Error?a.message:"Commit failed")}},[a.id,f,e]);return(0,o.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,o.jsx)(el,{title:a.title,description:e("taskDetail.panelDescription"),branch:`task/${a.id}`,baseBranch:a.baseBranch,hasConversation:!1,updatedAt:a.updatedAt,onBack:d}),(0,o.jsxs)("div",{className:"flex items-center justify-between border-b border-border px-4 py-2",children:[(0,o.jsxs)("div",{className:"flex gap-1",children:[(0,o.jsxs)("button",{onClick:()=>i("terminal"),className:`flex items-center gap-1.5 px-3 py-1 text-xs font-medium rounded-md ${"terminal"===h?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,o.jsx)(ef.Terminal,{className:"h-3 w-3"}),e("terminal.execute")]}),(0,o.jsx)("button",{onClick:()=>i("changes"),className:`px-3 py-1 text-xs font-medium rounded-md ${"changes"===h?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:e("taskPage.changes")}),(0,o.jsxs)("button",{onClick:()=>i("notes"),className:`flex items-center gap-1.5 px-3 py-1 text-xs font-medium rounded-md ${"notes"===h?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,o.jsx)(dR.FileText,{className:"h-3 w-3"}),e("taskPage.notes")]})]}),(0,o.jsxs)("div",{className:"flex items-center gap-2",children:["IN_REVIEW"===n&&(0,o.jsxs)(z.Button,{size:"sm",onClick:P,className:"bg-emerald-500/15 text-emerald-400 ring-1 ring-emerald-500/20 hover:bg-emerald-500/25",children:[(0,o.jsx)(eh.CheckCircle2,{className:"h-3 w-3"}),e("taskPage.completeTask")]}),"DONE"!==n&&"CANCELLED"!==n&&(0,o.jsxs)(z.Button,{variant:"ghost",size:"sm",onClick:()=>f.push(`/workspaces/${b}/tasks/${a.id}`),className:"text-muted-foreground",children:[(0,o.jsx)(ee,{className:"h-3 w-3"}),e("taskPage.viewDetails")]})]})]}),"terminal"===h?(0,o.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:x?s?(0,o.jsxs)("div",{className:"flex h-full flex-col overflow-hidden",children:[(0,o.jsxs)("div",{className:"shrink-0 flex items-center justify-between border-b border-neutral-800 px-3 py-2 bg-[#0f1419]",children:[(0,o.jsxs)("span",{className:"flex items-center gap-1.5 text-xs text-emerald-400",children:[(0,o.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"}),e("execution.running")]}),(0,o.jsxs)(ej.Tooltip,{children:[(0,o.jsxs)(ej.TooltipTrigger,{onClick:I,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,o.jsx)(eg.Square,{className:"h-3 w-3"}),e("terminal.stopExecution")]}),(0,o.jsx)(ej.TooltipContent,{side:"bottom",children:e("terminal.stopHint")})]})]}),(0,o.jsx)("div",{className:"flex-1 min-h-0",children:(0,o.jsx)(eo.TerminalOutlet,{taskId:a.id,worktreePath:s,onSessionEnd:H})})]}):"DONE"===n||"CANCELLED"===n?(0,o.jsx)("div",{className:"flex h-full flex-col overflow-hidden",children:(0,o.jsx)(R.ScrollArea,{className:"flex-1 min-h-0",children:(0,o.jsx)(ey.ExecutionTimeline,{executions:A})})}):(0,o.jsxs)("div",{className:"flex h-full flex-col overflow-hidden",children:[(0,o.jsxs)("div",{className:"shrink-0 flex items-center gap-2 border-b border-border px-4 py-3",children:[C.length>0&&(0,o.jsxs)(ei.Select,{defaultValue:E??"none",onValueChange:a=>F("none"===a?null:a),children:[(0,o.jsx)(ei.SelectTrigger,{size:"sm",className:"min-w-[120px]",children:(0,o.jsx)("span",{className:"text-left truncate",children:E?C.find(a=>a.id===E)?.name??e("terminal.noPrompt"):e("terminal.noPrompt")})}),(0,o.jsxs)(ei.SelectContent,{className:"min-w-[200px]",children:[(0,o.jsx)(ei.SelectItem,{value:"none",children:e("terminal.noPrompt")}),C.map(a=>(0,o.jsxs)(ei.SelectItem,{value:a.id,children:[a.name,a.isDefault?" ★":""]},a.id))]})]},`prompt-${C.length}`),(0,o.jsxs)(z.Button,{onClick:G,disabled:u,size:"sm",className:"gap-2 px-4",children:[u?(0,o.jsx)(dV.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):(0,o.jsx)(ef.Terminal,{className:"h-3.5 w-3.5"}),u?e("terminal.executing"):e("terminal.launch")]})]}),(0,o.jsx)(R.ScrollArea,{className:"flex-1 min-h-0",children:(0,o.jsx)(ey.ExecutionTimeline,{executions:A,onResume:J,onContinueLatest:K})})]}):(0,o.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-2 bg-[#0f1419]",children:[(0,o.jsx)(dV.Loader2,{className:"size-5 animate-spin text-neutral-500"}),(0,o.jsx)("span",{className:"text-xs text-neutral-500",children:e("execution.loading")})]})}):"changes"===h?(0,o.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:l?(0,o.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,o.jsx)("p",{className:"text-sm text-muted-foreground",children:e("taskPage.loadingDiff")})}):j?.branchDeleted?(0,o.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,o.jsx)("p",{className:"text-sm text-muted-foreground",children:e("taskPage.branchDeleted")})}):j?(0,o.jsx)(em.TaskDiffView,{files:j.files,totalAdded:j.totalAdded,totalRemoved:j.totalRemoved,hasConflicts:j.hasConflicts,conflictFiles:j.conflictFiles,onCommit:S,hasUncommitted:j.hasUncommitted}):(0,o.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,o.jsx)("p",{className:"text-sm text-muted-foreground",children:e("taskPage.noChanges")})})}):"notes"===h?(0,o.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:(0,o.jsx)(eI,{taskId:a.id,projectId:a.projectId})}):null,(0,o.jsx)(en.TaskMergeConfirmDialog,{open:L,onOpenChange:M,taskId:a.id,taskTitle:a.title,baseBranch:a.baseBranch??"main",fileCount:j?.files?.length??0,commitCount:j?.commitCount??0,commitLog:N,onMergeComplete:Q})]})}let eK=(0,dJ.createServerReference)("4054138fc41b122bd1ed800c6f1eac9534bef223c8",dJ.callServer,void 0,dJ.findSourceMapURL,"createTask"),eL=(0,dJ.createServerReference)("6054c2461447b80b81a8919d07204182565401aa75",dJ.callServer,void 0,dJ.findSourceMapURL,"updateTask"),eM=(0,dJ.createServerReference)("4098d493db5337c6626a8fb7b62ba3db92fd6aee92",dJ.callServer,void 0,dJ.findSourceMapURL,"deleteTask"),eN=(0,dJ.createServerReference)("4092a979dbd48b2897259dfbd4283c8d707dc12413",dJ.callServer,void 0,dJ.findSourceMapURL,"toggleTaskPinned");var eO=a.i(769726);function eP({projects:a,activeProjectId:b,onSelect:c}){let d=(0,p.useRef)(null),[e,f]=(0,p.useState)(!1),[g,h]=(0,p.useState)(!1),i=()=>{let a=d.current;a&&(f(a.scrollLeft>0),h(a.scrollLeft<a.scrollWidth-a.clientWidth-1))};(0,p.useEffect)(()=>{i();let a=d.current;if(a){a.addEventListener("scroll",i);let b=new ResizeObserver(i);return b.observe(a),()=>{a.removeEventListener("scroll",i),b.disconnect()}}},[a]);let j=a=>{let b=d.current;b&&b.scrollBy({left:"left"===a?-150:150,behavior:"smooth"})};return(0,o.jsxs)("div",{className:"relative flex items-center",children:[e&&(0,o.jsx)("button",{onClick:()=>j("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,o.jsx)(eO.ChevronLeft,{className:"h-4 w-4"})}),(0,o.jsx)("div",{ref:d,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=>{let d=b===a.id;return(0,o.jsxs)("button",{onClick:()=>{d||c(a.id)},className:`shrink-0 rounded-lg border-b-2 px-4 py-2 text-sm font-medium transition-colors ${d?"border-primary bg-primary/10 text-primary ring-1 ring-primary/20 cursor-default":"border-transparent text-muted-foreground hover:bg-accent hover:text-foreground cursor-pointer"}`,children:[(0,o.jsx)("span",{children:a.name}),a.alias&&(0,o.jsx)("span",{className:"ml-1.5 text-xs text-muted-foreground font-normal",children:a.alias})]},a.id)})}),g&&(0,o.jsx)("button",{onClick:()=>j("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,o.jsx)(dP.ChevronRight,{className:"h-4 w-4"})})]})}a.s(["BoardPageClient",0,function({workspaceId:a,projectId:b,project:c,projects:d,initialTasks:e,labels:f,openTaskId:g}){let h=(0,q.useRouter)(),[,i]=(0,p.useTransition)(),[j,k]=(0,p.useState)(""),[l,m]=(0,p.useState)(!1),[n,r]=(0,p.useState)("TODO"),[s,t]=(0,p.useState)(g?e.find(a=>a.id===g)??null:null),[u,v]=(0,p.useState)(null),x=(0,p.useCallback)(()=>{i(()=>{h.refresh()})},[h]);(0,p.useEffect)(()=>{if(l)return;let a=setInterval(()=>{i(()=>{h.refresh()})},5e3);return()=>clearInterval(a)},[h,l]);let y=(0,p.useCallback)(a=>{k(a)},[]),z=(0,p.useCallback)(async(a,b)=>{await (0,eu.updateTaskStatus)(a,b),s?.id===a&&t({...s,status:b}),x()},[x,s]),B=(0,p.useCallback)(async a=>{await eK({title:a.title,description:a.description,projectId:b,priority:a.priority,status:a.status,labelIds:a.labelIds,baseBranch:a.baseBranch,subPath:a.subPath}),x()},[b,x]),C=(0,p.useCallback)(async(a,b)=>{await eL(a,{...b,labelIds:b.labelIds}),v(null),x()},[x]),E=(0,p.useCallback)(async a=>{await eM(a),s?.id===a&&t(null),x()},[x,s]),F=(0,p.useCallback)(async a=>{await eN(a),x()},[x]),G=(0,p.useCallback)(async b=>{try{await (0,eq.startPtyExecution)(b,"")}catch(a){d2.toast.error(a instanceof Error?a.message:String(a))}h.push(`/workspaces/${a}/tasks/${b}`)},[h,a]),H=(0,p.useCallback)(async(a,b)=>{await (0,eu.updateTaskStatus)(a,b),s?.id===a&&t({...s,status:b}),x()},[x,s]),I=(0,p.useCallback)(a=>{r(a),v(null),m(!0)},[]),J=(0,p.useCallback)(a=>{v(a),m(!0)},[]),K=e.filter(a=>!a.labels?.some(a=>a.label.name===D.TOWER_LABEL_NAME&&a.label.isBuiltin)),L=j.trim()?K.filter(a=>{let b=j.toLowerCase();return a.title.toLowerCase().includes(b)||(a.description?.toLowerCase().includes(b)??!1)}):K;return(0,o.jsxs)("div",{className:"flex h-full",children:[(0,o.jsxs)("div",{className:"flex flex-1 flex-col overflow-hidden",children:[(0,o.jsx)("div",{className:"px-6 pt-3 pb-1",children:(0,o.jsx)(eP,{projects:d,activeProjectId:b,onSelect:b=>h.push(`/workspaces/${a}?projectId=${b}`,{scroll:!1})})}),(0,o.jsx)(w,{totalTasks:K.length,runningTasks:K.filter(a=>"IN_PROGRESS"===a.status).length}),(0,o.jsx)(A,{searchQuery:j,onSearchChange:y,onCreateTask:()=>{v(null),m(!0)}}),(0,o.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden p-4",children:(0,o.jsx)(U,{initialTasks:L,onTaskMove:z,onTaskClick:a=>{t(a)},onEditTask:J,onAddTask:I,onDeleteTask:E,onTogglePin:F,workspaceId:a,onContextMenuStatusChange:H,onContextMenuLaunch:G})}),(0,o.jsx)(dN,{open:l,onOpenChange:a=>{m(a),a||v(null)},onSubmit:B,onUpdate:C,defaultStatus:n,editTask:u,editTaskLabelIds:u?.labels?u.labels.map(a=>a.labelId):[],labels:f.filter(a=>!(a.name===D.TOWER_LABEL_NAME&&a.isBuiltin)),projectType:c.type,projectLocalPath:c.localPath})]}),s?(0,o.jsx)(eJ,{task:s,workspaceId:a,projectLocalPath:c.localPath,onClose:()=>t(null)}):(0,o.jsx)(ec,{project:c,workspaceId:a})]})}],257179)}];
5
+ For more information, see https://radix-ui.com/primitives/docs/components/${b.docsSlug}`;return p.useEffect(()=>{a&&(document.getElementById(a)||console.error(c))},[c,a]),null},c_=({contentRef:a,descriptionId:b})=>{let c=cZ("DialogDescriptionWarning"),d=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${c.contentName}}.`;return p.useEffect(()=>{let c=a.current?.getAttribute("aria-describedby");b&&c&&(document.getElementById(b)||console.warn(d))},[d,a,b]),null},c0=Symbol.for("react.lazy"),c1=p[" use ".trim().toString()];function c2(a){var b;return null!=a&&"object"==typeof a&&"$$typeof"in a&&a.$$typeof===c0&&"_payload"in a&&"object"==typeof(b=a._payload)&&null!==b&&"then"in b}var c3=Symbol("radix.slottable");function c4(a){return p.isValidElement(a)&&"function"==typeof a.type&&"__radixId"in a.type&&a.type.__radixId===c3}var c5=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((a,b)=>{var c,d;let e,f,g,h=(d=c=`Primitive.${b}`,(e=p.forwardRef((a,b)=>{let{children:c,...d}=a;if(c2(c)&&"function"==typeof c1&&(c=c1(c._payload)),p.isValidElement(c)){var e;let a,f,g=(e=c,(f=(a=Object.getOwnPropertyDescriptor(e.props,"ref")?.get)&&"isReactWarning"in a&&a.isReactWarning)?e.ref:(f=(a=Object.getOwnPropertyDescriptor(e,"ref")?.get)&&"isReactWarning"in a&&a.isReactWarning)?e.props.ref:e.props.ref||e.ref),h=function(a,b){let c={...b};for(let d in b){let e=a[d],f=b[d];/^on[A-Z]/.test(d)?e&&f?c[d]=(...a)=>{let b=f(...a);return e(...a),b}:e&&(c[d]=e):"style"===d?c[d]={...e,...f}:"className"===d&&(c[d]=[e,f].filter(Boolean).join(" "))}return{...a,...c}}(d,c.props);return c.type!==p.Fragment&&(h.ref=b?bs(b,g):g),p.cloneElement(c,h)}return p.Children.count(c)>1?p.Children.only(null):null})).displayName=`${d}.SlotClone`,f=e,(g=p.forwardRef((a,b)=>{let{children:c,...d}=a;c2(c)&&"function"==typeof c1&&(c=c1(c._payload));let e=p.Children.toArray(c),g=e.find(c4);if(g){let a=g.props.children,c=e.map(b=>b!==g?b:p.Children.count(a)>1?p.Children.only(null):p.isValidElement(a)?a.props.children:null);return(0,o.jsx)(f,{...d,ref:b,children:p.isValidElement(a)?p.cloneElement(a,void 0,c):null})}return(0,o.jsx)(f,{...d,ref:b,children:c})})).displayName=`${c}.Slot`,g),i=p.forwardRef((a,c)=>{let{asChild:d,...e}=a;return(0,o.jsx)(d?h:b,{...e,ref:c})});return i.displayName=`Primitive.${b}`,{...a,[b]:i}},{}),c6='[cmdk-group=""]',c7='[cmdk-group-items=""]',c8='[cmdk-item=""]',c9=`${c8}:not([aria-disabled="true"])`,da="cmdk-item-select",db="data-value",dc=(a,b,c)=>{var d;return d=a,function a(b,c,d,e,f,g,h){if(g===c.length)return f===b.length?1:.99;var i=`${f},${g}`;if(void 0!==h[i])return h[i];for(var j,k,l,m,n=e.charAt(g),o=d.indexOf(n,f),p=0;o>=0;)(j=a(b,c,d,e,o+1,g+1,h))>p&&(o===f?j*=1:bl.test(b.charAt(o-1))?(j*=.8,(l=b.slice(f,o-1).match(bm))&&f>0&&(j*=Math.pow(.999,l.length))):bn.test(b.charAt(o-1))?(j*=.9,(m=b.slice(f,o-1).match(bo))&&f>0&&(j*=Math.pow(.999,m.length))):(j*=.17,f>0&&(j*=Math.pow(.999,o-f))),b.charAt(o)!==c.charAt(g)&&(j*=.9999)),(j<.1&&d.charAt(o-1)===e.charAt(g+1)||e.charAt(g+1)===e.charAt(g)&&d.charAt(o-1)!==e.charAt(g))&&.1*(k=a(b,c,d,e,o+1,g+2,h))>j&&(j=.1*k),j>p&&(p=j),o=d.indexOf(n,o+1);return h[i]=p,p}(d=c&&c.length>0?`${d+" "+c.join(" ")}`:d,b,bp(d),bp(b),0,0,{})},dd=p.createContext(void 0),de=p.createContext(void 0),df=p.createContext(void 0),dg=p.forwardRef((a,b)=>{let c=dr(()=>{var b,c;return{search:"",value:null!=(c=null!=(b=a.value)?b:a.defaultValue)?c:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),d=dr(()=>new Set),e=dr(()=>new Map),f=dr(()=>new Map),g=dr(()=>new Set),h=dp(a),{label:i,children:j,value:k,onValueChange:l,filter:m,shouldFilter:n,loop:o,disablePointerSelection:q=!1,vimBindings:r=!0,...s}=a,t=bx(),u=bx(),v=bx(),w=p.useRef(null),x=du();dq(()=>{if(void 0!==k){let a=k.trim();c.current.value=a,y.emit()}},[k]),dq(()=>{x(6,E)},[]);let y=p.useMemo(()=>({subscribe:a=>(g.current.add(a),()=>g.current.delete(a)),snapshot:()=>c.current,setState:(a,b,d)=>{var e,f,g,i;if(!Object.is(c.current[a],b)){if(c.current[a]=b,"search"===a)D(),B(),x(1,C);else if("value"===a){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let a=document.getElementById(v);a?a.focus():null==(e=document.getElementById(t))||e.focus()}if(x(7,()=>{var a;c.current.selectedItemId=null==(a=F())?void 0:a.id,y.emit()}),d||x(5,E),(null==(f=h.current)?void 0:f.value)!==void 0){null==(i=(g=h.current).onValueChange)||i.call(g,null!=b?b:"");return}}y.emit()}},emit:()=>{g.current.forEach(a=>a())}}),[]),z=p.useMemo(()=>({value:(a,b,d)=>{var e;b!==(null==(e=f.current.get(a))?void 0:e.value)&&(f.current.set(a,{value:b,keywords:d}),c.current.filtered.items.set(a,A(b,d)),x(2,()=>{B(),y.emit()}))},item:(a,b)=>(d.current.add(a),b&&(e.current.has(b)?e.current.get(b).add(a):e.current.set(b,new Set([a]))),x(3,()=>{D(),B(),c.current.value||C(),y.emit()}),()=>{f.current.delete(a),d.current.delete(a),c.current.filtered.items.delete(a);let b=F();x(4,()=>{D(),(null==b?void 0:b.getAttribute("id"))===a&&C(),y.emit()})}),group:a=>(e.current.has(a)||e.current.set(a,new Set),()=>{f.current.delete(a),e.current.delete(a)}),filter:()=>h.current.shouldFilter,label:i||a["aria-label"],getDisablePointerSelection:()=>h.current.disablePointerSelection,listId:t,inputId:v,labelId:u,listInnerRef:w}),[]);function A(a,b){var d,e;let f=null!=(e=null==(d=h.current)?void 0:d.filter)?e:dc;return a?f(a,c.current.search,b):0}function B(){if(!c.current.search||!1===h.current.shouldFilter)return;let a=c.current.filtered.items,b=[];c.current.filtered.groups.forEach(c=>{let d=e.current.get(c),f=0;d.forEach(b=>{f=Math.max(a.get(b),f)}),b.push([c,f])});let d=w.current;G().sort((b,c)=>{var d,e;let f=b.getAttribute("id"),g=c.getAttribute("id");return(null!=(d=a.get(g))?d:0)-(null!=(e=a.get(f))?e:0)}).forEach(a=>{let b=a.closest(c7);b?b.appendChild(a.parentElement===b?a:a.closest(`${c7} > *`)):d.appendChild(a.parentElement===d?a:a.closest(`${c7} > *`))}),b.sort((a,b)=>b[1]-a[1]).forEach(a=>{var b;let c=null==(b=w.current)?void 0:b.querySelector(`${c6}[${db}="${encodeURIComponent(a[0])}"]`);null==c||c.parentElement.appendChild(c)})}function C(){let a=G().find(a=>"true"!==a.getAttribute("aria-disabled")),b=null==a?void 0:a.getAttribute(db);y.setState("value",b||void 0)}function D(){var a,b,g,i;if(!c.current.search||!1===h.current.shouldFilter){c.current.filtered.count=d.current.size;return}c.current.filtered.groups=new Set;let j=0;for(let e of d.current){let d=A(null!=(b=null==(a=f.current.get(e))?void 0:a.value)?b:"",null!=(i=null==(g=f.current.get(e))?void 0:g.keywords)?i:[]);c.current.filtered.items.set(e,d),d>0&&j++}for(let[a,b]of e.current)for(let d of b)if(c.current.filtered.items.get(d)>0){c.current.filtered.groups.add(a);break}c.current.filtered.count=j}function E(){var a,b,c;let d=F();d&&((null==(a=d.parentElement)?void 0:a.firstChild)===d&&(null==(c=null==(b=d.closest(c6))?void 0:b.querySelector('[cmdk-group-heading=""]'))||c.scrollIntoView({block:"nearest"})),d.scrollIntoView({block:"nearest"}))}function F(){var a;return null==(a=w.current)?void 0:a.querySelector(`${c8}[aria-selected="true"]`)}function G(){var a;return Array.from((null==(a=w.current)?void 0:a.querySelectorAll(c9))||[])}function H(a){let b=G()[a];b&&y.setState("value",b.getAttribute(db))}function I(a){var b;let c=F(),d=G(),e=d.findIndex(a=>a===c),f=d[e+a];null!=(b=h.current)&&b.loop&&(f=e+a<0?d[d.length-1]:e+a===d.length?d[0]:d[e+a]),f&&y.setState("value",f.getAttribute(db))}function J(a){let b=F(),c=null==b?void 0:b.closest(c6),d;for(;c&&!d;)d=null==(c=a>0?function(a,b){let c=a.nextElementSibling;for(;c;){if(c.matches(b))return c;c=c.nextElementSibling}}(c,c6):function(a,b){let c=a.previousElementSibling;for(;c;){if(c.matches(b))return c;c=c.previousElementSibling}}(c,c6))?void 0:c.querySelector(c9);d?y.setState("value",d.getAttribute(db)):I(a)}let K=()=>H(G().length-1),L=a=>{a.preventDefault(),a.metaKey?K():a.altKey?J(1):I(1)},M=a=>{a.preventDefault(),a.metaKey?H(0):a.altKey?J(-1):I(-1)};return p.createElement(c5.div,{ref:b,tabIndex:-1,...s,"cmdk-root":"",onKeyDown:a=>{var b;null==(b=s.onKeyDown)||b.call(s,a);let c=a.nativeEvent.isComposing||229===a.keyCode;if(!(a.defaultPrevented||c))switch(a.key){case"n":case"j":r&&a.ctrlKey&&L(a);break;case"ArrowDown":L(a);break;case"p":case"k":r&&a.ctrlKey&&M(a);break;case"ArrowUp":M(a);break;case"Home":a.preventDefault(),H(0);break;case"End":a.preventDefault(),K();break;case"Enter":{a.preventDefault();let b=F();if(b){let a=new Event(da);b.dispatchEvent(a)}}}}},p.createElement("label",{"cmdk-label":"",htmlFor:z.inputId,id:z.labelId,style:dw},i),dv(a,a=>p.createElement(de.Provider,{value:y},p.createElement(dd.Provider,{value:z},a))))}),dh=p.forwardRef((a,b)=>{var c,d;let e=bx(),f=p.useRef(null),g=p.useContext(df),h=p.useContext(dd),i=dp(a),j=null!=(d=null==(c=i.current)?void 0:c.forceMount)?d:null==g?void 0:g.forceMount;dq(()=>{if(!j)return h.item(e,null==g?void 0:g.id)},[j]);let k=dt(e,f,[a.value,a.children,f],a.keywords),l=p.useContext(de),m=ds(a=>a.value&&a.value===k.current),n=ds(a=>!!j||!1===h.filter()||!a.search||a.filtered.items.get(e)>0);function o(){var a,b;q(),null==(b=(a=i.current).onSelect)||b.call(a,k.current)}function q(){l.setState("value",k.current,!0)}if(p.useEffect(()=>{let b=f.current;if(!(!b||a.disabled))return b.addEventListener(da,o),()=>b.removeEventListener(da,o)},[n,a.onSelect,a.disabled]),!n)return null;let{disabled:r,value:s,onSelect:t,forceMount:u,keywords:v,...w}=a;return p.createElement(c5.div,{ref:bs(f,b),...w,id:e,"cmdk-item":"",role:"option","aria-disabled":!!r,"aria-selected":!!m,"data-disabled":!!r,"data-selected":!!m,onPointerMove:r||h.getDisablePointerSelection()?void 0:q,onClick:r?void 0:o},a.children)}),di=p.forwardRef((a,b)=>{let{heading:c,children:d,forceMount:e,...f}=a,g=bx(),h=p.useRef(null),i=p.useRef(null),j=bx(),k=p.useContext(dd),l=ds(a=>!!e||!1===k.filter()||!a.search||a.filtered.groups.has(g));dq(()=>k.group(g),[]),dt(g,h,[a.value,a.heading,i]);let m=p.useMemo(()=>({id:g,forceMount:e}),[e]);return p.createElement(c5.div,{ref:bs(h,b),...f,"cmdk-group":"",role:"presentation",hidden:!l||void 0},c&&p.createElement("div",{ref:i,"cmdk-group-heading":"","aria-hidden":!0,id:j},c),dv(a,a=>p.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":c?j:void 0},p.createElement(df.Provider,{value:m},a))))}),dj=p.forwardRef((a,b)=>{let{alwaysRender:c,...d}=a,e=p.useRef(null),f=ds(a=>!a.search);return c||f?p.createElement(c5.div,{ref:bs(e,b),...d,"cmdk-separator":"",role:"separator"}):null}),dk=p.forwardRef((a,b)=>{let{onValueChange:c,...d}=a,e=null!=a.value,f=p.useContext(de),g=ds(a=>a.search),h=ds(a=>a.selectedItemId),i=p.useContext(dd);return p.useEffect(()=>{null!=a.value&&f.setState("search",a.value)},[a.value]),p.createElement(c5.input,{ref:b,...d,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":i.listId,"aria-labelledby":i.labelId,"aria-activedescendant":h,id:i.inputId,type:"text",value:e?a.value:g,onChange:a=>{e||f.setState("search",a.target.value),null==c||c(a.target.value)}})}),dl=p.forwardRef((a,b)=>{let{children:c,label:d="Suggestions",...e}=a,f=p.useRef(null),g=p.useRef(null),h=ds(a=>a.selectedItemId),i=p.useContext(dd);return p.useEffect(()=>{if(g.current&&f.current){let a=g.current,b=f.current,c,d=new ResizeObserver(()=>{c=requestAnimationFrame(()=>{let c=a.offsetHeight;b.style.setProperty("--cmdk-list-height",c.toFixed(1)+"px")})});return d.observe(a),()=>{cancelAnimationFrame(c),d.unobserve(a)}}},[]),p.createElement(c5.div,{ref:bs(f,b),...e,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":h,"aria-label":d,id:i.listId},dv(a,a=>p.createElement("div",{ref:bs(g,i.listInnerRef),"cmdk-list-sizer":""},a)))}),dm=p.forwardRef((a,b)=>{let{open:c,onOpenChange:d,overlayClassName:e,contentClassName:f,container:g,...h}=a;return p.createElement(cE,{open:c,onOpenChange:d},p.createElement(cJ,{container:g},p.createElement(cL,{"cmdk-overlay":"",className:e}),p.createElement(cP,{"aria-label":a.label,"cmdk-dialog":"",className:f},p.createElement(dg,{ref:b,...h}))))}),dn=Object.assign(dg,{List:dl,Item:dh,Input:dk,Group:di,Separator:dj,Dialog:dm,Empty:p.forwardRef((a,b)=>ds(a=>0===a.filtered.count)?p.createElement(c5.div,{ref:b,...a,"cmdk-empty":"",role:"presentation"}):null),Loading:p.forwardRef((a,b)=>{let{progress:c,children:d,label:e="Loading...",...f}=a;return p.createElement(c5.div,{ref:b,...f,"cmdk-loading":"",role:"progressbar","aria-valuenow":c,"aria-valuemin":0,"aria-valuemax":100,"aria-label":e},dv(a,a=>p.createElement("div",{"aria-hidden":!0},a)))})});function dp(a){let b=p.useRef(a);return dq(()=>{b.current=a}),b}var dq=p.useEffect;function dr(a){let b=p.useRef();return void 0===b.current&&(b.current=a()),b}function ds(a){let b=p.useContext(de),c=()=>a(b.snapshot());return p.useSyncExternalStore(b.subscribe,c,c)}function dt(a,b,c,d=[]){let e=p.useRef(),f=p.useContext(dd);return dq(()=>{var g;let h=(()=>{var a;for(let b of c){if("string"==typeof b)return b.trim();if("object"==typeof b&&"current"in b)return b.current?null==(a=b.current.textContent)?void 0:a.trim():e.current}})(),i=d.map(a=>a.trim());f.value(a,h,i),null==(g=b.current)||g.setAttribute(db,h),e.current=h}),e}var du=()=>{let[a,b]=p.useState(),c=dr(()=>new Map);return dq(()=>{c.current.forEach(a=>a()),c.current=new Map},[a]),(a,d)=>{c.current.set(a,d),b({})}};function dv({asChild:a,children:b},c){let d;return a&&p.isValidElement(b)?p.cloneElement("function"==typeof(d=b.type)?d(b.props):"render"in d?d.render(b.props):b,{ref:b.ref},c(b.props.children)):c(b)}var dw={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"},dx=a.i(488137);function dy({className:a,...b}){return(0,o.jsx)("div",{"data-slot":"input-group",role:"group",className:(0,bh.cn)("group/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5",a),...b})}let dz=(0,dx.cva)("flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",{variants:{align:{"inline-start":"order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]","inline-end":"order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]","block-start":"order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2","block-end":"order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2"}},defaultVariants:{align:"inline-start"}});function dA({className:a,align:b="inline-start",...c}){return(0,o.jsx)("div",{role:"group","data-slot":"input-group-addon","data-align":b,className:(0,bh.cn)(dz({align:b}),a),onClick:a=>{a.target.closest("button")||a.currentTarget.parentElement?.querySelector("input")?.focus()},...c})}(0,dx.cva)("flex items-center gap-2 text-sm shadow-none",{variants:{size:{xs:"h-6 gap-1 rounded-[calc(var(--radius)-3px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5",sm:"","icon-xs":"size-6 rounded-[calc(var(--radius)-3px)] p-0 has-[>svg]:p-0","icon-sm":"size-8 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});var dB=a.i(458415),dB=dB,dC=a.i(659503);function dD({className:a,...b}){return(0,o.jsx)(dn,{"data-slot":"command",className:(0,bh.cn)("flex size-full flex-col overflow-hidden rounded-xl! bg-popover p-1 text-popover-foreground",a),...b})}function dE({className:a,...b}){return(0,o.jsx)("div",{"data-slot":"command-input-wrapper",className:"p-1 pb-0",children:(0,o.jsxs)(dy,{className:"h-8! rounded-lg! border-input/30 bg-input/30 shadow-none! *:data-[slot=input-group-addon]:pl-2!",children:[(0,o.jsx)(dn.Input,{"data-slot":"command-input",className:(0,bh.cn)("w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",a),...b}),(0,o.jsx)(dA,{children:(0,o.jsx)(dB.default,{className:"size-4 shrink-0 opacity-50"})})]})})}function dF({className:a,...b}){return(0,o.jsx)(dn.List,{"data-slot":"command-list",className:(0,bh.cn)("no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none",a),...b})}function dG({className:a,...b}){return(0,o.jsx)(dn.Empty,{"data-slot":"command-empty",className:(0,bh.cn)("py-6 text-center text-sm",a),...b})}function dH({className:a,...b}){return(0,o.jsx)(dn.Group,{"data-slot":"command-group",className:(0,bh.cn)("overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground",a),...b})}function dI({className:a,children:b,...c}){return(0,o.jsxs)(dn.Item,{"data-slot":"command-item",className:(0,bh.cn)("group/command-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none in-data-[slot=dialog-content]:rounded-lg! data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-muted data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-selected:*:[svg]:text-foreground",a),...c,children:[b,(0,o.jsx)(dC.CheckIcon,{className:"ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100"})]})}var dJ=a.i(879876);let dK=(0,dJ.createServerReference)("40f05fa7b35d68584ed09c9aeed23ccafa7f2f4b90",dJ.callServer,void 0,dJ.findSourceMapURL,"getProjectBranches"),dL=(0,dJ.createServerReference)("40e11bba7fe7a4233b0fb5baf42de8a0885e56d7ca",dJ.callServer,void 0,dJ.findSourceMapURL,"fetchRemoteBranches"),dM=(0,dJ.createServerReference)("405b2118bbf7d936fec20885b9bb70138b421d0f28",dJ.callServer,void 0,dJ.findSourceMapURL,"getCurrentBranch");function dN({open:a,onOpenChange:b,onSubmit:c,onUpdate:d,defaultStatus:e="TODO",editTask:f,editTaskLabelIds:g,labels:h,projectType:i,projectLocalPath:j}){let[k,l]=(0,p.useState)(""),[m,n]=(0,p.useState)(""),[q,r]=(0,p.useState)("MEDIUM"),[s,t]=(0,p.useState)(""),[u,w]=(0,p.useState)([]),[x,y]=(0,p.useState)([]),[A,B]=(0,p.useState)(!1),[D,E]=(0,p.useState)(""),[F,G]=(0,p.useState)(!1),[H,I]=(0,p.useState)(!0),{t:J}=(0,v.useI18n)(),K=!!f,L=!!j;return(0,p.useEffect)(()=>{f?(l(f.title),n(f.description??""),r(f.priority),t(f.subPath??""),w(g??[])):(l(""),n(""),r("MEDIUM"),t(""),w([]))},[f,g]),(0,p.useEffect)(()=>{a||f||(l(""),n(""),r("MEDIUM"),t(""),w([]),y([]),E(""),G(!1))},[a,f]),(0,p.useEffect)(()=>{a&&L&&!f&&(B(!0),Promise.all([dK(j),dM(j)]).then(([a,b])=>{y(a),E(b&&a.includes(b)?b:a[0]??""),B(!1),dL(j).then(()=>{setTimeout(()=>{dK(j).then(a=>{y(a),E(b=>a.includes(b)?b:a[0]??"")}).catch(()=>{})},3e3)})}).catch(()=>{y([]),E(""),B(!1)}))},[a,L,j,f]),(0,o.jsx)(Q.Dialog,{open:a,onOpenChange:b,disablePointerDismissal:!0,children:(0,o.jsxs)(Q.DialogContent,{className:"sm:max-w-md",children:[(0,o.jsx)(Q.DialogHeader,{children:(0,o.jsx)(Q.DialogTitle,{children:K?J("task.edit"):J("task.create")})}),(0,o.jsxs)("div",{className:"space-y-4 py-2",children:[(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)(X.Label,{htmlFor:"title",children:J("task.title")}),(0,o.jsx)(V.Input,{id:"title","data-testid":"task-title",placeholder:J("task.titlePlaceholder"),value:k,onChange:a=>l(a.target.value),onKeyDown:a=>"Enter"===a.key&&a.preventDefault()})]}),(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)(X.Label,{htmlFor:"description",children:J("task.description")}),(0,o.jsx)(W.Textarea,{id:"description",placeholder:J("task.descPlaceholder"),rows:4,value:m,onChange:a=>n(a.target.value),className:"max-h-[200px] overflow-y-auto"})]}),(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)(X.Label,{htmlFor:"subPath",children:J("task.subPath")}),(0,o.jsx)(V.Input,{id:"subPath",placeholder:J("task.subPathPlaceholder"),value:s,onChange:a=>t(a.target.value)}),(0,o.jsx)("p",{className:"text-xs text-muted-foreground",children:J("task.subPathHint")})]}),(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)(X.Label,{children:J("task.priority")}),(0,o.jsx)("div",{className:"flex gap-1.5",children:["LOW","MEDIUM","HIGH","CRITICAL"].map(a=>{let b={LOW:{label:J("task.priorityLow"),style:"text-slate-300 border-slate-500/30 bg-slate-500/10"},MEDIUM:{label:J("task.priorityMedium"),style:"text-amber-300 border-amber-500/30 bg-amber-500/10"},HIGH:{label:J("task.priorityHigh"),style:"text-orange-300 border-orange-500/30 bg-orange-500/10"},CRITICAL:{label:J("task.priorityCritical"),style:"text-rose-300 border-rose-500/30 bg-rose-500/10"}}[a];return(0,o.jsx)("button",{type:"button",onClick:()=>r(a),className:`rounded-lg border px-3 py-1.5 text-xs font-medium transition-all ${q===a?`${b.style} ring-1 ring-current/20`:"border-border text-muted-foreground hover:bg-accent"}`,children:b.label},a)})})]}),L&&!K&&(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)(X.Label,{children:J("task.baseBranch")}),A?(0,o.jsx)("div",{className:"text-sm text-muted-foreground",children:J("task.branchLoading")}):x.length>0?(0,o.jsxs)(bi,{open:F,onOpenChange:G,children:[(0,o.jsxs)(bj,{className:"flex w-full items-center gap-2 rounded-md border border-input bg-background px-3 py-2 text-sm font-mono transition-colors hover:bg-accent focus:outline-none focus:ring-1 focus:ring-ring","data-testid":"branch-selector",children:[(0,o.jsx)(Y.GitBranch,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),(0,o.jsx)("span",{className:"flex-1 truncate text-left text-xs",children:D||J("task.branchNone")}),(0,o.jsx)(Z,{className:"h-3.5 w-3.5 shrink-0 opacity-50"})]}),(0,o.jsx)(bk,{className:"p-0",align:"start",children:(0,o.jsxs)(dD,{children:[(0,o.jsx)(dE,{placeholder:J("task.branchSearch")}),(0,o.jsxs)(dF,{children:[(0,o.jsx)(dG,{children:J("task.branchNone")}),(0,o.jsx)(dH,{children:x.map(a=>(0,o.jsxs)(dI,{value:a,onSelect:()=>{E(a),G(!1)},children:[(0,o.jsx)(Y.GitBranch,{className:"h-3 w-3 text-muted-foreground shrink-0 mr-2"}),(0,o.jsx)("span",{className:"flex-1 truncate font-mono",children:a}),a===D&&(0,o.jsx)(C.Check,{className:"h-3 w-3 text-primary shrink-0 ml-auto"})]},a))})]})]})})]}):(0,o.jsx)("div",{className:"text-sm text-muted-foreground",children:J("task.branchNone")}),(0,o.jsxs)("div",{className:"mt-3 flex items-center gap-2",children:[(0,o.jsx)(X.Label,{className:"text-xs text-muted-foreground",children:J("task.worktreeLabel")}),(0,o.jsx)("div",{className:"flex gap-1",children:[!0,!1].map(a=>(0,o.jsx)("button",{type:"button",onClick:()=>I(a),className:`rounded-md px-3 py-1 text-xs font-medium transition-colors ${H===a?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:text-foreground"}`,children:a?J("task.worktreeYes"):J("task.worktreeNo")},String(a)))})]})]}),h.length>0&&(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)(X.Label,{children:J("task.labels")}),(0,o.jsx)("div",{className:"flex flex-wrap gap-1.5",children:h.map(a=>{let b=u.includes(a.id);return(0,o.jsx)("button",{type:"button",onClick:()=>{w(c=>b?c.filter(b=>b!==a.id):[...c,a.id])},className:`rounded-full px-2.5 py-1 text-xs font-medium transition-all ${b?"ring-1 ring-current/30":"opacity-50 hover:opacity-80"}`,style:{backgroundColor:a.color+"20",color:a.color,borderColor:b?a.color+"40":"transparent",borderWidth:"1px"},children:a.name},a.id)})})]})]}),(0,o.jsxs)(Q.DialogFooter,{children:[(0,o.jsx)(z.Button,{variant:"outline",onClick:()=>b(!1),children:J("common.cancel")}),(0,o.jsx)(z.Button,{onClick:()=>{k.trim()&&(K&&d?d(f.id,{title:k,description:m,priority:q,labelIds:u,subPath:s.trim()||""}):c({title:k,description:m,priority:q,status:e,labelIds:u,...L&&H&&D?{baseBranch:D}:{},...s.trim()?{subPath:s.trim()}:{}}),l(""),n(""),r("MEDIUM"),t(""),w([]),y([]),E(""),I(!0),b(!1))},className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:K?J("common.save"):J("common.create")})]})]})})}var dO=a.i(354994),dP=a.i(506008),dQ=a.i(212765),dR=a.i(161604),dS=a.i(986379);let dT=(0,r.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 dU=a.i(467034),dV=a.i(109434),dW=a.i(938899),dX=a.i(145685),dY=a.i(114603),dZ=a.i(408072);let d$=(0,dJ.createServerReference)("4098e0063f1ea45bd87ffdcc7cccea30b6478a6b3b",dJ.callServer,void 0,dJ.findSourceMapURL,"deleteProject"),d_=(0,dJ.createServerReference)("40168c3821f045fd64d0105bab8735f5e9e53547b7",dJ.callServer,void 0,dJ.findSourceMapURL,"getRecentLocalProjects"),d0=(0,dJ.createServerReference)("4062e4207ea1da3bc910bf578675fc13f57a38b71e",dJ.callServer,void 0,dJ.findSourceMapURL,"getOrCreateTowerTaskId");var d1=a.i(472600),d2=a.i(942308),d3=a.i(563504),d4=a.i(845924),d5=a.i(929526);let d6=(0,r.default)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);function d7({commits:a}){let{t:b}=(0,v.useI18n)(),[c,d]=(0,p.useState)(!1);return 0===a.length?null:(0,o.jsxs)("div",{children:[(0,o.jsxs)("button",{onClick:()=>d(!c),className:"flex w-full items-center justify-between py-1",children:[(0,o.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:b("git.commitLog")}),c?(0,o.jsx)(dO.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,o.jsx)(dP.ChevronRight,{className:"h-3 w-3 text-muted-foreground"})]}),c&&(0,o.jsx)("div",{className:"mt-1.5 space-y-0.5 max-h-64 overflow-y-auto",children:a.map(a=>(0,o.jsxs)("div",{className:"group flex items-start gap-2 rounded-md px-2 py-1.5 hover:bg-accent transition-colors",children:[(0,o.jsx)(dT,{className:"h-3 w-3 shrink-0 text-muted-foreground mt-0.5"}),(0,o.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,o.jsx)("p",{className:"text-xs text-foreground line-clamp-1",children:a.message}),(0,o.jsxs)("div",{className:"flex items-center gap-2 mt-0.5",children:[(0,o.jsxs)("button",{onClick:()=>{navigator.clipboard.writeText(a.shortHash),d2.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,o.jsx)(d6,{className:"h-2.5 w-2.5 opacity-0 group-hover:opacity-100 transition-opacity"})]}),(0,o.jsx)("span",{className:"text-[10px] text-muted-foreground",children:a.author}),(0,o.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 d8=a.i(14180),d9=a.i(460143),ea=a.i(820838);function eb({localPath:a,stashes:b,hasChanges:c,onRefresh:d}){let{t:e}=(0,v.useI18n)(),[f,g]=(0,p.useState)(!1),[h,i]=(0,p.useState)(!1),[j,k]=(0,p.useState)(""),[l,m]=(0,p.useState)(null),n=async()=>{i(!0);try{await (0,ea.gitAction)(a,"stash-save",{message:j}),k(""),d2.toast.success(e("git.stashSaved")),await d()}catch(a){d2.toast.error(a instanceof Error?a.message:String(a))}finally{i(!1)}},q=async b=>{m(b);try{await (0,ea.gitAction)(a,"stash-pop",{index:b}),d2.toast.success(e("git.stashApplied")),await d()}catch(a){d2.toast.error(a instanceof Error?a.message:String(a))}finally{m(null)}},r=async b=>{m(b);try{await (0,ea.gitAction)(a,"stash-drop",{index:b}),d2.toast.success(e("git.stashDropped")),await d()}catch(a){d2.toast.error(a instanceof Error?a.message:String(a))}finally{m(null)}};return c||0!==b.length?(0,o.jsxs)("div",{children:[(0,o.jsxs)("button",{onClick:()=>g(!f),className:"flex w-full items-center justify-between py-1",children:[(0,o.jsxs)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:[e("git.stash")," ",b.length>0&&`(${b.length})`]}),f?(0,o.jsx)(dO.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,o.jsx)(dP.ChevronRight,{className:"h-3 w-3 text-muted-foreground"})]}),f&&(0,o.jsxs)("div",{className:"mt-1.5 space-y-2",children:[c&&(0,o.jsxs)("div",{className:"flex gap-1.5",children:[(0,o.jsx)(V.Input,{value:j,onChange:a=>k(a.target.value),placeholder:e("git.stashMsgPlaceholder"),className:"h-7 text-xs flex-1",onKeyDown:a=>"Enter"===a.key&&n()}),(0,o.jsx)(z.Button,{variant:"outline",size:"icon-sm",onClick:n,disabled:h,className:"shrink-0",children:h?(0,o.jsx)(dV.Loader2,{className:"h-3 w-3 animate-spin"}):(0,o.jsx)(d8.Archive,{className:"h-3 w-3"})})]}),b.length>0&&(0,o.jsx)("div",{className:"space-y-0.5",children:b.map(a=>(0,o.jsxs)("div",{className:"group flex items-center gap-2 rounded-md px-2 py-1.5 hover:bg-accent transition-colors",children:[(0,o.jsx)(d8.Archive,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),(0,o.jsx)("span",{className:"flex-1 min-w-0 truncate text-xs text-foreground",children:a.message||`stash@{${a.index}}`}),(0,o.jsxs)("div",{className:"flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,o.jsx)(z.Button,{variant:"ghost",size:"icon-xs",onClick:()=>q(a.index),disabled:l===a.index,className:"text-muted-foreground","aria-label":e("git.stashApply"),children:l===a.index?(0,o.jsx)(dV.Loader2,{className:"h-3 w-3 animate-spin"}):(0,o.jsx)(d9.ArrowUpFromLine,{className:"h-3 w-3"})}),(0,o.jsx)(z.Button,{variant:"ghost",size:"icon-xs",onClick:()=>r(a.index),disabled:l===a.index,className:"text-rose-400","aria-label":e("git.stashDrop"),children:(0,o.jsx)(L.Trash2,{className:"h-3 w-3"})})]})]},a.index))})]})]}):null}function ec({project:a,workspaceId:b}){let{t:c,locale:d}=(0,v.useI18n)(),e=(0,q.useRouter)(),[f,g]=(0,p.useState)(!0),[h,i]=(0,p.useState)(!0),[j,k]=(0,p.useState)(!1),[l,m]=(0,p.useState)(!1),[n,r]=(0,p.useState)(""),[s,t]=(0,p.useState)(!1),[u,w]=(0,p.useState)(!1),[x,y]=(0,p.useState)(!1),[A,B]=(0,p.useState)(a.name),[C,D]=(0,p.useState)(a.alias??""),[E,F]=(0,p.useState)(a.description??""),[G,H]=(0,p.useState)(a.localPath??""),[I,J]=(0,p.useState)(a.projectType??"FRONTEND"),[M,N]=(0,p.useState)([]);(0,p.useEffect)(()=>{d_(100).then(N)},[]);let[O,P]=(0,p.useState)(!1),[R,S]=(0,p.useState)(""),[T,U]=(0,p.useState)(""),[X,Z]=(0,p.useState)(""),[$,_]=(0,p.useState)(""),[aa,ab]=(0,p.useState)("FRONTEND"),[ac,ad]=(0,p.useState)(!1),[ae,af]=(0,p.useState)(!1),[ag,ah]=(0,p.useState)(null),[ai,aj]=(0,p.useState)(!1),[ak,al]=(0,p.useState)(!1),[am,an]=(0,p.useState)(!1),ao=a=>{d2.toast.info(a)},ap=(0,p.useCallback)(async()=>{if(a.localPath){aj(!0);try{let b=await fetch(`/api/git?path=${encodeURIComponent(a.localPath)}`);b.ok&&ah(await b.json())}catch{}finally{aj(!1)}}},[a.localPath]);(0,p.useEffect)(()=>{ap()},[ap]);let aq=async()=>{if(a.localPath){al(!0);try{(await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"init",path:a.localPath})})).ok?(ao(c("git.initSuccess")),await ap()):ao(c("git.initFailed"))}catch{ao(c("git.initFailed"))}finally{al(!1)}}},ar=async b=>{if(a.localPath)try{let d=await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"checkout",path:a.localPath,branch:b})});if(d.ok)ao(`${c("git.switchSuccess")} ${b}`),await ap();else{let a=await d.json();ao(`${c("git.switchFailed")}: ${a.error}`)}}catch{ao(c("git.switchFailed"))}},as=(a,b)=>{e.push(`/workspaces/${a}?projectId=${b}`,{scroll:!1}),e.refresh()},at=async()=>{if(T.trim()){ad(!0);try{let a=await (0,dZ.createProject)({name:T.trim(),alias:X.trim()||void 0,description:$.trim()||void 0,localPath:R,projectType:aa,workspaceId:b});P(!1),as(b,a.id)}catch(a){d2.toast.error(a instanceof Error?a.message:String(a))}finally{ad(!1)}}},au=async()=>{if(G&&!ae){af(!0);try{let a=await (0,d1.analyzeProjectDirectory)(G.trim(),d);F(a)}catch{d2.toast.error(c("project.analyzeError"))}finally{af(!1)}}},av=async()=>{try{await (0,dY.updateProject)(a.id,{name:A.trim(),alias:C.trim()||void 0,description:E.trim()||void 0,localPath:G.trim()||void 0,projectType:I}),e.refresh(),k(!1)}catch(a){d2.toast.error(a instanceof Error?a.message:String(a))}};return(0,o.jsxs)("aside",{className:"relative w-72 flex-shrink-0 overflow-y-auto border-l border-border bg-sidebar",children:[(0,o.jsxs)("div",{className:"border-b border-border p-4",children:[(0,o.jsxs)("div",{className:"flex items-start justify-between",children:[(0,o.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,o.jsx)("h2",{className:"text-base font-semibold text-foreground",children:a.name}),a.alias&&(0,o.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:a.alias})]}),(0,o.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,o.jsx)(z.Button,{variant:"ghost",size:"icon-sm",onClick:()=>{B(a.name),D(a.alias??""),F(a.description??""),H(a.localPath??""),k(!0)},className:"text-muted-foreground",children:(0,o.jsx)(K.Pencil,{className:"h-3.5 w-3.5"})}),(0,o.jsx)(z.Button,{variant:"ghost",size:"icon-sm",onClick:()=>{r(""),m(!0)},className:"text-muted-foreground hover:text-rose-400",children:(0,o.jsx)(L.Trash2,{className:"h-3.5 w-3.5"})})]})]}),a.description&&(0,o.jsx)("p",{className:"mt-2 text-sm text-secondary-foreground leading-relaxed line-clamp-4",children:a.description}),(0,o.jsx)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:(0,o.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,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Y.GitBranch,{className:"h-3 w-3"}),c("sidebar.right.gitType")]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(dR.FileText,{className:"h-3 w-3"}),c("sidebar.right.normalType")]})})}),a.localPath&&(0,o.jsxs)("div",{className:"mt-3 flex items-start gap-2 rounded-md bg-muted/50 px-2.5 py-2 text-xs",children:[(0,o.jsx)(dS.FolderOpen,{className:"mt-0.5 h-3 w-3 shrink-0 text-muted-foreground"}),(0,o.jsx)("span",{className:"break-all font-mono text-secondary-foreground",children:a.localPath})]}),a.gitUrl&&(0,o.jsxs)("div",{className:"mt-2 flex items-start gap-2 rounded-md bg-muted/50 px-2.5 py-2 text-xs",children:[(0,o.jsx)(dQ.Globe,{className:"mt-0.5 h-3 w-3 shrink-0 text-muted-foreground"}),(0,o.jsx)("span",{className:"break-all text-secondary-foreground",children:a.gitUrl})]}),a.localPath&&(0,o.jsxs)(z.Button,{variant:"outline",className:"mt-3 w-full h-8 gap-1.5 text-xs",disabled:u,onClick:async()=>{w(!0);try{let c=await d0(a.id);e.push(`/workspaces/${b}/tasks/${c}`)}catch{d2.toast.error(c("git.openStudioFailed"))}finally{w(!1)}},children:[u?(0,o.jsx)(dV.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):(0,o.jsx)(dS.FolderOpen,{className:"h-3.5 w-3.5"}),c("git.openStudio")]})]}),(0,o.jsxs)("div",{className:"border-b border-border p-4",children:[(0,o.jsxs)(z.Button,{variant:"ghost",onClick:()=>g(!f),className:"flex w-full cursor-pointer justify-between px-2 py-2",children:[(0,o.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:c("git.section")}),f?(0,o.jsx)(dO.ChevronDown,{className:"h-3.5 w-3.5 text-muted-foreground"}):(0,o.jsx)(dP.ChevronRight,{className:"h-3.5 w-3.5 text-muted-foreground"})]}),f&&(0,o.jsx)("div",{className:"mt-3",children:a.localPath?ai?(0,o.jsxs)("div",{className:"flex items-center justify-center py-4 text-muted-foreground",children:[(0,o.jsx)(dV.Loader2,{className:"h-4 w-4 animate-spin"}),(0,o.jsx)("span",{className:"ml-2 text-xs",children:c("git.loading")})]}):ag&&!ag.isGit?(0,o.jsxs)("div",{className:"rounded-lg border border-border bg-muted/50 p-3",children:[(0,o.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,o.jsx)(dU.AlertCircle,{className:"h-3.5 w-3.5"}),(0,o.jsx)("p",{className:"text-xs",children:c("git.notInitialized")})]}),(0,o.jsxs)(z.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:aq,disabled:ak,children:[ak?(0,o.jsx)(dV.Loader2,{className:"h-3 w-3 animate-spin"}):(0,o.jsx)(dT,{className:"h-3 w-3"}),c("git.initRepo")]})]}):ag?.isGit?(0,o.jsxs)("div",{className:"space-y-3",children:[(0,o.jsx)(ed,{localBranches:ag.branches??[],remoteBranches:(ag.remoteBranches??[]).filter(a=>!ag.branches?.includes(a)),currentBranch:ag.currentBranch??"",onSwitch:ar,onFetch:async()=>{a.localPath&&(await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"fetch",path:a.localPath})}),await ap())},onCreateBranch:()=>an(!0)}),(0,o.jsx)(d7,{commits:ag.commits??[]}),(0,o.jsx)(eb,{localPath:a.localPath,stashes:ag.stashes??[],hasChanges:(ag.changedFiles??[]).length>0,onRefresh:ap})]}):null:(0,o.jsx)("div",{className:"rounded-lg border border-border bg-muted/50 p-3",children:(0,o.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,o.jsx)(dU.AlertCircle,{className:"h-3.5 w-3.5"}),(0,o.jsx)("p",{className:"text-xs",children:c("git.noLocalPath")})]})})})]}),(0,o.jsxs)("div",{className:"p-4",children:[(0,o.jsxs)(z.Button,{variant:"ghost",onClick:()=>i(!h),className:"flex w-full cursor-pointer justify-between px-2 py-2",children:[(0,o.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:c("sidebar.right.browseRepo")}),h?(0,o.jsx)(dO.ChevronDown,{className:"h-3.5 w-3.5 text-muted-foreground"}):(0,o.jsx)(dP.ChevronRight,{className:"h-3.5 w-3.5 text-muted-foreground"})]}),h&&(0,o.jsxs)("div",{className:"mt-3 space-y-3",children:[(0,o.jsxs)(z.Button,{variant:"outline",className:"w-full h-8 gap-1.5 text-xs",onClick:()=>y(!0),children:[(0,o.jsx)(dS.FolderOpen,{className:"h-3.5 w-3.5"}),c("sidebar.right.browseRepo")]}),M.length>0&&(0,o.jsxs)("div",{children:[(0,o.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground mb-1.5 px-1",children:c("sidebar.right.recent")}),(0,o.jsx)("div",{className:"space-y-0.5",children:M.map(b=>(0,o.jsxs)("button",{onClick:()=>{b.id!==a.id&&as(b.workspaceId,b.id)},className:`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left transition-colors ${b.id===a.id?"bg-primary/10 text-primary cursor-default":"hover:bg-accent cursor-pointer"}`,children:["GIT"===b.type?(0,o.jsx)(Y.GitBranch,{className:"h-3 w-3 shrink-0 text-emerald-400"}):(0,o.jsx)(dS.FolderOpen,{className:"h-3 w-3 shrink-0 text-primary/70"}),(0,o.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,o.jsx)("p",{className:"truncate text-xs font-medium text-foreground",children:b.name}),b.localPath&&(0,o.jsx)("p",{className:"truncate text-[10px] font-mono text-muted-foreground",children:b.localPath})]})]},b.id))})]})]})]}),(0,o.jsx)(Q.Dialog,{open:j,onOpenChange:k,children:(0,o.jsxs)(Q.DialogContent,{style:{maxWidth:"32rem"},children:[(0,o.jsx)(Q.DialogHeader,{children:(0,o.jsx)(Q.DialogTitle,{children:c("project.edit")})}),(0,o.jsxs)("div",{className:"space-y-3 py-2",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:c("project.name")}),(0,o.jsx)(V.Input,{value:A,onChange:a=>B(a.target.value),className:"mt-1.5"})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:c("project.type.label")}),(0,o.jsx)("div",{className:"mt-1.5",children:(0,o.jsx)(d4.SegmentedControl,{options:[{value:"FRONTEND",label:c("project.type.frontend")},{value:"BACKEND",label:c("project.type.backend")}],value:I,onChange:J})})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:c("project.alias")}),(0,o.jsx)(V.Input,{value:C,onChange:a=>D(a.target.value),className:"mt-1.5"})]}),(0,o.jsxs)("div",{children:[(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:c("project.description")}),(0,o.jsxs)(z.Button,{type:"button",variant:"ghost",onClick:au,className:`h-6 gap-1 px-2 text-[11px] text-muted-foreground hover:text-foreground ${!G||ae?"opacity-50":""}`,children:[ae?(0,o.jsx)(dV.Loader2,{className:"h-3 w-3 animate-spin"}):(0,o.jsx)(dW.Sparkles,{className:"h-3 w-3"}),ae?c("project.analyzing"):c("project.genDesc")]})]}),(0,o.jsx)(W.Textarea,{value:E,onChange:a=>F(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,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:c("project.localPath")}),(0,o.jsxs)("div",{className:"mt-1.5 flex gap-2",children:[(0,o.jsx)(V.Input,{value:G,onChange:a=>H(a.target.value),placeholder:c("project.localPathPlaceholder"),className:"flex-1 font-mono text-xs"}),(0,o.jsx)(z.Button,{variant:"outline",onClick:()=>y(!0),className:"h-8 shrink-0",children:c("folder.browse")})]})]})]}),(0,o.jsxs)(Q.DialogFooter,{children:[(0,o.jsx)(z.Button,{variant:"outline",onClick:()=>k(!1),children:c("common.cancel")}),(0,o.jsx)(z.Button,{onClick:av,disabled:!A.trim()||ae,className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:c("common.save")})]})]})}),(0,o.jsx)(d3.FolderBrowserDialog,{open:x,onOpenChange:y,onSelect:a=>{j?H(a):(a=>{let b=M.find(b=>b.localPath===a);if(b)return as(b.workspaceId,b.id);let c=a.split("/").filter(Boolean).pop()??"";S(a),U(c),Z(""),_(""),P(!0)})(a)}}),(0,o.jsx)(Q.Dialog,{open:O,onOpenChange:P,children:(0,o.jsxs)(Q.DialogContent,{className:"sm:max-w-md",children:[(0,o.jsx)(Q.DialogHeader,{children:(0,o.jsx)(Q.DialogTitle,{children:c("topbar.newProject")})}),(0,o.jsxs)("div",{className:"space-y-3 py-2",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:c("project.localPath")}),(0,o.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:R})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:c("project.name")}),(0,o.jsx)(V.Input,{value:T,onChange:a=>U(a.target.value),placeholder:c("project.namePlaceholder"),className:"mt-1.5"})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:c("project.type.label")}),(0,o.jsx)("div",{className:"mt-1.5",children:(0,o.jsx)(d4.SegmentedControl,{options:[{value:"FRONTEND",label:c("project.type.frontend")},{value:"BACKEND",label:c("project.type.backend")}],value:aa,onChange:ab})})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:c("project.alias")}),(0,o.jsx)(V.Input,{value:X,onChange:a=>Z(a.target.value),placeholder:c("project.aliasPlaceholder"),className:"mt-1.5"})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:c("project.description")}),(0,o.jsx)(W.Textarea,{value:$,onChange:a=>_(a.target.value),placeholder:c("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,o.jsxs)(Q.DialogFooter,{children:[(0,o.jsx)(z.Button,{variant:"outline",onClick:()=>P(!1),children:c("common.cancel")}),(0,o.jsxs)(z.Button,{onClick:at,disabled:!T.trim()||ac,className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:[ac?(0,o.jsx)(dV.Loader2,{className:"h-3 w-3 animate-spin mr-1"}):null,c("common.create")]})]})]})}),ag?.isGit&&(0,o.jsx)(d5.CreateBranchDialog,{open:am,onOpenChange:an,branches:ag.branches??[],currentBranch:ag.currentBranch??"",localPath:a.localPath,onCreated:async()=>{await ap(),ao(c("git.createSuccess"))},onError:a=>ao(`${c("git.createFailed")}: ${a}`)}),(0,o.jsx)(Q.Dialog,{open:l,onOpenChange:a=>{m(a),a||r("")},children:(0,o.jsxs)(Q.DialogContent,{className:"sm:max-w-md",children:[(0,o.jsx)(Q.DialogHeader,{children:(0,o.jsx)(Q.DialogTitle,{className:"text-rose-400",children:c("project.deleteTitle")})}),(0,o.jsxs)("div",{className:"space-y-3 py-2",children:[(0,o.jsx)("p",{className:"text-sm text-muted-foreground",children:c("project.deleteWarning",{name:a.name})}),(0,o.jsx)("p",{className:"text-sm text-muted-foreground",children:c("project.deleteIrreversible")}),(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:c("project.deleteConfirmLabel")}),(0,o.jsx)(V.Input,{value:n,onChange:a=>r(a.target.value),placeholder:c("project.deleteConfirmPlaceholder"),className:"mt-1.5",autoFocus:!0})]})]}),(0,o.jsxs)(Q.DialogFooter,{children:[(0,o.jsx)(z.Button,{variant:"outline",onClick:()=>m(!1),children:c("common.cancel")}),(0,o.jsxs)(z.Button,{variant:"destructive",disabled:n!==c("project.deleteConfirmText")||s,onClick:async()=>{t(!0);try{await d$(a.id),d2.toast.success(c("project.deleteSuccess")),e.push(`/workspaces/${b}`)}catch{d2.toast.error(c("project.deleteFailed"))}finally{t(!1),m(!1)}},children:[s&&(0,o.jsx)(dV.Loader2,{className:"h-3 w-3 animate-spin mr-1"}),c("project.deleteButton")]})]})]})})]})}function ed({localBranches:a,remoteBranches:b,currentBranch:c,onSwitch:d,onFetch:e,onCreateBranch:f}){let{t:g}=(0,v.useI18n)(),[h,i]=(0,p.useState)(!1),[j,k]=(0,p.useState)(""),[l,m]=(0,p.useState)(!1),n=(0,p.useRef)(null);(0,p.useEffect)(()=>{if(h)return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a);function a(a){n.current&&!n.current.contains(a.target)&&i(!1)}},[h]);let q=j.toLowerCase(),r=a.filter(a=>a.toLowerCase().includes(q)),s=b.filter(a=>a.toLowerCase().includes(q)),t=r.length>0||s.length>0,u=async()=>{m(!0);try{await e()}finally{m(!1)}};return(0,o.jsxs)("div",{children:[(0,o.jsxs)("div",{className:"flex items-center justify-between mb-1.5",children:[(0,o.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:g("git.currentBranch")}),(0,o.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,o.jsx)(z.Button,{variant:"ghost",size:"icon-xs",onClick:u,disabled:l,className:"text-muted-foreground","aria-label":"Fetch",children:(0,o.jsx)(dX.RefreshCw,{className:`h-3 w-3 ${l?"animate-spin":""}`})}),(0,o.jsx)(z.Button,{variant:"ghost",size:"icon-xs",onClick:f,className:"text-muted-foreground","aria-label":g("git.createBranch"),children:(0,o.jsx)(x.Plus,{className:"h-3 w-3"})})]})]}),(0,o.jsxs)("div",{className:"relative",ref:n,children:[(0,o.jsxs)("button",{onClick:()=>{i(!h),k("")},className:"flex w-full items-center justify-between rounded-lg border border-border bg-muted/50 px-3 py-2 text-left transition-colors hover:bg-accent",children:[(0,o.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,o.jsx)(Y.GitBranch,{className:"h-3 w-3 shrink-0 text-emerald-400"}),(0,o.jsx)("span",{className:"truncate font-mono text-xs text-foreground",children:c||"—"})]}),(0,o.jsx)(dO.ChevronDown,{className:`h-3 w-3 shrink-0 text-muted-foreground transition-transform ${h?"rotate-180":""}`})]}),h&&(0,o.jsxs)("div",{className:"absolute left-0 right-0 top-full z-20 mt-1 rounded-lg border border-border bg-popover shadow-xl",children:[(0,o.jsx)("div",{className:"border-b border-border p-1.5",children:(0,o.jsxs)("div",{className:"relative",children:[(0,o.jsx)(y.Search,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3 w-3 text-muted-foreground"}),(0,o.jsx)("input",{value:j,onChange:a=>k(a.target.value),placeholder:"Filter...",autoFocus:!0,className:"h-7 w-full rounded-md bg-muted/50 pl-7 pr-2 text-xs text-foreground placeholder-muted-foreground outline-none focus:ring-1 focus:ring-ring"})]})}),(0,o.jsxs)("div",{className:"max-h-60 overflow-auto py-1",children:[!t&&(0,o.jsx)("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No branches found"}),r.length>0&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("p",{className:"px-3 pt-1.5 pb-1 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:g("git.localBranches")}),r.map(a=>{let b=a===c;return(0,o.jsxs)("button",{onClick:()=>{b||d(a),i(!1)},className:`flex w-full items-center gap-2 px-3 py-1.5 text-left transition-colors ${b?"bg-emerald-500/10 text-emerald-400":"text-secondary-foreground hover:bg-accent"}`,children:[(0,o.jsx)(Y.GitBranch,{className:"h-3 w-3 shrink-0"}),(0,o.jsx)("span",{className:"truncate font-mono text-xs",children:a}),b&&(0,o.jsx)(C.Check,{className:"h-3 w-3 ml-auto shrink-0"})]},`local-${a}`)})]}),s.length>0&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("p",{className:"px-3 pt-2.5 pb-1 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:g("git.remoteBranches")}),s.map(a=>(0,o.jsxs)("button",{onClick:()=>{d(a),i(!1)},className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-secondary-foreground transition-colors hover:bg-accent",children:[(0,o.jsx)(dQ.Globe,{className:"h-3 w-3 shrink-0 text-sky-400"}),(0,o.jsx)("span",{className:"truncate font-mono text-xs",children:a})]},`remote-${a}`))]})]})]})]})]})}let ee=(0,r.default)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);var ef=a.i(236413),eg=a.i(105916),eh=a.i(57726),ei=a.i(224372),ej=a.i(95446),ek=a.i(59711);function el({title:a,description:b,branch:c,baseBranch:d,hasConversation:e,updatedAt:f,onBack:g}){let{t:h}=(0,v.useI18n)();return(0,o.jsxs)("div",{className:"border-b border-border px-4 py-3",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsxs)("div",{className:"flex items-center gap-2",children:[(0,o.jsx)(dW.Sparkles,{className:"h-3.5 w-3.5 text-primary"}),(0,o.jsx)("span",{className:"text-xs font-semibold text-primary",children:h("taskDetail.title")})]}),(0,o.jsxs)(z.Button,{variant:"ghost",onClick:g,className:"flex items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground h-auto px-2 py-1",children:[(0,o.jsx)(ek.ArrowLeft,{className:"h-3.5 w-3.5"}),h("taskDetail.back")]})]}),(0,o.jsx)("h2",{className:"mt-2.5 text-lg font-bold tracking-tight text-foreground",children:a}),b&&(0,o.jsx)("p",{className:"mt-1 text-xs text-muted-foreground line-clamp-2",children:b}),(0,o.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[d?(0,o.jsxs)(N.Badge,{variant:"secondary",className:"bg-muted text-muted-foreground text-[10px] font-mono border border-border",children:[(0,o.jsx)(Y.GitBranch,{className:"mr-1 h-3 w-3"}),d," · worktree"]}):c?(0,o.jsx)(N.Badge,{variant:"secondary",className:"bg-muted text-muted-foreground text-[10px] font-mono border border-border",children:h("taskDetail.directMode")}):null,e&&(0,o.jsx)(N.Badge,{variant:"secondary",className:"bg-emerald-500/10 text-emerald-400 text-[10px] border border-emerald-500/20",children:h("taskDetail.hasConversation")}),(0,o.jsxs)("span",{className:"text-[11px] text-muted-foreground",children:[h("taskDetail.updatedAt")," ",(0,bh.formatRelativeTime)(f)]})]})]})}var em=a.i(641804),en=a.i(569720),eo=a.i(184083),ep=a.i(265738),eq=a.i(515539),er=a.i(828591),es=a.i(211971),et=a.i(762591),eu=a.i(406545),ev=a.i(66938),ew=a.i(809557),ex=a.i(404681),ey=a.i(884284),ez=a.i(208168);let eA=(0,r.default)("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]);var eB=a.i(54709),eC=a.i(722877);let eD=(0,dJ.createServerReference)("401d84528840a0efe84b785291b673985a3aea7903",dJ.callServer,void 0,dJ.findSourceMapURL,"getTaskNotes");var eE=a.i(948639);let eF=(0,dJ.createServerReference)("402877f989e205de8b9ca5ef06e01f7567332b689a",dJ.callServer,void 0,dJ.findSourceMapURL,"getTaskAssets");var eG=a.i(903788),eH=a.i(572059);function eI({taskId:a,projectId:b}){let{t:c}=(0,v.useI18n)(),d=(0,p.useRef)(null),[e,f]=(0,p.useState)([]),[g,h]=(0,p.useState)([]),[i,j]=(0,p.useState)(!1),[k,l]=(0,p.useState)(""),[m,n]=(0,p.useState)(""),[q,r]=(0,p.useState)(!1);async function s(){k.trim()&&(await (0,eC.createNote)({title:k.trim(),content:m.trim(),projectId:b,taskId:a,category:"task"}),l(""),n(""),j(!1),eD(a).then(f))}async function t(a){await (0,eE.deleteNote)(a),f(b=>b.filter(b=>b.id!==a))}async function u(c){let e=c.target.files?.[0];if(e){r(!0);try{let c=new FormData;c.set("file",e),c.set("projectId",b),c.set("taskId",a),await (0,eG.uploadAsset)(c),eF(a).then(h)}finally{r(!1),d.current&&(d.current.value="")}}}async function w(a){await (0,eH.deleteAsset)(a),h(b=>b.filter(b=>b.id!==a))}return(0,p.useEffect)(()=>{eD(a).then(f),eF(a).then(h)},[a]),(0,o.jsx)(R.ScrollArea,{className:"h-full",children:(0,o.jsxs)("div",{className:"flex flex-col",children:[(0,o.jsxs)("div",{className:"border-b border-border px-4 py-3",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsxs)("h3",{className:"flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:[(0,o.jsx)(dR.FileText,{className:"h-3.5 w-3.5"}),c("taskPage.notes")]}),(0,o.jsxs)(z.Button,{variant:"ghost",className:"h-6 gap-1 px-2 text-xs",onClick:()=>j(!i),children:[i?(0,o.jsx)(eB.X,{className:"h-3 w-3"}):(0,o.jsx)(x.Plus,{className:"h-3 w-3"}),i?"":c("taskPage.addNote")]})]}),i&&(0,o.jsxs)("div",{className:"mt-3 space-y-2",children:[(0,o.jsx)("input",{type:"text",value:k,onChange:a=>l(a.target.value),placeholder:c("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,o.jsx)("textarea",{value:m,onChange:a=>n(a.target.value),placeholder:c("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,o.jsx)(z.Button,{className:"text-xs",onClick:s,disabled:!k.trim(),children:c("taskPage.addNote")})]}),(0,o.jsxs)("div",{className:"mt-2 space-y-2",children:[0===e.length&&!i&&(0,o.jsx)("p",{className:"text-xs text-muted-foreground py-2",children:c("taskPage.noNotes")}),e.map(a=>(0,o.jsx)("div",{className:"group rounded-md border border-border bg-card p-3",children:(0,o.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,o.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,o.jsx)("h4",{className:"text-sm font-medium truncate",children:a.title}),a.content&&(0,o.jsx)("p",{className:"mt-1 text-xs text-muted-foreground line-clamp-3 whitespace-pre-wrap",children:a.content}),(0,o.jsx)("p",{className:"mt-1 text-[10px] text-muted-foreground",children:new Date(a.createdAt).toLocaleString()})]}),(0,o.jsx)(z.Button,{variant:"ghost",size:"icon-xs",onClick:()=>t(a.id),className:"shrink-0 text-muted-foreground opacity-0 hover:bg-destructive/10 hover:text-destructive group-hover:opacity-100",title:c("taskPage.deleteNote"),children:(0,o.jsx)(L.Trash2,{className:"h-3.5 w-3.5"})})]})},a.id))]})]}),(0,o.jsxs)("div",{className:"px-4 py-3",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsxs)("h3",{className:"flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:[(0,o.jsx)(eA,{className:"h-3.5 w-3.5"}),c("taskPage.attachments")]}),(0,o.jsxs)(z.Button,{variant:"ghost",className:"h-6 gap-1 px-2 text-xs",onClick:()=>d.current?.click(),disabled:q,children:[(0,o.jsx)(ez.Upload,{className:"h-3 w-3"}),c("taskPage.uploadFile")]}),(0,o.jsx)("input",{ref:d,type:"file",className:"hidden",onChange:u})]}),(0,o.jsxs)("div",{className:"mt-2 space-y-1.5",children:[0===g.length&&(0,o.jsx)("p",{className:"text-xs text-muted-foreground py-2",children:c("taskPage.noAttachments")}),g.map(a=>{var b;return(0,o.jsxs)("div",{className:"group flex items-center gap-2 rounded-md border border-border bg-card px-3 py-2",children:[(0,o.jsx)(eA,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),(0,o.jsx)("span",{className:"flex-1 truncate text-sm",children:a.filename}),(0,o.jsx)("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:(b=a.size)?b<1024?`${b} B`:b<1048576?`${(b/1024).toFixed(1)} KB`:`${(b/1024/1024).toFixed(1)} MB`:""}),(0,o.jsx)(z.Button,{variant:"ghost",size:"icon-xs",onClick:()=>w(a.id),className:"shrink-0 text-muted-foreground opacity-0 hover:bg-destructive/10 hover:text-destructive group-hover:opacity-100",title:c("taskPage.deleteAttachment"),children:(0,o.jsx)(L.Trash2,{className:"h-3 w-3"})})]},a.id)})]})]})]})})}function eJ({task:a,workspaceId:b,projectLocalPath:c,onClose:d}){let{t:e}=(0,v.useI18n)(),f=(0,q.useRouter)(),{removePortal:g}=(0,eo.useTerminalPortal)(),[h,i]=(0,p.useState)("terminal"),[j,k]=(0,p.useState)(null),[l,m]=(0,p.useState)(!1),[n,r]=(0,p.useState)(a.status);(0,p.useEffect)(()=>{r(a.status)},[a.status]);let[s,t]=(0,p.useState)(null),[u,w]=(0,p.useState)(!1),[x,y]=(0,p.useState)(!1),[A,B]=(0,p.useState)([]);(0,p.useEffect)(()=>{t(null),w(!1),y(!1),B([]),k(null),i("terminal")},[a.id]);let[C,D]=(0,p.useState)([]),[E,F]=(0,p.useState)(null);(0,p.useEffect)(()=>{let a=!1;return(0,ex.getPrompts)().then(b=>{if(a)return;D(b.map(a=>({id:a.id,name:a.name,isDefault:a.isDefault})));let c=b.find(a=>a.isDefault);c&&F(c.id)}),()=>{a=!0}},[]),(0,p.useEffect)(()=>{t(null),y(!1);let b=!1;return(0,ep.getTaskExecutions)(a.id).then(a=>{if(b)return;let d=a[0];if(d?.status==="RUNNING"){let a=d.worktreePath||c||null;a&&t(a)}B(a.filter(a=>"RUNNING"!==a.status)),y(!0)}),()=>{b=!0}},[a.id]),(0,p.useEffect)(()=>{if("changes"!==h||"TODO"===n||"CANCELLED"===n)return;let b=!1;return m(!0),fetch(`/api/tasks/${a.id}/diff`).then(a=>{if(!a.ok)throw Error(`HTTP ${a.status}`);return a.json()}).then(a=>{b||k(a?.files||a?.branchDeleted?a:null)}).catch(()=>{b||k(null)}).finally(()=>{b||m(!1)}),()=>{b=!0}},[h,n,a.id]);let G=(0,p.useCallback)(async()=>{if(!u){w(!0);try{let{worktreePath:b}=await (0,eq.startPtyExecution)(a.id,"",E);t(b),r("IN_PROGRESS")}catch(a){w(!1),d2.toast.error(a instanceof Error?a.message:String(a))}}},[a.id,u,E]),H=(0,p.useCallback)(b=>{w(!1),t(null),g(a.id),0===b&&r("IN_REVIEW"),(0,ep.getTaskExecutions)(a.id).then(a=>{B(a.filter(a=>"RUNNING"!==a.status))}),f.refresh()},[f,a.id]),I=(0,p.useCallback)(async()=>{await (0,er.stopPtyExecution)(a.id),w(!1),t(null),r("IN_REVIEW"),(0,ep.getTaskExecutions)(a.id).then(a=>{B(a.filter(a=>"RUNNING"!==a.status))}),f.refresh()},[a.id,f]),J=(0,p.useCallback)(async b=>{w(!0),g(a.id),t(null);try{let{worktreePath:c}=await (0,es.resumePtyExecution)(a.id,b);t(c),r("IN_PROGRESS")}catch{w(!1)}},[a.id,g]),K=(0,p.useCallback)(async()=>{w(!0),g(a.id),t(null);try{let{worktreePath:b}=await (0,et.continueLatestPtyExecution)(a.id);t(b),r("IN_PROGRESS")}catch(a){w(!1),d2.toast.error(a instanceof Error?a.message:String(a))}},[a.id,g]),[L,M]=(0,p.useState)(!1),[N,O]=(0,p.useState)([]),P=(0,p.useCallback)(async()=>{try{let b=await (0,ev.checkWorktreeClean)(a.id);if(b.hasWorktree&&!b.clean)return void d2.toast.error(e("taskPage.uncommittedChanges",{count:String(b.files.length)}));if(b.hasWorktree&&b.clean&&!b.hasCommits)return void d2.toast.error(e("taskPage.noChangesToComplete"));if(b.hasWorktree&&b.hasCommits){O(b.commitLog),M(!0);return}await (0,eu.updateTaskStatus)(a.id,"DONE"),r("DONE"),d2.toast.success(e("taskPage.taskCompleted")),f.refresh()}catch{d2.toast.error("Failed to complete task")}},[a.id,f,e]),Q=(0,p.useCallback)(()=>{r("DONE"),M(!1),d2.toast.success(e("taskPage.taskCompleted")),f.refresh()},[f,e]),S=(0,p.useCallback)(async b=>{try{let{hash:c}=await (0,ew.commitWorktreeChanges)(a.id,b);d2.toast.success(e("diff.commitSuccess",{hash:c})),f.refresh();let d=await fetch(`/api/tasks/${a.id}/diff`);if(d.ok){let a=await d.json();k(a?.files?a:null)}}catch(a){d2.toast.error(a instanceof Error?a.message:"Commit failed")}},[a.id,f,e]);return(0,o.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,o.jsx)(el,{title:a.title,description:e("taskDetail.panelDescription"),branch:`task/${a.id}`,baseBranch:a.baseBranch,hasConversation:!1,updatedAt:a.updatedAt,onBack:d}),(0,o.jsxs)("div",{className:"flex items-center justify-between border-b border-border px-4 py-2",children:[(0,o.jsxs)("div",{className:"flex gap-1",children:[(0,o.jsxs)("button",{onClick:()=>i("terminal"),className:`flex items-center gap-1.5 px-3 py-1 text-xs font-medium rounded-md ${"terminal"===h?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,o.jsx)(ef.Terminal,{className:"h-3 w-3"}),e("terminal.execute")]}),(0,o.jsx)("button",{onClick:()=>i("changes"),className:`px-3 py-1 text-xs font-medium rounded-md ${"changes"===h?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:e("taskPage.changes")}),(0,o.jsxs)("button",{onClick:()=>i("notes"),className:`flex items-center gap-1.5 px-3 py-1 text-xs font-medium rounded-md ${"notes"===h?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,o.jsx)(dR.FileText,{className:"h-3 w-3"}),e("taskPage.notes")]})]}),(0,o.jsxs)("div",{className:"flex items-center gap-2",children:["IN_REVIEW"===n&&(0,o.jsxs)(z.Button,{size:"sm",onClick:P,className:"bg-emerald-500/15 text-emerald-400 ring-1 ring-emerald-500/20 hover:bg-emerald-500/25",children:[(0,o.jsx)(eh.CheckCircle2,{className:"h-3 w-3"}),e("taskPage.completeTask")]}),"DONE"!==n&&"CANCELLED"!==n&&(0,o.jsxs)(z.Button,{variant:"ghost",size:"sm",onClick:()=>f.push(`/workspaces/${b}/tasks/${a.id}`),className:"text-muted-foreground",children:[(0,o.jsx)(ee,{className:"h-3 w-3"}),e("taskPage.viewDetails")]})]})]}),"terminal"===h?(0,o.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:x?s?(0,o.jsxs)("div",{className:"flex h-full flex-col overflow-hidden",children:[(0,o.jsxs)("div",{className:"shrink-0 flex items-center justify-between border-b border-neutral-800 px-3 py-2 bg-[#0f1419]",children:[(0,o.jsxs)("span",{className:"flex items-center gap-1.5 text-xs text-emerald-400",children:[(0,o.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"}),e("execution.running")]}),(0,o.jsxs)(ej.Tooltip,{children:[(0,o.jsxs)(ej.TooltipTrigger,{onClick:I,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,o.jsx)(eg.Square,{className:"h-3 w-3"}),e("terminal.stopExecution")]}),(0,o.jsx)(ej.TooltipContent,{side:"bottom",children:e("terminal.stopHint")})]})]}),(0,o.jsx)("div",{className:"flex-1 min-h-0",children:(0,o.jsx)(eo.TerminalOutlet,{taskId:a.id,worktreePath:s,onSessionEnd:H})})]}):"DONE"===n||"CANCELLED"===n?(0,o.jsx)("div",{className:"flex h-full flex-col overflow-hidden",children:(0,o.jsx)(R.ScrollArea,{className:"flex-1 min-h-0",children:(0,o.jsx)(ey.ExecutionTimeline,{executions:A})})}):(0,o.jsxs)("div",{className:"flex h-full flex-col overflow-hidden",children:[(0,o.jsxs)("div",{className:"shrink-0 flex items-center gap-2 border-b border-border px-4 py-3",children:[C.length>0&&(0,o.jsxs)(ei.Select,{defaultValue:E??"none",onValueChange:a=>F("none"===a?null:a),children:[(0,o.jsx)(ei.SelectTrigger,{size:"sm",className:"min-w-[120px]",children:(0,o.jsx)("span",{className:"text-left truncate",children:E?C.find(a=>a.id===E)?.name??e("terminal.noPrompt"):e("terminal.noPrompt")})}),(0,o.jsxs)(ei.SelectContent,{className:"min-w-[200px]",children:[(0,o.jsx)(ei.SelectItem,{value:"none",children:e("terminal.noPrompt")}),C.map(a=>(0,o.jsxs)(ei.SelectItem,{value:a.id,children:[a.name,a.isDefault?" ★":""]},a.id))]})]},`prompt-${C.length}`),(0,o.jsxs)(z.Button,{onClick:G,disabled:u,size:"sm",className:"gap-2 px-4",children:[u?(0,o.jsx)(dV.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):(0,o.jsx)(ef.Terminal,{className:"h-3.5 w-3.5"}),u?e("terminal.executing"):e("terminal.launch")]})]}),(0,o.jsx)(R.ScrollArea,{className:"flex-1 min-h-0",children:(0,o.jsx)(ey.ExecutionTimeline,{executions:A,onResume:J,onContinueLatest:K})})]}):(0,o.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-2 bg-[#0f1419]",children:[(0,o.jsx)(dV.Loader2,{className:"size-5 animate-spin text-neutral-500"}),(0,o.jsx)("span",{className:"text-xs text-neutral-500",children:e("execution.loading")})]})}):"changes"===h?(0,o.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:l?(0,o.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,o.jsx)("p",{className:"text-sm text-muted-foreground",children:e("taskPage.loadingDiff")})}):j?.branchDeleted?(0,o.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,o.jsx)("p",{className:"text-sm text-muted-foreground",children:e("taskPage.branchDeleted")})}):j?(0,o.jsx)(em.TaskDiffView,{files:j.files,totalAdded:j.totalAdded,totalRemoved:j.totalRemoved,hasConflicts:j.hasConflicts,conflictFiles:j.conflictFiles,onCommit:S,hasUncommitted:j.hasUncommitted}):(0,o.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,o.jsx)("p",{className:"text-sm text-muted-foreground",children:e("taskPage.noChanges")})})}):"notes"===h?(0,o.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:(0,o.jsx)(eI,{taskId:a.id,projectId:a.projectId})}):null,(0,o.jsx)(en.TaskMergeConfirmDialog,{open:L,onOpenChange:M,taskId:a.id,taskTitle:a.title,baseBranch:a.baseBranch??"main",fileCount:j?.files?.length??0,commitCount:j?.commitCount??0,commitLog:N,onMergeComplete:Q})]})}let eK=(0,dJ.createServerReference)("40a9f909ac43b28bb728c3b80f7c3e02a2bcec5e33",dJ.callServer,void 0,dJ.findSourceMapURL,"createTask"),eL=(0,dJ.createServerReference)("605226e55b83b6d9fa6ea0ec5a337b4f607bd4c4b4",dJ.callServer,void 0,dJ.findSourceMapURL,"updateTask"),eM=(0,dJ.createServerReference)("40e79d3468fc55fc27a69f6058d0d2a871bd0b7de4",dJ.callServer,void 0,dJ.findSourceMapURL,"deleteTask"),eN=(0,dJ.createServerReference)("40b5ceb408602db0ddb6f2b625450abf5cd706d849",dJ.callServer,void 0,dJ.findSourceMapURL,"toggleTaskPinned");var eO=a.i(769726);function eP({projects:a,activeProjectId:b,onSelect:c}){let d=(0,p.useRef)(null),[e,f]=(0,p.useState)(!1),[g,h]=(0,p.useState)(!1),i=()=>{let a=d.current;a&&(f(a.scrollLeft>0),h(a.scrollLeft<a.scrollWidth-a.clientWidth-1))};(0,p.useEffect)(()=>{i();let a=d.current;if(a){a.addEventListener("scroll",i);let b=new ResizeObserver(i);return b.observe(a),()=>{a.removeEventListener("scroll",i),b.disconnect()}}},[a]);let j=a=>{let b=d.current;b&&b.scrollBy({left:"left"===a?-150:150,behavior:"smooth"})};return(0,o.jsxs)("div",{className:"relative flex items-center",children:[e&&(0,o.jsx)("button",{onClick:()=>j("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,o.jsx)(eO.ChevronLeft,{className:"h-4 w-4"})}),(0,o.jsx)("div",{ref:d,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=>{let d=b===a.id;return(0,o.jsxs)("button",{onClick:()=>{d||c(a.id)},className:`shrink-0 rounded-lg border-b-2 px-4 py-2 text-sm font-medium transition-colors ${d?"border-primary bg-primary/10 text-primary ring-1 ring-primary/20 cursor-default":"border-transparent text-muted-foreground hover:bg-accent hover:text-foreground cursor-pointer"}`,children:[(0,o.jsx)("span",{children:a.name}),a.alias&&(0,o.jsx)("span",{className:"ml-1.5 text-xs text-muted-foreground font-normal",children:a.alias})]},a.id)})}),g&&(0,o.jsx)("button",{onClick:()=>j("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,o.jsx)(dP.ChevronRight,{className:"h-4 w-4"})})]})}a.s(["BoardPageClient",0,function({workspaceId:a,projectId:b,project:c,projects:d,initialTasks:e,labels:f,openTaskId:g}){let h=(0,q.useRouter)(),[,i]=(0,p.useTransition)(),[j,k]=(0,p.useState)(""),[l,m]=(0,p.useState)(!1),[n,r]=(0,p.useState)("TODO"),[s,t]=(0,p.useState)(g?e.find(a=>a.id===g)??null:null),[u,v]=(0,p.useState)(null),x=(0,p.useCallback)(()=>{i(()=>{h.refresh()})},[h]);(0,p.useEffect)(()=>{if(l)return;let a=setInterval(()=>{i(()=>{h.refresh()})},5e3);return()=>clearInterval(a)},[h,l]);let y=(0,p.useCallback)(a=>{k(a)},[]),z=(0,p.useCallback)(async(a,b)=>{await (0,eu.updateTaskStatus)(a,b),s?.id===a&&t({...s,status:b}),x()},[x,s]),B=(0,p.useCallback)(async a=>{await eK({title:a.title,description:a.description,projectId:b,priority:a.priority,status:a.status,labelIds:a.labelIds,baseBranch:a.baseBranch,subPath:a.subPath}),x()},[b,x]),C=(0,p.useCallback)(async(a,b)=>{await eL(a,{...b,labelIds:b.labelIds}),v(null),x()},[x]),E=(0,p.useCallback)(async a=>{await eM(a),s?.id===a&&t(null),x()},[x,s]),F=(0,p.useCallback)(async a=>{await eN(a),x()},[x]),G=(0,p.useCallback)(async b=>{try{await (0,eq.startPtyExecution)(b,"")}catch(a){d2.toast.error(a instanceof Error?a.message:String(a))}h.push(`/workspaces/${a}/tasks/${b}`)},[h,a]),H=(0,p.useCallback)(async(a,b)=>{await (0,eu.updateTaskStatus)(a,b),s?.id===a&&t({...s,status:b}),x()},[x,s]),I=(0,p.useCallback)(a=>{r(a),v(null),m(!0)},[]),J=(0,p.useCallback)(a=>{v(a),m(!0)},[]),K=e.filter(a=>!a.labels?.some(a=>a.label.name===D.TOWER_LABEL_NAME&&a.label.isBuiltin)),L=j.trim()?K.filter(a=>{let b=j.toLowerCase();return a.title.toLowerCase().includes(b)||(a.description?.toLowerCase().includes(b)??!1)}):K;return(0,o.jsxs)("div",{className:"flex h-full",children:[(0,o.jsxs)("div",{className:"flex flex-1 flex-col overflow-hidden",children:[(0,o.jsx)("div",{className:"px-6 pt-3 pb-1",children:(0,o.jsx)(eP,{projects:d,activeProjectId:b,onSelect:b=>h.push(`/workspaces/${a}?projectId=${b}`,{scroll:!1})})}),(0,o.jsx)(w,{totalTasks:K.length,runningTasks:K.filter(a=>"IN_PROGRESS"===a.status).length}),(0,o.jsx)(A,{searchQuery:j,onSearchChange:y,onCreateTask:()=>{v(null),m(!0)}}),(0,o.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden p-4",children:(0,o.jsx)(U,{initialTasks:L,onTaskMove:z,onTaskClick:a=>{t(a)},onEditTask:J,onAddTask:I,onDeleteTask:E,onTogglePin:F,workspaceId:a,onContextMenuStatusChange:H,onContextMenuLaunch:G})}),(0,o.jsx)(dN,{open:l,onOpenChange:a=>{m(a),a||v(null)},onSubmit:B,onUpdate:C,defaultStatus:n,editTask:u,editTaskLabelIds:u?.labels?u.labels.map(a=>a.labelId):[],labels:f.filter(a=>!(a.name===D.TOWER_LABEL_NAME&&a.isBuiltin)),projectType:c.type,projectLocalPath:c.localPath})]}),s?(0,o.jsx)(eJ,{task:s,workspaceId:a,projectLocalPath:c.localPath,onClose:()=>t(null)}):(0,o.jsx)(ec,{project:c,workspaceId:a})]})}],257179)}];
6
6
 
7
7
  //# sourceMappingURL=project_f_tower_src_app_workspaces_%5BworkspaceId%5D_board-page-client_tsx_0jmj1xz._.js.map