const e={_data:{},getItem:t=>Object.prototype.hasOwnProperty.call(e._data,t)?e._data[t]:null,setItem:(t,o)=>{e._data[t]=o},removeItem:t=>{Object.prototype.hasOwnProperty.call(e._data,t)&&delete e._data[t]}},t=window.JSON,o=(()=>{try{return window.localStorage}catch(t){return e}})(),i={get(e){let i=o.getItem(e);return/^\{.*\}$/.test(i)&&(i=t.parse(i)),i},set:(e,i)=>(typeof i==typeof{}&&(i=t.stringify(i)),o.setItem(e,i)),remove:e=>o.removeItem(e)},d=Object.assign(((e,t)=>i.set(e,t)),i),s="ui.theme.mode";class n{constructor(e="light"){this.mode=e,this.width=0,this.height=0,this.size="xs",d.get(s)?this.switch(d.get(s)):this.autodetectTheme(),this.setupSizes(document.documentElement.clientWidth,document.documentElement.clientHeight),this.isMobile()&&document.querySelector("body").classList.add("is-mobile"),window.addEventListener("resize",(()=>{this.setupSizes(document.documentElement.clientWidth,document.documentElement.clientHeight)}))}isMobile(){const e=[/Android/i,/webOS/i,/iPhone/i,/iPad/i,/iPod/i,/BlackBerry/i,/Windows Phone/i].some((e=>e.exec(navigator.userAgent))),t=Math.min(document.documentElement.clientWidth,document.documentElement.clientHeight)<=576;return e||t}toggle(){this.switch("dark"===this.mode?"light":"dark")}validateModals(){"undefined"!=typeof document&&setTimeout((()=>{Boolean(document.querySelector("x-overlay-container x-modal.modal-show"))?document.querySelector("body").classList.add("modal-open"):document.querySelector("body").classList.remove("modal-open")}),100)}is(...e){return!!Array.isArray(e)&&e.includes(this.size)}getTheme(){return this.mode}autodetectTheme(){this.switch(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light")}setupSizes(e,t){this.width=e,this.height=t,this.size=this.getSizeByWidth(e),this.isMobile()?document.querySelector("body").classList.add("is-mobile"):document.querySelector("body").classList.remove("is-mobile")}getSizeByWidth(e){return e>=1200?"xl":e>=992?"lg":e>=768?"md":e>=576?"sm":"xs"}switch(e){"dark"==e&&document&&(this.mode=e,document.querySelector("body").classList.add("is-dark-mode"),d.set(s,e)),"light"==e&&document&&(this.mode=e,document.querySelector("body").classList.remove("is-dark-mode"),d.set(s,e))}static create(){const e=new n;return Object.assign((t=>e.switch(t)),{toggle:()=>e.toggle(),validateModals:()=>e.validateModals(),is:(...t)=>e.is(...t),isMobile:()=>e.isMobile(),getTheme:()=>e.getTheme(),autodetectTheme:()=>e.autodetectTheme(),size:e.size})}}const r=n.create(),m=(e,t)=>{var o;return null!==(o=(t||document).querySelector(`[ref="${e}"]`))&&void 0!==o?o:(t||document).querySelector(e)};export{m as Q,d as S,r as T}