import{c as e,d as a,h as l}from"./public.js?v=1764233927359";import{_ as t,d as s,a9 as i,p as n}from"./page_layout.js?v=1764233927359";import{b as o}from"./file.js?v=1764233927359";import{_ as c,dc as d,d5 as r,aC as p,da as u,eh as m}from"./naive.js?v=1764233927359";import{k as f,P as v,r as h,W as x,R as k,V as y,S as _,a3 as b,j as C,a4 as g,U as w,F as P,O as j}from"./vue.js?v=1764233927359";import"./common.js?v=1764233927359";import"./__commonjsHelpers__.js?v=1764233927359";const S={class:"flex flex-col h-full"},z={class:"flex-1 w-0 truncate"},I={class:"flex flex-1 overflow-hidden"},D={class:"w-160px py-12px overflow-auto"},E=["onClick"],F={class:"flex-1 ml-8px"},H={class:"flex-1","b-l":"1 solid #aaa"},L=n(f({__name:"index",props:{data:{}},setup(n,{expose:f}){const{t:L}=v(),O=n,{path:R,checkedType:T,callback:U}=O.data,$=h([]),A=h([]),K=h(R||"/"),{table:V,columns:W}=e([{key:"checkbox",title:"",width:36,render:e=>T.includes(e.type)?x("div",{onClick:e=>{e.stopPropagation()}},[x(c,{checked:e.filename===A.value[0],onUpdateChecked:a=>{A.value=a?[e.filename]:[]}},null)]):""},{key:"filename",title:L("Component.SelectPath.index_3"),render:e=>x("div",{class:"flex"},[x("div",{class:"flex items-center flex-1 cursor-pointer",onClick:a=>{"dir"===e.type&&(a.preventDefault(),K.value+="".concat("/"===K.value?"":"/").concat(e.filename),M(),a.stopPropagation())}},[x("div",null,["dir"===e.type?x(t,{name:"base-dir",size:"16"},null):"","file"===e.type?x(t,{name:"base-file",size:"16",color:"#666"},null):""]),x("div",{class:"ml-6px flex-1 w-0"},[x(d,null,{default:()=>[e.filename]})])])])},{key:"time",title:L("Component.SelectPath.index_4"),width:146},{key:"permission",title:L("Component.SelectPath.index_5"),width:86},{key:"owner",title:L("Component.SelectPath.index_6"),width:72}]),q=e=>({onClick:()=>{if(T.includes(e.type)){const a=m(A.value,a=>a===e.filename);A.value=-1!==a?[]:[e.filename]}},onDblclick:()=>{T.includes(e.type)&&(K.value+="".concat("/"===K.value?"":"/").concat(e.filename),M())}}),B=()=>{const e=K.value.substring(0,K.value.lastIndexOf("/"));K.value=""===e?"/":e,M()},{loading:G,setLoading:J}=a(),M=async()=>{try{J(!0),V.data=[],A.value=[];const{message:e}=await o({path:K.value});if(s(e)){const a=[],l=r(e,"DIR",[]),t=r(e,"FILES",[]);l.forEach(e=>{a.push(N(e,"dir"))}),t.forEach(e=>{a.push(N(e,"file"))}),K.value=e.PATH,V.data=a,$.value=r(e,"DISK",[])}}finally{J(!1)}},N=(e,a)=>{const l=e.split(";"),t=l[0],s=i(l[2]),n=l[3],o=l[4];return{path:("/"!==K.value?K.value+"/":"")+t,filename:t,time:s,permission:n,owner:o,type:a}};return M(),f({onConfirm:({hide:e})=>{const a=A.value.length>0?A.value[0]:"",l=("/"!==K.value?K.value+"/":"")+a,t=V.data.find(e=>e.filename===a);null==U||U(l,t),e()}}),(e,a)=>{const s=p,i=u,n=l;return y(),k("div",S,[x(i,{class:"items-center h-50px px-12px","b-b":"1 solid #aaa"},{default:b(()=>[x(s,{onClick:B},{default:b(()=>[C(g(e.$t("Component.SelectPath.index_1")),1)]),_:1}),_("div",z,g(e.$t("Component.SelectPath.index_2"))+": "+g(w(K)),1)]),_:1}),_("div",I,[_("div",D,[(y(!0),k(P,null,j(w($),e=>(y(),k("div",{key:e.path,class:"flex items-center p-8px pl-16px hover:bg-#ececec cursor-pointer transition-colors disk-item",onClick:a=>{return l=e.path,K.value=l,void M();var l}},[x(t,{name:"file-disk",size:"18",color:"#666"}),_("div",F,g(e.path)+" "+g(e.size[2]?"(".concat(e.size[2],")"):""),1)],8,E))),128))]),_("div",H,[x(n,{loading:w(G),"loading-num":10,bordered:!1,"virtual-scroll":!0,"max-height":456,data:w(V).data,columns:w(W),"row-props":q},null,8,["loading","data","columns"])])])])}}}),[["__scopeId","data-v-b9968102"]]);export{L as default};
