@everymatrix/mini-games-hub 0.1.21 → 0.1.22
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/package.json +1 -1
- package/components/BackButton-BMWvZ9Lb.js +0 -39
- package/components/BackButton-BNp3jVLa.js +0 -39
- package/components/BackButton-Bi1zFTns.js +0 -38
- package/components/BackButton-BvRNh4nJ.js +0 -39
- package/components/BackButton-C_v3b0Ky.cjs +0 -1
- package/components/BackButton-D5gfQ3NI.cjs +0 -1
- package/components/BackButton-DznJk3U4.js +0 -38
- package/components/BackButton-gIVGAf6v.js +0 -38
- package/components/BackButton-s0YqvufR.cjs +0 -1
- package/components/CoinFlip-5qt33VpA.js +0 -399
- package/components/CoinFlip-9-7FNYAn.js +0 -364
- package/components/CoinFlip-BWNJK7aS.js +0 -402
- package/components/CoinFlip-BaNNMAYb.cjs +0 -1
- package/components/CoinFlip-BgRZmhbg.js +0 -367
- package/components/CoinFlip-COwy7cq1.cjs +0 -1
- package/components/CoinFlip-CSel9VZR.js +0 -398
- package/components/CoinFlip-ClRh6gz2.js +0 -363
- package/components/CoinFlip-D7Bwnl8W.cjs +0 -1
- package/components/CoinFlip-D8OLaQiA.js +0 -367
- package/components/CoinFlip-Dg2ZA_B2.cjs +0 -1
- package/components/CoinFlip-DoASIhfX.cjs +0 -1
- package/components/CoinFlip-pvtcTO4f.cjs +0 -1
- package/components/CoinFlip-vrZpkrnS.js +0 -402
- package/components/CoinRoyale-4Oe-x5-J.cjs +0 -734
- package/components/CoinRoyale-9nHMXODj.js +0 -1017
- package/components/CoinRoyale-B3bu5S4n.cjs +0 -734
- package/components/CoinRoyale-B4dKiGgG.cjs +0 -736
- package/components/CoinRoyale-BCSu92s7.cjs +0 -759
- package/components/CoinRoyale-BJWVsEJj.cjs +0 -759
- package/components/CoinRoyale-BNxFDqe1.js +0 -999
- package/components/CoinRoyale-BfaHdSQN.cjs +0 -757
- package/components/CoinRoyale-Bgl4Ea3N.js +0 -1018
- package/components/CoinRoyale-BwNvG3QI.js +0 -1009
- package/components/CoinRoyale-Bza84vCL.cjs +0 -738
- package/components/CoinRoyale-C-x6uDgh.js +0 -989
- package/components/CoinRoyale-CAI2JCvG.js +0 -1020
- package/components/CoinRoyale-CGHKZ-kc.js +0 -997
- package/components/CoinRoyale-CbqmmMPg.cjs +0 -736
- package/components/CoinRoyale-ChWsctqo.cjs +0 -759
- package/components/CoinRoyale-Ck3dlmOV.js +0 -1040
- package/components/CoinRoyale-CuEAflkt.cjs +0 -757
- package/components/CoinRoyale-Cw8ImDP5.js +0 -1040
- package/components/CoinRoyale-CxIBSKFK.js +0 -1017
- package/components/CoinRoyale-D-rF6BV4.js +0 -1019
- package/components/CoinRoyale-DH-tQHtT.cjs +0 -736
- package/components/CoinRoyale-DKWXkm3P.js +0 -1040
- package/components/CoinRoyale-DmcgvBwG.js +0 -997
- package/components/CoinRoyale-Y2G7RWga.js +0 -1020
- package/components/CoinRoyale-d2utu3E3.cjs +0 -759
- package/components/CoinRoyale-hmGqx4pF.cjs +0 -759
- package/components/CoinRoyale-ifgbuEK3.cjs +0 -759
- package/components/CoinRoyale-t3opSEHv.js +0 -1038
- package/components/CoinRoyale-xAkf1dm_.cjs +0 -738
- package/components/CoinRoyale-xHokf0cY.js +0 -1020
- package/components/DrawResult-BHZeM1oX.cjs +0 -1
- package/components/DrawResult-BVtwLs-z.js +0 -373
- package/components/DrawResult-CG5KTjF7.cjs +0 -1
- package/components/DrawResult-CbLPtjvZ.js +0 -343
- package/components/DrawResult-DMRODSxk.cjs +0 -1
- package/components/DrawResult-DTJJfQkP.js +0 -373
- package/components/DrawResult-DdL4fFZM.js +0 -343
- package/components/DrawResult-DxG4CaKK.cjs +0 -1
- package/components/DrawResult-SyzKXHgd.js +0 -343
- package/components/DrawResult-ZEAa0flC.js +0 -373
- package/components/GameCard-8k9KvRun.cjs +0 -3
- package/components/GameCard-A3k7RxF5.js +0 -63
- package/components/GameCard-B2td6J8K.js +0 -62
- package/components/GameCard-Bku9nP58.cjs +0 -3
- package/components/GameCard-CBGi9i6m.cjs +0 -3
- package/components/GameCard-CHZmVd6n.cjs +0 -3
- package/components/GameCard-Cj4zAE8_.js +0 -59
- package/components/GameCard-CrKoQU1B.js +0 -59
- package/components/GameCard-DFVjSdtd.cjs +0 -3
- package/components/GameCard-DHetS96-.js +0 -66
- package/components/GameCard-DcWpuwMl.cjs +0 -3
- package/components/GameCard-jIcB63Tt.js +0 -62
- package/components/GameHistory-9Mf_u0La.js +0 -231
- package/components/GameHistory-BktmYuDa.js +0 -231
- package/components/GameHistory-CGAhNQKk.js +0 -231
- package/components/GameHistory-ChYjWDsa.cjs +0 -12
- package/components/GameHistory-CmiIChL-.cjs +0 -12
- package/components/GameHistory-CrrlOaAg.js +0 -231
- package/components/GameHistory-DVsHn3lx.cjs +0 -12
- package/components/GameHistory-_jU0BiqI.js +0 -231
- package/components/GameHistory-aQf3vf9u.cjs +0 -12
- package/components/GameHistory-lyXo0tYb.cjs +0 -12
- package/components/GameHistory-uzrT81kU.js +0 -231
- package/components/GameHistory-v6cI-TIF.cjs +0 -12
- package/components/GamePlaceholder-4oI8uJ-1.cjs +0 -1
- package/components/GamePlaceholder-Bp4nTJeL.js +0 -84
- package/components/GamePlaceholder-COiYGwNi.cjs +0 -15
- package/components/GamePlaceholder-CfJ4hx9w.js +0 -70
- package/components/GamePlaceholder-D9JEXsAk.js +0 -84
- package/components/GamePlaceholder-DGnB06iW.js +0 -71
- package/components/GamePlaceholder-DS5evGU6.js +0 -85
- package/components/GamePlaceholder-DmiU1G7G.cjs +0 -15
- package/components/GamePlaceholder-Dwo_YAUQ.cjs +0 -1
- package/components/GamePlaceholder-Uni3xW09.cjs +0 -15
- package/components/GamePlaceholder-fVPk29f9.cjs +0 -15
- package/components/GamePlaceholder-vUYYV2Ps.js +0 -85
- package/components/GameRules-41OkRwZu.js +0 -115
- package/components/GameRules-BwLJBo6z.cjs +0 -3
- package/components/GameRules-CRiycUU8.js +0 -115
- package/components/GameRules-CTKyBDZO.cjs +0 -3
- package/components/GameRules-CV9sxZYz.js +0 -126
- package/components/GameRules-CuuoMoqN.cjs +0 -3
- package/components/GameRules-Cy7jwBok.js +0 -126
- package/components/GameRules-DUD8OKC0.js +0 -115
- package/components/GameRules-Dkl0qVzr.js +0 -126
- package/components/GameRules-DpGqZdSj.cjs +0 -3
- package/components/GameRules-DrBYjWA6.cjs +0 -3
- package/components/GameRules-DrZ6w0LM.cjs +0 -3
- package/components/MiniGamesHub-9mWWh3N1.js +0 -1111
- package/components/MiniGamesHub-B6YnaRxS.cjs +0 -79
- package/components/MiniGamesHub-B9aQplHl.js +0 -1135
- package/components/MiniGamesHub-BRRQIXZj.cjs +0 -79
- package/components/MiniGamesHub-BWPRLpyq.cjs +0 -16
- package/components/MiniGamesHub-BXcQ_faH.js +0 -1022
- package/components/MiniGamesHub-BaMQ2sWj.js +0 -1105
- package/components/MiniGamesHub-BbkgB1GV.js +0 -1105
- package/components/MiniGamesHub-BjME_rom.cjs +0 -16
- package/components/MiniGamesHub-Bn-xvO1e.js +0 -1055
- package/components/MiniGamesHub-BpjzFxHO.cjs +0 -16
- package/components/MiniGamesHub-BtC6TmtK.cjs +0 -16
- package/components/MiniGamesHub-BvS3Q0HA.js +0 -1135
- package/components/MiniGamesHub-C-9Nf-x7.js +0 -1029
- package/components/MiniGamesHub-C0ESIt9P.cjs +0 -16
- package/components/MiniGamesHub-CQ1jWyWR.js +0 -1111
- package/components/MiniGamesHub-CWV1acJR.cjs +0 -79
- package/components/MiniGamesHub-CfIFEVOU.js +0 -1022
- package/components/MiniGamesHub-CfeP3fA-.cjs +0 -79
- package/components/MiniGamesHub-ChMf3rL7.js +0 -1141
- package/components/MiniGamesHub-Cj_6ebsL.cjs +0 -16
- package/components/MiniGamesHub-CkVJjuZl.cjs +0 -79
- package/components/MiniGamesHub-CktxKKTj.cjs +0 -16
- package/components/MiniGamesHub-ClPq7L0V.cjs +0 -79
- package/components/MiniGamesHub-CrPltGGl.js +0 -1042
- package/components/MiniGamesHub-Cv7rxLAO.cjs +0 -79
- package/components/MiniGamesHub-D2Eet3pe.js +0 -1048
- package/components/MiniGamesHub-D4fNnQ70.js +0 -1141
- package/components/MiniGamesHub-D9A4HvPC.js +0 -1135
- package/components/MiniGamesHub-DCCeYwnc.js +0 -1055
- package/components/MiniGamesHub-DuAv3Z6t.cjs +0 -79
- package/components/MiniGamesHub-DuyWceLB.cjs +0 -16
- package/components/MiniGamesHub-Dz8Ltp98.js +0 -1048
- package/components/MiniGamesHub-_uRBhzYg.js +0 -1029
- package/components/MiniGamesHub-gVFlxi4x.cjs +0 -79
- package/components/MiniGamesHub-kIXoGqbZ.cjs +0 -16
- package/components/MiniGamesHub-o7rVTqn5.cjs +0 -79
- package/components/MiniGamesHub-v8PPHifq.js +0 -1072
- package/components/MiniGamesHub-w5poRbtq.js +0 -1105
- package/components/MysteryChest-4_QXLnuB.js +0 -1298
- package/components/MysteryChest-B10zFJU3.cjs +0 -741
- package/components/MysteryChest-B4h9tqVR.js +0 -1301
- package/components/MysteryChest-BJCFkn02.cjs +0 -737
- package/components/MysteryChest-BXPAdruk.js +0 -1290
- package/components/MysteryChest-Bq1NBRQI.cjs +0 -739
- package/components/MysteryChest-BsUxRwj9.js +0 -1248
- package/components/MysteryChest-BuB9PD57.js +0 -1240
- package/components/MysteryChest-C1jSQFBT.cjs +0 -741
- package/components/MysteryChest-C40hwiCW.cjs +0 -745
- package/components/MysteryChest-CKPELFiF.cjs +0 -737
- package/components/MysteryChest-CRJtPhlo.cjs +0 -743
- package/components/MysteryChest-CScyc3Jw.cjs +0 -745
- package/components/MysteryChest-Cg48wdP6.cjs +0 -741
- package/components/MysteryChest-CheF_Rh5.cjs +0 -739
- package/components/MysteryChest-CkSMlhn1.cjs +0 -741
- package/components/MysteryChest-Cq77jWfV.cjs +0 -739
- package/components/MysteryChest-CrL8IXga.js +0 -1309
- package/components/MysteryChest-CrXzepqD.js +0 -1296
- package/components/MysteryChest-D5OWiZfM.js +0 -1250
- package/components/MysteryChest-D6eks4QE.js +0 -1254
- package/components/MysteryChest-DE2NS9aL.js +0 -1299
- package/components/MysteryChest-DJuhkpSa.cjs +0 -743
- package/components/MysteryChest-DOTlHt7A.js +0 -1248
- package/components/MysteryChest-DfggF659.js +0 -1262
- package/components/MysteryChest-Di-dVQnd.cjs +0 -745
- package/components/MysteryChest-DnstXEZJ.js +0 -1298
- package/components/MysteryChest-IcRh-Dcp.js +0 -1247
- package/components/MysteryChest-dyhqTxMg.cjs +0 -739
- package/components/MysteryChest-egeYjlMm.js +0 -1249
- package/components/MysteryChest-pWptmU6O.js +0 -1297
- package/components/WheelOfFortune--1feiOUD.js +0 -950
- package/components/WheelOfFortune-B0g1znMo.cjs +0 -627
- package/components/WheelOfFortune-BC0wwnC-.cjs +0 -617
- package/components/WheelOfFortune-BYxOqBjA.js +0 -928
- package/components/WheelOfFortune-BgUB1tnc.js +0 -942
- package/components/WheelOfFortune-Bh2XAbs4.cjs +0 -619
- package/components/WheelOfFortune-Bq6wSR__.cjs +0 -627
- package/components/WheelOfFortune-BwmCnHru.js +0 -926
- package/components/WheelOfFortune-CEH-5uIV.js +0 -950
- package/components/WheelOfFortune-CHgHhi9q.cjs +0 -619
- package/components/WheelOfFortune-CRgnumXh.cjs +0 -627
- package/components/WheelOfFortune-CZ2cERqz.cjs +0 -619
- package/components/WheelOfFortune-CpYsfi8D.js +0 -934
- package/components/WheelOfFortune-CriOHAfp.cjs +0 -627
- package/components/WheelOfFortune-Cy64rFDw.js +0 -942
- package/components/WheelOfFortune-D2AVLv8r.js +0 -934
- package/components/WheelOfFortune-D2dcgbxg.js +0 -934
- package/components/WheelOfFortune-DZ7fGpS9.cjs +0 -619
- package/components/WheelOfFortune-DZg0i79U.js +0 -949
- package/components/WheelOfFortune-DawF7WTd.js +0 -944
- package/components/WheelOfFortune-DjdKhLGF.cjs +0 -617
- package/components/WheelOfFortune-Dsr3jMxy.cjs +0 -627
- package/components/WheelOfFortune-KpRQWn3C.cjs +0 -627
- package/components/WheelOfFortune-M5VMIsnw.cjs +0 -619
- package/components/WheelOfFortune-kXjxp6t7.js +0 -926
- package/components/WheelOfFortune-pBG33-QJ.js +0 -933
- package/components/WheelOfFortune-uTfPiHqd.js +0 -950
- package/components/WheelOfFortuneWheel-B4fe-idJ.cjs +0 -3
- package/components/WheelOfFortuneWheel-BABzaEBd.js +0 -1812
- package/components/WheelOfFortuneWheel-BQFaJ7ZB.cjs +0 -3
- package/components/WheelOfFortuneWheel-BYEHNHdI.js +0 -1807
- package/components/WheelOfFortuneWheel-BuBjvGRI.cjs +0 -3
- package/components/WheelOfFortuneWheel-CQCLWOFi.js +0 -1908
- package/components/WheelOfFortuneWheel-CsOjhUcv.cjs +0 -3
- package/components/WheelOfFortuneWheel-DUE4gyGP.js +0 -1741
- package/components/WheelOfFortuneWheel-DXhwrWpD.js +0 -1978
- package/components/WheelOfFortuneWheel-DgVQP4GA.js +0 -1735
- package/components/constants-BDMySuIA.cjs +0 -1
- package/components/constants-DNSPUges.cjs +0 -1
- package/components/constants-DdcZGwlM.js +0 -38
- package/components/constants-DgCBmV7S.js +0 -29
- package/components/countdown-2m_26DZf.js +0 -157
- package/components/countdown-Bp3yWidJ.cjs +0 -1
- package/components/countdown-CH5h-cVr.js +0 -146
- package/components/countdown-CnUPVFlE.cjs +0 -1
- package/components/countdown-YmZm4DrD.js +0 -146
- package/components/sparkles-B2kHtb3R.js +0 -14
- package/components/sparkles-BBLT1jhq.js +0 -14
- package/components/sparkles-BIl7-lvq.cjs +0 -1
- package/components/sparkles-BRrL2C0i.cjs +0 -1
- package/components/sparkles-BXFe6GK6.js +0 -18
- package/components/sparkles-Cot5wZXx.cjs +0 -1
- package/components/sparkles-DKbGLSaY.cjs +0 -1
- package/components/sparkles-WqrZ-iXs.js +0 -18
- package/components/spin-controller-BF6ymCY4.cjs +0 -1
- package/components/spin-controller-Bc8nQATS.cjs +0 -1
- package/components/spin-controller-CC3QZvWl.js +0 -175
- package/components/spin-controller-CEIahkSh.cjs +0 -1
- package/components/spin-controller-CUb1rpPl.js +0 -177
- package/components/spin-controller-CVXfvzb7.cjs +0 -1
- package/components/spin-controller-DkSQ07IL.js +0 -177
- package/components/spin-controller-Dxxx3-ya.js +0 -175
- package/components/utils-AGVOgUGK.cjs +0 -3
- package/components/utils-B3aNdyMX.js +0 -6055
- package/components/utils-DEov6Qk_.js +0 -6007
- package/components/utils-DQ220WK3.js +0 -6016
- package/components/utils-DwrHy7a0.js +0 -6007
- package/components/utils-Dwz-wUFC.cjs +0 -3
- package/components/utils-Rda5erjI.cjs +0 -3
- package/components/utils-fG_nzyoc.cjs +0 -3
- package/components/utils-qUyu-MNU.js +0 -6064
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { C as y } from "./constants-DdcZGwlM.js";
|
|
2
|
-
function T(a, h, l, M = 14) {
|
|
3
|
-
var p;
|
|
4
|
-
const o = a.getBoundingClientRect(), u = h - o.left, x = l - o.top, n = Math.min(M, 30), s = a.parentElement;
|
|
5
|
-
s && ((p = s.classList) == null || p.add("is-bursting"), clearTimeout(s._burstTimer), s._burstTimer = setTimeout(() => {
|
|
6
|
-
var e;
|
|
7
|
-
return (e = s.classList) == null ? void 0 : e.remove("is-bursting");
|
|
8
|
-
}, 780));
|
|
9
|
-
for (let e = 0; e < n; e++) {
|
|
10
|
-
const t = document.createElement("span"), r = e < Math.ceil(n * 0.18), d = Math.random();
|
|
11
|
-
t.className = r ? "sparkle" : `confetti ${d > 0.76 ? "is-diamond" : d > 0.56 ? "is-ribbon" : ""}`;
|
|
12
|
-
const i = Math.PI * 2 * e / n + (Math.random() - 0.5) * 0.42, m = o.width * (0.12 + Math.random() * 0.14), P = Math.sin(i) < 0 ? 1.08 : 0.74, $ = Math.cos(i) * m, f = Math.sin(i) * m * P, c = r ? 4 + Math.random() * 7 : 4 + Math.random() * 8, g = r ? c : 3 + Math.random() * 8;
|
|
13
|
-
t.style.setProperty("--x", `${u}px`), t.style.setProperty("--y", `${x}px`), t.style.setProperty("--tx", `${$}px`), t.style.setProperty("--ty", `${f}px`), t.style.setProperty("--fall", `${42 + Math.random() * 82}px`), t.style.setProperty("--w", `${c}px`), t.style.setProperty("--h", `${g}px`), t.style.setProperty("--radius", `${r ? 50 : 2 + Math.random() * 4}px`), t.style.setProperty("--hue", y[Math.floor(Math.random() * y.length)]), t.style.setProperty("--d", `${950 + Math.random() * 700}ms`), t.style.setProperty("--rot", `${Math.random() * 360}deg`), t.style.setProperty("--spin", `${(Math.random() > 0.5 ? 1 : -1) * (180 + Math.random() * 360)}deg`), t.style.animationDelay = `${Math.random() * 55}ms`, a.appendChild(t), t.addEventListener("animationend", () => t.remove(), { once: !0 });
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
export {
|
|
17
|
-
T as b
|
|
18
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const st=require("./sparkles-Cot5wZXx.cjs"),u=require("./constants-BDMySuIA.cjs");function ot(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,m=0,f="idle",v=0,i=null;h(p);function h(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"),m&&clearTimeout(m),m=window.setTimeout(()=>{a.classList.remove("is-prize-hit"),m=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 d=Math.min(32,l-n);n=l,h(p+s*d),s*=Math.pow(u.SPIN_DECAY,d/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;st.burstSparkles(B,e,n,r?8:18)}}function V(t){o.style.animation="none",M(),a.classList.remove("is-prize-hit"),m&&(clearTimeout(m),m=0),f="free",t!==void 0?v=t:v=-(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(f!=="free")return;const l=Math.min(32,r-n);n=r,h(p+v*l),v*=Math.pow(u.FREE_SPIN_DECAY,l/16.67),Math.abs(v)<e&&(v=v<0?-e:e),c=requestAnimationFrame(s)}c=requestAnimationFrame(s)}function z(t){f==="free"&&(f="targeted",M(),W(t))}function X(){if(f!=="free")return;f="aborting",M();let t=performance.now(),e=v;a.classList.add("is-spin-active");function n(s){const r=Math.min(32,s-t);t=s,h(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"),f="idle",R==null||R())}c=requestAnimationFrame(n)}function C(t){M();const e=p,n=t-e;if(Math.abs(n)<.5){h(t);return}const s=Math.min(600,Math.max(300,Math.abs(n)*5)),r=performance.now();function l(d){const g=Math.min(1,(d-r)/s),L=1-Math.pow(1-g,3);h(e+n*L),g<1?c=requestAnimationFrame(l):(c=0,h(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,d=v<=0,g=d?l:(360-l)%360,L=Math.abs(v),K=P?2:Math.max(2,Math.round(L*3)),w=g+K*360,A=p,q=d?A-w:A+w,Q=Math.max(u.LANDING_MIN_VELOCITY,L),tt=Math.max(u.LANDING_MIN_DURATION_MS,Math.min(u.LANDING_MAX_DURATION_MS,2*w/Q)),et=performance.now();a.classList.add("is-spin-active");function x(nt){const Y=Math.min(1,(nt-et)/tt),it=1-Math.pow(1-Y,2);h(A+(q-A)*it),Y<1?c=requestAnimationFrame(x):(c=0,a.classList.remove("is-spin-active"),f="idle",h(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)||f!=="idle")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),h(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 d=e-150;for(;i.velocityHistory.length>2&&i.velocityHistory[0].t<d;)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 d=e[0],g=e[e.length-1],L=g.t-d.t;n=L>0?(g.cumulative-d.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(),m&&(clearTimeout(m),m=0,a.classList.remove("is-prize-hit")),f="idle",i=null}function J(){M(),m&&clearTimeout(m),o.removeEventListener("pointerdown",b),o.removeEventListener("pointermove",H),o.removeEventListener("pointerup",_),o.removeEventListener("pointercancel",_)}return{startFreeSpin:V,landOnIndex:z,abortSpin:X,reset:j,enableDrag:$,destroy:J,centerButtonPress:Z}}exports.createSpinController=ot;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const ot=require("./sparkles-BIl7-lvq.cjs"),l=require("./constants-BDMySuIA.cjs");function st(L){const{stage:r,disc:u,sparkleLayer:H,sliceCount:E,onSpinStart:S,onDragStart:q,onSettled:x,onPrizeClear:Y,onSpinAbort:B,liteMode:D}=L;let p=0,a=0,m=0,f="idle",v=0,n=null;h(p);function h(t){p=t,u.style.setProperty("--wheel-rotation",`${t}deg`)}function N(t){return(t+540)%360-180}function R(t){const e=u.getBoundingClientRect(),i=e.left+e.width/2,o=e.top+e.height/2;return Math.atan2(t.clientY-o,t.clientX-i)*180/Math.PI}function M(){a&&cancelAnimationFrame(a),a=0,r.classList.remove("is-spin-active")}function k(){const t=E();if(t===0)return 0;const e=360/t,i=(-p%360+360)%360;return Math.floor(i/e)%t}function w(t){const e=t!==void 0?t:k();r.classList.add("is-prize-hit"),m&&clearTimeout(m),m=window.setTimeout(()=>{r.classList.remove("is-prize-hit"),m=0,Y?.()},l.PRIZE_HIT_MS),x?.(e)}function z(t,e=!0){M(),r.classList.add("is-spin-active");let i=performance.now(),o=Math.max(-l.SPIN_MAX_VELOCITY,Math.min(l.SPIN_MAX_VELOCITY,t));function s(c){const d=Math.min(32,c-i);i=c,h(p+o*d),o*=Math.pow(l.SPIN_DECAY,d/16.67),Math.abs(o)>l.SPIN_SETTLE_THRESHOLD?a=requestAnimationFrame(s):(a=0,r.classList.remove("is-spin-active"),e&&w())}a=requestAnimationFrame(s)}function U(){const t=u.getBoundingClientRect(),e=t.left+t.width/2,i=t.top+t.height/2;r.classList.add("is-spinning");const o=r;if(clearTimeout(o._spinGlowTimer),o._spinGlowTimer=setTimeout(()=>r.classList.remove("is-spinning"),960),!D){const s=window.matchMedia("(pointer: coarse), (max-width: 640px)").matches;ot.burstSparkles(H,e,i,s?8:18)}}function G(t){u.style.animation="none",M(),r.classList.remove("is-prize-hit"),m&&(clearTimeout(m),m=0),f="free",t!==void 0?v=t:v=-(l.SPIN_BUTTON_VELOCITY_MIN+Math.random()*l.SPIN_BUTTON_VELOCITY_RANGE);const e=t!==void 0?Math.min(l.FREE_SPIN_VELOCITY_FLOOR,Math.abs(t)):l.FREE_SPIN_VELOCITY_FLOOR;U(),S?.(),r.classList.add("is-spin-active");let i=performance.now();function o(s){if(f!=="free")return;const c=Math.min(32,s-i);i=s,h(p+v*c),v*=Math.pow(l.FREE_SPIN_DECAY,c/16.67),Math.abs(v)<e&&(v=v<0?-e:e),a=requestAnimationFrame(o)}a=requestAnimationFrame(o)}function V(t){f==="free"&&(f="targeted",M(),W(t))}function X(){if(f!=="free")return;f="aborting",M();let t=performance.now(),e=v;r.classList.add("is-spin-active");function i(o){const s=Math.min(32,o-t);t=o,h(p+e*s),e*=Math.pow(l.ABORT_SPIN_DECAY,s/16.67),Math.abs(e)>l.SPIN_SETTLE_THRESHOLD?a=requestAnimationFrame(i):(a=0,r.classList.remove("is-spin-active"),f="idle",B?.())}a=requestAnimationFrame(i)}function y(t){M();const e=p,i=t-e;if(Math.abs(i)<.5){h(t);return}const o=Math.min(600,Math.max(300,Math.abs(i)*5)),s=performance.now();function c(d){const g=Math.min(1,(d-s)/o),I=1-Math.pow(1-g,3);h(e+i*I),g<1?a=requestAnimationFrame(c):(a=0,h(t))}a=requestAnimationFrame(c)}function W(t){const e=E();if(e===0)return;const i=360/e,o=(t+.5)*i,s=(-p%360+360)%360,c=((o-s)%360+360)%360,d=v<=0,g=d?c:(360-c)%360,I=Math.abs(v),K=D?2:Math.max(2,Math.round(I*3)),A=g+K*360,_=p,C=d?_-A:_+A,Q=Math.max(l.LANDING_MIN_VELOCITY,I),tt=Math.max(l.LANDING_MIN_DURATION_MS,Math.min(l.LANDING_MAX_DURATION_MS,2*A/Q)),et=performance.now();r.classList.add("is-spin-active");function F(nt){const b=Math.min(1,(nt-et)/tt),it=1-Math.pow(1-b,2);h(_+(C-_)*it),b<1?a=requestAnimationFrame(F):(a=0,r.classList.remove("is-spin-active"),f="idle",h(C),w(t))}a=requestAnimationFrame(F)}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 P(t){if(L.centerButtonEl&&L.centerButtonEl.contains(t.target)||f!=="idle")return;if(n!==null){u.releasePointerCapture(n.pointerId),r.classList.remove("is-dragging"),y(n.startRotation),n=null;return}if(!t.isPrimary)return;t.preventDefault(),q?.(),M(),r.classList.add("is-dragging"),u.setPointerCapture?.(t.pointerId);const e=R(t);n={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 O(t){if(!n||t.pointerId!==n.pointerId)return;t.preventDefault();const e=performance.now(),i=R(t),o=N(i-n.startAngle),s=N(i-n.previousAngle),c=Math.max(8,e-n.previousTime);Math.abs(o)>2&&(n.didDrag=!0),h(n.startRotation+o),n.velocity=s/c,n.previousAngle=i,n.previousTime=e,n.cumulativeDelta+=s,n.velocityHistory.push({cumulative:n.cumulativeDelta,t:e});const d=e-150;for(;n.velocityHistory.length>2&&n.velocityHistory[0].t<d;)n.velocityHistory.shift()}function T(t){if(!n||t.pointerId!==n.pointerId)return;const e=n.velocityHistory;let i;if(e.length>=2){const c=e[0],d=e[e.length-1],g=d.t-c.t;i=g>0?(d.cumulative-c.cumulative)/g:n.velocity}else i=n.velocity;const o=n.didDrag,s=n.startRotation;n=null,r.classList.remove("is-dragging"),u.releasePointerCapture?.(t.pointerId),o&&Math.abs(i)>l.DRAG_MIN_VELOCITY?L.onDragRelease?L.onDragRelease(i):(S?.(),z(i,!0)):o&&y(s)}function $(){u.addEventListener("pointerdown",P),u.addEventListener("pointermove",O),u.addEventListener("pointerup",T),u.addEventListener("pointercancel",T)}function j(){M(),m&&(clearTimeout(m),m=0,r.classList.remove("is-prize-hit")),f="idle",n=null}function J(){M(),m&&clearTimeout(m),u.removeEventListener("pointerdown",P),u.removeEventListener("pointermove",O),u.removeEventListener("pointerup",T),u.removeEventListener("pointercancel",T)}return{startFreeSpin:G,landOnIndex:V,abortSpin:X,reset:j,enableDrag:$,destroy:J,centerButtonPress:Z}}exports.createSpinController=st;
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
import { b as at } from "./sparkles-BBLT1jhq.js";
|
|
2
|
-
import { D as rt, A as ct, S as O, F as lt, a as x, b as ut, P as mt, c as H, L as dt, d as pt, e as ft, f as vt, g as ht } from "./constants-DdcZGwlM.js";
|
|
3
|
-
function Lt(M) {
|
|
4
|
-
const {
|
|
5
|
-
stage: a,
|
|
6
|
-
disc: l,
|
|
7
|
-
sparkleLayer: q,
|
|
8
|
-
sliceCount: _,
|
|
9
|
-
onSpinStart: D,
|
|
10
|
-
onDragStart: Y,
|
|
11
|
-
onSettled: B,
|
|
12
|
-
onPrizeClear: z,
|
|
13
|
-
onSpinAbort: U,
|
|
14
|
-
liteMode: E
|
|
15
|
-
} = M;
|
|
16
|
-
let d = 0, r = 0, u = 0, p = "idle", f = 0, n = null;
|
|
17
|
-
v(d);
|
|
18
|
-
function v(t) {
|
|
19
|
-
d = t, l.style.setProperty("--wheel-rotation", `${t}deg`);
|
|
20
|
-
}
|
|
21
|
-
function w(t) {
|
|
22
|
-
return (t + 540) % 360 - 180;
|
|
23
|
-
}
|
|
24
|
-
function S(t) {
|
|
25
|
-
const e = l.getBoundingClientRect(), i = e.left + e.width / 2, s = e.top + e.height / 2;
|
|
26
|
-
return Math.atan2(t.clientY - s, t.clientX - i) * 180 / Math.PI;
|
|
27
|
-
}
|
|
28
|
-
function h() {
|
|
29
|
-
r && cancelAnimationFrame(r), r = 0, a.classList.remove("is-spin-active");
|
|
30
|
-
}
|
|
31
|
-
function k() {
|
|
32
|
-
const t = _();
|
|
33
|
-
if (t === 0) return 0;
|
|
34
|
-
const e = 360 / t, i = (-d % 360 + 360) % 360;
|
|
35
|
-
return Math.floor(i / e) % t;
|
|
36
|
-
}
|
|
37
|
-
function y(t) {
|
|
38
|
-
const e = t !== void 0 ? t : k();
|
|
39
|
-
a.classList.add("is-prize-hit"), u && clearTimeout(u), u = window.setTimeout(() => {
|
|
40
|
-
a.classList.remove("is-prize-hit"), u = 0, z?.();
|
|
41
|
-
}, mt), B?.(e);
|
|
42
|
-
}
|
|
43
|
-
function G(t, e = !0) {
|
|
44
|
-
h(), a.classList.add("is-spin-active");
|
|
45
|
-
let i = performance.now(), s = Math.max(-H, Math.min(H, t));
|
|
46
|
-
function o(c) {
|
|
47
|
-
const m = Math.min(32, c - i);
|
|
48
|
-
i = c, v(d + s * m), s *= Math.pow(ut, m / 16.67), Math.abs(s) > O ? r = requestAnimationFrame(o) : (r = 0, a.classList.remove("is-spin-active"), e && y());
|
|
49
|
-
}
|
|
50
|
-
r = requestAnimationFrame(o);
|
|
51
|
-
}
|
|
52
|
-
function V() {
|
|
53
|
-
const t = l.getBoundingClientRect(), e = t.left + t.width / 2, i = t.top + t.height / 2;
|
|
54
|
-
a.classList.add("is-spinning");
|
|
55
|
-
const s = a;
|
|
56
|
-
if (clearTimeout(s._spinGlowTimer), s._spinGlowTimer = setTimeout(() => a.classList.remove("is-spinning"), 960), !E) {
|
|
57
|
-
const o = window.matchMedia("(pointer: coarse), (max-width: 640px)").matches;
|
|
58
|
-
at(q, e, i, o ? 8 : 18);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
function X(t) {
|
|
62
|
-
l.style.animation = "none", h(), a.classList.remove("is-prize-hit"), u && (clearTimeout(u), u = 0), p = "free", t !== void 0 ? f = t : f = -(vt + Math.random() * ht);
|
|
63
|
-
const e = t !== void 0 ? Math.min(x, Math.abs(t)) : x;
|
|
64
|
-
V(), D?.(), a.classList.add("is-spin-active");
|
|
65
|
-
let i = performance.now();
|
|
66
|
-
function s(o) {
|
|
67
|
-
if (p !== "free") return;
|
|
68
|
-
const c = Math.min(32, o - i);
|
|
69
|
-
i = o, v(d + f * c), f *= Math.pow(lt, c / 16.67), Math.abs(f) < e && (f = f < 0 ? -e : e), r = requestAnimationFrame(s);
|
|
70
|
-
}
|
|
71
|
-
r = requestAnimationFrame(s);
|
|
72
|
-
}
|
|
73
|
-
function W(t) {
|
|
74
|
-
p === "free" && (p = "targeted", h(), $(t));
|
|
75
|
-
}
|
|
76
|
-
function Z() {
|
|
77
|
-
if (p !== "free") return;
|
|
78
|
-
p = "aborting", h();
|
|
79
|
-
let t = performance.now(), e = f;
|
|
80
|
-
a.classList.add("is-spin-active");
|
|
81
|
-
function i(s) {
|
|
82
|
-
const o = Math.min(32, s - t);
|
|
83
|
-
t = s, v(d + e * o), e *= Math.pow(ct, o / 16.67), Math.abs(e) > O ? r = requestAnimationFrame(i) : (r = 0, a.classList.remove("is-spin-active"), p = "idle", U?.());
|
|
84
|
-
}
|
|
85
|
-
r = requestAnimationFrame(i);
|
|
86
|
-
}
|
|
87
|
-
function N(t) {
|
|
88
|
-
h();
|
|
89
|
-
const e = d, i = t - e;
|
|
90
|
-
if (Math.abs(i) < 0.5) {
|
|
91
|
-
v(t);
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
const s = Math.min(600, Math.max(300, Math.abs(i) * 5)), o = performance.now();
|
|
95
|
-
function c(m) {
|
|
96
|
-
const g = Math.min(1, (m - o) / s), T = 1 - Math.pow(1 - g, 3);
|
|
97
|
-
v(e + i * T), g < 1 ? r = requestAnimationFrame(c) : (r = 0, v(t));
|
|
98
|
-
}
|
|
99
|
-
r = requestAnimationFrame(c);
|
|
100
|
-
}
|
|
101
|
-
function $(t) {
|
|
102
|
-
const e = _();
|
|
103
|
-
if (e === 0) return;
|
|
104
|
-
const i = 360 / e, s = (t + 0.5) * i, o = (-d % 360 + 360) % 360, c = ((s - o) % 360 + 360) % 360, m = f <= 0, g = m ? c : (360 - c) % 360, T = Math.abs(f), tt = E ? 2 : Math.max(2, Math.round(T * 3)), I = g + tt * 360, A = d, F = m ? A - I : A + I, et = Math.max(ft, T), nt = Math.max(
|
|
105
|
-
dt,
|
|
106
|
-
Math.min(pt, 2 * I / et)
|
|
107
|
-
), it = performance.now();
|
|
108
|
-
a.classList.add("is-spin-active");
|
|
109
|
-
function b(st) {
|
|
110
|
-
const C = Math.min(1, (st - it) / nt), ot = 1 - Math.pow(1 - C, 2);
|
|
111
|
-
v(A + (F - A) * ot), C < 1 ? r = requestAnimationFrame(b) : (r = 0, a.classList.remove("is-spin-active"), p = "idle", v(F), y(t));
|
|
112
|
-
}
|
|
113
|
-
r = requestAnimationFrame(b);
|
|
114
|
-
}
|
|
115
|
-
function j(t) {
|
|
116
|
-
t.classList.remove("is-pressing"), t.offsetWidth, t.classList.add("is-pressing");
|
|
117
|
-
const e = t;
|
|
118
|
-
clearTimeout(e._pressTimer), e._pressTimer = setTimeout(() => t.classList.remove("is-pressing"), 620);
|
|
119
|
-
}
|
|
120
|
-
function R(t) {
|
|
121
|
-
if (M.centerButtonEl && M.centerButtonEl.contains(t.target) || p !== "idle") return;
|
|
122
|
-
if (n !== null) {
|
|
123
|
-
l.releasePointerCapture(n.pointerId), a.classList.remove("is-dragging"), N(n.startRotation), n = null;
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
if (!t.isPrimary) return;
|
|
127
|
-
t.preventDefault(), Y?.(), h(), a.classList.add("is-dragging"), l.setPointerCapture?.(t.pointerId);
|
|
128
|
-
const e = S(t);
|
|
129
|
-
n = {
|
|
130
|
-
pointerId: t.pointerId,
|
|
131
|
-
startAngle: e,
|
|
132
|
-
previousAngle: e,
|
|
133
|
-
startRotation: d,
|
|
134
|
-
previousTime: performance.now(),
|
|
135
|
-
velocity: 0,
|
|
136
|
-
didDrag: !1,
|
|
137
|
-
cumulativeDelta: 0,
|
|
138
|
-
velocityHistory: [{ cumulative: 0, t: performance.now() }]
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
function P(t) {
|
|
142
|
-
if (!n || t.pointerId !== n.pointerId) return;
|
|
143
|
-
t.preventDefault();
|
|
144
|
-
const e = performance.now(), i = S(t), s = w(i - n.startAngle), o = w(i - n.previousAngle), c = Math.max(8, e - n.previousTime);
|
|
145
|
-
Math.abs(s) > 2 && (n.didDrag = !0), v(n.startRotation + s), n.velocity = o / c, n.previousAngle = i, n.previousTime = e, n.cumulativeDelta += o, n.velocityHistory.push({ cumulative: n.cumulativeDelta, t: e });
|
|
146
|
-
const m = e - 150;
|
|
147
|
-
for (; n.velocityHistory.length > 2 && n.velocityHistory[0].t < m; )
|
|
148
|
-
n.velocityHistory.shift();
|
|
149
|
-
}
|
|
150
|
-
function L(t) {
|
|
151
|
-
if (!n || t.pointerId !== n.pointerId) return;
|
|
152
|
-
const e = n.velocityHistory;
|
|
153
|
-
let i;
|
|
154
|
-
if (e.length >= 2) {
|
|
155
|
-
const c = e[0], m = e[e.length - 1], g = m.t - c.t;
|
|
156
|
-
i = g > 0 ? (m.cumulative - c.cumulative) / g : n.velocity;
|
|
157
|
-
} else
|
|
158
|
-
i = n.velocity;
|
|
159
|
-
const s = n.didDrag, o = n.startRotation;
|
|
160
|
-
n = null, a.classList.remove("is-dragging"), l.releasePointerCapture?.(t.pointerId), s && Math.abs(i) > rt ? M.onDragRelease ? M.onDragRelease(i) : (D?.(), G(i, !0)) : s && N(o);
|
|
161
|
-
}
|
|
162
|
-
function J() {
|
|
163
|
-
l.addEventListener("pointerdown", R), l.addEventListener("pointermove", P), l.addEventListener("pointerup", L), l.addEventListener("pointercancel", L);
|
|
164
|
-
}
|
|
165
|
-
function K() {
|
|
166
|
-
h(), u && (clearTimeout(u), u = 0, a.classList.remove("is-prize-hit")), p = "idle", n = null;
|
|
167
|
-
}
|
|
168
|
-
function Q() {
|
|
169
|
-
h(), u && clearTimeout(u), l.removeEventListener("pointerdown", R), l.removeEventListener("pointermove", P), l.removeEventListener("pointerup", L), l.removeEventListener("pointercancel", L);
|
|
170
|
-
}
|
|
171
|
-
return { startFreeSpin: X, landOnIndex: W, abortSpin: Z, reset: K, enableDrag: J, destroy: Q, centerButtonPress: j };
|
|
172
|
-
}
|
|
173
|
-
export {
|
|
174
|
-
Lt as c
|
|
175
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const st=require("./sparkles-BRrL2C0i.cjs"),u=require("./constants-DNSPUges.cjs");function ot(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,m=0,f="idle",v=0,i=null;h(p);function h(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"),m&&clearTimeout(m),m=window.setTimeout(()=>{a.classList.remove("is-prize-hit"),m=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 d=Math.min(32,l-n);n=l,h(p+s*d),s*=Math.pow(u.SPIN_DECAY,d/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;st.burstSparkles(B,e,n,r?8:18)}}function V(t){o.style.animation="none",M(),a.classList.remove("is-prize-hit"),m&&(clearTimeout(m),m=0),f="free",t!==void 0?v=t:v=-(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(f!=="free")return;const l=Math.min(32,r-n);n=r,h(p+v*l),v*=Math.pow(u.FREE_SPIN_DECAY,l/16.67),Math.abs(v)<e&&(v=v<0?-e:e),c=requestAnimationFrame(s)}c=requestAnimationFrame(s)}function z(t){f==="free"&&(f="targeted",M(),W(t))}function X(){if(f!=="free")return;f="aborting",M();let t=performance.now(),e=v;a.classList.add("is-spin-active");function n(s){const r=Math.min(32,s-t);t=s,h(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"),f="idle",R==null||R())}c=requestAnimationFrame(n)}function C(t){M();const e=p,n=t-e;if(Math.abs(n)<.5){h(t);return}const s=Math.min(600,Math.max(300,Math.abs(n)*5)),r=performance.now();function l(d){const g=Math.min(1,(d-r)/s),L=1-Math.pow(1-g,3);h(e+n*L),g<1?c=requestAnimationFrame(l):(c=0,h(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,d=v<=0,g=d?l:(360-l)%360,L=Math.abs(v),K=P?2:Math.max(2,Math.round(L*3)),w=g+K*360,A=p,q=d?A-w:A+w,Q=Math.max(u.LANDING_MIN_VELOCITY,L),tt=Math.max(u.LANDING_MIN_DURATION_MS,Math.min(u.LANDING_MAX_DURATION_MS,2*w/Q)),et=performance.now();a.classList.add("is-spin-active");function x(nt){const Y=Math.min(1,(nt-et)/tt),it=1-Math.pow(1-Y,2);h(A+(q-A)*it),Y<1?c=requestAnimationFrame(x):(c=0,a.classList.remove("is-spin-active"),f="idle",h(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)||f!=="idle")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),h(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 d=e-150;for(;i.velocityHistory.length>2&&i.velocityHistory[0].t<d;)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 d=e[0],g=e[e.length-1],L=g.t-d.t;n=L>0?(g.cumulative-d.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(),m&&(clearTimeout(m),m=0,a.classList.remove("is-prize-hit")),f="idle",i=null}function J(){M(),m&&clearTimeout(m),o.removeEventListener("pointerdown",b),o.removeEventListener("pointermove",H),o.removeEventListener("pointerup",_),o.removeEventListener("pointercancel",_)}return{startFreeSpin:V,landOnIndex:z,abortSpin:X,reset:j,enableDrag:$,destroy:J,centerButtonPress:Z}}exports.createSpinController=ot;
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
import { b as at } from "./sparkles-WqrZ-iXs.js";
|
|
2
|
-
import { D as rt, A as ct, S as Y, F as lt, a as B, b as ut, P as mt, c as U, L as ft, d as dt, e as pt, f as vt, g as ht } from "./constants-DdcZGwlM.js";
|
|
3
|
-
function Lt(T) {
|
|
4
|
-
const {
|
|
5
|
-
stage: r,
|
|
6
|
-
disc: o,
|
|
7
|
-
sparkleLayer: k,
|
|
8
|
-
sliceCount: N,
|
|
9
|
-
onSpinStart: L,
|
|
10
|
-
onDragStart: _,
|
|
11
|
-
onSettled: E,
|
|
12
|
-
onPrizeClear: D,
|
|
13
|
-
onSpinAbort: w,
|
|
14
|
-
liteMode: R
|
|
15
|
-
} = T;
|
|
16
|
-
let f = 0, c = 0, u = 0, d = "idle", p = 0, i = null;
|
|
17
|
-
v(f);
|
|
18
|
-
function v(t) {
|
|
19
|
-
f = t, o.style.setProperty("--wheel-rotation", `${t}deg`);
|
|
20
|
-
}
|
|
21
|
-
function P(t) {
|
|
22
|
-
return (t + 540) % 360 - 180;
|
|
23
|
-
}
|
|
24
|
-
function F(t) {
|
|
25
|
-
const e = o.getBoundingClientRect(), n = e.left + e.width / 2, s = e.top + e.height / 2;
|
|
26
|
-
return Math.atan2(t.clientY - s, t.clientX - n) * 180 / Math.PI;
|
|
27
|
-
}
|
|
28
|
-
function h() {
|
|
29
|
-
c && cancelAnimationFrame(c), c = 0, r.classList.remove("is-spin-active");
|
|
30
|
-
}
|
|
31
|
-
function G() {
|
|
32
|
-
const t = N();
|
|
33
|
-
if (t === 0) return 0;
|
|
34
|
-
const e = 360 / t, n = (-f % 360 + 360) % 360;
|
|
35
|
-
return Math.floor(n / e) % t;
|
|
36
|
-
}
|
|
37
|
-
function O(t) {
|
|
38
|
-
const e = t !== void 0 ? t : G();
|
|
39
|
-
r.classList.add("is-prize-hit"), u && clearTimeout(u), u = window.setTimeout(() => {
|
|
40
|
-
r.classList.remove("is-prize-hit"), u = 0, D == null || D();
|
|
41
|
-
}, mt), E == null || E(e);
|
|
42
|
-
}
|
|
43
|
-
function z(t, e = !0) {
|
|
44
|
-
h(), r.classList.add("is-spin-active");
|
|
45
|
-
let n = performance.now(), s = Math.max(-U, Math.min(U, t));
|
|
46
|
-
function a(l) {
|
|
47
|
-
const m = Math.min(32, l - n);
|
|
48
|
-
n = l, v(f + s * m), s *= Math.pow(ut, m / 16.67), Math.abs(s) > Y ? c = requestAnimationFrame(a) : (c = 0, r.classList.remove("is-spin-active"), e && O());
|
|
49
|
-
}
|
|
50
|
-
c = requestAnimationFrame(a);
|
|
51
|
-
}
|
|
52
|
-
function V() {
|
|
53
|
-
const t = o.getBoundingClientRect(), e = t.left + t.width / 2, n = t.top + t.height / 2;
|
|
54
|
-
r.classList.add("is-spinning");
|
|
55
|
-
const s = r;
|
|
56
|
-
if (clearTimeout(s._spinGlowTimer), s._spinGlowTimer = setTimeout(() => r.classList.remove("is-spinning"), 960), !R) {
|
|
57
|
-
const a = window.matchMedia("(pointer: coarse), (max-width: 640px)").matches;
|
|
58
|
-
at(k, e, n, a ? 8 : 18);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
function X(t) {
|
|
62
|
-
o.style.animation = "none", h(), r.classList.remove("is-prize-hit"), u && (clearTimeout(u), u = 0), d = "free", t !== void 0 ? p = t : p = -(vt + Math.random() * ht);
|
|
63
|
-
const e = t !== void 0 ? Math.min(B, Math.abs(t)) : B;
|
|
64
|
-
V(), L == null || L(), r.classList.add("is-spin-active");
|
|
65
|
-
let n = performance.now();
|
|
66
|
-
function s(a) {
|
|
67
|
-
if (d !== "free") return;
|
|
68
|
-
const l = Math.min(32, a - n);
|
|
69
|
-
n = a, v(f + p * l), p *= Math.pow(lt, l / 16.67), Math.abs(p) < e && (p = p < 0 ? -e : e), c = requestAnimationFrame(s);
|
|
70
|
-
}
|
|
71
|
-
c = requestAnimationFrame(s);
|
|
72
|
-
}
|
|
73
|
-
function W(t) {
|
|
74
|
-
d === "free" && (d = "targeted", h(), $(t));
|
|
75
|
-
}
|
|
76
|
-
function Z() {
|
|
77
|
-
if (d !== "free") return;
|
|
78
|
-
d = "aborting", h();
|
|
79
|
-
let t = performance.now(), e = p;
|
|
80
|
-
r.classList.add("is-spin-active");
|
|
81
|
-
function n(s) {
|
|
82
|
-
const a = Math.min(32, s - t);
|
|
83
|
-
t = s, v(f + e * a), e *= Math.pow(ct, a / 16.67), Math.abs(e) > Y ? c = requestAnimationFrame(n) : (c = 0, r.classList.remove("is-spin-active"), d = "idle", w == null || w());
|
|
84
|
-
}
|
|
85
|
-
c = requestAnimationFrame(n);
|
|
86
|
-
}
|
|
87
|
-
function b(t) {
|
|
88
|
-
h();
|
|
89
|
-
const e = f, n = t - e;
|
|
90
|
-
if (Math.abs(n) < 0.5) {
|
|
91
|
-
v(t);
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
const s = Math.min(600, Math.max(300, Math.abs(n) * 5)), a = performance.now();
|
|
95
|
-
function l(m) {
|
|
96
|
-
const M = Math.min(1, (m - a) / s), g = 1 - Math.pow(1 - M, 3);
|
|
97
|
-
v(e + n * g), M < 1 ? c = requestAnimationFrame(l) : (c = 0, v(t));
|
|
98
|
-
}
|
|
99
|
-
c = requestAnimationFrame(l);
|
|
100
|
-
}
|
|
101
|
-
function $(t) {
|
|
102
|
-
const e = N();
|
|
103
|
-
if (e === 0) return;
|
|
104
|
-
const n = 360 / e, s = (t + 0.5) * n, a = (-f % 360 + 360) % 360, l = ((s - a) % 360 + 360) % 360, m = p <= 0, M = m ? l : (360 - l) % 360, g = Math.abs(p), tt = R ? 2 : Math.max(2, Math.round(g * 3)), y = M + tt * 360, A = f, x = m ? A - y : A + y, et = Math.max(pt, g), nt = Math.max(
|
|
105
|
-
ft,
|
|
106
|
-
Math.min(dt, 2 * y / et)
|
|
107
|
-
), it = performance.now();
|
|
108
|
-
r.classList.add("is-spin-active");
|
|
109
|
-
function H(st) {
|
|
110
|
-
const q = Math.min(1, (st - it) / nt), ot = 1 - Math.pow(1 - q, 2);
|
|
111
|
-
v(A + (x - A) * ot), q < 1 ? c = requestAnimationFrame(H) : (c = 0, r.classList.remove("is-spin-active"), d = "idle", v(x), O(t));
|
|
112
|
-
}
|
|
113
|
-
c = requestAnimationFrame(H);
|
|
114
|
-
}
|
|
115
|
-
function j(t) {
|
|
116
|
-
t.classList.remove("is-pressing"), t.offsetWidth, t.classList.add("is-pressing");
|
|
117
|
-
const e = t;
|
|
118
|
-
clearTimeout(e._pressTimer), e._pressTimer = setTimeout(() => t.classList.remove("is-pressing"), 620);
|
|
119
|
-
}
|
|
120
|
-
function C(t) {
|
|
121
|
-
var n;
|
|
122
|
-
if (T.centerButtonEl && T.centerButtonEl.contains(t.target) || d !== "idle") return;
|
|
123
|
-
if (i !== null) {
|
|
124
|
-
o.releasePointerCapture(i.pointerId), r.classList.remove("is-dragging"), b(i.startRotation), i = null;
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
if (!t.isPrimary) return;
|
|
128
|
-
t.preventDefault(), _ == null || _(), h(), r.classList.add("is-dragging"), (n = o.setPointerCapture) == null || n.call(o, t.pointerId);
|
|
129
|
-
const e = F(t);
|
|
130
|
-
i = {
|
|
131
|
-
pointerId: t.pointerId,
|
|
132
|
-
startAngle: e,
|
|
133
|
-
previousAngle: e,
|
|
134
|
-
startRotation: f,
|
|
135
|
-
previousTime: performance.now(),
|
|
136
|
-
velocity: 0,
|
|
137
|
-
didDrag: !1,
|
|
138
|
-
cumulativeDelta: 0,
|
|
139
|
-
velocityHistory: [{ cumulative: 0, t: performance.now() }]
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
function S(t) {
|
|
143
|
-
if (!i || t.pointerId !== i.pointerId) return;
|
|
144
|
-
t.preventDefault();
|
|
145
|
-
const e = performance.now(), n = F(t), s = P(n - i.startAngle), a = P(n - i.previousAngle), l = Math.max(8, e - i.previousTime);
|
|
146
|
-
Math.abs(s) > 2 && (i.didDrag = !0), v(i.startRotation + s), i.velocity = a / l, i.previousAngle = n, i.previousTime = e, i.cumulativeDelta += a, i.velocityHistory.push({ cumulative: i.cumulativeDelta, t: e });
|
|
147
|
-
const m = e - 150;
|
|
148
|
-
for (; i.velocityHistory.length > 2 && i.velocityHistory[0].t < m; )
|
|
149
|
-
i.velocityHistory.shift();
|
|
150
|
-
}
|
|
151
|
-
function I(t) {
|
|
152
|
-
var l;
|
|
153
|
-
if (!i || t.pointerId !== i.pointerId) return;
|
|
154
|
-
const e = i.velocityHistory;
|
|
155
|
-
let n;
|
|
156
|
-
if (e.length >= 2) {
|
|
157
|
-
const m = e[0], M = e[e.length - 1], g = M.t - m.t;
|
|
158
|
-
n = g > 0 ? (M.cumulative - m.cumulative) / g : i.velocity;
|
|
159
|
-
} else
|
|
160
|
-
n = i.velocity;
|
|
161
|
-
const s = i.didDrag, a = i.startRotation;
|
|
162
|
-
i = null, r.classList.remove("is-dragging"), (l = o.releasePointerCapture) == null || l.call(o, t.pointerId), s && Math.abs(n) > rt ? T.onDragRelease ? T.onDragRelease(n) : (L == null || L(), z(n, !0)) : s && b(a);
|
|
163
|
-
}
|
|
164
|
-
function J() {
|
|
165
|
-
o.addEventListener("pointerdown", C), o.addEventListener("pointermove", S), o.addEventListener("pointerup", I), o.addEventListener("pointercancel", I);
|
|
166
|
-
}
|
|
167
|
-
function K() {
|
|
168
|
-
h(), u && (clearTimeout(u), u = 0, r.classList.remove("is-prize-hit")), d = "idle", i = null;
|
|
169
|
-
}
|
|
170
|
-
function Q() {
|
|
171
|
-
h(), u && clearTimeout(u), o.removeEventListener("pointerdown", C), o.removeEventListener("pointermove", S), o.removeEventListener("pointerup", I), o.removeEventListener("pointercancel", I);
|
|
172
|
-
}
|
|
173
|
-
return { startFreeSpin: X, landOnIndex: W, abortSpin: Z, reset: K, enableDrag: J, destroy: Q, centerButtonPress: j };
|
|
174
|
-
}
|
|
175
|
-
export {
|
|
176
|
-
Lt as c
|
|
177
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const ot=require("./sparkles-DKbGLSaY.cjs"),l=require("./constants-DNSPUges.cjs");function st(L){const{stage:r,disc:u,sparkleLayer:H,sliceCount:E,onSpinStart:S,onDragStart:q,onSettled:x,onPrizeClear:Y,onSpinAbort:B,liteMode:D}=L;let p=0,a=0,m=0,f="idle",v=0,n=null;h(p);function h(t){p=t,u.style.setProperty("--wheel-rotation",`${t}deg`)}function N(t){return(t+540)%360-180}function R(t){const e=u.getBoundingClientRect(),i=e.left+e.width/2,o=e.top+e.height/2;return Math.atan2(t.clientY-o,t.clientX-i)*180/Math.PI}function M(){a&&cancelAnimationFrame(a),a=0,r.classList.remove("is-spin-active")}function k(){const t=E();if(t===0)return 0;const e=360/t,i=(-p%360+360)%360;return Math.floor(i/e)%t}function w(t){const e=t!==void 0?t:k();r.classList.add("is-prize-hit"),m&&clearTimeout(m),m=window.setTimeout(()=>{r.classList.remove("is-prize-hit"),m=0,Y?.()},l.PRIZE_HIT_MS),x?.(e)}function z(t,e=!0){M(),r.classList.add("is-spin-active");let i=performance.now(),o=Math.max(-l.SPIN_MAX_VELOCITY,Math.min(l.SPIN_MAX_VELOCITY,t));function s(c){const d=Math.min(32,c-i);i=c,h(p+o*d),o*=Math.pow(l.SPIN_DECAY,d/16.67),Math.abs(o)>l.SPIN_SETTLE_THRESHOLD?a=requestAnimationFrame(s):(a=0,r.classList.remove("is-spin-active"),e&&w())}a=requestAnimationFrame(s)}function U(){const t=u.getBoundingClientRect(),e=t.left+t.width/2,i=t.top+t.height/2;r.classList.add("is-spinning");const o=r;if(clearTimeout(o._spinGlowTimer),o._spinGlowTimer=setTimeout(()=>r.classList.remove("is-spinning"),960),!D){const s=window.matchMedia("(pointer: coarse), (max-width: 640px)").matches;ot.burstSparkles(H,e,i,s?8:18)}}function G(t){u.style.animation="none",M(),r.classList.remove("is-prize-hit"),m&&(clearTimeout(m),m=0),f="free",t!==void 0?v=t:v=-(l.SPIN_BUTTON_VELOCITY_MIN+Math.random()*l.SPIN_BUTTON_VELOCITY_RANGE);const e=t!==void 0?Math.min(l.FREE_SPIN_VELOCITY_FLOOR,Math.abs(t)):l.FREE_SPIN_VELOCITY_FLOOR;U(),S?.(),r.classList.add("is-spin-active");let i=performance.now();function o(s){if(f!=="free")return;const c=Math.min(32,s-i);i=s,h(p+v*c),v*=Math.pow(l.FREE_SPIN_DECAY,c/16.67),Math.abs(v)<e&&(v=v<0?-e:e),a=requestAnimationFrame(o)}a=requestAnimationFrame(o)}function V(t){f==="free"&&(f="targeted",M(),W(t))}function X(){if(f!=="free")return;f="aborting",M();let t=performance.now(),e=v;r.classList.add("is-spin-active");function i(o){const s=Math.min(32,o-t);t=o,h(p+e*s),e*=Math.pow(l.ABORT_SPIN_DECAY,s/16.67),Math.abs(e)>l.SPIN_SETTLE_THRESHOLD?a=requestAnimationFrame(i):(a=0,r.classList.remove("is-spin-active"),f="idle",B?.())}a=requestAnimationFrame(i)}function y(t){M();const e=p,i=t-e;if(Math.abs(i)<.5){h(t);return}const o=Math.min(600,Math.max(300,Math.abs(i)*5)),s=performance.now();function c(d){const g=Math.min(1,(d-s)/o),I=1-Math.pow(1-g,3);h(e+i*I),g<1?a=requestAnimationFrame(c):(a=0,h(t))}a=requestAnimationFrame(c)}function W(t){const e=E();if(e===0)return;const i=360/e,o=(t+.5)*i,s=(-p%360+360)%360,c=((o-s)%360+360)%360,d=v<=0,g=d?c:(360-c)%360,I=Math.abs(v),K=D?2:Math.max(2,Math.round(I*3)),A=g+K*360,_=p,C=d?_-A:_+A,Q=Math.max(l.LANDING_MIN_VELOCITY,I),tt=Math.max(l.LANDING_MIN_DURATION_MS,Math.min(l.LANDING_MAX_DURATION_MS,2*A/Q)),et=performance.now();r.classList.add("is-spin-active");function F(nt){const b=Math.min(1,(nt-et)/tt),it=1-Math.pow(1-b,2);h(_+(C-_)*it),b<1?a=requestAnimationFrame(F):(a=0,r.classList.remove("is-spin-active"),f="idle",h(C),w(t))}a=requestAnimationFrame(F)}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 P(t){if(L.centerButtonEl&&L.centerButtonEl.contains(t.target)||f!=="idle")return;if(n!==null){u.releasePointerCapture(n.pointerId),r.classList.remove("is-dragging"),y(n.startRotation),n=null;return}if(!t.isPrimary)return;t.preventDefault(),q?.(),M(),r.classList.add("is-dragging"),u.setPointerCapture?.(t.pointerId);const e=R(t);n={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 O(t){if(!n||t.pointerId!==n.pointerId)return;t.preventDefault();const e=performance.now(),i=R(t),o=N(i-n.startAngle),s=N(i-n.previousAngle),c=Math.max(8,e-n.previousTime);Math.abs(o)>2&&(n.didDrag=!0),h(n.startRotation+o),n.velocity=s/c,n.previousAngle=i,n.previousTime=e,n.cumulativeDelta+=s,n.velocityHistory.push({cumulative:n.cumulativeDelta,t:e});const d=e-150;for(;n.velocityHistory.length>2&&n.velocityHistory[0].t<d;)n.velocityHistory.shift()}function T(t){if(!n||t.pointerId!==n.pointerId)return;const e=n.velocityHistory;let i;if(e.length>=2){const c=e[0],d=e[e.length-1],g=d.t-c.t;i=g>0?(d.cumulative-c.cumulative)/g:n.velocity}else i=n.velocity;const o=n.didDrag,s=n.startRotation;n=null,r.classList.remove("is-dragging"),u.releasePointerCapture?.(t.pointerId),o&&Math.abs(i)>l.DRAG_MIN_VELOCITY?L.onDragRelease?L.onDragRelease(i):(S?.(),z(i,!0)):o&&y(s)}function $(){u.addEventListener("pointerdown",P),u.addEventListener("pointermove",O),u.addEventListener("pointerup",T),u.addEventListener("pointercancel",T)}function j(){M(),m&&(clearTimeout(m),m=0,r.classList.remove("is-prize-hit")),f="idle",n=null}function J(){M(),m&&clearTimeout(m),u.removeEventListener("pointerdown",P),u.removeEventListener("pointermove",O),u.removeEventListener("pointerup",T),u.removeEventListener("pointercancel",T)}return{startFreeSpin:G,landOnIndex:V,abortSpin:X,reset:j,enableDrag:$,destroy:J,centerButtonPress:Z}}exports.createSpinController=st;
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
import { b as at } from "./sparkles-BXFe6GK6.js";
|
|
2
|
-
import { D as rt, A as ct, S as Y, F as lt, a as B, b as ut, P as mt, c as U, L as ft, d as dt, e as pt, f as vt, g as ht } from "./constants-DgCBmV7S.js";
|
|
3
|
-
function Lt(T) {
|
|
4
|
-
const {
|
|
5
|
-
stage: r,
|
|
6
|
-
disc: o,
|
|
7
|
-
sparkleLayer: k,
|
|
8
|
-
sliceCount: N,
|
|
9
|
-
onSpinStart: L,
|
|
10
|
-
onDragStart: _,
|
|
11
|
-
onSettled: E,
|
|
12
|
-
onPrizeClear: D,
|
|
13
|
-
onSpinAbort: w,
|
|
14
|
-
liteMode: R
|
|
15
|
-
} = T;
|
|
16
|
-
let f = 0, c = 0, u = 0, d = "idle", p = 0, i = null;
|
|
17
|
-
v(f);
|
|
18
|
-
function v(t) {
|
|
19
|
-
f = t, o.style.setProperty("--wheel-rotation", `${t}deg`);
|
|
20
|
-
}
|
|
21
|
-
function P(t) {
|
|
22
|
-
return (t + 540) % 360 - 180;
|
|
23
|
-
}
|
|
24
|
-
function F(t) {
|
|
25
|
-
const e = o.getBoundingClientRect(), n = e.left + e.width / 2, s = e.top + e.height / 2;
|
|
26
|
-
return Math.atan2(t.clientY - s, t.clientX - n) * 180 / Math.PI;
|
|
27
|
-
}
|
|
28
|
-
function h() {
|
|
29
|
-
c && cancelAnimationFrame(c), c = 0, r.classList.remove("is-spin-active");
|
|
30
|
-
}
|
|
31
|
-
function G() {
|
|
32
|
-
const t = N();
|
|
33
|
-
if (t === 0) return 0;
|
|
34
|
-
const e = 360 / t, n = (-f % 360 + 360) % 360;
|
|
35
|
-
return Math.floor(n / e) % t;
|
|
36
|
-
}
|
|
37
|
-
function O(t) {
|
|
38
|
-
const e = t !== void 0 ? t : G();
|
|
39
|
-
r.classList.add("is-prize-hit"), u && clearTimeout(u), u = window.setTimeout(() => {
|
|
40
|
-
r.classList.remove("is-prize-hit"), u = 0, D == null || D();
|
|
41
|
-
}, mt), E == null || E(e);
|
|
42
|
-
}
|
|
43
|
-
function z(t, e = !0) {
|
|
44
|
-
h(), r.classList.add("is-spin-active");
|
|
45
|
-
let n = performance.now(), s = Math.max(-U, Math.min(U, t));
|
|
46
|
-
function a(l) {
|
|
47
|
-
const m = Math.min(32, l - n);
|
|
48
|
-
n = l, v(f + s * m), s *= Math.pow(ut, m / 16.67), Math.abs(s) > Y ? c = requestAnimationFrame(a) : (c = 0, r.classList.remove("is-spin-active"), e && O());
|
|
49
|
-
}
|
|
50
|
-
c = requestAnimationFrame(a);
|
|
51
|
-
}
|
|
52
|
-
function V() {
|
|
53
|
-
const t = o.getBoundingClientRect(), e = t.left + t.width / 2, n = t.top + t.height / 2;
|
|
54
|
-
r.classList.add("is-spinning");
|
|
55
|
-
const s = r;
|
|
56
|
-
if (clearTimeout(s._spinGlowTimer), s._spinGlowTimer = setTimeout(() => r.classList.remove("is-spinning"), 960), !R) {
|
|
57
|
-
const a = window.matchMedia("(pointer: coarse), (max-width: 640px)").matches;
|
|
58
|
-
at(k, e, n, a ? 8 : 18);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
function X(t) {
|
|
62
|
-
o.style.animation = "none", h(), r.classList.remove("is-prize-hit"), u && (clearTimeout(u), u = 0), d = "free", t !== void 0 ? p = t : p = -(vt + Math.random() * ht);
|
|
63
|
-
const e = t !== void 0 ? Math.min(B, Math.abs(t)) : B;
|
|
64
|
-
V(), L == null || L(), r.classList.add("is-spin-active");
|
|
65
|
-
let n = performance.now();
|
|
66
|
-
function s(a) {
|
|
67
|
-
if (d !== "free") return;
|
|
68
|
-
const l = Math.min(32, a - n);
|
|
69
|
-
n = a, v(f + p * l), p *= Math.pow(lt, l / 16.67), Math.abs(p) < e && (p = p < 0 ? -e : e), c = requestAnimationFrame(s);
|
|
70
|
-
}
|
|
71
|
-
c = requestAnimationFrame(s);
|
|
72
|
-
}
|
|
73
|
-
function W(t) {
|
|
74
|
-
d === "free" && (d = "targeted", h(), $(t));
|
|
75
|
-
}
|
|
76
|
-
function Z() {
|
|
77
|
-
if (d !== "free") return;
|
|
78
|
-
d = "aborting", h();
|
|
79
|
-
let t = performance.now(), e = p;
|
|
80
|
-
r.classList.add("is-spin-active");
|
|
81
|
-
function n(s) {
|
|
82
|
-
const a = Math.min(32, s - t);
|
|
83
|
-
t = s, v(f + e * a), e *= Math.pow(ct, a / 16.67), Math.abs(e) > Y ? c = requestAnimationFrame(n) : (c = 0, r.classList.remove("is-spin-active"), d = "idle", w == null || w());
|
|
84
|
-
}
|
|
85
|
-
c = requestAnimationFrame(n);
|
|
86
|
-
}
|
|
87
|
-
function b(t) {
|
|
88
|
-
h();
|
|
89
|
-
const e = f, n = t - e;
|
|
90
|
-
if (Math.abs(n) < 0.5) {
|
|
91
|
-
v(t);
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
const s = Math.min(600, Math.max(300, Math.abs(n) * 5)), a = performance.now();
|
|
95
|
-
function l(m) {
|
|
96
|
-
const M = Math.min(1, (m - a) / s), g = 1 - Math.pow(1 - M, 3);
|
|
97
|
-
v(e + n * g), M < 1 ? c = requestAnimationFrame(l) : (c = 0, v(t));
|
|
98
|
-
}
|
|
99
|
-
c = requestAnimationFrame(l);
|
|
100
|
-
}
|
|
101
|
-
function $(t) {
|
|
102
|
-
const e = N();
|
|
103
|
-
if (e === 0) return;
|
|
104
|
-
const n = 360 / e, s = (t + 0.5) * n, a = (-f % 360 + 360) % 360, l = ((s - a) % 360 + 360) % 360, m = p <= 0, M = m ? l : (360 - l) % 360, g = Math.abs(p), tt = R ? 2 : Math.max(2, Math.round(g * 3)), y = M + tt * 360, A = f, x = m ? A - y : A + y, et = Math.max(pt, g), nt = Math.max(
|
|
105
|
-
ft,
|
|
106
|
-
Math.min(dt, 2 * y / et)
|
|
107
|
-
), it = performance.now();
|
|
108
|
-
r.classList.add("is-spin-active");
|
|
109
|
-
function H(st) {
|
|
110
|
-
const q = Math.min(1, (st - it) / nt), ot = 1 - Math.pow(1 - q, 2);
|
|
111
|
-
v(A + (x - A) * ot), q < 1 ? c = requestAnimationFrame(H) : (c = 0, r.classList.remove("is-spin-active"), d = "idle", v(x), O(t));
|
|
112
|
-
}
|
|
113
|
-
c = requestAnimationFrame(H);
|
|
114
|
-
}
|
|
115
|
-
function j(t) {
|
|
116
|
-
t.classList.remove("is-pressing"), t.offsetWidth, t.classList.add("is-pressing");
|
|
117
|
-
const e = t;
|
|
118
|
-
clearTimeout(e._pressTimer), e._pressTimer = setTimeout(() => t.classList.remove("is-pressing"), 620);
|
|
119
|
-
}
|
|
120
|
-
function C(t) {
|
|
121
|
-
var n;
|
|
122
|
-
if (T.centerButtonEl && T.centerButtonEl.contains(t.target) || d !== "idle") return;
|
|
123
|
-
if (i !== null) {
|
|
124
|
-
o.releasePointerCapture(i.pointerId), r.classList.remove("is-dragging"), b(i.startRotation), i = null;
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
if (!t.isPrimary) return;
|
|
128
|
-
t.preventDefault(), _ == null || _(), h(), r.classList.add("is-dragging"), (n = o.setPointerCapture) == null || n.call(o, t.pointerId);
|
|
129
|
-
const e = F(t);
|
|
130
|
-
i = {
|
|
131
|
-
pointerId: t.pointerId,
|
|
132
|
-
startAngle: e,
|
|
133
|
-
previousAngle: e,
|
|
134
|
-
startRotation: f,
|
|
135
|
-
previousTime: performance.now(),
|
|
136
|
-
velocity: 0,
|
|
137
|
-
didDrag: !1,
|
|
138
|
-
cumulativeDelta: 0,
|
|
139
|
-
velocityHistory: [{ cumulative: 0, t: performance.now() }]
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
function S(t) {
|
|
143
|
-
if (!i || t.pointerId !== i.pointerId) return;
|
|
144
|
-
t.preventDefault();
|
|
145
|
-
const e = performance.now(), n = F(t), s = P(n - i.startAngle), a = P(n - i.previousAngle), l = Math.max(8, e - i.previousTime);
|
|
146
|
-
Math.abs(s) > 2 && (i.didDrag = !0), v(i.startRotation + s), i.velocity = a / l, i.previousAngle = n, i.previousTime = e, i.cumulativeDelta += a, i.velocityHistory.push({ cumulative: i.cumulativeDelta, t: e });
|
|
147
|
-
const m = e - 150;
|
|
148
|
-
for (; i.velocityHistory.length > 2 && i.velocityHistory[0].t < m; )
|
|
149
|
-
i.velocityHistory.shift();
|
|
150
|
-
}
|
|
151
|
-
function I(t) {
|
|
152
|
-
var l;
|
|
153
|
-
if (!i || t.pointerId !== i.pointerId) return;
|
|
154
|
-
const e = i.velocityHistory;
|
|
155
|
-
let n;
|
|
156
|
-
if (e.length >= 2) {
|
|
157
|
-
const m = e[0], M = e[e.length - 1], g = M.t - m.t;
|
|
158
|
-
n = g > 0 ? (M.cumulative - m.cumulative) / g : i.velocity;
|
|
159
|
-
} else
|
|
160
|
-
n = i.velocity;
|
|
161
|
-
const s = i.didDrag, a = i.startRotation;
|
|
162
|
-
i = null, r.classList.remove("is-dragging"), (l = o.releasePointerCapture) == null || l.call(o, t.pointerId), s && Math.abs(n) > rt ? T.onDragRelease ? T.onDragRelease(n) : (L == null || L(), z(n, !0)) : s && b(a);
|
|
163
|
-
}
|
|
164
|
-
function J() {
|
|
165
|
-
o.addEventListener("pointerdown", C), o.addEventListener("pointermove", S), o.addEventListener("pointerup", I), o.addEventListener("pointercancel", I);
|
|
166
|
-
}
|
|
167
|
-
function K() {
|
|
168
|
-
h(), u && (clearTimeout(u), u = 0, r.classList.remove("is-prize-hit")), d = "idle", i = null;
|
|
169
|
-
}
|
|
170
|
-
function Q() {
|
|
171
|
-
h(), u && clearTimeout(u), o.removeEventListener("pointerdown", C), o.removeEventListener("pointermove", S), o.removeEventListener("pointerup", I), o.removeEventListener("pointercancel", I);
|
|
172
|
-
}
|
|
173
|
-
return { startFreeSpin: X, landOnIndex: W, abortSpin: Z, reset: K, enableDrag: J, destroy: Q, centerButtonPress: j };
|
|
174
|
-
}
|
|
175
|
-
export {
|
|
176
|
-
Lt as c
|
|
177
|
-
};
|