Build 541864stable
Module 163432
2,514 characters · in c33eb37ee3fd5e96.jsDependencies
Source Raw
function(e,t,l){l.d(t,{Ay:()=>k,Vp:()=>d,i4:()=>S}),l(321073);var i=l(627968),n=l(64700),r=l(735438),a=l(90575),s=l(495544),u=l(927813),o=l(403362),c=l(175203),p=l(806931),h=l(264395);let d=112,f=16/9*112+8,g=10*u.A.Millis.SECOND;function x(e){let t=s.default.getId();return e.type===p.lp.USER&&e.user.id===t&&e.voiceState?.selfVideo}function S(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{tileWidth:f,tileMinWidth:124,tileMargin:8,limit:12,cropSelfVideo:!1},{tileWidth:i,tileMinWidth:s,tileMargin:u,limit:c,cropSelfVideo:h,version:d}=l,[S,k]=n.useState(Date.now());n.useEffect(()=>{let e=setTimeout(()=>{k(Date.now())},g);return()=>{clearTimeout(e)}},[t]);let m=n.useRef({}),{visibleParticipants:M,participantTileWidth:y}=n.useMemo(()=>{let l=Date.now(),n=(0,r.sortBy)(t,e=>(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Date.now();switch(e.type){case p.lp.ACTIVITY:return`\x01${e.sortKey}`;case p.lp.HIDDEN_STREAM:case p.lp.STREAM:return`\x02${(0,a.A)(e.userNick,e.user)}`;case p.lp.USER:var l;let i,n="\x06";return e.speaking?n="\x03":t-e.lastSpoke<g?n="\x04":e.voiceState?.selfVideo&&(n="\x05"),`${n}${l=e.lastSpoke,i=String(864e13).length,String(864e13-l).padStart(i,"0")}${(0,a.A)(e.userNick,e.user)}`}})(e,l)),[d,f]=(0,r.partition)(n,p.Xw),S=d.findIndex(x),k=null;-1!==S&&(k=d[S],d.splice(S,1));let M=null==k||h?e:e-i-u,y=Math.max(0,Math.min(Math.floor((M-u)/(s+u)),c,t.length)),v=Math.min((M-u)/y-u,i),w=Math.max(0,y-f.length),A=f.slice(0,y),C=d.slice(0,w),D=Array(w);if(w>0){let e=[];for(let t of C){let l=m.current[t.id];null!=l&&l<w?D[l]=t:e.push(t)}for(let t=0;t<D.length;t++){if(null!=D[t])continue;let l=e.shift();if(null==l)break;D[t]=l}}let E=D.filter(o.Vq);m.current=(0,r.keyBy)((0,r.range)(E.length),e=>E[e].id);let V=[...A,...E];return null!=k&&(h&&V.length>=y?V[Math.max(0,V.length-1)]=k:V.push(k)),{visibleParticipants:V,participantTileWidth:v}},[e,t,S,d,h,c,u,s,i]);return{visibleParticipants:M,participantTileWidth:y}}function k(e){let{participants:t,participantTileWidth:l,selectedParticipantId:n,onDoubleClick:r,onContextMenu:a,onClick:s,channel:u,inCall:o,popoutType:p,paused:d=!1}=e;return(0,i.jsx)("div",{className:h.zr,children:t.map(e=>{if(null==e)return null;let t=x(e);return(0,i.jsx)("div",{className:h.eP,style:t?{flexShrink:0}:void 0,children:(0,i.jsx)(c.Ay,{participant:e,selected:n===e.id,channel:u,className:h.Vs,fit:c.Yl.COVER,onClick:s,onDoubleClick:r,onContextMenu:a,width:t?f:l,inCall:o,paused:d,popoutType:p})},e.id)})})}}