juice-toast 1.4.3 → 1.4.4-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,4 +1,15 @@
1
- ## v1.4.3
1
+ ## v1.4.4 Pack 1 (Beta 2)
2
+ - Fix Parallax, 3D Mode, Promise, & Toast Animation
3
+ - Adding `pauseAll()`, `resumeAll()` & `listActive(filter)`
4
+ - Fix RAF
5
+ - Fix Scheduler
6
+ - Reduce Memory Leak's
7
+
8
+ v1.4.4 Pack 0 (Beta 1)
9
+ - Fix Parallax Mode
10
+ - Experimental **3D Mode** (unstable)
11
+
12
+ v1.4.3
2
13
  - Add Parallax Mode
3
14
  - Fixes Animation
4
15
  - Auto-fecth **Font Awesome** Icons
@@ -1,7 +1,8 @@
1
- Atrosfer License 1.0
2
-
3
- Copyright (c) 2026 Sholehuddin Khairy
4
- All rights reserved.
1
+ ===========================================
2
+ Atrosfer License 1.0
3
+ 2026 (C) OpenDN Foundation
4
+ https://atrosfer.opendnf.cloud/1.0
5
+ ===========================================
5
6
 
6
7
  1. Grant of License:
7
8
  - Permission is hereby granted, free of charge, to any person obtaining a copy
package/README.md CHANGED
@@ -7,13 +7,13 @@
7
7
  ![npm download](https://img.shields.io/npm/dt/juice-toast)
8
8
  ![npm version](https://img.shields.io/npm/v/juice-toast)
9
9
  ![license](https://img.shields.io/npm/l/juice-toast)
10
- ![stars](https://img.shields.io/github/stars/KhairyK/juiceToast)
11
10
  ![issues](https://img.shields.io/github/issues/KhairyK/juiceToast)
12
11
  ![repo size](https://img.shields.io/github/repo-size/KhairyK/juiceToast)
13
12
  ![browser](https://img.shields.io/badge/browser-all%20modern-brightgreen)
14
13
  ![deps](https://img.shields.io/badge/dependencies-0-brightgreen)
15
14
  ![ts](https://img.shields.io/badge/types-TypeScript-blue)
16
15
  ![last commit](https://img.shields.io/github/last-commit/KhairyK/juiceToast)
16
+ [![Socket Badge](https://badge.socket.dev/npm/package/juice-toast/1.4.3)](https://badge.socket.dev/npm/package/juice-toast/1.4.3)
17
17
 
18
18
  ---
19
19
 
@@ -1,46 +1,335 @@
1
- var Ct=Object.defineProperty,Lt=Object.defineProperties,St=Object.getOwnPropertyDescriptors,U=Object.getOwnPropertySymbols,ut=Object.prototype.hasOwnProperty,pt=Object.prototype.propertyIsEnumerable,mt=(e,t,a)=>t in e?Ct(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,Q=(e,t)=>{for(var a in t||(t={}))ut.call(t,a)&&mt(e,a,t[a]);if(U)for(var a of U(t))pt.call(t,a)&&mt(e,a,t[a]);return e},G=(e,t)=>Lt(e,St(t)),Pt=(e,t)=>{var a={};for(var r in e)ut.call(e,r)&&t.indexOf(r)<0&&(a[r]=e[r]);if(e!=null&&U)for(var r of U(e))t.indexOf(r)<0&&pt.call(e,r)&&(a[r]=e[r]);return a};const E=typeof window!="undefined"&&typeof document!="undefined",N=E&&window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;class O{constructor(){this._heap=[]}get size(){return this._heap.length}_parent(t){return Math.floor((t-1)/2)}_left(t){return 2*t+1}_right(t){return 2*t+2}_swap(t,a){[this._heap[t],this._heap[a]]=[this._heap[a],this._heap[t]]}push(t,a=0){const r={item:t,priority:a,seq:O._seq=(O._seq||0)+1};this._heap.push(r),this._siftUp(this._heap.length-1)}pop(){if(!this._heap.length)return null;this._swap(0,this._heap.length-1);const t=this._heap.pop();return this._siftDown(0),t.item}peek(){return this._heap[0]?this._heap[0].item:null}_siftUp(t){for(;t>0;){const a=this._parent(t);if(this._compare(t,a)<=0)break;this._swap(t,a),t=a}}_siftDown(t){for(;;){const a=this._left(t),r=this._right(t),i=this._heap.length;let s=t;if(a<i&&this._compare(a,s)>0&&(s=a),r<i&&this._compare(r,s)>0&&(s=r),s===t)break;this._swap(t,s),t=s}}_compare(t,a){const r=this._heap[t],i=this._heap[a];return r.priority!==i.priority?r.priority-i.priority:r.seq-i.seq}}let Z=!1;const tt=`
2
- /* JuiceToast base (extended) */
3
- #juice-toast-root,[id^="juice-toast-root-"]{position:fixed;z-index:9999;display:flex;pointer-events:none;gap:10px}
4
- #juice-toast-root[data-position="bottom-right"],#juice-toast-root-bottom-right{bottom:20px;right:20px;flex-direction:column-reverse;align-items:flex-end}
5
- #juice-toast-root[data-position="top-right"]{top:20px;right:20px;flex-direction:column;align-items:flex-end}
6
- #juice-toast-root[data-position="bottom-left"]{bottom:20px;left:20px;flex-direction:column-reverse;align-items:flex-start}
7
- #juice-toast-root[data-position="top-left"]{top:20px;left:20px;flex-direction:column;align-items:flex-start}
8
- #juice-toast-root[data-position="top-center"],#juice-toast-root[data-position="bottom-center"]{left:50%;transform:translateX(-50%)}
9
- .juice-toast{pointer-events:auto;min-width:220px;max-width:420px;padding:12px 16px;margin:6px 0;border-radius:10px;background:linear-gradient(180deg,rgba(30,30,30,.95),rgba(20,20,20,.95));color:#fff;display:flex;gap:12px;align-items:flex-start;box-sizing:border-box;transition: transform 0.25s cubic-bezier(0.4,0,0.2,1), opacity 0.28s ease; transform: translate3d(var(--jt-parallax-x,0), var(--jt-parallax-y,0), 0) translateX(var(--jt-drag-x,0)) translateY(var(--jt-drag-y,0)) scale(var(--jt-stack-scale,1));}
10
- @keyframes jt-slide-in{0%{opacity:0;transform:translateY(20px) scale(0.98)}100%{opacity:1;transform:translateY(0) scale(1)}}
11
- @keyframes jt-slide-out{0%{opacity:1;transform:translateY(0) scale(1)}100%{opacity:0;transform:translateY(20px) scale(0.98)}}
12
- @keyframes jt-bounce{0%{transform:translateY(0)}25%{transform:translateY(-6px)}50%{transform:translateY(0)}75%{transform:translateY(-3px)}100%{transform:translateY(0)}}
13
- @keyframes jt-shake{0%{transform:translateX(0)}20%{transform:translateX(-6px)}40%{transform:translateX(6px)}60%{transform:translateX(-4px)}80%{transform:translateX(2px)}100%{transform:translateX(0)}}
14
- @keyframes jt-pulse{0%{transform:scale(1)}50%{transform:scale(1.02)}100%{transform:scale(1)}}
15
- @keyframes jt-spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}
16
- .juice-toast.show{animation:jt-slide-in .32s cubic-bezier(0.4,0,0.2,1) forwards;opacity:1}
17
- .juice-toast.hide{animation:jt-slide-out .28s cubic-bezier(0.4,0,0.2,1) forwards;opacity:0;pointer-events:none}
18
- .juice-toast .icon{width:30px;height:30px;display:inline-flex;align-items:center;justify-content:center;border-radius:8px;background:rgba(255,255,255,.06)}
19
- .jt-content{display:flex;flex-direction:column;gap:4px;flex:1;min-width:0}
20
- .jt-title{font-weight:700;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
21
- .jt-message{font-size:13px;opacity:.95;word-break:break-word}
22
- .jt-actions{display:flex;gap:8px;margin-top:10px}
23
- .jt-action{border:1px solid currentColor;padding:4px 10px;border-radius:6px;font-size:12px;cursor:pointer;background:transparent}
24
- .jt-progress{position:absolute;left:0;bottom:0;height:4px;width:100%;border-radius:2px;background:linear-gradient(90deg,#4ade80,#22c55e);transform-origin:left;transform:scaleX(1);transition:transform linear}
25
- .juice-toast.swipe-dismissing {opacity: 0; transition: transform 0.22s ease-out, opacity 0.22s ease-out;}
26
- .jt-avatar{width:36px;height:36px;border-radius:50%;object-fit:cover;flex-shrink:0}
27
-
28
- /* avatar top variant */
29
- .juice-toast.jt-avatar-top{flex-direction:column;align-items:flex-start}
30
-
31
- /* modal */
1
+ var ke=Object.defineProperty,we=Object.defineProperties,Se=Object.getOwnPropertyDescriptors,W=Object.getOwnPropertySymbols,pe=Object.prototype.hasOwnProperty,he=Object.prototype.propertyIsEnumerable,me=(e,a,t)=>a in e?ke(e,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[a]=t,se=(e,a)=>{for(var t in a||(a={}))pe.call(a,t)&&me(e,t,a[t]);if(W)for(var t of W(a))he.call(a,t)&&me(e,t,a[t]);return e},ne=(e,a)=>we(e,Se(a)),Le=(e,a)=>{var t={};for(var l in e)pe.call(e,l)&&a.indexOf(l)<0&&(t[l]=e[l]);if(e!=null&&W)for(var l of W(e))a.indexOf(l)<0&&he.call(e,l)&&(t[l]=e[l]);return t};const P=typeof window!="undefined"&&typeof document!="undefined",D=P&&window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;class H{constructor(){this._heap=[]}get size(){return this._heap.length}_parent(a){return Math.floor((a-1)/2)}_left(a){return 2*a+1}_right(a){return 2*a+2}_swap(a,t){[this._heap[a],this._heap[t]]=[this._heap[t],this._heap[a]]}push(a,t=0){const l={item:a,priority:t,seq:H._seq=(H._seq||0)+1};this._heap.push(l),this._siftUp(this._heap.length-1)}pop(){if(!this._heap.length)return null;this._swap(0,this._heap.length-1);const a=this._heap.pop();return this._siftDown(0),a.item}peek(){return this._heap[0]?this._heap[0].item:null}_siftUp(a){for(;a>0;){const t=this._parent(a);if(this._compare(a,t)<=0)break;this._swap(a,t),a=t}}_siftDown(a){for(;;){const t=this._left(a),l=this._right(a),i=this._heap.length;let r=a;if(t<i&&this._compare(t,r)>0&&(r=t),l<i&&this._compare(l,r)>0&&(r=l),r===a)break;this._swap(a,r),a=r}}_compare(a,t){const l=this._heap[a],i=this._heap[t];return l.priority!==i.priority?l.priority-i.priority:i.seq-l.seq}}let fe=!1;const Q=`
2
+ :root{
3
+ --jt-radius:10px;
4
+ --jt-bg1:rgba(30,30,30,.95);
5
+ --jt-bg2:rgba(20,20,20,.95);
6
+ --jt-gap:10px;
7
+ }
8
+
9
+ /* ROOT \u2014 use data attribute for flexibility */
10
+ [data-juice-root]{
11
+ position:fixed;
12
+ z-index:9999;
13
+ display:flex;
14
+ pointer-events:none;
15
+ gap:var(--jt-gap);
16
+ perspective:800px;
17
+ }
18
+
19
+ /* POSITIONS */
20
+
21
+ [data-juice-root][data-position="bottom-right"]{
22
+ bottom:20px;
23
+ right:20px;
24
+ flex-direction:column-reverse;
25
+ align-items:flex-end;
26
+ }
27
+
28
+ [data-juice-root][data-position="top-right"]{
29
+ top:20px;
30
+ right:20px;
31
+ flex-direction:column;
32
+ align-items:flex-end;
33
+ }
34
+
35
+ [data-juice-root][data-position="bottom-left"]{
36
+ bottom:20px;
37
+ left:20px;
38
+ flex-direction:column-reverse;
39
+ align-items:flex-start;
40
+ }
41
+
42
+ [data-juice-root][data-position="top-left"]{
43
+ top:20px;
44
+ left:20px;
45
+ flex-direction:column;
46
+ align-items:flex-start;
47
+ }
48
+
49
+ [data-juice-root][data-position="top-center"]{
50
+ top:20px;
51
+ left:50%;
52
+ transform:translateX(-50%);
53
+ }
54
+
55
+ [data-juice-root][data-position="bottom-center"]{
56
+ bottom:20px;
57
+ left:50%;
58
+ transform:translateX(-50%);
59
+ }
60
+
61
+ /* TOAST */
62
+
63
+ .juice-toast{
64
+ pointer-events:auto;
65
+ min-width:220px;
66
+ max-width:420px;
67
+ padding:12px 16px;
68
+ margin:6px 0;
69
+ border-radius:var(--jt-radius);
70
+ background:linear-gradient(180deg,var(--jt-bg1),var(--jt-bg2));
71
+ color:#fff;
72
+ display:flex;
73
+ gap:12px;
74
+ align-items:flex-start;
75
+ box-sizing:border-box;
76
+
77
+ transform:
78
+ translate3d(var(--jt-parallax-x,0),var(--jt-parallax-y,0),var(--jt-parallax-z,0))
79
+ translateY(var(--jt-stack-y,0))
80
+ translateX(var(--jt-drag-x,0))
81
+ translateY(var(--jt-drag-y,0))
82
+ rotateX(var(--jt-rot-x,0))
83
+ rotateY(var(--jt-rot-y,0))
84
+ scale(var(--jt-stack-scale,1));
85
+
86
+ transform-style:preserve-3d;
87
+ transition:transform .25s cubic-bezier(.4,0,.2,1),opacity .28s ease;
88
+ will-change:transform,opacity;
89
+ }
90
+
91
+ /* STACK DEPTH FEATURE */
92
+
93
+ .juice-toast[data-stack="1"]{--jt-stack-scale:.97;opacity:.95}
94
+ .juice-toast[data-stack="2"]{--jt-stack-scale:.94;opacity:.9}
95
+ .juice-toast[data-stack="3"]{--jt-stack-scale:.91;opacity:.85}
96
+
97
+ /* SHOW/HIDE */
98
+
99
+ @keyframes jt-slide-in{
100
+ from{opacity:0;transform:translateY(20px) scale(.98)}
101
+ to{opacity:1;transform:translateY(0) scale(1)}
102
+ }
103
+
104
+ @keyframes jt-slide-out{
105
+ from{opacity:1;transform:translateY(0) scale(1)}
106
+ to{opacity:0;transform:translateY(20px) scale(.98)}
107
+ }
108
+
109
+ .juice-toast.show{
110
+ animation:jt-slide-in .32s cubic-bezier(.4,0,.2,1) forwards;
111
+ }
112
+
113
+ .juice-toast.hide{
114
+ animation:jt-slide-out .28s cubic-bezier(.4,0,.2,1) forwards;
115
+ pointer-events:none;
116
+ }
117
+
118
+ /* MICRO ANIMATIONS */
119
+
120
+ @keyframes jt-bounce{
121
+ 0%,100%{transform:translateY(0)}
122
+ 50%{transform:translateY(-6px)}
123
+ }
124
+
125
+ @keyframes jt-shake{
126
+ 0%,100%{transform:translateX(0)}
127
+ 25%{transform:translateX(-6px)}
128
+ 75%{transform:translateX(6px)}
129
+ }
130
+
131
+ @keyframes jt-pulse{
132
+ 0%,100%{transform:scale(1)}
133
+ 50%{transform:scale(1.03)}
134
+ }
135
+
136
+ @keyframes jt-spin{
137
+ from{transform:rotate(0deg)}
138
+ to{transform:rotate(360deg)}
139
+ }
140
+
141
+ .jt-spin{animation:jt-spin 1.5s linear infinite}
142
+ .jt-pulse{animation:jt-pulse 1.2s ease-in-out}
143
+
144
+ /* ICON */
145
+
146
+ .juice-toast .icon{
147
+ width:30px;
148
+ height:30px;
149
+ display:flex;
150
+ align-items:center;
151
+ justify-content:center;
152
+ border-radius:8px;
153
+ background:rgba(255,255,255,.06);
154
+ }
155
+
156
+ /* CONTENT */
157
+
158
+ .jt-content{
159
+ display:flex;
160
+ flex-direction:column;
161
+ gap:4px;
162
+ flex:1;
163
+ min-width:0;
164
+ }
165
+
166
+ .jt-title{
167
+ font-weight:700;
168
+ font-size:13px;
169
+ white-space:nowrap;
170
+ overflow:hidden;
171
+ text-overflow:ellipsis;
172
+ }
173
+
174
+ .jt-message{
175
+ font-size:13px;
176
+ opacity:.95;
177
+ word-break:break-word;
178
+ }
179
+
180
+ /* ACTIONS */
181
+
182
+ .jt-actions{
183
+ display:flex;
184
+ gap:8px;
185
+ margin-top:10px;
186
+ }
187
+
188
+ .jt-action{
189
+ border:1px solid currentColor;
190
+ padding:4px 10px;
191
+ border-radius:6px;
192
+ font-size:12px;
193
+ cursor:pointer;
194
+ background:transparent;
195
+ }
196
+
197
+ /* PROGRESS */
198
+
199
+ .jt-progress{
200
+ position:absolute;
201
+ left:0;
202
+ bottom:0;
203
+ height:4px;
204
+ width:100%;
205
+ border-radius:2px;
206
+ background:linear-gradient(90deg,#4ade80,#22c55e);
207
+ transform-origin:left;
208
+ transform:scaleX(1);
209
+ transition:transform linear;
210
+ }
211
+
212
+ /* SWIPE */
213
+
214
+ .juice-toast.swipe-dismissing{
215
+ opacity:0;
216
+ transition:transform .22s ease-out,opacity .22s ease-out;
217
+ }
218
+
219
+ /* AVATAR */
220
+
221
+ .jt-avatar{
222
+ width:36px;
223
+ height:36px;
224
+ border-radius:50%;
225
+ object-fit:cover;
226
+ flex-shrink:0;
227
+ }
228
+
229
+ .juice-toast.jt-avatar-top{
230
+ flex-direction:column;
231
+ align-items:flex-start;
232
+ }
233
+
234
+ /* MODAL */
235
+
32
236
  .jt-modal-overlay{
33
- position:fixed;inset:0;display:flex;align-items:center;justify-content:center;padding:20px;background:rgba(15,23,42,.55);backdrop-filter:blur(6px) saturate(120%);-webkit-backdrop-filter:blur(6px) saturate(120%);opacity:0;transition:opacity .25s ease;z-index:10000;
237
+ position:fixed;
238
+ inset:0;
239
+ display:flex;
240
+ align-items:center;
241
+ justify-content:center;
242
+ padding:20px;
243
+ background:rgba(15,23,42,.55);
244
+ backdrop-filter:blur(6px) saturate(120%);
245
+ opacity:0;
246
+ transition:opacity .25s ease;
247
+ z-index:10000;
34
248
  }
249
+
35
250
  .jt-modal-overlay.show{opacity:1}
36
- .jt-modal{width:100%;max-width:520px;border-radius:18px;padding:24px;opacity:0;transform:translateY(40px) scale(.96);transition:transform .35s cubic-bezier(.16,1,.3,1),opacity .25s ease;}
37
- .jt-modal.show{opacity:1;transform:translateY(0) scale(1)}
38
- .jt-modal-header{font-size:18px;font-weight:600;letter-spacing:.3px;margin-bottom:10px}
39
- .jt-modal-body{font-size:14.5px;line-height:1.6;opacity:.85;margin-bottom:22px}
40
- .jt-modal-actions{display:flex;justify-content:flex-end;gap:12px}
41
- .jt-modal-btn{min-width:88px;padding:8px 16px;border-radius:12px;font-size:13.5px;font-weight:500;cursor:pointer;transition:all .2s ease;border:1px solid rgba(255,255,255,.08);background:rgba(255,255,255,.04);color:inherit}
42
- .jt-modal-btn:hover{background:rgba(255,255,255,.08);transform:translateY(-1px)}
43
- .jt-modal-btn.primary{background:#6366f1;border-color:#6366f1;color:#fff}
44
- #juice-toast-root[data-parallax="true"] .juice-toast{transition: transform 0.12s cubic-bezier(.2,.8,.2,1), opacity .2s}
45
- `;function ht(e=tt){if(!E||Z)return;if(document.getElementById("juice-toast-style")){Z=!0;return}const t=document.createElement("style");t.id="juice-toast-style",t.textContent=e,document.head.appendChild(t),Z=!0}const et=(()=>{let e=1;return()=>"jt-"+e++})();function _(){return Date.now()}function I(e,t){return Object.assign({},e||{},t||{})}function at(e,t,a){return Math.max(t,Math.min(a,e))}function $(e){if(!e)return"";const t=document.createElement("template");t.innerHTML=e,t.content.querySelectorAll("script, style, iframe").forEach(r=>r.remove());const a=["b","i","u","strong","em","code","pre","ul","ol","li","br","p","span","img","h1","h2","h3","h4","h5","h6","a"];return(function r(i){Array.from(i.childNodes).forEach(s=>{if(s.nodeType===1){const u=s.tagName.toLowerCase();a.includes(u)?(Array.from(s.attributes||[]).forEach(b=>{const p=b.name.toLowerCase(),m=b.value||"";(p.startsWith("on")||(p==="href"||p==="src"||p==="xlink:href")&&m.trim().toLowerCase().startsWith("javascript:")||u==="img"&&p==="srcset")&&s.removeAttribute(b.name)}),r(s)):s.replaceWith(...Array.from(s.childNodes))}})})(t.content),t.innerHTML}const z={dark:{bg:"linear-gradient(180deg,#1f2937,#111827)",color:"#fff",border:"1px solid rgba(255,255,255,.06)"},light:{bg:"#fff",color:"#111",border:"1px solid #e5e7eb"},glass:{bg:"rgba(30,30,30,.35)",color:"#fff",border:"1px solid rgba(255,255,255,.1)"}},ft={sm:{width:"260px",padding:"10px"},md:{width:"320px",padding:"14px"},lg:{width:"420px",padding:"18px"}},Mt={success:"jt-bounce",error:"jt-shake",warning:"jt-shake",info:"jt-pulse",loading:"jt-spin"},k={_defaults:{duration:2500,maxVisible:3,swipeThreshold:60,glassUI:0,playSound:null,dev:!1,injectCSS:!0,css:null,autoDedupe:!1,maxVisiblePerType:{},parallaxMode:!1,autoFetchFA:!0},_config:{},_theme:"dark",_plugins:[],_queue:new O,_queueDedupe:new Set,_activeMap:new Map,_roots:new Map,_modalStack:[],_faInjected:!1,setup(e={}){const t=e,{duration:a,maxVisible:r}=t,i=Pt(t,["duration","maxVisible"]);typeof a=="number"&&(this._defaults.duration=a),typeof r=="number"&&(this._defaults.maxVisible=r),typeof e.autoDedupe=="boolean"&&(this._defaults.autoDedupe=e.autoDedupe),e.maxVisiblePerType&&(this._defaults.maxVisiblePerType=I(this._defaults.maxVisiblePerType,e.maxVisiblePerType)),typeof e.parallaxMode=="boolean"&&(this._defaults.parallaxMode=e.parallaxMode),typeof e.autoFetchFA=="boolean"&&(this._defaults.autoFetchFA=e.autoFetchFA),this._config=I(this._config,i),this._registerTypes()},use(e){typeof e=="function"&&this._plugins.push(e)},addType(e,t={}){this._config[e]=t,this._registerTypes()},defineTheme(e,t={}){z[e]=I(z[e]||{},t)},setTheme(e){this._theme=e,E&&this._roots.forEach(t=>t.dataset.theme=e)},clear(){this._queue=new O,this._queueDedupe.clear()},destroy(){this.clear(),E&&(this._roots.forEach(e=>{try{e.remove()}catch(t){}}),this._roots.clear())},promise(e,t={}){if(!e||typeof e.then!="function"){this._warn("promise expects a Promise");return}const a={id:et()}.id,r=t.timeout;this._enqueue("loading",G(Q({},Tt(t.loading,"Loading...")),{groupId:a,duration:0}));let i=null;r&&(i=setTimeout(()=>{this._enqueue("error",{message:t.timeoutMessage||"Request timeout",groupId:a}),s()},r));const s=()=>{i&&clearTimeout(i)};return e.then(u=>{s(),this._enqueue("success",G(Q({},yt(t.success,u,"Success")),{groupId:a}))}).catch(u=>{s(),this._enqueue("error",G(Q({},yt(t.error,u,"Error")),{groupId:a}))}),{cancel:()=>{this._enqueue("info",{message:t.cancelMessage||"Cancelled",groupId:a}),i&&clearTimeout(i)}}},modal(e={}){var t;if(!E)return;this._defaults.injectCSS!==!1&&ht(this._defaults.css||tt);const a=I({title:"",message:"",html:null,block:!0,blur:!0,closeOnOverlay:!0,closable:!0,animation:"scale",actions:[],theme:this._theme},e),r=z[a.theme]||z.dark,i=document.createElement("div");i.className="jt-modal-overlay",a.block?i.style.pointerEvents="all":i.style.pointerEvents="none",a.blur||(i.style.backdropFilter="none",i.style.webkitBackdropFilter="none");const s=document.createElement("div");if(s.className=`jt-modal jt-anim-${a.animation}`,s.style.background=r.bg,s.style.color=r.color,s.style.border=r.border||"none",a.title){const m=document.createElement("div");m.className="jt-modal-header",m.textContent=a.title,s.appendChild(m)}const u=document.createElement("div");if(u.className="jt-modal-body",a.html?u.innerHTML=$(a.html):u.textContent=a.message||"",s.appendChild(u),(t=a.actions)!=null&&t.length){const m=document.createElement("div");m.className="jt-modal-actions",a.actions.forEach(f=>{const j=document.createElement("button");j.className="jt-modal-btn"+(f.primary?" primary":""),j.textContent=f.label||"OK",j.onclick=S=>{var P;S.stopPropagation(),(P=f.onClick)==null||P.call(f,S),f.closeOnClick!==!1&&p()},m.appendChild(j)}),s.appendChild(m)}i.appendChild(s),document.body.appendChild(i),this._modalStack.push(i),a.block&&(document.body.style.overflow="hidden"),requestAnimationFrame(()=>{i.classList.add("show"),s.classList.add("show")});const b=m=>{m.key==="Escape"&&p()};a.closable&&(a.closeOnOverlay&&i.addEventListener("click",m=>{m.target===i&&p()}),document.addEventListener("keydown",b));const p=()=>{i.classList.remove("show"),s.classList.remove("show"),setTimeout(()=>{try{i.remove()}catch(f){}a.block&&(document.body.style.overflow=""),document.removeEventListener("keydown",b);const m=this._modalStack.indexOf(i);m>=0&&this._modalStack.splice(m,1)},300)};return{close:p}},_registerTypes(){Object.keys(this._config).forEach(e=>{if(typeof this[e]=="function"&&!this[e].__auto)return;const t=a=>this._enqueue(e,a);t.__auto=!0,this[e]=t})},_enqueue(e,t={}){var a,r;const i=typeof t.priority=="number"?t.priority:(r=(a=this._priorityMap)==null?void 0:a[t.priority])!=null?r:2,s=t.dedupeKey||(this._defaults.autoDedupe?this._computeDedupeKey(e,t):void 0);if(s&&this._queueDedupe.has(s)){this._defaults.dev&&console.log("[JuiceToast] deduped (queue)",s);return}const u={id:et(),type:e,payload:t,priority:i};return s&&this._queueDedupe.add(s),this._queue.push(u,i),this._processQueue(),u.id},_processQueue(){var e;if(!E)return;const t=this._defaults.maxVisible;for(;this._queue.size>0;){const a=this._queue.pop();if(!a)break;const r=((e=a.payload)==null?void 0:e.position)||"bottom-right",i=this._getRoot(r);if(!i)break;if(Array.from(i.children).length>=t){this._queue.push(a,a.priority-.001);break}const s=(this._defaults.maxVisiblePerType||{})[a.type];if(typeof s=="number"&&Array.from(i.children).filter(u=>u.dataset.toastType===a.type).length>=s){this._queue.push(a,a.priority-.001);break}this._showToast(a.type,a.payload,a.id)}},_getRoot(e="bottom-right"){if(!E)return null;if(this._roots.has(e))return this._roots.get(e);const t=document.createElement("div");switch(t.id=`juice-toast-root-${e}`,t.dataset.position=e,t.dataset.theme=this._theme,t.style.pointerEvents="none",t.style.display="flex",t.style.flexDirection="column",this._defaults.parallaxMode&&(t.dataset.parallax="true"),e){case"top-left":t.style.top="20px",t.style.left="20px";break;case"top-right":t.style.top="20px",t.style.right="20px";break;case"bottom-left":t.style.bottom="20px",t.style.left="20px";break;case"bottom-right":t.style.bottom="20px",t.style.right="20px";break;case"top-center":t.style.top="20px",t.style.left="50%",t.style.transform="translateX(-50%)";break;case"bottom-center":t.style.bottom="20px",t.style.left="50%",t.style.transform="translateX(-50%)";break;default:t.style.bottom="20px",t.style.right="20px"}if(document.body.appendChild(t),this._defaults.parallaxMode){const a=r=>{const i=t.getBoundingClientRect(),s=i.left+i.width/2,u=i.top+i.height/2,b=r.touches?r.touches[0].clientX:r.clientX,p=r.touches?r.touches[0].clientY:r.clientY;Array.from(t.children).forEach((m,f)=>{const j=(f+1)/Math.max(1,t.children.length),S=at((b-s)/i.width*j*8,-12,12),P=at((p-u)/i.height*j*6,-10,10);m.style.setProperty("--jt-parallax-x",`${S}px`),m.style.setProperty("--jt-parallax-y",`${P}px`)})};t._parallaxHandler=a,t.addEventListener("mousemove",a),t.addEventListener("touchmove",a,{passive:!0}),t.dataset.parallax="true"}return this._roots.set(e,t),t},_warn(e){this._defaults.dev&&typeof console!="undefined"&&console.warn("[JuiceToast]",e)},_ensureFA(){if(!(!E||this._faInjected||!this._defaults.autoFetchFA)){if(document.querySelector('link[href*="fontawesome"], link[href*="font-awesome"], link[href*="cdnjs.cloudflare.com/ajax/libs/font-awesome"]')){this._faInjected=!0;return}try{const e=document.createElement("link");e.rel="stylesheet",e.href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css",e.crossOrigin="anonymous",document.head.appendChild(e),this._faInjected=!0}catch(e){console.error("[JuiceToast]: Fetching icons failed:",e)}}},_playSound(e){if(!E)return;const t=typeof e=="string"&&e?e:this._defaults.playSound;if(t)try{const a=new Audio(t);a.volume=.6,a.play().catch(()=>{})}catch(a){}},_updateStackPositionsFor(e){const t=Array.from(e.children);e.dataset.position&&e.dataset.position.includes("bottom"),t.forEach((a,r)=>{const i=r,s=i*12;a.style.setProperty("--jt-stack-y",`-${s}px`),a.style.setProperty("--jt-stack-scale",1-i*.04),a.style.setProperty("--jt-stack-opacity",1-i*.12),a.style.zIndex=1e3-i})},_runPlugins(e){this._plugins.forEach(t=>{try{t(e)}catch(a){this._warn("Plugin error: "+((a==null?void 0:a.message)||a))}})},_normalizeGlass(e){if(e===!0)return 60;if(!e)return 0;const t=Number(e);return Number.isFinite(t)?at(t,0,100):0},_computeDedupeKey(e,t){try{const a=e||"",r=t.title||"",i=t.message||t.html||"";return`${a}::${String(r).trim().slice(0,200)}::${String(i).trim().slice(0,500)}`}catch(a){return}},_showToast(e,t={},a){var r,i,s,u,b,p,m,f,j,S,P,ot,st,nt,rt;if(!E)return;this._defaults.injectCSS!==!1&&ht(this._defaults.css||tt),this._ensureFA();const gt=this._config[e]||{},bt=typeof t=="object"?t:{message:String(t)},o=I(gt,bt);o.icon=(r=o.icon)!=null?r:o.icon_left_top,o.position=(s=(i=o.position)!=null?i:o.toast)!=null?s:"bottom-right",o.closable=(b=(u=o.closable)!=null?u:o.closeable)!=null?b:!0,o.duration=typeof o.duration=="number"?o.duration:this._defaults.duration;const X=z[o.theme||this._theme]||{},x=a||et(),D=o.dedupeKey||(this._defaults.autoDedupe?this._computeDedupeKey(e,o):void 0);if(D)for(const l of this._roots.values()){const c=Array.from(l.children).find(g=>g.dataset.dedupeKey===D);if(c){let g=c.querySelector(".jt-count");if(g||(g=document.createElement("span"),g.className="jt-count",g.style.marginLeft="6px",(p=c.querySelector(".jt-title"))==null||p.appendChild(g),g.textContent="1"),g.textContent=String(parseInt(g.textContent||"1")+1),o.mergeMessage){const v=c.querySelector(".jt-message");v&&(o.html?v.innerHTML=$(o.html):v.textContent=String(o.message||""))}return c.dataset.toastId}}const n=document.createElement("div");if(n.className="juice-toast",n.dataset.toastId=x,n.dataset.position=o.position,n.dataset.toastType=e,D&&(n.dataset.dedupeKey=D),n.tabIndex=0,n.setAttribute("role","status"),n.style.position="relative",n.style.pointerEvents="auto",n.style.background=o.bg||X.bg,n.style.color=o.color||X.color,n.style.border=o.border||X.border||"none",n.style.minHeight=n.style.minHeight||"",n.style.setProperty("--jt-parallax-x","0px"),n.style.setProperty("--jt-parallax-y","0px"),n.style.setProperty("--jt-drag-x","0px"),n.style.setProperty("--jt-drag-y","0px"),n.style.setProperty("--jt-stack-scale","1"),o.size&&ft[o.size]){const l=ft[o.size];l.width&&(n.style.width=l.width),l.padding&&(n.style.padding=l.padding)}const w=document.createElement("div");if(w.className="jt-content",o.title){const l=document.createElement("div");l.className="jt-title",l.textContent=o.title,w.appendChild(l)}const T=document.createElement("div");if(T.className="jt-message",o.html?T.innerHTML=$(o.html):typeof o.message=="string"?o.message.split(/(`[^`]+`)/g).forEach(l=>{if(l.startsWith("`")&&l.endsWith("`")){const c=document.createElement("code");c.textContent=l.slice(1,-1),T.appendChild(c)}else T.appendChild(document.createTextNode(l))}):o.message&&(T.textContent=String(o.message)),w.appendChild(T),Array.isArray(o.actions)&&o.actions.length){const l=document.createElement("div");l.className="jt-actions",o.actions.forEach(c=>{const g=document.createElement("button");g.className="jt-action",g.textContent=c.label||"Action",g.onclick=v=>{var F;v.stopPropagation(),(F=c.onClick)==null||F.call(c,v),c.closeOnClick&&this.remove(x)},l.appendChild(g)}),w.appendChild(l)}o.bgImage?(n.style.backgroundImage=`url(${o.bgImage})`,n.style.backgroundSize=o.bgSize||"cover",n.style.backgroundPosition=o.bgPosition||"center"):n.style.background=o.bg||X.bg;let y=null;if(o.icon){y=document.createElement("i");const l=o.icon.startsWith("fa")?o.icon:`fa-${o.icon}`;if(y.className=["icon",o.iconPack||"",l].join(" ").trim(),o.iconSize&&(y.style.fontSize=o.iconSize),!N){const c=o.iconAnim||Mt[e];c&&y.classList.add(c)}(o.iconLink||o.iconAnimate)&&(y.classList.add("icon-clickable"),y.addEventListener("click",c=>{c.stopPropagation(),o.iconAnimate&&(y.classList.remove(o.iconAnimate),y.offsetWidth,y.classList.add(o.iconAnimate)),o.iconLink&&window.open(o.iconLink,"_blank","noopener")}))}let h=null;if(o.avatar){h=document.createElement("img");const l=typeof o.avatar=="string"&&o.avatar?o.avatar:o.avatarSrc||"";l&&(h.src=l),h.alt=o.avatarAlt||o.title||"avatar",h.className="jt-avatar",h.loading=o.avatarLazy?"lazy":"eager",h.style.width=h.style.width||"36px",h.style.height=h.style.height||"36px",h.style.borderRadius=h.style.borderRadius||"50%",h.style.objectFit=h.style.objectFit||"cover",h.style.flexShrink="0";const c=o.avatarPosition||"left";c==="left"?h.style.marginRight=(m=o.avatarSpacing)!=null?m:"10px":c==="right"?h.style.marginLeft=(f=o.avatarSpacing)!=null?f:"10px":c==="top"&&(h.style.marginBottom=(j=o.avatarSpacing)!=null?j:"8px")}const V=o.avatarPosition||"left";h&&V==="top"?(n.classList.add("jt-avatar-top"),n.style.flexDirection="column",n.style.alignItems="flex-start",n.appendChild(h),y&&o.iconPosition==="top"?(n.appendChild(y),n.appendChild(w)):y&&o.iconPosition==="right"?(n.appendChild(w),n.appendChild(y)):(y&&n.appendChild(y),n.appendChild(w))):(n.style.flexDirection="row",n.style.alignItems="center",h&&V==="left"&&n.appendChild(h),y&&o.iconPosition==="right"?(n.appendChild(w),n.appendChild(y)):y&&o.iconPosition==="top"?(n.classList.add("jt-icon-top"),n.appendChild(y),n.appendChild(w)):(y&&n.appendChild(y),n.appendChild(w)),h&&V==="right"&&n.appendChild(h));let q=null;if(o.progress&&((S=o.duration)!=null?S:this._defaults.duration)>0&&(q=document.createElement("div"),q.className="jt-progress",o.progressColor&&(q.style.background=o.progressColor),n.appendChild(q)),o.undo){const l=document.createElement("button");l.className="jt-action",l.textContent="Undo",l.onclick=()=>{try{o.undo()}catch(c){}this.remove(x)},w.appendChild(l)}if(o.closable){const l=document.createElement("span");l.className="juice-toast-close",l.tabIndex=0,l.textContent="\xD7",l.style.marginLeft="8px",l.addEventListener("click",c=>{c.stopPropagation(),this.remove(x)}),n.appendChild(l)}const C=this._getRoot(o.position||"bottom-right");if(!C)return;if(o.groupId){const l=Array.from(C.children).find(c=>c.dataset.groupId===o.groupId);if(l){let c=l.querySelector(".jt-count");c||(c=document.createElement("span"),c.className="jt-count",c.style.marginLeft="6px",(P=l.querySelector(".jt-title"))==null||P.appendChild(c),c.textContent="1"),c.textContent=String(parseInt(c.textContent||"1")+1);return}n.dataset.groupId=o.groupId}const it=this._defaults.maxVisible;it&&C.children.length>=it&&C.removeChild(C.firstElementChild),C.appendChild(n);const d={id:x,toast:n,cfg:o,type:e,createdAt:_(),remaining:(ot=o.duration)!=null?ot:this._defaults.duration,raf:null,timer:null,start:_(),paused:!1,_boundMove:null,_boundUp:null,_onPointerDown:null,_onEnter:null,_onLeave:null,dedupeKey:D,hooks:{onShow:o.onShow,onShown:o.onShown,onClose:o.onClose,onRemoved:o.onRemoved}};this._activeMap.set(x,d);try{(nt=(st=d.hooks).onShow)==null||nt.call(st,{id:x,toast:n,cfg:o,type:e})}catch(l){}this._runPlugins({toast:n,cfg:o,type:e,root:C,meta:d}),this._updateStackPositionsFor(C),requestAnimationFrame(()=>{var l,c;N?(n.style.opacity="1",(c=(l=d.hooks).onShown)==null||c.call(l,{id:x,toast:n,cfg:o,type:e})):(n.classList.add("show"),setTimeout(()=>{var g,v;try{(v=(g=d.hooks).onShown)==null||v.call(g,{id:x,toast:n,cfg:o,type:e})}catch(F){}},320))});let lt=0,ct=0,L=0,A=0,K=!1,M=null,R=0;const H=l=>{const c=l.touches?l.touches[0]:l;lt=c.clientX,ct=c.clientY,L=0,A=0,K=!0,M=null,d.paused=!0,d.raf&&(cancelAnimationFrame(d.raf),d.raf=null),n.style.transition="none",d._boundMove=xt,d._boundUp=_t,document.addEventListener("touchmove",d._boundMove,{passive:!0}),document.addEventListener("mousemove",d._boundMove),document.addEventListener("touchend",d._boundUp),document.addEventListener("mouseup",d._boundUp),R=_()},xt=l=>{if(!K)return;const c=l.touches?l.touches[0]:l;L=c.clientX-lt,A=c.clientY-ct,M||(Math.abs(L)>6?M="x":Math.abs(A)>6&&(M="y")),M==="x"?n.style.setProperty("--jt-drag-x",`${L}px`):M==="y"&&n.style.setProperty("--jt-drag-y",`${A}px`),R=_(),c.clientX},_t=l=>{K=!1,d.paused=!1;const c=Math.abs(L),g=Math.abs(A),v=M||(c>g?"x":"y"),F=Math.max(1,_()-R),jt=F?L/F*1e3:0,wt=v==="x"&&(c>(k._defaults.swipeThreshold||60)||Math.abs(jt)>800),kt=v==="y"&&g>(k._defaults.swipeThreshold||80);if(wt||kt){const Et=L>=0?1:-1;v==="x"?n.style.setProperty("--jt-drag-x",`${Et*1e3}px`):n.style.setProperty("--jt-drag-y","1000px"),n.classList.add("swipe-dismissing"),setTimeout(()=>this.remove(x),220)}else n.style.transition="transform 0.22s ease-out, opacity 0.22s ease-out",n.style.setProperty("--jt-drag-x","0px"),n.style.setProperty("--jt-drag-y","0px");L=A=0,d._boundMove&&(document.removeEventListener("touchmove",d._boundMove),document.removeEventListener("mousemove",d._boundMove),d._boundMove=null),d._boundUp&&(document.removeEventListener("touchend",d._boundUp),document.removeEventListener("mouseup",d._boundUp),d._boundUp=null),J()};n._onPointerDown=H,n.addEventListener("touchstart",H,{passive:!0}),n.addEventListener("mousedown",H);const W=()=>{d.paused=!0,d.raf&&(cancelAnimationFrame(d.raf),d.raf=null)},B=()=>{d.paused&&(d.paused=!1,d.start=_(),J())};d._onEnter=W,d._onLeave=B,n.addEventListener("mouseenter",W),n.addEventListener("mouseleave",B),n.addEventListener("focusin",W),n.addEventListener("focusout",B);const Y=(rt=o.duration)!=null?rt:this._defaults.duration;function dt(){if(!k._activeMap.has(x))return;if(d.paused){d.raf=null,d.start=_();return}const l=_()-d.start;if(d.remaining-=l,d.start=_(),q){const c=Math.max(0,d.remaining/Y);q.style.transform=`scaleX(${c})`}if(d.remaining<=0){N||n.classList.remove("show"),setTimeout(()=>k.remove(x),280),d.raf=null;return}d.raf=requestAnimationFrame(dt)}const J=()=>{Y<=0||d.raf||d.paused||(d.start=_(),d.raf=requestAnimationFrame(dt))};Y>0&&(d.start=_(),d.remaining=Y,J());const vt=()=>this.remove(x);return o.undoTimeout&&(d.timer=setTimeout(vt,o.undoTimeout)),(o.playSound||this._defaults.playSound)&&this._playSound(o.playSound||this._defaults.playSound),x},remove(e){var t,a,r,i;const s=this._activeMap.get(e);if(!s)return!1;const{toast:u,cfg:b,type:p}=s;try{(a=(t=s.hooks).onClose)==null||a.call(t,{id:e,toast:u,cfg:b,type:p})}catch(f){}N?u.style.opacity="0":u.classList.add("hide");try{u._onPointerDown&&(u.removeEventListener("touchstart",u._onPointerDown),u.removeEventListener("mousedown",u._onPointerDown))}catch(f){}if(s._boundMove){try{document.removeEventListener("touchmove",s._boundMove),document.removeEventListener("mousemove",s._boundMove)}catch(f){}s._boundMove=null}if(s._boundUp){try{document.removeEventListener("touchend",s._boundUp),document.removeEventListener("mouseup",s._boundUp)}catch(f){}s._boundUp=null}try{s._onEnter&&u.removeEventListener("mouseenter",s._onEnter),s._onLeave&&u.removeEventListener("mouseleave",s._onLeave),s._onEnter&&u.removeEventListener("focusin",s._onEnter),s._onLeave&&u.removeEventListener("focusout",s._onLeave)}catch(f){}s.raf&&(cancelAnimationFrame(s.raf),s.raf=null),s.timer&&(clearTimeout(s.timer),s.timer=null),this._activeMap.delete(e);const m=u.parentNode;if(m&&m.removeChild(u),m&&this._updateStackPositionsFor(m),s.dedupeKey)try{this._queueDedupe.delete(s.dedupeKey)}catch(f){}try{(i=(r=s.hooks).onRemoved)==null||i.call(r,{id:e,cfg:b,type:p})}catch(f){}return!0},update(e,t={}){const a=this._activeMap.get(e);if(!a)return this._warn("update: id not found "+e),!1;const{toast:r}=a;if(a.cfg=I(a.cfg,t),a.cfg.title){const u=r.querySelector(".jt-title");u&&(u.textContent=a.cfg.title)}const i=r.querySelector(".jt-message");i&&(a.cfg.html?i.innerHTML=$(a.cfg.html):i.textContent=String(a.cfg.message||""));const s=z[a.cfg.theme||this._theme]||{};return r.style.background=a.cfg.bg||s.bg,r.style.color=a.cfg.color||s.color,r.style.border=a.cfg.border||s.border||"none",a.cfg.duration!==void 0&&(a.remaining=a.cfg.duration,a.start=_(),!a.paused&&!a.raf&&(a.raf=requestAnimationFrame(function u(){var b;if(!k._activeMap.has(e))return;const p=k._activeMap.get(e);if(!p)return;const m=_()-p.start;p.remaining-=m,p.start=_();const f=p.toast.querySelector(".jt-progress");if(f){const j=Math.max(0,p.remaining/((b=p.cfg.duration)!=null?b:k._defaults.duration));f.style.transform=`scaleX(${j})`}if(p.remaining<=0){N||p.toast.classList.remove("show"),setTimeout(()=>k.remove(e),280);return}p.raf=requestAnimationFrame(u)}))),this._runPlugins({toast:r,cfg:a.cfg,type:a.type,meta:a}),!0},_priorityMap:{low:1,normal:2,high:3,urgent:4}};function Tt(e,t){return e?typeof e=="string"?{message:e}:e:{message:t}}function yt(e,t,a){return e?typeof e=="function"?{message:e(t)}:typeof e=="string"?{message:e}:e:{message:a}}k.setup({success:{icon:"fa-check",iconPack:"fas",bg:"#16a34a",progress:!0,duration:4e3},error:{icon:"fa-xmark",iconPack:"fas",bg:"#dc2626",progress:!0,duration:4e3},info:{icon:"fa-circle-info",iconPack:"fas",bg:"#2563eb",progress:!0,duration:4e3},warning:{icon:"fa-triangle-exclamation",iconPack:"fas",bg:"#f59e0b",progress:!0,duration:4e3},loading:{icon:"fa-spinner",iconPack:"fas",iconAnim:"jt-spin",duration:0,progress:!0}});export{k as default,k as juiceToast};
251
+
252
+ .jt-modal{
253
+ width:100%;
254
+ max-width:520px;
255
+ border-radius:18px;
256
+ padding:24px;
257
+ opacity:0;
258
+ transform:translateY(40px) scale(.96);
259
+ transition:transform .35s cubic-bezier(.16,1,.3,1),opacity .25s ease;
260
+ will-change:transform,opacity;
261
+ }
262
+
263
+ .jt-modal.show{
264
+ opacity:1;
265
+ transform:translateY(0) scale(1);
266
+ }
267
+
268
+ .jt-modal-btn{
269
+ padding:8px 14px;
270
+ border-radius:8px;
271
+ font-size:14px;
272
+ cursor:pointer;
273
+ border:none;
274
+ transition:all .18s ease;
275
+ }
276
+
277
+ /* PRIMARY */
278
+
279
+ .jt-modal-btn.primary{
280
+ background:#3b82f6;
281
+ color:#fff;
282
+ }
283
+
284
+ .jt-modal-btn.primary:hover{
285
+ background:#2563eb;
286
+ }
287
+
288
+ /* SECONDARY */
289
+
290
+ .jt-modal-btn.secondary{
291
+ background:#e5e7eb;
292
+ color:#111;
293
+ }
294
+
295
+ .jt-modal-btn.secondary:hover{
296
+ background:#d1d5db;
297
+ }
298
+
299
+ /* OUTLINE */
300
+
301
+ .jt-modal-btn.outline{
302
+ background:transparent;
303
+ border:1px solid currentColor;
304
+ color:inherit;
305
+ }
306
+
307
+ .jt-modal-btn.outline:hover{
308
+ background:rgba(255,255,255,.06);
309
+ }
310
+
311
+ /* PARALLAX */
312
+
313
+ [data-juice-root][data-parallax="true"] .juice-toast{
314
+ transition:transform .12s cubic-bezier(.2,.8,.2,1),opacity .2s;
315
+ }
316
+
317
+ /* GLASS FEATURE */
318
+
319
+ [data-juice-root][data-glass="true"] .juice-toast{
320
+ background:rgba(30,30,30,.55);
321
+ backdrop-filter:blur(14px) saturate(140%);
322
+ border:1px solid rgba(255,255,255,.08);
323
+ }
324
+
325
+ /* REDUCED MOTION */
326
+
327
+ @media (prefers-reduced-motion:reduce){
328
+ .juice-toast,
329
+ .jt-modal{
330
+ animation:none!important;
331
+ transition:none!important;
332
+ }
333
+ }
334
+ `;function ie(e=Q){if(!P||fe||(fe=!0,document.getElementById("juice-toast-style")))return;const a=document.createElement("style");a.id="juice-toast-style",a.textContent=e,document.head.appendChild(a)}const le=(()=>{let e=1;return()=>"jt-"+Date.now().toString(36)+"-"+e++})();function S(){return Date.now()}function N(e,a){return Object.assign({},e||{},a||{})}function I(e,a,t){return Math.max(a,Math.min(t,e))}function U(e,a,t){return e+(a-e)*t}function B(e){if(!e)return"";const a=document.createElement("template");a.innerHTML=e,a.content.querySelectorAll("script, style, iframe, object, embed").forEach(i=>i.remove());const t=new Set(["b","i","u","strong","em","code","pre","ul","ol","li","br","p","span","img","h1","h2","h3","h4","h5","h6","a"]),l=/^(https?:\/\/|mailto:|tel:|\/\/)/i;return(function i(r){Array.from(r.childNodes).forEach(s=>{if(s.nodeType===1){const p=s.tagName.toLowerCase();t.has(p)?(Array.from(s.attributes||[]).forEach(f=>{const h=f.name.toLowerCase(),u=(f.value||"").trim();h.startsWith("on")?s.removeAttribute(f.name):h==="src"||h==="href"||h==="xlink:href"?l.test(u)?/^data:\s*image\/svg\+xml/i.test(u)&&s.removeAttribute(f.name):s.removeAttribute(f.name):(p==="img"&&h==="srcset"||h==="style")&&s.removeAttribute(f.name)}),i(s)):s.replaceWith(...Array.from(s.childNodes))}})})(a.content),a.innerHTML}const z={dark:{bg:"linear-gradient(180deg,#1f2937,#111827)",color:"#fff",border:"1px solid rgba(255,255,255,.06)"},light:{bg:"#fff",color:"#111",border:"1px solid #e5e7eb"},glass:{bg:"rgba(30,30,30,.35)",color:"#fff",border:"1px solid rgba(255,255,255,.1)"}},ye={sm:{width:"260px",padding:"10px"},md:{width:"320px",padding:"14px"},lg:{width:"420px",padding:"18px"}},Pe={success:"jt-bounce",error:"jt-shake",warning:"jt-shake",info:"jt-pulse",loading:"jt-spin"},$={_defaults:{duration:2500,maxVisible:3,swipeThreshold:60,glassUI:0,glassOnly:!1,playSound:null,dev:!1,injectCSS:!0,css:null,autoDedupe:!1,maxVisiblePerType:{},parallaxMode:!1,autoFetchFA:!0,use3d:!1,parallaxSmoothing:.12,_maxRequeueRetries:8},_config:{},_theme:"dark",_plugins:[],_queue:new H,_queueDedupe:new Set,_activeMap:new Map,_roots:new Map,_modalStack:[],_faInjected:!1,_schedulerRunning:!1,_schedulerLast:0,_schedulerRAF:null,_pausedAll:!1,setup(e={}){const a=e,{duration:t,maxVisible:l}=a,i=Le(a,["duration","maxVisible"]);typeof t=="number"&&(this._defaults.duration=t),typeof l=="number"&&(this._defaults.maxVisible=l),typeof e.autoDedupe=="boolean"&&(this._defaults.autoDedupe=e.autoDedupe),e.maxVisiblePerType&&(this._defaults.maxVisiblePerType=N(this._defaults.maxVisiblePerType,e.maxVisiblePerType)),typeof e.parallaxMode=="boolean"&&(this._defaults.parallaxMode=e.parallaxMode),typeof e.autoFetchFA=="boolean"&&(this._defaults.autoFetchFA=e.autoFetchFA),typeof e.use3d=="boolean"&&(this._defaults.use3d=e.use3d),typeof e.parallaxSmoothing=="number"&&(this._defaults.parallaxSmoothing=I(e.parallaxSmoothing,0,1)),typeof e._maxRequeueRetries=="number"&&(this._defaults._maxRequeueRetries=e._maxRequeueRetries),this._config=N(this._config,i),this._registerTypes(),this._defaults.injectCSS!==!1&&ie(this._defaults.css||Q)},use(e){typeof e=="function"&&this._plugins.push(e)},addType(e,a={}){this._config[e]=a,this._registerTypes()},defineTheme(e,a={}){z[e]=N(z[e]||{},a)},setTheme(e){this._theme=e,P&&this._roots.forEach(a=>a.dataset.theme=e)},clear(){this._queue=new H,this._queueDedupe.clear()},destroy(){this.clear(),P&&(this._roots.forEach(e=>{try{e._parallaxRAF&&cancelAnimationFrame(e._parallaxRAF),e._parallaxHandler&&(e.removeEventListener("mousemove",e._parallaxHandler),e.removeEventListener("touchmove",e._parallaxHandler)),e._parallaxReset&&(e.removeEventListener("mouseleave",e._parallaxReset),e.removeEventListener("touchend",e._parallaxReset)),e.remove()}catch(a){}}),this._roots.clear(),Array.from(this._activeMap.keys()).forEach(e=>this.remove(e)),this._stopScheduler())},promise(e,a={}){if(!e||typeof e.then!="function"){this._warn("promise expects a Promise");return}const t=le(),l=a.timeout;let i=null,r=!1,s=!1;const p=()=>{i&&(clearTimeout(i),i=null)};return this._enqueue("loading",ne(se({},Ce(a.loading,"Loading...")),{groupId:t,duration:0})),l&&(i=setTimeout(()=>{s||r||(s=!0,p(),this._enqueue("error",{message:a.timeoutMessage||"Request timeout",groupId:t}))},l)),e.then(f=>{r||s||(s=!0,p(),this._enqueue("success",ne(se({},ge(a.success,f,"Success")),{groupId:t})))}).catch(f=>{r||s||(s=!0,p(),this._enqueue("error",ne(se({},ge(a.error,f,"Error")),{groupId:t})))}),{cancel:()=>{r||s||(r=!0,p(),this._enqueue("info",{message:a.cancelMessage||"Cancelled",groupId:t}))}}},modal(e={}){var a;if(!P)return;this._defaults.injectCSS!==!1&&ie(this._defaults.css||Q);const t=N({title:"",message:"",html:null,block:!0,blur:!0,closeOnOverlay:!0,closable:!0,animation:"scale",actions:[],theme:this._theme,use3d:void 0},e),l=t.use3d===void 0?this._defaults.use3d:!!t.use3d,i=z[t.theme]||z.dark,r=document.createElement("div");r.className="jt-modal-overlay",r.style.pointerEvents=t.block?"all":"none",t.blur||(r.style.backdropFilter="none",r.style.webkitBackdropFilter="none");const s=document.createElement("div");if(s.className=`jt-modal jt-anim-${t.animation}`,s.style.background=i.bg,s.style.color=i.color,s.style.border=i.border||"none",l&&(r.style.perspective=r.style.perspective||"900px",s.style.transform="translateY(40px) scale(.96) rotateX(8deg)"),t.title){const u=document.createElement("div");u.className="jt-modal-header",u.textContent=t.title,s.appendChild(u)}const p=document.createElement("div");if(p.className="jt-modal-body",t.html?p.innerHTML=B(t.html):p.textContent=t.message||"",s.appendChild(p),(a=t.actions)!=null&&a.length){const u=document.createElement("div");u.className="jt-modal-actions",t.actions.forEach(y=>{const _=document.createElement("button"),v=y.buttonType||(y.primary?"primary":"secondary");_.className=`jt-modal-btn ${v}`,_.textContent=y.label||"OK",_.onclick=j=>{var L;j.stopPropagation(),(L=y.onClick)==null||L.call(y,j),y.closeOnClick!==!1&&h()},u.appendChild(_)}),s.appendChild(u)}r.appendChild(s),document.body.appendChild(r),this._modalStack.push(r),t.block&&(document.body.style.overflow="hidden"),requestAnimationFrame(()=>{r.classList.add("show"),s.classList.add("show"),l&&(s.style.transform="translateY(0) scale(1) rotateX(0deg)")});const f=u=>{u.key==="Escape"&&h()};t.closable&&(t.closeOnOverlay&&r.addEventListener("click",u=>{u.target===r&&h()}),document.addEventListener("keydown",f));const h=()=>{r.classList.remove("show"),s.classList.remove("show"),l&&(s.style.transform="translateY(40px) scale(.96) rotateX(8deg)"),setTimeout(()=>{try{r.remove()}catch(y){}t.block&&(document.body.style.overflow=""),document.removeEventListener("keydown",f);const u=this._modalStack.indexOf(r);u>=0&&this._modalStack.splice(u,1)},300)};return{close:h}},_registerTypes(){Object.keys(this._config).forEach(e=>{if(typeof this[e]=="function"&&!this[e].__auto)return;const a=t=>this._enqueue(e,t);a.__auto=!0,this[e]=a})},_enqueue(e,a={}){var t,l;const i=typeof a.priority=="number"?a.priority:(l=(t=this._priorityMap)==null?void 0:t[a.priority])!=null?l:2,r=a.dedupeKey||(this._defaults.autoDedupe?this._computeDedupeKey(e,a):void 0);if(r&&this._queueDedupe.has(r)){this._defaults.dev&&console.log("[JuiceToast] deduped (queue)",r);return}const s={id:le(),type:e,payload:a,priority:i};return s._retries=0,r&&(s._dedupeKey=r,this._queueDedupe.add(r)),this._queue.push(s,i),this._scheduleProcessQueue(),s.id},_processQueueScheduled:!1,_scheduleProcessQueue(){this._processQueueScheduled||(this._processQueueScheduled=!0,setTimeout(()=>{this._processQueueScheduled=!1,this._processQueue()},40))},_processQueue(){var e,a;if(!P)return;const t=this._defaults.maxVisible||1/0;let l=0;for(;this._queue.size>0&&l<200;){l++;const i=this._queue.pop();if(!i)break;const r=((e=i.payload)==null?void 0:e.position)||((a=i.payload)==null?void 0:a.toast)||"bottom-right",s=this._getRoot(r);if(!s){if(i._retries=(i._retries||0)+1,i._retries>(this._defaults._maxRequeueRetries||8)){i._dedupeKey&&this._queueDedupe.delete(i._dedupeKey);continue}setTimeout(()=>{this._queue.push(i,i.priority)},120);break}if(Array.from(s.children).length>=t){if(i._retries=(i._retries||0)+1,i._retries>(this._defaults._maxRequeueRetries||8)){i._dedupeKey&&this._queueDedupe.delete(i._dedupeKey);continue}setTimeout(()=>this._queue.push(i,i.priority),160);break}const p=(this._defaults.maxVisiblePerType||{})[i.type];if(typeof p=="number"&&Array.from(s.children).filter(f=>f.dataset.toastType===i.type).length>=p){if(i._retries=(i._retries||0)+1,i._retries>(this._defaults._maxRequeueRetries||8)){i._dedupeKey&&this._queueDedupe.delete(i._dedupeKey);continue}setTimeout(()=>this._queue.push(i,i.priority),160);break}this._showToast(i.type,i.payload,i.id)}},_getRoot(e="bottom-right"){var a;if(!P)return null;if(this._roots.has(e))return this._roots.get(e);const t=document.createElement("div");switch(t.setAttribute("data-juice-root","1"),t.id=`juice-toast-root-${e}`,t.dataset.position=e,t.dataset.theme=this._theme,t.style.pointerEvents="none",t.style.display="flex",t.style.flexDirection="column",this._defaults.parallaxMode&&(t.dataset.parallax="true"),e){case"top-left":t.style.top="20px",t.style.left="20px";break;case"top-right":t.style.top="20px",t.style.right="20px";break;case"bottom-left":t.style.bottom="20px",t.style.left="20px";break;case"bottom-right":t.style.bottom="20px",t.style.right="20px";break;case"top-center":t.style.top="20px",t.style.left="50%",t.style.transform="translateX(-50%)";break;case"bottom-center":t.style.bottom="20px",t.style.left="50%",t.style.transform="translateX(-50%)";break;default:t.style.bottom="20px",t.style.right="20px"}if(document.body.appendChild(t),this._defaults.parallaxMode&&!D){const l=(a=this._defaults.parallaxSmoothing)!=null?a:.12;t._parallaxTargets=new WeakMap;const i=s=>{const p=t.getBoundingClientRect(),f=p.left+p.width/2,h=p.top+p.height/2,u=s.touches?s.touches[0].clientX:s.clientX,y=s.touches?s.touches[0].clientY:s.clientY;Array.from(t.children).forEach((_,v)=>{const j=(v+1)/Math.max(1,t.children.length),L=I((u-f)/p.width*j*12,-18,18),T=I((y-h)/p.height*j*8,-14,14),M=I(-j*8,-30,0),J=I((u-f)/p.width*j*-6,-12,12),G=I((y-h)/p.height*j*4,-8,8),o={tx:L,ty:T,tz:M,rotX:G,rotY:J,smoothing:l};t._parallaxTargets.set(_,o)}),this._startScheduler()},r=()=>{Array.from(t.children).forEach(s=>{t._parallaxTargets.set(s,{tx:0,ty:0,tz:0,rotX:0,rotY:0,smoothing:.16})}),this._startScheduler()};t._parallaxHandler=i,t._parallaxReset=r,t.addEventListener("mousemove",i),t.addEventListener("touchmove",i,{passive:!0}),t.addEventListener("mouseleave",r),t.addEventListener("touchend",r)}return this._roots.set(e,t),t},_warn(e){this._defaults.dev&&typeof console!="undefined"&&console.warn("[JuiceToast]",e)},_ensureFA(){if(!(!P||this._faInjected||!this._defaults.autoFetchFA)){if(document.querySelector('link[href*="fontawesome"], link[href*="font-awesome"], link[href*="cdnjs.cloudflare.com/ajax/libs/font-awesome"]')){this._faInjected=!0;return}try{const e=document.createElement("link");e.rel="stylesheet",e.href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css",e.crossOrigin="anonymous",document.head.appendChild(e),this._faInjected=!0}catch(e){console.error("[JuiceToast]: Fetching icons failed:",e)}}},_playSound(e){if(!P)return;const a=typeof e=="string"&&e?e:this._defaults.playSound;if(a)try{const t=new Audio(a);t.volume=.6,t.play().catch(()=>{})}catch(t){}},_updateStackPositionsFor(e){const a=Array.from(e.children);e.dataset.position&&e.dataset.position.includes("bottom"),a.forEach((t,l)=>{const i=l,r=i*12;t.style.setProperty("--jt-stack-y",`${-r}px`),t.style.setProperty("--jt-stack-scale",1-i*.04),t.style.setProperty("--jt-stack-opacity",1-i*.12),t.style.zIndex=1e3-i,t.style.setProperty("--jt-parallax-z",`${-i*2}px`),t.dataset.stack=String(i)})},_runPlugins(e){this._plugins.forEach(a=>{try{a(e)}catch(t){this._warn("Plugin error: "+((t==null?void 0:t.message)||t))}})},_normalizeGlass(e){if(e===!0)return 60;if(!e)return 0;const a=Number(e);return Number.isFinite(a)?I(a,0,100):0},_computeDedupeKey(e,a){try{const t=e||"",l=a.title||"",i=a.message||a.html||"";return`${t}::${String(l).trim().slice(0,200)}::${String(i).trim().slice(0,500)}`}catch(t){return}},_showToast(e,a={},t){var l,i,r,s,p,f,h,u,y,_,v,j,L,T,M;if(!P)return;this._defaults.injectCSS!==!1&&ie(this._defaults.css||Q),this._ensureFA();const J=this._config[e]||{},G=typeof a=="object"?a:{message:String(a)},o=N(J,G);o.icon=(l=o.icon)!=null?l:o.icon_left_top,o.position=(r=(i=o.position)!=null?i:o.toast)!=null?r:"bottom-right",o.closable=(p=(s=o.closable)!=null?s:o.closeable)!=null?p:!0,o.duration=typeof o.duration=="number"?o.duration:this._defaults.duration;const V=z[o.theme||this._theme]||{},k=t||le(),X=o.dedupeKey||(this._defaults.autoDedupe?this._computeDedupeKey(e,o):void 0);if(X)for(const c of this._roots.values()){const d=Array.from(c.children).find(b=>b.dataset.dedupeKey===X);if(d){let b=d._cachedCountEl;if(b||(b=document.createElement("span"),b.className="jt-count",b.style.marginLeft="6px",(f=d.querySelector(".jt-title"))==null||f.appendChild(b),d._cachedCountEl=b,b.textContent="1"),b.textContent=String(parseInt(b.textContent||"1")+1),o.mergeMessage){const E=d.querySelector(".jt-message");E&&(o.html?E.innerHTML=B(o.html):E.textContent=String(o.message||""))}return d.dataset.toastId}}const n=document.createElement("div");if(n.className="juice-toast",n.dataset.toastId=k,n.dataset.position=o.position,n.dataset.toastType=e,X&&(n.dataset.dedupeKey=X),n.tabIndex=0,n.setAttribute("role",o.ariaRole||(e==="error"?"alert":"status")),n.getAttribute("aria-live")||(n.setAttribute("aria-live",e==="error"||e==="success"?"assertive":"polite"),n.setAttribute("aria-atomic","true")),n.style.position="relative",n.style.pointerEvents="auto",o.glassOnly?(n.style.background="rgba(255,255,255,0.35)",n.style.backdropFilter="blur(14px) saturate(140%)",n.style.webkitBackdropFilter="blur(14px) saturate(140%)",n.style.color="rgba(15,23,42,0.85)",n.style.border="1px solid rgba(0,0,0,0.08)",n.style.boxShadow="0 8px 28px rgba(0,0,0,0.08), inset 0 1px 0 rgba(255,255,255,0.25)"):(n.style.background=o.bg||V.bg,n.style.color=o.color||V.color,n.style.border=o.border||V.border||"none"),n.style.minHeight=n.style.minHeight||"",n.style.setProperty("--jt-parallax-x","0px"),n.style.setProperty("--jt-parallax-y","0px"),n.style.setProperty("--jt-parallax-z","0px"),n.style.setProperty("--jt-drag-x","0px"),n.style.setProperty("--jt-drag-y","0px"),n.style.setProperty("--jt-rot-x","0deg"),n.style.setProperty("--jt-rot-y","0deg"),n.style.setProperty("--jt-stack-y","0px"),n.style.setProperty("--jt-stack-scale","1"),o.size&&ye[o.size]){const c=ye[o.size];c.width&&(n.style.width=c.width),c.padding&&(n.style.padding=c.padding)}const w=document.createElement("div");w.className="jt-content";let Y=null;o.title&&(Y=document.createElement("div"),Y.className="jt-title",Y.textContent=o.title,w.appendChild(Y));const R=document.createElement("div");if(R.className="jt-message",o.html?R.innerHTML=B(o.html):typeof o.message=="string"?o.message.split(/(`[^`]+`)/g).forEach(c=>{if(c.startsWith("`")&&c.endsWith("`")){const d=document.createElement("code");d.textContent=c.slice(1,-1),R.appendChild(d)}else R.appendChild(document.createTextNode(c))}):o.message&&(R.textContent=String(o.message)),w.appendChild(R),Array.isArray(o.actions)&&o.actions.length){const c=document.createElement("div");c.className="jt-actions",o.actions.forEach(d=>{const b=document.createElement("button");b.className="jt-action",b.textContent=d.label||"Action",b.onclick=E=>{var F;E.stopPropagation(),(F=d.onClick)==null||F.call(d,E),d.closeOnClick!==!1&&this.remove(k)},c.appendChild(b)}),w.appendChild(c)}o.glassOnly||(o.bgImage?(n.style.backgroundImage=`url(${o.bgImage})`,n.style.backgroundSize=o.bgSize||"cover",n.style.backgroundPosition=o.bgPosition||"center"):n.style.background=o.bg||V.bg);let x=null;if(o.icon){x=document.createElement("i");const c=String(o.icon).startsWith("fa")?o.icon:`fa-${o.icon}`;if(x.className=["icon",o.iconPack||"",c].join(" ").trim(),o.iconSize&&(x.style.fontSize=o.iconSize),!D){const d=o.iconAnim||Pe[e];d&&x.classList.add(d)}(o.iconLink||o.iconAnimate)&&(x.classList.add("icon-clickable"),x.addEventListener("click",d=>{d.stopPropagation(),o.iconAnimate&&(x.classList.remove(o.iconAnimate),x.offsetWidth,x.classList.add(o.iconAnimate)),o.iconLink&&window.open(o.iconLink,"_blank","noopener")}))}let g=null;if(o.avatar){g=document.createElement("img");const c=typeof o.avatar=="string"&&o.avatar?o.avatar:o.avatarSrc||"";c&&(g.src=c),g.alt=o.avatarAlt||o.title||"avatar",g.className="jt-avatar",g.loading=o.avatarLazy?"lazy":"eager",g.style.width=g.style.width||"36px",g.style.height=g.style.height||"36px",g.style.borderRadius=g.style.borderRadius||"50%",g.style.objectFit=g.style.objectFit||"cover",g.style.flexShrink="0";const d=o.avatarPosition||"left";d==="left"?g.style.marginRight=(h=o.avatarSpacing)!=null?h:"10px":d==="right"?g.style.marginLeft=(u=o.avatarSpacing)!=null?u:"10px":d==="top"&&(g.style.marginBottom=(y=o.avatarSpacing)!=null?y:"8px")}const Z=o.avatarPosition||"left";g&&Z==="top"?(n.classList.add("jt-avatar-top"),n.style.flexDirection="column",n.style.alignItems="flex-start",n.appendChild(g),x&&o.iconPosition==="top"?(n.appendChild(x),n.appendChild(w)):x&&o.iconPosition==="right"?(n.appendChild(w),n.appendChild(x)):(x&&n.appendChild(x),n.appendChild(w))):(n.style.flexDirection="row",n.style.alignItems="center",g&&Z==="left"&&n.appendChild(g),x&&o.iconPosition==="right"?(n.appendChild(w),n.appendChild(x)):x&&o.iconPosition==="top"?(n.classList.add("jt-icon-top"),n.appendChild(x),n.appendChild(w)):(x&&n.appendChild(x),n.appendChild(w)),g&&Z==="right"&&n.appendChild(g));let K=null;if(o.progress&&((_=o.duration)!=null?_:this._defaults.duration)>0&&(K=document.createElement("div"),K.className="jt-progress",o.progressColor&&(K.style.background=o.progressColor),n.appendChild(K)),o.undo){const c=document.createElement("button");c.className="jt-action",c.textContent="Undo",c.onclick=()=>{try{o.undo()}catch(d){}this.remove(k)},w.appendChild(c)}if(o.closable){const c=document.createElement("span");c.className="juice-toast-close",c.tabIndex=0,c.textContent="\xD7",c.style.marginLeft="8px",c.addEventListener("click",d=>{d.stopPropagation(),this.remove(k)}),n.appendChild(c)}const C=this._getRoot(o.position||"bottom-right");if(!C)return;if(o.groupId){const c=Array.from(C.children).find(d=>d.dataset.groupId===o.groupId);if(c){const d=c.dataset.toastId;return this.update(d,{title:o.title,message:o.message,html:o.html,bg:o.bg,color:o.color,duration:o.duration,icon:o.icon,iconPack:o.iconPack}),d}n.dataset.groupId=o.groupId}const ce=this._defaults.maxVisible;if(ce&&C.children.length>=ce){const c=C.firstElementChild;if(c&&c.dataset&&c.dataset.toastId)this.remove(c.dataset.toastId);else try{C.removeChild(C.firstElementChild)}catch(d){}}C.appendChild(n),n._cachedTitleEl=Y,n._cachedMessageEl=R,n._cachedProgressEl=K;const m={id:k,toast:n,cfg:o,type:e,createdAt:S(),remaining:(v=o.duration)!=null?v:this._defaults.duration,timer:null,start:S(),paused:!1,_boundMove:null,_boundUp:null,_onPointerDown:null,_onEnter:null,_onLeave:null,dedupeKey:X,hooks:{onShow:o.onShow,onShown:o.onShown,onClose:o.onClose,onRemoved:o.onRemoved}};this._activeMap.set(k,m);try{(L=(j=m.hooks).onShow)==null||L.call(j,{id:k,toast:n,cfg:o,type:e})}catch(c){}this._runPlugins({toast:n,cfg:o,type:e,root:C,meta:m}),this._updateStackPositionsFor(C),requestAnimationFrame(()=>{var c,d;D?(n.style.opacity="1",(d=(c=m.hooks).onShown)==null||d.call(c,{id:k,toast:n,cfg:o,type:e})):(n.classList.add("show"),setTimeout(()=>{var b,E;try{(E=(b=m.hooks).onShown)==null||E.call(b,{id:k,toast:n,cfg:o,type:e})}catch(F){}},320))});let de=0,ue=0,A=0,O=0,ee=!1,q=null,te=0;const ae=c=>{const d=c.touches?c.touches[0]:c;de=d.clientX,ue=d.clientY,A=0,O=0,ee=!0,q=null,m.paused=!0,n.style.transition="none",m._boundMove=_e,m._boundUp=be,document.addEventListener("touchmove",m._boundMove,{passive:!0}),document.addEventListener("mousemove",m._boundMove),document.addEventListener("touchend",m._boundUp),document.addEventListener("mouseup",m._boundUp),te=S()},_e=c=>{if(!ee)return;const d=c.touches?c.touches[0]:c;A=d.clientX-de,O=d.clientY-ue,q||(Math.abs(A)>6?q="x":Math.abs(O)>6&&(q="y")),q==="x"?n.style.setProperty("--jt-drag-x",`${A}px`):q==="y"&&n.style.setProperty("--jt-drag-y",`${O}px`),te=S(),d.clientX},be=c=>{ee=!1,m.paused=!1;const d=Math.abs(A),b=Math.abs(O),E=q||(d>b?"x":"y"),F=Math.max(1,S()-te),xe=F?A/F*1e3:0,ve=E==="x"&&(d>($._defaults.swipeThreshold||60)||Math.abs(xe)>800),je=E==="y"&&b>($._defaults.swipeThreshold||80);if(ve||je){const Ee=A>=0?1:-1;E==="x"?n.style.setProperty("--jt-drag-x",`${Ee*1e3}px`):n.style.setProperty("--jt-drag-y","1000px"),n.classList.add("swipe-dismissing"),setTimeout(()=>this.remove(k),220)}else n.style.transition="transform 0.22s ease-out, opacity 0.22s ease-out",n.style.setProperty("--jt-drag-x","0px"),n.style.setProperty("--jt-drag-y","0px");A=O=0,m._boundMove&&(document.removeEventListener("touchmove",m._boundMove),document.removeEventListener("mousemove",m._boundMove),m._boundMove=null),m._boundUp&&(document.removeEventListener("touchend",m._boundUp),document.removeEventListener("mouseup",m._boundUp),m._boundUp=null),m.start=S(),this._startScheduler()};n._onPointerDown=ae,n.addEventListener("touchstart",ae,{passive:!0}),n.addEventListener("mousedown",ae);const oe=()=>{m.paused=!0},re=()=>{m.paused&&(m.paused=!1,m.start=S(),this._startScheduler())};return m._onEnter=oe,m._onLeave=re,n.addEventListener("mouseenter",oe),n.addEventListener("mouseleave",re),n.addEventListener("focusin",oe),n.addEventListener("focusout",re),m.start=S(),m.remaining=(T=o.duration)!=null?T:this._defaults.duration,m.paused=!1,((M=o.duration)!=null?M:this._defaults.duration)>0&&this._startScheduler(),o.undoTimeout&&(m.timer=setTimeout(()=>this.remove(k),o.undoTimeout)),(o.playSound||this._defaults.playSound)&&this._playSound(o.playSound||this._defaults.playSound),k},_startScheduler(){if(this._schedulerRunning)return;this._schedulerRunning=!0;const e=a=>{const t=S();this._schedulerLast=t,this._pausedAll||this._activeMap.forEach((r,s)=>{var p;if(!r||r.paused)return;const f=(p=r.cfg.duration)!=null?p:this._defaults.duration;if(f<=0)return;const h=t-r.start,u=Math.max(0,Math.min(h,1e3));r.remaining-=u,r.start=t;const y=r.toast._cachedProgressEl||r.toast.querySelector(".jt-progress");if(y){const _=Math.max(0,r.remaining/f);y.style.transform=`scaleX(${_})`}r.remaining<=0&&(D||r.toast.classList.remove("show"),setTimeout(()=>this.remove(s),280))}),this._roots.forEach(r=>{!r._parallaxTargets||!r.children.length||Array.from(r.children).forEach(s=>{var p,f,h;const u=r._parallaxTargets.get(s)||{tx:0,ty:0,tz:0,rotX:0,rotY:0,smoothing:(p=this._defaults.parallaxSmoothing)!=null?p:.12};s._jtPrev=s._jtPrev||{tx:0,ty:0,tz:0,rotX:0,rotY:0};const y=s._jtPrev,_=(h=u.smoothing)!=null?h:(f=this._defaults.parallaxSmoothing)!=null?f:.12,v=U(y.tx,u.tx||0,_),j=U(y.ty,u.ty||0,_),L=U(y.tz,u.tz||0,_),T=U(y.rotX,u.rotX||0,_),M=U(y.rotY,u.rotY||0,_);s.style.setProperty("--jt-parallax-x",`${v}px`),s.style.setProperty("--jt-parallax-y",`${j}px`),s.style.setProperty("--jt-parallax-z",`${L}px`),s.style.setProperty("--jt-rot-x",`${T}deg`),s.style.setProperty("--jt-rot-y",`${M}deg`),s._jtPrev.tx=v,s._jtPrev.ty=j,s._jtPrev.tz=L,s._jtPrev.rotX=T,s._jtPrev.rotY=M})});let l=!1;this._activeMap.forEach(r=>{var s;((s=r.cfg.duration)!=null?s:this._defaults.duration)>0&&!r.paused&&(l=!0)});let i=!1;this._roots.forEach(r=>{r._parallaxTargets&&r.children.length&&(i=!0)}),!l&&!i?this._stopScheduler():this._schedulerRAF=requestAnimationFrame(e)};this._schedulerRAF=requestAnimationFrame(e)},_stopScheduler(){this._schedulerRunning&&(this._schedulerRAF&&cancelAnimationFrame(this._schedulerRAF),this._schedulerRAF=null,this._schedulerRunning=!1,this._schedulerLast=0)},remove(e){var a,t,l,i;const r=this._activeMap.get(e);if(!r)return!1;const{toast:s,cfg:p,type:f}=r;try{(t=(a=r.hooks).onClose)==null||t.call(a,{id:e,toast:s,cfg:p,type:f})}catch(u){}D?s.style.opacity="0":s.classList.add("hide");try{s._onPointerDown&&(s.removeEventListener("touchstart",s._onPointerDown),s.removeEventListener("mousedown",s._onPointerDown))}catch(u){}if(r._boundMove){try{document.removeEventListener("touchmove",r._boundMove),document.removeEventListener("mousemove",r._boundMove)}catch(u){}r._boundMove=null}if(r._boundUp){try{document.removeEventListener("touchend",r._boundUp),document.removeEventListener("mouseup",r._boundUp)}catch(u){}r._boundUp=null}try{r._onEnter&&s.removeEventListener("mouseenter",r._onEnter),r._onLeave&&s.removeEventListener("mouseleave",r._onLeave),r._onEnter&&s.removeEventListener("focusin",r._onEnter),r._onLeave&&s.removeEventListener("focusout",r._onLeave)}catch(u){}r.timer&&(clearTimeout(r.timer),r.timer=null),this._activeMap.delete(e);const h=s.parentNode;if(h){const u=()=>{var y,_;try{s.parentNode&&s.parentNode.removeChild(s)}catch(v){}try{if(h.children.length===0){try{h._parallaxHandler&&(h.removeEventListener("mousemove",h._parallaxHandler),h.removeEventListener("touchmove",h._parallaxHandler)),h._parallaxReset&&(h.removeEventListener("mouseleave",h._parallaxReset),h.removeEventListener("touchend",h._parallaxReset)),h.remove()}catch(v){}this._roots.delete(h.dataset.position)}else this._updateStackPositionsFor(h)}catch(v){}if(r.dedupeKey)try{this._queueDedupe.delete(r.dedupeKey)}catch(v){}try{(_=(y=r.hooks).onRemoved)==null||_.call(y,{id:e,cfg:p,type:f})}catch(v){}};if(D)u();else{const y=_=>{_.target===s&&(s.removeEventListener("animationend",y),u())};s.addEventListener("animationend",y),setTimeout(u,700)}}else{if(r.dedupeKey)try{this._queueDedupe.delete(r.dedupeKey)}catch(u){}try{(i=(l=r.hooks).onRemoved)==null||i.call(l,{id:e,cfg:p,type:f})}catch(u){}}return!0},update(e,a={}){const t=this._activeMap.get(e);if(!t)return this._warn("update: id not found "+e),!1;const{toast:l}=t;if(t.cfg=N(t.cfg,a),t.cfg.title){const s=l.querySelector(".jt-title")||l._cachedTitleEl;s&&(s.textContent=t.cfg.title)}const i=l.querySelector(".jt-message")||l._cachedMessageEl;i&&(t.cfg.html?i.innerHTML=B(t.cfg.html):i.textContent=String(t.cfg.message||""));const r=z[t.cfg.theme||this._theme]||{};if(l.style.background=t.cfg.bg||r.bg,l.style.color=t.cfg.color||r.color,l.style.border=t.cfg.border||r.border||"none",t.cfg.duration!==void 0){t.remaining=t.cfg.duration,t.start=S(),t.paused||this._startScheduler();const s=t.toast._cachedProgressEl||t.toast.querySelector(".jt-progress");s&&(s.style.transform="scaleX(1)")}return this._runPlugins({toast:l,cfg:t.cfg,type:t.type,meta:t}),!0},_priorityMap:{low:1,normal:2,high:3,urgent:4},pauseAll(){this._pausedAll=!0},resumeAll(){this._pausedAll=!1,this._activeMap.forEach(e=>e.start=S()),this._startScheduler()},dismissAll(e={}){const a=e.type,t=e.position,l=[];this._activeMap.forEach((i,r)=>{const s=a?i.type===a:!0,p=t?(i.cfg.position||i.toast.dataset.position)===t:!0;s&&p&&l.push(r)}),l.forEach(i=>this.remove(i))},listActive(){const e=[];return this._activeMap.forEach((a,t)=>{e.push({id:t,type:a.type,remaining:a.remaining,createdAt:a.createdAt,position:a.cfg.position})}),e}};function Ce(e,a){return e?typeof e=="string"?{message:e}:e:{message:a}}function ge(e,a,t){return e?typeof e=="function"?{message:e(a)}:typeof e=="string"?{message:e}:e:{message:t}}$.setup({success:{icon:"fa-check",iconPack:"fas",bg:"#16a34a",progress:!0,duration:4e3},error:{icon:"fa-xmark",iconPack:"fas",bg:"#dc2626",progress:!0,duration:4e3},info:{icon:"fa-circle-info",iconPack:"fas",bg:"#2563eb",progress:!0,duration:4e3},warning:{icon:"fa-triangle-exclamation",iconPack:"fas",bg:"#f59e0b",progress:!0,duration:4e3},loading:{icon:"fa-spinner",iconPack:"fas",iconAnim:"jt-spin",duration:0,progress:!0}});export{$ as default,$ as juiceToast};
46
335
  //# sourceMappingURL=juice-toast.esm.js.map
@@ -1,46 +1,335 @@
1
- (function(P,N){typeof exports=="object"&&typeof module!="undefined"?N(exports):typeof define=="function"&&define.amd?define(["exports"],N):(P=typeof globalThis!="undefined"?globalThis:P||self,N(P.juiceToast={}))})(this,(function(P){"use strict";var N=Object.defineProperty,xe=Object.defineProperties,_e=Object.getOwnPropertyDescriptors,U=Object.getOwnPropertySymbols,se=Object.prototype.hasOwnProperty,re=Object.prototype.propertyIsEnumerable,ie=(t,e,o)=>e in t?N(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,R=(t,e)=>{for(var o in e||(e={}))se.call(e,o)&&ie(t,o,e[o]);if(U)for(var o of U(e))re.call(e,o)&&ie(t,o,e[o]);return t},H=(t,e)=>xe(t,_e(e)),ve=(t,e)=>{var o={};for(var r in t)se.call(t,r)&&e.indexOf(r)<0&&(o[r]=t[r]);if(t!=null&&U)for(var r of U(t))e.indexOf(r)<0&&re.call(t,r)&&(o[r]=t[r]);return o};const E=typeof window!="undefined"&&typeof document!="undefined",O=E&&window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;class X{constructor(){this._heap=[]}get size(){return this._heap.length}_parent(e){return Math.floor((e-1)/2)}_left(e){return 2*e+1}_right(e){return 2*e+2}_swap(e,o){[this._heap[e],this._heap[o]]=[this._heap[o],this._heap[e]]}push(e,o=0){const r={item:e,priority:o,seq:X._seq=(X._seq||0)+1};this._heap.push(r),this._siftUp(this._heap.length-1)}pop(){if(!this._heap.length)return null;this._swap(0,this._heap.length-1);const e=this._heap.pop();return this._siftDown(0),e.item}peek(){return this._heap[0]?this._heap[0].item:null}_siftUp(e){for(;e>0;){const o=this._parent(e);if(this._compare(e,o)<=0)break;this._swap(e,o),e=o}}_siftDown(e){for(;;){const o=this._left(e),r=this._right(e),i=this._heap.length;let n=e;if(o<i&&this._compare(o,n)>0&&(n=o),r<i&&this._compare(r,n)>0&&(n=r),n===e)break;this._swap(e,n),e=n}}_compare(e,o){const r=this._heap[e],i=this._heap[o];return r.priority!==i.priority?r.priority-i.priority:r.seq-i.seq}}let W=!1;const B=`
2
- /* JuiceToast base (extended) */
3
- #juice-toast-root,[id^="juice-toast-root-"]{position:fixed;z-index:9999;display:flex;pointer-events:none;gap:10px}
4
- #juice-toast-root[data-position="bottom-right"],#juice-toast-root-bottom-right{bottom:20px;right:20px;flex-direction:column-reverse;align-items:flex-end}
5
- #juice-toast-root[data-position="top-right"]{top:20px;right:20px;flex-direction:column;align-items:flex-end}
6
- #juice-toast-root[data-position="bottom-left"]{bottom:20px;left:20px;flex-direction:column-reverse;align-items:flex-start}
7
- #juice-toast-root[data-position="top-left"]{top:20px;left:20px;flex-direction:column;align-items:flex-start}
8
- #juice-toast-root[data-position="top-center"],#juice-toast-root[data-position="bottom-center"]{left:50%;transform:translateX(-50%)}
9
- .juice-toast{pointer-events:auto;min-width:220px;max-width:420px;padding:12px 16px;margin:6px 0;border-radius:10px;background:linear-gradient(180deg,rgba(30,30,30,.95),rgba(20,20,20,.95));color:#fff;display:flex;gap:12px;align-items:flex-start;box-sizing:border-box;transition: transform 0.25s cubic-bezier(0.4,0,0.2,1), opacity 0.28s ease; transform: translate3d(var(--jt-parallax-x,0), var(--jt-parallax-y,0), 0) translateX(var(--jt-drag-x,0)) translateY(var(--jt-drag-y,0)) scale(var(--jt-stack-scale,1));}
10
- @keyframes jt-slide-in{0%{opacity:0;transform:translateY(20px) scale(0.98)}100%{opacity:1;transform:translateY(0) scale(1)}}
11
- @keyframes jt-slide-out{0%{opacity:1;transform:translateY(0) scale(1)}100%{opacity:0;transform:translateY(20px) scale(0.98)}}
12
- @keyframes jt-bounce{0%{transform:translateY(0)}25%{transform:translateY(-6px)}50%{transform:translateY(0)}75%{transform:translateY(-3px)}100%{transform:translateY(0)}}
13
- @keyframes jt-shake{0%{transform:translateX(0)}20%{transform:translateX(-6px)}40%{transform:translateX(6px)}60%{transform:translateX(-4px)}80%{transform:translateX(2px)}100%{transform:translateX(0)}}
14
- @keyframes jt-pulse{0%{transform:scale(1)}50%{transform:scale(1.02)}100%{transform:scale(1)}}
15
- @keyframes jt-spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}
16
- .juice-toast.show{animation:jt-slide-in .32s cubic-bezier(0.4,0,0.2,1) forwards;opacity:1}
17
- .juice-toast.hide{animation:jt-slide-out .28s cubic-bezier(0.4,0,0.2,1) forwards;opacity:0;pointer-events:none}
18
- .juice-toast .icon{width:30px;height:30px;display:inline-flex;align-items:center;justify-content:center;border-radius:8px;background:rgba(255,255,255,.06)}
19
- .jt-content{display:flex;flex-direction:column;gap:4px;flex:1;min-width:0}
20
- .jt-title{font-weight:700;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
21
- .jt-message{font-size:13px;opacity:.95;word-break:break-word}
22
- .jt-actions{display:flex;gap:8px;margin-top:10px}
23
- .jt-action{border:1px solid currentColor;padding:4px 10px;border-radius:6px;font-size:12px;cursor:pointer;background:transparent}
24
- .jt-progress{position:absolute;left:0;bottom:0;height:4px;width:100%;border-radius:2px;background:linear-gradient(90deg,#4ade80,#22c55e);transform-origin:left;transform:scaleX(1);transition:transform linear}
25
- .juice-toast.swipe-dismissing {opacity: 0; transition: transform 0.22s ease-out, opacity 0.22s ease-out;}
26
- .jt-avatar{width:36px;height:36px;border-radius:50%;object-fit:cover;flex-shrink:0}
27
-
28
- /* avatar top variant */
29
- .juice-toast.jt-avatar-top{flex-direction:column;align-items:flex-start}
30
-
31
- /* modal */
1
+ (function(T,Y){typeof exports=="object"&&typeof module!="undefined"?Y(exports):typeof define=="function"&&define.amd?define(["exports"],Y):(T=typeof globalThis!="undefined"?globalThis:T||self,Y(T.juiceToast={}))})(this,(function(T){"use strict";var Y=Object.defineProperty,xe=Object.defineProperties,ve=Object.getOwnPropertyDescriptors,Q=Object.getOwnPropertySymbols,ue=Object.prototype.hasOwnProperty,pe=Object.prototype.propertyIsEnumerable,he=(e,a,t)=>a in e?Y(e,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[a]=t,Z=(e,a)=>{for(var t in a||(a={}))ue.call(a,t)&&he(e,t,a[t]);if(Q)for(var t of Q(a))pe.call(a,t)&&he(e,t,a[t]);return e},ee=(e,a)=>xe(e,ve(a)),je=(e,a)=>{var t={};for(var l in e)ue.call(e,l)&&a.indexOf(l)<0&&(t[l]=e[l]);if(e!=null&&Q)for(var l of Q(e))a.indexOf(l)<0&&pe.call(e,l)&&(t[l]=e[l]);return t};const P=typeof window!="undefined"&&typeof document!="undefined",F=P&&window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;class K{constructor(){this._heap=[]}get size(){return this._heap.length}_parent(a){return Math.floor((a-1)/2)}_left(a){return 2*a+1}_right(a){return 2*a+2}_swap(a,t){[this._heap[a],this._heap[t]]=[this._heap[t],this._heap[a]]}push(a,t=0){const l={item:a,priority:t,seq:K._seq=(K._seq||0)+1};this._heap.push(l),this._siftUp(this._heap.length-1)}pop(){if(!this._heap.length)return null;this._swap(0,this._heap.length-1);const a=this._heap.pop();return this._siftDown(0),a.item}peek(){return this._heap[0]?this._heap[0].item:null}_siftUp(a){for(;a>0;){const t=this._parent(a);if(this._compare(a,t)<=0)break;this._swap(a,t),a=t}}_siftDown(a){for(;;){const t=this._left(a),l=this._right(a),i=this._heap.length;let r=a;if(t<i&&this._compare(t,r)>0&&(r=t),l<i&&this._compare(l,r)>0&&(r=l),r===a)break;this._swap(a,r),a=r}}_compare(a,t){const l=this._heap[a],i=this._heap[t];return l.priority!==i.priority?l.priority-i.priority:i.seq-l.seq}}let me=!1;const B=`
2
+ :root{
3
+ --jt-radius:10px;
4
+ --jt-bg1:rgba(30,30,30,.95);
5
+ --jt-bg2:rgba(20,20,20,.95);
6
+ --jt-gap:10px;
7
+ }
8
+
9
+ /* ROOT \u2014 use data attribute for flexibility */
10
+ [data-juice-root]{
11
+ position:fixed;
12
+ z-index:9999;
13
+ display:flex;
14
+ pointer-events:none;
15
+ gap:var(--jt-gap);
16
+ perspective:800px;
17
+ }
18
+
19
+ /* POSITIONS */
20
+
21
+ [data-juice-root][data-position="bottom-right"]{
22
+ bottom:20px;
23
+ right:20px;
24
+ flex-direction:column-reverse;
25
+ align-items:flex-end;
26
+ }
27
+
28
+ [data-juice-root][data-position="top-right"]{
29
+ top:20px;
30
+ right:20px;
31
+ flex-direction:column;
32
+ align-items:flex-end;
33
+ }
34
+
35
+ [data-juice-root][data-position="bottom-left"]{
36
+ bottom:20px;
37
+ left:20px;
38
+ flex-direction:column-reverse;
39
+ align-items:flex-start;
40
+ }
41
+
42
+ [data-juice-root][data-position="top-left"]{
43
+ top:20px;
44
+ left:20px;
45
+ flex-direction:column;
46
+ align-items:flex-start;
47
+ }
48
+
49
+ [data-juice-root][data-position="top-center"]{
50
+ top:20px;
51
+ left:50%;
52
+ transform:translateX(-50%);
53
+ }
54
+
55
+ [data-juice-root][data-position="bottom-center"]{
56
+ bottom:20px;
57
+ left:50%;
58
+ transform:translateX(-50%);
59
+ }
60
+
61
+ /* TOAST */
62
+
63
+ .juice-toast{
64
+ pointer-events:auto;
65
+ min-width:220px;
66
+ max-width:420px;
67
+ padding:12px 16px;
68
+ margin:6px 0;
69
+ border-radius:var(--jt-radius);
70
+ background:linear-gradient(180deg,var(--jt-bg1),var(--jt-bg2));
71
+ color:#fff;
72
+ display:flex;
73
+ gap:12px;
74
+ align-items:flex-start;
75
+ box-sizing:border-box;
76
+
77
+ transform:
78
+ translate3d(var(--jt-parallax-x,0),var(--jt-parallax-y,0),var(--jt-parallax-z,0))
79
+ translateY(var(--jt-stack-y,0))
80
+ translateX(var(--jt-drag-x,0))
81
+ translateY(var(--jt-drag-y,0))
82
+ rotateX(var(--jt-rot-x,0))
83
+ rotateY(var(--jt-rot-y,0))
84
+ scale(var(--jt-stack-scale,1));
85
+
86
+ transform-style:preserve-3d;
87
+ transition:transform .25s cubic-bezier(.4,0,.2,1),opacity .28s ease;
88
+ will-change:transform,opacity;
89
+ }
90
+
91
+ /* STACK DEPTH FEATURE */
92
+
93
+ .juice-toast[data-stack="1"]{--jt-stack-scale:.97;opacity:.95}
94
+ .juice-toast[data-stack="2"]{--jt-stack-scale:.94;opacity:.9}
95
+ .juice-toast[data-stack="3"]{--jt-stack-scale:.91;opacity:.85}
96
+
97
+ /* SHOW/HIDE */
98
+
99
+ @keyframes jt-slide-in{
100
+ from{opacity:0;transform:translateY(20px) scale(.98)}
101
+ to{opacity:1;transform:translateY(0) scale(1)}
102
+ }
103
+
104
+ @keyframes jt-slide-out{
105
+ from{opacity:1;transform:translateY(0) scale(1)}
106
+ to{opacity:0;transform:translateY(20px) scale(.98)}
107
+ }
108
+
109
+ .juice-toast.show{
110
+ animation:jt-slide-in .32s cubic-bezier(.4,0,.2,1) forwards;
111
+ }
112
+
113
+ .juice-toast.hide{
114
+ animation:jt-slide-out .28s cubic-bezier(.4,0,.2,1) forwards;
115
+ pointer-events:none;
116
+ }
117
+
118
+ /* MICRO ANIMATIONS */
119
+
120
+ @keyframes jt-bounce{
121
+ 0%,100%{transform:translateY(0)}
122
+ 50%{transform:translateY(-6px)}
123
+ }
124
+
125
+ @keyframes jt-shake{
126
+ 0%,100%{transform:translateX(0)}
127
+ 25%{transform:translateX(-6px)}
128
+ 75%{transform:translateX(6px)}
129
+ }
130
+
131
+ @keyframes jt-pulse{
132
+ 0%,100%{transform:scale(1)}
133
+ 50%{transform:scale(1.03)}
134
+ }
135
+
136
+ @keyframes jt-spin{
137
+ from{transform:rotate(0deg)}
138
+ to{transform:rotate(360deg)}
139
+ }
140
+
141
+ .jt-spin{animation:jt-spin 1.5s linear infinite}
142
+ .jt-pulse{animation:jt-pulse 1.2s ease-in-out}
143
+
144
+ /* ICON */
145
+
146
+ .juice-toast .icon{
147
+ width:30px;
148
+ height:30px;
149
+ display:flex;
150
+ align-items:center;
151
+ justify-content:center;
152
+ border-radius:8px;
153
+ background:rgba(255,255,255,.06);
154
+ }
155
+
156
+ /* CONTENT */
157
+
158
+ .jt-content{
159
+ display:flex;
160
+ flex-direction:column;
161
+ gap:4px;
162
+ flex:1;
163
+ min-width:0;
164
+ }
165
+
166
+ .jt-title{
167
+ font-weight:700;
168
+ font-size:13px;
169
+ white-space:nowrap;
170
+ overflow:hidden;
171
+ text-overflow:ellipsis;
172
+ }
173
+
174
+ .jt-message{
175
+ font-size:13px;
176
+ opacity:.95;
177
+ word-break:break-word;
178
+ }
179
+
180
+ /* ACTIONS */
181
+
182
+ .jt-actions{
183
+ display:flex;
184
+ gap:8px;
185
+ margin-top:10px;
186
+ }
187
+
188
+ .jt-action{
189
+ border:1px solid currentColor;
190
+ padding:4px 10px;
191
+ border-radius:6px;
192
+ font-size:12px;
193
+ cursor:pointer;
194
+ background:transparent;
195
+ }
196
+
197
+ /* PROGRESS */
198
+
199
+ .jt-progress{
200
+ position:absolute;
201
+ left:0;
202
+ bottom:0;
203
+ height:4px;
204
+ width:100%;
205
+ border-radius:2px;
206
+ background:linear-gradient(90deg,#4ade80,#22c55e);
207
+ transform-origin:left;
208
+ transform:scaleX(1);
209
+ transition:transform linear;
210
+ }
211
+
212
+ /* SWIPE */
213
+
214
+ .juice-toast.swipe-dismissing{
215
+ opacity:0;
216
+ transition:transform .22s ease-out,opacity .22s ease-out;
217
+ }
218
+
219
+ /* AVATAR */
220
+
221
+ .jt-avatar{
222
+ width:36px;
223
+ height:36px;
224
+ border-radius:50%;
225
+ object-fit:cover;
226
+ flex-shrink:0;
227
+ }
228
+
229
+ .juice-toast.jt-avatar-top{
230
+ flex-direction:column;
231
+ align-items:flex-start;
232
+ }
233
+
234
+ /* MODAL */
235
+
32
236
  .jt-modal-overlay{
33
- position:fixed;inset:0;display:flex;align-items:center;justify-content:center;padding:20px;background:rgba(15,23,42,.55);backdrop-filter:blur(6px) saturate(120%);-webkit-backdrop-filter:blur(6px) saturate(120%);opacity:0;transition:opacity .25s ease;z-index:10000;
237
+ position:fixed;
238
+ inset:0;
239
+ display:flex;
240
+ align-items:center;
241
+ justify-content:center;
242
+ padding:20px;
243
+ background:rgba(15,23,42,.55);
244
+ backdrop-filter:blur(6px) saturate(120%);
245
+ opacity:0;
246
+ transition:opacity .25s ease;
247
+ z-index:10000;
34
248
  }
249
+
35
250
  .jt-modal-overlay.show{opacity:1}
36
- .jt-modal{width:100%;max-width:520px;border-radius:18px;padding:24px;opacity:0;transform:translateY(40px) scale(.96);transition:transform .35s cubic-bezier(.16,1,.3,1),opacity .25s ease;}
37
- .jt-modal.show{opacity:1;transform:translateY(0) scale(1)}
38
- .jt-modal-header{font-size:18px;font-weight:600;letter-spacing:.3px;margin-bottom:10px}
39
- .jt-modal-body{font-size:14.5px;line-height:1.6;opacity:.85;margin-bottom:22px}
40
- .jt-modal-actions{display:flex;justify-content:flex-end;gap:12px}
41
- .jt-modal-btn{min-width:88px;padding:8px 16px;border-radius:12px;font-size:13.5px;font-weight:500;cursor:pointer;transition:all .2s ease;border:1px solid rgba(255,255,255,.08);background:rgba(255,255,255,.04);color:inherit}
42
- .jt-modal-btn:hover{background:rgba(255,255,255,.08);transform:translateY(-1px)}
43
- .jt-modal-btn.primary{background:#6366f1;border-color:#6366f1;color:#fff}
44
- #juice-toast-root[data-parallax="true"] .juice-toast{transition: transform 0.12s cubic-bezier(.2,.8,.2,1), opacity .2s}
45
- `;function le(t=B){if(!E||W)return;if(document.getElementById("juice-toast-style")){W=!0;return}const e=document.createElement("style");e.id="juice-toast-style",e.textContent=t,document.head.appendChild(e),W=!0}const J=(()=>{let t=1;return()=>"jt-"+t++})();function x(){return Date.now()}function q(t,e){return Object.assign({},t||{},e||{})}function Q(t,e,o){return Math.max(e,Math.min(o,t))}function $(t){if(!t)return"";const e=document.createElement("template");e.innerHTML=t,e.content.querySelectorAll("script, style, iframe").forEach(r=>r.remove());const o=["b","i","u","strong","em","code","pre","ul","ol","li","br","p","span","img","h1","h2","h3","h4","h5","h6","a"];return(function r(i){Array.from(i.childNodes).forEach(n=>{if(n.nodeType===1){const u=n.tagName.toLowerCase();o.includes(u)?(Array.from(n.attributes||[]).forEach(b=>{const p=b.name.toLowerCase(),m=b.value||"";(p.startsWith("on")||(p==="href"||p==="src"||p==="xlink:href")&&m.trim().toLowerCase().startsWith("javascript:")||u==="img"&&p==="srcset")&&n.removeAttribute(b.name)}),r(n)):n.replaceWith(...Array.from(n.childNodes))}})})(e.content),e.innerHTML}const A={dark:{bg:"linear-gradient(180deg,#1f2937,#111827)",color:"#fff",border:"1px solid rgba(255,255,255,.06)"},light:{bg:"#fff",color:"#111",border:"1px solid #e5e7eb"},glass:{bg:"rgba(30,30,30,.35)",color:"#fff",border:"1px solid rgba(255,255,255,.1)"}},ce={sm:{width:"260px",padding:"10px"},md:{width:"320px",padding:"14px"},lg:{width:"420px",padding:"18px"}},je={success:"jt-bounce",error:"jt-shake",warning:"jt-shake",info:"jt-pulse",loading:"jt-spin"},w={_defaults:{duration:2500,maxVisible:3,swipeThreshold:60,glassUI:0,playSound:null,dev:!1,injectCSS:!0,css:null,autoDedupe:!1,maxVisiblePerType:{},parallaxMode:!1,autoFetchFA:!0},_config:{},_theme:"dark",_plugins:[],_queue:new X,_queueDedupe:new Set,_activeMap:new Map,_roots:new Map,_modalStack:[],_faInjected:!1,setup(t={}){const e=t,{duration:o,maxVisible:r}=e,i=ve(e,["duration","maxVisible"]);typeof o=="number"&&(this._defaults.duration=o),typeof r=="number"&&(this._defaults.maxVisible=r),typeof t.autoDedupe=="boolean"&&(this._defaults.autoDedupe=t.autoDedupe),t.maxVisiblePerType&&(this._defaults.maxVisiblePerType=q(this._defaults.maxVisiblePerType,t.maxVisiblePerType)),typeof t.parallaxMode=="boolean"&&(this._defaults.parallaxMode=t.parallaxMode),typeof t.autoFetchFA=="boolean"&&(this._defaults.autoFetchFA=t.autoFetchFA),this._config=q(this._config,i),this._registerTypes()},use(t){typeof t=="function"&&this._plugins.push(t)},addType(t,e={}){this._config[t]=e,this._registerTypes()},defineTheme(t,e={}){A[t]=q(A[t]||{},e)},setTheme(t){this._theme=t,E&&this._roots.forEach(e=>e.dataset.theme=t)},clear(){this._queue=new X,this._queueDedupe.clear()},destroy(){this.clear(),E&&(this._roots.forEach(t=>{try{t.remove()}catch(e){}}),this._roots.clear())},promise(t,e={}){if(!t||typeof t.then!="function"){this._warn("promise expects a Promise");return}const o={id:J()}.id,r=e.timeout;this._enqueue("loading",H(R({},we(e.loading,"Loading...")),{groupId:o,duration:0}));let i=null;r&&(i=setTimeout(()=>{this._enqueue("error",{message:e.timeoutMessage||"Request timeout",groupId:o}),n()},r));const n=()=>{i&&clearTimeout(i)};return t.then(u=>{n(),this._enqueue("success",H(R({},de(e.success,u,"Success")),{groupId:o}))}).catch(u=>{n(),this._enqueue("error",H(R({},de(e.error,u,"Error")),{groupId:o}))}),{cancel:()=>{this._enqueue("info",{message:e.cancelMessage||"Cancelled",groupId:o}),i&&clearTimeout(i)}}},modal(t={}){var e;if(!E)return;this._defaults.injectCSS!==!1&&le(this._defaults.css||B);const o=q({title:"",message:"",html:null,block:!0,blur:!0,closeOnOverlay:!0,closable:!0,animation:"scale",actions:[],theme:this._theme},t),r=A[o.theme]||A.dark,i=document.createElement("div");i.className="jt-modal-overlay",o.block?i.style.pointerEvents="all":i.style.pointerEvents="none",o.blur||(i.style.backdropFilter="none",i.style.webkitBackdropFilter="none");const n=document.createElement("div");if(n.className=`jt-modal jt-anim-${o.animation}`,n.style.background=r.bg,n.style.color=r.color,n.style.border=r.border||"none",o.title){const m=document.createElement("div");m.className="jt-modal-header",m.textContent=o.title,n.appendChild(m)}const u=document.createElement("div");if(u.className="jt-modal-body",o.html?u.innerHTML=$(o.html):u.textContent=o.message||"",n.appendChild(u),(e=o.actions)!=null&&e.length){const m=document.createElement("div");m.className="jt-modal-actions",o.actions.forEach(f=>{const j=document.createElement("button");j.className="jt-modal-btn"+(f.primary?" primary":""),j.textContent=f.label||"OK",j.onclick=S=>{var M;S.stopPropagation(),(M=f.onClick)==null||M.call(f,S),f.closeOnClick!==!1&&p()},m.appendChild(j)}),n.appendChild(m)}i.appendChild(n),document.body.appendChild(i),this._modalStack.push(i),o.block&&(document.body.style.overflow="hidden"),requestAnimationFrame(()=>{i.classList.add("show"),n.classList.add("show")});const b=m=>{m.key==="Escape"&&p()};o.closable&&(o.closeOnOverlay&&i.addEventListener("click",m=>{m.target===i&&p()}),document.addEventListener("keydown",b));const p=()=>{i.classList.remove("show"),n.classList.remove("show"),setTimeout(()=>{try{i.remove()}catch(f){}o.block&&(document.body.style.overflow=""),document.removeEventListener("keydown",b);const m=this._modalStack.indexOf(i);m>=0&&this._modalStack.splice(m,1)},300)};return{close:p}},_registerTypes(){Object.keys(this._config).forEach(t=>{if(typeof this[t]=="function"&&!this[t].__auto)return;const e=o=>this._enqueue(t,o);e.__auto=!0,this[t]=e})},_enqueue(t,e={}){var o,r;const i=typeof e.priority=="number"?e.priority:(r=(o=this._priorityMap)==null?void 0:o[e.priority])!=null?r:2,n=e.dedupeKey||(this._defaults.autoDedupe?this._computeDedupeKey(t,e):void 0);if(n&&this._queueDedupe.has(n)){this._defaults.dev&&console.log("[JuiceToast] deduped (queue)",n);return}const u={id:J(),type:t,payload:e,priority:i};return n&&this._queueDedupe.add(n),this._queue.push(u,i),this._processQueue(),u.id},_processQueue(){var t;if(!E)return;const e=this._defaults.maxVisible;for(;this._queue.size>0;){const o=this._queue.pop();if(!o)break;const r=((t=o.payload)==null?void 0:t.position)||"bottom-right",i=this._getRoot(r);if(!i)break;if(Array.from(i.children).length>=e){this._queue.push(o,o.priority-.001);break}const n=(this._defaults.maxVisiblePerType||{})[o.type];if(typeof n=="number"&&Array.from(i.children).filter(u=>u.dataset.toastType===o.type).length>=n){this._queue.push(o,o.priority-.001);break}this._showToast(o.type,o.payload,o.id)}},_getRoot(t="bottom-right"){if(!E)return null;if(this._roots.has(t))return this._roots.get(t);const e=document.createElement("div");switch(e.id=`juice-toast-root-${t}`,e.dataset.position=t,e.dataset.theme=this._theme,e.style.pointerEvents="none",e.style.display="flex",e.style.flexDirection="column",this._defaults.parallaxMode&&(e.dataset.parallax="true"),t){case"top-left":e.style.top="20px",e.style.left="20px";break;case"top-right":e.style.top="20px",e.style.right="20px";break;case"bottom-left":e.style.bottom="20px",e.style.left="20px";break;case"bottom-right":e.style.bottom="20px",e.style.right="20px";break;case"top-center":e.style.top="20px",e.style.left="50%",e.style.transform="translateX(-50%)";break;case"bottom-center":e.style.bottom="20px",e.style.left="50%",e.style.transform="translateX(-50%)";break;default:e.style.bottom="20px",e.style.right="20px"}if(document.body.appendChild(e),this._defaults.parallaxMode){const o=r=>{const i=e.getBoundingClientRect(),n=i.left+i.width/2,u=i.top+i.height/2,b=r.touches?r.touches[0].clientX:r.clientX,p=r.touches?r.touches[0].clientY:r.clientY;Array.from(e.children).forEach((m,f)=>{const j=(f+1)/Math.max(1,e.children.length),S=Q((b-n)/i.width*j*8,-12,12),M=Q((p-u)/i.height*j*6,-10,10);m.style.setProperty("--jt-parallax-x",`${S}px`),m.style.setProperty("--jt-parallax-y",`${M}px`)})};e._parallaxHandler=o,e.addEventListener("mousemove",o),e.addEventListener("touchmove",o,{passive:!0}),e.dataset.parallax="true"}return this._roots.set(t,e),e},_warn(t){this._defaults.dev&&typeof console!="undefined"&&console.warn("[JuiceToast]",t)},_ensureFA(){if(!(!E||this._faInjected||!this._defaults.autoFetchFA)){if(document.querySelector('link[href*="fontawesome"], link[href*="font-awesome"], link[href*="cdnjs.cloudflare.com/ajax/libs/font-awesome"]')){this._faInjected=!0;return}try{const t=document.createElement("link");t.rel="stylesheet",t.href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css",t.crossOrigin="anonymous",document.head.appendChild(t),this._faInjected=!0}catch(t){console.error("[JuiceToast]: Fetching icons failed:",t)}}},_playSound(t){if(!E)return;const e=typeof t=="string"&&t?t:this._defaults.playSound;if(e)try{const o=new Audio(e);o.volume=.6,o.play().catch(()=>{})}catch(o){}},_updateStackPositionsFor(t){const e=Array.from(t.children);t.dataset.position&&t.dataset.position.includes("bottom"),e.forEach((o,r)=>{const i=r,n=i*12;o.style.setProperty("--jt-stack-y",`-${n}px`),o.style.setProperty("--jt-stack-scale",1-i*.04),o.style.setProperty("--jt-stack-opacity",1-i*.12),o.style.zIndex=1e3-i})},_runPlugins(t){this._plugins.forEach(e=>{try{e(t)}catch(o){this._warn("Plugin error: "+((o==null?void 0:o.message)||o))}})},_normalizeGlass(t){if(t===!0)return 60;if(!t)return 0;const e=Number(t);return Number.isFinite(e)?Q(e,0,100):0},_computeDedupeKey(t,e){try{const o=t||"",r=e.title||"",i=e.message||e.html||"";return`${o}::${String(r).trim().slice(0,200)}::${String(i).trim().slice(0,500)}`}catch(o){return}},_showToast(t,e={},o){var r,i,n,u,b,p,m,f,j,S,M,ue,pe,me,he;if(!E)return;this._defaults.injectCSS!==!1&&le(this._defaults.css||B),this._ensureFA();const ke=this._config[t]||{},Ee=typeof e=="object"?e:{message:String(e)},a=q(ke,Ee);a.icon=(r=a.icon)!=null?r:a.icon_left_top,a.position=(n=(i=a.position)!=null?i:a.toast)!=null?n:"bottom-right",a.closable=(b=(u=a.closable)!=null?u:a.closeable)!=null?b:!0,a.duration=typeof a.duration=="number"?a.duration:this._defaults.duration;const V=A[a.theme||this._theme]||{},_=o||J(),Y=a.dedupeKey||(this._defaults.autoDedupe?this._computeDedupeKey(t,a):void 0);if(Y)for(const l of this._roots.values()){const c=Array.from(l.children).find(g=>g.dataset.dedupeKey===Y);if(c){let g=c.querySelector(".jt-count");if(g||(g=document.createElement("span"),g.className="jt-count",g.style.marginLeft="6px",(p=c.querySelector(".jt-title"))==null||p.appendChild(g),g.textContent="1"),g.textContent=String(parseInt(g.textContent||"1")+1),a.mergeMessage){const v=c.querySelector(".jt-message");v&&(a.html?v.innerHTML=$(a.html):v.textContent=String(a.message||""))}return c.dataset.toastId}}const s=document.createElement("div");if(s.className="juice-toast",s.dataset.toastId=_,s.dataset.position=a.position,s.dataset.toastType=t,Y&&(s.dataset.dedupeKey=Y),s.tabIndex=0,s.setAttribute("role","status"),s.style.position="relative",s.style.pointerEvents="auto",s.style.background=a.bg||V.bg,s.style.color=a.color||V.color,s.style.border=a.border||V.border||"none",s.style.minHeight=s.style.minHeight||"",s.style.setProperty("--jt-parallax-x","0px"),s.style.setProperty("--jt-parallax-y","0px"),s.style.setProperty("--jt-drag-x","0px"),s.style.setProperty("--jt-drag-y","0px"),s.style.setProperty("--jt-stack-scale","1"),a.size&&ce[a.size]){const l=ce[a.size];l.width&&(s.style.width=l.width),l.padding&&(s.style.padding=l.padding)}const k=document.createElement("div");if(k.className="jt-content",a.title){const l=document.createElement("div");l.className="jt-title",l.textContent=a.title,k.appendChild(l)}const F=document.createElement("div");if(F.className="jt-message",a.html?F.innerHTML=$(a.html):typeof a.message=="string"?a.message.split(/(`[^`]+`)/g).forEach(l=>{if(l.startsWith("`")&&l.endsWith("`")){const c=document.createElement("code");c.textContent=l.slice(1,-1),F.appendChild(c)}else F.appendChild(document.createTextNode(l))}):a.message&&(F.textContent=String(a.message)),k.appendChild(F),Array.isArray(a.actions)&&a.actions.length){const l=document.createElement("div");l.className="jt-actions",a.actions.forEach(c=>{const g=document.createElement("button");g.className="jt-action",g.textContent=c.label||"Action",g.onclick=v=>{var D;v.stopPropagation(),(D=c.onClick)==null||D.call(c,v),c.closeOnClick&&this.remove(_)},l.appendChild(g)}),k.appendChild(l)}a.bgImage?(s.style.backgroundImage=`url(${a.bgImage})`,s.style.backgroundSize=a.bgSize||"cover",s.style.backgroundPosition=a.bgPosition||"center"):s.style.background=a.bg||V.bg;let y=null;if(a.icon){y=document.createElement("i");const l=a.icon.startsWith("fa")?a.icon:`fa-${a.icon}`;if(y.className=["icon",a.iconPack||"",l].join(" ").trim(),a.iconSize&&(y.style.fontSize=a.iconSize),!O){const c=a.iconAnim||je[t];c&&y.classList.add(c)}(a.iconLink||a.iconAnimate)&&(y.classList.add("icon-clickable"),y.addEventListener("click",c=>{c.stopPropagation(),a.iconAnimate&&(y.classList.remove(a.iconAnimate),y.offsetWidth,y.classList.add(a.iconAnimate)),a.iconLink&&window.open(a.iconLink,"_blank","noopener")}))}let h=null;if(a.avatar){h=document.createElement("img");const l=typeof a.avatar=="string"&&a.avatar?a.avatar:a.avatarSrc||"";l&&(h.src=l),h.alt=a.avatarAlt||a.title||"avatar",h.className="jt-avatar",h.loading=a.avatarLazy?"lazy":"eager",h.style.width=h.style.width||"36px",h.style.height=h.style.height||"36px",h.style.borderRadius=h.style.borderRadius||"50%",h.style.objectFit=h.style.objectFit||"cover",h.style.flexShrink="0";const c=a.avatarPosition||"left";c==="left"?h.style.marginRight=(m=a.avatarSpacing)!=null?m:"10px":c==="right"?h.style.marginLeft=(f=a.avatarSpacing)!=null?f:"10px":c==="top"&&(h.style.marginBottom=(j=a.avatarSpacing)!=null?j:"8px")}const G=a.avatarPosition||"left";h&&G==="top"?(s.classList.add("jt-avatar-top"),s.style.flexDirection="column",s.style.alignItems="flex-start",s.appendChild(h),y&&a.iconPosition==="top"?(s.appendChild(y),s.appendChild(k)):y&&a.iconPosition==="right"?(s.appendChild(k),s.appendChild(y)):(y&&s.appendChild(y),s.appendChild(k))):(s.style.flexDirection="row",s.style.alignItems="center",h&&G==="left"&&s.appendChild(h),y&&a.iconPosition==="right"?(s.appendChild(k),s.appendChild(y)):y&&a.iconPosition==="top"?(s.classList.add("jt-icon-top"),s.appendChild(y),s.appendChild(k)):(y&&s.appendChild(y),s.appendChild(k)),h&&G==="right"&&s.appendChild(h));let I=null;if(a.progress&&((S=a.duration)!=null?S:this._defaults.duration)>0&&(I=document.createElement("div"),I.className="jt-progress",a.progressColor&&(I.style.background=a.progressColor),s.appendChild(I)),a.undo){const l=document.createElement("button");l.className="jt-action",l.textContent="Undo",l.onclick=()=>{try{a.undo()}catch(c){}this.remove(_)},k.appendChild(l)}if(a.closable){const l=document.createElement("span");l.className="juice-toast-close",l.tabIndex=0,l.textContent="\xD7",l.style.marginLeft="8px",l.addEventListener("click",c=>{c.stopPropagation(),this.remove(_)}),s.appendChild(l)}const C=this._getRoot(a.position||"bottom-right");if(!C)return;if(a.groupId){const l=Array.from(C.children).find(c=>c.dataset.groupId===a.groupId);if(l){let c=l.querySelector(".jt-count");c||(c=document.createElement("span"),c.className="jt-count",c.style.marginLeft="6px",(M=l.querySelector(".jt-title"))==null||M.appendChild(c),c.textContent="1"),c.textContent=String(parseInt(c.textContent||"1")+1);return}s.dataset.groupId=a.groupId}const fe=this._defaults.maxVisible;fe&&C.children.length>=fe&&C.removeChild(C.firstElementChild),C.appendChild(s);const d={id:_,toast:s,cfg:a,type:t,createdAt:x(),remaining:(ue=a.duration)!=null?ue:this._defaults.duration,raf:null,timer:null,start:x(),paused:!1,_boundMove:null,_boundUp:null,_onPointerDown:null,_onEnter:null,_onLeave:null,dedupeKey:Y,hooks:{onShow:a.onShow,onShown:a.onShown,onClose:a.onClose,onRemoved:a.onRemoved}};this._activeMap.set(_,d);try{(me=(pe=d.hooks).onShow)==null||me.call(pe,{id:_,toast:s,cfg:a,type:t})}catch(l){}this._runPlugins({toast:s,cfg:a,type:t,root:C,meta:d}),this._updateStackPositionsFor(C),requestAnimationFrame(()=>{var l,c;O?(s.style.opacity="1",(c=(l=d.hooks).onShown)==null||c.call(l,{id:_,toast:s,cfg:a,type:t})):(s.classList.add("show"),setTimeout(()=>{var g,v;try{(v=(g=d.hooks).onShown)==null||v.call(g,{id:_,toast:s,cfg:a,type:t})}catch(D){}},320))});let ye=0,ge=0,L=0,z=0,Z=!1,T=null,ee=0;const te=l=>{const c=l.touches?l.touches[0]:l;ye=c.clientX,ge=c.clientY,L=0,z=0,Z=!0,T=null,d.paused=!0,d.raf&&(cancelAnimationFrame(d.raf),d.raf=null),s.style.transition="none",d._boundMove=Ce,d._boundUp=Le,document.addEventListener("touchmove",d._boundMove,{passive:!0}),document.addEventListener("mousemove",d._boundMove),document.addEventListener("touchend",d._boundUp),document.addEventListener("mouseup",d._boundUp),ee=x()},Ce=l=>{if(!Z)return;const c=l.touches?l.touches[0]:l;L=c.clientX-ye,z=c.clientY-ge,T||(Math.abs(L)>6?T="x":Math.abs(z)>6&&(T="y")),T==="x"?s.style.setProperty("--jt-drag-x",`${L}px`):T==="y"&&s.style.setProperty("--jt-drag-y",`${z}px`),ee=x(),c.clientX},Le=l=>{Z=!1,d.paused=!1;const c=Math.abs(L),g=Math.abs(z),v=T||(c>g?"x":"y"),D=Math.max(1,x()-ee),Se=D?L/D*1e3:0,Me=v==="x"&&(c>(w._defaults.swipeThreshold||60)||Math.abs(Se)>800),Te=v==="y"&&g>(w._defaults.swipeThreshold||80);if(Me||Te){const qe=L>=0?1:-1;v==="x"?s.style.setProperty("--jt-drag-x",`${qe*1e3}px`):s.style.setProperty("--jt-drag-y","1000px"),s.classList.add("swipe-dismissing"),setTimeout(()=>this.remove(_),220)}else s.style.transition="transform 0.22s ease-out, opacity 0.22s ease-out",s.style.setProperty("--jt-drag-x","0px"),s.style.setProperty("--jt-drag-y","0px");L=z=0,d._boundMove&&(document.removeEventListener("touchmove",d._boundMove),document.removeEventListener("mousemove",d._boundMove),d._boundMove=null),d._boundUp&&(document.removeEventListener("touchend",d._boundUp),document.removeEventListener("mouseup",d._boundUp),d._boundUp=null),ne()};s._onPointerDown=te,s.addEventListener("touchstart",te,{passive:!0}),s.addEventListener("mousedown",te);const oe=()=>{d.paused=!0,d.raf&&(cancelAnimationFrame(d.raf),d.raf=null)},ae=()=>{d.paused&&(d.paused=!1,d.start=x(),ne())};d._onEnter=oe,d._onLeave=ae,s.addEventListener("mouseenter",oe),s.addEventListener("mouseleave",ae),s.addEventListener("focusin",oe),s.addEventListener("focusout",ae);const K=(he=a.duration)!=null?he:this._defaults.duration;function be(){if(!w._activeMap.has(_))return;if(d.paused){d.raf=null,d.start=x();return}const l=x()-d.start;if(d.remaining-=l,d.start=x(),I){const c=Math.max(0,d.remaining/K);I.style.transform=`scaleX(${c})`}if(d.remaining<=0){O||s.classList.remove("show"),setTimeout(()=>w.remove(_),280),d.raf=null;return}d.raf=requestAnimationFrame(be)}const ne=()=>{K<=0||d.raf||d.paused||(d.start=x(),d.raf=requestAnimationFrame(be))};K>0&&(d.start=x(),d.remaining=K,ne());const Pe=()=>this.remove(_);return a.undoTimeout&&(d.timer=setTimeout(Pe,a.undoTimeout)),(a.playSound||this._defaults.playSound)&&this._playSound(a.playSound||this._defaults.playSound),_},remove(t){var e,o,r,i;const n=this._activeMap.get(t);if(!n)return!1;const{toast:u,cfg:b,type:p}=n;try{(o=(e=n.hooks).onClose)==null||o.call(e,{id:t,toast:u,cfg:b,type:p})}catch(f){}O?u.style.opacity="0":u.classList.add("hide");try{u._onPointerDown&&(u.removeEventListener("touchstart",u._onPointerDown),u.removeEventListener("mousedown",u._onPointerDown))}catch(f){}if(n._boundMove){try{document.removeEventListener("touchmove",n._boundMove),document.removeEventListener("mousemove",n._boundMove)}catch(f){}n._boundMove=null}if(n._boundUp){try{document.removeEventListener("touchend",n._boundUp),document.removeEventListener("mouseup",n._boundUp)}catch(f){}n._boundUp=null}try{n._onEnter&&u.removeEventListener("mouseenter",n._onEnter),n._onLeave&&u.removeEventListener("mouseleave",n._onLeave),n._onEnter&&u.removeEventListener("focusin",n._onEnter),n._onLeave&&u.removeEventListener("focusout",n._onLeave)}catch(f){}n.raf&&(cancelAnimationFrame(n.raf),n.raf=null),n.timer&&(clearTimeout(n.timer),n.timer=null),this._activeMap.delete(t);const m=u.parentNode;if(m&&m.removeChild(u),m&&this._updateStackPositionsFor(m),n.dedupeKey)try{this._queueDedupe.delete(n.dedupeKey)}catch(f){}try{(i=(r=n.hooks).onRemoved)==null||i.call(r,{id:t,cfg:b,type:p})}catch(f){}return!0},update(t,e={}){const o=this._activeMap.get(t);if(!o)return this._warn("update: id not found "+t),!1;const{toast:r}=o;if(o.cfg=q(o.cfg,e),o.cfg.title){const u=r.querySelector(".jt-title");u&&(u.textContent=o.cfg.title)}const i=r.querySelector(".jt-message");i&&(o.cfg.html?i.innerHTML=$(o.cfg.html):i.textContent=String(o.cfg.message||""));const n=A[o.cfg.theme||this._theme]||{};return r.style.background=o.cfg.bg||n.bg,r.style.color=o.cfg.color||n.color,r.style.border=o.cfg.border||n.border||"none",o.cfg.duration!==void 0&&(o.remaining=o.cfg.duration,o.start=x(),!o.paused&&!o.raf&&(o.raf=requestAnimationFrame(function u(){var b;if(!w._activeMap.has(t))return;const p=w._activeMap.get(t);if(!p)return;const m=x()-p.start;p.remaining-=m,p.start=x();const f=p.toast.querySelector(".jt-progress");if(f){const j=Math.max(0,p.remaining/((b=p.cfg.duration)!=null?b:w._defaults.duration));f.style.transform=`scaleX(${j})`}if(p.remaining<=0){O||p.toast.classList.remove("show"),setTimeout(()=>w.remove(t),280);return}p.raf=requestAnimationFrame(u)}))),this._runPlugins({toast:r,cfg:o.cfg,type:o.type,meta:o}),!0},_priorityMap:{low:1,normal:2,high:3,urgent:4}};function we(t,e){return t?typeof t=="string"?{message:t}:t:{message:e}}function de(t,e,o){return t?typeof t=="function"?{message:t(e)}:typeof t=="string"?{message:t}:t:{message:o}}w.setup({success:{icon:"fa-check",iconPack:"fas",bg:"#16a34a",progress:!0,duration:4e3},error:{icon:"fa-xmark",iconPack:"fas",bg:"#dc2626",progress:!0,duration:4e3},info:{icon:"fa-circle-info",iconPack:"fas",bg:"#2563eb",progress:!0,duration:4e3},warning:{icon:"fa-triangle-exclamation",iconPack:"fas",bg:"#f59e0b",progress:!0,duration:4e3},loading:{icon:"fa-spinner",iconPack:"fas",iconAnim:"jt-spin",duration:0,progress:!0}}),P.default=w,P.juiceToast=w,Object.defineProperty(P,"__esModule",{value:!0})}));
251
+
252
+ .jt-modal{
253
+ width:100%;
254
+ max-width:520px;
255
+ border-radius:18px;
256
+ padding:24px;
257
+ opacity:0;
258
+ transform:translateY(40px) scale(.96);
259
+ transition:transform .35s cubic-bezier(.16,1,.3,1),opacity .25s ease;
260
+ will-change:transform,opacity;
261
+ }
262
+
263
+ .jt-modal.show{
264
+ opacity:1;
265
+ transform:translateY(0) scale(1);
266
+ }
267
+
268
+ .jt-modal-btn{
269
+ padding:8px 14px;
270
+ border-radius:8px;
271
+ font-size:14px;
272
+ cursor:pointer;
273
+ border:none;
274
+ transition:all .18s ease;
275
+ }
276
+
277
+ /* PRIMARY */
278
+
279
+ .jt-modal-btn.primary{
280
+ background:#3b82f6;
281
+ color:#fff;
282
+ }
283
+
284
+ .jt-modal-btn.primary:hover{
285
+ background:#2563eb;
286
+ }
287
+
288
+ /* SECONDARY */
289
+
290
+ .jt-modal-btn.secondary{
291
+ background:#e5e7eb;
292
+ color:#111;
293
+ }
294
+
295
+ .jt-modal-btn.secondary:hover{
296
+ background:#d1d5db;
297
+ }
298
+
299
+ /* OUTLINE */
300
+
301
+ .jt-modal-btn.outline{
302
+ background:transparent;
303
+ border:1px solid currentColor;
304
+ color:inherit;
305
+ }
306
+
307
+ .jt-modal-btn.outline:hover{
308
+ background:rgba(255,255,255,.06);
309
+ }
310
+
311
+ /* PARALLAX */
312
+
313
+ [data-juice-root][data-parallax="true"] .juice-toast{
314
+ transition:transform .12s cubic-bezier(.2,.8,.2,1),opacity .2s;
315
+ }
316
+
317
+ /* GLASS FEATURE */
318
+
319
+ [data-juice-root][data-glass="true"] .juice-toast{
320
+ background:rgba(30,30,30,.55);
321
+ backdrop-filter:blur(14px) saturate(140%);
322
+ border:1px solid rgba(255,255,255,.08);
323
+ }
324
+
325
+ /* REDUCED MOTION */
326
+
327
+ @media (prefers-reduced-motion:reduce){
328
+ .juice-toast,
329
+ .jt-modal{
330
+ animation:none!important;
331
+ transition:none!important;
332
+ }
333
+ }
334
+ `;function te(e=B){if(!P||me||(me=!0,document.getElementById("juice-toast-style")))return;const a=document.createElement("style");a.id="juice-toast-style",a.textContent=e,document.head.appendChild(a)}const ae=(()=>{let e=1;return()=>"jt-"+Date.now().toString(36)+"-"+e++})();function w(){return Date.now()}function D(e,a){return Object.assign({},e||{},a||{})}function M(e,a,t){return Math.max(a,Math.min(t,e))}function U(e,a,t){return e+(a-e)*t}function J(e){if(!e)return"";const a=document.createElement("template");a.innerHTML=e,a.content.querySelectorAll("script, style, iframe, object, embed").forEach(i=>i.remove());const t=new Set(["b","i","u","strong","em","code","pre","ul","ol","li","br","p","span","img","h1","h2","h3","h4","h5","h6","a"]),l=/^(https?:\/\/|mailto:|tel:|\/\/)/i;return(function i(r){Array.from(r.childNodes).forEach(s=>{if(s.nodeType===1){const p=s.tagName.toLowerCase();t.has(p)?(Array.from(s.attributes||[]).forEach(f=>{const h=f.name.toLowerCase(),u=(f.value||"").trim();h.startsWith("on")?s.removeAttribute(f.name):h==="src"||h==="href"||h==="xlink:href"?l.test(u)?/^data:\s*image\/svg\+xml/i.test(u)&&s.removeAttribute(f.name):s.removeAttribute(f.name):(p==="img"&&h==="srcset"||h==="style")&&s.removeAttribute(f.name)}),i(s)):s.replaceWith(...Array.from(s.childNodes))}})})(a.content),a.innerHTML}const N={dark:{bg:"linear-gradient(180deg,#1f2937,#111827)",color:"#fff",border:"1px solid rgba(255,255,255,.06)"},light:{bg:"#fff",color:"#111",border:"1px solid #e5e7eb"},glass:{bg:"rgba(30,30,30,.35)",color:"#fff",border:"1px solid rgba(255,255,255,.1)"}},fe={sm:{width:"260px",padding:"10px"},md:{width:"320px",padding:"14px"},lg:{width:"420px",padding:"18px"}},Ee={success:"jt-bounce",error:"jt-shake",warning:"jt-shake",info:"jt-pulse",loading:"jt-spin"},$={_defaults:{duration:2500,maxVisible:3,swipeThreshold:60,glassUI:0,glassOnly:!1,playSound:null,dev:!1,injectCSS:!0,css:null,autoDedupe:!1,maxVisiblePerType:{},parallaxMode:!1,autoFetchFA:!0,use3d:!1,parallaxSmoothing:.12,_maxRequeueRetries:8},_config:{},_theme:"dark",_plugins:[],_queue:new K,_queueDedupe:new Set,_activeMap:new Map,_roots:new Map,_modalStack:[],_faInjected:!1,_schedulerRunning:!1,_schedulerLast:0,_schedulerRAF:null,_pausedAll:!1,setup(e={}){const a=e,{duration:t,maxVisible:l}=a,i=je(a,["duration","maxVisible"]);typeof t=="number"&&(this._defaults.duration=t),typeof l=="number"&&(this._defaults.maxVisible=l),typeof e.autoDedupe=="boolean"&&(this._defaults.autoDedupe=e.autoDedupe),e.maxVisiblePerType&&(this._defaults.maxVisiblePerType=D(this._defaults.maxVisiblePerType,e.maxVisiblePerType)),typeof e.parallaxMode=="boolean"&&(this._defaults.parallaxMode=e.parallaxMode),typeof e.autoFetchFA=="boolean"&&(this._defaults.autoFetchFA=e.autoFetchFA),typeof e.use3d=="boolean"&&(this._defaults.use3d=e.use3d),typeof e.parallaxSmoothing=="number"&&(this._defaults.parallaxSmoothing=M(e.parallaxSmoothing,0,1)),typeof e._maxRequeueRetries=="number"&&(this._defaults._maxRequeueRetries=e._maxRequeueRetries),this._config=D(this._config,i),this._registerTypes(),this._defaults.injectCSS!==!1&&te(this._defaults.css||B)},use(e){typeof e=="function"&&this._plugins.push(e)},addType(e,a={}){this._config[e]=a,this._registerTypes()},defineTheme(e,a={}){N[e]=D(N[e]||{},a)},setTheme(e){this._theme=e,P&&this._roots.forEach(a=>a.dataset.theme=e)},clear(){this._queue=new K,this._queueDedupe.clear()},destroy(){this.clear(),P&&(this._roots.forEach(e=>{try{e._parallaxRAF&&cancelAnimationFrame(e._parallaxRAF),e._parallaxHandler&&(e.removeEventListener("mousemove",e._parallaxHandler),e.removeEventListener("touchmove",e._parallaxHandler)),e._parallaxReset&&(e.removeEventListener("mouseleave",e._parallaxReset),e.removeEventListener("touchend",e._parallaxReset)),e.remove()}catch(a){}}),this._roots.clear(),Array.from(this._activeMap.keys()).forEach(e=>this.remove(e)),this._stopScheduler())},promise(e,a={}){if(!e||typeof e.then!="function"){this._warn("promise expects a Promise");return}const t=ae(),l=a.timeout;let i=null,r=!1,s=!1;const p=()=>{i&&(clearTimeout(i),i=null)};return this._enqueue("loading",ee(Z({},ke(a.loading,"Loading...")),{groupId:t,duration:0})),l&&(i=setTimeout(()=>{s||r||(s=!0,p(),this._enqueue("error",{message:a.timeoutMessage||"Request timeout",groupId:t}))},l)),e.then(f=>{r||s||(s=!0,p(),this._enqueue("success",ee(Z({},ye(a.success,f,"Success")),{groupId:t})))}).catch(f=>{r||s||(s=!0,p(),this._enqueue("error",ee(Z({},ye(a.error,f,"Error")),{groupId:t})))}),{cancel:()=>{r||s||(r=!0,p(),this._enqueue("info",{message:a.cancelMessage||"Cancelled",groupId:t}))}}},modal(e={}){var a;if(!P)return;this._defaults.injectCSS!==!1&&te(this._defaults.css||B);const t=D({title:"",message:"",html:null,block:!0,blur:!0,closeOnOverlay:!0,closable:!0,animation:"scale",actions:[],theme:this._theme,use3d:void 0},e),l=t.use3d===void 0?this._defaults.use3d:!!t.use3d,i=N[t.theme]||N.dark,r=document.createElement("div");r.className="jt-modal-overlay",r.style.pointerEvents=t.block?"all":"none",t.blur||(r.style.backdropFilter="none",r.style.webkitBackdropFilter="none");const s=document.createElement("div");if(s.className=`jt-modal jt-anim-${t.animation}`,s.style.background=i.bg,s.style.color=i.color,s.style.border=i.border||"none",l&&(r.style.perspective=r.style.perspective||"900px",s.style.transform="translateY(40px) scale(.96) rotateX(8deg)"),t.title){const u=document.createElement("div");u.className="jt-modal-header",u.textContent=t.title,s.appendChild(u)}const p=document.createElement("div");if(p.className="jt-modal-body",t.html?p.innerHTML=J(t.html):p.textContent=t.message||"",s.appendChild(p),(a=t.actions)!=null&&a.length){const u=document.createElement("div");u.className="jt-modal-actions",t.actions.forEach(y=>{const _=document.createElement("button"),v=y.buttonType||(y.primary?"primary":"secondary");_.className=`jt-modal-btn ${v}`,_.textContent=y.label||"OK",_.onclick=j=>{var L;j.stopPropagation(),(L=y.onClick)==null||L.call(y,j),y.closeOnClick!==!1&&h()},u.appendChild(_)}),s.appendChild(u)}r.appendChild(s),document.body.appendChild(r),this._modalStack.push(r),t.block&&(document.body.style.overflow="hidden"),requestAnimationFrame(()=>{r.classList.add("show"),s.classList.add("show"),l&&(s.style.transform="translateY(0) scale(1) rotateX(0deg)")});const f=u=>{u.key==="Escape"&&h()};t.closable&&(t.closeOnOverlay&&r.addEventListener("click",u=>{u.target===r&&h()}),document.addEventListener("keydown",f));const h=()=>{r.classList.remove("show"),s.classList.remove("show"),l&&(s.style.transform="translateY(40px) scale(.96) rotateX(8deg)"),setTimeout(()=>{try{r.remove()}catch(y){}t.block&&(document.body.style.overflow=""),document.removeEventListener("keydown",f);const u=this._modalStack.indexOf(r);u>=0&&this._modalStack.splice(u,1)},300)};return{close:h}},_registerTypes(){Object.keys(this._config).forEach(e=>{if(typeof this[e]=="function"&&!this[e].__auto)return;const a=t=>this._enqueue(e,t);a.__auto=!0,this[e]=a})},_enqueue(e,a={}){var t,l;const i=typeof a.priority=="number"?a.priority:(l=(t=this._priorityMap)==null?void 0:t[a.priority])!=null?l:2,r=a.dedupeKey||(this._defaults.autoDedupe?this._computeDedupeKey(e,a):void 0);if(r&&this._queueDedupe.has(r)){this._defaults.dev&&console.log("[JuiceToast] deduped (queue)",r);return}const s={id:ae(),type:e,payload:a,priority:i};return s._retries=0,r&&(s._dedupeKey=r,this._queueDedupe.add(r)),this._queue.push(s,i),this._scheduleProcessQueue(),s.id},_processQueueScheduled:!1,_scheduleProcessQueue(){this._processQueueScheduled||(this._processQueueScheduled=!0,setTimeout(()=>{this._processQueueScheduled=!1,this._processQueue()},40))},_processQueue(){var e,a;if(!P)return;const t=this._defaults.maxVisible||1/0;let l=0;for(;this._queue.size>0&&l<200;){l++;const i=this._queue.pop();if(!i)break;const r=((e=i.payload)==null?void 0:e.position)||((a=i.payload)==null?void 0:a.toast)||"bottom-right",s=this._getRoot(r);if(!s){if(i._retries=(i._retries||0)+1,i._retries>(this._defaults._maxRequeueRetries||8)){i._dedupeKey&&this._queueDedupe.delete(i._dedupeKey);continue}setTimeout(()=>{this._queue.push(i,i.priority)},120);break}if(Array.from(s.children).length>=t){if(i._retries=(i._retries||0)+1,i._retries>(this._defaults._maxRequeueRetries||8)){i._dedupeKey&&this._queueDedupe.delete(i._dedupeKey);continue}setTimeout(()=>this._queue.push(i,i.priority),160);break}const p=(this._defaults.maxVisiblePerType||{})[i.type];if(typeof p=="number"&&Array.from(s.children).filter(f=>f.dataset.toastType===i.type).length>=p){if(i._retries=(i._retries||0)+1,i._retries>(this._defaults._maxRequeueRetries||8)){i._dedupeKey&&this._queueDedupe.delete(i._dedupeKey);continue}setTimeout(()=>this._queue.push(i,i.priority),160);break}this._showToast(i.type,i.payload,i.id)}},_getRoot(e="bottom-right"){var a;if(!P)return null;if(this._roots.has(e))return this._roots.get(e);const t=document.createElement("div");switch(t.setAttribute("data-juice-root","1"),t.id=`juice-toast-root-${e}`,t.dataset.position=e,t.dataset.theme=this._theme,t.style.pointerEvents="none",t.style.display="flex",t.style.flexDirection="column",this._defaults.parallaxMode&&(t.dataset.parallax="true"),e){case"top-left":t.style.top="20px",t.style.left="20px";break;case"top-right":t.style.top="20px",t.style.right="20px";break;case"bottom-left":t.style.bottom="20px",t.style.left="20px";break;case"bottom-right":t.style.bottom="20px",t.style.right="20px";break;case"top-center":t.style.top="20px",t.style.left="50%",t.style.transform="translateX(-50%)";break;case"bottom-center":t.style.bottom="20px",t.style.left="50%",t.style.transform="translateX(-50%)";break;default:t.style.bottom="20px",t.style.right="20px"}if(document.body.appendChild(t),this._defaults.parallaxMode&&!F){const l=(a=this._defaults.parallaxSmoothing)!=null?a:.12;t._parallaxTargets=new WeakMap;const i=s=>{const p=t.getBoundingClientRect(),f=p.left+p.width/2,h=p.top+p.height/2,u=s.touches?s.touches[0].clientX:s.clientX,y=s.touches?s.touches[0].clientY:s.clientY;Array.from(t.children).forEach((_,v)=>{const j=(v+1)/Math.max(1,t.children.length),L=M((u-f)/p.width*j*12,-18,18),R=M((y-h)/p.height*j*8,-14,14),q=M(-j*8,-30,0),oe=M((u-f)/p.width*j*-6,-12,12),re=M((y-h)/p.height*j*4,-8,8),o={tx:L,ty:R,tz:q,rotX:re,rotY:oe,smoothing:l};t._parallaxTargets.set(_,o)}),this._startScheduler()},r=()=>{Array.from(t.children).forEach(s=>{t._parallaxTargets.set(s,{tx:0,ty:0,tz:0,rotX:0,rotY:0,smoothing:.16})}),this._startScheduler()};t._parallaxHandler=i,t._parallaxReset=r,t.addEventListener("mousemove",i),t.addEventListener("touchmove",i,{passive:!0}),t.addEventListener("mouseleave",r),t.addEventListener("touchend",r)}return this._roots.set(e,t),t},_warn(e){this._defaults.dev&&typeof console!="undefined"&&console.warn("[JuiceToast]",e)},_ensureFA(){if(!(!P||this._faInjected||!this._defaults.autoFetchFA)){if(document.querySelector('link[href*="fontawesome"], link[href*="font-awesome"], link[href*="cdnjs.cloudflare.com/ajax/libs/font-awesome"]')){this._faInjected=!0;return}try{const e=document.createElement("link");e.rel="stylesheet",e.href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css",e.crossOrigin="anonymous",document.head.appendChild(e),this._faInjected=!0}catch(e){console.error("[JuiceToast]: Fetching icons failed:",e)}}},_playSound(e){if(!P)return;const a=typeof e=="string"&&e?e:this._defaults.playSound;if(a)try{const t=new Audio(a);t.volume=.6,t.play().catch(()=>{})}catch(t){}},_updateStackPositionsFor(e){const a=Array.from(e.children);e.dataset.position&&e.dataset.position.includes("bottom"),a.forEach((t,l)=>{const i=l,r=i*12;t.style.setProperty("--jt-stack-y",`${-r}px`),t.style.setProperty("--jt-stack-scale",1-i*.04),t.style.setProperty("--jt-stack-opacity",1-i*.12),t.style.zIndex=1e3-i,t.style.setProperty("--jt-parallax-z",`${-i*2}px`),t.dataset.stack=String(i)})},_runPlugins(e){this._plugins.forEach(a=>{try{a(e)}catch(t){this._warn("Plugin error: "+((t==null?void 0:t.message)||t))}})},_normalizeGlass(e){if(e===!0)return 60;if(!e)return 0;const a=Number(e);return Number.isFinite(a)?M(a,0,100):0},_computeDedupeKey(e,a){try{const t=e||"",l=a.title||"",i=a.message||a.html||"";return`${t}::${String(l).trim().slice(0,200)}::${String(i).trim().slice(0,500)}`}catch(t){return}},_showToast(e,a={},t){var l,i,r,s,p,f,h,u,y,_,v,j,L,R,q;if(!P)return;this._defaults.injectCSS!==!1&&te(this._defaults.css||B),this._ensureFA();const oe=this._config[e]||{},re=typeof a=="object"?a:{message:String(a)},o=D(oe,re);o.icon=(l=o.icon)!=null?l:o.icon_left_top,o.position=(r=(i=o.position)!=null?i:o.toast)!=null?r:"bottom-right",o.closable=(p=(s=o.closable)!=null?s:o.closeable)!=null?p:!0,o.duration=typeof o.duration=="number"?o.duration:this._defaults.duration;const G=N[o.theme||this._theme]||{},k=t||ae(),H=o.dedupeKey||(this._defaults.autoDedupe?this._computeDedupeKey(e,o):void 0);if(H)for(const c of this._roots.values()){const d=Array.from(c.children).find(b=>b.dataset.dedupeKey===H);if(d){let b=d._cachedCountEl;if(b||(b=document.createElement("span"),b.className="jt-count",b.style.marginLeft="6px",(f=d.querySelector(".jt-title"))==null||f.appendChild(b),d._cachedCountEl=b,b.textContent="1"),b.textContent=String(parseInt(b.textContent||"1")+1),o.mergeMessage){const E=d.querySelector(".jt-message");E&&(o.html?E.innerHTML=J(o.html):E.textContent=String(o.message||""))}return d.dataset.toastId}}const n=document.createElement("div");if(n.className="juice-toast",n.dataset.toastId=k,n.dataset.position=o.position,n.dataset.toastType=e,H&&(n.dataset.dedupeKey=H),n.tabIndex=0,n.setAttribute("role",o.ariaRole||(e==="error"?"alert":"status")),n.getAttribute("aria-live")||(n.setAttribute("aria-live",e==="error"||e==="success"?"assertive":"polite"),n.setAttribute("aria-atomic","true")),n.style.position="relative",n.style.pointerEvents="auto",o.glassOnly?(n.style.background="rgba(255,255,255,0.35)",n.style.backdropFilter="blur(14px) saturate(140%)",n.style.webkitBackdropFilter="blur(14px) saturate(140%)",n.style.color="rgba(15,23,42,0.85)",n.style.border="1px solid rgba(0,0,0,0.08)",n.style.boxShadow="0 8px 28px rgba(0,0,0,0.08), inset 0 1px 0 rgba(255,255,255,0.25)"):(n.style.background=o.bg||G.bg,n.style.color=o.color||G.color,n.style.border=o.border||G.border||"none"),n.style.minHeight=n.style.minHeight||"",n.style.setProperty("--jt-parallax-x","0px"),n.style.setProperty("--jt-parallax-y","0px"),n.style.setProperty("--jt-parallax-z","0px"),n.style.setProperty("--jt-drag-x","0px"),n.style.setProperty("--jt-drag-y","0px"),n.style.setProperty("--jt-rot-x","0deg"),n.style.setProperty("--jt-rot-y","0deg"),n.style.setProperty("--jt-stack-y","0px"),n.style.setProperty("--jt-stack-scale","1"),o.size&&fe[o.size]){const c=fe[o.size];c.width&&(n.style.width=c.width),c.padding&&(n.style.padding=c.padding)}const S=document.createElement("div");S.className="jt-content";let V=null;o.title&&(V=document.createElement("div"),V.className="jt-title",V.textContent=o.title,S.appendChild(V));const I=document.createElement("div");if(I.className="jt-message",o.html?I.innerHTML=J(o.html):typeof o.message=="string"?o.message.split(/(`[^`]+`)/g).forEach(c=>{if(c.startsWith("`")&&c.endsWith("`")){const d=document.createElement("code");d.textContent=c.slice(1,-1),I.appendChild(d)}else I.appendChild(document.createTextNode(c))}):o.message&&(I.textContent=String(o.message)),S.appendChild(I),Array.isArray(o.actions)&&o.actions.length){const c=document.createElement("div");c.className="jt-actions",o.actions.forEach(d=>{const b=document.createElement("button");b.className="jt-action",b.textContent=d.label||"Action",b.onclick=E=>{var X;E.stopPropagation(),(X=d.onClick)==null||X.call(d,E),d.closeOnClick!==!1&&this.remove(k)},c.appendChild(b)}),S.appendChild(c)}o.glassOnly||(o.bgImage?(n.style.backgroundImage=`url(${o.bgImage})`,n.style.backgroundSize=o.bgSize||"cover",n.style.backgroundPosition=o.bgPosition||"center"):n.style.background=o.bg||G.bg);let x=null;if(o.icon){x=document.createElement("i");const c=String(o.icon).startsWith("fa")?o.icon:`fa-${o.icon}`;if(x.className=["icon",o.iconPack||"",c].join(" ").trim(),o.iconSize&&(x.style.fontSize=o.iconSize),!F){const d=o.iconAnim||Ee[e];d&&x.classList.add(d)}(o.iconLink||o.iconAnimate)&&(x.classList.add("icon-clickable"),x.addEventListener("click",d=>{d.stopPropagation(),o.iconAnimate&&(x.classList.remove(o.iconAnimate),x.offsetWidth,x.classList.add(o.iconAnimate)),o.iconLink&&window.open(o.iconLink,"_blank","noopener")}))}let g=null;if(o.avatar){g=document.createElement("img");const c=typeof o.avatar=="string"&&o.avatar?o.avatar:o.avatarSrc||"";c&&(g.src=c),g.alt=o.avatarAlt||o.title||"avatar",g.className="jt-avatar",g.loading=o.avatarLazy?"lazy":"eager",g.style.width=g.style.width||"36px",g.style.height=g.style.height||"36px",g.style.borderRadius=g.style.borderRadius||"50%",g.style.objectFit=g.style.objectFit||"cover",g.style.flexShrink="0";const d=o.avatarPosition||"left";d==="left"?g.style.marginRight=(h=o.avatarSpacing)!=null?h:"10px":d==="right"?g.style.marginLeft=(u=o.avatarSpacing)!=null?u:"10px":d==="top"&&(g.style.marginBottom=(y=o.avatarSpacing)!=null?y:"8px")}const se=o.avatarPosition||"left";g&&se==="top"?(n.classList.add("jt-avatar-top"),n.style.flexDirection="column",n.style.alignItems="flex-start",n.appendChild(g),x&&o.iconPosition==="top"?(n.appendChild(x),n.appendChild(S)):x&&o.iconPosition==="right"?(n.appendChild(S),n.appendChild(x)):(x&&n.appendChild(x),n.appendChild(S))):(n.style.flexDirection="row",n.style.alignItems="center",g&&se==="left"&&n.appendChild(g),x&&o.iconPosition==="right"?(n.appendChild(S),n.appendChild(x)):x&&o.iconPosition==="top"?(n.classList.add("jt-icon-top"),n.appendChild(x),n.appendChild(S)):(x&&n.appendChild(x),n.appendChild(S)),g&&se==="right"&&n.appendChild(g));let W=null;if(o.progress&&((_=o.duration)!=null?_:this._defaults.duration)>0&&(W=document.createElement("div"),W.className="jt-progress",o.progressColor&&(W.style.background=o.progressColor),n.appendChild(W)),o.undo){const c=document.createElement("button");c.className="jt-action",c.textContent="Undo",c.onclick=()=>{try{o.undo()}catch(d){}this.remove(k)},S.appendChild(c)}if(o.closable){const c=document.createElement("span");c.className="juice-toast-close",c.tabIndex=0,c.textContent="\xD7",c.style.marginLeft="8px",c.addEventListener("click",d=>{d.stopPropagation(),this.remove(k)}),n.appendChild(c)}const C=this._getRoot(o.position||"bottom-right");if(!C)return;if(o.groupId){const c=Array.from(C.children).find(d=>d.dataset.groupId===o.groupId);if(c){const d=c.dataset.toastId;return this.update(d,{title:o.title,message:o.message,html:o.html,bg:o.bg,color:o.color,duration:o.duration,icon:o.icon,iconPack:o.iconPack}),d}n.dataset.groupId=o.groupId}const ge=this._defaults.maxVisible;if(ge&&C.children.length>=ge){const c=C.firstElementChild;if(c&&c.dataset&&c.dataset.toastId)this.remove(c.dataset.toastId);else try{C.removeChild(C.firstElementChild)}catch(d){}}C.appendChild(n),n._cachedTitleEl=V,n._cachedMessageEl=I,n._cachedProgressEl=W;const m={id:k,toast:n,cfg:o,type:e,createdAt:w(),remaining:(v=o.duration)!=null?v:this._defaults.duration,timer:null,start:w(),paused:!1,_boundMove:null,_boundUp:null,_onPointerDown:null,_onEnter:null,_onLeave:null,dedupeKey:H,hooks:{onShow:o.onShow,onShown:o.onShown,onClose:o.onClose,onRemoved:o.onRemoved}};this._activeMap.set(k,m);try{(L=(j=m.hooks).onShow)==null||L.call(j,{id:k,toast:n,cfg:o,type:e})}catch(c){}this._runPlugins({toast:n,cfg:o,type:e,root:C,meta:m}),this._updateStackPositionsFor(C),requestAnimationFrame(()=>{var c,d;F?(n.style.opacity="1",(d=(c=m.hooks).onShown)==null||d.call(c,{id:k,toast:n,cfg:o,type:e})):(n.classList.add("show"),setTimeout(()=>{var b,E;try{(E=(b=m.hooks).onShown)==null||E.call(b,{id:k,toast:n,cfg:o,type:e})}catch(X){}},320))});let _e=0,be=0,A=0,z=0,ne=!1,O=null,ie=0;const le=c=>{const d=c.touches?c.touches[0]:c;_e=d.clientX,be=d.clientY,A=0,z=0,ne=!0,O=null,m.paused=!0,n.style.transition="none",m._boundMove=we,m._boundUp=Se,document.addEventListener("touchmove",m._boundMove,{passive:!0}),document.addEventListener("mousemove",m._boundMove),document.addEventListener("touchend",m._boundUp),document.addEventListener("mouseup",m._boundUp),ie=w()},we=c=>{if(!ne)return;const d=c.touches?c.touches[0]:c;A=d.clientX-_e,z=d.clientY-be,O||(Math.abs(A)>6?O="x":Math.abs(z)>6&&(O="y")),O==="x"?n.style.setProperty("--jt-drag-x",`${A}px`):O==="y"&&n.style.setProperty("--jt-drag-y",`${z}px`),ie=w(),d.clientX},Se=c=>{ne=!1,m.paused=!1;const d=Math.abs(A),b=Math.abs(z),E=O||(d>b?"x":"y"),X=Math.max(1,w()-ie),Pe=X?A/X*1e3:0,Le=E==="x"&&(d>($._defaults.swipeThreshold||60)||Math.abs(Pe)>800),Ce=E==="y"&&b>($._defaults.swipeThreshold||80);if(Le||Ce){const Ae=A>=0?1:-1;E==="x"?n.style.setProperty("--jt-drag-x",`${Ae*1e3}px`):n.style.setProperty("--jt-drag-y","1000px"),n.classList.add("swipe-dismissing"),setTimeout(()=>this.remove(k),220)}else n.style.transition="transform 0.22s ease-out, opacity 0.22s ease-out",n.style.setProperty("--jt-drag-x","0px"),n.style.setProperty("--jt-drag-y","0px");A=z=0,m._boundMove&&(document.removeEventListener("touchmove",m._boundMove),document.removeEventListener("mousemove",m._boundMove),m._boundMove=null),m._boundUp&&(document.removeEventListener("touchend",m._boundUp),document.removeEventListener("mouseup",m._boundUp),m._boundUp=null),m.start=w(),this._startScheduler()};n._onPointerDown=le,n.addEventListener("touchstart",le,{passive:!0}),n.addEventListener("mousedown",le);const ce=()=>{m.paused=!0},de=()=>{m.paused&&(m.paused=!1,m.start=w(),this._startScheduler())};return m._onEnter=ce,m._onLeave=de,n.addEventListener("mouseenter",ce),n.addEventListener("mouseleave",de),n.addEventListener("focusin",ce),n.addEventListener("focusout",de),m.start=w(),m.remaining=(R=o.duration)!=null?R:this._defaults.duration,m.paused=!1,((q=o.duration)!=null?q:this._defaults.duration)>0&&this._startScheduler(),o.undoTimeout&&(m.timer=setTimeout(()=>this.remove(k),o.undoTimeout)),(o.playSound||this._defaults.playSound)&&this._playSound(o.playSound||this._defaults.playSound),k},_startScheduler(){if(this._schedulerRunning)return;this._schedulerRunning=!0;const e=a=>{const t=w();this._schedulerLast=t,this._pausedAll||this._activeMap.forEach((r,s)=>{var p;if(!r||r.paused)return;const f=(p=r.cfg.duration)!=null?p:this._defaults.duration;if(f<=0)return;const h=t-r.start,u=Math.max(0,Math.min(h,1e3));r.remaining-=u,r.start=t;const y=r.toast._cachedProgressEl||r.toast.querySelector(".jt-progress");if(y){const _=Math.max(0,r.remaining/f);y.style.transform=`scaleX(${_})`}r.remaining<=0&&(F||r.toast.classList.remove("show"),setTimeout(()=>this.remove(s),280))}),this._roots.forEach(r=>{!r._parallaxTargets||!r.children.length||Array.from(r.children).forEach(s=>{var p,f,h;const u=r._parallaxTargets.get(s)||{tx:0,ty:0,tz:0,rotX:0,rotY:0,smoothing:(p=this._defaults.parallaxSmoothing)!=null?p:.12};s._jtPrev=s._jtPrev||{tx:0,ty:0,tz:0,rotX:0,rotY:0};const y=s._jtPrev,_=(h=u.smoothing)!=null?h:(f=this._defaults.parallaxSmoothing)!=null?f:.12,v=U(y.tx,u.tx||0,_),j=U(y.ty,u.ty||0,_),L=U(y.tz,u.tz||0,_),R=U(y.rotX,u.rotX||0,_),q=U(y.rotY,u.rotY||0,_);s.style.setProperty("--jt-parallax-x",`${v}px`),s.style.setProperty("--jt-parallax-y",`${j}px`),s.style.setProperty("--jt-parallax-z",`${L}px`),s.style.setProperty("--jt-rot-x",`${R}deg`),s.style.setProperty("--jt-rot-y",`${q}deg`),s._jtPrev.tx=v,s._jtPrev.ty=j,s._jtPrev.tz=L,s._jtPrev.rotX=R,s._jtPrev.rotY=q})});let l=!1;this._activeMap.forEach(r=>{var s;((s=r.cfg.duration)!=null?s:this._defaults.duration)>0&&!r.paused&&(l=!0)});let i=!1;this._roots.forEach(r=>{r._parallaxTargets&&r.children.length&&(i=!0)}),!l&&!i?this._stopScheduler():this._schedulerRAF=requestAnimationFrame(e)};this._schedulerRAF=requestAnimationFrame(e)},_stopScheduler(){this._schedulerRunning&&(this._schedulerRAF&&cancelAnimationFrame(this._schedulerRAF),this._schedulerRAF=null,this._schedulerRunning=!1,this._schedulerLast=0)},remove(e){var a,t,l,i;const r=this._activeMap.get(e);if(!r)return!1;const{toast:s,cfg:p,type:f}=r;try{(t=(a=r.hooks).onClose)==null||t.call(a,{id:e,toast:s,cfg:p,type:f})}catch(u){}F?s.style.opacity="0":s.classList.add("hide");try{s._onPointerDown&&(s.removeEventListener("touchstart",s._onPointerDown),s.removeEventListener("mousedown",s._onPointerDown))}catch(u){}if(r._boundMove){try{document.removeEventListener("touchmove",r._boundMove),document.removeEventListener("mousemove",r._boundMove)}catch(u){}r._boundMove=null}if(r._boundUp){try{document.removeEventListener("touchend",r._boundUp),document.removeEventListener("mouseup",r._boundUp)}catch(u){}r._boundUp=null}try{r._onEnter&&s.removeEventListener("mouseenter",r._onEnter),r._onLeave&&s.removeEventListener("mouseleave",r._onLeave),r._onEnter&&s.removeEventListener("focusin",r._onEnter),r._onLeave&&s.removeEventListener("focusout",r._onLeave)}catch(u){}r.timer&&(clearTimeout(r.timer),r.timer=null),this._activeMap.delete(e);const h=s.parentNode;if(h){const u=()=>{var y,_;try{s.parentNode&&s.parentNode.removeChild(s)}catch(v){}try{if(h.children.length===0){try{h._parallaxHandler&&(h.removeEventListener("mousemove",h._parallaxHandler),h.removeEventListener("touchmove",h._parallaxHandler)),h._parallaxReset&&(h.removeEventListener("mouseleave",h._parallaxReset),h.removeEventListener("touchend",h._parallaxReset)),h.remove()}catch(v){}this._roots.delete(h.dataset.position)}else this._updateStackPositionsFor(h)}catch(v){}if(r.dedupeKey)try{this._queueDedupe.delete(r.dedupeKey)}catch(v){}try{(_=(y=r.hooks).onRemoved)==null||_.call(y,{id:e,cfg:p,type:f})}catch(v){}};if(F)u();else{const y=_=>{_.target===s&&(s.removeEventListener("animationend",y),u())};s.addEventListener("animationend",y),setTimeout(u,700)}}else{if(r.dedupeKey)try{this._queueDedupe.delete(r.dedupeKey)}catch(u){}try{(i=(l=r.hooks).onRemoved)==null||i.call(l,{id:e,cfg:p,type:f})}catch(u){}}return!0},update(e,a={}){const t=this._activeMap.get(e);if(!t)return this._warn("update: id not found "+e),!1;const{toast:l}=t;if(t.cfg=D(t.cfg,a),t.cfg.title){const s=l.querySelector(".jt-title")||l._cachedTitleEl;s&&(s.textContent=t.cfg.title)}const i=l.querySelector(".jt-message")||l._cachedMessageEl;i&&(t.cfg.html?i.innerHTML=J(t.cfg.html):i.textContent=String(t.cfg.message||""));const r=N[t.cfg.theme||this._theme]||{};if(l.style.background=t.cfg.bg||r.bg,l.style.color=t.cfg.color||r.color,l.style.border=t.cfg.border||r.border||"none",t.cfg.duration!==void 0){t.remaining=t.cfg.duration,t.start=w(),t.paused||this._startScheduler();const s=t.toast._cachedProgressEl||t.toast.querySelector(".jt-progress");s&&(s.style.transform="scaleX(1)")}return this._runPlugins({toast:l,cfg:t.cfg,type:t.type,meta:t}),!0},_priorityMap:{low:1,normal:2,high:3,urgent:4},pauseAll(){this._pausedAll=!0},resumeAll(){this._pausedAll=!1,this._activeMap.forEach(e=>e.start=w()),this._startScheduler()},dismissAll(e={}){const a=e.type,t=e.position,l=[];this._activeMap.forEach((i,r)=>{const s=a?i.type===a:!0,p=t?(i.cfg.position||i.toast.dataset.position)===t:!0;s&&p&&l.push(r)}),l.forEach(i=>this.remove(i))},listActive(){const e=[];return this._activeMap.forEach((a,t)=>{e.push({id:t,type:a.type,remaining:a.remaining,createdAt:a.createdAt,position:a.cfg.position})}),e}};function ke(e,a){return e?typeof e=="string"?{message:e}:e:{message:a}}function ye(e,a,t){return e?typeof e=="function"?{message:e(a)}:typeof e=="string"?{message:e}:e:{message:t}}$.setup({success:{icon:"fa-check",iconPack:"fas",bg:"#16a34a",progress:!0,duration:4e3},error:{icon:"fa-xmark",iconPack:"fas",bg:"#dc2626",progress:!0,duration:4e3},info:{icon:"fa-circle-info",iconPack:"fas",bg:"#2563eb",progress:!0,duration:4e3},warning:{icon:"fa-triangle-exclamation",iconPack:"fas",bg:"#f59e0b",progress:!0,duration:4e3},loading:{icon:"fa-spinner",iconPack:"fas",iconAnim:"jt-spin",duration:0,progress:!0}}),T.default=$,T.juiceToast=$,Object.defineProperty(T,"__esModule",{value:!0})}));
46
335
  //# sourceMappingURL=juice-toast.umd.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "juice-toast",
3
- "version": "1.4.3",
3
+ "version": "1.4.4-beta.2",
4
4
  "description": "Zero dependency JavaScript toast notification library with animations, dark mode, auto CSS injection, and mobile support",
5
5
  "keywords": [
6
6
  "toast",
@@ -52,7 +52,7 @@
52
52
  "README.md",
53
53
  "CONTRIBUTING.md",
54
54
  "WARNER_NEXT_VERSION.md",
55
- "EoL.md",
55
+ "Notice.md",
56
56
  "NEW_FUNCTION.md",
57
57
  "API.md"
58
58
  ],
File without changes