function e(e){e.store(`ui`,{theme:`light`,init(){let e=document.querySelector(`meta[name="pos-theme-default"]`)?.content||`light`;try{this.theme=localStorage.getItem(`pos_theme`)||e}catch{this.theme=e}this.apply()},set(e){this.theme=e;try{localStorage.setItem(`pos_theme`,e)}catch{}this.apply()},toggle(){this.set(this.theme===`dark`?`light`:`dark`)},apply(){let e=this.theme===`dark`||this.theme===`auto`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches;document.documentElement.classList.toggle(`dark`,e)}})}function t(){document.addEventListener(`submit`,e=>{if(e.defaultPrevented)return;let t=e.target;if(!(t instanceof HTMLFormElement)||t.hasAttribute(`data-no-loader`))return;let n=e.submitter||t.querySelector(`button[type="submit"], button:not([type])`);!n||n.hasAttribute(`data-no-loader`)||(n.textContent||``).trim()!==``&&(typeof n.querySelector==`function`&&n.querySelector(`.animate-spin`)||n.dataset.loading!==`1`&&(n.dataset.loading=`1`,n.classList.add(`is-loading`),n.querySelector(`.pos-btn-spin`)||n.insertAdjacentHTML(`afterbegin`,`<svg class="animate-spin pos-btn-spin h-4 w-4" viewBox="0 0 24 24" fill="none" aria-hidden="true"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"></path></svg>`),setTimeout(()=>{n.disabled=!0},0)))})}export{e as n,t};