pixi-reels 2.5.0 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/dist/board/BoardGrid.d.ts +18 -2
- package/dist/board/BoardGrid.d.ts.map +1 -1
- package/dist/board/HoldAndWinBoard.d.ts +2 -1
- package/dist/board/HoldAndWinBoard.d.ts.map +1 -1
- package/dist/board/HoldAndWinBuilder.d.ts +10 -1
- package/dist/board/HoldAndWinBuilder.d.ts.map +1 -1
- package/dist/core/maskStrategies.d.ts +41 -1
- package/dist/core/maskStrategies.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +155 -70
- package/dist/index.js.map +1 -1
- package/dist/spine/SpineReelSymbol.d.ts +2 -0
- package/dist/spine/SpineReelSymbol.d.ts.map +1 -1
- package/dist/spine.cjs +1 -1
- package/dist/spine.cjs.map +1 -1
- package/dist/spine.js +8 -4
- package/dist/spine.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# pixi-reels
|
|
2
2
|
|
|
3
|
+
## 2.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#221](https://github.com/schmooky/pixi-reels/pull/221) [`c96cfdd`](https://github.com/schmooky/pixi-reels/commit/c96cfdd5a29ccbb783425bd4f35765b43fd49941) Thanks [@igaming-bulochka](https://github.com/igaming-bulochka)! - Add: `RoundedRectMaskStrategy` gains `scope: 'outer'` (one rect per reel, only the corners that sit on the set's bounding box rounded, safe at a zero cross gap) and a `corners` option (`{ topLeft, topRight, bottomLeft, bottomRight }`, screen-space) that limits which corners round in any scope. `HoldAndWinBuilder.cellMask` and the `BoardGrid` `mask` option now hand the factory `(cell, { cols, rows, corners })`, where `corners` are the board corners that cell sits on, so `(_, { corners }) => new RoundedRectMaskStrategy({ radius, corners })` clips a gapless board as one rounded window with a separate rect mask per cell. Zero-argument factories keep working.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [#220](https://github.com/schmooky/pixi-reels/pull/220) [`767453a`](https://github.com/schmooky/pixi-reels/commit/767453a4f32c1c84ae4a8f0589d9f6a93ba6d0b9) Thanks [@igaming-bulochka](https://github.com/igaming-bulochka)! - Perf: `SpineReelSymbol` takes its cached, hidden Spine instances off the ticker. It keeps one instance per symbol id for instant swaps, and each of those was created with spine-pixi's default `autoUpdate`, so every parked skeleton kept updating its animation state and world transform every frame while invisible - hundreds of them on a Hold & Win board of 1x1 reels. Now only the instance on screen updates; a parked one is resumed the moment it is shown again.
|
|
12
|
+
|
|
3
13
|
## 2.5.0
|
|
4
14
|
|
|
5
15
|
### Minor Changes
|
|
@@ -2,6 +2,7 @@ import { Container, Graphics, Ticker } from 'pixi.js';
|
|
|
2
2
|
import { Direction, Orientation } from '../core/ReelAxis.js';
|
|
3
3
|
import { ReelSet } from '../core/ReelSet.js';
|
|
4
4
|
import { MaskStrategy } from '../core/ReelViewport.js';
|
|
5
|
+
import { MaskCorners } from '../core/maskStrategies.js';
|
|
5
6
|
import { ReelSymbol } from '../symbols/ReelSymbol.js';
|
|
6
7
|
import { SymbolRegistry } from '../symbols/SymbolRegistry.js';
|
|
7
8
|
import { SpeedProfile, SymbolData } from '../config/types.js';
|
|
@@ -16,6 +17,18 @@ export interface BoardSpinTarget {
|
|
|
16
17
|
cell: BoardCell;
|
|
17
18
|
id: string;
|
|
18
19
|
}
|
|
20
|
+
/** What a cell-mask factory is told about the cell it builds for. */
|
|
21
|
+
export interface BoardCellMaskInfo {
|
|
22
|
+
cols: number;
|
|
23
|
+
rows: number;
|
|
24
|
+
/**
|
|
25
|
+
* The BOARD corners this cell sits on: `{ topLeft: true }` and the rest
|
|
26
|
+
* `false` for cell `(0, 0)`, all `false` for an inner cell. Hand it to
|
|
27
|
+
* `RoundedRectMaskStrategy` as `corners` and the board reads as one rounded
|
|
28
|
+
* window built from one rect per cell.
|
|
29
|
+
*/
|
|
30
|
+
corners: MaskCorners;
|
|
31
|
+
}
|
|
19
32
|
/** A speed profile, or a per-cell function of one (e.g. a stagger wave). */
|
|
20
33
|
export type BoardProfile = SpeedProfile | ((cell: BoardCell) => SpeedProfile);
|
|
21
34
|
export interface BoardGridOptions {
|
|
@@ -55,9 +68,12 @@ export interface BoardGridOptions {
|
|
|
55
68
|
* Mask for each cell, built once per cell (every cell is its own reel set
|
|
56
69
|
* and owns its mask). Default: a shared rect over the cell. Hand it
|
|
57
70
|
* `() => new RoundedRectMaskStrategy({ radius })` for cells whose art and
|
|
58
|
-
* frame have rounded corners.
|
|
71
|
+
* frame have rounded corners. The factory is told which cell it builds for
|
|
72
|
+
* and which board corners that cell sits on, so
|
|
73
|
+
* `(_, { corners }) => new RoundedRectMaskStrategy({ radius, corners })`
|
|
74
|
+
* rounds only the board's outer corners and keeps every other cell square.
|
|
59
75
|
*/
|
|
60
|
-
mask?: () => MaskStrategy;
|
|
76
|
+
mask?: (cell: BoardCell, info: BoardCellMaskInfo) => MaskStrategy;
|
|
61
77
|
/**
|
|
62
78
|
* Which way each cell's own strip travels while it spins. Every cell is a
|
|
63
79
|
* 1x1 reel set, so this changes the direction a symbol scrolls in from, not
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BoardGrid.d.ts","sourceRoot":"","sources":["../../src/board/BoardGrid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAe,MAAM,SAAS,CAAC;AAC3D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEtC,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,KAAK,EAAE,YAAY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C;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE;IAKrD,sDAAsD;IACtD,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,UAAU;IAIrC,wEAAwE;IACxE,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO;IAIhC,8DAA8D;IAC9D,UAAU,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAI/C,yEAAyE;IACzE,KAAK,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI;IAUxC;;;;;;;;;;OAUG;IACG,SAAS,CACb,OAAO,EAAE,eAAe,EAAE,EAC1B,QAAQ,GAAE,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAY,GACzE,OAAO,CAAC,IAAI,CAAC;IAehB,2EAA2E;IAC3E,YAAY,IAAI,MAAM;IAetB,IAAI,WAAW,IAAI,OAAO,CAEzB;IAED,OAAO,IAAI,IAAI;IASf,OAAO,CAAC,OAAO;IAOf,OAAO,CAAC,KAAK;CAOd"}
|
|
@@ -5,6 +5,7 @@ import { ReelSymbol } from '../symbols/ReelSymbol.js';
|
|
|
5
5
|
import { SymbolRegistry } from '../symbols/SymbolRegistry.js';
|
|
6
6
|
import { SpeedProfile, SymbolData } from '../config/types.js';
|
|
7
7
|
import { Disposable } from '../utils/Disposable.js';
|
|
8
|
+
import { BoardCellMaskInfo } from './BoardGrid.js';
|
|
8
9
|
import { Direction, Orientation } from '../core/ReelAxis.js';
|
|
9
10
|
import { MaskStrategy } from '../core/ReelViewport.js';
|
|
10
11
|
import { HwPhase } from './HoldAndWinState.js';
|
|
@@ -38,7 +39,7 @@ export interface HoldAndWinBoardConfig<TData> {
|
|
|
38
39
|
}) => boolean) | null;
|
|
39
40
|
chrome: ((g: Graphics, width: number, height: number) => void) | null;
|
|
40
41
|
/** Per-cell mask factory. See `HoldAndWinBuilder.cellMask`. */
|
|
41
|
-
mask: (() => MaskStrategy) | null;
|
|
42
|
+
mask: ((cell: HwCell, info: BoardCellMaskInfo) => MaskStrategy) | null;
|
|
42
43
|
/** Travel axis for each cell's own strip. See `HoldAndWinBuilder.axis`. */
|
|
43
44
|
orientation?: Orientation;
|
|
44
45
|
direction?: Direction;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HoldAndWinBoard.d.ts","sourceRoot":"","sources":["../../src/board/HoldAndWinBoard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"HoldAndWinBoard.d.ts","sourceRoot":"","sources":["../../src/board/HoldAndWinBoard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,KA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AIG;IACG,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IA0CnE;;;;;;;OAOG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAa5B;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG,IAAI;IASnD;;;;;;OAMG;IACG,OAAO,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAK9C;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI;IAM/B;;;;OAIG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,EAAE;IAOzC;;;;;;OAMG;IACH,IAAI,IAAI,MAAM;IAMd;;;OAGG;IACH,KAAK,IAAI,IAAI;IAOb,IAAI,WAAW,IAAI,OAAO,CAEzB;IAED,OAAO,IAAI,IAAI;IAQf,yEAAyE;IACzE,OAAO,CAAC,MAAM;IAYd;;;;OAIG;IACH,OAAO,CAAC,OAAO;IAQf,sFAAsF;IACtF,OAAO,CAAC,WAAW;IAKnB,gEAAgE;IAChE,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,aAAa;CAQtB"}
|
|
@@ -4,6 +4,7 @@ import { SymbolRegistry } from '../symbols/SymbolRegistry.js';
|
|
|
4
4
|
import { HoldAndWinBoard } from './HoldAndWinBoard.js';
|
|
5
5
|
import { Direction, Orientation } from '../core/ReelAxis.js';
|
|
6
6
|
import { MaskStrategy } from '../core/ReelViewport.js';
|
|
7
|
+
import { BoardCellMaskInfo } from './BoardGrid.js';
|
|
7
8
|
import { HwCell, HwCellSizeOptions, HwLockAnimation } from './HwTypes.js';
|
|
8
9
|
/**
|
|
9
10
|
* Fluent builder for {@link HoldAndWinBoard}.
|
|
@@ -132,8 +133,16 @@ export declare class HoldAndWinBuilder<TData = unknown> {
|
|
|
132
133
|
* Mask for each cell, built once per cell. Default: a shared rect over the
|
|
133
134
|
* cell. `() => new RoundedRectMaskStrategy({ radius: 8 })` rounds every
|
|
134
135
|
* cell's corners to match a rounded frame drawn behind the board.
|
|
136
|
+
*
|
|
137
|
+
* The factory receives the cell and the board corners it sits on, so a
|
|
138
|
+
* board framed as ONE rounded window keeps every cell a plain rect except
|
|
139
|
+
* the four corner cells, each rounded on its outer corner only:
|
|
140
|
+
*
|
|
141
|
+
* ```ts
|
|
142
|
+
* .cellMask((_, { corners }) => new RoundedRectMaskStrategy({ radius: 18, corners }))
|
|
143
|
+
* ```
|
|
135
144
|
*/
|
|
136
|
-
cellMask(factory: () => MaskStrategy): this;
|
|
145
|
+
cellMask(factory: (cell: HwCell, info: BoardCellMaskInfo) => MaskStrategy): this;
|
|
137
146
|
/**
|
|
138
147
|
* Which way each cell's strip travels while it spins. Cells are 1x1 reel
|
|
139
148
|
* sets, so this picks the edge a coin scrolls in from; the board's own
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HoldAndWinBuilder.d.ts","sourceRoot":"","sources":["../../src/board/HoldAndWinBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEhD,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,MAAM,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/E;;;;;;;;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,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,KAAK,YAAY,GAAG,IAAI;IAKhF;;;;OAIG;IACH,IAAI,CAAC,WAAW,EAAE,WAAW,EAAE,SAAS,GAAE,SAAqB,GAAG,IAAI;IAMtE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAK5B,sEAAsE;IACtE,GAAG,CAAC,EAAE,EAAE,MAAM,MAAM,GAAG,IAAI;IAK3B,KAAK,IAAI,eAAe,CAAC,KAAK,CAAC;CAuChC"}
|
|
@@ -50,12 +50,43 @@ export type RoundedMaskScope =
|
|
|
50
50
|
* bites a lens-shaped notch out of the seam. The strategy warns once when
|
|
51
51
|
* it sees touching rects.
|
|
52
52
|
*/
|
|
53
|
-
| 'reel'
|
|
53
|
+
| 'reel'
|
|
54
|
+
/**
|
|
55
|
+
* One rect per reel, like `'reel'`, but a reel corner is rounded only when
|
|
56
|
+
* it sits on a corner of the union bounding box: the first reel's outer
|
|
57
|
+
* pair, the last reel's outer pair, nothing in between. Inner edges stay
|
|
58
|
+
* square, so the seams never notch and a zero cross gap is fine - the set
|
|
59
|
+
* reads as one rounded window while every reel keeps its own rect.
|
|
60
|
+
*
|
|
61
|
+
* On a jagged set the box corners may touch no reel at all, in which case
|
|
62
|
+
* nothing rounds; use {@link SilhouetteMaskStrategy} there.
|
|
63
|
+
*/
|
|
64
|
+
| 'outer';
|
|
65
|
+
/**
|
|
66
|
+
* Which corners of a box a {@link RoundedRectMaskStrategy} may round.
|
|
67
|
+
* SCREEN corners in every orientation: `topLeft` is the top-left of the drawn
|
|
68
|
+
* rect on a horizontal set too. Only the keys set to `true` round; `{}`
|
|
69
|
+
* rounds nothing. Absent (`undefined`) means all four.
|
|
70
|
+
*/
|
|
71
|
+
export interface MaskCorners {
|
|
72
|
+
topLeft?: boolean;
|
|
73
|
+
topRight?: boolean;
|
|
74
|
+
bottomLeft?: boolean;
|
|
75
|
+
bottomRight?: boolean;
|
|
76
|
+
}
|
|
54
77
|
export interface RoundedRectMaskOptions {
|
|
55
78
|
/** Corner radius in pixels. Pixi clamps it per corner to half the shorter adjacent edge. */
|
|
56
79
|
radius: number;
|
|
57
80
|
/** Which boxes get rounded. Default `'set'`. */
|
|
58
81
|
scope?: RoundedMaskScope;
|
|
82
|
+
/**
|
|
83
|
+
* Which corners may round at all. Default: all four. With `scope: 'set'`
|
|
84
|
+
* these are the corners of the union box; with `'reel'` the same corners of
|
|
85
|
+
* every reel; with `'outer'` the box corners that are also listed here. The
|
|
86
|
+
* way a 1x1 Hold & Win cell rounds only the board corner it sits on - see
|
|
87
|
+
* `HoldAndWinBuilder.cellMask`.
|
|
88
|
+
*/
|
|
89
|
+
corners?: MaskCorners;
|
|
59
90
|
}
|
|
60
91
|
/**
|
|
61
92
|
* Rounded-corner rectangles, per reel or per set.
|
|
@@ -75,11 +106,20 @@ export interface RoundedRectMaskOptions {
|
|
|
75
106
|
* // Each reel its own rounded card. Needs a cross gap.
|
|
76
107
|
* builder.symbolGap({ x: 12, y: 0 })
|
|
77
108
|
* .maskStrategy(new RoundedRectMaskStrategy({ radius: 14, scope: 'reel' }))
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* // One rect per reel, only the window's four corners rounded. Any gap.
|
|
112
|
+
* builder.maskStrategy(new RoundedRectMaskStrategy({ radius: 18, scope: 'outer' }))
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* // A 1x1 Hold & Win cell that rounds only the board corner it sits on.
|
|
116
|
+
* hw.cellMask((_cell, { corners }) => new RoundedRectMaskStrategy({ radius: 18, corners }))
|
|
78
117
|
*/
|
|
79
118
|
export declare class RoundedRectMaskStrategy implements DrawableMaskStrategy {
|
|
80
119
|
readonly version = 2;
|
|
81
120
|
private readonly _radius;
|
|
82
121
|
private readonly _scope;
|
|
122
|
+
private readonly _corners;
|
|
83
123
|
constructor(options: RoundedRectMaskOptions);
|
|
84
124
|
build(ctx: MaskContext): Graphics;
|
|
85
125
|
update(g: Graphics, ctx: MaskContext): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"maskStrategies.d.ts","sourceRoot":"","sources":["../../src/core/maskStrategies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAgB,MAAM,mBAAmB,CAAC;AAGjF;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,oBAAqB,SAAQ,YAAY;IACxD,uEAAuE;IACvE,IAAI,CAAC,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,WAAW,GAAG,IAAI,CAAC;CAC3C;AAED,sDAAsD;AACtD,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,YAAY,GAAG,CAAC,IAAI,oBAAoB,CAEjF;AAUD;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,WAAW,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAEtE;AAqBD,4EAA4E;AAC5E,MAAM,MAAM,gBAAgB;AAC1B;;;;;;GAMG;AACD,KAAK;AACP;;;;;;;;;GASG;GACD,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"maskStrategies.d.ts","sourceRoot":"","sources":["../../src/core/maskStrategies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAgB,MAAM,mBAAmB,CAAC;AAGjF;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,oBAAqB,SAAQ,YAAY;IACxD,uEAAuE;IACvE,IAAI,CAAC,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,WAAW,GAAG,IAAI,CAAC;CAC3C;AAED,sDAAsD;AACtD,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,YAAY,GAAG,CAAC,IAAI,oBAAoB,CAE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BG;AACH,wBAAgB,KAAK,CAAC,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,GAAG,oBAAoB,CA0ClF;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,YAAY,CAAC,GAAG,UAAU,EAAE,YAAY,EAAE,GAAG,oBAAoB,CA2BhF"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./debug-DkAoLN21.cjs`),t=require(`./ReelSymbol-DjJzuBhn.cjs`),n=require(`./SpineSymbol-Dq3IAu_k.cjs`);let r=require(`pixi.js`);function i(e){return typeof e.draw==`function`}var a={color:16777215};function o(e){return e.origin??{x:0,y:0}}function s(e){return e.axis.toScreen(e.bleed??0,0)}function c(e){let t=o(e);if(e.rects.length===0)return{x:t.x,y:t.y,width:e.width,height:e.height};let n=1/0,r=1/0,i=-1/0,a=-1/0;for(let t of e.rects)t.x<n&&(n=t.x),t.y<r&&(r=t.y),t.x+t.width>i&&(i=t.x+t.width),t.y+t.height>a&&(a=t.y+t.height);return{x:t.x+n,y:t.y+r,width:i-n,height:a-r}}var l=class{version=2;_radius;_scope;constructor(e){if(!Number.isFinite(e?.radius)||e.radius<0)throw Error(`RoundedRectMaskStrategy: radius must be a non-negative number, got ${String(e?.radius)}.`);this._radius=e.radius,this._scope=e.scope??`set`}build(e){let t=new r.Graphics;return this.draw(t,e),t}update(e,t){e.clear(),this.draw(e,t)}draw(e,t){let n=s(t),r=o(t);if(this._scope===`set`||t.rects.length===0){let r=c(t);e.roundRect(r.x-n.x,r.y-n.y,r.width+n.x*2,r.height+n.y*2,this._radius).fill(a);return}this._warnIfTouching(t);for(let i of t.rects)e.roundRect(r.x+i.x-n.x,r.y+i.y-n.y,i.width+n.x*2,i.height+n.y*2,this._radius).fill(a)}_warnIfTouching(t){if(t.rects.length<2)return;let n=t.axis.crossProp,r=n===`x`?`width`:`height`;for(let i=1;i<t.rects.length;i++){let a=t.rects[i-1],o=t.rects[i][n]-(a[n]+a[r]);if(Math.abs(o)<.5){e.A(`mask-rounded-touching`,`RoundedRectMaskStrategy: scope 'reel' with a zero cross gap rounds both sides of every shared reel edge, which notches the seams. Add a cross gap (symbolGap.x on a vertical set), use scope 'set', or use SilhouetteMaskStrategy.`);return}}}},u=.5,d=class{version=2;_radius;_concaveRadius;_fallback;constructor(e){if(!Number.isFinite(e?.radius)||e.radius<0)throw Error(`SilhouetteMaskStrategy: radius must be a non-negative number, got ${String(e?.radius)}.`);let t=e.concaveRadius??e.radius;if(!Number.isFinite(t)||t<0)throw Error(`SilhouetteMaskStrategy: concaveRadius must be a non-negative number, got ${String(t)}.`);this._radius=e.radius,this._concaveRadius=t,this._fallback=new l({radius:e.radius,scope:`reel`})}build(e){let t=new r.Graphics;return this.draw(t,e),t}update(e,t){e.clear(),this.draw(e,t)}draw(t,n){let r=this._spans(n);if(r.length===0){let e=c(n),r=s(n);t.roundRect(e.x-r.x,e.y-r.y,e.width+r.x*2,e.height+r.y*2,this._radius).fill(a);return}if(!this._isContiguous(r)){e.A(`mask-silhouette-disjoint`,`SilhouetteMaskStrategy: reels have a non-zero cross gap, so their union is not one outline. Falling back to per-reel rounded rects. Drop the cross gap to use the silhouette.`),this._fallback.draw(t,n);return}let i=this._ring(r);if(i.length<3){let e=c(n);t.rect(e.x,e.y,e.width,e.height).fill(a);return}this._assignRadii(i);let l=o(n),u=i.map(e=>{let t=n.axis.toScreen(e.c,e.m);return{x:l.x+t.x,y:l.y+t.y,radius:e.radius}});t.roundShape(u,this._radius).fill(a)}_spans(e){let t=e.axis,n=[];for(let r of e.rects){let e=t.toLocal(r.x,r.y),i=t.toLocal(r.width,r.height);i.cross<=0||i.main<=0||n.push({c0:e.cross,c1:e.cross+i.cross,m0:e.main,m1:e.main+i.main})}n.sort((e,t)=>e.c0-t.c0);let r=e.bleed??0;return n.length>0&&r!==0&&(n[0].c0-=r,n[n.length-1].c1+=r),n}_isContiguous(e){for(let t=1;t<e.length;t++)if(Math.abs(e[t].c0-e[t-1].c1)>u)return!1;return!0}_ring(e){let t=[],n=(e,n)=>{let r=t[t.length-1];r&&Math.abs(r.c-e)<u&&Math.abs(r.m-n)<u||t.push({c:e,m:n})},r=e[0],i=e[e.length-1];n(r.c0,r.m0);for(let t=1;t<e.length;t++)Math.abs(e[t].m0-e[t-1].m0)>u&&(n(e[t].c0,e[t-1].m0),n(e[t].c0,e[t].m0));n(i.c1,i.m0),n(i.c1,i.m1);for(let t=e.length-1;t>=1;t--)Math.abs(e[t].m1-e[t-1].m1)>u&&(n(e[t].c0,e[t].m1),n(e[t].c0,e[t-1].m1));for(n(r.c0,r.m1);t.length>1&&Math.abs(t[t.length-1].c-t[0].c)<u&&Math.abs(t[t.length-1].m-t[0].m)<u;)t.pop();return t.map(e=>({c:e.c,m:e.m,radius:this._radius}))}_assignRadii(e){let t=0;for(let n=0;n<e.length;n++){let r=e[n],i=e[(n+1)%e.length];t+=r.c*i.m-i.c*r.m}let n=t>=0?1:-1;for(let t=0;t<e.length;t++){let r=e[(t-1+e.length)%e.length],i=e[t],a=e[(t+1)%e.length];i.radius=((i.c-r.c)*(a.m-i.m)-(i.m-r.m)*(a.c-i.c))*n>=0?this._radius:this._concaveRadius}}},f=class{version=2;constructor(e){if(this._path=e,typeof e!=`function`)throw Error(`PathMaskStrategy: expected a (graphics, context) => void function.`)}build(e){let t=new r.Graphics;return this.draw(t,e),t}update(e,t){e.clear(),this.draw(e,t)}draw(e,t){this._path(e,t)}};function p(e,t){if(!Number.isFinite(t))throw Error(`inset(): expected a finite number of pixels, got ${String(t)}.`);let n=e=>{let n=o(e),r=e.axis.mainProp===`y`,i=(e.bleed??0)-t,a=e=>e-t*2;return{rects:e.rects.map(e=>({x:e.x,y:e.y,width:r?e.width:a(e.width),height:r?a(e.height):e.height})),width:r?e.width:a(e.width),height:r?a(e.height):e.height,axis:e.axis,bleed:i,origin:r?{x:n.x,y:n.y+t}:{x:n.x+t,y:n.y}}};return{version:2,build:t=>e.build(n(t)),update:(t,r)=>e.update(t,n(r)),draw:(t,r)=>g(e,t,n(r))}}function m(...e){if(e.length===0)throw Error(`composeMasks(): expected at least one strategy.`);let t=(t,n)=>{for(let r of e)g(r,t,n)};return{version:2,build(e){let n=new r.Graphics;return t(n,e),n},update(e,n){e.clear(),t(e,n)},draw:t}}var h=new WeakMap;function g(e,t,n){if(i(e)){e.draw(t,n);return}let r=h.get(t),a=r?.get(e);if(a&&a.parent===t){e.update(a,n);return}let o=e.build(n);r||(r=new Map,h.set(t,r)),r.set(e,o),t.addChild(o)}function _(e){let t=e.trim,n=e.orig;return!t||n.width<=0||n.height<=0||t.width===n.width&&t.height===n.height?null:{left:t.x/n.width,top:t.y/n.height,right:(t.x+t.width)/n.width,bottom:(t.y+t.height)/n.height}}function v(e){let t=e.source;if(!t||e.rotate!==0)return!1;let{frame:n,orig:r}=e;return n.x!==0||n.y!==0||n.width!==t.width||n.height!==t.height?!1:r.width===n.width&&r.height===n.height}var y=10,b=class{_mesh=null;_active=!1;_uvScratch=null;_uvSource=null;constructor(e,t){this._view=e,this._flat=t}get isActive(){return this._active}get mesh(){return this._mesh}apply(e,t){if(e===null||!v(t))return this._active?(this._active=!1,this._flat.visible=!0,this._mesh&&(this._mesh.visible=!1),!1):!1;let n=this._ensureMesh(t);n.texture!==t&&(n.texture=t),this._syncUvs(n,t),n.setCorners(e.x0,e.y0,e.x1,e.y1,e.x2,e.y2,e.x3,e.y3);let r=(e.x0+e.x1+e.x2+e.x3)/4,i=(e.y0+e.y1+e.y2+e.y3)/4;return n.pivot.set(r,i),n.position.set(r,i),this._active||(this._active=!0,this._flat.visible=!1,n.visible=!0),!0}resetTransform(){this._mesh&&this._mesh.scale.set(1,1)}syncTexture(e){this._active&&this._mesh&&this._mesh.texture!==e&&(this._mesh.texture=e,this._syncUvs(this._mesh,e))}destroy(){this._mesh&&(this._mesh.destroy(),this._mesh=null,this._active=!1,this._uvScratch=null,this._uvSource=null)}_ensureMesh(e){return this._mesh?this._mesh:(this._mesh=new r.PerspectiveMesh({texture:e,verticesX:y,verticesY:y}),this._uvScratch=new Float32Array(y*y*2),this._view.addChild(this._mesh),this._mesh)}_syncUvs(e,t){if(this._uvSource===t)return;let n=this._uvScratch;if(!n)return;this._uvSource=t;let{x0:r,y0:i,x1:a,y1:o,x2:s,y2:c,x3:l,y3:u}=t.uvs,d=y-1;for(let e=0;e<n.length/2;e++){let t=e%y/d,f=Math.floor(e/y)/d,p=(1-t)*(1-f),m=t*(1-f),h=t*f,g=(1-t)*f;n[e*2]=p*r+m*a+h*s+g*l,n[e*2+1]=p*i+m*o+h*c+g*u}e.geometry.uvs=n}},x=class extends t.t{_sprite;_textures;_winTween=null;_perspective;constructor(e){super(),this._textures=e.textures;let t=e.anchor??{x:0,y:0};this._sprite=new r.Sprite,this._sprite.anchor.set(t.x,t.y),this.view.addChild(this._sprite),this._perspective=new b(this.view,this._sprite)}onActivate(e){let t=this._textures[e];t&&(this._sprite.texture=t,this._perspective.syncTexture(t))}onDeactivate(){this._killWinTween(),this._sprite.scale.set(1,1),this._perspective.resetTransform()}get cellInset(){return _(this._sprite.texture)}applyCellQuad(e){if(this._perspective.apply(e,this._sprite.texture)){this.view.scale.set(1,1),this.view.pivot.set(0,0);return}super.applyCellQuad(e)}async playWin(){this._killWinTween();let e=this._perspective.isActive?this._perspective.mesh:this._sprite;if(e)return new Promise(t=>{this._winTween=this.gsap.to(e.scale,{x:1.15,y:1.15,duration:.15,yoyo:!0,repeat:1,ease:`power2.inOut`,onComplete:t})})}stopAnimation(){this._killWinTween(),this._sprite.scale.set(1,1),this._perspective.resetTransform()}resize(e,t){this._sprite.width=e,this._sprite.height=t}onDestroy(){this._killWinTween(),this._perspective.destroy()}_killWinTween(){this._winTween&&=(this._winTween.kill(),null)}},S=class extends t.t{_animSprite;_frames;_animationSpeed;_winResolve=null;_perspective;constructor(e){super(),this._frames=e.frames,this._animationSpeed=e.animationSpeed??1;let t=e.anchor??{x:0,y:0},n=Object.values(this._frames)[0]??[];this._animSprite=new r.AnimatedSprite(n.length>0?n:[]),this._animSprite.anchor.set(t.x,t.y),this._animSprite.animationSpeed=this._animationSpeed,this._animSprite.loop=!1,this.view.addChild(this._animSprite),this._perspective=new b(this.view,this._animSprite),this._animSprite.onFrameChange=()=>{this._perspective.syncTexture(this._animSprite.texture)}}get cellInset(){return _(this._animSprite.texture)}applyCellQuad(e){if(this._perspective.apply(e,this._animSprite.texture)){this.view.scale.set(1,1),this.view.pivot.set(0,0);return}super.applyCellQuad(e)}onActivate(e){let t=this._frames[e];t&&t.length>0&&(this._animSprite.textures=t,this._animSprite.gotoAndStop(0))}onDeactivate(){this._animSprite.stop(),this._winResolve=null}async playWin(){return new Promise(e=>{this._winResolve=e,this._animSprite.loop=!1,this._animSprite.onComplete=()=>{this._winResolve=null,this._animSprite.onComplete=void 0,this._animSprite.gotoAndStop(0),e()},this._animSprite.gotoAndPlay(0)})}stopAnimation(){this._animSprite.stop(),this._animSprite.gotoAndStop(0),this._winResolve&&=(this._winResolve(),null)}resize(e,t){this._animSprite.width=e,this._animSprite.height=t,this._animSprite.x=e*this._animSprite.anchor.x,this._animSprite.y=t*this._animSprite.anchor.y}onDestroy(){this._animSprite.onFrameChange=void 0,this._perspective.destroy()}},C=class extends t.t{onActivate(e){}onDeactivate(){}async playWin(){}stopAnimation(){}resize(e,t){}},w=class{_renderer;_resolution;_blurDefaults;_static=new Map;_blurred=new Map;_isDestroyed=!1;constructor(e){this._renderer=e.renderer,this._resolution=e.resolution,this._blurDefaults=e.blur??{}}setStatic(e,t){this._put(this._static,e,{texture:t,owned:!1,width:0,height:0})}setBlurred(e,t){this._put(this._blurred,e,{texture:t,owned:!1,width:0,height:0})}getStatic(e){return this._static.get(e)?.texture??null}getBlurred(e){return this._blurred.get(e)?.texture??null}hasStatic(e){return this._static.has(e)}hasBlurred(e){return this._blurred.has(e)}captureStatic(e,t,n,i){let a=this._static.get(e);if(a&&(!a.owned||a.width===n&&a.height===i))return a.texture;let o=this._renderer.generateTexture({target:t,frame:new r.Rectangle(0,0,n,i),resolution:this._resolution,antialias:!0});return this._put(this._static,e,{texture:o,owned:!0,width:n,height:i}),o}captureBlurred(e,t,n,i){let a=i?.axis??this._blurDefaults.axis??`y`,o=this._blurred.get(e);if(o&&(!o.owned||o.width===t&&o.height===n&&o.axis===a))return o.texture;let s=this.getStatic(e);if(!s)throw Error(`SpinTextureCache.captureBlurred('${e}'): no static texture to blur. Call captureStatic() or setStatic() for this symbolId first.`);let c=i?.strength??this._blurDefaults.strength??(a===`y`?n:t)*.2,l=i?.quality??this._blurDefaults.quality??4,u=i?.padding??this._blurDefaults.padding??Math.ceil(c),d=new r.Container,f=new r.Sprite(s);f.width=t,f.height=n,a===`y`?(f.y=u,f.filters=[new r.BlurFilter({strengthX:0,strengthY:c,quality:l})]):(f.x=u,f.filters=[new r.BlurFilter({strengthX:c,strengthY:0,quality:l})]),d.addChild(f);let p=this._renderer.generateTexture({target:d,frame:new r.Rectangle(0,0,t+(a===`x`?u*2:0),n+(a===`y`?u*2:0)),resolution:this._resolution,antialias:!0});return d.destroy({children:!0}),this._put(this._blurred,e,{texture:p,owned:!0,width:t,height:n,axis:a}),p}invalidate(e){this._drop(this._static,e),this._drop(this._blurred,e)}clear(){for(let e of[...this._static.keys()])this._drop(this._static,e);for(let e of[...this._blurred.keys()])this._drop(this._blurred,e)}destroy(){this._isDestroyed||=(this.clear(),!0)}get isDestroyed(){return this._isDestroyed}_put(e,t,n){this._drop(e,t),e.set(t,n)}_drop(e,t){let n=e.get(t);n?.owned&&n.texture.destroy(!0),e.delete(t)}};function T(e){let{cache:t,ids:n,width:r,height:i}=e,a=e.blurred??!0,o=e.createSymbol();try{for(let s of n)o.symbolId!==s&&o.activate(s),o.resize(r,i),t.captureStatic(s,o.view,r,i),a&&t.captureBlurred(s,r,i,e.blur)}finally{o.destroy()}}var E=class extends t.t{_inner;_cache;_mode;_rampMs;_blurOpts;_staticSprite;_blurSprite;_spinning=!1;_anticipating=!1;_cellW=0;_cellH=0;_rampTween=null;constructor(e){super(),this._inner=e.createInner(),this._cache=e.cache,this._mode=e.spinTexture??`blurred`,this._rampMs=e.blurRampMs??120,this._blurOpts=e.blur,this.view.addChild(this._inner.view),this._staticSprite=new r.Sprite,this._staticSprite.anchor.set(.5,.5),this._staticSprite.visible=!1,this._blurSprite=new r.Sprite,this._blurSprite.anchor.set(.5,.5),this._blurSprite.visible=!1,this.view.addChild(this._staticSprite,this._blurSprite)}get inner(){return this._inner}get isShowingSnapshot(){return this._spinning}onActivate(e){if(this._spinning){this._showSnapshot(e,{instant:!0});return}this._inner.symbolId!==e&&this._inner.activate(e),this._hideSnapshot()}onDeactivate(){this._killRamp(),this._spinning=!1,this._anticipating=!1,this._staticSprite.visible=!1,this._blurSprite.visible=!1,this._inner.symbolId!==``&&this._inner.deactivate()}onReelSpinStart(e=!1){if(this._spinning){this._showSnapshot(this.symbolId,{instant:!0});return}this._spinning=!0,this._anticipating=!1,this._showSnapshot(this.symbolId,{instant:e||this._rampMs<=0}),this._inner.symbolId!==``&&this._inner.deactivate()}onReelAnticipationStart(){if(!(!this._spinning||this._anticipating)&&(this._anticipating=!0,this._mode!==`static`)){if(this._killRamp(),this._staticSprite.visible=!0,this._staticSprite.alpha=1,!this._blurSprite.visible||this._rampMs<=0){this._blurSprite.visible=!1;return}this._rampTween=this.gsap.to(this._blurSprite,{alpha:0,duration:this._rampMs/1e3,ease:`power1.out`,onComplete:()=>{this._rampTween=null,this._blurSprite.visible=!1}})}}onReelSpinEnd(){this._spinning&&(this._spinning=!1,this._anticipating=!1,this._killRamp(),this._staticSprite.visible=!1,this._blurSprite.visible=!1,this._inner.symbolId!==this.symbolId&&(this._inner.activate(this.symbolId),this._inner.resize(this._cellW,this._cellH)))}onReelLanded(){this._spinning||this._inner.onReelLanded()}async playWin(){return this._inner.playWin()}stopAnimation(){this._inner.symbolId!==``&&this._inner.stopAnimation()}async playDestroy(e){return!this._spinning&&this._inner.symbolId!==``?this._inner.playDestroy(e):super.playDestroy(e)}resize(e,t){this._cellW=e,this._cellH=t,this._staticSprite.position.set(e/2,t/2),this._blurSprite.position.set(e/2,t/2),this._fitSprites(),this._inner.resize(e,t)}onDestroy(){this._killRamp(),this._inner.view.parent===this.view&&this.view.removeChild(this._inner.view),this._inner.destroy()}_showSnapshot(e,t){let n=this._ensureStatic(e);if(this._staticSprite.texture=n,this._mode===`blurred`&&(this._blurSprite.texture=this._cache.captureBlurred(e,this._cellW,this._cellH,this._resolvedBlur())),this._fitSprites(),this._mode===`static`){this._staticSprite.visible=!0,this._staticSprite.alpha=1;return}if(t.instant){if(this._anticipating){this._killRamp(),this._blurSprite.visible=!1,this._staticSprite.visible=!0,this._staticSprite.alpha=1;return}if(this._rampTween)return;this._staticSprite.visible=!1,this._blurSprite.visible=!0,this._blurSprite.alpha=1;return}this._killRamp(),this._staticSprite.visible=!0,this._staticSprite.alpha=1,this._blurSprite.visible=!0,this._blurSprite.alpha=0,this._rampTween=this.gsap.to(this._blurSprite,{alpha:1,duration:this._rampMs/1e3,ease:`power1.in`,onComplete:()=>{this._rampTween=null,this._staticSprite.visible=!1}})}_ensureStatic(e){let t=this._cache.getStatic(e);if(t)return t;let n=this._inner.symbolId!==e;n&&(this._inner.activate(e),this._inner.resize(this._cellW,this._cellH));let r=this._cache.captureStatic(e,this._inner.view,this._cellW,this._cellH);return n&&this._spinning&&this._inner.deactivate(),r}_hideSnapshot(){this._killRamp(),this._staticSprite.visible=!1,this._blurSprite.visible=!1}_fitSprites(){if(this._cellW<=0||this._cellH<=0)return;let e=this._resolvedBlur().axis===`x`;for(let t of[this._staticSprite,this._blurSprite]){let n=t.texture.width,r=t.texture.height;n<=0||r<=0||t.scale.set(e?this._cellH/r:this._cellW/n)}}_resolvedBlur(){return{...this._blurOpts,axis:this._blurOpts?.axis??this.mainAxis}}_killRamp(){this._rampTween&&=(this._rampTween.kill(),null)}},D=class extends t.t{_color;_label;_textColor;_gfx;_text;constructor(e){super(),this._color=e.color,this._label=e.label,this._textColor=e.textColor??16777215,this._gfx=new r.Graphics,this._text=new r.Text({text:this._label,style:{fontFamily:`"Roboto Condensed", "Arial Narrow", "Helvetica Neue Condensed", "Liberation Sans Narrow", system-ui, sans-serif`,fontSize:32,fontWeight:`700`,fill:this._textColor,align:`center`}}),this._text.anchor.set(.5),this.view.addChild(this._gfx),this.view.addChild(this._text)}onActivate(e){}onDeactivate(){}async playWin(){return new Promise(e=>{this.gsap.killTweensOf(this._text),this.gsap.killTweensOf(this._text.scale);let t=this._textColor;this.gsap.timeline({onComplete:()=>{this._text.scale.set(1,1),this._text.rotation=0,this._text.style.fill=t,e()}}).to(this._text.scale,{x:1.4,y:1.4,duration:.18,ease:`back.out(2)`},0).to(this._text,{rotation:-.12,duration:.09,ease:`sine.inOut`},0).to(this._text,{rotation:.12,duration:.18,ease:`sine.inOut`},.09).to(this._text,{rotation:0,duration:.09,ease:`sine.inOut`},.27).to(this._text.scale,{x:1,y:1,duration:.18,ease:`power2.out`},.32),this.gsap.delayedCall(.06,()=>this._text.style.fill=16769384),this.gsap.delayedCall(.42,()=>this._text.style.fill=t)})}stopAnimation(){this.gsap.killTweensOf(this._text),this.gsap.killTweensOf(this._text.scale),this._text.scale.set(1,1),this._text.rotation=0,this._text.style.fill=this._textColor,this._gfx.alpha=1}resize(e,t){this._gfx.clear(),this._gfx.rect(0,0,e,t).fill({color:this._color}),this._gfx.rect(1,1,e-2,t-2).stroke({color:0,width:2,alpha:.25}),this._text.x=e/2,this._text.y=t/2;let n=Math.max(1,this._label.length),r=t*.38,i=e*.7/(n*.45);this._text.style.fontSize=Math.max(7,Math.floor(Math.min(r,i)))}},O=[{id:`7`,color:12597547,label:`7`},{id:`8`,color:15105570,label:`8`},{id:`9`,color:15844367,label:`9`},{id:`10`,color:2600544,label:`10`},{id:`J`,color:1482885,label:`J`},{id:`Q`,color:2719929,label:`Q`},{id:`K`,color:9323693,label:`K`},{id:`A`,color:2899536,label:`A`}],k={id:`wild`,color:16774048,label:`WILD`,textColor:7033856};function A(e,t){let n=t.trigger??2,r=t.mode??`all-remaining`,i=e.map(e=>e.visible.filter(e=>e===t.symbol).length),a=0,o=-1;for(let e=0;e<i.length;e++)if(a+=i[e],a>=n){o=e;break}if(o===-1)return[];let s=[];for(let t=o+1;t<e.length;t++)(r===`all-remaining`||i[t]>0)&&s.push(t);return s}var j=class{name=`cascade`;_gravity;constructor(e=1.5){this._gravity=e}computeDelta(e,t,n){let r=e*t*this._gravity*n/1e3;return Math.min(r,e)}},M=class{name=`immediate`;computeDelta(e,t,n){return 0}},N=e=>`${e.reel},${e.cell}`,P=`default`,F=class{container;cols;rows;cellWidth;cellHeight;columnGap;rowGap;emptyId;_reels=new Map;_cells=[];_lifted;_destroyed=!1;constructor(t){if(!t.ticker)throw Error(`BoardGrid: a ticker is required.`);this.cols=t.cols,this.rows=t.rows;let n=typeof t.cellSize==`number`?{width:t.cellSize,height:t.cellSize}:t.cellSize;this.cellWidth=n.width,this.cellHeight=n.height;let i=t.gap??4;this.columnGap=t.columnGap??i,this.rowGap=t.rowGap??i,this.emptyId=t.emptyId??`empty`,this.container=new r.Container;let a=t.profiles&&Object.keys(t.profiles).length>0?t.profiles:{[P]:{...e.b.NORMAL,minimumSpinTime:320}},o=Object.keys(a),s=(e,t)=>typeof e==`function`?e(t):e;for(let e=0;e<t.cols;e++)for(let n=0;n<t.rows;n++){let i={reel:e,cell:n},a=this._origin(i);if(t.chrome){let e=new r.Graphics;t.chrome(e,this.cellWidth,this.cellHeight),e.position.set(a.x,a.y),this.container.addChild(e)}}for(let n=0;n<t.cols;n++)for(let r=0;r<t.rows;r++){let i={reel:n,cell:r},c=this._origin(i),l=new e.u().reels(1).visibleCells(1).symbolSize(this.cellWidth,this.cellHeight).symbolGap(0,0).maskStrategy(t.mask?t.mask():new e.z).symbols(e=>{t.symbols(e),e.has(this.emptyId)||e.register(this.emptyId,C,{})}).initialFrame([{visible:[this.emptyId],bufferStart:[this.emptyId],bufferEnd:[this.emptyId]}]).ticker(t.ticker).orientation(t.orientation??`vertical`).direction(t.direction??`forward`).initialSpeed(o[0]);for(let[e,t]of Object.entries(a))l.speed(e,s(t,i));t.weights&&l.weights(t.weights),t.symbolData&&l.symbolData(t.symbolData),t.rng&&l.rng(t.rng);let u=l.build();u.position.set(c.x,c.y),this.container.addChild(u),this._reels.set(N(i),u),this._cells.push(i)}this._lifted=new r.RenderLayer,this.container.addChild(this._lifted);for(let e of this._reels.values())this._lifted.attach(e.viewport.unmaskedContainer)}get cellSize(){return this.cellWidth}get gap(){return this.columnGap}cells(){return this._cells.map(e=>({reel:e.reel,cell:e.cell}))}cellBounds(e){let t=this._origin(e);return{x:t.x,y:t.y,width:this.cellWidth,height:this.cellHeight}}cellCenter(e){let t=this._origin(e);return{x:t.x+this.cellWidth/2,y:t.y+this.cellHeight/2}}symbolAt(e){return this._reel(e).getReel(0).getSymbolAt(0)}reelAt(e){return this._reel(e)}setProfile(e,t){this._reel(e).speed.set(t)}place(e,t){this._reel(e).getReel(0).placeSymbols({visible:[t],bufferStart:[this.emptyId],bufferEnd:[this.emptyId]})}async spinCells(e,t=()=>{}){await Promise.all(e.map(async({cell:e,id:n})=>{let r=this._reel(e),i=r.spin();r.setResult([{visible:[n],bufferStart:[this.emptyId],bufferEnd:[this.emptyId]}]),await i,await t(e,n)}))}skipSpinning(){let e=0;for(let t of this._reels.values())if(t.isSpinning){e+=1;try{t.skipSpin()}catch{}}return e}get isDestroyed(){return this._destroyed}destroy(){if(!this._destroyed){this._destroyed=!0;for(let e of this._reels.values())e.destroy();this._reels.clear(),this._cells.length=0,this.container.destroy({children:!0})}}_origin(e){return{x:e.reel*(this.cellWidth+this.columnGap),y:e.cell*(this.cellHeight+this.rowGap)}}_reel(e){let t=this._reels.get(N(e));if(!t)throw Error(`BoardGrid: cell ${N(e)} is outside the ${this.cols}x${this.rows} grid.`);return t}},I=e=>`${e.reel},${e.cell}`,L=class{_locked=new Map;_cellSet;_allCells;_initialInactive;_inactive;_defaultRespins;_respinsLeft=0;_round=0;_phase=`idle`;_waveLanded=[];constructor(e,t,n=[]){this._allCells=e,this._cellSet=new Set(e.map(I)),this._defaultRespins=t;for(let e of n)if(!this._cellSet.has(I(e)))throw Error(`HoldAndWinBoard: inactive cell ${I(e)} is outside the grid.`);this._initialInactive=new Set(n.map(I)),this._inactive=new Set(this._initialInactive)}get phase(){return this._phase}get respinsLeft(){return this._respinsLeft}get round(){return this._round}get capacity(){return this._allCells.length-this._inactive.size}get isFull(){return this._locked.size===this.capacity}lockedCoins(){return[...this._locked.values()]}freeCells(){return this._allCells.filter(e=>{let t=I(e);return!this._locked.has(t)&&!this._inactive.has(t)})}inactiveCells(){return this._allCells.filter(e=>this._inactive.has(I(e)))}isActive(e){return!this._inactive.has(I(e))}isLocked(e){return this._locked.has(I(e))}coinAt(e){return this._locked.get(I(e))}enter(e){if(this._phase!==`idle`)throw Error(`HoldAndWinBoard: enter() while a feature is active — call reset() first.`);let t=[],n=new Set;for(let r of e){let e=I(r.cell);if(this._assertActive(r.cell,`enter`),n.has(e))throw Error(`HoldAndWinBoard: enter() seeds cell ${e} twice.`);n.add(e);let i=this._freeze(r.cell,r.id,r.data);this._locked.set(e,i),t.push(i)}return this._round=0,this._phase=`active`,[this._setRespins(this._defaultRespins,`seed`),{type:`feature:enter`,payload:{seed:t,respins:this._respinsLeft}}]}beginWave(e){if(this._phase===`idle`)throw Error(`HoldAndWinBoard: respin() before enter().`);if(this._phase===`spinning`)throw Error(`HoldAndWinBoard: respin() while a wave is in flight.`);let t=new Map;for(let n of e){let e=I(n.cell);if(this._assertActive(n.cell,`respin`),this._locked.has(e))throw Error(`HoldAndWinBoard: hit targets locked cell ${e}.`);if(t.has(e))throw Error(`HoldAndWinBoard: respin() targets cell ${e} twice.`);t.set(e,n)}return this._waveLanded=[],this._phase=`spinning`,this._round+=1,{round:this._round,spinning:this.freeCells(),hitByKey:t}}land(e,t){if(this._phase!==`spinning`)return[];if(!t)return[{type:`cell:landed`,payload:{cell:e,coin:null}}];let n=this._freeze(e,t.id,t.data);return this._locked.set(I(e),n),this._waveLanded.push(n),[{type:`cell:landed`,payload:{cell:e,coin:n}},{type:`coin:locked`,payload:{coin:n,locked:this._locked.size,capacity:this.capacity}}]}endWave(){if(this._phase!==`spinning`)return{effects:[],landed:[]};let e=this._waveLanded,t=[];t.push(e.length>0?this._setRespins(this._defaultRespins,`hit-reset`):this._setRespins(this._respinsLeft-1,`miss`)),this._phase=`active`,t.push({type:`respin:end`,payload:{round:this._round,hits:[...e],respinsLeft:this._respinsLeft}});let n=this.isFull;return n&&t.push({type:`board:full`,payload:{coins:this.lockedCoins()}}),(n||this._respinsLeft<=0)&&(this._phase=`idle`,t.push({type:`feature:end`,payload:{coins:this.lockedCoins(),rounds:this._round,full:n}})),{effects:t,landed:[...e]}}abortWave(){this._phase===`spinning`&&(this._phase=`active`,this._waveLanded=[])}release(e){if(this._phase===`spinning`)throw Error(`HoldAndWinBoard: release() while a wave is in flight — await respin() first.`);let t=[],n=[];for(let r of e){let e=I(r),i=this._locked.get(e);i&&(this._locked.delete(e),n.push(i),t.push({type:`coin:released`,payload:{coin:i,remaining:this._locked.size}}))}return{effects:t,released:n}}activate(e){if(this._phase===`spinning`)throw Error(`HoldAndWinBoard: activate() while a wave is in flight — await respin() first.`);let t=[];for(let n of e){let e=I(n);this._assertInGrid(n,`activate`),this._inactive.has(e)&&(this._inactive.delete(e),t.push({reel:n.reel,cell:n.cell}))}return t.length===0?[]:[{type:`cells:activated`,payload:{cells:t,capacity:this.capacity}}]}swap(e,t,n){if(this._phase===`spinning`)throw Error(`HoldAndWinBoard: setSymbolAt() while a wave is in flight — await respin() first.`);let r=I(e),i=this._locked.get(r);if(!i)throw Error(`HoldAndWinBoard: setSymbolAt(${r}) on a non-locked cell — setSymbolAt rewrites a locked coin's identity.`);this._locked.set(r,this._freeze(e,t,n??i.data))}reset(){let e=this._locked.size;this._locked.clear(),this._inactive.clear();for(let e of this._initialInactive)this._inactive.add(e);return this._waveLanded=[],this._round=0,this._respinsLeft=0,this._phase=`idle`,[{type:`feature:reset`,payload:{clearedCoins:e}}]}_setRespins(e,t){return this._respinsLeft=Math.max(0,e),{type:`respins:changed`,payload:{value:this._respinsLeft,reason:t}}}_freeze(e,t,n){return{cell:Object.freeze({reel:e.reel,cell:e.cell}),id:t,data:n}}_assertInGrid(e,t){if(!this._cellSet.has(I(e)))throw Error(`HoldAndWinBoard: ${t}() targets cell ${I(e)} outside the grid.`)}_assertActive(e,t){if(this._assertInGrid(e,t),this._inactive.has(I(e)))throw Error(`HoldAndWinBoard: ${t}() targets inactive cell ${I(e)} — activate() it first.`)}},R=1100,z=class{events=new e.nt;cols;rows;_grid;_state;_emptyId;_inactiveId;_lockAnimation;_anticipateWhen;_stagger;_speeds=new Set;_speed;_tenseWave=!1;constructor(e){this.cols=e.cols,this.rows=e.rows,this._emptyId=e.emptyId,this._inactiveId=e.inactiveId,this._lockAnimation=e.lockAnimation,this._anticipateWhen=e.anticipateWhen,this._stagger=e.stagger,this._speed=e.initialSpeed;let t=[e.initialSpeed,...Object.keys(e.speeds).filter(t=>t!==e.initialSpeed)],n={};for(let r of t){let t=e.speeds[r];this._speeds.add(r),n[r]=e=>this._profileFor(r,t,e,!1),n[`${r}:tension`]=e=>this._profileFor(r,t,e,!0)}this._grid=new F({cols:e.cols,rows:e.rows,cellSize:{width:e.cellWidth,height:e.cellHeight},columnGap:e.columnGap,rowGap:e.rowGap,emptyId:e.emptyId,symbols:t=>{if(e.configurator(t),e.inactiveId!==e.emptyId&&!t.has(e.inactiveId))throw Error(`HoldAndWinBuilder: inactive(cells, '${e.inactiveId}') names a symbol id that .symbols(...) never registered.`)},weights:e.weights??void 0,symbolData:e.symbolData??void 0,chrome:e.chrome??void 0,mask:e.mask??void 0,orientation:e.orientation,direction:e.direction,ticker:e.ticker,rng:e.rng??void 0,profiles:n}),this._state=new L(this._grid.cells(),e.respins,e.inactive),this._dressInactive()}get container(){return this._grid.container}get capacity(){return this._state.capacity}get respinsLeft(){return this._state.respinsLeft}get lockedCoins(){return this._state.lockedCoins()}get isFull(){return this._state.isFull}get freeCells(){return this._state.freeCells()}get inactiveCells(){return this._state.inactiveCells()}get phase(){return this._state.phase}get speed(){return this._speed}get speedNames(){return[...this._speeds]}cellBounds(e){return this._grid.cellBounds(e)}cellCenter(e){return this._grid.cellCenter(e)}symbolAt(e){return this._grid.symbolAt(e)}reelAt(e){return this._grid.reelAt(e)}setSymbolAt(e,t,n){return this._state.swap(e,t,n),this._grid.place(e,t),this._grid.symbolAt(e)}enter(e){let t=this._state.enter(e);for(let t of e)this._grid.place(t.cell,t.id);this._apply(t)}async respin(e){let{round:t,spinning:n,hitByKey:r}=this._state.beginWave(e);try{let e=this._anticipating()&&n.length>0;this._tenseWave=e;let i=e?`${this._speed}:tension`:this._speed;for(let e of n)this._grid.setProfile(e,i);this.events.emit(`respin:start`,{round:t,respinsLeft:this._state.respinsLeft,spinning:n});let a=n.map(e=>({cell:e,id:r.get(I(e))?.id??this._emptyId}));await this._grid.spinCells(a,e=>{this._apply(this._state.land(e,r.get(I(e))??null))});let{effects:o,landed:s}=this._state.endWave();return this._apply(o),{round:t,hits:s,respinsLeft:this._state.respinsLeft,full:this._state.isFull,done:this._state.phase===`idle`}}catch(e){throw this._state.abortWave(),this._grid.skipSpinning(),e}}setSpeed(e){if(!this._speeds.has(e))throw Error(`HoldAndWinBoard: setSpeed('${e}') names no registered profile (have: ${[...this._speeds].join(`, `)}).`);let t=this._speed;this._speed=e;let n=this._state.phase===`spinning`&&this._tenseWave?`${e}:tension`:e;for(let e of this._grid.cells())this._grid.setProfile(e,n);this.events.emit(`speed:changed`,{name:e,previous:t})}addSpeed(e,t){for(let n of this._grid.cells()){let r=this._grid.reelAt(n).speed;r.addProfile(e,this._profileFor(e,t,n,!1)),r.addProfile(`${e}:tension`,this._profileFor(e,t,n,!0))}this._speeds.add(e)}async playWin(e){let t=e??this._state.lockedCoins().map(e=>e.cell);await Promise.all(t.map(e=>this._playOn(e,`win`)))}activate(e){let t=this._state.activate(e);for(let t of e)this._grid.place(t,this._emptyId);this._apply(t)}release(e){let{effects:t,released:n}=this._state.release(e);for(let e of n)this._grid.place(e.cell,this._emptyId);return this._apply(t),n}skip(){let e=this._grid.skipSpinning();return this.events.emit(`feature:skip`,{inFlight:e}),e}reset(){let e=this._state.reset();for(let e of this._grid.cells())this._grid.place(e,this._emptyId);this._dressInactive(),this._apply(e)}get isDestroyed(){return this._grid.isDestroyed}destroy(){this._grid.isDestroyed||(this.events.removeAllListeners(),this._grid.destroy())}_apply(e){for(let t of e)this.events.emit(t.type,t.payload),t.type===`coin:locked`&&this._lockAnimation!==`none`&&this._playOn(t.payload.coin.cell,this._lockAnimation)}_playOn(t,n){let r=this.symbolAt(t);return(n===`win`?r.playWin():r.playLanding()).catch(t=>e.k(`hw-coin-${n}-failed`,`HoldAndWinBoard: coin ${n} animation failed.`,t))}_profileFor(e,t,n,r){let i=(t.minimumSpinTime??320)+this._stagger(n.reel,n.cell,e);return{...t,minimumSpinTime:i+(r?R:0)}}_dressInactive(){for(let e of this._state.inactiveCells())this._grid.place(e,this._inactiveId)}_anticipating(){return this._anticipateWhen?this._anticipateWhen({locked:this._state.lockedCoins().length,capacity:this._state.capacity,respinsLeft:this._state.respinsLeft}):!1}},B=class{_cols=5;_rows=3;_cellWidth=72;_cellHeight=72;_columnGap=4;_rowGap=4;_emptyId=`empty`;_inactive=[];_inactiveId=null;_respins=3;_lockAnimation=`win`;_configurator=null;_weights=null;_symbolData=null;_speeds={normal:{...e.b.NORMAL,minimumSpinTime:320}};_initialSpeed=`normal`;_stagger=(e,t)=>(e+t)*70;_anticipateWhen=null;_chrome=null;_mask=null;_orientation=`vertical`;_direction=`forward`;_ticker=null;_rng=null;grid(e,t){return this._cols=e,this._rows=t,this}cellSize(e,t={}){return typeof e==`number`?(this._cellWidth=e,this._cellHeight=e):(this._cellWidth=e.width,this._cellHeight=e.height),t.gap!==void 0&&(this._columnGap=t.gap,this._rowGap=t.gap),t.columnGap!==void 0&&(this._columnGap=t.columnGap),t.rowGap!==void 0&&(this._rowGap=t.rowGap),this}symbols(e){return this._configurator=e,this}weights(e){return this._weights=e,this}emptyId(e){return this._emptyId=e,this}inactive(e,t){return this._inactive=e.map(e=>({reel:e.reel,cell:e.cell})),this._inactiveId=t??null,this}symbolData(e){return this._symbolData={...this._symbolData??{},...e},this}respins(e){return this._respins=e,this}lockAnimation(e){return this._lockAnimation=e,this}speedProfile(e){return this._speeds={...this._speeds,normal:e},this}speeds(e){return this._speeds={...this._speeds,...e},this}initialSpeed(e){return this._initialSpeed=e,this}stagger(e){return this._stagger=e,this}anticipateWhen(e){return this._anticipateWhen=e,this}cellChrome(e){return this._chrome=e,this}cellMask(e){return this._mask=e,this}axis(e,t=`forward`){return this._orientation=e,this._direction=t,this}ticker(e){return this._ticker=e,this}rng(e){return this._rng=e,this}build(){if(!this._configurator)throw Error(`HoldAndWinBuilder: .symbols(...) is required — register at least one coin id.`);if(!this._ticker)throw Error(`HoldAndWinBuilder: .ticker(...) is required.`);if(!(this._initialSpeed in this._speeds))throw Error(`HoldAndWinBuilder: initialSpeed('${this._initialSpeed}') names no registered profile - register it with .speeds({ ... }).`);return new z({cols:this._cols,rows:this._rows,cellWidth:this._cellWidth,cellHeight:this._cellHeight,columnGap:this._columnGap,rowGap:this._rowGap,emptyId:this._emptyId,inactive:this._inactive,inactiveId:this._inactiveId??this._emptyId,respins:this._respins,lockAnimation:this._lockAnimation,configurator:this._configurator,weights:this._weights,symbolData:this._symbolData,speeds:this._speeds,initialSpeed:this._initialSpeed,stagger:this._stagger,anticipateWhen:this._anticipateWhen,chrome:this._chrome,mask:this._mask,orientation:this._orientation,direction:this._direction,ticker:this._ticker,rng:this._rng})}};function V(e){return[...e].sort((e,t)=>(t.value??0)-(e.value??0))}var H=class e{_reelSet;_options;_abort=null;_isActive=!1;_isDestroyed=!1;constructor(t,n={}){this._reelSet=t,this._options=e._resolve(n)}get isActive(){return this._isActive}get isDestroyed(){return this._isDestroyed}async show(e){if(this.abort(),this._isDestroyed||e.length===0)return;let t=this._options.sortByValue?V(e):[...e],n=new AbortController;this._abort=n,this._isActive=!0,this._reelSet.events.emit(`win:start`,t);let r=0;try{for(;this._options.cycles===-1||r<this._options.cycles;){for(let e of t){if(n.signal.aborted||(await this._showOne(e,n.signal),n.signal.aborted))return;await this._wait(this._options.cycleGap,n.signal)}r++}}finally{this._restoreAlpha();let e=n.signal.aborted;this._abort===n&&(this._abort=null),this._isActive=!1,this._reelSet.events.emit(`win:end`,e?`aborted`:`complete`)}}abort(){this._abort&&this._abort.abort()}destroy(){this._isDestroyed||(this._isDestroyed=!0,this.abort())}async _showOne(e,t){let n=[...e.cells];if(n.length===0)return;this._applyDim(n),this._reelSet.events.emit(`win:group`,e,n);let r=this._options.stagger,i=[];for(let a=0;a<n.length&&!(t.aborted||(a>0&&r>0&&await this._wait(r,t),t.aborted));a++){let t=n[a],r=this._reelSet.getReel(t.reelIndex);if(!r)continue;let o=r.getSymbolAt(t.cellIndex);o&&(this._reelSet.events.emit(`win:symbol`,o,t,e),i.push(this._playAnim(o,t,e)))}await Promise.all(i)}async _playAnim(e,t,n){let r=this._options.symbolAnim;if(typeof r==`function`)return r(e,t,n);if(r===`win`)return e.playWin();let i=e;return typeof i.playAnimation==`function`?i.playAnimation(r):e.playWin()}_applyDim(e){let t=this._options.dimAlpha;if(t===null)return;let n=new Set;for(let t of e)n.add(`${t.reelIndex}:${t.cellIndex}`);let r=this._reelSet.reels;for(let e=0;e<r.length;e++){let i=r[e];for(let r=0;r<i.visibleCells;r++){let a=i.getSymbolAt(r).view;a.alpha=n.has(`${e}:${r}`)?1:t}}}_restoreAlpha(){let e=this._reelSet.reels;for(let t of e)for(let e=0;e<t.visibleCells;e++)t.getSymbolAt(e).view.alpha=1}_wait(e,t){return new Promise(n=>{if(t.aborted)return n();let r=setTimeout(n,e);t.addEventListener(`abort`,()=>{clearTimeout(r),n()},{once:!0})})}static _resolve(e){let t;return t=e.dimLosers===!1?null:typeof e.dimLosers==`object`&&e.dimLosers!==null?e.dimLosers.alpha??.35:.35,{dimAlpha:t,symbolAnim:e.symbolAnim??`win`,stagger:Math.max(0,e.stagger??0),cycleGap:e.cycleGap??400,cycles:e.cycles??1,sortByValue:e.sortByValue??!0}}};function U(e,n=t.n){let r=n;r.ticker.remove(r.updateRoot);let i=()=>{r.updateRoot(e.lastTime/1e3)};e.add(i);let a=!1;return()=>{a||(a=!0,e.remove(i),r.ticker.add(r.updateRoot))}}exports.AdjustPhase=e.d,exports.AnimatedSpriteSymbol=S,exports.AnticipationPhase=e.D,exports.BoardGrid=F,exports.CARD_DECK=O,exports.CURVE_FOCUS_WEIGHT=e.Z,exports.CardSymbol=D,exports.CascadeDropInPhase=e.f,exports.CascadeFallPhase=e.h,exports.CascadeMode=j,exports.CascadePlacePhase=e.p,exports.DEFAULTS=e.x,exports.DRIVE_FRAME_MS=e.V,exports.EmptySymbol=C,exports.EventEmitter=e.nt,exports.FrameBuilder=e._,exports.HoldAndWinBoard=z,exports.HoldAndWinBuilder=B,exports.HoldAndWinState=L,exports.ImmediateMode=M,exports.MASK_STRATEGY_VERSION=e.I,exports.OVERLAY_LABEL=e.c,exports.ObjectPool=e.v,exports.PathMaskStrategy=f,exports.PerspectiveCell=b,exports.PhaseFactory=e.E,exports.RectMaskStrategy=e.L,exports.Reel=e.B,exports.ReelCurve=e.Q,exports.ReelPhase=e.F,exports.ReelSet=e.S,exports.ReelSetBuilder=e.u,exports.ReelSymbol=t.t,exports.ReelViewport=e.R,exports.ReelWarp=e.Y,exports.RoundedRectMaskStrategy=l,exports.SharedRectMaskStrategy=e.z,exports.SilhouetteMaskStrategy=d,exports.SpeedManager=e.T,exports.SpeedPresets=e.b,exports.SpinPhase=e.N,exports.SpinTextureCache=w,exports.SpineSymbol=n.t,exports.SpriteSymbol=x,exports.StandardMode=e.W,exports.StartPhase=e.P,exports.StaticSpinSymbol=E,exports.StopPhase=e.M,exports.SymbolRegistry=e.y,exports.SymbolSpotlight=e.w,exports.TickerRef=e.X,exports.VERTICAL_FORWARD=e.et,exports.WILD_CARD=k,exports.WinPresenter=H,exports.anticipationForScatters=A,exports.canProjectTexture=v,exports.cellKey=I,exports.clearFrames=e.t,exports.cloneColumnTarget=e.G,exports.columnTargetToStrip=e.K,exports.composeMasks=m,exports.computeDropOffsets=e.m,exports.debugGrid=e.n,exports.debugOverlay=e.l,exports.debugSnapshot=e.r,exports.driveGsapWithTicker=U,exports.enableDebug=e.i,exports.getFrames=e.a,exports.getLogLevel=e.O,exports.getTargetSlot=e.q,exports.inset=p,exports.isDrawableMaskStrategy=i,exports.pinKey=e.C,exports.prewarmSpinTextures=T,exports.reelAxis=e.tt,exports.resolveCurveConfig=e.$,exports.resolveDriveConfig=e.H,exports.resolveTumbleConfig=e.g,exports.setLogLevel=e.j,exports.setTargetSlot=e.J,exports.sortByValueDesc=V,exports.startRecording=e.o,exports.stepDrive=e.U,exports.stopRecording=e.s,exports.textureCellInset=_,exports.whenSpineReady=n.n;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./debug-DkAoLN21.cjs`),t=require(`./ReelSymbol-DjJzuBhn.cjs`),n=require(`./SpineSymbol-Dq3IAu_k.cjs`);let r=require(`pixi.js`);function i(e){return typeof e.draw==`function`}var a={color:16777215};function o(e){return e.origin??{x:0,y:0}}function s(e){return e.axis.toScreen(e.bleed??0,0)}function c(e){let t=o(e);if(e.rects.length===0)return{x:t.x,y:t.y,width:e.width,height:e.height};let n=1/0,r=1/0,i=-1/0,a=-1/0;for(let t of e.rects)t.x<n&&(n=t.x),t.y<r&&(r=t.y),t.x+t.width>i&&(i=t.x+t.width),t.y+t.height>a&&(a=t.y+t.height);return{x:t.x+n,y:t.y+r,width:i-n,height:a-r}}var l={topLeft:!0,topRight:!0,bottomLeft:!0,bottomRight:!0};function u(e){if(e===void 0)return l;if(typeof e!=`object`||!e)throw Error(`RoundedRectMaskStrategy: corners must be an object like { topLeft: true }, got ${String(e)}.`);return{topLeft:e.topLeft===!0,topRight:e.topRight===!0,bottomLeft:e.bottomLeft===!0,bottomRight:e.bottomRight===!0}}var d=.5;function f(e,t,n){let r=Math.abs(e.x-t.x)<d,i=Math.abs(e.y-t.y)<d,a=Math.abs(e.x+e.width-(t.x+t.width))<d,o=Math.abs(e.y+e.height-(t.y+t.height))<d;return{topLeft:n.topLeft&&r&&i,topRight:n.topRight&&a&&i,bottomLeft:n.bottomLeft&&r&&o,bottomRight:n.bottomRight&&a&&o}}function p(e,t,n,r,i,o,s){let{topLeft:c,topRight:l,bottomLeft:u,bottomRight:d}=s;if(c&&l&&u&&d){e.roundRect(t,n,r,i,o).fill(a);return}if(!c&&!l&&!u&&!d){e.rect(t,n,r,i).fill(a);return}e.roundShape([{x:t,y:n,radius:c?o:0},{x:t+r,y:n,radius:l?o:0},{x:t+r,y:n+i,radius:d?o:0},{x:t,y:n+i,radius:u?o:0}],o).fill(a)}var m=class{version=2;_radius;_scope;_corners;constructor(e){if(!Number.isFinite(e?.radius)||e.radius<0)throw Error(`RoundedRectMaskStrategy: radius must be a non-negative number, got ${String(e?.radius)}.`);this._radius=e.radius,this._scope=e.scope??`set`,this._corners=u(e.corners)}build(e){let t=new r.Graphics;return this.draw(t,e),t}update(e,t){e.clear(),this.draw(e,t)}draw(e,t){let n=s(t),r=o(t);if(this._scope===`set`||t.rects.length===0){let r=c(t);p(e,r.x-n.x,r.y-n.y,r.width+n.x*2,r.height+n.y*2,this._radius,this._corners);return}this._scope===`reel`&&this._warnIfTouching(t);let i=this._scope===`outer`?c(t):null;for(let a of t.rects){let t={x:r.x+a.x,y:r.y+a.y,width:a.width,height:a.height},o=i?f(t,i,this._corners):this._corners;p(e,t.x-n.x,t.y-n.y,a.width+n.x*2,a.height+n.y*2,this._radius,o)}}_warnIfTouching(t){if(t.rects.length<2)return;let n=t.axis.crossProp,r=n===`x`?`width`:`height`;for(let i=1;i<t.rects.length;i++){let a=t.rects[i-1],o=t.rects[i][n]-(a[n]+a[r]);if(Math.abs(o)<.5){e.A(`mask-rounded-touching`,`RoundedRectMaskStrategy: scope 'reel' with a zero cross gap rounds both sides of every shared reel edge, which notches the seams. Add a cross gap (symbolGap.x on a vertical set), use scope 'set', or use SilhouetteMaskStrategy.`);return}}}},h=.5,g=class{version=2;_radius;_concaveRadius;_fallback;constructor(e){if(!Number.isFinite(e?.radius)||e.radius<0)throw Error(`SilhouetteMaskStrategy: radius must be a non-negative number, got ${String(e?.radius)}.`);let t=e.concaveRadius??e.radius;if(!Number.isFinite(t)||t<0)throw Error(`SilhouetteMaskStrategy: concaveRadius must be a non-negative number, got ${String(t)}.`);this._radius=e.radius,this._concaveRadius=t,this._fallback=new m({radius:e.radius,scope:`reel`})}build(e){let t=new r.Graphics;return this.draw(t,e),t}update(e,t){e.clear(),this.draw(e,t)}draw(t,n){let r=this._spans(n);if(r.length===0){let e=c(n),r=s(n);t.roundRect(e.x-r.x,e.y-r.y,e.width+r.x*2,e.height+r.y*2,this._radius).fill(a);return}if(!this._isContiguous(r)){e.A(`mask-silhouette-disjoint`,`SilhouetteMaskStrategy: reels have a non-zero cross gap, so their union is not one outline. Falling back to per-reel rounded rects. Drop the cross gap to use the silhouette.`),this._fallback.draw(t,n);return}let i=this._ring(r);if(i.length<3){let e=c(n);t.rect(e.x,e.y,e.width,e.height).fill(a);return}this._assignRadii(i);let l=o(n),u=i.map(e=>{let t=n.axis.toScreen(e.c,e.m);return{x:l.x+t.x,y:l.y+t.y,radius:e.radius}});t.roundShape(u,this._radius).fill(a)}_spans(e){let t=e.axis,n=[];for(let r of e.rects){let e=t.toLocal(r.x,r.y),i=t.toLocal(r.width,r.height);i.cross<=0||i.main<=0||n.push({c0:e.cross,c1:e.cross+i.cross,m0:e.main,m1:e.main+i.main})}n.sort((e,t)=>e.c0-t.c0);let r=e.bleed??0;return n.length>0&&r!==0&&(n[0].c0-=r,n[n.length-1].c1+=r),n}_isContiguous(e){for(let t=1;t<e.length;t++)if(Math.abs(e[t].c0-e[t-1].c1)>h)return!1;return!0}_ring(e){let t=[],n=(e,n)=>{let r=t[t.length-1];r&&Math.abs(r.c-e)<h&&Math.abs(r.m-n)<h||t.push({c:e,m:n})},r=e[0],i=e[e.length-1];n(r.c0,r.m0);for(let t=1;t<e.length;t++)Math.abs(e[t].m0-e[t-1].m0)>h&&(n(e[t].c0,e[t-1].m0),n(e[t].c0,e[t].m0));n(i.c1,i.m0),n(i.c1,i.m1);for(let t=e.length-1;t>=1;t--)Math.abs(e[t].m1-e[t-1].m1)>h&&(n(e[t].c0,e[t].m1),n(e[t].c0,e[t-1].m1));for(n(r.c0,r.m1);t.length>1&&Math.abs(t[t.length-1].c-t[0].c)<h&&Math.abs(t[t.length-1].m-t[0].m)<h;)t.pop();return t.map(e=>({c:e.c,m:e.m,radius:this._radius}))}_assignRadii(e){let t=0;for(let n=0;n<e.length;n++){let r=e[n],i=e[(n+1)%e.length];t+=r.c*i.m-i.c*r.m}let n=t>=0?1:-1;for(let t=0;t<e.length;t++){let r=e[(t-1+e.length)%e.length],i=e[t],a=e[(t+1)%e.length];i.radius=((i.c-r.c)*(a.m-i.m)-(i.m-r.m)*(a.c-i.c))*n>=0?this._radius:this._concaveRadius}}},_=class{version=2;constructor(e){if(this._path=e,typeof e!=`function`)throw Error(`PathMaskStrategy: expected a (graphics, context) => void function.`)}build(e){let t=new r.Graphics;return this.draw(t,e),t}update(e,t){e.clear(),this.draw(e,t)}draw(e,t){this._path(e,t)}};function v(e,t){if(!Number.isFinite(t))throw Error(`inset(): expected a finite number of pixels, got ${String(t)}.`);let n=e=>{let n=o(e),r=e.axis.mainProp===`y`,i=(e.bleed??0)-t,a=e=>e-t*2;return{rects:e.rects.map(e=>({x:e.x,y:e.y,width:r?e.width:a(e.width),height:r?a(e.height):e.height})),width:r?e.width:a(e.width),height:r?a(e.height):e.height,axis:e.axis,bleed:i,origin:r?{x:n.x,y:n.y+t}:{x:n.x+t,y:n.y}}};return{version:2,build:t=>e.build(n(t)),update:(t,r)=>e.update(t,n(r)),draw:(t,r)=>x(e,t,n(r))}}function y(...e){if(e.length===0)throw Error(`composeMasks(): expected at least one strategy.`);let t=(t,n)=>{for(let r of e)x(r,t,n)};return{version:2,build(e){let n=new r.Graphics;return t(n,e),n},update(e,n){e.clear(),t(e,n)},draw:t}}var b=new WeakMap;function x(e,t,n){if(i(e)){e.draw(t,n);return}let r=b.get(t),a=r?.get(e);if(a&&a.parent===t){e.update(a,n);return}let o=e.build(n);r||(r=new Map,b.set(t,r)),r.set(e,o),t.addChild(o)}function S(e){let t=e.trim,n=e.orig;return!t||n.width<=0||n.height<=0||t.width===n.width&&t.height===n.height?null:{left:t.x/n.width,top:t.y/n.height,right:(t.x+t.width)/n.width,bottom:(t.y+t.height)/n.height}}function C(e){let t=e.source;if(!t||e.rotate!==0)return!1;let{frame:n,orig:r}=e;return n.x!==0||n.y!==0||n.width!==t.width||n.height!==t.height?!1:r.width===n.width&&r.height===n.height}var w=10,T=class{_mesh=null;_active=!1;_uvScratch=null;_uvSource=null;constructor(e,t){this._view=e,this._flat=t}get isActive(){return this._active}get mesh(){return this._mesh}apply(e,t){if(e===null||!C(t))return this._active?(this._active=!1,this._flat.visible=!0,this._mesh&&(this._mesh.visible=!1),!1):!1;let n=this._ensureMesh(t);n.texture!==t&&(n.texture=t),this._syncUvs(n,t),n.setCorners(e.x0,e.y0,e.x1,e.y1,e.x2,e.y2,e.x3,e.y3);let r=(e.x0+e.x1+e.x2+e.x3)/4,i=(e.y0+e.y1+e.y2+e.y3)/4;return n.pivot.set(r,i),n.position.set(r,i),this._active||(this._active=!0,this._flat.visible=!1,n.visible=!0),!0}resetTransform(){this._mesh&&this._mesh.scale.set(1,1)}syncTexture(e){this._active&&this._mesh&&this._mesh.texture!==e&&(this._mesh.texture=e,this._syncUvs(this._mesh,e))}destroy(){this._mesh&&(this._mesh.destroy(),this._mesh=null,this._active=!1,this._uvScratch=null,this._uvSource=null)}_ensureMesh(e){return this._mesh?this._mesh:(this._mesh=new r.PerspectiveMesh({texture:e,verticesX:w,verticesY:w}),this._uvScratch=new Float32Array(w*w*2),this._view.addChild(this._mesh),this._mesh)}_syncUvs(e,t){if(this._uvSource===t)return;let n=this._uvScratch;if(!n)return;this._uvSource=t;let{x0:r,y0:i,x1:a,y1:o,x2:s,y2:c,x3:l,y3:u}=t.uvs,d=w-1;for(let e=0;e<n.length/2;e++){let t=e%w/d,f=Math.floor(e/w)/d,p=(1-t)*(1-f),m=t*(1-f),h=t*f,g=(1-t)*f;n[e*2]=p*r+m*a+h*s+g*l,n[e*2+1]=p*i+m*o+h*c+g*u}e.geometry.uvs=n}},E=class extends t.t{_sprite;_textures;_winTween=null;_perspective;constructor(e){super(),this._textures=e.textures;let t=e.anchor??{x:0,y:0};this._sprite=new r.Sprite,this._sprite.anchor.set(t.x,t.y),this.view.addChild(this._sprite),this._perspective=new T(this.view,this._sprite)}onActivate(e){let t=this._textures[e];t&&(this._sprite.texture=t,this._perspective.syncTexture(t))}onDeactivate(){this._killWinTween(),this._sprite.scale.set(1,1),this._perspective.resetTransform()}get cellInset(){return S(this._sprite.texture)}applyCellQuad(e){if(this._perspective.apply(e,this._sprite.texture)){this.view.scale.set(1,1),this.view.pivot.set(0,0);return}super.applyCellQuad(e)}async playWin(){this._killWinTween();let e=this._perspective.isActive?this._perspective.mesh:this._sprite;if(e)return new Promise(t=>{this._winTween=this.gsap.to(e.scale,{x:1.15,y:1.15,duration:.15,yoyo:!0,repeat:1,ease:`power2.inOut`,onComplete:t})})}stopAnimation(){this._killWinTween(),this._sprite.scale.set(1,1),this._perspective.resetTransform()}resize(e,t){this._sprite.width=e,this._sprite.height=t}onDestroy(){this._killWinTween(),this._perspective.destroy()}_killWinTween(){this._winTween&&=(this._winTween.kill(),null)}},D=class extends t.t{_animSprite;_frames;_animationSpeed;_winResolve=null;_perspective;constructor(e){super(),this._frames=e.frames,this._animationSpeed=e.animationSpeed??1;let t=e.anchor??{x:0,y:0},n=Object.values(this._frames)[0]??[];this._animSprite=new r.AnimatedSprite(n.length>0?n:[]),this._animSprite.anchor.set(t.x,t.y),this._animSprite.animationSpeed=this._animationSpeed,this._animSprite.loop=!1,this.view.addChild(this._animSprite),this._perspective=new T(this.view,this._animSprite),this._animSprite.onFrameChange=()=>{this._perspective.syncTexture(this._animSprite.texture)}}get cellInset(){return S(this._animSprite.texture)}applyCellQuad(e){if(this._perspective.apply(e,this._animSprite.texture)){this.view.scale.set(1,1),this.view.pivot.set(0,0);return}super.applyCellQuad(e)}onActivate(e){let t=this._frames[e];t&&t.length>0&&(this._animSprite.textures=t,this._animSprite.gotoAndStop(0))}onDeactivate(){this._animSprite.stop(),this._winResolve=null}async playWin(){return new Promise(e=>{this._winResolve=e,this._animSprite.loop=!1,this._animSprite.onComplete=()=>{this._winResolve=null,this._animSprite.onComplete=void 0,this._animSprite.gotoAndStop(0),e()},this._animSprite.gotoAndPlay(0)})}stopAnimation(){this._animSprite.stop(),this._animSprite.gotoAndStop(0),this._winResolve&&=(this._winResolve(),null)}resize(e,t){this._animSprite.width=e,this._animSprite.height=t,this._animSprite.x=e*this._animSprite.anchor.x,this._animSprite.y=t*this._animSprite.anchor.y}onDestroy(){this._animSprite.onFrameChange=void 0,this._perspective.destroy()}},O=class extends t.t{onActivate(e){}onDeactivate(){}async playWin(){}stopAnimation(){}resize(e,t){}},k=class{_renderer;_resolution;_blurDefaults;_static=new Map;_blurred=new Map;_isDestroyed=!1;constructor(e){this._renderer=e.renderer,this._resolution=e.resolution,this._blurDefaults=e.blur??{}}setStatic(e,t){this._put(this._static,e,{texture:t,owned:!1,width:0,height:0})}setBlurred(e,t){this._put(this._blurred,e,{texture:t,owned:!1,width:0,height:0})}getStatic(e){return this._static.get(e)?.texture??null}getBlurred(e){return this._blurred.get(e)?.texture??null}hasStatic(e){return this._static.has(e)}hasBlurred(e){return this._blurred.has(e)}captureStatic(e,t,n,i){let a=this._static.get(e);if(a&&(!a.owned||a.width===n&&a.height===i))return a.texture;let o=this._renderer.generateTexture({target:t,frame:new r.Rectangle(0,0,n,i),resolution:this._resolution,antialias:!0});return this._put(this._static,e,{texture:o,owned:!0,width:n,height:i}),o}captureBlurred(e,t,n,i){let a=i?.axis??this._blurDefaults.axis??`y`,o=this._blurred.get(e);if(o&&(!o.owned||o.width===t&&o.height===n&&o.axis===a))return o.texture;let s=this.getStatic(e);if(!s)throw Error(`SpinTextureCache.captureBlurred('${e}'): no static texture to blur. Call captureStatic() or setStatic() for this symbolId first.`);let c=i?.strength??this._blurDefaults.strength??(a===`y`?n:t)*.2,l=i?.quality??this._blurDefaults.quality??4,u=i?.padding??this._blurDefaults.padding??Math.ceil(c),d=new r.Container,f=new r.Sprite(s);f.width=t,f.height=n,a===`y`?(f.y=u,f.filters=[new r.BlurFilter({strengthX:0,strengthY:c,quality:l})]):(f.x=u,f.filters=[new r.BlurFilter({strengthX:c,strengthY:0,quality:l})]),d.addChild(f);let p=this._renderer.generateTexture({target:d,frame:new r.Rectangle(0,0,t+(a===`x`?u*2:0),n+(a===`y`?u*2:0)),resolution:this._resolution,antialias:!0});return d.destroy({children:!0}),this._put(this._blurred,e,{texture:p,owned:!0,width:t,height:n,axis:a}),p}invalidate(e){this._drop(this._static,e),this._drop(this._blurred,e)}clear(){for(let e of[...this._static.keys()])this._drop(this._static,e);for(let e of[...this._blurred.keys()])this._drop(this._blurred,e)}destroy(){this._isDestroyed||=(this.clear(),!0)}get isDestroyed(){return this._isDestroyed}_put(e,t,n){this._drop(e,t),e.set(t,n)}_drop(e,t){let n=e.get(t);n?.owned&&n.texture.destroy(!0),e.delete(t)}};function A(e){let{cache:t,ids:n,width:r,height:i}=e,a=e.blurred??!0,o=e.createSymbol();try{for(let s of n)o.symbolId!==s&&o.activate(s),o.resize(r,i),t.captureStatic(s,o.view,r,i),a&&t.captureBlurred(s,r,i,e.blur)}finally{o.destroy()}}var j=class extends t.t{_inner;_cache;_mode;_rampMs;_blurOpts;_staticSprite;_blurSprite;_spinning=!1;_anticipating=!1;_cellW=0;_cellH=0;_rampTween=null;constructor(e){super(),this._inner=e.createInner(),this._cache=e.cache,this._mode=e.spinTexture??`blurred`,this._rampMs=e.blurRampMs??120,this._blurOpts=e.blur,this.view.addChild(this._inner.view),this._staticSprite=new r.Sprite,this._staticSprite.anchor.set(.5,.5),this._staticSprite.visible=!1,this._blurSprite=new r.Sprite,this._blurSprite.anchor.set(.5,.5),this._blurSprite.visible=!1,this.view.addChild(this._staticSprite,this._blurSprite)}get inner(){return this._inner}get isShowingSnapshot(){return this._spinning}onActivate(e){if(this._spinning){this._showSnapshot(e,{instant:!0});return}this._inner.symbolId!==e&&this._inner.activate(e),this._hideSnapshot()}onDeactivate(){this._killRamp(),this._spinning=!1,this._anticipating=!1,this._staticSprite.visible=!1,this._blurSprite.visible=!1,this._inner.symbolId!==``&&this._inner.deactivate()}onReelSpinStart(e=!1){if(this._spinning){this._showSnapshot(this.symbolId,{instant:!0});return}this._spinning=!0,this._anticipating=!1,this._showSnapshot(this.symbolId,{instant:e||this._rampMs<=0}),this._inner.symbolId!==``&&this._inner.deactivate()}onReelAnticipationStart(){if(!(!this._spinning||this._anticipating)&&(this._anticipating=!0,this._mode!==`static`)){if(this._killRamp(),this._staticSprite.visible=!0,this._staticSprite.alpha=1,!this._blurSprite.visible||this._rampMs<=0){this._blurSprite.visible=!1;return}this._rampTween=this.gsap.to(this._blurSprite,{alpha:0,duration:this._rampMs/1e3,ease:`power1.out`,onComplete:()=>{this._rampTween=null,this._blurSprite.visible=!1}})}}onReelSpinEnd(){this._spinning&&(this._spinning=!1,this._anticipating=!1,this._killRamp(),this._staticSprite.visible=!1,this._blurSprite.visible=!1,this._inner.symbolId!==this.symbolId&&(this._inner.activate(this.symbolId),this._inner.resize(this._cellW,this._cellH)))}onReelLanded(){this._spinning||this._inner.onReelLanded()}async playWin(){return this._inner.playWin()}stopAnimation(){this._inner.symbolId!==``&&this._inner.stopAnimation()}async playDestroy(e){return!this._spinning&&this._inner.symbolId!==``?this._inner.playDestroy(e):super.playDestroy(e)}resize(e,t){this._cellW=e,this._cellH=t,this._staticSprite.position.set(e/2,t/2),this._blurSprite.position.set(e/2,t/2),this._fitSprites(),this._inner.resize(e,t)}onDestroy(){this._killRamp(),this._inner.view.parent===this.view&&this.view.removeChild(this._inner.view),this._inner.destroy()}_showSnapshot(e,t){let n=this._ensureStatic(e);if(this._staticSprite.texture=n,this._mode===`blurred`&&(this._blurSprite.texture=this._cache.captureBlurred(e,this._cellW,this._cellH,this._resolvedBlur())),this._fitSprites(),this._mode===`static`){this._staticSprite.visible=!0,this._staticSprite.alpha=1;return}if(t.instant){if(this._anticipating){this._killRamp(),this._blurSprite.visible=!1,this._staticSprite.visible=!0,this._staticSprite.alpha=1;return}if(this._rampTween)return;this._staticSprite.visible=!1,this._blurSprite.visible=!0,this._blurSprite.alpha=1;return}this._killRamp(),this._staticSprite.visible=!0,this._staticSprite.alpha=1,this._blurSprite.visible=!0,this._blurSprite.alpha=0,this._rampTween=this.gsap.to(this._blurSprite,{alpha:1,duration:this._rampMs/1e3,ease:`power1.in`,onComplete:()=>{this._rampTween=null,this._staticSprite.visible=!1}})}_ensureStatic(e){let t=this._cache.getStatic(e);if(t)return t;let n=this._inner.symbolId!==e;n&&(this._inner.activate(e),this._inner.resize(this._cellW,this._cellH));let r=this._cache.captureStatic(e,this._inner.view,this._cellW,this._cellH);return n&&this._spinning&&this._inner.deactivate(),r}_hideSnapshot(){this._killRamp(),this._staticSprite.visible=!1,this._blurSprite.visible=!1}_fitSprites(){if(this._cellW<=0||this._cellH<=0)return;let e=this._resolvedBlur().axis===`x`;for(let t of[this._staticSprite,this._blurSprite]){let n=t.texture.width,r=t.texture.height;n<=0||r<=0||t.scale.set(e?this._cellH/r:this._cellW/n)}}_resolvedBlur(){return{...this._blurOpts,axis:this._blurOpts?.axis??this.mainAxis}}_killRamp(){this._rampTween&&=(this._rampTween.kill(),null)}},M=class extends t.t{_color;_label;_textColor;_gfx;_text;constructor(e){super(),this._color=e.color,this._label=e.label,this._textColor=e.textColor??16777215,this._gfx=new r.Graphics,this._text=new r.Text({text:this._label,style:{fontFamily:`"Roboto Condensed", "Arial Narrow", "Helvetica Neue Condensed", "Liberation Sans Narrow", system-ui, sans-serif`,fontSize:32,fontWeight:`700`,fill:this._textColor,align:`center`}}),this._text.anchor.set(.5),this.view.addChild(this._gfx),this.view.addChild(this._text)}onActivate(e){}onDeactivate(){}async playWin(){return new Promise(e=>{this.gsap.killTweensOf(this._text),this.gsap.killTweensOf(this._text.scale);let t=this._textColor;this.gsap.timeline({onComplete:()=>{this._text.scale.set(1,1),this._text.rotation=0,this._text.style.fill=t,e()}}).to(this._text.scale,{x:1.4,y:1.4,duration:.18,ease:`back.out(2)`},0).to(this._text,{rotation:-.12,duration:.09,ease:`sine.inOut`},0).to(this._text,{rotation:.12,duration:.18,ease:`sine.inOut`},.09).to(this._text,{rotation:0,duration:.09,ease:`sine.inOut`},.27).to(this._text.scale,{x:1,y:1,duration:.18,ease:`power2.out`},.32),this.gsap.delayedCall(.06,()=>this._text.style.fill=16769384),this.gsap.delayedCall(.42,()=>this._text.style.fill=t)})}stopAnimation(){this.gsap.killTweensOf(this._text),this.gsap.killTweensOf(this._text.scale),this._text.scale.set(1,1),this._text.rotation=0,this._text.style.fill=this._textColor,this._gfx.alpha=1}resize(e,t){this._gfx.clear(),this._gfx.rect(0,0,e,t).fill({color:this._color}),this._gfx.rect(1,1,e-2,t-2).stroke({color:0,width:2,alpha:.25}),this._text.x=e/2,this._text.y=t/2;let n=Math.max(1,this._label.length),r=t*.38,i=e*.7/(n*.45);this._text.style.fontSize=Math.max(7,Math.floor(Math.min(r,i)))}},N=[{id:`7`,color:12597547,label:`7`},{id:`8`,color:15105570,label:`8`},{id:`9`,color:15844367,label:`9`},{id:`10`,color:2600544,label:`10`},{id:`J`,color:1482885,label:`J`},{id:`Q`,color:2719929,label:`Q`},{id:`K`,color:9323693,label:`K`},{id:`A`,color:2899536,label:`A`}],P={id:`wild`,color:16774048,label:`WILD`,textColor:7033856};function F(e,t){let n=t.trigger??2,r=t.mode??`all-remaining`,i=e.map(e=>e.visible.filter(e=>e===t.symbol).length),a=0,o=-1;for(let e=0;e<i.length;e++)if(a+=i[e],a>=n){o=e;break}if(o===-1)return[];let s=[];for(let t=o+1;t<e.length;t++)(r===`all-remaining`||i[t]>0)&&s.push(t);return s}var I=class{name=`cascade`;_gravity;constructor(e=1.5){this._gravity=e}computeDelta(e,t,n){let r=e*t*this._gravity*n/1e3;return Math.min(r,e)}},L=class{name=`immediate`;computeDelta(e,t,n){return 0}};function R(e,t,n){let r=e.reel===0,i=e.reel===t-1,a=e.cell===0,o=e.cell===n-1;return{topLeft:r&&a,topRight:i&&a,bottomLeft:r&&o,bottomRight:i&&o}}var z=e=>`${e.reel},${e.cell}`,B=`default`,V=class{container;cols;rows;cellWidth;cellHeight;columnGap;rowGap;emptyId;_reels=new Map;_cells=[];_lifted;_destroyed=!1;constructor(t){if(!t.ticker)throw Error(`BoardGrid: a ticker is required.`);this.cols=t.cols,this.rows=t.rows;let n=typeof t.cellSize==`number`?{width:t.cellSize,height:t.cellSize}:t.cellSize;this.cellWidth=n.width,this.cellHeight=n.height;let i=t.gap??4;this.columnGap=t.columnGap??i,this.rowGap=t.rowGap??i,this.emptyId=t.emptyId??`empty`,this.container=new r.Container;let a=t.profiles&&Object.keys(t.profiles).length>0?t.profiles:{[B]:{...e.b.NORMAL,minimumSpinTime:320}},o=Object.keys(a),s=(e,t)=>typeof e==`function`?e(t):e;for(let e=0;e<t.cols;e++)for(let n=0;n<t.rows;n++){let i={reel:e,cell:n},a=this._origin(i);if(t.chrome){let e=new r.Graphics;t.chrome(e,this.cellWidth,this.cellHeight),e.position.set(a.x,a.y),this.container.addChild(e)}}for(let n=0;n<t.cols;n++)for(let r=0;r<t.rows;r++){let i={reel:n,cell:r},c=this._origin(i),l=new e.u().reels(1).visibleCells(1).symbolSize(this.cellWidth,this.cellHeight).symbolGap(0,0).maskStrategy(t.mask?t.mask(i,{cols:t.cols,rows:t.rows,corners:R(i,t.cols,t.rows)}):new e.z).symbols(e=>{t.symbols(e),e.has(this.emptyId)||e.register(this.emptyId,O,{})}).initialFrame([{visible:[this.emptyId],bufferStart:[this.emptyId],bufferEnd:[this.emptyId]}]).ticker(t.ticker).orientation(t.orientation??`vertical`).direction(t.direction??`forward`).initialSpeed(o[0]);for(let[e,t]of Object.entries(a))l.speed(e,s(t,i));t.weights&&l.weights(t.weights),t.symbolData&&l.symbolData(t.symbolData),t.rng&&l.rng(t.rng);let u=l.build();u.position.set(c.x,c.y),this.container.addChild(u),this._reels.set(z(i),u),this._cells.push(i)}this._lifted=new r.RenderLayer,this.container.addChild(this._lifted);for(let e of this._reels.values())this._lifted.attach(e.viewport.unmaskedContainer)}get cellSize(){return this.cellWidth}get gap(){return this.columnGap}cells(){return this._cells.map(e=>({reel:e.reel,cell:e.cell}))}cellBounds(e){let t=this._origin(e);return{x:t.x,y:t.y,width:this.cellWidth,height:this.cellHeight}}cellCenter(e){let t=this._origin(e);return{x:t.x+this.cellWidth/2,y:t.y+this.cellHeight/2}}symbolAt(e){return this._reel(e).getReel(0).getSymbolAt(0)}reelAt(e){return this._reel(e)}setProfile(e,t){this._reel(e).speed.set(t)}place(e,t){this._reel(e).getReel(0).placeSymbols({visible:[t],bufferStart:[this.emptyId],bufferEnd:[this.emptyId]})}async spinCells(e,t=()=>{}){await Promise.all(e.map(async({cell:e,id:n})=>{let r=this._reel(e),i=r.spin();r.setResult([{visible:[n],bufferStart:[this.emptyId],bufferEnd:[this.emptyId]}]),await i,await t(e,n)}))}skipSpinning(){let e=0;for(let t of this._reels.values())if(t.isSpinning){e+=1;try{t.skipSpin()}catch{}}return e}get isDestroyed(){return this._destroyed}destroy(){if(!this._destroyed){this._destroyed=!0;for(let e of this._reels.values())e.destroy();this._reels.clear(),this._cells.length=0,this.container.destroy({children:!0})}}_origin(e){return{x:e.reel*(this.cellWidth+this.columnGap),y:e.cell*(this.cellHeight+this.rowGap)}}_reel(e){let t=this._reels.get(z(e));if(!t)throw Error(`BoardGrid: cell ${z(e)} is outside the ${this.cols}x${this.rows} grid.`);return t}},H=e=>`${e.reel},${e.cell}`,U=class{_locked=new Map;_cellSet;_allCells;_initialInactive;_inactive;_defaultRespins;_respinsLeft=0;_round=0;_phase=`idle`;_waveLanded=[];constructor(e,t,n=[]){this._allCells=e,this._cellSet=new Set(e.map(H)),this._defaultRespins=t;for(let e of n)if(!this._cellSet.has(H(e)))throw Error(`HoldAndWinBoard: inactive cell ${H(e)} is outside the grid.`);this._initialInactive=new Set(n.map(H)),this._inactive=new Set(this._initialInactive)}get phase(){return this._phase}get respinsLeft(){return this._respinsLeft}get round(){return this._round}get capacity(){return this._allCells.length-this._inactive.size}get isFull(){return this._locked.size===this.capacity}lockedCoins(){return[...this._locked.values()]}freeCells(){return this._allCells.filter(e=>{let t=H(e);return!this._locked.has(t)&&!this._inactive.has(t)})}inactiveCells(){return this._allCells.filter(e=>this._inactive.has(H(e)))}isActive(e){return!this._inactive.has(H(e))}isLocked(e){return this._locked.has(H(e))}coinAt(e){return this._locked.get(H(e))}enter(e){if(this._phase!==`idle`)throw Error(`HoldAndWinBoard: enter() while a feature is active — call reset() first.`);let t=[],n=new Set;for(let r of e){let e=H(r.cell);if(this._assertActive(r.cell,`enter`),n.has(e))throw Error(`HoldAndWinBoard: enter() seeds cell ${e} twice.`);n.add(e);let i=this._freeze(r.cell,r.id,r.data);this._locked.set(e,i),t.push(i)}return this._round=0,this._phase=`active`,[this._setRespins(this._defaultRespins,`seed`),{type:`feature:enter`,payload:{seed:t,respins:this._respinsLeft}}]}beginWave(e){if(this._phase===`idle`)throw Error(`HoldAndWinBoard: respin() before enter().`);if(this._phase===`spinning`)throw Error(`HoldAndWinBoard: respin() while a wave is in flight.`);let t=new Map;for(let n of e){let e=H(n.cell);if(this._assertActive(n.cell,`respin`),this._locked.has(e))throw Error(`HoldAndWinBoard: hit targets locked cell ${e}.`);if(t.has(e))throw Error(`HoldAndWinBoard: respin() targets cell ${e} twice.`);t.set(e,n)}return this._waveLanded=[],this._phase=`spinning`,this._round+=1,{round:this._round,spinning:this.freeCells(),hitByKey:t}}land(e,t){if(this._phase!==`spinning`)return[];if(!t)return[{type:`cell:landed`,payload:{cell:e,coin:null}}];let n=this._freeze(e,t.id,t.data);return this._locked.set(H(e),n),this._waveLanded.push(n),[{type:`cell:landed`,payload:{cell:e,coin:n}},{type:`coin:locked`,payload:{coin:n,locked:this._locked.size,capacity:this.capacity}}]}endWave(){if(this._phase!==`spinning`)return{effects:[],landed:[]};let e=this._waveLanded,t=[];t.push(e.length>0?this._setRespins(this._defaultRespins,`hit-reset`):this._setRespins(this._respinsLeft-1,`miss`)),this._phase=`active`,t.push({type:`respin:end`,payload:{round:this._round,hits:[...e],respinsLeft:this._respinsLeft}});let n=this.isFull;return n&&t.push({type:`board:full`,payload:{coins:this.lockedCoins()}}),(n||this._respinsLeft<=0)&&(this._phase=`idle`,t.push({type:`feature:end`,payload:{coins:this.lockedCoins(),rounds:this._round,full:n}})),{effects:t,landed:[...e]}}abortWave(){this._phase===`spinning`&&(this._phase=`active`,this._waveLanded=[])}release(e){if(this._phase===`spinning`)throw Error(`HoldAndWinBoard: release() while a wave is in flight — await respin() first.`);let t=[],n=[];for(let r of e){let e=H(r),i=this._locked.get(e);i&&(this._locked.delete(e),n.push(i),t.push({type:`coin:released`,payload:{coin:i,remaining:this._locked.size}}))}return{effects:t,released:n}}activate(e){if(this._phase===`spinning`)throw Error(`HoldAndWinBoard: activate() while a wave is in flight — await respin() first.`);let t=[];for(let n of e){let e=H(n);this._assertInGrid(n,`activate`),this._inactive.has(e)&&(this._inactive.delete(e),t.push({reel:n.reel,cell:n.cell}))}return t.length===0?[]:[{type:`cells:activated`,payload:{cells:t,capacity:this.capacity}}]}swap(e,t,n){if(this._phase===`spinning`)throw Error(`HoldAndWinBoard: setSymbolAt() while a wave is in flight — await respin() first.`);let r=H(e),i=this._locked.get(r);if(!i)throw Error(`HoldAndWinBoard: setSymbolAt(${r}) on a non-locked cell — setSymbolAt rewrites a locked coin's identity.`);this._locked.set(r,this._freeze(e,t,n??i.data))}reset(){let e=this._locked.size;this._locked.clear(),this._inactive.clear();for(let e of this._initialInactive)this._inactive.add(e);return this._waveLanded=[],this._round=0,this._respinsLeft=0,this._phase=`idle`,[{type:`feature:reset`,payload:{clearedCoins:e}}]}_setRespins(e,t){return this._respinsLeft=Math.max(0,e),{type:`respins:changed`,payload:{value:this._respinsLeft,reason:t}}}_freeze(e,t,n){return{cell:Object.freeze({reel:e.reel,cell:e.cell}),id:t,data:n}}_assertInGrid(e,t){if(!this._cellSet.has(H(e)))throw Error(`HoldAndWinBoard: ${t}() targets cell ${H(e)} outside the grid.`)}_assertActive(e,t){if(this._assertInGrid(e,t),this._inactive.has(H(e)))throw Error(`HoldAndWinBoard: ${t}() targets inactive cell ${H(e)} — activate() it first.`)}},W=1100,G=class{events=new e.nt;cols;rows;_grid;_state;_emptyId;_inactiveId;_lockAnimation;_anticipateWhen;_stagger;_speeds=new Set;_speed;_tenseWave=!1;constructor(e){this.cols=e.cols,this.rows=e.rows,this._emptyId=e.emptyId,this._inactiveId=e.inactiveId,this._lockAnimation=e.lockAnimation,this._anticipateWhen=e.anticipateWhen,this._stagger=e.stagger,this._speed=e.initialSpeed;let t=[e.initialSpeed,...Object.keys(e.speeds).filter(t=>t!==e.initialSpeed)],n={};for(let r of t){let t=e.speeds[r];this._speeds.add(r),n[r]=e=>this._profileFor(r,t,e,!1),n[`${r}:tension`]=e=>this._profileFor(r,t,e,!0)}this._grid=new V({cols:e.cols,rows:e.rows,cellSize:{width:e.cellWidth,height:e.cellHeight},columnGap:e.columnGap,rowGap:e.rowGap,emptyId:e.emptyId,symbols:t=>{if(e.configurator(t),e.inactiveId!==e.emptyId&&!t.has(e.inactiveId))throw Error(`HoldAndWinBuilder: inactive(cells, '${e.inactiveId}') names a symbol id that .symbols(...) never registered.`)},weights:e.weights??void 0,symbolData:e.symbolData??void 0,chrome:e.chrome??void 0,mask:e.mask??void 0,orientation:e.orientation,direction:e.direction,ticker:e.ticker,rng:e.rng??void 0,profiles:n}),this._state=new U(this._grid.cells(),e.respins,e.inactive),this._dressInactive()}get container(){return this._grid.container}get capacity(){return this._state.capacity}get respinsLeft(){return this._state.respinsLeft}get lockedCoins(){return this._state.lockedCoins()}get isFull(){return this._state.isFull}get freeCells(){return this._state.freeCells()}get inactiveCells(){return this._state.inactiveCells()}get phase(){return this._state.phase}get speed(){return this._speed}get speedNames(){return[...this._speeds]}cellBounds(e){return this._grid.cellBounds(e)}cellCenter(e){return this._grid.cellCenter(e)}symbolAt(e){return this._grid.symbolAt(e)}reelAt(e){return this._grid.reelAt(e)}setSymbolAt(e,t,n){return this._state.swap(e,t,n),this._grid.place(e,t),this._grid.symbolAt(e)}enter(e){let t=this._state.enter(e);for(let t of e)this._grid.place(t.cell,t.id);this._apply(t)}async respin(e){let{round:t,spinning:n,hitByKey:r}=this._state.beginWave(e);try{let e=this._anticipating()&&n.length>0;this._tenseWave=e;let i=e?`${this._speed}:tension`:this._speed;for(let e of n)this._grid.setProfile(e,i);this.events.emit(`respin:start`,{round:t,respinsLeft:this._state.respinsLeft,spinning:n});let a=n.map(e=>({cell:e,id:r.get(H(e))?.id??this._emptyId}));await this._grid.spinCells(a,e=>{this._apply(this._state.land(e,r.get(H(e))??null))});let{effects:o,landed:s}=this._state.endWave();return this._apply(o),{round:t,hits:s,respinsLeft:this._state.respinsLeft,full:this._state.isFull,done:this._state.phase===`idle`}}catch(e){throw this._state.abortWave(),this._grid.skipSpinning(),e}}setSpeed(e){if(!this._speeds.has(e))throw Error(`HoldAndWinBoard: setSpeed('${e}') names no registered profile (have: ${[...this._speeds].join(`, `)}).`);let t=this._speed;this._speed=e;let n=this._state.phase===`spinning`&&this._tenseWave?`${e}:tension`:e;for(let e of this._grid.cells())this._grid.setProfile(e,n);this.events.emit(`speed:changed`,{name:e,previous:t})}addSpeed(e,t){for(let n of this._grid.cells()){let r=this._grid.reelAt(n).speed;r.addProfile(e,this._profileFor(e,t,n,!1)),r.addProfile(`${e}:tension`,this._profileFor(e,t,n,!0))}this._speeds.add(e)}async playWin(e){let t=e??this._state.lockedCoins().map(e=>e.cell);await Promise.all(t.map(e=>this._playOn(e,`win`)))}activate(e){let t=this._state.activate(e);for(let t of e)this._grid.place(t,this._emptyId);this._apply(t)}release(e){let{effects:t,released:n}=this._state.release(e);for(let e of n)this._grid.place(e.cell,this._emptyId);return this._apply(t),n}skip(){let e=this._grid.skipSpinning();return this.events.emit(`feature:skip`,{inFlight:e}),e}reset(){let e=this._state.reset();for(let e of this._grid.cells())this._grid.place(e,this._emptyId);this._dressInactive(),this._apply(e)}get isDestroyed(){return this._grid.isDestroyed}destroy(){this._grid.isDestroyed||(this.events.removeAllListeners(),this._grid.destroy())}_apply(e){for(let t of e)this.events.emit(t.type,t.payload),t.type===`coin:locked`&&this._lockAnimation!==`none`&&this._playOn(t.payload.coin.cell,this._lockAnimation)}_playOn(t,n){let r=this.symbolAt(t);return(n===`win`?r.playWin():r.playLanding()).catch(t=>e.k(`hw-coin-${n}-failed`,`HoldAndWinBoard: coin ${n} animation failed.`,t))}_profileFor(e,t,n,r){let i=(t.minimumSpinTime??320)+this._stagger(n.reel,n.cell,e);return{...t,minimumSpinTime:i+(r?W:0)}}_dressInactive(){for(let e of this._state.inactiveCells())this._grid.place(e,this._inactiveId)}_anticipating(){return this._anticipateWhen?this._anticipateWhen({locked:this._state.lockedCoins().length,capacity:this._state.capacity,respinsLeft:this._state.respinsLeft}):!1}},K=class{_cols=5;_rows=3;_cellWidth=72;_cellHeight=72;_columnGap=4;_rowGap=4;_emptyId=`empty`;_inactive=[];_inactiveId=null;_respins=3;_lockAnimation=`win`;_configurator=null;_weights=null;_symbolData=null;_speeds={normal:{...e.b.NORMAL,minimumSpinTime:320}};_initialSpeed=`normal`;_stagger=(e,t)=>(e+t)*70;_anticipateWhen=null;_chrome=null;_mask=null;_orientation=`vertical`;_direction=`forward`;_ticker=null;_rng=null;grid(e,t){return this._cols=e,this._rows=t,this}cellSize(e,t={}){return typeof e==`number`?(this._cellWidth=e,this._cellHeight=e):(this._cellWidth=e.width,this._cellHeight=e.height),t.gap!==void 0&&(this._columnGap=t.gap,this._rowGap=t.gap),t.columnGap!==void 0&&(this._columnGap=t.columnGap),t.rowGap!==void 0&&(this._rowGap=t.rowGap),this}symbols(e){return this._configurator=e,this}weights(e){return this._weights=e,this}emptyId(e){return this._emptyId=e,this}inactive(e,t){return this._inactive=e.map(e=>({reel:e.reel,cell:e.cell})),this._inactiveId=t??null,this}symbolData(e){return this._symbolData={...this._symbolData??{},...e},this}respins(e){return this._respins=e,this}lockAnimation(e){return this._lockAnimation=e,this}speedProfile(e){return this._speeds={...this._speeds,normal:e},this}speeds(e){return this._speeds={...this._speeds,...e},this}initialSpeed(e){return this._initialSpeed=e,this}stagger(e){return this._stagger=e,this}anticipateWhen(e){return this._anticipateWhen=e,this}cellChrome(e){return this._chrome=e,this}cellMask(e){return this._mask=e,this}axis(e,t=`forward`){return this._orientation=e,this._direction=t,this}ticker(e){return this._ticker=e,this}rng(e){return this._rng=e,this}build(){if(!this._configurator)throw Error(`HoldAndWinBuilder: .symbols(...) is required — register at least one coin id.`);if(!this._ticker)throw Error(`HoldAndWinBuilder: .ticker(...) is required.`);if(!(this._initialSpeed in this._speeds))throw Error(`HoldAndWinBuilder: initialSpeed('${this._initialSpeed}') names no registered profile - register it with .speeds({ ... }).`);return new G({cols:this._cols,rows:this._rows,cellWidth:this._cellWidth,cellHeight:this._cellHeight,columnGap:this._columnGap,rowGap:this._rowGap,emptyId:this._emptyId,inactive:this._inactive,inactiveId:this._inactiveId??this._emptyId,respins:this._respins,lockAnimation:this._lockAnimation,configurator:this._configurator,weights:this._weights,symbolData:this._symbolData,speeds:this._speeds,initialSpeed:this._initialSpeed,stagger:this._stagger,anticipateWhen:this._anticipateWhen,chrome:this._chrome,mask:this._mask,orientation:this._orientation,direction:this._direction,ticker:this._ticker,rng:this._rng})}};function q(e){return[...e].sort((e,t)=>(t.value??0)-(e.value??0))}var J=class e{_reelSet;_options;_abort=null;_isActive=!1;_isDestroyed=!1;constructor(t,n={}){this._reelSet=t,this._options=e._resolve(n)}get isActive(){return this._isActive}get isDestroyed(){return this._isDestroyed}async show(e){if(this.abort(),this._isDestroyed||e.length===0)return;let t=this._options.sortByValue?q(e):[...e],n=new AbortController;this._abort=n,this._isActive=!0,this._reelSet.events.emit(`win:start`,t);let r=0;try{for(;this._options.cycles===-1||r<this._options.cycles;){for(let e of t){if(n.signal.aborted||(await this._showOne(e,n.signal),n.signal.aborted))return;await this._wait(this._options.cycleGap,n.signal)}r++}}finally{this._restoreAlpha();let e=n.signal.aborted;this._abort===n&&(this._abort=null),this._isActive=!1,this._reelSet.events.emit(`win:end`,e?`aborted`:`complete`)}}abort(){this._abort&&this._abort.abort()}destroy(){this._isDestroyed||(this._isDestroyed=!0,this.abort())}async _showOne(e,t){let n=[...e.cells];if(n.length===0)return;this._applyDim(n),this._reelSet.events.emit(`win:group`,e,n);let r=this._options.stagger,i=[];for(let a=0;a<n.length&&!(t.aborted||(a>0&&r>0&&await this._wait(r,t),t.aborted));a++){let t=n[a],r=this._reelSet.getReel(t.reelIndex);if(!r)continue;let o=r.getSymbolAt(t.cellIndex);o&&(this._reelSet.events.emit(`win:symbol`,o,t,e),i.push(this._playAnim(o,t,e)))}await Promise.all(i)}async _playAnim(e,t,n){let r=this._options.symbolAnim;if(typeof r==`function`)return r(e,t,n);if(r===`win`)return e.playWin();let i=e;return typeof i.playAnimation==`function`?i.playAnimation(r):e.playWin()}_applyDim(e){let t=this._options.dimAlpha;if(t===null)return;let n=new Set;for(let t of e)n.add(`${t.reelIndex}:${t.cellIndex}`);let r=this._reelSet.reels;for(let e=0;e<r.length;e++){let i=r[e];for(let r=0;r<i.visibleCells;r++){let a=i.getSymbolAt(r).view;a.alpha=n.has(`${e}:${r}`)?1:t}}}_restoreAlpha(){let e=this._reelSet.reels;for(let t of e)for(let e=0;e<t.visibleCells;e++)t.getSymbolAt(e).view.alpha=1}_wait(e,t){return new Promise(n=>{if(t.aborted)return n();let r=setTimeout(n,e);t.addEventListener(`abort`,()=>{clearTimeout(r),n()},{once:!0})})}static _resolve(e){let t;return t=e.dimLosers===!1?null:typeof e.dimLosers==`object`&&e.dimLosers!==null?e.dimLosers.alpha??.35:.35,{dimAlpha:t,symbolAnim:e.symbolAnim??`win`,stagger:Math.max(0,e.stagger??0),cycleGap:e.cycleGap??400,cycles:e.cycles??1,sortByValue:e.sortByValue??!0}}};function Y(e,n=t.n){let r=n;r.ticker.remove(r.updateRoot);let i=()=>{r.updateRoot(e.lastTime/1e3)};e.add(i);let a=!1;return()=>{a||(a=!0,e.remove(i),r.ticker.add(r.updateRoot))}}exports.AdjustPhase=e.d,exports.AnimatedSpriteSymbol=D,exports.AnticipationPhase=e.D,exports.BoardGrid=V,exports.CARD_DECK=N,exports.CURVE_FOCUS_WEIGHT=e.Z,exports.CardSymbol=M,exports.CascadeDropInPhase=e.f,exports.CascadeFallPhase=e.h,exports.CascadeMode=I,exports.CascadePlacePhase=e.p,exports.DEFAULTS=e.x,exports.DRIVE_FRAME_MS=e.V,exports.EmptySymbol=O,exports.EventEmitter=e.nt,exports.FrameBuilder=e._,exports.HoldAndWinBoard=G,exports.HoldAndWinBuilder=K,exports.HoldAndWinState=U,exports.ImmediateMode=L,exports.MASK_STRATEGY_VERSION=e.I,exports.OVERLAY_LABEL=e.c,exports.ObjectPool=e.v,exports.PathMaskStrategy=_,exports.PerspectiveCell=T,exports.PhaseFactory=e.E,exports.RectMaskStrategy=e.L,exports.Reel=e.B,exports.ReelCurve=e.Q,exports.ReelPhase=e.F,exports.ReelSet=e.S,exports.ReelSetBuilder=e.u,exports.ReelSymbol=t.t,exports.ReelViewport=e.R,exports.ReelWarp=e.Y,exports.RoundedRectMaskStrategy=m,exports.SharedRectMaskStrategy=e.z,exports.SilhouetteMaskStrategy=g,exports.SpeedManager=e.T,exports.SpeedPresets=e.b,exports.SpinPhase=e.N,exports.SpinTextureCache=k,exports.SpineSymbol=n.t,exports.SpriteSymbol=E,exports.StandardMode=e.W,exports.StartPhase=e.P,exports.StaticSpinSymbol=j,exports.StopPhase=e.M,exports.SymbolRegistry=e.y,exports.SymbolSpotlight=e.w,exports.TickerRef=e.X,exports.VERTICAL_FORWARD=e.et,exports.WILD_CARD=P,exports.WinPresenter=J,exports.anticipationForScatters=F,exports.canProjectTexture=C,exports.cellKey=H,exports.clearFrames=e.t,exports.cloneColumnTarget=e.G,exports.columnTargetToStrip=e.K,exports.composeMasks=y,exports.computeDropOffsets=e.m,exports.debugGrid=e.n,exports.debugOverlay=e.l,exports.debugSnapshot=e.r,exports.driveGsapWithTicker=Y,exports.enableDebug=e.i,exports.getFrames=e.a,exports.getLogLevel=e.O,exports.getTargetSlot=e.q,exports.inset=v,exports.isDrawableMaskStrategy=i,exports.pinKey=e.C,exports.prewarmSpinTextures=A,exports.reelAxis=e.tt,exports.resolveCurveConfig=e.$,exports.resolveDriveConfig=e.H,exports.resolveTumbleConfig=e.g,exports.setLogLevel=e.j,exports.setTargetSlot=e.J,exports.sortByValueDesc=q,exports.startRecording=e.o,exports.stepDrive=e.U,exports.stopRecording=e.s,exports.textureCellInset=S,exports.whenSpineReady=n.n;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|