pixi-reels 4.3.0 → 4.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # pixi-reels
2
2
 
3
+ ## 4.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#294](https://github.com/schmooky/pixi-reels/pull/294) [`4af027f`](https://github.com/schmooky/pixi-reels/commit/4af027f79b4aadf1b27567ab810641aa1e63493e) Thanks [@igaming-bulochka](https://github.com/igaming-bulochka)! - Add: a `host` option on `debugOverlay` from `pixi-reels/debug`. The overlay draws into that container instead of the reel set and copies the set's transform onto itself before every render. Pass a container outside the camera window or frame mask your game puts around the set, so the mask does not clip the panels under the reels.
8
+
9
+ ### Patch Changes
10
+
11
+ - [#293](https://github.com/schmooky/pixi-reels/pull/293) [`9f0b508`](https://github.com/schmooky/pixi-reels/commit/9f0b508fd8ec9534a1aaa98860065cd7b19b9c24) Thanks [@igaming-bulochka](https://github.com/igaming-bulochka)! - Fix: debug labels stay sharp when the reels are scaled up. `DebugPlaque` rows and the `debugOverlay` labels re-rasterise at the scale they are drawn, rounded to half steps and capped at 8x. Before this, a host that fitted the reels to a bigger canvas, or zoomed in, showed the text as a stretched bitmap next to the vector plates.
12
+
13
+ ## 4.3.1
14
+
15
+ ### Patch Changes
16
+
17
+ - [#287](https://github.com/schmooky/pixi-reels/pull/287) [`05bed07`](https://github.com/schmooky/pixi-reels/commit/05bed07592da0113e3ca2e94ae2fcb06955ecbe1) Thanks [@igaming-bulochka](https://github.com/igaming-bulochka)! - Fix: 4.3.1 is 4.3.0 published as `latest`. 4.3.0 reached npm under a branch dist-tag instead of `latest`, so `npm install pixi-reels` kept resolving to 4.2.0. The code is the same as 4.3.0; see its notes for the changes.
18
+
3
19
  ## 4.3.0
4
20
 
5
21
  ### Minor Changes
@@ -1 +1 @@
1
- {"version":3,"file":"DebugPlaque.d.ts","sourceRoot":"","sources":["../../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+ * Keep a debug label sharp at whatever scale it is drawn. Pixi rasterises a
4
+ * `Text` once, at the renderer's resolution, so a label inside a container
5
+ * scaled up two or three times (a host fitting the reels to its canvas, a
6
+ * camera zoom) is a stretched bitmap next to the vector plates around it.
7
+ * Before each render this re-rasterises the label when its on-screen scale
8
+ * has moved to a new half step, so the cost is paid on a zoom, not per frame.
9
+ */
10
+ export declare function crispText(text: Text): void;
11
+ //# sourceMappingURL=crispText.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crispText.d.ts","sourceRoot":"","sources":["../../src/debug/crispText.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,KAAK,IAAI,EAAE,MAAM,SAAS,CAAC;AAK3D;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAU1C"}
@@ -1,4 +1,4 @@
1
- import { Ticker } from 'pixi.js';
1
+ import { Container, Ticker } from 'pixi.js';
2
2
  import { ReelSet } from '../core/ReelSet.js';
3
3
  import { Disposable } from '../utils/Disposable.js';
4
4
  import { SpinMetrics, DebugRound } from './SpinMetrics.js';
@@ -61,6 +61,14 @@ export interface DebugOverlayOptions {
61
61
  * ticker, and destroys it with itself.
62
62
  */
63
63
  metrics?: SpinMetrics;
64
+ /**
65
+ * The container the overlay draws into. Defaults to the reel set. Pass one
66
+ * outside whatever clips the set (a camera window or frame mask a game puts
67
+ * around it, which would cut off the panels drawn under the reels): the
68
+ * overlay copies the set's transform onto itself before every render, so
69
+ * it still lines up with the reels but is no longer clipped with them.
70
+ */
71
+ host?: Container;
64
72
  }
65
73
  /** What the axis-family layers drew for one reel, as plain numbers. */
66
74
  export interface DebugOverlayReelInfo {
@@ -1 +1 @@
1
- {"version":3,"file":"debugOverlay.d.ts","sourceRoot":"","sources":["../../src/debug/debugOverlay.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,MAAM,EAAE,MAAM,SAAS,CAAC;AAE7D,OAAO,KAAK,EAAE,OAAO,EAAE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,SAAQ,UAAU;IACpD,uEAAuE;IACvE,SAAS,CAAC,MAAM,EAAE,iBAAiB,EAAE,GAAG,KAAK,GAAG,IAAI,CAAC;IACrD,kDAAkD;IAClD,MAAM,IAAI,IAAI,CAAC;IACf;;;;;;OAMG;IACH,QAAQ,IAAI,oBAAoB,CAAC;IACjC,+DAA+D;IAC/D,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,yEAAyE;IACzE,OAAO,IAAI,IAAI,CAAC;IAChB,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;CAC/B;AAqCD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,OAAO,EAChB,OAAO,GAAE,mBAAwB,GAChC,kBAAkB,CAEpB"}
package/dist/debug.cjs CHANGED
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./SpinMetrics-9nsu5jI6.cjs"),t=require("./PhaseCardSymbol-Ct9bCE4I.cjs");let n=require("pixi.js"),r=require("pixi-silk");function i(e,t){if(e.length<=t)return[e];let n=[],r=``;for(let i of e.split(` `)){let e=r?`${r} ${i}`:i;if(e.length<=t){r=e;continue}r&&n.push(r);let a=i;for(;a.length>t;)n.push(a.slice(0,t)),a=a.slice(t);r=a}return r&&n.push(r),n}var a=`'Fira Code', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace`,o=.6,s=15197668,c=724500,l=class extends n.Container{_opts;_gfx=new r.SilkGraphics({label:`DebugPlaque:plate`});_title=null;_texts=[];_width=0;_height=0;constructor(e={}){super(),this.label=`DebugPlaque`,this.eventMode=`none`,this._opts={...e},this.addChild(this._gfx),this._layout()}get isDestroyed(){return this.destroyed}destroy(e){this.destroyed||super.destroy(typeof e==`object`?{...e,children:!0}:{children:!0})}get plateWidth(){return this._width}get plateHeight(){return this._height}update(e){return Object.assign(this._opts,e),this._layout(),this}setRows(e){return this.update({rows:e})}get text(){let e=this._opts;return e.rows?e.rows.map(e=>typeof e==`string`?e:e.text).join(`
2
- `):e.text??``}set text(e){this._opts.rows=void 0,this._opts.text=e,this._layout()}_rows(e,t){let n=this._opts,r=n.color??s,a=(n.rows??(n.text===void 0?[]:n.text.split(`
3
- `))).map(e=>typeof e==`string`?{text:e,color:r,swatch:null,meter:null,meterColor:null}:{text:e.text,color:e.color??r,swatch:e.swatch??null,meter:e.meter??null,meterColor:e.meterColor??null});if(n.maxWidth===void 0)return a;let c=Math.max(1,Math.floor((n.maxWidth-t*2)/(e*o)));return a.flatMap(e=>i(e.text,c).map((t,n)=>n===0?{...e,text:t}:{...e,text:t,swatch:null,meter:null}))}_layout(){if(this.destroyed)return;let e=this._opts,t=e.fontSize??11,n=Math.round(t*1.4),r=t*o,[i,a]=typeof e.padding==`number`?[e.padding,e.padding]:e.padding??[Math.round(t*.75),Math.round(t*.45)],l=this._rows(t,i),u=e.title??``,d=Math.round(t*.75),f=l.some(e=>e.swatch!==null)?d+Math.round(t*.5):0,p=Math.round(t*4),m=Math.max(3,Math.round(t*.36)),h=l.some(e=>e.meter!==null)?p+Math.round(t*.7):0,g=e=>e.length*r,_=l.reduce((e,t)=>Math.max(e,f+g(t.text)+h),0),v=Math.max(_,g(u)),y=u?n+Math.round(t*.15):0,b=Math.ceil(Math.min(e.maxWidth??1/0,Math.max(e.minWidth??0,v+i*2))),x=Math.ceil(y+Math.max(l.length,e.reserveRows??0)*n+a*2);this._width=b,this._height=x;let S=this._gfx;S.clear();let C=e.radius===`pill`?x/2:e.radius??0;(e.shadow??!0)&&S.roundRect(0,1.5,b,x,C,.6).fill({color:0,alpha:.35,blur:3}),S.roundRect(0,0,b,x,C,.6).fill({color:e.fill??c,alpha:e.fillAlpha??.84}).stroke({color:e.accent??16777215,alpha:e.accent===void 0?.1:.5,width:1,alignment:`inside`});let w=e=>e+(n-t*1.25)/2;u?(this._title??=this._makeText(!0),this._title.visible=!0,this._title.text=u,this._title.style.fill=e.accent??e.color??s,this._title.style.fontSize=t,this._title.x=this._alignX(g(u),b,i),this._title.y=w(a)):this._title&&(this._title.visible=!1);let T=a+y;l.forEach((r,a)=>{let o=this._texts[a]??=this._makeText(!1);o.visible=!0,o.text=r.text,o.style.fill=r.color,o.style.fontSize=t;let s=T+a*n,c=this._alignX(f+g(r.text)+h,b,i);if(o.x=c+f,o.y=w(s),r.swatch!==null&&S.rect(c,s+(n-d)/2,d,d).fill(r.swatch),r.meter!==null){let t=b-i-p,a=s+(n-m)/2,o=Math.min(1,Math.max(0,r.meter));S.pill(t,a,p,m).fill({color:16777215,alpha:.14}),o>0&&S.pill(t,a,Math.max(m,p*o),m).fill(r.meterColor??e.accent??r.color)}});for(let e=l.length;e<this._texts.length;e++)this._texts[e].visible=!1;let E=e.anchor??0,D=typeof E==`number`?E:E.x,O=typeof E==`number`?E:E.y;this.pivot.set(Math.round(b*D),Math.round(x*O)),this.hitArea=this._plateRect(this.hitArea,b,x),this.boundsArea=this._plateRect(this.boundsArea,b,x)}_plateRect(e,t,r){return e instanceof n.Rectangle?(e.width=t,e.height=r,e):new n.Rectangle(0,0,t,r)}_alignX(e,t,n){switch(this._opts.align){case`center`:return Math.round((t-e)/2);case`right`:return Math.round(t-n-e);default:return n}}_makeText(e){let t=new n.Text({text:``,style:{fontFamily:a,fontSize:this._opts.fontSize??11,fontWeight:e?`600`:`400`,fill:this._opts.color??s}});return this.addChild(t),t}};function u(e,t,n,r,i,a=0){let o=Math.max(0,Math.min(a,r/2,i/2)),s=t+r,c=n+i;return e.moveTo(t+o,n).lineTo(s-o,n).quadraticCurveTo(s,n,s,n+o).lineTo(s,c-o).quadraticCurveTo(s,c,s-o,c).lineTo(t+o,c).quadraticCurveTo(t,c,t,c-o).lineTo(t,n+o).quadraticCurveTo(t,n,t+o,n).closePath()}var d=[`mask`,`cells`,`buffers`,`thresholds`,`axis`,`feed`,`bounds`,`blocks`,`pins`,`hud`,`metrics`,`timeline`],f={mask:16726832,cells:3321318,buffers:16749824,axis:3199320,feed:6607615,thresholds:16729402,bounds:16723349,blocks:16763904,pins:11490014,hud:16777215,metrics:6607615,timeline:16777215},p=`pixi-reels:debugOverlay`,m=3458905,h=3458905,g=3199320,_={slam:16729402,quicken:16766474},v=10265519,y=16020150,b=10,x=9,S=8,C=200,w=232,T=7,E=4;function D(e){return d.indexOf(e)*10}function O(e){return e===void 0||e===`all`?new Set(d):new Set(e)}function k(e){return e===`nudge`?y:t.t[e]??t.t.other}function A(e){return e<1e4?`${Math.round(e)}ms`:`${(e/1e3).toFixed(1)}s`}function j(e){for(let t of[50,100,200,250,500,1e3,2e3,2500,5e3,1e4])if(e/t<=6)return t;return 2e4}function M(e,t={}){return new N(e,t)}var N=class{_reelSet;_root=new n.Container;_graphics=new Map;_cellLabels=[];_hud=null;_metricsPlaque=null;_timeline=null;_timelineGfx=null;_timelineTexts=[];_active;_ticker=null;_tickerRef=null;_metrics;_ownsMetrics;_isDestroyed=!1;_phase;_reelDetach=[];_onStatic=()=>this._redrawStatic();_onSetEvent=e=>{e!==`destroyed`&&this._redrawInfo()};_onDestroyed=()=>this.destroy();_onReelsAdded=e=>{for(let t=e.from;t<e.from+e.count;t++)this._phase[t]=`idle`,this._trackPhase(this._reelSet.reels[t],t);this._redrawStatic()};_onReelsRemoved=e=>{this._phase.length=e.from;for(let t of this._reelDetach.splice(e.from))t();this._redrawStatic()};constructor(t,r){this._reelSet=t,this._active=O(r.layers),this._phase=t.reels.map(()=>`idle`),this._root.zIndex=1e6,this._root.eventMode=`none`,this._root.label=p,this._root.sortableChildren=!0,t.addChild(this._root),t.reels.forEach((e,t)=>this._trackPhase(e,t)),t.events.on(`shape:changed`,this._onStatic),t.events.on(`adjust:complete`,this._onStatic),t.events.on(`rows:added`,this._onStatic),t.events.on(`rows:removed`,this._onStatic),t.events.on(`column:set`,this._onStatic),t.events.on(`reels:added`,this._onReelsAdded),t.events.on(`reels:removed`,this._onReelsRemoved),t.events.on(`destroyed`,this._onDestroyed),r.live&&(this._ticker=r.ticker??n.Ticker.shared),this._ownsMetrics=!r.metrics,this._metrics=r.metrics??new e.t(t,{ticker:this._ticker??void 0}),this._ticker?(this._tickerRef=new e.n(this._ticker),this._tickerRef.add(()=>this._redrawLive())):t.events.onAny(this._onSetEvent),this.redraw()}get isDestroyed(){return this._isDestroyed}_trackPhase(e,t){let n=e=>{this._phase[t]=e},r=e=>{this._phase[t]===e&&(this._phase[t]=`idle`)};e.events.on(`phase:enter`,n),e.events.on(`phase:exit`,r),this._reelDetach[t]=()=>{e.events.off(`phase:enter`,n),e.events.off(`phase:exit`,r)}}get metrics(){return this._metrics}setLayers(e){if(!this._isDestroyed){this._active=O(e);for(let[e,t]of this._graphics)this._active.has(e)?t.visible=!0:(t.clear(),t.visible=!1);this._active.has(`cells`)||this._hideTextsFrom(this._cellLabels,0),this._hud&&(this._hud.visible=this._active.has(`hud`)),this._metricsPlaque&&(this._metricsPlaque.visible=this._active.has(`metrics`)),this._timeline&&(this._timeline.visible=this._active.has(`timeline`)),this.redraw()}}redraw(){this._isDestroyed||(this._redrawStatic(),this._redrawLive())}describe(){return{layers:[...this._active],reels:this._reelSet.reels.map((e,t)=>{let n=e.axis,r=this._arrowMains(e),i=e.motion.slotPitch;return{reel:t,orientation:n.orientation,direction:n.direction,feedEdge:n.feedEdge,axisArrow:r,feedMain:this._feedMain(e),thresholds:{start:-(e.bufferStart+1)*i,end:(e.visibleCells+e.bufferEnd)*i},visibleCells:e.visibleCells,phase:this._phase[t]}}),round:this._metrics.current?JSON.parse(JSON.stringify(this._metrics.current)):null}}destroy(){if(!this._isDestroyed){this._isDestroyed=!0,this._tickerRef?.destroy(),this._tickerRef=null,this._reelSet.events.off(`shape:changed`,this._onStatic),this._reelSet.events.off(`adjust:complete`,this._onStatic),this._reelSet.events.off(`rows:added`,this._onStatic),this._reelSet.events.off(`rows:removed`,this._onStatic),this._reelSet.events.off(`column:set`,this._onStatic),this._reelSet.events.off(`reels:added`,this._onReelsAdded),this._reelSet.events.off(`reels:removed`,this._onReelsRemoved),this._reelSet.events.off(`destroyed`,this._onDestroyed),this._reelSet.events.offAny(this._onSetEvent);for(let e of this._reelDetach)e();this._reelDetach.length=0,this._ownsMetrics&&this._metrics.destroy(),this._root.parent&&this._root.parent.removeChild(this._root),this._root.destroy({children:!0}),this._graphics.clear(),this._cellLabels.length=0,this._timelineTexts.length=0,this._hud=null,this._metricsPlaque=null,this._timeline=null,this._timelineGfx=null}}_redrawStatic(){this._isDestroyed||(this._active.has(`mask`)&&this._drawMask(),this._active.has(`cells`)&&this._drawCells(),this._active.has(`buffers`)&&this._drawBuffers(),this._active.has(`thresholds`)&&this._drawThresholds(),this._active.has(`axis`)&&this._drawAxis(),this._active.has(`feed`)&&this._drawFeed())}_redrawLive(){this._isDestroyed||(this._active.has(`bounds`)&&this._drawBounds(),this._active.has(`blocks`)&&this._drawBlocks(),this._active.has(`pins`)&&this._drawPins(),this._redrawInfo())}_redrawInfo(){this._isDestroyed||(this._active.has(`hud`)&&this._drawHud(),this._active.has(`metrics`)&&this._drawMetrics(),this._active.has(`timeline`)&&this._drawTimeline(),this._layoutPanels())}_layer(e){let t=this._graphics.get(e);return t||(t=new r.SilkGraphics({label:`${p}:${e}`}),t.zIndex=D(e),this._graphics.set(e,t),this._root.addChild(t)),t.visible=!0,t.clear(),t}_text(e,t,r,i,o){let s=e[t];return s||(s=new n.Text({text:``,style:{fontFamily:a,fontSize:i,fill:r}}),e[t]=s,o.addChild(s)),s.style.fill=r,s.visible=!0,s}_hideTextsFrom(e,t){for(let n=t;n<e.length;n++)e[n].visible=!1}_drawMask(){let e=this._layer(`mask`),t=this._reelSet.viewport,n=t.x,r=t.y;e.rect(n,r,t.maskWidth,t.maskHeight).stroke({color:f.mask,width:2});for(let i of t.maskRects)u(e,n+i.x,r+i.y,i.width,i.height).stroke({color:m,width:1.5,dash:[6,4]})}_drawCells(){let e=this._layer(`cells`),t=x*.6,n=0;this._reelSet.reels.forEach((r,i)=>{for(let a=0;a<r.visibleCells;a++){let r=this._reelSet.getCellBounds(i,a),o=this._reelSet.getCellQuad(i,a);o?e.poly(o,!0).stroke({color:f.cells,width:1,alpha:.85}):e.rect(r.x+.5,r.y+.5,r.width-1,r.height-1).stroke({color:f.cells,width:1,alpha:.85});let s=`${i},${a}`,c=(o?o[0].x:r.x)+3,l=(o?o[0].y:r.y)+3;e.rect(c-2,l-1,s.length*t+4,12).fill({color:0,alpha:.55});let u=this._text(this._cellLabels,n++,f.cells,x,this._root);u.zIndex=D(`cells`)+1,u.text=s,u.x=c,u.y=l}}),this._hideTextsFrom(this._cellLabels,n)}_drawBuffers(){let e=this._layer(`buffers`);for(let t of this._reelSet.reels){let n=t.motion.slotPitch,r=n=>{let r=t.curve,i=r?r.mapMain(n):n,a=r?r.mapMain(n+t.cellMain):n+t.cellMain,o=r?t.cellCross*r.scaleAt(n+t.cellMain/2):t.cellCross,s=this._reelRect(t,(t.cellCross-o)/2,i,o,a-i);u(e,s.x,s.y,s.width,s.height).stroke({color:f.buffers,width:1,alpha:.6,dash:[4,3]})};for(let e=1;e<=t.bufferStart;e++)r(-e*n);for(let e=0;e<t.bufferEnd;e++)r((t.visibleCells+e)*n)}}_reelPoint(e,t,n){let r=e.axis,i=r.toScreen(r.getCross(e.container)+t,r.getMain(e.container)+n);return{x:this._reelSet.viewport.x+i.x,y:this._reelSet.viewport.y+i.y}}_reelRect(e,t,n,r,i){let a=this._reelPoint(e,t,n),o=e.axis.toScreen(r,i);return{x:a.x,y:a.y,width:o.x,height:o.y}}_arrowMains(e){let t=e.visibleCells*e.motion.slotPitch,n=e.axis.polarity>0;return{fromMain:n?t*.2:t*.8,toMain:n?t*.8:t*.2}}_feedMain(e){let t=e.motion.slotPitch;return e.axis.feedEdge===`start`?-e.bufferStart*t:e.visibleCells*t}_drawAxis(){let e=this._layer(`axis`);for(let t of this._reelSet.reels){let n=t.visibleCells*t.motion.slotPitch,r=t.cellCross/2,{fromMain:i,toMain:a}=this._arrowMains(t),o=t.axis.polarity>0,s=Math.min(n*.12,t.cellCross*.4)||8,c=a-(o?s:-s),l=this._reelPoint(t,r,i),u=this._reelPoint(t,r,c),d=this._reelPoint(t,r,a),p=this._reelPoint(t,r-s*.6,c),m=this._reelPoint(t,r+s*.6,c);e.line(l.x,l.y,u.x,u.y).stroke({color:f.axis,width:3,cap:`round`}),e.triangle(d.x,d.y,p.x,p.y,m.x,m.y,1).fill(f.axis)}}_drawFeed(){let e=this._layer(`feed`);for(let t of this._reelSet.reels){let n=t.motion.slotPitch,r=this._reelRect(t,0,this._feedMain(t),t.cellCross,n*.18);e.roundRect(r.x,r.y,r.width,r.height,Math.min(r.width,r.height)/2).fill({color:f.feed,alpha:.55})}}_drawThresholds(){let e=this._layer(`thresholds`);for(let t of this._reelSet.reels){let n=t.motion.slotPitch,r=[-(t.bufferStart+1)*n,(t.visibleCells+t.bufferEnd)*n];for(let n of r){let r=this._reelPoint(t,0,n),i=this._reelPoint(t,t.cellCross,n);e.line(r.x,r.y,i.x,i.y).stroke({color:f.thresholds,width:2,alpha:.9,dash:[6,4]})}}}_drawBounds(){let e=this._layer(`bounds`);this._reelSet.reels.forEach(t=>{for(let n=0;n<t.visibleCells;n++){let r=t.getSymbolAt(n).view.getBounds(),i=this._root.toLocal({x:r.x,y:r.y}),a=this._root.toLocal({x:r.x+r.width,y:r.y+r.height});e.rect(i.x,i.y,a.x-i.x,a.y-i.y).stroke({color:f.bounds,width:1})}})}_drawBlocks(){let e=this._layer(`blocks`);this._reelSet.reels.forEach((t,n)=>{for(let r=0;r<t.visibleCells;r++){let t=this._reelSet.getSymbolFootprint(n,r);if(t.size.reels<=1&&t.size.cells<=1||t.anchor.reel!==n||t.anchor.cell!==r)continue;let i=this._reelSet.getBlockBounds(n,r);e.rect(i.x,i.y,i.width,i.height).fill({color:f.blocks,alpha:.08}).stroke({color:f.blocks,width:3,alignment:`inside`})}})}_drawPins(){let e=this._layer(`pins`);this._reelSet.reels.forEach((t,n)=>{for(let r=0;r<t.visibleCells;r++){if(!this._reelSet.getPin(n,r))continue;let t=this._reelSet.getCellBounds(n,r);e.rect(t.x,t.y,t.width,t.height).stroke({color:f.pins,width:3,alignment:`inside`}),e.line(t.x,t.y,t.x+t.width,t.y+t.height).line(t.x+t.width,t.y,t.x,t.y+t.height).stroke({color:h,width:1,alpha:.8})}})}_drawHud(){let e=this._reelSet.reels.map((e,n)=>{let r=e.axis,i=r.orientation===`vertical`?`V`:`H`,a=r.direction===`forward`?`F`:`R`,o=this._phase[n];return{text:`r${n} ${i}${a} feed=${r.feedEdge} spd=${e.speed.toFixed(1)} ${o} cells=${e.visibleCells}`,swatch:o===`idle`?t.t.rest:k(o),meter:Math.abs(e.speedNormalized),meterColor:o===`idle`?v:k(o)}});this._hud||(this._hud=new l({fontSize:b,padding:[6,4],shadow:!1}),this._hud.label=`${p}:hud`,this._hud.zIndex=D(`hud`),this._root.addChild(this._hud)),this._hud.visible=!0,this._hud.update({rows:e});let n=this._reelSet.viewport;this._hud.position.set(n.x,this._geometryTop()-S-this._hud.plateHeight)}_geometryTop(){let e=this._reelSet.viewport.y;for(let[t,n]of this._graphics){if(!this._active.has(t))continue;let r=n.getLocalBounds();r.height>0&&(e=Math.min(e,r.y))}return e}_drawMetrics(){this._metricsPlaque||(this._metricsPlaque=new l({fontSize:b,accent:f.metrics,minWidth:w,maxWidth:w}),this._metricsPlaque.label=`${p}:metrics`,this._metricsPlaque.zIndex=D(`metrics`),this._root.addChild(this._metricsPlaque)),this._metricsPlaque.visible=!0;let e=this._metrics.current;if(!e){this._metricsPlaque.update({title:`ROUND - waiting for a spin`,rows:[`time`,`land`,`tease`,`skip`,`pool`,`fps`,`wins`].map(e=>({text:`${e.padEnd(6)} -`,color:v}))});return}let n=this._metrics.isActive,r=this._metrics.length,i=e.reels.map(e=>e.stoppingAt).filter(e=>e!==null),a=i.length?Math.min(...i):null,o=e.landOrder.map(t=>e.reels[t].landedAt).filter(e=>e!==null),s=o.slice(1).map((e,t)=>e-o[t]),c=e.reels.filter(e=>e.tease!==null),u=e.reels.reduce((e,t)=>e+t.symbolSwaps,0),d=e.skips[e.skips.length-1],m=this._ticker?`${Math.round(this._ticker.FPS)}`:`-`,h=[{text:`time ${A(r)}`+(a===null?``:` first stop +${A(a)}`)},{text:`land ${e.landOrder.length?e.landOrder.join(` `):`-`}`+(s.length?` max gap ${A(Math.max(...s))}`:``),color:e.landOrder.length?void 0:v},{text:`tease `+(c.length?c.map(e=>{let t=e.tease;return`r${e.reel} ${A((t.end??r)-t.start)}`}).join(` `):`-`),color:c.length?t.t.anticipation:v},{text:d?`skip ${d.mode} r${d.reels.join(`,`)}${d.partial?` partial`:``} @${A(d.at)}`+(e.skips.length>1?` (x${e.skips.length})`:``):e.queuedSkipAt===null?`skip -`:`skip queued @${A(e.queuedSkipAt)}`,color:d?_[d.mode]:e.queuedSkipAt===null?v:_.quicken},{text:`swaps ${u} events ${e.events}`},{text:`fps ${m} pins ${this._reelSet.pins.size} spotlight ${this._reelSet.spotlight.isActive?`on`:`off`}`}];h.push({text:`wins ${e.wins} chains ${e.cascadeChains}`,color:e.wins>0||e.cascadeChains>0?void 0:v}),this._metricsPlaque.update({title:`ROUND ${e.index} ${e.profile} `+(n?`live`:e.wasSkipped?`skipped`:`done`)+(e.boosted?` boosted`:``),rows:h})}_drawTimeline(){this._timeline||(this._timeline=new n.Container,this._timeline.label=`${p}:timeline`,this._timeline.zIndex=D(`timeline`),this._timelineGfx=new r.SilkGraphics({label:`${p}:timeline:gfx`}),this._timeline.addChild(this._timelineGfx),this._root.addChild(this._timeline)),this._timeline.visible=!0;let e=this._timelineGfx;e.clear();let i=this._metrics.current,a=this._reelSet.reels.length,o=this._timelineWidth(),s=a*11-E,c=22+s+4+13+8-4,l=o-8;e.rect(0,1.5,o,c).fill({color:0,alpha:.35,blur:3}),e.rect(0,0,o,c).fill({color:724500,alpha:.84}).stroke({color:16777215,alpha:.1,width:1,alignment:`inside`}),this._timeline.boundsArea=new n.Rectangle(0,0,o,c);let u=0,d=(e,t,n,r)=>{let i=this._text(this._timelineTexts,u++,r,x,this._timeline);return i.text=e,i.x=Math.round(t),i.y=Math.round(n),i},f=[];for(let e of i?.reels??[])for(let t of e.phases)f.includes(t.phase)||f.push(t.phase);let m=8,h=x*.6;f.length===0&&d(`timeline (waiting for a spin)`,m,6,v);for(let t of f){let n=10+t.length*h;if(m+n>o-8)break;e.rect(m,9,7,7).fill(k(t)),d(t,m+10,6,v),m+=n+10}let y=Math.max(this._metrics.length,500),b=j(y),S=Math.ceil(y/b)*b,C=(l-32)/S,w=e=>32+Math.min(e,S)*C;for(let t=0;t<=S;t+=b){let n=w(t);e.line(n,20,n,22+s+2).stroke({color:16777215,alpha:.14,width:1,dash:[1,3]});let r=t===0?`0`:b>=1e3?`${t/1e3}s`:`${t}`;d(r,n-r.length*h/2,22+s+4,v)}for(let n=0;n<a;n++){let r=22+n*11;d(`r${n}`,8,r-2,v),e.rect(32,r,l-32,T).fill({color:16777215,alpha:.05});let a=i?.reels[n];if(a){for(let t of a.phases){let n=w(t.start),i=w(t.end??y);e.rect(n,r,Math.max(1.5,i-n),T).fill({color:k(t.phase),alpha:.9})}if(a.tease&&e.line(w(a.tease.start),r+T+1.5,w(a.tease.end??y),r+T+1.5).stroke({color:t.t.anticipation,width:1.5,cap:`round`}),a.speed.length>=4){let t=a.speed.length/2,n=Math.max(1,Math.ceil(t/(l-32)))*2,i=[];for(let e=0;e<a.speed.length;e+=n){let t=Math.min(1.25,Math.max(0,a.speed[e+1]));i.push(w(a.speed[e]),r+T-t/1.25*T)}e.polyline(i).stroke({color:16777215,alpha:.85,width:1,cap:`round`})}if(a.stoppingAt!==null){let t=w(a.stoppingAt);e.line(t,r-1.5,t,r+T+1.5).stroke({color:16777215,alpha:.7,width:1})}a.landedAt!==null&&e.circle(w(a.landedAt),r+T/2,3).fill(g).stroke({color:724500,width:1})}}for(let t of i?.skips??[]){let n=w(t.at);e.line(n,19,n,22+s+3).stroke({color:_[t.mode],width:1.5,dash:[3,2]})}if(i&&this._metrics.isActive){let t=w(y);e.line(t,19,t,22+s+3).stroke({color:16777215,alpha:.6,width:1})}this._hideTextsFrom(this._timelineTexts,u)}_timelineWidth(){let e=this._reelSet.viewport.maskWidth,t=this._panelsSideBySide()&&this._metricsPlaque?this._metricsPlaque.plateWidth+S:0;return Math.max(C,e-t)}_panelsSideBySide(){return!this._active.has(`metrics`)||!this._metricsPlaque?!1:this._reelSet.viewport.maskWidth-this._metricsPlaque.plateWidth-S>=C}_layoutPanels(){let e=this._reelSet.viewport,t=e.x,n=e.y+e.maskHeight+S,r=this._active.has(`metrics`)?this._metricsPlaque:null,i=this._active.has(`timeline`)?this._timeline:null;r&&r.position.set(t,n),i&&(r?this._panelsSideBySide()?i.position.set(t+r.plateWidth+S,n):i.position.set(t,n+r.plateHeight+S):i.position.set(t,n))}},P=[16763210,4905215,16735370,9240427,12094719,16752451],F=class extends n.Container{_reelSet;_style;_palette;_next=0;constructor(e,t={}){super(),this._reelSet=e,this.label=`pixi-reels:winLines`,this.eventMode=`none`,this._palette=t.palette?.length?t.palette:P,this._style={color:t.color,width:t.width??5,alpha:t.alpha??1,glow:t.glow??8,dot:t.dot,smooth:t.smooth??!1},e.addChild(this)}line(e,t={}){let n=this._resolve(t),r=e.map(e=>this._centre(e.reelIndex,e.cellIndex)),i=this._add();if(r.length>=2){let e=r.flatMap(e=>[e.x,e.y]),t={smooth:n.smooth?`catmull`:!1};n.glow>0&&i.polyline(e,t).stroke({color:n.color,width:n.width*2.4,alpha:n.alpha*.45,blur:n.glow,cap:`round`}),i.polyline(e,t).stroke({color:n.color,width:n.width,alpha:n.alpha,cap:`round`})}return this._dots(i,r,n),i}ways(e,t={}){let n=this._resolve(t),r=t.fromReel??0,i=e.map((e,t)=>e.map(e=>this._centre(r+t,e))),a=this._add();for(let e=0;e+1<i.length;e++)for(let t of i[e])for(let r of i[e+1])n.glow>0&&a.line(t.x,t.y,r.x,r.y).stroke({color:n.color,width:n.width*2.4,alpha:n.alpha*.35,blur:n.glow,cap:`round`}),a.line(t.x,t.y,r.x,r.y).stroke({color:n.color,width:n.width,alpha:n.alpha,cap:`round`});return this._dots(a,i.flat(),n),a}clear(){for(let e of this.removeChildren())e.destroy();return this._next=0,this}get isDestroyed(){return this.destroyed}destroy(){this.destroyed||(this.clear(),super.destroy({children:!0}))}_add(){if(this.destroyed)throw Error(`WinLines: line() / ways() called after destroy(). Make a new WinLines for the next win.`);let e=new r.SilkGraphics({label:`pixi-reels:winLine`});return this.addChild(e),e}_resolve(e){let t=e.color??this._style.color??this._palette[this._next++%this._palette.length],n=e.width??this._style.width;return{color:t,width:n,alpha:e.alpha??this._style.alpha,glow:e.glow??this._style.glow,dot:e.dot??this._style.dot??n*1.3,smooth:e.smooth??this._style.smooth}}_dots(e,t,n){if(!(n.dot<=0))for(let r of t)e.circle(r.x,r.y,n.dot).fill({color:n.color,alpha:n.alpha}).stroke({color:0,alpha:.35*n.alpha,width:1.5,alignment:`outside`})}_centre(e,t){let n=this._reelSet.getCellBounds(e,t);return{x:n.x+n.width/2,y:n.y+n.height/2}}};exports.DEBUG_FONT=a,exports.DebugPlaque=l,exports.OVERLAY_LABEL=p,exports.SpinMetrics=e.t,exports.WinLines=F,exports.debugOverlay=M,exports.roundRectPath=u;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./SpinMetrics-9nsu5jI6.cjs"),t=require("./PhaseCardSymbol-Ct9bCE4I.cjs");let n=require("pixi.js"),r=require("pixi-silk");var i=8;function a(e){let t=new n.Matrix;e.onRender=n=>{e.getGlobalTransform(t,!1);let r=Math.hypot(t.a,t.b)*n.resolution,a=Math.min(i,Math.max(1,Math.ceil(r*2)/2));e.resolution!==a&&(e.resolution=a)}}function o(e,t){if(e.length<=t)return[e];let n=[],r=``;for(let i of e.split(` `)){let e=r?`${r} ${i}`:i;if(e.length<=t){r=e;continue}r&&n.push(r);let a=i;for(;a.length>t;)n.push(a.slice(0,t)),a=a.slice(t);r=a}return r&&n.push(r),n}var s=`'Fira Code', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace`,c=.6,l=15197668,u=724500,d=class extends n.Container{_opts;_gfx=new r.SilkGraphics({label:`DebugPlaque:plate`});_title=null;_texts=[];_width=0;_height=0;constructor(e={}){super(),this.label=`DebugPlaque`,this.eventMode=`none`,this._opts={...e},this.addChild(this._gfx),this._layout()}get isDestroyed(){return this.destroyed}destroy(e){this.destroyed||super.destroy(typeof e==`object`?{...e,children:!0}:{children:!0})}get plateWidth(){return this._width}get plateHeight(){return this._height}update(e){return Object.assign(this._opts,e),this._layout(),this}setRows(e){return this.update({rows:e})}get text(){let e=this._opts;return e.rows?e.rows.map(e=>typeof e==`string`?e:e.text).join(`
2
+ `):e.text??``}set text(e){this._opts.rows=void 0,this._opts.text=e,this._layout()}_rows(e,t){let n=this._opts,r=n.color??l,i=(n.rows??(n.text===void 0?[]:n.text.split(`
3
+ `))).map(e=>typeof e==`string`?{text:e,color:r,swatch:null,meter:null,meterColor:null}:{text:e.text,color:e.color??r,swatch:e.swatch??null,meter:e.meter??null,meterColor:e.meterColor??null});if(n.maxWidth===void 0)return i;let a=Math.max(1,Math.floor((n.maxWidth-t*2)/(e*c)));return i.flatMap(e=>o(e.text,a).map((t,n)=>n===0?{...e,text:t}:{...e,text:t,swatch:null,meter:null}))}_layout(){if(this.destroyed)return;let e=this._opts,t=e.fontSize??11,n=Math.round(t*1.4),r=t*c,[i,a]=typeof e.padding==`number`?[e.padding,e.padding]:e.padding??[Math.round(t*.75),Math.round(t*.45)],o=this._rows(t,i),s=e.title??``,d=Math.round(t*.75),f=o.some(e=>e.swatch!==null)?d+Math.round(t*.5):0,p=Math.round(t*4),m=Math.max(3,Math.round(t*.36)),h=o.some(e=>e.meter!==null)?p+Math.round(t*.7):0,g=e=>e.length*r,_=o.reduce((e,t)=>Math.max(e,f+g(t.text)+h),0),v=Math.max(_,g(s)),y=s?n+Math.round(t*.15):0,b=Math.ceil(Math.min(e.maxWidth??1/0,Math.max(e.minWidth??0,v+i*2))),x=Math.ceil(y+Math.max(o.length,e.reserveRows??0)*n+a*2);this._width=b,this._height=x;let S=this._gfx;S.clear();let C=e.radius===`pill`?x/2:e.radius??0;(e.shadow??!0)&&S.roundRect(0,1.5,b,x,C,.6).fill({color:0,alpha:.35,blur:3}),S.roundRect(0,0,b,x,C,.6).fill({color:e.fill??u,alpha:e.fillAlpha??.84}).stroke({color:e.accent??16777215,alpha:e.accent===void 0?.1:.5,width:1,alignment:`inside`});let w=e=>e+(n-t*1.25)/2;s?(this._title??=this._makeText(!0),this._title.visible=!0,this._title.text=s,this._title.style.fill=e.accent??e.color??l,this._title.style.fontSize=t,this._title.x=this._alignX(g(s),b,i),this._title.y=w(a)):this._title&&(this._title.visible=!1);let T=a+y;o.forEach((r,a)=>{let o=this._texts[a]??=this._makeText(!1);o.visible=!0,o.text=r.text,o.style.fill=r.color,o.style.fontSize=t;let s=T+a*n,c=this._alignX(f+g(r.text)+h,b,i);if(o.x=c+f,o.y=w(s),r.swatch!==null&&S.rect(c,s+(n-d)/2,d,d).fill(r.swatch),r.meter!==null){let t=b-i-p,a=s+(n-m)/2,o=Math.min(1,Math.max(0,r.meter));S.pill(t,a,p,m).fill({color:16777215,alpha:.14}),o>0&&S.pill(t,a,Math.max(m,p*o),m).fill(r.meterColor??e.accent??r.color)}});for(let e=o.length;e<this._texts.length;e++)this._texts[e].visible=!1;let E=e.anchor??0,D=typeof E==`number`?E:E.x,O=typeof E==`number`?E:E.y;this.pivot.set(Math.round(b*D),Math.round(x*O)),this.hitArea=this._plateRect(this.hitArea,b,x),this.boundsArea=this._plateRect(this.boundsArea,b,x)}_plateRect(e,t,r){return e instanceof n.Rectangle?(e.width=t,e.height=r,e):new n.Rectangle(0,0,t,r)}_alignX(e,t,n){switch(this._opts.align){case`center`:return Math.round((t-e)/2);case`right`:return Math.round(t-n-e);default:return n}}_makeText(e){let t=new n.Text({text:``,style:{fontFamily:s,fontSize:this._opts.fontSize??11,fontWeight:e?`600`:`400`,fill:this._opts.color??l}});return a(t),this.addChild(t),t}};function f(e,t,n,r,i,a=0){let o=Math.max(0,Math.min(a,r/2,i/2)),s=t+r,c=n+i;return e.moveTo(t+o,n).lineTo(s-o,n).quadraticCurveTo(s,n,s,n+o).lineTo(s,c-o).quadraticCurveTo(s,c,s-o,c).lineTo(t+o,c).quadraticCurveTo(t,c,t,c-o).lineTo(t,n+o).quadraticCurveTo(t,n,t+o,n).closePath()}var p=[`mask`,`cells`,`buffers`,`thresholds`,`axis`,`feed`,`bounds`,`blocks`,`pins`,`hud`,`metrics`,`timeline`],m={mask:16726832,cells:3321318,buffers:16749824,axis:3199320,feed:6607615,thresholds:16729402,bounds:16723349,blocks:16763904,pins:11490014,hud:16777215,metrics:6607615,timeline:16777215},h=`pixi-reels:debugOverlay`,g=3458905,_=3458905,v=3199320,y={slam:16729402,quicken:16766474},b=10265519,x=16020150,S=10,C=9,w=8,T=200,E=232,D=7,O=4;function k(e){return p.indexOf(e)*10}function A(e){return e===void 0||e===`all`?new Set(p):new Set(e)}function j(e){return e===`nudge`?x:t.t[e]??t.t.other}function M(e){return e<1e4?`${Math.round(e)}ms`:`${(e/1e3).toFixed(1)}s`}function N(e){for(let t of[50,100,200,250,500,1e3,2e3,2500,5e3,1e4])if(e/t<=6)return t;return 2e4}function P(e,t={}){return new F(e,t)}var F=class{_reelSet;_root=new n.Container;_graphics=new Map;_cellLabels=[];_hud=null;_metricsPlaque=null;_timeline=null;_timelineGfx=null;_timelineTexts=[];_active;_ticker=null;_tickerRef=null;_metrics;_ownsMetrics;_isDestroyed=!1;_phase;_reelDetach=[];_onStatic=()=>this._redrawStatic();_onSetEvent=e=>{e!==`destroyed`&&this._redrawInfo()};_onDestroyed=()=>this.destroy();_onReelsAdded=e=>{for(let t=e.from;t<e.from+e.count;t++)this._phase[t]=`idle`,this._trackPhase(this._reelSet.reels[t],t);this._redrawStatic()};_onReelsRemoved=e=>{this._phase.length=e.from;for(let t of this._reelDetach.splice(e.from))t();this._redrawStatic()};constructor(t,r){this._reelSet=t,this._active=A(r.layers),this._phase=t.reels.map(()=>`idle`),this._root.zIndex=1e6,this._root.eventMode=`none`,this._root.label=h,this._root.sortableChildren=!0;let i=r.host??t;if(i.addChild(this._root),i!==t){let e=new n.Matrix,r=new n.Matrix;this._root.onRender=()=>{t.getGlobalTransform(e,!1),i.getGlobalTransform(r,!1),this._root.setFromMatrix(r.invert().append(e))}}t.reels.forEach((e,t)=>this._trackPhase(e,t)),t.events.on(`shape:changed`,this._onStatic),t.events.on(`adjust:complete`,this._onStatic),t.events.on(`rows:added`,this._onStatic),t.events.on(`rows:removed`,this._onStatic),t.events.on(`column:set`,this._onStatic),t.events.on(`reels:added`,this._onReelsAdded),t.events.on(`reels:removed`,this._onReelsRemoved),t.events.on(`destroyed`,this._onDestroyed),r.live&&(this._ticker=r.ticker??n.Ticker.shared),this._ownsMetrics=!r.metrics,this._metrics=r.metrics??new e.t(t,{ticker:this._ticker??void 0}),this._ticker?(this._tickerRef=new e.n(this._ticker),this._tickerRef.add(()=>this._redrawLive())):t.events.onAny(this._onSetEvent),this.redraw()}get isDestroyed(){return this._isDestroyed}_trackPhase(e,t){let n=e=>{this._phase[t]=e},r=e=>{this._phase[t]===e&&(this._phase[t]=`idle`)};e.events.on(`phase:enter`,n),e.events.on(`phase:exit`,r),this._reelDetach[t]=()=>{e.events.off(`phase:enter`,n),e.events.off(`phase:exit`,r)}}get metrics(){return this._metrics}setLayers(e){if(!this._isDestroyed){this._active=A(e);for(let[e,t]of this._graphics)this._active.has(e)?t.visible=!0:(t.clear(),t.visible=!1);this._active.has(`cells`)||this._hideTextsFrom(this._cellLabels,0),this._hud&&(this._hud.visible=this._active.has(`hud`)),this._metricsPlaque&&(this._metricsPlaque.visible=this._active.has(`metrics`)),this._timeline&&(this._timeline.visible=this._active.has(`timeline`)),this.redraw()}}redraw(){this._isDestroyed||(this._redrawStatic(),this._redrawLive())}describe(){return{layers:[...this._active],reels:this._reelSet.reels.map((e,t)=>{let n=e.axis,r=this._arrowMains(e),i=e.motion.slotPitch;return{reel:t,orientation:n.orientation,direction:n.direction,feedEdge:n.feedEdge,axisArrow:r,feedMain:this._feedMain(e),thresholds:{start:-(e.bufferStart+1)*i,end:(e.visibleCells+e.bufferEnd)*i},visibleCells:e.visibleCells,phase:this._phase[t]}}),round:this._metrics.current?JSON.parse(JSON.stringify(this._metrics.current)):null}}destroy(){if(!this._isDestroyed){this._isDestroyed=!0,this._tickerRef?.destroy(),this._tickerRef=null,this._reelSet.events.off(`shape:changed`,this._onStatic),this._reelSet.events.off(`adjust:complete`,this._onStatic),this._reelSet.events.off(`rows:added`,this._onStatic),this._reelSet.events.off(`rows:removed`,this._onStatic),this._reelSet.events.off(`column:set`,this._onStatic),this._reelSet.events.off(`reels:added`,this._onReelsAdded),this._reelSet.events.off(`reels:removed`,this._onReelsRemoved),this._reelSet.events.off(`destroyed`,this._onDestroyed),this._reelSet.events.offAny(this._onSetEvent);for(let e of this._reelDetach)e();this._reelDetach.length=0,this._ownsMetrics&&this._metrics.destroy(),this._root.parent&&this._root.parent.removeChild(this._root),this._root.destroy({children:!0}),this._graphics.clear(),this._cellLabels.length=0,this._timelineTexts.length=0,this._hud=null,this._metricsPlaque=null,this._timeline=null,this._timelineGfx=null}}_redrawStatic(){this._isDestroyed||(this._active.has(`mask`)&&this._drawMask(),this._active.has(`cells`)&&this._drawCells(),this._active.has(`buffers`)&&this._drawBuffers(),this._active.has(`thresholds`)&&this._drawThresholds(),this._active.has(`axis`)&&this._drawAxis(),this._active.has(`feed`)&&this._drawFeed())}_redrawLive(){this._isDestroyed||(this._active.has(`bounds`)&&this._drawBounds(),this._active.has(`blocks`)&&this._drawBlocks(),this._active.has(`pins`)&&this._drawPins(),this._redrawInfo())}_redrawInfo(){this._isDestroyed||(this._active.has(`hud`)&&this._drawHud(),this._active.has(`metrics`)&&this._drawMetrics(),this._active.has(`timeline`)&&this._drawTimeline(),this._layoutPanels())}_layer(e){let t=this._graphics.get(e);return t||(t=new r.SilkGraphics({label:`${h}:${e}`}),t.zIndex=k(e),this._graphics.set(e,t),this._root.addChild(t)),t.visible=!0,t.clear(),t}_text(e,t,r,i,o){let c=e[t];return c||(c=new n.Text({text:``,style:{fontFamily:s,fontSize:i,fill:r}}),a(c),e[t]=c,o.addChild(c)),c.style.fill=r,c.visible=!0,c}_hideTextsFrom(e,t){for(let n=t;n<e.length;n++)e[n].visible=!1}_drawMask(){let e=this._layer(`mask`),t=this._reelSet.viewport,n=t.x,r=t.y;e.rect(n,r,t.maskWidth,t.maskHeight).stroke({color:m.mask,width:2});for(let i of t.maskRects)f(e,n+i.x,r+i.y,i.width,i.height).stroke({color:g,width:1.5,dash:[6,4]})}_drawCells(){let e=this._layer(`cells`),t=C*.6,n=0;this._reelSet.reels.forEach((r,i)=>{for(let a=0;a<r.visibleCells;a++){let r=this._reelSet.getCellBounds(i,a),o=this._reelSet.getCellQuad(i,a);o?e.poly(o,!0).stroke({color:m.cells,width:1,alpha:.85}):e.rect(r.x+.5,r.y+.5,r.width-1,r.height-1).stroke({color:m.cells,width:1,alpha:.85});let s=`${i},${a}`,c=(o?o[0].x:r.x)+3,l=(o?o[0].y:r.y)+3;e.rect(c-2,l-1,s.length*t+4,12).fill({color:0,alpha:.55});let u=this._text(this._cellLabels,n++,m.cells,C,this._root);u.zIndex=k(`cells`)+1,u.text=s,u.x=c,u.y=l}}),this._hideTextsFrom(this._cellLabels,n)}_drawBuffers(){let e=this._layer(`buffers`);for(let t of this._reelSet.reels){let n=t.motion.slotPitch,r=n=>{let r=t.curve,i=r?r.mapMain(n):n,a=r?r.mapMain(n+t.cellMain):n+t.cellMain,o=r?t.cellCross*r.scaleAt(n+t.cellMain/2):t.cellCross,s=this._reelRect(t,(t.cellCross-o)/2,i,o,a-i);f(e,s.x,s.y,s.width,s.height).stroke({color:m.buffers,width:1,alpha:.6,dash:[4,3]})};for(let e=1;e<=t.bufferStart;e++)r(-e*n);for(let e=0;e<t.bufferEnd;e++)r((t.visibleCells+e)*n)}}_reelPoint(e,t,n){let r=e.axis,i=r.toScreen(r.getCross(e.container)+t,r.getMain(e.container)+n);return{x:this._reelSet.viewport.x+i.x,y:this._reelSet.viewport.y+i.y}}_reelRect(e,t,n,r,i){let a=this._reelPoint(e,t,n),o=e.axis.toScreen(r,i);return{x:a.x,y:a.y,width:o.x,height:o.y}}_arrowMains(e){let t=e.visibleCells*e.motion.slotPitch,n=e.axis.polarity>0;return{fromMain:n?t*.2:t*.8,toMain:n?t*.8:t*.2}}_feedMain(e){let t=e.motion.slotPitch;return e.axis.feedEdge===`start`?-e.bufferStart*t:e.visibleCells*t}_drawAxis(){let e=this._layer(`axis`);for(let t of this._reelSet.reels){let n=t.visibleCells*t.motion.slotPitch,r=t.cellCross/2,{fromMain:i,toMain:a}=this._arrowMains(t),o=t.axis.polarity>0,s=Math.min(n*.12,t.cellCross*.4)||8,c=a-(o?s:-s),l=this._reelPoint(t,r,i),u=this._reelPoint(t,r,c),d=this._reelPoint(t,r,a),f=this._reelPoint(t,r-s*.6,c),p=this._reelPoint(t,r+s*.6,c);e.line(l.x,l.y,u.x,u.y).stroke({color:m.axis,width:3,cap:`round`}),e.triangle(d.x,d.y,f.x,f.y,p.x,p.y,1).fill(m.axis)}}_drawFeed(){let e=this._layer(`feed`);for(let t of this._reelSet.reels){let n=t.motion.slotPitch,r=this._reelRect(t,0,this._feedMain(t),t.cellCross,n*.18);e.roundRect(r.x,r.y,r.width,r.height,Math.min(r.width,r.height)/2).fill({color:m.feed,alpha:.55})}}_drawThresholds(){let e=this._layer(`thresholds`);for(let t of this._reelSet.reels){let n=t.motion.slotPitch,r=[-(t.bufferStart+1)*n,(t.visibleCells+t.bufferEnd)*n];for(let n of r){let r=this._reelPoint(t,0,n),i=this._reelPoint(t,t.cellCross,n);e.line(r.x,r.y,i.x,i.y).stroke({color:m.thresholds,width:2,alpha:.9,dash:[6,4]})}}}_drawBounds(){let e=this._layer(`bounds`);this._reelSet.reels.forEach(t=>{for(let n=0;n<t.visibleCells;n++){let r=t.getSymbolAt(n).view.getBounds(),i=this._root.toLocal({x:r.x,y:r.y}),a=this._root.toLocal({x:r.x+r.width,y:r.y+r.height});e.rect(i.x,i.y,a.x-i.x,a.y-i.y).stroke({color:m.bounds,width:1})}})}_drawBlocks(){let e=this._layer(`blocks`);this._reelSet.reels.forEach((t,n)=>{for(let r=0;r<t.visibleCells;r++){let t=this._reelSet.getSymbolFootprint(n,r);if(t.size.reels<=1&&t.size.cells<=1||t.anchor.reel!==n||t.anchor.cell!==r)continue;let i=this._reelSet.getBlockBounds(n,r);e.rect(i.x,i.y,i.width,i.height).fill({color:m.blocks,alpha:.08}).stroke({color:m.blocks,width:3,alignment:`inside`})}})}_drawPins(){let e=this._layer(`pins`);this._reelSet.reels.forEach((t,n)=>{for(let r=0;r<t.visibleCells;r++){if(!this._reelSet.getPin(n,r))continue;let t=this._reelSet.getCellBounds(n,r);e.rect(t.x,t.y,t.width,t.height).stroke({color:m.pins,width:3,alignment:`inside`}),e.line(t.x,t.y,t.x+t.width,t.y+t.height).line(t.x+t.width,t.y,t.x,t.y+t.height).stroke({color:_,width:1,alpha:.8})}})}_drawHud(){let e=this._reelSet.reels.map((e,n)=>{let r=e.axis,i=r.orientation===`vertical`?`V`:`H`,a=r.direction===`forward`?`F`:`R`,o=this._phase[n];return{text:`r${n} ${i}${a} feed=${r.feedEdge} spd=${e.speed.toFixed(1)} ${o} cells=${e.visibleCells}`,swatch:o===`idle`?t.t.rest:j(o),meter:Math.abs(e.speedNormalized),meterColor:o===`idle`?b:j(o)}});this._hud||(this._hud=new d({fontSize:S,padding:[6,4],shadow:!1}),this._hud.label=`${h}:hud`,this._hud.zIndex=k(`hud`),this._root.addChild(this._hud)),this._hud.visible=!0,this._hud.update({rows:e});let n=this._reelSet.viewport;this._hud.position.set(n.x,this._geometryTop()-w-this._hud.plateHeight)}_geometryTop(){let e=this._reelSet.viewport.y;for(let[t,n]of this._graphics){if(!this._active.has(t))continue;let r=n.getLocalBounds();r.height>0&&(e=Math.min(e,r.y))}return e}_drawMetrics(){this._metricsPlaque||(this._metricsPlaque=new d({fontSize:S,accent:m.metrics,minWidth:E,maxWidth:E}),this._metricsPlaque.label=`${h}:metrics`,this._metricsPlaque.zIndex=k(`metrics`),this._root.addChild(this._metricsPlaque)),this._metricsPlaque.visible=!0;let e=this._metrics.current;if(!e){this._metricsPlaque.update({title:`ROUND - waiting for a spin`,rows:[`time`,`land`,`tease`,`skip`,`pool`,`fps`,`wins`].map(e=>({text:`${e.padEnd(6)} -`,color:b}))});return}let n=this._metrics.isActive,r=this._metrics.length,i=e.reels.map(e=>e.stoppingAt).filter(e=>e!==null),a=i.length?Math.min(...i):null,o=e.landOrder.map(t=>e.reels[t].landedAt).filter(e=>e!==null),s=o.slice(1).map((e,t)=>e-o[t]),c=e.reels.filter(e=>e.tease!==null),l=e.reels.reduce((e,t)=>e+t.symbolSwaps,0),u=e.skips[e.skips.length-1],f=this._ticker?`${Math.round(this._ticker.FPS)}`:`-`,p=[{text:`time ${M(r)}`+(a===null?``:` first stop +${M(a)}`)},{text:`land ${e.landOrder.length?e.landOrder.join(` `):`-`}`+(s.length?` max gap ${M(Math.max(...s))}`:``),color:e.landOrder.length?void 0:b},{text:`tease `+(c.length?c.map(e=>{let t=e.tease;return`r${e.reel} ${M((t.end??r)-t.start)}`}).join(` `):`-`),color:c.length?t.t.anticipation:b},{text:u?`skip ${u.mode} r${u.reels.join(`,`)}${u.partial?` partial`:``} @${M(u.at)}`+(e.skips.length>1?` (x${e.skips.length})`:``):e.queuedSkipAt===null?`skip -`:`skip queued @${M(e.queuedSkipAt)}`,color:u?y[u.mode]:e.queuedSkipAt===null?b:y.quicken},{text:`swaps ${l} events ${e.events}`},{text:`fps ${f} pins ${this._reelSet.pins.size} spotlight ${this._reelSet.spotlight.isActive?`on`:`off`}`}];p.push({text:`wins ${e.wins} chains ${e.cascadeChains}`,color:e.wins>0||e.cascadeChains>0?void 0:b}),this._metricsPlaque.update({title:`ROUND ${e.index} ${e.profile} `+(n?`live`:e.wasSkipped?`skipped`:`done`)+(e.boosted?` boosted`:``),rows:p})}_drawTimeline(){this._timeline||(this._timeline=new n.Container,this._timeline.label=`${h}:timeline`,this._timeline.zIndex=k(`timeline`),this._timelineGfx=new r.SilkGraphics({label:`${h}:timeline:gfx`}),this._timeline.addChild(this._timelineGfx),this._root.addChild(this._timeline)),this._timeline.visible=!0;let e=this._timelineGfx;e.clear();let i=this._metrics.current,a=this._reelSet.reels.length,o=this._timelineWidth(),s=a*11-O,c=22+s+4+13+8-4,l=o-8;e.rect(0,1.5,o,c).fill({color:0,alpha:.35,blur:3}),e.rect(0,0,o,c).fill({color:724500,alpha:.84}).stroke({color:16777215,alpha:.1,width:1,alignment:`inside`}),this._timeline.boundsArea=new n.Rectangle(0,0,o,c);let u=0,d=(e,t,n,r)=>{let i=this._text(this._timelineTexts,u++,r,C,this._timeline);return i.text=e,i.x=Math.round(t),i.y=Math.round(n),i},f=[];for(let e of i?.reels??[])for(let t of e.phases)f.includes(t.phase)||f.push(t.phase);let p=8,m=C*.6;f.length===0&&d(`timeline (waiting for a spin)`,p,6,b);for(let t of f){let n=10+t.length*m;if(p+n>o-8)break;e.rect(p,9,7,7).fill(j(t)),d(t,p+10,6,b),p+=n+10}let g=Math.max(this._metrics.length,500),_=N(g),x=Math.ceil(g/_)*_,S=(l-32)/x,w=e=>32+Math.min(e,x)*S;for(let t=0;t<=x;t+=_){let n=w(t);e.line(n,20,n,22+s+2).stroke({color:16777215,alpha:.14,width:1,dash:[1,3]});let r=t===0?`0`:_>=1e3?`${t/1e3}s`:`${t}`;d(r,n-r.length*m/2,22+s+4,b)}for(let n=0;n<a;n++){let r=22+n*11;d(`r${n}`,8,r-2,b),e.rect(32,r,l-32,D).fill({color:16777215,alpha:.05});let a=i?.reels[n];if(a){for(let t of a.phases){let n=w(t.start),i=w(t.end??g);e.rect(n,r,Math.max(1.5,i-n),D).fill({color:j(t.phase),alpha:.9})}if(a.tease&&e.line(w(a.tease.start),r+D+1.5,w(a.tease.end??g),r+D+1.5).stroke({color:t.t.anticipation,width:1.5,cap:`round`}),a.speed.length>=4){let t=a.speed.length/2,n=Math.max(1,Math.ceil(t/(l-32)))*2,i=[];for(let e=0;e<a.speed.length;e+=n){let t=Math.min(1.25,Math.max(0,a.speed[e+1]));i.push(w(a.speed[e]),r+D-t/1.25*D)}e.polyline(i).stroke({color:16777215,alpha:.85,width:1,cap:`round`})}if(a.stoppingAt!==null){let t=w(a.stoppingAt);e.line(t,r-1.5,t,r+D+1.5).stroke({color:16777215,alpha:.7,width:1})}a.landedAt!==null&&e.circle(w(a.landedAt),r+D/2,3).fill(v).stroke({color:724500,width:1})}}for(let t of i?.skips??[]){let n=w(t.at);e.line(n,19,n,22+s+3).stroke({color:y[t.mode],width:1.5,dash:[3,2]})}if(i&&this._metrics.isActive){let t=w(g);e.line(t,19,t,22+s+3).stroke({color:16777215,alpha:.6,width:1})}this._hideTextsFrom(this._timelineTexts,u)}_timelineWidth(){let e=this._reelSet.viewport.maskWidth,t=this._panelsSideBySide()&&this._metricsPlaque?this._metricsPlaque.plateWidth+w:0;return Math.max(T,e-t)}_panelsSideBySide(){return!this._active.has(`metrics`)||!this._metricsPlaque?!1:this._reelSet.viewport.maskWidth-this._metricsPlaque.plateWidth-w>=T}_layoutPanels(){let e=this._reelSet.viewport,t=e.x,n=e.y+e.maskHeight+w,r=this._active.has(`metrics`)?this._metricsPlaque:null,i=this._active.has(`timeline`)?this._timeline:null;r&&r.position.set(t,n),i&&(r?this._panelsSideBySide()?i.position.set(t+r.plateWidth+w,n):i.position.set(t,n+r.plateHeight+w):i.position.set(t,n))}},I=[16763210,4905215,16735370,9240427,12094719,16752451],L=class extends n.Container{_reelSet;_style;_palette;_next=0;constructor(e,t={}){super(),this._reelSet=e,this.label=`pixi-reels:winLines`,this.eventMode=`none`,this._palette=t.palette?.length?t.palette:I,this._style={color:t.color,width:t.width??5,alpha:t.alpha??1,glow:t.glow??8,dot:t.dot,smooth:t.smooth??!1},e.addChild(this)}line(e,t={}){let n=this._resolve(t),r=e.map(e=>this._centre(e.reelIndex,e.cellIndex)),i=this._add();if(r.length>=2){let e=r.flatMap(e=>[e.x,e.y]),t={smooth:n.smooth?`catmull`:!1};n.glow>0&&i.polyline(e,t).stroke({color:n.color,width:n.width*2.4,alpha:n.alpha*.45,blur:n.glow,cap:`round`}),i.polyline(e,t).stroke({color:n.color,width:n.width,alpha:n.alpha,cap:`round`})}return this._dots(i,r,n),i}ways(e,t={}){let n=this._resolve(t),r=t.fromReel??0,i=e.map((e,t)=>e.map(e=>this._centre(r+t,e))),a=this._add();for(let e=0;e+1<i.length;e++)for(let t of i[e])for(let r of i[e+1])n.glow>0&&a.line(t.x,t.y,r.x,r.y).stroke({color:n.color,width:n.width*2.4,alpha:n.alpha*.35,blur:n.glow,cap:`round`}),a.line(t.x,t.y,r.x,r.y).stroke({color:n.color,width:n.width,alpha:n.alpha,cap:`round`});return this._dots(a,i.flat(),n),a}clear(){for(let e of this.removeChildren())e.destroy();return this._next=0,this}get isDestroyed(){return this.destroyed}destroy(){this.destroyed||(this.clear(),super.destroy({children:!0}))}_add(){if(this.destroyed)throw Error(`WinLines: line() / ways() called after destroy(). Make a new WinLines for the next win.`);let e=new r.SilkGraphics({label:`pixi-reels:winLine`});return this.addChild(e),e}_resolve(e){let t=e.color??this._style.color??this._palette[this._next++%this._palette.length],n=e.width??this._style.width;return{color:t,width:n,alpha:e.alpha??this._style.alpha,glow:e.glow??this._style.glow,dot:e.dot??this._style.dot??n*1.3,smooth:e.smooth??this._style.smooth}}_dots(e,t,n){if(!(n.dot<=0))for(let r of t)e.circle(r.x,r.y,n.dot).fill({color:n.color,alpha:n.alpha}).stroke({color:0,alpha:.35*n.alpha,width:1.5,alignment:`outside`})}_centre(e,t){let n=this._reelSet.getCellBounds(e,t);return{x:n.x+n.width/2,y:n.y+n.height/2}}};exports.DEBUG_FONT=s,exports.DebugPlaque=d,exports.OVERLAY_LABEL=h,exports.SpinMetrics=e.t,exports.WinLines=L,exports.debugOverlay=P,exports.roundRectPath=f;
4
4
  //# sourceMappingURL=debug.cjs.map