import{E as e,r as s,z as n,C as o}from"./vendor-s2rfM_Vj.js";import{t as i,v as t,w as a,u as r}from"./apis-DdFSvwR4.js";import{a as c}from"./constant-Dkm_Y9q1.js";import{u as l,a as m,b as p,c as u,d,e as f,f as g}from"./newtab-BWIjnu6l.js";import{u as w}from"./useUserInfo-C51MDqe6.js";import"./index-Bf7N7lFc.js";import"./t-r-vendor-gn7FMrPE.js";const x=e("ul")({name:"WrapUI",class:"w5ghc9w",propsAsIs:!1,vars:{"w5ghc9w-0":[({left:e})=>e,"px"],"w5ghc9w-1":[({top:e})=>e,"px"],"w5ghc9w-2":[({leftover:e,topover:s,w:n,h:o})=>`${e?-n:0}px, ${s?-o:0}px`]}}),h=e("li")({name:"ItemUI",class:"i1lq5krl",propsAsIs:!1}),I=e("p")({name:"ItemTitleUI",class:"i16lbmtq",propsAsIs:!1}),b=e("span")({name:"ItemDescUI",class:"i1u12jpk",propsAsIs:!1}),v="_menu-enter_18760_1",_="_menu-enter-active_18760_7",j="_menu-exit_18760_17",S="_menu-exit-active_18760_23",A="_menu-exit-done_18760_29",M=window.innerWidth,k=window.innerHeight,y=["添加应用","新建文件夹","搜索应用"],C=({visible:e,x:C,y:D,handleShowSetting:L,setContextMenuPosition:N,setAddAppsDialogVisible:U,setLocalSearchVisible:$})=>{const O=s.useRef(!0),{handleMessage:E}=g(),F=l((e=>e.backgroundInfo)),T=m(),V=p(),{navigationInfo:q,setCurrentNavApps:z,filterApps:J}=u(),{isLogin:W}=w(),G=d((e=>e.setShowLogin)),H=m((e=>e.simpleMode)),P=s.useMemo((()=>H.isSimple?98:188),[H.isSimple]),R=s.useMemo((()=>C+P>M?1:0),[C,P]),B=s.useMemo((()=>D+180>k?1:0),[D]),K=s.useMemo((()=>[{name:"添加应用",icon:"add",cb:()=>{U(!0),N(null)}},{name:"新建文件夹",icon:"folder",cb:()=>{const e={id:i(),name:"文件夹",type:c.folder,size:"2*1",children:[]};z([...J,e]),f(e),N(null)}},{name:"搜索应用",desc:t?"⌘ + F":"Ctrl + F",cb:()=>{$(!0),N(null)}},{name:"下载壁纸",icon:"download",cb:()=>{const e=new Date,s=e.toLocaleTimeString(),n=e.toLocaleDateString();a(F.backgroundImage||F.backgroundVideo,`ovo壁纸_${n}_${s}`)}},{name:"设置中心",icon:"setting",cb:()=>{L(!0),N(null)}},{name:"立即备份",icon:"upload",cb:async()=>{if(W){if(!O.current)return E.warning("您已经备份过了，请稍后重试");O.current=!1,setTimeout((()=>{O.current=!0}),6e4);const e=JSON.parse(JSON.stringify({baseInfo:V,backgroundInfo:F,styleInfo:T,navigationInfo:q})),{code:s,msg:n}=await r(e);200===s?E.success("备份成功"):(E.error(n),O.current=!0)}else G(!0)}}]),[q,J]),Q=s.useMemo((()=>H.isSimple?K.filter((e=>!y.includes(e.name))):K),[K,H.isSimple]);return n.jsx(o,{in:e,timeout:R||B||0===C||0===D?0:200,unmountOnExit:!0,classNames:{enter:v,enterActive:_,exit:j,exitActive:S,exitDone:A},children:n.jsx(x,{left:C,top:D,leftover:R,topover:B,h:P,w:180,children:Q.map((e=>n.jsxs(h,{onClick:e.cb,children:[n.jsx(I,{children:e.name}),e.desc&&n.jsx(b,{children:e.desc}),e.icon&&n.jsx("i",{className:`ovo ${e.icon}`})]},e.name)))})})};export{C as default};
