import{C as q}from"./CalcVerify-DzxM0pDk.js?v=1773287522785";import{m as c,as as b,c as N}from"./index-BTglIPU2.js?v=1773287522785";import{w as O}from"./FileIcon-eIHDRaxH.js?v=1773287522785";import{B as $,q as P}from"./naive-ui--dJnpVcV.js?v=1773287522785";import{k as j,i as L,r as o,$ as p,a8 as M,a9 as n,S as i,Z as h,_ as f,a0 as m,j as u,aa as x,X as A}from"./vue-core-DJjvd5ZC.js?v=1773287522785";import"./prismjs-BZPoR7_J.js?v=1773287522785";import"./soft-Cjyfamvm.js?v=1773287522785";import"./copy-D-wIKr0q.js?v=1773287522785";const E={class:"header-tit single-line-ellipsis"},I={key:0,class:"del-modal-wrapper"},J={key:1,class:"del-modal-wrapper"},K={class:"text-[#f0a020]"},T={class:"modal-footer-btns"},U=j({__name:"Del",setup(X,{expose:D}){const v=L("fileStore"),{choosedKeys:l,fileList:d,fileRecycle:_,currentPath:k}=v,s=o(!1),r=o({}),F=o([]),y=o("Delete file"),g=o();D({open(){if(s.value=!0,l.value.length==1){const t=d.value.find(e=>e.nm==l.value[0]);r.value=t,y.value="Delete file [".concat(r.value.nm,"]")}else F.value=d.value.filter(t=>l.value.includes(t.nm))},close(){s.value=!1}});async function B(t){const e=c.loading("Files are being deleted. Please wait");try{s.value=!1,(await b.post("/files?action=DeleteFile",{path:t},{requestOptions:{isOriginalResult:!0}})).message.status==0?c.success("Files deleted successfully"):c.error("Files failed to delete")}catch(a){console.warn(a)}finally{e.close()}}async function C(t,e){await b.post("/files?action=SetBatchData",{data:JSON.stringify(t),type:4,path:e},{requestOptions:{loading:"正在批量删除中，请稍候...",successMessage:!0}}),s.value=!1}async function R(){if(l.value.length==1){const t=d.value.find(e=>e.nm==l.value[0]);await B(t.path)}l.value.length>1&&await C(l.value,k.value)}async function S(){if(!_.value&&!g.value.validate()){c.warning("Please enter the correct verification number");return}await R(),O(v)}return(t,e)=>{const a=$,V=P;return p(),M(V,{preset:"card",draggable:"","close-on-esc":!1,"mask-closable":!1,class:"w-170",segmented:"",show:i(s),"onUpdate:show":e[1]||(e[1]=w=>A(s)?s.value=w:null)},{header:n(()=>[f("div",E,x(i(y)),1)]),footer:n(()=>[f("div",T,[m(a,{onClick:e[0]||(e[0]=w=>s.value=!1)},{default:n(()=>e[5]||(e[5]=[u("cancel")])),_:1,__:[5]}),m(a,{type:"primary",onClick:S},{default:n(()=>e[6]||(e[6]=[u("confirm")])),_:1,__:[6]})])]),default:n(()=>[i(_)?(p(),h("div",J,[e[3]||(e[3]=u(" Confirm delete folder ")),f("span",K,x(i(r).path?"[".concat(i(r).path,"]"):""),1),e[4]||(e[4]=u(" ,it will move to recycle bin after delete, continue? "))])):(p(),h("div",I,[e[2]||(e[2]=f("div",{class:"text-red-5 mb-15px text-14px"}," Recycle bin is not currently open, delete file cannot be restored after, continue? ",-1)),m(q,{ref_key:"calcVertifyRef",ref:g},null,512)]))]),_:1},8,["show"])}}}),te=N(U,[["__scopeId","data-v-9d32222b"]]);export{te as default};
