import{r as e,z as s,L as o,N as n,O as t,S as r,R as a,Q as d,P as i}from"./vendor-s2rfM_Vj.js";import"./apis-DdFSvwR4.js";import{c as l,I as c,D as p,h as m,j as u,k as f,S as h,l as x,G as j,m as v,i as g,C as w,N as C,W as A}from"./newtab-BWIjnu6l.js";import{g as b,D as E}from"./t-r-vendor-gn7FMrPE.js";import"./index-Bf7N7lFc.js";import"./constant-Dkm_Y9q1.js";const F="_folder-dialog_1d3k4_1";function O(o){return function(n){const{updateFolder:t,folderApps:r}=n,a=e.useRef(null),[d,i]=e.useState(!1),{setApps:m,filterApps:u}=l(),f=()=>{t(r.filter((e=>e.id!==n.id)))},h=e=>{a.current&&!a.current.contains(e.target)&&i(!1)};return e.useEffect((()=>(document.addEventListener("mousedown",h),()=>{document.removeEventListener("mousedown",h)})),[]),s.jsxs(c,{ref:a,onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),i(!0)},children:[s.jsx(o,{...n}),s.jsx(b,{content:"下一步",destroyOnClose:!0,placement:"top",showArrow:!0,confirmBtn:"删除",cancelBtn:"移出文件夹",onConfirm:f,onCancel:()=>{f(),m([...u,n.item])},theme:"default",children:s.jsx(p,{active:d?1:0,className:"ovo close"})})]})}}const k=({item:o,folderApps:n,updateFolder:t})=>{const r=e.useMemo((()=>a.createElement(O(w.get(o.id)),{...o,item:o,folderApps:n,updateFolder:t})),[]);return s.jsx(e.Suspense,{children:r})},y=O(A),S=({visible:e,handleVisible:a,folderApps:l,updateFolder:c,name:p})=>{const A=o(n(i,{activationConstraint:{distance:8}}));return s.jsx(E,{className:F,style:{padding:"0 0 16px 16px",overflow:"auto",backgroundColor:"var(--theme-black7)",backdropFilter:"blur(5px)",height:"50vh",overflowY:"hidden"},width:"560px",visible:e,mode:"modal",onClose:()=>a(!1),preventScrollThrough:!0,showOverlay:!0,theme:"default",footer:!1,header:!1,closeBtn:!1,closeOnEscKeydown:!0,closeOnOverlayClick:!0,confirmOnEnter:!1,destroyOnClose:!0,children:s.jsxs(m,{children:[s.jsx(u,{children:p}),s.jsx(t,{sensors:A,onDragStart:()=>{},onDragEnd:e=>{const{active:s,over:o}=e,n=l.findIndex((e=>e.id===(null==s?void 0:s.id))),t=l.findIndex((e=>e.id===(null==o?void 0:o.id))),r=d(l,n,t);c(r)},children:s.jsx(r,{items:l,children:s.jsx(f,{children:l.map((e=>s.jsx(h,{...e,className:x[e.size],children:s.jsxs(j,{children:[v(e)&&s.jsx(y,{...e,item:e,folderApps:l,updateFolder:c}),g(e)&&w.get(e.id)&&s.jsx(k,{item:e,folderApps:l,updateFolder:c}),s.jsx(C,{children:e.name})]})},e.id)))})})})]})})};export{S as default};
