customizable-toast-notification 3.20.2 → 4.0.0

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/dist/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
- /*!
1
+ "use strict";/*!
2
2
  * Customizable Toast Notifications
3
- * Build: 2026-10-27 01:25:49
4
- * Cache-Buster: 1793064349404
3
+ * Build: 2026-10-27 09:46:57
4
+ * Cache-Buster: 1793094417148
5
5
  * Author: Priyanshu Patel
6
6
  * Email: priyanshu.alt191@gmail.com
7
7
  * License: Apache-2.0
@@ -11,6 +11,107 @@
11
11
  * designed for seamless integration with any JavaScript or framework-based UI.
12
12
  * Supports flexible positioning, theming, icons, animations, and timing options
13
13
  * out of the box — with CTA support and zero dependencies.
14
- */
15
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e=Object.freeze({maxVisible:3,maxQueueSize:100,zIndex:9999,targetNode:null,disableInlineStyles:!1,reducedMotion:"auto",defaultPosition:"bottom-right",theme:"light",stacked:!1,swipeToDismiss:!0,sound:!0,soundPreset:"modern",icon:!0,pauseOnHover:!1,syncTabs:!1,aiPrioritization:!1,shadowDom:!1,trapFocus:!1,priorityScorer:null,onMetrics:null,debug:!1}),t={...e};function n(e={}){if(!e||"object"!=typeof e||Array.isArray(e))return i();const{maxVisible:n,maxQueueSize:o,zIndex:r,targetNode:s,disableInlineStyles:a,reducedMotion:l,defaultPosition:c,theme:u,stacked:d,swipeToDismiss:p,sound:f,soundPreset:m,icon:h,pauseOnHover:y,syncTabs:g,aiPrioritization:b,shadowDom:w,trapFocus:x,priorityScorer:v,onMetrics:T,debug:A}=e;if(void 0!==w&&(t.shadowDom=Boolean(w)),void 0!==x&&(t.trapFocus=Boolean(x)),void 0!==A&&(t.debug=Boolean(A)),void 0!==n){const e=Number(n);Number.isFinite(e)&&e>0&&(t.maxVisible=Math.max(1,Math.floor(e)))}if(void 0!==o){const e=Number(o);Number.isFinite(e)&&e>=0&&(t.maxQueueSize=Math.floor(e))}if(void 0!==r){const e=Number(r);Number.isFinite(e)&&(t.zIndex=Math.trunc(e))}if(void 0!==s&&(t.targetNode=s&&"object"==typeof s&&"function"==typeof s.appendChild?s:null),void 0!==a&&(t.disableInlineStyles=Boolean(a)),void 0!==l){const e=String(l||"auto").toLowerCase();["auto","always","never"].includes(e)&&(t.reducedMotion=e,"undefined"!=typeof document&&("always"===e?document.documentElement.setAttribute("data-toast-reduced-motion","always"):"never"===e?document.documentElement.setAttribute("data-toast-reduced-motion","never"):document.documentElement.removeAttribute("data-toast-reduced-motion")))}if(void 0!==c){const e=String(c||"").toLowerCase().trim();e&&(t.defaultPosition=e)}if(void 0!==u){const e=String(u||"light").toLowerCase();["light","dark","high-contrast","compact","spacious","glass"].includes(e)&&(t.theme=e,"undefined"!=typeof document&&document.documentElement.setAttribute("data-toast-theme",e))}if(void 0!==d&&(t.stacked=Boolean(d)),void 0!==p&&(t.swipeToDismiss=Boolean(p)),void 0!==f&&(t.sound=Boolean(f)),void 0!==m){const e=String(m||"modern").toLowerCase().trim();e&&(t.soundPreset=e)}return void 0!==h&&(t.icon=Boolean(h)),void 0!==y&&(t.pauseOnHover=Boolean(y)),void 0!==g&&(t.syncTabs=Boolean(g)),void 0!==b&&(t.aiPrioritization=Boolean(b)),void 0!==v&&(t.priorityScorer="function"==typeof v?v:null),void 0!==T&&(t.onMetrics="function"==typeof T?T:null),i()}function o(){return Object.assign(t,e),"undefined"!=typeof document&&(document.documentElement.removeAttribute("data-toast-theme"),document.documentElement.removeAttribute("data-toast-reduced-motion")),i()}function i(){return{...t}}function r(){if("always"===t.reducedMotion)return!0;if("never"===t.reducedMotion)return!1;try{return Boolean("undefined"!=typeof window&&"function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches)}catch{return!1}}let s=0;const a=function(e=("undefined"!=typeof globalThis?globalThis.crypto:null)){if(e&&"function"==typeof e.getRandomValues){const t=new Uint16Array(1);return e.getRandomValues(t),t[0].toString(36).padStart(3,"0").slice(-3)}const t="undefined"!=typeof performance&&"function"==typeof performance.now?Math.floor(1e3*performance.now()):0;return(65535&(Date.now()^t)).toString(36).padStart(3,"0").slice(-3)}();function l(){s=0}function c(e="toast"){const t="string"==typeof e?e.trim().toLowerCase().replace(/[^a-z0-9_-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,""):"",n=t&&!/^[0-9]/.test(t)?t:"toast",o=Date.now().toString(36);s=s+1&16777215;const i=s.toString(36);return`${n}-${o}-${a}${i}`}const u=new class{constructor(e=200){this.maxSize=e,this.map=new Map}get(e){if(!this.map.has(e))return;const t=this.map.get(e);return this.map.delete(e),this.map.set(e,t),t}set(e,t){if(this.map.has(e))this.map.delete(e);else if(this.map.size>=this.maxSize){const e=this.map.keys().next().value;this.map.delete(e)}this.map.set(e,t)}}(200),d={};function p(e){if(!e)return"#ffffff";const t=String(e),n=u.get(t);if(n)return n;if(d[e?.toLowerCase()]){const n=d[e.toLowerCase()];return u.set(t,n),n}let o,i,r;try{const t=function(e){const t=e?.match(/^#(?:([0-9a-f]{3,4})|([0-9a-f]{6})|([0-9a-f]{8}))$/i);if(t){let e=t[1]||t[2]||t[3];if(3!==e.length&&4!==e.length||(e=e.slice(0,3).split("").map(e=>e+e).join("")),e.length>=6){const t=Number.parseInt(e.slice(0,2),16),n=Number.parseInt(e.slice(2,4),16),o=Number.parseInt(e.slice(4,6),16);if(Number.isFinite(t)&&Number.isFinite(n)&&Number.isFinite(o))return{r:t,g:n,b:o}}return null}const n=e=>{if("string"!=typeof e)return Number(e);const t=e.trim();return t.endsWith("%")?Math.round(Number.parseFloat(t)/100*255):Number(t)},o=e?.match(/rgba?\(\s*([\d.]+%?)\s*,\s*([\d.]+%?)\s*,\s*([\d.]+%?)(?:\s*,\s*[\d.%]+)?\s*\)/i);if(o){const e=Math.min(255,Math.max(0,n(o[1]))),t=Math.min(255,Math.max(0,n(o[2]))),i=Math.min(255,Math.max(0,n(o[3])));if(Number.isFinite(e)&&Number.isFinite(t)&&Number.isFinite(i))return{r:e,g:t,b:i}}const i=e?.match(/rgba?\(\s*([\d.]+%?)\s+([\d.]+%?)\s+([\d.]+%?)(?:\s*\/\s*[\d.%]+)?\s*\)/i);if(i){const e=Math.min(255,Math.max(0,n(i[1]))),t=Math.min(255,Math.max(0,n(i[2]))),o=Math.min(255,Math.max(0,n(i[3])));if(Number.isFinite(e)&&Number.isFinite(t)&&Number.isFinite(o))return{r:e,g:t,b:o}}const r=e?.match(/hsla?\(\s*(-?[\d.]+(?:deg|grad|rad|turn)?)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*[\d.%]+)?\s*\)/i),s=!r&&e?.match(/hsla?\(\s*(-?[\d.]+(?:deg|grad|rad|turn)?)\s+([\d.]+)%\s+([\d.]+)%(?:\s*\/\s*[\d.%]+)?\s*\)/i),a=r||s;if(a){const e=(e=>{const t=e.trim().toLowerCase();let n=Number.parseFloat(t);return Number.isFinite(n)?(t.endsWith("turn")?n*=360:t.endsWith("grad")?n=360*n/400:t.endsWith("rad")&&(n=180*n/Math.PI),(n%360+360)%360/360):0})(a[1]),t=Math.min(1,Math.max(0,Number(a[2])/100)),n=Math.min(1,Math.max(0,Number(a[3])/100));if(0===t){const e=Math.round(255*n);return{r:e,g:e,b:e}}const o=(e,t,n)=>{let o=n;return o<0&&(o+=1),o>1&&(o-=1),o<1/6?e+6*(t-e)*o:o<.5?t:o<2/3?e+(t-e)*(2/3-o)*6:e},i=n<.5?n*(1+t):n+t-n*t,r=2*n-i;return{r:Math.round(255*o(r,i,e+1/3)),g:Math.round(255*o(r,i,e)),b:Math.round(255*o(r,i,e-1/3))}}return null}(function(e){if("string"!=typeof e)return e;let t=e.trim(),n=0;for(;t.toLowerCase().startsWith("var(")&&t.endsWith(")")&&n<5;){n++;const e=t.slice(4,-1).trim(),o=e.indexOf(","),i=(-1===o?e:e.slice(0,o)).trim(),r=-1===o?"":e.slice(o+1).trim();if(!i.startsWith("--"))return t;let s="";try{"undefined"!=typeof document&&"function"==typeof getComputedStyle&&(s=getComputedStyle(document.documentElement).getPropertyValue(i).trim())}catch{}if(s)t=s;else{if(!r)break;t=r}}return t}("string"==typeof e?e.trim():String(e||"")).trim());if(!t)throw new Error("Unknown color");({r:o,g:i,b:r}=t)}catch{o=i=r=128}const s=(e,t,n)=>{const o=[e,t,n].map(e=>(e/=255)<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4));return.2126*o[0]+.7152*o[1]+.0722*o[2]},a=(e,t)=>{const n=s(...e),o=s(...t);return(Math.max(n,o)+.05)/(Math.min(n,o)+.05)};let[l,c,p]=((e,t,n)=>{e/=255,t/=255,n/=255;const o=Math.max(e,t,n),i=Math.min(e,t,n);let r,s,a=(o+i)/2;if(o===i)r=s=0;else{const l=o-i;switch(s=a>.5?l/(2-o-i):l/(o+i),o){case e:r=(t-n)/l+(t<n?6:0);break;case t:r=(n-e)/l+2;break;case n:r=(e-t)/l+4}r/=6}return[360*r,s,a]})(o,i,r),f=p<.5?Math.min(p+.5,1):Math.max(p-.5,0),[m,h,y]=((e,t,n)=>{let o,i,r;if(e/=360,0===t)o=i=r=n;else{const s=(e,t,n)=>(n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e),a=n<.5?n*(1+t):n+t-n*t,l=2*n-a;o=s(l,a,e+1/3),i=s(l,a,e),r=s(l,a,e-1/3)}return[Math.round(255*o),Math.round(255*i),Math.round(255*r)]})(l,c,f);if(a([o,i,r],[m,h,y])<4.5){const e=a([o,i,r],[0,0,0]),t=a([o,i,r],[255,255,255]);[m,h,y]=e>=t?[0,0,0]:[255,255,255]}const g=((e,t,n)=>`#${e.toString(16).padStart(2,"0")}${t.toString(16).padStart(2,"0")}${n.toString(16).padStart(2,"0")}`)(m,h,y);return u.set(t,g),g}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],transparent:[255,255,255],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(([e,[t,n,o]])=>{const i=e=>{const t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)},r=.2126*i(t)+.7152*i(n)+.0722*i(o),s=(r+.05)/.05,a=1.05/(r+.05);d[e.toLowerCase()]=s>=a?"#000000":"#ffffff"});const f=new Set(["DIV","SPAN","P","BR","STRONG","B","EM","I","U","SMALL","UL","OL","LI","A","IMG","PRE","CODE","MARK"]),m=new Set(["href","src","alt","title","class","target","rel","loading"]),h=new Set(["SCRIPT","STYLE","IFRAME","NOSCRIPT","OBJECT","EMBED","SVG","MATH","AUDIO","VIDEO","CANVAS","TEMPLATE"]),y=/^\s*(?:https?:|mailto:|data:image\/(?:png|jpe?g|gif|webp|avif|bmp|ico);|\/(?!\/|\\)|\.\/|\.\.\/|#)/i;function g(e,t,n){if(e.nodeType===Node.TEXT_NODE)return document.createTextNode(e.nodeValue);if(e.nodeType===Node.COMMENT_NODE)return null;if(e.nodeType!==Node.ELEMENT_NODE)return null;const o=e.tagName.toUpperCase();if(h.has(o)||o.includes("SCRIPT")||o.includes("<")||o.includes(">"))return null;if(!t.has(o)){const o=document.createDocumentFragment();return Array.from(e.childNodes).forEach(e=>{const i=g(e,t,n);i&&o.appendChild(i)}),o}const i=document.createElement(e.tagName);return Array.from(e.attributes||[]).forEach(e=>{i.setAttribute(e.name,e.value)}),function(e,t){const n=[];Array.from(e.attributes||[]).forEach(o=>{const i=o.name.toLowerCase(),r=o.value;if(t.has(i)&&!i.startsWith("on")){if("href"===i||"src"===i){const t="string"==typeof r?r.trim().toLowerCase():"";if((t.startsWith("javascript:")||t.startsWith("vbscript:")||t.startsWith("data:"))&&("src"!==i||!t.startsWith("data:image/")||t.startsWith("data:image/svg+xml")))return"href"===i?void e.setAttribute("href","#"):void n.push(o.name);if(!y.test(r))return"href"===i?void e.setAttribute("href","#"):void n.push(o.name)}if("target"===i&&"string"==typeof r&&"_blank"===r.trim().toLowerCase()){const t=(e.getAttribute("rel")||"").split(/\s+/).filter(Boolean);t.includes("noopener")||t.push("noopener"),t.includes("noreferrer")||t.push("noreferrer"),e.setAttribute("rel",t.join(" "))}}else n.push(o.name)}),n.forEach(t=>e.removeAttribute(t));const o=e.getAttribute("target");if("A"===e.tagName&&"string"==typeof o&&"_blank"===o.trim().toLowerCase()){const t=(e.getAttribute("rel")||"").split(/\s+/).filter(Boolean);t.includes("noopener")||t.push("noopener"),t.includes("noreferrer")||t.push("noreferrer"),e.setAttribute("rel",t.join(" "))}}(i,n),Array.from(e.childNodes).forEach(e=>{const o=g(e,t,n);o&&i.appendChild(o)}),i}function b(e){if(!e||"string"!=typeof e)return"";const t=function(e){if("undefined"!=typeof DOMParser)try{const t=(new DOMParser).parseFromString(e,"text/html");if(t&&t.body)return t.body}catch{}if("undefined"!=typeof document){const t=document.createElement("template");if("content"in t)return t.innerHTML=e,t.content;const n=document.createElement("div");return n.innerHTML=e,n}return null}(e);if(!t)return"";const n=document.createDocumentFragment();Array.from(t.childNodes).forEach(e=>{const t=g(e,f,m);t&&n.appendChild(t)});const o=document.createElement("div");return o.appendChild(n),o.querySelectorAll('a[target="_blank"]').forEach(e=>{const t=(e.getAttribute("rel")||"").split(/\s+/).filter(Boolean);t.includes("noopener")||t.push("noopener"),t.includes("noreferrer")||t.push("noreferrer"),e.setAttribute("rel",t.join(" "))}),o.innerHTML}function w(e,t={}){if("string"!=typeof e||!e.trim())return"";try{if(!t.forceFallback&&function(){try{return Boolean("undefined"!=typeof window&&window.DOMPurify&&"function"==typeof window.DOMPurify.sanitize)}catch{}return!1}()){const t=window.DOMPurify.sanitize(e,{ALLOWED_TAGS:Array.from(f),ALLOWED_ATTR:Array.from(m),ALLOWED_URI_REGEXP:y}),n=document.createElement("div");return n.innerHTML=t,n.querySelectorAll("a[href]").forEach(e=>{const t=e.getAttribute("href")||"";y.test(t)||e.setAttribute("href","#")}),n.querySelectorAll('a[target="_blank"]').forEach(e=>{const t=(e.getAttribute("rel")||"").split(/\s+/).filter(Boolean);t.includes("noopener")||t.push("noopener"),t.includes("noreferrer")||t.push("noreferrer"),e.setAttribute("rel",t.join(" "))}),n.innerHTML}}catch(e){console.warn("DOMPurify sanitization failed, falling back:",e)}return b(e)}function x(e={}){if("undefined"==typeof document)return null;const t=e&&"object"==typeof e&&!Array.isArray(e)?e:{},n=Number(t.size),o=Number.isFinite(n)&&n>0?n:14,s="string"==typeof t.color&&t.color.trim()?t.color.trim():"currentColor",a=/[\r\n<>"';]/.test(s)||/^\s*javascript:/i.test(s)?"currentColor":s,l="string"==typeof t.text?t.text:"",c=document.createElement("span");c.className="toast-loader",c.setAttribute("role","status"),c.setAttribute("aria-label",l||"Loading");const u=i();u.disableInlineStyles||(c.style.display="inline-flex",c.style.alignItems="center",c.style.gap="8px");const d="http://www.w3.org/2000/svg",p=document.createElementNS(d,"svg");p.setAttribute("width",String(o)),p.setAttribute("height",String(o)),p.setAttribute("viewBox","0 0 50 50"),p.setAttribute("aria-hidden","true");const f=document.createElementNS(d,"circle");if(f.classList.add("toast-loader-circle"),f.setAttribute("cx","25"),f.setAttribute("cy","25"),f.setAttribute("r","20"),f.setAttribute("fill","none"),f.setAttribute("stroke",a),f.setAttribute("stroke-width","4"),f.setAttribute("stroke-linecap","round"),u.disableInlineStyles||(f.style.opacity="0.85",f.style.strokeDasharray="90",f.style.strokeDashoffset="60",f.style.transformOrigin="center",r()||(f.style.animation="toast-spinner 1s linear infinite")),p.appendChild(f),c.appendChild(p),l){const e=document.createElement("span");e.className="toast-loader-label",u.disableInlineStyles||(e.style.fontSize="13px"),e.textContent=l,c.appendChild(e)}if(!u.disableInlineStyles&&"undefined"!=typeof document&&!document.getElementById("toast-spinner-styles"))try{const e=document.createElement("style");e.id="toast-spinner-styles",e.textContent="@keyframes toast-spinner { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }";const t=document.head||document.documentElement;t&&t.appendChild(e)}catch{}return c}const v={en:{success:"Operation completed successfully!",error:"Something went wrong!",warning:"Warning message!",info:"Information message!",loading:"Loading, please wait...",undo:"Undo",close:"Close notification"},hi:{success:"कार्य सफलतापूर्वक संपन्न हुआ!",error:"कुछ गड़बड़ हो गई!",warning:"चेतावनी: कृपया ध्यान दें!",info:"यहाँ कुछ जानकारी है!",loading:"लोड हो रहा है, कृपया प्रतीक्षा करें...",undo:"पूर्ववत करें",close:"सूचना बंद करें"},es:{success:"¡Operación completada con éxito!",error:"¡Algo salió mal!",warning:"¡Advertencia!",info:"¡Información!",loading:"Cargando, por favor espere...",undo:"Deshacer",close:"Cerrar notificación"},fr:{success:"Opération terminée avec succès !",error:"Une erreur est survenue !",warning:"Attention !",info:"Information !",loading:"Chargement, veuillez patienter...",undo:"Annuler",close:"Fermer la notification"},de:{success:"Vorgang erfolgreich abgeschlossen!",error:"Etwas ist schiefgelaufen!",warning:"Warnung!",info:"Information!",loading:"Laden, bitte warten...",undo:"Rückgängig",close:"Benachrichtigung schließen"},ar:{success:"تمت العملية بنجاح!",error:"حدث خطأ ما!",warning:"تحذير!",info:"معلومات!",loading:"جارٍ التحميل، يرجى الانتظار...",undo:"تراجع",close:"إغلاق الإشعار"},ja:{success:"操作が正常に完了しました!",error:"問題が発生しました!",warning:"警告メッセージ!",info:"お知らせ!",loading:"読み込み中、お待ちください...",undo:"元に戻す",close:"通知を閉じる"}};let T="en";const A=new Map;function S(e){if("string"!=typeof e||!e.trim())return T;const t=e.trim().toLowerCase();return(Object.prototype.hasOwnProperty.call(v,t)||A.has(t))&&(T=t),T}function C(){return T}function k(){return[...Object.keys(v),...Array.from(A.keys())]}function _(e,t){if("string"!=typeof e||!e.trim()||"object"!=typeof t||null===t||Array.isArray(t))return;const n=e.trim().toLowerCase(),o=A.get(n)||v[n]||{};A.set(n,{...o,...t})}function E(e,t){if("string"!=typeof e)return t;const n=A.get(T);if(n&&"string"==typeof n[e]&&n[e].trim())return n[e];const o=v[T];if(o&&"string"==typeof o[e])return o[e];const i=v.en;return i&&"string"==typeof i[e]?i[e]:t}function L(e=T){const t=String(e||"").toLowerCase().trim();return"ar"===t||"he"===t||"fa"===t||"ur"===t}function M(){T="en",A.clear()}function I(e,t,n){const o=t?.cta;if(!o||"object"!=typeof o)return;const r=Array.isArray(o)?o.filter(e=>e&&"object"==typeof e):[o];if(0===r.length)return;const s=[];r.forEach((o,a)=>{if(!o||"object"!=typeof o)return;const l={...o};l.label||(l.label=r.length>1?`Action ${a+1}`:"CTA Label Missing!");const c="link"===l.variant||!l.variant&&!!l.href,u=document.createElement(c?"a":"button");if(c){if(l.href){const e=String(l.href).trim(),t=/^(javascript:|vbscript:|data:(?!image\/[a-z0-9.+-]+;base64,))/i.test(e);u.href=t?"#":e}else u.setAttribute("role","button"),u.tabIndex=0;l.target&&(u.target=l.target);const e=new Set((l.rel||"").split(/\s+/).filter(Boolean));"string"==typeof l.target&&"_blank"===l.target.trim().toLowerCase()&&(e.add("noopener"),e.add("noreferrer")),u.rel=Array.from(e).join(" ")}else u.type="button";u.setAttribute("aria-label",l.ariaLabel||l.label);const d=l.textColor||l.color||t.textColor||p(t.backgroundColor),f=l.backgroundColor||l.background||(t.backgroundColor?z(t.backgroundColor):"rgba(255,255,255,0.15)"),m=("string"==typeof d?d.trim():"").match(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/);let h="rgba(128, 128, 128, 0.3)";m&&(h=(3===m[1].length?`#${m[1][0]}${m[1][0]}${m[1][1]}${m[1][1]}${m[1][2]}${m[1][2]}`:`#${m[1]}`)+"44"),u.className="toast-cta";const y="rtl"===t.fontDirection;i().disableInlineStyles||Object.assign(u.style,{marginLeft:y?"0px":0===a?"10px":"6px",marginRight:y?0===a?"10px":"6px":"0px",padding:"6px 10px",borderRadius:"6px",fontSize:"12px",fontWeight:"600",lineHeight:"1",border:`1px solid ${h}`,color:d,background:f,cursor:"pointer",whiteSpace:"nowrap",flexShrink:"0",display:"inline-flex",alignItems:"center",textDecoration:"none",outline:"none"}),u.textContent=l.label;const g=async t=>{if(!u._isExecuting){u._isExecuting=!0;try{if("function"==typeof l.onClick){const e=l.onClick(t);e?.then&&await e}}catch(e){console.error("CTA onClick handler error:",e)}finally{u._isExecuting=!1,!1!==l.autoClose&&"function"==typeof n&&await n(e)}}},b=e=>{!c||l.href||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),g(e))};u.addEventListener("click",g),c&&!l.href&&u.addEventListener("keydown",b);const w=()=>{u.removeEventListener("click",g),c&&!l.href&&u.removeEventListener("keydown",b)};u._cleanup=w,s.push(w);const x=e.querySelector(".toast-undo-btn")||e.querySelector(".toast-close-btn")||e.querySelector(".toast-progress-bar");x?e.insertBefore(u,x):e.appendChild(u)});const a=e._cleanupCTA;e._cleanupCTA=()=>{a?.(),s.forEach(e=>e())}}function N(e,t,n){const o=t?.undo;if(!o)return;const r="function"==typeof o;if(!r&&("object"!=typeof o||Array.isArray(o)))return;const s=r?{onUndo:o}:{...o},a="string"==typeof s.label&&s.label.trim()?s.label.trim():E("undo")||"Undo",l=Number(t?.duration),c=!1!==s.showCountdown&&Number.isFinite(l)&&l>0,u=document.createElement("button");u.type="button",u.className="toast-undo-btn",u.setAttribute("aria-label",`${a} action`);const d=t.textColor||p(t.backgroundColor),f=t.backgroundColor?z(t.backgroundColor):"rgba(255,255,255,0.18)",m=("string"==typeof d?d.trim():"").match(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/);let h="rgba(128, 128, 128, 0.35)";m&&(h=(3===m[1].length?`#${m[1][0]}${m[1][0]}${m[1][1]}${m[1][1]}${m[1][2]}${m[1][2]}`:`#${m[1]}`)+"55");const y="rtl"===t.fontDirection;i().disableInlineStyles||Object.assign(u.style,{marginLeft:y?"0px":"10px",marginRight:y?"10px":"0px",padding:"5px 10px",borderRadius:"6px",fontSize:"12px",fontWeight:"700",lineHeight:"1",border:`1px solid ${h}`,color:d,background:f,cursor:"pointer",whiteSpace:"nowrap",flexShrink:"0",display:"inline-flex",alignItems:"center",gap:"4px"});let g=Math.max(1,Math.ceil((l||2500)/1e3));const b=()=>{u.textContent=c?`${a} (${g}s)`:a};b();let w=null,x=!1;c&&(w=setInterval(()=>{x||(g=Math.max(0,g-1),b(),g<=0&&w&&(clearInterval(w),w=null))},1e3),"function"==typeof w?.unref&&w.unref()),e._pauseUndo=()=>{x=!0},e._resumeUndo=()=>{x=!1};const v=()=>{w&&(clearInterval(w),w=null),e._pauseUndo=null,e._resumeUndo=null},T=async t=>{v(),u.removeEventListener("click",T);try{if("function"==typeof s.onUndo){const n=s.onUndo(t,e);n?.then&&await n}}catch(e){console.error("Undo action error:",e)}finally{"function"==typeof n&&await n(e)}};u.addEventListener("click",T),u._cleanup=()=>{v(),u.removeEventListener("click",T)},e._cleanupUndo=()=>{v(),u.removeEventListener("click",T)};const A=e.querySelector(".toast-close-btn")||e.querySelector(".toast-progress-bar");A?e.insertBefore(u,A):e.appendChild(u)}function B(e,t,n){const o=document.createElement("button");o.type="button";const r=E("close")||"Close notification";o.setAttribute("aria-label",r),o.setAttribute("title",r),o.textContent="×";const s=t.textColor||p(t.backgroundColor);o.className="toast-close-btn";const a="rtl"===t.fontDirection;i().disableInlineStyles||Object.assign(o.style,{background:"none",border:"none",color:s,fontSize:"18px",marginLeft:a?"0px":"10px",marginRight:a?"10px":"0px",cursor:"pointer",lineHeight:"1",padding:"0 4px",flexShrink:"0",display:"inline-flex",alignItems:"center",justifyContent:"center"});const l=()=>{"function"==typeof n&&n(e)};o.addEventListener("click",l),e._cleanupCloseButton=()=>{o.removeEventListener("click",l)},e.appendChild(o)}function z(e){return e&&"#000000"===p(e)?"rgba(0,0,0,0.15)":"rgba(255,255,255,0.15)"}function P(){if("undefined"==typeof document||document.getElementById("toast-progress-indeterminate-styles"))return;const e=document.createElement("style");e.id="toast-progress-indeterminate-styles",e.textContent="\n @keyframes toast-progress-indeterminate {\n 0% { left: 0%; width: 0%; }\n 50% { left: 20%; width: 60%; }\n 100% { left: 100%; width: 0%; }\n }\n @keyframes toast-progress-indeterminate-rtl {\n 0% { right: 0%; width: 0%; }\n 50% { right: 20%; width: 60%; }\n 100% { right: 100%; width: 0%; }\n }\n .toast-progress-bar-indeterminate {\n animation: toast-progress-indeterminate 1.6s cubic-bezier(0.4, 0, 0.2, 1) infinite !important;\n }\n .toast-progress-bar-indeterminate-rtl {\n animation: toast-progress-indeterminate-rtl 1.6s cubic-bezier(0.4, 0, 0.2, 1) infinite !important;\n }\n ";const t=document.head||document.documentElement;t&&t.appendChild(e)}function D(e,t,n={}){if(null==e)return null;if("indeterminate"===e)return"indeterminate";let o;return o="string"==typeof e?Number.parseFloat(e.trim()):Number(e),Number.isFinite(o)?(t&&o>0&&o<1&&(t._progressRatioMode=!0),((Boolean(n.progressNormalized)||Boolean(t?._progressRatioMode))&&o>0&&o<=1||o>0&&o<1)&&(o*=100),Math.min(100,Math.max(0,o))):0}function R(e,t={}){if(!e)return;const n=document.createElement("div");n.className="toast-progress-bar",e._progressBar=n;const o=t.borderRadius||"0",s=Number.parseInt(o,10),a=Number.isFinite(s)&&s>0?s:0;let l=4,c="4px";if("number"==typeof t.progressHeight&&Number.isFinite(t.progressHeight)&&t.progressHeight>0)l=t.progressHeight,c=`${l}px`;else if("string"==typeof t.progressHeight&&t.progressHeight.trim()){const e=t.progressHeight.trim(),n=Number.parseFloat(e);Number.isFinite(n)&&n>0&&(e.endsWith("rem")||e.endsWith("em")?(l=16*n,c=e):(l=n,c=/^\d+(\.\d+)?$/.test(e)?`${n}px`:e))}const u=Number(t.duration??2500),d=Math.max(0,u+5),p=Math.min(a,2*l),f=a>0?`calc(100% - ${2*p}px)`:"100%",m="reverse"===t.progressDirection||"increasing"===t.progressDirection||"ltr"===t.progressDirection,h="rtl"===t.fontDirection||"rtl"===t.progressDirection||"rtl"===e?.style?.direction;n._leftOffset=p,n._finalWidth=f,n._isReverse=m,n._isRtl=h;const y=t.progressBarColor||t.progressColor||"currentColor";i().disableInlineStyles||Object.assign(n.style,{position:"absolute",left:h?"auto":`${p}px`,right:h?`${p}px`:"auto",height:c,background:y,width:m?"0%":`${f}`,transition:`width ${d}ms linear`,["top"===t.progressPosition?"top":"bottom"]:"0",borderRadius:l/2+"px",opacity:"0.8",zIndex:"2",willChange:"width"}),e.appendChild(n);const g="indeterminate"===t.progress||Boolean(t.showProgressBar)&&(0===t.duration||t.duration===1/0)&&void 0===t.progress;if(n._isIndeterminate=g,n._isManualProgress=void 0!==t.progress&&"indeterminate"!==t.progress,g){if(n.classList.add("toast-progress-bar-indeterminate"),h&&n.classList.add("toast-progress-bar-indeterminate-rtl"),!i().disableInlineStyles){P();const e=h?"toast-progress-indeterminate-rtl":"toast-progress-indeterminate";n.style.animation=`${e} 1.6s cubic-bezier(0.4, 0, 0.2, 1) infinite`}n.style.width=f}else{if(void 0!==t.progress){const o=D(t.progress,e,t);return n.style.width=`${o}%`,void(n.style.transition="width 200ms ease")}if(0!==t.duration&&t.duration!==1/0)if(r())n.style.display="none";else if("function"==typeof n.animate){const t=m?[{width:"0%"},{width:f}]:[{width:f},{width:"0%"}];e._progressAnimation=n.animate(t,{duration:d,easing:"linear",fill:"forwards",delay:50})}else n.style.transition=`width ${d}ms linear`,requestAnimationFrame(()=>{n.style.width=m?f:"0%"});else n.style.width="0%"}}function V(e){if(!e)return;if(e._hasAnimated)return;if(r())return e._hasAnimated=!0,e.style.transition="none",e.style.opacity="1",e.style.transform="translateY(0)",void e.classList.add("active");const t=()=>{if(!e._hasAnimated){e._hasAnimated=!0;try{e.offsetHeight}catch{}requestAnimationFrame(()=>{e.style.opacity="1",e.style.transform="none",e.classList.add("active")})}};e.isConnected?t():requestAnimationFrame(()=>{e.isConnected?t():requestAnimationFrame(()=>{t()})})}function O(e,t){if(!e||"function"!=typeof e.addEventListener)return;let n=0,o=0,s=0,a=0,l=!1,c=!1,u=null,d=!1;const p=()=>{d&&(d=!1,window.removeEventListener("mousemove",m),window.removeEventListener("mouseup",h))},f=t=>{if(!t)return;if(void 0!==t.button&&0!==t.button)return;const i=t.target;if(i&&"function"==typeof i.closest&&i.closest("button, a, input, textarea, select, label"))return;let r=t;t.touches&&t.touches.length>0?(r=t.touches[0],u=r.identifier??null):u=null,n=r.clientX,o=r.clientY,s=n,a=Date.now(),l=!0,c=!1,e._originalTransition=e.style.transition||"",e.style.transition="none",e.style.userSelect="none",d||"undefined"==typeof window||(d=!0,window.addEventListener("mousemove",m,{passive:!1}),window.addEventListener("mouseup",h,{passive:!0}))},m=t=>{if(!l||!t)return;let a=t;if(t.touches)if(null!==u){for(let e=0;e<t.touches.length;e++)if(t.touches[e].identifier===u){a=t.touches[e];break}}else t.touches.length>0&&(a=t.touches[0]);const d=a.clientX,f=a.clientY,m=d-n,h=f-o;if(!c)if(Math.abs(m)>8&&Math.abs(m)>Math.abs(h))c=!0;else if(Math.abs(h)>8)return l=!1,e.style.userSelect="",void p();if(c){s=d;const n=Math.max(0,1-Math.abs(m)/280);i().disableInlineStyles||r()||(e.style.transform=`translateX(${m}px)`,e.style.opacity=String(n)),t.cancelable&&t.preventDefault()}},h=()=>{if(p(),u=null,!l||!c)return l=!1,void(e.style.userSelect="");l=!1,e.style.userSelect="";const o=s-n,d=Math.max(1,Date.now()-a),f=(d>0?Math.abs(o)/d:0)>=.65&&Math.abs(o)>=50,m=f?50:75;if(Math.abs(o)>=m){const n=o>0?320:-320,s=f?120:180;i().disableInlineStyles||r()||(e.style.transition=`transform ${s}ms ease-out, opacity ${s}ms ease-out`,e.style.transform=`translateX(${n}px)`,e.style.opacity="0"),e._swipeTimeout&&clearTimeout(e._swipeTimeout),e._swipeTimeout=setTimeout(()=>{e._swipeTimeout=null,"function"==typeof t&&t(e)},s),"function"==typeof e._swipeTimeout?.unref&&e._swipeTimeout.unref()}else if(!i().disableInlineStyles&&!r()){const t=e._spring,n=t?.easing||"cubic-bezier(0.34, 1.56, 0.64, 1)",o=t?.duration?Math.min(400,t.duration):200;e.style.transition=`transform ${o}ms ${n}, opacity 200ms ease`,e.style.transform="translateX(0)",e.style.opacity="1",e._snapbackTimer&&clearTimeout(e._snapbackTimer),e._snapbackTimer=setTimeout(()=>{e._snapbackTimer=null,e._originalTransition&&(e.style.transition=e._originalTransition)},o),"function"==typeof e._snapbackTimer?.unref&&e._snapbackTimer.unref()}};e.addEventListener("touchstart",f,{passive:!0}),e.addEventListener("touchmove",m,{passive:!1}),e.addEventListener("touchend",h,{passive:!0}),e.addEventListener("touchcancel",h,{passive:!0}),e.addEventListener("mousedown",f,{passive:!0}),e._cleanupSwipe=()=>{e._swipeTimeout&&(clearTimeout(e._swipeTimeout),e._swipeTimeout=null),e._snapbackTimer&&(clearTimeout(e._snapbackTimer),e._snapbackTimer=null),p(),e.removeEventListener("touchstart",f),e.removeEventListener("touchmove",m),e.removeEventListener("touchend",h),e.removeEventListener("touchcancel",h),e.removeEventListener("mousedown",f)}}let q=null,F=!0,$=!1;if("undefined"!=typeof window)if("undefined"!=typeof navigator&&navigator.userActivation?.hasBeenActive)$=!0;else{const e=()=>{if($=!0,q&&"suspended"===q.state)try{q.resume().catch(()=>{})}catch{}try{window.removeEventListener("pointerdown",e,!0),window.removeEventListener("keydown",e,!0),window.removeEventListener("touchstart",e,!0)}catch{}};try{window.addEventListener("pointerdown",e,{capture:!0,once:!0,passive:!0}),window.addEventListener("keydown",e,{capture:!0,once:!0,passive:!0}),window.addEventListener("touchstart",e,{capture:!0,once:!0,passive:!0})}catch{}}const j=new Map;function W(e=!0){if("undefined"==typeof window)return null;const t=window.AudioContext||window.webkitAudioContext;if(!t)return null;if(!q)try{q=new t}catch{return null}const n=$||"undefined"!=typeof navigator&&navigator.userActivation&&navigator.userActivation.hasBeenActive;if(q&&"suspended"===q.state&&(e||n))try{q.resume().catch(()=>{})}catch{}return q}let H=null;function U(){const e=W(!1);if(!e||"function"!=typeof e.createAnalyser)return null;if(!H)try{H=e.createAnalyser(),H.fftSize=128,H.connect(e.destination)}catch{return null}return H}function G(e,t){H?t.connect(H):t.connect(e.destination)}function Y(e,t){e&&(e.onended=()=>{try{e.disconnect(),t?.disconnect?.()}catch{}})}const X={modern:function(e,t,n){if("success"===t)[523.25,659.25,783.99].forEach((t,o)=>{const i=e.createOscillator(),r=e.createGain();i.type="sine",i.frequency.setValueAtTime(t,n+.08*o),r.gain.setValueAtTime(.001,n+.08*o),r.gain.exponentialRampToValueAtTime(.12,n+.08*o+.02),r.gain.exponentialRampToValueAtTime(1e-4,n+.08*o+.35),i.connect(r),G(e,r),Y(i,r),i.start(n+.08*o),i.stop(n+.08*o+.36)});else if("error"===t)[320,240].forEach((t,o)=>{const i=e.createOscillator(),r=e.createGain();i.type="triangle",i.frequency.setValueAtTime(t,n+.1*o),r.gain.setValueAtTime(.001,n+.1*o),r.gain.exponentialRampToValueAtTime(.15,n+.1*o+.02),r.gain.exponentialRampToValueAtTime(1e-4,n+.1*o+.22),i.connect(r),G(e,r),Y(i,r),i.start(n+.1*o),i.stop(n+.1*o+.23)});else if("warning"===t){const t=e.createOscillator(),o=e.createGain();t.type="sine",t.frequency.setValueAtTime(440,n),t.frequency.exponentialRampToValueAtTime(493.88,n+.12),o.gain.setValueAtTime(.001,n),o.gain.exponentialRampToValueAtTime(.12,n+.02),o.gain.exponentialRampToValueAtTime(1e-4,n+.28),t.connect(o),G(e,o),Y(t,o),t.start(n),t.stop(n+.3)}else{const t=e.createOscillator(),o=e.createGain();t.type="sine",t.frequency.setValueAtTime(600,n),t.frequency.exponentialRampToValueAtTime(950,n+.04),t.frequency.exponentialRampToValueAtTime(400,n+.09),o.gain.setValueAtTime(.001,n),o.gain.exponentialRampToValueAtTime(.1,n+.015),o.gain.exponentialRampToValueAtTime(1e-4,n+.12),t.connect(o),G(e,o),Y(t,o),t.start(n),t.stop(n+.13)}},retro:function(e,t,n){if("success"===t)[523.25,659.25,783.99,1046.5].forEach((t,o)=>{const i=e.createOscillator(),r=e.createGain();i.type="square";const s=n+.045*o;i.frequency.setValueAtTime(t,s),r.gain.setValueAtTime(.001,s),r.gain.linearRampToValueAtTime(.08,s+.005),r.gain.exponentialRampToValueAtTime(1e-4,s+.042),i.connect(r),G(e,r),Y(i,r),i.start(s),i.stop(s+.045)});else if("error"===t){const t=e.createOscillator(),o=e.createGain();t.type="square",t.frequency.setValueAtTime(360,n),t.frequency.exponentialRampToValueAtTime(90,n+.22),o.gain.setValueAtTime(.001,n),o.gain.linearRampToValueAtTime(.1,n+.01),o.gain.exponentialRampToValueAtTime(1e-4,n+.22),t.connect(o),G(e,o),Y(t,o),t.start(n),t.stop(n+.23)}else"warning"===t?[0,.08].forEach(t=>{const o=e.createOscillator(),i=e.createGain();o.type="square";const r=n+t;o.frequency.setValueAtTime(880,r),i.gain.setValueAtTime(.001,r),i.gain.linearRampToValueAtTime(.07,r+.005),i.gain.exponentialRampToValueAtTime(1e-4,r+.05),o.connect(i),G(e,i),Y(o,i),o.start(r),o.stop(r+.055)}):[987.77,1318.51].forEach((t,o)=>{const i=e.createOscillator(),r=e.createGain();i.type="square";const s=n+.035*o;i.frequency.setValueAtTime(t,s),r.gain.setValueAtTime(.001,s),r.gain.linearRampToValueAtTime(.08,s+.005),r.gain.exponentialRampToValueAtTime(1e-4,s+.035),i.connect(r),G(e,r),Y(i,r),i.start(s),i.stop(s+.04)})},futuristic:function(e,t,n){if("success"===t){const t=e.createOscillator(),o=e.createGain();t.type="sine",t.frequency.setValueAtTime(440,n),t.frequency.exponentialRampToValueAtTime(1760,n+.2),o.gain.setValueAtTime(.001,n),o.gain.exponentialRampToValueAtTime(.12,n+.03),o.gain.exponentialRampToValueAtTime(1e-4,n+.32),t.connect(o),G(e,o),Y(t,o),t.start(n),t.stop(n+.33)}else if("error"===t){const t=e.createOscillator(),o=e.createGain();t.type="sawtooth",t.frequency.setValueAtTime(700,n),t.frequency.exponentialRampToValueAtTime(120,n+.24),o.gain.setValueAtTime(.001,n),o.gain.linearRampToValueAtTime(.09,n+.02),o.gain.exponentialRampToValueAtTime(1e-4,n+.25),t.connect(o),G(e,o),Y(t,o),t.start(n),t.stop(n+.26)}else if("warning"===t)[580,870].forEach(t=>{const o=e.createOscillator(),i=e.createGain();o.type="sine",o.frequency.setValueAtTime(t,n),o.frequency.linearRampToValueAtTime(1.15*t,n+.1),o.frequency.linearRampToValueAtTime(t,n+.2),i.gain.setValueAtTime(.001,n),i.gain.exponentialRampToValueAtTime(.07,n+.02),i.gain.exponentialRampToValueAtTime(1e-4,n+.25),o.connect(i),G(e,i),Y(o,i),o.start(n),o.stop(n+.26)});else{const t=e.createOscillator(),o=e.createGain();t.type="sine",t.frequency.setValueAtTime(1100,n),t.frequency.exponentialRampToValueAtTime(1600,n+.03),t.frequency.exponentialRampToValueAtTime(750,n+.09),o.gain.setValueAtTime(.001,n),o.gain.exponentialRampToValueAtTime(.09,n+.015),o.gain.exponentialRampToValueAtTime(1e-4,n+.12),t.connect(o),G(e,o),Y(t,o),t.start(n),t.stop(n+.13)}},subtle:function(e,t,n){if("success"===t)[750,1100].forEach((t,o)=>{const i=e.createOscillator(),r=e.createGain();i.type="sine";const s=n+.04*o;i.frequency.setValueAtTime(t,s),r.gain.setValueAtTime(.001,s),r.gain.linearRampToValueAtTime(.04,s+.003),r.gain.exponentialRampToValueAtTime(1e-4,s+.025),i.connect(r),G(e,r),Y(i,r),i.start(s),i.stop(s+.03)});else if("error"===t)[180,130].forEach((t,o)=>{const i=e.createOscillator(),r=e.createGain();i.type="triangle";const s=n+.05*o;i.frequency.setValueAtTime(t,s),r.gain.setValueAtTime(.001,s),r.gain.linearRampToValueAtTime(.05,s+.005),r.gain.exponentialRampToValueAtTime(1e-4,s+.035),i.connect(r),G(e,r),Y(i,r),i.start(s),i.stop(s+.04)});else if("warning"===t){const t=e.createOscillator(),o=e.createGain();t.type="sine",t.frequency.setValueAtTime(600,n),o.gain.setValueAtTime(.001,n),o.gain.linearRampToValueAtTime(.045,n+.003),o.gain.exponentialRampToValueAtTime(1e-4,n+.025),t.connect(o),G(e,o),Y(t,o),t.start(n),t.stop(n+.03)}else{const t=e.createOscillator(),o=e.createGain();t.type="sine",t.frequency.setValueAtTime(450,n),o.gain.setValueAtTime(.001,n),o.gain.linearRampToValueAtTime(.035,n+.003),o.gain.exponentialRampToValueAtTime(1e-4,n+.02),t.connect(o),G(e,o),Y(t,o),t.start(n),t.stop(n+.025)}},bell:function(e,t,n){if("success"===t)[659.25,1318.5,2637].forEach((t,o)=>{const i=e.createOscillator(),r=e.createGain();i.type="sine",i.frequency.setValueAtTime(t,n);const s=.09/(o+1);r.gain.setValueAtTime(.001,n),r.gain.exponentialRampToValueAtTime(s,n+.015),r.gain.exponentialRampToValueAtTime(1e-4,n+.55),i.connect(r),G(e,r),Y(i,r),i.start(n),i.stop(n+.58)});else if("error"===t)[220,440].forEach((t,o)=>{const i=e.createOscillator(),r=e.createGain();i.type="triangle",i.frequency.setValueAtTime(t,n);const s=.1/(o+1);r.gain.setValueAtTime(.001,n),r.gain.exponentialRampToValueAtTime(s,n+.015),r.gain.exponentialRampToValueAtTime(1e-4,n+.38),i.connect(r),G(e,r),Y(i,r),i.start(n),i.stop(n+.4)});else if("warning"===t){const t=e.createOscillator(),o=e.createGain();t.type="sine",t.frequency.setValueAtTime(880,n),o.gain.setValueAtTime(.001,n),o.gain.exponentialRampToValueAtTime(.1,n+.015),o.gain.exponentialRampToValueAtTime(1e-4,n+.45),t.connect(o),G(e,o),Y(t,o),t.start(n),t.stop(n+.48)}else{const t=e.createOscillator(),o=e.createGain();t.type="sine",t.frequency.setValueAtTime(1320,n),o.gain.setValueAtTime(.001,n),o.gain.exponentialRampToValueAtTime(.08,n+.01),o.gain.exponentialRampToValueAtTime(1e-4,n+.28),t.connect(o),G(e,o),Y(t,o),t.start(n),t.stop(n+.3)}}};let K=!1;function Q(e="info",t){if(!F)return;if(!K&&"undefined"!=typeof window&&window.customizableToast&&"function"==typeof window.customizableToast.playTone&&window.customizableToast.playTone!==Q)try{return K=!0,void window.customizableToast.playTone(e,t)}finally{K=!1}const n=W();if(n)try{"suspended"===n.state&&n.resume().catch(()=>{});const o=n.currentTime,r="number"==typeof e?e:Number.parseFloat(e);if(Number.isFinite(r)&&r>=20&&r<=2e4&&("number"==typeof e||/^\d+(\.\d+)?(hz)?$/i.test(String(e).trim()))){const e=n.createOscillator(),t=n.createGain();return e.type="sine",e.frequency.setValueAtTime(r,o),t.gain.setValueAtTime(.001,o),t.gain.exponentialRampToValueAtTime(.1,o+.015),t.gain.exponentialRampToValueAtTime(1e-4,o+.35),e.connect(t),G(n,t),Y(e,t),e.start(o),void e.stop(o+.36)}const s=String(e||"info").toLowerCase().trim(),a=String(t||i().soundPreset||"modern").toLowerCase().trim();if(j.has(a))try{const e=j.get(a);if("function"==typeof e)return void e(n,s,o)}catch(e){console.warn("Custom sound preset synthesizer error:",e)}(X[a]||X.modern)(n,s,o)}catch{}}function J(e,t){if("string"!=typeof e||!e.trim()||"function"!=typeof t)return!1;const n=e.toLowerCase().trim();return j.set(n,t),!0}function Z(){const e=Object.keys(X),t=Array.from(j.keys());return Array.from(new Set([...e,...t]))}function ee(){j.clear()}function te(e){F=Boolean(e)}function ne(){return F}function oe(){if(q)try{q.close?.().catch?.(()=>{})}catch{}q=null,H=null}const ie={default:{stiffness:100,damping:10,mass:1,bezierFallback:"cubic-bezier(0.34, 1.4, 0.64, 1)"},gentle:{stiffness:120,damping:14,mass:1,bezierFallback:"cubic-bezier(0.25, 1, 0.5, 1)"},wobbly:{stiffness:180,damping:12,mass:1,bezierFallback:"cubic-bezier(0.35, 1.6, 0.55, 1)"},stiff:{stiffness:210,damping:20,mass:1,bezierFallback:"cubic-bezier(0.18, 0.9, 0.32, 1)"},bouncy:{stiffness:300,damping:15,mass:1.2,bezierFallback:"cubic-bezier(0.34, 1.75, 0.5, 1)"}},re=new Map;function se(e,t){if("string"!=typeof e||!e.trim())throw new TypeError("registerSpringPreset: name must be a non-empty string");if(!t||"object"!=typeof t||Array.isArray(t))throw new TypeError("registerSpringPreset: config must be an object");const n=Number(t.stiffness),o=Number(t.damping),i=Number(t.mass);re.set(e.trim().toLowerCase(),{stiffness:Number.isFinite(n)&&n>0?n:100,damping:Number.isFinite(o)&&o>0?o:10,mass:Number.isFinite(i)&&i>0?i:1,bezierFallback:"string"==typeof t.bezierFallback&&t.bezierFallback.trim()?t.bezierFallback.trim():"cubic-bezier(0.34, 1.4, 0.64, 1)"})}function ae(){return[...Object.keys(ie),...re.keys()]}function le(){re.clear()}function ce(e){if(!e)return null;if("string"==typeof e){const t=e.trim().toLowerCase();return re.has(t)?re.get(t):Object.prototype.hasOwnProperty.call(ie,t)?ie[t]:ie.default}if(!0===e)return ie.default;if("object"==typeof e&&!Array.isArray(e)){const t=Number(e.stiffness),n=Number(e.damping),o=Number(e.mass),i=Number.isFinite(t)&&t>0?t:100,r=Number.isFinite(n)&&n>0?n:10,s=Number.isFinite(o)&&o>0?o:1,a=r/(2*Math.sqrt(i*s));let l="string"==typeof e.bezierFallback&&e.bezierFallback.trim()?e.bezierFallback.trim():"cubic-bezier(0.25, 1, 0.5, 1)";return e.bezierFallback||(a<.6?l="cubic-bezier(0.34, 1.7, 0.55, 1)":a<.85&&(l="cubic-bezier(0.34, 1.35, 0.64, 1)")),{stiffness:i,damping:r,mass:s,bezierFallback:l}}return null}function ue(e,t){if(e<=0)return 0;const n=Math.max(.001,t?.stiffness||100),o=Math.max(.001,t?.damping||10),i=Math.max(.001,t?.mass||1),r=Math.sqrt(n/i),s=o/(2*Math.sqrt(n*i));if(Math.abs(s-1)<1e-4)return 1-Math.exp(-r*e)*(1+r*e);if(s<1){const t=r*Math.sqrt(1-s*s);return 1-Math.exp(-s*r*e)*(Math.cos(t*e)+s/Math.sqrt(1-s*s)*Math.sin(t*e))}const a=r*Math.sqrt(s*s-1),l=-s*r+a,c=-s*r-a,u=-l/(c-l);return 1-(c/(c-l)*Math.exp(l*e)+u*Math.exp(c*e))}function de(e,t=.005){if(!e)return 400;const n=Math.max(.001,e.stiffness||100),o=Math.max(.001,e.damping||10),i=Math.max(.001,e.mass||1);let r=3;for(let e=.1;e<=3;e+=.01){const s=ue(e,{stiffness:n,damping:o,mass:i});if(Math.abs(s-1)<=t){let s=!0;for(let r=e;r<=Math.min(3,e+.12);r+=.01)if(Math.abs(ue(r,{stiffness:n,damping:o,mass:i})-1)>t){s=!1;break}if(s){r=e;break}}}const s=Math.round(1e3*r);return Math.max(150,Math.min(2500,s))}function pe(e,t=32){const n=de(e)/1e3,o=[];for(let i=0;i<=t;i++){const r=i/t,s=ue(r*n,e),a=Math.round(1e3*s)/1e3,l=Math.round(1e3*r)/10;o.push(`${a} ${l}%`)}return`linear(${o.join(", ")})`}function fe(e){const t=ce(e);if(!t)return null;const n=de(t),o=pe(t),i=function(){if("undefined"==typeof window||"undefined"==typeof CSS||"function"!=typeof CSS.supports)return!1;try{return CSS.supports("transition-timing-function","linear(0 0%, 1 100%)")||CSS.supports("transition-timing-function","linear(0, 1)")||CSS.supports("animation-timing-function","linear(0 0%, 1 100%)")}catch{return!1}}()?o:t.bezierFallback||"cubic-bezier(0.34, 1.4, 0.64, 1)";return{config:{stiffness:t.stiffness,damping:t.damping,mass:t.mass},duration:n,easing:i,isSpring:!0}}const me=new Set(["svg","g","path","circle","rect","line","polyline","polygon","ellipse","title","desc","defs","clippath","use"]),he=new Set(["viewbox","width","height","fill","stroke","stroke-width","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-dasharray","stroke-dashoffset","opacity","fill-opacity","stroke-opacity","d","cx","cy","r","x","y","x1","y1","x2","y2","points","rx","ry","transform","role","aria-hidden","focusable","xmlns","preserveaspectratio","class","id","href","xlink:href"]);function ye(e=""){return/^\s*javascript:/i.test(e)}function ge(e){const t="undefined"!=typeof DOMParser?DOMParser:"undefined"!=typeof window&&window.DOMParser?window.DOMParser:null;if(!t)return null;try{const n=(new t).parseFromString(e,"image/svg+xml");if(n.querySelector("parsererror"))return null;const o=n.documentElement;if(!o||"svg"!==o.tagName.toLowerCase())return null;const i=e=>{if(3===e.nodeType)return document.createTextNode(e.textContent||"");if(1!==e.nodeType)return null;const t=e.tagName.toLowerCase();if(!me.has(t))return null;const n=document.createElementNS("http://www.w3.org/2000/svg",t);if(e.attributes)for(let o=0;o<e.attributes.length;o++){const i=e.attributes[o],r=i.name,s=r.toLowerCase(),a=i.value||"";if(!s.startsWith("on")&&he.has(s)){if("href"===s||"xlink:href"===s){if(ye(a))continue;if("use"===t&&a&&!a.startsWith("#"))continue}n.setAttribute(r,a)}}if(e.childNodes)for(let t=0;t<e.childNodes.length;t++){const o=i(e.childNodes[t]);o&&n.appendChild(o)}return n};return i(o)}catch{return null}}const be={success:'\n <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">\n <path d="M20 6L9 17l-5-5"/>\n </svg>\n ',error:'\n <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">\n <circle cx="12" cy="12" r="10"/>\n <line x1="15" y1="9" x2="9" y2="15"/>\n <line x1="9" y1="9" x2="15" y2="15"/>\n </svg>\n ',warning:'\n <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">\n <path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"/>\n <line x1="12" y1="9" x2="12" y2="13"/>\n <line x1="12" y1="17" x2="12.01" y2="17"/>\n </svg>\n ',info:'\n <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">\n <circle cx="12" cy="12" r="10"/>\n <line x1="12" y1="16" x2="12" y2="12"/>\n <line x1="12" y1="8" x2="12.01" y2="8"/>\n </svg>\n '};function we(e={}){const t=e&&"object"==typeof e&&!Array.isArray(e)?e:{};let n=t.icon;if(void 0===n){const e=i().icon;void 0!==e&&(n=e)}if("function"==typeof n)try{n=n(t)}catch(e){console.warn("options.icon callback error:",e),n=null}if(!1===n||""===n||null===n)return null;if("undefined"==typeof document)return null;const o=t.type,r=i(),s=document.createElement("i");s.className="toast-icon",s.setAttribute("aria-hidden","true");const a="rtl"===t.fontDirection;if(r.disableInlineStyles||Object.assign(s.style,{display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:"0",marginLeft:a?"8px":"0px",marginRight:a?"0px":"8px",lineHeight:"1",fontStyle:"normal"}),n&&"object"==typeof n&&(1===n.nodeType||11===n.nodeType||"undefined"!=typeof HTMLElement&&n instanceof HTMLElement)&&"function"==typeof n.cloneNode)return s.appendChild(n.cloneNode(!0)),s;if("string"==typeof n&&n.trim()){const e=n.trim(),t={check:be.success,checkmark:be.success,success:be.success,cross:be.error,error:be.error,alert:be.warning,warning:be.warning,circle:be.info,info:be.info}[e.toLowerCase()];if(t){const e=ge(t.trim());return e&&s.appendChild(e),s}if(e.startsWith("<svg")&&e.endsWith("</svg>")){const t=ge(e);t?(t.setAttribute("aria-hidden","true"),t.setAttribute("focusable","false"),t.getAttribute("width")||t.setAttribute("width","18"),t.getAttribute("height")||t.setAttribute("height","18"),s.appendChild(t)):s.textContent=e}else s.textContent=e;return s}const l="string"==typeof o?o.toLowerCase().trim():"";if((!0===n||void 0===n)&&l&&be[l]){const e=ge(be[l].trim());return e&&s.appendChild(e),s}return null}function xe(e,t,n){const o=String(e||"").toLowerCase(),i=o.includes("top"),r=o.includes("left"),s=o.includes("right"),a=String(t||"").toLowerCase().trim();return"fade"===a?"none":"zoom"===a||"scale"===a?"scale(0.75)":"flip"===a?"perspective(600px) rotateX(45deg)":"slide"===a?r?"translateX(-100%)":s?"translateX(100%)":i?"translateY(-100%)":"translateY(100%)":n?!o.includes("center")||i||o.includes("bottom")?i?"translateY(-36px) scale(0.92)":"translateY(36px) scale(0.92)":r?"translateX(-36px) scale(0.92)":s?"translateX(36px) scale(0.92)":"scale(0.85)":"bounce"===a?i?"translateY(-36px) scale(0.9)":"translateY(36px) scale(0.9)":i?"translateY(-20px)":"translateY(20px)"}async function ve(e={},t){try{const n=i(),o=document.createElement("div"),r=e?.position||n.defaultPosition,s=String(r).toLowerCase().trim();let a="auto",l="auto",c="auto",u="auto",d="none";s.startsWith("top")?a="20px":(s.startsWith("bottom")||s.includes("below"))&&(l="20px"),s.startsWith("left")?c="20px":s.startsWith("right")?u="20px":"center"===s?(c="50%",a="50%",d="translate(-50%, -50%)"):s.includes("center")?s.includes("left")?(c="20px",a="50%",d="translateY(-50%)"):s.includes("right")?(u="20px",a="50%",d="translateY(-50%)"):s.includes("top")?(a="20px",c="50%",d="translateX(-50%)"):s.includes("bottom")&&(l="20px",c="50%",d="translateX(-50%)"):(u="20px",l="20px"),o.className="toast-emergency",o.tabIndex=0,o.setAttribute("role","alert"),o.setAttribute("aria-live","assertive"),n.disableInlineStyles||Object.assign(o.style,{background:"#333",color:"white",padding:"10px 15px",position:"fixed",top:a,bottom:l,left:c,right:u,transform:d,zIndex:String(n.zIndex+100),borderRadius:"3px",maxWidth:"250px",wordWrap:"break-word",boxShadow:"0 2px 10px rgba(0,0,0,0.3)"});const p=document.createElement("div"),f=document.createElement("span");if(f.className="toast-emergency-message",n.disableInlineStyles||(f.style.display="inline-block"),e.allowHtml)try{const t=w(String(e.message||"Emergency Toast Showing!")),n=document.createElement("div");for(n.innerHTML=t;n.firstChild;)f.appendChild(n.firstChild)}catch{f.appendChild(document.createTextNode(String(e.message||"Emergency Toast Showing!")))}else f.textContent=String(e.message||"Emergency Toast Creation Showing!");p.appendChild(f);const m=document.createElement("button");for(m.type="button",m.className="toast-emergency-close",m.setAttribute("aria-label","Close emergency notification"),n.disableInlineStyles||Object.assign(m.style,{float:"right",marginLeft:"10px",fontWeight:"bold",cursor:"pointer",background:"transparent",border:"none",color:"inherit",padding:"0",font:"inherit"}),m.textContent="×",p.appendChild(m);o.firstChild;)o.removeChild(o.firstChild);o.appendChild(p);let h=null;const y=()=>{h&&clearTimeout(h),m.removeEventListener("click",y),o.remove(),"function"==typeof t&&t(o)};m.addEventListener("click",y);const g=Number(e?.duration)||2500;return h=setTimeout(()=>{m.removeEventListener("click",y),o.remove(),"function"==typeof t&&t(o)},g),"function"==typeof h?.unref&&h.unref(),o}catch(e){return console.error("Emergency toast creation failed:",e),"function"==typeof t&&t(null),null}}class Te{constructor(e=5,t=50){this.initialSize=Math.max(1,Math.floor(e)),this.maxSize=Math.max(this.initialSize,Math.floor(t)),this.pool=[],this.inUseCount=0;for(let e=0;e<this.initialSize;e++)this.pool.push({element:this._createToastElement(),inUse:!1,id:null})}_createToastElement(){if("undefined"==typeof document)return{className:"toast",setAttribute(){},removeAttribute(){},appendChild(){},removeChild(){},style:{},childNodes:[]};const e=document.createElement("div");return e.className="toast",e.setAttribute("role","alert"),e.setAttribute("aria-live","polite"),e.tabIndex=0,e}acquire(e){if(!e||"string"!=typeof e)throw new Error("Toast ID required for pool allocation");let t=this.pool.find(e=>!e.inUse);!t&&this.pool.length<this.maxSize&&(t={element:this._createToastElement(),inUse:!1,id:null},this.pool.push(t));let n=!1;return t||(t=this.pool[0],n=!0,t.element._cleanupSwipe&&t.element._cleanupSwipe(),t.element._cleanupCloseButton&&t.element._cleanupCloseButton(),t.element._cleanupCTA&&t.element._cleanupCTA(),t.element._cleanupUndo&&t.element._cleanupUndo(),t.element._pauseCleanup&&t.element._pauseCleanup(),t.element._cleanup&&t.element._cleanup(),t.element.parentNode&&t.element.parentNode.removeChild(t.element),t.element=this._createToastElement()),t.element.innerHTML="",t.element.className="toast",t.element.removeAttribute("style"),t.element.setAttribute("role","alert"),t.element.id=`toast-${e}`,t.element._pooledId=e,delete t.element._progressAnimation,delete t.element._pauseCleanup,delete t.element._cleanupSwipe,delete t.element._cleanupCloseButton,delete t.element._cleanupCTA,delete t.element._cleanupUndo,delete t.element._key,delete t.element._cleanup,t.inUse=!0,t.id=e,n||(this.inUseCount+=1),t.element}release(e,t){if(!e&&!t)return;const n=e instanceof HTMLElement?e:null,o="string"==typeof t?t:"string"==typeof e?e:null,i=this.pool.find(e=>n&&e.element===n||o&&e.id===o);i&&i.inUse&&(i.element.parentNode&&i.element.parentNode.removeChild(i.element),i.element=this._createToastElement(),i.inUse=!1,i.id=null,this.inUseCount=Math.max(0,this.inUseCount-1))}getStats(){return{total:this.pool.length,inUse:this.inUseCount,available:this.pool.length-this.inUseCount,utilization:this.pool.length>0?this.inUseCount/this.pool.length*100:0,maxSize:this.maxSize}}clear(){this.pool.forEach(e=>{e.element.parentNode&&e.element.parentNode.removeChild(e.element)}),this.pool=[],this.inUseCount=0}compact(){if(this.pool.length>this.initialSize){const e=this.pool.filter(e=>!e.inUse),t=Math.max(0,e.length-this.initialSize);if(t>0)for(let n=0;n<t;n++){const t=this.pool.indexOf(e[n]);t>-1&&this.pool.splice(t,1)}}}}let Ae=null;function Se(e=5,t=50){return Ae||(Ae=new Te(e,t)),Ae}function Ce(){Ae&&(Ae.clear(),Ae=null)}async function ke(e,t){let n;const o="toast";try{if(e?.usePool){const e=c(o);n=Se().acquire(e),n._pooledId=e}else n=await async function(e,t){const n=document.createElement("div");return n.id=c(t),n}(0,o);return await async function(e,t,n){const o=i(),r=t?.spring?fe(t.spring):null,s=r?r.duration:await async function(e){if("number"==typeof e&&Number.isFinite(e)&&e>=0)return e;if("string"==typeof e){const t=e.trim().toLowerCase();if(t.endsWith("s")&&!t.endsWith("ms")){const e=1e3*Number.parseFloat(t);return Number.isFinite(e)&&e>=0?e:500}const n=Number.parseFloat(t);return Number.isFinite(n)&&n>=0?n:500}return 500}(t?.animationDuration),a=`${s}ms`,l=r?r.easing:"string"==typeof t?.animationEasing&&t.animationEasing.trim()?t.animationEasing.trim():"ease";r&&(e._spring=r),e._animationType=t?.animationType;const c="string"==typeof t?.className&&t.className.trim()?` ${t.className.trim()}`:"";e.className=`toast toast-${t?.type??"info"}${c}`;const u="number"==typeof t?.borderRadius?`${t.borderRadius}px`:t?.borderRadius,d="number"==typeof t?.maxWidth?`${t.maxWidth}px`:t?.maxWidth,p=r?`${Math.min(300,s)}ms`:a,f=r?"ease":l;o.disableInlineStyles||Object.assign(e.style,{background:t?.backgroundColor,padding:"12px 16px",marginBottom:"10px",borderRadius:u,overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"space-between",boxShadow:"0 4px 6px rgba(0, 0, 0, 0.1)",minWidth:"250px",maxWidth:d,opacity:"0",position:"relative",cursor:"default",boxSizing:"border-box",userSelect:"text",pointerEvents:"auto",transition:`opacity ${p} ${f}, transform ${a} ${l}`,transform:xe(t?.position,t?.animationType,!!r),zIndex:String(o.zIndex),direction:t?.fontDirection&&"auto"!==t.fontDirection?t.fontDirection:L()?"rtl":void 0});const m="error"===t?.type,h=t?.role||"alert",y=t?.ariaLive||(m?"assertive":"polite");e.setAttribute("role",h),e.setAttribute("aria-live",y),e.tabIndex=0,e._animationDuration=s;const g=document.createElement("span");g.className="toast-message",e._messageSpan=g,"truncate"!==t?.wrapText&&"ellipsis"!==t?.wrapText&&!1!==t?.wrapText&&t?.wrapText?o.disableInlineStyles||Object.assign(g.style,{display:"block",whiteSpace:"normal"}):(g.classList.add("is-truncated"),o.disableInlineStyles||Object.assign(g.style,{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:"3",whiteSpace:"normal",overflow:"hidden",textOverflow:"ellipsis"}));const b="number"==typeof t?.fontSize?`${t.fontSize}px`:t?.fontSize;o.disableInlineStyles||Object.assign(g.style,{flex:"1",padding:t?.fontPadding,fontFamily:t?.fontFamily,fontSize:b,fontWeight:t?.fontWeight,lineHeight:t?.fontLineHeight,color:t?.textColor,userSelect:"text",wordBreak:"break-word",overflow:"hidden",textOverflow:"ellipsis",direction:t?.fontDirection&&"auto"!==t.fontDirection?t.fontDirection:void 0});const v=!!t.allowHtml,T=t.message??"",A=we(t);if(A&&e.appendChild(A),t.loader||t.showLoader){const e=x(t.loader||{});g.appendChild(e);const n=document.createElement("span");n.className="toast-message-spacer",o.disableInlineStyles||(n.style.display="inline-block",n.style.width="8px"),g.appendChild(n)}if(v&&"string"==typeof T&&T.trim().length>0)try{const e=w(T),t=document.createElement("div");for(t.innerHTML=e;t.firstChild;)g.appendChild(t.firstChild)}catch(e){console.warn("HTML message sanitization failed, falling back to text:",e),g.appendChild(document.createTextNode(String(T)))}else g.appendChild(document.createTextNode(String(T)));g.setAttribute("title",g.textContent||""),e.appendChild(g),t?.cta&&"object"==typeof t.cta&&I(e,t,n),t?.undo&&N(e,t,n),t?.showCloseButton&&B(e,t,n),!1===t?.showProgressBar||!t?.showProgressBar&&void 0===t?.progress||R(e,t),!1!==(void 0!==t?.swipeToDismiss?t.swipeToDismiss:o.swipeToDismiss)&&O(e,n),(void 0!==t?.sound?t.sound:o.sound)&&Q("string"==typeof t.sound||"number"==typeof t.sound?t.sound:t?.type||"info",t?.soundPreset||o.soundPreset||"modern"),(t?.trapFocus??o.trapFocus)&&function(e){if(!e||"function"!=typeof e.querySelectorAll)return null;const t=()=>Array.from(e.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')).filter(e=>{try{if("number"==typeof e.offsetWidth&&"number"==typeof e.offsetHeight){const t="undefined"!=typeof window&&window.getComputedStyle?window.getComputedStyle(e):null;if(t&&("none"===t.display||"hidden"===t.visibility))return!1;if("undefined"!=typeof document&&document.body&&(document.body.offsetWidth>0||document.body.offsetHeight>0)&&0===e.offsetWidth&&0===e.offsetHeight)return e===document.activeElement}return!0}catch{return!0}}),n=n=>{if("Tab"!==n.key)return;if(!e.isConnected&&e.parentNode!==document.body)return;const o=t();if(0===o.length)return;const i=o[0],r=o[o.length-1];n.shiftKey?document.activeElement!==i&&e.contains(document.activeElement)||(r.focus(),n.preventDefault()):document.activeElement!==r&&e.contains(document.activeElement)||(i.focus(),n.preventDefault())};e.addEventListener("keydown",n),"undefined"!=typeof document&&document.addEventListener("keydown",n);const o=setTimeout(()=>{const e=t();e.length>0&&"function"==typeof e[0].focus&&e[0].focus()},30);"function"==typeof o?.unref&&o.unref(),e._cleanupFocusTrap=()=>{clearTimeout(o),e.removeEventListener("keydown",n),"undefined"!=typeof document&&document.removeEventListener("keydown",n)}}(e),V(e)}(n,e,t),n}catch(o){if(e?.usePool&&n?._pooledId)try{Se().release(n,n._pooledId)}catch{}return console.warn("toast creation failed with error showing fallback one: ",o),n=await ve(e,t),n}}const _e=new Map,Ee=new Map;function Le(e){if(!e||"string"!=typeof e)return"bottom-right";const t=e.toLowerCase().trim();if(!t)return"bottom-right";const n=t.replace(/\bbelow\b/g,"bottom").replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"-").replace(/-{2,}/g,"-");return{"center-top":"top-center","center-bottom":"bottom-center","center-left":"left-center","center-right":"right-center",top:"top-center",bottom:"bottom-center"}[n]||n}function Me(e){return`toast-container-${Le(e)}`}function Ie(e){const t=i();e.className="toast-container-base",t.disableInlineStyles||(e.style.position="fixed",e.style.zIndex=String(t.zIndex),e.style.pointerEvents="none",e.style.inset="auto 10px 10px auto",e.style.display="flex",e.style.justifyContent="space-between",e.style.alignItems="center",e.style.flexDirection="column",e.style.overflow="hidden")}async function Ne(e={},n){const o=i(),r=Me(e?.position||o.defaultPosition);let s=(a=t.targetNode)&&"object"==typeof a&&"function"==typeof a.appendChild?t.targetNode:"undefined"!=typeof document?document.body:null;var a;if(!s)throw new Error("Toast container root is unavailable");if(Boolean(e?.shadowDom??o.shadowDom)&&"undefined"!=typeof document&&"function"==typeof document.createElement){let e=null;try{e=s.querySelector?s.querySelector("#toast-shadow-host"):null}catch{}if(e||(e=document.createElement("div"),e.id="toast-shadow-host",e.style.position="fixed",e.style.zIndex=String(o.zIndex||9999),e.style.pointerEvents="none",e.style.inset="0",e.style.overflow="visible",s.appendChild(e)),!e.shadowRoot&&"function"==typeof e.attachShadow)try{e.attachShadow({mode:"open"})}catch{}if(e.shadowRoot&&(s=e.shadowRoot,!s.querySelector("style[data-toast-shadow-style]"))){const e=document.createElement("style");e.setAttribute("data-toast-shadow-style","true"),e.textContent=`\n :host { position: fixed; inset: 0; pointer-events: none; z-index: ${o.zIndex||9999}; }\n * { box-sizing: border-box; }\n `,s.appendChild(e)}}if(Ee.has(r))return Ee.get(r);const l=(async()=>{const t=_e.get(r);if(function(e,t){return!(!e||!t)&&(t===document.body?e.isConnected&&e.ownerDocument===document:"function"==typeof t.contains?t.contains(e):e.isConnected&&e.ownerDocument===document)}(t,s))return t;t&&_e.delete(r);let o=function(e,t){return e?"function"==typeof e.getElementById?e.getElementById(t):"function"==typeof e.querySelector?e.querySelector(`#${t}`):null:null}(s,r);if(o)Ie(o),"function"==typeof n&&await n(o,e);else{const t=s?.ownerDocument||("undefined"!=typeof document?document:null);if(!t)throw new Error("Document is unavailable");o=t.createElement("div"),o.id=r,o.setAttribute("role","status"),o.setAttribute("aria-atomic","true"),Ie(o),"function"==typeof n&&await n(o,e),s.appendChild(o)}if("function"==typeof s.querySelectorAll){const e=s.querySelectorAll(`#${r}`);if(e.length>1)for(let t=1;t<e.length;t++)try{e[t].remove()}catch{}}return _e.set(r,o),o})();Ee.set(r,l);try{return await l}finally{Ee.delete(r)}}const Be=new Set(["top-left","top-right","bottom-left","bottom-right","top-center","bottom-center","center-top","center-bottom","left-center","right-center","center-left","center-right","top-full-width","bottom-full-width","center"]),ze=new Set(["top","bottom"]),Pe=[...Be,...ze];async function De(e,t={}){if(!e||!t||"object"!=typeof t)throw new Error("Invalid container or position!");const n=i(),o=String(t?.position||n.defaultPosition||"bottom-right").toLowerCase().trim().replace(/\s+/g,"-");let r=o;var s;if(s=o,Be.has(s)||ze.has(o)||(console.warn(`Unknown position "${t.position}", defaulting to "bottom-right"`),r="bottom-right"),function(e){if(e?.classList)for(let t=0;t<Pe.length;t++)e.classList.remove("toast-position-"+Pe[t])}(e),e.classList?.add("toast-position-"+r),i().disableInlineStyles)return;!function(e){e.style.top="auto",e.style.bottom="auto",e.style.left="auto",e.style.right="auto",e.style.transform="none",e.style.maxWidth="none"}(e);const a=function(e){const t=e.toLowerCase().trim(),n="top-full-width"===t||"bottom-full-width"===t;return{hasTop:t.startsWith("top")||t.endsWith("top"),hasBottom:t.startsWith("bottom")||t.endsWith("bottom")||t.includes("below"),hasLeft:t.startsWith("left")||t.endsWith("left"),hasRight:t.startsWith("right")||t.endsWith("right"),hasCenter:t.includes("center"),hasFullWidth:n}}(r);(function(e,t){return!!t.hasFullWidth&&(e.style.maxWidth="100vw",t.hasTop?(e.style.top="10px",e.style.left="10px",e.style.right="10px",!0):!!t.hasBottom&&(e.style.bottom="10px",e.style.left="10px",e.style.right="10px",!0))})(e,a)||function(e,t){return!!t.hasCenter&&(!t.hasTop||t.hasLeft||t.hasRight?!t.hasBottom||t.hasLeft||t.hasRight?!t.hasLeft||t.hasTop||t.hasBottom?!t.hasRight||t.hasTop||t.hasBottom?!(t.hasLeft||t.hasRight||t.hasTop||t.hasBottom)&&(e.style.top="50%",e.style.left="50%",e.style.transform="translate(-50%, -50%)",!0):(e.style.right="10px",e.style.top="50%",e.style.transform="translateY(-50%)",!0):(e.style.left="10px",e.style.top="50%",e.style.transform="translateY(-50%)",!0):(e.style.bottom="10px",e.style.left="50%",e.style.transform="translateX(-50%)",!0):(e.style.top="10px",e.style.left="50%",e.style.transform="translateX(-50%)",!0))}(e,a)||function(e,t){t.hasBottom?e.style.bottom="10px":t.hasTop?e.style.top="10px":e.style.bottom="10px",t.hasRight?e.style.right="10px":t.hasLeft?e.style.left="10px":(e.style.left="50%",e.style.transform="translateX(-50%)")}(e,a)}class Re{constructor(e,t){this.callback="function"==typeof e?e:()=>{};const n=t===1/0,o=Number.isFinite(t)&&t>=0?t:n?1/0:0;this.delay=o,this.remaining=o,this.startTime=null,this.timeoutId=null,this.isPaused=!1,this.isCompleted=!1,this.isInfinite=n}start(){return this.isCompleted||this.timeoutId||this.isInfinite||(this.isPaused=!1,this.startTime=Date.now(),this.timeoutId=setTimeout(()=>{this.isCompleted=!0,this.timeoutId=null;try{this.callback()}catch(e){console.error("PausableTimer callback error:",e)}},this.remaining),"function"==typeof this.timeoutId?.unref&&this.timeoutId.unref()),this}pause(){if(this.isPaused||!this.timeoutId||this.isCompleted)return this;clearTimeout(this.timeoutId),this.timeoutId=null;const e=Math.max(0,Date.now()-this.startTime);return this.remaining=Math.min(this.delay,Math.max(0,this.remaining-e)),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}}class Ve{constructor(){this.channel=null,this.tabId=this._generateTabId(),this.isLeadTab=!1,this.leaderTimer=null,this.listeners=new Map,this.supportsBroadcastChannel="undefined"!=typeof BroadcastChannel,this.supportsBroadcastChannel&&this._initBroadcastChannel()}_generateTabId(e=("undefined"!=typeof crypto?crypto:null)){const t=Date.now().toString(36);let n="";if(e&&"function"==typeof e.getRandomValues)try{const t=new Uint32Array(2);e.getRandomValues(t),n=`${t[0].toString(36)}${t[1].toString(36)}`.slice(0,9)}catch{}if(!n){const e="undefined"!=typeof performance&&"function"==typeof performance.now?Math.floor(1e3*performance.now()):0;n=((Date.now()^e)>>>0).toString(36).slice(0,9)}return`tab-${t}-${n}`}_initBroadcastChannel(){try{if(this.channel=new BroadcastChannel("toast-notifications"),this.channel.unref?.(),this.channel.onmessage=e=>this._handleMessage(e.data),this._becomeLeadIfNeeded(),"undefined"!=typeof window){const e=()=>{if(this.isLeadTab&&this.channel)try{this.broadcast("leader-abdicate","",{tabId:this.tabId})}catch{}};window.addEventListener("beforeunload",e),window.addEventListener("pagehide",e)}}catch(e){console.warn("[Toast] BroadcastChannel initialization failed:",e),this.supportsBroadcastChannel=!1}}_becomeLeadIfNeeded(){this.channel&&(this.broadcast("sync-request","",{}),this.leaderTimer=setTimeout(()=>{this.leaderTimer=null,this.isLeadTab||(this.isLeadTab=!0,this.broadcast("leader-elected","",{tabId:this.tabId}))},1e3),this.leaderTimer.unref?.())}broadcast(e,t="",n={}){if(!this.supportsBroadcastChannel||!this.channel)return;let o=t,i=n;"object"==typeof t&&null!==t&&0===Object.keys(n).length&&(i=t,o="");const r={type:e,toastId:"string"==typeof o?o:String(o??""),payload:i&&"object"==typeof i?i:{},timestamp:Date.now(),tabId:this.tabId};try{this.channel.postMessage(r)}catch(e){console.warn("[Toast] Failed to broadcast message:",e)}}_handleMessage(e){if(!e||e.tabId===this.tabId)return;const{type:t,toastId:n,payload:o}=e;return"leader-elected"===t?(this.leaderTimer&&(clearTimeout(this.leaderTimer),this.leaderTimer=null),void(this.isLeadTab=!1)):"leader-abdicate"===t?(this.isLeadTab=!1,void this._becomeLeadIfNeeded()):("sync-response"===t&&this.leaderTimer&&(clearTimeout(this.leaderTimer),this.leaderTimer=null),void("sync-request"===t&&this.isLeadTab?this.broadcast("sync-response","all-toasts",{active:Array.from(this._getActiveToasts?.()||[]),queue:this._getQueuedToasts?.()||[]}):(this.listeners.get(t)||[]).forEach(i=>{try{i({toastId:n,payload:o,message:e})}catch(e){console.warn(`[Toast] Listener error for ${t}:`,e)}})))}on(e,t){if("function"!=typeof t)throw new Error("Callback must be a function");return this.listeners.has(e)||this.listeners.set(e,[]),this.listeners.get(e).push(t),()=>{const n=this.listeners.get(e)||[],o=n.indexOf(t);o>-1&&n.splice(o,1)}}registerActiveToastsGetter(e){this._getActiveToasts=e}registerQueuedToastsGetter(e){this._getQueuedToasts=e}isSupported(){return this.supportsBroadcastChannel}getTabId(){return this.tabId}isLeadingTab(){return this.isLeadTab}destroy(){if(this.leaderTimer&&(clearTimeout(this.leaderTimer),this.leaderTimer=null),this.channel)try{this.channel.close()}catch(e){console.warn("[Toast] Failed to close BroadcastChannel:",e)}this.listeners.clear(),this.channel=null}}let Oe=null;function qe(){if(!Oe&&(Oe=new Ve,"undefined"!=typeof window)){const e=()=>{Oe?.destroy(),Oe=null};window.addEventListener("pagehide",e),window.addEventListener("beforeunload",e)}return Oe}function Fe(){Oe&&(Oe.destroy(),Oe=null)}const $e={error:85,warning:70,info:40,success:30},je=["error","critical","severe","emergency","failure","fatal","crash","urgent","important","attention","immediate","now","fast","deadline","due","timeout","expired","overdue","security","breach","attack","unauthorized","hack","lost","missing","offline","down","unavailable","outage","downtime","broken","malfunction","defect","bug","data loss","corruption","invalid","wrong","incorrect","blocked","stopped","halted","paused","interrupted","exceeded","limit","quota","full","capacity","cannot","unable","failed","rejected","denied","blocked","invalid","expired","credentials","password","auth","payment","billing","charge","transaction","money","account","profile","settings","preferences"].map(e=>({keyword:e,regex:new RegExp(`\\b${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`,"i")})),We=["success","completed","finished","done","ready","info","information","note","notice","reminder","progress","processing","loading","saving","uploading","test","demo","sample","example","placeholder","updated","changed","modified","edited","created","connected","disconnected","online","offline"].map(e=>({keyword:e,regex:new RegExp(`\\b${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`,"i")}));function He(e){if(!e||"object"!=typeof e)return{score:50,breakdown:{base:50},keywords:[]};const{type:t,message:n,duration:o}=e,i={},r=[];let s=50;const a=$e[t]||50;i.type=a,s+=.6*(a-50);const l="string"==typeof n?n:String(n??""),c=l.toLowerCase();let u=0;for(let e=0;e<je.length;e++){const{keyword:t,regex:n}=je[e];n.test(l)&&(r.push(t),u+=2)}for(let e=0;e<We.length;e++){const{keyword:t,regex:n}=We[e];n.test(l)&&(r.push(t),u-=1)}if(i.urgency=Math.min(Math.max(u,-10),20),s+=i.urgency,o===1/0||0===o)i.duration=30,s+=15;else if("number"==typeof o&&Number.isFinite(o)&&o>0){const e=Math.max(0,30-o/1e3);i.duration=Math.round(e),s+=.5*e}const d=c.length;if(d>0){const e=Math.min(10,Math.floor(d/50));i.length=-e,s-=e}const p=(l.match(/!/g)||[]).length,f=Math.min(5,p);i.emphasis=f,s+=f;const m=(l.match(/\b[A-Z]{3,}\b/g)||[]).length,h=Math.min(5,m);return i.caps=h,s+=h,s=Math.max(0,Math.min(100,Math.round(s))),{score:s,breakdown:i,keywords:[...new Set(r)]}}function Ue(e){if(!e||"string"!=typeof e)return["unknown"];const t=e.toLowerCase(),n=[];return/\b(security|auth|password|unauthorized|breach|hack)\b/i.test(t)&&n.push("security"),/\b(performance|slow|timeout|load|latency|responsive)\b/i.test(t)&&n.push("performance"),/\b(user|profile|account|preferences|settings|avatar)\b/i.test(t)&&n.push("user"),/\b(system|server|database|network|connection|backend)\b/i.test(t)&&n.push("system"),/\b(payment|transaction|billing|charge|order|cart)\b/i.test(t)&&n.push("business"),/\b(ui|interface|click|scroll|mobile)\b/i.test(t)&&n.push("ui"),0===n.length&&n.push("general"),n}function Ge(e,t){if(!e||!t||"number"!=typeof e.x||"number"!=typeof t.x||"number"!=typeof e.y||"number"!=typeof t.y)return 0;const n=t.x-e.x,o=t.y-e.y;return Math.sqrt(n*n+o*o)}function Ye(e,t){const n=Number(e),o=Number(t);return!Number.isFinite(n)||!Number.isFinite(o)||o<0?0:0===o?0===n?0:1/0:Math.abs(n)/o}function Xe(e,t,n=.5,o=50){const i=Number(e),r=Number(t);return!(!Number.isFinite(i)||!Number.isFinite(r))&&i>=n&&Math.abs(r)>=o}function Ke(e){const t=[];if(e.touches&&e.touches.length>0)for(let n=0;n<e.touches.length;n++){const o=e.touches[n];t.push({x:o.clientX,y:o.clientY,id:o.identifier,time:Date.now()})}else if(e.changedTouches&&e.changedTouches.length>0)for(let n=0;n<e.changedTouches.length;n++){const o=e.changedTouches[n];t.push({x:o.clientX,y:o.clientY,id:o.identifier,time:Date.now()})}return t}function Qe(e,t=20){if(0===e.startDistance||0===e.currentDistance)return{isPinch:!1,scale:1,direction:"none"};const n=e.currentDistance-e.startDistance;return{isPinch:Math.abs(n)>=t,scale:e.currentDistance/e.startDistance,direction:n>0?"out":"in",distanceChange:n}}function Je(e,t={}){const{onFlick:n,onPinch:o,onSwipe:i,flickVelocityThreshold:r=.5,swipeVelocityThreshold:s=.3,swipeDistanceThreshold:a=50,pinchSensitivity:l=20}=t;let c=null,u=!1;const d=e=>{u=!0,c=function(e){const t=Ke(e);return{touches:t,startTouches:t.map(e=>({...e})),startTime:Date.now(),startDistance:t.length>=2?Ge(t[0],t[1]):0,currentDistance:t.length>=2?Ge(t[0],t[1]):0}}(e)},p=e=>{u&&c&&(c=function(e,t){const n=Ke(t);return{...e,touches:n,currentDistance:n.length>=2?Ge(n[0],n[1]):e.currentDistance}}(c,e))},f=e=>{if(!u||!c)return;u=!1;const t=Qe(c,l);t.isPinch&&"function"==typeof o&&o(t);const d=function(e){if(0===e.startTouches.length||0===e.touches.length)return{distance:0,velocity:0,direction:"none",duration:0};const t=e.startTouches[0],n=(e.touches.find(e=>e.id===t.id)||e.touches[0]).x-t.x,o=Date.now()-e.startTime;return{distance:n,velocity:Ye(n,o),direction:n>0?"right":"left",duration:o}}(c);Xe(d.velocity,d.distance,r,30)&&"function"==typeof n&&n(d);const p=function(e,t=.3,n=50){return e.velocity>=t||Math.abs(e.distance)>=n}(d,s,a);p&&"function"==typeof i&&i(d),c=null};return{attach(){e&&"function"==typeof e.addEventListener&&(e.addEventListener("touchstart",d,{passive:!0}),e.addEventListener("touchmove",p,{passive:!0}),e.addEventListener("touchend",f,{passive:!0}),e.addEventListener("touchcancel",f,{passive:!0}))},detach(){e&&"function"==typeof e.removeEventListener&&(e.removeEventListener("touchstart",d),e.removeEventListener("touchmove",p),e.removeEventListener("touchend",f),e.removeEventListener("touchcancel",f))},getState:()=>c}}let Ze=50;const et=[];function tt(e,t={},n="active"){const o=t&&"object"==typeof t?t:{},i={id:String(e||""),message:String(o.message||""),type:o.type||"info",position:String(o.position||"bottom-right"),timestamp:Date.now(),status:n,options:{...o}};return et.unshift(i),et.length>Ze&&(et.length=Ze),i}function nt(e,t={}){tt(e,t,"dropped")}function ot(){return et.map(e=>({...e,options:{...e.options}}))}function it(){et.length=0}function rt(e){const t=Number(e);Number.isFinite(t)&&t>0&&(Ze=Math.floor(t),et.length>Ze&&(et.length=Ze))}function st(){et.length=0,Ze=50}const at=new Map,lt=new Map,ct=[];let ut=0,dt=0;function pt(){return{activeCount:at.size,queueDepth:ct.length,visibleCount:ut,droppedCount:dt,timestamp:Date.now()}}function ft(){const e=i();if("function"==typeof e.onMetrics)try{e.onMetrics(pt())}catch(e){console.error("onMetrics callback error:",e)}}let mt=qe();function ht(){mt=qe(),mt.isSupported()&&"undefined"!=typeof window&&(mt.registerActiveToastsGetter(()=>Array.from(at.keys())),mt.registerQueuedToastsGetter(()=>ct.map(e=>({key:e.key,options:e.options,count:e.count}))),mt.on("create",({toastId:e,payload:t})=>{i().syncTabs&&e&&t&&!at.has(e)&&!lt.has(e)&&bt({...t.options,fromSync:!0}).catch(console.error)}),mt.on("update",({toastId:e,payload:t})=>{if(i().syncTabs&&e&&t&&at.has(e)){const n=at.get(e);n&&void 0!==t.count&&n.count!==t.count&&(n.count=t.count,_t(n).catch(console.error)),t.newOptions&&"object"==typeof t.newOptions&&Et(e,{...t.newOptions,fromSync:!0}).catch(console.error)}}),mt.on("dismiss",({toastId:e})=>{if(i().syncTabs&&e)if(at.has(e)||lt.has(e))St(e,!0).catch(console.error);else{const t=ct.findIndex(t=>t.key===e);-1!==t&&(ct.splice(t,1),ft())}}),mt.on("sync-response",({payload:e})=>{if(i().syncTabs&&e&&Array.isArray(e.queue))for(const t of e.queue)!t?.options||at.has(t.key)||lt.has(t.key)||bt({...t.options,fromSync:!0}).catch(console.error)}))}function yt(e){if("number"==typeof e?.options?.priority&&Number.isFinite(e.options.priority))return e.options.priority;const t=e?.priority?.score;if("number"==typeof t&&Number.isFinite(t))return t;const n=i();if("function"==typeof n.priorityScorer)try{const t=n.priorityScorer({type:e?.options?.type||"info",message:e?.options?.message||"",duration:e?.options?.duration,options:e?.options});if("number"==typeof t&&Number.isFinite(t))return t;if(t&&"number"==typeof t.score&&Number.isFinite(t.score))return t.score}catch(e){console.warn("[Toast] Custom priorityScorer error, falling back to built-in:",e)}return He(e?.options).score}function gt(e){if(!e||!e.children)return;if("true"!==e.getAttribute("data-stacked"))return;if(!e._stackedInitialized&&"function"==typeof e.addEventListener){e._stackedInitialized=!0;const t=()=>{e._isExpanded=!0,gt(e)},n=()=>{e._isExpanded=!1,gt(e)},o=()=>{e._isExpanded=!0,gt(e)},i=t=>{e.contains(t.relatedTarget)||(e._isExpanded=!1,gt(e))};e.addEventListener("mouseenter",t),e.addEventListener("mouseleave",n),e.addEventListener("focusin",o),e.addEventListener("focusout",i);let r=null;r=Je(e,{onPinch:t=>{"out"!==t.direction||e._isExpanded?"in"===t.direction&&e._isExpanded&&(e._isExpanded=!1,gt(e)):(e._isExpanded=!0,gt(e))}}),r.attach(),e._stackedCleanup=()=>{e.removeEventListener("mouseenter",t),e.removeEventListener("mouseleave",n),e.removeEventListener("focusin",o),e.removeEventListener("focusout",i),r?.detach?.(),e._stackedInitialized=!1}}if(!e.children||0===e.children.length)return;const t=Array.from(e.children),n=t.length,o=Boolean(e._isExpanded),r=Boolean(e.id&&e.id.includes("top"));t.forEach((e,t)=>{const s=n-1-t,a=o?"expanded":s>=3?"overflow":String(s);if("function"==typeof e.setAttribute&&e.setAttribute("data-stacked-depth",a),!i().disableInlineStyles)if(e.style.transition="transform 240ms cubic-bezier(0.16, 1, 0.3, 1), margin 240ms cubic-bezier(0.16, 1, 0.3, 1), opacity 240ms ease",o)e.style.transform="none",e.style.marginTop="0px",e.style.marginBottom="10px",e.style.opacity="1",e.style.zIndex=String(100+t),e.style.pointerEvents="auto";else if(0===s)e.style.transform="scale(1)",e.style.marginTop="0px",e.style.marginBottom="0px",e.style.opacity="1",e.style.zIndex="30",e.style.pointerEvents="auto";else if(1===s){const t=r?10:-10;e.style.transform=`scale(0.95) translateY(${t}px)`,e.style.marginTop="-55px",e.style.marginBottom="0px",e.style.opacity="0.9",e.style.zIndex="20",e.style.pointerEvents="auto"}else if(2===s){const t=r?20:-20;e.style.transform=`scale(0.90) translateY(${t}px)`,e.style.marginTop="-55px",e.style.marginBottom="0px",e.style.opacity="0.75",e.style.zIndex="10",e.style.pointerEvents="auto"}else{const t=r?30:-30;e.style.transform=`scale(0.85) translateY(${t}px)`,e.style.marginTop="-55px",e.style.marginBottom="0px",e.style.opacity="0",e.style.zIndex="1",e.style.pointerEvents="none"}})}async function bt(e={}){try{const t=function(e={}){const t=e&&"object"==typeof e?e:{};if(void 0!==t.id&&null!==t.id&&""!==t.id)return String(t.id);if(void 0!==t.tag&&null!==t.tag&&""!==t.tag){const e=Le(t.position||"bottom-right");return`tag:${String(t.tag).trim()}:${e}`}if(void 0!==t.groupId&&null!==t.groupId&&""!==t.groupId){const e=Le(t.position||"bottom-right");return`group:${String(t.groupId).trim()}:${e}`}return`${String(t.type||"info").trim().toLowerCase()}|${function(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n);return t>>>0}(String(t.message||"")).toString(16)}|${Le(t.position||"bottom-right")}`}(e);if(at.has(t)){const n=at.get(t);if(!n)throw new Error(`Active toast with key ${t} not found`);return n.count++,(e.tag||e.groupId)&&e.message&&n.toast?._messageSpan&&(n.toast._messageSpan.textContent=String(e.message),n.toast._messageSpan.title=String(e.message)),n.timer?.clear(),n.timer=vt(n.toast,e),await Tt(n),await _t(n),ft(),!e.fromSync&&!1!==e.syncTabs&&i().syncTabs&&mt.isSupported()&&mt.broadcast("update",t,{count:n.count}),t}if(lt.has(t)){const n=lt.get(t);if(!n)throw new Error(`Pending toast with key ${t} not found`);return n.count++,(e.tag||e.groupId)&&e.message&&(n.options={...n.options,...e}),t}const n={options:e,count:1,rafId:0};return lt.set(t,n),n.rafId=requestAnimationFrame(async()=>{const e=lt.get(t);if(e){if(lt.delete(t),ut>=i().maxVisible){const n={options:e.options,key:t,count:e.count},o=i().maxQueueSize??100;if(o<=0)return dt++,nt(t,e.options),void ft();const r=ct.find(e=>e.key===t);if(r)return r.count+=e.count,"number"==typeof e.options?.priority&&(r.options={...r.options,...e.options},r.priority=He(r.options)),void ft();const s=i().aiPrioritization||e.options?.aiPrioritization||"number"==typeof e.options?.priority||ct.some(e=>e?.options?.aiPrioritization||"number"==typeof e?.options?.priority);if(s&&(n.priority=He(e.options)),ct.length>=o){if(s){const o=yt(n);let i=0,r=yt(ct[0]);for(let e=1;e<ct.length;e++){const t=yt(ct[e]);t<r&&(i=e,r=t)}if(o<=r)return dt++,nt(t,e.options),void ft();const s=ct.splice(i,1)[0];s&&nt(s.key,s.options)}else{const e=ct.shift();e&&nt(e.key,e.options)}dt++}return ct.push(n),s&&ct.sort((e,t)=>yt(t)-yt(e)),ft(),void await kt()}try{await wt(e.options,t,e.count)}catch(e){console.error("showToast failed:",e)}}}),!e.fromSync&&!1!==e.syncTabs&&i().syncTabs&&mt.isSupported()&&mt.broadcast("create",t,{options:e}),t}catch(e){console.error("showToast failed:",e)}}async function wt(e,t,n){try{if(!e||"object"!=typeof e)throw new TypeError("options must be an object");ut++;const o=await Ne(e,De);if(!o)throw new Error("Failed to create toast container");const r=await ke(e,At);if(!r)throw new Error("Toast element creation failed");const s=document.createElement("div");s.className="toast-outer-wrapper",i().disableInlineStyles||Object.assign(s.style,{position:"relative",display:"inline-block",overflow:"visible",marginBottom:"10px",zIndex:"0",width:"100%",pointerEvents:"auto"});const a=document.createElement("div");a.className="toast-inner-wrapper",i().disableInlineStyles||Object.assign(a.style,{position:"relative",overflow:"hidden",zIndex:"1"}),a.appendChild(r),s.appendChild(a),o.id.includes("toast-container-")&&(o.appendChild(s),e.stacked&&o.setAttribute("data-stacked","true"),"true"===o.getAttribute("data-stacked")&&gt(o)),V(r);const l=!1!==e.pauseOnHover&&(!0===e.pauseOnHover||!!e.cta||Boolean(i().pauseOnHover)),c={outer:s,toast:r,options:e,count:Math.max(1,Math.floor(n??0)),pauseOnHover:l};at.set(t,c),r._key=t,tt(t,e,"active"),ft(),c.count>1&&await _t(c),c.timer=vt(r,e),await Tt(c)}catch(t){console.error("Something went wrong: ",t),ut=Math.max(0,ut-1),ft(),(document.querySelector('[id^="toast-container-"]')||document.body).appendChild(await ve(e,At))}}ht();const xt=async function(){try{if(0===at.size){if(lt.size>0){const[e,t]=Array.from(lt.entries()).at(-1);return t?.rafId&&cancelAnimationFrame(t.rafId),lt.delete(e),void ft()}return ct.length>0?(ct.pop(),void ft()):void 0}let e=null;const t=Array.from(at.values());if(t.length>0){const n=t.at(-1);e=n.toast||n.outer&&n.outer.querySelector('[id^="toast-"]')}if(e||document.querySelectorAll('[id^="toast-container-"]').forEach(t=>{const n=Array.from(t.children||[]);if(0===n.length)return;const o=n.at(-1);o&&(e=o.querySelector('[id^="toast-"]')||o)}),!e)return;const n=e._key?e:e.querySelector('[id^="toast-"]')||e;await At(n)}catch(e){console.error("dismissMostRecent failed:",e)}};function vt(e,t){const n=Number(t?.duration);if(t?.duration===1/0||"number"==typeof t?.duration&&t?.duration<=0)return null;const o=Number.isFinite(n)&&n>0?n:2500,i=new Re(()=>{At(e).catch(console.error)},o+5);return i.start(),i}async function Tt(e){if(!e.pauseOnHover||!e.outer||!e.timer)return;e.outer._pauseCleanup?.();const{outer:t,timer:n,toast:o}=e,i=()=>{if(o?._progressAnimation)try{o._progressAnimation.pause()}catch{}else if(o?._progressBar)try{if(o._progressBar._isIndeterminate)o._progressBar.style.animationPlayState="paused";else if(o._progressBar._isManualProgress);else{const e=window.getComputedStyle(o._progressBar).width;o._progressBar._pausedWidth=e,o._progressBar.style.transition="none",o._progressBar.style.width=e}}catch{}},r=()=>{if(o?._progressAnimation)try{o._progressAnimation.play()}catch{}else if(o?._progressBar)try{if(o._progressBar._isIndeterminate)o._progressBar.style.animationPlayState="running";else if(o._progressBar._isManualProgress);else if(o._progressBar._pausedWidth){const e=n.getRemainingTime?.()??1e3,t=o._progressBar._isReverse,i=o._progressBar._finalWidth||"100%";o._progressBar.style.transition=`width ${Math.max(0,e)}ms linear`,o._progressBar.style.width=t?i:"0%",o._progressBar._pausedWidth=null}}catch{}},s=()=>{n.pause(),i(),o?._pauseUndo?.(),o?.classList.add("toast-paused")},a=()=>{n.resume(),r(),o?._resumeUndo?.(),o?.classList.remove("toast-paused")},l=e=>{e.target.matches("[tabindex], div, span, button, a")&&(n.pause(),i(),o?._pauseUndo?.(),o?.classList.add("toast-paused"))},c=e=>{t.contains(e.relatedTarget)||(n.resume(),r(),o?._resumeUndo?.(),o?.classList.remove("toast-paused"))};t.addEventListener("mouseenter",s),t.addEventListener("mouseleave",a),t.addEventListener("focusin",l),t.addEventListener("focusout",c),t._pauseCleanup=()=>{t.removeEventListener("mouseenter",s),t.removeEventListener("mouseleave",a),t.removeEventListener("focusin",l),t.removeEventListener("focusout",c)}}async function At(e){if(e?._key)return St(e._key)}async function St(e,t=!1){try{if(!e)return;const n=at.get(e);!t&&!1!==n?.options?.syncDismiss&&!1!==n?.options?.syncTabs&&i().syncTabs&&mt.isSupported()&&mt.broadcast("dismiss",e,{});const o=lt.get(e);if(o)return cancelAnimationFrame(o.rafId),lt.delete(e),void ft();const s=ct.findIndex(t=>t.key===e);if(-1!==s)return ct.splice(s,1),void ft();if(!n)return;if(function(e){if(!e)return;const t=String(e),n=et.find(e=>e.id===t&&"active"===e.status);n&&(n.status="dismissed",n.dismissedAt=Date.now())}(e),n.timer?.clear(),n.outer?._pauseCleanup?.(),n.toast?._cleanupCloseButton?.(),n.toast?._cleanupCTA?.(),n.toast?._cleanupUndo?.(),n.toast?._cleanupSwipe?.(),n.toast?._cleanupFocusTrap?.(),n.toast?._cleanup?.(),n.toast?._progressAnimation){try{n.toast._progressAnimation.cancel()}catch{}n.toast._progressAnimation=null}const a=n.outer?.querySelector(".toast-count-badge");a?._scaleTimer&&(clearTimeout(a._scaleTimer),a._scaleTimer=null);const l=n.toast?.querySelector("button, a");l?._cleanup?.(),at.delete(e),ut=Math.max(0,ut-1),ft(),a&&a.remove();const c=n.toast?._animationDuration??400,u=Math.min(c,300);if(n.toast){if(!i().disableInlineStyles){const e=String(n.options?.position||n.outer?.parentElement?.id||"").toLowerCase(),t=e.includes("top"),o=e.includes("left"),i=e.includes("right"),s=String(n.options?.animationType||"").toLowerCase().trim();let a="translateY(20px)";const l=n.toast?._spring;r()?(n.toast.style.transition="none",n.toast.style.opacity="0"):("fade"===s?a="none":"zoom"===s||"scale"===s?a="scale(0.75)":"flip"===s?a="perspective(600px) rotateX(-45deg)":"slide"===s?a=o?"translateX(-100%)":i?"translateX(100%)":t?"translateY(-100%)":"translateY(100%)":"bounce"===s?a=t?"translateY(-36px) scale(0.9)":"translateY(36px) scale(0.9)":l&&(a=t?"translateY(-28px) scale(0.94)":"translateY(28px) scale(0.94)"),n.toast.style.transition=`opacity ${u}ms ease-in, transform ${u}ms ease-in`,n.toast.style.opacity="0",n.toast.style.transform=a)}n.toast.classList.remove("active")}const d=n.outer?.parentElement;if(await async function(e,t,n=400){return e?new Promise(o=>{let i=!1,s=null;const a=t||e.firstElementChild||e,l=()=>{if(i)return;i=!0,s&&(clearTimeout(s),s=null);try{a?.removeEventListener?.("transitionend",c,!0)}catch{}const t=e.querySelector?.(".toast")||e;if(t?._pooledId)try{Se().release(t,t._pooledId)}catch{}(async function(e){if(!e)return!0;try{if("function"==typeof e.remove)return e.remove(),!0}catch{}try{if(e.parentNode)return e.parentNode.removeChild(e),!0}catch{}return!1})(e).catch(console.error),o()};if(r()||n<=0)return void l();const c=e=>{try{if(e.target!==a)return;"transform"!==e.propertyName&&(a.style.transform&&"none"!==a.style.transform&&"initial"!==a.style.transform||"opacity"!==e.propertyName)||l()}catch(e){console.error("removeWithTransition error:",e)}};if(!a)return l();try{a.addEventListener("transitionend",c,!0)}catch(e){console.error("removeWithTransition error:",e)}s=setTimeout(l,n+100),"function"==typeof s?.unref&&s.unref()}):Promise.resolve()}(n.outer,n.toast,u),d&&0===d.children.length&&d.id?.startsWith("toast-container-"))try{d._stackedCleanup?.(),function(e){if(!e)return;const t="string"==typeof e&&e.startsWith("toast-container-")?e:Me(e);_e.delete(t),Ee.delete(t)}(d.id),d.remove()}catch{}else d&&"true"===d.getAttribute("data-stacked")&&gt(d);await kt()}catch(e){console.error("Closing Toast failed!: ",e)}}let Ct=!1;async function kt(){if(!Ct){Ct=!0;try{const e=i();for((e.aiPrioritization||ct.some(e=>e.options?.aiPrioritization||"number"==typeof e.options?.priority))&&ct.length>1&&ct.sort((e,t)=>yt(t)-yt(e));ut<e.maxVisible&&ct.length;){const e=ct.shift();if(at.has(e.key)){const t=at.get(e.key);t.count+=e.count,(e.options.tag||e.options.groupId)&&e.options.message&&t.toast?._messageSpan&&(t.toast._messageSpan.textContent=String(e.options.message),t.toast._messageSpan.title=String(e.options.message),t.timer?.clear(),t.timer=vt(t.toast,e.options)),await _t(t),ft();continue}await wt(e.options,e.key,e.count)}ft()}finally{Ct=!1}}}async function _t({outer:e,count:t}){if(!(e&&e instanceof HTMLElement))throw new Error("updateBadge: outer must be a valid HTMLElement");if(t<2){const t=e.querySelector(".toast-count-badge");return void(t&&t.remove())}let n=e.querySelector(".toast-count-badge");n||(n=document.createElement("span"),n.className="toast-count-badge",n.setAttribute("aria-label",`${t} identical notifications`),i().disableInlineStyles||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"}),e.appendChild(n)),n.textContent=t>99?"99+":String(t);try{r()||(n._scaleTimer&&clearTimeout(n._scaleTimer),n.style.transform="scale(1.2)",n._scaleTimer=setTimeout(()=>{n.style.transform="scale(1)",n._scaleTimer=null},150),"function"==typeof n._scaleTimer?.unref&&n._scaleTimer.unref())}catch(e){console.error("updateBadge animation error:",e)}}async function Et(e,t={}){if(!e||"object"!=typeof t||null===t)return;if(lt.has(e)){const n=lt.get(e);return void(n.options={...n.options,...t})}const n=ct.find(t=>t.key===e);if(n)return void(n.options={...n.options,...t});const o=at.get(e);if(!o||!o.toast)return;const r={...o.options};o.options={...o.options,...t};const s=o.toast,a=s._messageSpan||s.querySelector(".toast-message")||s.querySelector("span:not(.toast-count-badge)");if(void 0!==t.message){const e=String(t.message??""),n=void 0!==t.allowHtml?Boolean(t.allowHtml):Boolean(o.options.allowHtml),i=("success"===t.type||"error"===t.type||"warning"===t.type||"info"===t.type)&&!0!==t.showLoader;if(a){const o=a.querySelector(".toast-loader");if(a.innerHTML="",o&&!1!==t.showLoader&&null!==t.loader&&!i){a.appendChild(o);const e=document.createElement("span");e.style.display="inline-block",e.style.width="8px",a.appendChild(e)}if(n&&e.trim().length>0)try{const t=w(e),n=document.createElement("div");for(n.innerHTML=t;n.firstChild;)a.appendChild(n.firstChild)}catch{a.appendChild(document.createTextNode(e))}else a.appendChild(document.createTextNode(e));a.setAttribute("title",a.textContent||"")}}const l=("success"===t.type||"error"===t.type||"warning"===t.type||"info"===t.type)&&!0!==t.showLoader;if(!1===t.showLoader||null===t.loader||l){const e=a?.querySelector(".toast-loader");e&&(e.nextSibling&&"SPAN"===e.nextSibling.nodeName&&e.nextSibling.remove(),e.remove())}else if((!0===t.showLoader||t.loader&&"object"==typeof t.loader)&&a&&!a.querySelector(".toast-loader")){const e=x(t.loader||{});a.insertBefore(e,a.firstChild);const n=document.createElement("span");n.style.display="inline-block",n.style.width="8px",a.insertBefore(n,e.nextSibling)}if(t.type){const e=String(t.type).toLowerCase().trim();s.className=s.className.replace(/\btoast-(info|success|error|warning)\b/g,`toast-${e}`);const n="error"===e;if(t.role?s.setAttribute("role",t.role):s.setAttribute("role","alert"),s.setAttribute("aria-live",t.ariaLive||(n?"assertive":"polite")),!t.backgroundColor){const t={success:"#28a745",error:"#dc3545",warning:"#ffc107",info:"#17a2b8"};t[e]&&(s.style.background=t[e])}}if(void 0!==t.icon||void 0!==t.type){const e=s?.querySelector(".toast-icon");e&&e.remove();const n=we({...o.options,...t});n&&(a?s.insertBefore(n,a):s.appendChild(n))}if(t.backgroundColor&&(s.style.background=t.backgroundColor),t.textColor)s.style.color=t.textColor,a&&(a.style.color=t.textColor);else if(t.type||t.backgroundColor){const e=s.style.background;if(e){const t=p(e);s.style.color=t,a&&(a.style.color=t)}}if(void 0!==t.borderRadius){const e="number"==typeof t.borderRadius?`${t.borderRadius}px`:t.borderRadius;s.style.borderRadius=e}if(void 0!==t.maxWidth){const e="number"==typeof t.maxWidth?`${t.maxWidth}px`:t.maxWidth;s.style.maxWidth=e}if(void 0!==t.fontDirection){const e="auto"!==t.fontDirection?t.fontDirection:"";s.style.direction=e,a&&(a.style.direction=e)}if(void 0!==t.fontSize){const e="number"==typeof t.fontSize?`${t.fontSize}px`:t.fontSize;s.style.fontSize=e,a&&(a.style.fontSize=e)}if(void 0!==t.fontFamily&&(s.style.fontFamily=t.fontFamily,a&&(a.style.fontFamily=t.fontFamily)),void 0!==t.fontWeight){const e="number"==typeof t.fontWeight?String(t.fontWeight):t.fontWeight;s.style.fontWeight=e,a&&(a.style.fontWeight=e)}if(void 0!==t.fontLineHeight&&(s.style.lineHeight=t.fontLineHeight,a&&(a.style.lineHeight=t.fontLineHeight)),void 0!==t.fontPadding&&a&&(a.style.padding=t.fontPadding),void 0!==t.wrapText&&a&&("truncate"!==t.wrapText&&"ellipsis"!==t.wrapText&&!1!==t.wrapText&&t.wrapText?(a.classList.remove("is-truncated"),i().disableInlineStyles||Object.assign(a.style,{display:"block",WebkitBoxOrient:"",WebkitLineClamp:"",whiteSpace:"normal",overflow:"visible",textOverflow:"clip"})):(a.classList.add("is-truncated"),i().disableInlineStyles||Object.assign(a.style,{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:"3",whiteSpace:"normal",overflow:"hidden",textOverflow:"ellipsis"}))),void 0!==t.role&&s.setAttribute("role",t.role),void 0!==t.ariaLive&&s.setAttribute("aria-live",t.ariaLive),void 0!==t.className){const e=r.className;e&&"string"==typeof e&&s.classList.remove(...e.trim().split(/\s+/)),t.className&&"string"==typeof t.className&&s.classList.add(...t.className.trim().split(/\s+/))}let c=s.querySelector(".toast-progress-bar");if(!1===t.showProgressBar){if(s._progressAnimation){try{s._progressAnimation.cancel()}catch{}s._progressAnimation=null}c&&c.remove(),s._progressBar=null,c=null}else c||!1===t.showProgressBar||void 0===t.progress&&!0!==t.showProgressBar||(R(s,{...o.options,...t,showProgressBar:!0}),c=s.querySelector(".toast-progress-bar"));if(c){if(void 0!==t.progress)if("indeterminate"===t.progress){if(c._isIndeterminate=!0,c._isManualProgress=!1,s._progressAnimation){try{s._progressAnimation.cancel()}catch{}s._progressAnimation=null}c.classList.add("toast-progress-bar-indeterminate");const e=c._isRtl||"rtl"===t.fontDirection||"rtl"===t.progressDirection;if(e&&c.classList.add("toast-progress-bar-indeterminate-rtl"),!i().disableInlineStyles){P();const t=e?"toast-progress-indeterminate-rtl":"toast-progress-indeterminate";c.style.animation=`${t} 1.6s cubic-bezier(0.4, 0, 0.2, 1) infinite`}c.style.width=c._finalWidth||"100%"}else{const e=D(t.progress,s,{...o.options,...t});if(c._isIndeterminate=!1,c._isManualProgress=!0,c.classList.remove("toast-progress-bar-indeterminate"),c.classList.remove("toast-progress-bar-indeterminate-rtl"),c.style.animation="none",s._progressAnimation){try{s._progressAnimation.cancel()}catch{}s._progressAnimation=null}c.style.transition="width 200ms ease",c.style.width=`${e}%`}if((t.progressBarColor||t.progressColor)&&(c.style.background=t.progressBarColor||t.progressColor),t.progressPosition&&(c.style.top="top"===t.progressPosition?"0":"auto",c.style.bottom="bottom"===t.progressPosition?"0":"auto"),void 0!==t.progressHeight){const e="number"==typeof t.progressHeight?`${t.progressHeight}px`:t.progressHeight;c.style.height=e}}if(void 0!==t.animationType&&(o.options.animationType=t.animationType,s._animationType=t.animationType),void 0!==t.spring&&(o.options.spring=t.spring,s._spring=t.spring?fe(t.spring):null),void 0!==t.swipeToDismiss&&(o.options.swipeToDismiss=t.swipeToDismiss,!1===t.swipeToDismiss?(s._cleanupSwipe?.(),s._cleanupSwipe=null):!0!==t.swipeToDismiss||s._cleanupSwipe||O(s,At)),void 0!==t.duration){o.timer?.clear();const e=Number(t.duration);if(Number.isFinite(e)&&e>0){if(o.timer=vt(s,{duration:e}),await Tt(o),c&&!c._isManualProgress&&!c._isIndeterminate){const t=e+5;if(s._progressAnimation){try{s._progressAnimation.cancel()}catch{}const e=c._isReverse,n=c._finalWidth||"100%",o=e?[{width:"0%"},{width:n}]:[{width:n},{width:"0%"}];s._progressAnimation=c.animate(o,{duration:t,easing:"linear",fill:"forwards",delay:0})}else{c.style.transition=`width ${t}ms linear`;const e=c._isReverse,n=c._finalWidth||"100%";c.style.width=e?n:"0%"}}}else if(o.timer=null,c&&!c._isManualProgress&&!c._isIndeterminate){if(s._progressAnimation){try{s._progressAnimation.cancel()}catch{}s._progressAnimation=null}c.style.width="0%"}}else 0!==o.options.duration&&o.timer||"success"!==t.type&&"error"!==t.type&&"warning"!==t.type&&!1!==t.showLoader||(o.options.duration=2500,o.timer?.clear(),o.timer=vt(s,{duration:2500}),await Tt(o));if(void 0!==t.cta&&(s._cleanupCTA&&(s._cleanupCTA(),s._cleanupCTA=null),s.querySelectorAll(".toast-cta").forEach(e=>e.remove()),t.cta&&"object"==typeof t.cta)&&I(s,{...o.options,...t},At),void 0!==t.undo&&(s._cleanupUndo&&(s._cleanupUndo(),s._cleanupUndo=null),s.querySelectorAll(".toast-undo-btn").forEach(e=>e.remove()),t.undo)&&N(s,{...o.options,...t},At),void 0!==t.showCloseButton){const e=s.querySelector(".toast-close-btn");!1===t.showCloseButton?(s._cleanupCloseButton&&(s._cleanupCloseButton(),s._cleanupCloseButton=null),e&&e.remove()):!0!==t.showCloseButton||e||B(s,{...o.options,...t},At)}(void 0!==t.sound?Boolean(t.sound):Boolean(t.type&&(o.options.sound||i().sound)))&&Q("string"==typeof t.sound||"number"==typeof t.sound?t.sound:t.type||o.options.type||"info",t.soundPreset||o.options.soundPreset||i().soundPreset||"modern");const u=s.closest('[id^="toast-container-"]');u&&(!0===t.stacked?(u.setAttribute("data-stacked","true"),gt(u)):!1===t.stacked?(u.removeAttribute("data-stacked"),u._stackedCleanup?.(),Array.from(u.children).forEach(e=>{e.removeAttribute("data-stacked-depth"),e.style.transform="",e.style.marginTop="",e.style.marginBottom="10px",e.style.opacity="",e.style.zIndex="",e.style.pointerEvents="auto"})):"true"===u.getAttribute("data-stacked")&&gt(u)),!t.fromSync&&!1!==o.options?.syncTabs&&!1!==t.syncTabs&&i().syncTabs&&mt.isSupported()&&mt.broadcast("update",e,{newOptions:t})}let Lt={success:"#28a745",error:"#dc3545",warning:"#ffc107",info:"#17a2b8"},Mt={},It=!1,Nt=null;function Bt(e,t){const n="object"!=typeof t||null===t||Array.isArray(t)?{}:t;return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||"bigint"==typeof e?{...n,message:String(e)}:e instanceof Error?{...n,message:e.message||String(e)}:"object"!=typeof e||null===e||Array.isArray(e)?{...n}:{...n,...e}}function zt(e){try{if(e&&"object"==typeof e&&!Array.isArray(e)){const t=["success","error","warning","info"],n={};for(const[o,i]of Object.entries(e))t.includes(o)&&"string"==typeof i&&i.trim()&&(n[o]=i.trim());Object.keys(n).length>0&&(Lt={...Lt,...n})}}catch(e){console.error("setDefaultColors failed:",e)}}function Pt(e){try{if(e&&"object"==typeof e&&!Array.isArray(e)){const t=["success","error","warning","info"],n={};for(const[o,i]of Object.entries(e))t.includes(o)&&"string"==typeof i&&i.trim()&&(n[o]=i.trim());Object.keys(n).length>0&&(Mt={...Mt,...n})}}catch(e){console.error("setDefaultMessages failed:",e)}}let Dt=!1,Rt=null;const Vt=async function(e={}){return"undefined"!=typeof window&&"undefined"!=typeof document?(await async function(){It||"undefined"!=typeof window&&"undefined"!=typeof document&&("complete"!==document.readyState&&"interactive"!==document.readyState?(Nt||(Nt=new Promise(e=>{document.addEventListener("DOMContentLoaded",()=>{It=!0,e()},{once:!0})})),await Nt):It=!0)}(),await async function(e={}){try{const t=await async function(e){const t=Bt(e),n=i(),o=String(t?.position??n.defaultPosition).toLowerCase().trim(),r=o?.includes("top-full-width")||o?.includes("bottom-full-width")?"100vw":"400px",s={allowHtml:!1,sanitizeHtml:!0,pauseOnHover:void 0,duration:2500,position:n.defaultPosition,type:"info",borderRadius:"50px",backgroundColor:void 0,textColor:void 0,showCloseButton:!0,animationDuration:"0.4s",animationEasing:"ease",showProgressBar:!0,progressColor:void 0,progressBarColor:void 0,progressHeight:"4px",progressPosition:"bottom",progressDirection:"decreasing",animationType:"default",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:r,...t};s.message=t?.message??s.message;try{if(!s.backgroundColor){const e="undefined"!=typeof window&&"function"==typeof window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)")?.matches;s.backgroundColor=Lt?.[s.type]??(e?"#f5f5f5":"#111111")}}catch(e){console.warn("Background color resolution failed:",e),s.backgroundColor||(s.backgroundColor="#111111")}try{s.message=s.message||Mt[s.type]||E(s.type)||"No Message Provided!"}catch(e){console.warn("Default message resolution failed:",e)}try{s.fontDirection&&"auto"!==s.fontDirection||!L()||(s.fontDirection="rtl")}catch{}try{!s.textColor&&s.backgroundColor&&(s.textColor=p(s.backgroundColor))}catch(e){console.warn("Text color resolution failed:",e)}try{const e=t?.progressBarColor||t?.progressColor;e?(s.progressColor=e,s.progressBarColor=e):!s.progressColor&&s.backgroundColor&&(s.progressColor=s.textColor||p(s.backgroundColor),s.progressBarColor=s.progressColor)}catch(e){console.warn("Progress bar color resolution failed:",e)}return"string"!=typeof s.message&&(s.message="No Message Provided!"),s}(e);return await async function(e){try{return await Ne(e,De)}catch(e){return console.error("Failed to create toast container:",e),i().targetNode||document.body}}(t),await bt(t)}catch(e){return console.error("CreateToast failed:",e),null}}(e)):(console.warn("ToastNotification: running in non-browser environment, no DOM available."),null)};async function Ot(e={},t){const n=Bt(e,t),o=await async function(){if(Dt&&Rt)try{await Rt}catch(e){console.warn("Previous close operation failed (continuing anyway):",e)}return Vt(n)}();return{id:o,dismiss:()=>o?St(o):Promise.resolve(),update:e=>o?Et(o,e):Promise.resolve()}}Ot.success=(e,t)=>Ot({...Bt(e,t),type:"success"}),Ot.error=(e,t)=>Ot({...Bt(e,t),type:"error"}),Ot.warning=(e,t)=>Ot({...Bt(e,t),type:"warning"}),Ot.info=(e,t)=>Ot({...Bt(e,t),type:"info"}),Ot.loading=(e,t)=>Ot({type:"info",showLoader:!0,duration:0,showProgressBar:!1,pauseOnHover:!1,...Bt(e,t)}),Ot.custom=(e,t)=>Ot({allowHtml:!0,...Bt(e,t)});const qt=Ot.success,Ft=Ot.error,$t=Ot.warning,jt=Ot.info,Wt=Ot.loading,Ht=Ot.custom,Ut=async e=>{let t=e;if(e&&"function"==typeof e.then)try{t=await e}catch{return}Dt=!0,Rt=(async()=>{try{"string"==typeof t&&t.length>0?await St(t):t&&"object"==typeof t?"function"==typeof t.dismiss?await t.dismiss():t._key&&"string"==typeof t._key?await St(t._key):t.id&&"string"==typeof t.id?await St(t.id):await xt():await xt()}finally{Dt=!1,Rt=null}})(),await Rt},Gt=async()=>{Dt=!0,Rt=(async()=>{try{await async function(){try{for(const[,e]of lt)e?.rafId&&cancelAnimationFrame(e.rafId);lt.clear(),ct.length=0,ft();const e=Array.from(at.values()).map(e=>e.toast).filter(Boolean);await Promise.allSettled(e.map(async e=>{try{await At(e)}catch(e){console.warn("closeAllToasts: failed to close one toast:",e)}}))}catch(e){console.error("closeAllToasts failed:",e)}}()}finally{Dt=!1,Rt=null}})(),await Rt},Yt=Gt,Xt=Gt,Kt=864e5;async function Qt(e,t={},n={}){const o=t&&"object"==typeof t?t:{},i=n&&"object"==typeof n?n:{},r=o.loading??"Loading...",s="object"!=typeof r||null===r||Array.isArray(r)?{...i,type:"info",message:String(r),duration:Kt,showProgressBar:!1,pauseOnHover:!1,showLoader:i.showLoader??!0}:{...i,type:"info",duration:Kt,showProgressBar:!1,pauseOnHover:!1,showLoader:i.showLoader??!0,...r},a=await Ot(s),l={...i,pauseOnHover:i.pauseOnHover};try{const t="function"==typeof e?e():e,n=await t;if(a&&"function"==typeof a.dismiss)try{await a.dismiss()}catch{}const i="function"==typeof o.success?o.success(n):o.success??"Done!",r="object"!=typeof i||null===i||Array.isArray(i)?{...l,type:"success",message:String(i)}:{...l,type:"success",...i};return await Ot(r),n}catch(e){if(a&&"function"==typeof a.dismiss)try{await a.dismiss()}catch{}const t="function"==typeof o.error?o.error(e):o.error??"Something went wrong.",n="object"!=typeof t||null===t||Array.isArray(t)?{...l,type:"error",message:String(t)}:{...l,type:"error",...t};throw await Ot(n),e}}Ot.promise=Qt,Ot.dismiss=Ut,Ot.dismissAll=Gt,Ot.clear=Gt,Ot.getHistory=ot,Ot.clearHistory=it;const Jt="3.20.2";function Zt(e=("undefined"!=typeof window?window:null)){e&&e.document&&!e.__customizableToastEscapeAttached&&(e.__customizableToastEscapeAttached=!0,e.addEventListener("keydown",t=>{if("Escape"===t.key||"Esc"===t.key)(async()=>{try{Dt=!0,Rt=(async()=>{try{await xt()}finally{Dt=!1,Rt=null}})(),await Rt}catch(e){console.error("Escape key dismiss failed:",e),Dt=!1,Rt=null}})();else if("F6"===t.key||(t.altKey||t.metaKey)&&("t"===t.key||"T"===t.key)){const t=(i().targetNode&&"function"==typeof i().targetNode.querySelectorAll?i().targetNode:e.document).querySelectorAll('[id^="toast-container-"] [id^="toast-"]');if(t.length>0){const e=t[t.length-1],n=e.querySelector("button, a, [tabindex='0']");n&&"function"==typeof n.focus?n.focus():"function"==typeof e.focus&&e.focus()}}},{passive:!0}))}"undefined"!=typeof window&&"undefined"!=typeof document&&Zt(window);try{"undefined"!=typeof window&&(window.customizableToast={setConfig:n,getConfig:i,resetConfig:o,shouldReduceMotion:r,version:Jt,createToast:Ot,success:qt,error:Ft,warning:$t,info:jt,loading:Wt,custom:Ht,setDefaultColors:zt,setDefaultMessages:Pt,noop:Gt,dismiss:Ut,dismissAll:Gt,clear:Gt,toastPromise:Qt,promise:Qt,updateToastByKey:Et,setAudioEnabled:te,isAudioEnabled:ne,playTone:Q,registerSoundPreset:J,getSoundPresets:Z,resetSoundPresets:ee,resetAudioContext:oe,getToastPool:Se,resetToastPool:Ce,getToastBroadcaster:qe,resetToastBroadcaster:Fe,calculateToastPriority:He,categorizeToast:Ue,createGestureDetector:Je,detectPinch:Qe,isFlick:Xe,calculateVelocity:Ye,generateToastId:c,resetToastIdCounter:l,getToastMetrics:pt,registerSpringPreset:se,getSpringPresets:ae,resetSpringPresets:le,resolveSpringConfig:ce,solveSpring:ue,calculateSpringSettlingDuration:de,generateSpringLinearEasing:pe,getSpringTransition:fe,getAudioContext:W,getAudioAnalyser:U,setLocale:S,getLocale:C,getAvailableLocales:k,registerLocale:_,resetLocale:M,getToastHistory:ot,clearToastHistory:it,setHistoryCapacity:rt,resetToastHistory:st,initKeyboardShortcuts:Zt})}catch(Ft){console.error("Global assignment failed:",Ft)}exports.calculateSpringSettlingDuration=de,exports.calculateToastPriority=He,exports.calculateVelocity=Ye,exports.categorizeToast=Ue,exports.clear=Yt,exports.clearToastHistory=it,exports.createGestureDetector=Je,exports.createToast=Ot,exports.custom=Ht,exports.default=Ot,exports.detectPinch=Qe,exports.dismiss=Ut,exports.dismissAll=Xt,exports.error=Ft,exports.generateSpringLinearEasing=pe,exports.generateToastId=c,exports.getAudioAnalyser=U,exports.getAudioContext=W,exports.getAvailableLocales=k,exports.getConfig=i,exports.getLocale=C,exports.getSoundPresets=Z,exports.getSpringPresets=ae,exports.getSpringTransition=fe,exports.getToastBroadcaster=qe,exports.getToastHistory=ot,exports.getToastMetrics=pt,exports.getToastPool=Se,exports.info=jt,exports.initKeyboardShortcuts=Zt,exports.isAudioEnabled=ne,exports.isFlick=Xe,exports.loading=Wt,exports.noop=Gt,exports.playTone=Q,exports.registerLocale=_,exports.registerSoundPreset=J,exports.registerSpringPreset=se,exports.resetAudioContext=oe,exports.resetConfig=o,exports.resetContainerRegistry=function(){if(_e.clear(),Ee.clear(),"undefined"!=typeof document){const e=document.querySelector("#toast-shadow-host");if(e)try{e.remove()}catch{}}},exports.resetLocale=M,exports.resetSoundPresets=ee,exports.resetSpringPresets=le,exports.resetToastBroadcaster=Fe,exports.resetToastHistory=st,exports.resetToastIdCounter=l,exports.resetToastManager=function(){for(const[,e]of lt)e?.rafId&&cancelAnimationFrame(e.rafId);lt.clear(),ct.length=0;for(const[,e]of at){if(e.timer?.clear(),e.outer?._pauseCleanup?.(),e.toast?._cleanupCloseButton?.(),e.toast?._cleanupCTA?.(),e.toast?._cleanupUndo?.(),e.toast?._cleanupSwipe?.(),e.toast?._cleanupFocusTrap?.(),e.toast?._cleanup?.(),e.toast?._progressAnimation){try{e.toast._progressAnimation.cancel()}catch{}e.toast._progressAnimation=null}const t=e.outer?.querySelector(".toast-count-badge");t?._scaleTimer&&(clearTimeout(t._scaleTimer),t._scaleTimer=null)}"undefined"!=typeof document&&document.querySelectorAll('[id^="toast-container-"]').forEach(e=>{try{e._stackedCleanup?.()}catch{}}),at.clear(),ut=0,dt=0,Ct=!1,ft(),ht()},exports.resetToastPool=Ce,exports.resolveSpringConfig=ce,exports.setAudioEnabled=te,exports.setConfig=n,exports.setDefaultColors=zt,exports.setDefaultMessages=Pt,exports.setHistoryCapacity=rt,exports.setLocale=S,exports.shouldReduceMotion=r,exports.solveSpring=ue,exports.success=qt,exports.toastPromise=Qt,exports.updateToastByKey=Et,exports.version=Jt,exports.warning=$t;
14
+ */Object.defineProperty(exports,"__esModule",{value:!0});const DEFAULT_GLOBAL_CONFIG=Object.freeze({maxVisible:3,maxQueueSize:100,zIndex:9999,targetNode:null,disableInlineStyles:!1,reducedMotion:"auto",defaultPosition:"bottom-right",theme:"light",stacked:!1,swipeToDismiss:!0,sound:!1,icon:!0,pauseOnHover:!1,priorityQueue:!1,shadowDom:!1,trapFocus:!1,priorityScorer:null,onMetrics:null,debug:!1}),globalConfig={...DEFAULT_GLOBAL_CONFIG};function isValidMountTarget(t){return t&&typeof t=="object"&&typeof t.appendChild=="function"}function setConfig(t={}){if(!t||typeof t!="object"||Array.isArray(t))return getConfig();const{maxVisible:e,maxQueueSize:i,zIndex:r,targetNode:s,disableInlineStyles:n,reducedMotion:a,defaultPosition:o,theme:u,stacked:l,swipeToDismiss:c,sound:m,icon:f,pauseOnHover:y,priorityQueue:h,shadowDom:d,trapFocus:b,priorityScorer:p,onMetrics:v,debug:k}=t;if(d!==void 0&&(globalConfig.shadowDom=!!d),b!==void 0&&(globalConfig.trapFocus=!!b),k!==void 0&&(globalConfig.debug=!!k),e!==void 0){const x=Number(e);Number.isFinite(x)&&x>0&&(globalConfig.maxVisible=Math.max(1,Math.floor(x)))}if(i!==void 0){const x=Number(i);Number.isFinite(x)&&x>=0&&(globalConfig.maxQueueSize=Math.floor(x))}if(r!==void 0){const x=Number(r);Number.isFinite(x)&&(globalConfig.zIndex=Math.trunc(x))}if(s!==void 0&&(globalConfig.targetNode=s&&typeof s=="object"&&typeof s.appendChild=="function"?s:null),n!==void 0&&(globalConfig.disableInlineStyles=!!n),a!==void 0){const x=String(a||"auto").toLowerCase();["auto","always","never"].includes(x)&&(globalConfig.reducedMotion=x,typeof document<"u"&&(x==="always"?document.documentElement.setAttribute("data-toast-reduced-motion","always"):x==="never"?document.documentElement.setAttribute("data-toast-reduced-motion","never"):document.documentElement.removeAttribute("data-toast-reduced-motion")))}if(o!==void 0){const x=String(o||"").toLowerCase().trim();x&&(globalConfig.defaultPosition=x)}if(u!==void 0){const x=String(u||"light").toLowerCase();["light","dark","high-contrast","compact","spacious","glass"].includes(x)&&(globalConfig.theme=x,typeof document<"u"&&document.documentElement.setAttribute("data-toast-theme",x))}return l!==void 0&&(globalConfig.stacked=!!l),c!==void 0&&(globalConfig.swipeToDismiss=!!c),m!==void 0&&(globalConfig.sound=!!m),f!==void 0&&(globalConfig.icon=!!f),y!==void 0&&(globalConfig.pauseOnHover=!!y),h!==void 0&&(globalConfig.priorityQueue=!!h),p!==void 0&&(globalConfig.priorityScorer=typeof p=="function"?p:null),v!==void 0&&(globalConfig.onMetrics=typeof v=="function"?v:null),getConfig()}function resetConfig(){return Object.assign(globalConfig,DEFAULT_GLOBAL_CONFIG),typeof document<"u"&&(document.documentElement.removeAttribute("data-toast-theme"),document.documentElement.removeAttribute("data-toast-reduced-motion")),getConfig()}function getConfig(){return{...globalConfig}}function getToastRoot(){return isValidMountTarget(globalConfig.targetNode)?globalConfig.targetNode:typeof document<"u"?document.body:null}function shouldReduceMotion(){if(globalConfig.reducedMotion==="always")return!0;if(globalConfig.reducedMotion==="never")return!1;try{return!!(typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches)}catch{return!1}}let counter=0;function generateSalt(t=typeof globalThis<"u"?globalThis.crypto:null){if(t&&typeof t.getRandomValues=="function"){const r=new Uint16Array(1);return t.getRandomValues(r),r[0].toString(36).padStart(3,"0").slice(-3)}const e=typeof performance<"u"&&typeof performance.now=="function"?Math.floor(performance.now()*1e3):0;return((Date.now()^e)&65535).toString(36).padStart(3,"0").slice(-3)}const sessionSalt=generateSalt();function resetToastIdCounter(){counter=0}function generateToastId(t="toast"){const e=typeof t=="string"?t.trim().toLowerCase().replace(/[^a-z0-9_-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,""):"",i=e&&!/^[0-9]/.test(e)?e:"toast",r=Date.now().toString(36);counter=counter+1&16777215;const s=counter.toString(36);return`${i}-${r}-${sessionSalt}${s}`}async function createElementWithId(t,e){const i=document.createElement(t);return i.id=generateToastId(e),i}async function removeElement(t){if(!t)return!0;try{if(typeof t.remove=="function")return t.remove(),!0}catch{}try{if(t.parentNode)return t.parentNode.removeChild(t),!0}catch{}return!1}async function parseAnimationDuration(t){if(typeof t=="number"&&Number.isFinite(t)&&t>=0)return t;if(typeof t=="string"){const e=t.trim().toLowerCase();if(e.endsWith("s")&&!e.endsWith("ms")){const r=Number.parseFloat(e)*1e3;return Number.isFinite(r)&&r>=0?r:500}const i=Number.parseFloat(e);return Number.isFinite(i)&&i>=0?i:500}return 500}class LRUCache{constructor(e=200){this.maxSize=e,this.map=new Map}get(e){if(!this.map.has(e))return;const i=this.map.get(e);return this.map.delete(e),this.map.set(e,i),i}set(e,i){if(this.map.has(e))this.map.delete(e);else if(this.map.size>=this.maxSize){const r=this.map.keys().next().value;this.map.delete(r)}this.map.set(e,i)}}const colorCache=new LRUCache(200),namedColors={black:[0,0,0],white:[255,255,255],gray:[128,128,128],grey:[128,128,128],red:[255,0,0],green:[0,128,0],blue:[0,0,255],yellow:[255,255,0],orange:[255,165,0],purple:[128,0,128],transparent:[255,255,255]},precomputedNamedTextColors={};Object.entries(namedColors).forEach(([t,[e,i,r]])=>{const s=u=>{const l=u/255;return l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4)},n=.2126*s(e)+.7152*s(i)+.0722*s(r),a=(n+.05)/.05,o=1.05/(n+.05);precomputedNamedTextColors[t.toLowerCase()]=a>=o?"#000000":"#ffffff"});function getDynamicAccessibleTextColorHex(t){if(!t)return"#ffffff";const e=String(t),i=colorCache.get(e);if(i)return i;if(precomputedNamedTextColors[t==null?void 0:t.toLowerCase()]){const g=precomputedNamedTextColors[t.toLowerCase()];return colorCache.set(e,g),g}let r,s,n;function a(g){if(typeof g!="string")return g;let w=g.trim(),S=0;for(;w.toLowerCase().startsWith("var(")&&w.endsWith(")")&&S<5;){S++;const T=w.slice(4,-1).trim(),E=T.indexOf(","),M=(E===-1?T:T.slice(0,E)).trim(),D=E===-1?"":T.slice(E+1).trim();if(!M.startsWith("--"))return w;let _="";try{typeof document<"u"&&typeof getComputedStyle=="function"&&(_=getComputedStyle(document.documentElement).getPropertyValue(M).trim())}catch{}if(_)w=_;else if(D)w=D;else break}return w}function o(g){const w=g==null?void 0:g.match(/^#(?:([0-9a-f]{3,4})|([0-9a-f]{6})|([0-9a-f]{8}))$/i);if(w){let L=w[1]||w[2]||w[3];if((L.length===3||L.length===4)&&(L=L.slice(0,3).split("").map(A=>A+A).join("")),L.length>=6){const A=Number.parseInt(L.slice(0,2),16),C=Number.parseInt(L.slice(2,4),16),W=Number.parseInt(L.slice(4,6),16);if(Number.isFinite(A)&&Number.isFinite(C)&&Number.isFinite(W))return{r:A,g:C,b:W}}return null}const S=L=>{if(typeof L!="string")return Number(L);const A=L.trim();return A.endsWith("%")?Math.round(Number.parseFloat(A)/100*255):Number(A)},T=g==null?void 0:g.match(/rgba?\(\s*([\d.]+%?)\s*,\s*([\d.]+%?)\s*,\s*([\d.]+%?)(?:\s*,\s*[\d.%]+)?\s*\)/i);if(T){const L=Math.min(255,Math.max(0,S(T[1]))),A=Math.min(255,Math.max(0,S(T[2]))),C=Math.min(255,Math.max(0,S(T[3])));if(Number.isFinite(L)&&Number.isFinite(A)&&Number.isFinite(C))return{r:L,g:A,b:C}}const E=g==null?void 0:g.match(/rgba?\(\s*([\d.]+%?)\s+([\d.]+%?)\s+([\d.]+%?)(?:\s*\/\s*[\d.%]+)?\s*\)/i);if(E){const L=Math.min(255,Math.max(0,S(E[1]))),A=Math.min(255,Math.max(0,S(E[2]))),C=Math.min(255,Math.max(0,S(E[3])));if(Number.isFinite(L)&&Number.isFinite(A)&&Number.isFinite(C))return{r:L,g:A,b:C}}const M=L=>{const A=L.trim().toLowerCase();let C=Number.parseFloat(A);return Number.isFinite(C)?(A.endsWith("turn")?C=C*360:A.endsWith("grad")?C=C*360/400:A.endsWith("rad")&&(C=C*180/Math.PI),(C%360+360)%360/360):0},D=g==null?void 0:g.match(/hsla?\(\s*(-?[\d.]+(?:deg|grad|rad|turn)?)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*[\d.%]+)?\s*\)/i),_=!D&&(g==null?void 0:g.match(/hsla?\(\s*(-?[\d.]+(?:deg|grad|rad|turn)?)\s+([\d.]+)%\s+([\d.]+)%(?:\s*\/\s*[\d.%]+)?\s*\)/i)),N=D||_;if(N){const L=M(N[1]),A=Math.min(1,Math.max(0,Number(N[2])/100)),C=Math.min(1,Math.max(0,Number(N[3])/100));if(A===0){const B=Math.round(C*255);return{r:B,g:B,b:B}}const W=(B,F,j)=>{let z=j;return z<0&&(z+=1),z>1&&(z-=1),z<1/6?B+(F-B)*6*z:z<1/2?F:z<2/3?B+(F-B)*(2/3-z)*6:B},R=C<.5?C*(1+A):C+A-C*A,P=2*C-R;return{r:Math.round(W(P,R,L+1/3)*255),g:Math.round(W(P,R,L)*255),b:Math.round(W(P,R,L-1/3)*255)}}return null}try{const g=typeof t=="string"?t.trim():String(t||""),w=a(g).trim(),S=o(w);if(!S)throw new Error("Unknown color");({r,g:s,b:n}=S)}catch{r=s=n=128}const u=(g,w,S)=>{g/=255,w/=255,S/=255;const T=Math.max(g,w,S),E=Math.min(g,w,S);let M,D,_=(T+E)/2;if(T===E)M=D=0;else{const N=T-E;switch(D=_>.5?N/(2-T-E):N/(T+E),T){case g:M=(w-S)/N+(w<S?6:0);break;case w:M=(S-g)/N+2;break;case S:M=(g-w)/N+4}M/=6}return[M*360,D,_]},l=(g,w,S)=>{g/=360;let T,E,M;if(w===0)T=E=M=S;else{const D=(L,A,C)=>(C<0&&(C+=1),C>1&&(C-=1),C<.16666666666666666?L+(A-L)*6*C:C<.5?A:C<.6666666666666666?L+(A-L)*(.6666666666666666-C)*6:L),_=S<.5?S*(1+w):S+w-S*w,N=2*S-_;T=D(N,_,g+1/3),E=D(N,_,g),M=D(N,_,g-1/3)}return[Math.round(T*255),Math.round(E*255),Math.round(M*255)]},c=(g,w,S)=>{const T=[g,w,S].map(E=>(E/=255,E<=.03928?E/12.92:Math.pow((E+.055)/1.055,2.4)));return .2126*T[0]+.7152*T[1]+.0722*T[2]},m=(g,w)=>{const S=c(...g),T=c(...w);return(Math.max(S,T)+.05)/(Math.min(S,T)+.05)},f=(g,w,S)=>`#${g.toString(16).padStart(2,"0")}${w.toString(16).padStart(2,"0")}${S.toString(16).padStart(2,"0")}`;let[y,h,d]=u(r,s,n);const b=4.5;let p=d<.5?Math.min(d+.5,1):Math.max(d-.5,0),[v,k,x]=l(y,h,p);if(m([r,s,n],[v,k,x])<b){const g=m([r,s,n],[0,0,0]),w=m([r,s,n],[255,255,255]);[v,k,x]=g>=w?[0,0,0]:[255,255,255]}const I=f(v,k,x);return colorCache.set(e,I),I}const ALLOWED_TAGS=new Set(["DIV","SPAN","P","BR","STRONG","B","EM","I","U","SMALL","UL","OL","LI","A","IMG","PRE","CODE","MARK"]),ALLOWED_ATTRS=new Set(["href","src","alt","title","class","target","rel","loading"]),DISCARDED_TAGS=new Set(["SCRIPT","STYLE","IFRAME","NOSCRIPT","OBJECT","EMBED","SVG","MATH","AUDIO","VIDEO","CANVAS","TEMPLATE"]),ALLOWED_URI_REGEX=/^\s*(?:https?:|mailto:|data:image\/(?:png|jpe?g|gif|webp|avif|bmp|ico);|\/(?!\/|\\)|\.\/|\.\.\/|#)/i;function hasDOMPurify(){try{return!!(typeof window<"u"&&window.DOMPurify&&typeof window.DOMPurify.sanitize=="function")}catch{}return!1}function sanitizeAttributes(t,e){const i=[];Array.from(t.attributes||[]).forEach(s=>{const n=s.name.toLowerCase(),a=s.value;if(!e.has(n)||n.startsWith("on")){i.push(s.name);return}if(n==="href"||n==="src"){const o=typeof a=="string"?a.trim().toLowerCase():"";if((o.startsWith("javascript:")||o.startsWith("vbscript:")||o.startsWith("data:"))&&!(n==="src"&&o.startsWith("data:image/")&&!o.startsWith("data:image/svg+xml"))){if(n==="href"){t.setAttribute("href","#");return}i.push(s.name);return}if(!ALLOWED_URI_REGEX.test(a)){if(n==="href"){t.setAttribute("href","#");return}i.push(s.name);return}}if(n==="target"&&typeof a=="string"&&a.trim().toLowerCase()==="_blank"){const o=(t.getAttribute("rel")||"").split(/\s+/).filter(Boolean);o.includes("noopener")||o.push("noopener"),o.includes("noreferrer")||o.push("noreferrer"),t.setAttribute("rel",o.join(" "))}}),i.forEach(s=>t.removeAttribute(s));const r=t.getAttribute("target");if(t.tagName==="A"&&typeof r=="string"&&r.trim().toLowerCase()==="_blank"){const s=(t.getAttribute("rel")||"").split(/\s+/).filter(Boolean);s.includes("noopener")||s.push("noopener"),s.includes("noreferrer")||s.push("noreferrer"),t.setAttribute("rel",s.join(" "))}}function sanitizeNode(t,e,i){if(t.nodeType===Node.TEXT_NODE)return document.createTextNode(t.nodeValue);if(t.nodeType===Node.COMMENT_NODE||t.nodeType!==Node.ELEMENT_NODE)return null;const r=t.tagName.toUpperCase();if(DISCARDED_TAGS.has(r)||r.includes("SCRIPT")||r.includes("<")||r.includes(">"))return null;if(!e.has(r)){const n=document.createDocumentFragment();return Array.from(t.childNodes).forEach(a=>{const o=sanitizeNode(a,e,i);o&&n.appendChild(o)}),n}const s=document.createElement(t.tagName);return Array.from(t.attributes||[]).forEach(n=>{s.setAttribute(n.name,n.value)}),sanitizeAttributes(s,i),Array.from(t.childNodes).forEach(n=>{const a=sanitizeNode(n,e,i);a&&s.appendChild(a)}),s}function parseHtmlInert(t){if(typeof DOMParser<"u")try{const i=new DOMParser().parseFromString(t,"text/html");if(i&&i.body)return i.body}catch{}if(typeof document<"u"){const e=document.createElement("template");if("content"in e)return e.innerHTML=t,e.content;const i=document.createElement("div");return i.innerHTML=t,i}return null}function fallbackSanitize(t){if(!t||typeof t!="string")return"";const e=parseHtmlInert(t);if(!e)return"";const i=document.createDocumentFragment();Array.from(e.childNodes).forEach(s=>{const n=sanitizeNode(s,ALLOWED_TAGS,ALLOWED_ATTRS);n&&i.appendChild(n)});const r=document.createElement("div");return r.appendChild(i),r.querySelectorAll('a[target="_blank"]').forEach(s=>{const n=(s.getAttribute("rel")||"").split(/\s+/).filter(Boolean);n.includes("noopener")||n.push("noopener"),n.includes("noreferrer")||n.push("noreferrer"),s.setAttribute("rel",n.join(" "))}),r.innerHTML}function sanitizeHtml(t,e={}){if(typeof t!="string"||!t.trim())return"";try{if(!e.forceFallback&&hasDOMPurify()){const r=window.DOMPurify.sanitize(t,{ALLOWED_TAGS:Array.from(ALLOWED_TAGS),ALLOWED_ATTR:Array.from(ALLOWED_ATTRS),ALLOWED_URI_REGEXP:ALLOWED_URI_REGEX}),s=document.createElement("div");return s.innerHTML=r,s.querySelectorAll("a[href]").forEach(n=>{const a=n.getAttribute("href")||"";ALLOWED_URI_REGEX.test(a)||n.setAttribute("href","#")}),s.querySelectorAll('a[target="_blank"]').forEach(n=>{const a=(n.getAttribute("rel")||"").split(/\s+/).filter(Boolean);a.includes("noopener")||a.push("noopener"),a.includes("noreferrer")||a.push("noreferrer"),n.setAttribute("rel",a.join(" "))}),s.innerHTML}}catch(i){console.warn("DOMPurify sanitization failed, falling back:",i)}return fallbackSanitize(t)}function createLoader(t={}){if(typeof document>"u")return null;const e=t&&typeof t=="object"&&!Array.isArray(t)?t:{},i=Number(e.size),r=Number.isFinite(i)&&i>0?i:14,s=typeof e.color=="string"&&e.color.trim()?e.color.trim():"currentColor",n=/[\r\n<>"';]/.test(s)||/^\s*javascript:/i.test(s)?"currentColor":s,a=typeof e.text=="string"?e.text:"",o=document.createElement("span");o.className="toast-loader",o.setAttribute("role","status"),o.setAttribute("aria-label",a||"Loading");const u=getConfig();u.disableInlineStyles||(o.style.display="inline-flex",o.style.alignItems="center",o.style.gap="8px");const l="http://www.w3.org/2000/svg",c=document.createElementNS(l,"svg");c.setAttribute("width",String(r)),c.setAttribute("height",String(r)),c.setAttribute("viewBox","0 0 50 50"),c.setAttribute("aria-hidden","true");const m=document.createElementNS(l,"circle");if(m.classList.add("toast-loader-circle"),m.setAttribute("cx","25"),m.setAttribute("cy","25"),m.setAttribute("r","20"),m.setAttribute("fill","none"),m.setAttribute("stroke",n),m.setAttribute("stroke-width","4"),m.setAttribute("stroke-linecap","round"),u.disableInlineStyles||(m.style.opacity="0.85",m.style.strokeDasharray="90",m.style.strokeDashoffset="60",m.style.transformOrigin="center",shouldReduceMotion()||(m.style.animation="toast-spinner 1s linear infinite")),c.appendChild(m),o.appendChild(c),a){const f=document.createElement("span");f.className="toast-loader-label",u.disableInlineStyles||(f.style.fontSize="13px"),f.textContent=a,o.appendChild(f)}if(!u.disableInlineStyles&&typeof document<"u"&&!document.getElementById("toast-spinner-styles"))try{const f=document.createElement("style");f.id="toast-spinner-styles",f.textContent="@keyframes toast-spinner { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }";const y=document.head||document.documentElement;y&&y.appendChild(f)}catch{}return o}function createCTA(t,e,i){const r=e==null?void 0:e.cta;if(!r||typeof r!="object")return;const s=Array.isArray(r)?r.filter(o=>o&&typeof o=="object"):[r];if(s.length===0)return;const n=[];s.forEach((o,u)=>{if(!o||typeof o!="object")return;const l={...o};l.label||(l.label=s.length>1?`Action ${u+1}`:"CTA Label Missing!");const c=l.variant==="link"||!l.variant&&!!l.href,m=document.createElement(c?"a":"button");if(c){if(l.href){const w=String(l.href).trim(),S=/^(javascript:|vbscript:|data:(?!image\/[a-z0-9.+-]+;base64,))/i.test(w);m.href=S?"#":w}else m.setAttribute("role","button"),m.tabIndex=0;l.target&&(m.target=l.target);const g=new Set((l.rel||"").split(/\s+/).filter(Boolean));typeof l.target=="string"&&l.target.trim().toLowerCase()==="_blank"&&(g.add("noopener"),g.add("noreferrer")),m.rel=Array.from(g).join(" ")}else m.type="button";m.setAttribute("aria-label",l.ariaLabel||l.label);const f=l.textColor||l.color||e.textColor||getDynamicAccessibleTextColorHex(e.backgroundColor),y=l.backgroundColor||l.background||(e.backgroundColor?getContrastBackground(e.backgroundColor):"rgba(255,255,255,0.15)"),d=(typeof f=="string"?f.trim():"").match(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/);let b="rgba(128, 128, 128, 0.3)";d&&(b=`${d[1].length===3?`#${d[1][0]}${d[1][0]}${d[1][1]}${d[1][1]}${d[1][2]}${d[1][2]}`:`#${d[1]}`}44`),m.className="toast-cta";const p=e.fontDirection==="rtl";getConfig().disableInlineStyles||Object.assign(m.style,{marginLeft:p?"0px":u===0?"10px":"6px",marginRight:p?u===0?"10px":"6px":"0px",padding:"6px 10px",borderRadius:"6px",fontSize:"12px",fontWeight:"600",lineHeight:"1",border:`1px solid ${b}`,color:f,background:y,cursor:"pointer",whiteSpace:"nowrap",flexShrink:"0",display:"inline-flex",alignItems:"center",textDecoration:"none",outline:"none"}),m.textContent=l.label;const v=async g=>{if(!m._isExecuting){m._isExecuting=!0;try{if(typeof l.onClick=="function"){const w=l.onClick(g);w!=null&&w.then&&await w}}catch(w){console.error("CTA onClick handler error:",w)}finally{m._isExecuting=!1,l.autoClose!==!1&&typeof i=="function"&&await i(t)}}},k=g=>{c&&!l.href&&(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),v(g))};m.addEventListener("click",v),c&&!l.href&&m.addEventListener("keydown",k);const x=()=>{m.removeEventListener("click",v),c&&!l.href&&m.removeEventListener("keydown",k)};m._cleanup=x,n.push(x);const I=t.querySelector(".toast-undo-btn")||t.querySelector(".toast-close-btn")||t.querySelector(".toast-progress-bar");I?t.insertBefore(m,I):t.appendChild(m)});const a=t._cleanupCTA;t._cleanupCTA=()=>{a==null||a(),n.forEach(o=>o())}}function createUndoAction(t,e,i){const r=e==null?void 0:e.undo;if(!r)return;const s=typeof r=="function";if(!s&&(typeof r!="object"||Array.isArray(r)))return;const n=s?{onUndo:r}:{...r},a=typeof n.label=="string"&&n.label.trim()?n.label.trim():typeof(e==null?void 0:e.undoText)=="string"&&e.undoText.trim()?e.undoText.trim():"Undo",o=Number(e==null?void 0:e.duration),u=n.showCountdown!==!1&&Number.isFinite(o)&&o>0,l=document.createElement("button");l.type="button",l.className="toast-undo-btn",l.setAttribute("aria-label",`${a} action`);const c=e.textColor||getDynamicAccessibleTextColorHex(e.backgroundColor),m=e.backgroundColor?getContrastBackground(e.backgroundColor):"rgba(255,255,255,0.18)",y=(typeof c=="string"?c.trim():"").match(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/);let h="rgba(128, 128, 128, 0.35)";y&&(h=`${y[1].length===3?`#${y[1][0]}${y[1][0]}${y[1][1]}${y[1][1]}${y[1][2]}${y[1][2]}`:`#${y[1]}`}55`);const d=e.fontDirection==="rtl";getConfig().disableInlineStyles||Object.assign(l.style,{marginLeft:d?"0px":"10px",marginRight:d?"10px":"0px",padding:"5px 10px",borderRadius:"6px",fontSize:"12px",fontWeight:"700",lineHeight:"1",border:`1px solid ${h}`,color:c,background:m,cursor:"pointer",whiteSpace:"nowrap",flexShrink:"0",display:"inline-flex",alignItems:"center",gap:"4px"});let b=Math.max(1,Math.ceil((o||2500)/1e3));const p=()=>{l.textContent=u?`${a} (${b}s)`:a};p();let v=null,k=!1;u&&(v=setInterval(()=>{k||(b=Math.max(0,b-1),p(),b<=0&&v&&(clearInterval(v),v=null))},1e3),typeof(v==null?void 0:v.unref)=="function"&&v.unref()),t._pauseUndo=()=>{k=!0},t._resumeUndo=()=>{k=!1};const x=()=>{v&&(clearInterval(v),v=null),t._pauseUndo=null,t._resumeUndo=null},I=async w=>{x(),l.removeEventListener("click",I);try{if(typeof n.onUndo=="function"){const S=n.onUndo(w,t);S!=null&&S.then&&await S}}catch(S){console.error("Undo action error:",S)}finally{typeof i=="function"&&await i(t)}};l.addEventListener("click",I),l._cleanup=()=>{x(),l.removeEventListener("click",I)},t._cleanupUndo=()=>{x(),l.removeEventListener("click",I)};const g=t.querySelector(".toast-close-btn")||t.querySelector(".toast-progress-bar");g?t.insertBefore(l,g):t.appendChild(l)}function createCloseButton(t,e,i){const r=document.createElement("button");r.type="button";const s=typeof(e==null?void 0:e.closeAriaLabel)=="string"&&e.closeAriaLabel.trim()?e.closeAriaLabel.trim():"Close notification";r.setAttribute("aria-label",s),r.setAttribute("title",s),r.textContent="\xD7";const n=e.textColor||getDynamicAccessibleTextColorHex(e.backgroundColor);r.className="toast-close-btn";const a=e.fontDirection==="rtl";getConfig().disableInlineStyles||Object.assign(r.style,{background:"none",border:"none",color:n,fontSize:"18px",marginLeft:a?"0px":"10px",marginRight:a?"10px":"0px",cursor:"pointer",lineHeight:"1",padding:"0 4px",flexShrink:"0",display:"inline-flex",alignItems:"center",justifyContent:"center"});const o=()=>{typeof i=="function"&&i(t)};r.addEventListener("click",o),t._cleanupCloseButton=()=>{r.removeEventListener("click",o)},t.appendChild(r)}function getContrastBackground(t){return t&&getDynamicAccessibleTextColorHex(t)==="#000000"?"rgba(0,0,0,0.15)":"rgba(255,255,255,0.15)"}function ensureProgressIndeterminateStyles(){if(typeof document>"u"||document.getElementById("toast-progress-indeterminate-styles"))return;const t=document.createElement("style");t.id="toast-progress-indeterminate-styles",t.textContent=`
15
+ @keyframes toast-progress-indeterminate {
16
+ 0% { left: 0%; width: 0%; }
17
+ 50% { left: 20%; width: 60%; }
18
+ 100% { left: 100%; width: 0%; }
19
+ }
20
+ @keyframes toast-progress-indeterminate-rtl {
21
+ 0% { right: 0%; width: 0%; }
22
+ 50% { right: 20%; width: 60%; }
23
+ 100% { right: 100%; width: 0%; }
24
+ }
25
+ .toast-progress-bar-indeterminate {
26
+ animation: toast-progress-indeterminate 1.6s cubic-bezier(0.4, 0, 0.2, 1) infinite !important;
27
+ }
28
+ .toast-progress-bar-indeterminate-rtl {
29
+ animation: toast-progress-indeterminate-rtl 1.6s cubic-bezier(0.4, 0, 0.2, 1) infinite !important;
30
+ }
31
+ `;const e=document.head||document.documentElement;e&&e.appendChild(t)}function parseProgressValue(t,e,i={}){if(t==null)return null;if(t==="indeterminate")return"indeterminate";let r;return typeof t=="string"?r=Number.parseFloat(t.trim()):r=Number(t),Number.isFinite(r)?(e&&r>0&&r<1&&(e._progressRatioMode=!0),((i.progressNormalized||e!=null&&e._progressRatioMode)&&r>0&&r<=1||r>0&&r<1)&&(r=r*100),Math.min(100,Math.max(0,r))):0}function createProgressBar(t,e={}){var i;if(!t)return;const r=document.createElement("div");r.className="toast-progress-bar",t._progressBar=r;const s=e.borderRadius||"0",n=Number.parseInt(s,10),a=Number.isFinite(n)&&n>0?n:0;let o=4,u="4px";if(typeof e.progressHeight=="number"&&Number.isFinite(e.progressHeight)&&e.progressHeight>0)o=e.progressHeight,u=`${o}px`;else if(typeof e.progressHeight=="string"&&e.progressHeight.trim()){const p=e.progressHeight.trim(),v=Number.parseFloat(p);Number.isFinite(v)&&v>0&&(p.endsWith("rem")||p.endsWith("em")?(o=v*16,u=p):(o=v,u=/^\d+(\.\d+)?$/.test(p)?`${v}px`:p))}const l=Number(e.duration??2500),c=Math.max(0,l+5),m=Math.min(a,o*2),f=a>0?`calc(100% - ${m*2}px)`:"100%",y=e.progressDirection==="reverse"||e.progressDirection==="increasing"||e.progressDirection==="ltr",h=e.fontDirection==="rtl"||e.progressDirection==="rtl"||((i=t==null?void 0:t.style)==null?void 0:i.direction)==="rtl";r._leftOffset=m,r._finalWidth=f,r._isReverse=y,r._isRtl=h;const d=e.progressBarColor||e.progressColor||"currentColor";getConfig().disableInlineStyles||Object.assign(r.style,{position:"absolute",left:h?"auto":`${m}px`,right:h?`${m}px`:"auto",height:u,background:d,width:y?"0%":`${f}`,transition:`width ${c}ms linear`,[e.progressPosition==="top"?"top":"bottom"]:"0",borderRadius:`${o/2}px`,opacity:"0.8",zIndex:"2",willChange:"width"}),t.appendChild(r);const b=e.progress==="indeterminate"||!!e.showProgressBar&&(e.duration===0||e.duration===1/0)&&e.progress===void 0;if(r._isIndeterminate=b,r._isManualProgress=e.progress!==void 0&&e.progress!=="indeterminate",b){if(r.classList.add("toast-progress-bar-indeterminate"),h&&r.classList.add("toast-progress-bar-indeterminate-rtl"),!getConfig().disableInlineStyles){ensureProgressIndeterminateStyles();const p=h?"toast-progress-indeterminate-rtl":"toast-progress-indeterminate";r.style.animation=`${p} 1.6s cubic-bezier(0.4, 0, 0.2, 1) infinite`}r.style.width=f;return}if(e.progress!==void 0){const p=parseProgressValue(e.progress,t,e);r.style.width=`${p}%`,r.style.transition="width 200ms ease";return}if(e.duration===0||e.duration===1/0){r.style.width="0%";return}if(shouldReduceMotion())r.style.display="none";else if(typeof r.animate=="function"){const p=y?[{width:"0%"},{width:f}]:[{width:f},{width:"0%"}];t._progressAnimation=r.animate(p,{duration:c,easing:"linear",fill:"forwards",delay:50})}else r.style.transition=`width ${c}ms linear`,requestAnimationFrame(()=>{r.style.width=y?f:"0%"})}function runToastAnimation(t){if(!t||t._hasAnimated)return;if(shouldReduceMotion()){t._hasAnimated=!0,t.style.transition="none",t.style.opacity="1",t.style.transform="translateY(0)",t.classList.add("active");return}const e=()=>{if(!t._hasAnimated){t._hasAnimated=!0;try{t.offsetHeight}catch{}requestAnimationFrame(()=>{t.style.opacity="1",t.style.transform="none",t.classList.add("active")})}};t.isConnected?e():requestAnimationFrame(()=>{t.isConnected?e():requestAnimationFrame(()=>{e()})})}function attachSwipeToDismiss(t,e){if(!t||typeof t.addEventListener!="function")return;let i=0,r=0,s=0,n=0,a=!1,o=!1,u=null,l=!1;const c=()=>{l&&(l=!1,window.removeEventListener("mousemove",f),window.removeEventListener("mouseup",y))},m=h=>{if(!h||h.button!==void 0&&h.button!==0)return;const d=h.target;if(d&&typeof d.closest=="function"&&d.closest("button, a, input, textarea, select, label"))return;let b=h;h.touches&&h.touches.length>0?(b=h.touches[0],u=b.identifier??null):u=null,i=b.clientX,r=b.clientY,s=i,n=Date.now(),a=!0,o=!1,t._originalTransition=t.style.transition||"",t.style.transition="none",t.style.userSelect="none",!l&&typeof window<"u"&&(l=!0,window.addEventListener("mousemove",f,{passive:!1}),window.addEventListener("mouseup",y,{passive:!0}))},f=h=>{if(!a||!h)return;let d=h;if(h.touches)if(u!==null){for(let x=0;x<h.touches.length;x++)if(h.touches[x].identifier===u){d=h.touches[x];break}}else h.touches.length>0&&(d=h.touches[0]);const b=d.clientX,p=d.clientY,v=b-i,k=p-r;if(!o){if(Math.abs(v)>8&&Math.abs(v)>Math.abs(k))o=!0;else if(Math.abs(k)>8){a=!1,t.style.userSelect="",c();return}}if(o){s=b;const x=Math.max(0,1-Math.abs(v)/280);!getConfig().disableInlineStyles&&!shouldReduceMotion()&&(t.style.transform=`translateX(${v}px)`,t.style.opacity=String(x)),h.cancelable&&h.preventDefault()}},y=()=>{var h,d;if(c(),u=null,!a||!o){a=!1,t.style.userSelect="";return}a=!1,t.style.userSelect="";const b=s-i,p=Math.max(1,Date.now()-n),k=(p>0?Math.abs(b)/p:0)>=.65&&Math.abs(b)>=50,x=k?50:75;if(Math.abs(b)>=x){const I=b>0?320:-320,g=k?120:180;!getConfig().disableInlineStyles&&!shouldReduceMotion()&&(t.style.transition=`transform ${g}ms ease-out, opacity ${g}ms ease-out`,t.style.transform=`translateX(${I}px)`,t.style.opacity="0"),t._swipeTimeout&&clearTimeout(t._swipeTimeout),t._swipeTimeout=setTimeout(()=>{t._swipeTimeout=null,typeof e=="function"&&e(t)},g),typeof((h=t._swipeTimeout)==null?void 0:h.unref)=="function"&&t._swipeTimeout.unref()}else if(!getConfig().disableInlineStyles&&!shouldReduceMotion()){const I="cubic-bezier(0.34, 1.56, 0.64, 1)";t.style.transition=`transform 200ms ${I}, opacity 200ms ease`,t.style.transform="translateX(0)",t.style.opacity="1",t._snapbackTimer&&clearTimeout(t._snapbackTimer),t._snapbackTimer=setTimeout(()=>{t._snapbackTimer=null,t.style.transform="none",t._originalTransition&&(t.style.transition=t._originalTransition)},200),typeof((d=t._snapbackTimer)==null?void 0:d.unref)=="function"&&t._snapbackTimer.unref()}};t.addEventListener("touchstart",m,{passive:!0}),t.addEventListener("touchmove",f,{passive:!1}),t.addEventListener("touchend",y,{passive:!0}),t.addEventListener("touchcancel",y,{passive:!0}),t.addEventListener("mousedown",m,{passive:!0}),t._cleanupSwipe=()=>{t._swipeTimeout&&(clearTimeout(t._swipeTimeout),t._swipeTimeout=null),t._snapbackTimer&&(clearTimeout(t._snapbackTimer),t._snapbackTimer=null),c(),t.removeEventListener("touchstart",m),t.removeEventListener("touchmove",f),t.removeEventListener("touchend",y),t.removeEventListener("touchcancel",y),t.removeEventListener("mousedown",m)}}function attachFocusTrap(t){if(!t||typeof t.querySelectorAll!="function")return null;const e=typeof document<"u"&&document.activeElement&&document.activeElement!==document.body?document.activeElement:null,i=()=>Array.from(t.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')).filter(a=>{try{if(typeof a.offsetWidth=="number"&&typeof a.offsetHeight=="number"){const o=typeof window<"u"&&window.getComputedStyle?window.getComputedStyle(a):null;if(o&&(o.display==="none"||o.visibility==="hidden"))return!1;if(typeof document<"u"&&document.body&&(document.body.offsetWidth>0||document.body.offsetHeight>0)&&a.offsetWidth===0&&a.offsetHeight===0)return a===document.activeElement}return!0}catch{return!0}}),r=a=>{if(a.key!=="Tab"||!t.isConnected)return;const o=i();if(o.length===0)return;const u=o[0],l=o[o.length-1];a.shiftKey?(document.activeElement===u||!t.contains(document.activeElement))&&(l.focus(),a.preventDefault()):(document.activeElement===l||!t.contains(document.activeElement))&&(u.focus(),a.preventDefault())};t.addEventListener("keydown",r),typeof document<"u"&&document.addEventListener("keydown",r);const s=setTimeout(()=>{const a=i();a.length>0&&typeof a[0].focus=="function"&&a[0].focus()},30);typeof(s==null?void 0:s.unref)=="function"&&s.unref();const n=()=>{if(clearTimeout(s),t.removeEventListener("keydown",r),typeof document<"u"&&document.removeEventListener("keydown",r),e&&typeof e.focus=="function"&&e.isConnected)try{e.focus()}catch{}};return t._cleanupFocusTrap=n,n}const svgNS="http://www.w3.org/2000/svg",ALLOWED_SVG_TAGS=new Set(["svg","g","path","circle","rect","line","polyline","polygon","ellipse","title","desc","defs","clippath","use"]),ALLOWED_SVG_ATTRS=new Set(["viewbox","width","height","fill","stroke","stroke-width","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-dasharray","stroke-dashoffset","opacity","fill-opacity","stroke-opacity","d","cx","cy","r","x","y","x1","y1","x2","y2","points","rx","ry","transform","role","aria-hidden","focusable","xmlns","preserveaspectratio","class","id","href","xlink:href"]);function isUnsafeUrl(t=""){return/^\s*javascript:/i.test(t)}function sanitizeInlineSvg(t){const e=typeof DOMParser<"u"?DOMParser:typeof window<"u"&&window.DOMParser?window.DOMParser:null;if(!e)return null;try{const r=new e().parseFromString(t,"image/svg+xml");if(r.querySelector("parsererror"))return null;const s=r.documentElement;if(!s||s.tagName.toLowerCase()!=="svg")return null;const n=a=>{if(a.nodeType===3)return document.createTextNode(a.textContent||"");if(a.nodeType!==1)return null;const o=a.tagName.toLowerCase();if(!ALLOWED_SVG_TAGS.has(o))return null;const u=document.createElementNS(svgNS,o);if(a.attributes)for(let l=0;l<a.attributes.length;l++){const c=a.attributes[l],m=c.name,f=m.toLowerCase(),y=c.value||"";f.startsWith("on")||ALLOWED_SVG_ATTRS.has(f)&&((f==="href"||f==="xlink:href")&&(isUnsafeUrl(y)||o==="use"&&y&&!y.startsWith("#"))||u.setAttribute(m,y))}if(a.childNodes)for(let l=0;l<a.childNodes.length;l++){const c=n(a.childNodes[l]);c&&u.appendChild(c)}return u};return n(s)}catch{return null}}const ICON_SVGS={success:`
32
+ <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">
33
+ <path d="M20 6L9 17l-5-5"/>
34
+ </svg>
35
+ `,error:`
36
+ <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">
37
+ <circle cx="12" cy="12" r="10"/>
38
+ <line x1="15" y1="9" x2="9" y2="15"/>
39
+ <line x1="9" y1="9" x2="15" y2="15"/>
40
+ </svg>
41
+ `,warning:`
42
+ <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">
43
+ <path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"/>
44
+ <line x1="12" y1="9" x2="12" y2="13"/>
45
+ <line x1="12" y1="17" x2="12.01" y2="17"/>
46
+ </svg>
47
+ `,info:`
48
+ <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">
49
+ <circle cx="12" cy="12" r="10"/>
50
+ <line x1="12" y1="16" x2="12" y2="12"/>
51
+ <line x1="12" y1="8" x2="12.01" y2="8"/>
52
+ </svg>
53
+ `};function createToastIcon(t={}){const e=t&&typeof t=="object"&&!Array.isArray(t)?t:{};let i=e.icon;if(i===void 0){const u=getConfig().icon;u!==void 0&&(i=u)}if(typeof i=="function")try{i=i(e)}catch(u){console.warn("options.icon callback error:",u),i=null}if(i===!1||i===""||i===null||typeof document>"u")return null;const r=e.type,s=getConfig(),n=document.createElement("i");n.className="toast-icon",n.setAttribute("aria-hidden","true");const a=e.fontDirection==="rtl";if(s.disableInlineStyles||Object.assign(n.style,{display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:"0",marginLeft:a?"8px":"0px",marginRight:a?"0px":"8px",lineHeight:"1",fontStyle:"normal"}),i&&typeof i=="object"&&(i.nodeType===1||i.nodeType===11||typeof HTMLElement<"u"&&i instanceof HTMLElement)&&typeof i.cloneNode=="function")return n.appendChild(i.cloneNode(!0)),n;if(typeof i=="string"&&i.trim()){const u=i.trim(),c={check:ICON_SVGS.success,checkmark:ICON_SVGS.success,success:ICON_SVGS.success,cross:ICON_SVGS.error,error:ICON_SVGS.error,alert:ICON_SVGS.warning,warning:ICON_SVGS.warning,circle:ICON_SVGS.info,info:ICON_SVGS.info}[u.toLowerCase()];if(c){const m=sanitizeInlineSvg(c.trim());return m&&n.appendChild(m),n}if(u.startsWith("<svg")&&u.endsWith("</svg>")){const m=sanitizeInlineSvg(u);m?(m.setAttribute("aria-hidden","true"),m.setAttribute("focusable","false"),m.getAttribute("width")||m.setAttribute("width","18"),m.getAttribute("height")||m.setAttribute("height","18"),n.appendChild(m)):n.textContent=u}else n.textContent=u;return n}const o=typeof r=="string"?r.toLowerCase().trim():"";if((i===!0||i===void 0)&&o&&ICON_SVGS[o]){const u=sanitizeInlineSvg(ICON_SVGS[o].trim());return u&&n.appendChild(u),n}return null}function getInitialTransform(t,e,i){const r=String(t||"").toLowerCase(),s=r.includes("top"),n=r.includes("left"),a=r.includes("right"),o=String(e||"").toLowerCase().trim();return o==="fade"?"none":o==="zoom"||o==="scale"?"scale(0.75)":o==="flip"?"perspective(600px) rotateX(45deg)":o==="slide"?n?"translateX(-100%)":a?"translateX(100%)":s?"translateY(-100%)":"translateY(100%)":i?r.includes("center")&&!s&&!r.includes("bottom")?n?"translateX(-36px) scale(0.92)":a?"translateX(36px) scale(0.92)":"scale(0.85)":s?"translateY(-36px) scale(0.92)":"translateY(36px) scale(0.92)":o==="bounce"?s?"translateY(-36px) scale(0.9)":"translateY(36px) scale(0.9)":s?"translateY(-20px)":"translateY(20px)"}async function applyRichStyling(t,e,i){const r=getConfig(),s=String((e==null?void 0:e.animationType)||"").toLowerCase().trim(),n=!!(e!=null&&e.spring)||s==="spring",a=n?400:await parseAnimationDuration(e==null?void 0:e.animationDuration),o=`${a}ms`,u=n?"cubic-bezier(0.34, 1.56, 0.64, 1)":typeof(e==null?void 0:e.animationEasing)=="string"&&e.animationEasing.trim()?e.animationEasing.trim():"ease";t._animationType=e==null?void 0:e.animationType;const l=typeof(e==null?void 0:e.className)=="string"&&e.className.trim()?` ${e.className.trim()}`:"";t.className=`toast toast-${(e==null?void 0:e.type)??"info"}${l}`;const c=typeof(e==null?void 0:e.borderRadius)=="number"?`${e.borderRadius}px`:e==null?void 0:e.borderRadius,m=typeof(e==null?void 0:e.maxWidth)=="number"?`${e.maxWidth}px`:e==null?void 0:e.maxWidth,f=n?`${Math.min(300,a)}ms`:o,y=n?"ease":u;r.disableInlineStyles||Object.assign(t.style,{background:e==null?void 0:e.backgroundColor,padding:"12px 16px",marginBottom:"10px",borderRadius:c,overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"space-between",boxShadow:"0 4px 6px rgba(0, 0, 0, 0.1)",minWidth:"250px",maxWidth:m,opacity:"0",position:"relative",cursor:"default",boxSizing:"border-box",userSelect:"text",pointerEvents:"auto",transition:`opacity ${f} ${y}, transform ${o} ${u}`,transform:getInitialTransform(e==null?void 0:e.position,e==null?void 0:e.animationType,n),zIndex:String(r.zIndex),direction:e!=null&&e.fontDirection&&e.fontDirection!=="auto"?e.fontDirection:void 0});const h=(e==null?void 0:e.type)==="error",d=(e==null?void 0:e.role)||"alert",b=(e==null?void 0:e.ariaLive)||(h?"assertive":"polite");t.setAttribute("role",d),t.setAttribute("aria-live",b),t.tabIndex=0,t._animationDuration=a;const p=document.createElement("span");p.className="toast-message",t._messageSpan=p,(e==null?void 0:e.wrapText)==="truncate"||(e==null?void 0:e.wrapText)==="ellipsis"||(e==null?void 0:e.wrapText)===!1||!(e!=null&&e.wrapText)?(p.classList.add("is-truncated"),r.disableInlineStyles||Object.assign(p.style,{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:"3",whiteSpace:"normal",overflow:"hidden",textOverflow:"ellipsis"})):r.disableInlineStyles||Object.assign(p.style,{display:"block",whiteSpace:"normal"});const k=typeof(e==null?void 0:e.fontSize)=="number"?`${e.fontSize}px`:e==null?void 0:e.fontSize;r.disableInlineStyles||Object.assign(p.style,{flex:"1",padding:e==null?void 0:e.fontPadding,fontFamily:e==null?void 0:e.fontFamily,fontSize:k,fontWeight:e==null?void 0:e.fontWeight,lineHeight:e==null?void 0:e.fontLineHeight,color:e==null?void 0:e.textColor,userSelect:"text",wordBreak:"break-word",overflow:"hidden",textOverflow:"ellipsis",direction:e!=null&&e.fontDirection&&e.fontDirection!=="auto"?e.fontDirection:void 0});const x=!!e.allowHtml,I=e.message??"",g=createToastIcon(e);if(g&&t.appendChild(g),e.loader||e.showLoader){const T=createLoader(e.loader||{});p.appendChild(T);const E=document.createElement("span");E.className="toast-message-spacer",r.disableInlineStyles||(E.style.display="inline-block",E.style.width="8px"),p.appendChild(E)}if(x&&typeof I=="string"&&I.trim().length>0)try{const T=sanitizeHtml(I),E=document.createElement("div");for(E.innerHTML=T;E.firstChild;)p.appendChild(E.firstChild)}catch(T){console.warn("HTML message sanitization failed, falling back to text:",T),p.appendChild(document.createTextNode(String(I)))}else p.appendChild(document.createTextNode(String(I)));if(p.setAttribute("title",p.textContent||""),t.appendChild(p),e!=null&&e.cta&&typeof e.cta=="object"&&createCTA(t,e,i),e!=null&&e.undo&&createUndoAction(t,e,i),e!=null&&e.showCloseButton&&createCloseButton(t,e,i),(e==null?void 0:e.showProgressBar)!==!1&&(e!=null&&e.showProgressBar||(e==null?void 0:e.progress)!==void 0)&&createProgressBar(t,e),((e==null?void 0:e.swipeToDismiss)!==void 0?e.swipeToDismiss:r.swipeToDismiss)!==!1&&attachSwipeToDismiss(t,i),(e==null?void 0:e.sound)!==void 0?e.sound:r.sound){if(typeof(e==null?void 0:e.sound)=="string"&&typeof window<"u"&&typeof window.Audio=="function")try{new window.Audio(e.sound).play().catch(()=>{})}catch{}else if(typeof(e==null?void 0:e.onSound)=="function")try{e.onSound(e)}catch{}}((e==null?void 0:e.trapFocus)??r.trapFocus)&&attachFocusTrap(t),runToastAnimation(t)}async function createEmergencyToast(t={},e){try{const i=getConfig(),r=document.createElement("div"),s=(t==null?void 0:t.position)||i.defaultPosition,n=String(s).toLowerCase().trim();let a="auto",o="auto",u="auto",l="auto",c="none";n.startsWith("top")?a="20px":(n.startsWith("bottom")||n.includes("below"))&&(o="20px"),n.startsWith("left")?u="20px":n.startsWith("right")?l="20px":n==="center"?(u="50%",a="50%",c="translate(-50%, -50%)"):n.includes("center")?n.includes("left")?(u="20px",a="50%",c="translateY(-50%)"):n.includes("right")?(l="20px",a="50%",c="translateY(-50%)"):n.includes("top")?(a="20px",u="50%",c="translateX(-50%)"):n.includes("bottom")&&(o="20px",u="50%",c="translateX(-50%)"):(l="20px",o="20px"),r.className="toast-emergency",r.tabIndex=0,r.setAttribute("role","alert"),r.setAttribute("aria-live","assertive"),i.disableInlineStyles||Object.assign(r.style,{background:"#333",color:"white",padding:"10px 15px",position:"fixed",top:a,bottom:o,left:u,right:l,transform:c,zIndex:String(i.zIndex+100),borderRadius:"3px",maxWidth:"250px",wordWrap:"break-word",boxShadow:"0 2px 10px rgba(0,0,0,0.3)"});const m=document.createElement("div"),f=document.createElement("span");if(f.className="toast-emergency-message",i.disableInlineStyles||(f.style.display="inline-block"),t.allowHtml)try{const p=sanitizeHtml(String(t.message||"Emergency Toast Showing!")),v=document.createElement("div");for(v.innerHTML=p;v.firstChild;)f.appendChild(v.firstChild)}catch{f.appendChild(document.createTextNode(String(t.message||"Emergency Toast Showing!")))}else f.textContent=String(t.message||"Emergency Toast Creation Showing!");m.appendChild(f);const y=document.createElement("button");for(y.type="button",y.className="toast-emergency-close",y.setAttribute("aria-label","Close emergency notification"),i.disableInlineStyles||Object.assign(y.style,{float:"right",marginLeft:"10px",fontWeight:"bold",cursor:"pointer",background:"transparent",border:"none",color:"inherit",padding:"0",font:"inherit"}),y.textContent="\xD7",m.appendChild(y);r.firstChild;)r.removeChild(r.firstChild);r.appendChild(m);let h=null;const d=()=>{h&&clearTimeout(h),y.removeEventListener("click",d),r.remove(),typeof e=="function"&&e(r)};y.addEventListener("click",d);const b=Number(t==null?void 0:t.duration)||2500;return h=setTimeout(()=>{y.removeEventListener("click",d),r.remove(),typeof e=="function"&&e(r)},b),typeof(h==null?void 0:h.unref)=="function"&&h.unref(),r}catch(i){return console.error("Emergency toast creation failed:",i),typeof e=="function"&&e(null),null}}async function createToastElement(t,e){let i;const s="toast";try{return i=await createElementWithId("div",s),await applyRichStyling(i,t,e),i}catch(n){return console.warn("toast creation failed with error showing fallback one: ",n),i=await createEmergencyToast(t,e),i}}const containerRegistry=new Map,containerLocks=new Map;function normalizePositionKey(t){if(!t||typeof t!="string")return"bottom-right";const e=t.toLowerCase().trim();if(!e)return"bottom-right";const r=e.replace(/\bbelow\b/g,"bottom").replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"-").replace(/-{2,}/g,"-");return{"center-top":"top-center","center-bottom":"bottom-center","center-left":"left-center","center-right":"right-center",top:"top-center",bottom:"bottom-center"}[r]||r}function getContainerId(t){return`toast-container-${normalizePositionKey(t)}`}function resetContainerRegistry(){if(containerRegistry.clear(),containerLocks.clear(),typeof document<"u"){const t=document.querySelector("#toast-shadow-host");if(t)try{t.remove()}catch{}}}function unregisterContainer(t){if(!t)return;const e=typeof t=="string"&&t.startsWith("toast-container-")?t:getContainerId(t);containerRegistry.delete(e),containerLocks.delete(e)}function getContainerRoot(){return getToastRoot()}function findContainerById(t,e){return t?typeof t.getElementById=="function"?t.getElementById(e):typeof t.querySelector=="function"?t.querySelector(`#${e}`):null:null}function isConnectedToRoot(t,e){return!t||!e?!1:e===document.body?t.isConnected&&t.ownerDocument===document:typeof e.contains=="function"?e.contains(t):t.isConnected&&t.ownerDocument===document}function applyContainerBaseStyles(t){const e=getConfig();t.className="toast-container-base",!e.disableInlineStyles&&(t.style.position="fixed",t.style.zIndex=String(e.zIndex),t.style.pointerEvents="none",t.style.inset="auto 10px 10px auto",t.style.display="flex",t.style.justifyContent="space-between",t.style.alignItems="center",t.style.flexDirection="column",t.style.overflow="hidden")}async function getOrCreateToastContainer(t={},e){const i=getConfig(),r=getContainerId((t==null?void 0:t.position)||i.defaultPosition);let s=getContainerRoot();if(!s)throw new Error("Toast container root is unavailable");if(!!((t==null?void 0:t.shadowDom)??i.shadowDom)&&typeof document<"u"&&typeof document.createElement=="function"){let o=null;try{o=s.querySelector?s.querySelector("#toast-shadow-host"):null}catch{}if(o||(o=document.createElement("div"),o.id="toast-shadow-host",o.style.position="fixed",o.style.zIndex=String(i.zIndex||9999),o.style.pointerEvents="none",o.style.inset="0",o.style.overflow="visible",s.appendChild(o)),!o.shadowRoot&&typeof o.attachShadow=="function")try{o.attachShadow({mode:"open"})}catch{}if(o.shadowRoot&&(s=o.shadowRoot,!s.querySelector("style[data-toast-shadow-style]"))){const u=document.createElement("style");u.setAttribute("data-toast-shadow-style","true"),u.textContent=`
54
+ :host { position: fixed; inset: 0; pointer-events: none; z-index: ${i.zIndex||9999}; }
55
+ * { box-sizing: border-box; }
56
+ .toast-container-base {
57
+ position: fixed;
58
+ z-index: ${i.zIndex||9999};
59
+ pointer-events: none;
60
+ display: flex;
61
+ justify-content: space-between;
62
+ align-items: center;
63
+ flex-direction: column;
64
+ overflow: hidden;
65
+ inset: auto 10px 10px auto;
66
+ contain: layout style;
67
+ }
68
+ [data-stacked="true"] .toast-outer-wrapper {
69
+ transition: transform 240ms cubic-bezier(0.16, 1, 0.3, 1), margin 240ms cubic-bezier(0.16, 1, 0.3, 1), opacity 240ms ease;
70
+ }
71
+ [data-stacked="true"] .toast-outer-wrapper[data-stacked-depth="expanded"] {
72
+ transform: none;
73
+ margin-top: 0px;
74
+ margin-bottom: 10px;
75
+ opacity: 1;
76
+ pointer-events: auto;
77
+ }
78
+ [data-stacked="true"] .toast-outer-wrapper[data-stacked-depth="0"] {
79
+ transform: scale(1);
80
+ margin-top: 0px;
81
+ margin-bottom: 0px;
82
+ opacity: 1;
83
+ z-index: 30;
84
+ pointer-events: auto;
85
+ }
86
+ [data-stacked="true"] .toast-outer-wrapper[data-stacked-depth="1"] {
87
+ transform: scale(0.95) translateY(-10px);
88
+ margin-top: -55px;
89
+ margin-bottom: 0px;
90
+ opacity: 0.9;
91
+ z-index: 20;
92
+ pointer-events: auto;
93
+ }
94
+ [data-stacked="true"][id*="top"] .toast-outer-wrapper[data-stacked-depth="1"] {
95
+ transform: scale(0.95) translateY(10px);
96
+ }
97
+ [data-stacked="true"] .toast-outer-wrapper[data-stacked-depth="2"] {
98
+ transform: scale(0.90) translateY(-20px);
99
+ margin-top: -55px;
100
+ margin-bottom: 0px;
101
+ opacity: 0.75;
102
+ z-index: 10;
103
+ pointer-events: auto;
104
+ }
105
+ [data-stacked="true"][id*="top"] .toast-outer-wrapper[data-stacked-depth="2"] {
106
+ transform: scale(0.90) translateY(20px);
107
+ }
108
+ [data-stacked="true"] .toast-outer-wrapper[data-stacked-depth="overflow"] {
109
+ transform: scale(0.85) translateY(-30px);
110
+ margin-top: -55px;
111
+ margin-bottom: 0px;
112
+ opacity: 0;
113
+ z-index: 1;
114
+ pointer-events: none;
115
+ }
116
+ `,s.appendChild(u)}}if(containerLocks.has(r))return containerLocks.get(r);const a=(async()=>{const o=containerRegistry.get(r);if(isConnectedToRoot(o,s))return o;o&&containerRegistry.delete(r);let u=findContainerById(s,r);if(u)applyContainerBaseStyles(u),typeof e=="function"&&await e(u,t);else{const l=(s==null?void 0:s.ownerDocument)||(typeof document<"u"?document:null);if(!l)throw new Error("Document is unavailable");u=l.createElement("div"),u.id=r,u.setAttribute("role","status"),u.setAttribute("aria-atomic","true"),applyContainerBaseStyles(u),typeof e=="function"&&await e(u,t),s.appendChild(u)}if(typeof s.querySelectorAll=="function"){const l=s.querySelectorAll(`#${r}`);if(l.length>1)for(let c=1;c<l.length;c++)try{l[c].remove()}catch{}}return containerRegistry.set(r,u),u})();containerLocks.set(r,a);try{return await a}finally{containerLocks.delete(r)}}const DOCUMENTED_POSITIONS=new Set(["top-left","top-right","bottom-left","bottom-right","top-center","bottom-center","center-top","center-bottom","left-center","right-center","center-left","center-right","top-full-width","bottom-full-width","center"]),LEGACY_POSITIONS=new Set(["top","bottom"]),ALL_POSITIONS=[...DOCUMENTED_POSITIONS,...LEGACY_POSITIONS];function isDocumentedPosition(t){return DOCUMENTED_POSITIONS.has(t)}function resetPositionClasses(t){if(t!=null&&t.classList)for(let e=0;e<ALL_POSITIONS.length;e++)t.classList.remove("toast-position-"+ALL_POSITIONS[e])}async function setPosition(t,e={}){var i;if(!t||!e||typeof e!="object")throw new Error("Invalid container or position!");const r=getConfig(),s=String((e==null?void 0:e.position)||r.defaultPosition||"bottom-right").toLowerCase().trim().replace(/\s+/g,"-");let n=s;if(!isDocumentedPosition(s)&&!LEGACY_POSITIONS.has(s)&&(console.warn(`Unknown position "${e.position}", defaulting to "bottom-right"`),n="bottom-right"),resetPositionClasses(t),(i=t.classList)==null||i.add("toast-position-"+n),getConfig().disableInlineStyles)return;resetContainerStyles(t);const a=parsePosition(n);handleFullWidthPositions(t,a)||handleCenterPositions(t,a)||applyStandardPositioning(t,a)}function resetContainerStyles(t){t.style.top="auto",t.style.bottom="auto",t.style.left="auto",t.style.right="auto",t.style.transform="none",t.style.maxWidth="none"}function parsePosition(t){const e=t.toLowerCase().trim(),i=e==="top-full-width"||e==="bottom-full-width",r=e.startsWith("top")||e.endsWith("top"),s=e.startsWith("bottom")||e.endsWith("bottom")||e.includes("below"),n=e.startsWith("left")||e.endsWith("left"),a=e.startsWith("right")||e.endsWith("right"),o=e.includes("center");return{hasTop:r,hasBottom:s,hasLeft:n,hasRight:a,hasCenter:o,hasFullWidth:i}}function handleFullWidthPositions(t,e){return e.hasFullWidth?(t.style.maxWidth="100vw",e.hasTop?(t.style.top="10px",t.style.left="10px",t.style.right="10px",!0):e.hasBottom?(t.style.bottom="10px",t.style.left="10px",t.style.right="10px",!0):!1):!1}function handleCenterPositions(t,e){return e.hasCenter?e.hasTop&&!e.hasLeft&&!e.hasRight?(t.style.top="10px",t.style.left="50%",t.style.transform="translateX(-50%)",!0):e.hasBottom&&!e.hasLeft&&!e.hasRight?(t.style.bottom="10px",t.style.left="50%",t.style.transform="translateX(-50%)",!0):e.hasLeft&&!e.hasTop&&!e.hasBottom?(t.style.left="10px",t.style.top="50%",t.style.transform="translateY(-50%)",!0):e.hasRight&&!e.hasTop&&!e.hasBottom?(t.style.right="10px",t.style.top="50%",t.style.transform="translateY(-50%)",!0):!e.hasLeft&&!e.hasRight&&!e.hasTop&&!e.hasBottom?(t.style.top="50%",t.style.left="50%",t.style.transform="translate(-50%, -50%)",!0):!1:!1}function applyStandardPositioning(t,e){e.hasBottom?t.style.bottom="10px":e.hasTop?t.style.top="10px":t.style.bottom="10px",e.hasRight?t.style.right="10px":e.hasLeft?t.style.left="10px":(t.style.left="50%",t.style.transform="translateX(-50%)")}class PausableTimer{constructor(e,i){this.callback=typeof e=="function"?e:()=>{};const r=i===1/0,s=Number.isFinite(i)&&i>=0?i:r?1/0:0;this.delay=s,this.remaining=s,this.startTime=null,this.timeoutId=null,this.isPaused=!1,this.isCompleted=!1,this.isInfinite=r}start(){var e;return this.isCompleted||this.timeoutId||this.isInfinite?this:(this.isPaused=!1,this.startTime=Date.now(),this.timeoutId=setTimeout(()=>{this.isCompleted=!0,this.timeoutId=null;try{this.callback()}catch(i){console.error("PausableTimer callback error:",i)}},this.remaining),typeof((e=this.timeoutId)==null?void 0:e.unref)=="function"&&this.timeoutId.unref(),this)}pause(){if(this.isPaused||!this.timeoutId||this.isCompleted)return this;clearTimeout(this.timeoutId),this.timeoutId=null;const e=Math.max(0,Date.now()-this.startTime);return this.remaining=Math.min(this.delay,Math.max(0,this.remaining-e)),this.isPaused=!0,this}resume(){return!this.isPaused||this.isCompleted?this:(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 active=new Map,pending=new Map,queue=[];let visibleCount=0,droppedCount=0;function getToastMetrics(){return{activeCount:active.size,queueDepth:queue.length,visibleCount,droppedCount,timestamp:Date.now()}}function emitMetrics(){const t=getConfig();if(typeof t.onMetrics=="function")try{t.onMetrics(getToastMetrics())}catch(e){console.error("onMetrics callback error:",e)}}function getItemPriority(t){var e,i,r,s,n,a;if(typeof((e=t==null?void 0:t.options)==null?void 0:e.priority)=="number"&&Number.isFinite(t.options.priority))return t.options.priority;const o=(i=t==null?void 0:t.priority)==null?void 0:i.score;if(typeof o=="number"&&Number.isFinite(o))return o;const u=getConfig();if(typeof u.priorityScorer=="function")try{const c=u.priorityScorer({type:((r=t==null?void 0:t.options)==null?void 0:r.type)||"info",message:((s=t==null?void 0:t.options)==null?void 0:s.message)||"",duration:(n=t==null?void 0:t.options)==null?void 0:n.duration,options:t==null?void 0:t.options});if(typeof c=="number"&&Number.isFinite(c))return c;if(c&&typeof c.score=="number"&&Number.isFinite(c.score))return c.score}catch(c){console.warn("[Toast] Custom priorityScorer error, falling back to built-in:",c)}return{error:80,warning:60,info:40,success:20}[(a=t==null?void 0:t.options)==null?void 0:a.type]||0}function updateStackedLayout(t){if(!t||!t.children||!(t.getAttribute("data-stacked")==="true"))return;if(!t._stackedInitialized&&typeof t.addEventListener=="function"){t._stackedInitialized=!0;const a=()=>{t._isExpanded=!0,updateStackedLayout(t)},o=()=>{t._isExpanded=!1,updateStackedLayout(t)},u=()=>{t._isExpanded=!0,updateStackedLayout(t)},l=c=>{t.contains(c.relatedTarget)||(t._isExpanded=!1,updateStackedLayout(t))};t.addEventListener("mouseenter",a),t.addEventListener("mouseleave",o),t.addEventListener("focusin",u),t.addEventListener("focusout",l),t._stackedCleanup=()=>{t.removeEventListener("mouseenter",a),t.removeEventListener("mouseleave",o),t.removeEventListener("focusin",u),t.removeEventListener("focusout",l),t._stackedInitialized=!1}}if(!t.children||t.children.length===0)return;const i=Array.from(t.children),r=i.length,s=!!t._isExpanded,n=!!(t.id&&t.id.includes("top"));i.forEach((a,o)=>{const u=r-1-o,l=s?"expanded":u>=3?"overflow":String(u);if(typeof a.setAttribute=="function"&&a.setAttribute("data-stacked-depth",l),!getConfig().disableInlineStyles)if(a.style.transition="transform 240ms cubic-bezier(0.16, 1, 0.3, 1), margin 240ms cubic-bezier(0.16, 1, 0.3, 1), opacity 240ms ease",s)a.style.transform="none",a.style.marginTop="0px",a.style.marginBottom="10px",a.style.opacity="1",a.style.zIndex=String(100+o),a.style.pointerEvents="auto";else if(u===0)a.style.transform="scale(1)",a.style.marginTop="0px",a.style.marginBottom="0px",a.style.opacity="1",a.style.zIndex="30",a.style.pointerEvents="auto";else if(u===1){const c=n?10:-10;a.style.transform=`scale(0.95) translateY(${c}px)`,a.style.marginTop="-55px",a.style.marginBottom="0px",a.style.opacity="0.9",a.style.zIndex="20",a.style.pointerEvents="auto"}else if(u===2){const c=n?20:-20;a.style.transform=`scale(0.90) translateY(${c}px)`,a.style.marginTop="-55px",a.style.marginBottom="0px",a.style.opacity="0.75",a.style.zIndex="10",a.style.pointerEvents="auto"}else{const c=n?30:-30;a.style.transform=`scale(0.85) translateY(${c}px)`,a.style.marginTop="-55px",a.style.marginBottom="0px",a.style.opacity="0",a.style.zIndex="1",a.style.pointerEvents="none"}})}function hashString(t){let e=5381;for(let i=0;i<t.length;i++)e=(e<<5)+e+t.charCodeAt(i);return e>>>0}function makeKey(t={}){const e=t&&typeof t=="object"?t:{};if(e.id!==void 0&&e.id!==null&&e.id!=="")return String(e.id);if(e.tag!==void 0&&e.tag!==null&&e.tag!==""){const n=normalizePositionKey(e.position||"bottom-right");return`tag:${String(e.tag).trim()}:${n}`}if(e.groupId!==void 0&&e.groupId!==null&&e.groupId!==""){const n=normalizePositionKey(e.position||"bottom-right");return`group:${String(e.groupId).trim()}:${n}`}const i=String(e.type||"info").trim().toLowerCase(),r=hashString(String(e.message||"")).toString(16),s=normalizePositionKey(e.position||"bottom-right");return`${i}|${r}|${s}`}async function showToast(t={}){var e,i;try{const r=makeKey(t);if(active.has(r)){const n=active.get(r);if(!n)throw new Error(`Active toast with key ${r} not found`);return n.count++,(t.tag||t.groupId)&&t.message&&((e=n.toast)!=null&&e._messageSpan)&&(n.toast._messageSpan.textContent=String(t.message),n.toast._messageSpan.title=String(t.message)),(i=n.timer)==null||i.clear(),n.timer=createDismissTimer(n.toast,t),await setupPauseOnHover(n),await updateBadge(n),emitMetrics(),r}if(pending.has(r)){const n=pending.get(r);if(!n)throw new Error(`Pending toast with key ${r} not found`);return n.count++,(t.tag||t.groupId)&&t.message&&(n.options={...n.options,...t}),r}const s={options:t,count:1,rafId:0};return pending.set(r,s),s.rafId=requestAnimationFrame(async()=>{var n,a;const o=pending.get(r);if(o){if(pending.delete(r),visibleCount>=getConfig().maxVisible){const u={options:o.options,key:r,count:o.count},l=getConfig().maxQueueSize??100;if(l<=0){droppedCount++,emitMetrics();return}const c=queue.find(f=>f.key===r);if(c){c.count+=o.count,typeof((n=o.options)==null?void 0:n.priority)=="number"&&(c.options={...c.options,...o.options},c.priority={score:getItemPriority(c)}),emitMetrics();return}const m=typeof((a=o.options)==null?void 0:a.priority)=="number"||typeof getConfig().priorityScorer=="function"||queue.some(f=>{var y;return typeof((y=f==null?void 0:f.options)==null?void 0:y.priority)=="number"});if(m&&(u.priority={score:getItemPriority(u)}),queue.length>=l){if(m){const f=getItemPriority(u);let y=0,h=getItemPriority(queue[0]);for(let d=1;d<queue.length;d++){const b=getItemPriority(queue[d]);b<h&&(y=d,h=b)}if(f<=h){droppedCount++,emitMetrics();return}queue.splice(y,1)}else queue.shift();droppedCount++}queue.push(u),m&&queue.sort((f,y)=>getItemPriority(y)-getItemPriority(f)),emitMetrics(),await drainQueue();return}try{await createOne(o.options,r,o.count)}catch(u){console.error("showToast failed:",u)}}}),r}catch(r){console.error("showToast failed:",r)}}async function createOne(t,e,i){try{if(!t||typeof t!="object")throw new TypeError("options must be an object");visibleCount++;const r=await getOrCreateToastContainer(t,setPosition);if(!r)throw new Error("Failed to create toast container");const s=await createToastElement(t,closeToast);if(!s)throw new Error("Toast element creation failed");const n=document.createElement("div");n.className="toast-outer-wrapper",getConfig().disableInlineStyles||Object.assign(n.style,{position:"relative",display:"inline-block",overflow:"visible",marginBottom:"10px",zIndex:"0",width:"100%",pointerEvents:"auto"});const a=document.createElement("div");a.className="toast-inner-wrapper",getConfig().disableInlineStyles||Object.assign(a.style,{position:"relative",overflow:"hidden",zIndex:"1"}),a.appendChild(s),n.appendChild(a),r.id.includes("toast-container-")&&(r.appendChild(n),t.stacked&&r.setAttribute("data-stacked","true"),r.getAttribute("data-stacked")==="true"&&updateStackedLayout(r)),runToastAnimation(s);const o=t.pauseOnHover!==!1&&(t.pauseOnHover===!0||!!t.cta||!!getConfig().pauseOnHover),u={outer:n,toast:s,options:t,count:Math.max(1,Math.floor(i??0)),pauseOnHover:o};active.set(e,u),s._key=e,emitMetrics(),u.count>1&&await updateBadge(u),u.timer=createDismissTimer(s,t),await setupPauseOnHover(u)}catch(r){console.error("Something went wrong: ",r),visibleCount=Math.max(0,visibleCount-1),emitMetrics(),(document.querySelector('[id^="toast-container-"]')||document.body).appendChild(await createEmergencyToast(t,closeToast))}}async function dismissMostRecent(){try{if(active.size===0){if(pending.size>0){const[r,s]=Array.from(pending.entries()).at(-1);s!=null&&s.rafId&&cancelAnimationFrame(s.rafId),pending.delete(r),emitMetrics();return}if(queue.length>0){queue.pop(),emitMetrics();return}return}let t=null;const e=Array.from(active.values());if(e.length>0){const r=e.at(-1);t=r.toast||r.outer&&r.outer.querySelector('[id^="toast-"]')}if(t||document.querySelectorAll('[id^="toast-container-"]').forEach(s=>{const n=Array.from(s.children||[]);if(n.length===0)return;const a=n.at(-1);a&&(t=a.querySelector('[id^="toast-"]')||a)}),!t)return;const i=t._key?t:t.querySelector('[id^="toast-"]')||t;await closeToast(i)}catch(t){console.error("dismissMostRecent failed:",t)}}async function closeAllToasts(){try{for(const[,e]of pending)e!=null&&e.rafId&&cancelAnimationFrame(e.rafId);pending.clear(),queue.length=0,emitMetrics();const t=Array.from(active.values()).map(e=>e.toast).filter(Boolean);await Promise.allSettled(t.map(async e=>{try{await closeToast(e)}catch(i){console.warn("closeAllToasts: failed to close one toast:",i)}}))}catch(t){console.error("closeAllToasts failed:",t)}}function resetToastManager(){var t,e,i,r,s,n,a,o,u,l,c,m,f,y,h,d,b;for(const[,p]of pending)p!=null&&p.rafId&&cancelAnimationFrame(p.rafId);pending.clear(),queue.length=0;for(const[,p]of active){if((t=p.timer)==null||t.clear(),(i=(e=p.outer)==null?void 0:e._pauseCleanup)==null||i.call(e),(s=(r=p.toast)==null?void 0:r._cleanupCloseButton)==null||s.call(r),(a=(n=p.toast)==null?void 0:n._cleanupCTA)==null||a.call(n),(u=(o=p.toast)==null?void 0:o._cleanupUndo)==null||u.call(o),(c=(l=p.toast)==null?void 0:l._cleanupSwipe)==null||c.call(l),(f=(m=p.toast)==null?void 0:m._cleanupFocusTrap)==null||f.call(m),(h=(y=p.toast)==null?void 0:y._cleanup)==null||h.call(y),(d=p.toast)!=null&&d._progressAnimation){try{p.toast._progressAnimation.cancel()}catch{}p.toast._progressAnimation=null}const v=(b=p.outer)==null?void 0:b.querySelector(".toast-count-badge");v!=null&&v._scaleTimer&&(clearTimeout(v._scaleTimer),v._scaleTimer=null)}typeof document<"u"&&document.querySelectorAll('[id^="toast-container-"]').forEach(v=>{var k;try{(k=v._stackedCleanup)==null||k.call(v)}catch{}}),active.clear(),visibleCount=0,droppedCount=0,isDraining=!1,emitMetrics()}const dismiss=dismissMostRecent,noop=closeAllToasts;function createDismissTimer(t,e){const i=Number(e==null?void 0:e.duration);if((e==null?void 0:e.duration)===1/0||typeof(e==null?void 0:e.duration)=="number"&&(e==null?void 0:e.duration)<=0)return null;const s=(Number.isFinite(i)&&i>0?i:2500)+5,n=new PausableTimer(()=>{closeToast(t).catch(console.error)},s);return n.start(),n}async function setupPauseOnHover(t){var e,i;if(!t.pauseOnHover||!t.outer||!t.timer)return;(i=(e=t.outer)._pauseCleanup)==null||i.call(e);const{outer:r,timer:s,toast:n}=t,a=()=>{if(n!=null&&n._progressAnimation)try{n._progressAnimation.pause()}catch{}else if(n!=null&&n._progressBar)try{if(n._progressBar._isIndeterminate)n._progressBar.style.animationPlayState="paused";else if(!n._progressBar._isManualProgress){const f=window.getComputedStyle(n._progressBar).width;n._progressBar._pausedWidth=f,n._progressBar.style.transition="none",n._progressBar.style.width=f}}catch{}},o=()=>{var f;if(n!=null&&n._progressAnimation)try{n._progressAnimation.play()}catch{}else if(n!=null&&n._progressBar)try{if(n._progressBar._isIndeterminate)n._progressBar.style.animationPlayState="running";else if(!n._progressBar._isManualProgress){if(n._progressBar._pausedWidth){const y=((f=s.getRemainingTime)==null?void 0:f.call(s))??1e3,h=n._progressBar._isReverse,d=n._progressBar._finalWidth||"100%";n._progressBar.style.transition=`width ${Math.max(0,y)}ms linear`,n._progressBar.style.width=h?d:"0%",n._progressBar._pausedWidth=null}}}catch{}},u=()=>{var f;s.pause(),a(),(f=n==null?void 0:n._pauseUndo)==null||f.call(n),n==null||n.classList.add("toast-paused")},l=()=>{var f;s.resume(),o(),(f=n==null?void 0:n._resumeUndo)==null||f.call(n),n==null||n.classList.remove("toast-paused")},c=f=>{var y;f!=null&&f.target&&typeof f.target.matches=="function"&&f.target.matches("[tabindex], div, span, button, a")&&(s.pause(),a(),(y=n==null?void 0:n._pauseUndo)==null||y.call(n),n==null||n.classList.add("toast-paused"))},m=f=>{var y;r.contains(f.relatedTarget)||(s.resume(),o(),(y=n==null?void 0:n._resumeUndo)==null||y.call(n),n==null||n.classList.remove("toast-paused"))};r.addEventListener("mouseenter",u),r.addEventListener("mouseleave",l),r.addEventListener("focusin",c),r.addEventListener("focusout",m),r._pauseCleanup=()=>{r.removeEventListener("mouseenter",u),r.removeEventListener("mouseleave",l),r.removeEventListener("focusin",c),r.removeEventListener("focusout",m)}}async function closeToast(t){if(t!=null&&t._key)return closeToastByKey(t._key)}async function closeToastByKey(t){var e,i,r,s,n,a,o,u,l,c,m,f,y,h,d,b,p,v,k,x,I,g,w,S,T,E,M,D;try{if(!t)return;const _=active.get(t),N=pending.get(t);if(N){cancelAnimationFrame(N.rafId),pending.delete(t),emitMetrics();return}const L=queue.findIndex(B=>B.key===t);if(L!==-1){queue.splice(L,1),emitMetrics();return}if(!_)return;if((e=_.timer)==null||e.clear(),(r=(i=_.outer)==null?void 0:i._pauseCleanup)==null||r.call(i),(n=(s=_.toast)==null?void 0:s._cleanupCloseButton)==null||n.call(s),(o=(a=_.toast)==null?void 0:a._cleanupCTA)==null||o.call(a),(l=(u=_.toast)==null?void 0:u._cleanupUndo)==null||l.call(u),(m=(c=_.toast)==null?void 0:c._cleanupSwipe)==null||m.call(c),(y=(f=_.toast)==null?void 0:f._cleanupFocusTrap)==null||y.call(f),(d=(h=_.toast)==null?void 0:h._cleanup)==null||d.call(h),(b=_.toast)!=null&&b._progressAnimation){try{_.toast._progressAnimation.cancel()}catch{}_.toast._progressAnimation=null}const A=(p=_.outer)==null?void 0:p.querySelector(".toast-count-badge");A!=null&&A._scaleTimer&&(clearTimeout(A._scaleTimer),A._scaleTimer=null);const C=(v=_.toast)==null?void 0:v.querySelector("button, a");(k=C==null?void 0:C._cleanup)==null||k.call(C),active.delete(t),visibleCount=Math.max(0,visibleCount-1),emitMetrics(),A&&A.remove();const W=((x=_.toast)==null?void 0:x._animationDuration)??400,R=Math.min(W,300);if(_.toast){if(!getConfig().disableInlineStyles){const B=String(((I=_.options)==null?void 0:I.position)||((w=(g=_.outer)==null?void 0:g.parentElement)==null?void 0:w.id)||"").toLowerCase(),F=B.includes("top"),j=B.includes("left"),z=B.includes("right"),$=String(((S=_.options)==null?void 0:S.animationType)||"").toLowerCase().trim();let H="translateY(20px)";shouldReduceMotion()?(_.toast.style.transition="none",_.toast.style.opacity="0"):($==="fade"?H="none":$==="zoom"||$==="scale"?H="scale(0.75)":$==="flip"?H="perspective(600px) rotateX(-45deg)":$==="slide"?H=j?"translateX(-100%)":z?"translateX(100%)":F?"translateY(-100%)":"translateY(100%)":$==="bounce"?H=F?"translateY(-36px) scale(0.9)":"translateY(36px) scale(0.9)":((T=_.options)!=null&&T.spring||$==="spring")&&(H=F?"translateY(-28px) scale(0.94)":"translateY(28px) scale(0.94)"),_.toast.style.transition=`opacity ${R}ms ease-in, transform ${R}ms ease-in`,_.toast.style.opacity="0",_.toast.style.transform=H)}_.toast.classList.remove("active")}const P=(E=_.outer)==null?void 0:E.parentElement;if(await removeWithTransition(_.outer,_.toast,R),P&&P.children.length===0&&((M=P.id)!=null&&M.startsWith("toast-container-")))try{(D=P._stackedCleanup)==null||D.call(P),unregisterContainer(P.id),P.remove()}catch{}else P&&P.getAttribute("data-stacked")==="true"&&updateStackedLayout(P);await drainQueue()}catch(_){console.error("Closing Toast failed!: ",_)}}let isDraining=!1;async function drainQueue(){var t,e;if(!isDraining){isDraining=!0;try{const i=getConfig();for((i.priorityQueue||typeof i.priorityScorer=="function"||queue.some(r=>{var s,n;return((s=r.options)==null?void 0:s.priorityQueue)||typeof((n=r.options)==null?void 0:n.priority)=="number"}))&&queue.length>1&&queue.sort((r,s)=>getItemPriority(s)-getItemPriority(r));visibleCount<i.maxVisible&&queue.length;){const r=queue.shift();if(active.has(r.key)){const s=active.get(r.key);s.count+=r.count,(r.options.tag||r.options.groupId)&&r.options.message&&((t=s.toast)!=null&&t._messageSpan)&&(s.toast._messageSpan.textContent=String(r.options.message),s.toast._messageSpan.title=String(r.options.message),(e=s.timer)==null||e.clear(),s.timer=createDismissTimer(s.toast,r.options)),await updateBadge(s),emitMetrics();continue}await createOne(r.options,r.key,r.count)}emitMetrics()}finally{isDraining=!1}}}async function removeWithTransition(t,e,i=400){return t?new Promise(r=>{let s=!1,n=null;const a=e||t.firstElementChild||t,o=()=>{var c;if(!s){s=!0,n&&(clearTimeout(n),n=null);try{(c=a==null?void 0:a.removeEventListener)==null||c.call(a,"transitionend",u,!0)}catch{}removeElement(t).catch(console.error),r()}};if(shouldReduceMotion()||i<=0){o();return}const u=c=>{try{if(c.target!==a)return;(c.propertyName==="transform"||(!a.style.transform||a.style.transform==="none"||a.style.transform==="initial")&&c.propertyName==="opacity")&&o()}catch(m){console.error("removeWithTransition error:",m)}};if(!a)return o();try{a.addEventListener("transitionend",u,!0)}catch(c){console.error("removeWithTransition error:",c)}const l=i+100;n=setTimeout(o,l),typeof(n==null?void 0:n.unref)=="function"&&n.unref()}):Promise.resolve()}async function updateBadge({outer:t,count:e}){var i;if(!t||!(t instanceof HTMLElement))throw new Error("updateBadge: outer must be a valid HTMLElement");if(e<2){const s=t.querySelector(".toast-count-badge");s&&s.remove();return}let r=t.querySelector(".toast-count-badge");r||(r=document.createElement("span"),r.className="toast-count-badge",r.setAttribute("aria-label",`${e} identical notifications`),getConfig().disableInlineStyles||Object.assign(r.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(r)),r.textContent=e>99?"99+":String(e);try{shouldReduceMotion()||(r._scaleTimer&&clearTimeout(r._scaleTimer),r.style.transform="scale(1.2)",r._scaleTimer=setTimeout(()=>{r.style.transform="scale(1)",r._scaleTimer=null},150),typeof((i=r._scaleTimer)==null?void 0:i.unref)=="function"&&r._scaleTimer.unref())}catch(s){console.error("updateBadge animation error:",s)}}async function updateToastByKey(t,e={}){var i,r,s,n;if(!t||typeof e!="object"||e===null)return;if(pending.has(t)){const d=pending.get(t);d.options={...d.options,...e};return}const a=queue.find(d=>d.key===t);if(a){a.options={...a.options,...e};return}const o=active.get(t);if(!o||!o.toast)return;const u={...o.options};o.options={...o.options,...e};const l=o.toast,c=l._messageSpan||l.querySelector(".toast-message")||l.querySelector("span:not(.toast-count-badge)");if(e.message!==void 0){const d=String(e.message??""),b=e.allowHtml!==void 0?!!e.allowHtml:!!o.options.allowHtml,p=(e.type==="success"||e.type==="error"||e.type==="warning"||e.type==="info")&&e.showLoader!==!0;if(c){const v=c.querySelector(".toast-loader");if(c.innerHTML="",v&&e.showLoader!==!1&&e.loader!==null&&!p){c.appendChild(v);const k=document.createElement("span");k.style.display="inline-block",k.style.width="8px",c.appendChild(k)}if(b&&d.trim().length>0)try{const k=sanitizeHtml(d),x=document.createElement("div");for(x.innerHTML=k;x.firstChild;)c.appendChild(x.firstChild)}catch{c.appendChild(document.createTextNode(d))}else c.appendChild(document.createTextNode(d));c.setAttribute("title",c.textContent||"")}}const m=(e.type==="success"||e.type==="error"||e.type==="warning"||e.type==="info")&&e.showLoader!==!0;if(e.showLoader===!1||e.loader===null||m){const d=c==null?void 0:c.querySelector(".toast-loader");d&&(d.nextSibling&&d.nextSibling.nodeName==="SPAN"&&d.nextSibling.remove(),d.remove())}else if((e.showLoader===!0||e.loader&&typeof e.loader=="object")&&c&&!c.querySelector(".toast-loader")){const d=createLoader(e.loader||{});c.insertBefore(d,c.firstChild);const b=document.createElement("span");b.style.display="inline-block",b.style.width="8px",c.insertBefore(b,d.nextSibling)}if(e.type){const d=String(e.type).toLowerCase().trim();l.className=l.className.replace(/\btoast-(info|success|error|warning)\b/g,`toast-${d}`);const b=d==="error";if(e.role?l.setAttribute("role",e.role):l.setAttribute("role","alert"),l.setAttribute("aria-live",e.ariaLive||(b?"assertive":"polite")),!e.backgroundColor){const p={success:"#28a745",error:"#dc3545",warning:"#ffc107",info:"#17a2b8"};p[d]&&(l.style.background=p[d])}}if(e.icon!==void 0||e.type!==void 0){const d=l==null?void 0:l.querySelector(".toast-icon");d&&d.remove();const b={...o.options,...e},p=createToastIcon(b);p&&(c?l.insertBefore(p,c):l.appendChild(p))}if(e.backgroundColor&&(l.style.background=e.backgroundColor),e.textColor)l.style.color=e.textColor,c&&(c.style.color=e.textColor);else if(e.type||e.backgroundColor){const d=l.style.background;if(d){const b=getDynamicAccessibleTextColorHex(d);l.style.color=b,c&&(c.style.color=b)}}if(e.borderRadius!==void 0){const d=typeof e.borderRadius=="number"?`${e.borderRadius}px`:e.borderRadius;l.style.borderRadius=d}if(e.maxWidth!==void 0){const d=typeof e.maxWidth=="number"?`${e.maxWidth}px`:e.maxWidth;l.style.maxWidth=d}if(e.fontDirection!==void 0){const d=e.fontDirection!=="auto"?e.fontDirection:"";l.style.direction=d,c&&(c.style.direction=d);const b=d==="rtl";l.querySelectorAll(".toast-cta, .toast-undo-btn, .toast-close-btn").forEach(p=>{p.style.marginLeft=b?"0px":"10px",p.style.marginRight=b?"10px":"0px"})}if(e.fontSize!==void 0){const d=typeof e.fontSize=="number"?`${e.fontSize}px`:e.fontSize;l.style.fontSize=d,c&&(c.style.fontSize=d)}if(e.fontFamily!==void 0&&(l.style.fontFamily=e.fontFamily,c&&(c.style.fontFamily=e.fontFamily)),e.fontWeight!==void 0){const d=typeof e.fontWeight=="number"?String(e.fontWeight):e.fontWeight;l.style.fontWeight=d,c&&(c.style.fontWeight=d)}if(e.fontLineHeight!==void 0&&(l.style.lineHeight=e.fontLineHeight,c&&(c.style.lineHeight=e.fontLineHeight)),e.fontPadding!==void 0&&c&&(c.style.padding=e.fontPadding),e.wrapText!==void 0&&c&&(e.wrapText==="truncate"||e.wrapText==="ellipsis"||e.wrapText===!1||!e.wrapText?(c.classList.add("is-truncated"),getConfig().disableInlineStyles||Object.assign(c.style,{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:"3",whiteSpace:"normal",overflow:"hidden",textOverflow:"ellipsis"})):(c.classList.remove("is-truncated"),getConfig().disableInlineStyles||Object.assign(c.style,{display:"block",WebkitBoxOrient:"",WebkitLineClamp:"",whiteSpace:"normal",overflow:"visible",textOverflow:"clip"}))),e.role!==void 0&&l.setAttribute("role",e.role),e.ariaLive!==void 0&&l.setAttribute("aria-live",e.ariaLive),e.className!==void 0){const d=u.className;d&&typeof d=="string"&&l.classList.remove(...d.trim().split(/\s+/)),e.className&&typeof e.className=="string"&&l.classList.add(...e.className.trim().split(/\s+/))}let f=l.querySelector(".toast-progress-bar");if(e.showProgressBar===!1){if(l._progressAnimation){try{l._progressAnimation.cancel()}catch{}l._progressAnimation=null}f&&f.remove(),l._progressBar=null,f=null}else!f&&e.showProgressBar!==!1&&(e.progress!==void 0||e.showProgressBar===!0)&&(createProgressBar(l,{...o.options,...e,showProgressBar:!0}),f=l.querySelector(".toast-progress-bar"));if(f){if(e.progress!==void 0)if(e.progress==="indeterminate"){if(f._isIndeterminate=!0,f._isManualProgress=!1,l._progressAnimation){try{l._progressAnimation.cancel()}catch{}l._progressAnimation=null}f.classList.add("toast-progress-bar-indeterminate");const d=f._isRtl||e.fontDirection==="rtl"||e.progressDirection==="rtl";if(d&&f.classList.add("toast-progress-bar-indeterminate-rtl"),!getConfig().disableInlineStyles){ensureProgressIndeterminateStyles();const b=d?"toast-progress-indeterminate-rtl":"toast-progress-indeterminate";f.style.animation=`${b} 1.6s cubic-bezier(0.4, 0, 0.2, 1) infinite`}f.style.width=f._finalWidth||"100%"}else{const d=parseProgressValue(e.progress,l,{...o.options,...e});if(f._isIndeterminate=!1,f._isManualProgress=!0,f.classList.remove("toast-progress-bar-indeterminate"),f.classList.remove("toast-progress-bar-indeterminate-rtl"),f.style.animation="none",l._progressAnimation){try{l._progressAnimation.cancel()}catch{}l._progressAnimation=null}f.style.transition="width 200ms ease",f.style.width=`${d}%`}if((e.progressBarColor||e.progressColor)&&(f.style.background=e.progressBarColor||e.progressColor),e.progressPosition&&(f.style.top=e.progressPosition==="top"?"0":"auto",f.style.bottom=e.progressPosition==="bottom"?"0":"auto"),e.progressHeight!==void 0){const d=typeof e.progressHeight=="number"?`${e.progressHeight}px`:e.progressHeight;f.style.height=d}}if(e.animationType!==void 0&&(o.options.animationType=e.animationType,l._animationType=e.animationType),e.spring!==void 0&&(o.options.spring=e.spring),e.swipeToDismiss!==void 0&&(o.options.swipeToDismiss=e.swipeToDismiss,e.swipeToDismiss===!1?((i=l._cleanupSwipe)==null||i.call(l),l._cleanupSwipe=null):e.swipeToDismiss===!0&&!l._cleanupSwipe&&attachSwipeToDismiss(l,closeToast)),e.duration!==void 0){(r=o.timer)==null||r.clear();const d=Number(e.duration);if(Number.isFinite(d)&&d>0){if(o.timer=createDismissTimer(l,{duration:d}),await setupPauseOnHover(o),f&&!f._isManualProgress&&!f._isIndeterminate){const b=d+5;if(l._progressAnimation){try{l._progressAnimation.cancel()}catch{}const p=f._isReverse,v=f._finalWidth||"100%",k=p?[{width:"0%"},{width:v}]:[{width:v},{width:"0%"}];l._progressAnimation=f.animate(k,{duration:b,easing:"linear",fill:"forwards",delay:0})}else{f.style.transition=`width ${b}ms linear`;const p=f._isReverse,v=f._finalWidth||"100%";f.style.width=p?v:"0%"}}}else if(o.timer=null,f&&!f._isManualProgress&&!f._isIndeterminate){if(l._progressAnimation){try{l._progressAnimation.cancel()}catch{}l._progressAnimation=null}f.style.width="0%"}}else(o.options.duration===0||!o.timer)&&(e.type==="success"||e.type==="error"||e.type==="warning"||e.showLoader===!1)&&(o.options.duration=2500,(s=o.timer)==null||s.clear(),o.timer=createDismissTimer(l,{duration:2500}),await setupPauseOnHover(o));if(e.cta!==void 0&&(l._cleanupCTA&&(l._cleanupCTA(),l._cleanupCTA=null),l.querySelectorAll(".toast-cta").forEach(d=>d.remove()),e.cta&&typeof e.cta=="object")){const d={...o.options,...e};createCTA(l,d,closeToast)}if(e.undo!==void 0&&(l._cleanupUndo&&(l._cleanupUndo(),l._cleanupUndo=null),l.querySelectorAll(".toast-undo-btn").forEach(d=>d.remove()),e.undo)){const d={...o.options,...e};createUndoAction(l,d,closeToast)}if(e.showCloseButton!==void 0){const d=l.querySelector(".toast-close-btn");if(e.showCloseButton===!1)l._cleanupCloseButton&&(l._cleanupCloseButton(),l._cleanupCloseButton=null),d&&d.remove();else if(e.showCloseButton===!0&&!d){const b={...o.options,...e};createCloseButton(l,b,closeToast)}}if(e.sound!==void 0?!!e.sound:!!(e.type&&(o.options.sound||getConfig().sound))){if(typeof e.sound=="string"&&typeof window<"u"&&typeof window.Audio=="function")try{new window.Audio(e.sound).play().catch(()=>{})}catch{}else if(typeof e.onSound=="function")try{e.onSound(e)}catch{}}const h=l.closest('[id^="toast-container-"]');h&&(e.stacked===!0?(h.setAttribute("data-stacked","true"),updateStackedLayout(h)):e.stacked===!1?(h.removeAttribute("data-stacked"),(n=h._stackedCleanup)==null||n.call(h),Array.from(h.children).forEach(d=>{d.removeAttribute("data-stacked-depth"),d.style.transform="",d.style.marginTop="",d.style.marginBottom="10px",d.style.opacity="",d.style.zIndex="",d.style.pointerEvents="auto"})):h.getAttribute("data-stacked")==="true"&&updateStackedLayout(h))}let defaultColors={success:"#28a745",error:"#dc3545",warning:"#ffc107",info:"#17a2b8"};const DEFAULT_TYPE_MESSAGES={success:"Operation completed successfully!",error:"Something went wrong!",warning:"Warning message!",info:"Information message!",loading:"Loading, please wait..."};let customDefaultMessages={},domReady=!1,domReadyPromise=null;async function checkDOMReady(){if(!domReady&&!(typeof window>"u"||typeof document>"u")){if(document.readyState==="complete"||document.readyState==="interactive"){domReady=!0;return}domReadyPromise||(domReadyPromise=new Promise(t=>{document.addEventListener("DOMContentLoaded",()=>{domReady=!0,t()},{once:!0})})),await domReadyPromise}}async function createToastNow(t={}){try{const e=await sanitizeToastOptions(t);return await createFirstToastContainer(e),await showToast(e)}catch(e){return console.error("CreateToast failed:",e),null}}async function createToast(t={}){return typeof window<"u"&&typeof document<"u"?(await checkDOMReady(),await createToastNow(t)):(console.warn("ToastNotification: running in non-browser environment, no DOM available."),null)}async function createFirstToastContainer(t){try{return await getOrCreateToastContainer(t,setPosition)}catch(e){return console.error("Failed to create toast container:",e),getConfig().targetNode||document.body}}function normalizeToastOptions(t,e){const i=typeof e=="object"&&e!==null&&!Array.isArray(e)?e:{};return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"?{...i,message:String(t)}:t instanceof Error?{...i,message:t.message||String(t)}:typeof t=="object"&&t!==null&&!Array.isArray(t)?{...i,...t}:{...i}}async function sanitizeToastOptions(t){var e;const i=normalizeToastOptions(t),r=getConfig(),s=String((i==null?void 0:i.position)??r.defaultPosition).toLowerCase().trim(),n=s!=null&&s.includes("top-full-width")||s!=null&&s.includes("bottom-full-width")?"100vw":"400px",o={...{allowHtml:!1,sanitizeHtml:!0,pauseOnHover:void 0,duration:2500,position:r.defaultPosition,type:"info",borderRadius:"50px",backgroundColor:void 0,textColor:void 0,showCloseButton:!0,animationDuration:"0.4s",animationEasing:"ease",showProgressBar:!0,progressColor:void 0,progressBarColor:void 0,progressHeight:"4px",progressPosition:"bottom",progressDirection:"decreasing",animationType:"default",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:n},...i};o.message=(i==null?void 0:i.message)??o.message;try{if(!o.backgroundColor){const u=typeof window<"u"&&typeof window.matchMedia=="function"&&((e=window.matchMedia("(prefers-color-scheme: dark)"))==null?void 0:e.matches);o.backgroundColor=(defaultColors==null?void 0:defaultColors[o.type])??(u?"#f5f5f5":"#111111")}}catch(u){console.warn("Background color resolution failed:",u),o.backgroundColor||(o.backgroundColor="#111111")}try{o.message=o.message||customDefaultMessages[o.type]||DEFAULT_TYPE_MESSAGES[o.type]||"No Message Provided!"}catch(u){console.warn("Default message resolution failed:",u)}try{!o.textColor&&o.backgroundColor&&(o.textColor=getDynamicAccessibleTextColorHex(o.backgroundColor))}catch(u){console.warn("Text color resolution failed:",u)}try{const u=(i==null?void 0:i.progressBarColor)||(i==null?void 0:i.progressColor);u?(o.progressColor=u,o.progressBarColor=u):!o.progressColor&&o.backgroundColor&&(o.progressColor=o.textColor||getDynamicAccessibleTextColorHex(o.backgroundColor),o.progressBarColor=o.progressColor)}catch(u){console.warn("Progress bar color resolution failed:",u)}return typeof o.message!="string"&&(o.message="No Message Provided!"),o}function setDefaultColors(t){try{if(t&&typeof t=="object"&&!Array.isArray(t)){const e=["success","error","warning","info"],i={};for(const[r,s]of Object.entries(t))e.includes(r)&&typeof s=="string"&&s.trim()&&(i[r]=s.trim());Object.keys(i).length>0&&(defaultColors={...defaultColors,...i})}}catch(e){console.error("setDefaultColors failed:",e)}}function setDefaultMessages(t){try{if(t&&typeof t=="object"&&!Array.isArray(t)){const e=["success","error","warning","info"],i={};for(const[r,s]of Object.entries(t))e.includes(r)&&typeof s=="string"&&s.trim()&&(i[r]=s.trim());Object.keys(i).length>0&&(customDefaultMessages={...customDefaultMessages,...i})}}catch(e){console.error("setDefaultMessages failed:",e)}}let closeInProgress=!1,closePromise=null;async function runWithClosePriority(t){if(closeInProgress&&closePromise)try{await closePromise}catch(e){console.warn("Previous close operation failed (continuing anyway):",e)}return t()}const originalCreateToast=createToast;async function createToastWithPriority(t={},e){const i=normalizeToastOptions(t,e),r=await runWithClosePriority(()=>originalCreateToast(i));return{id:r,dismiss:()=>r?closeToastByKey(r):Promise.resolve(),update:s=>r?updateToastByKey(r,s):Promise.resolve()}}createToastWithPriority.success=(t,e)=>{const i=normalizeToastOptions(t,e);return createToastWithPriority({...i,type:"success"})},createToastWithPriority.error=(t,e)=>{const i=normalizeToastOptions(t,e);return createToastWithPriority({...i,type:"error"})},createToastWithPriority.warning=(t,e)=>{const i=normalizeToastOptions(t,e);return createToastWithPriority({...i,type:"warning"})},createToastWithPriority.info=(t,e)=>{const i=normalizeToastOptions(t,e);return createToastWithPriority({...i,type:"info"})},createToastWithPriority.loading=(t,e)=>{const i=normalizeToastOptions(t,e);return createToastWithPriority({type:"info",showLoader:!0,duration:0,showProgressBar:!1,pauseOnHover:!1,...i})},createToastWithPriority.custom=(t,e)=>{const i=normalizeToastOptions(t,e);return createToastWithPriority({allowHtml:!0,...i})};const success=createToastWithPriority.success,error=createToastWithPriority.error,warning=createToastWithPriority.warning,info=createToastWithPriority.info,loading=createToastWithPriority.loading,custom=createToastWithPriority.custom,dismissToast=async t=>{let e=t;if(t&&typeof t.then=="function")try{e=await t}catch{return}closeInProgress=!0,closePromise=(async()=>{try{typeof e=="string"&&e.length>0?await closeToastByKey(e):e&&typeof e=="object"?typeof e.dismiss=="function"?await e.dismiss():e._key&&typeof e._key=="string"?await closeToastByKey(e._key):e.id&&typeof e.id=="string"?await closeToastByKey(e.id):await dismiss():await dismiss()}finally{closeInProgress=!1,closePromise=null}})(),await closePromise},noopAll=async()=>{closeInProgress=!0,closePromise=(async()=>{try{await noop()}finally{closeInProgress=!1,closePromise=null}})(),await closePromise},clear=noopAll,dismissAll=noopAll,TOAST_PROMISE_LOADING_DURATION_MS=1440*60*1e3;async function toastPromise(t,e={},i={}){const r=e&&typeof e=="object"?e:{},s=i&&typeof i=="object"?i:{},n=r.loading??"Loading...",a=typeof n=="object"&&n!==null&&!Array.isArray(n)?{...s,type:"info",duration:TOAST_PROMISE_LOADING_DURATION_MS,showProgressBar:!1,pauseOnHover:!1,showLoader:s.showLoader??!0,...n}:{...s,type:"info",message:String(n),duration:TOAST_PROMISE_LOADING_DURATION_MS,showProgressBar:!1,pauseOnHover:!1,showLoader:s.showLoader??!0},o=await createToastWithPriority(a),u={...s,pauseOnHover:s.pauseOnHover};try{const c=await(typeof t=="function"?t():t);if(o&&typeof o.dismiss=="function")try{await o.dismiss()}catch{}const m=typeof r.success=="function"?r.success(c):r.success??"Done!",f=typeof m=="object"&&m!==null&&!Array.isArray(m)?{...u,type:"success",...m}:{...u,type:"success",message:String(m)};return await createToastWithPriority(f),c}catch(l){if(o&&typeof o.dismiss=="function")try{await o.dismiss()}catch{}const c=typeof r.error=="function"?r.error(l):r.error??"Something went wrong.",m=typeof c=="object"&&c!==null&&!Array.isArray(c)?{...u,type:"error",...c}:{...u,type:"error",message:String(c)};throw await createToastWithPriority(m),l}}createToastWithPriority.promise=toastPromise,createToastWithPriority.dismiss=dismissToast,createToastWithPriority.dismissAll=noopAll,createToastWithPriority.clear=noopAll;const version="4.0.0";function initKeyboardShortcuts(t=typeof window<"u"?window:null){if(!t||!t.document||t.__customizableToastEscapeAttached)return;t.__customizableToastEscapeAttached=!0;const e=i=>{if(i.key==="Escape"||i.key==="Esc")(async()=>{try{closeInProgress=!0,closePromise=(async()=>{try{await dismiss()}finally{closeInProgress=!1,closePromise=null}})(),await closePromise}catch(r){console.error("Escape key dismiss failed:",r),closeInProgress=!1,closePromise=null}})();else if(i.key==="F6"||(i.altKey||i.metaKey)&&(i.key==="t"||i.key==="T")){const s=(getConfig().targetNode&&typeof getConfig().targetNode.querySelectorAll=="function"?getConfig().targetNode:t.document).querySelectorAll('[id^="toast-container-"] [id^="toast-"]');if(s.length>0){const n=s[s.length-1],a=n.querySelector("button, a, [tabindex='0']");a&&typeof a.focus=="function"?a.focus():typeof n.focus=="function"&&n.focus()}}};t.addEventListener("keydown",e,{passive:!0})}typeof window<"u"&&typeof document<"u"&&initKeyboardShortcuts(window);try{typeof window<"u"&&(window.customizableToast={setConfig,getConfig,resetConfig,shouldReduceMotion,version,createToast:createToastWithPriority,success,error,warning,info,loading,custom,setDefaultColors,setDefaultMessages,noop:noopAll,dismiss:dismissToast,dismissAll:noopAll,clear:noopAll,toastPromise,promise:toastPromise,updateToastByKey,generateToastId,resetToastIdCounter,getToastMetrics,initKeyboardShortcuts})}catch(t){console.error("Global assignment failed:",t)}exports.clear=clear,exports.createToast=createToastWithPriority,exports.custom=custom,exports.default=createToastWithPriority,exports.dismiss=dismissToast,exports.dismissAll=dismissAll,exports.error=error,exports.generateToastId=generateToastId,exports.getConfig=getConfig,exports.getToastMetrics=getToastMetrics,exports.info=info,exports.initKeyboardShortcuts=initKeyboardShortcuts,exports.loading=loading,exports.noop=noopAll,exports.resetConfig=resetConfig,exports.resetContainerRegistry=resetContainerRegistry,exports.resetToastIdCounter=resetToastIdCounter,exports.resetToastManager=resetToastManager,exports.setConfig=setConfig,exports.setDefaultColors=setDefaultColors,exports.setDefaultMessages=setDefaultMessages,exports.shouldReduceMotion=shouldReduceMotion,exports.success=success,exports.toastPromise=toastPromise,exports.updateToastByKey=updateToastByKey,exports.version=version,exports.warning=warning;
16
117
  //# sourceMappingURL=index.cjs.map