juice-toast 1.4.2 → 1.4.3

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/API.md CHANGED
@@ -304,8 +304,15 @@ juiceToast.success({
304
304
  }
305
305
  ```
306
306
 
307
+ # Parallax Mode
308
+ ```js
309
+ juiceToast.success({
310
+ parallaxMode: true
311
+ });
312
+ ```
313
+
307
314
  ---
308
315
 
309
316
  # License
310
317
 
311
- MIT License
318
+ Atrosfer 1.0 License
package/CHANGELOG.md CHANGED
@@ -1,4 +1,10 @@
1
- ## v1.4.2
1
+ ## v1.4.3
2
+ - Add Parallax Mode
3
+ - Fixes Animation
4
+ - Auto-fecth **Font Awesome** Icons
5
+ - Smart Dedup
6
+
7
+ v1.4.2
2
8
  - Add modal
3
9
  - Bug fixes
4
10
  - improve documentation
package/CONTRIBUTING.md CHANGED
@@ -62,4 +62,4 @@ git push origin feature/your-feature-name
62
62
  ## Code of Conduct
63
63
  Read the [Code Of Conduct](https://github.com/KhairyK/juiceToast/blob/main/CODE_OF_CONDUCT.md)
64
64
 
65
- 2026 (C) OpenDN Foundation / Released under MIT LICENSE
65
+ 2026 (C) OpenDN Foundation / Released under Atrosfer 1.0LICENSE
package/LICENSE.md CHANGED
@@ -1,54 +1,72 @@
1
- # MIT License
2
-
3
- **Project:** JuiceToast
4
- **Copyright (c) 2026 OpenDN Foundation (Sholehuddin Khairy / KhairyK)**
5
-
6
- ---
7
-
8
- ## Permission
9
-
10
- Permission is hereby granted, free of charge, to any person obtaining a copy
11
- of this software and associated documentation files (the “Software”), to deal
12
- in the Software **without restriction**, including without limitation the rights to:
13
-
14
- - use
15
- - copy
16
- - modify
17
- - merge
18
- - publish
19
- - distribute
20
- - sublicense
21
- - and/or sell copies of the Software
22
-
23
- and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
24
-
25
- ---
26
-
27
- ## Conditions
28
-
29
- The above copyright notice and this permission notice shall be included in all
30
- copies or substantial portions of the Software.
31
-
32
- ---
33
-
34
- ## Disclaimer
35
-
36
- THE SOFTWARE IS PROVIDED **“AS IS”**, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
37
- INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
38
- AND NONINFRINGEMENT.
39
-
40
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES,
41
- OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM,
42
- OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
43
-
44
- ---
45
-
46
- ## Additional Notes (Project-Specific)
47
-
48
- - You are free to use JuiceToast in **personal, educational, and commercial projects**.
49
- - Attribution is appreciated but not required beyond the MIT notice.
50
- - Contributions, improvements, and community extensions are welcome.
51
-
52
- ---
53
-
54
- *Lightweight. Modern. Developer-friendly.*
1
+ Atrosfer License 1.0
2
+
3
+ Copyright (c) 2026 Sholehuddin Khairy
4
+ All rights reserved.
5
+
6
+ 1. Grant of License:
7
+ - Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, subject to the conditions stated herein.
12
+
13
+ 2. Conditions:
14
+ a. License Notice:
15
+ - The above copyright notice and this permission notice shall be included
16
+ in all copies or substantial portions of the Software.
17
+ b. Attribution:
18
+ - When distributing the Software in any form, credit must be given to the
19
+ original author, Sholehuddin Khairy, including a link to the official
20
+ repository or project page, if applicable.
21
+ c. Modifications:
22
+ - Any modified versions of the Software must clearly state the changes made
23
+ and retain this license in its entirety.
24
+
25
+ 3. Source Code Distribution:
26
+ - The Software may be distributed in source code or compiled/binary form.
27
+ - Redistribution must include this license and the original copyright notice.
28
+
29
+ 4. Commercial Use:
30
+ - The Software may be used for commercial purposes.
31
+ - Distribution or sale of modified versions for profit requires compliance
32
+ with all terms of this license, including proper attribution.
33
+
34
+ 5. Contributions:
35
+ - Contributions to the Software are encouraged.
36
+ - By submitting contributions, contributors grant the right to use, modify,
37
+ and distribute them under the terms of this license.
38
+
39
+ 6. Patent Clause:
40
+ - The license grants no rights to any patents owned by the copyright holder
41
+ or contributors. Use of the Software does not grant any patent license.
42
+
43
+ 7. Trademarks:
44
+ - This license does not grant any rights to use the trademarks, service marks,
45
+ or trade names of the copyright holder, except as required for reasonable
46
+ attribution of the Software.
47
+
48
+ 8. Warranty Disclaimer:
49
+ - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
50
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
51
+ FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
52
+ - THE COPYRIGHT HOLDER SHALL NOT BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER
53
+ LIABILITY ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR
54
+ THE USE OR OTHER DEALINGS IN THE SOFTWARE.
55
+
56
+ 9. Indemnity:
57
+ - Users agree to indemnify, defend, and hold harmless the copyright holder
58
+ from and against any claims, damages, or liabilities arising from their
59
+ use, modification, or distribution of the Software.
60
+
61
+ 10. International Use:
62
+ - This license is governed by international copyright law.
63
+ - Use of the Software constitutes acceptance of the terms in any jurisdiction.
64
+
65
+ 11. Termination:
66
+ - Any violation of the terms of this license will result in automatic
67
+ termination of rights granted herein.
68
+ - Termination does not affect rights accrued prior to the violation.
69
+
70
+ 12. Acceptance:
71
+ - By using, copying, modifying, or distributing this Software, you acknowledge
72
+ that you have read, understood, and agree to be bound by the terms of this license.
package/README.md CHANGED
@@ -395,7 +395,7 @@ JuiceToast provides more advanced architecture while staying dependency-free.
395
395
 
396
396
  # 📄 License
397
397
 
398
- MIT License (C) 2026 OpenDN Foundation
398
+ Atrosfer 1.0 License (C) 2026 OpenDN Foundation
399
399
 
400
400
  ---
401
401
 
@@ -1,113 +1,46 @@
1
- var ft=Object.defineProperty,gt=Object.defineProperties,bt=Object.getOwnPropertyDescriptors,U=Object.getOwnPropertySymbols,at=Object.prototype.hasOwnProperty,st=Object.prototype.propertyIsEnumerable,it=(e,t,o)=>t in e?ft(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,W=(e,t)=>{for(var o in t||(t={}))at.call(t,o)&&it(e,o,t[o]);if(U)for(var o of U(t))st.call(t,o)&&it(e,o,t[o]);return e},B=(e,t)=>gt(e,bt(t)),yt=(e,t)=>{var o={};for(var r in e)at.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(e!=null&&U)for(var r of U(e))t.indexOf(r)<0&&st.call(e,r)&&(o[r]=e[r]);return o};const y=typeof window!="undefined"&&typeof document!="undefined",vt=y&&window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;class q{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,o){[this._heap[t],this._heap[o]]=[this._heap[o],this._heap[t]]}push(t,o=0){const r={item:t,priority:o,seq:q._seq=(q._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 o=this._parent(t);if(this._compare(t,o)<=0)break;this._swap(t,o),t=o}}_siftDown(t){for(;;){const o=this._left(t),r=this._right(t),l=this._heap.length;let c=t;if(o<l&&this._compare(o,c)>0&&(c=o),r<l&&this._compare(r,c)>0&&(c=r),c===t)break;this._swap(t,c),t=c}}_compare(t,o){const r=this._heap[t],l=this._heap[o];return r.priority!==l.priority?r.priority-l.priority:l.seq-r.seq}}let H=!1;const J=`
2
- /* JuiceToast base (v1.4.0) */
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
3
  #juice-toast-root,[id^="juice-toast-root-"]{position:fixed;z-index:9999;display:flex;pointer-events:none;gap:10px}
4
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
5
  #juice-toast-root[data-position="top-right"]{top:20px;right:20px;flex-direction:column;align-items:flex-end}
6
6
  #juice-toast-root[data-position="bottom-left"]{bottom:20px;left:20px;flex-direction:column-reverse;align-items:flex-start}
7
7
  #juice-toast-root[data-position="top-left"]{top:20px;left:20px;flex-direction:column;align-items:flex-start}
8
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:opacity .28s ease,transform .32s ease}
10
- @keyframes jt-slide-in{0%{opacity:0;transform:translateY(20px) scale(0.95)}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.95)}}
12
- .juice-toast.show{animation:jt-slide-in .32s cubic-bezier(0.4,0,0.2,1) forwards;opacity:1;transform:translateY(0)}
13
- .juice-toast.hide{animation:jt-slide-out .28s cubic-bezier(0.4,0,0.2,1) forwards;opacity:0;transform:translateY(12px);pointer-events:none}
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}
14
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)}
15
- .jt-content{display:flex;flex-direction:column;gap:4px;flex:1}
16
- .jt-title{font-weight:700;font-size:13px}
17
- .jt-message{font-size:13px;opacity:.95}
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}
18
22
  .jt-actions{display:flex;gap:8px;margin-top:10px}
19
23
  .jt-action{border:1px solid currentColor;padding:4px 10px;border-radius:6px;font-size:12px;cursor:pointer;background:transparent}
20
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}
21
-
22
- /* avatar specific */
25
+ .juice-toast.swipe-dismissing {opacity: 0; transition: transform 0.22s ease-out, opacity 0.22s ease-out;}
23
26
  .jt-avatar{width:36px;height:36px;border-radius:50%;object-fit:cover;flex-shrink:0}
24
27
 
25
- /* ---------------- Modal ---------------- */
26
- /* Overlay */
27
- .jt-modal-overlay{
28
- position:fixed;
29
- inset:0;
30
- display:flex;
31
- align-items:center;
32
- justify-content:center;
33
- padding:20px;
34
- background:rgba(15,23,42,.55);
35
- backdrop-filter:blur(6px) saturate(120%);
36
- -webkit-backdrop-filter:blur(6px) saturate(120%);
37
- opacity:0;
38
- transition:opacity .25s ease;
39
- z-index:10000;
40
- }
41
- .jt-modal-overlay.show{
42
- opacity:1;
43
- }
44
-
45
- /* Base modal */
46
- .jt-modal{
47
- width:100%;
48
- max-width:520px;
49
- border-radius:18px;
50
- padding:24px;
51
-
52
- opacity:0;
53
- transform:translateY(40px) scale(.96);
54
- transition:
55
- transform .35s cubic-bezier(.16,1,.3,1),
56
- opacity .25s ease;
57
- }
58
-
59
- .jt-modal.show{
60
- opacity:1;
61
- transform:translateY(0) scale(1);
62
- }
63
-
64
- .jt-modal-header{
65
- font-size:18px;
66
- font-weight:600;
67
- letter-spacing:.3px;
68
- margin-bottom:10px;
69
- }
70
-
71
- .jt-modal-body{
72
- font-size:14.5px;
73
- line-height:1.6;
74
- opacity:.85;
75
- margin-bottom:22px;
76
- }
77
-
78
- .jt-modal-actions{
79
- display:flex;
80
- justify-content:flex-end;
81
- gap:12px;
82
- }
28
+ /* avatar top variant */
29
+ .juice-toast.jt-avatar-top{flex-direction:column;align-items:flex-start}
83
30
 
84
- .jt-modal-btn{
85
- min-width:88px;
86
- padding:8px 16px;
87
- border-radius:12px;
88
- font-size:13.5px;
89
- font-weight:500;
90
- cursor:pointer;
91
- transition:all .2s ease;
92
- border:1px solid rgba(255,255,255,.08);
93
- background:rgba(255,255,255,.04);
94
- color:inherit;
95
- }
96
- .jt-modal-btn:hover{
97
- background:rgba(255,255,255,.08);
98
- transform:translateY(-1px);
99
- }
100
- .jt-modal-btn:active{
101
- transform:translateY(0);
102
- }
103
-
104
- .jt-modal-btn.primary{
105
- background:#6366f1;
106
- border-color:#6366f1;
107
- color:#fff;
108
- }
109
- .jt-modal-btn.primary:hover{
110
- background:#5458ee;
111
- }
112
- `;function rt(e=J){if(!y||H)return;if(document.getElementById("juice-toast-style")){H=!0;return}const t=document.createElement("style");t.id="juice-toast-style",t.textContent=e,document.head.appendChild(t),H=!0}const K=(()=>{let e=1;return()=>"jt-"+e++})();function _(){return Date.now()}function F(e,t){return Object.assign({},e||{},t||{})}function xt(e,t,o){return Math.max(t,Math.min(o,e))}function lt(e){if(!e)return"";const t=document.createElement("template");t.innerHTML=e,t.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(l){Array.from(l.childNodes).forEach(c=>{if(c.nodeType===1){const h=c.tagName.toLowerCase();o.includes(h)?(Array.from(c.attributes||[]).forEach(g=>{const m=g.name.toLowerCase(),f=g.value||"";(m.startsWith("on")||(m==="href"||m==="src"||m==="xlink:href")&&f.trim().toLowerCase().startsWith("javascript:")||h==="img"&&m==="srcset")&&c.removeAttribute(g.name)}),r(c)):c.replaceWith(...Array.from(c.childNodes))}})})(t.content),t.innerHTML}const P={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)"}},ct={sm:{width:"260px",padding:"10px"},md:{width:"320px",padding:"14px"},lg:{width:"420px",padding:"18px"}},_t={success:"jt-bounce",error:"jt-shake",warning:"jt-shake",info:"jt-pulse",loading:"jt-spin"},j={_defaults:{duration:2500,maxVisible:3,swipeThreshold:60,glassUI:0,playSound:null,dev:!1,injectCSS:!0,css:null},_config:{},_theme:"dark",_plugins:[],_queue:new q,_queueDedupe:new Set,_activeMap:new Map,_roots:new Map,_modalStack:[],setup(e={}){const t=e,{duration:o,maxVisible:r}=t,l=yt(t,["duration","maxVisible"]);o&&(this._defaults.duration=o),r&&(this._defaults.maxVisible=r),this._config=F(this._config,l),this._registerTypes()},use(e){typeof e=="function"&&this._plugins.push(e)},addType(e,t={}){this._config[e]=t,this._registerTypes()},defineTheme(e,t={}){P[e]=F(P[e]||{},t)},setTheme(e){this._theme=e,y&&this._roots.forEach(t=>t.dataset.theme=e)},clear(){this._queue=new q,this._queueDedupe.clear()},destroy(){this.clear(),y&&(this._roots.forEach(e=>e.remove()),this._roots.clear())},promise(e,t={}){if(!e||typeof e.then!="function"){this._warn("promise expects a Promise");return}const o={id:K()}.id,r=t.timeout;this._enqueue("loading",B(W({},jt(t.loading,"Loading...")),{groupId:o,duration:0}));let l=null;r&&(l=setTimeout(()=>{this._enqueue("error",{message:t.timeoutMessage||"Request timeout",groupId:o}),c()},r));const c=()=>{l&&clearTimeout(l)};return e.then(h=>{c(),this._enqueue("success",B(W({},dt(t.success,h,"Success")),{groupId:o}))}).catch(h=>{c(),this._enqueue("error",B(W({},dt(t.error,h,"Error")),{groupId:o}))}),{cancel:()=>{this._enqueue("info",{message:t.cancelMessage||"Cancelled",groupId:o}),l&&clearTimeout(l)}}},modal(e={}){var t;if(!y)return;this._defaults.injectCSS!==!1&&rt(this._defaults.css||J);const o=F({title:"",message:"",html:null,block:!0,blur:!0,closeOnOverlay:!0,closable:!0,animation:"scale",actions:[],theme:this._theme},e),r=P[o.theme]||P.dark,l=document.createElement("div");l.className="jt-modal-overlay",o.block?l.style.pointerEvents="all":l.style.pointerEvents="none",o.blur||(l.style.backdropFilter="none",l.style.webkitBackdropFilter="none");const c=document.createElement("div");if(c.className=`jt-modal jt-anim-${o.animation}`,c.style.background=r.bg,c.style.color=r.color,c.style.border=r.border||"none",o.title){const m=document.createElement("div");m.className="jt-modal-header",m.textContent=o.title,c.appendChild(m)}const h=document.createElement("div");if(h.className="jt-modal-body",o.html?h.innerHTML=lt(o.html):h.textContent=o.message||"",c.appendChild(h),(t=o.actions)!=null&&t.length){const m=document.createElement("div");m.className="jt-modal-actions",o.actions.forEach(f=>{const w=document.createElement("button");w.className="jt-modal-btn"+(f.primary?" primary":""),w.textContent=f.label||"OK",w.onclick=M=>{var S;M.stopPropagation(),(S=f.onClick)==null||S.call(f,M),f.closeOnClick!==!1&&g()},m.appendChild(w)}),c.appendChild(m)}l.appendChild(c),document.body.appendChild(l),o.block&&(document.body.style.overflow="hidden"),requestAnimationFrame(()=>{l.classList.add("show"),c.classList.add("show")});const g=()=>{l.classList.remove("show"),c.classList.remove("show"),setTimeout(()=>{l.remove(),o.block&&(document.body.style.overflow="")},300)};if(o.closable){o.closeOnOverlay&&l.addEventListener("click",f=>{f.target===l&&g()});const m=f=>{f.key==="Escape"&&(g(),document.removeEventListener("keydown",m))};document.addEventListener("keydown",m)}return{close:g}},_registerTypes(){Object.keys(this._config).forEach(e=>{if(typeof this[e]=="function"&&!this[e].__auto)return;const t=o=>this._enqueue(e,o);t.__auto=!0,this[e]=t})},_enqueue(e,t={}){var o,r;const l=(r=(o=this._priorityMap)==null?void 0:o[t.priority])!=null?r:2,c=t.dedupeKey;if(c&&this._queueDedupe.has(c)){this._defaults.dev&&console.log("[JuiceToast] deduped",c);return}const h={id:K(),type:e,payload:t,priority:l};c&&this._queueDedupe.add(c),this._queue.push(h,l),this._processQueue()},_processQueue(){var e;if(!y)return;const t=this._defaults.maxVisible;for(;this._queue.size>0;){const o=this._queue.pop();if(!o)break;const r=((e=o.payload)==null?void 0:e.position)||"bottom-right",l=this._getRoot(r);if(Array.from(l.children).length>=t){this._queue.push(o,o.priority-.001);break}this._showToast(o.type,o.payload,o.id)}},_getRoot(e="bottom-right"){if(!y)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",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"}return document.body.appendChild(t),this._roots.set(e,t),t},_warn(e){this._defaults.dev&&typeof console!="undefined"&&console.warn("[JuiceToast]",e)},_playSound(e){if(!y)return;const t=typeof e=="string"&&e?e:this._defaults.playSound;if(t)try{const o=new Audio(t);o.volume=.6,o.play().catch(()=>{})}catch(o){}},_updateStackPositionsFor(e){const t=Array.from(e.children);e.dataset.position&&e.dataset.position.includes("bottom"),t.forEach((o,r)=>{const l=r,c=l*12;o.style.setProperty("--jt-stack-y",`-${c}px`),o.style.setProperty("--jt-stack-scale",1-l*.04),o.style.setProperty("--jt-stack-opacity",1-l*.12),o.style.zIndex=1e3-l})},_runPlugins(e){this._plugins.forEach(t=>{try{t(e)}catch(o){this._warn("Plugin error: "+o.message)}})},_normalizeGlass(e){if(e===!0)return 60;if(!e)return 0;const t=Number(e);return Number.isFinite(t)?xt(t,0,100):0},_showToast(e,t={},o){var r,l,c,h,g,m,f,w,M,S,Q,G,Z;if(!y)return;this._defaults.injectCSS!==!1&&rt(this._defaults.css||J);const ut=this._config[e]||{},pt=typeof t=="object"?t:{message:String(t)},n=F(ut,pt);n.icon=(r=n.icon)!=null?r:n.icon_left_top,n.position=(c=(l=n.position)!=null?l:n.toast)!=null?c:"bottom-right",n.closable=(g=(h=n.closable)!=null?h:n.closeable)!=null?g:!0,n.duration=(m=n.duration)!=null?m:this._defaults.duration;const Y=P[n.theme||this._theme]||{},v=o||K(),a=document.createElement("div");if(a.className="juice-toast",a.dataset.toastId=v,a.dataset.position=n.position,a.tabIndex=0,a.setAttribute("role","status"),a.style.position="relative",a.style.pointerEvents="auto",a.style.background=n.bg||Y.bg,a.style.color=n.color||Y.color,a.style.border=n.border||Y.border||"none",n.size&&ct[n.size]){const s=ct[n.size];s.width&&(a.style.width=s.width),s.padding&&(a.style.padding=s.padding)}const b=document.createElement("div");if(b.className="jt-content",n.title){const s=document.createElement("div");s.className="jt-title",s.textContent=n.title,b.appendChild(s)}const k=document.createElement("div");if(k.className="jt-message",n.html?k.innerHTML=lt(n.html):typeof n.message=="string"?n.message.split(/(`[^`]+`)/g).forEach(s=>{if(s.startsWith("`")&&s.endsWith("`")){const d=document.createElement("code");d.textContent=s.slice(1,-1),k.appendChild(d)}else k.appendChild(document.createTextNode(s))}):n.message&&(k.textContent=String(n.message)),b.appendChild(k),Array.isArray(n.actions)&&n.actions.length){const s=document.createElement("div");s.className="jt-actions",n.actions.forEach(d=>{const I=document.createElement("button");I.className="jt-action",I.textContent=d.label||"Action",I.onclick=ot=>{var nt;ot.stopPropagation(),(nt=d.onClick)==null||nt.call(d,ot),d.closeOnClick&&L()},s.appendChild(I)}),b.appendChild(s)}let p=null;if(n.icon){if(p=document.createElement("i"),p.className=["icon",n.iconPack||"",n.icon].join(" ").trim(),n.iconSize&&(p.style.fontSize=n.iconSize),!vt){const s=n.iconAnim||_t[e];s&&p.classList.add(s)}(n.iconLink||n.iconAnimate)&&(p.classList.add("icon-clickable"),p.addEventListener("click",s=>{s.stopPropagation(),n.iconAnimate&&(p.classList.remove(n.iconAnimate),p.offsetWidth,p.classList.add(n.iconAnimate)),n.iconLink&&window.open(n.iconLink,"_blank","noopener")}))}let u=null;if(n.avatar){u=document.createElement("img");const s=typeof n.avatar=="string"&&n.avatar?n.avatar:n.avatarSrc||"";s&&(u.src=s),u.alt=n.avatarAlt||n.title||"avatar",u.className="jt-avatar",u.loading=n.avatarLazy?"lazy":"eager",u.style.width=u.style.width||"36px",u.style.height=u.style.height||"36px",u.style.borderRadius=u.style.borderRadius||"50%",u.style.objectFit=u.style.objectFit||"cover",u.style.flexShrink="0";const d=n.avatarPosition||"left";d==="left"?u.style.marginRight=(f=n.avatarSpacing)!=null?f:"10px":d==="right"?u.style.marginLeft=(w=n.avatarSpacing)!=null?w:"10px":d==="top"&&(u.style.marginBottom=(M=n.avatarSpacing)!=null?M:"8px")}const D=n.avatarPosition||"left";u&&D==="top"?(a.classList.add("jt-avatar-top"),a.style.flexDirection="column",a.style.alignItems="flex-start",a.appendChild(u),p&&n.iconPosition==="top"?(a.appendChild(p),a.appendChild(b)):p&&n.iconPosition==="right"?(a.appendChild(b),a.appendChild(p)):(p&&a.appendChild(p),a.appendChild(b))):(a.style.flexDirection="row",a.style.alignItems="center",u&&D==="left"&&a.appendChild(u),p&&n.iconPosition==="right"?(a.appendChild(b),a.appendChild(p)):p&&n.iconPosition==="top"?(a.classList.add("jt-icon-top"),a.appendChild(p),a.appendChild(b)):(p&&a.appendChild(p),a.appendChild(b)),u&&D==="right"&&a.appendChild(u));let E=null;if(n.progress&&((S=n.duration)!=null?S:this._defaults.duration)>0&&(E=document.createElement("div"),E.className="jt-progress",n.progressColor&&(E.style.background=n.progressColor),a.appendChild(E)),n.undo){const s=document.createElement("button");s.className="jt-action",s.textContent="Undo",s.onclick=()=>{try{n.undo()}catch(d){}L()},b.appendChild(s)}if(n.closable){const s=document.createElement("span");s.className="juice-toast-close",s.tabIndex=0,s.textContent="\xD7",s.addEventListener("click",d=>{d.stopPropagation(),L()}),a.appendChild(s)}const x=this._getRoot(n.position||"bottom-right");if(!x)return;if(n.groupId){const s=Array.from(x.children).find(d=>d.dataset.groupId===n.groupId);if(s){let d=s.querySelector(".jt-count");d||(d=document.createElement("span"),d.className="jt-count",d.style.marginLeft="6px",(Q=s.querySelector(".jt-title"))==null||Q.appendChild(d),d.textContent="1"),d.textContent=String(parseInt(d.textContent||"1")+1);return}a.dataset.groupId=n.groupId}const tt=this._defaults.maxVisible;tt&&x.children.length>=tt&&x.removeChild(x.firstElementChild),x.appendChild(a);const i={id:v,toast:a,cfg:n,createdAt:_(),remaining:(G=n.duration)!=null?G:this._defaults.duration,raf:null,timer:null,start:_(),paused:!1,_boundMove:null,_boundUp:null};this._activeMap.set(v,i),this._runPlugins({toast:a,cfg:n,type:e,root:x}),this._updateStackPositionsFor(x),requestAnimationFrame(()=>a.classList.add("show"));let X=0,R=0,C=0,T=0,$=!1;const A=s=>{const d=s.touches?s.touches[0]:s;X=d.clientX,R=d.clientY,$=!0,i.paused=!0,i.raf&&(cancelAnimationFrame(i.raf),i.raf=null),a.style.transition="none",i._boundMove=mt,i._boundUp=ht,document.addEventListener("touchmove",i._boundMove,{passive:!0}),document.addEventListener("mousemove",i._boundMove),document.addEventListener("touchend",i._boundUp),document.addEventListener("mouseup",i._boundUp)},mt=s=>{if(!$)return;const d=s.touches?s.touches[0]:s;C=d.clientX-X,T=d.clientY-R,Math.abs(C)>Math.abs(T)?a.style.transform=`translateX(${C}px)`:a.style.transform=`translateY(${T}px)`},ht=()=>{$=!1,i.paused=!1,a.style.transition="",Math.abs(C)>(this._defaults.swipeThreshold||60)?(a.style.transform=`translateX(${C>0?1e3:-1e3}px)`,setTimeout(L,220)):a.style.transform="",X=R=C=T=0,i._boundMove&&(document.removeEventListener("touchmove",i._boundMove,{passive:!0}),document.removeEventListener("mousemove",i._boundMove),i._boundMove=null),i._boundUp&&(document.removeEventListener("touchend",i._boundUp),document.removeEventListener("mouseup",i._boundUp),i._boundUp=null),V()};a.addEventListener("touchstart",A,{passive:!0}),a.addEventListener("mousedown",A);const N=()=>{i.paused=!0,i.raf&&(cancelAnimationFrame(i.raf),i.raf=null)},z=()=>{i.paused&&(i.paused=!1,i.start=_(),V())};a.addEventListener("mouseenter",N),a.addEventListener("mouseleave",z),a.addEventListener("focusin",N),a.addEventListener("focusout",z);const O=(Z=n.duration)!=null?Z:this._defaults.duration;function et(){if(!j._activeMap.has(v))return;if(i.paused){i.raf=null,i.start=_();return}const s=_()-i.start;if(i.remaining-=s,i.start=_(),E){const d=Math.max(0,i.remaining/O);E.style.transform=`scaleX(${d})`}if(i.remaining<=0){a.classList.remove("show"),setTimeout(L,280),i.raf=null;return}i.raf=requestAnimationFrame(et)}function V(){O<=0||i.raf||i.paused||(i.start=_(),i.raf=requestAnimationFrame(et))}O>0&&(i.start=_(),i.remaining=O,V());function L(){if(!j._activeMap.has(v))return;a.classList.add("hide"),a.removeEventListener("touchstart",A),a.removeEventListener("mousedown",A),i._boundMove&&(document.removeEventListener("touchmove",i._boundMove,{passive:!0}),document.removeEventListener("mousemove",i._boundMove),i._boundMove=null),i._boundUp&&(document.removeEventListener("touchend",i._boundUp),document.removeEventListener("mouseup",i._boundUp),i._boundUp=null),a.removeEventListener("mouseenter",N),a.removeEventListener("mouseleave",z),a.removeEventListener("focusin",N),a.removeEventListener("focusout",z);const s=j._activeMap.get(v);s!=null&&s.raf&&(cancelAnimationFrame(s.raf),s.raf=null),s!=null&&s.timer&&(clearTimeout(s.timer),s.timer=null),j._activeMap.delete(v);const d=a.parentNode;d&&d.removeChild(a),d&&j._updateStackPositionsFor(d)}return n.undoTimeout&&(i.timer=setTimeout(L,n.undoTimeout)),(n.playSound||this._defaults.playSound)&&this._playSound(n.playSound||this._defaults.playSound),v},_priorityMap:{low:1,normal:2,high:3,urgent:4}};function jt(e,t){return e?typeof e=="string"?{message:t}:e:{message:t}}function dt(e,t,o){return e?typeof e=="function"?{message:e(t)}:typeof e=="string"?{message:e}:e:{message:o}}j.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:"spinner",iconPack:"fas",iconAnim:"jt-spin",duration:0,progress:!0}});export{j as default,j as juiceToast};
31
+ /* modal */
32
+ .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;
34
+ }
35
+ .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};
113
46
  //# sourceMappingURL=juice-toast.esm.js.map
@@ -1,113 +1,46 @@
1
- (function(w,S){typeof exports=="object"&&typeof module!="undefined"?S(exports):typeof define=="function"&&define.amd?define(["exports"],S):(w=typeof globalThis!="undefined"?globalThis:w||self,S(w.juiceToast={}))})(this,(function(w){"use strict";var S=Object.defineProperty,me=Object.defineProperties,he=Object.getOwnPropertyDescriptors,N=Object.getOwnPropertySymbols,Z=Object.prototype.hasOwnProperty,ee=Object.prototype.propertyIsEnumerable,te=(t,e,n)=>e in t?S(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,X=(t,e)=>{for(var n in e||(e={}))Z.call(e,n)&&te(t,n,e[n]);if(N)for(var n of N(e))ee.call(e,n)&&te(t,n,e[n]);return t},R=(t,e)=>me(t,he(e)),fe=(t,e)=>{var n={};for(var r in t)Z.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&N)for(var r of N(t))e.indexOf(r)<0&&ee.call(t,r)&&(n[r]=t[r]);return n};const y=typeof window!="undefined"&&typeof document!="undefined",ge=y&&window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;class T{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,n){[this._heap[e],this._heap[n]]=[this._heap[n],this._heap[e]]}push(e,n=0){const r={item:e,priority:n,seq:T._seq=(T._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 n=this._parent(e);if(this._compare(e,n)<=0)break;this._swap(e,n),e=n}}_siftDown(e){for(;;){const n=this._left(e),r=this._right(e),l=this._heap.length;let c=e;if(n<l&&this._compare(n,c)>0&&(c=n),r<l&&this._compare(r,c)>0&&(c=r),c===e)break;this._swap(e,c),e=c}}_compare(e,n){const r=this._heap[e],l=this._heap[n];return r.priority!==l.priority?r.priority-l.priority:l.seq-r.seq}}let $=!1;const V=`
2
- /* JuiceToast base (v1.4.0) */
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
3
  #juice-toast-root,[id^="juice-toast-root-"]{position:fixed;z-index:9999;display:flex;pointer-events:none;gap:10px}
4
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
5
  #juice-toast-root[data-position="top-right"]{top:20px;right:20px;flex-direction:column;align-items:flex-end}
6
6
  #juice-toast-root[data-position="bottom-left"]{bottom:20px;left:20px;flex-direction:column-reverse;align-items:flex-start}
7
7
  #juice-toast-root[data-position="top-left"]{top:20px;left:20px;flex-direction:column;align-items:flex-start}
8
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:opacity .28s ease,transform .32s ease}
10
- @keyframes jt-slide-in{0%{opacity:0;transform:translateY(20px) scale(0.95)}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.95)}}
12
- .juice-toast.show{animation:jt-slide-in .32s cubic-bezier(0.4,0,0.2,1) forwards;opacity:1;transform:translateY(0)}
13
- .juice-toast.hide{animation:jt-slide-out .28s cubic-bezier(0.4,0,0.2,1) forwards;opacity:0;transform:translateY(12px);pointer-events:none}
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}
14
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)}
15
- .jt-content{display:flex;flex-direction:column;gap:4px;flex:1}
16
- .jt-title{font-weight:700;font-size:13px}
17
- .jt-message{font-size:13px;opacity:.95}
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}
18
22
  .jt-actions{display:flex;gap:8px;margin-top:10px}
19
23
  .jt-action{border:1px solid currentColor;padding:4px 10px;border-radius:6px;font-size:12px;cursor:pointer;background:transparent}
20
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}
21
-
22
- /* avatar specific */
25
+ .juice-toast.swipe-dismissing {opacity: 0; transition: transform 0.22s ease-out, opacity 0.22s ease-out;}
23
26
  .jt-avatar{width:36px;height:36px;border-radius:50%;object-fit:cover;flex-shrink:0}
24
27
 
25
- /* ---------------- Modal ---------------- */
26
- /* Overlay */
27
- .jt-modal-overlay{
28
- position:fixed;
29
- inset:0;
30
- display:flex;
31
- align-items:center;
32
- justify-content:center;
33
- padding:20px;
34
- background:rgba(15,23,42,.55);
35
- backdrop-filter:blur(6px) saturate(120%);
36
- -webkit-backdrop-filter:blur(6px) saturate(120%);
37
- opacity:0;
38
- transition:opacity .25s ease;
39
- z-index:10000;
40
- }
41
- .jt-modal-overlay.show{
42
- opacity:1;
43
- }
44
-
45
- /* Base modal */
46
- .jt-modal{
47
- width:100%;
48
- max-width:520px;
49
- border-radius:18px;
50
- padding:24px;
51
-
52
- opacity:0;
53
- transform:translateY(40px) scale(.96);
54
- transition:
55
- transform .35s cubic-bezier(.16,1,.3,1),
56
- opacity .25s ease;
57
- }
58
-
59
- .jt-modal.show{
60
- opacity:1;
61
- transform:translateY(0) scale(1);
62
- }
63
-
64
- .jt-modal-header{
65
- font-size:18px;
66
- font-weight:600;
67
- letter-spacing:.3px;
68
- margin-bottom:10px;
69
- }
70
-
71
- .jt-modal-body{
72
- font-size:14.5px;
73
- line-height:1.6;
74
- opacity:.85;
75
- margin-bottom:22px;
76
- }
77
-
78
- .jt-modal-actions{
79
- display:flex;
80
- justify-content:flex-end;
81
- gap:12px;
82
- }
28
+ /* avatar top variant */
29
+ .juice-toast.jt-avatar-top{flex-direction:column;align-items:flex-start}
83
30
 
84
- .jt-modal-btn{
85
- min-width:88px;
86
- padding:8px 16px;
87
- border-radius:12px;
88
- font-size:13.5px;
89
- font-weight:500;
90
- cursor:pointer;
91
- transition:all .2s ease;
92
- border:1px solid rgba(255,255,255,.08);
93
- background:rgba(255,255,255,.04);
94
- color:inherit;
95
- }
96
- .jt-modal-btn:hover{
97
- background:rgba(255,255,255,.08);
98
- transform:translateY(-1px);
99
- }
100
- .jt-modal-btn:active{
101
- transform:translateY(0);
102
- }
103
-
104
- .jt-modal-btn.primary{
105
- background:#6366f1;
106
- border-color:#6366f1;
107
- color:#fff;
108
- }
109
- .jt-modal-btn.primary:hover{
110
- background:#5458ee;
111
- }
112
- `;function ne(t=V){if(!y||$)return;if(document.getElementById("juice-toast-style")){$=!0;return}const e=document.createElement("style");e.id="juice-toast-style",e.textContent=t,document.head.appendChild(e),$=!0}const W=(()=>{let t=1;return()=>"jt-"+t++})();function v(){return Date.now()}function z(t,e){return Object.assign({},t||{},e||{})}function be(t,e,n){return Math.max(e,Math.min(n,t))}function oe(t){if(!t)return"";const e=document.createElement("template");e.innerHTML=t,e.content.querySelectorAll("script, style, iframe").forEach(r=>r.remove());const n=["b","i","u","strong","em","code","pre","ul","ol","li","br","p","span","img","h1","h2","h3","h4","h5","h6","a"];return(function r(l){Array.from(l.childNodes).forEach(c=>{if(c.nodeType===1){const h=c.tagName.toLowerCase();n.includes(h)?(Array.from(c.attributes||[]).forEach(g=>{const m=g.name.toLowerCase(),f=g.value||"";(m.startsWith("on")||(m==="href"||m==="src"||m==="xlink:href")&&f.trim().toLowerCase().startsWith("javascript:")||h==="img"&&m==="srcset")&&c.removeAttribute(g.name)}),r(c)):c.replaceWith(...Array.from(c.childNodes))}})})(e.content),e.innerHTML}const P={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)"}},se={sm:{width:"260px",padding:"10px"},md:{width:"320px",padding:"14px"},lg:{width:"420px",padding:"18px"}},ye={success:"jt-bounce",error:"jt-shake",warning:"jt-shake",info:"jt-pulse",loading:"jt-spin"},x={_defaults:{duration:2500,maxVisible:3,swipeThreshold:60,glassUI:0,playSound:null,dev:!1,injectCSS:!0,css:null},_config:{},_theme:"dark",_plugins:[],_queue:new T,_queueDedupe:new Set,_activeMap:new Map,_roots:new Map,_modalStack:[],setup(t={}){const e=t,{duration:n,maxVisible:r}=e,l=fe(e,["duration","maxVisible"]);n&&(this._defaults.duration=n),r&&(this._defaults.maxVisible=r),this._config=z(this._config,l),this._registerTypes()},use(t){typeof t=="function"&&this._plugins.push(t)},addType(t,e={}){this._config[t]=e,this._registerTypes()},defineTheme(t,e={}){P[t]=z(P[t]||{},e)},setTheme(t){this._theme=t,y&&this._roots.forEach(e=>e.dataset.theme=t)},clear(){this._queue=new T,this._queueDedupe.clear()},destroy(){this.clear(),y&&(this._roots.forEach(t=>t.remove()),this._roots.clear())},promise(t,e={}){if(!t||typeof t.then!="function"){this._warn("promise expects a Promise");return}const n={id:W()}.id,r=e.timeout;this._enqueue("loading",R(X({},ve(e.loading,"Loading...")),{groupId:n,duration:0}));let l=null;r&&(l=setTimeout(()=>{this._enqueue("error",{message:e.timeoutMessage||"Request timeout",groupId:n}),c()},r));const c=()=>{l&&clearTimeout(l)};return t.then(h=>{c(),this._enqueue("success",R(X({},ae(e.success,h,"Success")),{groupId:n}))}).catch(h=>{c(),this._enqueue("error",R(X({},ae(e.error,h,"Error")),{groupId:n}))}),{cancel:()=>{this._enqueue("info",{message:e.cancelMessage||"Cancelled",groupId:n}),l&&clearTimeout(l)}}},modal(t={}){var e;if(!y)return;this._defaults.injectCSS!==!1&&ne(this._defaults.css||V);const n=z({title:"",message:"",html:null,block:!0,blur:!0,closeOnOverlay:!0,closable:!0,animation:"scale",actions:[],theme:this._theme},t),r=P[n.theme]||P.dark,l=document.createElement("div");l.className="jt-modal-overlay",n.block?l.style.pointerEvents="all":l.style.pointerEvents="none",n.blur||(l.style.backdropFilter="none",l.style.webkitBackdropFilter="none");const c=document.createElement("div");if(c.className=`jt-modal jt-anim-${n.animation}`,c.style.background=r.bg,c.style.color=r.color,c.style.border=r.border||"none",n.title){const m=document.createElement("div");m.className="jt-modal-header",m.textContent=n.title,c.appendChild(m)}const h=document.createElement("div");if(h.className="jt-modal-body",n.html?h.innerHTML=oe(n.html):h.textContent=n.message||"",c.appendChild(h),(e=n.actions)!=null&&e.length){const m=document.createElement("div");m.className="jt-modal-actions",n.actions.forEach(f=>{const k=document.createElement("button");k.className="jt-modal-btn"+(f.primary?" primary":""),k.textContent=f.label||"OK",k.onclick=q=>{var A;q.stopPropagation(),(A=f.onClick)==null||A.call(f,q),f.closeOnClick!==!1&&g()},m.appendChild(k)}),c.appendChild(m)}l.appendChild(c),document.body.appendChild(l),n.block&&(document.body.style.overflow="hidden"),requestAnimationFrame(()=>{l.classList.add("show"),c.classList.add("show")});const g=()=>{l.classList.remove("show"),c.classList.remove("show"),setTimeout(()=>{l.remove(),n.block&&(document.body.style.overflow="")},300)};if(n.closable){n.closeOnOverlay&&l.addEventListener("click",f=>{f.target===l&&g()});const m=f=>{f.key==="Escape"&&(g(),document.removeEventListener("keydown",m))};document.addEventListener("keydown",m)}return{close:g}},_registerTypes(){Object.keys(this._config).forEach(t=>{if(typeof this[t]=="function"&&!this[t].__auto)return;const e=n=>this._enqueue(t,n);e.__auto=!0,this[t]=e})},_enqueue(t,e={}){var n,r;const l=(r=(n=this._priorityMap)==null?void 0:n[e.priority])!=null?r:2,c=e.dedupeKey;if(c&&this._queueDedupe.has(c)){this._defaults.dev&&console.log("[JuiceToast] deduped",c);return}const h={id:W(),type:t,payload:e,priority:l};c&&this._queueDedupe.add(c),this._queue.push(h,l),this._processQueue()},_processQueue(){var t;if(!y)return;const e=this._defaults.maxVisible;for(;this._queue.size>0;){const n=this._queue.pop();if(!n)break;const r=((t=n.payload)==null?void 0:t.position)||"bottom-right",l=this._getRoot(r);if(Array.from(l.children).length>=e){this._queue.push(n,n.priority-.001);break}this._showToast(n.type,n.payload,n.id)}},_getRoot(t="bottom-right"){if(!y)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",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"}return document.body.appendChild(e),this._roots.set(t,e),e},_warn(t){this._defaults.dev&&typeof console!="undefined"&&console.warn("[JuiceToast]",t)},_playSound(t){if(!y)return;const e=typeof t=="string"&&t?t:this._defaults.playSound;if(e)try{const n=new Audio(e);n.volume=.6,n.play().catch(()=>{})}catch(n){}},_updateStackPositionsFor(t){const e=Array.from(t.children);t.dataset.position&&t.dataset.position.includes("bottom"),e.forEach((n,r)=>{const l=r,c=l*12;n.style.setProperty("--jt-stack-y",`-${c}px`),n.style.setProperty("--jt-stack-scale",1-l*.04),n.style.setProperty("--jt-stack-opacity",1-l*.12),n.style.zIndex=1e3-l})},_runPlugins(t){this._plugins.forEach(e=>{try{e(t)}catch(n){this._warn("Plugin error: "+n.message)}})},_normalizeGlass(t){if(t===!0)return 60;if(!t)return 0;const e=Number(t);return Number.isFinite(e)?be(e,0,100):0},_showToast(t,e={},n){var r,l,c,h,g,m,f,k,q,A,ie,re,le;if(!y)return;this._defaults.injectCSS!==!1&&ne(this._defaults.css||V);const xe=this._config[t]||{},_e=typeof e=="object"?e:{message:String(e)},o=z(xe,_e);o.icon=(r=o.icon)!=null?r:o.icon_left_top,o.position=(c=(l=o.position)!=null?l:o.toast)!=null?c:"bottom-right",o.closable=(g=(h=o.closable)!=null?h:o.closeable)!=null?g:!0,o.duration=(m=o.duration)!=null?m:this._defaults.duration;const B=P[o.theme||this._theme]||{},_=n||W(),s=document.createElement("div");if(s.className="juice-toast",s.dataset.toastId=_,s.dataset.position=o.position,s.tabIndex=0,s.setAttribute("role","status"),s.style.position="relative",s.style.pointerEvents="auto",s.style.background=o.bg||B.bg,s.style.color=o.color||B.color,s.style.border=o.border||B.border||"none",o.size&&se[o.size]){const a=se[o.size];a.width&&(s.style.width=a.width),a.padding&&(s.style.padding=a.padding)}const b=document.createElement("div");if(b.className="jt-content",o.title){const a=document.createElement("div");a.className="jt-title",a.textContent=o.title,b.appendChild(a)}const E=document.createElement("div");if(E.className="jt-message",o.html?E.innerHTML=oe(o.html):typeof o.message=="string"?o.message.split(/(`[^`]+`)/g).forEach(a=>{if(a.startsWith("`")&&a.endsWith("`")){const d=document.createElement("code");d.textContent=a.slice(1,-1),E.appendChild(d)}else E.appendChild(document.createTextNode(a))}):o.message&&(E.textContent=String(o.message)),b.appendChild(E),Array.isArray(o.actions)&&o.actions.length){const a=document.createElement("div");a.className="jt-actions",o.actions.forEach(d=>{const D=document.createElement("button");D.className="jt-action",D.textContent=d.label||"Action",D.onclick=ue=>{var pe;ue.stopPropagation(),(pe=d.onClick)==null||pe.call(d,ue),d.closeOnClick&&M()},a.appendChild(D)}),b.appendChild(a)}let p=null;if(o.icon){if(p=document.createElement("i"),p.className=["icon",o.iconPack||"",o.icon].join(" ").trim(),o.iconSize&&(p.style.fontSize=o.iconSize),!ge){const a=o.iconAnim||ye[t];a&&p.classList.add(a)}(o.iconLink||o.iconAnimate)&&(p.classList.add("icon-clickable"),p.addEventListener("click",a=>{a.stopPropagation(),o.iconAnimate&&(p.classList.remove(o.iconAnimate),p.offsetWidth,p.classList.add(o.iconAnimate)),o.iconLink&&window.open(o.iconLink,"_blank","noopener")}))}let u=null;if(o.avatar){u=document.createElement("img");const a=typeof o.avatar=="string"&&o.avatar?o.avatar:o.avatarSrc||"";a&&(u.src=a),u.alt=o.avatarAlt||o.title||"avatar",u.className="jt-avatar",u.loading=o.avatarLazy?"lazy":"eager",u.style.width=u.style.width||"36px",u.style.height=u.style.height||"36px",u.style.borderRadius=u.style.borderRadius||"50%",u.style.objectFit=u.style.objectFit||"cover",u.style.flexShrink="0";const d=o.avatarPosition||"left";d==="left"?u.style.marginRight=(f=o.avatarSpacing)!=null?f:"10px":d==="right"?u.style.marginLeft=(k=o.avatarSpacing)!=null?k:"10px":d==="top"&&(u.style.marginBottom=(q=o.avatarSpacing)!=null?q:"8px")}const H=o.avatarPosition||"left";u&&H==="top"?(s.classList.add("jt-avatar-top"),s.style.flexDirection="column",s.style.alignItems="flex-start",s.appendChild(u),p&&o.iconPosition==="top"?(s.appendChild(p),s.appendChild(b)):p&&o.iconPosition==="right"?(s.appendChild(b),s.appendChild(p)):(p&&s.appendChild(p),s.appendChild(b))):(s.style.flexDirection="row",s.style.alignItems="center",u&&H==="left"&&s.appendChild(u),p&&o.iconPosition==="right"?(s.appendChild(b),s.appendChild(p)):p&&o.iconPosition==="top"?(s.classList.add("jt-icon-top"),s.appendChild(p),s.appendChild(b)):(p&&s.appendChild(p),s.appendChild(b)),u&&H==="right"&&s.appendChild(u));let C=null;if(o.progress&&((A=o.duration)!=null?A:this._defaults.duration)>0&&(C=document.createElement("div"),C.className="jt-progress",o.progressColor&&(C.style.background=o.progressColor),s.appendChild(C)),o.undo){const a=document.createElement("button");a.className="jt-action",a.textContent="Undo",a.onclick=()=>{try{o.undo()}catch(d){}M()},b.appendChild(a)}if(o.closable){const a=document.createElement("span");a.className="juice-toast-close",a.tabIndex=0,a.textContent="\xD7",a.addEventListener("click",d=>{d.stopPropagation(),M()}),s.appendChild(a)}const j=this._getRoot(o.position||"bottom-right");if(!j)return;if(o.groupId){const a=Array.from(j.children).find(d=>d.dataset.groupId===o.groupId);if(a){let d=a.querySelector(".jt-count");d||(d=document.createElement("span"),d.className="jt-count",d.style.marginLeft="6px",(ie=a.querySelector(".jt-title"))==null||ie.appendChild(d),d.textContent="1"),d.textContent=String(parseInt(d.textContent||"1")+1);return}s.dataset.groupId=o.groupId}const ce=this._defaults.maxVisible;ce&&j.children.length>=ce&&j.removeChild(j.firstElementChild),j.appendChild(s);const i={id:_,toast:s,cfg:o,createdAt:v(),remaining:(re=o.duration)!=null?re:this._defaults.duration,raf:null,timer:null,start:v(),paused:!1,_boundMove:null,_boundUp:null};this._activeMap.set(_,i),this._runPlugins({toast:s,cfg:o,type:t,root:j}),this._updateStackPositionsFor(j),requestAnimationFrame(()=>s.classList.add("show"));let J=0,K=0,L=0,O=0,Q=!1;const I=a=>{const d=a.touches?a.touches[0]:a;J=d.clientX,K=d.clientY,Q=!0,i.paused=!0,i.raf&&(cancelAnimationFrame(i.raf),i.raf=null),s.style.transition="none",i._boundMove=je,i._boundUp=we,document.addEventListener("touchmove",i._boundMove,{passive:!0}),document.addEventListener("mousemove",i._boundMove),document.addEventListener("touchend",i._boundUp),document.addEventListener("mouseup",i._boundUp)},je=a=>{if(!Q)return;const d=a.touches?a.touches[0]:a;L=d.clientX-J,O=d.clientY-K,Math.abs(L)>Math.abs(O)?s.style.transform=`translateX(${L}px)`:s.style.transform=`translateY(${O}px)`},we=()=>{Q=!1,i.paused=!1,s.style.transition="",Math.abs(L)>(this._defaults.swipeThreshold||60)?(s.style.transform=`translateX(${L>0?1e3:-1e3}px)`,setTimeout(M,220)):s.style.transform="",J=K=L=O=0,i._boundMove&&(document.removeEventListener("touchmove",i._boundMove,{passive:!0}),document.removeEventListener("mousemove",i._boundMove),i._boundMove=null),i._boundUp&&(document.removeEventListener("touchend",i._boundUp),document.removeEventListener("mouseup",i._boundUp),i._boundUp=null),G()};s.addEventListener("touchstart",I,{passive:!0}),s.addEventListener("mousedown",I);const U=()=>{i.paused=!0,i.raf&&(cancelAnimationFrame(i.raf),i.raf=null)},F=()=>{i.paused&&(i.paused=!1,i.start=v(),G())};s.addEventListener("mouseenter",U),s.addEventListener("mouseleave",F),s.addEventListener("focusin",U),s.addEventListener("focusout",F);const Y=(le=o.duration)!=null?le:this._defaults.duration;function de(){if(!x._activeMap.has(_))return;if(i.paused){i.raf=null,i.start=v();return}const a=v()-i.start;if(i.remaining-=a,i.start=v(),C){const d=Math.max(0,i.remaining/Y);C.style.transform=`scaleX(${d})`}if(i.remaining<=0){s.classList.remove("show"),setTimeout(M,280),i.raf=null;return}i.raf=requestAnimationFrame(de)}function G(){Y<=0||i.raf||i.paused||(i.start=v(),i.raf=requestAnimationFrame(de))}Y>0&&(i.start=v(),i.remaining=Y,G());function M(){if(!x._activeMap.has(_))return;s.classList.add("hide"),s.removeEventListener("touchstart",I),s.removeEventListener("mousedown",I),i._boundMove&&(document.removeEventListener("touchmove",i._boundMove,{passive:!0}),document.removeEventListener("mousemove",i._boundMove),i._boundMove=null),i._boundUp&&(document.removeEventListener("touchend",i._boundUp),document.removeEventListener("mouseup",i._boundUp),i._boundUp=null),s.removeEventListener("mouseenter",U),s.removeEventListener("mouseleave",F),s.removeEventListener("focusin",U),s.removeEventListener("focusout",F);const a=x._activeMap.get(_);a!=null&&a.raf&&(cancelAnimationFrame(a.raf),a.raf=null),a!=null&&a.timer&&(clearTimeout(a.timer),a.timer=null),x._activeMap.delete(_);const d=s.parentNode;d&&d.removeChild(s),d&&x._updateStackPositionsFor(d)}return o.undoTimeout&&(i.timer=setTimeout(M,o.undoTimeout)),(o.playSound||this._defaults.playSound)&&this._playSound(o.playSound||this._defaults.playSound),_},_priorityMap:{low:1,normal:2,high:3,urgent:4}};function ve(t,e){return t?typeof t=="string"?{message:e}:t:{message:e}}function ae(t,e,n){return t?typeof t=="function"?{message:t(e)}:typeof t=="string"?{message:t}:t:{message:n}}x.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:"spinner",iconPack:"fas",iconAnim:"jt-spin",duration:0,progress:!0}}),w.default=x,w.juiceToast=x,Object.defineProperty(w,"__esModule",{value:!0})}));
31
+ /* modal */
32
+ .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;
34
+ }
35
+ .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})}));
113
46
  //# 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.2",
3
+ "version": "1.4.3",
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",
@@ -17,7 +17,7 @@
17
17
  "frontend-ui",
18
18
  "browser-notification"
19
19
  ],
20
- "license": "MIT",
20
+ "license": "Atrsofer-1.0",
21
21
  "author": "KhairyK",
22
22
  "homepage": "https://github.com/KhairyK/juiceToast",
23
23
  "bugs": {