var e={7615(e,t,i){i.d(t,{A:()=>n});
/*
 * HSBasePlugin
 * @version: 4.2.0
 * @author: Preline Labs Ltd.
 * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)
 * Copyright 2024 Preline Labs Ltd.
 */
class n{constructor(e,t,i){this.el=e,this.options=t,this.events=i,this.el=e,this.options=t,this.events={}}createCollection(e,t){var i,n;let s=e;if(!Array.isArray(s)&&"undefined"!=typeof window){const e=null===(i=this.constructor)||void 0===i?void 0:i.name,t="string"==typeof e&&e.startsWith("HS")?`$hs${e.slice(2)}Collection`:null;t&&(Array.isArray(window[t])||(window[t]=[]),s=window[t])}Array.isArray(s)&&s.push({id:(null===(n=null==t?void 0:t.el)||void 0===n?void 0:n.id)||s.length+1,element:t})}fireEvent(e,t=null){if(this.events.hasOwnProperty(e))return this.events[e](t)}on(e,t){this.events[e]=t}}},7189(e,t,i){i.d(t,{A:()=>o});var n=i(7615);
/*
 * HSThemeSwitch
 * @version: 4.2.0
 * @author: Preline Labs Ltd.
 * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)
 * Copyright 2024 Preline Labs Ltd.
 */class s extends n.A{constructor(e,t){super(e,t);const i=e.getAttribute("data-hs-theme-switch"),n=i?JSON.parse(i):{},s=Object.assign(Object.assign({},n),t);this.theme=(null==s?void 0:s.theme)||localStorage.getItem("hs_theme")||"default",this.type=(null==s?void 0:s.type)||"change",this.init()}elementChange(e){const t=e.target.checked?"dark":"default";this.setAppearance(t),this.toggleObserveSystemTheme()}elementClick(e){this.setAppearance(e),this.toggleObserveSystemTheme()}init(){this.createCollection(window.$hsThemeSwitchCollection,this),"default"!==this.theme&&this.setAppearance(),"click"===this.type?this.buildSwitchTypeOfClick():this.buildSwitchTypeOfChange()}buildSwitchTypeOfChange(){this.el.checked="dark"===this.theme,this.toggleObserveSystemTheme(),this.onElementChangeListener=e=>this.elementChange(e),this.el.addEventListener("change",this.onElementChangeListener)}buildSwitchTypeOfClick(){const e=this.el.getAttribute("data-hs-theme-click-value");this.toggleObserveSystemTheme(),this.onElementClickListener=()=>this.elementClick(e),this.el.addEventListener("click",this.onElementClickListener)}setResetStyles(){const e=document.createElement("style");return e.innerText="*{transition: unset !important;}",e.setAttribute("data-hs-appearance-onload-styles",""),document.head.appendChild(e),e}addSystemThemeObserver(){s.systemThemeObserver||(s.systemThemeObserver=e=>{var t;null===(t=window.$hsThemeSwitchCollection)||void 0===t||t.forEach(e=>{"auto"===localStorage.getItem("hs_theme")&&e.element.setAppearance("auto",!1)})},window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",s.systemThemeObserver))}removeSystemThemeObserver(){s.systemThemeObserver&&(window.matchMedia("(prefers-color-scheme: dark)").removeEventListener("change",s.systemThemeObserver),s.systemThemeObserver=null)}toggleObserveSystemTheme(){"auto"===localStorage.getItem("hs_theme")?this.addSystemThemeObserver():this.removeSystemThemeObserver()}setAppearance(e=this.theme,t=!0,i=!0){const n=document.querySelector("html"),s=this.setResetStyles();t&&localStorage.setItem("hs_theme",e);let o=e;"default"===o&&(o="light"),"auto"===o&&(o=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),n.classList.remove("light","dark","default","auto"),"auto"===e?n.classList.add("auto",o):n.classList.add(o),setTimeout(()=>s.remove()),i&&window.dispatchEvent(new CustomEvent("on-hs-appearance-change",{detail:e}))}destroy(){"change"===this.type&&this.el.removeEventListener("change",this.onElementChangeListener),"click"===this.type&&this.el.removeEventListener("click",this.onElementClickListener),window.$hsThemeSwitchCollection=window.$hsThemeSwitchCollection.filter(({element:e})=>e.el!==this.el)}static getInstance(e,t){const i=window.$hsThemeSwitchCollection.find(t=>t.element.el===("string"==typeof e?document.querySelector(e):e));return i?t?i:i.element.el:null}static autoInit(){window.$hsThemeSwitchCollection||(window.$hsThemeSwitchCollection=[]),window.$hsThemeSwitchCollection&&(window.$hsThemeSwitchCollection=window.$hsThemeSwitchCollection.filter(({element:e})=>document.contains(e.el))),document.querySelectorAll("[data-hs-theme-switch]:not(.--prevent-on-load-init)").forEach(e=>{window.$hsThemeSwitchCollection.find(t=>{var i;return(null===(i=null==t?void 0:t.element)||void 0===i?void 0:i.el)===e})||new s(e,{type:"change"})}),document.querySelectorAll("[data-hs-theme-click-value]:not(.--prevent-on-load-init)").forEach(e=>{window.$hsThemeSwitchCollection.find(t=>{var i;return(null===(i=null==t?void 0:t.element)||void 0===i?void 0:i.el)===e})||new s(e,{type:"click"})})}}s.systemThemeObserver=null;const o=s}},t={};function i(n){var s=t[n];if(void 0!==s)return s.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,i),o.exports}i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var n=i(7189);window.addEventListener("load",()=>{n.A.autoInit()}),window.$hsThemeSwitchCollection&&window.addEventListener("on-hs-appearance-change",e=>{window.$hsThemeSwitchCollection.forEach(t=>{t.element.el.checked="dark"===e.detail})}),"undefined"!=typeof window&&(window.HSThemeSwitch=n.A);