(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const t of document.querySelectorAll('link[rel="modulepreload"]'))s(t);new MutationObserver(t=>{for(const o of t)if(o.type==="childList")for(const c of o.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&s(c)}).observe(document,{childList:!0,subtree:!0});function n(t){const o={};return t.integrity&&(o.integrity=t.integrity),t.referrerPolicy&&(o.referrerPolicy=t.referrerPolicy),t.crossOrigin==="use-credentials"?o.credentials="include":t.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(t){if(t.ep)return;t.ep=!0;const o=n(t);fetch(t.href,o)}})();const i={"sharechess/sharechess":58,"caderek/aocrunner":164,"caderek/gramma":250,"caderek/vv3d":1,"caderek/lichess-speaker":4,"caderek/smol-video":1,"caderek/conway-cubes":2,"caderek/minibtc":11,"caderek/ord":2,"caderek/benny":746,"caderek/arrows":190,"caderek/subit":1};async function d(r){const e=await fetch(`https://api.npmjs.org/downloads/point/last-month/${r}`);if(e.ok)return(await e.json()).downloads}async function l(r){const e=await fetch(`https://api.github.com/repos/${r}`);return e.ok?(await e.json()).stargazers_count:i[r]??1}async function a(r,e){const n=document.querySelectorAll(`[data-${r}]`);for(const s of n){const t=s.dataset[r]??"",o=await e(t);o!==void 0&&(s.innerText=new Intl.NumberFormat("en-US").format(o))}}const u=()=>{var r,e;return(e=(r=window==null?void 0:window.matchMedia)==null?void 0:r.call(window,"(prefers-color-scheme:dark)"))!=null&&e.matches?"dark":"light"};function f(){const r=document.getElementById("mode");r.hidden=!1;const e=localStorage.getItem("mode");(e==="dark"||!e&&u()==="dark")&&document.body.classList.add("dark"),r.addEventListener("click",()=>{document.body.classList.toggle("dark"),localStorage.setItem("mode",document.body.classList.contains("dark")?"dark":"light")})}async function m(){f(),a("npm",d),a("github",l)}m();