import{autorun as e,toJS as t}from"../../../../mobx/dist/mobx.esm.js";import{store as o}from"./haxcms-site-store.js";import{WiredDarkmodeToggle as d}from"../../../app-hax/lib/wired-darkmode-toggle/wired-darkmode-toggle.js";export class HAXCMSDarkmodeToggle extends d{constructor(){super(),e((()=>{this.checked=t(o.darkMode)}))}static get tag(){return"haxcms-darkmode-toggle"}toggle(){this.checked=!this.checked}updated(e){super.updated&&super.updated(e),e.forEach(((e,t)=>{"checked"===t&&void 0!==e&&requestAnimationFrame((()=>{o.darkMode=this[t],o.playSound("click"),this[t]?o.toast("I'm ascared of the dark",2e3,{fire:!0}):o.toast("Sunny day it is",2e3,{hat:"random"})}))}))}}customElements.define(HAXCMSDarkmodeToggle.tag,HAXCMSDarkmodeToggle);