import{A as e,B as t,D as n,K as r,N as i,Q as a,R as o,W as s,X as c,Z as l,_ as u,g as d,h as f,m as p,p as m,q as h,x as g}from"./vendor-vue-D9nMs6_1.js";import{i as _}from"./backendApi-CRLUmnjv.js";import{t as v}from"./webSocketStore-DlcpUSTt.js";import{n as y}from"./renderReady-m0ZpQ02H.js";import{t as b}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{t as x}from"./backendCache-CLgi3wma.js";import{t as S}from"./GameAnalysis-qv4X0gG9.js";import{t as C}from"./PlayerAnalysis-CldsYUI5.js";import{t as w}from"./MatchupTable-Brn51W5h.js";import{t as T}from"./CurrentMatchUp-Cfs8qHqX.js";import{t as E}from"./PlayerstatFullScreen-CM_FAYaw.js";import{t as D}from"./FearlessTree-UrykKScc.js";import{t as O}from"./combinedViewTransitionType-l73N141j.js";var k={class:`combined-view-container`},A=[`src`],j=b(g({__name:`CombinedView`,setup(g){let b=v(),{style:j}=y(`PostGameTransition`),M=m(()=>{if(!j.value?.transition)return`fade`;switch(j.value.transition.type){case O.Cut:return`cut`;case O.Stinger:return`stinger`;case O.Fade:default:return`fade`}}),N=m(()=>j.value?.transition?.durationMs??500),P=m(()=>j.value?.transition?.stingerUrl??``),F=m(()=>j.value?.transition?.stingerSwapTimeMs??250),I={"postgame-game":S,"postgame-player":C,"postgame-player-stats":E,"matchup-full":w,"matchup-current":T,"fearless-bans":D},L=r(`A`),R=r(!1),z=h({component:null,playerIndex:void 0,team:void 0,gameId:void 0,matchId:void 0,componentSettings:void 0}),B=h({component:null,playerIndex:void 0,team:void 0,gameId:void 0,matchId:void 0,componentSettings:void 0}),V=r(),H=r(null),U=r(!1),W=r(!1),G=r(null),K,q={A:null,B:null};function J(e){q[e]?.(),q[e]=null}function Y(e,t=3e3){return new Promise(n=>{let r=setTimeout(()=>{q[e]=null,n()},t);q[e]=()=>{clearTimeout(r),n()}})}function X(e,t,n,r,i,a,o){e.component=t?s(t):null,e.playerIndex=n,e.team=r,e.gameId=i,e.matchId=a,e.componentSettings=o}function Z(e){e.component=null,e.playerIndex=void 0,e.team=void 0,e.gameId=void 0,e.matchId=void 0,e.componentSettings=void 0}async function Q(e,t,r,i,a,o){if(e&&!(e in I)){console.warn(`Unknown postgame component key:`,e);return}if(M.value===`cut`){K&&=(clearTimeout(K),void 0);let s=L.value===`A`?z:B;X(L.value===`A`?B:z,e?I[e]:null,t,r,i,a,o);let c=Y(L.value===`A`?`B`:`A`);await n(),await c,R.value=!0,L.value=L.value===`A`?`B`:`A`,V.value=e,Z(s),requestAnimationFrame(()=>{R.value=!1});return}if(M.value===`stinger`&&P.value)G.value={componentName:e,playerIndex:t,team:r,gameId:i,matchId:a,componentSettings:o},U.value=!0,W.value=!1,await n();else{K&&=(clearTimeout(K),void 0);let s=L.value===`A`?z:B;X(L.value===`A`?B:z,e?I[e]:null,t,r,i,a,o),await n(),L.value=L.value===`A`?`B`:`A`,V.value=e,K=setTimeout(()=>{Z(s),K=void 0},N.value+100)}}function $(e){let t=L.value===`A`?B:z,n=L.value===`A`?z:B;X(t,e.componentName?I[e.componentName]:null,e.playerIndex,e.team,e.gameId,e.matchId,e.componentSettings),R.value=!0,L.value=L.value===`A`?`B`:`A`,V.value=e.componentName,Z(n),requestAnimationFrame(()=>{R.value=!1})}function ee(){!H.value||W.value||!G.value||H.value.currentTime*1e3>=F.value&&($(G.value),W.value=!0,G.value=null)}function te(){U.value=!1,W.value=!1}t(()=>b.latestParsedMessage,async e=>{e.type===`active-component-changed`&&await Q(e.componentName,e.playerIndex,e.team,e.gameId,e.matchId,e.componentSettings)});async function ne(){return await _.get(`/postgame/active-component`).then(e=>e.data).catch(e=>{console.error(`Error fetching active component name:`,e)})}return e(async()=>{let e=await ne();e&&e.componentName&&e.componentName in I&&(V.value=e.componentName,X(z,I[V.value],e.playerIndex,e.team,e.gameId,e.matchId,e.componentSettings))}),(e,t)=>(i(),u(`div`,k,[p(`div`,{class:l([`transition-layer`,{active:L.value===`A`,"no-transition":R.value}]),style:a({transitionDuration:N.value+`ms`})},[c(z).component?(i(),f(o(c(z).component),{key:0,playerIndex:c(z).playerIndex,team:c(z).team,gameId:c(z).gameId,matchId:c(z).matchId,componentSettings:c(z).componentSettings,onVnodeMounted:t[0]||=e=>J(`A`)},null,8,[`playerIndex`,`team`,`gameId`,`matchId`,`componentSettings`])):d(``,!0)],6),p(`div`,{class:l([`transition-layer`,{active:L.value===`B`,"no-transition":R.value}]),style:a({transitionDuration:N.value+`ms`})},[c(B).component?(i(),f(o(c(B).component),{key:0,playerIndex:c(B).playerIndex,team:c(B).team,gameId:c(B).gameId,matchId:c(B).matchId,componentSettings:c(B).componentSettings,onVnodeMounted:t[1]||=e=>J(`B`)},null,8,[`playerIndex`,`team`,`gameId`,`matchId`,`componentSettings`])):d(``,!0)],6),U.value&&P.value?(i(),u(`video`,{key:0,ref_key:`stingerVideoRef`,ref:H,src:c(x).getCacheUrl(P.value),class:`stinger-overlay`,autoplay:``,muted:``,onTimeupdate:ee,onEnded:te},null,40,A)):d(``,!0)]))}}),[[`__scopeId`,`data-v-f41f0a90`]]);export{j as default};