@everymatrix/mini-games-hub 0.1.5 → 0.1.7
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/components/{GameCard-8XBwX5mB.js → GameCard-DTz2IEhm.js} +27 -29
- package/components/GameCard-Dfgtrwdb.cjs +3 -0
- package/components/{GameCard-SP2WkMe4.js → GameCard-sNqb2_mR.js} +27 -29
- package/components/{MiniGamesHub-DKkDXC81.cjs → MiniGamesHub-3XlqpfV_.cjs} +5 -5
- package/components/{MiniGamesHub-BEAlx3WE.js → MiniGamesHub-DTPiOtNT.js} +318 -286
- package/components/{MiniGamesHub-CrRIFbj_.js → MiniGamesHub-iX9t9vSW.js} +261 -249
- package/components/{WheelOfFortune-B7NMoATV.js → WheelOfFortune-BKUcclpm.js} +197 -164
- package/components/{WheelOfFortune-0yZoHYHH.js → WheelOfFortune-CbvJZO8-.js} +184 -151
- package/components/{WheelOfFortune-BxbFigrE.cjs → WheelOfFortune-DgAgnR_Q.cjs} +27 -6
- package/components/WheelOfFortuneDrawResults-AskDnOA6.cjs +1 -0
- package/components/WheelOfFortuneDrawResults-C9BcE4Kr.js +262 -0
- package/components/WheelOfFortuneDrawResults-DnQPGIPX.js +237 -0
- package/components/WheelOfFortuneHistory-BA977Hfx.js +230 -0
- package/components/WheelOfFortuneHistory-CT-5jtfe.js +230 -0
- package/components/WheelOfFortuneHistory-uP606zLS.cjs +13 -0
- package/components/{WheelOfFortuneRules-BI3iP5jZ.js → WheelOfFortuneRules-C16Md0m_.js} +64 -64
- package/components/WheelOfFortuneRules-DQcA-d8i.js +128 -0
- package/components/WheelOfFortuneRules-zVRcNYIv.cjs +5 -0
- package/components/WheelOfFortuneWheel-6j7QTrsf.cjs +3 -0
- package/components/WheelOfFortuneWheel-BvI-fAML.js +1980 -0
- package/components/WheelOfFortuneWheel-CCmzx2yj.js +1910 -0
- package/components/{constants-syi43uVY.js → constants-CWz8CXw2.js} +1 -1
- package/components/{constants-B5BwgkMh.cjs → constants-DM6Vdc6Z.cjs} +1 -1
- package/components/{sparkles-DMNeGYKa.cjs → sparkles-BnriHiyw.cjs} +1 -1
- package/components/{sparkles-Br3hNIM6.js → sparkles-BzZDomk7.js} +1 -1
- package/components/{sparkles-CsUJD5iK.js → sparkles-C9wObsYC.js} +1 -1
- package/components/{spin-controller-BfbakdA_.js → spin-controller-BjXSz9Me.js} +53 -52
- package/components/{spin-controller-Y0nB76qX.js → spin-controller-CETKYiGM.js} +51 -50
- package/components/spin-controller-q2CuZMYj.cjs +1 -0
- package/components/utils-B53aGsNG.js +6095 -0
- package/components/utils-C0oX5v1l.js +6141 -0
- package/components/utils-Du65tqU5.cjs +3 -0
- package/es2015/mini-games-hub.cjs +1 -1
- package/es2015/mini-games-hub.js +1 -1
- package/esnext/mini-games-hub.js +1 -1
- package/package.json +3 -1
- package/components/GameCard-B2Vf_Okb.cjs +0 -3
- package/components/GameCard-B2dUYs8D.cjs +0 -3
- package/components/GameCard-Bx4TWFNT.js +0 -58
- package/components/GameCard-CKlgiS66.cjs +0 -3
- package/components/GameCard-DX4XDT2r.js +0 -58
- package/components/GameCard-DXX0iD0Z.js +0 -58
- package/components/GameCard-Dfi3jlxs.js +0 -58
- package/components/GameCard-FmSc9xvG.js +0 -58
- package/components/GameCard-lPup4pYJ.js +0 -58
- package/components/GameCard-txJxZVfs.cjs +0 -3
- package/components/MiniGamesHub-BBCzOhms.js +0 -1269
- package/components/MiniGamesHub-BaAiz62L.cjs +0 -94
- package/components/MiniGamesHub-BbJIrcsb.cjs +0 -28
- package/components/MiniGamesHub-C6Nsfrqn.js +0 -1369
- package/components/MiniGamesHub-CLinNS2-.js +0 -1288
- package/components/MiniGamesHub-DXmod0OW.cjs +0 -94
- package/components/MiniGamesHub-DZHG1XwH.js +0 -1357
- package/components/MiniGamesHub-Db8-msnK.js +0 -1338
- package/components/MiniGamesHub-DxW3lK75.js +0 -1369
- package/components/WheelOfFortune-B-sa8npV.cjs +0 -572
- package/components/WheelOfFortune-CdsgfPZg.js +0 -829
- package/components/WheelOfFortune-Cfe5KhF-.cjs +0 -588
- package/components/WheelOfFortune-Cm-9CaHf.cjs +0 -570
- package/components/WheelOfFortune-DDfYKRzu.js +0 -862
- package/components/WheelOfFortune-DpMvjI6_.js +0 -811
- package/components/WheelOfFortune-Dtoep2n2.js +0 -852
- package/components/WheelOfFortune-cD7JyRL5.js +0 -820
- package/components/WheelOfFortune-u__JAdi_.js +0 -820
- package/components/WheelOfFortuneDrawResults-3S77J9M5.js +0 -292
- package/components/WheelOfFortuneDrawResults-B2L6I4Po.cjs +0 -1
- package/components/WheelOfFortuneDrawResults-B6RkAQ_i.cjs +0 -1
- package/components/WheelOfFortuneDrawResults-BRgQ0mTi.js +0 -261
- package/components/WheelOfFortuneDrawResults-BZAetM0L.js +0 -238
- package/components/WheelOfFortuneDrawResults-C0J_0fRE.cjs +0 -1
- package/components/WheelOfFortuneDrawResults-CKkYMVLn.js +0 -317
- package/components/WheelOfFortuneDrawResults-CvyqGbQG.js +0 -292
- package/components/WheelOfFortuneDrawResults-DIO74xIg.js +0 -317
- package/components/WheelOfFortuneDrawResults-D_QT2RDK.cjs +0 -1
- package/components/WheelOfFortuneDrawResults-WD4ZaXdI.js +0 -261
- package/components/WheelOfFortuneDrawResults-XiJyW5cc.js +0 -238
- package/components/WheelOfFortuneHistory-3lEfr9Yn.cjs +0 -13
- package/components/WheelOfFortuneHistory-BE1mGyJn.js +0 -233
- package/components/WheelOfFortuneHistory-BagUH_Pn.js +0 -233
- package/components/WheelOfFortuneHistory-BpfmGEE1.js +0 -233
- package/components/WheelOfFortuneHistory-C_EX6Ecx.js +0 -233
- package/components/WheelOfFortuneHistory-CgWvWb5r.js +0 -233
- package/components/WheelOfFortuneHistory-CldOJOup.js +0 -233
- package/components/WheelOfFortuneHistory-D9EVcaH2.js +0 -233
- package/components/WheelOfFortuneHistory-DQ7yysUE.cjs +0 -13
- package/components/WheelOfFortuneHistory-DoYx_EbF.js +0 -233
- package/components/WheelOfFortuneHistory-mbWa96d6.cjs +0 -13
- package/components/WheelOfFortuneHistory-tcBNosXj.cjs +0 -13
- package/components/WheelOfFortuneRules-3Pnc2tv_.cjs +0 -5
- package/components/WheelOfFortuneRules-ByuqEg7o.js +0 -128
- package/components/WheelOfFortuneRules-CD5FcLZh.js +0 -117
- package/components/WheelOfFortuneRules-CS1AnNsi.cjs +0 -5
- package/components/WheelOfFortuneRules-DEln64Ys.js +0 -117
- package/components/WheelOfFortuneRules-DTZ61azL.js +0 -128
- package/components/WheelOfFortuneRules-DUjXad1Z.cjs +0 -5
- package/components/WheelOfFortuneRules-Dp6015wP.cjs +0 -5
- package/components/WheelOfFortuneRules-ICYWgDZn.js +0 -128
- package/components/WheelOfFortuneRules-Sa4GsYQ7.js +0 -117
- package/components/WheelOfFortuneRules-ssp6aAUp.js +0 -128
- package/components/WheelOfFortuneWheel-76dShj7s.cjs +0 -1
- package/components/WheelOfFortuneWheel-B-3ALU8u.js +0 -632
- package/components/WheelOfFortuneWheel-B0P_kjVI.js +0 -599
- package/components/WheelOfFortuneWheel-C2yIQKzY.js +0 -598
- package/components/WheelOfFortuneWheel-C6o9ZPV4.js +0 -598
- package/components/WheelOfFortuneWheel-JKN_P3ES.cjs +0 -1
- package/components/WheelOfFortuneWheel-LXdY_AV0.js +0 -633
- package/components/WheelOfFortuneWheel-R5JZFn6S.js +0 -643
- package/components/WheelOfFortuneWheel-j83OpEdj.cjs +0 -1
- package/components/WheelOfFortuneWheel-jv0TkAX_.js +0 -632
- package/components/WheelOfFortuneWheel-le2uV09t.js +0 -609
- package/components/WheelOfFortuneWheel-rP-wIp2j.cjs +0 -1
- package/components/bonus-BcSq5fV_.cjs +0 -1
- package/components/bonus-BroDvSJR.js +0 -4
- package/components/coin-DetgSMGn.js +0 -4
- package/components/coin-dEAbLQma.cjs +0 -1
- package/components/loyalty-Bf3uaVFP.js +0 -4
- package/components/loyalty-XDJlZgzx.cjs +0 -1
- package/components/noprize-BJ-U8c5U.cjs +0 -1
- package/components/noprize-DQHyTDC0.js +0 -4
- package/components/role-Bxkn_4_S.cjs +0 -1
- package/components/role-CNEtykLr.js +0 -4
- package/components/spin-controller-Do0l1eeX.cjs +0 -1
- package/components/ticket-DP0fQfPa.cjs +0 -1
- package/components/ticket-DcOVRE_N.js +0 -4
- package/components/tournament-8UbfkV5I.cjs +0 -1
- package/components/tournament-BtKf5Btm.js +0 -4
- package/components/utils-BCvapeyS.cjs +0 -5
- package/components/utils-CG5ADU6a.cjs +0 -5
- package/components/utils-COXr0j7Z.js +0 -6803
- package/components/utils-CbMHM9Bv.js +0 -6831
- package/components/utils-ClIENp93.js +0 -6906
- package/components/utils-Cun_uLlb.js +0 -6890
- package/components/utils-D6FQ3_dW.cjs +0 -5
- package/components/utils-De4h5fhB.js +0 -6918
- package/components/utils-DrFJq1GB.js +0 -6819
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e = 0.972, s = 2.4, a = 9e-3, I = 1200, _ = 0.
|
|
1
|
+
const e = 0.972, s = 2.4, a = 9e-3, I = 1200, _ = 0.3, t = 1.2, f = 0.3, n = 0.998, i = 0.5, T = 0.94, r = 1e4, o = 0.25, c = 2500, N = 6e3, S = ["#c0392b", "#c8a84b"], E = ["#fff7a8", "#ffd229", "#ff9f1c", "#ff3158", "#ffffff"], O = ["#fff7a8", "#ffd229", "#ff9f1c", "#ff3158", "#36c7ff", "#ffffff"], m = [
|
|
2
2
|
{ name: { "*": "Cash Bonus" }, image1: {}, prizeText: { "*": "Cash Bonus" }, prizeImage: {}, rules: [] },
|
|
3
3
|
{ name: { "*": "Free Spins" }, image1: {}, prizeText: { "*": "Free Spins" }, prizeImage: {}, rules: [] },
|
|
4
4
|
{ name: { "*": "Try Again" }, image1: {}, prizeText: { "*": "Try Again" }, prizeImage: {}, rules: [] },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const _=["#c0392b","#c8a84b"],I=["#fff7a8","#ffd229","#ff9f1c","#ff3158","#ffffff"],N=["#fff7a8","#ffd229","#ff9f1c","#ff3158","#36c7ff","#ffffff"],T=[{name:{"*":"Cash Bonus"},image1:{},prizeText:{"*":"Cash Bonus"},prizeImage:{},rules:[]},{name:{"*":"Free Spins"},image1:{},prizeText:{"*":"Free Spins"},prizeImage:{},rules:[]},{name:{"*":"Try Again"},image1:{},prizeText:{"*":"Try Again"},prizeImage:{},rules:[]},{name:{"*":"VIP Points"},image1:{},prizeText:{"*":"VIP Points"},prizeImage:{},rules:[]},{name:{"*":"Mystery Prize"},image1:{},prizeText:{"*":"Mystery Prize"},prizeImage:{},rules:[]},{name:{"*":"Jackpot"},image1:{},prizeText:{"*":"Jackpot"},prizeImage:{},rules:[]},{name:{"*":"Loyalty Points"},image1:{},prizeText:{"*":"Loyalty Points"},prizeImage:{},rules:[]}];exports.ABORT_SPIN_DECAY=.94;exports.CONFETTI_COLORS=I;exports.DRAG_MIN_VELOCITY=.
|
|
1
|
+
"use strict";const _=["#c0392b","#c8a84b"],I=["#fff7a8","#ffd229","#ff9f1c","#ff3158","#ffffff"],N=["#fff7a8","#ffd229","#ff9f1c","#ff3158","#36c7ff","#ffffff"],T=[{name:{"*":"Cash Bonus"},image1:{},prizeText:{"*":"Cash Bonus"},prizeImage:{},rules:[]},{name:{"*":"Free Spins"},image1:{},prizeText:{"*":"Free Spins"},prizeImage:{},rules:[]},{name:{"*":"Try Again"},image1:{},prizeText:{"*":"Try Again"},prizeImage:{},rules:[]},{name:{"*":"VIP Points"},image1:{},prizeText:{"*":"VIP Points"},prizeImage:{},rules:[]},{name:{"*":"Mystery Prize"},image1:{},prizeText:{"*":"Mystery Prize"},prizeImage:{},rules:[]},{name:{"*":"Jackpot"},image1:{},prizeText:{"*":"Jackpot"},prizeImage:{},rules:[]},{name:{"*":"Loyalty Points"},image1:{},prizeText:{"*":"Loyalty Points"},prizeImage:{},rules:[]}];exports.ABORT_SPIN_DECAY=.94;exports.CONFETTI_COLORS=I;exports.DRAG_MIN_VELOCITY=.3;exports.FALLBACK_SLICE_COLORS=_;exports.FREE_SPIN_DECAY=.998;exports.FREE_SPIN_VELOCITY_FLOOR=.5;exports.LANDING_MAX_DURATION_MS=6e3;exports.LANDING_MIN_DURATION_MS=2500;exports.LANDING_MIN_VELOCITY=.25;exports.PRIZE_HIT_MS=1200;exports.SPIN_BUTTON_VELOCITY_MIN=1.2;exports.SPIN_BUTTON_VELOCITY_RANGE=.3;exports.SPIN_DECAY=.972;exports.SPIN_MAX_VELOCITY=2.4;exports.SPIN_SETTLE_THRESHOLD=.009;exports.SPIN_TIMEOUT_MS=1e4;exports.SUCCESS_CONFETTI_COLORS=N;exports.placeholderWheelSlices=T;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const p=require("./constants-
|
|
1
|
+
"use strict";const p=require("./constants-DM6Vdc6Z.cjs");function S(o,i,h,c=14){var d;const t=o.getBoundingClientRect(),r=i-t.left,y=h-t.top,a=Math.min(c,30),s=o.parentElement;s&&((d=s.classList)==null||d.add("is-bursting"),clearTimeout(s._burstTimer),s._burstTimer=setTimeout(()=>{var n;return(n=s.classList)==null?void 0:n.remove("is-bursting")},780));for(let n=0;n<a;n++){const e=document.createElement("span"),m=n<Math.ceil(a*.18),M=Math.random();e.className=m?"sparkle":`confetti ${M>.76?"is-diamond":M>.56?"is-ribbon":""}`;const l=Math.PI*2*n/a+(Math.random()-.5)*.42,u=t.width*(.12+Math.random()*.14),x=Math.sin(l)<0?1.08:.74,P=Math.cos(l)*u,C=Math.sin(l)*u*x,$=m?4+Math.random()*7:4+Math.random()*8,f=m?$:3+Math.random()*8;e.style.setProperty("--x",`${r}px`),e.style.setProperty("--y",`${y}px`),e.style.setProperty("--tx",`${P}px`),e.style.setProperty("--ty",`${C}px`),e.style.setProperty("--fall",`${42+Math.random()*82}px`),e.style.setProperty("--w",`${$}px`),e.style.setProperty("--h",`${f}px`),e.style.setProperty("--radius",`${m?50:2+Math.random()*4}px`),e.style.setProperty("--hue",p.CONFETTI_COLORS[Math.floor(Math.random()*p.CONFETTI_COLORS.length)]),e.style.setProperty("--d",`${950+Math.random()*700}ms`),e.style.setProperty("--rot",`${Math.random()*360}deg`),e.style.setProperty("--spin",`${(Math.random()>.5?1:-1)*(180+Math.random()*360)}deg`),e.style.animationDelay=`${Math.random()*55}ms`,o.appendChild(e),e.addEventListener("animationend",()=>e.remove(),{once:!0})}}function b(o){o.innerHTML="";const i=window.matchMedia("(pointer: coarse), (max-width: 640px)").matches,h=i?28:44;for(let c=0;c<h;c++){const t=document.createElement("span"),r=Math.random();t.className=`success-confetti-piece ${r>.78?"is-diamond":r>.56?"is-ribbon":""}`;const y=8+Math.random()*84,a=(Math.random()-.5)*(i?130:190),s=5+Math.random()*8,d=r>.56?3+Math.random()*8:7+Math.random()*11;t.style.setProperty("--x",`${y}%`),t.style.setProperty("--tx",`${a}px`),t.style.setProperty("--w",`${s}px`),t.style.setProperty("--h",`${d}px`),t.style.setProperty("--hue",p.SUCCESS_CONFETTI_COLORS[Math.floor(Math.random()*p.SUCCESS_CONFETTI_COLORS.length)]),t.style.setProperty("--d",`${1500+Math.random()*1050}ms`),t.style.setProperty("--rot",`${Math.random()*360}deg`),t.style.setProperty("--spin",`${(Math.random()>.5?1:-1)*(260+Math.random()*520)}deg`),t.style.animationDelay=`${Math.random()*260}ms`,o.appendChild(t),t.addEventListener("animationend",()=>t.remove(),{once:!0})}}exports.burstSparkles=S;exports.burstSuccessConfetti=b;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as u, C as x } from "./constants-
|
|
1
|
+
import { S as u, C as x } from "./constants-CWz8CXw2.js";
|
|
2
2
|
function C(o, i, c, d = 14) {
|
|
3
3
|
const t = o.getBoundingClientRect(), n = i - t.left, p = c - t.top, r = Math.min(d, 30), s = o.parentElement;
|
|
4
4
|
s && (s.classList?.add("is-bursting"), clearTimeout(s._burstTimer), s._burstTimer = setTimeout(() => s.classList?.remove("is-bursting"), 780));
|
|
@@ -1,78 +1,79 @@
|
|
|
1
|
-
import { b as
|
|
2
|
-
import { D as
|
|
3
|
-
function
|
|
4
|
-
const { stage: a, disc: l, sparkleLayer:
|
|
1
|
+
import { b as ot } from "./sparkles-BzZDomk7.js";
|
|
2
|
+
import { D as at, F as rt, a as O, b as ct, c as x, d as H, P as lt, e as ut, f as mt, A as dt, L as pt, g as ft, h as vt } from "./constants-CWz8CXw2.js";
|
|
3
|
+
function Mt(M) {
|
|
4
|
+
const { stage: a, disc: l, sparkleLayer: q, sliceCount: _, onSpinStart: D, onDragStart: Y, onSettled: B, onPrizeClear: U, onSpinAbort: k, liteMode: E } = M;
|
|
5
5
|
let m = 0, r = 0, f = 0, v = "idle", d = 0, i = null;
|
|
6
6
|
p(m);
|
|
7
7
|
function p(t) {
|
|
8
8
|
m = t, l.style.setProperty("--wheel-rotation", `${t}deg`);
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function w(t) {
|
|
11
11
|
return (t + 540) % 360 - 180;
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function y(t) {
|
|
14
14
|
const e = l.getBoundingClientRect(), n = e.left + e.width / 2, s = e.top + e.height / 2;
|
|
15
15
|
return Math.atan2(t.clientY - s, t.clientX - n) * 180 / Math.PI;
|
|
16
16
|
}
|
|
17
17
|
function h() {
|
|
18
18
|
r && cancelAnimationFrame(r), r = 0, a.classList.remove("is-spin-active");
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function z() {
|
|
21
21
|
const t = _();
|
|
22
22
|
if (t === 0) return 0;
|
|
23
23
|
const e = 360 / t, n = (-m % 360 + 360) % 360;
|
|
24
24
|
return Math.floor(n / e) % t;
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
const e = t !== void 0 ? t :
|
|
26
|
+
function S(t) {
|
|
27
|
+
const e = t !== void 0 ? t : z();
|
|
28
28
|
a.classList.add("is-prize-hit"), f && clearTimeout(f), f = window.setTimeout(() => {
|
|
29
|
-
a.classList.remove("is-prize-hit"), f = 0,
|
|
30
|
-
},
|
|
29
|
+
a.classList.remove("is-prize-hit"), f = 0, U?.();
|
|
30
|
+
}, lt), B?.(e);
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function G(t, e = !0) {
|
|
33
33
|
h(), a.classList.add("is-spin-active");
|
|
34
|
-
let n = performance.now(), s = Math.max(-
|
|
34
|
+
let n = performance.now(), s = Math.max(-H, Math.min(H, t));
|
|
35
35
|
function o(c) {
|
|
36
36
|
const u = Math.min(32, c - n);
|
|
37
|
-
n = c, p(m + s * u), s *= Math.pow(
|
|
37
|
+
n = c, p(m + s * u), s *= Math.pow(ct, u / 16.67), Math.abs(s) > x ? r = requestAnimationFrame(o) : (r = 0, a.classList.remove("is-spin-active"), e && S());
|
|
38
38
|
}
|
|
39
39
|
r = requestAnimationFrame(o);
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function V() {
|
|
42
42
|
const t = l.getBoundingClientRect(), e = t.left + t.width / 2, n = t.top + t.height / 2;
|
|
43
43
|
a.classList.add("is-spinning");
|
|
44
44
|
const s = a;
|
|
45
|
-
clearTimeout(s._spinGlowTimer), s._spinGlowTimer = setTimeout(() => a.classList.remove("is-spinning"), 960)
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
45
|
+
if (clearTimeout(s._spinGlowTimer), s._spinGlowTimer = setTimeout(() => a.classList.remove("is-spinning"), 960), !E) {
|
|
46
|
+
const o = window.matchMedia("(pointer: coarse), (max-width: 640px)").matches;
|
|
47
|
+
ot(q, e, n, o ? 8 : 18);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function X(t) {
|
|
51
|
+
l.style.animation = "none", h(), a.classList.remove("is-prize-hit"), f && (clearTimeout(f), f = 0), v = "free", t !== void 0 ? d = t : d = -(ut + Math.random() * mt);
|
|
52
|
+
const e = t !== void 0 ? Math.min(O, Math.abs(t)) : O;
|
|
53
|
+
V(), D?.(), a.classList.add("is-spin-active");
|
|
53
54
|
let n = performance.now();
|
|
54
55
|
function s(o) {
|
|
55
56
|
if (v !== "free") return;
|
|
56
57
|
const c = Math.min(32, o - n);
|
|
57
|
-
n = o, p(m + d * c), d *= Math.pow(
|
|
58
|
+
n = o, p(m + d * c), d *= Math.pow(rt, c / 16.67), Math.abs(d) < e && (d = d < 0 ? -e : e), r = requestAnimationFrame(s);
|
|
58
59
|
}
|
|
59
60
|
r = requestAnimationFrame(s);
|
|
60
61
|
}
|
|
61
|
-
function
|
|
62
|
-
v === "free" && (v = "targeted", h(),
|
|
62
|
+
function W(t) {
|
|
63
|
+
v === "free" && (v = "targeted", h(), $(t));
|
|
63
64
|
}
|
|
64
|
-
function
|
|
65
|
+
function Z() {
|
|
65
66
|
if (v !== "free") return;
|
|
66
67
|
v = "aborting", h();
|
|
67
68
|
let t = performance.now(), e = d;
|
|
68
69
|
a.classList.add("is-spin-active");
|
|
69
70
|
function n(s) {
|
|
70
71
|
const o = Math.min(32, s - t);
|
|
71
|
-
t = s, p(m + e * o), e *= Math.pow(
|
|
72
|
+
t = s, p(m + e * o), e *= Math.pow(dt, o / 16.67), Math.abs(e) > x ? r = requestAnimationFrame(n) : (r = 0, a.classList.remove("is-spin-active"), v = "idle", k?.());
|
|
72
73
|
}
|
|
73
74
|
r = requestAnimationFrame(n);
|
|
74
75
|
}
|
|
75
|
-
function
|
|
76
|
+
function N(t) {
|
|
76
77
|
h();
|
|
77
78
|
const e = m, n = t - e;
|
|
78
79
|
if (Math.abs(n) < 0.5) {
|
|
@@ -86,34 +87,34 @@ function gt(M) {
|
|
|
86
87
|
}
|
|
87
88
|
r = requestAnimationFrame(c);
|
|
88
89
|
}
|
|
89
|
-
function
|
|
90
|
+
function $(t) {
|
|
90
91
|
const e = _();
|
|
91
92
|
if (e === 0) return;
|
|
92
|
-
const n = 360 / e, s = (t + 0.5) * n, o = (-m % 360 + 360) % 360, c = ((s - o) % 360 + 360) % 360, u = d <= 0, g = u ? c : (360 - c) % 360, T = Math.abs(d),
|
|
93
|
-
|
|
94
|
-
Math.min(
|
|
95
|
-
),
|
|
93
|
+
const n = 360 / e, s = (t + 0.5) * n, o = (-m % 360 + 360) % 360, c = ((s - o) % 360 + 360) % 360, u = d <= 0, g = u ? c : (360 - c) % 360, T = Math.abs(d), Q = E ? 2 : Math.max(2, Math.round(T * 3)), I = g + Q * 360, A = m, F = u ? A - I : A + I, tt = Math.max(vt, T), et = Math.max(
|
|
94
|
+
pt,
|
|
95
|
+
Math.min(ft, 2 * I / tt)
|
|
96
|
+
), nt = performance.now();
|
|
96
97
|
a.classList.add("is-spin-active");
|
|
97
|
-
function
|
|
98
|
-
const
|
|
99
|
-
p(A + (
|
|
98
|
+
function b(it) {
|
|
99
|
+
const C = Math.min(1, (it - nt) / et), st = 1 - Math.pow(1 - C, 2);
|
|
100
|
+
p(A + (F - A) * st), C < 1 ? r = requestAnimationFrame(b) : (r = 0, a.classList.remove("is-spin-active"), v = "idle", p(F), S(t));
|
|
100
101
|
}
|
|
101
|
-
r = requestAnimationFrame(
|
|
102
|
+
r = requestAnimationFrame(b);
|
|
102
103
|
}
|
|
103
|
-
function
|
|
104
|
+
function j(t) {
|
|
104
105
|
t.classList.remove("is-pressing"), t.offsetWidth, t.classList.add("is-pressing");
|
|
105
106
|
const e = t;
|
|
106
107
|
clearTimeout(e._pressTimer), e._pressTimer = setTimeout(() => t.classList.remove("is-pressing"), 620);
|
|
107
108
|
}
|
|
108
|
-
function
|
|
109
|
+
function R(t) {
|
|
109
110
|
if (M.centerButtonEl && M.centerButtonEl.contains(t.target)) return;
|
|
110
111
|
if (i !== null) {
|
|
111
|
-
l.releasePointerCapture(i.pointerId), a.classList.remove("is-dragging"),
|
|
112
|
+
l.releasePointerCapture(i.pointerId), a.classList.remove("is-dragging"), N(i.startRotation), i = null;
|
|
112
113
|
return;
|
|
113
114
|
}
|
|
114
115
|
if (!t.isPrimary) return;
|
|
115
|
-
t.preventDefault(),
|
|
116
|
-
const e =
|
|
116
|
+
t.preventDefault(), Y?.(), h(), a.classList.add("is-dragging"), l.setPointerCapture?.(t.pointerId);
|
|
117
|
+
const e = y(t);
|
|
117
118
|
i = {
|
|
118
119
|
pointerId: t.pointerId,
|
|
119
120
|
startAngle: e,
|
|
@@ -126,10 +127,10 @@ function gt(M) {
|
|
|
126
127
|
velocityHistory: [{ cumulative: 0, t: performance.now() }]
|
|
127
128
|
};
|
|
128
129
|
}
|
|
129
|
-
function
|
|
130
|
+
function P(t) {
|
|
130
131
|
if (!i || t.pointerId !== i.pointerId) return;
|
|
131
132
|
t.preventDefault();
|
|
132
|
-
const e = performance.now(), n =
|
|
133
|
+
const e = performance.now(), n = y(t), s = w(n - i.startAngle), o = w(n - i.previousAngle), c = Math.max(8, e - i.previousTime);
|
|
133
134
|
Math.abs(s) > 2 && (i.didDrag = !0), p(i.startRotation + s), i.velocity = o / c, i.previousAngle = n, i.previousTime = e, i.cumulativeDelta += o, i.velocityHistory.push({ cumulative: i.cumulativeDelta, t: e });
|
|
134
135
|
const u = e - 150;
|
|
135
136
|
for (; i.velocityHistory.length > 2 && i.velocityHistory[0].t < u; )
|
|
@@ -145,16 +146,16 @@ function gt(M) {
|
|
|
145
146
|
} else
|
|
146
147
|
n = i.velocity;
|
|
147
148
|
const s = i.didDrag, o = i.startRotation;
|
|
148
|
-
i = null, a.classList.remove("is-dragging"), l.releasePointerCapture?.(t.pointerId), s && Math.abs(n) >
|
|
149
|
-
}
|
|
150
|
-
function j() {
|
|
151
|
-
l.addEventListener("pointerdown", N), l.addEventListener("pointermove", R), l.addEventListener("pointerup", L), l.addEventListener("pointercancel", L);
|
|
149
|
+
i = null, a.classList.remove("is-dragging"), l.releasePointerCapture?.(t.pointerId), s && Math.abs(n) > at ? M.onDragRelease ? M.onDragRelease(n) : (D?.(), G(n, !0)) : s && N(o);
|
|
152
150
|
}
|
|
153
151
|
function J() {
|
|
154
|
-
|
|
152
|
+
l.addEventListener("pointerdown", R), l.addEventListener("pointermove", P), l.addEventListener("pointerup", L), l.addEventListener("pointercancel", L);
|
|
153
|
+
}
|
|
154
|
+
function K() {
|
|
155
|
+
h(), f && clearTimeout(f), l.removeEventListener("pointerdown", R), l.removeEventListener("pointermove", P), l.removeEventListener("pointerup", L), l.removeEventListener("pointercancel", L);
|
|
155
156
|
}
|
|
156
|
-
return { startFreeSpin:
|
|
157
|
+
return { startFreeSpin: X, landOnIndex: W, abortSpin: Z, enableDrag: J, destroy: K, centerButtonPress: j };
|
|
157
158
|
}
|
|
158
159
|
export {
|
|
159
|
-
|
|
160
|
+
Mt as c
|
|
160
161
|
};
|
|
@@ -1,78 +1,79 @@
|
|
|
1
|
-
import { b as
|
|
2
|
-
import { D as
|
|
3
|
-
function
|
|
4
|
-
const { stage: r, disc: o, sparkleLayer:
|
|
1
|
+
import { b as ot } from "./sparkles-C9wObsYC.js";
|
|
2
|
+
import { D as at, F as rt, a as Y, b as ct, c as B, d as U, P as lt, e as ut, f as mt, A as dt, L as ft, g as pt, h as vt } from "./constants-CWz8CXw2.js";
|
|
3
|
+
function gt(T) {
|
|
4
|
+
const { stage: r, disc: o, sparkleLayer: k, sliceCount: N, onSpinStart: L, onDragStart: _, onSettled: E, onPrizeClear: D, onSpinAbort: w, liteMode: R } = T;
|
|
5
5
|
let m = 0, c = 0, p = 0, v = "idle", d = 0, i = null;
|
|
6
6
|
f(m);
|
|
7
7
|
function f(t) {
|
|
8
8
|
m = t, o.style.setProperty("--wheel-rotation", `${t}deg`);
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function P(t) {
|
|
11
11
|
return (t + 540) % 360 - 180;
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function F(t) {
|
|
14
14
|
const e = o.getBoundingClientRect(), n = e.left + e.width / 2, s = e.top + e.height / 2;
|
|
15
15
|
return Math.atan2(t.clientY - s, t.clientX - n) * 180 / Math.PI;
|
|
16
16
|
}
|
|
17
17
|
function h() {
|
|
18
18
|
c && cancelAnimationFrame(c), c = 0, r.classList.remove("is-spin-active");
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function G() {
|
|
21
21
|
const t = N();
|
|
22
22
|
if (t === 0) return 0;
|
|
23
23
|
const e = 360 / t, n = (-m % 360 + 360) % 360;
|
|
24
24
|
return Math.floor(n / e) % t;
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
const e = t !== void 0 ? t :
|
|
26
|
+
function O(t) {
|
|
27
|
+
const e = t !== void 0 ? t : G();
|
|
28
28
|
r.classList.add("is-prize-hit"), p && clearTimeout(p), p = window.setTimeout(() => {
|
|
29
29
|
r.classList.remove("is-prize-hit"), p = 0, D == null || D();
|
|
30
|
-
},
|
|
30
|
+
}, lt), E == null || E(e);
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function z(t, e = !0) {
|
|
33
33
|
h(), r.classList.add("is-spin-active");
|
|
34
|
-
let n = performance.now(), s = Math.max(-
|
|
34
|
+
let n = performance.now(), s = Math.max(-U, Math.min(U, t));
|
|
35
35
|
function a(l) {
|
|
36
36
|
const u = Math.min(32, l - n);
|
|
37
|
-
n = l, f(m + s * u), s *= Math.pow(
|
|
37
|
+
n = l, f(m + s * u), s *= Math.pow(ct, u / 16.67), Math.abs(s) > B ? c = requestAnimationFrame(a) : (c = 0, r.classList.remove("is-spin-active"), e && O());
|
|
38
38
|
}
|
|
39
39
|
c = requestAnimationFrame(a);
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function V() {
|
|
42
42
|
const t = o.getBoundingClientRect(), e = t.left + t.width / 2, n = t.top + t.height / 2;
|
|
43
43
|
r.classList.add("is-spinning");
|
|
44
44
|
const s = r;
|
|
45
|
-
clearTimeout(s._spinGlowTimer), s._spinGlowTimer = setTimeout(() => r.classList.remove("is-spinning"), 960)
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
45
|
+
if (clearTimeout(s._spinGlowTimer), s._spinGlowTimer = setTimeout(() => r.classList.remove("is-spinning"), 960), !R) {
|
|
46
|
+
const a = window.matchMedia("(pointer: coarse), (max-width: 640px)").matches;
|
|
47
|
+
ot(k, e, n, a ? 8 : 18);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function X(t) {
|
|
51
|
+
o.style.animation = "none", h(), r.classList.remove("is-prize-hit"), p && (clearTimeout(p), p = 0), v = "free", t !== void 0 ? d = t : d = -(ut + Math.random() * mt);
|
|
52
|
+
const e = t !== void 0 ? Math.min(Y, Math.abs(t)) : Y;
|
|
53
|
+
V(), L == null || L(), r.classList.add("is-spin-active");
|
|
53
54
|
let n = performance.now();
|
|
54
55
|
function s(a) {
|
|
55
56
|
if (v !== "free") return;
|
|
56
57
|
const l = Math.min(32, a - n);
|
|
57
|
-
n = a, f(m + d * l), d *= Math.pow(
|
|
58
|
+
n = a, f(m + d * l), d *= Math.pow(rt, l / 16.67), Math.abs(d) < e && (d = d < 0 ? -e : e), c = requestAnimationFrame(s);
|
|
58
59
|
}
|
|
59
60
|
c = requestAnimationFrame(s);
|
|
60
61
|
}
|
|
61
|
-
function
|
|
62
|
-
v === "free" && (v = "targeted", h(),
|
|
62
|
+
function W(t) {
|
|
63
|
+
v === "free" && (v = "targeted", h(), $(t));
|
|
63
64
|
}
|
|
64
|
-
function
|
|
65
|
+
function Z() {
|
|
65
66
|
if (v !== "free") return;
|
|
66
67
|
v = "aborting", h();
|
|
67
68
|
let t = performance.now(), e = d;
|
|
68
69
|
r.classList.add("is-spin-active");
|
|
69
70
|
function n(s) {
|
|
70
71
|
const a = Math.min(32, s - t);
|
|
71
|
-
t = s, f(m + e * a), e *= Math.pow(
|
|
72
|
+
t = s, f(m + e * a), e *= Math.pow(dt, a / 16.67), Math.abs(e) > B ? c = requestAnimationFrame(n) : (c = 0, r.classList.remove("is-spin-active"), v = "idle", w == null || w());
|
|
72
73
|
}
|
|
73
74
|
c = requestAnimationFrame(n);
|
|
74
75
|
}
|
|
75
|
-
function
|
|
76
|
+
function b(t) {
|
|
76
77
|
h();
|
|
77
78
|
const e = m, n = t - e;
|
|
78
79
|
if (Math.abs(n) < 0.5) {
|
|
@@ -86,35 +87,35 @@ function Mt(T) {
|
|
|
86
87
|
}
|
|
87
88
|
c = requestAnimationFrame(l);
|
|
88
89
|
}
|
|
89
|
-
function
|
|
90
|
+
function $(t) {
|
|
90
91
|
const e = N();
|
|
91
92
|
if (e === 0) return;
|
|
92
|
-
const n = 360 / e, s = (t + 0.5) * n, a = (-m % 360 + 360) % 360, l = ((s - a) % 360 + 360) % 360, u = d <= 0, M = u ? l : (360 - l) % 360, g = Math.abs(d),
|
|
93
|
-
|
|
94
|
-
Math.min(
|
|
95
|
-
),
|
|
93
|
+
const n = 360 / e, s = (t + 0.5) * n, a = (-m % 360 + 360) % 360, l = ((s - a) % 360 + 360) % 360, u = d <= 0, M = u ? l : (360 - l) % 360, g = Math.abs(d), Q = R ? 2 : Math.max(2, Math.round(g * 3)), y = M + Q * 360, A = m, S = u ? A - y : A + y, tt = Math.max(vt, g), et = Math.max(
|
|
94
|
+
ft,
|
|
95
|
+
Math.min(pt, 2 * y / tt)
|
|
96
|
+
), nt = performance.now();
|
|
96
97
|
r.classList.add("is-spin-active");
|
|
97
|
-
function
|
|
98
|
-
const
|
|
99
|
-
f(A + (
|
|
98
|
+
function H(it) {
|
|
99
|
+
const q = Math.min(1, (it - nt) / et), st = 1 - Math.pow(1 - q, 2);
|
|
100
|
+
f(A + (S - A) * st), q < 1 ? c = requestAnimationFrame(H) : (c = 0, r.classList.remove("is-spin-active"), v = "idle", f(S), O(t));
|
|
100
101
|
}
|
|
101
|
-
c = requestAnimationFrame(
|
|
102
|
+
c = requestAnimationFrame(H);
|
|
102
103
|
}
|
|
103
|
-
function
|
|
104
|
+
function j(t) {
|
|
104
105
|
t.classList.remove("is-pressing"), t.offsetWidth, t.classList.add("is-pressing");
|
|
105
106
|
const e = t;
|
|
106
107
|
clearTimeout(e._pressTimer), e._pressTimer = setTimeout(() => t.classList.remove("is-pressing"), 620);
|
|
107
108
|
}
|
|
108
|
-
function
|
|
109
|
+
function C(t) {
|
|
109
110
|
var n;
|
|
110
111
|
if (T.centerButtonEl && T.centerButtonEl.contains(t.target)) return;
|
|
111
112
|
if (i !== null) {
|
|
112
|
-
o.releasePointerCapture(i.pointerId), r.classList.remove("is-dragging"),
|
|
113
|
+
o.releasePointerCapture(i.pointerId), r.classList.remove("is-dragging"), b(i.startRotation), i = null;
|
|
113
114
|
return;
|
|
114
115
|
}
|
|
115
116
|
if (!t.isPrimary) return;
|
|
116
117
|
t.preventDefault(), _ == null || _(), h(), r.classList.add("is-dragging"), (n = o.setPointerCapture) == null || n.call(o, t.pointerId);
|
|
117
|
-
const e =
|
|
118
|
+
const e = F(t);
|
|
118
119
|
i = {
|
|
119
120
|
pointerId: t.pointerId,
|
|
120
121
|
startAngle: e,
|
|
@@ -127,10 +128,10 @@ function Mt(T) {
|
|
|
127
128
|
velocityHistory: [{ cumulative: 0, t: performance.now() }]
|
|
128
129
|
};
|
|
129
130
|
}
|
|
130
|
-
function
|
|
131
|
+
function x(t) {
|
|
131
132
|
if (!i || t.pointerId !== i.pointerId) return;
|
|
132
133
|
t.preventDefault();
|
|
133
|
-
const e = performance.now(), n =
|
|
134
|
+
const e = performance.now(), n = F(t), s = P(n - i.startAngle), a = P(n - i.previousAngle), l = Math.max(8, e - i.previousTime);
|
|
134
135
|
Math.abs(s) > 2 && (i.didDrag = !0), f(i.startRotation + s), i.velocity = a / l, i.previousAngle = n, i.previousTime = e, i.cumulativeDelta += a, i.velocityHistory.push({ cumulative: i.cumulativeDelta, t: e });
|
|
135
136
|
const u = e - 150;
|
|
136
137
|
for (; i.velocityHistory.length > 2 && i.velocityHistory[0].t < u; )
|
|
@@ -147,16 +148,16 @@ function Mt(T) {
|
|
|
147
148
|
} else
|
|
148
149
|
n = i.velocity;
|
|
149
150
|
const s = i.didDrag, a = i.startRotation;
|
|
150
|
-
i = null, r.classList.remove("is-dragging"), (l = o.releasePointerCapture) == null || l.call(o, t.pointerId), s && Math.abs(n) >
|
|
151
|
-
}
|
|
152
|
-
function j() {
|
|
153
|
-
o.addEventListener("pointerdown", b), o.addEventListener("pointermove", C), o.addEventListener("pointerup", I), o.addEventListener("pointercancel", I);
|
|
151
|
+
i = null, r.classList.remove("is-dragging"), (l = o.releasePointerCapture) == null || l.call(o, t.pointerId), s && Math.abs(n) > at ? T.onDragRelease ? T.onDragRelease(n) : (L == null || L(), z(n, !0)) : s && b(a);
|
|
154
152
|
}
|
|
155
153
|
function J() {
|
|
156
|
-
|
|
154
|
+
o.addEventListener("pointerdown", C), o.addEventListener("pointermove", x), o.addEventListener("pointerup", I), o.addEventListener("pointercancel", I);
|
|
155
|
+
}
|
|
156
|
+
function K() {
|
|
157
|
+
h(), p && clearTimeout(p), o.removeEventListener("pointerdown", C), o.removeEventListener("pointermove", x), o.removeEventListener("pointerup", I), o.removeEventListener("pointercancel", I);
|
|
157
158
|
}
|
|
158
|
-
return { startFreeSpin:
|
|
159
|
+
return { startFreeSpin: X, landOnIndex: W, abortSpin: Z, enableDrag: J, destroy: K, centerButtonPress: j };
|
|
159
160
|
}
|
|
160
161
|
export {
|
|
161
|
-
|
|
162
|
+
gt as c
|
|
162
163
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const it=require("./sparkles-BnriHiyw.cjs"),u=require("./constants-DM6Vdc6Z.cjs");function st(I){const{stage:a,disc:o,sparkleLayer:B,sliceCount:y,onSpinStart:T,onDragStart:E,onSettled:D,onPrizeClear:N,onSpinAbort:R,liteMode:P}=I;let p=0,c=0,v=0,h="idle",d=0,i=null;f(p);function f(t){p=t,o.style.setProperty("--wheel-rotation",`${t}deg`)}function O(t){return(t+540)%360-180}function F(t){const e=o.getBoundingClientRect(),n=e.left+e.width/2,s=e.top+e.height/2;return Math.atan2(t.clientY-s,t.clientX-n)*180/Math.PI}function M(){c&&cancelAnimationFrame(c),c=0,a.classList.remove("is-spin-active")}function k(){const t=y();if(t===0)return 0;const e=360/t,n=(-p%360+360)%360;return Math.floor(n/e)%t}function S(t){const e=t!==void 0?t:k();a.classList.add("is-prize-hit"),v&&clearTimeout(v),v=window.setTimeout(()=>{a.classList.remove("is-prize-hit"),v=0,N==null||N()},u.PRIZE_HIT_MS),D==null||D(e)}function U(t,e=!0){M(),a.classList.add("is-spin-active");let n=performance.now(),s=Math.max(-u.SPIN_MAX_VELOCITY,Math.min(u.SPIN_MAX_VELOCITY,t));function r(l){const m=Math.min(32,l-n);n=l,f(p+s*m),s*=Math.pow(u.SPIN_DECAY,m/16.67),Math.abs(s)>u.SPIN_SETTLE_THRESHOLD?c=requestAnimationFrame(r):(c=0,a.classList.remove("is-spin-active"),e&&S())}c=requestAnimationFrame(r)}function G(){const t=o.getBoundingClientRect(),e=t.left+t.width/2,n=t.top+t.height/2;a.classList.add("is-spinning");const s=a;if(clearTimeout(s._spinGlowTimer),s._spinGlowTimer=setTimeout(()=>a.classList.remove("is-spinning"),960),!P){const r=window.matchMedia("(pointer: coarse), (max-width: 640px)").matches;it.burstSparkles(B,e,n,r?8:18)}}function V(t){o.style.animation="none",M(),a.classList.remove("is-prize-hit"),v&&(clearTimeout(v),v=0),h="free",t!==void 0?d=t:d=-(u.SPIN_BUTTON_VELOCITY_MIN+Math.random()*u.SPIN_BUTTON_VELOCITY_RANGE);const e=t!==void 0?Math.min(u.FREE_SPIN_VELOCITY_FLOOR,Math.abs(t)):u.FREE_SPIN_VELOCITY_FLOOR;G(),T==null||T(),a.classList.add("is-spin-active");let n=performance.now();function s(r){if(h!=="free")return;const l=Math.min(32,r-n);n=r,f(p+d*l),d*=Math.pow(u.FREE_SPIN_DECAY,l/16.67),Math.abs(d)<e&&(d=d<0?-e:e),c=requestAnimationFrame(s)}c=requestAnimationFrame(s)}function z(t){h==="free"&&(h="targeted",M(),W(t))}function X(){if(h!=="free")return;h="aborting",M();let t=performance.now(),e=d;a.classList.add("is-spin-active");function n(s){const r=Math.min(32,s-t);t=s,f(p+e*r),e*=Math.pow(u.ABORT_SPIN_DECAY,r/16.67),Math.abs(e)>u.SPIN_SETTLE_THRESHOLD?c=requestAnimationFrame(n):(c=0,a.classList.remove("is-spin-active"),h="idle",R==null||R())}c=requestAnimationFrame(n)}function C(t){M();const e=p,n=t-e;if(Math.abs(n)<.5){f(t);return}const s=Math.min(600,Math.max(300,Math.abs(n)*5)),r=performance.now();function l(m){const g=Math.min(1,(m-r)/s),L=1-Math.pow(1-g,3);f(e+n*L),g<1?c=requestAnimationFrame(l):(c=0,f(t))}c=requestAnimationFrame(l)}function W(t){const e=y();if(e===0)return;const n=360/e,s=(t+.5)*n,r=(-p%360+360)%360,l=((s-r)%360+360)%360,m=d<=0,g=m?l:(360-l)%360,L=Math.abs(d),J=P?2:Math.max(2,Math.round(L*3)),w=g+J*360,A=p,q=m?A-w:A+w,K=Math.max(u.LANDING_MIN_VELOCITY,L),Q=Math.max(u.LANDING_MIN_DURATION_MS,Math.min(u.LANDING_MAX_DURATION_MS,2*w/K)),tt=performance.now();a.classList.add("is-spin-active");function x(et){const Y=Math.min(1,(et-tt)/Q),nt=1-Math.pow(1-Y,2);f(A+(q-A)*nt),Y<1?c=requestAnimationFrame(x):(c=0,a.classList.remove("is-spin-active"),h="idle",f(q),S(t))}c=requestAnimationFrame(x)}function Z(t){t.classList.remove("is-pressing"),t.offsetWidth,t.classList.add("is-pressing");const e=t;clearTimeout(e._pressTimer),e._pressTimer=setTimeout(()=>t.classList.remove("is-pressing"),620)}function b(t){var n;if(I.centerButtonEl&&I.centerButtonEl.contains(t.target))return;if(i!==null){o.releasePointerCapture(i.pointerId),a.classList.remove("is-dragging"),C(i.startRotation),i=null;return}if(!t.isPrimary)return;t.preventDefault(),E==null||E(),M(),a.classList.add("is-dragging"),(n=o.setPointerCapture)==null||n.call(o,t.pointerId);const e=F(t);i={pointerId:t.pointerId,startAngle:e,previousAngle:e,startRotation:p,previousTime:performance.now(),velocity:0,didDrag:!1,cumulativeDelta:0,velocityHistory:[{cumulative:0,t:performance.now()}]}}function H(t){if(!i||t.pointerId!==i.pointerId)return;t.preventDefault();const e=performance.now(),n=F(t),s=O(n-i.startAngle),r=O(n-i.previousAngle),l=Math.max(8,e-i.previousTime);Math.abs(s)>2&&(i.didDrag=!0),f(i.startRotation+s),i.velocity=r/l,i.previousAngle=n,i.previousTime=e,i.cumulativeDelta+=r,i.velocityHistory.push({cumulative:i.cumulativeDelta,t:e});const m=e-150;for(;i.velocityHistory.length>2&&i.velocityHistory[0].t<m;)i.velocityHistory.shift()}function _(t){var l;if(!i||t.pointerId!==i.pointerId)return;const e=i.velocityHistory;let n;if(e.length>=2){const m=e[0],g=e[e.length-1],L=g.t-m.t;n=L>0?(g.cumulative-m.cumulative)/L:i.velocity}else n=i.velocity;const s=i.didDrag,r=i.startRotation;i=null,a.classList.remove("is-dragging"),(l=o.releasePointerCapture)==null||l.call(o,t.pointerId),s&&Math.abs(n)>u.DRAG_MIN_VELOCITY?I.onDragRelease?I.onDragRelease(n):(T==null||T(),U(n,!0)):s&&C(r)}function $(){o.addEventListener("pointerdown",b),o.addEventListener("pointermove",H),o.addEventListener("pointerup",_),o.addEventListener("pointercancel",_)}function j(){M(),v&&clearTimeout(v),o.removeEventListener("pointerdown",b),o.removeEventListener("pointermove",H),o.removeEventListener("pointerup",_),o.removeEventListener("pointercancel",_)}return{startFreeSpin:V,landOnIndex:z,abortSpin:X,enableDrag:$,destroy:j,centerButtonPress:Z}}exports.createSpinController=st;
|