window.theme=(()=>{const e=localStorage.getItem("theme");if(e&&("dark"===e||"light"===e))return e;const t=window.matchMedia("(prefers-color-scheme: dark)").matches;return t?"dark":"light"})(),document.documentElement.setAttribute("data-theme",window.theme),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",({matches:e})=>{window.theme=e?"dark":"light",localStorage.setItem("theme",window.theme),document.documentElement.setAttribute("data-theme",window.theme)});