@shumai-one/shumai 0.6.3 → 0.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. package/bin/{chunk-y3haqtr8.js → chunk-01vx2chc.js} +2 -2
  2. package/bin/chunk-0epkrexd.js +2 -0
  3. package/bin/chunk-0h5239kt.js +2 -0
  4. package/bin/{chunk-tfrevef9.js → chunk-0jnstdgf.js} +1 -1
  5. package/bin/{chunk-w6g84d59.js → chunk-0njsjy6x.js} +4 -4
  6. package/bin/{chunk-f8hgy69t.js → chunk-13rq2gtr.js} +2 -2
  7. package/bin/chunk-1aqs9sdh.js +3 -0
  8. package/bin/{chunk-09mj32d7.js → chunk-22jbsrka.js} +1 -1
  9. package/bin/chunk-2qknebmd.js +1 -0
  10. package/bin/{chunk-bd3v8mp1.js → chunk-2qzmh3ae.js} +4 -4
  11. package/bin/{chunk-p2vsdnd1.js → chunk-2tt0b8ym.js} +2 -2
  12. package/bin/{chunk-3s2ga6mt.js → chunk-2zm7czk6.js} +1 -1
  13. package/bin/{chunk-vmwys2ch.js → chunk-396tfwdx.js} +1 -1
  14. package/bin/chunk-3mx4trvh.js +10 -0
  15. package/bin/{chunk-j2txsbxz.js → chunk-45pb3kzz.js} +2 -2
  16. package/bin/{chunk-dkhdn92k.js → chunk-47fmhzwv.js} +2 -2
  17. package/bin/chunk-4awk4xhq.js +2 -0
  18. package/bin/{chunk-5ddg5ezb.js → chunk-4b2x2qba.js} +21 -21
  19. package/bin/{chunk-9x42vgeq.js → chunk-4rjy7ybr.js} +8 -8
  20. package/bin/{chunk-enax4303.js → chunk-598x693h.js} +2 -2
  21. package/bin/chunk-5c7ztqs7.js +1 -0
  22. package/bin/{chunk-4p31kxjh.js → chunk-65dh7x4c.js} +2 -2
  23. package/bin/{chunk-s74g9vsk.js → chunk-66e2vrky.js} +1 -1
  24. package/bin/{chunk-q8xr1a8j.js → chunk-6j3beg6n.js} +2 -2
  25. package/bin/{chunk-95b4mwyq.js → chunk-6ke13k69.js} +1 -1
  26. package/bin/{chunk-a859y4e1.js → chunk-6rqakmg0.js} +2 -2
  27. package/bin/{chunk-yb4mzqrd.js → chunk-6ty4tfmf.js} +3 -3
  28. package/bin/chunk-7e9ws6dh.js +129 -0
  29. package/bin/chunk-7mdddkfc.js +1 -0
  30. package/bin/{chunk-qvp24w0q.js → chunk-7q4mgd5x.js} +2 -2
  31. package/bin/chunk-7yv7shad.js +1 -0
  32. package/bin/{chunk-25npafhz.js → chunk-81b8rfv7.js} +2 -2
  33. package/bin/{chunk-etrm28sy.js → chunk-8a7ymmd4.js} +2 -2
  34. package/bin/chunk-8ac9at5y.js +2 -0
  35. package/bin/{chunk-sz19nn1x.js → chunk-8zcfgz9c.js} +1 -1
  36. package/bin/{chunk-te484xtb.js → chunk-955kf5kc.js} +3 -3
  37. package/bin/{chunk-h2bphev9.js → chunk-978rm9a9.js} +2 -2
  38. package/bin/{chunk-jt02kpfc.js → chunk-9qzbrp4d.js} +2 -2
  39. package/bin/{chunk-20bamhwa.js → chunk-a283dh05.js} +2 -2
  40. package/bin/chunk-aa2a06cc.js +1 -0
  41. package/bin/{chunk-esj0kwe5.js → chunk-ajr1w3vq.js} +6 -6
  42. package/bin/chunk-akafypge.js +218 -0
  43. package/bin/chunk-amk373q2.js +2 -0
  44. package/bin/{chunk-mn71dffh.js → chunk-apq2gvvp.js} +2 -2
  45. package/bin/chunk-av2w1sez.js +2 -0
  46. package/bin/{chunk-atpt99h4.js → chunk-b6kmj34z.js} +12 -12
  47. package/bin/chunk-bkzaw9p8.js +1 -0
  48. package/bin/{chunk-pq6kdp83.js → chunk-bssb9tar.js} +3 -3
  49. package/bin/chunk-bwvj1aqc.js +1 -0
  50. package/bin/chunk-by9esjn7.js +3 -0
  51. package/bin/chunk-bywk8mbc.js +2 -0
  52. package/bin/{chunk-r6t0j0jx.js → chunk-c61g9hfa.js} +4 -4
  53. package/bin/{chunk-mn0kt3p6.js → chunk-cdcgjh8k.js} +1 -1
  54. package/bin/{chunk-atdfqdkj.js → chunk-d277evce.js} +4 -4
  55. package/bin/{chunk-9405hzv2.js → chunk-d3brvxh7.js} +2 -2
  56. package/bin/{chunk-4vjgdj0h.js → chunk-dcb1nzf1.js} +1 -1
  57. package/bin/{chunk-q5x0yywj.js → chunk-dfbzatq9.js} +2 -2
  58. package/bin/chunk-e0bckx12.js +2 -0
  59. package/bin/{chunk-wgvgtttc.js → chunk-e2p4s2pj.js} +3 -3
  60. package/bin/chunk-e8zzg57c.js +2 -0
  61. package/bin/{chunk-npeapp7e.js → chunk-edfaqwaq.js} +2 -2
  62. package/bin/{chunk-6nqqe7w9.js → chunk-ehgrp0f9.js} +1 -1
  63. package/bin/chunk-evs2aaav.js +12 -0
  64. package/bin/{chunk-cp96e9pq.js → chunk-f5bhcjhw.js} +1 -1
  65. package/bin/{chunk-34f64q0q.js → chunk-fb9dedm2.js} +2 -2
  66. package/bin/{chunk-zx1c4vm5.js → chunk-ff0mh9p3.js} +31 -31
  67. package/bin/chunk-fpfby5tz.js +1 -0
  68. package/bin/{chunk-eyjfhdp9.js → chunk-gd3b5akr.js} +2 -2
  69. package/bin/{chunk-3hgrw1m0.js → chunk-gm1fy3hm.js} +5 -5
  70. package/bin/{chunk-ezjxx44x.js → chunk-gqkjx7rz.js} +3 -3
  71. package/bin/{chunk-1y6h4vge.js → chunk-h7f5370s.js} +1 -1
  72. package/bin/chunk-hcyhsn8e.js +2 -0
  73. package/bin/{chunk-erfkd3z9.js → chunk-jxm0gzmf.js} +2 -2
  74. package/bin/{chunk-09mpcg9x.js → chunk-k3ggy3xk.js} +2 -2
  75. package/bin/{chunk-0a298n62.js → chunk-k9vjs21p.js} +2 -2
  76. package/bin/chunk-ka40gv72.js +1 -0
  77. package/bin/chunk-km70p970.js +2 -0
  78. package/bin/{chunk-vnmggrd6.js → chunk-m6v8rb39.js} +8 -8
  79. package/bin/{chunk-bbxwyhz3.js → chunk-m8spagwp.js} +3 -3
  80. package/bin/{chunk-addssm8d.js → chunk-mfh7mg5b.js} +1 -1
  81. package/bin/chunk-n0cn0218.js +2 -0
  82. package/bin/chunk-n54ftsdx.js +2 -0
  83. package/bin/{chunk-v0yevesp.js → chunk-n7cvj15k.js} +5 -5
  84. package/bin/chunk-na5fh7er.js +2 -0
  85. package/bin/chunk-neazdbxy.js +1 -0
  86. package/bin/chunk-nk24qw3m.js +1 -0
  87. package/bin/{chunk-7mawxsk3.js → chunk-nsbbseff.js} +2 -2
  88. package/bin/chunk-nseef85h.js +1 -0
  89. package/bin/chunk-p35ztj2z.js +3 -0
  90. package/bin/chunk-pcjc9ygv.js +2 -0
  91. package/bin/{chunk-brgns7hv.js → chunk-pemmtd8q.js} +1 -1
  92. package/bin/{chunk-7jz3cmq6.js → chunk-pzrqnnpg.js} +1 -1
  93. package/bin/{chunk-a74g6h8a.js → chunk-q43m934j.js} +2 -2
  94. package/bin/{chunk-6f3zhq64.js → chunk-q57m34h0.js} +3 -3
  95. package/bin/chunk-q5k72jz9.js +3 -0
  96. package/bin/chunk-q9fsxakd.js +2 -0
  97. package/bin/chunk-qadpe0ct.js +2 -0
  98. package/bin/chunk-qeypjv4f.css +1 -0
  99. package/bin/chunk-qw92z3wf.js +2 -0
  100. package/bin/chunk-r0byfq1t.js +1 -0
  101. package/bin/chunk-r0q88qw3.js +2 -0
  102. package/bin/chunk-rjhczkh3.js +2 -0
  103. package/bin/{chunk-19zbh4fr.js → chunk-s0wxbybf.js} +1 -1
  104. package/bin/{chunk-d55138xx.js → chunk-s4hkcw24.js} +2 -2
  105. package/bin/chunk-szta50g1.js +1 -0
  106. package/bin/chunk-t6cb99gp.js +2 -0
  107. package/bin/chunk-tcr080b9.js +1 -0
  108. package/bin/{chunk-s6pk2zyg.js → chunk-v4nqx084.js} +5 -5
  109. package/bin/{chunk-gyv3yrhj.js → chunk-v7jzc3ye.js} +1 -1
  110. package/bin/{chunk-hsyfrzdd.js → chunk-vbe8wred.js} +1 -1
  111. package/bin/{chunk-sz5zawfw.js → chunk-vf9s8b5t.js} +2 -2
  112. package/bin/{chunk-e55sgg8t.js → chunk-vk3eqr65.js} +1 -1
  113. package/bin/{chunk-vv0m0m2f.js → chunk-vm9bbk97.js} +4 -4
  114. package/bin/{chunk-1e1q1hyg.js → chunk-w4gqg27w.js} +2 -2
  115. package/bin/{chunk-z0de127n.js → chunk-w6ym7tsd.js} +4 -4
  116. package/bin/{chunk-3vpz5nat.js → chunk-ways29d1.js} +1 -1
  117. package/bin/chunk-wesg7tg9.js +1 -0
  118. package/bin/chunk-wmrrapwv.js +2 -0
  119. package/bin/chunk-wnwsjgj8.js +2 -0
  120. package/bin/{chunk-zkvezz89.js → chunk-wrb4xq9v.js} +1 -1
  121. package/bin/{chunk-7kah3zb5.js → chunk-wzrzc07t.js} +2 -2
  122. package/bin/chunk-xd1axsdv.js +2 -0
  123. package/bin/{chunk-k7vbk8v4.js → chunk-xk0jmx4s.js} +2 -2
  124. package/bin/{chunk-jc7dycy6.js → chunk-y545vfn0.js} +1 -1
  125. package/bin/{chunk-1ja2zw4w.js → chunk-y6h885fs.js} +1 -1
  126. package/bin/{chunk-0rgbxp24.js → chunk-yncmfr39.js} +2 -2
  127. package/bin/{chunk-7546ptwg.js → chunk-yxnz4ypt.js} +8 -8
  128. package/bin/chunk-zc1asygg.js +2 -0
  129. package/bin/{chunk-hg3rkp41.js → chunk-zc7wzcvh.js} +7 -7
  130. package/bin/chunk-zdvhh8mk.js +2 -0
  131. package/bin/{chunk-femnbfkj.js → chunk-zg0b902x.js} +2 -2
  132. package/bin/{chunk-ddmf9gqv.js → chunk-zhq7a7hs.js} +2 -2
  133. package/bin/{chunk-dygj751y.js → chunk-zmnvskn7.js} +11 -11
  134. package/bin/shumai-app.html +1 -1
  135. package/bin/shumai-app.js +470 -389
  136. package/package.json +7 -7
  137. package/prisma/migrations/20261102032402_add_archive_storage/migration.sql +25 -0
  138. package/prisma/schema.prisma +12 -6
  139. package/bin/chunk-02b5bcmc.js +0 -1
  140. package/bin/chunk-1tar0x8s.js +0 -7
  141. package/bin/chunk-20w1w9x7.js +0 -2
  142. package/bin/chunk-2qgagdb7.js +0 -1
  143. package/bin/chunk-2t6g3pny.js +0 -3
  144. package/bin/chunk-50pfmxt1.js +0 -2
  145. package/bin/chunk-5ngftxjb.js +0 -218
  146. package/bin/chunk-6t525bmg.js +0 -1
  147. package/bin/chunk-88jg9dq5.js +0 -2
  148. package/bin/chunk-8qdtvfx3.css +0 -1
  149. package/bin/chunk-8ww98y1m.js +0 -2
  150. package/bin/chunk-9vxmgvc8.js +0 -2
  151. package/bin/chunk-ajq9sxg0.js +0 -129
  152. package/bin/chunk-amp9h878.js +0 -2
  153. package/bin/chunk-awshe30f.js +0 -1
  154. package/bin/chunk-b3t7gbhm.js +0 -2
  155. package/bin/chunk-c02727j9.js +0 -2
  156. package/bin/chunk-c1wvs81k.js +0 -2
  157. package/bin/chunk-c8frmqsk.js +0 -2
  158. package/bin/chunk-cagzye3j.js +0 -2
  159. package/bin/chunk-djb65frk.js +0 -1
  160. package/bin/chunk-dx9f5wab.js +0 -1
  161. package/bin/chunk-ex3174e3.js +0 -2
  162. package/bin/chunk-f4xnx4n6.js +0 -1
  163. package/bin/chunk-fakph5jp.js +0 -1
  164. package/bin/chunk-ffjdkdcv.js +0 -2
  165. package/bin/chunk-gd016e9p.js +0 -2
  166. package/bin/chunk-h3atwgx2.js +0 -1
  167. package/bin/chunk-h7xny3de.js +0 -2
  168. package/bin/chunk-hpzk9k55.js +0 -1
  169. package/bin/chunk-hvyy8vct.js +0 -3
  170. package/bin/chunk-j2s311yc.js +0 -3
  171. package/bin/chunk-j6x53e33.js +0 -1
  172. package/bin/chunk-jacanzp7.js +0 -1
  173. package/bin/chunk-pdw77q09.js +0 -2
  174. package/bin/chunk-ptcz4ed3.js +0 -2
  175. package/bin/chunk-q1fzgqsv.js +0 -2
  176. package/bin/chunk-q4ny4hpt.js +0 -2
  177. package/bin/chunk-q8ysc5ex.js +0 -1
  178. package/bin/chunk-qm50g4n5.js +0 -10
  179. package/bin/chunk-s1j4v33x.js +0 -2
  180. package/bin/chunk-t68y25gf.js +0 -1
  181. package/bin/chunk-thpw6tcj.js +0 -2
  182. package/bin/chunk-vj4gamdn.js +0 -2
  183. package/bin/chunk-xy9qpn6b.js +0 -1
  184. package/bin/chunk-y5dv67mg.js +0 -2
  185. package/bin/chunk-z8t6e0ee.js +0 -1
  186. package/bin/chunk-zfg4yy3c.js +0 -2
  187. package/bin/chunk-zrrnvdxq.js +0 -3
  188. package/bin/chunk-zzqse5qc.js +0 -2
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{eA,Im,Gu,Qr,Vu,bs,Ku,bl,wl,Qo,Af,bc,Ky,In,so,en,_f}from"./chunk-sz19nn1x.js";export{Ku as EncryptJWT,bs as SignJWT,bc as UnsecuredJWT,Im as base64url,wl as calculateJwkThumbprint,Gu as compactVerify,Qo as createLocalJWKSet,Af as createRemoteJWKSet,en as decodeJwt,so as decodeProtectedHeader,eA as errors,bl as exportJWK,_f as generateKeyPair,In as importJWK,Ky as importPKCS8,Vu as jwtDecrypt,Qr as jwtVerify};
@@ -1 +0,0 @@
1
- import{S,L,a,X,Je,R,Pt,qt,Pg}from"./chunk-5ngftxjb.js";import"./chunk-ajq9sxg0.js";import"./chunk-1tar0x8s.js";import"./chunk-34f64q0q.js";import"./chunk-qvp24w0q.js";import"./chunk-9405hzv2.js";import"./chunk-qm50g4n5.js";import"./chunk-ffjdkdcv.js";import"./chunk-50pfmxt1.js";import"./chunk-20w1w9x7.js";import"./chunk-thpw6tcj.js";import"./chunk-pq6kdp83.js";import"./chunk-6f3zhq64.js";import"./chunk-d55138xx.js";import{xo}from"./chunk-cagzye3j.js";import"./chunk-sz5zawfw.js";import{Ar}from"./chunk-b3t7gbhm.js";import"./chunk-c1wvs81k.js";import"./chunk-etrm28sy.js";import"./chunk-0a298n62.js";import"./chunk-s1j4v33x.js";import"./chunk-pdw77q09.js";import"./chunk-femnbfkj.js";import"./chunk-25npafhz.js";import"./chunk-7kah3zb5.js";L();function m(){let{projectId:o,folderId:n}=c.useParams(),{teamId:r,ensureTeamIdForProject:t}=Pt();S(()=>{t(o)},[o,t]);let{data:d}=Ar(Pg(o)),e=d?.rootFolder,{data:s}=X({queryKey:["folders",e],queryFn:()=>(async()=>await(await R.api.folders[":folderId"].$get({param:{folderId:e}})).json())(),enabled:!!e});if(!r||!e||!s)return a(qt,{});return a(xo,{teamId:r,projectId:o,projectName:d.name??"",assetId:n,rootFolderId:e})}var c=Je("/projects/$projectId/folders/$folderId")({component:m});export{c as Route};
@@ -1,2 +0,0 @@
1
- import{ks,vA,Oc}from"./chunk-5ngftxjb.js";function Ar(e,r){return Oc({...e,enabled:!0,suspense:!0,throwOnError:vA,placeholderData:void 0},ks,r)}
2
- export{Ar};
@@ -1,2 +0,0 @@
1
- import{a,B}from"./chunk-5ngftxjb.js";function Un({className:t,...e}){return a("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:a("table",{"data-slot":"table",className:B("w-full caption-bottom text-sm",t),...e})})}function zn({className:t,...e}){return a("thead",{"data-slot":"table-header",className:B("[&_tr]:border-b",t),...e})}function jn({className:t,...e}){return a("tbody",{"data-slot":"table-body",className:B("[&_tr:last-child]:border-0",t),...e})}function Tr({className:t,...e}){return a("tr",{"data-slot":"table-row",className:B("border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",t),...e})}function vt({className:t,...e}){return a("th",{"data-slot":"table-head",className:B("h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e})}function ut({className:t,...e}){return a("td",{"data-slot":"table-cell",className:B("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e})}
2
- export{Un,zn,jn,Tr,vt,ut};
@@ -1,2 +0,0 @@
1
- import{z}from"./chunk-5ngftxjb.js";var e=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],ns=z("terminal",e);
2
- export{ns};
@@ -1,2 +0,0 @@
1
- import{z}from"./chunk-5ngftxjb.js";var e=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],du=z("code",e);
2
- export{du};
@@ -1,2 +0,0 @@
1
- import{S,Q,M,w,L,W,a,g,ie,X,ee,Tt,We,R,B,$0,H0,nR,Xt,oi,an,Xn,Eo,Md,$r,Bn,An,lr,Ir,Lr,hs}from"./chunk-5ngftxjb.js";import{cn}from"./chunk-ajq9sxg0.js";import{Ea}from"./chunk-1tar0x8s.js";import{ba}from"./chunk-ffjdkdcv.js";import{al,uu}from"./chunk-50pfmxt1.js";import{Au}from"./chunk-thpw6tcj.js";import{xa}from"./chunk-6f3zhq64.js";import{Yr}from"./chunk-d55138xx.js";L();function Ne(i,t,b,n,d,f){let T=i.type==="folder",m=t.type==="folder";if(T!==m)return null;let F=m?n:d,v=F.findIndex((o)=>o.id===b),x=F.findIndex((o)=>o.id===t.id);if(v===-1||x===-1)return null;let z=Math.min(v,x),K=Math.max(v,x),P=F.slice(z,K+1),r=new Set(f);return P.forEach((o)=>{if(o.id)r.add(o.id)}),r}function xo({teamId:i,projectId:t,projectName:b,assetId:n,rootFolderId:d,collection:f,onUpdateCollection:T}){let m=We(),F=ie(),{canEdit:v}=Xt(t),{setFields:x}=cn(),z=R.api.files[":fileId"].metadata.$patch,{mutate:K}=ee({mutationFn:async(e)=>{if(!(await z(e)).ok)throw Error("Failed to patch metadata");return null}}),{data:P}=X({queryKey:["fields",t],queryFn:async()=>{let e=await R.api.projects[":projectId"].fields.$get({param:{projectId:t}});if(!e.ok)throw Error("Failed to fetch fields");return await e.json()},enabled:!!t});S(()=>{if(P)x(P,t)},[P,t,x]);let r=n==="recently-deleted",o=n==="recents",[O,C]=w(null),[c,N]=w(new Set),[U,q]=w(null),[ke,Me]=w(240),[Ae,Le]=w(360),{isChatbotOpen:_}=Ir(),{members:Re,fetchMembers:oe}=An(),{metadata:ne,fetchMetadata:re,setMetadata:De}=Lr(),ae=Boolean(ne["appearance.hideAgent"]);S(()=>{if(i)oe(i),re(i)},[i,oe,re]);let H=Q(()=>f?.filter?.searchFilter?.conditions||[],[f]),[k,V]=w(H);S(()=>{V(H)},[H]);let le=`project:${t}:sort`,A=ne[le]||{field:"custom",order:"asc"},$e=(e)=>{if(e)De(i,le,e)},h=!!f,E=k.length>0||h,{fileListLeftSidebarCollapsed:de,setFileListLeftSidebarCollapsed:je,fileListRightSidebarCollapsed:fe,setFileListRightSidebarCollapsed:qe,viewModes:Ee}=lr(),ce=Ee[t]??"card",Te=M(null),{data:D}=r||o?{data:void 0}:X({queryKey:["folders",n],queryFn:async()=>{let e=await R.api.folders[":folderId"].$get({param:{folderId:n}});if(!e.ok)throw Error("failed to fetch folder");return await e.json()}}),{setProjectState:ue,clearProjectState:ge}=Bn();S(()=>(ue({teamId:i,projectId:t,projectName:b,rootFolderId:d,ancestorFolders:D?.ancestorFolders??[],currentAsset:r?{name:$0(),type:"folder"}:o?{name:H0(),type:"folder"}:h?{id:f.id,name:f.name,type:"folder"}:{id:D?.id||n,name:D?.name,type:"folder"},isRootFolder:!r&&!o&&!h&&n===d,onFolderClick:(e)=>{m({to:"/projects/$projectId/folders/$folderId",params:{projectId:t,folderId:e}})}}),()=>ge()),[i,t,b,D,r,o,n,d,ue,ge,m]);let{data:G,fetchNextPage:pe,hasNextPage:me,isFetchingNextPage:he,isLoading:ze}=Tt({queryKey:r?["projects",t,"recently-deleted","folder"]:o?["projects",t,"recents","folder"]:["search",i,n,"folder",k,A,h],queryFn:async({pageParam:e})=>{if(r||h||o){if(r){let l=await R.api.projects[":projectId"]["recently-deleted"].$get({param:{projectId:t},query:{assetType:"folder",after:e}});if(!l.ok)throw Error("failed to fetch recently deleted folders");return await l.json()}return{data:[],pageInfo:{total:0}}}if(E)return{data:[],pageInfo:{total:0}};let s=await R.api.folders[":folderId"].search.$post({param:{folderId:n},json:{assetType:"folder",after:e,recursively:!1,sort:A,conditions:[]}});if(!s.ok)throw Error("failed to search folders");return await s.json()},enabled:!E&&!o,initialPageParam:"",getNextPageParam:(e)=>e.pageInfo?.cursor||void 0}),{data:J,fetchNextPage:ye,hasNextPage:Se,isFetchingNextPage:Fe,isLoading:Ke}=Tt({queryKey:r?["projects",t,"recently-deleted","file"]:o?["projects",t,"recents","file"]:["search",i,n,"file",k,A,h],queryFn:async({pageParam:e})=>{if(r){let l=await R.api.projects[":projectId"]["recently-deleted"].$get({param:{projectId:t},query:{assetType:"file",after:e}});if(!l.ok)throw Error("failed to fetch recently deleted files");return await l.json()}if(o){let l=await R.api.projects[":projectId"].recents.$get({param:{projectId:t},query:{after:e,first:"20"}});if(!l.ok)throw Error("failed to fetch recent files");return await l.json()}let s=await R.api.folders[":folderId"].search.$post({param:{folderId:n},json:{assetType:"file",after:e,recursively:E||h,conditions:k,sort:A}});if(!s.ok)throw Error("failed to search files");return await s.json()},initialPageParam:"",getNextPageParam:(e)=>e.pageInfo?.cursor||void 0}),I=G?.pages.flatMap((e)=>e.data??[])??[],u=J?.pages.flatMap((e)=>e.data??[])??[],we=(!E&&!o?ze:!1)||Ke,xe=G?.pages[0]?.pageInfo?.total,Ie=J?.pages[0]?.pageInfo?.total,be=G?.pages[0]?.pageInfo?.totalSize,ve=J?.pages[0]?.pageInfo?.totalSize,Y=()=>{N(new Set),C(null),q(null)},{dragState:j,handleDragStart:Qe,handleDragEnd:Oe}=uu({teamId:i,projectId:t,assetId:n,folders:I,files:u,selectedIds:c,onClearSelection:Y}),Z=Q(()=>{if(c.size!==1)return null;let e=Array.from(c)[0];return u.find((l)=>l.id===e)||null},[c,u]),Pe=(e)=>{if(r)return;if(e.type==="folder")V([]),m({to:"/projects/$projectId/folders/$folderId",params:{projectId:t,folderId:e.id}});else m({to:"/projects/$projectId/files/$fileId",params:{projectId:t,fileId:e.versionStack?e.versionStack.id:e.id},search:{version:void 0}})},Ce=(e,s)=>{let l=s.metaKey||s.ctrlKey;if(s.shiftKey&&U){let se=[...I,...u].find((p)=>p.id===U);if(se){let p=Ne(se,e,U,I,u,c);if(p){N(p),C(e);return}}}if(l){let y=new Set(c);if(y.has(e.id)){if(y.delete(e.id),N(y),O?.id===e.id){let p=[...I,...u].find((Ue)=>y.has(Ue.id));C(p||null),q(p?p.id:null)}}else y.add(e.id),N(y),q(e.id),C(e);return}N(new Set([e.id])),q(e.id),C(e)},te=(e,s,l)=>{K({param:{fileId:e},json:[{key:s,value:l}]},{onSuccess:()=>{F.invalidateQueries({queryKey:["folders",n,"children",{assetType:"file"}]}),F.invalidateQueries({queryKey:["search",i,n]})}})};if(hs())return a(Au,{teamId:i,projectId:t,assetId:n,folders:I,files:u,totalFolders:xe,totalFiles:Ie,totalFoldersSize:be,totalFilesSize:ve,selectedItem:O,selectedIds:c,onItemSelect:Ce,onItemDoubleClick:Pe,onSaveField:te,onClearSelection:Y,fetchNextFoldersPage:pe,hasNextFoldersPage:me||!1,isFetchingNextFoldersPage:he,fetchNextFilesPage:ye,hasNextFilesPage:Se||!1,isFetchingNextFilesPage:Fe,isRecentlyDeleted:r,isRecents:o,isLoading:we,rootFolderId:d});return g(Eo,{modifiers:[al.configure({anchor:{x:0,y:0}})],plugins:(e)=>e.map((s)=>{if(s===oi)return oi.configure({dropAnimation:null});if(typeof s==="object"&&s!==null&&"plugin"in s&&s.plugin===oi)return oi.configure({dropAnimation:null});return s}),sensors:r||o||!v?[]:[Xn.configure({activationConstraints:[new an.Distance({value:10})]})],onDragStart:Qe,onDragEnd:Oe,children:[a("div",{className:"flex flex-1 flex-col bg-background min-h-0",children:g("div",{ref:Te,className:"flex flex-1 overflow-hidden relative",children:[!de&&a("div",{className:"md:hidden fixed inset-0 bg-black/50 z-40",onClick:()=>je(!0)}),(!fe||_)&&a("div",{className:"md:hidden fixed inset-0 bg-black/50 z-40",onClick:()=>{qe(!0),Ir.getState().setIsChatbotOpen(!1)}}),!de&&g(W,{children:[a("div",{className:"bg-background",style:{width:ke},children:a($r,{teamId:i,projectId:t,projectName:b,rootFolderId:d,dragState:j,ancestorFolders:D?.ancestorFolders??[]})}),a(Yr,{onResize:(e)=>{Me((s)=>Math.max(180,Math.min(400,s+e)))},className:"hidden md:block"})]}),a(Ea,{teamId:i,projectId:t,assetId:n,folders:I,files:u,totalFolders:xe,totalFiles:Ie,totalFoldersSize:be,totalFilesSize:ve,selectedItem:O,selectedIds:c,onItemSelect:Ce,onItemDoubleClick:Pe,onSaveField:te,displayStyle:ce,onClearSelection:Y,fetchNextFoldersPage:pe,hasNextFoldersPage:me||!1,isFetchingNextFoldersPage:he,fetchNextFilesPage:ye,hasNextFilesPage:Se||!1,isFetchingNextFilesPage:Fe,isRecentlyDeleted:r,isRecents:o,isLoading:we,filterConditions:k,onFilterChange:V,sort:A,onSortChange:$e,dragState:j,collection:f,onUpdateCollection:T,rootFolderId:d}),(!fe||_&&!ae)&&g(W,{children:[a(Yr,{onResize:(e)=>{Le((s)=>Math.max(240,Math.min(600,s-e)))},className:"hidden md:block"}),a("div",{style:{width:Ae},className:"bg-background flex flex-col flex-shrink-0",children:_&&!ae?a(ba,{projectId:t,contextAssetId:n}):Z?a(xa,{teamId:i,projectId:t,file:Z,onSaveField:(e,s)=>te(Z.id,e,s),members:Re,hideAnnotationControl:!0}):a("div",{className:"flex h-full items-center justify-center p-4 text-center text-sm text-muted-foreground",children:nR()})})]})]})}),a(Md,{children:j?.isActive?a("div",{className:B("flex items-center gap-2 rounded-md bg-popover px-3 py-2 text-sm font-medium text-popover-foreground shadow-md ring-1 ring-border cursor-grabbing",ce==="list"&&"w-30 h-[40px] px-0 flex-none overflow-hidden justify-center"),style:{transform:"translate(0px, 0px)"},children:g("span",{children:["Moving ",j.itemCount," item",j.itemCount!==1?"s":""]})}):null})]})}
2
- export{xo};
@@ -1 +0,0 @@
1
- import{a,Je}from"./chunk-5ngftxjb.js";import"./chunk-1tar0x8s.js";import"./chunk-34f64q0q.js";import"./chunk-qvp24w0q.js";import"./chunk-ajq9sxg0.js";import"./chunk-9405hzv2.js";import"./chunk-20w1w9x7.js";import"./chunk-thpw6tcj.js";import"./chunk-pq6kdp83.js";import"./chunk-6f3zhq64.js";import"./chunk-qm50g4n5.js";import"./chunk-q1fzgqsv.js";import"./chunk-d55138xx.js";import{wa}from"./chunk-9vxmgvc8.js";import"./chunk-c1wvs81k.js";import"./chunk-etrm28sy.js";import"./chunk-0a298n62.js";import"./chunk-s1j4v33x.js";import"./chunk-pdw77q09.js";import"./chunk-femnbfkj.js";import"./chunk-25npafhz.js";import"./chunk-7kah3zb5.js";function o(){let{shareId:e,folderId:r}=d.useParams();return a(wa,{shareId:e,initialFolderId:r})}var d=Je("/share/$shareId/folders/$folderId")({component:o});export{d as Route};
@@ -1 +0,0 @@
1
- import{S,L,a,X,ee,Je,R,Q_,Pt,Dg,Qy}from"./chunk-5ngftxjb.js";import"./chunk-ajq9sxg0.js";import"./chunk-1tar0x8s.js";import"./chunk-34f64q0q.js";import"./chunk-qvp24w0q.js";import"./chunk-9405hzv2.js";import"./chunk-qm50g4n5.js";import"./chunk-ffjdkdcv.js";import"./chunk-50pfmxt1.js";import"./chunk-20w1w9x7.js";import"./chunk-thpw6tcj.js";import"./chunk-pq6kdp83.js";import"./chunk-6f3zhq64.js";import"./chunk-d55138xx.js";import{xo}from"./chunk-cagzye3j.js";import"./chunk-sz5zawfw.js";import{Ar}from"./chunk-b3t7gbhm.js";import"./chunk-c1wvs81k.js";import"./chunk-etrm28sy.js";import"./chunk-0a298n62.js";import"./chunk-s1j4v33x.js";import"./chunk-pdw77q09.js";import"./chunk-femnbfkj.js";import"./chunk-25npafhz.js";import"./chunk-7kah3zb5.js";L();function f(){let{projectId:e,collectionId:n}=I.useParams(),{teamId:c,ensureTeamIdForProject:i}=Pt();S(()=>{i(e)},[e,i]);let{data:l}=Ar(Dg(e)),{data:r,refetch:d}=X({...Qy(n)}),{mutate:p}=ee({mutationFn:async(t)=>{let s=await R.api.collections[":collectionId"].$patch({param:{collectionId:n},json:t});if(!s.ok)throw Error("Failed to update collection");return await s.json()},onSuccess:()=>{d()}}),o=l?.rootFolder,{data:m}=X({queryKey:["folders",o],queryFn:async()=>{let t=await R.api.folders[":folderId"].$get({param:{folderId:o}});if(!t.ok)throw Error("Failed to fetch folder");return await t.json()},enabled:!!o});if(!c||!o||!m||!r)return a("div",{children:Q_()});let u=r.filter.sourceFolderId||o;return a(xo,{teamId:c,projectId:e,projectName:l.name??"",assetId:u,rootFolderId:o,collection:r,onUpdateCollection:p})}var I=Je("/projects/$projectId/collections/$collectionId")({component:f});export{I as Route};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{lc}from"./chunk-0rgbxp24.js";export default lc();
@@ -1 +0,0 @@
1
- import{S,M,w,L,W,a,g,ie,Rl,X,ee,We,Je,R,z,_r,K,qe,Re,Ge,B,F,$e,He,Qe,De,Ne,Fe,de,ev,tv,Qb,Ve,$w,iE,uE,Xm,Mt,UE,zE,KE,Px,oC,sC,ma,zS,TT,E1,I1,Tp,R1,M1,O1,P1,R0,D1,Ck,Di,Sd,Yc,rM,Xc,Id,Td,oM,kd,iM,ZM,IO,RO,PO,DO,_g,tu,dt,ft,pt,mt,ht,gt,At,_t,Se,xe,ke,ot,Ce,Ot,re,Xt,j,$y,fe,Ke,Lr}from"./chunk-5ngftxjb.js";import{wu}from"./chunk-20w1w9x7.js";import{mu}from"./chunk-y5dv67mg.js";import{cl}from"./chunk-gd016e9p.js";import{zo}from"./chunk-femnbfkj.js";import{$n}from"./chunk-25npafhz.js";import"./chunk-7kah3zb5.js";var Ie=[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M11 4h10",key:"1w87gc"}],["path",{d:"M11 8h7",key:"djye34"}],["path",{d:"M11 12h4",key:"q8tih4"}]],Z=z("arrow-down-wide-narrow",Ie);var _e=[["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M12 21v-9",key:"17s77i"}],["path",{d:"M12 8V3",key:"13r4qs"}],["path",{d:"M17 16h4",key:"h1uq16"}],["path",{d:"M19 12V3",key:"o1uvq1"}],["path",{d:"M19 21v-5",key:"qua636"}],["path",{d:"M3 14h4",key:"bcjad9"}],["path",{d:"M5 10V3",key:"cb8scm"}],["path",{d:"M5 21v-7",key:"1w1uti"}]],te=z("sliders-vertical",_e);L();function ae({open:o,onOpenChange:l,mode:c,teamId:f,project:i}){let p=ie(),m=We(),[s,h]=w(""),[I,b]=w(!0),[_,y]=w(void 0),[k,v]=w(void 0),[u,C]=w(!1),x=M(null);S(()=>{if(o)if(c==="edit"&&i)h(i.name||""),y(i.coverImageKey),v(i.coverImage),b(i.enableNotification!==!1);else h(""),y(void 0),v(void 0),b(!0)},[o,c,i]);let P=R.api.teams[":teamId"].projects.$post,{mutate:O}=ee({mutationFn:async(n)=>{let r=await P({param:{teamId:f},json:n});if(!r.ok)throw Error(Px());return await r.json()},onSuccess:(n)=>{p.invalidateQueries({queryKey:["teams",f,"projects"]}),l(!1);let r=n;if(r&&typeof r.id==="string")m({to:"/projects/$projectId",params:{projectId:r.id}})}}),A=R.api.projects[":projectId"].$put,{mutate:Q}=ee({mutationFn:async(n)=>{let r=await A({param:{projectId:i.id},json:n});if(!r.ok)throw Error(oC());return await r.json()},onSuccess:()=>{p.invalidateQueries({queryKey:["teams",f,"projects"]}),l(!1)}}),H=R.api.teams[":teamId"].files.$post,{mutate:E}=ee({mutationFn:async({file:n})=>{let r=await H({param:{teamId:f},form:{file:n}});if(!r.ok)throw Error(ma());return await r.json()},onSuccess:(n)=>{let r=n;if(r&&typeof r.key==="string")y(r.key);C(!1)},onError:()=>{C(!1)}}),d=(n)=>{let r=n.target.files?.[0];if(r){C(!0);let V=URL.createObjectURL(r);v(V),E({file:r})}},N=()=>{x.current?.click()},T=(n)=>{n.stopPropagation(),y(void 0),v(void 0)},D=()=>{if(!s.trim())return;if(c==="create")O({name:s.trim(),coverImageKey:_,enableNotification:I});else if(c==="edit"&&i?.id)Q({name:s.trim(),coverImageKey:_,enableNotification:I})};return a(Se,{open:o,onOpenChange:l,children:g(xe,{className:"sm:max-w-[550px] overflow-hidden rounded-2xl border border-border/60 bg-background/95 backdrop-blur-md shadow-2xl p-0 gap-0",children:[g(ke,{className:"relative overflow-hidden bg-gradient-to-br from-primary/5 to-transparent p-6 border-b border-border/40",children:[a("div",{className:"absolute top-0 right-0 w-24 h-24 bg-primary/10 rounded-full blur-2xl pointer-events-none"}),a("div",{className:"absolute bottom-0 left-10 w-32 h-12 bg-primary/5 rounded-full blur-xl pointer-events-none"}),a("div",{className:"flex items-center gap-3",children:g("div",{children:[a(Ce,{className:"text-xl font-semibold tracking-tight text-foreground",children:c==="create"?uE():R0()}),a(Ot,{className:"text-xs text-muted-foreground/80 mt-1",children:c==="create"?$w():zS()})]})})]}),g("div",{className:"space-y-6 p-6 max-h-[75vh] overflow-y-auto",children:[g("div",{className:"space-y-2",children:[a(fe,{htmlFor:"name",className:"text-sm font-semibold tracking-tight text-foreground",children:Tp()}),g("div",{className:"relative",children:[a(re,{id:"name",value:s,onChange:(n)=>h(n.target.value),placeholder:M1(),className:"h-11 px-4 rounded-xl border-border/80 focus-visible:ring-ring/25 focus-visible:border-primary transition-all shadow-xs pr-10"}),s.trim()&&a("div",{className:"absolute inset-y-0 right-3 flex items-center",children:a(qe,{className:"w-4 h-4 text-primary"})})]}),a("p",{className:"text-[11px] text-muted-foreground",children:R1()})]}),g("div",{className:"space-y-3 border-t border-border/40 pt-5",children:[g("div",{className:"flex items-center justify-between",children:[g(fe,{className:"text-sm font-semibold tracking-tight text-foreground flex items-center gap-1.5",children:[a($n,{className:"w-4 h-4 text-primary"}),I1()]}),k&&g("button",{type:"button",onClick:T,className:"text-xs text-muted-foreground hover:text-destructive hover:bg-destructive/5 px-2.5 py-1 rounded-lg transition-all flex items-center gap-1 font-medium",children:[a(Ge,{className:"w-3.5 h-3.5"}),Ck()]})]}),g("div",{className:"relative aspect-square w-48 mx-auto rounded-2xl border border-dashed border-border flex items-center justify-center cursor-pointer overflow-hidden group shadow-inner bg-muted/20 transition-all duration-300 hover:border-primary/50 hover:bg-muted/40",onClick:N,children:[a("input",{type:"file",ref:x,className:"hidden",accept:"image/*",onChange:d}),u&&a("div",{className:"absolute inset-0 bg-background/70 backdrop-blur-xs flex flex-col items-center justify-center gap-2 z-20",children:g("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-background border rounded-full shadow-lg",children:[a(K,{className:"w-4 h-4 animate-spin text-primary"}),a("span",{className:"text-xs font-semibold text-foreground",children:tu()})]})}),k?g(W,{children:[a("img",{src:k,alt:iE(),className:"w-full h-full object-cover transition-transform duration-500 group-hover:scale-105"}),g("div",{className:"absolute inset-0 bg-black/45 opacity-0 group-hover:opacity-100 transition-opacity duration-300 flex flex-col items-center justify-center gap-1.5 text-white z-10",children:[a(zo,{className:"w-5 h-5 transform translate-y-1 group-hover:translate-y-0 transition-transform duration-300"}),a("span",{className:"text-xs font-semibold",children:_g()})]})]}):g("div",{className:"flex flex-col items-center gap-2 text-center p-4",children:[a("div",{className:"p-2.5 rounded-full bg-background border shadow-xs group-hover:scale-110 transition-transform duration-300",children:a(zo,{className:"w-4 h-4 text-muted-foreground"})}),g("div",{children:[a("p",{className:"text-xs font-medium text-foreground",children:PO()}),a("p",{className:"text-[11px] text-muted-foreground mt-0.5 max-w-[140px] mx-auto leading-normal",children:DO()})]})]})]})]}),g("div",{className:"space-y-3 border-t border-border/40 pt-5",children:[g(fe,{className:"text-sm font-semibold tracking-tight text-foreground flex items-center gap-1.5",children:[a(te,{className:"w-4 h-4 text-primary"}),P1()]}),g("div",{className:"flex items-start justify-between rounded-xl border border-border/50 bg-muted/10 p-4 transition-all duration-300 hover:bg-muted/20",children:[g("div",{className:"space-y-1 pr-4",children:[g("div",{className:"text-sm font-semibold flex items-center gap-2 text-foreground",children:[a(cl,{className:"w-4 h-4 text-primary"}),ev()]}),a("p",{className:"text-xs text-muted-foreground leading-normal",children:tv()})]}),a(Ke,{checked:I,onCheckedChange:b,disabled:u,className:"mt-0.5"})]})]})]}),g(ot,{className:"flex items-center justify-end gap-3 px-6 py-4 bg-muted/20 border-t border-border/40",children:[a(F,{type:"button",variant:"ghost",onClick:()=>l(!1),disabled:u,className:"rounded-xl h-10 px-4 hover:bg-muted font-medium text-sm text-muted-foreground hover:text-foreground transition-colors",children:Ve()}),a(F,{type:"submit",onClick:D,disabled:!s.trim()||u,className:"rounded-xl h-10 px-5 bg-primary text-primary-foreground hover:bg-primary/90 font-semibold text-sm shadow-lg shadow-primary/10 hover:shadow-primary/20 active:scale-98 transition-all flex items-center gap-2",children:u?g(W,{children:[a(K,{className:"w-4 h-4 animate-spin"}),E1()]}):c==="create"?Xm():Di()})]})]})})}function se({sortBy:o,sortDirection:l,onSortChange:c}){let f=(s)=>{c(s,l)},i=()=>{c(o,l==="asc"?"desc":"asc")},p=(s)=>{switch(s){case"name":return Xc();case"created_at":return rM();case"updated_at":return oM();default:return s}},m=l==="asc";return g(De,{children:[a(Ne,{asChild:!0,children:g(F,{variant:"outline",className:"gap-2 bg-muted/50",children:[a("span",{className:"text-muted-foreground",children:iM()}),a("span",{className:"font-medium text-foreground",children:p(o)})]})}),g(Fe,{align:"end",className:"w-56 p-2",children:[a("div",{className:"text-xs font-semibold text-muted-foreground mb-2 px-2",children:Yc()}),g(De,{children:[a(Ne,{asChild:!0,children:g(F,{variant:"ghost",className:"w-full justify-between font-normal px-2 h-10 bg-muted/50 hover:bg-muted mb-2 border",children:[a("span",{children:p(o)}),a(Z,{className:"h-4 w-4 opacity-50"})]})}),a(Fe,{className:"w-52",children:["name","created_at","updated_at"].map((s)=>g(de,{onClick:()=>f(s),className:"justify-between",children:[p(s),o===s&&a(qe,{className:"h-4 w-4"})]},s))})]}),g(F,{variant:"ghost",className:"w-full justify-between font-normal px-2 h-10 bg-muted/50 hover:bg-muted border",onClick:i,children:[a("span",{className:"text-muted-foreground",children:o==="name"?m?a(W,{children:Sd()}):a(W,{children:kd()}):m?a(W,{children:Td()}):a(W,{children:Id()})}),m?a(mu,{className:"h-4 w-4 opacity-50"}):a(Z,{className:"h-4 w-4 opacity-50"})]})]})]})}L();function Me(){let{teamId:o}=Pe.useParams(),{canEdit:l,canAdmin:c}=Xt(),f=We(),i=ie(),[p,m]=w(null),[s,h]=w(!1),[I,b]=w("create"),[_,y]=w(void 0),[k,v]=w(!1),[u,C]=w(void 0),[x,P]=w(""),[O,A]=w(!1),{metadata:Q,setMetadata:H}=Lr(),E=`team:${o}:projects:sort`,d=Q[E],[N,T]=w(()=>d?.sortBy||"name"),[D,n]=w(()=>d?.sortDirection||"asc");S(()=>{if(d?.sortBy&&d.sortBy!==N)T(d.sortBy);if(d?.sortDirection&&d.sortDirection!==D)n(d.sortDirection)},[d]);let r=R.api.teams[":teamId"].projects.$get,{data:V}=X({queryKey:["teams",o,"projects",N,D],queryFn:async()=>{let e=await r({param:{teamId:o},query:{sortBy:N,sortDirection:D}});if(!e.ok)throw Error("Failed to fetch projects");return await e.json()},placeholderData:Rl}),{data:Y}=X({queryKey:["teams",o,"members"],queryFn:async()=>{let e=await R.api.teams[":teamId"].members.$get({param:{teamId:o},query:{}});if(!e.ok)throw Error("Failed to fetch members");return await e.json()}}),{data:G}=X({queryKey:["teams",o,"me"],queryFn:async()=>{let e=await R.api.teams[":teamId"].me.$get({param:{teamId:o}});if(!e.ok)throw Error("Failed to fetch me");return await e.json()}}),ne=R.api.teams[":teamId"].invite.$post,le=ee({mutationFn:async(e)=>{let t=await ne(e);if(!t.ok)throw Error("Failed to invite");return await t.json()}}),q=ee({mutationFn:async(e)=>{if(!(await R.api.projects[":projectId"].$delete({param:{projectId:e}})).ok)throw Error("Failed to delete project")},onSuccess:()=>{i.invalidateQueries({queryKey:["teams",o,"projects"]})}}),ce=ee({mutationFn:async(e)=>{let t=await R.api.projects[":projectId"].$put({param:{projectId:e.id},json:{enableNotification:!e.enableNotification}});if(!t.ok)throw Error("Failed to update project notification settings");return await t.json()},onSuccess:()=>{i.invalidateQueries({queryKey:["teams",o,"projects"]}),j.success(O1())},onError:(e)=>{j.error(e instanceof Error?e.message:sC())}}),J=()=>{b("create"),y(void 0),h(!0)},me=()=>{m("create"),setTimeout(()=>{m(null)},100),setTimeout(()=>{J()},200)},pe=(e)=>{b("edit"),y(e),h(!0)},ue=(e)=>{C(e),P(""),v(!0)},ge=async()=>{if(u&&x==="delete")try{await q.mutateAsync(u.id),v(!1)}catch(e){console.error(e)}},ve=(e,t)=>{if(t.detail>1)return;m(e),setTimeout(()=>{m(null)},100),setTimeout(()=>{f({to:"/projects/$projectId",params:{projectId:e}})},200)},he=async(e)=>(await le.mutateAsync({param:{teamId:o},json:{role:e}})).code,ye=ee({mutationFn:async({userId:e,role:t})=>{if(!(await R.api.teams[":teamId"].members[":userId"].$patch({param:{teamId:o,userId:e},json:{role:t}})).ok)throw Error("Failed to update member role")},onSuccess:()=>{i.invalidateQueries({queryKey:["teams",o,"members"]})}}),be=ee({mutationFn:async(e)=>{if(!(await R.api.teams[":teamId"].members[":userId"].$delete({param:{teamId:o,userId:e}})).ok)throw Error("Failed to remove member")},onSuccess:()=>{i.invalidateQueries({queryKey:["teams",o,"members"]})}}),we=(e)=>{if(!e)return"??";return e.split(" ").map((t)=>t[0]).slice(0,2).join("").toUpperCase()},je=(e,t)=>{T(e),n(t),H(o,E,{sortBy:e,sortDirection:t})},U=Array.isArray(Y)?Y:[];return g("div",{className:"flex-1 overflow-y-auto p-4",children:[g("div",{className:"flex flex-wrap items-center justify-between mb-4 gap-4",children:[a("h1",{className:"text-2xl font-bold",children:D1()}),g("div",{className:"flex flex-wrap items-center gap-4",children:[g("div",{className:"flex items-center -space-x-2 cursor-pointer hover:opacity-90",onClick:()=>A(!0),"data-testid":"team-members-trigger",children:[U.slice(0,3).map((e)=>g($e,{className:"border-2 border-background w-8 h-8",children:[e.image&&a(He,{src:e.image,alt:e.name,className:"object-cover"}),a(Qe,{className:"text-[10px]",children:we(e.name)})]},e.id)),U.length>3&&g("div",{className:"flex items-center justify-center w-8 h-8 rounded-full border-2 border-background bg-muted text-[10px] font-medium",children:["+",U.length-3]})]}),a(se,{sortBy:N,sortDirection:D,onSortChange:je}),l&&g(F,{className:"bg-orange-600 hover:bg-orange-700 text-white gap-2",onClick:J,children:[a(Re,{className:"w-4 h-4"}),Xm()]})]})]}),g("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-6 gap-4",children:[V?.data?.map((e)=>a("div",{className:B("shadow-md relative border rounded-xl overflow-hidden cursor-pointer transition-transform duration-100 ease-in-out",p===e.id?"scale-95":"scale-100"),onClick:(t)=>ve(e.id,t),children:g("div",{className:"flex flex-col",children:[g("div",{className:"relative w-full h-full aspect-square flex items-center justify-center bg-zinc-400/20",children:[e.coverImage?a("img",{src:e.coverImage,alt:e.name,className:"w-full h-full object-cover rounded"}):g("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 180.95 164.7",preserveAspectRatio:"xMidYMid slice",className:"w-full h-full object-cover rounded",children:[a("polygon",{fill:"#FC9F8E",points:"0 18.5 0 76.0 151.69 164.7 180.95 164.7 180.95 113.6"}),a("polygon",{fill:"#FEBAB8",points:"0 0 74.58 61.5 90.53 51.6 110.33 63.9 180.95 18.9 180.95 0"}),a("polyline",{fill:"#FAA5A5",points:"0 18.5 74.58 61.5 90.53 51.6 110.33 63.9 180.95 18.9 180.95 0 0 0"}),a("polygon",{fill:"#EC5B6C",points:"0 76.0 0 164.7 151.69 164.7"}),a("polygon",{fill:"#E85C71",points:"180.95 18.9 110.33 63.9 117.37 68.0 117.26 73.4 180.95 113.6"}),a("polygon",{fill:"#C8405B",points:"117.26 73.4 117.37 99.0 90.53 114.9 174.35 164.7 180.95 164.7 180.95 113.6"}),a("polygon",{fill:"#FFCCBE",points:"90.53 51.6 63.69 68.1 90.53 83.4"}),a("path",{fill:"#FB9991",d:"M 90.53 51.6 L 90.53 61.3 L 100.87 67.4 L 90.53 73.5 L 90.53 83.4 L 117.37 68.0 C 117.15 67.6 90.53 51.6 90.53 51.6 Z"}),a("path",{fill:"#FFEACD",d:"M 63.69 68.1 C 63.47 68.5 64.02 99.3 64.02 99.3 C 64.02 99.3 64.46 99.6 64.9 99.9 L 90.53 83.4 L 63.69 68.1 Z"}),a("polygon",{fill:"#FFCFB5",points:"64.02 99.3 90.53 114.9 90.53 83.4"}),a("path",{fill:"#F67D73",d:"M 90.53 83.4 L 90.53 114.9 L 117.37 99.0 Z"}),a("path",{fill:"#F26560",d:"M 90.53 83.4 L 117.37 99.0 L 117.37 68.0 Z"}),a("polygon",{fill:"#EB5F5B",points:"80.08 67.5 90.53 73.5 90.53 61.3"}),a("polygon",{fill:"#DB4D50",points:"90.53 61.3 90.53 73.5 100.87 67.4"})]}),a("div",{className:"absolute bottom-0 left-0 w-full h-[65%] bg-linear-to-t from-black/35 to-black/0"}),a("p",{className:"absolute left-1 bottom-2 text-white",children:e.name})]}),g("div",{className:"px-2 h-10 flex justify-between items-center",children:[g("p",{className:"truncate pr-1 text-xs text-muted-foreground",children:[RO()," ",$y(e.updatedAt??"")]}),a("div",{onClick:(t)=>t.stopPropagation(),children:g(De,{modal:!1,children:[a(Ne,{asChild:!0,children:a("button",{className:"hover:bg-muted outline-none flex px-1",children:a(_r,{className:"w-5 h-5 text-muted-foreground"})})}),g(Fe,{align:"end",children:[l&&a(de,{onClick:(t)=>{t.stopPropagation(),pe(e)},children:R0()}),g(de,{className:"flex items-center justify-between gap-4 cursor-pointer",onSelect:(t)=>{t.preventDefault(),ce.mutate(e)},children:[a("span",{children:TT()}),a(Ke,{checked:e.enableNotification??!0,className:"pointer-events-none"})]}),c&&a(de,{className:"text-destructive focus:text-destructive",onClick:()=>ue(e),children:Mt()})]})]})})]})]})},e.id)),l&&a("div",{className:B("shadow-md relative border rounded-xl overflow-hidden cursor-pointer transition-transform duration-100 ease-in-out border-dashed hover:border-orange-600/50 group",p==="create"?"scale-95":"scale-100"),onClick:me,children:g("div",{className:"flex flex-col",children:[a("div",{className:"relative w-full aspect-square flex items-center justify-center bg-zinc-400/5 group-hover:bg-orange-600/5 transition-colors",children:a(Re,{className:"w-8 h-8 text-zinc-400 group-hover:text-orange-600 transition-colors"})}),a("div",{className:"px-2 h-10 flex items-center justify-center bg-zinc-400/10 border-t group-hover:bg-orange-600/10 transition-colors",children:a("p",{className:"text-sm text-muted-foreground group-hover:text-orange-600 transition-colors",children:Xm()})})]})})]}),a(ae,{open:s,onOpenChange:h,mode:I,teamId:o,project:_}),a(dt,{open:k,onOpenChange:v,children:g(ft,{children:[g(pt,{children:[a(ht,{children:Qb()}),g(gt,{children:[zE({name:u?.name??""}),g("div",{className:"mt-4 flex flex-col gap-2 text-foreground",children:[a("span",{className:"text-sm font-medium",children:IO()}),a(re,{value:x,onChange:(e)=>P(e.target.value),placeholder:UE(),className:"h-9",autoFocus:!0})]})]})]}),g(mt,{children:[a(_t,{disabled:q.isPending,children:Ve()}),a(At,{onClick:(e)=>{e.preventDefault(),ge()},disabled:x!=="delete"||q.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:q.isPending?KE():Mt()})]})]})}),a(wu,{open:O,onOpenChange:A,title:ZM(),type:"team",members:U,isOwner:G?.role==="owner",onInvite:he,onUpdateRole:async(e,t)=>{await ye.mutateAsync({userId:e,role:t})},onRemoveMember:async(e)=>{await be.mutateAsync(e)},currentUserId:G?.id})]})}var Pe=Je("/teams/$teamId/")({component:Me});export{Pe as Route};
@@ -1 +0,0 @@
1
- import{a,Je}from"./chunk-5ngftxjb.js";import"./chunk-1tar0x8s.js";import"./chunk-34f64q0q.js";import"./chunk-qvp24w0q.js";import"./chunk-ajq9sxg0.js";import"./chunk-9405hzv2.js";import"./chunk-20w1w9x7.js";import"./chunk-thpw6tcj.js";import"./chunk-pq6kdp83.js";import"./chunk-6f3zhq64.js";import"./chunk-qm50g4n5.js";import"./chunk-q1fzgqsv.js";import"./chunk-d55138xx.js";import{wa}from"./chunk-9vxmgvc8.js";import"./chunk-c1wvs81k.js";import"./chunk-etrm28sy.js";import"./chunk-0a298n62.js";import"./chunk-s1j4v33x.js";import"./chunk-pdw77q09.js";import"./chunk-femnbfkj.js";import"./chunk-25npafhz.js";import"./chunk-7kah3zb5.js";function n(){let{shareId:r,fileId:i}=e.useParams(),{start:t,version:o,compare:c,cmpLeft:m,cmpRight:s,cmpActive:p}=e.useSearch();return a(wa,{shareId:r,initialFileId:i,startTime:t,versionId:o,compare:c,compareLeftId:m,compareRightId:s,compareActiveSide:p})}var e=Je("/share/$shareId/files/$fileId")({component:n});export{e as Route};
@@ -1,2 +0,0 @@
1
- import{G,S,M,w,L,W,a,g,ie,X,R,z,K,ao,$t,Be,Bt,Er,xr,Re,Ue,Ge,B,Vb,Kb,ew,_w,Wm,r_,Ww,AE,qE,$E,Dr,j_,gh,bh,l0,iT,fT,NT,w0,Yh,Zp,ZR,XM,pg,mg,SO,Yn,hg,Ie,Pt,ln,on,ga,Xe,et,tt,rt,be,ts,Fi,lr,Ir}from"./chunk-5ngftxjb.js";import{ro}from"./chunk-9405hzv2.js";import{Vd,Bi}from"./chunk-qm50g4n5.js";import{rs}from"./chunk-sz5zawfw.js";var Ce=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],ae=z("brain",Ce);L();function ba({projectId:m,contextAssetId:k,file:f,currentTime:ne,frameRate:C,startTimecode:V,formatTimestamp:I,onTyping:le,onSelectMessage:J,selectedMessageId:de}){let{isHistoryMode:p,setIsHistoryMode:A,currentSessionId:me,chatAssets:ce,removeAsset:ue,messages:h,historySessions:U,isStreaming:_,fetchHistorySessions:Z,loadSession:pe,deleteSession:fe,startNewSession:Y,sendMessage:ge,abortActiveSession:xe,selectedAgentId:T,setSelectedAgentId:j,inputText:he,setInputText:ve}=Ir(),{teamId:c,ensureTeamIdForProject:ee}=Pt(),{videoTimeDisplayMode:ye}=lr(),[q,D]=w(null);S(()=>{if(m)ee(m)},[m,ee]);let{data:we=[],isSuccess:te}=X({queryKey:["chat-agents",m],queryFn:async()=>{if(!m)return[];let e=await R.api.projects[":projectId"]["chat-agents"].$get({param:{projectId:m}});if(!e.ok)throw Error("failed to fetch agents");return e.json()},enabled:!!m}),N=we.filter((e)=>e.type==="chat"&&e.enabled);S(()=>{if(!te)return;if(N.length>0){if(!N.some((t)=>t.id===T))j(N[0].id)}else if(T!==null)j(null)},[te,N,T,j]);let re=M(null),E=M(null),F=M(!0),H=M(!0);S(()=>{H.current=!0,F.current=!0},[m,k,p]),S(()=>{let e=E.current?.querySelector('[data-slot="scroll-area-viewport"]');if(!e)return;let{scrollTop:t,isAtBottom:i}=Ir.getState(),r=setTimeout(()=>{if(i)e.scrollTop=e.scrollHeight;else e.scrollTop=t;let d=setTimeout(()=>{H.current=!1},50);return()=>clearTimeout(d)},0);return()=>clearTimeout(r)},[m,k,p]),S(()=>{let e=E.current?.querySelector('[data-slot="scroll-area-viewport"]');if(!e)return;let t=()=>{if(H.current)return;let i=e.scrollTop,r=e.scrollHeight-i-e.clientHeight<10;Ir.getState().setScrollState(i,r)};return e.addEventListener("scroll",t),()=>{e.removeEventListener("scroll",t)}},[m,k,p]);let{ref:ke,isDropTarget:Ne}=ln({id:"chatbot-sidebar",data:{type:"chatbot-sidebar"}});S(()=>{if(!p){let{isAtBottom:e}=Ir.getState();if(e||_){let t=F.current?"auto":"smooth";re.current?.scrollIntoView({behavior:t})}F.current=!1}},[h,_,p]),S(()=>{if(p&&c)Z(c)},[p,Z,c]);let v=ie(),_e=G(()=>{v.invalidateQueries({queryKey:["search"]}),v.invalidateQueries({queryKey:["folders"]}),v.invalidateQueries({queryKey:["files"]}),v.invalidateQueries({queryKey:["file"]}),v.invalidateQueries({queryKey:["version_stacks"]}),v.invalidateQueries({queryKey:["projects"]})},[v]),O=(e)=>{if(typeof e==="string")return e;if(Array.isArray(e))return e.map((t)=>{if(typeof t==="string")return t;if(t&&typeof t==="object"&&"type"in t&&t.type==="text"&&"text"in t)return String(t.text);return""}).join("");return""},oe=(e)=>e.replace(/<@([a-zA-Z0-9_-]+)>/g,"@$1").replace(/^\[([^\]]+)\]:/gm,"\\[$1\\]:"),Se=(e)=>{switch(e.role){case"user":case"custom":{let t=e;if(e.role==="custom"&&t.customType==="context_display_info"){let d=t.details?.assets||[];if(d.length===0)return null;return g("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:[a("div",{className:"font-semibold",children:Kb()}),a("ul",{className:"list-disc list-inside space-y-0.5",children:d.map((s)=>g("li",{className:"truncate",children:[s.name," ",g("span",{className:"text-muted-foreground/70",children:["(",s.type,")"]})]},s.id))})]},e.id)}if(e.role==="user"||t.customType==="shumai_message"){let r=t.details,d=r?.referencedAssets||[],s=r?.attachedFiles||[],n=r?.position,u=r?.annotation||r?.annotations&&r.annotations.length>0,l=!r?.currentAsset?.id||k&&r.currentAsset.id===k||f?.id&&r.currentAsset.id===f.id,x=de===e.id,y="";if(n?.type==="time")if(I)y=I(n.seconds);else if(C){let o=Math.round(n.seconds*C);y=ro(o,C,ye,V)}else{let o=Math.floor(n.seconds/60),b=Math.floor(n.seconds%60);y=`${o.toString().padStart(2,"0")}:${b.toString().padStart(2,"0")}`}else if(n?.type==="page")y=w0({page:n.page});let se=O(t.content),Te=s.length>0||d.length>0;return a("div",{onClick:()=>{if(l&&J)J(e)},className:B("flex flex-col items-end w-full group transition-all duration-150",l&&(u||n)&&"cursor-pointer"),children:g("div",{className:B("bg-primary text-primary-foreground rounded-lg px-3 py-2 text-sm whitespace-pre-wrap shadow-xs break-words transition-all border",Te?"w-full":"max-w-[85%]",x?"border-blue-500 dark:border-blue-400":"border-transparent"),children:[g("div",{className:"text-sm leading-relaxed whitespace-pre-wrap break-words",children:[u&&a("span",{className:"inline-flex items-center align-middle mr-1.5 p-0.5 rounded bg-primary-foreground/20 text-primary-foreground",title:Ww(),children:a(ga,{className:"w-3.5 h-3.5"})}),n&&a("span",{className:"inline-flex items-center align-middle mr-1.5 px-1.5 py-0.5 rounded text-xs font-mono font-bold bg-primary-foreground/20 text-primary-foreground",children:y}),se&&a("span",{children:se})]}),s.length>0&&g("div",{className:"mt-2.5 w-full",children:[a("div",{className:"text-xs font-medium text-primary-foreground/70 mb-1",children:ew()}),a("div",{className:"flex flex-col gap-1.5 w-full",children:s.map((o)=>{let b=o.name||"file",P=Fi(b)||o.mediaType==="image"||o.mimeType?.startsWith("image/");return g("div",{className:B("group/att relative flex items-center w-full max-w-full rounded-lg border border-primary-foreground/15 bg-primary-foreground/10 hover:bg-primary-foreground/15 transition-colors overflow-hidden",P?"h-18 p-1.5 gap-2.5 cursor-pointer":"h-9 px-2.5 gap-2.5"),onClick:(Q)=>{if(Q.stopPropagation(),o.url)if(P)D({url:o.url,name:b});else window.open(o.url,"_blank","noreferrer")},children:[P&&o.url?a("div",{className:"h-full aspect-square rounded-md overflow-hidden bg-black/20 shrink-0",children:a("img",{src:o.url,alt:b,className:"w-full h-full object-cover group-hover/att:scale-105 transition-transform duration-200"})}):a(Er,{className:"w-4 h-4 text-primary-foreground/70 shrink-0"}),a("div",{className:"min-w-0 flex-1 overflow-hidden",children:a("p",{className:"text-xs font-medium text-primary-foreground truncate block w-full",title:b,children:b})}),o.url&&a("a",{href:o.url,target:"_blank",rel:"noreferrer",download:b,className:"p-1 text-primary-foreground/70 hover:text-primary-foreground shrink-0 rounded-md hover:bg-primary-foreground/20 transition-colors opacity-0 group-hover/att:opacity-100",onClick:(Q)=>Q.stopPropagation(),title:Dr(),children:a(Bt,{className:"w-3.5 h-3.5"})})]},o.id)})})]}),d.length>0&&g("div",{className:"mt-2.5 w-full",children:[a("div",{className:"text-xs font-medium text-primary-foreground/70 mb-1",children:Vb()}),a("div",{className:"flex flex-col gap-1.5 w-full",children:d.map((o)=>g("div",{className:"flex items-center justify-between w-full h-9 px-2.5 rounded-lg border border-primary-foreground/15 bg-primary-foreground/10 hover:bg-primary-foreground/15 transition-colors overflow-hidden",children:[g("div",{className:"flex items-center gap-2.5 min-w-0 flex-1",children:[o.type==="folder"?a(xr,{className:"w-4 h-4 text-primary-foreground/70 shrink-0"}):a(Er,{className:"w-4 h-4 text-primary-foreground/70 shrink-0"}),a("span",{className:"text-xs font-medium truncate text-primary-foreground",title:o.name,children:o.name})]}),a("span",{className:"text-[10px] text-primary-foreground/60 uppercase shrink-0 font-mono ml-2",children:o.type})]},o.id))})]})]})},e.id)}let i=t.content||"";return a("div",{className:"text-center text-xs text-muted-foreground italic bg-muted/20 py-1.5 rounded",children:O(i)},e.id)}case"assistant":{let i=e.content;if(!i)return null;let r=[];if(i.forEach((s,n)=>{if(!s||typeof s!=="object")return;let u=s;switch(u.type){case"text":{let l=u.text;if(typeof l!=="string"||!l.trim())return;r.push(a("div",{className:"text-sm leading-[1.8] prose prose-sm dark:prose-invert max-w-none break-words",children:a(ts,{components:{pre:({node:x,...y})=>a("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",...y})},children:oe(l)})},`txt-${n}`));break}case"thinking":{let l=u.thinking;if(typeof l!=="string"||!l.trim())return;r.push(g("details",{className:"group border border-border/50 rounded-lg bg-muted/20 my-2 overflow-hidden",children:[g("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:[a(ae,{className:"h-3.5 w-3.5 text-primary/70 animate-pulse"}),a("span",{children:Yh()||"Thinking"}),a(Be,{className:"h-3 w-3 ml-auto transition-transform group-open:rotate-180"})]}),a("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:a(ts,{children:oe(l)})})]},`think-${n}`));break}case"toolCall":{let l=String(u.name||u.toolName||Yn()),x=u.arguments||u.args;r.push(g("details",{className:"group border border-border/50 rounded-lg bg-violet-500/5 my-2 overflow-hidden",children:[g("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:[a(rs,{className:"h-3.5 w-3.5"}),a("span",{children:Wm()}),a("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:l}),a(Be,{className:"h-3 w-3 ml-auto transition-transform group-open:rotate-180"})]}),!!x&&g("div",{className:"p-3 pt-0 text-[10px] text-muted-foreground/90 border-t border-border/40 bg-violet-500/5 font-sans",children:[a("div",{className:"text-[9px] text-muted-foreground/60 uppercase font-bold tracking-wider mb-1.5",children:pg()||"Arguments"}),a("pre",{className:"font-mono bg-muted/30 p-2 rounded border border-border/30 overflow-x-auto max-h-32",children:JSON.stringify(x,null,2)})]})]},`tool-${n}`));break}case"image":{let l=String(u.mimeType||"image/png"),x=String(u.data||"");r.push(a("div",{className:"my-2 max-w-full",children:x?a("img",{src:x.startsWith("data:")?x:`data:${l};base64,${x}`,alt:"Attached asset",className:"max-h-60 rounded border border-border/50 object-contain shadow-xs"}):a("div",{className:"text-xs text-muted-foreground italic flex items-center gap-1.5 py-1",children:gh()})},`img-${n}`));break}default:{let l=JSON.stringify(s,null,2);if(l==="{}")return;r.push(a("pre",{className:"text-xs text-foreground/80 font-mono whitespace-pre-wrap break-words bg-muted/20 p-2 rounded",children:l},`other-${n}`))}}}),r.length===0)return null;let d=!1;if(i.length>0){let s=i[i.length-1];if(typeof s==="string"&&s.trim().length>0)d=!0;else if(s&&typeof s==="object"){let n=s;if(n.type==="text"&&typeof n.text==="string"&&n.text.trim().length>0)d=!0}}return g("div",{className:"flex flex-col w-full space-y-1",children:[a("div",{className:"space-y-2 w-full",children:r}),d&&a("div",{className:"text-[10px] text-muted-foreground self-start italic pt-1",children:AE()})]},e.id)}case"toolResult":return a("div",{className:"flex items-center gap-2 text-xs text-muted-foreground bg-muted/40 p-2 rounded-md border border-border/50",children:a("span",{className:"font-semibold",children:mg({name:e.toolName||"tool"})})},e.id);case"thinking_level_change":{let i=e.content||"";return a("div",{className:"text-center text-xs text-muted-foreground italic bg-muted/20 py-1.5 rounded",children:O(i)},e.id)}default:return null}};return g("div",{ref:ke,className:B("relative flex flex-col h-full bg-background transition-colors duration-200 min-h-0"),children:[Ne&&a("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:g("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:[a($t,{className:"h-6 w-6 text-primary animate-bounce"}),a("span",{className:"text-sm font-semibold text-foreground",children:r_()})]})}),g("div",{className:"h-12 border-b border-border flex items-center justify-between px-4 flex-shrink-0 bg-background/50 backdrop-blur-sm",children:[g("div",{className:"flex items-center gap-2",children:[p&&a("button",{onClick:()=>A(!1),className:"p-1 rounded-md hover:bg-muted text-muted-foreground hover:text-foreground transition-colors cursor-pointer",title:_w(),children:a(Vd,{className:"h-4 w-4"})}),a($t,{className:"h-5 w-5 text-primary"}),a("span",{className:"font-semibold text-sm",children:p?j_():ZR()})]}),a("div",{className:"flex items-center gap-1",children:!p?g(W,{children:[a("button",{onClick:Y,className:"p-1.5 rounded-md hover:bg-muted text-muted-foreground hover:text-foreground transition-colors cursor-pointer",title:l0(),children:a(Re,{className:"h-4 w-4"})}),a("button",{onClick:()=>A(!0),className:"p-1.5 rounded-md hover:bg-muted text-muted-foreground hover:text-foreground transition-colors cursor-pointer",title:j_(),children:a(ao,{className:"h-4 w-4"})})]}):g("button",{onClick:()=>{Y(),A(!1)},className:"flex items-center gap-1 text-xs bg-primary text-primary-foreground px-2.5 py-1 rounded-md hover:bg-primary/90 transition-colors shadow-xs cursor-pointer",children:[a(Re,{className:"h-3.5 w-3.5"}),a("span",{children:l0()})]})})]}),p?a(Ie,{className:"flex-1 p-3",children:U.length===0?a("div",{className:"text-center text-xs text-muted-foreground py-8",children:fT()}):a("div",{className:"space-y-1",children:U.map((e)=>{let t=e.id===me;return g("div",{onClick:()=>{if(c)pe(c,e.id),A(!1)},className:B("group flex items-center justify-between p-2.5 rounded-lg text-xs cursor-pointer transition-all border border-transparent",t?"bg-accent/80 text-accent-foreground font-medium border-border/40":"hover:bg-muted/60 text-muted-foreground hover:text-foreground"),children:[g("div",{className:"flex flex-col min-w-0 pr-2",children:[a("span",{className:"truncate text-foreground font-medium text-xs",children:e.name||hg()}),a("span",{className:"text-[10px] text-muted-foreground",children:on(e.updatedAt)})]}),a("button",{onClick:(i)=>{if(i.stopPropagation(),c&&window.confirm($E()))fe(c,e.id)},className:"opacity-0 group-hover:opacity-100 focus:opacity-100 transition-opacity text-muted-foreground hover:text-destructive p-1 rounded hover:bg-muted cursor-pointer",title:qE(),children:a(Ue,{className:"h-4 w-4"})})]},e.id)})})}):g(W,{children:[a(Ie,{ref:E,className:"flex-1 p-4 min-h-0 [&>div>div]:!block",children:h.length===0?g("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:[a($t,{className:"h-8 w-8 mb-2 opacity-50 text-muted-foreground"}),a("p",{className:"text-sm",children:r_()})]}):g("div",{className:"space-y-4 pb-4",children:[h.map(Se),_&&h.length>0&&(h[h.length-1].role==="user"||h[h.length-1].customType==="shumai_message")&&g("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground italic",children:[a(K,{className:"h-3 w-3 animate-spin text-primary"}),a("span",{children:XM()})]}),a("div",{ref:re})]})}),a("div",{className:"p-2 flex-shrink-0 bg-background",children:a(Bi,{projectId:m,value:he,onChangeText:ve,placeholder:SO(),disabled:!T||!c,isStreaming:_,onAbort:()=>{if(c)xe(c)},allowMentions:!1,allowAttachments:!0,workspaceAssets:ce,onRemoveWorkspaceAsset:ue,allowMarkup:!0,canMarkup:!!f&&["image","video","pdf"].includes(f.proxyType||""),markupDisabledTooltip:!f?NT():bh(),allowTimestamp:f?.proxyType==="video"||f?.proxyType==="pdf",currentTime:ne,frameRate:C||f?.media?.metadata?.frameRate||30,startTimecode:V||f?.media?.metadata?.startTimecode,formatTimestamp:I||(f?.proxyType==="pdf"?(e)=>w0({page:Math.round(e)}):void 0),onTyping:le,onSendMessage:(e,t,i,r,d,s)=>{if(!c)return;ge(c,e,m,k,_e,t,i,d,s)},bottomLeftExtra:a("div",{className:"flex items-center gap-1.5 min-w-0 max-w-full",children:N.length>0?g(Xe,{value:T||"",onValueChange:(e)=>j(e),disabled:_,children:[a(tt,{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 cursor-pointer",children:a(et,{placeholder:Zp()})}),a(rt,{children:N.map((e)=>a(be,{value:e.id,className:"cursor-pointer",children:g("div",{className:"flex items-center gap-2",children:[e.avatar?a("img",{src:e.avatar,alt:e.name,className:"w-4 h-4 rounded-full object-cover"}):a($t,{className:"w-4 h-4 text-muted-foreground"}),a("span",{className:"text-xs",children:e.name})]})},e.id))})]}):a("div",{className:"flex items-center gap-1.5 px-2 py-1 text-[11px] text-muted-foreground/60 italic select-none",children:a("span",{children:iT()})})})})})]}),q&&g("div",{className:"fixed inset-0 z-[100] bg-black/95 flex flex-col items-center justify-center p-4 animate-in fade-in duration-200",onClick:()=>D(null),children:[a("button",{className:"absolute top-4 right-4 text-white/70 hover:text-white hover:bg-white/20 rounded-full p-2 transition-colors z-50 cursor-pointer",children:a(Ge,{className:"w-8 h-8"})}),a("div",{className:"w-full h-full flex items-center justify-center p-2",children:a("img",{src:q.url,alt:q.name,className:"max-w-full max-h-[85vh] object-contain rounded shadow-2xl cursor-zoom-out",onClick:(e)=>{e.stopPropagation(),D(null)}})}),a("div",{className:"absolute bottom-6 text-white text-sm font-medium bg-black/50 px-4 py-2 rounded-full backdrop-blur-sm",children:q.name})]})]})}
2
- export{ba};
@@ -1,2 +0,0 @@
1
- import{z}from"./chunk-5ngftxjb.js";var e=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],cl=z("bell",e);
2
- export{cl};
@@ -1 +0,0 @@
1
- import{S,M,w,L,W,a,g,ie,Rl,X,ee,We,Jn,Je,R,K,Er,B,F,Ve,Mt,bd,wd,VE,pp,Ll,Wx,N_,ms,Rk,wo,dt,ft,pt,mt,ht,gt,At,_t,Se,xe,ke,ot,Ce,re,Pt,Vt,j,Bn,An,lr,Ir,Lr,hs,Te,sm}from"./chunk-5ngftxjb.js";import"./chunk-34f64q0q.js";import"./chunk-qvp24w0q.js";import{un}from"./chunk-9405hzv2.js";import"./chunk-qm50g4n5.js";import{ba}from"./chunk-ffjdkdcv.js";import{Ps,_u,Ns,ci}from"./chunk-ajq9sxg0.js";import{hu,gu}from"./chunk-q1fzgqsv.js";import"./chunk-pq6kdp83.js";import{xa}from"./chunk-6f3zhq64.js";import{Yr}from"./chunk-d55138xx.js";import"./chunk-sz5zawfw.js";import"./chunk-c1wvs81k.js";import"./chunk-etrm28sy.js";import"./chunk-s1j4v33x.js";import"./chunk-pdw77q09.js";import"./chunk-25npafhz.js";import"./chunk-7kah3zb5.js";L();var xt=({item:t})=>{if(t.preview?.thumbnailUrl)return a("img",{src:t.preview.thumbnailUrl,alt:"Preview",className:"w-full h-full object-cover"});if(t.preview?.proxyType==="audio"||t.proxyType==="audio")return a("div",{className:"w-full h-full flex items-center justify-center bg-muted",children:a(Ps,{className:"w-5 h-5 text-muted-foreground"})});return a("div",{className:"w-full h-full flex items-center justify-center bg-muted",children:a(Er,{className:"w-5 h-5 text-muted-foreground"})})},Me=({projectId:t,currentAssetId:n,parentFolderId:v,initialFiles:f,initialNextCursor:b,isLoading:s=!1})=>{let{ref:N,inView:C}=Vt({threshold:0,rootMargin:"200px"}),D=M(null),i=M(!0),[d,p]=w(f),[E,z]=w(b),[O,H]=w(!!b),[u,G]=w(!1);return S(()=>{p(f),z(b),H(!!b),i.current=!0},[f,b]),S(()=>{(async()=>{if(!E||u||!C||!O)return;G(!0);try{let m=await R.api.folders[":folderId"].search.$post({param:{folderId:v},json:{assetType:"file",after:E,first:200,recursively:!1,conditions:[]}});if(!m.ok)throw Error("Failed to fetch next page");let V=await m.json(),P=V.data||[];p((J)=>[...J,...P]),z(V.pageInfo?.cursor||void 0),H(!!V.pageInfo?.cursor&&P.length>0)}catch(m){console.error("Error fetching next page:",m)}finally{G(!1)}})()},[C,E,O,u,v]),S(()=>{if(d.some((m)=>m?.id===n)&&D.current)if(i.current)D.current.scrollIntoView({block:"center",inline:"center",behavior:"auto"}),i.current=!1;else D.current.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})},[d,n]),a("div",{className:"h-24 md:h-full w-full md:w-24 bg-gray-100 dark:bg-gray-950 flex flex-row md:flex-col flex-shrink-0 select-none",children:g("div",{className:"flex-1 overflow-x-auto overflow-y-hidden md:overflow-y-auto md:overflow-x-hidden px-4 md:px-0 py-2 md:py-4 flex flex-row md:flex-col items-center gap-3 no-scrollbar",children:[s&&d.length===0?Array.from({length:6}).map((c,m)=>a(Te,{className:"w-[52px] h-[52px] rounded-lg shrink-0","data-testid":"carousel-skeleton-item"},m)):d.map((c)=>{if(!c)return null;let m=c.id===n;return a("div",{ref:c.id===n?D:null,className:"flex-shrink-0",children:g(Jn,{to:"/projects/$projectId/files/$fileId",params:{projectId:t,fileId:c.id},search:{version:void 0},className:B("rounded-lg border overflow-hidden flex items-center justify-center transition-all bg-muted/30 block relative",m?"w-[62px] h-[62px] opacity-100":"w-[52px] h-[52px] opacity-60 hover:opacity-100"),children:[a(xt,{item:c}),c.agent&&a("span",{className:"absolute top-1 right-1 z-10 pointer-events-none select-none rounded bg-black/60 px-1 py-0.5 text-[10px] font-medium leading-none text-white",title:c.agent.name,"data-testid":"carousel-agent-badge",children:"AI"})]})},c.id)}),!s&&O&&a("div",{ref:N,className:"px-2 md:px-0 py-2 md:py-4 flex justify-center items-center h-full md:w-full flex-shrink-0",children:u&&a(K,{className:"h-5 w-5 animate-spin text-muted-foreground"})})]})})};L();function jt(){let{projectId:t,fileId:n}=Ne.useParams(),v=Ne.useSearch(),{version:f,start:b}=v,s=f||n,{cmpLeft:N,cmpRight:C}=v,D=v.cmpActive??"left",i=!!v.compare&&!!N&&!!C,d=M(null),{teamId:p,ensureTeamIdForProject:E}=Pt(),[z,O]=w(360),[H,u]=w([]),{fileViewRightSidebarCollapsed:G}=lr(),{isChatbotOpen:c}=Ir(),m=Lr((e)=>Boolean(e.metadata["appearance.hideAgent"])),[V,P]=w(0),[J,T]=w(null),[pe,Le]=w(null),[Ee,ge]=w(void 0),[Q,he]=w({show:!0,files:[],nextCursor:void 0,folderId:void 0}),[Pe,oe]=w(!0),qe=R.api.files[":fileId"].metadata.$patch,{mutate:_e}=ee({mutationFn:async(e)=>{let o=await qe(e);if(!o.ok)throw Error("Failed to patch metadata");return await o.json()}}),U=ie(),{members:Ke,fetchProjectMembers:Ie}=An(),Oe=hs();S(()=>{E(t)},[t,E]),S(()=>{if(t)Ie(t,!0)},[t,Ie]),S(()=>{if(t&&n)R.api.projects[":projectId"].recents.view.$post({param:{projectId:t},json:{assetId:n}}).catch(()=>{})},[t,n]);let{data:ye,isLoading:He,isError:Qe,isFetching:Be}=X({queryKey:["files",n],queryFn:async()=>{let e=await R.api.files[":fileId"].$get({param:{fileId:n}});if(!e.ok)throw Error("Failed to fetch stack");return await e.json()},enabled:!!p,placeholderData:Rl}),{data:Ue,isLoading:ze,isError:Ge,isFetching:Xe}=X({queryKey:["files",f],queryFn:async()=>{let e=await R.api.files[":fileId"].$get({param:{fileId:f}});if(!e.ok)throw Error("Failed to fetch version");return await e.json()},enabled:!!p&&!!f,placeholderData:Rl}),{data:Ye}=X({queryKey:["version_stacks",n,"versions"],queryFn:async()=>{let e=await R.api.version_stacks[":stackId"].versions.$get({param:{stackId:n}});if(!e.ok)throw Error("Failed to fetch versions");return await e.json()},enabled:!!t&&!!n&&(!!f||i)}),{data:A}=X({queryKey:["projects",t],queryFn:async()=>{let e=await R.api.projects[":projectId"].$get({param:{projectId:t}});if(!e.ok)throw Error("Failed to fetch project");return await e.json()}}),h=We(),{setProjectState:ve,clearProjectState:we}=Bn(),Ze=He||!!f&&ze,et=Qe||!!f&&Ge,tt=Be||!!f&&Xe,r=Ue||ye,k=f?Ye:ye?.versionStack?.versions,l=r?.ancestorFolders?.[0]?.id??A?.rootFolder??"",[ne,Y]=w(!1),[Z,Fe]=w(""),se=M(null),ae=M(!1),[nt,le]=w(!1),rt=R.api.files[":fileId"].$put,{mutate:st,mutateAsync:it,isPending:be}=ee({mutationFn:async(e)=>{let o=await rt(e);if(!o.ok)throw Error("Failed to rename file");return await o.json()},onSuccess:()=>{U.invalidateQueries({queryKey:["files"]}),U.invalidateQueries({queryKey:["version_stacks"]}),j.success(Rk?.()||"Renamed successfully"),Y(!1)},onError:()=>{j.error(Wx?.()||"Failed to rename")}}),at=R.api.files.$delete,{mutate:lt,mutateAsync:ct,isPending:Ae}=ee({mutationFn:async(e)=>{if(!(await at(e)).ok)throw Error("Failed to delete file")},onSuccess:()=>{if(U.invalidateQueries({queryKey:["files"]}),U.invalidateQueries({queryKey:["version_stacks"]}),j.success(VE?.()||"Deleted"),le(!1),l&&l!==A?.rootFolder)h({to:"/projects/$projectId/folders/$folderId",params:{projectId:t,folderId:l}});else h({to:"/projects/$projectId",params:{projectId:t}})},onError:()=>{j.error(Ll?.()||"Failed to delete")}}),ut=(e)=>{if(e?.preventDefault(),!Z.trim()||!s)return;st({param:{fileId:s},json:{name:Z.trim()}})},It=()=>{if(!s)return;lt({json:{ids:[s]}})};S(()=>{if(r&&A&&p)ve({teamId:p,projectId:t,projectName:A.name??"",ancestorFolders:r.ancestorFolders??[],currentAsset:{id:s||n,name:r.name,type:"file",version:k?k.find((e)=>e.id===s)?.version??k.length:void 0,proxyType:r.proxyType},isRootFolder:!1,fileId:n,downloadInfo:{originalKey:r.media?.original?.key,videoTranscodes:r.media?.videoTranscodes?.map((e)=>({key:e.key,width:e.width,height:e.height,resolution:e.resolution,hdr:e.hdr}))},versions:k,compareMode:i,canCompareVersions:(k?.length??0)>=2,onCompareVersions:()=>{let e=_u(k);if(!e)return;h({to:"/projects/$projectId/files/$fileId",params:{projectId:t,fileId:n},search:(o)=>({...o,version:void 0,compare:!0,cmpLeft:e.left.id,cmpRight:e.right.id,cmpActive:"left"})})},onFolderClick:(e)=>{h({to:"/projects/$projectId/folders/$folderId",params:{projectId:t,folderId:e}})},onRename:()=>{ae.current=!1,Fe(r?.name??""),Y(!0)},onDelete:()=>{le(!0)}});return()=>we()},[p,t,A,r,k,s,n,i,ve,we,h]),S(()=>{if(!ne)return;let e=setTimeout(()=>{ae.current=!0},1000);return()=>clearTimeout(e)},[ne]);let yt=()=>{if(ae.current)return;setTimeout(()=>{if(se.current)ci(se.current)},0)};if(S(()=>{if(!l||!s)return;if(Q.folderId===l){oe(!1);return}oe(!0);let e=!0;return(async()=>{try{let I="",y=!1,x=[],ce=void 0;for(let fe=0;fe<5;fe++){let ue=await R.api.folders[":folderId"].search.$post({param:{folderId:l},json:{assetType:"file",after:I,first:200,recursively:!1,conditions:[]}});if(!ue.ok)throw Error("Failed to search parent folder for carousel");let _=await ue.json(),me=_.data||[];if(x.push(...me),me.some((te)=>te.id===s)){if(y=!0,ce=_.pageInfo?.cursor||void 0,_.pageInfo?.cursor)try{let te=await R.api.folders[":folderId"].search.$post({param:{folderId:l},json:{assetType:"file",after:_.pageInfo.cursor,first:200,recursively:!1,conditions:[]}});if(te.ok){let $e=await te.json(),bt=$e.data||[];x.push(...bt),ce=$e.pageInfo?.cursor||void 0}}catch{}break}if(!_.pageInfo?.cursor||me.length<200)break;I=_.pageInfo.cursor}if(e)he({show:!0,files:y?x:r?[r]:[],nextCursor:y?ce:void 0,folderId:l})}catch(I){if(console.error(I),e)he({show:!0,files:r?[r]:[],nextCursor:void 0,folderId:l})}finally{if(e)oe(!1)}})(),()=>{e=!1}},[l,s,Q.folderId,r]),S(()=>{P(0),T(null),u([])},[r?.id]),S(()=>{T(null),u([])},[pe?.id]),S(()=>{un.getState().reset(),un.getState().setIsDrawing(!1),u([]),T(null)},[s]),Ze&&!r)return a(sm,{});if(et||!r||!A||!p)return a("div",{children:N_()});let q=i?pe:r,je=q?.id??s,De=(e,o)=>{if(!p)return;_e({param:{fileId:je},json:[{key:e,value:o}]},{onSuccess:()=>{U.invalidateQueries({queryKey:["files",je]})}})},de=(e)=>{h({to:"/projects/$projectId/files/$fileId",params:{projectId:t,fileId:n},search:(o)=>({...o,...e})})},vt=()=>{de({compare:void 0,cmpLeft:void 0,cmpRight:void 0,cmpActive:void 0,version:D==="left"?N:C})},wt=(e)=>{T(e.id||null);let o=e.annotations;if(o&&o.length>0)u(o);else u([]);if(i){if(e.second!==null&&e.second!==void 0)ge({second:e.second,nonce:Date.now()});return}if(e.second!==null&&e.second!==void 0)d.current?.seekTo(e.second),d.current?.pause();else if(o&&o.length>0)d.current?.pause()},Ft=(e)=>{T(e.id||null);let I=e.details,y=I?.annotations;if(y&&y.length>0)u(y);else u([]);let x=I?.position?.type==="time"?I.position.seconds:I?.position?.type==="page"?I.position.page:void 0;if(i){if(x!==void 0)ge({second:x,nonce:Date.now()});return}if(x!==void 0)d.current?.seekTo(x),d.current?.pause();else if(y&&y.length>0)d.current?.pause()},Re=()=>{u([]),T(null)},kt=()=>{u([]),T(null)};if(Oe&&!i)return a(hu,{projectId:t,teamId:p,fileId:n,file:r,projectInfo:A,ancestorFolders:r.ancestorFolders??[],parentFolderId:l,versions:k,activeFileId:s,startTime:b,siblingFiles:Q.files,onNavigateToFile:(e)=>{h({to:"/projects/$projectId/files/$fileId",params:{projectId:t,fileId:e}})},onNavigateBack:()=>{if(l&&l!==A?.rootFolder)h({to:"/projects/$projectId/folders/$folderId",params:{projectId:t,folderId:l}});else h({to:"/projects/$projectId",params:{projectId:t}})},onSelectVersion:(e)=>{h({to:"/projects/$projectId/files/$fileId",params:{projectId:t,fileId:n},search:(o)=>({...o,version:e})})},onRenameFile:async(e)=>{await it({param:{fileId:s},json:{name:e}})},onDeleteFile:async()=>{await ct({json:{ids:[s]}})},onSaveField:De});return g("div",{className:"h-full flex flex-1 flex-col bg-background",children:[g("div",{className:"h-full flex flex-1 overflow-hidden",children:[g("div",{className:"flex-1 relative",children:[tt&&!i&&a("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-background/50",children:a(K,{className:"h-8 w-8 animate-spin text-foreground"})}),i&&N&&C?a(gu,{versions:k??[],leftId:N,rightId:C,activeSide:D,annotations:H,seekRequest:Ee,onActiveSideChange:(e)=>de({cmpActive:e}),onSwitchVersion:(e,o)=>de(e==="left"?{cmpLeft:o}:{cmpRight:o}),onExit:vt,onActiveAssetChange:Le,onPlay:Re,onTimeUpdate:P}):a(Ns,{file:r,mediaControllerRef:d,onPlay:Re,onTimeUpdate:P,onSeek:kt,annotations:H,startTime:b,children:a(Me,{projectId:t,currentAssetId:s,parentFolderId:l,initialFiles:Q.files,initialNextCursor:Q.nextCursor,isLoading:Pe})})]}),(!G||c&&!m)&&g(W,{children:[a(Yr,{onResize:(e)=>{O((o)=>Math.max(300,Math.min(600,o-e)))},className:"hidden md:block"}),a("div",{style:{width:z},className:"flex-shrink-0 bg-background flex flex-col",children:c&&!m?a(ba,{projectId:t,contextAssetId:s,file:q,currentTime:V,frameRate:q?.media?.metadata?.frameRate||30,startTimecode:q?.media?.metadata?.startTimecode,onTyping:()=>{if(i)return;d.current?.pause()},onSelectMessage:Ft,selectedMessageId:J}):a(xa,{teamId:p,projectId:t,file:q,onSaveField:De,members:Ke,onCommentSelect:wt,currentTime:V,onTyping:()=>{if(i)return;d.current?.pause()},selectedCommentId:J,hideAnnotationControl:q?.proxyType==="audio"})})]})]}),a(Se,{open:ne,onOpenChange:Y,children:a(xe,{children:g("form",{onSubmit:ut,children:[a(ke,{children:a(Ce,{children:ms()})}),a("div",{className:"py-4",children:a(re,{ref:se,value:Z,onChange:(e)=>Fe(e.target.value),placeholder:pp?.()||"Enter new name",onFocus:yt,autoFocus:!0})}),g(ot,{children:[a(F,{type:"button",variant:"outline",onClick:()=>Y(!1),children:Ve()}),g(F,{type:"submit",disabled:be||!Z.trim(),children:[be&&a(K,{className:"mr-2 h-4 w-4 animate-spin"}),wo()]})]})]})})}),a(dt,{open:nt,onOpenChange:le,children:g(ft,{children:[g(pt,{children:[a(ht,{children:wd?.()||"Delete Asset?"}),a(gt,{children:bd?.()||"Deleted items can be recovered for 30 days before being permanently deleted."})]}),g(mt,{children:[a(_t,{children:Ve()}),g(At,{onClick:It,disabled:Ae,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[Ae&&a(K,{className:"mr-2 h-4 w-4 animate-spin"}),Mt()]})]})]})})]})}var Ne=Je("/projects/$projectId/files/$fileId")({component:jt});export{Ne as Route};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Mf,Of,Nm,Fm}from"./chunk-5ddg5ezb.js";function ge(o){return Mf(Nm,o)}function zg(o){return Of(Fm,o)}export{ge,zg};
@@ -1 +0,0 @@
1
- import{Y,G,S,Q,M,w,Mo,L,W,a,g,ie,Zf,Bf,qr,dd,Va,Yo,ar,ks,Uf,zf,jf,qf,fd,$f,X,ee,Tt,Je,R,z,wr,K,rn,$t,qe,Be,ur,Pn,nr,Rs,Ge,B,Ut,Le,pe,Gt,Kr,tr,we,Cr,F,$e,He,Qe,Wy,Jy,zm,Eb,Sb,Ib,Gb,Vm,tw,t_,Ve,Rw,Dw,Nw,Xa,a_,hE,up,vd,d_,Mi,Ms,T_,Gx,k_,ph,yC,vC,bC,wC,aS,$_,xS,SI,II,Ch,sT,Mh,Oh,yT,IT,OT,XT,y0,Cd,u1,k0,Tp,U0,Q1,V1,zh,W1,X1,j0,tk,rk,q0,nk,sk,Dp,Np,Fp,Wc,Gh,pk,mk,hk,gk,Lp,xk,Pi,Zk,Xk,rR,hR,rg,AR,TR,kR,MR,OR,PR,DR,uy,NR,dy,Ay,cM,uM,dM,PM,vy,wy,DM,Cy,jp,LM,zM,rO,lO,Ry,Yn,hg,MO,LO,ZO,Rd,$O,yg,sP,dt,ft,pt,mt,ht,gt,At,_t,Se,xe,ke,Ce,Ot,re,Ie,Vt,j,Hl,Ql,nu,on,wg,co,uo,Jr,gn,ve,bt,wt,Et,Sr,Fr,om,ct,Nt,Ft,Ht,St}from"./chunk-5ngftxjb.js";import{os,Zr}from"./chunk-qvp24w0q.js";import{vu}from"./chunk-pq6kdp83.js";import{Li,eo,gs,lu,Kl,va,cu}from"./chunk-enax4303.js";import"./chunk-sz5zawfw.js";import{Un,zn,jn,Tr,vt,ut}from"./chunk-c02727j9.js";import"./chunk-c1wvs81k.js";import{Uo}from"./chunk-etrm28sy.js";import{bu}from"./chunk-s1j4v33x.js";import{qn}from"./chunk-pdw77q09.js";import{Br}from"./chunk-7kah3zb5.js";L();function de(e,t){let s=new Set(t);return e.filter((i)=>!s.has(i))}var me=class extends Yo{#r;#e;#o;#a;#t;#s;#i;#n;#l;#d=[];constructor(e,t,s){super();this.#r=e,this.#a=s,this.#o=[],this.#t=[],this.#e=[],this.setQueries(t)}onSubscribe(){if(this.listeners.size===1)this.#t.forEach((e)=>{e.subscribe((t)=>{this.#p(e,t)})})}onUnsubscribe(){if(!this.listeners.size)this.destroy()}destroy(){this.listeners=new Set,this.#t.forEach((e)=>{e.destroy()})}setQueries(e,t){this.#o=e,this.#a=t,ar.batch(()=>{let s=this.#t,i=this.#u(this.#o);i.forEach((p)=>p.observer.setOptions(p.defaultedQueryOptions));let n=i.map((p)=>p.observer),r=n.map((p)=>p.getCurrentResult()),c=s.length!==n.length,u=n.some((p,b)=>p!==s[b]),f=c||u,v=f?!0:r.some((p,b)=>{let h=this.#e[b];return!h||!Va(p,h)});if(!f&&!v)return;if(f)this.#d=i,this.#t=n;if(this.#e=r,!this.hasListeners())return;if(f)de(s,n).forEach((p)=>{p.destroy()}),de(n,s).forEach((p)=>{p.subscribe((b)=>{this.#p(p,b)})});this.#f()})}getCurrentResult(){return this.#e}getQueries(){return this.#t.map((e)=>e.getCurrentQuery())}getObservers(){return this.#t}getOptimisticResult(e,t){let s=this.#u(e),i=s.map((r)=>r.observer.getOptimisticResult(r.defaultedQueryOptions)),n=s.map((r)=>r.defaultedQueryOptions.queryHash);return[i,(r)=>this.#c(r??i,t,n),()=>this.#m(i,s)]}#m(e,t){let s=new Set;return t.map((i,n)=>{let r=e[n];return!i.defaultedQueryOptions.notifyOnChangeProps?i.observer.trackResult(r,(c)=>{if(!s.has(c))s.add(c),t.forEach((u)=>{u.observer.trackProp(c)})}):r})}#c(e,t,s){if(t){let i=this.#l,n=s!==void 0&&i!==void 0&&(i.length!==s.length||s.some((r,c)=>r!==i[c]));if(this.#e!==this.#n||n||t!==this.#i){if(this.#i=t,this.#n=this.#e,s!==void 0)this.#l=s;this.#s=dd(this.#s,t(e))}return this.#s}return e}#g(){return!this.#a?.combine||this.#t.some((e,t)=>e.options.suspense&&this.#e[t]?.data===void 0)}#u(e){let t=new Map;this.#t.forEach((i)=>{let n=i.options.queryHash;if(!n)return;let r=t.get(n);if(r)r.push(i);else t.set(n,[i])});let s=[];return e.forEach((i)=>{let n=this.#r.defaultQueryOptions(i),r=t.get(n.queryHash)?.shift()??new ks(this.#r,n);s.push({defaultedQueryOptions:n,observer:r})}),s}#p(e,t){let s=this.#t.indexOf(e);if(s!==-1)this.#e=this.#e.slice(),this.#e[s]=t,this.#f()}#f(){if(this.hasListeners()){let e=this.#g(),t=this.#s,s=e?t:this.#c(this.#m(this.#e,this.#d),this.#a?.combine);if(e||t!==s)ar.batch(()=>{this.listeners.forEach((i)=>{i(this.#e)})})}}};L();function ce({queries:e,...t},s){let i=ie(s),n=Zf(),r=Bf(),c=t.subscribed!==!1,u=Q(()=>e.map((m)=>{let x=i.defaultQueryOptions(m);return x._optimisticResults=n?"isRestoring":c?"optimistic":void 0,x}),[e,i,n,c]);u.forEach((m)=>{qf(m);let x=i.getQueryCache().get(m.queryHash);Uf(m,r,x)}),zf(r);let[f]=w(()=>new me(i,u,t)),[v,p,b]=f.getOptimisticResult(u,t.combine),h=!n&&c;Mo(G((m)=>h?f.subscribe(ar.batchCalls(m)):qr,[f,h]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),S(()=>{f.setQueries(u,t)},[u,t,f]);let l=v.some((m,x)=>fd(u[x],m))?v.flatMap((m,x)=>{let T=u[x];if(T&&fd(T,m)){let k=new ks(i,T);return $f(T,k,r)}return[]}):[];if(l.length>0)throw Promise.all(l);let C=v.find((m,x)=>{let T=u[x];return T&&jf({result:m,errorResetBoundary:r,throwOnError:T.throwOnError,query:i.getQueryCache().get(T.queryHash),suspense:T.suspense})});if(C)throw C.error;return p(b())}L();L();var je=Object.defineProperty,U=(e,t)=>je(e,"name",{value:t,configurable:!0}),se="Collapsible",[Fe,da]=Ut(se),[We,oe]=Fe(se),ze=Y(U(function(t,s){let{__scopeCollapsible:i,open:n,defaultOpen:r,disabled:c,onOpenChange:u,...f}=t,[v,p]=tr({prop:n,defaultProp:r??!1,onChange:u,caller:se});return a(We,{scope:i,disabled:c,contentId:Kr(),open:v,onOpenToggle:G(()=>p((b)=>!b),[p]),children:a(we.div,{"data-state":te(v),"data-disabled":c?"":void 0,...f,ref:s})})},"Collapsible")),Ue="CollapsibleTrigger",Ke=Y(U(function(t,s){let{__scopeCollapsible:i,...n}=t,r=oe(Ue,i);return a(we.button,{type:"button","aria-controls":r.open?r.contentId:void 0,"aria-expanded":r.open||!1,"data-state":te(r.open),"data-disabled":r.disabled?"":void 0,disabled:r.disabled,...n,ref:s,onClick:pe(t.onClick,r.onOpenToggle)})},"CollapsibleTrigger")),ue="CollapsibleContent",Xe=Y(U(function(t,s){let{forceMount:i,...n}=t,r=oe(ue,t.__scopeCollapsible);return a(Cr,{present:i||r.open,children:({present:c})=>a(Ye,{...n,ref:s,present:c})})},"CollapsibleContent")),Ye=Y(U(function(t,s){let{__scopeCollapsible:i,present:n,children:r,...c}=t,u=oe(ue,i),[f,v]=w(n),p=M(null),b=Le(s,p),h=M(0),l=h.current,C=M(0),m=C.current,x=u.open||f,T=M(x),k=M(void 0);return S(()=>{let _=requestAnimationFrame(()=>T.current=!1);return()=>cancelAnimationFrame(_)},[]),Gt(()=>{let _=p.current;if(_){k.current=k.current||{transitionDuration:_.style.transitionDuration,animationName:_.style.animationName},_.style.transitionDuration="0s",_.style.animationName="none";let q=_.getBoundingClientRect();if(h.current=q.height,C.current=q.width,!T.current)_.style.transitionDuration=k.current.transitionDuration,_.style.animationName=k.current.animationName;v(n)}},[u.open,n]),a(we.div,{"data-state":te(u.open),"data-disabled":u.disabled?"":void 0,id:u.contentId,hidden:!x,...c,ref:b,style:{["--radix-collapsible-content-height"]:l?`${l}px`:void 0,["--radix-collapsible-content-width"]:m?`${m}px`:void 0,...t.style},children:x&&r})},"CollapsibleContentImpl"));function te(e){return e?"open":"closed"}U(te,"getState");var Ze=ze;var tt=[["path",{d:"M5 21v-6",key:"1hz6c0"}],["path",{d:"M12 21V3",key:"1lcnhd"}],["path",{d:"M19 21V9",key:"unv183"}]],fe=z("chart-no-axes-column",tt);var at=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],P=z("funnel",at);var st=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],ge=z("eye",st);var rt=[["path",{d:"M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z",key:"1n2ejm"}],["path",{d:"M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1",key:"1qfcsi"}]],V=z("messages-square",rt);var ot=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],be=z("rotate-cw",ot);var it=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],ae=z("workflow",it);function he({teamId:e}){let[t,s]=w("team"),[i,n]=w("1h"),{data:r,isLoading:c}=X({queryKey:["teams",e,"ai-usage",i,"team"],queryFn:async()=>{let m=await R.api.teams[":teamId"]["ai-usage"].$get({param:{teamId:e},query:{timeframe:i}});if(!m.ok)throw Error("Failed to fetch team AI usage");return await m.json()},enabled:!!e&&t==="team"}),{data:u,isLoading:f}=X({queryKey:["teams",e,"members"],queryFn:async()=>{let m=await R.api.teams[":teamId"].members.$get({param:{teamId:e},query:{}});if(!m.ok)throw Error("Failed to fetch team members");return await m.json()},enabled:!!e&&t==="members"}),v=ce({queries:(u||[]).map((m)=>({queryKey:["teams",e,"ai-usage",i,m.id],queryFn:async()=>{let x=await R.api.teams[":teamId"]["ai-usage"].$get({param:{teamId:e},query:{timeframe:i,userId:m.id}});if(!x.ok)throw Error(`Failed to fetch AI usage for member ${m.id}`);return await x.json()},enabled:!!e&&t==="members"}))}),p=f||v.some((m)=>m.isLoading),b=(m)=>{if(!m)return"U";let x=m.split(" ");if(x.length>1)return`${x[0][0]}${x[x.length-1][0]}`.toUpperCase();return m.substring(0,2).toUpperCase()},h=(m)=>{if(!m)return"";switch(m.toLowerCase()){case"owner":return Cd();case"editor":return Mi();case"reviewer":return Pi();default:return m}},l=(m)=>(m??0).toLocaleString(),C=(m)=>`$${(m??0).toFixed(6)}`;return g(ct,{className:"border-border/60 shadow-sm",children:[g(Nt,{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between pb-6",children:[g("div",{children:[a(Ft,{className:"text-xl font-semibold tracking-tight",children:Sb()}),a(Ht,{className:"text-sm text-muted-foreground mt-1",children:Ib()})]}),g("div",{className:"flex flex-wrap items-center gap-3",children:[g(os,{type:"single",value:t,onValueChange:(m)=>{if(m)s(m)},className:"border rounded-lg p-1 bg-muted/30",children:[a(Zr,{value:"team",className:"px-3 py-1.5 text-xs font-medium",children:zM()}),a(Zr,{value:"members",className:"px-3 py-1.5 text-xs font-medium",children:II()})]}),g(os,{type:"single",value:i,onValueChange:(m)=>{if(m)n(m)},className:"border rounded-lg p-1 bg-muted/30",children:[a(Zr,{value:"1h",className:"px-2.5 py-1.5 text-xs font-medium",children:"1h"}),a(Zr,{value:"24h",className:"px-2.5 py-1.5 text-xs font-medium",children:"24h"}),a(Zr,{value:"7d",className:"px-2.5 py-1.5 text-xs font-medium",children:"7d"}),a(Zr,{value:"30d",className:"px-2.5 py-1.5 text-xs font-medium",children:"30d"})]})]})]}),a(St,{children:t==="team"?c?a("div",{className:"flex h-48 items-center justify-center",children:a(K,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):a("div",{className:"rounded-md border",children:g(Un,{children:[a(zn,{children:g(Tr,{children:[a(vt,{children:jp()}),a(vt,{className:"text-right",children:$_()}),a(vt,{className:"text-right",children:y0()}),a(vt,{className:"text-right",children:t_()}),a(vt,{className:"text-right",children:Ry()}),a(vt,{className:"text-right",children:a_()})]})}),a(jn,{children:g(Tr,{children:[a(ut,{className:"font-medium",children:jp()}),a(ut,{className:"text-right",children:l(r?.team?.inputTokens)}),a(ut,{className:"text-right",children:l(r?.team?.outputTokens)}),a(ut,{className:"text-right",children:l(r?.team?.cacheReadTokens)}),a(ut,{className:"text-right font-medium",children:l(r?.team?.totalTokens)}),a(ut,{className:"text-right font-medium",children:C(r?.team?.cost)})]})})]})}):p?a("div",{className:"flex h-48 items-center justify-center",children:a(K,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):a("div",{className:"rounded-md border",children:g(Un,{children:[a(zn,{children:g(Tr,{children:[a(vt,{children:SI()}),a(vt,{children:Zk()}),a(vt,{className:"text-right",children:$_()}),a(vt,{className:"text-right",children:y0()}),a(vt,{className:"text-right",children:t_()}),a(vt,{className:"text-right",children:Ry()}),a(vt,{className:"text-right",children:a_()})]})}),a(jn,{children:(u||[]).map((m,x)=>{let T=v[x]?.data?.member;return g(Tr,{children:[a(ut,{children:g("div",{className:"flex items-center gap-3",children:[g($e,{className:"h-8 w-8 rounded-full",children:[m.image&&a(He,{src:m.image,alt:m.name,className:"object-cover"}),a(Qe,{className:"bg-primary/20 text-xs",children:b(m.name)})]}),g("div",{className:"flex flex-col",children:[a("span",{className:"text-sm font-medium leading-none",children:m.name}),a("span",{className:"text-xs text-muted-foreground mt-0.5",children:m.email})]})]})}),a(ut,{className:"text-xs text-muted-foreground",children:h(m.role)}),a(ut,{className:"text-right",children:l(T?.inputTokens)}),a(ut,{className:"text-right",children:l(T?.outputTokens)}),a(ut,{className:"text-right",children:l(T?.cacheReadTokens)}),a(ut,{className:"text-right font-medium",children:l(T?.totalTokens)}),a(ut,{className:"text-right font-medium",children:C(T?.cost)})]},m.id)})})]})})})]})}L();function Ne({teamId:e}){let[t,s]=w(null),{ref:i,inView:n}=Vt(),{data:r,isLoading:c,isError:u,fetchNextPage:f,hasNextPage:v,isFetchingNextPage:p}=Tt({queryKey:["teams",e,"agent-sessions"],queryFn:async({pageParam:l})=>{let C=await R.api.teams[":teamId"]["agent-sessions"].$get({param:{teamId:e},query:{first:"20",after:l?String(l):void 0}});if(!C.ok)throw Error("Failed to fetch agent sessions");return await C.json()},initialPageParam:"",getNextPageParam:(l)=>l.pageInfo.cursor||void 0,enabled:!!e});S(()=>{if(n&&v&&!p)f()},[n,v,p,f]);let b=r?.pages.flatMap((l)=>l.data).filter((l)=>l.id!=="pending")||[],h=(l)=>{switch(l){case"comment":return a(ve,{variant:"outline",className:"bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20",children:PR()});case"chat":return a(ve,{variant:"outline",className:"bg-violet-500/10 text-violet-600 dark:text-violet-400 border-violet-500/20",children:OR()});case"naming":return a(ve,{variant:"outline",className:"bg-amber-500/10 text-amber-600 dark:text-amber-400 border-amber-500/20",children:DR()});default:return a(ve,{variant:"outline",className:"bg-muted text-muted-foreground border-border",children:l})}};return g("div",{className:"space-y-6",children:[g(ct,{className:"border border-border/50 shadow-xs",children:[a(Nt,{className:"pb-4",children:a("div",{className:"flex items-center justify-between",children:g("div",{children:[g(Ft,{className:"text-xl font-bold flex items-center gap-2",children:[a(V,{className:"w-5 h-5 text-violet-500"}),uy()]}),a(Ht,{className:"mt-1 text-sm text-muted-foreground",children:NR()})]})})}),a(St,{children:c?a("div",{className:"flex h-64 items-center justify-center",children:a(K,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):u?a("div",{className:"flex h-64 items-center justify-center text-destructive",children:"Failed to load agent sessions."}):b.length===0?g("div",{className:"flex flex-col items-center justify-center py-12 text-center text-muted-foreground",children:[a(V,{className:"w-10 h-10 text-muted-foreground/40 mb-3"}),a("p",{className:"text-base font-medium",children:yT()})]}):g("div",{className:"rounded-md border border-border/50 overflow-hidden",children:[g(Un,{children:[a(zn,{className:"bg-muted/40",children:g(Tr,{children:[a(vt,{children:kR()}),a(vt,{children:vd()}),a(vt,{children:MR()}),a(vt,{className:"text-right",children:hE()})]})}),a(jn,{children:b.map((l)=>g(Tr,{onClick:()=>s(l.id),className:"cursor-pointer hover:bg-muted/50 transition-colors",children:[a(ut,{className:"font-medium",children:g("div",{className:"flex flex-col",children:[a("span",{className:"text-sm font-semibold text-foreground",children:l.name||hg()}),a("span",{className:"text-xs font-mono text-muted-foreground/70",children:l.id})]})}),a(ut,{children:g("div",{className:"flex items-center gap-2",children:[g($e,{className:"h-6 w-6",children:[a(He,{src:l.creator?.image||void 0}),a(Qe,{className:"text-[10px]",children:l.creator?.name?.[0]?.toUpperCase()||"?"})]}),a("span",{className:"text-sm text-foreground/90",children:l.creator?.name||"System / Agent"})]})}),a(ut,{children:h(l.type)}),a(ut,{className:"text-right text-xs text-muted-foreground",children:on(l.createdAt)})]},l.id))})]}),a("div",{ref:i,className:"py-4 flex justify-center",children:p&&a(K,{className:"h-6 w-6 animate-spin text-muted-foreground"})})]})})]}),a(vu,{sessionId:t,open:!!t,onOpenChange:(l)=>{if(!l)s(null)}})]})}L();function ye({...e}){return a(Ze,{"data-slot":"collapsible",...e})}function Te({...e}){return a(Ke,{"data-slot":"collapsible-trigger",...e})}function _e({...e}){return a(Xe,{"data-slot":"collapsible-content",...e})}function ne(e){switch(e.toLowerCase()){case"owner":return Cd();case"editor":return Mi();case"reviewer":return Pi();default:return e}}function nt(e,t){if(typeof e==="object"&&e!==null&&"message"in e){let s=e.message;if(typeof s==="string")return s}return t}function lt({rule:e}){let t=e.resourceData??{};if(e.resource==="agent_mcp_call_count")return a("span",{children:mk({value:String(t.id??"")})});if(e.resource==="agent_bash_call_count")return a("span",{children:pk({value:String(t.match??"*")})});if(e.resource==="agent_tool_call_count")return a("span",{children:hk({value:String(t.name??t.toolName??"*")})});return null}function xt({rule:e}){if(e.scopeMode==="all_members")return g(ve,{variant:"secondary",className:"gap-1 text-xs",children:[a(Uo,{className:"h-3 w-3"}),g("span",{children:[Dp(),e.role?` (${ne(e.role)})`:` (${Wc()})`]})]});if(e.scopeMode==="each_member")return g(ve,{variant:"secondary",className:"gap-1 text-xs",children:[a(qn,{className:"h-3 w-3"}),g("span",{children:[Np(),e.role?` (${ne(e.role)})`:` (${Wc()})`]})]});return g(ve,{variant:"secondary",className:"gap-1 text-xs",children:[a(Rs,{className:"h-3 w-3"}),g("span",{children:[Fp()," (",e.userIds?.length||0,")"]})]})}function yt({teamId:e,rule:t,record:s}){let i=ie(),[n,r]=w(!1),[c,u]=w(()=>new Date),f=Kl[t.resource],v=t.scopeMode==="all_members",p=s.percent>=100,b=v?t.role?`${sk()}: ${ne(t.role)}`:gk():s.user?.name||s.userId||Yn();S(()=>{if(!s.isWindowActive||!s.periodEnd)return;let l=window.setInterval(()=>u(new Date),60000);return()=>window.clearInterval(l)},[s.isWindowActive,s.periodEnd]);let h=ee({mutationFn:async()=>{let l=await R.api.teams[":teamId"].quotas[":id"].records.reset.$post({param:{teamId:e,id:t.id},json:{userId:s.userId??null}});if(!l.ok){let C=await l.json().catch(()=>null);throw Error(nt(C,k_()))}return await l.json()},onSuccess:()=>{i.invalidateQueries({queryKey:["teams",e,"quotas",t.id,"records"]}),i.invalidateQueries({queryKey:["teams",e,"quotas"]}),r(!1),j.success(rk())},onError:(l)=>{let C=l instanceof Error?l.message:k_();r(!1),j.error(C)}});return g(W,{children:[g("div",{className:"space-y-3 rounded-xl border border-border/70 bg-card p-4 text-card-foreground shadow-2xs",children:[g("div",{className:"flex items-center justify-between gap-3",children:[g("div",{className:"flex min-w-0 items-center gap-3",children:[v?a("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary",children:a(Uo,{className:"h-5 w-5"})}):g($e,{className:"h-9 w-9 shrink-0 border border-border/50",children:[a(He,{src:s.user?.image||void 0}),a(Qe,{className:"text-xs font-semibold",children:s.user?.name?.[0]?.toUpperCase()||"U"})]}),g("div",{className:"min-w-0",children:[a("div",{className:"truncate text-sm font-semibold text-foreground",children:b}),!v&&s.user?.email&&a("div",{className:"truncate text-xs text-muted-foreground",children:s.user.email})]})]}),g("div",{className:"flex shrink-0 items-center gap-2",children:[s.isWindowActive&&s.periodEnd?g(ve,{variant:"outline",className:"hidden gap-1 border-primary/30 bg-primary/5 text-xs text-primary sm:flex",children:[a(ur,{className:"h-3 w-3"}),a("span",{children:j0({time:wg(s.periodEnd,c)})})]}):g(ve,{variant:"secondary",className:"hidden gap-1 text-xs text-muted-foreground sm:flex",children:[a(wr,{className:"h-3 w-3 text-primary"}),a("span",{children:U0()})]}),g(F,{type:"button",variant:"outline",size:"sm",className:"gap-1.5",onClick:()=>r(!0),disabled:h.isPending,children:[h.isPending?a(K,{className:"h-3.5 w-3.5 animate-spin"}):a(Li,{className:"h-3.5 w-3.5"}),q0()]})]})]}),g("div",{className:"space-y-1.5 pt-1",children:[a(om,{value:Math.min(100,Math.max(0,s.percent)),className:"h-2"}),g("div",{className:"flex items-center justify-between gap-2 text-xs font-medium",children:[g("span",{className:p?"font-bold text-destructive":"text-foreground",children:[va(t.resource,s.consumed)," /"," ",va(t.resource,t.limit)," ",f?.unit]}),g("span",{className:p?"font-bold text-destructive":"text-muted-foreground",children:[s.percent,"%"]})]})]}),g("div",{className:"flex items-center justify-between gap-2 text-xs text-muted-foreground sm:hidden",children:[s.isWindowActive&&s.periodEnd?g("span",{className:"flex items-center gap-1 text-primary",children:[a(ur,{className:"h-3 w-3"}),j0({time:wg(s.periodEnd,c)})]}):g("span",{className:"flex items-center gap-1",children:[a(wr,{className:"h-3 w-3 text-primary"}),U0()]}),g("span",{children:[tk(),": ",va(t.resource,s.remaining)," ",f?.unit]})]})]}),a(dt,{open:n,onOpenChange:r,children:g(ft,{children:[g(pt,{children:[a(ht,{children:q0()}),a(gt,{children:nk({target:b})})]}),g(mt,{children:[a(_t,{disabled:h.isPending,children:Ve()}),g(At,{onClick:(l)=>{l.preventDefault(),h.mutate()},disabled:h.isPending,children:[h.isPending&&a(K,{className:"mr-2 h-4 w-4 animate-spin"}),Xa()]})]})]})})]})}function Ct({teamId:e,rule:t}){let[s,i]=w(!1),[n,r]=w(""),c=Kl[t.resource],u=c?.icon||gs,{data:f,isLoading:v,isError:p}=X({queryKey:["teams",e,"quotas",t.id,"records"],queryFn:async()=>{let l=await R.api.teams[":teamId"].quotas[":id"].records.$get({param:{teamId:e,id:t.id}});if(!l.ok)throw Error(T_());return await l.json()},enabled:s,refetchInterval:s?1e4:!1}),b=f?.records??[],h=b.filter((l)=>{if(!n.trim())return!0;let C=n.toLowerCase();return l.user?.name.toLowerCase().includes(C)||l.user?.email.toLowerCase().includes(C)});return g(ye,{open:s,onOpenChange:i,className:"rounded-xl border border-border/70",children:[a(Te,{asChild:!0,children:g("button",{type:"button","aria-label":s?Q1():W1(),className:"flex w-full items-center justify-between gap-4 p-4 text-left transition-colors hover:bg-muted/40",children:[g("div",{className:"flex min-w-0 items-start gap-3",children:[a("div",{className:"mt-0.5 rounded-lg bg-primary/10 p-2 text-primary",children:a(u,{className:"h-5 w-5"})}),g("div",{className:"min-w-0",children:[g("div",{className:"flex flex-wrap items-center gap-2",children:[a("span",{className:"font-semibold text-foreground",children:c?.label()||t.resource}),!t.enabled&&a(ve,{variant:"secondary",children:zh()})]}),g("div",{className:"mt-1 flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground",children:[a(xt,{rule:t}),g(ve,{variant:"outline",className:"gap-1 text-xs",children:[a(ur,{className:"h-3 w-3"}),va(t.resource,t.limit)," ",c?.unit," /"," ",cu(t.period)]}),a(lt,{rule:t})]})]})]}),a(Be,{className:`h-5 w-5 shrink-0 text-muted-foreground transition-transform ${s?"rotate-180":""}`})]})}),a(_e,{children:g("div",{className:"space-y-3 border-t border-border/60 bg-muted/10 p-4",children:[t.scopeMode!=="all_members"&&b.length>3&&g("div",{className:"relative",children:[a(nr,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a(re,{value:n,onChange:(l)=>r(l.target.value),placeholder:Gh(),className:"h-9 pl-9 text-sm"})]}),v?a("div",{className:"flex justify-center py-10",children:a(K,{className:"h-7 w-7 animate-spin text-primary"})}):p?a("div",{className:"py-8 text-center text-sm text-destructive",children:T_()}):h.length===0?a("div",{className:"py-8 text-center text-sm text-muted-foreground",children:X1()}):h.map((l,C)=>a(yt,{teamId:e,rule:t,record:l},l.id||l.userId||`record-${C}`))]})})]})}function Ae({teamId:e}){let{data:t,isLoading:s,isError:i}=X({queryKey:["teams",e,"quotas"],queryFn:async()=>{let r=await R.api.teams[":teamId"].quotas.$get({param:{teamId:e}});if(!r.ok)throw Error(Ms());return await r.json()},enabled:!!e}),n=t?.rules??[];return g(ct,{className:"border-border/60 shadow-sm",children:[g(Nt,{children:[g(Ft,{className:"flex items-center gap-2 text-xl font-semibold tracking-tight",children:[a(gs,{className:"h-5 w-5 text-primary"}),Lp()]}),a(Ht,{children:V1()})]}),a(St,{children:s?a("div",{className:"flex h-48 items-center justify-center",children:a(K,{className:"h-7 w-7 animate-spin text-muted-foreground"})}):i?a("div",{className:"py-10 text-center text-sm text-destructive",children:Ms()}):n.length===0?g("div",{className:"flex flex-col items-center justify-center rounded-xl border-2 border-dashed border-border py-12 text-center",children:[a(gs,{className:"mb-3 h-10 w-10 text-muted-foreground/50"}),a("p",{className:"text-base font-medium text-foreground",children:Oh()}),a("p",{className:"mt-1 max-w-md text-sm text-muted-foreground",children:Mh()})]}):a("div",{className:"space-y-3",children:n.map((r)=>a(Ct,{teamId:e,rule:r},r.id))})})]})}L();var kt=Object.values(nu);function Re({teamId:e}){let[t,s]=w([]),[i,n]=w([]),[r,c]=w(""),{ref:u,inView:f}=Vt(),{data:v}=X({queryKey:["teams",e,"members"],queryFn:async()=>{let d=await R.api.teams[":teamId"].members.$get({param:{teamId:e},query:{}});if(!d.ok)return[];return await d.json()},enabled:!!e}),p=v||[],{data:b,isLoading:h,isError:l,fetchNextPage:C,hasNextPage:m,isFetchingNextPage:x}=Tt({queryKey:["teams",e,"audit-logs",t,i,r],queryFn:async({pageParam:d})=>{let N=await R.api.teams[":teamId"]["audit-logs"].$get({param:{teamId:e},query:{first:"20",after:d?String(d):void 0,actions:t.length>0?t:void 0,userIds:i.length>0?i:void 0,itemId:r.trim()||void 0}});if(!N.ok)throw Error("Failed to fetch audit logs");return await N.json()},initialPageParam:"",getNextPageParam:(d)=>d.pageInfo.endCursor||void 0,enabled:!!e});S(()=>{if(f&&m&&!x)C()},[f,m,x,C]);let T=b?.pages.flatMap((d)=>d.nodes)||[],k=b?.pages[0]?.total??0,_=(d)=>{s((N)=>N.includes(d)?N.filter((D)=>D!==d):[...N,d])},q=(d)=>{n((N)=>N.includes(d)?N.filter((D)=>D!==d):[...N,d])},I=(d)=>{if(d.includes("delete")||d.includes("remove")||d.includes("revoke"))return a(ve,{variant:"outline",className:"bg-destructive/10 text-destructive border-destructive/20 font-mono text-xs",children:d});if(d.includes("create")||d.includes("add"))return a(ve,{variant:"outline",className:"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-500/20 font-mono text-xs",children:d});if(d.includes("update")||d.includes("reparent")||d.includes("copy"))return a(ve,{variant:"outline",className:"bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20 font-mono text-xs",children:d});return a(ve,{variant:"outline",className:"bg-muted text-muted-foreground border-border font-mono text-xs",children:d})},J=new Map(p.map((d)=>[d.userId||d.id,d]));return a("div",{className:"space-y-6",children:g(ct,{className:"border border-border/50 shadow-xs",children:[g(Nt,{className:"pb-4",children:[g("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4",children:[g("div",{children:[g(Ft,{className:"text-xl font-bold flex items-center gap-2",children:[a(Li,{className:"h-5 w-5 text-primary"}),Vm()]}),a(Ht,{className:"mt-1",children:tw()})]}),k>0&&g(ve,{variant:"secondary",className:"w-fit text-xs font-normal",children:[k," ",Vm()]})]}),g("div",{className:"mt-4 flex flex-wrap items-center gap-3 pt-4 border-t border-border/40",children:[g(bt,{children:[a(wt,{asChild:!0,children:g(F,{variant:"outline",size:"sm",className:"h-9 gap-2 text-xs border-dashed",children:[a(P,{className:"h-3.5 w-3.5"}),yC(),t.length>0&&a(ve,{variant:"secondary",className:"ml-1 px-1.5 py-0 text-[10px]",children:t.length})]})}),g(Et,{className:"w-64 p-2",align:"start",children:[a("div",{className:"text-xs font-semibold text-muted-foreground px-2 py-1 mb-1",children:rR()}),a("div",{className:"max-h-60 overflow-y-auto space-y-1 pr-1",children:kt.map((d)=>g("label",{className:"flex items-center gap-2 px-2 py-1.5 hover:bg-accent rounded-md cursor-pointer text-xs",children:[a(Sr,{checked:t.includes(d),onCheckedChange:()=>_(d)}),a("span",{className:"font-mono",children:d})]},d))}),t.length>0&&a(F,{variant:"ghost",size:"sm",className:"w-full mt-2 h-7 text-xs text-muted-foreground hover:text-foreground",onClick:()=>s([]),children:"Clear Actions"})]})]}),g(bt,{children:[a(wt,{asChild:!0,children:g(F,{variant:"outline",size:"sm",className:"h-9 gap-2 text-xs border-dashed",children:[a(P,{className:"h-3.5 w-3.5"}),wC(),i.length>0&&a(ve,{variant:"secondary",className:"ml-1 px-1.5 py-0 text-[10px]",children:i.length})]})}),g(Et,{className:"w-64 p-2",align:"start",children:[a("div",{className:"text-xs font-semibold text-muted-foreground px-2 py-1 mb-1",children:AR()}),a("div",{className:"max-h-60 overflow-y-auto space-y-1 pr-1",children:p.map((d)=>{let N=d.userId||d.user?.id||d.id,D=d.user?.name||d.name||N,E=d.user?.image||d.image;return g("label",{className:"flex items-center gap-2 px-2 py-1.5 hover:bg-accent rounded-md cursor-pointer text-xs",children:[a(Sr,{checked:i.includes(N),onCheckedChange:()=>q(N)}),g($e,{className:"h-5 w-5",children:[a(He,{src:E||void 0}),a(Qe,{className:"text-[10px]",children:D.slice(0,2).toUpperCase()})]}),a("span",{className:"truncate",children:D})]},N)})}),i.length>0&&a(F,{variant:"ghost",size:"sm",className:"w-full mt-2 h-7 text-xs text-muted-foreground hover:text-foreground",onClick:()=>n([]),children:"Clear Users"})]})]}),g("div",{className:"relative flex-1 min-w-[200px] max-w-xs",children:[a(nr,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),a(re,{type:"text",placeholder:Xk(),value:r,onChange:(d)=>c(d.target.value),className:"pl-8 pr-8 h-9 text-xs"}),r&&a("button",{onClick:()=>c(""),className:"absolute right-2.5 top-2.5 text-muted-foreground hover:text-foreground",children:a(Ge,{className:"h-4 w-4"})})]}),(t.length>0||i.length>0||r)&&a(F,{variant:"ghost",size:"sm",className:"h-9 px-2 text-xs text-muted-foreground hover:text-foreground",onClick:()=>{s([]),n([]),c("")},children:"Clear all"})]})]}),g(St,{className:"p-0",children:[h?a("div",{className:"flex h-64 items-center justify-center",children:a(K,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):l?a("div",{className:"p-8 text-center text-sm text-destructive",children:"Failed to load audit logs."}):T.length===0?a("div",{className:"p-12 text-center text-sm text-muted-foreground",children:sT()}):g(Un,{children:[a(zn,{children:g(Tr,{className:"hover:bg-transparent border-b border-border/50",children:[a(vt,{className:"w-[180px] pl-6 text-xs font-semibold",children:Jy()}),a(vt,{className:"w-[200px] px-4 text-xs font-semibold",children:ZO()}),a(vt,{className:"px-4 text-xs font-semibold",children:xS()}),a(vt,{className:"px-4 text-xs font-semibold",children:k0()}),a(vt,{className:"w-[160px] pr-6 text-right text-xs font-semibold",children:rO()})]})}),a(jn,{children:T.map((d)=>{let N=d.userId?J.get(d.userId):null,D=N?.user?.name||N?.name||d.userId||"System",E=N?.user?.image||N?.image;return g(Tr,{className:"hover:bg-muted/40 transition-colors",children:[a(ut,{className:"py-3 pl-6 font-medium",children:I(d.action)}),a(ut,{className:"py-3 px-4",children:g("div",{className:"flex items-center gap-2",children:[g($e,{className:"h-6 w-6",children:[a(He,{src:E||void 0}),a(Qe,{className:"text-[10px]",children:D.slice(0,2).toUpperCase()})]}),a("span",{className:"text-xs font-medium text-foreground truncate max-w-[160px]",children:d.agent?Rd({user:D,agent:d.agent.name}):D}),d.agent&&a($t,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"})]})}),a(ut,{className:"py-3 px-4 text-xs font-mono text-muted-foreground",children:d.itemId||"-"}),a(ut,{className:"py-3 px-4 text-xs font-mono text-muted-foreground",children:d.projectId||"-"}),a(ut,{className:"py-3 pr-6 text-right text-xs text-muted-foreground",children:on(d.createdAt)})]},d.id)})})]}),a("div",{ref:u,className:"py-4 flex justify-center",children:x&&a(K,{className:"h-6 w-6 animate-spin text-muted-foreground"})})]})]})})}L();L();function De({task:e,open:t,onOpenChange:s}){let[i,n]=w(null);if(!e)return null;let r=(u,f)=>{navigator.clipboard.writeText(u),n(f),setTimeout(()=>{n(null)},2000)},c=(u)=>{switch(u){case"completed":return a(ve,{variant:"outline",className:"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-500/20 text-xs font-mono",children:"completed"});case"processing":return a(ve,{variant:"outline",className:"bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20 text-xs font-mono",children:"processing"});case"pending":return a(ve,{variant:"outline",className:"bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 border-yellow-500/20 text-xs font-mono",children:"pending"});case"failed":return a(ve,{variant:"outline",className:"bg-destructive/10 text-destructive border-destructive/20 text-xs font-mono",children:"failed"});default:return a(ve,{variant:"outline",className:"text-xs font-mono",children:u||"unknown"})}};return a(Se,{open:t,onOpenChange:s,children:g(xe,{className:"max-w-2xl max-h-[90vh] flex flex-col p-6",children:[g(ke,{className:"pb-2 border-b border-border/50",children:[g("div",{className:"flex items-center justify-between gap-2 pr-6",children:[g("div",{className:"flex items-center gap-2",children:[a(Pn,{className:"h-5 w-5 text-primary"}),a(Ce,{className:"text-lg font-bold",children:PM()})]}),g("div",{className:"flex items-center gap-2",children:[c(e.status),e.type&&a(ve,{variant:"secondary",className:"font-mono text-xs",children:e.type})]})]}),g(Ot,{className:"text-xs text-muted-foreground mt-1 flex items-center gap-2",children:[g("span",{children:[vy(),": ",a("span",{className:"font-mono text-foreground",children:e.id})]}),a(F,{variant:"ghost",size:"icon",className:"h-5 w-5 text-muted-foreground hover:text-foreground",onClick:()=>r(e.id,"task_id"),children:i==="task_id"?a(qe,{className:"h-3 w-3 text-emerald-500"}):a(Br,{className:"h-3 w-3"})})]})]}),g("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3 py-3 text-xs border-b border-border/40",children:[g("div",{children:[a("div",{className:"text-muted-foreground",children:ph()}),a("div",{className:"truncate font-medium text-foreground mt-0.5",title:e.fileName||"-",children:e.fileName||"-"})]}),g("div",{children:[a("div",{className:"text-muted-foreground",children:dy()}),a("div",{className:"font-mono truncate font-medium text-foreground mt-0.5",children:e.fileSize!==null&&e.fileSize!==void 0?Fr(e.fileSize):"-"})]}),g("div",{children:[a("div",{className:"text-muted-foreground",children:Tp()}),a("div",{className:"truncate font-medium text-foreground mt-0.5",title:e.projectName||"-",children:e.projectName||"-"})]}),g("div",{children:[a("div",{className:"text-muted-foreground",children:Gb()}),a("div",{className:"font-mono truncate font-medium text-foreground mt-0.5",children:e.assetId||"-"})]}),g("div",{children:[a("div",{className:"text-muted-foreground",children:k0()}),a("div",{className:"font-mono truncate font-medium text-foreground mt-0.5",children:e.projectId||"-"})]}),g("div",{children:[a("div",{className:"text-muted-foreground",children:up()}),g("div",{className:"font-medium text-foreground mt-0.5 flex items-center gap-1",children:[a(ur,{className:"h-3 w-3 text-muted-foreground"}),on(e.createdAt)]})]}),g("div",{children:[a("div",{className:"text-muted-foreground",children:MO()}),a("div",{className:"font-medium text-foreground mt-0.5",children:on(e.updatedAt)})]}),e.heartbeat&&g("div",{children:[a("div",{className:"text-muted-foreground",children:aS()}),a("div",{className:"font-medium text-foreground mt-0.5",children:on(e.heartbeat)})]}),e.model&&g("div",{children:[a("div",{className:"text-muted-foreground",children:Ch()}),a("div",{className:"font-mono truncate font-medium text-foreground mt-0.5",children:e.model})]}),(e.inputTokens>0||e.outputTokens>0)&&g("div",{children:[g("div",{className:"text-muted-foreground flex items-center gap-1",children:[a(eo,{className:"h-3 w-3"})," ",lO()]}),g("div",{className:"font-medium text-foreground mt-0.5 font-mono",children:[e.inputTokens.toLocaleString()," in / ",e.outputTokens.toLocaleString()," out"]})]}),e.sessionId&&g("div",{className:"col-span-2",children:[a("div",{className:"text-muted-foreground",children:TR()}),a("div",{className:"font-mono truncate font-medium text-foreground mt-0.5",children:e.sessionId})]})]}),a("div",{className:"flex-1 min-h-0 pt-3",children:g(co,{defaultValue:"payload",className:"w-full h-full flex flex-col",children:[g(uo,{className:"grid w-full grid-cols-2",children:[a(Jr,{value:"payload",children:u1()}),a(Jr,{value:"output",children:XT()})]}),a(gn,{value:"payload",className:"flex-1 mt-2 min-h-0",children:a(Ie,{className:"h-64 w-full rounded-md border border-border/50 bg-muted/30 p-3 font-mono text-xs",children:a("pre",{className:"whitespace-pre-wrap break-all text-foreground/90",children:e.payload?JSON.stringify(e.payload,null,2):"null"})})}),a(gn,{value:"output",className:"flex-1 mt-2 min-h-0",children:a(Ie,{className:"h-64 w-full rounded-md border border-border/50 bg-muted/30 p-3 font-mono text-xs",children:a("pre",{className:"whitespace-pre-wrap break-all text-foreground/90",children:e.output?JSON.stringify(e.output,null,2):"null"})})})]})})]})})}var Rt=Object.values(Hl),Dt=Object.values(Ql);function Pe({teamId:e}){let t=ie(),[s,i]=w([]),[n,r]=w([]),[c,u]=w(null),[f,v]=w(null),{ref:p,inView:b}=Vt(),h=Q(()=>["teams",e,"workflow-tasks",s,n],[e,s,n]),{data:l,isLoading:C,isError:m,fetchNextPage:x,hasNextPage:T,isFetchingNextPage:k,refetch:_,isRefetching:q}=Tt({queryKey:h,queryFn:async({pageParam:o})=>{let y=await R.api.teams[":teamId"]["workflow-tasks"].$get({param:{teamId:e},query:{first:"20",after:o?String(o):void 0,status:s.length>0?s:void 0,types:n.length>0?n:void 0}});if(!y.ok)throw Error("Failed to fetch workflow tasks");return await y.json()},initialPageParam:"",getNextPageParam:(o)=>o.pageInfo.endCursor||void 0,enabled:!!e});S(()=>{if(b&&T&&!k)x()},[b,T,k,x]);let I=Q(()=>l?.pages.flatMap((o)=>o.nodes)||[],[l]),J=l?.pages[0]?.total??0,d=Q(()=>I.filter((o)=>o.status==="pending"||o.status==="processing").map((o)=>o.id),[I]);X({queryKey:["teams",e,"workflow-tasks","batch-status",d],queryFn:async()=>{if(d.length===0)return null;let o=await R.api.teams[":teamId"]["workflow-tasks"]["batch-status"].$post({param:{teamId:e},json:{taskIds:d}});if(!o.ok)return null;let y=await o.json();if(y.tasks&&y.tasks.length>0)t.setQueryData(h,(A)=>{if(!A)return A;let Z=new Map(y.tasks.map((O)=>[O.id,O]));return{...A,pages:A.pages.map((O)=>({...O,nodes:O.nodes.map((le)=>Z.get(le.id)||le)}))}});return y},enabled:d.length>0,refetchInterval:6000});let N=ee({mutationFn:async(o)=>{let y=await R.api.teams[":teamId"]["workflow-tasks"][":taskId"].stop.$post({param:{teamId:e,taskId:o}});if(!y.ok){let A=await y.json().catch(()=>({message:"Failed to stop task"}));throw Error(A.message||"Failed to stop task")}return await y.json()},onSuccess:(o)=>{j.success(DM()),t.setQueryData(h,(y)=>{if(!y)return y;return{...y,pages:y.pages.map((A)=>({...A,nodes:A.nodes.map((Z)=>Z.id===o.task.id?o.task:Z)}))}}),u(null)},onError:(o)=>{j.error(o.message||"Failed to stop task")}}),D=(o)=>{i((y)=>y.includes(o)?y.filter((A)=>A!==o):[...y,o])},E=(o)=>{r((y)=>y.includes(o)?y.filter((A)=>A!==o):[...y,o])},Ee=(o)=>{switch(o){case"completed":return a(ve,{variant:"outline",className:"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-500/20 font-mono text-xs",children:"completed"});case"processing":return g(ve,{variant:"outline",className:"bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20 font-mono text-xs gap-1.5",children:[a(K,{className:"h-3 w-3 animate-spin"}),"processing"]});case"pending":return a(ve,{variant:"outline",className:"bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 border-yellow-500/20 font-mono text-xs",children:"pending"});case"failed":return a(ve,{variant:"outline",className:"bg-destructive/10 text-destructive border-destructive/20 font-mono text-xs",children:"failed"});default:return a(ve,{variant:"outline",className:"font-mono text-xs",children:o||"-"})}},Oe=(o)=>{if(!o)return a(ve,{variant:"outline",children:"-"});if(o.startsWith("transcode"))return a(ve,{variant:"outline",className:"bg-purple-500/10 text-purple-600 dark:text-purple-400 border-purple-500/20 font-mono text-xs",children:o});if(o.startsWith("ai_")||o==="chat")return a(ve,{variant:"outline",className:"bg-indigo-500/10 text-indigo-600 dark:text-indigo-400 border-indigo-500/20 font-mono text-xs",children:o});return a(ve,{variant:"secondary",className:"font-mono text-xs",children:o})};return g("div",{className:"space-y-6",children:[g(ct,{className:"border border-border/50 shadow-xs",children:[g(Nt,{className:"pb-4",children:[g("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4",children:[g("div",{children:[g(Ft,{className:"text-xl font-bold flex items-center gap-2",children:[a(ae,{className:"h-5 w-5 text-primary"}),yg()]}),a(Ht,{className:"mt-1",children:sP()})]}),g("div",{className:"flex items-center gap-3",children:[J>0&&g(ve,{variant:"secondary",className:"w-fit text-xs font-normal",children:[J," ",yg()]}),g(F,{variant:"outline",size:"sm",className:"h-9 gap-1.5 text-xs",onClick:()=>_(),disabled:q,children:[a(be,{className:`h-3.5 w-3.5 ${q?"animate-spin":""}`}),xk()]})]})]}),g("div",{className:"mt-4 flex flex-wrap items-center gap-3 pt-4 border-t border-border/40",children:[g(bt,{children:[a(wt,{asChild:!0,children:g(F,{variant:"outline",size:"sm",className:"h-9 gap-2 text-xs border-dashed",children:[a(P,{className:"h-3.5 w-3.5"}),vC(),s.length>0&&a(ve,{variant:"secondary",className:"ml-1 px-1.5 py-0 text-[10px]",children:s.length})]})}),g(Et,{className:"w-56 p-2",align:"start",children:[a("div",{className:"text-xs font-semibold text-muted-foreground px-2 py-1 mb-1",children:hR()}),a("div",{className:"space-y-1",children:Dt.map((o)=>g("label",{className:"flex items-center gap-2 px-2 py-1.5 hover:bg-accent rounded-md cursor-pointer text-xs",children:[a(Sr,{checked:s.includes(o),onCheckedChange:()=>D(o)}),a("span",{className:"font-mono",children:o})]},o))}),s.length>0&&a(F,{variant:"ghost",size:"sm",className:"w-full mt-2 h-7 text-xs text-muted-foreground hover:text-foreground",onClick:()=>i([]),children:Dw()})]})]}),g(bt,{children:[a(wt,{asChild:!0,children:g(F,{variant:"outline",size:"sm",className:"h-9 gap-2 text-xs border-dashed",children:[a(P,{className:"h-3.5 w-3.5"}),bC(),n.length>0&&a(ve,{variant:"secondary",className:"ml-1 px-1.5 py-0 text-[10px]",children:n.length})]})}),g(Et,{className:"w-64 p-2",align:"start",children:[a("div",{className:"text-xs font-semibold text-muted-foreground px-2 py-1 mb-1",children:rg()}),a("div",{className:"max-h-60 overflow-y-auto space-y-1 pr-1",children:Rt.map((o)=>g("label",{className:"flex items-center gap-2 px-2 py-1.5 hover:bg-accent rounded-md cursor-pointer text-xs",children:[a(Sr,{checked:n.includes(o),onCheckedChange:()=>E(o)}),a("span",{className:"font-mono truncate",children:o})]},o))}),n.length>0&&a(F,{variant:"ghost",size:"sm",className:"w-full mt-2 h-7 text-xs text-muted-foreground hover:text-foreground",onClick:()=>r([]),children:Nw()})]})]}),(s.length>0||n.length>0)&&a(F,{variant:"ghost",size:"sm",className:"h-9 px-2 text-xs text-muted-foreground hover:text-foreground",onClick:()=>{i([]),r([])},children:Rw()})]})]}),g(St,{className:"p-0",children:[C?a("div",{className:"flex h-64 items-center justify-center",children:a(K,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):m?a("div",{className:"p-8 text-center text-sm text-destructive",children:Gx()}):I.length===0?a("div",{className:"p-12 text-center text-sm text-muted-foreground",children:IT()}):g(Un,{children:[a(zn,{children:g(Tr,{className:"hover:bg-transparent border-b border-border/50",children:[a(vt,{className:"w-[170px] pl-6 text-xs font-semibold",children:Cy()}),a(vt,{className:"w-[130px] px-4 text-xs font-semibold",children:wy()}),a(vt,{className:"min-w-[180px] px-4 text-xs font-semibold",children:ph()}),a(vt,{className:"w-[110px] px-4 text-xs font-semibold",children:dy()}),a(vt,{className:"w-[160px] px-4 text-xs font-semibold",children:Tp()}),a(vt,{className:"w-[130px] px-4 text-right text-xs font-semibold",children:up()}),a(vt,{className:"w-[120px] pr-6 text-right text-xs font-semibold",children:zm()})]})}),a(jn,{children:I.map((o)=>{let y=o.status==="pending"||o.status==="processing";return g(Tr,{className:"hover:bg-muted/40 transition-colors",children:[a(ut,{className:"py-3 pl-6 font-medium",children:Oe(o.type)}),a(ut,{className:"py-3 px-4 font-medium",children:Ee(o.status)}),a(ut,{className:"py-3 px-4 text-xs font-medium",children:a("span",{className:"truncate block max-w-[220px]",title:o.fileName||o.assetId||"-",children:o.fileName||o.assetId||"-"})}),a(ut,{className:"py-3 px-4 text-xs font-mono text-muted-foreground",children:o.fileSize!==null&&o.fileSize!==void 0?Fr(o.fileSize):"-"}),a(ut,{className:"py-3 px-4 text-xs text-muted-foreground",children:a("span",{className:"truncate block max-w-[160px]",title:o.projectName||o.projectId||"-",children:o.projectName||o.projectId||"-"})}),a(ut,{className:"py-3 px-4 text-right text-xs text-muted-foreground whitespace-nowrap",children:on(o.createdAt)}),a(ut,{className:"py-3 pr-6 text-right",children:g("div",{className:"flex items-center justify-end gap-1",children:[a(F,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 text-muted-foreground hover:text-foreground",onClick:()=>v(o),title:$O(),children:a(ge,{className:"h-4 w-4"})}),y&&g(F,{variant:"outline",size:"sm",className:"h-8 px-2 text-xs border-destructive/30 text-destructive hover:bg-destructive/10",onClick:()=>u(o),disabled:N.isPending,children:[a(bu,{className:"h-3 w-3 mr-1 fill-current"}),Ay()]})]})})]},o.id)})})]}),a("div",{ref:p,className:"py-4 flex justify-center",children:k&&a(K,{className:"h-6 w-6 animate-spin text-muted-foreground"})})]})]}),a(dt,{open:!!c,onOpenChange:(o)=>{if(!o)u(null)},children:g(ft,{children:[g(pt,{children:[g("div",{className:"flex items-center gap-2",children:[a(rn,{className:"h-5 w-5 text-destructive"}),a(ht,{children:uM()})]}),a(gt,{className:"pt-2 text-sm text-muted-foreground",children:cM()}),c&&g("div",{className:"mt-3 p-2.5 rounded-md bg-muted/50 border border-border/40 font-mono text-xs space-y-1",children:[g("div",{children:[vy(),": ",c.id]}),c.fileName&&g("div",{className:"font-sans",children:[ph(),":"," ",a("span",{className:"font-medium text-foreground",children:c.fileName})]}),g("div",{children:[Cy(),": ",c.type||"unknown"]}),g("div",{children:[wy(),": ",c.status]})]})]}),g(mt,{children:[a(_t,{disabled:N.isPending,children:Ve()}),a(At,{className:"bg-destructive hover:bg-destructive/90 text-destructive-foreground",disabled:N.isPending,onClick:()=>{if(c)N.mutate(c.id)},children:N.isPending?g(W,{children:[a(K,{className:"h-3.5 w-3.5 animate-spin mr-1.5"}),dM()]}):Ay()})]})]})}),a(De,{task:f,open:!!f,onOpenChange:(o)=>{if(!o)v(null)}})]})}function qt(){let{teamId:e}=It.useParams(),[t,s]=w("audit-logs"),{data:i,isLoading:n}=X({queryKey:["teams",e,"me"],queryFn:async()=>{let r=await R.api.teams[":teamId"].me.$get({param:{teamId:e}});if(!r.ok)throw Error("Failed to fetch me");return await r.json()},enabled:!!e});if(n)return a("div",{className:"flex h-screen items-center justify-center",children:a(K,{className:"h-8 w-8 animate-spin text-muted-foreground"})});if(i?.role?.toLowerCase()!=="owner")return g("div",{className:"flex h-full flex-col items-center justify-center p-8 text-center",children:[a(lu,{className:"h-12 w-12 text-destructive mb-4"}),a("h2",{className:"text-xl font-bold tracking-tight mb-2",children:Wy()}),a("p",{className:"text-sm text-muted-foreground max-w-md",children:OT()})]});return a("div",{className:"h-full bg-background font-sans selection:bg-primary/20 transition-colors duration-300",children:g("div",{className:"flex flex-col md:flex-row h-full",children:[a("div",{className:"w-full h-full md:w-72 bg-sidebar border-b md:border-b-0 md:border-r border-sidebar-border z-10 md:left-16 overflow-y-auto transition-colors duration-300",children:g("nav",{className:"p-4 space-y-1 mt-4",children:[a("div",{className:"mb-2 px-4 text-xs font-semibold text-sidebar-foreground/60 uppercase tracking-wider",children:d_()}),a("div",{className:"mt-4 mb-2 px-4 text-xs font-semibold text-sidebar-foreground/60 uppercase tracking-wider pt-4 border-t border-sidebar-border",children:LM()}),g("button",{onClick:()=>s("audit-logs"),className:B("w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all",t==="audit-logs"?"bg-sidebar-accent text-sidebar-accent-foreground ring-1 ring-sidebar-border":"text-sidebar-foreground/75 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"),children:[a(Li,{className:"w-5 h-5"}),Vm(),t==="audit-logs"&&a("div",{className:"ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary"})]}),g("button",{onClick:()=>s("workflow-tasks"),className:B("w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all",t==="workflow-tasks"?"bg-sidebar-accent text-sidebar-accent-foreground ring-1 ring-sidebar-border":"text-sidebar-foreground/75 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"),children:[a(ae,{className:"w-5 h-5"}),yg(),t==="workflow-tasks"&&a("div",{className:"ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary"})]}),g("button",{onClick:()=>s("quotas"),className:B("w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all",t==="quotas"?"bg-sidebar-accent text-sidebar-accent-foreground ring-1 ring-sidebar-border":"text-sidebar-foreground/75 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"),children:[a(gs,{className:"w-5 h-5"}),Lp(),t==="quotas"&&a("div",{className:"ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary"})]}),a("div",{className:"mt-4 mb-2 px-4 text-xs font-semibold text-sidebar-foreground/60 uppercase tracking-wider pt-4 border-t border-sidebar-border",children:Eb()}),g("button",{onClick:()=>s("ai-usage"),className:B("w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all",t==="ai-usage"?"bg-sidebar-accent text-sidebar-accent-foreground ring-1 ring-sidebar-border":"text-sidebar-foreground/75 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"),children:[a(fe,{className:"w-5 h-5"}),LO(),t==="ai-usage"&&a("div",{className:"ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary"})]}),g("button",{onClick:()=>s("ai-sessions"),className:B("w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all",t==="ai-sessions"?"bg-sidebar-accent text-sidebar-accent-foreground ring-1 ring-sidebar-border":"text-sidebar-foreground/75 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"),children:[a(V,{className:"w-5 h-5"}),uy(),t==="ai-sessions"&&a("div",{className:"ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary"})]})]})}),a("div",{className:"flex-1 overflow-y-auto p-4 md:p-8",children:g("div",{className:"max-w-6xl mx-auto space-y-8",children:[t==="audit-logs"&&a(Re,{teamId:e}),t==="workflow-tasks"&&a(Pe,{teamId:e}),t==="ai-usage"&&a(he,{teamId:e}),t==="ai-sessions"&&a(Ne,{teamId:e}),t==="quotas"&&a(Ae,{teamId:e})]})})]})})}var It=Je("/teams/$teamId/dashboard")({component:qt});export{It as Route};
@@ -1,3 +0,0 @@
1
- // @bun
2
- function Qn(n){let e={};for(let[t,r]of n.entries())e[t]=r;return e}function Fa(n){if(!n)return;let e={};for(let[t,r]of Object.entries(n))if(r!==null)e[t]=r;return Object.keys(e).length>0?e:void 0}
3
- export{Qn,Fa};
@@ -1,3 +0,0 @@
1
- // @bun
2
- function Bs(_){if(_===void 0)return;let n=Array.from(_);if(n.length<=64)return _;return n.slice(0,64).join("")}
3
- export{Bs};
@@ -1 +0,0 @@
1
- import{S,L,a,X,Je,R,Pt,qt,Ng}from"./chunk-5ngftxjb.js";import"./chunk-9405hzv2.js";import"./chunk-qm50g4n5.js";import"./chunk-ffjdkdcv.js";import"./chunk-d55138xx.js";import{Wl}from"./chunk-zx1c4vm5.js";import"./chunk-j2txsbxz.js";import"./chunk-c8frmqsk.js";import"./chunk-a859y4e1.js";import"./chunk-sz5zawfw.js";import{Ar}from"./chunk-b3t7gbhm.js";import"./chunk-0a298n62.js";import"./chunk-s1j4v33x.js";L();function m(){let{projectId:e,folderId:s}=c.useParams(),{teamId:r,ensureTeamIdForProject:t}=Pt();S(()=>{t(e)},[e,t]);let{data:d}=Ar(Ng(e)),o=d?.rootFolder,{data:f}=X({queryKey:["folders",o],queryFn:async()=>{let n=await R.api.folders[":folderId"].$get({param:{folderId:o}});if(!n.ok)throw Error("failed to fetch folder");return await n.json()},enabled:!!o});if(!r||!o||!f)return a(qt,{});return a(Wl,{teamId:r,projectId:e,projectName:d.name??"",assetId:s,rootFolderId:o,isRoot:!1})}var c=Je("/projects/$projectId/folders/$folderId_/agentsmd")({component:m});export{c as Route};
@@ -1 +0,0 @@
1
- import{G,S,Q,M,w,L,W,a,g,ie,X,ee,Tt,Je,R,z,K,qe,On,jt,Do,No,ps,Re,Ue,Ge,F,De,Ne,Fe,de,xn,dr,jm,wA,$m,Mb,Ob,Qm,Gm,Ve,Bw,Xa,tE,nE,c_,Mt,nh,cx,xx,x_,Mx,Nx,Fx,Lx,Zx,Bx,Ll,pa,ma,uh,Zl,hC,CC,XC,mS,gS,OS,DS,NS,bp,LI,xT,ST,DT,FT,Fh,b0,Lh,_1,y1,Jc,kk,Uk,wo,Hk,tR,oR,iy,ql,Sd,Yc,sg,ig,ag,Xc,Id,Td,lg,cg,kd,jM,qM,$M,HM,GM,Yn,_g,NO,FO,tu,Ly,QO,GO,VO,KO,WO,Se,xe,ke,ot,Ce,re,Ie,Pt,an,Xn,Eo,Md,j,$r,Bn,fe,Ke,Xe,et,tt,rt,be,_a,lr,Lr,qt,Og}from"./chunk-5ngftxjb.js";import{tc}from"./chunk-ajq9sxg0.js";import{Bd,Ea}from"./chunk-1tar0x8s.js";import{_s}from"./chunk-34f64q0q.js";import"./chunk-qvp24w0q.js";import"./chunk-9405hzv2.js";import"./chunk-20w1w9x7.js";import{Yr}from"./chunk-d55138xx.js";import{al,uu}from"./chunk-50pfmxt1.js";import{iu,au}from"./chunk-20bamhwa.js";import{ll}from"./chunk-j2txsbxz.js";import{fu}from"./chunk-f8hgy69t.js";import{Ar}from"./chunk-b3t7gbhm.js";import{mu}from"./chunk-y5dv67mg.js";import"./chunk-etrm28sy.js";import"./chunk-0a298n62.js";import"./chunk-pdw77q09.js";import{zo}from"./chunk-femnbfkj.js";import"./chunk-25npafhz.js";import{jo}from"./chunk-88jg9dq5.js";import{Br}from"./chunk-7kah3zb5.js";L();var bt=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],it=z("folder-open",bt);var yt=[["path",{d:"M2 5h20",key:"1fs1ex"}],["path",{d:"M6 12h12",key:"8npq4p"}],["path",{d:"M9 19h6",key:"456am0"}]],lt=z("list-filter",yt);L();function Nt({ratio:t}){switch(t){case"16:9":return a("span",{className:"inline-block w-4 h-2.5 border border-current rounded-[1px] shrink-0"});case"9:16":return a("span",{className:"inline-block w-2.5 h-4 border border-current rounded-[1px] shrink-0"});case"4:3":return a("span",{className:"inline-block w-3.5 h-2.5 border border-current rounded-[1px] shrink-0"});case"3:4":return a("span",{className:"inline-block w-2.5 h-3.5 border border-current rounded-[1px] shrink-0"});case"1:1":return a("span",{className:"inline-block w-3 h-3 border border-current rounded-[1px] shrink-0"});default:return a("span",{className:"inline-block w-4 h-2.5 border border-current rounded-[1px] shrink-0"})}}function at(){return Math.random().toString(36).substring(2,9)}function dt(){return{id:at(),type:"text",text:"CONFIDENTIAL",x:0.5,y:0.5,size:0.05,color:"#999999",opacity:0.5,rotation:-30}}function kt(){return{id:at(),type:"image",imageAssetKey:"",x:0.5,y:0.5,size:0.15,opacity:0.5,rotation:0}}var Ze=[{id:"dark",label:"Dark Slate",bg:"#1e293b",dot:"#475569"},{id:"black",label:"Black",bg:"#000000",dot:"#404040"},{id:"gray",label:"Slate Gray",bg:"#64748b",dot:"#cbd5e1"},{id:"white",label:"White",bg:"#ffffff",dot:"#94a3b8"},{id:"green",label:"Chroma Green",bg:"#059669",dot:"#047857"}],St={"16:9":1.7777777777777777,"9:16":0.5625,"4:3":1.3333333333333333,"3:4":0.75,"1:1":1};function mt({open:t,onOpenChange:b,initialConfig:f,shareId:m,teamId:y,onSaveSuccess:x}){let D=ie(),[l,v]=w([]),[d,p]=w(null),[B,E]=w(null),[N,oe]=w("16:9"),[le,ce]=w("grid"),[ge,U]=w(!1),[ne,te]=w("new"),[se,V]=w(""),[H,Y]=w(null),k=M(null),J=M(null),[Z,ve]=w({w:0,h:0}),[_,A]=w(!1),s=G((e)=>{if(J.current=e,!e)return;let i=()=>{let{clientWidth:C,clientHeight:h}=e;if(C<=0||h<=0)return;let P=St[N],Ye=C,Te=Ye/P;if(Te>h)Te=h,Ye=Te*P;ve({w:Math.round(Ye),h:Math.round(Te)})};i();let o=new ResizeObserver(i);return o.observe(e),()=>{o.disconnect(),J.current=null}},[N]),q=Pt((e)=>e.teamId),me=y||q,[Ee,ye]=w(!1),[O,he]=w({}),ae=M(null),ue=R.api.teams[":teamId"].files.$post,we=async(e,i)=>{let o=e.target.files?.[0];if(!o)return;if(o.size>1048576){if(j.error(hC()),ae.current)ae.current.value="";return}if(!me){j.error(ma());return}ye(!0);let C=URL.createObjectURL(o);he((h)=>({...h,[i]:C}));try{let h=await ue({param:{teamId:me},form:{file:o}});if(!h.ok)throw Error(ma());let P=await h.json();I(i,{imageAssetKey:P.key,imageAssetUrl:P.url})}catch(h){let P=h instanceof Error?h.message:ma();j.error(P)}finally{if(ye(!1),ae.current)ae.current.value=""}};S(()=>{if(t){if(f?.blocks&&f.blocks.length>0)v(f.blocks),p(f.blocks[0].id);else{let e=dt();v([e]),p(e.id)}E(null)}},[t,f]);let{data:T=[]}=X({queryKey:["watermark-templates",y],queryFn:async()=>{let e=await R.api["watermark-templates"].$get({query:y?{teamId:y}:{}});if(!e.ok)return[];return await e.json()},enabled:t}),_e=R.api.shares[":shareId"].watermark.$put,{mutate:pe,isPending:Ae}=ee({mutationFn:async(e)=>{let i=await _e({param:{shareId:m},json:{enabled:!0,config:e}});if(!i.ok){let o=await i.json().catch(()=>null);throw Error(o?.error||pa())}return await i.json()},onSuccess:()=>{D.invalidateQueries({queryKey:["share",m]}),D.invalidateQueries({queryKey:["shares"]}),j.success(WO()),b(!1),x?.()},onError:(e)=>{j.error(e.message||pa())}}),We=R.api["watermark-templates"].$post,{mutate:ze,isPending:Le}=ee({mutationFn:async({name:e,config:i})=>{let o=await We({json:{name:e,teamId:y||void 0,config:i}});if(!o.ok)throw Error(pa());return await o.json()},onSuccess:(e)=>{D.invalidateQueries({queryKey:["watermark-templates"]}),E(e.id),U(!1),j.success($M())},onError:()=>{j.error(pa())}}),$e=R.api["watermark-templates"][":templateId"].$put,{mutate:Me,isPending:Oe}=ee({mutationFn:async({templateId:e,config:i})=>{let o=await $e({param:{templateId:e},json:{config:i}});if(!o.ok)throw Error(pa());return await o.json()},onSuccess:()=>{D.invalidateQueries({queryKey:["watermark-templates"]}),U(!1),j.success(HM())},onError:()=>{j.error(pa())}}),r=R.api["watermark-templates"][":templateId"].$delete,{mutate:c}=ee({mutationFn:async(e)=>{if(!(await r({param:{templateId:e}})).ok)throw Error(Ll())},onSuccess:(e,i)=>{if(D.invalidateQueries({queryKey:["watermark-templates"]}),B===i)E(null);j.success(jM())},onError:()=>{j.error(Ll())}}),u=l.findIndex((e)=>e.id===d),n=u>=0?l[u]:null,Be=()=>{let e=dt();v((i)=>[...i,e]),p(e.id)},pt=()=>{let e=kt();v((i)=>[...i,e]),p(e.id)},nt=(e)=>{if(!e)return;v((i)=>{let o=i.filter((C)=>C.id!==e);if(d===e)p(o.length>0?o[Math.max(0,u-1)].id:null);return o})},I=(e,i)=>{v((o)=>o.map((C)=>C.id===e?{...C,...i}:C))},ft=()=>{if(l.length===0)return;let e=(u-1+l.length)%l.length;p(l[e].id)},gt=()=>{if(l.length===0)return;let e=(u+1)%l.length;p(l[e].id)},xt=(e,i)=>{e.stopPropagation(),p(i),A(!0)},Qe=G((e)=>{if(!_||!d||!k.current)return;let i=k.current.getBoundingClientRect(),o=(e.clientX-i.left)/i.width,C=(e.clientY-i.top)/i.height,h=Math.max(0,Math.min(1,Math.round(o*100)/100)),P=Math.max(0,Math.min(1,Math.round(C*100)/100));I(d,{x:h,y:P})},[_,d]),He=G(()=>{A(!1)},[]);S(()=>{if(_)window.addEventListener("mousemove",Qe),window.addEventListener("mouseup",He);return()=>{window.removeEventListener("mousemove",Qe),window.removeEventListener("mouseup",He)}},[_,Qe,He]),S(()=>{let e=(i)=>{if(!t||!d)return;let o=i.target?.tagName?.toLowerCase();if(o==="input"||o==="textarea"||o==="select")return;if(i.key==="Delete"||i.key==="Backspace")i.preventDefault(),nt(d)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t,d,u]);let vt=(e)=>{if(e.config?.blocks&&e.config.blocks.length>0){let i=e.config.blocks.map((o)=>({...o,id:at()}));v(i),p(i[0].id),E(e.id)}},ht=()=>{if(l.length===0){j.error(ST());return}pe({blocks:l})},wt=()=>{if(ne==="new"){if(!se.trim()){j.error(x_());return}ze({name:se.trim(),config:{blocks:l}})}else{let e=H||B;if(!e){j.error(iy());return}Me({templateId:e,config:{blocks:l}})}};return g(W,{children:[a(Se,{open:t,onOpenChange:b,children:g(xe,{showCloseButton:!1,className:"sm:max-w-[1400px] max-w-[95vw] w-[95vw] h-[88vh] flex flex-col p-0 gap-0 overflow-hidden",onPointerDownOutside:(e)=>e.preventDefault(),children:[g("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border bg-card",children:[a("div",{className:"flex items-center gap-3",children:a(Ce,{className:"text-base font-semibold",children:GO()})}),g("div",{className:"flex items-center gap-2",children:[g(De,{modal:!1,children:[a(Ne,{asChild:!0,children:g(F,{variant:"outline",size:"sm",className:"gap-2 text-xs",children:[a(it,{className:"h-4 w-4 text-muted-foreground"}),VO()]})}),g(Fe,{align:"end",className:"w-56",children:[a(xn,{className:"text-xs font-semibold text-muted-foreground",children:NS()}),T.length===0?a("div",{className:"px-2 py-1.5 text-xs text-muted-foreground italic",children:xT()}):T.map((e)=>g(de,{onClick:()=>vt(e),className:"flex items-center justify-between text-xs cursor-pointer",children:[a("span",{className:"truncate flex-1",children:e.name}),B===e.id&&a(qe,{className:"h-3.5 w-3.5 text-primary ml-2 flex-shrink-0"}),a(F,{variant:"ghost",size:"icon",className:"h-5 w-5 hover:bg-destructive/10 hover:text-destructive ml-1",onClick:(i)=>{i.stopPropagation(),c(e.id)},children:a(Ue,{className:"h-3 w-3"})})]},e.id)),a(dr,{}),g(de,{onClick:()=>{te("new"),V(""),U(!0)},className:"text-xs gap-2 cursor-pointer",children:[a(Re,{className:"h-3.5 w-3.5 text-primary"}),c_()]}),T.length>0&&g(de,{onClick:()=>{te("overwrite"),Y(B||T[0].id),U(!0)},className:"text-xs gap-2 cursor-pointer",children:[a(ll,{className:"h-3.5 w-3.5 text-muted-foreground"}),b0()]})]})]}),a(F,{variant:"outline",size:"sm",className:"text-xs",onClick:()=>b(!1),children:Ve()}),g(F,{size:"sm",className:"text-xs bg-primary hover:bg-primary/90 text-primary-foreground gap-1.5",disabled:Ae,onClick:ht,children:[a(ll,{className:"h-3.5 w-3.5"}),Hk()]})]})]}),g("div",{className:"flex-1 flex overflow-hidden",children:[g("div",{className:"w-[65%] flex flex-col p-4 bg-muted/20 border-r border-border overflow-hidden select-none",children:[g("div",{className:"flex items-center justify-between mb-3",children:[a("div",{className:"flex items-center gap-1 bg-muted/60 p-1 rounded-md border border-border/60",children:["16:9","9:16","4:3","3:4","1:1"].map((e)=>g(F,{variant:N===e?"secondary":"ghost",size:"sm",className:Pe("h-7 px-2.5 text-xs gap-1.5 font-mono transition-all",N===e?"bg-background shadow-xs font-semibold text-foreground border border-border/50":"text-muted-foreground hover:text-foreground"),onClick:()=>oe(e),children:[a(Nt,{ratio:e}),a("span",{children:e})]},e))}),a("div",{className:"flex items-center gap-1.5 bg-background border border-border/60 rounded-md p-1",children:Ze.map((e)=>a("button",{type:"button",onClick:()=>ce(e.id),style:{backgroundColor:e.bg},className:Pe("w-5 h-5 rounded-full border border-border/80 transition-all cursor-pointer relative",le===e.id?"ring-2 ring-primary ring-offset-1 scale-110":"hover:scale-105 opacity-80 hover:opacity-100"),title:e.label},e.id))})]}),a("div",{ref:s,className:"flex-1 flex items-center justify-center overflow-hidden",children:(()=>{let e=Ze.find((o)=>o.id===le)||Ze[0],i=Z.w>0&&Z.h>0;return a("div",{ref:k,onClick:()=>p(null),style:{backgroundColor:e.bg,backgroundImage:`radial-gradient(${e.dot} 1px, transparent 1px)`,backgroundSize:"16px 16px",...i?{width:Z.w,height:Z.h}:{}},className:Pe("relative rounded-lg border border-border overflow-hidden shadow-inner transition-all",N==="16:9"&&"aspect-[16/9] w-full max-h-full",N==="9:16"&&"aspect-[9/16] h-full max-w-full",N==="4:3"&&"aspect-[4/3] w-full max-h-full",N==="3:4"&&"aspect-[3/4] h-full max-w-full",N==="1:1"&&"aspect-square h-full max-w-full"),children:l.map((o)=>{let C=o.id===d,h=o.size*(Z.w||640);return a("div",{onMouseDown:(P)=>xt(P,o.id),onClick:(P)=>{P.stopPropagation(),p(o.id)},style:{left:`${o.x*100}%`,top:`${o.y*100}%`,transform:`translate(-50%, -50%) rotate(${o.rotation}deg)`,opacity:o.opacity},className:Pe("absolute cursor-move select-none transition-shadow rounded p-1.5 flex items-center justify-center",C?"ring-2 ring-primary ring-offset-2 ring-offset-background/80 bg-primary/10":"hover:ring-1 hover:ring-muted-foreground/50"),children:o.type==="text"?a("span",{style:{fontSize:`${h}px`,color:o.color,lineHeight:1,whiteSpace:"nowrap",fontWeight:700,textShadow:"0 1px 3px rgba(0,0,0,0.5)"},children:o.text||"Text"}):a("div",{style:{width:`${h}px`,height:`${h}px`},className:"bg-primary/20 border border-primary/40 rounded flex items-center justify-center p-1 overflow-hidden",children:O[o.id]||o.imageAssetUrl?a("img",{src:O[o.id]||o.imageAssetUrl,alt:"Watermark logo",className:"w-full h-full object-contain pointer-events-none"}):a(Do,{className:"h-1/2 w-1/2 opacity-70 text-primary"})})},o.id)})})})()})]}),g("div",{className:"w-[35%] flex flex-col bg-card overflow-hidden border-l border-border",children:[a("div",{className:"p-4 border-b border-border bg-muted/10 flex items-center justify-between",children:g("div",{className:"flex items-center gap-2",children:[a(No,{className:"h-4 w-4 text-muted-foreground"}),a("span",{className:"text-xs font-semibold",children:Ly()})]})}),g("div",{className:"p-3 border-b border-border bg-background flex items-center justify-between gap-2",children:[g("div",{className:"flex items-center gap-1",children:[a(F,{variant:"outline",size:"icon",className:"h-7 w-7",disabled:l.length<=1,onClick:ft,children:a(On,{className:"h-4 w-4"})}),g(De,{modal:!1,children:[a(Ne,{asChild:!0,children:a(F,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs font-mono",children:l.length===0?"0 / 0":`${u+1} / ${l.length}`})}),a(Fe,{align:"start",className:"w-48",children:l.map((e,i)=>g(de,{onClick:()=>p(e.id),className:"text-xs flex items-center justify-between cursor-pointer",children:[g("span",{className:"flex items-center gap-2 truncate",children:[e.type==="text"?a(tc,{className:"h-3.5 w-3.5 text-muted-foreground"}):a(Do,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.type==="text"?e.text||"Text":e.imageAssetKey||"Image"]}),g("span",{className:"text-[10px] font-mono text-muted-foreground ml-2",children:["#",i+1]})]},e.id))})]}),a(F,{variant:"outline",size:"icon",className:"h-7 w-7",disabled:l.length<=1,onClick:gt,children:a(jt,{className:"h-4 w-4"})})]}),g("div",{className:"flex items-center gap-1",children:[n&&a(F,{variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:bg-destructive/10",title:Mt(),onClick:()=>nt(n.id),children:a(Ue,{className:"h-4 w-4"})}),g(De,{modal:!1,children:[a(Ne,{asChild:!0,children:g(F,{size:"sm",className:"h-7 text-xs gap-1",children:[a(Re,{className:"h-3.5 w-3.5"}),jm()]})}),g(Fe,{align:"end",children:[g(de,{onClick:Be,className:"text-xs gap-2 cursor-pointer",children:[a(tc,{className:"h-3.5 w-3.5"}),$m()]}),g(de,{onClick:pt,className:"text-xs gap-2 cursor-pointer",children:[a(Do,{className:"h-3.5 w-3.5"}),wA()]})]})]})]})]}),a(Ie,{className:"flex-1 min-h-0 p-4",children:n?g("div",{className:"space-y-5 text-xs",children:[g("div",{className:"flex items-center justify-between pb-2 border-b border-border",children:[g("span",{className:"font-semibold text-muted-foreground flex items-center gap-1.5",children:[n.type==="text"?a(tc,{className:"h-4 w-4 text-primary"}):a(Do,{className:"h-4 w-4 text-primary"}),n.type==="text"?$m():wA()]}),g("span",{className:"text-[10px] font-mono text-muted-foreground",children:["ID: ",n.id.slice(0,6)]})]}),n.type==="text"&&g("div",{className:"space-y-2",children:[a(fe,{className:"text-xs",children:GM()}),a(re,{type:"text",value:n.text,onChange:(e)=>I(n.id,{text:e.target.value}),className:"text-xs h-8"})]}),n.type==="image"&&g("div",{className:"space-y-2",children:[g("div",{className:"flex items-center justify-between",children:[a(fe,{className:"text-xs",children:mS()}),n.imageAssetKey&&g("button",{type:"button",onClick:()=>I(n.id,{imageAssetKey:"",imageAssetUrl:void 0}),className:"text-xs text-muted-foreground hover:text-destructive flex items-center gap-1 font-medium transition-colors cursor-pointer",children:[a(Ge,{className:"w-3.5 h-3.5"}),Jc?Jc():"Remove"]})]}),a("input",{type:"file",ref:ae,className:"hidden",accept:"image/*",onChange:(e)=>we(e,n.id)}),g("div",{onClick:()=>ae.current?.click(),className:"relative aspect-square w-full rounded-xl border border-dashed border-border flex items-center justify-center cursor-pointer overflow-hidden group shadow-inner bg-muted/20 hover:border-primary/50 hover:bg-muted/40 transition-all p-2",children:[Ee&&a("div",{className:"absolute inset-0 bg-background/70 backdrop-blur-xs flex flex-col items-center justify-center gap-2 z-20",children:g("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-background border rounded-full shadow-lg",children:[a(K,{className:"w-4 h-4 animate-spin text-primary"}),a("span",{className:"text-xs font-semibold",children:tu()})]})}),O[n.id]||n.imageAssetUrl?g(W,{children:[a("img",{src:O[n.id]||n.imageAssetUrl,alt:"Uploaded logo preview",className:"max-w-full max-h-full object-contain transition-transform duration-300 group-hover:scale-105"}),g("div",{className:"absolute inset-0 bg-black/45 opacity-0 group-hover:opacity-100 transition-opacity duration-300 flex flex-col items-center justify-center gap-1 text-white z-10",children:[a(zo,{className:"w-5 h-5 transform translate-y-1 group-hover:translate-y-0 transition-transform duration-300"}),a("span",{className:"text-xs font-semibold",children:_g()})]})]}):g("div",{className:"flex flex-col items-center gap-1.5 text-center p-3",children:[a("div",{className:"p-2 rounded-full bg-background border shadow-xs group-hover:scale-110 transition-transform duration-300",children:a(zo,{className:"w-4 h-4 text-muted-foreground"})}),g("div",{children:[a("p",{className:"text-xs font-medium text-foreground",children:NO()}),a("p",{className:"text-[10px] text-muted-foreground mt-0.5 max-w-[150px] mx-auto leading-normal",children:FO()})]})]})]})]}),g("div",{className:"space-y-2",children:[g("div",{className:"flex items-center justify-between",children:[a(fe,{className:"text-xs",children:n.type==="text"?CC():gS()}),g("span",{className:"font-mono text-[11px] text-muted-foreground",children:[Math.round(n.size*100),"%"]})]}),g("div",{className:"flex items-center gap-3",children:[a(_s,{min:n.type==="text"?0.01:0.02,max:n.type==="text"?0.12:0.5,step:0.005,value:[n.size],onValueChange:([e])=>I(n.id,{size:e}),className:"flex-1"}),a(re,{type:"number",min:1,max:100,value:Math.round(n.size*100),onChange:(e)=>I(n.id,{size:Math.min(1,Math.max(0.001,Number(e.target.value)/100))}),className:"w-16 h-7 text-xs font-mono text-right"})]})]}),n.type==="text"&&g("div",{className:"space-y-2",children:[g("div",{className:"flex items-center justify-between",children:[a(fe,{className:"text-xs",children:Bw()}),a("span",{className:"font-mono text-[11px] text-muted-foreground uppercase",children:n.color})]}),g("div",{className:"flex items-center gap-2",children:[a("input",{type:"color",value:n.color,onChange:(e)=>I(n.id,{color:e.target.value}),className:"w-8 h-8 rounded border border-border cursor-pointer bg-transparent p-0"}),a(re,{type:"text",value:n.color,onChange:(e)=>I(n.id,{color:e.target.value}),className:"flex-1 h-8 text-xs font-mono"})]}),a("div",{className:"flex items-center gap-1.5 pt-1",children:["#FFFFFF","#000000","#999999","#EF4444","#3B82F6","#10B981","#F59E0B"].map((e)=>a("button",{type:"button",onClick:()=>I(n.id,{color:e}),style:{backgroundColor:e},className:"w-5 h-5 rounded-full border border-border hover:scale-110 transition-transform"},e))})]}),g("div",{className:"space-y-2",children:[g("div",{className:"flex items-center justify-between",children:[a(fe,{className:"text-xs",children:DT()}),g("span",{className:"font-mono text-[11px] text-muted-foreground",children:[Math.round(n.opacity*100),"%"]})]}),a(_s,{min:0,max:1,step:0.01,value:[n.opacity],onValueChange:([e])=>I(n.id,{opacity:e})})]}),g("div",{className:"space-y-2",children:[g("div",{className:"flex items-center justify-between",children:[a(fe,{className:"text-xs",children:Uk()}),g("span",{className:"font-mono text-[11px] text-muted-foreground",children:[n.rotation,"°"]})]}),a(_s,{min:-180,max:180,step:1,value:[n.rotation],onValueChange:([e])=>I(n.id,{rotation:e})}),a("div",{className:"flex items-center gap-1.5 pt-1",children:[-45,-30,0,30,45].map((e)=>g(F,{variant:"outline",size:"sm",className:"h-6 text-[10px] flex-1 px-1 font-mono",onClick:()=>I(n.id,{rotation:e}),children:[e,"°"]},e))})]}),g("div",{className:"space-y-2",children:[g("div",{className:"flex items-center justify-between",children:[a(fe,{className:"text-xs",children:_1()}),g("span",{className:"font-mono text-[11px] text-muted-foreground",children:[Math.round(n.x*100),"%"]})]}),a(_s,{min:0,max:1,step:0.01,value:[n.x],onValueChange:([e])=>I(n.id,{x:e})})]}),g("div",{className:"space-y-2",children:[g("div",{className:"flex items-center justify-between",children:[a(fe,{className:"text-xs",children:y1()}),g("span",{className:"font-mono text-[11px] text-muted-foreground",children:[Math.round(n.y*100),"%"]})]}),a(_s,{min:0,max:1,step:0.01,value:[n.y],onValueChange:([e])=>I(n.id,{y:e})})]})]}):g("div",{className:"py-12 text-center text-xs text-muted-foreground space-y-3",children:[a("p",{children:oR()}),g(F,{size:"sm",variant:"outline",onClick:Be,children:[a(Re,{className:"h-3.5 w-3.5 mr-1"}),$m()]})]})})]})]})]})}),a(Se,{open:ge,onOpenChange:U,children:g(xe,{className:"max-w-md",children:[a(ke,{children:a(Ce,{className:"text-sm font-semibold",children:ne==="new"?c_():b0()})}),a("div",{className:"py-3 space-y-4 text-xs",children:ne==="new"?g("div",{className:"space-y-2",children:[a(fe,{children:qM()}),a(re,{type:"text",value:se,onChange:(e)=>V(e.target.value),placeholder:x_(),className:"text-xs"})]}):g("div",{className:"space-y-2",children:[a(fe,{children:iy()}),a("select",{value:H||"",onChange:(e)=>Y(e.target.value),className:"w-full h-9 rounded-md border border-input bg-background px-3 text-xs",children:T.map((e)=>a("option",{value:e.id,children:e.name},e.id))})]})}),g(ot,{children:[a(F,{variant:"outline",size:"sm",className:"text-xs",onClick:()=>U(!1),children:Ve()}),a(F,{size:"sm",className:"text-xs",disabled:Le||Oe,onClick:wt,children:Xa()})]})]})})]})}function Pe(...t){return t.filter(Boolean).join(" ")}L();function ut({shareLink:t,viewMode:b,onViewModeChange:f,defaultSortOrder:m,onSortOrderChange:y}){let x=ie(),[D,l]=w(t.password||""),[v,d]=w(t.expireAt?new Date(t.expireAt):void 0),[p,B]=w(!1);S(()=>{l(t.password||"")},[t.password]);let[E,N]=w(t.hasPassword),[oe,le]=w(!!t.expireAt),{data:ce,refetch:ge}=X({queryKey:["share-watermark",t.id],queryFn:async()=>{let s=await R.api.shares[":shareId"].watermark.$get({param:{shareId:t.id}});if(!s.ok)return null;return await s.json()},refetchInterval:(s)=>(s.state.data?.watermarkStatus||t.watermarkStatus)==="processing"?3000:!1}),U=R.api.shares[":shareId"].watermark.$put,{mutate:ne}=ee({mutationFn:async()=>{let s=await U({param:{shareId:t.id},json:{enabled:!1}});if(!s.ok)throw Error(pa());return await s.json()},onSuccess:()=>{x.invalidateQueries({queryKey:["shares",t.projectId]}),x.invalidateQueries({queryKey:["share",t.id]}),x.invalidateQueries({queryKey:["share-watermark",t.id]}),j.success(QO())}}),te=ce?.watermarkStatus??t.watermarkStatus??(t.watermarkConfigId?"ready":"disabled"),se=ce?.watermarkConfig?.config??t.watermarkConfig?.config??null,V=se!==null&&te!=="disabled",{data:H}=X({queryKey:["fields",t.projectId],queryFn:async()=>{let s=await R.api.projects[":projectId"].fields.$get({param:{projectId:t.projectId}});if(!s.ok)throw Error(Nx());return await s.json()},enabled:!!t.projectId}),Y=R.api.shares[":shareId"].$put,{mutate:k}=ee({mutationFn:async(s)=>{let q=await Y({param:{shareId:t.id},json:s});if(!q.ok)throw Error(pa());return await q.json()},onSuccess:()=>{x.invalidateQueries({queryKey:["shares",t.projectId]}),x.invalidateQueries({queryKey:["share",t.id]}),j.success(ql())}}),J=`${window.location.origin}/share/${t.id}`,Z=async(s)=>{if(await jo(s))j.success(tE())},ve=(s)=>{let q=t.fieldVisibility||{},me={...q,[s]:!q[s]};k({fieldVisibility:me})},_="index",A="asc";if(m){let s=m.split(":");_=s[0],A=s[1]||"asc"}return g("div",{className:"flex flex-col h-full bg-background border-l border-border",children:[a("div",{className:"flex-1 overflow-y-auto",children:g("div",{className:"p-4 space-y-6",children:[g("div",{className:"space-y-4",children:[g("div",{className:"flex items-center justify-between",children:[a("h3",{className:"text-sm font-medium",children:OS()}),a(Ke,{checked:!t.isDisabled,onCheckedChange:(s)=>k({isDisabled:!s})})]}),g("div",{className:"relative w-full",children:[a(re,{value:J,readOnly:!0,className:"pr-10 bg-muted/50 text-xs"}),a(F,{variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full",onClick:()=>Z(J),children:a(Br,{className:"h-4 w-4"})})]})]}),g("div",{className:"space-y-1",children:[a(je,{title:tR(),icon:a(au,{className:"h-4 w-4"}),children:g("div",{className:"p-3 space-y-4 pt-2",children:[g("div",{className:"space-y-2",children:[g("div",{className:"flex items-center justify-between",children:[a(fe,{className:"text-xs",children:Lh()}),a(Ke,{checked:E,onCheckedChange:(s)=>{if(N(s),!s)k({password:null})}})]}),E&&g("div",{className:"flex gap-2 animate-in fade-in slide-in-from-top-1 duration-200",children:[a(re,{type:"text",value:D,onChange:(s)=>l(s.target.value),placeholder:xx(),className:"text-xs"}),a(F,{size:"sm",onClick:()=>k({password:D}),children:wo()})]})]}),g("div",{className:"space-y-2",children:[g("div",{className:"flex items-center justify-between",children:[a(fe,{className:"text-xs",children:Mx()}),a(Ke,{checked:oe,onCheckedChange:(s)=>{if(le(s),!s)d(void 0),k({expireAt:null})}})]}),oe&&a("div",{className:"animate-in fade-in slide-in-from-top-1 duration-200",children:a(_a,{value:v,onChange:(s)=>{d(s),k({expireAt:s?s.toISOString():null})},className:"text-xs"})})]}),g("div",{className:"space-y-2",children:[g("div",{className:"flex items-center justify-between",children:[a(fe,{className:"text-xs",children:Mb()}),a(Ke,{checked:t.allowDownload,onCheckedChange:(s)=>k({allowDownload:s})})]}),a("p",{className:"text-xs text-muted-foreground",children:Ob()})]}),g("div",{className:"space-y-2 pt-2 border-t border-border/50",children:[g("div",{className:"flex items-center justify-between",children:[a(fe,{className:"text-xs",children:Ly()}),a(Ke,{checked:V,disabled:te==="processing",onCheckedChange:(s)=>{if(!s)ne();else B(!0)}})]}),V&&te==="processing"&&g("div",{className:"flex items-center gap-2 text-xs text-amber-600 dark:text-amber-400 font-medium py-1 animate-pulse",children:[a(K,{className:"h-3.5 w-3.5 animate-spin"}),a("span",{children:KO()})]}),V&&te!=="processing"&&a(F,{variant:"outline",size:"sm",className:"w-full text-xs gap-1.5 mt-1",onClick:()=>B(!0),children:cx()})]})]})}),a(je,{title:Qm(),icon:a(iu,{className:"h-4 w-4"}),children:g("div",{className:"p-3 space-y-3 pt-2 flex gap-2",children:[g(F,{variant:b==="card"?"secondary":"outline",size:"sm",className:"flex-1 gap-2 text-xs",onClick:()=>f("card"),children:[a(No,{className:"h-4 w-4"}),XC()]}),g(F,{variant:b==="list"?"secondary":"outline",size:"sm",className:"flex-1 gap-2 text-xs",onClick:()=>f("list"),children:[a(ps,{className:"h-4 w-4"}),DS()]})]})}),a(je,{title:Zl(),icon:a(lt,{className:"h-4 w-4"}),children:a("div",{className:"p-3 space-y-3 pt-2",children:H?.map((s)=>g("div",{className:"flex items-center justify-between",children:[a(fe,{className:"text-xs",children:s.config?.name}),a(Ke,{checked:t.fieldVisibility?.[s.id]??!1,onCheckedChange:()=>ve(s.id)})]},s.id))})}),a(je,{title:Yc(),icon:a(mu,{className:"h-4 w-4"}),children:g("div",{className:"p-3 space-y-4 pt-2",children:[g("div",{className:"space-y-2",children:[a(fe,{className:"text-xs text-muted-foreground",children:uh()}),g(Xe,{value:_,onValueChange:(s)=>{if(s==="index")y(null);else y(`${s}:${A}`)},children:[a(tt,{className:"w-full text-xs h-9",children:a(et,{})}),g(rt,{children:[a(be,{value:"index",children:sg()}),a(be,{value:"name",children:Xc()}),a(be,{value:"createdAt",children:ig()}),a(be,{value:"size",children:lg()})]})]})]}),g("div",{className:"space-y-2",children:[a(fe,{className:"text-xs text-muted-foreground",children:Fh()}),g(F,{variant:"outline",className:"w-full justify-between font-normal text-xs h-9",disabled:_==="index",onClick:()=>{y(`${_}:${A==="asc"?"desc":"asc"}`)},children:[a("span",{children:_==="name"?A==="asc"?Sd():kd():_==="createdAt"?A==="asc"?Td():Id():_==="size"?A==="asc"?cg():ag():A==="asc"?Gm():nh()}),a(Bd,{className:"h-4 w-4 opacity-50"})]})]})]})})]})]})}),g("div",{className:"p-4 border-t border-border space-y-2",children:[g(F,{variant:"outline",className:"w-full justify-center",onClick:()=>window.open(J,"_blank"),children:[a(fu,{className:"h-4 w-4 mr-2"}),FT()]}),g(F,{className:"w-full justify-center bg-blue-600 hover:bg-blue-700 text-white",onClick:()=>Z(J),children:[a(Br,{className:"h-4 w-4 mr-2"}),nE()]})]}),a(mt,{open:p,onOpenChange:B,initialConfig:se,shareId:t.id,onSaveSuccess:()=>{ge(),x.invalidateQueries({queryKey:["share",t.id]}),x.invalidateQueries({queryKey:["shares",t.projectId]})}})]})}function je({title:t,icon:b,children:f}){let[m,y]=w(!1);return g("div",{className:"border-b border-border last:border-0",children:[g("button",{onClick:()=>y(!m),className:"w-full flex items-center justify-between py-3 px-2 hover:bg-muted/50 transition-colors",children:[g("div",{className:"flex items-center gap-3",children:[b,a("span",{className:"text-sm font-medium",children:t})]}),a(jt,{className:_t("h-4 w-4 transition-transform",m&&"rotate-90")})]}),m&&f&&a("div",{className:"animate-in fade-in slide-in-from-top-1 duration-200",children:f})]})}function _t(...t){return t.filter(Boolean).join(" ")}function st({teamId:t,projectId:b,projectName:f,shareId:m,rootFolderId:y}){let x=ie(),{fetchMetadata:D}=Lr();S(()=>{if(t)D(t)},[t,D]);let{data:l}=X({queryKey:["share",m],queryFn:async()=>{let r=await R.api.shares[":shareId"].$get({param:{shareId:m}});if(!r.ok)throw Error(Zx());return await r.json()}}),v=l?.rootFolderId,[d,p]=w(null),[B,E]=w([]);S(()=>{if(v)p(v),E([]),T(new Set)},[v,m]);let N=Bn((r)=>r.setProjectState),oe=Bn((r)=>r.clearProjectState),le=(r)=>{if(r===d)return;if(r===v)p(v),E([]);else{let c=B.findIndex((u)=>u.id===r);if(c!==-1)p(r),E(B.slice(c+1))}T(new Set)},[ce,ge]=w(240),[U,ne]=w(360),{shareConfigLeftSidebarCollapsed:te,shareConfigRightSidebarCollapsed:se}=lr(),V=l?.defaultSortOrder||null,H,Y;if(V){let r=V.split(":");H=r[0],Y=r[1]}let k=l?.viewMode??"card",{data:J,fetchNextPage:Z,hasNextPage:ve,isFetchingNextPage:_,isLoading:A}=Tt({queryKey:["folder-children",t,d,"folder",H,Y],queryFn:async({pageParam:r})=>{let c=await R.api.folders[":folderId"].children.$get({param:{folderId:d},query:{assetType:"folder",after:r,sort:H,order:Y}});if(!c.ok)throw Error(Lx());return await c.json()},enabled:!!d,initialPageParam:"",getNextPageParam:(r)=>r.pageInfo?.cursor||void 0}),{data:s,fetchNextPage:q,hasNextPage:me,isFetchingNextPage:Ee,isLoading:ye}=Tt({queryKey:["folder-children",t,d,"file",H,Y],queryFn:async({pageParam:r})=>{let c=await R.api.folders[":folderId"].children.$get({param:{folderId:d},query:{assetType:"file",after:r,sort:H,order:Y}});if(!c.ok)throw Error(Fx());return await c.json()},enabled:!!d,initialPageParam:"",getNextPageParam:(r)=>r.pageInfo?.cursor||void 0}),O=Q(()=>J?.pages.flatMap((r)=>r.data??[])??[],[J]),he=Q(()=>s?.pages.flatMap((r)=>r.data??[])??[],[s]);S(()=>{if(l)N({teamId:t,projectId:b,projectName:f,ancestorFolders:B,currentAsset:{name:d===v?l.name:O.find((r)=>r.id===d)?.name||l.name,type:"folder"},isRootFolder:!1,shareId:m,onFolderClick:le});return()=>oe()},[t,b,f,B,d,v,l,m,O,N,oe]);let[ae,ue]=w(null),[we,T]=w(new Set),_e=()=>{T(new Set),ue(null)},{dragState:pe,handleDragStart:Ae,handleDragEnd:We}=uu({teamId:t,projectId:b,assetId:d||"",folders:O,files:he,selectedIds:we,onClearSelection:_e}),ze=R.api.shares[":shareId"].assets[":assetId"].$delete,{mutate:Le}=ee({mutationFn:async(r)=>{if(!(await ze({param:{shareId:m,assetId:r}})).ok)throw Error(Bx())},onSuccess:()=>{x.invalidateQueries({queryKey:["folder-children",t,d]}),j.success(kk())}}),$e=R.api.shares[":shareId"].$put,{mutate:Me}=ee({mutationFn:async(r)=>{let c=await $e({param:{shareId:m},json:r});if(!c.ok)throw Error(pa());return await c.json()},onSuccess:()=>{x.invalidateQueries({queryKey:["share",m]}),j.success(ql())}}),Oe=(r)=>{if(r.type==="folder"||r.targetType==="folder"){let c=d===v?l?.name||"":O.find((u)=>u.id===d)?.name||Yn();E((u)=>[{id:d,name:c},...u]),p(r.id),T(new Set)}};if(!l)return a("div",{children:bp()});return g(Eo,{modifiers:[al.configure({anchor:{x:0,y:0}})],sensors:[Xn.configure({activationConstraints:[new an.Distance({value:10})]})],onDragStart:Ae,onDragEnd:We,children:[a("div",{className:"flex flex-1 flex-col bg-background min-h-0",children:g("div",{className:"flex flex-1 overflow-hidden relative",children:[!te&&g(W,{children:[a("div",{className:"bg-background",style:{width:ce},children:a($r,{teamId:t,projectId:b,projectName:f,rootFolderId:y,dragState:pe})}),a(Yr,{onResize:(r)=>ge((c)=>Math.max(180,Math.min(400,c+r)))})]}),a(Ea,{teamId:t,projectId:b,assetId:d||"",folders:O,files:he,selectedItem:ae,selectedIds:we,onItemSelect:(r,c)=>{if(c.metaKey||c.ctrlKey){let u=new Set(we);if(u.has(r.id)){if(u.delete(r.id),T(u),ae?.id===r.id){let n=[...O,...he].find((Be)=>u.has(Be.id));ue(n||null)}}else u.add(r.id),T(u),ue(r)}else T(new Set([r.id])),ue(r)},onItemDoubleClick:Oe,onSaveField:()=>{},displayStyle:k,onClearSelection:_e,fetchNextFoldersPage:Z,hasNextFoldersPage:ve,isFetchingNextFoldersPage:_,fetchNextFilesPage:q,hasNextFilesPage:me,isFetchingNextFilesPage:Ee,isLoading:A||ye,filterConditions:[],onFilterChange:()=>{},dragState:pe,isShareView:!0,onRemoveFromShare:(r)=>{r.forEach((c)=>Le(c.id))},fieldVisibility:l.fieldVisibility}),!se&&g(W,{children:[a(Yr,{onResize:(r)=>ne((c)=>Math.max(240,Math.min(600,c-r)))}),a("div",{style:{width:U},className:"flex-shrink-0 h-full",children:a(ut,{shareLink:l,viewMode:k,onViewModeChange:(r)=>Me({viewMode:r}),defaultSortOrder:V,onSortOrderChange:(r)=>Me({defaultSortOrder:r})})})]})]})}),a(Md,{children:pe?.isActive?a("div",{className:"flex items-center gap-2 rounded-md bg-popover px-3 py-2 text-sm font-medium shadow-md",children:LI({count:pe.itemCount})}):null})]})}L();function It(){let{projectId:t,shareId:b}=Ct.useParams(),{teamId:f,ensureTeamIdForProject:m}=Pt();S(()=>{m(t)},[t,m]);let{data:y}=Ar(Og(t)),x=y?.rootFolder,{data:D}=X({queryKey:["folders",x],queryFn:async()=>{let l=await R.api.folders[":folderId"].$get({param:{folderId:x}});if(!l.ok)throw Error("Failed to fetch folder");return await l.json()},enabled:!!x});if(!f||!x||!D)return a(qt,{});return a(st,{teamId:f,projectId:t,projectName:y.name??"",shareId:b,rootFolderId:x})}var Ct=Je("/projects/$projectId/shares/$shareId")({component:It});export{Ct as Route};
@@ -1,2 +0,0 @@
1
- import{z}from"./chunk-5ngftxjb.js";var e=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],qn=z("user",e);
2
- export{qn};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import"./chunk-atdfqdkj.js";import{fm,aP}from"./chunk-esj0kwe5.js";import"./chunk-wgvgtttc.js";import"./chunk-w6g84d59.js";export{fm as createKyselyAdapter,aP as kyselyAdapter};
@@ -1,2 +0,0 @@
1
- import{G,S,Q,M,w,L,W,a,g,ie,X,ee,Tt,R,z,Vr,K,fs,qe,Be,On,jt,Bt,Er,Ue,Ge,B,F,De,Ya,Ne,Fe,de,xn,dr,Xs,ei,ti,Hm,Ve,cp,Mt,bd,wd,Dr,pp,Rx,Vx,Zl,_h,Sh,u0,d0,Bl,S0,Bh,ms,wo,Up,dt,ft,pt,mt,ht,gt,At,_t,Se,xe,ke,ot,Ce,re,Ie,Xt,Vt,j,co,uo,Jr,gn,ve,ii,An,rm}from"./chunk-5ngftxjb.js";import{ai,li,cn,Hd,Qd,Ds,Ns,ci,di}from"./chunk-ajq9sxg0.js";import{ec,qd}from"./chunk-6f3zhq64.js";import{Bi}from"./chunk-qm50g4n5.js";var tt=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Ze=z("pencil",tt);L();L();function Qe({teamId:d,projectId:r,file:n,onSaveField:l,members:N,onCommentSelect:f,hideAnnotationControl:k=!1,readOnly:h=!1,publicFields:v,isPublic:m=!1,shareId:b,currentTime:E,onTyping:q,selectedCommentId:p,heightPercent:D,onHeightPercentChange:V}){let{canEdit:I}=Xt(r),{fields:s,setFields:U}=cn(),ne=ie(),{ref:J,inView:ae}=Vt(),[o,P]=w(null),[pe,Z]=w(!1),[se,Pe]=w(null),_=M(!1),Re=M(0),A=M(D),Ee=(e)=>{_.current=!0,Re.current=e.clientY,A.current=D,e.target.setPointerCapture?.(e.pointerId)},he=G((e)=>{if(!_.current)return;let x=(Re.current-e.clientY)/window.innerHeight*100,Y=Math.min(85,Math.max(10,A.current+x));V(Y)},[V]),fe=(e)=>{_.current=!1;try{e.target.releasePointerCapture?.(e.pointerId)}catch{}},{data:O}=X({queryKey:["fields",r],queryFn:async()=>{let e=await R.api.projects[":projectId"].fields.$get({param:{projectId:r}});if(!e.ok)throw Error("Failed to fetch fields");return await e.json()},enabled:!!r&&!v}),y=Ds(n);S(()=>{if(v)U(v,r);else if(O)U(O,r)},[O,v,r,U]);let{data:le,fetchNextPage:H,hasNextPage:ge}=Tt({queryKey:m?["shares",b,"files",n?.id,"comments"]:["files",n?.id,"comments"],queryFn:async({pageParam:e})=>{if(m){let i=localStorage.getItem(`share_pwd_${b}`)||"",x=await R.api.shares[":shareId"].files[":fileId"].comments.$get({param:{shareId:b,fileId:n.id},query:{after:e}},{headers:{"x-share-password":i}});if(!x.ok)throw Error("Failed to fetch comments");return await x.json()}else{let i=await R.api.files[":fileId"].comments.$get({param:{fileId:n.id},query:{after:e}});if(!i.ok)throw Error("Failed to fetch comments");return await i.json()}},enabled:!!n?.id&&(!m||!!b),initialPageParam:"",refetchInterval:2000,getNextPageParam:(e)=>e.pageInfo?.cursor||void 0}),{mutate:we}=ee({mutationFn:async({text:e,attachmentIds:i,annotations:x,replyToId:Y,guestUserId:me,second:ce})=>{if(m){let oe=localStorage.getItem(`share_pwd_${b}`)||"",Le=await R.api.shares[":shareId"].files[":fileId"].comments.$post({param:{shareId:b,fileId:n.id},json:{message:e,attachmentIds:i,replyToId:Y??void 0,annotations:x,second:ce??void 0}},{headers:{"x-share-password":oe,...me?{"x-guest-user-id":me}:{}}});if(!Le.ok)throw Error("Failed to create comment");return await Le.json()}else{let oe=await R.api.files[":fileId"].comments.$post({param:{fileId:n.id},json:{message:e,attachmentIds:i,replyToId:Y??void 0,annotations:x,second:ce??void 0}});if(!oe.ok)throw Error("Failed to create comment");return await oe.json()}},onSuccess:()=>{ne.invalidateQueries({queryKey:m?["shares",b,"files",n?.id,"comments"]:["files",n?.id,"comments"]})},onError:()=>{j.error(Vx?.()||"Failed to post comment")}}),be=le?.pages?.[0]?.pageInfo?.total??le?.pages.reduce((e,i)=>e+(i.data?.length||0),0)??0;S(()=>{if(ae&&ge)H()},[ae,H,ge]);let T=Q(()=>(n?.fieldValues||[]).reduce((e,i)=>(e[i.fieldId]=i,e),{}),[n?.fieldValues]),te=Q(()=>[...s].sort((e,i)=>{let x=e.config?.name?.toLowerCase()||"",Y=i.config?.name?.toLowerCase()||"";if(x<Y)return-1;if(x>Y)return 1;return 0}),[s]),Me=le?.pages.flatMap((e)=>e.data??[])??[],Ae=(e,i,x=[],Y,me)=>{if(!e.trim()&&i.length===0&&x.length===0)return;let ce=Y||o?.id||null;if(m){let oe=localStorage.getItem(`guest_user_id_${b}`);if(!oe)Pe({text:e,attachmentIds:i,annotations:x,replyToId:ce,second:me}),Z(!0);else we({text:e,attachmentIds:i,annotations:x,replyToId:ce,guestUserId:oe,second:me})}else we({text:e,attachmentIds:i,annotations:x,replyToId:ce,second:me});P(null)},_e=(e)=>{if(se)we({...se,guestUserId:e}),Pe(null),P(null)},ye=(e)=>{let i=N.find((x)=>x.id===e);if(i)return i;return{id:"unknown",name:"Unknown",role:"unknown"}},Te=D<=15;return g("div",{style:{height:`${D}dvh`},className:"shrink-0 flex flex-col bg-background border-t border-border shadow-2xl rounded-t-2xl overflow-hidden select-none z-20","data-testid":"mobile-bottom-sheet",children:[a("div",{onPointerDown:Ee,onPointerMove:he,onPointerUp:fe,onPointerCancel:fe,className:"w-full pt-2 pb-1.5 flex flex-col items-center justify-center cursor-grab active:cursor-grabbing touch-none shrink-0","aria-label":"Drag to resize bottom sheet",children:a("div",{className:"w-10 h-1 rounded-full bg-muted-foreground/30 hover:bg-muted-foreground/50 transition-colors"})}),g(co,{defaultValue:"comments",className:"flex-1 flex flex-col min-h-0 px-2 pb-1 overflow-hidden",children:[g(uo,{className:"w-full shrink-0 h-9 bg-muted/60 p-1",children:[g(Jr,{value:"comments",className:"flex-1 text-xs font-semibold py-1",children:[cp()," ",be>0&&`(${be})`]}),a(Jr,{value:"fields",className:"flex-1 text-xs font-semibold py-1",children:Zl()})]}),g(gn,{value:"comments",className:B("flex-1 flex flex-col overflow-hidden min-h-0 mt-2",Te&&"hidden"),children:[a("div",{className:"flex items-center justify-between px-2 pb-1.5 shrink-0 border-b border-border/50",children:g("span",{className:"text-xs font-bold text-foreground",children:[Hm?.()||"All comments",be>0?` (${be})`:""]})}),a(Ie,{className:"flex-1 min-h-0 px-2 py-2 [&>div>div]:block!",children:Me.length===0?a("div",{className:"py-8 text-center text-xs text-muted-foreground",children:d0()}):g("div",{className:"space-y-3",children:[Me.map((e)=>g("div",{children:[a(ec,{teamId:d,message:e,getUser:ye,onReply:P,hasReplies:!!e.replies?.length,formatTimestamp:y?.commentsConfig?.formatTimestamp,frameRate:y?.commentsConfig?.hasTimestamp?n?.media?.metadata?.frameRate||30:void 0,startTimecode:y?.commentsConfig?.hasTimestamp?n?.media?.metadata?.startTimecode:void 0,isSelected:p===e.id,onSelect:()=>{f?.(e)},readOnly:h,isPublic:m}),e.replies?.map((i,x)=>a("div",{children:a(ec,{teamId:d,isReply:!0,message:i,getUser:ye,onReply:P,hasReplies:!1,isLastReply:x===(e.replies?.length??0)-1,formatTimestamp:y?.commentsConfig?.formatTimestamp,frameRate:y?.commentsConfig?.hasTimestamp?n?.media?.metadata?.frameRate||30:void 0,startTimecode:y?.commentsConfig?.hasTimestamp?n?.media?.metadata?.startTimecode:void 0,isSelected:p===i.id,onSelect:()=>{f?.(i)},readOnly:h,isPublic:m})},i.id))]},e.id)),a("div",{ref:J})]})}),(!h||m)&&a("div",{className:"mt-auto shrink-0 bg-background border-t border-border pt-1",children:a(qd,{isOpen:pe,onClose:()=>Z(!1),onSuccess:_e,children:a(Bi,{projectId:r,onSendMessage:Ae,replyingTo:o,onCancelReply:()=>P(null),hideAnnotationControl:k,disableMentions:m,currentTime:y?.commentsConfig?.hasTimestamp?E:void 0,formatTimestamp:y?.commentsConfig?.formatTimestamp,frameRate:y?.commentsConfig?.hasTimestamp?n?.media?.metadata?.frameRate||30:void 0,startTimecode:y?.commentsConfig?.hasTimestamp?n?.media?.metadata?.startTimecode:void 0,onTyping:q})})})]}),a(gn,{value:"fields",className:B("flex-1 flex flex-col overflow-hidden min-h-0 mt-2",Te&&"hidden"),children:a(Ie,{className:"flex-1 px-3 py-2 min-h-0 [&>div>div]:block!",children:te&&te.length>0?a("div",{className:"space-y-4 pb-6",children:te.map((e)=>g("div",{className:"space-y-1.5",children:[a("label",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:e.config?.name}),a("div",{className:"min-h-[32px]",children:a(di,{fieldId:e.id,config:e.config,value:T[e.id]?.value,onSave:I?(i)=>l(e.id,i):void 0,readOnly:h||e.readOnly||!I})})]},e.id))}):a("div",{className:"py-8 text-center text-xs text-muted-foreground",children:"No custom fields defined"})})})]})]})}function Ye({fileName:d,folderName:r,version:n,versions:l,activeFileId:N,isPublic:f=!1,shareId:k,allowDownload:h=!0,downloadInfo:v,canEdit:m=!1,onBack:b,onPrevFile:E,onNextFile:q,hasPrevFile:p=!1,hasNextFile:D=!1,onSelectVersion:V,onRename:I,onDelete:s,onLinkedTasks:U,linkedTaskCount:ne=0}){let J=async(o)=>{try{let P=f&&k?await R.api.shares[":shareId"].files[":fileId"]["download-url"].$post({param:{shareId:k,fileId:N},json:{key:o}}):await R.api.files["download-url"].$post({json:{key:o,assetId:N}});if(!P.ok)return;let{url:pe}=await P.json(),Z=document.createElement("a");Z.href=pe,Z.download="",document.body.appendChild(Z),Z.click(),document.body.removeChild(Z)}catch{}},ae=(v?.videoTranscodes?.length??0)>0;return g("header",{className:"flex h-12 w-full items-center justify-between border-b border-border bg-card px-2 py-1.5 shrink-0 select-none z-30",children:[a("div",{className:"flex items-center",children:a(F,{variant:"ghost",size:"icon",onClick:b,className:"h-8 w-8 text-foreground hover:bg-accent cursor-pointer","aria-label":Bh(),children:a(On,{className:"h-5 w-5"})})}),g("div",{className:"flex flex-1 items-center justify-center gap-1 min-w-0 px-1",children:[g("div",{className:"flex items-center min-w-0 max-w-[65vw]",children:[r&&g(W,{children:[a("span",{className:"truncate text-xs font-medium text-muted-foreground max-w-[80px]",children:r}),a("span",{className:"text-muted-foreground mx-1 text-xs",children:"/"})]}),l&&l.length>1?g(De,{modal:!1,children:[a(Ne,{asChild:!0,children:g("button",{className:"flex items-center gap-1 min-w-0 truncate text-xs font-medium text-foreground hover:bg-accent rounded px-1 py-0.5 transition-colors cursor-pointer",children:[a("span",{className:"truncate max-w-[120px] font-semibold",children:d}),n!==void 0&&g(ve,{variant:"outline",className:"px-1 py-0 text-[10px] shrink-0 font-normal",children:["v",n]}),a(Be,{className:"h-3 w-3 shrink-0 text-muted-foreground"})]})}),g(Fe,{align:"center",className:"w-48 z-40",children:[a(xn,{className:"text-xs",children:Up()}),l.map((o)=>g(de,{onClick:()=>V?.(o.id),className:B("flex items-center justify-between text-xs cursor-pointer",o.id===N?"bg-accent font-semibold text-accent-foreground":""),children:[g("span",{children:["v",o.version]}),a("span",{className:"text-[11px] text-muted-foreground truncate max-w-[120px]",children:o.name||d})]},o.id))]})]}):g("div",{className:"flex items-center gap-1 min-w-0 truncate",children:[a("span",{className:"truncate text-xs font-semibold text-foreground max-w-[140px]",children:d}),n!==void 0&&g(ve,{variant:"outline",className:"px-1 py-0 text-[10px] shrink-0 font-normal",children:["v",n]})]})]}),(p||D)&&g("div",{className:"flex items-center gap-0.5 shrink-0 bg-muted/60 rounded p-0.5 ml-1",children:[a(F,{variant:"ghost",size:"icon",disabled:!p,onClick:E,className:"h-5 w-5 p-0 text-muted-foreground hover:text-foreground disabled:opacity-30 cursor-pointer",title:S0(),"aria-label":S0(),children:a(On,{className:"h-3.5 w-3.5"})}),a(F,{variant:"ghost",size:"icon",disabled:!D,onClick:q,className:"h-5 w-5 p-0 text-muted-foreground hover:text-foreground disabled:opacity-30 cursor-pointer",title:u0(),"aria-label":u0(),children:a(jt,{className:"h-3.5 w-3.5"})})]})]}),a("div",{className:"flex items-center gap-1",children:g(De,{modal:!1,children:[a(Ne,{asChild:!0,children:a(F,{variant:"ghost",size:"icon",className:"h-8 w-8 text-foreground hover:bg-accent cursor-pointer","aria-label":Sh(),children:a(Vr,{className:"h-4 w-4"})})}),g(Fe,{align:"end",className:"w-52 z-40",children:[h&&(ae?g(Xs,{children:[g(ei,{className:"flex items-center gap-2 text-xs cursor-pointer",children:[a(Bt,{className:"h-3.5 w-3.5"}),a("span",{children:Dr()})]}),a(Ya,{children:g(ti,{className:"w-48 z-50",children:[a(xn,{className:"text-xs",children:Dr()}),v?.videoTranscodes?.map((o)=>{let P=ii(o),pe=o.hdr?`${P} (HDR)`:P;return g(de,{onClick:()=>J(o.key),className:"flex items-center justify-between text-xs cursor-pointer",children:[a("span",{children:pe}),a("span",{className:"text-[10px] text-muted-foreground",children:"MP4"})]},o.key||`${P}-${o.hdr?"hdr":"sdr"}`)}),v?.originalKey&&g(W,{children:[a(dr,{}),g(de,{onClick:()=>J(v.originalKey),className:"flex items-center justify-between text-xs cursor-pointer",children:[a("span",{children:Bl?.()||"Original"}),a("span",{className:"text-[10px] text-muted-foreground",children:d.split(".").pop()?.toUpperCase()||"RAW"})]})]})]})})]}):g(de,{onClick:()=>v?.originalKey&&J(v.originalKey),disabled:!v?.originalKey,className:"flex items-center gap-2 text-xs cursor-pointer",children:[a(Bt,{className:"h-3.5 w-3.5"}),a("span",{children:Dr()})]})),l&&l.length>1&&V&&g(Xs,{children:[a(ei,{className:"flex items-center gap-2 text-xs cursor-pointer",children:a("span",{children:Up?.()||"Switch version"})}),a(Ya,{children:g(ti,{className:"w-48 z-50",children:[a(xn,{className:"text-xs",children:Up?.()||"Switch version"}),l.map((o)=>g(de,{onClick:()=>V(o.id),className:B("flex items-center justify-between text-xs cursor-pointer",o.id===N?"bg-accent font-semibold text-accent-foreground":""),children:[g("span",{children:["v",o.version]}),a("span",{className:"text-[10px] text-muted-foreground truncate max-w-[120px]",children:o.name||d})]},o.id))]})})]}),U&&g(de,{onClick:U,className:"flex items-center justify-between text-xs cursor-pointer",children:[g("span",{className:"flex items-center gap-2",children:[a(fs,{className:"h-3.5 w-3.5"}),a("span",{children:_h?.()||"Linked Tasks"})]}),ne>0&&a("span",{className:"inline-flex items-center justify-center px-1.5 py-0.2 text-[10px] font-semibold rounded-full bg-muted-foreground/15 text-foreground",children:ne})]}),m&&I&&g(de,{onClick:I,className:"flex items-center gap-2 text-xs cursor-pointer",children:[a(Ze,{className:"h-3.5 w-3.5"}),a("span",{children:ms()})]}),m&&s&&g(W,{children:[a(dr,{}),g(de,{onClick:s,className:"flex items-center gap-2 text-xs text-destructive focus:text-destructive cursor-pointer",children:[a(Ue,{className:"h-3.5 w-3.5"}),a("span",{children:Mt()})]})]})]})]})})]})}function hu({projectId:d,teamId:r="",fileId:n,file:l,projectInfo:N,ancestorFolders:f=[],versions:k,activeFileId:h,startTime:v,isPublic:m=!1,shareId:b,allowDownload:E=!0,publicFields:q,siblingFiles:p=[],onNavigateToFile:D,onNavigateBack:V,onRenameFile:I,onDeleteFile:s,onSaveField:U,onSelectVersion:ne}){let{canEdit:J}=Xt(d),{members:ae}=An(),o=M(null),[P,pe]=w(50),[Z,se]=w([]),[Pe,_]=w(0),[Re,A]=w(null),[Ee,he]=w(!1),[fe,O]=w(""),y=M(null),[le,H]=w(!1),[ge,we]=w(!1),[be,T]=w(!1),[te,Me]=w(!1),{data:Ae}=X({queryKey:["teams",r,"kanban","assets",h,"tasks"],queryFn:async()=>{if(!r||!h||m)return{data:[],total:0};let c=await R.api.teams[":teamId"].kanban.assets[":assetId"].tasks.$get({param:{teamId:r,assetId:h}});if(!c.ok)return{data:[],total:0};return await c.json()},enabled:!!r&&!!h&&!m}),_e=Ae?.total??Ae?.data?.length??0,{prevFile:ye,nextFile:Te}=Q(()=>{if(!p||p.length===0)return{prevFile:null,nextFile:null};let c=p.findIndex((ue)=>ue.id===n||ue.id===h);if(c===-1)return{prevFile:null,nextFile:null};return{prevFile:c>0?p[c-1]:null,nextFile:c<p.length-1?p[c+1]:null}},[p,n,h]),e=f.length>0?f[0]?.name:N?.name,x=k?.find((c)=>c.id===h)?.version??(k&&k.length>0?k.length:void 0),Y=Q(()=>({originalKey:l.media?.original?.key,videoTranscodes:l.media?.videoTranscodes?.map((c)=>({key:c.key,width:c.width,height:c.height,resolution:c.resolution,hdr:c.hdr}))}),[l.media]),me=()=>{se([]),A(null)},ce=()=>{se([]),A(null)},oe=(c)=>{A(c.id||null);let ue=c.annotations;if(ue&&ue.length>0)se(ue);else se([]);if(c.second!==null&&c.second!==void 0)o.current?.seekTo(c.second),o.current?.pause();else if(ue&&ue.length>0)o.current?.pause()},Le=async(c)=>{if(c?.preventDefault(),!fe.trim()||!I)return;try{we(!0),await I(fe.trim()),he(!1)}finally{we(!1)}},Oe=async()=>{if(!s)return;try{H(!0),await s(),T(!1)}finally{H(!1)}};return S(()=>{_(0),A(null),se([])},[l?.id]),g("div",{className:"flex h-[100dvh] w-full flex-col bg-background overflow-hidden relative",children:[a(Ye,{fileName:l.name,folderName:e,version:x,versions:k,activeFileId:h,isPublic:m,shareId:b,allowDownload:E,downloadInfo:Y,canEdit:J,onBack:V,hasPrevFile:!!ye,hasNextFile:!!Te,onPrevFile:()=>ye&&D(ye.id),onNextFile:()=>Te&&D(Te.id),onSelectVersion:ne,onRename:()=>{O(l.name),he(!0)},onDelete:()=>T(!0),onLinkedTasks:!m?()=>Me(!0):void 0,linkedTaskCount:_e}),a("div",{className:"relative flex-1 min-h-0 bg-background overflow-hidden flex flex-col",children:a(Ns,{file:l,mediaControllerRef:o,onPlay:me,onTimeUpdate:_,onSeek:ce,annotations:Z,startTime:v,shareId:b,allowDownload:E})}),a(Qe,{teamId:r,projectId:d,file:l,onSaveField:U,members:ae,onCommentSelect:oe,hideAnnotationControl:l.proxyType==="audio",readOnly:m||!J,publicFields:q,isPublic:m,shareId:b,currentTime:Pe,onTyping:()=>o.current?.pause(),selectedCommentId:Re,heightPercent:P,onHeightPercentChange:pe}),!m&&te&&a(rm,{teamId:r,assetId:h,assetName:l.name,isOpen:te,onClose:()=>Me(!1)}),!m&&a(Se,{open:Ee,onOpenChange:he,children:a(xe,{children:g("form",{onSubmit:Le,children:[a(ke,{children:a(Ce,{children:ms()})}),a("div",{className:"py-4",children:a(re,{ref:y,value:fe,onChange:(c)=>O(c.target.value),placeholder:pp?.()||"Enter new name",onFocus:()=>{setTimeout(()=>{if(y.current)ci(y.current)},0)},autoFocus:!0})}),g(ot,{children:[a(F,{type:"button",variant:"outline",onClick:()=>he(!1),children:Ve()}),g(F,{type:"submit",disabled:ge||!fe.trim(),children:[ge&&a(K,{className:"mr-2 h-4 w-4 animate-spin"}),wo()]})]})]})})}),!m&&a(dt,{open:be,onOpenChange:T,children:g(ft,{children:[g(pt,{children:[a(ht,{children:wd?.()||"Delete Asset?"}),a(gt,{children:bd?.()||"Deleted items can be recovered for 30 days before being permanently deleted."})]}),g(mt,{children:[a(_t,{children:Ve()}),g(At,{onClick:Oe,disabled:le,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[le&&a(K,{className:"mr-2 h-4 w-4 animate-spin"}),Mt()]})]})]})})]})}L();function We({activeState:d,activeAsset:r,previewUrl:n,isFullScreen:l,onTogglePlay:N,onToggleLoop:f,onSeek:k,onVolumeChange:h,onToggleMute:v,onChangePlaybackRate:m,onChangeResolution:b,onZoomIn:E,onZoomOut:q,onFit:p,onDownload:D,onToggleFullScreen:V,allowDownload:I=!0}){if(d?.kind==="video"&&d.video&&r){let s=d.video,U=s.totalFrames/s.frameRate,ne=s.currentFrame/s.frameRate,J={isPlaying:s.isPlaying,progress:U>0?ne/U*100:0,currentTime:ne,duration:U,volume:s.volume,isMuted:s.isMuted,isLooping:s.isLooping,playbackRate:s.playbackRate,isFullScreen:l,showFrames:!1,currentResolution:s.currentResolution,isCurrentHdr:s.isCurrentHdr,activeAutoResolution:s.activeAutoResolution,isHlsManualSupported:s.isHlsManualSupported,isLoading:s.isLoading},ae=n&&!r.media?.videoPreview?{...r,media:{...r.media,videoPreview:{url:n}}}:r;return a(Hd,{state:J,zoom:d.zoom,isControlsVisible:!0,floatOverlayInFullScreen:!1,buffered:s.buffered,data:ae,resolutions:s.resolutions,togglePlay:N,toggleLoop:f,toggleMute:v,handleVolumeChange:h,changePlaybackRate:m,changeResolution:(o)=>b(o.resolution,o.hdr),handleDownload:(o)=>D(o),toggleFullScreen:V,onZoomChange:(o)=>o>=d.zoom?E():q(),onZoomReset:p,frameRate:s.frameRate,totalFrames:s.totalFrames,currentFrame:s.currentFrame,seekToFrame:k,allowDownload:I})}if(d?.kind==="image")return a(Qd,{zoom:d.zoom,onZoomIn:E,onZoomOut:q,onFit:p,onDownload:()=>D(),canDownload:!!r?.media?.original?.key,fullscreen:{isFullScreen:l,onToggle:V},allowDownload:I});return a("div",{className:"relative z-10 flex items-center justify-end gap-2 border-t border-border bg-card px-4 py-3",children:a("button",{onClick:V,className:"text-foreground transition-colors hover:text-primary",title:"Fullscreen",children:l?a(li,{className:"h-5 w-5"}):a(ai,{className:"h-5 w-5"})})})}function $e({side:d,fileName:r,version:n,activeVersionId:l,versions:N,isActive:f,onActivate:k,onSwitchVersion:h,onExit:v}){let m=B("flex-shrink-0 rounded p-1 transition-colors hover:bg-muted",f?"text-foreground":"text-muted-foreground hover:text-foreground"),b=a("button",{onClick:v,title:Rx(),className:m,children:a(Ge,{className:"h-4 w-4"})}),E=g("button",{onClick:k,className:B("flex min-w-0 items-center gap-1 rounded px-2 py-1 text-sm font-medium transition-colors hover:bg-muted",f?"text-foreground":"text-muted-foreground hover:text-foreground"),children:[a("span",{className:"truncate",children:r}),n!==void 0&&g("span",{className:B("flex-shrink-0 rounded border px-1 py-0 text-xs",f?"border-foreground/40":"border-border"),children:["v",n]})]}),q=g(De,{children:[a(Ne,{onClick:k,title:Up(),className:m,children:a(Be,{className:"h-4 w-4"})}),a(Fe,{align:d==="left"?"start":"end",className:"w-80 p-1",children:a("div",{className:"flex max-h-96 flex-col gap-1 overflow-y-auto",children:N.map((p)=>{let D=p.id===l;return g(de,{onClick:()=>h(p.id),className:"flex cursor-pointer items-center gap-3 rounded-md px-3 py-2",children:[g("div",{className:"flex min-w-[2rem] flex-shrink-0 items-center justify-center rounded-full bg-muted px-2 py-0.5 text-xs font-semibold text-muted-foreground select-none",children:["v",p.version]}),a("div",{className:"flex h-10 w-16 flex-shrink-0 items-center justify-center overflow-hidden rounded-md border border-border bg-muted",children:p.previewUrl?a("img",{src:p.previewUrl,alt:p.name||void 0,className:"h-full w-full object-cover"}):a(Er,{className:"h-4 w-4 text-muted-foreground"})}),g("div",{className:"flex min-w-0 flex-1 flex-col text-left",children:[a("span",{className:"truncate text-sm font-semibold text-foreground",children:p.name}),a("span",{className:"truncate text-xs text-muted-foreground",children:p.creator?.name||"Unknown"})]}),D&&a(qe,{className:"ml-auto h-4 w-4 flex-shrink-0 text-primary"})]},p.id)})})})]});return a("div",{onMouseDown:k,className:B("dark flex h-10 flex-shrink-0 items-center gap-1 border-b bg-background px-2 transition-colors",f?"border-b-2 border-primary":"border-border"),children:d==="left"?g(W,{children:[b,E,q]}):g(W,{children:[E,q,a("div",{className:"ml-auto"}),b]})})}function Xe(d,r,n){return X({queryKey:r?["public-share-file",n,d,localStorage.getItem(`share_pwd_${n}`)||""]:["files",d],queryFn:async()=>{if(r){let N=localStorage.getItem(`share_pwd_${n}`)||"",f=await R.api.shares[":shareId"].files[":fileId"].$get({param:{shareId:n,fileId:d}},{headers:{"x-share-password":N}});if(!f.ok)throw Error("Failed to fetch version asset");return await f.json()}let l=await R.api.files[":fileId"].$get({param:{fileId:d}});if(!l.ok)throw Error("Failed to fetch version asset");return await l.json()},enabled:!!d&&(!r||!!n)})}function gu({isPublic:d=!1,shareId:r,versions:n,leftId:l,rightId:N,activeSide:f,annotations:k,seekRequest:h,onActiveSideChange:v,onSwitchVersion:m,onExit:b,onActiveAssetChange:E,onPlay:q,onTimeUpdate:p,allowDownload:D=!0}){let V=M(null),I=M(null),s=M(null),[U,ne]=w(null),[J,ae]=w(null),[o,P]=w(1),[pe,Z]=w(!1),[se,Pe]=w(!1),{data:_,isLoading:Re}=Xe(l,d,r),{data:A,isLoading:Ee}=Xe(N,d,r),he=Ds(_),fe=Ds(A),O=!!_&&!!A&&he.id===fe.id,y=f==="left"?_:A,le=f==="left"?U:J,H=G(()=>f==="left"?I.current:s.current,[f]),ge=G(()=>f==="left"?s.current:I.current,[f]);S(()=>{E(y??null)},[y,E]),S(()=>{if(!h)return;let t=H();if(t?.seekToSecond(h.second),t?.pause(),O){let u=ge();u?.seekToSecond(h.second),u?.pause()}},[h?.nonce]),S(()=>{let t=()=>Pe(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",t),()=>document.removeEventListener("fullscreenchange",t)},[]);let we=G((t)=>ne(t),[]),be=G((t)=>ae(t),[]),T=G((t)=>{let u=H();if(u)t(u);if(O){let C=ge();if(C)t(C)}},[H,ge,O]),te=G(()=>{let t=!le?.video?.isPlaying;T((u)=>t?u.play():u.pause())},[le?.video?.isPlaying,T]);S(()=>{let t=(u)=>{let C=document.activeElement;if(C&&(C.tagName==="INPUT"||C.tagName==="TEXTAREA"||C instanceof HTMLElement&&C.isContentEditable))return;let je=u.key===" ",He=C&&(C.tagName==="BUTTON"||C.tagName==="A"||C.tagName==="SELECT"||C.tagName==="OPTION"||C.getAttribute("role")==="button"||C.getAttribute("role")==="link"||C.getAttribute("role")==="checkbox"||C.getAttribute("role")==="radio"||C.getAttribute("role")==="menuitem");if(je&&He)return;if(u.key===" "||u.key.toLowerCase()==="k")u.preventDefault(),te()};return window.addEventListener("keydown",t),()=>{window.removeEventListener("keydown",t)}},[te]);let Me=G((t)=>T((u)=>u.seekToFrame(t)),[T]),Ae=G(()=>H()?.toggleLoop(),[H]),_e=G((t)=>{P(t),Z(t===0)},[]),ye=G(()=>Z((t)=>!t),[]),Te=G((t)=>T((u)=>u.setPlaybackRate(t)),[T]),e=G((t,u)=>H()?.changeResolution(t,u),[H]),i=G(()=>T((t)=>t.zoomBy(1.2)),[T]),x=G(()=>T((t)=>t.zoomBy(0.8)),[T]),Y=G(()=>T((t)=>t.fit()),[T]),me=G((t)=>{H()?.download(t)},[H]),ce=G(()=>{let t=V.current;if(!t||typeof t.requestFullscreen!=="function")return;if(!document.fullscreenElement)t.requestFullscreen().catch(()=>{});else if(document.exitFullscreen)document.exitFullscreen().catch(()=>{})},[]),oe=G((t,u)=>{if(O)s.current?.panBy(t,u)},[O]),Le=G((t,u)=>{if(O)I.current?.panBy(t,u)},[O]),Oe=G(()=>te(),[te]),c=G((t)=>n.find((u)=>u.id===t)?.version,[n]),ue=Q(()=>y?.media?.videoPreview?.url,[y?.media?.videoPreview?.url]),Ke=(t,u)=>{let je=Ds(u)?.comparePane;if(!je)return a("div",{className:"flex flex-1 items-center justify-center bg-gray-100 dark:bg-gray-950",children:a("p",{className:"text-muted-foreground",children:"Preview unavailable"})});let He=f===t;return a(je,{ref:t==="left"?I:s,file:u,shareId:r,isActive:He,annotations:He?k:[],onStateChange:t==="left"?we:be,onUserPan:t==="left"?oe:Le,onActivate:()=>v(t),muted:He?pe:!0,volume:o,onPlay:q,onTimeUpdate:p,onRequestTogglePlay:Oe},u.id)},Je=!!_&&!!A,et=Re||Ee;return g("div",{ref:V,className:"flex h-full flex-1 flex-col bg-background",children:[g("div",{className:"flex min-h-0 flex-1",children:[g("div",{className:"flex min-w-0 flex-1 flex-col border-r border-zinc-800",children:[_&&a($e,{side:"left",fileName:_.name,version:c(l),activeVersionId:l,versions:n,isActive:f==="left",onActivate:()=>v("left"),onSwitchVersion:(t)=>m("left",t),onExit:b}),a("div",{className:"relative flex min-h-0 flex-1",children:_?Ke("left",_):a("div",{className:"flex flex-1 items-center justify-center",children:a(K,{className:"h-6 w-6 animate-spin text-foreground"})})})]}),g("div",{className:"flex min-w-0 flex-1 flex-col",children:[A&&a($e,{side:"right",fileName:A.name,version:c(N),activeVersionId:N,versions:n,isActive:f==="right",onActivate:()=>v("right"),onSwitchVersion:(t)=>m("right",t),onExit:b}),a("div",{className:"relative flex min-h-0 flex-1",children:A?Ke("right",A):a("div",{className:"flex flex-1 items-center justify-center",children:a(K,{className:"h-6 w-6 animate-spin text-foreground"})})})]})]}),et&&!Je&&a("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-background/30",children:a(K,{className:"h-8 w-8 animate-spin text-foreground"})}),a(We,{activeState:le,activeAsset:y??null,previewUrl:ue,isFullScreen:se,onTogglePlay:te,onToggleLoop:Ae,onSeek:Me,onVolumeChange:_e,onToggleMute:ye,onChangePlaybackRate:Te,onChangeResolution:e,onZoomIn:i,onZoomOut:x,onFit:Y,onDownload:me,onToggleFullScreen:ce,allowDownload:D})]})}
2
- export{hu,gu};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{ld,cd,Ff}from"./chunk-zfg4yy3c.js";export{ld as ENV_KEY,cd as ENV_SECRET,Ff as fromEnv};