@shumai-one/shumai 0.6.2 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (165) hide show
  1. package/bin/chunk-02b5bcmc.js +1 -0
  2. package/bin/{chunk-m0q2cgfg.js → chunk-09mj32d7.js} +1 -1
  3. package/bin/{chunk-b7bnp021.js → chunk-09mpcg9x.js} +2 -2
  4. package/bin/{chunk-257dcd2f.js → chunk-0a298n62.js} +2 -2
  5. package/bin/{chunk-cz13a82m.js → chunk-0rgbxp24.js} +2 -2
  6. package/bin/{chunk-mwktrwtx.js → chunk-19zbh4fr.js} +1 -1
  7. package/bin/{chunk-v05rrxp5.js → chunk-1e1q1hyg.js} +2 -2
  8. package/bin/{chunk-fatmqnp1.js → chunk-1ja2zw4w.js} +1 -1
  9. package/bin/chunk-1tar0x8s.js +7 -0
  10. package/bin/{chunk-1nvd90g2.js → chunk-1y6h4vge.js} +1 -1
  11. package/bin/{chunk-tekwpkjf.js → chunk-20bamhwa.js} +2 -2
  12. package/bin/{chunk-8mqbztj8.js → chunk-20w1w9x7.js} +2 -2
  13. package/bin/{chunk-qwpkcp8d.js → chunk-25npafhz.js} +2 -2
  14. package/bin/{chunk-km4gn6b6.js → chunk-2qgagdb7.js} +1 -1
  15. package/bin/chunk-2t6g3pny.js +3 -0
  16. package/bin/{chunk-ns33grgx.js → chunk-34f64q0q.js} +1 -1
  17. package/bin/{chunk-1wfg56z3.js → chunk-3hgrw1m0.js} +4 -4
  18. package/bin/{chunk-p3f5aevs.js → chunk-3s2ga6mt.js} +1 -1
  19. package/bin/{chunk-hzkjgcre.js → chunk-3vpz5nat.js} +1 -1
  20. package/bin/{chunk-2jj4j8cn.js → chunk-4p31kxjh.js} +2 -2
  21. package/bin/{chunk-9t3p4xp6.js → chunk-4vjgdj0h.js} +1 -1
  22. package/bin/{chunk-96qpjght.js → chunk-50pfmxt1.js} +2 -2
  23. package/bin/{chunk-2cdxm1cp.js → chunk-5ddg5ezb.js} +9 -9
  24. package/bin/chunk-5ngftxjb.js +218 -0
  25. package/bin/{chunk-r1xer8gn.js → chunk-6f3zhq64.js} +3 -3
  26. package/bin/chunk-6nqqe7w9.js +1 -0
  27. package/bin/{chunk-h1n7jqnw.js → chunk-6t525bmg.js} +1 -1
  28. package/bin/{chunk-01052ssf.js → chunk-7546ptwg.js} +11 -11
  29. package/bin/{chunk-82tps5n1.js → chunk-7jz3cmq6.js} +1 -1
  30. package/bin/{chunk-v5cn90cf.js → chunk-7kah3zb5.js} +2 -2
  31. package/bin/{chunk-73yncv54.js → chunk-7mawxsk3.js} +2 -2
  32. package/bin/chunk-8ww98y1m.js +2 -0
  33. package/bin/{chunk-55h9ze53.js → chunk-9405hzv2.js} +2 -2
  34. package/bin/{chunk-cgmebxx6.js → chunk-95b4mwyq.js} +1 -1
  35. package/bin/chunk-9vxmgvc8.js +2 -0
  36. package/bin/{chunk-knj2s8mg.js → chunk-9x42vgeq.js} +5 -5
  37. package/bin/{chunk-7sgrtxbt.js → chunk-a859y4e1.js} +2 -2
  38. package/bin/{chunk-y241cxff.js → chunk-addssm8d.js} +1 -1
  39. package/bin/{chunk-f6avg5qe.js → chunk-ajq9sxg0.js} +33 -33
  40. package/bin/chunk-amp9h878.js +2 -0
  41. package/bin/{chunk-yk12hydf.js → chunk-atdfqdkj.js} +4 -4
  42. package/bin/{chunk-5wapd171.js → chunk-atpt99h4.js} +10 -10
  43. package/bin/chunk-awshe30f.js +1 -0
  44. package/bin/chunk-b3t7gbhm.js +2 -0
  45. package/bin/{chunk-e4f56spj.js → chunk-bbxwyhz3.js} +3 -3
  46. package/bin/{chunk-a411xhmm.js → chunk-bd3v8mp1.js} +4 -4
  47. package/bin/{chunk-167z646e.js → chunk-brgns7hv.js} +1 -1
  48. package/bin/{chunk-576nj64j.js → chunk-c02727j9.js} +2 -2
  49. package/bin/{chunk-8yjsmr7g.js → chunk-c1wvs81k.js} +1 -1
  50. package/bin/chunk-c8frmqsk.js +2 -0
  51. package/bin/{chunk-xc54vhfz.js → chunk-cagzye3j.js} +1 -1
  52. package/bin/{chunk-s9ksftq2.js → chunk-cp96e9pq.js} +1 -1
  53. package/bin/{chunk-q5vkxee3.js → chunk-d55138xx.js} +2 -2
  54. package/bin/{chunk-7v7mypc6.js → chunk-ddmf9gqv.js} +2 -2
  55. package/bin/chunk-djb65frk.js +1 -0
  56. package/bin/{chunk-q83h0hkx.js → chunk-dkhdn92k.js} +2 -2
  57. package/bin/chunk-dx9f5wab.js +1 -0
  58. package/bin/{chunk-f25fe9th.js → chunk-dygj751y.js} +11 -11
  59. package/bin/{chunk-m9adtgzk.js → chunk-e55sgg8t.js} +1 -1
  60. package/bin/{chunk-q8w4mbw4.js → chunk-enax4303.js} +2 -2
  61. package/bin/{chunk-vcrmjtcz.js → chunk-erfkd3z9.js} +2 -2
  62. package/bin/{chunk-8cjet7pp.js → chunk-esj0kwe5.js} +5 -5
  63. package/bin/{chunk-atfz7g7e.js → chunk-etrm28sy.js} +1 -1
  64. package/bin/chunk-ex3174e3.js +2 -0
  65. package/bin/{chunk-9n1w5dw1.js → chunk-ezjxx44x.js} +3 -3
  66. package/bin/{chunk-cf5axr8c.js → chunk-f4xnx4n6.js} +1 -1
  67. package/bin/{chunk-7naa7tpn.js → chunk-f8hgy69t.js} +2 -2
  68. package/bin/chunk-fakph5jp.js +1 -0
  69. package/bin/{chunk-kvhf12b4.js → chunk-femnbfkj.js} +1 -1
  70. package/bin/{chunk-ah8fjb6f.js → chunk-ffjdkdcv.js} +2 -2
  71. package/bin/{chunk-vkzasgxw.js → chunk-gd016e9p.js} +2 -2
  72. package/bin/{chunk-ympbfzz4.js → chunk-gyv3yrhj.js} +1 -1
  73. package/bin/{chunk-jzgbxqdg.js → chunk-h2bphev9.js} +2 -2
  74. package/bin/chunk-h3atwgx2.js +1 -0
  75. package/bin/chunk-h7xny3de.js +2 -0
  76. package/bin/{chunk-m82tkhaa.js → chunk-hg3rkp41.js} +5 -5
  77. package/bin/{chunk-3z85zxkn.js → chunk-hpzk9k55.js} +1 -1
  78. package/bin/{chunk-9zsv6d2f.js → chunk-hsyfrzdd.js} +1 -1
  79. package/bin/chunk-hvyy8vct.js +3 -0
  80. package/bin/{chunk-b5rhvzv9.js → chunk-j2txsbxz.js} +2 -2
  81. package/bin/chunk-j6x53e33.js +1 -0
  82. package/bin/chunk-jacanzp7.js +1 -0
  83. package/bin/{chunk-g6sdezec.js → chunk-jc7dycy6.js} +1 -1
  84. package/bin/{chunk-cwat1jwx.js → chunk-k7vbk8v4.js} +1 -1
  85. package/bin/{chunk-zrszykjf.js → chunk-mn0kt3p6.js} +1 -1
  86. package/bin/chunk-mn71dffh.js +4 -0
  87. package/bin/{chunk-vp3czaeh.js → chunk-npeapp7e.js} +2 -2
  88. package/bin/{chunk-2nhgdqdg.js → chunk-p2vsdnd1.js} +2 -2
  89. package/bin/chunk-pdw77q09.js +2 -0
  90. package/bin/{chunk-zezje74z.js → chunk-pq6kdp83.js} +3 -3
  91. package/bin/chunk-ptcz4ed3.js +2 -0
  92. package/bin/{chunk-z1p13dnc.js → chunk-q1fzgqsv.js} +2 -2
  93. package/bin/chunk-q4ny4hpt.js +2 -0
  94. package/bin/{chunk-mzsw9var.js → chunk-q5x0yywj.js} +2 -2
  95. package/bin/{chunk-g22wmpk1.js → chunk-q8xr1a8j.js} +2 -2
  96. package/bin/chunk-q8ysc5ex.js +1 -0
  97. package/bin/{chunk-1ktk6764.js → chunk-qm50g4n5.js} +4 -4
  98. package/bin/{chunk-q2bew2vc.js → chunk-qvp24w0q.js} +2 -2
  99. package/bin/{chunk-9xhjy897.js → chunk-r6t0j0jx.js} +3 -3
  100. package/bin/chunk-s1j4v33x.js +2 -0
  101. package/bin/{chunk-yq32evnn.js → chunk-s6pk2zyg.js} +5 -5
  102. package/bin/{chunk-hnkcgvcj.js → chunk-s74g9vsk.js} +1 -1
  103. package/bin/{chunk-gxepkvt2.js → chunk-sz19nn1x.js} +1 -1
  104. package/bin/{chunk-hpbn0k9n.js → chunk-sz5zawfw.js} +1 -1
  105. package/bin/chunk-t68y25gf.js +1 -0
  106. package/bin/{chunk-mcw198kg.js → chunk-te484xtb.js} +8 -8
  107. package/bin/{chunk-jt0ykktx.js → chunk-tfrevef9.js} +1 -1
  108. package/bin/chunk-thpw6tcj.js +2 -0
  109. package/bin/{chunk-02fvcrej.js → chunk-v0yevesp.js} +7 -7
  110. package/bin/chunk-vj4gamdn.js +2 -0
  111. package/bin/{chunk-p4s95471.js → chunk-vmwys2ch.js} +1 -1
  112. package/bin/{chunk-e4yscwen.js → chunk-vnmggrd6.js} +7 -7
  113. package/bin/{chunk-hpwv4am3.js → chunk-vv0m0m2f.js} +4 -4
  114. package/bin/{chunk-x03jwaga.js → chunk-w6g84d59.js} +4 -4
  115. package/bin/{chunk-3ckkwdjx.js → chunk-wgvgtttc.js} +3 -3
  116. package/bin/chunk-xy9qpn6b.js +1 -0
  117. package/bin/{chunk-mcj1xpcc.js → chunk-y3haqtr8.js} +2 -2
  118. package/bin/chunk-y5dv67mg.js +2 -0
  119. package/bin/{chunk-4mws03es.js → chunk-yb4mzqrd.js} +2 -2
  120. package/bin/{chunk-x8mjh387.js → chunk-z0de127n.js} +4 -4
  121. package/bin/chunk-z8t6e0ee.js +1 -0
  122. package/bin/chunk-zfg4yy3c.js +2 -0
  123. package/bin/{chunk-hw6czrya.js → chunk-zkvezz89.js} +1 -1
  124. package/bin/chunk-zrrnvdxq.js +3 -0
  125. package/bin/{chunk-srxp5jav.js → chunk-zx1c4vm5.js} +30 -30
  126. package/bin/chunk-zzqse5qc.js +2 -0
  127. package/bin/shumai-app.html +1 -1
  128. package/bin/shumai-app.js +328 -328
  129. package/package.json +7 -7
  130. package/bin/chunk-0bj887zm.js +0 -2
  131. package/bin/chunk-26qn7fek.js +0 -2
  132. package/bin/chunk-2ne2b54t.js +0 -2
  133. package/bin/chunk-2vbeqczj.js +0 -1
  134. package/bin/chunk-37p6bcx2.js +0 -1
  135. package/bin/chunk-3knfx6dm.js +0 -1
  136. package/bin/chunk-54tbfvya.js +0 -2
  137. package/bin/chunk-56kh5fxc.js +0 -1
  138. package/bin/chunk-6cnqjngz.js +0 -1
  139. package/bin/chunk-7g46e1wy.js +0 -3
  140. package/bin/chunk-84x8p7v5.js +0 -1
  141. package/bin/chunk-8fyg9dy4.js +0 -2
  142. package/bin/chunk-8gtfgkrn.js +0 -2
  143. package/bin/chunk-8xb6yz11.js +0 -2
  144. package/bin/chunk-91rb0jpb.js +0 -2
  145. package/bin/chunk-9f1xk1nt.js +0 -1
  146. package/bin/chunk-9mk9cvbk.js +0 -1
  147. package/bin/chunk-9nw5w8vh.js +0 -1
  148. package/bin/chunk-dk42gf7v.js +0 -2
  149. package/bin/chunk-eb7mzbfm.js +0 -1
  150. package/bin/chunk-er14d498.js +0 -3
  151. package/bin/chunk-fvx9k1dc.js +0 -2
  152. package/bin/chunk-gtf19jc1.js +0 -2
  153. package/bin/chunk-hfm82066.js +0 -2
  154. package/bin/chunk-kj6h5j5a.js +0 -4
  155. package/bin/chunk-ny1kbmxt.js +0 -2
  156. package/bin/chunk-p3j6ydk1.js +0 -1
  157. package/bin/chunk-pk406dgy.js +0 -2
  158. package/bin/chunk-s1e4qy3q.js +0 -14
  159. package/bin/chunk-swtwaaqe.js +0 -1
  160. package/bin/chunk-tagdrg7p.js +0 -1
  161. package/bin/chunk-twtxnzbv.js +0 -2
  162. package/bin/chunk-v5mcjwxy.js +0 -2
  163. package/bin/chunk-x342vzdx.js +0 -2
  164. package/bin/chunk-xvkwbczx.js +0 -3
  165. package/bin/chunk-zarz3sqn.js +0 -211
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shumai-one/shumai",
3
- "version": "0.6.2",
3
+ "version": "0.6.3",
4
4
  "description": "A fullstack AI-powered media workspace and workflow engine",
5
5
  "type": "module",
6
6
  "bin": {
@@ -25,12 +25,12 @@
25
25
  "exiftool-vendored": "38.1.0"
26
26
  },
27
27
  "optionalDependencies": {
28
- "@shumai-one/shumai-darwin-arm64": "0.6.2",
29
- "@shumai-one/shumai-darwin-x64": "0.6.2",
30
- "@shumai-one/shumai-linux-arm64": "0.6.2",
31
- "@shumai-one/shumai-linux-x64": "0.6.2",
32
- "@shumai-one/shumai-win32-arm64": "0.6.2",
33
- "@shumai-one/shumai-win32-x64": "0.6.2"
28
+ "@shumai-one/shumai-darwin-arm64": "0.6.3",
29
+ "@shumai-one/shumai-darwin-x64": "0.6.3",
30
+ "@shumai-one/shumai-linux-arm64": "0.6.3",
31
+ "@shumai-one/shumai-linux-x64": "0.6.3",
32
+ "@shumai-one/shumai-win32-arm64": "0.6.3",
33
+ "@shumai-one/shumai-win32-x64": "0.6.3"
34
34
  },
35
35
  "repository": {
36
36
  "type": "git",
@@ -1,2 +0,0 @@
1
- import{S,G,M,w,Z,Y,a,g,X,Tt,We,R,K,Pn,F,t1,re,Zn,hs,tm,lt,Nt,Ft,St}from"./chunk-zarz3sqn.js";import{wa}from"./chunk-s1e4qy3q.js";import{gu,Ns}from"./chunk-f6avg5qe.js";import{hu}from"./chunk-gtf19jc1.js";import{Ea}from"./chunk-r1xer8gn.js";import{pu,mu}from"./chunk-z1p13dnc.js";import{Jr}from"./chunk-q5vkxee3.js";import{_r}from"./chunk-ny1kbmxt.js";Z();function ba({shareId:r,initialFolderId:ve,initialFileId:W,startTime:O,versionId:x,compare:ye,compareLeftId:C,compareRightId:k,compareActiveSide:Q="left"}){let c=We(),A=hs(),p=!!ye&&!!C&&!!k,[d,J]=w(()=>localStorage.getItem(`share_pwd_${r}`)||""),[q,xe]=w(""),{data:s,error:b,isLoading:Se}=X({queryKey:["share-info",r,d],queryFn:async()=>{let e=await R.api.shares[":shareId"].info.$get({param:{shareId:r}},{headers:{"x-share-password":d}});if(e.status===401)throw Error("Unauthorized");if(e.status===403){let t=await e.json();throw Error(t.error||"Forbidden")}if(!e.ok)throw Error("Failed to fetch share info");return await e.json()},retry:!1}),o=ve||s?.rootFolderId,l=W||null,z=x||l,[V,ee]=w([]),{data:j}=X({queryKey:["public-share-folder",r,o,d],queryFn:async()=>{let e=await R.api.shares[":shareId"].files[":fileId"].$get({param:{shareId:r,fileId:o}},{headers:{"x-share-password":d}});if(e.status===401)throw Error("Unauthorized");return await e.json()},enabled:!!s&&!!o});S(()=>{if(j?.ancestorFolders&&s){let e=j.ancestorFolders.findIndex((t)=>t.id===s.rootFolderId);if(e!==-1)ee(j.ancestorFolders.slice(0,e));else if(o===s.rootFolderId)ee([])}},[j,s,o]);let[D,u]=w(null),[I,f]=w(new Set),[be,Pe]=w(360),[U,Ne]=w(()=>!W),P=M(null),[te,E]=w([]),[Ce,se]=w(0),[ke,_]=w(null),[oe,Ae]=w(null),[je,De]=w(void 0),{data:T,fetchNextPage:ae,hasNextPage:ne,isFetchingNextPage:ie,isLoading:le,error:de}=Tt({queryKey:["public-share-children",r,o,"folder",d],queryFn:async({pageParam:e})=>{let t=await R.api.shares[":shareId"].folders[":folderId"].children.$get({param:{shareId:r,folderId:o},query:{assetType:"folder",after:e}},{headers:{"x-share-password":d}});if(t.status===401)throw Error("Unauthorized");if(t.status===403)throw Error("Expired");return await t.json()},enabled:!!s&&!!o,initialPageParam:"",getNextPageParam:(e)=>e.pageInfo?.cursor||void 0,retry:!1}),{data:L,fetchNextPage:ce,hasNextPage:fe,isFetchingNextPage:ue,isLoading:me}=Tt({queryKey:["public-share-children",r,o,"file",d],queryFn:async({pageParam:e})=>{let t=await R.api.shares[":shareId"].folders[":folderId"].children.$get({param:{shareId:r,folderId:o},query:{assetType:"file",after:e}},{headers:{"x-share-password":d}});if(t.status===401)throw Error("Unauthorized");if(t.status===403)throw Error("Expired");return await t.json()},enabled:!!s&&!!o,initialPageParam:"",getNextPageParam:(e)=>e.pageInfo?.cursor||void 0,retry:!1}),{data:pe}=X({queryKey:["public-share-fields",r,d],queryFn:async()=>{let e=await R.api.shares[":shareId"].fields.$get({param:{shareId:r}},{headers:{"x-share-password":d}});if(e.status===401)throw Error("Unauthorized");return await e.json()},enabled:!!s}),{data:m,isLoading:$e}=X({queryKey:["public-share-file",r,l,d],queryFn:async()=>{let e=await R.api.shares[":shareId"].files[":fileId"].$get({param:{shareId:r,fileId:l}},{headers:{"x-share-password":d}});if(e.status===401)throw Error("Unauthorized");return await e.json()},enabled:!!l&&!!s}),{data:Ee,isLoading:Te}=X({queryKey:["public-share-file",r,x,d],queryFn:async()=>{let e=await R.api.shares[":shareId"].files[":fileId"].$get({param:{shareId:r,fileId:x}},{headers:{"x-share-password":d}});if(e.status===401)throw Error("Unauthorized");return await e.json()},enabled:!!x&&!!s}),n=x?Ee:m,Le=$e||!!x&&Te;S(()=>{if(de?.message==="Unauthorized")J(""),localStorage.removeItem(`share_pwd_${r}`)},[de,r]);let h=G(()=>T?.pages.flatMap((e)=>e.data??[])??[],[T]),v=G(()=>L?.pages.flatMap((e)=>e.data??[])??[],[L]),Re=T?.pages[0]?.pageInfo?.total,qe=L?.pages[0]?.pageInfo?.total,ze=T?.pages[0]?.pageInfo?.totalSize,Me=L?.pages[0]?.pageInfo?.totalSize,ge=G(()=>{if(n)return n;if(I.size!==1)return null;let e=Array.from(I)[0];return[...h,...v].find((t)=>t.id===e)||null},[I,h,v,n]),Ke=(e)=>{e.preventDefault(),J(q),localStorage.setItem(`share_pwd_${r}`,q)},he=(e)=>{if(e.type==="folder"||e.targetType==="folder")c({to:"/share/$shareId/folders/$folderId",params:{shareId:r,folderId:e.id}});else c({to:"/share/$shareId/files/$fileId",params:{shareId:r,fileId:e.versionStack?e.versionStack.id:e.id}});f(new Set)},Ve=(e)=>{if(!s)return;let t=e==="root"?s.rootFolderId:e;if(t===s.rootFolderId)c({to:"/share/$shareId",params:{shareId:r}});else c({to:"/share/$shareId/folders/$folderId",params:{shareId:r,folderId:t}});f(new Set),u(null)},Ue=(e)=>{_(e.id||null);let t=e.annotations;if(t&&t.length>0)E(t);else E([]);if(p){if(e.second!==null&&e.second!==void 0)De({second:e.second,nonce:Date.now()});return}if(e.second!==null&&e.second!==void 0)P.current?.seekTo(e.second),P.current?.pause();else if(t&&t.length>0)P.current?.pause()},we=()=>{E([]),_(null)},_e=()=>{E([]),_(null)},B=(e)=>{if(!l)return;c({to:"/share/$shareId/files/$fileId",params:{shareId:r,fileId:l},search:(t)=>({...t,...e})})},Be=()=>{B({compare:void 0,cmpLeft:void 0,cmpRight:void 0,cmpActive:void 0,version:Q==="left"?C:k})},{setProjectState:Ie,clearProjectState:Fe}=Zn();S(()=>{if(s&&o){let e=o===s.rootFolderId?s.name:h.find((t)=>t.id===o)?.name||s.name;Ie({teamId:"",projectId:s.projectId,projectName:s.name,ancestorFolders:V,currentAsset:{name:n?.name||e,type:l?"file":"folder",version:m?.versionStack?m.versionStack.versions.find((t)=>t.id===z)?.version??m.versionStack.versions.length:void 0,proxyType:n?.proxyType||null},isRootFolder:o===s.rootFolderId&&!l,isPublic:!0,shareId:r,fileId:l||void 0,allowDownload:s.allowDownload,downloadInfo:n?{originalKey:n.media?.original?.key,videoTranscodes:n.media?.videoTranscodes?.map((t)=>({key:t.key,width:t.width,height:t.height,resolution:t.resolution,hdr:t.hdr}))}:void 0,onFolderClick:Ve,isRightSidebarCollapsed:U,onRightSidebarToggle:()=>Ne((t)=>!t),versions:m?.versionStack?.versions,compareMode:p,canCompareVersions:(m?.versionStack?.versions?.length??0)>=2,onCompareVersions:()=>{let t=gu(m?.versionStack?.versions);if(!t||!l)return;c({to:"/share/$shareId/files/$fileId",params:{shareId:r,fileId:l},search:(i)=>({...i,compare:!0,cmpLeft:t.left.id,cmpRight:t.right.id,cmpActive:"left"})})}})}return()=>Fe()},[s,o,h,n,m,z,l,V,Ie,Fe,U,p,c,r]);let y;if(Se&&!b)y=a("div",{className:"flex flex-1 items-center justify-center bg-background",children:a(K,{className:"h-8 w-8 animate-spin text-foreground"})});else if(b)if(b.message==="Unauthorized"){let e=d!=="";y=a("div",{className:"flex flex-1 items-center justify-center p-4",children:g(lt,{className:"w-full max-w-md",children:[g(Nt,{className:"text-center",children:[a("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-primary/10",children:a(Pn,{className:"h-6 w-6 text-primary"})}),a(Ft,{children:t1()})]}),a(St,{children:g("form",{onSubmit:Ke,className:"space-y-4",children:[g("div",{className:"space-y-2",children:[a(re,{type:"password",placeholder:"Enter password",value:q,onChange:(t)=>xe(t.target.value),autoFocus:!0}),e&&a("p",{className:"text-sm font-medium text-destructive",children:"Incorrect password. Please try again."})]}),a(F,{type:"submit",className:"w-full",children:"Access Share"})]})})]})})}else{let e=b.message.includes("expired"),t=b.message.includes("disabled");y=a("div",{className:"flex flex-1 items-center justify-center p-4",children:g(lt,{className:"w-full max-w-md",children:[g(Nt,{className:"text-center",children:[a("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-destructive/10",children:a(_r,{className:"h-6 w-6 text-destructive"})}),a(Ft,{children:e?"Share Expired":t?"Share Disabled":"Error"})]}),a(St,{className:"text-center text-muted-foreground",children:b.message})]})})}else if(!s)y=a("div",{className:"flex flex-1 items-center justify-center bg-background",children:a(K,{className:"h-8 w-8 animate-spin text-foreground"})});else if(A&&l&&!p&&n){let e=n?.ancestorFolders?.[0]?.id||(o!==s.rootFolderId?o:void 0),t=n?.ancestorFolders&&n.ancestorFolders.length>0?n.ancestorFolders:V;y=a(pu,{projectId:s.projectId,fileId:l,file:n,projectInfo:{name:s.name,rootFolder:s.rootFolderId},ancestorFolders:t,versions:m?.versionStack?.versions??n?.versionStack?.versions,activeFileId:z||l,startTime:O,isPublic:!0,shareId:r,allowDownload:s.allowDownload,publicFields:pe,siblingFiles:v,onNavigateToFile:(i)=>{c({to:"/share/$shareId/files/$fileId",params:{shareId:r,fileId:i}})},onNavigateBack:()=>{if(e&&e!==s.rootFolderId)c({to:"/share/$shareId/folders/$folderId",params:{shareId:r,folderId:e}});else c({to:"/share/$shareId",params:{shareId:r}})},onSelectVersion:(i)=>{c({to:"/share/$shareId/files/$fileId",params:{shareId:r,fileId:l},search:(N)=>({...N,version:i})})},onSaveField:()=>{}})}else y=g("div",{className:"flex flex-1 overflow-hidden relative",children:[l?g("div",{className:"flex-1 relative bg-muted/30",children:[Le&&!p&&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"})}),p&&C&&k?a(mu,{isPublic:!0,shareId:r,versions:n?.versionStack?.versions??[],leftId:C,rightId:k,activeSide:Q,annotations:te,seekRequest:je,allowDownload:s.allowDownload,onActiveSideChange:(e)=>B({cmpActive:e}),onSwitchVersion:(e,t)=>B(e==="left"?{cmpLeft:t}:{cmpRight:t}),onExit:Be,onActiveAssetChange:Ae,onPlay:we,onTimeUpdate:se}):n&&a(Ns,{file:n,mediaControllerRef:P,onPlay:we,onTimeUpdate:se,onSeek:_e,annotations:te,startTime:O,shareId:r,allowDownload:s.allowDownload})]}):o&&(A?a(hu,{teamId:"",projectId:s.projectId,assetId:o,folders:h,files:v,totalFolders:Re,totalFiles:qe,totalFoldersSize:ze,totalFilesSize:Me,selectedItem:D,selectedIds:I,onItemSelect:(e,t)=>{if(t.metaKey||t.ctrlKey){let i=new Set(I);if(i.has(e.id)){if(i.delete(e.id),f(i),D?.id===e.id){let N=[...h,...v].find((H)=>i.has(H.id));u(N||null)}}else i.add(e.id),f(i),u(e)}else f(new Set([e.id])),u(e)},onItemDoubleClick:he,onClearSelection:()=>{f(new Set),u(null)},fetchNextFoldersPage:ae,hasNextFoldersPage:ne,isFetchingNextFoldersPage:ie,fetchNextFilesPage:ce,hasNextFilesPage:fe,isFetchingNextFilesPage:ue,isLoading:le||me,isShareView:!0,isPublic:!0,shareId:r,allowDownload:s.allowDownload}):a(wa,{teamId:"",projectId:s.projectId,assetId:o,folders:h,files:v,selectedItem:D,selectedIds:I,onItemSelect:(e,t)=>{if(t.metaKey||t.ctrlKey){let i=new Set(I);if(i.has(e.id)){if(i.delete(e.id),f(i),D?.id===e.id){let N=[...h,...v].find((H)=>i.has(H.id));u(N||null)}}else i.add(e.id),f(i),u(e)}else f(new Set([e.id])),u(e)},onItemDoubleClick:he,onSaveField:()=>{},displayStyle:s.viewMode??"card",onClearSelection:()=>{f(new Set),u(null)},fetchNextFoldersPage:ae,hasNextFoldersPage:ne,isFetchingNextFoldersPage:ie,fetchNextFilesPage:ce,hasNextFilesPage:fe,isFetchingNextFilesPage:ue,isLoading:le||me,isShareView:!0,isPublic:!0,shareId:r,sharePassword:d,allowDownload:s.allowDownload})),!U&&!A&&g(Y,{children:[a(Jr,{onResize:(e)=>Pe((t)=>Math.max(240,Math.min(600,t-e)))}),a("div",{style:{width:be},className:"flex-shrink-0 border-l",children:a(Ea,{teamId:"",projectId:s.projectId,file:p?oe:ge,onSaveField:()=>{},members:[],readOnly:!0,publicFields:pe,onCommentSelect:Ue,isPublic:!0,shareId:r,currentTime:Ce,onTyping:()=>{P.current?.pause()},selectedCommentId:ke,hideAnnotationControl:(p?oe:ge)?.proxyType==="audio"})})]})]});return g("div",{className:"flex h-[100dvh] flex-col bg-background",children:[(!A||!l)&&a(tm,{}),y]})}
2
- export{ba};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Yt}from"./chunk-9xhjy897.js";import{at}from"./chunk-e4yscwen.js";import{se}from"./chunk-2jj4j8cn.js";var _=se(Yt()),N=se(at()),id="AWS_ACCESS_KEY_ID",ad="AWS_SECRET_ACCESS_KEY",S="AWS_SESSION_TOKEN",C="AWS_CREDENTIAL_EXPIRATION",A="AWS_CREDENTIAL_SCOPE",p="AWS_ACCOUNT_ID",Nf=(e)=>async()=>{e?.logger?.debug("@aws-sdk/credential-provider-env - fromEnv");let o=process.env[id],E=process.env[ad],r=process.env[S],n=process.env[C],s=process.env[A],t=process.env[p];if(o&&E){let c={accessKeyId:o,secretAccessKey:E,...r&&{sessionToken:r},...n&&{expiration:new Date(n)},...s&&{credentialScope:s},...t&&{accountId:t}};return _.setCredentialFeature(c,"CREDENTIALS_ENV_VARS","g"),c}throw new N.CredentialsProviderError("Unable to find environment variable credentials.",{logger:e?.logger})};export{id,ad,Nf};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{id,ad,Nf}from"./chunk-26qn7fek.js";export{id as ENV_KEY,ad as ENV_SECRET,Nf as fromEnv};
@@ -1 +0,0 @@
1
- import{S,Z,a,X,Je,R,Pt,qt,Mg}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 m(){let{projectId:o,folderId:n}=c.useParams(),{teamId:r,ensureTeamIdForProject:t}=Pt();S(()=>{t(o)},[o,t]);let{data:d}=gr(Mg(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 +0,0 @@
1
- import{S,Z,a,X,Je,R,Pt,qt,Sg}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:o}=m.useParams(),{teamId:r,ensureTeamIdForProject:t}=Pt();S(()=>{t(o)},[o,t]);let{data:n}=gr(Sg(o)),e=n?.rootFolder,{data:d}=X({queryKey:["folders",e],queryFn:()=>(async()=>await(await R.api.folders[":folderId"].$get({param:{folderId:e}})).json())(),enabled:!!e});if(!r||!e||!d)return a(qt,{});return a(xo,{teamId:r,projectId:o,projectName:n.name??"",assetId:"recently-deleted",rootFolderId:e})}var m=Je("/projects/$projectId/recently-deleted")({component:s});export{m as Route};
@@ -1 +0,0 @@
1
- import{Q,S,G,M,w,Z,Y,a,g,ie,X,ee,Tt,Je,R,z,K,qe,Mn,jt,Do,No,ps,Re,Ue,Ge,F,De,Ne,Fe,de,En,ur,Um,vA,jm,Cb,Sb,$m,Hm,Ke,Pw,Ya,Kw,Jw,a_,Mt,th,nx,_x,w_,Cx,kx,Rx,Mx,Ox,Px,Fl,pa,bd,lh,Ll,uC,vC,VC,cS,dS,IS,kS,RS,vp,OI,yT,bT,kT,MT,Dh,_0,Nh,p1,m1,Wc,xk,Nk,wo,Uk,Wk,Xk,ny,jl,Cd,Jc,ng,og,sg,Yc,Sd,Id,ig,ag,Td,LM,ZM,BM,UM,jM,Jn,gg,RO,MO,kd,My,zO,jO,qO,$O,HO,Se,xe,ke,ot,Ce,re,Ie,Pt,an,Yn,Eo,Md,j,qr,Zn,fe,Ve,Xe,et,tt,rt,be,Aa,ar,Fr,qt,Rg}from"./chunk-zarz3sqn.js";import{ec}from"./chunk-f6avg5qe.js";import{Zd,wa}from"./chunk-s1e4qy3q.js";import{_s}from"./chunk-ns33grgx.js";import"./chunk-q2bew2vc.js";import"./chunk-55h9ze53.js";import"./chunk-8mqbztj8.js";import{Jr}from"./chunk-q5vkxee3.js";import{il,lu}from"./chunk-96qpjght.js";import{ou,su}from"./chunk-tekwpkjf.js";import{al}from"./chunk-b5rhvzv9.js";import{uu}from"./chunk-7naa7tpn.js";import{gr}from"./chunk-pk406dgy.js";import{fu}from"./chunk-8fyg9dy4.js";import"./chunk-atfz7g7e.js";import"./chunk-257dcd2f.js";import"./chunk-ny1kbmxt.js";import"./chunk-fvx9k1dc.js";import{zo}from"./chunk-kvhf12b4.js";import"./chunk-qwpkcp8d.js";import{jo}from"./chunk-88jg9dq5.js";import{Zr}from"./chunk-v5cn90cf.js";Z();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);Z();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,q]=w(!1),[ne,te]=w("new"),[se,O]=w(""),[U,V]=w(null),k=M(null),H=M(null),[J,ve]=w({w:0,h:0}),[_,A]=w(!1),s=Q((e)=>{if(H.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(),H.current=null}},[N]),W=Pt((e)=>e.teamId),me=y||W,[Ee,ye]=w(!1),[L,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(uC()),ae.current)ae.current.value="";return}if(!me){j.error(bd());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(bd());let P=await h.json();I(i,{imageAssetKey:P.key,imageAssetUrl:P.url})}catch(h){let P=h instanceof Error?h.message:bd();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(HO()),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),q(!1),j.success(BM())},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"]}),q(!1),j.success(UM())},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(Fl())},onSuccess:(e,i)=>{if(D.invalidateQueries({queryKey:["watermark-templates"]}),B===i)E(null);j.success(LM())},onError:()=>{j.error(Fl())}}),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=Q((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=Q(()=>{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(bT());return}pe({blocks:l})},wt=()=>{if(ne==="new"){if(!se.trim()){j.error(w_());return}ze({name:se.trim(),config:{blocks:l}})}else{let e=U||B;if(!e){j.error(ny());return}Me({templateId:e,config:{blocks:l}})}};return g(Y,{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:jO()})}),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"}),qO()]})}),g(Fe,{align:"end",className:"w-56",children:[a(En,{className:"text-xs font-semibold text-muted-foreground",children:RS()}),T.length===0?a("div",{className:"px-2 py-1.5 text-xs text-muted-foreground italic",children:yT()}):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(ur,{}),g(de,{onClick:()=>{te("new"),O(""),q(!0)},className:"text-xs gap-2 cursor-pointer",children:[a(Re,{className:"h-3.5 w-3.5 text-primary"}),a_()]}),T.length>0&&g(de,{onClick:()=>{te("overwrite"),V(B||T[0].id),q(!0)},className:"text-xs gap-2 cursor-pointer",children:[a(al,{className:"h-3.5 w-3.5 text-muted-foreground"}),_0()]})]})]}),a(F,{variant:"outline",size:"sm",className:"text-xs",onClick:()=>b(!1),children:Ke()}),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(al,{className:"h-3.5 w-3.5"}),Uk()]})]})]}),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=J.w>0&&J.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:J.w,height:J.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*(J.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:L[o.id]||o.imageAssetUrl?a("img",{src:L[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:My()})]})}),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(Mn,{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(ec,{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"}),Um()]})}),g(Fe,{align:"end",children:[g(de,{onClick:Be,className:"text-xs gap-2 cursor-pointer",children:[a(ec,{className:"h-3.5 w-3.5"}),jm()]}),g(de,{onClick:pt,className:"text-xs gap-2 cursor-pointer",children:[a(Do,{className:"h-3.5 w-3.5"}),vA()]})]})]})]})]}),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(ec,{className:"h-4 w-4 text-primary"}):a(Do,{className:"h-4 w-4 text-primary"}),n.type==="text"?jm():vA()]}),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:jM()}),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:cS()}),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"}),Wc?Wc():"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:kd()})]})}),L[n.id]||n.imageAssetUrl?g(Y,{children:[a("img",{src:L[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:gg()})]})]}):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:RO()}),a("p",{className:"text-[10px] text-muted-foreground mt-0.5 max-w-[150px] mx-auto leading-normal",children:MO()})]})]})]})]}),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"?vC():dS()}),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:Pw()}),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:kT()}),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:Nk()}),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:p1()}),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:m1()}),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:Xk()}),g(F,{size:"sm",variant:"outline",onClick:Be,children:[a(Re,{className:"h-3.5 w-3.5 mr-1"}),jm()]})]})})]})]})]})}),a(Se,{open:ge,onOpenChange:q,children:g(xe,{className:"max-w-md",children:[a(ke,{children:a(Ce,{className:"text-sm font-semibold",children:ne==="new"?a_():_0()})}),a("div",{className:"py-3 space-y-4 text-xs",children:ne==="new"?g("div",{className:"space-y-2",children:[a(fe,{children:ZM()}),a(re,{type:"text",value:se,onChange:(e)=>O(e.target.value),placeholder:w_(),className:"text-xs"})]}):g("div",{className:"space-y-2",children:[a(fe,{children:ny()}),a("select",{value:U||"",onChange:(e)=>V(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:()=>q(!1),children:Ke()}),a(F,{size:"sm",className:"text-xs",disabled:Le||Oe,onClick:wt,children:Ya()})]})]})})]})}function Pe(...t){return t.filter(Boolean).join(" ")}Z();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}),q=R.api.shares[":shareId"].watermark.$put,{mutate:ne}=ee({mutationFn:async()=>{let s=await q({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(zO())}}),te=ce?.watermarkStatus??t.watermarkStatus??(t.watermarkConfigId?"ready":"disabled"),se=ce?.watermarkConfig?.config??t.watermarkConfig?.config??null,O=se!==null&&te!=="disabled",{data:U}=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(kx());return await s.json()},enabled:!!t.projectId}),V=R.api.shares[":shareId"].$put,{mutate:k}=ee({mutationFn:async(s)=>{let W=await V({param:{shareId:t.id},json:s});if(!W.ok)throw Error(pa());return await W.json()},onSuccess:()=>{x.invalidateQueries({queryKey:["shares",t.projectId]}),x.invalidateQueries({queryKey:["share",t.id]}),j.success(jl())}}),H=`${window.location.origin}/share/${t.id}`,J=async(s)=>{if(await jo(s))j.success(Kw())},ve=(s)=>{let W=t.fieldVisibility||{},me={...W,[s]:!W[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:IS()}),a(Ve,{checked:!t.isDisabled,onCheckedChange:(s)=>k({isDisabled:!s})})]}),g("div",{className:"relative w-full",children:[a(re,{value:H,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:()=>J(H),children:a(Zr,{className:"h-4 w-4"})})]})]}),g("div",{className:"space-y-1",children:[a(je,{title:Wk(),icon:a(su,{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:Nh()}),a(Ve,{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:_x(),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:Cx()}),a(Ve,{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(Aa,{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:Cb()}),a(Ve,{checked:t.allowDownload,onCheckedChange:(s)=>k({allowDownload:s})})]}),a("p",{className:"text-xs text-muted-foreground",children:Sb()})]}),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:My()}),a(Ve,{checked:O,disabled:te==="processing",onCheckedChange:(s)=>{if(!s)ne();else B(!0)}})]}),O&&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:$O()})]}),O&&te!=="processing"&&a(F,{variant:"outline",size:"sm",className:"w-full text-xs gap-1.5 mt-1",onClick:()=>B(!0),children:nx()})]})]})}),a(je,{title:$m(),icon:a(ou,{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"}),VC()]}),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"}),kS()]})]})}),a(je,{title:Ll(),icon:a(lt,{className:"h-4 w-4"}),children:a("div",{className:"p-3 space-y-3 pt-2",children:U?.map((s)=>g("div",{className:"flex items-center justify-between",children:[a(fe,{className:"text-xs",children:s.config?.name}),a(Ve,{checked:t.fieldVisibility?.[s.id]??!1,onCheckedChange:()=>ve(s.id)})]},s.id))})}),a(je,{title:Jc(),icon:a(fu,{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:lh()}),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:ng()}),a(be,{value:"name",children:Yc()}),a(be,{value:"createdAt",children:og()}),a(be,{value:"size",children:ig()})]})]})]}),g("div",{className:"space-y-2",children:[a(fe,{className:"text-xs text-muted-foreground",children:Dh()}),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"?Cd():Td():_==="createdAt"?A==="asc"?Id():Sd():_==="size"?A==="asc"?ag():sg():A==="asc"?Hm():th()}),a(Zd,{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(H,"_blank"),children:[a(uu,{className:"h-4 w-4 mr-2"}),MT()]}),g(F,{className:"w-full justify-center bg-blue-600 hover:bg-blue-700 text-white",onClick:()=>J(H),children:[a(Zr,{className:"h-4 w-4 mr-2"}),Jw()]})]}),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}=Fr();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(Ox());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=Zn((r)=>r.setProjectState),oe=Zn((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),[q,ne]=w(360),{shareConfigLeftSidebarCollapsed:te,shareConfigRightSidebarCollapsed:se}=ar(),O=l?.defaultSortOrder||null,U,V;if(O){let r=O.split(":");U=r[0],V=r[1]}let k=l?.viewMode??"card",{data:H,fetchNextPage:J,hasNextPage:ve,isFetchingNextPage:_,isLoading:A}=Tt({queryKey:["folder-children",t,d,"folder",U,V],queryFn:async({pageParam:r})=>{let c=await R.api.folders[":folderId"].children.$get({param:{folderId:d},query:{assetType:"folder",after:r,sort:U,order:V}});if(!c.ok)throw Error(Mx());return await c.json()},enabled:!!d,initialPageParam:"",getNextPageParam:(r)=>r.pageInfo?.cursor||void 0}),{data:s,fetchNextPage:W,hasNextPage:me,isFetchingNextPage:Ee,isLoading:ye}=Tt({queryKey:["folder-children",t,d,"file",U,V],queryFn:async({pageParam:r})=>{let c=await R.api.folders[":folderId"].children.$get({param:{folderId:d},query:{assetType:"file",after:r,sort:U,order:V}});if(!c.ok)throw Error(Rx());return await c.json()},enabled:!!d,initialPageParam:"",getNextPageParam:(r)=>r.pageInfo?.cursor||void 0}),L=G(()=>H?.pages.flatMap((r)=>r.data??[])??[],[H]),he=G(()=>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:L.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,L,N,oe]);let[ae,ue]=w(null),[we,T]=w(new Set),_e=()=>{T(new Set),ue(null)},{dragState:pe,handleDragStart:Ae,handleDragEnd:We}=lu({teamId:t,projectId:b,assetId:d||"",folders:L,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(Px())},onSuccess:()=>{x.invalidateQueries({queryKey:["folder-children",t,d]}),j.success(xk())}}),$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(jl())}}),Oe=(r)=>{if(r.type==="folder"||r.targetType==="folder"){let c=d===v?l?.name||"":L.find((u)=>u.id===d)?.name||Jn();E((u)=>[{id:d,name:c},...u]),p(r.id),T(new Set)}};if(!l)return a("div",{children:vp()});return g(Eo,{modifiers:[il.configure({anchor:{x:0,y:0}})],sensors:[Yn.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(Y,{children:[a("div",{className:"bg-background",style:{width:ce},children:a(qr,{teamId:t,projectId:b,projectName:f,rootFolderId:y,dragState:pe})}),a(Jr,{onResize:(r)=>ge((c)=>Math.max(180,Math.min(400,c+r)))})]}),a(wa,{teamId:t,projectId:b,assetId:d||"",folders:L,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=[...L,...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:J,hasNextFoldersPage:ve,isFetchingNextFoldersPage:_,fetchNextFilesPage:W,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(Y,{children:[a(Jr,{onResize:(r)=>ne((c)=>Math.max(240,Math.min(600,c-r)))}),a("div",{style:{width:q},className:"flex-shrink-0 h-full",children:a(ut,{shareLink:l,viewMode:k,onViewModeChange:(r)=>Me({viewMode:r}),defaultSortOrder:O,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:OI({count:pe.itemCount})}):null})]})}Z();function It(){let{projectId:t,shareId:b}=Ct.useParams(),{teamId:f,ensureTeamIdForProject:m}=Pt();S(()=>{m(t)},[t,m]);let{data:y}=gr(Rg(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
- // @bun
2
- import{zy,Wg,mf,gl,nP,oP,sP,Jg,jy,iP,hf,Qn}from"./chunk-f25fe9th.js";import"./chunk-gxepkvt2.js";import"./chunk-3ckkwdjx.js";import"./chunk-yk12hydf.js";export{gl as d,Wg as f,mf as h,hf as i,oP as m,jy as n,sP as o,nP as p,iP as r,Jg as s,Qn as t,zy as u};
@@ -1 +0,0 @@
1
- import{S,Z,a,X,Je,R,Pt,qt,Ig}from"./chunk-zarz3sqn.js";import"./chunk-55h9ze53.js";import"./chunk-1ktk6764.js";import"./chunk-ah8fjb6f.js";import"./chunk-q5vkxee3.js";import{Kl}from"./chunk-srxp5jav.js";import"./chunk-b5rhvzv9.js";import"./chunk-8xb6yz11.js";import"./chunk-7sgrtxbt.js";import"./chunk-hpbn0k9n.js";import{gr}from"./chunk-pk406dgy.js";import"./chunk-257dcd2f.js";import"./chunk-91rb0jpb.js";import"./chunk-ny1kbmxt.js";Z();function m(){let{projectId:e}=c.useParams(),{teamId:r,ensureTeamIdForProject:t}=Pt();S(()=>{t(e)},[e,t]);let{data:n}=gr(Ig(e)),o=n?.rootFolder,{data:s}=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||!s)return a(qt,{});return a(Kl,{teamId:r,projectId:e,projectName:n.name??"",assetId:o,rootFolderId:o,isRoot:!0})}var c=Je("/projects/$projectId/agentsmd")({component:m});export{c as Route};
@@ -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 o(){let{shareId:e,folderId:r}=d.useParams();return a(ba,{shareId:e,initialFolderId:r})}var d=Je("/share/$shareId/folders/$folderId")({component:o});export{d as Route};
@@ -1,3 +0,0 @@
1
- // @bun
2
- function Hn(n){let e={};for(let[t,r]of n.entries())e[t]=r;return e}function Na(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{Hn,Na};
@@ -1 +0,0 @@
1
- import{S,Z,a,X,ee,Je,R,q_,Pt,Og,Uy}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 f(){let{projectId:e,collectionId:n}=I.useParams(),{teamId:c,ensureTeamIdForProject:i}=Pt();S(()=>{i(e)},[e,i]);let{data:l}=gr(Og(e)),{data:r,refetch:d}=X({...Uy(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
- import{z}from"./chunk-zarz3sqn.js";var o=[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M11 12h4",key:"q8tih4"}],["path",{d:"M11 16h7",key:"uosisv"}],["path",{d:"M11 20h10",key:"jvxblo"}]],fu=z("arrow-up-narrow-wide",o);
2
- export{fu};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{iA,aA,lA,cA,uA,Om,Pf,Nm,pA,Fm}from"./chunk-2cdxm1cp.js";import{Ye}from"./chunk-2jj4j8cn.js";var Ji={};Ye(Ji,{bigint:()=>e,boolean:()=>Vu,date:()=>t,number:()=>Xg,string:()=>_f});function _f(r){return iA(Om,r)}function Xg(r){return aA(Pf,r)}function Vu(r){return lA(Nm,r)}function e(r){return cA(pA,r)}function t(r){return uA(Fm,r)}export{_f,Xg,Vu,Ji};
@@ -1,2 +0,0 @@
1
- import{z}from"./chunk-zarz3sqn.js";var e=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],cu=z("code",e);
2
- export{cu};
@@ -1,2 +0,0 @@
1
- import{z}from"./chunk-zarz3sqn.js";var e=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],yu=z("square",e);
2
- export{yu};
@@ -1 +0,0 @@
1
- import{S,Z,a,X,Je,R,Pt,qt,Pg}from"./chunk-zarz3sqn.js";import"./chunk-55h9ze53.js";import"./chunk-1ktk6764.js";import"./chunk-ah8fjb6f.js";import"./chunk-q5vkxee3.js";import{Kl}from"./chunk-srxp5jav.js";import"./chunk-b5rhvzv9.js";import"./chunk-8xb6yz11.js";import"./chunk-7sgrtxbt.js";import"./chunk-hpbn0k9n.js";import{gr}from"./chunk-pk406dgy.js";import"./chunk-257dcd2f.js";import"./chunk-91rb0jpb.js";import"./chunk-ny1kbmxt.js";Z();function m(){let{projectId:e,folderId:s}=c.useParams(),{teamId:r,ensureTeamIdForProject:t}=Pt();S(()=>{t(e)},[e,t]);let{data:d}=gr(Pg(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(Kl,{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{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 n(){let{shareId:r,fileId:i}=e.useParams(),{start:t,version:o,compare:c,cmpLeft:m,cmpRight:s,cmpActive:p}=e.useSearch();return a(ba,{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 +0,0 @@
1
- import{S,M,w,Z,Y,a,g,ie,kl,X,ee,We,Wn,Je,R,K,Er,B,F,Ke,Mt,yd,vd,jE,fp,Fl,$x,O_,ms,Ck,wo,_t,yt,vt,bt,wt,Et,xt,Ct,Se,xe,ke,ot,Ce,re,Pt,Vt,j,Zn,An,ar,Ir,Fr,hs,Te,nm}from"./chunk-zarz3sqn.js";import"./chunk-ns33grgx.js";import"./chunk-q2bew2vc.js";import{un}from"./chunk-55h9ze53.js";import"./chunk-1ktk6764.js";import{va}from"./chunk-ah8fjb6f.js";import{Ps,gu,Ns,ci}from"./chunk-f6avg5qe.js";import{pu,mu}from"./chunk-z1p13dnc.js";import"./chunk-zezje74z.js";import{Ea}from"./chunk-r1xer8gn.js";import{Jr}from"./chunk-q5vkxee3.js";import"./chunk-hpbn0k9n.js";import"./chunk-8yjsmr7g.js";import"./chunk-atfz7g7e.js";import"./chunk-91rb0jpb.js";import"./chunk-ny1kbmxt.js";import"./chunk-fvx9k1dc.js";import"./chunk-qwpkcp8d.js";import"./chunk-v5cn90cf.js";Z();var Ft=({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),[L,U]=w(b),[_,O]=w(!!b),[u,z]=w(!1);return S(()=>{p(f),U(b),O(!!b),i.current=!0},[f,b]),S(()=>{(async()=>{if(!L||u||!C||!_)return;z(!0);try{let m=await R.api.folders[":folderId"].search.$post({param:{folderId:v},json:{assetType:"file",after:L,first:200,recursively:!1,conditions:[]}});if(!m.ok)throw Error("Failed to fetch next page");let E=await m.json(),V=E.data||[];p((W)=>[...W,...V]),U(E.pageInfo?.cursor||void 0),O(!!E.pageInfo?.cursor&&V.length>0)}catch(m){console.error("Error fetching next page:",m)}finally{z(!1)}})()},[C,L,_,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(Wn,{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(Ft,{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&&_&&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"})})]})})};Z();function kt(){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:L}=Pt(),[U,_]=w(360),[O,u]=w([]),{fileViewRightSidebarCollapsed:z}=ar(),{isChatbotOpen:c}=Ir(),m=Fr((e)=>Boolean(e.metadata["appearance.hideAgent"])),[E,V]=w(0),[W,T]=w(null),[pe,Le]=w(null),[Ee,ge]=w(void 0),[H,he]=w({show:!0,files:[],nextCursor:void 0,folderId:void 0}),[Ve,oe]=w(!0),Pe=R.api.files[":fileId"].metadata.$patch,{mutate:qe}=ee({mutationFn:async(e)=>{let o=await Pe(e);if(!o.ok)throw Error("Failed to patch metadata");return await o.json()}}),Q=ie(),{members:_e,fetchProjectMembers:Ie}=An(),Oe=hs();S(()=>{L(t)},[t,L]),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:kl}),{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:kl}),{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}=Zn(),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,G]=w(!1),[J,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:()=>{Q.invalidateQueries({queryKey:["files"]}),Q.invalidateQueries({queryKey:["version_stacks"]}),j.success(Ck?.()||"Renamed successfully"),G(!1)},onError:()=>{j.error($x?.()||"Failed to rename")}}),at=R.api.files.$delete,{mutate:lt,mutateAsync:dt,isPending:Ae}=ee({mutationFn:async(e)=>{if(!(await at(e)).ok)throw Error("Failed to delete file")},onSuccess:()=>{if(Q.invalidateQueries({queryKey:["files"]}),Q.invalidateQueries({queryKey:["version_stacks"]}),j.success(jE?.()||"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(Fl?.()||"Failed to delete")}}),ct=(e)=>{if(e?.preventDefault(),!J.trim()||!s)return;st({param:{fileId:s},json:{name:J.trim()}})},ft=()=>{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=gu(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??""),G(!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 ut=()=>{if(ae.current)return;setTimeout(()=>{if(se.current)ci(se.current)},0)};if(S(()=>{if(!l||!s)return;if(H.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 q=await ue.json(),me=q.data||[];if(x.push(...me),me.some((te)=>te.id===s)){if(y=!0,ce=q.pageInfo?.cursor||void 0,q.pageInfo?.cursor)try{let te=await R.api.folders[":folderId"].search.$post({param:{folderId:l},json:{assetType:"file",after:q.pageInfo.cursor,first:200,recursively:!1,conditions:[]}});if(te.ok){let $e=await te.json(),It=$e.data||[];x.push(...It),ce=$e.pageInfo?.cursor||void 0}}catch{}break}if(!q.pageInfo?.cursor||me.length<200)break;I=q.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,H.folderId,r]),S(()=>{V(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(nm,{});if(et||!r||!A||!p)return a("div",{children:O_()});let P=i?pe:r,je=P?.id??s,De=(e,o)=>{if(!p)return;qe({param:{fileId:je},json:[{key:e,value:o}]},{onSuccess:()=>{Q.invalidateQueries({queryKey:["files",je]})}})},de=(e)=>{h({to:"/projects/$projectId/files/$fileId",params:{projectId:t,fileId:n},search:(o)=>({...o,...e})})},mt=()=>{de({compare:void 0,cmpLeft:void 0,cmpRight:void 0,cmpActive:void 0,version:D==="left"?N:C})},pt=(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()},gt=(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)},ht=()=>{u([]),T(null)};if(Oe&&!i)return a(pu,{projectId:t,teamId:p,fileId:n,file:r,projectInfo:A,ancestorFolders:r.ancestorFolders??[],parentFolderId:l,versions:k,activeFileId:s,startTime:b,siblingFiles:H.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 dt({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(mu,{versions:k??[],leftId:N,rightId:C,activeSide:D,annotations:O,seekRequest:Ee,onActiveSideChange:(e)=>de({cmpActive:e}),onSwitchVersion:(e,o)=>de(e==="left"?{cmpLeft:o}:{cmpRight:o}),onExit:mt,onActiveAssetChange:Le,onPlay:Re,onTimeUpdate:V}):a(Ns,{file:r,mediaControllerRef:d,onPlay:Re,onTimeUpdate:V,onSeek:ht,annotations:O,startTime:b,children:a(Me,{projectId:t,currentAssetId:s,parentFolderId:l,initialFiles:H.files,initialNextCursor:H.nextCursor,isLoading:Ve})})]}),(!z||c&&!m)&&g(Y,{children:[a(Jr,{onResize:(e)=>{_((o)=>Math.max(300,Math.min(600,o-e)))},className:"hidden md:block"}),a("div",{style:{width:U},className:"flex-shrink-0 bg-background flex flex-col",children:c&&!m?a(va,{projectId:t,contextAssetId:s,file:P,currentTime:E,frameRate:P?.media?.metadata?.frameRate||30,startTimecode:P?.media?.metadata?.startTimecode,onTyping:()=>{if(i)return;d.current?.pause()},onSelectMessage:gt,selectedMessageId:W}):a(Ea,{teamId:p,projectId:t,file:P,onSaveField:De,members:_e,onCommentSelect:pt,currentTime:E,onTyping:()=>{if(i)return;d.current?.pause()},selectedCommentId:W,hideAnnotationControl:P?.proxyType==="audio"})})]})]}),a(Se,{open:ne,onOpenChange:G,children:a(xe,{children:g("form",{onSubmit:ct,children:[a(ke,{children:a(Ce,{children:ms()})}),a("div",{className:"py-4",children:a(re,{ref:se,value:J,onChange:(e)=>Fe(e.target.value),placeholder:fp?.()||"Enter new name",onFocus:ut,autoFocus:!0})}),g(ot,{children:[a(F,{type:"button",variant:"outline",onClick:()=>G(!1),children:Ke()}),g(F,{type:"submit",disabled:be||!J.trim(),children:[be&&a(K,{className:"mr-2 h-4 w-4 animate-spin"}),wo()]})]})]})})}),a(_t,{open:nt,onOpenChange:le,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:ft,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:kt});export{Ne as Route};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{lm}from"./chunk-g22wmpk1.js";export default lm();
@@ -1 +0,0 @@
1
- import{S,Z,a,X,Je,R,Pt,qt,Cg}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 m(){let{projectId:o}=c.useParams(),{teamId:r,ensureTeamIdForProject:t}=Pt();S(()=>{t(o)},[o,t]);let{data:n}=gr(Cg(o)),e=n?.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:n.name??"",assetId:"recents",rootFolderId:e})}var c=Je("/projects/$projectId/recents")({component:m});export{c as Route};