const routes={"/":()=>window.renderHomePage,"/r6data-game":()=>window.renderR6DataGamePage,"/maps":()=>window.renderMapsPage,"/operators":()=>window.renderOperatorsPage,"/ranks":()=>window.renderRanksPage,"/seasons":()=>window.renderSeasonsPage,"/status":()=>window.renderServiceStatusPage,"/attachments":()=>window.renderAttachmentsPage,"/charms":()=>window.renderCharmsPage,"/weapons":()=>window.renderWeaponsPage,"/gadgets":()=>window.renderGadgetsPage,"/skins":()=>window.renderUniversalSkinsPage,"/search":()=>window.renderSearchPage,"/stats":()=>window.renderStatsPage,"/bans":()=>window.renderBansPage,"/streaming-widget":()=>window.renderStreamingWidgetPage,"/discord":()=>window.renderDiscordPage,"/team-builder":()=>window.renderTeamBuilderPage,"/contact":()=>window.renderContactPage},HARD_REDIRECTS={"/login":"/login.html","/register":"/register.html","/dashboard":"/dashboard.html","/api-docs":"/api-docs.html","/r6-streaming-widget":"/r6-streaming-widget.html","/r6-data-js":"/r6-data-js.html","/game-summary":"/game-summary.html"};function initRouter(){handleRouteChange(),window.addEventListener("popstate",handleRouteChange),document.addEventListener("click",e=>{const t=e.target.closest("a");if(t&&t.getAttribute("href")&&!t.getAttribute("href").startsWith("http")&&!t.getAttribute("href").startsWith("data:")&&!t.getAttribute("href").startsWith("blob:")){if("_blank"===t.getAttribute("target"))return;const n=t.getAttribute("href");if(n.startsWith("/operators/")&&"/operators"!==n)return void(window.location.href=n);if(n.startsWith("/support"))return void(window.location.href=n);if(n.endsWith(".html"))return window.location.pathname===n||window.location.pathname==="/"+n?void window.location.reload():void(window.location.href=n);if("true"===t.getAttribute("data-no-router"))return;e.preventDefault(),navigateTo(t.getAttribute("href"))}})}function handleRouteChange(){const e=window.location.pathname;if(HARD_REDIRECTS[e])return void window.location.replace(HARD_REDIRECTS[e]);if(e.endsWith(".html"))return void window.location.replace(e);const t=(window.location.search||"").toLowerCase();if(t){if(t.includes("login")||t.includes("page=login"))return void window.location.replace("/login.html");if(t.includes("register")||t.includes("page=register"))return void window.location.replace("/register.html");if(t.includes("dashboard")||t.includes("page=dashboard")||t.includes("user"))return void window.location.replace("/dashboard.html");if(t.includes("api-docs")||t.includes("page=api-docs"))return void window.location.replace("/api-docs.html")}const n=(routes[e]||routes["/"])();if("function"==typeof n){const e=document.getElementById("content")||document.getElementById("main-content");e&&(e.innerHTML="",n(e))}else console.warn(`Render function not found for route: ${e}`);updateActiveLinks(e),window.scrollTo({top:0,behavior:"smooth"})}function navigateTo(e){"string"==typeof e&&(!(e=e.trim())||e.startsWith("/")||e.startsWith("?")||e.startsWith("#")||(e="/"+e)),history.pushState(null,null,e),handleRouteChange()}function updateActiveLinks(e){document.querySelectorAll(".navbar-link, .mobile-menu-item").forEach(e=>{e.classList.remove("active")}),document.querySelectorAll(`.navbar-link[href="proxy.php?url=https%3A%2F%2Fr6data.eu%2F%24%7Be%7D"], .mobile-menu-item[href="proxy.php?url=https%3A%2F%2Fr6data.eu%2F%24%7Be%7D"]`).forEach(e=>{e.classList.add("active")})}