pixi-reels 0.0.0-dependabot-github-actions-github-codeql-action-4-35-4-20260514194131

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.
Files changed (125) hide show
  1. package/CHANGELOG.md +260 -0
  2. package/CONTRIBUTING.md +85 -0
  3. package/LICENSE +28 -0
  4. package/README.md +168 -0
  5. package/dist/SpineSymbol-CfVrc5Pk.js +88 -0
  6. package/dist/SpineSymbol-CfVrc5Pk.js.map +1 -0
  7. package/dist/SpineSymbol-JA5PdEbT.cjs +2 -0
  8. package/dist/SpineSymbol-JA5PdEbT.cjs.map +1 -0
  9. package/dist/cascade/CascadeAnticipationPhase.d.ts +23 -0
  10. package/dist/cascade/CascadeAnticipationPhase.d.ts.map +1 -0
  11. package/dist/cascade/DropRecipes.d.ts +40 -0
  12. package/dist/cascade/DropRecipes.d.ts.map +1 -0
  13. package/dist/config/SpeedPresets.d.ts +49 -0
  14. package/dist/config/SpeedPresets.d.ts.map +1 -0
  15. package/dist/config/defaults.d.ts +12 -0
  16. package/dist/config/defaults.d.ts.map +1 -0
  17. package/dist/config/types.d.ts +296 -0
  18. package/dist/config/types.d.ts.map +1 -0
  19. package/dist/core/Reel.d.ts +339 -0
  20. package/dist/core/Reel.d.ts.map +1 -0
  21. package/dist/core/ReelMotion.d.ts +51 -0
  22. package/dist/core/ReelMotion.d.ts.map +1 -0
  23. package/dist/core/ReelSet.d.ts +509 -0
  24. package/dist/core/ReelSet.d.ts.map +1 -0
  25. package/dist/core/ReelSetBuilder.d.ts +282 -0
  26. package/dist/core/ReelSetBuilder.d.ts.map +1 -0
  27. package/dist/core/ReelViewport.d.ts +129 -0
  28. package/dist/core/ReelViewport.d.ts.map +1 -0
  29. package/dist/core/StopSequencer.d.ts +26 -0
  30. package/dist/core/StopSequencer.d.ts.map +1 -0
  31. package/dist/debug/debug.d.ts +129 -0
  32. package/dist/debug/debug.d.ts.map +1 -0
  33. package/dist/events/EventEmitter.d.ts +25 -0
  34. package/dist/events/EventEmitter.d.ts.map +1 -0
  35. package/dist/events/ReelEvents.d.ts +125 -0
  36. package/dist/events/ReelEvents.d.ts.map +1 -0
  37. package/dist/frame/ColumnTarget.d.ts +77 -0
  38. package/dist/frame/ColumnTarget.d.ts.map +1 -0
  39. package/dist/frame/FrameBuilder.d.ts +51 -0
  40. package/dist/frame/FrameBuilder.d.ts.map +1 -0
  41. package/dist/frame/OffsetCalculator.d.ts +19 -0
  42. package/dist/frame/OffsetCalculator.d.ts.map +1 -0
  43. package/dist/frame/RandomSymbolProvider.d.ts +27 -0
  44. package/dist/frame/RandomSymbolProvider.d.ts.map +1 -0
  45. package/dist/index.cjs +5 -0
  46. package/dist/index.cjs.map +1 -0
  47. package/dist/index.d.ts +70 -0
  48. package/dist/index.d.ts.map +1 -0
  49. package/dist/index.js +2571 -0
  50. package/dist/index.js.map +1 -0
  51. package/dist/pins/CellPin.d.ts +140 -0
  52. package/dist/pins/CellPin.d.ts.map +1 -0
  53. package/dist/pool/ObjectPool.d.ts +36 -0
  54. package/dist/pool/ObjectPool.d.ts.map +1 -0
  55. package/dist/speed/SpeedManager.d.ts +38 -0
  56. package/dist/speed/SpeedManager.d.ts.map +1 -0
  57. package/dist/spin/SpinController.d.ts +183 -0
  58. package/dist/spin/SpinController.d.ts.map +1 -0
  59. package/dist/spin/modes/CascadeMode.d.ts +16 -0
  60. package/dist/spin/modes/CascadeMode.d.ts.map +1 -0
  61. package/dist/spin/modes/ImmediateMode.d.ts +10 -0
  62. package/dist/spin/modes/ImmediateMode.d.ts.map +1 -0
  63. package/dist/spin/modes/SpinningMode.d.ts +18 -0
  64. package/dist/spin/modes/SpinningMode.d.ts.map +1 -0
  65. package/dist/spin/modes/StandardMode.d.ts +10 -0
  66. package/dist/spin/modes/StandardMode.d.ts.map +1 -0
  67. package/dist/spin/phases/AdjustPhase.d.ts +73 -0
  68. package/dist/spin/phases/AdjustPhase.d.ts.map +1 -0
  69. package/dist/spin/phases/AnticipationPhase.d.ts +24 -0
  70. package/dist/spin/phases/AnticipationPhase.d.ts.map +1 -0
  71. package/dist/spin/phases/DropStartPhase.d.ts +21 -0
  72. package/dist/spin/phases/DropStartPhase.d.ts.map +1 -0
  73. package/dist/spin/phases/DropStopPhase.d.ts +44 -0
  74. package/dist/spin/phases/DropStopPhase.d.ts.map +1 -0
  75. package/dist/spin/phases/PhaseFactory.d.ts +32 -0
  76. package/dist/spin/phases/PhaseFactory.d.ts.map +1 -0
  77. package/dist/spin/phases/ReelPhase.d.ts +39 -0
  78. package/dist/spin/phases/ReelPhase.d.ts.map +1 -0
  79. package/dist/spin/phases/SpinPhase.d.ts +25 -0
  80. package/dist/spin/phases/SpinPhase.d.ts.map +1 -0
  81. package/dist/spin/phases/StartPhase.d.ts +26 -0
  82. package/dist/spin/phases/StartPhase.d.ts.map +1 -0
  83. package/dist/spin/phases/StopPhase.d.ts +37 -0
  84. package/dist/spin/phases/StopPhase.d.ts.map +1 -0
  85. package/dist/spine/SpineReelSymbol.d.ts +130 -0
  86. package/dist/spine/SpineReelSymbol.d.ts.map +1 -0
  87. package/dist/spine/index.d.ts +5 -0
  88. package/dist/spine/index.d.ts.map +1 -0
  89. package/dist/spine.cjs +2 -0
  90. package/dist/spine.cjs.map +1 -0
  91. package/dist/spine.js +123 -0
  92. package/dist/spine.js.map +1 -0
  93. package/dist/spotlight/SymbolSpotlight.d.ts +70 -0
  94. package/dist/spotlight/SymbolSpotlight.d.ts.map +1 -0
  95. package/dist/symbols/AnimatedSpriteSymbol.d.ts +30 -0
  96. package/dist/symbols/AnimatedSpriteSymbol.d.ts.map +1 -0
  97. package/dist/symbols/ReelSymbol.d.ts +86 -0
  98. package/dist/symbols/ReelSymbol.d.ts.map +1 -0
  99. package/dist/symbols/SpineSymbol.d.ts +34 -0
  100. package/dist/symbols/SpineSymbol.d.ts.map +1 -0
  101. package/dist/symbols/SpriteSymbol.d.ts +29 -0
  102. package/dist/symbols/SpriteSymbol.d.ts.map +1 -0
  103. package/dist/symbols/SymbolFactory.d.ts +20 -0
  104. package/dist/symbols/SymbolFactory.d.ts.map +1 -0
  105. package/dist/symbols/SymbolRegistry.d.ts +25 -0
  106. package/dist/symbols/SymbolRegistry.d.ts.map +1 -0
  107. package/dist/testing/FakeTicker.d.ts +45 -0
  108. package/dist/testing/FakeTicker.d.ts.map +1 -0
  109. package/dist/testing/HeadlessSymbol.d.ts +28 -0
  110. package/dist/testing/HeadlessSymbol.d.ts.map +1 -0
  111. package/dist/testing/index.d.ts +5 -0
  112. package/dist/testing/index.d.ts.map +1 -0
  113. package/dist/testing/testHarness.d.ts +97 -0
  114. package/dist/testing/testHarness.d.ts.map +1 -0
  115. package/dist/utils/Disposable.d.ts +10 -0
  116. package/dist/utils/Disposable.d.ts.map +1 -0
  117. package/dist/utils/TickerRef.d.ts +30 -0
  118. package/dist/utils/TickerRef.d.ts.map +1 -0
  119. package/dist/utils/gsapRef.d.ts +14 -0
  120. package/dist/utils/gsapRef.d.ts.map +1 -0
  121. package/dist/wins/Win.d.ts +7 -0
  122. package/dist/wins/Win.d.ts.map +1 -0
  123. package/dist/wins/WinPresenter.d.ts +100 -0
  124. package/dist/wins/WinPresenter.d.ts.map +1 -0
  125. package/package.json +87 -0
@@ -0,0 +1,125 @@
1
+ import { SpeedProfile, Win, SymbolPosition } from '../config/types.js';
2
+ import { CellPin, PinExpireReason } from '../pins/CellPin.js';
3
+ export type { SymbolPosition };
4
+ /** Result returned when a spin completes. */
5
+ export interface SpinResult {
6
+ /** Final symbol grid [reelIndex][rowIndex]. */
7
+ symbols: string[][];
8
+ /** Whether the spin was skipped/slam-stopped. */
9
+ wasSkipped: boolean;
10
+ /** Total spin duration in milliseconds. */
11
+ duration: number;
12
+ }
13
+ /** Events emitted by a ReelSet. */
14
+ export interface ReelSetEvents extends Record<string, unknown[]> {
15
+ 'spin:start': [];
16
+ 'spin:allStarted': [];
17
+ 'spin:stopping': [reelIndex: number];
18
+ 'spin:reelLanded': [reelIndex: number, symbols: string[]];
19
+ 'spin:allLanded': [result: SpinResult];
20
+ 'spin:complete': [result: SpinResult];
21
+ 'skip:requested': [];
22
+ 'skip:completed': [];
23
+ 'speed:changed': [profile: SpeedProfile, previous: SpeedProfile];
24
+ 'spotlight:start': [positions: SymbolPosition[]];
25
+ 'spotlight:end': [];
26
+ /**
27
+ * WinPresenter started a sequence. Fires once per `show()` call, with
28
+ * the full list of wins in the order they'll be shown (sorted by
29
+ * `value` desc by default).
30
+ */
31
+ 'win:start': [wins: readonly Win[]];
32
+ /**
33
+ * A single win is now being presented. Fires once per win per cycle —
34
+ * before `win:symbol` fires for its cells. Subscribe to draw per-win
35
+ * visuals (payline polyline, cluster outline, number popup) using
36
+ * `reelSet.getCellBounds(col, row)`.
37
+ */
38
+ 'win:group': [win: Win, cells: readonly SymbolPosition[]];
39
+ /**
40
+ * A specific cell is being animated. Fires once per cell per win per
41
+ * cycle. `symbol` is typed as `unknown` to keep this module free of
42
+ * symbol-layer imports; cast to `ReelSymbol` (or your subclass).
43
+ * When `WinPresenter.stagger > 0`, successive cells fire this event
44
+ * one after another with that gap.
45
+ */
46
+ 'win:symbol': [symbol: unknown, cell: SymbolPosition, win: Win];
47
+ /** WinPresenter finished — either naturally (`complete`) or via abort. */
48
+ 'win:end': [reason: 'complete' | 'aborted'];
49
+ /**
50
+ * A pin was placed at a cell. The pin's `originRow` is captured at
51
+ * placement and frozen for its lifetime; on MultiWays slots it controls
52
+ * how the pin migrates across reshapes (see `pin:migrated`). For
53
+ * non-MultiWays slots `originRow === pin.row` and never changes — but
54
+ * the field is still on the payload, so trace logs can show the intent.
55
+ */
56
+ 'pin:placed': [pin: CellPin];
57
+ 'pin:moved': [pin: CellPin, from: {
58
+ col: number;
59
+ row: number;
60
+ }];
61
+ 'pin:expired': [pin: CellPin, reason: PinExpireReason];
62
+ /**
63
+ * MultiWays: a pin was relocated by an AdjustPhase reshape because its
64
+ * `originRow` either no longer fits within the new shape (`clamped: true`)
65
+ * or fits at a row that differs from its current visual position.
66
+ *
67
+ * Always fires from a MultiWays AdjustPhase — non-MultiWays slots never
68
+ * emit this event.
69
+ */
70
+ 'pin:migrated': [
71
+ pin: CellPin,
72
+ info: {
73
+ fromRow: number;
74
+ toRow: number;
75
+ clamped: boolean;
76
+ reelIndex: number;
77
+ }
78
+ ];
79
+ /**
80
+ * MultiWays: `setShape(rowsPerReel)` recorded a new target shape for the
81
+ * upcoming AdjustPhase. Fires before any geometry change. No-op for
82
+ * non-MultiWays slots — they never see this event.
83
+ */
84
+ 'shape:changed': [rowsPerReel: number[]];
85
+ /**
86
+ * MultiWays: per-reel AdjustPhase entry. `fromRows` is the row count
87
+ * before the reshape; `toRows` is the row count after.
88
+ */
89
+ 'adjust:start': [info: {
90
+ reelIndex: number;
91
+ fromRows: number;
92
+ toRows: number;
93
+ }];
94
+ /** MultiWays: per-reel AdjustPhase exit. */
95
+ 'adjust:complete': [info: {
96
+ reelIndex: number;
97
+ }];
98
+ /**
99
+ * Fires whenever the engine creates a visual overlay symbol for a pin
100
+ * during a spin's motion phase. The `overlay` argument is the pooled
101
+ * ReelSymbol instance — typed as `unknown` here to keep this module
102
+ * free of symbol-layer imports; cast to your concrete symbol class.
103
+ *
104
+ * Use this hook to drive animation state on the overlay (e.g. set a
105
+ * Spine animation track). The overlay is recycled on `pin:overlayDestroyed`.
106
+ */
107
+ 'pin:overlayCreated': [pin: CellPin, overlay: unknown];
108
+ /**
109
+ * Fires when the engine is about to release a pin's visual overlay
110
+ * back to the pool (on spin:allLanded, unpin, or pin replacement).
111
+ * Use this hook to stop any animations or listeners you attached.
112
+ */
113
+ 'pin:overlayDestroyed': [pin: CellPin, overlay: unknown];
114
+ 'destroyed': [];
115
+ }
116
+ /** Events emitted by an individual Reel. */
117
+ export interface ReelEvents extends Record<string, unknown[]> {
118
+ 'phase:enter': [phaseName: string];
119
+ 'phase:exit': [phaseName: string];
120
+ 'symbol:created': [symbolId: string, row: number];
121
+ 'symbol:recycled': [symbolId: string, row: number];
122
+ 'landed': [symbols: string[]];
123
+ 'destroyed': [];
124
+ }
125
+ //# sourceMappingURL=ReelEvents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReelEvents.d.ts","sourceRoot":"","sources":["../../src/events/ReelEvents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,GAAG,EACH,cAAc,EACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAInE,YAAY,EAAE,cAAc,EAAE,CAAC;AAE/B,6CAA6C;AAC7C,MAAM,WAAW,UAAU;IACzB,+CAA+C;IAC/C,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC;IACpB,iDAAiD;IACjD,UAAU,EAAE,OAAO,CAAC;IACpB,2CAA2C;IAC3C,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,mCAAmC;AACnC,MAAM,WAAW,aAAc,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;IAC9D,YAAY,EAAE,EAAE,CAAC;IACjB,iBAAiB,EAAE,EAAE,CAAC;IACtB,eAAe,EAAE,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IACrC,iBAAiB,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;IAC1D,gBAAgB,EAAE,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACvC,eAAe,EAAE,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACtC,gBAAgB,EAAE,EAAE,CAAC;IACrB,gBAAgB,EAAE,EAAE,CAAC;IACrB,eAAe,EAAE,CAAC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;IACjE,iBAAiB,EAAE,CAAC,SAAS,EAAE,cAAc,EAAE,CAAC,CAAC;IACjD,eAAe,EAAE,EAAE,CAAC;IACpB;;;;OAIG;IACH,WAAW,EAAE,CAAC,IAAI,EAAE,SAAS,GAAG,EAAE,CAAC,CAAC;IACpC;;;;;OAKG;IACH,WAAW,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,cAAc,EAAE,CAAC,CAAC;IAC1D;;;;;;OAMG;IACH,YAAY,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IAChE,0EAA0E;IAC1E,SAAS,EAAE,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,CAAC,CAAC;IAC5C;;;;;;OAMG;IACH,YAAY,EAAE,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAC7B,WAAW,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAChE,aAAa,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,eAAe,CAAC,CAAC;IACvD;;;;;;;OAOG;IACH,cAAc,EAAE;QACd,GAAG,EAAE,OAAO;QACZ,IAAI,EAAE;YAAE,OAAO,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,OAAO,CAAC;YAAC,SAAS,EAAE,MAAM,CAAA;SAAE;KAC9E,CAAC;IACF;;;;OAIG;IACH,eAAe,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,CAAC,CAAC;IACzC;;;OAGG;IACH,cAAc,EAAE,CAAC,IAAI,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAChF,4CAA4C;IAC5C,iBAAiB,EAAE,CAAC,IAAI,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACjD;;;;;;;;OAQG;IACH,oBAAoB,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACvD;;;;OAIG;IACH,sBAAsB,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACzD,WAAW,EAAE,EAAE,CAAC;CACjB;AAED,4CAA4C;AAC5C,MAAM,WAAW,UAAW,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;IAC3D,aAAa,EAAE,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IACnC,YAAY,EAAE,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAClC,gBAAgB,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;IAClD,iBAAiB,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;IACnD,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;IAC9B,WAAW,EAAE,EAAE,CAAC;CACjB"}
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Per-reel target shape for `ReelSet.setResult`. The explicit alternative to
3
+ * the legacy `string[]` form where buffer-above slots are stored as
4
+ * negative-index string properties (`arr[-1]`, `arr[-2]`).
5
+ *
6
+ * Both forms are accepted by `setResult`. The explicit form is easier to
7
+ * type-check, serialize across worker/network boundaries, and read in code
8
+ * reviews — internally the engine normalizes one to the other.
9
+ */
10
+ export interface ColumnTarget {
11
+ /** Visible-area target symbols, indexed `0 … visibleRows-1`. */
12
+ visible: string[];
13
+ /**
14
+ * Buffer-above target symbols. `bufferAbove[0]` is the slot closest to the
15
+ * visible top row; `bufferAbove[bufferAboveCount-1]` is the furthest above.
16
+ * Equivalent to legacy `frame[col][-1] … frame[col][-bufferAboveCount]`.
17
+ */
18
+ bufferAbove?: (string | undefined)[];
19
+ /**
20
+ * Buffer-below target symbols. `bufferBelow[0]` is the slot closest to the
21
+ * visible bottom row; later indices go further below.
22
+ * Equivalent to legacy `frame[col][visibleRows] … frame[col][visibleRows + n - 1]`.
23
+ */
24
+ bufferBelow?: (string | undefined)[];
25
+ }
26
+ /**
27
+ * True when `grid` is the explicit `ColumnTarget[]` form. False for the
28
+ * legacy `string[][]` form. Discriminated by whether the first column is an
29
+ * array (legacy) or a plain object (explicit).
30
+ */
31
+ export declare function isColumnTargetGrid(grid: string[][] | ColumnTarget[]): grid is ColumnTarget[];
32
+ /**
33
+ * Clone a per-reel target grid while preserving negative-index slots used by
34
+ * buffer-above targeting.
35
+ *
36
+ * **CONTRIBUTOR NOTE — do not replace with plain spread.**
37
+ *
38
+ * The legacy public API supports `frame[col][-1] = 'COIN'` for targeting
39
+ * the cell just above the visible window. JavaScript stores that as a
40
+ * string property `"-1"` on the array object. Standard spread (`[...col]`),
41
+ * `structuredClone`, `JSON.stringify`, `Array.from`, and `postMessage`
42
+ * **all silently drop** those non-numeric properties. Any code path that
43
+ * needs to clone a result grid in the engine **must** route through this
44
+ * helper, or buffer-above targeting will silently break end-to-end and the
45
+ * integration tests in `tests/integration/setResult-bufferAbove.test.ts`
46
+ * will fail. See `tests/unit/ColumnTarget.test.ts` for the canary.
47
+ *
48
+ * Two existing call sites depend on this:
49
+ * - `ReelSet._applyPinsToGrid`
50
+ * - `SpinController._coordinateBigSymbols`
51
+ *
52
+ * If you add a third clone site, use this helper there too.
53
+ */
54
+ export declare function cloneTargetGrid(grid: string[][], bufferAbove: number): string[][];
55
+ /** Single-column form of {@link cloneTargetGrid}. Same contributor rules. */
56
+ export declare function cloneColumn(col: string[], bufferAbove: number): string[];
57
+ /**
58
+ * Convert a `ColumnTarget` to the legacy `string[]` form, materializing
59
+ * `bufferAbove` entries as negative-index slots and `bufferBelow` entries as
60
+ * indices `>= visible.length`. This is what the rest of the pipeline (the
61
+ * `FrameBuilder` target-placement middleware, big-symbol coordinator, pins)
62
+ * already understands.
63
+ */
64
+ export declare function columnTargetToArray(target: ColumnTarget): string[];
65
+ /**
66
+ * Normalize either input form into the legacy `string[][]` shape the
67
+ * pipeline runs on. Cheap when the input is already `string[][]` — returns
68
+ * it unchanged. Otherwise materializes one `string[]` per column.
69
+ *
70
+ * Throws with a readable message if the columns are a mix of the two
71
+ * shapes (e.g. `[ ['a','b'], { visible: ['c','d'] } ]`). TypeScript blocks
72
+ * this at compile time, but a JS caller bypassing types would otherwise
73
+ * crash later with a confusing `[...col]`-not-iterable error inside the
74
+ * pipeline; we fail loudly at the entry point instead.
75
+ */
76
+ export declare function toLegacyTargetGrid(grid: string[][] | ColumnTarget[]): string[][];
77
+ //# sourceMappingURL=ColumnTarget.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ColumnTarget.d.ts","sourceRoot":"","sources":["../../src/frame/ColumnTarget.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,WAAW,YAAY;IAC3B,gEAAgE;IAChE,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,CAAC;IACrC;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,CAAC;CACtC;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,YAAY,EAAE,GAChC,IAAI,IAAI,YAAY,EAAE,CAExB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,CAEjF;AAED,6EAA6E;AAC7E,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,CAOxE;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,EAAE,CAelE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,YAAY,EAAE,GAChC,MAAM,EAAE,EAAE,CAeZ"}
@@ -0,0 +1,51 @@
1
+ import { RandomSymbolProvider } from './RandomSymbolProvider.js';
2
+ /** Context passed through the middleware pipeline. */
3
+ export interface FrameContext {
4
+ /** Reel column index. */
5
+ readonly reelIndex: number;
6
+ /** Total visible rows. */
7
+ readonly visibleRows: number;
8
+ /** Buffer symbols above visible area. */
9
+ readonly bufferAbove: number;
10
+ /** Buffer symbols below visible area. */
11
+ readonly bufferBelow: number;
12
+ /** The symbol array being built (buffer + visible + buffer). Mutable by middleware. */
13
+ symbols: string[];
14
+ /** Target symbols from setResult() (visible rows only), if available. */
15
+ readonly targetSymbols?: string[];
16
+ /** Whether the reel is currently spinning. */
17
+ readonly isSpinning: boolean;
18
+ /** Arbitrary metadata middleware can use to communicate. */
19
+ metadata: Record<string, unknown>;
20
+ }
21
+ /** Middleware that participates in frame building. */
22
+ export interface FrameMiddleware {
23
+ readonly name: string;
24
+ /** Lower priority runs first. */
25
+ readonly priority: number;
26
+ process(context: FrameContext, next: () => void): void;
27
+ }
28
+ /**
29
+ * Builds symbol frames using a middleware pipeline.
30
+ *
31
+ * Built-in middleware handles random fill and target placement.
32
+ * Users can inject custom middleware for features like multiplier encoding
33
+ * or triple-prevention.
34
+ */
35
+ export declare class FrameBuilder {
36
+ private _randomProvider;
37
+ private _middlewares;
38
+ private _sorted;
39
+ constructor(_randomProvider: RandomSymbolProvider);
40
+ /** Add a middleware to the pipeline. */
41
+ use(middleware: FrameMiddleware): this;
42
+ /** Remove a middleware by name. */
43
+ remove(name: string): this;
44
+ /** Build a frame for a single reel. */
45
+ build(reelIndex: number, visibleRows: number, bufferAbove: number, bufferBelow: number, targetSymbols?: string[], isSpinning?: boolean): string[];
46
+ /** Build frames for all reels. */
47
+ buildAll(reelCount: number, visibleRows: number, bufferAbove: number, bufferBelow: number, targetSymbols?: string[][], isSpinning?: boolean): string[][];
48
+ get randomProvider(): RandomSymbolProvider;
49
+ get middleware(): ReadonlyArray<FrameMiddleware>;
50
+ }
51
+ //# sourceMappingURL=FrameBuilder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FrameBuilder.d.ts","sourceRoot":"","sources":["../../src/frame/FrameBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEtE,sDAAsD;AACtD,MAAM,WAAW,YAAY;IAC3B,yBAAyB;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,0BAA0B;IAC1B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,yCAAyC;IACzC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,yCAAyC;IACzC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,uFAAuF;IACvF,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,yEAAyE;IACzE,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IAClC,8CAA8C;IAC9C,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,4DAA4D;IAC5D,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,sDAAsD;AACtD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,iCAAiC;IACjC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,OAAO,CAAC,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;CACxD;AAED;;;;;;GAMG;AACH,qBAAa,YAAY;IAIX,OAAO,CAAC,eAAe;IAHnC,OAAO,CAAC,YAAY,CAAyB;IAC7C,OAAO,CAAC,OAAO,CAAS;gBAEJ,eAAe,EAAE,oBAAoB;IAMzD,wCAAwC;IACxC,GAAG,CAAC,UAAU,EAAE,eAAe,GAAG,IAAI;IAMtC,mCAAmC;IACnC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAK1B,uCAAuC;IACvC,KAAK,CACH,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,aAAa,CAAC,EAAE,MAAM,EAAE,EACxB,UAAU,GAAE,OAAe,GAC1B,MAAM,EAAE;IA+BX,kCAAkC;IAClC,QAAQ,CACN,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,aAAa,CAAC,EAAE,MAAM,EAAE,EAAE,EAC1B,UAAU,GAAE,OAAe,GAC1B,MAAM,EAAE,EAAE;IAab,IAAI,cAAc,IAAI,oBAAoB,CAEzC;IAED,IAAI,UAAU,IAAI,aAAa,CAAC,eAAe,CAAC,CAE/C;CACF"}
@@ -0,0 +1,19 @@
1
+ import { OffsetConfig } from '../config/types.js';
2
+ /**
3
+ * Computes X-position offsets for symbols to create visual effects
4
+ * like trapezoid perspective.
5
+ */
6
+ export declare class OffsetCalculator {
7
+ private _reelCount;
8
+ private _totalRows;
9
+ private _symbolWidth;
10
+ private _config;
11
+ private _offsets;
12
+ constructor(_reelCount: number, _totalRows: number, _symbolWidth: number, _config: OffsetConfig);
13
+ /** Get X offset for a specific reel and row. */
14
+ getOffset(reelIndex: number, rowIndex: number): number;
15
+ /** Get all offsets as a 2D array [reelIndex][rowIndex]. */
16
+ get offsets(): readonly (readonly number[])[];
17
+ private _compute;
18
+ }
19
+ //# sourceMappingURL=OffsetCalculator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OffsetCalculator.d.ts","sourceRoot":"","sources":["../../src/frame/OffsetCalculator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAmB,MAAM,oBAAoB,CAAC;AAExE;;;GAGG;AACH,qBAAa,gBAAgB;IAIzB,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,OAAO;IANjB,OAAO,CAAC,QAAQ,CAAkB;gBAGxB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,YAAY;IAK/B,gDAAgD;IAChD,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM;IAItD,2DAA2D;IAC3D,IAAI,OAAO,IAAI,SAAS,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,CAE5C;IAED,OAAO,CAAC,QAAQ;CA8BjB"}
@@ -0,0 +1,27 @@
1
+ import { SymbolData } from '../config/types.js';
2
+ /**
3
+ * Weighted random symbol selector using binary search on cumulative weights.
4
+ *
5
+ * Supports exclusion lists for symbols that shouldn't appear during
6
+ * spinning or in buffer areas.
7
+ */
8
+ export declare class RandomSymbolProvider {
9
+ private _symbols;
10
+ private _weights;
11
+ private _cumulativeWeights;
12
+ private _totalWeight;
13
+ private _excludeSpinning;
14
+ private _excludeBuffer;
15
+ constructor(symbolsData: Record<string, SymbolData>);
16
+ /** Get a random symbol, optionally excluding buffer-only symbols. */
17
+ next(useBufferExclusion?: boolean): string;
18
+ /** Set symbols to exclude during spinning. */
19
+ setExcludeSpinning(symbolIds: string[]): void;
20
+ /** Set symbols to exclude from buffer (above/below) areas. */
21
+ setExcludeBuffer(symbolIds: string[]): void;
22
+ /** Update weights at runtime (e.g., for different game modes). */
23
+ updateWeights(symbolsData: Record<string, SymbolData>): void;
24
+ private _rebuildWeights;
25
+ private _pickWeighted;
26
+ }
27
+ //# sourceMappingURL=RandomSymbolProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RandomSymbolProvider.d.ts","sourceRoot":"","sources":["../../src/frame/RandomSymbolProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;;GAKG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAW;IAC3B,OAAO,CAAC,QAAQ,CAAW;IAC3B,OAAO,CAAC,kBAAkB,CAAgB;IAC1C,OAAO,CAAC,YAAY,CAAa;IACjC,OAAO,CAAC,gBAAgB,CAAqB;IAC7C,OAAO,CAAC,cAAc,CAAqB;gBAE/B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;IAMnD,qEAAqE;IACrE,IAAI,CAAC,kBAAkB,GAAE,OAAe,GAAG,MAAM;IAyCjD,8CAA8C;IAC9C,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,IAAI;IAI7C,8DAA8D;IAC9D,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,IAAI;IAI3C,kEAAkE;IAClE,aAAa,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,IAAI;IAM5D,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,aAAa;CActB"}
package/dist/index.cjs ADDED
@@ -0,0 +1,5 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./SpineSymbol-JA5PdEbT.cjs`);let t=require(`pixi.js`),n=require(`gsap`);var r=class{_listeners=new Map;on(e,t,n){return this._add(e,t,n,!1)}once(e,t,n){return this._add(e,t,n,!0)}off(e,t,n){let r=this._listeners.get(e);if(!r)return this;if(!t)return this._listeners.delete(e),this;let i=r.filter(e=>e.fn!==t||n!==void 0&&e.context!==n);return i.length===0?this._listeners.delete(e):this._listeners.set(e,i),this}emit(e,...t){let n=this._listeners.get(e);if(!n||n.length===0)return!1;let r=n.slice();for(let n of r)n.once&&this.off(e,n.fn,n.context),n.fn.apply(n.context,t);return!0}removeAllListeners(e){return e===void 0?this._listeners.clear():this._listeners.delete(e),this}listenerCount(e){return this._listeners.get(e)?.length??0}_add(e,t,n,r){let i=this._listeners.get(e);return i||(i=[],this._listeners.set(e,i)),i.push({fn:t,context:n,once:r}),this}},i=class{_symbolHeight;_symbolGapY;_slotHeight;_minY;_maxY;constructor(e,t,n,r,i,a){this._symbols=e,this._bufferAbove=r,this._onSymbolWrapped=a,this._symbolHeight=t,this._symbolGapY=n,this._slotHeight=t+n,this._maxY=(i+1)*this._slotHeight,this._minY=-(this._bufferAbove+1)*this._slotHeight}displace(e){if(e!==0){for(let t of this._symbols)t.view.y+=e;e>0?this._wrapBottomToTop():this._wrapTopToBottom()}}snapToGrid(){for(let e=0;e<this._symbols.length;e++){let t=(e-this._bufferAbove)*this._slotHeight;this._symbols[e].view.y=t}}setToTopPosition(){for(let e=0;e<this._symbols.length;e++)this._symbols[e].view.y=this._minY-(this._symbols.length-e)*this._slotHeight}getRowY(e){return(e-this._bufferAbove)*this._slotHeight}get slotHeight(){return this._slotHeight}reshape(e,t,n,r){this._symbolHeight=e,this._symbolGapY=t,this._slotHeight=e+t,this._bufferAbove=n,this._maxY=(r+1)*this._slotHeight,this._minY=-(this._bufferAbove+1)*this._slotHeight}_wrapBottomToTop(){let e=this._symbols.length-1,t=this._symbols[e];if(t.view.y<this._maxY)return;let n=this._symbols[0];t.view.y=n.view.y-this._slotHeight,this._symbols.pop(),this._symbols.unshift(t),this._onSymbolWrapped(t,0,`up`)}_wrapTopToBottom(){let e=this._symbols[0];if(e.view.y>=this._minY)return;let t=this._symbols[this._symbols.length-1];e.view.y=t.view.y+this._slotHeight,this._symbols.shift(),this._symbols.push(e),this._onSymbolWrapped(e,this._symbols.length-1,`down`)}},a=class{_frame=[];_remaining=0;setFrame(e){this._frame=[...e],this._remaining=this._frame.length}next(){return this._remaining>0?(this._remaining--,this._frame[this._remaining]):this._frame[0]??``}get hasRemaining(){return this._remaining>0}get remaining(){return this._remaining}reset(){this._frame=[],this._remaining=0}},o=class{name=`standard`;computeDeltaY(e,t,n){let r=e*t*n/1e3;return Math.min(r,e/2)}},s=class extends e.n{onActivate(){this.view.alpha=0,this.view.visible=!1}onDeactivate(){}async playWin(){}stopAnimation(){}resize(){}},c=`__pixi_reels_occupied__`,l=class{container;events;reelIndex;symbols;speed=0;spinningMode=new o;motion;stopSequencer;_symbolFactory;_randomProvider;_viewport;_symbolsData;_visibleRows;_bufferAbove;_symbolWidth;_symbolHeight;_offsetY;_reelHeight;_spinSymbolHeight;_symbolGapY;_symbolGapX;_isDestroyed=!1;_isStopping=!1;_occupiedStubs=[];_occupancy=[];_crossReelResolver=null;constructor(e,n,o,s){this.reelIndex=e.reelIndex,this._symbolFactory=n,this._randomProvider=o,this._viewport=s,this._symbolsData=e.symbolsData,this._visibleRows=e.visibleRows,this._bufferAbove=e.bufferAbove,this._symbolWidth=e.symbolWidth,this._symbolHeight=e.symbolHeight,this._offsetY=e.offsetY??0,this._reelHeight=e.reelHeight??e.visibleRows*e.symbolHeight,this._spinSymbolHeight=e.spinSymbolHeight??e.symbolHeight,this._symbolGapY=e.symbolGapY,this._symbolGapX=e.symbolGapX,this._occupancy=Array(e.visibleRows).fill(null),this.events=new r,this.stopSequencer=new a,this.container=new t.Container,this.container.sortableChildren=!0,this.container.x=e.reelIndex*(e.symbolWidth+e.symbolGapX),this.container.y=this._offsetY,this.container.zIndex=e.reelIndex,this.symbols=e.initialSymbols.map((t,r)=>{let i=n.acquire(t);return i.resize(e.symbolWidth,this._spinSymbolHeight),i}),this.motion=new i(this.symbols,this._spinSymbolHeight,e.symbolGapY,e.bufferAbove,e.visibleRows,(e,t,n)=>this._onSymbolWrapped(e,t,n)),this._setupSymbolPositions(e)}get isDestroyed(){return this._isDestroyed}get isStopping(){return this._isStopping}set isStopping(e){this._isStopping=e}get bufferAbove(){return this._bufferAbove}get bufferBelow(){return this.symbols.length-this._bufferAbove-this._visibleRows}get visibleRows(){return this._visibleRows}get symbolWidth(){return this._symbolWidth}get symbolHeight(){return this._symbolHeight}get reelHeight(){return this._reelHeight}get offsetY(){return this._offsetY}get spinSymbolHeight(){return this._spinSymbolHeight}update(e){if(this.speed===0)return;let t=this.spinningMode.computeDeltaY(this.motion.slotHeight,this.speed,e);t!==0&&this.motion.displace(t)}setStopFrame(e){this.stopSequencer.setFrame(e)}getVisibleSymbols(){let e=[];for(let t=0;t<this._visibleRows;t++){let n=this._occupancy[t];if(n){let t=this.symbols[this._bufferAbove+n.anchorRow];e.push(t.symbolId)}else{let n=this.symbols[this._bufferAbove+t].symbolId;n===`__pixi_reels_occupied__`&&this._crossReelResolver?e.push(this._crossReelResolver(this.reelIndex,t)):e.push(n)}}return e}setCrossReelResolver(e){this._crossReelResolver=e}getSymbolAt(e){let t=this._occupancy[e],n=t?t.anchorRow:e;return this.symbols[this._bufferAbove+n]}_getAnchorRow(e){let t=this._occupancy[e];return t?t.anchorRow:e}_setOccupancy(e,t){t===null?this._occupancy[e]=null:this._occupancy[e]={anchorRow:t}}notifySpinStart(){for(let e=this._bufferAbove;e<this._bufferAbove+this._visibleRows;e++)this.symbols[e].onReelSpinStart()}notifySpinEnd(){for(let e=this._bufferAbove;e<this._bufferAbove+this._visibleRows;e++)this.symbols[e].onReelSpinEnd()}notifyLanded(){for(let e=this._bufferAbove;e<this._bufferAbove+this._visibleRows;e++)this.symbols[e].onReelLanded()}snapToGrid(){this.motion.snapToGrid(),this._finalizeFrame(),this.refreshZIndex()}setSymbolAt(e,t){if(this.speed!==0||this._isStopping)throw Error(`setSymbolAt: cannot swap mid-spin (speed=${this.speed}, isStopping=${this._isStopping}). Wait for the spin to land before calling, or use the result grid via setResult().`);if(!Number.isInteger(e)||e<0||e>=this._visibleRows)throw Error(`setSymbolAt: visibleRow ${e} is out of range [0, ${this._visibleRows}).`);if(!Object.prototype.hasOwnProperty.call(this._symbolsData,t))throw Error(`setSymbolAt: symbolId '${t}' is not registered. Register it via builder.symbols(...).`);let n=this._occupancy[e];if(n)throw Error(`setSymbolAt: visible row ${e} is a non-anchor cell of a big symbol (anchor at row ${n.anchorRow}). Use placeSymbols to rebuild the frame.`);let r=this._bufferAbove+e,i=this.symbols[r],a=this._symbolsData[i.symbolId];if(a?.size&&(a.size.w>1||a.size.h>1))throw Error(`setSymbolAt: row ${e} currently holds the anchor of big symbol '${i.symbolId}' (${a.size.w}x${a.size.h}). Big blocks span multiple cells (and possibly reels); use placeSymbols + the OCCUPIED coordinator instead.`);let o=this._symbolsData[t];if(o?.size&&(o.size.w>1||o.size.h>1))throw Error(`setSymbolAt: '${t}' is a big symbol (${o.size.w}x${o.size.h}). Use placeSymbols + the OCCUPIED coordinator instead.`);this._replaceSymbol(r,t)}placeSymbols(e){let t=this.symbols.length,n=this._bufferAbove;for(let r=0;r<t;r++){let t;t=e[r-n],t===void 0&&(t=this._randomProvider.next(!0)),this._replaceSymbol(r,t)}this.motion.snapToGrid(),this._finalizeFrame(),this.refreshZIndex()}reshape(e,t,n,r){let i=n+e+r;for(;this.symbols.length<i;){let e=this._randomProvider.next(!0),n=this._symbolFactory.acquire(e);n.resize(this._symbolWidth,t),this._placeSymbolView(n.view,n.view.y,this._isUnmasked(e)),this._parentForSymbolId(e).addChild(n.view),this.symbols.push(n)}for(;this.symbols.length>i;){let e=this.symbols.pop();e instanceof s?e.view.parent?.removeChild(e.view):this._symbolFactory.release(e)}this._visibleRows=e,this._symbolHeight=t,this._bufferAbove=n,this._occupancy=Array(e).fill(null),this._reelHeight=e*t+(e-1)*this._symbolGapY;for(let e of this.symbols)e instanceof s||e.resize(this._symbolWidth,t);this.motion.reshape(t,this._symbolGapY,n,e),this.motion.snapToGrid(),this.refreshZIndex()}_computeSymbolZIndex(e,t){return(this._symbolsData[e]?.zIndex??0)*100+t}refreshZIndex(){for(let e=0;e<this.symbols.length;e++){let t=this.symbols[e];if(t instanceof s){t.view.zIndex=e;continue}t.view.zIndex=this._computeSymbolZIndex(t.symbolId,e)}}destroy(){if(!this._isDestroyed){for(let e of this.symbols)e instanceof s?e.destroy():this._symbolFactory.release(e);for(let e of this._occupiedStubs)e.isDestroyed||e.destroy();this._occupiedStubs=[],this.symbols=[],this.events.removeAllListeners(),this.container.destroy({children:!0}),this._isDestroyed=!0,this.events.emit(`destroyed`)}}_isUnmasked(e){return!!this._symbolsData[e]?.unmask}_parentForSymbolId(e){return this._isUnmasked(e)?this._viewport.unmaskedContainer:this.container}_placeSymbolView(e,t,n){n?(e.x=this.container.x,e.y=this.container.y+t):(e.x=0,e.y=t)}_toReelLocalY(e){return e.parent===this._viewport.unmaskedContainer?e.y-this.container.y:e.y}_setupSymbolPositions(e){let t=this._spinSymbolHeight+e.symbolGapY;this._viewport.maskedContainer.addChild(this.container);for(let n=0;n<this.symbols.length;n++){let r=this.symbols[n],i=(n-e.bufferAbove)*t,a=this._isUnmasked(r.symbolId);this._placeSymbolView(r.view,i,a),this._parentForSymbolId(r.symbolId).addChild(r.view)}}_onSymbolWrapped(e,t,n){let r;r=this._isStopping&&this.stopSequencer.hasRemaining?this.stopSequencer.next():this._randomProvider.next(),this._replaceSymbol(this.symbols.indexOf(e),r),this.refreshZIndex()}_replaceSymbol(e,t){let n=this.symbols[e],r=n instanceof s,i=r?n.view.y:this._toReelLocalY(n.view);if(t===`__pixi_reels_occupied__`){if(r){n.view.alpha=0;return}this._symbolFactory.release(n);let t=this._acquireOccupiedStub();t.view.y=i,t.view.x=0,t.view.alpha=0,t.view.visible=!0,t.view.scale.set(1,1),t.view.zIndex=e,t.view.parent!==this.container&&this.container.addChild(t.view),this.symbols[e]=t;return}if(r){this._releaseOccupiedStub(n);let r=this._symbolFactory.acquire(t),a=this._isUnmasked(t);r.resize(this._symbolWidth,this._symbolHeight),this._placeSymbolView(r.view,i,a),r.view.alpha=1,r.view.scale.set(1,1),r.view.zIndex=this._computeSymbolZIndex(t,e),this._parentForSymbolId(t).addChild(r.view),this.symbols[e]=r,this.events.emit(`symbol:created`,t,e);return}if(n.symbolId===t){n.view.alpha=1,n.view.scale.set(1,1),n.view.rotation=0,n.view.filters=null,n.view.zIndex=this._computeSymbolZIndex(t,e);let r=this._parentForSymbolId(t);n.view.parent!==r&&r.addChild(n.view),this._placeSymbolView(n.view,i,this._isUnmasked(t));return}this._symbolFactory.release(n);let a=this._symbolFactory.acquire(t),o=this._isUnmasked(t);a.resize(this._symbolWidth,this._symbolHeight),this._placeSymbolView(a.view,i,o),a.view.alpha=1,a.view.scale.set(1,1),a.view.zIndex=this._computeSymbolZIndex(t,e),this._parentForSymbolId(t).addChild(a.view),this.symbols[e]=a,this.events.emit(`symbol:created`,t,e)}_acquireOccupiedStub(){for(let e of this._occupiedStubs)if(!e.view.parent)return e;let e=new s;return e.activate(c),this._occupiedStubs.push(e),e}_releaseOccupiedStub(e){e.view.parent?.removeChild(e.view)}_finalizeFrame(){this._occupancy=Array(this._visibleRows).fill(null);for(let e=0;e<this._visibleRows;e++){let t=this.symbols[this._bufferAbove+e];if(t instanceof s)continue;let n=this._symbolsData[t.symbolId];if(!n?.size)continue;let r=n.size.w,i=n.size.h;if(r===1&&i===1)continue;let a=r*this._symbolWidth+(r-1)*this._symbolGapX,o=i*this._symbolHeight+(i-1)*this._symbolGapY;t.resize(a,o);for(let t=1;t<i;t++){let n=e+t;n<this._visibleRows&&(this._occupancy[n]={anchorRow:e})}}}},u=class{build(e,n,r){let i=new t.Graphics;return this._draw(i,e,n,r),i}update(e,t,n,r){e.clear(),this._draw(e,t,n,r)}_draw(e,t,n,r){if(t.length===0){e.rect(0,0,n,r).fill({color:16777215});return}for(let n of t)e.rect(n.x,n.y,n.width,n.height).fill({color:16777215})}},d=class{build(e,n,r){let i=new t.Graphics;return this._draw(i,e,n,r),i}update(e,t,n,r){e.clear(),this._draw(e,t,n,r)}_draw(e,t,n,r){e.rect(0,0,n,r).fill({color:16777215})}},f=class extends t.Container{maskedContainer;unmaskedContainer;spotlightContainer;dimOverlay;_mask;_maskStrategy;_maskWidth;_maskHeight;_maskRects=[];_isDestroyed=!1;constructor(e,n,r={x:0,y:0},i=new u){super(),this.x=r.x,this.y=r.y,this._maskStrategy=i,this._maskWidth=e,this._maskHeight=n,this._mask=this._maskStrategy.build(this._maskRects,e,n),this.maskedContainer=new t.Container,this.maskedContainer.sortableChildren=!0,this.maskedContainer.addChild(this._mask),this.maskedContainer.mask=this._mask,this.addChild(this.maskedContainer),this.unmaskedContainer=new t.Container,this.unmaskedContainer.sortableChildren=!0,this.addChild(this.unmaskedContainer),this.dimOverlay=new t.Graphics,this.dimOverlay.rect(0,0,e,n).fill({color:0,alpha:.5}),this.dimOverlay.visible=!1,this.addChild(this.dimOverlay),this.spotlightContainer=new t.Container,this.spotlightContainer.sortableChildren=!0,this.addChild(this.spotlightContainer)}get maskWidth(){return this._maskWidth}get maskHeight(){return this._maskHeight}get maskRects(){return this._maskRects}get maskGraphics(){return this._mask}get isDestroyed(){return this._isDestroyed}showDim(e=.5){this.dimOverlay.alpha=e,this.dimOverlay.visible=!0}hideDim(){this.dimOverlay.visible=!1}updateMaskSize(e,t,n=[]){this._maskWidth=e,this._maskHeight=t,this._maskRects=n,this._maskStrategy.update(this._mask,this._maskRects,e,t)}destroy(){this._isDestroyed||(this._isDestroyed=!0,super.destroy({children:!0}))}},p=class{_reel;_speed;_resolve=null;_isActive=!1;constructor(e,t){this._reel=e,this._speed=t}get reel(){return this._reel}get isActive(){return this._isActive}async run(e){return this._isActive=!0,this._reel.events.emit(`phase:enter`,this.name),new Promise(t=>{this._resolve=()=>{this._isActive=!1,this._reel.events.emit(`phase:exit`,this.name),t()},this.onEnter(e)})}skip(){!this.skippable||!this._isActive||(this.onSkip(),this._complete())}forceComplete(){this._isActive&&(this.onSkip(),this._complete())}_complete(){if(this._resolve){let e=this._resolve;this._resolve=null,e()}}},m=n.gsap;function h(e){m=e}function g(){return m}var _=class extends p{name=`start`;skippable=!0;_tween=null;_delayedCall=null;onEnter(e){let t=this._reel;this._speed;let n=e.delay??0;t.spinningMode=e.spinningMode,t.speed=0,n>0?this._delayedCall=g().delayedCall(n/1e3,()=>this._launch()):this._launch()}_launch(){this._delayedCall=null;let e=this._reel,t=this._speed,n=(t.accelerationDuration??300)/1e3,r=t.accelerationEase??`power2.in`;this._tween=g().timeline(),t.bounceDistance>0&&this._tween.to(e,{speed:-2,duration:.05,ease:`power1.out`}),this._tween.to(e,{speed:t.spinSpeed,duration:n,ease:r,onComplete:()=>{e.notifySpinStart(),this._complete()}})}update(e){}onSkip(){this._kill(),this._reel.speed=this._speed.spinSpeed}_kill(){this._delayedCall&&=(this._delayedCall.kill(),null),this._tween&&=(this._tween.kill(),null)}},v=class extends p{name=`spin`;skippable=!1;_elapsed=0;_minTime=0;_readyToStop=!1;onEnter(e){this._elapsed=0,this._minTime=e.minimumSpinTime??this._speed.minimumSpinTime??500,this._readyToStop=!1}update(e){this._elapsed+=e,this._readyToStop&&this._elapsed>=this._minTime&&this._complete()}resolve(){this._readyToStop=!0,this._elapsed>=this._minTime&&this._complete()}onSkip(){}},y=class extends p{name=`stop`;skippable=!0;_config=null;_delayTween=null;_bounceTween=null;_stage=`delay`;_baseY=0;onEnter(e){this._config=e,this._stage=`delay`,this._baseY=this._reel.container.y;let t=(e.delay??0)/1e3;t>0?this._delayTween=g().delayedCall(t,()=>this._beginSpinOut()):this._beginSpinOut()}_beginSpinOut(){if(!this._config)return;let e=this._reel,t=this._speed;e.setStopFrame(this._config.targetFrame),e.isStopping=!0,e.speed=t.spinSpeed,this._stage=`spinning`}update(e){this._stage===`spinning`&&(this._reel.stopSequencer.hasRemaining||this._landAndBounce())}_landAndBounce(){let e=this._reel,t=this._speed;e.speed=0,e.isStopping=!1,e.snapToGrid(),e.notifySpinEnd(),e.notifyLanded();let n=t.bounceDistance;if(n<=0){this._stage=`done`,this._complete();return}let r=(t.bounceDuration??600)/2e3;this._stage=`bouncing`,this._bounceTween=g().timeline(),this._bounceTween.to(e.container,{y:this._baseY+n,duration:r,ease:`power1.out`}),this._bounceTween.to(e.container,{y:this._baseY,duration:r,ease:`power1.out`,onComplete:()=>{this._stage=`done`,this._complete()}})}onSkip(){this._killTweens();let e=this._reel;if(e.speed=0,e.isStopping=!1,this._stage!==`done`&&this._config){let t=e.bufferAbove,n=e.visibleRows;e.placeSymbols(this._config.targetFrame.slice(t,t+n))}e.snapToGrid(),e.container.y=this._baseY,this._stage=`done`}_killTweens(){this._delayTween&&=(this._delayTween.kill(),null),this._bounceTween&&=(this._bounceTween.kill(),null)}},b=class extends p{name=`anticipation`;skippable=!0;_tween=null;onEnter(e){let t=this._reel,n=this._speed,r=(e.duration??n.anticipationDelay)/1e3,i=n.spinSpeed*(e.speedMultiplier??.3);if(r<=0){this._complete();return}this._tween=g().timeline(),this._tween.to(t,{speed:i,duration:r*.35,ease:`power2.out`}),this._tween.to({},{duration:r*.65,onComplete:()=>this._complete()})}update(e){}onSkip(){this._kill(),this._reel.speed=this._speed.spinSpeed}_kill(){this._tween&&=(this._tween.kill(),null)}},x=class{_registry=new Map;constructor(){this._registry.set(`start`,(e,t)=>new _(e,t)),this._registry.set(`spin`,(e,t)=>new v(e,t)),this._registry.set(`stop`,(e,t)=>new y(e,t)),this._registry.set(`anticipation`,(e,t)=>new b(e,t))}register(e,t){this._registry.set(e,(e,n)=>new t(e,n))}registerFactory(e,t){this._registry.set(e,t)}create(e,t,n){let r=this._registry.get(e);if(!r)throw Error(`Phase '${e}' not registered. Available: ${[...this._registry.keys()].join(`, `)}`);return r(t,n)}has(e){return this._registry.has(e)}},S=class{_callbacks=[];_isDestroyed=!1;constructor(e){this._ticker=e}get isDestroyed(){return this._isDestroyed}add(e){this._isDestroyed||(this._callbacks.push(e),this._ticker.add(e))}remove(e){let t=this._callbacks.indexOf(e);t!==-1&&(this._callbacks.splice(t,1),this._ticker.remove(e))}destroy(){if(!this._isDestroyed){for(let e of this._callbacks)this._ticker.remove(e);this._callbacks.length=0,this._isDestroyed=!0}}};function C(e,t){return e.map(e=>w(e,t))}function w(e,t){let n=[...e];for(let r=1;r<=t;r++){let t=e[-r];t!==void 0&&(n[-r]=t)}return n}function T(e){let t=[...e.visible];if(e.bufferBelow)for(let n=0;n<e.bufferBelow.length;n++){let r=e.bufferBelow[n];r!==void 0&&(t[e.visible.length+n]=r)}if(e.bufferAbove)for(let n=0;n<e.bufferAbove.length;n++){let r=e.bufferAbove[n];r!==void 0&&(t[-1-n]=r)}return t}function E(e){if(e.length===0)return e;let t=Array.isArray(e[0]);for(let n=1;n<e.length;n++)if(Array.isArray(e[n])!==t){let r=t?`string[]`:`ColumnTarget`,i=Array.isArray(e[n])?`string[]`:`ColumnTarget`;throw Error(`setResult/initialFrame: mixed input shapes — column 0 is ${r} but column ${n} is ${i}. Use one shape consistently for all reels.`)}return t?e:e.map(T)}var D=class{_reels;_speedManager;_frameBuilder;_phaseFactory;_events;_tickerRef;_spinningMode;_defaultSpinMode;_currentSpinMode=`standard`;_hooks;_isSpinning=!1;_spinStartTime=0;_resultSymbols=null;_anticipationReels=[];_stopDelayOverride=null;_activePhases=new Map;_landedReels=new Set;_heldReels=new Set;_wasSkipped=!1;_skipPending=!1;_isDestroyed=!1;_currentSpinResolve=null;_spinGeneration=0;constructor(e,t,n,r,i,a,s,c=`standard`,l){this._reels=e,this._speedManager=t,this._frameBuilder=n,this._phaseFactory=r,this._events=i,this._tickerRef=new S(a),this._spinningMode=s??new o,this._defaultSpinMode=c,this._hooks=l??{isMultiWaysSlot:!1,symbolsData:{},peekTargetShape:()=>null,clearTargetShape:()=>{},multiwaysReelPixelHeight:0,symbolGapY:0,getPinsOnReel:()=>[],migratePinsForReel:()=>[],refreshPinOverlaysForReel:()=>{},buildPinOverlayTweens:()=>[]},this._tickerRef.add(e=>this._onTick(e))}get isSpinning(){return this._isSpinning}get isDestroyed(){return this._isDestroyed}async spin(e){if(this._isSpinning)throw Error(`Cannot start a new spin while one is in progress.`);let t=e?.mode??this._defaultSpinMode;if(t===`cascade`&&!this._phaseFactory.has(`dropStart`))throw Error(`spin({ mode: 'cascade' }) requires .cascade(...) on the builder.`);this._currentSpinMode=t,this._isSpinning=!0,this._wasSkipped=!1,this._skipPending=!1,this._spinStartTime=performance.now(),this._resultSymbols=null,this._anticipationReels=[],this._stopDelayOverride=null,this._landedReels.clear(),this._activePhases.clear(),this._heldReels=this._normalizeHoldReels(e?.holdReels),this._spinGeneration++;let n=this._spinGeneration,r=this._speedManager.active;this._events.emit(`spin:start`);let i=new Promise(e=>{this._currentSpinResolve=e});if(this._heldReels.size===this._reels.length)return Promise.resolve().then(()=>{n===this._spinGeneration&&this._finishSpin()}),i;for(let e=0;e<this._reels.length;e++)this._heldReels.has(e)||this._startReel(e,r,n);return i}_normalizeHoldReels(e){let t=new Set;if(!e)return t;for(let n of e)Number.isInteger(n)&&n>=0&&n<this._reels.length&&t.add(n);return t}setResult(e){this._isSpinning&&(this._coordinateBigSymbols(e,e=>{let t=this._hooks.peekTargetShape();return t?t[e]:this._reels[e].visibleRows}),this._resultSymbols=e,this._tryBeginStopSequence(),this._skipPending&&(this._skipPending=!1,this.skip()))}setAnticipation(e){this._anticipationReels=e.filter(e=>!this._heldReels.has(e))}setStopDelays(e){this._stopDelayOverride=[...e]}requestSkip(){if(this._isSpinning){if(this._resultSymbols){this.skip();return}this._skipPending=!0}}skip(){if(this._isSpinning){this._wasSkipped=!0,this._events.emit(`skip:requested`);for(let[,e]of this._activePhases)e.forceComplete();if(this._activePhases.clear(),this._spinGeneration++,this._resultSymbols){let e=this._hooks.peekTargetShape(),t=this._coordinateBigSymbols(this._resultSymbols,t=>e?e[t]:this._reels[t].visibleRows);for(let n=0;n<this._reels.length;n++){if(this._landedReels.has(n)||this._heldReels.has(n))continue;let r=this._reels[n];r.speed=0,r.isStopping=!1,this._hooks.isMultiWaysSlot&&e&&this._applyReshape(n,e[n]),r.placeSymbols(t[n]),r.notifySpinEnd(),r.notifyLanded(),this._markLanded(n)}}else for(let e=0;e<this._reels.length;e++){if(this._landedReels.has(e)||this._heldReels.has(e))continue;let t=this._reels[e];t.speed=0,t.isStopping=!1,t.snapToGrid(),t.notifySpinEnd(),t.notifyLanded(),this._markLanded(e)}this._events.emit(`skip:completed`)}}destroy(){this._isDestroyed||=(this._tickerRef.destroy(),this._activePhases.clear(),!0)}_targetCellHeightFor(e,t){return this._hooks.multiwaysReelPixelHeight<=0?e.symbolHeight:(this._hooks.multiwaysReelPixelHeight-(t-1)*this._hooks.symbolGapY)/t}_applyReshape(e,t){let n=this._reels[e],r=this._targetCellHeightFor(n,t),i=n.visibleRows;return t===i&&r===n.symbolHeight?!1:(this._events.emit(`adjust:start`,{reelIndex:e,fromRows:i,toRows:t}),n.reshape(t,r,n.bufferAbove,n.bufferBelow),this._hooks.refreshPinOverlaysForReel(e),this._events.emit(`adjust:complete`,{reelIndex:e}),!0)}async _startReel(e,t,n){if(n!==this._spinGeneration)return;let r=this._reels[e],i=this._currentSpinMode===`cascade`?{start:`dropStart`,stop:`dropStop`}:{start:`start`,stop:`stop`},a=this._phaseFactory.create(i.start,r,t);if(this._activePhases.set(e,a),await a.run({spinningMode:this._spinningMode,delay:e*t.spinDelay}),n!==this._spinGeneration)return;let o=this._phaseFactory.create(`spin`,r,t);this._activePhases.set(e,o);let s=o.run({}),c=!0;for(let e=0;e<this._reels.length;e++){if(this._heldReels.has(e))continue;let t=this._activePhases.get(e);if(!t||t.name!==`spin`){c=!1;break}}if(c&&(this._events.emit(`spin:allStarted`),this._tryBeginStopSequence()),await s,n!==this._spinGeneration||this._hooks.isMultiWaysSlot&&this._phaseFactory.has(`adjust`)&&(await this._runAdjustForReel(r,e,t,n),n!==this._spinGeneration))return;let l=this._stopDelayFor(e,t),u=this._frameFor(e);if(this._anticipationReels.includes(e)&&t.anticipationDelay>0){this._events.emit(`spin:stopping`,e);let i=this._phaseFactory.create(`anticipation`,r,t);if(this._activePhases.set(e,i),await i.run({}),n!==this._spinGeneration)return}else this._events.emit(`spin:stopping`,e);let d=this._phaseFactory.create(i.stop,r,t);this._activePhases.set(e,d),await d.run({targetFrame:u,delay:l}),n===this._spinGeneration&&this._markLanded(e)}async _runAdjustForReel(e,t,n,r){let i=this._hooks.peekTargetShape(),a=i?i[t]:e.visibleRows,o=this._targetCellHeightFor(e,a),s=this._hooks.buildPinOverlayTweens(t,o,this._hooks.symbolGapY);if(!this._applyReshape(t,a)&&s.length===0||s.length===0)return;let c=this._phaseFactory.create(`adjust`,e,n);this._activePhases.set(t,c),await c.run({pinOverlays:s})}_stopDelayFor(e,t){return this._stopDelayOverride?this._stopDelayOverride[e]??0:e*t.stopDelay}_cachedFrames=null;_frameFor(e){return this._cachedFrames?this._cachedFrames[e]:[]}_tryBeginStopSequence(){if(!this._resultSymbols)return;for(let e=0;e<this._reels.length;e++){if(this._heldReels.has(e))continue;let t=this._activePhases.get(e);if(!t||t.name!==`spin`)return}let e=this._hooks.peekTargetShape(),t=t=>e?e[t]:this._reels[t].visibleRows,n=this._coordinateBigSymbols(this._resultSymbols,t),r=[];for(let e=0;e<this._reels.length;e++){if(this._heldReels.has(e)){r.push([]);continue}let i=this._reels[e],a=t(e);r.push(this._frameBuilder.build(e,a,i.bufferAbove,i.bufferBelow,n[e]))}this._cachedFrames=r;for(let e=0;e<this._reels.length;e++){if(this._heldReels.has(e))continue;let t=this._activePhases.get(e);t?.resolve&&t.resolve()}}_coordinateBigSymbols(e,t){let n=C(e,this._reels[0]?.bufferAbove??0),r=this._hooks.symbolsData;for(let e=0;e<n.length;e++){let i=t(e);for(let a=0;a<i&&a<n[e].length;a++){let o=n[e][a],s=r[o];if(!s?.size)continue;let l=s.size.w,u=s.size.h;if(!(l===1&&u===1)){if(a+u>i)throw Error(`big symbol '${o}' (${l}x${u}) at (col=${e}, row=${a}) exceeds reel ${e} height ${i}.`);if(e+l>n.length)throw Error(`big symbol '${o}' (${l}x${u}) at (col=${e}, row=${a}) exceeds reel count ${n.length}.`);for(let n=0;n<l;n++){let r=e+n,i=t(r);if(a+u>i)throw Error(`big symbol '${o}' (${l}x${u}) at (col=${e}, row=${a}) exceeds reel ${r} height ${i}.`)}for(let t=0;t<u;t++)for(let r=0;r<l;r++)r===0&&t===0||(n[e+r][a+t]=c)}}}return n}_markLanded(e){if(this._landedReels.has(e))return;this._landedReels.add(e);let t=this._reels[e],n=t.getVisibleSymbols();t.events.emit(`landed`,n),this._events.emit(`spin:reelLanded`,e,n),this._landedReels.size===this._reels.length-this._heldReels.size&&this._finishSpin()}_finishSpin(){let e={symbols:this._reels.map(e=>e.getVisibleSymbols()),wasSkipped:this._wasSkipped,duration:performance.now()-this._spinStartTime};this._isSpinning=!1,this._activePhases.clear(),this._cachedFrames=null,this._hooks.clearTargetShape(),this._events.emit(`spin:allLanded`,e),this._events.emit(`spin:complete`,e),this._currentSpinResolve&&=(this._currentSpinResolve(e),null)}_onTick(e){if(!this._isSpinning)return;let t=e.deltaMS;for(let e of this._reels)e.update(t);for(let e of this._activePhases.values())e.isActive&&e.update(t)}},O=class{_profiles=new Map;_activeName;_active;constructor(e,t){for(let[t,n]of e)this._profiles.set(t,n);let n=this._profiles.get(t);if(!n)throw Error(`Speed profile '${t}' not found. Available: ${[...this._profiles.keys()].join(`, `)}`);this._activeName=t,this._active=n}get active(){return this._active}get activeName(){return this._activeName}set(e){let t=this._profiles.get(e);if(!t)throw Error(`Speed profile '${e}' not found. Available: ${[...this._profiles.keys()].join(`, `)}`);let n=this._active;return this._activeName=e,this._active=t,{previous:n,current:t}}addProfile(e,t){this._profiles.set(e,t)}getProfile(e){return this._profiles.get(e)}get profileNames(){return[...this._profiles.keys()]}},k=class{_reels;_viewport;_promoted=[];_isActive=!1;_isDestroyed=!1;_cycleAbort=null;constructor(e,t){this._reels=e,this._viewport=t}get isActive(){return this._isActive}get isDestroyed(){return this._isDestroyed}async show(e,t={}){this.hide();let{dimAmount:n=.5,playWinAnimation:r=!0,promoteAboveMask:i=!0}=t;this._isActive=!0,this._viewport.showDim(n);let a=[],o=new Set;for(let t of e){let e=this._reels[t.reelIndex];if(!e)continue;let n=e.getSymbolAt(t.rowIndex);if(!n)continue;let s=`${t.reelIndex}:${e._getAnchorRow(t.rowIndex)}`;if(!o.has(s)){if(o.add(s),i){let e=n.view.parent;this._promoted.push({symbol:n,originalParent:e,position:t});let r=n.view.getGlobalPosition();this._viewport.spotlightContainer.addChild(n.view);let i=this._viewport.spotlightContainer.toLocal(r);n.view.x=i.x,n.view.y=i.y}r&&a.push(n.playWin())}}a.length>0&&await Promise.all(a)}hide(){this._cycleAbort&&=(this._cycleAbort.abort(),null);for(let{symbol:e,originalParent:t}of this._promoted)if(e.view.parent===this._viewport.spotlightContainer){if(t){let n=e.view.getGlobalPosition();t.addChild(e.view);let r=t.toLocal(n);e.view.x=r.x,e.view.y=r.y}e.stopAnimation()}this._promoted=[],this._viewport.hideDim(),this._isActive=!1}async cycle(e,t={}){let{displayDuration:n=2e3,gapDuration:r=300,cycles:i=1}=t;if(e.length===0)return;this._cycleAbort=new AbortController;let a=this._cycleAbort.signal,o=0;for(;i===-1||o<i;){for(let i of e){if(a.aborted||(await this.show(i.positions,t),await this._wait(n,a),a.aborted))return;this.hide(),await this._wait(r,a)}o++}}destroy(){this._isDestroyed||=(this.hide(),!0)}_wait(e,t){return new Promise(n=>{if(t.aborted){n();return}let r=setTimeout(n,e);t.addEventListener(`abort`,()=>{clearTimeout(r),n()},{once:!0})})}};function A(e,t){return`${e}:${t}`}var j=class e extends t.Container{static PIN_OVERLAY_Z_INDEX=1e4;_events=new r;_reels;_viewport;_spinController;_speedManager;_spotlight;_symbolFactory;_frameBuilder;_frameAPI;_isDestroyed=!1;_pins=new Map;_pinOverlays=new Map;_targetShape=null;_resultSetForCurrentSpin=!1;_isMultiWaysSlot;_multiwaysMinRows=0;_multiwaysMaxRows=0;_multiwaysReelPixelHeight=0;_symbolsData;_configGapX;constructor(e){super(),this._reels=e.reels,this._viewport=e.viewport,this._symbolFactory=e.symbolFactory,this._frameBuilder=e.frameBuilder,this._symbolsData=e.config.symbols,this._configGapX=e.config.grid.symbolGap.x,this._isMultiWaysSlot=!!e.config.grid.multiways,e.config.grid.multiways&&(this._multiwaysMinRows=e.config.grid.multiways.minRows,this._multiwaysMaxRows=e.config.grid.multiways.maxRows,this._multiwaysReelPixelHeight=e.config.grid.multiways.reelPixelHeight);for(let e of this._reels)e.setCrossReelResolver((e,t)=>{let n=this.getSymbolFootprint(e,t),r=this._reels[n.anchor.col];return r.symbols[r.bufferAbove+n.anchor.row].symbolId});let t=this._frameBuilder;this._frameAPI={use(e){t.use(e)},remove(e){t.remove(e)},get middleware(){return t.middleware}},this._speedManager=new O(e.config.speeds,e.config.initialSpeed),this._spinController=new D(e.reels,this._speedManager,e.frameBuilder,e.phaseFactory,this._events,e.config.ticker,e.spinningMode,e.defaultSpinMode,{isMultiWaysSlot:this._isMultiWaysSlot,symbolsData:this._symbolsData,peekTargetShape:()=>this._peekTargetShape(),clearTargetShape:()=>this._clearTargetShape(),multiwaysReelPixelHeight:this._multiwaysReelPixelHeight,symbolGapY:e.config.grid.symbolGap.y,getPinsOnReel:e=>this._pinsOnReel(e),migratePinsForReel:(e,t)=>this._migratePinsForReel(e,t),refreshPinOverlaysForReel:e=>this.refreshPinOverlaysForReel(e),buildPinOverlayTweens:(e,t,n)=>this._buildPinOverlayTweens(e,t,n)}),this._spotlight=new k(e.reels,e.viewport),this.addChild(this._viewport),this._events.on(`spin:allLanded`,()=>this._onSpinLanded()),this._events.on(`spin:start`,()=>this._onSpinStart())}get events(){return this._events}async spin(e){return this._spinController.spin(e)}setResult(e){let t=E(e),n=this._applyPinsToGrid(t);this._resultSetForCurrentSpin=!0,this._spinController.setResult(n)}setAnticipation(e){this._spinController.setAnticipation(e)}setStopDelays(e){this._spinController.setStopDelays(e)}skip(){this._spinController.skip()}requestSkip(){this._spinController.requestSkip()}setSymbolAt(e,t,n){if(e<0||e>=this._reels.length)throw RangeError(`setSymbolAt: col ${e} out of range [0, ${this._reels.length})`);if(this._pins.has(A(e,t)))throw Error(`setSymbolAt: cell (${e}, ${t}) has an active pin. Call unpin(col, row) first if you intend to overwrite it.`);this._reels[e].setSymbolAt(t,n)}setDropOrder(e,t){if(Array.isArray(e)){this._spinController.setStopDelays(e);return}let n=this._reels.length,r=t??Math.max(this._speedManager.active.stopDelay,150),i;i=e===`all`?Array(n).fill(0):e===`ltr`?Array.from({length:n},(e,t)=>t*r):Array.from({length:n},(e,t)=>(n-1-t)*r),this._spinController.setStopDelays(i)}get isSpinning(){return this._spinController.isSpinning}get isMultiWaysSlot(){return this._isMultiWaysSlot}setShape(e){if(!this._isMultiWaysSlot)throw Error(`setShape(): slot was not built with .multiways(...) — call ReelSetBuilder.multiways() first.`);if(this._resultSetForCurrentSpin)throw Error(`setShape(): must be called BEFORE setResult() in the current spin. Calling setShape after setResult corrupts the cached frames (pins were overlaid at their pre-migration rows). Reorder: spin() → setShape() → setResult().`);if(e.length!==this._reels.length)throw Error(`setShape(): rowsPerReel length ${e.length} must equal reelCount ${this._reels.length}.`);for(let t=0;t<e.length;t++){let n=e[t];if(n<this._multiwaysMinRows||n>this._multiwaysMaxRows)throw Error(`setShape(): rowsPerReel[${t}] = ${n} out of range [${this._multiwaysMinRows}, ${this._multiwaysMaxRows}].`)}let t=!0;for(let n=0;n<this._reels.length;n++)if(this._reels[n].visibleRows!==e[n]){t=!1;break}if(!t){this._targetShape=[...e],this._events.emit(`shape:changed`,[...e]);for(let t=0;t<this._reels.length;t++)this._migratePinsForReel(t,e[t])}}_peekTargetShape(){return this._targetShape}_clearTargetShape(){this._targetShape=null}getVisibleGrid(){return this._reels.map(e=>e.getVisibleSymbols())}getSymbolFootprint(e,t){if(e<0||e>=this._reels.length)throw RangeError(`getSymbolFootprint: col ${e} out of range [0, ${this._reels.length})`);let n=this._reels[e];if(t<0||t>=n.visibleRows)throw RangeError(`getSymbolFootprint: row ${t} out of range [0, ${n.visibleRows})`);let r=n._getAnchorRow(t),i=n.getSymbolAt(t),a=this._symbolsData[i.symbolId],o=a?.size&&(a.size.w>1||a.size.h>1)?a.size:{w:1,h:1},s=e;for(let t=e-1;t>=0;t--){let n=this._reels[t];if(r>=n.visibleRows)break;let i=n._getAnchorRow(r),a=n.getSymbolAt(r),o=this._symbolsData[a.symbolId];if(o?.size&&o.size.w>e-t)return s=t,{anchor:{col:s,row:i},size:o.size}}return{anchor:{col:s,row:r},size:o}}getBlockBounds(e,t){let n=this.getSymbolFootprint(e,t),r=this.getCellBounds(n.anchor.col,n.anchor.row),i=this._reels[n.anchor.col],a=this._configGapX,o=i.motion.slotHeight,s=r.width,c=r.height,l=o-c;return{x:r.x,y:r.y,width:n.size.w*s+(n.size.w-1)*a,height:n.size.h*c+(n.size.h-1)*l}}get speed(){return this._speedManager}setSpeed(e){let{previous:t,current:n}=this._speedManager.set(e);this._events.emit(`speed:changed`,n,t)}get spotlight(){return this._spotlight}get reels(){return this._reels}getReel(e){return this._reels[e]}getCellBounds(e,t){if(e<0||e>=this._reels.length)throw RangeError(`getCellBounds: col ${e} out of range [0, ${this._reels.length})`);let n=this._reels[e];if(t<0||t>=n.visibleRows)throw RangeError(`getCellBounds: row ${t} out of range [0, ${n.visibleRows})`);return{x:this._viewport.x+n.container.x,y:this._viewport.y+n.offsetY+t*n.motion.slotHeight,width:n.symbolWidth,height:n.symbolHeight}}get viewport(){return this._viewport}pin(e,t,n,r){if(e<0||e>=this._reels.length)throw Error(`pin(): col ${e} out of range [0, ${this._reels.length})`);let i=this._reels[e];if(t<0||t>=i.visibleRows)throw Error(`pin(): row ${t} out of range [0, ${i.visibleRows})`);let a={col:e,row:t,originRow:r?.originRow??t,migration:r?.migration??`origin`,symbolId:n,turns:r?.turns??`permanent`,payload:r?.payload},o=A(e,t);return this._pins.has(o)&&this._destroyPinOverlay(o),this._pins.set(o,a),this._spinController.isSpinning?this._ensurePinOverlay(a):this._applyPinVisually(e,t,n),this._events.emit(`pin:placed`,a),a}unpin(e,t){let n=A(e,t),r=this._pins.get(n);r&&(this._pins.delete(n),this._destroyPinOverlay(n),this._events.emit(`pin:expired`,r,`explicit`))}get pins(){return this._pins}getPin(e,t){return this._pins.get(A(e,t))}async movePin(e,t,n){if(this._spinController.isSpinning)throw Error(`movePin(): cannot move pin while spinning`);let r=A(e.col,e.row),i=this._pins.get(r);if(!i)throw Error(`movePin(): no pin at (${e.col}, ${e.row})`);if(t.col<0||t.col>=this._reels.length)throw Error(`movePin(): to col ${t.col} out of range [0, ${this._reels.length})`);let a=this._reels[t.col];if(t.row<0||t.row>=a.visibleRows)throw Error(`movePin(): to row ${t.row} out of range [0, ${a.visibleRows})`);if(e.col===t.col&&e.row===t.row){this._events.emit(`pin:moved`,i,{col:e.col,row:e.row});return}let o=A(t.col,t.row);if(this._pins.has(o))throw Error(`movePin(): a pin already exists at (${t.col}, ${t.row})`);this._pins.delete(r);let s={...i,col:t.col,row:t.row,originRow:t.row};this._pins.set(o,s),this._destroyPinOverlay(r);let c=this._reels[e.col],l=c.getSymbolAt(e.row).view.y,u=a.getSymbolAt(t.row).view.y,d=c.container.x,f=a.container.x,p=n?.backfill??this._frameBuilder.randomProvider.next(!1),m=c.getVisibleSymbols();m[e.row]=p,c.placeSymbols(m);let h=this._symbolFactory.acquire(i.symbolId);h.resize(c.symbolWidth,c.symbolHeight),h.view.x=d,h.view.y=l,this._viewport.unmaskedContainer.addChild(h.view);try{n?.onFlightCreated?.(h)}catch{}let _=(n?.duration??400)/1e3,v=n?.easing??`power2.inOut`;await new Promise(e=>{g().to(h.view,{x:f,y:u,duration:_,ease:v,onComplete:()=>e()})});try{n?.onFlightCompleted?.(h)}catch{}let y=a.getVisibleSymbols();y[t.row]=i.symbolId,a.placeSymbols(y),this._viewport.unmaskedContainer.removeChild(h.view),this._symbolFactory.release(h),this._events.emit(`pin:moved`,s,{col:e.col,row:e.row})}get frame(){return this._frameAPI}get isDestroyed(){return this._isDestroyed}destroy(){if(!this._isDestroyed){this._isDestroyed=!0,this._spotlight.destroy(),this._spinController.destroy();for(let e of this._reels)e.destroy();this._destroyAllPinOverlays(),this._symbolFactory.destroy(),this._viewport.destroy(),this._pins.clear(),this._events.emit(`destroyed`),this._events.removeAllListeners(),super.destroy({children:!0})}}_applyPinsToGrid(e){if(this._pins.size===0)return e;let t=C(e,this._reels[0]?.bufferAbove??0);for(let e of this._pins.values())e.col<t.length&&e.row<t[e.col].length&&(t[e.col][e.row]=e.symbolId);return t}_pinsOnReel(e){let t=[];for(let n of this._pins.values())n.col===e&&t.push(n);return t}_migratePinsForReel(e,t){let n=[],r=this._pinsOnReel(e);for(let i of r){let r=i.row,a,o,s=i.originRow;if(i.migration===`frozen`?r<t?(a=r,o=!1):(a=t-1,o=!0,s=a):(a=Math.min(i.originRow,t-1),o=a!==i.originRow),a===r&&s===i.originRow)continue;let c=A(i.col,r),l=A(i.col,a);this._pins.delete(c);let u={...i,row:a,originRow:s};this._pins.set(l,u);let d=this._pinOverlays.get(c);d&&(this._pinOverlays.delete(c),this._pinOverlays.set(l,{pin:u,overlay:d.overlay})),n.push({pin:u,fromRow:r,toRow:a,clamped:o}),this._events.emit(`pin:migrated`,u,{fromRow:r,toRow:a,clamped:o,reelIndex:e})}return n}_applyPinVisually(e,t,n){let r=this._reels[e],i=r.getVisibleSymbols();i[t]!==n&&(i[t]=n,r.placeSymbols(i))}_onSpinLanded(){if(this._destroyAllPinOverlays(),this._pins.size===0)return;let e=[];for(let t of this._pins.values())typeof t.turns==`number`&&(--t.turns,t.turns<=0&&e.push(t));for(let t of e)this._pins.delete(A(t.col,t.row)),this._events.emit(`pin:expired`,t,`turns`)}_onSpinStart(){if(this._resultSetForCurrentSpin=!1,this._pins.size>0){let e=[];for(let t of this._pins.values())t.turns===`eval`&&e.push(t);for(let t of e)this._pins.delete(A(t.col,t.row)),this._events.emit(`pin:expired`,t,`eval`)}for(let e of this._pins.values())this._ensurePinOverlay(e)}_ensurePinOverlay(t){let n=A(t.col,t.row);if(this._pinOverlays.has(n))return;let r=this._reels[t.col],i=this._symbolFactory.acquire(t.symbolId);i.resize(r.symbolWidth,r.symbolHeight),i.view.x=r.container.x,i.view.y=r.container.y+r.getSymbolAt(t.row).view.y,i.view.zIndex=e.PIN_OVERLAY_Z_INDEX,this._viewport.unmaskedContainer.addChild(i.view),this._pinOverlays.set(n,{pin:t,overlay:i}),this._events.emit(`pin:overlayCreated`,t,i)}refreshPinOverlaysForReel(e){let t=this._reels[e];for(let[,n]of this._pinOverlays){if(n.pin.col!==e)continue;let{pin:r,overlay:i}=n;i.resize(t.symbolWidth,t.symbolHeight),i.view.x=t.container.x,i.view.y=t.container.y+r.row*t.motion.slotHeight}}_buildPinOverlayTweens(e,t,n){let r=this._reels[e],i=[],a=t+n;for(let[,n]of this._pinOverlays){if(n.pin.col!==e)continue;let{pin:o,overlay:s}=n;i.push({symbol:s,cellWidth:r.symbolWidth,oldCellHeight:r.symbolHeight,newCellHeight:t,fromY:s.view.y,toY:r.container.y+o.row*a,x:r.container.x})}return i}_destroyPinOverlay(e){let t=this._pinOverlays.get(e);if(!t)return;let{pin:n,overlay:r}=t;this._events.emit(`pin:overlayDestroyed`,n,r),this._viewport.unmaskedContainer.removeChild(r.view),this._symbolFactory.release(r),this._pinOverlays.delete(e)}_destroyAllPinOverlays(){let e=[...this._pinOverlays.keys()];for(let t of e)this._destroyPinOverlay(t)}},M={bufferSymbols:1,symbolGap:{x:0,y:0},initialSpeed:`normal`,maxPoolPerKey:20,zIndexStep:100},N={NORMAL:{name:`normal`,spinDelay:100,spinSpeed:30,stopDelay:140,anticipationDelay:450,bounceDistance:56,bounceDuration:600,accelerationEase:`power2.in`,decelerationEase:`power2.out`,accelerationDuration:300,minimumSpinTime:500},TURBO:{name:`turbo`,spinDelay:30,spinSpeed:50,stopDelay:0,anticipationDelay:250,bounceDistance:42,bounceDuration:200,accelerationEase:`power2.in`,decelerationEase:`power2.out`,accelerationDuration:200,minimumSpinTime:300},SUPER_TURBO:{name:`superTurbo`,spinDelay:0,spinSpeed:80,stopDelay:0,anticipationDelay:0,bounceDistance:14,bounceDuration:120,accelerationEase:`power1.in`,decelerationEase:`power1.out`,accelerationDuration:50,minimumSpinTime:100}},P=class{_entries=new Map;register(e,t,n){if(this._entries.has(e))throw Error(`Symbol '${e}' is already registered.`);this._entries.set(e,{SymbolClass:t,options:n})}create(e){let t=this._entries.get(e);if(!t)throw Error(`Symbol '${e}' is not registered. Available: ${[...this._entries.keys()].join(`, `)}`);let n=new t.SymbolClass(t.options);return n.activate(e),n}has(e){return this._entries.has(e)}get symbolIds(){return[...this._entries.keys()]}get size(){return this._entries.size}},F=class{_pools=new Map;_isDestroyed=!1;constructor(e,t,n,r=20){this._factory=e,this._reset=t,this._dispose=n,this._maxPerKey=r}get isDestroyed(){return this._isDestroyed}acquire(e){let t=this._pools.get(e);if(t&&t.length>0){let e=t.pop();return this._reset?.(e),e}return this._factory(e)}release(e,t){let n=this._pools.get(e);if(n||(n=[],this._pools.set(e,n)),n.length>=this._maxPerKey){this._dispose?.(t);return}n.push(t)}size(e){return this._pools.get(e)?.length??0}get totalSize(){let e=0;for(let t of this._pools.values())e+=t.length;return e}clear(){if(this._dispose)for(let e of this._pools.values())for(let t of e)this._dispose(t);this._pools.clear()}destroy(){this._isDestroyed||=(this.clear(),!0)}},I=class{_pool;constructor(e,t=20){this._registry=e,this._pool=new F(e=>this._registry.create(e),e=>e.reset(),e=>e.destroy(),t)}acquire(e){let t=this._pool.acquire(e);return t.symbolId!==e&&t.activate(e),t}release(e){let t=e.symbolId;e.deactivate(),this._pool.release(t,e)}destroy(){this._pool.destroy()}},L=class{_symbols;_weights;_cumulativeWeights=[];_totalWeight=0;_excludeSpinning=new Set;_excludeBuffer=new Set;constructor(e){this._symbols=Object.keys(e),this._weights=this._symbols.map(t=>e[t].weight),this._rebuildWeights()}next(e=!1){let t=e?new Set([...this._excludeSpinning,...this._excludeBuffer]):this._excludeSpinning;if(t.size===0)return this._pickWeighted();let n=0,r=[];for(let e=0;e<this._symbols.length;e++)t.has(this._symbols[e])||(n+=this._weights[e],r.push({id:this._symbols[e],cumWeight:n}));if(n===0||r.length===0){for(let e of this._symbols)if(!t.has(e))return e;return this._symbols[0]}let i=Math.random()*n,a=0,o=r.length-1;for(;a<o;){let e=a+o>>1;r[e].cumWeight<=i?a=e+1:o=e}return r[a].id}setExcludeSpinning(e){this._excludeSpinning=new Set(e)}setExcludeBuffer(e){this._excludeBuffer=new Set(e)}updateWeights(e){this._symbols=Object.keys(e),this._weights=this._symbols.map(t=>e[t].weight),this._rebuildWeights()}_rebuildWeights(){this._cumulativeWeights=[],this._totalWeight=0;for(let e of this._weights)this._totalWeight+=e,this._cumulativeWeights.push(this._totalWeight)}_pickWeighted(){let e=Math.random()*this._totalWeight,t=0,n=this._cumulativeWeights.length-1;for(;t<n;){let r=t+n>>1;this._cumulativeWeights[r]<=e?t=r+1:n=r}return this._symbols[t]}},R=class{_middlewares=[];_sorted=!1;constructor(e){this._randomProvider=e,this.use(new ee(e)),this.use(new te)}use(e){return this._middlewares.push(e),this._sorted=!1,this}remove(e){return this._middlewares=this._middlewares.filter(t=>t.name!==e),this}build(e,t,n,r,i,a=!1){this._sorted||=(this._middlewares.sort((e,t)=>e.priority-t.priority),!0);let o=n+t+r,s={reelIndex:e,visibleRows:t,bufferAbove:n,bufferBelow:r,symbols:Array(o).fill(``),targetSymbols:i,isSpinning:a,metadata:{}},c=0,l=()=>{c<this._middlewares.length&&this._middlewares[c++].process(s,l)};return l(),s.symbols}buildAll(e,t,n,r,i,a=!1){return Array.from({length:e},(e,o)=>this.build(o,t,n,r,i?.[o],a))}get randomProvider(){return this._randomProvider}get middleware(){return this._middlewares}},ee=class{name=`random-fill`;priority=0;constructor(e){this._provider=e}process(e,t){for(let t=0;t<e.symbols.length;t++)if(!e.symbols[t]){let n=t<e.bufferAbove||t>=e.bufferAbove+e.visibleRows;e.symbols[t]=this._provider.next(n)}t()}},te=class{name=`target-placement`;priority=10;process(e,t){if(e.targetSymbols)for(let t=-e.bufferAbove;t<e.targetSymbols.length;t++){let n=e.bufferAbove+t;e.targetSymbols[t]&&n<e.symbols.length&&(e.symbols[n]=e.targetSymbols[t])}t()}},z=class{_offsets=[];constructor(e,t,n,r){this._reelCount=e,this._totalRows=t,this._symbolWidth=n,this._config=r,this._compute()}getOffset(e,t){return this._offsets[e]?.[t]??0}get offsets(){return this._offsets}_compute(){if(this._config.mode===`none`){this._offsets=Array.from({length:this._reelCount},()=>Array(this._totalRows).fill(0));return}let e=this._config,t=(this._reelCount-1)/2;this._offsets=[];for(let n=0;n<this._reelCount;n++){let r=this._reelCount>1?(n-t)/(this._reelCount/2):0,i=[];for(let t=0;t<this._totalRows;t++){let n=this._totalRows>1?t/(this._totalRows-1):.5,a=r*e.widthDifference*e.topWidthFactor,o=a+(r*e.widthDifference*e.bottomWidthFactor-a)*n;i.push(o)}this._offsets.push(i)}}},B=class extends p{name=`start`;skippable=!0;onEnter(e){this._reel.spinningMode=e.spinningMode,this._reel.speed=0,this._reel.notifySpinStart(),this._complete()}update(e){}onSkip(){}},V=class extends p{name=`stop`;skippable=!0;_dropConfig;_runConfig=null;_delayTween=null;_fallTween=null;_dropTween=null;_stage=`falling`;_fallingViews=[];constructor(e,t,n){super(e,t),this._dropConfig=n}onEnter(e){this._runConfig=e,this._stage=`falling`,this._beginFall()}_beginFall(){this._delayTween=null;let e=this._reel,{fromY:t,fallDuration:n=300,fallRowDelay:r=0}=this._dropConfig,i=e.motion.slotHeight,a=e.visibleRows,o=t??i*(a+e.bufferAbove),s=n/1e3,c=r/1e3,l=Array.from({length:a},(t,n)=>e.getSymbolAt(n).view),u=l.map(e=>e.y);if(this._fallingViews=l,this._stage=`falling`,s<=0){this._beginDropIn(o);return}this._fallTween=g().timeline({onComplete:()=>{this._fallTween=null,l.forEach(e=>{e.alpha=0}),this._fallingViews=[];let e=(this._runConfig?.delay??0)/1e3;e>0?(this._stage=`waiting`,this._delayTween=g().delayedCall(e,()=>this._beginDropIn(o))):this._beginDropIn(o)}}),l.forEach((e,t)=>{this._fallTween.to(e,{y:u[t]+o,duration:s,ease:`power2.in`},t*c)})}_beginDropIn(e){this._stage=`dropping`;let t=this._reel,{rowDelay:n=0,easing:r=`bounce.out`,dropDuration:i=600}=this._dropConfig,a=t.bufferAbove,o=t.visibleRows,s=n/1e3,c=i/1e3;t.placeSymbols(this._runConfig.targetFrame.slice(a,a+o)),t.notifySpinEnd();let l=Array.from({length:o},(e,n)=>t.getSymbolAt(n).view),u=l.map(e=>e.y);if(l.forEach(t=>{t.y-=e}),c<=0){l.forEach((e,t)=>{e.y=u[t]}),this._stage=`done`,t.notifyLanded(),this._complete();return}this._dropTween=g().timeline({onComplete:()=>{this._stage=`done`,t.notifyLanded(),this._complete()}}),l.forEach((e,t)=>{this._dropTween.to(e,{y:u[t],duration:c,ease:r},t*s)})}update(e){}onSkip(){this._killTweens(),this._fallingViews.forEach(e=>{e.alpha=0}),this._fallingViews=[];let e=this._reel,t=this._runConfig;if(t&&this._stage!==`done`){let n=e.bufferAbove,r=e.visibleRows;e.placeSymbols(t.targetFrame.slice(n,n+r))}this._stage=`done`}_killTweens(){this._delayTween?.kill(),this._delayTween=null,this._fallTween?.kill(),this._fallTween=null,this._dropTween?.kill(),this._dropTween=null}},H=class extends p{name=`adjust`;skippable=!0;_durationMs;_ease;_tween=null;_settle=null;constructor(e,t,n){super(e,t),this._durationMs=n.durationMs,this._ease=n.ease??`power2.out`}onEnter(e){let t=e.pinOverlays;if(t.length===0){this._complete();return}if(this._durationMs<=0){this._snapPinOverlays(t),this._complete();return}for(let e of t)e.symbol.resize(e.cellWidth,e.newCellHeight),e.symbol.view.x=e.x,e.symbol.view.y=e.fromY,e.symbol.view.scale.y=e.newCellHeight>0?e.oldCellHeight/e.newCellHeight:1,e.symbol.view.scale.x=1;this._settle=()=>{for(let e of t)e.symbol.view.scale.set(1,1),e.symbol.view.y=e.toY,e.symbol.view.x=e.x};let n=this._durationMs/1e3,r=this._ease;this._tween=g().timeline({onComplete:()=>{this._settle?.(),this._settle=null,this._tween=null,this._complete()}});for(let e of t)this._tween.to(e.symbol.view,{y:e.toY,duration:n,ease:r},0),this._tween.to(e.symbol.view.scale,{y:1,duration:n,ease:r},0)}update(e){}onSkip(){this._tween&&=(this._tween.progress(1),this._tween.kill(),null),this._settle&&=(this._settle(),null)}_snapPinOverlays(e){for(let t of e)t.symbol.resize(t.cellWidth,t.newCellHeight),t.symbol.view.x=t.x,t.symbol.view.y=t.toY,t.symbol.view.scale.set(1,1)}},U=class e{_reelCount;_visibleRows;_symbolWidth;_symbolHeight;_symbolGap={...M.symbolGap};_bufferSymbols=M.bufferSymbols;_symbolRegistry=new P;_weights={};_speeds=new Map;_initialSpeed=M.initialSpeed;_offset={mode:`none`};_ticker;_spinningMode=new o;_phaseFactory=new x;_middlewares=[];_initialFrame;_symbolDataOverrides={};_cascadeDropConfig;_defaultSpinMode=`standard`;_visibleRowsPerReel;_reelPixelHeights;_reelAnchor=`center`;_multiways;_pinMigrationDuration=200;_pinMigrationEase=`power2.out`;_maskStrategy=new u;_maskStrategyExplicit=!1;reels(e){return this._reelCount=e,this}visibleRows(e){return this._visibleRows=e,this}visibleSymbols(e){return this.visibleRows(e)}visibleRowsPerReel(e){return this._visibleRowsPerReel=[...e],this}reelPixelHeights(e){return this._reelPixelHeights=[...e],this}reelAnchor(e){return this._reelAnchor=e,this}maskStrategy(e){if(e==null||typeof e.build!=`function`||typeof e.update!=`function`)throw Error(`maskStrategy(): expected a MaskStrategy with build(...) and update(...) methods (e.g. new RectMaskStrategy() or new SharedRectMaskStrategy()).`);return this._maskStrategy=e,this._maskStrategyExplicit=!0,this}multiways(e){return this._multiways={...e},this}pinMigrationDuration(e){return this._pinMigrationDuration=e,this}pinMigrationEase(e){return this._pinMigrationEase=e,this}symbolSize(e,t){return this._symbolWidth=e,this._symbolHeight=t,this}symbolGap(e,t){return this._symbolGap={x:e,y:t},this}bufferSymbols(t){return!Number.isFinite(t)||t<1?(e._bufferWarnedThisProcess||(e._bufferWarnedThisProcess=!0,console.warn(`[pixi-reels] bufferSymbols(${t}) is below the minimum of 1; clamping to 1. The motion layer needs at least one buffer row above and below the visible window for wrap detection.`)),this._bufferSymbols=1,this):(this._bufferSymbols=t,this)}static _bufferWarnedThisProcess=!1;symbols(e){return e(this._symbolRegistry),this}weights(e){return this._weights=e,this}symbolData(e){return this._symbolDataOverrides={...this._symbolDataOverrides,...e},this}speed(e,t){return this._speeds.set(e,t),this}initialSpeed(e){return this._initialSpeed=e,this}offsetConfig(e){return this._offset=e,this}ticker(e){return this._ticker=e,this}gsap(e){return h(e),this}spinningMode(e){return this._spinningMode=e,this}frameMiddleware(e){return this._middlewares.push(e),this}phases(e){return e(this._phaseFactory),this}cascade(e){return this._cascadeDropConfig=e,this._defaultSpinMode=`cascade`,this}initialFrame(e){return this._initialFrame=E(e),this}build(){this._validate();let e=this._reelCount,t=this._symbolWidth,n=this._symbolHeight,r=this._bufferSymbols,i=this._bufferSymbols,a=this._ticker,o=!!this._multiways,s;if(o)s=Array(e).fill(this._multiways.maxRows);else if(this._visibleRowsPerReel)s=this._visibleRowsPerReel;else{let t=this._visibleRows;s=Array(e).fill(t)}let c;c=o?Array(e).fill(this._multiways.reelPixelHeight):this._reelPixelHeights?this._reelPixelHeights:s.map(e=>e*n+(e-1)*this._symbolGap.y);let u=Math.max(...c),p=c.map(e=>{switch(this._reelAnchor){case`top`:return 0;case`bottom`:return u-e;default:return(u-e)/2}}),m=c.map((e,t)=>{let n=s[t];return(e-(n-1)*this._symbolGap.y)/n}),h=n,g=o?Array(e).fill(h):m;this._speeds.size===0&&this._speeds.set(`normal`,N.NORMAL);let _={},v=this._symbolRegistry.symbolIds;for(let e of v){let t=this._symbolDataOverrides[e]??{};_[e]={weight:t.weight??this._weights[e]??10,zIndex:t.zIndex??1,unmask:t.unmask,size:t.size}}let y={grid:{reelCount:e,visibleRows:this._visibleRows??s[0],symbolWidth:t,symbolHeight:n,symbolGap:{...this._symbolGap},bufferSymbols:this._bufferSymbols,visibleRowsPerReel:s,reelPixelHeights:c,reelAnchor:this._reelAnchor,multiways:this._multiways},symbols:_,speeds:this._speeds,initialSpeed:this._initialSpeed,offset:this._offset,ticker:a},b=new I(this._symbolRegistry),x=new L(_),S=new R(x);for(let e of this._middlewares)S.use(e);if(this._cascadeDropConfig){let e=this._cascadeDropConfig;this._phaseFactory.register(`dropStart`,B),this._phaseFactory.registerFactory(`dropStop`,(t,n)=>new V(t,n,e))}if(o){let e=this._pinMigrationDuration,t=this._pinMigrationEase;this._phaseFactory.registerFactory(`adjust`,(n,r)=>new H(n,r,{durationMs:typeof e==`function`?e(n.reelIndex):e,ease:t}))}let C=e*(t+this._symbolGap.x)-this._symbolGap.x,w=u,T=Object.values(_).some(e=>e.size&&(e.size.w>1||e.size.h>1)),E=Object.values(_).some(e=>e.unmask);if(E&&p.some(e=>e!==0)){let e=p.findIndex(e=>e!==0);throw Error(`[pixi-reels] unmask + pyramid layout is not supported (reel ${e} has offsetY=${p[e]}). The motion layer writes reel-local Y to unmasked views, which mispositions them by reel.container.y on every snap. Use cell pins (reelSet.pin(...)) for above-mask overlays on pyramid slots, or remove the per-reel offset.`)}!this._maskStrategyExplicit&&(T||E)&&this._symbolGap.x>0&&(this._maskStrategy=new d,console.info(`[pixi-reels] auto-selected SharedRectMaskStrategy because ${T?`big symbols are registered`:"one or more symbols use `unmask: true`"} and symbolGap.x > 0. Pass .maskStrategy(...) explicitly to override.`));let D=new f(C,w,void 0,this._maskStrategy);new z(e,r+Math.max(...s)+i,t,this._offset);let O=[],k=[];for(let n=0;n<e;n++){let e=s[n],a=g[n],o=this._initialFrame?S.build(n,e,r,i,this._initialFrame[n]):S.build(n,e,r,i),u=new l({reelIndex:n,visibleRows:e,bufferAbove:r,bufferBelow:i,symbolWidth:t,symbolHeight:a,symbolGapX:this._symbolGap.x,symbolGapY:this._symbolGap.y,symbolsData:_,initialSymbols:o,offsetY:p[n],reelHeight:c[n],spinSymbolHeight:h},b,x,D);O.push(u),k.push({x:n*(t+this._symbolGap.x),y:p[n],width:t,height:c[n]})}return D.updateMaskSize(C,w,k),new j({config:y,reels:O,viewport:D,symbolFactory:b,frameBuilder:S,phaseFactory:this._phaseFactory,spinningMode:this._spinningMode,defaultSpinMode:this._defaultSpinMode})}_validate(){let e=[];(this._reelCount===void 0||this._reelCount<=0)&&e.push(`reels() must be called with a positive number.`);let t=!!this._visibleRowsPerReel,n=this._visibleRows!==void 0,r=!!this._multiways;if(!r&&!n&&!t&&e.push(`one of visibleRows(n) or visibleRowsPerReel([...]) or multiways({...}) must be called.`),n&&t&&e.push(`cannot call both visibleRows() and visibleRowsPerReel() — pick one.`),r&&t&&e.push(`cannot combine multiways() with visibleRowsPerReel() — MultiWays shapes are server-driven.`),this._reelCount&&t&&this._visibleRowsPerReel.length!==this._reelCount&&e.push(`visibleRowsPerReel length ${this._visibleRowsPerReel.length} must equal reels(${this._reelCount}).`),t){for(let t=0;t<this._visibleRowsPerReel.length;t++)if(this._visibleRowsPerReel[t]<=0){e.push(`visibleRowsPerReel[${t}] = ${this._visibleRowsPerReel[t]} must be positive.`);break}}if(this._reelCount&&this._reelPixelHeights&&this._reelPixelHeights.length!==this._reelCount&&e.push(`reelPixelHeights length ${this._reelPixelHeights.length} must equal reels(${this._reelCount}).`),r){let t=this._multiways;t.minRows<=0||t.maxRows<=0?e.push(`multiways({minRows, maxRows}) must both be positive.`):t.minRows>t.maxRows&&e.push(`multiways: minRows ${t.minRows} cannot exceed maxRows ${t.maxRows}.`),t.reelPixelHeight<=0&&e.push(`multiways({reelPixelHeight}) must be positive.`),this._reelPixelHeights&&e.push(`cannot combine multiways({reelPixelHeight}) with reelPixelHeights([...]) — multiways slots use a uniform reel pixel height. Drop reelPixelHeights() or remove the multiways() configuration.`);for(let t of this._symbolRegistry.symbolIds){let n=this._symbolDataOverrides[t]??{};if(n.size&&(n.size.w>1||n.size.h>1)){e.push(`big symbol '${t}' (size ${n.size.w}x${n.size.h}) cannot be registered on a MultiWays slot. Drop multiways() or remove the size metadata.`);break}}}for(let t of this._symbolRegistry.symbolIds){let n=this._symbolDataOverrides[t]??{},r=n.size;if(!r||r.w===1&&r.h===1)continue;let i=n.weight??this._weights[t];i!==void 0&&i>0&&e.push(`big symbol '${t}' (size ${r.w}x${r.h}) must have weight 0 — big symbols are placed by the server at anchor cells only and never enter random fill in v1. Set weight to 0 (or omit it) and place the symbol via setResult().`)}if(this._visibleRows!==void 0&&this._visibleRows<=0&&e.push(`visibleRows() must be called with a positive number.`),(this._symbolWidth===void 0||this._symbolHeight===void 0)&&e.push(`symbolSize() must be called with width and height.`),this._symbolRegistry.size===0&&e.push(`symbols() must register at least one symbol.`),this._ticker||e.push(`ticker() must be called with a PixiJS Ticker.`),this._speeds.size>0&&!this._speeds.has(this._initialSpeed)&&e.push(`initialSpeed '${this._initialSpeed}' does not match any registered speed profile. Available: ${[...this._speeds.keys()].join(`, `)}`),e.length>0)throw Error(`ReelSetBuilder validation failed:\n - ${e.join(`
2
+ - `)}`)}},ne=class extends e.n{_sprite;_textures;_winTween=null;constructor(e){super(),this._textures=e.textures;let n=e.anchor??{x:0,y:0};this._sprite=new t.Sprite,this._sprite.anchor.set(n.x,n.y),this.view.addChild(this._sprite)}onActivate(e){let t=this._textures[e];t&&(this._sprite.texture=t)}onDeactivate(){this._killWinTween(),this._sprite.scale.set(1,1)}async playWin(){return this._killWinTween(),new Promise(e=>{this._winTween=g().to(this._sprite.scale,{x:1.15,y:1.15,duration:.15,yoyo:!0,repeat:1,ease:`power2.inOut`,onComplete:e})})}stopAnimation(){this._killWinTween(),this._sprite.scale.set(1,1)}resize(e,t){this._sprite.width=e,this._sprite.height=t}onDestroy(){this._killWinTween()}_killWinTween(){this._winTween&&=(this._winTween.kill(),null)}},re=class extends e.n{_animSprite;_frames;_animationSpeed;_winResolve=null;constructor(e){super(),this._frames=e.frames,this._animationSpeed=e.animationSpeed??1;let n=e.anchor??{x:0,y:0},r=Object.values(this._frames)[0]??[];this._animSprite=new t.AnimatedSprite(r.length>0?r:[]),this._animSprite.anchor.set(n.x,n.y),this._animSprite.animationSpeed=this._animationSpeed,this._animSprite.loop=!1,this.view.addChild(this._animSprite)}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}},ie={cascadeDrop:{rowDelay:80,dropDuration:600,fallDuration:300,easing:`bounce.out`},stiffDrop:{rowDelay:60,dropDuration:450,fallDuration:280,easing:`power3.out`},simultaneousDrop:{rowDelay:0,dropDuration:500,fallDuration:300,easing:`bounce.out`},slamDrop:{rowDelay:0,dropDuration:0,fallDuration:0}},ae=class extends p{name=`anticipation`;skippable=!0;_tween=null;_baseX=0;onEnter(){let e=this._speed.anticipationDelay/1e3;if(e<=0){this._complete();return}this._baseX=this._reel.container.x;let t=.04,n=Math.round(e/t)-1;this._tween=g().to(this._reel.container,{x:this._baseX+4,duration:t,ease:`power1.inOut`,yoyo:!0,repeat:n,onComplete:()=>{this._reel.container.x=this._baseX,this._complete()}})}update(e){}onSkip(){this._tween?.kill(),this._tween=null,this._reel.container.x=this._baseX}},oe=class{name=`cascade`;_gravity;constructor(e=1.5){this._gravity=e}computeDeltaY(e,t,n){let r=e*t*this._gravity*n/1e3;return Math.min(r,e)}},se=class{name=`immediate`;computeDeltaY(e,t,n){return 0}};function W(e){return[...e].sort((e,t)=>(t.value??0)-(e.value??0))}var ce=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?W(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.rowIndex);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.rowIndex}`);let r=this._reelSet.reels;for(let e=0;e<r.length;e++){let i=r[e];for(let r=0;r<i.visibleRows;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.visibleRows;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 G(e){let t=e.reels,n=t.map((e,t)=>({index:t,speed:e.speed,isStopping:e.isStopping,allSymbols:e.symbols.map((e,t)=>({row:t,symbolId:e.symbolId,y:Math.round(e.view.y)})),visibleSymbols:e.getVisibleSymbols()})),r=e.getVisibleGrid();return{timestamp:Date.now(),isSpinning:e.isSpinning,currentSpeed:e.speed.activeName,availableSpeeds:e.speed.profileNames,spotlightActive:e.spotlight.isActive,reelCount:t.length,visibleRows:t.map(e=>e.visibleRows),reels:n,grid:r}}function K(e){let{grid:t,visibleRows:n}=G(e);if(t.length===0)return`(empty grid)`;let r=Math.max(...n),i=e=>e.slice(0,8).padEnd(8),a=` `.repeat(8),o=(e,n,r)=>e+t.map(()=>`─`.repeat(8)).join(n)+r,s=[];s.push(o(`┌`,`┬`,`┐`));for(let e=0;e<r;e++){let r=t.map((t,r)=>e<n[r]?i(t[e]??`?`):a);s.push(`│`+r.join(`│`)+`│`)}return s.push(o(`└`,`┴`,`┘`)),s.join(`
3
+ `)}var le=1e3,q=[],J=le,Y=new WeakMap;function X(e,t=`default`,n={}){Z(e),n.maxFrames!==void 0&&n.maxFrames>0&&(J=n.maxFrames);let r=n=>{q.push({tag:t,trigger:n,snapshot:G(e)}),q.length>J&&q.splice(0,q.length-J)},i=()=>r(`spin:start`),a=()=>r(`spin:reelLanded`),o=()=>r(`spin:allLanded`),s=()=>r(`spin:complete`),c=()=>Z(e);e.events.on(`spin:start`,i),e.events.on(`spin:reelLanded`,a),e.events.on(`spin:allLanded`,o),e.events.on(`spin:complete`,s),e.events.on(`destroyed`,c),Y.set(e,()=>{e.events.off(`spin:start`,i),e.events.off(`spin:reelLanded`,a),e.events.off(`spin:allLanded`,o),e.events.off(`spin:complete`,s),e.events.off(`destroyed`,c)})}function Z(e){let t=Y.get(e);t&&(t(),Y.delete(e))}function Q(e){return e===void 0?q.slice():q.filter(t=>t.tag===e)}function ue(){q.length=0}function de(e){if(typeof window>`u`)return;let n=null;window.__PIXI_REELS_DEBUG={reelSet:e,snapshot:()=>G(e),grid:()=>K(e),log:()=>{let t=G(e);return console.log(`[pixi-reels debug] spinning=${t.isSpinning} speed=${t.currentSpeed}`),console.log(K(e)),t},trace:()=>{for(let t of[`spin:start`,`spin:allStarted`,`spin:stopping`,`spin:reelLanded`,`spin:allLanded`,`spin:complete`,`skip:requested`,`skip:completed`,`speed:changed`,`spotlight:start`,`spotlight:end`,`shape:changed`,`adjust:start`,`adjust:complete`,`pin:placed`,`pin:moved`,`pin:expired`,`pin:migrated`,`destroyed`])e.events.on(t,(...e)=>{console.log(`[pixi-reels] ${t}`,...e)});console.log(`[pixi-reels debug] tracing enabled for all events`)},startRecording:(t=`default`,n)=>X(e,t,n),stopRecording:()=>Z(e),getFrames:e=>Q(e),clearFrames:()=>ue(),showMask:r=>{if(r){if(n)return;let r=new t.Graphics;r.rect(0,0,e.viewport.maskWidth,e.viewport.maskHeight).fill({color:16711680,alpha:.15});for(let t of e.viewport.maskRects)r.rect(t.x,t.y,t.width,t.height).stroke({color:65280,width:2});e.viewport.unmaskedContainer.addChild(r),n=r}else n&&=(e.viewport.unmaskedContainer.removeChild(n),n.destroy(),null)}},console.log(`[pixi-reels] Debug mode enabled. Use __PIXI_REELS_DEBUG.log() to inspect state.`)}var fe=class{deltaMS=16;deltaTime=1;elapsedMS=0;lastTime=0;speed=1;started=!1;FPS=60;minFPS=10;maxFPS=0;_callbacks=[];add(e){return this._callbacks.push(e),this}addOnce(e){let t=n=>{this.remove(t),e(n)};return this.add(t)}remove(e){let t=this._callbacks.indexOf(e);return t!==-1&&this._callbacks.splice(t,1),this}start(){return this.started=!0,this}stop(){return this.started=!1,this}destroy(){this._callbacks.length=0,this.started=!1}tick(e=16){this.deltaMS=e,this.deltaTime=e/(1e3/60),this.elapsedMS+=e,this.lastTime+=e;let t=this._callbacks.slice();for(let e of t)e(this)}tickFor(e,t=16){let n=e;for(;n>0;){let e=Math.min(t,n);this.tick(e),n-=e}}get listenerCount(){return this._callbacks.length}},pe=class extends e.n{_width=0;_height=0;onActivate(e){}onDeactivate(){}async playWin(){}stopAnimation(){}resize(e,t){this._width=e,this._height=t}get width(){return this._width}get height(){return this._height}};function me(e={}){let t=e.reels??5,n=e.symbolIds??[`a`,`b`,`c`],r=e.weights??{},i=e.symbolSize??{width:100,height:100},a=new fe,o=new U().reels(t).symbolSize(i.width,i.height).ticker(a).symbols(e=>{for(let t of n)e.register(t,pe,{})});e.multiways?o.multiways(e.multiways):Array.isArray(e.visibleRows)?o.visibleRowsPerReel(e.visibleRows):o.visibleSymbols(e.visibleRows??3),e.symbolGap&&o.symbolGap(e.symbolGap.x,e.symbolGap.y),Object.keys(r).length>0&&o.weights(r),e.symbolData&&o.symbolData(e.symbolData),e.bufferSymbols!==void 0&&o.bufferSymbols(e.bufferSymbols),e.initialFrame&&o.initialFrame(e.initialFrame);let s=o.build();return{reelSet:s,ticker:a,advance(e,t=16){a.tickFor(e,t)},async spinAndLand(e){return $(s,e)},destroy(){s.destroy(),a.destroy()}}}async function $(e,t){let n=e.spin();return e.setResult(t),e.skip(),n}function he(e,t){let n=[];for(let r of t)e.events.on(r,(...e)=>{n.push({event:r,args:e})});return n}function ge(e,t){let n=G(e).grid,r=[];if(n.length!==t.length)throw Error(`Grid reel count mismatch: expected ${t.length} got ${n.length}\n${K(e)}`);for(let e=0;e<t.length;e++){if(t[e].length!==n[e].length){r.push(` reel ${e} row count: expected ${t[e].length} got ${n[e].length}`);continue}for(let i=0;i<t[e].length;i++)t[e][i]!==n[e][i]&&r.push(` reel ${e} row ${i}: expected "${t[e][i]}" got "${n[e][i]}"`)}if(r.length>0)throw Error(`Grid mismatch:\n${r.join(`
4
+ `)}\n\nCurrent grid:\n${K(e)}`)}function _e(e,t){let n=0;for(let r of G(e).grid)for(let e of r)e===t&&n++;return n}exports.AdjustPhase=H,exports.AnimatedSpriteSymbol=re,exports.AnticipationPhase=b,exports.CascadeAnticipationPhase=ae,exports.CascadeMode=oe,exports.DEFAULTS=M,exports.DropRecipes=ie,exports.DropStartPhase=B,exports.DropStopPhase=V,exports.EventEmitter=r,exports.FakeTicker=fe,exports.FrameBuilder=R,exports.HeadlessSymbol=pe,exports.ImmediateMode=se,exports.OCCUPIED_SENTINEL=c,exports.ObjectPool=F,exports.OffsetCalculator=z,exports.PhaseFactory=x,exports.RandomSymbolProvider=L,exports.RectMaskStrategy=u,exports.Reel=l,exports.ReelMotion=i,exports.ReelPhase=p,exports.ReelSet=j,exports.ReelSetBuilder=U,exports.ReelSymbol=e.n,exports.ReelViewport=f,exports.SharedRectMaskStrategy=d,exports.SpeedManager=O,exports.SpeedPresets=N,exports.SpinController=D,exports.SpinPhase=v,exports.SpineSymbol=e.t,exports.SpriteSymbol=ne,exports.StandardMode=o,exports.StartPhase=_,exports.StopPhase=y,exports.StopSequencer=a,exports.SymbolFactory=I,exports.SymbolRegistry=P,exports.SymbolSpotlight=k,exports.TickerRef=S,exports.WinPresenter=ce,exports.captureEvents=he,exports.clearFrames=ue,exports.countSymbol=_e,exports.createTestReelSet=me,exports.debugGrid=K,exports.debugSnapshot=G,exports.enableDebug=de,exports.expectGrid=ge,exports.getFrames=Q,exports.pinKey=A,exports.sortByValueDesc=W,exports.spinAndLand=$,exports.startRecording=X,exports.stopRecording=Z;
5
+ //# sourceMappingURL=index.cjs.map