1import{_ as e,b as t,g as n}from"./env-DDtwVrOu.js";import{t as r}from"./http-xcAQJ1NU.js";import{a as i,c as a,r as o,s}from"./useFeedCards-Ccu25A8t.js";import{a as c}from"./analytics-DpHunbR-.js";import{r as l}from"./useSurfaceExit-DcFrj0-O.js";import{s as u}from"./feed-cache-BucHuwMu.js";import{t as d}from"./feed-DsL0-k-u.js";import{n as f,t as p}from"./RightRail-BO1Ve0jd.js";import{t as m}from"./useScrollDepth-CiNEvLLX.js";import{t as h}from"./useSeenCount-DGU9yMcz.js";var g=t(e(),1),_=500,v=100,y=20;function b({columnRef:e,surface:t}){let n=(0,g.useRef)([]),i=(0,g.useRef)(t);i.current=t,(0,g.useEffect)(()=>{let t=e.current;if(!t||typeof IntersectionObserver>`u`)return;let a=()=>{let e=n.current.splice(0,v);e.length!==0&&r.post(`/whip/feed/impressions/`,{impressions:e}).catch(()=>void 0)},o=new Map,s=new IntersectionObserver(e=>{for(let t of e){let e=t.target.getAttribute(`data-track-id`);if(!e)continue;if(t.isIntersecting){o.set(e,Date.now());continue}let r=o.get(e);o.delete(e),!(r===void 0||Date.now()-r<_)&&(n.current.push({version_id:e,surface:i.current,dwell_ms:Date.now()-r}),n.current.length>=y&&a())}},{root:document.getElementById(`app-main`),threshold:.5}),c=()=>{for(let e of t.querySelectorAll(`[data-track-id]`))s.observe(e)};c();let l=new MutationObserver(c);l.observe(t,{childList:!0});let u=()=>{let e=Date.now();for(let[t,r]of o)e-r<_||n.current.push({version_id:t,surface:i.current,dwell_ms:e-r});o.clear()},d=()=>{u(),a()},f=()=>{document.visibilityState===`hidden`&&d()};return document.addEventListener(`visibilitychange`,f),window.addEventListener(`pagehide`,d),()=>{s.disconnect(),l.disconnect(),document.removeEventListener(`visibilitychange`,f),window.removeEventListener(`pagehide`,d),d()}},[e])}function x({columnRef:e,tab:t}){let n=(0,g.useRef)(Date.now()),r=m(),i=h(e),a=(0,g.useRef)(0),o=(0,g.useRef)(t);o.current=t;let s=(0,g.useCallback)(()=>{a.current+=1},[]);return l(`feed`,()=>{o.current===`for-you`&&c(`feed_session_ended`,{duration_seconds:Math.round((Date.now()-n.current)/1e3*10)/10,scroll_depth_percent:r.current,apps_viewed_count:i.current,apps_tapped_count:a.current})}),{noteTapped:s}}var S=n(),C=e=>!u(e);function w(){let{tab:e=`for-you`,category:t}=d.useSearch(),n=e===`trending`?`top`:`feed`,r=o(n,t),c=o(`feed`),l=o(`top`),m=r.data.pages.flatMap(e=>e.results).filter(C),h=c.data.pages.flatMap(e=>e.results).filter(u).flatMap(e=>e.users),_=l.data.pages[0].results.filter(C),{fetchNextPage:v,hasNextPage:y,isFetchingNextPage:w}=r,T=(0,g.useRef)(null),E=x({columnRef:T,tab:e});b({columnRef:T,surface:n});let D=f({columnRef:T,fetchNextPage:v,hasNextPage:y,resetKey:`${n}:${t??``}`});return(0,S.jsxs)(`div`,{className:`px-4 pb-10 xl:grid xl:grid-cols-[minmax(0,1fr)_auto] xl:gap-10 xl:px-10`,children:[(0,S.jsxs)(`div`,{ref:T,className:`flex w-full flex-col items-center`,children:[m.map(e=>(0,S.jsx)(`div`,{"data-feed-card":!0,"data-track-id":e.id,className:s,children:(0,S.jsx)(a,{item:e,surface:n,onUsed:E.noteTapped,shieldApp:!0})},e.id)),y?(0,S.jsx)(`div`,{ref:D,children:w?(0,S.jsx)(i,{}):(0,S.jsx)(`div`,{className:`h-4`})}):null]}),(0,S.jsx)(`aside`,{className:`hidden xl:block`,children:(0,S.jsx)(`div`,{"data-feed-rail":!0,className:`sticky top-[var(--content-top)]`,children:(0,S.jsx)(p,{creators:h,trending:_})})})]})}export{w as component};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.