@shumai-one/shumai 0.4.0 → 0.4.2

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 (184) hide show
  1. package/bin/{chunk-2xgvs3as.js → chunk-07h4b77v.js} +2 -2
  2. package/bin/{chunk-gazp5662.js → chunk-0t4n4d5w.js} +2 -2
  3. package/bin/{chunk-x9akgj7w.js → chunk-1611z9jg.js} +2 -2
  4. package/bin/{chunk-kvnfgr29.js → chunk-1phqxp6z.js} +1 -1
  5. package/bin/chunk-23hckrrz.js +2 -0
  6. package/bin/{chunk-ymr5ybxk.js → chunk-30z44j1g.js} +2 -2
  7. package/bin/{chunk-fcsfssar.js → chunk-3j463k1g.js} +1 -1
  8. package/bin/{chunk-zye42cfp.js → chunk-4181tdds.js} +1 -1
  9. package/bin/chunk-480jtqng.js +4 -0
  10. package/bin/{chunk-m8z8jvdq.js → chunk-4c3g146q.js} +2 -2
  11. package/bin/chunk-4ca0zt5e.js +1 -0
  12. package/bin/chunk-4d9bgmf2.js +2 -0
  13. package/bin/{chunk-fvbd5dk7.js → chunk-4ev56fss.js} +5 -5
  14. package/bin/{chunk-zmyawgth.js → chunk-4gk52tjq.js} +1 -1
  15. package/bin/chunk-4mdqkj4d.js +1 -0
  16. package/bin/{chunk-mhps85dd.js → chunk-4r91fggc.js} +1 -1
  17. package/bin/chunk-50fb1x3w.js +1 -0
  18. package/bin/chunk-59gj1njz.js +1 -0
  19. package/bin/{chunk-j04sztp3.js → chunk-5pr0t7fb.js} +1 -1
  20. package/bin/chunk-5vewxmz7.js +3 -0
  21. package/bin/chunk-62zx96pe.js +2 -0
  22. package/bin/chunk-63y0eb07.js +2 -0
  23. package/bin/chunk-6d5xrgfx.js +2 -0
  24. package/bin/{chunk-etprs58p.js → chunk-6gbtz5bf.js} +2 -2
  25. package/bin/{chunk-wrgwjg2g.js → chunk-6gjg5egq.js} +1 -1
  26. package/bin/{chunk-4q782s34.js → chunk-6m4jz9s1.js} +3 -3
  27. package/bin/{chunk-wehhpcm1.js → chunk-6s4x525w.js} +1 -1
  28. package/bin/{chunk-xzag8w1v.js → chunk-6w2wmvqs.js} +1 -1
  29. package/bin/{chunk-r2shjtte.js → chunk-77d23vcn.js} +2 -2
  30. package/bin/{chunk-vhcqazqf.js → chunk-77m5p188.js} +2 -2
  31. package/bin/chunk-7bvx087f.js +1 -0
  32. package/bin/chunk-7pfjfrjg.js +5 -0
  33. package/bin/{chunk-1qr0ajc8.js → chunk-7q10s127.js} +1 -1
  34. package/bin/{chunk-c3msq02x.js → chunk-7thx8ctx.js} +2 -2
  35. package/bin/{chunk-vvhs586e.js → chunk-8t4s91gh.js} +1 -1
  36. package/bin/{chunk-k3r97v7j.js → chunk-98ey5p2e.js} +1 -1
  37. package/bin/{chunk-44edgqvy.js → chunk-9amndcyh.js} +3 -3
  38. package/bin/chunk-9bk23g9x.js +1 -0
  39. package/bin/chunk-9mkcfy43.js +1 -0
  40. package/bin/{chunk-0h8rjeyj.js → chunk-9t3nsq5n.js} +2 -2
  41. package/bin/{chunk-j536e9nx.js → chunk-9tjq99ds.js} +2 -2
  42. package/bin/chunk-9wm9rwh1.js +2 -0
  43. package/bin/{chunk-nz2v1jmd.js → chunk-ab16fyg4.js} +2 -2
  44. package/bin/chunk-arv0g2av.js +1 -0
  45. package/bin/{chunk-hx2mvd20.js → chunk-aytj4zxg.js} +2 -2
  46. package/bin/{chunk-02afmyqy.js → chunk-b1ypjqgp.js} +2 -2
  47. package/bin/{chunk-93ecxcy4.js → chunk-bdjv0ykq.js} +1 -1
  48. package/bin/chunk-c1k86mfa.js +10 -0
  49. package/bin/{chunk-wy2f6mby.js → chunk-caa96dgd.js} +1 -1
  50. package/bin/chunk-ce4v2yjy.js +1 -0
  51. package/bin/{chunk-m2tbft2c.js → chunk-cqh60y54.js} +2 -2
  52. package/bin/chunk-cvq7zgw7.js +1 -0
  53. package/bin/{chunk-tcm57j8r.js → chunk-d9mjbtp2.js} +2 -2
  54. package/bin/{chunk-xkhwj8mw.js → chunk-dn7sbjws.js} +2 -2
  55. package/bin/{chunk-p49h5fxs.js → chunk-dxyq9h8n.js} +1 -1
  56. package/bin/{chunk-3twtxs5m.js → chunk-e3cabksx.js} +1 -1
  57. package/bin/{chunk-52dr035y.js → chunk-egcrbj94.js} +2 -2
  58. package/bin/chunk-ev17v1mv.js +2 -0
  59. package/bin/chunk-evtpwg71.js +2 -0
  60. package/bin/{chunk-2rbexbv0.js → chunk-f3e0nsv2.js} +1 -1
  61. package/bin/chunk-f40gjqpq.js +2 -0
  62. package/bin/chunk-fe7822ak.js +299 -0
  63. package/bin/{chunk-4b7jcpgv.js → chunk-g8tkhw9j.js} +2 -2
  64. package/bin/{chunk-mgnxa0vy.js → chunk-g9r0p4t8.js} +1 -1
  65. package/bin/chunk-gbjyh9ms.js +1 -0
  66. package/bin/{chunk-thbfw1ed.js → chunk-gtbsb39v.js} +1 -1
  67. package/bin/{chunk-zh752hw8.js → chunk-gytz1q13.js} +1 -1
  68. package/bin/chunk-h0fxysxs.js +7 -0
  69. package/bin/{chunk-aw5zkdma.js → chunk-h8bdvsqt.js} +2 -2
  70. package/bin/{chunk-76433x4d.js → chunk-hag024w8.js} +2 -2
  71. package/bin/chunk-hc6w5nw4.js +7 -0
  72. package/bin/chunk-j69dqc48.js +2 -0
  73. package/bin/{chunk-yfqz6f72.js → chunk-jbtw1zym.js} +1 -1
  74. package/bin/{chunk-9k76s3y6.js → chunk-jc1vb7rj.js} +2 -2
  75. package/bin/{chunk-41d9gkx7.js → chunk-jdv78w9r.js} +1 -1
  76. package/bin/{chunk-dag45evp.js → chunk-jjs70y9v.js} +1 -1
  77. package/bin/{chunk-ysvhtgve.js → chunk-jmdar2gz.js} +2 -2
  78. package/bin/chunk-jvwz10n4.js +2 -0
  79. package/bin/{chunk-ck6msfch.js → chunk-k47md1g4.js} +2 -2
  80. package/bin/{chunk-yyjx8nbq.js → chunk-k4v0brcb.js} +1 -1
  81. package/bin/chunk-k6n7c07e.js +1 -0
  82. package/bin/{chunk-kjjhvrk1.js → chunk-kk2cstsg.js} +1 -1
  83. package/bin/{chunk-3r33kewe.js → chunk-knz4h56q.js} +3 -3
  84. package/bin/{chunk-j5rx3x1q.js → chunk-kqqtt6bd.js} +1 -1
  85. package/bin/{chunk-ez6veng7.js → chunk-kvyp1t4j.js} +1 -1
  86. package/bin/{chunk-djx2r4nj.js → chunk-kxskpgsq.js} +2 -2
  87. package/bin/{chunk-3gjn4pyp.js → chunk-m6srbjcs.js} +2 -2
  88. package/bin/{chunk-8956rryj.js → chunk-mcc1scxs.js} +2 -2
  89. package/bin/{chunk-0bfqrx5q.js → chunk-mq83a0kk.js} +2 -2
  90. package/bin/chunk-mxm8g4q0.js +1 -0
  91. package/bin/{chunk-6m1k317a.js → chunk-nhpgdqq5.js} +2 -2
  92. package/bin/{chunk-pdjar480.js → chunk-nne496aa.js} +2 -2
  93. package/bin/{chunk-s73c0brj.js → chunk-nqpb0r9h.js} +1 -1
  94. package/bin/chunk-ns0zww9g.js +2 -0
  95. package/bin/{chunk-9cmvymm5.js → chunk-ps4xfp23.js} +1 -1
  96. package/bin/chunk-pz2ec6xt.js +2 -0
  97. package/bin/{chunk-vkgxrn1h.js → chunk-q163k309.js} +2 -2
  98. package/bin/chunk-q1da61ps.js +1 -0
  99. package/bin/{chunk-7x1vkftb.js → chunk-qrf0ady6.js} +2 -2
  100. package/bin/{chunk-d7en47eh.js → chunk-qy28f25e.js} +1 -1
  101. package/bin/{chunk-xjnghr99.js → chunk-r7s4ypw1.js} +1 -1
  102. package/bin/chunk-ran23vm9.js +1 -0
  103. package/bin/chunk-rfvdc4n0.js +2 -0
  104. package/bin/{chunk-8rcfhfq5.js → chunk-rgthkvgx.js} +1 -1
  105. package/bin/chunk-s39n3yw3.js +2 -0
  106. package/bin/{chunk-xv5h4dv1.js → chunk-s7wdd0g7.js} +1 -1
  107. package/bin/{chunk-n8gsjwht.js → chunk-s88ha5kx.js} +2 -2
  108. package/bin/chunk-sf91bt9m.js +2 -0
  109. package/bin/{chunk-2x46963w.js → chunk-sjwbjf9j.js} +1 -1
  110. package/bin/chunk-t62076pv.js +1 -0
  111. package/bin/{chunk-he1ywtxx.js → chunk-tbbwss3v.js} +1 -1
  112. package/bin/{chunk-06spnkta.js → chunk-tjcc7a6y.js} +1 -1
  113. package/bin/{chunk-qac5hr5h.js → chunk-tp6ab26e.js} +1 -1
  114. package/bin/{chunk-md12a1sf.js → chunk-v2wxk9p5.js} +2 -2
  115. package/bin/chunk-vbk6y4hk.js +2 -0
  116. package/bin/{chunk-vcf2qk9h.js → chunk-vfgfg5fk.js} +2 -2
  117. package/bin/{chunk-gjnrd32m.js → chunk-vm6c3xx9.js} +2 -2
  118. package/bin/{chunk-agabtxrc.js → chunk-vsx96mt6.js} +1 -1
  119. package/bin/{chunk-et0cewj7.js → chunk-wbyw1shz.js} +2 -2
  120. package/bin/chunk-whh2vh50.css +1 -0
  121. package/bin/{chunk-792t2653.js → chunk-wjkcq65s.js} +2 -2
  122. package/bin/{chunk-5yhn31rd.js → chunk-wkefwkfp.js} +1 -1
  123. package/bin/{chunk-gcc6pte2.js → chunk-x7bsnk1e.js} +2 -2
  124. package/bin/{chunk-tn67sjb2.js → chunk-xbhw6bpz.js} +2 -2
  125. package/bin/{chunk-34kaja59.js → chunk-xg5yrcj5.js} +2 -2
  126. package/bin/{chunk-wzmpvadf.js → chunk-xw2gpcsh.js} +1 -1
  127. package/bin/{chunk-sx6y697s.js → chunk-ycq8ank7.js} +1 -1
  128. package/bin/chunk-yp9hvkc5.js +73 -0
  129. package/bin/{chunk-dkjkn8t3.js → chunk-ytypyfkc.js} +2 -2
  130. package/bin/{chunk-62ebss6h.js → chunk-z1kjmf60.js} +2 -2
  131. package/bin/chunk-z36bx86r.js +2 -0
  132. package/bin/chunk-z7hdnecp.js +3 -0
  133. package/bin/chunk-zeby1cq7.js +2 -0
  134. package/bin/chunk-zs5e8z1w.js +1 -0
  135. package/bin/chunk-zxnyefg5.js +2 -0
  136. package/bin/shumai-app.html +1 -1
  137. package/bin/shumai-app.js +312 -342
  138. package/package.json +7 -7
  139. package/prisma/schema.prisma +1 -1
  140. package/bin/chunk-045f1bw7.js +0 -2
  141. package/bin/chunk-0n1wfwcm.js +0 -2
  142. package/bin/chunk-1fwzepfn.js +0 -2
  143. package/bin/chunk-2xevs82j.js +0 -2
  144. package/bin/chunk-31y5j4hr.js +0 -1
  145. package/bin/chunk-34adtqqh.js +0 -1
  146. package/bin/chunk-4j8fbckp.js +0 -1
  147. package/bin/chunk-57s7yj35.js +0 -1
  148. package/bin/chunk-6tse78c7.js +0 -2
  149. package/bin/chunk-8nyve0cr.js +0 -7
  150. package/bin/chunk-ajndx51c.js +0 -2
  151. package/bin/chunk-bbyc2jfq.js +0 -1
  152. package/bin/chunk-br7d2qwc.js +0 -1
  153. package/bin/chunk-by6g0vye.js +0 -2
  154. package/bin/chunk-c24fvhm6.js +0 -1
  155. package/bin/chunk-c6aszz6p.js +0 -1
  156. package/bin/chunk-csqvmx1m.js +0 -2
  157. package/bin/chunk-dg8c91j5.js +0 -1
  158. package/bin/chunk-dk8vk17v.js +0 -2
  159. package/bin/chunk-ex2ym5pz.js +0 -2
  160. package/bin/chunk-f2zbsrc9.js +0 -2
  161. package/bin/chunk-gcpr2a24.js +0 -7
  162. package/bin/chunk-gpjkegdp.js +0 -1
  163. package/bin/chunk-jt6d0zb1.js +0 -2
  164. package/bin/chunk-jwgfkpek.js +0 -3
  165. package/bin/chunk-k2065y29.js +0 -2
  166. package/bin/chunk-k514bttd.js +0 -1
  167. package/bin/chunk-k7chm9a9.js +0 -2
  168. package/bin/chunk-kjgejwjp.css +0 -1
  169. package/bin/chunk-kqpzx5az.js +0 -73
  170. package/bin/chunk-kxr8fjsq.js +0 -2
  171. package/bin/chunk-mha3rsh7.js +0 -2
  172. package/bin/chunk-nn0px81k.js +0 -307
  173. package/bin/chunk-ns804tmv.js +0 -2
  174. package/bin/chunk-p1temt1j.js +0 -1
  175. package/bin/chunk-rkz6x3r0.js +0 -2
  176. package/bin/chunk-svz0ds0g.js +0 -1
  177. package/bin/chunk-t31basc5.js +0 -1
  178. package/bin/chunk-t6qdrw24.js +0 -1
  179. package/bin/chunk-wvwqgff4.js +0 -1
  180. package/bin/chunk-ww1cy08p.js +0 -1
  181. package/bin/chunk-xfp27ya9.js +0 -2
  182. package/bin/chunk-y0f4bc9f.js +0 -2
  183. package/bin/chunk-y2s0tjaa.js +0 -3
  184. package/bin/chunk-y3dy4pdt.js +0 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shumai-one/shumai",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "A fullstack AI-powered media workspace and workflow engine",
5
5
  "type": "module",
6
6
  "bin": {
@@ -27,12 +27,12 @@
27
27
  "zod": "4.4.3"
28
28
  },
29
29
  "optionalDependencies": {
30
- "@shumai-one/shumai-darwin-arm64": "0.4.0",
31
- "@shumai-one/shumai-darwin-x64": "0.4.0",
32
- "@shumai-one/shumai-linux-arm64": "0.4.0",
33
- "@shumai-one/shumai-linux-x64": "0.4.0",
34
- "@shumai-one/shumai-win32-arm64": "0.4.0",
35
- "@shumai-one/shumai-win32-x64": "0.4.0"
30
+ "@shumai-one/shumai-darwin-arm64": "0.4.2",
31
+ "@shumai-one/shumai-darwin-x64": "0.4.2",
32
+ "@shumai-one/shumai-linux-arm64": "0.4.2",
33
+ "@shumai-one/shumai-linux-x64": "0.4.2",
34
+ "@shumai-one/shumai-win32-arm64": "0.4.2",
35
+ "@shumai-one/shumai-win32-x64": "0.4.2"
36
36
  },
37
37
  "repository": {
38
38
  "type": "git",
@@ -117,7 +117,7 @@ enum WorkflowTaskType {
117
117
  chat
118
118
  ai_embedding
119
119
  query_embedding_for_search
120
- agent_tool_call
120
+ agent_tool_call // @deprecated: Agent tools now execute directly in-process via Core services
121
121
  kanban_agent_run
122
122
  }
123
123
 
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Oa as e,Pa as p,Qa as t}from"./chunk-44edgqvy.js";import"./chunk-3r33kewe.js";import"./chunk-n8gsjwht.js";import"./chunk-hx2mvd20.js";import"./chunk-8rcfhfq5.js";import"./chunk-c3msq02x.js";import"./chunk-p49h5fxs.js";export{t as kyselyAdapter,e as getKyselyDatabaseType,p as createKyselyAdapter};
@@ -1,2 +0,0 @@
1
- import{dg as v}from"./chunk-y2s0tjaa.js";import{eg as _z,fg as $z,gg as Kz,hg as Uz,ig as Vz}from"./chunk-yyjx8nbq.js";import{jg as I}from"./chunk-zye42cfp.js";import{_g as Yz}from"./chunk-7x1vkftb.js";import{bh as S}from"./chunk-ck6msfch.js";import{Ch as Zz}from"./chunk-2xgvs3as.js";import{mi as Xz}from"./chunk-02afmyqy.js";import{Ci as o,qi as n,ti as r}from"./chunk-8nyve0cr.js";import{Hj as e,Jj as s,Kl as Jz,Pl as w,Qj as T,Rj as zz,Vi as Mz,Wi as M,Wj as b,Xi as z,Yi as J,bl as Gz,mm as Y,wj as t,yk as h,yl as A}from"./chunk-kqpzx5az.js";import{kn as Bz}from"./chunk-p49h5fxs.js";var Z=Bz(Mz(),1);function gz({projectId:V,contextAssetId:R}){let{isHistoryMode:L,setIsHistoryMode:p,currentSessionId:Wz,chatAssets:u,removeAsset:Lz,messages:E,historySessions:g,isStreaming:D,fetchHistorySessions:m,loadSession:Nz,deleteSession:Qz,startNewSession:Pz,sendMessage:Oz,abortActiveSession:Dz,selectedAgentId:F,setSelectedAgentId:B,inputText:C,setInputText:l}=v(),{teamId:W,ensureTeamIdForProject:j}=Xz();Z.useEffect(()=>{if(V)j(V)},[V,j]);let{data:qz=[],isSuccess:d}=r({queryKey:["chat-agents",V],queryFn:async()=>{if(!V)return[];let G=await o.api.projects[":projectId"]["chat-agents"].$get({param:{projectId:V}});if(!G.ok)throw Error("failed to fetch agents");return G.json()},enabled:!!V}),H=qz.filter((G)=>G.type==="chat"&&G.enabled);Z.useEffect(()=>{if(!d)return;if(H.length>0){if(!H.some((X)=>X.id===F))B(H[0].id)}else if(F!==null)B(null)},[d,H,F,B]);let x=Z.useRef(null),y=Z.useRef(null),k=Z.useRef(!0),f=Z.useRef(!0);Z.useEffect(()=>{f.current=!0,k.current=!0},[V,R,L]),Z.useEffect(()=>{let G=y.current?.querySelector('[data-slot="scroll-area-viewport"]');if(!G)return;let{scrollTop:X,isAtBottom:_}=v.getState(),U=setTimeout(()=>{if(_)G.scrollTop=G.scrollHeight;else G.scrollTop=X;let P=setTimeout(()=>{f.current=!1},50);return()=>clearTimeout(P)},0);return()=>clearTimeout(U)},[V,R,L]),Z.useEffect(()=>{let G=y.current?.querySelector('[data-slot="scroll-area-viewport"]');if(!G)return;let X=()=>{if(f.current)return;let _=G.scrollTop,U=G.scrollHeight-_-G.clientHeight<10;v.getState().setScrollState(_,U)};return G.addEventListener("scroll",X),()=>{G.removeEventListener("scroll",X)}},[V,R,L]);let{ref:Ez,isDropTarget:Fz}=Yz({id:"chatbot-sidebar",data:{type:"chatbot-sidebar"}});Z.useEffect(()=>{if(!L){let{isAtBottom:G}=v.getState();if(G||D){let X=k.current?"auto":"smooth";x.current?.scrollIntoView({behavior:X})}k.current=!1}},[E,D,L]),Z.useEffect(()=>{if(L&&W)m(W)},[L,m,W]);let q=n(),Hz=Z.useCallback(()=>{q.invalidateQueries({queryKey:["search"]}),q.invalidateQueries({queryKey:["folders"]}),q.invalidateQueries({queryKey:["files"]}),q.invalidateQueries({queryKey:["file"]}),q.invalidateQueries({queryKey:["version_stacks"]}),q.invalidateQueries({queryKey:["projects"]})},[q]),i=()=>{if(!C.trim()||D||!W)return;Oz(W,C,V,R,Hz),l("")},Cz=(G)=>{if(G.nativeEvent.isComposing)return;if(G.key==="Enter"&&!G.shiftKey)G.preventDefault(),i()},a=(G)=>{if(typeof G==="string")return G;if(Array.isArray(G))return G.map((X)=>{if(typeof X==="string")return X;if(X&&typeof X==="object"&&"type"in X&&X.type==="text"&&"text"in X)return String(X.text);return""}).join("");return""},c=(G)=>{return G.replace(/<@([a-zA-Z0-9_-]+)>/g,"@$1").replace(/^\[([^\]]+)\]:/gm,"\\[$1\\]:")},vz=(G)=>{switch(G.role){case"user":return z("div",{className:"flex justify-end w-full",children:z("div",{className:"bg-primary text-primary-foreground rounded-lg px-3 py-2 max-w-[85%] text-sm whitespace-pre-wrap shadow-xs break-words",children:a(G.content)})},G.id);case"assistant":{let _=G.content;if(!_)return null;let U=[];if(_.forEach(($,N)=>{if(!$||typeof $!=="object")return;let Q=$;switch(Q.type){case"text":{let K=Q.text;if(typeof K!=="string"||!K.trim())return;U.push(z("div",{className:"text-sm leading-[1.8] prose prose-sm dark:prose-invert max-w-none break-words",children:z(I,{components:{pre:({node:O,...Rz})=>z("pre",{className:"whitespace-pre-wrap break-all break-words bg-muted text-foreground p-4 rounded-md border border-border/50 font-mono text-sm",...Rz})},children:c(K)})},`txt-${N}`));break}case"thinking":{let K=Q.thinking;if(typeof K!=="string"||!K.trim())return;U.push(J("details",{className:"group border border-border/50 rounded-lg bg-muted/20 my-2 overflow-hidden",children:[J("summary",{className:"flex items-center gap-2 p-2.5 text-xs font-medium text-muted-foreground select-none cursor-pointer hover:bg-muted/40 transition-colors list-none [&::-webkit-details-marker]:hidden",children:[z(zz,{className:"h-3.5 w-3.5 text-primary/70 animate-pulse"}),z("span",{children:Y.role_thinking()||"Thinking"}),z(b,{className:"h-3 w-3 ml-auto transition-transform group-open:rotate-180"})]}),z("div",{className:"p-3 pt-0 text-xs text-muted-foreground/90 border-t border-border/40 bg-muted/10 leading-relaxed prose prose-sm dark:prose-invert max-w-none whitespace-pre-wrap font-sans",children:z(I,{children:c(K)})})]},`think-${N}`));break}case"toolCall":{let K=String(Q.name||Q.toolName||Y.unknown()),O=Q.arguments||Q.args;U.push(J("details",{className:"group border border-border/50 rounded-lg bg-violet-500/5 my-2 overflow-hidden",children:[J("summary",{className:"flex items-center gap-2 p-2.5 text-xs font-semibold text-violet-600 dark:text-violet-400 select-none cursor-pointer hover:bg-violet-500/10 transition-colors list-none [&::-webkit-details-marker]:hidden",children:[z(Jz,{className:"h-3.5 w-3.5"}),z("span",{children:Y.calling_tool()}),z("span",{className:"font-mono bg-violet-500/10 px-1.5 py-0.5 rounded text-[11px] text-violet-700 dark:text-violet-300",children:K}),z(b,{className:"h-3 w-3 ml-auto transition-transform group-open:rotate-180"})]}),!!O&&J("div",{className:"p-3 pt-0 text-[10px] text-muted-foreground/90 border-t border-border/40 bg-violet-500/5 font-sans",children:[z("div",{className:"text-[9px] text-muted-foreground/60 uppercase font-bold tracking-wider mb-1.5",children:Y.tool_arguments()||"Arguments"}),z("pre",{className:"font-mono bg-muted/30 p-2 rounded border border-border/30 overflow-x-auto max-h-32",children:JSON.stringify(O,null,2)})]})]},`tool-${N}`));break}case"image":{let K=String(Q.mimeType||"image/png"),O=String(Q.data||"");U.push(z("div",{className:"my-2 max-w-full",children:O?z("img",{src:O.startsWith("data:")?O:`data:${K};base64,${O}`,alt:"Attached asset",className:"max-h-60 rounded border border-border/50 object-contain shadow-xs"}):z("div",{className:"text-xs text-muted-foreground italic flex items-center gap-1.5 py-1",children:Y.image_object()})},`img-${N}`));break}default:{let K=JSON.stringify($,null,2);if(K==="{}")return;U.push(z("pre",{className:"text-xs text-foreground/80 font-mono whitespace-pre-wrap break-words bg-muted/20 p-2 rounded",children:K},`other-${N}`))}}}),U.length===0)return null;let P=!1;if(_.length>0){let $=_[_.length-1];if(typeof $==="string"&&$.trim().length>0)P=!0;else if($&&typeof $==="object"){let N=$;if(N.type==="text"&&typeof N.text==="string"&&N.text.trim().length>0)P=!0}}return J("div",{className:"flex flex-col w-full space-y-1",children:[z("div",{className:"space-y-2 w-full",children:U}),P&&z("div",{className:"text-[10px] text-muted-foreground self-start italic pt-1",children:Y.created_by_agent()})]},G.id)}case"toolResult":return z("div",{className:"flex items-center gap-2 text-xs text-muted-foreground bg-muted/40 p-2 rounded-md border border-border/50",children:z("span",{className:"font-semibold",children:Y.tool_result_with_name({name:G.toolName||"tool"})})},G.id);case"thinking_level_change":case"custom":{let X=G;if(X.customType==="context_display_info"){let P=X.details?.assets||[];if(P.length===0)return null;return J("div",{className:"text-xs text-muted-foreground bg-muted/40 p-2.5 rounded-lg border border-border/50 space-y-1 my-1",children:[z("div",{className:"font-semibold",children:Y.assets_added_to_context()}),z("ul",{className:"list-disc list-inside space-y-0.5",children:P.map(($)=>J("li",{className:"truncate",children:[$.name," ",J("span",{className:"text-muted-foreground/70",children:["(",$.type,")"]})]},$.id))})]},G.id)}let _=X.content||"";return z("div",{className:"text-center text-xs text-muted-foreground italic bg-muted/20 py-1.5 rounded",children:a(_)},G.id)}default:return null}};return J("div",{ref:Ez,className:w("relative flex flex-col h-full bg-background transition-colors duration-200 min-h-0"),children:[Fz&&z("div",{className:"absolute inset-0 bg-accent/30 border-2 border-primary z-50 pointer-events-none flex items-center justify-center p-6 text-center animate-in fade-in duration-150",children:J("div",{className:"bg-background/95 text-foreground px-4 py-3 rounded-xl border border-border/80 flex flex-col items-center gap-2 shadow-lg max-w-[80%] animate-in zoom-in-95 duration-150",children:[z(T,{className:"h-6 w-6 text-primary animate-bounce"}),z("span",{className:"text-sm font-semibold text-foreground",children:Y.chatbot_drag_drop_hint()||"Drop assets here"})]})}),z("div",{className:"flex items-center justify-between p-4 pt-[0.7rem] flex-shrink-0",children:L?J(M,{children:[z("div",{className:"flex items-center gap-2 font-semibold",children:z("span",{children:Y.history()})}),z("button",{onClick:()=>p(!1),className:"p-1.5 hover:bg-accent rounded-md text-muted-foreground hover:text-foreground transition-colors",title:"Close History",children:z(e,{className:"h-4 w-4"})})]}):J(M,{children:[z("div",{className:"flex items-center gap-2 font-semibold",children:z("span",{children:Y.shumai_agent()})}),J("div",{className:"flex items-center gap-1",children:[z("button",{onClick:Pz,className:"p-1.5 hover:bg-accent rounded-md text-muted-foreground hover:text-foreground transition-colors",title:Y.new_chat(),children:z(Gz,{className:"h-4 w-4"})}),z("button",{onClick:()=>p(!0),className:"p-1.5 hover:bg-accent rounded-md text-muted-foreground hover:text-foreground transition-colors",title:Y.history(),children:z(h,{className:"h-4 w-4"})})]})]})}),L?z(S,{className:"flex-1 p-4 min-h-0",children:g.length===0?J("div",{className:"flex flex-col items-center justify-center h-48 text-muted-foreground p-4 text-center",children:[z(h,{className:"h-8 w-8 mb-2 opacity-50 text-muted-foreground"}),z("p",{className:"text-sm",children:Y.no_history_sessions()})]}):z("div",{className:"space-y-2 pb-4",children:g.map((G)=>{let X=G.id===Wz;return J("div",{className:w("group relative flex items-center justify-between p-3 border rounded-lg transition-all cursor-pointer bg-card",X?"border-primary":"border-border hover:bg-accent/30"),children:[J("div",{onClick:()=>W&&Nz(W,G.id),className:"flex-1 min-w-0 pr-6",children:[z("div",{className:"text-sm font-semibold text-foreground truncate",children:G.name||Y.new_chat()}),z("div",{className:"text-xs text-muted-foreground mt-0.5",children:Zz(G.createdAt)})]}),z("button",{onClick:(_)=>{if(_.stopPropagation(),W&&confirm(Y.delete_session_confirm()))Qz(W,G.id)},className:"absolute right-3 opacity-0 group-hover:opacity-100 focus:opacity-100 transition-opacity text-muted-foreground hover:text-destructive p-1 rounded hover:bg-muted",title:"Delete Session",children:z(A,{className:"h-4 w-4"})})]},G.id)})})}):J(M,{children:[z(S,{ref:y,className:"flex-1 p-4 min-h-0 [&>div>div]:!block",children:E.length===0?J("div",{className:"flex flex-col items-center justify-center h-48 border-2 border-dashed border-border rounded-lg text-muted-foreground p-4 text-center",children:[z(T,{className:"h-8 w-8 mb-2 opacity-50 text-muted-foreground"}),z("p",{className:"text-sm",children:Y.chatbot_drag_drop_hint()})]}):J("div",{className:"space-y-4 pb-4",children:[E.map(vz),D&&E.length>0&&E[E.length-1].role==="user"&&J("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground italic",children:[z(t,{className:"h-3 w-3 animate-spin text-primary"}),z("span",{children:"Thinking..."})]}),z("div",{ref:x})]})}),z("div",{className:"p-2 flex-shrink-0 bg-background",children:J("div",{className:"relative flex flex-col w-full border border-foreground/20 rounded-2xl shadow-xs transition-all duration-200 focus-within:ring-2 focus-within:ring-primary focus-within:border-transparent bg-background overflow-hidden",children:[u.length>0&&z("div",{className:"flex flex-col gap-1.5 min-h-0 max-h-[160px] overflow-y-auto border-b border-border bg-muted/5 p-3 divide-y divide-border/50",children:u.map((G)=>J("div",{className:"flex items-center justify-between py-1.5 text-xs group",children:[J("div",{className:"flex items-baseline gap-1.5 min-w-0 pr-2",children:[z("span",{className:"truncate font-medium text-foreground",children:G.name}),z("span",{className:"text-[9px] text-muted-foreground uppercase flex-shrink-0",children:G.type})]}),z("button",{onClick:()=>Lz(G.id),className:"text-muted-foreground hover:text-destructive transition-colors p-0.5",title:Y.remove_from_context(),children:z(A,{className:"h-3.5 w-3.5"})})]},G.id))}),z("textarea",{value:C,onChange:(G)=>l(G.target.value),onKeyDown:Cz,placeholder:"Type a message...",rows:2,className:"w-full bg-transparent border-none focus:ring-0 focus:outline-hidden resize-none min-h-[44px] max-h-[120px] px-3 py-2 text-sm focus-visible:outline-hidden focus:ring-transparent focus:border-transparent focus-visible:ring-0",disabled:D}),J("div",{className:"flex justify-between items-center px-3 pb-2 pt-1",children:[z("div",{className:"flex items-center gap-1.5 min-w-0 max-w-[70%]",children:H.length>0?J(_z,{value:F||"",onValueChange:(G)=>B(G),disabled:D,children:[z(Kz,{className:"h-8 border-none bg-transparent hover:bg-muted text-muted-foreground hover:text-foreground focus:ring-0 focus:ring-offset-0 px-2 py-0 gap-1.5 text-xs shrink-0 select-none shadow-none max-w-full",children:z($z,{placeholder:Y.select_agent()})}),z(Uz,{children:H.map((G)=>z(Vz,{value:G.id,children:J("div",{className:"flex items-center gap-2",children:[G.avatar?z("img",{src:G.avatar,alt:G.name,className:"w-4 h-4 rounded-full object-cover"}):z(T,{className:"w-4 h-4 text-muted-foreground"}),z("span",{className:"text-xs",children:G.name})]})},G.id))})]}):z("div",{className:"flex items-center gap-1.5 px-2 py-1 text-[11px] text-muted-foreground/60 italic select-none",children:z("span",{children:Y.no_chat_agents_warning()})})}),D?z("button",{onClick:()=>{if(W)Dz(W)},className:"p-2 rounded-full transition-all duration-200 flex items-center justify-center shrink-0 shadow-sm bg-destructive text-destructive-foreground hover:bg-destructive/90 transform hover:-translate-y-0.5",title:"Stop generation",children:z("div",{className:"h-4 w-4 flex items-center justify-center",children:z("div",{className:"h-3 w-3 bg-current rounded-[2px] bg-white"})})}):z("button",{onClick:i,disabled:!C.trim()||!F,className:w("p-2 rounded-full transition-all duration-200 flex items-center justify-center shrink-0 shadow-sm",C.trim()&&F?"bg-primary text-primary-foreground hover:bg-primary/95 transform hover:-translate-y-0.5":"bg-muted text-muted-foreground cursor-not-allowed opacity-50"),children:z(s,{className:"h-4 w-4"})})]})]})})]})]})}
2
- export{gz as h};
@@ -1,2 +0,0 @@
1
- import{$e as o0}from"./chunk-ex2ym5pz.js";import{af as $b}from"./chunk-34kaja59.js";import{Af as Sb,Bf as rb,Cf as u0,Df as I0}from"./chunk-r2shjtte.js";import{Jf as Q0,Kf as Pb}from"./chunk-ns804tmv.js";import{Mf as l0,Nf as i0,Of as x0,Pf as Q,Qf as x,Rf as m,ag as Gb,bg as t0}from"./chunk-2xevs82j.js";import{eg as H0,fg as W0,gg as y0,hg as J0,ig as I}from"./chunk-yyjx8nbq.js";import{jg as Rb}from"./chunk-zye42cfp.js";import{kg as bb}from"./chunk-dk8vk17v.js";import{ah as p0}from"./chunk-7x1vkftb.js";import{bh as u}from"./chunk-ck6msfch.js";import{eh as a0}from"./chunk-tcm57j8r.js";import{Xh as S0}from"./chunk-9cmvymm5.js";import{Yh as Yb}from"./chunk-6m1k317a.js";import{$h as z0,Zh as Z0,_h as f0}from"./chunk-kxr8fjsq.js";import{ai as Jb,ci as Zb,di as fb,ei as zb}from"./chunk-02afmyqy.js";import{Ci as R,Di as Xb,Ei as Ub,Fi as Db,Gi as Vb,Hi as Ob,Ii as qb,Ji as Bb,Ki as Qb,Li as V0,Ni as O0,Oi as q0,Pi as h0,Qi as B0,Si as c,qi as R0,ti as S,vi as _0,wi as r0}from"./chunk-8nyve0cr.js";import{Ui as d}from"./chunk-62ebss6h.js";import{Gk as m0,Jj as Lb,Ll as U0,Pl as j,Qj as L0,Tk as gb,Vi as Y0,Vj as M0,Wi as w0,Xi as b,Yi as N,Zk as Mb,bl as g0,hk as k0,jk as A0,jm as r,kk as C0,kl as d0,lk as e0,mm as K,nm as P0,qk as a,uj as Wb,vl as Kb,wj as h,yl as yb,zk as vb}from"./chunk-kqpzx5az.js";import{kn as $0}from"./chunk-p49h5fxs.js";var db=[Q.TODO,Q.READY,Q.IN_PROGRESS,Q.BLOCKED,Q.IN_REVIEW,Q.DONE];function K0(_){switch(_){case Q.TODO:return K.status_todo();case Q.READY:return K.status_ready();case Q.IN_PROGRESS:return K.status_in_progress();case Q.BLOCKED:return K.status_blocked();case Q.IN_REVIEW:return K.status_in_review();case Q.DONE:return K.status_done();default:return _}}function ub(_){switch(_){case Q.TODO:return{badge:"bg-muted text-muted-foreground border-border",border:"border-border",dot:"bg-muted-foreground",bg:"bg-muted/30"};case Q.READY:return{badge:"bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20",border:"border-blue-500/30",dot:"bg-blue-500",bg:"bg-blue-500/5"};case Q.IN_PROGRESS:return{badge:"bg-amber-500/10 text-amber-600 dark:text-amber-400 border-amber-500/20",border:"border-amber-500/30",dot:"bg-amber-500",bg:"bg-amber-500/5"};case Q.BLOCKED:return{badge:"bg-red-500/10 text-red-600 dark:text-red-400 border-red-500/20",border:"border-red-500/30",dot:"bg-red-500",bg:"bg-red-500/5"};case Q.IN_REVIEW:return{badge:"bg-purple-500/10 text-purple-600 dark:text-purple-400 border-purple-500/20",border:"border-purple-500/30",dot:"bg-purple-500",bg:"bg-purple-500/5"};case Q.DONE:return{badge:"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-500/20",border:"border-emerald-500/30",dot:"bg-emerald-500",bg:"bg-emerald-500/5"}}}function T0(_){return ub(_).badge}function c0(_){switch(_){case x.LOW:return K.priority_low();case x.MEDIUM:return K.priority_medium();case x.HIGH:return K.priority_high();case x.URGENT:return K.priority_urgent();default:return _}}function n0(_){switch(_){case x.LOW:return"bg-muted text-muted-foreground border-border";case x.MEDIUM:return"bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20";case x.HIGH:return"bg-amber-500/10 text-amber-600 dark:text-amber-400 border-amber-500/20";case x.URGENT:return"bg-red-500/10 text-red-600 dark:text-red-400 border-red-500/20 font-semibold";default:return"bg-muted text-muted-foreground border-border"}}var X0=$0(Y0(),1);var G0=$0(Y0(),1);var Ib=[Q.TODO,Q.READY,Q.IN_PROGRESS,Q.IN_REVIEW,Q.DONE,Q.BLOCKED];function j0({teamId:_,currentTaskId:G,excludeTaskIds:Y=[],value:Z=[],knownTasks:O=[],onChange:D,disabled:X=!1,canEdit:L=!0,className:y}){let[U,T]=G0.useState(!1),[P,v]=G0.useState(Q.TODO),[W,f]=G0.useState(""),[p,z]=G0.useState(()=>{let H={};for(let q of O)H[q.id]={title:q.title,status:q.status};return H}),{data:w,isLoading:E0}=S({queryKey:["teams",_,"kanban","tasks","status",P],queryFn:async()=>{let H=await R.api.teams[":teamId"].kanban.tasks.$get({param:{teamId:_},query:{status:P,first:"100"}});if(!H.ok)return{data:[]};return await H.json()},enabled:!!_&&U}),k=w?.data||[];G0.useMemo(()=>{if(k.length>0)z((H)=>{let q=!1,A={...H};for(let o of k)if(!A[o.id]||A[o.id].title!==o.title||A[o.id].status!==o.status)A[o.id]={title:o.title,status:o.status},q=!0;return q?A:H})},[k]);let F=G0.useMemo(()=>{let H=new Set(Y);if(G)H.add(G);return H},[G,Y]),l=G0.useMemo(()=>{let H=W.trim().toLowerCase();return k.filter((q)=>{if(F.has(q.id))return!1;if(!H)return!0;return q.title.toLowerCase().includes(H)})},[k,F,W]),i=(H)=>{if(!L||X)return;let A=Z.includes(H)?Z.filter((o)=>o!==H):[...Z,H];D?.(A)},E=(H,q)=>{if(q.stopPropagation(),!L||X)return;D?.(Z.filter((A)=>A!==H))},V=L&&!X;return N(l0,{open:U&&V,onOpenChange:(H)=>V&&T(H),children:[b(i0,{asChild:!0,children:b("div",{role:"button",tabIndex:V?0:-1,className:j("w-full min-h-[36px] px-2.5 py-1.5 flex flex-wrap items-center gap-1.5 rounded-md border border-input bg-background text-xs transition-colors",V?"cursor-pointer hover:border-ring/60 focus:outline-none focus:ring-2 focus:ring-ring/50":"cursor-not-allowed opacity-70",y),children:Z.length===0?N("div",{className:"flex items-center gap-1.5 text-muted-foreground",children:[b(m0,{className:"w-3.5 h-3.5 text-muted-foreground/70"}),b("span",{children:K.select_parent_tasks()})]}):Z.map((H)=>{let q=p[H];return N("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-md text-[11px] bg-muted text-foreground border border-border/80 shrink-0 max-w-[220px]",children:[q?.status&&b("span",{className:j("px-1 py-0.2 rounded text-[9px] uppercase font-semibold shrink-0",T0(q.status)),children:K0(q.status)}),b("span",{className:"truncate font-medium",children:q?.title||H}),V&&b("button",{type:"button",onClick:(A)=>E(H,A),className:"text-muted-foreground hover:text-destructive shrink-0 p-0.5 -mr-1",children:b(U0,{className:"w-3 h-3"})})]},H)})})}),N(x0,{align:"start",sideOffset:4,className:"w-[var(--radix-popover-trigger-width)] min-w-[320px] sm:min-w-[420px] max-w-[500px] p-2.5 space-y-2 bg-popover border border-border rounded-lg shadow-lg",children:[b("div",{className:"flex flex-wrap gap-1.5 pb-0.5",children:Ib.map((H)=>{return b("button",{type:"button",onClick:()=>v(H),className:j("text-[11px] h-7 px-2.5 rounded-md font-medium transition-colors border shrink-0",P===H?"bg-primary text-primary-foreground border-primary shadow-xs":"bg-muted/50 hover:bg-accent text-muted-foreground hover:text-foreground border-border/60"),children:K0(H)},H)})}),N("div",{className:"relative",children:[b(d0,{className:"w-3.5 h-3.5 absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none"}),b(P0,{value:W,onChange:(H)=>f(H.target.value),placeholder:K.filter_tasks_placeholder(),className:"h-8 pl-8 text-xs bg-muted/40",autoFocus:!0})]}),b("div",{className:"border rounded-md overflow-hidden bg-background/50",children:b(u,{className:"h-48 p-1",children:E0?b("div",{className:"flex items-center justify-center py-8",children:b(h,{className:"w-4 h-4 animate-spin text-muted-foreground"})}):l.length===0?b("div",{className:"py-8 text-center text-xs text-muted-foreground italic",children:K.no_matching_tasks()}):b("div",{className:"space-y-1",children:l.map((H)=>{let q=Z.includes(H.id);return N("div",{onClick:()=>i(H.id),className:j("flex items-center justify-between p-2 rounded-md hover:bg-accent cursor-pointer transition-colors text-xs border border-transparent",q&&"bg-accent/50 border-border/50"),children:[N("div",{className:"flex items-center gap-2 min-w-0 flex-1 pr-2",children:[b("div",{className:j("w-4 h-4 rounded border flex items-center justify-center shrink-0 transition-colors",q?"bg-primary border-primary text-primary-foreground":"border-input bg-background"),children:q&&b(M0,{className:"w-3 h-3 stroke-[3]"})}),b("span",{className:j("px-1.5 py-0.5 rounded text-[10px] uppercase font-medium shrink-0",T0(H.status)),children:K0(H.status)}),b("span",{className:"font-medium text-foreground truncate",children:H.title})]}),H.assignee&&b("span",{className:"text-[10px] text-muted-foreground truncate shrink-0",children:H.assignee.name})]},H.id)})})})})]})]})}var Nb=$0(Y0(),1);var D0=$0(Y0(),1);function s0({teamId:_,initialProjectId:G,excludeAssetIds:Y=[],isOpen:Z,onClose:O,onConfirm:D}){let[X,L]=D0.useState(G||""),[y,U]=D0.useState(null),[T,P]=D0.useState(new Map),{data:v,isLoading:W}=S({queryKey:["teams",_,"projects"],queryFn:async()=>{let $=await R.api.teams[":teamId"].projects.$get({param:{teamId:_},query:{first:"100"}});if(!$.ok)throw Error("Failed to fetch projects");return await $.json()},enabled:!!_&&Z}),f=v?.data||[],p=X||(f[0]?.id??""),z=f.find(($)=>$.id===p),w=y?.id||z?.rootFolder||"",E0=w===z?.rootFolder,{data:k,fetchNextPage:F,hasNextPage:l,isFetchingNextPage:i,isLoading:E}=r0({queryKey:["folders",w,"children","folder","picker"],queryFn:async({pageParam:$})=>{let g=await R.api.folders[":folderId"].children.$get({param:{folderId:w},query:{assetType:"folder",after:$,first:"20"}});if(!g.ok)throw Error("Failed to fetch folders");return await g.json()},initialPageParam:"",getNextPageParam:($)=>$.pageInfo?.cursor||void 0,enabled:!!w&&Z}),{data:V,fetchNextPage:H,hasNextPage:q,isFetchingNextPage:A,isLoading:o}=r0({queryKey:["folders",w,"children","file","picker"],queryFn:async({pageParam:$})=>{let g=await R.api.folders[":folderId"].children.$get({param:{folderId:w},query:{assetType:"file",after:$,first:"20"}});if(!g.ok)throw Error("Failed to fetch files");return await g.json()},initialPageParam:"",getNextPageParam:($)=>$.pageInfo?.cursor||void 0,enabled:!!w&&Z}),{ref:J,inView:B}=a0();D0.useEffect(()=>{if(B){if(l&&!i)F();else if(q&&!A)H()}},[B,l,i,F,q,A,H]);let t=E&&!k||o&&!V,C=i||A,M=D0.useMemo(()=>{let $=k?.pages.flatMap((N0)=>N0.data??[])??[],g=V?.pages.flatMap((N0)=>N0.data??[])??[];return[...$,...g]},[k,V]),s=($)=>{let g=new Map(T);if(g.has($.id))g.delete($.id);else{let N0=z?`/${[z.name,...($.ancestorFolders||[]).map((v0)=>v0.name)].filter(Boolean).join("/")}`:"/";g.set($.id,{id:$.id,name:$.name,type:$.type,proxyType:$.proxyType??null,thumbnailUrl:$.preview?.thumbnailUrl??null,path:N0,creator:$.creator?{id:$.creator.id,name:$.creator.name,image:$.creator.image??void 0}:null,sizeByte:$.sizeByte??0,fileCount:$.fileCount??null,projectId:$.projectId??z?.id??null,createdAt:$.createdAt??new Date().toISOString()})}P(g)},e=()=>{if(!y||E0)return;let $=new Map(T);if($.has(y.id))$.delete(y.id);else{let g=z?`/${[z.name,...(y.ancestorFolders||[]).map((N0)=>N0.name)].filter(Boolean).join("/")}`:"/";$.set(y.id,{id:y.id,name:y.name,type:"folder",proxyType:null,thumbnailUrl:null,path:g,creator:y.creator?{id:y.creator.id,name:y.creator.name,image:y.creator.image??void 0}:null,sizeByte:y.sizeByte??0,fileCount:y.fileCount??null,projectId:y.projectId??z?.id??null,createdAt:y.createdAt??new Date().toISOString()})}P($)},b0=()=>{D(Array.from(T.values())),O()};return b(V0,{open:Z,onOpenChange:($)=>{if(!$)O()},children:N(O0,{className:"sm:max-w-4xl flex flex-col h-[650px] p-0 overflow-hidden gap-1",children:[b(q0,{className:"px-4 py-3 border-b shrink-0",children:N("div",{className:"flex items-center gap-2",children:[b(a,{className:"w-5 h-5 text-primary"}),b(B0,{children:K.select_assets()})]})}),N("div",{className:"flex items-center gap-2.5 px-4 py-1.5 border-b bg-transparent shrink-0",children:[N("span",{className:"text-xs font-medium text-muted-foreground whitespace-nowrap",children:[K.current_project_label(),":"]}),b("div",{className:"w-64",children:N(H0,{value:p,onValueChange:($)=>{L($),U(null)},children:[b(y0,{className:"h-8 text-xs bg-background",children:b(W0,{placeholder:K.select_project()})}),b(J0,{children:f.map(($)=>b(I,{value:$.id,className:"text-xs",children:$.name},$.id))})]})})]}),N("div",{className:"flex-1 min-h-0 flex overflow-hidden",children:[b("div",{className:"w-1/3 min-h-0 border-r bg-sidebar/30 flex flex-col overflow-hidden",children:b(u,{className:"flex-1 min-h-0 [&>div>div]:block!",children:z&&z.rootFolder?b("div",{className:"p-2",children:b(p0,{teamId:_,projectId:z.id,projectName:z.name,rootFolderId:z.rootFolder,onSelect:($)=>U($),selectedFolderId:w,hideCollections:!0,hideShares:!0,hideRecentlyDeleted:!0})}):b("div",{className:"flex items-center justify-center h-full p-6 text-xs text-muted-foreground",children:W?b(h,{className:"w-5 h-5 animate-spin text-muted-foreground"}):K.no_project_selected()})})}),N("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden bg-background",children:[N("div",{className:"p-2.5 px-4 border-b flex items-center justify-between bg-muted/20 shrink-0",children:[N("div",{className:"flex items-center gap-2 text-xs font-medium truncate",children:[b(a,{className:"w-4 h-4 text-muted-foreground shrink-0"}),b("span",{className:"truncate",children:y?y.name:z?.name||""}),E0&&b("span",{className:"text-[10px] text-muted-foreground/70 bg-muted px-1.5 py-0.5 rounded",children:"Root"})]}),!E0&&y&&b(r,{size:"sm",variant:T.has(y.id)?"secondary":"outline",className:"h-7 text-xs gap-1.5",onClick:e,disabled:Y.includes(y.id),children:T.has(y.id)?N(w0,{children:[b(M0,{className:"w-3.5 h-3.5 text-primary"}),K.saved()]}):N(w0,{children:[b(g0,{className:"w-3.5 h-3.5"}),K.select_current_folder()]})})]}),b(u,{className:"flex-1 min-h-0 [&>div>div]:block!",children:t?b("div",{className:"flex items-center justify-center p-12",children:b(h,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):M.length===0?N("div",{className:"flex flex-col items-center justify-center p-12 text-center text-xs text-muted-foreground gap-2",children:[b(a,{className:"w-8 h-8 opacity-30"}),b("p",{children:K.no_assets_in_folder()})]}):N("div",{className:"divide-y divide-border/40",children:[M.map(($)=>{let g=Y.includes($.id),N0=T.has($.id),v0=$.type==="folder";return N("div",{onClick:()=>{if(!g)s($)},className:`flex items-center gap-3 px-4 py-2.5 hover:bg-muted/40 cursor-pointer transition-colors ${N0?"bg-primary/5":""} ${g?"opacity-50 cursor-not-allowed":""}`,children:[b(t0,{checked:N0,disabled:g,onCheckedChange:()=>{if(!g)s($)},onClick:(kb)=>kb.stopPropagation()}),b("div",{className:"w-9 h-9 rounded bg-muted/60 border shrink-0 flex items-center justify-center overflow-hidden",children:$.preview?.thumbnailUrl?b("img",{src:$.preview.thumbnailUrl,alt:$.name,className:"w-full h-full object-cover"}):v0?b(a,{className:"w-5 h-5 text-primary fill-primary/20"}):b(C0,{className:"w-5 h-5 text-muted-foreground"})}),N("div",{className:"flex-1 min-w-0",children:[b("p",{className:"text-xs font-medium truncate text-foreground",children:$.name}),N("p",{className:"text-[11px] text-muted-foreground truncate",children:[v0?`${$.fileCount??0} items`:Q0($.sizeByte||0),$.creator?.name?` • ${$.creator.name}`:""]})]})]},$.id)}),b("div",{ref:J,className:"h-1"}),C&&b("div",{className:"flex items-center justify-center p-3",children:b(h,{className:"w-4 h-4 animate-spin text-muted-foreground"})})]})})]})]}),N(h0,{className:"p-3 px-4 border-t flex items-center justify-between sm:justify-between bg-muted/10 shrink-0",children:[b("div",{className:"text-xs text-muted-foreground",children:T.size>0&&K.n_assets_selected({count:T.size})}),N("div",{className:"flex items-center gap-2",children:[b(r,{variant:"outline",size:"sm",onClick:O,children:K.cancel()}),b(r,{size:"sm",onClick:b0,disabled:T.size===0,children:K.add_assets()})]})]})]})})}function _b({teamId:_,projectId:G,assets:Y,onAddAssets:Z,onRemoveAsset:O,disabled:D=!1}){let[X,L]=Nb.useState(!1),y=(U)=>{let T=new Set(Y.map((v)=>v.id)),P=U.filter((v)=>!T.has(v.id));if(P.length>0)Z(P)};return N("div",{className:"space-y-2",children:[N("div",{className:"flex items-center justify-between",children:[N("div",{className:"flex items-center gap-1.5 text-xs font-semibold text-foreground",children:[b(e0,{className:"w-3.5 h-3.5 text-muted-foreground"}),b("span",{children:K.related_assets()}),Y.length>0&&N("span",{className:"text-[11px] text-muted-foreground font-normal",children:["(",Y.length,")"]})]}),!D&&b(r,{type:"button",variant:"ghost",size:"sm",className:"h-6 w-6 p-0 hover:bg-muted",onClick:()=>L(!0),title:K.add_assets(),children:b(g0,{className:"w-3.5 h-3.5"})})]}),b(bb,{}),Y.length===0?b("p",{className:"text-xs text-muted-foreground/70 py-1 italic",children:K.no_related_assets()}):b("div",{className:"space-y-1.5 max-h-48 overflow-y-auto pr-1",children:Y.map((U)=>{let T=U.type==="folder";return N("div",{className:"flex items-center justify-between gap-2 p-1.5 px-2 rounded-md bg-muted/40 hover:bg-muted/70 transition-colors text-xs border border-border/40",children:[N("div",{className:"flex items-center gap-2.5 min-w-0 flex-1",children:[b("div",{className:"w-7 h-7 rounded bg-muted border shrink-0 flex items-center justify-center overflow-hidden",children:U.thumbnailUrl?b("img",{src:U.thumbnailUrl,alt:U.name,className:"w-full h-full object-cover"}):T?b(a,{className:"w-4 h-4 text-primary fill-primary/20"}):b(C0,{className:"w-4 h-4 text-muted-foreground"})}),N("div",{className:"flex-1 min-w-0",children:[b("p",{className:"font-medium truncate text-foreground leading-snug",children:U.name}),b("p",{className:"text-[10px] text-muted-foreground truncate leading-none mt-0.5",children:U.path||"/"})]})]}),N("div",{className:"flex items-center gap-2 shrink-0",children:[U.creator&&N("div",{className:"flex items-center gap-1 text-[11px] text-muted-foreground",title:U.creator.name,children:[N(Z0,{className:"w-4 h-4 text-[9px]",children:[b(f0,{src:U.creator.image||void 0}),b(z0,{children:U.creator.name.slice(0,1).toUpperCase()})]}),b("span",{className:"hidden sm:inline text-[11px] max-w-[80px] truncate",children:U.creator.name})]}),!D&&b(r,{type:"button",variant:"ghost",size:"sm",className:"h-5 w-5 p-0 text-muted-foreground hover:text-destructive hover:bg-destructive/10",onClick:()=>O(U.id),title:K.unlink_asset(),children:b(U0,{className:"w-3 h-3"})})]})]},U.id)})}),X&&b(s0,{teamId:_,initialProjectId:G,excludeAssetIds:Y.map((U)=>U.id),isOpen:X,onClose:()=>L(!1),onConfirm:y})]})}var F0=$0(Y0(),1);function Eb({teamId:_,currentProjectId:G,currentTargetFolderId:Y,isOpen:Z,onClose:O,onSelect:D}){let[X,L]=F0.useState(G||""),[y,U]=F0.useState(null),{data:T,isLoading:P}=S({queryKey:["teams",_,"projects"],queryFn:async()=>{let z=await R.api.teams[":teamId"].projects.$get({param:{teamId:_},query:{first:"100"}});if(!z.ok)throw Error("Failed to fetch projects");return await z.json()},enabled:!!_&&Z}),v=T?.data||[],W=X||(v[0]?.id??""),f=v.find((z)=>z.id===W),p=()=>{if(!W)return;let z=y?.id||f?.rootFolder;if(z)D(W,z,y?.name||f?.name),O()};return b(V0,{open:Z,onOpenChange:(z)=>!z&&O(),children:N(O0,{className:"sm:max-w-2xl flex flex-col h-[580px]",children:[b(q0,{children:N("div",{className:"flex items-center gap-2",children:[b(a,{className:"w-5 h-5 text-primary"}),b(B0,{children:K.select_target_folder()})]})}),N("div",{className:"flex flex-col gap-3 flex-1 overflow-hidden py-2",children:[N("div",{className:"space-y-1.5",children:[b("label",{className:"text-xs font-medium text-muted-foreground",children:K.select_project()}),N(H0,{value:W,onValueChange:(z)=>{L(z),U(null)},children:[b(y0,{className:"h-9",children:b(W0,{placeholder:K.select_project()})}),b(J0,{children:v.map((z)=>b(I,{value:z.id,children:z.name},z.id))})]})]}),N("div",{className:"space-y-1.5 flex-1 flex flex-col overflow-hidden",children:[b("label",{className:"text-xs font-medium text-muted-foreground",children:K.target_folder()}),b("div",{className:"border rounded-md flex-1 overflow-hidden bg-sidebar/50",children:b(u,{className:"h-full",children:f&&f.rootFolder?b(p0,{teamId:_,projectId:f.id,projectName:f.name,rootFolderId:f.rootFolder,onSelect:U,selectedFolderId:y?.id||Y||f.rootFolder,hideCollections:!0,hideShares:!0,hideRecentlyDeleted:!0}):b("div",{className:"flex items-center justify-center h-full p-6 text-xs text-muted-foreground",children:P?b(h,{className:"w-5 h-5 animate-spin text-muted-foreground"}):K.no_project_selected()})})})]})]}),N(h0,{children:[b(r,{variant:"outline",onClick:O,children:K.cancel()}),b(r,{onClick:p,disabled:!W,children:K.confirm()})]})]})})}function Hb({teamId:_,task:G,canEdit:Y=!0}){let Z=R0(),[O,D]=X0.useState(G.title),[X,L]=X0.useState(G.description||""),[y,U]=X0.useState(!1),[T,P]=X0.useState(null),v=X0.useRef(null);X0.useEffect(()=>{D(G.title),L(G.description||"")},[G.id,G.title,G.description]);let{data:W=[]}=S({queryKey:["teams",_,"members","human"],queryFn:async()=>{let E=await R.api.teams[":teamId"].members.$get({param:{teamId:_},query:{includeAgents:"false"}});if(!E.ok)return[];let V=await E.json();return Array.isArray(V)?V:[]},enabled:!!_}),{data:f=[]}=S({queryKey:["teams",_,"agents"],queryFn:async()=>{let E=await R.api.teams[":teamId"].agents.$get({param:{teamId:_}});if(!E.ok)return[];return await E.json()||[]},enabled:!!_}),{data:p}=S({queryKey:["teams",_,"kanban","goals"],queryFn:async()=>{let E=await R.api.teams[":teamId"].kanban.goals.$get({param:{teamId:_},query:{}});if(!E.ok)return{data:[]};return await E.json()},enabled:!!_}),z=p?.data||[],{mutate:w,isPending:E0}=_0({mutationFn:async(E)=>{let V=await R.api.teams[":teamId"].kanban.tasks[":taskId"].$patch({param:{teamId:_,taskId:G.id},json:E});if(!V.ok){let H=await V.json().catch(()=>({message:K.error()}));throw Error(H.message||K.error())}return await V.json()},onSuccess:()=>{Z.invalidateQueries({queryKey:["teams",_,"kanban","task",G.id]}),Z.invalidateQueries({queryKey:["teams",_,"kanban","tasks"]})},onError:(E)=>{c.error(E.message)}}),{mutate:k}=_0({mutationFn:async(E)=>{let V=await R.api.teams[":teamId"].kanban.tasks[":taskId"].assets.$post({param:{teamId:_,taskId:G.id},json:{assetIds:E.map((H)=>H.id)}});if(!V.ok)throw Error("Failed to link assets");return await V.json()},onSuccess:()=>{Z.invalidateQueries({queryKey:["teams",_,"kanban","task",G.id]}),Z.invalidateQueries({queryKey:["teams",_,"kanban","tasks"]}),c.success(K.asset_linked())},onError:(E)=>{c.error(E.message)}}),{mutate:F}=_0({mutationFn:async(E)=>{let V=await R.api.teams[":teamId"].kanban.tasks[":taskId"].assets[":assetId"].$delete({param:{teamId:_,taskId:G.id,assetId:E}});if(!V.ok)throw Error("Failed to unlink asset");return await V.json()},onSuccess:()=>{Z.invalidateQueries({queryKey:["teams",_,"kanban","task",G.id]}),Z.invalidateQueries({queryKey:["teams",_,"kanban","tasks"]}),c.success(K.asset_unlinked())},onError:(E)=>{c.error(E.message)}}),l=(E,V)=>{if(E==="title")D(V);if(E==="description")L(V);if(v.current)clearTimeout(v.current);v.current=setTimeout(()=>{if(E==="title"&&V.trim()&&V.trim()!==G.title)w({title:V.trim()});else if(E==="description"&&V!==(G.description||""))w({description:V.trim()||null})},600)},i=G.isAgentTask;return N(u,{className:"h-full p-5",children:[N("div",{className:"space-y-6 w-full pr-3",children:[N("div",{className:"space-y-1.5",children:[N("div",{className:"flex items-center justify-between",children:[b(d,{htmlFor:"task-title",className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:K.task_title()}),E0&&N("span",{className:"flex items-center gap-1 text-[11px] text-muted-foreground animate-pulse",children:[b(h,{className:"w-3 h-3 animate-spin"}),K.saving()]})]}),b(P0,{id:"task-title",value:O,onChange:(E)=>l("title",E.target.value),disabled:!Y,className:"text-base font-semibold h-10 bg-background",placeholder:K.task_title_placeholder()})]}),N("div",{className:"space-y-1.5",children:[b(d,{htmlFor:"task-description",className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:K.task_description()}),b($b,{id:"task-description",value:X,onChange:(E)=>l("description",E.target.value),disabled:!Y,rows:5,className:"text-xs leading-relaxed bg-background",placeholder:K.task_description_placeholder()})]}),N("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 p-4 rounded-lg bg-muted/20 border border-border/60",children:[N("div",{className:"sm:col-span-2 flex items-center justify-between space-x-2 rounded-md border border-border/60 bg-background/50 px-3 py-2 h-14",children:[N("div",{className:"space-y-0.5 min-w-0 pr-2",children:[N(d,{className:"text-xs font-medium text-muted-foreground flex items-center gap-1.5",children:[b(L0,{className:"w-3.5 h-3.5 text-orange-500"}),b("span",{children:K.task_type_agent()})]}),b("p",{className:"text-[11px] text-muted-foreground/80 line-clamp-1",children:K.task_type_agent_desc()})]}),b(Yb,{checked:G.isAgentTask,disabled:!0})]}),N("div",{className:"space-y-1.5",children:[b(d,{className:"text-xs font-medium text-muted-foreground",children:K.task_priority()}),N(H0,{value:G.priority,onValueChange:(E)=>w({priority:E}),disabled:!Y,children:[b(y0,{className:"w-full h-8 text-xs bg-background",children:b(W0,{})}),b(J0,{children:Object.values(x).map((E)=>b(I,{value:E,children:b("span",{className:j("px-1.5 py-0.5 rounded text-[10px] uppercase font-medium",n0(E)),children:c0(E)})},E))})]})]}),N("div",{className:"space-y-1.5",children:[b(d,{className:"text-xs font-medium text-muted-foreground",children:K.goals()}),N(H0,{value:G.goal?.id||"none",onValueChange:(E)=>w({goalId:E==="none"?null:E}),disabled:!Y,children:[b(y0,{className:"w-full h-8 text-xs bg-background",children:b(W0,{placeholder:K.no_folder_selected()})}),N(J0,{children:[b(I,{value:"none",children:b("span",{className:"text-muted-foreground italic",children:"None"})}),z.filter((E)=>E.id!==Gb).map((E)=>b(I,{value:E.id,children:N("div",{className:"flex items-center gap-2",children:[b(Kb,{className:"w-3.5 h-3.5 text-primary"}),b("span",{children:E.title})]})},E.id))]})]})]}),N("div",{className:"space-y-1.5",children:[b(d,{className:"text-xs font-medium text-muted-foreground",children:i?K.select_agent():K.assignee()}),N(H0,{value:G.assignee?.id||"none",onValueChange:(E)=>w({assigneeId:E==="none"?null:E}),disabled:!Y,children:[b(y0,{className:"w-full h-8 text-xs bg-background",children:b(W0,{placeholder:K.unassigned()})}),N(J0,{children:[b(I,{value:"none",children:b("span",{className:"text-muted-foreground italic",children:K.unassigned()})}),i?f.map((E)=>b(I,{value:E.id,children:N("div",{className:"flex items-center gap-2",children:[b(L0,{className:"w-3.5 h-3.5 text-purple-500"}),b("span",{children:E.name})]})},E.id)):W.map((E)=>b(I,{value:E.id,children:N("div",{className:"flex items-center gap-2",children:[N(Z0,{size:"sm",className:"w-4 h-4",children:[b(f0,{src:E.image}),b(z0,{className:"text-[8px]",children:E.name.slice(0,2).toUpperCase()})]}),b("span",{children:E.name})]})},E.id))]})]})]}),N("div",{className:"space-y-1.5",children:[b(d,{className:"text-xs font-medium text-muted-foreground",children:K.reporter()}),N(H0,{value:G.reporter?.id||"none",onValueChange:(E)=>w({reporterId:E==="none"?null:E}),disabled:!Y,children:[b(y0,{className:"w-full h-8 text-xs bg-background",children:b(W0,{placeholder:K.unassigned()})}),N(J0,{children:[b(I,{value:"none",children:b("span",{className:"text-muted-foreground italic",children:K.unassigned()})}),W.map((E)=>b(I,{value:E.id,children:N("div",{className:"flex items-center gap-2",children:[N(Z0,{size:"sm",className:"w-4 h-4",children:[b(f0,{src:E.image}),b(z0,{className:"text-[8px]",children:E.name.slice(0,2).toUpperCase()})]}),b("span",{children:E.name})]})},E.id))]})]})]}),i&&N("div",{className:"sm:col-span-2 space-y-1.5",children:[b(d,{className:"text-xs font-medium text-muted-foreground",children:K.target_folder()}),b("div",{className:"flex items-center gap-2",children:N(r,{type:"button",variant:"outline",size:"sm",onClick:()=>U(!0),disabled:!Y,className:"w-full justify-start h-8 text-xs bg-background truncate font-normal",children:[b(a,{className:"w-3.5 h-3.5 mr-2 text-primary shrink-0"}),b("span",{className:"truncate",children:T||(G.targetFolderId?"Selected Folder":K.select_target_folder())})]})})]}),N("div",{className:"space-y-1.5",children:[b(d,{className:"text-xs font-medium text-muted-foreground",children:K.start_date()}),b(o0,{value:G.startDate?new Date(G.startDate):void 0,onChange:(E)=>w({startDate:E?E.toISOString():null}),disabled:!Y,placeholder:K.start_date(),className:"h-8 text-xs bg-background"})]}),N("div",{className:"space-y-1.5",children:[b(d,{className:"text-xs font-medium text-muted-foreground",children:K.due_date()}),b(o0,{value:G.dueDate?new Date(G.dueDate):void 0,onChange:(E)=>w({dueDate:E?E.toISOString():null}),disabled:!Y,placeholder:K.due_date(),className:"h-8 text-xs bg-background"})]}),N("div",{className:"sm:col-span-2 space-y-1.5",children:[b(d,{className:"text-xs font-medium text-muted-foreground",children:K.parent_tasks()}),b(j0,{teamId:_,currentTaskId:G.id,excludeTaskIds:G.dependents.map((E)=>E.id),value:G.dependencies.map((E)=>E.id),knownTasks:[...G.dependencies,...G.dependents],onChange:(E)=>w({parentIds:E}),canEdit:Y})]}),b("div",{className:"sm:col-span-2 pt-1",children:b(_b,{teamId:_,projectId:G.projectId,assets:G.assets||[],onAddAssets:(E)=>k(E),onRemoveAsset:(E)=>F(E),disabled:!Y})})]})]}),y&&b(Eb,{teamId:_,currentProjectId:G.projectId,currentTargetFolderId:G.targetFolderId,isOpen:y,onClose:()=>U(!1),onSelect:(E,V,H)=>{P(H||"Selected Folder"),w({projectId:E,targetFolderId:V})}})]})}var Fb=$0(Y0(),1);var hb=$0(Y0(),1);var Tb=$0(Y0(),1);function wb({teamId:_,taskId:G,comment:Y,currentUserId:Z,isOwnerOrAdmin:O,onViewAttachment:D}){let X=R0(),[L,y]=Tb.useState(!1),U=O||Y.author.id===Z,{mutate:T,isPending:P}=_0({mutationFn:async()=>{let W=await R.api.teams[":teamId"].kanban.tasks[":taskId"].comments[":commentId"].$delete({param:{teamId:_,taskId:G,commentId:Y.id}});if(!W.ok){let f=await W.json().catch(()=>({message:K.error()}));throw Error(f.message||K.error())}return await W.json()},onSuccess:()=>{X.invalidateQueries({queryKey:["teams",_,"kanban","tasks",G,"comments"]}),X.invalidateQueries({queryKey:["teams",_,"kanban","task",G]}),X.invalidateQueries({queryKey:["teams",_,"kanban","tasks"]}),c.success("Comment deleted"),y(!1)},onError:(W)=>{c.error(W.message)}}),v=(Y.author.name||"U").split(" ").map((W)=>W[0]).slice(0,2).join("").toUpperCase();return N("div",{className:"relative flex gap-3 p-3 rounded-xl border border-transparent bg-foreground/[0.03] dark:bg-foreground/[0.08] hover:bg-foreground/[0.06] dark:hover:bg-foreground/[0.12] transition-colors group",children:[N(Z0,{className:"w-7 h-7 shrink-0 mt-0.5 border border-border",children:[Y.author.image&&b(f0,{src:Y.author.image,alt:Y.author.name}),b(z0,{className:"text-[10px] font-medium bg-muted text-muted-foreground",children:v})]}),N("div",{className:"flex-1 min-w-0 space-y-1.5",children:[N("div",{className:"flex items-center justify-between gap-2",children:[N("div",{className:"flex items-center gap-2 min-w-0",children:[b("span",{className:"font-semibold text-xs text-foreground truncate",children:Y.author.name}),b("span",{className:"text-[10px] text-muted-foreground shrink-0 font-mono",children:S0(new Date(Y.createdAt),"MMM d, h:mm a")})]}),U&&b("div",{className:"opacity-0 group-hover:opacity-100 transition-opacity",children:N(Jb,{modal:!1,children:[b(Zb,{asChild:!0,children:b(r,{size:"icon-xs",variant:"ghost",className:"h-5 w-5 text-muted-foreground",children:b(Wb,{className:"h-3.5 w-3.5"})})}),b(fb,{align:"end",children:N(zb,{className:"text-destructive focus:text-destructive cursor-pointer text-xs",onClick:()=>y(!0),children:[b(yb,{className:"mr-1.5 h-3.5 w-3.5"}),b("span",{children:K.delete()})]})})]})})]}),Y.body&&b("div",{className:"text-xs leading-relaxed prose prose-xs dark:prose-invert max-w-none break-words text-foreground/90 font-sans",children:b(Rb,{children:Y.body})}),Y.attachments&&Y.attachments.length>0&&b("div",{className:"flex flex-wrap gap-2 pt-1.5",children:Y.attachments.map((W)=>{let f=W.proxyType==="image"||W.contentType?.startsWith("image/");return b("div",{className:"relative group/att rounded-lg border border-border bg-card overflow-hidden transition-all duration-200",children:f?N("div",{className:"w-40 h-28 relative cursor-pointer overflow-hidden bg-muted/40",onClick:()=>D?.(W),children:[b("img",{src:W.url,alt:W.name,className:"w-full h-full object-cover group-hover/att:scale-105 transition-transform duration-200"}),b("a",{href:W.url,download:W.name,target:"_blank",rel:"noreferrer",className:"absolute right-1.5 bottom-1.5 bg-black/60 hover:bg-black/80 text-white p-1 rounded-md opacity-0 group-hover/att:opacity-100 transition-opacity shadow-xs",onClick:(p)=>p.stopPropagation(),title:"Download",children:b(k0,{className:"w-3.5 h-3.5"})})]}):N("div",{className:"flex items-center gap-2.5 p-2.5 max-w-[240px] bg-card hover:bg-muted/40 transition-colors",children:[b(A0,{className:"w-7 h-7 text-primary/80 shrink-0"}),N("div",{className:"min-w-0 flex-1",children:[b("p",{className:"text-xs font-medium text-foreground truncate",title:W.name,children:W.name}),b("p",{className:"text-[10px] text-muted-foreground font-mono",children:Q0(W.sizeByte)})]}),b("a",{href:W.url,download:W.name,target:"_blank",rel:"noreferrer",className:"p-1 text-muted-foreground hover:text-foreground shrink-0 rounded-md hover:bg-muted transition-colors",title:"Download",children:b(k0,{className:"w-3.5 h-3.5"})})]})},W.id)})})]}),b(Xb,{open:L,onOpenChange:y,children:N(Ub,{children:[N(Db,{children:[b(Ob,{children:K.delete_comment_confirm()}),b(qb,{children:K.delete_comment_description()})]}),N(Vb,{children:[b(Qb,{disabled:P,children:K.cancel()}),b(Bb,{className:"bg-destructive hover:bg-destructive/90 text-white",disabled:P,onClick:()=>T(),children:K.delete()})]})]})})]})}var n=$0(Y0(),1);function Cb({teamId:_,onSendMessage:G,isSubmitting:Y}){let[Z,O]=n.useState(""),[D,X]=n.useState([]),[L,y]=n.useState(!1),[U,T]=n.useState(""),[P,v]=n.useState(0),W=n.useRef(null),f=n.useRef(null),p=n.useRef(null),{members:z,fetchMembers:w}=Pb();n.useEffect(()=>{if(_)w(_,!0,!0)},[_,w]);let{mutateAsync:E0}=_0({mutationFn:async(J)=>{let B=await R.api.teams[":teamId"].kanban.attachments.$post({param:{teamId:_},json:J});if(!B.ok)throw Error("Failed to get attachment upload url");return await B.json()}}),k=(J)=>{let B=J.target.value;if(O(B),W.current)W.current.style.height="auto",W.current.style.height=`${Math.min(W.current.scrollHeight,160)}px`;let t=J.target.selectionStart||0,C=B.slice(0,t),M=C.lastIndexOf("@");if(M!==-1){let s=M===0,e=C[M-1];if(s||/\s/.test(e)){let $=C.slice(M+1);if(!/\s/.test($)){T($),y(!0);return}}}y(!1)},F=z.filter((J)=>J.name?.toLowerCase().includes(U.toLowerCase()));n.useEffect(()=>{v(0)},[U,L]);let l=(J)=>{if(!W.current)return;let B=W.current.selectionStart||0,t=Z.slice(0,B),C=Z.slice(B),M=t.lastIndexOf("@");if(M!==-1){let s=`${Z.slice(0,M)}@${J.name} ${C}`;O(s),y(!1),setTimeout(()=>{if(W.current){W.current.focus();let e=M+J.name.length+2;W.current.setSelectionRange(e,e)}},0)}},i=async(J)=>{let B=Array.from(J.target.files||[]);if(B.length===0)return;let t=B.map((C)=>({id:`${Date.now()}-${C.name}-${Math.random()}`,file:C,isUploading:!0}));X((C)=>[...C,...t]);for(let C of t)try{let M=await E0({fileName:C.file.name,size:C.file.size,contentType:C.file.type||"application/octet-stream"});if(!(await fetch(M.uploadUrl,{method:"PUT",body:C.file,headers:{"Content-Type":C.file.type||"application/octet-stream"}})).ok)throw Error("Failed to upload file to storage");X((e)=>e.map((b0)=>b0.id===C.id?{...b0,isUploading:!1,payload:{id:M.id,name:M.name,key:M.key,sizeByte:M.sizeByte,contentType:M.contentType,proxyType:M.proxyType}}:b0))}catch(M){let s=M instanceof Error?M.message:"Upload failed";c.error(`${C.file.name}: ${s}`),X((e)=>e.map((b0)=>b0.id===C.id?{...b0,isUploading:!1,error:s}:b0))}if(f.current)f.current.value=""},E=(J)=>{X((B)=>B.filter((t)=>t.id!==J))},V=D.some((J)=>J.isUploading),H=D.map((J)=>J.payload).filter((J)=>!!J),q=(Z.trim().length>0||H.length>0)&&!V,A=async()=>{if(!q||Y)return;try{if(await G(Z.trim(),H.length>0?H:void 0),O(""),X([]),W.current)W.current.style.height="auto"}catch{}},o=(J)=>{if(L&&F.length>0){if(J.key==="ArrowDown"){J.preventDefault(),v((B)=>(B+1)%F.length);return}if(J.key==="ArrowUp"){J.preventDefault(),v((B)=>(B-1+F.length)%F.length);return}if(J.key==="Enter"||J.key==="Tab"){J.preventDefault();let B=F[P];if(B)l(B);return}if(J.key==="Escape"){y(!1);return}}if(J.key==="Enter"&&(J.metaKey||J.ctrlKey))J.preventDefault(),A()};return N("div",{className:"relative flex flex-col w-full border border-border focus-within:border-foreground/40 bg-card rounded-2xl p-2.5 shadow-2xs transition-all",children:[L&&F.length>0&&b("div",{ref:p,className:"absolute bottom-full left-0 mb-2 w-64 max-h-48 overflow-y-auto rounded-xl border border-border bg-popover p-1 shadow-lg z-50",children:F.map((J,B)=>N("button",{type:"button",onClick:()=>l(J),className:`w-full flex items-center gap-2 px-2.5 py-1.5 rounded-lg text-xs transition-colors text-left ${B===P?"bg-primary text-primary-foreground font-medium":"hover:bg-muted text-foreground"}`,children:[N(Z0,{className:"w-5 h-5",children:[J.image&&b(f0,{src:J.image}),b(z0,{className:"text-[9px]",children:J.name?.slice(0,2).toUpperCase()})]}),b("span",{className:"truncate",children:J.name})]},J.id))}),D.length>0&&b("div",{className:"flex flex-wrap gap-1.5 pb-2 mb-1.5 border-b border-border/50",children:D.map((J)=>{let B=J.file.type.startsWith("image/");return N("div",{className:"flex items-center gap-1.5 pl-2 pr-1.5 py-1 rounded-lg bg-muted/60 border border-border text-xs max-w-[200px]",children:[J.isUploading?b(h,{className:"w-3.5 h-3.5 animate-spin text-primary shrink-0"}):B?b(vb,{className:"w-3.5 h-3.5 text-primary shrink-0"}):b(A0,{className:"w-3.5 h-3.5 text-muted-foreground shrink-0"}),N("div",{className:"min-w-0 flex-1 truncate",children:[b("span",{className:"truncate block font-medium text-[11px]",children:J.file.name}),b("span",{className:"text-[9px] text-muted-foreground font-mono",children:Q0(J.file.size)})]}),b("button",{type:"button",onClick:()=>E(J.id),className:"p-0.5 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted shrink-0",children:b(U0,{className:"w-3 h-3"})})]},J.id)})}),b("textarea",{ref:W,value:Z,onChange:k,onKeyDown:o,placeholder:K.comment_placeholder(),rows:1,className:"w-full min-h-[44px] max-h-[160px] bg-transparent border-0 focus:outline-hidden focus-visible:ring-0 resize-none text-xs text-foreground placeholder:text-muted-foreground/70 p-1 font-sans leading-relaxed"}),N("div",{className:"flex items-center justify-between pt-1 mt-1 border-t border-border/40",children:[N("div",{className:"flex items-center gap-1",children:[b("input",{ref:f,type:"file",multiple:!0,className:"hidden",onChange:i}),b(r,{type:"button",variant:"ghost",size:"icon-xs",onClick:()=>f.current?.click(),className:"h-7 w-7 rounded-lg text-muted-foreground hover:text-foreground hover:bg-muted",title:"Attach files",disabled:Y,children:b(Mb,{className:"w-3.5 h-3.5"})}),b("span",{className:"text-[10px] text-muted-foreground/60 hidden sm:inline pl-1",children:"Cmd+Enter to send"})]}),b(r,{type:"button",size:"icon-xs",onClick:A,disabled:!q||Y,className:"h-7 w-7 rounded-full shadow-xs bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-40 transition-all shrink-0",title:"Send comment",children:Y||V?b(h,{className:"w-3.5 h-3.5 animate-spin"}):b(Lb,{className:"w-3.5 h-3.5 stroke-[2.5]"})})]})]})}function pb({teamId:_,taskId:G,initialComments:Y}){let Z=R0(),[O,D]=hb.useState(null),{data:X}=S({queryKey:["teams",_,"me"],queryFn:async()=>{let f=await R.api.teams[":teamId"].me.$get({param:{teamId:_}});if(!f.ok)throw Error("Failed to fetch me");return await f.json()},enabled:!!_}),L=X?.role?.toLowerCase()==="owner"||X?.role?.toLowerCase()==="editor",{data:y,isLoading:U}=S({queryKey:["teams",_,"kanban","tasks",G,"comments"],queryFn:async()=>{let f=await R.api.teams[":teamId"].kanban.tasks[":taskId"].comments.$get({param:{teamId:_,taskId:G}});if(!f.ok)throw Error("Failed to fetch comments");return await f.json()},initialData:Y?{data:Y}:void 0,enabled:!!_&&!!G,refetchInterval:4000}),T=y?.data||[],{mutateAsync:P,isPending:v}=_0({mutationFn:async({body:f,attachments:p})=>{let z=await R.api.teams[":teamId"].kanban.tasks[":taskId"].comments.$post({param:{teamId:_,taskId:G},json:{body:f,attachments:p}});if(!z.ok){let w=await z.json().catch(()=>({message:K.error()}));throw Error(w.message||K.error())}return await z.json()},onSuccess:()=>{Z.invalidateQueries({queryKey:["teams",_,"kanban","tasks",G,"comments"]}),Z.invalidateQueries({queryKey:["teams",_,"kanban","task",G]}),Z.invalidateQueries({queryKey:["teams",_,"kanban","tasks"]})},onError:(f)=>{c.error(f.message)}}),W=async(f,p)=>{await P({body:f,attachments:p})};return N("div",{className:"flex flex-col h-full overflow-hidden bg-background",children:[O&&N("div",{className:"fixed inset-0 z-50 bg-black/90 flex flex-col items-center justify-center p-4 animate-in fade-in duration-150",onClick:()=>D(null),children:[b("button",{type:"button",onClick:()=>D(null),className:"absolute top-4 right-4 text-white/80 hover:text-white bg-white/10 hover:bg-white/20 rounded-full p-2 transition-colors z-50 cursor-pointer",title:"Close",children:b(U0,{className:"w-6 h-6"})}),b("div",{className:"w-full h-full flex items-center justify-center p-2",children:b("img",{src:O.url,alt:O.name,className:"max-w-full max-h-[85vh] object-contain rounded-lg shadow-2xl",onClick:(f)=>f.stopPropagation()})})]}),b(u,{className:"flex-1 p-3.5",children:b("div",{className:"space-y-3 pr-1 pb-2",children:U?b("div",{className:"flex items-center justify-center py-12",children:b(h,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):T.length===0?N("div",{className:"flex flex-col items-center justify-center py-16 text-center text-xs text-muted-foreground/80 space-y-2",children:[b("div",{className:"w-10 h-10 rounded-full bg-muted/60 flex items-center justify-center",children:b(gb,{className:"w-5 h-5 opacity-40"})}),b("p",{className:"font-medium",children:K.no_comments_yet()})]}):T.map((f)=>b(wb,{teamId:_,taskId:G,comment:f,currentUserId:X?.id,isOwnerOrAdmin:L,onViewAttachment:(p)=>D(p)},f.id))})}),b("div",{className:"p-3 border-t border-border/60 bg-card/60 shrink-0",children:b(Cb,{teamId:_,onSendMessage:W,isSubmitting:v})})]})}function cb(_){let G=_.data||{};switch(_.type){case m.CREATED:return"Created task";case m.STATUS_CHANGED:return`Changed status from ${_.fromStatus?K0(_.fromStatus):"None"} to ${_.toStatus?K0(_.toStatus):"None"}`;case m.ASSIGNED:return"Assigned task";case m.UNASSIGNED:return"Unassigned task";case m.PRIORITY_CHANGED:return`Changed priority to ${String(G.to||"")}`;case m.GOAL_CHANGED:return"Updated goal association";case m.DEPENDENCY_ADDED:return"Added prerequisite dependency";case m.DEPENDENCY_REMOVED:return"Removed prerequisite dependency";case m.CHANGES_REQUESTED:return`Requested changes: "${String(G.reason||"")}"`;case m.BLOCKED:return`Task blocked: "${String(G.reason||G.blockReason||"")}"`;case m.UNBLOCKED:return"Task unblocked";case m.COMMENTED:return"Added a comment";default:return _.type}}function Ab({teamId:_,taskId:G,initialEvents:Y}){let{data:Z,isLoading:O}=S({queryKey:["teams",_,"kanban","tasks",G,"events"],queryFn:async()=>{let X=await R.api.teams[":teamId"].kanban.tasks[":taskId"].events.$get({param:{teamId:_,taskId:G}});if(!X.ok)throw Error("Failed to fetch events");return await X.json()},initialData:Y?{data:Y}:void 0,enabled:!!_&&!!G}),D=Z?.data||[];return b(u,{className:"h-full p-3",children:b("div",{className:"space-y-4 pr-2",children:b("div",{className:"space-y-2",children:O?b("div",{className:"flex items-center justify-center py-6",children:b(h,{className:"w-4 h-4 animate-spin text-muted-foreground"})}):D.length===0?b("div",{className:"py-6 text-center text-xs text-muted-foreground",children:K.no_activity_yet()}):b("div",{className:"relative pl-5 space-y-3 before:absolute before:left-[4px] before:top-2 before:bottom-2 before:w-[2px] before:bg-border/60",children:D.map((X)=>N("div",{className:"relative flex items-start gap-2 text-xs",children:[b("div",{className:"absolute -left-5 top-[3px] w-2.5 h-2.5 rounded-full bg-background border-2 border-primary shrink-0"}),N("div",{className:"flex-1 min-w-0",children:[N("div",{className:"flex items-center justify-between gap-1",children:[b("span",{className:"font-medium text-foreground truncate",children:X.actor?.name||"System"}),b("span",{className:"text-[10px] text-muted-foreground font-mono shrink-0",children:S0(new Date(X.createdAt),"MM/dd HH:mm")})]}),b("p",{className:"text-[11px] text-muted-foreground leading-snug mt-0.5",children:cb(X)})]})]},X.id))})})})})}function ob({teamId:_,task:G}){let[Y,Z]=Fb.useState("comments");return b("div",{className:"flex flex-col h-full bg-sidebar/30 border-l border-border/60 overflow-hidden",children:N(Sb,{value:Y,onValueChange:(O)=>Z(O),className:"flex flex-col h-full",children:[b("div",{className:"px-3 pt-2.5 pb-1 border-b border-border/60 bg-card/50 shrink-0",children:N(rb,{className:"w-full grid grid-cols-2 h-8 bg-muted/60",children:[N(u0,{value:"comments",className:"text-xs h-7",children:[b("span",{children:K.comments()}),G.comments.length>0&&N("span",{className:"text-[10px] font-mono text-muted-foreground ml-1",children:["(",G.comments.length,")"]})]}),b(u0,{value:"activity",className:"text-xs h-7",children:b("span",{children:K.activity()})})]})}),N("div",{className:"flex-1 overflow-hidden",children:[b(I0,{value:"comments",className:"h-full m-0 data-[state=active]:flex data-[state=active]:flex-col",children:b(pb,{teamId:_,taskId:G.id,initialComments:G.comments})}),b(I0,{value:"activity",className:"h-full m-0 data-[state=active]:block",children:b(Ab,{teamId:_,taskId:G.id,initialEvents:G.events})})]})]})})}function z_({teamId:_,taskId:G,isOpen:Y,onClose:Z,canEdit:O=!0}){let{data:D,isLoading:X,error:L}=S({queryKey:["teams",_,"kanban","task",G],queryFn:async()=>{if(!G)return null;let y=await R.api.teams[":teamId"].kanban.tasks[":taskId"].$get({param:{teamId:_,taskId:G}});if(!y.ok)throw Error("Failed to fetch task details");return await y.json()},enabled:!!_&&!!G&&Y});return b(V0,{open:Y,onOpenChange:(y)=>!y&&Z(),children:N(O0,{className:"sm:max-w-5xl w-[95vw] h-[88vh] p-0 gap-0 flex flex-col overflow-hidden bg-background",children:[b(q0,{className:"px-5 py-3 border-b border-border/70 flex flex-row items-center justify-between space-y-0 shrink-0 bg-card/80",children:N("div",{className:"flex items-center gap-2 min-w-0 pr-4",children:[D?.isAgentTask&&N("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-[11px] font-semibold bg-orange-500/15 text-orange-600 dark:text-orange-400 border border-orange-500/30 shrink-0",children:[b(L0,{className:"w-3.5 h-3.5"}),b("span",{children:K.task_type_agent()})]}),D?.status&&b("span",{className:j("px-2 py-0.5 rounded text-[11px] font-medium border uppercase shrink-0",T0(D.status)),children:K0(D.status)}),b(B0,{className:"text-sm font-semibold truncate text-foreground",children:D?.title||K.edit_task()})]})}),b("div",{className:"flex-1 flex flex-col md:flex-row overflow-hidden",children:X?b("div",{className:"flex-1 flex items-center justify-center p-12",children:b(h,{className:"w-8 h-8 animate-spin text-muted-foreground"})}):L||!D?b("div",{className:"flex-1 flex items-center justify-center p-12 text-xs text-muted-foreground",children:K.file_not_found()}):N(w0,{children:[b("div",{className:"flex-1 md:w-2/3 h-full overflow-hidden flex flex-col",children:b(Hb,{teamId:_,task:D,canEdit:O})}),b("div",{className:"md:w-1/3 h-full overflow-hidden flex flex-col",children:b(ob,{teamId:_,task:D})})]})})]})})}
2
- export{db as Re,K0 as Se,ub as Te,T0 as Ue,c0 as Ve,n0 as We,j0 as Xe,_b as Ye,Eb as Ze,z_ as _e};
@@ -1,2 +0,0 @@
1
- import{uh as e}from"./chunk-dkjkn8t3.js";import{Pl as b,Vj as re,Vl as w,Xi as p,_l as m}from"./chunk-kqpzx5az.js";var u={human:"human",agent:"agent"};var S={editor:"editor",reviewer:"reviewer"};var Q={team:"team",project:"project"};var L={all_members:"all_members",each_member:"each_member",selected_members:"selected_members"};var A={agent_total_tokens:"agent_total_tokens",agent_cost:"agent_cost",agent_mcp_call_count:"agent_mcp_call_count",agent_bash_call_count:"agent_bash_call_count",agent_tool_call_count:"agent_tool_call_count"},s={TODO:"TODO",READY:"READY",IN_PROGRESS:"IN_PROGRESS",BLOCKED:"BLOCKED",IN_REVIEW:"IN_REVIEW",DONE:"DONE"},l={LOW:"LOW",MEDIUM:"MEDIUM",HIGH:"HIGH",URGENT:"URGENT"},d={CREATED:"CREATED",STATUS_CHANGED:"STATUS_CHANGED",ASSIGNED:"ASSIGNED",UNASSIGNED:"UNASSIGNED",COMMENTED:"COMMENTED",CHANGES_REQUESTED:"CHANGES_REQUESTED",BLOCKED:"BLOCKED",UNBLOCKED:"UNBLOCKED",PRIORITY_CHANGED:"PRIORITY_CHANGED",GOAL_CHANGED:"GOAL_CHANGED",DEPENDENCY_ADDED:"DEPENDENCY_ADDED",DEPENDENCY_REMOVED:"DEPENDENCY_REMOVED"},O={chat:"chat",autofill:"autofill",embedding:"embedding"};var c=e.object({cursor:e.string().optional(),total:e.number().optional(),totalSize:e.number().optional()}),a=e.object({first:e.coerce.number().optional(),after:e.string().optional()});var ot=e.object({name:e.string()}),ne=e.object({id:e.string(),name:e.string(),rootFolder:e.string().optional(),updatedAt:e.union([e.string(),e.date()])});var rt=e.object({data:e.array(ne),pageInfo:c}),at=e.object({teamId:e.string(),userId:e.string()}),nt=e.object({id:e.string(),name:e.string(),email:e.string().optional(),role:e.enum(["owner","editor","reviewer","bot","unknown"]),image:e.string().optional(),unreadNotificationCount:e.number().optional()}),st=e.object({name:e.string().optional(),imageKey:e.string().nullable().optional()}),it=e.object({id:e.string(),name:e.string(),role:e.enum(["owner","editor","reviewer","bot","unknown"]),email:e.string().optional(),type:e.nativeEnum(u).optional(),image:e.string().optional(),scope:e.nativeEnum(Q).optional()}),pt=e.object({includeAgents:e.string().optional().transform((t)=>t==="true")}),se={best_match:"best_match",all:"all"},ie={off:"off",auto:"auto"},ct=e.union([e.object({key:e.literal("transcode.videoStrategy"),value:e.nativeEnum(se)}),e.object({key:e.literal("transcode.hardwareAcceleration"),value:e.nativeEnum(ie)})]),lt=e.object({networkSandboxEnabled:e.boolean(),allowedDomains:e.array(e.string()),pendingDomains:e.array(e.string()).default([])}),mt=e.object({networkSandboxEnabled:e.boolean().optional(),allowedDomains:e.array(e.string()).optional(),pendingDomains:e.array(e.string()).optional()}),ut=e.object({role:e.enum(["editor","reviewer"])});var F=e.nativeEnum(O),G=e.enum(["off","minimal","low","medium","high","xhigh"]),_=e.enum(["owner","editor","reviewer"]),pe=e.object({id:e.string().optional(),skillId:e.string(),skill:e.object({id:e.string(),name:e.string()}).optional()}),yt=e.object({id:e.string(),name:e.string(),type:F,enabled:e.boolean(),permission:_.optional().default("reviewer"),avatar:e.string().optional(),providerId:e.string().optional(),modelId:e.string().optional(),thinkingLevel:G.optional().default("off"),systemPrompt:e.string().optional(),soul:e.string().optional(),skills:e.array(pe).optional(),mcpServerIds:e.array(e.string()).optional(),deniedTools:e.array(e.string()).optional()}),V=e.object({name:e.string().min(1),type:F,enabled:e.boolean().optional().default(!0),permission:_.optional(),avatar:e.string().optional(),providerId:e.string().optional(),modelId:e.string().optional(),thinkingLevel:G.optional().default("off"),systemPrompt:e.string().optional(),soul:e.string().optional(),skills:e.array(e.string()).optional(),mcpServerIds:e.array(e.string()).optional(),deniedTools:e.array(e.string()).optional()}),bt=V.superRefine((t,r)=>{if(t.type==="chat"||t.type==="autofill"){if(!t.providerId)r.addIssue({code:e.ZodIssueCode.custom,message:"providerId is required for chat/autofill agents",path:["providerId"]});if(!t.modelId)r.addIssue({code:e.ZodIssueCode.custom,message:"modelId is required for chat/autofill agents",path:["modelId"]})}}),ht=V.superRefine((t,r)=>{if(t.type==="chat"||t.type==="autofill"){if(!t.providerId)r.addIssue({code:e.ZodIssueCode.custom,message:"providerId is required for chat/autofill agents",path:["providerId"]});if(!t.modelId)r.addIssue({code:e.ZodIssueCode.custom,message:"modelId is required for chat/autofill agents",path:["modelId"]})}}),St=e.object({permission:_}),_t=e.object({id:e.string(),sessionId:e.string(),entry:e.unknown()}),xt=e.object({id:e.string(),name:e.string().nullable().optional(),type:e.string(),createdAt:e.string(),creator:e.object({id:e.string(),name:e.string().nullable().optional(),email:e.string().nullable().optional(),image:e.string().nullable().optional()}).nullable().optional(),agentId:e.string().optional()});var It=e.object({apiKey:e.string().optional(),baseUrl:e.string().optional(),chatModels:e.array(e.string()).optional()}),ce=e.enum(["1h","24h","7d","30d"]),Tt=e.object({timeframe:ce.default("30d"),userId:e.string().optional()});var Pt=e.object({data:e.array(e.lazy(()=>fe)),pageInfo:c}),W=e.object({proxyType:e.enum(["image","video","audio","pdf"]).nullable().optional(),thumbnailUrl:e.string().optional(),originalHeight:e.number().optional(),originalWidth:e.number().optional(),spriteUrl:e.string().optional(),duration:e.number().optional(),pageCount:e.number().optional()}),le=e.object({type:e.string().nullable(),preview:W.nullable()}),f=e.object({id:e.string(),name:e.string(),image:e.string().optional()}),me=e.object({fieldId:e.string(),value:e.any()}),ue=e.object({id:e.string(),name:e.string()}),de=e.object({duration:e.number().optional(),originalWidth:e.number().optional(),originalHeight:e.number().optional(),frameRate:e.number().optional(),totalFrames:e.number().optional(),startTimecode:e.string().optional()}),fe=e.object({id:e.string(),name:e.string(),sizeByte:e.number(),fileCount:e.number(),type:e.string(),targetType:e.string().optional().nullable(),status:e.string(),proxyType:e.enum(["image","video","audio","pdf"]).nullable().optional(),latestChildren:e.array(le).optional(),preview:W.nullable().optional(),createdAt:e.string(),updatedAt:e.string(),deletedAt:e.string().nullable().optional(),projectId:e.string().optional().nullable(),creator:f.nullable().optional(),fieldValues:e.array(me).optional(),sortIndex:e.string().optional().nullable(),startTime:e.number().optional().nullable(),endTime:e.number().optional().nullable(),hasAgentsMd:e.boolean().optional(),media:e.object({original:e.object({key:e.string().optional()}).optional(),videoTranscodes:e.array(e.object({id:e.string(),url:e.string(),key:e.string(),width:e.number(),height:e.number(),size:e.number()})).optional(),imageTranscodes:e.array(e.object({id:e.string(),url:e.string(),key:e.string(),width:e.number(),height:e.number(),size:e.number()})).optional(),videoPreview:e.object({url:e.string(),key:e.string().optional()}).optional(),pdfTranscode:e.object({url:e.string(),key:e.string().optional()}).optional(),proxyType:e.enum(["image","video","audio","pdf"]).nullable().optional(),metadata:de.optional()}).optional(),ancestorFolders:e.array(ue).optional(),versionStack:e.object({id:e.string(),versions:e.array(e.object({version:e.number(),current:e.boolean(),id:e.string(),name:e.string().optional().nullable(),previewUrl:e.string().optional().nullable(),createdAt:e.string().optional().nullable(),creator:e.object({id:e.string(),name:e.string().nullable(),image:e.string().optional().nullable()}).nullable().optional()}))}).optional().nullable()}),Et=e.object({name:e.string(),type:e.string(),projectId:e.string().optional(),parentId:e.string().optional(),key:e.string().optional(),sizeByte:e.number().optional(),contentType:e.string().optional(),creatorId:e.string().optional()}),Ct=e.object({assetId:e.string()}),Mt=e.object({id:e.string(),name:e.string()}),Dt=e.object({assetId:e.string().optional(),assetType:e.string(),projectId:e.string().optional(),showDeleted:e.boolean().optional(),prefix:e.string().optional(),sort:e.string().optional(),order:e.string().optional(),...a.shape}),Ut=e.object({assetId:e.string(),userId:e.string(),replyToId:e.string().optional(),message:e.string(),annotations:e.any().optional(),second:e.number().optional(),attachmentIds:e.array(e.string())}),ge=e.object({id:e.string(),assetId:e.string(),url:e.string(),proxyType:e.enum(["image","video","audio","pdf"]).nullable().optional()}),ye=e.object({id:e.string(),assetId:e.string(),message:e.string().nullable(),annotations:e.any(),second:e.number().nullable(),creator:f,replies:e.array(e.lazy(()=>ye)),attachments:e.array(ge),mentions:e.array(f),createdAt:e.string(),updatedAt:e.string(),sessionId:e.string().nullable(),isCompleted:e.boolean(),completionLastChangedBy:f.nullable()}),Nt=e.object({isCompleted:e.boolean()}),Kt=e.object({newParentId:e.string(),assetIds:e.array(e.string()),creatorId:e.string().optional()}),wt=e.object({newParentId:e.string(),assetIds:e.array(e.string()),withComments:e.boolean().default(!1),creatorId:e.string().optional()}),Qt=e.object({name:e.string()}),Lt=e.object({beforeIndex:e.string().optional(),afterIndex:e.string().optional()}),At=e.object({ids:e.array(e.string())}),Ot=e.object({ids:e.array(e.string())}),Ft=e.object({file:e.instanceof(File)}),Gt=e.object({key:e.string()}),Vt=e.object({fileName:e.string(),contentType:e.string(),size:e.number()}),Wt=e.object({id:e.string(),uploadUrl:e.string()}),Bt=e.object({ids:e.array(e.string())}),be=e.object({id:e.string(),name:e.string(),url:e.string()}),Ht=e.object({files:e.array(be)});var Jt=e.object({userCount:e.number()}),Xt=e.object({name:e.string().min(1,"Name is required").max(100,"Name is too long")}),$t=e.object({id:e.string(),token:e.string(),name:e.string(),createdAt:e.string()});var he=e.enum(["is","eq","neq","gt","gte","lt","lte","contains","notContains","isEmpty","isNotEmpty","in","notIn","hasAny","hasAll","hasNone","isWithin"]),Se=e.object({field:e.string(),operator:he,value:e.any()}),_e=e.enum(["asc","desc"]),xe=e.object({field:e.string(),order:_e}),ke=e.enum(["AND","OR"]),Re=e.enum(["file","folder"]),x=e.object({operator:ke.optional().default("AND"),conditions:e.array(Se).optional().default([]),sort:xe.optional(),assetType:Re.optional(),showSymlink:e.boolean().optional(),recursively:e.boolean().optional().default(!0),query:e.string().optional(),isSemantic:e.boolean().optional().default(!1)}),oo=x.extend(a.shape);var k=e.object({sourceFolderId:e.string(),searchFilter:x}),Ie=e.object({id:e.string(),name:e.string(),filter:k,projectId:e.string(),createdAt:e.string(),updatedAt:e.string(),creator:e.object({id:e.string(),name:e.string(),image:e.string().optional().nullable()}).optional().nullable()}),io=e.object({name:e.string(),filter:k}),po=e.object({name:e.string().optional(),filter:k.optional()});var co=e.object({data:e.array(Ie),pageInfo:e.object({cursor:e.string().optional(),total:e.number().optional()})});var uo=e.object({name:e.string(),parentId:e.string()}),fo=e.object({name:e.string()}),go=e.object({ids:e.array(e.string())}),yo=e.object({ids:e.array(e.string())}),bo=e.object({content:e.string().max(1e5)});var xo=e.object({code:e.string(),role:e.string(),teamId:e.string(),teamName:e.string(),projectId:e.string().optional(),projectName:e.string().optional(),inviterName:e.string(),isUsed:e.boolean()}),ko=e.object({role:e.nativeEnum(S)}),Ro=e.object({role:e.nativeEnum(S)}),Io=e.object({code:e.string()});var Po={text:"text",longText:"longText",select:"select",selectMulti:"selectMulti",rating:"rating",number:"number",toggle:"toggle",date:"date",user:"user",userMulti:"userMulti"},Te={NONE:"NONE",CONTENT:"CONTENT",CREATION_CONTEXT:"CREATION_CONTEXT"},Eo=e.object({id:e.string(),displayName:e.string(),color:e.string().optional()}),R=e.object({name:e.string(),type:e.enum(["text","longText","select","selectMulti","rating","number","toggle","date","user","userMulti"]),autofillSource:e.nativeEnum(Te).optional(),text:e.any().optional(),longText:e.any().optional(),select:e.any().optional(),selectMulti:e.any().optional(),rating:e.any().optional(),number:e.any().optional(),toggle:e.any().optional(),date:e.any().optional(),user:e.any().optional(),userMulti:e.any().optional()}),Co=e.object({key:e.string().optional(),label:e.string().optional(),scope:e.string().optional(),config:R,description:e.string().default("")}),Mo=e.object({label:e.string().optional(),config:R,description:e.string().optional()}),ve=e.object({fieldId:e.string(),visible:e.boolean()}),Do=e.array(ve),je=e.object({key:e.string(),value:e.any()}),Uo=e.array(je),No=e.object({id:e.string(),config:R,scope:e.string(),readOnly:e.boolean(),visible:e.boolean(),description:e.string()});var B=e.enum(["auto","none","bearer","oauth"]),I=e.enum(["streamable_http","sse"]),g=e.enum(["owner","editor","reviewer"]),qe=e.object({grantType:e.enum(["authorization_code","client_credentials"]).optional(),clientId:e.string().optional(),clientSecret:e.string().optional(),scope:e.string().optional(),authorizationParams:e.record(e.string(),e.string()).optional(),redirectUri:e.string().optional(),clientName:e.string().optional(),clientUri:e.string().optional(),skipIssuerMetadataValidation:e.boolean().optional()}),H=e.object({type:B.optional(),bearerToken:e.string().optional(),headers:e.record(e.string(),e.string()).optional(),oauth:qe.optional()}),T=e.object({excludeTools:e.array(e.string()).optional(),requestTimeoutMs:e.number().int().positive().optional(),idleTimeoutMs:e.number().int().positive().optional(),keepAlive:e.boolean().optional(),protocolVersion:e.enum(["legacy","auto","2026-07-28"]).optional(),directTools:e.array(e.string()).optional()}),Pe=e.object({name:e.string(),title:e.string().optional(),description:e.string().optional(),inputSchema:e.unknown().optional()}),Qo=e.object({url:e.string().url(),transport:I.optional(),authConfig:H.optional(),config:T.optional(),permission:g.optional()}),Lo=e.object({transport:I.optional(),authConfig:H.optional(),config:T.optional(),permission:g.optional()}),Ao=e.object({permission:g}),Ee=e.object({id:e.string(),name:e.string(),description:e.string().optional(),instructions:e.string().optional(),url:e.string(),transport:I,authType:B,config:T.optional(),permission:g,status:e.string(),lastError:e.string().nullable().optional(),toolCount:e.number(),hasCredential:e.boolean(),createdAt:e.string(),updatedAt:e.string()}),Oo=e.object({servers:e.array(Ee)}),Fo=e.object({}),Go=e.object({tools:e.array(Pe)}),Z=e.enum(["authenticated","expired","not_authenticated","in_progress"]),Vo=e.object({status:Z}),Wo=e.object({authorizationUrl:e.string().optional(),status:Z}),Bo=e.object({code:e.string(),iss:e.string().optional()}),Ho=e.object({ok:e.boolean(),toolCount:e.number(),message:e.string().optional()});var Y=e.object({id:e.string().optional(),name:e.string().optional(),role:e.string().optional()}),J=e.object({id:e.string().optional(),name:e.string().optional()}),Ce=e.object({id:e.string().optional(),proxyType:e.enum(["image","video","audio","pdf"]).nullable().optional(),name:e.string().optional(),preview:e.string().optional(),thumbnailUrl:e.string().optional(),originalWidth:e.number().optional(),originalHeight:e.number().optional()}),Me=e.object({id:e.string().optional(),title:e.string().optional(),status:e.string().optional()}),Jo=e.object({id:e.string().optional(),creator:Y.optional(),type:e.string().optional(),team:J.optional(),project:J.optional(),asset:Ce.optional(),kanbanTask:Me.optional(),user:Y.optional(),createdAt:e.string().optional(),isRead:e.boolean().optional()}),Xo=e.object({unreadOnly:e.union([e.boolean(),e.string()]).transform((t)=>t===!0||t==="true").optional(),after:e.string().optional(),pageSize:e.coerce.number().optional()}),$o=e.object({notificationId:e.string().min(1)}),zo=e.object({comments:e.boolean().default(!0),replies:e.boolean().default(!0),mentions:e.boolean().default(!0),yourUploads:e.boolean().default(!1),otherUploads:e.boolean().default(!0),statusUpdates:e.boolean().default(!0),kanbanTasks:e.boolean().default(!0),kanbanComments:e.boolean().default(!0)});var ar=e.object({name:e.string(),coverImageKey:e.string().optional(),enableNotification:e.boolean().default(!0)}),nr=e.object({name:e.string().optional(),coverImageKey:e.string().optional(),enableNotification:e.boolean().optional()}),De=e.object({id:e.string(),name:e.string(),teamId:e.string(),rootFolder:e.string().optional(),coverImage:e.string().optional(),coverImageKey:e.string().optional(),enableNotification:e.boolean(),updatedAt:e.union([e.string(),e.date()])}),sr=e.object({sortBy:e.string().optional(),sortDirection:e.enum(["asc","desc"]).optional()}).merge(a),ir=e.object({data:e.array(De),pageInfo:c}),pr=e.object({teamId:e.string()}),cr=e.object({id:e.string(),name:e.string(),role:e.enum(["owner","editor","reviewer","bot","unknown"]),type:e.nativeEnum(u).optional(),image:e.string().optional(),scope:e.enum(["team","project"]).optional(),hasCustomRole:e.boolean().optional()}),lr=e.object({assetType:e.string(),sort:e.enum(["createdAt","name","size"]).optional(),order:e.enum(["asc","desc"]).optional()}).merge(a),mr=e.object({role:e.enum(["editor","reviewer"])}),ur=e.object({userId:e.string(),role:e.enum(["owner","editor","reviewer"])}),dr=e.object({id:e.string(),name:e.string(),role:e.enum(["owner","editor","reviewer","bot","unknown"]),image:e.string().optional()});var X=["openai-completions","mistral-conversations","openai-responses","azure-openai-responses","openai-codex-responses","anthropic-messages","bedrock-converse-stream","google-generative-ai","google-vertex"],Ue=e.object({api:e.enum(X).optional(),reasoning:e.boolean().default(!1),input:e.array(e.enum(["text","image"])).default(["text"]),contextWindow:e.number().int().positive().default(128000),maxTokens:e.number().int().positive().default(4096),cost:e.object({input:e.number().nonnegative().default(0),output:e.number().nonnegative().default(0),cacheRead:e.number().nonnegative().default(0),cacheWrite:e.number().nonnegative().default(0)})}),v=e.object({id:e.string().optional(),modelId:e.string().min(1,"Model ID is required"),name:e.string().min(0).default(""),config:Ue}),j=e.object({baseUrl:e.string().url("Must be a valid URL").optional().or(e.literal("")),apiKey:e.string().optional().or(e.literal("")),api:e.enum(X),headers:e.record(e.string(),e.string()).optional(),authHeader:e.boolean().optional()}),yr=e.object({name:e.string().min(1,"Provider name is required"),config:j,models:e.array(v).min(1,"At least one model is required")}),br=e.object({config:j,models:e.array(v).min(1,"At least one model is required")}),hr=e.object({id:e.string(),name:e.string(),isBuiltin:e.boolean(),config:j,models:e.array(v).optional(),modelsCount:e.number().optional(),createdAt:e.date(),updatedAt:e.date()});var kr=e.object({name:e.string().min(1),expireAt:e.string().datetime().optional(),password:e.string().optional(),isDisabled:e.boolean().optional(),allowDownload:e.boolean().optional(),defaultSortOrder:e.string().optional(),viewMode:e.string().optional()}),Rr=e.object({name:e.string().min(1).optional(),expireAt:e.string().datetime().optional().nullable(),password:e.string().optional().nullable(),isDisabled:e.boolean().optional(),allowDownload:e.boolean().optional(),defaultSortOrder:e.string().optional().nullable(),viewMode:e.string().optional().nullable(),fieldVisibility:e.record(e.string(),e.boolean()).optional().nullable()}),Ir=a.extend({projectId:e.string().optional()}),Tr=e.object({assetIds:e.array(e.string().min(1)).min(1)});var qr=e.object({assetId:e.string().optional(),githubUrl:e.string().optional(),override:e.boolean().optional()}),Pr=e.object({config:e.object({environmentVariables:e.array(e.object({name:e.string(),default:e.string().optional()}))})}),Er=e.object({permission:e.enum(["owner","editor","reviewer"])});var $=e.lazy(()=>e.object({name:e.string(),id:e.string(),size:e.number(),children:e.array($),type:e.string(),mediaType:e.string().optional()})),Dr=e.object({parentId:e.string(),files:e.array($)}),Ne=e.object({id:e.string(),fileId:e.string(),url:e.string()}),Ur=e.object({taskId:e.string(),presignedUrls:e.array(Ne),createdAssets:e.array(e.object({tempId:e.string(),assetId:e.string()})).optional()}),Nr=e.object({fileId:e.string(),errorMessage:e.string().optional()}),Kr=e.object({id:e.string(),name:e.string(),total:e.number(),uploaded:e.number(),createdAt:e.string()}),wr=e.object({bucket:e.string(),key:e.string(),Signature:e.string()}),Qr=e.object({file:e.instanceof(File)});var Ke=e.object({key:e.string(),value:e.unknown()}),Or=e.object({value:e.unknown()}),Fr=e.array(Ke);var Wr=e.object({fileIds:e.array(e.string())}),Br=e.object({fileId:e.string(),beforeId:e.string()}),Hr=e.object({id:e.string(),version:e.number(),name:e.string().optional().nullable(),previewUrl:e.string().optional().nullable(),createdAt:e.string().optional().nullable(),creator:e.object({id:e.string(),name:e.string().nullable(),image:e.string().optional().nullable()}).nullable().optional()});var Jr=e.object({agentId:e.string(),textPrompt:e.string().optional(),attachedFiles:e.array(e.string()).optional(),assetIds:e.array(e.string()).optional(),sessionId:e.string().optional(),contextAssetId:e.string().optional(),projectId:e.string().optional()}).superRefine((t,r)=>{let n=t.textPrompt&&t.textPrompt.trim().length>0,h=t.attachedFiles&&t.attachedFiles.length>0,ae=t.assetIds&&t.assetIds.length>0;if(!n&&!h&&!ae)r.addIssue({code:e.ZodIssueCode.custom,message:"At least one of textPrompt, attachedFiles, or assetIds must be provided.",path:["textPrompt"]})}),Xr=e.object({id:e.string(),agentId:e.string(),userId:e.string().nullable(),assetId:e.string().nullable(),userCommentId:e.string().nullable(),name:e.string().nullable().optional(),createdAt:e.string(),updatedAt:e.string()}),$r=e.intersection(e.object({id:e.string()}),e.unknown());var y;((o)=>{o.team_create="team_create";o.team_update="team_update";o.team_delete="team_delete";o.team_member_add="team_member_add";o.team_member_update="team_member_update";o.team_member_remove="team_member_remove";o.project_create="project_create";o.project_update="project_update";o.project_delete="project_delete";o.project_empty_trash="project_empty_trash";o.project_member_add="project_member_add";o.project_member_update="project_member_update";o.project_member_remove="project_member_remove";o.file_create="file_create";o.file_update="file_update";o.file_delete="file_delete";o.folder_create="folder_create";o.folder_update="folder_update";o.folder_delete="folder_delete";o.asset_reparent="asset_reparent";o.asset_copy="asset_copy";o.share_create="share_create";o.share_update="share_update";o.share_delete="share_delete";o.agent_create="agent_create";o.agent_update="agent_update";o.agent_delete="agent_delete";o.skill_create="skill_create";o.skill_update="skill_update";o.skill_delete="skill_delete";o.mcp_server_create="mcp_server_create";o.mcp_server_update="mcp_server_update";o.mcp_server_delete="mcp_server_delete";o.provider_create="provider_create";o.provider_update="provider_update";o.provider_delete="provider_delete";o.invite_create="invite_create";o.invite_revoke="invite_revoke";o.metadata_field_create="metadata_field_create";o.metadata_field_update="metadata_field_update";o.metadata_field_delete="metadata_field_delete";o.comment_create="comment_create";o.comment_update="comment_update";o.comment_delete="comment_delete";o.comment_complete="comment_complete";o.quota_rule_create="quota_rule_create";o.quota_rule_update="quota_rule_update";o.quota_rule_delete="quota_rule_delete";o.quota_record_reset="quota_record_reset";o.quota_policy_create="quota_policy_create";o.quota_policy_update="quota_policy_update";o.quota_policy_delete="quota_policy_delete";o.kanban_goal_create="kanban_goal_create";o.kanban_goal_update="kanban_goal_update";o.kanban_goal_delete="kanban_goal_delete";o.kanban_task_create="kanban_task_create";o.kanban_task_update="kanban_task_update";o.kanban_task_delete="kanban_task_delete";o.kanban_comment_create="kanban_comment_create";o.kanban_comment_delete="kanban_comment_delete";o.kanban_dependency_add="kanban_dependency_add";o.kanban_dependency_remove="kanban_dependency_remove"})(y||={});var we=e.object({id:e.string(),action:e.nativeEnum(y),teamId:e.string(),userId:e.string().nullable().optional(),projectId:e.string().nullable().optional(),itemId:e.string().nullable().optional(),createdAt:e.string()}),ta=e.object({first:e.coerce.number().optional(),after:e.string().optional(),actions:e.union([e.nativeEnum(y),e.array(e.nativeEnum(y))]).transform((t)=>Array.isArray(t)?t:[t]).optional(),userIds:e.union([e.string(),e.array(e.string())]).transform((t)=>Array.isArray(t)?t:[t]).optional(),itemId:e.string().optional()}),oa=e.object({nodes:e.array(we),pageInfo:e.object({hasNextPage:e.boolean(),endCursor:e.string().nullable()}),total:e.number()});var Qe=e.object({id:e.string(),type:e.literal("text"),x:e.number().min(0).max(1),y:e.number().min(0).max(1),opacity:e.number().min(0).max(1),rotation:e.number().min(-180).max(180),text:e.string(),size:e.number().positive().max(1),color:e.string()}),Le=e.object({id:e.string(),type:e.literal("image"),x:e.number().min(0).max(1),y:e.number().min(0).max(1),opacity:e.number().min(0).max(1),rotation:e.number().min(-180).max(180),imageAssetKey:e.string().min(1),imageAssetUrl:e.string().optional(),size:e.number().positive().max(1)}),Ae=e.discriminatedUnion("type",[Qe,Le]),q=e.object({blocks:e.array(Ae)}),na=e.object({name:e.string().min(1),teamId:e.string().optional(),config:q}),sa=e.object({name:e.string().min(1).optional(),config:q.optional()}),ia=e.object({enabled:e.boolean(),config:q.optional()}).superRefine((t,r)=>{if(t.enabled&&(!t.config||t.config.blocks.length===0))r.addIssue({code:"custom",path:["config"],message:"Watermark configuration is required when enabling watermark"})});var P=e.nativeEnum(L),E=e.enum(["1hour","5hour","1day","7day","one_hour","five_hours","one_day","seven_days"]);function ua(t){switch(t){case"one_hour":case"1hour":return"1hour";case"five_hours":case"5hour":return"5hour";case"one_day":case"1day":return"1day";case"seven_days":case"7day":return"7day";default:return t}}var C=e.nativeEnum(A),M=e.enum(["owner","editor","reviewer"]),z=e.object({id:e.string().min(1,"MCP server ID is required")}),ee=e.object({match:e.string().min(1,"Bash match wildcard is required")}),te=e.object({name:e.string().min(1,"Tool name is required")}),D=e.record(e.string(),e.unknown()),Oe=e.object({id:e.string().nullable(),ruleId:e.string(),teamId:e.string(),userId:e.string().nullable().optional(),user:e.object({id:e.string(),name:e.string(),email:e.string(),image:e.string().nullable().optional()}).nullable().optional(),periodStart:e.string().nullable().optional(),periodEnd:e.string().nullable().optional(),consumed:e.number(),remaining:e.number(),percent:e.number(),isWindowActive:e.boolean()}),da=e.object({records:e.array(Oe),total:e.number()}),Fe=e.object({id:e.string(),teamId:e.string(),scopeMode:P,role:M.nullable().optional(),userIds:e.array(e.string()).nullable().optional(),resource:C,resourceData:D.nullable().optional(),limit:e.number(),period:E,enabled:e.boolean(),recordsCount:e.number().optional(),createdAt:e.string(),updatedAt:e.string()}),fa=e.object({rules:e.array(Fe),total:e.number()}),ga=e.object({scopeMode:P,role:M.optional().nullable(),userIds:e.array(e.string()).optional().nullable(),resource:C,resourceData:D.optional().nullable(),limit:e.number().positive("Limit must be greater than 0"),period:E,enabled:e.boolean().optional().default(!0)}).superRefine((t,r)=>{if(t.scopeMode==="selected_members"){if(!t.userIds||t.userIds.length===0)r.addIssue({code:e.ZodIssueCode.custom,message:'userIds must contain at least one user when scopeMode is "selected_members"',path:["userIds"]})}if(t.resource==="agent_mcp_call_count"){if(!z.safeParse(t.resourceData).success)r.addIssue({code:e.ZodIssueCode.custom,message:"resourceData.id is required for agent_mcp_call_count",path:["resourceData","id"]})}else if(t.resource==="agent_bash_call_count"){if(!ee.safeParse(t.resourceData).success)r.addIssue({code:e.ZodIssueCode.custom,message:"resourceData.match is required for agent_bash_call_count",path:["resourceData","match"]})}else if(t.resource==="agent_tool_call_count"){if(!te.safeParse(t.resourceData).success)r.addIssue({code:e.ZodIssueCode.custom,message:"resourceData.name is required for agent_tool_call_count",path:["resourceData","name"]})}}),ya=e.object({userId:e.string().nullable()}),ba=e.object({scopeMode:P.optional(),role:M.optional().nullable(),userIds:e.array(e.string()).optional().nullable(),resource:C.optional(),resourceData:D.optional().nullable(),limit:e.number().positive("Limit must be greater than 0").optional(),period:E.optional(),enabled:e.boolean().optional()}).superRefine((t,r)=>{if(t.scopeMode==="selected_members"&&t.userIds!==void 0){if(!t.userIds||t.userIds.length===0)r.addIssue({code:e.ZodIssueCode.custom,message:'userIds must contain at least one user when scopeMode is "selected_members"',path:["userIds"]})}if(t.resource==="agent_mcp_call_count"&&t.resourceData!==void 0){if(!z.safeParse(t.resourceData).success)r.addIssue({code:e.ZodIssueCode.custom,message:"resourceData.id is required for agent_mcp_call_count",path:["resourceData","id"]})}else if(t.resource==="agent_bash_call_count"&&t.resourceData!==void 0){if(!ee.safeParse(t.resourceData).success)r.addIssue({code:e.ZodIssueCode.custom,message:"resourceData.match is required for agent_bash_call_count",path:["resourceData","match"]})}else if(t.resource==="agent_tool_call_count"&&t.resourceData!==void 0){if(!te.safeParse(t.resourceData).success)r.addIssue({code:e.ZodIssueCode.custom,message:"resourceData.name is required for agent_tool_call_count",path:["resourceData","name"]})}});var _a="unassigned",xa=e.object({title:e.string().min(1),description:e.string().optional()}),ka=e.object({title:e.string().min(1).optional(),description:e.string().nullable().optional()}),Ge=e.object({id:e.string(),title:e.string(),description:e.string().nullable().optional(),teamId:e.string(),creatorId:e.string().nullable().optional(),taskCount:e.number().optional(),createdAt:e.union([e.string(),e.date()]),updatedAt:e.union([e.string(),e.date()])}),Ra=e.object({}),Ia=e.object({data:e.array(Ge)});var i=e.object({id:e.string(),name:e.string(),image:e.string().optional()}),Ve=e.object({summary:e.string().optional(),blockReason:e.string().optional(),blockKind:e.string().optional(),reason:e.string().optional(),assets:e.array(e.object({id:e.string(),type:e.string().optional(),name:e.string().optional(),description:e.string().optional()})).optional()}).passthrough(),U=e.object({id:e.string(),taskId:e.string(),actor:i.nullable().optional(),type:e.nativeEnum(d),fromStatus:e.nativeEnum(s).nullable().optional(),toStatus:e.nativeEnum(s).nullable().optional(),data:Ve.nullable().optional(),createdAt:e.union([e.string(),e.date()])}),qa=e.object({data:e.array(U)});var We=e.object({id:e.string(),name:e.string(),key:e.string(),sizeByte:e.number(),contentType:e.string().nullable().optional(),proxyType:e.enum(["image","video","audio","pdf"]).nullable().optional()}),Be=e.object({id:e.string(),name:e.string(),sizeByte:e.number(),contentType:e.string().nullable().optional(),url:e.string(),proxyType:e.enum(["image","video","audio","pdf"]).nullable().optional()}),Ma=e.object({id:e.string(),name:e.string(),key:e.string(),sizeByte:e.number(),contentType:e.string().nullable().optional(),uploadUrl:e.string(),proxyType:e.enum(["image","video","audio","pdf"]).nullable().optional()}),Da=e.object({body:e.string().default(""),attachments:e.array(We).optional()}).refine((t)=>t.body.trim().length>0||t.attachments&&t.attachments.length>0,{message:"Comment body or attachments required"}),N=e.object({id:e.string(),taskId:e.string(),author:i,body:e.string(),attachments:e.array(Be).default([]),createdAt:e.union([e.string(),e.date()]),updatedAt:e.union([e.string(),e.date()])}),Ua=e.object({data:e.array(N)});var Oa=e.object({title:e.string().min(1),description:e.string().optional(),isAgentTask:e.boolean().optional(),priority:e.nativeEnum(l).optional(),startDate:e.union([e.string(),e.date()]).optional(),dueDate:e.union([e.string(),e.date()]).optional(),goalId:e.string().optional(),projectId:e.string().optional(),reporterId:e.string().optional(),assigneeId:e.string().optional(),targetFolderId:e.string().optional(),parentIds:e.array(e.string()).optional(),assetIds:e.array(e.string()).optional()}),Fa=e.object({fromStatus:e.nativeEnum(s).optional(),title:e.string().min(1).optional(),description:e.string().nullable().optional(),status:e.nativeEnum(s).optional(),reason:e.string().optional(),priority:e.nativeEnum(l).optional(),startDate:e.union([e.string(),e.date()]).nullable().optional(),dueDate:e.union([e.string(),e.date()]).nullable().optional(),goalId:e.string().nullable().optional(),projectId:e.string().nullable().optional(),reporterId:e.string().nullable().optional(),assigneeId:e.string().nullable().optional(),targetFolderId:e.string().nullable().optional(),beforeIndex:e.string().optional(),afterIndex:e.string().optional(),parentIds:e.array(e.string()).optional(),assetIds:e.array(e.string()).optional()}),Ga=e.object({status:e.nativeEnum(s).optional(),isAgentTask:e.union([e.boolean(),e.string()]).transform((t)=>t===!0||t==="true").optional(),goalId:e.string().optional(),projectId:e.string().optional(),priority:e.nativeEnum(l).optional(),assigneeId:e.string().optional(),reporterId:e.string().optional()}).merge(a),He=e.object({id:e.string(),type:e.nativeEnum(d),actor:i.nullable().optional(),summary:e.string().optional(),blockReason:e.string().optional(),blockKind:e.string().optional(),reason:e.string().optional(),createdAt:e.union([e.string(),e.date()])}),Ze=e.object({id:e.string(),title:e.string()}),oe=e.object({id:e.string(),title:e.string(),isAgentTask:e.boolean(),status:e.nativeEnum(s),priority:e.nativeEnum(l),sortIndex:e.string().nullable().optional()}),Ye=e.object({id:e.string(),name:e.string(),type:e.string(),proxyType:e.enum(["image","video","audio","pdf"]).nullable().optional(),thumbnailUrl:e.string().nullable().optional(),path:e.string(),creator:i.nullable().optional(),sizeByte:e.number().optional(),fileCount:e.number().optional(),projectId:e.string().nullable().optional(),createdAt:e.union([e.string(),e.date()])}),K=e.object({id:e.string(),title:e.string(),description:e.string().nullable().optional(),isAgentTask:e.boolean(),status:e.nativeEnum(s),priority:e.nativeEnum(l),startDate:e.union([e.string(),e.date()]).nullable().optional(),dueDate:e.union([e.string(),e.date()]).nullable().optional(),startedAt:e.union([e.string(),e.date()]).nullable().optional(),completedAt:e.union([e.string(),e.date()]).nullable().optional(),teamId:e.string(),projectId:e.string().nullable().optional(),sortIndex:e.string().nullable().optional(),creator:i,reporter:i.nullable().optional(),assignee:i.nullable().optional(),goal:Ze.nullable().optional(),targetFolderId:e.string().nullable().optional(),latestStatusEvent:He.nullable().optional(),commentCount:e.number().default(0),dependencyCount:e.number().default(0),dependentCount:e.number().default(0),assetCount:e.number().default(0),createdAt:e.union([e.string(),e.date()]),updatedAt:e.union([e.string(),e.date()])}),Va=K.extend({dependencies:e.array(oe),dependents:e.array(oe),assets:e.array(Ye),comments:e.array(N),events:e.array(U)}),Wa=e.object({data:e.array(K),pageInfo:c}),Ba=e.object({taskId:e.string()}),Ha=e.object({assetIds:e.array(e.string())}),Za=e.object({data:e.array(K),total:e.number()});var rn=e.object({assetId:e.string()});function Kn({...t}){return p(m.Root,{"data-slot":"popover",...t})}function wn({...t}){return p(m.Trigger,{"data-slot":"popover-trigger",...t})}function Qn({className:t,align:r="center",sideOffset:n=4,...h}){return p(m.Portal,{children:p(m.Content,{"data-slot":"popover-content",align:r,sideOffset:n,className:b("z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",t),...h})})}function Vn({className:t,...r}){return p(w.Root,{"data-slot":"checkbox",className:b("peer size-4 shrink-0 rounded-[4px] border border-input shadow-xs transition-shadow outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:bg-input/30 dark:aria-invalid:ring-destructive/40 dark:data-[state=checked]:bg-primary",t),...r,children:p(w.Indicator,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none",children:p(re,{className:"size-3.5"})})})}
2
- export{Kn as Mf,wn as Nf,Qn as Of,s as Pf,l as Qf,d as Rf,G as Sf,Po as Tf,Te as Uf,X as Vf,v as Wf,j as Xf,se as Yf,ie as Zf,y as _f,ua as $f,_a as ag,Vn as bg};
@@ -1 +0,0 @@
1
- import{Re as y1,Se as L1,Te as q1,Ve as k_,We as u_,Xe as D1,Ye as p1,Ze as T1,_e as m1}from"./chunk-1fwzepfn.js";import{$e as r_}from"./chunk-ex2ym5pz.js";import{af as L_}from"./chunk-34kaja59.js";import"./chunk-r2shjtte.js";import"./chunk-ns804tmv.js";import{Pf as l,Qf as j_,ag as s}from"./chunk-2xevs82j.js";import{eg as V_,fg as Q_,gg as f_,hg as N_,ig as d}from"./chunk-yyjx8nbq.js";import"./chunk-zye42cfp.js";import"./chunk-dk8vk17v.js";import{$g as m_,Lg as U1,Mg as P1,Ng as b1,Wg as O1,Yg as F1,_g as Z_}from"./chunk-7x1vkftb.js";import{bh as c_}from"./chunk-ck6msfch.js";import{eh as E1}from"./chunk-tcm57j8r.js";import"./chunk-dkjkn8t3.js";import{Ih as V1,Xh as l_}from"./chunk-9cmvymm5.js";import{Yh as S1}from"./chunk-6m1k317a.js";import{$h as z_,Zh as X_,_h as H_}from"./chunk-kxr8fjsq.js";import{ai as P_,ci as b_,di as O_,ei as Y_}from"./chunk-02afmyqy.js";import{Ci as G,Di as y_,Ei as A_,Fi as G_,Gi as C_,Hi as S_,Ii as D_,Ji as p_,Ki as T_,Li as M_,Ni as w_,Oi as F_,Pi as B_,Qi as K_,Ri as Y1,Si as c,qi as o,ti as i,vi as x,wi as K1}from"./chunk-8nyve0cr.js";import{Ui as k}from"./chunk-62ebss6h.js";import{Aj as f1,Ej as N1,Gk as M1,Gl as _1,Hl as $1,Kk as o_,Ll as J1,Pl as m,Qj as $_,Tj as h1,Tk as w1,Vi as __,Wi as q_,Xi as _,Xj as X1,Yi as J,Yj as H1,bl as t,gj as g1,jm as P,lk as v1,mm as W,nm as E_,qk as C1,uj as R_,vl as n,wj as g,yj as Z1,yl as U_}from"./chunk-kqpzx5az.js";import{kn as e}from"./chunk-p49h5fxs.js";var r=e(__(),1);function W1({scope:$,onScopeChange:H,selectedGoal:F,onClearGoal:h,onCreateTask:L,canCreateTask:B=!0}){return J("header",{className:"h-14 border-b border-border bg-card/60 backdrop-blur-sm px-4 flex items-center justify-between gap-3 shrink-0 select-none",children:[J("div",{className:"flex items-center gap-3 min-w-0",children:[J("div",{className:"flex items-center bg-muted/60 p-0.5 rounded-lg border border-border/50",children:[J(P,{variant:$==="team"?"secondary":"ghost",size:"sm",onClick:()=>H("team"),className:`h-7 px-2.5 text-xs font-medium gap-1.5 transition-all ${$==="team"?"bg-background text-foreground shadow-xs":"text-muted-foreground hover:text-foreground"}`,children:[_($1,{className:"w-3.5 h-3.5"}),_("span",{children:W.team_tasks()})]}),J(P,{variant:$==="my"?"secondary":"ghost",size:"sm",onClick:()=>H("my"),className:`h-7 px-2.5 text-xs font-medium gap-1.5 transition-all ${$==="my"?"bg-background text-foreground shadow-xs":"text-muted-foreground hover:text-foreground"}`,children:[_(_1,{className:"w-3.5 h-3.5"}),_("span",{children:W.my_tasks()})]})]}),F&&J("div",{className:"hidden sm:flex items-center gap-1.5 px-2 py-1 rounded-md bg-sidebar-accent border border-sidebar-border text-xs text-sidebar-accent-foreground min-w-0 max-w-[200px] md:max-w-[280px]",children:[_(n,{className:"w-3.5 h-3.5 text-sidebar-primary shrink-0"}),_("span",{className:"truncate font-medium",children:F.id===s?W.unassigned():F.title}),_(P,{variant:"ghost",size:"icon-xs",onClick:h,className:"h-4 w-4 p-0 ml-0.5 text-muted-foreground hover:text-foreground",title:W.clear_filter(),children:_(J1,{className:"w-3 h-3"})})]})]}),B&&_("div",{className:"flex items-center gap-2 shrink-0",children:J(P,{size:"sm",onClick:L,className:"h-8 px-3 text-xs gap-1.5 shadow-xs",children:[_(t,{className:"w-3.5 h-3.5"}),_("span",{children:W.create_task()})]})})]})}var W_=e(__(),1);var J_=e(__(),1);function d_({teamId:$,isOpen:H,onClose:F,goalToEdit:h}){let L=o(),[B,U]=J_.useState(""),[M,b]=J_.useState("");J_.useEffect(()=>{if(h)U(h.title),b(h.description||"");else U(""),b("")},[h,H]);let{mutate:y,isPending:C}=x({mutationFn:async()=>{let X=await G.api.teams[":teamId"].kanban.goals.$post({param:{teamId:$},json:{title:B.trim(),description:M.trim()||void 0}});if(!X.ok){let w=await X.json().catch(()=>({message:W.error()}));throw Error(w.message||W.error())}return await X.json()},onSuccess:()=>{L.invalidateQueries({queryKey:["teams",$,"kanban","goals"]}),c.success(W.goal_created()),F()},onError:(X)=>{c.error(X.message)}}),{mutate:S,isPending:O}=x({mutationFn:async()=>{if(!h)return;let X=await G.api.teams[":teamId"].kanban.goals[":goalId"].$patch({param:{teamId:$,goalId:h.id},json:{title:B.trim(),description:M.trim()||null}});if(!X.ok){let w=await X.json().catch(()=>({message:W.error()}));throw Error(w.message||W.error())}return await X.json()},onSuccess:()=>{L.invalidateQueries({queryKey:["teams",$,"kanban","goals"]}),c.success(W.goal_updated()),F()},onError:(X)=>{c.error(X.message)}}),T=(X)=>{if(X.preventDefault(),!B.trim())return;if(h)S();else y()},Q=C||O;return _(M_,{open:H,onOpenChange:(X)=>!X&&F(),children:_(w_,{className:"sm:max-w-xl",children:J("form",{onSubmit:T,className:"space-y-4",children:[J(F_,{children:[_(K_,{children:h?W.edit_goal():W.create_goal()}),_(Y1,{children:h?W.edit_goal():W.create_first_goal()})]}),J("div",{className:"space-y-3 py-2",children:[J("div",{className:"space-y-1.5",children:[_(k,{htmlFor:"goal-title",children:W.goal_title()}),_(E_,{id:"goal-title",value:B,onChange:(X)=>U(X.target.value),placeholder:W.goal_title_placeholder(),required:!0,autoFocus:!0})]}),J("div",{className:"space-y-1.5",children:[_(k,{htmlFor:"goal-description",children:W.goal_description()}),_(L_,{id:"goal-description",value:M,onChange:(X)=>b(X.target.value),placeholder:W.goal_description_placeholder(),rows:3})]})]}),J(B_,{children:[_(P,{type:"button",variant:"outline",onClick:F,disabled:Q,children:W.cancel()}),J(P,{type:"submit",disabled:!B.trim()||Q,children:[Q&&_(g,{className:"w-4 h-4 mr-1.5 animate-spin"}),h?W.save_changes():W.create()]})]})]})})})}function z1({teamId:$,selectedGoalId:H,onSelectGoal:F,isOwnerOrEditor:h=!0}){let L=o(),[B,U]=W_.useState(!1),[M,b]=W_.useState(null),[y,C]=W_.useState(null),[S,O]=W_.useState(!1),{data:T,isLoading:Q}=i({queryKey:["teams",$,"kanban","goals"],queryFn:async()=>{let z=await G.api.teams[":teamId"].kanban.goals.$get({param:{teamId:$},query:{}});if(!z.ok)throw Error("Failed to fetch goals");return await z.json()},enabled:!!$}),X=T?.data||[],w=X.reduce((z,Z)=>z+(Z.taskCount||0),0),{mutate:q,isPending:V}=x({mutationFn:async(z)=>{let Z=await G.api.teams[":teamId"].kanban.goals[":goalId"].$delete({param:{teamId:$,goalId:z}});if(!Z.ok){let N=await Z.json().catch(()=>({message:W.error()}));throw Error(N.message||W.error())}return await Z.json()},onSuccess:(z,Z)=>{if(L.invalidateQueries({queryKey:["teams",$,"kanban","goals"]}),L.invalidateQueries({queryKey:["teams",$,"kanban","tasks"]}),c.success(W.goal_deleted()),H===Z)F(null);C(null)},onError:(z)=>{c.error(z.message)}});if(S)return J("div",{className:"border-r border-sidebar-border bg-sidebar flex flex-col items-center w-12 shrink-0 transition-all duration-300",children:[_("div",{className:"h-14 flex items-center justify-center border-b border-sidebar-border w-full shrink-0",children:_(P,{variant:"ghost",size:"icon-sm",onClick:()=>O(!1),title:W.goals(),className:"text-sidebar-foreground/70 hover:text-sidebar-foreground",children:_(H1,{className:"w-4 h-4"})})}),J("div",{className:"mt-3 flex flex-col items-center gap-2",children:[_(P,{variant:H===null?"secondary":"ghost",size:"icon-sm",onClick:()=>F(null),title:W.all_tasks(),className:m("w-8 h-8 rounded-md",H===null&&"bg-sidebar-accent text-sidebar-accent-foreground"),children:_(o_,{className:"w-4 h-4"})}),_(P,{variant:"ghost",size:"icon-sm",onClick:()=>U(!0),title:W.new_goal(),className:"w-8 h-8 rounded-md text-sidebar-foreground/70 hover:text-sidebar-foreground",children:_(t,{className:"w-4 h-4"})})]}),B&&_(d_,{teamId:$,isOpen:B,onClose:()=>U(!1)})]});return J("aside",{className:"w-64 border-r border-sidebar-border bg-sidebar flex flex-col shrink-0 transition-all duration-300 select-none",children:[J("div",{className:"h-14 px-3 flex items-center justify-between border-b border-sidebar-border shrink-0",children:[J("div",{className:"flex items-center gap-2 font-semibold text-xs tracking-wider uppercase text-sidebar-foreground/70",children:[_(n,{className:"w-4 h-4 text-sidebar-primary"}),_("span",{children:W.goals()})]}),J("div",{className:"flex items-center gap-1",children:[h&&_(P,{variant:"ghost",size:"icon-sm",onClick:()=>U(!0),className:"h-7 w-7 text-sidebar-foreground/70 hover:text-sidebar-foreground",title:W.new_goal(),children:_(t,{className:"w-4 h-4"})}),_(P,{variant:"ghost",size:"icon-sm",onClick:()=>O(!0),className:"h-7 w-7 text-sidebar-foreground/70 hover:text-sidebar-foreground",title:"Collapse",children:_(X1,{className:"w-4 h-4"})})]})]}),_(c_,{className:"flex-1 p-2",children:J("div",{className:"space-y-1",children:[J("div",{onClick:()=>F(null),className:m("flex items-center justify-between px-2.5 py-1 rounded-md text-xs font-medium cursor-pointer transition-colors group h-8 min-h-[32px]",H===null?"bg-sidebar-accent text-sidebar-accent-foreground font-semibold shadow-xs":"text-sidebar-foreground/70 hover:bg-sidebar-accent/50 hover:text-sidebar-foreground"),children:[J("div",{className:"flex items-center gap-2 truncate min-w-0",children:[_(o_,{className:"w-3.5 h-3.5 shrink-0 text-sidebar-primary"}),_("span",{className:"truncate",children:W.all_tasks()})]}),w>0&&_("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded-full bg-sidebar-border text-sidebar-foreground/60 shrink-0",children:w})]}),Q?_("div",{className:"flex items-center justify-center p-4",children:_(g,{className:"w-4 h-4 animate-spin text-muted-foreground"})}):X.length===0?_("div",{className:"px-2.5 py-4 text-center text-xs text-muted-foreground",children:W.no_goals_yet()}):X.map((z)=>{let Z=H===z.id,N=z.id===s,K=N?W.unassigned():z.title,v=h&&!N;return J("div",{onClick:()=>F(z.id),className:m("flex items-center justify-between px-2.5 py-1 rounded-md text-xs font-medium cursor-pointer transition-colors group relative min-h-[32px]",Z?"bg-sidebar-accent text-sidebar-accent-foreground font-semibold shadow-xs":"text-sidebar-foreground/70 hover:bg-sidebar-accent/50 hover:text-sidebar-foreground"),children:[J("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[_(n,{className:m("w-3.5 h-3.5 shrink-0",Z?"text-sidebar-primary":"text-muted-foreground")}),_("span",{className:"line-clamp-2 break-words leading-tight",title:K,children:K})]}),_("div",{className:"flex items-center shrink-0 ml-1",children:v?J(q_,{children:[(z.taskCount??0)>0&&_("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded-full bg-sidebar-border text-sidebar-foreground/60 group-hover:hidden group-focus-within:hidden [&:has(~_div_[data-state=open])]:hidden",children:z.taskCount}),_("div",{className:"hidden group-hover:flex group-focus-within:flex [&:has([data-state=open])]:flex items-center",onClick:(f)=>f.stopPropagation(),children:J(P_,{modal:!1,children:[_(b_,{asChild:!0,children:_(P,{variant:"ghost",size:"icon-xs",className:"h-6 w-6 p-0 text-muted-foreground hover:text-foreground",children:_(R_,{className:"w-3.5 h-3.5"})})}),J(O_,{align:"end",className:"w-36",children:[J(Y_,{onClick:()=>{b(z)},children:[_(Z1,{className:"w-3.5 h-3.5 mr-2"}),W.edit()]}),J(Y_,{className:"text-destructive focus:text-destructive focus:bg-destructive/10",onClick:()=>{C(z)},children:[_(U_,{className:"w-3.5 h-3.5 mr-2"}),W.delete()]})]})]})})]}):(z.taskCount??0)>0&&_("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded-full bg-sidebar-border text-sidebar-foreground/60",children:z.taskCount})})]},z.id)})]})}),(B||M)&&_(d_,{teamId:$,isOpen:B||!!M,goalToEdit:M,onClose:()=>{U(!1),b(null)}}),y&&_(y_,{open:!!y,onOpenChange:(z)=>!z&&C(null),children:J(A_,{children:[J(G_,{children:[_(S_,{children:W.delete_goal()}),_(D_,{children:W.delete_goal_confirm({title:y.title})})]}),J(C_,{children:[_(T_,{disabled:V,children:W.cancel()}),J(p_,{onClick:()=>q(y.id),disabled:V,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[V&&_(g,{className:"w-4 h-4 mr-1.5 animate-spin"}),W.delete()]})]})]})})]})}var A1=e(__(),1);var g_=e(__(),1);function Q1($){return+V1($)<Date.now()}function B1({task:$,onClick:H,onDelete:F,disabled:h,isFirst:L,isLast:B,showBottomIndicator:U,currentUserId:M,currentUserRole:b}){let{source:y}=m_(),C=!!y,S=b?.toLowerCase()==="owner",O=b?.toLowerCase()==="editor",T=!!M&&$.creator?.id===M,Q=$.reporter?.id===M||T,X=$.assignee?.id===M,w=S||O||Q||X,q=T||S||Q,V=h||!w,{ref:z,isDragging:Z}=F1({id:$.id,data:{type:"kanban_task",task:$},disabled:V}),{ref:N,isDropTarget:K}=Z_({id:`reorder-before-${$.id}`,data:{type:"reorder",task:$,position:"before"},disabled:Z||h}),{ref:v,isDropTarget:f}=Z_({id:`reorder-after-${$.id}`,data:{type:"reorder",task:$,position:"after"},disabled:Z||h}),R=$.isAgentTask,A=$.status===l.BLOCKED,E=$.dueDate?Q1(new Date($.dueDate))&&$.status!==l.DONE:!1;return J("div",{className:"relative",children:[_("div",{ref:N,className:m("absolute left-0 right-0 z-20",L?"-top-6 h-[calc(50%+24px)]":"-top-1 h-[calc(50%+4px)]",C&&!Z?"pointer-events-auto":"pointer-events-none")}),_("div",{ref:v,className:m("absolute bottom-0 left-0 right-0 z-20",B?"-bottom-6 h-[calc(50%+24px)]":"h-1/2",C&&!Z?"pointer-events-auto":"pointer-events-none")}),K&&!Z&&_("div",{className:"absolute -top-1.5 left-0 right-0 h-[3px] rounded-full bg-primary shadow-[0_0_8px_rgba(var(--primary),0.6)] z-30 pointer-events-none"}),(f||U)&&!Z&&_("div",{className:"absolute -bottom-1.5 left-0 right-0 h-[3px] rounded-full bg-primary shadow-[0_0_8px_rgba(var(--primary),0.6)] z-30 pointer-events-none"}),J("div",{ref:z,onClick:()=>H($),className:m("group relative flex flex-col gap-2 p-3 rounded-lg border text-card-foreground transition-all duration-200 cursor-pointer select-none",Z&&"opacity-40 scale-95 shadow-lg ring-2 ring-primary",!Z&&"hover:shadow-md","border-border/80 bg-card hover:border-primary/50 shadow-2xs",A&&"border-red-500/60 bg-red-500/[0.03] ring-1 ring-red-500/20"),children:[J("div",{className:"flex items-center justify-between gap-1.5 min-w-0",children:[J("div",{className:"flex items-center gap-1.5 min-w-0 flex-1",children:[_("span",{className:m("px-1.5 py-0.5 rounded text-[10px] font-medium border uppercase tracking-wider shrink-0",u_($.priority)),children:k_($.priority)}),R&&J("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-semibold bg-orange-500/15 text-orange-600 dark:text-orange-400 border border-orange-500/30 shrink-0",children:[_($_,{className:"w-3 h-3"}),_("span",{children:W.task_type_agent()})]}),$.goal&&J("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium bg-muted text-muted-foreground border border-border/70 truncate max-w-[130px]",children:[_(n,{className:"w-2.5 h-2.5 shrink-0"}),_("span",{className:"truncate",children:$.goal.title})]})]}),_("div",{className:"flex items-center gap-1 shrink-0",children:q&&_("div",{className:"opacity-0 group-hover:opacity-100 [&:has([data-state=open])]:opacity-100 focus-within:opacity-100 transition-opacity flex items-center",onClick:(I)=>I.stopPropagation(),children:J(P_,{modal:!1,children:[_(b_,{asChild:!0,children:_(P,{variant:"ghost",size:"icon-xs",className:"h-5 w-5 p-0 text-muted-foreground hover:text-foreground",children:_(R_,{className:"w-3.5 h-3.5"})})}),_(O_,{align:"end",className:"w-32",children:J(Y_,{className:"text-destructive focus:text-destructive focus:bg-destructive/10",onClick:()=>F?.($),children:[_(U_,{className:"w-3.5 h-3.5 mr-2"}),W.delete()]})})]})})})]}),_("h4",{className:"text-xs font-semibold leading-snug line-clamp-2 text-foreground break-words",children:$.title}),A&&J("div",{className:"flex items-start gap-1.5 p-1.5 rounded bg-red-500/10 border border-red-500/20 text-[11px] text-red-600 dark:text-red-400",children:[_(N1,{className:"w-3.5 h-3.5 shrink-0 mt-0.5"}),_("span",{className:"line-clamp-2 break-words",children:$.latestStatusEvent?.blockReason||$.latestStatusEvent?.reason||$.latestStatusEvent?.summary||W.status_blocked()})]}),$.status===l.IN_REVIEW&&$.latestStatusEvent?.summary&&J("div",{className:"flex items-start gap-1.5 p-1.5 rounded bg-purple-500/10 border border-purple-500/20 text-[11px] text-purple-600 dark:text-purple-400",children:[_(f1,{className:"w-3.5 h-3.5 shrink-0 mt-0.5"}),_("span",{className:"line-clamp-2 break-words",children:$.latestStatusEvent.summary})]}),J("div",{className:"flex items-center justify-between gap-2 pt-1 mt-auto border-t border-border/40 text-[11px] text-muted-foreground",children:[_("div",{className:"flex items-center gap-1.5 min-w-0",children:$.assignee?J(q_,{children:[R?_("div",{className:"w-5 h-5 rounded-full bg-orange-500/15 border border-orange-500/30 flex items-center justify-center shrink-0",children:_($_,{className:"w-3 h-3 text-orange-600 dark:text-orange-400"})}):J(X_,{size:"sm",className:"w-5 h-5 border border-border",children:[_(H_,{src:$.assignee.image}),_(z_,{className:"text-[9px]",children:$.assignee.name.slice(0,2).toUpperCase()})]}),_("span",{className:"truncate text-xs font-medium text-foreground/80 max-w-[90px]",children:$.assignee.name})]}):_("span",{className:"text-[11px] italic text-muted-foreground/60",children:W.unassigned()})}),J("div",{className:"flex items-center gap-2 shrink-0",children:[$.dueDate&&J("div",{className:m("flex items-center gap-1 text-[10px] font-mono",E?"text-red-500 font-semibold":"text-muted-foreground"),title:l_(new Date($.dueDate),"yyyy/MM/dd HH:mm"),children:[_(h1,{className:"w-3 h-3"}),_("span",{children:l_(new Date($.dueDate),"MM/dd")})]}),$.assetCount>0&&J("div",{className:"flex items-center gap-0.5 text-[10px] text-muted-foreground hover:text-foreground",title:W.linked_assets_count({count:$.assetCount}),children:[_(v1,{className:"w-3 h-3"}),_("span",{children:$.assetCount})]}),$.dependencyCount>0&&J("div",{className:"flex items-center gap-0.5 text-[10px] text-muted-foreground hover:text-foreground",title:`${$.dependencyCount} dependencies`,children:[_(M1,{className:"w-3 h-3"}),_("span",{children:$.dependencyCount})]}),$.commentCount>0&&J("div",{className:"flex items-center gap-0.5 text-[10px] text-muted-foreground hover:text-foreground",title:`${$.commentCount} comments`,children:[_(w1,{className:"w-3 h-3"}),_("span",{children:$.commentCount})]})]})]})]})]})}function R1({teamId:$,status:H,selectedGoalId:F,scope:h,currentUserId:L,currentUserRole:B,onTaskClick:U,onDeleteTask:M,onCreateTaskInColumn:b}){let y=B?.toLowerCase()==="owner"||B?.toLowerCase()==="editor",C=h==="my"?L:void 0,{data:S,fetchNextPage:O,hasNextPage:T,isFetchingNextPage:Q,isLoading:X}=K1({queryKey:["teams",$,"kanban","tasks",{status:H,goalId:F,assigneeId:C}],queryFn:async({pageParam:D=""})=>{let j=await G.api.teams[":teamId"].kanban.tasks.$get({param:{teamId:$},query:{status:H,goalId:F||void 0,assigneeId:C||void 0,first:"20",after:D||void 0}});if(!j.ok)throw Error("Failed to fetch column tasks");return await j.json()},initialPageParam:"",getNextPageParam:(D)=>D.pageInfo?.cursor||void 0,refetchInterval:5000,enabled:!!$}),{ref:w,inView:q}=E1({threshold:0.1});g_.useEffect(()=>{if(q&&T&&!Q)O()},[q,T,Q,O]);let V=g_.useMemo(()=>{return S?.pages?.flatMap((D)=>Array.isArray(D?.data)?D.data:[])||[]},[S]),{source:z,target:Z}=m_(),N=V.filter((D)=>D.id!==z?.id).at(-1),{ref:K,isDropTarget:v}=Z_({id:H,data:{type:"kanban_column",status:H,lastTask:N}}),f=z?.data?.type==="kanban_task",R=f&&(v||Z?.data?.type==="kanban_column"&&Z.data.status===H||Z?.data?.type==="reorder"&&Z.data.task?.status===H),A=f&&Z?.data?.type==="kanban_column"&&Z.data.status===H,E=S?.pages?.[0]?.pageInfo?.total??V.length,I=q1(H);return J("div",{ref:K,className:m("flex flex-col h-full max-h-full w-80 md:w-84 shrink-0 rounded-xl bg-card/60 border border-border/70 shadow-xs transition-colors duration-200 overflow-hidden select-none",R&&"ring-2 ring-primary/60 bg-primary/[0.03] border-primary/40"),children:[J("div",{className:"h-11 px-3.5 flex items-center justify-between border-b border-border/60 bg-card/80 shrink-0",children:[J("div",{className:"flex items-center gap-2 min-w-0",children:[_("div",{className:m("w-2.5 h-2.5 rounded-full shrink-0",I.dot)}),_("h3",{className:"text-xs font-bold tracking-wide uppercase text-foreground/90 truncate",children:L1(H)})]}),_("div",{className:"flex items-center gap-1 shrink-0",children:_("span",{className:"text-[11px] font-mono px-2 py-0.5 rounded-full bg-muted font-medium text-muted-foreground",children:E})})]}),_(c_,{className:"flex-1 min-h-0 [&>div>div]:block!",children:J("div",{className:"p-2.5 space-y-2.5 min-h-full flex flex-col",children:[X?_("div",{className:"flex items-center justify-center py-10",children:_(g,{className:"w-5 h-5 animate-spin text-muted-foreground"})}):V.length===0?_("div",{className:"flex flex-col items-center justify-center py-10 px-4 text-center",children:_("p",{className:"text-xs text-muted-foreground/70",children:W.no_tasks_in_column()})}):V.map((D,j)=>_(B1,{task:D,onClick:U,onDelete:M,isFirst:j===0,isLast:j===V.length-1,showBottomIndicator:A&&D.id===N?.id,currentUserId:L,currentUserRole:B},D.id)),_("div",{ref:w,className:"h-2"}),Q&&_("div",{className:"flex justify-center py-2",children:_(g,{className:"w-4 h-4 animate-spin text-muted-foreground"})})]})}),y&&_("div",{className:"p-2 border-t border-border/50 bg-card/90 shrink-0",children:J(P,{variant:"ghost",size:"sm",onClick:()=>b(H),className:"w-full justify-center h-8 text-xs font-medium text-muted-foreground hover:text-foreground hover:bg-muted/80 border border-dashed border-border/80",children:[_(t,{className:"w-3.5 h-3.5 mr-1.5"}),_("span",{children:W.create_task()})]})})]})}function G1({teamId:$,selectedGoalId:H,scope:F,currentUserId:h,currentUserRole:L,onTaskClick:B,onCreateTaskInColumn:U}){let M=o(),[b,y]=A1.useState(null),{mutate:C,isPending:S}=x({mutationFn:async(Q)=>{let X=await G.api.teams[":teamId"].kanban.tasks[":taskId"].$delete({param:{teamId:$,taskId:Q}});if(!X.ok){let w=await X.json().catch(()=>({message:W.error()}));throw Error(w.message||W.error())}return await X.json()},onSuccess:()=>{M.invalidateQueries({queryKey:["teams",$,"kanban","tasks"]}),M.invalidateQueries({queryKey:["teams",$,"kanban","goals"]}),c.success(W.task_deleted()),y(null)},onError:(Q)=>{c.error(Q.message)}}),{mutate:O}=x({mutationFn:async({taskId:Q,fromStatus:X,status:w,reason:q,beforeIndex:V,afterIndex:z})=>{let Z=await G.api.teams[":teamId"].kanban.tasks[":taskId"].$patch({param:{teamId:$,taskId:Q},json:{fromStatus:X,status:w,reason:q,beforeIndex:V,afterIndex:z}});if(!Z.ok){let N=await Z.json().catch(()=>({message:W.error()}));throw Error(N.message||W.error())}return await Z.json()},onMutate:async({taskId:Q,status:X,targetTaskId:w,position:q})=>{await M.cancelQueries({queryKey:["teams",$,"kanban","tasks"]});let V=M.getQueriesData({queryKey:["teams",$,"kanban","tasks"]}),z=null,Z=(N)=>{return N[0]==="teams"&&N[1]===$&&N[2]==="kanban"&&N[3]==="tasks"&&typeof N[4]==="object"&&N[4]!==null&&"status"in N[4]};if(M.setQueriesData({predicate:(N)=>Z(N.queryKey)},(N)=>{if(!N||!Array.isArray(N.pages))return N;let K=!1,v=N.pages.map((f)=>{if(!f||!Array.isArray(f.data))return f;let R=f.data.find((A)=>A.id===Q);if(R)return z={...R,status:X},K=!0,{...f,data:f.data.filter((A)=>A.id!==Q),pageInfo:{...f.pageInfo,total:Math.max(0,(f.pageInfo?.total??f.data.length)-1)}};return f});return K?{...N,pages:v}:N}),z){let N=z;M.setQueriesData({predicate:(K)=>{if(!Z(K.queryKey))return!1;return K.queryKey[4]?.status===X}},(K)=>{if(!K||!Array.isArray(K.pages))return K;let v=K.pages.flatMap((E)=>E?.data??[]).filter((E)=>E.id!==Q),f=v.length;if(w){let E=v.findIndex((I)=>I.id===w);if(E!==-1)f=q==="before"?E:E+1}v.splice(f,0,N);let R=0,A=K.pages.map((E,I)=>{let D=E?.data?E.data.length:0,j=I===0&&D===0?1:I===K.pages.length-1?v.length-R:D,h_=v.slice(R,R+j);return R+=j,{...E,data:h_,pageInfo:{...E?.pageInfo,total:(E?.pageInfo?.total??0)+1}}});if(R<v.length&&A.length>0){let E=A.length-1;A[E]={...A[E],data:[...A[E]?.data??[],...v.slice(R)]}}return{...K,pages:A}})}return{previousQueries:V}},onError:(Q,X,w)=>{if(w?.previousQueries)for(let[q,V]of w.previousQueries)M.setQueryData(q,V);c.error(Q.message)},onSettled:()=>{M.invalidateQueries({queryKey:["teams",$,"kanban","tasks"]})}}),T=(Q)=>{if(Q.canceled)return;let{source:X,target:w}=Q.operation;if(!X||!w)return;let q=X.data;if(q?.type!=="kanban_task"||!q.task)return;let V=q.task,z=L?.toLowerCase()==="owner",Z=L?.toLowerCase()==="editor",N=V.reporter?.id===h||V.creator?.id===h,K=V.assignee?.id===h;if(!z&&!Z&&!N&&!K){c.error(W.cannot_change_task_status_permission());return}let v=w.data;if(!v)return;if(v.type==="reorder"&&v.task&&v.position){let f=v.task,R=f.status;if(V.id===f.id)return;let A=v.position==="before"?f.sortIndex??void 0:void 0,E=v.position==="after"?f.sortIndex??void 0:void 0;O({taskId:V.id,fromStatus:V.status,status:R,beforeIndex:A,afterIndex:E,targetTaskId:f.id,position:v.position});return}if(v.type==="kanban_column"&&v.status){let{status:f,lastTask:R}=v;if(R){if(V.id===R.id){if(V.status===f)return;O({taskId:V.id,fromStatus:V.status,status:f});return}O({taskId:V.id,fromStatus:V.status,status:f,afterIndex:R.sortIndex??void 0,targetTaskId:R.id,position:"after"});return}if(V.status===f)return;O({taskId:V.id,fromStatus:V.status,status:f})}};return J(O1,{sensors:[b1.configure({activationConstraints:[new P1.Distance({value:8})]}),U1],onDragEnd:T,children:[_("div",{className:"flex-1 min-h-0 overflow-x-auto overflow-y-hidden p-4 bg-background/50",children:_("div",{className:"flex gap-4 h-full min-w-max pb-2",children:y1.map((Q)=>_(R1,{teamId:$,status:Q,selectedGoalId:H,scope:F,currentUserId:h,currentUserRole:L,onTaskClick:B,onDeleteTask:(X)=>y(X),onCreateTaskInColumn:U},Q))})}),b&&_(y_,{open:!!b,onOpenChange:(Q)=>!Q&&y(null),children:J(A_,{children:[J(G_,{children:[_(S_,{children:W.delete_task()}),_(D_,{children:W.delete_task_confirm({title:b.title})})]}),J(C_,{children:[_(T_,{disabled:S,children:W.cancel()}),J(p_,{onClick:()=>C(b.id),disabled:S,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[S&&_(g,{className:"w-4 h-4 mr-1.5 animate-spin"}),W.delete()]})]})]})})]})}var p=e(__(),1);function c1({teamId:$,isOpen:H,onClose:F,initialGoalId:h}){let L=o(),B=h===s||!h?"none":h,[U,M]=p.useState(""),[b,y]=p.useState(""),[C,S]=p.useState(!1),[O,T]=p.useState(j_.MEDIUM),[Q,X]=p.useState(B),[w,q]=p.useState("none"),[V,z]=p.useState("none"),[Z,N]=p.useState(void 0),[K,v]=p.useState(void 0),[f,R]=p.useState(null),[A,E]=p.useState(null),[I,D]=p.useState(null),[j,h_]=p.useState([]),[I_,x_]=p.useState([]),[a_,t_]=p.useState(!1),{data:s_}=i({queryKey:["teams",$,"me"],queryFn:async()=>{let Y=await G.api.teams[":teamId"].me.$get({param:{teamId:$}});if(!Y.ok)return null;return await Y.json()},enabled:!!$&&H});p.useEffect(()=>{if(H)M(""),y(""),S(!1),T(j_.MEDIUM),X(B),q("none"),z(s_?.id||"none"),N(void 0),v(void 0),R(null),E(null),D(null),h_([]),x_([])},[H,B,s_?.id]);let{data:e_=[]}=i({queryKey:["teams",$,"members","human"],queryFn:async()=>{let Y=await G.api.teams[":teamId"].members.$get({param:{teamId:$},query:{includeAgents:"false"}});if(!Y.ok)return[];let u=await Y.json();return Array.isArray(u)?u:[]},enabled:!!$&&H}),{data:j1=[]}=i({queryKey:["teams",$,"agents"],queryFn:async()=>{let Y=await G.api.teams[":teamId"].agents.$get({param:{teamId:$}});if(!Y.ok)return[];return await Y.json()||[]},enabled:!!$&&H}),{data:I1}=i({queryKey:["teams",$,"kanban","goals"],queryFn:async()=>{let Y=await G.api.teams[":teamId"].kanban.goals.$get({param:{teamId:$},query:{}});if(!Y.ok)return{data:[]};return await Y.json()},enabled:!!$&&H}),x1=I1?.data||[],{mutate:i1,isPending:v_}=x({mutationFn:async()=>{let Y=await G.api.teams[":teamId"].kanban.tasks.$post({param:{teamId:$},json:{title:U.trim(),description:b.trim()||void 0,isAgentTask:C,priority:O,goalId:Q!=="none"?Q:void 0,assigneeId:w!=="none"?w:void 0,reporterId:V!=="none"?V:void 0,startDate:Z?Z.toISOString():void 0,dueDate:K?K.toISOString():void 0,projectId:f||void 0,targetFolderId:A||void 0,parentIds:j.length>0?j:void 0,assetIds:I_.length>0?I_.map((u)=>u.id):void 0}});if(!Y.ok){let u=await Y.text().catch(()=>""),a=W.error();if(u)try{let n_=JSON.parse(u);if(n_&&typeof n_.message==="string")a=n_.message}catch{a=u}throw Error(a)}return await Y.json()},onSuccess:()=>{L.invalidateQueries({queryKey:["teams",$,"kanban","tasks"]}),L.invalidateQueries({queryKey:["teams",$,"kanban","goals"]}),c.success(W.task_created()),F()},onError:(Y)=>{c.error(Y.message)}}),n1=(Y)=>{if(Y.preventDefault(),!U.trim()||v_)return;i1()},i_=C;return _(M_,{open:H,onOpenChange:(Y)=>!Y&&F(),children:J(w_,{className:"sm:max-w-3xl max-h-[90vh] overflow-y-auto",children:[J("form",{onSubmit:n1,className:"space-y-4",children:[_(F_,{children:_(K_,{children:W.create_task()})}),J("div",{className:"space-y-3.5 py-1",children:[J("div",{className:"space-y-1.5",children:[_(k,{htmlFor:"create-task-title",children:W.task_title()}),_(E_,{id:"create-task-title",value:U,onChange:(Y)=>M(Y.target.value),placeholder:W.task_title_placeholder(),required:!0,autoFocus:!0})]}),J("div",{className:"space-y-1.5",children:[_(k,{htmlFor:"create-task-desc",children:W.task_description()}),_(L_,{id:"create-task-desc",value:b,onChange:(Y)=>y(Y.target.value),placeholder:W.task_description_placeholder(),rows:3})]}),J("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[J("div",{className:"sm:col-span-2 flex items-center justify-between space-x-2 rounded-lg border border-border/80 bg-muted/30 p-2.5 h-14",children:[J("div",{className:"space-y-0.5 min-w-0 pr-2",children:[J(k,{htmlFor:"create-is-agent-task",className:"text-xs font-medium cursor-pointer flex items-center gap-1.5",children:[_($_,{className:"w-3.5 h-3.5 text-orange-500"}),_("span",{children:W.task_type_agent()})]}),_("p",{className:"text-[11px] text-muted-foreground line-clamp-1",children:W.task_type_agent_desc()})]}),_(S1,{id:"create-is-agent-task",checked:C,onCheckedChange:(Y)=>{S(Y),q("none")}})]}),J("div",{className:"space-y-1.5",children:[_(k,{className:"text-xs font-medium text-muted-foreground",children:W.task_priority()}),J(V_,{value:O,onValueChange:(Y)=>T(Y),children:[_(f_,{className:"w-full h-9 text-xs",children:_(Q_,{})}),_(N_,{children:Object.values(j_).map((Y)=>_(d,{value:Y,children:_("span",{className:m("px-1.5 py-0.5 rounded text-[10px] uppercase font-medium",u_(Y)),children:k_(Y)})},Y))})]})]}),J("div",{className:"space-y-1.5",children:[_(k,{className:"text-xs font-medium text-muted-foreground",children:W.goals()}),J(V_,{value:Q,onValueChange:X,children:[_(f_,{className:"w-full h-9 text-xs",children:_(Q_,{placeholder:"None"})}),J(N_,{children:[_(d,{value:"none",children:_("span",{className:"text-muted-foreground italic",children:"None"})}),x1.filter((Y)=>Y.id!==s).map((Y)=>_(d,{value:Y.id,children:J("div",{className:"flex items-center gap-2",children:[_(n,{className:"w-3.5 h-3.5 text-primary"}),_("span",{children:Y.title})]})},Y.id))]})]})]}),J("div",{className:"space-y-1.5",children:[_(k,{className:"text-xs font-medium text-muted-foreground",children:i_?W.select_agent():W.assignee()}),J(V_,{value:w,onValueChange:q,children:[_(f_,{className:"w-full h-9 text-xs",children:_(Q_,{placeholder:W.unassigned()})}),J(N_,{children:[_(d,{value:"none",children:_("span",{className:"text-muted-foreground italic",children:W.unassigned()})}),i_?j1.map((Y)=>_(d,{value:Y.id,children:J("div",{className:"flex items-center gap-2",children:[_($_,{className:"w-3.5 h-3.5 text-purple-500"}),_("span",{children:Y.name})]})},Y.id)):e_.map((Y)=>_(d,{value:Y.id,children:J("div",{className:"flex items-center gap-2",children:[J(X_,{size:"sm",className:"w-4 h-4",children:[_(H_,{src:Y.image}),_(z_,{className:"text-[8px]",children:Y.name.slice(0,2).toUpperCase()})]}),_("span",{children:Y.name})]})},Y.id))]})]})]}),J("div",{className:"space-y-1.5",children:[_(k,{className:"text-xs font-medium text-muted-foreground",children:W.reporter()}),J(V_,{value:V,onValueChange:z,children:[_(f_,{className:"w-full h-9 text-xs",children:_(Q_,{placeholder:W.unassigned()})}),J(N_,{children:[_(d,{value:"none",children:_("span",{className:"text-muted-foreground italic",children:W.unassigned()})}),e_.map((Y)=>_(d,{value:Y.id,children:J("div",{className:"flex items-center gap-2",children:[J(X_,{size:"sm",className:"w-4 h-4",children:[_(H_,{src:Y.image}),_(z_,{className:"text-[8px]",children:Y.name.slice(0,2).toUpperCase()})]}),_("span",{children:Y.name})]})},Y.id))]})]})]}),i_&&J("div",{className:"sm:col-span-2 space-y-1.5",children:[_(k,{className:"text-xs font-medium text-muted-foreground",children:W.target_folder()}),J(P,{type:"button",variant:"outline",size:"sm",onClick:()=>t_(!0),className:"w-full justify-start h-9 text-xs truncate font-normal",children:[_(C1,{className:"w-3.5 h-3.5 mr-2 text-primary shrink-0"}),_("span",{className:"truncate",children:I||W.select_target_folder()})]})]}),J("div",{className:"space-y-1.5",children:[_(k,{className:"text-xs font-medium text-muted-foreground",children:W.start_date()}),_(r_,{value:Z,onChange:N,placeholder:W.start_date(),className:"h-9 text-xs"})]}),J("div",{className:"space-y-1.5",children:[_(k,{className:"text-xs font-medium text-muted-foreground",children:W.due_date()}),_(r_,{value:K,onChange:v,placeholder:W.due_date(),className:"h-9 text-xs"})]}),J("div",{className:"sm:col-span-2 space-y-1.5",children:[_(k,{className:"text-xs font-medium text-muted-foreground",children:W.parent_tasks()}),_(D1,{teamId:$,value:j,onChange:h_})]}),_("div",{className:"sm:col-span-2 pt-1",children:_(p1,{teamId:$,projectId:f,assets:I_,onAddAssets:(Y)=>x_((u)=>[...u,...Y]),onRemoveAsset:(Y)=>x_((u)=>u.filter((a)=>a.id!==Y))})})]})]}),J(B_,{children:[_(P,{type:"button",variant:"outline",onClick:F,disabled:v_,children:W.cancel()}),J(P,{type:"submit",disabled:!U.trim()||v_,children:[v_&&_(g,{className:"w-4 h-4 mr-1.5 animate-spin"}),W.create()]})]})]}),a_&&_(T1,{teamId:$,currentProjectId:f,currentTargetFolderId:A,isOpen:a_,onClose:()=>t_(!1),onSelect:(Y,u,a)=>{R(Y),E(u),D(a||"Selected Folder")}})]})})}function k1({teamId:$,initialTaskId:H}){let[F,h]=r.useState("team"),[L,B]=r.useState(null),[U,M]=r.useState(H??null),[b,y]=r.useState(!1);r.useEffect(()=>{if(H)M(H)},[H]);let[C,S]=r.useState(l.TODO),{data:O,isLoading:T}=i({queryKey:["teams",$,"me"],queryFn:async()=>{let Z=await G.api.teams[":teamId"].me.$get({param:{teamId:$}});if(!Z.ok)throw Error("Failed to fetch me");return await Z.json()},enabled:!!$}),{data:Q}=i({queryKey:["teams",$,"kanban","goals"],queryFn:async()=>{let Z=await G.api.teams[":teamId"].kanban.goals.$get({param:{teamId:$},query:{}});if(!Z.ok)return{data:[]};return await Z.json()},enabled:!!$}),X=Q?.data||[],w=L?X.find((Z)=>Z.id===L)||null:null,q=O?.role?.toLowerCase()==="owner"||O?.role?.toLowerCase()==="editor",V=(Z=l.TODO)=>{S(Z),y(!0)},z=(Z)=>{M(Z.id)};if(T)return _("div",{className:"flex h-full items-center justify-center",children:_(g,{className:"w-8 h-8 animate-spin text-muted-foreground"})});return J("div",{className:"flex flex-row h-full bg-background overflow-hidden font-sans",children:[_(z1,{teamId:$,selectedGoalId:L,onSelectGoal:B,isOwnerOrEditor:q}),J("div",{className:"flex-1 flex flex-col min-w-0 h-full overflow-hidden",children:[_(W1,{scope:F,onScopeChange:h,selectedGoal:w,onClearGoal:()=>B(null),onCreateTask:()=>V(l.TODO),canCreateTask:q}),_(G1,{teamId:$,selectedGoalId:L,scope:F,currentUserId:O?.id,currentUserRole:O?.role,onTaskClick:z,onCreateTaskInColumn:(Z)=>V(Z)})]}),U&&_(m1,{teamId:$,taskId:U,isOpen:!!U,onClose:()=>M(null),canEdit:q}),b&&_(c1,{teamId:$,isOpen:b,initialStatus:C,initialGoalId:L,onClose:()=>y(!1)})]})}function d1(){let{teamId:$}=u1.useParams(),{taskId:H}=u1.useSearch();return _(k1,{teamId:$,initialTaskId:H})}var u1=g1("/teams/$teamId/kanban")({component:d1});export{u1 as Route};
@@ -1 +0,0 @@
1
- import{i as d,j as x,k as r,l as D,m as G,n as M}from"./chunk-sx6y697s.js";import{ba as p}from"./chunk-djx2r4nj.js";import{ie as m}from"./chunk-vkgxrn1h.js";import{Ee as I}from"./chunk-y0f4bc9f.js";import{lg as g}from"./chunk-rkz6x3r0.js";import{ah as u}from"./chunk-7x1vkftb.js";import"./chunk-ck6msfch.js";import"./chunk-vhcqazqf.js";import{eh as f}from"./chunk-tcm57j8r.js";import{$h as T,Zh as F,_h as P}from"./chunk-kxr8fjsq.js";import{mi as b}from"./chunk-02afmyqy.js";import{Ci as N,ui as R,wi as k}from"./chunk-8nyve0cr.js";import{Fk as S,Pj as z,Tj as C,Vi as o,Wi as y,Xi as q,Yi as K,bj as v,gj as L,mm as Y,wj as h}from"./chunk-kqpzx5az.js";import{kn as t}from"./chunk-p49h5fxs.js";var Z=t(o(),1);var s=(X)=>{if(!X)return"??";return X.split(" ").map((_)=>_[0]).slice(0,2).join("").toUpperCase()};function e(){let{projectId:X}=qq.useParams(),{teamId:_,ensureTeamIdForProject:E}=b(),j=v();Z.useEffect(()=>{E(X)},[X,E]);let{data:O}=R(m(X)),W=O?.rootFolder,[n,i]=Z.useState(240),{fileListLeftSidebarCollapsed:A,setFileListLeftSidebarCollapsed:c}=g(),{data:B,isLoading:a,fetchNextPage:Q,hasNextPage:V,isFetchingNextPage:U}=k({queryKey:["collections",X],queryFn:async({pageParam:J})=>{let $=await N.api.projects[":projectId"].collections.$get({param:{projectId:X},query:{first:"20",after:J}});if(!$.ok)throw Error("Failed to fetch collections");return await $.json()},initialPageParam:"",getNextPageParam:(J)=>J.pageInfo?.cursor||void 0,enabled:!!X}),{ref:l,inView:H}=f();Z.useEffect(()=>{if(H&&V&&!U)Q()},[H,V,U,Q]);let w=Z.useMemo(()=>B?.pages.flatMap((J)=>J.data)||[],[B]);if(!_||!W||!O)return q(I,{});return q("div",{className:"flex flex-1 flex-col bg-background min-h-0",children:K("div",{className:"flex flex-1 overflow-hidden relative",children:[!A&&q("div",{className:"md:hidden fixed inset-0 bg-black/50 z-40",onClick:()=>c(!0)}),!A&&K(y,{children:[q("div",{className:"bg-background",style:{width:n},children:q(u,{teamId:_,projectId:X,projectName:O.name??"",rootFolderId:W})}),q(p,{onResize:(J)=>{i(($)=>Math.max(180,Math.min(400,$+J)))},className:"hidden md:block"})]}),K("div",{className:"flex-1 flex flex-col min-h-0 bg-card overflow-hidden",children:[q("header",{className:"h-14 border-b flex items-center justify-between px-6 shrink-0 bg-background/50 backdrop-blur-sm sticky top-0 z-10",children:K("div",{className:"flex items-center gap-2",children:[q(z,{className:"h-5 w-5 text-primary"}),q("h1",{className:"font-bold text-lg text-foreground",children:Y.all_collections()})]})}),q("div",{className:"flex-1 overflow-y-auto p-6",children:a?q("div",{className:"flex justify-center items-center h-64",children:q("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):w.length===0?K("div",{className:"flex flex-col items-center justify-center h-64 text-muted-foreground gap-3",children:[q(S,{className:"h-10 w-10 text-muted-foreground/50"}),q("p",{children:Y.no_collections_yet()})]}):K("div",{className:"border border-border rounded-xl bg-background overflow-hidden shadow-xs",children:[K(d,{children:[q(x,{children:K(D,{className:"hover:bg-transparent bg-muted/20",children:[q(G,{className:"font-semibold px-4 py-3",children:Y.collection_name()}),q(G,{className:"font-semibold px-4 py-3",children:Y.creator()}),q(G,{className:"font-semibold px-4 py-3 w-[200px]",children:Y.created_date()})]})}),q(r,{children:w.map((J)=>K(D,{className:"hover:bg-muted/10 transition-colors cursor-pointer",onClick:()=>j({to:"/projects/$projectId/collections/$collectionId",params:{projectId:X,collectionId:J.id}}),children:[q(M,{className:"font-medium px-4 py-3.5",children:K("div",{className:"flex items-center gap-2",children:[q(z,{className:"h-4 w-4 text-primary shrink-0"}),q("span",{className:"text-foreground font-semibold hover:underline",children:J.name})]})}),q(M,{className:"px-4 py-3.5",children:K("div",{className:"flex items-center gap-2",children:[K(F,{className:"h-6 w-6",children:[J.creator?.image&&q(P,{src:J.creator.image,alt:J.creator.name,className:"object-cover"}),q(T,{className:"text-[10px]",children:s(J.creator?.name)})]}),q("span",{className:"text-sm font-medium text-foreground truncate max-w-[200px]",children:J.creator?.name||Y.unknown()})]})}),q(M,{className:"px-4 py-3.5 text-muted-foreground text-sm",children:K("div",{className:"flex items-center gap-2",children:[q(C,{className:"h-3.5 w-3.5 text-muted-foreground/70"}),q("span",{children:new Date(J.createdAt).toLocaleDateString()})]})})]},J.id))})]}),q("div",{ref:l,className:"h-10 w-full flex items-center justify-center",children:U&&q(h,{className:"h-6 w-6 animate-spin text-primary"})})]})})]})]})})}var qq=L("/projects/$projectId/collections/")({component:e});export{qq as Route};
@@ -1 +0,0 @@
1
- import{d as y}from"./chunk-k2065y29.js";import"./chunk-6tse78c7.js";import"./chunk-0n1wfwcm.js";import"./chunk-by6g0vye.js";import"./chunk-gcpr2a24.js";import"./chunk-nn0px81k.js";import"./chunk-mha3rsh7.js";import"./chunk-jt6d0zb1.js";import"./chunk-4b7jcpgv.js";import"./chunk-djx2r4nj.js";import"./chunk-y3dy4pdt.js";import"./chunk-mgnxa0vy.js";import{oe as v,pe as m}from"./chunk-52dr035y.js";import"./chunk-j536e9nx.js";import"./chunk-ajndx51c.js";import"./chunk-93ecxcy4.js";import"./chunk-mhps85dd.js";import"./chunk-r2shjtte.js";import"./chunk-ns804tmv.js";import"./chunk-ymr5ybxk.js";import"./chunk-2xevs82j.js";import"./chunk-y2s0tjaa.js";import"./chunk-yyjx8nbq.js";import"./chunk-zye42cfp.js";import"./chunk-dk8vk17v.js";import"./chunk-rkz6x3r0.js";import"./chunk-7x1vkftb.js";import"./chunk-ck6msfch.js";import"./chunk-vhcqazqf.js";import"./chunk-tcm57j8r.js";import"./chunk-0bfqrx5q.js";import"./chunk-dkjkn8t3.js";import"./chunk-76433x4d.js";import"./chunk-2xgvs3as.js";import"./chunk-9cmvymm5.js";import"./chunk-6m1k317a.js";import"./chunk-kxr8fjsq.js";import{mi as w}from"./chunk-02afmyqy.js";import{Ci as r,ti as i,ui as f,vi as x}from"./chunk-8nyve0cr.js";import"./chunk-62ebss6h.js";import{Vi as q,Xi as n,gj as b,mm as g}from"./chunk-kqpzx5az.js";import{kn as W}from"./chunk-p49h5fxs.js";var d=W(q(),1);function A(){let{projectId:e,collectionId:l}=K.useParams(),{teamId:o,ensureTeamIdForProject:h}=w();d.useEffect(()=>{h(e)},[e,h]);let{data:p}=f(v(e)),{data:s,refetch:z}=i({...m(l)}),{mutate:k}=x({mutationFn:async(a)=>{let c=await r.api.collections[":collectionId"].$patch({param:{collectionId:l},json:a});if(!c.ok)throw Error("Failed to update collection");return await c.json()},onSuccess:()=>{z()}}),t=p?.rootFolder,{data:u}=i({queryKey:["folders",t],queryFn:async()=>{let a=await r.api.folders[":folderId"].$get({param:{folderId:t}});if(!a.ok)throw Error("Failed to fetch folder");return await a.json()},enabled:!!t});if(!o||!t||!u||!s)return n("div",{children:g.loading_collection()});let C=s.filter.sourceFolderId||t;return n(y,{teamId:o,projectId:e,projectName:p.name??"",assetId:C,rootFolderId:t,collection:s,onUpdateCollection:k})}var K=b("/projects/$projectId/collections/$collectionId")({component:A});export{K as Route};
@@ -1 +0,0 @@
1
- import{d as g}from"./chunk-k2065y29.js";import"./chunk-6tse78c7.js";import"./chunk-0n1wfwcm.js";import"./chunk-by6g0vye.js";import"./chunk-gcpr2a24.js";import"./chunk-nn0px81k.js";import"./chunk-mha3rsh7.js";import"./chunk-jt6d0zb1.js";import"./chunk-4b7jcpgv.js";import"./chunk-djx2r4nj.js";import"./chunk-y3dy4pdt.js";import"./chunk-mgnxa0vy.js";import{te as x}from"./chunk-aw5zkdma.js";import{Ee as f}from"./chunk-y0f4bc9f.js";import"./chunk-j536e9nx.js";import"./chunk-ajndx51c.js";import"./chunk-93ecxcy4.js";import"./chunk-mhps85dd.js";import"./chunk-r2shjtte.js";import"./chunk-ns804tmv.js";import"./chunk-ymr5ybxk.js";import"./chunk-2xevs82j.js";import"./chunk-y2s0tjaa.js";import"./chunk-yyjx8nbq.js";import"./chunk-zye42cfp.js";import"./chunk-dk8vk17v.js";import"./chunk-rkz6x3r0.js";import"./chunk-7x1vkftb.js";import"./chunk-ck6msfch.js";import"./chunk-vhcqazqf.js";import"./chunk-tcm57j8r.js";import"./chunk-0bfqrx5q.js";import"./chunk-dkjkn8t3.js";import"./chunk-76433x4d.js";import"./chunk-2xgvs3as.js";import"./chunk-9cmvymm5.js";import"./chunk-6m1k317a.js";import"./chunk-kxr8fjsq.js";import{mi as p}from"./chunk-02afmyqy.js";import{Ci as h,ti as r,ui as o}from"./chunk-8nyve0cr.js";import"./chunk-62ebss6h.js";import{Vi as v,Xi as a,gj as c}from"./chunk-kqpzx5az.js";import{kn as w}from"./chunk-p49h5fxs.js";var b=w(v(),1);function d(){let{projectId:e}=y.useParams(),{teamId:s,ensureTeamIdForProject:n}=p();b.useEffect(()=>{n(e)},[e,n]);let{data:i}=o(x(e)),t=i?.rootFolder,{data:m}=r({queryKey:["folders",t],queryFn:async()=>{let l=await h.api.folders[":folderId"].$get({param:{folderId:t}});if(!l.ok)throw Error("failed to fetch folder");return await l.json()},enabled:!!t});if(!s||!t||!m)return a(f,{});return a(g,{teamId:s,projectId:e,projectName:i.name??"",assetId:t,rootFolderId:t})}var y=c("/projects/$projectId/")({component:d});export{y as Route};
@@ -1,2 +0,0 @@
1
- import{dg as p}from"./chunk-y2s0tjaa.js";import{tg as j,vg as F}from"./chunk-7x1vkftb.js";import{Ci as f,Si as _,qi as q,vi as P}from"./chunk-8nyve0cr.js";import{Vi as s}from"./chunk-kqpzx5az.js";import{kn as l}from"./chunk-p49h5fxs.js";var i={x:0.5,y:0.5};class D extends F{apply({activatorEvent:Z,shape:L,transform:E}){if(!L||!(Z instanceof PointerEvent))return E;let M=this.options?.anchor??i,{boundingRectangle:G}=L.initial,Q=G.left+G.width*M.x,J=G.top+G.height*M.y;return{x:E.x+Z.clientX-Q,y:E.y+Z.clientY-J}}static configure=j(D)}var C=l(s(),1);function YO({teamId:Z,projectId:L,assetId:E,folders:M,files:G,selectedIds:Q,onClearSelection:J}){let T=q(),[N,A]=C.useState(void 0),y=(Y,R)=>{let h=["search",Z,E,Y?"folder":"file"],U=T.getQueriesData({queryKey:h}),H=(X)=>{if(typeof X!=="object"||X===null)return!1;let O=X;return"field"in O&&"order"in O&&typeof O.field==="string"&&(O.order==="asc"||O.order==="desc")};for(let[X,O]of U){if(!O||!Array.isArray(O.pages))continue;let z=X.find(H),k=O.pages.flatMap((w)=>w.data??[]),K=k.findIndex((w)=>w.id===R.id);if(K===-1)continue;if(k[K]={...k[K],...R},z?.field==="custom"){let w=z.order==="desc";k.sort((B,x)=>{let $=B.sortIndex??"",b=x.sortIndex??"";if($===b)return 0;if(w)return $<b?1:-1;else return $<b?-1:1})}let V=0,o=O.pages.map((w)=>{let B=w.data?w.data.length:0,x=k.slice(V,V+B);return V+=B,{...w,data:x}});T.setQueryData(X,{...O,pages:o})}},v=f.api.projects[":projectId"].reparent.$post,{mutate:c}=P({mutationFn:async(Y)=>{if(!(await v(Y)).ok)throw Error("Failed to move assets");return null}}),n=f.api.folders[":folderId"].order.$patch,{mutate:u}=P({mutationFn:async(Y)=>{let R=await n(Y);if(!R.ok)throw Error("Failed to reorder folder");return await R.json()}}),m=f.api.files[":fileId"].order.$patch,{mutate:S}=P({mutationFn:async(Y)=>{let R=await m(Y);if(!R.ok)throw Error("Failed to reorder file");return await R.json()}}),I=f.api.shares[":shareId"].assets.$post,{mutate:g}=P({mutationFn:async(Y)=>{let R=await I(Y);if(!R.ok)throw Error("Failed to add asset to share");return await R.json()}});return{dragState:N,handleDragStart:(Y)=>{let R=Y.operation.source;if(!R)return;let W=R.id.split(":").pop(),h=R.data;if(!h)return;let U,H;if(Q.has(W))U=new Set(Q),H=[...M,...G].filter((O)=>Q.has(O.id));else U=new Set([W]),H=[h.item];let X=H.some((O)=>O.type==="folder");A({isActive:!0,draggedIds:U,hasFolders:X,itemCount:U.size})},handleDragEnd:(Y)=>{let{target:R}=Y.operation;if(R&&N){let W=R.id.split(":").pop(),h=R.data;if(h?.type==="chatbot-sidebar"){let X=[...M,...G].filter((O)=>N.draggedIds.has(O.id)).map((O)=>({id:O.id,name:O.name||"Unnamed",type:O.type}));p.getState().addAssets(X),J(),A(void 0);return}if(h?.type==="share-link"){let H=W,X=Array.from(N.draggedIds);g({param:{shareId:H},json:{assetIds:X}},{onSuccess:(O)=>{if(O.addedCount===0)_.info("Assets already exists in share");else _.success(`Added ${O.addedCount} item(s) to share link`);T.invalidateQueries({queryKey:["shares",L]}),J()},onError:(O)=>{_.error(`Failed to add to share: ${O.message}`)}}),A(void 0);return}let U=!1;if(h&&!N.draggedIds.has(W)){if(h.type==="folder"||h.type==="reorder")U=!0;else if(h.type==="file"){if(!N.hasFolders&&N.itemCount===1)U=!0}}if(h?.type==="reorder"){let{position:H,item:X}=h,O=N.hasFolders,z=Array.from(N.draggedIds)[0];if(O)u({param:{folderId:z},json:H==="before"?{beforeIndex:X.sortIndex??void 0}:{afterIndex:X.sortIndex??void 0}},{onSuccess:(k)=>{_.success("Folder reordered"),y(!0,k),J()},onError:(k)=>{_.error(`Failed to reorder: ${k.message}`)}});else S({param:{fileId:z},json:H==="before"?{beforeIndex:X.sortIndex??void 0}:{afterIndex:X.sortIndex??void 0}},{onSuccess:(k)=>{_.success("File reordered"),y(!1,k),J()},onError:(k)=>{_.error(`Failed to reorder: ${k.message}`)}})}else if(U)c({param:{projectId:L},json:{assetIds:Array.from(N.draggedIds),newParentId:W}},{onSuccess:()=>{_.success("Assets moved successfully"),T.invalidateQueries({queryKey:["search",Z,E]}),T.invalidateQueries({queryKey:["folders"]}),J()},onError:()=>{_.error("Failed to move assets")}})}A(void 0)}}}
2
- export{D as e,YO as f};