customizable-toast-notification 3.11.1 → 3.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [3.11.2](https://github.com/sammy-cool/customizable-toast-notification/compare/v3.11.1...v3.11.2) (2026-08-12)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * improve package builds and release verification ([84d3150](https://github.com/sammy-cool/customizable-toast-notification/commit/84d3150fa258bb77005001c467702ea10dc954cf))
7
+
1
8
  ## [3.11.1](https://github.com/sammy-cool/customizable-toast-notification/compare/v3.11.0...v3.11.1) (2026-08-12)
2
9
 
3
10
 
package/dist/index.cjs ADDED
@@ -0,0 +1,16 @@
1
+ /*!
2
+ * Customizable Toast Notifications 3.11.1
3
+ * Build: 2026-08-12 21:55:37
4
+ * Cache-Buster: 1786571737019
5
+ * Author: Priyanshu Patel
6
+ * Email: priyanshu.alt191@gmail.com
7
+ * License: Apache-2.0
8
+ * Dependencies: None
9
+ * Created: July 31, 2024
10
+ * A lightweight and fully customizable toast notification library
11
+ * designed for seamless integration with any JavaScript or framework-based UI.
12
+ * Supports flexible positioning, theming, icons, animations, and timing options
13
+ * out of the box — with CTA support and zero dependencies.
14
+ */
15
+ "use strict";async function t(t,e){const n=document.createElement(t);return n.id=function(t){return`${t}-${Date.now().toString(36)}-${Math.floor(1048575*Math.random()).toString(36)}`}(e),n}const e=new class{constructor(t=200){this.maxSize=t,this.map=new Map}get(t){if(!this.map.has(t))return;const e=this.map.get(t);return this.map.delete(t),this.map.set(t,e),e}set(t,e){if(this.map.has(t))this.map.delete(t);else if(this.map.size>=this.maxSize){const t=this.map.keys().next().value;this.map.delete(t)}this.map.set(t,e)}}(200),n={};function o(t,o=1){if(!t)return"snow";const i=`${t}|${o}`,r=e.get(i);if(r)return r;if(n[null==t?void 0:t.toLowerCase()]){const o=n[t.toLowerCase()];return e.set(i,o),o}let a,s,l;try{const e=null==t?void 0:t.match(/^#([0-9a-f]{3,8})$/i);if(e){let t=e[1];3===t.length&&(t=t.split("").map(t=>t+t).join("")),a=parseInt(t.slice(0,2),16),s=parseInt(t.slice(2,4),16),l=parseInt(t.slice(4,6),16)}else{const e=null==t?void 0:t.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*[\d.]+)?\)/i);if(!e)throw new Error("Unknown color");a=Number(e[1]),s=Number(e[2]),l=Number(e[3])}}catch{a=50+Math.floor(206*Math.random()),s=50+Math.floor(206*Math.random()),l=50+Math.floor(206*Math.random())}a=Math.round(a*o+255*(1-o)),s=Math.round(s*o+255*(1-o)),l=Math.round(l*o+255*(1-o));const c=(t,e,n)=>{const o=[t,e,n].map(t=>(t/=255)<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4));return.2126*o[0]+.7152*o[1]+.0722*o[2]},u=(t,e)=>{const n=c(...t),o=c(...e);return(Math.max(n,o)+.05)/(Math.min(n,o)+.05)};let[d,m,p]=((t,e,n)=>{t/=255,e/=255,n/=255;const o=Math.max(t,e,n),i=Math.min(t,e,n);let r,a,s=(o+i)/2;if(o===i)r=a=0;else{const l=o-i;switch(a=s>.5?l/(2-o-i):l/(o+i),o){case t:r=(e-n)/l+(e<n?6:0);break;case e:r=(n-t)/l+2;break;case n:r=(t-e)/l+4}r/=6}return[360*r,a,s]})(a,s,l);let h=p<.5?Math.min(p+.5,1):Math.max(p-.5,0),[f,y,g]=((t,e,n)=>{let o,i,r;if(t/=360,0===e)o=i=r=n;else{const a=(t,e,n)=>(n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t),s=n<.5?n*(1+e):n+e-n*e,l=2*n-s;o=a(l,s,t+1/3),i=a(l,s,t),r=a(l,s,t-1/3)}return[Math.round(255*o),Math.round(255*i),Math.round(255*r)]})(d,m,h);if(u([a,s,l],[f,y,g])<4.5){const t=u([a,s,l],[0,0,0]),e=u([a,s,l],[255,255,255]);[f,y,g]=t>=e?[0,0,0]:[255,255,255]}const b=((t,e,n)=>`#${t.toString(16).padStart(2,"0")}${e.toString(16).padStart(2,"0")}${n.toString(16).padStart(2,"0")}`)(f,y,g);return e.set(i,b),b}function i(t){if(!t||"string"!=typeof t)return"";let e=t.replace(/<\/?(script|iframe|object|embed|link|meta|style|form|input|button)[^>]*>/gi,"");e=e.replace(/\s(on\w+)\s*=\s*(['"])[\s\S]*?\2/gi,""),e=e.replace(/(href|src)\s*=\s*(['"])\s*javascript:[^'"]*\2/gi,"$1=$2#$2");const n=document.createElement("div");n.innerHTML=e;const o=new Set(["DIV","SPAN","P","BR","STRONG","B","EM","I","U","SMALL","UL","OL","LI","A","IMG","PRE","CODE","MARK"]),i=new Set(["href","src","alt","title","class","target","rel"]);function r(t){if(t.nodeType===Node.TEXT_NODE)return document.createTextNode(t.nodeValue);if(t.nodeType!==Node.ELEMENT_NODE)return null;const e=t.tagName.toUpperCase();if(!o.has(e)){const e=document.createDocumentFragment();return Array.from(t.childNodes).forEach(t=>{const n=r(t);n&&e.appendChild(n)}),e}const n=document.createElement(t.tagName);return Array.from(t.attributes||[]).forEach(e=>{const o=e.name.toLowerCase(),r=e.value;i.has(o)&&("href"!==o&&"src"!==o||!/^\s*javascript:/i.test(r))&&("src"!==o||/^\s*(https?:|data:image\/)/i.test(r))&&("target"===o&&"_blank"===r&&n.setAttribute("rel",(t.getAttribute("rel")||"")+" noopener noreferrer"),n.setAttribute(o,r))}),Array.from(t.childNodes).forEach(t=>{const e=r(t);e&&n.appendChild(e)}),n}const a=document.createDocumentFragment();Array.from(n.childNodes).forEach(t=>{const e=r(t);e&&a.appendChild(e)});const s=document.createElement("div");return s.appendChild(a),s.innerHTML}function r(t,e={}){if(!t)return"";try{if(!e.forceFallback&&function(){try{if("undefined"!=typeof window&&window.DOMPurify)return!0}catch(t){}return!1}())return window.DOMPurify.sanitize(t,{ADD_ATTR:["target"],ALLOWED_URI_REGEXP:/^(?:(?:https?|mailto|ftp|tel|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i})}catch(t){}return i(t)}async function a(t,e,n){const o=await async function(t){if("number"==typeof t&&t>0)return t;if("string"==typeof t){if(t.endsWith("s")&&!t.endsWith("ms")){const e=1e3*parseFloat(t);return e>0?e:500}const e=parseFloat(t);return e>0?e:500}return 500}(null==e?void 0:e.animationDuration);t.className=`toast toast-${(null==e?void 0:e.type)??"info"}`,Object.assign(t.style,{background:null==e?void 0:e.backgroundColor,padding:"12px 16px",marginBottom:"10px",borderRadius:null==e?void 0:e.borderRadius,overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"space-between",boxShadow:"0 4px 6px rgba(0, 0, 0, 0.1)",minWidth:"250px",maxWidth:null==e?void 0:e.maxWidth,opacity:"0",position:"relative",cursor:"default",boxSizing:"border-box",userSelect:"text",transition:`opacity ${null==e?void 0:e.animationDuration} ${null==e?void 0:e.animationEasing}, transform ${null==e?void 0:e.animationDuration} ${null==e?void 0:e.animationEasing}`,transform:"translateY(20px)",zIndex:"9999"}),t.setAttribute("role","alert"),t.setAttribute("aria-live","polite"),t.tabIndex=0,t._animationDuration=o;const i=document.createElement("span");null!=e&&e.wrapText?Object.assign(i.style,{display:"block",whiteSpace:"normal"}):Object.assign(i.style,{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:"3",whiteSpace:"nowrap"}),Object.assign(i.style,{flex:"1",padding:null==e?void 0:e.fontPadding,fontFamily:null==e?void 0:e.fontFamily,fontSize:null==e?void 0:e.fontSize,fontWeight:null==e?void 0:e.fontWeight,lineHeight:null==e?void 0:e.fontLineHeight,color:null==e?void 0:e.textColor,userSelect:"text",wordBreak:"break-word",overflow:"hidden",textOverflow:"ellipsis"});const a=!!e.allowHtml,s=e.message??"";if(e.loader||e.showLoader){const t=function(t={}){const e=t.size||14,n=t.color||"currentColor",o=t.text||"",i=document.createElement("span");i.className="toast-loader",i.style.display="inline-flex",i.style.alignItems="center",i.style.gap="8px";const r="http://www.w3.org/2000/svg",a=document.createElementNS(r,"svg");a.setAttribute("width",String(e)),a.setAttribute("height",String(e)),a.setAttribute("viewBox","0 0 50 50"),a.setAttribute("aria-hidden","true");const s=document.createElementNS(r,"circle");if(s.setAttribute("cx","25"),s.setAttribute("cy","25"),s.setAttribute("r","20"),s.setAttribute("fill","none"),s.setAttribute("stroke",n),s.setAttribute("stroke-width","4"),s.setAttribute("stroke-linecap","round"),s.style.opacity="0.85",s.style.strokeDasharray="90",s.style.strokeDashoffset="60",s.style.transformOrigin="center",s.style.animation="toast-spinner 1s linear infinite",a.appendChild(s),i.appendChild(a),o){const t=document.createElement("span");t.style.fontSize="13px",t.textContent=o,i.appendChild(t)}if(!document.getElementById("toast-spinner-styles")){const t=document.createElement("style");t.id="toast-spinner-styles",t.innerHTML="@keyframes toast-spinner { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }",document.head.appendChild(t)}return i}(e.loader||{});i.appendChild(t);const n=document.createElement("span");n.style.display="inline-block",n.style.width="8px",i.appendChild(n)}if(a&&"string"==typeof s&&s.trim().length>0)try{const t=r(s),e=document.createElement("div");for(e.innerHTML=t;e.firstChild;)i.appendChild(e.firstChild)}catch(t){i.textContent=s}else i.textContent=String(s);i.setAttribute("aria-label","Toast Notification Center"),i.setAttribute("title","string"==typeof s?s.replace(/<[^>]+>/g,""):String(s)),t.appendChild(i),null!=e&&e.cta&&0!==Object.keys(e.cta).length&&function(t,e,n){const o=null==e?void 0:e.cta;if(!o)return;o.label||(o.label="CTA Label Missing!");const i=!!o.href&&"link"===o.variant,r=document.createElement(i?"a":"button");i?(r.href=o.href,o.target&&(r.target=o.target),r.rel=o.rel||("_blank"===o.target?"noopener noreferrer":"")):r.type="button",r.setAttribute("aria-label",o.ariaLabel||o.label),Object.assign(r.style,{marginLeft:"10px",padding:"6px 10px",borderRadius:"6px",fontSize:"12px",fontWeight:"600",lineHeight:"1",border:"1px solid rgba(255,255,255,0.35)",color:e.textColor||"#fff",background:"rgba(255,255,255,0.15)",cursor:"pointer",whiteSpace:"nowrap",flexShrink:"0"}),r.textContent=o.label;const a=async e=>{try{if("function"==typeof o.onClick){const t=o.onClick(e);null!=t&&t.then&&await t}}finally{!1!==o.autoClose&&n(t)}};r.addEventListener("click",a),r._cleanup=()=>r.removeEventListener("click",a),t.appendChild(r)}(t,e,n),null!=e&&e.showCloseButton&&function(t,e,n){const o=document.createElement("button");o.setAttribute("aria-label","Close notification"),o.setAttribute("title","Close"),o.textContent="×",Object.assign(o.style,{background:"none",border:"none",color:e.textColor||"white",fontSize:"18px",marginLeft:"10px",cursor:"pointer"});const i=()=>n(t);o.addEventListener("click",i),t._cleanupCloseButton=()=>{o.removeEventListener("click",i)},t.appendChild(o)}(t,e,n),null!=e&&e.showProgressBar&&function(t,e){const n=document.createElement("div"),o=e.borderRadius||0,i=parseInt(o,10),r=i?"12px":"0",a=i?12:0,s=Math.max(i-10,a),l=i?`calc(100% - ${s}px)`:"100%";Object.assign(n.style,{position:"absolute",left:`${r}`,height:e.progressHeight||"4px",background:e.progressColor||"rgba(255, 255, 255, 0.3)",width:`${l}`,transition:`width ${e.duration||1800}ms linear`,["top"===e.progressPosition?"top":"bottom"]:"0",borderRadius:e.borderRadius||"4px"}),t.appendChild(n),"function"==typeof n.animate?t._progressAnimation=n.animate([{width:l},{width:"0%"}],{duration:Number(e.duration)||1800,easing:"linear",fill:"forwards",delay:50}):(n.style.transition=`width ${e.duration||1800}ms linear`,setTimeout(()=>{n.offsetWidth,n.style.width="0%"},50))}(t,e),function(t){setTimeout(()=>{requestAnimationFrame(()=>{t.style.opacity="1",t.style.transform="translateY(0)"})},50)}(t)}async function s(t,e){try{const n=document.createElement("div");Object.assign(n.style,{background:"#333",color:"white",padding:"10px 15px",position:"fixed",top:"20px",right:"20px",zIndex:"99999",borderRadius:"3px",maxWidth:"250px",wordWrap:"break-word",boxShadow:"0 2px 10px rgba(0,0,0,0.3)",cursor:"pointer"});const o=document.createElement("div"),i=document.createElement("span");i.style.display="inline-block",t.allowHtml?i.innerHTML=r(String(t.message||"Emergency Toast Showing!")):i.textContent=String(t.message||"Emergency Toast Creation Showing!"),o.appendChild(i);const a=document.createElement("span");for(a.style.cssText="float: right; margin-left: 10px; font-weight: bold;",a.textContent="×",o.appendChild(a);n.firstChild;)n.removeChild(n.firstChild);return n.appendChild(o),a.onclick=()=>{n.remove(),e(n)},document.body.appendChild(n),setTimeout(()=>{n.remove(),e(n)},null==t?void 0:t.duration),n}catch(n){return setTimeout(()=>{alert((null==t?void 0:t.message)||"Emergency Toast Creation Showing!"),e(null)},100),null}}Object.entries({aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}).forEach(([t,[e,o,i]])=>{const r=t=>{const e=t/255;return e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)},a=.2126*r(e)+.7152*r(o)+.0722*r(i),s=(a+.05)/.05,l=1.05/(a+.05);n[t.toLowerCase()]=s>=l?"#000000":"#ffffff"});const l=new Map,c=new Map;function u(t){return`toast-container-${function(t){return String(t).toLowerCase().trim().replace(/\bbelow\b/g,"bottom").replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"-").replace(/-{2,}/g,"-")}(t)}`}async function d(t,e){const n=u(t.position);if(c.has(n))return c.get(n);const o=(async()=>{const o=l.get(n);if(null!=o&&o.isConnected)return o;let i=document.getElementById(n);i&&!i.isConnected&&document.body.appendChild(i),i?(i.style.position=i.style.position||"fixed",i.style.zIndex=i.style.zIndex||"9999","function"==typeof e&&await e(i,t)):(i=document.createElement("div"),i.id=n,i.setAttribute("role","status"),i.setAttribute("aria-atomic","true"),i.style.position="fixed",i.style.zIndex="9999",i.style.inset="auto 10px 10px auto",i.style.display="flex",i.style.justifyContent="space-between",i.style.alignItems="center",i.style.flexDirection="column",i.style.overflow="hidden","function"==typeof e&&await e(i,t),document.body.appendChild(i));const r=document.querySelectorAll(`#${n}`);if(r.length>1)for(let t=1;t<r.length;t++)try{r[t].remove()}catch{}return l.set(n,i),i})();c.set(n,o);try{return await o}finally{c.delete(u(t.position))}}async function m(t,e){if(!t||!e.position)throw new Error("Invalid container or position!");!function(t){t.style.top="auto",t.style.bottom="auto",t.style.left="auto",t.style.right="auto",t.style.transform="none"}(t);const n=function(t){const e=t.toLowerCase().trim();return{hasTop:e.includes("top"),hasBottom:e.includes("bottom")||e.includes("below"),hasLeft:e.includes("left"),hasRight:e.includes("right"),hasCenter:e.includes("center"),hasFullWidth:e.includes("top-full-width")||e.includes("bottom-full-width")||e.includes("fullwidth")}}(e.position);(function(t,e,n){if(!n.hasFullWidth)return!1;if(e.maxWidth="100vw",n.hasTop)return t.style.top="10px",t.style.left="10px",t.style.right="10px",!0;if(n.hasBottom)return t.style.bottom="10px",t.style.left="10px",t.style.right="10px",!0;return!1})(t,e,n)||function(t,e){if(!e.hasCenter)return!1;if(e.hasTop&&!e.hasLeft&&!e.hasRight)return t.style.top="10px",t.style.left="50%",t.style.transform="translateX(-50%)",!0;if(e.hasBottom&&!e.hasLeft&&!e.hasRight)return t.style.bottom="10px",t.style.left="50%",t.style.transform="translateX(-50%)",!0;if(e.hasLeft&&!e.hasTop&&!e.hasBottom)return t.style.left="10px",t.style.top="50%",t.style.transform="translateY(-50%)",!0;if(e.hasRight&&!e.hasTop&&!e.hasBottom)return t.style.right="10px",t.style.top="50%",t.style.transform="translateY(-50%)",!0;if(!(e.hasLeft||e.hasRight||e.hasTop||e.hasBottom))return t.style.top="50%",t.style.left="50%",t.style.transform="translate(-50%, -50%)",!0;return!1}(t,n)||function(t,e){e.hasBottom?t.style.bottom="10px":e.hasTop&&(t.style.top="10px");e.hasRight?t.style.right="10px":e.hasLeft?t.style.left="10px":(e.hasBottom||e.hasTop||(t.style.bottom="10px"),t.style.left="50%",t.style.transform="translateX(-50%)")}(t,n)}class p{constructor(t,e){this.callback=t,this.delay=e,this.remaining=e,this.startTime=null,this.timeoutId=null,this.isPaused=!1,this.isCompleted=!1}start(){return this.isCompleted||this.timeoutId||(this.startTime=Date.now(),this.timeoutId=setTimeout(()=>{this.isCompleted=!0,this.timeoutId=null,this.callback()},this.remaining)),this}pause(){return this.isPaused||!this.timeoutId||this.isCompleted||(clearTimeout(this.timeoutId),this.timeoutId=null,this.remaining-=Date.now()-this.startTime,this.remaining=Math.max(0,this.remaining),this.isPaused=!0),this}resume(){return!this.isPaused||this.isCompleted||(this.isPaused=!1,this.start()),this}clear(){return this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null),this.isCompleted=!0,this}getRemainingTime(){return this.isCompleted?0:this.isPaused?this.remaining:this.timeoutId?Math.max(0,this.remaining-(Date.now()-this.startTime)):this.delay}}const h=new Map,f=new Map,y=[];let g=0;async function b(t={}){try{const e=function(t={}){return`${String(t.type).trim().toLowerCase()}|${function(t){let e=5381;for(let n=0;n<t.length;n++)e=(e<<5)+e+t.charCodeAt(n);return e>>>0}(String(t.message||"")).toString(16)}|${String(t.position).trim().toLowerCase()}`}(t);if(h.has(e)){const n=h.get(e);if(!n)throw new Error(`Active toast with key ${e} not found`);return n.count++,n.timer.clear(),n.timer=C(n.toast,t),await k(n),void await A(n)}if(f.has(e)){const t=f.get(e);if(!t)throw new Error(`Pending toast with key ${e} not found`);return void t.count++}const n={options:t,count:1,rafId:0};f.set(e,n),n.rafId=requestAnimationFrame(async()=>{const t=f.get(e);if(t){if(f.delete(e),g>=3)return y.push({options:t.options,key:e,count:t.count}),void await S();try{await w(t.options,e,t.count)}catch(t){}}})}catch(t){}}async function w(e,n,o){try{if(!e||"object"!=typeof e)throw new TypeError("options must be an object");g++;const i=await d(e,m);if(!i)throw new Error("Failed to create toast container");const r=await async function(e,n){if(!document.querySelector('[id^="toast-container-"]'))return null;let o;try{return o=await t("div","toast"),await a(o,e,n),o}catch(t){return o=await s(e,n),o}}(e,E);if(!r)throw new Error("Toast element creation failed");const l=document.createElement("div");Object.assign(l.style,{position:"relative",display:"inline-block",overflow:"visible",marginBottom:"10px",zIndex:"0",width:"100%"});const c=document.createElement("div");Object.assign(c.style,{position:"relative",overflow:"hidden",zIndex:"1"}),c.appendChild(r),l.appendChild(c),i.id.includes("toast-container-")&&i.appendChild(l);const u=!1!==e.pauseOnHover&&(!0===e.pauseOnHover||!!e.cta),p={outer:l,toast:r,count:Math.max(1,Math.floor(o??0)),timeout:null,pauseOnHover:u};h.set(n,p),r._key=n,p.count>1&&await A(p),p.timer=C(r,e),await k(p)}catch(t){g=Math.max(0,g-1);(document.querySelector('[id^="toast-container-"]')||document.body).appendChild(await s(e,E))}}const v=async function(){try{if(0===h.size)return;let t=null;if(document.querySelectorAll('[id^="toast-container-"]').forEach(e=>{const n=Array.from(e.children||[]);if(0===n.length)return;const o=n.at(-1);o&&(t=o.querySelector('[id^="toast-"]')||o)}),!t){const e=Array.from(h.entries());if(e.length>0){const[,n]=e.at(-1);t=n.toast||n.outer&&n.outer.querySelector('[id^="toast-"]')}}if(!t)return;const e=t._key?t:t.querySelector('[id^="toast-"]')||t;await E(e)}catch(t){}},x=async function(){try{const t=Array.from(h.values()).map(t=>t.toast).filter(Boolean);y.length=0,f.clear();for(const e of t)try{await E(e)}catch(t){}}catch(t){}};function C(t,e){const n=Number(e.duration??1800)+5,o=new p(async()=>await E(t),n);return o.start(),o}async function k(t){if(!t.pauseOnHover||!t.outer||!t.timer)return;const{outer:e,timer:n,toast:o}=t,i=()=>{var t;n.pause(),null==o||null===(t=o._progressAnimation)||void 0===t||t.pause()},r=()=>{var t;n.resume(),null==o||null===(t=o._progressAnimation)||void 0===t||t.play()},a=t=>{var e;t.target.matches("[tabindex], div, span, button, a")&&(n.pause(),null==o||null===(e=o._progressAnimation)||void 0===e||e.pause())},s=t=>{var i;e.contains(t.relatedTarget)||(n.resume(),null==o||null===(i=o._progressAnimation)||void 0===i||i.play())};e.addEventListener("mouseenter",i),e.addEventListener("mouseleave",r),e.addEventListener("focusin",a),e.addEventListener("focusout",s),e._pauseCleanup=()=>{e.removeEventListener("mouseenter",i),e.removeEventListener("mouseleave",r),e.removeEventListener("focusin",a),e.removeEventListener("focusout",s)}}async function E(t){try{var e,n,o;if(null==t||!t._key)return;const i=h.get(t._key);if(!i)return;null===(e=i.timer)||void 0===e||e.clear(),null===(n=i.outer)||void 0===n||null===(o=n._pauseCleanup)||void 0===o||o.call(n),h.delete(t._key),g=Math.max(0,g-1);const r=i.outer.querySelector(".toast-count-badge");r&&r.remove(),await async function(t){return t?new Promise(e=>{let n=!1;const o=()=>{n||(n=!0,async function(t){if(!t)return!0;try{var e;if(null!=t&&null!==(e=t.parentNode)&&void 0!==e&&e.id.includes("toast-container-"))return t.parentNode.removeChild(t),!0}catch{}try{if(t.remove)return t.remove(),!0}catch{}try{return Object.assign(t.style,{display:"none",opacity:"0",pointerEvents:"none",position:"absolute",left:"-9999px"}),!0}catch{}}(t),e())},i=t.firstElementChild||t;if(!i)return e();const r=t=>{try{if(t.target!==i)return;i.removeEventListener("transitionend",r,!0),o()}catch(t){}};try{i.addEventListener("transitionend",r,!0)}catch(t){}setTimeout(()=>{try{i.removeEventListener("transitionend",r,!0),o()}catch(t){}},700)}):Promise.resolve()}(i.outer),await S()}catch(t){}}async function S(){for(;g<3&&y.length;){const t=y.shift();if(h.has(t.key)){const e=h.get(t.key);e.count+=t.count,await A(e);continue}w(t.options,t.key,t.count)}}async function A({outer:t,count:e}){if(!(t&&t instanceof HTMLElement))throw new Error("updateBadge: outer must be a valid HTMLElement");if(e<2){const e=t.querySelector(".toast-count-badge");return void(e&&e.remove())}let n=t.querySelector(".toast-count-badge");n||(n=document.createElement("span"),n.className="toast-count-badge",n.setAttribute("aria-label",`${e} identical notifications`),Object.assign(n.style,{position:"absolute",top:"6px",right:"6px",backgroundColor:"#f44336",color:"#fff",borderRadius:"50%",minWidth:"20px",height:"20px",fontSize:"12px",fontWeight:"600",display:"flex",alignItems:"center",justifyContent:"center",border:"2px solid #fff",boxShadow:"0 2px 6px rgba(0,0,0,0.3)",zIndex:"2",pointerEvents:"none",transition:"transform 150ms ease"}),t.appendChild(n)),n.textContent=e>99?"99+":String(e);try{n.style.transform="scale(1.2)",setTimeout(()=>n.style.transform="scale(1)",150)}catch(t){}}let T={success:"#28a745",error:"#dc3545",warning:"#ffc107",info:"#17a2b8"},L={success:"Operation completed successfully!",error:"Something went wrong!",warning:"Warning message!",info:"Information message!"};const M=[];let I=!1;async function O(t={}){try{const e=await async function(t){var e;const n=null==t||null===(e=t.position)||void 0===e||null===(e=e.toLowerCase())||void 0===e?void 0:e.trim(),i=null!=n&&n.includes("top-full-width")||null!=n&&n.includes("bottom-full-width")?"100vw":"400px",r={allowHtml:!1,sanitizeHtml:!0,pauseOnHover:void 0,duration:2500,position:"bottom-right",type:"info",borderRadius:"50px",backgroundColor:void 0,textColor:void 0,showCloseButton:!0,animationDuration:"0.4s",animationType:"fade",animationEasing:"ease",showProgressBar:!0,progressColor:void 0,progressHeight:"4px",progressPosition:"bottom",fontPosition:"relative",fontPadding:void 0,fontBorderRadius:void 0,fontBackgroundColor:void 0,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',fontSize:"14px",fontWeight:"400",fontLineHeight:"1.4",fontDirection:"auto",wrapText:"normal",maxWidth:i,..."object"!=typeof t||Array.isArray(t)?{}:t};r.message=(null==t?void 0:t.message)??r.message;try{var a,s;if(!r.backgroundColor)r.backgroundColor=(null===(s=T)||void 0===s?void 0:s[r.type])??(window.matchMedia("(prefers-color-scheme: dark)").matches?"#f5f5f5":"#111111");if(r.message=r.message||(null===(a=L)||void 0===a?void 0:a[r.type])||"No Message Provided!",!r.textColor&&r.backgroundColor){const t=o(r.backgroundColor);r.textColor=t}if(!r.progressColor&&r.backgroundColor)if(r.textColor)r.progressColor=r.textColor;else{const t=o(r.backgroundColor);r.progressColor=t}}catch(t){}"string"!=typeof r.message&&(r.message="No Message Provided!");return r}(t);await async function(t){try{return await d(t,m)}catch(t){return document.body}}(e),await b(e)}catch(e){const n="string"==typeof(null==t?void 0:t.message)&&null!==(null==t?void 0:t.message)?`${t.message.substring(0,200)} toast creation failed!`:"Toast creation failed!";alert(n)}}function $(t){try{t&&"object"==typeof t&&!Array.isArray(t)&&(T={...T,...t})}catch(t){}}function j(t){try{t&&"object"==typeof t&&!Array.isArray(t)&&(L={...L,...t})}catch(t){}}let z=!1,D=null;const N=async function(t={}){"undefined"!=typeof window&&"undefined"!=typeof document&&(await async function(){I||"undefined"!=typeof window&&"undefined"!=typeof document&&("complete"===document.readyState||"interactive"===document.readyState?(I=!0,M.forEach(t=>setTimeout(()=>O(t),2500)),M.length=0):document.addEventListener("DOMContentLoaded",()=>{I=!0,M.forEach(t=>setTimeout(()=>O(t),2500)),M.length=0},{once:!0}))}(),I?await O(t):M.push(t))};async function B(t={}){return async function(t){if(z&&D)try{await D}catch(t){}return t()}(()=>N(t))}const R=async()=>{z=!0,D=(async()=>{try{await v()}finally{z=!1,D=null}})(),await D},P=async()=>{z=!0,D=(async()=>{try{await x()}finally{z=!1,D=null}})(),await D};if("undefined"!=typeof window&&"undefined"!=typeof document){let t=!1;if(!t){const e=t=>{"Escape"!==t.key&&"Esc"!==t.key||(async()=>{z=!0,D=(async()=>{try{await v()}finally{z=!1,D=null}})(),await D})()};window.addEventListener("keydown",e,{passive:!0}),t=!0}}try{"undefined"!=typeof window&&(window.customizableToast={createToast:B,setDefaultColors:$,setDefaultMessages:j,noop:P,dismiss:R})}catch(t){}exports.createToast=B,exports.dismiss=R,exports.dismissToast=R,exports.noop=P,exports.noopAll=P,exports.setDefaultColors=$,exports.setDefaultMessages=j;
16
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../src/utils/dom.js","../src/utils/id.js","../src/utils/html-sanitizer.js","../src/components/toast-utils.js","../src/components/loader.js","../src/components/toast-utils-core.js","../src/utils/containerRegistry.js","../src/utils/position.js","../src/utils/PausableTimer.js","../src/components/ToastManager.js","../src/components/Toast.js","../src/index.js"],"sourcesContent":["// src/utils/dom.js\n\"use strict\";\n\nimport { generateToastId } from \"./id.js\";\n\n/**\n * Creates an element with a unique ID using the given prefix.\n * @param {string} tagName - Tag name of the element.\n * @param {string} prefix - Prefix for the element ID.\n * @returns {Promise<Element>}\n */\nexport async function createElementWithId(tagName, prefix) {\n if (!tagName || !prefix) throw new Error(\"tagName and prefix are required\");\n const el = document.createElement(tagName);\n el.id = generateToastId(prefix);\n return el;\n}\n\n/**\n * Appends a child element to a parent element with multiple fallbacks.\n * @param {Element} parent - The parent element.\n * @param {Element} child - The child element.\n * @returns {Promise<boolean>}\n */\nexport async function appendChild(parent, child) {\n if (!parent || !child) return false;\n\n try {\n if (!parent.contains(child)) parent.appendChild(child);\n return true;\n } catch (primaryError) {\n console.warn(\"appendChild primary failed:\", primaryError);\n try {\n parent.insertAdjacentElement(\"beforeend\", child);\n return true;\n } catch (fallbackError) {\n console.warn(\"appendChild fallback failed:\", fallbackError);\n try {\n if (parent === document.body) {\n const clone = child.cloneNode(true);\n parent.appendChild(clone);\n return true;\n }\n } catch (emergencyError) {\n console.error(\"appendChild emergency failed:\", emergencyError);\n return false;\n }\n }\n }\n return false;\n}\n\n/**\n * Removes an element from the DOM with multiple methods.\n * @param {Element} el - The element to be removed.\n * @returns {Promise<boolean>}\n */\nexport async function removeElement(el) {\n if (!el) return true;\n\n try {\n if (el?.parentNode?.id.includes(\"toast-container-\")) {\n el.parentNode.removeChild(el);\n return true;\n }\n } catch {}\n\n try {\n if (el.remove) {\n el.remove();\n return true;\n }\n } catch {}\n\n try {\n Object.assign(el.style, {\n display: \"none\",\n opacity: \"0\",\n pointerEvents: \"none\",\n position: \"absolute\",\n left: \"-9999px\",\n });\n return true;\n } catch {}\n\n return false;\n}\n\n/**\n * Parses animation duration from a string or number.\n * @param {string|number} duration - Duration value.\n * @returns {Promise<number>} - Milliseconds.\n */\nexport async function parseAnimationDuration(duration) {\n if (typeof duration === \"number\" && duration > 0) return duration;\n if (typeof duration === \"string\") {\n if (duration.endsWith(\"s\") && !duration.endsWith(\"ms\")) {\n const parsed = parseFloat(duration) * 1000;\n return parsed > 0 ? parsed : 500;\n }\n const parsed = parseFloat(duration);\n return parsed > 0 ? parsed : 500;\n }\n return 500;\n}\n\n/**\n * Forces a reflow on an element.\n * @param {Element} el - The element.\n * @returns {number}\n */\nexport function forceReflow(el) {\n try {\n return el?.offsetWidth || 0;\n } catch (error) {\n console.warn(\"Force reflow failed:\", error);\n return 0;\n }\n}\n\n/**\n * Shortcut for query selection with optional root.\n * @param {string} selector - CSS selector.\n * @param {Element|Document} [root=document] - Root element.\n * @returns {Element|null}\n */\nexport function query(selector, root = document) {\n return root.querySelector(selector);\n}\n\n/**\n * Gets accessible text color based on background according to WCAG.\n * Optimized with caching for repeated background colors.\n *\n * @param {string} toastBg - Background color (hex, rgb, hsl, named).\n * @param {number} [opa=1] - Optional opacity (0–1).\n * @returns {string} - Text color: \"black\" or \"white\".\n */\nclass LRUCache {\n constructor(maxSize = 200) {\n this.maxSize = maxSize;\n this.map = new Map();\n }\n\n get(key) {\n if (!this.map.has(key)) return undefined;\n const value = this.map.get(key);\n this.map.delete(key);\n this.map.set(key, value);\n return value;\n }\n\n set(key, value) {\n if (this.map.has(key)) this.map.delete(key);\n else if (this.map.size >= this.maxSize) {\n const firstKey = this.map.keys().next().value;\n this.map.delete(firstKey);\n }\n this.map.set(key, value);\n }\n}\n\nconst colorCache = new LRUCache(200);\n\n// Full named CSS color table\nconst namedColors = {\n aliceblue: [240, 248, 255],\n antiquewhite: [250, 235, 215],\n aqua: [0, 255, 255],\n aquamarine: [127, 255, 212],\n azure: [240, 255, 255],\n beige: [245, 245, 220],\n bisque: [255, 228, 196],\n black: [0, 0, 0],\n blanchedalmond: [255, 235, 205],\n blue: [0, 0, 255],\n blueviolet: [138, 43, 226],\n brown: [165, 42, 42],\n burlywood: [222, 184, 135],\n cadetblue: [95, 158, 160],\n chartreuse: [127, 255, 0],\n chocolate: [210, 105, 30],\n coral: [255, 127, 80],\n cornflowerblue: [100, 149, 237],\n cornsilk: [255, 248, 220],\n crimson: [220, 20, 60],\n cyan: [0, 255, 255],\n darkblue: [0, 0, 139],\n darkcyan: [0, 139, 139],\n darkgoldenrod: [184, 134, 11],\n darkgray: [169, 169, 169],\n darkgreen: [0, 100, 0],\n darkgrey: [169, 169, 169],\n darkkhaki: [189, 183, 107],\n darkmagenta: [139, 0, 139],\n darkolivegreen: [85, 107, 47],\n darkorange: [255, 140, 0],\n darkorchid: [153, 50, 204],\n darkred: [139, 0, 0],\n darksalmon: [233, 150, 122],\n darkseagreen: [143, 188, 143],\n darkslateblue: [72, 61, 139],\n darkslategray: [47, 79, 79],\n darkslategrey: [47, 79, 79],\n darkturquoise: [0, 206, 209],\n darkviolet: [148, 0, 211],\n deeppink: [255, 20, 147],\n deepskyblue: [0, 191, 255],\n dimgray: [105, 105, 105],\n dimgrey: [105, 105, 105],\n dodgerblue: [30, 144, 255],\n firebrick: [178, 34, 34],\n floralwhite: [255, 250, 240],\n forestgreen: [34, 139, 34],\n fuchsia: [255, 0, 255],\n gainsboro: [220, 220, 220],\n ghostwhite: [248, 248, 255],\n gold: [255, 215, 0],\n goldenrod: [218, 165, 32],\n gray: [128, 128, 128],\n green: [0, 128, 0],\n greenyellow: [173, 255, 47],\n grey: [128, 128, 128],\n honeydew: [240, 255, 240],\n hotpink: [255, 105, 180],\n indianred: [205, 92, 92],\n indigo: [75, 0, 130],\n ivory: [255, 255, 240],\n khaki: [240, 230, 140],\n lavender: [230, 230, 250],\n lavenderblush: [255, 240, 245],\n lawngreen: [124, 252, 0],\n lemonchiffon: [255, 250, 205],\n lightblue: [173, 216, 230],\n lightcoral: [240, 128, 128],\n lightcyan: [224, 255, 255],\n lightgoldenrodyellow: [250, 250, 210],\n lightgray: [211, 211, 211],\n lightgreen: [144, 238, 144],\n lightgrey: [211, 211, 211],\n lightpink: [255, 182, 193],\n lightsalmon: [255, 160, 122],\n lightseagreen: [32, 178, 170],\n lightskyblue: [135, 206, 250],\n lightslategray: [119, 136, 153],\n lightslategrey: [119, 136, 153],\n lightsteelblue: [176, 196, 222],\n lightyellow: [255, 255, 224],\n lime: [0, 255, 0],\n limegreen: [50, 205, 50],\n linen: [250, 240, 230],\n magenta: [255, 0, 255],\n maroon: [128, 0, 0],\n mediumaquamarine: [102, 205, 170],\n mediumblue: [0, 0, 205],\n mediumorchid: [186, 85, 211],\n mediumpurple: [147, 112, 219],\n mediumseagreen: [60, 179, 113],\n mediumslateblue: [123, 104, 238],\n mediumspringgreen: [0, 250, 154],\n mediumturquoise: [72, 209, 204],\n mediumvioletred: [199, 21, 133],\n midnightblue: [25, 25, 112],\n mintcream: [245, 255, 250],\n mistyrose: [255, 228, 225],\n moccasin: [255, 228, 181],\n navajowhite: [255, 222, 173],\n navy: [0, 0, 128],\n oldlace: [253, 245, 230],\n olive: [128, 128, 0],\n olivedrab: [107, 142, 35],\n orange: [255, 165, 0],\n orangered: [255, 69, 0],\n orchid: [218, 112, 214],\n palegoldenrod: [238, 232, 170],\n palegreen: [152, 251, 152],\n paleturquoise: [175, 238, 238],\n palevioletred: [219, 112, 147],\n papayawhip: [255, 239, 213],\n peachpuff: [255, 218, 185],\n peru: [205, 133, 63],\n pink: [255, 192, 203],\n plum: [221, 160, 221],\n powderblue: [176, 224, 230],\n purple: [128, 0, 128],\n rebeccapurple: [102, 51, 153],\n red: [255, 0, 0],\n rosybrown: [188, 143, 143],\n royalblue: [65, 105, 225],\n saddlebrown: [139, 69, 19],\n salmon: [250, 128, 114],\n sandybrown: [244, 164, 96],\n seagreen: [46, 139, 87],\n seashell: [255, 245, 238],\n sienna: [160, 82, 45],\n silver: [192, 192, 192],\n skyblue: [135, 206, 235],\n slateblue: [106, 90, 205],\n slategray: [112, 128, 144],\n slategrey: [112, 128, 144],\n snow: [255, 250, 250],\n springgreen: [0, 255, 127],\n steelblue: [70, 130, 180],\n tan: [210, 180, 140],\n teal: [0, 128, 128],\n thistle: [216, 191, 216],\n tomato: [255, 99, 71],\n turquoise: [64, 224, 208],\n violet: [238, 130, 238],\n wheat: [245, 222, 179],\n white: [255, 255, 255],\n whitesmoke: [245, 245, 245],\n yellow: [255, 255, 0],\n yellowgreen: [154, 205, 50],\n};\n\n// Precompute accessible text for all named colors (O(1) lookup) (case-insensitive)\nconst precomputedNamedTextColors = {};\nObject.entries(namedColors).forEach(([name, [r, g, b]]) => {\n // Calculate relative luminance\n const lum = (c) => {\n const v = c / 255;\n return v <= 0.03928 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4);\n };\n const L = 0.2126 * lum(r) + 0.7152 * lum(g) + 0.0722 * lum(b);\n // WCAG contrast: choose black or white based on which has higher contrast\n const contrastBlack = (L + 0.05) / 0.05;\n const contrastWhite = 1.05 / (L + 0.05);\n precomputedNamedTextColors[name.toLowerCase()] =\n contrastBlack >= contrastWhite ? \"#000000\" : \"#ffffff\";\n});\n\nexport function getDynamicAccessibleTextColorHex(toastBg, opa = 1) {\n if (!toastBg) return \"snow\";\n\n const key = `${toastBg}|${opa}`;\n const cached = colorCache.get(key);\n if (cached) return cached;\n\n // Named color precomputed lookup\n if (precomputedNamedTextColors[toastBg?.toLowerCase()]) {\n const textColor = precomputedNamedTextColors[toastBg.toLowerCase()];\n colorCache.set(key, textColor);\n return textColor;\n }\n\n let r, g, b;\n\n try {\n const hexMatch = toastBg?.match(/^#([0-9a-f]{3,8})$/i);\n if (hexMatch) {\n let hex = hexMatch[1];\n if (hex.length === 3)\n hex = hex\n .split(\"\")\n .map((c) => c + c)\n .join(\"\");\n r = parseInt(hex.slice(0, 2), 16);\n g = parseInt(hex.slice(2, 4), 16);\n b = parseInt(hex.slice(4, 6), 16);\n } else {\n const rgbMatch = toastBg?.match(\n /rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+)(?:,\\s*[\\d.]+)?\\)/i,\n );\n if (rgbMatch) {\n r = Number(rgbMatch[1]);\n g = Number(rgbMatch[2]);\n b = Number(rgbMatch[3]);\n } else throw new Error(\"Unknown color\");\n }\n } catch {\n r = 50 + Math.floor(Math.random() * 206);\n g = 50 + Math.floor(Math.random() * 206);\n b = 50 + Math.floor(Math.random() * 206);\n }\n\n // Apply opacity blending\n r = Math.round(r * opa + 255 * (1 - opa));\n g = Math.round(g * opa + 255 * (1 - opa));\n b = Math.round(b * opa + 255 * (1 - opa));\n\n // Convert HSL and adjust lightness dynamically\n const rgbToHsl = (r, g, b) => {\n r /= 255;\n g /= 255;\n b /= 255;\n const max = Math.max(r, g, b),\n min = Math.min(r, g, b);\n let h,\n s,\n l = (max + min) / 2;\n if (max === min) h = s = 0;\n else {\n const d = max - min;\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n switch (max) {\n case r:\n h = (g - b) / d + (g < b ? 6 : 0);\n break;\n case g:\n h = (b - r) / d + 2;\n break;\n case b:\n h = (r - g) / d + 4;\n }\n h /= 6;\n }\n return [h * 360, s, l];\n };\n const hslToRgb = (h, s, l) => {\n h /= 360;\n let r, g, b;\n if (s === 0) r = g = b = l;\n else {\n const hue2rgb = (p, q, t) => {\n if (t < 0) t += 1;\n if (t > 1) t -= 1;\n if (t < 1 / 6) return p + (q - p) * 6 * t;\n if (t < 1 / 2) return q;\n if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;\n return p;\n };\n const q = l < 0.5 ? l * (1 + s) : l + s - l * s;\n const p = 2 * l - q;\n r = hue2rgb(p, q, h + 1 / 3);\n g = hue2rgb(p, q, h);\n b = hue2rgb(p, q, h - 1 / 3);\n }\n return [Math.round(r * 255), Math.round(g * 255), Math.round(b * 255)];\n };\n const luminance = (r, g, b) => {\n const a = [r, g, b].map((v) => {\n v /= 255;\n return v <= 0.03928 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4);\n });\n return 0.2126 * a[0] + 0.7152 * a[1] + 0.0722 * a[2];\n };\n const contrastRatio = (rgb1, rgb2) => {\n const L1 = luminance(...rgb1);\n const L2 = luminance(...rgb2);\n return (Math.max(L1, L2) + 0.05) / (Math.min(L1, L2) + 0.05);\n };\n const rgbToHex = (r, g, b) =>\n `#${r.toString(16).padStart(2, \"0\")}${g.toString(16).padStart(2, \"0\")}${b\n .toString(16)\n .padStart(2, \"0\")}`;\n\n let [h, s, l] = rgbToHsl(r, g, b);\n const minContrast = 4.5;\n let textL = l < 0.5 ? Math.min(l + 0.5, 1) : Math.max(l - 0.5, 0);\n let [tr, tg, tb] = hslToRgb(h, s, textL);\n\n if (contrastRatio([r, g, b], [tr, tg, tb]) < minContrast) {\n const contrastBlack = contrastRatio([r, g, b], [0, 0, 0]);\n const contrastWhite = contrastRatio([r, g, b], [255, 255, 255]);\n [tr, tg, tb] = contrastBlack >= contrastWhite ? [0, 0, 0] : [255, 255, 255];\n }\n\n const result = rgbToHex(tr, tg, tb);\n colorCache.set(key, result);\n return result;\n}\n","// src/utils/id.js\n\"use strict\";\n\n/**\n * Generate unique ID for DOM elements to avoid conflicts\n * @param {string} prefix - Optional prefix for ID\n * @returns {string} Unique ID\n */\nexport function generateToastId(prefix) {\n const timestamp = Date.now().toString(36); // shorter timestamp\n const random = Math.floor(Math.random() * 0xfffff).toString(36); // short random part\n return `${prefix}-${timestamp}-${random}`;\n}\n","// src/utils/html-sanitizer.js\n// Lightweight HTML sanitizer wrapper — prefers DOMPurify if available, else conservative fallback.\n\nexport function hasDOMPurify() {\n try {\n if (typeof window !== \"undefined\" && window.DOMPurify) return true;\n } catch (e) {\n /* ignore */\n }\n return false;\n}\n\n/**\n * Basic conservative fallback sanitizer.\n * - Removes <script>, <iframe>, <object>, <embed>, <link>, <meta>, <style> tags entirely.\n * - Strips on* attributes (onclick, onerror, etc) and javascript: URIs in href/src.\n * - Keeps allowed tags list (span, div, p, a, strong, em, b, i, small, u, ul, ol, li, img)\n * - For img, allows only src that starts with http(s) or data:image/.\n *\n * NOTE: fallback is intentionally conservative. Prefer DOMPurify for robust security.\n */\nexport function fallbackSanitize(dirty) {\n if (!dirty || typeof dirty !== \"string\") return \"\";\n\n // Remove dangerous tags\n const blockedTags =\n /<\\/?(script|iframe|object|embed|link|meta|style|form|input|button)[^>]*>/gi;\n let step1 = dirty.replace(blockedTags, \"\");\n\n // Remove event handler attributes (on*)\n step1 = step1.replace(/\\s(on\\w+)\\s*=\\s*(['\"])[\\s\\S]*?\\2/gi, \"\");\n\n // Remove javascript: URIs in href/src\n step1 = step1.replace(\n /(href|src)\\s*=\\s*(['\"])\\s*javascript:[^'\"]*\\2/gi,\n \"$1=$2#$2\"\n );\n\n // Allowlist simple tags & attributes; strip others\n // Create a DOM tree and rebuild with allowed tags/attrs\n const container = document.createElement(\"div\");\n container.innerHTML = step1;\n\n const ALLOWED_TAGS = new Set([\n \"DIV\",\n \"SPAN\",\n \"P\",\n \"BR\",\n \"STRONG\",\n \"B\",\n \"EM\",\n \"I\",\n \"U\",\n \"SMALL\",\n \"UL\",\n \"OL\",\n \"LI\",\n \"A\",\n \"IMG\",\n \"PRE\",\n \"CODE\",\n \"MARK\",\n ]);\n\n // AUDIT FIX (C1 — security): 'style' was previously allowed through with\n // zero validation, letting an attacker-controlled message (allowHtml:true)\n // inject `position:fixed;inset:0;z-index:999999` and render a full-page\n // clickjacking overlay through a toast that already renders at\n // z-index:9999. Inline style is a well-known sanitizer bypass class (see\n // OWASP's XSS Filter Evasion Cheat Sheet). Removed from the allowlist\n // entirely rather than attempting partial validation — toasts don't need\n // arbitrary inline styling to be useful, and \"no unchecked style\" is the\n // safe default most reputable sanitizers ship with.\n const ALLOWED_ATTRS = new Set([\n \"href\",\n \"src\",\n \"alt\",\n \"title\",\n \"class\",\n \"target\",\n \"rel\",\n ]);\n\n function sanitizeNode(node) {\n if (node.nodeType === Node.TEXT_NODE) {\n return document.createTextNode(node.nodeValue);\n }\n if (node.nodeType !== Node.ELEMENT_NODE) {\n return null;\n }\n const tag = node.tagName.toUpperCase();\n if (!ALLOWED_TAGS.has(tag)) {\n // preserve children text but drop the tag itself\n const frag = document.createDocumentFragment();\n Array.from(node.childNodes).forEach((child) => {\n const sanitized = sanitizeNode(child);\n if (sanitized) frag.appendChild(sanitized);\n });\n return frag;\n }\n const el = document.createElement(node.tagName);\n // copy allowed attributes w/ safe checks\n Array.from(node.attributes || []).forEach((attr) => {\n const name = attr.name.toLowerCase();\n const val = attr.value;\n if (!ALLOWED_ATTRS.has(name)) return;\n // Protect href/src from 'javascript:' pseudo-protocol\n if ((name === \"href\" || name === \"src\") && /^\\s*javascript:/i.test(val))\n return;\n // For src allow data images or https/http only\n if (name === \"src\" && !/^\\s*(https?:|data:image\\/)/i.test(val)) return;\n // For href target _blank ensure rel noopener\n if (name === \"target\" && val === \"_blank\") {\n el.setAttribute(\n \"rel\",\n (node.getAttribute(\"rel\") || \"\") + \" noopener noreferrer\"\n );\n }\n el.setAttribute(name, val);\n });\n // recurse children\n Array.from(node.childNodes).forEach((child) => {\n const sanitizedChild = sanitizeNode(child);\n if (sanitizedChild) el.appendChild(sanitizedChild);\n });\n return el;\n }\n\n const outFrag = document.createDocumentFragment();\n Array.from(container.childNodes).forEach((child) => {\n const s = sanitizeNode(child);\n if (s) outFrag.appendChild(s);\n });\n\n const wrapper = document.createElement(\"div\");\n wrapper.appendChild(outFrag);\n return wrapper.innerHTML;\n}\n\n/**\n * sanitizeHtml: main export\n * opts: { forceFallback: boolean }\n */\nexport function sanitizeHtml(dirty, opts = {}) {\n if (!dirty) return \"\";\n try {\n if (!opts.forceFallback && hasDOMPurify()) {\n // Use global DOMPurify if available (or you can import it)\n return window.DOMPurify.sanitize(dirty, {\n ADD_ATTR: [\"target\"],\n ALLOWED_URI_REGEXP:\n /^(?:(?:https?|mailto|ftp|tel|data):|[^a-z]|[a-z+.\\-]+(?:[^a-z+.\\-:]|$))/i,\n });\n }\n } catch (err) {\n // rely on fallback\n // console.warn(\"DOMPurify not available or errored; using fallback sanitizer\", err);\n }\n return fallbackSanitize(dirty);\n}\n","// src/components/toast-utils.js\n\"use strict\";\n\nimport { parseAnimationDuration } from \"../utils/dom.js\";\nimport { sanitizeHtml } from \"../utils/html-sanitizer.js\";\nimport { createLoader } from \"./loader.js\";\nimport {\n createCTA,\n createCloseButton,\n createProgressBar,\n runToastAnimation,\n} from \"./toast-utils-core.js\";\n\n/**\n * Applies rich styling and content to a toast element.\n * @param {HTMLElement} toast - The toast container element.\n * @param {object} options - Configuration options for the toast.\n * @param {Function} onClose - Callback invoked when the toast closes.\n */\nexport async function applyRichStyling(toast, options, onClose) {\n const durationMs = await parseAnimationDuration(options?.animationDuration);\n\n // Compose className based on provided type (default to \"info\")\n toast.className = `toast toast-${options?.type ?? \"info\"}`;\n\n Object.assign(toast.style, {\n background: options?.backgroundColor,\n padding: \"12px 16px\",\n marginBottom: \"10px\",\n borderRadius: options?.borderRadius,\n overflow: \"hidden\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n boxShadow: \"0 4px 6px rgba(0, 0, 0, 0.1)\",\n minWidth: \"250px\",\n maxWidth: options?.maxWidth,\n opacity: \"0\",\n position: \"relative\",\n cursor: \"default\",\n boxSizing: \"border-box\",\n userSelect: \"text\",\n transition: `opacity ${options?.animationDuration} ${options?.animationEasing}, transform ${options?.animationDuration} ${options?.animationEasing}`,\n transform: \"translateY(20px)\",\n zIndex: \"9999\",\n });\n // Accessibility settings\n toast.setAttribute(\"role\", \"alert\");\n toast.setAttribute(\"aria-live\", \"polite\");\n toast.tabIndex = 0; // Make focusable for accessibility if needed\n\n toast._animationDuration = durationMs;\n\n const messageSpan = document.createElement(\"span\");\n\n if (options?.wrapText) {\n Object.assign(messageSpan.style, {\n display: \"block\",\n whiteSpace: \"normal\",\n });\n } else {\n Object.assign(messageSpan.style, {\n display: \"-webkit-box\",\n WebkitBoxOrient: \"vertical\",\n WebkitLineClamp: \"3\",\n whiteSpace: \"nowrap\",\n });\n }\n\n Object.assign(messageSpan.style, {\n flex: \"1\",\n padding: options?.fontPadding,\n fontFamily: options?.fontFamily,\n fontSize: options?.fontSize,\n fontWeight: options?.fontWeight,\n lineHeight: options?.fontLineHeight,\n color: options?.textColor,\n userSelect: \"text\",\n wordBreak: \"break-word\",\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n // AUDIT FIX (C4): display/WebkitLineClamp/WebkitBoxOrient used to be\n // re-applied here unconditionally, silently overwriting whatever the\n // wrapText conditional above had just set — meaning wrapText:\"normal\"\n // never actually worked; every toast truncated to 3 lines regardless.\n // Those three properties are already correctly set by the if/else block\n // above based on options.wrapText, so they're intentionally NOT\n // repeated here anymore.\n });\n\n const allowHtml = !!options.allowHtml; // opt-in flag\n const rawMessage = options.message ?? \"\";\n\n // If a loader is requested as part of the message, create it safely\n if (options.loader || options.showLoader) {\n // createLoader returns an element (see new function below)\n const loaderEl = createLoader(options.loader || {});\n // Put loader before message content\n messageSpan.appendChild(loaderEl);\n // Small spacer\n const spacer = document.createElement(\"span\");\n spacer.style.display = \"inline-block\";\n spacer.style.width = \"8px\";\n messageSpan.appendChild(spacer);\n }\n\n // If allowHtml is explicitly true, sanitize and set innerHTML, otherwise use textContent\n if (\n allowHtml &&\n typeof rawMessage === \"string\" &&\n rawMessage.trim().length > 0\n ) {\n try {\n const sanitized = sanitizeHtml(rawMessage);\n // Use DOM APIs to set sanitized HTML safely\n const tmp = document.createElement(\"div\");\n tmp.innerHTML = sanitized;\n // Move children to messageSpan to avoid re-parsing at outer scope\n while (tmp.firstChild) {\n messageSpan.appendChild(tmp.firstChild);\n }\n } catch (err) {\n console.warn(\n \"HTML message sanitization failed, falling back to text:\",\n err\n );\n messageSpan.textContent = rawMessage;\n }\n } else {\n // default safe text mode\n messageSpan.textContent = String(rawMessage);\n }\n\n // set aria + title\n messageSpan.setAttribute(\"aria-label\", \"Toast Notification Center\");\n messageSpan.setAttribute(\n \"title\",\n typeof rawMessage === \"string\"\n ? rawMessage.replace(/<[^>]+>/g, \"\")\n : String(rawMessage)\n );\n toast.appendChild(messageSpan);\n\n if (options?.cta && Object.keys(options.cta).length !== 0) {\n createCTA(toast, options, onClose);\n }\n\n if (options?.showCloseButton) {\n createCloseButton(toast, options, onClose);\n }\n\n if (options?.showProgressBar) {\n createProgressBar(toast, options);\n }\n\n runToastAnimation(toast);\n}\n\n/**\n * Creates an emergency toast as a safe fallback.\n * @param {object} options - Configuration options for the toast.\n * @param {Function} onClose - Callback invoked when the toast closes.\n * @returns {Promise<HTMLElement|null>}\n */\nexport async function createEmergencyToast(options, onClose) {\n try {\n const emergency = document.createElement(\"div\");\n Object.assign(emergency.style, {\n background: \"#333\",\n color: \"white\",\n padding: \"10px 15px\",\n position: \"fixed\",\n top: \"20px\",\n right: \"20px\",\n zIndex: \"99999\",\n borderRadius: \"3px\",\n maxWidth: \"250px\",\n wordWrap: \"break-word\",\n boxShadow: \"0 2px 10px rgba(0,0,0,0.3)\",\n cursor: \"pointer\",\n });\n\n const innerWrapper = document.createElement(\"div\");\n const msgEl = document.createElement(\"span\");\n msgEl.style.display = \"inline-block\";\n if (options.allowHtml) {\n msgEl.innerHTML = sanitizeHtml(\n String(options.message || \"Emergency Toast Showing!\")\n );\n } else {\n msgEl.textContent = String(\n options.message || \"Emergency Toast Creation Showing!\"\n );\n }\n innerWrapper.appendChild(msgEl);\n\n // add close X via textContent to avoid innerHTML\n const closeSpan = document.createElement(\"span\");\n closeSpan.style.cssText =\n \"float: right; margin-left: 10px; font-weight: bold;\";\n closeSpan.textContent = \"×\";\n innerWrapper.appendChild(closeSpan);\n\n while (emergency.firstChild) emergency.removeChild(emergency.firstChild);\n emergency.appendChild(innerWrapper);\n closeSpan.onclick = () => {\n emergency.remove();\n onClose(emergency);\n };\n\n document.body.appendChild(emergency);\n setTimeout(() => {\n emergency.remove();\n onClose(emergency);\n }, options?.duration);\n\n return emergency;\n } catch (error) {\n console.error(\"Emergency toast creation failed:\", error);\n setTimeout(() => {\n alert(options?.message || \"Emergency Toast Creation Showing!\");\n onClose(null);\n }, 100);\n return null;\n }\n}\n","// src/components/loader.js\nexport function createLoader(opts = {}) {\n const size = opts.size || 14;\n const color = opts.color || \"currentColor\";\n const labelText = opts.text || \"\";\n const wrapper = document.createElement(\"span\");\n wrapper.className = \"toast-loader\";\n wrapper.style.display = \"inline-flex\";\n wrapper.style.alignItems = \"center\";\n wrapper.style.gap = \"8px\";\n\n const svgNS = \"http://www.w3.org/2000/svg\";\n const svg = document.createElementNS(svgNS, \"svg\");\n svg.setAttribute(\"width\", String(size));\n svg.setAttribute(\"height\", String(size));\n svg.setAttribute(\"viewBox\", \"0 0 50 50\");\n svg.setAttribute(\"aria-hidden\", \"true\");\n // spinner circle\n const circle = document.createElementNS(svgNS, \"circle\");\n circle.setAttribute(\"cx\", \"25\");\n circle.setAttribute(\"cy\", \"25\");\n circle.setAttribute(\"r\", \"20\");\n circle.setAttribute(\"fill\", \"none\");\n circle.setAttribute(\"stroke\", color);\n circle.setAttribute(\"stroke-width\", \"4\");\n circle.setAttribute(\"stroke-linecap\", \"round\");\n circle.style.opacity = \"0.85\";\n circle.style.strokeDasharray = \"90\";\n circle.style.strokeDashoffset = \"60\";\n circle.style.transformOrigin = \"center\";\n circle.style.animation = \"toast-spinner 1s linear infinite\";\n\n svg.appendChild(circle);\n wrapper.appendChild(svg);\n\n if (labelText) {\n const lbl = document.createElement(\"span\");\n lbl.style.fontSize = \"13px\";\n lbl.textContent = labelText;\n wrapper.appendChild(lbl);\n }\n\n // add minimal spinner keyframes if not present\n if (!document.getElementById(\"toast-spinner-styles\")) {\n const st = document.createElement(\"style\");\n st.id = \"toast-spinner-styles\";\n st.innerHTML = `@keyframes toast-spinner { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }`;\n document.head.appendChild(st);\n }\n\n return wrapper;\n}\n","\"use strict\";\n\n/**\n * Creates a Call-To-Action (CTA) button or link for the toast.\n * @param {HTMLElement} toast - The toast container element.\n * @param {Object} options - Toast options including cta config.\n * @param {Function} onClose - Callback when toast closes.\n */\nexport function createCTA(toast, options, onClose) {\n const cfg = options?.cta;\n if (!cfg) return;\n\n if (!cfg.label) {\n cfg.label = \"CTA Label Missing!\";\n }\n\n const isLink = !!cfg.href && cfg.variant === \"link\";\n const el = document.createElement(isLink ? \"a\" : \"button\");\n\n if (isLink) {\n el.href = cfg.href;\n if (cfg.target) el.target = cfg.target;\n el.rel = cfg.rel || (cfg.target === \"_blank\" ? \"noopener noreferrer\" : \"\");\n } else {\n el.type = \"button\";\n }\n\n el.setAttribute(\"aria-label\", cfg.ariaLabel || cfg.label);\n\n Object.assign(el.style, {\n marginLeft: \"10px\",\n padding: \"6px 10px\",\n borderRadius: \"6px\",\n fontSize: \"12px\",\n fontWeight: \"600\",\n lineHeight: \"1\",\n border: \"1px solid rgba(255,255,255,0.35)\",\n color: options.textColor || \"#fff\",\n background: \"rgba(255,255,255,0.15)\",\n cursor: \"pointer\",\n whiteSpace: \"nowrap\",\n flexShrink: \"0\",\n });\n\n el.textContent = cfg.label;\n\n const onClick = async (e) => {\n try {\n if (typeof cfg.onClick === \"function\") {\n const res = cfg.onClick(e);\n if (res?.then) await res;\n }\n } finally {\n if (cfg.autoClose !== false) onClose(toast);\n }\n };\n\n el.addEventListener(\"click\", onClick);\n\n // Store cleanup for event listener removal if needed\n el._cleanup = () => el.removeEventListener(\"click\", onClick);\n\n toast.appendChild(el);\n}\n\n/**\n * Creates the close button for the toast.\n * @param {HTMLElement} toast\n * @param {Object} options\n * @param {Function} onClose\n */\nexport function createCloseButton(toast, options, onClose) {\n const closeBtn = document.createElement(\"button\");\n closeBtn.setAttribute(\"aria-label\", \"Close notification\");\n closeBtn.setAttribute(\"title\", \"Close\");\n closeBtn.textContent = \"×\";\n\n Object.assign(closeBtn.style, {\n background: \"none\",\n border: \"none\",\n color: options.textColor || \"white\",\n fontSize: \"18px\",\n marginLeft: \"10px\",\n cursor: \"pointer\",\n });\n\n const onClick = () => onClose(toast);\n closeBtn.addEventListener(\"click\", onClick);\n\n // Provide cleanup for memory management\n toast._cleanupCloseButton = () => {\n closeBtn.removeEventListener(\"click\", onClick);\n };\n\n toast.appendChild(closeBtn);\n}\n\n/**\n * Creates and animates the progress bar on the toast.\n * @param {HTMLElement} toast\n * @param {Object} options\n */\nexport function createProgressBar(toast, options) {\n const progressBar = document.createElement(\"div\");\n const borderRadiusStr = options.borderRadius || 0;\n const borderRadiusNum = parseInt(borderRadiusStr, 10);\n // AUDIT FIX (H4, corrected): the first pass at this fix only stopped\n // `borderRadiusNum - 10` from going negative (which had flipped the\n // calc() into an addition). But the bar is also shifted right by\n // `left: 12px` below — and clamping the subtracted amount to a floor of\n // 0 doesn't account for that offset, so the bar's right edge still sat\n // at `12px + 100%`, ~12px past the container, for any small\n // borderRadius. The real constraint is: leftOffset + width must not\n // exceed 100%, i.e. the subtracted amount must be at least as large as\n // the left offset (12px) whenever that offset is applied. For large\n // borderRadius (the library's own default is 50px) this clamp never\n // kicks in — behavior there is unchanged from before.\n const leftVal = borderRadiusNum ? \"12px\" : \"0\";\n const minSafeOffset = borderRadiusNum ? 12 : 0;\n const radiusOffset = Math.max(borderRadiusNum - 10, minSafeOffset);\n const finalWidth = borderRadiusNum\n ? `calc(100% - ${radiusOffset}px)`\n : \"100%\";\n\n Object.assign(progressBar.style, {\n position: \"absolute\",\n left: `${leftVal}`,\n height: options.progressHeight || \"4px\",\n background: options.progressColor || \"rgba(255, 255, 255, 0.3)\",\n width: `${finalWidth}`,\n transition: `width ${options.duration || 1800}ms linear`,\n [options.progressPosition === \"top\" ? \"top\" : \"bottom\"]: \"0\",\n borderRadius: options.borderRadius || \"4px\",\n });\n\n toast.appendChild(progressBar);\n\n // AUDIT FIX (H3): this used to be a plain CSS `transition`, kicked off by\n // flipping `style.width` to \"0%\" after a setTimeout. That works visually,\n // but a CSS transition has no idea PausableTimer exists — it runs on its\n // own clock. When ToastManager.js calls timer.pause() on hover, the real\n // dismiss genuinely freezes, but the transition kept animating to 0% (or\n // had already finished), so the bar visually lied about how much time was\n // actually left.\n //\n // The Web Animations API (Element.animate()) solves this properly: it\n // returns an Animation object with real .pause()/.play() methods that we\n // can call from the exact same mouseenter/mouseleave/focus handlers that\n // already call timer.pause()/timer.resume() in ToastManager.js — so the\n // bar and the real timer are now driven by the same pause signal instead\n // of two independent clocks. Stored on the toast element (matching the\n // existing _cleanup/_pauseCleanup convention) so ToastManager.js can\n // reach it without createProgressBar needing to know about PausableTimer.\n //\n // Compatibility fallback: Element.animate() isn't available in every\n // environment this package claims to support (browserslist floor is\n // safari>=10.1; Web Animations API landed in Safari 13.1) or in test\n // environments like jsdom. Rather than throw and break toast creation\n // entirely, fall back to the original CSS-transition approach — it won't\n // get the pause-sync fix, but it degrades to the previous (already\n // shipped) behavior instead of crashing.\n if (typeof progressBar.animate === \"function\") {\n toast._progressAnimation = progressBar.animate(\n [{ width: finalWidth }, { width: \"0%\" }],\n {\n duration: Number(options.duration) || 1800,\n easing: \"linear\",\n fill: \"forwards\",\n delay: 50,\n },\n );\n } else {\n progressBar.style.transition = `width ${options.duration || 1800}ms linear`;\n setTimeout(() => {\n progressBar.offsetWidth;\n progressBar.style.width = \"0%\";\n }, 50);\n }\n}\n\n/**\n * Runs the toast's fade-in animation.\n * @param {HTMLElement} toast\n */\nexport function runToastAnimation(toast) {\n setTimeout(() => {\n requestAnimationFrame(() => {\n toast.style.opacity = \"1\";\n toast.style.transform = \"translateY(0)\";\n });\n }, 50);\n}\n","// src/utils/containerRegistry.js\n\"use strict\";\n\nconst containerRegistry = new Map(); // id -> HTMLElement\nconst containerLocks = new Map(); // id -> Promise<HTMLElement>\n\n/**\n * Normalize a position string to a canonical key (id-safe, stable).\n */\nexport function normalizePositionKey(position) {\n // lower-case, trim, unify separators, alias \"below\" -> \"bottom\"\n const raw = String(position).toLowerCase().trim();\n const aliased = raw.replace(/\\bbelow\\b/g, \"bottom\");\n return aliased\n .replace(/\\s+/g, \"-\")\n .replace(/[^a-z0-9-]/g, \"-\")\n .replace(/-{2,}/g, \"-\");\n}\n\n/**\n * Canonical container id\n */\nexport function getContainerId(position) {\n return `toast-container-${normalizePositionKey(position)}`;\n}\n\n/**\n * Atomically get or create a single container per canonical id.\n */\nexport async function getOrCreateToastContainer(options, setPosition) {\n const id = getContainerId(options.position);\n // If a creation is in-flight, await it\n if (containerLocks.has(id)) {\n return containerLocks.get(id);\n }\n\n const p = (async () => {\n // 1) Prefer registry cache if still connected\n const cached = containerRegistry.get(id);\n if (cached?.isConnected) {\n return cached;\n }\n\n // 2) Find existing in DOM\n let el = document.getElementById(id); // unique by spec, but may return first if duplicates exist\n if (el && !el.isConnected) {\n // re-attach if detached\n document.body.appendChild(el);\n }\n\n // 3) If not found, create\n if (!el) {\n el = document.createElement(\"div\");\n el.id = id;\n el.setAttribute(\"role\", \"status\"); // polite + atomic by default\n el.setAttribute(\"aria-atomic\", \"true\"); // explicit for consistency\n el.style.position = \"fixed\";\n el.style.zIndex = \"9999\";\n el.style.inset = \"auto 10px 10px auto\";\n el.style.display = \"flex\";\n el.style.justifyContent = \"space-between\";\n el.style.alignItems = \"center\";\n el.style.flexDirection = \"column\";\n el.style.overflow = \"hidden\";\n // Position with provided helper\n if (typeof setPosition === \"function\") {\n await setPosition(el, options);\n }\n document.body.appendChild(el);\n } else {\n // Ensure base styles and (re)apply position in case options changed\n el.style.position = el.style.position || \"fixed\";\n el.style.zIndex = el.style.zIndex || \"9999\";\n if (typeof setPosition === \"function\") {\n await setPosition(el, options);\n }\n }\n\n // 4) If somehow duplicates exist, keep the first and remove the rest\n // getElementById would have returned the first; clean up others proactively\n const all = document.querySelectorAll(`#${id}`);\n if (all.length > 1) {\n for (let i = 1; i < all.length; i++) {\n try {\n all[i].remove();\n } catch {}\n }\n }\n\n containerRegistry.set(id, el);\n return el;\n })();\n\n containerLocks.set(id, p);\n try {\n const out = await p;\n return out;\n } finally {\n // Clear the lock so future calls can re-enter if needed\n containerLocks.delete(getContainerId(options.position));\n }\n}\n","// src/utils/position.js\n\"use strict\";\n\n/**\n * Set position for toast container\n * @param {HTMLElement} container - Toast container element\n * @param {Object} options - Options object containing position\n * @returns {Promise<void>}\n */\nexport async function setPosition(container, options) {\n if (!container || !options.position) {\n throw new Error(\"Invalid container or position!\");\n }\n\n resetContainerStyles(container);\n const positionFlags = parsePosition(options.position);\n\n if (handleFullWidthPositions(container, options, positionFlags)) return;\n if (handleCenterPositions(container, positionFlags)) return;\n\n applyStandardPositioning(container, positionFlags);\n}\n\n/**\n * Reset all position-related styles\n * @param {HTMLElement} container\n */\nfunction resetContainerStyles(container) {\n container.style.top = \"auto\";\n container.style.bottom = \"auto\";\n container.style.left = \"auto\";\n container.style.right = \"auto\";\n container.style.transform = \"none\";\n}\n\n/**\n * Parse position string into boolean flags\n * @param {string} position\n * @returns {Object} Position flags\n */\nfunction parsePosition(position) {\n const pos = position.toLowerCase().trim();\n return {\n hasTop: pos.includes(\"top\"),\n hasBottom: pos.includes(\"bottom\") || pos.includes(\"below\"),\n hasLeft: pos.includes(\"left\"),\n hasRight: pos.includes(\"right\"),\n hasCenter: pos.includes(\"center\"),\n hasFullWidth:\n pos.includes(\"top-full-width\") ||\n pos.includes(\"bottom-full-width\") ||\n pos.includes(\"fullwidth\"),\n };\n}\n\n/**\n * Handle full-width positioning cases\n * @param {HTMLElement} container\n * @param {Object} options\n * @param {Object} flags\n * @returns {boolean} True if position was handled\n */\nfunction handleFullWidthPositions(container, options, flags) {\n if (!flags.hasFullWidth) return false;\n\n options.maxWidth = \"100vw\";\n\n if (flags.hasTop) {\n container.style.top = \"10px\";\n container.style.left = \"10px\";\n container.style.right = \"10px\";\n return true;\n }\n\n if (flags.hasBottom) {\n container.style.bottom = \"10px\";\n container.style.left = \"10px\";\n container.style.right = \"10px\";\n return true;\n }\n\n return false;\n}\n\n/**\n * Handle center positioning cases\n * @param {HTMLElement} container\n * @param {Object} flags\n * @returns {boolean} True if position was handled\n */\nfunction handleCenterPositions(container, flags) {\n if (!flags.hasCenter) return false;\n\n // top-center\n if (flags.hasTop && !flags.hasLeft && !flags.hasRight) {\n container.style.top = \"10px\";\n container.style.left = \"50%\";\n container.style.transform = \"translateX(-50%)\";\n return true;\n }\n\n // bottom-center\n if (flags.hasBottom && !flags.hasLeft && !flags.hasRight) {\n container.style.bottom = \"10px\";\n container.style.left = \"50%\";\n container.style.transform = \"translateX(-50%)\";\n return true;\n }\n\n // left-center\n if (flags.hasLeft && !flags.hasTop && !flags.hasBottom) {\n container.style.left = \"10px\";\n container.style.top = \"50%\";\n container.style.transform = \"translateY(-50%)\";\n return true;\n }\n\n // right-center\n if (flags.hasRight && !flags.hasTop && !flags.hasBottom) {\n container.style.right = \"10px\";\n container.style.top = \"50%\";\n container.style.transform = \"translateY(-50%)\";\n return true;\n }\n\n // full center (no sides specified)\n if (!flags.hasLeft && !flags.hasRight && !flags.hasTop && !flags.hasBottom) {\n container.style.top = \"50%\";\n container.style.left = \"50%\";\n container.style.transform = \"translate(-50%, -50%)\";\n return true;\n }\n\n return false;\n}\n\n/**\n * Apply standard positioning (corners and edges)\n * @param {HTMLElement} container\n * @param {Object} flags\n */\nfunction applyStandardPositioning(container, flags) {\n if (flags.hasBottom) {\n container.style.bottom = \"10px\";\n } else if (flags.hasTop) {\n container.style.top = \"10px\";\n }\n\n if (flags.hasRight) {\n container.style.right = \"10px\";\n } else if (flags.hasLeft) {\n container.style.left = \"10px\";\n } else {\n // AUDIT FIX (M1): this branch previously set `bottom: 10px`\n // unconditionally, even when `hasTop` had already set `top: 10px`\n // above (e.g. an undocumented/malformed position string like \"top\"\n // alone). A position:fixed element with BOTH top and bottom set and no\n // explicit height gets stretched to fill the gap between them. Only\n // fall back to \"bottom\" here if no vertical anchor was chosen at all.\n if (!flags.hasBottom && !flags.hasTop) {\n container.style.bottom = \"10px\";\n }\n container.style.left = \"50%\";\n container.style.transform = \"translateX(-50%)\";\n }\n}\n","// src/utils/PausableTimer.js\n\"use strict\";\n\nexport class PausableTimer {\n constructor(callback, delay) {\n this.callback = callback;\n this.delay = delay;\n this.remaining = delay;\n this.startTime = null;\n this.timeoutId = null;\n this.isPaused = false;\n this.isCompleted = false;\n }\n\n start() {\n if (this.isCompleted || this.timeoutId) return this;\n this.startTime = Date.now();\n this.timeoutId = setTimeout(() => {\n this.isCompleted = true;\n this.timeoutId = null;\n this.callback();\n }, this.remaining);\n return this;\n }\n\n pause() {\n if (this.isPaused || !this.timeoutId || this.isCompleted) return this;\n clearTimeout(this.timeoutId);\n this.timeoutId = null;\n this.remaining -= Date.now() - this.startTime;\n this.remaining = Math.max(0, this.remaining); // prevent negative\n this.isPaused = true;\n return this;\n }\n\n resume() {\n if (!this.isPaused || this.isCompleted) return this;\n this.isPaused = false;\n this.start();\n return this;\n }\n\n clear() {\n if (this.timeoutId) {\n clearTimeout(this.timeoutId);\n this.timeoutId = null;\n }\n this.isCompleted = true;\n return this;\n }\n\n getRemainingTime() {\n if (this.isCompleted) return 0;\n if (this.isPaused) return this.remaining;\n if (!this.timeoutId) return this.delay;\n return Math.max(0, this.remaining - (Date.now() - this.startTime));\n }\n}\n","// src/components/ToastManager.js\n\"use strict\";\n\nimport { createToastElement } from \"./Toast.js\";\nimport { removeElement } from \"../utils/dom.js\";\nimport { createEmergencyToast } from \"./toast-utils.js\";\nimport { getOrCreateToastContainer } from \"../utils/containerRegistry.js\";\nimport { setPosition } from \"../utils/position.js\";\nimport { PausableTimer } from \"../utils/PausableTimer.js\";\n\n// Config\nconst MAX_VISIBLE = 3;\n\n// State\nconst active = new Map(); // key -> { outer, toast, count, timeout }\nconst pending = new Map(); // key -> { options, count, rafId }\nconst queue = []; // [{ options, key, count }]\nlet visibleCount = 0;\n\n// djb2 hash function for message deduplication\nfunction hashString(str) {\n let h = 5381;\n for (let i = 0; i < str.length; i++) h = (h << 5) + h + str.charCodeAt(i);\n return h >>> 0;\n}\n\n/**\n * Creates a unique key for a toast notification based on its type, message, and position.\n * This key is used to identify and deduplicate identical toast notifications.\n * @param {Object} options - Toast options with type, message, and position.\n * @returns {string} A unique key for the toast notification.\n */\nfunction makeKey(options = {}) {\n const type = String(options.type).trim().toLowerCase();\n const messageHash = hashString(String(options.message || \"\")).toString(16);\n const position = String(options.position).trim().toLowerCase();\n\n return `${type}|${messageHash}|${position}`;\n}\n\n/**\n * Shows a toast notification with the given options.\n * If there is already an active toast with the same type, message, and position,\n * it will be grouped immediately and the count will be incremented.\n * If there is already a pending toast with the same type, message, and position,\n * it will be coalesced and the count will be incremented.\n * If there is no capacity left (i.e. the number of visible toasts is at the maximum),\n * the grouped request will be enqueued and processed later.\n * @param {Object} options - Toast options with type, message, and position.\n * @returns {Promise<void>} A promise that resolves when the toast is fully created and displayed.\n */\nexport async function showToast(options = {}) {\n try {\n const key = makeKey(options);\n\n // If already active: group immediately\n if (active.has(key)) {\n const data = active.get(key);\n if (!data) throw new Error(`Active toast with key ${key} not found`);\n data.count++;\n\n // Reset timer with new duration\n data.timer.clear();\n data.timer = createDismissTimer(data.toast, options);\n await setupPauseOnHover(data);\n await updateBadge(data);\n return;\n }\n\n // If coalescing is already scheduled for this key, just increment the pending count\n if (pending.has(key)) {\n const current = pending.get(key);\n if (!current) throw new Error(`Pending toast with key ${key} not found`);\n current.count++;\n return;\n }\n\n // Start coalescing identical calls in the same frame\n const entry = { options, count: 1, rafId: 0 };\n pending.set(key, entry);\n\n entry.rafId = requestAnimationFrame(async () => {\n // finalize batch for this key\n const current = pending.get(key);\n if (!current) return;\n pending.delete(key);\n\n // If capacity full, enqueue the grouped request\n if (visibleCount >= MAX_VISIBLE) {\n queue.push({ options: current.options, key, count: current.count });\n await drainQueue();\n return;\n }\n\n // Otherwise create immediately with the grouped count\n try {\n await createOne(current.options, key, current.count);\n } catch (error) {\n console.error(\"showToast failed:\", error);\n }\n });\n } catch (error) {\n console.error(\"showToast failed:\", error);\n }\n}\n\n/**\n * Creates a single toast notification with the given options and initial count.\n * Will create and mount the toast element, and setup a timer to auto-dismiss.\n * If the toast creation fails, it will fallback to an emergency toast.\n * @param {Object} options - Toast options with type, message, and position.\n * @param {string} key - Unique key for the toast.\n * @param {number} initialCount - Initial count for the toast.\n * @returns {Promise<void>} A promise that resolves when the toast is fully created and displayed.\n */\nasync function createOne(options, key, initialCount) {\n try {\n if (!options || typeof options !== \"object\") {\n throw new TypeError(\"options must be an object\");\n }\n\n visibleCount++;\n\n const container = await getOrCreateToastContainer(options, setPosition);\n if (!container) {\n throw new Error(\"Failed to create toast container\");\n }\n\n // Build the toast element\n const toast = await createToastElement(options, closeToast);\n if (!toast) {\n throw new Error(\"Toast element creation failed\");\n }\n\n // Outer wrapper (badge surface; visible overflow)\n const outer = document.createElement(\"div\");\n Object.assign(outer.style, {\n position: \"relative\",\n display: \"inline-block\",\n overflow: \"visible\",\n marginBottom: \"10px\",\n zIndex: \"0\",\n width: \"100%\",\n });\n\n // Inner wrapper (clip progress bar & rounded corners)\n const inner = document.createElement(\"div\");\n Object.assign(inner.style, {\n position: \"relative\",\n overflow: \"hidden\",\n // borderRadius: options.borderRadius || \"8px\",\n zIndex: \"1\",\n });\n\n inner.appendChild(toast);\n outer.appendChild(inner);\n\n // Mount\n if (container.id.includes(\"toast-container-\")) {\n container.appendChild(outer);\n }\n\n // Determine if should pause on hover (default: true if has CTA)\n const shouldPauseOnHover =\n options.pauseOnHover !== false &&\n (options.pauseOnHover === true || !!options.cta);\n\n // Track\n const data = {\n outer,\n toast,\n count: Math.max(1, Math.floor(initialCount ?? 0)),\n timeout: null,\n pauseOnHover: shouldPauseOnHover,\n };\n active.set(key, data);\n toast._key = key;\n\n if (data.count > 1) await updateBadge(data);\n\n // Create and start timer\n data.timer = createDismissTimer(toast, options);\n await setupPauseOnHover(data);\n } catch (err) {\n console.error(\"Something went wrong: \", err);\n visibleCount = Math.max(0, visibleCount - 1);\n const el =\n document.querySelector('[id^=\"toast-container-\"]') || document.body;\n el.appendChild(await createEmergencyToast(options, closeToast));\n }\n}\n\n/**\n * Dismiss (close) the most recently shown toast.\n * - Finds the most recently appended toast element across containers.\n * - Calls closeToast on it (which handles timers, cleanup, and queue drain).\n * - Returns a Promise that resolves when the close completes.\n */\nexport async function dismissMostRecent() {\n try {\n // If no active toasts, nothing to dismiss\n if (active.size === 0) return;\n\n // Strategy: find the last inserted element in DOM among all containers.\n // Iterate containers and pick lastElementChild of container that is a toast wrapper.\n let lastToastEl = null;\n\n const containers = document.querySelectorAll('[id^=\"toast-container-\"]');\n containers.forEach((container) => {\n const children = Array.from(container.children || []);\n if (children.length === 0) return;\n // AUDIT FIX (L3): toasts are always appended (never prepended), so\n // the LAST child in DOM order is the most recently created one.\n // children.at(0) — the previous behavior — was actually the OLDEST\n // visible toast, the opposite of what \"dismissMostRecent\" promises.\n const candidate = children.at(-1);\n if (candidate) {\n lastToastEl = candidate.querySelector('[id^=\"toast-\"]') || candidate;\n }\n });\n\n if (!lastToastEl) {\n // Same fix applied to the Map-based fallback: Map preserves\n // insertion order, so the LAST entry is the most recently created\n // toast, not the first.\n const entries = Array.from(active.entries());\n if (entries.length > 0) {\n const [, data] = entries.at(-1);\n lastToastEl =\n data.toast ||\n (data.outer && data.outer.querySelector('[id^=\"toast-\"]'));\n }\n }\n\n if (!lastToastEl) return;\n\n // If the element is a wrapper, attempt to find the actual toast element with _key\n const toastEl = lastToastEl._key\n ? lastToastEl\n : lastToastEl.querySelector('[id^=\"toast-\"]') || lastToastEl;\n\n await closeToast(toastEl);\n } catch (err) {\n console.error(\"dismissMostRecent failed:\", err);\n }\n}\n\n/**\n * Close all active toasts immediately.\n * - Clears timers, runs closeToast for each active toast,\n * - Also clears the pending queue.\n */\nexport async function closeAllToasts() {\n try {\n // mark in-progress (consumers can use this flag via module if needed)\n const activeToasts = Array.from(active.values())\n .map((d) => d.toast)\n .filter(Boolean);\n // clear pending queue (so no queued toasts will appear after we remove active)\n queue.length = 0;\n pending.clear();\n\n // Close in clockwise order (oldest first)\n for (const t of activeToasts) {\n try {\n // Sequentially close to preserve animation and queue order\n await closeToast(t);\n } catch (error_inner) {\n console.warn(\"closeAllToasts: failed to close one toast:\", error_inner);\n }\n }\n } catch (err) {\n console.error(\"closeAllToasts failed:\", err);\n }\n}\n\n// Export aliases for clarity / compatibility\nexport const dismiss = dismissMostRecent;\nexport const noop = closeAllToasts;\n\n/**\n * Creates a PausableTimer that auto-closes a toast after a delay.\n * @param {HTMLElement} toast - The toast element to auto-close.\n * @param {Object} options - Toast options with duration.\n * @returns {PausableTimer} A timer that can be paused, resumed, or cleared.\n */\nfunction createDismissTimer(toast, options) {\n const delay = Number(options.duration ?? 1800) + 5;\n const timer = new PausableTimer(async () => await closeToast(toast), delay);\n timer.start();\n return timer;\n}\n\nasync function setupPauseOnHover(data) {\n if (!data.pauseOnHover || !data.outer || !data.timer) return;\n\n const { outer, timer, toast } = data;\n\n const onMouseEnter = () => {\n timer.pause();\n // AUDIT FIX (H3): the progress bar's Web Animations API animation\n // (toast._progressAnimation, set on the INNER toast element by\n // toast-utils-core.js's createProgressBar — not on `outer`, which is\n // just ToastManager's positioning wrapper div around it) previously\n // had no connection to pause-on-hover at all — it ran on its own\n // clock and kept animating to 0% even while the real PausableTimer\n // was genuinely frozen, so the bar visually lied about how much time\n // was actually left. Pausing it here, from the exact same event that\n // pauses the real timer, keeps both in sync.\n toast?._progressAnimation?.pause();\n };\n const onMouseLeave = () => {\n timer.resume();\n toast?._progressAnimation?.play();\n };\n\n const onFocusIn = (e) => {\n if (e.target.matches(\"[tabindex], div, span, button, a\")) {\n timer.pause();\n toast?._progressAnimation?.pause();\n }\n };\n\n const onFocusOut = (e) => {\n if (!outer.contains(e.relatedTarget)) {\n timer.resume();\n toast?._progressAnimation?.play();\n }\n };\n\n // Add event listeners\n outer.addEventListener(\"mouseenter\", onMouseEnter);\n outer.addEventListener(\"mouseleave\", onMouseLeave);\n outer.addEventListener(\"focusin\", onFocusIn);\n outer.addEventListener(\"focusout\", onFocusOut);\n\n // Store cleanup function\n outer._pauseCleanup = () => {\n outer.removeEventListener(\"mouseenter\", onMouseEnter);\n outer.removeEventListener(\"mouseleave\", onMouseLeave);\n outer.removeEventListener(\"focusin\", onFocusIn);\n outer.removeEventListener(\"focusout\", onFocusOut);\n };\n}\n\n/**\n * Closes a toast notification immediately.\n * If the toast is not found in the active toasts map, this function does nothing.\n * @param {HTMLElement|null} toast - The toast element to close.\n * @returns {Promise<void>} A promise that resolves when the toast is fully removed from the DOM.\n */\nexport async function closeToast(toast) {\n try {\n if (!toast?._key) return;\n const data = active.get(toast._key);\n if (!data) return;\n\n // Clear timer and cleanup pause events\n data.timer?.clear();\n data.outer?._pauseCleanup?.();\n\n active.delete(toast._key);\n visibleCount = Math.max(0, visibleCount - 1);\n\n // Remove badge if present\n const badge = data.outer.querySelector(\".toast-count-badge\");\n if (badge) badge.remove();\n\n // Remove wrapper after transition ends (or fallback)\n await removeWithTransition(data.outer);\n\n // Drain queue after a slot frees\n await drainQueue();\n } catch (error) {\n console.error(\"Closing Toast failed!: \", error);\n }\n}\n\nasync function drainQueue() {\n // Fill available slots; coalesce queued entries against active if they became active meanwhile\n while (visibleCount < MAX_VISIBLE && queue.length) {\n const item = queue.shift();\n if (active.has(item.key)) {\n const data = active.get(item.key);\n data.count += item.count;\n await updateBadge(data);\n continue;\n }\n // Create without awaiting to keep loop responsive; visibleCount is incremented inside createOne\n void createOne(item.options, item.key, item.count);\n }\n}\n\n/**\n * Safely remove an element after its transition ends, with a hard timeout fallback\n * @param {Element} el - The element to remove\n * @returns {Promise<void>} A promise that resolves after the element is removed\n */\nasync function removeWithTransition(el) {\n if (!el) return Promise.resolve();\n\n return new Promise((resolve) => {\n let done = false;\n const finish = () => {\n if (done) return;\n done = true;\n removeElement(el);\n resolve();\n };\n\n // Listen on the immediate child (inner wrapper) if possible\n const child = el.firstElementChild || el;\n if (!child) return resolve();\n\n const onEnd = (e) => {\n try {\n // Check if the event target is the same element we're listening on\n if (e.target !== child) return;\n // Remove the event listener to prevent multiple triggers\n child.removeEventListener(\"transitionend\", onEnd, true);\n finish();\n } catch (error) {\n console.error(\"removeWithTransition error:\", error);\n }\n };\n\n // Add the event listener to the child element\n try {\n child.addEventListener(\"transitionend\", onEnd, true);\n } catch (error) {\n console.error(\"removeWithTransition error:\", error);\n }\n\n // Hard fallback if no transition fires after 700ms\n setTimeout(() => {\n try {\n // Remove the event listener to prevent multiple triggers\n child.removeEventListener(\"transitionend\", onEnd, true);\n finish();\n } catch (error) {\n console.error(\"removeWithTransition error:\", error);\n }\n }, 700);\n });\n}\n\n/**\n * Updates the badge count on the outer toast wrapper.\n * @param {Object} options Options object containing the outer toast wrapper and the count.\n * @param {HTMLElement} options.outer The outer toast wrapper element.\n * @param {number} options.count The count of identical notifications.\n */\nasync function updateBadge({ outer, count }) {\n if (!outer || !(outer instanceof HTMLElement)) {\n throw new Error(\"updateBadge: outer must be a valid HTMLElement\");\n }\n\n if (count < 2) {\n // Remove the badge if the count is less than 2\n const badge = outer.querySelector(\".toast-count-badge\");\n if (badge) badge.remove();\n return;\n }\n\n let badge = outer.querySelector(\".toast-count-badge\");\n if (!badge) {\n // Create the badge if it doesn't exist\n badge = document.createElement(\"span\");\n badge.className = \"toast-count-badge\";\n badge.setAttribute(\"aria-label\", `${count} identical notifications`);\n\n // Style the badge\n Object.assign(badge.style, {\n position: \"absolute\",\n top: \"6px\",\n right: \"6px\",\n backgroundColor: \"#f44336\",\n color: \"#fff\",\n borderRadius: \"50%\",\n minWidth: \"20px\",\n height: \"20px\",\n fontSize: \"12px\",\n fontWeight: \"600\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n border: \"2px solid #fff\",\n boxShadow: \"0 2px 6px rgba(0,0,0,0.3)\",\n zIndex: \"2\",\n pointerEvents: \"none\",\n transition: \"transform 150ms ease\",\n });\n\n // Add the badge to the outer toast wrapper\n outer.appendChild(badge);\n }\n\n // Update the badge text content\n badge.textContent = count > 99 ? \"99+\" : String(count);\n\n // Animate the badge by scaling it up and then back down\n try {\n badge.style.transform = \"scale(1.2)\";\n setTimeout(() => (badge.style.transform = \"scale(1)\"), 150);\n } catch (error) {\n console.error(\"updateBadge animation error:\", error);\n }\n}\n","// src/components/Toast.js //# Single responsibility\n\"use strict\";\n\nimport { createElementWithId } from \"../utils/dom.js\";\nimport { applyRichStyling, createEmergencyToast } from \"./toast-utils.js\";\n\n/**\n * Creates a multi-layer toast element with satellite-grade fallbacks\n * @param {Object} options - Toast configuration options\n * @param {Function} onClose - Callback when toast closes\n * @returns {HTMLElement} Toast element\n */\nexport async function createToastElement(options, onClose) {\n const toastContainerSelector = '[id^=\"toast-container-\"]';\n const toastContainer = document.querySelector(toastContainerSelector);\n if (!toastContainer) return null;\n\n let toast;\n const tagName = \"div\";\n const prefix = \"toast\";\n\n // PRIMARY: Full-featured toast\n try {\n toast = await createElementWithId(tagName, prefix);\n await applyRichStyling(toast, options, onClose);\n return toast;\n } catch (error) {\n console.warn(\n \"toast creation failed with error showing fallback one: \",\n error\n );\n // Fallback: create emergency toast\n toast = await createEmergencyToast(options, onClose);\n return toast;\n }\n}\n","// src/index.js\n\"use strict\";\n\nimport { showToast } from \"./components/ToastManager.js\";\nimport { getOrCreateToastContainer } from \"./utils/containerRegistry.js\";\nimport { getDynamicAccessibleTextColorHex } from \"./utils/dom.js\";\nimport { setPosition } from \"./utils/position.js\";\n\n// Protected default colors with fallbacks\nlet defaultColors = {\n success: \"#28a745\",\n error: \"#dc3545\",\n warning: \"#ffc107\",\n info: \"#17a2b8\",\n};\n\nlet defaultMessages = {\n success: \"Operation completed successfully!\",\n error: \"Something went wrong!\",\n warning: \"Warning message!\",\n info: \"Information message!\",\n};\n\n/**\n * Create toast with satellite-grade reliability\n */\n// Toast queue for calls before DOM ready\nconst pendingToasts = [];\n\n// Flag to indicate DOM ready for toast execution\nlet domReady = false;\n\n/**\n * Checks if DOM is ready and flushes pending toasts after a delay\n */\nasync function checkDOMReady() {\n if (domReady) return;\n\n if (typeof window !== \"undefined\" && typeof document !== \"undefined\") {\n if (\n document.readyState === \"complete\" ||\n document.readyState === \"interactive\"\n ) {\n domReady = true;\n // Flush queued toasts after 2.5s delay\n pendingToasts.forEach((options) =>\n setTimeout(() => createToastNow(options), 2500)\n );\n pendingToasts.length = 0;\n } else {\n // Wait for DOMContentLoaded\n document.addEventListener(\n \"DOMContentLoaded\",\n () => {\n domReady = true;\n pendingToasts.forEach((options) =>\n setTimeout(() => createToastNow(options), 2500)\n );\n pendingToasts.length = 0;\n },\n { once: true }\n );\n }\n }\n}\n\n/**\n * Core toast creation logic\n * @param {Object} options - Toast options\n * @returns {Promise<void>} Toast creation promise\n */\nasync function createToastNow(options = {}) {\n try {\n /**\n * Sanitize toast options and fill in defaults\n * @param {Object} options - Toast options\n * @returns {Promise<Object>} Sanitized toast options promise\n */\n const sanitizedOptions = await sanitizeToastOptions(options);\n\n /**\n * Create the first toast container for pre-validate to a given position for same position toast stacking\n * @param {Object} options - Sanitized toast options\n * @returns {Promise<HTMLElement>} Toast container promise\n */\n await createFirstToastContainer(sanitizedOptions);\n\n /**\n * Show the toast notification with given options\n * @param {Object} options - Sanitized toast options\n * @returns {Promise<void>} Show toast promise\n */\n await showToast(sanitizedOptions);\n } catch (error) {\n console.error(\"CreateToast failed:\", error);\n\n const safeMessage =\n typeof options?.message === \"string\" && options?.message !== null\n ? `${options.message.substring(0, 200)} toast creation failed!`\n : \"Toast creation failed!\";\n\n alert(safeMessage);\n }\n}\n\n/**\n * Public API for creating a toast\n * @param {Object} options Toast options\n */\nasync function createToast(options = {}) {\n // Check browser environment\n const isBrowser =\n typeof window !== \"undefined\" && typeof document !== \"undefined\";\n\n if (!isBrowser) {\n console.warn(\n \"ToastNotification: running in non-browser environment, no DOM available.\"\n );\n return;\n }\n\n // Check if DOM ready\n await checkDOMReady();\n\n if (!domReady) {\n // Queue for later execution\n pendingToasts.push(options);\n return;\n }\n\n await createToastNow(options);\n}\n\n/**\n * Creates or retrieves the toast container for a given position\n * Single source of truth for containers; prevents same-id duplicates\n * @param {Object} options\n * @returns {Promise<HTMLElement>}\n */\nasync function createFirstToastContainer(options) {\n try {\n return await getOrCreateToastContainer(options, setPosition);\n } catch (error) {\n console.error(\"Failed to create toast container:\", error);\n return document.body;\n }\n}\n\n/**\n * Sanitizes and normalizes toast options.\n * Fills in defaults, validates input, and ensures colors & messages are set.\n * @param {Object} options - User-provided toast options\n * @returns {Promise<Object>} final sanitized toast options\n */\nasync function sanitizeToastOptions(options) {\n const contPosition = options?.position?.toLowerCase()?.trim();\n const contMaxWidth =\n contPosition?.includes(\"top-full-width\") ||\n contPosition?.includes(\"bottom-full-width\")\n ? \"100vw\"\n : \"400px\";\n\n const defaults = {\n allowHtml: false, // default: false for safety\n sanitizeHtml: true, // whether to sanitize (if DOMPurify present it's used)\n pauseOnHover: undefined,\n duration: 2500,\n position: \"bottom-right\",\n type: \"info\",\n borderRadius: \"50px\",\n backgroundColor: undefined,\n textColor: undefined,\n showCloseButton: true,\n animationDuration: \"0.4s\",\n animationType: \"fade\",\n animationEasing: \"ease\",\n showProgressBar: true,\n progressColor: undefined,\n progressHeight: \"4px\",\n progressPosition: \"bottom\",\n fontPosition: \"relative\",\n fontPadding: undefined,\n fontBorderRadius: undefined,\n fontBackgroundColor: undefined,\n fontFamily:\n '-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"',\n fontSize: \"14px\",\n fontWeight: \"400\",\n fontLineHeight: \"1.4\",\n fontDirection: \"auto\",\n wrapText: \"normal\",\n maxWidth: contMaxWidth,\n };\n\n // Merge defaults with user options\n const final = {\n ...defaults,\n ...(typeof options === \"object\" && !Array.isArray(options) ? options : {}),\n };\n\n // Ensure message property separately\n final.message = options?.message ?? final.message;\n\n try {\n // Background color fallback based on type or system preference\n if (!final.backgroundColor) {\n final.backgroundColor =\n defaultColors?.[final.type] ??\n (window.matchMedia(\"(prefers-color-scheme: dark)\").matches\n ? \"#f5f5f5\"\n : \"#111111\");\n }\n\n // Default message if not provided\n final.message =\n final.message || defaultMessages?.[final.type] || \"No Message Provided!\";\n\n // Ensure textColor is set\n if (!final.textColor && final.backgroundColor) {\n const textColorResult = getDynamicAccessibleTextColorHex(\n final.backgroundColor\n );\n final.textColor = textColorResult;\n }\n\n // Ensure progressColor is set\n if (!final.progressColor && final.backgroundColor) {\n if (final.textColor) {\n final.progressColor = final.textColor;\n } else {\n const barColorResult = getDynamicAccessibleTextColorHex(\n final.backgroundColor\n );\n final.progressColor = barColorResult;\n }\n }\n } catch (error) {\n console.warn(\"Option processing failed:\", error);\n }\n\n // Safety check for message type\n if (typeof final.message !== \"string\") {\n final.message = \"No Message Provided!\";\n }\n\n return final;\n}\n\n/**\n * Sets default colors\n * @param {Object} colors\n */\nfunction setDefaultColors(colors) {\n try {\n if (colors && typeof colors === \"object\" && !Array.isArray(colors)) {\n defaultColors = { ...defaultColors, ...colors };\n }\n } catch (error) {\n console.error(\"setDefaultColors failed:\", error);\n }\n}\n\n/**\n * Sets default messages\n * @param {Object} messages\n */\nfunction setDefaultMessages(messages) {\n try {\n if (messages && typeof messages === \"object\" && !Array.isArray(messages)) {\n defaultMessages = { ...defaultMessages, ...messages };\n }\n } catch (error) {\n console.error(\"setDefaultMessages failed:\", error);\n }\n}\n\n// import the manager functions\nimport { dismiss, noop as managerNoop } from \"./components/ToastManager.js\";\n\n// Replace any existing noop export with the manager one\n// (If file previously defined a noop here, remove/replace it.)\n\n// Close-priority lock: when true, createToast should wait until close finishes.\nlet closeInProgress = false;\nlet closePromise = null;\n\nasync function runWithClosePriority(fn) {\n // If a close is in progress, await it first\n if (closeInProgress && closePromise) {\n try {\n await closePromise;\n } catch (e) {\n // ignore errors from close\n }\n }\n return fn();\n}\n\n// Wrap createToast to respect close priority\nconst originalCreateToast = createToast;\nasync function createToastWithPriority(options = {}) {\n return runWithClosePriority(() => originalCreateToast(options));\n}\n\n// Re-export the wrapped createToast\nexport { createToastWithPriority as createToast };\n\n// Re-export the manager APIs with expected names:\nexport { setDefaultColors, setDefaultMessages };\nexport const dismissToast = async () => {\n // mark close in progress for dismiss\n closeInProgress = true;\n closePromise = (async () => {\n try {\n await dismiss();\n } finally {\n closeInProgress = false;\n closePromise = null;\n }\n })();\n await closePromise;\n};\nexport const noopAll = async () => {\n closeInProgress = true;\n closePromise = (async () => {\n try {\n await managerNoop();\n } finally {\n closeInProgress = false;\n closePromise = null;\n }\n })();\n await closePromise;\n};\n// For backward-compat, export names the user expects:\nexport { dismissToast as dismiss, noopAll as noop };\n\n// Add Esc key listener (register once)\nif (typeof window !== \"undefined\" && typeof document !== \"undefined\") {\n let escRegistered = false;\n if (!escRegistered) {\n const onKeyDown = (e) => {\n if (e.key === \"Escape\" || e.key === \"Esc\") {\n // Prevent default behavior and dismiss the most recent toast.\n // e.preventDefault();\n // Fire-and-forget, but ensure close priority is set\n (async () => {\n closeInProgress = true;\n closePromise = (async () => {\n try {\n await dismiss();\n } finally {\n closeInProgress = false;\n closePromise = null;\n }\n })();\n await closePromise;\n })();\n }\n };\n window.addEventListener(\"keydown\", onKeyDown, { passive: true });\n escRegistered = true;\n }\n}\n\n// Module exports\n// export { createToast, setDefaultColors, setDefaultMessages, noop };\n\n// Global assignment with protection\ntry {\n // UMD/Global support\n if (typeof window !== \"undefined\") {\n // AUDIT FIX (H5): this object previously used the RAW, unwrapped\n // `createToast`/`dismiss`/`noop` locals — meaning window.customizableToast\n // (the exact global your README's CDN usage example is built around)\n // lacked the closeInProgress/closePromise race-condition serialization\n // that ESM consumers get for free via the named exports. Now both\n // consumption paths behave identically.\n window.customizableToast = {\n createToast: createToastWithPriority,\n setDefaultColors,\n setDefaultMessages,\n noop: noopAll,\n dismiss: dismissToast,\n };\n }\n} catch (error) {\n console.error(\"Global assignment failed:\", error);\n}\n"],"names":["async","createElementWithId","tagName","prefix","el","document","createElement","id","Date","now","toString","Math","floor","random","generateToastId","colorCache","constructor","maxSize","this","map","Map","get","key","has","value","delete","set","size","firstKey","keys","next","precomputedNamedTextColors","getDynamicAccessibleTextColorHex","toastBg","opa","cached","toLowerCase","textColor","r","g","b","hexMatch","match","hex","length","split","c","join","parseInt","slice","rgbMatch","Error","Number","round","luminance","a","v","pow","contrastRatio","rgb1","rgb2","L1","L2","max","min","h","s","l","rgbToHsl","d","textL","tr","tg","tb","hslToRgb","hue2rgb","p","q","t","contrastBlack","contrastWhite","result","rgbToHex","padStart","fallbackSanitize","dirty","step1","replace","container","innerHTML","ALLOWED_TAGS","Set","ALLOWED_ATTRS","sanitizeNode","node","nodeType","Node","TEXT_NODE","createTextNode","nodeValue","ELEMENT_NODE","tag","toUpperCase","frag","createDocumentFragment","Array","from","childNodes","forEach","child","sanitized","appendChild","attributes","attr","name","val","test","setAttribute","getAttribute","sanitizedChild","outFrag","wrapper","sanitizeHtml","opts","forceFallback","window","DOMPurify","e","hasDOMPurify","sanitize","ADD_ATTR","ALLOWED_URI_REGEXP","err","applyRichStyling","toast","options","onClose","durationMs","duration","endsWith","parsed","parseFloat","parseAnimationDuration","animationDuration","className","type","Object","assign","style","background","backgroundColor","padding","marginBottom","borderRadius","overflow","display","alignItems","justifyContent","boxShadow","minWidth","maxWidth","opacity","position","cursor","boxSizing","userSelect","transition","animationEasing","transform","zIndex","tabIndex","_animationDuration","messageSpan","wrapText","whiteSpace","WebkitBoxOrient","WebkitLineClamp","flex","fontPadding","fontFamily","fontSize","fontWeight","lineHeight","fontLineHeight","color","wordBreak","textOverflow","allowHtml","rawMessage","message","loader","showLoader","loaderEl","labelText","text","gap","svgNS","svg","createElementNS","String","circle","strokeDasharray","strokeDashoffset","transformOrigin","animation","lbl","textContent","getElementById","st","head","createLoader","spacer","width","trim","tmp","firstChild","cta","cfg","label","isLink","href","variant","target","rel","ariaLabel","marginLeft","border","flexShrink","onClick","res","then","autoClose","addEventListener","_cleanup","removeEventListener","createCTA","showCloseButton","closeBtn","_cleanupCloseButton","createCloseButton","showProgressBar","progressBar","borderRadiusStr","borderRadiusNum","leftVal","minSafeOffset","radiusOffset","finalWidth","left","height","progressHeight","progressColor","progressPosition","animate","_progressAnimation","easing","fill","delay","setTimeout","offsetWidth","createProgressBar","requestAnimationFrame","runToastAnimation","createEmergencyToast","emergency","top","right","wordWrap","innerWrapper","msgEl","closeSpan","cssText","removeChild","onclick","remove","body","error","alert","entries","aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen","lum","L","containerRegistry","containerLocks","getContainerId","normalizePositionKey","getOrCreateToastContainer","setPosition","isConnected","inset","flexDirection","all","querySelectorAll","i","bottom","resetContainerStyles","positionFlags","pos","hasTop","includes","hasBottom","hasLeft","hasRight","hasCenter","hasFullWidth","parsePosition","flags","handleFullWidthPositions","handleCenterPositions","applyStandardPositioning","PausableTimer","callback","remaining","startTime","timeoutId","isPaused","isCompleted","start","pause","clearTimeout","resume","clear","getRemainingTime","active","pending","queue","visibleCount","showToast","str","charCodeAt","hashString","makeKey","data","count","timer","createDismissTimer","setupPauseOnHover","updateBadge","current","entry","rafId","push","drainQueue","createOne","initialCount","TypeError","querySelector","createToastElement","closeToast","outer","inner","shouldPauseOnHover","pauseOnHover","timeout","_key","dismiss","lastToastEl","children","candidate","at","toastEl","noop","activeToasts","values","filter","Boolean","error_inner","onMouseEnter","_toast$_progressAnima","onMouseLeave","_toast$_progressAnima2","play","onFocusIn","_toast$_progressAnima3","matches","onFocusOut","_toast$_progressAnima4","contains","relatedTarget","_pauseCleanup","_data$timer","_data$outer","_data$outer$_pauseCle","call","badge","Promise","resolve","done","finish","_el$parentNode","parentNode","pointerEvents","removeElement","firstElementChild","onEnd","removeWithTransition","item","shift","HTMLElement","defaultColors","success","warning","info","defaultMessages","pendingToasts","domReady","createToastNow","sanitizedOptions","_options$position","contPosition","contMaxWidth","final","undefined","animationType","fontPosition","fontBorderRadius","fontBackgroundColor","fontDirection","isArray","_defaultMessages","_defaultColors","matchMedia","textColorResult","barColorResult","sanitizeToastOptions","createFirstToastContainer","safeMessage","substring","setDefaultColors","colors","setDefaultMessages","messages","closeInProgress","closePromise","originalCreateToast","readyState","once","checkDOMReady","createToastWithPriority","fn","runWithClosePriority","dismissToast","noopAll","managerNoop","escRegistered","onKeyDown","passive","customizableToast","createToast"],"mappings":";;;;;;;;;;;;;;aAWOA,eAAeC,EAAoBC,EAASC,GAEjD,MAAMC,EAAKC,SAASC,cAAcJ,GAElC,OADAE,EAAGG,GCNE,SAAyBJ,GAG9B,MAAO,GAAGA,KAFQK,KAAKC,MAAMC,SAAS,OACvBC,KAAKC,MAAsB,QAAhBD,KAAKE,UAAoBH,SAAS,KAE9D,CDEUI,CAAgBX,GACjBC,CACT,CAkJA,MAAMW,EAAa,IAxBnB,MACEC,WAAAA,CAAYC,EAAU,KACpBC,KAAKD,QAAUA,EACfC,KAAKC,IAAM,IAAIC,GACjB,CAEAC,GAAAA,CAAIC,GACF,IAAKJ,KAAKC,IAAII,IAAID,GAAM,OACxB,MAAME,EAAQN,KAAKC,IAAIE,IAAIC,GAG3B,OAFAJ,KAAKC,IAAIM,OAAOH,GAChBJ,KAAKC,IAAIO,IAAIJ,EAAKE,GACXA,CACT,CAEAE,GAAAA,CAAIJ,EAAKE,GACP,GAAIN,KAAKC,IAAII,IAAID,GAAMJ,KAAKC,IAAIM,OAAOH,QAClC,GAAIJ,KAAKC,IAAIQ,MAAQT,KAAKD,QAAS,CACtC,MAAMW,EAAWV,KAAKC,IAAIU,OAAOC,OAAON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buster: 1786567044727
2
+ * Customizable Toast Notifications 3.11.1
3
+ * Build: 2026-08-12 21:55:37
4
+ * Cache-Buster: 1786571737019
5
5
  * Author: Priyanshu Patel
6
- * Email: [priyanshu.alt191@gmail.com](mailto:priyanshu.alt191@gmail.com)
6
+ * Email: priyanshu.alt191@gmail.com
7
7
  * License: Apache-2.0
8
8
  * Dependencies: None
9
9
  * Created: July 31, 2024
@@ -12,4 +12,5 @@
12
12
  * Supports flexible positioning, theming, icons, animations, and timing options
13
13
  * out of the box — with CTA support and zero dependencies.
14
14
  */
15
- function t(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=Array(e);n<e;n++)o[n]=t[n];return o}function e(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,e);if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function n(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,o)}return n}function o(t){for(var o=1;o<arguments.length;o++){var r=null!=arguments[o]?arguments[o]:{};o%2?n(Object(r),!0).forEach(function(n){e(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function r(e,n){return function(t){if(Array.isArray(t))return t}(e)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var o,r,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(o=i.call(n)).done)&&(s.push(o.value),s.length!==e);l=!0);}catch(t){c=!0,r=t}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw r}}return s}}(e,n)||function(e,n){if(e){if("string"==typeof e)return t(e,n);var o={}.toString.call(e).slice(8,-1);return"Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?t(e,n):void 0}}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}async function i(t,e){const n=document.createElement(t);return n.id=function(t){const e=Date.now().toString(36),n=Math.floor(1048575*Math.random()).toString(36);return"".concat(t,"-").concat(e,"-").concat(n)}(e),n}const a=new class{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:200;this.maxSize=t,this.map=new Map}get(t){if(!this.map.has(t))return;const e=this.map.get(t);return this.map.delete(t),this.map.set(t,e),e}set(t,e){if(this.map.has(t))this.map.delete(t);else if(this.map.size>=this.maxSize){const t=this.map.keys().next().value;this.map.delete(t)}this.map.set(t,e)}}(200),s={};function l(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(!t)return"snow";const n="".concat(t,"|").concat(e),o=a.get(n);if(o)return o;if(s[null==t?void 0:t.toLowerCase()]){const e=s[t.toLowerCase()];return a.set(n,e),e}let i,l,c;try{const e=null==t?void 0:t.match(/^#([0-9a-f]{3,8})$/i);if(e){let t=e[1];3===t.length&&(t=t.split("").map(t=>t+t).join("")),i=parseInt(t.slice(0,2),16),l=parseInt(t.slice(2,4),16),c=parseInt(t.slice(4,6),16)}else{const e=null==t?void 0:t.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*[\d.]+)?\)/i);if(!e)throw new Error("Unknown color");i=Number(e[1]),l=Number(e[2]),c=Number(e[3])}}catch(t){i=50+Math.floor(206*Math.random()),l=50+Math.floor(206*Math.random()),c=50+Math.floor(206*Math.random())}i=Math.round(i*e+255*(1-e)),l=Math.round(l*e+255*(1-e)),c=Math.round(c*e+255*(1-e));const u=(t,e,n)=>{const o=[t,e,n].map(t=>(t/=255)<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4));return.2126*o[0]+.7152*o[1]+.0722*o[2]},d=(t,e)=>{const n=u(...t),o=u(...e);return(Math.max(n,o)+.05)/(Math.min(n,o)+.05)};let f=((t,e,n)=>{t/=255,e/=255,n/=255;const o=Math.max(t,e,n),r=Math.min(t,e,n);let i,a,s=(o+r)/2;if(o===r)i=a=0;else{const l=o-r;switch(a=s>.5?l/(2-o-r):l/(o+r),o){case t:i=(e-n)/l+(e<n?6:0);break;case e:i=(n-t)/l+2;break;case n:i=(t-e)/l+4}i/=6}return[360*i,a,s]})(i,l,c),m=r(f,3),p=m[0],h=m[1],y=m[2];let g=((t,e,n)=>{let o,r,i;if(t/=360,0===e)o=r=i=n;else{const a=(t,e,n)=>(n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t),s=n<.5?n*(1+e):n+e-n*e,l=2*n-s;o=a(l,s,t+1/3),r=a(l,s,t),i=a(l,s,t-1/3)}return[Math.round(255*o),Math.round(255*r),Math.round(255*i)]})(p,h,y<.5?Math.min(y+.5,1):Math.max(y-.5,0)),b=r(g,3),w=b[0],v=b[1],x=b[2];if(d([i,l,c],[w,v,x])<4.5){var C=r(d([i,l,c],[0,0,0])>=d([i,l,c],[255,255,255])?[0,0,0]:[255,255,255],3);w=C[0],v=C[1],x=C[2]}const k=((t,e,n)=>"#".concat(t.toString(16).padStart(2,"0")).concat(e.toString(16).padStart(2,"0")).concat(n.toString(16).padStart(2,"0")))(w,v,x);return a.set(n,k),k}function c(t){if(!t||"string"!=typeof t)return"";let e=t.replace(/<\/?(script|iframe|object|embed|link|meta|style|form|input|button)[^>]*>/gi,"");e=e.replace(/\s(on\w+)\s*=\s*(['"])[\s\S]*?\2/gi,""),e=e.replace(/(href|src)\s*=\s*(['"])\s*javascript:[^'"]*\2/gi,"$1=$2#$2");const n=document.createElement("div");n.innerHTML=e;const o=new Set(["DIV","SPAN","P","BR","STRONG","B","EM","I","U","SMALL","UL","OL","LI","A","IMG","PRE","CODE","MARK"]),r=new Set(["href","src","alt","title","class","target","rel"]);function i(t){if(t.nodeType===Node.TEXT_NODE)return document.createTextNode(t.nodeValue);if(t.nodeType!==Node.ELEMENT_NODE)return null;const e=t.tagName.toUpperCase();if(!o.has(e)){const e=document.createDocumentFragment();return Array.from(t.childNodes).forEach(t=>{const n=i(t);n&&e.appendChild(n)}),e}const n=document.createElement(t.tagName);return Array.from(t.attributes||[]).forEach(e=>{const o=e.name.toLowerCase(),i=e.value;r.has(o)&&("href"!==o&&"src"!==o||!/^\s*javascript:/i.test(i))&&("src"!==o||/^\s*(https?:|data:image\/)/i.test(i))&&("target"===o&&"_blank"===i&&n.setAttribute("rel",(t.getAttribute("rel")||"")+" noopener noreferrer"),n.setAttribute(o,i))}),Array.from(t.childNodes).forEach(t=>{const e=i(t);e&&n.appendChild(e)}),n}const a=document.createDocumentFragment();Array.from(n.childNodes).forEach(t=>{const e=i(t);e&&a.appendChild(e)});const s=document.createElement("div");return s.appendChild(a),s.innerHTML}function u(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!t)return"";try{if(!e.forceFallback&&function(){try{if("undefined"!=typeof window&&window.DOMPurify)return!0}catch(t){}return!1}())return window.DOMPurify.sanitize(t,{ADD_ATTR:["target"],ALLOWED_URI_REGEXP:/^(?:(?:https?|mailto|ftp|tel|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i})}catch(t){}return c(t)}async function d(t,e,n){var o,r;const i=await async function(t){if("number"==typeof t&&t>0)return t;if("string"==typeof t){if(t.endsWith("s")&&!t.endsWith("ms")){const e=1e3*parseFloat(t);return e>0?e:500}const e=parseFloat(t);return e>0?e:500}return 500}(null==e?void 0:e.animationDuration);t.className="toast toast-".concat(null!==(o=null==e?void 0:e.type)&&void 0!==o?o:"info"),Object.assign(t.style,{background:null==e?void 0:e.backgroundColor,padding:"12px 16px",marginBottom:"10px",borderRadius:null==e?void 0:e.borderRadius,overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"space-between",boxShadow:"0 4px 6px rgba(0, 0, 0, 0.1)",minWidth:"250px",maxWidth:null==e?void 0:e.maxWidth,opacity:"0",position:"relative",cursor:"default",boxSizing:"border-box",userSelect:"text",transition:"opacity ".concat(null==e?void 0:e.animationDuration," ").concat(null==e?void 0:e.animationEasing,", transform ").concat(null==e?void 0:e.animationDuration," ").concat(null==e?void 0:e.animationEasing),transform:"translateY(20px)",zIndex:"9999"}),t.setAttribute("role","alert"),t.setAttribute("aria-live","polite"),t.tabIndex=0,t._animationDuration=i;const a=document.createElement("span");null!=e&&e.wrapText?Object.assign(a.style,{display:"block",whiteSpace:"normal"}):Object.assign(a.style,{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:"3",whiteSpace:"nowrap"}),Object.assign(a.style,{flex:"1",padding:null==e?void 0:e.fontPadding,fontFamily:null==e?void 0:e.fontFamily,fontSize:null==e?void 0:e.fontSize,fontWeight:null==e?void 0:e.fontWeight,lineHeight:null==e?void 0:e.fontLineHeight,color:null==e?void 0:e.textColor,userSelect:"text",wordBreak:"break-word",overflow:"hidden",textOverflow:"ellipsis"});const s=!!e.allowHtml,l=null!==(r=e.message)&&void 0!==r?r:"";if(e.loader||e.showLoader){const t=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e=t.size||14,n=t.color||"currentColor",o=t.text||"",r=document.createElement("span");r.className="toast-loader",r.style.display="inline-flex",r.style.alignItems="center",r.style.gap="8px";const i="http://www.w3.org/2000/svg",a=document.createElementNS(i,"svg");a.setAttribute("width",String(e)),a.setAttribute("height",String(e)),a.setAttribute("viewBox","0 0 50 50"),a.setAttribute("aria-hidden","true");const s=document.createElementNS(i,"circle");if(s.setAttribute("cx","25"),s.setAttribute("cy","25"),s.setAttribute("r","20"),s.setAttribute("fill","none"),s.setAttribute("stroke",n),s.setAttribute("stroke-width","4"),s.setAttribute("stroke-linecap","round"),s.style.opacity="0.85",s.style.strokeDasharray="90",s.style.strokeDashoffset="60",s.style.transformOrigin="center",s.style.animation="toast-spinner 1s linear infinite",a.appendChild(s),r.appendChild(a),o){const t=document.createElement("span");t.style.fontSize="13px",t.textContent=o,r.appendChild(t)}if(!document.getElementById("toast-spinner-styles")){const t=document.createElement("style");t.id="toast-spinner-styles",t.innerHTML="@keyframes toast-spinner { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }",document.head.appendChild(t)}return r}(e.loader||{});a.appendChild(t);const n=document.createElement("span");n.style.display="inline-block",n.style.width="8px",a.appendChild(n)}if(s&&"string"==typeof l&&l.trim().length>0)try{const t=u(l),e=document.createElement("div");for(e.innerHTML=t;e.firstChild;)a.appendChild(e.firstChild)}catch(t){console.warn("HTML message sanitization failed, falling back to text:",t),a.textContent=l}else a.textContent=String(l);a.setAttribute("aria-label","Toast Notification Center"),a.setAttribute("title","string"==typeof l?l.replace(/<[^>]+>/g,""):String(l)),t.appendChild(a),null!=e&&e.cta&&0!==Object.keys(e.cta).length&&function(t,e,n){const o=null==e?void 0:e.cta;if(!o)return;o.label||(o.label="CTA Label Missing!");const r=!!o.href&&"link"===o.variant,i=document.createElement(r?"a":"button");r?(i.href=o.href,o.target&&(i.target=o.target),i.rel=o.rel||("_blank"===o.target?"noopener noreferrer":"")):i.type="button",i.setAttribute("aria-label",o.ariaLabel||o.label),Object.assign(i.style,{marginLeft:"10px",padding:"6px 10px",borderRadius:"6px",fontSize:"12px",fontWeight:"600",lineHeight:"1",border:"1px solid rgba(255,255,255,0.35)",color:e.textColor||"#fff",background:"rgba(255,255,255,0.15)",cursor:"pointer",whiteSpace:"nowrap",flexShrink:"0"}),i.textContent=o.label;const a=async e=>{try{if("function"==typeof o.onClick){const t=o.onClick(e);null!=t&&t.then&&await t}}finally{!1!==o.autoClose&&n(t)}};i.addEventListener("click",a),i._cleanup=()=>i.removeEventListener("click",a),t.appendChild(i)}(t,e,n),null!=e&&e.showCloseButton&&function(t,e,n){const o=document.createElement("button");o.setAttribute("aria-label","Close notification"),o.setAttribute("title","Close"),o.textContent="×",Object.assign(o.style,{background:"none",border:"none",color:e.textColor||"white",fontSize:"18px",marginLeft:"10px",cursor:"pointer"});const r=()=>n(t);o.addEventListener("click",r),t._cleanupCloseButton=()=>{o.removeEventListener("click",r)},t.appendChild(o)}(t,e,n),null!=e&&e.showProgressBar&&function(t,e){const n=document.createElement("div"),o=e.borderRadius||0,r=parseInt(o,10),i=r?"12px":"0",a=r?12:0,s=Math.max(r-10,a),l=r?"calc(100% - ".concat(s,"px)"):"100%";Object.assign(n.style,{position:"absolute",left:"".concat(i),height:e.progressHeight||"4px",background:e.progressColor||"rgba(255, 255, 255, 0.3)",width:"".concat(l),transition:"width ".concat(e.duration||1800,"ms linear"),["top"===e.progressPosition?"top":"bottom"]:"0",borderRadius:e.borderRadius||"4px"}),t.appendChild(n),"function"==typeof n.animate?t._progressAnimation=n.animate([{width:l},{width:"0%"}],{duration:Number(e.duration)||1800,easing:"linear",fill:"forwards",delay:50}):(n.style.transition="width ".concat(e.duration||1800,"ms linear"),setTimeout(()=>{n.offsetWidth,n.style.width="0%"},50))}(t,e),function(t){setTimeout(()=>{requestAnimationFrame(()=>{t.style.opacity="1",t.style.transform="translateY(0)"})},50)}(t)}async function f(t,e){try{const n=document.createElement("div");Object.assign(n.style,{background:"#333",color:"white",padding:"10px 15px",position:"fixed",top:"20px",right:"20px",zIndex:"99999",borderRadius:"3px",maxWidth:"250px",wordWrap:"break-word",boxShadow:"0 2px 10px rgba(0,0,0,0.3)",cursor:"pointer"});const o=document.createElement("div"),r=document.createElement("span");r.style.display="inline-block",t.allowHtml?r.innerHTML=u(String(t.message||"Emergency Toast Showing!")):r.textContent=String(t.message||"Emergency Toast Creation Showing!"),o.appendChild(r);const i=document.createElement("span");for(i.style.cssText="float: right; margin-left: 10px; font-weight: bold;",i.textContent="×",o.appendChild(i);n.firstChild;)n.removeChild(n.firstChild);return n.appendChild(o),i.onclick=()=>{n.remove(),e(n)},document.body.appendChild(n),setTimeout(()=>{n.remove(),e(n)},null==t?void 0:t.duration),n}catch(n){return console.error("Emergency toast creation failed:",n),setTimeout(()=>{alert((null==t?void 0:t.message)||"Emergency Toast Creation Showing!"),e(null)},100),null}}Object.entries({aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}).forEach(t=>{let e=r(t,2),n=e[0],o=r(e[1],3),i=o[0],a=o[1],l=o[2];const c=t=>{const e=t/255;return e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)},u=.2126*c(i)+.7152*c(a)+.0722*c(l),d=(u+.05)/.05,f=1.05/(u+.05);s[n.toLowerCase()]=d>=f?"#000000":"#ffffff"});const m=new Map,p=new Map;function h(t){return"toast-container-".concat(function(t){return String(t).toLowerCase().trim().replace(/\bbelow\b/g,"bottom").replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"-").replace(/-{2,}/g,"-")}(t))}async function y(t,e){const n=h(t.position);if(p.has(n))return p.get(n);const o=(async()=>{const o=m.get(n);if(null!=o&&o.isConnected)return o;let r=document.getElementById(n);r&&!r.isConnected&&document.body.appendChild(r),r?(r.style.position=r.style.position||"fixed",r.style.zIndex=r.style.zIndex||"9999","function"==typeof e&&await e(r,t)):(r=document.createElement("div"),r.id=n,r.setAttribute("role","status"),r.setAttribute("aria-atomic","true"),r.style.position="fixed",r.style.zIndex="9999",r.style.inset="auto 10px 10px auto",r.style.display="flex",r.style.justifyContent="space-between",r.style.alignItems="center",r.style.flexDirection="column",r.style.overflow="hidden","function"==typeof e&&await e(r,t),document.body.appendChild(r));const i=document.querySelectorAll("#".concat(n));if(i.length>1)for(let t=1;t<i.length;t++)try{i[t].remove()}catch(t){}return m.set(n,r),r})();p.set(n,o);try{return await o}finally{p.delete(h(t.position))}}async function g(t,e){if(!t||!e.position)throw new Error("Invalid container or position!");!function(t){t.style.top="auto",t.style.bottom="auto",t.style.left="auto",t.style.right="auto",t.style.transform="none"}(t);const n=function(t){const e=t.toLowerCase().trim();return{hasTop:e.includes("top"),hasBottom:e.includes("bottom")||e.includes("below"),hasLeft:e.includes("left"),hasRight:e.includes("right"),hasCenter:e.includes("center"),hasFullWidth:e.includes("top-full-width")||e.includes("bottom-full-width")||e.includes("fullwidth")}}(e.position);(function(t,e,n){if(!n.hasFullWidth)return!1;if(e.maxWidth="100vw",n.hasTop)return t.style.top="10px",t.style.left="10px",t.style.right="10px",!0;if(n.hasBottom)return t.style.bottom="10px",t.style.left="10px",t.style.right="10px",!0;return!1})(t,e,n)||function(t,e){if(!e.hasCenter)return!1;if(e.hasTop&&!e.hasLeft&&!e.hasRight)return t.style.top="10px",t.style.left="50%",t.style.transform="translateX(-50%)",!0;if(e.hasBottom&&!e.hasLeft&&!e.hasRight)return t.style.bottom="10px",t.style.left="50%",t.style.transform="translateX(-50%)",!0;if(e.hasLeft&&!e.hasTop&&!e.hasBottom)return t.style.left="10px",t.style.top="50%",t.style.transform="translateY(-50%)",!0;if(e.hasRight&&!e.hasTop&&!e.hasBottom)return t.style.right="10px",t.style.top="50%",t.style.transform="translateY(-50%)",!0;if(!(e.hasLeft||e.hasRight||e.hasTop||e.hasBottom))return t.style.top="50%",t.style.left="50%",t.style.transform="translate(-50%, -50%)",!0;return!1}(t,n)||function(t,e){e.hasBottom?t.style.bottom="10px":e.hasTop&&(t.style.top="10px");e.hasRight?t.style.right="10px":e.hasLeft?t.style.left="10px":(e.hasBottom||e.hasTop||(t.style.bottom="10px"),t.style.left="50%",t.style.transform="translateX(-50%)")}(t,n)}class b{constructor(t,e){this.callback=t,this.delay=e,this.remaining=e,this.startTime=null,this.timeoutId=null,this.isPaused=!1,this.isCompleted=!1}start(){return this.isCompleted||this.timeoutId||(this.startTime=Date.now(),this.timeoutId=setTimeout(()=>{this.isCompleted=!0,this.timeoutId=null,this.callback()},this.remaining)),this}pause(){return this.isPaused||!this.timeoutId||this.isCompleted||(clearTimeout(this.timeoutId),this.timeoutId=null,this.remaining-=Date.now()-this.startTime,this.remaining=Math.max(0,this.remaining),this.isPaused=!0),this}resume(){return!this.isPaused||this.isCompleted||(this.isPaused=!1,this.start()),this}clear(){return this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null),this.isCompleted=!0,this}getRemainingTime(){return this.isCompleted?0:this.isPaused?this.remaining:this.timeoutId?Math.max(0,this.remaining-(Date.now()-this.startTime)):this.delay}}const w=new Map,v=new Map,x=[];let C=0;async function k(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{const e=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e=String(t.type).trim().toLowerCase(),n=function(t){let e=5381;for(let n=0;n<t.length;n++)e=(e<<5)+e+t.charCodeAt(n);return e>>>0}(String(t.message||"")).toString(16),o=String(t.position).trim().toLowerCase();return"".concat(e,"|").concat(n,"|").concat(o)}(t);if(w.has(e)){const n=w.get(e);if(!n)throw new Error("Active toast with key ".concat(e," not found"));return n.count++,n.timer.clear(),n.timer=A(n.toast,t),await M(n),void await j(n)}if(v.has(e)){const t=v.get(e);if(!t)throw new Error("Pending toast with key ".concat(e," not found"));return void t.count++}const n={options:t,count:1,rafId:0};v.set(e,n),n.rafId=requestAnimationFrame(async()=>{const t=v.get(e);if(t){if(v.delete(e),C>=3)return x.push({options:t.options,key:e,count:t.count}),void await O();try{await E(t.options,e,t.count)}catch(t){console.error("showToast failed:",t)}}})}catch(t){console.error("showToast failed:",t)}}async function E(t,e,n){try{if(!t||"object"!=typeof t)throw new TypeError("options must be an object");C++;const o=await y(t,g);if(!o)throw new Error("Failed to create toast container");const r=await async function(t,e){if(!document.querySelector('[id^="toast-container-"]'))return null;let n;try{return n=await i("div","toast"),await d(n,t,e),n}catch(o){return console.warn("toast creation failed with error showing fallback one: ",o),n=await f(t,e),n}}(t,L);if(!r)throw new Error("Toast element creation failed");const a=document.createElement("div");Object.assign(a.style,{position:"relative",display:"inline-block",overflow:"visible",marginBottom:"10px",zIndex:"0",width:"100%"});const s=document.createElement("div");Object.assign(s.style,{position:"relative",overflow:"hidden",zIndex:"1"}),s.appendChild(r),a.appendChild(s),o.id.includes("toast-container-")&&o.appendChild(a);const l=!1!==t.pauseOnHover&&(!0===t.pauseOnHover||!!t.cta),c={outer:a,toast:r,count:Math.max(1,Math.floor(null!=n?n:0)),timeout:null,pauseOnHover:l};w.set(e,c),r._key=e,c.count>1&&await j(c),c.timer=A(r,t),await M(c)}catch(e){console.error("Something went wrong: ",e),C=Math.max(0,C-1);(document.querySelector('[id^="toast-container-"]')||document.body).appendChild(await f(t,L))}}const S=async function(){try{if(0===w.size)return;let t=null;if(document.querySelectorAll('[id^="toast-container-"]').forEach(e=>{const n=Array.from(e.children||[]);if(0===n.length)return;const o=n.at(-1);o&&(t=o.querySelector('[id^="toast-"]')||o)}),!t){const e=Array.from(w.entries());if(e.length>0){const n=e.at(-1),o=r(n,2)[1];t=o.toast||o.outer&&o.outer.querySelector('[id^="toast-"]')}}if(!t)return;const e=t._key?t:t.querySelector('[id^="toast-"]')||t;await L(e)}catch(t){console.error("dismissMostRecent failed:",t)}},T=async function(){try{const t=Array.from(w.values()).map(t=>t.toast).filter(Boolean);x.length=0,v.clear();for(const e of t)try{await L(e)}catch(t){console.warn("closeAllToasts: failed to close one toast:",t)}}catch(t){console.error("closeAllToasts failed:",t)}};function A(t,e){var n;const o=Number(null!==(n=e.duration)&&void 0!==n?n:1800)+5,r=new b(async()=>await L(t),o);return r.start(),r}async function M(t){if(!t.pauseOnHover||!t.outer||!t.timer)return;const e=t.outer,n=t.timer,o=t.toast,r=()=>{var t;n.pause(),null==o||null===(t=o._progressAnimation)||void 0===t||t.pause()},i=()=>{var t;n.resume(),null==o||null===(t=o._progressAnimation)||void 0===t||t.play()},a=t=>{var e;t.target.matches("[tabindex], div, span, button, a")&&(n.pause(),null==o||null===(e=o._progressAnimation)||void 0===e||e.pause())},s=t=>{var r;e.contains(t.relatedTarget)||(n.resume(),null==o||null===(r=o._progressAnimation)||void 0===r||r.play())};e.addEventListener("mouseenter",r),e.addEventListener("mouseleave",i),e.addEventListener("focusin",a),e.addEventListener("focusout",s),e._pauseCleanup=()=>{e.removeEventListener("mouseenter",r),e.removeEventListener("mouseleave",i),e.removeEventListener("focusin",a),e.removeEventListener("focusout",s)}}async function L(t){try{var e,n,o;if(null==t||!t._key)return;const r=w.get(t._key);if(!r)return;null===(e=r.timer)||void 0===e||e.clear(),null===(n=r.outer)||void 0===n||null===(o=n._pauseCleanup)||void 0===o||o.call(n),w.delete(t._key),C=Math.max(0,C-1);const i=r.outer.querySelector(".toast-count-badge");i&&i.remove(),await async function(t){return t?new Promise(e=>{let n=!1;const o=()=>{n||(n=!0,async function(t){if(!t)return!0;try{var e;if(null!=t&&null!==(e=t.parentNode)&&void 0!==e&&e.id.includes("toast-container-"))return t.parentNode.removeChild(t),!0}catch(t){}try{if(t.remove)return t.remove(),!0}catch(t){}try{return Object.assign(t.style,{display:"none",opacity:"0",pointerEvents:"none",position:"absolute",left:"-9999px"}),!0}catch(t){}}(t),e())},r=t.firstElementChild||t;if(!r)return e();const i=t=>{try{if(t.target!==r)return;r.removeEventListener("transitionend",i,!0),o()}catch(t){console.error("removeWithTransition error:",t)}};try{r.addEventListener("transitionend",i,!0)}catch(t){console.error("removeWithTransition error:",t)}setTimeout(()=>{try{r.removeEventListener("transitionend",i,!0),o()}catch(t){console.error("removeWithTransition error:",t)}},700)}):Promise.resolve()}(r.outer),await O()}catch(t){console.error("Closing Toast failed!: ",t)}}async function O(){for(;C<3&&x.length;){const t=x.shift();if(w.has(t.key)){const e=w.get(t.key);e.count+=t.count,await j(e);continue}E(t.options,t.key,t.count)}}async function j(t){let e=t.outer,n=t.count;if(!(e&&e instanceof HTMLElement))throw new Error("updateBadge: outer must be a valid HTMLElement");if(n<2){const t=e.querySelector(".toast-count-badge");return void(t&&t.remove())}let o=e.querySelector(".toast-count-badge");o||(o=document.createElement("span"),o.className="toast-count-badge",o.setAttribute("aria-label","".concat(n," identical notifications")),Object.assign(o.style,{position:"absolute",top:"6px",right:"6px",backgroundColor:"#f44336",color:"#fff",borderRadius:"50%",minWidth:"20px",height:"20px",fontSize:"12px",fontWeight:"600",display:"flex",alignItems:"center",justifyContent:"center",border:"2px solid #fff",boxShadow:"0 2px 6px rgba(0,0,0,0.3)",zIndex:"2",pointerEvents:"none",transition:"transform 150ms ease"}),e.appendChild(o)),o.textContent=n>99?"99+":String(n);try{o.style.transform="scale(1.2)",setTimeout(()=>o.style.transform="scale(1)",150)}catch(t){console.error("updateBadge animation error:",t)}}let I={success:"#28a745",error:"#dc3545",warning:"#ffc107",info:"#17a2b8"},P={success:"Operation completed successfully!",error:"Something went wrong!",warning:"Warning message!",info:"Information message!"};const D=[];let z=!1;async function N(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{const e=await async function(t){var e,n;const r=null==t||null===(e=t.position)||void 0===e||null===(e=e.toLowerCase())||void 0===e?void 0:e.trim(),i=null!=r&&r.includes("top-full-width")||null!=r&&r.includes("bottom-full-width")?"100vw":"400px",a=o(o({},{allowHtml:!1,sanitizeHtml:!0,pauseOnHover:void 0,duration:2500,position:"bottom-right",type:"info",borderRadius:"50px",backgroundColor:void 0,textColor:void 0,showCloseButton:!0,animationDuration:"0.4s",animationType:"fade",animationEasing:"ease",showProgressBar:!0,progressColor:void 0,progressHeight:"4px",progressPosition:"bottom",fontPosition:"relative",fontPadding:void 0,fontBorderRadius:void 0,fontBackgroundColor:void 0,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',fontSize:"14px",fontWeight:"400",fontLineHeight:"1.4",fontDirection:"auto",wrapText:"normal",maxWidth:i}),"object"!=typeof t||Array.isArray(t)?{}:t);a.message=null!==(n=null==t?void 0:t.message)&&void 0!==n?n:a.message;try{var s,c,u;if(!a.backgroundColor)a.backgroundColor=null!==(c=null===(u=I)||void 0===u?void 0:u[a.type])&&void 0!==c?c:window.matchMedia("(prefers-color-scheme: dark)").matches?"#f5f5f5":"#111111";if(a.message=a.message||(null===(s=P)||void 0===s?void 0:s[a.type])||"No Message Provided!",!a.textColor&&a.backgroundColor){const t=l(a.backgroundColor);a.textColor=t}if(!a.progressColor&&a.backgroundColor)if(a.textColor)a.progressColor=a.textColor;else{const t=l(a.backgroundColor);a.progressColor=t}}catch(t){console.warn("Option processing failed:",t)}"string"!=typeof a.message&&(a.message="No Message Provided!");return a}(t);await async function(t){try{return await y(t,g)}catch(t){return console.error("Failed to create toast container:",t),document.body}}(e),await k(e)}catch(e){console.error("CreateToast failed:",e);const n="string"==typeof(null==t?void 0:t.message)&&null!==(null==t?void 0:t.message)?"".concat(t.message.substring(0,200)," toast creation failed!"):"Toast creation failed!";alert(n)}}function B(t){try{t&&"object"==typeof t&&!Array.isArray(t)&&(I=o(o({},I),t))}catch(t){console.error("setDefaultColors failed:",t)}}function R(t){try{t&&"object"==typeof t&&!Array.isArray(t)&&(P=o(o({},P),t))}catch(t){console.error("setDefaultMessages failed:",t)}}let W=!1,H=null;const _=async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"undefined"!=typeof window&&"undefined"!=typeof document?(await async function(){z||"undefined"!=typeof window&&"undefined"!=typeof document&&("complete"===document.readyState||"interactive"===document.readyState?(z=!0,D.forEach(t=>setTimeout(()=>N(t),2500)),D.length=0):document.addEventListener("DOMContentLoaded",()=>{z=!0,D.forEach(t=>setTimeout(()=>N(t),2500)),D.length=0},{once:!0}))}(),z?await N(t):D.push(t)):console.warn("ToastNotification: running in non-browser environment, no DOM available.")};async function q(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return async function(t){if(W&&H)try{await H}catch(t){}return t()}(()=>_(t))}const F=async()=>{W=!0,H=(async()=>{try{await S()}finally{W=!1,H=null}})(),await H},U=async()=>{W=!0,H=(async()=>{try{await T()}finally{W=!1,H=null}})(),await H};if("undefined"!=typeof window&&"undefined"!=typeof document){let t=!1;if(!t){const e=t=>{"Escape"!==t.key&&"Esc"!==t.key||(async()=>{W=!0,H=(async()=>{try{await S()}finally{W=!1,H=null}})(),await H})()};window.addEventListener("keydown",e,{passive:!0}),t=!0}}try{"undefined"!=typeof window&&(window.customizableToast={createToast:q,setDefaultColors:B,setDefaultMessages:R,noop:U,dismiss:F})}catch(t){console.error("Global assignment failed:",t)}export{q as createToast,F as dismiss,F as dismissToast,U as noop,U as noopAll,B as setDefaultColors,R as setDefaultMessages};
15
+ function t(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=Array(e);n<e;n++)o[n]=t[n];return o}function e(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,e);if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function n(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,o)}return n}function o(t){for(var o=1;o<arguments.length;o++){var r=null!=arguments[o]?arguments[o]:{};o%2?n(Object(r),!0).forEach(function(n){e(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function r(e,n){return function(t){if(Array.isArray(t))return t}(e)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var o,r,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(o=i.call(n)).done)&&(s.push(o.value),s.length!==e);l=!0);}catch(t){c=!0,r=t}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw r}}return s}}(e,n)||function(e,n){if(e){if("string"==typeof e)return t(e,n);var o={}.toString.call(e).slice(8,-1);return"Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?t(e,n):void 0}}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}async function i(t,e){const n=document.createElement(t);return n.id=function(t){const e=Date.now().toString(36),n=Math.floor(1048575*Math.random()).toString(36);return"".concat(t,"-").concat(e,"-").concat(n)}(e),n}const a=new class{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:200;this.maxSize=t,this.map=new Map}get(t){if(!this.map.has(t))return;const e=this.map.get(t);return this.map.delete(t),this.map.set(t,e),e}set(t,e){if(this.map.has(t))this.map.delete(t);else if(this.map.size>=this.maxSize){const t=this.map.keys().next().value;this.map.delete(t)}this.map.set(t,e)}}(200),s={};function l(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(!t)return"snow";const n="".concat(t,"|").concat(e),o=a.get(n);if(o)return o;if(s[null==t?void 0:t.toLowerCase()]){const e=s[t.toLowerCase()];return a.set(n,e),e}let i,l,c;try{const e=null==t?void 0:t.match(/^#([0-9a-f]{3,8})$/i);if(e){let t=e[1];3===t.length&&(t=t.split("").map(t=>t+t).join("")),i=parseInt(t.slice(0,2),16),l=parseInt(t.slice(2,4),16),c=parseInt(t.slice(4,6),16)}else{const e=null==t?void 0:t.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*[\d.]+)?\)/i);if(!e)throw new Error("Unknown color");i=Number(e[1]),l=Number(e[2]),c=Number(e[3])}}catch(t){i=50+Math.floor(206*Math.random()),l=50+Math.floor(206*Math.random()),c=50+Math.floor(206*Math.random())}i=Math.round(i*e+255*(1-e)),l=Math.round(l*e+255*(1-e)),c=Math.round(c*e+255*(1-e));const u=(t,e,n)=>{const o=[t,e,n].map(t=>(t/=255)<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4));return.2126*o[0]+.7152*o[1]+.0722*o[2]},d=(t,e)=>{const n=u(...t),o=u(...e);return(Math.max(n,o)+.05)/(Math.min(n,o)+.05)};let m=((t,e,n)=>{t/=255,e/=255,n/=255;const o=Math.max(t,e,n),r=Math.min(t,e,n);let i,a,s=(o+r)/2;if(o===r)i=a=0;else{const l=o-r;switch(a=s>.5?l/(2-o-r):l/(o+r),o){case t:i=(e-n)/l+(e<n?6:0);break;case e:i=(n-t)/l+2;break;case n:i=(t-e)/l+4}i/=6}return[360*i,a,s]})(i,l,c),f=r(m,3),p=f[0],h=f[1],y=f[2];let g=((t,e,n)=>{let o,r,i;if(t/=360,0===e)o=r=i=n;else{const a=(t,e,n)=>(n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t),s=n<.5?n*(1+e):n+e-n*e,l=2*n-s;o=a(l,s,t+1/3),r=a(l,s,t),i=a(l,s,t-1/3)}return[Math.round(255*o),Math.round(255*r),Math.round(255*i)]})(p,h,y<.5?Math.min(y+.5,1):Math.max(y-.5,0)),b=r(g,3),w=b[0],v=b[1],x=b[2];if(d([i,l,c],[w,v,x])<4.5){var C=r(d([i,l,c],[0,0,0])>=d([i,l,c],[255,255,255])?[0,0,0]:[255,255,255],3);w=C[0],v=C[1],x=C[2]}const k=((t,e,n)=>"#".concat(t.toString(16).padStart(2,"0")).concat(e.toString(16).padStart(2,"0")).concat(n.toString(16).padStart(2,"0")))(w,v,x);return a.set(n,k),k}function c(t){if(!t||"string"!=typeof t)return"";let e=t.replace(/<\/?(script|iframe|object|embed|link|meta|style|form|input|button)[^>]*>/gi,"");e=e.replace(/\s(on\w+)\s*=\s*(['"])[\s\S]*?\2/gi,""),e=e.replace(/(href|src)\s*=\s*(['"])\s*javascript:[^'"]*\2/gi,"$1=$2#$2");const n=document.createElement("div");n.innerHTML=e;const o=new Set(["DIV","SPAN","P","BR","STRONG","B","EM","I","U","SMALL","UL","OL","LI","A","IMG","PRE","CODE","MARK"]),r=new Set(["href","src","alt","title","class","target","rel"]);function i(t){if(t.nodeType===Node.TEXT_NODE)return document.createTextNode(t.nodeValue);if(t.nodeType!==Node.ELEMENT_NODE)return null;const e=t.tagName.toUpperCase();if(!o.has(e)){const e=document.createDocumentFragment();return Array.from(t.childNodes).forEach(t=>{const n=i(t);n&&e.appendChild(n)}),e}const n=document.createElement(t.tagName);return Array.from(t.attributes||[]).forEach(e=>{const o=e.name.toLowerCase(),i=e.value;r.has(o)&&("href"!==o&&"src"!==o||!/^\s*javascript:/i.test(i))&&("src"!==o||/^\s*(https?:|data:image\/)/i.test(i))&&("target"===o&&"_blank"===i&&n.setAttribute("rel",(t.getAttribute("rel")||"")+" noopener noreferrer"),n.setAttribute(o,i))}),Array.from(t.childNodes).forEach(t=>{const e=i(t);e&&n.appendChild(e)}),n}const a=document.createDocumentFragment();Array.from(n.childNodes).forEach(t=>{const e=i(t);e&&a.appendChild(e)});const s=document.createElement("div");return s.appendChild(a),s.innerHTML}function u(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!t)return"";try{if(!e.forceFallback&&function(){try{if("undefined"!=typeof window&&window.DOMPurify)return!0}catch(t){}return!1}())return window.DOMPurify.sanitize(t,{ADD_ATTR:["target"],ALLOWED_URI_REGEXP:/^(?:(?:https?|mailto|ftp|tel|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i})}catch(t){}return c(t)}async function d(t,e,n){var o,r;const i=await async function(t){if("number"==typeof t&&t>0)return t;if("string"==typeof t){if(t.endsWith("s")&&!t.endsWith("ms")){const e=1e3*parseFloat(t);return e>0?e:500}const e=parseFloat(t);return e>0?e:500}return 500}(null==e?void 0:e.animationDuration);t.className="toast toast-".concat(null!==(o=null==e?void 0:e.type)&&void 0!==o?o:"info"),Object.assign(t.style,{background:null==e?void 0:e.backgroundColor,padding:"12px 16px",marginBottom:"10px",borderRadius:null==e?void 0:e.borderRadius,overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"space-between",boxShadow:"0 4px 6px rgba(0, 0, 0, 0.1)",minWidth:"250px",maxWidth:null==e?void 0:e.maxWidth,opacity:"0",position:"relative",cursor:"default",boxSizing:"border-box",userSelect:"text",transition:"opacity ".concat(null==e?void 0:e.animationDuration," ").concat(null==e?void 0:e.animationEasing,", transform ").concat(null==e?void 0:e.animationDuration," ").concat(null==e?void 0:e.animationEasing),transform:"translateY(20px)",zIndex:"9999"}),t.setAttribute("role","alert"),t.setAttribute("aria-live","polite"),t.tabIndex=0,t._animationDuration=i;const a=document.createElement("span");null!=e&&e.wrapText?Object.assign(a.style,{display:"block",whiteSpace:"normal"}):Object.assign(a.style,{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:"3",whiteSpace:"nowrap"}),Object.assign(a.style,{flex:"1",padding:null==e?void 0:e.fontPadding,fontFamily:null==e?void 0:e.fontFamily,fontSize:null==e?void 0:e.fontSize,fontWeight:null==e?void 0:e.fontWeight,lineHeight:null==e?void 0:e.fontLineHeight,color:null==e?void 0:e.textColor,userSelect:"text",wordBreak:"break-word",overflow:"hidden",textOverflow:"ellipsis"});const s=!!e.allowHtml,l=null!==(r=e.message)&&void 0!==r?r:"";if(e.loader||e.showLoader){const t=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e=t.size||14,n=t.color||"currentColor",o=t.text||"",r=document.createElement("span");r.className="toast-loader",r.style.display="inline-flex",r.style.alignItems="center",r.style.gap="8px";const i="http://www.w3.org/2000/svg",a=document.createElementNS(i,"svg");a.setAttribute("width",String(e)),a.setAttribute("height",String(e)),a.setAttribute("viewBox","0 0 50 50"),a.setAttribute("aria-hidden","true");const s=document.createElementNS(i,"circle");if(s.setAttribute("cx","25"),s.setAttribute("cy","25"),s.setAttribute("r","20"),s.setAttribute("fill","none"),s.setAttribute("stroke",n),s.setAttribute("stroke-width","4"),s.setAttribute("stroke-linecap","round"),s.style.opacity="0.85",s.style.strokeDasharray="90",s.style.strokeDashoffset="60",s.style.transformOrigin="center",s.style.animation="toast-spinner 1s linear infinite",a.appendChild(s),r.appendChild(a),o){const t=document.createElement("span");t.style.fontSize="13px",t.textContent=o,r.appendChild(t)}if(!document.getElementById("toast-spinner-styles")){const t=document.createElement("style");t.id="toast-spinner-styles",t.innerHTML="@keyframes toast-spinner { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }",document.head.appendChild(t)}return r}(e.loader||{});a.appendChild(t);const n=document.createElement("span");n.style.display="inline-block",n.style.width="8px",a.appendChild(n)}if(s&&"string"==typeof l&&l.trim().length>0)try{const t=u(l),e=document.createElement("div");for(e.innerHTML=t;e.firstChild;)a.appendChild(e.firstChild)}catch(t){a.textContent=l}else a.textContent=String(l);a.setAttribute("aria-label","Toast Notification Center"),a.setAttribute("title","string"==typeof l?l.replace(/<[^>]+>/g,""):String(l)),t.appendChild(a),null!=e&&e.cta&&0!==Object.keys(e.cta).length&&function(t,e,n){const o=null==e?void 0:e.cta;if(!o)return;o.label||(o.label="CTA Label Missing!");const r=!!o.href&&"link"===o.variant,i=document.createElement(r?"a":"button");r?(i.href=o.href,o.target&&(i.target=o.target),i.rel=o.rel||("_blank"===o.target?"noopener noreferrer":"")):i.type="button",i.setAttribute("aria-label",o.ariaLabel||o.label),Object.assign(i.style,{marginLeft:"10px",padding:"6px 10px",borderRadius:"6px",fontSize:"12px",fontWeight:"600",lineHeight:"1",border:"1px solid rgba(255,255,255,0.35)",color:e.textColor||"#fff",background:"rgba(255,255,255,0.15)",cursor:"pointer",whiteSpace:"nowrap",flexShrink:"0"}),i.textContent=o.label;const a=async e=>{try{if("function"==typeof o.onClick){const t=o.onClick(e);null!=t&&t.then&&await t}}finally{!1!==o.autoClose&&n(t)}};i.addEventListener("click",a),i._cleanup=()=>i.removeEventListener("click",a),t.appendChild(i)}(t,e,n),null!=e&&e.showCloseButton&&function(t,e,n){const o=document.createElement("button");o.setAttribute("aria-label","Close notification"),o.setAttribute("title","Close"),o.textContent="×",Object.assign(o.style,{background:"none",border:"none",color:e.textColor||"white",fontSize:"18px",marginLeft:"10px",cursor:"pointer"});const r=()=>n(t);o.addEventListener("click",r),t._cleanupCloseButton=()=>{o.removeEventListener("click",r)},t.appendChild(o)}(t,e,n),null!=e&&e.showProgressBar&&function(t,e){const n=document.createElement("div"),o=e.borderRadius||0,r=parseInt(o,10),i=r?"12px":"0",a=r?12:0,s=Math.max(r-10,a),l=r?"calc(100% - ".concat(s,"px)"):"100%";Object.assign(n.style,{position:"absolute",left:"".concat(i),height:e.progressHeight||"4px",background:e.progressColor||"rgba(255, 255, 255, 0.3)",width:"".concat(l),transition:"width ".concat(e.duration||1800,"ms linear"),["top"===e.progressPosition?"top":"bottom"]:"0",borderRadius:e.borderRadius||"4px"}),t.appendChild(n),"function"==typeof n.animate?t._progressAnimation=n.animate([{width:l},{width:"0%"}],{duration:Number(e.duration)||1800,easing:"linear",fill:"forwards",delay:50}):(n.style.transition="width ".concat(e.duration||1800,"ms linear"),setTimeout(()=>{n.offsetWidth,n.style.width="0%"},50))}(t,e),function(t){setTimeout(()=>{requestAnimationFrame(()=>{t.style.opacity="1",t.style.transform="translateY(0)"})},50)}(t)}async function m(t,e){try{const n=document.createElement("div");Object.assign(n.style,{background:"#333",color:"white",padding:"10px 15px",position:"fixed",top:"20px",right:"20px",zIndex:"99999",borderRadius:"3px",maxWidth:"250px",wordWrap:"break-word",boxShadow:"0 2px 10px rgba(0,0,0,0.3)",cursor:"pointer"});const o=document.createElement("div"),r=document.createElement("span");r.style.display="inline-block",t.allowHtml?r.innerHTML=u(String(t.message||"Emergency Toast Showing!")):r.textContent=String(t.message||"Emergency Toast Creation Showing!"),o.appendChild(r);const i=document.createElement("span");for(i.style.cssText="float: right; margin-left: 10px; font-weight: bold;",i.textContent="×",o.appendChild(i);n.firstChild;)n.removeChild(n.firstChild);return n.appendChild(o),i.onclick=()=>{n.remove(),e(n)},document.body.appendChild(n),setTimeout(()=>{n.remove(),e(n)},null==t?void 0:t.duration),n}catch(n){return setTimeout(()=>{alert((null==t?void 0:t.message)||"Emergency Toast Creation Showing!"),e(null)},100),null}}Object.entries({aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}).forEach(t=>{let e=r(t,2),n=e[0],o=r(e[1],3),i=o[0],a=o[1],l=o[2];const c=t=>{const e=t/255;return e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)},u=.2126*c(i)+.7152*c(a)+.0722*c(l),d=(u+.05)/.05,m=1.05/(u+.05);s[n.toLowerCase()]=d>=m?"#000000":"#ffffff"});const f=new Map,p=new Map;function h(t){return"toast-container-".concat(function(t){return String(t).toLowerCase().trim().replace(/\bbelow\b/g,"bottom").replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"-").replace(/-{2,}/g,"-")}(t))}async function y(t,e){const n=h(t.position);if(p.has(n))return p.get(n);const o=(async()=>{const o=f.get(n);if(null!=o&&o.isConnected)return o;let r=document.getElementById(n);r&&!r.isConnected&&document.body.appendChild(r),r?(r.style.position=r.style.position||"fixed",r.style.zIndex=r.style.zIndex||"9999","function"==typeof e&&await e(r,t)):(r=document.createElement("div"),r.id=n,r.setAttribute("role","status"),r.setAttribute("aria-atomic","true"),r.style.position="fixed",r.style.zIndex="9999",r.style.inset="auto 10px 10px auto",r.style.display="flex",r.style.justifyContent="space-between",r.style.alignItems="center",r.style.flexDirection="column",r.style.overflow="hidden","function"==typeof e&&await e(r,t),document.body.appendChild(r));const i=document.querySelectorAll("#".concat(n));if(i.length>1)for(let t=1;t<i.length;t++)try{i[t].remove()}catch(t){}return f.set(n,r),r})();p.set(n,o);try{return await o}finally{p.delete(h(t.position))}}async function g(t,e){if(!t||!e.position)throw new Error("Invalid container or position!");!function(t){t.style.top="auto",t.style.bottom="auto",t.style.left="auto",t.style.right="auto",t.style.transform="none"}(t);const n=function(t){const e=t.toLowerCase().trim();return{hasTop:e.includes("top"),hasBottom:e.includes("bottom")||e.includes("below"),hasLeft:e.includes("left"),hasRight:e.includes("right"),hasCenter:e.includes("center"),hasFullWidth:e.includes("top-full-width")||e.includes("bottom-full-width")||e.includes("fullwidth")}}(e.position);(function(t,e,n){if(!n.hasFullWidth)return!1;if(e.maxWidth="100vw",n.hasTop)return t.style.top="10px",t.style.left="10px",t.style.right="10px",!0;if(n.hasBottom)return t.style.bottom="10px",t.style.left="10px",t.style.right="10px",!0;return!1})(t,e,n)||function(t,e){if(!e.hasCenter)return!1;if(e.hasTop&&!e.hasLeft&&!e.hasRight)return t.style.top="10px",t.style.left="50%",t.style.transform="translateX(-50%)",!0;if(e.hasBottom&&!e.hasLeft&&!e.hasRight)return t.style.bottom="10px",t.style.left="50%",t.style.transform="translateX(-50%)",!0;if(e.hasLeft&&!e.hasTop&&!e.hasBottom)return t.style.left="10px",t.style.top="50%",t.style.transform="translateY(-50%)",!0;if(e.hasRight&&!e.hasTop&&!e.hasBottom)return t.style.right="10px",t.style.top="50%",t.style.transform="translateY(-50%)",!0;if(!(e.hasLeft||e.hasRight||e.hasTop||e.hasBottom))return t.style.top="50%",t.style.left="50%",t.style.transform="translate(-50%, -50%)",!0;return!1}(t,n)||function(t,e){e.hasBottom?t.style.bottom="10px":e.hasTop&&(t.style.top="10px");e.hasRight?t.style.right="10px":e.hasLeft?t.style.left="10px":(e.hasBottom||e.hasTop||(t.style.bottom="10px"),t.style.left="50%",t.style.transform="translateX(-50%)")}(t,n)}class b{constructor(t,e){this.callback=t,this.delay=e,this.remaining=e,this.startTime=null,this.timeoutId=null,this.isPaused=!1,this.isCompleted=!1}start(){return this.isCompleted||this.timeoutId||(this.startTime=Date.now(),this.timeoutId=setTimeout(()=>{this.isCompleted=!0,this.timeoutId=null,this.callback()},this.remaining)),this}pause(){return this.isPaused||!this.timeoutId||this.isCompleted||(clearTimeout(this.timeoutId),this.timeoutId=null,this.remaining-=Date.now()-this.startTime,this.remaining=Math.max(0,this.remaining),this.isPaused=!0),this}resume(){return!this.isPaused||this.isCompleted||(this.isPaused=!1,this.start()),this}clear(){return this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null),this.isCompleted=!0,this}getRemainingTime(){return this.isCompleted?0:this.isPaused?this.remaining:this.timeoutId?Math.max(0,this.remaining-(Date.now()-this.startTime)):this.delay}}const w=new Map,v=new Map,x=[];let C=0;async function k(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{const e=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e=String(t.type).trim().toLowerCase(),n=function(t){let e=5381;for(let n=0;n<t.length;n++)e=(e<<5)+e+t.charCodeAt(n);return e>>>0}(String(t.message||"")).toString(16),o=String(t.position).trim().toLowerCase();return"".concat(e,"|").concat(n,"|").concat(o)}(t);if(w.has(e)){const n=w.get(e);if(!n)throw new Error("Active toast with key ".concat(e," not found"));return n.count++,n.timer.clear(),n.timer=T(n.toast,t),await L(n),void await j(n)}if(v.has(e)){const t=v.get(e);if(!t)throw new Error("Pending toast with key ".concat(e," not found"));return void t.count++}const n={options:t,count:1,rafId:0};v.set(e,n),n.rafId=requestAnimationFrame(async()=>{const t=v.get(e);if(t){if(v.delete(e),C>=3)return x.push({options:t.options,key:e,count:t.count}),void await O();try{await E(t.options,e,t.count)}catch(t){}}})}catch(t){}}async function E(t,e,n){try{if(!t||"object"!=typeof t)throw new TypeError("options must be an object");C++;const o=await y(t,g);if(!o)throw new Error("Failed to create toast container");const r=await async function(t,e){if(!document.querySelector('[id^="toast-container-"]'))return null;let n;try{return n=await i("div","toast"),await d(n,t,e),n}catch(o){return n=await m(t,e),n}}(t,M);if(!r)throw new Error("Toast element creation failed");const a=document.createElement("div");Object.assign(a.style,{position:"relative",display:"inline-block",overflow:"visible",marginBottom:"10px",zIndex:"0",width:"100%"});const s=document.createElement("div");Object.assign(s.style,{position:"relative",overflow:"hidden",zIndex:"1"}),s.appendChild(r),a.appendChild(s),o.id.includes("toast-container-")&&o.appendChild(a);const l=!1!==t.pauseOnHover&&(!0===t.pauseOnHover||!!t.cta),c={outer:a,toast:r,count:Math.max(1,Math.floor(null!=n?n:0)),timeout:null,pauseOnHover:l};w.set(e,c),r._key=e,c.count>1&&await j(c),c.timer=T(r,t),await L(c)}catch(e){C=Math.max(0,C-1);(document.querySelector('[id^="toast-container-"]')||document.body).appendChild(await m(t,M))}}const S=async function(){try{if(0===w.size)return;let t=null;if(document.querySelectorAll('[id^="toast-container-"]').forEach(e=>{const n=Array.from(e.children||[]);if(0===n.length)return;const o=n.at(-1);o&&(t=o.querySelector('[id^="toast-"]')||o)}),!t){const e=Array.from(w.entries());if(e.length>0){const n=e.at(-1),o=r(n,2)[1];t=o.toast||o.outer&&o.outer.querySelector('[id^="toast-"]')}}if(!t)return;const e=t._key?t:t.querySelector('[id^="toast-"]')||t;await M(e)}catch(t){}},A=async function(){try{const t=Array.from(w.values()).map(t=>t.toast).filter(Boolean);x.length=0,v.clear();for(const e of t)try{await M(e)}catch(t){}}catch(t){}};function T(t,e){var n;const o=Number(null!==(n=e.duration)&&void 0!==n?n:1800)+5,r=new b(async()=>await M(t),o);return r.start(),r}async function L(t){if(!t.pauseOnHover||!t.outer||!t.timer)return;const e=t.outer,n=t.timer,o=t.toast,r=()=>{var t;n.pause(),null==o||null===(t=o._progressAnimation)||void 0===t||t.pause()},i=()=>{var t;n.resume(),null==o||null===(t=o._progressAnimation)||void 0===t||t.play()},a=t=>{var e;t.target.matches("[tabindex], div, span, button, a")&&(n.pause(),null==o||null===(e=o._progressAnimation)||void 0===e||e.pause())},s=t=>{var r;e.contains(t.relatedTarget)||(n.resume(),null==o||null===(r=o._progressAnimation)||void 0===r||r.play())};e.addEventListener("mouseenter",r),e.addEventListener("mouseleave",i),e.addEventListener("focusin",a),e.addEventListener("focusout",s),e._pauseCleanup=()=>{e.removeEventListener("mouseenter",r),e.removeEventListener("mouseleave",i),e.removeEventListener("focusin",a),e.removeEventListener("focusout",s)}}async function M(t){try{var e,n,o;if(null==t||!t._key)return;const r=w.get(t._key);if(!r)return;null===(e=r.timer)||void 0===e||e.clear(),null===(n=r.outer)||void 0===n||null===(o=n._pauseCleanup)||void 0===o||o.call(n),w.delete(t._key),C=Math.max(0,C-1);const i=r.outer.querySelector(".toast-count-badge");i&&i.remove(),await async function(t){return t?new Promise(e=>{let n=!1;const o=()=>{n||(n=!0,async function(t){if(!t)return!0;try{var e;if(null!=t&&null!==(e=t.parentNode)&&void 0!==e&&e.id.includes("toast-container-"))return t.parentNode.removeChild(t),!0}catch(t){}try{if(t.remove)return t.remove(),!0}catch(t){}try{return Object.assign(t.style,{display:"none",opacity:"0",pointerEvents:"none",position:"absolute",left:"-9999px"}),!0}catch(t){}}(t),e())},r=t.firstElementChild||t;if(!r)return e();const i=t=>{try{if(t.target!==r)return;r.removeEventListener("transitionend",i,!0),o()}catch(t){}};try{r.addEventListener("transitionend",i,!0)}catch(t){}setTimeout(()=>{try{r.removeEventListener("transitionend",i,!0),o()}catch(t){}},700)}):Promise.resolve()}(r.outer),await O()}catch(t){}}async function O(){for(;C<3&&x.length;){const t=x.shift();if(w.has(t.key)){const e=w.get(t.key);e.count+=t.count,await j(e);continue}E(t.options,t.key,t.count)}}async function j(t){let e=t.outer,n=t.count;if(!(e&&e instanceof HTMLElement))throw new Error("updateBadge: outer must be a valid HTMLElement");if(n<2){const t=e.querySelector(".toast-count-badge");return void(t&&t.remove())}let o=e.querySelector(".toast-count-badge");o||(o=document.createElement("span"),o.className="toast-count-badge",o.setAttribute("aria-label","".concat(n," identical notifications")),Object.assign(o.style,{position:"absolute",top:"6px",right:"6px",backgroundColor:"#f44336",color:"#fff",borderRadius:"50%",minWidth:"20px",height:"20px",fontSize:"12px",fontWeight:"600",display:"flex",alignItems:"center",justifyContent:"center",border:"2px solid #fff",boxShadow:"0 2px 6px rgba(0,0,0,0.3)",zIndex:"2",pointerEvents:"none",transition:"transform 150ms ease"}),e.appendChild(o)),o.textContent=n>99?"99+":String(n);try{o.style.transform="scale(1.2)",setTimeout(()=>o.style.transform="scale(1)",150)}catch(t){}}let I={success:"#28a745",error:"#dc3545",warning:"#ffc107",info:"#17a2b8"},P={success:"Operation completed successfully!",error:"Something went wrong!",warning:"Warning message!",info:"Information message!"};const D=[];let z=!1;async function N(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{const e=await async function(t){var e,n;const r=null==t||null===(e=t.position)||void 0===e||null===(e=e.toLowerCase())||void 0===e?void 0:e.trim(),i=null!=r&&r.includes("top-full-width")||null!=r&&r.includes("bottom-full-width")?"100vw":"400px",a=o(o({},{allowHtml:!1,sanitizeHtml:!0,pauseOnHover:void 0,duration:2500,position:"bottom-right",type:"info",borderRadius:"50px",backgroundColor:void 0,textColor:void 0,showCloseButton:!0,animationDuration:"0.4s",animationType:"fade",animationEasing:"ease",showProgressBar:!0,progressColor:void 0,progressHeight:"4px",progressPosition:"bottom",fontPosition:"relative",fontPadding:void 0,fontBorderRadius:void 0,fontBackgroundColor:void 0,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',fontSize:"14px",fontWeight:"400",fontLineHeight:"1.4",fontDirection:"auto",wrapText:"normal",maxWidth:i}),"object"!=typeof t||Array.isArray(t)?{}:t);a.message=null!==(n=null==t?void 0:t.message)&&void 0!==n?n:a.message;try{var s,c,u;if(!a.backgroundColor)a.backgroundColor=null!==(c=null===(u=I)||void 0===u?void 0:u[a.type])&&void 0!==c?c:window.matchMedia("(prefers-color-scheme: dark)").matches?"#f5f5f5":"#111111";if(a.message=a.message||(null===(s=P)||void 0===s?void 0:s[a.type])||"No Message Provided!",!a.textColor&&a.backgroundColor){const t=l(a.backgroundColor);a.textColor=t}if(!a.progressColor&&a.backgroundColor)if(a.textColor)a.progressColor=a.textColor;else{const t=l(a.backgroundColor);a.progressColor=t}}catch(t){}"string"!=typeof a.message&&(a.message="No Message Provided!");return a}(t);await async function(t){try{return await y(t,g)}catch(t){return document.body}}(e),await k(e)}catch(e){const n="string"==typeof(null==t?void 0:t.message)&&null!==(null==t?void 0:t.message)?"".concat(t.message.substring(0,200)," toast creation failed!"):"Toast creation failed!";alert(n)}}function B(t){try{t&&"object"==typeof t&&!Array.isArray(t)&&(I=o(o({},I),t))}catch(t){}}function R(t){try{t&&"object"==typeof t&&!Array.isArray(t)&&(P=o(o({},P),t))}catch(t){}}let H=!1,W=null;const _=async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"undefined"!=typeof window&&"undefined"!=typeof document&&(await async function(){z||"undefined"!=typeof window&&"undefined"!=typeof document&&("complete"===document.readyState||"interactive"===document.readyState?(z=!0,D.forEach(t=>setTimeout(()=>N(t),2500)),D.length=0):document.addEventListener("DOMContentLoaded",()=>{z=!0,D.forEach(t=>setTimeout(()=>N(t),2500)),D.length=0},{once:!0}))}(),z?await N(t):D.push(t))};async function q(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return async function(t){if(H&&W)try{await W}catch(t){}return t()}(()=>_(t))}const F=async()=>{H=!0,W=(async()=>{try{await S()}finally{H=!1,W=null}})(),await W},U=async()=>{H=!0,W=(async()=>{try{await A()}finally{H=!1,W=null}})(),await W};if("undefined"!=typeof window&&"undefined"!=typeof document){let t=!1;if(!t){const e=t=>{"Escape"!==t.key&&"Esc"!==t.key||(async()=>{H=!0,W=(async()=>{try{await S()}finally{H=!1,W=null}})(),await W})()};window.addEventListener("keydown",e,{passive:!0}),t=!0}}try{"undefined"!=typeof window&&(window.customizableToast={createToast:q,setDefaultColors:B,setDefaultMessages:R,noop:U,dismiss:F})}catch(t){}export{q as createToast,F as dismiss,F as dismissToast,U as noop,U as noopAll,B as setDefaultColors,R as setDefaultMessages};
16
+ //# sourceMappingURL=index.esm.mjs.map