import{d as F,r as $,cK as B,c3 as S,o as _,k as w,l as f,c as l,y as d,m as p,t as c,z as s,x,O as A,cL as R,cM as y,ag as E,ae as T,W as V,q as L}from"./index-7f89456f.js";import{_ as N}from"./index-ec397928.js";import{F as U,s as O}from"./FileItem-71fdd7ed.js";import{u as j,b as q,j as H}from"./index-d3fa759a.js";import"./index-7ba6e156.js";import"./index-31a27e12.js";import"./index-08e1e48f.js";import"./shortcut-7f420da3.js";import"./index-8dbe984d.js";import"./_isIterateeCall-eac05144.js";const W={class:"actions-panel actions"},G={class:"item"},K={key:0,class:"file-list"},M={class:"hint"},P=F({__name:"batchDownload",props:{tabIdx:{},paneIdx:{},id:{}},setup(Q){const{stackViewEl:b}=j().toRefs(),{itemSize:h,gridItems:D,cellWidth:g}=q(),i=$(),m=H(),{selectdFiles:a}=B(m),r=S(),v=async e=>{const t=R(e);t&&m.addFiles(t.nodes)},C=async()=>{r.pushAction(async()=>{const e=await y.value.post("/zip",{paths:a.value.map(u=>u.fullpath),compress:i.batchDownloadCompress,pack_only:!1},{responseType:"blob"}),t=window.URL.createObjectURL(new Blob([e.data])),o=document.createElement("a");o.href=t,o.setAttribute("download",`iib_${new Date().toLocaleString()}.zip`),document.body.appendChild(o),o.click()})},I=async()=>{r.pushAction(async()=>{await y.value.post("/zip",{paths:a.value.map(e=>e.fullpath),compress:i.batchDownloadCompress,pack_only:!0},{responseType:"blob"}),E.success(T("success"))})},z=e=>{a.value.splice(e,1)};return(e,t)=>{const o=V,u=N;return _(),w("div",{class:"container",ref_key:"stackViewEl",ref:b,onDrop:v},[f("div",W,[l(o,{onClick:t[0]||(t[0]=n=>s(m).selectdFiles=[])},{default:d(()=>[p(c(e.$t("clear")),1)]),_:1}),f("div",G,[p(c(e.$t("compressFile"))+": ",1),l(u,{checked:s(i).batchDownloadCompress,"onUpdate:checked":t[1]||(t[1]=n=>s(i).batchDownloadCompress=n)},null,8,["checked"])]),l(o,{onClick:I,type:"primary",loading:!s(r).isIdle},{default:d(()=>[p(c(e.$t("packOnlyNotDownload")),1)]),_:1},8,["loading"]),l(o,{onClick:C,type:"primary",loading:!s(r).isIdle},{default:d(()=>[p(c(e.$t("zipDownload")),1)]),_:1},8,["loading"])]),s(a).length?(_(),x(s(O),{key:1,ref:"scroller",class:"file-list",items:s(a).slice(),"item-size":s(h).first,"key-field":"fullpath","item-secondary-size":s(h).second,gridItems:s(D)},{default:d(({item:n,index:k})=>[l(U,{idx:k,file:n,"cell-width":s(g),"enable-close-icon":"",onCloseIconClick:J=>z(k),"full-screen-preview-image-url":s(A)(n),"enable-right-click-menu":!1},null,8,["idx","file","cell-width","onCloseIconClick","full-screen-preview-image-url"])]),_:1},8,["items","item-size","item-secondary-size","gridItems"])):(_(),w("div",K,[f("p",M,c(e.$t("batchDownloaDDragAndDropHint")),1)]))],544)}}});const ce=L(P,[["__scopeId","data-v-3d7e6f2d"]]);export{ce as default};