"use strict";(()=>{var e={};e.id=8674,e.ids=[8674],e.modules={20399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},30517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},27905:(e,t,a)=>{a.r(t),a.d(t,{originalPathname:()=>k,patchFetch:()=>b,requestAsyncStorage:()=>x,routeModule:()=>f,serverHooks:()=>w,staticGenerationAsyncStorage:()=>g});var r={};a.r(r),a.d(r,{GET:()=>h});var s=a(49303),o=a(88716),i=a(60670),n=a(87070);let p=process.env.API_FOOTBALL_KEY||"",u="https://api-football-v1.p.rapidapi.com/v3",d=new Map;async function c(e,t,a=5){let r=await fetch(`${u}/fixtures/headtohead?h2h=${e}-${t}&last=${a}`,{headers:{"x-rapidapi-host":"api-football-v1.p.rapidapi.com","x-rapidapi-key":p}});if(!r.ok)throw Error("Failed to fetch H2H data");return(await r.json()).response||[]}async function l(e,t){let a=await fetch(`${u}/players/topscorers?league=${e}&season=${t}`,{headers:{"x-rapidapi-host":"api-football-v1.p.rapidapi.com","x-rapidapi-key":p}});if(!a.ok)throw Error("Failed to fetch top scorers");return((await a.json()).response||[]).slice(0,5)}async function m(e,t,a){let r=await fetch(`${u}/teams/statistics?team=${e}&league=${t}&season=${a}`,{headers:{"x-rapidapi-host":"api-football-v1.p.rapidapi.com","x-rapidapi-key":p}});if(!r.ok)throw Error("Failed to fetch team stats");return(await r.json()).response||null}async function h(e){try{let{searchParams:t}=new URL(e.url),a=t.get("matchId"),r=t.get("homeTeamId"),s=t.get("awayTeamId"),o=t.get("leagueId"),i=t.get("season");if(!a||!r||!s||!o||!i)return n.NextResponse.json({sukses:!1,pesan:"Parameter tidak lengkap"},{status:400});let p=d.get(a);if(p&&Date.now()-p.waktu<864e5)return n.NextResponse.json({sukses:!0,data:p.data,dariCache:!0});let[u,h,f,x]=await Promise.all([c(Number(r),Number(s)),l(Number(o),Number(i)),m(Number(r),Number(o),Number(i)),m(Number(s),Number(o),Number(i))]),g={h2h:u,topScorers:h,teamStats:{home:f,away:x}};return d.set(a,{data:g,waktu:Date.now()}),n.NextResponse.json({sukses:!0,data:g,dariCache:!1})}catch(e){return console.error("Match stats error:",e),n.NextResponse.json({sukses:!1,pesan:"Gagal mengambil statistik pertandingan"},{status:500})}}let f=new s.AppRouteRouteModule({definition:{kind:o.x.APP_ROUTE,page:"/api/match-stats/route",pathname:"/api/match-stats",filename:"route",bundlePath:"app/api/match-stats/route"},resolvedPagePath:"C:\\xampp\\htdocs\\Bolafest\\app\\api\\match-stats\\route.ts",nextConfigOutput:"standalone",userland:r}),{requestAsyncStorage:x,staticGenerationAsyncStorage:g,serverHooks:w}=f,k="/api/match-stats/route";function b(){return(0,i.patchFetch)({serverHooks:w,staticGenerationAsyncStorage:g})}}};var t=require("../../../webpack-runtime.js");t.C(e);var a=e=>t(t.s=e),r=t.X(0,[9276,5972],()=>a(27905));module.exports=r})();