import{E as s,r as e,z as a,R as t}from"./vendor-s2rfM_Vj.js";import{d as r}from"./apis-DdFSvwR4.js";import{c as i,i as o,C as n,l,q as d,e as c}from"./newtab-BWIjnu6l.js";import{G as p}from"./GroupSelector-DE_oQW1L.js";import{I as m,B as u}from"./t-r-vendor-gn7FMrPE.js";import"./index-Bf7N7lFc.js";import"./constant-Dkm_Y9q1.js";import"./Index-DDcvGMwD.js";const v=s("div")({name:"WrapUI",class:"w1azvtxw",propsAsIs:!1}),I=s("div")({name:"HeaderUI",class:"hwmuk47",propsAsIs:!1}),j=s("div")({name:"ListUI",class:"l1cmqssi",propsAsIs:!1}),f=s("div")({name:"ItemHoverUI",class:"i1s9lpbe",propsAsIs:!1}),x=s("div")({name:"ItemContentUI",class:"i19v6pzb",propsAsIs:!1}),h=s("div")({name:"ItemUI",class:"igrk9zo",propsAsIs:!1}),g=s("div")({name:"ItemNameUI",class:"i1jo6dgi",propsAsIs:!1}),N=({handleVisible:s})=>{const N=e.useRef(null),{currentNavId:C,navigationInfo:b,setCurrentNavId:A,setCurrentNavApps:z,hasInstalledCurrent:U}=i(),w=d(),[y,E]=e.useState(b.find((s=>s.id===C))),[k,H]=e.useState(""),S=e.useMemo((()=>w.filter((s=>s.name.includes(k)))),[k]),T=e.useCallback(r((()=>{}),500),[]),q=s=>{const{scrollTop:e,scrollHeight:a,clientHeight:t}=s.currentTarget;e+t>=a&&T()};return e.useEffect((()=>{const s=N.current;if(s)return s.addEventListener("scroll",q,{passive:!0}),()=>{s.removeEventListener("scroll",q)}}),[]),a.jsxs(v,{className:"component-list__wrap",children:[a.jsxs(I,{children:[a.jsx(m,{value:k,align:"left",size:"small",status:"default",type:"text",placeholder:"搜索应用",prefixIcon:a.jsx("i",{className:"ovo search"}),style:{borderRadius:"50%",width:150},onChange:H}),a.jsx(p,{targetNav:y,setTargetNav:E})]}),a.jsx(j,{ref:N,children:S.map(((e,r)=>{if(o(e)&&n.get(e.id))return a.jsxs(h,{onClick:()=>(e=>{U(e.id,null==y?void 0:y.apps)||(setTimeout((()=>{void 0!==(null==y?void 0:y.id)&&A(null==y?void 0:y.id);const s=[...(null==y?void 0:y.apps)??[],e];z(s),void 0!==(null==y?void 0:y.id)&&E({...y,apps:s}),c(e)}),100),s(!1))})(e),children:[a.jsx(x,{className:l[e.size],children:t.createElement(n.get(e.id),{...e})}),a.jsx(g,{children:e.name}),a.jsx(f,{children:a.jsx(u,{shape:"square",size:"medium",type:"button",variant:"outline",style:{backgroundColor:"transparent"},icon:a.jsx("i",{className:U(e.id,null==y?void 0:y.apps)?"ovo success":"ovo add",style:{color:"var(--td-gray-color-3)"}})})})]},r)}))})]})};export{N as default};
