const browserIsDark=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches,sitePreference=document.documentElement.getAttribute("data-default-appearance"),userPreference=localStorage.getItem("appearance");(browserIsDark&&userPreference===null||browserIsDark&&userPreference==="dark"||sitePreference==="dark"&&userPreference===null||sitePreference==="dark"&&userPreference==="dark"||userPreference==="dark")&&document.documentElement.classList.add("dark"),document.documentElement.getAttribute("data-auto-appearance")==="true"&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",a=>{a.matches?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")}),window.addEventListener("DOMContentLoaded",b=>{const a=document.getElementById("appearance-switcher");a&&(a.addEventListener("click",()=>{document.documentElement.classList.toggle("dark"),localStorage.setItem("appearance",document.documentElement.classList.contains("dark")?"dark":"light")}),a.addEventListener("contextmenu",a=>{a.preventDefault(),localStorage.removeItem("appearance")}))})