window.addEventListener("DOMContentLoaded",(()=>{const e=localStorage.getItem("sppbActiveColorMode"),t=document.querySelector(".sppb-color-switcher-modes"),o=document.querySelector(".sppb-color-switcher-toggle"),s=document.querySelector(".sppb-color-switcher-colors"),r=document.querySelector(`.sppb-color-switcher-color[data-mode="${e}"]`),l=(s?.scrollHeight||0)+32;r&&r.classList.add("sppb-switcher-active"),s&&(s.style.height=l+"px",s.parentElement.style.height=l+"px",s.parentElement.style.paddingTop="25px",s.parentElement.style.paddingBottom="2px"),o?.addEventListener("click",(()=>{if(s){const e="0px"!==s.parentElement.style.height;s.parentElement.style.height=e?"0px":l+"px",s.parentElement.style.paddingTop=e?"0px":"25px",s.parentElement.style.paddingBottom=e?"0px":"2px",t.classList.toggle("expanded",!e)}})),s?.addEventListener("click",(e=>{const t=e.target.closest(".sppb-color-switcher-color");if(t){const e=document.querySelectorAll(".sppb-color-switcher-color"),o=t.dataset.mode;document?.body?.setAttribute("data-sppb-color-mode",o),e.forEach((e=>{e.classList.remove("sppb-switcher-active")})),t.classList.add("sppb-switcher-active"),localStorage.setItem("sppbActiveColorMode",o);const s="--sppb";if(window.sppbColorVariables){const e="string"==typeof window.sppbColorVariables?JSON.parse(window.sppbColorVariables):window.sppbColorVariables;for(const t of e){const{path:e,value:r}=t,l=`${s}-${String(e[0]).trim().toLowerCase().replaceAll(" ","-")}`;o===e[1]&&document.documentElement.style.setProperty(l,r)}}}}))}));