import{d as B,g as l,A as n,J as c,K as a,L as f,P as d,j as h,t as I,G as m,H as $,a8 as p,i as N,_ as y,D as K,c as k}from"./index-DOFLUERq.js";import{I as M}from"./iconify-p99pbjf9.js";import{f as T}from"./timezone-gppATNyQ.js";import{_ as j}from"./_plugin-vue_export-helper-DlAUqK2U.js";const A={class:"file-list-view"},F={class:"col-checkbox"},L=["checked","indeterminate"],E={class:"col-actions"},w={class:"list-body"},D=["onClick"],G=["checked","onChange"],V=["onClick"],P={key:0,class:"file-name-cell"},H=["src"],J={class:"file-name-text"},O=B({__name:"list_view",props:{rows:{},columns:{},selectedKeys:{},previewName:{}},emits:["rowClick","toggleSelection","toggleSelectAll"],setup(o){const r=o,v=k(()=>r.rows.length>0&&r.rows.every(t=>r.selectedKeys.includes(t.name))),b=k(()=>!v.value&&r.rows.some(t=>r.selectedKeys.includes(t.name))),g=k(()=>{const t=["40px"];return r.columns.forEach(e=>{t.push(e.width||"minmax(100px, 1fr)")}),t.push("120px"),{gridTemplateColumns:t.join(" ")}}),u=["jpg","jpeg","png","gif","webp","svg","bmp","ico"];function _(t){return u.includes((t.file_type||"").toLowerCase())}function x(t){const e=(t.file_type||"").toLowerCase();return t.is_folder?"tabler:folder":u.includes(e)?"tabler:photo":["pdf"].includes(e)?"tabler:file-type-pdf":["doc","docx"].includes(e)?"tabler:file-type-doc":["xls","xlsx"].includes(e)?"tabler:file-type-xls":["ppt","pptx"].includes(e)?"tabler:file-type-ppt":["zip","rar","7z","tar","gz"].includes(e)?"tabler:file-zip":["mp4","avi","mov","mkv","webm"].includes(e)?"tabler:file-type-video":["mp3","wav","flac","aac","ogg"].includes(e)?"tabler:file-type-audio":["txt","md","csv"].includes(e)?"tabler:file-type-text":["js","ts","py","html","css","json","xml"].includes(e)?"tabler:file-type-code":"tabler:file"}function C(t){const e=(t.file_type||"").toLowerCase();return t.is_folder?"#f59e0b":u.includes(e)?"#10b981":["pdf"].includes(e)?"#ef4444":["doc","docx"].includes(e)?"#3b82f6":["xls","xlsx"].includes(e)?"#059669":["zip","rar","7z"].includes(e)?"#8b5cf6":["mp4","avi","mov"].includes(e)?"#ec4899":["mp3","wav","flac"].includes(e)?"#f97316":"#6b7280"}function z(t){const e=typeof t=="string"?parseInt(t,10):t;if(isNaN(e)||e===0)return"0 B";const i=["B","KB","MB","GB","TB"],s=Math.floor(Math.log(e)/Math.log(1024));return(e/Math.pow(1024,s)).toFixed(s>0?1:0)+" "+i[s]}function S(t){if(!t)return"—";try{return T(t)}catch{return String(t)}}return(t,e)=>(l(),n("div",A,[c("div",{class:"list-header",style:m(g.value)},[c("div",F,[c("input",{type:"checkbox",checked:v.value,indeterminate:b.value,onChange:e[0]||(e[0]=i=>t.$emit("toggleSelectAll"))},null,40,L)]),(l(!0),n(a,null,f(o.columns,i=>(l(),n("div",{key:i.key,class:"col-data"},d(i.title),1))),128)),c("div",E,d(h(I)("Actions")),1)],4),c("div",w,[(l(!0),n(a,null,f(o.rows,i=>(l(),n("div",{key:i.name,class:$(["list-item",{selected:o.selectedKeys.includes(i.name),previewed:o.previewName===i.name}]),style:m(g.value),onClick:s=>t.$emit("rowClick",i)},[c("div",{class:"col-checkbox",onClick:e[1]||(e[1]=p(()=>{},["stop"]))},[c("input",{type:"checkbox",checked:o.selectedKeys.includes(i.name),onChange:s=>t.$emit("toggleSelection",i.name)},null,40,G)]),(l(!0),n(a,null,f(o.columns,s=>(l(),n("div",{key:s.key,class:"col-data",onClick:p(X=>t.$emit("rowClick",i),["stop"])},[s.key==="file_name"?(l(),n("div",P,[_(i)&&i.thumbnail_url?(l(),n("img",{key:0,src:i.thumbnail_url,class:"file-thumb",loading:"lazy",decoding:"async"},null,8,H)):(l(),N(h(M),{key:1,icon:x(i),size:18,class:"file-icon",style:m({color:C(i)})},null,8,["icon","style"])),c("span",J,d(i.file_name||i.name),1)])):s.key==="file_size"?(l(),n(a,{key:1},[y(d(i.file_size?z(i.file_size):"—"),1)],64)):s.key==="modified"||s.key==="creation"?(l(),n(a,{key:2},[y(d(S(i[s.key])),1)],64)):(l(),n(a,{key:3},[y(d(i[s.key]??"—"),1)],64))],8,V))),128)),c("div",{class:"col-actions",onClick:e[2]||(e[2]=p(()=>{},["stop"]))},[K(t.$slots,"actions",{row:i},void 0,!0)])],14,D))),128))])]))}}),W=j(O,[["__scopeId","data-v-3f49220d"]]);export{W as default};
