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