import{d as x,g as i,A as a,G as n,K as C,L as z,H as S,J as s,a8 as b,B,j as M,P as r,O as u,D as F,c as I,t as N}from"./index-DOFLUERq.js";import{I as P}from"./iconify-p99pbjf9.js";import{_ as G}from"./_plugin-vue_export-helper-DlAUqK2U.js";const L=["onClick"],V=["checked","onChange"],A={class:"card-image-area"},D=["src","alt"],E=["src","alt"],j={class:"card-content"},K={class:"card-title"},O={class:"card-meta"},$={key:0,class:"meta-item"},J={key:1,class:"meta-item meta-type"},X=x({__name:"card_view",props:{rows:{},selectedKeys:{},previewName:{},cardSize:{}},emits:["rowClick","toggleSelection"],setup(c){const g=c,d=["jpg","jpeg","png","gif","webp","svg","bmp","ico"],_={S:"140px",M:"200px",L:"280px"},y=I(()=>({"--card-min-width":_[g.cardSize]||"200px"}));function p(t){return d.includes((t.file_type||"").toLowerCase())}function v(t){const l=(t.file_type||"").toLowerCase();return t.is_folder?"tabler:folder":d.includes(l)?"tabler:photo":["pdf"].includes(l)?"tabler:file-type-pdf":["doc","docx"].includes(l)?"tabler:file-type-doc":["xls","xlsx"].includes(l)?"tabler:file-type-xls":["zip","rar","7z","tar","gz"].includes(l)?"tabler:file-zip":["mp4","avi","mov","mkv","webm"].includes(l)?"tabler:file-type-video":["mp3","wav","flac","aac","ogg"].includes(l)?"tabler:file-type-audio":"tabler:file"}function m(t){const l=(t.file_type||"").toLowerCase();return t.is_folder?"#f59e0b":d.includes(l)?"#10b981":["pdf"].includes(l)?"#ef4444":["doc","docx"].includes(l)?"#3b82f6":["xls","xlsx"].includes(l)?"#059669":["zip","rar","7z"].includes(l)?"#8b5cf6":["mp4","avi","mov"].includes(l)?"#ec4899":["mp3","wav","flac"].includes(l)?"#f97316":"#6b7280"}const h={jpg:{label:"JPG",color:"#10b981"},jpeg:{label:"JPG",color:"#10b981"},png:{label:"PNG",color:"#14b8a6"},gif:{label:"GIF",color:"#f59e0b"},webp:{label:"WEBP",color:"#06b6d4"},svg:{label:"SVG",color:"#8b5cf6"},pdf:{label:"PDF",color:"#ef4444"},doc:{label:"DOC",color:"#3b82f6"},docx:{label:"DOC",color:"#3b82f6"},xls:{label:"XLS",color:"#059669"},xlsx:{label:"XLS",color:"#059669"},zip:{label:"ZIP",color:"#8b5cf6"},rar:{label:"RAR",color:"#8b5cf6"},mp4:{label:"MP4",color:"#ec4899"},mov:{label:"MOV",color:"#ec4899"},mp3:{label:"MP3",color:"#f97316"},wav:{label:"WAV",color:"#f97316"}};function f(t){return t.is_folder?{label:N("Folder"),color:"#f59e0b"}:h[(t.file_type||"").toLowerCase()]||null}function k(t){const l=typeof t=="string"?parseInt(t,10):t;if(isNaN(l)||l===0)return"0 B";const e=["B","KB","MB","GB","TB"],o=Math.floor(Math.log(l)/Math.log(1024));return(l/Math.pow(1024,o)).toFixed(o>0?1:0)+" "+e[o]}return(t,l)=>(i(),a("div",{class:"file-card-view",style:n(y.value)},[(i(!0),a(C,null,z(c.rows,e=>(i(),a("div",{key:e.name,class:S(["file-card",{selected:c.selectedKeys.includes(e.name),previewed:c.previewName===e.name}]),onClick:o=>t.$emit("rowClick",e)},[s("div",{class:"card-checkbox",onClick:l[0]||(l[0]=b(()=>{},["stop"]))},[s("input",{type:"checkbox",checked:c.selectedKeys.includes(e.name),onChange:o=>t.$emit("toggleSelection",e.name)},null,40,V)]),s("div",A,[p(e)&&e.thumbnail_url?(i(),a("img",{key:0,src:e.thumbnail_url,alt:e.file_name,loading:"lazy",decoding:"async",class:"card-img"},null,8,D)):p(e)&&e.file_url?(i(),a("img",{key:1,src:e.file_url,alt:e.file_name,loading:"lazy",decoding:"async",class:"card-img"},null,8,E)):(i(),a("div",{key:2,class:"card-image-placeholder",style:n({backgroundColor:m(e)+"15"})},[B(M(P),{icon:v(e),size:40,style:n({color:m(e)})},null,8,["icon","style"])],4)),f(e)?(i(),a("span",{key:3,class:"file-type-badge",style:n({backgroundColor:f(e).color})},r(f(e).label),5)):u("",!0)]),s("div",j,[s("div",K,r(e.file_name||e.name),1),s("div",O,[e.file_size?(i(),a("span",$,r(k(e.file_size)),1)):u("",!0),e.file_type?(i(),a("span",J,r(e.file_type.toUpperCase()),1)):u("",!0)])]),s("div",{class:"card-actions",onClick:l[1]||(l[1]=b(()=>{},["stop"]))},[F(t.$slots,"actions",{row:e},void 0,!0)])],10,L))),128))],4))}}),H=G(X,[["__scopeId","data-v-6f3aabee"]]);export{H as default};
