agent-tower 0.5.3-beta.8 → 0.5.3

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 (100) hide show
  1. package/dist/web/assets/{AgentDemoPage-gztcIidI.js → AgentDemoPage-DMLw4xpg.js} +1 -1
  2. package/dist/web/assets/{AgentEnvironmentSettingsPage-CPNttAOj.js → AgentEnvironmentSettingsPage-NgRdouLu.js} +1 -1
  3. package/dist/web/assets/{AgentLogo-Bqjt1u2k.js → AgentLogo-ThhvSi7G.js} +1 -1
  4. package/dist/web/assets/{ConversationPage-DdfPLaBU.js → ConversationPage-B1ZcyF_h.js} +1 -1
  5. package/dist/web/assets/{CreateTaskInput-DQSvlvL0.js → CreateTaskInput-Cb3aRHr3.js} +1 -1
  6. package/dist/web/assets/{DemoPage-BHRQrxxs.js → DemoPage-CN2OBKzu.js} +1 -1
  7. package/dist/web/assets/{GeneralSettingsPage-c6tWGPk7.js → GeneralSettingsPage-CE7P3t_v.js} +1 -1
  8. package/dist/web/assets/{Icons-hnXjnfjL.js → Icons-DIZBOtuC.js} +1 -1
  9. package/dist/web/assets/{LoadingPreviewPage-D_TI4PEx.js → LoadingPreviewPage-CRBcypeY.js} +1 -1
  10. package/dist/web/assets/{McpSettingsPage-D6b7ZWOS.js → McpSettingsPage-gp1XDMUd.js} +1 -1
  11. package/dist/web/assets/{MemberAvatar-DKsedKpu.js → MemberAvatar-Y_pJlw-N.js} +1 -1
  12. package/dist/web/assets/{NotificationSettingsPage-Cv91U2pg.js → NotificationSettingsPage-BhZeHEef.js} +1 -1
  13. package/dist/web/assets/{ProfileSettingsPage-K_eadHzF.js → ProfileSettingsPage-D_y3ePFs.js} +1 -1
  14. package/dist/web/assets/{ProjectKanbanPage-Cw4kAimX.js → ProjectKanbanPage-CBfocvKp.js} +3 -3
  15. package/dist/web/assets/{ProjectSettingsPage-Vw4sQoAf.js → ProjectSettingsPage-V38j8T61.js} +1 -1
  16. package/dist/web/assets/{ProviderSettingsPage-DeNiqchP.js → ProviderSettingsPage-D-1Fyh5B.js} +1 -1
  17. package/dist/web/assets/{SettingsMasterDetail-BusgjyV7.js → SettingsMasterDetail-CZfVaFo2.js} +1 -1
  18. package/dist/web/assets/{TeamSettingsPage-DIQuN3Y5.js → TeamSettingsPage-DysTmOGE.js} +1 -1
  19. package/dist/web/assets/{arc-cT4PVtdQ.js → arc-CgLBAHTH.js} +1 -1
  20. package/dist/web/assets/{architectureDiagram-3BPJPVTR-DYwJxluW.js → architectureDiagram-3BPJPVTR-CP9eQfdk.js} +1 -1
  21. package/dist/web/assets/{arrow-left-DWeEJsaX.js → arrow-left-y1LwO7sB.js} +1 -1
  22. package/dist/web/assets/{blockDiagram-GPEHLZMM-CaXsST1G.js → blockDiagram-GPEHLZMM-BURZnUwn.js} +1 -1
  23. package/dist/web/assets/{c4Diagram-AAUBKEIU-DKqAyb1m.js → c4Diagram-AAUBKEIU-Dzgp3z3S.js} +1 -1
  24. package/dist/web/assets/channel-CWEYGfCJ.js +1 -0
  25. package/dist/web/assets/check-D2WWIhwV.js +1 -0
  26. package/dist/web/assets/{chevron-down-o4IZE_P6.js → chevron-down--B7iZqBL.js} +1 -1
  27. package/dist/web/assets/{chevron-right-DSyyoNau.js → chevron-right-7PShDIwg.js} +1 -1
  28. package/dist/web/assets/{chevron-up-BsLA8Xot.js → chevron-up-3n_vHdrD.js} +1 -1
  29. package/dist/web/assets/{chunk-2J33WTMH-DoC7k16y.js → chunk-2J33WTMH-CIpasa01.js} +1 -1
  30. package/dist/web/assets/{chunk-4BX2VUAB-CMKi8GO_.js → chunk-4BX2VUAB-DeSe2m1y.js} +1 -1
  31. package/dist/web/assets/{chunk-55IACEB6-Lyg5IKqI.js → chunk-55IACEB6-BkJ6ogdn.js} +1 -1
  32. package/dist/web/assets/{chunk-727SXJPM-ColYow00.js → chunk-727SXJPM-Bkbv-knP.js} +1 -1
  33. package/dist/web/assets/{chunk-AQP2D5EJ-CoT-4pKg.js → chunk-AQP2D5EJ-BG9wGFIo.js} +1 -1
  34. package/dist/web/assets/{chunk-FMBD7UC4-DVIaL62f.js → chunk-FMBD7UC4-Cvl_2za9.js} +1 -1
  35. package/dist/web/assets/{chunk-ND2GUHAM-BNuafnYz.js → chunk-ND2GUHAM-B_zdzkWX.js} +1 -1
  36. package/dist/web/assets/{chunk-QZHKN3VN-mqqlxbRp.js → chunk-QZHKN3VN-Ch6dvKNw.js} +1 -1
  37. package/dist/web/assets/{circle-alert-FqsC_oWX.js → circle-alert-W13JkYj3.js} +1 -1
  38. package/dist/web/assets/classDiagram-4FO5ZUOK-CcU8zfK8.js +1 -0
  39. package/dist/web/assets/classDiagram-v2-Q7XG4LA2-CcU8zfK8.js +1 -0
  40. package/dist/web/assets/{code-block-OCS4YCEC-BHWPqjt4.js → code-block-OCS4YCEC-CYhJ9OPu.js} +1 -1
  41. package/dist/web/assets/{confirm-dialog-BRqwAzwk.js → confirm-dialog-BAqfLDT8.js} +1 -1
  42. package/dist/web/assets/{copy-r1RvUhIY.js → copy-bJ2sut_L.js} +1 -1
  43. package/dist/web/assets/{cose-bilkent-S5V4N54A-Dx6hZ-zB.js → cose-bilkent-S5V4N54A-DWlnxyfH.js} +1 -1
  44. package/dist/web/assets/{dagre-BM42HDAG-jCqcQJ4A.js → dagre-BM42HDAG-Bt3QI02a.js} +1 -1
  45. package/dist/web/assets/{diagram-2AECGRRQ-BFaFAwAW.js → diagram-2AECGRRQ-EaJBYSnS.js} +1 -1
  46. package/dist/web/assets/{diagram-5GNKFQAL-D0VOgGBN.js → diagram-5GNKFQAL-BGyRb-_h.js} +1 -1
  47. package/dist/web/assets/{diagram-KO2AKTUF-OkBj16PX.js → diagram-KO2AKTUF-CZhDTMfm.js} +1 -1
  48. package/dist/web/assets/{diagram-LMA3HP47-Ca28pfZT.js → diagram-LMA3HP47-Be8BAxmL.js} +1 -1
  49. package/dist/web/assets/{diagram-OG6HWLK6-BdQf7KOI.js → diagram-OG6HWLK6-DEdQ7Cml.js} +1 -1
  50. package/dist/web/assets/{erDiagram-TEJ5UH35-Bf80VYE6.js → erDiagram-TEJ5UH35-CG9SNlbz.js} +1 -1
  51. package/dist/web/assets/{flowDiagram-I6XJVG4X-BZWZqm_C.js → flowDiagram-I6XJVG4X-BUpx5PVX.js} +1 -1
  52. package/dist/web/assets/{folder-picker-ROPpPW7C.js → folder-picker-DFB9_pv4.js} +1 -1
  53. package/dist/web/assets/{folder-C-l50KQ-.js → folder-u7fKAtz_.js} +1 -1
  54. package/dist/web/assets/{ganttDiagram-6RSMTGT7-CWf25QDV.js → ganttDiagram-6RSMTGT7-D7vRxMpE.js} +1 -1
  55. package/dist/web/assets/{gitGraphDiagram-PVQCEYII-9cyYoW83.js → gitGraphDiagram-PVQCEYII-3lhH-RcD.js} +1 -1
  56. package/dist/web/assets/{index-3VWij2vw.js → index-7nw4fV42.js} +3 -3
  57. package/dist/web/assets/{index-Cask0_DN.js → index-CGMjRoF7.js} +4 -4
  58. package/dist/web/assets/index-YCjjSSLC.css +1 -0
  59. package/dist/web/assets/{infoDiagram-5YYISTIA-DWSuhoXN.js → infoDiagram-5YYISTIA-C5SNbJpO.js} +1 -1
  60. package/dist/web/assets/{input-Dyl1onpD.js → input-CKwRYuUJ.js} +1 -1
  61. package/dist/web/assets/{ishikawaDiagram-YF4QCWOH-BfxkZcbP.js → ishikawaDiagram-YF4QCWOH-Ca7tX9_0.js} +1 -1
  62. package/dist/web/assets/{journeyDiagram-JHISSGLW-keJyzDNt.js → journeyDiagram-JHISSGLW-B2oo6nxY.js} +1 -1
  63. package/dist/web/assets/{kanban-definition-UN3LZRKU-wo8SY3VQ.js → kanban-definition-UN3LZRKU-D1CzIzX9.js} +1 -1
  64. package/dist/web/assets/{layers-CT4P8Wt_.js → layers-BbLzQqyy.js} +1 -1
  65. package/dist/web/assets/{linear-DXmYF97H.js → linear-BWowtcGw.js} +1 -1
  66. package/dist/web/assets/{mermaid-NOHMQCX5-DjJdrIaK.js → mermaid-NOHMQCX5-B42ziicV.js} +3 -3
  67. package/dist/web/assets/{message-square-B0uoScMB.js → message-square-Bd_m34OX.js} +1 -1
  68. package/dist/web/assets/{mindmap-definition-RKZ34NQL-BR1VqGMr.js → mindmap-definition-RKZ34NQL-CYbO6QCk.js} +1 -1
  69. package/dist/web/assets/{modal-CN741Elc.js → modal-CxOKWOjZ.js} +1 -1
  70. package/dist/web/assets/{pencil-B05Eh9uE.js → pencil-h5kxwbcu.js} +1 -1
  71. package/dist/web/assets/{pieDiagram-4H26LBE5-DmIVi6kN.js → pieDiagram-4H26LBE5-DXQghKRy.js} +1 -1
  72. package/dist/web/assets/{quadrantDiagram-W4KKPZXB-Bh1fx3P_.js → quadrantDiagram-W4KKPZXB-C6lAMMQB.js} +1 -1
  73. package/dist/web/assets/{requirementDiagram-4Y6WPE33-BheNLVEb.js → requirementDiagram-4Y6WPE33-Di9Le7Wy.js} +1 -1
  74. package/dist/web/assets/{sankeyDiagram-5OEKKPKP-CWuQByUh.js → sankeyDiagram-5OEKKPKP-BGpnptvR.js} +1 -1
  75. package/dist/web/assets/{select-B2NVUyiF.js → select-DFuN9DX8.js} +1 -1
  76. package/dist/web/assets/{sequenceDiagram-3UESZ5HK-Blll85Hd.js → sequenceDiagram-3UESZ5HK-DjfkfaQL.js} +1 -1
  77. package/dist/web/assets/{stateDiagram-AJRCARHV-C31npQBQ.js → stateDiagram-AJRCARHV-DsELotm9.js} +1 -1
  78. package/dist/web/assets/stateDiagram-v2-BHNVJYJU-CudtEyHd.js +1 -0
  79. package/dist/web/assets/{switch-BiB7Kgpg.js → switch-gL7lBFj6.js} +1 -1
  80. package/dist/web/assets/{textarea-Du_ydNYw.js → textarea-Lr4GZaYW.js} +1 -1
  81. package/dist/web/assets/{timeline-definition-PNZ67QCA-BXjt2YG8.js → timeline-definition-PNZ67QCA-Cq1BWC0T.js} +1 -1
  82. package/dist/web/assets/{trash-2-CWVsy23V.js → trash-2-B7GFt5Wl.js} +1 -1
  83. package/dist/web/assets/{upload-C-wK_vWU.js → upload-L8hpDFoO.js} +1 -1
  84. package/dist/web/assets/{use-profiles-DwPVupVL.js → use-profiles-zIsoigD8.js} +1 -1
  85. package/dist/web/assets/{use-providers-C-PIoFvi.js → use-providers-erJ2iHLz.js} +1 -1
  86. package/dist/web/assets/{useNormalizedLogs-CGOi3cNq.js → useNormalizedLogs-CXAn7xj_.js} +1 -1
  87. package/dist/web/assets/{vennDiagram-CIIHVFJN-DKpjIApG.js → vennDiagram-CIIHVFJN-DdOfNtRo.js} +1 -1
  88. package/dist/web/assets/{wardley-L42UT6IY-DvryVGdS.js → wardley-L42UT6IY-BeKcEIgK.js} +1 -1
  89. package/dist/web/assets/{wardleyDiagram-YWT4CUSO-CtUF9zNr.js → wardleyDiagram-YWT4CUSO-DPKOxABd.js} +1 -1
  90. package/dist/web/assets/{xychartDiagram-2RQKCTM6-Qx4Q-1Xq.js → xychartDiagram-2RQKCTM6-olIy_aaY.js} +1 -1
  91. package/dist/web/index.html +2 -2
  92. package/node_modules/@prisma/client/.prisma/client/edge.js +2 -2
  93. package/node_modules/@prisma/client/.prisma/client/index.js +2 -2
  94. package/package.json +1 -1
  95. package/dist/web/assets/channel--M3xJN0e.js +0 -1
  96. package/dist/web/assets/check-CjNklwnC.js +0 -1
  97. package/dist/web/assets/classDiagram-4FO5ZUOK-BkKX675E.js +0 -1
  98. package/dist/web/assets/classDiagram-v2-Q7XG4LA2-BkKX675E.js +0 -1
  99. package/dist/web/assets/index-C4wUDrio.css +0 -1
  100. package/dist/web/assets/stateDiagram-v2-BHNVJYJU-BXcVcTJl.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-Cask0_DN.js","assets/index-3VWij2vw.js","assets/index-C4wUDrio.css"])))=>i.map(i=>d[i]);
2
- import{ae as sn,af as Yn,ag as Uc,ah as qc,ai as Kc,aj as Fi,ak as Xc,al as Yc,k as at,am as Vc,an as Gc,r as C,ao as Qc,ap as Zc,aq as Jc,ar as ed,as as Vn,at as Gn,au as td,av as sd,aw as rd,g as Ue,ax as ce,w as ts,i as Tt,l as St,m as xe,q as oe,u as ue,j as t,a5 as gt,O as ga,P as id,h as ee,U as As,B as Me,ay as va,az as xa,aA as _a,ac as us,X as os,aB as rn,J as rr,aC as nd,aD as od,x as ad,aE as ld,aF as cd,aG as dd,T as ir,t as ht,K as Jt,M as dt,N as ks,a1 as Rr,aH as nr,$ as Ve,aI as ba,ad as ud,a9 as hd,aJ as nn,aa as fd,aK as ya,aL as on,aM as Sa,aN as wa,aO as Ca,aP as md,aQ as pd,Y as gd,aR as vd,aS as xd,aT as _d,Q as Qn,a4 as Zn}from"./index-3VWij2vw.js";import{S as rt,u as an,A as ln,j as bd,F as ka,Q as cn,k as yd,l as dn,W as Dt,m as Rt,o as Ea,C as Gs,i as Ft,b as Ar,T as Bt}from"./mermaid-NOHMQCX5-DjJdrIaK.js";import{C as un}from"./confirm-dialog-BRqwAzwk.js";import{c as ja,a as Na,b as Ra,I as Aa,d as Ma,A as Jn,G as Ta}from"./Icons-hnXjnfjL.js";import{C as yt}from"./chevron-down-o4IZE_P6.js";import{C as Mt}from"./chevron-right-DSyyoNau.js";import{d as hn,S as Sd,u as fn,A as Qs,b as mn,G as Da,Z as wd,e as Cd,T as pn,f as kd,a as La,P as Pa,g as Ed,C as eo,B as to,c as so}from"./CreateTaskInput-DQSvlvL0.js";import{a as jd,F as Nd,f as Rd,g as Ad,e as Md,u as Td}from"./folder-picker-ROPpPW7C.js";import{M as Kr}from"./message-square-B0uoScMB.js";import{L as Ms}from"./layers-CT4P8Wt_.js";import{P as gn,u as Oa,a as Ia,T as Mr}from"./useNormalizedLogs-CGOi3cNq.js";import{u as Ds}from"./use-providers-C-PIoFvi.js";import{A as Xr}from"./AgentLogo-Bqjt1u2k.js";import{M as zt}from"./MemberAvatar-DKsedKpu.js";import{C as Ba}from"./chevron-up-BsLA8Xot.js";import{C as Kt}from"./check-CjNklwnC.js";import{M as hs}from"./modal-CN741Elc.js";import{S as es}from"./select-B2NVUyiF.js";import{P as ss,T as vn}from"./trash-2-CWVsy23V.js";import{F as Fa}from"./folder-C-l50KQ-.js";import{U as Tr}from"./upload-C-wK_vWU.js";import{A as Zs}from"./arrow-left-DWeEJsaX.js";import{C as ro}from"./copy-r1RvUhIY.js";import"./circle-alert-FqsC_oWX.js";var Dd=class extends sn{constructor(e,s){super(e,s)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:Yn()})}getOptimisticResult(e){return e.behavior=Yn(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,s){const{state:r}=e,o=super.createResult(e,s),{isFetching:p,isRefetching:m,isError:v,isRefetchError:i}=o,n=r.fetchMeta?.fetchMore?.direction,l=v&&n==="forward",u=p&&n==="forward",c=v&&n==="backward",g=p&&n==="backward";return{...o,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:qc(s,r.data),hasPreviousPage:Uc(s,r.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:c,isFetchingPreviousPage:g,isRefetchError:i&&!l&&!c,isRefetching:m&&!u&&!g}}};function io(e,s){const r=new Set(s);return e.filter(o=>!r.has(o))}function Ld(e,s,r){const o=e.slice(0);return o[s]=r,o}var Pd=class extends Kc{#r;#e;#i;#n;#t;#s;#o;#a;#l;#c=[];constructor(e,s,r){super(),this.#r=e,this.#n=r,this.#i=[],this.#t=[],this.#e=[],this.setQueries(s)}onSubscribe(){this.listeners.size===1&&this.#t.forEach(e=>{e.subscribe(s=>{this.#f(e,s)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#t.forEach(e=>{e.destroy()})}setQueries(e,s){this.#i=e,this.#n=s,Fi.batch(()=>{const r=this.#t,o=this.#h(this.#i);o.forEach(u=>u.observer.setOptions(u.defaultedQueryOptions));const p=o.map(u=>u.observer),m=p.map(u=>u.getCurrentResult()),v=r.length!==p.length,i=p.some((u,c)=>u!==r[c]),n=v||i,l=n?!0:m.some((u,c)=>{const g=this.#e[c];return!g||!Xc(u,g)});!n&&!l||(n&&(this.#c=o,this.#t=p),this.#e=m,this.hasListeners()&&(n&&(io(r,p).forEach(u=>{u.destroy()}),io(p,r).forEach(u=>{u.subscribe(c=>{this.#f(u,c)})})),this.#m()))})}getCurrentResult(){return this.#e}getQueries(){return this.#t.map(e=>e.getCurrentQuery())}getObservers(){return this.#t}getOptimisticResult(e,s){const r=this.#h(e),o=r.map(m=>m.observer.getOptimisticResult(m.defaultedQueryOptions)),p=r.map(m=>m.defaultedQueryOptions.queryHash);return[o,m=>this.#u(m??o,s,p),()=>this.#d(o,r)]}#d(e,s){return s.map((r,o)=>{const p=e[o];return r.defaultedQueryOptions.notifyOnChangeProps?p:r.observer.trackResult(p,m=>{s.forEach(v=>{v.observer.trackProp(m)})})})}#u(e,s,r){if(s){const o=this.#l,p=r!==void 0&&o!==void 0&&(o.length!==r.length||r.some((m,v)=>m!==o[v]));return(!this.#s||this.#e!==this.#a||p||s!==this.#o)&&(this.#o=s,this.#a=this.#e,r!==void 0&&(this.#l=r),this.#s=Yc(this.#s,s(e))),this.#s}return e}#h(e){const s=new Map;this.#t.forEach(o=>{const p=o.options.queryHash;if(!p)return;const m=s.get(p);m?m.push(o):s.set(p,[o])});const r=[];return e.forEach(o=>{const p=this.#r.defaultQueryOptions(o),v=s.get(p.queryHash)?.shift()??new sn(this.#r,p);r.push({defaultedQueryOptions:p,observer:v})}),r}#f(e,s){const r=this.#t.indexOf(e);r!==-1&&(this.#e=Ld(this.#e,r,s),this.#m())}#m(){if(this.hasListeners()){const e=this.#s,s=this.#d(this.#e,this.#c),r=this.#u(s,this.#n?.combine);e!==r&&Fi.batch(()=>{this.listeners.forEach(o=>{o(this.#e)})})}}};function Od({queries:e,...s},r){const o=at(),p=Vc(),m=Gc(),v=C.useMemo(()=>e.map(_=>{const a=o.defaultQueryOptions(_);return a._optimisticResults=p?"isRestoring":"optimistic",a}),[e,o,p]);v.forEach(_=>{Qc(_);const a=o.getQueryCache().get(_.queryHash);Zc(_,m,a)}),Jc(m);const[i]=C.useState(()=>new Pd(o,v,s)),[n,l,u]=i.getOptimisticResult(v,s.combine),c=!p&&s.subscribed!==!1;C.useSyncExternalStore(C.useCallback(_=>c?i.subscribe(Fi.batchCalls(_)):ed,[i,c]),()=>i.getCurrentResult(),()=>i.getCurrentResult()),C.useEffect(()=>{i.setQueries(v,s)},[v,s,i]);const x=n.some((_,a)=>Vn(v[a],_))?n.flatMap((_,a)=>{const h=v[a];if(h){const d=new sn(o,h);if(Vn(h,_))return Gn(h,d,m);td(_,p)&&Gn(h,d,m)}return[]}):[];if(x.length>0)throw Promise.all(x);const y=n.find((_,a)=>{const h=v[a];return h&&sd({result:_,errorResetBoundary:m,throwOnError:h.throwOnError,query:o.getQueryCache().get(h.queryHash),suspense:h.suspense})});if(y?.error)throw y.error;return l(u())}function xn(e,s){return rd(e,Dd)}const Id=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Bd=Ue("arrow-right",Id);const Fd=[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],za=Ue("ban",Fd);const zd=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Wd=Ue("chevron-left",zd);const Hd=[["path",{d:"M12 6v6h4",key:"135r8i"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Es=Ue("clock-3",Hd);const $d=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],Yr=Ue("code-xml",$d);const Ud=[["line",{x1:"15",x2:"15",y1:"12",y2:"18",key:"1p7wdc"}],["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],no=Ue("copy-plus",Ud);const qd=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],Wa=Ue("ellipsis-vertical",qd);const Kd=[["path",{d:"M14 22h4a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v6",key:"14cnrg"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M5 14a1 1 0 0 0-1 1v2a1 1 0 0 1-1 1 1 1 0 0 1 1 1v2a1 1 0 0 0 1 1",key:"sr0ebq"}],["path",{d:"M9 22a1 1 0 0 0 1-1v-2a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-2a1 1 0 0 0-1-1",key:"w793db"}]],Xd=Ue("file-braces-corner",Kd);const Yd=[["path",{d:"M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35",key:"1wthlu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m5 16-3 3 3 3",key:"331omg"}],["path",{d:"m9 22 3-3-3-3",key:"lsp7cz"}]],Dr=Ue("file-code-corner",Yd);const Vd=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Gd=Ue("file-exclamation-point",Vd);const Qd=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],Vr=Ue("folder-open",Qd);const Zd=[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M5 9v6",key:"158jrl"}],["circle",{cx:"5",cy:"18",r:"3",key:"104gr9"}],["path",{d:"M12 3v18",key:"108xh3"}],["circle",{cx:"19",cy:"6",r:"3",key:"108a5v"}],["path",{d:"M16 15.7A9 9 0 0 0 19 9",key:"1e3vqb"}]],Ls=Ue("git-graph",Zd);const Jd=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],Ts=Ue("history",Jd);const eu=[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]],tu=Ue("lock-keyhole",eu);const su=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]],ru=Ue("maximize",su);const iu=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],nu=Ue("panel-left-close",iu);const ou=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]],au=Ue("panel-left-open",ou);const lu=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]],cu=Ue("panel-right-close",lu);const du=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]],zi=Ue("panel-right-open",du);const uu=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],hu=Ue("pen-line",uu);const fu=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],qt=Ue("play",fu);const mu=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],pu=Ue("save",mu);const gu=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],Ha=Ue("settings-2",gu);const vu=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],oo=Ue("smartphone",vu);const xu=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],_r=Ue("user-plus",xu);const _u=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],bu=Ue("zoom-in",_u);const yu=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],Su=Ue("zoom-out",yu),Gr=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ps(e){const s=Object.prototype.toString.call(e);return s==="[object Window]"||s==="[object global]"}function _n(e){return"nodeType"in e}function bt(e){var s,r;return e?Ps(e)?e:_n(e)&&(s=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?s:window:window}function bn(e){const{Document:s}=bt(e);return e instanceof s}function or(e){return Ps(e)?!1:e instanceof bt(e).HTMLElement}function $a(e){return e instanceof bt(e).SVGElement}function Os(e){return e?Ps(e)?e.document:_n(e)?bn(e)?e:or(e)||$a(e)?e.ownerDocument:document:document:document}const Xt=Gr?C.useLayoutEffect:C.useEffect;function Qr(e){const s=C.useRef(e);return Xt(()=>{s.current=e}),C.useCallback(function(){for(var r=arguments.length,o=new Array(r),p=0;p<r;p++)o[p]=arguments[p];return s.current==null?void 0:s.current(...o)},[])}function wu(){const e=C.useRef(null),s=C.useCallback((o,p)=>{e.current=setInterval(o,p)},[]),r=C.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[s,r]}function Js(e,s){s===void 0&&(s=[e]);const r=C.useRef(e);return Xt(()=>{r.current!==e&&(r.current=e)},s),r}function ar(e,s){const r=C.useRef();return C.useMemo(()=>{const o=e(r.current);return r.current=o,o},[...s])}function Lr(e){const s=Qr(e),r=C.useRef(null),o=C.useCallback(p=>{p!==r.current&&s?.(p,r.current),r.current=p},[]);return[r,o]}function Pr(e){const s=C.useRef();return C.useEffect(()=>{s.current=e},[e]),s.current}let xi={};function Zr(e,s){return C.useMemo(()=>{if(s)return s;const r=xi[e]==null?0:xi[e]+1;return xi[e]=r,e+"-"+r},[e,s])}function Ua(e){return function(s){for(var r=arguments.length,o=new Array(r>1?r-1:0),p=1;p<r;p++)o[p-1]=arguments[p];return o.reduce((m,v)=>{const i=Object.entries(v);for(const[n,l]of i){const u=m[n];u!=null&&(m[n]=u+e*l)}return m},{...s})}}const Rs=Ua(1),Or=Ua(-1);function Cu(e){return"clientX"in e&&"clientY"in e}function yn(e){if(!e)return!1;const{KeyboardEvent:s}=bt(e.target);return s&&e instanceof s}function ku(e){if(!e)return!1;const{TouchEvent:s}=bt(e.target);return s&&e instanceof s}function Ir(e){if(ku(e)){if(e.touches&&e.touches.length){const{clientX:s,clientY:r}=e.touches[0];return{x:s,y:r}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:s,clientY:r}=e.changedTouches[0];return{x:s,y:r}}}return Cu(e)?{x:e.clientX,y:e.clientY}:null}const er=Object.freeze({Translate:{toString(e){if(!e)return;const{x:s,y:r}=e;return"translate3d("+(s?Math.round(s):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:s,scaleY:r}=e;return"scaleX("+s+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[er.Translate.toString(e),er.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:s,duration:r,easing:o}=e;return s+" "+r+"ms "+o}}}),ao="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Eu(e){return e.matches(ao)?e:e.querySelector(ao)}const ju={display:"none"};function Nu(e){let{id:s,value:r}=e;return ce.createElement("div",{id:s,style:ju},r)}function Ru(e){let{id:s,announcement:r,ariaLiveType:o="assertive"}=e;const p={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return ce.createElement("div",{id:s,style:p,role:"status","aria-live":o,"aria-atomic":!0},r)}function Au(){const[e,s]=C.useState("");return{announce:C.useCallback(o=>{o!=null&&s(o)},[]),announcement:e}}const qa=C.createContext(null);function Mu(e){const s=C.useContext(qa);C.useEffect(()=>{if(!s)throw new Error("useDndMonitor must be used within a children of <DndContext>");return s(e)},[e,s])}function Tu(){const[e]=C.useState(()=>new Set),s=C.useCallback(o=>(e.add(o),()=>e.delete(o)),[e]);return[C.useCallback(o=>{let{type:p,event:m}=o;e.forEach(v=>{var i;return(i=v[p])==null?void 0:i.call(v,m)})},[e]),s]}const Du={draggable:`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CGMjRoF7.js","assets/index-7nw4fV42.js","assets/index-YCjjSSLC.css"])))=>i.map(i=>d[i]);
2
+ import{ae as sn,af as Yn,ag as Uc,ah as qc,ai as Kc,aj as Fi,ak as Xc,al as Yc,k as at,am as Vc,an as Gc,r as C,ao as Qc,ap as Zc,aq as Jc,ar as ed,as as Vn,at as Gn,au as td,av as sd,aw as rd,g as Ue,ax as ce,w as ts,i as Tt,l as St,m as xe,q as oe,u as ue,j as t,a5 as gt,O as ga,P as id,h as ee,U as As,B as Me,ay as va,az as xa,aA as _a,ac as us,X as os,aB as rn,J as rr,aC as nd,aD as od,x as ad,aE as ld,aF as cd,aG as dd,T as ir,t as ht,K as Jt,M as dt,N as ks,a1 as Rr,aH as nr,$ as Ve,aI as ba,ad as ud,a9 as hd,aJ as nn,aa as fd,aK as ya,aL as on,aM as Sa,aN as wa,aO as Ca,aP as md,aQ as pd,Y as gd,aR as vd,aS as xd,aT as _d,Q as Qn,a4 as Zn}from"./index-7nw4fV42.js";import{S as rt,u as an,A as ln,j as bd,F as ka,Q as cn,k as yd,l as dn,W as Dt,m as Rt,o as Ea,C as Gs,i as Ft,b as Ar,T as Bt}from"./mermaid-NOHMQCX5-B42ziicV.js";import{C as un}from"./confirm-dialog-BAqfLDT8.js";import{c as ja,a as Na,b as Ra,I as Aa,d as Ma,A as Jn,G as Ta}from"./Icons-DIZBOtuC.js";import{C as yt}from"./chevron-down--B7iZqBL.js";import{C as Mt}from"./chevron-right-7PShDIwg.js";import{d as hn,S as Sd,u as fn,A as Qs,b as mn,G as Da,Z as wd,e as Cd,T as pn,f as kd,a as La,P as Pa,g as Ed,C as eo,B as to,c as so}from"./CreateTaskInput-Cb3aRHr3.js";import{a as jd,F as Nd,f as Rd,g as Ad,e as Md,u as Td}from"./folder-picker-DFB9_pv4.js";import{M as Kr}from"./message-square-Bd_m34OX.js";import{L as Ms}from"./layers-BbLzQqyy.js";import{P as gn,u as Oa,a as Ia,T as Mr}from"./useNormalizedLogs-CXAn7xj_.js";import{u as Ds}from"./use-providers-erJ2iHLz.js";import{A as Xr}from"./AgentLogo-ThhvSi7G.js";import{M as zt}from"./MemberAvatar-Y_pJlw-N.js";import{C as Ba}from"./chevron-up-3n_vHdrD.js";import{C as Kt}from"./check-D2WWIhwV.js";import{M as hs}from"./modal-CxOKWOjZ.js";import{S as es}from"./select-DFuN9DX8.js";import{P as ss,T as vn}from"./trash-2-B7GFt5Wl.js";import{F as Fa}from"./folder-u7fKAtz_.js";import{U as Tr}from"./upload-L8hpDFoO.js";import{A as Zs}from"./arrow-left-y1LwO7sB.js";import{C as ro}from"./copy-bJ2sut_L.js";import"./circle-alert-W13JkYj3.js";var Dd=class extends sn{constructor(e,s){super(e,s)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:Yn()})}getOptimisticResult(e){return e.behavior=Yn(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,s){const{state:r}=e,o=super.createResult(e,s),{isFetching:p,isRefetching:m,isError:v,isRefetchError:i}=o,n=r.fetchMeta?.fetchMore?.direction,l=v&&n==="forward",u=p&&n==="forward",c=v&&n==="backward",g=p&&n==="backward";return{...o,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:qc(s,r.data),hasPreviousPage:Uc(s,r.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:c,isFetchingPreviousPage:g,isRefetchError:i&&!l&&!c,isRefetching:m&&!u&&!g}}};function io(e,s){const r=new Set(s);return e.filter(o=>!r.has(o))}function Ld(e,s,r){const o=e.slice(0);return o[s]=r,o}var Pd=class extends Kc{#r;#e;#i;#n;#t;#s;#o;#a;#l;#c=[];constructor(e,s,r){super(),this.#r=e,this.#n=r,this.#i=[],this.#t=[],this.#e=[],this.setQueries(s)}onSubscribe(){this.listeners.size===1&&this.#t.forEach(e=>{e.subscribe(s=>{this.#f(e,s)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#t.forEach(e=>{e.destroy()})}setQueries(e,s){this.#i=e,this.#n=s,Fi.batch(()=>{const r=this.#t,o=this.#h(this.#i);o.forEach(u=>u.observer.setOptions(u.defaultedQueryOptions));const p=o.map(u=>u.observer),m=p.map(u=>u.getCurrentResult()),v=r.length!==p.length,i=p.some((u,c)=>u!==r[c]),n=v||i,l=n?!0:m.some((u,c)=>{const g=this.#e[c];return!g||!Xc(u,g)});!n&&!l||(n&&(this.#c=o,this.#t=p),this.#e=m,this.hasListeners()&&(n&&(io(r,p).forEach(u=>{u.destroy()}),io(p,r).forEach(u=>{u.subscribe(c=>{this.#f(u,c)})})),this.#m()))})}getCurrentResult(){return this.#e}getQueries(){return this.#t.map(e=>e.getCurrentQuery())}getObservers(){return this.#t}getOptimisticResult(e,s){const r=this.#h(e),o=r.map(m=>m.observer.getOptimisticResult(m.defaultedQueryOptions)),p=r.map(m=>m.defaultedQueryOptions.queryHash);return[o,m=>this.#u(m??o,s,p),()=>this.#d(o,r)]}#d(e,s){return s.map((r,o)=>{const p=e[o];return r.defaultedQueryOptions.notifyOnChangeProps?p:r.observer.trackResult(p,m=>{s.forEach(v=>{v.observer.trackProp(m)})})})}#u(e,s,r){if(s){const o=this.#l,p=r!==void 0&&o!==void 0&&(o.length!==r.length||r.some((m,v)=>m!==o[v]));return(!this.#s||this.#e!==this.#a||p||s!==this.#o)&&(this.#o=s,this.#a=this.#e,r!==void 0&&(this.#l=r),this.#s=Yc(this.#s,s(e))),this.#s}return e}#h(e){const s=new Map;this.#t.forEach(o=>{const p=o.options.queryHash;if(!p)return;const m=s.get(p);m?m.push(o):s.set(p,[o])});const r=[];return e.forEach(o=>{const p=this.#r.defaultQueryOptions(o),v=s.get(p.queryHash)?.shift()??new sn(this.#r,p);r.push({defaultedQueryOptions:p,observer:v})}),r}#f(e,s){const r=this.#t.indexOf(e);r!==-1&&(this.#e=Ld(this.#e,r,s),this.#m())}#m(){if(this.hasListeners()){const e=this.#s,s=this.#d(this.#e,this.#c),r=this.#u(s,this.#n?.combine);e!==r&&Fi.batch(()=>{this.listeners.forEach(o=>{o(this.#e)})})}}};function Od({queries:e,...s},r){const o=at(),p=Vc(),m=Gc(),v=C.useMemo(()=>e.map(_=>{const a=o.defaultQueryOptions(_);return a._optimisticResults=p?"isRestoring":"optimistic",a}),[e,o,p]);v.forEach(_=>{Qc(_);const a=o.getQueryCache().get(_.queryHash);Zc(_,m,a)}),Jc(m);const[i]=C.useState(()=>new Pd(o,v,s)),[n,l,u]=i.getOptimisticResult(v,s.combine),c=!p&&s.subscribed!==!1;C.useSyncExternalStore(C.useCallback(_=>c?i.subscribe(Fi.batchCalls(_)):ed,[i,c]),()=>i.getCurrentResult(),()=>i.getCurrentResult()),C.useEffect(()=>{i.setQueries(v,s)},[v,s,i]);const x=n.some((_,a)=>Vn(v[a],_))?n.flatMap((_,a)=>{const h=v[a];if(h){const d=new sn(o,h);if(Vn(h,_))return Gn(h,d,m);td(_,p)&&Gn(h,d,m)}return[]}):[];if(x.length>0)throw Promise.all(x);const y=n.find((_,a)=>{const h=v[a];return h&&sd({result:_,errorResetBoundary:m,throwOnError:h.throwOnError,query:o.getQueryCache().get(h.queryHash),suspense:h.suspense})});if(y?.error)throw y.error;return l(u())}function xn(e,s){return rd(e,Dd)}const Id=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Bd=Ue("arrow-right",Id);const Fd=[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],za=Ue("ban",Fd);const zd=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Wd=Ue("chevron-left",zd);const Hd=[["path",{d:"M12 6v6h4",key:"135r8i"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Es=Ue("clock-3",Hd);const $d=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],Yr=Ue("code-xml",$d);const Ud=[["line",{x1:"15",x2:"15",y1:"12",y2:"18",key:"1p7wdc"}],["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],no=Ue("copy-plus",Ud);const qd=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],Wa=Ue("ellipsis-vertical",qd);const Kd=[["path",{d:"M14 22h4a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v6",key:"14cnrg"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M5 14a1 1 0 0 0-1 1v2a1 1 0 0 1-1 1 1 1 0 0 1 1 1v2a1 1 0 0 0 1 1",key:"sr0ebq"}],["path",{d:"M9 22a1 1 0 0 0 1-1v-2a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-2a1 1 0 0 0-1-1",key:"w793db"}]],Xd=Ue("file-braces-corner",Kd);const Yd=[["path",{d:"M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35",key:"1wthlu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m5 16-3 3 3 3",key:"331omg"}],["path",{d:"m9 22 3-3-3-3",key:"lsp7cz"}]],Dr=Ue("file-code-corner",Yd);const Vd=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Gd=Ue("file-exclamation-point",Vd);const Qd=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],Vr=Ue("folder-open",Qd);const Zd=[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M5 9v6",key:"158jrl"}],["circle",{cx:"5",cy:"18",r:"3",key:"104gr9"}],["path",{d:"M12 3v18",key:"108xh3"}],["circle",{cx:"19",cy:"6",r:"3",key:"108a5v"}],["path",{d:"M16 15.7A9 9 0 0 0 19 9",key:"1e3vqb"}]],Ls=Ue("git-graph",Zd);const Jd=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],Ts=Ue("history",Jd);const eu=[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]],tu=Ue("lock-keyhole",eu);const su=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]],ru=Ue("maximize",su);const iu=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],nu=Ue("panel-left-close",iu);const ou=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]],au=Ue("panel-left-open",ou);const lu=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]],cu=Ue("panel-right-close",lu);const du=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]],zi=Ue("panel-right-open",du);const uu=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],hu=Ue("pen-line",uu);const fu=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],qt=Ue("play",fu);const mu=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],pu=Ue("save",mu);const gu=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],Ha=Ue("settings-2",gu);const vu=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],oo=Ue("smartphone",vu);const xu=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],_r=Ue("user-plus",xu);const _u=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],bu=Ue("zoom-in",_u);const yu=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],Su=Ue("zoom-out",yu),Gr=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ps(e){const s=Object.prototype.toString.call(e);return s==="[object Window]"||s==="[object global]"}function _n(e){return"nodeType"in e}function bt(e){var s,r;return e?Ps(e)?e:_n(e)&&(s=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?s:window:window}function bn(e){const{Document:s}=bt(e);return e instanceof s}function or(e){return Ps(e)?!1:e instanceof bt(e).HTMLElement}function $a(e){return e instanceof bt(e).SVGElement}function Os(e){return e?Ps(e)?e.document:_n(e)?bn(e)?e:or(e)||$a(e)?e.ownerDocument:document:document:document}const Xt=Gr?C.useLayoutEffect:C.useEffect;function Qr(e){const s=C.useRef(e);return Xt(()=>{s.current=e}),C.useCallback(function(){for(var r=arguments.length,o=new Array(r),p=0;p<r;p++)o[p]=arguments[p];return s.current==null?void 0:s.current(...o)},[])}function wu(){const e=C.useRef(null),s=C.useCallback((o,p)=>{e.current=setInterval(o,p)},[]),r=C.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[s,r]}function Js(e,s){s===void 0&&(s=[e]);const r=C.useRef(e);return Xt(()=>{r.current!==e&&(r.current=e)},s),r}function ar(e,s){const r=C.useRef();return C.useMemo(()=>{const o=e(r.current);return r.current=o,o},[...s])}function Lr(e){const s=Qr(e),r=C.useRef(null),o=C.useCallback(p=>{p!==r.current&&s?.(p,r.current),r.current=p},[]);return[r,o]}function Pr(e){const s=C.useRef();return C.useEffect(()=>{s.current=e},[e]),s.current}let xi={};function Zr(e,s){return C.useMemo(()=>{if(s)return s;const r=xi[e]==null?0:xi[e]+1;return xi[e]=r,e+"-"+r},[e,s])}function Ua(e){return function(s){for(var r=arguments.length,o=new Array(r>1?r-1:0),p=1;p<r;p++)o[p-1]=arguments[p];return o.reduce((m,v)=>{const i=Object.entries(v);for(const[n,l]of i){const u=m[n];u!=null&&(m[n]=u+e*l)}return m},{...s})}}const Rs=Ua(1),Or=Ua(-1);function Cu(e){return"clientX"in e&&"clientY"in e}function yn(e){if(!e)return!1;const{KeyboardEvent:s}=bt(e.target);return s&&e instanceof s}function ku(e){if(!e)return!1;const{TouchEvent:s}=bt(e.target);return s&&e instanceof s}function Ir(e){if(ku(e)){if(e.touches&&e.touches.length){const{clientX:s,clientY:r}=e.touches[0];return{x:s,y:r}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:s,clientY:r}=e.changedTouches[0];return{x:s,y:r}}}return Cu(e)?{x:e.clientX,y:e.clientY}:null}const er=Object.freeze({Translate:{toString(e){if(!e)return;const{x:s,y:r}=e;return"translate3d("+(s?Math.round(s):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:s,scaleY:r}=e;return"scaleX("+s+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[er.Translate.toString(e),er.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:s,duration:r,easing:o}=e;return s+" "+r+"ms "+o}}}),ao="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Eu(e){return e.matches(ao)?e:e.querySelector(ao)}const ju={display:"none"};function Nu(e){let{id:s,value:r}=e;return ce.createElement("div",{id:s,style:ju},r)}function Ru(e){let{id:s,announcement:r,ariaLiveType:o="assertive"}=e;const p={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return ce.createElement("div",{id:s,style:p,role:"status","aria-live":o,"aria-atomic":!0},r)}function Au(){const[e,s]=C.useState("");return{announce:C.useCallback(o=>{o!=null&&s(o)},[]),announcement:e}}const qa=C.createContext(null);function Mu(e){const s=C.useContext(qa);C.useEffect(()=>{if(!s)throw new Error("useDndMonitor must be used within a children of <DndContext>");return s(e)},[e,s])}function Tu(){const[e]=C.useState(()=>new Set),s=C.useCallback(o=>(e.add(o),()=>e.delete(o)),[e]);return[C.useCallback(o=>{let{type:p,event:m}=o;e.forEach(v=>{var i;return(i=v[p])==null?void 0:i.call(v,m)})},[e]),s]}const Du={draggable:`
3
3
  To pick up a draggable item, press the space bar.
4
4
  While dragging, use the arrow keys to move the item.
5
5
  Press space again to drop the item in its new position, or press escape to cancel.
@@ -10,7 +10,7 @@ import{ae as sn,af as Yn,ag as Uc,ah as qc,ai as Kc,aj as Fi,ak as Xc,al as Yc,k
10
10
  ${w&&!d?"bg-info/10 ring-1 ring-info/30":""}
11
11
  ${h&&l?"border border-dashed border-border mx-2":""}`,children:h?t.jsx("span",{className:"text-xs text-muted-foreground/50 py-2 px-4",children:y("No tasks")}):r.map(E=>{const R=m===E.id,L=n?.has(E.id)??!1,T=E.projectId?i.find(M=>M.id===E.projectId):void 0;return t.jsx(uf,{task:E,status:o,isSelected:R,isAgentActive:L,project:T,onSelectTask:v,onTaskStatusChange:E.projectArchivedAt?void 0:c,onDeleteTask:E.projectArchivedAt?void 0:g,disableDrag:x},E.id)})})]})}),ff=12,mf=50;function pf({isOpen:e,onClose:s,tasks:r,projects:o,onSelectTask:p}){const{t:m}=ue(),[v,i]=C.useState(""),[n,l]=C.useState(0),u=C.useRef(null);C.useEffect(()=>{e&&(i(""),l(0))},[e]);const c=C.useMemo(()=>{const y=v.trim().toLowerCase();return y?r.filter(_=>_.title.toLowerCase().includes(y)).slice(0,mf):r.slice(0,ff)},[r,v]);C.useEffect(()=>{l(0)},[v]),C.useEffect(()=>{u.current?.children[n]?.scrollIntoView({block:"nearest"})},[n]);const g=C.useCallback(y=>{p(y),s()},[p,s]),x=C.useCallback(y=>{if(y.key==="Escape")y.preventDefault(),s();else if(y.key==="ArrowDown")y.preventDefault(),l(_=>Math.min(_+1,c.length-1));else if(y.key==="ArrowUp")y.preventDefault(),l(_=>Math.max(_-1,0));else if(y.key==="Enter"&&!y.nativeEvent.isComposing){y.preventDefault();const _=c[n];_&&g(_.id)}},[s,c,n,g]);return e?t.jsxs("div",{className:"fixed inset-0 z-90",role:"dialog","aria-modal":"true",children:[t.jsx("div",{className:"absolute inset-0 bg-black/20",onClick:s}),t.jsxs("div",{className:"absolute left-1/2 top-[18vh] w-[min(560px,calc(100vw-2rem))] -translate-x-1/2 bg-popover rounded-xl border border-border shadow-lg overflow-hidden animate-in fade-in zoom-in-95 duration-100",children:[t.jsxs("div",{className:"flex items-center gap-2.5 px-4 border-b border-border/60",children:[t.jsx(hn,{size:15,className:"text-muted-foreground/70 shrink-0"}),t.jsx("input",{value:v,onChange:y=>i(y.target.value),onKeyDown:x,placeholder:m("Search tasks..."),"aria-label":m("Search tasks..."),autoFocus:!0,className:"flex-1 py-3 bg-transparent border-none focus:outline-none text-sm text-foreground placeholder-muted-foreground/60"})]}),c.length>0?t.jsxs(t.Fragment,{children:[!v.trim()&&t.jsx("div",{className:"px-4 pt-2.5 pb-1 text-[11px] font-medium text-muted-foreground/70",children:m("Recent tasks")}),t.jsx("div",{ref:u,className:"max-h-[46vh] overflow-y-auto scrollbar-app-thin pb-1.5 pt-0.5",children:c.map((y,_)=>{const a=o.find(f=>f.id===y.projectId),{icon:h,iconClass:d}=Ui[y.status];return t.jsxs("button",{onClick:()=>g(y.id),onMouseEnter:()=>l(_),className:`w-full flex items-center gap-2.5 px-4 py-2 text-left transition-colors
12
12
  ${_===n?"bg-accent":""}`,children:[t.jsx(h,{className:`${d} shrink-0`}),t.jsx("span",{className:"flex-1 min-w-0 truncate text-sm text-foreground/90",title:y.title,children:y.title}),a&&t.jsx("span",{className:"shrink-0 max-w-[120px] truncate text-xs text-muted-foreground/70",children:a.name})]},y.id)})})]}):t.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground/70",children:m("No matching tasks")})]})]}):null}const gf=260,vf=220;function xf(e){const s={[ve.Review]:[],[ve.Running]:[],[ve.Pending]:[],[ve.Done]:[],[ve.Cancelled]:[]};for(const r of e)s[r.status].push(r);return s}const _f=[{status:ve.Review,title:"Review",defaultOpen:!0},{status:ve.Running,title:"Running",defaultOpen:!0},{status:ve.Pending,title:"Pending",defaultOpen:!1},{status:ve.Done,title:"Done",defaultOpen:!1},{status:ve.Cancelled,title:"Cancelled",defaultOpen:!1}];function bo({tasks:e=[],projects:s=[],selectedTaskId:r,onSelectTask:o,filterProjectId:p,setFilterProjectId:m,width:v=320,onCreateTask:i,onCreateProject:n,isCreateActive:l,activeTaskIds:u,onTaskStatusChange:c,onDeleteTask:g}){const{t:x}=ue(),{preserveDesktopSearch:y}=ga(),_=cl(),[a,h]=C.useState(null),[d,f]=C.useState(null),[b,w]=C.useState(!1),k=C.useRef(new Map),j=C.useRef(new Set),S=C.useRef(new Map),E=C.useMemo(()=>({registry:k.current}),[]),R=C.useCallback(I=>{I.remove(),j.current.delete(I)},[]),L=p?e.filter(I=>I.projectId===p):e,T=C.useCallback((I,$)=>{const Y=document.querySelector(`[data-task-group-status="${I}"]`);if(!Y)return null;const X=(Y.querySelector("button")??Y).getBoundingClientRect();return X.width===0||X.height===0?null:new DOMRect(X.left+8,X.bottom+4,$.width,$.height)},[]),M=C.useCallback((I,$,Y,U=!1)=>{const X=document.createElement("div");X.setAttribute("aria-hidden","true"),X.innerHTML=Y;const z=X.firstElementChild;z&&(z.style.cssText="",z.className=z.className.replace(/\bopacity-\S*/g,"").replace(/\banimate-task-enter\b/g,""),z.style.pointerEvents="none",z.style.width=`${I.width}px`,z.style.height=`${I.height}px`,z.style.margin="0",z.style.backgroundColor="var(--sidebar-accent)",z.style.borderRadius="0.375rem",z.style.boxShadow="0 6px 16px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.08)",z.style.opacity="0.96",z.style.transition="none",z.setAttribute("tabindex","-1")),Object.assign(X.style,{position:"fixed",left:`${I.left}px`,top:`${I.top}px`,width:`${I.width}px`,height:`${I.height}px`,zIndex:"9999",pointerEvents:"none",overflow:"visible",transformOrigin:"top left",willChange:"transform, opacity"}),document.body.appendChild(X),j.current.add(X);const N=$.left-I.left,W=$.top-I.top;X.animate([{transform:"translate(0, 0)",opacity:.96,offset:0},{transform:`translate(${N}px, ${W}px)`,opacity:U?.12:.96,offset:1}],{duration:U?vf:gf,easing:"cubic-bezier(0.2, 0, 0, 1)",fill:"forwards"}).finished.then(()=>R(X),()=>R(X))},[R]);C.useLayoutEffect(()=>{const I=window.matchMedia("(prefers-reduced-motion: reduce)").matches,$=new Map;for(const Y of L){const U=k.current.get(Y.id);if(!U)continue;const X={status:Y.status,rect:U.getBoundingClientRect(),html:U.outerHTML};if($.set(Y.id,X),I)continue;const z=S.current.get(Y.id);if(!z||z.status===Y.status)continue;const N=X.rect.left-z.rect.left,W=X.rect.top-z.rect.top;Math.abs(N)<1&&Math.abs(W)<1||M(z.rect,X.rect,z.html)}if(!I)for(const[Y,U]of S.current){if($.has(Y))continue;const X=L.find(N=>N.id===Y);if(!X||X.status===U.status)continue;const z=T(X.status,U.rect);z&&M(U.rect,z,U.html,!0)}S.current=$},[L,M,T]),C.useEffect(()=>()=>{for(const I of j.current)I.remove();j.current.clear()},[]);const B=Iu(Ou(kn,{activationConstraint:{distance:8}})),D=C.useCallback(I=>{const $=I.active.data.current?.task,Y=I.active.data.current?.fromStatus;$&&h($),Y&&f(Y)},[]),F=C.useCallback(I=>{h(null),f(null);const{active:$,over:Y}=I;if(!Y)return;const U=$.data.current?.task,X=$.data.current?.fromStatus,z=Y.data.current?.status;!U||!X||!z||U.projectArchivedAt||X!==z&&c?.(U.id,z)},[c]),O=!!!(p?s.find(I=>I.id===p)??null:null)?.archivedAt,P=xf(L);return t.jsxs("div",{className:"h-full flex flex-col flex-shrink-0",style:{width:v},children:[t.jsxs("div",{className:"px-2 pt-2 pb-1 flex-shrink-0",children:[n&&t.jsxs("button",{onClick:n,className:"w-full flex items-center gap-2.5 px-2 py-2 rounded-md text-sm text-foreground/80 hover:bg-accent/50 transition-colors",title:x("New Project"),children:[t.jsx(jd,{size:16,className:"text-muted-foreground"}),t.jsx("span",{children:x("New Project")})]}),t.jsxs("button",{onClick:i,disabled:!O,className:`w-full flex items-center gap-2.5 px-2 py-2 rounded-md text-sm transition-colors disabled:opacity-30 disabled:cursor-not-allowed
13
- ${l?"bg-accent text-foreground":"text-foreground/80 hover:bg-accent/50"}`,title:x(O?"New Task":"Deleted projects are read-only"),children:[t.jsx(Sd,{size:16,className:"text-muted-foreground"}),t.jsx("span",{children:x("New Task")})]}),t.jsxs("button",{onClick:()=>w(!0),className:"w-full flex items-center gap-2.5 px-2 py-2 rounded-md text-sm text-foreground/80 hover:bg-accent/50 transition-colors",title:x("Search"),children:[t.jsx(hn,{size:16,className:"text-muted-foreground"}),t.jsx("span",{children:x("Search")})]}),t.jsxs(id,{to:y("/conversations"),className:"w-full flex items-center gap-2.5 px-2 py-2 rounded-md text-sm text-foreground/80 hover:bg-accent/50 transition-colors",title:x("对话"),children:[t.jsx(Kr,{size:16,className:"text-muted-foreground"}),t.jsx("span",{children:x("对话")})]})]}),L.length===0?t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center px-6 text-center select-none",children:[t.jsx(Ms,{size:36,className:"text-muted-foreground/40 mb-3",strokeWidth:1.5}),t.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:x("No tasks")}),O&&i?t.jsx("button",{onClick:i,className:"px-3.5 py-1.5 rounded-md bg-brand text-brand-foreground text-xs font-medium hover:bg-brand/90 transition-colors",children:x("New Task")}):null]}):t.jsx(fl.Provider,{value:E,children:t.jsxs(Lh,{sensors:B,onDragStart:D,onDragEnd:F,children:[t.jsx("div",{className:"flex-1 overflow-y-auto scrollbar-app-thin pt-3 pb-4 relative",children:_f.map(({status:I,title:$,defaultOpen:Y})=>t.jsx(hf,{title:$,tasks:P[I],status:I,defaultOpen:Y,selectedTaskId:r,onSelectTask:o,projects:s,activeTaskIds:u,isDragging:a!==null,dragFromStatus:d,onTaskStatusChange:c,onDeleteTask:g,disableDrag:_},I))}),t.jsx(ef,{dropAnimation:null,children:a?t.jsx("div",{className:"bg-popover shadow-lg rounded-md border border-border px-4 py-2 text-sm max-w-[280px] opacity-90",children:t.jsx("span",{className:"block truncate font-medium text-foreground/80",title:a.title,children:a.title})}):null})]})}),L.length>0?t.jsxs("div",{className:"px-4 py-3 border-t border-border/60 text-xs text-muted-foreground/70 flex items-center justify-between",children:[t.jsx("span",{children:x("{count} tasks",{count:L.length})}),p?t.jsx("button",{onClick:()=>m(null),className:"hover:text-foreground underline decoration-border underline-offset-2",children:x("Clear filter")}):null]}):t.jsx("div",{className:"px-4 py-3 border-t border-border/60 text-xs text-muted-foreground/70 flex items-center justify-between",children:t.jsx("span",{children:x("{count} tasks",{count:0})})}),t.jsx(pf,{isOpen:b,onClose:()=>w(!1),tasks:L,projects:s,onSelectTask:o})]})}const bf=10,yf=24,ml=bf*yf,Sf=8;function wf(e,s=ml){return e>s+Sf}function Cf(e,s){return e.includes(s)?e:[...e,s]}function kf(e,s){return e.filter(r=>r!==s)}function Ef(e,s){const r=new Map(s.map(o=>[o.id,o]));return e.map(o=>r.get(o)).filter(o=>!!o).map(o=>({memberId:o.id,label:o.name}))}const ti=new Set(["RUNNING","WAITING_ROOM_REPLY","QUEUED","SESSION_ENDED"]);function yo(e){if(!e)return 0;const s=Date.parse(e);return Number.isNaN(s)?0:s}function jf(e,s=[],r=[]){const o=new Set(r.filter(m=>ti.has(m.status)).map(m=>m.workRequestId));return[...e.map(m=>({kind:"message",key:`message:${m.id}`,sortTime:m.createdAt,order:0,message:m})),...s.filter(m=>m.status==="PENDING_APPROVAL").filter(m=>!o.has(m.id)).map(m=>({kind:"pendingApproval",key:`pending-approval:${m.id}`,sortTime:m.updatedAt??m.createdAt,order:1,request:m}))].sort((m,v)=>{const i=yo(m.sortTime)-yo(v.sortTime);return i!==0?i:m.order!==v.order?m.order-v.order:m.key.localeCompare(v.key)})}function Nf(e){switch(e){case"RUNNING":return"Working";case"QUEUED":return"Queued...";case"WAITING_ROOM_REPLY":return"Waiting reply...";case"SESSION_ENDED":return"Session ended";default:return e}}function Rf(e){switch(e){case"FAILED":return"text-red-500";case"RUNNING":case"WAITING_ROOM_REPLY":case"QUEUED":case"SESSION_ENDED":return"text-neutral-500";default:return"text-neutral-500"}}function Af(e,s){const r=e.reduce((p,m)=>(p[m.status]=(p[m.status]??0)+1,p),{});return[["RUNNING","running"],["QUEUED","queued"],["WAITING_ROOM_REPLY","waiting"],["SESSION_ENDED","ended"]].map(([p,m])=>{const v=r[p];return v?`${v} ${s(m)}`:null}).filter(p=>!!p).join(" · ")}function Mf(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(min-width: 768px)").matches}function Tf({status:e}){const{t:s}=ue();return e==="RUNNING"?t.jsxs(t.Fragment,{children:[s("Working"),t.jsxs("span",{className:"active-work-dots","aria-hidden":"true",children:[t.jsx("span",{children:"."}),t.jsx("span",{className:"active-work-dots__second",children:"."}),t.jsx("span",{className:"active-work-dots__third",children:"."})]})]}):t.jsx(t.Fragment,{children:s(Nf(e))})}function Df({invocations:e,memberById:s,workRequestById:r,onViewInvocationSession:o,onStopMember:p,isStopPending:m,stoppingMemberId:v,stopPromptInvocationId:i,onToggleStopConfirm:n}){const{t:l}=ue(),[u,c]=C.useState(Mf),g=C.useMemo(()=>e.filter(y=>ti.has(y.status)).sort((y,_)=>Date.parse(_.updatedAt??_.createdAt??"")-Date.parse(y.updatedAt??y.createdAt??"")),[e]);if(g.length===0)return null;const x=Af(g,l);return t.jsxs("div",{className:"border-t border-neutral-200 bg-neutral-50/80",children:[t.jsxs("button",{type:"button",onClick:()=>c(y=>!y),"aria-expanded":u,className:"flex h-8 w-full items-center justify-between gap-3 px-3 text-left text-xs text-neutral-600 transition-colors hover:bg-neutral-100",children:[t.jsxs("span",{className:"min-w-0 truncate",children:[t.jsx("span",{className:"font-medium text-neutral-800",children:l("Active work")}),t.jsx("span",{className:"mx-1.5 text-neutral-300",children:"·"}),t.jsx("span",{children:x})]}),u?t.jsx(yt,{size:15,className:"shrink-0 text-neutral-400"}):t.jsx(Ba,{size:15,className:"shrink-0 text-neutral-400"})]}),u&&t.jsx("div",{className:"max-h-32 overflow-y-auto border-t border-neutral-200",children:g.map(y=>{const _=s.get(y.memberId),a=r.get(y.workRequestId),h=!!(y.sessionId&&o),d=!!_,f=i===y.id,b=m&&v===y.memberId,w=a?.instruction??y.workRequestId;return t.jsxs("div",{className:"border-t border-neutral-100 first:border-t-0",children:[t.jsxs("div",{title:w,className:ee("group flex h-8 items-center gap-2 px-3 text-xs text-neutral-700",h?"cursor-pointer hover:bg-white":"cursor-default"),role:h?"button":void 0,tabIndex:h?0:void 0,onClick:()=>y.sessionId&&o?.(y.sessionId),onKeyDown:k=>{!h||!y.sessionId||(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),o?.(y.sessionId))},children:[t.jsx(zt,{name:_?.name??l("Agent"),avatar:_?.avatar??null,className:"h-4 w-4 text-[8px]"}),t.jsxs("div",{className:"flex min-w-0 flex-1 items-baseline gap-1.5",children:[t.jsx("span",{className:"truncate font-medium text-neutral-800",children:_?.name??l("Agent")}),t.jsx("span",{className:ee("shrink-0",Rf(y.status)),children:t.jsx(Tf,{status:y.status})})]}),h&&t.jsx("button",{type:"button",onClick:k=>{k.stopPropagation(),y.sessionId&&o?.(y.sessionId)},onKeyDown:k=>k.stopPropagation(),className:"hidden shrink-0 rounded-md p-1 text-neutral-400 transition-colors hover:bg-neutral-100 hover:text-neutral-700 group-hover:inline-flex",title:l("View log"),"aria-label":`${l("View log")} ${_?.name??l("Agent")}`,children:t.jsx(zi,{size:13})}),d&&t.jsx("button",{type:"button",onClick:k=>{k.stopPropagation(),n(y.id)},onKeyDown:k=>k.stopPropagation(),disabled:b,className:"shrink-0 rounded-md p-1 text-neutral-400 transition-colors hover:bg-red-50 hover:text-red-700 disabled:cursor-not-allowed disabled:opacity-50",title:l("Stop"),"aria-label":`${l("Stop")} ${_?.name??l("Agent")}`,children:t.jsx(As,{size:12})})]}),d&&f&&_&&t.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 border-t border-neutral-100 bg-white px-3 py-2",children:[t.jsx("span",{className:"mr-1 text-[11px] text-neutral-600",children:l("Stop running work?")}),t.jsxs(Me,{type:"button",size:"xs",variant:"outline",disabled:b,onClick:()=>p(_.id,!1),children:[t.jsx(As,{size:11}),t.jsx("span",{children:l(b?"Stopping":"Stop only")})]}),t.jsxs(Me,{type:"button",size:"xs",variant:"outline",disabled:b,className:"border-red-200 bg-red-50 text-red-700 hover:bg-red-100 hover:text-red-800",onClick:()=>p(_.id,!0),children:[t.jsx(za,{size:11}),t.jsx("span",{children:l(b?"Stopping":"Stop + clear queue")})]})]})]},y.id)})})]})}const zr=rr(),Lf=240,Pf=/(^|\n)(```|~~~)[^\S\r\n]*mermaid(?:[\s\r\n]|$)/i;let qi=null;function Of(e){return Pf.test(e)}function If(){return qi??=od(async()=>{const{mermaid:e}=await import("./index-Cask0_DN.js").then(s=>s.bm);return{mermaid:e}},__vite__mapDeps([0,1,2])).then(({mermaid:e})=>({mermaid:e})),qi}function Bf(e){const s=Of(e),[r,o]=C.useState();return C.useEffect(()=>{if(!s){o(void 0);return}let p=!0;return If().then(m=>{p&&o(m)}).catch(()=>{qi=null,p&&o(void 0)}),()=>{p=!1}},[s]),s?r:void 0}let So=0;function Ff(e,s){return So+=1,{id:`pending-room-message-${Date.now()}-${So}`,teamRunId:e,senderType:s.senderType??"user",senderId:s.senderId??null,senderInvocationId:s.senderInvocationId??null,kind:s.kind??((s.mentions?.length??0)>0?"work_request":"chat"),visibility:"PUBLIC",content:s.content,mentions:s.mentions??[],workRequestIds:[],artifactRefs:s.artifactRefs??[],attachmentIds:s.attachmentIds??[],createdAt:new Date().toISOString(),pendingStatus:"sending"}}function pl(e){return"pendingStatus"in e}const zf=e=>e.includes("://")||e.startsWith("/api/")?e:e.startsWith("/")?`${zr}/attachments/by-path?path=${encodeURIComponent(e)}`:e;function Wf(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(1)}MB`}function Hf(e){return`${e.mimeType.startsWith("image/")?"!":""}[${e.originalName}](${e.storagePath})`}function Ki(e,s){if(s.length===0)return e;const r=new Set(s.map(Hf));return e.split(`
13
+ ${l?"bg-accent text-foreground":"text-foreground/80 hover:bg-accent/50"}`,title:x(O?"New Task":"Deleted projects are read-only"),children:[t.jsx(Sd,{size:16,className:"text-muted-foreground"}),t.jsx("span",{children:x("New Task")})]}),t.jsxs("button",{onClick:()=>w(!0),className:"w-full flex items-center gap-2.5 px-2 py-2 rounded-md text-sm text-foreground/80 hover:bg-accent/50 transition-colors",title:x("Search"),children:[t.jsx(hn,{size:16,className:"text-muted-foreground"}),t.jsx("span",{children:x("Search")})]}),t.jsxs(id,{to:y("/conversations"),className:"w-full flex items-center gap-2.5 px-2 py-2 rounded-md text-sm text-foreground/80 hover:bg-accent/50 transition-colors",title:x("对话"),children:[t.jsx(Kr,{size:16,className:"text-muted-foreground"}),t.jsx("span",{children:x("对话")})]})]}),L.length===0?t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center px-6 text-center select-none",children:[t.jsx(Ms,{size:36,className:"text-muted-foreground/40 mb-3",strokeWidth:1.5}),t.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:x("No tasks")}),O&&i?t.jsx("button",{onClick:i,className:"px-3.5 py-1.5 rounded-md bg-brand text-brand-foreground text-xs font-medium hover:bg-brand/90 transition-colors",children:x("New Task")}):null]}):t.jsx(fl.Provider,{value:E,children:t.jsxs(Lh,{sensors:B,onDragStart:D,onDragEnd:F,children:[t.jsx("div",{className:"flex-1 overflow-y-auto scrollbar-app-thin pt-3 pb-4 relative",children:_f.map(({status:I,title:$,defaultOpen:Y})=>t.jsx(hf,{title:$,tasks:P[I],status:I,defaultOpen:Y,selectedTaskId:r,onSelectTask:o,projects:s,activeTaskIds:u,isDragging:a!==null,dragFromStatus:d,onTaskStatusChange:c,onDeleteTask:g,disableDrag:_},I))}),t.jsx(ef,{dropAnimation:null,children:a?t.jsx("div",{className:"bg-popover shadow-lg rounded-md border border-border px-4 py-2 text-sm max-w-[280px] opacity-90",children:t.jsx("span",{className:"block truncate font-medium text-foreground/80",title:a.title,children:a.title})}):null})]})}),L.length>0?t.jsxs("div",{className:"px-4 py-3 border-t border-border/60 text-xs text-muted-foreground/70 flex items-center justify-between",children:[t.jsx("span",{children:x("{count} tasks",{count:L.length})}),p?t.jsx("button",{onClick:()=>m(null),className:"hover:text-foreground underline decoration-border underline-offset-2",children:x("Clear filter")}):null]}):t.jsx("div",{className:"px-4 py-3 border-t border-border/60 text-xs text-muted-foreground/70 flex items-center justify-between",children:t.jsx("span",{children:x("{count} tasks",{count:0})})}),t.jsx(pf,{isOpen:b,onClose:()=>w(!1),tasks:L,projects:s,onSelectTask:o})]})}const bf=10,yf=24,ml=bf*yf,Sf=8;function wf(e,s=ml){return e>s+Sf}function Cf(e,s){return e.includes(s)?e:[...e,s]}function kf(e,s){return e.filter(r=>r!==s)}function Ef(e,s){const r=new Map(s.map(o=>[o.id,o]));return e.map(o=>r.get(o)).filter(o=>!!o).map(o=>({memberId:o.id,label:o.name}))}const ti=new Set(["RUNNING","WAITING_ROOM_REPLY","QUEUED","SESSION_ENDED"]);function yo(e){if(!e)return 0;const s=Date.parse(e);return Number.isNaN(s)?0:s}function jf(e,s=[],r=[]){const o=new Set(r.filter(m=>ti.has(m.status)).map(m=>m.workRequestId));return[...e.map(m=>({kind:"message",key:`message:${m.id}`,sortTime:m.createdAt,order:0,message:m})),...s.filter(m=>m.status==="PENDING_APPROVAL").filter(m=>!o.has(m.id)).map(m=>({kind:"pendingApproval",key:`pending-approval:${m.id}`,sortTime:m.updatedAt??m.createdAt,order:1,request:m}))].sort((m,v)=>{const i=yo(m.sortTime)-yo(v.sortTime);return i!==0?i:m.order!==v.order?m.order-v.order:m.key.localeCompare(v.key)})}function Nf(e){switch(e){case"RUNNING":return"Working";case"QUEUED":return"Queued...";case"WAITING_ROOM_REPLY":return"Waiting reply...";case"SESSION_ENDED":return"Session ended";default:return e}}function Rf(e){switch(e){case"FAILED":return"text-red-500";case"RUNNING":case"WAITING_ROOM_REPLY":case"QUEUED":case"SESSION_ENDED":return"text-neutral-500";default:return"text-neutral-500"}}function Af(e,s){const r=e.reduce((p,m)=>(p[m.status]=(p[m.status]??0)+1,p),{});return[["RUNNING","running"],["QUEUED","queued"],["WAITING_ROOM_REPLY","waiting"],["SESSION_ENDED","ended"]].map(([p,m])=>{const v=r[p];return v?`${v} ${s(m)}`:null}).filter(p=>!!p).join(" · ")}function Mf(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(min-width: 768px)").matches}function Tf({status:e}){const{t:s}=ue();return e==="RUNNING"?t.jsxs(t.Fragment,{children:[s("Working"),t.jsxs("span",{className:"active-work-dots","aria-hidden":"true",children:[t.jsx("span",{children:"."}),t.jsx("span",{className:"active-work-dots__second",children:"."}),t.jsx("span",{className:"active-work-dots__third",children:"."})]})]}):t.jsx(t.Fragment,{children:s(Nf(e))})}function Df({invocations:e,memberById:s,workRequestById:r,onViewInvocationSession:o,onStopMember:p,isStopPending:m,stoppingMemberId:v,stopPromptInvocationId:i,onToggleStopConfirm:n}){const{t:l}=ue(),[u,c]=C.useState(Mf),g=C.useMemo(()=>e.filter(y=>ti.has(y.status)).sort((y,_)=>Date.parse(_.updatedAt??_.createdAt??"")-Date.parse(y.updatedAt??y.createdAt??"")),[e]);if(g.length===0)return null;const x=Af(g,l);return t.jsxs("div",{className:"border-t border-neutral-200 bg-neutral-50/80",children:[t.jsxs("button",{type:"button",onClick:()=>c(y=>!y),"aria-expanded":u,className:"flex h-8 w-full items-center justify-between gap-3 px-3 text-left text-xs text-neutral-600 transition-colors hover:bg-neutral-100",children:[t.jsxs("span",{className:"min-w-0 truncate",children:[t.jsx("span",{className:"font-medium text-neutral-800",children:l("Active work")}),t.jsx("span",{className:"mx-1.5 text-neutral-300",children:"·"}),t.jsx("span",{children:x})]}),u?t.jsx(yt,{size:15,className:"shrink-0 text-neutral-400"}):t.jsx(Ba,{size:15,className:"shrink-0 text-neutral-400"})]}),u&&t.jsx("div",{className:"max-h-32 overflow-y-auto border-t border-neutral-200",children:g.map(y=>{const _=s.get(y.memberId),a=r.get(y.workRequestId),h=!!(y.sessionId&&o),d=!!_,f=i===y.id,b=m&&v===y.memberId,w=a?.instruction??y.workRequestId;return t.jsxs("div",{className:"border-t border-neutral-100 first:border-t-0",children:[t.jsxs("div",{title:w,className:ee("group flex h-8 items-center gap-2 px-3 text-xs text-neutral-700",h?"cursor-pointer hover:bg-white":"cursor-default"),role:h?"button":void 0,tabIndex:h?0:void 0,onClick:()=>y.sessionId&&o?.(y.sessionId),onKeyDown:k=>{!h||!y.sessionId||(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),o?.(y.sessionId))},children:[t.jsx(zt,{name:_?.name??l("Agent"),avatar:_?.avatar??null,className:"h-4 w-4 text-[8px]"}),t.jsxs("div",{className:"flex min-w-0 flex-1 items-baseline gap-1.5",children:[t.jsx("span",{className:"truncate font-medium text-neutral-800",children:_?.name??l("Agent")}),t.jsx("span",{className:ee("shrink-0",Rf(y.status)),children:t.jsx(Tf,{status:y.status})})]}),h&&t.jsx("button",{type:"button",onClick:k=>{k.stopPropagation(),y.sessionId&&o?.(y.sessionId)},onKeyDown:k=>k.stopPropagation(),className:"hidden shrink-0 rounded-md p-1 text-neutral-400 transition-colors hover:bg-neutral-100 hover:text-neutral-700 group-hover:inline-flex",title:l("View log"),"aria-label":`${l("View log")} ${_?.name??l("Agent")}`,children:t.jsx(zi,{size:13})}),d&&t.jsx("button",{type:"button",onClick:k=>{k.stopPropagation(),n(y.id)},onKeyDown:k=>k.stopPropagation(),disabled:b,className:"shrink-0 rounded-md p-1 text-neutral-400 transition-colors hover:bg-red-50 hover:text-red-700 disabled:cursor-not-allowed disabled:opacity-50",title:l("Stop"),"aria-label":`${l("Stop")} ${_?.name??l("Agent")}`,children:t.jsx(As,{size:12})})]}),d&&f&&_&&t.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 border-t border-neutral-100 bg-white px-3 py-2",children:[t.jsx("span",{className:"mr-1 text-[11px] text-neutral-600",children:l("Stop running work?")}),t.jsxs(Me,{type:"button",size:"xs",variant:"outline",disabled:b,onClick:()=>p(_.id,!1),children:[t.jsx(As,{size:11}),t.jsx("span",{children:l(b?"Stopping":"Stop only")})]}),t.jsxs(Me,{type:"button",size:"xs",variant:"outline",disabled:b,className:"border-red-200 bg-red-50 text-red-700 hover:bg-red-100 hover:text-red-800",onClick:()=>p(_.id,!0),children:[t.jsx(za,{size:11}),t.jsx("span",{children:l(b?"Stopping":"Stop + clear queue")})]})]})]},y.id)})})]})}const zr=rr(),Lf=240,Pf=/(^|\n)(```|~~~)[^\S\r\n]*mermaid(?:[\s\r\n]|$)/i;let qi=null;function Of(e){return Pf.test(e)}function If(){return qi??=od(async()=>{const{mermaid:e}=await import("./index-CGMjRoF7.js").then(s=>s.bm);return{mermaid:e}},__vite__mapDeps([0,1,2])).then(({mermaid:e})=>({mermaid:e})),qi}function Bf(e){const s=Of(e),[r,o]=C.useState();return C.useEffect(()=>{if(!s){o(void 0);return}let p=!0;return If().then(m=>{p&&o(m)}).catch(()=>{qi=null,p&&o(void 0)}),()=>{p=!1}},[s]),s?r:void 0}let So=0;function Ff(e,s){return So+=1,{id:`pending-room-message-${Date.now()}-${So}`,teamRunId:e,senderType:s.senderType??"user",senderId:s.senderId??null,senderInvocationId:s.senderInvocationId??null,kind:s.kind??((s.mentions?.length??0)>0?"work_request":"chat"),visibility:"PUBLIC",content:s.content,mentions:s.mentions??[],workRequestIds:[],artifactRefs:s.artifactRefs??[],attachmentIds:s.attachmentIds??[],createdAt:new Date().toISOString(),pendingStatus:"sending"}}function pl(e){return"pendingStatus"in e}const zf=e=>e.includes("://")||e.startsWith("/api/")?e:e.startsWith("/")?`${zr}/attachments/by-path?path=${encodeURIComponent(e)}`:e;function Wf(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(1)}MB`}function Hf(e){return`${e.mimeType.startsWith("image/")?"!":""}[${e.originalName}](${e.storagePath})`}function Ki(e,s){if(s.length===0)return e;const r=new Set(s.map(Hf));return e.split(`
14
14
  `).map(o=>{const p=o.match(/^\s*/)?.[0]??"",m=o.trimStart();for(const v of r){if(m===v)return null;if(m.startsWith(`${v} `)||m.startsWith(`${v} `))return`${p}${m.slice(v.length).trimStart()}`}return o}).filter(o=>o!=null).join(`
15
15
  `).replace(/\n{3,}/g,`
16
16
 
@@ -1,2 +1,2 @@
1
- import{u as _,r as o,m as de,j as e,X as se,S as W,V as ue,d as $,n as H,h as K,T as me,B as z,W as xe,Y as pe,t as U}from"./index-3VWij2vw.js";import{F as V,a as he,u as fe,b as ge,c as je,d as ve,e as be}from"./folder-picker-ROPpPW7C.js";import{F as X}from"./folder-C-l50KQ-.js";import{P as re,T as Ne}from"./trash-2-CWVsy23V.js";import{M as Y}from"./modal-CN741Elc.js";import{S as ye}from"./SettingsMasterDetail-BusgjyV7.js";import"./chevron-right-DSyyoNau.js";import"./circle-alert-FqsC_oWX.js";import"./check-CjNklwnC.js";import"./arrow-left-DWeEJsaX.js";function Pe({value:t,onChange:N,repoPath:y,placeholder:k,disabled:i,disabledMessage:c}){const{t:d}=_(),[l,j]=o.useState(""),[h,n]=o.useState([]),[u,x]=o.useState(!1),[p,v]=o.useState(-1),b=o.useRef(null),E=o.useRef(null),R=o.useRef(void 0),q=o.useCallback(async s=>{if(i||!y||!s){n([]),x(!1);return}try{const a=await de.get("/filesystem/complete",{params:{basePath:y,prefix:s}});n(a.results),x(a.results.length>0),v(-1)}catch{n([]),x(!1)}},[i,y]);o.useEffect(()=>{if(clearTimeout(R.current),!l){n([]),x(!1);return}return R.current=setTimeout(()=>q(l),200),()=>clearTimeout(R.current)},[l,q]),o.useEffect(()=>{const s=a=>{E.current&&!E.current.contains(a.target)&&b.current&&!b.current.contains(a.target)&&x(!1)};return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[]);const w=s=>{if(i)return;const a=s.trim();!a||t.includes(a)||(N([...t,a]),j(""),x(!1),b.current?.focus())},S=s=>{i||N(t.filter((a,A)=>A!==s))},D=s=>{i||(s.type==="directory"?(j(s.path),b.current?.focus()):w(s.path))},M=(s,a)=>{i||(a.stopPropagation(),w(s.path.replace(/\/$/,"")))},F=s=>{s.nativeEvent.isComposing||s.nativeEvent.keyCode===229||i||(u&&h.length>0?s.key==="ArrowDown"?(s.preventDefault(),v(a=>Math.min(a+1,h.length-1))):s.key==="ArrowUp"?(s.preventDefault(),v(a=>Math.max(a-1,-1))):s.key==="Enter"?(s.preventDefault(),p>=0?D(h[p]):w(l)):s.key==="Escape"&&x(!1):s.key==="Enter"&&(s.preventDefault(),w(l)))};return e.jsxs("div",{children:[t.length>0&&e.jsx("div",{className:"border border-neutral-200 rounded-lg mb-2 divide-y divide-neutral-100",children:t.map((s,a)=>e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 group",children:[s.includes(".")&&!s.endsWith("/")?e.jsx(V,{size:14,className:"text-neutral-400 shrink-0"}):e.jsx(X,{size:14,className:"text-amber-500 shrink-0"}),e.jsx("span",{className:"text-sm font-mono text-neutral-700 truncate flex-1",children:s}),e.jsx("button",{onClick:()=>S(a),disabled:i,className:"p-0.5 text-neutral-300 hover:text-red-500 opacity-0 group-hover:opacity-100 transition-opacity shrink-0 disabled:cursor-not-allowed disabled:hover:text-neutral-300",children:e.jsx(se,{size:14})})]},s))}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{ref:b,type:"text",value:l,onChange:s=>j(s.target.value),onKeyDown:F,onFocus:()=>{l&&h.length>0&&x(!0)},placeholder:k??d("输入文件路径..."),disabled:i,className:"flex-1 px-3 py-2 border border-neutral-200 rounded-lg text-sm font-mono focus:outline-none focus:ring-1 focus:ring-neutral-300 disabled:cursor-not-allowed disabled:bg-neutral-50 disabled:text-neutral-400"}),e.jsxs("button",{onClick:()=>w(l),disabled:i||!l.trim(),className:"flex items-center gap-1 px-3 py-2 text-sm bg-neutral-900 text-white rounded-lg hover:bg-neutral-800 disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:[e.jsx(re,{size:14}),e.jsx("span",{children:d("添加")})]})]}),u&&e.jsx("div",{ref:E,className:"absolute z-50 left-0 right-0 mt-1 bg-white border border-neutral-200 rounded-lg shadow-lg max-h-[200px] overflow-y-auto",children:h.map((s,a)=>e.jsxs("button",{onClick:()=>D(s),className:`w-full flex items-center gap-2 px-3 py-1.5 text-sm text-left hover:bg-neutral-50 transition-colors ${a===p?"bg-neutral-100":""}`,children:[s.type==="directory"?e.jsx(X,{size:14,className:"text-amber-500 shrink-0"}):e.jsx(V,{size:14,className:"text-neutral-400 shrink-0"}),e.jsx("span",{className:"font-mono text-neutral-700 truncate flex-1",children:s.path}),s.type==="directory"&&e.jsx("span",{onClick:A=>M(s,A),className:"p-0.5 text-neutral-300 hover:text-emerald-600 shrink-0",title:d("添加此目录"),children:e.jsx(he,{size:14})})]},s.path))})]}),i&&c&&e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:c})]})}function ke({value:t,onChange:N}){const{t:y}=_(),[k,i]=o.useState(""),[c,d]=o.useState(""),l=()=>{const n=k.trim(),u=c.trim();!n||!u||(N([...t,{name:n,command:u}]),i(""),d(""))},j=n=>{N(t.filter((u,x)=>x!==n))},h=n=>{n.key==="Enter"&&!n.nativeEvent.isComposing&&n.nativeEvent.keyCode!==229&&(n.preventDefault(),l())};return e.jsxs("div",{children:[t.length>0&&e.jsx("div",{className:"border border-neutral-200 rounded-lg mb-2 divide-y divide-neutral-100",children:t.map((n,u)=>e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 group",children:[e.jsx("span",{className:"text-sm font-medium text-neutral-700 w-28 shrink-0 truncate",children:n.name}),e.jsx("span",{className:"text-sm font-mono text-neutral-500 flex-1 truncate",children:n.command}),e.jsx("button",{onClick:()=>j(u),className:"p-0.5 text-neutral-300 hover:text-red-500 opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:e.jsx(se,{size:14})})]},u))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:k,onChange:n=>i(n.target.value),onKeyDown:h,placeholder:y("名称"),className:"w-28 shrink-0 px-3 py-2 border border-neutral-200 rounded-lg text-sm focus:outline-none focus:ring-1 focus:ring-neutral-300"}),e.jsx("input",{type:"text",value:c,onChange:n=>d(n.target.value),onKeyDown:h,placeholder:y("命令"),className:"flex-1 px-3 py-2 border border-neutral-200 rounded-lg text-sm font-mono focus:outline-none focus:ring-1 focus:ring-neutral-300"}),e.jsxs("button",{onClick:l,disabled:!k.trim()||!c.trim(),className:"flex items-center gap-1 px-3 py-2 text-sm bg-neutral-900 text-white rounded-lg hover:bg-neutral-800 disabled:opacity-30 disabled:cursor-not-allowed transition-colors shrink-0",children:[e.jsx(re,{size:14}),e.jsx("span",{children:y("添加")})]})]})]})}function Z(t){return t?t.split(",").map(N=>N.trim()).filter(Boolean):[]}function ee(t){if(!t)return[];try{return JSON.parse(t)}catch{return[]}}function te(t){return typeof t.color!="string"||t.color.trim()===""?"bg-muted-foreground":t.color.startsWith("bg-")?t.color:t.color.startsWith("text-")?t.color.replace("text-","bg-"):"bg-muted-foreground"}function qe(){const{t}=_(),{data:N,isLoading:y}=fe({limit:100,includeArchived:!0}),k=ge(),i=je(),c=ve(),[d,l]=o.useState(""),[j,h]=o.useState(null),[n,u]=o.useState({copyFiles:[],setupScript:"",quickCommands:[]}),[x,p]=o.useState(!1),[v,b]=o.useState(null),[E,R]=o.useState(!1),[q,w]=o.useState(!1),[S,D]=o.useState(!1),[M,F]=o.useState(!1),[s,a]=o.useState(""),[A,J]=o.useState(!1),C=N?.data??[],g=o.useMemo(()=>C.filter(r=>!r.archivedAt),[C]),I=o.useMemo(()=>C.filter(r=>r.archivedAt),[C]),f=g.find(r=>r.id===d),T=o.useMemo(()=>C.find(r=>r.id===v)??null,[v,C]);if(o.useEffect(()=>{!d&&g.length>0&&l(g[0].id)},[g,d]),o.useEffect(()=>{if(j){g.some(r=>r.id===j)&&(l(j),h(null));return}d&&!g.some(r=>r.id===d)&&(l(g[0]?.id??""),p(!1))},[g,j,d]),o.useEffect(()=>{f&&!x&&u({copyFiles:Z(f.copyFiles),setupScript:f.setupScript??"",quickCommands:ee(f.quickCommands)})},[f,x]),y)return e.jsx(W,{className:"max-w-5xl",children:e.jsx(ue,{})});if(C.length===0)return e.jsxs(W,{className:"max-w-5xl",children:[e.jsx($,{title:t("项目配置")}),e.jsx(H,{message:t("暂无项目,请先创建项目")})]});const ne=()=>{d&&k.mutate({id:d,copyFiles:n.copyFiles.length>0?n.copyFiles.join(", "):null,setupScript:n.setupScript.trim()||null,quickCommands:n.quickCommands.length>0?JSON.stringify(n.quickCommands):null},{onSuccess:()=>p(!1)})},oe=r=>{h(null),l(r),p(!1),J(!0)},ie=()=>{f&&(b(f.id),D(!1),F(!1),R(!0))},O=()=>{i.isPending||(R(!1),b(null),D(!1),F(!1))},ae=async()=>{if(v)try{await i.mutateAsync({id:v,deleteRepo:S}),U.success(t(S?"项目已删除,并清理了本地文件":"项目已删除")),p(!1),O()}catch{}},le=r=>{const m=I.find(P=>P.id===r);b(r),a(m?.repoDeletedAt?m.repoPath:""),w(!0)},L=()=>{c.isPending||(w(!1),b(null),a(""))},ce=async()=>{if(!(!v||T?.repoDeletedAt&&!s.trim()))try{const m=await c.mutateAsync({id:v,repoPath:s.trim()||void 0});U.success(t("项目已恢复"));for(const P of m.warnings)U.warning(P);p(!1),h(m.project.id),l(m.project.id),L()}catch{}},Q=T?.name??t("this project"),G=!!T?.repoDeletedAt,B=f?.isGitRepo!==!1;return e.jsxs(e.Fragment,{children:[e.jsxs(W,{className:"max-w-5xl",children:[e.jsx($,{title:t("项目配置")}),g.length===0&&I.length===0?e.jsx(H,{message:t("暂无项目,请先创建项目")}):e.jsx(ye,{items:g,selectedId:d,onSelectItem:oe,getItemId:r=>r.id,mobileShowDetail:A,onMobileBack:()=>J(!1),renderListItem:(r,m)=>e.jsxs(e.Fragment,{children:[e.jsx("span",{className:K("h-2 w-2 rounded-full shrink-0",m?"bg-primary-foreground/60":te(r))}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate text-[13px] font-medium",children:r.name}),e.jsx("div",{className:K("truncate text-[11px] font-mono",m?"text-primary-foreground/70":"text-muted-foreground"),children:r.repoPath.split("/").pop()})]})]}),renderListFooter:I.length>0?()=>e.jsxs("div",{className:"pt-3 mt-2 border-t border-border",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 mb-1",children:[e.jsx("span",{className:"text-[11px] font-medium text-muted-foreground",children:t("已删除")}),e.jsx("span",{className:"rounded-full bg-muted px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground",children:I.length})]}),I.map(r=>e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-lg px-3 py-2 text-muted-foreground",children:[e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx("div",{className:"truncate text-[12px]",children:r.name})}),e.jsx("button",{onClick:()=>le(r.id),disabled:c.isPending,className:"shrink-0 text-[11px] hover:text-foreground transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60","aria-label":t("恢复项目"),children:e.jsx(pe,{size:12})})]},r.id))]}):void 0,renderDetail:r=>r?e.jsxs("div",{className:"p-5",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:K("h-2.5 w-2.5 rounded-full shrink-0",te(r))}),e.jsx("h3",{className:"text-base font-semibold text-foreground",children:r.name}),r.isGitRepo===!1&&e.jsx("span",{className:"rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground",children:t("Local project")})]}),e.jsx("p",{className:"text-[11px] text-muted-foreground font-mono mb-5",children:r.repoPath}),r.isGitRepo===!1&&e.jsx("div",{className:"mb-5 rounded-lg border border-info/25 bg-info/8 px-3 py-2 text-xs leading-relaxed text-info/90",children:t("Local projects only support local Solo tasks. Initialize Git to use worktrees and TeamRun.")}),e.jsxs("div",{className:"divide-y divide-border/60",children:[e.jsxs("div",{className:"py-5 first:pt-0",children:[e.jsxs("div",{className:"mb-3",children:[e.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:t("自动复制文件")}),e.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:t("创建 worktree 时自动从主仓库复制的文件或目录,适用于 .env、node_modules 等不在 git 管理中的文件。支持 glob。")})]}),e.jsx(Pe,{value:n.copyFiles,onChange:m=>{u(P=>({...P,copyFiles:m})),p(!0)},repoPath:r.repoPath,disabled:!B,disabledMessage:t("This setting applies only to Git worktree projects.")})]}),e.jsxs("div",{className:"py-5",children:[e.jsxs("div",{className:"mb-3",children:[e.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:t("Setup 脚本")}),e.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:t("创建 worktree 后自动执行的命令,每行一条。在 worktree 目录下执行,单条超时 5 分钟。")})]}),e.jsx("textarea",{value:n.setupScript,onChange:m=>{u(P=>({...P,setupScript:m.target.value})),p(!0)},placeholder:`pnpm install
1
+ import{u as _,r as o,m as de,j as e,X as se,S as W,V as ue,d as $,n as H,h as K,T as me,B as z,W as xe,Y as pe,t as U}from"./index-7nw4fV42.js";import{F as V,a as he,u as fe,b as ge,c as je,d as ve,e as be}from"./folder-picker-DFB9_pv4.js";import{F as X}from"./folder-u7fKAtz_.js";import{P as re,T as Ne}from"./trash-2-B7GFt5Wl.js";import{M as Y}from"./modal-CxOKWOjZ.js";import{S as ye}from"./SettingsMasterDetail-CZfVaFo2.js";import"./chevron-right-7PShDIwg.js";import"./circle-alert-W13JkYj3.js";import"./check-D2WWIhwV.js";import"./arrow-left-y1LwO7sB.js";function Pe({value:t,onChange:N,repoPath:y,placeholder:k,disabled:i,disabledMessage:c}){const{t:d}=_(),[l,j]=o.useState(""),[h,n]=o.useState([]),[u,x]=o.useState(!1),[p,v]=o.useState(-1),b=o.useRef(null),E=o.useRef(null),R=o.useRef(void 0),q=o.useCallback(async s=>{if(i||!y||!s){n([]),x(!1);return}try{const a=await de.get("/filesystem/complete",{params:{basePath:y,prefix:s}});n(a.results),x(a.results.length>0),v(-1)}catch{n([]),x(!1)}},[i,y]);o.useEffect(()=>{if(clearTimeout(R.current),!l){n([]),x(!1);return}return R.current=setTimeout(()=>q(l),200),()=>clearTimeout(R.current)},[l,q]),o.useEffect(()=>{const s=a=>{E.current&&!E.current.contains(a.target)&&b.current&&!b.current.contains(a.target)&&x(!1)};return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[]);const w=s=>{if(i)return;const a=s.trim();!a||t.includes(a)||(N([...t,a]),j(""),x(!1),b.current?.focus())},S=s=>{i||N(t.filter((a,A)=>A!==s))},D=s=>{i||(s.type==="directory"?(j(s.path),b.current?.focus()):w(s.path))},M=(s,a)=>{i||(a.stopPropagation(),w(s.path.replace(/\/$/,"")))},F=s=>{s.nativeEvent.isComposing||s.nativeEvent.keyCode===229||i||(u&&h.length>0?s.key==="ArrowDown"?(s.preventDefault(),v(a=>Math.min(a+1,h.length-1))):s.key==="ArrowUp"?(s.preventDefault(),v(a=>Math.max(a-1,-1))):s.key==="Enter"?(s.preventDefault(),p>=0?D(h[p]):w(l)):s.key==="Escape"&&x(!1):s.key==="Enter"&&(s.preventDefault(),w(l)))};return e.jsxs("div",{children:[t.length>0&&e.jsx("div",{className:"border border-neutral-200 rounded-lg mb-2 divide-y divide-neutral-100",children:t.map((s,a)=>e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 group",children:[s.includes(".")&&!s.endsWith("/")?e.jsx(V,{size:14,className:"text-neutral-400 shrink-0"}):e.jsx(X,{size:14,className:"text-amber-500 shrink-0"}),e.jsx("span",{className:"text-sm font-mono text-neutral-700 truncate flex-1",children:s}),e.jsx("button",{onClick:()=>S(a),disabled:i,className:"p-0.5 text-neutral-300 hover:text-red-500 opacity-0 group-hover:opacity-100 transition-opacity shrink-0 disabled:cursor-not-allowed disabled:hover:text-neutral-300",children:e.jsx(se,{size:14})})]},s))}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{ref:b,type:"text",value:l,onChange:s=>j(s.target.value),onKeyDown:F,onFocus:()=>{l&&h.length>0&&x(!0)},placeholder:k??d("输入文件路径..."),disabled:i,className:"flex-1 px-3 py-2 border border-neutral-200 rounded-lg text-sm font-mono focus:outline-none focus:ring-1 focus:ring-neutral-300 disabled:cursor-not-allowed disabled:bg-neutral-50 disabled:text-neutral-400"}),e.jsxs("button",{onClick:()=>w(l),disabled:i||!l.trim(),className:"flex items-center gap-1 px-3 py-2 text-sm bg-neutral-900 text-white rounded-lg hover:bg-neutral-800 disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:[e.jsx(re,{size:14}),e.jsx("span",{children:d("添加")})]})]}),u&&e.jsx("div",{ref:E,className:"absolute z-50 left-0 right-0 mt-1 bg-white border border-neutral-200 rounded-lg shadow-lg max-h-[200px] overflow-y-auto",children:h.map((s,a)=>e.jsxs("button",{onClick:()=>D(s),className:`w-full flex items-center gap-2 px-3 py-1.5 text-sm text-left hover:bg-neutral-50 transition-colors ${a===p?"bg-neutral-100":""}`,children:[s.type==="directory"?e.jsx(X,{size:14,className:"text-amber-500 shrink-0"}):e.jsx(V,{size:14,className:"text-neutral-400 shrink-0"}),e.jsx("span",{className:"font-mono text-neutral-700 truncate flex-1",children:s.path}),s.type==="directory"&&e.jsx("span",{onClick:A=>M(s,A),className:"p-0.5 text-neutral-300 hover:text-emerald-600 shrink-0",title:d("添加此目录"),children:e.jsx(he,{size:14})})]},s.path))})]}),i&&c&&e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:c})]})}function ke({value:t,onChange:N}){const{t:y}=_(),[k,i]=o.useState(""),[c,d]=o.useState(""),l=()=>{const n=k.trim(),u=c.trim();!n||!u||(N([...t,{name:n,command:u}]),i(""),d(""))},j=n=>{N(t.filter((u,x)=>x!==n))},h=n=>{n.key==="Enter"&&!n.nativeEvent.isComposing&&n.nativeEvent.keyCode!==229&&(n.preventDefault(),l())};return e.jsxs("div",{children:[t.length>0&&e.jsx("div",{className:"border border-neutral-200 rounded-lg mb-2 divide-y divide-neutral-100",children:t.map((n,u)=>e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 group",children:[e.jsx("span",{className:"text-sm font-medium text-neutral-700 w-28 shrink-0 truncate",children:n.name}),e.jsx("span",{className:"text-sm font-mono text-neutral-500 flex-1 truncate",children:n.command}),e.jsx("button",{onClick:()=>j(u),className:"p-0.5 text-neutral-300 hover:text-red-500 opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:e.jsx(se,{size:14})})]},u))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:k,onChange:n=>i(n.target.value),onKeyDown:h,placeholder:y("名称"),className:"w-28 shrink-0 px-3 py-2 border border-neutral-200 rounded-lg text-sm focus:outline-none focus:ring-1 focus:ring-neutral-300"}),e.jsx("input",{type:"text",value:c,onChange:n=>d(n.target.value),onKeyDown:h,placeholder:y("命令"),className:"flex-1 px-3 py-2 border border-neutral-200 rounded-lg text-sm font-mono focus:outline-none focus:ring-1 focus:ring-neutral-300"}),e.jsxs("button",{onClick:l,disabled:!k.trim()||!c.trim(),className:"flex items-center gap-1 px-3 py-2 text-sm bg-neutral-900 text-white rounded-lg hover:bg-neutral-800 disabled:opacity-30 disabled:cursor-not-allowed transition-colors shrink-0",children:[e.jsx(re,{size:14}),e.jsx("span",{children:y("添加")})]})]})]})}function Z(t){return t?t.split(",").map(N=>N.trim()).filter(Boolean):[]}function ee(t){if(!t)return[];try{return JSON.parse(t)}catch{return[]}}function te(t){return typeof t.color!="string"||t.color.trim()===""?"bg-muted-foreground":t.color.startsWith("bg-")?t.color:t.color.startsWith("text-")?t.color.replace("text-","bg-"):"bg-muted-foreground"}function qe(){const{t}=_(),{data:N,isLoading:y}=fe({limit:100,includeArchived:!0}),k=ge(),i=je(),c=ve(),[d,l]=o.useState(""),[j,h]=o.useState(null),[n,u]=o.useState({copyFiles:[],setupScript:"",quickCommands:[]}),[x,p]=o.useState(!1),[v,b]=o.useState(null),[E,R]=o.useState(!1),[q,w]=o.useState(!1),[S,D]=o.useState(!1),[M,F]=o.useState(!1),[s,a]=o.useState(""),[A,J]=o.useState(!1),C=N?.data??[],g=o.useMemo(()=>C.filter(r=>!r.archivedAt),[C]),I=o.useMemo(()=>C.filter(r=>r.archivedAt),[C]),f=g.find(r=>r.id===d),T=o.useMemo(()=>C.find(r=>r.id===v)??null,[v,C]);if(o.useEffect(()=>{!d&&g.length>0&&l(g[0].id)},[g,d]),o.useEffect(()=>{if(j){g.some(r=>r.id===j)&&(l(j),h(null));return}d&&!g.some(r=>r.id===d)&&(l(g[0]?.id??""),p(!1))},[g,j,d]),o.useEffect(()=>{f&&!x&&u({copyFiles:Z(f.copyFiles),setupScript:f.setupScript??"",quickCommands:ee(f.quickCommands)})},[f,x]),y)return e.jsx(W,{className:"max-w-5xl",children:e.jsx(ue,{})});if(C.length===0)return e.jsxs(W,{className:"max-w-5xl",children:[e.jsx($,{title:t("项目配置")}),e.jsx(H,{message:t("暂无项目,请先创建项目")})]});const ne=()=>{d&&k.mutate({id:d,copyFiles:n.copyFiles.length>0?n.copyFiles.join(", "):null,setupScript:n.setupScript.trim()||null,quickCommands:n.quickCommands.length>0?JSON.stringify(n.quickCommands):null},{onSuccess:()=>p(!1)})},oe=r=>{h(null),l(r),p(!1),J(!0)},ie=()=>{f&&(b(f.id),D(!1),F(!1),R(!0))},O=()=>{i.isPending||(R(!1),b(null),D(!1),F(!1))},ae=async()=>{if(v)try{await i.mutateAsync({id:v,deleteRepo:S}),U.success(t(S?"项目已删除,并清理了本地文件":"项目已删除")),p(!1),O()}catch{}},le=r=>{const m=I.find(P=>P.id===r);b(r),a(m?.repoDeletedAt?m.repoPath:""),w(!0)},L=()=>{c.isPending||(w(!1),b(null),a(""))},ce=async()=>{if(!(!v||T?.repoDeletedAt&&!s.trim()))try{const m=await c.mutateAsync({id:v,repoPath:s.trim()||void 0});U.success(t("项目已恢复"));for(const P of m.warnings)U.warning(P);p(!1),h(m.project.id),l(m.project.id),L()}catch{}},Q=T?.name??t("this project"),G=!!T?.repoDeletedAt,B=f?.isGitRepo!==!1;return e.jsxs(e.Fragment,{children:[e.jsxs(W,{className:"max-w-5xl",children:[e.jsx($,{title:t("项目配置")}),g.length===0&&I.length===0?e.jsx(H,{message:t("暂无项目,请先创建项目")}):e.jsx(ye,{items:g,selectedId:d,onSelectItem:oe,getItemId:r=>r.id,mobileShowDetail:A,onMobileBack:()=>J(!1),renderListItem:(r,m)=>e.jsxs(e.Fragment,{children:[e.jsx("span",{className:K("h-2 w-2 rounded-full shrink-0",m?"bg-primary-foreground/60":te(r))}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate text-[13px] font-medium",children:r.name}),e.jsx("div",{className:K("truncate text-[11px] font-mono",m?"text-primary-foreground/70":"text-muted-foreground"),children:r.repoPath.split("/").pop()})]})]}),renderListFooter:I.length>0?()=>e.jsxs("div",{className:"pt-3 mt-2 border-t border-border",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 mb-1",children:[e.jsx("span",{className:"text-[11px] font-medium text-muted-foreground",children:t("已删除")}),e.jsx("span",{className:"rounded-full bg-muted px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground",children:I.length})]}),I.map(r=>e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-lg px-3 py-2 text-muted-foreground",children:[e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx("div",{className:"truncate text-[12px]",children:r.name})}),e.jsx("button",{onClick:()=>le(r.id),disabled:c.isPending,className:"shrink-0 text-[11px] hover:text-foreground transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60","aria-label":t("恢复项目"),children:e.jsx(pe,{size:12})})]},r.id))]}):void 0,renderDetail:r=>r?e.jsxs("div",{className:"p-5",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:K("h-2.5 w-2.5 rounded-full shrink-0",te(r))}),e.jsx("h3",{className:"text-base font-semibold text-foreground",children:r.name}),r.isGitRepo===!1&&e.jsx("span",{className:"rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground",children:t("Local project")})]}),e.jsx("p",{className:"text-[11px] text-muted-foreground font-mono mb-5",children:r.repoPath}),r.isGitRepo===!1&&e.jsx("div",{className:"mb-5 rounded-lg border border-info/25 bg-info/8 px-3 py-2 text-xs leading-relaxed text-info/90",children:t("Local projects only support local Solo tasks. Initialize Git to use worktrees and TeamRun.")}),e.jsxs("div",{className:"divide-y divide-border/60",children:[e.jsxs("div",{className:"py-5 first:pt-0",children:[e.jsxs("div",{className:"mb-3",children:[e.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:t("自动复制文件")}),e.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:t("创建 worktree 时自动从主仓库复制的文件或目录,适用于 .env、node_modules 等不在 git 管理中的文件。支持 glob。")})]}),e.jsx(Pe,{value:n.copyFiles,onChange:m=>{u(P=>({...P,copyFiles:m})),p(!0)},repoPath:r.repoPath,disabled:!B,disabledMessage:t("This setting applies only to Git worktree projects.")})]}),e.jsxs("div",{className:"py-5",children:[e.jsxs("div",{className:"mb-3",children:[e.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:t("Setup 脚本")}),e.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:t("创建 worktree 后自动执行的命令,每行一条。在 worktree 目录下执行,单条超时 5 分钟。")})]}),e.jsx("textarea",{value:n.setupScript,onChange:m=>{u(P=>({...P,setupScript:m.target.value})),p(!0)},placeholder:`pnpm install
2
2
  pnpm run setup`,rows:4,disabled:!B,className:"w-full rounded-lg border border-input bg-muted/50 px-3 py-2 text-sm font-mono transition-colors focus:border-ring focus:bg-background focus:outline-none resize-none disabled:cursor-not-allowed disabled:opacity-50"}),!B&&e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:t("This setting applies only to Git worktree projects.")})]}),e.jsxs("div",{className:"py-5",children:[e.jsxs("div",{className:"mb-3",children:[e.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:t("常用命令")}),e.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:t("在终端中可快速执行的命令,不会自动运行。")})]}),e.jsx(ke,{value:n.quickCommands,onChange:m=>{u(P=>({...P,quickCommands:m})),p(!0)}})]})]}),e.jsx("div",{className:"mt-2 rounded-lg border border-destructive/30 bg-destructive/10 p-4",children:e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(me,{size:15,className:"text-destructive mt-0.5 shrink-0","aria-hidden":"true"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[13px] font-medium text-foreground",children:t("删除项目")}),e.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:t("项目将从默认列表隐藏,历史记录保留。可选同时删除本地文件。")})]})]}),e.jsxs(z,{size:"sm",variant:"destructive",className:"shrink-0",onClick:ie,disabled:i.isPending||c.isPending,children:[e.jsx(Ne,{size:13}),t("删除项目")]})]})}),x&&e.jsx(xe,{saving:k.isPending,onSave:ne,onCancel:()=>{f&&u({copyFiles:Z(f.copyFiles),setupScript:f.setupScript??"",quickCommands:ee(f.quickCommands)}),p(!1)},className:"-mx-5"})]}):e.jsx("div",{className:"py-16 text-center text-sm text-muted-foreground",children:g.length>0?t("选择一个项目查看配置"):t("当前没有可配置的项目")})})]}),e.jsx(Y,{isOpen:E,onClose:O,title:t("Delete Project"),action:e.jsxs(e.Fragment,{children:[e.jsx(z,{variant:"outline",onClick:O,disabled:i.isPending,children:t("Cancel")}),e.jsx(z,{variant:"destructive",onClick:ae,disabled:i.isPending||S&&!M,children:i.isPending?t("Deleting..."):t("Delete Project")})]}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:t("项目「{title}」将从默认项目列表隐藏,但历史任务、workspace 和会话记录仍会保留。",{title:Q})}),e.jsxs("label",{className:"flex items-start gap-3 rounded-lg border border-border bg-muted px-3 py-3",children:[e.jsx("input",{type:"checkbox",checked:S,onChange:r=>{D(r.target.checked),r.target.checked||F(!1)},className:"mt-0.5 h-4 w-4 rounded border-border accent-primary"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:t("同时删除本地项目文件")}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t("勾选后会删除项目路径指向的本地目录,并禁用代码/Git 相关能力。")})]})]}),S&&e.jsxs("div",{className:"rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-3",children:[e.jsx("p",{className:"text-sm font-medium text-destructive",children:t("勾选后会连项目文件一起删除,请谨慎选择。")}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t("恢复该项目时需要重新绑定一个有效的项目路径。")}),e.jsxs("label",{className:"mt-3 flex items-start gap-2 text-xs text-foreground",children:[e.jsx("input",{type:"checkbox",checked:M,onChange:r=>F(r.target.checked),className:"mt-0.5 h-4 w-4 rounded border-border accent-primary"}),e.jsx("span",{children:t("我已确认这会删除本地项目文件")})]})]}),i.isError&&e.jsx("p",{className:"text-xs text-destructive",children:i.error instanceof Error?i.error.message:t("Failed to delete project")})]})}),e.jsx(Y,{isOpen:q,onClose:L,title:t("Restore Project"),action:e.jsxs(e.Fragment,{children:[e.jsx(z,{variant:"outline",onClick:L,disabled:c.isPending,children:t("Cancel")}),e.jsx(z,{onClick:ce,disabled:c.isPending||G&&!s.trim(),children:c.isPending?t("Restoring..."):t("Restore Project")})]}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:G?t("项目「{title}」的本地项目文件已删除。恢复前需要重新绑定一个有效的项目路径。",{title:Q}):t("恢复后,项目会重新出现在默认项目列表中。")}),G&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-1.5",children:t("Project Path")}),e.jsx(be,{value:s,onChange:a,validationMode:"directory"}),e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:t("Agent Tower 会尽量校验项目 identity;如果 remote URL 或目录名不同,会给出警告但允许继续。")})]}),c.isError&&e.jsx("p",{className:"text-xs text-destructive",children:c.error instanceof Error?c.error.message:t("Failed to restore project")})]})})]})}export{qe as ProjectSettingsPage};
@@ -1,4 +1,4 @@
1
- import{i as Ce,q as _e,m as ke,u as S,r as j,j as n,h as T,S as ie,V as Pe,d as Oe,B as E,a8 as Ie,n as Se,C as Te,t as k,Y as Ae,f as X,T as De,a0 as Le,a9 as Re,a5 as Y}from"./index-3VWij2vw.js";import{u as ze,a as Ue,b as Fe,c as Me,d as Be,e as Ge,f as Ke}from"./use-providers-C-PIoFvi.js";import{C as Ze}from"./confirm-dialog-BRqwAzwk.js";import{I as B}from"./input-Dyl1onpD.js";import{M as W}from"./modal-CN741Elc.js";import{S as ce}from"./select-B2NVUyiF.js";import{S as Xe}from"./switch-BiB7Kgpg.js";import{T as de}from"./textarea-Du_ydNYw.js";import{h as R,i as y}from"./mermaid-NOHMQCX5-DjJdrIaK.js";import{A as z}from"./AgentLogo-Bqjt1u2k.js";import{C as ue}from"./chevron-down-o4IZE_P6.js";import{S as Ye}from"./SettingsMasterDetail-BusgjyV7.js";import{U as qe}from"./upload-C-wK_vWU.js";import{P as $,T as me}from"./trash-2-CWVsy23V.js";import{P as Ve}from"./pencil-B05Eh9uE.js";import"./check-CjNklwnC.js";import"./chevron-right-DSyyoNau.js";import"./arrow-left-DWeEJsaX.js";function $e(e,t){let i=e.slice(0,t).split(/\r\n|\n|\r/g);return[i.length,i.pop().length+1]}function Je(e,t,i){let a=e.split(/\r\n|\n|\r/g),l="",r=(Math.log10(t+1)|0)+1;for(let s=t-1;s<=t+1;s++){let o=a[s-1];o&&(l+=s.toString().padEnd(r," "),l+=": ",l+=o,l+=`
1
+ import{i as Ce,q as _e,m as ke,u as S,r as j,j as n,h as T,S as ie,V as Pe,d as Oe,B as E,a8 as Ie,n as Se,C as Te,t as k,Y as Ae,f as X,T as De,a0 as Le,a9 as Re,a5 as Y}from"./index-7nw4fV42.js";import{u as ze,a as Ue,b as Fe,c as Me,d as Be,e as Ge,f as Ke}from"./use-providers-erJ2iHLz.js";import{C as Ze}from"./confirm-dialog-BAqfLDT8.js";import{I as B}from"./input-CKwRYuUJ.js";import{M as W}from"./modal-CxOKWOjZ.js";import{S as ce}from"./select-DFuN9DX8.js";import{S as Xe}from"./switch-gL7lBFj6.js";import{T as de}from"./textarea-Lr4GZaYW.js";import{h as R,i as y}from"./mermaid-NOHMQCX5-B42ziicV.js";import{A as z}from"./AgentLogo-ThhvSi7G.js";import{C as ue}from"./chevron-down--B7iZqBL.js";import{S as Ye}from"./SettingsMasterDetail-CZfVaFo2.js";import{U as qe}from"./upload-L8hpDFoO.js";import{P as $,T as me}from"./trash-2-B7GFt5Wl.js";import{P as Ve}from"./pencil-h5kxwbcu.js";import"./check-D2WWIhwV.js";import"./chevron-right-7PShDIwg.js";import"./arrow-left-y1LwO7sB.js";function $e(e,t){let i=e.slice(0,t).split(/\r\n|\n|\r/g);return[i.length,i.pop().length+1]}function Je(e,t,i){let a=e.split(/\r\n|\n|\r/g),l="",r=(Math.log10(t+1)|0)+1;for(let s=t-1;s<=t+1;s++){let o=a[s-1];o&&(l+=s.toString().padEnd(r," "),l+=": ",l+=o,l+=`
2
2
  `,s===t&&(l+=" ".repeat(r+i+2),l+=`^
3
3
  `))}return l}class x extends Error{line;column;codeblock;constructor(t,i){const[a,l]=$e(i.toml,i.ptr),r=Je(i.toml,a,l);super(`Invalid TOML document: ${t}
4
4
 
@@ -1 +1 @@
1
- import{u as v,j as r,h as o}from"./index-3VWij2vw.js";import{A as h}from"./arrow-left-DWeEJsaX.js";function N({items:n,selectedId:t,onSelectItem:c,getItemId:l,renderListItem:d,renderDetail:u,renderListFooter:g,mobileShowDetail:a,onMobileBack:x,listClassName:f,detailClassName:p}){const{t:m}=v(),b=n.find(e=>l(e)===t)??null;return r.jsxs("div",{className:"grid gap-5 lg:grid-cols-[240px_minmax(0,1fr)] lg:h-[calc(100vh-16rem)] lg:max-h-[640px]",children:[r.jsxs("div",{className:o("space-y-1 lg:overflow-y-auto lg:pr-1 scrollbar-app-thin",a&&"hidden lg:block",f),children:[n.map(e=>{const s=l(e),i=s===t;return r.jsx("button",{onClick:()=>c(s),"aria-current":i?"true":void 0,className:o("flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-left transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",i?"bg-primary text-primary-foreground":"text-foreground hover:bg-muted/50"),children:d(e,i)},s)}),g?.()]}),r.jsxs("div",{className:o("rounded-xl border border-border bg-card lg:overflow-y-auto scrollbar-app-thin",!a&&"hidden lg:block",p),children:[r.jsxs("button",{onClick:x,className:"mb-4 flex items-center gap-1.5 px-5 pt-3 text-xs text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 lg:hidden",children:[r.jsx(h,{size:14}),m("返回列表")]}),u(b)]})]})}export{N as S};
1
+ import{u as v,j as r,h as o}from"./index-7nw4fV42.js";import{A as h}from"./arrow-left-y1LwO7sB.js";function N({items:n,selectedId:t,onSelectItem:c,getItemId:l,renderListItem:d,renderDetail:u,renderListFooter:g,mobileShowDetail:a,onMobileBack:x,listClassName:f,detailClassName:p}){const{t:m}=v(),b=n.find(e=>l(e)===t)??null;return r.jsxs("div",{className:"grid gap-5 lg:grid-cols-[240px_minmax(0,1fr)] lg:h-[calc(100vh-16rem)] lg:max-h-[640px]",children:[r.jsxs("div",{className:o("space-y-1 lg:overflow-y-auto lg:pr-1 scrollbar-app-thin",a&&"hidden lg:block",f),children:[n.map(e=>{const s=l(e),i=s===t;return r.jsx("button",{onClick:()=>c(s),"aria-current":i?"true":void 0,className:o("flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-left transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",i?"bg-primary text-primary-foreground":"text-foreground hover:bg-muted/50"),children:d(e,i)},s)}),g?.()]}),r.jsxs("div",{className:o("rounded-xl border border-border bg-card lg:overflow-y-auto scrollbar-app-thin",!a&&"hidden lg:block",p),children:[r.jsxs("button",{onClick:x,className:"mb-4 flex items-center gap-1.5 px-5 pt-3 text-xs text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 lg:hidden",children:[r.jsx(h,{size:14}),m("返回列表")]}),u(b)]})]})}export{N as S};
@@ -1 +1 @@
1
- import{u as Oe,x as gt,y as bt,z as ft,D as ht,E as vt,F as jt,G as yt,H as Pt,r as l,j as e,S as Ee,I as Nt,d as kt,h as B,B as p,n as Ae,t as c,J as Tt}from"./index-3VWij2vw.js";import{C as Me}from"./confirm-dialog-BRqwAzwk.js";import{M as wt}from"./modal-CN741Elc.js";import{S as O}from"./select-B2NVUyiF.js";import"./mermaid-NOHMQCX5-DjJdrIaK.js";import{A as Ct}from"./AgentLogo-Bqjt1u2k.js";import{M as U}from"./MemberAvatar-DKsedKpu.js";import{u as It}from"./use-providers-C-PIoFvi.js";import{A as _e}from"./arrow-left-DWeEJsaX.js";import{T as ue,P as R}from"./trash-2-CWVsy23V.js";import{C as St}from"./chevron-up-BsLA8Xot.js";import{C as Et}from"./chevron-down-o4IZE_P6.js";import"./check-CjNklwnC.js";import"./chevron-right-DSyyoNau.js";const o="/avatars/presets",At=[{id:"developer",label:"Developer",src:`${o}/avatar-preset-01-developer.png`},{id:"architect",label:"Architect",src:`${o}/avatar-preset-02-architect.png`},{id:"tester",label:"Tester",src:`${o}/avatar-preset-03-tester.png`},{id:"devops",label:"DevOps",src:`${o}/avatar-preset-04-devops.png`},{id:"data-scientist",label:"Data scientist",src:`${o}/avatar-preset-05-data-scientist.png`},{id:"frontend",label:"Frontend",src:`${o}/avatar-preset-06-frontend.png`},{id:"backend",label:"Backend",src:`${o}/avatar-preset-07-backend.png`},{id:"security",label:"Security",src:`${o}/avatar-preset-08-security.png`},{id:"project-manager",label:"Project manager",src:`${o}/avatar-preset-09-project-manager.png`},{id:"product-manager",label:"Product manager",src:`${o}/avatar-preset-10-product-manager.png`},{id:"scrum-master",label:"Scrum master",src:`${o}/avatar-preset-11-scrum-master.png`},{id:"tech-lead",label:"Tech lead",src:`${o}/avatar-preset-12-tech-lead.png`},{id:"coordinator",label:"Coordinator",src:`${o}/avatar-preset-13-coordinator.png`},{id:"mentor",label:"Mentor",src:`${o}/avatar-preset-14-mentor.png`},{id:"reviewer",label:"Reviewer",src:`${o}/avatar-preset-15-reviewer.png`},{id:"ui-designer",label:"UI designer",src:`${o}/avatar-preset-16-ui-designer.png`},{id:"ux-researcher",label:"UX researcher",src:`${o}/avatar-preset-17-ux-researcher.png`},{id:"documenter",label:"Documenter",src:`${o}/avatar-preset-18-documenter.png`},{id:"translator",label:"Translator",src:`${o}/avatar-preset-19-translator.png`},{id:"analyst",label:"Analyst",src:`${o}/avatar-preset-20-analyst.png`},{id:"consultant",label:"Consultant",src:`${o}/avatar-preset-21-consultant.png`},{id:"creative-director",label:"Creative director",src:`${o}/avatar-preset-22-creative-director.png`},{id:"support",label:"Support",src:`${o}/avatar-preset-23-support.png`},{id:"assistant",label:"Assistant",src:`${o}/avatar-preset-24-assistant.png`},{id:"robot",label:"Robot",src:`${o}/avatar-preset-25-robot.png`}],Re=Tt(),Mt=2*1024*1024,_t=[],Ft=[],$t=[],De=[{key:"readRoom",label:"读房间"},{key:"postRoomMessage",label:"发房间消息"},{key:"mentionMembers",label:"提及成员"},{key:"stopMemberWork",label:"停止成员工作"},{key:"markReadyForReview",label:"标记可审查"},{key:"readFiles",label:"读文件"},{key:"writeFiles",label:"写文件"},{key:"runCommands",label:"运行命令"},{key:"readDiff",label:"读 diff"},{key:"mergeWorkspace",label:"合并工作区"}],ze={readRoom:!1,postRoomMessage:!1,mentionMembers:!1,stopMemberWork:!1,markReadyForReview:!1,readFiles:!1,writeFiles:!1,runCommands:!1,readDiff:!1,mergeWorkspace:!1},Fe=[{value:"none",label:"无"},{value:"shared",label:"共享"},{value:"dedicated",label:"独占"}],Ot=[{value:"MENTION_ONLY",label:"仅提及"},{value:"USER_MESSAGES",label:"所有用户消息"}],Rt=[{value:"new_per_request",label:"每次新会话"},{value:"resume_last",label:"复用上次会话"}],Dt=[{value:"own_only",label:"仅自己队列"},{value:"team_pending",label:"全队列待处理"}];function Y(){return{name:"",aliasesText:"",providerId:"",rolePrompt:"",capabilities:{...ze},workspacePolicy:"none",triggerPolicy:"MENTION_ONLY",sessionPolicy:"new_per_request",queueManagementPolicy:"own_only",avatar:""}}function xe(r){return{name:r.name,aliasesText:r.aliases.join(", "),providerId:r.providerId,rolePrompt:r.rolePrompt,capabilities:{...ze,...r.capabilities},workspacePolicy:r.workspacePolicy,triggerPolicy:r.triggerPolicy,sessionPolicy:r.sessionPolicy,queueManagementPolicy:r.queueManagementPolicy,avatar:r.avatar??""}}function q(){return{name:"",memberPresetIds:[]}}function pe(r){return{name:r.name,memberPresetIds:r.members?.map(i=>i.memberPresetId)??[]}}function zt(r,i,d,m){if(d.filter(M=>M===m).length<=1)return r;const W=d.slice(0,i+1).filter(M=>M===m).length;return`${r} #${W}`}function Lt(r){return Array.from(new Set(r.split(/[\n,]/).map(i=>i.trim()).filter(Boolean)))}function Bt(r){return r.trim()||null}function $e(r){return De.reduce((i,d)=>i+(r[d.key]?1:0),0)}function A(r,i){return r instanceof Error?r.message:i}function Ut(r){return["image/png","image/jpeg","image/webp"].includes(r.type)}async function Yt(r){const i=new FormData;i.append("file",r);const d=await fetch(`${Re}/attachments/upload`,{method:"POST",body:i});if(!d.ok){const m=await d.json().catch(()=>({}));throw new Error(m.error||m.message||`Upload failed (${d.status})`)}return d.json()}function G({title:r,error:i,isFetching:d,onRetry:m}){const{t:T}=Oe();return e.jsx("div",{role:"alert",className:"rounded-lg border border-destructive/30 bg-destructive/10 px-4 py-3 text-sm text-destructive",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-medium",children:r}),e.jsx("div",{className:"mt-1 text-xs text-destructive/90",children:A(i,T("请稍后重试。"))})]}),e.jsx(p,{type:"button",size:"sm",variant:"outline",onClick:m,disabled:d,children:T(d?"加载中...":"重试")})]})})}function ar(){const{t:r}=Oe(),{data:i,error:d,isError:m,isFetching:T,isLoading:W,refetch:M}=It(),{data:Le,error:ge,isError:w,isFetching:be,isLoading:V,refetch:fe}=gt(),{data:Be,error:Ue,isError:D,isFetching:Ye,isLoading:H,refetch:qe}=bt(),J=ft(),Q=ht(),he=vt(),X=jt(),K=yt(),ve=Pt(),[Z,je]=l.useState("presets"),[C,ee]=l.useState("edit"),[f,te]=l.useState(null),[a,v]=l.useState(Y()),[ye,_]=l.useState(!1),[j,re]=l.useState(null),[Ge,se]=l.useState(!1),[Pe,Ne]=l.useState(!1),ke=l.useRef(null),[I,ae]=l.useState("edit"),[h,ne]=l.useState(null),[y,g]=l.useState(q()),[Te,P]=l.useState(!1),[N,oe]=l.useState(null),[we,F]=l.useState(!1),u=Le??_t,b=Be??Ft,z=i??$t,$=l.useMemo(()=>new Map(u.map(t=>[t.id,t])),[u]),le=l.useMemo(()=>new Map(b.map(t=>[t.id,t])),[b]),We=l.useMemo(()=>{const t=z.map(({provider:s,availability:n})=>({value:s.id,label:s.name+(n.type==="NOT_FOUND"?r(" (不可用)"):""),icon:e.jsx(Ct,{agentType:s.agentType,className:"size-4"}),disabled:n.type==="NOT_FOUND"}));return a.providerId&&!t.some(s=>s.value===a.providerId)&&t.unshift({value:a.providerId,label:`${a.providerId}${r(" (不可用)")}`,disabled:!0}),t},[a.providerId,z,r]),ie=f?$.get(f)??null:null,de=h?le.get(h)??null:null,Ve=l.useMemo(()=>new Map(z.map(({provider:t,availability:s})=>[t.id,t.name+(s.type==="NOT_FOUND"?r(" (不可用)"):"")])),[z,r]);if(l.useEffect(()=>{if(!(V||w||ye)){if(C==="create"){v(Y());return}if(f){const t=$.get(f);t&&v(xe(t));return}if(u.length>0){const t=u[0];te(t.id),ee("edit"),v(xe(t));return}ee("create"),te(null),v(Y())}},[$,ye,C,u,w,V,f]),l.useEffect(()=>{if(!(H||D||Te)){if(I==="create"){g(q());return}if(h){const t=le.get(h);t&&g(pe(t));return}if(b.length>0){const t=b[0];ne(t.id),ae("edit"),g(pe(t));return}ae("create"),ne(null),g(q())}},[h,le,Te,I,b,D,H]),W||V||H)return e.jsx(Ee,{className:"max-w-6xl",children:e.jsx(Nt,{cards:6})});const x=(t,s)=>{v(n=>({...n,[t]:s})),_(!0)},He=(t,s)=>{v(n=>({...n,capabilities:{...n.capabilities,[t]:s}})),_(!0)},Je=t=>{x("avatar",t),se(!1)},Qe=()=>{x("avatar","")},Xe=async t=>{const s=t.target.files?.[0];if(t.target.value="",!!s){if(!Ut(s)){c.error(r("仅支持 PNG、JPG、WebP 头像。"));return}if(s.size>Mt){c.error(r("头像图片不能超过 2MB。"));return}Ne(!0);try{const n=await Yt(s);x("avatar",`${Re}${n.url}`),c.success(r("头像已上传"))}catch(n){c.error(A(n,r("头像上传失败")))}finally{Ne(!1)}}},S=(t,s)=>{ee(t),te(s?.id??null),v(s?xe(s):Y()),_(!1)},Ke=(t,s)=>{g(n=>({...n,[t]:s})),P(!0)},E=(t,s)=>{ae(t),ne(s?.id??null),g(s?pe(s):q()),P(!1)},Ze=async()=>{const t={name:a.name.trim(),aliases:Lt(a.aliasesText),providerId:a.providerId.trim(),rolePrompt:a.rolePrompt.trim(),capabilities:{...a.capabilities},workspacePolicy:a.workspacePolicy,triggerPolicy:a.triggerPolicy,sessionPolicy:a.sessionPolicy,queueManagementPolicy:a.queueManagementPolicy,avatar:Bt(a.avatar)};try{if(C==="create"||!f){const s=await J.mutateAsync(t);S("edit",s),c.success(r("已创建"))}else{const s=await Q.mutateAsync({id:f,data:t});S("edit",s),c.success(r("已保存"))}}catch(s){c.error(A(s,r("保存失败")))}},et=async()=>{if(j)try{await he.mutateAsync(j.id),c.success(r("Deleted"));const t=u.filter(s=>s.id!==j.id);f===j.id&&(t.length>0?S("edit",t[0]):S("create",null)),re(null)}catch(t){c.error(A(t,r("删除失败")))}},tt=async()=>{const t={name:y.name.trim(),memberPresetIds:y.memberPresetIds};try{if(I==="create"||!h){const s=await X.mutateAsync(t);E("edit",s),c.success(r("已创建"))}else{const s=await K.mutateAsync({id:h,data:t});E("edit",s),c.success(r("已保存"))}}catch(s){c.error(A(s,r("保存失败")))}},rt=async()=>{if(N)try{await ve.mutateAsync(N.id),c.success(r("Deleted"));const t=b.filter(s=>s.id!==N.id);h===N.id&&(t.length>0?E("edit",t[0]):E("create",null)),oe(null)}catch(t){c.error(A(t,r("删除失败")))}},st=$e(a.capabilities),at=!!a.name.trim()&&!!a.providerId.trim()&&!!a.rolePrompt.trim()&&!m&&!w&&!J.isPending&&!Q.isPending,nt=!!y.name.trim()&&!D&&!w&&!X.isPending&&!K.isPending,ce=y.memberPresetIds.map(t=>$.get(t)).filter(t=>!!t),ot=t=>{_(!1),S("edit",t)},lt=()=>{_(!1),S("create",null)},it=t=>{P(!1),E("edit",t)},dt=()=>{P(!1),E("create",null)},ct=t=>{g(s=>({...s,memberPresetIds:[...s.memberPresetIds,t]})),P(!0)},mt=t=>{g(s=>({...s,memberPresetIds:s.memberPresetIds.filter((n,k)=>k!==t)})),P(!0)},Ce=(t,s)=>{g(n=>{const k=t+s;if(k<0||k>=n.memberPresetIds.length)return n;const me=[...n.memberPresetIds],[pt]=me.splice(t,1);return me.splice(k,0,pt),{...n,memberPresetIds:me}}),P(!0)},ut=t=>{ot(t),F(!0)},Ie=()=>{lt(),F(!0)},xt=t=>{it(t),F(!0)},Se=()=>{dt(),F(!0)},L=()=>F(!1);return e.jsxs(Ee,{className:"max-w-6xl",children:[e.jsx(kt,{title:r("团队协作设置"),actions:e.jsxs("div",{className:"inline-flex rounded-lg border border-border bg-muted/80 p-0.5",children:[e.jsx("button",{type:"button",onClick:()=>{je("presets"),L()},className:B("rounded-md px-3 py-1.5 text-[12px] font-medium transition-all",Z==="presets"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:r("成员预设")}),e.jsx("button",{type:"button",onClick:()=>{je("templates"),L()},className:B("rounded-md px-3 py-1.5 text-[12px] font-medium transition-all",Z==="templates"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:r("团队模板")})]})}),m&&e.jsx(G,{title:r("Provider 列表加载失败"),error:d,isFetching:T,onRetry:()=>{M()}}),Z==="presets"?we?e.jsxs("div",{className:"rounded-xl border border-border bg-white",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-border/60 px-5 py-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{onClick:L,className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[e.jsx(_e,{size:14}),r("返回")]}),e.jsx("span",{className:"text-neutral-200",children:"|"}),e.jsx("h3",{className:"text-[13px] font-semibold text-foreground",children:C==="create"?r("创建新预设"):ie?.name??r("编辑预设")})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[C==="edit"&&ie&&e.jsx("button",{onClick:()=>re(ie),className:"flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-colors",title:r("删除"),children:e.jsx(ue,{size:14})}),e.jsx(p,{size:"sm",onClick:Ze,disabled:!at,children:J.isPending||Q.isPending?r("保存中..."):r(C==="create"?"创建":"保存")})]})]}),e.jsxs("div",{className:"p-5 space-y-5",children:[e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsxs("div",{className:"shrink-0",children:[e.jsx(U,{name:a.name||r("Agent"),avatar:a.avatar,className:"h-14 w-14 text-sm"}),e.jsxs("div",{className:"flex justify-center gap-1 mt-2",children:[e.jsx("button",{type:"button",onClick:()=>se(!0),className:"text-[10px] text-muted-foreground hover:text-foreground transition-colors",children:r("选择")}),e.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:"·"}),e.jsx("button",{type:"button",onClick:()=>ke.current?.click(),disabled:Pe,className:"text-[10px] text-muted-foreground hover:text-foreground transition-colors",children:r(Pe?"...":"上传")}),a.avatar.trim()&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:"·"}),e.jsx("button",{type:"button",onClick:Qe,className:"text-[10px] text-muted-foreground hover:text-destructive transition-colors",children:r("清除")})]})]}),e.jsx("input",{ref:ke,type:"file",accept:"image/png,image/jpeg,image/webp",className:"hidden",onChange:Xe})]}),e.jsxs("div",{className:"flex-1 min-w-0 grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[12px] font-medium text-muted-foreground mb-1",children:r("名称")}),e.jsx("input",{value:a.name,onChange:t=>x("name",t.target.value),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm transition-colors focus:border-ring focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[12px] font-medium text-muted-foreground mb-1",children:r("别名")}),e.jsx("input",{value:a.aliasesText,onChange:t=>x("aliasesText",t.target.value),placeholder:r("alice, a, reviewer"),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm transition-colors focus:border-ring focus:outline-none"})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[12px] font-medium text-muted-foreground mb-1",children:r("Provider")}),e.jsx(O,{value:a.providerId,onChange:t=>x("providerId",t),options:We,disabled:m}),m&&e.jsx("p",{className:"mt-1 text-[11px] text-destructive",children:r("Provider 列表加载失败。")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[12px] font-medium text-muted-foreground mb-1",children:r("角色提示词")}),e.jsx("textarea",{value:a.rolePrompt,onChange:t=>x("rolePrompt",t.target.value),rows:4,className:"w-full rounded-lg border border-border bg-muted/50 px-3 py-2 text-sm font-mono transition-colors focus:border-ring focus:bg-background focus:outline-none resize-y"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-end justify-between gap-3 mb-2",children:[e.jsx("label",{className:"text-[12px] font-medium text-muted-foreground",children:r("可用能力")}),e.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[st,"/10"]})]}),e.jsx("div",{className:"grid gap-1 sm:grid-cols-2 xl:grid-cols-3",children:De.map(t=>e.jsxs("label",{className:"flex items-center gap-2 rounded px-2.5 py-1.5 text-[12px] text-foreground hover:bg-muted transition-colors cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:a.capabilities[t.key],onChange:s=>He(t.key,s.target.checked),className:"h-3.5 w-3.5 rounded border-border"}),e.jsx("span",{children:r(t.label)})]},t.key))})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[12px] font-medium text-muted-foreground mb-1",children:r("工作区")}),e.jsx(O,{value:a.workspacePolicy,onChange:t=>x("workspacePolicy",t),options:Fe.map(t=>({value:t.value,label:r(t.label)}))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[12px] font-medium text-muted-foreground mb-1",children:r("触发")}),e.jsx(O,{value:a.triggerPolicy,onChange:t=>x("triggerPolicy",t),options:Ot.map(t=>({value:t.value,label:r(t.label)}))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[12px] font-medium text-muted-foreground mb-1",children:r("会话")}),e.jsx(O,{value:a.sessionPolicy,onChange:t=>x("sessionPolicy",t),options:Rt.map(t=>({value:t.value,label:r(t.label)}))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[12px] font-medium text-muted-foreground mb-1",children:r("队列")}),e.jsx(O,{value:a.queueManagementPolicy,onChange:t=>x("queueManagementPolicy",t),options:Dt.map(t=>({value:t.value,label:r(t.label)}))})]})]})]})]}):e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 mb-4",children:[e.jsx("span",{className:"text-[12px] text-muted-foreground",children:r("{count} 个成员预设",{count:u.length})}),e.jsxs(p,{size:"sm",variant:"outline",onClick:Ie,children:[e.jsx(R,{size:13})," ",r("新增预设")]})]}),w?e.jsx(G,{title:r("加载失败"),error:ge,isFetching:be,onRetry:()=>{fe()}}):u.length===0?e.jsx(Ae,{message:r("暂无成员预设"),action:e.jsxs(p,{size:"sm",onClick:Ie,children:[e.jsx(R,{size:13,className:"mr-1"})," ",r("新增预设")]})}):e.jsx("div",{className:"grid gap-3 grid-cols-1 sm:grid-cols-2 lg:grid-cols-3",children:u.map(t=>{const s=$e(t.capabilities);return e.jsxs("button",{type:"button",onClick:()=>ut(t),className:"flex items-start gap-3 rounded-xl border border-border bg-background p-4 text-left transition-all hover:border-border hover:shadow-sm",children:[e.jsx(U,{name:t.name,avatar:t.avatar,className:"h-10 w-10 text-xs shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate text-[13px] font-semibold text-foreground",children:t.name}),t.aliases.length>0&&e.jsx("div",{className:"truncate text-[11px] text-muted-foreground mt-0.5",children:t.aliases.join(", ")}),e.jsx("div",{className:"truncate text-[11px] text-muted-foreground mt-1",children:Ve.get(t.providerId)??t.providerId}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 mt-2",children:[e.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground",children:r(Fe.find(n=>n.value===t.workspacePolicy)?.label??t.workspacePolicy)}),e.jsxs("span",{className:"rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground",children:[s,"/10 ",r("能力")]})]})]})]},t.id)})})]}):we?e.jsxs("div",{className:"rounded-xl border border-border bg-white",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-border/60 px-5 py-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{onClick:L,className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[e.jsx(_e,{size:14}),r("返回")]}),e.jsx("span",{className:"text-neutral-200",children:"|"}),e.jsx("h3",{className:"text-[13px] font-semibold text-foreground",children:I==="create"?r("创建新模板"):de?.name??r("编辑模板")})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[I==="edit"&&de&&e.jsx("button",{onClick:()=>oe(de),className:"flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-colors",title:r("删除"),children:e.jsx(ue,{size:14})}),e.jsx(p,{size:"sm",onClick:tt,disabled:!nt,children:X.isPending||K.isPending?r("保存中..."):r(I==="create"?"创建":"保存")})]})]}),e.jsxs("div",{className:"p-5 space-y-5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[12px] font-medium text-muted-foreground mb-1",children:r("模板名称")}),e.jsx("input",{value:y.name,onChange:t=>Ke("name",t.target.value),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm transition-colors focus:border-ring focus:outline-none"})]}),e.jsxs("div",{className:"grid gap-4 xl:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[12px] font-medium text-muted-foreground mb-2",children:r("可用预设")}),e.jsx("div",{className:"max-h-[400px] space-y-1 overflow-y-auto scrollbar-app-thin",children:w?e.jsx(G,{title:r("加载失败"),error:ge,isFetching:be,onRetry:()=>{fe()}}):u.length===0?e.jsx("div",{className:"rounded-lg border border-dashed border-border p-3 text-center text-[12px] text-muted-foreground",children:r("先创建成员预设")}):u.map(t=>{const s=y.memberPresetIds.filter(n=>n===t.id).length;return e.jsxs("button",{type:"button",onClick:()=>ct(t.id),className:B("flex w-full items-center gap-2.5 rounded-lg border px-3 py-2 text-left transition-all",s>0?"border-neutral-900 bg-muted":"border-border bg-background hover:border-border"),children:[e.jsx(U,{name:t.name,avatar:t.avatar,className:"h-7 w-7 text-[10px] shrink-0"}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx("div",{className:"truncate text-[12px] font-medium text-foreground",children:t.name})}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[s>0&&e.jsxs("span",{className:"rounded-full bg-neutral-900 px-1.5 py-0.5 text-[10px] font-medium text-white",children:["x",s]}),e.jsx(R,{size:13,className:"text-muted-foreground"})]})]},t.id)})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[12px] font-medium text-muted-foreground mb-2",children:r("已选成员")}),e.jsx("div",{className:"max-h-[400px] space-y-1 overflow-y-auto scrollbar-app-thin",children:ce.length===0?e.jsx("div",{className:"rounded-lg border border-dashed border-border p-3 text-center text-[12px] text-muted-foreground",children:r("尚未选择")}):ce.map((t,s)=>e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-lg border border-border bg-background px-3 py-2",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(U,{name:t.name,avatar:t.avatar,className:"h-7 w-7 text-[10px] shrink-0"}),e.jsx("span",{className:"truncate text-[12px] font-medium text-foreground",children:zt(t.name,s,y.memberPresetIds,t.id)})]}),e.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[e.jsx(p,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>Ce(s,-1),disabled:s===0,children:e.jsx(St,{size:13})}),e.jsx(p,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>Ce(s,1),disabled:s===ce.length-1,children:e.jsx(Et,{size:13})}),e.jsx(p,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>mt(s),children:e.jsx(ue,{size:13})})]})]},`${t.id}-${s}`))})]})]})]})]}):e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 mb-4",children:[e.jsx("span",{className:"text-[12px] text-muted-foreground",children:r("{count} 个团队模板",{count:b.length})}),e.jsxs(p,{size:"sm",variant:"outline",onClick:Se,children:[e.jsx(R,{size:13})," ",r("新增模板")]})]}),D?e.jsx(G,{title:r("加载失败"),error:Ue,isFetching:Ye,onRetry:()=>{qe()}}):b.length===0?e.jsx(Ae,{message:r("暂无团队模板"),action:e.jsxs(p,{size:"sm",onClick:Se,children:[e.jsx(R,{size:13,className:"mr-1"})," ",r("新增模板")]})}):e.jsx("div",{className:"grid gap-3 grid-cols-1 sm:grid-cols-2 lg:grid-cols-3",children:b.map(t=>{const s=t.members?.length??0,n=(t.members??[]).slice(0,3).map(k=>$.get(k.memberPresetId)?.name).filter(Boolean);return e.jsxs("button",{type:"button",onClick:()=>xt(t),className:"flex flex-col rounded-xl border border-border bg-background p-4 text-left transition-all hover:border-border hover:shadow-sm",children:[e.jsx("div",{className:"truncate text-[13px] font-semibold text-foreground",children:t.name}),e.jsx("div",{className:"text-[11px] text-muted-foreground mt-1",children:r("{count} 个成员",{count:s})}),n.length>0&&e.jsxs("div",{className:"truncate text-[11px] text-muted-foreground mt-1.5",children:[n.join(", "),s>3?` +${s-3}`:""]})]},t.id)})})]}),e.jsx(Me,{isOpen:!!j,onClose:()=>re(null),onConfirm:et,title:r("删除"),description:j?r('确定删除 "{name}"?此操作不可撤销。',{name:j.name}):"",variant:"danger",confirmText:r("删除"),cancelText:r("取消"),isLoading:he.isPending}),e.jsx(wt,{isOpen:Ge,onClose:()=>se(!1),title:r("选择预设头像"),className:"max-w-2xl",children:e.jsx("div",{className:"grid grid-cols-4 gap-2 sm:grid-cols-5",children:At.map(t=>{const s=a.avatar===t.src;return e.jsxs("button",{type:"button",onClick:()=>Je(t.src),className:B("group rounded-xl border bg-background p-2 text-center transition-all hover:border-neutral-400 hover:bg-muted focus:outline-none focus:ring-2 focus:ring-neutral-900/15",s?"border-neutral-900 ring-2 ring-neutral-900/10":"border-border"),"aria-pressed":s,"aria-label":r("选择 {name} 头像",{name:t.label}),children:[e.jsx("img",{src:t.src,alt:t.label,loading:"lazy",className:"mx-auto h-14 w-14 rounded-full object-cover sm:h-16 sm:w-16"}),e.jsx("span",{className:"mt-1 block truncate text-[10px] font-medium text-muted-foreground",children:t.label})]},t.id)})})}),e.jsx(Me,{isOpen:!!N,onClose:()=>oe(null),onConfirm:rt,title:r("删除"),description:N?r('确定删除 "{name}"?此操作不可撤销。',{name:N.name}):"",variant:"danger",confirmText:r("删除"),cancelText:r("取消"),isLoading:ve.isPending})]})}export{ar as TeamSettingsPage};
1
+ import{u as Oe,x as gt,y as bt,z as ft,D as ht,E as vt,F as jt,G as yt,H as Pt,r as l,j as e,S as Ee,I as Nt,d as kt,h as B,B as p,n as Ae,t as c,J as Tt}from"./index-7nw4fV42.js";import{C as Me}from"./confirm-dialog-BAqfLDT8.js";import{M as wt}from"./modal-CxOKWOjZ.js";import{S as O}from"./select-DFuN9DX8.js";import"./mermaid-NOHMQCX5-B42ziicV.js";import{A as Ct}from"./AgentLogo-ThhvSi7G.js";import{M as U}from"./MemberAvatar-Y_pJlw-N.js";import{u as It}from"./use-providers-erJ2iHLz.js";import{A as _e}from"./arrow-left-y1LwO7sB.js";import{T as ue,P as R}from"./trash-2-B7GFt5Wl.js";import{C as St}from"./chevron-up-3n_vHdrD.js";import{C as Et}from"./chevron-down--B7iZqBL.js";import"./check-D2WWIhwV.js";import"./chevron-right-7PShDIwg.js";const o="/avatars/presets",At=[{id:"developer",label:"Developer",src:`${o}/avatar-preset-01-developer.png`},{id:"architect",label:"Architect",src:`${o}/avatar-preset-02-architect.png`},{id:"tester",label:"Tester",src:`${o}/avatar-preset-03-tester.png`},{id:"devops",label:"DevOps",src:`${o}/avatar-preset-04-devops.png`},{id:"data-scientist",label:"Data scientist",src:`${o}/avatar-preset-05-data-scientist.png`},{id:"frontend",label:"Frontend",src:`${o}/avatar-preset-06-frontend.png`},{id:"backend",label:"Backend",src:`${o}/avatar-preset-07-backend.png`},{id:"security",label:"Security",src:`${o}/avatar-preset-08-security.png`},{id:"project-manager",label:"Project manager",src:`${o}/avatar-preset-09-project-manager.png`},{id:"product-manager",label:"Product manager",src:`${o}/avatar-preset-10-product-manager.png`},{id:"scrum-master",label:"Scrum master",src:`${o}/avatar-preset-11-scrum-master.png`},{id:"tech-lead",label:"Tech lead",src:`${o}/avatar-preset-12-tech-lead.png`},{id:"coordinator",label:"Coordinator",src:`${o}/avatar-preset-13-coordinator.png`},{id:"mentor",label:"Mentor",src:`${o}/avatar-preset-14-mentor.png`},{id:"reviewer",label:"Reviewer",src:`${o}/avatar-preset-15-reviewer.png`},{id:"ui-designer",label:"UI designer",src:`${o}/avatar-preset-16-ui-designer.png`},{id:"ux-researcher",label:"UX researcher",src:`${o}/avatar-preset-17-ux-researcher.png`},{id:"documenter",label:"Documenter",src:`${o}/avatar-preset-18-documenter.png`},{id:"translator",label:"Translator",src:`${o}/avatar-preset-19-translator.png`},{id:"analyst",label:"Analyst",src:`${o}/avatar-preset-20-analyst.png`},{id:"consultant",label:"Consultant",src:`${o}/avatar-preset-21-consultant.png`},{id:"creative-director",label:"Creative director",src:`${o}/avatar-preset-22-creative-director.png`},{id:"support",label:"Support",src:`${o}/avatar-preset-23-support.png`},{id:"assistant",label:"Assistant",src:`${o}/avatar-preset-24-assistant.png`},{id:"robot",label:"Robot",src:`${o}/avatar-preset-25-robot.png`}],Re=Tt(),Mt=2*1024*1024,_t=[],Ft=[],$t=[],De=[{key:"readRoom",label:"读房间"},{key:"postRoomMessage",label:"发房间消息"},{key:"mentionMembers",label:"提及成员"},{key:"stopMemberWork",label:"停止成员工作"},{key:"markReadyForReview",label:"标记可审查"},{key:"readFiles",label:"读文件"},{key:"writeFiles",label:"写文件"},{key:"runCommands",label:"运行命令"},{key:"readDiff",label:"读 diff"},{key:"mergeWorkspace",label:"合并工作区"}],ze={readRoom:!1,postRoomMessage:!1,mentionMembers:!1,stopMemberWork:!1,markReadyForReview:!1,readFiles:!1,writeFiles:!1,runCommands:!1,readDiff:!1,mergeWorkspace:!1},Fe=[{value:"none",label:"无"},{value:"shared",label:"共享"},{value:"dedicated",label:"独占"}],Ot=[{value:"MENTION_ONLY",label:"仅提及"},{value:"USER_MESSAGES",label:"所有用户消息"}],Rt=[{value:"new_per_request",label:"每次新会话"},{value:"resume_last",label:"复用上次会话"}],Dt=[{value:"own_only",label:"仅自己队列"},{value:"team_pending",label:"全队列待处理"}];function Y(){return{name:"",aliasesText:"",providerId:"",rolePrompt:"",capabilities:{...ze},workspacePolicy:"none",triggerPolicy:"MENTION_ONLY",sessionPolicy:"new_per_request",queueManagementPolicy:"own_only",avatar:""}}function xe(r){return{name:r.name,aliasesText:r.aliases.join(", "),providerId:r.providerId,rolePrompt:r.rolePrompt,capabilities:{...ze,...r.capabilities},workspacePolicy:r.workspacePolicy,triggerPolicy:r.triggerPolicy,sessionPolicy:r.sessionPolicy,queueManagementPolicy:r.queueManagementPolicy,avatar:r.avatar??""}}function q(){return{name:"",memberPresetIds:[]}}function pe(r){return{name:r.name,memberPresetIds:r.members?.map(i=>i.memberPresetId)??[]}}function zt(r,i,d,m){if(d.filter(M=>M===m).length<=1)return r;const W=d.slice(0,i+1).filter(M=>M===m).length;return`${r} #${W}`}function Lt(r){return Array.from(new Set(r.split(/[\n,]/).map(i=>i.trim()).filter(Boolean)))}function Bt(r){return r.trim()||null}function $e(r){return De.reduce((i,d)=>i+(r[d.key]?1:0),0)}function A(r,i){return r instanceof Error?r.message:i}function Ut(r){return["image/png","image/jpeg","image/webp"].includes(r.type)}async function Yt(r){const i=new FormData;i.append("file",r);const d=await fetch(`${Re}/attachments/upload`,{method:"POST",body:i});if(!d.ok){const m=await d.json().catch(()=>({}));throw new Error(m.error||m.message||`Upload failed (${d.status})`)}return d.json()}function G({title:r,error:i,isFetching:d,onRetry:m}){const{t:T}=Oe();return e.jsx("div",{role:"alert",className:"rounded-lg border border-destructive/30 bg-destructive/10 px-4 py-3 text-sm text-destructive",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-medium",children:r}),e.jsx("div",{className:"mt-1 text-xs text-destructive/90",children:A(i,T("请稍后重试。"))})]}),e.jsx(p,{type:"button",size:"sm",variant:"outline",onClick:m,disabled:d,children:T(d?"加载中...":"重试")})]})})}function ar(){const{t:r}=Oe(),{data:i,error:d,isError:m,isFetching:T,isLoading:W,refetch:M}=It(),{data:Le,error:ge,isError:w,isFetching:be,isLoading:V,refetch:fe}=gt(),{data:Be,error:Ue,isError:D,isFetching:Ye,isLoading:H,refetch:qe}=bt(),J=ft(),Q=ht(),he=vt(),X=jt(),K=yt(),ve=Pt(),[Z,je]=l.useState("presets"),[C,ee]=l.useState("edit"),[f,te]=l.useState(null),[a,v]=l.useState(Y()),[ye,_]=l.useState(!1),[j,re]=l.useState(null),[Ge,se]=l.useState(!1),[Pe,Ne]=l.useState(!1),ke=l.useRef(null),[I,ae]=l.useState("edit"),[h,ne]=l.useState(null),[y,g]=l.useState(q()),[Te,P]=l.useState(!1),[N,oe]=l.useState(null),[we,F]=l.useState(!1),u=Le??_t,b=Be??Ft,z=i??$t,$=l.useMemo(()=>new Map(u.map(t=>[t.id,t])),[u]),le=l.useMemo(()=>new Map(b.map(t=>[t.id,t])),[b]),We=l.useMemo(()=>{const t=z.map(({provider:s,availability:n})=>({value:s.id,label:s.name+(n.type==="NOT_FOUND"?r(" (不可用)"):""),icon:e.jsx(Ct,{agentType:s.agentType,className:"size-4"}),disabled:n.type==="NOT_FOUND"}));return a.providerId&&!t.some(s=>s.value===a.providerId)&&t.unshift({value:a.providerId,label:`${a.providerId}${r(" (不可用)")}`,disabled:!0}),t},[a.providerId,z,r]),ie=f?$.get(f)??null:null,de=h?le.get(h)??null:null,Ve=l.useMemo(()=>new Map(z.map(({provider:t,availability:s})=>[t.id,t.name+(s.type==="NOT_FOUND"?r(" (不可用)"):"")])),[z,r]);if(l.useEffect(()=>{if(!(V||w||ye)){if(C==="create"){v(Y());return}if(f){const t=$.get(f);t&&v(xe(t));return}if(u.length>0){const t=u[0];te(t.id),ee("edit"),v(xe(t));return}ee("create"),te(null),v(Y())}},[$,ye,C,u,w,V,f]),l.useEffect(()=>{if(!(H||D||Te)){if(I==="create"){g(q());return}if(h){const t=le.get(h);t&&g(pe(t));return}if(b.length>0){const t=b[0];ne(t.id),ae("edit"),g(pe(t));return}ae("create"),ne(null),g(q())}},[h,le,Te,I,b,D,H]),W||V||H)return e.jsx(Ee,{className:"max-w-6xl",children:e.jsx(Nt,{cards:6})});const x=(t,s)=>{v(n=>({...n,[t]:s})),_(!0)},He=(t,s)=>{v(n=>({...n,capabilities:{...n.capabilities,[t]:s}})),_(!0)},Je=t=>{x("avatar",t),se(!1)},Qe=()=>{x("avatar","")},Xe=async t=>{const s=t.target.files?.[0];if(t.target.value="",!!s){if(!Ut(s)){c.error(r("仅支持 PNG、JPG、WebP 头像。"));return}if(s.size>Mt){c.error(r("头像图片不能超过 2MB。"));return}Ne(!0);try{const n=await Yt(s);x("avatar",`${Re}${n.url}`),c.success(r("头像已上传"))}catch(n){c.error(A(n,r("头像上传失败")))}finally{Ne(!1)}}},S=(t,s)=>{ee(t),te(s?.id??null),v(s?xe(s):Y()),_(!1)},Ke=(t,s)=>{g(n=>({...n,[t]:s})),P(!0)},E=(t,s)=>{ae(t),ne(s?.id??null),g(s?pe(s):q()),P(!1)},Ze=async()=>{const t={name:a.name.trim(),aliases:Lt(a.aliasesText),providerId:a.providerId.trim(),rolePrompt:a.rolePrompt.trim(),capabilities:{...a.capabilities},workspacePolicy:a.workspacePolicy,triggerPolicy:a.triggerPolicy,sessionPolicy:a.sessionPolicy,queueManagementPolicy:a.queueManagementPolicy,avatar:Bt(a.avatar)};try{if(C==="create"||!f){const s=await J.mutateAsync(t);S("edit",s),c.success(r("已创建"))}else{const s=await Q.mutateAsync({id:f,data:t});S("edit",s),c.success(r("已保存"))}}catch(s){c.error(A(s,r("保存失败")))}},et=async()=>{if(j)try{await he.mutateAsync(j.id),c.success(r("Deleted"));const t=u.filter(s=>s.id!==j.id);f===j.id&&(t.length>0?S("edit",t[0]):S("create",null)),re(null)}catch(t){c.error(A(t,r("删除失败")))}},tt=async()=>{const t={name:y.name.trim(),memberPresetIds:y.memberPresetIds};try{if(I==="create"||!h){const s=await X.mutateAsync(t);E("edit",s),c.success(r("已创建"))}else{const s=await K.mutateAsync({id:h,data:t});E("edit",s),c.success(r("已保存"))}}catch(s){c.error(A(s,r("保存失败")))}},rt=async()=>{if(N)try{await ve.mutateAsync(N.id),c.success(r("Deleted"));const t=b.filter(s=>s.id!==N.id);h===N.id&&(t.length>0?E("edit",t[0]):E("create",null)),oe(null)}catch(t){c.error(A(t,r("删除失败")))}},st=$e(a.capabilities),at=!!a.name.trim()&&!!a.providerId.trim()&&!!a.rolePrompt.trim()&&!m&&!w&&!J.isPending&&!Q.isPending,nt=!!y.name.trim()&&!D&&!w&&!X.isPending&&!K.isPending,ce=y.memberPresetIds.map(t=>$.get(t)).filter(t=>!!t),ot=t=>{_(!1),S("edit",t)},lt=()=>{_(!1),S("create",null)},it=t=>{P(!1),E("edit",t)},dt=()=>{P(!1),E("create",null)},ct=t=>{g(s=>({...s,memberPresetIds:[...s.memberPresetIds,t]})),P(!0)},mt=t=>{g(s=>({...s,memberPresetIds:s.memberPresetIds.filter((n,k)=>k!==t)})),P(!0)},Ce=(t,s)=>{g(n=>{const k=t+s;if(k<0||k>=n.memberPresetIds.length)return n;const me=[...n.memberPresetIds],[pt]=me.splice(t,1);return me.splice(k,0,pt),{...n,memberPresetIds:me}}),P(!0)},ut=t=>{ot(t),F(!0)},Ie=()=>{lt(),F(!0)},xt=t=>{it(t),F(!0)},Se=()=>{dt(),F(!0)},L=()=>F(!1);return e.jsxs(Ee,{className:"max-w-6xl",children:[e.jsx(kt,{title:r("团队协作设置"),actions:e.jsxs("div",{className:"inline-flex rounded-lg border border-border bg-muted/80 p-0.5",children:[e.jsx("button",{type:"button",onClick:()=>{je("presets"),L()},className:B("rounded-md px-3 py-1.5 text-[12px] font-medium transition-all",Z==="presets"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:r("成员预设")}),e.jsx("button",{type:"button",onClick:()=>{je("templates"),L()},className:B("rounded-md px-3 py-1.5 text-[12px] font-medium transition-all",Z==="templates"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:r("团队模板")})]})}),m&&e.jsx(G,{title:r("Provider 列表加载失败"),error:d,isFetching:T,onRetry:()=>{M()}}),Z==="presets"?we?e.jsxs("div",{className:"rounded-xl border border-border bg-white",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-border/60 px-5 py-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{onClick:L,className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[e.jsx(_e,{size:14}),r("返回")]}),e.jsx("span",{className:"text-neutral-200",children:"|"}),e.jsx("h3",{className:"text-[13px] font-semibold text-foreground",children:C==="create"?r("创建新预设"):ie?.name??r("编辑预设")})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[C==="edit"&&ie&&e.jsx("button",{onClick:()=>re(ie),className:"flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-colors",title:r("删除"),children:e.jsx(ue,{size:14})}),e.jsx(p,{size:"sm",onClick:Ze,disabled:!at,children:J.isPending||Q.isPending?r("保存中..."):r(C==="create"?"创建":"保存")})]})]}),e.jsxs("div",{className:"p-5 space-y-5",children:[e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsxs("div",{className:"shrink-0",children:[e.jsx(U,{name:a.name||r("Agent"),avatar:a.avatar,className:"h-14 w-14 text-sm"}),e.jsxs("div",{className:"flex justify-center gap-1 mt-2",children:[e.jsx("button",{type:"button",onClick:()=>se(!0),className:"text-[10px] text-muted-foreground hover:text-foreground transition-colors",children:r("选择")}),e.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:"·"}),e.jsx("button",{type:"button",onClick:()=>ke.current?.click(),disabled:Pe,className:"text-[10px] text-muted-foreground hover:text-foreground transition-colors",children:r(Pe?"...":"上传")}),a.avatar.trim()&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:"·"}),e.jsx("button",{type:"button",onClick:Qe,className:"text-[10px] text-muted-foreground hover:text-destructive transition-colors",children:r("清除")})]})]}),e.jsx("input",{ref:ke,type:"file",accept:"image/png,image/jpeg,image/webp",className:"hidden",onChange:Xe})]}),e.jsxs("div",{className:"flex-1 min-w-0 grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[12px] font-medium text-muted-foreground mb-1",children:r("名称")}),e.jsx("input",{value:a.name,onChange:t=>x("name",t.target.value),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm transition-colors focus:border-ring focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[12px] font-medium text-muted-foreground mb-1",children:r("别名")}),e.jsx("input",{value:a.aliasesText,onChange:t=>x("aliasesText",t.target.value),placeholder:r("alice, a, reviewer"),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm transition-colors focus:border-ring focus:outline-none"})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[12px] font-medium text-muted-foreground mb-1",children:r("Provider")}),e.jsx(O,{value:a.providerId,onChange:t=>x("providerId",t),options:We,disabled:m}),m&&e.jsx("p",{className:"mt-1 text-[11px] text-destructive",children:r("Provider 列表加载失败。")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[12px] font-medium text-muted-foreground mb-1",children:r("角色提示词")}),e.jsx("textarea",{value:a.rolePrompt,onChange:t=>x("rolePrompt",t.target.value),rows:4,className:"w-full rounded-lg border border-border bg-muted/50 px-3 py-2 text-sm font-mono transition-colors focus:border-ring focus:bg-background focus:outline-none resize-y"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-end justify-between gap-3 mb-2",children:[e.jsx("label",{className:"text-[12px] font-medium text-muted-foreground",children:r("可用能力")}),e.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[st,"/10"]})]}),e.jsx("div",{className:"grid gap-1 sm:grid-cols-2 xl:grid-cols-3",children:De.map(t=>e.jsxs("label",{className:"flex items-center gap-2 rounded px-2.5 py-1.5 text-[12px] text-foreground hover:bg-muted transition-colors cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:a.capabilities[t.key],onChange:s=>He(t.key,s.target.checked),className:"h-3.5 w-3.5 rounded border-border"}),e.jsx("span",{children:r(t.label)})]},t.key))})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[12px] font-medium text-muted-foreground mb-1",children:r("工作区")}),e.jsx(O,{value:a.workspacePolicy,onChange:t=>x("workspacePolicy",t),options:Fe.map(t=>({value:t.value,label:r(t.label)}))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[12px] font-medium text-muted-foreground mb-1",children:r("触发")}),e.jsx(O,{value:a.triggerPolicy,onChange:t=>x("triggerPolicy",t),options:Ot.map(t=>({value:t.value,label:r(t.label)}))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[12px] font-medium text-muted-foreground mb-1",children:r("会话")}),e.jsx(O,{value:a.sessionPolicy,onChange:t=>x("sessionPolicy",t),options:Rt.map(t=>({value:t.value,label:r(t.label)}))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[12px] font-medium text-muted-foreground mb-1",children:r("队列")}),e.jsx(O,{value:a.queueManagementPolicy,onChange:t=>x("queueManagementPolicy",t),options:Dt.map(t=>({value:t.value,label:r(t.label)}))})]})]})]})]}):e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 mb-4",children:[e.jsx("span",{className:"text-[12px] text-muted-foreground",children:r("{count} 个成员预设",{count:u.length})}),e.jsxs(p,{size:"sm",variant:"outline",onClick:Ie,children:[e.jsx(R,{size:13})," ",r("新增预设")]})]}),w?e.jsx(G,{title:r("加载失败"),error:ge,isFetching:be,onRetry:()=>{fe()}}):u.length===0?e.jsx(Ae,{message:r("暂无成员预设"),action:e.jsxs(p,{size:"sm",onClick:Ie,children:[e.jsx(R,{size:13,className:"mr-1"})," ",r("新增预设")]})}):e.jsx("div",{className:"grid gap-3 grid-cols-1 sm:grid-cols-2 lg:grid-cols-3",children:u.map(t=>{const s=$e(t.capabilities);return e.jsxs("button",{type:"button",onClick:()=>ut(t),className:"flex items-start gap-3 rounded-xl border border-border bg-background p-4 text-left transition-all hover:border-border hover:shadow-sm",children:[e.jsx(U,{name:t.name,avatar:t.avatar,className:"h-10 w-10 text-xs shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate text-[13px] font-semibold text-foreground",children:t.name}),t.aliases.length>0&&e.jsx("div",{className:"truncate text-[11px] text-muted-foreground mt-0.5",children:t.aliases.join(", ")}),e.jsx("div",{className:"truncate text-[11px] text-muted-foreground mt-1",children:Ve.get(t.providerId)??t.providerId}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 mt-2",children:[e.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground",children:r(Fe.find(n=>n.value===t.workspacePolicy)?.label??t.workspacePolicy)}),e.jsxs("span",{className:"rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground",children:[s,"/10 ",r("能力")]})]})]})]},t.id)})})]}):we?e.jsxs("div",{className:"rounded-xl border border-border bg-white",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-border/60 px-5 py-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{onClick:L,className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[e.jsx(_e,{size:14}),r("返回")]}),e.jsx("span",{className:"text-neutral-200",children:"|"}),e.jsx("h3",{className:"text-[13px] font-semibold text-foreground",children:I==="create"?r("创建新模板"):de?.name??r("编辑模板")})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[I==="edit"&&de&&e.jsx("button",{onClick:()=>oe(de),className:"flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-colors",title:r("删除"),children:e.jsx(ue,{size:14})}),e.jsx(p,{size:"sm",onClick:tt,disabled:!nt,children:X.isPending||K.isPending?r("保存中..."):r(I==="create"?"创建":"保存")})]})]}),e.jsxs("div",{className:"p-5 space-y-5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[12px] font-medium text-muted-foreground mb-1",children:r("模板名称")}),e.jsx("input",{value:y.name,onChange:t=>Ke("name",t.target.value),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm transition-colors focus:border-ring focus:outline-none"})]}),e.jsxs("div",{className:"grid gap-4 xl:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[12px] font-medium text-muted-foreground mb-2",children:r("可用预设")}),e.jsx("div",{className:"max-h-[400px] space-y-1 overflow-y-auto scrollbar-app-thin",children:w?e.jsx(G,{title:r("加载失败"),error:ge,isFetching:be,onRetry:()=>{fe()}}):u.length===0?e.jsx("div",{className:"rounded-lg border border-dashed border-border p-3 text-center text-[12px] text-muted-foreground",children:r("先创建成员预设")}):u.map(t=>{const s=y.memberPresetIds.filter(n=>n===t.id).length;return e.jsxs("button",{type:"button",onClick:()=>ct(t.id),className:B("flex w-full items-center gap-2.5 rounded-lg border px-3 py-2 text-left transition-all",s>0?"border-neutral-900 bg-muted":"border-border bg-background hover:border-border"),children:[e.jsx(U,{name:t.name,avatar:t.avatar,className:"h-7 w-7 text-[10px] shrink-0"}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx("div",{className:"truncate text-[12px] font-medium text-foreground",children:t.name})}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[s>0&&e.jsxs("span",{className:"rounded-full bg-neutral-900 px-1.5 py-0.5 text-[10px] font-medium text-white",children:["x",s]}),e.jsx(R,{size:13,className:"text-muted-foreground"})]})]},t.id)})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[12px] font-medium text-muted-foreground mb-2",children:r("已选成员")}),e.jsx("div",{className:"max-h-[400px] space-y-1 overflow-y-auto scrollbar-app-thin",children:ce.length===0?e.jsx("div",{className:"rounded-lg border border-dashed border-border p-3 text-center text-[12px] text-muted-foreground",children:r("尚未选择")}):ce.map((t,s)=>e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-lg border border-border bg-background px-3 py-2",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(U,{name:t.name,avatar:t.avatar,className:"h-7 w-7 text-[10px] shrink-0"}),e.jsx("span",{className:"truncate text-[12px] font-medium text-foreground",children:zt(t.name,s,y.memberPresetIds,t.id)})]}),e.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[e.jsx(p,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>Ce(s,-1),disabled:s===0,children:e.jsx(St,{size:13})}),e.jsx(p,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>Ce(s,1),disabled:s===ce.length-1,children:e.jsx(Et,{size:13})}),e.jsx(p,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>mt(s),children:e.jsx(ue,{size:13})})]})]},`${t.id}-${s}`))})]})]})]})]}):e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 mb-4",children:[e.jsx("span",{className:"text-[12px] text-muted-foreground",children:r("{count} 个团队模板",{count:b.length})}),e.jsxs(p,{size:"sm",variant:"outline",onClick:Se,children:[e.jsx(R,{size:13})," ",r("新增模板")]})]}),D?e.jsx(G,{title:r("加载失败"),error:Ue,isFetching:Ye,onRetry:()=>{qe()}}):b.length===0?e.jsx(Ae,{message:r("暂无团队模板"),action:e.jsxs(p,{size:"sm",onClick:Se,children:[e.jsx(R,{size:13,className:"mr-1"})," ",r("新增模板")]})}):e.jsx("div",{className:"grid gap-3 grid-cols-1 sm:grid-cols-2 lg:grid-cols-3",children:b.map(t=>{const s=t.members?.length??0,n=(t.members??[]).slice(0,3).map(k=>$.get(k.memberPresetId)?.name).filter(Boolean);return e.jsxs("button",{type:"button",onClick:()=>xt(t),className:"flex flex-col rounded-xl border border-border bg-background p-4 text-left transition-all hover:border-border hover:shadow-sm",children:[e.jsx("div",{className:"truncate text-[13px] font-semibold text-foreground",children:t.name}),e.jsx("div",{className:"text-[11px] text-muted-foreground mt-1",children:r("{count} 个成员",{count:s})}),n.length>0&&e.jsxs("div",{className:"truncate text-[11px] text-muted-foreground mt-1.5",children:[n.join(", "),s>3?` +${s-3}`:""]})]},t.id)})})]}),e.jsx(Me,{isOpen:!!j,onClose:()=>re(null),onConfirm:et,title:r("删除"),description:j?r('确定删除 "{name}"?此操作不可撤销。',{name:j.name}):"",variant:"danger",confirmText:r("删除"),cancelText:r("取消"),isLoading:he.isPending}),e.jsx(wt,{isOpen:Ge,onClose:()=>se(!1),title:r("选择预设头像"),className:"max-w-2xl",children:e.jsx("div",{className:"grid grid-cols-4 gap-2 sm:grid-cols-5",children:At.map(t=>{const s=a.avatar===t.src;return e.jsxs("button",{type:"button",onClick:()=>Je(t.src),className:B("group rounded-xl border bg-background p-2 text-center transition-all hover:border-neutral-400 hover:bg-muted focus:outline-none focus:ring-2 focus:ring-neutral-900/15",s?"border-neutral-900 ring-2 ring-neutral-900/10":"border-border"),"aria-pressed":s,"aria-label":r("选择 {name} 头像",{name:t.label}),children:[e.jsx("img",{src:t.src,alt:t.label,loading:"lazy",className:"mx-auto h-14 w-14 rounded-full object-cover sm:h-16 sm:w-16"}),e.jsx("span",{className:"mt-1 block truncate text-[10px] font-medium text-muted-foreground",children:t.label})]},t.id)})})}),e.jsx(Me,{isOpen:!!N,onClose:()=>oe(null),onConfirm:rt,title:r("删除"),description:N?r('确定删除 "{name}"?此操作不可撤销。',{name:N.name}):"",variant:"danger",confirmText:r("删除"),cancelText:r("取消"),isLoading:ve.isPending})]})}export{ar as TeamSettingsPage};
@@ -1 +1 @@
1
- import{X as ln,Y as an,$ as C,a0 as q,a1 as $,a2 as un,a3 as y,a4 as tn,a5 as H,a6 as _,a7 as rn,a8 as o,a9 as on,aa as sn,ab as fn}from"./index-Cask0_DN.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,I,D,v,A,j,a){var O=I-l,i=D-h,n=j-v,d=a-A,u=d*O-n*i;if(!(u*u<y))return u=(n*(h-A)-d*(l-v))/u,[l+u*O,h+u*i]}function Q(l,h,I,D,v,A,j){var a=l-I,O=h-D,i=(j?A:-A)/H(a*a+O*O),n=i*O,d=-i*a,u=l+n,s=h+d,f=I+n,c=D+d,z=(u+f)/2,t=(s+c)/2,m=f-u,g=c-s,R=m*m+g*g,T=v-A,P=u*c-f*s,S=(g<0?-1:1)*H(on(0,T*T*R-P*P)),X=(P*g-m*S)/R,Y=(-P*m-g*S)/R,w=(P*g+m*S)/R,p=(-P*m+g*S)/R,x=X-z,e=Y-t,r=w-z,B=p-t;return x*x+e*e>r*r+B*B&&(X=w,Y=p),{cx:X,cy:Y,x01:-n,y01:-d,x11:X*(v/T-1),y11:Y*(v/T-1)}}function hn(){var l=cn,h=yn,I=$(0),D=null,v=gn,A=dn,j=mn,a=null,O=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-un,c=A.apply(this,arguments)-un,z=rn(c-f),t=c>f;if(a||(a=n=O()),s<u&&(d=s,s=u,u=d),!(s>y))a.moveTo(0,0);else if(z>tn-y)a.moveTo(s*C(f),s*q(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*C(c),u*q(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,R=f,T=c,P=z,S=z,X=j.apply(this,arguments)/2,Y=X>y&&(D?+D.apply(this,arguments):H(u*u+s*s)),w=_(rn(s-u)/2,+I.apply(this,arguments)),p=w,x=w,e,r;if(Y>y){var B=sn(Y/u*q(X)),J=sn(Y/s*q(X));(P-=B*2)>y?(B*=t?1:-1,R+=B,T-=B):(P=0,R=T=(f+c)/2),(S-=J*2)>y?(J*=t?1:-1,m+=J,g-=J):(S=0,m=g=(f+c)/2)}var F=s*C(m),G=s*q(m),K=u*C(T),L=u*q(T);if(w>y){var M=s*C(g),N=s*q(g),U=u*C(R),V=u*q(R),E;if(z<an)if(E=pn(F,G,U,V,M,N,K,L)){var W=F-E[0],Z=G-E[1],b=M-E[0],k=N-E[1],nn=1/q(fn((W*b+Z*k)/(H(W*W+Z*Z)*H(b*b+k*k)))/2),en=H(E[0]*E[0]+E[1]*E[1]);p=_(w,(u-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}S>y?x>y?(e=Q(U,V,F,G,s,x,t),r=Q(M,N,K,L,s,x,t),a.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),a.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(a.moveTo(F,G),a.arc(0,0,s,m,g,!t)):a.moveTo(F,G),!(u>y)||!(P>y)?a.lineTo(K,L):p>y?(e=Q(K,L,M,N,u,-p,t),r=Q(F,G,U,V,u,-p,t),a.lineTo(e.cx+e.x01,e.cy+e.y01),p<w?a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,u,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),a.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):a.arc(0,0,u,T,R,t)}if(a.closePath(),n)return a=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +A.apply(this,arguments))/2-an/2;return[C(d)*n,q(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:$(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:$(+n),i):h},i.cornerRadius=function(n){return arguments.length?(I=typeof n=="function"?n:$(+n),i):I},i.padRadius=function(n){return arguments.length?(D=n==null?null:typeof n=="function"?n:$(+n),i):D},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:$(+n),i):v},i.endAngle=function(n){return arguments.length?(A=typeof n=="function"?n:$(+n),i):A},i.padAngle=function(n){return arguments.length?(j=typeof n=="function"?n:$(+n),i):j},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as d};
1
+ import{X as ln,Y as an,$ as C,a0 as q,a1 as $,a2 as un,a3 as y,a4 as tn,a5 as H,a6 as _,a7 as rn,a8 as o,a9 as on,aa as sn,ab as fn}from"./index-CGMjRoF7.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,I,D,v,A,j,a){var O=I-l,i=D-h,n=j-v,d=a-A,u=d*O-n*i;if(!(u*u<y))return u=(n*(h-A)-d*(l-v))/u,[l+u*O,h+u*i]}function Q(l,h,I,D,v,A,j){var a=l-I,O=h-D,i=(j?A:-A)/H(a*a+O*O),n=i*O,d=-i*a,u=l+n,s=h+d,f=I+n,c=D+d,z=(u+f)/2,t=(s+c)/2,m=f-u,g=c-s,R=m*m+g*g,T=v-A,P=u*c-f*s,S=(g<0?-1:1)*H(on(0,T*T*R-P*P)),X=(P*g-m*S)/R,Y=(-P*m-g*S)/R,w=(P*g+m*S)/R,p=(-P*m+g*S)/R,x=X-z,e=Y-t,r=w-z,B=p-t;return x*x+e*e>r*r+B*B&&(X=w,Y=p),{cx:X,cy:Y,x01:-n,y01:-d,x11:X*(v/T-1),y11:Y*(v/T-1)}}function hn(){var l=cn,h=yn,I=$(0),D=null,v=gn,A=dn,j=mn,a=null,O=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-un,c=A.apply(this,arguments)-un,z=rn(c-f),t=c>f;if(a||(a=n=O()),s<u&&(d=s,s=u,u=d),!(s>y))a.moveTo(0,0);else if(z>tn-y)a.moveTo(s*C(f),s*q(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*C(c),u*q(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,R=f,T=c,P=z,S=z,X=j.apply(this,arguments)/2,Y=X>y&&(D?+D.apply(this,arguments):H(u*u+s*s)),w=_(rn(s-u)/2,+I.apply(this,arguments)),p=w,x=w,e,r;if(Y>y){var B=sn(Y/u*q(X)),J=sn(Y/s*q(X));(P-=B*2)>y?(B*=t?1:-1,R+=B,T-=B):(P=0,R=T=(f+c)/2),(S-=J*2)>y?(J*=t?1:-1,m+=J,g-=J):(S=0,m=g=(f+c)/2)}var F=s*C(m),G=s*q(m),K=u*C(T),L=u*q(T);if(w>y){var M=s*C(g),N=s*q(g),U=u*C(R),V=u*q(R),E;if(z<an)if(E=pn(F,G,U,V,M,N,K,L)){var W=F-E[0],Z=G-E[1],b=M-E[0],k=N-E[1],nn=1/q(fn((W*b+Z*k)/(H(W*W+Z*Z)*H(b*b+k*k)))/2),en=H(E[0]*E[0]+E[1]*E[1]);p=_(w,(u-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}S>y?x>y?(e=Q(U,V,F,G,s,x,t),r=Q(M,N,K,L,s,x,t),a.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),a.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(a.moveTo(F,G),a.arc(0,0,s,m,g,!t)):a.moveTo(F,G),!(u>y)||!(P>y)?a.lineTo(K,L):p>y?(e=Q(K,L,M,N,u,-p,t),r=Q(F,G,U,V,u,-p,t),a.lineTo(e.cx+e.x01,e.cy+e.y01),p<w?a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,u,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),a.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):a.arc(0,0,u,T,R,t)}if(a.closePath(),n)return a=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +A.apply(this,arguments))/2-an/2;return[C(d)*n,q(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:$(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:$(+n),i):h},i.cornerRadius=function(n){return arguments.length?(I=typeof n=="function"?n:$(+n),i):I},i.padRadius=function(n){return arguments.length?(D=n==null?null:typeof n=="function"?n:$(+n),i):D},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:$(+n),i):v},i.endAngle=function(n){return arguments.length?(A=typeof n=="function"?n:$(+n),i):A},i.padAngle=function(n){return arguments.length?(j=typeof n=="function"?n:$(+n),i):j},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as d};