/*!
 * KoliBri - The accessible HTML-Standard
 */
import{s as setCustomTagNames,K as KolToastContainerTag}from"./component-names-61247f2f.js";import{_}from"./index-0489af72.js";import{i as initI18n,c as configI18n}from"./i18n-fddf0324.js";let initialized=!1;const bootstrap=async(t,e,n)=>{var i,o,a;await initI18n(null===(i=null==n?void 0:n.translation)||void 0===i?void 0:i.name),await configI18n(null!==(a=null===(o=null==n?void 0:n.translation)||void 0===o?void 0:o.name)&&void 0!==a?a:"de",null==n?void 0:n.translations),(null==n?void 0:n.transformTagName)&&setCustomTagNames(null==n?void 0:n.transformTagName);const s=await _(t,e,n);return initialized=!0,s},register=bootstrap,isInitialized=()=>initialized;class ToasterService{constructor(t,e){this.document=t,this.options=e,console.log("create",KolToastContainerTag),console.trace(),this.toastContainerElement=this.document.createElement(KolToastContainerTag),this.document.body.prepend(this.toastContainerElement)}static getInstance(t,e){if(!isInitialized())throw new Error("Toaster: Call KoliBri bootstrap/register method first.");let n=this.instances.get(t);return n||(n=new ToasterService(t,e),this.instances.set(t,n)),n}dispose(){const t=this.toastContainerElement;t?(this.toastContainerElement=void 0,t.remove()):console.warn("Toaster service is already disposed.")}enqueue(t){var e,n;if(this.toastContainerElement&&"function"==typeof this.toastContainerElement.enqueue)return!t.alertVariant&&(null===(e=this.options)||void 0===e?void 0:e.defaultAlertVariant)&&(t.alertVariant=null===(n=this.options)||void 0===n?void 0:n.defaultAlertVariant),this.toastContainerElement.enqueue(t)}closeAll(){this.toastContainerElement&&"function"==typeof this.toastContainerElement.closeAll&&this.toastContainerElement.closeAll()}}ToasterService.instances=new Map;export{ToasterService as T,bootstrap as b,register as r};