@betorigami/game-calculations 0.0.0-sha-d2b9872-20251208055736 → 0.0.0-sha-b164d9d-20260126031858
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 -0
- package/dist/index.d.ts +1808 -0
- package/dist/index.mjs +1 -0
- package/package.json +6 -1
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var D;((f)=>{f.DICE="DICE";f.MINES="MINES";f.KENO="KENO";f.LIMBO="LIMBO";f.ADVANCED_DICE="ADVANCED_DICE";f.BACCARAT="BACCARAT";f.DIAMONDS="DIAMONDS";f.PLINKO="PLINKO";f.ROULETTE="ROULETTE";f.WHEEL="WHEEL";f.BLACKJACK="BLACKJACK"})(D||={});class x{gameId;constructor(r){this.gameId=r}getGameResult(r){return this.determineGameResult(r)}}import{Big as g}from"big.js";var Wr;((t)=>t.INPUT_VALIDATION_ERROR="INPUT_VALIDATION_ERROR")(Wr||={});class i extends Error{static createValidationError(r){return new i("INPUT_VALIDATION_ERROR",r)}static isGameError(r){return r instanceof i}errorCode;constructor(r,t){super(t);this.errorCode=r}}var rr=0,tr=1e4,ur=10001,Lr=0.01,vr=98,kr=(r)=>{if(r<rr)throw i.createValidationError(`Lower bound ${r} is below minimum allowed value ${rr}`)},Kr=(r)=>{if(r>tr)throw i.createValidationError(`Upper bound ${r} is above maximum allowed value ${tr}`)},z=(r)=>{if(kr(r.lower),Kr(r.upper),r.lower>=r.upper)throw i.createValidationError(`Lower bound ${r.lower} must be less than ${r.upper}`)},gr=(r,t)=>{let[o,c]=r.lower<=t.lower?[r,t]:[t,r];if(o.upper>c.lower)throw i.createValidationError("Bounds must not overlap")},rt=(r,t)=>t>=r.lower&&t<=r.upper,tt=(r)=>r.upper-r.lower+1,k=(r,t)=>t>r.lower&&t<r.upper,K=(r)=>r.upper-r.lower-1,ot;((c)=>{c.ROLL_BETWEEN="ROLL_BETWEEN";c.ROLL_OUTSIDE="ROLL_OUTSIDE";c.ROLL_BETWEEN_TWO="ROLL_BETWEEN_TWO"})(ot||={});var Dr=(r)=>{let o=(()=>{switch(r.mode){case"ROLL_BETWEEN":return z(r.bounds),K(r.bounds);case"ROLL_OUTSIDE":return z(r.bounds),ur-tt(r.bounds);case"ROLL_BETWEEN_TWO":return z(r.firstBounds),z(r.secondBounds),gr(r.firstBounds,r.secondBounds),K(r.firstBounds)+K(r.secondBounds)}})(),c=g(o).div(ur).mul(100);if(c.lt(Lr))throw i.createValidationError("Win chance too low");if(c.gt(vr))throw i.createValidationError("Win chance too high");return c},So=(r)=>{Dr(r)};class ct extends x{constructor(){super("ADVANCED_DICE")}determineGameResult({generator:r,edge:t,gameInputs:o}){let c=Dr(o),a=r.getRandomInt({min:rr,max:tr}),A=a.value;return{isFinished:!0,payoutMultiplier:(()=>{switch(o.mode){case"ROLL_BETWEEN":return k(o.bounds,A);case"ROLL_OUTSIDE":return!rt(o.bounds,A);case"ROLL_BETWEEN_TWO":return k(o.firstBounds,A)||k(o.secondBounds,A)}})()?new g(100-t).div(c):new g(0),outputs:{result:a.values},randomValues:a}}}import T from"big.js";var at=["Clubs","Diamonds","Hearts","Spades"],At=["Ace","2","3","4","5","6","7","8","9","10","Jack","Queen","King"],Et;((c)=>{c.PLAYER_WIN="PLAYER_WIN";c.TIE="TIE";c.BANKER_WIN="BANKER_WIN"})(Et||={});var it;((c)=>{c.PLAYER="PLAYER";c.TIE="TIE";c.BANKER="BANKER"})(it||={});var ft={["PLAYER_WIN"]:{betType:"PLAYER",multiplier:2},["TIE"]:{betType:"TIE",multiplier:9},["BANKER_WIN"]:{betType:"BANKER",multiplier:1.95}},pt=(r)=>{return new T(0).add(r.bets.reduce((o,c)=>o.add(c.amount),new T(0)))};class dt extends x{constructor(){super("BACCARAT")}determineGameResult({generator:r,gameInputs:t,edge:o}){if(o!==1)throw new Error("Baccarat is only available at 1% edge.");this.validateGameInputs(t);let c=r.getRandomIntsWithReplacement({min:0,max:51,count:6}),a=c.values,A=a.slice(0,3),E=a.slice(3,6),p=[],d=0;for(let h of A.slice(0,2)){let n=this.mapRandomValueToCard(h),$=this.mapRandomValueToCardValue(h);p.push(n),d=(d+$)%10}let B=[],O=0;for(let h of E.slice(0,2)){let n=this.mapRandomValueToCard(h),$=this.mapRandomValueToCardValue(h);B.push(n),O=(O+$)%10}if(!this.isNaturalWin(d,O)){let h=this.shouldDrawThirdPlayerCard(d),n=null;if(h)n=this.mapRandomValueToCardValue(A[2]),p.push(this.mapRandomValueToCard(A[2])),d=(d+n)%10;if(this.shouldDrawThirdBankerCard(O,n))B.push(this.mapRandomValueToCard(E[2])),O=(O+this.mapRandomValueToCardValue(E[2]))%10}let f;if(d===O)f="TIE";else f=d>O?"PLAYER_WIN":"BANKER_WIN";let u=pt(t),{betType:S,multiplier:Y}=ft[f],m=new T(0);if(m=m.add(t.bets.filter((h)=>h.type===S).reduce((h,n)=>h.add(n.amount.mul(Y)),new T(0))),f==="TIE")m=m.add(t.bets.filter((h)=>h.type==="PLAYER"||h.type==="BANKER").reduce((h,n)=>h.add(n.amount),new T(0)));return{isFinished:!0,payoutMultiplier:u.gt(0)?m.div(u):new T(0),outputs:{playerCards:p,playerHandValue:d,bankerCards:B,bankerHandValue:O,gameOutcome:f,result:c.values},randomValues:c}}validateGameInputs(r){if(r.bets.length===0)throw new Error("Must place at least a single bet.");if(!r.bets.every((t)=>t.amount.gte(0)))throw new Error("Invalid bet.")}mapRandomValueToCard(r){let t=at[Math.floor(r/13)],o=At[r%13];return{suit:t,rank:o}}isNaturalWin(r,t){let o=[8,9];return o.includes(r)||o.includes(t)}mapRandomValueToCardValue(r){let t=r%13;if(t===0)return 1;if(t>=10)return 10;return t+1}shouldDrawThirdPlayerCard(r){return r<=5}shouldDrawThirdBankerCard(r,t){if(t===null)return r<=5;if(r<=2)return!0;if(r===3)return t!==8;if(r===4)return[2,3,4,5,6,7].includes(t);if(r===5)return[4,5,6,7].includes(t);if(r===6)return[6,7].includes(t);return!1}}import wr from"big.js";import{Guard as pr}from"@betorigami/guard";import{Guard as Er}from"@betorigami/guard";import{Guard as Bt}from"@betorigami/guard";var or=0,cr=51,J=Array.from({length:52},(r,t)=>t);class ar{value;constructor(r){let t=J[r];Bt.againstNullOrUndefined(t,`Invalid card value: ${r}`),this.value=t}get suit(){return Math.floor(this.value/13)}get rank(){return this.value%13}serialise(){return{rank:this.rank,suit:this.suit,cardValue:this.value}}}var nr=2.5,yr=2,Cr=1,Zr=0,Sr=17,s=21;var Tr=63;var Ar=10,_r=10;class C extends ar{get numericRank(){if(this.rank>=10)return _r;return this.rank+1}static fromValue(r){if(J.includes(r))return new C(r);throw new Error(`Invalid card value: ${r}`)}}class U{cards;hardHandValue;softHandValue=null;constructor(r){this.cards=r;if(this.hardHandValue=r.reduce((o,c)=>o+c.numericRank,0),r.some((o)=>o.rank===0)&&this.hardHandValue+Ar<=s)this.softHandValue=this.hardHandValue+Ar}get cardCount(){return this.cards.length}get hasSoftHandValue(){return this.softHandValue!==null}get isBusted(){return this.hardHandValue>s}get isBlackjack(){return this.cardCount===2&&this.highestHandValue===s}get highestHandValue(){return this.softHandValue!==null?this.softHandValue:this.hardHandValue}serialise(){return this.cards.map((r)=>r.serialise())}}class _{cards;value;constructor(r){this.cards=r.map((t)=>C.fromValue(t)),this.value=new U(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((r)=>r.value)}toDto(){return{cards:this.cards.map((r)=>r.serialise()),value:this.highestHandValue}}}class b extends _{otherCards;upCard;holeCard;constructor(r,t,o=[]){super([r,t,...o]);this.otherCards=o;this.upCard=C.fromValue(r),this.holeCard=C.fromValue(t)}static withInitialDeal(r){return new b(r.upCard,r.holeCard)}addDrawnCards(r){return new b(this.upCard.value,this.holeCard.value,[...this.otherCards,...r])}toDto(r=!1){if(r)return super.toDto();return{cards:[this.upCard.serialise()],value:new U([this.upCard]).highestHandValue}}}class V extends _{static withInitialDeal(r){return new V(r)}addDrawnCards(r){return new V([...this.rawValues,...r])}}var q;((a)=>{a.WIN="WIN";a.LOSE="LOSE";a.PUSH="PUSH";a.PLAYER_BLACKJACK="PLAYER_BLACKJACK"})(q||={});var X;((c)=>{c.START="START";c.HIT="HIT";c.STAND="STAND"})(X||={});class y{deck;playerHand;dealerHand;outcome;constructor(r,t,o,c){this.deck=r;this.playerHand=t;this.dealerHand=o;this.outcome=c}get isFinished(){return this.outcome!==null}toDto(){return{playerHand:this.playerHand.toDto(),dealerHand:this.dealerHand.toDto(this.isFinished),outcome:this.outcome}}static start(r){let t=r.drawCard(),o=r.drawCard(),c=r.drawCard(),a=r.drawCard(),A=V.withInitialDeal([t.value,o.value]),E=b.withInitialDeal({upCard:c.value,holeCard:a.value}),p=A.isBlackjack,d=E.isBlackjack,B=null;if(p&&d)B="PUSH";else if(p)B="PLAYER_BLACKJACK";else if(d)B="LOSE";return new y(r,A,E,B)}applyAction(r){switch(r){case"HIT":return this.hit();case"STAND":return this.stand();case"START":throw new Error("START cannot be applied to an existing state.");default:throw Er.againstNever(r,`Unknown action: ${r}`),new Error(`Unknown action: ${r}`)}}hit(){Er.against(this.isFinished,"Cannot hit on a finished game.");let r=this.deck.drawCard(),t=this.playerHand.addDrawnCards([r.value]);if(t.isBusted)return new y(this.deck,t,this.dealerHand,"LOSE");if(t.highestHandValue===21)return new y(this.deck,t,this.dealerHand,null).stand();return new y(this.deck,t,this.dealerHand,null)}stand(){Er.against(this.isFinished,"Cannot stand on a finished game.");let r=this.playDealerHand(),t=y.calculateOutcome(this.playerHand,r);return new y(this.deck,this.playerHand,r,t)}static calculateOutcome(r,t){if(r.isBusted)return"LOSE";if(t.isBusted)return"WIN";let o=r.highestHandValue,c=t.highestHandValue;if(o>c)return"WIN";if(o<c)return"LOSE";return"PUSH"}playDealerHand(){let r=this.dealerHand;while(r.highestHandValue<Sr){let t=this.deck.drawCard();r=r.addDrawnCards([t.value])}return r}}import{Guard as xt}from"@betorigami/guard";class ir{values;proofHash;proofString;index=0;constructor(r){let t=r.getRandomIntsWithReplacement({min:or,max:cr,count:Tr});this.values=t.values.map((o)=>new C(o)),this.proofHash=t.proofHash,this.proofString=t.proofString}drawCard(){return xt.against(this.index>=this.values.length,"Card drawer exhausted - pre-drawn values depleted"),this.values[this.index++]}getConsumedRandomValues(){return{values:this.values.slice(0,this.index).map((r)=>r.value),count:this.index,min:or,max:cr,proofHash:this.proofHash,proofString:this.proofString}}}import Q from"big.js";var fr={PLAYER_BLACKJACK:Q(nr),WIN:Q(yr),PUSH:Q(Cr),LOSE:Q(Zr)};class Gr extends x{constructor(){super("BLACKJACK")}determineGameResult({generator:r,gameInputs:t}){let{previousActions:o,nextAction:c}=t,a=new ir(r);if(c==="START"){pr.against(o.length>0,"START action requires previousActions to be empty.");let f=y.start(a),u=f.isFinished,S=f.outcome!==null?fr[f.outcome]:wr(0),Y=a.getConsumedRandomValues();return{isFinished:u,payoutMultiplier:S,outputs:{action:c,state:f.toDto(),result:u?Y.values:[]},randomValues:Y}}pr.against(o[0]!=="START","previousActions must start with START.");let E=o.slice(1).reduce((f,u)=>f.applyAction(u),y.start(a));pr.against(E.isFinished,`Cannot process action "${c}" on a finished game with outcome "${E.outcome}".`);let p=E.applyAction(c),d=p.isFinished,B=p.outcome!==null?fr[p.outcome]:wr(0),O=a.getConsumedRandomValues();return{isFinished:d,payoutMultiplier:B,outputs:{action:c,state:p.toDto(),result:d?O.values:[]},randomValues:O}}}import ht from"big.js";class Z{multipliers;constructor(r){this.multipliers=r}getMultipliers(r){let t=this.multipliers.get(r);if(t===void 0)throw new Error(`Multipliers for ${r} not found`);return t}getAllMultipliers(){return Array.from(this.multipliers.entries()).map(([r,t])=>({edge:r,multipliers:t}))}}var ut;((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"})(ut||={});var Dt={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},nt={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},yt={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},Ct={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},Zt={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},St=new Z(new Map([[1,Dt],[2,nt],[3,yt],[4,Ct],[8,Zt]])),Tt={2:"PAIR",3:"THREE_OF_A_KIND",4:"FOUR_OF_A_KIND",5:"FIVE_OF_A_KIND"};class _t extends x{constructor(){super("DIAMONDS")}determineGameResult({generator:r,edge:t}){let o=r.getRandomIntsWithReplacement({min:0,max:6,count:5}),c=St.getMultipliers(t),a=o.values,A=this.calculatePayoutMultiplier(c,a);return{isFinished:!0,payoutMultiplier:ht(A),outputs:{result:o.values},randomValues:o}}calculatePayoutMultiplier(r,t){let o=new Map;for(let A of t){let E=o.get(A)||0;o.set(A,E+1)}let c=[...o.values()].filter((A)=>A>1),a=this.classifyResult(c);return a===null?0:r[a]}classifyResult(r){if(r.length>2)throw new Error(`Unexpected number of repeats ${r.length}`);let[t,o]=r;if(t===void 0)return null;if(o===void 0){let c=Tt[t];if(c===void 0)throw new Error(`Unexpected single diamond repeat count: ${t}`);return c}return t===3||o===3?"FULL_HOUSE":"TWO_PAIR"}}import dr from"big.js";var wt;((o)=>{o.ABOVE="ABOVE";o.BELOW="BELOW"})(wt||={});class Gt extends x{constructor(){super("DICE")}determineGameResult({generator:r,edge:t,gameInputs:o}){let c=r.getRandomInt({min:0,max:1e4}),a=c.min,p=c.max-a+1-1,d=o.direction==="ABOVE"?p-o.selectedValue:o.selectedValue,B=new dr(d).div(p).mul(100);return{isFinished:!0,payoutMultiplier:(o.direction==="ABOVE"?c.value>o.selectedValue:c.value<o.selectedValue)?new dr(100-t).div(B):new dr(0),outputs:{result:c.values},randomValues:c}}}import bt from"big.js";import{Guard as e}from"@betorigami/guard";var Nr;((a)=>{a.CLASSIC="CLASSIC";a.LOW_RISK="LOW_RISK";a.MEDIUM_RISK="MEDIUM_RISK";a.HIGH_RISK="HIGH_RISK"})(Nr||={});var Nt=[1,2,3,4,5,6,7,8,9,10],Hr=(r)=>{return Nt.includes(r)};var Ht={[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]}},jt={[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]}},lt={[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]}},mt={[1]:{CLASSIC:[0,3.88],LOW_RISK:[0.68,1.84],MEDIUM_RISK:[0.38,2.74],HIGH_RISK:[0,3.88]},[2]:{CLASSIC:[0,1.85,4.48],LOW_RISK:[0,1.96,3.75],MEDIUM_RISK:[0,1.77,5],HIGH_RISK:[0,0,16.82]},[3]:{CLASSIC:[0,1,3.05,9.35],LOW_RISK:[0,1.07,1.37,25.7],MEDIUM_RISK:[0,0,2.74,49],HIGH_RISK:[0,0,0,79.9]},[4]:{CLASSIC:[0,0.8,1.72,4.95,22.3],LOW_RISK:[0,0,2.15,7.86,87],MEDIUM_RISK:[0,0,1.67,9.7,100],HIGH_RISK:[0,0,0,9.7,256]},[5]:{CLASSIC:[0,0.24,1.38,4,16.3,35.5],LOW_RISK:[0,0,1.48,4.1,12.43,300],MEDIUM_RISK:[0,0,1.35,3.96,13.8,389],HIGH_RISK:[0,0,0,4.4,47,444]},[6]:{CLASSIC:[0,0,1,3.57,6.8,16.2,37],LOW_RISK:[0,0,1.06,1.96,6.16,99,700],MEDIUM_RISK:[0,0,0,2.9,8.9,178,709],HIGH_RISK:[0,0,0,0,10.4,347,709]},[7]:{CLASSIC:[0,0,0.45,2.95,4.44,13.85,30,60],LOW_RISK:[0,0,1.07,1.57,3.47,14.57,225,700],MEDIUM_RISK:[0,0,0,1.95,6.8,29.8,400,800],HIGH_RISK:[0,0,0,0,6.8,88.2,400,800]},[8]:{CLASSIC:[0,0,0,2.15,3.9,12.9,21.9,55,70],LOW_RISK:[0,0,1.08,1.45,1.98,5.48,38.8,100,800],MEDIUM_RISK:[0,0,0,1.95,3.96,10.6,66.9,396,896],HIGH_RISK:[0,0,0,0,4.9,19.2,269,599,896]},[9]:{CLASSIC:[0,0,0,1.5,2.95,7.96,14.96,44,60,85],LOW_RISK:[0,0,1.05,1.29,1.69,2.49,7.49,49,250,1000],MEDIUM_RISK:[0,0,0,1.95,2.47,4.9,14.9,99,500,1000],HIGH_RISK:[0,0,0,0,3.96,10.5,55,500,800,1000]},[10]:{CLASSIC:[0,0,0,1.37,2.2,4.45,7.7,16.7,50,80,100],LOW_RISK:[0,0,1.08,1.18,1.28,1.76,3.4,12.9,50,250,1000],MEDIUM_RISK:[0,0,0,1.57,1.95,3.96,6.9,25.5,100,500,1000],HIGH_RISK:[0,0,0,0,3.43,7.9,12.5,60,500,800,1000]}},Ut={[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]}},jr=new Z(new Map([[1,Ht],[2,jt],[3,lt],[4,mt],[8,Ut]]));class Vt extends x{constructor(){super("KENO")}determineGameResult({generator:r,edge:t,gameInputs:o}){e.againstEmptyArray(o.selectedNumbers,()=>i.createValidationError("No numbers selected")),e.against(o.selectedNumbers.length>10,()=>i.createValidationError("Maximum of 10 numbers can be selected"));for(let f of o.selectedNumbers)e.againstNonInteger(f,()=>i.createValidationError("Only integers can be selected")),e.against(f<0||f>39,()=>i.createValidationError("Invalid number selected"));let c=r.getUniqueRandomInts({min:0,max:39,count:10}),a=o.selectedNumbers.filter((f)=>c.values.includes(f)),A=o.selectedNumbers.length;if(!Hr(A))throw new Error(`Invalid tile count: ${A}`);let B=jr.getMultipliers(t)[A][o.riskLevel][a.length];if(B===void 0)throw new Error(`No multiplier found for matching tile count ${a.length}`);return{isFinished:!0,payoutMultiplier:new bt(B),outputs:{result:c.values},randomValues:c}}}import w from"big.js";var lr=(r,t)=>{return r.gt(t)?r:t};var mr=(r,t)=>{return r.lt(t)?r:t};class Mt extends x{constructor(){super("LIMBO")}determineGameResult({generator:r,edge:t,gameInputs:o}){let c=r.getRandomInt({min:1,max:4294967295}),a=c.max,A=new w(16777216),E=new w(1),p=new w(1e6),d=c.value,B=new w(d-1).div(a),O=(100-t)/100,f=A.div(B.mul(A).plus(1)).mul(O),u=lr(E,mr(f,p));return{isFinished:!0,payoutMultiplier:u.gte(o.targetMultiplier)?new w(o.targetMultiplier):new w(0),outputs:{randomMultiplier:u,result:c.values},randomValues:c}}}import R from"big.js";var Br=(r,t)=>{if(t<0||r<0||t>r)throw new Error("Invalid input: ensure 0 ≤ r ≤ n and n ≥ 0.");if(t>r-t)t=r-t;let o=1;for(let c=1;c<=t;c++)o=o*(r-c+1)/c;return o};class Pt extends x{constructor(){super("MINES")}determineGameResult({generator:r,edge:t,gameInputs:o}){if(o.minesCount<=0||o.minesCount>24)throw new Error("Must select between 1 and 24 mines.");if(o.selectedTiles.length>25-o.minesCount)throw new Error("Cannot select more tiles than available safe tiles (total tiles minus mines).");let E=r.getUniqueRandomInts({min:1,max:25,count:o.minesCount}),p=E.values.some((S)=>o.selectedTiles.includes(S)),d=o.hasCashedOut||p,B=(100-t)/100,O=new R(Br(25-o.minesCount,o.selectedTiles.length)).div(new R(Br(25,o.selectedTiles.length))),u=o.hasCashedOut&&!p?new R(B).div(O):new R(0);return{isFinished:d,payoutMultiplier:u,outputs:{result:E.values},randomValues:E}}}import{Big as Jt}from"big.js";var Ur;((c)=>{c.LOW_RISK="LOW_RISK";c.MEDIUM_RISK="MEDIUM_RISK";c.HIGH_RISK="HIGH_RISK"})(Ur||={});var da=[8,9,10,11,12,13,14,15,16],Ft={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]}},It={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]}},Yt={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]}},$t={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]}},zt={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]}},br=new Z(new Map([[1,Ft],[2,It],[3,Yt],[4,$t],[8,zt]]));class st extends x{constructor(){super("PLINKO")}determineGameResult({generator:r,gameInputs:t,edge:o}){if(t.numberOfRows%1>0)throw new Error("Number of rows must be an integer");if(t.numberOfRows<8||t.numberOfRows>16)throw new Error("Number of rows must be between 8 and 16");let c=t.numberOfRows,E=br.getMultipliers(o)[t.riskLevel][c],p=r.getRandomIntsWithReplacement({min:0,max:1,count:t.numberOfRows}),B=p.values.reduce((f,u)=>f+u,0),O=E[B];if(O===void 0)throw new Error(`No payout found for end position ${B}`);return{isFinished:!0,payoutMultiplier:Jt(O),outputs:{result:p.values},randomValues:p}}}import{Big as v}from"big.js";var Or=[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],Vr=[37,...Or],Mr=[[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]],Pr=[[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]],Fr=[[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]],Ir=[[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]],Yr=[[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]],$r=[[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]],zr=[0,1,2,3,37],Jr=[[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]],sr=[[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]],G;((o)=>{o.EVEN="EVEN";o.ODD="ODD"})(G||={});var N;((o)=>{o.RED="RED";o.BLACK="BLACK"})(N||={});var H;((o)=>{o.LOW="LOW";o.HIGH="HIGH"})(H||={});var j;((c)=>{c.TOP="TOP";c.MIDDLE="MIDDLE";c.BOTTOM="BOTTOM"})(j||={});var l;((c)=>{c.FIRST="FIRST";c.SECOND="SECOND";c.THIRD="THIRD"})(l||={});var xr;((o)=>{o.AMERICAN="AMERICAN";o.EUROPEAN="EUROPEAN"})(xr||={});var W=(r)=>{if(r.straightBets.length===0&&r.splitBets.length===0&&r.streetBets.length===0&&r.cornerBets.length===0&&r.doubleStreetBets.length===0&&r.parityBets.length===0&&r.colorBets.length===0&&r.halfBets.length===0&&r.columnBets.length===0&&r.dozenBets.length===0)throw i.createValidationError("Must place at least a single bet.");if(!r.straightBets.every((t)=>t.amount.gte(0)&&M(t.value)))throw i.createValidationError("Invalid straight bet.");if(!r.splitBets.every((t)=>t.amount.gte(0)&&qt(t.values)))throw i.createValidationError("Invalid split bet.");if(!r.streetBets.every((t)=>t.amount.gte(0)&&Xt(t.values)))throw i.createValidationError("Invalid street bet.");if(!r.cornerBets.every((t)=>t.amount.gte(0)&&Qt(t.values)))throw i.createValidationError("Invalid corner bet.");if(!r.doubleStreetBets.every((t)=>t.amount.gte(0)&&et(t.values)))throw i.createValidationError("Invalid double street bet.");if(!r.parityBets.every((t)=>t.amount.gte(0)&&Object.values(G).includes(t.parity)))throw i.createValidationError("Invalid parity bet.");if(!r.colorBets.every((t)=>t.amount.gte(0)&&Object.values(N).includes(t.color)))throw i.createValidationError("Invalid color bet.");if(!r.halfBets.every((t)=>t.amount.gte(0)&&Object.values(H).includes(t.half)))throw i.createValidationError("Invalid half bet.");if(!r.columnBets.every((t)=>t.amount.gte(0)&&Object.values(j).includes(t.column)))throw i.createValidationError("Invalid column bet.");if(!r.dozenBets.every((t)=>t.amount.gte(0)&&Object.values(l).includes(t.dozen)))throw i.createValidationError("Invalid dozen bet.")},M=(r)=>{return Or.includes(r)},qt=(r)=>{if(r.length!==2)return!1;if(!r.every(M))return!1;return Mr.some(([t,o])=>t===r[0]&&o===r[1])},Xt=(r)=>{if(r.length!==3)return!1;if(!r.every(M))return!1;return Fr.some(([t,o,c])=>t===r[0]&&o===r[1]&&c===r[2])},Qt=(r)=>{if(r.length!==4)return!1;if(!r.every(M))return!1;return Yr.some(([t,o,c,a])=>t===r[0]&&o===r[1]&&c===r[2]&&a===r[3])},et=(r)=>{if(r.length!==6)return!1;if(!r.every(M))return!1;return Jr.some(([t,o,c,a,A,E])=>t===r[0]&&o===r[1]&&c===r[2]&&a===r[3]&&A===r[4]&&E===r[5])};var L=(r)=>{if(r.straightBets.length===0&&r.splitBets.length===0&&r.streetBets.length===0&&r.cornerBets.length===0&&r.basketBets.length===0&&r.doubleStreetBets.length===0&&r.parityBets.length===0&&r.colorBets.length===0&&r.halfBets.length===0&&r.columnBets.length===0&&r.dozenBets.length===0)throw i.createValidationError("Must place at least a single bet.");if(!r.straightBets.every((t)=>t.amount.gte(0)&&P(t.value)))throw i.createValidationError("Invalid straight bet.");if(!r.splitBets.every((t)=>t.amount.gte(0)&&Rt(t.values)))throw i.createValidationError("Invalid split bet.");if(!r.streetBets.every((t)=>t.amount.gte(0)&&Wt(t.values)))throw i.createValidationError("Invalid street bet.");if(!r.cornerBets.every((t)=>t.amount.gte(0)&&Lt(t.values)))throw i.createValidationError("Invalid corner bet.");if(!r.basketBets.every((t)=>t.amount.gte(0)))throw i.createValidationError("Invalid basket bet.");if(!r.doubleStreetBets.every((t)=>t.amount.gte(0)&&vt(t.values)))throw i.createValidationError("Invalid double street bet.");if(!r.parityBets.every((t)=>t.amount.gte(0)&&Object.values(G).includes(t.parity)))throw i.createValidationError("Invalid parity bet.");if(!r.colorBets.every((t)=>t.amount.gte(0)&&Object.values(N).includes(t.color)))throw i.createValidationError("Invalid color bet.");if(!r.halfBets.every((t)=>t.amount.gte(0)&&Object.values(H).includes(t.half)))throw i.createValidationError("Invalid half bet.");if(!r.columnBets.every((t)=>t.amount.gte(0)&&Object.values(j).includes(t.column)))throw i.createValidationError("Invalid column bet.");if(!r.dozenBets.every((t)=>t.amount.gte(0)&&Object.values(l).includes(t.dozen)))throw i.createValidationError("Invalid dozen bet.")},P=(r)=>{return Vr.includes(r)};function Rt(r){if(r.length!==2)return!1;if(!r.every(P))return!1;return Pr.some(([t,o])=>t===r[0]&&o===r[1])}var Wt=(r)=>{if(r.length!==3)return!1;if(!r.every(P))return!1;return Ir.some(([t,o,c])=>t===r[0]&&o===r[1]&&c===r[2])},Lt=(r)=>{if(r.length!==4)return!1;if(!r.every(P))return!1;return $r.some(([t,o,c,a])=>t===r[0]&&o===r[1]&&c===r[2]&&a===r[3])},vt=(r)=>{if(r.length!==6)return!1;if(!r.every(P))return!1;return sr.some(([t,o,c,a,A,E])=>t===r[0]&&o===r[1]&&c===r[2]&&a===r[3]&&A===r[4]&&E===r[5])};var kt={straightBets:36,splitBets:18,streetBets:12,cornerBets:9,basketBets:7,doubleStreetBets:6,parityBets:2,colorBets:2,halfBets:2,columnBets:3,dozenBets:3},Kt=[3,6,9,12,15,18,21,24,27,30,33,36],gt=[2,5,8,11,14,17,20,23,26,29,32,35],ro=[1,4,7,10,13,16,19,22,25,28,31,34],to=[1,3,5,7,9,12,14,16,18,19,21,23,25,27,30,32,34,36],oo=[2,4,6,8,10,11,13,15,17,20,22,24,26,28,29,31,33,35],co=2.7,ao=5.3;class hr extends x{constructor(){super("ROULETTE")}determineGameResult({generator:r,gameInputs:t}){this.validateInputs(t);let o=r.getRandomInt({min:0,max:this.maxNumber}),c=o.value,a=this.determineBetOutcomes(t,c),{payoutMultiplier:A}=this.getPayoutDetails(t,c);return{outputs:{betOutcomes:a,result:o.values},payoutMultiplier:A,isFinished:!0,randomValues:o}}getBetAmount(r){return this.calculateTotalBetAmount(this.getBetTotals(r))}getPayoutDetails(r,t){let o=this.determineBetOutcomes(r,t),c=this.getBetTotals(r),a=this.getBetTotals(o.winningBets),A=this.calculateTotalBetAmount(c),E=this.calculateTotalPayout(a);return{payoutMultiplier:A.gt(0)?E.div(A):new v(0),payoutAmount:E}}determineBetOutcomes(r,t){let o={},c={};for(let a of Object.keys(r)){let A=r[a],E=this.betPredicates[a],{winning:p,losing:d}=this.partitionBets(A,E,t);o[a]=p,c[a]=d}return{winningBets:o,losingBets:c}}calculateTotalAmount(r){return r.reduce((t,o)=>t.plus(o.amount),new v(0))}isWinningStraightBet(r,t){return r.value===t}isWinningSplitBet(r,t){return r.values.some((o)=>o===t)}isWinningStreetBet(r,t){return r.values.some((o)=>o===t)}isWinningCornerBet(r,t){return r.values.some((o)=>o===t)}isWinningDoubleStreetBet(r,t){return r.values.some((o)=>o===t)}isWinningColorBet(r,t){let o=r;return to.includes(t)&&o.color==="RED"||oo.includes(t)&&o.color==="BLACK"}isWinningHalfBet(r,t){let o=r;if(t>0&&t<=18&&o.half==="LOW")return!0;if(t>18&&t<=36&&o.half==="HIGH")return!0;return!1}isWinningColumnBet(r,t){let o=r;return Kt.includes(t)&&o.column==="TOP"||gt.includes(t)&&o.column==="MIDDLE"||ro.includes(t)&&o.column==="BOTTOM"}isWinningDozenBet(r,t){let o=r;if(t>0&&t<=12&&o.dozen==="FIRST")return!0;if(t>12&&t<=24&&o.dozen==="SECOND")return!0;if(t>24&&t<=36&&o.dozen==="THIRD")return!0;return!1}isWinningParityBet(r,t){let o=r;if(t===0||t===37)return!1;let c=t%2===0?"EVEN":"ODD";return o.parity===c}getBetTotals(r){let t={};for(let o of Object.keys(r))t[o]=this.calculateTotalAmount(r[o]);return t}calculateTotalBetAmount(r){return Object.values(r).reduce((t,o)=>t.plus(o),new v(0))}partitionBets(r,t,o){return{winning:r.filter((c)=>t(c,o)),losing:r.filter((c)=>!t(c,o))}}calculateTotalPayout(r){return Object.entries(r).reduce((t,[o,c])=>{let A=kt[o];return t.plus(c.mul(A||0))},new v(0))}}class qr extends hr{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};validateInputs(r){W(r)}}class Xr extends hr{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};validateInputs(r){L(r)}isWinningBasketBet(r,t){return zr.some((o)=>o===t)}}class Qr extends x{europeanGame;americanGame;constructor(){super("ROULETTE");this.europeanGame=new qr,this.americanGame=new Xr}getBetAmount(r){switch(r.type){case"AMERICAN":return this.americanGame.getBetAmount(r.inputs);case"EUROPEAN":return this.europeanGame.getBetAmount(r.inputs);default:throw new Error("Unhandled roulette type")}}determineGameResult(r){let{gameInputs:t,...o}=r;if(r.edge===co&&t.type==="EUROPEAN"){let c=this.europeanGame.determineGameResult({...o,gameInputs:t.inputs}),{betOutcomes:a}=c.outputs;return{...c,outputs:{type:"european",betOutcomes:a,result:c.outputs.result}}}if(r.edge===ao&&t.type==="AMERICAN"){let c=this.americanGame.determineGameResult({...o,gameInputs:t.inputs}),{betOutcomes:a}=c.outputs;return{...c,outputs:{type:"american",betOutcomes:a,result:c.outputs.result}}}throw i.createValidationError(`Attempted to play ${t.type} roulette on edge ${r.edge}`)}}var Va=(r)=>{return new Qr().getBetAmount(r)};var Ya=(r)=>{if(r.type==="EUROPEAN")W(r.inputs);else L(r.inputs)};import{Big as Bo}from"big.js";var F;((c)=>{c.LOW_RISK="LOW_RISK";c.MEDIUM_RISK="MEDIUM_RISK";c.HIGH_RISK="HIGH_RISK"})(F||={});var I;((A)=>{A[A.TEN=10]="TEN";A[A.TWENTY=20]="TWENTY";A[A.THIRTY=30]="THIRTY";A[A.FORTY=40]="FORTY";A[A.FIFTY=50]="FIFTY"})(I||={});var Ao={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}}},Eo={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}}},io={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}}},fo={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}}},po={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}}},er=new Z(new Map([[1,Ao],[2,Eo],[3,io],[4,fo],[8,po]]));var Rr={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 Oo extends x{constructor(){super("WHEEL")}determineGameResult({generator:r,gameInputs:t,edge:o}){if(!Object.values(I).includes(t.segments))throw new Error("Invalid segments value");if(!Object.values(F).includes(t.riskLevel))throw new Error("Invalid risk level");let a=er.getMultipliers(o)[t.riskLevel];if(a===void 0)throw new Error(`No multipliers found for risk level ${t.riskLevel}`);let A=a[t.segments];if(A===void 0)throw new Error(`No multipliers found for segment ${t.segments}`);let E=Rr[t.riskLevel];if(E===void 0)throw new Error(`No patterns found for risk level ${t.riskLevel}`);let p=E[t.segments];if(p===void 0)throw new Error(`No patterns found for segment ${t.segments}`);let d=r.getRandomInt({min:0,max:p.length-1}),B=p[d.value];if(B===void 0)throw new Error(`No pattern found for segment ${t.segments} and value ${d.value}`);let O=A[B];if(O===void 0)throw new Error(`No payout found for picked segment ${B}`);return{isFinished:!0,payoutMultiplier:new Bo(O),outputs:{result:d.values},randomValues:d}}}export{Ya as validateRouletteGameInputs,So as validateAdvancedDiceInputs,Ht as rtp99Multipliers,jt as rtp98Multipliers,lt as rtp97Multipliers,mt as rtp96Multipliers,Ut as rtp92Multipliers,br as plinkoMultipliers,jr as kenoMultipliers,Hr as isTileCount,St as diamondsMultipliers,Va as calculateRouletteBetAmount,pt as calculateBaccaratBetAmount,I as WheelSegments,F as WheelRiskLevel,Oo as Wheel,at as VALID_SUITS,At as VALID_RANKS,Fr as VALID_EUROPEAN_STREETS,Or as VALID_EUROPEAN_STRAIGHTS,Mr as VALID_EUROPEAN_SPLITS,Jr as VALID_EUROPEAN_DOUBLE_STREETS,Yr as VALID_EUROPEAN_CORNERS,Ir as VALID_AMERICAN_STREETS,Vr as VALID_AMERICAN_STRAIGHTS,Pr as VALID_AMERICAN_SPLITS,sr as VALID_AMERICAN_DOUBLE_STREETS,$r as VALID_AMERICAN_CORNERS,Kt as TOP_COLUMN,Nt as TILE_COUNTS,xr as RouletteType,Qr as Roulette,ot as RollType,to as RED_NUMBERS,rr as RANDOM_MIN_VALUE,tr as RANDOM_MAX_VALUE,Ur as PlinkoRiskLevel,st as Plinko,G as Parity,da as PLINKO_ROW_COUNTS,kt as PAYOUT_MULTIPLIERS,D as OrigamiGame,Pt as Mines,Lr as MIN_WIN_CHANCE,gt as MIDDLE_COLUMN,vr as MAX_WIN_CHANCE,Mt as Limbo,Nr as KenoRiskLevel,Vt as Keno,H as Half,Wr as GameErrorCode,i as GameError,x as Game,qr as EuropeanRoulette,co as EUROPEAN_HOUSE_EDGE,ur as EFFECTIVE_RANGE,l as Dozen,wt as DiceDirection,Gt as Dice,ut as DiamondsResultType,_t as Diamonds,j as Column,N as Color,q as BlackjackOutcome,_ as BlackjackHand,X as BlackjackAction,Gr as Blackjack,Et as BaccaratOutcome,it as BaccaratBetType,dt as Baccarat,ro as BOTTOM_COLUMN,oo as BLACK_NUMBERS,Xr as AmericanRoulette,ct as AdvancedDice,ao as AMERICAN_HOUSE_EDGE,zr as AMERICAN_BASKET};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@betorigami/game-calculations",
|
|
3
|
-
"version": "0.0.0-sha-
|
|
3
|
+
"version": "0.0.0-sha-b164d9d-20260126031858",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@betorigami/provably-fair-rng": "^1.0.0",
|
|
28
28
|
"@tsconfig/bun": "^1.0.8",
|
|
29
|
+
"@types/big.js": "^6.2.2",
|
|
29
30
|
"@types/bun": "^1.2.17",
|
|
30
31
|
"bun-plugin-dts": "^0.3.0",
|
|
31
32
|
"typescript": "^5.8.3",
|
|
@@ -33,5 +34,9 @@
|
|
|
33
34
|
},
|
|
34
35
|
"publishConfig": {
|
|
35
36
|
"access": "public"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@betorigami/guard": "^2.0.5",
|
|
40
|
+
"big.js": "^7.0.1"
|
|
36
41
|
}
|
|
37
42
|
}
|