const HelixToaster={options:{timeout:5e3,containerId:"hu-toaster-container",prefix:"hu-toaster",position:"hu-toaster-bottom-right",titleClass:"",messageClass:"",target:"body"},toasts:[],toastIndex:0,elementTimeout:null,success(t,e,s){this.createToaster({type:"success",message:t,title:e,options:s})},error(t,e,s){this.createToaster({type:"error",message:t,title:e,options:s})},info(t,e,s){this.createToaster({type:"info",message:t,title:e,options:s})},warning(t,e,s){this.createToaster({type:"warning",message:t,title:e,options:s})},getTypeClass:t=>`hu-toast-${t}`,createContainer(){const t=document.createElement("div");return t.setAttribute("id",this.options.containerId),t.setAttribute("class",this.options.position),document.querySelector(this.options.target).appendChild(t),t},createToaster({type:t,message:e,title:s,options:i}){const o=document.createElement("div");o.setAttribute("class",this.options.prefix+" "+this.getTypeClass(t));let a=`\n\t\t\t<div class="hu-toaster-info-icon"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-info-circle" viewBox="0 0 20 20"><path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/><path d="M8.93 6.588l-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"/></svg></div>\n\t\t\t<div class="hu-toaster-wrap">\n\t\t\t\t<div class="${`${this.options.prefix}-title ${this.options.titleClass}`}">${s}</div>\n\t\t\t\t<div class="${`${this.options.prefix}-message ${this.options.messageClass}`}">${e}</div>\n\t\t\t</div>\n\t\t\t<div class="hu-toaster-close"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-x" viewBox="0 0 16 16"><path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"/></svg></div>\n\n\t\t`;o.innerHTML=a,o.style.animationName="huFadeInUp",o.style.animationDuration=".35s",this.toasts.push(o),this.toastIndex++,this.getContainer().appendChild(o),this.elementTimeout=setTimeout((()=>{o.style.animationName="huFadeInDown",o.style.animationDuration=".35s",o.style.opacity=0,setTimeout((()=>{o.parentNode.removeChild(o)}),450)}),this.options.timeout),o.addEventListener("click",(t=>{t.preventDefault(),this.elementTimeout&&clearTimeout(this.elementTimeout),o.style.animationName="huFadeInDown",o.style.animationDuration=".35s",o.style.opacity=0,setTimeout((()=>{o.parentNode.removeChild(o)}),450)}))},getContainer(){let t=document.querySelector(`#${this.options.containerId}`);return t||(t=this.createContainer()),t},displayToaster(){const t=this.getContainer();t.innerHTML="",this.toasts.forEach((e=>{t.appendChild(e)}))},delay:(t=1e3)=>new Promise((e=>setTimeout(e,t))),removeToaster(t){return new Promise((e=>{this.toasts.splice(t,1);const s=document.querySelector(`#${this.options.containerId}`);s.firstChild&&s.removeChild(s.firstChild),e({status:!0})}))}};Joomla.HelixToaster=HelixToaster;