@betorigami/game-calculations 9.0.0 → 9.0.2
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/dist/index.cjs +1 -1
- package/dist/index.d.cts +1255 -0
- package/dist/index.d.ts +908 -1922
- package/dist/index.mjs +1 -1
- package/package.json +14 -14
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var qa;((r)=>{r.UNSUPPORTED_EDGE="UNSUPPORTED_EDGE";r.INPUT_VALIDATION_ERROR="INPUT_VALIDATION_ERROR"})(qa||={});class l extends Error{static createUnsupportedEdgeError(t){return new l("UNSUPPORTED_EDGE",t)}static createValidationError(t){return new l("INPUT_VALIDATION_ERROR",t)}static isGameError(t){return t instanceof l}errorCode;constructor(t,a){super(a);this.errorCode=t}}var S;((p)=>{p.DICE="DICE";p.MINES="MINES";p.KENO="KENO";p.LIMBO="LIMBO";p.ADVANCED_DICE="ADVANCED_DICE";p.BACCARAT="BACCARAT";p.DIAMONDS="DIAMONDS";p.PLINKO="PLINKO";p.ROULETTE="ROULETTE";p.WHEEL="WHEEL";p.BLACKJACK="BLACKJACK";p.BLITZ="BLITZ";p.DARTS="DARTS"})(S||={});import{Guard as Xa}from"@betorigami/guard";class B{gameId;constructor(t){this.gameId=t}getGameResult(t){let a=this.supportedEdgeConfigurations.includes(t.edge);return Xa.against(!a,()=>l.createUnsupportedEdgeError(`${this.gameId} does not support ${t.edge}% edge. Supported edge configurations include: ${this.supportedEdgeConfigurations}`)),this.determineGameResult(t)}}import{Big as Jt}from"big.js";import Bt from"big.js";class C{static withMultiplier(t,a){return new Bt(t).times(new Bt(100-a).div(100))}static withWinChance(t,a){return Bt(100-t).div(a)}}var at=0,rt=1e4,Ft=rt-at+1,Qa=0.01,Wa=98,ga=(t)=>{if(t<at)throw l.createValidationError(`Lower bound ${t} is below minimum allowed value ${at}`)},La=(t)=>{if(t>rt)throw l.createValidationError(`Upper bound ${t} is above maximum allowed value ${rt}`)},tt=(t)=>{if(ga(t.lower),La(t.upper),t.lower>=t.upper)throw l.createValidationError(`Lower bound ${t.lower} must be less than ${t.upper}`)},Ka=(t,a)=>{let[r,n]=t.lower<=a.lower?[t,a]:[a,t];if(r.upper>n.lower)throw l.createValidationError("Bounds must not overlap")},va=(t,a)=>a>=t.lower&&a<=t.upper,tr=(t)=>t.upper-t.lower+1,mt=(t,a)=>a>t.lower&&a<t.upper,Et=(t)=>t.upper-t.lower-1,ar;((n)=>{n.ROLL_BETWEEN="ROLL_BETWEEN";n.ROLL_OUTSIDE="ROLL_OUTSIDE";n.ROLL_BETWEEN_TWO="ROLL_BETWEEN_TWO"})(ar||={});var Yt=(t)=>{let r=(()=>{switch(t.mode){case"ROLL_BETWEEN":return tt(t.bounds),Et(t.bounds);case"ROLL_OUTSIDE":return tt(t.bounds),Ft-tr(t.bounds);case"ROLL_BETWEEN_TWO":return tt(t.firstBounds),tt(t.secondBounds),Ka(t.firstBounds,t.secondBounds),Et(t.firstBounds)+Et(t.secondBounds)}})(),n=Jt(r).div(Ft).mul(100);if(n.lt(Qa))throw l.createValidationError("Win chance too low");if(n.gt(Wa))throw l.createValidationError("Win chance too high");return n},ae=(t)=>{Yt(t)};class rr extends B{constructor(){super("ADVANCED_DICE")}get supportedEdgeConfigurations(){return[1,2,3,4,8]}getBetAmount(t){return t.betAmount}determineGameResult({generator:t,edge:a,gameInputs:r}){let n=Yt(r),o=t.getRandomInt({min:at,max:rt}),c=o.value,i=(()=>{switch(r.mode){case"ROLL_BETWEEN":return mt(r.bounds,c);case"ROLL_OUTSIDE":return!va(r.bounds,c);case"ROLL_BETWEEN_TWO":return mt(r.firstBounds,c)||mt(r.secondBounds,c)}})()?C.withWinChance(a,n):new Jt(0);return{isFinished:!0,payout:{legs:[{amount:r.betAmount.mul(i)}]},payoutMultiplier:i,outputs:{result:o.values},randomValues:o}}}import ot from"big.js";import{Guard as ft}from"@betorigami/guard";var $t=0,zt=51,nt=Array.from({length:52},(t,a)=>a),qt=["Spades","Hearts","Diamonds","Clubs"],et=["Ace","Two","Three","Four","Five","Six","Seven","Eight","Nine","Ten","Jack","Queen","King"],Xt=["Jack","Queen","King"],yt={Hearts:"red",Diamonds:"red",Spades:"black",Clubs:"black"};class T{value;constructor(t){let a=nt[t];ft.againstNullOrUndefined(a,`Invalid card value: ${t}`),this.value=a}get suit(){let t=Math.floor(this.value/13),a=qt[t];return ft.againstNullOrUndefined(a,`Invalid suit index: ${t}`),a}get rank(){let t=this.value%13,a=et[t];return ft.againstNullOrUndefined(a,`Invalid rank index: ${t}`),a}toDto(){return{rank:this.rank,suit:this.suit,cardValue:this.value}}}import nr from"big.js";var R=(t)=>t.legs.reduce((a,r)=>a.add(r.amount),new nr("0"));var Ee=["Clubs","Diamonds","Hearts","Spades"],ye=["Ace","2","3","4","5","6","7","8","9","10","Jack","Queen","King"],er={Ace:"Ace",Two:"2",Three:"3",Four:"4",Five:"5",Six:"6",Seven:"7",Eight:"8",Nine:"9",Ten:"10",Jack:"Jack",Queen:"Queen",King:"King"},or;((n)=>{n.PLAYER_WIN="PLAYER_WIN";n.TIE="TIE";n.BANKER_WIN="BANKER_WIN"})(or||={});var cr;((n)=>{n.PLAYER="PLAYER";n.TIE="TIE";n.BANKER="BANKER"})(cr||={});var ir={["PLAYER_WIN"]:{betType:"PLAYER",multiplier:2},["TIE"]:{betType:"TIE",multiplier:9},["BANKER_WIN"]:{betType:"BANKER",multiplier:1.95}},Qt=(t)=>{return new ot(0).add(t.bets.reduce((r,n)=>r.add(n.amount),new ot(0)))},lr=(t,a)=>t==="TIE"&&(a==="PLAYER"||a==="BANKER");class ur extends B{constructor(){super("BACCARAT")}get supportedEdgeConfigurations(){return[1]}getBetAmount(t){return Qt(t)}determineGameResult({generator:t,gameInputs:a}){this.validateGameInputs(a);let r=t.getRandomIntsWithReplacement({min:0,max:51,count:6}),n=r.values,o=n.slice(0,3),c=n.slice(3,6),e=[],i=0;for(let f of o.slice(0,2)){let j=this.mapRandomValueToCard(f),v=this.mapRandomValueToCardValue(f);e.push(j),i=(i+v)%10}let u=[],d=0;for(let f of c.slice(0,2)){let j=this.mapRandomValueToCard(f),v=this.mapRandomValueToCardValue(f);u.push(j),d=(d+v)%10}if(!this.isNaturalWin(i,d)){let f=this.shouldDrawThirdPlayerCard(i),j=null;if(f)j=this.mapRandomValueToCardValue(o[2]),e.push(this.mapRandomValueToCard(o[2])),i=(i+j)%10;if(this.shouldDrawThirdBankerCard(d,j))u.push(this.mapRandomValueToCard(c[2])),d=(d+this.mapRandomValueToCardValue(c[2]))%10}let A;if(i===d)A="TIE";else A=i>d?"PLAYER_WIN":"BANKER_WIN";let s=Qt(a),{betType:m,multiplier:p}=ir[A],H={legs:a.bets.map((f)=>{if(f.type===m)return{amount:f.amount.mul(p)};return{amount:lr(A,f.type)?f.amount:new ot("0")}})},k=R(H),K=s.gt(0)?k.div(s):new ot(0);return{isFinished:!0,payout:H,payoutMultiplier:K,outputs:{playerCards:e,playerHandValue:i,bankerCards:u,bankerHandValue:d,gameOutcome:A,result:r.values},randomValues:r}}validateGameInputs(t){if(t.bets.length===0)throw new Error("Must place at least a single bet.");if(!t.bets.every((a)=>a.amount.gte(0)))throw new Error("Invalid bet.")}mapRandomValueToCard(t){let a=new T(t);return{suit:a.suit,rank:er[a.rank]}}isNaturalWin(t,a){let r=[8,9];return r.includes(t)||r.includes(a)}mapRandomValueToCardValue(t){let a=t%13;if(a===0)return 1;if(a>=10)return 10;return a+1}shouldDrawThirdPlayerCard(t){return t<=5}shouldDrawThirdBankerCard(t,a){if(a===null)return t<=5;if(t<=2)return!0;if(t===3)return a!==8;if(t===4)return[2,3,4,5,6,7].includes(a);if(t===5)return[4,5,6,7].includes(a);if(t===6)return[6,7].includes(a);return!1}}var St;((o)=>{o.WIN="WIN";o.LOSE="LOSE";o.PUSH="PUSH";o.PLAYER_BLACKJACK="PLAYER_BLACKJACK"})(St||={});var Ot;((r)=>{r.WON="WON";r.LOST="LOST"})(Ot||={});var Ht;((i)=>{i.START="START";i.HIT="BLACKJACK_HIT";i.STAND="BLACKJACK_STAND";i.BUY_INSURANCE="BLACKJACK_BUY_INSURANCE";i.REJECT_INSURANCE="BLACKJACK_REJECT_INSURANCE";i.DOUBLE_DOWN="BLACKJACK_DOUBLE_DOWN";i.SPLIT="BLACKJACK_SPLIT"})(Ht||={});var Dt;((o)=>{o.EXACT_PAIR="EXACT_PAIR";o.COLORED_PAIR="COLORED_PAIR";o.MIXED_PAIR="MIXED_PAIR";o.LOSS="LOSS"})(Dt||={});var ht;((e)=>{e.SUITED_TRIPS="SUITED_TRIPS";e.STRAIGHT_FLUSH="STRAIGHT_FLUSH";e.THREE_OF_A_KIND="THREE_OF_A_KIND";e.STRAIGHT="STRAIGHT";e.FLUSH="FLUSH";e.LOSS="LOSS"})(ht||={});var dr=2.5,sr=2,Ar=1,pr=0,Wt=17,Ct=21,D=21,xt=63,gt=0.5,Pt=3,_=1,w=1,he=13,bt=10,Lt=10,ct={PLAYER_BLACKJACK:dr,WIN:sr,PUSH:Ar,LOSE:pr},Kt={EXACT_PAIR:26,COLORED_PAIR:11,MIXED_PAIR:7,LOSS:0},vt={SUITED_TRIPS:101,STRAIGHT_FLUSH:51,THREE_OF_A_KIND:31,STRAIGHT:11,FLUSH:5,LOSS:0};import b from"big.js";import{Guard as E}from"@betorigami/guard";import{createStore as Sr}from"@xstate/store";import{Guard as Br}from"@betorigami/guard";class y extends T{get numericRank(){if(Xt.includes(this.rank))return Lt;return et.indexOf(this.rank)+1}static fromValue(t){return Br.against(!nt.includes(t),`Invalid card value: ${t}`),new y(t)}}class F{cards;hardHandValue;softHandValue=null;constructor(t){this.cards=t;if(this.hardHandValue=t.reduce((r,n)=>r+n.numericRank,0),t.some((r)=>r.rank==="Ace")&&this.hardHandValue+bt<=Ct)this.softHandValue=this.hardHandValue+bt}get cardCount(){return this.cards.length}get hasSoftHandValue(){return this.softHandValue!==null}get isBusted(){return this.hardHandValue>Ct}get isBlackjack(){return this.cardCount===2&&this.highestHandValue===D}get highestHandValue(){return this.softHandValue!==null?this.softHandValue:this.hardHandValue}}class J{cards;value;constructor(t){this.cards=t.map((a)=>y.fromValue(a)),this.value=new F(this.cards)}get isBusted(){return this.value.isBusted}get isBlackjack(){return this.value.isBlackjack}get highestHandValue(){return this.value.highestHandValue}get rawValues(){return this.cards.map((t)=>t.value)}toDto(){return{cards:this.cards.map((t)=>t.toDto()),value:this.highestHandValue}}}class Y extends J{otherCards;upCard;holeCard;constructor(t,a,r=[]){super([t,a,...r]);this.otherCards=r;this.upCard=y.fromValue(t),this.holeCard=y.fromValue(a)}static withInitialDeal(t){return new Y(t.upCard,t.holeCard)}addDrawnCards(t){return new Y(this.upCard.value,this.holeCard.value,[...this.otherCards,...t])}toDto(t=!1){if(t)return super.toDto();return{cards:[this.upCard.toDto()],value:new F([this.upCard]).highestHandValue}}}class N extends J{static withInitialDeal(t){return new N(t)}addDrawnCards(t){return new N([...this.rawValues,...t])}}import{Guard as it}from"@betorigami/guard";class lt{source;index=0;constructor(t){this.source=t}static from(t,a){return it.against(a<=0,`Count must be positive, got ${a}`),it.against(t.values.length!==a,`Expected ${a} values, got ${t.values.length}`),new lt(t)}get consumedValues(){return this.source.values.slice(0,this.index)}toMultipleRandomValues(){return this.source}takeOne(){let t=this.source.values[this.index];return it.againstUndefined(t,"RandomValuePool exhausted"),this.index+=1,t}take(t){it.against(this.index+t>this.source.values.length,`RandomValuePool exhausted: requested ${t} but only ${this.source.values.length-this.index} remain`);let a=this.source.values.slice(this.index,this.index+t);return this.index+=t,a}}import{Guard as ta}from"@betorigami/guard";import mr from"fast-deep-equal";class jt{gameId;edge;constructor(t,a){this.gameId=t;this.edge=a;this.validateEdge(a)}play(t,a,r=[]){let n=this.createGameStore(),o=this.generateRandomValues(t),c=o.toMultipleRandomValues();for(let u of r)n.send({...u.playerArgument,randomValuePool:o});let e=r[r.length-1];if(e)ta.against(!mr(e.state,this.toExternalState(n.getSnapshot().context.state)),"The final state of the game does not match the expected state based on the previous actions");n.send({...a,randomValuePool:o});let i=n.getSnapshot().context;return{playerArgument:i.playerArgument,state:this.toExternalState(i.state),config:i.config,additionalBetAmount:i.additionalBetAmount,proof:{proofHash:c.proofHash,proofString:c.proofString}}}validateEdge(t){let a=this.supportedEdgeConfigurations.includes(t);ta.against(!a,()=>l.createUnsupportedEdgeError(`${this.gameId} does not support ${t}% edge. Supported edge configurations include: ${this.supportedEdgeConfigurations}`))}}import x from"big.js";import{Guard as Tt}from"@betorigami/guard";var aa=(t)=>{let a=t.pairBonus!==null?{amount:x(t.pairBonus.betAmount).mul(t.pairBonus.payoutMultiplier)}:null,r=t.threeCardBonus!==null?{amount:x(t.threeCardBonus.betAmount).mul(t.threeCardBonus.payoutMultiplier)}:null;return[a,r].filter((n)=>n!==null)},ra=(t)=>{let a=t.betAmounts.mainBetAmount,n=t.actionType==="BLACKJACK_DOUBLE_DOWN"?a.mul(_):x(0),o=t.insuranceOutcome!==void 0?t.insuranceStake:x(0),c=a.plus(n).mul(ct[t.outcome]),e=t.insuranceOutcome==="WON"?o.mul(Pt):x(0),i=aa(t.sideBetResults),u=[{amount:c},...t.insuranceOutcome!==void 0?[{amount:e}]:[],...i],d=R({legs:u}),A=a.plus(o).plus(n).plus(t.betAmounts.pairBonusAmount).plus(t.betAmounts.threeCardBonusAmount);Tt.against(A.eq(0),"Total bet amount cannot be zero");let s=d.div(A);Tt.against(t.actionType==="BLACKJACK_SPLIT","SPLIT action type is not valid for standard multiplier calculation");let m;switch(t.actionType){case"BLACKJACK_DOUBLE_DOWN":m=n;break;case"BLACKJACK_BUY_INSURANCE":m=t.insuranceStake;break;case"BLACKJACK_SPLIT":m=a.mul(w);break}return{payouts:u,totalBetAmount:A,multiplier:s,additionalBetAmount:m}},na=(t)=>{let a=t.betAmounts.mainBetAmount,r=t.mainHandDoubledDown?a.mul(_):x(0),n=t.splitHandDoubledDown?a.mul(_):x(0),o=t.insuranceOutcome!==void 0?t.insuranceStake:x(0),c=a.plus(r).mul(ct[t.mainOutcome]),e=a.plus(n).mul(ct[t.splitOutcome]),i=t.insuranceOutcome==="WON"?o.mul(Pt):x(0),u=aa(t.sideBetResults),d=[{amount:c},{amount:e},...t.insuranceOutcome!==void 0?[{amount:i}]:[],...u],A=R({legs:d}),s=a.plus(a).plus(o).plus(r).plus(n).plus(t.betAmounts.pairBonusAmount).plus(t.betAmounts.threeCardBonusAmount);Tt.against(s.eq(0),"Total bet amount cannot be zero");let m=A.div(s),p;switch(t.actionType){case"BLACKJACK_DOUBLE_DOWN":p=a.mul(_);break;case"BLACKJACK_SPLIT":p=a.mul(w);break}return{payouts:d,totalBetAmount:s,multiplier:m,additionalBetAmount:p}};var ea=(t,a)=>a(t.mul(gt));import{Guard as Er}from"@betorigami/guard";var Rt=(t)=>t.every((a)=>a===t[0]),oa=(t)=>{let a=[...t].sort((r,n)=>r-n);return a.every((r,n)=>{let o=a[n-1];if(n===0)return!0;return Er.againstUndefined(o,"Previous value cannot be undefined"),r===o+1})},ca={Ace:1,Two:2,Three:3,Four:4,Five:5,Six:6,Seven:7,Eight:8,Nine:9,Ten:10,Jack:11,Queen:12,King:13},yr={...ca,Ace:14},fr=(t)=>oa(t.map((a)=>ca[a]))||oa(t.map((a)=>yr[a])),ia=(t,a)=>{let r=y.fromValue(t),n=y.fromValue(a);if(r.rank!==n.rank)return"LOSS";if(t===a)return"EXACT_PAIR";if(yt[r.suit]===yt[n.suit])return"COLORED_PAIR";return"MIXED_PAIR"},la=(t,a)=>({betAmount:t,result:a,payoutMultiplier:Kt[a]}),ua=(t,a,r)=>{let n=y.fromValue(t),o=y.fromValue(a),c=y.fromValue(r),e=[n.rank,o.rank,c.rank],i=Rt([n.suit,o.suit,c.suit]),u=Rt(e),d=fr(e);if(Rt([t,a,r]))return"SUITED_TRIPS";if(i&&d)return"STRAIGHT_FLUSH";if(u)return"THREE_OF_A_KIND";if(d)return"STRAIGHT";if(i)return"FLUSH";return"LOSS"},da=(t,a)=>({betAmount:t,result:a,payoutMultiplier:vt[a]});var Or={state:{isFinished:!1,phase:"uninitialised",multiplier:b(0)},config:{},playerArgument:{type:"START",mainBetAmount:"0",pairBonusAmount:"0",threeCardBonusAmount:"0"}},O=(t)=>y.fromValue(t).value;function Hr(t){E.against(t.phase!=="in-progress","Expected a started, in-progress game state")}function sa(t){E.against(t.phase!=="awaiting-insurance","Expected game to be awaiting insurance decision")}function _t(t){E.against(t.phase!=="in-progress"&&t.phase!=="playing-main-hand"&&t.phase!=="playing-split-hand","Expected a started, in-progress game state")}var Aa=(t,a)=>{let r=a;while(r.highestHandValue<Wt)r=r.addDrawnCards([O(t.takeOne())]);return r},Nt=(t,a)=>{if(t.isBusted)return"LOSE";if(a.isBusted)return"WIN";let r=t.highestHandValue,n=a.highestHandValue;if(r>n)return"WIN";if(r<n)return"LOSE";return"PUSH"},pa=(t)=>t.insuranceOutcome===void 0?b(0):t.calculateStake(t.betAmounts.mainBetAmount),Ba=(t)=>{let{payouts:a,multiplier:r,additionalBetAmount:n}=ra({outcome:t.outcome,insuranceOutcome:t.insuranceOutcome,insuranceStake:pa(t),actionType:t.playerArgument.type,betAmounts:t.betAmounts,sideBetResults:t.sideBetResults});return{state:{isFinished:!0,phase:"finished",playerHand:t.playerHand,dealerHand:t.dealerHand,outcome:t.outcome,payout:{legs:a},multiplier:r,randomValues:t.randomValuePool.consumedValues,insuranceOutcome:t.insuranceOutcome,sideBetResults:t.sideBetResults},config:{},playerArgument:t.playerArgument,additionalBetAmount:n}},Dr=(t)=>{let a=Aa(t.randomValuePool,t.dealerHand),r=Nt(t.playerHand,a);return Ba({...t,dealerHand:a,outcome:r})},hr=(t)=>{let r=t.mainHand.isBusted&&t.splitHand.isBusted?t.dealerHand:Aa(t.randomValuePool,t.dealerHand),n=Nt(t.mainHand,r),o=Nt(t.splitHand,r),{payouts:c,multiplier:e,additionalBetAmount:i}=na({hasSplit:!0,mainOutcome:n,splitOutcome:o,insuranceOutcome:t.insuranceOutcome,insuranceStake:pa(t),mainHandDoubledDown:t.mainHandDoubledDown,splitHandDoubledDown:t.splitHandDoubledDown,actionType:t.playerArgument.type,betAmounts:t.betAmounts,sideBetResults:t.sideBetResults});return{state:{isFinished:!0,phase:"split-finished",mainHand:t.mainHand,splitHand:t.splitHand,dealerHand:r,mainOutcome:n,splitOutcome:o,payout:{legs:c},multiplier:e,randomValues:t.randomValuePool.consumedValues,insuranceOutcome:t.insuranceOutcome,sideBetResults:t.sideBetResults},config:{},playerArgument:t.playerArgument,additionalBetAmount:i}};class Cr extends jt{roundInsuranceStake;constructor(t,a){super("BLACKJACK",t);this.roundInsuranceStake=a}get supportedEdgeConfigurations(){return[1]}generateRandomValues(t){return lt.from(t.getRandomIntsWithReplacement({min:$t,max:zt,count:xt}),xt)}toExternalState(t){let a=t.phase;switch(a){case"awaiting-insurance":return{isFinished:!1,phase:"awaiting-insurance",multiplier:t.multiplier,playerHand:t.playerHand.toDto(),dealerHand:t.dealerHand.toDto(!1),sideBetResults:t.sideBetResults};case"in-progress":return{isFinished:!1,phase:"player-turn",multiplier:t.multiplier,playerHand:t.playerHand.toDto(),dealerHand:t.dealerHand.toDto(!1),sideBetResults:t.sideBetResults};case"playing-main-hand":return{isFinished:!1,phase:"playing-main-hand",multiplier:t.multiplier,mainHand:t.mainHand.toDto(),splitHand:t.splitHand.toDto(),dealerHand:t.dealerHand.toDto(!1),sideBetResults:t.sideBetResults};case"playing-split-hand":return{isFinished:!1,phase:"playing-split-hand",multiplier:t.multiplier,mainHand:t.mainHand.toDto(),splitHand:t.splitHand.toDto(),dealerHand:t.dealerHand.toDto(!1),sideBetResults:t.sideBetResults};case"finished":return{isFinished:!0,payout:t.payout,multiplier:t.multiplier,randomValues:t.randomValues,outcome:t.outcome,playerHand:t.playerHand.toDto(),dealerHand:t.dealerHand.toDto(!0),sideBetResults:t.sideBetResults,...t.insuranceOutcome!==void 0&&{insuranceOutcome:t.insuranceOutcome}};case"split-finished":return{isFinished:!0,payout:t.payout,multiplier:t.multiplier,randomValues:t.randomValues,mainOutcome:t.mainOutcome,splitOutcome:t.splitOutcome,mainHand:t.mainHand.toDto(),splitHand:t.splitHand.toDto(),dealerHand:t.dealerHand.toDto(!0),sideBetResults:t.sideBetResults,...t.insuranceOutcome!==void 0&&{insuranceOutcome:t.insuranceOutcome}};case"uninitialised":throw new Error("Cannot convert uninitialised state to external state");default:E.againstNever(a,"Invalid state received")}}createGameStore(){let t=(o)=>{let c=ea(o,this.roundInsuranceStake);return E.against(o.gt(0)&&c.eq(0),"Insurance stake rounds below the smallest unit this currency supports"),c},a=(o)=>Ba({...o,calculateStake:t}),r=(o)=>Dr({...o,calculateStake:t}),n=(o)=>hr({...o,calculateStake:t});return Sr({context:Or,on:{START:(o,c)=>{let{state:e}=o;E.against(e.phase!=="uninitialised","START action requires a fresh game");let i=O(c.randomValuePool.takeOne()),u=O(c.randomValuePool.takeOne()),d=O(c.randomValuePool.takeOne()),A=O(c.randomValuePool.takeOne()),s=N.withInitialDeal([i,u]),m=Y.withInitialDeal({upCard:d,holeCard:A}),p={mainBetAmount:b(c.mainBetAmount),pairBonusAmount:b(c.pairBonusAmount),threeCardBonusAmount:b(c.threeCardBonusAmount)},h={pairBonus:b(c.pairBonusAmount).gt(0)?la(c.pairBonusAmount,ia(i,u)):null,threeCardBonus:b(c.threeCardBonusAmount).gt(0)?da(c.threeCardBonusAmount,ua(i,u,d)):null},H={type:"START",mainBetAmount:c.mainBetAmount,pairBonusAmount:c.pairBonusAmount,threeCardBonusAmount:c.threeCardBonusAmount};if(m.upCard.rank==="Ace")return{state:{...e,isFinished:!1,phase:"awaiting-insurance",playerHand:s,dealerHand:m,betAmounts:p,sideBetResults:h},config:{},playerArgument:H};let k={playerHand:s,dealerHand:m,randomValuePool:c.randomValuePool,playerArgument:H,betAmounts:p,sideBetResults:h};if(s.isBlackjack&&m.isBlackjack)return a({...k,outcome:"PUSH"});if(s.isBlackjack)return a({...k,outcome:"PLAYER_BLACKJACK"});if(m.isBlackjack)return a({...k,outcome:"LOSE"});return{state:{...e,isFinished:!1,phase:"in-progress",playerHand:s,dealerHand:m,insuranceOutcome:void 0,betAmounts:p,sideBetResults:h},config:{},playerArgument:H}},BLACKJACK_BUY_INSURANCE:(o,c)=>{let{state:e}=o;sa(e);let{playerHand:i,dealerHand:u,betAmounts:d,sideBetResults:A}=e,s={...e,randomValuePool:c.randomValuePool,playerArgument:{type:"BLACKJACK_BUY_INSURANCE"},betAmounts:d,sideBetResults:A};if(i.isBlackjack&&u.isBlackjack)return a({...s,outcome:"PUSH",insuranceOutcome:"WON"});if(i.isBlackjack)return a({...s,outcome:"PLAYER_BLACKJACK",insuranceOutcome:"LOST"});if(u.isBlackjack)return a({...s,outcome:"LOSE",insuranceOutcome:"WON"});return{state:{...e,phase:"in-progress",insuranceOutcome:"LOST"},config:{},playerArgument:{type:"BLACKJACK_BUY_INSURANCE"},additionalBetAmount:t(d.mainBetAmount)}},BLACKJACK_REJECT_INSURANCE:(o,c)=>{let{state:e}=o;sa(e);let{playerHand:i,dealerHand:u,betAmounts:d,sideBetResults:A}=e,s={playerHand:i,dealerHand:u,randomValuePool:c.randomValuePool,playerArgument:{type:"BLACKJACK_REJECT_INSURANCE"},betAmounts:d,sideBetResults:A};if(i.isBlackjack&&u.isBlackjack)return a({...s,outcome:"PUSH"});if(i.isBlackjack)return a({...s,outcome:"PLAYER_BLACKJACK"});if(u.isBlackjack)return a({...s,outcome:"LOSE"});return{state:{...e,phase:"in-progress",insuranceOutcome:void 0},config:{},playerArgument:{type:"BLACKJACK_REJECT_INSURANCE"}}},BLACKJACK_HIT:(o,c)=>{let{state:e}=o;switch(_t(e),e.phase){case"playing-main-hand":{let i=e.mainHand.addDrawnCards([O(c.randomValuePool.takeOne())]);if(i.isBusted||i.highestHandValue===D){if(e.splitHand.highestHandValue===D)return n({...e,mainHand:i,splitHandDoubledDown:!1,randomValuePool:c.randomValuePool,playerArgument:{type:"BLACKJACK_HIT"}});return{state:{...e,phase:"playing-split-hand",mainHand:i,splitHandDoubledDown:!1},config:{},playerArgument:{type:"BLACKJACK_HIT"}}}return{state:{...e,mainHand:i},config:{},playerArgument:{type:"BLACKJACK_HIT"}}}case"playing-split-hand":{let i=e.splitHand.addDrawnCards([O(c.randomValuePool.takeOne())]);if(i.isBusted||i.highestHandValue===D)return n({...e,splitHand:i,randomValuePool:c.randomValuePool,playerArgument:{type:"BLACKJACK_HIT"}});return{state:{...e,splitHand:i},config:{},playerArgument:{type:"BLACKJACK_HIT"}}}case"in-progress":{let i=e.playerHand.addDrawnCards([O(c.randomValuePool.takeOne())]);if(i.isBusted)return a({...e,playerHand:i,outcome:"LOSE",randomValuePool:c.randomValuePool,playerArgument:{type:"BLACKJACK_HIT"}});if(i.highestHandValue===D)return r({...e,playerHand:i,randomValuePool:c.randomValuePool,playerArgument:{type:"BLACKJACK_HIT"}});return{state:{...e,phase:"in-progress",playerHand:i},config:{},playerArgument:{type:"BLACKJACK_HIT"}}}default:E.againstNever(e,"Invalid phase for HIT action")}},BLACKJACK_STAND:(o,c)=>{let{state:e}=o;switch(_t(e),e.phase){case"playing-main-hand":{if(e.splitHand.highestHandValue===D)return n({...e,splitHandDoubledDown:!1,randomValuePool:c.randomValuePool,playerArgument:{type:"BLACKJACK_STAND"}});return{state:{...e,phase:"playing-split-hand",splitHandDoubledDown:!1},config:{},playerArgument:{type:"BLACKJACK_STAND"}}}case"playing-split-hand":return n({...e,splitHandDoubledDown:e.splitHandDoubledDown,randomValuePool:c.randomValuePool,playerArgument:{type:"BLACKJACK_STAND"}});case"in-progress":return r({...e,randomValuePool:c.randomValuePool,playerArgument:{type:"BLACKJACK_STAND"}});default:E.againstNever(e,"Invalid phase for STAND action")}},BLACKJACK_DOUBLE_DOWN:(o,c)=>{let{state:e}=o;switch(_t(e),e.phase){case"playing-main-hand":{E.against(e.mainHand.cards.length!==2,"Double down is only allowed as the first action");let i=e.mainHand.addDrawnCards([O(c.randomValuePool.takeOne())]),{betAmounts:u}=e;if(e.splitHand.highestHandValue===D)return n({...e,mainHand:i,mainHandDoubledDown:!0,splitHandDoubledDown:!1,randomValuePool:c.randomValuePool,playerArgument:{type:"BLACKJACK_DOUBLE_DOWN"}});return{state:{...e,phase:"playing-split-hand",mainHand:i,mainHandDoubledDown:!0,splitHandDoubledDown:!1},config:{},playerArgument:{type:"BLACKJACK_DOUBLE_DOWN"},additionalBetAmount:u.mainBetAmount.mul(_)}}case"playing-split-hand":{E.against(e.splitHand.cards.length!==2,"Double down is only allowed as the first action");let i=e.splitHand.addDrawnCards([O(c.randomValuePool.takeOne())]);return n({...e,splitHand:i,randomValuePool:c.randomValuePool,playerArgument:{type:"BLACKJACK_DOUBLE_DOWN"},splitHandDoubledDown:!0})}case"in-progress":{E.against(e.playerHand.cards.length!==2,"Double down is only allowed as the first action");let i=e.playerHand.addDrawnCards([O(c.randomValuePool.takeOne())]);if(i.isBusted)return a({...e,playerHand:i,outcome:"LOSE",randomValuePool:c.randomValuePool,playerArgument:{type:"BLACKJACK_DOUBLE_DOWN"}});return r({...e,playerHand:i,randomValuePool:c.randomValuePool,playerArgument:{type:"BLACKJACK_DOUBLE_DOWN"}})}default:E.againstNever(e,"Invalid phase for DOUBLE_DOWN action")}},BLACKJACK_SPLIT:(o,c)=>{let{state:e}=o;Hr(e);let{playerHand:i,betAmounts:u,sideBetResults:d}=e;E.against(i.cards.length!==2,"Split is only allowed with exactly 2 cards");let A=i.cards[0],s=i.cards[1];E.againstUndefined(A,"First card is missing"),E.againstUndefined(s,"Second card is missing"),E.against(A.rank!==s.rank,"Split requires two cards of the same rank");let m=O(c.randomValuePool.takeOne()),p=O(c.randomValuePool.takeOne()),h=N.withInitialDeal([A.value,m]),H=N.withInitialDeal([s.value,p]);if(A.rank==="Ace")return n({...e,mainHand:h,splitHand:H,randomValuePool:c.randomValuePool,playerArgument:{type:"BLACKJACK_SPLIT"},mainHandDoubledDown:!1,splitHandDoubledDown:!1});let K=h.highestHandValue===D,f=H.highestHandValue===D;if(K&&f)return n({mainHand:h,splitHand:H,dealerHand:e.dealerHand,randomValuePool:c.randomValuePool,playerArgument:{type:"BLACKJACK_SPLIT"},insuranceOutcome:e.insuranceOutcome,mainHandDoubledDown:!1,splitHandDoubledDown:!1,betAmounts:u,sideBetResults:d});if(K)return{state:{...e,phase:"playing-split-hand",mainHand:h,splitHand:H,mainHandDoubledDown:!1,splitHandDoubledDown:!1},config:{},playerArgument:{type:"BLACKJACK_SPLIT"},additionalBetAmount:u.mainBetAmount.mul(w)};return{state:{...e,phase:"playing-main-hand",multiplier:b(0),mainHand:h,splitHand:H,mainHandDoubledDown:!1},config:{},playerArgument:{type:"BLACKJACK_SPLIT"},additionalBetAmount:u.mainBetAmount.mul(w)}}}})}getValidNextActionTypes(t){if(t.isFinished)return[];switch(t.phase){case"awaiting-insurance":return["BLACKJACK_BUY_INSURANCE","BLACKJACK_REJECT_INSURANCE"];case"playing-main-hand":{let a=["BLACKJACK_HIT","BLACKJACK_STAND"];if(t.mainHand.cards.length===2)a.push("BLACKJACK_DOUBLE_DOWN");return a}case"playing-split-hand":{let a=["BLACKJACK_HIT","BLACKJACK_STAND"];if(t.splitHand.cards.length===2)a.push("BLACKJACK_DOUBLE_DOWN");return a}case"player-turn":{let a=["BLACKJACK_HIT","BLACKJACK_STAND"];if(t.playerHand.cards.length===2){a.push("BLACKJACK_DOUBLE_DOWN");let r=t.playerHand.cards[0],n=t.playerHand.cards[1];if(E.againstUndefined(r,"First player card is missing"),E.againstUndefined(n,"Second player card is missing"),r.rank===n.rank)a.push("BLACKJACK_SPLIT")}return a}default:E.againstNever(t,"Invalid phase for getting valid actions")}}}import z from"big.js";import{Guard as fa}from"@betorigami/guard";var ma=0,Ea=51,$=52,ya=52;var Uo=()=>({minPicks:5,maxPicks:36}),xr=(t)=>t.length===new Set(t).size,Pr=(t)=>{let a=z(1),r=z($);for(let n=0;n<t;n+=1)a=a.mul(z($-n).div(r));return a};class br extends B{constructor(){super("BLITZ")}get supportedEdgeConfigurations(){return[2]}getBetAmount(t){return t.betAmount}determineGameResult({generator:t,gameInputs:a,edge:r}){fa.against(a.pickCount<1||a.pickCount>$,`pickCount must be between 1 and ${$}`),fa.againstNonInteger(a.pickCount,"pickCount must be an integer");let n=t.getRandomIntsWithReplacement({min:ma,max:Ea,count:ya}),o=n.values.slice(0,a.pickCount),c=xr(o),e=Pr(a.pickCount),i=c?C.withMultiplier(z(1).div(e),r):z(0);return{isFinished:!0,payout:{legs:[{amount:a.betAmount.mul(i)}]},payoutMultiplier:i,outputs:{result:n.values,cards:o.map((u)=>new T(u).toDto())},randomValues:n}}}var Sa=0,kt=4294967295,Oa;((o)=>{o.EASY="EASY";o.MEDIUM="MEDIUM";o.HARD="HARD";o.EXPERT="EXPERT"})(Oa||={});var jr=["YELLOW","ORANGE","YELLOW","RED","YELLOW","ORANGE","YELLOW","RED","YELLOW","ORANGE","YELLOW","RED","YELLOW","ORANGE","YELLOW","ORANGE","YELLOW","RED"],Tr={distanceBoundaries:{bullseye:67108864,ringOne:1299227607,ringTwo:2415919104,ringThree:3478923509},multipliers:{bullseye:8.5,ringOne:0.5,ringTwo:0.8,ringThree:{YELLOW:1.2,ORANGE:1.5,RED:2.7},ringFour:0.5},segments:jr},Rr=["YELLOW","ORANGE","YELLOW","RED","YELLOW","ORANGE","YELLOW","RED","YELLOW","ORANGE","YELLOW","RED","YELLOW","ORANGE","YELLOW","ORANGE","YELLOW","RED"],_r={distanceBoundaries:{bullseye:42949673,ringOne:869730878,ringTwo:2104533975,ringThree:2748779069},multipliers:{bullseye:16,ringOne:0.4,ringTwo:0.6,ringThree:{YELLOW:1.3,ORANGE:3.1,RED:6},ringFour:0.4},segments:Rr},Nr=["YELLOW","ORANGE","YELLOW","ORANGE","YELLOW","RED","YELLOW","ORANGE","YELLOW","ORANGE","YELLOW","RED","YELLOW","ORANGE","YELLOW","ORANGE","YELLOW","RED"],kr={distanceBoundaries:{bullseye:15461883,ringOne:687194768,ringTwo:1870887754,ringThree:2415919104},multipliers:{bullseye:63,ringOne:0.2,ringTwo:0.5,ringThree:{YELLOW:2.5,ORANGE:3.6,RED:8.8},ringFour:0.2},segments:Nr},wr=["YELLOW","ORANGE","YELLOW","YELLOW","RED","YELLOW","YELLOW","ORANGE","YELLOW","YELLOW","ORANGE","YELLOW","YELLOW","RED","YELLOW","YELLOW","ORANGE","YELLOW"],Vr={distanceBoundaries:{bullseye:1717987,ringOne:1073741824,ringTwo:2165093014,ringThree:2415919104},multipliers:{bullseye:500,ringOne:0.1,ringTwo:0.5,ringThree:{YELLOW:4.8,ORANGE:9.6,RED:42},ringFour:0.1},segments:wr},$o=(t)=>{let a=wt[t];return[a.multipliers.bullseye,a.multipliers.ringOne,a.multipliers.ringTwo,...Object.values(a.multipliers.ringThree),a.multipliers.ringFour].reduce((n,o)=>o>n?o:n)},wt={EASY:Tr,MEDIUM:_r,HARD:kr,EXPERT:Vr};import{Guard as Vt}from"@betorigami/guard";import Ir from"big.js";class Ur extends B{constructor(){super("DARTS")}get supportedEdgeConfigurations(){return[2]}getBetAmount(t){return t.betAmount}determineGameResult({generator:t,gameInputs:a}){let r=t.getRandomIntsWithReplacement({min:Sa,max:kt,count:2}),n=r.values[0],o=r.values[1];Vt.againstUndefined(n,"Random number generator returned no value for clockWiseRotation"),Vt.againstUndefined(o,"Random number generator returned no value for distanceFromCentre");let c=a.difficultyLevel,e=Ir(Zr(c,n,o));return{isFinished:!0,payout:{legs:[{amount:a.betAmount.mul(e)}]},payoutMultiplier:e,outputs:{result:r.values},randomValues:r}}}var Zr=(t,a,r)=>{let n=wt[t],{distanceBoundaries:o,multipliers:c}=n;if(r<o.bullseye)return c.bullseye;if(r<o.ringOne)return c.ringOne;if(r<o.ringTwo)return c.ringTwo;if(r<o.ringThree)return Gr(n,a);return c.ringFour},Gr=(t,a)=>{let r=t.segments.length,n=Math.floor(a/(kt+1)*r),o=t.segments[n];return Vt.againstUndefined(o,`Segment index ${n} out of bounds`),t.multipliers.ringThree[o]};import Mr from"big.js";class P{multipliers;constructor(t){this.multipliers=t}getMultipliers(t){let a=this.multipliers.get(t);if(a===void 0)throw new Error(`Multipliers for ${t} not found`);return a}getAllMultipliers(){return Array.from(this.multipliers.entries()).map(([t,a])=>({edge:t,multipliers:a}))}}var Fr;((e)=>{e.PAIR="PAIR";e.TWO_PAIR="TWO_PAIR";e.THREE_OF_A_KIND="THREE_OF_A_KIND";e.FULL_HOUSE="FULL_HOUSE";e.FOUR_OF_A_KIND="FOUR_OF_A_KIND";e.FIVE_OF_A_KIND="FIVE_OF_A_KIND"})(Fr||={});var Jr={PAIR:0.1,TWO_PAIR:2,THREE_OF_A_KIND:3,FULL_HOUSE:4.3,FOUR_OF_A_KIND:5,FIVE_OF_A_KIND:50},Yr={PAIR:0.1,TWO_PAIR:2,THREE_OF_A_KIND:3,FULL_HOUSE:4,FOUR_OF_A_KIND:4.8,FIVE_OF_A_KIND:50},$r={PAIR:0.1,TWO_PAIR:2,THREE_OF_A_KIND:3,FULL_HOUSE:3.7,FOUR_OF_A_KIND:4.6,FIVE_OF_A_KIND:50},zr={PAIR:0.1,TWO_PAIR:2,THREE_OF_A_KIND:3,FULL_HOUSE:3.4,FOUR_OF_A_KIND:4.4,FIVE_OF_A_KIND:50},qr={PAIR:0.1,TWO_PAIR:2,THREE_OF_A_KIND:2.8,FULL_HOUSE:3.2,FOUR_OF_A_KIND:3.6,FIVE_OF_A_KIND:50},Xr=new P(new Map([[1,Jr],[2,Yr],[3,$r],[4,zr],[8,qr]])),Qr={2:"PAIR",3:"THREE_OF_A_KIND",4:"FOUR_OF_A_KIND",5:"FIVE_OF_A_KIND"};class Wr extends B{constructor(){super("DIAMONDS")}get supportedEdgeConfigurations(){return[1,2,3,4,8]}getBetAmount(t){return t.betAmount}determineGameResult({generator:t,edge:a,gameInputs:r}){let n=t.getRandomIntsWithReplacement({min:0,max:6,count:5}),o=Xr.getMultipliers(a),c=n.values,e=Mr(this.calculatePayoutMultiplier(o,c));return{isFinished:!0,payout:{legs:[{amount:r.betAmount.mul(e)}]},payoutMultiplier:e,outputs:{result:n.values},randomValues:n}}calculatePayoutMultiplier(t,a){let r=new Map;for(let c of a){let e=r.get(c)||0;r.set(c,e+1)}let n=[...r.values()].filter((c)=>c>1),o=this.classifyResult(n);return o===null?0:t[o]}classifyResult(t){if(t.length>2)throw new Error(`Unexpected number of repeats ${t.length}`);let[a,r]=t;if(a===void 0)return null;if(r===void 0){let n=Qr[a];if(n===void 0)throw new Error(`Unexpected single diamond repeat count: ${a}`);return n}return a===3||r===3?"FULL_HOUSE":"TWO_PAIR"}}import Ha from"big.js";var gr;((r)=>{r.ABOVE="ABOVE";r.BELOW="BELOW"})(gr||={});var Da=0,It=1e4,Lr=It-Da+1,Kr=(t)=>{let a=t.direction==="ABOVE"?It-t.selectedValue:t.selectedValue;return new Ha(a).div(Lr).mul(100)},vr=(t,a)=>t.direction==="ABOVE"?a>t.selectedValue:a<t.selectedValue;class tn extends B{constructor(){super("DICE")}get supportedEdgeConfigurations(){return[1,2,3,4,8]}getBetAmount(t){return t.betAmount}determineGameResult({generator:t,edge:a,gameInputs:r}){let n=t.getRandomInt({min:Da,max:It}),o=Kr(r),e=vr(r,n.value)?C.withWinChance(a,o):new Ha(0);return{isFinished:!0,payout:{legs:[{amount:r.betAmount.mul(e)}]},payoutMultiplier:e,outputs:{result:n.values},randomValues:n}}}import ln from"big.js";import{Guard as ut}from"@betorigami/guard";var ha;((o)=>{o.CLASSIC="CLASSIC";o.LOW_RISK="LOW_RISK";o.MEDIUM_RISK="MEDIUM_RISK";o.HIGH_RISK="HIGH_RISK"})(ha||={});var an=[1,2,3,4,5,6,7,8,9,10],Ca=(t)=>{return an.includes(t)};var rn={[1]:{CLASSIC:[0,3.96],LOW_RISK:[0.7,1.85],MEDIUM_RISK:[0.4,2.75],HIGH_RISK:[0,3.96]},[2]:{CLASSIC:[0,1.9,4.5],LOW_RISK:[0,2,3.8],MEDIUM_RISK:[0,1.8,5.1],HIGH_RISK:[0,0,17.1]},[3]:{CLASSIC:[0,1,3.1,10.4],LOW_RISK:[0,1.1,1.38,26],MEDIUM_RISK:[0,0,2.8,50],HIGH_RISK:[0,0,0,81.5]},[4]:{CLASSIC:[0,0.8,1.8,5,22.5],LOW_RISK:[0,0,2.2,7.9,90],MEDIUM_RISK:[0,0,1.7,10,100],HIGH_RISK:[0,0,0,10,259]},[5]:{CLASSIC:[0,0.25,1.4,4.1,16.5,36],LOW_RISK:[0,0,1.5,4.2,13,300],MEDIUM_RISK:[0,0,1.4,4,14,390],HIGH_RISK:[0,0,0,4.5,48,450]},[6]:{CLASSIC:[0,0,1,3.68,7,16.5,40],LOW_RISK:[0,0,1.1,2,6.2,100,700],MEDIUM_RISK:[0,0,0,3,9,180,710],HIGH_RISK:[0,0,0,0,11,350,710]},[7]:{CLASSIC:[0,0,0.47,3,4.5,14,31,60],LOW_RISK:[0,0,1.1,1.6,3.5,15,225,700],MEDIUM_RISK:[0,0,0,2,7,30,400,800],HIGH_RISK:[0,0,0,0,7,90,400,800]},[8]:{CLASSIC:[0,0,0,2.2,4,13,22,55,70],LOW_RISK:[0,0,1.1,1.5,2,5.5,39,100,800],MEDIUM_RISK:[0,0,0,2,4,11,67,400,900],HIGH_RISK:[0,0,0,0,5,20,270,600,900]},[9]:{CLASSIC:[0,0,0,1.55,3,8,15,44,60,85],LOW_RISK:[0,0,1.1,1.3,1.7,2.5,7.5,50,250,1000],MEDIUM_RISK:[0,0,0,2,2.5,5,15,100,500,1000],HIGH_RISK:[0,0,0,0,4,11,56,500,800,1000]},[10]:{CLASSIC:[0,0,0,1.4,2.25,4.5,8,17,50,80,100],LOW_RISK:[0,0,1.1,1.2,1.3,1.8,3.5,13,50,250,1000],MEDIUM_RISK:[0,0,0,1.6,2,4,7,26,100,500,1000],HIGH_RISK:[0,0,0,0,3.5,8,13,63,500,800,1000]}},nn={[1]:{CLASSIC:[0,3.92],LOW_RISK:[0.7,1.82],MEDIUM_RISK:[0.4,2.72],HIGH_RISK:[0,3.92]},[2]:{CLASSIC:[0,1.9,4.32],LOW_RISK:[0,2,3.65],MEDIUM_RISK:[0,1.8,5],HIGH_RISK:[0,0,17]},[3]:{CLASSIC:[0,1,3,10.7],LOW_RISK:[0,1.1,1.3,26.2],MEDIUM_RISK:[0,0,2.7,50.3],HIGH_RISK:[0,0,0,80.7]},[4]:{CLASSIC:[0,0.8,1.8,4.75,22.5],LOW_RISK:[0,0,2.2,7.65,90],MEDIUM_RISK:[0,0,1.7,9.8,100],HIGH_RISK:[0,0,0,9.75,259]},[5]:{CLASSIC:[0,0.2,1.4,4.25,16.4,36],LOW_RISK:[0,0,1.5,4.1,12.9,300],MEDIUM_RISK:[0,0,1.4,3.9,13.9,390],HIGH_RISK:[0,0,0,4.5,47,450]},[6]:{CLASSIC:[0,0,1,3.6,7,17,40],LOW_RISK:[0,0,1.1,2,5.8,100,700],MEDIUM_RISK:[0,0,0,3,8.6,180,710],HIGH_RISK:[0,0,0,0,10.6,350,710]},[7]:{CLASSIC:[0,0,0.5,3,4.1,13.7,31,60],LOW_RISK:[0,0,1.1,1.6,3.5,13.5,225,700],MEDIUM_RISK:[0,0,0,2,6.9,29.2,400,800],HIGH_RISK:[0,0,0,0,6.9,89.1,400,800]},[8]:{CLASSIC:[0,0,0,2.2,4,12.2,22,55,70],LOW_RISK:[0,0,1.1,1.5,2,4.8,38,100,800],MEDIUM_RISK:[0,0,0,2,4,10.4,66,400,900],HIGH_RISK:[0,0,0,0,4.9,19.8,270,600,900]},[9]:{CLASSIC:[0,0,0,1.5,3,8.1,15,45,60,85],LOW_RISK:[0,0,1.1,1.3,1.7,2.1,7.4,50,250,1000],MEDIUM_RISK:[0,0,0,2,2.5,4.6,15.2,100,500,1000],HIGH_RISK:[0,0,0,0,4,10.7,55.4,500,800,1000]},[10]:{CLASSIC:[0,0,0,1.4,2.2,4.5,7.6,16,50,80,100],LOW_RISK:[0,0,1.1,1.2,1.3,1.6,3.7,13,50,250,1000],MEDIUM_RISK:[0,0,0,1.6,2,3.8,6.8,26,100,500,1000],HIGH_RISK:[0,0,0,0,3.5,7.8,12.8,63,500,800,1000]}},en={[1]:{CLASSIC:[0,3.88],LOW_RISK:[0.7,1.78],MEDIUM_RISK:[0.4,2.68],HIGH_RISK:[0,3.88]},[2]:{CLASSIC:[0,1.85,4.48],LOW_RISK:[0,2,3.48],MEDIUM_RISK:[0,1.8,4.8],HIGH_RISK:[0,0,16.8]},[3]:{CLASSIC:[0,1,3,9.9],LOW_RISK:[0,1.1,1.2,26.5],MEDIUM_RISK:[0,0,2.65,50],HIGH_RISK:[0,0,0,79.9]},[4]:{CLASSIC:[0,0.8,1.7,5,23],LOW_RISK:[0,0,2.1,7.95,90],MEDIUM_RISK:[0,0,1.7,9.55,100],HIGH_RISK:[0,0,0,9.5,259]},[5]:{CLASSIC:[0,0.2,1.4,4.1,16.6,36],LOW_RISK:[0,0,1.5,4,12.7,300],MEDIUM_RISK:[0,0,1.4,3.8,13.7,390],HIGH_RISK:[0,0,0,4.4,46.9,450]},[6]:{CLASSIC:[0,0,1,3.6,6.6,16.5,40],LOW_RISK:[0,0,1.1,1.9,5.9,100,700],MEDIUM_RISK:[0,0,0,2.9,8.7,180,710],HIGH_RISK:[0,0,0,0,10.8,342,710]},[7]:{CLASSIC:[0,0,0.5,2.9,4.3,13.5,30.4,60],LOW_RISK:[0,0,1.1,1.6,3.1,14.8,225,700],MEDIUM_RISK:[0,0,0,2,6.7,29,400,800],HIGH_RISK:[0,0,0,0,6.8,88.2,400,800]},[8]:{CLASSIC:[0,0,0,2.2,3.8,12.7,21,54,70],LOW_RISK:[0,0,1.1,1.5,1.8,5.2,38,100,800],MEDIUM_RISK:[0,0,0,2,3.8,10.8,66,400,900],HIGH_RISK:[0,0,0,0,4.9,19.5,265,600,900]},[9]:{CLASSIC:[0,0,0,1.5,2.9,8.2,15,43,60,85],LOW_RISK:[0,0,1.1,1.3,1.6,2.1,7.7,49,250,1000],MEDIUM_RISK:[0,0,0,2,2.4,4.7,15,98,500,1000],HIGH_RISK:[0,0,0,0,3.9,10.8,55,500,800,1000]},[10]:{CLASSIC:[0,0,0,1.4,2.2,4.2,8,16.7,50,80,100],LOW_RISK:[0,0,1.1,1.2,1.3,1.5,2.9,12,50,250,1000],MEDIUM_RISK:[0,0,0,1.6,2,3.6,6.6,26,100,500,1000],HIGH_RISK:[0,0,0,0,3.4,7.9,12.9,62,500,800,1000]}},on={[1]:{CLASSIC:[0,3.84],LOW_RISK:[0.69,1.77],MEDIUM_RISK:[0.38,2.7],HIGH_RISK:[0,3.84]},[2]:{CLASSIC:[0,1.83,4.44],LOW_RISK:[0,1.98,3.44],MEDIUM_RISK:[0,1.78,4.77],HIGH_RISK:[0,0,16.64]},[3]:{CLASSIC:[0,0.98,3,9.8],LOW_RISK:[0,1.09,1.19,26.15],MEDIUM_RISK:[0,0,2.6,49.8],HIGH_RISK:[0,0,0,79]},[4]:{CLASSIC:[0,0.79,1.68,5,22.7],LOW_RISK:[0,0,2.1,7.8,88.3],MEDIUM_RISK:[0,0,1.66,9.5,100],HIGH_RISK:[0,0,0,9.25,259]},[5]:{CLASSIC:[0,0.19,1.39,4.1,16.3,35.5],LOW_RISK:[0,0,1.47,4,12.5,300],MEDIUM_RISK:[0,0,1.37,3.8,13.5,390],HIGH_RISK:[0,0,0,4.3,46.6,450]},[6]:{CLASSIC:[0,0,0.98,3.6,6.5,15.9,39.9],LOW_RISK:[0,0,1.08,1.89,5.8,100,700],MEDIUM_RISK:[0,0,0,2.9,8.35,180,710],HIGH_RISK:[0,0,0,0,10.4,342,710]},[7]:{CLASSIC:[0,0,0.47,2.9,4.3,13.5,30.4,60],LOW_RISK:[0,0,1.08,1.59,3.1,14.6,225,700],MEDIUM_RISK:[0,0,0,1.98,6.6,28.7,400,800],HIGH_RISK:[0,0,0,0,6.7,87.3,400,800]},[8]:{CLASSIC:[0,0,0,2.2,3.7,12.5,21,54,70],LOW_RISK:[0,0,1.09,1.49,1.77,5.1,37.5,100,800],MEDIUM_RISK:[0,0,0,1.96,3.8,10.7,65.8,400,900],HIGH_RISK:[0,0,0,0,4.9,18.8,265,600,900]},[9]:{CLASSIC:[0,0,0,1.47,2.9,8.1,14.9,43,60,85],LOW_RISK:[0,0,1.09,1.28,1.59,2.1,7.6,48.4,250,1000],MEDIUM_RISK:[0,0,0,1.97,2.4,4.6,15,97.1,500,1000],HIGH_RISK:[0,0,0,0,3.8,10.8,55,500,800,1000]},[10]:{CLASSIC:[0,0,0,1.37,2.2,4.2,7.8,16.5,49.2,80,100],LOW_RISK:[0,0,1.08,1.19,1.3,1.47,2.9,12,50,250,1000],MEDIUM_RISK:[0,0,0,1.58,1.98,3.6,6.4,26,100,500,1000],HIGH_RISK:[0,0,0,0,3.4,7.7,12.7,61.9,500,800,1000]}},cn={[1]:{CLASSIC:[0,3.68],LOW_RISK:[0.7,1.58],MEDIUM_RISK:[0.4,2.48],HIGH_RISK:[0,3.68]},[2]:{CLASSIC:[0,1.72,4.48],LOW_RISK:[0,1.9,3.28],MEDIUM_RISK:[0,1.7,4.62],HIGH_RISK:[0,0,15.95]},[3]:{CLASSIC:[0,0.9,2.95,9.9],LOW_RISK:[0,1,1.2,26],MEDIUM_RISK:[0,0,2.29,50],HIGH_RISK:[0,0,0,75.7]},[4]:{CLASSIC:[0,0.8,1.6,4.4,21],LOW_RISK:[0,0,2,7.5,86],MEDIUM_RISK:[0,0,1.5,9.5,98],HIGH_RISK:[0,0,0,9,246]},[5]:{CLASSIC:[0,0.2,1.2,4.2,16.3,37],LOW_RISK:[0,0,1.4,3.8,12,300],MEDIUM_RISK:[0,0,1.3,3.5,14,385],HIGH_RISK:[0,0,0,4,45,450]},[6]:{CLASSIC:[0,0,1,3.3,6.2,15,40],LOW_RISK:[0,0,1.1,1.7,4.9,99,700],MEDIUM_RISK:[0,0,0,2.6,8.5,177,705],HIGH_RISK:[0,0,0,0,10,327,710]},[7]:{CLASSIC:[0,0,0.4,2.8,4.2,14.5,30,60],LOW_RISK:[0,0,1.1,1.4,3,14,210,700],MEDIUM_RISK:[0,0,0,1.8,6.4,29,400,800],HIGH_RISK:[0,0,0,0,6.1,85,400,800]},[8]:{CLASSIC:[0,0,0,2,3.7,13,20,50,70],LOW_RISK:[0,0,1.1,1.4,1.6,4.6,35,90,800],MEDIUM_RISK:[0,0,0,1.9,3.5,10.5,65,400,900],HIGH_RISK:[0,0,0,0,4.5,18,265,600,900]},[9]:{CLASSIC:[0,0,0,1.4,2.6,9,11.5,40,60,85],LOW_RISK:[0,0,1,1.3,1.5,2,7,45,250,1000],MEDIUM_RISK:[0,0,0,2,2.1,4,15,98,500,1000],HIGH_RISK:[0,0,0,0,3.5,10.5,55,500,800,1000]},[10]:{CLASSIC:[0,0,0,1.3,2,4.4,8,16.7,50,80,100],LOW_RISK:[0,0,1,1.2,1.25,1.4,2,10,50,250,1000],MEDIUM_RISK:[0,0,0,1.5,1.9,3.5,6.2,26,100,500,1000],HIGH_RISK:[0,0,0,0,3,8,14,57,500,800,1000]}},xa=new P(new Map([[1,rn],[2,nn],[3,en],[4,on],[8,cn]]));class un extends B{constructor(){super("KENO")}get supportedEdgeConfigurations(){return[1,2,3,4,8]}getBetAmount(t){return t.betAmount}determineGameResult({generator:t,edge:a,gameInputs:r}){ut.againstEmptyArray(r.selectedNumbers,()=>l.createValidationError("No numbers selected")),ut.against(r.selectedNumbers.length>10,()=>l.createValidationError("Maximum of 10 numbers can be selected"));for(let s of r.selectedNumbers)ut.againstNonInteger(s,()=>l.createValidationError("Only integers can be selected")),ut.against(s<0||s>39,()=>l.createValidationError("Invalid number selected"));let n=t.getUniqueRandomInts({min:0,max:39,count:10}),o=r.selectedNumbers.filter((s)=>n.values.includes(s)),c=r.selectedNumbers.length;if(!Ca(c))throw new Error(`Invalid tile count: ${c}`);let d=xa.getMultipliers(a)[c][r.riskLevel][o.length];if(d===void 0)throw new Error(`No multiplier found for matching tile count ${o.length}`);let A=new ln(d);return{isFinished:!0,payout:{legs:[{amount:r.betAmount.mul(A)}]},payoutMultiplier:A,outputs:{result:n.values},randomValues:n}}}import V from"big.js";var Pa=(t,a)=>{return t.gt(a)?t:a};var ba=(t,a)=>{return t.lt(a)?t:a};class dn extends B{constructor(){super("LIMBO")}get supportedEdgeConfigurations(){return[1,2,3,4,8]}getBetAmount(t){return t.betAmount}determineGameResult({generator:t,edge:a,gameInputs:r}){let n=t.getRandomInt({min:1,max:4294967295}),o=n.max,c=new V(16777216),e=new V(1),i=new V(1e6),u=n.value,d=new V(u-1).div(o),A=(100-a)/100,s=c.div(d.mul(c).plus(1)).mul(A),m=Pa(e,ba(s,i)),p=m.gte(r.targetMultiplier)?new V(r.targetMultiplier):new V(0);return{isFinished:!0,payout:{legs:[{amount:r.betAmount.mul(p)}]},payoutMultiplier:p,outputs:{randomMultiplier:m,result:n.values},randomValues:n}}}import dt from"big.js";var Ut=(t,a)=>{if(a<0||t<0||a>t)throw new Error("Invalid input: ensure 0 ≤ r ≤ n and n ≥ 0.");if(a>t-a)a=t-a;let r=1;for(let n=1;n<=a;n++)r=r*(t-n+1)/n;return r};class sn extends B{constructor(){super("MINES")}get supportedEdgeConfigurations(){return[1,2,3,4,8]}getBetAmount(t){return t.betAmount}determineGameResult({generator:t,edge:a,gameInputs:r}){if(r.minesCount<=0||r.minesCount>24)throw new Error("Must select between 1 and 24 mines.");if(r.selectedTiles.length>25-r.minesCount)throw new Error("Cannot select more tiles than available safe tiles (total tiles minus mines).");let e=t.getUniqueRandomInts({min:1,max:25,count:r.minesCount}),i=e.values.some((p)=>r.selectedTiles.includes(p)),u=r.hasCashedOut||i,d=(100-a)/100,A=new dt(Ut(25-r.minesCount,r.selectedTiles.length)).div(new dt(Ut(25,r.selectedTiles.length))),m=r.hasCashedOut&&!i?new dt(d).div(A):new dt(0);return{isFinished:u,payout:{legs:[{amount:r.betAmount.mul(m)}]},payoutMultiplier:m,outputs:{result:e.values},randomValues:e}}}import{Big as yn}from"big.js";var ja;((n)=>{n.LOW_RISK="LOW_RISK";n.MEDIUM_RISK="MEDIUM_RISK";n.HIGH_RISK="HIGH_RISK"})(ja||={});var ri=[8,9,10,11,12,13,14,15,16],An={LOW_RISK:{8:[6,2.1,1.1,1,0.5,1,1.1,2.1,6],9:[6,2,1.6,1,0.7,0.7,1,1.6,2,6],10:[9,3,1.4,1.1,1,0.5,1,1.1,1.4,3,9],11:[8,3,1.9,1.3,1,0.7,0.7,1,1.3,1.9,3,8],12:[10,3,1.6,1.4,1.1,1,0.5,1,1.1,1.4,1.6,3,10],13:[8,4,3,1.9,1.2,0.9,0.7,0.7,0.9,1.2,1.9,3,4,8],14:[7,4,1.9,1.4,1.3,1.1,1,0.5,1,1.1,1.3,1.4,1.9,4,7],15:[15,8,3,2,1.5,1.1,1,0.7,0.7,1,1.1,1.5,2,3,8,15],16:[16,9,2,1.4,1.4,1.2,1.1,1,0.5,1,1.1,1.2,1.4,1.4,2,9,16]},MEDIUM_RISK:{8:[13,3,1.3,0.7,0.4,0.7,1.3,3,13],9:[18,4,1.7,0.9,0.5,0.5,0.9,1.7,4,18],10:[22,5,2,1.4,0.6,0.4,0.6,1.4,2,5,22],11:[24,6,3,1.8,0.7,0.5,0.5,0.7,1.8,3,6,24],12:[33,11,4,2,1.1,0.6,0.3,0.6,1.1,2,4,11,33],13:[43,13,6,3,1.3,0.7,0.4,0.4,0.7,1.3,3,6,13,43],14:[58,15,7,4,1.9,1,0.5,0.2,0.5,1,1.9,4,7,15,58],15:[88,18,11,5,3,1.3,0.5,0.3,0.3,0.5,1.3,3,5,11,18,88],16:[110,41.1,10,5,3,1.5,1,0.5,0.3,0.5,1,1.5,3,5,10,41.1,110]},HIGH_RISK:{8:[29,4,1.5,0.3,0.2,0.3,1.5,4,29],9:[43,7,2,0.6,0.2,0.2,0.6,2,7,43],10:[76,10,3,0.9,0.3,0.2,0.3,0.9,3,10,76],11:[120,13.9,5.2,1.4,0.4,0.2,0.2,0.4,1.4,5.2,13.9,120],12:[170,23.8,8.1,2,0.7,0.2,0.2,0.2,0.7,2,8.1,23.8,170],13:[260,36.7,11,4,1,0.2,0.2,0.2,0.2,1,4,11,36.7,260],14:[420,56.1,18,5,1.9,0.3,0.2,0.2,0.2,0.3,1.9,5,18,56.1,420],15:[620,82.8,27,8,3,0.5,0.2,0.2,0.2,0.2,0.5,3,8,27,82.8,620],16:[1000,129.9,26.1,9,4,2,0.2,0.2,0.2,0.2,0.2,2,4,9,26.1,129.9,1000]}},pn={LOW_RISK:{8:[6,1.9,1.1,1,0.5,1,1.1,1.9,6],9:[6,1.7,1.6,1,0.7,0.7,1,1.6,1.7,6],10:[9,2.5,1.4,1.1,1,0.5,1,1.1,1.4,2.5,9],11:[9,2.5,1.8,1.3,1,0.7,0.7,1,1.3,1.8,2.5,9],12:[10,3.2,1.6,1.3,1.1,1,0.5,1,1.1,1.3,1.6,3.2,10],13:[8,3.7,2.9,1.8,1.2,0.9,0.7,0.7,0.9,1.2,1.8,2.9,3.7,8],14:[7,4,1.8,1.2,1.3,1.1,1,0.5,1,1.1,1.3,1.2,1.8,4,7],15:[15,7.6,2.8,2,1.4,1.1,1,0.7,0.7,1,1.1,1.4,2,2.8,7.6,15],16:[16,9,1.7,1.2,1.3,1.2,1.1,1,0.5,1,1.1,1.2,1.3,1.2,1.7,9,16]},MEDIUM_RISK:{8:[13,3.2,1.4,0.6,0.4,0.6,1.4,3.2,13],9:[18,3.7,1.7,0.9,0.5,0.5,0.9,1.7,3.7,18],10:[22,5,1.9,1.4,0.6,0.4,0.6,1.4,1.9,5,22],11:[24,6,2.8,1.8,0.7,0.5,0.5,0.7,1.8,2.8,6,24],12:[33,11.1,4,1.9,1.1,0.6,0.3,0.6,1.1,1.9,4,11.1,33],13:[43,13.7,6.1,2.8,1.3,0.7,0.4,0.4,0.7,1.3,2.8,6.1,13.7,43],14:[58,13.7,6.7,3.9,1.9,1,0.5,0.2,0.5,1,1.9,3.9,6.7,13.7,58],15:[88,17.7,10.8,5,2.9,1.3,0.5,0.3,0.3,0.5,1.3,2.9,5,10.8,17.7,88],16:[110,40.5,9.8,4.8,2.9,1.5,1,0.5,0.3,0.5,1,1.5,2.9,4.8,9.8,40.5,110]},HIGH_RISK:{8:[29,3.8,1.5,0.3,0.2,0.3,1.5,3.8,29],9:[43,7.1,1.9,0.6,0.2,0.2,0.6,1.9,7.1,43],10:[76,9.9,2.9,0.9,0.3,0.2,0.3,0.9,2.9,9.9,76],11:[120,13.4,5.1,1.4,0.4,0.2,0.2,0.4,1.4,5.1,13.4,120],12:[170,23.2,7.9,2,0.7,0.2,0.2,0.2,0.7,2,7.9,23.2,170],13:[260,36.6,10.5,4,1,0.2,0.2,0.2,0.2,1,4,10.5,36.6,260],14:[420,55.5,17.6,4.9,1.9,0.3,0.2,0.2,0.2,0.3,1.9,4.9,17.6,55.5,420],15:[620,82.3,26.8,7.7,3,0.5,0.2,0.2,0.2,0.2,0.5,3,7.7,26.8,82.3,620],16:[1000,129.8,25.2,8.6,4,2,0.2,0.2,0.2,0.2,0.2,2,4,8.6,25.2,129.8,1000]}},Bn={LOW_RISK:{8:[6,2.2,1.1,1,0.4,1,1.1,2.2,6],9:[6,1.8,1.5,1,0.7,0.7,1,1.5,1.8,6],10:[9,2.4,1.3,1.1,1,0.5,1,1.1,1.3,2.4,9],11:[8,2.7,1.9,1.2,1,0.7,0.7,1,1.2,1.9,2.7,8],12:[10,3.3,1.6,1.2,1.1,1,0.5,1,1.1,1.2,1.6,3.3,10],13:[8,3.8,2.9,1.9,1.1,0.9,0.7,0.7,0.9,1.1,1.9,2.9,3.8,8],14:[7,3.9,2,1.4,1.3,1.1,1,0.4,1,1.1,1.3,1.4,2,3.9,7],15:[15,7.9,2.5,2,1.3,1.1,1,0.7,0.7,1,1.1,1.3,2,2.5,7.9,15],16:[16,8.9,1.9,1.4,1.4,1.2,1.1,1,0.4,1,1.1,1.2,1.4,1.4,1.9,8.9,16]},MEDIUM_RISK:{8:[13,3.5,1.2,0.7,0.3,0.7,1.2,3.5,13],9:[18,3.8,1.6,0.9,0.5,0.5,0.9,1.6,3.8,18],10:[22,5.2,2,1.3,0.6,0.4,0.6,1.3,2,5.2,22],11:[24,5.6,2.7,1.8,0.7,0.5,0.5,0.7,1.8,2.7,5.6,24],12:[33,11.3,4,1.8,1.1,0.6,0.3,0.6,1.1,1.8,4,11.3,33],13:[43,12.9,5.7,2.8,1.3,0.7,0.4,0.4,0.7,1.3,2.8,5.7,12.9,43],14:[58,13.7,6.9,3.9,1.8,1,0.5,0.2,0.5,1,1.8,3.9,6.9,13.7,58],15:[88,18,10.9,4.9,2.8,1.3,0.5,0.3,0.3,0.5,1.3,2.8,4.9,10.9,18,88],16:[110,39.9,9.9,5,2.9,1.4,1,0.5,0.3,0.5,1,1.4,2.9,5,9.9,39.9,110]},HIGH_RISK:{8:[29,4,1.4,0.3,0.2,0.3,1.4,4,29],9:[43,7.3,2,0.5,0.2,0.2,0.5,2,7.3,43],10:[76,9.8,2.8,0.9,0.3,0.2,0.3,0.9,2.8,9.8,76],11:[120,13.5,4.9,1.4,0.4,0.2,0.2,0.4,1.4,4.9,13.5,120],12:[170,23.3,7.9,1.9,0.7,0.2,0.2,0.2,0.7,1.9,7.9,23.3,170],13:[260,36.2,10.4,3.9,1,0.2,0.2,0.2,0.2,1,3.9,10.4,36.2,260],14:[420,54.8,17.9,4.9,1.8,0.3,0.2,0.2,0.2,0.3,1.8,4.9,17.9,54.8,420],15:[620,81.9,26.6,7.7,2.9,0.5,0.2,0.2,0.2,0.2,0.5,2.9,7.7,26.6,81.9,620],16:[1000,130,24.9,8.4,3.9,2,0.2,0.2,0.2,0.2,0.2,2,3.9,8.4,24.9,130,1000]}},mn={LOW_RISK:{8:[6,2,1.1,1,0.4,1,1.1,2,6],9:[6,1.9,1.4,1,0.7,0.7,1,1.4,1.9,6],10:[9,2.8,1.1,1.1,1,0.5,1,1.1,1.1,2.8,9],11:[8,2.7,1.7,1.2,1,0.7,0.7,1,1.2,1.7,2.7,8],12:[10,2.7,1.4,1.2,1.1,1,0.5,1,1.1,1.2,1.4,2.7,10],13:[8,3.5,2.8,1.9,1.3,0.9,0.6,0.6,0.9,1.3,1.9,2.8,3.5,8],14:[7,3.3,1.6,1.3,1.3,1.1,1,0.4,1,1.1,1.3,1.3,1.6,3.3,7],15:[15,8,2.9,2,1.4,1.2,1,0.6,0.6,1,1.2,1.4,2,2.9,8,15],16:[16,9.1,2.2,1.4,1.2,1.2,1.1,1,0.4,1,1.1,1.2,1.2,1.4,2.2,9.1,16]},MEDIUM_RISK:{8:[13,2.9,1.2,0.7,0.4,0.7,1.2,2.9,13],9:[18,3.5,1.6,0.9,0.5,0.5,0.9,1.6,3.5,18],10:[22,4.7,2,1.3,0.6,0.4,0.6,1.3,2,4.7,22],11:[24,5.7,2.5,1.8,0.7,0.5,0.5,0.7,1.8,2.5,5.7,24],12:[33,10.7,3.8,1.8,1.1,0.6,0.3,0.6,1.1,1.8,3.8,10.7,33],13:[43,12.6,5.6,2.7,1.3,0.7,0.4,0.4,0.7,1.3,2.7,5.6,12.6,43],14:[58,13.7,6.4,3.8,1.8,1,0.5,0.2,0.5,1,1.8,3.8,6.4,13.7,58],15:[88,17.7,10.7,4.9,2.7,1.3,0.5,0.3,0.3,0.5,1.3,2.7,4.9,10.7,17.7,88],16:[110,39.7,9.6,4.8,2.8,1.4,1,0.5,0.3,0.5,1,1.4,2.8,4.8,9.6,39.7,110]},HIGH_RISK:{8:[29,3.9,1.4,0.3,0.2,0.3,1.4,3.9,29],9:[43,6.9,1.8,0.6,0.2,0.2,0.6,1.8,6.9,43],10:[76,9.8,2.7,0.9,0.3,0.2,0.3,0.9,2.7,9.8,76],11:[120,13.1,5.1,1.3,0.4,0.2,0.2,0.4,1.3,5.1,13.1,120],12:[170,22.7,7.7,1.9,0.7,0.2,0.2,0.2,0.7,1.9,7.7,22.7,170],13:[260,35.9,10.3,3.8,1,0.2,0.2,0.2,0.2,1,3.8,10.3,35.9,260],14:[420,54.2,17.5,4.8,1.8,0.3,0.2,0.2,0.2,0.3,1.8,4.8,17.5,54.2,420],15:[620,80.6,26.1,7.8,2.8,0.5,0.2,0.2,0.2,0.2,0.5,2.8,7.8,26.1,80.6,620],16:[1000,129.7,24.7,8.2,3.8,2,0.2,0.2,0.2,0.2,0.2,2,3.8,8.2,24.7,129.7,1000]}},En={LOW_RISK:{8:[5,1.8,1,1,0.4,1,1,1.8,5],9:[5,1.7,1.2,1,0.7,0.7,1,1.2,1.7,5],10:[9,2.8,1.2,1,1,0.4,1,1,1.2,2.8,9],11:[8,2.5,1.6,1,1,0.7,0.7,1,1,1.6,2.5,8],12:[10,2.5,1.3,1.3,1,1,0.4,1,1,1.3,1.3,2.5,10],13:[8,4.1,2.8,1.8,1.1,0.9,0.6,0.6,0.9,1.1,1.8,2.8,4.1,8],14:[7,3.3,1.7,1.2,1.2,1,1,0.4,1,1,1.2,1.2,1.7,3.3,7],15:[15,7.3,2.9,1.9,1.4,1,1,0.6,0.6,1,1,1.4,1.9,2.9,7.3,15],16:[16,8.7,2,1.5,1.3,1,1.1,1,0.3,1,1.1,1,1.3,1.5,2,8.7,16]},MEDIUM_RISK:{8:[13,2.6,1.1,0.7,0.4,0.7,1.1,2.6,13],9:[17,3.3,1.4,0.9,0.5,0.5,0.9,1.4,3.3,17],10:[21,4.1,1.7,1.3,0.6,0.4,0.6,1.3,1.7,4.1,21],11:[23,5.6,2.4,1.6,0.7,0.5,0.5,0.7,1.6,2.4,5.6,23],12:[32,10.2,3.7,1.7,1.1,0.6,0.2,0.6,1.1,1.7,3.7,10.2,32],13:[42,11.7,5.3,2.5,1.2,0.7,0.4,0.4,0.7,1.2,2.5,5.3,11.7,42],14:[56,13.2,5.9,3.6,1.6,1,0.5,0.2,0.5,1,1.6,3.6,5.9,13.2,56],15:[86,17.3,10,4.6,2.6,1.2,0.5,0.3,0.3,0.5,1.2,2.6,4.6,10,17.3,86],16:[107,39,9.9,4.5,2.4,1.3,1,0.5,0.3,0.5,1,1.3,2.4,4.5,9.9,39,107]},HIGH_RISK:{8:[28,3.3,1.4,0.3,0.2,0.3,1.4,3.3,28],9:[42,6.7,1.6,0.6,0.2,0.2,0.6,1.6,6.7,42],10:[74,9.6,2.6,0.9,0.3,0.1,0.3,0.9,2.6,9.6,74],11:[116,12.7,4.8,1.2,0.4,0.2,0.2,0.4,1.2,4.8,12.7,116],12:[165,20.9,7.2,1.8,0.7,0.2,0.2,0.2,0.7,1.8,7.2,20.9,165],13:[252,33.9,10.1,3.4,1,0.2,0.2,0.2,0.2,1,3.4,10.1,33.9,252],14:[407,51.9,16.3,4.6,1.7,0.3,0.2,0.2,0.2,0.3,1.7,4.6,16.3,51.9,407],15:[600,76.9,24.9,7.4,2.6,0.5,0.2,0.2,0.2,0.2,0.5,2.6,7.4,24.9,76.9,600],16:[1000,122,24.5,8,3.7,1.8,0.2,0.2,0.2,0.2,0.2,1.8,3.7,8,24.5,122,1000]}},Ta=new P(new Map([[1,An],[2,pn],[3,Bn],[4,mn],[8,En]]));class fn extends B{constructor(){super("PLINKO")}get supportedEdgeConfigurations(){return[1,2,3,4,8]}getBetAmount(t){return t.betAmount}determineGameResult({generator:t,gameInputs:a,edge:r}){if(a.numberOfRows%1>0)throw new Error("Number of rows must be an integer");if(a.numberOfRows<8||a.numberOfRows>16)throw new Error("Number of rows must be between 8 and 16");let n=a.numberOfRows,e=Ta.getMultipliers(r)[a.riskLevel][n],i=t.getRandomIntsWithReplacement({min:0,max:1,count:a.numberOfRows}),d=i.values.reduce((m,p)=>m+p,0),A=e[d];if(A===void 0)throw new Error(`No payout found for end position ${d}`);let s=yn(A);return{isFinished:!0,payout:{legs:[{amount:a.betAmount.mul(s)}]},payoutMultiplier:s,outputs:{result:i.values},randomValues:i}}}import{Big as pt}from"big.js";var Zt=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36],Ra=[37,...Zt],_a=[[0,1],[0,2],[0,3],[1,2],[1,4],[2,3],[2,5],[3,6],[4,5],[4,7],[5,6],[5,8],[6,9],[7,8],[7,10],[8,9],[8,11],[9,12],[10,11],[10,13],[11,12],[11,14],[12,15],[13,14],[13,16],[14,15],[14,17],[15,18],[16,17],[16,19],[17,18],[17,20],[18,21],[19,20],[19,22],[20,21],[20,23],[21,24],[22,23],[22,25],[23,24],[23,26],[24,27],[25,26],[25,28],[26,27],[26,29],[27,30],[28,29],[28,31],[29,30],[29,32],[30,33],[31,32],[31,34],[32,33],[32,35],[33,36],[34,35],[35,36]],Na=[[0,1],[0,37],[3,37],[1,2],[1,4],[2,3],[2,5],[3,6],[4,5],[4,7],[5,6],[5,8],[6,9],[7,8],[7,10],[8,9],[8,11],[9,12],[10,11],[10,13],[11,12],[11,14],[12,15],[13,14],[13,16],[14,15],[14,17],[15,18],[16,17],[16,19],[17,18],[17,20],[18,21],[19,20],[19,22],[20,21],[20,23],[21,24],[22,23],[22,25],[23,24],[23,26],[24,27],[25,26],[25,28],[26,27],[26,29],[27,30],[28,29],[28,31],[29,30],[29,32],[30,33],[31,32],[31,34],[32,33],[32,35],[33,36],[34,35],[35,36]],ka=[[0,1,2],[0,2,3],[1,2,3],[4,5,6],[7,8,9],[10,11,12],[13,14,15],[16,17,18],[19,20,21],[22,23,24],[25,26,27],[28,29,30],[31,32,33],[34,35,36]],wa=[[0,1,2],[0,2,37],[1,2,3],[2,3,37],[4,5,6],[7,8,9],[10,11,12],[13,14,15],[16,17,18],[19,20,21],[22,23,24],[25,26,27],[28,29,30],[31,32,33],[34,35,36]],Va=[[0,1,2,3],[1,2,4,5],[2,3,5,6],[4,5,7,8],[5,6,8,9],[7,8,10,11],[8,9,11,12],[10,11,13,14],[11,12,14,15],[13,14,16,17],[14,15,17,18],[16,17,19,20],[17,18,20,21],[19,20,22,23],[20,21,23,24],[22,23,25,26],[23,24,26,27],[25,26,28,29],[26,27,29,30],[28,29,31,32],[29,30,32,33],[31,32,34,35],[32,33,35,36]],Ia=[[1,2,4,5],[2,3,5,6],[4,5,7,8],[5,6,8,9],[7,8,10,11],[8,9,11,12],[10,11,13,14],[11,12,14,15],[13,14,16,17],[14,15,17,18],[16,17,19,20],[17,18,20,21],[19,20,22,23],[20,21,23,24],[22,23,25,26],[23,24,26,27],[25,26,28,29],[26,27,29,30],[28,29,31,32],[29,30,32,33],[31,32,34,35],[32,33,35,36]],Ua=[0,1,2,3,37],Za=[[1,2,3,4,5,6],[4,5,6,7,8,9],[7,8,9,10,11,12],[10,11,12,13,14,15],[13,14,15,16,17,18],[16,17,18,19,20,21],[19,20,21,22,23,24],[22,23,24,25,26,27],[25,26,27,28,29,30],[28,29,30,31,32,33],[31,32,33,34,35,36]],Ga=[[1,2,3,4,5,6],[4,5,6,7,8,9],[7,8,9,10,11,12],[10,11,12,13,14,15],[13,14,15,16,17,18],[16,17,18,19,20,21],[19,20,21,22,23,24],[22,23,24,25,26,27],[25,26,27,28,29,30],[28,29,30,31,32,33],[31,32,33,34,35,36]],I;((r)=>{r.EVEN="EVEN";r.ODD="ODD"})(I||={});var U;((r)=>{r.RED="RED";r.BLACK="BLACK"})(U||={});var Z;((r)=>{r.LOW="LOW";r.HIGH="HIGH"})(Z||={});var G;((n)=>{n.TOP="TOP";n.MIDDLE="MIDDLE";n.BOTTOM="BOTTOM"})(G||={});var M;((n)=>{n.FIRST="FIRST";n.SECOND="SECOND";n.THIRD="THIRD"})(M||={});var Gt;((r)=>{r.AMERICAN="AMERICAN";r.EUROPEAN="EUROPEAN"})(Gt||={});var q=2.7,X=5.3;var st=(t)=>{if(t.straightBets.length===0&&t.splitBets.length===0&&t.streetBets.length===0&&t.cornerBets.length===0&&t.doubleStreetBets.length===0&&t.parityBets.length===0&&t.colorBets.length===0&&t.halfBets.length===0&&t.columnBets.length===0&&t.dozenBets.length===0)throw l.createValidationError("Must place at least a single bet.");if(!t.straightBets.every((a)=>a.amount.gte(0)&&Q(a.value)))throw l.createValidationError("Invalid straight bet.");if(!t.splitBets.every((a)=>a.amount.gte(0)&&Sn(a.values)))throw l.createValidationError("Invalid split bet.");if(!t.streetBets.every((a)=>a.amount.gte(0)&&On(a.values)))throw l.createValidationError("Invalid street bet.");if(!t.cornerBets.every((a)=>a.amount.gte(0)&&Hn(a.values)))throw l.createValidationError("Invalid corner bet.");if(!t.doubleStreetBets.every((a)=>a.amount.gte(0)&&Dn(a.values)))throw l.createValidationError("Invalid double street bet.");if(!t.parityBets.every((a)=>a.amount.gte(0)&&Object.values(I).includes(a.parity)))throw l.createValidationError("Invalid parity bet.");if(!t.colorBets.every((a)=>a.amount.gte(0)&&Object.values(U).includes(a.color)))throw l.createValidationError("Invalid color bet.");if(!t.halfBets.every((a)=>a.amount.gte(0)&&Object.values(Z).includes(a.half)))throw l.createValidationError("Invalid half bet.");if(!t.columnBets.every((a)=>a.amount.gte(0)&&Object.values(G).includes(a.column)))throw l.createValidationError("Invalid column bet.");if(!t.dozenBets.every((a)=>a.amount.gte(0)&&Object.values(M).includes(a.dozen)))throw l.createValidationError("Invalid dozen bet.")},Q=(t)=>{return Zt.includes(t)},Sn=(t)=>{if(t.length!==2)return!1;if(!t.every(Q))return!1;return _a.some(([a,r])=>a===t[0]&&r===t[1])},On=(t)=>{if(t.length!==3)return!1;if(!t.every(Q))return!1;return ka.some(([a,r,n])=>a===t[0]&&r===t[1]&&n===t[2])},Hn=(t)=>{if(t.length!==4)return!1;if(!t.every(Q))return!1;return Va.some(([a,r,n,o])=>a===t[0]&&r===t[1]&&n===t[2]&&o===t[3])},Dn=(t)=>{if(t.length!==6)return!1;if(!t.every(Q))return!1;return Za.some(([a,r,n,o,c,e])=>a===t[0]&&r===t[1]&&n===t[2]&&o===t[3]&&c===t[4]&&e===t[5])};var At=(t)=>{if(t.straightBets.length===0&&t.splitBets.length===0&&t.streetBets.length===0&&t.cornerBets.length===0&&t.basketBets.length===0&&t.doubleStreetBets.length===0&&t.parityBets.length===0&&t.colorBets.length===0&&t.halfBets.length===0&&t.columnBets.length===0&&t.dozenBets.length===0)throw l.createValidationError("Must place at least a single bet.");if(!t.straightBets.every((a)=>a.amount.gte(0)&&W(a.value)))throw l.createValidationError("Invalid straight bet.");if(!t.splitBets.every((a)=>a.amount.gte(0)&&hn(a.values)))throw l.createValidationError("Invalid split bet.");if(!t.streetBets.every((a)=>a.amount.gte(0)&&Cn(a.values)))throw l.createValidationError("Invalid street bet.");if(!t.cornerBets.every((a)=>a.amount.gte(0)&&xn(a.values)))throw l.createValidationError("Invalid corner bet.");if(!t.basketBets.every((a)=>a.amount.gte(0)))throw l.createValidationError("Invalid basket bet.");if(!t.doubleStreetBets.every((a)=>a.amount.gte(0)&&Pn(a.values)))throw l.createValidationError("Invalid double street bet.");if(!t.parityBets.every((a)=>a.amount.gte(0)&&Object.values(I).includes(a.parity)))throw l.createValidationError("Invalid parity bet.");if(!t.colorBets.every((a)=>a.amount.gte(0)&&Object.values(U).includes(a.color)))throw l.createValidationError("Invalid color bet.");if(!t.halfBets.every((a)=>a.amount.gte(0)&&Object.values(Z).includes(a.half)))throw l.createValidationError("Invalid half bet.");if(!t.columnBets.every((a)=>a.amount.gte(0)&&Object.values(G).includes(a.column)))throw l.createValidationError("Invalid column bet.");if(!t.dozenBets.every((a)=>a.amount.gte(0)&&Object.values(M).includes(a.dozen)))throw l.createValidationError("Invalid dozen bet.")},W=(t)=>{return Ra.includes(t)};function hn(t){if(t.length!==2)return!1;if(!t.every(W))return!1;return Na.some(([a,r])=>a===t[0]&&r===t[1])}var Cn=(t)=>{if(t.length!==3)return!1;if(!t.every(W))return!1;return wa.some(([a,r,n])=>a===t[0]&&r===t[1]&&n===t[2])},xn=(t)=>{if(t.length!==4)return!1;if(!t.every(W))return!1;return Ia.some(([a,r,n,o])=>a===t[0]&&r===t[1]&&n===t[2]&&o===t[3])},Pn=(t)=>{if(t.length!==6)return!1;if(!t.every(W))return!1;return Ga.some(([a,r,n,o,c,e])=>a===t[0]&&r===t[1]&&n===t[2]&&o===t[3]&&c===t[4]&&e===t[5])};var bn=(t,a)=>{let r=a===q&&t.type==="EUROPEAN",n=a===X&&t.type==="AMERICAN";if(!r&&!n)throw l.createValidationError(`Attempted to play ${t.type} roulette on edge ${a}`)},Ma=(t,a)=>{if(bn(t,a),t.type==="EUROPEAN")st(t.inputs);else At(t.inputs)};var jn={straightBets:36,splitBets:18,streetBets:12,cornerBets:9,basketBets:7,doubleStreetBets:6,parityBets:2,colorBets:2,halfBets:2,columnBets:3,dozenBets:3},Tn=[3,6,9,12,15,18,21,24,27,30,33,36],Rn=[2,5,8,11,14,17,20,23,26,29,32,35],_n=[1,4,7,10,13,16,19,22,25,28,31,34],Nn=[1,3,5,7,9,12,14,16,18,19,21,23,25,27,30,32,34,36],kn=[2,4,6,8,10,11,13,15,17,20,22,24,26,28,29,31,33,35];class Mt extends B{constructor(){super("ROULETTE")}determineGameResult({generator:t,gameInputs:a}){this.validateInputs(a);let r=t.getRandomInt({min:0,max:this.maxNumber}),n=r.value,o=this.determineBetOutcomes(a,n),{payoutMultiplier:c,payout:e}=this.getPayoutDetails(a,n);return{outputs:{betOutcomes:o,result:r.values},payout:e,payoutMultiplier:c,isFinished:!0,randomValues:r}}getBetAmount(t){return this.calculateTotalBetAmount(this.getBetTotals(t))}getPayoutDetails(t,a){let r=this.getBetTotals(t),n=this.calculateTotalBetAmount(r),o={legs:this.calculatePayoutLegs(t,a)},c=R(o);return{payoutMultiplier:n.gt(0)?c.div(n):new pt(0),payout:o}}determineBetOutcomes(t,a){let r={},n={};for(let o of Object.keys(t)){let c=t[o],e=this.betPredicates[o],{winning:i,losing:u}=this.partitionBets(c,e,a);r[o]=i,n[o]=u}return{winningBets:r,losingBets:n}}calculateTotalAmount(t){return t.reduce((a,r)=>a.plus(r.amount),new pt(0))}isWinningStraightBet(t,a){return t.value===a}isWinningSplitBet(t,a){return t.values.some((r)=>r===a)}isWinningStreetBet(t,a){return t.values.some((r)=>r===a)}isWinningCornerBet(t,a){return t.values.some((r)=>r===a)}isWinningDoubleStreetBet(t,a){return t.values.some((r)=>r===a)}isWinningColorBet(t,a){let r=t;return Nn.includes(a)&&r.color==="RED"||kn.includes(a)&&r.color==="BLACK"}isWinningHalfBet(t,a){let r=t;if(a>0&&a<=18&&r.half==="LOW")return!0;if(a>18&&a<=36&&r.half==="HIGH")return!0;return!1}isWinningColumnBet(t,a){let r=t;return Tn.includes(a)&&r.column==="TOP"||Rn.includes(a)&&r.column==="MIDDLE"||_n.includes(a)&&r.column==="BOTTOM"}isWinningDozenBet(t,a){let r=t;if(a>0&&a<=12&&r.dozen==="FIRST")return!0;if(a>12&&a<=24&&r.dozen==="SECOND")return!0;if(a>24&&a<=36&&r.dozen==="THIRD")return!0;return!1}isWinningParityBet(t,a){let r=t;if(a===0||a===37)return!1;let n=a%2===0?"EVEN":"ODD";return r.parity===n}getBetTotals(t){let a={};for(let r of Object.keys(t))a[r]=this.calculateTotalAmount(t[r]);return a}calculateTotalBetAmount(t){return Object.values(t).reduce((a,r)=>a.plus(r),new pt(0))}partitionBets(t,a,r){return{winning:t.filter((n)=>a(n,r)),losing:t.filter((n)=>!a(n,r))}}calculatePayoutLegs(t,a){return Object.keys(t).flatMap((r)=>{let n=jn[r],o=this.betPredicates[r];return t[r].map((c)=>{if(!o(c,a))return{amount:new pt("0")};return{amount:c.amount.mul(n||0)}})})}}class Fa extends Mt{maxNumber=36;betPredicates={straightBets:this.isWinningStraightBet,splitBets:this.isWinningSplitBet,streetBets:this.isWinningStreetBet,cornerBets:this.isWinningCornerBet,doubleStreetBets:this.isWinningDoubleStreetBet,parityBets:this.isWinningParityBet,colorBets:this.isWinningColorBet,halfBets:this.isWinningHalfBet,columnBets:this.isWinningColumnBet,dozenBets:this.isWinningDozenBet};get supportedEdgeConfigurations(){return[q]}validateInputs(t){st(t)}}class Ja extends Mt{maxNumber=37;betPredicates={straightBets:this.isWinningStraightBet,splitBets:this.isWinningSplitBet,streetBets:this.isWinningStreetBet,cornerBets:this.isWinningCornerBet,basketBets:this.isWinningBasketBet,doubleStreetBets:this.isWinningDoubleStreetBet,parityBets:this.isWinningParityBet,colorBets:this.isWinningColorBet,halfBets:this.isWinningHalfBet,columnBets:this.isWinningColumnBet,dozenBets:this.isWinningDozenBet};get supportedEdgeConfigurations(){return[X]}validateInputs(t){At(t)}isWinningBasketBet(t,a){return Ua.some((r)=>r===a)}}class Ya extends B{europeanGame;americanGame;constructor(){super("ROULETTE");this.europeanGame=new Fa,this.americanGame=new Ja}get supportedEdgeConfigurations(){return[q,X]}getBetAmount(t){switch(t.type){case"AMERICAN":return this.americanGame.getBetAmount(t.inputs);case"EUROPEAN":return this.europeanGame.getBetAmount(t.inputs);default:throw new Error("Unhandled roulette type")}}determineGameResult(t){let{gameInputs:a,...r}=t;if(Ma(a,t.edge),a.type==="EUROPEAN"){let c=this.europeanGame.determineGameResult({...r,gameInputs:a.inputs}),{betOutcomes:e}=c.outputs;return{...c,outputs:{type:"european",betOutcomes:e,result:c.outputs.result}}}let n=this.americanGame.determineGameResult({...r,gameInputs:a.inputs}),{betOutcomes:o}=n.outputs;return{...n,outputs:{type:"american",betOutcomes:o,result:n.outputs.result}}}}var ki=(t)=>{return new Ya().getBetAmount(t)};import{Big as Gn}from"big.js";var g;((n)=>{n.LOW_RISK="LOW_RISK";n.MEDIUM_RISK="MEDIUM_RISK";n.HIGH_RISK="HIGH_RISK"})(g||={});var L;((c)=>{c[c.TEN=10]="TEN";c[c.TWENTY=20]="TWENTY";c[c.THIRTY=30]="THIRTY";c[c.FORTY=40]="FORTY";c[c.FIFTY=50]="FIFTY"})(L||={});var wn={LOW_RISK:{10:{ZERO:0,A:1.2,B:1.5},20:{ZERO:0,A:1.2,B:1.5},30:{ZERO:0,A:1.2,B:1.5},40:{ZERO:0,A:1.2,B:1.5},50:{ZERO:0,A:1.2,B:1.5}},MEDIUM_RISK:{10:{ZERO:0,A:1.5,B:1.9,C:2,D:3},20:{ZERO:0,A:1.5,B:1.8,C:2,D:3},30:{ZERO:0,A:1.5,B:1.7,C:2,D:3,E:4},40:{ZERO:0,A:1.5,B:1.6,C:2,D:3},50:{ZERO:0,A:1.5,B:2,C:3,D:5}},HIGH_RISK:{10:{ZERO:0,A:9.9},20:{ZERO:0,A:19.8},30:{ZERO:0,A:29.7},40:{ZERO:0,A:39.6},50:{ZERO:0,A:49.5}}},Vn={LOW_RISK:{10:{ZERO:0,A:1.2,B:1.4},20:{ZERO:0,A:1.2,B:1.4},30:{ZERO:0,A:1.2,B:1.4},40:{ZERO:0,A:1.2,B:1.4},50:{ZERO:0,A:1.2,B:1.4}},MEDIUM_RISK:{10:{ZERO:0,A:1.4,B:1.9,C:2,D:3.1},20:{ZERO:0,A:1.5,B:1.8,C:1.9,D:3.4},30:{ZERO:0,A:1.5,B:1.7,C:1.9,D:3,E:4.3},40:{ZERO:0,A:1.5,B:1.6,C:2,D:2.9},50:{ZERO:0,A:1.5,B:2,C:3,D:4.5}},HIGH_RISK:{10:{ZERO:0,A:9.8},20:{ZERO:0,A:19.6},30:{ZERO:0,A:29.4},40:{ZERO:0,A:39.2},50:{ZERO:0,A:49}}},In={LOW_RISK:{10:{ZERO:0,A:1.15,B:1.65},20:{ZERO:0,A:1.15,B:1.65},30:{ZERO:0,A:1.15,B:1.65},40:{ZERO:0,A:1.15,B:1.65},50:{ZERO:0,A:1.15,B:1.65}},MEDIUM_RISK:{10:{ZERO:0,A:1.4,B:1.9,C:2,D:3},20:{ZERO:0,A:1.4,B:1.6,C:2,D:3},30:{ZERO:0,A:1.4,B:1.7,C:2,D:3,E:4},40:{ZERO:0,A:1.5,B:1.6,C:2,D:2.8},50:{ZERO:0,A:1.5,B:2,C:2.7,D:4.9}},HIGH_RISK:{10:{ZERO:0,A:9.7},20:{ZERO:0,A:19.4},30:{ZERO:0,A:29.1},40:{ZERO:0,A:38.8},50:{ZERO:0,A:48.5}}},Un={LOW_RISK:{10:{ZERO:0,A:1.15,B:1.55},20:{ZERO:0,A:1.15,B:1.55},30:{ZERO:0,A:1.15,B:1.55},40:{ZERO:0,A:1.15,B:1.55},50:{ZERO:0,A:1.15,B:1.55}},MEDIUM_RISK:{10:{ZERO:0,A:1.4,B:1.8,C:2,D:3},20:{ZERO:0,A:1.3,B:1.5,C:2,D:3},30:{ZERO:0,A:1.4,B:1.6,C:2,D:2.9,E:4},40:{ZERO:0,A:1.5,B:1.6,C:2,D:2.7},50:{ZERO:0,A:1.5,B:2,C:2.6,D:4.8}},HIGH_RISK:{10:{ZERO:0,A:9.6},20:{ZERO:0,A:19.2},30:{ZERO:0,A:28.8},40:{ZERO:0,A:38.4},50:{ZERO:0,A:48}}},Zn={LOW_RISK:{10:{ZERO:0,A:1.1,B:1.5},20:{ZERO:0,A:1.1,B:1.5},30:{ZERO:0,A:1.1,B:1.45},40:{ZERO:0,A:1.1,B:1.45},50:{ZERO:0,A:1.1,B:1.45}},MEDIUM_RISK:{10:{ZERO:0,A:1.3,B:1.7,C:1.9,D:3},20:{ZERO:0,A:1.3,B:1.4,C:1.9,D:3},30:{ZERO:0,A:1.3,B:1.7,C:1.9,D:2.8,E:3.8},40:{ZERO:0,A:1.4,B:1.8,C:1.9,D:2.6},50:{ZERO:0,A:1.4,B:1.9,C:2.6,D:4.6}},HIGH_RISK:{10:{ZERO:0,A:9.2},20:{ZERO:0,A:18.4},30:{ZERO:0,A:27.6},40:{ZERO:0,A:36.8},50:{ZERO:0,A:46}}},$a=new P(new Map([[1,wn],[2,Vn],[3,In],[4,Un],[8,Zn]]));var za={LOW_RISK:{10:["B","A","A","A","ZERO","A","A","A","A","ZERO"],20:["B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO"],30:["B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO"],40:["B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO"],50:["B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO"]},MEDIUM_RISK:{10:["ZERO","B","ZERO","A","ZERO","C","ZERO","A","ZERO","D"],20:["A","ZERO","C","ZERO","B","ZERO","C","ZERO","C","ZERO","A","ZERO","C","ZERO","C","ZERO","D","ZERO","C","ZERO"],30:["A","ZERO","C","ZERO","A","ZERO","C","ZERO","D","ZERO","B","ZERO","A","ZERO","C","ZERO","A","ZERO","C","ZERO","A","ZERO","C","ZERO","E","ZERO","A","ZERO","C","ZERO"],40:["C","ZERO","A","ZERO","D","ZERO","C","ZERO","A","ZERO","C","ZERO","A","ZERO","D","ZERO","C","ZERO","A","ZERO","B","ZERO","A","ZERO","D","ZERO","C","ZERO","A","ZERO","C","ZERO","A","ZERO","D","ZERO","C","ZERO","A","ZERO"],50:["A","ZERO","B","ZERO","A","ZERO","C","ZERO","A","ZERO","B","ZERO","A","ZERO","B","ZERO","A","ZERO","C","ZERO","A","ZERO","B","ZERO","A","ZERO","B","ZERO","A","ZERO","C","ZERO","A","ZERO","B","ZERO","A","ZERO","B","ZERO","A","ZERO","D","ZERO","A","ZERO","B","ZERO","A","ZERO"]},HIGH_RISK:{10:[...Array(9).fill("ZERO"),"A"],20:[...Array(19).fill("ZERO"),"A"],30:[...Array(29).fill("ZERO"),"A"],40:[...Array(39).fill("ZERO"),"A"],50:[...Array(49).fill("ZERO"),"A"]}};class Mn extends B{constructor(){super("WHEEL")}get supportedEdgeConfigurations(){return[1,2,3,4,8]}getBetAmount(t){return t.betAmount}determineGameResult({generator:t,gameInputs:a,edge:r}){if(!Object.values(L).includes(a.segments))throw new Error("Invalid segments value");if(!Object.values(g).includes(a.riskLevel))throw new Error("Invalid risk level");let o=$a.getMultipliers(r)[a.riskLevel];if(o===void 0)throw new Error(`No multipliers found for risk level ${a.riskLevel}`);let c=o[a.segments];if(c===void 0)throw new Error(`No multipliers found for segment ${a.segments}`);let e=za[a.riskLevel];if(e===void 0)throw new Error(`No patterns found for risk level ${a.riskLevel}`);let i=e[a.segments];if(i===void 0)throw new Error(`No patterns found for segment ${a.segments}`);let u=t.getRandomInt({min:0,max:i.length-1}),d=i[u.value];if(d===void 0)throw new Error(`No pattern found for segment ${a.segments} and value ${u.value}`);let A=c[d];if(A===void 0)throw new Error(`No payout found for picked segment ${d}`);let s=new Gn(A);return{isFinished:!0,payout:{legs:[{amount:a.betAmount.mul(s)}]},payoutMultiplier:s,outputs:{result:u.values},randomValues:u}}}export{Ma as validateRouletteGameInputs,ae as validateAdvancedDiceInputs,R as sumPayout,rn as rtp99Multipliers,nn as rtp98Multipliers,en as rtp97Multipliers,on as rtp96Multipliers,cn as rtp92Multipliers,Ta as plinkoMultipliers,Ut as nCr,xa as kenoMultipliers,Ca as isTileCount,vr as hasDiceWon,xr as hasBlitzWon,$o as getMaxMultiplierForDifficulty,Uo as getBlitzDefaults,Xr as diamondsMultipliers,ki as calculateRouletteBetAmount,ea as calculateInsuranceStake,Kr as calculateDiceWinChance,Pr as calculateBlitzWinChance,Qt as calculateBaccaratBetAmount,Yt as calculateAdvancedDiceWinChance,ba as bigMin,Pa as bigMax,va as advancedDiceIsWithinBoundsInclusive,mt as advancedDiceIsWithinBoundsExclusive,tr as advancedDiceGetInclusiveBoundsRange,Et as advancedDiceGetExclusiveBoundsRange,L as WheelSegments,g as WheelRiskLevel,Mn as Wheel,sr as WIN_MULTIPLIER,Ee as VALID_SUITS,ye as VALID_RANKS,ka as VALID_EUROPEAN_STREETS,Zt as VALID_EUROPEAN_STRAIGHTS,_a as VALID_EUROPEAN_SPLITS,Za as VALID_EUROPEAN_DOUBLE_STREETS,Va as VALID_EUROPEAN_CORNERS,wa as VALID_AMERICAN_STREETS,Ra as VALID_AMERICAN_STRAIGHTS,Na as VALID_AMERICAN_SPLITS,Ga as VALID_AMERICAN_DOUBLE_STREETS,Ia as VALID_AMERICAN_CORNERS,ht as ThreeCardBonusType,Tn as TOP_COLUMN,an as TILE_COUNTS,vt as THREE_CARD_BONUS_PAYOUTS,B as SingleActionGame,w as SPLIT_BET_SIZE_FACTOR,Gt as RouletteType,Ya as Roulette,ar as RollType,lt as RandomValuePool,Nn as RED_NUMBERS,at as RANDOM_MIN_VALUE,rt as RANDOM_MAX_VALUE,ja as PlinkoRiskLevel,fn as Plinko,I as Parity,Dt as PairBonusType,Ar as PUSH_MULTIPLIER,ri as PLINKO_ROW_COUNTS,jn as PAYOUT_MULTIPLIERS,Kt as PAIR_BONUS_PAYOUTS,S as OrigamiGame,C as MultiplierCalculator,jt as MultiActionGame,sn as Mines,Qa as MIN_WIN_CHANCE,Rn as MIDDLE_COLUMN,Wa as MAX_WIN_CHANCE,xt as MAX_CARDS_PER_ROUND,dn as Limbo,pr as LOSE_MULTIPLIER,ha as KenoRiskLevel,un as Keno,Ot as InsuranceOutcome,Pt as INSURANCE_WIN_MULTIPLIER,gt as INSURANCE_BET_SIZE_FACTOR,Z as Half,qa as GameErrorCode,l as GameError,Lt as FACE_CARD_VALUE,Fa as EuropeanRoulette,q as EUROPEAN_HOUSE_EDGE,Ft as EFFECTIVE_RANGE,M as Dozen,gr as DiceDirection,tn as Dice,Fr as DiamondsResultType,Wr as Diamonds,Ur as Darts,_ as DOUBLE_DOWN_BET_SIZE_FACTOR,Da as DICE_MIN_ROLL,It as DICE_MAX_ROLL,Lr as DICE_EFFECTIVE_RANGE,Wt as DEALER_STAND_VALUE,Sa as DARTS_MIN_VALUE,kt as DARTS_MAX_VALUE,Oa as DARTS_DIFFICULTY_LEVEL,wt as DARTS_BOARD_CONFIGS,G as Column,U as Color,he as CARDS_PER_SUIT,br as Blitz,St as BlackjackOutcome,Ht as BlackjackActionType,Cr as Blackjack,or as BaccaratOutcome,cr as BaccaratBetType,ur as Baccarat,Ct as BUST_VALUE,_n as BOTTOM_COLUMN,ya as BLITZ_RANDOM_NUMBER_COUNT,ma as BLITZ_MIN_CARD_RANGE,Ea as BLITZ_MAX_CARD_RANGE,$ as BLITZ_CARD_COUNT,kn as BLACK_NUMBERS,D as BLACKJACK_VALUE,dr as BLACKJACK_MULTIPLIER,ct as BASE_PAYOUT_MULTIPLIERS,Ja as AmericanRoulette,rr as AdvancedDice,X as AMERICAN_HOUSE_EDGE,Ua as AMERICAN_BASKET,bt as ACE_SOFT_BONUS};
|
|
1
|
+
import{Guard as e}from"@betorigami/guard";import t,{Big as n}from"big.js";import{createStore as r}from"@xstate/store";import i from"fast-deep-equal";const a=0,o=51,s=Array.from({length:52},(e,t)=>t),c=[`Spades`,`Hearts`,`Diamonds`,`Clubs`],l=[`Ace`,`Two`,`Three`,`Four`,`Five`,`Six`,`Seven`,`Eight`,`Nine`,`Ten`,`Jack`,`Queen`,`King`],u=[`Jack`,`Queen`,`King`],d={Hearts:`red`,Diamonds:`red`,Spades:`black`,Clubs:`black`};let f=function(e){return e.UNSUPPORTED_EDGE=`UNSUPPORTED_EDGE`,e.INPUT_VALIDATION_ERROR=`INPUT_VALIDATION_ERROR`,e}({});var p=class e extends Error{static createUnsupportedEdgeError(t){return new e(`UNSUPPORTED_EDGE`,t)}static createValidationError(t){return new e(`INPUT_VALIDATION_ERROR`,t)}static isGameError(t){return t instanceof e}errorCode;constructor(e,t){super(t),this.errorCode=e}};let m=function(e){return e.DICE=`DICE`,e.MINES=`MINES`,e.KENO=`KENO`,e.LIMBO=`LIMBO`,e.ADVANCED_DICE=`ADVANCED_DICE`,e.BACCARAT=`BACCARAT`,e.DIAMONDS=`DIAMONDS`,e.PLINKO=`PLINKO`,e.ROULETTE=`ROULETTE`,e.WHEEL=`WHEEL`,e.BLACKJACK=`BLACKJACK`,e.BLITZ=`BLITZ`,e.DARTS=`DARTS`,e}({});var h=class{gameId;constructor(e){this.gameId=e}getGameResult(t){let n=this.supportedEdgeConfigurations.includes(t.edge);return e.against(!n,()=>p.createUnsupportedEdgeError(`${this.gameId} does not support ${t.edge}% edge. Supported edge configurations include: ${this.supportedEdgeConfigurations}`)),this.determineGameResult(t)}},g=class{static withMultiplier(e,n){return new t(e).times(new t(100-n).div(100))}static withWinChance(e,n){return t(100-e).div(n)}};const ee=0,_=1e4,v=10001,te=.01,ne=98,re=e=>{if(e<0)throw p.createValidationError(`Lower bound ${e} is below minimum allowed value 0`)},ie=e=>{if(e>1e4)throw p.createValidationError(`Upper bound ${e} is above maximum allowed value ${_}`)},y=e=>{if(re(e.lower),ie(e.upper),e.lower>=e.upper)throw p.createValidationError(`Lower bound ${e.lower} must be less than ${e.upper}`)},ae=(e,t)=>{let[n,r]=e.lower<=t.lower?[e,t]:[t,e];if(n.upper>r.lower)throw p.createValidationError(`Bounds must not overlap`)},b=(e,t)=>t>=e.lower&&t<=e.upper,x=e=>e.upper-e.lower+1,S=(e,t)=>t>e.lower&&t<e.upper,C=e=>e.upper-e.lower-1;let oe=function(e){return e.ROLL_BETWEEN=`ROLL_BETWEEN`,e.ROLL_OUTSIDE=`ROLL_OUTSIDE`,e.ROLL_BETWEEN_TWO=`ROLL_BETWEEN_TWO`,e}({});const w=e=>{let t=(()=>{switch(e.mode){case`ROLL_BETWEEN`:return y(e.bounds),C(e.bounds);case`ROLL_OUTSIDE`:return y(e.bounds),v-x(e.bounds);case`ROLL_BETWEEN_TWO`:return y(e.firstBounds),y(e.secondBounds),ae(e.firstBounds,e.secondBounds),C(e.firstBounds)+C(e.secondBounds)}})(),r=n(t).div(v).mul(100);if(r.lt(.01))throw p.createValidationError(`Win chance too low`);if(r.gt(98))throw p.createValidationError(`Win chance too high`);return r},se=e=>{w(e)};var ce=class extends h{constructor(){super(`ADVANCED_DICE`)}get supportedEdgeConfigurations(){return[1,2,3,4,8]}getBetAmount(e){return e.betAmount}determineGameResult({generator:e,edge:t,gameInputs:r}){let i=w(r),a=e.getRandomInt({min:0,max:_}),o=a.value,s=(()=>{switch(r.mode){case`ROLL_BETWEEN`:return S(r.bounds,o);case`ROLL_OUTSIDE`:return!b(r.bounds,o);case`ROLL_BETWEEN_TWO`:return S(r.firstBounds,o)||S(r.secondBounds,o)}})()?g.withWinChance(t,i):new n(0);return{isFinished:!0,payout:{legs:[{amount:r.betAmount.mul(s)}]},payoutMultiplier:s,outputs:{result:a.values},randomValues:a}}},T=class{value;constructor(t){let n=s[t];e.againstNullOrUndefined(n,`Invalid card value: ${t}`),this.value=n}get suit(){let t=Math.floor(this.value/13),n=c[t];return e.againstNullOrUndefined(n,`Invalid suit index: ${t}`),n}get rank(){let t=this.value%13,n=l[t];return e.againstNullOrUndefined(n,`Invalid rank index: ${t}`),n}toDto(){return{rank:this.rank,suit:this.suit,cardValue:this.value}}};const E=e=>e.legs.reduce((e,t)=>e.add(t.amount),new t(`0`)),le=[`Clubs`,`Diamonds`,`Hearts`,`Spades`],ue=[`Ace`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`,`10`,`Jack`,`Queen`,`King`],de={Ace:`Ace`,Two:`2`,Three:`3`,Four:`4`,Five:`5`,Six:`6`,Seven:`7`,Eight:`8`,Nine:`9`,Ten:`10`,Jack:`Jack`,Queen:`Queen`,King:`King`};let fe=function(e){return e.PLAYER_WIN=`PLAYER_WIN`,e.TIE=`TIE`,e.BANKER_WIN=`BANKER_WIN`,e}({}),pe=function(e){return e.PLAYER=`PLAYER`,e.TIE=`TIE`,e.BANKER=`BANKER`,e}({});const me={PLAYER_WIN:{betType:`PLAYER`,multiplier:2},TIE:{betType:`TIE`,multiplier:9},BANKER_WIN:{betType:`BANKER`,multiplier:1.95}},D=e=>new t(0).add(e.bets.reduce((e,t)=>e.add(t.amount),new t(0))),he=(e,t)=>e===`TIE`&&(t===`PLAYER`||t===`BANKER`);var ge=class extends h{constructor(){super(`BACCARAT`)}get supportedEdgeConfigurations(){return[1]}getBetAmount(e){return D(e)}determineGameResult({generator:e,gameInputs:n}){this.validateGameInputs(n);let r=e.getRandomIntsWithReplacement({min:0,max:51,count:6}),i=r.values,a=i.slice(0,3),o=i.slice(3,6),s=[],c=0;for(let e of a.slice(0,2)){let t=this.mapRandomValueToCard(e),n=this.mapRandomValueToCardValue(e);s.push(t),c=(c+n)%10}let l=[],u=0;for(let e of o.slice(0,2)){let t=this.mapRandomValueToCard(e),n=this.mapRandomValueToCardValue(e);l.push(t),u=(u+n)%10}if(!this.isNaturalWin(c,u)){let e=this.shouldDrawThirdPlayerCard(c),t=null;e&&(t=this.mapRandomValueToCardValue(a[2]),s.push(this.mapRandomValueToCard(a[2])),c=(c+t)%10),this.shouldDrawThirdBankerCard(u,t)&&(l.push(this.mapRandomValueToCard(o[2])),u=(u+this.mapRandomValueToCardValue(o[2]))%10)}let d;d=c===u?`TIE`:c>u?`PLAYER_WIN`:`BANKER_WIN`;let f=D(n),{betType:p,multiplier:m}=me[d],h={legs:n.bets.map(e=>e.type===p?{amount:e.amount.mul(m)}:{amount:he(d,e.type)?e.amount:new t(`0`)})},g=E(h);return{isFinished:!0,payout:h,payoutMultiplier:f.gt(0)?g.div(f):new t(0),outputs:{playerCards:s,playerHandValue:c,bankerCards:l,bankerHandValue:u,gameOutcome:d,result:r.values},randomValues:r}}validateGameInputs(e){if(e.bets.length===0)throw Error(`Must place at least a single bet.`);if(!e.bets.every(e=>e.amount.gte(0)))throw Error(`Invalid bet.`)}mapRandomValueToCard(e){let t=new T(e);return{suit:t.suit,rank:de[t.rank]}}isNaturalWin(e,t){let n=[8,9];return n.includes(e)||n.includes(t)}mapRandomValueToCardValue(e){let t=e%13;return t===0?1:t>=10?10:t+1}shouldDrawThirdPlayerCard(e){return e<=5}shouldDrawThirdBankerCard(e,t){return t===null?e<=5:e<=2?!0:e===3?t!==8:e===4?[2,3,4,5,6,7].includes(t):e===5?[4,5,6,7].includes(t):e===6&&[6,7].includes(t)}};let _e=function(e){return e.WIN=`WIN`,e.LOSE=`LOSE`,e.PUSH=`PUSH`,e.PLAYER_BLACKJACK=`PLAYER_BLACKJACK`,e}({}),ve=function(e){return e.WON=`WON`,e.LOST=`LOST`,e}({}),ye=function(e){return e.START=`START`,e.HIT=`BLACKJACK_HIT`,e.STAND=`BLACKJACK_STAND`,e.BUY_INSURANCE=`BLACKJACK_BUY_INSURANCE`,e.REJECT_INSURANCE=`BLACKJACK_REJECT_INSURANCE`,e.DOUBLE_DOWN=`BLACKJACK_DOUBLE_DOWN`,e.SPLIT=`BLACKJACK_SPLIT`,e}({}),be=function(e){return e.EXACT_PAIR=`EXACT_PAIR`,e.COLORED_PAIR=`COLORED_PAIR`,e.MIXED_PAIR=`MIXED_PAIR`,e.LOSS=`LOSS`,e}({}),xe=function(e){return e.SUITED_TRIPS=`SUITED_TRIPS`,e.STRAIGHT_FLUSH=`STRAIGHT_FLUSH`,e.THREE_OF_A_KIND=`THREE_OF_A_KIND`,e.STRAIGHT=`STRAIGHT`,e.FLUSH=`FLUSH`,e.LOSS=`LOSS`,e}({});const O=2.5,Se=2,Ce=1,we=0,Te=17,Ee=21,De=21,Oe=63,k=.5,ke=3,Ae=1,je=1,Me=13,Ne=10,Pe=10,A={PLAYER_BLACKJACK:O,WIN:2,PUSH:1,LOSE:0},j={EXACT_PAIR:26,COLORED_PAIR:11,MIXED_PAIR:7,LOSS:0},M={SUITED_TRIPS:101,STRAIGHT_FLUSH:51,THREE_OF_A_KIND:31,STRAIGHT:11,FLUSH:5,LOSS:0};var N=class t extends T{get numericRank(){return u.includes(this.rank)?10:l.indexOf(this.rank)+1}static fromValue(n){return e.against(!s.includes(n),`Invalid card value: ${n}`),new t(n)}},Fe=class{cards;hardHandValue;softHandValue=null;constructor(e){this.cards=e,this.hardHandValue=e.reduce((e,t)=>e+t.numericRank,0),e.some(e=>e.rank===`Ace`)&&this.hardHandValue+10<=21&&(this.softHandValue=this.hardHandValue+10)}get cardCount(){return this.cards.length}get hasSoftHandValue(){return this.softHandValue!==null}get isBusted(){return this.hardHandValue>21}get isBlackjack(){return this.cardCount===2&&this.highestHandValue===21}get highestHandValue(){return this.softHandValue===null?this.hardHandValue:this.softHandValue}},Ie=class{cards;value;constructor(e){this.cards=e.map(e=>N.fromValue(e)),this.value=new Fe(this.cards)}get isBusted(){return this.value.isBusted}get isBlackjack(){return this.value.isBlackjack}get highestHandValue(){return this.value.highestHandValue}get rawValues(){return this.cards.map(e=>e.value)}toDto(){return{cards:this.cards.map(e=>e.toDto()),value:this.highestHandValue}}},Le=class e extends Ie{otherCards;upCard;holeCard;constructor(e,t,n=[]){super([e,t,...n]),this.otherCards=n,this.upCard=N.fromValue(e),this.holeCard=N.fromValue(t)}static withInitialDeal(t){return new e(t.upCard,t.holeCard)}addDrawnCards(t){return new e(this.upCard.value,this.holeCard.value,[...this.otherCards,...t])}toDto(e=!1){return e?super.toDto():{cards:[this.upCard.toDto()],value:new Fe([this.upCard]).highestHandValue}}},P=class e extends Ie{static withInitialDeal(t){return new e(t)}addDrawnCards(t){return new e([...this.rawValues,...t])}},Re=class t{source;index=0;constructor(e){this.source=e}static from(n,r){return e.against(r<=0,`Count must be positive, got ${r}`),e.against(n.values.length!==r,`Expected ${r} values, got ${n.values.length}`),new t(n)}get consumedValues(){return this.source.values.slice(0,this.index)}toMultipleRandomValues(){return this.source}takeOne(){let t=this.source.values[this.index];return e.againstUndefined(t,`RandomValuePool exhausted`),this.index+=1,t}take(t){e.against(this.index+t>this.source.values.length,`RandomValuePool exhausted: requested ${t} but only ${this.source.values.length-this.index} remain`);let n=this.source.values.slice(this.index,this.index+t);return this.index+=t,n}},ze=class{gameId;edge;constructor(e,t){this.gameId=e,this.edge=t,this.validateEdge(t)}play(t,n,r=[]){let a=this.createGameStore(),o=this.generateRandomValues(t),s=o.toMultipleRandomValues();for(let e of r)a.send({...e.playerArgument,randomValuePool:o});let c=r[r.length-1];c&&e.against(!i(c.state,this.toExternalState(a.getSnapshot().context.state)),`The final state of the game does not match the expected state based on the previous actions`),a.send({...n,randomValuePool:o});let l=a.getSnapshot().context;return{playerArgument:l.playerArgument,state:this.toExternalState(l.state),config:l.config,additionalBetAmount:l.additionalBetAmount,proof:{proofHash:s.proofHash,proofString:s.proofString}}}validateEdge(t){let n=this.supportedEdgeConfigurations.includes(t);e.against(!n,()=>p.createUnsupportedEdgeError(`${this.gameId} does not support ${t}% edge. Supported edge configurations include: ${this.supportedEdgeConfigurations}`))}};const Be=e=>[e.pairBonus===null?null:{amount:t(e.pairBonus.betAmount).mul(e.pairBonus.payoutMultiplier)},e.threeCardBonus===null?null:{amount:t(e.threeCardBonus.betAmount).mul(e.threeCardBonus.payoutMultiplier)}].filter(e=>e!==null),Ve=n=>{let r=n.betAmounts.mainBetAmount,i=n.actionType===`BLACKJACK_DOUBLE_DOWN`?r.mul(1):t(0),a=n.insuranceOutcome===void 0?t(0):n.insuranceStake,o=r.plus(i).mul(A[n.outcome]),s=n.insuranceOutcome===`WON`?a.mul(3):t(0),c=Be(n.sideBetResults),l=[{amount:o},...n.insuranceOutcome===void 0?[]:[{amount:s}],...c],u=E({legs:l}),d=r.plus(a).plus(i).plus(n.betAmounts.pairBonusAmount).plus(n.betAmounts.threeCardBonusAmount);e.against(d.eq(0),`Total bet amount cannot be zero`);let f=u.div(d);e.against(n.actionType===`BLACKJACK_SPLIT`,`SPLIT action type is not valid for standard multiplier calculation`);let p;switch(n.actionType){case`BLACKJACK_DOUBLE_DOWN`:p=i;break;case`BLACKJACK_BUY_INSURANCE`:p=n.insuranceStake;break;case`BLACKJACK_SPLIT`:p=r.mul(1)}return{payouts:l,totalBetAmount:d,multiplier:f,additionalBetAmount:p}},He=n=>{let r=n.betAmounts.mainBetAmount,i=n.mainHandDoubledDown?r.mul(1):t(0),a=n.splitHandDoubledDown?r.mul(1):t(0),o=n.insuranceOutcome===void 0?t(0):n.insuranceStake,s=r.plus(i).mul(A[n.mainOutcome]),c=r.plus(a).mul(A[n.splitOutcome]),l=n.insuranceOutcome===`WON`?o.mul(3):t(0),u=Be(n.sideBetResults),d=[{amount:s},{amount:c},...n.insuranceOutcome===void 0?[]:[{amount:l}],...u],f=E({legs:d}),p=r.plus(r).plus(o).plus(i).plus(a).plus(n.betAmounts.pairBonusAmount).plus(n.betAmounts.threeCardBonusAmount);e.against(p.eq(0),`Total bet amount cannot be zero`);let m=f.div(p),h;switch(n.actionType){case`BLACKJACK_DOUBLE_DOWN`:h=r.mul(1);break;case`BLACKJACK_SPLIT`:h=r.mul(1)}return{payouts:d,totalBetAmount:p,multiplier:m,additionalBetAmount:h}},Ue=(e,t)=>t(e.mul(k)),F=e=>e.every(t=>t===e[0]),We=t=>{let n=[...t].sort((e,t)=>e-t);return n.every((t,r)=>{let i=n[r-1];return r===0||(e.againstUndefined(i,`Previous value cannot be undefined`),t===i+1)})},Ge={Ace:1,Two:2,Three:3,Four:4,Five:5,Six:6,Seven:7,Eight:8,Nine:9,Ten:10,Jack:11,Queen:12,King:13},Ke={...Ge,Ace:14},qe=e=>We(e.map(e=>Ge[e]))||We(e.map(e=>Ke[e])),Je=(e,t)=>{let n=N.fromValue(e),r=N.fromValue(t);return n.rank===r.rank?e===t?`EXACT_PAIR`:d[n.suit]===d[r.suit]?`COLORED_PAIR`:`MIXED_PAIR`:`LOSS`},Ye=(e,t)=>({betAmount:e,result:t,payoutMultiplier:j[t]}),Xe=(e,t,n)=>{let r=N.fromValue(e),i=N.fromValue(t),a=N.fromValue(n),o=[r.rank,i.rank,a.rank],s=F([r.suit,i.suit,a.suit]),c=F(o),l=qe(o);return F([e,t,n])?`SUITED_TRIPS`:s&&l?`STRAIGHT_FLUSH`:c?`THREE_OF_A_KIND`:l?`STRAIGHT`:s?`FLUSH`:`LOSS`},Ze=(e,t)=>({betAmount:e,result:t,payoutMultiplier:M[t]}),Qe={state:{isFinished:!1,phase:`uninitialised`,multiplier:t(0)},config:{},playerArgument:{type:`START`,mainBetAmount:`0`,pairBonusAmount:`0`,threeCardBonusAmount:`0`}},I=e=>N.fromValue(e).value;function $e(t){e.against(t.phase!==`in-progress`,`Expected a started, in-progress game state`)}function et(t){e.against(t.phase!==`awaiting-insurance`,`Expected game to be awaiting insurance decision`)}function L(t){e.against(t.phase!==`in-progress`&&t.phase!==`playing-main-hand`&&t.phase!==`playing-split-hand`,`Expected a started, in-progress game state`)}const tt=(e,t)=>{let n=t;for(;n.highestHandValue<17;)n=n.addDrawnCards([I(e.takeOne())]);return n},R=(e,t)=>{if(e.isBusted)return`LOSE`;if(t.isBusted)return`WIN`;let n=e.highestHandValue,r=t.highestHandValue;return n>r?`WIN`:n<r?`LOSE`:`PUSH`},nt=e=>e.insuranceOutcome===void 0?t(0):e.calculateStake(e.betAmounts.mainBetAmount),rt=e=>{let{payouts:t,multiplier:n,additionalBetAmount:r}=Ve({outcome:e.outcome,insuranceOutcome:e.insuranceOutcome,insuranceStake:nt(e),actionType:e.playerArgument.type,betAmounts:e.betAmounts,sideBetResults:e.sideBetResults});return{state:{isFinished:!0,phase:`finished`,playerHand:e.playerHand,dealerHand:e.dealerHand,outcome:e.outcome,payout:{legs:t},multiplier:n,randomValues:e.randomValuePool.consumedValues,insuranceOutcome:e.insuranceOutcome,sideBetResults:e.sideBetResults},config:{},playerArgument:e.playerArgument,additionalBetAmount:r}},it=e=>{let t=tt(e.randomValuePool,e.dealerHand),n=R(e.playerHand,t);return rt({...e,dealerHand:t,outcome:n})},at=e=>{let t=e.mainHand.isBusted&&e.splitHand.isBusted?e.dealerHand:tt(e.randomValuePool,e.dealerHand),n=R(e.mainHand,t),r=R(e.splitHand,t),{payouts:i,multiplier:a,additionalBetAmount:o}=He({hasSplit:!0,mainOutcome:n,splitOutcome:r,insuranceOutcome:e.insuranceOutcome,insuranceStake:nt(e),mainHandDoubledDown:e.mainHandDoubledDown,splitHandDoubledDown:e.splitHandDoubledDown,actionType:e.playerArgument.type,betAmounts:e.betAmounts,sideBetResults:e.sideBetResults});return{state:{isFinished:!0,phase:`split-finished`,mainHand:e.mainHand,splitHand:e.splitHand,dealerHand:t,mainOutcome:n,splitOutcome:r,payout:{legs:i},multiplier:a,randomValues:e.randomValuePool.consumedValues,insuranceOutcome:e.insuranceOutcome,sideBetResults:e.sideBetResults},config:{},playerArgument:e.playerArgument,additionalBetAmount:o}};var ot=class extends ze{roundInsuranceStake;constructor(e,t){super(`BLACKJACK`,e),this.roundInsuranceStake=t}get supportedEdgeConfigurations(){return[1]}generateRandomValues(e){return Re.from(e.getRandomIntsWithReplacement({min:0,max:51,count:63}),63)}toExternalState(t){let n=t.phase;switch(n){case`awaiting-insurance`:return{isFinished:!1,phase:`awaiting-insurance`,multiplier:t.multiplier,playerHand:t.playerHand.toDto(),dealerHand:t.dealerHand.toDto(!1),sideBetResults:t.sideBetResults};case`in-progress`:return{isFinished:!1,phase:`player-turn`,multiplier:t.multiplier,playerHand:t.playerHand.toDto(),dealerHand:t.dealerHand.toDto(!1),sideBetResults:t.sideBetResults};case`playing-main-hand`:return{isFinished:!1,phase:`playing-main-hand`,multiplier:t.multiplier,mainHand:t.mainHand.toDto(),splitHand:t.splitHand.toDto(),dealerHand:t.dealerHand.toDto(!1),sideBetResults:t.sideBetResults};case`playing-split-hand`:return{isFinished:!1,phase:`playing-split-hand`,multiplier:t.multiplier,mainHand:t.mainHand.toDto(),splitHand:t.splitHand.toDto(),dealerHand:t.dealerHand.toDto(!1),sideBetResults:t.sideBetResults};case`finished`:return{isFinished:!0,payout:t.payout,multiplier:t.multiplier,randomValues:t.randomValues,outcome:t.outcome,playerHand:t.playerHand.toDto(),dealerHand:t.dealerHand.toDto(!0),sideBetResults:t.sideBetResults,...t.insuranceOutcome!==void 0&&{insuranceOutcome:t.insuranceOutcome}};case`split-finished`:return{isFinished:!0,payout:t.payout,multiplier:t.multiplier,randomValues:t.randomValues,mainOutcome:t.mainOutcome,splitOutcome:t.splitOutcome,mainHand:t.mainHand.toDto(),splitHand:t.splitHand.toDto(),dealerHand:t.dealerHand.toDto(!0),sideBetResults:t.sideBetResults,...t.insuranceOutcome!==void 0&&{insuranceOutcome:t.insuranceOutcome}};case`uninitialised`:throw Error(`Cannot convert uninitialised state to external state`);default:e.againstNever(n,`Invalid state received`)}}createGameStore(){let n=t=>{let n=Ue(t,this.roundInsuranceStake);return e.against(t.gt(0)&&n.eq(0),`Insurance stake rounds below the smallest unit this currency supports`),n},i=e=>rt({...e,calculateStake:n}),a=e=>it({...e,calculateStake:n}),o=e=>at({...e,calculateStake:n});return r({context:Qe,on:{START:(n,r)=>{let{state:a}=n;e.against(a.phase!==`uninitialised`,`START action requires a fresh game`);let o=I(r.randomValuePool.takeOne()),s=I(r.randomValuePool.takeOne()),c=I(r.randomValuePool.takeOne()),l=I(r.randomValuePool.takeOne()),u=P.withInitialDeal([o,s]),d=Le.withInitialDeal({upCard:c,holeCard:l}),f={mainBetAmount:t(r.mainBetAmount),pairBonusAmount:t(r.pairBonusAmount),threeCardBonusAmount:t(r.threeCardBonusAmount)},p={pairBonus:t(r.pairBonusAmount).gt(0)?Ye(r.pairBonusAmount,Je(o,s)):null,threeCardBonus:t(r.threeCardBonusAmount).gt(0)?Ze(r.threeCardBonusAmount,Xe(o,s,c)):null},m={type:`START`,mainBetAmount:r.mainBetAmount,pairBonusAmount:r.pairBonusAmount,threeCardBonusAmount:r.threeCardBonusAmount};if(d.upCard.rank===`Ace`)return{state:{...a,isFinished:!1,phase:`awaiting-insurance`,playerHand:u,dealerHand:d,betAmounts:f,sideBetResults:p},config:{},playerArgument:m};let h={playerHand:u,dealerHand:d,randomValuePool:r.randomValuePool,playerArgument:m,betAmounts:f,sideBetResults:p};return u.isBlackjack&&d.isBlackjack?i({...h,outcome:`PUSH`}):u.isBlackjack?i({...h,outcome:`PLAYER_BLACKJACK`}):d.isBlackjack?i({...h,outcome:`LOSE`}):{state:{...a,isFinished:!1,phase:`in-progress`,playerHand:u,dealerHand:d,insuranceOutcome:void 0,betAmounts:f,sideBetResults:p},config:{},playerArgument:m}},BLACKJACK_BUY_INSURANCE:(e,t)=>{let{state:r}=e;et(r);let{playerHand:a,dealerHand:o,betAmounts:s,sideBetResults:c}=r,l={...r,randomValuePool:t.randomValuePool,playerArgument:{type:`BLACKJACK_BUY_INSURANCE`},betAmounts:s,sideBetResults:c};return a.isBlackjack&&o.isBlackjack?i({...l,outcome:`PUSH`,insuranceOutcome:`WON`}):a.isBlackjack?i({...l,outcome:`PLAYER_BLACKJACK`,insuranceOutcome:`LOST`}):o.isBlackjack?i({...l,outcome:`LOSE`,insuranceOutcome:`WON`}):{state:{...r,phase:`in-progress`,insuranceOutcome:`LOST`},config:{},playerArgument:{type:`BLACKJACK_BUY_INSURANCE`},additionalBetAmount:n(s.mainBetAmount)}},BLACKJACK_REJECT_INSURANCE:(e,t)=>{let{state:n}=e;et(n);let{playerHand:r,dealerHand:a,betAmounts:o,sideBetResults:s}=n,c={playerHand:r,dealerHand:a,randomValuePool:t.randomValuePool,playerArgument:{type:`BLACKJACK_REJECT_INSURANCE`},betAmounts:o,sideBetResults:s};return r.isBlackjack&&a.isBlackjack?i({...c,outcome:`PUSH`}):r.isBlackjack?i({...c,outcome:`PLAYER_BLACKJACK`}):a.isBlackjack?i({...c,outcome:`LOSE`}):{state:{...n,phase:`in-progress`,insuranceOutcome:void 0},config:{},playerArgument:{type:`BLACKJACK_REJECT_INSURANCE`}}},BLACKJACK_HIT:(t,n)=>{let{state:r}=t;switch(L(r),r.phase){case`playing-main-hand`:{let e=r.mainHand.addDrawnCards([I(n.randomValuePool.takeOne())]);return e.isBusted||e.highestHandValue===21?r.splitHand.highestHandValue===21?o({...r,mainHand:e,splitHandDoubledDown:!1,randomValuePool:n.randomValuePool,playerArgument:{type:`BLACKJACK_HIT`}}):{state:{...r,phase:`playing-split-hand`,mainHand:e,splitHandDoubledDown:!1},config:{},playerArgument:{type:`BLACKJACK_HIT`}}:{state:{...r,mainHand:e},config:{},playerArgument:{type:`BLACKJACK_HIT`}}}case`playing-split-hand`:{let e=r.splitHand.addDrawnCards([I(n.randomValuePool.takeOne())]);return e.isBusted||e.highestHandValue===21?o({...r,splitHand:e,randomValuePool:n.randomValuePool,playerArgument:{type:`BLACKJACK_HIT`}}):{state:{...r,splitHand:e},config:{},playerArgument:{type:`BLACKJACK_HIT`}}}case`in-progress`:{let e=r.playerHand.addDrawnCards([I(n.randomValuePool.takeOne())]);return e.isBusted?i({...r,playerHand:e,outcome:`LOSE`,randomValuePool:n.randomValuePool,playerArgument:{type:`BLACKJACK_HIT`}}):e.highestHandValue===21?a({...r,playerHand:e,randomValuePool:n.randomValuePool,playerArgument:{type:`BLACKJACK_HIT`}}):{state:{...r,phase:`in-progress`,playerHand:e},config:{},playerArgument:{type:`BLACKJACK_HIT`}}}default:e.againstNever(r,`Invalid phase for HIT action`)}},BLACKJACK_STAND:(t,n)=>{let{state:r}=t;switch(L(r),r.phase){case`playing-main-hand`:return r.splitHand.highestHandValue===21?o({...r,splitHandDoubledDown:!1,randomValuePool:n.randomValuePool,playerArgument:{type:`BLACKJACK_STAND`}}):{state:{...r,phase:`playing-split-hand`,splitHandDoubledDown:!1},config:{},playerArgument:{type:`BLACKJACK_STAND`}};case`playing-split-hand`:return o({...r,splitHandDoubledDown:r.splitHandDoubledDown,randomValuePool:n.randomValuePool,playerArgument:{type:`BLACKJACK_STAND`}});case`in-progress`:return a({...r,randomValuePool:n.randomValuePool,playerArgument:{type:`BLACKJACK_STAND`}});default:e.againstNever(r,`Invalid phase for STAND action`)}},BLACKJACK_DOUBLE_DOWN:(t,n)=>{let{state:r}=t;switch(L(r),r.phase){case`playing-main-hand`:{e.against(r.mainHand.cards.length!==2,`Double down is only allowed as the first action`);let t=r.mainHand.addDrawnCards([I(n.randomValuePool.takeOne())]),{betAmounts:i}=r;return r.splitHand.highestHandValue===21?o({...r,mainHand:t,mainHandDoubledDown:!0,splitHandDoubledDown:!1,randomValuePool:n.randomValuePool,playerArgument:{type:`BLACKJACK_DOUBLE_DOWN`}}):{state:{...r,phase:`playing-split-hand`,mainHand:t,mainHandDoubledDown:!0,splitHandDoubledDown:!1},config:{},playerArgument:{type:`BLACKJACK_DOUBLE_DOWN`},additionalBetAmount:i.mainBetAmount.mul(1)}}case`playing-split-hand`:{e.against(r.splitHand.cards.length!==2,`Double down is only allowed as the first action`);let t=r.splitHand.addDrawnCards([I(n.randomValuePool.takeOne())]);return o({...r,splitHand:t,randomValuePool:n.randomValuePool,playerArgument:{type:`BLACKJACK_DOUBLE_DOWN`},splitHandDoubledDown:!0})}case`in-progress`:{e.against(r.playerHand.cards.length!==2,`Double down is only allowed as the first action`);let t=r.playerHand.addDrawnCards([I(n.randomValuePool.takeOne())]);return t.isBusted?i({...r,playerHand:t,outcome:`LOSE`,randomValuePool:n.randomValuePool,playerArgument:{type:`BLACKJACK_DOUBLE_DOWN`}}):a({...r,playerHand:t,randomValuePool:n.randomValuePool,playerArgument:{type:`BLACKJACK_DOUBLE_DOWN`}})}default:e.againstNever(r,`Invalid phase for DOUBLE_DOWN action`)}},BLACKJACK_SPLIT:(n,r)=>{let{state:i}=n;$e(i);let{playerHand:a,betAmounts:s,sideBetResults:c}=i;e.against(a.cards.length!==2,`Split is only allowed with exactly 2 cards`);let l=a.cards[0],u=a.cards[1];e.againstUndefined(l,`First card is missing`),e.againstUndefined(u,`Second card is missing`),e.against(l.rank!==u.rank,`Split requires two cards of the same rank`);let d=I(r.randomValuePool.takeOne()),f=I(r.randomValuePool.takeOne()),p=P.withInitialDeal([l.value,d]),m=P.withInitialDeal([u.value,f]);if(l.rank===`Ace`)return o({...i,mainHand:p,splitHand:m,randomValuePool:r.randomValuePool,playerArgument:{type:`BLACKJACK_SPLIT`},mainHandDoubledDown:!1,splitHandDoubledDown:!1});let h=p.highestHandValue===21,g=m.highestHandValue===21;return h&&g?o({mainHand:p,splitHand:m,dealerHand:i.dealerHand,randomValuePool:r.randomValuePool,playerArgument:{type:`BLACKJACK_SPLIT`},insuranceOutcome:i.insuranceOutcome,mainHandDoubledDown:!1,splitHandDoubledDown:!1,betAmounts:s,sideBetResults:c}):h?{state:{...i,phase:`playing-split-hand`,mainHand:p,splitHand:m,mainHandDoubledDown:!1,splitHandDoubledDown:!1},config:{},playerArgument:{type:`BLACKJACK_SPLIT`},additionalBetAmount:s.mainBetAmount.mul(1)}:{state:{...i,phase:`playing-main-hand`,multiplier:t(0),mainHand:p,splitHand:m,mainHandDoubledDown:!1},config:{},playerArgument:{type:`BLACKJACK_SPLIT`},additionalBetAmount:s.mainBetAmount.mul(1)}}}})}getValidNextActionTypes(t){if(t.isFinished)return[];switch(t.phase){case`awaiting-insurance`:return[`BLACKJACK_BUY_INSURANCE`,`BLACKJACK_REJECT_INSURANCE`];case`playing-main-hand`:{let e=[`BLACKJACK_HIT`,`BLACKJACK_STAND`];return t.mainHand.cards.length===2&&e.push(`BLACKJACK_DOUBLE_DOWN`),e}case`playing-split-hand`:{let e=[`BLACKJACK_HIT`,`BLACKJACK_STAND`];return t.splitHand.cards.length===2&&e.push(`BLACKJACK_DOUBLE_DOWN`),e}case`player-turn`:{let n=[`BLACKJACK_HIT`,`BLACKJACK_STAND`];if(t.playerHand.cards.length===2){n.push(`BLACKJACK_DOUBLE_DOWN`);let r=t.playerHand.cards[0],i=t.playerHand.cards[1];e.againstUndefined(r,`First player card is missing`),e.againstUndefined(i,`Second player card is missing`),r.rank===i.rank&&n.push(`BLACKJACK_SPLIT`)}return n}default:e.againstNever(t,`Invalid phase for getting valid actions`)}}};const st=0,ct=51,lt=52,ut=52,dt=()=>({minPicks:5,maxPicks:36}),ft=e=>e.length===new Set(e).size,pt=e=>{let n=t(1),r=t(52);for(let i=0;i<e;i+=1)n=n.mul(t(52-i).div(r));return n};var mt=class extends h{constructor(){super(`BLITZ`)}get supportedEdgeConfigurations(){return[2]}getBetAmount(e){return e.betAmount}determineGameResult({generator:n,gameInputs:r,edge:i}){e.against(r.pickCount<1||r.pickCount>52,`pickCount must be between 1 and 52`),e.againstNonInteger(r.pickCount,`pickCount must be an integer`);let a=n.getRandomIntsWithReplacement({min:0,max:51,count:52}),o=a.values.slice(0,r.pickCount),s=ft(o),c=pt(r.pickCount),l=s?g.withMultiplier(t(1).div(c),i):t(0);return{isFinished:!0,payout:{legs:[{amount:r.betAmount.mul(l)}]},payoutMultiplier:l,outputs:{result:a.values,cards:o.map(e=>new T(e).toDto())},randomValues:a}}};const ht=0,gt=4294967295;let _t=function(e){return e.EASY=`EASY`,e.MEDIUM=`MEDIUM`,e.HARD=`HARD`,e.EXPERT=`EXPERT`,e}({});const vt={distanceBoundaries:{bullseye:67108864,ringOne:1299227607,ringTwo:2415919104,ringThree:3478923509},multipliers:{bullseye:8.5,ringOne:.5,ringTwo:.8,ringThree:{YELLOW:1.2,ORANGE:1.5,RED:2.7},ringFour:.5},segments:[`YELLOW`,`ORANGE`,`YELLOW`,`RED`,`YELLOW`,`ORANGE`,`YELLOW`,`RED`,`YELLOW`,`ORANGE`,`YELLOW`,`RED`,`YELLOW`,`ORANGE`,`YELLOW`,`ORANGE`,`YELLOW`,`RED`]},yt={distanceBoundaries:{bullseye:42949673,ringOne:869730878,ringTwo:2104533975,ringThree:2748779069},multipliers:{bullseye:16,ringOne:.4,ringTwo:.6,ringThree:{YELLOW:1.3,ORANGE:3.1,RED:6},ringFour:.4},segments:[`YELLOW`,`ORANGE`,`YELLOW`,`RED`,`YELLOW`,`ORANGE`,`YELLOW`,`RED`,`YELLOW`,`ORANGE`,`YELLOW`,`RED`,`YELLOW`,`ORANGE`,`YELLOW`,`ORANGE`,`YELLOW`,`RED`]},bt={distanceBoundaries:{bullseye:15461883,ringOne:687194768,ringTwo:1870887754,ringThree:2415919104},multipliers:{bullseye:63,ringOne:.2,ringTwo:.5,ringThree:{YELLOW:2.5,ORANGE:3.6,RED:8.8},ringFour:.2},segments:[`YELLOW`,`ORANGE`,`YELLOW`,`ORANGE`,`YELLOW`,`RED`,`YELLOW`,`ORANGE`,`YELLOW`,`ORANGE`,`YELLOW`,`RED`,`YELLOW`,`ORANGE`,`YELLOW`,`ORANGE`,`YELLOW`,`RED`]},xt={distanceBoundaries:{bullseye:1717987,ringOne:1073741824,ringTwo:2165093014,ringThree:2415919104},multipliers:{bullseye:500,ringOne:.1,ringTwo:.5,ringThree:{YELLOW:4.8,ORANGE:9.6,RED:42},ringFour:.1},segments:[`YELLOW`,`ORANGE`,`YELLOW`,`YELLOW`,`RED`,`YELLOW`,`YELLOW`,`ORANGE`,`YELLOW`,`YELLOW`,`ORANGE`,`YELLOW`,`YELLOW`,`RED`,`YELLOW`,`YELLOW`,`ORANGE`,`YELLOW`]},St=e=>{let t=z[e];return[t.multipliers.bullseye,t.multipliers.ringOne,t.multipliers.ringTwo,...Object.values(t.multipliers.ringThree),t.multipliers.ringFour].reduce((e,t)=>t>e?t:e)},z={EASY:vt,MEDIUM:yt,HARD:bt,EXPERT:xt};var Ct=class extends h{constructor(){super(`DARTS`)}get supportedEdgeConfigurations(){return[2]}getBetAmount(e){return e.betAmount}determineGameResult({generator:n,gameInputs:r}){let i=n.getRandomIntsWithReplacement({min:0,max:gt,count:2}),a=i.values[0],o=i.values[1];e.againstUndefined(a,`Random number generator returned no value for clockWiseRotation`),e.againstUndefined(o,`Random number generator returned no value for distanceFromCentre`);let s=r.difficultyLevel,c=t(wt(s,a,o));return{isFinished:!0,payout:{legs:[{amount:r.betAmount.mul(c)}]},payoutMultiplier:c,outputs:{result:i.values},randomValues:i}}};const wt=(e,t,n)=>{let r=z[e],{distanceBoundaries:i,multipliers:a}=r;return n<i.bullseye?a.bullseye:n<i.ringOne?a.ringOne:n<i.ringTwo?a.ringTwo:n<i.ringThree?Tt(r,t):a.ringFour},Tt=(t,n)=>{let r=t.segments.length,i=Math.floor(n/4294967296*r),a=t.segments[i];return e.againstUndefined(a,`Segment index ${i} out of bounds`),t.multipliers.ringThree[a]};var B=class{multipliers;constructor(e){this.multipliers=e}getMultipliers(e){let t=this.multipliers.get(e);if(t===void 0)throw Error(`Multipliers for ${e} not found`);return t}getAllMultipliers(){return Array.from(this.multipliers.entries()).map(([e,t])=>({edge:e,multipliers:t}))}};let Et=function(e){return e.PAIR=`PAIR`,e.TWO_PAIR=`TWO_PAIR`,e.THREE_OF_A_KIND=`THREE_OF_A_KIND`,e.FULL_HOUSE=`FULL_HOUSE`,e.FOUR_OF_A_KIND=`FOUR_OF_A_KIND`,e.FIVE_OF_A_KIND=`FIVE_OF_A_KIND`,e}({});const Dt=new B(new Map([[1,{PAIR:.1,TWO_PAIR:2,THREE_OF_A_KIND:3,FULL_HOUSE:4.3,FOUR_OF_A_KIND:5,FIVE_OF_A_KIND:50}],[2,{PAIR:.1,TWO_PAIR:2,THREE_OF_A_KIND:3,FULL_HOUSE:4,FOUR_OF_A_KIND:4.8,FIVE_OF_A_KIND:50}],[3,{PAIR:.1,TWO_PAIR:2,THREE_OF_A_KIND:3,FULL_HOUSE:3.7,FOUR_OF_A_KIND:4.6,FIVE_OF_A_KIND:50}],[4,{PAIR:.1,TWO_PAIR:2,THREE_OF_A_KIND:3,FULL_HOUSE:3.4,FOUR_OF_A_KIND:4.4,FIVE_OF_A_KIND:50}],[8,{PAIR:.1,TWO_PAIR:2,THREE_OF_A_KIND:2.8,FULL_HOUSE:3.2,FOUR_OF_A_KIND:3.6,FIVE_OF_A_KIND:50}]])),Ot={2:`PAIR`,3:`THREE_OF_A_KIND`,4:`FOUR_OF_A_KIND`,5:`FIVE_OF_A_KIND`};var kt=class extends h{constructor(){super(`DIAMONDS`)}get supportedEdgeConfigurations(){return[1,2,3,4,8]}getBetAmount(e){return e.betAmount}determineGameResult({generator:e,edge:n,gameInputs:r}){let i=e.getRandomIntsWithReplacement({min:0,max:6,count:5}),a=Dt.getMultipliers(n),o=i.values,s=t(this.calculatePayoutMultiplier(a,o));return{isFinished:!0,payout:{legs:[{amount:r.betAmount.mul(s)}]},payoutMultiplier:s,outputs:{result:i.values},randomValues:i}}calculatePayoutMultiplier(e,t){let n=new Map;for(let e of t){let t=n.get(e)||0;n.set(e,t+1)}let r=[...n.values()].filter(e=>e>1),i=this.classifyResult(r);return i===null?0:e[i]}classifyResult(e){if(e.length>2)throw Error(`Unexpected number of repeats ${e.length}`);let[t,n]=e;if(t===void 0)return null;if(n===void 0){let e=Ot[t];if(e===void 0)throw Error(`Unexpected single diamond repeat count: ${t}`);return e}return t===3||n===3?`FULL_HOUSE`:`TWO_PAIR`}};let At=function(e){return e.ABOVE=`ABOVE`,e.BELOW=`BELOW`,e}({});const jt=0,V=1e4,Mt=10001,Nt=e=>{let n=e.direction===`ABOVE`?V-e.selectedValue:e.selectedValue;return new t(n).div(Mt).mul(100)},Pt=(e,t)=>e.direction===`ABOVE`?t>e.selectedValue:t<e.selectedValue;var Ft=class extends h{constructor(){super(`DICE`)}get supportedEdgeConfigurations(){return[1,2,3,4,8]}getBetAmount(e){return e.betAmount}determineGameResult({generator:e,edge:n,gameInputs:r}){let i=e.getRandomInt({min:0,max:V}),a=Nt(r),o=Pt(r,i.value)?g.withWinChance(n,a):new t(0);return{isFinished:!0,payout:{legs:[{amount:r.betAmount.mul(o)}]},payoutMultiplier:o,outputs:{result:i.values},randomValues:i}}};let It=function(e){return e.CLASSIC=`CLASSIC`,e.LOW_RISK=`LOW_RISK`,e.MEDIUM_RISK=`MEDIUM_RISK`,e.HIGH_RISK=`HIGH_RISK`,e}({});const Lt=[1,2,3,4,5,6,7,8,9,10],Rt=e=>Lt.includes(e),zt={1:{CLASSIC:[0,3.96],LOW_RISK:[.7,1.85],MEDIUM_RISK:[.4,2.75],HIGH_RISK:[0,3.96]},2:{CLASSIC:[0,1.9,4.5],LOW_RISK:[0,2,3.8],MEDIUM_RISK:[0,1.8,5.1],HIGH_RISK:[0,0,17.1]},3:{CLASSIC:[0,1,3.1,10.4],LOW_RISK:[0,1.1,1.38,26],MEDIUM_RISK:[0,0,2.8,50],HIGH_RISK:[0,0,0,81.5]},4:{CLASSIC:[0,.8,1.8,5,22.5],LOW_RISK:[0,0,2.2,7.9,90],MEDIUM_RISK:[0,0,1.7,10,100],HIGH_RISK:[0,0,0,10,259]},5:{CLASSIC:[0,.25,1.4,4.1,16.5,36],LOW_RISK:[0,0,1.5,4.2,13,300],MEDIUM_RISK:[0,0,1.4,4,14,390],HIGH_RISK:[0,0,0,4.5,48,450]},6:{CLASSIC:[0,0,1,3.68,7,16.5,40],LOW_RISK:[0,0,1.1,2,6.2,100,700],MEDIUM_RISK:[0,0,0,3,9,180,710],HIGH_RISK:[0,0,0,0,11,350,710]},7:{CLASSIC:[0,0,.47,3,4.5,14,31,60],LOW_RISK:[0,0,1.1,1.6,3.5,15,225,700],MEDIUM_RISK:[0,0,0,2,7,30,400,800],HIGH_RISK:[0,0,0,0,7,90,400,800]},8:{CLASSIC:[0,0,0,2.2,4,13,22,55,70],LOW_RISK:[0,0,1.1,1.5,2,5.5,39,100,800],MEDIUM_RISK:[0,0,0,2,4,11,67,400,900],HIGH_RISK:[0,0,0,0,5,20,270,600,900]},9:{CLASSIC:[0,0,0,1.55,3,8,15,44,60,85],LOW_RISK:[0,0,1.1,1.3,1.7,2.5,7.5,50,250,1e3],MEDIUM_RISK:[0,0,0,2,2.5,5,15,100,500,1e3],HIGH_RISK:[0,0,0,0,4,11,56,500,800,1e3]},10:{CLASSIC:[0,0,0,1.4,2.25,4.5,8,17,50,80,100],LOW_RISK:[0,0,1.1,1.2,1.3,1.8,3.5,13,50,250,1e3],MEDIUM_RISK:[0,0,0,1.6,2,4,7,26,100,500,1e3],HIGH_RISK:[0,0,0,0,3.5,8,13,63,500,800,1e3]}},Bt={1:{CLASSIC:[0,3.92],LOW_RISK:[.7,1.82],MEDIUM_RISK:[.4,2.72],HIGH_RISK:[0,3.92]},2:{CLASSIC:[0,1.9,4.32],LOW_RISK:[0,2,3.65],MEDIUM_RISK:[0,1.8,5],HIGH_RISK:[0,0,17]},3:{CLASSIC:[0,1,3,10.7],LOW_RISK:[0,1.1,1.3,26.2],MEDIUM_RISK:[0,0,2.7,50.3],HIGH_RISK:[0,0,0,80.7]},4:{CLASSIC:[0,.8,1.8,4.75,22.5],LOW_RISK:[0,0,2.2,7.65,90],MEDIUM_RISK:[0,0,1.7,9.8,100],HIGH_RISK:[0,0,0,9.75,259]},5:{CLASSIC:[0,.2,1.4,4.25,16.4,36],LOW_RISK:[0,0,1.5,4.1,12.9,300],MEDIUM_RISK:[0,0,1.4,3.9,13.9,390],HIGH_RISK:[0,0,0,4.5,47,450]},6:{CLASSIC:[0,0,1,3.6,7,17,40],LOW_RISK:[0,0,1.1,2,5.8,100,700],MEDIUM_RISK:[0,0,0,3,8.6,180,710],HIGH_RISK:[0,0,0,0,10.6,350,710]},7:{CLASSIC:[0,0,.5,3,4.1,13.7,31,60],LOW_RISK:[0,0,1.1,1.6,3.5,13.5,225,700],MEDIUM_RISK:[0,0,0,2,6.9,29.2,400,800],HIGH_RISK:[0,0,0,0,6.9,89.1,400,800]},8:{CLASSIC:[0,0,0,2.2,4,12.2,22,55,70],LOW_RISK:[0,0,1.1,1.5,2,4.8,38,100,800],MEDIUM_RISK:[0,0,0,2,4,10.4,66,400,900],HIGH_RISK:[0,0,0,0,4.9,19.8,270,600,900]},9:{CLASSIC:[0,0,0,1.5,3,8.1,15,45,60,85],LOW_RISK:[0,0,1.1,1.3,1.7,2.1,7.4,50,250,1e3],MEDIUM_RISK:[0,0,0,2,2.5,4.6,15.2,100,500,1e3],HIGH_RISK:[0,0,0,0,4,10.7,55.4,500,800,1e3]},10:{CLASSIC:[0,0,0,1.4,2.2,4.5,7.6,16,50,80,100],LOW_RISK:[0,0,1.1,1.2,1.3,1.6,3.7,13,50,250,1e3],MEDIUM_RISK:[0,0,0,1.6,2,3.8,6.8,26,100,500,1e3],HIGH_RISK:[0,0,0,0,3.5,7.8,12.8,63,500,800,1e3]}},Vt={1:{CLASSIC:[0,3.88],LOW_RISK:[.7,1.78],MEDIUM_RISK:[.4,2.68],HIGH_RISK:[0,3.88]},2:{CLASSIC:[0,1.85,4.48],LOW_RISK:[0,2,3.48],MEDIUM_RISK:[0,1.8,4.8],HIGH_RISK:[0,0,16.8]},3:{CLASSIC:[0,1,3,9.9],LOW_RISK:[0,1.1,1.2,26.5],MEDIUM_RISK:[0,0,2.65,50],HIGH_RISK:[0,0,0,79.9]},4:{CLASSIC:[0,.8,1.7,5,23],LOW_RISK:[0,0,2.1,7.95,90],MEDIUM_RISK:[0,0,1.7,9.55,100],HIGH_RISK:[0,0,0,9.5,259]},5:{CLASSIC:[0,.2,1.4,4.1,16.6,36],LOW_RISK:[0,0,1.5,4,12.7,300],MEDIUM_RISK:[0,0,1.4,3.8,13.7,390],HIGH_RISK:[0,0,0,4.4,46.9,450]},6:{CLASSIC:[0,0,1,3.6,6.6,16.5,40],LOW_RISK:[0,0,1.1,1.9,5.9,100,700],MEDIUM_RISK:[0,0,0,2.9,8.7,180,710],HIGH_RISK:[0,0,0,0,10.8,342,710]},7:{CLASSIC:[0,0,.5,2.9,4.3,13.5,30.4,60],LOW_RISK:[0,0,1.1,1.6,3.1,14.8,225,700],MEDIUM_RISK:[0,0,0,2,6.7,29,400,800],HIGH_RISK:[0,0,0,0,6.8,88.2,400,800]},8:{CLASSIC:[0,0,0,2.2,3.8,12.7,21,54,70],LOW_RISK:[0,0,1.1,1.5,1.8,5.2,38,100,800],MEDIUM_RISK:[0,0,0,2,3.8,10.8,66,400,900],HIGH_RISK:[0,0,0,0,4.9,19.5,265,600,900]},9:{CLASSIC:[0,0,0,1.5,2.9,8.2,15,43,60,85],LOW_RISK:[0,0,1.1,1.3,1.6,2.1,7.7,49,250,1e3],MEDIUM_RISK:[0,0,0,2,2.4,4.7,15,98,500,1e3],HIGH_RISK:[0,0,0,0,3.9,10.8,55,500,800,1e3]},10:{CLASSIC:[0,0,0,1.4,2.2,4.2,8,16.7,50,80,100],LOW_RISK:[0,0,1.1,1.2,1.3,1.5,2.9,12,50,250,1e3],MEDIUM_RISK:[0,0,0,1.6,2,3.6,6.6,26,100,500,1e3],HIGH_RISK:[0,0,0,0,3.4,7.9,12.9,62,500,800,1e3]}},Ht={1:{CLASSIC:[0,3.84],LOW_RISK:[.69,1.77],MEDIUM_RISK:[.38,2.7],HIGH_RISK:[0,3.84]},2:{CLASSIC:[0,1.83,4.44],LOW_RISK:[0,1.98,3.44],MEDIUM_RISK:[0,1.78,4.77],HIGH_RISK:[0,0,16.64]},3:{CLASSIC:[0,.98,3,9.8],LOW_RISK:[0,1.09,1.19,26.15],MEDIUM_RISK:[0,0,2.6,49.8],HIGH_RISK:[0,0,0,79]},4:{CLASSIC:[0,.79,1.68,5,22.7],LOW_RISK:[0,0,2.1,7.8,88.3],MEDIUM_RISK:[0,0,1.66,9.5,100],HIGH_RISK:[0,0,0,9.25,259]},5:{CLASSIC:[0,.19,1.39,4.1,16.3,35.5],LOW_RISK:[0,0,1.47,4,12.5,300],MEDIUM_RISK:[0,0,1.37,3.8,13.5,390],HIGH_RISK:[0,0,0,4.3,46.6,450]},6:{CLASSIC:[0,0,.98,3.6,6.5,15.9,39.9],LOW_RISK:[0,0,1.08,1.89,5.8,100,700],MEDIUM_RISK:[0,0,0,2.9,8.35,180,710],HIGH_RISK:[0,0,0,0,10.4,342,710]},7:{CLASSIC:[0,0,.47,2.9,4.3,13.5,30.4,60],LOW_RISK:[0,0,1.08,1.59,3.1,14.6,225,700],MEDIUM_RISK:[0,0,0,1.98,6.6,28.7,400,800],HIGH_RISK:[0,0,0,0,6.7,87.3,400,800]},8:{CLASSIC:[0,0,0,2.2,3.7,12.5,21,54,70],LOW_RISK:[0,0,1.09,1.49,1.77,5.1,37.5,100,800],MEDIUM_RISK:[0,0,0,1.96,3.8,10.7,65.8,400,900],HIGH_RISK:[0,0,0,0,4.9,18.8,265,600,900]},9:{CLASSIC:[0,0,0,1.47,2.9,8.1,14.9,43,60,85],LOW_RISK:[0,0,1.09,1.28,1.59,2.1,7.6,48.4,250,1e3],MEDIUM_RISK:[0,0,0,1.97,2.4,4.6,15,97.1,500,1e3],HIGH_RISK:[0,0,0,0,3.8,10.8,55,500,800,1e3]},10:{CLASSIC:[0,0,0,1.37,2.2,4.2,7.8,16.5,49.2,80,100],LOW_RISK:[0,0,1.08,1.19,1.3,1.47,2.9,12,50,250,1e3],MEDIUM_RISK:[0,0,0,1.58,1.98,3.6,6.4,26,100,500,1e3],HIGH_RISK:[0,0,0,0,3.4,7.7,12.7,61.9,500,800,1e3]}},Ut={1:{CLASSIC:[0,3.68],LOW_RISK:[.7,1.58],MEDIUM_RISK:[.4,2.48],HIGH_RISK:[0,3.68]},2:{CLASSIC:[0,1.72,4.48],LOW_RISK:[0,1.9,3.28],MEDIUM_RISK:[0,1.7,4.62],HIGH_RISK:[0,0,15.95]},3:{CLASSIC:[0,.9,2.95,9.9],LOW_RISK:[0,1,1.2,26],MEDIUM_RISK:[0,0,2.29,50],HIGH_RISK:[0,0,0,75.7]},4:{CLASSIC:[0,.8,1.6,4.4,21],LOW_RISK:[0,0,2,7.5,86],MEDIUM_RISK:[0,0,1.5,9.5,98],HIGH_RISK:[0,0,0,9,246]},5:{CLASSIC:[0,.2,1.2,4.2,16.3,37],LOW_RISK:[0,0,1.4,3.8,12,300],MEDIUM_RISK:[0,0,1.3,3.5,14,385],HIGH_RISK:[0,0,0,4,45,450]},6:{CLASSIC:[0,0,1,3.3,6.2,15,40],LOW_RISK:[0,0,1.1,1.7,4.9,99,700],MEDIUM_RISK:[0,0,0,2.6,8.5,177,705],HIGH_RISK:[0,0,0,0,10,327,710]},7:{CLASSIC:[0,0,.4,2.8,4.2,14.5,30,60],LOW_RISK:[0,0,1.1,1.4,3,14,210,700],MEDIUM_RISK:[0,0,0,1.8,6.4,29,400,800],HIGH_RISK:[0,0,0,0,6.1,85,400,800]},8:{CLASSIC:[0,0,0,2,3.7,13,20,50,70],LOW_RISK:[0,0,1.1,1.4,1.6,4.6,35,90,800],MEDIUM_RISK:[0,0,0,1.9,3.5,10.5,65,400,900],HIGH_RISK:[0,0,0,0,4.5,18,265,600,900]},9:{CLASSIC:[0,0,0,1.4,2.6,9,11.5,40,60,85],LOW_RISK:[0,0,1,1.3,1.5,2,7,45,250,1e3],MEDIUM_RISK:[0,0,0,2,2.1,4,15,98,500,1e3],HIGH_RISK:[0,0,0,0,3.5,10.5,55,500,800,1e3]},10:{CLASSIC:[0,0,0,1.3,2,4.4,8,16.7,50,80,100],LOW_RISK:[0,0,1,1.2,1.25,1.4,2,10,50,250,1e3],MEDIUM_RISK:[0,0,0,1.5,1.9,3.5,6.2,26,100,500,1e3],HIGH_RISK:[0,0,0,0,3,8,14,57,500,800,1e3]}},Wt=new B(new Map([[1,zt],[2,Bt],[3,Vt],[4,Ht],[8,Ut]]));var Gt=class extends h{constructor(){super(`KENO`)}get supportedEdgeConfigurations(){return[1,2,3,4,8]}getBetAmount(e){return e.betAmount}determineGameResult({generator:n,edge:r,gameInputs:i}){e.againstEmptyArray(i.selectedNumbers,()=>p.createValidationError(`No numbers selected`)),e.against(i.selectedNumbers.length>10,()=>p.createValidationError(`Maximum of 10 numbers can be selected`));for(let t of i.selectedNumbers)e.againstNonInteger(t,()=>p.createValidationError(`Only integers can be selected`)),e.against(t<0||t>39,()=>p.createValidationError(`Invalid number selected`));let a=n.getUniqueRandomInts({min:0,max:39,count:10}),o=i.selectedNumbers.filter(e=>a.values.includes(e)),s=i.selectedNumbers.length;if(!Rt(s))throw Error(`Invalid tile count: ${s}`);let c=Wt.getMultipliers(r)[s][i.riskLevel][o.length];if(c===void 0)throw Error(`No multiplier found for matching tile count ${o.length}`);let l=new t(c);return{isFinished:!0,payout:{legs:[{amount:i.betAmount.mul(l)}]},payoutMultiplier:l,outputs:{result:a.values},randomValues:a}}};const Kt=(e,t)=>e.gt(t)?e:t,qt=(e,t)=>e.lt(t)?e:t;var Jt=class extends h{constructor(){super(`LIMBO`)}get supportedEdgeConfigurations(){return[1,2,3,4,8]}getBetAmount(e){return e.betAmount}determineGameResult({generator:e,edge:n,gameInputs:r}){let i=e.getRandomInt({min:1,max:4294967295}),a=i.max,o=new t(16777216),s=new t(1),c=new t(1e6),l=i.value,u=new t(l-1).div(a),d=(100-n)/100,f=o.div(u.mul(o).plus(1)).mul(d),p=Kt(s,qt(f,c)),m=p.gte(r.targetMultiplier)?new t(r.targetMultiplier):new t(0);return{isFinished:!0,payout:{legs:[{amount:r.betAmount.mul(m)}]},payoutMultiplier:m,outputs:{randomMultiplier:p,result:i.values},randomValues:i}}};const H=(e,t)=>{if(t<0||e<0||t>e)throw Error(`Invalid input: ensure 0 ≤ r ≤ n and n ≥ 0.`);t>e-t&&(t=e-t);let n=1;for(let r=1;r<=t;r++)n=n*(e-r+1)/r;return n};var Yt=class extends h{constructor(){super(`MINES`)}get supportedEdgeConfigurations(){return[1,2,3,4,8]}getBetAmount(e){return e.betAmount}determineGameResult({generator:e,edge:n,gameInputs:r}){if(r.minesCount<=0||r.minesCount>24)throw Error(`Must select between 1 and 24 mines.`);if(r.selectedTiles.length>25-r.minesCount)throw Error(`Cannot select more tiles than available safe tiles (total tiles minus mines).`);let i=e.getUniqueRandomInts({min:1,max:25,count:r.minesCount}),a=i.values.some(e=>r.selectedTiles.includes(e)),o=r.hasCashedOut||a,s=(100-n)/100,c=new t(H(25-r.minesCount,r.selectedTiles.length)).div(new t(H(25,r.selectedTiles.length))),l=r.hasCashedOut&&!a?new t(s).div(c):new t(0);return{isFinished:o,payout:{legs:[{amount:r.betAmount.mul(l)}]},payoutMultiplier:l,outputs:{result:i.values},randomValues:i}}};let Xt=function(e){return e.LOW_RISK=`LOW_RISK`,e.MEDIUM_RISK=`MEDIUM_RISK`,e.HIGH_RISK=`HIGH_RISK`,e}({});const Zt=[8,9,10,11,12,13,14,15,16],Qt=new B(new Map([[1,{LOW_RISK:{8:[6,2.1,1.1,1,.5,1,1.1,2.1,6],9:[6,2,1.6,1,.7,.7,1,1.6,2,6],10:[9,3,1.4,1.1,1,.5,1,1.1,1.4,3,9],11:[8,3,1.9,1.3,1,.7,.7,1,1.3,1.9,3,8],12:[10,3,1.6,1.4,1.1,1,.5,1,1.1,1.4,1.6,3,10],13:[8,4,3,1.9,1.2,.9,.7,.7,.9,1.2,1.9,3,4,8],14:[7,4,1.9,1.4,1.3,1.1,1,.5,1,1.1,1.3,1.4,1.9,4,7],15:[15,8,3,2,1.5,1.1,1,.7,.7,1,1.1,1.5,2,3,8,15],16:[16,9,2,1.4,1.4,1.2,1.1,1,.5,1,1.1,1.2,1.4,1.4,2,9,16]},MEDIUM_RISK:{8:[13,3,1.3,.7,.4,.7,1.3,3,13],9:[18,4,1.7,.9,.5,.5,.9,1.7,4,18],10:[22,5,2,1.4,.6,.4,.6,1.4,2,5,22],11:[24,6,3,1.8,.7,.5,.5,.7,1.8,3,6,24],12:[33,11,4,2,1.1,.6,.3,.6,1.1,2,4,11,33],13:[43,13,6,3,1.3,.7,.4,.4,.7,1.3,3,6,13,43],14:[58,15,7,4,1.9,1,.5,.2,.5,1,1.9,4,7,15,58],15:[88,18,11,5,3,1.3,.5,.3,.3,.5,1.3,3,5,11,18,88],16:[110,41.1,10,5,3,1.5,1,.5,.3,.5,1,1.5,3,5,10,41.1,110]},HIGH_RISK:{8:[29,4,1.5,.3,.2,.3,1.5,4,29],9:[43,7,2,.6,.2,.2,.6,2,7,43],10:[76,10,3,.9,.3,.2,.3,.9,3,10,76],11:[120,13.9,5.2,1.4,.4,.2,.2,.4,1.4,5.2,13.9,120],12:[170,23.8,8.1,2,.7,.2,.2,.2,.7,2,8.1,23.8,170],13:[260,36.7,11,4,1,.2,.2,.2,.2,1,4,11,36.7,260],14:[420,56.1,18,5,1.9,.3,.2,.2,.2,.3,1.9,5,18,56.1,420],15:[620,82.8,27,8,3,.5,.2,.2,.2,.2,.5,3,8,27,82.8,620],16:[1e3,129.9,26.1,9,4,2,.2,.2,.2,.2,.2,2,4,9,26.1,129.9,1e3]}}],[2,{LOW_RISK:{8:[6,1.9,1.1,1,.5,1,1.1,1.9,6],9:[6,1.7,1.6,1,.7,.7,1,1.6,1.7,6],10:[9,2.5,1.4,1.1,1,.5,1,1.1,1.4,2.5,9],11:[9,2.5,1.8,1.3,1,.7,.7,1,1.3,1.8,2.5,9],12:[10,3.2,1.6,1.3,1.1,1,.5,1,1.1,1.3,1.6,3.2,10],13:[8,3.7,2.9,1.8,1.2,.9,.7,.7,.9,1.2,1.8,2.9,3.7,8],14:[7,4,1.8,1.2,1.3,1.1,1,.5,1,1.1,1.3,1.2,1.8,4,7],15:[15,7.6,2.8,2,1.4,1.1,1,.7,.7,1,1.1,1.4,2,2.8,7.6,15],16:[16,9,1.7,1.2,1.3,1.2,1.1,1,.5,1,1.1,1.2,1.3,1.2,1.7,9,16]},MEDIUM_RISK:{8:[13,3.2,1.4,.6,.4,.6,1.4,3.2,13],9:[18,3.7,1.7,.9,.5,.5,.9,1.7,3.7,18],10:[22,5,1.9,1.4,.6,.4,.6,1.4,1.9,5,22],11:[24,6,2.8,1.8,.7,.5,.5,.7,1.8,2.8,6,24],12:[33,11.1,4,1.9,1.1,.6,.3,.6,1.1,1.9,4,11.1,33],13:[43,13.7,6.1,2.8,1.3,.7,.4,.4,.7,1.3,2.8,6.1,13.7,43],14:[58,13.7,6.7,3.9,1.9,1,.5,.2,.5,1,1.9,3.9,6.7,13.7,58],15:[88,17.7,10.8,5,2.9,1.3,.5,.3,.3,.5,1.3,2.9,5,10.8,17.7,88],16:[110,40.5,9.8,4.8,2.9,1.5,1,.5,.3,.5,1,1.5,2.9,4.8,9.8,40.5,110]},HIGH_RISK:{8:[29,3.8,1.5,.3,.2,.3,1.5,3.8,29],9:[43,7.1,1.9,.6,.2,.2,.6,1.9,7.1,43],10:[76,9.9,2.9,.9,.3,.2,.3,.9,2.9,9.9,76],11:[120,13.4,5.1,1.4,.4,.2,.2,.4,1.4,5.1,13.4,120],12:[170,23.2,7.9,2,.7,.2,.2,.2,.7,2,7.9,23.2,170],13:[260,36.6,10.5,4,1,.2,.2,.2,.2,1,4,10.5,36.6,260],14:[420,55.5,17.6,4.9,1.9,.3,.2,.2,.2,.3,1.9,4.9,17.6,55.5,420],15:[620,82.3,26.8,7.7,3,.5,.2,.2,.2,.2,.5,3,7.7,26.8,82.3,620],16:[1e3,129.8,25.2,8.6,4,2,.2,.2,.2,.2,.2,2,4,8.6,25.2,129.8,1e3]}}],[3,{LOW_RISK:{8:[6,2.2,1.1,1,.4,1,1.1,2.2,6],9:[6,1.8,1.5,1,.7,.7,1,1.5,1.8,6],10:[9,2.4,1.3,1.1,1,.5,1,1.1,1.3,2.4,9],11:[8,2.7,1.9,1.2,1,.7,.7,1,1.2,1.9,2.7,8],12:[10,3.3,1.6,1.2,1.1,1,.5,1,1.1,1.2,1.6,3.3,10],13:[8,3.8,2.9,1.9,1.1,.9,.7,.7,.9,1.1,1.9,2.9,3.8,8],14:[7,3.9,2,1.4,1.3,1.1,1,.4,1,1.1,1.3,1.4,2,3.9,7],15:[15,7.9,2.5,2,1.3,1.1,1,.7,.7,1,1.1,1.3,2,2.5,7.9,15],16:[16,8.9,1.9,1.4,1.4,1.2,1.1,1,.4,1,1.1,1.2,1.4,1.4,1.9,8.9,16]},MEDIUM_RISK:{8:[13,3.5,1.2,.7,.3,.7,1.2,3.5,13],9:[18,3.8,1.6,.9,.5,.5,.9,1.6,3.8,18],10:[22,5.2,2,1.3,.6,.4,.6,1.3,2,5.2,22],11:[24,5.6,2.7,1.8,.7,.5,.5,.7,1.8,2.7,5.6,24],12:[33,11.3,4,1.8,1.1,.6,.3,.6,1.1,1.8,4,11.3,33],13:[43,12.9,5.7,2.8,1.3,.7,.4,.4,.7,1.3,2.8,5.7,12.9,43],14:[58,13.7,6.9,3.9,1.8,1,.5,.2,.5,1,1.8,3.9,6.9,13.7,58],15:[88,18,10.9,4.9,2.8,1.3,.5,.3,.3,.5,1.3,2.8,4.9,10.9,18,88],16:[110,39.9,9.9,5,2.9,1.4,1,.5,.3,.5,1,1.4,2.9,5,9.9,39.9,110]},HIGH_RISK:{8:[29,4,1.4,.3,.2,.3,1.4,4,29],9:[43,7.3,2,.5,.2,.2,.5,2,7.3,43],10:[76,9.8,2.8,.9,.3,.2,.3,.9,2.8,9.8,76],11:[120,13.5,4.9,1.4,.4,.2,.2,.4,1.4,4.9,13.5,120],12:[170,23.3,7.9,1.9,.7,.2,.2,.2,.7,1.9,7.9,23.3,170],13:[260,36.2,10.4,3.9,1,.2,.2,.2,.2,1,3.9,10.4,36.2,260],14:[420,54.8,17.9,4.9,1.8,.3,.2,.2,.2,.3,1.8,4.9,17.9,54.8,420],15:[620,81.9,26.6,7.7,2.9,.5,.2,.2,.2,.2,.5,2.9,7.7,26.6,81.9,620],16:[1e3,130,24.9,8.4,3.9,2,.2,.2,.2,.2,.2,2,3.9,8.4,24.9,130,1e3]}}],[4,{LOW_RISK:{8:[6,2,1.1,1,.4,1,1.1,2,6],9:[6,1.9,1.4,1,.7,.7,1,1.4,1.9,6],10:[9,2.8,1.1,1.1,1,.5,1,1.1,1.1,2.8,9],11:[8,2.7,1.7,1.2,1,.7,.7,1,1.2,1.7,2.7,8],12:[10,2.7,1.4,1.2,1.1,1,.5,1,1.1,1.2,1.4,2.7,10],13:[8,3.5,2.8,1.9,1.3,.9,.6,.6,.9,1.3,1.9,2.8,3.5,8],14:[7,3.3,1.6,1.3,1.3,1.1,1,.4,1,1.1,1.3,1.3,1.6,3.3,7],15:[15,8,2.9,2,1.4,1.2,1,.6,.6,1,1.2,1.4,2,2.9,8,15],16:[16,9.1,2.2,1.4,1.2,1.2,1.1,1,.4,1,1.1,1.2,1.2,1.4,2.2,9.1,16]},MEDIUM_RISK:{8:[13,2.9,1.2,.7,.4,.7,1.2,2.9,13],9:[18,3.5,1.6,.9,.5,.5,.9,1.6,3.5,18],10:[22,4.7,2,1.3,.6,.4,.6,1.3,2,4.7,22],11:[24,5.7,2.5,1.8,.7,.5,.5,.7,1.8,2.5,5.7,24],12:[33,10.7,3.8,1.8,1.1,.6,.3,.6,1.1,1.8,3.8,10.7,33],13:[43,12.6,5.6,2.7,1.3,.7,.4,.4,.7,1.3,2.7,5.6,12.6,43],14:[58,13.7,6.4,3.8,1.8,1,.5,.2,.5,1,1.8,3.8,6.4,13.7,58],15:[88,17.7,10.7,4.9,2.7,1.3,.5,.3,.3,.5,1.3,2.7,4.9,10.7,17.7,88],16:[110,39.7,9.6,4.8,2.8,1.4,1,.5,.3,.5,1,1.4,2.8,4.8,9.6,39.7,110]},HIGH_RISK:{8:[29,3.9,1.4,.3,.2,.3,1.4,3.9,29],9:[43,6.9,1.8,.6,.2,.2,.6,1.8,6.9,43],10:[76,9.8,2.7,.9,.3,.2,.3,.9,2.7,9.8,76],11:[120,13.1,5.1,1.3,.4,.2,.2,.4,1.3,5.1,13.1,120],12:[170,22.7,7.7,1.9,.7,.2,.2,.2,.7,1.9,7.7,22.7,170],13:[260,35.9,10.3,3.8,1,.2,.2,.2,.2,1,3.8,10.3,35.9,260],14:[420,54.2,17.5,4.8,1.8,.3,.2,.2,.2,.3,1.8,4.8,17.5,54.2,420],15:[620,80.6,26.1,7.8,2.8,.5,.2,.2,.2,.2,.5,2.8,7.8,26.1,80.6,620],16:[1e3,129.7,24.7,8.2,3.8,2,.2,.2,.2,.2,.2,2,3.8,8.2,24.7,129.7,1e3]}}],[8,{LOW_RISK:{8:[5,1.8,1,1,.4,1,1,1.8,5],9:[5,1.7,1.2,1,.7,.7,1,1.2,1.7,5],10:[9,2.8,1.2,1,1,.4,1,1,1.2,2.8,9],11:[8,2.5,1.6,1,1,.7,.7,1,1,1.6,2.5,8],12:[10,2.5,1.3,1.3,1,1,.4,1,1,1.3,1.3,2.5,10],13:[8,4.1,2.8,1.8,1.1,.9,.6,.6,.9,1.1,1.8,2.8,4.1,8],14:[7,3.3,1.7,1.2,1.2,1,1,.4,1,1,1.2,1.2,1.7,3.3,7],15:[15,7.3,2.9,1.9,1.4,1,1,.6,.6,1,1,1.4,1.9,2.9,7.3,15],16:[16,8.7,2,1.5,1.3,1,1.1,1,.3,1,1.1,1,1.3,1.5,2,8.7,16]},MEDIUM_RISK:{8:[13,2.6,1.1,.7,.4,.7,1.1,2.6,13],9:[17,3.3,1.4,.9,.5,.5,.9,1.4,3.3,17],10:[21,4.1,1.7,1.3,.6,.4,.6,1.3,1.7,4.1,21],11:[23,5.6,2.4,1.6,.7,.5,.5,.7,1.6,2.4,5.6,23],12:[32,10.2,3.7,1.7,1.1,.6,.2,.6,1.1,1.7,3.7,10.2,32],13:[42,11.7,5.3,2.5,1.2,.7,.4,.4,.7,1.2,2.5,5.3,11.7,42],14:[56,13.2,5.9,3.6,1.6,1,.5,.2,.5,1,1.6,3.6,5.9,13.2,56],15:[86,17.3,10,4.6,2.6,1.2,.5,.3,.3,.5,1.2,2.6,4.6,10,17.3,86],16:[107,39,9.9,4.5,2.4,1.3,1,.5,.3,.5,1,1.3,2.4,4.5,9.9,39,107]},HIGH_RISK:{8:[28,3.3,1.4,.3,.2,.3,1.4,3.3,28],9:[42,6.7,1.6,.6,.2,.2,.6,1.6,6.7,42],10:[74,9.6,2.6,.9,.3,.1,.3,.9,2.6,9.6,74],11:[116,12.7,4.8,1.2,.4,.2,.2,.4,1.2,4.8,12.7,116],12:[165,20.9,7.2,1.8,.7,.2,.2,.2,.7,1.8,7.2,20.9,165],13:[252,33.9,10.1,3.4,1,.2,.2,.2,.2,1,3.4,10.1,33.9,252],14:[407,51.9,16.3,4.6,1.7,.3,.2,.2,.2,.3,1.7,4.6,16.3,51.9,407],15:[600,76.9,24.9,7.4,2.6,.5,.2,.2,.2,.2,.5,2.6,7.4,24.9,76.9,600],16:[1e3,122,24.5,8,3.7,1.8,.2,.2,.2,.2,.2,1.8,3.7,8,24.5,122,1e3]}}]]));var $t=class extends h{constructor(){super(`PLINKO`)}get supportedEdgeConfigurations(){return[1,2,3,4,8]}getBetAmount(e){return e.betAmount}determineGameResult({generator:e,gameInputs:t,edge:r}){if(t.numberOfRows%1>0)throw Error(`Number of rows must be an integer`);if(t.numberOfRows<8||t.numberOfRows>16)throw Error(`Number of rows must be between 8 and 16`);let i=t.numberOfRows,a=Qt.getMultipliers(r)[t.riskLevel][i],o=e.getRandomIntsWithReplacement({min:0,max:1,count:t.numberOfRows}),s=o.values.reduce((e,t)=>e+t,0),c=a[s];if(c===void 0)throw Error(`No payout found for end position ${s}`);let l=n(c);return{isFinished:!0,payout:{legs:[{amount:t.betAmount.mul(l)}]},payoutMultiplier:l,outputs:{result:o.values},randomValues:o}}};const U=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36],en=[37,...U],tn=[[0,1],[0,2],[0,3],[1,2],[1,4],[2,3],[2,5],[3,6],[4,5],[4,7],[5,6],[5,8],[6,9],[7,8],[7,10],[8,9],[8,11],[9,12],[10,11],[10,13],[11,12],[11,14],[12,15],[13,14],[13,16],[14,15],[14,17],[15,18],[16,17],[16,19],[17,18],[17,20],[18,21],[19,20],[19,22],[20,21],[20,23],[21,24],[22,23],[22,25],[23,24],[23,26],[24,27],[25,26],[25,28],[26,27],[26,29],[27,30],[28,29],[28,31],[29,30],[29,32],[30,33],[31,32],[31,34],[32,33],[32,35],[33,36],[34,35],[35,36]],nn=[[0,1],[0,37],[3,37],[1,2],[1,4],[2,3],[2,5],[3,6],[4,5],[4,7],[5,6],[5,8],[6,9],[7,8],[7,10],[8,9],[8,11],[9,12],[10,11],[10,13],[11,12],[11,14],[12,15],[13,14],[13,16],[14,15],[14,17],[15,18],[16,17],[16,19],[17,18],[17,20],[18,21],[19,20],[19,22],[20,21],[20,23],[21,24],[22,23],[22,25],[23,24],[23,26],[24,27],[25,26],[25,28],[26,27],[26,29],[27,30],[28,29],[28,31],[29,30],[29,32],[30,33],[31,32],[31,34],[32,33],[32,35],[33,36],[34,35],[35,36]],rn=[[0,1,2],[0,2,3],[1,2,3],[4,5,6],[7,8,9],[10,11,12],[13,14,15],[16,17,18],[19,20,21],[22,23,24],[25,26,27],[28,29,30],[31,32,33],[34,35,36]],an=[[0,1,2],[0,2,37],[1,2,3],[2,3,37],[4,5,6],[7,8,9],[10,11,12],[13,14,15],[16,17,18],[19,20,21],[22,23,24],[25,26,27],[28,29,30],[31,32,33],[34,35,36]],on=[[0,1,2,3],[1,2,4,5],[2,3,5,6],[4,5,7,8],[5,6,8,9],[7,8,10,11],[8,9,11,12],[10,11,13,14],[11,12,14,15],[13,14,16,17],[14,15,17,18],[16,17,19,20],[17,18,20,21],[19,20,22,23],[20,21,23,24],[22,23,25,26],[23,24,26,27],[25,26,28,29],[26,27,29,30],[28,29,31,32],[29,30,32,33],[31,32,34,35],[32,33,35,36]],sn=[[1,2,4,5],[2,3,5,6],[4,5,7,8],[5,6,8,9],[7,8,10,11],[8,9,11,12],[10,11,13,14],[11,12,14,15],[13,14,16,17],[14,15,17,18],[16,17,19,20],[17,18,20,21],[19,20,22,23],[20,21,23,24],[22,23,25,26],[23,24,26,27],[25,26,28,29],[26,27,29,30],[28,29,31,32],[29,30,32,33],[31,32,34,35],[32,33,35,36]],cn=[0,1,2,3,37],ln=[[1,2,3,4,5,6],[4,5,6,7,8,9],[7,8,9,10,11,12],[10,11,12,13,14,15],[13,14,15,16,17,18],[16,17,18,19,20,21],[19,20,21,22,23,24],[22,23,24,25,26,27],[25,26,27,28,29,30],[28,29,30,31,32,33],[31,32,33,34,35,36]],un=[[1,2,3,4,5,6],[4,5,6,7,8,9],[7,8,9,10,11,12],[10,11,12,13,14,15],[13,14,15,16,17,18],[16,17,18,19,20,21],[19,20,21,22,23,24],[22,23,24,25,26,27],[25,26,27,28,29,30],[28,29,30,31,32,33],[31,32,33,34,35,36]];let W=function(e){return e.EVEN=`EVEN`,e.ODD=`ODD`,e}({}),G=function(e){return e.RED=`RED`,e.BLACK=`BLACK`,e}({}),K=function(e){return e.LOW=`LOW`,e.HIGH=`HIGH`,e}({}),q=function(e){return e.TOP=`TOP`,e.MIDDLE=`MIDDLE`,e.BOTTOM=`BOTTOM`,e}({}),J=function(e){return e.FIRST=`FIRST`,e.SECOND=`SECOND`,e.THIRD=`THIRD`,e}({}),dn=function(e){return e.AMERICAN=`AMERICAN`,e.EUROPEAN=`EUROPEAN`,e}({});const Y=2.7,X=5.3,fn=e=>{if(e.straightBets.length===0&&e.splitBets.length===0&&e.streetBets.length===0&&e.cornerBets.length===0&&e.doubleStreetBets.length===0&&e.parityBets.length===0&&e.colorBets.length===0&&e.halfBets.length===0&&e.columnBets.length===0&&e.dozenBets.length===0)throw p.createValidationError(`Must place at least a single bet.`);if(!e.straightBets.every(e=>e.amount.gte(0)&&Z(e.value)))throw p.createValidationError(`Invalid straight bet.`);if(!e.splitBets.every(e=>e.amount.gte(0)&&pn(e.values)))throw p.createValidationError(`Invalid split bet.`);if(!e.streetBets.every(e=>e.amount.gte(0)&&mn(e.values)))throw p.createValidationError(`Invalid street bet.`);if(!e.cornerBets.every(e=>e.amount.gte(0)&&hn(e.values)))throw p.createValidationError(`Invalid corner bet.`);if(!e.doubleStreetBets.every(e=>e.amount.gte(0)&&gn(e.values)))throw p.createValidationError(`Invalid double street bet.`);if(!e.parityBets.every(e=>e.amount.gte(0)&&Object.values(W).includes(e.parity)))throw p.createValidationError(`Invalid parity bet.`);if(!e.colorBets.every(e=>e.amount.gte(0)&&Object.values(G).includes(e.color)))throw p.createValidationError(`Invalid color bet.`);if(!e.halfBets.every(e=>e.amount.gte(0)&&Object.values(K).includes(e.half)))throw p.createValidationError(`Invalid half bet.`);if(!e.columnBets.every(e=>e.amount.gte(0)&&Object.values(q).includes(e.column)))throw p.createValidationError(`Invalid column bet.`);if(!e.dozenBets.every(e=>e.amount.gte(0)&&Object.values(J).includes(e.dozen)))throw p.createValidationError(`Invalid dozen bet.`)},Z=e=>U.includes(e),pn=e=>e.length!==2||!e.every(Z)?!1:tn.some(([t,n])=>t===e[0]&&n===e[1]),mn=e=>e.length!==3||!e.every(Z)?!1:rn.some(([t,n,r])=>t===e[0]&&n===e[1]&&r===e[2]),hn=e=>e.length!==4||!e.every(Z)?!1:on.some(([t,n,r,i])=>t===e[0]&&n===e[1]&&r===e[2]&&i===e[3]),gn=e=>e.length!==6||!e.every(Z)?!1:ln.some(([t,n,r,i,a,o])=>t===e[0]&&n===e[1]&&r===e[2]&&i===e[3]&&a===e[4]&&o===e[5]),_n=e=>{if(e.straightBets.length===0&&e.splitBets.length===0&&e.streetBets.length===0&&e.cornerBets.length===0&&e.basketBets.length===0&&e.doubleStreetBets.length===0&&e.parityBets.length===0&&e.colorBets.length===0&&e.halfBets.length===0&&e.columnBets.length===0&&e.dozenBets.length===0)throw p.createValidationError(`Must place at least a single bet.`);if(!e.straightBets.every(e=>e.amount.gte(0)&&Q(e.value)))throw p.createValidationError(`Invalid straight bet.`);if(!e.splitBets.every(e=>e.amount.gte(0)&&vn(e.values)))throw p.createValidationError(`Invalid split bet.`);if(!e.streetBets.every(e=>e.amount.gte(0)&&yn(e.values)))throw p.createValidationError(`Invalid street bet.`);if(!e.cornerBets.every(e=>e.amount.gte(0)&&bn(e.values)))throw p.createValidationError(`Invalid corner bet.`);if(!e.basketBets.every(e=>e.amount.gte(0)))throw p.createValidationError(`Invalid basket bet.`);if(!e.doubleStreetBets.every(e=>e.amount.gte(0)&&xn(e.values)))throw p.createValidationError(`Invalid double street bet.`);if(!e.parityBets.every(e=>e.amount.gte(0)&&Object.values(W).includes(e.parity)))throw p.createValidationError(`Invalid parity bet.`);if(!e.colorBets.every(e=>e.amount.gte(0)&&Object.values(G).includes(e.color)))throw p.createValidationError(`Invalid color bet.`);if(!e.halfBets.every(e=>e.amount.gte(0)&&Object.values(K).includes(e.half)))throw p.createValidationError(`Invalid half bet.`);if(!e.columnBets.every(e=>e.amount.gte(0)&&Object.values(q).includes(e.column)))throw p.createValidationError(`Invalid column bet.`);if(!e.dozenBets.every(e=>e.amount.gte(0)&&Object.values(J).includes(e.dozen)))throw p.createValidationError(`Invalid dozen bet.`)},Q=e=>en.includes(e);function vn(e){return e.length!==2||!e.every(Q)?!1:nn.some(([t,n])=>t===e[0]&&n===e[1])}const yn=e=>e.length!==3||!e.every(Q)?!1:an.some(([t,n,r])=>t===e[0]&&n===e[1]&&r===e[2]),bn=e=>e.length!==4||!e.every(Q)?!1:sn.some(([t,n,r,i])=>t===e[0]&&n===e[1]&&r===e[2]&&i===e[3]),xn=e=>e.length!==6||!e.every(Q)?!1:un.some(([t,n,r,i,a,o])=>t===e[0]&&n===e[1]&&r===e[2]&&i===e[3]&&a===e[4]&&o===e[5]),Sn=(e,t)=>{let n=t===2.7&&e.type===`EUROPEAN`,r=t===5.3&&e.type===`AMERICAN`;if(!n&&!r)throw p.createValidationError(`Attempted to play ${e.type} roulette on edge ${t}`)},Cn=(e,t)=>{Sn(e,t),e.type===`EUROPEAN`?fn(e.inputs):_n(e.inputs)},wn={straightBets:36,splitBets:18,streetBets:12,cornerBets:9,basketBets:7,doubleStreetBets:6,parityBets:2,colorBets:2,halfBets:2,columnBets:3,dozenBets:3},Tn=[3,6,9,12,15,18,21,24,27,30,33,36],En=[2,5,8,11,14,17,20,23,26,29,32,35],$=[1,4,7,10,13,16,19,22,25,28,31,34],Dn=[1,3,5,7,9,12,14,16,18,19,21,23,25,27,30,32,34,36],On=[2,4,6,8,10,11,13,15,17,20,22,24,26,28,29,31,33,35];var kn=class extends h{constructor(){super(`ROULETTE`)}determineGameResult({generator:e,gameInputs:t}){this.validateInputs(t);let n=e.getRandomInt({min:0,max:this.maxNumber}),r=n.value,i=this.determineBetOutcomes(t,r),{payoutMultiplier:a,payout:o}=this.getPayoutDetails(t,r);return{outputs:{betOutcomes:i,result:n.values},payout:o,payoutMultiplier:a,isFinished:!0,randomValues:n}}getBetAmount(e){return this.calculateTotalBetAmount(this.getBetTotals(e))}getPayoutDetails(e,t){let r=this.getBetTotals(e),i=this.calculateTotalBetAmount(r),a={legs:this.calculatePayoutLegs(e,t)},o=E(a);return{payoutMultiplier:i.gt(0)?o.div(i):new n(0),payout:a}}determineBetOutcomes(e,t){let n={},r={};for(let i of Object.keys(e)){let a=e[i],o=this.betPredicates[i],{winning:s,losing:c}=this.partitionBets(a,o,t);n[i]=s,r[i]=c}return{winningBets:n,losingBets:r}}calculateTotalAmount(e){return e.reduce((e,t)=>e.plus(t.amount),new n(0))}isWinningStraightBet(e,t){return e.value===t}isWinningSplitBet(e,t){return e.values.some(e=>e===t)}isWinningStreetBet(e,t){return e.values.some(e=>e===t)}isWinningCornerBet(e,t){return e.values.some(e=>e===t)}isWinningDoubleStreetBet(e,t){return e.values.some(e=>e===t)}isWinningColorBet(e,t){let n=e;return Dn.includes(t)&&n.color===`RED`||On.includes(t)&&n.color===`BLACK`}isWinningHalfBet(e,t){let n=e;return t>0&&t<=18&&n.half===`LOW`||t>18&&t<=36&&n.half===`HIGH`}isWinningColumnBet(e,t){let n=e;return Tn.includes(t)&&n.column===`TOP`||En.includes(t)&&n.column===`MIDDLE`||$.includes(t)&&n.column===`BOTTOM`}isWinningDozenBet(e,t){let n=e;return t>0&&t<=12&&n.dozen===`FIRST`||t>12&&t<=24&&n.dozen===`SECOND`||t>24&&t<=36&&n.dozen===`THIRD`}isWinningParityBet(e,t){let n=e;if(t===0||t===37)return!1;let r=t%2==0?`EVEN`:`ODD`;return n.parity===r}getBetTotals(e){let t={};for(let n of Object.keys(e))t[n]=this.calculateTotalAmount(e[n]);return t}calculateTotalBetAmount(e){return Object.values(e).reduce((e,t)=>e.plus(t),new n(0))}partitionBets(e,t,n){return{winning:e.filter(e=>t(e,n)),losing:e.filter(e=>!t(e,n))}}calculatePayoutLegs(e,t){return Object.keys(e).flatMap(r=>{let i=wn[r],a=this.betPredicates[r];return e[r].map(e=>a(e,t)?{amount:e.amount.mul(i||0)}:{amount:new n(`0`)})})}},An=class extends kn{maxNumber=36;betPredicates={straightBets:this.isWinningStraightBet,splitBets:this.isWinningSplitBet,streetBets:this.isWinningStreetBet,cornerBets:this.isWinningCornerBet,doubleStreetBets:this.isWinningDoubleStreetBet,parityBets:this.isWinningParityBet,colorBets:this.isWinningColorBet,halfBets:this.isWinningHalfBet,columnBets:this.isWinningColumnBet,dozenBets:this.isWinningDozenBet};get supportedEdgeConfigurations(){return[Y]}validateInputs(e){fn(e)}},jn=class extends kn{maxNumber=37;betPredicates={straightBets:this.isWinningStraightBet,splitBets:this.isWinningSplitBet,streetBets:this.isWinningStreetBet,cornerBets:this.isWinningCornerBet,basketBets:this.isWinningBasketBet,doubleStreetBets:this.isWinningDoubleStreetBet,parityBets:this.isWinningParityBet,colorBets:this.isWinningColorBet,halfBets:this.isWinningHalfBet,columnBets:this.isWinningColumnBet,dozenBets:this.isWinningDozenBet};get supportedEdgeConfigurations(){return[X]}validateInputs(e){_n(e)}isWinningBasketBet(e,t){return cn.some(e=>e===t)}},Mn=class extends h{europeanGame;americanGame;constructor(){super(`ROULETTE`),this.europeanGame=new An,this.americanGame=new jn}get supportedEdgeConfigurations(){return[Y,X]}getBetAmount(e){switch(e.type){case`AMERICAN`:return this.americanGame.getBetAmount(e.inputs);case`EUROPEAN`:return this.europeanGame.getBetAmount(e.inputs);default:throw Error(`Unhandled roulette type`)}}determineGameResult(e){let{gameInputs:t,...n}=e;if(Cn(t,e.edge),t.type===`EUROPEAN`){let e=this.europeanGame.determineGameResult({...n,gameInputs:t.inputs}),{betOutcomes:r}=e.outputs;return{...e,outputs:{type:`european`,betOutcomes:r,result:e.outputs.result}}}let r=this.americanGame.determineGameResult({...n,gameInputs:t.inputs}),{betOutcomes:i}=r.outputs;return{...r,outputs:{type:`american`,betOutcomes:i,result:r.outputs.result}}}};const Nn=e=>new Mn().getBetAmount(e);let Pn=function(e){return e.LOW_RISK=`LOW_RISK`,e.MEDIUM_RISK=`MEDIUM_RISK`,e.HIGH_RISK=`HIGH_RISK`,e}({}),Fn=function(e){return e[e.TEN=10]=`TEN`,e[e.TWENTY=20]=`TWENTY`,e[e.THIRTY=30]=`THIRTY`,e[e.FORTY=40]=`FORTY`,e[e.FIFTY=50]=`FIFTY`,e}({});const In=new B(new Map([[1,{LOW_RISK:{10:{ZERO:0,A:1.2,B:1.5},20:{ZERO:0,A:1.2,B:1.5},30:{ZERO:0,A:1.2,B:1.5},40:{ZERO:0,A:1.2,B:1.5},50:{ZERO:0,A:1.2,B:1.5}},MEDIUM_RISK:{10:{ZERO:0,A:1.5,B:1.9,C:2,D:3},20:{ZERO:0,A:1.5,B:1.8,C:2,D:3},30:{ZERO:0,A:1.5,B:1.7,C:2,D:3,E:4},40:{ZERO:0,A:1.5,B:1.6,C:2,D:3},50:{ZERO:0,A:1.5,B:2,C:3,D:5}},HIGH_RISK:{10:{ZERO:0,A:9.9},20:{ZERO:0,A:19.8},30:{ZERO:0,A:29.7},40:{ZERO:0,A:39.6},50:{ZERO:0,A:49.5}}}],[2,{LOW_RISK:{10:{ZERO:0,A:1.2,B:1.4},20:{ZERO:0,A:1.2,B:1.4},30:{ZERO:0,A:1.2,B:1.4},40:{ZERO:0,A:1.2,B:1.4},50:{ZERO:0,A:1.2,B:1.4}},MEDIUM_RISK:{10:{ZERO:0,A:1.4,B:1.9,C:2,D:3.1},20:{ZERO:0,A:1.5,B:1.8,C:1.9,D:3.4},30:{ZERO:0,A:1.5,B:1.7,C:1.9,D:3,E:4.3},40:{ZERO:0,A:1.5,B:1.6,C:2,D:2.9},50:{ZERO:0,A:1.5,B:2,C:3,D:4.5}},HIGH_RISK:{10:{ZERO:0,A:9.8},20:{ZERO:0,A:19.6},30:{ZERO:0,A:29.4},40:{ZERO:0,A:39.2},50:{ZERO:0,A:49}}}],[3,{LOW_RISK:{10:{ZERO:0,A:1.15,B:1.65},20:{ZERO:0,A:1.15,B:1.65},30:{ZERO:0,A:1.15,B:1.65},40:{ZERO:0,A:1.15,B:1.65},50:{ZERO:0,A:1.15,B:1.65}},MEDIUM_RISK:{10:{ZERO:0,A:1.4,B:1.9,C:2,D:3},20:{ZERO:0,A:1.4,B:1.6,C:2,D:3},30:{ZERO:0,A:1.4,B:1.7,C:2,D:3,E:4},40:{ZERO:0,A:1.5,B:1.6,C:2,D:2.8},50:{ZERO:0,A:1.5,B:2,C:2.7,D:4.9}},HIGH_RISK:{10:{ZERO:0,A:9.7},20:{ZERO:0,A:19.4},30:{ZERO:0,A:29.1},40:{ZERO:0,A:38.8},50:{ZERO:0,A:48.5}}}],[4,{LOW_RISK:{10:{ZERO:0,A:1.15,B:1.55},20:{ZERO:0,A:1.15,B:1.55},30:{ZERO:0,A:1.15,B:1.55},40:{ZERO:0,A:1.15,B:1.55},50:{ZERO:0,A:1.15,B:1.55}},MEDIUM_RISK:{10:{ZERO:0,A:1.4,B:1.8,C:2,D:3},20:{ZERO:0,A:1.3,B:1.5,C:2,D:3},30:{ZERO:0,A:1.4,B:1.6,C:2,D:2.9,E:4},40:{ZERO:0,A:1.5,B:1.6,C:2,D:2.7},50:{ZERO:0,A:1.5,B:2,C:2.6,D:4.8}},HIGH_RISK:{10:{ZERO:0,A:9.6},20:{ZERO:0,A:19.2},30:{ZERO:0,A:28.8},40:{ZERO:0,A:38.4},50:{ZERO:0,A:48}}}],[8,{LOW_RISK:{10:{ZERO:0,A:1.1,B:1.5},20:{ZERO:0,A:1.1,B:1.5},30:{ZERO:0,A:1.1,B:1.45},40:{ZERO:0,A:1.1,B:1.45},50:{ZERO:0,A:1.1,B:1.45}},MEDIUM_RISK:{10:{ZERO:0,A:1.3,B:1.7,C:1.9,D:3},20:{ZERO:0,A:1.3,B:1.4,C:1.9,D:3},30:{ZERO:0,A:1.3,B:1.7,C:1.9,D:2.8,E:3.8},40:{ZERO:0,A:1.4,B:1.8,C:1.9,D:2.6},50:{ZERO:0,A:1.4,B:1.9,C:2.6,D:4.6}},HIGH_RISK:{10:{ZERO:0,A:9.2},20:{ZERO:0,A:18.4},30:{ZERO:0,A:27.6},40:{ZERO:0,A:36.8},50:{ZERO:0,A:46}}}]])),Ln={LOW_RISK:{10:[`B`,`A`,`A`,`A`,`ZERO`,`A`,`A`,`A`,`A`,`ZERO`],20:[`B`,`A`,`A`,`A`,`ZERO`,`A`,`A`,`A`,`A`,`ZERO`,`B`,`A`,`A`,`A`,`ZERO`,`A`,`A`,`A`,`A`,`ZERO`],30:`B.A.A.A.ZERO.A.A.A.A.ZERO.B.A.A.A.ZERO.A.A.A.A.ZERO.B.A.A.A.ZERO.A.A.A.A.ZERO`.split(`.`),40:`B.A.A.A.ZERO.A.A.A.A.ZERO.B.A.A.A.ZERO.A.A.A.A.ZERO.B.A.A.A.ZERO.A.A.A.A.ZERO.B.A.A.A.ZERO.A.A.A.A.ZERO`.split(`.`),50:`B.A.A.A.ZERO.A.A.A.A.ZERO.B.A.A.A.ZERO.A.A.A.A.ZERO.B.A.A.A.ZERO.A.A.A.A.ZERO.B.A.A.A.ZERO.A.A.A.A.ZERO.B.A.A.A.ZERO.A.A.A.A.ZERO`.split(`.`)},MEDIUM_RISK:{10:[`ZERO`,`B`,`ZERO`,`A`,`ZERO`,`C`,`ZERO`,`A`,`ZERO`,`D`],20:[`A`,`ZERO`,`C`,`ZERO`,`B`,`ZERO`,`C`,`ZERO`,`C`,`ZERO`,`A`,`ZERO`,`C`,`ZERO`,`C`,`ZERO`,`D`,`ZERO`,`C`,`ZERO`],30:`A.ZERO.C.ZERO.A.ZERO.C.ZERO.D.ZERO.B.ZERO.A.ZERO.C.ZERO.A.ZERO.C.ZERO.A.ZERO.C.ZERO.E.ZERO.A.ZERO.C.ZERO`.split(`.`),40:`C.ZERO.A.ZERO.D.ZERO.C.ZERO.A.ZERO.C.ZERO.A.ZERO.D.ZERO.C.ZERO.A.ZERO.B.ZERO.A.ZERO.D.ZERO.C.ZERO.A.ZERO.C.ZERO.A.ZERO.D.ZERO.C.ZERO.A.ZERO`.split(`.`),50:`A.ZERO.B.ZERO.A.ZERO.C.ZERO.A.ZERO.B.ZERO.A.ZERO.B.ZERO.A.ZERO.C.ZERO.A.ZERO.B.ZERO.A.ZERO.B.ZERO.A.ZERO.C.ZERO.A.ZERO.B.ZERO.A.ZERO.B.ZERO.A.ZERO.D.ZERO.A.ZERO.B.ZERO.A.ZERO`.split(`.`)},HIGH_RISK:{10:[...Array(9).fill(`ZERO`),`A`],20:[...Array(19).fill(`ZERO`),`A`],30:[...Array(29).fill(`ZERO`),`A`],40:[...Array(39).fill(`ZERO`),`A`],50:[...Array(49).fill(`ZERO`),`A`]}};var Rn=class extends h{constructor(){super(`WHEEL`)}get supportedEdgeConfigurations(){return[1,2,3,4,8]}getBetAmount(e){return e.betAmount}determineGameResult({generator:e,gameInputs:t,edge:r}){if(!Object.values(Fn).includes(t.segments))throw Error(`Invalid segments value`);if(!Object.values(Pn).includes(t.riskLevel))throw Error(`Invalid risk level`);let i=In.getMultipliers(r)[t.riskLevel];if(i===void 0)throw Error(`No multipliers found for risk level ${t.riskLevel}`);let a=i[t.segments];if(a===void 0)throw Error(`No multipliers found for segment ${t.segments}`);let o=Ln[t.riskLevel];if(o===void 0)throw Error(`No patterns found for risk level ${t.riskLevel}`);let s=o[t.segments];if(s===void 0)throw Error(`No patterns found for segment ${t.segments}`);let c=e.getRandomInt({min:0,max:s.length-1}),l=s[c.value];if(l===void 0)throw Error(`No pattern found for segment ${t.segments} and value ${c.value}`);let u=a[l];if(u===void 0)throw Error(`No payout found for picked segment ${l}`);let d=new n(u);return{isFinished:!0,payout:{legs:[{amount:t.betAmount.mul(d)}]},payoutMultiplier:d,outputs:{result:c.values},randomValues:c}}};export{Ne as ACE_SOFT_BONUS,cn as AMERICAN_BASKET,X as AMERICAN_HOUSE_EDGE,ce as AdvancedDice,jn as AmericanRoulette,A as BASE_PAYOUT_MULTIPLIERS,O as BLACKJACK_MULTIPLIER,De as BLACKJACK_VALUE,On as BLACK_NUMBERS,lt as BLITZ_CARD_COUNT,ct as BLITZ_MAX_CARD_RANGE,st as BLITZ_MIN_CARD_RANGE,ut as BLITZ_RANDOM_NUMBER_COUNT,$ as BOTTOM_COLUMN,Ee as BUST_VALUE,ge as Baccarat,pe as BaccaratBetType,fe as BaccaratOutcome,ot as Blackjack,ye as BlackjackActionType,_e as BlackjackOutcome,mt as Blitz,Me as CARDS_PER_SUIT,l as CARD_RANKS,c as CARD_SUITS,d as CARD_SUIT_COLORS,s as CARD_VALUES,G as Color,q as Column,z as DARTS_BOARD_CONFIGS,_t as DARTS_DIFFICULTY_LEVEL,gt as DARTS_MAX_VALUE,ht as DARTS_MIN_VALUE,Te as DEALER_STAND_VALUE,Mt as DICE_EFFECTIVE_RANGE,V as DICE_MAX_ROLL,jt as DICE_MIN_ROLL,Ae as DOUBLE_DOWN_BET_SIZE_FACTOR,Ct as Darts,kt as Diamonds,Et as DiamondsResultType,Ft as Dice,At as DiceDirection,J as Dozen,v as EFFECTIVE_RANGE,Y as EUROPEAN_HOUSE_EDGE,An as EuropeanRoulette,u as FACE_CARD_RANKS,Pe as FACE_CARD_VALUE,p as GameError,f as GameErrorCode,K as Half,k as INSURANCE_BET_SIZE_FACTOR,ke as INSURANCE_WIN_MULTIPLIER,ve as InsuranceOutcome,Gt as Keno,It as KenoRiskLevel,we as LOSE_MULTIPLIER,Jt as Limbo,Oe as MAX_CARDS_PER_ROUND,o as MAX_CARD_VALUE,ne as MAX_WIN_CHANCE,En as MIDDLE_COLUMN,a as MIN_CARD_VALUE,te as MIN_WIN_CHANCE,Yt as Mines,ze as MultiActionGame,g as MultiplierCalculator,m as OrigamiGame,j as PAIR_BONUS_PAYOUTS,wn as PAYOUT_MULTIPLIERS,Zt as PLINKO_ROW_COUNTS,Ce as PUSH_MULTIPLIER,be as PairBonusType,W as Parity,$t as Plinko,Xt as PlinkoRiskLevel,_ as RANDOM_MAX_VALUE,ee as RANDOM_MIN_VALUE,Dn as RED_NUMBERS,Re as RandomValuePool,oe as RollType,Mn as Roulette,dn as RouletteType,je as SPLIT_BET_SIZE_FACTOR,h as SingleActionGame,M as THREE_CARD_BONUS_PAYOUTS,Lt as TILE_COUNTS,Tn as TOP_COLUMN,xe as ThreeCardBonusType,sn as VALID_AMERICAN_CORNERS,un as VALID_AMERICAN_DOUBLE_STREETS,nn as VALID_AMERICAN_SPLITS,en as VALID_AMERICAN_STRAIGHTS,an as VALID_AMERICAN_STREETS,on as VALID_EUROPEAN_CORNERS,ln as VALID_EUROPEAN_DOUBLE_STREETS,tn as VALID_EUROPEAN_SPLITS,U as VALID_EUROPEAN_STRAIGHTS,rn as VALID_EUROPEAN_STREETS,ue as VALID_RANKS,le as VALID_SUITS,Se as WIN_MULTIPLIER,Rn as Wheel,Pn as WheelRiskLevel,Fn as WheelSegments,C as advancedDiceGetExclusiveBoundsRange,x as advancedDiceGetInclusiveBoundsRange,S as advancedDiceIsWithinBoundsExclusive,b as advancedDiceIsWithinBoundsInclusive,Kt as bigMax,qt as bigMin,w as calculateAdvancedDiceWinChance,D as calculateBaccaratBetAmount,pt as calculateBlitzWinChance,Nt as calculateDiceWinChance,Ue as calculateInsuranceStake,Nn as calculateRouletteBetAmount,Dt as diamondsMultipliers,dt as getBlitzDefaults,St as getMaxMultiplierForDifficulty,ft as hasBlitzWon,Pt as hasDiceWon,Rt as isTileCount,Wt as kenoMultipliers,H as nCr,Qt as plinkoMultipliers,Ut as rtp92Multipliers,Ht as rtp96Multipliers,Vt as rtp97Multipliers,Bt as rtp98Multipliers,zt as rtp99Multipliers,E as sumPayout,se as validateAdvancedDiceInputs,Cn as validateRouletteGameInputs};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@betorigami/game-calculations",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -15,21 +15,12 @@
|
|
|
15
15
|
"files": [
|
|
16
16
|
"dist"
|
|
17
17
|
],
|
|
18
|
-
"scripts": {
|
|
19
|
-
"tsc": "tsc",
|
|
20
|
-
"build": "bun run build.ts",
|
|
21
|
-
"watch": "bun run --watch src/index.ts",
|
|
22
|
-
"test": "bun test",
|
|
23
|
-
"test:watch": "bun test --watch",
|
|
24
|
-
"bundlemon": "bundlemon --subProject game-calculations",
|
|
25
|
-
"format": "biome format --write"
|
|
26
|
-
},
|
|
27
18
|
"devDependencies": {
|
|
19
|
+
"@betorigami/ecvrf": "^1.0.2",
|
|
28
20
|
"@betorigami/provably-fair-rng": "^1.0.0",
|
|
29
|
-
"@tsconfig/bun": "^1.0.8",
|
|
30
21
|
"@types/big.js": "^6.2.2",
|
|
31
|
-
"@types/
|
|
32
|
-
"
|
|
22
|
+
"@types/node": "^26.4.1",
|
|
23
|
+
"tsdown": "^0.23.0",
|
|
33
24
|
"type-fest": "^5.4.4",
|
|
34
25
|
"typescript": "^5.8.3",
|
|
35
26
|
"vitest": "^3.2.4"
|
|
@@ -42,5 +33,14 @@
|
|
|
42
33
|
"@xstate/store": "^3.16.0",
|
|
43
34
|
"big.js": "^7.0.1",
|
|
44
35
|
"fast-deep-equal": "^3.1.3"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"tsc": "tsc",
|
|
39
|
+
"build": "tsdown",
|
|
40
|
+
"watch": "tsdown --watch",
|
|
41
|
+
"test": "vitest run",
|
|
42
|
+
"test:watch": "vitest",
|
|
43
|
+
"bundlemon": "bundlemon --subProject game-calculations",
|
|
44
|
+
"format": "biome format --write"
|
|
45
45
|
}
|
|
46
|
-
}
|
|
46
|
+
}
|