const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Index-BJZU66f-.js","./vendor-s2rfM_Vj.js","./apis-DdFSvwR4.js","./constant-Dkm_Y9q1.js","./newtab-BWIjnu6l.js","./index-Bf7N7lFc.js","./index-_OyDQdIX.css","./t-r-vendor-gn7FMrPE.js","./t-r-vendor-BqYdeEzc.css","./newtab-0VcUNIVO.css","./Index-DbLCXnhw.css"])))=>i.map(i=>d[i]);
import{f as s,_ as e}from"./constant-Dkm_Y9q1.js";import{E as a,r,z as o}from"./vendor-s2rfM_Vj.js";import{d as t,X as i}from"./apis-DdFSvwR4.js";import{c as n,e as l}from"./newtab-BWIjnu6l.js";import{G as c}from"./GroupSelector-DE_oQW1L.js";import{I as p,B as d}from"./t-r-vendor-gn7FMrPE.js";import"./index-Bf7N7lFc.js";import"./Index-DDcvGMwD.js";const u=a("div")({name:"WrapUI",class:"wh8zral",propsAsIs:!1}),m=a("div")({name:"HeaderUI",class:"h13e3ir5",propsAsIs:!1}),v=a("div")({name:"ListUI",class:"l8crmj7",propsAsIs:!1}),I=a("div")({name:"ItemHoverUI",class:"i1d8spfo",propsAsIs:!1}),j=a("div")({name:"ItemUI",class:"i1g9qg64",propsAsIs:!1}),f=a("div")({name:"ImgWrapUI",class:"i1hzgcu9",propsAsIs:!1,vars:{"i1hzgcu9-0":[s=>s.backgroundcolor]}}),g=a("img")({name:"ImgUI",class:"im3vsep",propsAsIs:!1}),x=a("div")({name:"ItemNameUI",class:"iektbev",propsAsIs:!1}),h=r.lazy((()=>e((()=>import("./Index-BJZU66f-.js")),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10]),import.meta.url)));function b({handleVisible:e}){const a=r.useRef(null),[b,y]=r.useState([]),{currentNavId:k,navigationInfo:z,setCurrentNavId:A,setCurrentNavApps:N,hasInstalledCurrent:C}=n(),[E,S]=r.useState(!1),[U,w]=r.useState(z.find((s=>s.id===k))),[_,G]=r.useState(s.all),[H,L]=r.useState(""),[T,q]=r.useState(0),P=async()=>{const{code:s,data:e,msg:a}=await i({page:T,size:30,type:_,name:H});200===s?y((s=>[...s,...e])):console.log(a)},R=r.useCallback(t((()=>{q((s=>s+1))}),500),[]),V=s=>{const{scrollTop:e,scrollHeight:a,clientHeight:r}=s.currentTarget;e+r>=a&&R()};return r.useEffect((()=>{const s=a.current;if(s)return s.addEventListener("scroll",V,{passive:!0}),()=>{s.removeEventListener("scroll",V)}}),[]),r.useEffect((()=>{P()}),[T]),r.useEffect((()=>{y([]),q(0),P()}),[_,H]),o.jsxs(u,{children:[o.jsxs(m,{children:[o.jsx(p,{value:H,align:"left",size:"small",status:"default",type:"text",placeholder:"搜索应用",prefixIcon:o.jsx("i",{className:"ovo search"}),style:{borderRadius:"50%",width:150},onChange:L}),o.jsx(c,{targetNav:U,setTargetNav:w}),o.jsx(d,{size:"small",icon:o.jsx("i",{className:"ovo filter"}),onClick:()=>S(!E),children:"筛选"})]}),o.jsx(v,{ref:a,children:b.map(((s,e)=>o.jsxs(j,{onClick:()=>(async s=>{if(C(s.id,null==U?void 0:U.apps))return;void 0!==(null==U?void 0:U.id)&&A(null==U?void 0:U.id);const e=[...(null==U?void 0:U.apps)??[],s];N(e),w({...U,apps:e}),l(s)})(s),children:[o.jsx(f,{backgroundcolor:s.background,children:o.jsx(g,{loading:"lazy",fetchPriority:"low",decoding:"async",src:s.icon,alt:""})}),o.jsx(x,{children:s.name}),o.jsxs(I,{children:[o.jsx(d,{shape:"square",size:"medium",type:"button",variant:"outline",style:{backgroundColor:"transparent"},icon:o.jsx("i",{className:C(s.id,null==U?void 0:U.apps)?"ovo success":"ovo add",style:{color:"var(--td-gray-color-3)"}})}),o.jsx(d,{className:"link-btn",shape:"square",size:"medium",type:"button",variant:"text",icon:o.jsx("i",{className:"ovo link"}),onClick:e=>((s,e)=>{s.stopPropagation(),window.open(e.url)})(e,s)})]})]},e)))}),o.jsx(r.Suspense,{children:o.jsx(h,{appGroup:_,visible:E,setAppGroup:G,handleVisible:S})})]})}export{b as default};
