import{A as e,B as t,F as n,K as r,N as i,Q as a,X as o,_ as s,f as c,g as l,h as u,m as d,p as f,s as p,x as m,y as h}from"./vendor-vue-D9nMs6_1.js";import{i as g,r as _}from"./backendApi-CRLUmnjv.js";import{n as v,t as y}from"./renderReady-m0ZpQ02H.js";import{a as b,n as x}from"./styleDecoder-BtKxnsm0.js";import{t as S}from"./backendCache-CLgi3wma.js";import{t as C}from"./bestoftype-D9b0yRcs.js";var w=m({__name:`BannedChampionIcon`,props:{champion:{},gameStyle:{}},setup(e){let t=f(()=>e.champion?S.getCacheUrl(e.champion.squareImg):``);return(n,r)=>(i(),s(`div`,{class:`bg-center bg-cover border`,style:a([o(b)(e.gameStyle.layoutStyle),{backgroundImage:e.champion&&e.champion.squareImg?`url('${t.value}')`:void 0,background:!e.champion||!e.champion.squareImg?o(x)(e.gameStyle.background,void 0).background:void 0}])},null,4))}}),T=m({__name:`ChampionRow`,props:{gameStyle:{},data:{default:()=>void 0},length:{default:4}},setup(e){return(t,r)=>(i(),s(`div`,{class:`flex flex-row flex-nowrap`,style:a({gap:e.gameStyle.laneRowLayoutStyle.gapX})},[(i(!0),s(c,null,n(e.length,t=>(i(),u(w,{"game-style":e.gameStyle.laneRowLayoutStyle,key:t,champion:e.data&&e.data.length>=t-1?e.data[t-1]:void 0},null,8,[`game-style`,`champion`]))),128))],4))}}),E={key:0,class:`flex flex-row justify-center items-center`},D=m({__name:`BanTable`,props:{positionIndex:{},gameStyle:{},data:{default:()=>void 0},gameCount:{default:0}},setup(e){let t=f(()=>{switch(e.positionIndex){case 0:return S.getCacheUrl(`/style/common/lane/top-placeholder-cropped.svg`);case 1:return S.getCacheUrl(`/style/common/lane/jgl-placeholder-cropped.svg`);case 2:return S.getCacheUrl(`/style/common/lane/mid-placeholder-cropped.svg`);case 3:return S.getCacheUrl(`/style/common/lane/bot-placeholder-cropped.svg`);case 4:return S.getCacheUrl(`/style/common/lane/sup-placeholder-cropped.svg`);default:return S.getCacheUrl(`/style/common/lane/top-placeholder-cropped.svg`)}}),p=r(2),m=f(()=>p.value*2),h=f(()=>e.gameStyle?Math.ceil((e.gameCount-1)/p.value):0);function g(t,n,r){if(!e.data)return[];let i=[];return Object.values(e.data).forEach(e=>{Object.values(e).forEach(e=>{e[t]&&i.push(e[t])})}),i.slice(n,n+r)}return(r,f)=>e.gameStyle?(i(),s(`div`,E,[d(`div`,{style:a({...o(b)(e.gameStyle.laneIconStyle.layoutStyle)}),class:`w-10 h-10 shrink-0 mr-4 flex items-center justify-center relative`},[d(`div`,{class:`w-full h-full`,style:a({background:o(x)(e.gameStyle.laneIconStyle.fillColor,void 0).background,WebkitMaskImage:`url('${t.value}')`,WebkitMaskRepeat:`no-repeat`,WebkitMaskSize:`cover`,maskImage:`url('${t.value}')`,maskRepeat:`no-repeat`,maskSize:`cover`})},null,4)],4),d(`div`,{class:`flex flex-col`,style:a({gap:e.gameStyle.laneRowLayoutStyle.gapY})},[(i(!0),s(c,null,n(h.value,t=>(i(),u(T,{key:t,"game-style":e.gameStyle,data:g(e.positionIndex,(t-1)*m.value,m.value),length:m.value},null,8,[`game-style`,`data`,`length`]))),128))],4)])):l(``,!0)}}),O=m({__name:`FearlessDraft`,props:{matchId:{}},setup(u){let d=p(),f=u,{style:m}=v(`FearlessDraft`),x=r(void 0),S=r(0),w=r(f.matchId??`current`);function T(){g.get(`/match/${w.value}/fearless/bans`).then(e=>{console.log(e.data),x.value=e.data}).catch(e=>{console.error(`Error fetching current bans:`,e),x.value=void 0})}function E(){return g.get(`/match/${w.value}/bestof`).then(e=>{console.log(e.data),S.value=C[e.data]}).catch(e=>{console.error(`Error fetching max game count:`,e)})}function O(){if(f.matchId!==void 0){w.value=f.matchId;return}if(d.params.matchId){let e=parseInt(d.params.matchId);if(!Number.isNaN(e)){w.value=e;return}}if(d.query.matchId){let e=parseInt(d.query.matchId);if(!Number.isNaN(e)){w.value=e;return}}w.value=`current`}t(()=>f.matchId,e=>{e!==void 0&&(w.value=e,T(),E())}),t(()=>d.params.matchId,e=>{if(f.matchId!==void 0)return;if(!e){w.value=`current`,T(),E();return}let t=parseInt(e);Number.isNaN(t)||w.value!==t&&(w.value=t,T(),E())});let k=_();return t(()=>k.statsVersion,()=>{T(),E()}),e(async()=>{O(),await T(),await E(),x.value&&await y()}),(e,t)=>o(m)?(i(),s(`div`,{key:0,style:a({...o(b)(o(m).container)}),class:`flex items-between flex-wrap justify-center sm:justify-between w-full p-5`},[(i(),s(c,null,n(5,e=>h(D,{"game-style":o(m),key:e,"position-index":e-1,data:x.value,"game-count":S.value},null,8,[`game-style`,`position-index`,`data`,`game-count`])),64))],4)):l(``,!0)}});export{O as default};