import{bU as e,D as t,E as r,r as a,aw as o,aE as n,k as s,a7 as i,aJ as l,S as c,dW as u,aY as d,aD as g,aI as m,a6 as p,bT as b,N as h,a1 as f,am as j}from"./index-C-dDkA_D.js";import{b as x}from"./style-Da45fJnE.js";import{M as w}from"./index-BA8MiV3y.js";import{I as y}from"./ImageWithError-D4HZ3mfG.js";import{g as $,O as k}from"./icon-D8IhN6yM.js";import{I as v,u as I}from"./helper-CTplQJLF.js";const C=C=>{const{isHide:E}=e();if(E(C.obj))return null;const{setPathAs:z}=t(),K=r(n,{get color(){return o()},get boxSize(){return parseInt(a.grid_item_size)-30+"px"},get as(){return $(C.obj)}}),{show:_}=x({id:1}),{pushHref:D,to:M}=s(),{openWithDoubleClick:P,toggleWithClick:S,restoreSelectionCache:W}=I();return r(j.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{duration:.2},style:{width:"100%"},get children(){return r(i,{get classList(){return{selected:!!C.obj.selected}},class:"grid-item viselect-item",get"data-index"(){return C.index},w:"$full",p:"$1",spacing:"$1",rounded:"$lg",transition:"all 0.3s",get _hover(){return{transform:"scale(1.06)",bgColor:h()}},as:w,get href(){return C.obj.name},get cursor(){return P()||S()?"default":"pointer"},get bgColor(){return f(()=>!!C.obj.selected)()?h():void 0},"on:dblclick":()=>{P()&&(u(C.index,!0,!0),M(D(C.obj.name)))},"on:click":e=>{if(e.preventDefault(),!P()&&!(e.ctrlKey||e.metaKey||e.shiftKey)&&W())return S()?u(C.index,!C.obj.selected):void M(D(C.obj.name))},onMouseEnter:()=>{z(C.obj.name,C.obj.is_dir,!0)},onContextMenu:e=>{b(()=>{u(C.index,!0,!0)}),_(e,{props:C.obj})},get children(){return[r(l,{class:"item-thumbnail",get h(){return`${parseInt(a.grid_item_size)}px`},w:"$full",get cursor(){return C.obj.type!==k.IMAGE?"inherit":"pointer"},"on:click":e=>{C.obj.type===k.IMAGE&&(e.ctrlKey||e.metaKey||e.shiftKey||W()&&(m.emit("gallery",C.obj.name),e.preventDefault(),e.stopPropagation()))},pos:"relative",get children(){return[r(c,{get when(){return d()},get children(){return r(v,{pos:"absolute",left:"$1",top:"$1","on:mousedown":e=>{e.stopPropagation()},"on:click":e=>{e.stopPropagation()},get checked(){return C.obj.selected},onChange:e=>{u(C.index,e.target.checked)}})}}),r(c,{get when(){return C.obj.thumb},fallback:K,get children(){return r(y,{maxH:"$full",maxW:"$full",rounded:"$lg",shadow:"$md",get fallback(){return r(g,{size:"lg"})},fallbackErr:K,get src(){return C.obj.thumb},loading:"lazy"})}})]}}),r(p,{css:{whiteSpace:"nowrap",textOverflow:"ellipsis"},w:"$full",overflow:"hidden",textAlign:"center",fontSize:"$sm",get title(){return C.obj.name},get children(){return C.obj.name}})]}})}})};export{C as G};
