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/CHANGELOG.md +22 -0
- package/README.md +56 -132
- package/dist/angular.cjs +117 -0
- package/dist/angular.cjs.map +1 -0
- package/dist/angular.d.ts +44 -0
- package/dist/angular.esm.mjs +117 -0
- package/dist/angular.esm.mjs.map +1 -0
- package/dist/index.cjs +106 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.d.ts +0 -12
- package/dist/index.css.map +2 -2
- package/dist/index.d.ts +28 -630
- package/dist/index.esm.mjs +105 -4
- package/dist/index.esm.mjs.map +1 -1
- package/dist/index.umd.js +105 -4
- package/dist/index.umd.js.map +1 -1
- package/dist/react.cjs +117 -0
- package/dist/react.cjs.map +1 -0
- package/dist/react.d.ts +44 -0
- package/dist/react.esm.mjs +117 -0
- package/dist/react.esm.mjs.map +1 -0
- package/dist/solid.cjs +117 -0
- package/dist/solid.cjs.map +1 -0
- package/dist/solid.d.ts +45 -0
- package/dist/solid.esm.mjs +117 -0
- package/dist/solid.esm.mjs.map +1 -0
- package/dist/svelte.cjs +117 -0
- package/dist/svelte.cjs.map +1 -0
- package/dist/svelte.d.ts +50 -0
- package/dist/svelte.esm.mjs +117 -0
- package/dist/svelte.esm.mjs.map +1 -0
- package/dist/vue.cjs +117 -0
- package/dist/vue.cjs.map +1 -0
- package/dist/vue.d.ts +45 -0
- package/dist/vue.esm.mjs +117 -0
- package/dist/vue.esm.mjs.map +1 -0
- package/package.json +20 -28
package/dist/index.esm.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Customizable Toast Notifications
|
|
3
|
-
* Build: 2026-10-27
|
|
4
|
-
* Cache-Buster:
|
|
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
|
-
function e(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t);if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function t(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,o)}return n}function n(n){for(var o=1;o<arguments.length;o++){var i=null!=arguments[o]?arguments[o]:{};o%2?t(Object(i),!0).forEach(function(t){e(n,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(i)):t(Object(i)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(i,e))})}return n}const o=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}),i=n({},o);function r(e={}){if(!e||"object"!=typeof e||Array.isArray(e))return a();const{maxVisible:t,maxQueueSize:n,zIndex:o,targetNode:r,disableInlineStyles:s,reducedMotion:l,defaultPosition:c,theme:u,stacked:d,swipeToDismiss:p,sound:f,soundPreset:m,icon:h,pauseOnHover:y,syncTabs:g,aiPrioritization:b,shadowDom:v,trapFocus:w,priorityScorer:x,onMetrics:T,debug:A}=e;if(void 0!==v&&(i.shadowDom=Boolean(v)),void 0!==w&&(i.trapFocus=Boolean(w)),void 0!==A&&(i.debug=Boolean(A)),void 0!==t){const e=Number(t);Number.isFinite(e)&&e>0&&(i.maxVisible=Math.max(1,Math.floor(e)))}if(void 0!==n){const e=Number(n);Number.isFinite(e)&&e>=0&&(i.maxQueueSize=Math.floor(e))}if(void 0!==o){const e=Number(o);Number.isFinite(e)&&(i.zIndex=Math.trunc(e))}if(void 0!==r&&(i.targetNode=r&&"object"==typeof r&&"function"==typeof r.appendChild?r:null),void 0!==s&&(i.disableInlineStyles=Boolean(s)),void 0!==l){const e=String(l||"auto").toLowerCase();["auto","always","never"].includes(e)&&(i.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&&(i.defaultPosition=e)}if(void 0!==u){const e=String(u||"light").toLowerCase();["light","dark","high-contrast","compact","spacious","glass"].includes(e)&&(i.theme=e,"undefined"!=typeof document&&document.documentElement.setAttribute("data-toast-theme",e))}if(void 0!==d&&(i.stacked=Boolean(d)),void 0!==p&&(i.swipeToDismiss=Boolean(p)),void 0!==f&&(i.sound=Boolean(f)),void 0!==m){const e=String(m||"modern").toLowerCase().trim();e&&(i.soundPreset=e)}return void 0!==h&&(i.icon=Boolean(h)),void 0!==y&&(i.pauseOnHover=Boolean(y)),void 0!==g&&(i.syncTabs=Boolean(g)),void 0!==b&&(i.aiPrioritization=Boolean(b)),void 0!==x&&(i.priorityScorer="function"==typeof x?x:null),void 0!==T&&(i.onMetrics="function"==typeof T?T:null),a()}function s(){return Object.assign(i,o),"undefined"!=typeof document&&(document.documentElement.removeAttribute("data-toast-theme"),document.documentElement.removeAttribute("data-toast-reduced-motion")),a()}function a(){return n({},i)}function l(){if("always"===i.reducedMotion)return!0;if("never"===i.reducedMotion)return!1;try{return Boolean("undefined"!=typeof window&&"function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches)}catch(e){return!1}}let c=0;const u=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 d(){c=0}function p(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);c=c+1&16777215;const i=c.toString(36);return`${n}-${o}-${u}${i}`}const f=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),m={};function h(e){if(!e)return"#ffffff";const t=String(e),n=f.get(t);if(n)return n;if(m[null==e?void 0:e.toLowerCase()]){const n=m[e.toLowerCase()];return f.set(t,n),n}let o,i,r;try{const t=function(e){const t=null==e?void 0: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=null==e?void 0: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=null==e?void 0: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=null==e?void 0:e.match(/hsla?\(\s*(-?[\d.]+(?:deg|grad|rad|turn)?)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*[\d.%]+)?\s*\)/i),s=!r&&(null==e?void 0: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(e){}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(e){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,u]=((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),d=u<.5?Math.min(u+.5,1):Math.max(u-.5,0),[p,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,d);if(a([o,i,r],[p,h,y])<4.5){const e=a([o,i,r],[0,0,0]),t=a([o,i,r],[255,255,255]);[p,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")}`)(p,h,y);return f.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);m[e.toLowerCase()]=s>=a?"#000000":"#ffffff"});const y=new Set(["DIV","SPAN","P","BR","STRONG","B","EM","I","U","SMALL","UL","OL","LI","A","IMG","PRE","CODE","MARK"]),g=new Set(["href","src","alt","title","class","target","rel","loading"]),b=new Set(["SCRIPT","STYLE","IFRAME","NOSCRIPT","OBJECT","EMBED","SVG","MATH","AUDIO","VIDEO","CANVAS","TEMPLATE"]),v=/^\s*(?:https?:|mailto:|data:image\/(?:png|jpe?g|gif|webp|avif|bmp|ico);|\/(?!\/|\\)|\.\/|\.\.\/|#)/i;function w(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(b.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=w(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(!v.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=w(e,t,n);o&&i.appendChild(o)}),i}function x(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(e){}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=w(e,y,g);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 T(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(e){}return!1}()){const t=window.DOMPurify.sanitize(e,{ALLOWED_TAGS:Array.from(y),ALLOWED_ATTR:Array.from(g),ALLOWED_URI_REGEXP:v}),n=document.createElement("div");return n.innerHTML=t,n.querySelectorAll("a[href]").forEach(e=>{const t=e.getAttribute("href")||"";v.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 x(e)}function A(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,i="string"==typeof t.color&&t.color.trim()?t.color.trim():"currentColor",r=/[\r\n<>"';]/.test(i)||/^\s*javascript:/i.test(i)?"currentColor":i,s="string"==typeof t.text?t.text:"",c=document.createElement("span");c.className="toast-loader",c.setAttribute("role","status"),c.setAttribute("aria-label",s||"Loading");const u=a();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",r),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",l()||(f.style.animation="toast-spinner 1s linear infinite")),p.appendChild(f),c.appendChild(p),s){const e=document.createElement("span");e.className="toast-loader-label",u.disableInlineStyles||(e.style.fontSize="13px"),e.textContent=s,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(e){}return c}const S={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 C="en";const k=new Map;function _(e){if("string"!=typeof e||!e.trim())return C;const t=e.trim().toLowerCase();return(Object.prototype.hasOwnProperty.call(S,t)||k.has(t))&&(C=t),C}function E(){return C}function L(){return[...Object.keys(S),...Array.from(k.keys())]}function M(e,t){if("string"!=typeof e||!e.trim()||"object"!=typeof t||null===t||Array.isArray(t))return;const o=e.trim().toLowerCase(),i=k.get(o)||S[o]||{};k.set(o,n(n({},i),t))}function I(e,t){if("string"!=typeof e)return t;const n=k.get(C);if(n&&"string"==typeof n[e]&&n[e].trim())return n[e];const o=S[C];if(o&&"string"==typeof o[e])return o[e];const i=S.en;return i&&"string"==typeof i[e]?i[e]:t}function N(e=C){const t=String(e||"").toLowerCase().trim();return"ar"===t||"he"===t||"fa"===t||"ur"===t}function B(){C="en",k.clear()}function z(e,t,o){const i=null==t?void 0:t.cta;if(!i||"object"!=typeof i)return;const r=Array.isArray(i)?i.filter(e=>e&&"object"==typeof e):[i];if(0===r.length)return;const s=[];r.forEach((i,l)=>{if(!i||"object"!=typeof i)return;const c=n({},i);c.label||(c.label=r.length>1?`Action ${l+1}`:"CTA Label Missing!");const u="link"===c.variant||!c.variant&&!!c.href,d=document.createElement(u?"a":"button");if(u){if(c.href){const e=String(c.href).trim(),t=/^(javascript:|vbscript:|data:(?!image\/[a-z0-9.+-]+;base64,))/i.test(e);d.href=t?"#":e}else d.setAttribute("role","button"),d.tabIndex=0;c.target&&(d.target=c.target);const e=new Set((c.rel||"").split(/\s+/).filter(Boolean));"string"==typeof c.target&&"_blank"===c.target.trim().toLowerCase()&&(e.add("noopener"),e.add("noreferrer")),d.rel=Array.from(e).join(" ")}else d.type="button";d.setAttribute("aria-label",c.ariaLabel||c.label);const p=c.textColor||c.color||t.textColor||h(t.backgroundColor),f=c.backgroundColor||c.background||(t.backgroundColor?P(t.backgroundColor):"rgba(255,255,255,0.15)"),m=("string"==typeof p?p.trim():"").match(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/);let y="rgba(128, 128, 128, 0.3)";m&&(y=(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"),d.className="toast-cta";const g="rtl"===t.fontDirection;a().disableInlineStyles||Object.assign(d.style,{marginLeft:g?"0px":0===l?"10px":"6px",marginRight:g?0===l?"10px":"6px":"0px",padding:"6px 10px",borderRadius:"6px",fontSize:"12px",fontWeight:"600",lineHeight:"1",border:`1px solid ${y}`,color:p,background:f,cursor:"pointer",whiteSpace:"nowrap",flexShrink:"0",display:"inline-flex",alignItems:"center",textDecoration:"none",outline:"none"}),d.textContent=c.label;const b=async t=>{if(!d._isExecuting){d._isExecuting=!0;try{if("function"==typeof c.onClick){const e=c.onClick(t);null!=e&&e.then&&await e}}catch(e){console.error("CTA onClick handler error:",e)}finally{d._isExecuting=!1,!1!==c.autoClose&&"function"==typeof o&&await o(e)}}},v=e=>{!u||c.href||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),b(e))};d.addEventListener("click",b),u&&!c.href&&d.addEventListener("keydown",v);const w=()=>{d.removeEventListener("click",b),u&&!c.href&&d.removeEventListener("keydown",v)};d._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(d,x):e.appendChild(d)});const l=e._cleanupCTA;e._cleanupCTA=()=>{null==l||l(),s.forEach(e=>e())}}function O(e,t,o){const i=null==t?void 0:t.undo;if(!i)return;const r="function"==typeof i;if(!r&&("object"!=typeof i||Array.isArray(i)))return;const s=r?{onUndo:i}:n({},i),l="string"==typeof s.label&&s.label.trim()?s.label.trim():I("undo")||"Undo",c=Number(null==t?void 0:t.duration),u=!1!==s.showCountdown&&Number.isFinite(c)&&c>0,d=document.createElement("button");d.type="button",d.className="toast-undo-btn",d.setAttribute("aria-label",`${l} action`);const p=t.textColor||h(t.backgroundColor),f=t.backgroundColor?P(t.backgroundColor):"rgba(255,255,255,0.18)",m=("string"==typeof p?p.trim():"").match(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/);let y="rgba(128, 128, 128, 0.35)";m&&(y=(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 g="rtl"===t.fontDirection;a().disableInlineStyles||Object.assign(d.style,{marginLeft:g?"0px":"10px",marginRight:g?"10px":"0px",padding:"5px 10px",borderRadius:"6px",fontSize:"12px",fontWeight:"700",lineHeight:"1",border:`1px solid ${y}`,color:p,background:f,cursor:"pointer",whiteSpace:"nowrap",flexShrink:"0",display:"inline-flex",alignItems:"center",gap:"4px"});let b=Math.max(1,Math.ceil((c||2500)/1e3));const v=()=>{d.textContent=u?`${l} (${b}s)`:l};v();let w=null,x=!1;var T;u&&(w=setInterval(()=>{x||(b=Math.max(0,b-1),v(),b<=0&&w&&(clearInterval(w),w=null))},1e3),"function"==typeof(null===(T=w)||void 0===T?void 0:T.unref)&&w.unref()),e._pauseUndo=()=>{x=!0},e._resumeUndo=()=>{x=!1};const A=()=>{w&&(clearInterval(w),w=null),e._pauseUndo=null,e._resumeUndo=null},S=async t=>{A(),d.removeEventListener("click",S);try{if("function"==typeof s.onUndo){const n=s.onUndo(t,e);null!=n&&n.then&&await n}}catch(e){console.error("Undo action error:",e)}finally{"function"==typeof o&&await o(e)}};d.addEventListener("click",S),d._cleanup=()=>{A(),d.removeEventListener("click",S)},e._cleanupUndo=()=>{A(),d.removeEventListener("click",S)};const C=e.querySelector(".toast-close-btn")||e.querySelector(".toast-progress-bar");C?e.insertBefore(d,C):e.appendChild(d)}function D(e,t,n){const o=document.createElement("button");o.type="button";const i=I("close")||"Close notification";o.setAttribute("aria-label",i),o.setAttribute("title",i),o.textContent="×";const r=t.textColor||h(t.backgroundColor);o.className="toast-close-btn";const s="rtl"===t.fontDirection;a().disableInlineStyles||Object.assign(o.style,{background:"none",border:"none",color:r,fontSize:"18px",marginLeft:s?"0px":"10px",marginRight:s?"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 P(e){return e&&"#000000"===h(e)?"rgba(0,0,0,0.15)":"rgba(255,255,255,0.15)"}function V(){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 R(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(null==t?void 0:t._progressRatioMode))&&o>0&&o<=1||o>0&&o<1)&&(o*=100),Math.min(100,Math.max(0,o))):0}function q(e,t={}){var n,o;if(!e)return;const i=document.createElement("div");i.className="toast-progress-bar",e._progressBar=i;const r=t.borderRadius||"0",s=Number.parseInt(r,10),c=Number.isFinite(s)&&s>0?s:0;let u=4,d="4px";if("number"==typeof t.progressHeight&&Number.isFinite(t.progressHeight)&&t.progressHeight>0)u=t.progressHeight,d=`${u}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")?(u=16*n,d=e):(u=n,d=/^\d+(\.\d+)?$/.test(e)?`${n}px`:e))}const p=Number(null!==(n=t.duration)&&void 0!==n?n:2500),f=Math.max(0,p+5),m=Math.min(c,2*u),h=c>0?`calc(100% - ${2*m}px)`:"100%",y="reverse"===t.progressDirection||"increasing"===t.progressDirection||"ltr"===t.progressDirection,g="rtl"===t.fontDirection||"rtl"===t.progressDirection||"rtl"===(null==e||null===(o=e.style)||void 0===o?void 0:o.direction);i._leftOffset=m,i._finalWidth=h,i._isReverse=y,i._isRtl=g;const b=t.progressBarColor||t.progressColor||"currentColor";a().disableInlineStyles||Object.assign(i.style,{position:"absolute",left:g?"auto":`${m}px`,right:g?`${m}px`:"auto",height:d,background:b,width:y?"0%":`${h}`,transition:`width ${f}ms linear`,["top"===t.progressPosition?"top":"bottom"]:"0",borderRadius:u/2+"px",opacity:"0.8",zIndex:"2",willChange:"width"}),e.appendChild(i);const v="indeterminate"===t.progress||Boolean(t.showProgressBar)&&(0===t.duration||t.duration===1/0)&&void 0===t.progress;if(i._isIndeterminate=v,i._isManualProgress=void 0!==t.progress&&"indeterminate"!==t.progress,v){if(i.classList.add("toast-progress-bar-indeterminate"),g&&i.classList.add("toast-progress-bar-indeterminate-rtl"),!a().disableInlineStyles){V();const e=g?"toast-progress-indeterminate-rtl":"toast-progress-indeterminate";i.style.animation=`${e} 1.6s cubic-bezier(0.4, 0, 0.2, 1) infinite`}i.style.width=h}else{if(void 0!==t.progress){const n=R(t.progress,e,t);return i.style.width=`${n}%`,void(i.style.transition="width 200ms ease")}if(0!==t.duration&&t.duration!==1/0)if(l())i.style.display="none";else if("function"==typeof i.animate){const t=y?[{width:"0%"},{width:h}]:[{width:h},{width:"0%"}];e._progressAnimation=i.animate(t,{duration:f,easing:"linear",fill:"forwards",delay:50})}else i.style.transition=`width ${f}ms linear`,requestAnimationFrame(()=>{i.style.width=y?h:"0%"});else i.style.width="0%"}}function F(e){if(!e)return;if(e._hasAnimated)return;if(l())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(e){}requestAnimationFrame(()=>{e.style.opacity="1",e.style.transform="none",e.classList.add("active")})}};e.isConnected?t():requestAnimationFrame(()=>{e.isConnected?t():requestAnimationFrame(()=>{t()})})}function j(e,t){if(!e||"function"!=typeof e.addEventListener)return;let n=0,o=0,i=0,r=0,s=!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 a=t.target;if(a&&"function"==typeof a.closest&&a.closest("button, a, input, textarea, select, label"))return;let l=t;var p;t.touches&&t.touches.length>0?(l=t.touches[0],u=null!==(p=l.identifier)&&void 0!==p?p:null):u=null,n=l.clientX,o=l.clientY,i=n,r=Date.now(),s=!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(!s||!t)return;let r=t;if(t.touches)if(null!==u){for(let e=0;e<t.touches.length;e++)if(t.touches[e].identifier===u){r=t.touches[e];break}}else t.touches.length>0&&(r=t.touches[0]);const d=r.clientX,f=r.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 s=!1,e.style.userSelect="",void p();if(c){i=d;const n=Math.max(0,1-Math.abs(m)/280);a().disableInlineStyles||l()||(e.style.transform=`translateX(${m}px)`,e.style.opacity=String(n)),t.cancelable&&t.preventDefault()}},h=()=>{if(p(),u=null,!s||!c)return s=!1,void(e.style.userSelect="");s=!1,e.style.userSelect="";const o=i-n,d=Math.max(1,Date.now()-r),f=(d>0?Math.abs(o)/d:0)>=.65&&Math.abs(o)>=50,m=f?50:75;if(Math.abs(o)>=m){var h;const n=o>0?320:-320,i=f?120:180;a().disableInlineStyles||l()||(e.style.transition=`transform ${i}ms ease-out, opacity ${i}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)},i),"function"==typeof(null===(h=e._swipeTimeout)||void 0===h?void 0:h.unref)&&e._swipeTimeout.unref()}else if(!a().disableInlineStyles&&!l()){var y;const t=e._spring,n=(null==t?void 0:t.easing)||"cubic-bezier(0.34, 1.56, 0.64, 1)",o=null!=t&&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(null===(y=e._snapbackTimer)||void 0===y?void 0:y.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 $=null,W=!0,H=!1;var U;if("undefined"!=typeof window)if("undefined"!=typeof navigator&&null!==(U=navigator.userActivation)&&void 0!==U&&U.hasBeenActive)H=!0;else{const e=()=>{if(H=!0,$&&"suspended"===$.state)try{$.resume().catch(()=>{})}catch(e){}try{window.removeEventListener("pointerdown",e,!0),window.removeEventListener("keydown",e,!0),window.removeEventListener("touchstart",e,!0)}catch(e){}};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(e){}}const G=new Map;function Y(e=!0){if("undefined"==typeof window)return null;const t=window.AudioContext||window.webkitAudioContext;if(!t)return null;if(!$)try{$=new t}catch(e){return null}const n=H||"undefined"!=typeof navigator&&navigator.userActivation&&navigator.userActivation.hasBeenActive;if($&&"suspended"===$.state&&(e||n))try{$.resume().catch(()=>{})}catch(e){}return $}let X=null;function Q(){const e=Y(!1);if(!e||"function"!=typeof e.createAnalyser)return null;if(!X)try{X=e.createAnalyser(),X.fftSize=128,X.connect(e.destination)}catch(e){return null}return X}function K(e,t){X?t.connect(X):t.connect(e.destination)}function J(e,t){e&&(e.onended=()=>{try{var n;e.disconnect(),null==t||null===(n=t.disconnect)||void 0===n||n.call(t)}catch(e){}})}const Z={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),K(e,r),J(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),K(e,r),J(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),K(e,o),J(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),K(e,o),J(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),K(e,r),J(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),K(e,o),J(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),K(e,i),J(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),K(e,r),J(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),K(e,o),J(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),K(e,o),J(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),K(e,i),J(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),K(e,o),J(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),K(e,r),J(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),K(e,r),J(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),K(e,o),J(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),K(e,o),J(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),K(e,r),J(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),K(e,r),J(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),K(e,o),J(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),K(e,o),J(t,o),t.start(n),t.stop(n+.3)}}};let ee=!1;function te(e="info",t){if(!W)return;if(!ee&&"undefined"!=typeof window&&window.customizableToast&&"function"==typeof window.customizableToast.playTone&&window.customizableToast.playTone!==te)try{return ee=!0,void window.customizableToast.playTone(e,t)}finally{ee=!1}const n=Y();if(n)try{"suspended"===n.state&&n.resume().catch(()=>{});const o=n.currentTime,i="number"==typeof e?e:Number.parseFloat(e);if(Number.isFinite(i)&&i>=20&&i<=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(i,o),t.gain.setValueAtTime(.001,o),t.gain.exponentialRampToValueAtTime(.1,o+.015),t.gain.exponentialRampToValueAtTime(1e-4,o+.35),e.connect(t),K(n,t),J(e,t),e.start(o),void e.stop(o+.36)}const r=String(e||"info").toLowerCase().trim(),s=String(t||a().soundPreset||"modern").toLowerCase().trim();if(G.has(s))try{const e=G.get(s);if("function"==typeof e)return void e(n,r,o)}catch(e){console.warn("Custom sound preset synthesizer error:",e)}(Z[s]||Z.modern)(n,r,o)}catch(e){}}function ne(e,t){if("string"!=typeof e||!e.trim()||"function"!=typeof t)return!1;const n=e.toLowerCase().trim();return G.set(n,t),!0}function oe(){const e=Object.keys(Z),t=Array.from(G.keys());return Array.from(new Set([...e,...t]))}function ie(){G.clear()}function re(e){W=Boolean(e)}function se(){return W}function ae(){if($)try{var e,t,n,o;null===(e=(t=$).close)||void 0===e||null===(n=(o=e.call(t)).catch)||void 0===n||n.call(o,()=>{})}catch(e){}$=null,X=null}const le={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)"}},ce=new Map;function ue(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);ce.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 de(){return[...Object.keys(le),...ce.keys()]}function pe(){ce.clear()}function fe(e){if(!e)return null;if("string"==typeof e){const t=e.trim().toLowerCase();return ce.has(t)?ce.get(t):Object.prototype.hasOwnProperty.call(le,t)?le[t]:le.default}if(!0===e)return le.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 me(e,t){if(e<=0)return 0;const n=Math.max(.001,(null==t?void 0:t.stiffness)||100),o=Math.max(.001,(null==t?void 0:t.damping)||10),i=Math.max(.001,(null==t?void 0: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 he(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=me(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(me(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 ye(e,t=32){const n=he(e)/1e3,o=[];for(let i=0;i<=t;i++){const r=i/t,s=me(r*n,e),a=Math.round(1e3*s)/1e3,l=Math.round(1e3*r)/10;o.push(`${a} ${l}%`)}return`linear(${o.join(", ")})`}function ge(e){const t=fe(e);if(!t)return null;const n=he(t),o=ye(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(e){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 be=new Set(["svg","g","path","circle","rect","line","polyline","polygon","ellipse","title","desc","defs","clippath","use"]),ve=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 we(e=""){return/^\s*javascript:/i.test(e)}function xe(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(!be.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")&&ve.has(s)){if("href"===s||"xlink:href"===s){if(we(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(e){return null}}const Te={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 Ae(e={}){const t=e&&"object"==typeof e&&!Array.isArray(e)?e:{};let n=t.icon;if(void 0===n){const e=a().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,i=a(),r=document.createElement("i");r.className="toast-icon",r.setAttribute("aria-hidden","true");const s="rtl"===t.fontDirection;if(i.disableInlineStyles||Object.assign(r.style,{display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:"0",marginLeft:s?"8px":"0px",marginRight:s?"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 r.appendChild(n.cloneNode(!0)),r;if("string"==typeof n&&n.trim()){const e=n.trim(),t={check:Te.success,checkmark:Te.success,success:Te.success,cross:Te.error,error:Te.error,alert:Te.warning,warning:Te.warning,circle:Te.info,info:Te.info}[e.toLowerCase()];if(t){const e=xe(t.trim());return e&&r.appendChild(e),r}if(e.startsWith("<svg")&&e.endsWith("</svg>")){const t=xe(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"),r.appendChild(t)):r.textContent=e}else r.textContent=e;return r}const l="string"==typeof o?o.toLowerCase().trim():"";if((!0===n||void 0===n)&&l&&Te[l]){const e=xe(Te[l].trim());return e&&r.appendChild(e),r}return null}function Se(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 Ce(e={},t){try{var n;const o=a(),i=document.createElement("div"),r=(null==e?void 0:e.position)||o.defaultPosition,s=String(r).toLowerCase().trim();let l="auto",c="auto",u="auto",d="auto",p="none";s.startsWith("top")?l="20px":(s.startsWith("bottom")||s.includes("below"))&&(c="20px"),s.startsWith("left")?u="20px":s.startsWith("right")?d="20px":"center"===s?(u="50%",l="50%",p="translate(-50%, -50%)"):s.includes("center")?s.includes("left")?(u="20px",l="50%",p="translateY(-50%)"):s.includes("right")?(d="20px",l="50%",p="translateY(-50%)"):s.includes("top")?(l="20px",u="50%",p="translateX(-50%)"):s.includes("bottom")&&(c="20px",u="50%",p="translateX(-50%)"):(d="20px",c="20px"),i.className="toast-emergency",i.tabIndex=0,i.setAttribute("role","alert"),i.setAttribute("aria-live","assertive"),o.disableInlineStyles||Object.assign(i.style,{background:"#333",color:"white",padding:"10px 15px",position:"fixed",top:l,bottom:c,left:u,right:d,transform:p,zIndex:String(o.zIndex+100),borderRadius:"3px",maxWidth:"250px",wordWrap:"break-word",boxShadow:"0 2px 10px rgba(0,0,0,0.3)"});const f=document.createElement("div"),m=document.createElement("span");if(m.className="toast-emergency-message",o.disableInlineStyles||(m.style.display="inline-block"),e.allowHtml)try{const t=T(String(e.message||"Emergency Toast Showing!")),n=document.createElement("div");for(n.innerHTML=t;n.firstChild;)m.appendChild(n.firstChild)}catch(t){m.appendChild(document.createTextNode(String(e.message||"Emergency Toast Showing!")))}else m.textContent=String(e.message||"Emergency Toast Creation Showing!");f.appendChild(m);const h=document.createElement("button");for(h.type="button",h.className="toast-emergency-close",h.setAttribute("aria-label","Close emergency notification"),o.disableInlineStyles||Object.assign(h.style,{float:"right",marginLeft:"10px",fontWeight:"bold",cursor:"pointer",background:"transparent",border:"none",color:"inherit",padding:"0",font:"inherit"}),h.textContent="×",f.appendChild(h);i.firstChild;)i.removeChild(i.firstChild);i.appendChild(f);let y=null;const g=()=>{y&&clearTimeout(y),h.removeEventListener("click",g),i.remove(),"function"==typeof t&&t(i)};h.addEventListener("click",g);const b=Number(null==e?void 0:e.duration)||2500;return y=setTimeout(()=>{h.removeEventListener("click",g),i.remove(),"function"==typeof t&&t(i)},b),"function"==typeof(null===(n=y)||void 0===n?void 0:n.unref)&&y.unref(),i}catch(e){return console.error("Emergency toast creation failed:",e),"function"==typeof t&&t(null),null}}class ke{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 _e=null;function Ee(e=5,t=50){return _e||(_e=new ke(e,t)),_e}function Le(){_e&&(_e.clear(),_e=null)}async function Me(e,t){let n;const o="toast";try{if(null!=e&&e.usePool){const e=p(o);n=Ee().acquire(e),n._pooledId=e}else n=await async function(e,t){const n=document.createElement("div");return n.id=p(t),n}(0,o);return await async function(e,t,n){var o,i,r;const s=a(),l=null!=t&&t.spring?ge(t.spring):null,c=l?l.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}(null==t?void 0:t.animationDuration),u=`${c}ms`,d=l?l.easing:"string"==typeof(null==t?void 0:t.animationEasing)&&t.animationEasing.trim()?t.animationEasing.trim():"ease";l&&(e._spring=l),e._animationType=null==t?void 0:t.animationType;const p="string"==typeof(null==t?void 0:t.className)&&t.className.trim()?` ${t.className.trim()}`:"";e.className=`toast toast-${null!==(o=null==t?void 0:t.type)&&void 0!==o?o:"info"}${p}`;const f="number"==typeof(null==t?void 0:t.borderRadius)?`${t.borderRadius}px`:null==t?void 0:t.borderRadius,m="number"==typeof(null==t?void 0:t.maxWidth)?`${t.maxWidth}px`:null==t?void 0:t.maxWidth,h=l?`${Math.min(300,c)}ms`:u,y=l?"ease":d;s.disableInlineStyles||Object.assign(e.style,{background:null==t?void 0:t.backgroundColor,padding:"12px 16px",marginBottom:"10px",borderRadius:f,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 ${h} ${y}, transform ${u} ${d}`,transform:Se(null==t?void 0:t.position,null==t?void 0:t.animationType,!!l),zIndex:String(s.zIndex),direction:null!=t&&t.fontDirection&&"auto"!==t.fontDirection?t.fontDirection:N()?"rtl":void 0});const g="error"===(null==t?void 0:t.type),b=(null==t?void 0:t.role)||"alert",v=(null==t?void 0:t.ariaLive)||(g?"assertive":"polite");e.setAttribute("role",b),e.setAttribute("aria-live",v),e.tabIndex=0,e._animationDuration=c;const w=document.createElement("span");w.className="toast-message",e._messageSpan=w,"truncate"!==(null==t?void 0:t.wrapText)&&"ellipsis"!==(null==t?void 0:t.wrapText)&&!1!==(null==t?void 0:t.wrapText)&&null!=t&&t.wrapText?s.disableInlineStyles||Object.assign(w.style,{display:"block",whiteSpace:"normal"}):(w.classList.add("is-truncated"),s.disableInlineStyles||Object.assign(w.style,{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:"3",whiteSpace:"normal",overflow:"hidden",textOverflow:"ellipsis"}));const x="number"==typeof(null==t?void 0:t.fontSize)?`${t.fontSize}px`:null==t?void 0:t.fontSize;s.disableInlineStyles||Object.assign(w.style,{flex:"1",padding:null==t?void 0:t.fontPadding,fontFamily:null==t?void 0:t.fontFamily,fontSize:x,fontWeight:null==t?void 0:t.fontWeight,lineHeight:null==t?void 0:t.fontLineHeight,color:null==t?void 0:t.textColor,userSelect:"text",wordBreak:"break-word",overflow:"hidden",textOverflow:"ellipsis",direction:null!=t&&t.fontDirection&&"auto"!==t.fontDirection?t.fontDirection:void 0});const S=!!t.allowHtml,C=null!==(i=t.message)&&void 0!==i?i:"",k=Ae(t);if(k&&e.appendChild(k),t.loader||t.showLoader){const e=A(t.loader||{});w.appendChild(e);const n=document.createElement("span");n.className="toast-message-spacer",s.disableInlineStyles||(n.style.display="inline-block",n.style.width="8px"),w.appendChild(n)}if(S&&"string"==typeof C&&C.trim().length>0)try{const e=T(C),t=document.createElement("div");for(t.innerHTML=e;t.firstChild;)w.appendChild(t.firstChild)}catch(e){console.warn("HTML message sanitization failed, falling back to text:",e),w.appendChild(document.createTextNode(String(C)))}else w.appendChild(document.createTextNode(String(C)));w.setAttribute("title",w.textContent||""),e.appendChild(w),null!=t&&t.cta&&"object"==typeof t.cta&&z(e,t,n),null!=t&&t.undo&&O(e,t,n),null!=t&&t.showCloseButton&&D(e,t,n),!1!==(null==t?void 0:t.showProgressBar)&&(null!=t&&t.showProgressBar||void 0!==(null==t?void 0:t.progress))&&q(e,t),!1!==(void 0!==(null==t?void 0:t.swipeToDismiss)?t.swipeToDismiss:s.swipeToDismiss)&&j(e,n),(void 0!==(null==t?void 0:t.sound)?t.sound:s.sound)&&te("string"==typeof t.sound||"number"==typeof t.sound?t.sound:(null==t?void 0:t.type)||"info",(null==t?void 0:t.soundPreset)||s.soundPreset||"modern"),(null!==(r=null==t?void 0:t.trapFocus)&&void 0!==r?r:s.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(e){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(null==o?void 0:o.unref)&&o.unref(),e._cleanupFocusTrap=()=>{clearTimeout(o),e.removeEventListener("keydown",n),"undefined"!=typeof document&&document.removeEventListener("keydown",n)}}(e),F(e)}(n,e,t),n}catch(o){var i;if(null!=e&&e.usePool&&null!==(i=n)&&void 0!==i&&i._pooledId)try{Ee().release(n,n._pooledId)}catch(e){}return console.warn("toast creation failed with error showing fallback one: ",o),n=await Ce(e,t),n}}const Ie=new Map,Ne=new Map;function Be(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 ze(e){return`toast-container-${Be(e)}`}function Oe(){if(Ie.clear(),Ne.clear(),"undefined"!=typeof document){const e=document.querySelector("#toast-shadow-host");if(e)try{e.remove()}catch(e){}}}function De(e){const t=a();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 Pe(e={},t){var n;const o=a(),r=ze((null==e?void 0:e.position)||o.defaultPosition);let s=(l=i.targetNode)&&"object"==typeof l&&"function"==typeof l.appendChild?i.targetNode:"undefined"!=typeof document?document.body:null;var l;if(!s)throw new Error("Toast container root is unavailable");if(Boolean(null!==(n=null==e?void 0:e.shadowDom)&&void 0!==n?n:o.shadowDom)&&"undefined"!=typeof document&&"function"==typeof document.createElement){let e=null;try{e=s.querySelector?s.querySelector("#toast-shadow-host"):null}catch(e){}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(e){}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(Ne.has(r))return Ne.get(r);const c=(async()=>{const n=Ie.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)}(n,s))return n;n&&Ie.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)De(o),"function"==typeof t&&await t(o,e);else{var i;const n=(null===(i=s)||void 0===i?void 0:i.ownerDocument)||("undefined"!=typeof document?document:null);if(!n)throw new Error("Document is unavailable");o=n.createElement("div"),o.id=r,o.setAttribute("role","status"),o.setAttribute("aria-atomic","true"),De(o),"function"==typeof t&&await t(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(e){}}return Ie.set(r,o),o})();Ne.set(r,c);try{return await c}finally{Ne.delete(r)}}const Ve=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"]),Re=new Set(["top","bottom"]),qe=[...Ve,...Re];async function Fe(e,t={}){var n;if(!e||!t||"object"!=typeof t)throw new Error("Invalid container or position!");const o=a(),i=String((null==t?void 0:t.position)||o.defaultPosition||"bottom-right").toLowerCase().trim().replace(/\s+/g,"-");let r=i;var s;if(s=i,Ve.has(s)||Re.has(i)||(console.warn(`Unknown position "${t.position}", defaulting to "bottom-right"`),r="bottom-right"),function(e){if(null!=e&&e.classList)for(let t=0;t<qe.length;t++)e.classList.remove("toast-position-"+qe[t])}(e),null===(n=e.classList)||void 0===n||n.add("toast-position-"+r),a().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 l=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,l)||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,l)||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,l)}class je{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(){var e;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(null===(e=this.timeoutId)||void 0===e?void 0:e.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 $e{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(e){}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{var e,t;if(this.channel=new BroadcastChannel("toast-notifications"),null===(e=(t=this.channel).unref)||void 0===e||e.call(t),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(e){}};window.addEventListener("beforeunload",e),window.addEventListener("pagehide",e)}}catch(e){console.warn("[Toast] BroadcastChannel initialization failed:",e),this.supportsBroadcastChannel=!1}}_becomeLeadIfNeeded(){var e,t;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),null===(e=(t=this.leaderTimer).unref)||void 0===e||e.call(t))}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(null!=o?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((null===(i=this._getActiveToasts)||void 0===i?void 0:i.call(this))||[]),queue:(null===(r=this._getQueuedToasts)||void 0===r?void 0:r.call(this))||[]}):(this.listeners.get(t)||[]).forEach(i=>{try{i({toastId:n,payload:o,message:e})}catch(e){console.warn(`[Toast] Listener error for ${t}:`,e)}})));var i,r}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 We=null;function He(){if(!We&&(We=new $e,"undefined"!=typeof window)){const e=()=>{var e;null===(e=We)||void 0===e||e.destroy(),We=null};window.addEventListener("pagehide",e),window.addEventListener("beforeunload",e)}return We}function Ue(){We&&(We.destroy(),We=null)}const Ge={error:85,warning:70,info:40,success:30},Ye=["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")})),Xe=["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 Qe(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=Ge[t]||50;i.type=a,s+=.6*(a-50);const l="string"==typeof n?n:String(null!=n?n:""),c=l.toLowerCase();let u=0;for(let e=0;e<Ye.length;e++){const{keyword:t,regex:n}=Ye[e];n.test(l)&&(r.push(t),u+=2)}for(let e=0;e<Xe.length;e++){const{keyword:t,regex:n}=Xe[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 Ke(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 Je(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 Ze(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 et(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 tt(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 nt(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 ot(e,t={}){const{onFlick:o,onPinch:i,onSwipe:r,flickVelocityThreshold:s=.5,swipeVelocityThreshold:a=.3,swipeDistanceThreshold:l=50,pinchSensitivity:c=20}=t;let u=null,d=!1;const p=e=>{d=!0,u=function(e){const t=tt(e);return{touches:t,startTouches:t.map(e=>n({},e)),startTime:Date.now(),startDistance:t.length>=2?Je(t[0],t[1]):0,currentDistance:t.length>=2?Je(t[0],t[1]):0}}(e)},f=e=>{d&&u&&(u=function(e,t){const o=tt(t);return n(n({},e),{},{touches:o,currentDistance:o.length>=2?Je(o[0],o[1]):e.currentDistance})}(u,e))},m=e=>{if(!d||!u)return;d=!1;const t=nt(u,c);t.isPinch&&"function"==typeof i&&i(t);const n=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:Ze(n,o),direction:n>0?"right":"left",duration:o}}(u);et(n.velocity,n.distance,s,30)&&"function"==typeof o&&o(n);const p=function(e,t=.3,n=50){return e.velocity>=t||Math.abs(e.distance)>=n}(n,a,l);p&&"function"==typeof r&&r(n),u=null};return{attach(){e&&"function"==typeof e.addEventListener&&(e.addEventListener("touchstart",p,{passive:!0}),e.addEventListener("touchmove",f,{passive:!0}),e.addEventListener("touchend",m,{passive:!0}),e.addEventListener("touchcancel",m,{passive:!0}))},detach(){e&&"function"==typeof e.removeEventListener&&(e.removeEventListener("touchstart",p),e.removeEventListener("touchmove",f),e.removeEventListener("touchend",m),e.removeEventListener("touchcancel",m))},getState:()=>u}}let it=50;const rt=[];function st(e,t={},o="active"){const i=t&&"object"==typeof t?t:{},r={id:String(e||""),message:String(i.message||""),type:i.type||"info",position:String(i.position||"bottom-right"),timestamp:Date.now(),status:o,options:n({},i)};return rt.unshift(r),rt.length>it&&(rt.length=it),r}function at(e,t={}){st(e,t,"dropped")}function lt(){return rt.map(e=>n(n({},e),{},{options:n({},e.options)}))}function ct(){rt.length=0}function ut(e){const t=Number(e);Number.isFinite(t)&&t>0&&(it=Math.floor(t),rt.length>it&&(rt.length=it))}function dt(){rt.length=0,it=50}const pt=new Map,ft=new Map,mt=[];let ht=0,yt=0;function gt(){return{activeCount:pt.size,queueDepth:mt.length,visibleCount:ht,droppedCount:yt,timestamp:Date.now()}}function bt(){const e=a();if("function"==typeof e.onMetrics)try{e.onMetrics(gt())}catch(e){console.error("onMetrics callback error:",e)}}let vt=He();function wt(){vt=He(),vt.isSupported()&&"undefined"!=typeof window&&(vt.registerActiveToastsGetter(()=>Array.from(pt.keys())),vt.registerQueuedToastsGetter(()=>mt.map(e=>({key:e.key,options:e.options,count:e.count}))),vt.on("create",({toastId:e,payload:t})=>{a().syncTabs&&e&&t&&!pt.has(e)&&!ft.has(e)&&At(n(n({},t.options),{},{fromSync:!0})).catch(console.error)}),vt.on("update",({toastId:e,payload:t})=>{if(a().syncTabs&&e&&t&&pt.has(e)){const o=pt.get(e);o&&void 0!==t.count&&o.count!==t.count&&(o.count=t.count,Bt(o).catch(console.error)),t.newOptions&&"object"==typeof t.newOptions&&zt(e,n(n({},t.newOptions),{},{fromSync:!0})).catch(console.error)}}),vt.on("dismiss",({toastId:e})=>{if(a().syncTabs&&e)if(pt.has(e)||ft.has(e))Mt(e,!0).catch(console.error);else{const t=mt.findIndex(t=>t.key===e);-1!==t&&(mt.splice(t,1),bt())}}),vt.on("sync-response",({payload:e})=>{if(a().syncTabs&&e&&Array.isArray(e.queue))for(const t of e.queue)null==t||!t.options||pt.has(t.key)||ft.has(t.key)||At(n(n({},t.options),{},{fromSync:!0})).catch(console.error)}))}function xt(e){var t,n;if("number"==typeof(null==e||null===(t=e.options)||void 0===t?void 0:t.priority)&&Number.isFinite(e.options.priority))return e.options.priority;const o=null==e||null===(n=e.priority)||void 0===n?void 0:n.score;if("number"==typeof o&&Number.isFinite(o))return o;const i=a();if("function"==typeof i.priorityScorer)try{var r,s,l;const t=i.priorityScorer({type:(null==e||null===(r=e.options)||void 0===r?void 0:r.type)||"info",message:(null==e||null===(s=e.options)||void 0===s?void 0:s.message)||"",duration:null==e||null===(l=e.options)||void 0===l?void 0:l.duration,options:null==e?void 0: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 Qe(null==e?void 0:e.options).score}function Tt(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,Tt(e)},n=()=>{e._isExpanded=!1,Tt(e)},o=()=>{e._isExpanded=!0,Tt(e)},i=t=>{e.contains(t.relatedTarget)||(e._isExpanded=!1,Tt(e))};e.addEventListener("mouseenter",t),e.addEventListener("mouseleave",n),e.addEventListener("focusin",o),e.addEventListener("focusout",i);let r=null;r=ot(e,{onPinch:t=>{"out"!==t.direction||e._isExpanded?"in"===t.direction&&e._isExpanded&&(e._isExpanded=!1,Tt(e)):(e._isExpanded=!0,Tt(e))}}),r.attach(),e._stackedCleanup=()=>{var s,a;e.removeEventListener("mouseenter",t),e.removeEventListener("mouseleave",n),e.removeEventListener("focusin",o),e.removeEventListener("focusout",i),null===(s=r)||void 0===s||null===(a=s.detach)||void 0===a||a.call(s),e._stackedInitialized=!1}}if(!e.children||0===e.children.length)return;const t=Array.from(e.children),n=t.length,o=Boolean(e._isExpanded),i=Boolean(e.id&&e.id.includes("top"));t.forEach((e,t)=>{const r=n-1-t,s=o?"expanded":r>=3?"overflow":String(r);if("function"==typeof e.setAttribute&&e.setAttribute("data-stacked-depth",s),!a().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===r)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===r){const t=i?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===r){const t=i?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=i?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 At(e={}){try{const i=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=Be(t.position||"bottom-right");return`tag:${String(t.tag).trim()}:${e}`}if(void 0!==t.groupId&&null!==t.groupId&&""!==t.groupId){const e=Be(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)}|${Be(t.position||"bottom-right")}`}(e);if(pt.has(i)){var t,o;const n=pt.get(i);if(!n)throw new Error(`Active toast with key ${i} not found`);return n.count++,(e.tag||e.groupId)&&e.message&&null!==(t=n.toast)&&void 0!==t&&t._messageSpan&&(n.toast._messageSpan.textContent=String(e.message),n.toast._messageSpan.title=String(e.message)),null===(o=n.timer)||void 0===o||o.clear(),n.timer=_t(n.toast,e),await Et(n),await Bt(n),bt(),!e.fromSync&&!1!==e.syncTabs&&a().syncTabs&&vt.isSupported()&&vt.broadcast("update",i,{count:n.count}),i}if(ft.has(i)){const t=ft.get(i);if(!t)throw new Error(`Pending toast with key ${i} not found`);return t.count++,(e.tag||e.groupId)&&e.message&&(t.options=n(n({},t.options),e)),i}const r={options:e,count:1,rafId:0};return ft.set(i,r),r.rafId=requestAnimationFrame(async()=>{const e=ft.get(i);if(e){if(ft.delete(i),ht>=a().maxVisible){var t,o,r;const l={options:e.options,key:i,count:e.count},c=null!==(t=a().maxQueueSize)&&void 0!==t?t:100;if(c<=0)return yt++,at(i,e.options),void bt();const u=mt.find(e=>e.key===i);var s;if(u)return u.count+=e.count,"number"==typeof(null===(s=e.options)||void 0===s?void 0:s.priority)&&(u.options=n(n({},u.options),e.options),u.priority=Qe(u.options)),void bt();const d=a().aiPrioritization||(null===(o=e.options)||void 0===o?void 0:o.aiPrioritization)||"number"==typeof(null===(r=e.options)||void 0===r?void 0:r.priority)||mt.some(e=>{var t,n;return(null==e||null===(t=e.options)||void 0===t?void 0:t.aiPrioritization)||"number"==typeof(null==e||null===(n=e.options)||void 0===n?void 0:n.priority)});if(d&&(l.priority=Qe(e.options)),mt.length>=c){if(d){const t=xt(l);let n=0,o=xt(mt[0]);for(let e=1;e<mt.length;e++){const t=xt(mt[e]);t<o&&(n=e,o=t)}if(t<=o)return yt++,at(i,e.options),void bt();const r=mt.splice(n,1)[0];r&&at(r.key,r.options)}else{const e=mt.shift();e&&at(e.key,e.options)}yt++}return mt.push(l),d&&mt.sort((e,t)=>xt(t)-xt(e)),bt(),void await Nt()}try{await St(e.options,i,e.count)}catch(e){console.error("showToast failed:",e)}}}),!e.fromSync&&!1!==e.syncTabs&&a().syncTabs&&vt.isSupported()&&vt.broadcast("create",i,{options:e}),i}catch(e){console.error("showToast failed:",e)}}async function St(e,t,n){try{if(!e||"object"!=typeof e)throw new TypeError("options must be an object");ht++;const o=await Pe(e,Fe);if(!o)throw new Error("Failed to create toast container");const i=await Me(e,Lt);if(!i)throw new Error("Toast element creation failed");const r=document.createElement("div");r.className="toast-outer-wrapper",a().disableInlineStyles||Object.assign(r.style,{position:"relative",display:"inline-block",overflow:"visible",marginBottom:"10px",zIndex:"0",width:"100%",pointerEvents:"auto"});const s=document.createElement("div");s.className="toast-inner-wrapper",a().disableInlineStyles||Object.assign(s.style,{position:"relative",overflow:"hidden",zIndex:"1"}),s.appendChild(i),r.appendChild(s),o.id.includes("toast-container-")&&(o.appendChild(r),e.stacked&&o.setAttribute("data-stacked","true"),"true"===o.getAttribute("data-stacked")&&Tt(o)),F(i);const l=!1!==e.pauseOnHover&&(!0===e.pauseOnHover||!!e.cta||Boolean(a().pauseOnHover)),c={outer:r,toast:i,options:e,count:Math.max(1,Math.floor(null!=n?n:0)),pauseOnHover:l};pt.set(t,c),i._key=t,st(t,e,"active"),bt(),c.count>1&&await Bt(c),c.timer=_t(i,e),await Et(c)}catch(t){console.error("Something went wrong: ",t),ht=Math.max(0,ht-1),bt(),(document.querySelector('[id^="toast-container-"]')||document.body).appendChild(await Ce(e,Lt))}}function Ct(){for(const[,e]of ft)null!=e&&e.rafId&&cancelAnimationFrame(e.rafId);ft.clear(),mt.length=0;for(const[,g]of pt){var e,t,n,o,i,r,s,a,l,c,u,d,p,f,m,h,y;if(null===(e=g.timer)||void 0===e||e.clear(),null===(t=g.outer)||void 0===t||null===(n=t._pauseCleanup)||void 0===n||n.call(t),null===(o=g.toast)||void 0===o||null===(i=o._cleanupCloseButton)||void 0===i||i.call(o),null===(r=g.toast)||void 0===r||null===(s=r._cleanupCTA)||void 0===s||s.call(r),null===(a=g.toast)||void 0===a||null===(l=a._cleanupUndo)||void 0===l||l.call(a),null===(c=g.toast)||void 0===c||null===(u=c._cleanupSwipe)||void 0===u||u.call(c),null===(d=g.toast)||void 0===d||null===(p=d._cleanupFocusTrap)||void 0===p||p.call(d),null===(f=g.toast)||void 0===f||null===(m=f._cleanup)||void 0===m||m.call(f),null!==(h=g.toast)&&void 0!==h&&h._progressAnimation){try{g.toast._progressAnimation.cancel()}catch(e){}g.toast._progressAnimation=null}const b=null===(y=g.outer)||void 0===y?void 0:y.querySelector(".toast-count-badge");null!=b&&b._scaleTimer&&(clearTimeout(b._scaleTimer),b._scaleTimer=null)}"undefined"!=typeof document&&document.querySelectorAll('[id^="toast-container-"]').forEach(e=>{try{var t;null===(t=e._stackedCleanup)||void 0===t||t.call(e)}catch(e){}}),pt.clear(),ht=0,yt=0,It=!1,bt(),wt()}wt();const kt=async function(){try{if(0===pt.size){if(ft.size>0){const[e,t]=Array.from(ft.entries()).at(-1);return null!=t&&t.rafId&&cancelAnimationFrame(t.rafId),ft.delete(e),void bt()}return mt.length>0?(mt.pop(),void bt()):void 0}let e=null;const t=Array.from(pt.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 Lt(n)}catch(e){console.error("dismissMostRecent failed:",e)}};function _t(e,t){const n=Number(null==t?void 0:t.duration);if((null==t?void 0:t.duration)===1/0||"number"==typeof(null==t?void 0:t.duration)&&(null==t?void 0:t.duration)<=0)return null;const o=Number.isFinite(n)&&n>0?n:2500,i=new je(()=>{Lt(e).catch(console.error)},o+5);return i.start(),i}async function Et(e){var t,n;if(!e.pauseOnHover||!e.outer||!e.timer)return;null===(t=(n=e.outer)._pauseCleanup)||void 0===t||t.call(n);const{outer:o,timer:i,toast:r}=e,s=()=>{if(null!=r&&r._progressAnimation)try{r._progressAnimation.pause()}catch(e){}else if(null!=r&&r._progressBar)try{if(r._progressBar._isIndeterminate)r._progressBar.style.animationPlayState="paused";else if(r._progressBar._isManualProgress);else{const e=window.getComputedStyle(r._progressBar).width;r._progressBar._pausedWidth=e,r._progressBar.style.transition="none",r._progressBar.style.width=e}}catch(e){}},a=()=>{if(null!=r&&r._progressAnimation)try{r._progressAnimation.play()}catch(e){}else if(null!=r&&r._progressBar)try{if(r._progressBar._isIndeterminate)r._progressBar.style.animationPlayState="running";else if(r._progressBar._isManualProgress);else if(r._progressBar._pausedWidth){var e,t;const n=null!==(e=null===(t=i.getRemainingTime)||void 0===t?void 0:t.call(i))&&void 0!==e?e:1e3,o=r._progressBar._isReverse,s=r._progressBar._finalWidth||"100%";r._progressBar.style.transition=`width ${Math.max(0,n)}ms linear`,r._progressBar.style.width=o?s:"0%",r._progressBar._pausedWidth=null}}catch(e){}},l=()=>{var e;i.pause(),s(),null==r||null===(e=r._pauseUndo)||void 0===e||e.call(r),null==r||r.classList.add("toast-paused")},c=()=>{var e;i.resume(),a(),null==r||null===(e=r._resumeUndo)||void 0===e||e.call(r),null==r||r.classList.remove("toast-paused")},u=e=>{var t;e.target.matches("[tabindex], div, span, button, a")&&(i.pause(),s(),null==r||null===(t=r._pauseUndo)||void 0===t||t.call(r),null==r||r.classList.add("toast-paused"))},d=e=>{var t;o.contains(e.relatedTarget)||(i.resume(),a(),null==r||null===(t=r._resumeUndo)||void 0===t||t.call(r),null==r||r.classList.remove("toast-paused"))};o.addEventListener("mouseenter",l),o.addEventListener("mouseleave",c),o.addEventListener("focusin",u),o.addEventListener("focusout",d),o._pauseCleanup=()=>{o.removeEventListener("mouseenter",l),o.removeEventListener("mouseleave",c),o.removeEventListener("focusin",u),o.removeEventListener("focusout",d)}}async function Lt(e){if(null!=e&&e._key)return Mt(e._key)}async function Mt(e,t=!1){try{var n,o,i,r,s,c,u,d,p,f,m,h,y,g,b,v,w,x,T,A,S,C,k,_,E;if(!e)return;const z=pt.get(e),O=!1!==(null==z||null===(n=z.options)||void 0===n?void 0:n.syncDismiss)&&!1!==(null==z||null===(o=z.options)||void 0===o?void 0:o.syncTabs);!t&&O&&a().syncTabs&&vt.isSupported()&&vt.broadcast("dismiss",e,{});const D=ft.get(e);if(D)return cancelAnimationFrame(D.rafId),ft.delete(e),void bt();const P=mt.findIndex(t=>t.key===e);if(-1!==P)return mt.splice(P,1),void bt();if(!z)return;if(function(e){if(!e)return;const t=String(e),n=rt.find(e=>e.id===t&&"active"===e.status);n&&(n.status="dismissed",n.dismissedAt=Date.now())}(e),null===(i=z.timer)||void 0===i||i.clear(),null===(r=z.outer)||void 0===r||null===(s=r._pauseCleanup)||void 0===s||s.call(r),null===(c=z.toast)||void 0===c||null===(u=c._cleanupCloseButton)||void 0===u||u.call(c),null===(d=z.toast)||void 0===d||null===(p=d._cleanupCTA)||void 0===p||p.call(d),null===(f=z.toast)||void 0===f||null===(m=f._cleanupUndo)||void 0===m||m.call(f),null===(h=z.toast)||void 0===h||null===(y=h._cleanupSwipe)||void 0===y||y.call(h),null===(g=z.toast)||void 0===g||null===(b=g._cleanupFocusTrap)||void 0===b||b.call(g),null===(v=z.toast)||void 0===v||null===(w=v._cleanup)||void 0===w||w.call(v),null!==(x=z.toast)&&void 0!==x&&x._progressAnimation){try{z.toast._progressAnimation.cancel()}catch(e){}z.toast._progressAnimation=null}const V=null===(T=z.outer)||void 0===T?void 0:T.querySelector(".toast-count-badge");null!=V&&V._scaleTimer&&(clearTimeout(V._scaleTimer),V._scaleTimer=null);const R=null===(A=z.toast)||void 0===A?void 0:A.querySelector("button, a");null==R||null===(S=R._cleanup)||void 0===S||S.call(R),pt.delete(e),ht=Math.max(0,ht-1),bt(),V&&V.remove();const q=null!==(C=null===(k=z.toast)||void 0===k?void 0:k._animationDuration)&&void 0!==C?C:400,F=Math.min(q,300);if(z.toast){if(!a().disableInlineStyles){var L,M,I,N;const e=String((null===(L=z.options)||void 0===L?void 0:L.position)||(null===(M=z.outer)||void 0===M||null===(M=M.parentElement)||void 0===M?void 0:M.id)||"").toLowerCase(),t=e.includes("top"),n=e.includes("left"),o=e.includes("right"),i=String((null===(I=z.options)||void 0===I?void 0:I.animationType)||"").toLowerCase().trim();let r="translateY(20px)";const s=null===(N=z.toast)||void 0===N?void 0:N._spring;l()?(z.toast.style.transition="none",z.toast.style.opacity="0"):("fade"===i?r="none":"zoom"===i||"scale"===i?r="scale(0.75)":"flip"===i?r="perspective(600px) rotateX(-45deg)":"slide"===i?r=n?"translateX(-100%)":o?"translateX(100%)":t?"translateY(-100%)":"translateY(100%)":"bounce"===i?r=t?"translateY(-36px) scale(0.9)":"translateY(36px) scale(0.9)":s&&(r=t?"translateY(-28px) scale(0.94)":"translateY(28px) scale(0.94)"),z.toast.style.transition=`opacity ${F}ms ease-in, transform ${F}ms ease-in`,z.toast.style.opacity="0",z.toast.style.transform=r)}z.toast.classList.remove("active")}const j=null===(_=z.outer)||void 0===_?void 0:_.parentElement;if(await async function(e,t,n=400){return e?new Promise(o=>{var i;let r=!1,s=null;const a=t||e.firstElementChild||e,c=()=>{var t;if(r)return;r=!0,s&&(clearTimeout(s),s=null);try{var n;null==a||null===(n=a.removeEventListener)||void 0===n||n.call(a,"transitionend",u,!0)}catch(e){}const i=(null===(t=e.querySelector)||void 0===t?void 0:t.call(e,".toast"))||e;if(null!=i&&i._pooledId)try{Ee().release(i,i._pooledId)}catch(e){}(async function(e){if(!e)return!0;try{if("function"==typeof e.remove)return e.remove(),!0}catch(e){}try{if(e.parentNode)return e.parentNode.removeChild(e),!0}catch(e){}return!1})(e).catch(console.error),o()};if(l()||n<=0)return void c();const u=e=>{try{if(e.target!==a)return;"transform"!==e.propertyName&&(a.style.transform&&"none"!==a.style.transform&&"initial"!==a.style.transform||"opacity"!==e.propertyName)||c()}catch(e){console.error("removeWithTransition error:",e)}};if(!a)return c();try{a.addEventListener("transitionend",u,!0)}catch(e){console.error("removeWithTransition error:",e)}s=setTimeout(c,n+100),"function"==typeof(null===(i=s)||void 0===i?void 0:i.unref)&&s.unref()}):Promise.resolve()}(z.outer,z.toast,F),j&&0===j.children.length&&null!==(E=j.id)&&void 0!==E&&E.startsWith("toast-container-"))try{var B;null===(B=j._stackedCleanup)||void 0===B||B.call(j),function(e){if(!e)return;const t="string"==typeof e&&e.startsWith("toast-container-")?e:ze(e);Ie.delete(t),Ne.delete(t)}(j.id),j.remove()}catch(e){}else j&&"true"===j.getAttribute("data-stacked")&&Tt(j);await Nt()}catch(e){console.error("Closing Toast failed!: ",e)}}let It=!1;async function Nt(){if(!It){It=!0;try{const n=a();for((n.aiPrioritization||mt.some(e=>{var t,n;return(null===(t=e.options)||void 0===t?void 0:t.aiPrioritization)||"number"==typeof(null===(n=e.options)||void 0===n?void 0:n.priority)}))&&mt.length>1&&mt.sort((e,t)=>xt(t)-xt(e));ht<n.maxVisible&&mt.length;){const n=mt.shift();if(pt.has(n.key)){var e;const o=pt.get(n.key);var t;o.count+=n.count,(n.options.tag||n.options.groupId)&&n.options.message&&null!==(e=o.toast)&&void 0!==e&&e._messageSpan&&(o.toast._messageSpan.textContent=String(n.options.message),o.toast._messageSpan.title=String(n.options.message),null===(t=o.timer)||void 0===t||t.clear(),o.timer=_t(o.toast,n.options)),await Bt(o),bt();continue}await St(n.options,n.key,n.count)}bt()}finally{It=!1}}}async function Bt({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`),a().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{var o;l()||(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(null===(o=n._scaleTimer)||void 0===o?void 0:o.unref)&&n._scaleTimer.unref())}catch(e){console.error("updateBadge animation error:",e)}}async function zt(e,t={}){var o;if(!e||"object"!=typeof t||null===t)return;if(ft.has(e)){const o=ft.get(e);return void(o.options=n(n({},o.options),t))}const i=mt.find(t=>t.key===e);if(i)return void(i.options=n(n({},i.options),t));const r=pt.get(e);if(!r||!r.toast)return;const s=n({},r.options);r.options=n(n({},r.options),t);const l=r.toast,c=l._messageSpan||l.querySelector(".toast-message")||l.querySelector("span:not(.toast-count-badge)");if(void 0!==t.message){var u;const e=String(null!==(u=t.message)&&void 0!==u?u:""),n=void 0!==t.allowHtml?Boolean(t.allowHtml):Boolean(r.options.allowHtml),o=("success"===t.type||"error"===t.type||"warning"===t.type||"info"===t.type)&&!0!==t.showLoader;if(c){const i=c.querySelector(".toast-loader");if(c.innerHTML="",i&&!1!==t.showLoader&&null!==t.loader&&!o){c.appendChild(i);const e=document.createElement("span");e.style.display="inline-block",e.style.width="8px",c.appendChild(e)}if(n&&e.trim().length>0)try{const t=T(e),n=document.createElement("div");for(n.innerHTML=t;n.firstChild;)c.appendChild(n.firstChild)}catch(t){c.appendChild(document.createTextNode(e))}else c.appendChild(document.createTextNode(e));c.setAttribute("title",c.textContent||"")}}const d=("success"===t.type||"error"===t.type||"warning"===t.type||"info"===t.type)&&!0!==t.showLoader;if(!1===t.showLoader||null===t.loader||d){const e=null==c?void 0:c.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)&&c&&!c.querySelector(".toast-loader")){const e=A(t.loader||{});c.insertBefore(e,c.firstChild);const n=document.createElement("span");n.style.display="inline-block",n.style.width="8px",c.insertBefore(n,e.nextSibling)}if(t.type){const e=String(t.type).toLowerCase().trim();l.className=l.className.replace(/\btoast-(info|success|error|warning)\b/g,`toast-${e}`);const n="error"===e;if(t.role?l.setAttribute("role",t.role):l.setAttribute("role","alert"),l.setAttribute("aria-live",t.ariaLive||(n?"assertive":"polite")),!t.backgroundColor){const t={success:"#28a745",error:"#dc3545",warning:"#ffc107",info:"#17a2b8"};t[e]&&(l.style.background=t[e])}}if(void 0!==t.icon||void 0!==t.type){const e=null==l?void 0:l.querySelector(".toast-icon");e&&e.remove();const o=Ae(n(n({},r.options),t));o&&(c?l.insertBefore(o,c):l.appendChild(o))}if(t.backgroundColor&&(l.style.background=t.backgroundColor),t.textColor)l.style.color=t.textColor,c&&(c.style.color=t.textColor);else if(t.type||t.backgroundColor){const e=l.style.background;if(e){const t=h(e);l.style.color=t,c&&(c.style.color=t)}}if(void 0!==t.borderRadius){const e="number"==typeof t.borderRadius?`${t.borderRadius}px`:t.borderRadius;l.style.borderRadius=e}if(void 0!==t.maxWidth){const e="number"==typeof t.maxWidth?`${t.maxWidth}px`:t.maxWidth;l.style.maxWidth=e}if(void 0!==t.fontDirection){const e="auto"!==t.fontDirection?t.fontDirection:"";l.style.direction=e,c&&(c.style.direction=e)}if(void 0!==t.fontSize){const e="number"==typeof t.fontSize?`${t.fontSize}px`:t.fontSize;l.style.fontSize=e,c&&(c.style.fontSize=e)}if(void 0!==t.fontFamily&&(l.style.fontFamily=t.fontFamily,c&&(c.style.fontFamily=t.fontFamily)),void 0!==t.fontWeight){const e="number"==typeof t.fontWeight?String(t.fontWeight):t.fontWeight;l.style.fontWeight=e,c&&(c.style.fontWeight=e)}if(void 0!==t.fontLineHeight&&(l.style.lineHeight=t.fontLineHeight,c&&(c.style.lineHeight=t.fontLineHeight)),void 0!==t.fontPadding&&c&&(c.style.padding=t.fontPadding),void 0!==t.wrapText&&c&&("truncate"!==t.wrapText&&"ellipsis"!==t.wrapText&&!1!==t.wrapText&&t.wrapText?(c.classList.remove("is-truncated"),a().disableInlineStyles||Object.assign(c.style,{display:"block",WebkitBoxOrient:"",WebkitLineClamp:"",whiteSpace:"normal",overflow:"visible",textOverflow:"clip"})):(c.classList.add("is-truncated"),a().disableInlineStyles||Object.assign(c.style,{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:"3",whiteSpace:"normal",overflow:"hidden",textOverflow:"ellipsis"}))),void 0!==t.role&&l.setAttribute("role",t.role),void 0!==t.ariaLive&&l.setAttribute("aria-live",t.ariaLive),void 0!==t.className){const e=s.className;e&&"string"==typeof e&&l.classList.remove(...e.trim().split(/\s+/)),t.className&&"string"==typeof t.className&&l.classList.add(...t.className.trim().split(/\s+/))}let p=l.querySelector(".toast-progress-bar");if(!1===t.showProgressBar){if(l._progressAnimation){try{l._progressAnimation.cancel()}catch(e){}l._progressAnimation=null}p&&p.remove(),l._progressBar=null,p=null}else p||!1===t.showProgressBar||void 0===t.progress&&!0!==t.showProgressBar||(q(l,n(n(n({},r.options),t),{},{showProgressBar:!0})),p=l.querySelector(".toast-progress-bar"));if(p){if(void 0!==t.progress)if("indeterminate"===t.progress){if(p._isIndeterminate=!0,p._isManualProgress=!1,l._progressAnimation){try{l._progressAnimation.cancel()}catch(e){}l._progressAnimation=null}p.classList.add("toast-progress-bar-indeterminate");const e=p._isRtl||"rtl"===t.fontDirection||"rtl"===t.progressDirection;if(e&&p.classList.add("toast-progress-bar-indeterminate-rtl"),!a().disableInlineStyles){V();const t=e?"toast-progress-indeterminate-rtl":"toast-progress-indeterminate";p.style.animation=`${t} 1.6s cubic-bezier(0.4, 0, 0.2, 1) infinite`}p.style.width=p._finalWidth||"100%"}else{const e=R(t.progress,l,n(n({},r.options),t));if(p._isIndeterminate=!1,p._isManualProgress=!0,p.classList.remove("toast-progress-bar-indeterminate"),p.classList.remove("toast-progress-bar-indeterminate-rtl"),p.style.animation="none",l._progressAnimation){try{l._progressAnimation.cancel()}catch(e){}l._progressAnimation=null}p.style.transition="width 200ms ease",p.style.width=`${e}%`}if((t.progressBarColor||t.progressColor)&&(p.style.background=t.progressBarColor||t.progressColor),t.progressPosition&&(p.style.top="top"===t.progressPosition?"0":"auto",p.style.bottom="bottom"===t.progressPosition?"0":"auto"),void 0!==t.progressHeight){const e="number"==typeof t.progressHeight?`${t.progressHeight}px`:t.progressHeight;p.style.height=e}}var f;if(void 0!==t.animationType&&(r.options.animationType=t.animationType,l._animationType=t.animationType),void 0!==t.spring&&(r.options.spring=t.spring,l._spring=t.spring?ge(t.spring):null),void 0!==t.swipeToDismiss&&(r.options.swipeToDismiss=t.swipeToDismiss,!1===t.swipeToDismiss?(null===(f=l._cleanupSwipe)||void 0===f||f.call(l),l._cleanupSwipe=null):!0!==t.swipeToDismiss||l._cleanupSwipe||j(l,Lt)),void 0!==t.duration){var m;null===(m=r.timer)||void 0===m||m.clear();const e=Number(t.duration);if(Number.isFinite(e)&&e>0){if(r.timer=_t(l,{duration:e}),await Et(r),p&&!p._isManualProgress&&!p._isIndeterminate){const t=e+5;if(l._progressAnimation){try{l._progressAnimation.cancel()}catch(e){}const e=p._isReverse,n=p._finalWidth||"100%",o=e?[{width:"0%"},{width:n}]:[{width:n},{width:"0%"}];l._progressAnimation=p.animate(o,{duration:t,easing:"linear",fill:"forwards",delay:0})}else{p.style.transition=`width ${t}ms linear`;const e=p._isReverse,n=p._finalWidth||"100%";p.style.width=e?n:"0%"}}}else if(r.timer=null,p&&!p._isManualProgress&&!p._isIndeterminate){if(l._progressAnimation){try{l._progressAnimation.cancel()}catch(e){}l._progressAnimation=null}p.style.width="0%"}}else if(!(0!==r.options.duration&&r.timer||"success"!==t.type&&"error"!==t.type&&"warning"!==t.type&&!1!==t.showLoader)){var y;r.options.duration=2500,null===(y=r.timer)||void 0===y||y.clear(),r.timer=_t(l,{duration:2500}),await Et(r)}if(void 0!==t.cta&&(l._cleanupCTA&&(l._cleanupCTA(),l._cleanupCTA=null),l.querySelectorAll(".toast-cta").forEach(e=>e.remove()),t.cta&&"object"==typeof t.cta)&&z(l,n(n({},r.options),t),Lt),void 0!==t.undo&&(l._cleanupUndo&&(l._cleanupUndo(),l._cleanupUndo=null),l.querySelectorAll(".toast-undo-btn").forEach(e=>e.remove()),t.undo)&&O(l,n(n({},r.options),t),Lt),void 0!==t.showCloseButton){const e=l.querySelector(".toast-close-btn");!1===t.showCloseButton?(l._cleanupCloseButton&&(l._cleanupCloseButton(),l._cleanupCloseButton=null),e&&e.remove()):!0!==t.showCloseButton||e||D(l,n(n({},r.options),t),Lt)}(void 0!==t.sound?Boolean(t.sound):Boolean(t.type&&(r.options.sound||a().sound)))&&te("string"==typeof t.sound||"number"==typeof t.sound?t.sound:t.type||r.options.type||"info",t.soundPreset||r.options.soundPreset||a().soundPreset||"modern");const g=l.closest('[id^="toast-container-"]');if(g)if(!0===t.stacked)g.setAttribute("data-stacked","true"),Tt(g);else if(!1===t.stacked){var b;g.removeAttribute("data-stacked"),null===(b=g._stackedCleanup)||void 0===b||b.call(g),Array.from(g.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"})}else"true"===g.getAttribute("data-stacked")&&Tt(g);!t.fromSync&&!1!==(null===(o=r.options)||void 0===o?void 0:o.syncTabs)&&!1!==t.syncTabs&&a().syncTabs&&vt.isSupported()&&vt.broadcast("update",e,{newOptions:t})}let Ot={success:"#28a745",error:"#dc3545",warning:"#ffc107",info:"#17a2b8"},Dt={},Pt=!1,Vt=null;function Rt(e,t){const o="object"!=typeof t||null===t||Array.isArray(t)?{}:t;return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||"bigint"==typeof e?n(n({},o),{},{message:String(e)}):e instanceof Error?n(n({},o),{},{message:e.message||String(e)}):"object"!=typeof e||null===e||Array.isArray(e)?n({},o):n(n({},o),e)}function qt(e){try{if(e&&"object"==typeof e&&!Array.isArray(e)){const t=["success","error","warning","info"],o={};for(const[n,i]of Object.entries(e))t.includes(n)&&"string"==typeof i&&i.trim()&&(o[n]=i.trim());Object.keys(o).length>0&&(Ot=n(n({},Ot),o))}}catch(e){console.error("setDefaultColors failed:",e)}}function Ft(e){try{if(e&&"object"==typeof e&&!Array.isArray(e)){const t=["success","error","warning","info"],o={};for(const[n,i]of Object.entries(e))t.includes(n)&&"string"==typeof i&&i.trim()&&(o[n]=i.trim());Object.keys(o).length>0&&(Dt=n(n({},Dt),o))}}catch(e){console.error("setDefaultMessages failed:",e)}}let jt=!1,$t=null;const Wt=async function(e={}){return"undefined"!=typeof window&&"undefined"!=typeof document?(await async function(){Pt||"undefined"!=typeof window&&"undefined"!=typeof document&&("complete"!==document.readyState&&"interactive"!==document.readyState?(Vt||(Vt=new Promise(e=>{document.addEventListener("DOMContentLoaded",()=>{Pt=!0,e()},{once:!0})})),await Vt):Pt=!0)}(),await async function(e={}){try{const t=await async function(e){var t,o;const i=Rt(e),r=a(),s=String(null!==(t=null==i?void 0:i.position)&&void 0!==t?t:r.defaultPosition).toLowerCase().trim(),l=null!=s&&s.includes("top-full-width")||null!=s&&s.includes("bottom-full-width")?"100vw":"400px",c=n(n({},{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:l}),i);c.message=null!==(o=null==i?void 0:i.message)&&void 0!==o?o:c.message;try{if(!c.backgroundColor){var u,d,p;const e="undefined"!=typeof window&&"function"==typeof window.matchMedia&&(null===(u=window.matchMedia("(prefers-color-scheme: dark)"))||void 0===u?void 0:u.matches);c.backgroundColor=null!==(d=null===(p=Ot)||void 0===p?void 0:p[c.type])&&void 0!==d?d:e?"#f5f5f5":"#111111"}}catch(e){console.warn("Background color resolution failed:",e),c.backgroundColor||(c.backgroundColor="#111111")}try{c.message=c.message||Dt[c.type]||I(c.type)||"No Message Provided!"}catch(e){console.warn("Default message resolution failed:",e)}try{c.fontDirection&&"auto"!==c.fontDirection||!N()||(c.fontDirection="rtl")}catch(e){}try{!c.textColor&&c.backgroundColor&&(c.textColor=h(c.backgroundColor))}catch(e){console.warn("Text color resolution failed:",e)}try{const e=(null==i?void 0:i.progressBarColor)||(null==i?void 0:i.progressColor);e?(c.progressColor=e,c.progressBarColor=e):!c.progressColor&&c.backgroundColor&&(c.progressColor=c.textColor||h(c.backgroundColor),c.progressBarColor=c.progressColor)}catch(e){console.warn("Progress bar color resolution failed:",e)}return"string"!=typeof c.message&&(c.message="No Message Provided!"),c}(e);return await async function(e){try{return await Pe(e,Fe)}catch(e){return console.error("Failed to create toast container:",e),a().targetNode||document.body}}(t),await At(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 Ht(e={},t){const n=Rt(e,t),o=await async function(){if(jt&&$t)try{await $t}catch(e){console.warn("Previous close operation failed (continuing anyway):",e)}return Wt(n)}();return{id:o,dismiss:()=>o?Mt(o):Promise.resolve(),update:e=>o?zt(o,e):Promise.resolve()}}Ht.success=(e,t)=>Ht(n(n({},Rt(e,t)),{},{type:"success"})),Ht.error=(e,t)=>Ht(n(n({},Rt(e,t)),{},{type:"error"})),Ht.warning=(e,t)=>Ht(n(n({},Rt(e,t)),{},{type:"warning"})),Ht.info=(e,t)=>Ht(n(n({},Rt(e,t)),{},{type:"info"})),Ht.loading=(e,t)=>Ht(n({type:"info",showLoader:!0,duration:0,showProgressBar:!1,pauseOnHover:!1},Rt(e,t))),Ht.custom=(e,t)=>Ht(n({allowHtml:!0},Rt(e,t)));const Ut=Ht.success,Gt=Ht.error,Yt=Ht.warning,Xt=Ht.info,Qt=Ht.loading,Kt=Ht.custom,Jt=async e=>{let t=e;if(e&&"function"==typeof e.then)try{t=await e}catch(e){return}jt=!0,$t=(async()=>{try{"string"==typeof t&&t.length>0?await Mt(t):t&&"object"==typeof t?"function"==typeof t.dismiss?await t.dismiss():t._key&&"string"==typeof t._key?await Mt(t._key):t.id&&"string"==typeof t.id?await Mt(t.id):await kt():await kt()}finally{jt=!1,$t=null}})(),await $t},Zt=async()=>{jt=!0,$t=(async()=>{try{await async function(){try{for(const[,e]of ft)null!=e&&e.rafId&&cancelAnimationFrame(e.rafId);ft.clear(),mt.length=0,bt();const e=Array.from(pt.values()).map(e=>e.toast).filter(Boolean);await Promise.allSettled(e.map(async e=>{try{await Lt(e)}catch(e){console.warn("closeAllToasts: failed to close one toast:",e)}}))}catch(e){console.error("closeAllToasts failed:",e)}}()}finally{jt=!1,$t=null}})(),await $t},en=Zt,tn=Zt,nn=864e5;async function on(e,t={},o={}){var i,r,s;const a=t&&"object"==typeof t?t:{},l=o&&"object"==typeof o?o:{},c=null!==(i=a.loading)&&void 0!==i?i:"Loading...",u="object"!=typeof c||null===c||Array.isArray(c)?n(n({},l),{},{type:"info",message:String(c),duration:nn,showProgressBar:!1,pauseOnHover:!1,showLoader:null===(s=l.showLoader)||void 0===s||s}):n(n({},l),{},{type:"info",duration:nn,showProgressBar:!1,pauseOnHover:!1,showLoader:null===(r=l.showLoader)||void 0===r||r},c),d=await Ht(u),p=n(n({},l),{},{pauseOnHover:l.pauseOnHover});try{var f;const t="function"==typeof e?e():e,o=await t;if(d&&"function"==typeof d.dismiss)try{await d.dismiss()}catch(e){}const i="function"==typeof a.success?a.success(o):null!==(f=a.success)&&void 0!==f?f:"Done!",r="object"!=typeof i||null===i||Array.isArray(i)?n(n({},p),{},{type:"success",message:String(i)}):n(n({},p),{},{type:"success"},i);return await Ht(r),o}catch(e){var m;if(d&&"function"==typeof d.dismiss)try{await d.dismiss()}catch(e){}const t="function"==typeof a.error?a.error(e):null!==(m=a.error)&&void 0!==m?m:"Something went wrong.",o="object"!=typeof t||null===t||Array.isArray(t)?n(n({},p),{},{type:"error",message:String(t)}):n(n({},p),{},{type:"error"},t);throw await Ht(o),e}}Ht.promise=on,Ht.dismiss=Jt,Ht.dismissAll=Zt,Ht.clear=Zt,Ht.getHistory=lt,Ht.clearHistory=ct;const rn="3.20.2";function sn(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{jt=!0,$t=(async()=>{try{await kt()}finally{jt=!1,$t=null}})(),await $t}catch(e){console.error("Escape key dismiss failed:",e),jt=!1,$t=null}})();else if("F6"===t.key||(t.altKey||t.metaKey)&&("t"===t.key||"T"===t.key)){const t=(a().targetNode&&"function"==typeof a().targetNode.querySelectorAll?a().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&&sn(window);try{"undefined"!=typeof window&&(window.customizableToast={setConfig:r,getConfig:a,resetConfig:s,shouldReduceMotion:l,version:rn,createToast:Ht,success:Ut,error:Gt,warning:Yt,info:Xt,loading:Qt,custom:Kt,setDefaultColors:qt,setDefaultMessages:Ft,noop:Zt,dismiss:Jt,dismissAll:Zt,clear:Zt,toastPromise:on,promise:on,updateToastByKey:zt,setAudioEnabled:re,isAudioEnabled:se,playTone:te,registerSoundPreset:ne,getSoundPresets:oe,resetSoundPresets:ie,resetAudioContext:ae,getToastPool:Ee,resetToastPool:Le,getToastBroadcaster:He,resetToastBroadcaster:Ue,calculateToastPriority:Qe,categorizeToast:Ke,createGestureDetector:ot,detectPinch:nt,isFlick:et,calculateVelocity:Ze,generateToastId:p,resetToastIdCounter:d,getToastMetrics:gt,registerSpringPreset:ue,getSpringPresets:de,resetSpringPresets:pe,resolveSpringConfig:fe,solveSpring:me,calculateSpringSettlingDuration:he,generateSpringLinearEasing:ye,getSpringTransition:ge,getAudioContext:Y,getAudioAnalyser:Q,setLocale:_,getLocale:E,getAvailableLocales:L,registerLocale:M,resetLocale:B,getToastHistory:lt,clearToastHistory:ct,setHistoryCapacity:ut,resetToastHistory:dt,initKeyboardShortcuts:sn})}catch(Gt){console.error("Global assignment failed:",Gt)}export{he as calculateSpringSettlingDuration,Qe as calculateToastPriority,Ze as calculateVelocity,Ke as categorizeToast,en as clear,ct as clearToastHistory,ot as createGestureDetector,Ht as createToast,Kt as custom,Ht as default,nt as detectPinch,Jt as dismiss,tn as dismissAll,Gt as error,ye as generateSpringLinearEasing,p as generateToastId,Q as getAudioAnalyser,Y as getAudioContext,L as getAvailableLocales,a as getConfig,E as getLocale,oe as getSoundPresets,de as getSpringPresets,ge as getSpringTransition,He as getToastBroadcaster,lt as getToastHistory,gt as getToastMetrics,Ee as getToastPool,Xt as info,sn as initKeyboardShortcuts,se as isAudioEnabled,et as isFlick,Qt as loading,Zt as noop,te as playTone,M as registerLocale,ne as registerSoundPreset,ue as registerSpringPreset,ae as resetAudioContext,s as resetConfig,Oe as resetContainerRegistry,B as resetLocale,ie as resetSoundPresets,pe as resetSpringPresets,Ue as resetToastBroadcaster,dt as resetToastHistory,d as resetToastIdCounter,Ct as resetToastManager,Le as resetToastPool,fe as resolveSpringConfig,re as setAudioEnabled,r as setConfig,qt as setDefaultColors,Ft as setDefaultMessages,ut as setHistoryCapacity,_ as setLocale,l as shouldReduceMotion,me as solveSpring,Ut as success,on as toastPromise,zt as updateToastByKey,rn as version,Yt as warning};
|
|
14
|
+
*/const Me=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}),I={...Me};function yt(t){return t&&typeof t=="object"&&typeof t.appendChild=="function"}function Ne(t={}){if(!t||typeof t!="object"||Array.isArray(t))return x();const{maxVisible:e,maxQueueSize:n,zIndex:r,targetNode:s,disableInlineStyles:i,reducedMotion:o,defaultPosition:c,theme:l,stacked:u,swipeToDismiss:d,sound:a,icon:f,pauseOnHover:m,priorityQueue:p,shadowDom:h,trapFocus:v,priorityScorer:S,onMetrics:T,debug:N}=t;if(h!==void 0&&(I.shadowDom=!!h),v!==void 0&&(I.trapFocus=!!v),N!==void 0&&(I.debug=!!N),e!==void 0){const g=Number(e);Number.isFinite(g)&&g>0&&(I.maxVisible=Math.max(1,Math.floor(g)))}if(n!==void 0){const g=Number(n);Number.isFinite(g)&&g>=0&&(I.maxQueueSize=Math.floor(g))}if(r!==void 0){const g=Number(r);Number.isFinite(g)&&(I.zIndex=Math.trunc(g))}if(s!==void 0&&(I.targetNode=s&&typeof s=="object"&&typeof s.appendChild=="function"?s:null),i!==void 0&&(I.disableInlineStyles=!!i),o!==void 0){const g=String(o||"auto").toLowerCase();["auto","always","never"].includes(g)&&(I.reducedMotion=g,typeof document<"u"&&(g==="always"?document.documentElement.setAttribute("data-toast-reduced-motion","always"):g==="never"?document.documentElement.setAttribute("data-toast-reduced-motion","never"):document.documentElement.removeAttribute("data-toast-reduced-motion")))}if(c!==void 0){const g=String(c||"").toLowerCase().trim();g&&(I.defaultPosition=g)}if(l!==void 0){const g=String(l||"light").toLowerCase();["light","dark","high-contrast","compact","spacious","glass"].includes(g)&&(I.theme=g,typeof document<"u"&&document.documentElement.setAttribute("data-toast-theme",g))}return u!==void 0&&(I.stacked=!!u),d!==void 0&&(I.swipeToDismiss=!!d),a!==void 0&&(I.sound=!!a),f!==void 0&&(I.icon=!!f),m!==void 0&&(I.pauseOnHover=!!m),p!==void 0&&(I.priorityQueue=!!p),S!==void 0&&(I.priorityScorer=typeof S=="function"?S:null),T!==void 0&&(I.onMetrics=typeof T=="function"?T:null),x()}function De(){return Object.assign(I,Me),typeof document<"u"&&(document.documentElement.removeAttribute("data-toast-theme"),document.documentElement.removeAttribute("data-toast-reduced-motion")),x()}function x(){return{...I}}function ht(){return yt(I.targetNode)?I.targetNode:typeof document<"u"?document.body:null}function j(){if(I.reducedMotion==="always")return!0;if(I.reducedMotion==="never")return!1;try{return!!(typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches)}catch{return!1}}let ae=0;function gt(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 bt=gt();function Be(){ae=0}function pe(t="toast"){const e=typeof t=="string"?t.trim().toLowerCase().replace(/[^a-z0-9_-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,""):"",n=e&&!/^[0-9]/.test(e)?e:"toast",r=Date.now().toString(36);ae=ae+1&16777215;const s=ae.toString(36);return`${n}-${r}-${bt}${s}`}async function xt(t,e){const n=document.createElement(t);return n.id=pe(e),n}async function vt(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 wt(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 n=Number.parseFloat(e);return Number.isFinite(n)&&n>=0?n:500}return 500}class St{constructor(e=200){this.maxSize=e,this.map=new Map}get(e){if(!this.map.has(e))return;const n=this.map.get(e);return this.map.delete(e),this.map.set(e,n),n}set(e,n){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,n)}}const ye=new St(200),Ct={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]},he={};Object.entries(Ct).forEach(([t,[e,n,r]])=>{const s=l=>{const u=l/255;return u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4)},i=.2126*s(e)+.7152*s(n)+.0722*s(r),o=(i+.05)/.05,c=1.05/(i+.05);he[t.toLowerCase()]=o>=c?"#000000":"#ffffff"});function O(t){if(!t)return"#ffffff";const e=String(t),n=ye.get(e);if(n)return n;if(he[t?.toLowerCase()]){const y=he[t.toLowerCase()];return ye.set(e,y),y}let r,s,i;function o(y){if(typeof y!="string")return y;let b=y.trim(),w=0;for(;b.toLowerCase().startsWith("var(")&&b.endsWith(")")&&w<5;){w++;const E=b.slice(4,-1).trim(),A=E.indexOf(","),z=(A===-1?E:E.slice(0,A)).trim(),F=A===-1?"":E.slice(A+1).trim();if(!z.startsWith("--"))return b;let $="";try{typeof document<"u"&&typeof getComputedStyle=="function"&&($=getComputedStyle(document.documentElement).getPropertyValue(z).trim())}catch{}if($)b=$;else if(F)b=F;else break}return b}function c(y){const b=y?.match(/^#(?:([0-9a-f]{3,4})|([0-9a-f]{6})|([0-9a-f]{8}))$/i);if(b){let _=b[1]||b[2]||b[3];if((_.length===3||_.length===4)&&(_=_.slice(0,3).split("").map(k=>k+k).join("")),_.length>=6){const k=Number.parseInt(_.slice(0,2),16),C=Number.parseInt(_.slice(2,4),16),ee=Number.parseInt(_.slice(4,6),16);if(Number.isFinite(k)&&Number.isFinite(C)&&Number.isFinite(ee))return{r:k,g:C,b:ee}}return null}const w=_=>{if(typeof _!="string")return Number(_);const k=_.trim();return k.endsWith("%")?Math.round(Number.parseFloat(k)/100*255):Number(k)},E=y?.match(/rgba?\(\s*([\d.]+%?)\s*,\s*([\d.]+%?)\s*,\s*([\d.]+%?)(?:\s*,\s*[\d.%]+)?\s*\)/i);if(E){const _=Math.min(255,Math.max(0,w(E[1]))),k=Math.min(255,Math.max(0,w(E[2]))),C=Math.min(255,Math.max(0,w(E[3])));if(Number.isFinite(_)&&Number.isFinite(k)&&Number.isFinite(C))return{r:_,g:k,b:C}}const A=y?.match(/rgba?\(\s*([\d.]+%?)\s+([\d.]+%?)\s+([\d.]+%?)(?:\s*\/\s*[\d.%]+)?\s*\)/i);if(A){const _=Math.min(255,Math.max(0,w(A[1]))),k=Math.min(255,Math.max(0,w(A[2]))),C=Math.min(255,Math.max(0,w(A[3])));if(Number.isFinite(_)&&Number.isFinite(k)&&Number.isFinite(C))return{r:_,g:k,b:C}}const z=_=>{const k=_.trim().toLowerCase();let C=Number.parseFloat(k);return Number.isFinite(C)?(k.endsWith("turn")?C=C*360:k.endsWith("grad")?C=C*360/400:k.endsWith("rad")&&(C=C*180/Math.PI),(C%360+360)%360/360):0},F=y?.match(/hsla?\(\s*(-?[\d.]+(?:deg|grad|rad|turn)?)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*[\d.%]+)?\s*\)/i),$=!F&&y?.match(/hsla?\(\s*(-?[\d.]+(?:deg|grad|rad|turn)?)\s+([\d.]+)%\s+([\d.]+)%(?:\s*\/\s*[\d.%]+)?\s*\)/i),W=F||$;if(W){const _=z(W[1]),k=Math.min(1,Math.max(0,Number(W[2])/100)),C=Math.min(1,Math.max(0,Number(W[3])/100));if(k===0){const U=Math.round(C*255);return{r:U,g:U,b:U}}const ee=(U,me,pt)=>{let Y=pt;return Y<0&&(Y+=1),Y>1&&(Y-=1),Y<1/6?U+(me-U)*6*Y:Y<1/2?me:Y<2/3?U+(me-U)*(2/3-Y)*6:U},se=C<.5?C*(1+k):C+k-C*k,fe=2*C-se;return{r:Math.round(ee(fe,se,_+1/3)*255),g:Math.round(ee(fe,se,_)*255),b:Math.round(ee(fe,se,_-1/3)*255)}}return null}try{const y=typeof t=="string"?t.trim():String(t||""),b=o(y).trim(),w=c(b);if(!w)throw new Error("Unknown color");({r,g:s,b:i}=w)}catch{r=s=i=128}const l=(y,b,w)=>{y/=255,b/=255,w/=255;const E=Math.max(y,b,w),A=Math.min(y,b,w);let z,F,$=(E+A)/2;if(E===A)z=F=0;else{const W=E-A;switch(F=$>.5?W/(2-E-A):W/(E+A),E){case y:z=(b-w)/W+(b<w?6:0);break;case b:z=(w-y)/W+2;break;case w:z=(y-b)/W+4}z/=6}return[z*360,F,$]},u=(y,b,w)=>{y/=360;let E,A,z;if(b===0)E=A=z=w;else{const F=(_,k,C)=>(C<0&&(C+=1),C>1&&(C-=1),C<.16666666666666666?_+(k-_)*6*C:C<.5?k:C<.6666666666666666?_+(k-_)*(.6666666666666666-C)*6:_),$=w<.5?w*(1+b):w+b-w*b,W=2*w-$;E=F(W,$,y+1/3),A=F(W,$,y),z=F(W,$,y-1/3)}return[Math.round(E*255),Math.round(A*255),Math.round(z*255)]},d=(y,b,w)=>{const E=[y,b,w].map(A=>(A/=255,A<=.03928?A/12.92:Math.pow((A+.055)/1.055,2.4)));return .2126*E[0]+.7152*E[1]+.0722*E[2]},a=(y,b)=>{const w=d(...y),E=d(...b);return(Math.max(w,E)+.05)/(Math.min(w,E)+.05)},f=(y,b,w)=>`#${y.toString(16).padStart(2,"0")}${b.toString(16).padStart(2,"0")}${w.toString(16).padStart(2,"0")}`;let[m,p,h]=l(r,s,i);const v=4.5;let S=h<.5?Math.min(h+.5,1):Math.max(h-.5,0),[T,N,g]=u(m,p,S);if(a([r,s,i],[T,N,g])<v){const y=a([r,s,i],[0,0,0]),b=a([r,s,i],[255,255,255]);[T,N,g]=y>=b?[0,0,0]:[255,255,255]}const D=f(T,N,g);return ye.set(e,D),D}const Pe=new Set(["DIV","SPAN","P","BR","STRONG","B","EM","I","U","SMALL","UL","OL","LI","A","IMG","PRE","CODE","MARK"]),ze=new Set(["href","src","alt","title","class","target","rel","loading"]),Tt=new Set(["SCRIPT","STYLE","IFRAME","NOSCRIPT","OBJECT","EMBED","SVG","MATH","AUDIO","VIDEO","CANVAS","TEMPLATE"]),ge=/^\s*(?:https?:|mailto:|data:image\/(?:png|jpe?g|gif|webp|avif|bmp|ico);|\/(?!\/|\\)|\.\/|\.\.\/|#)/i;function Et(){try{return!!(typeof window<"u"&&window.DOMPurify&&typeof window.DOMPurify.sanitize=="function")}catch{}return!1}function At(t,e){const n=[];Array.from(t.attributes||[]).forEach(s=>{const i=s.name.toLowerCase(),o=s.value;if(!e.has(i)||i.startsWith("on")){n.push(s.name);return}if(i==="href"||i==="src"){const c=typeof o=="string"?o.trim().toLowerCase():"";if((c.startsWith("javascript:")||c.startsWith("vbscript:")||c.startsWith("data:"))&&!(i==="src"&&c.startsWith("data:image/")&&!c.startsWith("data:image/svg+xml"))){if(i==="href"){t.setAttribute("href","#");return}n.push(s.name);return}if(!ge.test(o)){if(i==="href"){t.setAttribute("href","#");return}n.push(s.name);return}}if(i==="target"&&typeof o=="string"&&o.trim().toLowerCase()==="_blank"){const c=(t.getAttribute("rel")||"").split(/\s+/).filter(Boolean);c.includes("noopener")||c.push("noopener"),c.includes("noreferrer")||c.push("noreferrer"),t.setAttribute("rel",c.join(" "))}}),n.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 be(t,e,n){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(Tt.has(r)||r.includes("SCRIPT")||r.includes("<")||r.includes(">"))return null;if(!e.has(r)){const i=document.createDocumentFragment();return Array.from(t.childNodes).forEach(o=>{const c=be(o,e,n);c&&i.appendChild(c)}),i}const s=document.createElement(t.tagName);return Array.from(t.attributes||[]).forEach(i=>{s.setAttribute(i.name,i.value)}),At(s,n),Array.from(t.childNodes).forEach(i=>{const o=be(i,e,n);o&&s.appendChild(o)}),s}function _t(t){if(typeof DOMParser<"u")try{const n=new DOMParser().parseFromString(t,"text/html");if(n&&n.body)return n.body}catch{}if(typeof document<"u"){const e=document.createElement("template");if("content"in e)return e.innerHTML=t,e.content;const n=document.createElement("div");return n.innerHTML=t,n}return null}function kt(t){if(!t||typeof t!="string")return"";const e=_t(t);if(!e)return"";const n=document.createDocumentFragment();Array.from(e.childNodes).forEach(s=>{const i=be(s,Pe,ze);i&&n.appendChild(i)});const r=document.createElement("div");return r.appendChild(n),r.querySelectorAll('a[target="_blank"]').forEach(s=>{const i=(s.getAttribute("rel")||"").split(/\s+/).filter(Boolean);i.includes("noopener")||i.push("noopener"),i.includes("noreferrer")||i.push("noreferrer"),s.setAttribute("rel",i.join(" "))}),r.innerHTML}function xe(t,e={}){if(typeof t!="string"||!t.trim())return"";try{if(!e.forceFallback&&Et()){const r=window.DOMPurify.sanitize(t,{ALLOWED_TAGS:Array.from(Pe),ALLOWED_ATTR:Array.from(ze),ALLOWED_URI_REGEXP:ge}),s=document.createElement("div");return s.innerHTML=r,s.querySelectorAll("a[href]").forEach(i=>{const o=i.getAttribute("href")||"";ge.test(o)||i.setAttribute("href","#")}),s.querySelectorAll('a[target="_blank"]').forEach(i=>{const o=(i.getAttribute("rel")||"").split(/\s+/).filter(Boolean);o.includes("noopener")||o.push("noopener"),o.includes("noreferrer")||o.push("noreferrer"),i.setAttribute("rel",o.join(" "))}),s.innerHTML}}catch(n){console.warn("DOMPurify sanitization failed, falling back:",n)}return kt(t)}function We(t={}){if(typeof document>"u")return null;const e=t&&typeof t=="object"&&!Array.isArray(t)?t:{},n=Number(e.size),r=Number.isFinite(n)&&n>0?n:14,s=typeof e.color=="string"&&e.color.trim()?e.color.trim():"currentColor",i=/[\r\n<>"';]/.test(s)||/^\s*javascript:/i.test(s)?"currentColor":s,o=typeof e.text=="string"?e.text:"",c=document.createElement("span");c.className="toast-loader",c.setAttribute("role","status"),c.setAttribute("aria-label",o||"Loading");const l=x();l.disableInlineStyles||(c.style.display="inline-flex",c.style.alignItems="center",c.style.gap="8px");const u="http://www.w3.org/2000/svg",d=document.createElementNS(u,"svg");d.setAttribute("width",String(r)),d.setAttribute("height",String(r)),d.setAttribute("viewBox","0 0 50 50"),d.setAttribute("aria-hidden","true");const a=document.createElementNS(u,"circle");if(a.classList.add("toast-loader-circle"),a.setAttribute("cx","25"),a.setAttribute("cy","25"),a.setAttribute("r","20"),a.setAttribute("fill","none"),a.setAttribute("stroke",i),a.setAttribute("stroke-width","4"),a.setAttribute("stroke-linecap","round"),l.disableInlineStyles||(a.style.opacity="0.85",a.style.strokeDasharray="90",a.style.strokeDashoffset="60",a.style.transformOrigin="center",j()||(a.style.animation="toast-spinner 1s linear infinite")),d.appendChild(a),c.appendChild(d),o){const f=document.createElement("span");f.className="toast-loader-label",l.disableInlineStyles||(f.style.fontSize="13px"),f.textContent=o,c.appendChild(f)}if(!l.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 m=document.head||document.documentElement;m&&m.appendChild(f)}catch{}return c}function Re(t,e,n){const r=e?.cta;if(!r||typeof r!="object")return;const s=Array.isArray(r)?r.filter(c=>c&&typeof c=="object"):[r];if(s.length===0)return;const i=[];s.forEach((c,l)=>{if(!c||typeof c!="object")return;const u={...c};u.label||(u.label=s.length>1?`Action ${l+1}`:"CTA Label Missing!");const d=u.variant==="link"||!u.variant&&!!u.href,a=document.createElement(d?"a":"button");if(d){if(u.href){const b=String(u.href).trim(),w=/^(javascript:|vbscript:|data:(?!image\/[a-z0-9.+-]+;base64,))/i.test(b);a.href=w?"#":b}else a.setAttribute("role","button"),a.tabIndex=0;u.target&&(a.target=u.target);const y=new Set((u.rel||"").split(/\s+/).filter(Boolean));typeof u.target=="string"&&u.target.trim().toLowerCase()==="_blank"&&(y.add("noopener"),y.add("noreferrer")),a.rel=Array.from(y).join(" ")}else a.type="button";a.setAttribute("aria-label",u.ariaLabel||u.label);const f=u.textColor||u.color||e.textColor||O(e.backgroundColor),m=u.backgroundColor||u.background||(e.backgroundColor?He(e.backgroundColor):"rgba(255,255,255,0.15)"),h=(typeof f=="string"?f.trim():"").match(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/);let v="rgba(128, 128, 128, 0.3)";h&&(v=`${h[1].length===3?`#${h[1][0]}${h[1][0]}${h[1][1]}${h[1][1]}${h[1][2]}${h[1][2]}`:`#${h[1]}`}44`),a.className="toast-cta";const S=e.fontDirection==="rtl";x().disableInlineStyles||Object.assign(a.style,{marginLeft:S?"0px":l===0?"10px":"6px",marginRight:S?l===0?"10px":"6px":"0px",padding:"6px 10px",borderRadius:"6px",fontSize:"12px",fontWeight:"600",lineHeight:"1",border:`1px solid ${v}`,color:f,background:m,cursor:"pointer",whiteSpace:"nowrap",flexShrink:"0",display:"inline-flex",alignItems:"center",textDecoration:"none",outline:"none"}),a.textContent=u.label;const T=async y=>{if(!a._isExecuting){a._isExecuting=!0;try{if(typeof u.onClick=="function"){const b=u.onClick(y);b?.then&&await b}}catch(b){console.error("CTA onClick handler error:",b)}finally{a._isExecuting=!1,u.autoClose!==!1&&typeof n=="function"&&await n(t)}}},N=y=>{d&&!u.href&&(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),T(y))};a.addEventListener("click",T),d&&!u.href&&a.addEventListener("keydown",N);const g=()=>{a.removeEventListener("click",T),d&&!u.href&&a.removeEventListener("keydown",N)};a._cleanup=g,i.push(g);const D=t.querySelector(".toast-undo-btn")||t.querySelector(".toast-close-btn")||t.querySelector(".toast-progress-bar");D?t.insertBefore(a,D):t.appendChild(a)});const o=t._cleanupCTA;t._cleanupCTA=()=>{o?.(),i.forEach(c=>c())}}function Fe(t,e,n){const r=e?.undo;if(!r)return;const s=typeof r=="function";if(!s&&(typeof r!="object"||Array.isArray(r)))return;const i=s?{onUndo:r}:{...r},o=typeof i.label=="string"&&i.label.trim()?i.label.trim():typeof e?.undoText=="string"&&e.undoText.trim()?e.undoText.trim():"Undo",c=Number(e?.duration),l=i.showCountdown!==!1&&Number.isFinite(c)&&c>0,u=document.createElement("button");u.type="button",u.className="toast-undo-btn",u.setAttribute("aria-label",`${o} action`);const d=e.textColor||O(e.backgroundColor),a=e.backgroundColor?He(e.backgroundColor):"rgba(255,255,255,0.18)",m=(typeof d=="string"?d.trim():"").match(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/);let p="rgba(128, 128, 128, 0.35)";m&&(p=`${m[1].length===3?`#${m[1][0]}${m[1][0]}${m[1][1]}${m[1][1]}${m[1][2]}${m[1][2]}`:`#${m[1]}`}55`);const h=e.fontDirection==="rtl";x().disableInlineStyles||Object.assign(u.style,{marginLeft:h?"0px":"10px",marginRight:h?"10px":"0px",padding:"5px 10px",borderRadius:"6px",fontSize:"12px",fontWeight:"700",lineHeight:"1",border:`1px solid ${p}`,color:d,background:a,cursor:"pointer",whiteSpace:"nowrap",flexShrink:"0",display:"inline-flex",alignItems:"center",gap:"4px"});let v=Math.max(1,Math.ceil((c||2500)/1e3));const S=()=>{u.textContent=l?`${o} (${v}s)`:o};S();let T=null,N=!1;l&&(T=setInterval(()=>{N||(v=Math.max(0,v-1),S(),v<=0&&T&&(clearInterval(T),T=null))},1e3),typeof T?.unref=="function"&&T.unref()),t._pauseUndo=()=>{N=!0},t._resumeUndo=()=>{N=!1};const g=()=>{T&&(clearInterval(T),T=null),t._pauseUndo=null,t._resumeUndo=null},D=async b=>{g(),u.removeEventListener("click",D);try{if(typeof i.onUndo=="function"){const w=i.onUndo(b,t);w?.then&&await w}}catch(w){console.error("Undo action error:",w)}finally{typeof n=="function"&&await n(t)}};u.addEventListener("click",D),u._cleanup=()=>{g(),u.removeEventListener("click",D)},t._cleanupUndo=()=>{g(),u.removeEventListener("click",D)};const y=t.querySelector(".toast-close-btn")||t.querySelector(".toast-progress-bar");y?t.insertBefore(u,y):t.appendChild(u)}function $e(t,e,n){const r=document.createElement("button");r.type="button";const s=typeof e?.closeAriaLabel=="string"&&e.closeAriaLabel.trim()?e.closeAriaLabel.trim():"Close notification";r.setAttribute("aria-label",s),r.setAttribute("title",s),r.textContent="\xD7";const i=e.textColor||O(e.backgroundColor);r.className="toast-close-btn";const o=e.fontDirection==="rtl";x().disableInlineStyles||Object.assign(r.style,{background:"none",border:"none",color:i,fontSize:"18px",marginLeft:o?"0px":"10px",marginRight:o?"10px":"0px",cursor:"pointer",lineHeight:"1",padding:"0 4px",flexShrink:"0",display:"inline-flex",alignItems:"center",justifyContent:"center"});const c=()=>{typeof n=="function"&&n(t)};r.addEventListener("click",c),t._cleanupCloseButton=()=>{r.removeEventListener("click",c)},t.appendChild(r)}function He(t){return t&&O(t)==="#000000"?"rgba(0,0,0,0.15)":"rgba(255,255,255,0.15)"}function je(){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 qe(t,e,n={}){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),((n.progressNormalized||e?._progressRatioMode)&&r>0&&r<=1||r>0&&r<1)&&(r=r*100),Math.min(100,Math.max(0,r))):0}function Ue(t,e={}){if(!t)return;const n=document.createElement("div");n.className="toast-progress-bar",t._progressBar=n;const r=e.borderRadius||"0",s=Number.parseInt(r,10),i=Number.isFinite(s)&&s>0?s:0;let o=4,c="4px";if(typeof e.progressHeight=="number"&&Number.isFinite(e.progressHeight)&&e.progressHeight>0)o=e.progressHeight,c=`${o}px`;else if(typeof e.progressHeight=="string"&&e.progressHeight.trim()){const v=e.progressHeight.trim(),S=Number.parseFloat(v);Number.isFinite(S)&&S>0&&(v.endsWith("rem")||v.endsWith("em")?(o=S*16,c=v):(o=S,c=/^\d+(\.\d+)?$/.test(v)?`${S}px`:v))}const l=Number(e.duration??2500),u=Math.max(0,l+5),d=Math.min(i,o*2),a=i>0?`calc(100% - ${d*2}px)`:"100%",f=e.progressDirection==="reverse"||e.progressDirection==="increasing"||e.progressDirection==="ltr",m=e.fontDirection==="rtl"||e.progressDirection==="rtl"||t?.style?.direction==="rtl";n._leftOffset=d,n._finalWidth=a,n._isReverse=f,n._isRtl=m;const p=e.progressBarColor||e.progressColor||"currentColor";x().disableInlineStyles||Object.assign(n.style,{position:"absolute",left:m?"auto":`${d}px`,right:m?`${d}px`:"auto",height:c,background:p,width:f?"0%":`${a}`,transition:`width ${u}ms linear`,[e.progressPosition==="top"?"top":"bottom"]:"0",borderRadius:`${o/2}px`,opacity:"0.8",zIndex:"2",willChange:"width"}),t.appendChild(n);const h=e.progress==="indeterminate"||!!e.showProgressBar&&(e.duration===0||e.duration===1/0)&&e.progress===void 0;if(n._isIndeterminate=h,n._isManualProgress=e.progress!==void 0&&e.progress!=="indeterminate",h){if(n.classList.add("toast-progress-bar-indeterminate"),m&&n.classList.add("toast-progress-bar-indeterminate-rtl"),!x().disableInlineStyles){je();const v=m?"toast-progress-indeterminate-rtl":"toast-progress-indeterminate";n.style.animation=`${v} 1.6s cubic-bezier(0.4, 0, 0.2, 1) infinite`}n.style.width=a;return}if(e.progress!==void 0){const v=qe(e.progress,t,e);n.style.width=`${v}%`,n.style.transition="width 200ms ease";return}if(e.duration===0||e.duration===1/0){n.style.width="0%";return}if(j())n.style.display="none";else if(typeof n.animate=="function"){const v=f?[{width:"0%"},{width:a}]:[{width:a},{width:"0%"}];t._progressAnimation=n.animate(v,{duration:u,easing:"linear",fill:"forwards",delay:50})}else n.style.transition=`width ${u}ms linear`,requestAnimationFrame(()=>{n.style.width=f?a:"0%"})}function Ye(t){if(!t||t._hasAnimated)return;if(j()){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 Xe(t,e){if(!t||typeof t.addEventListener!="function")return;let n=0,r=0,s=0,i=0,o=!1,c=!1,l=null,u=!1;const d=()=>{u&&(u=!1,window.removeEventListener("mousemove",f),window.removeEventListener("mouseup",m))},a=p=>{if(!p||p.button!==void 0&&p.button!==0)return;const h=p.target;if(h&&typeof h.closest=="function"&&h.closest("button, a, input, textarea, select, label"))return;let v=p;p.touches&&p.touches.length>0?(v=p.touches[0],l=v.identifier??null):l=null,n=v.clientX,r=v.clientY,s=n,i=Date.now(),o=!0,c=!1,t._originalTransition=t.style.transition||"",t.style.transition="none",t.style.userSelect="none",!u&&typeof window<"u"&&(u=!0,window.addEventListener("mousemove",f,{passive:!1}),window.addEventListener("mouseup",m,{passive:!0}))},f=p=>{if(!o||!p)return;let h=p;if(p.touches)if(l!==null){for(let g=0;g<p.touches.length;g++)if(p.touches[g].identifier===l){h=p.touches[g];break}}else p.touches.length>0&&(h=p.touches[0]);const v=h.clientX,S=h.clientY,T=v-n,N=S-r;if(!c){if(Math.abs(T)>8&&Math.abs(T)>Math.abs(N))c=!0;else if(Math.abs(N)>8){o=!1,t.style.userSelect="",d();return}}if(c){s=v;const g=Math.max(0,1-Math.abs(T)/280);!x().disableInlineStyles&&!j()&&(t.style.transform=`translateX(${T}px)`,t.style.opacity=String(g)),p.cancelable&&p.preventDefault()}},m=()=>{if(d(),l=null,!o||!c){o=!1,t.style.userSelect="";return}o=!1,t.style.userSelect="";const p=s-n,h=Math.max(1,Date.now()-i),S=(h>0?Math.abs(p)/h:0)>=.65&&Math.abs(p)>=50,T=S?50:75;if(Math.abs(p)>=T){const N=p>0?320:-320,g=S?120:180;!x().disableInlineStyles&&!j()&&(t.style.transition=`transform ${g}ms ease-out, opacity ${g}ms ease-out`,t.style.transform=`translateX(${N}px)`,t.style.opacity="0"),t._swipeTimeout&&clearTimeout(t._swipeTimeout),t._swipeTimeout=setTimeout(()=>{t._swipeTimeout=null,typeof e=="function"&&e(t)},g),typeof t._swipeTimeout?.unref=="function"&&t._swipeTimeout.unref()}else if(!x().disableInlineStyles&&!j()){const N="cubic-bezier(0.34, 1.56, 0.64, 1)";t.style.transition=`transform 200ms ${N}, 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 t._snapbackTimer?.unref=="function"&&t._snapbackTimer.unref()}};t.addEventListener("touchstart",a,{passive:!0}),t.addEventListener("touchmove",f,{passive:!1}),t.addEventListener("touchend",m,{passive:!0}),t.addEventListener("touchcancel",m,{passive:!0}),t.addEventListener("mousedown",a,{passive:!0}),t._cleanupSwipe=()=>{t._swipeTimeout&&(clearTimeout(t._swipeTimeout),t._swipeTimeout=null),t._snapbackTimer&&(clearTimeout(t._snapbackTimer),t._snapbackTimer=null),d(),t.removeEventListener("touchstart",a),t.removeEventListener("touchmove",f),t.removeEventListener("touchend",m),t.removeEventListener("touchcancel",m),t.removeEventListener("mousedown",a)}}function Lt(t){if(!t||typeof t.querySelectorAll!="function")return null;const e=typeof document<"u"&&document.activeElement&&document.activeElement!==document.body?document.activeElement:null,n=()=>Array.from(t.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')).filter(o=>{try{if(typeof o.offsetWidth=="number"&&typeof o.offsetHeight=="number"){const c=typeof window<"u"&&window.getComputedStyle?window.getComputedStyle(o):null;if(c&&(c.display==="none"||c.visibility==="hidden"))return!1;if(typeof document<"u"&&document.body&&(document.body.offsetWidth>0||document.body.offsetHeight>0)&&o.offsetWidth===0&&o.offsetHeight===0)return o===document.activeElement}return!0}catch{return!0}}),r=o=>{if(o.key!=="Tab"||!t.isConnected)return;const c=n();if(c.length===0)return;const l=c[0],u=c[c.length-1];o.shiftKey?(document.activeElement===l||!t.contains(document.activeElement))&&(u.focus(),o.preventDefault()):(document.activeElement===u||!t.contains(document.activeElement))&&(l.focus(),o.preventDefault())};t.addEventListener("keydown",r),typeof document<"u"&&document.addEventListener("keydown",r);const s=setTimeout(()=>{const o=n();o.length>0&&typeof o[0].focus=="function"&&o[0].focus()},30);typeof s?.unref=="function"&&s.unref();const i=()=>{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=i,i}const It="http://www.w3.org/2000/svg",Mt=new Set(["svg","g","path","circle","rect","line","polyline","polygon","ellipse","title","desc","defs","clippath","use"]),Nt=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 Dt(t=""){return/^\s*javascript:/i.test(t)}function ve(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 i=o=>{if(o.nodeType===3)return document.createTextNode(o.textContent||"");if(o.nodeType!==1)return null;const c=o.tagName.toLowerCase();if(!Mt.has(c))return null;const l=document.createElementNS(It,c);if(o.attributes)for(let u=0;u<o.attributes.length;u++){const d=o.attributes[u],a=d.name,f=a.toLowerCase(),m=d.value||"";f.startsWith("on")||Nt.has(f)&&((f==="href"||f==="xlink:href")&&(Dt(m)||c==="use"&&m&&!m.startsWith("#"))||l.setAttribute(a,m))}if(o.childNodes)for(let u=0;u<o.childNodes.length;u++){const d=i(o.childNodes[u]);d&&l.appendChild(d)}return l};return i(s)}catch{return null}}const q={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 Ve(t={}){const e=t&&typeof t=="object"&&!Array.isArray(t)?t:{};let n=e.icon;if(n===void 0){const l=x().icon;l!==void 0&&(n=l)}if(typeof n=="function")try{n=n(e)}catch(l){console.warn("options.icon callback error:",l),n=null}if(n===!1||n===""||n===null||typeof document>"u")return null;const r=e.type,s=x(),i=document.createElement("i");i.className="toast-icon",i.setAttribute("aria-hidden","true");const o=e.fontDirection==="rtl";if(s.disableInlineStyles||Object.assign(i.style,{display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:"0",marginLeft:o?"8px":"0px",marginRight:o?"0px":"8px",lineHeight:"1",fontStyle:"normal"}),n&&typeof n=="object"&&(n.nodeType===1||n.nodeType===11||typeof HTMLElement<"u"&&n instanceof HTMLElement)&&typeof n.cloneNode=="function")return i.appendChild(n.cloneNode(!0)),i;if(typeof n=="string"&&n.trim()){const l=n.trim(),d={check:q.success,checkmark:q.success,success:q.success,cross:q.error,error:q.error,alert:q.warning,warning:q.warning,circle:q.info,info:q.info}[l.toLowerCase()];if(d){const a=ve(d.trim());return a&&i.appendChild(a),i}if(l.startsWith("<svg")&&l.endsWith("</svg>")){const a=ve(l);a?(a.setAttribute("aria-hidden","true"),a.setAttribute("focusable","false"),a.getAttribute("width")||a.setAttribute("width","18"),a.getAttribute("height")||a.setAttribute("height","18"),i.appendChild(a)):i.textContent=l}else i.textContent=l;return i}const c=typeof r=="string"?r.toLowerCase().trim():"";if((n===!0||n===void 0)&&c&&q[c]){const l=ve(q[c].trim());return l&&i.appendChild(l),i}return null}function Bt(t,e,n){const r=String(t||"").toLowerCase(),s=r.includes("top"),i=r.includes("left"),o=r.includes("right"),c=String(e||"").toLowerCase().trim();return c==="fade"?"none":c==="zoom"||c==="scale"?"scale(0.75)":c==="flip"?"perspective(600px) rotateX(45deg)":c==="slide"?i?"translateX(-100%)":o?"translateX(100%)":s?"translateY(-100%)":"translateY(100%)":n?r.includes("center")&&!s&&!r.includes("bottom")?i?"translateX(-36px) scale(0.92)":o?"translateX(36px) scale(0.92)":"scale(0.85)":s?"translateY(-36px) scale(0.92)":"translateY(36px) scale(0.92)":c==="bounce"?s?"translateY(-36px) scale(0.9)":"translateY(36px) scale(0.9)":s?"translateY(-20px)":"translateY(20px)"}async function Pt(t,e,n){const r=x(),s=String(e?.animationType||"").toLowerCase().trim(),i=!!e?.spring||s==="spring",o=i?400:await wt(e?.animationDuration),c=`${o}ms`,l=i?"cubic-bezier(0.34, 1.56, 0.64, 1)":typeof e?.animationEasing=="string"&&e.animationEasing.trim()?e.animationEasing.trim():"ease";t._animationType=e?.animationType;const u=typeof e?.className=="string"&&e.className.trim()?` ${e.className.trim()}`:"";t.className=`toast toast-${e?.type??"info"}${u}`;const d=typeof e?.borderRadius=="number"?`${e.borderRadius}px`:e?.borderRadius,a=typeof e?.maxWidth=="number"?`${e.maxWidth}px`:e?.maxWidth,f=i?`${Math.min(300,o)}ms`:c,m=i?"ease":l;r.disableInlineStyles||Object.assign(t.style,{background:e?.backgroundColor,padding:"12px 16px",marginBottom:"10px",borderRadius:d,overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"space-between",boxShadow:"0 4px 6px rgba(0, 0, 0, 0.1)",minWidth:"250px",maxWidth:a,opacity:"0",position:"relative",cursor:"default",boxSizing:"border-box",userSelect:"text",pointerEvents:"auto",transition:`opacity ${f} ${m}, transform ${c} ${l}`,transform:Bt(e?.position,e?.animationType,i),zIndex:String(r.zIndex),direction:e?.fontDirection&&e.fontDirection!=="auto"?e.fontDirection:void 0});const p=e?.type==="error",h=e?.role||"alert",v=e?.ariaLive||(p?"assertive":"polite");t.setAttribute("role",h),t.setAttribute("aria-live",v),t.tabIndex=0,t._animationDuration=o;const S=document.createElement("span");S.className="toast-message",t._messageSpan=S,e?.wrapText==="truncate"||e?.wrapText==="ellipsis"||e?.wrapText===!1||!e?.wrapText?(S.classList.add("is-truncated"),r.disableInlineStyles||Object.assign(S.style,{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:"3",whiteSpace:"normal",overflow:"hidden",textOverflow:"ellipsis"})):r.disableInlineStyles||Object.assign(S.style,{display:"block",whiteSpace:"normal"});const N=typeof e?.fontSize=="number"?`${e.fontSize}px`:e?.fontSize;r.disableInlineStyles||Object.assign(S.style,{flex:"1",padding:e?.fontPadding,fontFamily:e?.fontFamily,fontSize:N,fontWeight:e?.fontWeight,lineHeight:e?.fontLineHeight,color:e?.textColor,userSelect:"text",wordBreak:"break-word",overflow:"hidden",textOverflow:"ellipsis",direction:e?.fontDirection&&e.fontDirection!=="auto"?e.fontDirection:void 0});const g=!!e.allowHtml,D=e.message??"",y=Ve(e);if(y&&t.appendChild(y),e.loader||e.showLoader){const E=We(e.loader||{});S.appendChild(E);const A=document.createElement("span");A.className="toast-message-spacer",r.disableInlineStyles||(A.style.display="inline-block",A.style.width="8px"),S.appendChild(A)}if(g&&typeof D=="string"&&D.trim().length>0)try{const E=xe(D),A=document.createElement("div");for(A.innerHTML=E;A.firstChild;)S.appendChild(A.firstChild)}catch(E){console.warn("HTML message sanitization failed, falling back to text:",E),S.appendChild(document.createTextNode(String(D)))}else S.appendChild(document.createTextNode(String(D)));if(S.setAttribute("title",S.textContent||""),t.appendChild(S),e?.cta&&typeof e.cta=="object"&&Re(t,e,n),e?.undo&&Fe(t,e,n),e?.showCloseButton&&$e(t,e,n),e?.showProgressBar!==!1&&(e?.showProgressBar||e?.progress!==void 0)&&Ue(t,e),(e?.swipeToDismiss!==void 0?e.swipeToDismiss:r.swipeToDismiss)!==!1&&Xe(t,n),e?.sound!==void 0?e.sound:r.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{}}(e?.trapFocus??r.trapFocus)&&Lt(t),Ye(t)}async function Ge(t={},e){try{const n=x(),r=document.createElement("div"),s=t?.position||n.defaultPosition,i=String(s).toLowerCase().trim();let o="auto",c="auto",l="auto",u="auto",d="none";i.startsWith("top")?o="20px":(i.startsWith("bottom")||i.includes("below"))&&(c="20px"),i.startsWith("left")?l="20px":i.startsWith("right")?u="20px":i==="center"?(l="50%",o="50%",d="translate(-50%, -50%)"):i.includes("center")?i.includes("left")?(l="20px",o="50%",d="translateY(-50%)"):i.includes("right")?(u="20px",o="50%",d="translateY(-50%)"):i.includes("top")?(o="20px",l="50%",d="translateX(-50%)"):i.includes("bottom")&&(c="20px",l="50%",d="translateX(-50%)"):(u="20px",c="20px"),r.className="toast-emergency",r.tabIndex=0,r.setAttribute("role","alert"),r.setAttribute("aria-live","assertive"),n.disableInlineStyles||Object.assign(r.style,{background:"#333",color:"white",padding:"10px 15px",position:"fixed",top:o,bottom:c,left:l,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 a=document.createElement("div"),f=document.createElement("span");if(f.className="toast-emergency-message",n.disableInlineStyles||(f.style.display="inline-block"),t.allowHtml)try{const S=xe(String(t.message||"Emergency Toast Showing!")),T=document.createElement("div");for(T.innerHTML=S;T.firstChild;)f.appendChild(T.firstChild)}catch{f.appendChild(document.createTextNode(String(t.message||"Emergency Toast Showing!")))}else f.textContent=String(t.message||"Emergency Toast Creation Showing!");a.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="\xD7",a.appendChild(m);r.firstChild;)r.removeChild(r.firstChild);r.appendChild(a);let p=null;const h=()=>{p&&clearTimeout(p),m.removeEventListener("click",h),r.remove(),typeof e=="function"&&e(r)};m.addEventListener("click",h);const v=Number(t?.duration)||2500;return p=setTimeout(()=>{m.removeEventListener("click",h),r.remove(),typeof e=="function"&&e(r)},v),typeof p?.unref=="function"&&p.unref(),r}catch(n){return console.error("Emergency toast creation failed:",n),typeof e=="function"&&e(null),null}}async function zt(t,e){let n;const s="toast";try{return n=await xt("div",s),await Pt(n,t,e),n}catch(i){return console.warn("toast creation failed with error showing fallback one: ",i),n=await Ge(t,e),n}}const re=new Map,te=new Map;function le(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 Ke(t){return`toast-container-${le(t)}`}function Wt(){if(re.clear(),te.clear(),typeof document<"u"){const t=document.querySelector("#toast-shadow-host");if(t)try{t.remove()}catch{}}}function Rt(t){if(!t)return;const e=typeof t=="string"&&t.startsWith("toast-container-")?t:Ke(t);re.delete(e),te.delete(e)}function Ft(){return ht()}function $t(t,e){return t?typeof t.getElementById=="function"?t.getElementById(e):typeof t.querySelector=="function"?t.querySelector(`#${e}`):null:null}function Ht(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 Qe(t){const e=x();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 Je(t={},e){const n=x(),r=Ke(t?.position||n.defaultPosition);let s=Ft();if(!s)throw new Error("Toast container root is unavailable");if(!!(t?.shadowDom??n.shadowDom)&&typeof document<"u"&&typeof document.createElement=="function"){let c=null;try{c=s.querySelector?s.querySelector("#toast-shadow-host"):null}catch{}if(c||(c=document.createElement("div"),c.id="toast-shadow-host",c.style.position="fixed",c.style.zIndex=String(n.zIndex||9999),c.style.pointerEvents="none",c.style.inset="0",c.style.overflow="visible",s.appendChild(c)),!c.shadowRoot&&typeof c.attachShadow=="function")try{c.attachShadow({mode:"open"})}catch{}if(c.shadowRoot&&(s=c.shadowRoot,!s.querySelector("style[data-toast-shadow-style]"))){const l=document.createElement("style");l.setAttribute("data-toast-shadow-style","true"),l.textContent=`
|
|
54
|
+
:host { position: fixed; inset: 0; pointer-events: none; z-index: ${n.zIndex||9999}; }
|
|
55
|
+
* { box-sizing: border-box; }
|
|
56
|
+
.toast-container-base {
|
|
57
|
+
position: fixed;
|
|
58
|
+
z-index: ${n.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(l)}}if(te.has(r))return te.get(r);const o=(async()=>{const c=re.get(r);if(Ht(c,s))return c;c&&re.delete(r);let l=$t(s,r);if(l)Qe(l),typeof e=="function"&&await e(l,t);else{const u=s?.ownerDocument||(typeof document<"u"?document:null);if(!u)throw new Error("Document is unavailable");l=u.createElement("div"),l.id=r,l.setAttribute("role","status"),l.setAttribute("aria-atomic","true"),Qe(l),typeof e=="function"&&await e(l,t),s.appendChild(l)}if(typeof s.querySelectorAll=="function"){const u=s.querySelectorAll(`#${r}`);if(u.length>1)for(let d=1;d<u.length;d++)try{u[d].remove()}catch{}}return re.set(r,l),l})();te.set(r,o);try{return await o}finally{te.delete(r)}}const Ze=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"]),Oe=new Set(["top","bottom"]),et=[...Ze,...Oe];function jt(t){return Ze.has(t)}function qt(t){if(t?.classList)for(let e=0;e<et.length;e++)t.classList.remove("toast-position-"+et[e])}async function tt(t,e={}){if(!t||!e||typeof e!="object")throw new Error("Invalid container or position!");const n=x(),r=String(e?.position||n.defaultPosition||"bottom-right").toLowerCase().trim().replace(/\s+/g,"-");let s=r;if(!jt(r)&&!Oe.has(r)&&(console.warn(`Unknown position "${e.position}", defaulting to "bottom-right"`),s="bottom-right"),qt(t),t.classList?.add("toast-position-"+s),x().disableInlineStyles)return;Ut(t);const i=Yt(s);Xt(t,i)||Vt(t,i)||Gt(t,i)}function Ut(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 Yt(t){const e=t.toLowerCase().trim(),n=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"),i=e.startsWith("left")||e.endsWith("left"),o=e.startsWith("right")||e.endsWith("right"),c=e.includes("center");return{hasTop:r,hasBottom:s,hasLeft:i,hasRight:o,hasCenter:c,hasFullWidth:n}}function Xt(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 Vt(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 Gt(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 Kt{constructor(e,n){this.callback=typeof e=="function"?e:()=>{};const r=n===1/0,s=Number.isFinite(n)&&n>=0?n: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(){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(e){console.error("PausableTimer callback error:",e)}},this.remaining),typeof this.timeoutId?.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 R=new Map,B=new Map,M=[];let X=0,ne=0;function we(){return{activeCount:R.size,queueDepth:M.length,visibleCount:X,droppedCount:ne,timestamp:Date.now()}}function P(){const t=x();if(typeof t.onMetrics=="function")try{t.onMetrics(we())}catch(e){console.error("onMetrics callback error:",e)}}function V(t){if(typeof t?.options?.priority=="number"&&Number.isFinite(t.options.priority))return t.options.priority;const e=t?.priority?.score;if(typeof e=="number"&&Number.isFinite(e))return e;const n=x();if(typeof n.priorityScorer=="function")try{const s=n.priorityScorer({type:t?.options?.type||"info",message:t?.options?.message||"",duration:t?.options?.duration,options:t?.options});if(typeof s=="number"&&Number.isFinite(s))return s;if(s&&typeof s.score=="number"&&Number.isFinite(s.score))return s.score}catch(s){console.warn("[Toast] Custom priorityScorer error, falling back to built-in:",s)}return{error:80,warning:60,info:40,success:20}[t?.options?.type]||0}function K(t){if(!t||!t.children||!(t.getAttribute("data-stacked")==="true"))return;if(!t._stackedInitialized&&typeof t.addEventListener=="function"){t._stackedInitialized=!0;const o=()=>{t._isExpanded=!0,K(t)},c=()=>{t._isExpanded=!1,K(t)},l=()=>{t._isExpanded=!0,K(t)},u=d=>{t.contains(d.relatedTarget)||(t._isExpanded=!1,K(t))};t.addEventListener("mouseenter",o),t.addEventListener("mouseleave",c),t.addEventListener("focusin",l),t.addEventListener("focusout",u),t._stackedCleanup=()=>{t.removeEventListener("mouseenter",o),t.removeEventListener("mouseleave",c),t.removeEventListener("focusin",l),t.removeEventListener("focusout",u),t._stackedInitialized=!1}}if(!t.children||t.children.length===0)return;const n=Array.from(t.children),r=n.length,s=!!t._isExpanded,i=!!(t.id&&t.id.includes("top"));n.forEach((o,c)=>{const l=r-1-c,u=s?"expanded":l>=3?"overflow":String(l);if(typeof o.setAttribute=="function"&&o.setAttribute("data-stacked-depth",u),!x().disableInlineStyles)if(o.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)o.style.transform="none",o.style.marginTop="0px",o.style.marginBottom="10px",o.style.opacity="1",o.style.zIndex=String(100+c),o.style.pointerEvents="auto";else if(l===0)o.style.transform="scale(1)",o.style.marginTop="0px",o.style.marginBottom="0px",o.style.opacity="1",o.style.zIndex="30",o.style.pointerEvents="auto";else if(l===1){const d=i?10:-10;o.style.transform=`scale(0.95) translateY(${d}px)`,o.style.marginTop="-55px",o.style.marginBottom="0px",o.style.opacity="0.9",o.style.zIndex="20",o.style.pointerEvents="auto"}else if(l===2){const d=i?20:-20;o.style.transform=`scale(0.90) translateY(${d}px)`,o.style.marginTop="-55px",o.style.marginBottom="0px",o.style.opacity="0.75",o.style.zIndex="10",o.style.pointerEvents="auto"}else{const d=i?30:-30;o.style.transform=`scale(0.85) translateY(${d}px)`,o.style.marginTop="-55px",o.style.marginBottom="0px",o.style.opacity="0",o.style.zIndex="1",o.style.pointerEvents="none"}})}function Qt(t){let e=5381;for(let n=0;n<t.length;n++)e=(e<<5)+e+t.charCodeAt(n);return e>>>0}function Jt(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 i=le(e.position||"bottom-right");return`tag:${String(e.tag).trim()}:${i}`}if(e.groupId!==void 0&&e.groupId!==null&&e.groupId!==""){const i=le(e.position||"bottom-right");return`group:${String(e.groupId).trim()}:${i}`}const n=String(e.type||"info").trim().toLowerCase(),r=Qt(String(e.message||"")).toString(16),s=le(e.position||"bottom-right");return`${n}|${r}|${s}`}async function Zt(t={}){try{const e=Jt(t);if(R.has(e)){const r=R.get(e);if(!r)throw new Error(`Active toast with key ${e} not found`);return r.count++,(t.tag||t.groupId)&&t.message&&r.toast?._messageSpan&&(r.toast._messageSpan.textContent=String(t.message),r.toast._messageSpan.title=String(t.message)),r.timer?.clear(),r.timer=oe(r.toast,t),await ce(r),await Ce(r),P(),e}if(B.has(e)){const r=B.get(e);if(!r)throw new Error(`Pending toast with key ${e} not found`);return r.count++,(t.tag||t.groupId)&&t.message&&(r.options={...r.options,...t}),e}const n={options:t,count:1,rafId:0};return B.set(e,n),n.rafId=requestAnimationFrame(async()=>{const r=B.get(e);if(r){if(B.delete(e),X>=x().maxVisible){const s={options:r.options,key:e,count:r.count},i=x().maxQueueSize??100;if(i<=0){ne++,P();return}const o=M.find(l=>l.key===e);if(o){o.count+=r.count,typeof r.options?.priority=="number"&&(o.options={...o.options,...r.options},o.priority={score:V(o)}),P();return}const c=typeof r.options?.priority=="number"||typeof x().priorityScorer=="function"||M.some(l=>typeof l?.options?.priority=="number");if(c&&(s.priority={score:V(s)}),M.length>=i){if(c){const l=V(s);let u=0,d=V(M[0]);for(let a=1;a<M.length;a++){const f=V(M[a]);f<d&&(u=a,d=f)}if(l<=d){ne++,P();return}M.splice(u,1)}else M.shift();ne++}M.push(s),c&&M.sort((l,u)=>V(u)-V(l)),P(),await nt();return}try{await rt(r.options,e,r.count)}catch(s){console.error("showToast failed:",s)}}}),e}catch(e){console.error("showToast failed:",e)}}async function rt(t,e,n){try{if(!t||typeof t!="object")throw new TypeError("options must be an object");X++;const r=await Je(t,tt);if(!r)throw new Error("Failed to create toast container");const s=await zt(t,G);if(!s)throw new Error("Toast element creation failed");const i=document.createElement("div");i.className="toast-outer-wrapper",x().disableInlineStyles||Object.assign(i.style,{position:"relative",display:"inline-block",overflow:"visible",marginBottom:"10px",zIndex:"0",width:"100%",pointerEvents:"auto"});const o=document.createElement("div");o.className="toast-inner-wrapper",x().disableInlineStyles||Object.assign(o.style,{position:"relative",overflow:"hidden",zIndex:"1"}),o.appendChild(s),i.appendChild(o),r.id.includes("toast-container-")&&(r.appendChild(i),t.stacked&&r.setAttribute("data-stacked","true"),r.getAttribute("data-stacked")==="true"&&K(r)),Ye(s);const c=t.pauseOnHover!==!1&&(t.pauseOnHover===!0||!!t.cta||!!x().pauseOnHover),l={outer:i,toast:s,options:t,count:Math.max(1,Math.floor(n??0)),pauseOnHover:c};R.set(e,l),s._key=e,P(),l.count>1&&await Ce(l),l.timer=oe(s,t),await ce(l)}catch(r){console.error("Something went wrong: ",r),X=Math.max(0,X-1),P(),(document.querySelector('[id^="toast-container-"]')||document.body).appendChild(await Ge(t,G))}}async function Ot(){try{if(R.size===0){if(B.size>0){const[r,s]=Array.from(B.entries()).at(-1);s?.rafId&&cancelAnimationFrame(s.rafId),B.delete(r),P();return}if(M.length>0){M.pop(),P();return}return}let t=null;const e=Array.from(R.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 i=Array.from(s.children||[]);if(i.length===0)return;const o=i.at(-1);o&&(t=o.querySelector('[id^="toast-"]')||o)}),!t)return;const n=t._key?t:t.querySelector('[id^="toast-"]')||t;await G(n)}catch(t){console.error("dismissMostRecent failed:",t)}}async function er(){try{for(const[,e]of B)e?.rafId&&cancelAnimationFrame(e.rafId);B.clear(),M.length=0,P();const t=Array.from(R.values()).map(e=>e.toast).filter(Boolean);await Promise.allSettled(t.map(async e=>{try{await G(e)}catch(n){console.warn("closeAllToasts: failed to close one toast:",n)}}))}catch(t){console.error("closeAllToasts failed:",t)}}function tr(){for(const[,t]of B)t?.rafId&&cancelAnimationFrame(t.rafId);B.clear(),M.length=0;for(const[,t]of R){if(t.timer?.clear(),t.outer?._pauseCleanup?.(),t.toast?._cleanupCloseButton?.(),t.toast?._cleanupCTA?.(),t.toast?._cleanupUndo?.(),t.toast?._cleanupSwipe?.(),t.toast?._cleanupFocusTrap?.(),t.toast?._cleanup?.(),t.toast?._progressAnimation){try{t.toast._progressAnimation.cancel()}catch{}t.toast._progressAnimation=null}const e=t.outer?.querySelector(".toast-count-badge");e?._scaleTimer&&(clearTimeout(e._scaleTimer),e._scaleTimer=null)}typeof document<"u"&&document.querySelectorAll('[id^="toast-container-"]').forEach(e=>{try{e._stackedCleanup?.()}catch{}}),R.clear(),X=0,ne=0,ue=!1,P()}const Se=Ot,rr=er;function oe(t,e){const n=Number(e?.duration);if(e?.duration===1/0||typeof e?.duration=="number"&&e?.duration<=0)return null;const s=(Number.isFinite(n)&&n>0?n:2500)+5,i=new Kt(()=>{G(t).catch(console.error)},s);return i.start(),i}async function ce(t){if(!t.pauseOnHover||!t.outer||!t.timer)return;t.outer._pauseCleanup?.();const{outer:e,timer:n,toast:r}=t,s=()=>{if(r?._progressAnimation)try{r._progressAnimation.pause()}catch{}else if(r?._progressBar)try{if(r._progressBar._isIndeterminate)r._progressBar.style.animationPlayState="paused";else if(!r._progressBar._isManualProgress){const d=window.getComputedStyle(r._progressBar).width;r._progressBar._pausedWidth=d,r._progressBar.style.transition="none",r._progressBar.style.width=d}}catch{}},i=()=>{if(r?._progressAnimation)try{r._progressAnimation.play()}catch{}else if(r?._progressBar)try{if(r._progressBar._isIndeterminate)r._progressBar.style.animationPlayState="running";else if(!r._progressBar._isManualProgress){if(r._progressBar._pausedWidth){const d=n.getRemainingTime?.()??1e3,a=r._progressBar._isReverse,f=r._progressBar._finalWidth||"100%";r._progressBar.style.transition=`width ${Math.max(0,d)}ms linear`,r._progressBar.style.width=a?f:"0%",r._progressBar._pausedWidth=null}}}catch{}},o=()=>{n.pause(),s(),r?._pauseUndo?.(),r?.classList.add("toast-paused")},c=()=>{n.resume(),i(),r?._resumeUndo?.(),r?.classList.remove("toast-paused")},l=d=>{d?.target&&typeof d.target.matches=="function"&&d.target.matches("[tabindex], div, span, button, a")&&(n.pause(),s(),r?._pauseUndo?.(),r?.classList.add("toast-paused"))},u=d=>{e.contains(d.relatedTarget)||(n.resume(),i(),r?._resumeUndo?.(),r?.classList.remove("toast-paused"))};e.addEventListener("mouseenter",o),e.addEventListener("mouseleave",c),e.addEventListener("focusin",l),e.addEventListener("focusout",u),e._pauseCleanup=()=>{e.removeEventListener("mouseenter",o),e.removeEventListener("mouseleave",c),e.removeEventListener("focusin",l),e.removeEventListener("focusout",u)}}async function G(t){if(t?._key)return ie(t._key)}async function ie(t){try{if(!t)return;const e=R.get(t),n=B.get(t);if(n){cancelAnimationFrame(n.rafId),B.delete(t),P();return}const r=M.findIndex(u=>u.key===t);if(r!==-1){M.splice(r,1),P();return}if(!e)return;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 s=e.outer?.querySelector(".toast-count-badge");s?._scaleTimer&&(clearTimeout(s._scaleTimer),s._scaleTimer=null),e.toast?.querySelector("button, a")?._cleanup?.(),R.delete(t),X=Math.max(0,X-1),P(),s&&s.remove();const o=e.toast?._animationDuration??400,c=Math.min(o,300);if(e.toast){if(!x().disableInlineStyles){const u=String(e.options?.position||e.outer?.parentElement?.id||"").toLowerCase(),d=u.includes("top"),a=u.includes("left"),f=u.includes("right"),m=String(e.options?.animationType||"").toLowerCase().trim();let p="translateY(20px)";j()?(e.toast.style.transition="none",e.toast.style.opacity="0"):(m==="fade"?p="none":m==="zoom"||m==="scale"?p="scale(0.75)":m==="flip"?p="perspective(600px) rotateX(-45deg)":m==="slide"?p=a?"translateX(-100%)":f?"translateX(100%)":d?"translateY(-100%)":"translateY(100%)":m==="bounce"?p=d?"translateY(-36px) scale(0.9)":"translateY(36px) scale(0.9)":(e.options?.spring||m==="spring")&&(p=d?"translateY(-28px) scale(0.94)":"translateY(28px) scale(0.94)"),e.toast.style.transition=`opacity ${c}ms ease-in, transform ${c}ms ease-in`,e.toast.style.opacity="0",e.toast.style.transform=p)}e.toast.classList.remove("active")}const l=e.outer?.parentElement;if(await nr(e.outer,e.toast,c),l&&l.children.length===0&&l.id?.startsWith("toast-container-"))try{l._stackedCleanup?.(),Rt(l.id),l.remove()}catch{}else l&&l.getAttribute("data-stacked")==="true"&&K(l);await nt()}catch(e){console.error("Closing Toast failed!: ",e)}}let ue=!1;async function nt(){if(!ue){ue=!0;try{const t=x();for((t.priorityQueue||typeof t.priorityScorer=="function"||M.some(e=>e.options?.priorityQueue||typeof e.options?.priority=="number"))&&M.length>1&&M.sort((e,n)=>V(n)-V(e));X<t.maxVisible&&M.length;){const e=M.shift();if(R.has(e.key)){const n=R.get(e.key);n.count+=e.count,(e.options.tag||e.options.groupId)&&e.options.message&&n.toast?._messageSpan&&(n.toast._messageSpan.textContent=String(e.options.message),n.toast._messageSpan.title=String(e.options.message),n.timer?.clear(),n.timer=oe(n.toast,e.options)),await Ce(n),P();continue}await rt(e.options,e.key,e.count)}P()}finally{ue=!1}}}async function nr(t,e,n=400){return t?new Promise(r=>{let s=!1,i=null;const o=e||t.firstElementChild||t,c=()=>{if(!s){s=!0,i&&(clearTimeout(i),i=null);try{o?.removeEventListener?.("transitionend",l,!0)}catch{}vt(t).catch(console.error),r()}};if(j()||n<=0){c();return}const l=d=>{try{if(d.target!==o)return;(d.propertyName==="transform"||(!o.style.transform||o.style.transform==="none"||o.style.transform==="initial")&&d.propertyName==="opacity")&&c()}catch(a){console.error("removeWithTransition error:",a)}};if(!o)return c();try{o.addEventListener("transitionend",l,!0)}catch(d){console.error("removeWithTransition error:",d)}const u=n+100;i=setTimeout(c,u),typeof i?.unref=="function"&&i.unref()}):Promise.resolve()}async function Ce({outer:t,count:e}){if(!t||!(t instanceof HTMLElement))throw new Error("updateBadge: outer must be a valid HTMLElement");if(e<2){const r=t.querySelector(".toast-count-badge");r&&r.remove();return}let n=t.querySelector(".toast-count-badge");n||(n=document.createElement("span"),n.className="toast-count-badge",n.setAttribute("aria-label",`${e} identical notifications`),x().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"}),t.appendChild(n)),n.textContent=e>99?"99+":String(e);try{j()||(n._scaleTimer&&clearTimeout(n._scaleTimer),n.style.transform="scale(1.2)",n._scaleTimer=setTimeout(()=>{n.style.transform="scale(1)",n._scaleTimer=null},150),typeof n._scaleTimer?.unref=="function"&&n._scaleTimer.unref())}catch(r){console.error("updateBadge animation error:",r)}}async function Te(t,e={}){if(!t||typeof e!="object"||e===null)return;if(B.has(t)){const a=B.get(t);a.options={...a.options,...e};return}const n=M.find(a=>a.key===t);if(n){n.options={...n.options,...e};return}const r=R.get(t);if(!r||!r.toast)return;const s={...r.options};r.options={...r.options,...e};const i=r.toast,o=i._messageSpan||i.querySelector(".toast-message")||i.querySelector("span:not(.toast-count-badge)");if(e.message!==void 0){const a=String(e.message??""),f=e.allowHtml!==void 0?!!e.allowHtml:!!r.options.allowHtml,m=(e.type==="success"||e.type==="error"||e.type==="warning"||e.type==="info")&&e.showLoader!==!0;if(o){const p=o.querySelector(".toast-loader");if(o.innerHTML="",p&&e.showLoader!==!1&&e.loader!==null&&!m){o.appendChild(p);const h=document.createElement("span");h.style.display="inline-block",h.style.width="8px",o.appendChild(h)}if(f&&a.trim().length>0)try{const h=xe(a),v=document.createElement("div");for(v.innerHTML=h;v.firstChild;)o.appendChild(v.firstChild)}catch{o.appendChild(document.createTextNode(a))}else o.appendChild(document.createTextNode(a));o.setAttribute("title",o.textContent||"")}}const c=(e.type==="success"||e.type==="error"||e.type==="warning"||e.type==="info")&&e.showLoader!==!0;if(e.showLoader===!1||e.loader===null||c){const a=o?.querySelector(".toast-loader");a&&(a.nextSibling&&a.nextSibling.nodeName==="SPAN"&&a.nextSibling.remove(),a.remove())}else if((e.showLoader===!0||e.loader&&typeof e.loader=="object")&&o&&!o.querySelector(".toast-loader")){const a=We(e.loader||{});o.insertBefore(a,o.firstChild);const f=document.createElement("span");f.style.display="inline-block",f.style.width="8px",o.insertBefore(f,a.nextSibling)}if(e.type){const a=String(e.type).toLowerCase().trim();i.className=i.className.replace(/\btoast-(info|success|error|warning)\b/g,`toast-${a}`);const f=a==="error";if(e.role?i.setAttribute("role",e.role):i.setAttribute("role","alert"),i.setAttribute("aria-live",e.ariaLive||(f?"assertive":"polite")),!e.backgroundColor){const m={success:"#28a745",error:"#dc3545",warning:"#ffc107",info:"#17a2b8"};m[a]&&(i.style.background=m[a])}}if(e.icon!==void 0||e.type!==void 0){const a=i?.querySelector(".toast-icon");a&&a.remove();const f={...r.options,...e},m=Ve(f);m&&(o?i.insertBefore(m,o):i.appendChild(m))}if(e.backgroundColor&&(i.style.background=e.backgroundColor),e.textColor)i.style.color=e.textColor,o&&(o.style.color=e.textColor);else if(e.type||e.backgroundColor){const a=i.style.background;if(a){const f=O(a);i.style.color=f,o&&(o.style.color=f)}}if(e.borderRadius!==void 0){const a=typeof e.borderRadius=="number"?`${e.borderRadius}px`:e.borderRadius;i.style.borderRadius=a}if(e.maxWidth!==void 0){const a=typeof e.maxWidth=="number"?`${e.maxWidth}px`:e.maxWidth;i.style.maxWidth=a}if(e.fontDirection!==void 0){const a=e.fontDirection!=="auto"?e.fontDirection:"";i.style.direction=a,o&&(o.style.direction=a);const f=a==="rtl";i.querySelectorAll(".toast-cta, .toast-undo-btn, .toast-close-btn").forEach(m=>{m.style.marginLeft=f?"0px":"10px",m.style.marginRight=f?"10px":"0px"})}if(e.fontSize!==void 0){const a=typeof e.fontSize=="number"?`${e.fontSize}px`:e.fontSize;i.style.fontSize=a,o&&(o.style.fontSize=a)}if(e.fontFamily!==void 0&&(i.style.fontFamily=e.fontFamily,o&&(o.style.fontFamily=e.fontFamily)),e.fontWeight!==void 0){const a=typeof e.fontWeight=="number"?String(e.fontWeight):e.fontWeight;i.style.fontWeight=a,o&&(o.style.fontWeight=a)}if(e.fontLineHeight!==void 0&&(i.style.lineHeight=e.fontLineHeight,o&&(o.style.lineHeight=e.fontLineHeight)),e.fontPadding!==void 0&&o&&(o.style.padding=e.fontPadding),e.wrapText!==void 0&&o&&(e.wrapText==="truncate"||e.wrapText==="ellipsis"||e.wrapText===!1||!e.wrapText?(o.classList.add("is-truncated"),x().disableInlineStyles||Object.assign(o.style,{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:"3",whiteSpace:"normal",overflow:"hidden",textOverflow:"ellipsis"})):(o.classList.remove("is-truncated"),x().disableInlineStyles||Object.assign(o.style,{display:"block",WebkitBoxOrient:"",WebkitLineClamp:"",whiteSpace:"normal",overflow:"visible",textOverflow:"clip"}))),e.role!==void 0&&i.setAttribute("role",e.role),e.ariaLive!==void 0&&i.setAttribute("aria-live",e.ariaLive),e.className!==void 0){const a=s.className;a&&typeof a=="string"&&i.classList.remove(...a.trim().split(/\s+/)),e.className&&typeof e.className=="string"&&i.classList.add(...e.className.trim().split(/\s+/))}let l=i.querySelector(".toast-progress-bar");if(e.showProgressBar===!1){if(i._progressAnimation){try{i._progressAnimation.cancel()}catch{}i._progressAnimation=null}l&&l.remove(),i._progressBar=null,l=null}else!l&&e.showProgressBar!==!1&&(e.progress!==void 0||e.showProgressBar===!0)&&(Ue(i,{...r.options,...e,showProgressBar:!0}),l=i.querySelector(".toast-progress-bar"));if(l){if(e.progress!==void 0)if(e.progress==="indeterminate"){if(l._isIndeterminate=!0,l._isManualProgress=!1,i._progressAnimation){try{i._progressAnimation.cancel()}catch{}i._progressAnimation=null}l.classList.add("toast-progress-bar-indeterminate");const a=l._isRtl||e.fontDirection==="rtl"||e.progressDirection==="rtl";if(a&&l.classList.add("toast-progress-bar-indeterminate-rtl"),!x().disableInlineStyles){je();const f=a?"toast-progress-indeterminate-rtl":"toast-progress-indeterminate";l.style.animation=`${f} 1.6s cubic-bezier(0.4, 0, 0.2, 1) infinite`}l.style.width=l._finalWidth||"100%"}else{const a=qe(e.progress,i,{...r.options,...e});if(l._isIndeterminate=!1,l._isManualProgress=!0,l.classList.remove("toast-progress-bar-indeterminate"),l.classList.remove("toast-progress-bar-indeterminate-rtl"),l.style.animation="none",i._progressAnimation){try{i._progressAnimation.cancel()}catch{}i._progressAnimation=null}l.style.transition="width 200ms ease",l.style.width=`${a}%`}if((e.progressBarColor||e.progressColor)&&(l.style.background=e.progressBarColor||e.progressColor),e.progressPosition&&(l.style.top=e.progressPosition==="top"?"0":"auto",l.style.bottom=e.progressPosition==="bottom"?"0":"auto"),e.progressHeight!==void 0){const a=typeof e.progressHeight=="number"?`${e.progressHeight}px`:e.progressHeight;l.style.height=a}}if(e.animationType!==void 0&&(r.options.animationType=e.animationType,i._animationType=e.animationType),e.spring!==void 0&&(r.options.spring=e.spring),e.swipeToDismiss!==void 0&&(r.options.swipeToDismiss=e.swipeToDismiss,e.swipeToDismiss===!1?(i._cleanupSwipe?.(),i._cleanupSwipe=null):e.swipeToDismiss===!0&&!i._cleanupSwipe&&Xe(i,G)),e.duration!==void 0){r.timer?.clear();const a=Number(e.duration);if(Number.isFinite(a)&&a>0){if(r.timer=oe(i,{duration:a}),await ce(r),l&&!l._isManualProgress&&!l._isIndeterminate){const f=a+5;if(i._progressAnimation){try{i._progressAnimation.cancel()}catch{}const m=l._isReverse,p=l._finalWidth||"100%",h=m?[{width:"0%"},{width:p}]:[{width:p},{width:"0%"}];i._progressAnimation=l.animate(h,{duration:f,easing:"linear",fill:"forwards",delay:0})}else{l.style.transition=`width ${f}ms linear`;const m=l._isReverse,p=l._finalWidth||"100%";l.style.width=m?p:"0%"}}}else if(r.timer=null,l&&!l._isManualProgress&&!l._isIndeterminate){if(i._progressAnimation){try{i._progressAnimation.cancel()}catch{}i._progressAnimation=null}l.style.width="0%"}}else(r.options.duration===0||!r.timer)&&(e.type==="success"||e.type==="error"||e.type==="warning"||e.showLoader===!1)&&(r.options.duration=2500,r.timer?.clear(),r.timer=oe(i,{duration:2500}),await ce(r));if(e.cta!==void 0&&(i._cleanupCTA&&(i._cleanupCTA(),i._cleanupCTA=null),i.querySelectorAll(".toast-cta").forEach(a=>a.remove()),e.cta&&typeof e.cta=="object")){const a={...r.options,...e};Re(i,a,G)}if(e.undo!==void 0&&(i._cleanupUndo&&(i._cleanupUndo(),i._cleanupUndo=null),i.querySelectorAll(".toast-undo-btn").forEach(a=>a.remove()),e.undo)){const a={...r.options,...e};Fe(i,a,G)}if(e.showCloseButton!==void 0){const a=i.querySelector(".toast-close-btn");if(e.showCloseButton===!1)i._cleanupCloseButton&&(i._cleanupCloseButton(),i._cleanupCloseButton=null),a&&a.remove();else if(e.showCloseButton===!0&&!a){const f={...r.options,...e};$e(i,f,G)}}if(e.sound!==void 0?!!e.sound:!!(e.type&&(r.options.sound||x().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 d=i.closest('[id^="toast-container-"]');d&&(e.stacked===!0?(d.setAttribute("data-stacked","true"),K(d)):e.stacked===!1?(d.removeAttribute("data-stacked"),d._stackedCleanup?.(),Array.from(d.children).forEach(a=>{a.removeAttribute("data-stacked-depth"),a.style.transform="",a.style.marginTop="",a.style.marginBottom="10px",a.style.opacity="",a.style.zIndex="",a.style.pointerEvents="auto"})):d.getAttribute("data-stacked")==="true"&&K(d))}let Ee={success:"#28a745",error:"#dc3545",warning:"#ffc107",info:"#17a2b8"};const or={success:"Operation completed successfully!",error:"Something went wrong!",warning:"Warning message!",info:"Information message!",loading:"Loading, please wait..."};let Ae={},_e=!1,ke=null;async function ir(){if(!_e&&!(typeof window>"u"||typeof document>"u")){if(document.readyState==="complete"||document.readyState==="interactive"){_e=!0;return}ke||(ke=new Promise(t=>{document.addEventListener("DOMContentLoaded",()=>{_e=!0,t()},{once:!0})})),await ke}}async function sr(t={}){try{const e=await cr(t);return await lr(e),await Zt(e)}catch(e){return console.error("CreateToast failed:",e),null}}async function ar(t={}){return typeof window<"u"&&typeof document<"u"?(await ir(),await sr(t)):(console.warn("ToastNotification: running in non-browser environment, no DOM available."),null)}async function lr(t){try{return await Je(t,tt)}catch(e){return console.error("Failed to create toast container:",e),x().targetNode||document.body}}function Q(t,e){const n=typeof e=="object"&&e!==null&&!Array.isArray(e)?e:{};return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"?{...n,message:String(t)}:t instanceof Error?{...n,message:t.message||String(t)}:typeof t=="object"&&t!==null&&!Array.isArray(t)?{...n,...t}:{...n}}async function cr(t){const e=Q(t),n=x(),r=String(e?.position??n.defaultPosition).toLowerCase().trim(),s=r?.includes("top-full-width")||r?.includes("bottom-full-width")?"100vw":"400px",o={...{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:s},...e};o.message=e?.message??o.message;try{if(!o.backgroundColor){const c=typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)")?.matches;o.backgroundColor=Ee?.[o.type]??(c?"#f5f5f5":"#111111")}}catch(c){console.warn("Background color resolution failed:",c),o.backgroundColor||(o.backgroundColor="#111111")}try{o.message=o.message||Ae[o.type]||or[o.type]||"No Message Provided!"}catch(c){console.warn("Default message resolution failed:",c)}try{!o.textColor&&o.backgroundColor&&(o.textColor=O(o.backgroundColor))}catch(c){console.warn("Text color resolution failed:",c)}try{const c=e?.progressBarColor||e?.progressColor;c?(o.progressColor=c,o.progressBarColor=c):!o.progressColor&&o.backgroundColor&&(o.progressColor=o.textColor||O(o.backgroundColor),o.progressBarColor=o.progressColor)}catch(c){console.warn("Progress bar color resolution failed:",c)}return typeof o.message!="string"&&(o.message="No Message Provided!"),o}function ot(t){try{if(t&&typeof t=="object"&&!Array.isArray(t)){const e=["success","error","warning","info"],n={};for(const[r,s]of Object.entries(t))e.includes(r)&&typeof s=="string"&&s.trim()&&(n[r]=s.trim());Object.keys(n).length>0&&(Ee={...Ee,...n})}}catch(e){console.error("setDefaultColors failed:",e)}}function it(t){try{if(t&&typeof t=="object"&&!Array.isArray(t)){const e=["success","error","warning","info"],n={};for(const[r,s]of Object.entries(t))e.includes(r)&&typeof s=="string"&&s.trim()&&(n[r]=s.trim());Object.keys(n).length>0&&(Ae={...Ae,...n})}}catch(e){console.error("setDefaultMessages failed:",e)}}let J=!1,H=null;async function ur(t){if(J&&H)try{await H}catch(e){console.warn("Previous close operation failed (continuing anyway):",e)}return t()}const dr=ar;async function L(t={},e){const n=Q(t,e),r=await ur(()=>dr(n));return{id:r,dismiss:()=>r?ie(r):Promise.resolve(),update:s=>r?Te(r,s):Promise.resolve()}}L.success=(t,e)=>{const n=Q(t,e);return L({...n,type:"success"})},L.error=(t,e)=>{const n=Q(t,e);return L({...n,type:"error"})},L.warning=(t,e)=>{const n=Q(t,e);return L({...n,type:"warning"})},L.info=(t,e)=>{const n=Q(t,e);return L({...n,type:"info"})},L.loading=(t,e)=>{const n=Q(t,e);return L({type:"info",showLoader:!0,duration:0,showProgressBar:!1,pauseOnHover:!1,...n})},L.custom=(t,e)=>{const n=Q(t,e);return L({allowHtml:!0,...n})};const st=L.success,at=L.error,lt=L.warning,ct=L.info,ut=L.loading,dt=L.custom,Le=async t=>{let e=t;if(t&&typeof t.then=="function")try{e=await t}catch{return}J=!0,H=(async()=>{try{typeof e=="string"&&e.length>0?await ie(e):e&&typeof e=="object"?typeof e.dismiss=="function"?await e.dismiss():e._key&&typeof e._key=="string"?await ie(e._key):e.id&&typeof e.id=="string"?await ie(e.id):await Se():await Se()}finally{J=!1,H=null}})(),await H},Z=async()=>{J=!0,H=(async()=>{try{await rr()}finally{J=!1,H=null}})(),await H},fr=Z,mr=Z,ft=1440*60*1e3;async function de(t,e={},n={}){const r=e&&typeof e=="object"?e:{},s=n&&typeof n=="object"?n:{},i=r.loading??"Loading...",o=typeof i=="object"&&i!==null&&!Array.isArray(i)?{...s,type:"info",duration:ft,showProgressBar:!1,pauseOnHover:!1,showLoader:s.showLoader??!0,...i}:{...s,type:"info",message:String(i),duration:ft,showProgressBar:!1,pauseOnHover:!1,showLoader:s.showLoader??!0},c=await L(o),l={...s,pauseOnHover:s.pauseOnHover};try{const d=await(typeof t=="function"?t():t);if(c&&typeof c.dismiss=="function")try{await c.dismiss()}catch{}const a=typeof r.success=="function"?r.success(d):r.success??"Done!",f=typeof a=="object"&&a!==null&&!Array.isArray(a)?{...l,type:"success",...a}:{...l,type:"success",message:String(a)};return await L(f),d}catch(u){if(c&&typeof c.dismiss=="function")try{await c.dismiss()}catch{}const d=typeof r.error=="function"?r.error(u):r.error??"Something went wrong.",a=typeof d=="object"&&d!==null&&!Array.isArray(d)?{...l,type:"error",...d}:{...l,type:"error",message:String(d)};throw await L(a),u}}L.promise=de,L.dismiss=Le,L.dismissAll=Z,L.clear=Z;const mt="4.0.0";function Ie(t=typeof window<"u"?window:null){if(!t||!t.document||t.__customizableToastEscapeAttached)return;t.__customizableToastEscapeAttached=!0;const e=n=>{if(n.key==="Escape"||n.key==="Esc")(async()=>{try{J=!0,H=(async()=>{try{await Se()}finally{J=!1,H=null}})(),await H}catch(r){console.error("Escape key dismiss failed:",r),J=!1,H=null}})();else if(n.key==="F6"||(n.altKey||n.metaKey)&&(n.key==="t"||n.key==="T")){const s=(x().targetNode&&typeof x().targetNode.querySelectorAll=="function"?x().targetNode:t.document).querySelectorAll('[id^="toast-container-"] [id^="toast-"]');if(s.length>0){const i=s[s.length-1],o=i.querySelector("button, a, [tabindex='0']");o&&typeof o.focus=="function"?o.focus():typeof i.focus=="function"&&i.focus()}}};t.addEventListener("keydown",e,{passive:!0})}typeof window<"u"&&typeof document<"u"&&Ie(window);try{typeof window<"u"&&(window.customizableToast={setConfig:Ne,getConfig:x,resetConfig:De,shouldReduceMotion:j,version:mt,createToast:L,success:st,error:at,warning:lt,info:ct,loading:ut,custom:dt,setDefaultColors:ot,setDefaultMessages:it,noop:Z,dismiss:Le,dismissAll:Z,clear:Z,toastPromise:de,promise:de,updateToastByKey:Te,generateToastId:pe,resetToastIdCounter:Be,getToastMetrics:we,initKeyboardShortcuts:Ie})}catch(t){console.error("Global assignment failed:",t)}export{fr as clear,L as createToast,dt as custom,L as default,Le as dismiss,mr as dismissAll,at as error,pe as generateToastId,x as getConfig,we as getToastMetrics,ct as info,Ie as initKeyboardShortcuts,ut as loading,Z as noop,De as resetConfig,Wt as resetContainerRegistry,Be as resetToastIdCounter,tr as resetToastManager,Ne as setConfig,ot as setDefaultColors,it as setDefaultMessages,j as shouldReduceMotion,st as success,de as toastPromise,Te as updateToastByKey,mt as version,lt as warning};
|
|
16
117
|
//# sourceMappingURL=index.esm.mjs.map
|