function a(s){const t=`; ${document.cookie}`.split(`; ${s}=`);if(t.length===2)return t.pop().split(";").shift()}function n(){return localStorage.getItem("jwt")||a("user")}function l(s){return new Promise(e=>setTimeout(e,s))}function i(s){return window.locale.messages[s]||s}class u extends HTMLElement{constructor(){super(),this.timer=0,this.addEventListener("click",()=>this.hide())}connectedCallback(){let e=sessionStorage.getItem("toast");if(e){let{message:t,icon:o}=JSON.parse(e);this.show(t,o),sessionStorage.removeItem("toast")}}show(e,t){clearTimeout(this.timer),this.hide(),this.innerHTML="",t&&(t=="success"?t="ti ti-square-rounded-check-filled":t=="error"&&(t="ti ti-square-rounded-x-filled"),this.innerHTML=`<i class="text-2xl transition-all delay-100 translate-y-2 rotate-45 opacity-0 group-data-[open]/toast:rotate-0 group-data-[open]/toast:translate-y-0 group-data-[open]/toast:opacity-100 ${t}"></i>`);let o=document.createElement("div");o.innerHTML=i(e),this.appendChild(o),setTimeout(()=>this.dataset.open=!0,100),this.timer=setTimeout(()=>this.hide(),5e3)}hide(){delete this.dataset.open}defer(e,t="success"){sessionStorage.setItem("toast",JSON.stringify({message:e,icon:t}))}success(e){this.show(e,"success")}error(e){this.show(e,"error")}}let r=document.querySelector("toast-message");window.toast=r;export{u as T,i as _,n as a,a as g,l as s,r as t};
