@shumai-one/shumai 0.5.0 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (164) hide show
  1. package/bin/{chunk-h82r29wm.js → chunk-04avc4fn.js} +49 -49
  2. package/bin/chunk-0asthrjf.js +2 -0
  3. package/bin/chunk-0ge2mm8j.js +1 -0
  4. package/bin/{chunk-3z20b2hz.js → chunk-0j22699g.js} +2 -2
  5. package/bin/{chunk-j909v9p5.js → chunk-0v9srsdz.js} +1 -1
  6. package/bin/{chunk-exgtwask.js → chunk-0y4zq3y4.js} +1 -1
  7. package/bin/{chunk-5yd9cv7f.js → chunk-15vsw36h.js} +5 -5
  8. package/bin/{chunk-eez1yncf.js → chunk-15w79661.js} +2 -2
  9. package/bin/{chunk-xvdd04gy.js → chunk-19jpn3r6.js} +1 -1
  10. package/bin/{chunk-grsgkkrb.js → chunk-19q13a80.js} +6 -6
  11. package/bin/{chunk-r6gkv98n.js → chunk-1nvj833s.js} +6 -6
  12. package/bin/chunk-23780yj6.js +3 -0
  13. package/bin/chunk-2gf95tj0.js +1 -0
  14. package/bin/{chunk-6vvs18bw.js → chunk-2pw7xcrn.js} +1 -1
  15. package/bin/chunk-2tk5w3jc.js +1 -0
  16. package/bin/chunk-2w6gve12.js +4 -0
  17. package/bin/chunk-301e7g3z.js +2 -0
  18. package/bin/chunk-3kmjbc3m.js +2 -0
  19. package/bin/{chunk-zhe16jvg.js → chunk-3pm6q6kg.js} +1 -1
  20. package/bin/{chunk-zfqz72sd.js → chunk-3q5qkfkc.js} +1 -1
  21. package/bin/chunk-3td60k1m.js +2 -0
  22. package/bin/chunk-42hrvk6k.js +211 -0
  23. package/bin/chunk-4zksqvwj.js +2 -0
  24. package/bin/chunk-5bk16qdp.js +2 -0
  25. package/bin/{chunk-y03z5rrg.js → chunk-5nqvqvqp.js} +3 -3
  26. package/bin/{chunk-e3r1m6rb.js → chunk-5rzxekn4.js} +1 -1
  27. package/bin/{chunk-h9x81yp6.js → chunk-5vqbzsjv.js} +1 -1
  28. package/bin/{chunk-628k58ek.js → chunk-6hzktewz.js} +2 -2
  29. package/bin/{chunk-yfe6hkzk.js → chunk-6jkjx0n2.js} +3 -3
  30. package/bin/{chunk-gy8z8sd7.js → chunk-6rn094yj.js} +1 -1
  31. package/bin/{chunk-3cvbb6kh.js → chunk-7qvvf0yd.js} +2 -2
  32. package/bin/{chunk-35mpp84e.js → chunk-81dawvn4.js} +2 -2
  33. package/bin/chunk-8abhmarc.js +2 -0
  34. package/bin/{chunk-51h2bgpf.js → chunk-8ayz61rc.js} +3 -3
  35. package/bin/{chunk-03bfjh8k.js → chunk-8ny7wvzb.js} +2 -2
  36. package/bin/{chunk-3btc8a0p.js → chunk-8tzfcqtb.js} +2 -2
  37. package/bin/{chunk-5patxztz.js → chunk-8zgq5sav.js} +3 -3
  38. package/bin/{chunk-m1xc3t0p.js → chunk-93p27bbm.js} +6 -6
  39. package/bin/chunk-951r2rx1.js +1 -0
  40. package/bin/chunk-965102pf.js +3 -0
  41. package/bin/{chunk-hr2027z3.js → chunk-98mg3dpd.js} +8 -8
  42. package/bin/{chunk-v42jcex0.js → chunk-9bakwac0.js} +4 -4
  43. package/bin/{chunk-z8mmqfm4.js → chunk-9ggwc289.js} +1 -1
  44. package/bin/{chunk-6bgbx563.js → chunk-9zgqjdx1.js} +2 -2
  45. package/bin/{chunk-kzsdp31a.js → chunk-a8bymrv1.js} +2 -2
  46. package/bin/chunk-acn3r2m2.js +1 -0
  47. package/bin/{chunk-z1r86fna.js → chunk-ae6zgjhd.js} +2 -2
  48. package/bin/{chunk-trndqdaa.js → chunk-asy868kq.js} +1 -1
  49. package/bin/{chunk-r1m4q8vw.js → chunk-b5r0be06.js} +2 -2
  50. package/bin/{chunk-dz33q4v1.js → chunk-bbcmhcvc.js} +2 -2
  51. package/bin/{chunk-myd3wg9a.js → chunk-bpxw19ez.js} +1 -1
  52. package/bin/{chunk-sg7n2g3z.js → chunk-cdk8vqeg.js} +4 -4
  53. package/bin/chunk-ce0bhc72.js +2 -0
  54. package/bin/chunk-ce75dw3k.css +1 -0
  55. package/bin/{chunk-m7dp8rqv.js → chunk-cpj562n6.js} +1 -1
  56. package/bin/{chunk-h153xefb.js → chunk-cx32wsa1.js} +1 -1
  57. package/bin/{chunk-r5rpdhed.js → chunk-d2dgazjj.js} +1 -1
  58. package/bin/{chunk-3zvvct3r.js → chunk-d5hbzp7t.js} +1 -1
  59. package/bin/chunk-d9qpgkek.js +2 -0
  60. package/bin/{chunk-9h6nn1a3.js → chunk-dche0gy0.js} +1 -1
  61. package/bin/{chunk-zcrtr8qd.js → chunk-dppfek34.js} +2 -2
  62. package/bin/chunk-dv6p6n5e.js +1 -0
  63. package/bin/{chunk-hx76pje1.js → chunk-e439kt05.js} +1 -1
  64. package/bin/{chunk-gptzcgte.js → chunk-eqr0znmc.js} +1 -1
  65. package/bin/{chunk-q5mkbnr9.js → chunk-f5z3096k.js} +2 -2
  66. package/bin/{chunk-b9j5575n.js → chunk-ffj9cq9y.js} +2 -2
  67. package/bin/{chunk-80qz30dc.js → chunk-fxg81vtx.js} +2 -2
  68. package/bin/{chunk-5jbx9gqe.js → chunk-ggfx2b0f.js} +1 -1
  69. package/bin/chunk-gnt9gewm.js +2 -0
  70. package/bin/{chunk-czny5thj.js → chunk-grjek810.js} +2 -2
  71. package/bin/chunk-gvas3xkp.js +2 -0
  72. package/bin/{chunk-ghjhyajn.js → chunk-j53sjkxt.js} +2 -2
  73. package/bin/{chunk-0tf15vee.js → chunk-jgfye6nf.js} +2 -2
  74. package/bin/{chunk-tcat7q9p.js → chunk-jt6v15wx.js} +2 -2
  75. package/bin/{chunk-rn9rktp4.js → chunk-k3prp6c6.js} +4 -4
  76. package/bin/{chunk-mqr096rn.js → chunk-k97axrc4.js} +1 -1
  77. package/bin/{chunk-20anqpf1.js → chunk-kvwec0p3.js} +2 -2
  78. package/bin/{chunk-vbbn4hth.js → chunk-kzr6ecke.js} +1 -1
  79. package/bin/{chunk-rkq6jvhb.js → chunk-m6v8vt2b.js} +2 -2
  80. package/bin/{chunk-32japja5.js → chunk-mn108p93.js} +1 -1
  81. package/bin/{chunk-31vx01aw.js → chunk-mn208vrv.js} +2 -2
  82. package/bin/chunk-mneeg71d.js +2 -0
  83. package/bin/{chunk-d7mgjqf8.js → chunk-n76w2wcr.js} +1 -1
  84. package/bin/{chunk-fyssg02c.js → chunk-n9vp9nbg.js} +29 -29
  85. package/bin/{chunk-2g5qdx4s.js → chunk-p0j4wpa5.js} +2 -2
  86. package/bin/chunk-qb178ntp.js +2 -0
  87. package/bin/{chunk-7vd5yajk.js → chunk-qmrg2jhs.js} +7 -7
  88. package/bin/{chunk-d9btz95y.js → chunk-qxscgcn9.js} +2 -2
  89. package/bin/{chunk-0vtk7wrf.js → chunk-r249n1xe.js} +2 -2
  90. package/bin/{chunk-36r20sj7.js → chunk-r776bhsg.js} +1 -1
  91. package/bin/{chunk-1k16xsqq.js → chunk-rmvhyqyb.js} +6 -6
  92. package/bin/{chunk-zwb9kamp.js → chunk-rtaya5wc.js} +2 -2
  93. package/bin/chunk-rw5h0n0s.js +1 -0
  94. package/bin/{chunk-m9sp00a9.js → chunk-ryepy5er.js} +4 -4
  95. package/bin/{chunk-mcd7zas7.js → chunk-rza95y4z.js} +2 -2
  96. package/bin/chunk-s4r6e6ms.js +1 -0
  97. package/bin/{chunk-qgkbxw1k.js → chunk-sbyyn9yw.js} +2 -2
  98. package/bin/chunk-syjjke3f.js +1 -0
  99. package/bin/chunk-t1yamxgk.js +2 -0
  100. package/bin/chunk-tgfxe0sb.js +1 -0
  101. package/bin/chunk-tjretpx8.js +1 -0
  102. package/bin/chunk-tvkekn4z.js +1 -0
  103. package/bin/{chunk-5t05jpna.js → chunk-twpc640e.js} +1 -1
  104. package/bin/{chunk-p5v22g5n.js → chunk-v034sfw8.js} +2 -2
  105. package/bin/{chunk-wydd7sz7.js → chunk-v5hz09a1.js} +2 -2
  106. package/bin/{chunk-j3xaq9s3.js → chunk-vm2pz2hm.js} +2 -2
  107. package/bin/{chunk-mt532a33.js → chunk-vzdgsfkf.js} +1 -1
  108. package/bin/chunk-w4yjgez6.js +14 -0
  109. package/bin/{chunk-0yv0nnmh.js → chunk-w73v578p.js} +2 -2
  110. package/bin/{chunk-edjtb7pk.js → chunk-w9z27p0m.js} +2 -2
  111. package/bin/chunk-wjcebkpb.js +1 -0
  112. package/bin/{chunk-cw8z9w5c.js → chunk-wnqxyqrg.js} +2 -2
  113. package/bin/chunk-ws71fg50.js +2 -0
  114. package/bin/{chunk-g8h1e1kh.js → chunk-wwkhskce.js} +2 -2
  115. package/bin/{chunk-kgfa5y9w.js → chunk-xr2v0d6y.js} +5 -5
  116. package/bin/{chunk-wkxm6yny.js → chunk-y2dhf3p0.js} +2 -2
  117. package/bin/chunk-yfp3q4da.js +1 -0
  118. package/bin/{chunk-f22nrm6r.js → chunk-ypkkfwfb.js} +4 -4
  119. package/bin/chunk-z8e4wc59.js +1 -0
  120. package/bin/{chunk-fhq5m9ya.js → chunk-zckxc8m6.js} +2 -2
  121. package/bin/{chunk-3fjgf7eb.js → chunk-zdzkjp4q.js} +2 -2
  122. package/bin/chunk-zf5cyxnt.js +2 -0
  123. package/bin/shumai-app.html +1 -1
  124. package/bin/shumai-app.js +402 -397
  125. package/package.json +7 -7
  126. package/prisma/migrations/20261008134859_add_transcode_3d/migration.sql +2 -0
  127. package/prisma/schema.prisma +1 -0
  128. package/bin/chunk-12npypek.js +0 -2
  129. package/bin/chunk-13d525jm.js +0 -2
  130. package/bin/chunk-1yt1gsyy.js +0 -2
  131. package/bin/chunk-3ewmtf1c.js +0 -1
  132. package/bin/chunk-3xw70yr4.js +0 -2
  133. package/bin/chunk-5seey9ee.js +0 -2
  134. package/bin/chunk-66hdwm6f.js +0 -2
  135. package/bin/chunk-756mr32b.js +0 -2
  136. package/bin/chunk-7wb3dga5.js +0 -2
  137. package/bin/chunk-9k86d2a3.js +0 -4
  138. package/bin/chunk-9wk11jtz.js +0 -1
  139. package/bin/chunk-a1crhhzy.js +0 -1
  140. package/bin/chunk-axfwh5et.js +0 -2
  141. package/bin/chunk-cgsxyw07.js +0 -2
  142. package/bin/chunk-dckdnqc0.js +0 -2
  143. package/bin/chunk-dx0wz749.js +0 -211
  144. package/bin/chunk-dz4fdrmk.js +0 -1
  145. package/bin/chunk-hz9stgvn.js +0 -1
  146. package/bin/chunk-hzr8100w.js +0 -3
  147. package/bin/chunk-jb6d142z.js +0 -1
  148. package/bin/chunk-k9cgfzgk.js +0 -3
  149. package/bin/chunk-meyvvmgk.js +0 -1
  150. package/bin/chunk-n1b3pt17.js +0 -14
  151. package/bin/chunk-n5v48hz5.js +0 -2
  152. package/bin/chunk-phzemmmy.js +0 -2
  153. package/bin/chunk-qhzat67w.js +0 -2
  154. package/bin/chunk-smcn7ep7.js +0 -2
  155. package/bin/chunk-tf8q7h6b.js +0 -1
  156. package/bin/chunk-tvr5rm1g.js +0 -1
  157. package/bin/chunk-ty88m3yg.js +0 -2
  158. package/bin/chunk-v2x9915x.js +0 -1
  159. package/bin/chunk-vnk2p7mq.css +0 -1
  160. package/bin/chunk-x8hky9td.js +0 -1
  161. package/bin/chunk-y12ah7c6.js +0 -1
  162. package/bin/chunk-y7jz31ay.js +0 -1
  163. package/bin/chunk-ydk3edsw.js +0 -1
  164. package/bin/chunk-zbma2zeh.js +0 -1
@@ -1,2 +0,0 @@
1
- import{Ko,Em,ul}from"./chunk-dx0wz749.js";function nr(e,r){return ul({...e,enabled:!0,suspense:!0,throwOnError:Em,placeholderData:void 0},Ko,r)}
2
- export{nr};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Cc,Ic,zu}from"./chunk-756mr32b.js";export{Cc as ENV_KEY,Ic as ENV_SECRET,zu as fromEnv};
@@ -1,2 +0,0 @@
1
- import{I}from"./chunk-dx0wz749.js";var e=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],Jl=I("code",e);
2
- export{Jl};
@@ -1,2 +0,0 @@
1
- import{h,y,u,S,L,t,o,Q,B,A,O,Vr,ve,vt,wt,Ls,pe,E,he,ge,Ae,K,De,na,sh,at,Uc,zc,gh,bb,vb,Fh,Lh,Zh,op,sp,ip,ap,xl,dg,up,dp,wg,xg,Cp,$g,uA,jp,YT,Gp,Vp,Je,Xe,et,tt,rt,nt,ot,st,ue,ae,fe,qe,le,It,q,Dt,Pt,M,Wr,yn,OA}from"./chunk-dx0wz749.js";import{au,lu,cu,uu,du}from"./chunk-n1b3pt17.js";import{Zo}from"./chunk-h82r29wm.js";import{lo}from"./chunk-d9btz95y.js";S();var Se=[];function ql({teamId:r,projectId:D,assetId:m,folders:a,files:l,totalFolders:Me,totalFiles:Re,totalFoldersSize:ze,totalFilesSize:Ue,selectedItem:J,selectedIds:w,onItemSelect:X,onItemDoubleClick:Y,onSaveField:Be,onClearSelection:$e,fetchNextFoldersPage:Z,hasNextFoldersPage:ee,isFetchingNextFoldersPage:b,fetchNextFilesPage:te,hasNextFilesPage:oe,isFetchingNextFilesPage:x,isRecentlyDeleted:k=!1,isRecents:C=!1,isLoading:se=!1,isShareView:U=!1,isPublic:ie=!1,shareId:Oe,allowDownload:re=!0}){let d=Q(),{canEdit:N,canAdmin:We}=Dt(D),ne=y(null),de=y(null),[W,je]=u(!0),[j,Qe]=u(!0),[He,_]=u(!1),[F,ce]=u(""),[Ke,H]=u(!1),me=Me??a.length,we=Re??l.length,ye=ze??(a.length>0?a.reduce((e,s)=>e+(s.sizeByte||0),0):-1),be=Ue??(l.length>0?l.reduce((e,s)=>e+(s.sizeByte||0),0):-1),Le=ye>-1,Pe=be>-1,xe=(e,s)=>{if(s)return e===1?sp({count:e}):op({count:e});else return e===1?ap({count:e}):ip({count:e})},{editingItemId:ke,setEditingItemId:Ce,handleAction:Ne,onRenameSubmit:_e,isDeleteDialogOpen:Ve,setIsDeleteDialogOpen:Ge,confirmDelete:Ye,isDownloadDialogOpen:Ze,setIsDownloadDialogOpen:P,isLoadingLinks:I,resolvedFiles:Fe,startDownload:it}=du({teamId:r,projectId:D,assetId:m,folders:a,files:l,selectedIds:w,isPublic:ie,shareId:Oe}),{ref:lt,inView:Ie}=Pt();h(()=>{if(Ie){if(ee&&!b)Z();else if(oe&&!x)te()}},[Ie,ee,b,oe,x,Z,te]);let dt=yn((e)=>e.startTask),ct=A.api.teams[":teamId"].upload.tasks.$post,{mutate:mt}=B({mutationFn:async(e)=>{let s=await ct(e);if(!s.ok)throw Error("Failed to create upload task");return await s.json()},onMutate:()=>({files:[...Se]}),onSuccess:async(e,s,n)=>{let p=n?.files||[],f=p.map((i)=>{let v=e.createdAssets?.find((c)=>c.tempId===i.id),R=e.presignedUrls?.find((c)=>c.id===i.id);return{fileId:v?.assetId||R?.fileId||i.id,name:i.file.name,size:i.file.size}}).filter((i)=>!!i.fileId),g=p.filter((i)=>!i.file.name.startsWith(".")),T=g.length===1?g[0].file.name:`${g.length} Items`;if(e.taskId)dt(e.taskId,T,f);d.invalidateQueries({queryKey:["search",r,m]}),d.invalidateQueries({queryKey:["teams",r,"upload","tasks"]}),await lu({files:p,taskId:e.taskId,teamId:r,storageBackend:e.storageBackend||"local",createdAssets:e.createdAssets,presignedUrls:e.presignedUrls,onFileFinished:async()=>{await d.invalidateQueries({queryKey:["search",r,m]})}}),d.invalidateQueries({queryKey:["search",r,m]}),d.invalidateQueries({queryKey:["teams",r,"upload","tasks"]})}}),Te=(e)=>{if(!e||e.length===0)return;let s=[],n=[],p=new Map;for(let f of e){let g=(f.webkitRelativePath||f.name).split("/");if(g.some((z)=>z.startsWith(".")))continue;let T=g.pop(),i=n,v="";for(let z of g)if(v=`${v}/${z}`,!p.has(v)){let G=[],yt={name:z,type:"folder",id:Zo(),children:G,size:0};i.push(yt),p.set(v,G),i=G}else i=p.get(v);let R={file:f,id:Zo()};s.push(R);let c=f.type;if(T.toLowerCase().endsWith(".wma")&&c?.startsWith("video/"))c=c.replace(/^video\//,"audio/");i.push({name:T,size:f.size,type:"file",id:R.id,children:[],mediaType:c})}Se=s,mt({param:{teamId:r},json:{parentId:m,files:n}})},pt=A.api.folders.$post,{mutate:ut,isPending:Ee}=B({mutationFn:async(e)=>{let s=await pt({json:{name:e,parentId:m}});if(!s.ok)throw Error("Failed to create folder");return await s.json()},onSuccess:()=>{M.success(xl()),_(!1),ce(""),d.invalidateQueries({queryKey:["search",r,m]}),d.invalidateQueries({queryKey:["folders"]})},onError:(e)=>{M.error(`Error: ${e.message}`)}}),{mutate:ft,isPending:V}=B({mutationFn:async()=>{let e=await A.api.projects[":projectId"]["empty-trash"].$post({param:{projectId:D}});if(!e.ok)throw Error("Failed to empty trash");return await e.json()},onSuccess:()=>{M.success(YT()),d.invalidateQueries({queryKey:["projects",D,"recently-deleted"]}),$e(),H(!1)},onError:(e)=>{M.error(`Error: ${e.message}`)}}),gt=(e)=>{if(e.preventDefault(),!F.trim())return;ut(F.trim())},ht=!se&&a.length===0&&l.length===0&&!b&&!x;return o("div",{className:"flex-1 flex flex-col min-h-0 bg-background overflow-hidden relative",children:[N&&o(L,{children:[t("input",{type:"file",ref:ne,multiple:!0,className:"hidden",onChange:(e)=>{if(e.target.files)Te(e.target.files)}}),t("input",{type:"file",ref:de,multiple:!0,webkitdirectory:"true",className:"hidden",onChange:(e)=>{if(e.target.files)Te(e.target.files)}})]}),k&&o("div",{className:"flex items-center justify-between px-4 py-2.5 bg-muted/20 border-b border-border text-sm shrink-0",children:[o("div",{className:"flex items-center gap-2 text-muted-foreground",children:[t(Vr,{className:"h-4 w-4 text-amber-500 shrink-0"}),t("span",{className:"text-xs",children:Cp()})]}),We&&t(E,{variant:"destructive",size:"sm",disabled:V||a.length===0&&l.length===0,onClick:()=>H(!0),className:"h-7 px-2.5 text-xs font-medium bg-destructive/10 text-destructive border border-destructive/20 hover:bg-destructive hover:text-destructive-foreground",children:"Delete"})]}),o("div",{className:"flex-1 overflow-y-auto min-h-0 p-3 pb-24",children:[se&&a.length===0&&l.length===0?t(OA,{}):o("div",{className:"max-w-lg mx-auto w-full",children:[me>0&&o("div",{className:"mb-4",children:[o("button",{onClick:()=>je(!W),className:"flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground mb-3 font-medium select-none cursor-pointer",children:[W?t(ve,{className:"h-4 w-4"}):t(vt,{className:"h-4 w-4"}),o("span",{children:[xe(me,!1),Le?` • ${Wr(ye)}`:""]})]}),W&&t("div",{className:"grid grid-cols-1 gap-4 w-full",children:a.map((e)=>t(uu,{item:e,isSelected:J?.id===e.id,isChecked:w.has(e.id),isEditing:ke===e.id,onSelect:X,onDoubleClick:Y,onContextMenu:()=>{},onDragStart:()=>{},onDrop:()=>{},onRename:(s)=>_e(e,s),onFinishEditing:()=>Ce(null),onAction:(s,n)=>Ne(s,n),isRecentlyDeleted:k,isRecents:C,selectedCount:w.size,canEdit:N,isShareView:U,allowDownload:re},e.id))})]}),we>0&&o("div",{className:"mb-4",children:[o("button",{onClick:()=>Qe(!j),className:"flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground mb-3 font-medium select-none cursor-pointer",children:[j?t(ve,{className:"h-4 w-4"}):t(vt,{className:"h-4 w-4"}),o("span",{children:[xe(we,!0),Pe?` • ${Wr(be)}`:""]})]}),j&&t("div",{className:"grid grid-cols-1 gap-4 w-full",children:l.map((e)=>t(cu,{teamId:r,item:e,isSelected:J?.id===e.id,isChecked:w.has(e.id),isEditing:ke===e.id,onSelect:X,onDoubleClick:Y,onContextMenu:()=>{},onDragStart:()=>{},onDrop:()=>{},onRename:(s)=>_e(e,s),onFinishEditing:()=>Ce(null),onSaveField:(s,n)=>Be?.(e.id,s,n),fields:[],onAction:(s,n)=>Ne(s,n),isRecentlyDeleted:k,isRecents:C,selectedCount:w.size,canEdit:N,isShareView:U,allowDownload:re},e.id))})]})]}),ht&&t("div",{className:"flex flex-col items-center justify-center h-64 text-sm text-muted-foreground p-6 text-center",children:C?o("div",{className:"flex flex-col items-center gap-2",children:[t(Ls,{className:"h-10 w-10 text-muted-foreground/40 mb-1"}),t("p",{className:"font-medium text-foreground",children:up()}),t("p",{className:"text-xs text-muted-foreground",children:dp()})]}):t("span",{children:jp()})}),t("div",{ref:lt,className:"py-4 flex justify-center items-center min-h-6",children:(b||x)&&t(O,{className:"h-5 w-5 animate-spin text-muted-foreground"})})]}),N&&!k&&!C&&!U&&!ie&&t("div",{className:"fixed bottom-6 right-6 z-30",children:o(he,{modal:!1,children:[t(ge,{asChild:!0,children:t(E,{size:"icon",className:"h-14 w-14 rounded-full bg-primary text-primary-foreground shadow-lg shadow-primary/25 hover:bg-primary/90 flex items-center justify-center","aria-label":"Actions",children:t(pe,{className:"h-6 w-6"})})}),o(Ae,{align:"end",side:"top",className:"w-48 mb-2",children:[o(K,{onClick:()=>ne.current?.click(),className:"flex items-center gap-2.5 py-2 cursor-pointer",children:[t(lo,{className:"h-4 w-4"}),t("span",{children:Gp()})]}),o(K,{onClick:()=>de.current?.click(),className:"flex items-center gap-2.5 py-2 cursor-pointer",children:[t(lo,{className:"h-4 w-4"}),t("span",{children:Vp()})]}),o(K,{onClick:()=>_(!0),className:"flex items-center gap-2.5 py-2 cursor-pointer",children:[t(au,{className:"h-4 w-4"}),t("span",{children:xl()})]})]})]})}),t(ue,{open:He,onOpenChange:_,children:t(ae,{className:"sm:max-w-md",children:o("form",{onSubmit:gt,children:[o(fe,{children:[t(le,{children:xl()}),t(It,{children:Lh()})]}),t("div",{className:"py-4",children:t(q,{autoFocus:!0,placeholder:Lh(),value:F,onChange:(e)=>ce(e.target.value)})}),o(qe,{children:[t(E,{type:"button",variant:"outline",onClick:()=>_(!1),children:De()}),o(E,{type:"submit",disabled:!F.trim()||Ee,children:[Ee?t(O,{className:"h-4 w-4 animate-spin mr-2"}):null,na()]})]})]})})}),t(Je,{open:Ve,onOpenChange:Ge,children:o(Xe,{children:[o(et,{children:[t(rt,{children:zc()}),t(nt,{children:Uc()})]}),o(tt,{children:[t(st,{children:De()}),t(ot,{onClick:()=>Ye(),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:at()})]})]})}),t(Je,{open:Ke,onOpenChange:H,children:o(Xe,{children:[o(et,{children:[t(rt,{children:vb()}),t(nt,{children:bb()})]}),o(tt,{children:[t(st,{children:De()}),t(ot,{onClick:(e)=>{e.preventDefault(),ft()},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",disabled:V,children:V?"Deleting...":at()})]})]})}),t(ue,{open:Ze,onOpenChange:P,children:o(ae,{className:"sm:max-w-md",children:[o(fe,{children:[t(le,{children:I?wg():sh()}),t(It,{children:I?$g():Fh()})]}),I?o("div",{className:"space-y-4 py-6 flex flex-col items-center justify-center",children:[t(O,{className:"h-8 w-8 animate-spin text-primary"}),t("span",{className:"text-sm font-medium text-muted-foreground mt-2",children:xg()})]}):o("div",{className:"space-y-4 py-2",children:[t("div",{className:"text-sm text-muted-foreground",children:gh({count:Fe.length})}),o("div",{className:"flex items-start gap-3 p-3 text-sm rounded-lg bg-amber-50 dark:bg-amber-950/30 text-amber-800 dark:text-amber-300 border border-amber-200 dark:border-amber-900/30",children:[t(Vr,{className:"h-5 w-5 shrink-0 mt-0.5"}),o("div",{children:[t("p",{className:"font-semibold",children:dg()}),t("p",{className:"mt-0.5 text-xs text-amber-700/90 dark:text-amber-400/90",children:Zh()})]})]})]}),t(qe,{children:!I?o(L,{children:[t(E,{variant:"outline",onClick:()=>P(!1),children:De()}),o(E,{onClick:it,className:"gap-2",disabled:Fe.length===0,children:[t(wt,{className:"h-4 w-4"}),uA()]})]}):t(E,{variant:"outline",onClick:()=>P(!1),children:De()})})]})})]})}
2
- export{ql};
@@ -1 +0,0 @@
1
- import{D,h,N,y,u,S,L,t,o,Q,Z,B,pt,ze,A,I,O,Pe,nn,vt,eo,to,Oo,pe,we,Ne,E,he,ge,Ae,K,Qr,Vt,wf,Im,Sf,K0,W0,Cf,If,De,$_,na,ay,uy,ch,at,Ff,hb,kb,xh,Lb,zb,jb,qb,Hb,$b,Na,yi,jc,qf,Da,vv,Mv,Vv,aw,cw,Sw,Cw,Iw,wd,Mx,gS,_S,ES,IS,pp,yg,mp,aE,lE,Ml,yC,MC,xo,DC,HC,VC,nA,Gc,Vc,kl,Op,Fp,Lp,Rl,Qc,Kc,Zp,Bp,Wc,CT,IT,TT,MT,RT,An,Qp,l1,c1,Yc,SA,_1,y1,b1,v1,w1,ue,ae,fe,qe,le,q,ce,lt,Dr,_n,$n,Xc,M,br,un,W,Me,Le,Ze,Be,Ue,ne,xi,$t,Ar,St,sm}from"./chunk-dx0wz749.js";import{$a}from"./chunk-h82r29wm.js";import{iu,Ci}from"./chunk-n1b3pt17.js";import{Uo}from"./chunk-edjtb7pk.js";import"./chunk-b9j5575n.js";import"./chunk-cw8z9w5c.js";import"./chunk-dckdnqc0.js";import{Ir}from"./chunk-myd3wg9a.js";import{ua,jl}from"./chunk-mcd7zas7.js";import{ca}from"./chunk-0tf15vee.js";import{Zl}from"./chunk-p5v22g5n.js";import{Bl}from"./chunk-13d525jm.js";import{nr}from"./chunk-n5v48hz5.js";import"./chunk-g8h1e1kh.js";import{Ql,Kl}from"./chunk-dz33q4v1.js";import"./chunk-3btc8a0p.js";import"./chunk-6bgbx563.js";import{lo}from"./chunk-d9btz95y.js";import"./chunk-czny5thj.js";import{co}from"./chunk-80qz30dc.js";import{Nr}from"./chunk-r5rpdhed.js";S();var Ct=[["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"}]],dt=I("folder-open",Ct);var _t=[["path",{d:"M2 5h20",key:"1fs1ex"}],["path",{d:"M6 12h12",key:"8npq4p"}],["path",{d:"M9 19h6",key:"456am0"}]],ct=I("list-filter",_t);S();function It({ratio:a}){switch(a){case"16:9":return t("span",{className:"inline-block w-4 h-2.5 border border-current rounded-[1px] shrink-0"});case"9:16":return t("span",{className:"inline-block w-2.5 h-4 border border-current rounded-[1px] shrink-0"});case"4:3":return t("span",{className:"inline-block w-3.5 h-2.5 border border-current rounded-[1px] shrink-0"});case"3:4":return t("span",{className:"inline-block w-2.5 h-3.5 border border-current rounded-[1px] shrink-0"});case"1:1":return t("span",{className:"inline-block w-3 h-3 border border-current rounded-[1px] shrink-0"});default:return t("span",{className:"inline-block w-4 h-2.5 border border-current rounded-[1px] shrink-0"})}}function ot(){return Math.random().toString(36).substring(2,9)}function mt(){return{id:ot(),type:"text",text:"CONFIDENTIAL",x:0.5,y:0.5,size:0.05,color:"#999999",opacity:0.5,rotation:-30}}function Ft(){return{id:ot(),type:"image",imageAssetKey:"",x:0.5,y:0.5,size:0.15,opacity:0.5,rotation:0}}var st=[{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"}],Dt={"16:9":1.7777777777777777,"9:16":0.5625,"4:3":1.3333333333333333,"3:4":0.75,"1:1":1};function ft({open:a,onOpenChange:k,initialConfig:x,shareId:p,teamId:C,onSaveSuccess:v}){let z=Q(),[d,w]=u([]),[c,g]=u(null),[R,H]=u(null),[_,xe]=u("16:9"),[be,ye]=u("grid"),[_e,J]=u(!1),[ve,ie]=u("new"),[me,ee]=u(""),[te,re]=u(null),F=y(null),se=y(null),[oe,Ie]=u({w:0,h:0}),[T,G]=u(!1),s=D((e)=>{if(se.current=e,!e)return;let l=()=>{let{clientWidth:P,clientHeight:b}=e;if(P<=0||b<=0)return;let V=Dt[_],rt=P,Re=rt/V;if(Re>b)Re=b,rt=Re*V;Ie({w:Math.round(rt),h:Math.round(Re)})};l();let n=new ResizeObserver(l);return n.observe(e),()=>{n.disconnect(),se.current=null}},[_]),X=lt((e)=>e.teamId),ke=C||X,[Qe,je]=u(!1),[Y,Fe]=u({}),de=y(null),Se=A.api.teams[":teamId"].files.$post,Te=async(e,l)=>{let n=e.target.files?.[0];if(!n)return;if(n.size>1048576){if(M.error(vv()),de.current)de.current.value="";return}if(!ke){M.error(jc());return}je(!0);let P=URL.createObjectURL(n);Fe((b)=>({...b,[l]:P}));try{let b=await Se({param:{teamId:ke},form:{file:n}});if(!b.ok)throw Error(jc());let V=await b.json();j(l,{imageAssetKey:V.key,imageAssetUrl:V.url})}catch(b){let V=b instanceof Error?b.message:jc();M.error(V)}finally{if(je(!1),de.current)de.current.value=""}};h(()=>{if(a){if(x?.blocks&&x.blocks.length>0)w(x.blocks),g(x.blocks[0].id);else{let e=mt();w([e]),g(e.id)}H(null)}},[a,x]);let{data:U=[]}=Z({queryKey:["watermark-templates",C],queryFn:async()=>{let e=await A.api["watermark-templates"].$get({query:C?{teamId:C}:{}});if(!e.ok)return[];return await e.json()},enabled:a}),Ee=A.api.shares[":shareId"].watermark.$put,{mutate:Ce,isPending:Ve}=B({mutationFn:async(e)=>{let l=await Ee({param:{shareId:p},json:{enabled:!0,config:e}});if(!l.ok){let n=await l.json().catch(()=>null);throw Error(n?.error||yi())}return await l.json()},onSuccess:()=>{z.invalidateQueries({queryKey:["share",p]}),z.invalidateQueries({queryKey:["shares"]}),M.success(w1()),k(!1),v?.()},onError:(e)=>{M.error(e.message||yi())}}),He=A.api["watermark-templates"].$post,{mutate:Ge,isPending:Xe}=B({mutationFn:async({name:e,config:l})=>{let n=await He({json:{name:e,teamId:C||void 0,config:l}});if(!n.ok)throw Error(yi());return await n.json()},onSuccess:(e)=>{z.invalidateQueries({queryKey:["watermark-templates"]}),H(e.id),J(!1),M.success(TT())},onError:()=>{M.error(yi())}}),Ye=A.api["watermark-templates"][":templateId"].$put,{mutate:We,isPending:Je}=B({mutationFn:async({templateId:e,config:l})=>{let n=await Ye({param:{templateId:e},json:{config:l}});if(!n.ok)throw Error(yi());return await n.json()},onSuccess:()=>{z.invalidateQueries({queryKey:["watermark-templates"]}),J(!1),M.success(MT())},onError:()=>{M.error(yi())}}),r=A.api["watermark-templates"][":templateId"].$delete,{mutate:m}=B({mutationFn:async(e)=>{if(!(await r({param:{templateId:e}})).ok)throw Error(Na())},onSuccess:(e,l)=>{if(z.invalidateQueries({queryKey:["watermark-templates"]}),R===l)H(null);M.success(CT())},onError:()=>{M.error(Na())}}),f=d.findIndex((e)=>e.id===c),i=f>=0?d[f]:null,$e=()=>{let e=mt();w((l)=>[...l,e]),g(e.id)},xt=()=>{let e=Ft();w((l)=>[...l,e]),g(e.id)},it=(e)=>{if(!e)return;w((l)=>{let n=l.filter((P)=>P.id!==e);if(c===e)g(n.length>0?n[Math.max(0,f-1)].id:null);return n})},j=(e,l)=>{w((n)=>n.map((P)=>P.id===e?{...P,...l}:P))},ht=()=>{if(d.length===0)return;let e=(f-1+d.length)%d.length;g(d[e].id)},wt=()=>{if(d.length===0)return;let e=(f+1)%d.length;g(d[e].id)},bt=(e,l)=>{e.stopPropagation(),g(l),G(!0)},et=D((e)=>{if(!T||!c||!F.current)return;let l=F.current.getBoundingClientRect(),n=(e.clientX-l.left)/l.width,P=(e.clientY-l.top)/l.height,b=Math.max(0,Math.min(1,Math.round(n*100)/100)),V=Math.max(0,Math.min(1,Math.round(P*100)/100));j(c,{x:b,y:V})},[T,c]),tt=D(()=>{G(!1)},[]);h(()=>{if(T)window.addEventListener("mousemove",et),window.addEventListener("mouseup",tt);return()=>{window.removeEventListener("mousemove",et),window.removeEventListener("mouseup",tt)}},[T,et,tt]),h(()=>{let e=(l)=>{if(!a||!c)return;let n=l.target?.tagName?.toLowerCase();if(n==="input"||n==="textarea"||n==="select")return;if(l.key==="Delete"||l.key==="Backspace")l.preventDefault(),it(c)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[a,c,f]);let yt=(e)=>{if(e.config?.blocks&&e.config.blocks.length>0){let l=e.config.blocks.map((n)=>({...n,id:ot()}));w(l),g(l[0].id),H(e.id)}},Nt=()=>{if(d.length===0){M.error(_S());return}Ce({blocks:d})},kt=()=>{if(ve==="new"){if(!me.trim()){M.error(xh());return}Ge({name:me.trim(),config:{blocks:d}})}else{let e=te||R;if(!e){M.error(nA());return}We({templateId:e,config:{blocks:d}})}};return o(L,{children:[t(ue,{open:a,onOpenChange:k,children:o(ae,{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:[o("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border bg-card",children:[t("div",{className:"flex items-center gap-3",children:t(le,{className:"text-base font-semibold",children:y1()})}),o("div",{className:"flex items-center gap-2",children:[o(he,{modal:!1,children:[t(ge,{asChild:!0,children:o(E,{variant:"outline",size:"sm",className:"gap-2 text-xs",children:[t(dt,{className:"h-4 w-4 text-muted-foreground"}),b1()]})}),o(Ae,{align:"end",className:"w-56",children:[t(Qr,{className:"text-xs font-semibold text-muted-foreground",children:Iw()}),U.length===0?t("div",{className:"px-2 py-1.5 text-xs text-muted-foreground italic",children:gS()}):U.map((e)=>o(K,{onClick:()=>yt(e),className:"flex items-center justify-between text-xs cursor-pointer",children:[t("span",{className:"truncate flex-1",children:e.name}),R===e.id&&t(Pe,{className:"h-3.5 w-3.5 text-primary ml-2 flex-shrink-0"}),t(E,{variant:"ghost",size:"icon",className:"h-5 w-5 hover:bg-destructive/10 hover:text-destructive ml-1",onClick:(l)=>{l.stopPropagation(),m(e.id)},children:t(we,{className:"h-3 w-3"})})]},e.id)),t(Vt,{}),o(K,{onClick:()=>{ie("new"),ee(""),J(!0)},className:"text-xs gap-2 cursor-pointer",children:[t(pe,{className:"h-3.5 w-3.5 text-primary"}),ch()]}),U.length>0&&o(K,{onClick:()=>{ie("overwrite"),re(R||U[0].id),J(!0)},className:"text-xs gap-2 cursor-pointer",children:[t(ca,{className:"h-3.5 w-3.5 text-muted-foreground"}),yg()]})]})]}),t(E,{variant:"outline",size:"sm",className:"text-xs",onClick:()=>k(!1),children:De()}),o(E,{size:"sm",className:"text-xs bg-primary hover:bg-primary/90 text-primary-foreground gap-1.5",disabled:Ve,onClick:Nt,children:[t(ca,{className:"h-3.5 w-3.5"}),DC()]})]})]}),o("div",{className:"flex-1 flex overflow-hidden",children:[o("div",{className:"w-[65%] flex flex-col p-4 bg-muted/20 border-r border-border overflow-hidden select-none",children:[o("div",{className:"flex items-center justify-between mb-3",children:[t("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)=>o(E,{variant:_===e?"secondary":"ghost",size:"sm",className:Oe("h-7 px-2.5 text-xs gap-1.5 font-mono transition-all",_===e?"bg-background shadow-xs font-semibold text-foreground border border-border/50":"text-muted-foreground hover:text-foreground"),onClick:()=>xe(e),children:[t(It,{ratio:e}),t("span",{children:e})]},e))}),t("div",{className:"flex items-center gap-1.5 bg-background border border-border/60 rounded-md p-1",children:st.map((e)=>t("button",{type:"button",onClick:()=>ye(e.id),style:{backgroundColor:e.bg},className:Oe("w-5 h-5 rounded-full border border-border/80 transition-all cursor-pointer relative",be===e.id?"ring-2 ring-primary ring-offset-1 scale-110":"hover:scale-105 opacity-80 hover:opacity-100"),title:e.label},e.id))})]}),t("div",{ref:s,className:"flex-1 flex items-center justify-center overflow-hidden",children:(()=>{let e=st.find((n)=>n.id===be)||st[0],l=oe.w>0&&oe.h>0;return t("div",{ref:F,onClick:()=>g(null),style:{backgroundColor:e.bg,backgroundImage:`radial-gradient(${e.dot} 1px, transparent 1px)`,backgroundSize:"16px 16px",...l?{width:oe.w,height:oe.h}:{}},className:Oe("relative rounded-lg border border-border overflow-hidden shadow-inner transition-all",_==="16:9"&&"aspect-[16/9] w-full max-h-full",_==="9:16"&&"aspect-[9/16] h-full max-w-full",_==="4:3"&&"aspect-[4/3] w-full max-h-full",_==="3:4"&&"aspect-[3/4] h-full max-w-full",_==="1:1"&&"aspect-square h-full max-w-full"),children:d.map((n)=>{let P=n.id===c,b=n.size*(oe.w||640);return t("div",{onMouseDown:(V)=>bt(V,n.id),onClick:(V)=>{V.stopPropagation(),g(n.id)},style:{left:`${n.x*100}%`,top:`${n.y*100}%`,transform:`translate(-50%, -50%) rotate(${n.rotation}deg)`,opacity:n.opacity},className:Oe("absolute cursor-move select-none transition-shadow rounded p-1.5 flex items-center justify-center",P?"ring-2 ring-primary ring-offset-2 ring-offset-background/80 bg-primary/10":"hover:ring-1 hover:ring-muted-foreground/50"),children:n.type==="text"?t("span",{style:{fontSize:`${b}px`,color:n.color,lineHeight:1,whiteSpace:"nowrap",fontWeight:700,textShadow:"0 1px 3px rgba(0,0,0,0.5)"},children:n.text||"Text"}):t("div",{style:{width:`${b}px`,height:`${b}px`},className:"bg-primary/20 border border-primary/40 rounded flex items-center justify-center p-1 overflow-hidden",children:Y[n.id]||n.imageAssetUrl?t("img",{src:Y[n.id]||n.imageAssetUrl,alt:"Watermark logo",className:"w-full h-full object-contain pointer-events-none"}):t(eo,{className:"h-1/2 w-1/2 opacity-70 text-primary"})})},n.id)})})})()})]}),o("div",{className:"w-[35%] flex flex-col bg-card overflow-hidden border-l border-border",children:[t("div",{className:"p-4 border-b border-border bg-muted/10 flex items-center justify-between",children:o("div",{className:"flex items-center gap-2",children:[t(to,{className:"h-4 w-4 text-muted-foreground"}),t("span",{className:"text-xs font-semibold",children:SA()})]})}),o("div",{className:"p-3 border-b border-border bg-background flex items-center justify-between gap-2",children:[o("div",{className:"flex items-center gap-1",children:[t(E,{variant:"outline",size:"icon",className:"h-7 w-7",disabled:d.length<=1,onClick:ht,children:t(nn,{className:"h-4 w-4"})}),o(he,{modal:!1,children:[t(ge,{asChild:!0,children:t(E,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs font-mono",children:d.length===0?"0 / 0":`${f+1} / ${d.length}`})}),t(Ae,{align:"start",className:"w-48",children:d.map((e,l)=>o(K,{onClick:()=>g(e.id),className:"text-xs flex items-center justify-between cursor-pointer",children:[o("span",{className:"flex items-center gap-2 truncate",children:[e.type==="text"?t($a,{className:"h-3.5 w-3.5 text-muted-foreground"}):t(eo,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.type==="text"?e.text||"Text":e.imageAssetKey||"Image"]}),o("span",{className:"text-[10px] font-mono text-muted-foreground ml-2",children:["#",l+1]})]},e.id))})]}),t(E,{variant:"outline",size:"icon",className:"h-7 w-7",disabled:d.length<=1,onClick:wt,children:t(vt,{className:"h-4 w-4"})})]}),o("div",{className:"flex items-center gap-1",children:[i&&t(E,{variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:bg-destructive/10",title:at(),onClick:()=>it(i.id),children:t(we,{className:"h-4 w-4"})}),o(he,{modal:!1,children:[t(ge,{asChild:!0,children:o(E,{size:"sm",className:"h-7 text-xs gap-1",children:[t(pe,{className:"h-3.5 w-3.5"}),wf()]})}),o(Ae,{align:"end",children:[o(K,{onClick:$e,className:"text-xs gap-2 cursor-pointer",children:[t($a,{className:"h-3.5 w-3.5"}),Sf()]}),o(K,{onClick:xt,className:"text-xs gap-2 cursor-pointer",children:[t(eo,{className:"h-3.5 w-3.5"}),Im()]})]})]})]})]}),t(ce,{className:"flex-1 min-h-0 p-4",children:i?o("div",{className:"space-y-5 text-xs",children:[o("div",{className:"flex items-center justify-between pb-2 border-b border-border",children:[o("span",{className:"font-semibold text-muted-foreground flex items-center gap-1.5",children:[i.type==="text"?t($a,{className:"h-4 w-4 text-primary"}):t(eo,{className:"h-4 w-4 text-primary"}),i.type==="text"?Sf():Im()]}),o("span",{className:"text-[10px] font-mono text-muted-foreground",children:["ID: ",i.id.slice(0,6)]})]}),i.type==="text"&&o("div",{className:"space-y-2",children:[t(W,{className:"text-xs",children:RT()}),t(q,{type:"text",value:i.text,onChange:(e)=>j(i.id,{text:e.target.value}),className:"text-xs h-8"})]}),i.type==="image"&&o("div",{className:"space-y-2",children:[o("div",{className:"flex items-center justify-between",children:[t(W,{className:"text-xs",children:aw()}),i.imageAssetKey&&o("button",{type:"button",onClick:()=>j(i.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:[t(Ne,{className:"w-3.5 h-3.5"}),Ml?Ml():"Remove"]})]}),t("input",{type:"file",ref:de,className:"hidden",accept:"image/*",onChange:(e)=>Te(e,i.id)}),o("div",{onClick:()=>de.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:[Qe&&t("div",{className:"absolute inset-0 bg-background/70 backdrop-blur-xs flex flex-col items-center justify-center gap-2 z-20",children:o("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-background border rounded-full shadow-lg",children:[t(O,{className:"w-4 h-4 animate-spin text-primary"}),t("span",{className:"text-xs font-semibold",children:Yc()})]})}),Y[i.id]||i.imageAssetUrl?o(L,{children:[t("img",{src:Y[i.id]||i.imageAssetUrl,alt:"Uploaded logo preview",className:"max-w-full max-h-full object-contain transition-transform duration-300 group-hover:scale-105"}),o("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:[t(lo,{className:"w-5 h-5 transform translate-y-1 group-hover:translate-y-0 transition-transform duration-300"}),t("span",{className:"text-xs font-semibold",children:Qp()})]})]}):o("div",{className:"flex flex-col items-center gap-1.5 text-center p-3",children:[t("div",{className:"p-2 rounded-full bg-background border shadow-xs group-hover:scale-110 transition-transform duration-300",children:t(lo,{className:"w-4 h-4 text-muted-foreground"})}),o("div",{children:[t("p",{className:"text-xs font-medium text-foreground",children:l1()}),t("p",{className:"text-[10px] text-muted-foreground mt-0.5 max-w-[150px] mx-auto leading-normal",children:c1()})]})]})]})]}),o("div",{className:"space-y-2",children:[o("div",{className:"flex items-center justify-between",children:[t(W,{className:"text-xs",children:i.type==="text"?Mv():cw()}),o("span",{className:"font-mono text-[11px] text-muted-foreground",children:[Math.round(i.size*100),"%"]})]}),o("div",{className:"flex items-center gap-3",children:[t(Uo,{min:i.type==="text"?0.01:0.02,max:i.type==="text"?0.12:0.5,step:0.005,value:[i.size],onValueChange:([e])=>j(i.id,{size:e}),className:"flex-1"}),t(q,{type:"number",min:1,max:100,value:Math.round(i.size*100),onChange:(e)=>j(i.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"})]})]}),i.type==="text"&&o("div",{className:"space-y-2",children:[o("div",{className:"flex items-center justify-between",children:[t(W,{className:"text-xs",children:$_()}),t("span",{className:"font-mono text-[11px] text-muted-foreground uppercase",children:i.color})]}),o("div",{className:"flex items-center gap-2",children:[t("input",{type:"color",value:i.color,onChange:(e)=>j(i.id,{color:e.target.value}),className:"w-8 h-8 rounded border border-border cursor-pointer bg-transparent p-0"}),t(q,{type:"text",value:i.color,onChange:(e)=>j(i.id,{color:e.target.value}),className:"flex-1 h-8 text-xs font-mono"})]}),t("div",{className:"flex items-center gap-1.5 pt-1",children:["#FFFFFF","#000000","#999999","#EF4444","#3B82F6","#10B981","#F59E0B"].map((e)=>t("button",{type:"button",onClick:()=>j(i.id,{color:e}),style:{backgroundColor:e},className:"w-5 h-5 rounded-full border border-border hover:scale-110 transition-transform"},e))})]}),o("div",{className:"space-y-2",children:[o("div",{className:"flex items-center justify-between",children:[t(W,{className:"text-xs",children:ES()}),o("span",{className:"font-mono text-[11px] text-muted-foreground",children:[Math.round(i.opacity*100),"%"]})]}),t(Uo,{min:0,max:1,step:0.01,value:[i.opacity],onValueChange:([e])=>j(i.id,{opacity:e})})]}),o("div",{className:"space-y-2",children:[o("div",{className:"flex items-center justify-between",children:[t(W,{className:"text-xs",children:MC()}),o("span",{className:"font-mono text-[11px] text-muted-foreground",children:[i.rotation,"°"]})]}),t(Uo,{min:-180,max:180,step:1,value:[i.rotation],onValueChange:([e])=>j(i.id,{rotation:e})}),t("div",{className:"flex items-center gap-1.5 pt-1",children:[-45,-30,0,30,45].map((e)=>o(E,{variant:"outline",size:"sm",className:"h-6 text-[10px] flex-1 px-1 font-mono",onClick:()=>j(i.id,{rotation:e}),children:[e,"°"]},e))})]}),o("div",{className:"space-y-2",children:[o("div",{className:"flex items-center justify-between",children:[t(W,{className:"text-xs",children:aE()}),o("span",{className:"font-mono text-[11px] text-muted-foreground",children:[Math.round(i.x*100),"%"]})]}),t(Uo,{min:0,max:1,step:0.01,value:[i.x],onValueChange:([e])=>j(i.id,{x:e})})]}),o("div",{className:"space-y-2",children:[o("div",{className:"flex items-center justify-between",children:[t(W,{className:"text-xs",children:lE()}),o("span",{className:"font-mono text-[11px] text-muted-foreground",children:[Math.round(i.y*100),"%"]})]}),t(Uo,{min:0,max:1,step:0.01,value:[i.y],onValueChange:([e])=>j(i.id,{y:e})})]})]}):o("div",{className:"py-12 text-center text-xs text-muted-foreground space-y-3",children:[t("p",{children:VC()}),o(E,{size:"sm",variant:"outline",onClick:$e,children:[t(pe,{className:"h-3.5 w-3.5 mr-1"}),Sf()]})]})})]})]})]})}),t(ue,{open:_e,onOpenChange:J,children:o(ae,{className:"max-w-md",children:[t(fe,{children:t(le,{className:"text-sm font-semibold",children:ve==="new"?ch():yg()})}),t("div",{className:"py-3 space-y-4 text-xs",children:ve==="new"?o("div",{className:"space-y-2",children:[t(W,{children:IT()}),t(q,{type:"text",value:me,onChange:(e)=>ee(e.target.value),placeholder:xh(),className:"text-xs"})]}):o("div",{className:"space-y-2",children:[t(W,{children:nA()}),t("select",{value:te||"",onChange:(e)=>re(e.target.value),className:"w-full h-9 rounded-md border border-input bg-background px-3 text-xs",children:U.map((e)=>t("option",{value:e.id,children:e.name},e.id))})]})}),o(qe,{children:[t(E,{variant:"outline",size:"sm",className:"text-xs",onClick:()=>J(!1),children:De()}),t(E,{size:"sm",className:"text-xs",disabled:Xe||Je,onClick:kt,children:na()})]})]})})]})}function Oe(...a){return a.filter(Boolean).join(" ")}S();function gt({shareLink:a,viewMode:k,onViewModeChange:x,defaultSortOrder:p,onSortOrderChange:C}){let v=Q(),[z,d]=u(a.password||""),[w,c]=u(a.expireAt?new Date(a.expireAt):void 0),[g,R]=u(!1);h(()=>{d(a.password||"")},[a.password]);let[H,_]=u(a.hasPassword),[xe,be]=u(!!a.expireAt),{data:ye,refetch:_e}=Z({queryKey:["share-watermark",a.id],queryFn:async()=>{let s=await A.api.shares[":shareId"].watermark.$get({param:{shareId:a.id}});if(!s.ok)return null;return await s.json()},refetchInterval:(s)=>(s.state.data?.watermarkStatus||a.watermarkStatus)==="processing"?3000:!1}),J=A.api.shares[":shareId"].watermark.$put,{mutate:ve}=B({mutationFn:async()=>{let s=await J({param:{shareId:a.id},json:{enabled:!1}});if(!s.ok)throw Error(yi());return await s.json()},onSuccess:()=>{v.invalidateQueries({queryKey:["shares",a.projectId]}),v.invalidateQueries({queryKey:["share",a.id]}),v.invalidateQueries({queryKey:["share-watermark",a.id]}),M.success(_1())}}),ie=ye?.watermarkStatus??a.watermarkStatus??(a.watermarkConfigId?"ready":"disabled"),me=ye?.watermarkConfig?.config??a.watermarkConfig?.config??null,ee=me!==null&&ie!=="disabled",{data:te}=Z({queryKey:["fields",a.projectId],queryFn:async()=>{let s=await A.api.projects[":projectId"].fields.$get({param:{projectId:a.projectId}});if(!s.ok)throw Error(zb());return await s.json()},enabled:!!a.projectId}),re=A.api.shares[":shareId"].$put,{mutate:F}=B({mutationFn:async(s)=>{let X=await re({param:{shareId:a.id},json:s});if(!X.ok)throw Error(yi());return await X.json()},onSuccess:()=>{v.invalidateQueries({queryKey:["shares",a.projectId]}),v.invalidateQueries({queryKey:["share",a.id]}),M.success(Gc())}}),se=`${window.location.origin}/share/${a.id}`,oe=async(s)=>{if(await co(s))M.success(ay())},Ie=(s)=>{let X=a.fieldVisibility||{},ke={...X,[s]:!X[s]};F({fieldVisibility:ke})},T="index",G="asc";if(p){let s=p.split(":");T=s[0],G=s[1]||"asc"}return o("div",{className:"flex flex-col h-full bg-background border-l border-border",children:[t("div",{className:"flex-1 overflow-y-auto",children:o("div",{className:"p-4 space-y-6",children:[o("div",{className:"space-y-4",children:[o("div",{className:"flex items-center justify-between",children:[t("h3",{className:"text-sm font-medium",children:Sw()}),t(Me,{checked:!a.isDisabled,onCheckedChange:(s)=>F({isDisabled:!s})})]}),o("div",{className:"relative w-full",children:[t(q,{value:se,readOnly:!0,className:"pr-10 bg-muted/50 text-xs"}),t(E,{variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full",onClick:()=>oe(se),children:t(Nr,{className:"h-4 w-4"})})]})]}),o("div",{className:"space-y-1",children:[t(Ke,{title:HC(),icon:t(Kl,{className:"h-4 w-4"}),children:o("div",{className:"p-3 space-y-4 pt-2",children:[o("div",{className:"space-y-2",children:[o("div",{className:"flex items-center justify-between",children:[t(W,{className:"text-xs",children:mp()}),t(Me,{checked:H,onCheckedChange:(s)=>{if(_(s),!s)F({password:null})}})]}),H&&o("div",{className:"flex gap-2 animate-in fade-in slide-in-from-top-1 duration-200",children:[t(q,{type:"text",value:z,onChange:(s)=>d(s.target.value),placeholder:kb(),className:"text-xs"}),t(E,{size:"sm",onClick:()=>F({password:z}),children:xo()})]})]}),o("div",{className:"space-y-2",children:[o("div",{className:"flex items-center justify-between",children:[t(W,{className:"text-xs",children:Lb()}),t(Me,{checked:xe,onCheckedChange:(s)=>{if(be(s),!s)c(void 0),F({expireAt:null})}})]}),xe&&t("div",{className:"animate-in fade-in slide-in-from-top-1 duration-200",children:t(xi,{value:w,onChange:(s)=>{c(s),F({expireAt:s?s.toISOString():null})},className:"text-xs"})})]}),o("div",{className:"space-y-2",children:[o("div",{className:"flex items-center justify-between",children:[t(W,{className:"text-xs",children:K0()}),t(Me,{checked:a.allowDownload,onCheckedChange:(s)=>F({allowDownload:s})})]}),t("p",{className:"text-xs text-muted-foreground",children:W0()})]}),o("div",{className:"space-y-2 pt-2 border-t border-border/50",children:[o("div",{className:"flex items-center justify-between",children:[t(W,{className:"text-xs",children:SA()}),t(Me,{checked:ee,disabled:ie==="processing",onCheckedChange:(s)=>{if(!s)ve();else R(!0)}})]}),ee&&ie==="processing"&&o("div",{className:"flex items-center gap-2 text-xs text-amber-600 dark:text-amber-400 font-medium py-1 animate-pulse",children:[t(O,{className:"h-3.5 w-3.5 animate-spin"}),t("span",{children:v1()})]}),ee&&ie!=="processing"&&t(E,{variant:"outline",size:"sm",className:"w-full text-xs gap-1.5 mt-1",onClick:()=>R(!0),children:hb()})]})]})}),t(Ke,{title:Cf(),icon:t(Ql,{className:"h-4 w-4"}),children:o("div",{className:"p-3 space-y-3 pt-2 flex gap-2",children:[o(E,{variant:k==="card"?"secondary":"outline",size:"sm",className:"flex-1 gap-2 text-xs",onClick:()=>x("card"),children:[t(to,{className:"h-4 w-4"}),Vv()]}),o(E,{variant:k==="list"?"secondary":"outline",size:"sm",className:"flex-1 gap-2 text-xs",onClick:()=>x("list"),children:[t(Oo,{className:"h-4 w-4"}),Cw()]})]})}),t(Ke,{title:Da(),icon:t(ct,{className:"h-4 w-4"}),children:t("div",{className:"p-3 space-y-3 pt-2",children:te?.map((s)=>o("div",{className:"flex items-center justify-between",children:[t(W,{className:"text-xs",children:s.config?.name}),t(Me,{checked:a.fieldVisibility?.[s.id]??!1,onCheckedChange:()=>Ie(s.id)})]},s.id))})}),t(Ke,{title:kl(),icon:t(Bl,{className:"h-4 w-4"}),children:o("div",{className:"p-3 space-y-4 pt-2",children:[o("div",{className:"space-y-2",children:[t(W,{className:"text-xs text-muted-foreground",children:qf()}),o(Le,{value:T,onValueChange:(s)=>{if(s==="index")C(null);else C(`${s}:${G}`)},children:[t(Be,{className:"w-full text-xs h-9",children:t(Ze,{})}),o(Ue,{children:[t(ne,{value:"index",children:Op()}),t(ne,{value:"name",children:Rl()}),t(ne,{value:"createdAt",children:Fp()}),t(ne,{value:"size",children:Zp()})]})]})]}),o("div",{className:"space-y-2",children:[t(W,{className:"text-xs text-muted-foreground",children:pp()}),o(E,{variant:"outline",className:"w-full justify-between font-normal text-xs h-9",disabled:T==="index",onClick:()=>{C(`${T}:${G==="asc"?"desc":"asc"}`)},children:[t("span",{children:T==="name"?G==="asc"?Vc():Wc():T==="createdAt"?G==="asc"?Kc():Qc():T==="size"?G==="asc"?Bp():Lp():G==="asc"?If():Ff()}),t(iu,{className:"h-4 w-4 opacity-50"})]})]})]})})]})]})}),o("div",{className:"p-4 border-t border-border space-y-2",children:[o(E,{variant:"outline",className:"w-full justify-center",onClick:()=>window.open(se,"_blank"),children:[t(Zl,{className:"h-4 w-4 mr-2"}),IS()]}),o(E,{className:"w-full justify-center bg-blue-600 hover:bg-blue-700 text-white",onClick:()=>oe(se),children:[t(Nr,{className:"h-4 w-4 mr-2"}),uy()]})]}),t(ft,{open:g,onOpenChange:R,initialConfig:me,shareId:a.id,onSaveSuccess:()=>{_e(),v.invalidateQueries({queryKey:["share",a.id]}),v.invalidateQueries({queryKey:["shares",a.projectId]})}})]})}function Ke({title:a,icon:k,children:x}){let[p,C]=u(!1);return o("div",{className:"border-b border-border last:border-0",children:[o("button",{onClick:()=>C(!p),className:"w-full flex items-center justify-between py-3 px-2 hover:bg-muted/50 transition-colors",children:[o("div",{className:"flex items-center gap-3",children:[k,t("span",{className:"text-sm font-medium",children:a})]}),t(vt,{className:Mt("h-4 w-4 transition-transform",p&&"rotate-90")})]}),p&&x&&t("div",{className:"animate-in fade-in slide-in-from-top-1 duration-200",children:x})]})}function Mt(...a){return a.filter(Boolean).join(" ")}function nt({teamId:a,projectId:k,projectName:x,shareId:p,rootFolderId:C}){let v=Q(),{fetchMetadata:z}=Ar();h(()=>{if(a)z(a)},[a,z]);let{data:d}=Z({queryKey:["share",p],queryFn:async()=>{let r=await A.api.shares[":shareId"].$get({param:{shareId:p}});if(!r.ok)throw Error(Hb());return await r.json()}}),w=d?.rootFolderId,[c,g]=u(null),[R,H]=u([]);h(()=>{if(w)g(w),H([]),U(new Set)},[w,p]);let _=un((r)=>r.setProjectState),xe=un((r)=>r.clearProjectState),be=(r)=>{if(r===c)return;if(r===w)g(w),H([]);else{let m=R.findIndex((f)=>f.id===r);if(m!==-1)g(r),H(R.slice(m+1))}U(new Set)},[ye,_e]=u(240),[J,ve]=u(360),{shareConfigLeftSidebarCollapsed:ie,shareConfigRightSidebarCollapsed:me}=$t(),ee=d?.defaultSortOrder||null,te,re;if(ee){let r=ee.split(":");te=r[0],re=r[1]}let F=d?.viewMode??"card",{data:se,fetchNextPage:oe,hasNextPage:Ie,isFetchingNextPage:T,isLoading:G}=pt({queryKey:["folder-children",a,c,"folder",te,re],queryFn:async({pageParam:r})=>{let m=await A.api.folders[":folderId"].children.$get({param:{folderId:c},query:{assetType:"folder",after:r,sort:te,order:re}});if(!m.ok)throw Error(qb());return await m.json()},enabled:!!c,initialPageParam:"",getNextPageParam:(r)=>r.pageInfo?.cursor||void 0}),{data:s,fetchNextPage:X,hasNextPage:ke,isFetchingNextPage:Qe,isLoading:je}=pt({queryKey:["folder-children",a,c,"file",te,re],queryFn:async({pageParam:r})=>{let m=await A.api.folders[":folderId"].children.$get({param:{folderId:c},query:{assetType:"file",after:r,sort:te,order:re}});if(!m.ok)throw Error(jb());return await m.json()},enabled:!!c,initialPageParam:"",getNextPageParam:(r)=>r.pageInfo?.cursor||void 0}),Y=N(()=>se?.pages.flatMap((r)=>r.data??[])??[],[se]),Fe=N(()=>s?.pages.flatMap((r)=>r.data??[])??[],[s]);h(()=>{if(d)_({teamId:a,projectId:k,projectName:x,ancestorFolders:R,currentAsset:{name:c===w?d.name:Y.find((r)=>r.id===c)?.name||d.name,type:"folder"},isRootFolder:!1,shareId:p,onFolderClick:be});return()=>xe()},[a,k,x,R,c,w,d,p,Y,_,xe]);let[de,Se]=u(null),[Te,U]=u(new Set),Ee=()=>{U(new Set),Se(null)},{dragState:Ce,handleDragStart:Ve,handleDragEnd:He}=jl({teamId:a,projectId:k,assetId:c||"",folders:Y,files:Fe,selectedIds:Te,onClearSelection:Ee}),Ge=A.api.shares[":shareId"].assets[":assetId"].$delete,{mutate:Xe}=B({mutationFn:async(r)=>{if(!(await Ge({param:{shareId:p,assetId:r}})).ok)throw Error($b())},onSuccess:()=>{v.invalidateQueries({queryKey:["folder-children",a,c]}),M.success(yC())}}),Ye=A.api.shares[":shareId"].$put,{mutate:We}=B({mutationFn:async(r)=>{let m=await Ye({param:{shareId:p},json:r});if(!m.ok)throw Error(yi());return await m.json()},onSuccess:()=>{v.invalidateQueries({queryKey:["share",p]}),M.success(Gc())}}),Je=(r)=>{if(r.type==="folder"||r.targetType==="folder"){let m=c===w?d?.name||"":Y.find((f)=>f.id===c)?.name||An();H((f)=>[{id:c,name:m},...f]),g(r.id),U(new Set)}};if(!d)return t("div",{children:wd()});return o($n,{modifiers:[ua.configure({anchor:{x:0,y:0}})],sensors:[_n.configure({activationConstraints:[new Dr.Distance({value:10})]})],onDragStart:Ve,onDragEnd:He,children:[t("div",{className:"flex flex-1 flex-col bg-background min-h-0",children:o("div",{className:"flex flex-1 overflow-hidden relative",children:[!ie&&o(L,{children:[t("div",{className:"bg-background",style:{width:ye},children:t(br,{teamId:a,projectId:k,projectName:x,rootFolderId:C,dragState:Ce})}),t(Ir,{onResize:(r)=>_e((m)=>Math.max(180,Math.min(400,m+r)))})]}),t(Ci,{teamId:a,projectId:k,assetId:c||"",folders:Y,files:Fe,selectedItem:de,selectedIds:Te,onItemSelect:(r,m)=>{if(m.metaKey||m.ctrlKey){let f=new Set(Te);if(f.has(r.id)){if(f.delete(r.id),U(f),de?.id===r.id){let i=[...Y,...Fe].find(($e)=>f.has($e.id));Se(i||null)}}else f.add(r.id),U(f),Se(r)}else U(new Set([r.id])),Se(r)},onItemDoubleClick:Je,onSaveField:()=>{},displayStyle:F,onClearSelection:Ee,fetchNextFoldersPage:oe,hasNextFoldersPage:Ie,isFetchingNextFoldersPage:T,fetchNextFilesPage:X,hasNextFilesPage:ke,isFetchingNextFilesPage:Qe,isLoading:G||je,filterConditions:[],onFilterChange:()=>{},dragState:Ce,isShareView:!0,onRemoveFromShare:(r)=>{r.forEach((m)=>Xe(m.id))},fieldVisibility:d.fieldVisibility}),!me&&o(L,{children:[t(Ir,{onResize:(r)=>ve((m)=>Math.max(240,Math.min(600,m-r)))}),t("div",{style:{width:J},className:"flex-shrink-0 h-full",children:t(gt,{shareLink:d,viewMode:F,onViewModeChange:(r)=>We({viewMode:r}),defaultSortOrder:ee,onSortOrderChange:(r)=>We({defaultSortOrder:r})})})]})]})}),t(Xc,{children:Ce?.isActive?t("div",{className:"flex items-center gap-2 rounded-md bg-popover px-3 py-2 text-sm font-medium shadow-md",children:Mx({count:Ce.itemCount})}):null})]})}S();function Tt(){let{projectId:a,shareId:k}=jt.useParams(),{teamId:x,ensureTeamIdForProject:p}=lt();h(()=>{p(a)},[a,p]);let{data:C}=nr(sm(a)),v=C?.rootFolder,{data:z}=Z({queryKey:["folders",v],queryFn:async()=>{let d=await A.api.folders[":folderId"].$get({param:{folderId:v}});if(!d.ok)throw Error("Failed to fetch folder");return await d.json()},enabled:!!v});if(!x||!v||!z)return t(St,{});return t(nt,{teamId:x,projectId:a,projectName:C.name??"",shareId:k,rootFolderId:v})}var jt=ze("/projects/$projectId/shares/$shareId")({component:Tt});export{jt as Route};
@@ -1 +0,0 @@
1
- import{t,ze}from"./chunk-dx0wz749.js";import"./chunk-n1b3pt17.js";import"./chunk-edjtb7pk.js";import"./chunk-b9j5575n.js";import"./chunk-h82r29wm.js";import"./chunk-cw8z9w5c.js";import"./chunk-dckdnqc0.js";import"./chunk-smcn7ep7.js";import"./chunk-51h2bgpf.js";import"./chunk-yfe6hkzk.js";import"./chunk-m9sp00a9.js";import"./chunk-cgsxyw07.js";import"./chunk-myd3wg9a.js";import{Si}from"./chunk-ty88m3yg.js";import"./chunk-g8h1e1kh.js";import"./chunk-7wb3dga5.js";import"./chunk-3btc8a0p.js";import"./chunk-6bgbx563.js";import"./chunk-d9btz95y.js";import"./chunk-czny5thj.js";import"./chunk-r5rpdhed.js";function a(){let{shareId:e}=s.useParams();return t(Si,{shareId:e})}var s=ze("/share/$shareId/")({component:a});export{s as Route};
@@ -1,2 +0,0 @@
1
- import{h,N,y,u,S,L,t,o,Z,pt,Re,A,O,on,E,WS,q,un,Lo,tf,ut,Tt,Mt,xt}from"./chunk-dx0wz749.js";import{Ci}from"./chunk-n1b3pt17.js";import{Hl,rs}from"./chunk-h82r29wm.js";import{ql}from"./chunk-smcn7ep7.js";import{Ii}from"./chunk-yfe6hkzk.js";import{Ul,zl}from"./chunk-cgsxyw07.js";import{Ir}from"./chunk-myd3wg9a.js";import{fr}from"./chunk-6bgbx563.js";S();function Si({shareId:r,initialFolderId:ye,initialFileId:X,startTime:G,versionId:b,compare:Ie,compareLeftId:j,compareRightId:z,compareActiveSide:J="left"}){let f=Re(),D=Lo(),w=!!Ie&&!!j&&!!z,[c,Y]=u(()=>localStorage.getItem(`share_pwd_${r}`)||""),[V,Fe]=u(""),{data:a,error:P,isLoading:be}=Z({queryKey:["share-info",r,c],queryFn:async()=>{let e=await A.api.shares[":shareId"].info.$get({param:{shareId:r}},{headers:{"x-share-password":c}});if(e.status===401)throw Error("Unauthorized");if(e.status===403){let s=await e.json();throw Error(s.error||"Forbidden")}if(!e.ok)throw Error("Failed to fetch share info");return await e.json()},retry:!1}),n=ye||a?.rootFolderId,d=X||null,U=b||d,[_,ee]=u([]),{data:T}=Z({queryKey:["public-share-folder",r,n,c],queryFn:async()=>{let e=await A.api.shares[":shareId"].files[":fileId"].$get({param:{shareId:r,fileId:n}},{headers:{"x-share-password":c}});if(e.status===401)throw Error("Unauthorized");return await e.json()},enabled:!!a&&!!n});h(()=>{if(T?.ancestorFolders&&a){let e=T.ancestorFolders.findIndex((s)=>s.id===a.rootFolderId);if(e!==-1)ee(T.ancestorFolders.slice(0,e));else if(n===a.rootFolderId)ee([])}},[T,a,n]);let[R,m]=u(null),[v,p]=u(new Set),[Se,Pe]=u(360),[B,Ne]=u(()=>!X),C=y(null),[te,W]=u([]),[Ce,se]=u(0),[ke,ae]=u(null),[oe,Ae]=u(null),[je,ze]=u(void 0),{data:M,fetchNextPage:re,hasNextPage:ne,isFetchingNextPage:ie,isLoading:le,error:de}=pt({queryKey:["public-share-children",r,n,"folder",c],queryFn:async({pageParam:e})=>{let s=await A.api.shares[":shareId"].folders[":folderId"].children.$get({param:{shareId:r,folderId:n},query:{assetType:"folder",after:e}},{headers:{"x-share-password":c}});if(s.status===401)throw Error("Unauthorized");if(s.status===403)throw Error("Expired");return await s.json()},enabled:!!a&&!!n,initialPageParam:"",getNextPageParam:(e)=>e.pageInfo?.cursor||void 0,retry:!1}),{data:K,fetchNextPage:ce,hasNextPage:fe,isFetchingNextPage:ue,isLoading:pe}=pt({queryKey:["public-share-children",r,n,"file",c],queryFn:async({pageParam:e})=>{let s=await A.api.shares[":shareId"].folders[":folderId"].children.$get({param:{shareId:r,folderId:n},query:{assetType:"file",after:e}},{headers:{"x-share-password":c}});if(s.status===401)throw Error("Unauthorized");if(s.status===403)throw Error("Expired");return await s.json()},enabled:!!a&&!!n,initialPageParam:"",getNextPageParam:(e)=>e.pageInfo?.cursor||void 0,retry:!1}),{data:me}=Z({queryKey:["public-share-fields",r,c],queryFn:async()=>{let e=await A.api.shares[":shareId"].fields.$get({param:{shareId:r}},{headers:{"x-share-password":c}});if(e.status===401)throw Error("Unauthorized");return await e.json()},enabled:!!a}),{data:g,isLoading:De}=Z({queryKey:["public-share-file",r,d,c],queryFn:async()=>{let e=await A.api.shares[":shareId"].files[":fileId"].$get({param:{shareId:r,fileId:d}},{headers:{"x-share-password":c}});if(e.status===401)throw Error("Unauthorized");return await e.json()},enabled:!!d&&!!a}),{data:Te,isLoading:$e}=Z({queryKey:["public-share-file",r,b,c],queryFn:async()=>{let e=await A.api.shares[":shareId"].files[":fileId"].$get({param:{shareId:r,fileId:b}},{headers:{"x-share-password":c}});if(e.status===401)throw Error("Unauthorized");return await e.json()},enabled:!!b&&!!a}),i=b?Te:g,Ee=De||!!b&&$e;h(()=>{if(de?.message==="Unauthorized")Y(""),localStorage.removeItem(`share_pwd_${r}`)},[de,r]);let x=N(()=>M?.pages.flatMap((e)=>e.data??[])??[],[M]),I=N(()=>K?.pages.flatMap((e)=>e.data??[])??[],[K]),Le=M?.pages[0]?.pageInfo?.total,qe=K?.pages[0]?.pageInfo?.total,Me=M?.pages[0]?.pageInfo?.totalSize,Ke=K?.pages[0]?.pageInfo?.totalSize,he=N(()=>{if(i)return i;if(v.size!==1)return null;let e=Array.from(v)[0];return[...x,...I].find((s)=>s.id===e)||null},[v,x,I,i]),Ve=(e)=>{e.preventDefault(),Y(V),localStorage.setItem(`share_pwd_${r}`,V)},ge=(e)=>{if(e.type==="folder"||e.targetType==="folder")f({to:"/share/$shareId/folders/$folderId",params:{shareId:r,folderId:e.id}});else f({to:"/share/$shareId/files/$fileId",params:{shareId:r,fileId:e.versionStack?e.versionStack.id:e.id}});p(new Set)},Ue=(e)=>{if(!a)return;let s=e==="root"?a.rootFolderId:e;if(s===a.rootFolderId)f({to:"/share/$shareId",params:{shareId:r}});else f({to:"/share/$shareId/folders/$folderId",params:{shareId:r,folderId:s}});p(new Set),m(null)},_e=(e)=>{ae(e.id||null);let s=e.annotations;if(s&&s.length>0)W(s);else W([]);if(w){if(e.second!==null&&e.second!==void 0)ze({second:e.second,nonce:Date.now()});return}if(e.second!==null&&e.second!==void 0)C.current?.seekTo(e.second),C.current?.pause();else if(s&&s.length>0)C.current?.pause()},we=()=>{W([]),ae(null)},H=(e)=>{if(!d)return;f({to:"/share/$shareId/files/$fileId",params:{shareId:r,fileId:d},search:(s)=>({...s,...e})})},Be=()=>{H({compare:void 0,cmpLeft:void 0,cmpRight:void 0,cmpActive:void 0,version:J==="left"?j:z})},{setProjectState:xe,clearProjectState:ve}=un();h(()=>{if(a&&n){let e=n===a.rootFolderId?a.name:x.find((s)=>s.id===n)?.name||a.name;xe({teamId:"",projectId:a.projectId,projectName:a.name,ancestorFolders:_,currentAsset:{name:i?.name||e,type:d?"file":"folder",version:g?.versionStack?g.versionStack.versions.find((s)=>s.id===U)?.version??g.versionStack.versions.length:void 0,proxyType:i?.proxyType||null},isRootFolder:n===a.rootFolderId&&!d,isPublic:!0,shareId:r,fileId:d||void 0,allowDownload:a.allowDownload,downloadInfo:i?{originalKey:i.media?.original?.key,videoTranscodes:i.media?.videoTranscodes?.map((s)=>({key:s.key,width:s.width,height:s.height,resolution:s.resolution,hdr:s.hdr}))}:void 0,onFolderClick:Ue,isRightSidebarCollapsed:B,onRightSidebarToggle:()=>Ne((s)=>!s),versions:g?.versionStack?.versions,compareMode:w,canCompareVersions:(g?.versionStack?.versions?.length??0)>=2,onCompareVersions:()=>{let s=Hl(g?.versionStack?.versions);if(!s||!d)return;f({to:"/share/$shareId/files/$fileId",params:{shareId:r,fileId:d},search:(l)=>({...l,compare:!0,cmpLeft:s.left.id,cmpRight:s.right.id,cmpActive:"left"})})}})}return()=>ve()},[a,n,x,i,g,U,d,_,xe,ve,B,w,f,r]);let F;if(be&&!P)F=t("div",{className:"flex flex-1 items-center justify-center bg-background",children:t(O,{className:"h-8 w-8 animate-spin text-foreground"})});else if(P)if(P.message==="Unauthorized"){let e=c!=="";F=t("div",{className:"flex flex-1 items-center justify-center p-4",children:o(ut,{className:"w-full max-w-md",children:[o(Tt,{className:"text-center",children:[t("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-primary/10",children:t(on,{className:"h-6 w-6 text-primary"})}),t(Mt,{children:WS()})]}),t(xt,{children:o("form",{onSubmit:Ve,className:"space-y-4",children:[o("div",{className:"space-y-2",children:[t(q,{type:"password",placeholder:"Enter password",value:V,onChange:(s)=>Fe(s.target.value),autoFocus:!0}),e&&t("p",{className:"text-sm font-medium text-destructive",children:"Incorrect password. Please try again."})]}),t(E,{type:"submit",className:"w-full",children:"Access Share"})]})})]})})}else{let e=P.message.includes("expired"),s=P.message.includes("disabled");F=t("div",{className:"flex flex-1 items-center justify-center p-4",children:o(ut,{className:"w-full max-w-md",children:[o(Tt,{className:"text-center",children:[t("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-destructive/10",children:t(fr,{className:"h-6 w-6 text-destructive"})}),t(Mt,{children:e?"Share Expired":s?"Share Disabled":"Error"})]}),t(xt,{className:"text-center text-muted-foreground",children:P.message})]})})}else if(!a)F=t("div",{className:"flex flex-1 items-center justify-center bg-background",children:t(O,{className:"h-8 w-8 animate-spin text-foreground"})});else if(D&&d&&!w&&i){let e=i?.ancestorFolders?.[0]?.id||(n!==a.rootFolderId?n:void 0),s=i?.ancestorFolders&&i.ancestorFolders.length>0?i.ancestorFolders:_;F=t(Ul,{projectId:a.projectId,fileId:d,file:i,projectInfo:{name:a.name,rootFolder:a.rootFolderId},ancestorFolders:s,versions:g?.versionStack?.versions??i?.versionStack?.versions,activeFileId:U||d,startTime:G,isPublic:!0,shareId:r,allowDownload:a.allowDownload,publicFields:me,siblingFiles:I,onNavigateToFile:(l)=>{f({to:"/share/$shareId/files/$fileId",params:{shareId:r,fileId:l}})},onNavigateBack:()=>{if(e&&e!==a.rootFolderId)f({to:"/share/$shareId/folders/$folderId",params:{shareId:r,folderId:e}});else f({to:"/share/$shareId",params:{shareId:r}})},onSelectVersion:(l)=>{f({to:"/share/$shareId/files/$fileId",params:{shareId:r,fileId:d},search:(k)=>({...k,version:l})})},onSaveField:()=>{}})}else F=o("div",{className:"flex flex-1 overflow-hidden relative",children:[d?o("div",{className:"flex-1 relative bg-muted/30",children:[Ee&&!w&&t("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-background/50",children:t(O,{className:"h-8 w-8 animate-spin text-foreground"})}),w&&j&&z?t(zl,{isPublic:!0,shareId:r,versions:i?.versionStack?.versions??[],leftId:j,rightId:z,activeSide:J,annotations:te,seekRequest:je,allowDownload:a.allowDownload,onActiveSideChange:(e)=>H({cmpActive:e}),onSwitchVersion:(e,s)=>H(e==="left"?{cmpLeft:s}:{cmpRight:s}),onExit:Be,onActiveAssetChange:Ae,onPlay:we,onTimeUpdate:se}):i&&t(rs,{file:i,mediaControllerRef:C,onPlay:we,onTimeUpdate:se,annotations:te,startTime:G,shareId:r,allowDownload:a.allowDownload})]}):n&&(D?t(ql,{teamId:"",projectId:a.projectId,assetId:n,folders:x,files:I,totalFolders:Le,totalFiles:qe,totalFoldersSize:Me,totalFilesSize:Ke,selectedItem:R,selectedIds:v,onItemSelect:(e,s)=>{if(s.metaKey||s.ctrlKey){let l=new Set(v);if(l.has(e.id)){if(l.delete(e.id),p(l),R?.id===e.id){let k=[...x,...I].find((Q)=>l.has(Q.id));m(k||null)}}else l.add(e.id),p(l),m(e)}else p(new Set([e.id])),m(e)},onItemDoubleClick:ge,onClearSelection:()=>{p(new Set),m(null)},fetchNextFoldersPage:re,hasNextFoldersPage:ne,isFetchingNextFoldersPage:ie,fetchNextFilesPage:ce,hasNextFilesPage:fe,isFetchingNextFilesPage:ue,isLoading:le||pe,isShareView:!0,isPublic:!0,shareId:r,allowDownload:a.allowDownload}):t(Ci,{teamId:"",projectId:a.projectId,assetId:n,folders:x,files:I,selectedItem:R,selectedIds:v,onItemSelect:(e,s)=>{if(s.metaKey||s.ctrlKey){let l=new Set(v);if(l.has(e.id)){if(l.delete(e.id),p(l),R?.id===e.id){let k=[...x,...I].find((Q)=>l.has(Q.id));m(k||null)}}else l.add(e.id),p(l),m(e)}else p(new Set([e.id])),m(e)},onItemDoubleClick:ge,onSaveField:()=>{},displayStyle:a.viewMode??"card",onClearSelection:()=>{p(new Set),m(null)},fetchNextFoldersPage:re,hasNextFoldersPage:ne,isFetchingNextFoldersPage:ie,fetchNextFilesPage:ce,hasNextFilesPage:fe,isFetchingNextFilesPage:ue,isLoading:le||pe,isShareView:!0,isPublic:!0,shareId:r,sharePassword:c,allowDownload:a.allowDownload})),!B&&!D&&o(L,{children:[t(Ir,{onResize:(e)=>Pe((s)=>Math.max(240,Math.min(600,s-e)))}),t("div",{style:{width:Se},className:"flex-shrink-0 border-l",children:t(Ii,{teamId:"",projectId:a.projectId,file:w?oe:he,onSaveField:()=>{},members:[],readOnly:!0,publicFields:me,onCommentSelect:_e,isPublic:!0,shareId:r,currentTime:Ce,onTyping:()=>{C.current?.pause()},selectedCommentId:ke,hideAnnotationControl:(w?oe:he)?.proxyType==="audio"})})]})]});return o("div",{className:"flex h-[100dvh] flex-col bg-background",children:[(!D||!d)&&t(tf,{}),F]})}
2
- export{Si};
@@ -1 +0,0 @@
1
- import{h,S,t,Z,ze,A,lt,St,im}from"./chunk-dx0wz749.js";import"./chunk-h82r29wm.js";import"./chunk-n1b3pt17.js";import"./chunk-edjtb7pk.js";import"./chunk-b9j5575n.js";import"./chunk-cw8z9w5c.js";import"./chunk-m9sp00a9.js";import"./chunk-fhq5m9ya.js";import"./chunk-mcd7zas7.js";import"./chunk-dckdnqc0.js";import"./chunk-smcn7ep7.js";import"./chunk-51h2bgpf.js";import"./chunk-yfe6hkzk.js";import"./chunk-myd3wg9a.js";import{Gn}from"./chunk-1yt1gsyy.js";import{nr}from"./chunk-n5v48hz5.js";import"./chunk-g8h1e1kh.js";import"./chunk-eez1yncf.js";import"./chunk-7wb3dga5.js";import"./chunk-3btc8a0p.js";import"./chunk-6bgbx563.js";import"./chunk-d9btz95y.js";import"./chunk-czny5thj.js";import"./chunk-r5rpdhed.js";S();function l(){let{projectId:o,folderId:n}=c.useParams(),{teamId:r,ensureTeamIdForProject:a}=lt();h(()=>{a(o)},[o,a]);let{data:s}=nr(im(o)),e=s?.rootFolder,{data:i}=Z({queryKey:["folders",e],queryFn:()=>(async()=>await(await A.api.folders[":folderId"].$get({param:{folderId:e}})).json())(),enabled:!!e});if(!r||!e||!i)return t(St,{});return t(Gn,{teamId:r,projectId:o,projectName:s.name??"",assetId:n,rootFolderId:e})}var c=ze("/projects/$projectId/folders/$folderId")({component:l});export{c as Route};