const sitePreference=document.documentElement.getAttribute("data-default-appearance"),userPreference=localStorage.getItem("appearance");function getCSSValue(e){var t=window.getComputedStyle(document.documentElement).getPropertyValue(e);return"rgb("+t.replace(/\s+/g,"")+")"}function setThemeColor(){var e=document.querySelector("meta[name=theme-color]");return document.documentElement.classList.contains("dark")?e.setAttribute("content",getCSSValue("--color-neutral-800")):e.setAttribute("content",getCSSValue("--color-neutral")),!0}(sitePreference==="dark"&&userPreference===null||userPreference==="dark")&&(document.documentElement.classList.add("dark"),setThemeColor()),document.documentElement.getAttribute("data-auto-appearance")==="true"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches&&userPreference!=="light"&&(document.documentElement.classList.add("dark"),setThemeColor()),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",e=>{e.matches?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark"),setThemeColor()})),window.addEventListener("DOMContentLoaded",e=>{const t=document.getElementById("appearance-switcher");t&&(t.addEventListener("click",()=>{document.documentElement.classList.toggle("dark"),setThemeColor(),localStorage.setItem("appearance",document.documentElement.classList.contains("dark")?"dark":"light")}),t.addEventListener("contextmenu",e=>{e.preventDefault(),localStorage.removeItem("appearance")}))})