customizable-toast-notification 3.18.0 → 3.18.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/README.md +3 -1
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.d.ts +103 -49
- package/dist/index.css.map +2 -2
- package/dist/index.esm.mjs +3 -3
- package/dist/index.esm.mjs.map +1 -1
- package/dist/index.umd.js +3 -3
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
## [3.18.2](https://github.com/sammy-cool/customizable-toast-notification/compare/v3.18.1...v3.18.2) (2026-10-24)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **core:** harden icons, loader, audio teardown, and css type declarations ([4c2ff53](https://github.com/sammy-cool/customizable-toast-notification/commit/4c2ff5350b3bddda6b8a3aa09538183833fbf2a9))
|
|
7
|
+
* **core:** harden priority queue eviction, html sanitizer parity, and css color parsing ([b621673](https://github.com/sammy-cool/customizable-toast-notification/commit/b621673e6c35b925b62c8f955021335f7e2c1ccc))
|
|
8
|
+
|
|
9
|
+
## [3.18.1](https://github.com/sammy-cool/customizable-toast-notification/compare/v3.18.0...v3.18.1) (2026-10-11)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* **animation:** harden progress bar indeterminate state and swipe snapback ([38faf63](https://github.com/sammy-cool/customizable-toast-notification/commit/38faf630acaad1b010a4efe81af12352c4d55cef))
|
|
15
|
+
|
|
1
16
|
# [3.18.0](https://github.com/sammy-cool/customizable-toast-notification/compare/v3.17.0...v3.18.0) (2026-10-11)
|
|
2
17
|
|
|
3
18
|
|
package/README.md
CHANGED
|
@@ -223,7 +223,9 @@ auto-dismissed on its own — they no-op gracefully rather than throwing. You ca
|
|
|
223
223
|
| `sound` | `boolean \| string`| `false` | Zero-asset audio chime (`true`, `'success'`, `'error'`, `'warning'`, `'pop'`) |
|
|
224
224
|
| `soundPreset` | `string` | `"modern"` | Audio synth theme: `"modern"`, `"retro"`, `"futuristic"`, `"subtle"`, `"bell"` |
|
|
225
225
|
| `swipeToDismiss` | `boolean` | `true` | Mobile touch swipe-to-dismiss gesture with physics |
|
|
226
|
-
| `
|
|
226
|
+
| `progressDirection` | `string` | `"decreasing"` | Progress bar fill direction: `"decreasing"`, `"increasing"`, `"reverse"`, `"ltr"` |
|
|
227
|
+
| `progressBarColor` | `string` | Falls back to `textColor` | Alias for `progressColor` (accepts hex, rgb, hsl, CSS var) |
|
|
228
|
+
| `progress` | `number \| 'indeterminate'`| `undefined` | Explicit percentage (0 to 100) or `"indeterminate"` moving gradient |
|
|
227
229
|
| `usePool` | `boolean` | `false` | Virtual element pooling for DOM recycling in high-frequency rendering |
|
|
228
230
|
| `cta` | `object \| array` | `null` | Call-to-action configuration (see [CTA](#call-to-action)) |
|
|
229
231
|
| `undo` | `function \| object`| `null` | Action Undo button with live dynamic countdown badge (see [Undo](#️-action-undo-with-live-countdown)) |
|
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Customizable Toast Notifications
|
|
3
|
-
* Build: 2026-10-
|
|
4
|
-
* Cache-Buster:
|
|
3
|
+
* Build: 2026-10-24 03:52:13
|
|
4
|
+
* Cache-Buster: 1792813933783
|
|
5
5
|
* Author: Priyanshu Patel
|
|
6
6
|
* Email: priyanshu.alt191@gmail.com
|
|
7
7
|
* License: Apache-2.0
|
|
@@ -12,5 +12,5 @@
|
|
|
12
12
|
* Supports flexible positioning, theming, icons, animations, and timing options
|
|
13
13
|
* out of the box — with CTA support and zero dependencies.
|
|
14
14
|
*/
|
|
15
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e=Object.freeze({maxVisible:3,maxQueueSize:100,zIndex:9999,targetNode:null,disableInlineStyles:!1,reducedMotion:"auto",defaultPosition:"bottom-right",theme:"light",stacked:!1,swipeToDismiss:!0,sound:!0,soundPreset:"modern",pauseOnHover:!1,syncTabs:!1,aiPrioritization:!1,priorityScorer:null,onMetrics:null,debug:!1}),t={...e};function n(e={}){if(!e||"object"!=typeof e||Array.isArray(e))return i();const{maxVisible:n,maxQueueSize:o,zIndex:r,targetNode:s,disableInlineStyles:a,reducedMotion:l,defaultPosition:c,theme:u,stacked:d,swipeToDismiss:p,sound:f,soundPreset:m,pauseOnHover:h,syncTabs:y,aiPrioritization:g,priorityScorer:b,onMetrics:w,debug:x}=e;if(void 0!==x&&(t.debug=Boolean(x)),void 0!==n){const e=Number(n);Number.isFinite(e)&&e>0&&(t.maxVisible=Math.max(1,Math.floor(e)))}if(void 0!==o){const e=Number(o);Number.isFinite(e)&&e>=0&&(t.maxQueueSize=Math.floor(e))}if(void 0!==r){const e=Number(r);Number.isFinite(e)&&(t.zIndex=Math.trunc(e))}if(void 0!==s&&(t.targetNode=s&&"object"==typeof s&&"function"==typeof s.appendChild?s:null),void 0!==a&&(t.disableInlineStyles=Boolean(a)),void 0!==l){const e=String(l||"auto").toLowerCase();["auto","always","never"].includes(e)&&(t.reducedMotion=e,"undefined"!=typeof document&&("always"===e?document.documentElement.setAttribute("data-toast-reduced-motion","always"):"never"===e?document.documentElement.setAttribute("data-toast-reduced-motion","never"):document.documentElement.removeAttribute("data-toast-reduced-motion")))}if(void 0!==c){const e=String(c||"").toLowerCase().trim();e&&(t.defaultPosition=e)}if(void 0!==u){const e=String(u||"light").toLowerCase();["light","dark","high-contrast","compact","spacious","glass"].includes(e)&&(t.theme=e,"undefined"!=typeof document&&document.documentElement.setAttribute("data-toast-theme",e))}if(void 0!==d&&(t.stacked=Boolean(d)),void 0!==p&&(t.swipeToDismiss=Boolean(p)),void 0!==f&&(t.sound=Boolean(f)),void 0!==m){const e=String(m||"modern").toLowerCase().trim();e&&(t.soundPreset=e)}return void 0!==h&&(t.pauseOnHover=Boolean(h)),void 0!==y&&(t.syncTabs=Boolean(y)),void 0!==g&&(t.aiPrioritization=Boolean(g)),void 0!==b&&(t.priorityScorer="function"==typeof b?b:null),void 0!==w&&(t.onMetrics="function"==typeof w?w:null),i()}function o(){return Object.assign(t,e),"undefined"!=typeof document&&(document.documentElement.removeAttribute("data-toast-theme"),document.documentElement.removeAttribute("data-toast-reduced-motion")),i()}function i(){return{...t}}function r(){if("always"===t.reducedMotion)return!0;if("never"===t.reducedMotion)return!1;try{return Boolean("undefined"!=typeof window&&"function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches)}catch{return!1}}let s=0;const a=Math.floor(65535*Math.random()).toString(36).padStart(3,"0");function l(){s=0}function c(e="toast"){const t="string"==typeof e?e.trim().toLowerCase().replace(/[^a-z0-9_-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,""):"",n=t&&!/^[0-9]/.test(t)?t:"toast",o=Date.now().toString(36);s=s+1&16777215;const i=s.toString(36);return`${n}-${o}-${a}${i}`}const u=new class{constructor(e=200){this.maxSize=e,this.map=new Map}get(e){if(!this.map.has(e))return;const t=this.map.get(e);return this.map.delete(e),this.map.set(e,t),t}set(e,t){if(this.map.has(e))this.map.delete(e);else if(this.map.size>=this.maxSize){const e=this.map.keys().next().value;this.map.delete(e)}this.map.set(e,t)}}(200),d={};function p(e){if(!e)return"#ffffff";const t=String(e),n=u.get(t);if(n)return n;if(d[e?.toLowerCase()]){const n=d[e.toLowerCase()];return u.set(t,n),n}let o,i,r;try{const t=function(e){const t=e?.match(/^#(?:([0-9a-f]{3,4})|([0-9a-f]{6})|([0-9a-f]{8}))$/i);if(t){let e=t[1]||t[2]||t[3];if(3!==e.length&&4!==e.length||(e=e.slice(0,3).split("").map(e=>e+e).join("")),e.length>=6){const t=parseInt(e.slice(0,2),16),n=parseInt(e.slice(2,4),16),o=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?.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*[\d.]+)?\)/i);if(n)return{r:Number(n[1]),g:Number(n[2]),b:Number(n[3])};const o=e?.match(/rgba?\(\s*(\d+)\s+(\d+)\s+(\d+)(?:\s*\/\s*[\d.%]+)?\s*\)/i);if(o)return{r:Number(o[1]),g:Number(o[2]),b:Number(o[3])};const i=e?.match(/hsla?\(\s*([\d.]+)(?:deg)?\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*[\d.]+)?\)/i);if(i){const e=Number(i[1])/360,t=Number(i[2])/100,n=Number(i[3])/100;if(0===t){const e=Math.round(255*n);return{r:e,g:e,b:e}}const o=(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),r=n<.5?n*(1+t):n+t-n*t,s=2*n-r;return{r:Math.round(255*o(s,r,e+1/3)),g:Math.round(255*o(s,r,e)),b:Math.round(255*o(s,r,e-1/3))}}return null}(function(e){if("string"!=typeof e)return e;const t=e.trim();if(!t.toLowerCase().startsWith("var(")||!t.endsWith(")"))return e;const n=t.slice(4,-1).trim(),o=n.indexOf(","),i=(-1===o?n:n.slice(0,o)).trim(),r=-1===o?"":n.slice(o+1).trim();if(!i.startsWith("--"))return e;try{if("undefined"!=typeof document&&"function"==typeof getComputedStyle){const e=getComputedStyle(document.documentElement).getPropertyValue(i).trim();if(e)return e}}catch(e){}return r||e}("string"==typeof e?e.trim():String(e||"")).trim());if(!t)throw new Error("Unknown color");({r:o,g:i,b:r}=t)}catch{o=i=r=128}const s=(e,t,n)=>{const o=[e,t,n].map(e=>(e/=255)<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4));return.2126*o[0]+.7152*o[1]+.0722*o[2]},a=(e,t)=>{const n=s(...e),o=s(...t);return(Math.max(n,o)+.05)/(Math.min(n,o)+.05)};let[l,c,p]=((e,t,n)=>{e/=255,t/=255,n/=255;const o=Math.max(e,t,n),i=Math.min(e,t,n);let r,s,a=(o+i)/2;if(o===i)r=s=0;else{const l=o-i;switch(s=a>.5?l/(2-o-i):l/(o+i),o){case e:r=(t-n)/l+(t<n?6:0);break;case t:r=(n-e)/l+2;break;case n:r=(e-t)/l+4}r/=6}return[360*r,s,a]})(o,i,r),f=p<.5?Math.min(p+.5,1):Math.max(p-.5,0),[m,h,y]=((e,t,n)=>{let o,i,r;if(e/=360,0===t)o=i=r=n;else{const s=(e,t,n)=>(n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e),a=n<.5?n*(1+t):n+t-n*t,l=2*n-a;o=s(l,a,e+1/3),i=s(l,a,e),r=s(l,a,e-1/3)}return[Math.round(255*o),Math.round(255*i),Math.round(255*r)]})(l,c,f);if(a([o,i,r],[m,h,y])<4.5){const e=a([o,i,r],[0,0,0]),t=a([o,i,r],[255,255,255]);[m,h,y]=e>=t?[0,0,0]:[255,255,255]}const g=((e,t,n)=>`#${e.toString(16).padStart(2,"0")}${t.toString(16).padStart(2,"0")}${n.toString(16).padStart(2,"0")}`)(m,h,y);return u.set(t,g),g}Object.entries({aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],transparent:[255,255,255],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}).forEach(([e,[t,n,o]])=>{const i=e=>{const t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)},r=.2126*i(t)+.7152*i(n)+.0722*i(o),s=(r+.05)/.05,a=1.05/(r+.05);d[e.toLowerCase()]=s>=a?"#000000":"#ffffff"});const f=new Set(["DIV","SPAN","P","BR","STRONG","B","EM","I","U","SMALL","UL","OL","LI","A","IMG","PRE","CODE","MARK"]),m=new Set(["href","src","alt","title","class","target","rel","loading"]),h=new Set(["SCRIPT","STYLE","IFRAME","NOSCRIPT","OBJECT","EMBED","SVG","MATH","AUDIO","VIDEO","CANVAS","TEMPLATE"]),y=/^\s*(?:https?:|mailto:|data:image\/(?:png|jpe?g|gif|webp|avif|bmp|ico);|\/(?!\/|\\)|\.\/|\.\.\/|#)/i;function g(e,t,n){if(e.nodeType===Node.TEXT_NODE)return document.createTextNode(e.nodeValue);if(e.nodeType===Node.COMMENT_NODE)return null;if(e.nodeType!==Node.ELEMENT_NODE)return null;const o=e.tagName.toUpperCase();if(h.has(o)||o.includes("SCRIPT")||o.includes("<")||o.includes(">"))return null;if(!t.has(o)){const o=document.createDocumentFragment();return Array.from(e.childNodes).forEach(e=>{const i=g(e,t,n);i&&o.appendChild(i)}),o}const i=document.createElement(e.tagName);return Array.from(e.attributes||[]).forEach(e=>{i.setAttribute(e.name,e.value)}),function(e,t){const n=[];Array.from(e.attributes||[]).forEach(o=>{const i=o.name.toLowerCase(),r=o.value;if(t.has(i)&&!i.startsWith("on")){if("href"===i||"src"===i){const t="string"==typeof r?r.trim().toLowerCase():"";if((t.startsWith("javascript:")||t.startsWith("vbscript:")||t.startsWith("data:"))&&("src"!==i||!t.startsWith("data:image/")||t.startsWith("data:image/svg+xml")))return"href"===i?void e.setAttribute("href","#"):void n.push(o.name);if(!y.test(r))return"href"===i?void e.setAttribute("href","#"):void n.push(o.name)}if("target"===i&&"string"==typeof r&&"_blank"===r.trim().toLowerCase()){const t=(e.getAttribute("rel")||"").split(/\s+/).filter(Boolean);t.includes("noopener")||t.push("noopener"),t.includes("noreferrer")||t.push("noreferrer"),e.setAttribute("rel",t.join(" "))}}else n.push(o.name)}),n.forEach(t=>e.removeAttribute(t));const o=e.getAttribute("target");if("A"===e.tagName&&"string"==typeof o&&"_blank"===o.trim().toLowerCase()){const t=(e.getAttribute("rel")||"").split(/\s+/).filter(Boolean);t.includes("noopener")||t.push("noopener"),t.includes("noreferrer")||t.push("noreferrer"),e.setAttribute("rel",t.join(" "))}}(i,n),Array.from(e.childNodes).forEach(e=>{const o=g(e,t,n);o&&i.appendChild(o)}),i}function b(e){if(!e||"string"!=typeof e)return"";const t=function(e){if("undefined"!=typeof DOMParser)try{const t=(new DOMParser).parseFromString(e,"text/html");if(t&&t.body)return t.body}catch{}if("undefined"!=typeof document){const t=document.createElement("template");if("content"in t)return t.innerHTML=e,t.content;const n=document.createElement("div");return n.innerHTML=e,n}return null}(e);if(!t)return"";const n=document.createDocumentFragment();Array.from(t.childNodes).forEach(e=>{const t=g(e,f,m);t&&n.appendChild(t)});const o=document.createElement("div");return o.appendChild(n),o.querySelectorAll('a[target="_blank"]').forEach(e=>{const t=(e.getAttribute("rel")||"").split(/\s+/).filter(Boolean);t.includes("noopener")||t.push("noopener"),t.includes("noreferrer")||t.push("noreferrer"),e.setAttribute("rel",t.join(" "))}),o.innerHTML}function w(e,t={}){if("string"!=typeof e||!e.trim())return"";try{if(!t.forceFallback&&function(){try{return Boolean("undefined"!=typeof window&&window.DOMPurify&&"function"==typeof window.DOMPurify.sanitize)}catch(e){}return!1}()){const t=window.DOMPurify.sanitize(e,{ALLOWED_TAGS:Array.from(f),ALLOWED_ATTR:Array.from(m),ALLOWED_URI_REGEXP:/^(?:(?:https?|mailto|ftp|tel):|data:image\/(?:png|jpeg|jpg|gif|webp|avif|bmp|ico);base64,|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i}),n=document.createElement("div");return n.innerHTML=t,n.querySelectorAll("a[href]").forEach(e=>{const t=(e.getAttribute("href")||"").trim().toLowerCase();(t.startsWith("data:")||t.startsWith("javascript:")||t.startsWith("vbscript:"))&&e.setAttribute("href","#")}),n.querySelectorAll('a[target="_blank"]').forEach(e=>{const t=(e.getAttribute("rel")||"").split(/\s+/).filter(Boolean);t.includes("noopener")||t.push("noopener"),t.includes("noreferrer")||t.push("noreferrer"),e.setAttribute("rel",t.join(" "))}),n.innerHTML}}catch(e){console.warn("DOMPurify sanitization failed, falling back:",e)}return b(e)}function x(e={}){const t=e&&"object"==typeof e&&!Array.isArray(e)?e:{},n=Number(t.size),o=Number.isFinite(n)&&n>0?n:14,s="string"==typeof t.color&&t.color.trim()?t.color.trim():"currentColor",a="string"==typeof t.text?t.text:"",l=document.createElement("span");l.className="toast-loader",l.setAttribute("role","status"),l.setAttribute("aria-label",a||"Loading");const c=i();c.disableInlineStyles||(l.style.display="inline-flex",l.style.alignItems="center",l.style.gap="8px");const u="http://www.w3.org/2000/svg",d=document.createElementNS(u,"svg");d.setAttribute("width",String(o)),d.setAttribute("height",String(o)),d.setAttribute("viewBox","0 0 50 50"),d.setAttribute("aria-hidden","true");const p=document.createElementNS(u,"circle");if(p.classList.add("toast-loader-circle"),p.setAttribute("cx","25"),p.setAttribute("cy","25"),p.setAttribute("r","20"),p.setAttribute("fill","none"),p.setAttribute("stroke",s),p.setAttribute("stroke-width","4"),p.setAttribute("stroke-linecap","round"),c.disableInlineStyles||(p.style.opacity="0.85",p.style.strokeDasharray="90",p.style.strokeDashoffset="60",p.style.transformOrigin="center",r()||(p.style.animation="toast-spinner 1s linear infinite")),d.appendChild(p),l.appendChild(d),a){const e=document.createElement("span");e.className="toast-loader-label",c.disableInlineStyles||(e.style.fontSize="13px"),e.textContent=a,l.appendChild(e)}if(!c.disableInlineStyles&&"undefined"!=typeof document&&!document.getElementById("toast-spinner-styles")){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)}return l}function v(e,t,n){const o=t?.cta;if(!o||"object"!=typeof o)return;const r=Array.isArray(o)?o.filter(e=>e&&"object"==typeof e):[o];if(0===r.length)return;const s=[];r.forEach((o,a)=>{if(!o||"object"!=typeof o)return;const l={...o};l.label||(l.label=r.length>1?`Action ${a+1}`:"CTA Label Missing!");const c="link"===l.variant||!l.variant&&!!l.href,u=document.createElement(c?"a":"button");if(c){if(l.href){const e=String(l.href).trim(),t=/^(javascript:|vbscript:|data:(?!image\/[a-z0-9.+-]+;base64,))/i.test(e);u.href=t?"#":e}else u.setAttribute("role","button"),u.tabIndex=0;l.target&&(u.target=l.target);const e=new Set((l.rel||"").split(/\s+/).filter(Boolean));"string"==typeof l.target&&"_blank"===l.target.trim().toLowerCase()&&(e.add("noopener"),e.add("noreferrer")),u.rel=Array.from(e).join(" ")}else u.type="button";u.setAttribute("aria-label",l.ariaLabel||l.label);const d=l.textColor||l.color||t.textColor||p(t.backgroundColor),f=l.backgroundColor||l.background||(t.backgroundColor?C(t.backgroundColor):"rgba(255,255,255,0.15)"),m="string"==typeof d&&/^#[0-9a-fA-F]{6}$/.test(d.trim())?`${d.trim()}44`:"rgba(128, 128, 128, 0.3)";u.className="toast-cta",i().disableInlineStyles||Object.assign(u.style,{marginLeft:0===a?"10px":"6px",padding:"6px 10px",borderRadius:"6px",fontSize:"12px",fontWeight:"600",lineHeight:"1",border:`1px solid ${m}`,color:d,background:f,cursor:"pointer",whiteSpace:"nowrap",flexShrink:"0"}),u.textContent=l.label;const h=async t=>{try{if("function"==typeof l.onClick){const e=l.onClick(t);e?.then&&await e}}catch(e){console.error("CTA onClick handler error:",e)}finally{!1!==l.autoClose&&"function"==typeof n&&n(e)}},y=e=>{!c||l.href||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),h(e))};u.addEventListener("click",h),c&&!l.href&&u.addEventListener("keydown",y);const g=()=>{u.removeEventListener("click",h),c&&!l.href&&u.removeEventListener("keydown",y)};u._cleanup=g,s.push(g);const b=e.querySelector(".toast-undo-btn")||e.querySelector(".toast-close-btn")||e.querySelector(".toast-progress-bar");b?e.insertBefore(u,b):e.appendChild(u)});const a=e._cleanupCTA;e._cleanupCTA=()=>{a?.(),s.forEach(e=>e())}}function T(e,t,n){const o=t?.undo;if(!o)return;const r="function"==typeof o;if(!r&&("object"!=typeof o||Array.isArray(o)))return;const s=r?{onUndo:o}:{...o},a="string"==typeof s.label&&s.label.trim()?s.label.trim():"Undo",l=Number(t?.duration),c=!1!==s.showCountdown&&Number.isFinite(l)&&l>0,u=document.createElement("button");u.type="button",u.className="toast-undo-btn",u.setAttribute("aria-label",`${a} action`);const d=t.textColor||p(t.backgroundColor),f=t.backgroundColor?C(t.backgroundColor):"rgba(255,255,255,0.18)",m="string"==typeof d&&/^#[0-9a-fA-F]{6}$/.test(d.trim())?`${d.trim()}55`:"rgba(128, 128, 128, 0.35)";i().disableInlineStyles||Object.assign(u.style,{marginLeft:"10px",padding:"5px 10px",borderRadius:"6px",fontSize:"12px",fontWeight:"700",lineHeight:"1",border:`1px solid ${m}`,color:d,background:f,cursor:"pointer",whiteSpace:"nowrap",flexShrink:"0",display:"inline-flex",alignItems:"center",gap:"4px"});let h=Math.max(1,Math.ceil((l||2500)/1e3));const y=()=>{u.textContent=c?`${a} (${h}s)`:a};y();let g=null,b=!1;c&&(g=setInterval(()=>{b||(h=Math.max(0,h-1),y(),h<=0&&g&&(clearInterval(g),g=null))},1e3),"function"==typeof g?.unref&&g.unref()),e._pauseUndo=()=>{b=!0},e._resumeUndo=()=>{b=!1};const w=()=>{g&&(clearInterval(g),g=null),e._pauseUndo=null,e._resumeUndo=null},x=async t=>{w(),u.removeEventListener("click",x);try{if("function"==typeof s.onUndo){const n=s.onUndo(t,e);n?.then&&await n}}catch(e){console.error("Undo action error:",e)}finally{"function"==typeof n&&n(e)}};u.addEventListener("click",x),u._cleanup=()=>{w(),u.removeEventListener("click",x)},e._cleanupUndo=()=>{w(),u.removeEventListener("click",x)};const v=e.querySelector(".toast-close-btn")||e.querySelector(".toast-progress-bar");v?e.insertBefore(u,v):e.appendChild(u)}function A(e,t,n){const o=document.createElement("button");o.type="button",o.setAttribute("aria-label","Close notification"),o.setAttribute("title","Close"),o.textContent="×";const r=t.textColor||p(t.backgroundColor);o.className="toast-close-btn",i().disableInlineStyles||Object.assign(o.style,{background:"none",border:"none",color:r,fontSize:"18px",marginLeft:"10px",cursor:"pointer",lineHeight:"1",padding:"0 4px"});const s=()=>{"function"==typeof n&&n(e)};o.addEventListener("click",s),e._cleanupCloseButton=()=>{o.removeEventListener("click",s)},e.appendChild(o)}function C(e){return e&&"#000000"===p(e)?"rgba(0,0,0,0.15)":"rgba(255,255,255,0.15)"}function S(e,t={}){const n=document.createElement("div");n.className="toast-progress-bar",e._progressBar=n;const o=t.borderRadius||"0",s=parseInt(o,10),a=Number.isFinite(s)&&s>0?s:0;let l=4,c="4px";if("number"==typeof t.progressHeight&&Number.isFinite(t.progressHeight)&&t.progressHeight>0)l=t.progressHeight,c=`${l}px`;else if("string"==typeof t.progressHeight&&t.progressHeight.trim()){const e=t.progressHeight.trim(),n=parseFloat(e);Number.isFinite(n)&&n>0&&(e.endsWith("rem")||e.endsWith("em")?(l=16*n,c=e):(l=n,c=/^\d+(\.\d+)?$/.test(e)?`${n}px`:e))}const u=Number(t.duration??2500),d=Math.max(0,u+5),p=Math.min(a,2*l),f=a>0?`calc(100% - ${2*p}px)`:"100%";n._leftOffset=p,n._finalWidth=f;const m=t.progressBarColor||t.progressColor||"currentColor",h="reverse"===t.progressDirection||"increasing"===t.progressDirection||"ltr"===t.progressDirection;if(i().disableInlineStyles||Object.assign(n.style,{position:"absolute",left:`${p}px`,height:c,background:m,width:h?"0%":`${f}`,transition:`width ${d}ms linear`,["top"===t.progressPosition?"top":"bottom"]:"0",borderRadius:l/2+"px",opacity:"0.8",zIndex:"2",willChange:"width"}),e.appendChild(n),"indeterminate"===t.progress||Boolean(t.showProgressBar)&&(0===t.duration||t.duration===1/0)&&void 0===t.progress)return n.classList.add("toast-progress-bar-indeterminate"),void(n.style.width=f);if(void 0!==t.progress){let e=Number(t.progress);return Number.isFinite(e)||(e=0),e<1&&e>0&&(e*=100),n.style.width=`${e}%`,void(n.style.transition="width 200ms ease")}if(0!==t.duration&&t.duration!==1/0)if(r())n.style.display="none";else if("function"==typeof n.animate){const t=h?[{width:"0%"},{width:f}]:[{width:f},{width:"0%"}];e._progressAnimation=n.animate(t,{duration:d,easing:"linear",fill:"forwards",delay:50})}else n.style.transition=`width ${d}ms linear`,requestAnimationFrame(()=>{n.style.width=h?f:"0%"});else n.style.width="0%"}function k(e){if(!e)return;if(e._hasAnimated)return;if(r())return e._hasAnimated=!0,e.style.transition="none",e.style.opacity="1",e.style.transform="translateY(0)",void e.classList.add("active");const t=()=>{if(!e._hasAnimated){e._hasAnimated=!0;try{e.offsetHeight}catch{}requestAnimationFrame(()=>{e.style.opacity="1",e.style.transform="none",e.classList.add("active")})}};e.isConnected?t():requestAnimationFrame(()=>{e.isConnected?t():requestAnimationFrame(()=>{t()})})}let E=null,L=!0,M=!1;if("undefined"!=typeof window)if("undefined"!=typeof navigator&&navigator.userActivation?.hasBeenActive)M=!0;else{const e=()=>{if(M=!0,E&&"suspended"===E.state)try{E.resume().catch(()=>{})}catch{}try{window.removeEventListener("pointerdown",e,!0),window.removeEventListener("keydown",e,!0),window.removeEventListener("touchstart",e,!0)}catch{}};try{window.addEventListener("pointerdown",e,{capture:!0,once:!0,passive:!0}),window.addEventListener("keydown",e,{capture:!0,once:!0,passive:!0}),window.addEventListener("touchstart",e,{capture:!0,once:!0,passive:!0})}catch{}}const _=new Map;function N(e=!0){if("undefined"==typeof window)return null;const t=window.AudioContext||window.webkitAudioContext;if(!t)return null;if(!E)try{E=new t}catch{return null}const n=M||"undefined"!=typeof navigator&&navigator.userActivation&&navigator.userActivation.hasBeenActive;if(E&&"suspended"===E.state&&(e||n))try{E.resume().catch(()=>{})}catch{}return E}let I=null;function z(){const e=N(!1);if(!e||"function"!=typeof e.createAnalyser)return null;if(!I)try{I=e.createAnalyser(),I.fftSize=128,I.connect(e.destination)}catch{return null}return I}function B(e,t){I?t.connect(I):t.connect(e.destination)}const P={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),B(e,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),B(e,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),B(e,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),B(e,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),B(e,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),B(e,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),B(e,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),B(e,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),B(e,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),B(e,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),B(e,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),B(e,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),B(e,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),B(e,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),B(e,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),B(e,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),B(e,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),B(e,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),B(e,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),B(e,o),t.start(n),t.stop(n+.3)}}};let V=!1;function q(e="info",t){if(!L)return;if(!V&&"undefined"!=typeof window&&window.customizableToast&&"function"==typeof window.customizableToast.playTone&&window.customizableToast.playTone!==q)try{return V=!0,void window.customizableToast.playTone(e,t)}finally{V=!1}const n=N();if(n)try{"suspended"===n.state&&n.resume().catch(()=>{});const o=n.currentTime,r="number"==typeof e?e:parseFloat(e);if(Number.isFinite(r)&&r>=20&&r<=2e4&&("number"==typeof e||/^\d+(\.\d+)?(hz)?$/i.test(String(e).trim()))){const e=n.createOscillator(),t=n.createGain();return e.type="sine",e.frequency.setValueAtTime(r,o),t.gain.setValueAtTime(.001,o),t.gain.exponentialRampToValueAtTime(.1,o+.015),t.gain.exponentialRampToValueAtTime(1e-4,o+.35),e.connect(t),B(n,t),e.start(o),void e.stop(o+.36)}const s=String(e||"info").toLowerCase().trim(),a=String(t||i().soundPreset||"modern").toLowerCase().trim();if(_.has(a))try{const e=_.get(a);if("function"==typeof e)return void e(n,s,o)}catch(e){console.warn("Custom sound preset synthesizer error:",e)}(P[a]||P.modern)(n,s,o)}catch{}}function O(e,t){if("string"!=typeof e||!e.trim()||"function"!=typeof t)return!1;const n=e.toLowerCase().trim();return _.set(n,t),!0}function D(){const e=Object.keys(P),t=Array.from(_.keys());return Array.from(new Set([...e,...t]))}function R(){_.clear()}function F(e){L=Boolean(e)}function j(){return L}function $(){if(E)try{E.close?.().catch?.(()=>{})}catch{}E=null,I=null}const W={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)"}},H=new Map;function U(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);H.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 G(){return[...Object.keys(W),...H.keys()]}function Y(){H.clear()}function X(e){if(!e)return null;if("string"==typeof e){const t=e.trim().toLowerCase();return H.has(t)?H.get(t):Object.prototype.hasOwnProperty.call(W,t)?W[t]:W.default}if(!0===e)return W.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 Q(e,t){if(e<=0)return 0;const n=Math.max(.001,t?.stiffness||100),o=Math.max(.001,t?.damping||10),i=Math.max(.001,t?.mass||1),r=Math.sqrt(n/i),s=o/(2*Math.sqrt(n*i));if(Math.abs(s-1)<1e-4)return 1-Math.exp(-r*e)*(1+r*e);if(s<1){const t=r*Math.sqrt(1-s*s);return 1-Math.exp(-s*r*e)*(Math.cos(t*e)+s/Math.sqrt(1-s*s)*Math.sin(t*e))}const a=r*Math.sqrt(s*s-1),l=-s*r+a,c=-s*r-a,u=-l/(c-l);return 1-(c/(c-l)*Math.exp(l*e)+u*Math.exp(c*e))}function K(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=Q(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(Q(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 J(e,t=32){const n=K(e)/1e3,o=[];for(let i=0;i<=t;i++){const r=i/t,s=Q(r*n,e),a=Math.round(1e3*s)/1e3,l=Math.round(1e3*r)/10;o.push(`${a} ${l}%`)}return`linear(${o.join(", ")})`}function Z(e){const t=X(e);if(!t)return null;const n=K(t),o=J(t),i=function(){if("undefined"==typeof window||"undefined"==typeof CSS||"function"!=typeof CSS.supports)return!1;try{return CSS.supports("transition-timing-function","linear(0 0%, 1 100%)")||CSS.supports("transition-timing-function","linear(0, 1)")||CSS.supports("animation-timing-function","linear(0 0%, 1 100%)")}catch{return!1}}()?o:t.bezierFallback||"cubic-bezier(0.34, 1.4, 0.64, 1)";return{config:{stiffness:t.stiffness,damping:t.damping,mass:t.mass},duration:n,easing:i,isSpring:!0}}const ee=new Set(["svg","g","path","circle","rect","line","polyline","polygon","ellipse","title","desc","defs","clippath","use"]),te=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 ne(e=""){return/^\s*javascript:/i.test(e)}function oe(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(!ee.has(t))return null;const n=document.createElementNS("http://www.w3.org/2000/svg",t);if(e.attributes)for(let t=0;t<e.attributes.length;t++){const o=e.attributes[t],i=o.name,r=i.toLowerCase(),s=o.value||"";r.startsWith("on")||te.has(r)&&("href"!==r&&"xlink:href"!==r||!ne(s))&&n.setAttribute(i,s)}if(e.childNodes)for(let t=0;t<e.childNodes.length;t++){const o=i(e.childNodes[t]);o&&n.appendChild(o)}return n};return i(o)}catch{return null}}const ie={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 re(e={}){let t=e.icon;if("function"==typeof t)try{t=t(e)}catch(e){console.warn("options.icon callback error:",e),t=null}if(!1===t||""===t||null===t)return null;const n=e.type,o=i(),r=document.createElement("i");if(r.className="toast-icon",r.setAttribute("aria-hidden","true"),o.disableInlineStyles||Object.assign(r.style,{display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:"0",marginRight:"8px",lineHeight:"1",fontStyle:"normal"}),t&&"object"==typeof t&&(1===t.nodeType||"undefined"!=typeof HTMLElement&&t instanceof HTMLElement)&&"function"==typeof t.cloneNode)return r.appendChild(t.cloneNode(!0)),r;if("string"==typeof t&&t.trim()){const e=t.trim(),n={check:ie.success,checkmark:ie.success,success:ie.success,cross:ie.error,error:ie.error,alert:ie.warning,warning:ie.warning,circle:ie.info,info:ie.info}[e.toLowerCase()];if(n){const e=oe(n.trim());return e&&r.appendChild(e),r}if(e.startsWith("<svg")&&e.endsWith("</svg>")){const t=oe(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 s="string"==typeof n?n.toLowerCase().trim():"";if((!0===t||void 0===t)&&s&&ie[s]){const e=oe(ie[s].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 ae(e={},t){try{const n=i(),o=document.createElement("div"),r=e?.position||n.defaultPosition,s=String(r).toLowerCase().trim();let a="auto",l="auto",c="auto",u="auto",d="none";s.startsWith("top")?a="20px":(s.startsWith("bottom")||s.includes("below"))&&(l="20px"),s.startsWith("left")?c="20px":s.startsWith("right")?u="20px":"center"===s?(c="50%",a="50%",d="translate(-50%, -50%)"):s.includes("center")?s.includes("left")?(c="20px",a="50%",d="translateY(-50%)"):s.includes("right")?(u="20px",a="50%",d="translateY(-50%)"):s.includes("top")?(a="20px",c="50%",d="translateX(-50%)"):s.includes("bottom")&&(l="20px",c="50%",d="translateX(-50%)"):(u="20px",l="20px"),o.className="toast-emergency",n.disableInlineStyles||Object.assign(o.style,{background:"#333",color:"white",padding:"10px 15px",position:"fixed",top:a,bottom:l,left:c,right:u,transform:d,zIndex:String(n.zIndex+100),borderRadius:"3px",maxWidth:"250px",wordWrap:"break-word",boxShadow:"0 2px 10px rgba(0,0,0,0.3)"});const p=document.createElement("div"),f=document.createElement("span");if(f.className="toast-emergency-message",n.disableInlineStyles||(f.style.display="inline-block"),e.allowHtml)try{const t=w(String(e.message||"Emergency Toast Showing!")),n=document.createElement("div");for(n.innerHTML=t;n.firstChild;)f.appendChild(n.firstChild)}catch{f.appendChild(document.createTextNode(String(e.message||"Emergency Toast Showing!")))}else f.textContent=String(e.message||"Emergency Toast Creation Showing!");p.appendChild(f);const m=document.createElement("span");for(m.className="toast-emergency-close",m.setAttribute("role","button"),m.setAttribute("aria-label","Close emergency notification"),m.tabIndex=0,n.disableInlineStyles||Object.assign(m.style,{float:"right",marginLeft:"10px",fontWeight:"bold",cursor:"pointer"}),m.textContent="×",p.appendChild(m);o.firstChild;)o.removeChild(o.firstChild);o.appendChild(p);let h=null;const y=()=>{h&&clearTimeout(h),m.removeEventListener("click",y),o.remove(),"function"==typeof t&&t(o)};m.addEventListener("click",y);const g=Number(e?.duration)||2500;return h=setTimeout(()=>{m.removeEventListener("click",y),o.remove(),"function"==typeof t&&t(o)},g),"function"==typeof h?.unref&&h.unref(),o}catch(e){return console.error("Emergency toast creation failed:",e),"function"==typeof t&&t(null),null}}class le{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(){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 ce=null;function ue(e=5,t=50){return ce||(ce=new le(e,t)),ce}function de(){ce&&(ce.clear(),ce=null)}async function pe(e,t){let n;const o="toast";try{if(e?.usePool){const e=c(o);n=ue().acquire(e),n._pooledId=e}else n=await async function(e,t){const n=document.createElement("div");return n.id=c(t),n}(0,o);return await async function(e,t,n){const o=i(),s=t?.spring?Z(t.spring):null,a=s?s.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*parseFloat(t);return Number.isFinite(e)&&e>=0?e:500}const n=parseFloat(t);return Number.isFinite(n)&&n>=0?n:500}return 500}(t?.animationDuration),l=`${a}ms`,c=s?s.easing:"string"==typeof t?.animationEasing&&t.animationEasing.trim()?t.animationEasing.trim():"ease";s&&(e._spring=s),e._animationType=t?.animationType;const u="string"==typeof t?.className&&t.className.trim()?` ${t.className.trim()}`:"";e.className=`toast toast-${t?.type??"info"}${u}`;const d="number"==typeof t?.borderRadius?`${t.borderRadius}px`:t?.borderRadius,p="number"==typeof t?.maxWidth?`${t.maxWidth}px`:t?.maxWidth,f=s?`${Math.min(300,a)}ms`:l,m=s?"ease":c;o.disableInlineStyles||Object.assign(e.style,{background:t?.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:p,opacity:"0",position:"relative",cursor:"default",boxSizing:"border-box",userSelect:"text",pointerEvents:"auto",transition:`opacity ${f} ${m}, transform ${l} ${c}`,transform:se(t?.position,t?.animationType,!!s),zIndex:String(o.zIndex),direction:t?.fontDirection&&"auto"!==t.fontDirection?t.fontDirection:void 0});const h="error"===t?.type,y=t?.role||(h?"alert":t?.role??"alert"),g=t?.ariaLive||(h?"assertive":"polite");e.setAttribute("role",y),e.setAttribute("aria-live",g),e.tabIndex=0,e._animationDuration=a;const b=document.createElement("span");b.className="toast-message",e._messageSpan=b,"truncate"!==t?.wrapText&&"ellipsis"!==t?.wrapText&&!1!==t?.wrapText&&t?.wrapText?o.disableInlineStyles||Object.assign(b.style,{display:"block",whiteSpace:"normal"}):(b.classList.add("is-truncated"),o.disableInlineStyles||Object.assign(b.style,{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:"3",whiteSpace:"normal",overflow:"hidden",textOverflow:"ellipsis"}));const C="number"==typeof t?.fontSize?`${t.fontSize}px`:t?.fontSize;o.disableInlineStyles||Object.assign(b.style,{flex:"1",padding:t?.fontPadding,fontFamily:t?.fontFamily,fontSize:C,fontWeight:t?.fontWeight,lineHeight:t?.fontLineHeight,color:t?.textColor,userSelect:"text",wordBreak:"break-word",overflow:"hidden",textOverflow:"ellipsis",direction:t?.fontDirection&&"auto"!==t.fontDirection?t.fontDirection:void 0});const E=!!t.allowHtml,L=t.message??"",M=re(t);if(M&&e.appendChild(M),t.loader||t.showLoader){const e=x(t.loader||{});b.appendChild(e);const n=document.createElement("span");n.className="toast-message-spacer",o.disableInlineStyles||(n.style.display="inline-block",n.style.width="8px"),b.appendChild(n)}if(E&&"string"==typeof L&&L.trim().length>0)try{const e=w(L),t=document.createElement("div");for(t.innerHTML=e;t.firstChild;)b.appendChild(t.firstChild)}catch(e){console.warn("HTML message sanitization failed, falling back to text:",e),b.appendChild(document.createTextNode(String(L)))}else b.appendChild(document.createTextNode(String(L)));b.setAttribute("title",b.textContent||""),e.appendChild(b),t?.cta&&"object"==typeof t.cta&&v(e,t,n),t?.undo&&T(e,t,n),t?.showCloseButton&&A(e,t,n),!1===t?.showProgressBar||!t?.showProgressBar&&void 0===t?.progress||S(e,t),!1!==(void 0!==t?.swipeToDismiss?t.swipeToDismiss:o.swipeToDismiss)&&function(e,t){if(!e||"function"!=typeof e.addEventListener)return;let n=0,o=0,s=0,a=0,l=!1,c=!1,u=null,d=!1;const p=()=>{d&&(d=!1,window.removeEventListener("mousemove",m),window.removeEventListener("mouseup",h))},f=t=>{if(!t)return;const i=t.target;if(i&&"function"==typeof i.closest&&i.closest("button, a, input, textarea, select, label"))return;let r=t;t.touches&&t.touches.length>0?(r=t.touches[0],u=r.identifier??null):u=null,n=r.clientX,o=r.clientY,s=n,a=Date.now(),l=!0,c=!1,e.style.transition="none",e.style.userSelect="none",d||"undefined"==typeof window||(d=!0,window.addEventListener("mousemove",m,{passive:!1}),window.addEventListener("mouseup",h,{passive:!0}))},m=t=>{if(!l||!t)return;let a=t;if(t.touches)if(null!==u){for(let e=0;e<t.touches.length;e++)if(t.touches[e].identifier===u){a=t.touches[e];break}}else t.touches.length>0&&(a=t.touches[0]);const d=a.clientX,f=a.clientY,m=d-n,h=f-o;if(!c)if(Math.abs(m)>8&&Math.abs(m)>Math.abs(h))c=!0;else if(Math.abs(h)>8)return l=!1,e.style.userSelect="",void p();if(c){s=d;const n=Math.max(0,1-Math.abs(m)/280);i().disableInlineStyles||r()||(e.style.transform=`translateX(${m}px)`,e.style.opacity=String(n)),t.cancelable&&t.preventDefault()}},h=()=>{if(p(),u=null,!l||!c)return l=!1,void(e.style.userSelect="");l=!1,e.style.userSelect="";const o=s-n,d=Math.max(1,Date.now()-a),f=(d>0?Math.abs(o)/d:0)>=.65&&Math.abs(o)>=50,m=f?50:75;if(Math.abs(o)>=m){const n=o>0?320:-320,s=f?120:180;i().disableInlineStyles||r()||(e.style.transition=`transform ${s}ms ease-out, opacity ${s}ms ease-out`,e.style.transform=`translateX(${n}px)`,e.style.opacity="0"),e._swipeTimeout&&clearTimeout(e._swipeTimeout),e._swipeTimeout=setTimeout(()=>{e._swipeTimeout=null,"function"==typeof t&&t(e)},s),"function"==typeof e._swipeTimeout?.unref&&e._swipeTimeout.unref()}else if(!i().disableInlineStyles&&!r()){const t=e._spring,n=t?.easing||"cubic-bezier(0.34, 1.56, 0.64, 1)",o=t?.duration?Math.min(400,t.duration):200;e.style.transition=`transform ${o}ms ${n}, opacity 200ms ease`,e.style.transform="translateX(0)",e.style.opacity="1"}};e.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),p(),e.removeEventListener("touchstart",f),e.removeEventListener("touchmove",m),e.removeEventListener("touchend",h),e.removeEventListener("touchcancel",h),e.removeEventListener("mousedown",f)}}(e,n),(void 0!==t?.sound?t.sound:o.sound)&&q("string"==typeof t.sound?t.sound:t?.type||"info",t?.soundPreset||o.soundPreset||"modern"),k(e)}(n,e,t),n}catch(o){if(e?.usePool&&n?._pooledId)try{ue().release(n,n._pooledId)}catch{}return console.warn("toast creation failed with error showing fallback one: ",o),n=await ae(e,t),n}}const fe=new Map,me=new Map;function he(e){if(!e||"string"!=typeof e)return"bottom-right";const t=e.toLowerCase().trim();return t?t.replace(/\bbelow\b/g,"bottom").replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"-").replace(/-{2,}/g,"-"):"bottom-right"}function ye(e){return`toast-container-${he(e)}`}function ge(e){const t=i();e.className="toast-container-base",t.disableInlineStyles||(e.style.position="fixed",e.style.zIndex=String(t.zIndex),e.style.pointerEvents="none",e.style.inset="auto 10px 10px auto",e.style.display="flex",e.style.justifyContent="space-between",e.style.alignItems="center",e.style.flexDirection="column",e.style.overflow="hidden")}async function be(e={},n){const o=i(),r=ye(e?.position||o.defaultPosition),s=(a=t.targetNode)&&"object"==typeof a&&"function"==typeof a.appendChild?t.targetNode:"undefined"!=typeof document?document.body:null;var a;if(!s)throw new Error("Toast container root is unavailable");if(me.has(r))return me.get(r);const l=(async()=>{const t=fe.get(r);if(function(e,t){return!(!e||!t)&&(t===document.body?e.isConnected&&e.ownerDocument===document:"function"==typeof t.contains?t.contains(e):e.isConnected&&e.ownerDocument===document)}(t,s))return t;t&&fe.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)ge(o),"function"==typeof n&&await n(o,e);else{const t=s?.ownerDocument||("undefined"!=typeof document?document:null);if(!t)throw new Error("Document is unavailable");o=t.createElement("div"),o.id=r,o.setAttribute("role","status"),o.setAttribute("aria-atomic","true"),ge(o),"function"==typeof n&&await n(o,e),s.appendChild(o)}if("function"==typeof s.querySelectorAll){const e=s.querySelectorAll(`#${r}`);if(e.length>1)for(let t=1;t<e.length;t++)try{e[t].remove()}catch{}}return fe.set(r,o),o})();me.set(r,l);try{return await l}finally{me.delete(r)}}const we=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"]),xe=new Set(["top","bottom"]),ve=[...we,...xe];async function Te(e,t={}){if(!e||!t||"object"!=typeof t)throw new Error("Invalid container or position!");const n=i(),o=String(t?.position||n.defaultPosition||"bottom-right").toLowerCase().trim().replace(/\s+/g,"-");let r=o;var s;if(s=o,we.has(s)||xe.has(o)||(console.warn(`Unknown position "${t.position}", defaulting to "bottom-right"`),r="bottom-right"),function(e){if(e?.classList)for(let t=0;t<ve.length;t++)e.classList.remove("toast-position-"+ve[t])}(e),e.classList?.add("toast-position-"+r),i().disableInlineStyles)return;!function(e){e.style.top="auto",e.style.bottom="auto",e.style.left="auto",e.style.right="auto",e.style.transform="none",e.style.maxWidth="none"}(e);const a=function(e){const t=e.toLowerCase().trim(),n="top-full-width"===t||"bottom-full-width"===t;return{hasTop:t.startsWith("top")||t.endsWith("top"),hasBottom:t.startsWith("bottom")||t.endsWith("bottom")||t.includes("below"),hasLeft:t.startsWith("left")||t.endsWith("left"),hasRight:t.startsWith("right")||t.endsWith("right"),hasCenter:t.includes("center"),hasFullWidth:n}}(r);(function(e,t,n){if(!n.hasFullWidth)return!1;e.style.maxWidth="100vw";try{!t||t.maxWidth||Object.isFrozen(t)||(t.maxWidth="100vw")}catch{}return n.hasTop?(e.style.top="10px",e.style.left="10px",e.style.right="10px",!0):!!n.hasBottom&&(e.style.bottom="10px",e.style.left="10px",e.style.right="10px",!0)})(e,t,a)||function(e,t){return!!t.hasCenter&&(!t.hasTop||t.hasLeft||t.hasRight?!t.hasBottom||t.hasLeft||t.hasRight?!t.hasLeft||t.hasTop||t.hasBottom?!t.hasRight||t.hasTop||t.hasBottom?!(t.hasLeft||t.hasRight||t.hasTop||t.hasBottom)&&(e.style.top="50%",e.style.left="50%",e.style.transform="translate(-50%, -50%)",!0):(e.style.right="10px",e.style.top="50%",e.style.transform="translateY(-50%)",!0):(e.style.left="10px",e.style.top="50%",e.style.transform="translateY(-50%)",!0):(e.style.bottom="10px",e.style.left="50%",e.style.transform="translateX(-50%)",!0):(e.style.top="10px",e.style.left="50%",e.style.transform="translateX(-50%)",!0))}(e,a)||function(e,t){t.hasBottom?e.style.bottom="10px":t.hasTop?e.style.top="10px":e.style.bottom="10px",t.hasRight?e.style.right="10px":t.hasLeft?e.style.left="10px":(e.style.left="50%",e.style.transform="translateX(-50%)")}(e,a)}class Ae{constructor(e,t){this.callback="function"==typeof e?e:()=>{};const n=t===1/0,o=Number.isFinite(t)&&t>=0?t:n?1/0:0;this.delay=o,this.remaining=o,this.startTime=null,this.timeoutId=null,this.isPaused=!1,this.isCompleted=!1,this.isInfinite=n}start(){return this.isCompleted||this.timeoutId||this.isInfinite||(this.isPaused=!1,this.startTime=Date.now(),this.timeoutId=setTimeout(()=>{this.isCompleted=!0,this.timeoutId=null;try{this.callback()}catch(e){console.error("PausableTimer callback error:",e)}},this.remaining),"function"==typeof this.timeoutId?.unref&&this.timeoutId.unref()),this}pause(){if(this.isPaused||!this.timeoutId||this.isCompleted)return this;clearTimeout(this.timeoutId),this.timeoutId=null;const e=Math.max(0,Date.now()-this.startTime);return this.remaining=Math.min(this.delay,Math.max(0,this.remaining-e)),this.isPaused=!0,this}resume(){return!this.isPaused||this.isCompleted||(this.isPaused=!1,this.start()),this}clear(){return this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null),this.isCompleted=!0,this}getRemainingTime(){return this.isCompleted?0:this.isPaused?this.remaining:this.timeoutId?Math.max(0,this.remaining-(Date.now()-this.startTime)):this.delay}}class Ce{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(){const e=Date.now().toString(36);let t="";if("undefined"!=typeof crypto&&"function"==typeof crypto.getRandomValues)try{const e=new Uint32Array(2);crypto.getRandomValues(e),t=`${e[0].toString(36)}${e[1].toString(36)}`.slice(0,9)}catch{}return t||(t=Math.floor(9007199254740991*Math.random()).toString(36).slice(0,9)),`tab-${e}-${t}`}_initBroadcastChannel(){try{this.channel=new BroadcastChannel("toast-notifications"),this.channel.unref?.(),this.channel.onmessage=e=>this._handleMessage(e.data),this._becomeLeadIfNeeded()}catch(e){console.warn("[Toast] BroadcastChannel initialization failed:",e),this.supportsBroadcastChannel=!1}}_becomeLeadIfNeeded(){this.channel&&(this.broadcast("sync-request","",{}),this.leaderTimer=setTimeout(()=>{this.leaderTimer=null,this.isLeadTab||(this.isLeadTab=!0,this.broadcast("leader-elected","",{tabId:this.tabId}))},1e3),this.leaderTimer.unref?.())}broadcast(e,t="",n={}){if(!this.supportsBroadcastChannel||!this.channel)return;let o=t,i=n;"object"==typeof t&&null!==t&&0===Object.keys(n).length&&(i=t,o="");const r={type:e,toastId:"string"==typeof o?o:String(o??""),payload:i&&"object"==typeof i?i:{},timestamp:Date.now(),tabId:this.tabId};try{this.channel.postMessage(r)}catch(e){console.warn("[Toast] Failed to broadcast message:",e)}}_handleMessage(e){if(!e||e.tabId===this.tabId)return;const{type:t,toastId:n,payload:o}=e;if("leader-elected"===t)return this.leaderTimer&&(clearTimeout(this.leaderTimer),this.leaderTimer=null),void(this.isLeadTab=!1);"sync-response"===t&&this.leaderTimer&&(clearTimeout(this.leaderTimer),this.leaderTimer=null),"sync-request"===t&&this.isLeadTab?this.broadcast("sync-response","all-toasts",{active:Array.from(this._getActiveToasts?.()||[]),queue:this._getQueuedToasts?.()||[]}):(this.listeners.get(t)||[]).forEach(i=>{try{i({toastId:n,payload:o,message:e})}catch(e){console.warn(`[Toast] Listener error for ${t}:`,e)}})}on(e,t){if("function"!=typeof t)throw new Error("Callback must be a function");return this.listeners.has(e)||this.listeners.set(e,[]),this.listeners.get(e).push(t),()=>{const n=this.listeners.get(e)||[],o=n.indexOf(t);o>-1&&n.splice(o,1)}}registerActiveToastsGetter(e){this._getActiveToasts=e}registerQueuedToastsGetter(e){this._getQueuedToasts=e}isSupported(){return this.supportsBroadcastChannel}getTabId(){return this.tabId}isLeadingTab(){return this.isLeadTab}destroy(){if(this.leaderTimer&&(clearTimeout(this.leaderTimer),this.leaderTimer=null),this.channel)try{this.channel.close()}catch(e){console.warn("[Toast] Failed to close BroadcastChannel:",e)}this.listeners.clear(),this.channel=null}}let Se=null;function ke(){if(!Se&&(Se=new Ce,"undefined"!=typeof window)){const e=()=>{Se?.destroy(),Se=null};window.addEventListener("pagehide",e),window.addEventListener("beforeunload",e)}return Se}function Ee(){Se&&(Se.destroy(),Se=null)}const Le={error:85,warning:70,info:40,success:30},Me=["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"],_e=["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"];function Ne(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=Le[t]||50;i.type=a,s+=.6*(a-50);const l="string"==typeof n?n:String(n??""),c=l.toLowerCase();let u=0;for(const e of Me){const t=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");new RegExp(`\\b${t}\\b`,"i").test(l)&&(r.push(e),u+=2)}for(const e of _e){const t=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");new RegExp(`\\b${t}\\b`,"i").test(l)&&(r.push(e),u-=1)}if(i.urgency=Math.min(Math.max(u,-10),20),s+=i.urgency,o===1/0)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 Ie(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 ze(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 Be(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 Pe(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 Ve(e){const t=[];if(e.touches&&e.touches.length>0)for(let n=0;n<e.touches.length;n++){const o=e.touches[n];t.push({x:o.clientX,y:o.clientY,id:o.identifier,time:Date.now()})}else if(e.changedTouches&&e.changedTouches.length>0)for(let n=0;n<e.changedTouches.length;n++){const o=e.changedTouches[n];t.push({x:o.clientX,y:o.clientY,id:o.identifier,time:Date.now()})}return t}function qe(e,t=20){if(0===e.startDistance||0===e.currentDistance)return{isPinch:!1,scale:1,direction:"none"};const n=e.currentDistance-e.startDistance;return{isPinch:Math.abs(n)>=t,scale:e.currentDistance/e.startDistance,direction:n>0?"out":"in",distanceChange:n}}function Oe(e,t={}){const{onFlick:n,onPinch:o,onSwipe:i,flickVelocityThreshold:r=.5,swipeVelocityThreshold:s=.3,swipeDistanceThreshold:a=50,pinchSensitivity:l=20}=t;let c=null,u=!1;const d=e=>{u=!0,c=function(e){const t=Ve(e);return{touches:t,startTouches:t.map(e=>({...e})),startTime:Date.now(),startDistance:t.length>=2?ze(t[0],t[1]):0,currentDistance:t.length>=2?ze(t[0],t[1]):0}}(e)},p=e=>{u&&c&&(c=function(e,t){const n=Ve(t);return{...e,touches:n,currentDistance:n.length>=2?ze(n[0],n[1]):e.currentDistance}}(c,e))},f=e=>{if(!u||!c)return;u=!1;const t=qe(c,l);t.isPinch&&"function"==typeof o&&o(t);const d=function(e){if(0===e.startTouches.length||0===e.touches.length)return{distance:0,velocity:0,direction:"none",duration:0};const t=e.startTouches[0],n=(e.touches.find(e=>e.id===t.id)||e.touches[0]).x-t.x,o=Date.now()-e.startTime;return{distance:n,velocity:Be(n,o),direction:n>0?"right":"left",duration:o}}(c);Pe(d.velocity,d.distance,r,30)&&"function"==typeof n&&n(d);const p=function(e,t=.3,n=50){return e.velocity>=t||Math.abs(e.distance)>=n}(d,s,a);p&&"function"==typeof i&&i(d),c=null};return{attach(){e&&(e.addEventListener("touchstart",d,{passive:!0}),e.addEventListener("touchmove",p,{passive:!0}),e.addEventListener("touchend",f,{passive:!0}),e.addEventListener("touchcancel",f,{passive:!0}))},detach(){e&&(e.removeEventListener("touchstart",d),e.removeEventListener("touchmove",p),e.removeEventListener("touchend",f),e.removeEventListener("touchcancel",f))},getState:()=>c}}const De=new Map,Re=new Map,Fe=[];let je=0,$e=0;function We(){return{activeCount:De.size,queueDepth:Fe.length,visibleCount:je,droppedCount:$e,timestamp:Date.now()}}function He(){const e=i();if("function"==typeof e.onMetrics)try{e.onMetrics(We())}catch(e){console.error("onMetrics callback error:",e)}}const Ue=ke();function Ge(e){if("number"==typeof e?.options?.priority&&Number.isFinite(e.options.priority))return e.options.priority;const t=e?.priority?.score;if("number"==typeof t&&Number.isFinite(t))return t;const n=i();if("function"==typeof n.priorityScorer)try{const t=n.priorityScorer({type:e?.options?.type||"info",message:e?.options?.message||"",duration:e?.options?.duration,options:e?.options});if("number"==typeof t&&Number.isFinite(t))return t;if(t&&"number"==typeof t.score&&Number.isFinite(t.score))return t.score}catch(e){console.warn("[Toast] Custom priorityScorer error, falling back to built-in:",e)}return Ne(e?.options).score}function Ye(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,Ye(e)},n=()=>{e._isExpanded=!1,Ye(e)},o=()=>{e._isExpanded=!0,Ye(e)},i=t=>{e.contains(t.relatedTarget)||(e._isExpanded=!1,Ye(e))};e.addEventListener("mouseenter",t),e.addEventListener("mouseleave",n),e.addEventListener("focusin",o),e.addEventListener("focusout",i);let r=null;r=Oe(e,{onPinch:t=>{"out"!==t.direction||e._isExpanded?"in"===t.direction&&e._isExpanded&&(e._isExpanded=!1,Ye(e)):(e._isExpanded=!0,Ye(e))}}),r.attach(),e._stackedCleanup=()=>{e.removeEventListener("mouseenter",t),e.removeEventListener("mouseleave",n),e.removeEventListener("focusin",o),e.removeEventListener("focusout",i),r?.detach?.(),e._stackedInitialized=!1}}if(!e.children||0===e.children.length)return;const t=Array.from(e.children),n=t.length,o=Boolean(e._isExpanded),r=Boolean(e.id&&e.id.includes("top"));t.forEach((e,t)=>{const s=n-1-t,a=o?"expanded":s>=3?"overflow":String(s);if("function"==typeof e.setAttribute&&e.setAttribute("data-stacked-depth",a),!i().disableInlineStyles)if(e.style.transition="transform 240ms cubic-bezier(0.16, 1, 0.3, 1), margin 240ms cubic-bezier(0.16, 1, 0.3, 1), opacity 240ms ease",o)e.style.transform="none",e.style.marginTop="0px",e.style.marginBottom="10px",e.style.opacity="1",e.style.zIndex=String(100+t),e.style.pointerEvents="auto";else if(0===s)e.style.transform="scale(1)",e.style.marginTop="0px",e.style.marginBottom="0px",e.style.opacity="1",e.style.zIndex="30",e.style.pointerEvents="auto";else if(1===s){const t=r?10:-10;e.style.transform=`scale(0.95) translateY(${t}px)`,e.style.marginTop="-55px",e.style.marginBottom="0px",e.style.opacity="0.9",e.style.zIndex="20",e.style.pointerEvents="auto"}else if(2===s){const t=r?20:-20;e.style.transform=`scale(0.90) translateY(${t}px)`,e.style.marginTop="-55px",e.style.marginBottom="0px",e.style.opacity="0.75",e.style.zIndex="10",e.style.pointerEvents="auto"}else{const t=r?30:-30;e.style.transform=`scale(0.85) translateY(${t}px)`,e.style.marginTop="-55px",e.style.marginBottom="0px",e.style.opacity="0",e.style.zIndex="1",e.style.pointerEvents="none"}})}async function Xe(e={}){try{const t=function(e={}){const t=e&&"object"==typeof e?e:{};return t.id?String(t.id):`${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)}|${he(t.position||"bottom-right")}`}(e);if(De.has(t)){const n=De.get(t);if(!n)throw new Error(`Active toast with key ${t} not found`);return n.count++,n.timer?.clear(),n.timer=Je(n.toast,e),await Ze(n),await it(n),He(),!e.fromSync&&i().syncTabs&&Ue.isSupported()&&Ue.broadcast("update",t,{count:n.count}),t}if(Re.has(t)){const e=Re.get(t);if(!e)throw new Error(`Pending toast with key ${t} not found`);return e.count++,t}const n={options:e,count:1,rafId:0};return Re.set(t,n),n.rafId=requestAnimationFrame(async()=>{const e=Re.get(t);if(e){if(Re.delete(t),je>=i().maxVisible){const n={options:e.options,key:t,count:e.count},o=i().maxQueueSize??100;return o<=0?($e++,void He()):(Fe.length>=o&&(Fe.shift(),$e++),i().aiPrioritization||e.options?.aiPrioritization?(n.priority=Ne(e.options),Fe.push(n),Fe.sort((e,t)=>Ge(t)-Ge(e))):Fe.push(n),He(),void await ot())}try{await Qe(e.options,t,e.count)}catch(e){console.error("showToast failed:",e)}}}),!e.fromSync&&i().syncTabs&&Ue.isSupported()&&Ue.broadcast("create",t,{options:e}),t}catch(e){console.error("showToast failed:",e)}}async function Qe(e,t,n){try{if(!e||"object"!=typeof e)throw new TypeError("options must be an object");je++;const o=await be(e,Te);if(!o)throw new Error("Failed to create toast container");const r=await pe(e,et);if(!r)throw new Error("Toast element creation failed");const s=document.createElement("div");s.className="toast-outer-wrapper",i().disableInlineStyles||Object.assign(s.style,{position:"relative",display:"inline-block",overflow:"visible",marginBottom:"10px",zIndex:"0",width:"100%",pointerEvents:"auto"});const a=document.createElement("div");a.className="toast-inner-wrapper",i().disableInlineStyles||Object.assign(a.style,{position:"relative",overflow:"hidden",zIndex:"1"}),a.appendChild(r),s.appendChild(a),o.id.includes("toast-container-")&&(o.appendChild(s),e.stacked&&o.setAttribute("data-stacked","true"),"true"===o.getAttribute("data-stacked")&&Ye(o)),k(r);const l=!1!==e.pauseOnHover&&(!0===e.pauseOnHover||!!e.cta||Boolean(i().pauseOnHover)),c={outer:s,toast:r,options:e,count:Math.max(1,Math.floor(n??0)),pauseOnHover:l};De.set(t,c),r._key=t,He(),c.count>1&&await it(c),c.timer=Je(r,e),await Ze(c)}catch(t){console.error("Something went wrong: ",t),je=Math.max(0,je-1),He(),(document.querySelector('[id^="toast-container-"]')||document.body).appendChild(await ae(e,et))}}Ue.registerActiveToastsGetter(()=>Array.from(De.keys())),Ue.registerQueuedToastsGetter(()=>Fe.map(e=>({key:e.key,options:e.options,count:e.count}))),Ue.isSupported()&&"undefined"!=typeof window&&(Ue.on("create",({toastId:e,payload:t})=>{i().syncTabs&&e&&t&&!De.has(e)&&!Re.has(e)&&Xe({...t.options,fromSync:!0})}),Ue.on("update",({toastId:e,payload:t})=>{if(i().syncTabs&&e&&t&&De.has(e)){const n=De.get(e);n&&n.count!==t.count&&(n.count=t.count,it(n))}}),Ue.on("dismiss",({toastId:e})=>{i().syncTabs&&e&&(De.has(e)||Re.has(e))&&tt(e,!0)}),Ue.on("sync-response",({payload:e})=>{if(i().syncTabs&&e&&Array.isArray(e.queue))for(const t of e.queue)!t?.options||De.has(t.key)||Re.has(t.key)||Xe({...t.options,fromSync:!0})}));const Ke=async function(){try{if(0===De.size){if(Re.size>0){const[e,t]=Array.from(Re.entries()).at(-1);return t?.rafId&&cancelAnimationFrame(t.rafId),Re.delete(e),void He()}return Fe.length>0?(Fe.pop(),void He()):void 0}let e=null;const t=Array.from(De.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 et(n)}catch(e){console.error("dismissMostRecent failed:",e)}};function Je(e,t){const n=Number(t?.duration);if(t?.duration===1/0||"number"==typeof t?.duration&&t?.duration<=0)return null;const o=Number.isFinite(n)&&n>0?n:2500,i=new Ae(async()=>await et(e),o+5);return i.start(),i}async function Ze(e){if(!e.pauseOnHover||!e.outer||!e.timer)return;e.outer._pauseCleanup?.();const{outer:t,timer:n,toast:o}=e,i=()=>{n.pause(),o?._progressAnimation?.pause(),o?._pauseUndo?.(),o?.classList.add("toast-paused")},r=()=>{n.resume(),o?._progressAnimation?.play(),o?._resumeUndo?.(),o?.classList.remove("toast-paused")},s=e=>{e.target.matches("[tabindex], div, span, button, a")&&(n.pause(),o?._progressAnimation?.pause(),o?._pauseUndo?.(),o?.classList.add("toast-paused"))},a=e=>{t.contains(e.relatedTarget)||(n.resume(),o?._progressAnimation?.play(),o?._resumeUndo?.(),o?.classList.remove("toast-paused"))};t.addEventListener("mouseenter",i),t.addEventListener("mouseleave",r),t.addEventListener("focusin",s),t.addEventListener("focusout",a),t._pauseCleanup=()=>{t.removeEventListener("mouseenter",i),t.removeEventListener("mouseleave",r),t.removeEventListener("focusin",s),t.removeEventListener("focusout",a)}}async function et(e){if(e?._key)return tt(e._key)}async function tt(e,t=!1){try{if(!e)return;!t&&i().syncTabs&&Ue.isSupported()&&Ue.broadcast("dismiss",e,{});const n=Re.get(e);if(n)return cancelAnimationFrame(n.rafId),Re.delete(e),void He();const o=Fe.findIndex(t=>t.key===e);if(-1!==o)return Fe.splice(o,1),void He();const r=De.get(e);if(!r)return;if(r.timer?.clear(),r.outer?._pauseCleanup?.(),r.toast?._cleanupCloseButton?.(),r.toast?._cleanupCTA?.(),r.toast?._cleanupUndo?.(),r.toast?._cleanupSwipe?.(),r.toast?._cleanup?.(),r.toast?._progressAnimation){try{r.toast._progressAnimation.cancel()}catch{}r.toast._progressAnimation=null}const s=r.outer?.querySelector(".toast-count-badge");s?._scaleTimer&&(clearTimeout(s._scaleTimer),s._scaleTimer=null);const a=r.toast?.querySelector("button, a");a?._cleanup?.(),De.delete(e),je=Math.max(0,je-1),He(),s&&s.remove();const l=r.toast?._animationDuration??400,c=Math.min(l,300);if(r.toast){if(!i().disableInlineStyles){const e=String(r.options?.position||r.outer?.parentElement?.id||"").toLowerCase(),t=e.includes("top"),n=e.includes("left"),o=e.includes("right"),i=String(r.options?.animationType||"").toLowerCase().trim();let s="translateY(20px)";"fade"===i?s="none":"zoom"===i||"scale"===i?s="scale(0.75)":"flip"===i?s="perspective(600px) rotateX(-45deg)":"slide"===i&&(s=n?"translateX(-100%)":o?"translateX(100%)":t?"translateY(-100%)":"translateY(100%)"),r.toast.style.transition=`opacity ${c}ms ease-in, transform ${c}ms ease-in`,r.toast.style.opacity="0",r.toast.style.transform=s}r.toast.classList.remove("active")}const u=r.outer?.parentElement;if(await async function(e,t,n=400){return e?new Promise(o=>{let i=!1,r=null;const s=t||e.firstElementChild||e,a=()=>{if(i)return;i=!0,r&&(clearTimeout(r),r=null);try{s?.removeEventListener?.("transitionend",l,!0)}catch{}const t=e.querySelector?.(".toast")||e;if(t?._pooledId)try{ue().release(t,t._pooledId)}catch{}!async function(e){if(!e)return!0;try{if("function"==typeof e.remove)return e.remove(),!0}catch{}try{if(e.parentNode)return e.parentNode.removeChild(e),!0}catch{}}(e),o()},l=e=>{try{if(e.target!==s)return;("transform"===e.propertyName||!s.style.transform&&"opacity"===e.propertyName)&&a()}catch(e){console.error("removeWithTransition error:",e)}};if(!s)return a();try{s.addEventListener("transitionend",l,!0)}catch(e){console.error("removeWithTransition error:",e)}r=setTimeout(a,n+100),"function"==typeof r?.unref&&r.unref()}):Promise.resolve()}(r.outer,r.toast,c),u&&0===u.children.length&&u.id?.startsWith("toast-container-"))try{u._stackedCleanup?.(),function(e){if(!e)return;const t="string"==typeof e&&e.startsWith("toast-container-")?e:ye(e);fe.delete(t),me.delete(t)}(u.id),u.remove()}catch{}else u&&"true"===u.getAttribute("data-stacked")&&Ye(u);await ot()}catch(e){console.error("Closing Toast failed!: ",e)}}let nt=!1;async function ot(){if(!nt){nt=!0;try{const e=i();for((e.aiPrioritization||Fe.some(e=>e.options?.aiPrioritization||"number"==typeof e.options?.priority))&&Fe.length>1&&Fe.sort((e,t)=>Ge(t)-Ge(e));je<e.maxVisible&&Fe.length;){const e=Fe.shift();if(De.has(e.key)){const t=De.get(e.key);t.count+=e.count,await it(t),He();continue}await Qe(e.options,e.key,e.count)}He()}finally{nt=!1}}}async function it({outer:e,count:t}){if(!(e&&e instanceof HTMLElement))throw new Error("updateBadge: outer must be a valid HTMLElement");if(t<2){const t=e.querySelector(".toast-count-badge");return void(t&&t.remove())}let n=e.querySelector(".toast-count-badge");n||(n=document.createElement("span"),n.className="toast-count-badge",n.setAttribute("aria-label",`${t} identical notifications`),i().disableInlineStyles||Object.assign(n.style,{position:"absolute",top:"6px",right:"6px",backgroundColor:"#f44336",color:"#fff",borderRadius:"50%",minWidth:"20px",height:"20px",fontSize:"12px",fontWeight:"600",display:"flex",alignItems:"center",justifyContent:"center",border:"2px solid #fff",boxShadow:"0 2px 6px rgba(0,0,0,0.3)",zIndex:"2",pointerEvents:"none",transition:"transform 150ms ease"}),e.appendChild(n)),n.textContent=t>99?"99+":String(t);try{r()||(n._scaleTimer&&clearTimeout(n._scaleTimer),n.style.transform="scale(1.2)",n._scaleTimer=setTimeout(()=>{n.style.transform="scale(1)",n._scaleTimer=null},150),"function"==typeof n._scaleTimer?.unref&&n._scaleTimer.unref())}catch(e){console.error("updateBadge animation error:",e)}}async function rt(e,t={}){if(!e||"object"!=typeof t||null===t)return;if(Re.has(e)){const n=Re.get(e);return void(n.options={...n.options,...t})}const n=Fe.find(t=>t.key===e);if(n)return void(n.options={...n.options,...t});const o=De.get(e);if(!o||!o.toast)return;const r={...o.options};o.options={...o.options,...t};const s=o.toast,a=s._messageSpan||s.querySelector(".toast-message")||s.querySelector("span:not(.toast-count-badge)");if(void 0!==t.message){const e=String(t.message??""),n=void 0!==t.allowHtml?Boolean(t.allowHtml):Boolean(o.options.allowHtml),i=("success"===t.type||"error"===t.type)&&!0!==t.showLoader;if(a){const o=a.querySelector(".toast-loader");if(a.innerHTML="",o&&!1!==t.showLoader&&null!==t.loader&&!i){a.appendChild(o);const e=document.createElement("span");e.style.display="inline-block",e.style.width="8px",a.appendChild(e)}if(n&&e.trim().length>0)try{const t=w(e),n=document.createElement("div");for(n.innerHTML=t;n.firstChild;)a.appendChild(n.firstChild)}catch{a.appendChild(document.createTextNode(e))}else a.appendChild(document.createTextNode(e));a.setAttribute("title",a.textContent||"")}}const l=("success"===t.type||"error"===t.type)&&!0!==t.showLoader;if(!1===t.showLoader||null===t.loader||l){const e=a?.querySelector(".toast-loader");e&&(e.nextSibling&&"SPAN"===e.nextSibling.nodeName&&e.nextSibling.remove(),e.remove())}else if((!0===t.showLoader||t.loader&&"object"==typeof t.loader)&&a&&!a.querySelector(".toast-loader")){const e=x(t.loader||{});a.insertBefore(e,a.firstChild);const n=document.createElement("span");n.style.display="inline-block",n.style.width="8px",a.insertBefore(n,e.nextSibling)}if(t.type){const e=String(t.type).toLowerCase().trim();s.className=s.className.replace(/\btoast-(info|success|error|warning)\b/g,`toast-${e}`);const n="error"===e;if(t.role?s.setAttribute("role",t.role):s.setAttribute("role","alert"),s.setAttribute("aria-live",t.ariaLive||(n?"assertive":"polite")),!t.backgroundColor){const t={success:"#28a745",error:"#dc3545",warning:"#ffc107",info:"#17a2b8"};t[e]&&(s.style.background=t[e])}}if(void 0!==t.icon||void 0!==t.type){const e=s?.querySelector(".toast-icon");e&&e.remove();const n=re({...o.options,...t});n&&(a?s.insertBefore(n,a):s.appendChild(n))}if(t.backgroundColor&&(s.style.background=t.backgroundColor),t.textColor)s.style.color=t.textColor,a&&(a.style.color=t.textColor);else if(t.type||t.backgroundColor){const e=s.style.background;if(e){const t=p(e);s.style.color=t,a&&(a.style.color=t)}}if(void 0!==t.borderRadius){const e="number"==typeof t.borderRadius?`${t.borderRadius}px`:t.borderRadius;s.style.borderRadius=e}if(void 0!==t.maxWidth){const e="number"==typeof t.maxWidth?`${t.maxWidth}px`:t.maxWidth;s.style.maxWidth=e}if(void 0!==t.fontDirection){const e="auto"!==t.fontDirection?t.fontDirection:"";s.style.direction=e,a&&(a.style.direction=e)}if(void 0!==t.fontSize){const e="number"==typeof t.fontSize?`${t.fontSize}px`:t.fontSize;s.style.fontSize=e,a&&(a.style.fontSize=e)}if(void 0!==t.fontFamily&&(s.style.fontFamily=t.fontFamily,a&&(a.style.fontFamily=t.fontFamily)),void 0!==t.fontWeight){const e="number"==typeof t.fontWeight?String(t.fontWeight):t.fontWeight;s.style.fontWeight=e,a&&(a.style.fontWeight=e)}if(void 0!==t.fontLineHeight&&(s.style.lineHeight=t.fontLineHeight,a&&(a.style.lineHeight=t.fontLineHeight)),void 0!==t.role&&s.setAttribute("role",t.role),void 0!==t.ariaLive&&s.setAttribute("aria-live",t.ariaLive),void 0!==t.className){const e=r.className;e&&"string"==typeof e&&s.classList.remove(...e.trim().split(/\s+/)),t.className&&"string"==typeof t.className&&s.classList.add(...t.className.trim().split(/\s+/))}if(void 0!==t.progress){let e=Number(t.progress);Number.isFinite(e)||(e=0),e<1&&e>0&&(e*=100),e=Math.min(100,Math.max(0,e));let n=s.querySelector(".toast-progress-bar");if(n||!t.showProgressBar&&!o.options.showProgressBar||(S(s,{...o.options,...t}),n=s.querySelector(".toast-progress-bar")),n){if(s._progressAnimation){try{s._progressAnimation.cancel()}catch{}s._progressAnimation=null}n.style.transition="width 200ms ease",n.style.width=`${e}%`}}else if(!1===t.showProgressBar){const e=s.querySelector(".toast-progress-bar");e&&e.remove()}if(t.progressBarColor||t.progressColor){const e=s.querySelector(".toast-progress-bar");e&&(e.style.background=t.progressBarColor||t.progressColor)}if(t.progressPosition){const e=s.querySelector(".toast-progress-bar");e&&(e.style.top="top"===t.progressPosition?"0":"auto",e.style.bottom="bottom"===t.progressPosition?"0":"auto")}if(void 0!==t.progressHeight){const e=s.querySelector(".toast-progress-bar");if(e){const n="number"==typeof t.progressHeight?`${t.progressHeight}px`:t.progressHeight;e.style.height=n}}if(void 0!==t.animationType&&(o.options.animationType=t.animationType,s._animationType=t.animationType),void 0!==t.duration){o.timer?.clear();const e=Number(t.duration);Number.isFinite(e)&&e>0?(o.timer=Je(s,{duration:e}),await Ze(o)):o.timer=null}else 0!==o.options.duration&&o.timer||"success"!==t.type&&"error"!==t.type&&"warning"!==t.type&&!1!==t.showLoader||(o.timer?.clear(),o.timer=Je(s,{duration:2500}),await Ze(o));if(void 0!==t.cta&&(s._cleanupCTA&&(s._cleanupCTA(),s._cleanupCTA=null),s.querySelectorAll(".toast-cta").forEach(e=>e.remove()),t.cta&&"object"==typeof t.cta)&&v(s,{...o.options,...t},et),void 0!==t.undo&&(s._cleanupUndo&&(s._cleanupUndo(),s._cleanupUndo=null),s.querySelectorAll(".toast-undo-btn").forEach(e=>e.remove()),t.undo)&&T(s,{...o.options,...t},et),void 0!==t.showCloseButton){const e=s.querySelector(".toast-close-btn");!1===t.showCloseButton?(s._cleanupCloseButton&&(s._cleanupCloseButton(),s._cleanupCloseButton=null),e&&e.remove()):!0!==t.showCloseButton||e||A(s,o.options,et)}(void 0!==t.sound?Boolean(t.sound):Boolean(t.type&&(o.options.sound||i().sound)))&&q("string"==typeof t.sound?t.sound:t.type||o.options.type||"info",t.soundPreset||o.options.soundPreset||i().soundPreset||"modern");const c=s.closest('[id^="toast-container-"]');c&&"true"===c.getAttribute("data-stacked")&&Ye(c)}let st={success:"#28a745",error:"#dc3545",warning:"#ffc107",info:"#17a2b8"},at={success:"Operation completed successfully!",error:"Something went wrong!",warning:"Warning message!",info:"Information message!"},lt=!1,ct=null;function ut(e,t){const n="object"!=typeof t||null===t||Array.isArray(t)?{}:t;return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||"bigint"==typeof e?{...n,message:String(e)}:e instanceof Error?{...n,message:e.message||String(e)}:"object"!=typeof e||null===e||Array.isArray(e)?{...n}:{...n,...e}}function dt(e){try{if(e&&"object"==typeof e&&!Array.isArray(e)){const t=["success","error","warning","info"],n={};for(const[o,i]of Object.entries(e))t.includes(o)&&"string"==typeof i&&i.trim()&&(n[o]=i.trim());Object.keys(n).length>0&&(st={...st,...n})}}catch(e){console.error("setDefaultColors failed:",e)}}function pt(e){try{if(e&&"object"==typeof e&&!Array.isArray(e)){const t=["success","error","warning","info"],n={};for(const[o,i]of Object.entries(e))t.includes(o)&&"string"==typeof i&&i.trim()&&(n[o]=i.trim());Object.keys(n).length>0&&(at={...at,...n})}}catch(e){console.error("setDefaultMessages failed:",e)}}let ft=!1,mt=null;const ht=async function(e={}){return"undefined"!=typeof window&&"undefined"!=typeof document?(await async function(){lt||"undefined"!=typeof window&&"undefined"!=typeof document&&("complete"!==document.readyState&&"interactive"!==document.readyState?(ct||(ct=new Promise(e=>{document.addEventListener("DOMContentLoaded",()=>{lt=!0,e()},{once:!0})})),await ct):lt=!0)}(),await async function(e={}){try{const t=await async function(e){const t=ut(e),n=i(),o=String(t?.position??n.defaultPosition).toLowerCase().trim(),r=o?.includes("top-full-width")||o?.includes("bottom-full-width")?"100vw":"400px",s={allowHtml:!1,sanitizeHtml:!0,pauseOnHover:void 0,duration:2500,position:n.defaultPosition,type:"info",borderRadius:"50px",backgroundColor:void 0,textColor:void 0,showCloseButton:!0,animationDuration:"0.4s",animationEasing:"ease",showProgressBar:!0,progressColor:void 0,progressBarColor:void 0,progressHeight:"4px",progressPosition:"bottom",progressDirection:"decreasing",animationType:"default",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',fontSize:"14px",fontWeight:"400",fontLineHeight:"1.4",fontDirection:"auto",wrapText:"normal",maxWidth:r,...t};s.message=t?.message??s.message;try{s.backgroundColor||(s.backgroundColor=st?.[s.type]??(window.matchMedia("(prefers-color-scheme: dark)").matches?"#f5f5f5":"#111111"))}catch(e){console.warn("Background color resolution failed:",e)}try{s.message=s.message||at?.[s.type]||"No Message Provided!"}catch(e){console.warn("Default message resolution failed:",e)}try{!s.textColor&&s.backgroundColor&&(s.textColor=p(s.backgroundColor))}catch(e){console.warn("Text color resolution failed:",e)}try{const e=t?.progressBarColor||t?.progressColor;e?(s.progressColor=e,s.progressBarColor=e):!s.progressColor&&s.backgroundColor&&(s.progressColor=s.textColor||p(s.backgroundColor),s.progressBarColor=s.progressColor)}catch(e){console.warn("Progress bar color resolution failed:",e)}return"string"!=typeof s.message&&(s.message="No Message Provided!"),s}(e);return await async function(e){try{return await be(e,Te)}catch(e){return console.error("Failed to create toast container:",e),i().targetNode||document.body}}(t),await Xe(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 yt(e={},t){const n=ut(e,t),o=await async function(){if(ft&&mt)try{await mt}catch(e){console.warn("Previous close operation failed (continuing anyway):",e)}return ht(n)}();return{id:o,dismiss:()=>o?tt(o):Promise.resolve(),update:e=>o?rt(o,e):Promise.resolve()}}yt.success=(e,t)=>yt({...ut(e,t),type:"success"}),yt.error=(e,t)=>yt({...ut(e,t),type:"error"}),yt.warning=(e,t)=>yt({...ut(e,t),type:"warning"}),yt.info=(e,t)=>yt({...ut(e,t),type:"info"}),yt.loading=(e,t)=>yt({type:"info",showLoader:!0,duration:0,showProgressBar:!1,pauseOnHover:!1,...ut(e,t)}),yt.custom=(e,t)=>yt({allowHtml:!0,...ut(e,t)});const gt=yt.success,bt=yt.error,wt=yt.warning,xt=yt.info,vt=yt.loading,Tt=yt.custom,At=async e=>{let t=e;if(e&&"function"==typeof e.then)try{t=await e}catch{return}ft=!0,mt=(async()=>{try{"string"==typeof t&&t.length>0?await tt(t):t&&"object"==typeof t?"function"==typeof t.dismiss?await t.dismiss():t._key&&"string"==typeof t._key?await tt(t._key):t.id&&"string"==typeof t.id?await tt(t.id):await Ke():await Ke()}finally{ft=!1,mt=null}})(),await mt},Ct=async()=>{ft=!0,mt=(async()=>{try{await async function(){try{for(const[,e]of Re)e?.rafId&&cancelAnimationFrame(e.rafId);Re.clear(),Fe.length=0,He();const e=Array.from(De.values()).map(e=>e.toast).filter(Boolean);await Promise.allSettled(e.map(async e=>{try{await et(e)}catch(e){console.warn("closeAllToasts: failed to close one toast:",e)}}))}catch(e){console.error("closeAllToasts failed:",e)}}()}finally{ft=!1,mt=null}})(),await mt},St=Ct,kt=Ct,Et=864e5;async function Lt(e,t={},n={}){const o=t&&"object"==typeof t?t:{},i=n&&"object"==typeof n?n:{},r=o.loading??"Loading...",s="object"!=typeof r||null===r||Array.isArray(r)?{...i,type:"info",message:String(r),duration:Et,showProgressBar:!1,pauseOnHover:!1,showLoader:i.showLoader??!0}:{...i,type:"info",duration:Et,showProgressBar:!1,pauseOnHover:!1,showLoader:!0,...r},a=await yt(s),l={...i,pauseOnHover:i.pauseOnHover};try{const t="function"==typeof e?e():e,n=await t;if(a&&"function"==typeof a.dismiss)try{await a.dismiss()}catch{}const i="function"==typeof o.success?o.success(n):o.success??"Done!",r="object"!=typeof i||null===i||Array.isArray(i)?{...l,type:"success",message:String(i)}:{...l,type:"success",...i};return await yt(r),n}catch(e){if(a&&"function"==typeof a.dismiss)try{await a.dismiss()}catch{}const t="function"==typeof o.error?o.error(e):o.error??"Something went wrong.",n="object"!=typeof t||null===t||Array.isArray(t)?{...l,type:"error",message:String(t)}:{...l,type:"error",...t};throw await yt(n),e}}yt.promise=Lt,yt.dismiss=At,yt.dismissAll=Ct,yt.clear=Ct;const Mt="3.18.0";if("undefined"!=typeof window&&"undefined"!=typeof document&&!window.__customizableToastEscapeAttached){window.__customizableToastEscapeAttached=!0;const e=e=>{if("Escape"===e.key||"Esc"===e.key)(async()=>{try{ft=!0,mt=(async()=>{try{await Ke()}finally{ft=!1,mt=null}})(),await mt}catch(e){console.error("Escape key dismiss failed:",e),ft=!1,mt=null}})();else if("F6"===e.key||(e.altKey||e.metaKey)&&("t"===e.key||"T"===e.key)){const e=document.querySelectorAll('[id^="toast-container-"] [id^="toast-"]');if(e.length>0){const t=e[e.length-1],n=t.querySelector("button, a, [tabindex='0']");n&&"function"==typeof n.focus?n.focus():"function"==typeof t.focus&&t.focus()}}};window.addEventListener("keydown",e,{passive:!0})}try{"undefined"!=typeof window&&(window.customizableToast={setConfig:n,getConfig:i,resetConfig:o,shouldReduceMotion:r,version:Mt,createToast:yt,success:gt,error:bt,warning:wt,info:xt,loading:vt,custom:Tt,setDefaultColors:dt,setDefaultMessages:pt,noop:Ct,dismiss:At,dismissAll:Ct,clear:Ct,toastPromise:Lt,promise:Lt,updateToastByKey:rt,setAudioEnabled:F,isAudioEnabled:j,playTone:q,registerSoundPreset:O,getSoundPresets:D,resetSoundPresets:R,resetAudioContext:$,getToastPool:ue,resetToastPool:de,getToastBroadcaster:ke,resetToastBroadcaster:Ee,calculateToastPriority:Ne,categorizeToast:Ie,createGestureDetector:Oe,detectPinch:qe,isFlick:Pe,calculateVelocity:Be,generateToastId:c,resetToastIdCounter:l,getToastMetrics:We,registerSpringPreset:U,getSpringPresets:G,resetSpringPresets:Y,resolveSpringConfig:X,solveSpring:Q,calculateSpringSettlingDuration:K,generateSpringLinearEasing:J,getSpringTransition:Z,getAudioContext:N,getAudioAnalyser:z})}catch(bt){console.error("Global assignment failed:",bt)}exports.calculateSpringSettlingDuration=K,exports.calculateToastPriority=Ne,exports.calculateVelocity=Be,exports.categorizeToast=Ie,exports.clear=St,exports.createGestureDetector=Oe,exports.createToast=yt,exports.custom=Tt,exports.default=yt,exports.detectPinch=qe,exports.dismiss=At,exports.dismissAll=kt,exports.error=bt,exports.generateSpringLinearEasing=J,exports.generateToastId=c,exports.getAudioAnalyser=z,exports.getAudioContext=N,exports.getConfig=i,exports.getSoundPresets=D,exports.getSpringPresets=G,exports.getSpringTransition=Z,exports.getToastBroadcaster=ke,exports.getToastMetrics=We,exports.getToastPool=ue,exports.info=xt,exports.isAudioEnabled=j,exports.isFlick=Pe,exports.loading=vt,exports.noop=Ct,exports.playTone=q,exports.registerSoundPreset=O,exports.registerSpringPreset=U,exports.resetAudioContext=$,exports.resetConfig=o,exports.resetContainerRegistry=function(){fe.clear(),me.clear()},exports.resetSoundPresets=R,exports.resetSpringPresets=Y,exports.resetToastBroadcaster=Ee,exports.resetToastIdCounter=l,exports.resetToastManager=function(){for(const[,e]of Re)e?.rafId&&cancelAnimationFrame(e.rafId);Re.clear(),Fe.length=0;for(const[,e]of De){if(e.timer?.clear(),e.outer?._pauseCleanup?.(),e.toast?._cleanupCloseButton?.(),e.toast?._cleanupCTA?.(),e.toast?._cleanupUndo?.(),e.toast?._cleanupSwipe?.(),e.toast?._cleanup?.(),e.toast?._progressAnimation){try{e.toast._progressAnimation.cancel()}catch{}e.toast._progressAnimation=null}const t=e.outer?.querySelector(".toast-count-badge");t?._scaleTimer&&(clearTimeout(t._scaleTimer),t._scaleTimer=null)}"undefined"!=typeof document&&document.querySelectorAll('[id^="toast-container-"]').forEach(e=>{try{e._stackedCleanup?.()}catch{}}),De.clear(),je=0,$e=0,nt=!1,He()},exports.resetToastPool=de,exports.resolveSpringConfig=X,exports.setAudioEnabled=F,exports.setConfig=n,exports.setDefaultColors=dt,exports.setDefaultMessages=pt,exports.shouldReduceMotion=r,exports.solveSpring=Q,exports.success=gt,exports.toastPromise=Lt,exports.updateToastByKey=rt,exports.version=Mt,exports.warning=wt;
|
|
15
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e=Object.freeze({maxVisible:3,maxQueueSize:100,zIndex:9999,targetNode:null,disableInlineStyles:!1,reducedMotion:"auto",defaultPosition:"bottom-right",theme:"light",stacked:!1,swipeToDismiss:!0,sound:!0,soundPreset:"modern",pauseOnHover:!1,syncTabs:!1,aiPrioritization:!1,priorityScorer:null,onMetrics:null,debug:!1}),t={...e};function n(e={}){if(!e||"object"!=typeof e||Array.isArray(e))return i();const{maxVisible:n,maxQueueSize:o,zIndex:r,targetNode:s,disableInlineStyles:a,reducedMotion:l,defaultPosition:c,theme:u,stacked:d,swipeToDismiss:p,sound:m,soundPreset:f,pauseOnHover:h,syncTabs:y,aiPrioritization:g,priorityScorer:b,onMetrics:w,debug:x}=e;if(void 0!==x&&(t.debug=Boolean(x)),void 0!==n){const e=Number(n);Number.isFinite(e)&&e>0&&(t.maxVisible=Math.max(1,Math.floor(e)))}if(void 0!==o){const e=Number(o);Number.isFinite(e)&&e>=0&&(t.maxQueueSize=Math.floor(e))}if(void 0!==r){const e=Number(r);Number.isFinite(e)&&(t.zIndex=Math.trunc(e))}if(void 0!==s&&(t.targetNode=s&&"object"==typeof s&&"function"==typeof s.appendChild?s:null),void 0!==a&&(t.disableInlineStyles=Boolean(a)),void 0!==l){const e=String(l||"auto").toLowerCase();["auto","always","never"].includes(e)&&(t.reducedMotion=e,"undefined"!=typeof document&&("always"===e?document.documentElement.setAttribute("data-toast-reduced-motion","always"):"never"===e?document.documentElement.setAttribute("data-toast-reduced-motion","never"):document.documentElement.removeAttribute("data-toast-reduced-motion")))}if(void 0!==c){const e=String(c||"").toLowerCase().trim();e&&(t.defaultPosition=e)}if(void 0!==u){const e=String(u||"light").toLowerCase();["light","dark","high-contrast","compact","spacious","glass"].includes(e)&&(t.theme=e,"undefined"!=typeof document&&document.documentElement.setAttribute("data-toast-theme",e))}if(void 0!==d&&(t.stacked=Boolean(d)),void 0!==p&&(t.swipeToDismiss=Boolean(p)),void 0!==m&&(t.sound=Boolean(m)),void 0!==f){const e=String(f||"modern").toLowerCase().trim();e&&(t.soundPreset=e)}return void 0!==h&&(t.pauseOnHover=Boolean(h)),void 0!==y&&(t.syncTabs=Boolean(y)),void 0!==g&&(t.aiPrioritization=Boolean(g)),void 0!==b&&(t.priorityScorer="function"==typeof b?b:null),void 0!==w&&(t.onMetrics="function"==typeof w?w:null),i()}function o(){return Object.assign(t,e),"undefined"!=typeof document&&(document.documentElement.removeAttribute("data-toast-theme"),document.documentElement.removeAttribute("data-toast-reduced-motion")),i()}function i(){return{...t}}function r(){if("always"===t.reducedMotion)return!0;if("never"===t.reducedMotion)return!1;try{return Boolean("undefined"!=typeof window&&"function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches)}catch{return!1}}let s=0;const a=Math.floor(65535*Math.random()).toString(36).padStart(3,"0");function l(){s=0}function c(e="toast"){const t="string"==typeof e?e.trim().toLowerCase().replace(/[^a-z0-9_-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,""):"",n=t&&!/^[0-9]/.test(t)?t:"toast",o=Date.now().toString(36);s=s+1&16777215;const i=s.toString(36);return`${n}-${o}-${a}${i}`}const u=new class{constructor(e=200){this.maxSize=e,this.map=new Map}get(e){if(!this.map.has(e))return;const t=this.map.get(e);return this.map.delete(e),this.map.set(e,t),t}set(e,t){if(this.map.has(e))this.map.delete(e);else if(this.map.size>=this.maxSize){const e=this.map.keys().next().value;this.map.delete(e)}this.map.set(e,t)}}(200),d={};function p(e){if(!e)return"#ffffff";const t=String(e),n=u.get(t);if(n)return n;if(d[e?.toLowerCase()]){const n=d[e.toLowerCase()];return u.set(t,n),n}let o,i,r;try{const t=function(e){const t=e?.match(/^#(?:([0-9a-f]{3,4})|([0-9a-f]{6})|([0-9a-f]{8}))$/i);if(t){let e=t[1]||t[2]||t[3];if(3!==e.length&&4!==e.length||(e=e.slice(0,3).split("").map(e=>e+e).join("")),e.length>=6){const t=parseInt(e.slice(0,2),16),n=parseInt(e.slice(2,4),16),o=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(parseFloat(t)/100*255):Number(t)},o=e?.match(/rgba?\(\s*([\d.]+%?)\s*,\s*([\d.]+%?)\s*,\s*([\d.]+%?)(?:\s*,\s*[\d.%]+)?\s*\)/i);if(o){const e=Math.min(255,Math.max(0,n(o[1]))),t=Math.min(255,Math.max(0,n(o[2]))),i=Math.min(255,Math.max(0,n(o[3])));if(Number.isFinite(e)&&Number.isFinite(t)&&Number.isFinite(i))return{r:e,g:t,b:i}}const i=e?.match(/rgba?\(\s*([\d.]+%?)\s+([\d.]+%?)\s+([\d.]+%?)(?:\s*\/\s*[\d.%]+)?\s*\)/i);if(i){const e=Math.min(255,Math.max(0,n(i[1]))),t=Math.min(255,Math.max(0,n(i[2]))),o=Math.min(255,Math.max(0,n(i[3])));if(Number.isFinite(e)&&Number.isFinite(t)&&Number.isFinite(o))return{r:e,g:t,b:o}}const r=e?.match(/hsla?\(\s*(-?[\d.]+(?:deg|rad|turn)?)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*[\d.%]+)?\s*\)/i),s=!r&&e?.match(/hsla?\(\s*(-?[\d.]+(?:deg|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=parseFloat(t);return Number.isFinite(n)?(t.endsWith("turn")?n*=360: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{o=i=r=128}const s=(e,t,n)=>{const o=[e,t,n].map(e=>(e/=255)<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4));return.2126*o[0]+.7152*o[1]+.0722*o[2]},a=(e,t)=>{const n=s(...e),o=s(...t);return(Math.max(n,o)+.05)/(Math.min(n,o)+.05)};let[l,c,p]=((e,t,n)=>{e/=255,t/=255,n/=255;const o=Math.max(e,t,n),i=Math.min(e,t,n);let r,s,a=(o+i)/2;if(o===i)r=s=0;else{const l=o-i;switch(s=a>.5?l/(2-o-i):l/(o+i),o){case e:r=(t-n)/l+(t<n?6:0);break;case t:r=(n-e)/l+2;break;case n:r=(e-t)/l+4}r/=6}return[360*r,s,a]})(o,i,r),m=p<.5?Math.min(p+.5,1):Math.max(p-.5,0),[f,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,m);if(a([o,i,r],[f,h,y])<4.5){const e=a([o,i,r],[0,0,0]),t=a([o,i,r],[255,255,255]);[f,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")}`)(f,h,y);return u.set(t,g),g}Object.entries({aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],transparent:[255,255,255],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}).forEach(([e,[t,n,o]])=>{const i=e=>{const t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)},r=.2126*i(t)+.7152*i(n)+.0722*i(o),s=(r+.05)/.05,a=1.05/(r+.05);d[e.toLowerCase()]=s>=a?"#000000":"#ffffff"});const m=new Set(["DIV","SPAN","P","BR","STRONG","B","EM","I","U","SMALL","UL","OL","LI","A","IMG","PRE","CODE","MARK"]),f=new Set(["href","src","alt","title","class","target","rel","loading"]),h=new Set(["SCRIPT","STYLE","IFRAME","NOSCRIPT","OBJECT","EMBED","SVG","MATH","AUDIO","VIDEO","CANVAS","TEMPLATE"]),y=/^\s*(?:https?:|mailto:|data:image\/(?:png|jpe?g|gif|webp|avif|bmp|ico);|\/(?!\/|\\)|\.\/|\.\.\/|#)/i;function g(e,t,n){if(e.nodeType===Node.TEXT_NODE)return document.createTextNode(e.nodeValue);if(e.nodeType===Node.COMMENT_NODE)return null;if(e.nodeType!==Node.ELEMENT_NODE)return null;const o=e.tagName.toUpperCase();if(h.has(o)||o.includes("SCRIPT")||o.includes("<")||o.includes(">"))return null;if(!t.has(o)){const o=document.createDocumentFragment();return Array.from(e.childNodes).forEach(e=>{const i=g(e,t,n);i&&o.appendChild(i)}),o}const i=document.createElement(e.tagName);return Array.from(e.attributes||[]).forEach(e=>{i.setAttribute(e.name,e.value)}),function(e,t){const n=[];Array.from(e.attributes||[]).forEach(o=>{const i=o.name.toLowerCase(),r=o.value;if(t.has(i)&&!i.startsWith("on")){if("href"===i||"src"===i){const t="string"==typeof r?r.trim().toLowerCase():"";if((t.startsWith("javascript:")||t.startsWith("vbscript:")||t.startsWith("data:"))&&("src"!==i||!t.startsWith("data:image/")||t.startsWith("data:image/svg+xml")))return"href"===i?void e.setAttribute("href","#"):void n.push(o.name);if(!y.test(r))return"href"===i?void e.setAttribute("href","#"):void n.push(o.name)}if("target"===i&&"string"==typeof r&&"_blank"===r.trim().toLowerCase()){const t=(e.getAttribute("rel")||"").split(/\s+/).filter(Boolean);t.includes("noopener")||t.push("noopener"),t.includes("noreferrer")||t.push("noreferrer"),e.setAttribute("rel",t.join(" "))}}else n.push(o.name)}),n.forEach(t=>e.removeAttribute(t));const o=e.getAttribute("target");if("A"===e.tagName&&"string"==typeof o&&"_blank"===o.trim().toLowerCase()){const t=(e.getAttribute("rel")||"").split(/\s+/).filter(Boolean);t.includes("noopener")||t.push("noopener"),t.includes("noreferrer")||t.push("noreferrer"),e.setAttribute("rel",t.join(" "))}}(i,n),Array.from(e.childNodes).forEach(e=>{const o=g(e,t,n);o&&i.appendChild(o)}),i}function b(e){if(!e||"string"!=typeof e)return"";const t=function(e){if("undefined"!=typeof DOMParser)try{const t=(new DOMParser).parseFromString(e,"text/html");if(t&&t.body)return t.body}catch{}if("undefined"!=typeof document){const t=document.createElement("template");if("content"in t)return t.innerHTML=e,t.content;const n=document.createElement("div");return n.innerHTML=e,n}return null}(e);if(!t)return"";const n=document.createDocumentFragment();Array.from(t.childNodes).forEach(e=>{const t=g(e,m,f);t&&n.appendChild(t)});const o=document.createElement("div");return o.appendChild(n),o.querySelectorAll('a[target="_blank"]').forEach(e=>{const t=(e.getAttribute("rel")||"").split(/\s+/).filter(Boolean);t.includes("noopener")||t.push("noopener"),t.includes("noreferrer")||t.push("noreferrer"),e.setAttribute("rel",t.join(" "))}),o.innerHTML}function w(e,t={}){if("string"!=typeof e||!e.trim())return"";try{if(!t.forceFallback&&function(){try{return Boolean("undefined"!=typeof window&&window.DOMPurify&&"function"==typeof window.DOMPurify.sanitize)}catch(e){}return!1}()){const t=window.DOMPurify.sanitize(e,{ALLOWED_TAGS:Array.from(m),ALLOWED_ATTR:Array.from(f),ALLOWED_URI_REGEXP:y}),n=document.createElement("div");return n.innerHTML=t,n.querySelectorAll("a[href]").forEach(e=>{const t=e.getAttribute("href")||"";y.test(t)||e.setAttribute("href","#")}),n.querySelectorAll('a[target="_blank"]').forEach(e=>{const t=(e.getAttribute("rel")||"").split(/\s+/).filter(Boolean);t.includes("noopener")||t.push("noopener"),t.includes("noreferrer")||t.push("noreferrer"),e.setAttribute("rel",t.join(" "))}),n.innerHTML}}catch(e){console.warn("DOMPurify sanitization failed, falling back:",e)}return b(e)}function x(e={}){if("undefined"==typeof document)return null;const t=e&&"object"==typeof e&&!Array.isArray(e)?e:{},n=Number(t.size),o=Number.isFinite(n)&&n>0?n:14,s="string"==typeof t.color&&t.color.trim()?t.color.trim():"currentColor",a=/[\r\n<>"';]/.test(s)||/^\s*javascript:/i.test(s)?"currentColor":s,l="string"==typeof t.text?t.text:"",c=document.createElement("span");c.className="toast-loader",c.setAttribute("role","status"),c.setAttribute("aria-label",l||"Loading");const u=i();u.disableInlineStyles||(c.style.display="inline-flex",c.style.alignItems="center",c.style.gap="8px");const d="http://www.w3.org/2000/svg",p=document.createElementNS(d,"svg");p.setAttribute("width",String(o)),p.setAttribute("height",String(o)),p.setAttribute("viewBox","0 0 50 50"),p.setAttribute("aria-hidden","true");const m=document.createElementNS(d,"circle");if(m.classList.add("toast-loader-circle"),m.setAttribute("cx","25"),m.setAttribute("cy","25"),m.setAttribute("r","20"),m.setAttribute("fill","none"),m.setAttribute("stroke",a),m.setAttribute("stroke-width","4"),m.setAttribute("stroke-linecap","round"),u.disableInlineStyles||(m.style.opacity="0.85",m.style.strokeDasharray="90",m.style.strokeDashoffset="60",m.style.transformOrigin="center",r()||(m.style.animation="toast-spinner 1s linear infinite")),p.appendChild(m),c.appendChild(p),l){const e=document.createElement("span");e.className="toast-loader-label",u.disableInlineStyles||(e.style.fontSize="13px"),e.textContent=l,c.appendChild(e)}if(!u.disableInlineStyles&&"undefined"!=typeof document&&!document.getElementById("toast-spinner-styles"))try{const e=document.createElement("style");e.id="toast-spinner-styles",e.textContent="@keyframes toast-spinner { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }";const t=document.head||document.documentElement;t&&t.appendChild(e)}catch{}return c}function v(e,t,n){const o=t?.cta;if(!o||"object"!=typeof o)return;const r=Array.isArray(o)?o.filter(e=>e&&"object"==typeof e):[o];if(0===r.length)return;const s=[];r.forEach((o,a)=>{if(!o||"object"!=typeof o)return;const l={...o};l.label||(l.label=r.length>1?`Action ${a+1}`:"CTA Label Missing!");const c="link"===l.variant||!l.variant&&!!l.href,u=document.createElement(c?"a":"button");if(c){if(l.href){const e=String(l.href).trim(),t=/^(javascript:|vbscript:|data:(?!image\/[a-z0-9.+-]+;base64,))/i.test(e);u.href=t?"#":e}else u.setAttribute("role","button"),u.tabIndex=0;l.target&&(u.target=l.target);const e=new Set((l.rel||"").split(/\s+/).filter(Boolean));"string"==typeof l.target&&"_blank"===l.target.trim().toLowerCase()&&(e.add("noopener"),e.add("noreferrer")),u.rel=Array.from(e).join(" ")}else u.type="button";u.setAttribute("aria-label",l.ariaLabel||l.label);const d=l.textColor||l.color||t.textColor||p(t.backgroundColor),m=l.backgroundColor||l.background||(t.backgroundColor?C(t.backgroundColor):"rgba(255,255,255,0.15)"),f="string"==typeof d&&/^#[0-9a-fA-F]{6}$/.test(d.trim())?`${d.trim()}44`:"rgba(128, 128, 128, 0.3)";u.className="toast-cta",i().disableInlineStyles||Object.assign(u.style,{marginLeft:0===a?"10px":"6px",padding:"6px 10px",borderRadius:"6px",fontSize:"12px",fontWeight:"600",lineHeight:"1",border:`1px solid ${f}`,color:d,background:m,cursor:"pointer",whiteSpace:"nowrap",flexShrink:"0"}),u.textContent=l.label;const h=async t=>{try{if("function"==typeof l.onClick){const e=l.onClick(t);e?.then&&await e}}catch(e){console.error("CTA onClick handler error:",e)}finally{!1!==l.autoClose&&"function"==typeof n&&n(e)}},y=e=>{!c||l.href||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),h(e))};u.addEventListener("click",h),c&&!l.href&&u.addEventListener("keydown",y);const g=()=>{u.removeEventListener("click",h),c&&!l.href&&u.removeEventListener("keydown",y)};u._cleanup=g,s.push(g);const b=e.querySelector(".toast-undo-btn")||e.querySelector(".toast-close-btn")||e.querySelector(".toast-progress-bar");b?e.insertBefore(u,b):e.appendChild(u)});const a=e._cleanupCTA;e._cleanupCTA=()=>{a?.(),s.forEach(e=>e())}}function T(e,t,n){const o=t?.undo;if(!o)return;const r="function"==typeof o;if(!r&&("object"!=typeof o||Array.isArray(o)))return;const s=r?{onUndo:o}:{...o},a="string"==typeof s.label&&s.label.trim()?s.label.trim():"Undo",l=Number(t?.duration),c=!1!==s.showCountdown&&Number.isFinite(l)&&l>0,u=document.createElement("button");u.type="button",u.className="toast-undo-btn",u.setAttribute("aria-label",`${a} action`);const d=t.textColor||p(t.backgroundColor),m=t.backgroundColor?C(t.backgroundColor):"rgba(255,255,255,0.18)",f="string"==typeof d&&/^#[0-9a-fA-F]{6}$/.test(d.trim())?`${d.trim()}55`:"rgba(128, 128, 128, 0.35)";i().disableInlineStyles||Object.assign(u.style,{marginLeft:"10px",padding:"5px 10px",borderRadius:"6px",fontSize:"12px",fontWeight:"700",lineHeight:"1",border:`1px solid ${f}`,color:d,background:m,cursor:"pointer",whiteSpace:"nowrap",flexShrink:"0",display:"inline-flex",alignItems:"center",gap:"4px"});let h=Math.max(1,Math.ceil((l||2500)/1e3));const y=()=>{u.textContent=c?`${a} (${h}s)`:a};y();let g=null,b=!1;c&&(g=setInterval(()=>{b||(h=Math.max(0,h-1),y(),h<=0&&g&&(clearInterval(g),g=null))},1e3),"function"==typeof g?.unref&&g.unref()),e._pauseUndo=()=>{b=!0},e._resumeUndo=()=>{b=!1};const w=()=>{g&&(clearInterval(g),g=null),e._pauseUndo=null,e._resumeUndo=null},x=async t=>{w(),u.removeEventListener("click",x);try{if("function"==typeof s.onUndo){const n=s.onUndo(t,e);n?.then&&await n}}catch(e){console.error("Undo action error:",e)}finally{"function"==typeof n&&n(e)}};u.addEventListener("click",x),u._cleanup=()=>{w(),u.removeEventListener("click",x)},e._cleanupUndo=()=>{w(),u.removeEventListener("click",x)};const v=e.querySelector(".toast-close-btn")||e.querySelector(".toast-progress-bar");v?e.insertBefore(u,v):e.appendChild(u)}function A(e,t,n){const o=document.createElement("button");o.type="button",o.setAttribute("aria-label","Close notification"),o.setAttribute("title","Close"),o.textContent="×";const r=t.textColor||p(t.backgroundColor);o.className="toast-close-btn",i().disableInlineStyles||Object.assign(o.style,{background:"none",border:"none",color:r,fontSize:"18px",marginLeft:"10px",cursor:"pointer",lineHeight:"1",padding:"0 4px"});const s=()=>{"function"==typeof n&&n(e)};o.addEventListener("click",s),e._cleanupCloseButton=()=>{o.removeEventListener("click",s)},e.appendChild(o)}function C(e){return e&&"#000000"===p(e)?"rgba(0,0,0,0.15)":"rgba(255,255,255,0.15)"}function S(e,t={}){const n=document.createElement("div");n.className="toast-progress-bar",e._progressBar=n;const o=t.borderRadius||"0",s=parseInt(o,10),a=Number.isFinite(s)&&s>0?s:0;let l=4,c="4px";if("number"==typeof t.progressHeight&&Number.isFinite(t.progressHeight)&&t.progressHeight>0)l=t.progressHeight,c=`${l}px`;else if("string"==typeof t.progressHeight&&t.progressHeight.trim()){const e=t.progressHeight.trim(),n=parseFloat(e);Number.isFinite(n)&&n>0&&(e.endsWith("rem")||e.endsWith("em")?(l=16*n,c=e):(l=n,c=/^\d+(\.\d+)?$/.test(e)?`${n}px`:e))}const u=Number(t.duration??2500),d=Math.max(0,u+5),p=Math.min(a,2*l),m=a>0?`calc(100% - ${2*p}px)`:"100%",f="reverse"===t.progressDirection||"increasing"===t.progressDirection||"ltr"===t.progressDirection;n._leftOffset=p,n._finalWidth=m,n._isReverse=f;const h=t.progressBarColor||t.progressColor||"currentColor";if(i().disableInlineStyles||Object.assign(n.style,{position:"absolute",left:`${p}px`,height:c,background:h,width:f?"0%":`${m}`,transition:`width ${d}ms linear`,["top"===t.progressPosition?"top":"bottom"]:"0",borderRadius:l/2+"px",opacity:"0.8",zIndex:"2",willChange:"width"}),e.appendChild(n),"indeterminate"===t.progress||Boolean(t.showProgressBar)&&(0===t.duration||t.duration===1/0)&&void 0===t.progress)return n.classList.add("toast-progress-bar-indeterminate"),i().disableInlineStyles||(function(){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 .toast-progress-bar-indeterminate {\n animation: toast-progress-indeterminate 1.6s cubic-bezier(0.4, 0, 0.2, 1) infinite !important;\n }\n ";const t=document.head||document.documentElement;t&&t.appendChild(e)}(),n.style.animation="toast-progress-indeterminate 1.6s cubic-bezier(0.4, 0, 0.2, 1) infinite"),void(n.style.width=m);if(void 0!==t.progress){let e=Number(t.progress);return Number.isFinite(e)||(e=0),e<1&&e>0&&(e*=100),e=Math.min(100,Math.max(0,e)),n.style.width=`${e}%`,void(n.style.transition="width 200ms ease")}if(0!==t.duration&&t.duration!==1/0)if(r())n.style.display="none";else if("function"==typeof n.animate){const t=f?[{width:"0%"},{width:m}]:[{width:m},{width:"0%"}];e._progressAnimation=n.animate(t,{duration:d,easing:"linear",fill:"forwards",delay:50})}else n.style.transition=`width ${d}ms linear`,requestAnimationFrame(()=>{n.style.width=f?m:"0%"});else n.style.width="0%"}function k(e){if(!e)return;if(e._hasAnimated)return;if(r())return e._hasAnimated=!0,e.style.transition="none",e.style.opacity="1",e.style.transform="translateY(0)",void e.classList.add("active");const t=()=>{if(!e._hasAnimated){e._hasAnimated=!0;try{e.offsetHeight}catch{}requestAnimationFrame(()=>{e.style.opacity="1",e.style.transform="none",e.classList.add("active")})}};e.isConnected?t():requestAnimationFrame(()=>{e.isConnected?t():requestAnimationFrame(()=>{t()})})}let E=null,_=!0,L=!1;if("undefined"!=typeof window)if("undefined"!=typeof navigator&&navigator.userActivation?.hasBeenActive)L=!0;else{const e=()=>{if(L=!0,E&&"suspended"===E.state)try{E.resume().catch(()=>{})}catch{}try{window.removeEventListener("pointerdown",e,!0),window.removeEventListener("keydown",e,!0),window.removeEventListener("touchstart",e,!0)}catch{}};try{window.addEventListener("pointerdown",e,{capture:!0,once:!0,passive:!0}),window.addEventListener("keydown",e,{capture:!0,once:!0,passive:!0}),window.addEventListener("touchstart",e,{capture:!0,once:!0,passive:!0})}catch{}}const M=new Map;function N(e=!0){if("undefined"==typeof window)return null;const t=window.AudioContext||window.webkitAudioContext;if(!t)return null;if(!E)try{E=new t}catch{return null}const n=L||"undefined"!=typeof navigator&&navigator.userActivation&&navigator.userActivation.hasBeenActive;if(E&&"suspended"===E.state&&(e||n))try{E.resume().catch(()=>{})}catch{}return E}let I=null;function B(){const e=N(!1);if(!e||"function"!=typeof e.createAnalyser)return null;if(!I)try{I=e.createAnalyser(),I.fftSize=128,I.connect(e.destination)}catch{return null}return I}function z(e,t){I?t.connect(I):t.connect(e.destination)}function P(e,t){e&&(e.onended=()=>{try{e.disconnect(),t?.disconnect?.()}catch{}})}const V={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),z(e,r),P(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),z(e,r),P(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),z(e,o),P(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),z(e,o),P(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),z(e,r),P(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),z(e,o),P(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),z(e,i),P(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),z(e,r),P(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),z(e,o),P(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),z(e,o),P(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),z(e,i),P(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),z(e,o),P(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),z(e,r),P(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),z(e,r),P(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),z(e,o),P(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),z(e,o),P(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),z(e,r),P(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),z(e,r),P(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),z(e,o),P(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),z(e,o),P(t,o),t.start(n),t.stop(n+.3)}}};let q=!1;function F(e="info",t){if(!_)return;if(!q&&"undefined"!=typeof window&&window.customizableToast&&"function"==typeof window.customizableToast.playTone&&window.customizableToast.playTone!==F)try{return q=!0,void window.customizableToast.playTone(e,t)}finally{q=!1}const n=N();if(n)try{"suspended"===n.state&&n.resume().catch(()=>{});const o=n.currentTime,r="number"==typeof e?e:parseFloat(e);if(Number.isFinite(r)&&r>=20&&r<=2e4&&("number"==typeof e||/^\d+(\.\d+)?(hz)?$/i.test(String(e).trim()))){const e=n.createOscillator(),t=n.createGain();return e.type="sine",e.frequency.setValueAtTime(r,o),t.gain.setValueAtTime(.001,o),t.gain.exponentialRampToValueAtTime(.1,o+.015),t.gain.exponentialRampToValueAtTime(1e-4,o+.35),e.connect(t),z(n,t),P(e,t),e.start(o),void e.stop(o+.36)}const s=String(e||"info").toLowerCase().trim(),a=String(t||i().soundPreset||"modern").toLowerCase().trim();if(M.has(a))try{const e=M.get(a);if("function"==typeof e)return void e(n,s,o)}catch(e){console.warn("Custom sound preset synthesizer error:",e)}(V[a]||V.modern)(n,s,o)}catch{}}function R(e,t){if("string"!=typeof e||!e.trim()||"function"!=typeof t)return!1;const n=e.toLowerCase().trim();return M.set(n,t),!0}function O(){const e=Object.keys(V),t=Array.from(M.keys());return Array.from(new Set([...e,...t]))}function D(){M.clear()}function j(e){_=Boolean(e)}function $(){return _}function W(){if(E)try{E.close?.().catch?.(()=>{})}catch{}E=null,I=null}const H={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)"}},U=new Map;function G(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);U.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 Y(){return[...Object.keys(H),...U.keys()]}function X(){U.clear()}function Q(e){if(!e)return null;if("string"==typeof e){const t=e.trim().toLowerCase();return U.has(t)?U.get(t):Object.prototype.hasOwnProperty.call(H,t)?H[t]:H.default}if(!0===e)return H.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 K(e,t){if(e<=0)return 0;const n=Math.max(.001,t?.stiffness||100),o=Math.max(.001,t?.damping||10),i=Math.max(.001,t?.mass||1),r=Math.sqrt(n/i),s=o/(2*Math.sqrt(n*i));if(Math.abs(s-1)<1e-4)return 1-Math.exp(-r*e)*(1+r*e);if(s<1){const t=r*Math.sqrt(1-s*s);return 1-Math.exp(-s*r*e)*(Math.cos(t*e)+s/Math.sqrt(1-s*s)*Math.sin(t*e))}const a=r*Math.sqrt(s*s-1),l=-s*r+a,c=-s*r-a,u=-l/(c-l);return 1-(c/(c-l)*Math.exp(l*e)+u*Math.exp(c*e))}function J(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=K(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(K(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 Z(e,t=32){const n=J(e)/1e3,o=[];for(let i=0;i<=t;i++){const r=i/t,s=K(r*n,e),a=Math.round(1e3*s)/1e3,l=Math.round(1e3*r)/10;o.push(`${a} ${l}%`)}return`linear(${o.join(", ")})`}function ee(e){const t=Q(e);if(!t)return null;const n=J(t),o=Z(t),i=function(){if("undefined"==typeof window||"undefined"==typeof CSS||"function"!=typeof CSS.supports)return!1;try{return CSS.supports("transition-timing-function","linear(0 0%, 1 100%)")||CSS.supports("transition-timing-function","linear(0, 1)")||CSS.supports("animation-timing-function","linear(0 0%, 1 100%)")}catch{return!1}}()?o:t.bezierFallback||"cubic-bezier(0.34, 1.4, 0.64, 1)";return{config:{stiffness:t.stiffness,damping:t.damping,mass:t.mass},duration:n,easing:i,isSpring:!0}}const te=new Set(["svg","g","path","circle","rect","line","polyline","polygon","ellipse","title","desc","defs","clippath","use"]),ne=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 oe(e=""){return/^\s*javascript:/i.test(e)}function ie(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(!te.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")&&ne.has(s)){if("href"===s||"xlink:href"===s){if(oe(a))continue;if("use"===t&&a&&!a.startsWith("#"))continue}n.setAttribute(r,a)}}if(e.childNodes)for(let t=0;t<e.childNodes.length;t++){const o=i(e.childNodes[t]);o&&n.appendChild(o)}return n};return i(o)}catch{return null}}const re={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 se(e={}){const t=e&&"object"==typeof e&&!Array.isArray(e)?e:{};let n=t.icon;if("function"==typeof n)try{n=n(t)}catch(e){console.warn("options.icon callback error:",e),n=null}if(!1===n||""===n||null===n)return null;if("undefined"==typeof document)return null;const o=t.type,r=i(),s=document.createElement("i");if(s.className="toast-icon",s.setAttribute("aria-hidden","true"),r.disableInlineStyles||Object.assign(s.style,{display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:"0",marginRight:"8px",lineHeight:"1",fontStyle:"normal"}),n&&"object"==typeof n&&(1===n.nodeType||"undefined"!=typeof HTMLElement&&n instanceof HTMLElement)&&"function"==typeof n.cloneNode)return s.appendChild(n.cloneNode(!0)),s;if("string"==typeof n&&n.trim()){const e=n.trim(),t={check:re.success,checkmark:re.success,success:re.success,cross:re.error,error:re.error,alert:re.warning,warning:re.warning,circle:re.info,info:re.info}[e.toLowerCase()];if(t){const e=ie(t.trim());return e&&s.appendChild(e),s}if(e.startsWith("<svg")&&e.endsWith("</svg>")){const t=ie(e);t?(t.setAttribute("aria-hidden","true"),t.setAttribute("focusable","false"),t.getAttribute("width")||t.setAttribute("width","18"),t.getAttribute("height")||t.setAttribute("height","18"),s.appendChild(t)):s.textContent=e}else s.textContent=e;return s}const a="string"==typeof o?o.toLowerCase().trim():"";if((!0===n||void 0===n)&&a&&re[a]){const e=ie(re[a].trim());return e&&s.appendChild(e),s}return null}function ae(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 le(e={},t){try{const n=i(),o=document.createElement("div"),r=e?.position||n.defaultPosition,s=String(r).toLowerCase().trim();let a="auto",l="auto",c="auto",u="auto",d="none";s.startsWith("top")?a="20px":(s.startsWith("bottom")||s.includes("below"))&&(l="20px"),s.startsWith("left")?c="20px":s.startsWith("right")?u="20px":"center"===s?(c="50%",a="50%",d="translate(-50%, -50%)"):s.includes("center")?s.includes("left")?(c="20px",a="50%",d="translateY(-50%)"):s.includes("right")?(u="20px",a="50%",d="translateY(-50%)"):s.includes("top")?(a="20px",c="50%",d="translateX(-50%)"):s.includes("bottom")&&(l="20px",c="50%",d="translateX(-50%)"):(u="20px",l="20px"),o.className="toast-emergency",n.disableInlineStyles||Object.assign(o.style,{background:"#333",color:"white",padding:"10px 15px",position:"fixed",top:a,bottom:l,left:c,right:u,transform:d,zIndex:String(n.zIndex+100),borderRadius:"3px",maxWidth:"250px",wordWrap:"break-word",boxShadow:"0 2px 10px rgba(0,0,0,0.3)"});const p=document.createElement("div"),m=document.createElement("span");if(m.className="toast-emergency-message",n.disableInlineStyles||(m.style.display="inline-block"),e.allowHtml)try{const t=w(String(e.message||"Emergency Toast Showing!")),n=document.createElement("div");for(n.innerHTML=t;n.firstChild;)m.appendChild(n.firstChild)}catch{m.appendChild(document.createTextNode(String(e.message||"Emergency Toast Showing!")))}else m.textContent=String(e.message||"Emergency Toast Creation Showing!");p.appendChild(m);const f=document.createElement("button");for(f.type="button",f.className="toast-emergency-close",f.setAttribute("aria-label","Close emergency notification"),n.disableInlineStyles||Object.assign(f.style,{float:"right",marginLeft:"10px",fontWeight:"bold",cursor:"pointer",background:"transparent",border:"none",color:"inherit",padding:"0",font:"inherit"}),f.textContent="×",p.appendChild(f);o.firstChild;)o.removeChild(o.firstChild);o.appendChild(p);let h=null;const y=()=>{h&&clearTimeout(h),f.removeEventListener("click",y),o.remove(),"function"==typeof t&&t(o)};f.addEventListener("click",y);const g=Number(e?.duration)||2500;return h=setTimeout(()=>{f.removeEventListener("click",y),o.remove(),"function"==typeof t&&t(o)},g),"function"==typeof h?.unref&&h.unref(),o}catch(e){return console.error("Emergency toast creation failed:",e),"function"==typeof t&&t(null),null}}class ce{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 ue=null;function de(e=5,t=50){return ue||(ue=new ce(e,t)),ue}function pe(){ue&&(ue.clear(),ue=null)}async function me(e,t){let n;const o="toast";try{if(e?.usePool){const e=c(o);n=de().acquire(e),n._pooledId=e}else n=await async function(e,t){const n=document.createElement("div");return n.id=c(t),n}(0,o);return await async function(e,t,n){const o=i(),s=t?.spring?ee(t.spring):null,a=s?s.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*parseFloat(t);return Number.isFinite(e)&&e>=0?e:500}const n=parseFloat(t);return Number.isFinite(n)&&n>=0?n:500}return 500}(t?.animationDuration),l=`${a}ms`,c=s?s.easing:"string"==typeof t?.animationEasing&&t.animationEasing.trim()?t.animationEasing.trim():"ease";s&&(e._spring=s),e._animationType=t?.animationType;const u="string"==typeof t?.className&&t.className.trim()?` ${t.className.trim()}`:"";e.className=`toast toast-${t?.type??"info"}${u}`;const d="number"==typeof t?.borderRadius?`${t.borderRadius}px`:t?.borderRadius,p="number"==typeof t?.maxWidth?`${t.maxWidth}px`:t?.maxWidth,m=s?`${Math.min(300,a)}ms`:l,f=s?"ease":c;o.disableInlineStyles||Object.assign(e.style,{background:t?.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:p,opacity:"0",position:"relative",cursor:"default",boxSizing:"border-box",userSelect:"text",pointerEvents:"auto",transition:`opacity ${m} ${f}, transform ${l} ${c}`,transform:ae(t?.position,t?.animationType,!!s),zIndex:String(o.zIndex),direction:t?.fontDirection&&"auto"!==t.fontDirection?t.fontDirection:void 0});const h="error"===t?.type,y=t?.role||(h?"alert":t?.role??"alert"),g=t?.ariaLive||(h?"assertive":"polite");e.setAttribute("role",y),e.setAttribute("aria-live",g),e.tabIndex=0,e._animationDuration=a;const b=document.createElement("span");b.className="toast-message",e._messageSpan=b,"truncate"!==t?.wrapText&&"ellipsis"!==t?.wrapText&&!1!==t?.wrapText&&t?.wrapText?o.disableInlineStyles||Object.assign(b.style,{display:"block",whiteSpace:"normal"}):(b.classList.add("is-truncated"),o.disableInlineStyles||Object.assign(b.style,{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:"3",whiteSpace:"normal",overflow:"hidden",textOverflow:"ellipsis"}));const C="number"==typeof t?.fontSize?`${t.fontSize}px`:t?.fontSize;o.disableInlineStyles||Object.assign(b.style,{flex:"1",padding:t?.fontPadding,fontFamily:t?.fontFamily,fontSize:C,fontWeight:t?.fontWeight,lineHeight:t?.fontLineHeight,color:t?.textColor,userSelect:"text",wordBreak:"break-word",overflow:"hidden",textOverflow:"ellipsis",direction:t?.fontDirection&&"auto"!==t.fontDirection?t.fontDirection:void 0});const E=!!t.allowHtml,_=t.message??"",L=se(t);if(L&&e.appendChild(L),t.loader||t.showLoader){const e=x(t.loader||{});b.appendChild(e);const n=document.createElement("span");n.className="toast-message-spacer",o.disableInlineStyles||(n.style.display="inline-block",n.style.width="8px"),b.appendChild(n)}if(E&&"string"==typeof _&&_.trim().length>0)try{const e=w(_),t=document.createElement("div");for(t.innerHTML=e;t.firstChild;)b.appendChild(t.firstChild)}catch(e){console.warn("HTML message sanitization failed, falling back to text:",e),b.appendChild(document.createTextNode(String(_)))}else b.appendChild(document.createTextNode(String(_)));b.setAttribute("title",b.textContent||""),e.appendChild(b),t?.cta&&"object"==typeof t.cta&&v(e,t,n),t?.undo&&T(e,t,n),t?.showCloseButton&&A(e,t,n),!1===t?.showProgressBar||!t?.showProgressBar&&void 0===t?.progress||S(e,t),!1!==(void 0!==t?.swipeToDismiss?t.swipeToDismiss:o.swipeToDismiss)&&function(e,t){if(!e||"function"!=typeof e.addEventListener)return;let n=0,o=0,s=0,a=0,l=!1,c=!1,u=null,d=!1;const p=()=>{d&&(d=!1,window.removeEventListener("mousemove",f),window.removeEventListener("mouseup",h))},m=t=>{if(!t)return;const i=t.target;if(i&&"function"==typeof i.closest&&i.closest("button, a, input, textarea, select, label"))return;let r=t;t.touches&&t.touches.length>0?(r=t.touches[0],u=r.identifier??null):u=null,n=r.clientX,o=r.clientY,s=n,a=Date.now(),l=!0,c=!1,e._originalTransition=e.style.transition||"",e.style.transition="none",e.style.userSelect="none",d||"undefined"==typeof window||(d=!0,window.addEventListener("mousemove",f,{passive:!1}),window.addEventListener("mouseup",h,{passive:!0}))},f=t=>{if(!l||!t)return;let a=t;if(t.touches)if(null!==u){for(let e=0;e<t.touches.length;e++)if(t.touches[e].identifier===u){a=t.touches[e];break}}else t.touches.length>0&&(a=t.touches[0]);const d=a.clientX,m=a.clientY,f=d-n,h=m-o;if(!c)if(Math.abs(f)>8&&Math.abs(f)>Math.abs(h))c=!0;else if(Math.abs(h)>8)return l=!1,e.style.userSelect="",void p();if(c){s=d;const n=Math.max(0,1-Math.abs(f)/280);i().disableInlineStyles||r()||(e.style.transform=`translateX(${f}px)`,e.style.opacity=String(n)),t.cancelable&&t.preventDefault()}},h=()=>{if(p(),u=null,!l||!c)return l=!1,void(e.style.userSelect="");l=!1,e.style.userSelect="";const o=s-n,d=Math.max(1,Date.now()-a),m=(d>0?Math.abs(o)/d:0)>=.65&&Math.abs(o)>=50,f=m?50:75;if(Math.abs(o)>=f){const n=o>0?320:-320,s=m?120:180;i().disableInlineStyles||r()||(e.style.transition=`transform ${s}ms ease-out, opacity ${s}ms ease-out`,e.style.transform=`translateX(${n}px)`,e.style.opacity="0"),e._swipeTimeout&&clearTimeout(e._swipeTimeout),e._swipeTimeout=setTimeout(()=>{e._swipeTimeout=null,"function"==typeof t&&t(e)},s),"function"==typeof e._swipeTimeout?.unref&&e._swipeTimeout.unref()}else if(!i().disableInlineStyles&&!r()){const t=e._spring,n=t?.easing||"cubic-bezier(0.34, 1.56, 0.64, 1)",o=t?.duration?Math.min(400,t.duration):200;e.style.transition=`transform ${o}ms ${n}, opacity 200ms ease`,e.style.transform="translateX(0)",e.style.opacity="1",e._snapbackTimer&&clearTimeout(e._snapbackTimer),e._snapbackTimer=setTimeout(()=>{e._snapbackTimer=null,e._originalTransition&&(e.style.transition=e._originalTransition)},o),"function"==typeof e._snapbackTimer?.unref&&e._snapbackTimer.unref()}};e.addEventListener("touchstart",m,{passive:!0}),e.addEventListener("touchmove",f,{passive:!1}),e.addEventListener("touchend",h,{passive:!0}),e.addEventListener("touchcancel",h,{passive:!0}),e.addEventListener("mousedown",m,{passive:!0}),e._cleanupSwipe=()=>{e._swipeTimeout&&(clearTimeout(e._swipeTimeout),e._swipeTimeout=null),e._snapbackTimer&&(clearTimeout(e._snapbackTimer),e._snapbackTimer=null),p(),e.removeEventListener("touchstart",m),e.removeEventListener("touchmove",f),e.removeEventListener("touchend",h),e.removeEventListener("touchcancel",h),e.removeEventListener("mousedown",m)}}(e,n),(void 0!==t?.sound?t.sound:o.sound)&&F("string"==typeof t.sound?t.sound:t?.type||"info",t?.soundPreset||o.soundPreset||"modern"),k(e)}(n,e,t),n}catch(o){if(e?.usePool&&n?._pooledId)try{de().release(n,n._pooledId)}catch{}return console.warn("toast creation failed with error showing fallback one: ",o),n=await le(e,t),n}}const fe=new Map,he=new Map;function ye(e){if(!e||"string"!=typeof e)return"bottom-right";const t=e.toLowerCase().trim();return t?t.replace(/\bbelow\b/g,"bottom").replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"-").replace(/-{2,}/g,"-"):"bottom-right"}function ge(e){return`toast-container-${ye(e)}`}function be(e){const t=i();e.className="toast-container-base",t.disableInlineStyles||(e.style.position="fixed",e.style.zIndex=String(t.zIndex),e.style.pointerEvents="none",e.style.inset="auto 10px 10px auto",e.style.display="flex",e.style.justifyContent="space-between",e.style.alignItems="center",e.style.flexDirection="column",e.style.overflow="hidden")}async function we(e={},n){const o=i(),r=ge(e?.position||o.defaultPosition),s=(a=t.targetNode)&&"object"==typeof a&&"function"==typeof a.appendChild?t.targetNode:"undefined"!=typeof document?document.body:null;var a;if(!s)throw new Error("Toast container root is unavailable");if(he.has(r))return he.get(r);const l=(async()=>{const t=fe.get(r);if(function(e,t){return!(!e||!t)&&(t===document.body?e.isConnected&&e.ownerDocument===document:"function"==typeof t.contains?t.contains(e):e.isConnected&&e.ownerDocument===document)}(t,s))return t;t&&fe.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)be(o),"function"==typeof n&&await n(o,e);else{const t=s?.ownerDocument||("undefined"!=typeof document?document:null);if(!t)throw new Error("Document is unavailable");o=t.createElement("div"),o.id=r,o.setAttribute("role","status"),o.setAttribute("aria-atomic","true"),be(o),"function"==typeof n&&await n(o,e),s.appendChild(o)}if("function"==typeof s.querySelectorAll){const e=s.querySelectorAll(`#${r}`);if(e.length>1)for(let t=1;t<e.length;t++)try{e[t].remove()}catch{}}return fe.set(r,o),o})();he.set(r,l);try{return await l}finally{he.delete(r)}}const xe=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"]),ve=new Set(["top","bottom"]),Te=[...xe,...ve];async function Ae(e,t={}){if(!e||!t||"object"!=typeof t)throw new Error("Invalid container or position!");const n=i(),o=String(t?.position||n.defaultPosition||"bottom-right").toLowerCase().trim().replace(/\s+/g,"-");let r=o;var s;if(s=o,xe.has(s)||ve.has(o)||(console.warn(`Unknown position "${t.position}", defaulting to "bottom-right"`),r="bottom-right"),function(e){if(e?.classList)for(let t=0;t<Te.length;t++)e.classList.remove("toast-position-"+Te[t])}(e),e.classList?.add("toast-position-"+r),i().disableInlineStyles)return;!function(e){e.style.top="auto",e.style.bottom="auto",e.style.left="auto",e.style.right="auto",e.style.transform="none",e.style.maxWidth="none"}(e);const a=function(e){const t=e.toLowerCase().trim(),n="top-full-width"===t||"bottom-full-width"===t;return{hasTop:t.startsWith("top")||t.endsWith("top"),hasBottom:t.startsWith("bottom")||t.endsWith("bottom")||t.includes("below"),hasLeft:t.startsWith("left")||t.endsWith("left"),hasRight:t.startsWith("right")||t.endsWith("right"),hasCenter:t.includes("center"),hasFullWidth:n}}(r);(function(e,t){return!!t.hasFullWidth&&(e.style.maxWidth="100vw",t.hasTop?(e.style.top="10px",e.style.left="10px",e.style.right="10px",!0):!!t.hasBottom&&(e.style.bottom="10px",e.style.left="10px",e.style.right="10px",!0))})(e,a)||function(e,t){return!!t.hasCenter&&(!t.hasTop||t.hasLeft||t.hasRight?!t.hasBottom||t.hasLeft||t.hasRight?!t.hasLeft||t.hasTop||t.hasBottom?!t.hasRight||t.hasTop||t.hasBottom?!(t.hasLeft||t.hasRight||t.hasTop||t.hasBottom)&&(e.style.top="50%",e.style.left="50%",e.style.transform="translate(-50%, -50%)",!0):(e.style.right="10px",e.style.top="50%",e.style.transform="translateY(-50%)",!0):(e.style.left="10px",e.style.top="50%",e.style.transform="translateY(-50%)",!0):(e.style.bottom="10px",e.style.left="50%",e.style.transform="translateX(-50%)",!0):(e.style.top="10px",e.style.left="50%",e.style.transform="translateX(-50%)",!0))}(e,a)||function(e,t){t.hasBottom?e.style.bottom="10px":t.hasTop?e.style.top="10px":e.style.bottom="10px",t.hasRight?e.style.right="10px":t.hasLeft?e.style.left="10px":(e.style.left="50%",e.style.transform="translateX(-50%)")}(e,a)}class Ce{constructor(e,t){this.callback="function"==typeof e?e:()=>{};const n=t===1/0,o=Number.isFinite(t)&&t>=0?t:n?1/0:0;this.delay=o,this.remaining=o,this.startTime=null,this.timeoutId=null,this.isPaused=!1,this.isCompleted=!1,this.isInfinite=n}start(){return this.isCompleted||this.timeoutId||this.isInfinite||(this.isPaused=!1,this.startTime=Date.now(),this.timeoutId=setTimeout(()=>{this.isCompleted=!0,this.timeoutId=null;try{this.callback()}catch(e){console.error("PausableTimer callback error:",e)}},this.remaining),"function"==typeof this.timeoutId?.unref&&this.timeoutId.unref()),this}pause(){if(this.isPaused||!this.timeoutId||this.isCompleted)return this;clearTimeout(this.timeoutId),this.timeoutId=null;const e=Math.max(0,Date.now()-this.startTime);return this.remaining=Math.min(this.delay,Math.max(0,this.remaining-e)),this.isPaused=!0,this}resume(){return!this.isPaused||this.isCompleted||(this.isPaused=!1,this.start()),this}clear(){return this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null),this.isCompleted=!0,this}getRemainingTime(){return this.isCompleted?0:this.isPaused?this.remaining:this.timeoutId?Math.max(0,this.remaining-(Date.now()-this.startTime)):this.delay}}class Se{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(){const e=Date.now().toString(36);let t="";if("undefined"!=typeof crypto&&"function"==typeof crypto.getRandomValues)try{const e=new Uint32Array(2);crypto.getRandomValues(e),t=`${e[0].toString(36)}${e[1].toString(36)}`.slice(0,9)}catch{}return t||(t=Math.floor(9007199254740991*Math.random()).toString(36).slice(0,9)),`tab-${e}-${t}`}_initBroadcastChannel(){try{this.channel=new BroadcastChannel("toast-notifications"),this.channel.unref?.(),this.channel.onmessage=e=>this._handleMessage(e.data),this._becomeLeadIfNeeded()}catch(e){console.warn("[Toast] BroadcastChannel initialization failed:",e),this.supportsBroadcastChannel=!1}}_becomeLeadIfNeeded(){this.channel&&(this.broadcast("sync-request","",{}),this.leaderTimer=setTimeout(()=>{this.leaderTimer=null,this.isLeadTab||(this.isLeadTab=!0,this.broadcast("leader-elected","",{tabId:this.tabId}))},1e3),this.leaderTimer.unref?.())}broadcast(e,t="",n={}){if(!this.supportsBroadcastChannel||!this.channel)return;let o=t,i=n;"object"==typeof t&&null!==t&&0===Object.keys(n).length&&(i=t,o="");const r={type:e,toastId:"string"==typeof o?o:String(o??""),payload:i&&"object"==typeof i?i:{},timestamp:Date.now(),tabId:this.tabId};try{this.channel.postMessage(r)}catch(e){console.warn("[Toast] Failed to broadcast message:",e)}}_handleMessage(e){if(!e||e.tabId===this.tabId)return;const{type:t,toastId:n,payload:o}=e;if("leader-elected"===t)return this.leaderTimer&&(clearTimeout(this.leaderTimer),this.leaderTimer=null),void(this.isLeadTab=!1);"sync-response"===t&&this.leaderTimer&&(clearTimeout(this.leaderTimer),this.leaderTimer=null),"sync-request"===t&&this.isLeadTab?this.broadcast("sync-response","all-toasts",{active:Array.from(this._getActiveToasts?.()||[]),queue:this._getQueuedToasts?.()||[]}):(this.listeners.get(t)||[]).forEach(i=>{try{i({toastId:n,payload:o,message:e})}catch(e){console.warn(`[Toast] Listener error for ${t}:`,e)}})}on(e,t){if("function"!=typeof t)throw new Error("Callback must be a function");return this.listeners.has(e)||this.listeners.set(e,[]),this.listeners.get(e).push(t),()=>{const n=this.listeners.get(e)||[],o=n.indexOf(t);o>-1&&n.splice(o,1)}}registerActiveToastsGetter(e){this._getActiveToasts=e}registerQueuedToastsGetter(e){this._getQueuedToasts=e}isSupported(){return this.supportsBroadcastChannel}getTabId(){return this.tabId}isLeadingTab(){return this.isLeadTab}destroy(){if(this.leaderTimer&&(clearTimeout(this.leaderTimer),this.leaderTimer=null),this.channel)try{this.channel.close()}catch(e){console.warn("[Toast] Failed to close BroadcastChannel:",e)}this.listeners.clear(),this.channel=null}}let ke=null;function Ee(){if(!ke&&(ke=new Se,"undefined"!=typeof window)){const e=()=>{ke?.destroy(),ke=null};window.addEventListener("pagehide",e),window.addEventListener("beforeunload",e)}return ke}function _e(){ke&&(ke.destroy(),ke=null)}const Le={error:85,warning:70,info:40,success:30},Me=["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"],Ne=["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"];function Ie(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=Le[t]||50;i.type=a,s+=.6*(a-50);const l="string"==typeof n?n:String(n??""),c=l.toLowerCase();let u=0;for(const e of Me){const t=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");new RegExp(`\\b${t}\\b`,"i").test(l)&&(r.push(e),u+=2)}for(const e of Ne){const t=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");new RegExp(`\\b${t}\\b`,"i").test(l)&&(r.push(e),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,m=Math.min(5,p);i.emphasis=m,s+=m;const f=(l.match(/\b[A-Z]{3,}\b/g)||[]).length,h=Math.min(5,f);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 Be(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 ze(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 Pe(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 Ve(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 qe(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 Fe(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 Re(e,t={}){const{onFlick:n,onPinch:o,onSwipe:i,flickVelocityThreshold:r=.5,swipeVelocityThreshold:s=.3,swipeDistanceThreshold:a=50,pinchSensitivity:l=20}=t;let c=null,u=!1;const d=e=>{u=!0,c=function(e){const t=qe(e);return{touches:t,startTouches:t.map(e=>({...e})),startTime:Date.now(),startDistance:t.length>=2?ze(t[0],t[1]):0,currentDistance:t.length>=2?ze(t[0],t[1]):0}}(e)},p=e=>{u&&c&&(c=function(e,t){const n=qe(t);return{...e,touches:n,currentDistance:n.length>=2?ze(n[0],n[1]):e.currentDistance}}(c,e))},m=e=>{if(!u||!c)return;u=!1;const t=Fe(c,l);t.isPinch&&"function"==typeof o&&o(t);const d=function(e){if(0===e.startTouches.length||0===e.touches.length)return{distance:0,velocity:0,direction:"none",duration:0};const t=e.startTouches[0],n=(e.touches.find(e=>e.id===t.id)||e.touches[0]).x-t.x,o=Date.now()-e.startTime;return{distance:n,velocity:Pe(n,o),direction:n>0?"right":"left",duration:o}}(c);Ve(d.velocity,d.distance,r,30)&&"function"==typeof n&&n(d);const p=function(e,t=.3,n=50){return e.velocity>=t||Math.abs(e.distance)>=n}(d,s,a);p&&"function"==typeof i&&i(d),c=null};return{attach(){e&&"function"==typeof e.addEventListener&&(e.addEventListener("touchstart",d,{passive:!0}),e.addEventListener("touchmove",p,{passive:!0}),e.addEventListener("touchend",m,{passive:!0}),e.addEventListener("touchcancel",m,{passive:!0}))},detach(){e&&"function"==typeof e.removeEventListener&&(e.removeEventListener("touchstart",d),e.removeEventListener("touchmove",p),e.removeEventListener("touchend",m),e.removeEventListener("touchcancel",m))},getState:()=>c}}const Oe=new Map,De=new Map,je=[];let $e=0,We=0;function He(){return{activeCount:Oe.size,queueDepth:je.length,visibleCount:$e,droppedCount:We,timestamp:Date.now()}}function Ue(){const e=i();if("function"==typeof e.onMetrics)try{e.onMetrics(He())}catch(e){console.error("onMetrics callback error:",e)}}const Ge=Ee();function Ye(e){if("number"==typeof e?.options?.priority&&Number.isFinite(e.options.priority))return e.options.priority;const t=e?.priority?.score;if("number"==typeof t&&Number.isFinite(t))return t;const n=i();if("function"==typeof n.priorityScorer)try{const t=n.priorityScorer({type:e?.options?.type||"info",message:e?.options?.message||"",duration:e?.options?.duration,options:e?.options});if("number"==typeof t&&Number.isFinite(t))return t;if(t&&"number"==typeof t.score&&Number.isFinite(t.score))return t.score}catch(e){console.warn("[Toast] Custom priorityScorer error, falling back to built-in:",e)}return Ie(e?.options).score}function Xe(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,Xe(e)},n=()=>{e._isExpanded=!1,Xe(e)},o=()=>{e._isExpanded=!0,Xe(e)},i=t=>{e.contains(t.relatedTarget)||(e._isExpanded=!1,Xe(e))};e.addEventListener("mouseenter",t),e.addEventListener("mouseleave",n),e.addEventListener("focusin",o),e.addEventListener("focusout",i);let r=null;r=Re(e,{onPinch:t=>{"out"!==t.direction||e._isExpanded?"in"===t.direction&&e._isExpanded&&(e._isExpanded=!1,Xe(e)):(e._isExpanded=!0,Xe(e))}}),r.attach(),e._stackedCleanup=()=>{e.removeEventListener("mouseenter",t),e.removeEventListener("mouseleave",n),e.removeEventListener("focusin",o),e.removeEventListener("focusout",i),r?.detach?.(),e._stackedInitialized=!1}}if(!e.children||0===e.children.length)return;const t=Array.from(e.children),n=t.length,o=Boolean(e._isExpanded),r=Boolean(e.id&&e.id.includes("top"));t.forEach((e,t)=>{const s=n-1-t,a=o?"expanded":s>=3?"overflow":String(s);if("function"==typeof e.setAttribute&&e.setAttribute("data-stacked-depth",a),!i().disableInlineStyles)if(e.style.transition="transform 240ms cubic-bezier(0.16, 1, 0.3, 1), margin 240ms cubic-bezier(0.16, 1, 0.3, 1), opacity 240ms ease",o)e.style.transform="none",e.style.marginTop="0px",e.style.marginBottom="10px",e.style.opacity="1",e.style.zIndex=String(100+t),e.style.pointerEvents="auto";else if(0===s)e.style.transform="scale(1)",e.style.marginTop="0px",e.style.marginBottom="0px",e.style.opacity="1",e.style.zIndex="30",e.style.pointerEvents="auto";else if(1===s){const t=r?10:-10;e.style.transform=`scale(0.95) translateY(${t}px)`,e.style.marginTop="-55px",e.style.marginBottom="0px",e.style.opacity="0.9",e.style.zIndex="20",e.style.pointerEvents="auto"}else if(2===s){const t=r?20:-20;e.style.transform=`scale(0.90) translateY(${t}px)`,e.style.marginTop="-55px",e.style.marginBottom="0px",e.style.opacity="0.75",e.style.zIndex="10",e.style.pointerEvents="auto"}else{const t=r?30:-30;e.style.transform=`scale(0.85) translateY(${t}px)`,e.style.marginTop="-55px",e.style.marginBottom="0px",e.style.opacity="0",e.style.zIndex="1",e.style.pointerEvents="none"}})}async function Qe(e={}){try{const t=function(e={}){const t=e&&"object"==typeof e?e:{};return t.id?String(t.id):`${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)}|${ye(t.position||"bottom-right")}`}(e);if(Oe.has(t)){const n=Oe.get(t);if(!n)throw new Error(`Active toast with key ${t} not found`);return n.count++,n.timer?.clear(),n.timer=Ze(n.toast,e),await et(n),await rt(n),Ue(),!e.fromSync&&i().syncTabs&&Ge.isSupported()&&Ge.broadcast("update",t,{count:n.count}),t}if(De.has(t)){const e=De.get(t);if(!e)throw new Error(`Pending toast with key ${t} not found`);return e.count++,t}const n={options:e,count:1,rafId:0};return De.set(t,n),n.rafId=requestAnimationFrame(async()=>{const e=De.get(t);if(e){if(De.delete(t),$e>=i().maxVisible){const n={options:e.options,key:t,count:e.count},o=i().maxQueueSize??100;if(o<=0)return We++,void Ue();const r=i().aiPrioritization||e.options?.aiPrioritization||"number"==typeof e.options?.priority||je.some(e=>e?.options?.aiPrioritization||"number"==typeof e?.options?.priority);if(r&&(n.priority=Ie(e.options)),je.length>=o){if(r){const e=Ye(n);let t=0,o=Ye(je[0]);for(let e=1;e<je.length;e++){const n=Ye(je[e]);n<o&&(t=e,o=n)}if(e<=o)return We++,void Ue();je.splice(t,1)}else je.shift();We++}return je.push(n),r&&je.sort((e,t)=>Ye(t)-Ye(e)),Ue(),void await it()}try{await Ke(e.options,t,e.count)}catch(e){console.error("showToast failed:",e)}}}),!e.fromSync&&i().syncTabs&&Ge.isSupported()&&Ge.broadcast("create",t,{options:e}),t}catch(e){console.error("showToast failed:",e)}}async function Ke(e,t,n){try{if(!e||"object"!=typeof e)throw new TypeError("options must be an object");$e++;const o=await we(e,Ae);if(!o)throw new Error("Failed to create toast container");const r=await me(e,tt);if(!r)throw new Error("Toast element creation failed");const s=document.createElement("div");s.className="toast-outer-wrapper",i().disableInlineStyles||Object.assign(s.style,{position:"relative",display:"inline-block",overflow:"visible",marginBottom:"10px",zIndex:"0",width:"100%",pointerEvents:"auto"});const a=document.createElement("div");a.className="toast-inner-wrapper",i().disableInlineStyles||Object.assign(a.style,{position:"relative",overflow:"hidden",zIndex:"1"}),a.appendChild(r),s.appendChild(a),o.id.includes("toast-container-")&&(o.appendChild(s),e.stacked&&o.setAttribute("data-stacked","true"),"true"===o.getAttribute("data-stacked")&&Xe(o)),k(r);const l=!1!==e.pauseOnHover&&(!0===e.pauseOnHover||!!e.cta||Boolean(i().pauseOnHover)),c={outer:s,toast:r,options:e,count:Math.max(1,Math.floor(n??0)),pauseOnHover:l};Oe.set(t,c),r._key=t,Ue(),c.count>1&&await rt(c),c.timer=Ze(r,e),await et(c)}catch(t){console.error("Something went wrong: ",t),$e=Math.max(0,$e-1),Ue(),(document.querySelector('[id^="toast-container-"]')||document.body).appendChild(await le(e,tt))}}Ge.registerActiveToastsGetter(()=>Array.from(Oe.keys())),Ge.registerQueuedToastsGetter(()=>je.map(e=>({key:e.key,options:e.options,count:e.count}))),Ge.isSupported()&&"undefined"!=typeof window&&(Ge.on("create",({toastId:e,payload:t})=>{i().syncTabs&&e&&t&&!Oe.has(e)&&!De.has(e)&&Qe({...t.options,fromSync:!0})}),Ge.on("update",({toastId:e,payload:t})=>{if(i().syncTabs&&e&&t&&Oe.has(e)){const n=Oe.get(e);n&&n.count!==t.count&&(n.count=t.count,rt(n))}}),Ge.on("dismiss",({toastId:e})=>{i().syncTabs&&e&&(Oe.has(e)||De.has(e))&&nt(e,!0)}),Ge.on("sync-response",({payload:e})=>{if(i().syncTabs&&e&&Array.isArray(e.queue))for(const t of e.queue)!t?.options||Oe.has(t.key)||De.has(t.key)||Qe({...t.options,fromSync:!0})}));const Je=async function(){try{if(0===Oe.size){if(De.size>0){const[e,t]=Array.from(De.entries()).at(-1);return t?.rafId&&cancelAnimationFrame(t.rafId),De.delete(e),void Ue()}return je.length>0?(je.pop(),void Ue()):void 0}let e=null;const t=Array.from(Oe.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 tt(n)}catch(e){console.error("dismissMostRecent failed:",e)}};function Ze(e,t){const n=Number(t?.duration);if(t?.duration===1/0||"number"==typeof t?.duration&&t?.duration<=0)return null;const o=Number.isFinite(n)&&n>0?n:2500,i=new Ce(async()=>await tt(e),o+5);return i.start(),i}async function et(e){if(!e.pauseOnHover||!e.outer||!e.timer)return;e.outer._pauseCleanup?.();const{outer:t,timer:n,toast:o}=e,i=()=>{if(o?._progressAnimation)try{o._progressAnimation.pause()}catch{}else if(o?._progressBar)try{const e=window.getComputedStyle(o._progressBar).width;o._progressBar._pausedWidth=e,o._progressBar.style.transition="none",o._progressBar.style.width=e}catch{}},r=()=>{if(o?._progressAnimation)try{o._progressAnimation.play()}catch{}else if(o?._progressBar&&o._progressBar._pausedWidth)try{const e=n.getRemainingTime?.()??1e3,t=o._progressBar._isReverse,i=o._progressBar._finalWidth||"100%";o._progressBar.style.transition=`width ${Math.max(0,e)}ms linear`,o._progressBar.style.width=t?i:"0%",o._progressBar._pausedWidth=null}catch{}},s=()=>{n.pause(),i(),o?._pauseUndo?.(),o?.classList.add("toast-paused")},a=()=>{n.resume(),r(),o?._resumeUndo?.(),o?.classList.remove("toast-paused")},l=e=>{e.target.matches("[tabindex], div, span, button, a")&&(n.pause(),i(),o?._pauseUndo?.(),o?.classList.add("toast-paused"))},c=e=>{t.contains(e.relatedTarget)||(n.resume(),r(),o?._resumeUndo?.(),o?.classList.remove("toast-paused"))};t.addEventListener("mouseenter",s),t.addEventListener("mouseleave",a),t.addEventListener("focusin",l),t.addEventListener("focusout",c),t._pauseCleanup=()=>{t.removeEventListener("mouseenter",s),t.removeEventListener("mouseleave",a),t.removeEventListener("focusin",l),t.removeEventListener("focusout",c)}}async function tt(e){if(e?._key)return nt(e._key)}async function nt(e,t=!1){try{if(!e)return;!t&&i().syncTabs&&Ge.isSupported()&&Ge.broadcast("dismiss",e,{});const n=De.get(e);if(n)return cancelAnimationFrame(n.rafId),De.delete(e),void Ue();const o=je.findIndex(t=>t.key===e);if(-1!==o)return je.splice(o,1),void Ue();const s=Oe.get(e);if(!s)return;if(s.timer?.clear(),s.outer?._pauseCleanup?.(),s.toast?._cleanupCloseButton?.(),s.toast?._cleanupCTA?.(),s.toast?._cleanupUndo?.(),s.toast?._cleanupSwipe?.(),s.toast?._cleanup?.(),s.toast?._progressAnimation){try{s.toast._progressAnimation.cancel()}catch{}s.toast._progressAnimation=null}const a=s.outer?.querySelector(".toast-count-badge");a?._scaleTimer&&(clearTimeout(a._scaleTimer),a._scaleTimer=null);const l=s.toast?.querySelector("button, a");l?._cleanup?.(),Oe.delete(e),$e=Math.max(0,$e-1),Ue(),a&&a.remove();const c=s.toast?._animationDuration??400,u=Math.min(c,300);if(s.toast){if(!i().disableInlineStyles){const e=String(s.options?.position||s.outer?.parentElement?.id||"").toLowerCase(),t=e.includes("top"),n=e.includes("left"),o=e.includes("right"),i=String(s.options?.animationType||"").toLowerCase().trim();let a="translateY(20px)";const l=s.toast?._spring;r()?(s.toast.style.transition="none",s.toast.style.opacity="0"):("fade"===i?a="none":"zoom"===i||"scale"===i?a="scale(0.75)":"flip"===i?a="perspective(600px) rotateX(-45deg)":"slide"===i?a=n?"translateX(-100%)":o?"translateX(100%)":t?"translateY(-100%)":"translateY(100%)":"bounce"===i?a=t?"translateY(-36px) scale(0.9)":"translateY(36px) scale(0.9)":l&&(a=t?"translateY(-28px) scale(0.94)":"translateY(28px) scale(0.94)"),s.toast.style.transition=`opacity ${u}ms ease-in, transform ${u}ms ease-in`,s.toast.style.opacity="0",s.toast.style.transform=a)}s.toast.classList.remove("active")}const d=s.outer?.parentElement;if(await async function(e,t,n=400){return e?new Promise(o=>{let i=!1,r=null;const s=t||e.firstElementChild||e,a=()=>{if(i)return;i=!0,r&&(clearTimeout(r),r=null);try{s?.removeEventListener?.("transitionend",l,!0)}catch{}const t=e.querySelector?.(".toast")||e;if(t?._pooledId)try{de().release(t,t._pooledId)}catch{}!async function(e){if(!e)return!0;try{if("function"==typeof e.remove)return e.remove(),!0}catch{}try{if(e.parentNode)return e.parentNode.removeChild(e),!0}catch{}}(e),o()},l=e=>{try{if(e.target!==s)return;("transform"===e.propertyName||!s.style.transform&&"opacity"===e.propertyName)&&a()}catch(e){console.error("removeWithTransition error:",e)}};if(!s)return a();try{s.addEventListener("transitionend",l,!0)}catch(e){console.error("removeWithTransition error:",e)}r=setTimeout(a,n+100),"function"==typeof r?.unref&&r.unref()}):Promise.resolve()}(s.outer,s.toast,u),d&&0===d.children.length&&d.id?.startsWith("toast-container-"))try{d._stackedCleanup?.(),function(e){if(!e)return;const t="string"==typeof e&&e.startsWith("toast-container-")?e:ge(e);fe.delete(t),he.delete(t)}(d.id),d.remove()}catch{}else d&&"true"===d.getAttribute("data-stacked")&&Xe(d);await it()}catch(e){console.error("Closing Toast failed!: ",e)}}let ot=!1;async function it(){if(!ot){ot=!0;try{const e=i();for((e.aiPrioritization||je.some(e=>e.options?.aiPrioritization||"number"==typeof e.options?.priority))&&je.length>1&&je.sort((e,t)=>Ye(t)-Ye(e));$e<e.maxVisible&&je.length;){const e=je.shift();if(Oe.has(e.key)){const t=Oe.get(e.key);t.count+=e.count,await rt(t),Ue();continue}await Ke(e.options,e.key,e.count)}Ue()}finally{ot=!1}}}async function rt({outer:e,count:t}){if(!(e&&e instanceof HTMLElement))throw new Error("updateBadge: outer must be a valid HTMLElement");if(t<2){const t=e.querySelector(".toast-count-badge");return void(t&&t.remove())}let n=e.querySelector(".toast-count-badge");n||(n=document.createElement("span"),n.className="toast-count-badge",n.setAttribute("aria-label",`${t} identical notifications`),i().disableInlineStyles||Object.assign(n.style,{position:"absolute",top:"6px",right:"6px",backgroundColor:"#f44336",color:"#fff",borderRadius:"50%",minWidth:"20px",height:"20px",fontSize:"12px",fontWeight:"600",display:"flex",alignItems:"center",justifyContent:"center",border:"2px solid #fff",boxShadow:"0 2px 6px rgba(0,0,0,0.3)",zIndex:"2",pointerEvents:"none",transition:"transform 150ms ease"}),e.appendChild(n)),n.textContent=t>99?"99+":String(t);try{r()||(n._scaleTimer&&clearTimeout(n._scaleTimer),n.style.transform="scale(1.2)",n._scaleTimer=setTimeout(()=>{n.style.transform="scale(1)",n._scaleTimer=null},150),"function"==typeof n._scaleTimer?.unref&&n._scaleTimer.unref())}catch(e){console.error("updateBadge animation error:",e)}}async function st(e,t={}){if(!e||"object"!=typeof t||null===t)return;if(De.has(e)){const n=De.get(e);return void(n.options={...n.options,...t})}const n=je.find(t=>t.key===e);if(n)return void(n.options={...n.options,...t});const o=Oe.get(e);if(!o||!o.toast)return;const r={...o.options};o.options={...o.options,...t};const s=o.toast,a=s._messageSpan||s.querySelector(".toast-message")||s.querySelector("span:not(.toast-count-badge)");if(void 0!==t.message){const e=String(t.message??""),n=void 0!==t.allowHtml?Boolean(t.allowHtml):Boolean(o.options.allowHtml),i=("success"===t.type||"error"===t.type)&&!0!==t.showLoader;if(a){const o=a.querySelector(".toast-loader");if(a.innerHTML="",o&&!1!==t.showLoader&&null!==t.loader&&!i){a.appendChild(o);const e=document.createElement("span");e.style.display="inline-block",e.style.width="8px",a.appendChild(e)}if(n&&e.trim().length>0)try{const t=w(e),n=document.createElement("div");for(n.innerHTML=t;n.firstChild;)a.appendChild(n.firstChild)}catch{a.appendChild(document.createTextNode(e))}else a.appendChild(document.createTextNode(e));a.setAttribute("title",a.textContent||"")}}const l=("success"===t.type||"error"===t.type)&&!0!==t.showLoader;if(!1===t.showLoader||null===t.loader||l){const e=a?.querySelector(".toast-loader");e&&(e.nextSibling&&"SPAN"===e.nextSibling.nodeName&&e.nextSibling.remove(),e.remove())}else if((!0===t.showLoader||t.loader&&"object"==typeof t.loader)&&a&&!a.querySelector(".toast-loader")){const e=x(t.loader||{});a.insertBefore(e,a.firstChild);const n=document.createElement("span");n.style.display="inline-block",n.style.width="8px",a.insertBefore(n,e.nextSibling)}if(t.type){const e=String(t.type).toLowerCase().trim();s.className=s.className.replace(/\btoast-(info|success|error|warning)\b/g,`toast-${e}`);const n="error"===e;if(t.role?s.setAttribute("role",t.role):s.setAttribute("role","alert"),s.setAttribute("aria-live",t.ariaLive||(n?"assertive":"polite")),!t.backgroundColor){const t={success:"#28a745",error:"#dc3545",warning:"#ffc107",info:"#17a2b8"};t[e]&&(s.style.background=t[e])}}if(void 0!==t.icon||void 0!==t.type){const e=s?.querySelector(".toast-icon");e&&e.remove();const n=se({...o.options,...t});n&&(a?s.insertBefore(n,a):s.appendChild(n))}if(t.backgroundColor&&(s.style.background=t.backgroundColor),t.textColor)s.style.color=t.textColor,a&&(a.style.color=t.textColor);else if(t.type||t.backgroundColor){const e=s.style.background;if(e){const t=p(e);s.style.color=t,a&&(a.style.color=t)}}if(void 0!==t.borderRadius){const e="number"==typeof t.borderRadius?`${t.borderRadius}px`:t.borderRadius;s.style.borderRadius=e}if(void 0!==t.maxWidth){const e="number"==typeof t.maxWidth?`${t.maxWidth}px`:t.maxWidth;s.style.maxWidth=e}if(void 0!==t.fontDirection){const e="auto"!==t.fontDirection?t.fontDirection:"";s.style.direction=e,a&&(a.style.direction=e)}if(void 0!==t.fontSize){const e="number"==typeof t.fontSize?`${t.fontSize}px`:t.fontSize;s.style.fontSize=e,a&&(a.style.fontSize=e)}if(void 0!==t.fontFamily&&(s.style.fontFamily=t.fontFamily,a&&(a.style.fontFamily=t.fontFamily)),void 0!==t.fontWeight){const e="number"==typeof t.fontWeight?String(t.fontWeight):t.fontWeight;s.style.fontWeight=e,a&&(a.style.fontWeight=e)}if(void 0!==t.fontLineHeight&&(s.style.lineHeight=t.fontLineHeight,a&&(a.style.lineHeight=t.fontLineHeight)),void 0!==t.role&&s.setAttribute("role",t.role),void 0!==t.ariaLive&&s.setAttribute("aria-live",t.ariaLive),void 0!==t.className){const e=r.className;e&&"string"==typeof e&&s.classList.remove(...e.trim().split(/\s+/)),t.className&&"string"==typeof t.className&&s.classList.add(...t.className.trim().split(/\s+/))}if(void 0!==t.progress){let e=Number(t.progress);Number.isFinite(e)||(e=0),e<1&&e>0&&(e*=100),e=Math.min(100,Math.max(0,e));let n=s.querySelector(".toast-progress-bar");if(n||!t.showProgressBar&&!o.options.showProgressBar||(S(s,{...o.options,...t}),n=s.querySelector(".toast-progress-bar")),n){if(s._progressAnimation){try{s._progressAnimation.cancel()}catch{}s._progressAnimation=null}n.style.transition="width 200ms ease",n.style.width=`${e}%`}}else if(!1===t.showProgressBar){const e=s.querySelector(".toast-progress-bar");e&&e.remove()}if(t.progressBarColor||t.progressColor){const e=s.querySelector(".toast-progress-bar");e&&(e.style.background=t.progressBarColor||t.progressColor)}if(t.progressPosition){const e=s.querySelector(".toast-progress-bar");e&&(e.style.top="top"===t.progressPosition?"0":"auto",e.style.bottom="bottom"===t.progressPosition?"0":"auto")}if(void 0!==t.progressHeight){const e=s.querySelector(".toast-progress-bar");if(e){const n="number"==typeof t.progressHeight?`${t.progressHeight}px`:t.progressHeight;e.style.height=n}}if(void 0!==t.animationType&&(o.options.animationType=t.animationType,s._animationType=t.animationType),void 0!==t.duration){o.timer?.clear();const e=Number(t.duration);Number.isFinite(e)&&e>0?(o.timer=Ze(s,{duration:e}),await et(o)):o.timer=null}else 0!==o.options.duration&&o.timer||"success"!==t.type&&"error"!==t.type&&"warning"!==t.type&&!1!==t.showLoader||(o.timer?.clear(),o.timer=Ze(s,{duration:2500}),await et(o));if(void 0!==t.cta&&(s._cleanupCTA&&(s._cleanupCTA(),s._cleanupCTA=null),s.querySelectorAll(".toast-cta").forEach(e=>e.remove()),t.cta&&"object"==typeof t.cta)&&v(s,{...o.options,...t},tt),void 0!==t.undo&&(s._cleanupUndo&&(s._cleanupUndo(),s._cleanupUndo=null),s.querySelectorAll(".toast-undo-btn").forEach(e=>e.remove()),t.undo)&&T(s,{...o.options,...t},tt),void 0!==t.showCloseButton){const e=s.querySelector(".toast-close-btn");!1===t.showCloseButton?(s._cleanupCloseButton&&(s._cleanupCloseButton(),s._cleanupCloseButton=null),e&&e.remove()):!0!==t.showCloseButton||e||A(s,o.options,tt)}(void 0!==t.sound?Boolean(t.sound):Boolean(t.type&&(o.options.sound||i().sound)))&&F("string"==typeof t.sound?t.sound:t.type||o.options.type||"info",t.soundPreset||o.options.soundPreset||i().soundPreset||"modern");const c=s.closest('[id^="toast-container-"]');c&&"true"===c.getAttribute("data-stacked")&&Xe(c)}let at={success:"#28a745",error:"#dc3545",warning:"#ffc107",info:"#17a2b8"},lt={success:"Operation completed successfully!",error:"Something went wrong!",warning:"Warning message!",info:"Information message!"},ct=!1,ut=null;function dt(e,t){const n="object"!=typeof t||null===t||Array.isArray(t)?{}:t;return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||"bigint"==typeof e?{...n,message:String(e)}:e instanceof Error?{...n,message:e.message||String(e)}:"object"!=typeof e||null===e||Array.isArray(e)?{...n}:{...n,...e}}function pt(e){try{if(e&&"object"==typeof e&&!Array.isArray(e)){const t=["success","error","warning","info"],n={};for(const[o,i]of Object.entries(e))t.includes(o)&&"string"==typeof i&&i.trim()&&(n[o]=i.trim());Object.keys(n).length>0&&(at={...at,...n})}}catch(e){console.error("setDefaultColors failed:",e)}}function mt(e){try{if(e&&"object"==typeof e&&!Array.isArray(e)){const t=["success","error","warning","info"],n={};for(const[o,i]of Object.entries(e))t.includes(o)&&"string"==typeof i&&i.trim()&&(n[o]=i.trim());Object.keys(n).length>0&&(lt={...lt,...n})}}catch(e){console.error("setDefaultMessages failed:",e)}}let ft=!1,ht=null;const yt=async function(e={}){return"undefined"!=typeof window&&"undefined"!=typeof document?(await async function(){ct||"undefined"!=typeof window&&"undefined"!=typeof document&&("complete"!==document.readyState&&"interactive"!==document.readyState?(ut||(ut=new Promise(e=>{document.addEventListener("DOMContentLoaded",()=>{ct=!0,e()},{once:!0})})),await ut):ct=!0)}(),await async function(e={}){try{const t=await async function(e){const t=dt(e),n=i(),o=String(t?.position??n.defaultPosition).toLowerCase().trim(),r=o?.includes("top-full-width")||o?.includes("bottom-full-width")?"100vw":"400px",s={allowHtml:!1,sanitizeHtml:!0,pauseOnHover:void 0,duration:2500,position:n.defaultPosition,type:"info",borderRadius:"50px",backgroundColor:void 0,textColor:void 0,showCloseButton:!0,animationDuration:"0.4s",animationEasing:"ease",showProgressBar:!0,progressColor:void 0,progressBarColor:void 0,progressHeight:"4px",progressPosition:"bottom",progressDirection:"decreasing",animationType:"default",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',fontSize:"14px",fontWeight:"400",fontLineHeight:"1.4",fontDirection:"auto",wrapText:"normal",maxWidth:r,...t};s.message=t?.message??s.message;try{s.backgroundColor||(s.backgroundColor=at?.[s.type]??(window.matchMedia("(prefers-color-scheme: dark)").matches?"#f5f5f5":"#111111"))}catch(e){console.warn("Background color resolution failed:",e)}try{s.message=s.message||lt?.[s.type]||"No Message Provided!"}catch(e){console.warn("Default message resolution failed:",e)}try{!s.textColor&&s.backgroundColor&&(s.textColor=p(s.backgroundColor))}catch(e){console.warn("Text color resolution failed:",e)}try{const e=t?.progressBarColor||t?.progressColor;e?(s.progressColor=e,s.progressBarColor=e):!s.progressColor&&s.backgroundColor&&(s.progressColor=s.textColor||p(s.backgroundColor),s.progressBarColor=s.progressColor)}catch(e){console.warn("Progress bar color resolution failed:",e)}return"string"!=typeof s.message&&(s.message="No Message Provided!"),s}(e);return await async function(e){try{return await we(e,Ae)}catch(e){return console.error("Failed to create toast container:",e),i().targetNode||document.body}}(t),await Qe(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 gt(e={},t){const n=dt(e,t),o=await async function(){if(ft&&ht)try{await ht}catch(e){console.warn("Previous close operation failed (continuing anyway):",e)}return yt(n)}();return{id:o,dismiss:()=>o?nt(o):Promise.resolve(),update:e=>o?st(o,e):Promise.resolve()}}gt.success=(e,t)=>gt({...dt(e,t),type:"success"}),gt.error=(e,t)=>gt({...dt(e,t),type:"error"}),gt.warning=(e,t)=>gt({...dt(e,t),type:"warning"}),gt.info=(e,t)=>gt({...dt(e,t),type:"info"}),gt.loading=(e,t)=>gt({type:"info",showLoader:!0,duration:0,showProgressBar:!1,pauseOnHover:!1,...dt(e,t)}),gt.custom=(e,t)=>gt({allowHtml:!0,...dt(e,t)});const bt=gt.success,wt=gt.error,xt=gt.warning,vt=gt.info,Tt=gt.loading,At=gt.custom,Ct=async e=>{let t=e;if(e&&"function"==typeof e.then)try{t=await e}catch{return}ft=!0,ht=(async()=>{try{"string"==typeof t&&t.length>0?await nt(t):t&&"object"==typeof t?"function"==typeof t.dismiss?await t.dismiss():t._key&&"string"==typeof t._key?await nt(t._key):t.id&&"string"==typeof t.id?await nt(t.id):await Je():await Je()}finally{ft=!1,ht=null}})(),await ht},St=async()=>{ft=!0,ht=(async()=>{try{await async function(){try{for(const[,e]of De)e?.rafId&&cancelAnimationFrame(e.rafId);De.clear(),je.length=0,Ue();const e=Array.from(Oe.values()).map(e=>e.toast).filter(Boolean);await Promise.allSettled(e.map(async e=>{try{await tt(e)}catch(e){console.warn("closeAllToasts: failed to close one toast:",e)}}))}catch(e){console.error("closeAllToasts failed:",e)}}()}finally{ft=!1,ht=null}})(),await ht},kt=St,Et=St,_t=864e5;async function Lt(e,t={},n={}){const o=t&&"object"==typeof t?t:{},i=n&&"object"==typeof n?n:{},r=o.loading??"Loading...",s="object"!=typeof r||null===r||Array.isArray(r)?{...i,type:"info",message:String(r),duration:_t,showProgressBar:!1,pauseOnHover:!1,showLoader:i.showLoader??!0}:{...i,type:"info",duration:_t,showProgressBar:!1,pauseOnHover:!1,showLoader:!0,...r},a=await gt(s),l={...i,pauseOnHover:i.pauseOnHover};try{const t="function"==typeof e?e():e,n=await t;if(a&&"function"==typeof a.dismiss)try{await a.dismiss()}catch{}const i="function"==typeof o.success?o.success(n):o.success??"Done!",r="object"!=typeof i||null===i||Array.isArray(i)?{...l,type:"success",message:String(i)}:{...l,type:"success",...i};return await gt(r),n}catch(e){if(a&&"function"==typeof a.dismiss)try{await a.dismiss()}catch{}const t="function"==typeof o.error?o.error(e):o.error??"Something went wrong.",n="object"!=typeof t||null===t||Array.isArray(t)?{...l,type:"error",message:String(t)}:{...l,type:"error",...t};throw await gt(n),e}}gt.promise=Lt,gt.dismiss=Ct,gt.dismissAll=St,gt.clear=St;const Mt="3.18.2";if("undefined"!=typeof window&&"undefined"!=typeof document&&!window.__customizableToastEscapeAttached){window.__customizableToastEscapeAttached=!0;const e=e=>{if("Escape"===e.key||"Esc"===e.key)(async()=>{try{ft=!0,ht=(async()=>{try{await Je()}finally{ft=!1,ht=null}})(),await ht}catch(e){console.error("Escape key dismiss failed:",e),ft=!1,ht=null}})();else if("F6"===e.key||(e.altKey||e.metaKey)&&("t"===e.key||"T"===e.key)){const e=document.querySelectorAll('[id^="toast-container-"] [id^="toast-"]');if(e.length>0){const t=e[e.length-1],n=t.querySelector("button, a, [tabindex='0']");n&&"function"==typeof n.focus?n.focus():"function"==typeof t.focus&&t.focus()}}};window.addEventListener("keydown",e,{passive:!0})}try{"undefined"!=typeof window&&(window.customizableToast={setConfig:n,getConfig:i,resetConfig:o,shouldReduceMotion:r,version:Mt,createToast:gt,success:bt,error:wt,warning:xt,info:vt,loading:Tt,custom:At,setDefaultColors:pt,setDefaultMessages:mt,noop:St,dismiss:Ct,dismissAll:St,clear:St,toastPromise:Lt,promise:Lt,updateToastByKey:st,setAudioEnabled:j,isAudioEnabled:$,playTone:F,registerSoundPreset:R,getSoundPresets:O,resetSoundPresets:D,resetAudioContext:W,getToastPool:de,resetToastPool:pe,getToastBroadcaster:Ee,resetToastBroadcaster:_e,calculateToastPriority:Ie,categorizeToast:Be,createGestureDetector:Re,detectPinch:Fe,isFlick:Ve,calculateVelocity:Pe,generateToastId:c,resetToastIdCounter:l,getToastMetrics:He,registerSpringPreset:G,getSpringPresets:Y,resetSpringPresets:X,resolveSpringConfig:Q,solveSpring:K,calculateSpringSettlingDuration:J,generateSpringLinearEasing:Z,getSpringTransition:ee,getAudioContext:N,getAudioAnalyser:B})}catch(wt){console.error("Global assignment failed:",wt)}exports.calculateSpringSettlingDuration=J,exports.calculateToastPriority=Ie,exports.calculateVelocity=Pe,exports.categorizeToast=Be,exports.clear=kt,exports.createGestureDetector=Re,exports.createToast=gt,exports.custom=At,exports.default=gt,exports.detectPinch=Fe,exports.dismiss=Ct,exports.dismissAll=Et,exports.error=wt,exports.generateSpringLinearEasing=Z,exports.generateToastId=c,exports.getAudioAnalyser=B,exports.getAudioContext=N,exports.getConfig=i,exports.getSoundPresets=O,exports.getSpringPresets=Y,exports.getSpringTransition=ee,exports.getToastBroadcaster=Ee,exports.getToastMetrics=He,exports.getToastPool=de,exports.info=vt,exports.isAudioEnabled=$,exports.isFlick=Ve,exports.loading=Tt,exports.noop=St,exports.playTone=F,exports.registerSoundPreset=R,exports.registerSpringPreset=G,exports.resetAudioContext=W,exports.resetConfig=o,exports.resetContainerRegistry=function(){fe.clear(),he.clear()},exports.resetSoundPresets=D,exports.resetSpringPresets=X,exports.resetToastBroadcaster=_e,exports.resetToastIdCounter=l,exports.resetToastManager=function(){for(const[,e]of De)e?.rafId&&cancelAnimationFrame(e.rafId);De.clear(),je.length=0;for(const[,e]of Oe){if(e.timer?.clear(),e.outer?._pauseCleanup?.(),e.toast?._cleanupCloseButton?.(),e.toast?._cleanupCTA?.(),e.toast?._cleanupUndo?.(),e.toast?._cleanupSwipe?.(),e.toast?._cleanup?.(),e.toast?._progressAnimation){try{e.toast._progressAnimation.cancel()}catch{}e.toast._progressAnimation=null}const t=e.outer?.querySelector(".toast-count-badge");t?._scaleTimer&&(clearTimeout(t._scaleTimer),t._scaleTimer=null)}"undefined"!=typeof document&&document.querySelectorAll('[id^="toast-container-"]').forEach(e=>{try{e._stackedCleanup?.()}catch{}}),Oe.clear(),$e=0,We=0,ot=!1,Ue()},exports.resetToastPool=pe,exports.resolveSpringConfig=Q,exports.setAudioEnabled=j,exports.setConfig=n,exports.setDefaultColors=pt,exports.setDefaultMessages=mt,exports.shouldReduceMotion=r,exports.solveSpring=K,exports.success=bt,exports.toastPromise=Lt,exports.updateToastByKey=st,exports.version=Mt,exports.warning=xt;
|
|
16
16
|
//# sourceMappingURL=index.cjs.map
|