{o[e]&&(o[e]={})},getSupportedLocales:N,isLocaleSupported:H,getLocaleName:O,getLocaleDirection:D,getLocaleInfo:q,getAllLocaleInfo:()=>N().map(q),formatNumber:(e,t={})=>{try{return new Intl.NumberFormat(T,t).format(e)}catch{return e.toString()}},formatCurrency:(e,t="USD",n={})=>{try{return new Intl.NumberFormat(T,{style:"currency",currency:t,...n}).format(e)}catch{return e.toString()}},formatPercent:(e,t={})=>{try{return new Intl.NumberFormat(T,{style:"percent",minimumFractionDigits:0,maximumFractionDigits:2,...t}).format(e/100)}catch{return`${e}%`}},formatDate:X,formatTime:(e,t={})=>X(e,{hour:"numeric",minute:"numeric",second:"numeric",...t}),formatRelativeTime:(e,t={})=>{try{const n=e instanceof Date?e:new Date(e),o=new Date,r=n.getTime()-o.getTime(),i=new Intl.RelativeTimeFormat(T,{numeric:"auto",...t}),s=[{unit:"year",ms:31536e6},{unit:"month",ms:2592e6},{unit:"week",ms:6048e5},{unit:"day",ms:864e5},{unit:"hour",ms:36e5},{unit:"minute",ms:6e4},{unit:"second",ms:1e3}];for(const{unit:e,ms:t}of s)if(Math.abs(r)>=t||"second"===e){const n=Math.round(r/t);return i.format(n,e)}return String(e)}catch{return String(e)}},formatList:(e,t={})=>{const n=Intl;if("function"==typeof n.ListFormat)try{return new n.ListFormat(T,{style:"long",type:"conjunction"}).format(e)}catch(e){}return e.join(", ")},formatPlural:Y,addLocaleListener:e=>(S.add(e),()=>{S.delete(e)}),removeLocaleListener:e=>{S.delete(e)},clearLocaleListeners:()=>{S.clear()},initI18n:()=>{const e=V();E(e)},saveLocale:F,loadLocale:V,getDefaultLocale:R};o["zh-CN"],o["en-US"];const G=new Map,K=new Set(["slide","fade","scale","bounce","flip","rotate","zoom","slideUp","slideDown","slideLeft","slideRight"]);let Z=null;const J=new Set;Object.entries(a).forEach(([e,t])=>{G.set(e,{name:e,enter:t.enter,leave:t.leave,duration:t.duration,easing:t.easing})});const Q={register(e,t){G.set(e,{name:e,enter:t.enter||{},leave:t.leave||{},duration:t.duration||300,easing:t.easing||"cubic-bezier(0.4, 0, 0.2, 1)"})},unregister(e){G.delete(e)},get:e=>G.get(e)||null,getAnimationNames:()=>Array.from(G.keys()),getActiveCount:()=>G.size,cancelAll(){},reset(){G.clear(),Object.entries(a).forEach(([e,t])=>{G.set(e,{name:e,enter:t.enter,leave:t.leave,duration:t.duration,easing:t.easing})})},destroy(){G.clear(),J.clear(),Z=null}};class ee{static setCallbacks(e){void 0!==e.onError&&(ee._onError=e.onError),void 0!==e.removeToast&&(ee._removeToast=e.removeToast)}static on(e,t){return this._hooks.has(e)||this._hooks.set(e,[]),this._hooks.get(e).push(t),()=>ee.off(e,t)}static off(e,t){const n=this._hooks.get(e);if(n){const o=n.filter(e=>e!==t);0===o.length?this._hooks.delete(e):this._hooks.set(e,o)}}static trigger(e,t=null){const n=this._hooks.get(e);if(!n||0===n.length)return!0;let o=!0;return n.forEach(n=>{try{!1===n(t)&&(o=!1)}catch(n){if(ee._onError)try{ee._onError({hook:e,error:n,toast:t})}catch(e){}}}),o}constructor(e){this.el=null,this.barEl=null,this.rafId=null,this.startedAt=0,this.paused=!1,this.closing=!1,this.group=null,this._cleanups=[],this.id=e.id||"met-"+Date.now().toString(36)+"-"+Math.random().toString(36).slice(2,8),this.type=e.type||"default",this.title=e.title||"",this.message=e.message??e.content??"",this.html=e.html||"",this.iconHTML=e.iconHTML||"",this.config={...i,...e},e.style&&"object"==typeof e.style&&(this.config.style={...e.style}),this.remaining=this.config.duration||0,this.group=e.group||null}_palette(){const e=(e=>m(e))(this.config.theme||"auto"),t=s[this.type]||s.default,n=l[e]||l.light;return{theme:e,c:t,t:{bg:n.bg,border:n.border,shadow:n.shadow}}}create(){if("undefined"==typeof window||"undefined"==typeof document)return this;if(!ee.trigger("beforeShow",this))return this;if("function"==typeof this.config.onBeforeShow)try{if(!1===this.config.onBeforeShow(this))return this}catch(e){}(()=>{if("undefined"==typeof document)return;if(c&&document.getElementById("metona-toast-styles"))return;c=document.createElement("style"),c.id="metona-toast-styles",c.textContent='\n .met-container {\n pointer-events: none;\n display: flex;\n flex-direction: column;\n gap: 12px;\n box-sizing: border-box;\n padding: 24px;\n max-width: 100vw;\n position: fixed;\n z-index: 9999;\n }\n\n .met-container.top-left { top: 0; left: 0; align-items: flex-start; }\n .met-container.top-center { top: 0; left: 0; right: 0; align-items: center; }\n .met-container.top-right { top: 0; right: 0; align-items: flex-end; }\n .met-container.bottom-left { bottom: 0; left: 0; align-items: flex-start; }\n .met-container.bottom-center{ bottom: 0; left: 0; right: 0; align-items: center; }\n .met-container.bottom-right { bottom: 0; right: 0; align-items: flex-end; }\n\n .met-toast {\n position: relative;\n display: flex;\n align-items: flex-start;\n gap: 12px;\n padding: 14px 16px;\n border-radius: 12px;\n box-sizing: border-box;\n backdrop-filter: blur(14px) saturate(180%);\n -webkit-backdrop-filter: blur(14px) saturate(180%);\n font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;\n user-select: none;\n -webkit-user-select: none;\n transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),\n box-shadow 0.25s ease,\n opacity 0.25s ease;\n will-change: transform, opacity;\n flex-shrink: 0;\n pointer-events: auto;\n min-width: 240px;\n max-width: calc(100vw - 48px);\n width: 360px;\n border: 1px solid var(--met-border, rgba(0,0,0,0.06));\n background: var(--met-bg, rgba(255,255,255,0.96));\n color: var(--met-text, #1f2937);\n box-shadow: var(--met-shadow, 0 10px 36px -10px rgba(0,0,0,0.18), 0 4px 14px -4px rgba(0,0,0,0.08));\n transform: translateZ(0);\n -webkit-transform: translateZ(0);\n backface-visibility: hidden;\n -webkit-backface-visibility: hidden;\n perspective: 1000;\n }\n\n .met-toast:hover {\n box-shadow: var(--met-hover-shadow, 0 14px 48px -10px rgba(0,0,0,0.22), 0 6px 18px -4px rgba(0,0,0,0.10)) !important;\n }\n\n .met-toast.met-clickable {\n cursor: pointer;\n }\n\n .met-icon {\n flex-shrink: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 24px;\n height: 24px;\n margin-top: 1px;\n }\n\n .met-content {\n flex: 1;\n min-width: 0;\n word-wrap: break-word;\n overflow-wrap: break-word;\n }\n\n .met-title {\n font-weight: 600;\n font-size: 14px;\n letter-spacing: 0.1px;\n }\n\n .met-message {\n font-size: 13px;\n opacity: 0.85;\n margin-top: 2px;\n }\n\n .met-close {\n flex-shrink: 0;\n background: transparent;\n border: 0;\n padding: 4px;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 6px;\n transition: background 0.2s, color 0.2s;\n line-height: 0;\n color: inherit;\n opacity: 0.5;\n }\n\n .met-close:hover {\n opacity: 1;\n background: var(--met-close-hover-bg, rgba(0,0,0,0.06));\n }\n\n .met-progress {\n position: absolute;\n left: 0; right: 0; bottom: 0;\n height: 3px;\n overflow: hidden;\n background: var(--met-progress-bg, rgba(0,0,0,0.06));\n border-radius: 0 0 12px 12px;\n }\n\n .met-progress-v {\n position: absolute;\n left: 0; top: 0; bottom: 0;\n width: 3px;\n overflow: hidden;\n background: var(--met-progress-bg, rgba(0,0,0,0.06));\n border-radius: 12px 0 0 12px;\n }\n\n .met-bar {\n position: absolute;\n left: 0; top: 0;\n height: 100%; width: 100%;\n transform-origin: left;\n transform: scaleX(1);\n }\n\n .met-bar-v {\n position: absolute;\n left: 0; bottom: 0;\n width: 100%; height: 100%;\n transform-origin: bottom;\n transform: scaleY(1);\n }\n\n .met-side {\n position: absolute;\n left: 0; top: 0; bottom: 0;\n width: 4px;\n border-radius: 12px 0 0 12px;\n }\n\n .met-spin {\n animation: met-rot 1s linear infinite;\n transform-origin: 50% 50%;\n }\n\n .met-toast.met-leaving {\n pointer-events: none;\n z-index: 1;\n }\n\n @keyframes met-rot {\n to { transform: rotate(360deg); }\n }\n\n .met-anim-slide.met-toast,\n .met-anim-fade.met-toast,\n .met-anim-scale.met-toast,\n .met-anim-bounce.met-toast,\n .met-anim-flip.met-toast,\n .met-anim-rotate.met-toast,\n .met-anim-zoom.met-toast,\n .met-anim-slideUp.met-toast,\n .met-anim-slideDown.met-toast,\n .met-anim-slideLeft.met-toast,\n .met-anim-slideRight.met-toast {\n opacity: 0;\n }\n\n @keyframes met-slide-in {\n 0% { transform: translateX(80px); opacity: 0; }\n 65% { transform: translateX(-6px); opacity: 1; }\n 100% { transform: translateX(0); opacity: 1; }\n }\n @keyframes met-fade-in {\n 0% { opacity: 0; filter: blur(3px); }\n 100% { opacity: 1; filter: blur(0); }\n }\n @keyframes met-scale-in {\n 0% { transform: scale(0.55); opacity: 0; }\n 65% { transform: scale(1.07); opacity: 1; }\n 100% { transform: scale(1); opacity: 1; }\n }\n @keyframes met-bounce-in {\n 0% { transform: translateY(-80px); opacity: 0; animation-timing-function: ease-in; }\n 45% { transform: translateY(14px); opacity: 1; animation-timing-function: ease-out; }\n 65% { transform: translateY(-12px); animation-timing-function: ease-in; }\n 82% { transform: translateY(4px); animation-timing-function: ease-out; }\n 100% { transform: translateY(0); opacity: 1; }\n }\n @keyframes met-flip-in {\n 0% { transform: perspective(500px) rotateX(-90deg); opacity: 0; }\n 60% { transform: perspective(500px) rotateX(8deg); opacity: 1; }\n 85% { transform: perspective(500px) rotateX(-2deg); }\n 100% { transform: perspective(500px) rotateX(0); opacity: 1; }\n }\n @keyframes met-rotate-in {\n 0% { transform: rotate(-25deg) scale(0.6); opacity: 0; }\n 60% { transform: rotate(4deg) scale(1.05); opacity: 1; }\n 85% { transform: rotate(-1deg) scale(0.98); }\n 100% { transform: rotate(0) scale(1); opacity: 1; }\n }\n @keyframes met-zoom-in {\n 0% { transform: scale(0.1); opacity: 0; }\n 50% { transform: scale(1.12); opacity: 1; }\n 75% { transform: scale(0.94); }\n 100% { transform: scale(1); opacity: 1; }\n }\n @keyframes met-slideUp-in {\n 0% { transform: translateY(60px); opacity: 0; }\n 70% { transform: translateY(-6px); opacity: 1; }\n 100% { transform: translateY(0); opacity: 1; }\n }\n @keyframes met-slideDown-in {\n 0% { transform: translateY(-60px); opacity: 0; }\n 70% { transform: translateY(6px); opacity: 1; }\n 100% { transform: translateY(0); opacity: 1; }\n }\n @keyframes met-slideLeft-in {\n 0% { transform: translateX(-90px); opacity: 0; }\n 65% { transform: translateX(6px); opacity: 1; }\n 100% { transform: translateX(0); opacity: 1; }\n }\n @keyframes met-slideRight-in {\n 0% { transform: translateX(90px); opacity: 0; }\n 65% { transform: translateX(-6px); opacity: 1; }\n 100% { transform: translateX(0); opacity: 1; }\n }\n\n .met-anim-slide.met-toast.met-show { animation: met-slide-in 0.40s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards; }\n .met-anim-fade.met-toast.met-show { animation: met-fade-in 0.50s ease forwards; }\n .met-anim-scale.met-toast.met-show { animation: met-scale-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; }\n .met-anim-bounce.met-toast.met-show { animation: met-bounce-in 0.65s ease forwards; }\n .met-anim-flip.met-toast.met-show { animation: met-flip-in 0.50s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards; }\n .met-anim-rotate.met-toast.met-show { animation: met-rotate-in 0.50s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards; }\n .met-anim-zoom.met-toast.met-show { animation: met-zoom-in 0.50s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; }\n .met-anim-slideUp.met-toast.met-show { animation: met-slideUp-in 0.40s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards; }\n .met-anim-slideDown.met-toast.met-show { animation: met-slideDown-in 0.40s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards; }\n .met-anim-slideLeft.met-toast.met-show { animation: met-slideLeft-in 0.40s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards; }\n .met-anim-slideRight.met-toast.met-show { animation: met-slideRight-in 0.40s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards; }\n\n @media (max-width: 480px) {\n .met-container { padding: 12px !important; }\n .met-toast { width: 100% !important; min-width: 0 !important; }\n }\n\n @media (max-width: 768px) {\n .met-toast { font-size: 13px; }\n .met-title { font-size: 13px; }\n .met-message { font-size: 12px; }\n }\n\n @media (min-width: 1200px) {\n .met-toast { width: 400px; }\n }\n\n @media (min-width: 1920px) {\n .met-toast { width: 440px; }\n }\n\n @media (max-width: 320px) {\n .met-toast { width: 100%; min-width: 0; padding: 12px 14px; }\n .met-container { padding: 8px; }\n }\n\n @media (orientation: landscape) and (max-height: 500px) {\n .met-container { padding: 12px 24px; }\n .met-toast { min-height: 44px; padding: 10px 14px; }\n }\n\n @media (orientation: portrait) and (max-width: 500px) {\n .met-container { padding: 12px; }\n .met-toast { width: 100%; min-width: 0; }\n }\n\n @media (prefers-reduced-motion: reduce) {\n .met-toast { transition: opacity 0.15s !important; }\n .met-toast.met-show { animation: none !important; opacity: 1 !important; }\n .met-spin { animation-duration: 2.5s !important; }\n }\n\n @media (forced-colors: active) {\n .met-toast { border: 2px solid ButtonText; }\n .met-close { border: 1px solid ButtonText; }\n }\n\n @media (prefers-contrast: high) {\n .met-toast { border-width: 3px; border-style: solid; }\n .met-close { border: 2px solid currentColor; border-radius: 4px; }\n }\n\n .met-toast:focus-visible {\n outline: 2px solid #3b82f6;\n outline-offset: 2px;\n }\n .met-close:focus-visible {\n outline: 2px solid #3b82f6;\n outline-offset: 2px;\n }\n\n @media (hover: none) and (pointer: coarse) {\n .met-toast:hover { box-shadow: inherit; }\n .met-toast { min-height: 48px; }\n .met-close { min-width: 48px; min-height: 48px; }\n }\n\n @media print {\n .met-container { display: none !important; }\n .met-toast { display: none !important; }\n }\n\n :fullscreen .met-container,\n :picture-in-picture .met-container {\n z-index: 2147483647;\n }\n\n @supports (padding: max(0px)) {\n .met-container {\n padding: max(24px, env(safe-area-inset-top))\n max(24px, env(safe-area-inset-right))\n max(24px, env(safe-area-inset-bottom))\n max(24px, env(safe-area-inset-left));\n }\n }\n\n .met-toast:active {\n transform: scale(0.98);\n }\n\n .met-toast.met-success { border-left: 4px solid #10b981; }\n .met-toast.met-error { border-left: 4px solid #ef4444; }\n .met-toast.met-warning { border-left: 4px solid #f59e0b; }\n .met-toast.met-info { border-left: 4px solid #3b82f6; }\n .met-toast.met-loading { border-left: 4px solid #6366f1; }\n\n .met-bar, .met-bar-v {\n transition: transform 0.1s linear;\n }\n\n /* RTL 镜像:进度条从右向左收缩、side 条移到右侧、类型色条翻转到右边 */\n [dir="rtl"] .met-bar {\n transform-origin: right;\n }\n [dir="rtl"] .met-side {\n left: auto;\n right: 0;\n border-radius: 0 12px 12px 0;\n }\n [dir="rtl"] .met-progress-v {\n left: auto;\n right: 0;\n border-radius: 0 12px 12px 0;\n }\n [dir="rtl"] .met-toast.met-success {\n border-left-width: 1px;\n border-right: 4px solid #10b981;\n }\n [dir="rtl"] .met-toast.met-error {\n border-left-width: 1px;\n border-right: 4px solid #ef4444;\n }\n [dir="rtl"] .met-toast.met-warning {\n border-left-width: 1px;\n border-right: 4px solid #f59e0b;\n }\n [dir="rtl"] .met-toast.met-info {\n border-left-width: 1px;\n border-right: 4px solid #3b82f6;\n }\n [dir="rtl"] .met-toast.met-loading {\n border-left-width: 1px;\n border-right: 4px solid #6366f1;\n }\n\n .met-container::-webkit-scrollbar { width: 6px; height: 6px; }\n .met-container::-webkit-scrollbar-track { background: transparent; }\n .met-container::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.2); border-radius: 3px; }\n .met-container::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.3); }\n\n .met-toast.met-theme-dark {\n background: rgba(28, 32, 40, 0.94);\n color: #e6e8eb;\n border-color: rgba(255, 255, 255, 0.08);\n box-shadow: 0 10px 36px -10px rgba(0, 0, 0, 0.6), 0 4px 14px -4px rgba(0, 0, 0, 0.4);\n }\n .met-toast.met-theme-dark:hover {\n box-shadow: 0 14px 48px -8px rgba(0, 0, 0, 0.6), 0 6px 18px -4px rgba(0, 0, 0, 0.4) !important;\n }\n .met-toast.met-theme-dark .met-close:hover {\n background: rgba(255, 255, 255, 0.08);\n }\n .met-toast.met-theme-dark .met-progress,\n .met-toast.met-theme-dark .met-progress-v {\n background: rgba(255, 255, 255, 0.08);\n }\n\n .met-toast.met-theme-light {\n background: rgba(255, 255, 255, 0.96);\n color: #1f2937;\n border-color: rgba(0, 0, 0, 0.06);\n box-shadow: 0 10px 36px -10px rgba(0, 0, 0, 0.18), 0 4px 14px -4px rgba(0, 0, 0, 0.08);\n }\n .met-toast.met-theme-light:hover {\n box-shadow: 0 14px 48px -10px rgba(0, 0, 0, 0.22), 0 6px 18px -4px rgba(0, 0, 0, 0.10) !important;\n }\n .met-toast.met-theme-light .met-close:hover {\n background: rgba(0, 0, 0, 0.06);\n }\n .met-toast.met-theme-light .met-progress,\n .met-toast.met-theme-light .met-progress-v {\n background: rgba(0, 0, 0, 0.06);\n }\n\n .met-toast[data-theme] {\n --met-bg: var(--met-theme-bg);\n --met-text: var(--met-theme-text);\n --met-border: var(--met-theme-border);\n --met-shadow: var(--met-theme-shadow);\n }\n\n @media (prefers-color-scheme: dark) {\n .met-theme-auto .met-toast {\n background: rgba(28, 32, 40, 0.94);\n color: #e6e8eb;\n border-color: rgba(255, 255, 255, 0.08);\n box-shadow: 0 10px 36px -10px rgba(0, 0, 0, 0.6), 0 4px 14px -4px rgba(0, 0, 0, 0.4);\n }\n .met-theme-auto .met-toast:hover {\n box-shadow: 0 14px 48px -8px rgba(0, 0, 0, 0.6), 0 6px 18px -4px rgba(0, 0, 0, 0.4) !important;\n }\n .met-theme-auto .met-close:hover { background: rgba(255, 255, 255, 0.08); }\n .met-theme-auto .met-progress,\n .met-theme-auto .met-progress-v { background: rgba(255, 255, 255, 0.08); }\n }\n\n @media (prefers-color-scheme: light) {\n .met-theme-auto .met-toast {\n background: rgba(255, 255, 255, 0.96);\n color: #1f2937;\n border-color: rgba(0, 0, 0, 0.06);\n box-shadow: 0 10px 36px -10px rgba(0, 0, 0, 0.18), 0 4px 14px -4px rgba(0, 0, 0, 0.08);\n }\n .met-theme-auto .met-toast:hover {\n box-shadow: 0 14px 48px -10px rgba(0, 0, 0, 0.22), 0 6px 18px -4px rgba(0, 0, 0, 0.10) !important;\n }\n .met-theme-auto .met-close:hover { background: rgba(0, 0, 0, 0.06); }\n .met-theme-auto .met-progress,\n .met-theme-auto .met-progress-v { background: rgba(0, 0, 0, 0.06); }\n }\n '.replace(/\s+/g," "),document.head.appendChild(c)})(),(e=>{if("undefined"==typeof document)return;if(K.has(e))return;const t=G.get(e);t&&!J.has(e)&&(Z||(Z=document.getElementById("metona-toast-anim-styles"),Z||(Z=document.createElement("style"),Z.id="metona-toast-anim-styles",document.head.appendChild(Z))),Z.textContent+=((e,t)=>{var n;return`\n @keyframes met-${e}-in {\n from { ${n=t.enter,Object.entries(n).map(([e,t])=>`${e}:${t}`).join(";")}; }\n }\n .met-anim-${e}.met-toast { opacity: 0; }\n .met-anim-${e}.met-toast.met-show {\n animation: met-${e}-in ${t.duration}ms ${t.easing} forwards;\n }\n `})(e,t),J.add(e))})(this.config.animation||"slide");const e=this._getContainer(),{theme:t,c:n,t:o}=this._palette();this._limitToasts(e);const r=document.createElement("div");if(r.className=this._buildClassName(t),r.setAttribute("role","error"===this.type||"warning"===this.type?"alert":"status"),r.setAttribute("aria-live","error"===this.type?"assertive":"polite"),r.dataset.id=this.id,this._applyStyles(r,t,o),this._buildContent(r,n),this.el=r,(this.config.position||"top-right").startsWith("top")?e.insertBefore(r,e.firstChild):e.appendChild(r),ee._registry.set(this.id,this),this._bindEvents(r),this._startTimer(),requestAnimationFrame(()=>{requestAnimationFrame(()=>{r.classList.add("met-show")})}),"function"==typeof this.config.onShow)try{this.config.onShow(this)}catch(e){}return ee.trigger("afterShow",this),this}_getContainer(){const e=this.config.position||"top-right",t=this.config.zIndex||9999,n="rtl"===D(L()),o=n?e.replace("left","__TMP__").replace("right","left").replace("__TMP__","right"):e,r=te.get(document.body);if(r&&r.has(o))return r.get(o);te.has(document.body)||te.set(document.body,new Map);const i=document.createElement("div");return i.className=`met-container ${o}`,i.setAttribute("aria-label","Notifications"),i.setAttribute("role","region"),n&&i.setAttribute("dir","rtl"),i.style.cssText=`\n display:flex;\n flex-direction:column;\n gap:${this.config.gap||12}px;\n box-sizing:border-box;\n padding:${this.config.offset||24}px;\n max-width:100vw;\n position:fixed;\n z-index:${t};\n pointer-events:none;\n ${{"top-left":"top:0;left:0;align-items:flex-start","top-center":"top:0;left:0;right:0;align-items:center","top-right":"top:0;right:0;align-items:flex-end","bottom-left":"bottom:0;left:0;align-items:flex-start","bottom-center":"bottom:0;left:0;right:0;align-items:center","bottom-right":"bottom:0;right:0;align-items:flex-end"}[o]||"top:0;right:0;align-items:flex-end"}\n `,document.body.appendChild(i),te.get(document.body).set(o,i),i}_limitToasts(e){const t=this.config.max||6,n=Array.from(e.querySelectorAll(".met-toast"));for(;n.length>=t;){const e=n.shift(),t=e?.dataset.id;if(!t)continue;const o=ee._registry.get(t);o?o.close(!0):ee._removeToast&&ee._removeToast(t)}}_buildClassName(e){const t=(n=this.config.animation||"",G.has(n)?this.config.animation:"slide");var n;return["met-toast",`met-${this.type}`,`met-theme-${e}`,`met-anim-${t}`,this.config.closeOnClick||this.config.draggable?"met-clickable":"",this.config.className||""].filter(Boolean).join(" ")}_applyStyles(e,t,n){const o="number"==typeof this.config.width?`${this.config.width}px`:"string"==typeof this.config.width?this.config.width:"360px",r=(t,n)=>e.style.setProperty(t,n,"important");r("position","relative"),r("flex-shrink","0"),r("min-width","240px"),r("max-width","calc(100vw - 48px)"),r("width",o),this.config.style&&Object.keys(this.config.style).length>0&&Object.entries(this.config.style).forEach(([t,n])=>{e.style[t]=n})}_buildContent(e,o){if("function"==typeof this.config.render)return e.innerHTML=this.config.render(this),void(this.barEl=e.querySelector(".met-bar, .met-bar-v"));const r=!1!==this.config.icon&&(this.iconHTML||n[this.type]),i=!1!==this.config.closeButton,s=!1!==this.config.showProgress&&(this.config.duration||0)>0,a=!r&&"default"!==this.type,l=this.title?`${t(this.title)}
`:"",c=this.html?`${this.html}
`:this.message?`${t(this.message)}
`:"",d=r?`${this.iconHTML||n[this.type]}
`:"",h=i?``:"",g=s?"vertical"===this.config.progressDirection?``:``:"",p=a?``:"";e.innerHTML=`\n ${d}\n ${p}\n \n ${l}\n ${c}\n
\n ${h}\n ${g}\n `,this.barEl=e.querySelector(".met-bar, .met-bar-v")}_bindEvents(e){const t=e=>{const t=e.target;if(t.closest(".met-close"))return e.stopPropagation(),void this.close();if(ee.trigger("click",this),!this.config.closeOnClick||t.closest(".met-close"));else{if("function"==typeof this.config.onClick)try{this.config.onClick(this)}catch(e){}this.close()}};if(e.addEventListener("click",t),this._cleanups.push(()=>e.removeEventListener("click",t)),this.config.pauseOnHover&&(this.config.duration||0)>0){const t=()=>{ee.trigger("hover",this),this._pause()},n=()=>{ee.trigger("hover",this),this._resume()};e.addEventListener("mouseenter",t),e.addEventListener("mouseleave",n),this._cleanups.push(()=>{e.removeEventListener("mouseenter",t),e.removeEventListener("mouseleave",n)})}const n=()=>ee.trigger("animationStart",this),o=()=>ee.trigger("animationEnd",this);e.addEventListener("animationstart",n),e.addEventListener("animationend",o),this._cleanups.push(()=>{e.removeEventListener("animationstart",n),e.removeEventListener("animationend",o)}),this.config.draggable&&this._bindDrag(e)}_bindDrag(e){let t=0,n=0,o=0,r=0,i=!1;const s=o=>{o.target.closest(".met-close")||(i=!0,t=o.clientX,n=o.clientY,e.setPointerCapture(o.pointerId),e.style.transition="none",this._pause(),ee.trigger("dragStart",this))},a=s=>{i&&(o=s.clientX-t,r=s.clientY-n,e.style.transform=`translate(${o}px, ${r}px) rotate(${.1*o}deg)`,e.style.opacity=String(Math.max(0,1-Math.abs(o)/200)))},l=t=>{if(!i)return;i=!1,e.releasePointerCapture(t.pointerId),e.style.transition="";const n=this.config.dragThreshold??120;Math.abs(o)>n?(e.style.transform=`translate(${2*o}px, ${r}px) rotate(${.2*o}deg)`,e.style.opacity="0",setTimeout(()=>this.close(!0),250)):(e.style.transform="",e.style.opacity="",this._resume()),o=r=0,ee.trigger("dragEnd",this)};e.addEventListener("pointerdown",s),e.addEventListener("pointermove",a),e.addEventListener("pointerup",l),e.addEventListener("pointercancel",l),this._cleanups.push(()=>{e.removeEventListener("pointerdown",s),e.removeEventListener("pointermove",a),e.removeEventListener("pointerup",l),e.removeEventListener("pointercancel",l)})}_startTimer(e=!1){if((this.config.duration||0)<=0)return;e||(this.startedAt=Date.now(),this.remaining=this.config.duration||0,ee.trigger("progressStart",this));const t=()=>{if(!this.paused&&!this.closing){try{const e=Date.now()-this.startedAt;if(this.remaining=Math.max(0,(this.config.duration||0)-e),this.barEl){const e=this.remaining/(this.config.duration||1),t="vertical"===this.config.progressDirection?`scaleY(${e})`:`scaleX(${e})`;this.barEl.style.transform=t}if(this.remaining<=0)return ee.trigger("progressEnd",this),void this.close()}catch(e){if(ee._onError)try{ee._onError({source:"timer",error:e,toast:this})}catch(e){}}this.rafId=requestAnimationFrame(t)}};this.rafId=requestAnimationFrame(t)}_pause(){this.paused||(this.config.duration||0)<=0||(this.paused=!0,null!==this.rafId&&cancelAnimationFrame(this.rafId),this.remaining=Math.max(0,(this.config.duration||0)-(Date.now()-this.startedAt)))}_resume(){this.paused&&(this.paused=!1,this.startedAt=Date.now()-((this.config.duration||0)-this.remaining),this._startTimer(!0))}update(e){if(!ee.trigger("beforeUpdate",this))return this;const n=e.type&&e.type!==this.type;if(e.type&&(this.type=e.type),void 0!==e.title&&(this.title=e.title),void 0!==e.message&&(this.message=e.message),void 0!==e.html&&(this.html=e.html),!this.el)return ee.trigger("afterUpdate",this),this;if(n){if(["met-success","met-error","met-warning","met-info","met-loading","met-default"].forEach(e=>this.el.classList.remove(e)),this.el.classList.add(`met-${this.type}`),this.barEl){const e=s[this.type]||s.default;this.barEl.style.background=e.fg}const e=this.el.querySelector(".met-side");if(e){const t=s[this.type]||s.default;e.style.background=t.fg}}const o=this.el.querySelector(".met-content");if(o){const e=this.title?`${t(this.title)}
`:"",n=this.html?`${this.html}
`:this.message?`${t(this.message)}
`:"";o.innerHTML=`${e}${n}`}if(void 0!==e.duration&&e.duration!==this.config.duration&&(this.config.duration=e.duration,null!==this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=null,this.remaining=Math.max(0,e.duration),e.duration>0&&!this.paused&&(this.startedAt=Date.now(),this._startTimer())),this.config.resetTimerOnUpdate&&(this.config.duration||0)>0&&(null!==this.rafId&&cancelAnimationFrame(this.rafId),this.startedAt=Date.now(),this.remaining=this.config.duration||0,this._startTimer()),"function"==typeof this.config.onUpdate)try{this.config.onUpdate(this)}catch(e){}return ee.trigger("afterUpdate",this),this}updatePosition(e){if(!e||!this.el)return this;const t=this.el.parentNode;this.config.position=e;const n=this._getContainer();return t===n||(t&&this.el.parentNode===t&&t.removeChild(this.el),e.startsWith("top")?n.insertBefore(this.el,n.firstChild):n.appendChild(this.el)),this}remove(){null!==this.rafId&&(cancelAnimationFrame(this.rafId),this.rafId=null),this._cleanups.forEach(e=>{try{e()}catch(e){}}),this._cleanups=[],this.el&&this.el.parentNode&&this.el.parentNode.removeChild(this.el),this.el=null,ee._registry.delete(this.id),ee._removeToast&&ee._removeToast(this.id)}close(e=!1){if(this.closing)return;if(!ee.trigger("beforeClose",this))return;this.closing=!0,null!==this.rafId&&cancelAnimationFrame(this.rafId),this._cleanups.forEach(e=>{try{e()}catch(e){}}),this._cleanups=[];const t=this.el;if(!t)return void(ee._removeToast&&ee._removeToast(this.id));const n=t.parentNode;if(n&&!e){const e=t.getBoundingClientRect(),o=n.getBoundingClientRect();t.style.position="absolute",t.style.top=e.top-o.top+"px",t.style.left=e.left-o.left+"px",t.style.width=e.width+"px",t.style.margin="0"}t.classList.add("met-leaving"),t.classList.remove("met-show");const o=this.config.position||"top-right",r="rtl"===D(L());let i="scale(.96)";i=o.includes("right")?r?"translateX(-120%)":"translateX(120%)":o.includes("left")?r?"translateX(120%)":"translateX(-120%)":o.startsWith("top")?"translateY(-20px)":"translateY(20px)",t.style.transform=i,t.style.opacity="0",setTimeout(()=>this._destroy(),e?0:300)}_destroy(){if(this.el&&this.el.parentNode&&this.el.parentNode.removeChild(this.el),this.el=null,"function"==typeof this.config.onClose)try{this.config.onClose(this)}catch(e){}ee.trigger("afterClose",this),ee._registry.delete(this.id),ee._removeToast&&ee._removeToast(this.id)}}ee._hooks=new Map,ee._registry=new Map,ee._onError=null,ee._removeToast=null;const te=new Map,ne=e=>`\n \n ${e}\n
`,oe=e=>{const n=e.confirmText||z("confirm"),o=e.cancelText||z("cancel"),r=e.confirmColor||"#10b981",i=e.cancelColor||"#6b7280";return ne(`\n \n \n `)},re=e=>{const n=e.submitText||z("confirm"),o=e.cancelText||z("cancel"),r=e.submitColor||"#3b82f6",i=e.cancelColor||"#6b7280";return`\n \n ${ne(`\n \n \n `)}\n `},ie=e=>`\n \n 0%
\n `,se=e=>{if(!Array.isArray(e)||0===e.length)return"";const n=e.map((e,n)=>``).join("");return ne(n)};class ae{constructor(){this.plugins=new Map,this.initialized=!1}register(e,t){if(this.plugins.has(e))return this;if(!t||"object"!=typeof t||!t.name)return this;const n={...t,installed:!1,enabled:!0};if(n.name||(n.name=e),this.plugins.set(e,n),n.install)try{n.install(this),n.installed=!0}catch(e){}return this}unregister(e){const t=this.plugins.get(e);if(!t)return this;if(t.uninstall)try{t.uninstall(this)}catch(e){}return this.plugins.delete(e),this}get(e){return this.plugins.get(e)||null}has(e){return this.plugins.has(e)}getAll(){return Array.from(this.plugins.values())}getNames(){return Array.from(this.plugins.keys())}enable(e){const t=this.plugins.get(e);return t&&(t.enabled=!0),this}disable(e){const t=this.plugins.get(e);return t&&(t.enabled=!1),this}isEnabled(e){const t=this.plugins.get(e);return!!t&&!!t.enabled}destroy(){this.plugins.forEach(e=>{if(e.destroy)try{e.destroy(this)}catch(e){}}),this.plugins.clear()}}const le={keyboard:{name:"keyboard",version:"1.0.0",description:"ESC 关闭所有 Toast",_handler:null,install(){if("undefined"==typeof document)return;const e=e=>{"Escape"===e.key&&document.querySelectorAll(".met-toast .met-close").forEach(e=>{try{e.click()}catch(e){}})};this._handler=e,document.addEventListener("keydown",e)},uninstall(){const e=this._handler;e&&"undefined"!=typeof document&&(document.removeEventListener("keydown",e),this._handler=null)}},persistence:{name:"persistence",version:"1.0.0",description:"自动持久化配置到 localStorage",storageKey:"metona-toast-config",install(){if("undefined"!=typeof localStorage)try{const e=this.storageKey,t=localStorage.getItem(e);return t?JSON.parse(t):null}catch(e){return null}return null},save(e){if("undefined"!=typeof localStorage)try{const t=this.storageKey;localStorage.setItem(t,JSON.stringify(e))}catch(e){}},uninstall(){if("undefined"!=typeof localStorage)try{const e=this.storageKey;localStorage.removeItem(e)}catch(e){}const e=this;"function"==typeof e._saveOff&&(e._saveOff(),e._saveOff=null)}},accessibility:{name:"accessibility",version:"1.0.0",description:"通过屏幕阅读器朗读 Toast 内容",announce(e){if("undefined"==typeof document)return;const t=document.createElement("div");t.setAttribute("aria-live","assertive"),t.setAttribute("aria-atomic","true"),t.style.cssText="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;";const n=z(e.type)||e.type;t.textContent=`${n}: ${e.title||""} ${e.message||""}`,document.body.appendChild(t),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t)},3e3)},uninstall(){const e=this;"function"==typeof e._off&&(e._off(),e._off=null)}},dedupe:{name:"dedupe",version:"1.0.0",description:"相同类型和消息的 Toast 自动去重,更新已有实例而非重复弹出",_off:null,install(){const e=ee.on("beforeShow",e=>{const t=Array.from(ee._registry.values()).find(t=>!t.closing&&t.type===e.type&&t.message===e.message);if(t)return t.update({title:e.title||t.title}),!1});this._off=e},uninstall(){const e=this._off;e&&e(),this._off=null}}},ce={createManager:()=>new ae,register:(e,t)=>de.register(e,t),unregister:e=>de.unregister(e),get:e=>de.get(e),has:e=>de.has(e),getAll:()=>de.getAll(),getNames:()=>de.getNames(),enable:e=>de.enable(e),disable:e=>de.disable(e),isEnabled:e=>de.isEnabled(e),getPreset:e=>le[e]||null,getAllPresets:()=>({...le}),createPlugin:e=>({name:e.name||"custom",version:e.version||"1.0.0",description:e.description||"",hooks:e.hooks||{},install:e.install||void 0,uninstall:e.uninstall||void 0,...e}),validatePlugin(e){const t=[];return e&&"object"==typeof e||t.push("Plugin must be an object"),e.name||e.version||t.push("Plugin must have a name or version"),{valid:0===t.length,errors:t}}},de=new ae,he=(e,t="default")=>{const[n,o]=e;return"string"==typeof n?{...o||{},type:o?.type||t,message:n}:n&&"object"==typeof n?{...n,type:n.type||t}:{type:t,message:""}},ge={_toasts:new Map,_config:{...i},version:r,configure(e){return e&&"object"==typeof e?(Object.assign(this._config,e),e.theme&&b(e.theme),e.locale&&E(e.locale),ee.trigger("configChange"),this):this},_emit(e){const t={...this._config,...e};t.content&&!t.message&&(t.message=t.content);const n=new ee(t);return n.create(),null!==n.el&&this._toasts.set(n.id,n),n},_remove(e){this._toasts.delete(e)},find(e){if(e)return this._toasts.get(e)},show(e,t={}){const n=he([e,t],"default");return this._emit(n)},success(e,t={}){const n=he([e,t],"success");return this._emit(n)},error(e,t={}){const n=he([e,t],"error");return this._emit(n)},warning(e,t={}){const n=he([e,t],"warning");return this._emit(n)},info(e,t={}){const n=he([e,t],"info");return this._emit(n)},loading(e,t={}){const n=he([e,t],"loading");n.duration=0,n.closeButton=!1,n.showProgress=!1;const o=this._emit(n);return{id:o.id,success:(e,t={})=>this._resolve(o,"success",e||z("success"),t),error:(e,t={})=>this._resolve(o,"error",e||z("error"),t),info:(e,t={})=>this._resolve(o,"info",e||z("info"),t),warning:(e,t={})=>this._resolve(o,"warning",e||z("warning"),t),update:e=>(o.update(e),this),dismiss:()=>o.close()}},promise(e,t={}){if(!e||"function"!=typeof e.then)return Promise.reject(new Error("Invalid promise"));const n=t.loading||z("loading"),o=t.success||z("success"),r=t.error||z("error"),i=this.loading(n);return Promise.resolve(e).then(e=>(i.success(o),e)).catch(e=>{throw i.error(r),e})},_resolve(e,t,n,o){const r=this._toasts.get(e.id);return r?(r.update({...o,type:t,message:n,duration:o.duration??(r.config.duration||this._config.duration)}),r):null},confirm(e,t={}){return"string"!=typeof e?Promise.resolve(!1):new Promise(n=>{let o=!1;const r=e=>{o||(o=!0,clearTimeout(i),n(e))},i=setTimeout(()=>r(!1),1e4),s=this._emit({...t,type:t.type||"warning",message:e,duration:0,closeButton:!1,closeOnClick:!1,draggable:!1,html:oe(t)});setTimeout(()=>{const e=s.el?.querySelector(".met-confirm-btn"),t=s.el?.querySelector(".met-cancel-btn");e&&e.addEventListener("click",()=>{s.close(),r(!0)}),t&&t.addEventListener("click",()=>{s.close(),r(!1)})},0)})},prompt(e,t={}){return"string"!=typeof e?Promise.resolve(null):new Promise(n=>{let o=!1;const r=e=>{o||(o=!0,clearTimeout(i),n(e))},i=setTimeout(()=>r(null),1e4),s=this._emit({...t,type:t.type||"info",message:e,duration:0,closeButton:!1,closeOnClick:!1,draggable:!1,html:re(t)});setTimeout(()=>{const e=s.el?.querySelector(".met-input"),t=s.el?.querySelector(".met-submit-btn"),n=s.el?.querySelector(".met-cancel-btn");e&&(e.focus(),e.addEventListener("keydown",t=>{"Enter"===t.key&&(s.close(),r(e.value))})),t&&t.addEventListener("click",()=>{s.close(),r(e?.value||null)}),n&&n.addEventListener("click",()=>{s.close(),r(null)})},0)})},progress(e,t={}){const n=he([e,t],"info");n.duration=0,n.closeButton=!1,n.showProgress=!1;const o=this._emit({...n,html:ie(t)});return{id:o.id,setProgress(e){const t=o.el?.querySelector(".met-progress-fill"),n=o.el?.querySelector(".met-progress-text");t&&(t.style.width=`${Math.min(100,Math.max(0,e))}%`),n&&(n.textContent=`${Math.round(e)}%`)},complete(e){this.setProgress(100),setTimeout(()=>{o.update({type:"success",message:e||z("success"),html:""}),setTimeout(()=>o.close(),1e3)},300)},error(e){o.update({type:"error",message:e||z("error"),html:""}),setTimeout(()=>o.close(),2e3)},dismiss(){o.close()}}},countdown(e,t=10,n={}){if("string"!=typeof e)return{id:"",cancel:()=>{},pause:()=>{},resume:()=>{}};let o=Math.max(1,parseInt(String(t))||10),r=null;const i=this._emit({...n,type:n.type||"warning",message:e.replace(/\{seconds\}/g,String(o)),duration:0,closeButton:!0,showProgress:!1}),s=()=>{if(o--,o<=0){if(null!==r&&clearInterval(r),i.close(),"function"==typeof n.onComplete)try{n.onComplete()}catch(e){}}else i.update({message:e.replace(/\{seconds\}/g,String(o))})};return r=setInterval(s,1e3),{id:i.id,cancel(){null!==r&&clearInterval(r),i.close()},pause(){null!==r&&clearInterval(r)},resume(){null!==r&&clearInterval(r),r=setInterval(s,1e3)}}},action(e,t=[],n={}){const o=he([e,n],"info");o.duration=n.duration??0,o.closeButton=n.closeButton??!0;const r=this._emit({...o,html:(o.html||"")+se(t)});return Array.isArray(t)&&setTimeout(()=>{t.forEach((e,t)=>{const n=r.el?.querySelector(`.met-action-btn-${t}`);n&&"function"==typeof e.onClick&&n.addEventListener("click",t=>{t.stopPropagation();try{e.onClick(r)}catch(e){}!1!==e.close&&r.close()})})},0),{id:r.id,toast:r,dismiss:()=>r.close()}},queue(e,t={}){if(!Array.isArray(e)){const e=Promise.resolve();return{then:t=>e.then(t),catch:t=>e.catch(t),cancel:()=>{}}}let n=!1;const o=new Promise(o=>{let r=0;const i=t.delay||1e3,s=t.onClose,a=()=>{if(n||r>=e.length)return void o();const l=e[r];r++;const c="string"==typeof l?l:l?.message||"",d="object"==typeof l&&null!==l?l:{},h=d.onClose;this._emit({...t,...d,message:c,duration:d.duration||t.duration||3e3,onClose:e=>{if("function"==typeof h)try{h(e)}catch(e){}if("function"==typeof s)try{s(e)}catch(e){}setTimeout(a,i)}})};a()});return{then:(e,t)=>o.then(e,t),catch:e=>o.catch(e),cancel:()=>{n=!0}}},stack(e,t={}){Array.isArray(e)&&e.forEach((e,n)=>{setTimeout(()=>{const n="string"==typeof e?e:e?.message||"";this._emit({...t,..."object"==typeof e&&null!==e?e:{},message:n})},n*(t.stagger||100))})},dismiss(e){if(e){const t=this._toasts.get(e);return void(t&&t.close())}this._toasts.forEach(e=>e.close())},removeToast(e){if(!e)return;const t=this._toasts.get(e);t&&t.remove()},clear(e){this._toasts.forEach(t=>{e&&t.config.position!==e||t.close()})},getAll(){return new Map(this._toasts)},count(){return this._toasts.size},group(e){const t=this,n={_group:e};return["show","success","error","warning","info","loading","action"].forEach(o=>{n[o]=(...n)=>{const r=n[n.length-1],i="object"==typeof r&&null!==r&&!Array.isArray(r),s=t;return i&&1===n.length?s[o]({...r,group:e}):i?(n.pop(),s[o](...n,{...r,group:e})):s[o](...n,{group:e})}}),n.dismiss=()=>t.dismissGroup(e),n.count=()=>t._groupCount(e),n},dismissGroup(e){this._toasts.forEach(t=>{t.group===e&&t.close()})},_groupCount(e){let t=0;return this._toasts.forEach(n=>{n.group===e&&t++}),t},getToasts(){return Array.from(this._toasts.values())},hasToasts(){return this._toasts.size>0},getToast(e){return e&&this._toasts.get(e)||null},closeAll(){this._toasts.forEach(e=>e.close())},clearAll(){this._toasts.forEach(e=>e.close())},pauseAll(){this._toasts.forEach(e=>e._pause())},resumeAll(){this._toasts.forEach(e=>e._resume())},updateAll(e){e&&"object"==typeof e&&this._toasts.forEach(t=>t.update(e))},findToasts(e){return"function"!=typeof e?[]:Array.from(this._toasts.values()).filter(e)},findByType(e){return this.findToasts(t=>t.type===e)},findByPosition(e){return this.findToasts(t=>t.config.position===e)},init(e={}){return ee.trigger("beforeInit"),this._destroyed=!1,e.config&&this.configure(e.config),e.theme&&this.themes&&this.themes.switchTheme(e.theme),e.locale&&this.i18n&&this.i18n.switchLocale(e.locale),e.plugins&&Array.isArray(e.plugins)&&e.plugins.forEach(e=>{this.use(e)}),ee.trigger("afterInit"),this},getStatus(){return{version:r,toasts:this._toasts.size,theme:this.themes?.getCurrentTheme?.()||"auto",locale:this.i18n?.getCurrentLocale?.()||"zh-CN",plugins:this.plugins?.getNames?.()||[],animations:this.animations?.getActiveCount?.()||0}},getConfig(){return{...this._config}},updateConfig(e){return e&&"object"==typeof e&&(Object.assign(this._config,e),ee.trigger("configChange")),this},resetConfig(){return Object.keys(this._config).forEach(e=>delete this._config[e]),Object.assign(this._config,i),ee.trigger("configChange"),this},use(e,t={}){if("string"==typeof e){const n=le[e];if(!n)return this;this.plugins.register(e,{...n,...t});const o=this.plugins.get(e);if("accessibility"===e){o&&"function"==typeof o._off&&o._off();const e=n;o&&(o._off=ee.on("afterShow",t=>{"function"==typeof e.announce&&e.announce(t)}))}if("persistence"===e){o&&"function"==typeof o._saveOff&&o._saveOff();const e="function"==typeof n.install?n.install(this.plugins):null;e&&this.configure(e);const t=n;o&&(o._saveOff=ee.on("afterClose",()=>{"function"==typeof t.save&&t.save(this.getConfig())}))}}else e&&"object"==typeof e&&this.plugins.register(e.name||"custom",{...e,...t});return this},destroy(){this._destroyed||(this._destroyed=!0,ee.trigger("beforeDestroy"),this.dismiss(),this.plugins&&"function"==typeof this.plugins.destroy&&this.plugins.destroy(),this.themes&&("function"==typeof this.themes.clearThemeListeners&&this.themes.clearThemeListeners(),"function"==typeof this.themes.unwatchSystemTheme&&this.themes.unwatchSystemTheme()),this.i18n&&"function"==typeof this.i18n.clearLocaleListeners&&this.i18n.clearLocaleListeners(),this.animations&&"function"==typeof this.animations.destroy&&this.animations.destroy(),"undefined"!=typeof document&&(document.querySelectorAll(".met-container").forEach(e=>{e.parentNode&&e.parentNode.removeChild(e)}),["metona-toast-styles","metona-toast-theme-css","metona-toast-custom-styles","metona-toast-anim-styles"].forEach(e=>{const t=document.getElementById(e);t&&t.parentNode&&t.parentNode.removeChild(t)})),this._toasts.clear(),te.clear(),ee._registry.clear(),ee.trigger("afterDestroy"),ee._hooks.clear())},animations:null,themes:null,i18n:null,plugins:null,presetPlugins:{}};ee.setCallbacks({onError:e=>{const t=ge._config.onError;if("function"==typeof t)try{t(e)}catch(e){}},removeToast:e=>{ge._toasts.delete(e)}});const pe={...ge,version:r,animations:Q,themes:j,i18n:W,plugins:ce,presetPlugins:le};if("function"==typeof j.initTheme&&j.initTheme(),"function"==typeof W.initI18n&&W.initI18n(),"function"==typeof j.addThemeListener&&j.addThemeListener(()=>ee.trigger("themeChange")),"function"==typeof W.addLocaleListener&&W.addLocaleListener(()=>ee.trigger("localeChange")),"undefined"!=typeof window){window.MeToast=pe,window.Met=pe;const e=e=>{try{new Notification(e.title||e.type,{body:e.message})}catch(e){}};pe._notify=t=>{"undefined"!=typeof Notification&&"denied"!==Notification.permission&&document.hidden&&("default"!==Notification.permission?e(t):Notification.requestPermission().then(n=>{"granted"===n&&e(t)}))},ee.on("afterShow",e=>{e.config.notifyWhenHidden&&pe._notify(e)})}e.MeToast=pe,e.Met=pe,e.Toast=ee,e.VERSION=r,e.default=pe,e.meToast=pe,Object.defineProperty(e,"__esModule",{value:!0})});