Module 750770

2,207 characters · in no known chunk
Dependencies
Required by (1)
Lazily required by (0)none
Lazily requires (0)none
Source Raw
function(e,t,n){"use strict";n.d(t,{f:()=>S,s:()=>v});var r=n(64700),i=n(311907),s=n(73153),a=n(963307),o=n(734057),l=n(71393),u=n(531685),c=n(954571),d=n(99066),_=n(435738),f=n(376261),p=n(947593),h=n(188737),m=n(420706),E=n(424994),g=n(495744),A=n(652215),I=n(985018);let T=3,S=0,y=3e3;function v(e){let{memberStoreProps:{groups:t,rows:n,version:S},channelId:v,guildId:N}=e,[C,R]=r.useState(!1),{requestId:O,entries:b,impressionCappedEntryIds:D}=(0,h.A)(v),L=(0,i.bG)([_.A],()=>_.A.hidden),w=(0,i.bG)([u.A],()=>u.A.isFocused()),M=(0,i.bG)([o.A],()=>o.A.getChannel(v)),P=(0,i.bG)([l.A],()=>l.A.getGuild(N),[N]),x=((0,f.T)(P)??!1)&&M?.isForumChannel()===!1,[k,U,G,F]=r.useMemo(()=>{let e;if(null==b||0===b.length||null==O||!x)return[t,n,S];let r=T,i=C?b.length:r,s=b.slice(0,i);e=L?[{type:a.S9.HIDDEN_CONTENT_INVENTORY}]:s.map(e=>({type:a.S9.CONTENT_INVENTORY,entry:e,requestId:O}));let o=()=>{R(e=>{let t=!e;return c.default.track(A.HAw.MEMBERLIST_CONTENT_FEED_TOGGLED,{channel_id:v,guild_id:N,expanded:t}),t})},l={id:g.C,type:a.S9.CONTENT_INVENTORY_GROUP,key:g.C,count:e.length,index:n.length,title:I.intl.string(I.t["6gwSFY"]),onToggleExpand:o,expanded:C,expandedCount:b.length,feedHeight:e.map(m.h9).reduce((e,t)=>e+t,0)};return[[l,...t],[...n,l,...e],Math.random(),e]},[v,b,C,t,N,O,n,S,L,x]),V=r.useRef(0),B=r.useRef(b),H=r.useRef(void 0),j=r.useRef({impressionCappedEntryIds:D}),Y=r.useCallback(e=>{let t=Math.floor(e/m.bG),n=Math.min(F?.length??0,t);V.current=Math.max(V.current,n)},[F]);return r.useEffect(()=>{B.current=b},[b]),r.useEffect(()=>{j.current={impressionCappedEntryIds:D}},[D]),r.useEffect(()=>(V.current=0,H.current=Date.now(),()=>{if(null==O||null==H.current||Date.now()-H.current<y)return;let e=B.current?.map(e=>e.id)??[],t=e.slice(0,V.current);!L&&w&&x&&((0,p.D)(A.HAw.RANKING_ITEMS_SEEN_MUST_BE_SAMPLED,{request_id:O,first_shown_at:H.current,item_ids:t,surface_type:E.UG.GUILD_MEMBER_LIST,channel_id:v,guild_id:N,all_item_ids:e,impression_capped_item_ids:[...j.current.impressionCappedEntryIds]}),(0,d.sE)("useInjectContentInventoryFeed")&&s.h.dispatch({type:"CONTENT_INVENTORY_TRACK_ITEM_IMPRESSIONS",itemIds:t}))}),[O,v,N,L,w,x]),{groups:k,rows:U,version:G,updateMaxRowSeen:Y}}}