import{gi as Mt,ar as Pt,z as y,b5 as Lt,aq as Rt,t as tt,i as S,gj as Bt,j as e,c4 as at,aR as ie,q as x,ao as U,a1 as ve,a6 as D,F as E,aj as ye,bJ as be,ap as k,c1 as re,gk as we,c6 as je,H as Ft,Z as st,bu as Ot,b1 as _t,gl as Kt,bl as zt,P as Ae,bU as q,gm as Se,al as it,gn as nt,bo as Vt,a2 as Wt,E as Gt,ds as Me,V as Ht,dr as Pe,K as qt,a as Ut}from"./index-BbBXKozi.js";import{a as ke,I as rt,d as Qt,e as Xt,f as Zt,g as Yt,S as Jt,A as ea,h as ta,L as aa}from"./index-BZRwgrYr.js";import{g as sa}from"./__federation_shared_react-xoJ64Y1K.js";import{_ as ia}from"./_baseAssignValue-CtKJsRIN.js";import{u as na}from"./useFetchTeamsPlayers-BCq8CB7N.js";import{l as ot,a as ra}from"./livestatsBucket-DgRzZcU9.js";import{c as oa,q as la,b as ca,u as da,d as ma,T as ua,e as fa,a as pa}from"./styled-BRQ04gdo.js";import{u as lt}from"./useRefetchMatchesEveryMinute-CKUYJDVt.js";import{u as ha}from"./useFindCurrentMatchAndMap-C0yh-Bqb.js";import{g as V}from"./generateTeamLogoSrc-Bbrvku3Z.js";import{F as ga}from"./index-CKnY7As6.js";import{t as O}from"./trackEvent-Z6ufzxbR.js";import{S as xa,M as va,N as ya,a as ba}from"./pagination.min-V9f1lLat.js";import{S as wa}from"./SwitchTransition-CHC1m-Pk.js";import{b as ct}from"./index-CDnJG_qv.js";import{P as ja}from"./PoweredByTradeit-YtNNv7-i.js";import{F as Sa}from"./ArrowPathIcon-yFxdVjnS.js";import{C as ce}from"./popover-CCXjVi1j.js";import{F as dt}from"./ChevronDownIcon-B6ig6hDZ.js";import{F as ka}from"./ArrowTopRightOnSquareIcon-CBcECc5E.js";import{_ as Na}from"./switch-XJtiTVLZ.js";import{T as mt}from"./Typography-D_A1O53W.js";import{S as Ta}from"./index-Bm0ugJZe.js";import{b as de}from"./lib-B8SDk80K.js";import{u as ut,P as Da}from"./Particles-DVCmyRgI.js";import{u as Ca,V as Ia}from"./useViewTime-0zU0PEMr.js";import{u as $a}from"./useTrackLiveViews-3q1r18Cs.js";import{q as Ea,g as Aa,u as Ma,d as Pa}from"./useGetCsMatchEvents-S_LJwg4d.js";import{n as Le}from"./notEmpty-CAZYL50h.js";import{u as La}from"./usePictureInPicture-mJRz3dvN.js";import{g as Ra}from"./index-COTrWZQd.js";import{C as Ba,P as Fa,a as Oa,R as _a}from"./styled-CaVne9ds.js";var Ka=ia,za=Mt,Va=Pt;function Wa(a,t){var r={};return t=Va(t),za(a,function(i,o,n){Ka(r,t(i,o,n),i)}),r}var Ga=Wa;const Ha=sa(Ga),qa=y.object({weaponName:y.string(),skinName:y.string(),itemName:y.string(),weaponImage:y.string(),usedByT:y.boolean().optional(),usedByCT:y.boolean().optional(),weaponMinWear:y.number().optional(),weaponMaxWear:y.number().optional(),potentialRarities:y.array(y.string()).optional(),type:y.string().optional()}),Ua=y.object({name:y.string(),paintkit:y.string(),type:y.string().optional(),state:y.string(),ammo_clip:y.number().optional(),ammo_clip_max:y.number().optional(),ammo_reserve:y.number().optional(),details:qa.optional()}),Qa=y.object({name:y.string(),team:y.enum(["T","CT"]),state:y.object({health:y.coerce.number(),armor:y.coerce.number(),helmet:y.boolean(),flashed:y.coerce.number(),smoked:y.coerce.number().nullish(),burning:y.coerce.number(),money:y.coerce.number(),round_kills:y.coerce.number(),round_killhs:y.coerce.number(),round_totaldmg:y.coerce.number(),equip_value:y.coerce.number()}),position:y.string().optional(),weapons:y.record(Ua)}),Xa=async({steamIds:a,date:t})=>{const i=`/statistics/gamestate/${a.reduce((l,d)=>l+Number(d.slice(-5)),0)}_${t}/index.json`,{data:o}=await ot.get(i),n=y.record(Qa).safeParse(o);if(!n.success)throw Lt("Error parsing gamestate for steamIds",{extra:{data:o,error:n.error}}),console.error(n.error),new Error(`Error parsing gamestate for steamIds ${a}`);return n.data},Za=({steamIds:a})=>{const t=Rt.now().toUTC().toFormat("yyyy-MM-dd"),r=a?.join(",");return tt({queryKey:ra.getGameState(r,t),queryFn:()=>a?Xa({steamIds:a,date:t}):void 0,retry:!0,enabled:a?.length===10,refetchInterval:5e3})},Ya=async({mapNumber:a,matchId:t})=>{const{data:r}=await ot.get(`/statistics/csgo/${t}/${a}/live.json`);return oa.array().parse(r)},Ja=({enabled:a,retry:t,refetchInterval:r,...i})=>tt({queryKey:la.roundStats(i),queryFn:()=>Ya(i),enabled:a,retry:t,refetchInterval:r}),es=a=>Ja({...a,retry:!0,refetchInterval:5e3}),{useMemo:_}=await S("react");function ts(a){return Ha(a,(t,r)=>Bt(r))}const Re=a=>!!(a??!1),as=({enabled:a,series:t,mapNumber:r=1})=>{const i=_(()=>{const s=[];return t&&(t.teamA&&s.push(t.teamA),t.teamB&&s.push(t.teamB)),s},[t]),o=na({teams:i}),n=_(()=>o.map(s=>s.data?Array.from(Object.values(s.data)):void 0).flat().filter(Re).filter(s=>s.playerType==="player"),[o]),l=_(()=>n.map(s=>s.ingameId).filter(Re),[n]),{data:d}=Za({steamIds:l}),f=_(()=>i.map(s=>{const m=n.filter(h=>h.team?.uuid===s.uuid);return{team:s,playersStats:m.map(h=>({player:h,stats:{}})).sort((h,p)=>h.player.nickname.localeCompare(p.player.nickname))}}).sort((s,m)=>s.team.name.localeCompare(m.team.name)),[i,n]),{data:g}=es({matchId:t?.uuid,mapNumber:r,enabled:a}),c=_(()=>{if(!g)return new Map;const s=new Map;g.sort((h,p)=>h.roundNumber-p.roundNumber).forEach(h=>{h.players.forEach(p=>{let v=s.get(p.playerSteamId);v||(v={stats:{kills:0,headshotPercentage:0,headshots:0,firstKills:0,deaths:0,assists:0,killDeathRatio:0,adr:0,avgDamageTaken:0,utilityDamage:0,effectiveDamageTaken:0,effectiveDamageDealt:0,streaks:[0]},iterations:0}),v.stats.kills+=Number(p.kills)||0,v.stats.deaths+=Number(p.deaths)||0,v.stats.headshots+=Number(p.headshots)||0,v.stats.firstKills+=Number(p.firstKills)||0,v.stats.assists+=Number(p.assists)||0,v.stats.utilityDamage+=Number(p.utilityDamage)||0,v.stats.effectiveDamageTaken+=Number(p.effectiveDamageTaken)||0,v.stats.effectiveDamageDealt+=Number(p.effectiveDamageDealt)||0,v.stats.streaks[v.stats.streaks.length-1]+=Number(p.kills)||0,p.deaths&&v.stats.streaks.push(0),v.iterations++,s.set(p.playerSteamId,v)})});const m=new Map;for(const[h,p]of s.entries()){const v=Math.max(...p.stats.streaks);m.set(h,{...p.stats,headshotPercentage:p.stats.kills?p.stats.headshots/p.stats.kills:0,killDeathRatio:p.stats.deaths?p.stats.kills/p.stats.deaths:p.stats.kills,adr:p.stats.effectiveDamageDealt/p.iterations,avgDamageTaken:p.stats.effectiveDamageTaken/p.iterations,maxStreak:v,maxStreakActive:!!v&&p.stats.streaks[p.stats.streaks.length-1]===v})}return m},[g]),w=_(()=>f.map(s=>({...s,playersStats:s.playersStats.map(m=>({...m,stats:c.get(m.player.ingameId)??{}}))})),[c,f]);return{rounds:_(()=>!c||!g?[]:g.map(s=>{let m,h,p;const v=f.map($=>{let L=0,C=0,j,M;const K=$.playersStats.map(P=>{const N=s.players.find(A=>A.playerSteamId?A.playerSteamId.toLocaleLowerCase()===P.player.ingameId?.toLocaleLowerCase():!1);return N&&(L+=Number(N.kills||0),Number(N.effectiveDamageDealt||0)>C&&(C=Number(N.effectiveDamageDealt||0),j=P.player),m||(m=s.winnerSide==="TERRORISTS"?"T":s.winnerSide==="COUNTER_TERRORISTS"?"CT":void 0),h||(h=s.firstKillAttackerSteamId?n.find(A=>A.ingameId===s.firstKillAttackerSteamId):void 0),p||(p=s.firstKillVictimSteamId?n.find(A=>A.ingameId===s.firstKillVictimSteamId):void 0)),!M&&N&&(M=N.playerSide==="TERRORISTS"?"T":N.playerSide==="COUNTER_TERRORISTS"?"CT":void 0),{...P,stats:N?ts(N):{}}});return{team:{...$.team,side:M},teamStats:{kills:L,highestDamageDealt:C,highestDamageDealtPlayer:j},playersStats:K}});return{roundNumber:Number(s.roundNumber),roundWinnerTeam:v.find($=>m?$.team.side===m:void 0)?.team,teamAggregates:v,firstKillAttacker:h,firstKillVictim:p}}),[n,c,g,f]),teamAggregates:w,gamestatePlayers:d}},ft=await S("react"),{createContext:ss,useEffect:me,useState:ue}=ft,pt=ss({mapStats:null,isLiveStatsAvailable:!1,isLiveStatsExpanded:!1,toggleLiveStats:()=>{},isWaitingState:!1,series:void 0,vetoes:[],toggleActiveTeam:()=>{},activeState:{},setActiveState:()=>{}}),is=()=>{const[a,t]=ue({}),{enabled:r}=at("frontend_livestats"),{isDesktop:i}=ie(),{currentBroadcast:o}=ke(),{matches:n}=lt(o?.seriesIds),{currentMatch:l,currentMapNumber:d}=ha(n),[f,g]=ue(!1),[c,w]=ue(!1),b=l?.tournament?.format==="showmatch",s=r&&i&&!b,m=as({enabled:s&&!!l?.uuid,series:l,mapNumber:d}),{data:h}=ca({seriesId:l?.uuid||void 0}),p=s&&Number(m?.teamAggregates?.length)>=2,v=ft.useRef(void 0),$=m?.teamAggregates===void 0&&m?.rounds===void 0;me(()=>(p?(clearTimeout(v.current),w(!0)):v.current=setTimeout(()=>{w(!1)},3e4),()=>{clearTimeout(v.current)}),[p]),me(()=>{s||w(!1)},[s]),me(()=>{l?.teamA&&t({activeTeam:l.teamA})},[l?.teamA]);const L=(C,j)=>{const M=j||l?.teamB,K=m?.teamAggregates.find(I=>I.team.uuid===M?.uuid)?.playersStats.sort((I,z)=>{const Q=I.player.nickname.toLowerCase(),W=z.player.nickname.toLowerCase();return Q<W?-1:Q>W?1:0})?.[0]?.player?.ingameId,P=Object.values(m?.gamestatePlayers?.[K??""]?.weapons??{}),N={primary:P?.filter(I=>I.type&&I?.type!=="Pistol"&&I?.type!=="Knife"&&I?.type!=="Grenade"&&I?.type!=="C4")?.[0]??void 0,secondary:P?.filter(I=>I?.type==="Pistol")?.[0]??void 0,knife:P?.filter(I=>I?.type==="Knife")?.[0]??void 0},A=N.primary??N.secondary??N.knife;return{activeTeam:M,selectedPlayerSteamId:K,weaponDetails:A?.details}};return{isLiveStatsExpanded:s&&f&&c&&s,isLiveStatsAvailable:s&&c,isWaitingState:$,toggleLiveStats:C=>{!f&&C&&t(L),g(j=>!j)},series:l,vetoes:h||[],mapStats:m,toggleActiveTeam:()=>{t(C=>{const j=l?.teamA?.uuid===C.activeTeam?.uuid?l?.teamB:l?.teamA;return{...L(C,j),activeTeam:j}})},setActiveState:t,activeState:a}},ns=({children:a})=>{const t=is();return e.jsx(pt.Provider,{value:t,children:a})},{useContext:rs}=await S("react"),oe=()=>rs(pt),Z=x.div` display: flex; flex-direction: column; justify-content: center; margin: 0 0.5rem; height: 100%; `,B=x.div` background-color: ${({active:a})=>a?U.white:U.canvas80}; width: ${ve(3)}; height: ${ve(9)}; margin: 0.125rem 0; `,Be=({matchType:a,score:t})=>{switch(a){case"BO1":return e.jsx(Z,{children:e.jsx(B,{active:t>0})});case"BO3":return e.jsxs(Z,{children:[e.jsx(B,{active:t>1}),e.jsx(B,{active:t>0})]});case"BO5":return e.jsxs(Z,{children:[e.jsx(B,{active:t>2}),e.jsx(B,{active:t>1}),e.jsx(B,{active:t>0})]});default:return e.jsxs(Z,{children:[e.jsx(B,{active:t>1}),e.jsx(B,{active:t>0})]})}},ht=({leftTeamScore:a,rightTeamScore:t,leftTeamMatchScore:r,rightTeamMatchScore:i,matchType:o})=>e.jsxs("div",{className:"flex items-center justify-center rounded pb-2 font-norms uppercase",children:[e.jsx(Be,{matchType:o,score:r??0}),e.jsxs("div",{className:"flex rounded-small bg-canvas-90 p-2 font-style-label-2",children:[a!==void 0&&e.jsx("span",{className:"mr-2 block text-right",children:a}),":",t!==void 0&&e.jsx("span",{className:"ml-2 block text-left",children:t})]}),e.jsx(Be,{matchType:o,score:i??0})]}),os=x.div` position: absolute; z-index: 10; height: 100%; width: 1rem; ${({leftToRight:a})=>a?"left: 0;":"right: 0;"}; background: linear-gradient( ${({leftToRight:a})=>a?"to right":"to left"}, ${D.blastCanvas}, rgba(0, 0, 0, 0) 100% ); `;function Fe({leftToRight:a}){return e.jsx(os,{leftToRight:a})}const se=(a,t={type:"INTEGER"})=>{const r=t.default??"0";if(a===void 0)return r;const i=Number(a);if(Number.isNaN(i))return r;switch(t.type){case"INTEGER":return i.toLocaleString();case"DECIMAL":return i.toLocaleString(void 0,{maximumFractionDigits:t.decimalPlaces});case"PERCENTAGE":return i.toLocaleString(void 0,{style:"percent",maximumFractionDigits:t.decimalPlaces});default:return r}},{useCallback:ls,useMemo:Oe}=await S("react"),cs=({nationality:a,nickname:t,steamId:r,kills:i,deaths:o,adr:n,playerState:l,handleWeaponDetailsClick:d})=>{const f=ls(w=>{if(!w||!l)return;const b=Object.values(l?.weapons??{});return{primary:b?.filter(s=>s.type&&s?.type!=="Pistol"&&s?.type!=="Knife"&&s?.type!=="Grenade"&&s?.type!=="C4")?.[0]??void 0,secondary:b?.filter(s=>s?.type==="Pistol")?.[0]??void 0,knife:b?.filter(s=>s?.type==="Knife")?.[0]??void 0}},[l]),g=Oe(()=>f(r),[r,f]),c=Oe(()=>{if(g)return g.primary?.details??g.secondary?.details??g.knife?.details},[g]);return e.jsxs("div",{dir:"ltr",style:{fontFamily:"TT Norms Pro, sans-serif"},className:"z-0 flex min-w-[151px] transform-none flex-col overflow-hidden rounded-small bg-canvas-95 text-center text-xs font-bold leading-none tracking-wider",children:[e.jsx("div",{className:"flex shrink place-content-center items-center bg-canvas-90 p-1",children:e.jsxs("div",{className:"flex items-center",children:[a&&e.jsxs("div",{className:"mr-1 opacity-90",children:[e.jsx(ga,{countryCode:a,widthPx:16})," "]}),e.jsx("span",{children:t})]})}),e.jsx("div",{className:"px-2 xl:px-2 2xl:px-4",children:e.jsx("div",{className:E("w-full border-collapse border-spacing-0 border-0 bg-canvas-95",{"pl-2":!c}),children:e.jsxs("div",{className:"flex w-full place-content-center items-center gap-2 py-3",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"font-style-label-4",children:"K"}),e.jsx("span",{className:"w-fit whitespace-nowrap font-style-b4-body-copy",children:se(i,{type:"INTEGER",default:"0"})})]}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"font-style-label-4",children:"D"}),e.jsx("span",{className:"w-fit whitespace-nowrap font-style-b4-body-copy",children:se(o,{type:"INTEGER",default:"0"})})]}),e.jsxs("div",{className:"flex flex-col place-content-center items-center",children:[e.jsx("span",{className:"font-style-label-4",children:"ADR"}),e.jsx("span",{className:"w-fit whitespace-nowrap text-center font-style-b4-body-copy",children:se(n,{type:"DECIMAL",default:"0",decimalPlaces:0})})]}),e.jsx("div",{children:c&&r?e.jsx("div",{className:"group shrink cursor-pointer",title:"See skin details",onClick:()=>{O("Button Clicked",{context:"player-card-gun-button",id:r,steamId:r,itemName:c.weaponName}),d({steamId:r,weaponDetails:c})},children:e.jsx("div",{className:"rounded-small border border-white px-2 outline-none group-hover:bg-canvas-80",children:e.jsx("img",{src:c?.weaponImage,className:"w-7 brightness-200 group-hover:brightness-100",alt:c?.weaponName,draggable:!1})})}):null})]})})})]})},ds=x.div` width: 100%; margin: 0 auto; user-select: none; height: fit-content; .swiper-wrapper { align-items: center; } .swiper { width: 100%; height: 100%; } .swiper-slide { width: fit-content; } `,{Children:ms}=await S("react");function gt({initialSlide:a,spaceBetween:t,centeredSlides:r=!0,navNextRef:i,navPrevRef:o,dir:n="ltr",children:l,...d}){const{isMobile:f}=ie();return e.jsx(ds,{...d,children:e.jsx(xa,{slidesPerView:"auto",centeredSlides:r,loop:!1,loopFillGroupWithBlank:!1,modules:[va,ya],scrollbar:{hide:!0},mousewheel:{forceToAxis:!0},navigation:{nextEl:i?.current,prevEl:o?.current},initialSlide:a,spaceBetween:t||t===0?t:f?8:16,style:{overflow:"visible"},dir:n,children:ms.map(l,(g,c)=>e.jsx(ba,{children:g},`swiper-child-${c}`))})})}const us=x(gt)` padding: 0 1rem; cursor: grab; &:active { cursor: grabbing; } `;function _e({teamStats:a,isOnRight:t,gamestate:r,handleWeaponDetailsClick:i}){const o=a.playersStats.sort((n,l)=>{const d=Number(n.stats.adr);return Number(l.stats.adr)-d});return o.length?e.jsxs(e.Fragment,{children:[e.jsx(Fe,{leftToRight:t}),e.jsx(us,{centeredSlides:!1,initialSlide:0,spaceBetween:16,dir:t?"ltr":"rtl",children:o.map((n,l)=>e.jsx(cs,{handleWeaponDetailsClick:i,nationality:n.player.nationality,nickname:n.player.nickname,adr:n.stats.adr??0,deaths:n.stats.deaths??0,kills:n.stats.kills??0,steamId:n.player.ingameId,playerState:n.player.ingameId?r?.[n.player.ingameId]:void 0},l))}),e.jsx(Fe,{leftToRight:!t})]}):null}const{forwardRef:fs,useMemo:fe}=await S("react"),xt=fs(({teamsStats:a,isWaiting:t,roundsStats:r,series:i,gamestate:o,handleWeaponDetailsClick:n},l)=>{const d=a.length===2?a[0]:void 0,f=a.length===2?a[1]:void 0,{leftTeamScore:g,rightTeamScore:c}=fe(()=>{if(!d||!f)return{leftTeamScore:void 0,rightTeamScore:void 0};const s=r.filter(h=>h.roundWinnerTeam?.uuid===d.team.uuid).length,m=r.filter(h=>h.roundWinnerTeam?.uuid===f.team.uuid).length;return{leftTeamScore:s,rightTeamScore:m}},[r,d,f]),w=fe(()=>{if(i&&d)return d.team.uuid===i.teamA?.uuid?i.teamAScore:i.teamBScore},[i,d]),b=fe(()=>{if(i&&f)return f.team.uuid===i.teamA?.uuid?i.teamAScore:i.teamBScore},[i,f]);return!d||!f?null:e.jsxs("div",{className:"relative z-0 flex h-fit w-full shrink-0 grow-0 flex-row items-center overflow-hidden bg-canvas-100",ref:l,children:[e.jsx("div",{className:"relative flex-1 flex-row overflow-hidden",children:e.jsx(_e,{teamStats:d,isWaiting:t,gamestate:o,handleWeaponDetailsClick:n})}),e.jsxs("div",{className:"relative z-infoToolTip flex h-12 shrink-0 grow-0 flex-col justify-center px-7",children:[e.jsx("img",{className:"absolute left-0 top-[-15%] -z-infoToolTip max-h-12 w-10 object-contain opacity-40",src:V({id:d.team.uuid})}),e.jsx(ht,{leftTeamScore:g,rightTeamScore:c,leftTeamMatchScore:w,rightTeamMatchScore:b,matchType:i?.type}),e.jsx("img",{className:"absolute bottom-[-15%] right-0 -z-infoToolTip max-h-10 w-10 object-contain opacity-40",src:V({id:f.team.uuid})})]}),e.jsxs("div",{className:"relative flex-1 flex-row-reverse overflow-hidden",children:[" ",e.jsx(_e,{teamStats:f,isWaiting:t,isOnRight:!0,gamestate:o,handleWeaponDetailsClick:n})]})," "]})});xt.displayName="PerformanceBar";const ps="87px",vt="248px",yt=ye` ${be}; font-size: 1rem; letter-spacing: 0.1rem; `,hs=x.div` background-color: ${D.blastCanvas}; flex-shrink: 0; flex-grow: 0; width: 100%; overflow: hidden; display: flex; align-items: center; justify-content: center; transition: all ${k}ms ease-in-out, height ${k}ms ease-in-out; height: ${({isExpanded:a,isTheaterMode:t})=>t?0:a?vt:ps}; ${({isTheaterMode:a})=>a&&"opacity: 0;"} .fade-enter { opacity: 0; } .fade-enter-active { opacity: 1; transition: all ${k}ms ease-in-out; } .fade-enter-done { opacity: 1; } .fade-exit { opacity: 1; } .fade-exit-active { opacity: 0; transition: all ${k}ms ease-in-out; } .fade-exit-done { opacity: 0; } `,bt=ye` ${yt} text-align: center; color: ${D.blastCanvas50}; `,gs=x.div` ${bt}; font-size: 0.75rem; `,xs=x.div` transition: all 0.25s ease; cursor: ${({isClickable:a})=>a?"pointer":"unset"}; ${bt}; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 2.5rem; height: 2.75rem; border-radius: 4px; margin-top: 0.5rem; border: 1px solid ${({isSelected:a})=>a?D.blastYellow:D.blastCanvas20}; &:hover { ${({isSelected:a,isClickable:t})=>{if(t&&!a)return`border-color : ${D.blastCanvas50}`}}; } `,vs=x.img` width: 90%; height: 95%; object-fit: contain; `;function Ke({roundNumber:a,isSelected:t,winnerTeamId:r,onSelect:i}){const o=!!r&&!t;return e.jsxs("div",{className:"mx-2",children:[e.jsxs(gs,{children:["R",a]}),e.jsx(xs,{isClickable:o,isSelected:t,onClick:()=>{o&&i&&i(a)},children:r?e.jsx(vs,{src:V({id:r})}):"?"})]})}const ys=x(gt)` max-width: fit-content; cursor: grab; padding-left: 1rem; padding-right: 1rem; &:active { cursor: grabbing; } `,bs=x.div` ${yt}; height: fit-content; margin-top: 1.25rem; `,{useMemo:ws}=await S("react"),ze=24,Ve=12;function js({selectedRound:a,onRoundSelect:t,isWaiting:r,roundWinners:i}){const o=ws(()=>{const n=[...i.map(l=>({roundNumber:l.roundNumber,isSelected:a===l.roundNumber,winnerTeamId:r?void 0:l.winnerTeamId,onSelect:t}))];if(n.length<ze)for(let l=n.length+1;l<=ze;l++)n.push({roundNumber:l,isSelected:!1,onSelect:void 0});return n.sort((l,d)=>l.roundNumber-d.roundNumber),n},[i,a,t,r]);return e.jsxs(ys,{centeredSlides:!1,spaceBetween:0,initialSlide:Math.max((a??0)-10,0),children:[o.slice(0,Ve).map(n=>e.jsx(Ke,{roundNumber:n.roundNumber,isSelected:n.isSelected,onSelect:n.onSelect,winnerTeamId:n.winnerTeamId},n.roundNumber)),e.jsx(bs,{children:"HT"},"ht"),o.slice(Ve).map(n=>e.jsx(Ke,{roundNumber:n.roundNumber,isSelected:n.isSelected,onSelect:n.onSelect,winnerTeamId:n.winnerTeamId},n.roundNumber))]})}const Ss=x.div` display: flex; flex-direction: column; align-items: center; justify-content: flex-start; height: fit-content; flex: 1; ${be}; font-size: 0.8rem; text-transform: none; `,ks=x.table` border-collapse: collapse; border-spacing: 0; border: none; width: 100%; `,Y=x.tr` &:nth-child(even) { background: linear-gradient( 90deg, ${D.blastCanvas10}00 00%, ${D.blastCanvas10}00 10%, ${D.blastCanvas10} 20%, ${D.blastCanvas10}, ${D.blastCanvas10} 80%, ${D.blastCanvas10}00 90%, ${D.blastCanvas10}00 100% ); } `,wt=ye` padding: 0.25rem 0.5rem; `,Ne=x.td` display: flex; align-items: center; justify-content: center; min-height: 1.75rem; `,jt=x.span` ${wt}; text-transform: uppercase; font-size: 0.65rem; `,Ns=x(jt)` font-size: 0.6rem; `,Te=x.div` text-transform: uppercase; margin: 0 1.5rem; flex-shrink: 0; flex-grow: 0; color: ${D.blastCanvas70}; `,ne=x.div` ${wt}; &:first-child { text-align: right; } white-space: nowrap; color: ${D.white}; flex: 1 0 auto; width: 100%; min-width: 4rem; `,J=x.span` width: fit-content; display: flex; align-items: center; `,We=x(rt)` transform: translateY(0.05rem); `,Ge=x(rt)` ${({isMirrored:a})=>a&&"transform: scaleX(-1);"} `,ee=x.span` margin: 0 0.5rem; `,Ts=({selectedRound:a,isWaiting:t,leftTeam:r})=>{let i=e.jsx("span",{}),o=e.jsx("span",{});if(a&&!t){const n=a.firstKillAttacker,l=a.firstKillVictim;n&&n.team?.uuid===r.uuid?(i=e.jsxs(J,{children:[e.jsx(ee,{children:n?.nickname||""}),e.jsx(Ge,{icon:"ak47"})]}),o=e.jsxs(J,{children:[e.jsx(We,{icon:"dead"}),e.jsx(ee,{children:l?.nickname||""})]})):(i=e.jsxs(J,{children:[e.jsx(ee,{children:l?.nickname||""}),e.jsx(We,{icon:"dead"})]}),o=e.jsxs(J,{children:[e.jsx(Ge,{icon:"ak47",isMirrored:!0}),e.jsx(ee,{children:n?.nickname||""})]}))}return e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx("div",{className:"whitespace-nowrap p-2",children:i}),e.jsx(Te,{children:"1st blood"}),e.jsx("div",{className:"whitespace-nowrap p-2",children:o})]})},Ds=({selectedRound:a,isWaiting:t,leftTeam:r,rightTeam:i})=>{let o,n,l,d;if(a&&!t){const f=a?.teamAggregates.find(c=>c.team.uuid===r.uuid)?.teamStats;o=f?.highestDamageDealt,n=f?.highestDamageDealtPlayer;const g=a?.teamAggregates.find(c=>c.team.uuid===i.uuid)?.teamStats;l=g?.highestDamageDealt,d=g?.highestDamageDealtPlayer}return e.jsxs(Ne,{children:[e.jsx(ne,{children:o?`${n?.nickname??""}: ${o}`:""}),e.jsx(Te,{children:"Highest damage dealt"}),e.jsx(ne,{children:l?`${d?.nickname??""}: ${l}`:""})]})},Cs=({selectedRound:a,isWaiting:t,leftTeam:r,rightTeam:i})=>{let o,n;return a&&!t&&(o=a?.teamAggregates.find(l=>l.team.uuid===r.uuid)?.teamStats?.kills||0,n=a?.teamAggregates.find(l=>l.team.uuid===i.uuid)?.teamStats?.kills||0),e.jsxs(Ne,{children:[e.jsx(ne,{children:o??""}),e.jsx(Te,{children:"Round kills"}),e.jsx(ne,{children:n??""})]})},{useMemo:H}=await S("react"),Is=({isWaiting:a,roundsStats:t,selectedRoundNumber:r,leftTeam:i,rightTeam:o,seriesData:n})=>{const l=!a&&(!t.length||!t[0].roundWinnerTeam),d=H(()=>r?t.find(b=>b.roundNumber===r):void 0,[r,t]),f=H(()=>{if(r)return t.filter(b=>b.roundNumber<=r).filter(b=>b.roundWinnerTeam?.uuid===i.uuid).length},[r,t,i]),g=H(()=>{if(r)return t.filter(b=>b.roundNumber<=r).filter(b=>b.roundWinnerTeam?.uuid===o.uuid).length},[r,t,o]),c=H(()=>{if(n)return i.uuid===n.teamA?.uuid?n.teamAScore:n.teamBScore},[n,i]),w=H(()=>{if(n)return o.uuid===n.teamA?.uuid?n.teamAScore:n.teamBScore},[n,o]);return e.jsx(Ss,{children:e.jsx(ks,{children:e.jsxs("tbody",{children:[e.jsx(Y,{children:e.jsx(Ne,{children:a?e.jsx(Ns,{children:"Waiting..."}):l?e.jsx(jt,{children:"Round 1 in progress..."}):e.jsx(ht,{leftTeamScore:f,rightTeamScore:g,leftTeamMatchScore:c,rightTeamMatchScore:w,matchType:n?.type})})}),e.jsx(Y,{children:e.jsx(Ts,{isWaiting:a,selectedRound:d,leftTeam:i})}),e.jsx(Y,{children:e.jsx(Cs,{isWaiting:a,selectedRound:d,leftTeam:i,rightTeam:o})}),e.jsx(Y,{children:e.jsx(Ds,{isWaiting:a,selectedRound:d,leftTeam:i,rightTeam:o})})]})})})},$s=x.div` background-color: ${D.blastCanvas}; display: flex; flex-direction: column; padding: 1rem 0 0; height: ${vt}; `,Es=x.div` margin: 0 auto; width: 100%; `,As=x.div` flex-grow: 1; display: flex; align-items: center; height: 100%; overflow: hidden; `,He=x.div` ${be}; flex: 1; max-width: 25%; display: flex; flex-direction: row; align-items: center; justify-content: center; padding: 1rem; position: relative; height: 100%; `,qe=x.div` z-index: 1; position: absolute; top: 0; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; `,Ue=x.img` height: 80%; width: 100%; object-fit: contain; opacity: 0.3; `,{forwardRef:Ms,useEffect:Ps,useMemo:Ls,useState:Rs}=await S("react"),St=Ms(({roundsStats:a,teams:t,isWaiting:r,series:i},o)=>{const n=a.length&&!r?Math.max(...a.filter(s=>s.roundWinnerTeam).map(s=>s.roundNumber)):void 0,[l,d]=Rs(n),f=a.find(s=>s.roundNumber===l),g=t.map(s=>f?{...s,side:f.teamAggregates.find(m=>m.team.uuid===s.uuid)?.team.side}:s),c=g[0],w=g[1];Ps(()=>{d(s=>n&&s===n-1?n:s)},[n]);const b=Ls(()=>{const s=[];for(const m of a)m.roundWinnerTeam&&s.push({roundNumber:m.roundNumber,winnerTeamId:m.roundWinnerTeam.uuid});return s},[a]);return e.jsxs($s,{ref:o,children:[e.jsx(Es,{children:e.jsx(js,{selectedRound:l,onRoundSelect:d,isWaiting:r,roundWinners:b})}),e.jsxs(As,{children:[e.jsxs(He,{children:[e.jsx(Ue,{src:V({id:c.uuid})}),e.jsx(qe,{children:c?.side?`${c.side} SIDE`:""})]}),e.jsx(Is,{leftTeam:c,rightTeam:w,isWaiting:r,roundsStats:a,selectedRoundNumber:l,seriesData:i}),e.jsxs(He,{children:[e.jsx(Ue,{src:V({id:w.uuid})}),e.jsx(qe,{children:w?.side?`${w.side} SIDE`:""})]})]})]})});St.displayName="RoundProgressBar";const{useEffect:Bs,useRef:Qe,useState:Xe}=await S("react");function Fs(){const a=oe(),{series:t,isLiveStatsAvailable:r,isLiveStatsExpanded:i,isWaitingState:o,mapStats:n,toggleLiveStats:l,setActiveState:d}=a,f=a.mapStats?.teamAggregates??[],g=a.mapStats?.rounds??[],[c,w]=Xe(!1),[b,s]=Xe(i),m=Qe(null),h=Qe(null),p=i?m:h,{isTheaterMode:v}=re();return Bs(()=>{c?i?s(!0):setTimeout(()=>{s(!1)},k-we):w(!0)},[i,c]),!r||!t||!a.mapStats?null:e.jsx(hs,{isExpanded:b,isTheaterMode:v,children:e.jsx(wa,{children:e.jsx(je,{nodeRef:p,timeout:k,classNames:"fade",children:e.jsxs("div",{ref:p,className:"relative w-full",children:[e.jsx("div",{className:"absolute left-0 top-0 z-[2] h-full w-4 bg-gradient-to-r from-canvas-100 to-transparent"}),e.jsx("div",{className:"absolute right-0 top-0 z-[2] h-full w-4 bg-gradient-to-l from-canvas-100 to-transparent"}),!i&&e.jsx(xt,{teamsStats:f,isWaiting:o,roundsStats:g,series:t,gamestate:n?.gamestatePlayers,handleWeaponDetailsClick:$=>{const L=f.find(C=>C.playersStats.find(j=>j.player.ingameId===$?.steamId));d({activeTeam:L?.team,weaponDetails:$?.weaponDetails,selectedPlayerSteamId:$?.steamId}),l()}}),i&&e.jsx(St,{isWaiting:o,teams:f.map($=>$.team),roundsStats:g,series:t})]})},i?"expanded":"collapsed")})})}const{useCallback:Os,useEffect:_s,useState:Ks}=await S("react"),Ze="--vh",zs=()=>Number((window.innerHeight*.01).toFixed(2));let pe=0;const Vs=()=>{const[a,t]=Ks(0),r=Os(()=>{const i=zs();document.documentElement.style.setProperty(Ze,`${i}px`),t(i)},[]);return _s(()=>(typeof window<"u"&&(pe+=1,r(),window.addEventListener("resize",r)),()=>{window.removeEventListener("resize",r),pe-=1,pe===0&&document.documentElement.style.removeProperty(Ze)}),[r]),a},Ws=a=>`${st}/skins/weapon_${a}.svg`;function he({skin:a,isActive:t,onClick:r,steamId:i,defaultSkins:o}){return e.jsx("div",{className:E("flex place-content-center items-center rounded-small border-canvas-90 px-3 py-1",{"bg-canvas-80":t,"cursor-pointer hover:bg-canvas-80":a}),onClick:()=>{!t&&a&&i?(r({steamId:i,weaponDetails:a}),Ft?.track("Button Clicked",{weapon:a?.itemName,steamId:i,weaponType:a.type,context:"sidemenu-gun-button"})):r(null)},children:a?.weaponImage?e.jsx("img",{src:a?.weaponImage,className:"h-8 w-12 brightness-110"}):e.jsx("img",{src:Ws(o)})})}const{useCallback:Gs,useEffect:Hs,useMemo:ge,useState:Ye}=await S("react"),Je={kills:{title:"Kills",formattingOptions:{type:"INTEGER",default:"0"}},deaths:{title:"Deaths",formattingOptions:{type:"INTEGER",default:"0"}},killDeathRatio:{title:"K/D Ratio",formattingOptions:{type:"DECIMAL",decimalPlaces:1,default:"0"}},adr:{title:"ADR",formattingOptions:{type:"DECIMAL",decimalPlaces:1,default:"0"}},avgDamageTaken:{title:"Avg Damage Taken",formattingOptions:{type:"DECIMAL",decimalPlaces:1,default:"0"}},headshotPercentage:{title:"Headshot %",formattingOptions:{type:"PERCENTAGE",default:"0"}},assists:{title:"Assists",formattingOptions:{type:"INTEGER",default:"0"}},utilityDamage:{title:"Utility Damage",formattingOptions:{type:"DECIMAL",decimalPlaces:1,default:"0"}},firstKills:{title:"Opening Kills",formattingOptions:{type:"INTEGER",default:"0"}},maxStreak:{title:"Max Streak",formattingOptions:{type:"INTEGER",default:"0"}}};function qs({teamStats:a}){const{activeState:t,setActiveState:r,mapStats:i}=oe(),[o,n]=Ye(!1),[l,d]=Ye(!1);ct(()=>{r(s=>({chosenWeaponDetails:void 0,activeTeam:s.activeTeam,selectedPlayerSteamId:s.selectedPlayerSteamId})),d(!1)},l?500:null);const f=s=>{if(!s){d(!0);return}r(m=>({...m,selectedPlayerSteamId:s.steamId,weaponDetails:s.weaponDetails}))},g=Gs(s=>{if(!i?.gamestatePlayers||!s||!i?.gamestatePlayers[s])return;const m=Object.values(i?.gamestatePlayers[s].weapons??{});return{primary:m?.filter(h=>h.type&&h?.type!=="Pistol"&&h?.type!=="Knife"&&h?.type!=="Grenade"&&h?.type!=="C4")?.[0]??void 0,secondary:m?.filter(h=>h?.type==="Pistol")?.[0]??void 0,knife:m?.filter(h=>h?.type==="Knife")?.[0]??void 0}},[i?.gamestatePlayers]),c=ge(()=>{if(t.selectedPlayerSteamId)return g(t.selectedPlayerSteamId)},[t.selectedPlayerSteamId,g]),w=ge(()=>{if(!t.weaponDetails)return;const s=t.weaponDetails?.itemName;return s===c?.primary?.details?.itemName?"primary":s===c?.secondary?.details?.itemName?"secondary":s===c?.knife?.details?.itemName?"knife":void 0},[t.weaponDetails]),b=ge(()=>{if(!t.weaponDetails)return;const s=t.weaponDetails?.itemName;return{isStale:(s===c?.primary?.details?.itemName?c?.primary:s===c?.secondary?.details?.itemName?c?.secondary:s===c?.knife?.details?.itemName?c?.knife:void 0)===void 0,newDetails:w&&c?.[w]?c?.[w]:void 0,steamId:t.selectedPlayerSteamId,weaponDetails:t.weaponDetails}},[t.selectedPlayerSteamId,t.weaponDetails,c,w]);return Hs(()=>{const s=document.querySelector(`[data-player-name="${t.selectedPlayerSteamId}"]`);s&&s.scrollIntoView({behavior:"smooth",block:"center"})},[t.selectedPlayerSteamId]),a.playersStats.length?e.jsxs("div",{className:"flex flex-col overflow-x-hidden",children:[e.jsx("div",{className:"custom-scrollbar flex items-center justify-between overflow-x-auto p-2",children:e.jsx("div",{className:"flex items-center gap-1",children:a.playersStats.map(s=>{const{player:m}=s;return e.jsx("div",{"data-player-name":m.ingameId,onClick:()=>{r(h=>{const p=g(m.ingameId),v=p?.primary??p?.secondary??p?.knife;return v?{...h,weaponDetails:v.details,selectedPlayerSteamId:m.ingameId}:(d(!0),{...h,selectedPlayerSteamId:m.ingameId})})},className:E("cursor-pointer rounded-small px-2 py-0.5",{"bg-canvas-80 text-white":t.selectedPlayerSteamId===m.ingameId,"bg-canvas-90 text-neutral-50":t.selectedPlayerSteamId!==m.nickname}),children:e.jsx("span",{className:"capitalize font-style-b3-body-copy",children:m.nickname})},m.uuid)})})}),e.jsxs("div",{className:"flex flex-col gap-2 border-x-0 border-b border-t-0 border-canvas-90 p-2",children:[e.jsx("span",{className:"px-1 font-style-b3-body-copy",children:"Skins"}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(he,{skin:c?.primary?.details,isActive:!!(t?.weaponDetails===c?.primary?.details&&c?.primary?.details),onClick:f,steamId:t.selectedPlayerSteamId,defaultSkins:"famas"}),e.jsx(he,{skin:c?.secondary?.details,isActive:!!(t?.weaponDetails===c?.secondary.details&&c?.secondary.details),onClick:f,steamId:t.selectedPlayerSteamId,defaultSkins:"fiveseven"}),e.jsx(he,{defaultSkins:"knife",skin:c?.knife?.details,isActive:!!(t?.weaponDetails===c?.knife?.details&&c?.knife?.details),onClick:f,steamId:t.selectedPlayerSteamId})]}),e.jsxs(Ot,{show:!!t.weaponDetails?.itemName&&!l,enter:"transition-all duration-default",enterFrom:"-translate-y-2 opacity-0",enterTo:"translate-y-0 opacity-100",leave:"transition-all duration-default",leaveFrom:"translate-y-0 opacity-100",leaveTo:"-translate-y-2 opacity-0",children:[e.jsx("div",{className:"flex w-full flex-col place-content-center items-center gap-2",children:e.jsxs("div",{className:"h-32",children:[e.jsx("img",{src:t.weaponDetails?.weaponImage,onLoad:()=>n(!0),className:E("h-32 brightness-110",{"opacity-0":!o})},t.weaponDetails?.weaponImage),!o&&e.jsx("div",{className:"h-32 w-full animate-pulse bg-canvas-80"})]})}),e.jsx(ja,{}),e.jsxs("div",{className:"flex w-full flex-col gap-2 pt-3",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"font-style-b3-body-copy",children:t.weaponDetails?.skinName!=="default"?t.weaponDetails?.itemName:`Default ${t.weaponDetails?.itemName}`}),b?.isStale&&b?.newDetails?e.jsxs("div",{onClick:()=>{r(s=>({...s,weaponDetails:b.newDetails?.details,selectedPlayerSteamId:b.steamId}))},className:"cursor-pointer rounded-small px-1.5 pt-0.5 text-yellow hover:bg-canvas-95",children:[" ",e.jsx(Sa,{className:"size-3"})]}):null]}),t.weaponDetails?.potentialRarities?.[0]!==void 0&&t.weaponDetails.skinName!=="default"&&e.jsxs("div",{className:"flex w-full items-center justify-between text-neutral-50 font-style-b3-body-copy",children:[e.jsx("div",{className:"",children:"Potential wear:"}),e.jsxs("div",{className:"ml-1 flex place-content-center items-center gap-0.5",children:[t.weaponDetails?.potentialRarities?.[0],t.weaponDetails?.potentialRarities?.length>1&&e.jsxs(ce,{className:"relative",children:[e.jsx(ce.Button,{className:"cursor-pointer [all:unset]",children:e.jsx(dt,{className:"inline-block size-2"})}),e.jsxs(ce.Panel,{className:"absolute right-0 top-4 z-10 flex flex-col gap-0.5 rounded-small bg-canvas-80 p-1",children:[t.weaponDetails?.potentialRarities?.slice(1)?.map(s=>e.jsx("div",{className:"flex flex-col place-content-end items-end gap-1 text-right text-neutral-50 font-style-b4-body-copy",onClick:()=>{O("External Link Clicked",{id:t.selectedPlayerSteamId,name:t.weaponDetails?.itemName,steamId:t.selectedPlayerSteamId,itemName:t.weaponDetails?.itemName,link:`https://tradeit.gg/csgo/store?search=${t.weaponDetails?.itemName} (${s})`,context:"skins-in-stats",target:"tradeit"})},children:e.jsx("a",{href:`https://tradeit.gg/csgo/store?search=${t.weaponDetails?.itemName} (${s})&utm_source=blast&utm_medium=affiliate&utm_campaign=skins_in_stats`,target:"_blank",rel:"noreferrer",className:"ml-1 flex text-right text-yellow no-underline font-style-label-4 hover:opacity-80",children:s})},s)),e.jsx("img",{src:"/solutions.jpg",alt:""})]})]})]})]}),t.weaponDetails?.weaponMinWear!==void 0&&e.jsxs("div",{className:"flex w-full items-center justify-between text-neutral-50 font-style-b3-body-copy",children:[e.jsx("div",{className:"",children:"Min wear:"}),e.jsx("div",{className:"ml-1",children:t.weaponDetails?.weaponMinWear})]}),t.weaponDetails?.weaponMaxWear!==void 0&&e.jsxs("div",{className:"flex w-full items-center justify-between text-neutral-50 font-style-b3-body-copy",children:[e.jsx("div",{className:"",children:"Max wear:"}),e.jsx("div",{className:"ml-1",children:t.weaponDetails?.weaponMaxWear})]}),t.weaponDetails?.skinName!=="default"&&e.jsx("div",{className:"flex w-full items-center justify-between text-neutral-50 font-style-b3-body-copy",children:e.jsxs(_t,{href:`https://tradeit.gg/csgo/store?search=${t.weaponDetails?.itemName} (${t.weaponDetails?.potentialRarities?.[0]??"Factory New"})&utm_source=blast&utm_medium=affiliate&utm_campaign=skins_in_stats`,variant:"tertiary",target:"_blank",className:"flex items-center px-0",onClick:()=>{O("External Link Clicked",{id:t.selectedPlayerSteamId,name:t.weaponDetails?.itemName,steamId:t.selectedPlayerSteamId,itemName:t.weaponDetails?.itemName,link:`https://tradeit.gg/csgo/store?search=${t.weaponDetails?.itemName} (${t.weaponDetails?.potentialRarities?.[0]??"Factory New"})`,context:"skins-in-stats",target:"tradeit"})},children:["Market ",e.jsx(ka,{className:"inline-block size-3 pt-0.5"})]})})]})]})]}),!!t.selectedPlayerSteamId&&e.jsx("table",{className:"w-full border-spacing-0 border-0 bg-canvas-100",children:e.jsx("tbody",{children:Object.entries(Je).map(([s,m])=>{const h=a.playersStats.find(v=>v.player.ingameId===t.selectedPlayerSteamId)?.stats[s],p=se(typeof h=="boolean"?"":h,Je[s].formattingOptions);return e.jsx("tr",{children:e.jsxs("td",{className:"flex items-center justify-between border-x-0 border-b border-t-0 border-canvas-90 p-2 px-3 font-style-b3-body-copy",children:[e.jsx("span",{className:"",children:m.title}),e.jsx("span",{children:p})]})},s)})})})]}):null}const{useEffect:Us,useMemo:Qs,useRef:Xs,useState:Zs}=await S("react");function Ys(){const a=oe(),{isLiveStatsAvailable:t,isLiveStatsExpanded:r,isWaitingState:i,activeState:o}=a,[n,l]=Zs(r),d=Xs(null),f=Qs(()=>{if(!(!a.mapStats?.teamAggregates||!o.activeTeam))return a.mapStats.teamAggregates.find(g=>g.team.uuid===o.activeTeam?.uuid)},[a.mapStats?.teamAggregates,o.activeTeam]);return Us(()=>{r?setTimeout(()=>{l(!0)},k-we):l(!1)},[r]),t?e.jsx(je,{in:n,timeout:k,nodeRef:d,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:i||!f?e.jsx("div",{className:E("flex size-full flex-col items-center justify-center p-8 text-center",{"opacity-0":!n}),ref:d,children:"Waiting for the match to begin..."}):e.jsx("div",{className:E("absolute left-0 top-0 w-full",{"opacity-0":!n}),ref:d,children:e.jsx(qs,{teamStats:f})})}):null}const Js="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='48'%20height='4'%20viewBox='0%200%2048%204'%20fill='none'%3e%3cpath%20d='M1%200L1%204'%20stroke='%234D3D48'%20/%3e%3cpath%20d='M3%200L3%204'%20stroke='%234D3D48'%20/%3e%3cpath%20d='M5%200L5%204'%20stroke='%234D3D48'%20/%3e%3cpath%20d='M7%200L7%204'%20stroke='%234D3D48'%20/%3e%3cpath%20d='M9%200L9%204'%20stroke='%234D3D48'%20/%3e%3cpath%20d='M11%200L11%204'%20stroke='%234D3D48'%20/%3e%3cpath%20d='M13%200L13%204'%20stroke='%234D3D48'%20/%3e%3cpath%20d='M15%200L15%204'%20stroke='%234D3D48'%20/%3e%3cpath%20d='M17%200L17%204'%20stroke='%234D3D48'%20/%3e%3cpath%20d='M19%200L19%204'%20stroke='%234D3D48'%20/%3e%3cpath%20d='M21%200L21%204'%20stroke='%234D3D48'%20/%3e%3cpath%20d='M23%200L23%204'%20stroke='%234D3D48'%20/%3e%3cpath%20d='M21%200L21%204'%20stroke='%234D3D48'%20/%3e%3cpath%20d='M25%200L25%204'%20stroke='%234D3D48'%20/%3e%3cpath%20d='M27%200L27%204'%20stroke='%234D3D48'%20/%3e%3cpath%20d='M31%200L31%204'%20stroke='%234D3D48'%20/%3e%3cpath%20d='M33%200L33%204'%20stroke='%234D3D48'%20/%3e%3cpath%20d='M35%200L35%204'%20stroke='%234D3D48'%20/%3e%3cpath%20d='M37%200L37%204'%20stroke='%234D3D48'%20/%3e%3cpath%20d='M39%200L39%204'%20stroke='%234D3D48'%20/%3e%3cpath%20d='M41%200L41%204'%20stroke='%234D3D48'%20/%3e%3cpath%20d='M43%200L43%204'%20stroke='%234D3D48'%20/%3e%3cpath%20d='M45%200L45%204'%20stroke='%234D3D48'%20/%3e%3cpath%20d='M47%200L47%204'%20stroke='%234D3D48'%20/%3e%3cpath%20d='M29%200L29%204'%20stroke='%234D3D48'%20/%3e%3c/svg%3e",{useEffect:ei,useState:ti}=await S("react"),et=({veto:a,isShown:t,mountDelay:r,unmountDelay:i})=>{const[o,n]=ti(!1);return ei(()=>{t?setTimeout(()=>n(!0),r):setTimeout(()=>n(!1),i)},[t,r,i]),e.jsxs("div",{className:E("mb-1 flex h-16 w-full flex-col items-center justify-center rounded bg-cover bg-center opacity-0 transition-opacity duration-700",{"opacity-100":o}),style:{backgroundImage:`linear-gradient(to bottom, rgba(42, 24, 37, 0.7), rgba(42, 24, 37, 0.7)), url("${st}/maps/${a.map}")`},children:[e.jsx("span",{className:"my-1 text-white font-style-label-5",children:Kt(a.map.split("_")[1])}),a.team&&e.jsx("img",{className:"size-5",src:V({id:a.team?.uuid,width:20,height:20}),alt:`team ${a.team.name} logo`}),e.jsx("div",{className:"my-1 flex items-center justify-center rounded-small bg-canvas-100 px-2 py-1",children:e.jsx("span",{className:"text-white font-style-label-5",children:a.team?a.type:"DECIDER"})})]})},{useMemo:ai,useState:si}=await S("react"),ii=({vetoes:a})=>{const[t,r]=si(!1),i=ai(()=>a.filter(o=>o.type==="pick"),[a]);return e.jsxs("div",{className:"mx-1 flex flex-col items-center opacity-100",children:[e.jsx("img",{src:Js,alt:""}),e.jsx("button",{className:"my-3 h-14 w-full rounded-small border-none bg-canvas-90 hover:cursor-pointer",onClick:()=>r(o=>!o),children:e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsxs("span",{className:"text-white font-style-label-4",children:["Map",e.jsx("br",{})," Picks"]}),e.jsx(dt,{className:E("rotate-0 text-white transition-all duration-700",{"rotate-180":t}),height:18})]})}),i.map((o,n)=>{if(o.type==="pick"&&o.team===null)return e.jsx(et,{veto:o,isShown:t,mountDelay:(n+1)*50,unmountDelay:(i.length-n)*25},o.index);if(o.team)return e.jsx(et,{veto:o,isShown:t,mountDelay:(n+1)*50,unmountDelay:(i.length-n)*25},o.index)})]})};function ni({teamAActive:a,toggleActive:t,teamLogoA:r,teamLogoB:i}){return e.jsxs(Na,{checked:a,onChange:t,className:E("relative inline-flex h-6 w-14 shrink cursor-pointer rounded-small border-2 border-transparent bg-transparent p-0 duration-200 ease-in-out"),children:[e.jsx("span",{className:"sr-only",children:"Use setting"}),e.jsxs("span",{className:E(a?"translate-x-11":"translate-x-0","pointer-events-none relative inline-block size-9 rounded-small bg-canvas-90 shadow ring-0 transition duration-200 ease-in-out"),children:[e.jsx("span",{className:E(a?"opacity-0 duration-100 ease-out":"opacity-100 duration-200 ease-in","absolute inset-0 flex size-full items-center justify-center transition-opacity"),"aria-hidden":"true",children:e.jsx("img",{className:"size-6",src:r,alt:"Team A"})}),e.jsx("span",{className:E(a?"opacity-100 duration-200 ease-in":"opacity-0 duration-100 ease-out","absolute inset-0 flex size-full items-center justify-center transition-opacity"),"aria-hidden":"true",children:e.jsx("img",{className:"size-6",src:i,alt:"Team B"})})]}),e.jsx("span",{className:"absolute -right-7 top-0 flex size-9 items-center justify-center transition-opacity","aria-hidden":"true",children:e.jsx("img",{className:"size-6",src:i,alt:"Team A",draggable:!1})}),e.jsx("span",{className:"absolute right-4 top-0 flex size-9 items-center justify-center transition-opacity","aria-hidden":"true",children:e.jsx("img",{className:"size-6",src:r,alt:"Team B",draggable:!1})})]})}const ri=x.div` padding: 0.25rem; display: flex; align-items: center; padding-left: 0.75rem; `,oi=x.img` transform: rotate(${({isRotated:a,reversed:t})=>a?t?0:180:t?180:0}deg); transition: transform ${k}ms ease-in-out; cursor: pointer; z-index: ${zt.liveChatToggleIcon}; `,li="data:image/svg+xml,%3csvg%20width='32'%20height='32'%20viewBox='0%200%2032%2032'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='16'%20cy='16'%20r='12'%20stroke='white'/%3e%3cpath%20d='M10%2016L9.64645%2016.3536L9.29289%2016L9.64645%2015.6464L10%2016ZM15.6464%2022.3536L9.64645%2016.3536L10.3536%2015.6464L16.3536%2021.6464L15.6464%2022.3536ZM9.64645%2015.6464L15.6464%209.64645L16.3536%2010.3536L10.3536%2016.3536L9.64645%2015.6464Z'%20fill='white'/%3e%3cpath%20d='M20%2022L20%2010'%20stroke='white'/%3e%3cpath%20d='M10%2016L20%2016'%20stroke='white'/%3e%3c/svg%3e",ci=({isRotated:a,label:t,onClick:r,reversed:i,className:o,title:n})=>e.jsx(ri,{title:n,className:o,"aria-label":t,onClick:r,children:e.jsx(oi,{src:li,isRotated:a,reversed:i})}),kt="18rem",Nt="60px",di=x.div` --width-expanded: ${kt}; --width-collapsed: ${Nt}; display: flex; flex-direction: column; flex-shrink: 0; flex-grow: 0; background-color: ${U.canvas100}; z-index: 1; white-space: nowrap; overflow: hidden; width: ${({isExpanded:a,isTheaterMode:t})=>t?0:a?"var(--width-expanded)":"var(--width-collapsed)"}; transition: width ${k}ms ease-in-out; .fade-enter { opacity: 0; } .fade-enter-active { opacity: 1; transition: all ${k}ms ease-in-out; } .fade-enter-done { opacity: 1; } .fade-exit { opacity: 1; } .fade-exit-active { opacity: 0; transition: all ${k}ms ease-in-out; } .fade-exit-done { opacity: 0; } `,mi=x(ci)` position: absolute; right: 0; transform: ${({isTransformed:a})=>a?"translateX(0)":"translateX(-10px)"}; transition: transform ${k}ms ease-in-out; `,ui=x.div` display: flex; position: relative; min-width: ${({isExpanded:a})=>a?kt:Nt}; `,fi=x(mt)` width: fit-content; opacity: ${({hidden:a})=>a?0:1}; transition: all ${k}ms ease-in-out; position: absolute; text-align: center; top: 3rem; `,{useEffect:pi,useRef:hi,useState:xe}=await S("react");function gi(){const{isLiveStatsAvailable:a,isLiveStatsExpanded:t,toggleLiveStats:r,vetoes:i,series:o,toggleActiveTeam:n,activeState:l}=oe(),[d,f]=xe(t),[g,c]=xe(t),[w,b]=xe(!1),s=hi(null),{isTheaterMode:m}=re();return pi(()=>{let h=-1;return b(!0),t?(f(!0),h=window.setTimeout(()=>{b(!1),c(!0)},k)):(c(!1),h=window.setTimeout(()=>{b(!1),f(!1)},k-we)),()=>{window.clearTimeout(h)}},[t]),e.jsxs(di,{isExpanded:d,isTheaterMode:m,children:[a&&e.jsx(e.Fragment,{children:e.jsxs("div",{className:E("relative flex justify-center transition-all",{"h-fit":d,"h-[5.5rem]":!d}),children:[e.jsx(je,{in:g,timeout:k,nodeRef:s,classNames:"fade",unmountOnExit:!0,mountOnEnter:!0,children:e.jsxs("div",{className:"flex w-full flex-col",children:[e.jsx("div",{className:"flex h-fit w-full place-content-center items-center bg-canvas-90",children:e.jsx("div",{className:"relative flex items-center justify-start gap-3 px-2 py-3",ref:s,children:e.jsx("span",{className:"font-style-label-3",children:`${l?.activeTeam?.name} Stats`})})}),e.jsx("div",{className:"relative h-11 px-2 pt-1",children:e.jsx("div",{className:"",children:e.jsx(ni,{teamAActive:l?.activeTeam?.name===o?.teamA?.name,toggleActive:n,teamLogoB:o?.teamA?.uuid?Ae("teams",o?.teamA?.uuid,{format:"auto"}):void 0,teamLogoA:o?.teamB?.uuid?Ae("teams",o?.teamB?.uuid,{format:"auto"}):void 0})})})]})}),e.jsx(mi,{isRotated:t,isTransformed:d,label:"Reveal live stats",onClick:w?void 0:()=>r(!0),reversed:!0,title:"Expand for more live stats"}),e.jsxs(fi,{hidden:d,variant:"label3",children:["MORE",e.jsx("br",{}),"STATS"]})]})}),!d&&i.length>0&&e.jsx(ii,{vetoes:i}),e.jsx(ui,{isExpanded:d,children:e.jsx(q,{children:e.jsx(Ys,{})})})]})}const xi=x.div` background-color: #8f31f5; height: ${Se}px; width: 100%; bottom: 0; border: none; display: flex; justify-content: center; @media (max-width: ${it.tablet}px) { height: ${nt}px; } // Add child class hover for all children &:hover { background-color: ${U.purple}; } `,vi=x.button` background-color: transparent; height: ${Se}px; width: 100%; height: 100%; bottom: 0; border: none; align-items: center; display: flex; justify-content: center; pointer-events: auto; cursor: pointer; &:hover { background-color: ${U.purple}; } @media (max-width: ${it.desktop}px) { text-align: left; padding-left: 1rem; } `,yi=x.div` display: flex; justify-content: flex-end; `,bi=x(Vt)` height: 100%; width: ${ve(16)}; background-color: transparent; padding-right: 1rem; padding-left: 1rem; &:hover { background-color: #8f31f5; } `;function wi({isShowing:a,handleClose:t}){const r=Wt(),i=()=>{r?.openModal("register")};return a?e.jsxs(xi,{children:[e.jsx(vi,{onClick:i,children:e.jsx(mt,{variant:"label3",children:"EXPERIENCE BLAST.TV AT IT'S BEST AS A MEMBER OF THE COMMUNITY!"})}),e.jsx(yi,{children:e.jsx(bi,{icon:"closeCircleFilled",onClick:t,label:"Close"})})]}):null}const ji="3.5rem",Si=x.button` width: ${ji}; height: 1.8rem; border-radius: 0.25rem; background-color: ${a=>a.isLive?"#f23f37":"#3f2938"}; color: ${a=>a.isLive?"#ffffff":"#fffe3e"}; font-family: TT Norms Pro Bold, sans-serif; font-size: 0.75rem; border: ${a=>a.isLive?"0":"1px solid #fffe3e"}; cursor: pointer; font-weight: bold; margin: 0.5rem 0.5rem; flex-shrink: 0; @media screen and (max-width: 390px) { width: 3.5rem; height: 1.75rem; } @media screen and (max-width: 844px) and (orientation: landscape) { width: 3.5rem; height: 1.75rem; } `,ki=({isLive:a,onClick:t})=>{const{triggerCounterRain:r,particlesInit:i}=ut();return e.jsxs(e.Fragment,{children:[e.jsx(Da,{init:i}),e.jsx(Si,{onClick:()=>{r(),t&&t()},isLive:a,children:"LIVE"})]})},{useCallback:Ni}=await S("react"),Ti=a=>Ni(()=>{a&&(a.currentTime=a.seekable.end(0))},[a]),Di=({matchIds:a=[]})=>Gt({queries:a.map(t=>({queryKey:Ea.csEvents(t),queryFn:()=>Aa({matchId:t}),refetchInterval:3e4}))}),{useCallback:te,useMemo:ae,useRef:Ci,useState:F}=await S("react");function Ii(){const{enabled:a}=at("broadcast_use_alternative_video_src"),{currentBroadcast:t,isLoading:r}=ke(),{matches:i}=lt(t?.seriesIds),o=ae(()=>i?.sort((u,T)=>u.timeOfSeries.valueOf()-T.timeOfSeries.valueOf()),[i]),n=ae(()=>o?.filter(u=>Me({series:u})==="live"),[o]),l=ae(()=>o?.filter(u=>Me({series:u})!=="live"),[o]),d=Ma({matchIds:l?.map(u=>u.uuid)}),f=Di({matchIds:n?.map(u=>u.uuid)}),[g,c]=F(void 0),[w,b]=F(void 0),[s,m]=F(void 0),[h,p]=F(!0),[v,$]=F({}),L=ae(()=>[...d.map(u=>u.data).filter(Le),...f.map(u=>u.data).filter(Le)].map(u=>u.map(T=>T.id in v?{...T,isClipProcessed:v[T.id].harvestJobStatus==="SUCCEEDED",isClipDownloadable:v[T.id].isDownloadable}:T)),[v,d,f]),C=Ci(null),j=C.current,M=Qt(j),K=Ti(j),P=da({videoElement:j,streamStartIsoString:g,videoOffset:t?.videoOffset}),[N,A]=F(!1);Xt({video:j,canPlay:N});const[I,z]=F(),[Q,W]=F(),{action:Tt,clearAction:De}=Zt(j,!0),{action:Dt,clearAction:Ce}=Yt(j,{enabled:de}),Ct=te(()=>{De(),Ce()},[De,Ce]),{setPlayed:It}=Ca();ct(()=>{j&&j.currentTime>0&&!j.paused&&It(j.played)},1e3);const{toggleTheaterMode:Ie,isTheaterMode:le}=re(),$t=te(()=>{Ie(),O("Theatre Mode Toggled",{context:"live-player",enabled:!le})},[le,Ie]),Et=te(({nextResolution:u,prevResolution:T,bitrate:R,autoLevelEnabled:G})=>{G||O("Player Quality Changed",{context:"live-player",resolutionNew:u,resolutionOld:T,autoLevelEnabled:G,bitrate:R}),m({height:u,bitrate:R}),p(G)},[]),At=te(()=>{w||b(new Date().toISOString())},[w]);$a(t?.id,{startTime:w,activeQuality:s,selectedQualityHeight:h?void 0:s?.height});let X;a&&t?.videoAlternativeSrc?X=t.videoAlternativeSrc:X=t?.videoSrc;const $e=t?.videoStartTime?`${X}?start=${t.videoStartTime}`:X,{setPictureInPicturePaused:Ee}=La({src:$e});return t===void 0||t.videoSrc===void 0?e.jsx("div",{children:"There's no live stream here"}):r?e.jsx(Jt,{center:!0}):e.jsxs("div",{className:"flex size-full grow flex-col items-stretch overflow-hidden",children:[e.jsxs(ma,{children:[e.jsx("div",{className:"pointer-events-none absolute inset-0 z-10 m-auto flex size-full flex-col items-center justify-center opacity-90",children:e.jsx(ua,{videoIsLoaded:N,animationType:I,animationMap:Q,onComplete:()=>{W(void 0),z(void 0)}})}),e.jsxs(fa,{children:[e.jsx(Ht,{autoPlay:!0,controls:!0,muted:Pe.get().muted,onVolumeChange:()=>{Pe.set({muted:!!C.current?.muted})},showTimeRemaining:!M,src:$e,ref:C,theatreMode:le,onCanPlay:()=>A(!0),onProgramDateTime:u=>{c(u)},onClickTheatreMode:$t,onQualityLevelChange:Et,onPlay:()=>{At(),Ee(!1)},onPause:()=>Ee(!0),logger:Ta}),e.jsx("div",{children:e.jsx(ea,{action:Tt??Dt,onCompleted:Ct})})]})]}),e.jsx(q,{children:e.jsxs("div",{className:"mt-0.5 flex items-center justify-between",children:[e.jsx(pa,{className:"w-[calc(100%-4.5rem)]",isMobile:de,matchEvents:L,onClickMap:u=>{O("Timeline Event Clicked",{context:"timeline",id:u.id,matchId:u.matchId,type:u.eventType}),A(!1),P(u.occurredAt),W(u.eventContent.mapName)},onClickEvent:async u=>{O("Timeline Event Clicked",{context:"timeline",id:u.id,matchId:u.matchId,type:u.eventType,mapNumber:u.mapNumber,manual:u.isManualEvent}),A(!1),P(u.occurredAt),u.eventType==="RAPID"&&u.eventContent.numberOfKills===3&&z("RAPID3"),u.eventType==="RAPID"&&u.eventContent.numberOfKills===4&&z("RAPID4"),u.eventType!=="RAPID"&&u.eventType!=="MATCH_START"&&u.eventType!=="MAP_START"&&u.eventType!=="ROUND_END"&&z(u.eventType);const T=await Ra({eventId:u.id});$(R=>({...R,[`${T.eventId}`]:T}))},onCopyEvent:async u=>{O("Share Button Clicked",{context:"timeline",id:u.id,timelineEventId:u.id,timelineEventType:u.eventType});const T=`${window.location.origin}/clips/${u.id}`,R={url:T,title:"BLAST.tv - Clips",text:"Watch this amazing highlight captured on BLAST.tv"};if(de&&navigator.canShare(R))try{await navigator.share(R)}catch{console.error("Failed to share clip url")}else try{await navigator.clipboard.writeText(T)}catch{console.error("Failed to copy clips link to clipboard")}},onDownloadEvent:async u=>{await Pa(u.id)},onRedditShareEvent:u=>{const R=`https://reddit.com/submit?url=${`${window.location.origin}/clips/${u.id}`}&title=Watch this amazing highlight captured on BLAST.tv`;window.open(R,"_blank")?.focus()}}),e.jsx(ki,{isLive:M,onClick:K})]})})]})}const{useCallback:$i,useEffect:Ei,useState:Ai}=await S("react"),un=()=>{const a=qt(),{isDesktop:t}=ie(),[r,i]=Ai(!a.isAuthenticated),{currentBroadcast:o,isLoading:n}=ke(),l=Ut(),{isTheaterMode:d}=re(),{isMobile:f}=ie(),{triggerConfetti:g}=ut();ta(o,g);const c=$i(()=>{l("/live/end",{replace:!0})},[l]);return Ei(()=>{a.isAuthenticated&&i(!1)},[a.isAuthenticated]),Vs(),!n&&!o&&c(),n?e.jsx(Ba,{}):e.jsx(ns,{children:e.jsxs(Ia,{children:[e.jsxs(Fa,{isTheaterMode:d,ctaBannerHeight:r?f?nt:Se:0,children:[t&&e.jsx(q,{children:e.jsx(gi,{})}),e.jsxs(Oa,{children:[e.jsx(Ii,{}),t&&e.jsx(q,{children:e.jsx(Fs,{})})]}),e.jsx(q,{children:e.jsx(_a,{children:e.jsx(aa,{})})})]}),e.jsx(wi,{handleClose:()=>i(!1),isShowing:r})]})})};export{un as Live,un as default}; //# sourceMappingURL=index-BtfmSeoR.js.map