import{g as i,r as a}from"./api-DZ3cXm1m.js";document.addEventListener("DOMContentLoaded",function(){const t=window.themeConfig;t&&document.querySelectorAll(".activate-theme-btn").forEach(n=>{n.addEventListener("click",async function(){const r=this.dataset.theme;if(await window.showConfirm(t.translations.confirm))try{const e=await fetch(t.routes.activate,{method:"POST",headers:{Authorization:`Bearer ${i()}`,Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({theme:r})});if(e.status===401&&await a()){this.click();return}const o=await e.json();o.success?(typeof toastr<"u"&&toastr.success(t.translations.activated),setTimeout(()=>window.location.reload(),1e3)):typeof toastr<"u"&&toastr.error(o.message||t.translations.error)}catch(e){console.error("Theme activation error:",e),typeof toastr<"u"&&toastr.error(t.translations.error)}})})});
