tower-studio 0.1.12 → 0.1.13

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 (163) 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/diagnostics/route-bundle-stats.json +38 -38
  6. package/.next/fallback-build-manifest.json +3 -3
  7. package/.next/prerender-manifest.json +3 -3
  8. package/.next/server/app/_global-error.html +1 -1
  9. package/.next/server/app/_global-error.rsc +1 -1
  10. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  12. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  13. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  14. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  15. package/.next/server/app/_not-found/page/react-loadable-manifest.json +1 -1
  16. package/.next/server/app/_not-found/page/server-reference-manifest.json +25 -25
  17. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  18. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  19. package/.next/server/app/_not-found.html +1 -1
  20. package/.next/server/app/_not-found.rsc +13 -13
  21. package/.next/server/app/_not-found.segments/_full.segment.rsc +13 -13
  22. package/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
  23. package/.next/server/app/_not-found.segments/_index.segment.rsc +8 -8
  24. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  25. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
  26. package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  27. package/.next/server/app/index.html +1 -1
  28. package/.next/server/app/index.rsc +13 -13
  29. package/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  30. package/.next/server/app/index.segments/_full.segment.rsc +13 -13
  31. package/.next/server/app/index.segments/_head.segment.rsc +4 -4
  32. package/.next/server/app/index.segments/_index.segment.rsc +8 -8
  33. package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  34. package/.next/server/app/missions/page/react-loadable-manifest.json +1 -1
  35. package/.next/server/app/missions/page/server-reference-manifest.json +55 -55
  36. package/.next/server/app/missions/page.js.nft.json +1 -1
  37. package/.next/server/app/missions/page_client-reference-manifest.js +1 -1
  38. package/.next/server/app/onboarding/page/react-loadable-manifest.json +1 -1
  39. package/.next/server/app/onboarding/page/server-reference-manifest.json +25 -25
  40. package/.next/server/app/onboarding/page.js.nft.json +1 -1
  41. package/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
  42. package/.next/server/app/onboarding.html +1 -1
  43. package/.next/server/app/onboarding.rsc +15 -15
  44. package/.next/server/app/onboarding.segments/_full.segment.rsc +15 -15
  45. package/.next/server/app/onboarding.segments/_head.segment.rsc +4 -4
  46. package/.next/server/app/onboarding.segments/_index.segment.rsc +8 -8
  47. package/.next/server/app/onboarding.segments/_tree.segment.rsc +1 -1
  48. package/.next/server/app/onboarding.segments/onboarding/__PAGE__.segment.rsc +4 -4
  49. package/.next/server/app/onboarding.segments/onboarding.segment.rsc +3 -3
  50. package/.next/server/app/page/react-loadable-manifest.json +1 -1
  51. package/.next/server/app/page/server-reference-manifest.json +25 -25
  52. package/.next/server/app/page.js.nft.json +1 -1
  53. package/.next/server/app/page_client-reference-manifest.js +1 -1
  54. package/.next/server/app/settings/page/react-loadable-manifest.json +1 -1
  55. package/.next/server/app/settings/page/server-reference-manifest.json +34 -34
  56. package/.next/server/app/settings/page.js.nft.json +1 -1
  57. package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  58. package/.next/server/app/settings.html +1 -1
  59. package/.next/server/app/settings.rsc +15 -15
  60. package/.next/server/app/settings.segments/_full.segment.rsc +15 -15
  61. package/.next/server/app/settings.segments/_head.segment.rsc +4 -4
  62. package/.next/server/app/settings.segments/_index.segment.rsc +8 -8
  63. package/.next/server/app/settings.segments/_tree.segment.rsc +1 -1
  64. package/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +4 -4
  65. package/.next/server/app/settings.segments/settings.segment.rsc +3 -3
  66. package/.next/server/app/workspaces/[workspaceId]/archive/page/react-loadable-manifest.json +1 -1
  67. package/.next/server/app/workspaces/[workspaceId]/archive/page/server-reference-manifest.json +77 -77
  68. package/.next/server/app/workspaces/[workspaceId]/archive/page.js.nft.json +1 -1
  69. package/.next/server/app/workspaces/[workspaceId]/archive/page_client-reference-manifest.js +1 -1
  70. package/.next/server/app/workspaces/[workspaceId]/assets/page/react-loadable-manifest.json +1 -1
  71. package/.next/server/app/workspaces/[workspaceId]/assets/page/server-reference-manifest.json +72 -72
  72. package/.next/server/app/workspaces/[workspaceId]/assets/page.js.nft.json +1 -1
  73. package/.next/server/app/workspaces/[workspaceId]/assets/page_client-reference-manifest.js +1 -1
  74. package/.next/server/app/workspaces/[workspaceId]/notes/page/react-loadable-manifest.json +1 -1
  75. package/.next/server/app/workspaces/[workspaceId]/notes/page/server-reference-manifest.json +57 -57
  76. package/.next/server/app/workspaces/[workspaceId]/notes/page.js.nft.json +1 -1
  77. package/.next/server/app/workspaces/[workspaceId]/notes/page_client-reference-manifest.js +1 -1
  78. package/.next/server/app/workspaces/[workspaceId]/page/react-loadable-manifest.json +1 -1
  79. package/.next/server/app/workspaces/[workspaceId]/page/server-reference-manifest.json +53 -53
  80. package/.next/server/app/workspaces/[workspaceId]/page.js.nft.json +1 -1
  81. package/.next/server/app/workspaces/[workspaceId]/page_client-reference-manifest.js +1 -1
  82. package/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page/react-loadable-manifest.json +1 -1
  83. package/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page/server-reference-manifest.json +25 -25
  84. package/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page.js.nft.json +1 -1
  85. package/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page_client-reference-manifest.js +1 -1
  86. package/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page/react-loadable-manifest.json +1 -1
  87. package/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page/server-reference-manifest.json +58 -58
  88. package/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page.js.nft.json +1 -1
  89. package/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
  90. package/.next/server/app/workspaces/page/react-loadable-manifest.json +1 -1
  91. package/.next/server/app/workspaces/page/server-reference-manifest.json +43 -43
  92. package/.next/server/app/workspaces/page.js.nft.json +1 -1
  93. package/.next/server/app/workspaces/page_client-reference-manifest.js +1 -1
  94. package/.next/server/chunks/0uz~_next_dist_esm_build_templates_app-route_05yec2y.js +2 -2
  95. package/.next/server/chunks/[root-of-the-server]__0~33o~m._.js +1 -1
  96. package/.next/server/chunks/project_f_tower_0n1s3ym._.js +1 -1
  97. package/.next/server/chunks/project_f_tower_src_11e.cv5._.js +1 -1
  98. package/.next/server/chunks/ssr/04uy_src_app_workspaces_[workspaceId]_tasks_[taskId]_task-page-client_tsx_01.s1p0._.js +1 -1
  99. package/.next/server/chunks/ssr/0y0r_f_tower_src_app_workspaces_[workspaceId]_assets_assets-page-client_tsx_0n4g3bn._.js +1 -1
  100. package/.next/server/chunks/ssr/[root-of-the-server]__06qzctf._.js +1 -1
  101. package/.next/server/chunks/ssr/[root-of-the-server]__0ffdrwp._.js +1 -1
  102. package/.next/server/chunks/ssr/[root-of-the-server]__0fwuc5u._.js +1 -1
  103. package/.next/server/chunks/ssr/[root-of-the-server]__0i4rk9v._.js +3 -3
  104. package/.next/server/chunks/ssr/[root-of-the-server]__0nmyvwk._.js +1 -1
  105. package/.next/server/chunks/ssr/{[root-of-the-server]__08meal1._.js → [root-of-the-server]__0p59u95._.js} +2 -2
  106. package/.next/server/chunks/ssr/{[root-of-the-server]__0la.lch._.js → [root-of-the-server]__0ukbsy0._.js} +2 -2
  107. package/.next/server/chunks/ssr/[root-of-the-server]__0w7gbe7._.js +1 -1
  108. package/.next/server/chunks/ssr/{[root-of-the-server]__0p~~40h._.js → [root-of-the-server]__118z55s._.js} +2 -2
  109. package/.next/server/chunks/ssr/[root-of-the-server]__11j4k9o._.js +1 -1
  110. package/.next/server/chunks/ssr/[root-of-the-server]__13cjs8r._.js +1 -1
  111. package/.next/server/chunks/ssr/[root-of-the-server]__13eo85g._.js +1 -1
  112. package/.next/server/chunks/ssr/project_f_tower_0.txwd8._.js +1 -1
  113. package/.next/server/chunks/ssr/{project_f_tower_0ifpw8k._.js → project_f_tower_0d_85uz._.js} +2 -2
  114. package/.next/server/chunks/ssr/project_f_tower_0f0-wva._.js +1 -1
  115. package/.next/server/chunks/ssr/{project_f_tower_0.k8r5w._.js → project_f_tower_0fdpm0.._.js} +2 -2
  116. package/.next/server/chunks/ssr/{project_f_tower_0ron~f-._.js → project_f_tower_0gp-92y._.js} +2 -2
  117. package/.next/server/chunks/ssr/project_f_tower_0hgtev9._.js +1 -1
  118. package/.next/server/chunks/ssr/project_f_tower_0ivvjwd._.js +1 -1
  119. package/.next/server/chunks/ssr/project_f_tower_0jy~1uf._.js +1 -1
  120. package/.next/server/chunks/ssr/project_f_tower_0l6ssf8._.js +1 -1
  121. package/.next/server/chunks/ssr/project_f_tower_0o5.y1e._.js +1 -1
  122. package/.next/server/chunks/ssr/{project_f_tower_0dfyjgz._.js → project_f_tower_0qe3y7w._.js} +2 -2
  123. package/.next/server/chunks/ssr/project_f_tower_0ym-aea._.js +1 -1
  124. package/.next/server/chunks/ssr/{project_f_tower_0c6n7oo._.js → project_f_tower_103i_mo._.js} +2 -2
  125. package/.next/server/chunks/ssr/{project_f_tower_0t0smg9._.js → project_f_tower_11iv6rj._.js} +2 -2
  126. package/.next/server/chunks/ssr/{project_f_tower_src_0_g15e8._.js → project_f_tower_src_0dhz712._.js} +2 -2
  127. package/.next/server/chunks/ssr/project_f_tower_src_actions_agent-actions_ts_0.s4~m-._.js +1 -1
  128. package/.next/server/chunks/ssr/project_f_tower_src_actions_file-actions_ts_02i742t._.js +1 -1
  129. package/.next/server/chunks/ssr/project_f_tower_src_app_missions_missions-client_tsx_0ums4qx._.js +1 -1
  130. package/.next/server/chunks/ssr/project_f_tower_src_app_onboarding_page_tsx_0_9_yoq._.js +1 -1
  131. package/.next/server/chunks/ssr/project_f_tower_src_app_settings_page_tsx_0oo06~d._.js +1 -1
  132. package/.next/server/chunks/ssr/project_f_tower_src_app_workspaces_[workspaceId]_board-page-client_tsx_0jmj1xz._.js +1 -1
  133. package/.next/server/middleware-build-manifest.js +3 -3
  134. package/.next/server/pages/404.html +1 -1
  135. package/.next/server/pages/500.html +1 -1
  136. package/.next/server/server-reference-manifest.js +1 -1
  137. package/.next/server/server-reference-manifest.json +232 -232
  138. package/.next/static/chunks/09k2v2gb9asa~.js +1 -0
  139. package/.next/static/chunks/{09hs9w6-77im2.js → 0b2l7e_-hz6uu.js} +1 -1
  140. package/.next/static/chunks/0d8czythhy15~.js +1 -0
  141. package/.next/static/chunks/{15zclhqyib88_.js → 0hbu0b_cpu234.js} +1 -1
  142. package/.next/static/chunks/{0im8~yii0.2mn.js → 0i-bk-_pxq3kf.js} +1 -1
  143. package/.next/static/chunks/0qz9.02.c_xy9.js +1 -0
  144. package/.next/static/chunks/0s.v9zvpavx.p.js +1 -0
  145. package/.next/static/chunks/{00atyrg-7i0hj.js → 0svo2_2.iajx0.js} +1 -1
  146. package/.next/static/chunks/{0-plp~pgpcel9.js → 0ufq5z-zsc_rq.js} +1 -1
  147. package/.next/static/chunks/{01mymnegugktp.js → 0uvcabj7_ht1m.js} +1 -1
  148. package/.next/static/chunks/{0d.3wv6u.2g~6.js → 0v6j_niujykvw.js} +1 -1
  149. package/.next/static/chunks/{0c49o.5w_cw8_.js → 0zk37-fhd4h6q.js} +1 -1
  150. package/.next/static/chunks/{0qp~1_kfjklfg.js → 11y66l77sw_f_.js} +1 -1
  151. package/.next/static/chunks/{09p7-kr_vidww.js → 150hyh9in9gbd.js} +1 -1
  152. package/.next/static/chunks/{0vs5vey5ni44t.js → 160iuo21rl~gx.js} +1 -1
  153. package/.next/trace +2 -2
  154. package/.next/trace-build +1 -1
  155. package/bin/tower.mjs +32 -1
  156. package/package.json +1 -1
  157. package/.next/static/chunks/0.do_z22ngnjd.js +0 -1
  158. package/.next/static/chunks/09hxu-k8oyivu.js +0 -1
  159. package/.next/static/chunks/0kbuf91gryyo2.js +0 -1
  160. package/.next/static/chunks/0p~3m91-t6p91.js +0 -1
  161. /package/.next/static/{jMxcHfsOSldWKgvAjGnAv → z3fBPUSyN4JFEFJowhSmx}/_buildManifest.js +0 -0
  162. /package/.next/static/{jMxcHfsOSldWKgvAjGnAv → z3fBPUSyN4JFEFJowhSmx}/_clientMiddlewareManifest.js +0 -0
  163. /package/.next/static/{jMxcHfsOSldWKgvAjGnAv → z3fBPUSyN4JFEFJowhSmx}/_ssgManifest.js +0 -0
@@ -2,4 +2,4 @@
2
2
 
3
3
  If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
4
4
 
5
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return h.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},r4=({contentRef:e,descriptionId:t})=>{let r=r5("DialogDescriptionWarning"),n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${r.contentName}}.`;return h.useEffect(()=>{let r=e.current?.getAttribute("aria-describedby");t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},r8=Symbol.for("react.lazy"),r9=h[" use ".trim().toString()];function r7(e){var t;return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===r8&&"_payload"in e&&"object"==typeof(t=e._payload)&&null!==t&&"then"in t}var r6=Symbol("radix.slottable");function ne(e){return h.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===r6}var nt=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var r,n;let a,s,o,i=(n=r=`Primitive.${t}`,(a=h.forwardRef((e,t)=>{let{children:r,...n}=e;if(r7(r)&&"function"==typeof r9&&(r=r9(r._payload)),h.isValidElement(r)){var a;let e,s,o=(a=r,(s=(e=Object.getOwnPropertyDescriptor(a.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?a.ref:(s=(e=Object.getOwnPropertyDescriptor(a,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?a.props.ref:a.props.ref||a.ref),i=function(e,t){let r={...t};for(let n in t){let a=e[n],s=t[n];/^on[A-Z]/.test(n)?a&&s?r[n]=(...e)=>{let t=s(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...s}:"className"===n&&(r[n]=[a,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==h.Fragment&&(i.ref=t?tv(t,o):o),h.cloneElement(r,i)}return h.Children.count(r)>1?h.Children.only(null):null})).displayName=`${n}.SlotClone`,s=a,(o=h.forwardRef((e,t)=>{let{children:r,...n}=e;r7(r)&&"function"==typeof r9&&(r=r9(r._payload));let a=h.Children.toArray(r),o=a.find(ne);if(o){let e=o.props.children,r=a.map(t=>t!==o?t:h.Children.count(e)>1?h.Children.only(null):h.isValidElement(e)?e.props.children:null);return(0,f.jsx)(s,{...n,ref:t,children:h.isValidElement(e)?h.cloneElement(e,void 0,r):null})}return(0,f.jsx)(s,{...n,ref:t,children:r})})).displayName=`${r}.Slot`,o),l=h.forwardRef((e,r)=>{let{asChild:n,...a}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,f.jsx)(n?i:t,{...a,ref:r})});return l.displayName=`Primitive.${t}`,{...e,[t]:l}},{}),nr='[cmdk-group=""]',nn='[cmdk-group-items=""]',na='[cmdk-item=""]',ns=`${na}:not([aria-disabled="true"])`,no="cmdk-item-select",ni="data-value",nl=(e,t,r)=>{var n;return n=e,function e(t,r,n,a,s,o,i){if(o===r.length)return s===t.length?1:.99;var l=`${s},${o}`;if(void 0!==i[l])return i[l];for(var c,d,u,m,p=a.charAt(o),f=n.indexOf(p,s),h=0;f>=0;)(c=e(t,r,n,a,f+1,o+1,i))>h&&(f===s?c*=1:tu.test(t.charAt(f-1))?(c*=.8,(u=t.slice(s,f-1).match(tm))&&s>0&&(c*=Math.pow(.999,u.length))):tp.test(t.charAt(f-1))?(c*=.9,(m=t.slice(s,f-1).match(tf))&&s>0&&(c*=Math.pow(.999,m.length))):(c*=.17,s>0&&(c*=Math.pow(.999,f-s))),t.charAt(f)!==r.charAt(o)&&(c*=.9999)),(c<.1&&n.charAt(f-1)===a.charAt(o+1)||a.charAt(o+1)===a.charAt(o)&&n.charAt(f-1)!==a.charAt(o))&&.1*(d=e(t,r,n,a,f+1,o+2,i))>c&&(c=.1*d),c>h&&(h=c),f=n.indexOf(p,f+1);return i[l]=h,h}(n=r&&r.length>0?`${n+" "+r.join(" ")}`:n,t,th(n),th(t),0,0,{})},nc=h.createContext(void 0),nd=h.createContext(void 0),nu=h.createContext(void 0),nm=h.forwardRef((e,t)=>{let r=nN(()=>{var t,r;return{search:"",value:null!=(r=null!=(t=e.value)?t:e.defaultValue)?r:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),n=nN(()=>new Set),a=nN(()=>new Map),s=nN(()=>new Map),o=nN(()=>new Set),i=ny(e),{label:l,children:c,value:d,onValueChange:u,filter:m,shouldFilter:p,loop:f,disablePointerSelection:x=!1,vimBindings:g=!0,...v}=e,b=tw(),y=tw(),j=tw(),N=h.useRef(null),w=nC();nj(()=>{if(void 0!==d){let e=d.trim();r.current.value=e,k.emit()}},[d]),nj(()=>{w(6,P)},[]);let k=h.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>r.current,setState:(e,t,n)=>{var a,s,o,l;if(!Object.is(r.current[e],t)){if(r.current[e]=t,"search"===e)I(),E(),w(1,R);else if("value"===e){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let e=document.getElementById(j);e?e.focus():null==(a=document.getElementById(b))||a.focus()}if(w(7,()=>{var e;r.current.selectedItemId=null==(e=T())?void 0:e.id,k.emit()}),n||w(5,P),(null==(s=i.current)?void 0:s.value)!==void 0){null==(l=(o=i.current).onValueChange)||l.call(o,null!=t?t:"");return}}k.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),C=h.useMemo(()=>({value:(e,t,n)=>{var a;t!==(null==(a=s.current.get(e))?void 0:a.value)&&(s.current.set(e,{value:t,keywords:n}),r.current.filtered.items.set(e,S(t,n)),w(2,()=>{E(),k.emit()}))},item:(e,t)=>(n.current.add(e),t&&(a.current.has(t)?a.current.get(t).add(e):a.current.set(t,new Set([e]))),w(3,()=>{I(),E(),r.current.value||R(),k.emit()}),()=>{s.current.delete(e),n.current.delete(e),r.current.filtered.items.delete(e);let t=T();w(4,()=>{I(),(null==t?void 0:t.getAttribute("id"))===e&&R(),k.emit()})}),group:e=>(a.current.has(e)||a.current.set(e,new Set),()=>{s.current.delete(e),a.current.delete(e)}),filter:()=>i.current.shouldFilter,label:l||e["aria-label"],getDisablePointerSelection:()=>i.current.disablePointerSelection,listId:b,inputId:j,labelId:y,listInnerRef:N}),[]);function S(e,t){var n,a;let s=null!=(a=null==(n=i.current)?void 0:n.filter)?a:nl;return e?s(e,r.current.search,t):0}function E(){if(!r.current.search||!1===i.current.shouldFilter)return;let e=r.current.filtered.items,t=[];r.current.filtered.groups.forEach(r=>{let n=a.current.get(r),s=0;n.forEach(t=>{s=Math.max(e.get(t),s)}),t.push([r,s])});let n=N.current;O().sort((t,r)=>{var n,a;let s=t.getAttribute("id"),o=r.getAttribute("id");return(null!=(n=e.get(o))?n:0)-(null!=(a=e.get(s))?a:0)}).forEach(e=>{let t=e.closest(nn);t?t.appendChild(e.parentElement===t?e:e.closest(`${nn} > *`)):n.appendChild(e.parentElement===n?e:e.closest(`${nn} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{var t;let r=null==(t=N.current)?void 0:t.querySelector(`${nr}[${ni}="${encodeURIComponent(e[0])}"]`);null==r||r.parentElement.appendChild(r)})}function R(){let e=O().find(e=>"true"!==e.getAttribute("aria-disabled")),t=null==e?void 0:e.getAttribute(ni);k.setState("value",t||void 0)}function I(){var e,t,o,l;if(!r.current.search||!1===i.current.shouldFilter){r.current.filtered.count=n.current.size;return}r.current.filtered.groups=new Set;let c=0;for(let a of n.current){let n=S(null!=(t=null==(e=s.current.get(a))?void 0:e.value)?t:"",null!=(l=null==(o=s.current.get(a))?void 0:o.keywords)?l:[]);r.current.filtered.items.set(a,n),n>0&&c++}for(let[e,t]of a.current)for(let n of t)if(r.current.filtered.items.get(n)>0){r.current.filtered.groups.add(e);break}r.current.filtered.count=c}function P(){var e,t,r;let n=T();n&&((null==(e=n.parentElement)?void 0:e.firstChild)===n&&(null==(r=null==(t=n.closest(nr))?void 0:t.querySelector('[cmdk-group-heading=""]'))||r.scrollIntoView({block:"nearest"})),n.scrollIntoView({block:"nearest"}))}function T(){var e;return null==(e=N.current)?void 0:e.querySelector(`${na}[aria-selected="true"]`)}function O(){var e;return Array.from((null==(e=N.current)?void 0:e.querySelectorAll(ns))||[])}function D(e){let t=O()[e];t&&k.setState("value",t.getAttribute(ni))}function M(e){var t;let r=T(),n=O(),a=n.findIndex(e=>e===r),s=n[a+e];null!=(t=i.current)&&t.loop&&(s=a+e<0?n[n.length-1]:a+e===n.length?n[0]:n[a+e]),s&&k.setState("value",s.getAttribute(ni))}function A(e){let t=T(),r=null==t?void 0:t.closest(nr),n;for(;r&&!n;)n=null==(r=e>0?function(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}(r,nr):function(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}(r,nr))?void 0:r.querySelector(ns);n?k.setState("value",n.getAttribute(ni)):M(e)}let L=()=>D(O().length-1),F=e=>{e.preventDefault(),e.metaKey?L():e.altKey?A(1):M(1)},B=e=>{e.preventDefault(),e.metaKey?D(0):e.altKey?A(-1):M(-1)};return h.createElement(nt.div,{ref:t,tabIndex:-1,...v,"cmdk-root":"",onKeyDown:e=>{var t;null==(t=v.onKeyDown)||t.call(v,e);let r=e.nativeEvent.isComposing||229===e.keyCode;if(!(e.defaultPrevented||r))switch(e.key){case"n":case"j":g&&e.ctrlKey&&F(e);break;case"ArrowDown":F(e);break;case"p":case"k":g&&e.ctrlKey&&B(e);break;case"ArrowUp":B(e);break;case"Home":e.preventDefault(),D(0);break;case"End":e.preventDefault(),L();break;case"Enter":{e.preventDefault();let t=T();if(t){let e=new Event(no);t.dispatchEvent(e)}}}}},h.createElement("label",{"cmdk-label":"",htmlFor:C.inputId,id:C.labelId,style:nE},l),nS(e,e=>h.createElement(nd.Provider,{value:k},h.createElement(nc.Provider,{value:C},e))))}),np=h.forwardRef((e,t)=>{var r,n;let a=tw(),s=h.useRef(null),o=h.useContext(nu),i=h.useContext(nc),l=ny(e),c=null!=(n=null==(r=l.current)?void 0:r.forceMount)?n:null==o?void 0:o.forceMount;nj(()=>{if(!c)return i.item(a,null==o?void 0:o.id)},[c]);let d=nk(a,s,[e.value,e.children,s],e.keywords),u=h.useContext(nd),m=nw(e=>e.value&&e.value===d.current),p=nw(e=>!!c||!1===i.filter()||!e.search||e.filtered.items.get(a)>0);function f(){var e,t;x(),null==(t=(e=l.current).onSelect)||t.call(e,d.current)}function x(){u.setState("value",d.current,!0)}if(h.useEffect(()=>{let t=s.current;if(!(!t||e.disabled))return t.addEventListener(no,f),()=>t.removeEventListener(no,f)},[p,e.onSelect,e.disabled]),!p)return null;let{disabled:g,value:v,onSelect:b,forceMount:y,keywords:j,...N}=e;return h.createElement(nt.div,{ref:tv(s,t),...N,id:a,"cmdk-item":"",role:"option","aria-disabled":!!g,"aria-selected":!!m,"data-disabled":!!g,"data-selected":!!m,onPointerMove:g||i.getDisablePointerSelection()?void 0:x,onClick:g?void 0:f},e.children)}),nf=h.forwardRef((e,t)=>{let{heading:r,children:n,forceMount:a,...s}=e,o=tw(),i=h.useRef(null),l=h.useRef(null),c=tw(),d=h.useContext(nc),u=nw(e=>!!a||!1===d.filter()||!e.search||e.filtered.groups.has(o));nj(()=>d.group(o),[]),nk(o,i,[e.value,e.heading,l]);let m=h.useMemo(()=>({id:o,forceMount:a}),[a]);return h.createElement(nt.div,{ref:tv(i,t),...s,"cmdk-group":"",role:"presentation",hidden:!u||void 0},r&&h.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:c},r),nS(e,e=>h.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?c:void 0},h.createElement(nu.Provider,{value:m},e))))}),nh=h.forwardRef((e,t)=>{let{alwaysRender:r,...n}=e,a=h.useRef(null),s=nw(e=>!e.search);return r||s?h.createElement(nt.div,{ref:tv(a,t),...n,"cmdk-separator":"",role:"separator"}):null}),nx=h.forwardRef((e,t)=>{let{onValueChange:r,...n}=e,a=null!=e.value,s=h.useContext(nd),o=nw(e=>e.search),i=nw(e=>e.selectedItemId),l=h.useContext(nc);return h.useEffect(()=>{null!=e.value&&s.setState("search",e.value)},[e.value]),h.createElement(nt.input,{ref:t,...n,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":i,id:l.inputId,type:"text",value:a?e.value:o,onChange:e=>{a||s.setState("search",e.target.value),null==r||r(e.target.value)}})}),ng=h.forwardRef((e,t)=>{let{children:r,label:n="Suggestions",...a}=e,s=h.useRef(null),o=h.useRef(null),i=nw(e=>e.selectedItemId),l=h.useContext(nc);return h.useEffect(()=>{if(o.current&&s.current){let e=o.current,t=s.current,r,n=new ResizeObserver(()=>{r=requestAnimationFrame(()=>{let r=e.offsetHeight;t.style.setProperty("--cmdk-list-height",r.toFixed(1)+"px")})});return n.observe(e),()=>{cancelAnimationFrame(r),n.unobserve(e)}}},[]),h.createElement(nt.div,{ref:tv(s,t),...a,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":i,"aria-label":n,id:l.listId},nS(e,e=>h.createElement("div",{ref:tv(o,l.listInnerRef),"cmdk-list-sizer":""},e)))}),nv=h.forwardRef((e,t)=>{let{open:r,onOpenChange:n,overlayClassName:a,contentClassName:s,container:o,...i}=e;return h.createElement(rL,{open:r,onOpenChange:n},h.createElement(rz,{container:o},h.createElement(rW,{"cmdk-overlay":"",className:a}),h.createElement(rK,{"aria-label":e.label,"cmdk-dialog":"",className:s},h.createElement(nm,{ref:t,...i}))))}),nb=Object.assign(nm,{List:ng,Item:np,Input:nx,Group:nf,Separator:nh,Dialog:nv,Empty:h.forwardRef((e,t)=>nw(e=>0===e.filtered.count)?h.createElement(nt.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Loading:h.forwardRef((e,t)=>{let{progress:r,children:n,label:a="Loading...",...s}=e;return h.createElement(nt.div,{ref:t,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},nS(e,e=>h.createElement("div",{"aria-hidden":!0},e)))})});function ny(e){let t=h.useRef(e);return nj(()=>{t.current=e}),t}var nj="u"<typeof window?h.useEffect:h.useLayoutEffect;function nN(e){let t=h.useRef();return void 0===t.current&&(t.current=e()),t}function nw(e){let t=h.useContext(nd),r=()=>e(t.snapshot());return h.useSyncExternalStore(t.subscribe,r,r)}function nk(e,t,r,n=[]){let a=h.useRef(),s=h.useContext(nc);return nj(()=>{var o;let i=(()=>{var e;for(let t of r){if("string"==typeof t)return t.trim();if("object"==typeof t&&"current"in t)return t.current?null==(e=t.current.textContent)?void 0:e.trim():a.current}})(),l=n.map(e=>e.trim());s.value(e,i,l),null==(o=t.current)||o.setAttribute(ni,i),a.current=i}),a}var nC=()=>{let[e,t]=h.useState(),r=nN(()=>new Map);return nj(()=>{r.current.forEach(e=>e()),r.current=new Map},[e]),(e,n)=>{r.current.set(e,n),t({})}};function nS({asChild:e,children:t},r){let n;return e&&h.isValidElement(t)?h.cloneElement("function"==typeof(n=t.type)?n(t.props):"render"in n?n.render(t.props):t,{ref:t.ref},r(t.props.children)):r(t)}var nE={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"},nR=e.i(164688);function nI({className:e,...t}){return(0,f.jsx)("div",{"data-slot":"input-group",role:"group",className:(0,ti.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",e),...t})}let nP=(0,nR.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 nT({className:e,align:t="inline-start",...r}){return(0,f.jsx)("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:(0,ti.cn)(nP({align:t}),e),onClick:e=>{e.target.closest("button")||e.currentTarget.parentElement?.querySelector("input")?.focus()},...r})}(0,nR.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 nO=e.i(142296),nO=nO,nD=e.i(209760);function nM({className:e,...t}){return(0,f.jsx)(nb,{"data-slot":"command",className:(0,ti.cn)("flex size-full flex-col overflow-hidden rounded-xl! bg-popover p-1 text-popover-foreground",e),...t})}function nA({className:e,...t}){return(0,f.jsx)("div",{"data-slot":"command-input-wrapper",className:"p-1 pb-0",children:(0,f.jsxs)(nI,{className:"h-8! rounded-lg! border-input/30 bg-input/30 shadow-none! *:data-[slot=input-group-addon]:pl-2!",children:[(0,f.jsx)(nb.Input,{"data-slot":"command-input",className:(0,ti.cn)("w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",e),...t}),(0,f.jsx)(nT,{children:(0,f.jsx)(nO.default,{className:"size-4 shrink-0 opacity-50"})})]})})}function nL({className:e,...t}){return(0,f.jsx)(nb.List,{"data-slot":"command-list",className:(0,ti.cn)("no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none",e),...t})}function nF({className:e,...t}){return(0,f.jsx)(nb.Empty,{"data-slot":"command-empty",className:(0,ti.cn)("py-6 text-center text-sm",e),...t})}function nB({className:e,...t}){return(0,f.jsx)(nb.Group,{"data-slot":"command-group",className:(0,ti.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",e),...t})}function n$({className:e,children:t,...r}){return(0,f.jsxs)(nb.Item,{"data-slot":"command-item",className:(0,ti.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",e),...r,children:[t,(0,f.jsx)(nD.CheckIcon,{className:"ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100"})]})}var n_=e.i(543485);let nz=(0,n_.createServerReference)("40f524d6493153a89d590b16ee996054b3514860a3",n_.callServer,void 0,n_.findSourceMapURL,"getProjectBranches"),nU=(0,n_.createServerReference)("40a5f85730bae3711a1ed0a8c8898d5153719e0b91",n_.callServer,void 0,n_.findSourceMapURL,"fetchRemoteBranches"),nW=(0,n_.createServerReference)("400a68fcfd8e23d942b0e9b2d92885f07ea2c1d72c",n_.callServer,void 0,n_.findSourceMapURL,"getCurrentBranch");function nH({open:e,onOpenChange:t,onSubmit:r,onUpdate:n,defaultStatus:a="TODO",editTask:s,editTaskLabelIds:o,labels:i,projectType:l,projectLocalPath:c}){let[d,u]=(0,h.useState)(""),[m,p]=(0,h.useState)(""),[x,g]=(0,h.useState)("MEDIUM"),[v,b]=(0,h.useState)(""),[y,N]=(0,h.useState)([]),[w,k]=(0,h.useState)([]),[S,E]=(0,h.useState)(!1),[I,P]=(0,h.useState)(""),[T,O]=(0,h.useState)(!1),[D,M]=(0,h.useState)(!0),{t:A}=(0,j.useI18n)(),L=!!s,F=!!c;return(0,h.useEffect)(()=>{s?(u(s.title),p(s.description??""),g(s.priority),b(s.subPath??""),N(o??[])):(u(""),p(""),g("MEDIUM"),b(""),N([]))},[s,o]),(0,h.useEffect)(()=>{e||s||(u(""),p(""),g("MEDIUM"),b(""),N([]),k([]),P(""),O(!1))},[e,s]),(0,h.useEffect)(()=>{e&&F&&!s&&(E(!0),Promise.all([nz(c),nW(c)]).then(([e,t])=>{k(e),P(t&&e.includes(t)?t:e[0]??""),E(!1),nU(c).then(()=>{setTimeout(()=>{nz(c).then(e=>{k(e),P(t=>e.includes(t)?t:e[0]??"")}).catch(()=>{})},3e3)})}).catch(()=>{k([]),P(""),E(!1)}))},[e,F,c,s]),(0,f.jsx)(U.Dialog,{open:e,onOpenChange:t,disablePointerDismissal:!0,children:(0,f.jsxs)(U.DialogContent,{className:"sm:max-w-md",children:[(0,f.jsx)(U.DialogHeader,{children:(0,f.jsx)(U.DialogTitle,{children:L?A("task.edit"):A("task.create")})}),(0,f.jsxs)("div",{className:"space-y-4 py-2",children:[(0,f.jsxs)("div",{className:"space-y-2",children:[(0,f.jsx)(Y.Label,{htmlFor:"title",children:A("task.title")}),(0,f.jsx)(K.Input,{id:"title","data-testid":"task-title",placeholder:A("task.titlePlaceholder"),value:d,onChange:e=>u(e.target.value),onKeyDown:e=>"Enter"===e.key&&e.preventDefault()})]}),(0,f.jsxs)("div",{className:"space-y-2",children:[(0,f.jsx)(Y.Label,{htmlFor:"description",children:A("task.description")}),(0,f.jsx)(q.Textarea,{id:"description",placeholder:A("task.descPlaceholder"),rows:4,value:m,onChange:e=>p(e.target.value),className:"max-h-[200px] overflow-y-auto"})]}),(0,f.jsxs)("div",{className:"space-y-2",children:[(0,f.jsx)(Y.Label,{htmlFor:"subPath",children:A("task.subPath")}),(0,f.jsx)(K.Input,{id:"subPath",placeholder:A("task.subPathPlaceholder"),value:v,onChange:e=>b(e.target.value)}),(0,f.jsx)("p",{className:"text-xs text-muted-foreground",children:A("task.subPathHint")})]}),(0,f.jsxs)("div",{className:"space-y-2",children:[(0,f.jsx)(Y.Label,{children:A("task.priority")}),(0,f.jsx)("div",{className:"flex gap-1.5",children:["LOW","MEDIUM","HIGH","CRITICAL"].map(e=>{let t={LOW:{label:A("task.priorityLow"),style:"text-slate-300 border-slate-500/30 bg-slate-500/10"},MEDIUM:{label:A("task.priorityMedium"),style:"text-amber-300 border-amber-500/30 bg-amber-500/10"},HIGH:{label:A("task.priorityHigh"),style:"text-orange-300 border-orange-500/30 bg-orange-500/10"},CRITICAL:{label:A("task.priorityCritical"),style:"text-rose-300 border-rose-500/30 bg-rose-500/10"}}[e];return(0,f.jsx)("button",{type:"button",onClick:()=>g(e),className:`rounded-lg border px-3 py-1.5 text-xs font-medium transition-all ${x===e?`${t.style} ring-1 ring-current/20`:"border-border text-muted-foreground hover:bg-accent"}`,children:t.label},e)})})]}),F&&!L&&(0,f.jsxs)("div",{className:"space-y-2",children:[(0,f.jsx)(Y.Label,{children:A("task.baseBranch")}),S?(0,f.jsx)("div",{className:"text-sm text-muted-foreground",children:A("task.branchLoading")}):w.length>0?(0,f.jsxs)(tl,{open:T,onOpenChange:O,children:[(0,f.jsxs)(tc,{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,f.jsx)(X.GitBranch,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),(0,f.jsx)("span",{className:"flex-1 truncate text-left text-xs",children:I||A("task.branchNone")}),(0,f.jsx)(Z,{className:"h-3.5 w-3.5 shrink-0 opacity-50"})]}),(0,f.jsx)(td,{className:"p-0",align:"start",children:(0,f.jsxs)(nM,{children:[(0,f.jsx)(nA,{placeholder:A("task.branchSearch")}),(0,f.jsxs)(nL,{children:[(0,f.jsx)(nF,{children:A("task.branchNone")}),(0,f.jsx)(nB,{children:w.map(e=>(0,f.jsxs)(n$,{value:e,onSelect:()=>{P(e),O(!1)},children:[(0,f.jsx)(X.GitBranch,{className:"h-3 w-3 text-muted-foreground shrink-0 mr-2"}),(0,f.jsx)("span",{className:"flex-1 truncate font-mono",children:e}),e===I&&(0,f.jsx)(R.Check,{className:"h-3 w-3 text-primary shrink-0 ml-auto"})]},e))})]})]})})]}):(0,f.jsx)("div",{className:"text-sm text-muted-foreground",children:A("task.branchNone")}),(0,f.jsxs)("div",{className:"mt-3 flex items-center gap-2",children:[(0,f.jsx)(Y.Label,{className:"text-xs text-muted-foreground",children:A("task.worktreeLabel")}),(0,f.jsx)("div",{className:"flex gap-1",children:[!0,!1].map(e=>(0,f.jsx)("button",{type:"button",onClick:()=>M(e),className:`rounded-md px-3 py-1 text-xs font-medium transition-colors ${D===e?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:text-foreground"}`,children:e?A("task.worktreeYes"):A("task.worktreeNo")},String(e)))})]})]}),i.length>0&&(0,f.jsxs)("div",{className:"space-y-2",children:[(0,f.jsx)(Y.Label,{children:A("task.labels")}),(0,f.jsx)("div",{className:"flex flex-wrap gap-1.5",children:i.map(e=>{let t=y.includes(e.id);return(0,f.jsx)("button",{type:"button",onClick:()=>{N(r=>t?r.filter(t=>t!==e.id):[...r,e.id])},className:`rounded-full px-2.5 py-1 text-xs font-medium transition-all ${t?"ring-1 ring-current/30":"opacity-50 hover:opacity-80"}`,style:{backgroundColor:e.color+"20",color:e.color,borderColor:t?e.color+"40":"transparent",borderWidth:"1px"},children:e.name},e.id)})})]})]}),(0,f.jsxs)(U.DialogFooter,{children:[(0,f.jsx)(C.Button,{variant:"outline",onClick:()=>t(!1),children:A("common.cancel")}),(0,f.jsx)(C.Button,{onClick:()=>{d.trim()&&(L&&n?n(s.id,{title:d,description:m,priority:x,labelIds:y,subPath:v.trim()||""}):r({title:d,description:m,priority:x,status:a,labelIds:y,...F&&D&&I?{baseBranch:I}:{},...v.trim()?{subPath:v.trim()}:{}}),u(""),p(""),g("MEDIUM"),b(""),N([]),k([]),P(""),M(!0),t(!1))},className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:L?A("common.save"):A("common.create")})]})]})})}var nG=e.i(458851),nV=e.i(803041),nK=e.i(802461),nq=e.i(555159),nY=e.i(478430);let nX=(0,v.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 nZ=e.i(894296),nJ=e.i(946960),nQ=e.i(239358),n0=e.i(126741),n1=e.i(866790),n2=e.i(967541);let n5=(0,n_.createServerReference)("40c3e283c4bc09dd0ddeac0fee2d5450add9aba2ef",n_.callServer,void 0,n_.findSourceMapURL,"deleteProject"),n3=(0,n_.createServerReference)("401227c576cd75dc12c7d7ef6c4acb53b48d853e45",n_.callServer,void 0,n_.findSourceMapURL,"getRecentLocalProjects"),n4=(0,n_.createServerReference)("40d6e8e588bda631b24c5a0e2c634b36786afb4521",n_.callServer,void 0,n_.findSourceMapURL,"getOrCreateTowerTaskId");var n8=e.i(552192),n9=e.i(286302),n7=e.i(921280),n6=e.i(584685),ae=e.i(909105),at=e.i(421845);function ar({commits:e}){let{t}=(0,j.useI18n)(),[r,n]=(0,h.useState)(!1);return 0===e.length?null:(0,f.jsxs)("div",{children:[(0,f.jsxs)("button",{onClick:()=>n(!r),className:"flex w-full items-center justify-between py-1",children:[(0,f.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:t("git.commitLog")}),r?(0,f.jsx)(nG.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,f.jsx)(nV.ChevronRight,{className:"h-3 w-3 text-muted-foreground"})]}),r&&(0,f.jsx)("div",{className:"mt-1.5 space-y-0.5 max-h-64 overflow-y-auto",children:e.map(e=>(0,f.jsxs)("div",{className:"group flex items-start gap-2 rounded-md px-2 py-1.5 hover:bg-accent transition-colors",children:[(0,f.jsx)(nX,{className:"h-3 w-3 shrink-0 text-muted-foreground mt-0.5"}),(0,f.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,f.jsx)("p",{className:"text-xs text-foreground line-clamp-1",children:e.message}),(0,f.jsxs)("div",{className:"flex items-center gap-2 mt-0.5",children:[(0,f.jsxs)("button",{onClick:()=>{navigator.clipboard.writeText(e.shortHash),n9.toast.success(`Copied ${e.shortHash}`)},className:"flex items-center gap-0.5 font-mono text-[10px] text-primary/70 hover:text-primary transition-colors",children:[e.shortHash,(0,f.jsx)(at.Copy,{className:"h-2.5 w-2.5 opacity-0 group-hover:opacity-100 transition-opacity"})]}),(0,f.jsx)("span",{className:"text-[10px] text-muted-foreground",children:e.author}),(0,f.jsx)("span",{className:"text-[10px] text-muted-foreground",children:function(e){let t=Math.floor((Date.now()-new Date(e).getTime())/6e4);if(t<1)return"just now";if(t<60)return`${t}m`;let r=Math.floor(t/60);if(r<24)return`${r}h`;let n=Math.floor(r/24);return n<30?`${n}d`:`${Math.floor(n/30)}mo`}(e.date)})]})]})]},e.hash))})]})}var an=e.i(565037),aa=e.i(871183),as=e.i(657572);function ao({localPath:e,stashes:t,hasChanges:r,onRefresh:n}){let{t:a}=(0,j.useI18n)(),[s,o]=(0,h.useState)(!1),[i,l]=(0,h.useState)(!1),[c,d]=(0,h.useState)(""),[u,m]=(0,h.useState)(null),p=async()=>{l(!0);try{await (0,as.gitAction)(e,"stash-save",{message:c}),d(""),n9.toast.success(a("git.stashSaved")),await n()}catch(e){n9.toast.error(e instanceof Error?e.message:String(e))}finally{l(!1)}},x=async t=>{m(t);try{await (0,as.gitAction)(e,"stash-pop",{index:t}),n9.toast.success(a("git.stashApplied")),await n()}catch(e){n9.toast.error(e instanceof Error?e.message:String(e))}finally{m(null)}},g=async t=>{m(t);try{await (0,as.gitAction)(e,"stash-drop",{index:t}),n9.toast.success(a("git.stashDropped")),await n()}catch(e){n9.toast.error(e instanceof Error?e.message:String(e))}finally{m(null)}};return r||0!==t.length?(0,f.jsxs)("div",{children:[(0,f.jsxs)("button",{onClick:()=>o(!s),className:"flex w-full items-center justify-between py-1",children:[(0,f.jsxs)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:[a("git.stash")," ",t.length>0&&`(${t.length})`]}),s?(0,f.jsx)(nG.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,f.jsx)(nV.ChevronRight,{className:"h-3 w-3 text-muted-foreground"})]}),s&&(0,f.jsxs)("div",{className:"mt-1.5 space-y-2",children:[r&&(0,f.jsxs)("div",{className:"flex gap-1.5",children:[(0,f.jsx)(K.Input,{value:c,onChange:e=>d(e.target.value),placeholder:a("git.stashMsgPlaceholder"),className:"h-7 text-xs flex-1",onKeyDown:e=>"Enter"===e.key&&p()}),(0,f.jsx)(C.Button,{variant:"outline",size:"icon-sm",onClick:p,disabled:i,className:"shrink-0",children:i?(0,f.jsx)(nJ.Loader2,{className:"h-3 w-3 animate-spin"}):(0,f.jsx)(an.Archive,{className:"h-3 w-3"})})]}),t.length>0&&(0,f.jsx)("div",{className:"space-y-0.5",children:t.map(e=>(0,f.jsxs)("div",{className:"group flex items-center gap-2 rounded-md px-2 py-1.5 hover:bg-accent transition-colors",children:[(0,f.jsx)(an.Archive,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),(0,f.jsx)("span",{className:"flex-1 min-w-0 truncate text-xs text-foreground",children:e.message||`stash@{${e.index}}`}),(0,f.jsxs)("div",{className:"flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,f.jsx)(C.Button,{variant:"ghost",size:"icon-xs",onClick:()=>x(e.index),disabled:u===e.index,className:"text-muted-foreground","aria-label":a("git.stashApply"),children:u===e.index?(0,f.jsx)(nJ.Loader2,{className:"h-3 w-3 animate-spin"}):(0,f.jsx)(aa.ArrowUpFromLine,{className:"h-3 w-3"})}),(0,f.jsx)(C.Button,{variant:"ghost",size:"icon-xs",onClick:()=>g(e.index),disabled:u===e.index,className:"text-rose-400","aria-label":a("git.stashDrop"),children:(0,f.jsx)(F.Trash2,{className:"h-3 w-3"})})]})]},e.index))})]})]}):null}function ai({project:e,workspaceId:t}){let{t:r,locale:n}=(0,j.useI18n)(),a=(0,x.useRouter)(),[s,o]=(0,h.useState)(!0),[i,l]=(0,h.useState)(!0),[c,d]=(0,h.useState)(!1),[u,m]=(0,h.useState)(!1),[p,g]=(0,h.useState)(""),[v,b]=(0,h.useState)(!1),[y,N]=(0,h.useState)(!1),[w,k]=(0,h.useState)(!1),[S,E]=(0,h.useState)(e.name),[R,I]=(0,h.useState)(e.alias??""),[P,T]=(0,h.useState)(e.description??""),[O,D]=(0,h.useState)(e.localPath??""),[M,A]=(0,h.useState)(e.projectType??"FRONTEND"),[B,$]=(0,h.useState)([]);(0,h.useEffect)(()=>{n3(100).then($)},[]);let[_,z]=(0,h.useState)(!1),[W,H]=(0,h.useState)(""),[G,V]=(0,h.useState)(""),[Y,Z]=(0,h.useState)(""),[J,Q]=(0,h.useState)(""),[ee,et]=(0,h.useState)("FRONTEND"),[er,en]=(0,h.useState)(!1),[ea,es]=(0,h.useState)(!1),[eo,ei]=(0,h.useState)(null),[el,ec]=(0,h.useState)(!1),[ed,eu]=(0,h.useState)(!1),[em,ep]=(0,h.useState)(!1),ef=e=>{n9.toast.info(e)},eh=(0,h.useCallback)(async()=>{if(e.localPath){ec(!0);try{let t=await fetch(`/api/git?path=${encodeURIComponent(e.localPath)}`);t.ok&&ei(await t.json())}catch{}finally{ec(!1)}}},[e.localPath]);(0,h.useEffect)(()=>{eh()},[eh]);let ex=async()=>{if(e.localPath){eu(!0);try{(await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"init",path:e.localPath})})).ok?(ef(r("git.initSuccess")),await eh()):ef(r("git.initFailed"))}catch{ef(r("git.initFailed"))}finally{eu(!1)}}},eg=async t=>{if(e.localPath)try{let n=await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"checkout",path:e.localPath,branch:t})});if(n.ok)ef(`${r("git.switchSuccess")} ${t}`),await eh();else{let e=await n.json();ef(`${r("git.switchFailed")}: ${e.error}`)}}catch{ef(r("git.switchFailed"))}},ev=(e,t)=>{a.push(`/workspaces/${e}?projectId=${t}`,{scroll:!1}),a.refresh()},eb=async()=>{if(G.trim()){en(!0);try{let e=await (0,n2.createProject)({name:G.trim(),alias:Y.trim()||void 0,description:J.trim()||void 0,localPath:W,projectType:ee,workspaceId:t});z(!1),ev(t,e.id)}catch(e){n9.toast.error(e instanceof Error?e.message:String(e))}finally{en(!1)}}},ey=async()=>{if(O&&!ea){es(!0);try{let e=await (0,n8.analyzeProjectDirectory)(O.trim(),n);T(e)}catch{n9.toast.error(r("project.analyzeError"))}finally{es(!1)}}},ej=async()=>{try{await (0,n1.updateProject)(e.id,{name:S.trim(),alias:R.trim()||void 0,description:P.trim()||void 0,localPath:O.trim()||void 0,projectType:M}),a.refresh(),d(!1)}catch(e){n9.toast.error(e instanceof Error?e.message:String(e))}};return(0,f.jsxs)("aside",{className:"relative w-72 flex-shrink-0 overflow-y-auto border-l border-border bg-sidebar",children:[(0,f.jsxs)("div",{className:"border-b border-border p-4",children:[(0,f.jsxs)("div",{className:"flex items-start justify-between",children:[(0,f.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,f.jsx)("h2",{className:"text-base font-semibold text-foreground",children:e.name}),e.alias&&(0,f.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:e.alias})]}),(0,f.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,f.jsx)(C.Button,{variant:"ghost",size:"icon-sm",onClick:()=>{E(e.name),I(e.alias??""),T(e.description??""),D(e.localPath??""),d(!0)},className:"text-muted-foreground",children:(0,f.jsx)(L.Pencil,{className:"h-3.5 w-3.5"})}),(0,f.jsx)(C.Button,{variant:"ghost",size:"icon-sm",onClick:()=>{g(""),m(!0)},className:"text-muted-foreground hover:text-rose-400",children:(0,f.jsx)(F.Trash2,{className:"h-3.5 w-3.5"})})]})]}),e.description&&(0,f.jsx)("p",{className:"mt-2 text-sm text-secondary-foreground leading-relaxed line-clamp-4",children:e.description}),(0,f.jsx)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:(0,f.jsx)("span",{className:`inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-[11px] font-medium ${"GIT"===e.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"===e.type?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(X.GitBranch,{className:"h-3 w-3"}),r("sidebar.right.gitType")]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(nq.FileText,{className:"h-3 w-3"}),r("sidebar.right.normalType")]})})}),e.localPath&&(0,f.jsxs)("div",{className:"mt-3 flex items-start gap-2 rounded-md bg-muted/50 px-2.5 py-2 text-xs",children:[(0,f.jsx)(nY.FolderOpen,{className:"mt-0.5 h-3 w-3 shrink-0 text-muted-foreground"}),(0,f.jsx)("span",{className:"break-all font-mono text-secondary-foreground",children:e.localPath})]}),e.gitUrl&&(0,f.jsxs)("div",{className:"mt-2 flex items-start gap-2 rounded-md bg-muted/50 px-2.5 py-2 text-xs",children:[(0,f.jsx)(nK.Globe,{className:"mt-0.5 h-3 w-3 shrink-0 text-muted-foreground"}),(0,f.jsx)("span",{className:"break-all text-secondary-foreground",children:e.gitUrl})]}),e.localPath&&(0,f.jsxs)(C.Button,{variant:"outline",className:"mt-3 w-full h-8 gap-1.5 text-xs",disabled:y,onClick:async()=>{N(!0);try{let r=await n4(e.id);a.push(`/workspaces/${t}/tasks/${r}`)}catch{n9.toast.error(r("git.openStudioFailed"))}finally{N(!1)}},children:[y?(0,f.jsx)(nJ.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):(0,f.jsx)(nY.FolderOpen,{className:"h-3.5 w-3.5"}),r("git.openStudio")]})]}),(0,f.jsxs)("div",{className:"border-b border-border p-4",children:[(0,f.jsxs)(C.Button,{variant:"ghost",onClick:()=>o(!s),className:"flex w-full cursor-pointer justify-between px-2 py-2",children:[(0,f.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:r("git.section")}),s?(0,f.jsx)(nG.ChevronDown,{className:"h-3.5 w-3.5 text-muted-foreground"}):(0,f.jsx)(nV.ChevronRight,{className:"h-3.5 w-3.5 text-muted-foreground"})]}),s&&(0,f.jsx)("div",{className:"mt-3",children:e.localPath?el?(0,f.jsxs)("div",{className:"flex items-center justify-center py-4 text-muted-foreground",children:[(0,f.jsx)(nJ.Loader2,{className:"h-4 w-4 animate-spin"}),(0,f.jsx)("span",{className:"ml-2 text-xs",children:r("git.loading")})]}):eo&&!eo.isGit?(0,f.jsxs)("div",{className:"rounded-lg border border-border bg-muted/50 p-3",children:[(0,f.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,f.jsx)(nZ.AlertCircle,{className:"h-3.5 w-3.5"}),(0,f.jsx)("p",{className:"text-xs",children:r("git.notInitialized")})]}),(0,f.jsxs)(C.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:ex,disabled:ed,children:[ed?(0,f.jsx)(nJ.Loader2,{className:"h-3 w-3 animate-spin"}):(0,f.jsx)(nX,{className:"h-3 w-3"}),r("git.initRepo")]})]}):eo?.isGit?(0,f.jsxs)("div",{className:"space-y-3",children:[(0,f.jsx)(al,{localBranches:eo.branches??[],remoteBranches:(eo.remoteBranches??[]).filter(e=>!eo.branches?.includes(e)),currentBranch:eo.currentBranch??"",onSwitch:eg,onFetch:async()=>{e.localPath&&(await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"fetch",path:e.localPath})}),await eh())},onCreateBranch:()=>ep(!0)}),(0,f.jsx)(ar,{commits:eo.commits??[]}),(0,f.jsx)(ao,{localPath:e.localPath,stashes:eo.stashes??[],hasChanges:(eo.changedFiles??[]).length>0,onRefresh:eh})]}):null:(0,f.jsx)("div",{className:"rounded-lg border border-border bg-muted/50 p-3",children:(0,f.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,f.jsx)(nZ.AlertCircle,{className:"h-3.5 w-3.5"}),(0,f.jsx)("p",{className:"text-xs",children:r("git.noLocalPath")})]})})})]}),(0,f.jsxs)("div",{className:"p-4",children:[(0,f.jsxs)(C.Button,{variant:"ghost",onClick:()=>l(!i),className:"flex w-full cursor-pointer justify-between px-2 py-2",children:[(0,f.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:r("sidebar.right.browseRepo")}),i?(0,f.jsx)(nG.ChevronDown,{className:"h-3.5 w-3.5 text-muted-foreground"}):(0,f.jsx)(nV.ChevronRight,{className:"h-3.5 w-3.5 text-muted-foreground"})]}),i&&(0,f.jsxs)("div",{className:"mt-3 space-y-3",children:[(0,f.jsxs)(C.Button,{variant:"outline",className:"w-full h-8 gap-1.5 text-xs",onClick:()=>k(!0),children:[(0,f.jsx)(nY.FolderOpen,{className:"h-3.5 w-3.5"}),r("sidebar.right.browseRepo")]}),B.length>0&&(0,f.jsxs)("div",{children:[(0,f.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground mb-1.5 px-1",children:r("sidebar.right.recent")}),(0,f.jsx)("div",{className:"space-y-0.5",children:B.map(t=>(0,f.jsxs)("button",{onClick:()=>{t.id!==e.id&&ev(t.workspaceId,t.id)},className:`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left transition-colors ${t.id===e.id?"bg-primary/10 text-primary cursor-default":"hover:bg-accent cursor-pointer"}`,children:["GIT"===t.type?(0,f.jsx)(X.GitBranch,{className:"h-3 w-3 shrink-0 text-emerald-400"}):(0,f.jsx)(nY.FolderOpen,{className:"h-3 w-3 shrink-0 text-primary/70"}),(0,f.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,f.jsx)("p",{className:"truncate text-xs font-medium text-foreground",children:t.name}),t.localPath&&(0,f.jsx)("p",{className:"truncate text-[10px] font-mono text-muted-foreground",children:t.localPath})]})]},t.id))})]})]})]}),(0,f.jsx)(U.Dialog,{open:c,onOpenChange:d,children:(0,f.jsxs)(U.DialogContent,{style:{maxWidth:"32rem"},children:[(0,f.jsx)(U.DialogHeader,{children:(0,f.jsx)(U.DialogTitle,{children:r("project.edit")})}),(0,f.jsxs)("div",{className:"space-y-3 py-2",children:[(0,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:r("project.name")}),(0,f.jsx)(K.Input,{value:S,onChange:e=>E(e.target.value),className:"mt-1.5"})]}),(0,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:r("project.type.label")}),(0,f.jsx)("div",{className:"mt-1.5",children:(0,f.jsx)(n6.SegmentedControl,{options:[{value:"FRONTEND",label:r("project.type.frontend")},{value:"BACKEND",label:r("project.type.backend")}],value:M,onChange:A})})]}),(0,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:r("project.alias")}),(0,f.jsx)(K.Input,{value:R,onChange:e=>I(e.target.value),className:"mt-1.5"})]}),(0,f.jsxs)("div",{children:[(0,f.jsxs)("div",{className:"flex items-center justify-between",children:[(0,f.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:r("project.description")}),(0,f.jsxs)(C.Button,{type:"button",variant:"ghost",onClick:ey,className:`h-6 gap-1 px-2 text-[11px] text-muted-foreground hover:text-foreground ${!O||ea?"opacity-50":""}`,children:[ea?(0,f.jsx)(nJ.Loader2,{className:"h-3 w-3 animate-spin"}):(0,f.jsx)(nQ.Sparkles,{className:"h-3 w-3"}),ea?r("project.analyzing"):r("project.genDesc")]})]}),(0,f.jsx)(q.Textarea,{value:P,onChange:e=>T(e.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,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:r("project.localPath")}),(0,f.jsxs)("div",{className:"mt-1.5 flex gap-2",children:[(0,f.jsx)(K.Input,{value:O,onChange:e=>D(e.target.value),placeholder:r("project.localPathPlaceholder"),className:"flex-1 font-mono text-xs"}),(0,f.jsx)(C.Button,{variant:"outline",onClick:()=>k(!0),className:"h-8 shrink-0",children:r("folder.browse")})]})]})]}),(0,f.jsxs)(U.DialogFooter,{children:[(0,f.jsx)(C.Button,{variant:"outline",onClick:()=>d(!1),children:r("common.cancel")}),(0,f.jsx)(C.Button,{onClick:ej,disabled:!S.trim()||ea,className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:r("common.save")})]})]})}),(0,f.jsx)(n7.FolderBrowserDialog,{open:w,onOpenChange:k,onSelect:e=>{c?D(e):(e=>{let t=B.find(t=>t.localPath===e);if(t)return ev(t.workspaceId,t.id);let r=e.split("/").filter(Boolean).pop()??"";H(e),V(r),Z(""),Q(""),z(!0)})(e)}}),(0,f.jsx)(U.Dialog,{open:_,onOpenChange:z,children:(0,f.jsxs)(U.DialogContent,{className:"sm:max-w-md",children:[(0,f.jsx)(U.DialogHeader,{children:(0,f.jsx)(U.DialogTitle,{children:r("topbar.newProject")})}),(0,f.jsxs)("div",{className:"space-y-3 py-2",children:[(0,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:r("project.localPath")}),(0,f.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:W})]}),(0,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:r("project.name")}),(0,f.jsx)(K.Input,{value:G,onChange:e=>V(e.target.value),placeholder:r("project.namePlaceholder"),className:"mt-1.5"})]}),(0,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:r("project.type.label")}),(0,f.jsx)("div",{className:"mt-1.5",children:(0,f.jsx)(n6.SegmentedControl,{options:[{value:"FRONTEND",label:r("project.type.frontend")},{value:"BACKEND",label:r("project.type.backend")}],value:ee,onChange:et})})]}),(0,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:r("project.alias")}),(0,f.jsx)(K.Input,{value:Y,onChange:e=>Z(e.target.value),placeholder:r("project.aliasPlaceholder"),className:"mt-1.5"})]}),(0,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:r("project.description")}),(0,f.jsx)(q.Textarea,{value:J,onChange:e=>Q(e.target.value),placeholder:r("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,f.jsxs)(U.DialogFooter,{children:[(0,f.jsx)(C.Button,{variant:"outline",onClick:()=>z(!1),children:r("common.cancel")}),(0,f.jsxs)(C.Button,{onClick:eb,disabled:!G.trim()||er,className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:[er?(0,f.jsx)(nJ.Loader2,{className:"h-3 w-3 animate-spin mr-1"}):null,r("common.create")]})]})]})}),eo?.isGit&&(0,f.jsx)(ae.CreateBranchDialog,{open:em,onOpenChange:ep,branches:eo.branches??[],currentBranch:eo.currentBranch??"",localPath:e.localPath,onCreated:async()=>{await eh(),ef(r("git.createSuccess"))},onError:e=>ef(`${r("git.createFailed")}: ${e}`)}),(0,f.jsx)(U.Dialog,{open:u,onOpenChange:e=>{m(e),e||g("")},children:(0,f.jsxs)(U.DialogContent,{className:"sm:max-w-md",children:[(0,f.jsx)(U.DialogHeader,{children:(0,f.jsx)(U.DialogTitle,{className:"text-rose-400",children:r("project.deleteTitle")})}),(0,f.jsxs)("div",{className:"space-y-3 py-2",children:[(0,f.jsx)("p",{className:"text-sm text-muted-foreground",children:r("project.deleteWarning",{name:e.name})}),(0,f.jsx)("p",{className:"text-sm text-muted-foreground",children:r("project.deleteIrreversible")}),(0,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:r("project.deleteConfirmLabel")}),(0,f.jsx)(K.Input,{value:p,onChange:e=>g(e.target.value),placeholder:r("project.deleteConfirmPlaceholder"),className:"mt-1.5",autoFocus:!0})]})]}),(0,f.jsxs)(U.DialogFooter,{children:[(0,f.jsx)(C.Button,{variant:"outline",onClick:()=>m(!1),children:r("common.cancel")}),(0,f.jsxs)(C.Button,{variant:"destructive",disabled:p!==r("project.deleteConfirmText")||v,onClick:async()=>{b(!0);try{await n5(e.id),n9.toast.success(r("project.deleteSuccess")),a.push(`/workspaces/${t}`)}catch{n9.toast.error(r("project.deleteFailed"))}finally{b(!1),m(!1)}},children:[v&&(0,f.jsx)(nJ.Loader2,{className:"h-3 w-3 animate-spin mr-1"}),r("project.deleteButton")]})]})]})})]})}function al({localBranches:e,remoteBranches:t,currentBranch:r,onSwitch:n,onFetch:a,onCreateBranch:s}){let{t:o}=(0,j.useI18n)(),[i,l]=(0,h.useState)(!1),[c,d]=(0,h.useState)(""),[u,m]=(0,h.useState)(!1),p=(0,h.useRef)(null);(0,h.useEffect)(()=>{if(i)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e);function e(e){p.current&&!p.current.contains(e.target)&&l(!1)}},[i]);let x=c.toLowerCase(),g=e.filter(e=>e.toLowerCase().includes(x)),v=t.filter(e=>e.toLowerCase().includes(x)),b=g.length>0||v.length>0,y=async()=>{m(!0);try{await a()}finally{m(!1)}};return(0,f.jsxs)("div",{children:[(0,f.jsxs)("div",{className:"flex items-center justify-between mb-1.5",children:[(0,f.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:o("git.currentBranch")}),(0,f.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,f.jsx)(C.Button,{variant:"ghost",size:"icon-xs",onClick:y,disabled:u,className:"text-muted-foreground","aria-label":"Fetch",children:(0,f.jsx)(n0.RefreshCw,{className:`h-3 w-3 ${u?"animate-spin":""}`})}),(0,f.jsx)(C.Button,{variant:"ghost",size:"icon-xs",onClick:s,className:"text-muted-foreground","aria-label":o("git.createBranch"),children:(0,f.jsx)(w.Plus,{className:"h-3 w-3"})})]})]}),(0,f.jsxs)("div",{className:"relative",ref:p,children:[(0,f.jsxs)("button",{onClick:()=>{l(!i),d("")},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,f.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,f.jsx)(X.GitBranch,{className:"h-3 w-3 shrink-0 text-emerald-400"}),(0,f.jsx)("span",{className:"truncate font-mono text-xs text-foreground",children:r||"—"})]}),(0,f.jsx)(nG.ChevronDown,{className:`h-3 w-3 shrink-0 text-muted-foreground transition-transform ${i?"rotate-180":""}`})]}),i&&(0,f.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,f.jsx)("div",{className:"border-b border-border p-1.5",children:(0,f.jsxs)("div",{className:"relative",children:[(0,f.jsx)(k.Search,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3 w-3 text-muted-foreground"}),(0,f.jsx)("input",{value:c,onChange:e=>d(e.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,f.jsxs)("div",{className:"max-h-60 overflow-auto py-1",children:[!b&&(0,f.jsx)("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No branches found"}),g.length>0&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("p",{className:"px-3 pt-1.5 pb-1 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:o("git.localBranches")}),g.map(e=>{let t=e===r;return(0,f.jsxs)("button",{onClick:()=>{t||n(e),l(!1)},className:`flex w-full items-center gap-2 px-3 py-1.5 text-left transition-colors ${t?"bg-emerald-500/10 text-emerald-400":"text-secondary-foreground hover:bg-accent"}`,children:[(0,f.jsx)(X.GitBranch,{className:"h-3 w-3 shrink-0"}),(0,f.jsx)("span",{className:"truncate font-mono text-xs",children:e}),t&&(0,f.jsx)(R.Check,{className:"h-3 w-3 ml-auto shrink-0"})]},`local-${e}`)})]}),v.length>0&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("p",{className:"px-3 pt-2.5 pb-1 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:o("git.remoteBranches")}),v.map(e=>(0,f.jsxs)("button",{onClick:()=>{n(e),l(!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,f.jsx)(nK.Globe,{className:"h-3 w-3 shrink-0 text-sky-400"}),(0,f.jsx)("span",{className:"truncate font-mono text-xs",children:e})]},`remote-${e}`))]})]})]})]})]})}let ac=(0,v.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 ad=e.i(950211),au=e.i(289208),am=e.i(750986),ap=e.i(610874),af=e.i(11915),ah=e.i(265826);function ax({title:e,description:t,branch:r,baseBranch:n,hasConversation:a,updatedAt:s,onBack:o}){let{t:i}=(0,j.useI18n)();return(0,f.jsxs)("div",{className:"border-b border-border px-4 py-3",children:[(0,f.jsxs)("div",{className:"flex items-center justify-between",children:[(0,f.jsxs)("div",{className:"flex items-center gap-2",children:[(0,f.jsx)(nQ.Sparkles,{className:"h-3.5 w-3.5 text-primary"}),(0,f.jsx)("span",{className:"text-xs font-semibold text-primary",children:i("taskDetail.title")})]}),(0,f.jsxs)(C.Button,{variant:"ghost",onClick:o,className:"flex items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground h-auto px-2 py-1",children:[(0,f.jsx)(ah.ArrowLeft,{className:"h-3.5 w-3.5"}),i("taskDetail.back")]})]}),(0,f.jsx)("h2",{className:"mt-2.5 text-lg font-bold tracking-tight text-foreground",children:e}),t&&(0,f.jsx)("p",{className:"mt-1 text-xs text-muted-foreground line-clamp-2",children:t}),(0,f.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[n?(0,f.jsxs)($.Badge,{variant:"secondary",className:"bg-muted text-muted-foreground text-[10px] font-mono border border-border",children:[(0,f.jsx)(X.GitBranch,{className:"mr-1 h-3 w-3"}),n," · worktree"]}):r?(0,f.jsx)($.Badge,{variant:"secondary",className:"bg-muted text-muted-foreground text-[10px] font-mono border border-border",children:i("taskDetail.directMode")}):null,a&&(0,f.jsx)($.Badge,{variant:"secondary",className:"bg-emerald-500/10 text-emerald-400 text-[10px] border border-emerald-500/20",children:i("taskDetail.hasConversation")}),(0,f.jsxs)("span",{className:"text-[11px] text-muted-foreground",children:[i("taskDetail.updatedAt")," ",(0,ti.formatRelativeTime)(s)]})]})]})}var ag=e.i(477795),av=e.i(486305),ab=e.i(79769),ay=e.i(896894),aj=e.i(409676),aN=e.i(697551),aw=e.i(190045),ak=e.i(797556),aC=e.i(924260),aS=e.i(558543),aE=e.i(884178),aR=e.i(117886),aI=e.i(612758),aP=e.i(215365);let aT=(0,v.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 aO=e.i(996032),aD=e.i(724380);let aM=(0,n_.createServerReference)("40c2ab0119ffd4ced8f4a8114ec09a995edc21b272",n_.callServer,void 0,n_.findSourceMapURL,"getTaskNotes");var aA=e.i(747532);let aL=(0,n_.createServerReference)("400ea84e8a7836f87ab0e72d3b669f65e54ac05662",n_.callServer,void 0,n_.findSourceMapURL,"getTaskAssets");var aF=e.i(739730),aB=e.i(99649);function a$({taskId:e,projectId:t}){let{t:r}=(0,j.useI18n)(),n=(0,h.useRef)(null),[a,s]=(0,h.useState)([]),[o,i]=(0,h.useState)([]),[l,c]=(0,h.useState)(!1),[d,u]=(0,h.useState)(""),[m,p]=(0,h.useState)(""),[x,g]=(0,h.useState)(!1);async function v(){d.trim()&&(await (0,aD.createNote)({title:d.trim(),content:m.trim(),projectId:t,taskId:e,category:"task"}),u(""),p(""),c(!1),aM(e).then(s))}async function b(e){await (0,aA.deleteNote)(e),s(t=>t.filter(t=>t.id!==e))}async function y(r){let a=r.target.files?.[0];if(a){g(!0);try{let r=new FormData;r.set("file",a),r.set("projectId",t),r.set("taskId",e),await (0,aF.uploadAsset)(r),aL(e).then(i)}finally{g(!1),n.current&&(n.current.value="")}}}async function N(e){await (0,aB.deleteAsset)(e),i(t=>t.filter(t=>t.id!==e))}return(0,h.useEffect)(()=>{aM(e).then(s),aL(e).then(i)},[e]),(0,f.jsx)(W.ScrollArea,{className:"h-full",children:(0,f.jsxs)("div",{className:"flex flex-col",children:[(0,f.jsxs)("div",{className:"border-b border-border px-4 py-3",children:[(0,f.jsxs)("div",{className:"flex items-center justify-between",children:[(0,f.jsxs)("h3",{className:"flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:[(0,f.jsx)(nq.FileText,{className:"h-3.5 w-3.5"}),r("taskPage.notes")]}),(0,f.jsxs)(C.Button,{variant:"ghost",className:"h-6 gap-1 px-2 text-xs",onClick:()=>c(!l),children:[l?(0,f.jsx)(aO.X,{className:"h-3 w-3"}):(0,f.jsx)(w.Plus,{className:"h-3 w-3"}),l?"":r("taskPage.addNote")]})]}),l&&(0,f.jsxs)("div",{className:"mt-3 space-y-2",children:[(0,f.jsx)("input",{type:"text",value:d,onChange:e=>u(e.target.value),placeholder:r("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,f.jsx)("textarea",{value:m,onChange:e=>p(e.target.value),placeholder:r("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,f.jsx)(C.Button,{className:"text-xs",onClick:v,disabled:!d.trim(),children:r("taskPage.addNote")})]}),(0,f.jsxs)("div",{className:"mt-2 space-y-2",children:[0===a.length&&!l&&(0,f.jsx)("p",{className:"text-xs text-muted-foreground py-2",children:r("taskPage.noNotes")}),a.map(e=>(0,f.jsx)("div",{className:"group rounded-md border border-border bg-card p-3",children:(0,f.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,f.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,f.jsx)("h4",{className:"text-sm font-medium truncate",children:e.title}),e.content&&(0,f.jsx)("p",{className:"mt-1 text-xs text-muted-foreground line-clamp-3 whitespace-pre-wrap",children:e.content}),(0,f.jsx)("p",{className:"mt-1 text-[10px] text-muted-foreground",children:new Date(e.createdAt).toLocaleString()})]}),(0,f.jsx)(C.Button,{variant:"ghost",size:"icon-xs",onClick:()=>b(e.id),className:"shrink-0 text-muted-foreground opacity-0 hover:bg-destructive/10 hover:text-destructive group-hover:opacity-100",title:r("taskPage.deleteNote"),children:(0,f.jsx)(F.Trash2,{className:"h-3.5 w-3.5"})})]})},e.id))]})]}),(0,f.jsxs)("div",{className:"px-4 py-3",children:[(0,f.jsxs)("div",{className:"flex items-center justify-between",children:[(0,f.jsxs)("h3",{className:"flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:[(0,f.jsx)(aT,{className:"h-3.5 w-3.5"}),r("taskPage.attachments")]}),(0,f.jsxs)(C.Button,{variant:"ghost",className:"h-6 gap-1 px-2 text-xs",onClick:()=>n.current?.click(),disabled:x,children:[(0,f.jsx)(aP.Upload,{className:"h-3 w-3"}),r("taskPage.uploadFile")]}),(0,f.jsx)("input",{ref:n,type:"file",className:"hidden",onChange:y})]}),(0,f.jsxs)("div",{className:"mt-2 space-y-1.5",children:[0===o.length&&(0,f.jsx)("p",{className:"text-xs text-muted-foreground py-2",children:r("taskPage.noAttachments")}),o.map(e=>{var t;return(0,f.jsxs)("div",{className:"group flex items-center gap-2 rounded-md border border-border bg-card px-3 py-2",children:[(0,f.jsx)(aT,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),(0,f.jsx)("span",{className:"flex-1 truncate text-sm",children:e.filename}),(0,f.jsx)("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:(t=e.size)?t<1024?`${t} B`:t<1048576?`${(t/1024).toFixed(1)} KB`:`${(t/1024/1024).toFixed(1)} MB`:""}),(0,f.jsx)(C.Button,{variant:"ghost",size:"icon-xs",onClick:()=>N(e.id),className:"shrink-0 text-muted-foreground opacity-0 hover:bg-destructive/10 hover:text-destructive group-hover:opacity-100",title:r("taskPage.deleteAttachment"),children:(0,f.jsx)(F.Trash2,{className:"h-3 w-3"})})]},e.id)})]})]})]})})}function a_({task:e,workspaceId:t,projectLocalPath:r,onClose:n}){let{t:a}=(0,j.useI18n)(),s=(0,x.useRouter)(),{removePortal:o}=(0,ab.useTerminalPortal)(),[i,l]=(0,h.useState)("terminal"),[c,d]=(0,h.useState)(null),[u,m]=(0,h.useState)(!1),[p,g]=(0,h.useState)(e.status);(0,h.useEffect)(()=>{g(e.status)},[e.status]);let[v,b]=(0,h.useState)(null),[y,N]=(0,h.useState)(!1),[w,k]=(0,h.useState)(!1),[S,E]=(0,h.useState)([]);(0,h.useEffect)(()=>{b(null),N(!1),k(!1),E([]),d(null),l("terminal")},[e.id]);let[R,I]=(0,h.useState)([]),[P,T]=(0,h.useState)(null);(0,h.useEffect)(()=>{let e=!1;return(0,aR.getPrompts)().then(t=>{if(e)return;I(t.map(e=>({id:e.id,name:e.name,isDefault:e.isDefault})));let r=t.find(e=>e.isDefault);r&&T(r.id)}),()=>{e=!0}},[]),(0,h.useEffect)(()=>{b(null),k(!1);let t=!1;return(0,ay.getTaskExecutions)(e.id).then(e=>{if(t)return;let n=e[0];if(n?.status==="RUNNING"){let e=n.worktreePath||r||null;e&&b(e)}E(e.filter(e=>"RUNNING"!==e.status)),k(!0)}),()=>{t=!0}},[e.id]),(0,h.useEffect)(()=>{if("changes"!==i||"TODO"===p||"CANCELLED"===p)return;let t=!1;return m(!0),fetch(`/api/tasks/${e.id}/diff`).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(e=>{t||d(e?.files||e?.branchDeleted?e:null)}).catch(()=>{t||d(null)}).finally(()=>{t||m(!1)}),()=>{t=!0}},[i,p,e.id]);let O=(0,h.useCallback)(async()=>{if(!y){N(!0);try{let{worktreePath:t}=await (0,aj.startPtyExecution)(e.id,"",P);b(t),g("IN_PROGRESS")}catch(e){N(!1),n9.toast.error(e instanceof Error?e.message:String(e))}}},[e.id,y,P]),D=(0,h.useCallback)(t=>{N(!1),b(null),o(e.id),0===t&&g("IN_REVIEW"),(0,ay.getTaskExecutions)(e.id).then(e=>{E(e.filter(e=>"RUNNING"!==e.status))}),s.refresh()},[s,e.id]),M=(0,h.useCallback)(async()=>{await (0,aN.stopPtyExecution)(e.id),N(!1),b(null),g("IN_REVIEW"),(0,ay.getTaskExecutions)(e.id).then(e=>{E(e.filter(e=>"RUNNING"!==e.status))}),s.refresh()},[e.id,s]),A=(0,h.useCallback)(async t=>{N(!0),o(e.id),b(null);try{let{worktreePath:r}=await (0,aw.resumePtyExecution)(e.id,t);b(r),g("IN_PROGRESS")}catch{N(!1)}},[e.id,o]),L=(0,h.useCallback)(async()=>{N(!0),o(e.id),b(null);try{let{worktreePath:t}=await (0,ak.continueLatestPtyExecution)(e.id);b(t),g("IN_PROGRESS")}catch(e){N(!1),n9.toast.error(e instanceof Error?e.message:String(e))}},[e.id,o]),[F,B]=(0,h.useState)(!1),[$,_]=(0,h.useState)([]),z=(0,h.useCallback)(async()=>{try{let t=await (0,aS.checkWorktreeClean)(e.id);if(t.hasWorktree&&!t.clean)return void n9.toast.error(a("taskPage.uncommittedChanges",{count:String(t.files.length)}));if(t.hasWorktree&&t.clean&&!t.hasCommits)return void n9.toast.error(a("taskPage.noChangesToComplete"));if(t.hasWorktree&&t.hasCommits){_(t.commitLog),B(!0);return}await (0,aC.updateTaskStatus)(e.id,"DONE"),g("DONE"),n9.toast.success(a("taskPage.taskCompleted")),s.refresh()}catch{n9.toast.error("Failed to complete task")}},[e.id,s,a]),U=(0,h.useCallback)(()=>{g("DONE"),B(!1),n9.toast.success(a("taskPage.taskCompleted")),s.refresh()},[s,a]),H=(0,h.useCallback)(async t=>{try{let{hash:r}=await (0,aE.commitWorktreeChanges)(e.id,t);n9.toast.success(a("diff.commitSuccess",{hash:r})),s.refresh();let n=await fetch(`/api/tasks/${e.id}/diff`);if(n.ok){let e=await n.json();d(e?.files?e:null)}}catch(e){n9.toast.error(e instanceof Error?e.message:"Commit failed")}},[e.id,s,a]);return(0,f.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,f.jsx)(ax,{title:e.title,description:a("taskDetail.panelDescription"),branch:`task/${e.id}`,baseBranch:e.baseBranch,hasConversation:!1,updatedAt:e.updatedAt,onBack:n}),(0,f.jsxs)("div",{className:"flex items-center justify-between border-b border-border px-4 py-2",children:[(0,f.jsxs)("div",{className:"flex gap-1",children:[(0,f.jsxs)("button",{onClick:()=>l("terminal"),className:`flex items-center gap-1.5 px-3 py-1 text-xs font-medium rounded-md ${"terminal"===i?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,f.jsx)(ad.Terminal,{className:"h-3 w-3"}),a("terminal.execute")]}),(0,f.jsx)("button",{onClick:()=>l("changes"),className:`px-3 py-1 text-xs font-medium rounded-md ${"changes"===i?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:a("taskPage.changes")}),(0,f.jsxs)("button",{onClick:()=>l("notes"),className:`flex items-center gap-1.5 px-3 py-1 text-xs font-medium rounded-md ${"notes"===i?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,f.jsx)(nq.FileText,{className:"h-3 w-3"}),a("taskPage.notes")]})]}),(0,f.jsxs)("div",{className:"flex items-center gap-2",children:["IN_REVIEW"===p&&(0,f.jsxs)(C.Button,{size:"sm",onClick:z,className:"bg-emerald-500/15 text-emerald-400 ring-1 ring-emerald-500/20 hover:bg-emerald-500/25",children:[(0,f.jsx)(am.CheckCircle2,{className:"h-3 w-3"}),a("taskPage.completeTask")]}),"DONE"!==p&&"CANCELLED"!==p&&(0,f.jsxs)(C.Button,{variant:"ghost",size:"sm",onClick:()=>s.push(`/workspaces/${t}/tasks/${e.id}`),className:"text-muted-foreground",children:[(0,f.jsx)(ac,{className:"h-3 w-3"}),a("taskPage.viewDetails")]})]})]}),"terminal"===i?(0,f.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:w?v?(0,f.jsxs)("div",{className:"flex h-full flex-col overflow-hidden",children:[(0,f.jsxs)("div",{className:"shrink-0 flex items-center justify-between border-b border-neutral-800 px-3 py-2 bg-[#0f1419]",children:[(0,f.jsxs)("span",{className:"flex items-center gap-1.5 text-xs text-emerald-400",children:[(0,f.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"}),a("execution.running")]}),(0,f.jsxs)(af.Tooltip,{children:[(0,f.jsxs)(af.TooltipTrigger,{onClick:M,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,f.jsx)(au.Square,{className:"h-3 w-3"}),a("terminal.stopExecution")]}),(0,f.jsx)(af.TooltipContent,{side:"bottom",children:a("terminal.stopHint")})]})]}),(0,f.jsx)("div",{className:"flex-1 min-h-0",children:(0,f.jsx)(ab.TerminalOutlet,{taskId:e.id,worktreePath:v,onSessionEnd:D})})]}):"DONE"===p||"CANCELLED"===p?(0,f.jsx)("div",{className:"flex h-full flex-col overflow-hidden",children:(0,f.jsx)(W.ScrollArea,{className:"flex-1 min-h-0",children:(0,f.jsx)(aI.ExecutionTimeline,{executions:S})})}):(0,f.jsxs)("div",{className:"flex h-full flex-col overflow-hidden",children:[(0,f.jsxs)("div",{className:"shrink-0 flex items-center gap-2 border-b border-border px-4 py-3",children:[R.length>0&&(0,f.jsxs)(ap.Select,{defaultValue:P??"none",onValueChange:e=>T("none"===e?null:e),children:[(0,f.jsx)(ap.SelectTrigger,{size:"sm",className:"min-w-[120px]",children:(0,f.jsx)("span",{className:"text-left truncate",children:P?R.find(e=>e.id===P)?.name??a("terminal.noPrompt"):a("terminal.noPrompt")})}),(0,f.jsxs)(ap.SelectContent,{className:"min-w-[200px]",children:[(0,f.jsx)(ap.SelectItem,{value:"none",children:a("terminal.noPrompt")}),R.map(e=>(0,f.jsxs)(ap.SelectItem,{value:e.id,children:[e.name,e.isDefault?" ★":""]},e.id))]})]},`prompt-${R.length}`),(0,f.jsxs)(C.Button,{onClick:O,disabled:y,size:"sm",className:"gap-2 px-4",children:[y?(0,f.jsx)(nJ.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):(0,f.jsx)(ad.Terminal,{className:"h-3.5 w-3.5"}),y?a("terminal.executing"):a("terminal.launch")]})]}),(0,f.jsx)(W.ScrollArea,{className:"flex-1 min-h-0",children:(0,f.jsx)(aI.ExecutionTimeline,{executions:S,onResume:A,onContinueLatest:L})})]}):(0,f.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-2 bg-[#0f1419]",children:[(0,f.jsx)(nJ.Loader2,{className:"size-5 animate-spin text-neutral-500"}),(0,f.jsx)("span",{className:"text-xs text-neutral-500",children:a("execution.loading")})]})}):"changes"===i?(0,f.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:u?(0,f.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,f.jsx)("p",{className:"text-sm text-muted-foreground",children:a("taskPage.loadingDiff")})}):c?.branchDeleted?(0,f.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,f.jsx)("p",{className:"text-sm text-muted-foreground",children:a("taskPage.branchDeleted")})}):c?(0,f.jsx)(ag.TaskDiffView,{files:c.files,totalAdded:c.totalAdded,totalRemoved:c.totalRemoved,hasConflicts:c.hasConflicts,conflictFiles:c.conflictFiles,onCommit:H,hasUncommitted:c.hasUncommitted}):(0,f.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,f.jsx)("p",{className:"text-sm text-muted-foreground",children:a("taskPage.noChanges")})})}):"notes"===i?(0,f.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:(0,f.jsx)(a$,{taskId:e.id,projectId:e.projectId})}):null,(0,f.jsx)(av.TaskMergeConfirmDialog,{open:F,onOpenChange:B,taskId:e.id,taskTitle:e.title,baseBranch:e.baseBranch??"main",fileCount:c?.files?.length??0,commitCount:c?.commitCount??0,commitLog:$,onMergeComplete:U})]})}let az=(0,n_.createServerReference)("40622d25277e3c11015df1608e15d738bebaf6e879",n_.callServer,void 0,n_.findSourceMapURL,"createTask"),aU=(0,n_.createServerReference)("605b03fbb419cd1a1831e8464a8242d82cdae18ae6",n_.callServer,void 0,n_.findSourceMapURL,"updateTask"),aW=(0,n_.createServerReference)("4037a0d2f662d32e4dd9a4b1a619489e9fdf17d735",n_.callServer,void 0,n_.findSourceMapURL,"deleteTask"),aH=(0,n_.createServerReference)("40a7e4fdd6803b7d8447525be3097063e42fc480f2",n_.callServer,void 0,n_.findSourceMapURL,"toggleTaskPinned");var aG=e.i(864056);function aV({projects:e,activeProjectId:t,onSelect:r}){let n=(0,h.useRef)(null),[a,s]=(0,h.useState)(!1),[o,i]=(0,h.useState)(!1),l=()=>{let e=n.current;e&&(s(e.scrollLeft>0),i(e.scrollLeft<e.scrollWidth-e.clientWidth-1))};(0,h.useEffect)(()=>{l();let e=n.current;if(e){e.addEventListener("scroll",l);let t=new ResizeObserver(l);return t.observe(e),()=>{e.removeEventListener("scroll",l),t.disconnect()}}},[e]);let c=e=>{let t=n.current;t&&t.scrollBy({left:"left"===e?-150:150,behavior:"smooth"})};return(0,f.jsxs)("div",{className:"relative flex items-center",children:[a&&(0,f.jsx)("button",{onClick:()=>c("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,f.jsx)(aG.ChevronLeft,{className:"h-4 w-4"})}),(0,f.jsx)("div",{ref:n,className:"flex items-center gap-1.5 overflow-x-auto scrollbar-none px-1 py-1",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:e.map(e=>{let n=t===e.id;return(0,f.jsxs)("button",{onClick:()=>{n||r(e.id)},className:`shrink-0 rounded-lg border-b-2 px-4 py-2 text-sm font-medium transition-colors ${n?"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,f.jsx)("span",{children:e.name}),e.alias&&(0,f.jsx)("span",{className:"ml-1.5 text-xs text-muted-foreground font-normal",children:e.alias})]},e.id)})}),o&&(0,f.jsx)("button",{onClick:()=>c("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,f.jsx)(nV.ChevronRight,{className:"h-4 w-4"})})]})}e.s(["BoardPageClient",0,function({workspaceId:e,projectId:t,project:r,projects:n,initialTasks:a,labels:s,openTaskId:o}){let i=(0,x.useRouter)(),[,l]=(0,h.useTransition)(),[c,d]=(0,h.useState)(""),[u,m]=(0,h.useState)(!1),[p,g]=(0,h.useState)("TODO"),[v,b]=(0,h.useState)(o?a.find(e=>e.id===o)??null:null),[y,j]=(0,h.useState)(null),w=(0,h.useCallback)(()=>{l(()=>{i.refresh()})},[i]);(0,h.useEffect)(()=>{if(u)return;let e=setInterval(()=>{l(()=>{i.refresh()})},5e3);return()=>clearInterval(e)},[i,u]);let k=(0,h.useCallback)(e=>{d(e)},[]),C=(0,h.useCallback)(async(e,t)=>{await (0,aC.updateTaskStatus)(e,t),v?.id===e&&b({...v,status:t}),w()},[w,v]),E=(0,h.useCallback)(async e=>{await az({title:e.title,description:e.description,projectId:t,priority:e.priority,status:e.status,labelIds:e.labelIds,baseBranch:e.baseBranch,subPath:e.subPath}),w()},[t,w]),R=(0,h.useCallback)(async(e,t)=>{await aU(e,{...t,labelIds:t.labelIds}),j(null),w()},[w]),P=(0,h.useCallback)(async e=>{await aW(e),v?.id===e&&b(null),w()},[w,v]),T=(0,h.useCallback)(async e=>{await aH(e),w()},[w]),O=(0,h.useCallback)(async t=>{try{await (0,aj.startPtyExecution)(t,"")}catch(e){n9.toast.error(e instanceof Error?e.message:String(e))}i.push(`/workspaces/${e}/tasks/${t}`)},[i,e]),D=(0,h.useCallback)(async(e,t)=>{await (0,aC.updateTaskStatus)(e,t),v?.id===e&&b({...v,status:t}),w()},[w,v]),M=(0,h.useCallback)(e=>{g(e),j(null),m(!0)},[]),A=(0,h.useCallback)(e=>{j(e),m(!0)},[]),L=a.filter(e=>!e.labels?.some(e=>e.label.name===I.TOWER_LABEL_NAME&&e.label.isBuiltin)),F=c.trim()?L.filter(e=>{let t=c.toLowerCase();return e.title.toLowerCase().includes(t)||(e.description?.toLowerCase().includes(t)??!1)}):L;return(0,f.jsxs)("div",{className:"flex h-full",children:[(0,f.jsxs)("div",{className:"flex flex-1 flex-col overflow-hidden",children:[(0,f.jsx)("div",{className:"px-6 pt-3 pb-1",children:(0,f.jsx)(aV,{projects:n,activeProjectId:t,onSelect:t=>i.push(`/workspaces/${e}?projectId=${t}`,{scroll:!1})})}),(0,f.jsx)(N,{totalTasks:L.length,runningTasks:L.filter(e=>"IN_PROGRESS"===e.status).length}),(0,f.jsx)(S,{searchQuery:c,onSearchChange:k,onCreateTask:()=>{j(null),m(!0)}}),(0,f.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden p-4",children:(0,f.jsx)(V,{initialTasks:F,onTaskMove:C,onTaskClick:e=>{b(e)},onEditTask:A,onAddTask:M,onDeleteTask:P,onTogglePin:T,workspaceId:e,onContextMenuStatusChange:D,onContextMenuLaunch:O})}),(0,f.jsx)(nH,{open:u,onOpenChange:e=>{m(e),e||j(null)},onSubmit:E,onUpdate:R,defaultStatus:p,editTask:y,editTaskLabelIds:y?.labels?y.labels.map(e=>e.labelId):[],labels:s.filter(e=>!(e.name===I.TOWER_LABEL_NAME&&e.isBuiltin)),projectType:r.type,projectLocalPath:r.localPath})]}),v?(0,f.jsx)(a_,{task:v,workspaceId:e,projectLocalPath:r.localPath,onClose:()=>b(null)}):(0,f.jsx)(ai,{project:r,workspaceId:e})]})}],136924)}]);
5
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return h.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},r4=({contentRef:e,descriptionId:t})=>{let r=r5("DialogDescriptionWarning"),n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${r.contentName}}.`;return h.useEffect(()=>{let r=e.current?.getAttribute("aria-describedby");t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},r8=Symbol.for("react.lazy"),r9=h[" use ".trim().toString()];function r7(e){var t;return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===r8&&"_payload"in e&&"object"==typeof(t=e._payload)&&null!==t&&"then"in t}var r6=Symbol("radix.slottable");function ne(e){return h.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===r6}var nt=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var r,n;let a,s,o,i=(n=r=`Primitive.${t}`,(a=h.forwardRef((e,t)=>{let{children:r,...n}=e;if(r7(r)&&"function"==typeof r9&&(r=r9(r._payload)),h.isValidElement(r)){var a;let e,s,o=(a=r,(s=(e=Object.getOwnPropertyDescriptor(a.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?a.ref:(s=(e=Object.getOwnPropertyDescriptor(a,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?a.props.ref:a.props.ref||a.ref),i=function(e,t){let r={...t};for(let n in t){let a=e[n],s=t[n];/^on[A-Z]/.test(n)?a&&s?r[n]=(...e)=>{let t=s(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...s}:"className"===n&&(r[n]=[a,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==h.Fragment&&(i.ref=t?tv(t,o):o),h.cloneElement(r,i)}return h.Children.count(r)>1?h.Children.only(null):null})).displayName=`${n}.SlotClone`,s=a,(o=h.forwardRef((e,t)=>{let{children:r,...n}=e;r7(r)&&"function"==typeof r9&&(r=r9(r._payload));let a=h.Children.toArray(r),o=a.find(ne);if(o){let e=o.props.children,r=a.map(t=>t!==o?t:h.Children.count(e)>1?h.Children.only(null):h.isValidElement(e)?e.props.children:null);return(0,f.jsx)(s,{...n,ref:t,children:h.isValidElement(e)?h.cloneElement(e,void 0,r):null})}return(0,f.jsx)(s,{...n,ref:t,children:r})})).displayName=`${r}.Slot`,o),l=h.forwardRef((e,r)=>{let{asChild:n,...a}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,f.jsx)(n?i:t,{...a,ref:r})});return l.displayName=`Primitive.${t}`,{...e,[t]:l}},{}),nr='[cmdk-group=""]',nn='[cmdk-group-items=""]',na='[cmdk-item=""]',ns=`${na}:not([aria-disabled="true"])`,no="cmdk-item-select",ni="data-value",nl=(e,t,r)=>{var n;return n=e,function e(t,r,n,a,s,o,i){if(o===r.length)return s===t.length?1:.99;var l=`${s},${o}`;if(void 0!==i[l])return i[l];for(var c,d,u,m,p=a.charAt(o),f=n.indexOf(p,s),h=0;f>=0;)(c=e(t,r,n,a,f+1,o+1,i))>h&&(f===s?c*=1:tu.test(t.charAt(f-1))?(c*=.8,(u=t.slice(s,f-1).match(tm))&&s>0&&(c*=Math.pow(.999,u.length))):tp.test(t.charAt(f-1))?(c*=.9,(m=t.slice(s,f-1).match(tf))&&s>0&&(c*=Math.pow(.999,m.length))):(c*=.17,s>0&&(c*=Math.pow(.999,f-s))),t.charAt(f)!==r.charAt(o)&&(c*=.9999)),(c<.1&&n.charAt(f-1)===a.charAt(o+1)||a.charAt(o+1)===a.charAt(o)&&n.charAt(f-1)!==a.charAt(o))&&.1*(d=e(t,r,n,a,f+1,o+2,i))>c&&(c=.1*d),c>h&&(h=c),f=n.indexOf(p,f+1);return i[l]=h,h}(n=r&&r.length>0?`${n+" "+r.join(" ")}`:n,t,th(n),th(t),0,0,{})},nc=h.createContext(void 0),nd=h.createContext(void 0),nu=h.createContext(void 0),nm=h.forwardRef((e,t)=>{let r=nN(()=>{var t,r;return{search:"",value:null!=(r=null!=(t=e.value)?t:e.defaultValue)?r:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),n=nN(()=>new Set),a=nN(()=>new Map),s=nN(()=>new Map),o=nN(()=>new Set),i=ny(e),{label:l,children:c,value:d,onValueChange:u,filter:m,shouldFilter:p,loop:f,disablePointerSelection:x=!1,vimBindings:g=!0,...v}=e,b=tw(),y=tw(),j=tw(),N=h.useRef(null),w=nC();nj(()=>{if(void 0!==d){let e=d.trim();r.current.value=e,k.emit()}},[d]),nj(()=>{w(6,P)},[]);let k=h.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>r.current,setState:(e,t,n)=>{var a,s,o,l;if(!Object.is(r.current[e],t)){if(r.current[e]=t,"search"===e)I(),E(),w(1,R);else if("value"===e){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let e=document.getElementById(j);e?e.focus():null==(a=document.getElementById(b))||a.focus()}if(w(7,()=>{var e;r.current.selectedItemId=null==(e=T())?void 0:e.id,k.emit()}),n||w(5,P),(null==(s=i.current)?void 0:s.value)!==void 0){null==(l=(o=i.current).onValueChange)||l.call(o,null!=t?t:"");return}}k.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),C=h.useMemo(()=>({value:(e,t,n)=>{var a;t!==(null==(a=s.current.get(e))?void 0:a.value)&&(s.current.set(e,{value:t,keywords:n}),r.current.filtered.items.set(e,S(t,n)),w(2,()=>{E(),k.emit()}))},item:(e,t)=>(n.current.add(e),t&&(a.current.has(t)?a.current.get(t).add(e):a.current.set(t,new Set([e]))),w(3,()=>{I(),E(),r.current.value||R(),k.emit()}),()=>{s.current.delete(e),n.current.delete(e),r.current.filtered.items.delete(e);let t=T();w(4,()=>{I(),(null==t?void 0:t.getAttribute("id"))===e&&R(),k.emit()})}),group:e=>(a.current.has(e)||a.current.set(e,new Set),()=>{s.current.delete(e),a.current.delete(e)}),filter:()=>i.current.shouldFilter,label:l||e["aria-label"],getDisablePointerSelection:()=>i.current.disablePointerSelection,listId:b,inputId:j,labelId:y,listInnerRef:N}),[]);function S(e,t){var n,a;let s=null!=(a=null==(n=i.current)?void 0:n.filter)?a:nl;return e?s(e,r.current.search,t):0}function E(){if(!r.current.search||!1===i.current.shouldFilter)return;let e=r.current.filtered.items,t=[];r.current.filtered.groups.forEach(r=>{let n=a.current.get(r),s=0;n.forEach(t=>{s=Math.max(e.get(t),s)}),t.push([r,s])});let n=N.current;O().sort((t,r)=>{var n,a;let s=t.getAttribute("id"),o=r.getAttribute("id");return(null!=(n=e.get(o))?n:0)-(null!=(a=e.get(s))?a:0)}).forEach(e=>{let t=e.closest(nn);t?t.appendChild(e.parentElement===t?e:e.closest(`${nn} > *`)):n.appendChild(e.parentElement===n?e:e.closest(`${nn} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{var t;let r=null==(t=N.current)?void 0:t.querySelector(`${nr}[${ni}="${encodeURIComponent(e[0])}"]`);null==r||r.parentElement.appendChild(r)})}function R(){let e=O().find(e=>"true"!==e.getAttribute("aria-disabled")),t=null==e?void 0:e.getAttribute(ni);k.setState("value",t||void 0)}function I(){var e,t,o,l;if(!r.current.search||!1===i.current.shouldFilter){r.current.filtered.count=n.current.size;return}r.current.filtered.groups=new Set;let c=0;for(let a of n.current){let n=S(null!=(t=null==(e=s.current.get(a))?void 0:e.value)?t:"",null!=(l=null==(o=s.current.get(a))?void 0:o.keywords)?l:[]);r.current.filtered.items.set(a,n),n>0&&c++}for(let[e,t]of a.current)for(let n of t)if(r.current.filtered.items.get(n)>0){r.current.filtered.groups.add(e);break}r.current.filtered.count=c}function P(){var e,t,r;let n=T();n&&((null==(e=n.parentElement)?void 0:e.firstChild)===n&&(null==(r=null==(t=n.closest(nr))?void 0:t.querySelector('[cmdk-group-heading=""]'))||r.scrollIntoView({block:"nearest"})),n.scrollIntoView({block:"nearest"}))}function T(){var e;return null==(e=N.current)?void 0:e.querySelector(`${na}[aria-selected="true"]`)}function O(){var e;return Array.from((null==(e=N.current)?void 0:e.querySelectorAll(ns))||[])}function D(e){let t=O()[e];t&&k.setState("value",t.getAttribute(ni))}function M(e){var t;let r=T(),n=O(),a=n.findIndex(e=>e===r),s=n[a+e];null!=(t=i.current)&&t.loop&&(s=a+e<0?n[n.length-1]:a+e===n.length?n[0]:n[a+e]),s&&k.setState("value",s.getAttribute(ni))}function A(e){let t=T(),r=null==t?void 0:t.closest(nr),n;for(;r&&!n;)n=null==(r=e>0?function(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}(r,nr):function(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}(r,nr))?void 0:r.querySelector(ns);n?k.setState("value",n.getAttribute(ni)):M(e)}let L=()=>D(O().length-1),F=e=>{e.preventDefault(),e.metaKey?L():e.altKey?A(1):M(1)},B=e=>{e.preventDefault(),e.metaKey?D(0):e.altKey?A(-1):M(-1)};return h.createElement(nt.div,{ref:t,tabIndex:-1,...v,"cmdk-root":"",onKeyDown:e=>{var t;null==(t=v.onKeyDown)||t.call(v,e);let r=e.nativeEvent.isComposing||229===e.keyCode;if(!(e.defaultPrevented||r))switch(e.key){case"n":case"j":g&&e.ctrlKey&&F(e);break;case"ArrowDown":F(e);break;case"p":case"k":g&&e.ctrlKey&&B(e);break;case"ArrowUp":B(e);break;case"Home":e.preventDefault(),D(0);break;case"End":e.preventDefault(),L();break;case"Enter":{e.preventDefault();let t=T();if(t){let e=new Event(no);t.dispatchEvent(e)}}}}},h.createElement("label",{"cmdk-label":"",htmlFor:C.inputId,id:C.labelId,style:nE},l),nS(e,e=>h.createElement(nd.Provider,{value:k},h.createElement(nc.Provider,{value:C},e))))}),np=h.forwardRef((e,t)=>{var r,n;let a=tw(),s=h.useRef(null),o=h.useContext(nu),i=h.useContext(nc),l=ny(e),c=null!=(n=null==(r=l.current)?void 0:r.forceMount)?n:null==o?void 0:o.forceMount;nj(()=>{if(!c)return i.item(a,null==o?void 0:o.id)},[c]);let d=nk(a,s,[e.value,e.children,s],e.keywords),u=h.useContext(nd),m=nw(e=>e.value&&e.value===d.current),p=nw(e=>!!c||!1===i.filter()||!e.search||e.filtered.items.get(a)>0);function f(){var e,t;x(),null==(t=(e=l.current).onSelect)||t.call(e,d.current)}function x(){u.setState("value",d.current,!0)}if(h.useEffect(()=>{let t=s.current;if(!(!t||e.disabled))return t.addEventListener(no,f),()=>t.removeEventListener(no,f)},[p,e.onSelect,e.disabled]),!p)return null;let{disabled:g,value:v,onSelect:b,forceMount:y,keywords:j,...N}=e;return h.createElement(nt.div,{ref:tv(s,t),...N,id:a,"cmdk-item":"",role:"option","aria-disabled":!!g,"aria-selected":!!m,"data-disabled":!!g,"data-selected":!!m,onPointerMove:g||i.getDisablePointerSelection()?void 0:x,onClick:g?void 0:f},e.children)}),nf=h.forwardRef((e,t)=>{let{heading:r,children:n,forceMount:a,...s}=e,o=tw(),i=h.useRef(null),l=h.useRef(null),c=tw(),d=h.useContext(nc),u=nw(e=>!!a||!1===d.filter()||!e.search||e.filtered.groups.has(o));nj(()=>d.group(o),[]),nk(o,i,[e.value,e.heading,l]);let m=h.useMemo(()=>({id:o,forceMount:a}),[a]);return h.createElement(nt.div,{ref:tv(i,t),...s,"cmdk-group":"",role:"presentation",hidden:!u||void 0},r&&h.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:c},r),nS(e,e=>h.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?c:void 0},h.createElement(nu.Provider,{value:m},e))))}),nh=h.forwardRef((e,t)=>{let{alwaysRender:r,...n}=e,a=h.useRef(null),s=nw(e=>!e.search);return r||s?h.createElement(nt.div,{ref:tv(a,t),...n,"cmdk-separator":"",role:"separator"}):null}),nx=h.forwardRef((e,t)=>{let{onValueChange:r,...n}=e,a=null!=e.value,s=h.useContext(nd),o=nw(e=>e.search),i=nw(e=>e.selectedItemId),l=h.useContext(nc);return h.useEffect(()=>{null!=e.value&&s.setState("search",e.value)},[e.value]),h.createElement(nt.input,{ref:t,...n,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":i,id:l.inputId,type:"text",value:a?e.value:o,onChange:e=>{a||s.setState("search",e.target.value),null==r||r(e.target.value)}})}),ng=h.forwardRef((e,t)=>{let{children:r,label:n="Suggestions",...a}=e,s=h.useRef(null),o=h.useRef(null),i=nw(e=>e.selectedItemId),l=h.useContext(nc);return h.useEffect(()=>{if(o.current&&s.current){let e=o.current,t=s.current,r,n=new ResizeObserver(()=>{r=requestAnimationFrame(()=>{let r=e.offsetHeight;t.style.setProperty("--cmdk-list-height",r.toFixed(1)+"px")})});return n.observe(e),()=>{cancelAnimationFrame(r),n.unobserve(e)}}},[]),h.createElement(nt.div,{ref:tv(s,t),...a,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":i,"aria-label":n,id:l.listId},nS(e,e=>h.createElement("div",{ref:tv(o,l.listInnerRef),"cmdk-list-sizer":""},e)))}),nv=h.forwardRef((e,t)=>{let{open:r,onOpenChange:n,overlayClassName:a,contentClassName:s,container:o,...i}=e;return h.createElement(rL,{open:r,onOpenChange:n},h.createElement(rz,{container:o},h.createElement(rW,{"cmdk-overlay":"",className:a}),h.createElement(rK,{"aria-label":e.label,"cmdk-dialog":"",className:s},h.createElement(nm,{ref:t,...i}))))}),nb=Object.assign(nm,{List:ng,Item:np,Input:nx,Group:nf,Separator:nh,Dialog:nv,Empty:h.forwardRef((e,t)=>nw(e=>0===e.filtered.count)?h.createElement(nt.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Loading:h.forwardRef((e,t)=>{let{progress:r,children:n,label:a="Loading...",...s}=e;return h.createElement(nt.div,{ref:t,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},nS(e,e=>h.createElement("div",{"aria-hidden":!0},e)))})});function ny(e){let t=h.useRef(e);return nj(()=>{t.current=e}),t}var nj="u"<typeof window?h.useEffect:h.useLayoutEffect;function nN(e){let t=h.useRef();return void 0===t.current&&(t.current=e()),t}function nw(e){let t=h.useContext(nd),r=()=>e(t.snapshot());return h.useSyncExternalStore(t.subscribe,r,r)}function nk(e,t,r,n=[]){let a=h.useRef(),s=h.useContext(nc);return nj(()=>{var o;let i=(()=>{var e;for(let t of r){if("string"==typeof t)return t.trim();if("object"==typeof t&&"current"in t)return t.current?null==(e=t.current.textContent)?void 0:e.trim():a.current}})(),l=n.map(e=>e.trim());s.value(e,i,l),null==(o=t.current)||o.setAttribute(ni,i),a.current=i}),a}var nC=()=>{let[e,t]=h.useState(),r=nN(()=>new Map);return nj(()=>{r.current.forEach(e=>e()),r.current=new Map},[e]),(e,n)=>{r.current.set(e,n),t({})}};function nS({asChild:e,children:t},r){let n;return e&&h.isValidElement(t)?h.cloneElement("function"==typeof(n=t.type)?n(t.props):"render"in n?n.render(t.props):t,{ref:t.ref},r(t.props.children)):r(t)}var nE={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"},nR=e.i(164688);function nI({className:e,...t}){return(0,f.jsx)("div",{"data-slot":"input-group",role:"group",className:(0,ti.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",e),...t})}let nP=(0,nR.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 nT({className:e,align:t="inline-start",...r}){return(0,f.jsx)("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:(0,ti.cn)(nP({align:t}),e),onClick:e=>{e.target.closest("button")||e.currentTarget.parentElement?.querySelector("input")?.focus()},...r})}(0,nR.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 nO=e.i(142296),nO=nO,nD=e.i(209760);function nM({className:e,...t}){return(0,f.jsx)(nb,{"data-slot":"command",className:(0,ti.cn)("flex size-full flex-col overflow-hidden rounded-xl! bg-popover p-1 text-popover-foreground",e),...t})}function nA({className:e,...t}){return(0,f.jsx)("div",{"data-slot":"command-input-wrapper",className:"p-1 pb-0",children:(0,f.jsxs)(nI,{className:"h-8! rounded-lg! border-input/30 bg-input/30 shadow-none! *:data-[slot=input-group-addon]:pl-2!",children:[(0,f.jsx)(nb.Input,{"data-slot":"command-input",className:(0,ti.cn)("w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",e),...t}),(0,f.jsx)(nT,{children:(0,f.jsx)(nO.default,{className:"size-4 shrink-0 opacity-50"})})]})})}function nL({className:e,...t}){return(0,f.jsx)(nb.List,{"data-slot":"command-list",className:(0,ti.cn)("no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none",e),...t})}function nF({className:e,...t}){return(0,f.jsx)(nb.Empty,{"data-slot":"command-empty",className:(0,ti.cn)("py-6 text-center text-sm",e),...t})}function nB({className:e,...t}){return(0,f.jsx)(nb.Group,{"data-slot":"command-group",className:(0,ti.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",e),...t})}function n$({className:e,children:t,...r}){return(0,f.jsxs)(nb.Item,{"data-slot":"command-item",className:(0,ti.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",e),...r,children:[t,(0,f.jsx)(nD.CheckIcon,{className:"ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100"})]})}var n_=e.i(543485);let nz=(0,n_.createServerReference)("40709d2ea2001ab9698482e5c43736bf3793a5c4a7",n_.callServer,void 0,n_.findSourceMapURL,"getProjectBranches"),nU=(0,n_.createServerReference)("4022e746885ec7ed12cdd7f8cbe851c024859209ff",n_.callServer,void 0,n_.findSourceMapURL,"fetchRemoteBranches"),nW=(0,n_.createServerReference)("40945b22dcbfc9249d4a29415e4ecdc3d3d0892a26",n_.callServer,void 0,n_.findSourceMapURL,"getCurrentBranch");function nH({open:e,onOpenChange:t,onSubmit:r,onUpdate:n,defaultStatus:a="TODO",editTask:s,editTaskLabelIds:o,labels:i,projectType:l,projectLocalPath:c}){let[d,u]=(0,h.useState)(""),[m,p]=(0,h.useState)(""),[x,g]=(0,h.useState)("MEDIUM"),[v,b]=(0,h.useState)(""),[y,N]=(0,h.useState)([]),[w,k]=(0,h.useState)([]),[S,E]=(0,h.useState)(!1),[I,P]=(0,h.useState)(""),[T,O]=(0,h.useState)(!1),[D,M]=(0,h.useState)(!0),{t:A}=(0,j.useI18n)(),L=!!s,F=!!c;return(0,h.useEffect)(()=>{s?(u(s.title),p(s.description??""),g(s.priority),b(s.subPath??""),N(o??[])):(u(""),p(""),g("MEDIUM"),b(""),N([]))},[s,o]),(0,h.useEffect)(()=>{e||s||(u(""),p(""),g("MEDIUM"),b(""),N([]),k([]),P(""),O(!1))},[e,s]),(0,h.useEffect)(()=>{e&&F&&!s&&(E(!0),Promise.all([nz(c),nW(c)]).then(([e,t])=>{k(e),P(t&&e.includes(t)?t:e[0]??""),E(!1),nU(c).then(()=>{setTimeout(()=>{nz(c).then(e=>{k(e),P(t=>e.includes(t)?t:e[0]??"")}).catch(()=>{})},3e3)})}).catch(()=>{k([]),P(""),E(!1)}))},[e,F,c,s]),(0,f.jsx)(U.Dialog,{open:e,onOpenChange:t,disablePointerDismissal:!0,children:(0,f.jsxs)(U.DialogContent,{className:"sm:max-w-md",children:[(0,f.jsx)(U.DialogHeader,{children:(0,f.jsx)(U.DialogTitle,{children:L?A("task.edit"):A("task.create")})}),(0,f.jsxs)("div",{className:"space-y-4 py-2",children:[(0,f.jsxs)("div",{className:"space-y-2",children:[(0,f.jsx)(Y.Label,{htmlFor:"title",children:A("task.title")}),(0,f.jsx)(K.Input,{id:"title","data-testid":"task-title",placeholder:A("task.titlePlaceholder"),value:d,onChange:e=>u(e.target.value),onKeyDown:e=>"Enter"===e.key&&e.preventDefault()})]}),(0,f.jsxs)("div",{className:"space-y-2",children:[(0,f.jsx)(Y.Label,{htmlFor:"description",children:A("task.description")}),(0,f.jsx)(q.Textarea,{id:"description",placeholder:A("task.descPlaceholder"),rows:4,value:m,onChange:e=>p(e.target.value),className:"max-h-[200px] overflow-y-auto"})]}),(0,f.jsxs)("div",{className:"space-y-2",children:[(0,f.jsx)(Y.Label,{htmlFor:"subPath",children:A("task.subPath")}),(0,f.jsx)(K.Input,{id:"subPath",placeholder:A("task.subPathPlaceholder"),value:v,onChange:e=>b(e.target.value)}),(0,f.jsx)("p",{className:"text-xs text-muted-foreground",children:A("task.subPathHint")})]}),(0,f.jsxs)("div",{className:"space-y-2",children:[(0,f.jsx)(Y.Label,{children:A("task.priority")}),(0,f.jsx)("div",{className:"flex gap-1.5",children:["LOW","MEDIUM","HIGH","CRITICAL"].map(e=>{let t={LOW:{label:A("task.priorityLow"),style:"text-slate-300 border-slate-500/30 bg-slate-500/10"},MEDIUM:{label:A("task.priorityMedium"),style:"text-amber-300 border-amber-500/30 bg-amber-500/10"},HIGH:{label:A("task.priorityHigh"),style:"text-orange-300 border-orange-500/30 bg-orange-500/10"},CRITICAL:{label:A("task.priorityCritical"),style:"text-rose-300 border-rose-500/30 bg-rose-500/10"}}[e];return(0,f.jsx)("button",{type:"button",onClick:()=>g(e),className:`rounded-lg border px-3 py-1.5 text-xs font-medium transition-all ${x===e?`${t.style} ring-1 ring-current/20`:"border-border text-muted-foreground hover:bg-accent"}`,children:t.label},e)})})]}),F&&!L&&(0,f.jsxs)("div",{className:"space-y-2",children:[(0,f.jsx)(Y.Label,{children:A("task.baseBranch")}),S?(0,f.jsx)("div",{className:"text-sm text-muted-foreground",children:A("task.branchLoading")}):w.length>0?(0,f.jsxs)(tl,{open:T,onOpenChange:O,children:[(0,f.jsxs)(tc,{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,f.jsx)(X.GitBranch,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),(0,f.jsx)("span",{className:"flex-1 truncate text-left text-xs",children:I||A("task.branchNone")}),(0,f.jsx)(Z,{className:"h-3.5 w-3.5 shrink-0 opacity-50"})]}),(0,f.jsx)(td,{className:"p-0",align:"start",children:(0,f.jsxs)(nM,{children:[(0,f.jsx)(nA,{placeholder:A("task.branchSearch")}),(0,f.jsxs)(nL,{children:[(0,f.jsx)(nF,{children:A("task.branchNone")}),(0,f.jsx)(nB,{children:w.map(e=>(0,f.jsxs)(n$,{value:e,onSelect:()=>{P(e),O(!1)},children:[(0,f.jsx)(X.GitBranch,{className:"h-3 w-3 text-muted-foreground shrink-0 mr-2"}),(0,f.jsx)("span",{className:"flex-1 truncate font-mono",children:e}),e===I&&(0,f.jsx)(R.Check,{className:"h-3 w-3 text-primary shrink-0 ml-auto"})]},e))})]})]})})]}):(0,f.jsx)("div",{className:"text-sm text-muted-foreground",children:A("task.branchNone")}),(0,f.jsxs)("div",{className:"mt-3 flex items-center gap-2",children:[(0,f.jsx)(Y.Label,{className:"text-xs text-muted-foreground",children:A("task.worktreeLabel")}),(0,f.jsx)("div",{className:"flex gap-1",children:[!0,!1].map(e=>(0,f.jsx)("button",{type:"button",onClick:()=>M(e),className:`rounded-md px-3 py-1 text-xs font-medium transition-colors ${D===e?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:text-foreground"}`,children:e?A("task.worktreeYes"):A("task.worktreeNo")},String(e)))})]})]}),i.length>0&&(0,f.jsxs)("div",{className:"space-y-2",children:[(0,f.jsx)(Y.Label,{children:A("task.labels")}),(0,f.jsx)("div",{className:"flex flex-wrap gap-1.5",children:i.map(e=>{let t=y.includes(e.id);return(0,f.jsx)("button",{type:"button",onClick:()=>{N(r=>t?r.filter(t=>t!==e.id):[...r,e.id])},className:`rounded-full px-2.5 py-1 text-xs font-medium transition-all ${t?"ring-1 ring-current/30":"opacity-50 hover:opacity-80"}`,style:{backgroundColor:e.color+"20",color:e.color,borderColor:t?e.color+"40":"transparent",borderWidth:"1px"},children:e.name},e.id)})})]})]}),(0,f.jsxs)(U.DialogFooter,{children:[(0,f.jsx)(C.Button,{variant:"outline",onClick:()=>t(!1),children:A("common.cancel")}),(0,f.jsx)(C.Button,{onClick:()=>{d.trim()&&(L&&n?n(s.id,{title:d,description:m,priority:x,labelIds:y,subPath:v.trim()||""}):r({title:d,description:m,priority:x,status:a,labelIds:y,...F&&D&&I?{baseBranch:I}:{},...v.trim()?{subPath:v.trim()}:{}}),u(""),p(""),g("MEDIUM"),b(""),N([]),k([]),P(""),M(!0),t(!1))},className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:L?A("common.save"):A("common.create")})]})]})})}var nG=e.i(458851),nV=e.i(803041),nK=e.i(802461),nq=e.i(555159),nY=e.i(478430);let nX=(0,v.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 nZ=e.i(894296),nJ=e.i(946960),nQ=e.i(239358),n0=e.i(126741),n1=e.i(581265),n2=e.i(249472);let n5=(0,n_.createServerReference)("40020a75fca39101e3a19e18ee61bd1f6feb43d0db",n_.callServer,void 0,n_.findSourceMapURL,"deleteProject"),n3=(0,n_.createServerReference)("4043e343760201a238ce986f8233c1371e057bdcda",n_.callServer,void 0,n_.findSourceMapURL,"getRecentLocalProjects"),n4=(0,n_.createServerReference)("40cf0477520bd1ff9e5958ab2ede6d1ad5227a5322",n_.callServer,void 0,n_.findSourceMapURL,"getOrCreateTowerTaskId");var n8=e.i(962040),n9=e.i(286302),n7=e.i(921280),n6=e.i(584685),ae=e.i(909105),at=e.i(421845);function ar({commits:e}){let{t}=(0,j.useI18n)(),[r,n]=(0,h.useState)(!1);return 0===e.length?null:(0,f.jsxs)("div",{children:[(0,f.jsxs)("button",{onClick:()=>n(!r),className:"flex w-full items-center justify-between py-1",children:[(0,f.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:t("git.commitLog")}),r?(0,f.jsx)(nG.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,f.jsx)(nV.ChevronRight,{className:"h-3 w-3 text-muted-foreground"})]}),r&&(0,f.jsx)("div",{className:"mt-1.5 space-y-0.5 max-h-64 overflow-y-auto",children:e.map(e=>(0,f.jsxs)("div",{className:"group flex items-start gap-2 rounded-md px-2 py-1.5 hover:bg-accent transition-colors",children:[(0,f.jsx)(nX,{className:"h-3 w-3 shrink-0 text-muted-foreground mt-0.5"}),(0,f.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,f.jsx)("p",{className:"text-xs text-foreground line-clamp-1",children:e.message}),(0,f.jsxs)("div",{className:"flex items-center gap-2 mt-0.5",children:[(0,f.jsxs)("button",{onClick:()=>{navigator.clipboard.writeText(e.shortHash),n9.toast.success(`Copied ${e.shortHash}`)},className:"flex items-center gap-0.5 font-mono text-[10px] text-primary/70 hover:text-primary transition-colors",children:[e.shortHash,(0,f.jsx)(at.Copy,{className:"h-2.5 w-2.5 opacity-0 group-hover:opacity-100 transition-opacity"})]}),(0,f.jsx)("span",{className:"text-[10px] text-muted-foreground",children:e.author}),(0,f.jsx)("span",{className:"text-[10px] text-muted-foreground",children:function(e){let t=Math.floor((Date.now()-new Date(e).getTime())/6e4);if(t<1)return"just now";if(t<60)return`${t}m`;let r=Math.floor(t/60);if(r<24)return`${r}h`;let n=Math.floor(r/24);return n<30?`${n}d`:`${Math.floor(n/30)}mo`}(e.date)})]})]})]},e.hash))})]})}var an=e.i(565037),aa=e.i(871183),as=e.i(657572);function ao({localPath:e,stashes:t,hasChanges:r,onRefresh:n}){let{t:a}=(0,j.useI18n)(),[s,o]=(0,h.useState)(!1),[i,l]=(0,h.useState)(!1),[c,d]=(0,h.useState)(""),[u,m]=(0,h.useState)(null),p=async()=>{l(!0);try{await (0,as.gitAction)(e,"stash-save",{message:c}),d(""),n9.toast.success(a("git.stashSaved")),await n()}catch(e){n9.toast.error(e instanceof Error?e.message:String(e))}finally{l(!1)}},x=async t=>{m(t);try{await (0,as.gitAction)(e,"stash-pop",{index:t}),n9.toast.success(a("git.stashApplied")),await n()}catch(e){n9.toast.error(e instanceof Error?e.message:String(e))}finally{m(null)}},g=async t=>{m(t);try{await (0,as.gitAction)(e,"stash-drop",{index:t}),n9.toast.success(a("git.stashDropped")),await n()}catch(e){n9.toast.error(e instanceof Error?e.message:String(e))}finally{m(null)}};return r||0!==t.length?(0,f.jsxs)("div",{children:[(0,f.jsxs)("button",{onClick:()=>o(!s),className:"flex w-full items-center justify-between py-1",children:[(0,f.jsxs)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:[a("git.stash")," ",t.length>0&&`(${t.length})`]}),s?(0,f.jsx)(nG.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,f.jsx)(nV.ChevronRight,{className:"h-3 w-3 text-muted-foreground"})]}),s&&(0,f.jsxs)("div",{className:"mt-1.5 space-y-2",children:[r&&(0,f.jsxs)("div",{className:"flex gap-1.5",children:[(0,f.jsx)(K.Input,{value:c,onChange:e=>d(e.target.value),placeholder:a("git.stashMsgPlaceholder"),className:"h-7 text-xs flex-1",onKeyDown:e=>"Enter"===e.key&&p()}),(0,f.jsx)(C.Button,{variant:"outline",size:"icon-sm",onClick:p,disabled:i,className:"shrink-0",children:i?(0,f.jsx)(nJ.Loader2,{className:"h-3 w-3 animate-spin"}):(0,f.jsx)(an.Archive,{className:"h-3 w-3"})})]}),t.length>0&&(0,f.jsx)("div",{className:"space-y-0.5",children:t.map(e=>(0,f.jsxs)("div",{className:"group flex items-center gap-2 rounded-md px-2 py-1.5 hover:bg-accent transition-colors",children:[(0,f.jsx)(an.Archive,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),(0,f.jsx)("span",{className:"flex-1 min-w-0 truncate text-xs text-foreground",children:e.message||`stash@{${e.index}}`}),(0,f.jsxs)("div",{className:"flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,f.jsx)(C.Button,{variant:"ghost",size:"icon-xs",onClick:()=>x(e.index),disabled:u===e.index,className:"text-muted-foreground","aria-label":a("git.stashApply"),children:u===e.index?(0,f.jsx)(nJ.Loader2,{className:"h-3 w-3 animate-spin"}):(0,f.jsx)(aa.ArrowUpFromLine,{className:"h-3 w-3"})}),(0,f.jsx)(C.Button,{variant:"ghost",size:"icon-xs",onClick:()=>g(e.index),disabled:u===e.index,className:"text-rose-400","aria-label":a("git.stashDrop"),children:(0,f.jsx)(F.Trash2,{className:"h-3 w-3"})})]})]},e.index))})]})]}):null}function ai({project:e,workspaceId:t}){let{t:r,locale:n}=(0,j.useI18n)(),a=(0,x.useRouter)(),[s,o]=(0,h.useState)(!0),[i,l]=(0,h.useState)(!0),[c,d]=(0,h.useState)(!1),[u,m]=(0,h.useState)(!1),[p,g]=(0,h.useState)(""),[v,b]=(0,h.useState)(!1),[y,N]=(0,h.useState)(!1),[w,k]=(0,h.useState)(!1),[S,E]=(0,h.useState)(e.name),[R,I]=(0,h.useState)(e.alias??""),[P,T]=(0,h.useState)(e.description??""),[O,D]=(0,h.useState)(e.localPath??""),[M,A]=(0,h.useState)(e.projectType??"FRONTEND"),[B,$]=(0,h.useState)([]);(0,h.useEffect)(()=>{n3(100).then($)},[]);let[_,z]=(0,h.useState)(!1),[W,H]=(0,h.useState)(""),[G,V]=(0,h.useState)(""),[Y,Z]=(0,h.useState)(""),[J,Q]=(0,h.useState)(""),[ee,et]=(0,h.useState)("FRONTEND"),[er,en]=(0,h.useState)(!1),[ea,es]=(0,h.useState)(!1),[eo,ei]=(0,h.useState)(null),[el,ec]=(0,h.useState)(!1),[ed,eu]=(0,h.useState)(!1),[em,ep]=(0,h.useState)(!1),ef=e=>{n9.toast.info(e)},eh=(0,h.useCallback)(async()=>{if(e.localPath){ec(!0);try{let t=await fetch(`/api/git?path=${encodeURIComponent(e.localPath)}`);t.ok&&ei(await t.json())}catch{}finally{ec(!1)}}},[e.localPath]);(0,h.useEffect)(()=>{eh()},[eh]);let ex=async()=>{if(e.localPath){eu(!0);try{(await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"init",path:e.localPath})})).ok?(ef(r("git.initSuccess")),await eh()):ef(r("git.initFailed"))}catch{ef(r("git.initFailed"))}finally{eu(!1)}}},eg=async t=>{if(e.localPath)try{let n=await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"checkout",path:e.localPath,branch:t})});if(n.ok)ef(`${r("git.switchSuccess")} ${t}`),await eh();else{let e=await n.json();ef(`${r("git.switchFailed")}: ${e.error}`)}}catch{ef(r("git.switchFailed"))}},ev=(e,t)=>{a.push(`/workspaces/${e}?projectId=${t}`,{scroll:!1}),a.refresh()},eb=async()=>{if(G.trim()){en(!0);try{let e=await (0,n2.createProject)({name:G.trim(),alias:Y.trim()||void 0,description:J.trim()||void 0,localPath:W,projectType:ee,workspaceId:t});z(!1),ev(t,e.id)}catch(e){n9.toast.error(e instanceof Error?e.message:String(e))}finally{en(!1)}}},ey=async()=>{if(O&&!ea){es(!0);try{let e=await (0,n8.analyzeProjectDirectory)(O.trim(),n);T(e)}catch{n9.toast.error(r("project.analyzeError"))}finally{es(!1)}}},ej=async()=>{try{await (0,n1.updateProject)(e.id,{name:S.trim(),alias:R.trim()||void 0,description:P.trim()||void 0,localPath:O.trim()||void 0,projectType:M}),a.refresh(),d(!1)}catch(e){n9.toast.error(e instanceof Error?e.message:String(e))}};return(0,f.jsxs)("aside",{className:"relative w-72 flex-shrink-0 overflow-y-auto border-l border-border bg-sidebar",children:[(0,f.jsxs)("div",{className:"border-b border-border p-4",children:[(0,f.jsxs)("div",{className:"flex items-start justify-between",children:[(0,f.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,f.jsx)("h2",{className:"text-base font-semibold text-foreground",children:e.name}),e.alias&&(0,f.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:e.alias})]}),(0,f.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,f.jsx)(C.Button,{variant:"ghost",size:"icon-sm",onClick:()=>{E(e.name),I(e.alias??""),T(e.description??""),D(e.localPath??""),d(!0)},className:"text-muted-foreground",children:(0,f.jsx)(L.Pencil,{className:"h-3.5 w-3.5"})}),(0,f.jsx)(C.Button,{variant:"ghost",size:"icon-sm",onClick:()=>{g(""),m(!0)},className:"text-muted-foreground hover:text-rose-400",children:(0,f.jsx)(F.Trash2,{className:"h-3.5 w-3.5"})})]})]}),e.description&&(0,f.jsx)("p",{className:"mt-2 text-sm text-secondary-foreground leading-relaxed line-clamp-4",children:e.description}),(0,f.jsx)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:(0,f.jsx)("span",{className:`inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-[11px] font-medium ${"GIT"===e.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"===e.type?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(X.GitBranch,{className:"h-3 w-3"}),r("sidebar.right.gitType")]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(nq.FileText,{className:"h-3 w-3"}),r("sidebar.right.normalType")]})})}),e.localPath&&(0,f.jsxs)("div",{className:"mt-3 flex items-start gap-2 rounded-md bg-muted/50 px-2.5 py-2 text-xs",children:[(0,f.jsx)(nY.FolderOpen,{className:"mt-0.5 h-3 w-3 shrink-0 text-muted-foreground"}),(0,f.jsx)("span",{className:"break-all font-mono text-secondary-foreground",children:e.localPath})]}),e.gitUrl&&(0,f.jsxs)("div",{className:"mt-2 flex items-start gap-2 rounded-md bg-muted/50 px-2.5 py-2 text-xs",children:[(0,f.jsx)(nK.Globe,{className:"mt-0.5 h-3 w-3 shrink-0 text-muted-foreground"}),(0,f.jsx)("span",{className:"break-all text-secondary-foreground",children:e.gitUrl})]}),e.localPath&&(0,f.jsxs)(C.Button,{variant:"outline",className:"mt-3 w-full h-8 gap-1.5 text-xs",disabled:y,onClick:async()=>{N(!0);try{let r=await n4(e.id);a.push(`/workspaces/${t}/tasks/${r}`)}catch{n9.toast.error(r("git.openStudioFailed"))}finally{N(!1)}},children:[y?(0,f.jsx)(nJ.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):(0,f.jsx)(nY.FolderOpen,{className:"h-3.5 w-3.5"}),r("git.openStudio")]})]}),(0,f.jsxs)("div",{className:"border-b border-border p-4",children:[(0,f.jsxs)(C.Button,{variant:"ghost",onClick:()=>o(!s),className:"flex w-full cursor-pointer justify-between px-2 py-2",children:[(0,f.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:r("git.section")}),s?(0,f.jsx)(nG.ChevronDown,{className:"h-3.5 w-3.5 text-muted-foreground"}):(0,f.jsx)(nV.ChevronRight,{className:"h-3.5 w-3.5 text-muted-foreground"})]}),s&&(0,f.jsx)("div",{className:"mt-3",children:e.localPath?el?(0,f.jsxs)("div",{className:"flex items-center justify-center py-4 text-muted-foreground",children:[(0,f.jsx)(nJ.Loader2,{className:"h-4 w-4 animate-spin"}),(0,f.jsx)("span",{className:"ml-2 text-xs",children:r("git.loading")})]}):eo&&!eo.isGit?(0,f.jsxs)("div",{className:"rounded-lg border border-border bg-muted/50 p-3",children:[(0,f.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,f.jsx)(nZ.AlertCircle,{className:"h-3.5 w-3.5"}),(0,f.jsx)("p",{className:"text-xs",children:r("git.notInitialized")})]}),(0,f.jsxs)(C.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:ex,disabled:ed,children:[ed?(0,f.jsx)(nJ.Loader2,{className:"h-3 w-3 animate-spin"}):(0,f.jsx)(nX,{className:"h-3 w-3"}),r("git.initRepo")]})]}):eo?.isGit?(0,f.jsxs)("div",{className:"space-y-3",children:[(0,f.jsx)(al,{localBranches:eo.branches??[],remoteBranches:(eo.remoteBranches??[]).filter(e=>!eo.branches?.includes(e)),currentBranch:eo.currentBranch??"",onSwitch:eg,onFetch:async()=>{e.localPath&&(await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"fetch",path:e.localPath})}),await eh())},onCreateBranch:()=>ep(!0)}),(0,f.jsx)(ar,{commits:eo.commits??[]}),(0,f.jsx)(ao,{localPath:e.localPath,stashes:eo.stashes??[],hasChanges:(eo.changedFiles??[]).length>0,onRefresh:eh})]}):null:(0,f.jsx)("div",{className:"rounded-lg border border-border bg-muted/50 p-3",children:(0,f.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,f.jsx)(nZ.AlertCircle,{className:"h-3.5 w-3.5"}),(0,f.jsx)("p",{className:"text-xs",children:r("git.noLocalPath")})]})})})]}),(0,f.jsxs)("div",{className:"p-4",children:[(0,f.jsxs)(C.Button,{variant:"ghost",onClick:()=>l(!i),className:"flex w-full cursor-pointer justify-between px-2 py-2",children:[(0,f.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:r("sidebar.right.browseRepo")}),i?(0,f.jsx)(nG.ChevronDown,{className:"h-3.5 w-3.5 text-muted-foreground"}):(0,f.jsx)(nV.ChevronRight,{className:"h-3.5 w-3.5 text-muted-foreground"})]}),i&&(0,f.jsxs)("div",{className:"mt-3 space-y-3",children:[(0,f.jsxs)(C.Button,{variant:"outline",className:"w-full h-8 gap-1.5 text-xs",onClick:()=>k(!0),children:[(0,f.jsx)(nY.FolderOpen,{className:"h-3.5 w-3.5"}),r("sidebar.right.browseRepo")]}),B.length>0&&(0,f.jsxs)("div",{children:[(0,f.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground mb-1.5 px-1",children:r("sidebar.right.recent")}),(0,f.jsx)("div",{className:"space-y-0.5",children:B.map(t=>(0,f.jsxs)("button",{onClick:()=>{t.id!==e.id&&ev(t.workspaceId,t.id)},className:`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left transition-colors ${t.id===e.id?"bg-primary/10 text-primary cursor-default":"hover:bg-accent cursor-pointer"}`,children:["GIT"===t.type?(0,f.jsx)(X.GitBranch,{className:"h-3 w-3 shrink-0 text-emerald-400"}):(0,f.jsx)(nY.FolderOpen,{className:"h-3 w-3 shrink-0 text-primary/70"}),(0,f.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,f.jsx)("p",{className:"truncate text-xs font-medium text-foreground",children:t.name}),t.localPath&&(0,f.jsx)("p",{className:"truncate text-[10px] font-mono text-muted-foreground",children:t.localPath})]})]},t.id))})]})]})]}),(0,f.jsx)(U.Dialog,{open:c,onOpenChange:d,children:(0,f.jsxs)(U.DialogContent,{style:{maxWidth:"32rem"},children:[(0,f.jsx)(U.DialogHeader,{children:(0,f.jsx)(U.DialogTitle,{children:r("project.edit")})}),(0,f.jsxs)("div",{className:"space-y-3 py-2",children:[(0,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:r("project.name")}),(0,f.jsx)(K.Input,{value:S,onChange:e=>E(e.target.value),className:"mt-1.5"})]}),(0,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:r("project.type.label")}),(0,f.jsx)("div",{className:"mt-1.5",children:(0,f.jsx)(n6.SegmentedControl,{options:[{value:"FRONTEND",label:r("project.type.frontend")},{value:"BACKEND",label:r("project.type.backend")}],value:M,onChange:A})})]}),(0,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:r("project.alias")}),(0,f.jsx)(K.Input,{value:R,onChange:e=>I(e.target.value),className:"mt-1.5"})]}),(0,f.jsxs)("div",{children:[(0,f.jsxs)("div",{className:"flex items-center justify-between",children:[(0,f.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:r("project.description")}),(0,f.jsxs)(C.Button,{type:"button",variant:"ghost",onClick:ey,className:`h-6 gap-1 px-2 text-[11px] text-muted-foreground hover:text-foreground ${!O||ea?"opacity-50":""}`,children:[ea?(0,f.jsx)(nJ.Loader2,{className:"h-3 w-3 animate-spin"}):(0,f.jsx)(nQ.Sparkles,{className:"h-3 w-3"}),ea?r("project.analyzing"):r("project.genDesc")]})]}),(0,f.jsx)(q.Textarea,{value:P,onChange:e=>T(e.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,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:r("project.localPath")}),(0,f.jsxs)("div",{className:"mt-1.5 flex gap-2",children:[(0,f.jsx)(K.Input,{value:O,onChange:e=>D(e.target.value),placeholder:r("project.localPathPlaceholder"),className:"flex-1 font-mono text-xs"}),(0,f.jsx)(C.Button,{variant:"outline",onClick:()=>k(!0),className:"h-8 shrink-0",children:r("folder.browse")})]})]})]}),(0,f.jsxs)(U.DialogFooter,{children:[(0,f.jsx)(C.Button,{variant:"outline",onClick:()=>d(!1),children:r("common.cancel")}),(0,f.jsx)(C.Button,{onClick:ej,disabled:!S.trim()||ea,className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:r("common.save")})]})]})}),(0,f.jsx)(n7.FolderBrowserDialog,{open:w,onOpenChange:k,onSelect:e=>{c?D(e):(e=>{let t=B.find(t=>t.localPath===e);if(t)return ev(t.workspaceId,t.id);let r=e.split("/").filter(Boolean).pop()??"";H(e),V(r),Z(""),Q(""),z(!0)})(e)}}),(0,f.jsx)(U.Dialog,{open:_,onOpenChange:z,children:(0,f.jsxs)(U.DialogContent,{className:"sm:max-w-md",children:[(0,f.jsx)(U.DialogHeader,{children:(0,f.jsx)(U.DialogTitle,{children:r("topbar.newProject")})}),(0,f.jsxs)("div",{className:"space-y-3 py-2",children:[(0,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:r("project.localPath")}),(0,f.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:W})]}),(0,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:r("project.name")}),(0,f.jsx)(K.Input,{value:G,onChange:e=>V(e.target.value),placeholder:r("project.namePlaceholder"),className:"mt-1.5"})]}),(0,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:r("project.type.label")}),(0,f.jsx)("div",{className:"mt-1.5",children:(0,f.jsx)(n6.SegmentedControl,{options:[{value:"FRONTEND",label:r("project.type.frontend")},{value:"BACKEND",label:r("project.type.backend")}],value:ee,onChange:et})})]}),(0,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:r("project.alias")}),(0,f.jsx)(K.Input,{value:Y,onChange:e=>Z(e.target.value),placeholder:r("project.aliasPlaceholder"),className:"mt-1.5"})]}),(0,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:r("project.description")}),(0,f.jsx)(q.Textarea,{value:J,onChange:e=>Q(e.target.value),placeholder:r("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,f.jsxs)(U.DialogFooter,{children:[(0,f.jsx)(C.Button,{variant:"outline",onClick:()=>z(!1),children:r("common.cancel")}),(0,f.jsxs)(C.Button,{onClick:eb,disabled:!G.trim()||er,className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:[er?(0,f.jsx)(nJ.Loader2,{className:"h-3 w-3 animate-spin mr-1"}):null,r("common.create")]})]})]})}),eo?.isGit&&(0,f.jsx)(ae.CreateBranchDialog,{open:em,onOpenChange:ep,branches:eo.branches??[],currentBranch:eo.currentBranch??"",localPath:e.localPath,onCreated:async()=>{await eh(),ef(r("git.createSuccess"))},onError:e=>ef(`${r("git.createFailed")}: ${e}`)}),(0,f.jsx)(U.Dialog,{open:u,onOpenChange:e=>{m(e),e||g("")},children:(0,f.jsxs)(U.DialogContent,{className:"sm:max-w-md",children:[(0,f.jsx)(U.DialogHeader,{children:(0,f.jsx)(U.DialogTitle,{className:"text-rose-400",children:r("project.deleteTitle")})}),(0,f.jsxs)("div",{className:"space-y-3 py-2",children:[(0,f.jsx)("p",{className:"text-sm text-muted-foreground",children:r("project.deleteWarning",{name:e.name})}),(0,f.jsx)("p",{className:"text-sm text-muted-foreground",children:r("project.deleteIrreversible")}),(0,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:r("project.deleteConfirmLabel")}),(0,f.jsx)(K.Input,{value:p,onChange:e=>g(e.target.value),placeholder:r("project.deleteConfirmPlaceholder"),className:"mt-1.5",autoFocus:!0})]})]}),(0,f.jsxs)(U.DialogFooter,{children:[(0,f.jsx)(C.Button,{variant:"outline",onClick:()=>m(!1),children:r("common.cancel")}),(0,f.jsxs)(C.Button,{variant:"destructive",disabled:p!==r("project.deleteConfirmText")||v,onClick:async()=>{b(!0);try{await n5(e.id),n9.toast.success(r("project.deleteSuccess")),a.push(`/workspaces/${t}`)}catch{n9.toast.error(r("project.deleteFailed"))}finally{b(!1),m(!1)}},children:[v&&(0,f.jsx)(nJ.Loader2,{className:"h-3 w-3 animate-spin mr-1"}),r("project.deleteButton")]})]})]})})]})}function al({localBranches:e,remoteBranches:t,currentBranch:r,onSwitch:n,onFetch:a,onCreateBranch:s}){let{t:o}=(0,j.useI18n)(),[i,l]=(0,h.useState)(!1),[c,d]=(0,h.useState)(""),[u,m]=(0,h.useState)(!1),p=(0,h.useRef)(null);(0,h.useEffect)(()=>{if(i)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e);function e(e){p.current&&!p.current.contains(e.target)&&l(!1)}},[i]);let x=c.toLowerCase(),g=e.filter(e=>e.toLowerCase().includes(x)),v=t.filter(e=>e.toLowerCase().includes(x)),b=g.length>0||v.length>0,y=async()=>{m(!0);try{await a()}finally{m(!1)}};return(0,f.jsxs)("div",{children:[(0,f.jsxs)("div",{className:"flex items-center justify-between mb-1.5",children:[(0,f.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:o("git.currentBranch")}),(0,f.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,f.jsx)(C.Button,{variant:"ghost",size:"icon-xs",onClick:y,disabled:u,className:"text-muted-foreground","aria-label":"Fetch",children:(0,f.jsx)(n0.RefreshCw,{className:`h-3 w-3 ${u?"animate-spin":""}`})}),(0,f.jsx)(C.Button,{variant:"ghost",size:"icon-xs",onClick:s,className:"text-muted-foreground","aria-label":o("git.createBranch"),children:(0,f.jsx)(w.Plus,{className:"h-3 w-3"})})]})]}),(0,f.jsxs)("div",{className:"relative",ref:p,children:[(0,f.jsxs)("button",{onClick:()=>{l(!i),d("")},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,f.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,f.jsx)(X.GitBranch,{className:"h-3 w-3 shrink-0 text-emerald-400"}),(0,f.jsx)("span",{className:"truncate font-mono text-xs text-foreground",children:r||"—"})]}),(0,f.jsx)(nG.ChevronDown,{className:`h-3 w-3 shrink-0 text-muted-foreground transition-transform ${i?"rotate-180":""}`})]}),i&&(0,f.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,f.jsx)("div",{className:"border-b border-border p-1.5",children:(0,f.jsxs)("div",{className:"relative",children:[(0,f.jsx)(k.Search,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3 w-3 text-muted-foreground"}),(0,f.jsx)("input",{value:c,onChange:e=>d(e.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,f.jsxs)("div",{className:"max-h-60 overflow-auto py-1",children:[!b&&(0,f.jsx)("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No branches found"}),g.length>0&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("p",{className:"px-3 pt-1.5 pb-1 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:o("git.localBranches")}),g.map(e=>{let t=e===r;return(0,f.jsxs)("button",{onClick:()=>{t||n(e),l(!1)},className:`flex w-full items-center gap-2 px-3 py-1.5 text-left transition-colors ${t?"bg-emerald-500/10 text-emerald-400":"text-secondary-foreground hover:bg-accent"}`,children:[(0,f.jsx)(X.GitBranch,{className:"h-3 w-3 shrink-0"}),(0,f.jsx)("span",{className:"truncate font-mono text-xs",children:e}),t&&(0,f.jsx)(R.Check,{className:"h-3 w-3 ml-auto shrink-0"})]},`local-${e}`)})]}),v.length>0&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("p",{className:"px-3 pt-2.5 pb-1 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:o("git.remoteBranches")}),v.map(e=>(0,f.jsxs)("button",{onClick:()=>{n(e),l(!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,f.jsx)(nK.Globe,{className:"h-3 w-3 shrink-0 text-sky-400"}),(0,f.jsx)("span",{className:"truncate font-mono text-xs",children:e})]},`remote-${e}`))]})]})]})]})]})}let ac=(0,v.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 ad=e.i(950211),au=e.i(289208),am=e.i(750986),ap=e.i(610874),af=e.i(11915),ah=e.i(265826);function ax({title:e,description:t,branch:r,baseBranch:n,hasConversation:a,updatedAt:s,onBack:o}){let{t:i}=(0,j.useI18n)();return(0,f.jsxs)("div",{className:"border-b border-border px-4 py-3",children:[(0,f.jsxs)("div",{className:"flex items-center justify-between",children:[(0,f.jsxs)("div",{className:"flex items-center gap-2",children:[(0,f.jsx)(nQ.Sparkles,{className:"h-3.5 w-3.5 text-primary"}),(0,f.jsx)("span",{className:"text-xs font-semibold text-primary",children:i("taskDetail.title")})]}),(0,f.jsxs)(C.Button,{variant:"ghost",onClick:o,className:"flex items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground h-auto px-2 py-1",children:[(0,f.jsx)(ah.ArrowLeft,{className:"h-3.5 w-3.5"}),i("taskDetail.back")]})]}),(0,f.jsx)("h2",{className:"mt-2.5 text-lg font-bold tracking-tight text-foreground",children:e}),t&&(0,f.jsx)("p",{className:"mt-1 text-xs text-muted-foreground line-clamp-2",children:t}),(0,f.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[n?(0,f.jsxs)($.Badge,{variant:"secondary",className:"bg-muted text-muted-foreground text-[10px] font-mono border border-border",children:[(0,f.jsx)(X.GitBranch,{className:"mr-1 h-3 w-3"}),n," · worktree"]}):r?(0,f.jsx)($.Badge,{variant:"secondary",className:"bg-muted text-muted-foreground text-[10px] font-mono border border-border",children:i("taskDetail.directMode")}):null,a&&(0,f.jsx)($.Badge,{variant:"secondary",className:"bg-emerald-500/10 text-emerald-400 text-[10px] border border-emerald-500/20",children:i("taskDetail.hasConversation")}),(0,f.jsxs)("span",{className:"text-[11px] text-muted-foreground",children:[i("taskDetail.updatedAt")," ",(0,ti.formatRelativeTime)(s)]})]})]})}var ag=e.i(477795),av=e.i(486305),ab=e.i(79769),ay=e.i(812063),aj=e.i(874084),aN=e.i(211342),aw=e.i(232112),ak=e.i(266154),aC=e.i(679012),aS=e.i(654095),aE=e.i(999287),aR=e.i(290517),aI=e.i(612758),aP=e.i(215365);let aT=(0,v.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 aO=e.i(996032),aD=e.i(381223);let aM=(0,n_.createServerReference)("4051391ab7e49b9b5ae10a12671fd8f58595a9d100",n_.callServer,void 0,n_.findSourceMapURL,"getTaskNotes");var aA=e.i(2405);let aL=(0,n_.createServerReference)("40a9ff60f6aa78bf28ddef1a04d1f00cf86358b6cb",n_.callServer,void 0,n_.findSourceMapURL,"getTaskAssets");var aF=e.i(645205),aB=e.i(68701);function a$({taskId:e,projectId:t}){let{t:r}=(0,j.useI18n)(),n=(0,h.useRef)(null),[a,s]=(0,h.useState)([]),[o,i]=(0,h.useState)([]),[l,c]=(0,h.useState)(!1),[d,u]=(0,h.useState)(""),[m,p]=(0,h.useState)(""),[x,g]=(0,h.useState)(!1);async function v(){d.trim()&&(await (0,aD.createNote)({title:d.trim(),content:m.trim(),projectId:t,taskId:e,category:"task"}),u(""),p(""),c(!1),aM(e).then(s))}async function b(e){await (0,aA.deleteNote)(e),s(t=>t.filter(t=>t.id!==e))}async function y(r){let a=r.target.files?.[0];if(a){g(!0);try{let r=new FormData;r.set("file",a),r.set("projectId",t),r.set("taskId",e),await (0,aF.uploadAsset)(r),aL(e).then(i)}finally{g(!1),n.current&&(n.current.value="")}}}async function N(e){await (0,aB.deleteAsset)(e),i(t=>t.filter(t=>t.id!==e))}return(0,h.useEffect)(()=>{aM(e).then(s),aL(e).then(i)},[e]),(0,f.jsx)(W.ScrollArea,{className:"h-full",children:(0,f.jsxs)("div",{className:"flex flex-col",children:[(0,f.jsxs)("div",{className:"border-b border-border px-4 py-3",children:[(0,f.jsxs)("div",{className:"flex items-center justify-between",children:[(0,f.jsxs)("h3",{className:"flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:[(0,f.jsx)(nq.FileText,{className:"h-3.5 w-3.5"}),r("taskPage.notes")]}),(0,f.jsxs)(C.Button,{variant:"ghost",className:"h-6 gap-1 px-2 text-xs",onClick:()=>c(!l),children:[l?(0,f.jsx)(aO.X,{className:"h-3 w-3"}):(0,f.jsx)(w.Plus,{className:"h-3 w-3"}),l?"":r("taskPage.addNote")]})]}),l&&(0,f.jsxs)("div",{className:"mt-3 space-y-2",children:[(0,f.jsx)("input",{type:"text",value:d,onChange:e=>u(e.target.value),placeholder:r("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,f.jsx)("textarea",{value:m,onChange:e=>p(e.target.value),placeholder:r("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,f.jsx)(C.Button,{className:"text-xs",onClick:v,disabled:!d.trim(),children:r("taskPage.addNote")})]}),(0,f.jsxs)("div",{className:"mt-2 space-y-2",children:[0===a.length&&!l&&(0,f.jsx)("p",{className:"text-xs text-muted-foreground py-2",children:r("taskPage.noNotes")}),a.map(e=>(0,f.jsx)("div",{className:"group rounded-md border border-border bg-card p-3",children:(0,f.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,f.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,f.jsx)("h4",{className:"text-sm font-medium truncate",children:e.title}),e.content&&(0,f.jsx)("p",{className:"mt-1 text-xs text-muted-foreground line-clamp-3 whitespace-pre-wrap",children:e.content}),(0,f.jsx)("p",{className:"mt-1 text-[10px] text-muted-foreground",children:new Date(e.createdAt).toLocaleString()})]}),(0,f.jsx)(C.Button,{variant:"ghost",size:"icon-xs",onClick:()=>b(e.id),className:"shrink-0 text-muted-foreground opacity-0 hover:bg-destructive/10 hover:text-destructive group-hover:opacity-100",title:r("taskPage.deleteNote"),children:(0,f.jsx)(F.Trash2,{className:"h-3.5 w-3.5"})})]})},e.id))]})]}),(0,f.jsxs)("div",{className:"px-4 py-3",children:[(0,f.jsxs)("div",{className:"flex items-center justify-between",children:[(0,f.jsxs)("h3",{className:"flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:[(0,f.jsx)(aT,{className:"h-3.5 w-3.5"}),r("taskPage.attachments")]}),(0,f.jsxs)(C.Button,{variant:"ghost",className:"h-6 gap-1 px-2 text-xs",onClick:()=>n.current?.click(),disabled:x,children:[(0,f.jsx)(aP.Upload,{className:"h-3 w-3"}),r("taskPage.uploadFile")]}),(0,f.jsx)("input",{ref:n,type:"file",className:"hidden",onChange:y})]}),(0,f.jsxs)("div",{className:"mt-2 space-y-1.5",children:[0===o.length&&(0,f.jsx)("p",{className:"text-xs text-muted-foreground py-2",children:r("taskPage.noAttachments")}),o.map(e=>{var t;return(0,f.jsxs)("div",{className:"group flex items-center gap-2 rounded-md border border-border bg-card px-3 py-2",children:[(0,f.jsx)(aT,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),(0,f.jsx)("span",{className:"flex-1 truncate text-sm",children:e.filename}),(0,f.jsx)("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:(t=e.size)?t<1024?`${t} B`:t<1048576?`${(t/1024).toFixed(1)} KB`:`${(t/1024/1024).toFixed(1)} MB`:""}),(0,f.jsx)(C.Button,{variant:"ghost",size:"icon-xs",onClick:()=>N(e.id),className:"shrink-0 text-muted-foreground opacity-0 hover:bg-destructive/10 hover:text-destructive group-hover:opacity-100",title:r("taskPage.deleteAttachment"),children:(0,f.jsx)(F.Trash2,{className:"h-3 w-3"})})]},e.id)})]})]})]})})}function a_({task:e,workspaceId:t,projectLocalPath:r,onClose:n}){let{t:a}=(0,j.useI18n)(),s=(0,x.useRouter)(),{removePortal:o}=(0,ab.useTerminalPortal)(),[i,l]=(0,h.useState)("terminal"),[c,d]=(0,h.useState)(null),[u,m]=(0,h.useState)(!1),[p,g]=(0,h.useState)(e.status);(0,h.useEffect)(()=>{g(e.status)},[e.status]);let[v,b]=(0,h.useState)(null),[y,N]=(0,h.useState)(!1),[w,k]=(0,h.useState)(!1),[S,E]=(0,h.useState)([]);(0,h.useEffect)(()=>{b(null),N(!1),k(!1),E([]),d(null),l("terminal")},[e.id]);let[R,I]=(0,h.useState)([]),[P,T]=(0,h.useState)(null);(0,h.useEffect)(()=>{let e=!1;return(0,aR.getPrompts)().then(t=>{if(e)return;I(t.map(e=>({id:e.id,name:e.name,isDefault:e.isDefault})));let r=t.find(e=>e.isDefault);r&&T(r.id)}),()=>{e=!0}},[]),(0,h.useEffect)(()=>{b(null),k(!1);let t=!1;return(0,ay.getTaskExecutions)(e.id).then(e=>{if(t)return;let n=e[0];if(n?.status==="RUNNING"){let e=n.worktreePath||r||null;e&&b(e)}E(e.filter(e=>"RUNNING"!==e.status)),k(!0)}),()=>{t=!0}},[e.id]),(0,h.useEffect)(()=>{if("changes"!==i||"TODO"===p||"CANCELLED"===p)return;let t=!1;return m(!0),fetch(`/api/tasks/${e.id}/diff`).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(e=>{t||d(e?.files||e?.branchDeleted?e:null)}).catch(()=>{t||d(null)}).finally(()=>{t||m(!1)}),()=>{t=!0}},[i,p,e.id]);let O=(0,h.useCallback)(async()=>{if(!y){N(!0);try{let{worktreePath:t}=await (0,aj.startPtyExecution)(e.id,"",P);b(t),g("IN_PROGRESS")}catch(e){N(!1),n9.toast.error(e instanceof Error?e.message:String(e))}}},[e.id,y,P]),D=(0,h.useCallback)(t=>{N(!1),b(null),o(e.id),0===t&&g("IN_REVIEW"),(0,ay.getTaskExecutions)(e.id).then(e=>{E(e.filter(e=>"RUNNING"!==e.status))}),s.refresh()},[s,e.id]),M=(0,h.useCallback)(async()=>{await (0,aN.stopPtyExecution)(e.id),N(!1),b(null),g("IN_REVIEW"),(0,ay.getTaskExecutions)(e.id).then(e=>{E(e.filter(e=>"RUNNING"!==e.status))}),s.refresh()},[e.id,s]),A=(0,h.useCallback)(async t=>{N(!0),o(e.id),b(null);try{let{worktreePath:r}=await (0,aw.resumePtyExecution)(e.id,t);b(r),g("IN_PROGRESS")}catch{N(!1)}},[e.id,o]),L=(0,h.useCallback)(async()=>{N(!0),o(e.id),b(null);try{let{worktreePath:t}=await (0,ak.continueLatestPtyExecution)(e.id);b(t),g("IN_PROGRESS")}catch(e){N(!1),n9.toast.error(e instanceof Error?e.message:String(e))}},[e.id,o]),[F,B]=(0,h.useState)(!1),[$,_]=(0,h.useState)([]),z=(0,h.useCallback)(async()=>{try{let t=await (0,aS.checkWorktreeClean)(e.id);if(t.hasWorktree&&!t.clean)return void n9.toast.error(a("taskPage.uncommittedChanges",{count:String(t.files.length)}));if(t.hasWorktree&&t.clean&&!t.hasCommits)return void n9.toast.error(a("taskPage.noChangesToComplete"));if(t.hasWorktree&&t.hasCommits){_(t.commitLog),B(!0);return}await (0,aC.updateTaskStatus)(e.id,"DONE"),g("DONE"),n9.toast.success(a("taskPage.taskCompleted")),s.refresh()}catch{n9.toast.error("Failed to complete task")}},[e.id,s,a]),U=(0,h.useCallback)(()=>{g("DONE"),B(!1),n9.toast.success(a("taskPage.taskCompleted")),s.refresh()},[s,a]),H=(0,h.useCallback)(async t=>{try{let{hash:r}=await (0,aE.commitWorktreeChanges)(e.id,t);n9.toast.success(a("diff.commitSuccess",{hash:r})),s.refresh();let n=await fetch(`/api/tasks/${e.id}/diff`);if(n.ok){let e=await n.json();d(e?.files?e:null)}}catch(e){n9.toast.error(e instanceof Error?e.message:"Commit failed")}},[e.id,s,a]);return(0,f.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,f.jsx)(ax,{title:e.title,description:a("taskDetail.panelDescription"),branch:`task/${e.id}`,baseBranch:e.baseBranch,hasConversation:!1,updatedAt:e.updatedAt,onBack:n}),(0,f.jsxs)("div",{className:"flex items-center justify-between border-b border-border px-4 py-2",children:[(0,f.jsxs)("div",{className:"flex gap-1",children:[(0,f.jsxs)("button",{onClick:()=>l("terminal"),className:`flex items-center gap-1.5 px-3 py-1 text-xs font-medium rounded-md ${"terminal"===i?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,f.jsx)(ad.Terminal,{className:"h-3 w-3"}),a("terminal.execute")]}),(0,f.jsx)("button",{onClick:()=>l("changes"),className:`px-3 py-1 text-xs font-medium rounded-md ${"changes"===i?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:a("taskPage.changes")}),(0,f.jsxs)("button",{onClick:()=>l("notes"),className:`flex items-center gap-1.5 px-3 py-1 text-xs font-medium rounded-md ${"notes"===i?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,f.jsx)(nq.FileText,{className:"h-3 w-3"}),a("taskPage.notes")]})]}),(0,f.jsxs)("div",{className:"flex items-center gap-2",children:["IN_REVIEW"===p&&(0,f.jsxs)(C.Button,{size:"sm",onClick:z,className:"bg-emerald-500/15 text-emerald-400 ring-1 ring-emerald-500/20 hover:bg-emerald-500/25",children:[(0,f.jsx)(am.CheckCircle2,{className:"h-3 w-3"}),a("taskPage.completeTask")]}),"DONE"!==p&&"CANCELLED"!==p&&(0,f.jsxs)(C.Button,{variant:"ghost",size:"sm",onClick:()=>s.push(`/workspaces/${t}/tasks/${e.id}`),className:"text-muted-foreground",children:[(0,f.jsx)(ac,{className:"h-3 w-3"}),a("taskPage.viewDetails")]})]})]}),"terminal"===i?(0,f.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:w?v?(0,f.jsxs)("div",{className:"flex h-full flex-col overflow-hidden",children:[(0,f.jsxs)("div",{className:"shrink-0 flex items-center justify-between border-b border-neutral-800 px-3 py-2 bg-[#0f1419]",children:[(0,f.jsxs)("span",{className:"flex items-center gap-1.5 text-xs text-emerald-400",children:[(0,f.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"}),a("execution.running")]}),(0,f.jsxs)(af.Tooltip,{children:[(0,f.jsxs)(af.TooltipTrigger,{onClick:M,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,f.jsx)(au.Square,{className:"h-3 w-3"}),a("terminal.stopExecution")]}),(0,f.jsx)(af.TooltipContent,{side:"bottom",children:a("terminal.stopHint")})]})]}),(0,f.jsx)("div",{className:"flex-1 min-h-0",children:(0,f.jsx)(ab.TerminalOutlet,{taskId:e.id,worktreePath:v,onSessionEnd:D})})]}):"DONE"===p||"CANCELLED"===p?(0,f.jsx)("div",{className:"flex h-full flex-col overflow-hidden",children:(0,f.jsx)(W.ScrollArea,{className:"flex-1 min-h-0",children:(0,f.jsx)(aI.ExecutionTimeline,{executions:S})})}):(0,f.jsxs)("div",{className:"flex h-full flex-col overflow-hidden",children:[(0,f.jsxs)("div",{className:"shrink-0 flex items-center gap-2 border-b border-border px-4 py-3",children:[R.length>0&&(0,f.jsxs)(ap.Select,{defaultValue:P??"none",onValueChange:e=>T("none"===e?null:e),children:[(0,f.jsx)(ap.SelectTrigger,{size:"sm",className:"min-w-[120px]",children:(0,f.jsx)("span",{className:"text-left truncate",children:P?R.find(e=>e.id===P)?.name??a("terminal.noPrompt"):a("terminal.noPrompt")})}),(0,f.jsxs)(ap.SelectContent,{className:"min-w-[200px]",children:[(0,f.jsx)(ap.SelectItem,{value:"none",children:a("terminal.noPrompt")}),R.map(e=>(0,f.jsxs)(ap.SelectItem,{value:e.id,children:[e.name,e.isDefault?" ★":""]},e.id))]})]},`prompt-${R.length}`),(0,f.jsxs)(C.Button,{onClick:O,disabled:y,size:"sm",className:"gap-2 px-4",children:[y?(0,f.jsx)(nJ.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):(0,f.jsx)(ad.Terminal,{className:"h-3.5 w-3.5"}),y?a("terminal.executing"):a("terminal.launch")]})]}),(0,f.jsx)(W.ScrollArea,{className:"flex-1 min-h-0",children:(0,f.jsx)(aI.ExecutionTimeline,{executions:S,onResume:A,onContinueLatest:L})})]}):(0,f.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-2 bg-[#0f1419]",children:[(0,f.jsx)(nJ.Loader2,{className:"size-5 animate-spin text-neutral-500"}),(0,f.jsx)("span",{className:"text-xs text-neutral-500",children:a("execution.loading")})]})}):"changes"===i?(0,f.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:u?(0,f.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,f.jsx)("p",{className:"text-sm text-muted-foreground",children:a("taskPage.loadingDiff")})}):c?.branchDeleted?(0,f.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,f.jsx)("p",{className:"text-sm text-muted-foreground",children:a("taskPage.branchDeleted")})}):c?(0,f.jsx)(ag.TaskDiffView,{files:c.files,totalAdded:c.totalAdded,totalRemoved:c.totalRemoved,hasConflicts:c.hasConflicts,conflictFiles:c.conflictFiles,onCommit:H,hasUncommitted:c.hasUncommitted}):(0,f.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,f.jsx)("p",{className:"text-sm text-muted-foreground",children:a("taskPage.noChanges")})})}):"notes"===i?(0,f.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:(0,f.jsx)(a$,{taskId:e.id,projectId:e.projectId})}):null,(0,f.jsx)(av.TaskMergeConfirmDialog,{open:F,onOpenChange:B,taskId:e.id,taskTitle:e.title,baseBranch:e.baseBranch??"main",fileCount:c?.files?.length??0,commitCount:c?.commitCount??0,commitLog:$,onMergeComplete:U})]})}let az=(0,n_.createServerReference)("406e8276c49fc34f681ca891671fbfb313a11aeb14",n_.callServer,void 0,n_.findSourceMapURL,"createTask"),aU=(0,n_.createServerReference)("60040e85635735db052cc8b2470398fb532c5030da",n_.callServer,void 0,n_.findSourceMapURL,"updateTask"),aW=(0,n_.createServerReference)("402f1d403498bb101c05d7a3a1d0bac78905017cc9",n_.callServer,void 0,n_.findSourceMapURL,"deleteTask"),aH=(0,n_.createServerReference)("40cd59b91ec375d053bbbb4e42c9adb9c3bffd1a99",n_.callServer,void 0,n_.findSourceMapURL,"toggleTaskPinned");var aG=e.i(864056);function aV({projects:e,activeProjectId:t,onSelect:r}){let n=(0,h.useRef)(null),[a,s]=(0,h.useState)(!1),[o,i]=(0,h.useState)(!1),l=()=>{let e=n.current;e&&(s(e.scrollLeft>0),i(e.scrollLeft<e.scrollWidth-e.clientWidth-1))};(0,h.useEffect)(()=>{l();let e=n.current;if(e){e.addEventListener("scroll",l);let t=new ResizeObserver(l);return t.observe(e),()=>{e.removeEventListener("scroll",l),t.disconnect()}}},[e]);let c=e=>{let t=n.current;t&&t.scrollBy({left:"left"===e?-150:150,behavior:"smooth"})};return(0,f.jsxs)("div",{className:"relative flex items-center",children:[a&&(0,f.jsx)("button",{onClick:()=>c("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,f.jsx)(aG.ChevronLeft,{className:"h-4 w-4"})}),(0,f.jsx)("div",{ref:n,className:"flex items-center gap-1.5 overflow-x-auto scrollbar-none px-1 py-1",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:e.map(e=>{let n=t===e.id;return(0,f.jsxs)("button",{onClick:()=>{n||r(e.id)},className:`shrink-0 rounded-lg border-b-2 px-4 py-2 text-sm font-medium transition-colors ${n?"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,f.jsx)("span",{children:e.name}),e.alias&&(0,f.jsx)("span",{className:"ml-1.5 text-xs text-muted-foreground font-normal",children:e.alias})]},e.id)})}),o&&(0,f.jsx)("button",{onClick:()=>c("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,f.jsx)(nV.ChevronRight,{className:"h-4 w-4"})})]})}e.s(["BoardPageClient",0,function({workspaceId:e,projectId:t,project:r,projects:n,initialTasks:a,labels:s,openTaskId:o}){let i=(0,x.useRouter)(),[,l]=(0,h.useTransition)(),[c,d]=(0,h.useState)(""),[u,m]=(0,h.useState)(!1),[p,g]=(0,h.useState)("TODO"),[v,b]=(0,h.useState)(o?a.find(e=>e.id===o)??null:null),[y,j]=(0,h.useState)(null),w=(0,h.useCallback)(()=>{l(()=>{i.refresh()})},[i]);(0,h.useEffect)(()=>{if(u)return;let e=setInterval(()=>{l(()=>{i.refresh()})},5e3);return()=>clearInterval(e)},[i,u]);let k=(0,h.useCallback)(e=>{d(e)},[]),C=(0,h.useCallback)(async(e,t)=>{await (0,aC.updateTaskStatus)(e,t),v?.id===e&&b({...v,status:t}),w()},[w,v]),E=(0,h.useCallback)(async e=>{await az({title:e.title,description:e.description,projectId:t,priority:e.priority,status:e.status,labelIds:e.labelIds,baseBranch:e.baseBranch,subPath:e.subPath}),w()},[t,w]),R=(0,h.useCallback)(async(e,t)=>{await aU(e,{...t,labelIds:t.labelIds}),j(null),w()},[w]),P=(0,h.useCallback)(async e=>{await aW(e),v?.id===e&&b(null),w()},[w,v]),T=(0,h.useCallback)(async e=>{await aH(e),w()},[w]),O=(0,h.useCallback)(async t=>{try{await (0,aj.startPtyExecution)(t,"")}catch(e){n9.toast.error(e instanceof Error?e.message:String(e))}i.push(`/workspaces/${e}/tasks/${t}`)},[i,e]),D=(0,h.useCallback)(async(e,t)=>{await (0,aC.updateTaskStatus)(e,t),v?.id===e&&b({...v,status:t}),w()},[w,v]),M=(0,h.useCallback)(e=>{g(e),j(null),m(!0)},[]),A=(0,h.useCallback)(e=>{j(e),m(!0)},[]),L=a.filter(e=>!e.labels?.some(e=>e.label.name===I.TOWER_LABEL_NAME&&e.label.isBuiltin)),F=c.trim()?L.filter(e=>{let t=c.toLowerCase();return e.title.toLowerCase().includes(t)||(e.description?.toLowerCase().includes(t)??!1)}):L;return(0,f.jsxs)("div",{className:"flex h-full",children:[(0,f.jsxs)("div",{className:"flex flex-1 flex-col overflow-hidden",children:[(0,f.jsx)("div",{className:"px-6 pt-3 pb-1",children:(0,f.jsx)(aV,{projects:n,activeProjectId:t,onSelect:t=>i.push(`/workspaces/${e}?projectId=${t}`,{scroll:!1})})}),(0,f.jsx)(N,{totalTasks:L.length,runningTasks:L.filter(e=>"IN_PROGRESS"===e.status).length}),(0,f.jsx)(S,{searchQuery:c,onSearchChange:k,onCreateTask:()=>{j(null),m(!0)}}),(0,f.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden p-4",children:(0,f.jsx)(V,{initialTasks:F,onTaskMove:C,onTaskClick:e=>{b(e)},onEditTask:A,onAddTask:M,onDeleteTask:P,onTogglePin:T,workspaceId:e,onContextMenuStatusChange:D,onContextMenuLaunch:O})}),(0,f.jsx)(nH,{open:u,onOpenChange:e=>{m(e),e||j(null)},onSubmit:E,onUpdate:R,defaultStatus:p,editTask:y,editTaskLabelIds:y?.labels?y.labels.map(e=>e.labelId):[],labels:s.filter(e=>!(e.name===I.TOWER_LABEL_NAME&&e.isBuiltin)),projectType:r.type,projectLocalPath:r.localPath})]}),v?(0,f.jsx)(a_,{task:v,workspaceId:e,projectLocalPath:r.localPath,onClose:()=>b(null)}):(0,f.jsx)(ai,{project:r,workspaceId:e})]})}],136924)}]);
@@ -1 +1 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,117474,e=>{"use strict";let t=(0,e.i(863961).default)("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);e.s(["User",0,t],117474)},803041,e=>{"use strict";var t=e.i(422364);e.s(["ChevronRight",()=>t.default])},750986,1156,e=>{"use strict";var t=e.i(419613);e.s(["CheckCircle2",()=>t.default],750986);let s=(0,e.i(863961).default)("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);e.s(["XCircle",0,s],1156)},950211,e=>{"use strict";let t=(0,e.i(863961).default)("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);e.s(["Terminal",0,t],950211)},864056,e=>{"use strict";let t=(0,e.i(863961).default)("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);e.s(["ChevronLeft",0,t],864056)},690951,e=>{"use strict";var t=e.i(432377),s=e.i(85212),a=e.i(309542),l=e.i(275283),r=e.i(711296),i=e.i(831349),n=e.i(584685),o=e.i(937756);function d({className:e,size:s="default",...a}){return(0,t.jsx)("div",{"data-slot":"card","data-size":s,className:(0,o.cn)("group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-card py-4 text-sm text-card-foreground ring-1 ring-foreground/10 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",e),...a})}function c({className:e,...s}){return(0,t.jsx)("div",{"data-slot":"card-content",className:(0,o.cn)("px-4 group-data-[size=sm]/card:px-3",e),...s})}var m=e.i(946960),x=e.i(893832),h=e.i(996032),u=e.i(950211),p=e.i(750986),g=e.i(1156),f=e.i(625054);function b({adapterType:e,adapterLabel:a,onResult:l}){let[i,n]=(0,s.useState)(!1),[j,v]=(0,s.useState)(null),{t:N}=(0,f.useI18n)();async function y(){if(!i){n(!0),v(null);try{let t=await fetch("/api/adapters/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({adapterType:e})}),s=await t.json();v(s),l?.(s)}catch{let e={ok:!1,checks:[{name:"network_error",passed:!1,message:"Network request failed"}]};v(e),l?.(e)}finally{n(!1)}}}return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"rounded-lg bg-emerald-100 dark:bg-emerald-900/30 p-2",children:(0,t.jsx)(u.Terminal,{className:"h-5 w-5 text-emerald-600 dark:text-emerald-400"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h3",{className:"font-semibold",children:N("settings.aiTools.cliVerification")}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:N("settings.aiTools.cliVerificationDesc")})]})]}),(0,t.jsx)(d,{children:(0,t.jsxs)(c,{className:"p-6 space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("div",{children:a&&(0,t.jsx)("p",{className:"font-medium",children:a})}),(0,t.jsx)(r.Button,{onClick:y,disabled:i,variant:"outline",children:i?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(m.Loader2,{className:"h-4 w-4 animate-spin mr-2"}),N("settings.aiTools.testing")]}):N("settings.aiTools.testConnection")})]}),j&&(0,t.jsxs)("div",{className:(0,o.cn)("rounded-lg border p-4 space-y-3",j.ok?"bg-green-50 border-green-200 dark:bg-green-950/20 dark:border-green-800":"bg-red-50 border-red-200 dark:bg-red-950/20 dark:border-red-800"),children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[j.ok?(0,t.jsx)(p.CheckCircle2,{className:"h-4 w-4 text-green-600 dark:text-green-400"}):(0,t.jsx)(g.XCircle,{className:"h-4 w-4 text-red-600 dark:text-red-400"}),(0,t.jsx)("span",{className:(0,o.cn)("text-sm font-medium",j.ok?"text-green-700 dark:text-green-300":"text-red-700 dark:text-red-300"),children:N(j.ok?"settings.aiTools.testPassed":"settings.aiTools.testFailed")})]}),(0,t.jsx)("div",{className:"space-y-2",children:j.checks.map(s=>(0,t.jsxs)("div",{className:"flex items-start gap-2 text-sm",children:[s.passed?(0,t.jsx)(x.Check,{className:"h-4 w-4 text-green-500 mt-0.5 shrink-0"}):(0,t.jsx)(h.X,{className:"h-4 w-4 text-red-500 mt-0.5 shrink-0"}),(0,t.jsx)("span",{className:(0,o.cn)(s.passed?"text-green-700 dark:text-green-300":"text-red-700 dark:text-red-300"),children:s.message})]},`${e}-${s.name}`))})]})]})})]})}var j=e.i(543485);let v=(0,j.createServerReference)("405e24a96c3040b977262f38c5e06b74894259e0be",j.callServer,void 0,j.findSourceMapURL,"completeOnboarding");var N=e.i(632033),y=e.i(117474),k=e.i(357334),w=e.i(864056),C=e.i(803041),T=e.i(811424),S=e.i(809250),L=e.i(863961);let P=(0,L.default)("monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]),B=(0,L.default)("languages",[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]);var M=e.i(780156),$=e.i(909260);function R({step:e}){let s=[y.User,u.Terminal,k.GitBranch][e-1]??y.User,a=["Profile","Connect","Configure"][e-1]??"";return(0,t.jsxs)("div",{className:"relative h-full w-full overflow-hidden",children:[(0,t.jsx)("div",{className:"absolute inset-0 opacity-[0.07] text-white",style:{backgroundImage:"radial-gradient(circle, currentColor 1px, transparent 1px)",backgroundSize:"24px 24px"}}),(0,t.jsx)("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full",style:{width:"380px",height:"380px",background:"radial-gradient(circle, oklch(0.80 0.14 75 / 0.25) 0%, oklch(0.80 0.14 75 / 0.08) 45%, transparent 70%)",animation:"ob-pulse 6s ease-in-out infinite"}}),(0,t.jsx)("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full border border-amber-400/25",style:{width:"260px",height:"260px",animation:"ob-spin 20s linear infinite"},children:(0,t.jsx)("div",{className:"absolute -top-1.5 left-1/2 -translate-x-1/2 h-3 w-3 rounded-full bg-amber-400",style:{boxShadow:"0 0 16px oklch(0.80 0.14 75 / 0.7)"}})}),(0,t.jsxs)("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full border border-amber-400/15",style:{width:"380px",height:"380px",animation:"ob-spin 30s linear infinite reverse"},children:[(0,t.jsx)("div",{className:"absolute -top-1 left-1/2 -translate-x-1/2 h-2 w-2 rounded-full bg-amber-400/70"}),(0,t.jsx)("div",{className:"absolute -bottom-1 left-1/2 -translate-x-1/2 h-1.5 w-1.5 rounded-full bg-amber-400/50"})]}),(0,t.jsx)("svg",{className:"absolute",style:{top:"18%",right:"22%",animation:"ob-float 8s ease-in-out infinite"},width:"44",height:"50",viewBox:"0 0 40 46",fill:"none",children:(0,t.jsx)("path",{d:"M20 1 L38 12 L38 34 L20 45 L2 34 L2 12 Z",stroke:"oklch(0.80 0.14 75 / 0.4)",strokeWidth:"1.5",fill:"oklch(0.80 0.14 75 / 0.06)"})}),(0,t.jsx)("svg",{className:"absolute",style:{bottom:"22%",left:"18%",animation:"ob-float 10s ease-in-out 2s infinite"},width:"32",height:"36",viewBox:"0 0 40 46",fill:"none",children:(0,t.jsx)("path",{d:"M20 1 L38 12 L38 34 L20 45 L2 34 L2 12 Z",stroke:"oklch(0.80 0.14 75 / 0.3)",strokeWidth:"1.5",fill:"oklch(0.80 0.14 75 / 0.05)"})}),(0,t.jsx)("div",{className:"absolute h-3.5 w-3.5 rounded-full bg-amber-400/40",style:{top:"30%",left:"28%",animation:"ob-float 7s ease-in-out 1s infinite"}}),(0,t.jsx)("div",{className:"absolute h-2.5 w-2.5 rounded-full bg-amber-400/30",style:{top:"65%",right:"30%",animation:"ob-float 9s ease-in-out 3s infinite"}}),(0,t.jsx)("div",{className:"absolute h-2 w-2 rounded-full bg-amber-400/20",style:{top:"45%",right:"15%",animation:"ob-float 6s ease-in-out 0.5s infinite"}}),(0,t.jsxs)("svg",{className:"absolute inset-0 h-full w-full text-white opacity-[0.12]",children:[(0,t.jsx)("line",{x1:"30%",y1:"25%",x2:"70%",y2:"45%",stroke:"currentColor",strokeWidth:"1",strokeDasharray:"4 6",style:{animation:"ob-dash 12s linear infinite"}}),(0,t.jsx)("line",{x1:"65%",y1:"30%",x2:"35%",y2:"70%",stroke:"currentColor",strokeWidth:"1",strokeDasharray:"4 6",style:{animation:"ob-dash 15s linear infinite reverse"}})]}),(0,t.jsx)("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 flex items-center justify-center",children:(0,t.jsx)("div",{className:"flex h-16 w-16 items-center justify-center rounded-2xl border border-amber-400/35 bg-amber-500/10 backdrop-blur-sm transition-all duration-700",style:{boxShadow:"0 0 50px oklch(0.80 0.14 75 / 0.2)"},children:(0,t.jsx)(s,{className:"h-7 w-7 text-amber-400"})})}),(0,t.jsx)("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 translate-y-12 text-center",children:(0,t.jsx)("p",{className:"text-[11px] font-medium tracking-widest uppercase text-amber-400/60",children:a})})]})}let U={host:"",ownerMatch:"*",localPathTemplate:""};e.s(["default",0,function(){let e,o,d,c=(0,a.useRouter)(),{t:m,locale:h,setLocale:p}=(0,f.useI18n)(),{theme:g,setTheme:j}=(0,l.useTheme)(),[L,z]=(0,s.useState)(!1),[I,H]=(0,s.useState)(1),[F,G]=(0,s.useState)(""),[O,D]=(0,s.useState)(null),[W,_]=(0,s.useState)([]),[q,V]=(0,s.useState)({...U}),[X,A]=(0,s.useState)(!0),[E,K]=(0,s.useState)(0),[Z,J]=(0,s.useState)(!1),[Q,Y]=(0,s.useState)(!1);(0,s.useEffect)(()=>z(!0),[]);let ee=[{value:"light",label:(0,t.jsx)(T.Sun,{className:"h-4 w-4"})},{value:"dark",label:(0,t.jsx)(S.Moon,{className:"h-4 w-4"})},{value:"system",label:(0,t.jsx)(P,{className:"h-4 w-4"})}];function et(){H(e=>e+1)}function es(){H(e=>Math.max(1,e-1))}async function ea(){Y(!0);try{W.length>0&&await (0,N.setConfigValue)("git.pathMappingRules",W),await v(F.trim()),c.replace("/workspaces")}catch{Y(!1)}}let el=[{icon:y.User,label:m("onboarding.step1.title")},{icon:u.Terminal,label:m("onboarding.step2.title")},{icon:k.GitBranch,label:m("onboarding.step3.title")}];return(0,t.jsxs)("div",{className:"flex h-screen bg-background",children:[(0,t.jsx)("div",{className:"hidden xl:block xl:w-3/5 border-r border-border/50 bg-[oklch(0.13_0.006_260)]",children:(0,t.jsx)(R,{step:I})}),(0,t.jsx)("div",{className:"flex w-full flex-col items-center px-8 pt-[10vh] pb-10 xl:w-2/5 xl:px-16 overflow-y-auto",children:(0,t.jsxs)("div",{className:"w-full max-w-lg space-y-6",children:[(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,t.jsx)("img",{src:"/logo.png",alt:"Tower",className:"h-8 w-8 rounded-lg"}),(0,t.jsx)("span",{className:"text-lg font-semibold tracking-tight",children:"Tower"})]}),(0,t.jsx)("div",{className:"flex items-center gap-1.5",children:el.map((e,s)=>{let a=s+1,l=a===I,r=a<I,i=e.icon;return(0,t.jsxs)("div",{className:"flex items-center gap-1.5 shrink-0",children:[s>0&&(0,t.jsx)("div",{className:`h-px w-4 transition-colors duration-500 ${r?"bg-primary":"bg-border"}`}),(0,t.jsxs)("div",{className:`flex items-center gap-1 shrink-0 rounded-full px-2 py-1 text-[11px] font-medium whitespace-nowrap transition-all duration-500 ${l?"bg-primary text-primary-foreground shadow-sm":r?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"}`,children:[r?(0,t.jsx)(x.Check,{className:"h-3 w-3 shrink-0"}):(0,t.jsx)(i,{className:"h-3 w-3 shrink-0"}),(0,t.jsx)("span",{children:e.label})]})]},s)})})]}),(0,t.jsxs)("div",{children:[1===I&&(0,t.jsxs)("div",{className:"space-y-7 animate-in fade-in slide-in-from-left-4 duration-500",children:[(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("h1",{className:"text-2xl font-bold tracking-tight",children:m("onboarding.step1.title")}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground leading-relaxed",children:m("onboarding.step1.desc")})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{htmlFor:"onboarding-username",className:"text-sm font-medium",children:m("onboarding.step1.usernameLabel")}),(0,t.jsx)("input",{id:"onboarding-username",type:"text",value:F,onChange:e=>G(e.target.value),placeholder:m("onboarding.step1.usernamePlaceholder"),className:"flex h-10 w-full rounded-lg border border-input bg-transparent px-3 py-2 text-sm shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",maxLength:64,autoFocus:!0,autoComplete:"username"})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-6",children:[(0,t.jsxs)("div",{className:"space-y-2.5",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(B,{className:"h-3.5 w-3.5 text-muted-foreground"}),(0,t.jsx)("label",{className:"text-sm font-medium",children:m("settings.language")})]}),(0,t.jsx)(n.SegmentedControl,{options:[{value:"zh",label:"中文"},{value:"en",label:"English"}].map(e=>({value:e.value,label:e.label})),value:h,onChange:e=>p(e)})]}),(0,t.jsxs)("div",{className:"space-y-2.5",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(T.Sun,{className:"h-3.5 w-3.5 text-muted-foreground"}),(0,t.jsx)("label",{className:"text-sm font-medium",children:m("settings.theme")})]}),L?(0,t.jsx)(n.SegmentedControl,{options:ee.map(e=>({value:e.value,label:e.label})),value:g??"system",onChange:e=>j(e)}):(0,t.jsx)("div",{className:"inline-flex h-8 rounded-md border border-border bg-muted p-1 gap-1 w-[120px]"})]})]}),(0,t.jsx)("div",{className:"flex justify-end pt-3",children:(0,t.jsxs)(r.Button,{onClick:et,disabled:0===F.trim().length,className:"px-5",children:[m("onboarding.step1.next"),(0,t.jsx)(C.ChevronRight,{className:"h-4 w-4 ml-1"})]})})]}),2===I&&(0,t.jsxs)("div",{className:"space-y-7 animate-in fade-in slide-in-from-left-4 duration-500",children:[(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("h1",{className:"text-2xl font-bold tracking-tight",children:m("onboarding.step2.title")}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground leading-relaxed",children:m("onboarding.step2.desc")})]}),(0,t.jsx)(b,{adapterType:"claude_code",adapterLabel:"Claude CLI",onResult:D}),(0,t.jsxs)("div",{className:"flex items-center justify-between pt-3",children:[(0,t.jsxs)(r.Button,{variant:"ghost",className:"text-muted-foreground",onClick:es,children:[(0,t.jsx)(w.ChevronLeft,{className:"h-4 w-4 mr-1"}),m("onboarding.back")]}),(0,t.jsxs)(r.Button,{onClick:et,disabled:!O?.ok,className:"px-5",children:[m("onboarding.step1.next"),(0,t.jsx)(C.ChevronRight,{className:"h-4 w-4 ml-1"})]})]})]}),3===I&&(0,t.jsxs)("div",{className:"space-y-5 animate-in fade-in slide-in-from-left-4 duration-500",children:[(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("h1",{className:"text-2xl font-bold tracking-tight",children:m("onboarding.step3.title")}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground leading-relaxed",children:m("onboarding.step3.desc")})]}),W.length>0&&(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("p",{className:"text-xs font-medium text-muted-foreground",children:m("onboarding.step3.added").replace("{count}",String(W.length))}),W.map(e=>(0,t.jsxs)("div",{className:"flex items-center justify-between rounded-lg border border-border bg-muted/30 px-3 py-2",children:[(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsxs)("p",{className:"text-sm font-medium truncate",children:[e.host,(0,t.jsx)("span",{className:"text-muted-foreground",children:"*"!==e.ownerMatch?` / ${e.ownerMatch}`:""})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground font-mono truncate",children:e.localPathTemplate})]}),(0,t.jsx)(r.Button,{variant:"ghost",size:"icon",className:"shrink-0 text-muted-foreground hover:text-destructive",onClick:()=>{var t;return t=e.id,void _(e=>e.filter(e=>e.id!==t))},children:(0,t.jsx)($.Trash2,{className:"h-3.5 w-3.5"})})]},e.id))]}),X?(0,t.jsxs)("div",{className:"space-y-3 rounded-lg border border-border p-4",children:[(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("label",{className:"text-xs font-medium",children:m("onboarding.step3.hostLabel")}),(0,t.jsx)(i.Input,{value:q.host,onChange:e=>V(t=>({...t,host:e.target.value})),placeholder:m("onboarding.step3.hostPlaceholder"),className:"h-9",autoFocus:!0})]}),(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("label",{className:"text-xs font-medium",children:m("onboarding.step3.ownerLabel")}),(0,t.jsx)(i.Input,{value:q.ownerMatch,onChange:e=>V(t=>({...t,ownerMatch:e.target.value})),placeholder:m("onboarding.step3.ownerPlaceholder"),className:"h-9"})]}),(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("label",{className:"text-xs font-medium",children:m("onboarding.step3.pathLabel")}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(i.Input,{value:q.localPathTemplate,onChange:e=>V(t=>({...t,localPathTemplate:e.target.value})),placeholder:m("onboarding.step3.pathPlaceholder"),className:"h-9 font-mono text-xs flex-1"}),(0,t.jsx)("button",{type:"button",onClick:()=>{J(e=>(e||K(2),!e))},className:`shrink-0 rounded-full px-2.5 py-1 text-[11px] font-mono font-medium transition-colors ${Z?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:text-foreground"}`,children:"{path}"})]}),(0,t.jsx)("p",{className:"text-[11px] text-muted-foreground",children:m(Z?"onboarding.step3.pathHintFull":"onboarding.step3.pathHintRepo")})]}),q.localPathTemplate&&(e=q.localPathTemplate.trim().replace(/\/+$/,""),o=Z?`${e}/{path}`:e,d=[{label:"GitHub SSH",url:"git@github.com:user/my-app.git"},{label:"GitHub HTTPS",url:"https://github.com/user/my-app.git"},{label:"GitLab Subgroup",url:"https://gitlab.com/org/team/sub/my-api.git"}],(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-xs font-medium",children:m("onboarding.step3.previewLabel")}),(0,t.jsx)("div",{className:"flex gap-1 flex-wrap",children:d.map((e,s)=>(0,t.jsx)("button",{type:"button",onClick:()=>K(s),className:`rounded-md px-2 py-1 text-[11px] font-medium transition-colors ${E===s?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:text-foreground"}`,children:e.label},s))}),(0,t.jsxs)("div",{className:"rounded-md bg-muted/50 px-3 py-2 space-y-1",children:[(0,t.jsx)("p",{className:"font-mono text-[11px] text-muted-foreground truncate",children:d[E].url}),(0,t.jsxs)("p",{className:"font-mono text-xs",children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:"→ "}),(0,t.jsx)("span",{className:"text-primary",children:function(e,t){if(!e||!t)return"";let s=t.trim(),a=[],l=s.match(/^git@[^:]+:(.+)$/);if(l)a=l[1].replace(/\.git\/?$/,"").split("/").filter(Boolean);else try{let e=new URL(s);a=decodeURIComponent(e.pathname).replace(/\.git\/?$/,"").split("/").filter(Boolean)}catch{return""}if(!a.length)return"";let r=a[0],i=a[a.length-1],n=a.join("/");if(e.includes("{path}"))return e.replace("{path}",n).replace("{owner}",r).replace("{repo}",i).replace(/\/+$/,"");let o=e.replace("{owner}",r).replace("{repo}","").replace(/\/+$/,"");return`${o}/${i}`}(o,d[E].url)})]})]})]})),(0,t.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[W.length>0&&(0,t.jsx)(r.Button,{variant:"ghost",onClick:()=>A(!1),children:m("settings.config.git.cancel")}),(0,t.jsxs)(r.Button,{onClick:function(){if(!q.host.trim()||!q.localPathTemplate.trim())return;let e=q.localPathTemplate.trim().replace(/\/+$/,""),t=Z?`${e}/{path}`:e,s={id:crypto.randomUUID(),host:q.host.trim(),ownerMatch:q.ownerMatch.trim()||"*",localPathTemplate:t,priority:W.length};_(e=>[...e,s]),V({...U}),J(!1),A(!1)},disabled:!q.host.trim()||!q.localPathTemplate.trim(),children:[(0,t.jsx)(x.Check,{className:"h-4 w-4 mr-1"}),m("settings.config.git.save")]})]})]}):(0,t.jsxs)(r.Button,{variant:"outline",onClick:()=>{V({...U}),A(!0)},children:[(0,t.jsx)(M.Plus,{className:"h-4 w-4 mr-1"}),m("settings.config.git.addRule")]}),(0,t.jsxs)("div",{className:"flex items-center justify-between pt-3",children:[(0,t.jsxs)(r.Button,{variant:"ghost",className:"text-muted-foreground",onClick:es,children:[(0,t.jsx)(w.ChevronLeft,{className:"h-4 w-4 mr-1"}),m("onboarding.back")]}),(0,t.jsxs)(r.Button,{onClick:ea,disabled:Q,className:"px-5",children:[m("onboarding.complete"),(0,t.jsx)(x.Check,{className:"h-4 w-4 ml-1"})]})]})]})]}),(0,t.jsx)("div",{className:"pt-6 text-xs text-muted-foreground",children:m("onboarding.stepIndicator").replace("{current}",String(I)).replace("{total}",String(3))})]})})]})}],690951)}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,117474,e=>{"use strict";let t=(0,e.i(863961).default)("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);e.s(["User",0,t],117474)},803041,e=>{"use strict";var t=e.i(422364);e.s(["ChevronRight",()=>t.default])},750986,1156,e=>{"use strict";var t=e.i(419613);e.s(["CheckCircle2",()=>t.default],750986);let s=(0,e.i(863961).default)("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);e.s(["XCircle",0,s],1156)},950211,e=>{"use strict";let t=(0,e.i(863961).default)("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);e.s(["Terminal",0,t],950211)},864056,e=>{"use strict";let t=(0,e.i(863961).default)("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);e.s(["ChevronLeft",0,t],864056)},690951,e=>{"use strict";var t=e.i(432377),s=e.i(85212),a=e.i(309542),l=e.i(275283),r=e.i(711296),i=e.i(831349),n=e.i(584685),o=e.i(937756);function d({className:e,size:s="default",...a}){return(0,t.jsx)("div",{"data-slot":"card","data-size":s,className:(0,o.cn)("group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-card py-4 text-sm text-card-foreground ring-1 ring-foreground/10 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",e),...a})}function c({className:e,...s}){return(0,t.jsx)("div",{"data-slot":"card-content",className:(0,o.cn)("px-4 group-data-[size=sm]/card:px-3",e),...s})}var m=e.i(946960),x=e.i(893832),h=e.i(996032),u=e.i(950211),p=e.i(750986),g=e.i(1156),b=e.i(625054);function f({adapterType:e,adapterLabel:a,onResult:l}){let[i,n]=(0,s.useState)(!1),[j,v]=(0,s.useState)(null),{t:N}=(0,b.useI18n)();async function y(){if(!i){n(!0),v(null);try{let t=await fetch("/api/adapters/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({adapterType:e})}),s=await t.json();v(s),l?.(s)}catch{let e={ok:!1,checks:[{name:"network_error",passed:!1,message:"Network request failed"}]};v(e),l?.(e)}finally{n(!1)}}}return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"rounded-lg bg-emerald-100 dark:bg-emerald-900/30 p-2",children:(0,t.jsx)(u.Terminal,{className:"h-5 w-5 text-emerald-600 dark:text-emerald-400"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h3",{className:"font-semibold",children:N("settings.aiTools.cliVerification")}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:N("settings.aiTools.cliVerificationDesc")})]})]}),(0,t.jsx)(d,{children:(0,t.jsxs)(c,{className:"p-6 space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("div",{children:a&&(0,t.jsx)("p",{className:"font-medium",children:a})}),(0,t.jsx)(r.Button,{onClick:y,disabled:i,variant:"outline",children:i?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(m.Loader2,{className:"h-4 w-4 animate-spin mr-2"}),N("settings.aiTools.testing")]}):N("settings.aiTools.testConnection")})]}),j&&(0,t.jsxs)("div",{className:(0,o.cn)("rounded-lg border p-4 space-y-3",j.ok?"bg-green-50 border-green-200 dark:bg-green-950/20 dark:border-green-800":"bg-red-50 border-red-200 dark:bg-red-950/20 dark:border-red-800"),children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[j.ok?(0,t.jsx)(p.CheckCircle2,{className:"h-4 w-4 text-green-600 dark:text-green-400"}):(0,t.jsx)(g.XCircle,{className:"h-4 w-4 text-red-600 dark:text-red-400"}),(0,t.jsx)("span",{className:(0,o.cn)("text-sm font-medium",j.ok?"text-green-700 dark:text-green-300":"text-red-700 dark:text-red-300"),children:N(j.ok?"settings.aiTools.testPassed":"settings.aiTools.testFailed")})]}),(0,t.jsx)("div",{className:"space-y-2",children:j.checks.map(s=>(0,t.jsxs)("div",{className:"flex items-start gap-2 text-sm",children:[s.passed?(0,t.jsx)(x.Check,{className:"h-4 w-4 text-green-500 mt-0.5 shrink-0"}):(0,t.jsx)(h.X,{className:"h-4 w-4 text-red-500 mt-0.5 shrink-0"}),(0,t.jsx)("span",{className:(0,o.cn)(s.passed?"text-green-700 dark:text-green-300":"text-red-700 dark:text-red-300"),children:s.message})]},`${e}-${s.name}`))})]})]})})]})}var j=e.i(543485);let v=(0,j.createServerReference)("408131d9114dbbcb470b8ebd8a59952c6fe74c7b1b",j.callServer,void 0,j.findSourceMapURL,"completeOnboarding");var N=e.i(380402),y=e.i(117474),k=e.i(357334),w=e.i(864056),C=e.i(803041),T=e.i(811424),S=e.i(809250),L=e.i(863961);let P=(0,L.default)("monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]),B=(0,L.default)("languages",[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]);var M=e.i(780156),$=e.i(909260);function R({step:e}){let s=[y.User,u.Terminal,k.GitBranch][e-1]??y.User,a=["Profile","Connect","Configure"][e-1]??"";return(0,t.jsxs)("div",{className:"relative h-full w-full overflow-hidden",children:[(0,t.jsx)("div",{className:"absolute inset-0 opacity-[0.07] text-white",style:{backgroundImage:"radial-gradient(circle, currentColor 1px, transparent 1px)",backgroundSize:"24px 24px"}}),(0,t.jsx)("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full",style:{width:"380px",height:"380px",background:"radial-gradient(circle, oklch(0.80 0.14 75 / 0.25) 0%, oklch(0.80 0.14 75 / 0.08) 45%, transparent 70%)",animation:"ob-pulse 6s ease-in-out infinite"}}),(0,t.jsx)("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full border border-amber-400/25",style:{width:"260px",height:"260px",animation:"ob-spin 20s linear infinite"},children:(0,t.jsx)("div",{className:"absolute -top-1.5 left-1/2 -translate-x-1/2 h-3 w-3 rounded-full bg-amber-400",style:{boxShadow:"0 0 16px oklch(0.80 0.14 75 / 0.7)"}})}),(0,t.jsxs)("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full border border-amber-400/15",style:{width:"380px",height:"380px",animation:"ob-spin 30s linear infinite reverse"},children:[(0,t.jsx)("div",{className:"absolute -top-1 left-1/2 -translate-x-1/2 h-2 w-2 rounded-full bg-amber-400/70"}),(0,t.jsx)("div",{className:"absolute -bottom-1 left-1/2 -translate-x-1/2 h-1.5 w-1.5 rounded-full bg-amber-400/50"})]}),(0,t.jsx)("svg",{className:"absolute",style:{top:"18%",right:"22%",animation:"ob-float 8s ease-in-out infinite"},width:"44",height:"50",viewBox:"0 0 40 46",fill:"none",children:(0,t.jsx)("path",{d:"M20 1 L38 12 L38 34 L20 45 L2 34 L2 12 Z",stroke:"oklch(0.80 0.14 75 / 0.4)",strokeWidth:"1.5",fill:"oklch(0.80 0.14 75 / 0.06)"})}),(0,t.jsx)("svg",{className:"absolute",style:{bottom:"22%",left:"18%",animation:"ob-float 10s ease-in-out 2s infinite"},width:"32",height:"36",viewBox:"0 0 40 46",fill:"none",children:(0,t.jsx)("path",{d:"M20 1 L38 12 L38 34 L20 45 L2 34 L2 12 Z",stroke:"oklch(0.80 0.14 75 / 0.3)",strokeWidth:"1.5",fill:"oklch(0.80 0.14 75 / 0.05)"})}),(0,t.jsx)("div",{className:"absolute h-3.5 w-3.5 rounded-full bg-amber-400/40",style:{top:"30%",left:"28%",animation:"ob-float 7s ease-in-out 1s infinite"}}),(0,t.jsx)("div",{className:"absolute h-2.5 w-2.5 rounded-full bg-amber-400/30",style:{top:"65%",right:"30%",animation:"ob-float 9s ease-in-out 3s infinite"}}),(0,t.jsx)("div",{className:"absolute h-2 w-2 rounded-full bg-amber-400/20",style:{top:"45%",right:"15%",animation:"ob-float 6s ease-in-out 0.5s infinite"}}),(0,t.jsxs)("svg",{className:"absolute inset-0 h-full w-full text-white opacity-[0.12]",children:[(0,t.jsx)("line",{x1:"30%",y1:"25%",x2:"70%",y2:"45%",stroke:"currentColor",strokeWidth:"1",strokeDasharray:"4 6",style:{animation:"ob-dash 12s linear infinite"}}),(0,t.jsx)("line",{x1:"65%",y1:"30%",x2:"35%",y2:"70%",stroke:"currentColor",strokeWidth:"1",strokeDasharray:"4 6",style:{animation:"ob-dash 15s linear infinite reverse"}})]}),(0,t.jsx)("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 flex items-center justify-center",children:(0,t.jsx)("div",{className:"flex h-16 w-16 items-center justify-center rounded-2xl border border-amber-400/35 bg-amber-500/10 backdrop-blur-sm transition-all duration-700",style:{boxShadow:"0 0 50px oklch(0.80 0.14 75 / 0.2)"},children:(0,t.jsx)(s,{className:"h-7 w-7 text-amber-400"})})}),(0,t.jsx)("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 translate-y-12 text-center",children:(0,t.jsx)("p",{className:"text-[11px] font-medium tracking-widest uppercase text-amber-400/60",children:a})})]})}let U={host:"",ownerMatch:"*",localPathTemplate:""};e.s(["default",0,function(){let e,o,d,c=(0,a.useRouter)(),{t:m,locale:h,setLocale:p}=(0,b.useI18n)(),{theme:g,setTheme:j}=(0,l.useTheme)(),[L,z]=(0,s.useState)(!1),[I,H]=(0,s.useState)(1),[F,G]=(0,s.useState)(""),[O,D]=(0,s.useState)(null),[W,_]=(0,s.useState)([]),[q,V]=(0,s.useState)({...U}),[X,A]=(0,s.useState)(!0),[E,K]=(0,s.useState)(0),[Z,J]=(0,s.useState)(!1),[Q,Y]=(0,s.useState)(!1);(0,s.useEffect)(()=>z(!0),[]);let ee=[{value:"light",label:(0,t.jsx)(T.Sun,{className:"h-4 w-4"})},{value:"dark",label:(0,t.jsx)(S.Moon,{className:"h-4 w-4"})},{value:"system",label:(0,t.jsx)(P,{className:"h-4 w-4"})}];function et(){H(e=>e+1)}function es(){H(e=>Math.max(1,e-1))}async function ea(){Y(!0);try{W.length>0&&await (0,N.setConfigValue)("git.pathMappingRules",W),await v(F.trim()),c.replace("/workspaces")}catch{Y(!1)}}let el=[{icon:y.User,label:m("onboarding.step1.title")},{icon:u.Terminal,label:m("onboarding.step2.title")},{icon:k.GitBranch,label:m("onboarding.step3.title")}];return(0,t.jsxs)("div",{className:"flex h-screen bg-background",children:[(0,t.jsx)("div",{className:"hidden xl:block xl:w-3/5 border-r border-border/50 bg-[oklch(0.13_0.006_260)]",children:(0,t.jsx)(R,{step:I})}),(0,t.jsx)("div",{className:"flex w-full flex-col items-center px-8 pt-[10vh] pb-10 xl:w-2/5 xl:px-16 overflow-y-auto",children:(0,t.jsxs)("div",{className:"w-full max-w-lg space-y-6",children:[(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,t.jsx)("img",{src:"/logo.png",alt:"Tower",className:"h-8 w-8 rounded-lg"}),(0,t.jsx)("span",{className:"text-lg font-semibold tracking-tight",children:"Tower"})]}),(0,t.jsx)("div",{className:"flex items-center gap-1.5",children:el.map((e,s)=>{let a=s+1,l=a===I,r=a<I,i=e.icon;return(0,t.jsxs)("div",{className:"flex items-center gap-1.5 shrink-0",children:[s>0&&(0,t.jsx)("div",{className:`h-px w-4 transition-colors duration-500 ${r?"bg-primary":"bg-border"}`}),(0,t.jsxs)("div",{className:`flex items-center gap-1 shrink-0 rounded-full px-2 py-1 text-[11px] font-medium whitespace-nowrap transition-all duration-500 ${l?"bg-primary text-primary-foreground shadow-sm":r?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"}`,children:[r?(0,t.jsx)(x.Check,{className:"h-3 w-3 shrink-0"}):(0,t.jsx)(i,{className:"h-3 w-3 shrink-0"}),(0,t.jsx)("span",{children:e.label})]})]},s)})})]}),(0,t.jsxs)("div",{children:[1===I&&(0,t.jsxs)("div",{className:"space-y-7 animate-in fade-in slide-in-from-left-4 duration-500",children:[(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("h1",{className:"text-2xl font-bold tracking-tight",children:m("onboarding.step1.title")}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground leading-relaxed",children:m("onboarding.step1.desc")})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{htmlFor:"onboarding-username",className:"text-sm font-medium",children:m("onboarding.step1.usernameLabel")}),(0,t.jsx)("input",{id:"onboarding-username",type:"text",value:F,onChange:e=>G(e.target.value),placeholder:m("onboarding.step1.usernamePlaceholder"),className:"flex h-10 w-full rounded-lg border border-input bg-transparent px-3 py-2 text-sm shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",maxLength:64,autoFocus:!0,autoComplete:"username"})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-6",children:[(0,t.jsxs)("div",{className:"space-y-2.5",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(B,{className:"h-3.5 w-3.5 text-muted-foreground"}),(0,t.jsx)("label",{className:"text-sm font-medium",children:m("settings.language")})]}),(0,t.jsx)(n.SegmentedControl,{options:[{value:"zh",label:"中文"},{value:"en",label:"English"}].map(e=>({value:e.value,label:e.label})),value:h,onChange:e=>p(e)})]}),(0,t.jsxs)("div",{className:"space-y-2.5",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(T.Sun,{className:"h-3.5 w-3.5 text-muted-foreground"}),(0,t.jsx)("label",{className:"text-sm font-medium",children:m("settings.theme")})]}),L?(0,t.jsx)(n.SegmentedControl,{options:ee.map(e=>({value:e.value,label:e.label})),value:g??"system",onChange:e=>j(e)}):(0,t.jsx)("div",{className:"inline-flex h-8 rounded-md border border-border bg-muted p-1 gap-1 w-[120px]"})]})]}),(0,t.jsx)("div",{className:"flex justify-end pt-3",children:(0,t.jsxs)(r.Button,{onClick:et,disabled:0===F.trim().length,className:"px-5",children:[m("onboarding.step1.next"),(0,t.jsx)(C.ChevronRight,{className:"h-4 w-4 ml-1"})]})})]}),2===I&&(0,t.jsxs)("div",{className:"space-y-7 animate-in fade-in slide-in-from-left-4 duration-500",children:[(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("h1",{className:"text-2xl font-bold tracking-tight",children:m("onboarding.step2.title")}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground leading-relaxed",children:m("onboarding.step2.desc")})]}),(0,t.jsx)(f,{adapterType:"claude_code",adapterLabel:"Claude CLI",onResult:D}),(0,t.jsxs)("div",{className:"flex items-center justify-between pt-3",children:[(0,t.jsxs)(r.Button,{variant:"ghost",className:"text-muted-foreground",onClick:es,children:[(0,t.jsx)(w.ChevronLeft,{className:"h-4 w-4 mr-1"}),m("onboarding.back")]}),(0,t.jsxs)(r.Button,{onClick:et,disabled:!O?.ok,className:"px-5",children:[m("onboarding.step1.next"),(0,t.jsx)(C.ChevronRight,{className:"h-4 w-4 ml-1"})]})]})]}),3===I&&(0,t.jsxs)("div",{className:"space-y-5 animate-in fade-in slide-in-from-left-4 duration-500",children:[(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("h1",{className:"text-2xl font-bold tracking-tight",children:m("onboarding.step3.title")}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground leading-relaxed",children:m("onboarding.step3.desc")})]}),W.length>0&&(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("p",{className:"text-xs font-medium text-muted-foreground",children:m("onboarding.step3.added").replace("{count}",String(W.length))}),W.map(e=>(0,t.jsxs)("div",{className:"flex items-center justify-between rounded-lg border border-border bg-muted/30 px-3 py-2",children:[(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsxs)("p",{className:"text-sm font-medium truncate",children:[e.host,(0,t.jsx)("span",{className:"text-muted-foreground",children:"*"!==e.ownerMatch?` / ${e.ownerMatch}`:""})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground font-mono truncate",children:e.localPathTemplate})]}),(0,t.jsx)(r.Button,{variant:"ghost",size:"icon",className:"shrink-0 text-muted-foreground hover:text-destructive",onClick:()=>{var t;return t=e.id,void _(e=>e.filter(e=>e.id!==t))},children:(0,t.jsx)($.Trash2,{className:"h-3.5 w-3.5"})})]},e.id))]}),X?(0,t.jsxs)("div",{className:"space-y-3 rounded-lg border border-border p-4",children:[(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("label",{className:"text-xs font-medium",children:m("onboarding.step3.hostLabel")}),(0,t.jsx)(i.Input,{value:q.host,onChange:e=>V(t=>({...t,host:e.target.value})),placeholder:m("onboarding.step3.hostPlaceholder"),className:"h-9",autoFocus:!0})]}),(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("label",{className:"text-xs font-medium",children:m("onboarding.step3.ownerLabel")}),(0,t.jsx)(i.Input,{value:q.ownerMatch,onChange:e=>V(t=>({...t,ownerMatch:e.target.value})),placeholder:m("onboarding.step3.ownerPlaceholder"),className:"h-9"})]}),(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("label",{className:"text-xs font-medium",children:m("onboarding.step3.pathLabel")}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(i.Input,{value:q.localPathTemplate,onChange:e=>V(t=>({...t,localPathTemplate:e.target.value})),placeholder:m("onboarding.step3.pathPlaceholder"),className:"h-9 font-mono text-xs flex-1"}),(0,t.jsx)("button",{type:"button",onClick:()=>{J(e=>(e||K(2),!e))},className:`shrink-0 rounded-full px-2.5 py-1 text-[11px] font-mono font-medium transition-colors ${Z?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:text-foreground"}`,children:"{path}"})]}),(0,t.jsx)("p",{className:"text-[11px] text-muted-foreground",children:m(Z?"onboarding.step3.pathHintFull":"onboarding.step3.pathHintRepo")})]}),q.localPathTemplate&&(e=q.localPathTemplate.trim().replace(/\/+$/,""),o=Z?`${e}/{path}`:e,d=[{label:"GitHub SSH",url:"git@github.com:user/my-app.git"},{label:"GitHub HTTPS",url:"https://github.com/user/my-app.git"},{label:"GitLab Subgroup",url:"https://gitlab.com/org/team/sub/my-api.git"}],(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-xs font-medium",children:m("onboarding.step3.previewLabel")}),(0,t.jsx)("div",{className:"flex gap-1 flex-wrap",children:d.map((e,s)=>(0,t.jsx)("button",{type:"button",onClick:()=>K(s),className:`rounded-md px-2 py-1 text-[11px] font-medium transition-colors ${E===s?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:text-foreground"}`,children:e.label},s))}),(0,t.jsxs)("div",{className:"rounded-md bg-muted/50 px-3 py-2 space-y-1",children:[(0,t.jsx)("p",{className:"font-mono text-[11px] text-muted-foreground truncate",children:d[E].url}),(0,t.jsxs)("p",{className:"font-mono text-xs",children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:"→ "}),(0,t.jsx)("span",{className:"text-primary",children:function(e,t){if(!e||!t)return"";let s=t.trim(),a=[],l=s.match(/^git@[^:]+:(.+)$/);if(l)a=l[1].replace(/\.git\/?$/,"").split("/").filter(Boolean);else try{let e=new URL(s);a=decodeURIComponent(e.pathname).replace(/\.git\/?$/,"").split("/").filter(Boolean)}catch{return""}if(!a.length)return"";let r=a[0],i=a[a.length-1],n=a.join("/");if(e.includes("{path}"))return e.replace("{path}",n).replace("{owner}",r).replace("{repo}",i).replace(/\/+$/,"");let o=e.replace("{owner}",r).replace("{repo}","").replace(/\/+$/,"");return`${o}/${i}`}(o,d[E].url)})]})]})]})),(0,t.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[W.length>0&&(0,t.jsx)(r.Button,{variant:"ghost",onClick:()=>A(!1),children:m("settings.config.git.cancel")}),(0,t.jsxs)(r.Button,{onClick:function(){if(!q.host.trim()||!q.localPathTemplate.trim())return;let e=q.localPathTemplate.trim().replace(/\/+$/,""),t=Z?`${e}/{path}`:e,s={id:crypto.randomUUID(),host:q.host.trim(),ownerMatch:q.ownerMatch.trim()||"*",localPathTemplate:t,priority:W.length};_(e=>[...e,s]),V({...U}),J(!1),A(!1)},disabled:!q.host.trim()||!q.localPathTemplate.trim(),children:[(0,t.jsx)(x.Check,{className:"h-4 w-4 mr-1"}),m("settings.config.git.save")]})]})]}):(0,t.jsxs)(r.Button,{variant:"outline",onClick:()=>{V({...U}),A(!0)},children:[(0,t.jsx)(M.Plus,{className:"h-4 w-4 mr-1"}),m("settings.config.git.addRule")]}),(0,t.jsxs)("div",{className:"flex items-center justify-between pt-3",children:[(0,t.jsxs)(r.Button,{variant:"ghost",className:"text-muted-foreground",onClick:es,children:[(0,t.jsx)(w.ChevronLeft,{className:"h-4 w-4 mr-1"}),m("onboarding.back")]}),(0,t.jsxs)(r.Button,{onClick:ea,disabled:Q,className:"px-5",children:[m("onboarding.complete"),(0,t.jsx)(x.Check,{className:"h-4 w-4 ml-1"})]})]})]})]}),(0,t.jsx)("div",{className:"pt-6 text-xs text-muted-foreground",children:m("onboarding.stepIndicator").replace("{current}",String(I)).replace("{total}",String(3))})]})})]})}],690951)}]);