@shumai-one/shumai 0.6.2 → 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 (192) hide show
  1. package/bin/{chunk-mcj1xpcc.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-jt0ykktx.js → chunk-0jnstdgf.js} +1 -1
  5. package/bin/{chunk-x03jwaga.js → chunk-0njsjy6x.js} +4 -4
  6. package/bin/{chunk-7naa7tpn.js → chunk-13rq2gtr.js} +2 -2
  7. package/bin/chunk-1aqs9sdh.js +3 -0
  8. package/bin/{chunk-m0q2cgfg.js → chunk-22jbsrka.js} +1 -1
  9. package/bin/chunk-2qknebmd.js +1 -0
  10. package/bin/{chunk-a411xhmm.js → chunk-2qzmh3ae.js} +4 -4
  11. package/bin/{chunk-2nhgdqdg.js → chunk-2tt0b8ym.js} +2 -2
  12. package/bin/{chunk-p3f5aevs.js → chunk-2zm7czk6.js} +1 -1
  13. package/bin/{chunk-p4s95471.js → chunk-396tfwdx.js} +1 -1
  14. package/bin/chunk-3mx4trvh.js +10 -0
  15. package/bin/{chunk-b5rhvzv9.js → chunk-45pb3kzz.js} +2 -2
  16. package/bin/{chunk-q83h0hkx.js → chunk-47fmhzwv.js} +2 -2
  17. package/bin/chunk-4awk4xhq.js +2 -0
  18. package/bin/{chunk-2cdxm1cp.js → chunk-4b2x2qba.js} +23 -23
  19. package/bin/{chunk-knj2s8mg.js → chunk-4rjy7ybr.js} +8 -8
  20. package/bin/{chunk-q8w4mbw4.js → chunk-598x693h.js} +2 -2
  21. package/bin/chunk-5c7ztqs7.js +1 -0
  22. package/bin/{chunk-2jj4j8cn.js → chunk-65dh7x4c.js} +2 -2
  23. package/bin/{chunk-hnkcgvcj.js → chunk-66e2vrky.js} +1 -1
  24. package/bin/{chunk-g22wmpk1.js → chunk-6j3beg6n.js} +2 -2
  25. package/bin/{chunk-cgmebxx6.js → chunk-6ke13k69.js} +1 -1
  26. package/bin/{chunk-7sgrtxbt.js → chunk-6rqakmg0.js} +2 -2
  27. package/bin/{chunk-4mws03es.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-q2bew2vc.js → chunk-7q4mgd5x.js} +2 -2
  31. package/bin/chunk-7yv7shad.js +1 -0
  32. package/bin/{chunk-qwpkcp8d.js → chunk-81b8rfv7.js} +2 -2
  33. package/bin/{chunk-atfz7g7e.js → chunk-8a7ymmd4.js} +2 -2
  34. package/bin/chunk-8ac9at5y.js +2 -0
  35. package/bin/{chunk-gxepkvt2.js → chunk-8zcfgz9c.js} +1 -1
  36. package/bin/{chunk-mcw198kg.js → chunk-955kf5kc.js} +8 -8
  37. package/bin/{chunk-jzgbxqdg.js → chunk-978rm9a9.js} +2 -2
  38. package/bin/{chunk-jt02kpfc.js → chunk-9qzbrp4d.js} +2 -2
  39. package/bin/{chunk-tekwpkjf.js → chunk-a283dh05.js} +2 -2
  40. package/bin/chunk-aa2a06cc.js +1 -0
  41. package/bin/{chunk-8cjet7pp.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-apq2gvvp.js +4 -0
  45. package/bin/chunk-av2w1sez.js +2 -0
  46. package/bin/{chunk-5wapd171.js → chunk-b6kmj34z.js} +12 -12
  47. package/bin/chunk-bkzaw9p8.js +1 -0
  48. package/bin/{chunk-zezje74z.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-9xhjy897.js → chunk-c61g9hfa.js} +4 -4
  53. package/bin/{chunk-zrszykjf.js → chunk-cdcgjh8k.js} +1 -1
  54. package/bin/{chunk-yk12hydf.js → chunk-d277evce.js} +4 -4
  55. package/bin/{chunk-55h9ze53.js → chunk-d3brvxh7.js} +2 -2
  56. package/bin/{chunk-9t3p4xp6.js → chunk-dcb1nzf1.js} +1 -1
  57. package/bin/{chunk-mzsw9var.js → chunk-dfbzatq9.js} +2 -2
  58. package/bin/chunk-e0bckx12.js +2 -0
  59. package/bin/{chunk-3ckkwdjx.js → chunk-e2p4s2pj.js} +3 -3
  60. package/bin/chunk-e8zzg57c.js +2 -0
  61. package/bin/{chunk-vp3czaeh.js → chunk-edfaqwaq.js} +2 -2
  62. package/bin/chunk-ehgrp0f9.js +1 -0
  63. package/bin/chunk-evs2aaav.js +12 -0
  64. package/bin/{chunk-s9ksftq2.js → chunk-f5bhcjhw.js} +1 -1
  65. package/bin/{chunk-ns33grgx.js → chunk-fb9dedm2.js} +2 -2
  66. package/bin/{chunk-srxp5jav.js → chunk-ff0mh9p3.js} +32 -32
  67. package/bin/chunk-fpfby5tz.js +1 -0
  68. package/bin/{chunk-eyjfhdp9.js → chunk-gd3b5akr.js} +2 -2
  69. package/bin/{chunk-1wfg56z3.js → chunk-gm1fy3hm.js} +5 -5
  70. package/bin/{chunk-9n1w5dw1.js → chunk-gqkjx7rz.js} +3 -3
  71. package/bin/{chunk-1nvd90g2.js → chunk-h7f5370s.js} +1 -1
  72. package/bin/chunk-hcyhsn8e.js +2 -0
  73. package/bin/{chunk-vcrmjtcz.js → chunk-jxm0gzmf.js} +2 -2
  74. package/bin/{chunk-b7bnp021.js → chunk-k3ggy3xk.js} +2 -2
  75. package/bin/{chunk-257dcd2f.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-e4yscwen.js → chunk-m6v8rb39.js} +8 -8
  79. package/bin/chunk-m8spagwp.js +4 -0
  80. package/bin/{chunk-y241cxff.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-02fvcrej.js → chunk-n7cvj15k.js} +7 -7
  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-73yncv54.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-167z646e.js → chunk-pemmtd8q.js} +1 -1
  92. package/bin/{chunk-82tps5n1.js → chunk-pzrqnnpg.js} +1 -1
  93. package/bin/{chunk-a74g6h8a.js → chunk-q43m934j.js} +2 -2
  94. package/bin/{chunk-r1xer8gn.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-mwktrwtx.js → chunk-s0wxbybf.js} +1 -1
  104. package/bin/{chunk-q5vkxee3.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-yq32evnn.js → chunk-v4nqx084.js} +5 -5
  109. package/bin/{chunk-ympbfzz4.js → chunk-v7jzc3ye.js} +1 -1
  110. package/bin/{chunk-9zsv6d2f.js → chunk-vbe8wred.js} +1 -1
  111. package/bin/{chunk-hpbn0k9n.js → chunk-vf9s8b5t.js} +2 -2
  112. package/bin/{chunk-m9adtgzk.js → chunk-vk3eqr65.js} +1 -1
  113. package/bin/{chunk-hpwv4am3.js → chunk-vm9bbk97.js} +4 -4
  114. package/bin/{chunk-v05rrxp5.js → chunk-w4gqg27w.js} +2 -2
  115. package/bin/{chunk-x8mjh387.js → chunk-w6ym7tsd.js} +4 -4
  116. package/bin/{chunk-hzkjgcre.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-hw6czrya.js → chunk-wrb4xq9v.js} +1 -1
  121. package/bin/{chunk-v5cn90cf.js → chunk-wzrzc07t.js} +2 -2
  122. package/bin/chunk-xd1axsdv.js +2 -0
  123. package/bin/{chunk-cwat1jwx.js → chunk-xk0jmx4s.js} +2 -2
  124. package/bin/{chunk-g6sdezec.js → chunk-y545vfn0.js} +1 -1
  125. package/bin/{chunk-fatmqnp1.js → chunk-y6h885fs.js} +1 -1
  126. package/bin/{chunk-cz13a82m.js → chunk-yncmfr39.js} +2 -2
  127. package/bin/{chunk-01052ssf.js → chunk-yxnz4ypt.js} +11 -11
  128. package/bin/chunk-zc1asygg.js +2 -0
  129. package/bin/{chunk-m82tkhaa.js → chunk-zc7wzcvh.js} +7 -7
  130. package/bin/chunk-zdvhh8mk.js +2 -0
  131. package/bin/{chunk-kvhf12b4.js → chunk-zg0b902x.js} +2 -2
  132. package/bin/{chunk-7v7mypc6.js → chunk-zhq7a7hs.js} +2 -2
  133. package/bin/{chunk-f25fe9th.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-0bj887zm.js +0 -2
  140. package/bin/chunk-1ktk6764.js +0 -10
  141. package/bin/chunk-26qn7fek.js +0 -2
  142. package/bin/chunk-2ne2b54t.js +0 -2
  143. package/bin/chunk-2vbeqczj.js +0 -1
  144. package/bin/chunk-37p6bcx2.js +0 -1
  145. package/bin/chunk-3knfx6dm.js +0 -1
  146. package/bin/chunk-3z85zxkn.js +0 -1
  147. package/bin/chunk-54tbfvya.js +0 -2
  148. package/bin/chunk-56kh5fxc.js +0 -1
  149. package/bin/chunk-576nj64j.js +0 -2
  150. package/bin/chunk-6cnqjngz.js +0 -1
  151. package/bin/chunk-7g46e1wy.js +0 -3
  152. package/bin/chunk-84x8p7v5.js +0 -1
  153. package/bin/chunk-88jg9dq5.js +0 -2
  154. package/bin/chunk-8fyg9dy4.js +0 -2
  155. package/bin/chunk-8gtfgkrn.js +0 -2
  156. package/bin/chunk-8mqbztj8.js +0 -2
  157. package/bin/chunk-8qdtvfx3.css +0 -1
  158. package/bin/chunk-8xb6yz11.js +0 -2
  159. package/bin/chunk-8yjsmr7g.js +0 -2
  160. package/bin/chunk-91rb0jpb.js +0 -2
  161. package/bin/chunk-96qpjght.js +0 -2
  162. package/bin/chunk-9f1xk1nt.js +0 -1
  163. package/bin/chunk-9mk9cvbk.js +0 -1
  164. package/bin/chunk-9nw5w8vh.js +0 -1
  165. package/bin/chunk-ah8fjb6f.js +0 -2
  166. package/bin/chunk-cf5axr8c.js +0 -1
  167. package/bin/chunk-dk42gf7v.js +0 -2
  168. package/bin/chunk-e4f56spj.js +0 -4
  169. package/bin/chunk-eb7mzbfm.js +0 -1
  170. package/bin/chunk-er14d498.js +0 -3
  171. package/bin/chunk-f6avg5qe.js +0 -129
  172. package/bin/chunk-fvx9k1dc.js +0 -2
  173. package/bin/chunk-gtf19jc1.js +0 -2
  174. package/bin/chunk-h1n7jqnw.js +0 -1
  175. package/bin/chunk-hfm82066.js +0 -2
  176. package/bin/chunk-j2s311yc.js +0 -3
  177. package/bin/chunk-kj6h5j5a.js +0 -4
  178. package/bin/chunk-km4gn6b6.js +0 -1
  179. package/bin/chunk-ny1kbmxt.js +0 -2
  180. package/bin/chunk-p3j6ydk1.js +0 -1
  181. package/bin/chunk-pk406dgy.js +0 -2
  182. package/bin/chunk-s1e4qy3q.js +0 -14
  183. package/bin/chunk-swtwaaqe.js +0 -1
  184. package/bin/chunk-tagdrg7p.js +0 -1
  185. package/bin/chunk-twtxnzbv.js +0 -2
  186. package/bin/chunk-v5mcjwxy.js +0 -2
  187. package/bin/chunk-vkzasgxw.js +0 -2
  188. package/bin/chunk-x342vzdx.js +0 -2
  189. package/bin/chunk-xc54vhfz.js +0 -2
  190. package/bin/chunk-xvkwbczx.js +0 -3
  191. package/bin/chunk-z1p13dnc.js +0 -2
  192. package/bin/chunk-zarz3sqn.js +0 -211
@@ -1 +0,0 @@
1
- import{a,Je}from"./chunk-zarz3sqn.js";import"./chunk-s1e4qy3q.js";import"./chunk-ns33grgx.js";import"./chunk-q2bew2vc.js";import"./chunk-f6avg5qe.js";import"./chunk-55h9ze53.js";import"./chunk-8mqbztj8.js";import"./chunk-gtf19jc1.js";import"./chunk-zezje74z.js";import"./chunk-r1xer8gn.js";import"./chunk-1ktk6764.js";import"./chunk-z1p13dnc.js";import"./chunk-q5vkxee3.js";import{ba}from"./chunk-0bj887zm.js";import"./chunk-8yjsmr7g.js";import"./chunk-atfz7g7e.js";import"./chunk-257dcd2f.js";import"./chunk-91rb0jpb.js";import"./chunk-ny1kbmxt.js";import"./chunk-fvx9k1dc.js";import"./chunk-kvhf12b4.js";import"./chunk-qwpkcp8d.js";import"./chunk-v5cn90cf.js";function r(){let{shareId:e}=o.useParams();return a(ba,{shareId:e})}var o=Je("/share/$shareId/")({component:r});export{o as Route};
@@ -1 +0,0 @@
1
- import{S,Z,a,X,Je,R,Pt,qt,xg}from"./chunk-zarz3sqn.js";import"./chunk-f6avg5qe.js";import"./chunk-s1e4qy3q.js";import"./chunk-ns33grgx.js";import"./chunk-q2bew2vc.js";import"./chunk-55h9ze53.js";import"./chunk-1ktk6764.js";import"./chunk-ah8fjb6f.js";import"./chunk-96qpjght.js";import"./chunk-8mqbztj8.js";import"./chunk-gtf19jc1.js";import"./chunk-zezje74z.js";import"./chunk-r1xer8gn.js";import"./chunk-q5vkxee3.js";import{xo}from"./chunk-xc54vhfz.js";import"./chunk-hpbn0k9n.js";import{gr}from"./chunk-pk406dgy.js";import"./chunk-8yjsmr7g.js";import"./chunk-atfz7g7e.js";import"./chunk-257dcd2f.js";import"./chunk-91rb0jpb.js";import"./chunk-ny1kbmxt.js";import"./chunk-fvx9k1dc.js";import"./chunk-kvhf12b4.js";import"./chunk-qwpkcp8d.js";import"./chunk-v5cn90cf.js";Z();function s(){let{projectId:e}=c.useParams(),{teamId:r,ensureTeamIdForProject:t}=Pt();S(()=>{t(e)},[e,t]);let{data:n}=gr(xg(e)),o=n?.rootFolder,{data:m}=X({queryKey:["folders",o],queryFn:async()=>{let d=await R.api.folders[":folderId"].$get({param:{folderId:o}});if(!d.ok)throw Error("failed to fetch folder");return await d.json()},enabled:!!o});if(!r||!o||!m)return a(qt,{});return a(xo,{teamId:r,projectId:e,projectName:n.name??"",assetId:o,rootFolderId:o})}var c=Je("/projects/$projectId/")({component:s});export{c as Route};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{ac}from"./chunk-cz13a82m.js";export default ac();
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Rf,Mf,Pm,Dm}from"./chunk-2cdxm1cp.js";function he(o){return Rf(Pm,o)}function Bg(o){return Mf(Dm,o)}export{he,Bg};
@@ -1,2 +0,0 @@
1
- import{z}from"./chunk-zarz3sqn.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"}]],ll=z("bell",e);
2
- export{ll};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Yg,Cm,Hu,Hr,Qu,bs,Gu,vl,bl,Qo,gf,vc,qy,Sn,so,Xr,Af}from"./chunk-gxepkvt2.js";export{Gu as EncryptJWT,bs as SignJWT,vc as UnsecuredJWT,Cm as base64url,bl as calculateJwkThumbprint,Hu as compactVerify,Qo as createLocalJWKSet,gf as createRemoteJWKSet,Xr as decodeJwt,so as decodeProtectedHeader,Yg as errors,vl as exportJWK,Af as generateKeyPair,Sn as importJWK,qy as importPKCS8,Qu as jwtDecrypt,Hr as jwtVerify};
@@ -1,2 +0,0 @@
1
- import{S,G,M,w,Z,Y,a,g,ie,X,ee,Tt,We,R,B,z0,j0,Yk,Xt,oi,an,Yn,Eo,Md,qr,Zn,An,ar,Ir,Fr,hs}from"./chunk-zarz3sqn.js";import{cn}from"./chunk-f6avg5qe.js";import{wa}from"./chunk-s1e4qy3q.js";import{va}from"./chunk-ah8fjb6f.js";import{il,lu}from"./chunk-96qpjght.js";import{hu}from"./chunk-gtf19jc1.js";import{Ea}from"./chunk-r1xer8gn.js";import{Jr}from"./chunk-q5vkxee3.js";Z();function Ne(i,t,b,n,d,f){let E=i.type==="folder",m=t.type==="folder";if(E!==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 T=Math.min(v,x),z=Math.max(v,x),P=F.slice(T,z+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:E}){let m=We(),F=ie(),{canEdit:v}=Xt(t),{setFields:x}=cn(),T=R.api.files[":fileId"].metadata.$patch,{mutate:z}=ee({mutationFn:async(e)=>{if(!(await T(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",[K,C]=w(null),[c,N]=w(new Set),[Q,j]=w(null),[ke,Me]=w(240),[Ae,Le]=w(360),{isChatbotOpen:O}=Ir(),{members:Re,fetchMembers:oe}=An(),{metadata:ne,fetchMetadata:re,setMetadata:De}=Fr(),ae=Boolean(ne["appearance.hideAgent"]);S(()=>{if(i)oe(i),re(i)},[i,oe,re]);let U=G(()=>f?.filter?.searchFilter?.conditions||[],[f]),[k,_]=w(U);S(()=>{_(U)},[U]);let le=`project:${t}:sort`,A=ne[le]||{field:"custom",order:"asc"},$e=(e)=>{if(e)De(i,le,e)},h=!!f,q=k.length>0||h,{fileListLeftSidebarCollapsed:de,setFileListLeftSidebarCollapsed:je,fileListRightSidebarCollapsed:fe,setFileListRightSidebarCollapsed:qe,viewModes:Ee}=ar(),ce=Ee[t]??"card",Te=M(null),{data:L}=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}=Zn();S(()=>(ue({teamId:i,projectId:t,projectName:b,rootFolderId:d,ancestorFolders:L?.ancestorFolders??[],currentAsset:r?{name:z0(),type:"folder"}:o?{name:j0(),type:"folder"}:h?{id:f.id,name:f.name,type:"folder"}:{id:L?.id||n,name:L?.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,L,r,o,n,d,ue,ge,m]);let{data:W,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(q)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:!q&&!o,initialPageParam:"",getNextPageParam:(e)=>e.pageInfo?.cursor||void 0}),{data:H,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:q||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=W?.pages.flatMap((e)=>e.data??[])??[],u=H?.pages.flatMap((e)=>e.data??[])??[],we=(!q&&!o?ze:!1)||Ke,xe=W?.pages[0]?.pageInfo?.total,Ie=H?.pages[0]?.pageInfo?.total,be=W?.pages[0]?.pageInfo?.totalSize,ve=H?.pages[0]?.pageInfo?.totalSize,V=()=>{N(new Set),C(null),j(null)},{dragState:D,handleDragStart:Qe,handleDragEnd:Oe}=lu({teamId:i,projectId:t,assetId:n,folders:I,files:u,selectedIds:c,onClearSelection:V}),J=G(()=>{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")_([]),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&&Q){let se=[...I,...u].find((p)=>p.id===Q);if(se){let p=Ne(se,e,Q,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),K?.id===e.id){let p=[...I,...u].find((Ue)=>y.has(Ue.id));C(p||null),j(p?p.id:null)}}else y.add(e.id),N(y),j(e.id),C(e);return}N(new Set([e.id])),j(e.id),C(e)},te=(e,s,l)=>{z({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(hu,{teamId:i,projectId:t,assetId:n,folders:I,files:u,totalFolders:xe,totalFiles:Ie,totalFoldersSize:be,totalFilesSize:ve,selectedItem:K,selectedIds:c,onItemSelect:Ce,onItemDoubleClick:Pe,onSaveField:te,onClearSelection:V,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:[il.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?[]:[Yn.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||O)&&a("div",{className:"md:hidden fixed inset-0 bg-black/50 z-40",onClick:()=>{qe(!0),Ir.getState().setIsChatbotOpen(!1)}}),!de&&g(Y,{children:[a("div",{className:"bg-background",style:{width:ke},children:a(qr,{teamId:i,projectId:t,projectName:b,rootFolderId:d,dragState:D,ancestorFolders:L?.ancestorFolders??[]})}),a(Jr,{onResize:(e)=>{Me((s)=>Math.max(180,Math.min(400,s+e)))},className:"hidden md:block"})]}),a(wa,{teamId:i,projectId:t,assetId:n,folders:I,files:u,totalFolders:xe,totalFiles:Ie,totalFoldersSize:be,totalFilesSize:ve,selectedItem:K,selectedIds:c,onItemSelect:Ce,onItemDoubleClick:Pe,onSaveField:te,displayStyle:ce,onClearSelection:V,fetchNextFoldersPage:pe,hasNextFoldersPage:me||!1,isFetchingNextFoldersPage:he,fetchNextFilesPage:ye,hasNextFilesPage:Se||!1,isFetchingNextFilesPage:Fe,isRecentlyDeleted:r,isRecents:o,isLoading:we,filterConditions:k,onFilterChange:_,sort:A,onSortChange:$e,dragState:D,collection:f,onUpdateCollection:E,rootFolderId:d}),(!fe||O&&!ae)&&g(Y,{children:[a(Jr,{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:O&&!ae?a(va,{projectId:t,contextAssetId:n}):J?a(Ea,{teamId:i,projectId:t,file:J,onSaveField:(e,s)=>te(J.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:Yk()})})]})]})}),a(Md,{children:D?.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 ",D.itemCount," item",D.itemCount!==1?"s":""]})}):null})]})}
2
- export{xo};
@@ -1,3 +0,0 @@
1
- // @bun
2
- import{C,tr,It}from"./chunk-a411xhmm.js";var Or=C({raw(r,e=[]){return C({sql:r,query:tr.createWithSql(r),parameters:C(e),queryId:It()})}});
3
- export{Or};
@@ -1,2 +0,0 @@
1
- import{Q,S,G,M,w,Z,Y,a,g,ie,X,ee,Tt,R,z,Gr,K,fs,qe,Be,Mn,jt,Bt,Er,Ue,Ge,B,F,De,Ja,Ne,Fe,de,En,ur,Xs,ei,ti,qm,Ke,lp,Mt,yd,vd,Dr,fp,xx,jx,Ll,gh,xh,a0,l0,Zl,E0,Lh,ms,wo,Bp,_t,yt,vt,bt,wt,Et,xt,Ct,Se,xe,ke,ot,Ce,re,Ie,Xt,Vt,j,co,uo,Wr,gn,ve,ii,An,em}from"./chunk-zarz3sqn.js";import{ai,li,cn,$d,Hd,Ds,Ns,ci,di}from"./chunk-f6avg5qe.js";import{Xl,jd}from"./chunk-r1xer8gn.js";import{Bi}from"./chunk-1ktk6764.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);Z();Z();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:L,onTyping:O,selectedCommentId:p,heightPercent:D,onHeightPercentChange:E}){let{canEdit:I}=Xt(r),{fields:s,setFields:H}=cn(),ne=ie(),{ref:J,inView:ae}=Vt(),[o,P]=w(null),[pe,q]=w(!1),[se,Pe]=w(null),V=M(!1),Re=M(0),A=M(D),Ee=(e)=>{V.current=!0,Re.current=e.clientY,A.current=D,e.target.setPointerCapture?.(e.pointerId)},he=Q((e)=>{if(!V.current)return;let x=(Re.current-e.clientY)/window.innerHeight*100,W=Math.min(85,Math.max(10,A.current+x));E(W)},[E]),fe=(e)=>{V.current=!1;try{e.target.releasePointerCapture?.(e.pointerId)}catch{}},{data:U}=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)H(v,r);else if(U)H(U,r)},[U,v,r,H]);let{data:le,fetchNextPage:_,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:W,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:W??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:W??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(jx?.()||"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)_()},[ae,_,ge]);let T=G(()=>(n?.fieldValues||[]).reduce((e,i)=>(e[i.fieldId]=i,e),{}),[n?.fieldValues]),te=G(()=>[...s].sort((e,i)=>{let x=e.config?.name?.toLowerCase()||"",W=i.config?.name?.toLowerCase()||"";if(x<W)return-1;if(x>W)return 1;return 0}),[s]),Me=le?.pages.flatMap((e)=>e.data??[])??[],Ae=(e,i,x=[],W,me)=>{if(!e.trim()&&i.length===0&&x.length===0)return;let ce=W||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}),q(!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)},Ve=(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(Wr,{value:"comments",className:"flex-1 text-xs font-semibold py-1",children:[lp()," ",be>0&&`(${be})`]}),a(Wr,{value:"fields",className:"flex-1 text-xs font-semibold py-1",children:Ll()})]}),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:[qm?.()||"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:l0()}):g("div",{className:"space-y-3",children:[Me.map((e)=>g("div",{children:[a(Xl,{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(Xl,{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(jd,{isOpen:pe,onClose:()=>q(!1),onSuccess:Ve,children:a(Bi,{projectId:r,onSendMessage:Ae,replyingTo:o,onCancelReply:()=>P(null),hideAnnotationControl:k,disableMentions:m,currentTime:y?.commentsConfig?.hasTimestamp?L: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:O})})})]}),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:L,onNextFile:O,hasPrevFile:p=!1,hasNextFile:D=!1,onSelectVersion:E,onRename:I,onDelete:s,onLinkedTasks:H,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(),q=document.createElement("a");q.href=pe,q.download="",document.body.appendChild(q),q.click(),document.body.removeChild(q)}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":Lh(),children:a(Mn,{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(Y,{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(En,{className:"text-xs",children:Bp()}),l.map((o)=>g(de,{onClick:()=>E?.(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:L,className:"h-5 w-5 p-0 text-muted-foreground hover:text-foreground disabled:opacity-30 cursor-pointer",title:E0(),"aria-label":E0(),children:a(Mn,{className:"h-3.5 w-3.5"})}),a(F,{variant:"ghost",size:"icon",disabled:!D,onClick:O,className:"h-5 w-5 p-0 text-muted-foreground hover:text-foreground disabled:opacity-30 cursor-pointer",title:a0(),"aria-label":a0(),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":xh(),children:a(Gr,{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(Ja,{children:g(ti,{className:"w-48 z-50",children:[a(En,{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(Y,{children:[a(ur,{}),g(de,{onClick:()=>J(v.originalKey),className:"flex items-center justify-between text-xs cursor-pointer",children:[a("span",{children:Zl?.()||"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&&E&&g(Xs,{children:[a(ei,{className:"flex items-center gap-2 text-xs cursor-pointer",children:a("span",{children:Bp?.()||"Switch version"})}),a(Ja,{children:g(ti,{className:"w-48 z-50",children:[a(En,{className:"text-xs",children:Bp?.()||"Switch version"}),l.map((o)=>g(de,{onClick:()=>E(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))]})})]}),H&&g(de,{onClick:H,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:gh?.()||"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(Y,{children:[a(ur,{}),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 pu({projectId:d,teamId:r="",fileId:n,file:l,projectInfo:N,ancestorFolders:f=[],versions:k,activeFileId:h,startTime:v,isPublic:m=!1,shareId:b,allowDownload:L=!0,publicFields:O,siblingFiles:p=[],onNavigateToFile:D,onNavigateBack:E,onRenameFile:I,onDeleteFile:s,onSaveField:H,onSelectVersion:ne}){let{canEdit:J}=Xt(d),{members:ae}=An(),o=M(null),[P,pe]=w(50),[q,se]=w([]),[Pe,V]=w(0),[Re,A]=w(null),[Ee,he]=w(!1),[fe,U]=w(""),y=M(null),[le,_]=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}),Ve=Ae?.total??Ae?.data?.length??0,{prevFile:ye,nextFile:Te}=G(()=>{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),W=G(()=>({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)}},je=async()=>{if(!s)return;try{_(!0),await s(),T(!1)}finally{_(!1)}};return S(()=>{V(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:L,downloadInfo:W,canEdit:J,onBack:E,hasPrevFile:!!ye,hasNextFile:!!Te,onPrevFile:()=>ye&&D(ye.id),onNextFile:()=>Te&&D(Te.id),onSelectVersion:ne,onRename:()=>{U(l.name),he(!0)},onDelete:()=>T(!0),onLinkedTasks:!m?()=>Me(!0):void 0,linkedTaskCount:Ve}),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:V,onSeek:ce,annotations:q,startTime:v,shareId:b,allowDownload:L})}),a(Qe,{teamId:r,projectId:d,file:l,onSaveField:H,members:ae,onCommentSelect:oe,hideAnnotationControl:l.proxyType==="audio",readOnly:m||!J,publicFields:O,isPublic:m,shareId:b,currentTime:Pe,onTyping:()=>o.current?.pause(),selectedCommentId:Re,heightPercent:P,onHeightPercentChange:pe}),!m&&te&&a(em,{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)=>U(c.target.value),placeholder:fp?.()||"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:Ke()}),g(F,{type:"submit",disabled:ge||!fe.trim(),children:[ge&&a(K,{className:"mr-2 h-4 w-4 animate-spin"}),wo()]})]})]})})}),!m&&a(_t,{open:be,onOpenChange:T,children:g(yt,{children:[g(vt,{children:[a(wt,{children:vd?.()||"Delete Asset?"}),a(Et,{children:yd?.()||"Deleted items can be recovered for 30 days before being permanently deleted."})]}),g(bt,{children:[a(Ct,{children:Ke()}),g(xt,{onClick:je,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()]})]})]})})]})}Z();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:L,onZoomOut:O,onFit:p,onDownload:D,onToggleFullScreen:E,allowDownload:I=!0}){if(d?.kind==="video"&&d.video&&r){let s=d.video,H=s.totalFrames/s.frameRate,ne=s.currentFrame/s.frameRate,J={isPlaying:s.isPlaying,progress:H>0?ne/H*100:0,currentTime:ne,duration:H,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($d,{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:E,onZoomChange:(o)=>o>=d.zoom?L():O(),onZoomReset:p,frameRate:s.frameRate,totalFrames:s.totalFrames,currentFrame:s.currentFrame,seekToFrame:k,allowDownload:I})}if(d?.kind==="image")return a(Hd,{zoom:d.zoom,onZoomIn:L,onZoomOut:O,onFit:p,onDownload:()=>D(),canDownload:!!r?.media?.original?.key,fullscreen:{isFullScreen:l,onToggle:E},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:E,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 ze({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:xx(),className:m,children:a(Ge,{className:"h-4 w-4"})}),L=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]})]}),O=g(De,{children:[a(Ne,{onClick:k,title:Bp(),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(Y,{children:[b,L,O]}):g(Y,{children:[L,O,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 mu({isPublic:d=!1,shareId:r,versions:n,leftId:l,rightId:N,activeSide:f,annotations:k,seekRequest:h,onActiveSideChange:v,onSwitchVersion:m,onExit:b,onActiveAssetChange:L,onPlay:O,onTimeUpdate:p,allowDownload:D=!0}){let E=M(null),I=M(null),s=M(null),[H,ne]=w(null),[J,ae]=w(null),[o,P]=w(1),[pe,q]=w(!1),[se,Pe]=w(!1),{data:V,isLoading:Re}=Xe(l,d,r),{data:A,isLoading:Ee}=Xe(N,d,r),he=Ds(V),fe=Ds(A),U=!!V&&!!A&&he.id===fe.id,y=f==="left"?V:A,le=f==="left"?H:J,_=Q(()=>f==="left"?I.current:s.current,[f]),ge=Q(()=>f==="left"?s.current:I.current,[f]);S(()=>{L(y??null)},[y,L]),S(()=>{if(!h)return;let t=_();if(t?.seekToSecond(h.second),t?.pause(),U){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=Q((t)=>ne(t),[]),be=Q((t)=>ae(t),[]),T=Q((t)=>{let u=_();if(u)t(u);if(U){let C=ge();if(C)t(C)}},[_,ge,U]),te=Q(()=>{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 He=u.key===" ",_e=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(He&&_e)return;if(u.key===" "||u.key.toLowerCase()==="k")u.preventDefault(),te()};return window.addEventListener("keydown",t),()=>{window.removeEventListener("keydown",t)}},[te]);let Me=Q((t)=>T((u)=>u.seekToFrame(t)),[T]),Ae=Q(()=>_()?.toggleLoop(),[_]),Ve=Q((t)=>{P(t),q(t===0)},[]),ye=Q(()=>q((t)=>!t),[]),Te=Q((t)=>T((u)=>u.setPlaybackRate(t)),[T]),e=Q((t,u)=>_()?.changeResolution(t,u),[_]),i=Q(()=>T((t)=>t.zoomBy(1.2)),[T]),x=Q(()=>T((t)=>t.zoomBy(0.8)),[T]),W=Q(()=>T((t)=>t.fit()),[T]),me=Q((t)=>{_()?.download(t)},[_]),ce=Q(()=>{let t=E.current;if(!t||typeof t.requestFullscreen!=="function")return;if(!document.fullscreenElement)t.requestFullscreen().catch(()=>{});else if(document.exitFullscreen)document.exitFullscreen().catch(()=>{})},[]),oe=Q((t,u)=>{if(U)s.current?.panBy(t,u)},[U]),Le=Q((t,u)=>{if(U)I.current?.panBy(t,u)},[U]),je=Q(()=>te(),[te]),c=Q((t)=>n.find((u)=>u.id===t)?.version,[n]),ue=G(()=>y?.media?.videoPreview?.url,[y?.media?.videoPreview?.url]),$e=(t,u)=>{let He=Ds(u)?.comparePane;if(!He)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 _e=f===t;return a(He,{ref:t==="left"?I:s,file:u,shareId:r,isActive:_e,annotations:_e?k:[],onStateChange:t==="left"?we:be,onUserPan:t==="left"?oe:Le,onActivate:()=>v(t),muted:_e?pe:!0,volume:o,onPlay:O,onTimeUpdate:p,onRequestTogglePlay:je},u.id)},Je=!!V&&!!A,et=Re||Ee;return g("div",{ref:E,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:[V&&a(ze,{side:"left",fileName:V.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:V?$e("left",V):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(ze,{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?$e("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:Ve,onToggleMute:ye,onChangePlaybackRate:Te,onChangeResolution:e,onZoomIn:i,onZoomOut:x,onFit:W,onDownload:me,onToggleFullScreen:ce,allowDownload:D})]})}
2
- export{pu,mu};