@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 CHANGED
@@ -1 +1 @@
1
- var Kr=Object.create;var{getPrototypeOf:vr,defineProperty:Q,getOwnPropertyNames:Ra,getOwnPropertyDescriptor:tn}=Object,_a=Object.prototype.hasOwnProperty;var O=(t,a,r)=>{r=t!=null?Kr(vr(t)):{};let n=a||!t||!t.__esModule?Q(r,"default",{value:t,enumerable:!0}):r;for(let o of Ra(t))if(!_a.call(n,o))Q(n,o,{get:()=>t[o],enumerable:!0});return n},Ta=new WeakMap,an=(t)=>{var a=Ta.get(t),r;if(a)return a;if(a=Q({},"__esModule",{value:!0}),t&&typeof t==="object"||typeof t==="function")Ra(t).map((n)=>!_a.call(a,n)&&Q(a,n,{get:()=>t[n],enumerable:!(r=tn(t,n))||r.enumerable}));return Ta.set(t,a),a};var rn=(t,a)=>{for(var r in a)Q(t,r,{get:a[r],enumerable:!0,configurable:!0,set:(n)=>a[r]=()=>n})};var oe={};rn(oe,{validateRouletteGameInputs:()=>Ca,validateAdvancedDiceInputs:()=>cn,sumPayout:()=>T,rtp99Multipliers:()=>_r,rtp98Multipliers:()=>Nr,rtp97Multipliers:()=>kr,rtp96Multipliers:()=>wr,rtp92Multipliers:()=>Vr,plinkoMultipliers:()=>pa,nCr:()=>kt,kenoMultipliers:()=>ua,isTileCount:()=>la,hasDiceWon:()=>jr,hasBlitzWon:()=>Er,getMaxMultiplierForDifficulty:()=>Tn,getBlitzDefaults:()=>On,diamondsMultipliers:()=>hr,calculateRouletteBetAmount:()=>vn,calculateInsuranceStake:()=>Wt,calculateDiceWinChance:()=>br,calculateBlitzWinChance:()=>yr,calculateBaccaratBetAmount:()=>Jt,calculateAdvancedDiceWinChance:()=>Mt,bigMin:()=>sa,bigMax:()=>da,advancedDiceIsWithinBoundsInclusive:()=>Ia,advancedDiceIsWithinBoundsExclusive:()=>pt,advancedDiceGetInclusiveBoundsRange:()=>Ua,advancedDiceGetExclusiveBoundsRange:()=>Bt,WheelSegments:()=>X,WheelRiskLevel:()=>q,Wheel:()=>Lr,WIN_MULTIPLIER:()=>Wa,VALID_SUITS:()=>ln,VALID_RANKS:()=>un,VALID_EUROPEAN_STREETS:()=>ya,VALID_EUROPEAN_STRAIGHTS:()=>wt,VALID_EUROPEAN_SPLITS:()=>ma,VALID_EUROPEAN_DOUBLE_STREETS:()=>Da,VALID_EUROPEAN_CORNERS:()=>Sa,VALID_AMERICAN_STREETS:()=>fa,VALID_AMERICAN_STRAIGHTS:()=>Ba,VALID_AMERICAN_SPLITS:()=>Ea,VALID_AMERICAN_DOUBLE_STREETS:()=>ha,VALID_AMERICAN_CORNERS:()=>Oa,ThreeCardBonusType:()=>Dt,TOP_COLUMN:()=>Yr,TILE_COUNTS:()=>Rr,THREE_CARD_BONUS_PAYOUTS:()=>Xt,SingleActionGame:()=>B,SPLIT_BET_SIZE_FACTOR:()=>k,RouletteType:()=>Vt,Roulette:()=>ja,RollType:()=>Za,RandomValuePool:()=>nt,RED_NUMBERS:()=>qr,RANDOM_MIN_VALUE:()=>W,RANDOM_MAX_VALUE:()=>g,PlinkoRiskLevel:()=>Aa,Plinko:()=>Fr,Parity:()=>I,PairBonusType:()=>Ht,PUSH_MULTIPLIER:()=>ga,PLINKO_ROW_COUNTS:()=>Zn,PAYOUT_MULTIPLIERS:()=>Jr,PAIR_BONUS_PAYOUTS:()=>qt,OrigamiGame:()=>y,MultiplierCalculator:()=>x,MultiActionGame:()=>bt,Mines:()=>Gr,MIN_WIN_CHANCE:()=>wa,MIDDLE_COLUMN:()=>$r,MAX_WIN_CHANCE:()=>Va,MAX_CARDS_PER_ROUND:()=>Ct,Limbo:()=>Zr,LOSE_MULTIPLIER:()=>La,KenoRiskLevel:()=>ia,Keno:()=>Ur,InsuranceOutcome:()=>St,INSURANCE_WIN_MULTIPLIER:()=>xt,INSURANCE_BET_SIZE_FACTOR:()=>$t,Half:()=>Z,GameErrorCode:()=>Na,GameError:()=>l,FACE_CARD_VALUE:()=>zt,EuropeanRoulette:()=>Pa,EUROPEAN_HOUSE_EDGE:()=>$,EFFECTIVE_RANGE:()=>Zt,Dozen:()=>M,DiceDirection:()=>xr,Dice:()=>Tr,DiamondsResultType:()=>Dr,Diamonds:()=>Cr,Darts:()=>Or,DOUBLE_DOWN_BET_SIZE_FACTOR:()=>R,DICE_MIN_ROLL:()=>ca,DICE_MAX_ROLL:()=>Nt,DICE_EFFECTIVE_RANGE:()=>Pr,DEALER_STAND_VALUE:()=>Yt,DARTS_MIN_VALUE:()=>na,DARTS_MAX_VALUE:()=>Tt,DARTS_DIFFICULTY_LEVEL:()=>ea,DARTS_BOARD_CONFIGS:()=>Rt,Column:()=>G,Color:()=>U,CARDS_PER_SUIT:()=>pn,Blitz:()=>fr,BlackjackOutcome:()=>ft,BlackjackActionType:()=>Ot,Blackjack:()=>mr,BaccaratOutcome:()=>za,BaccaratBetType:()=>qa,Baccarat:()=>Xa,BUST_VALUE:()=>ht,BOTTOM_COLUMN:()=>zr,BLITZ_RANDOM_NUMBER_COUNT:()=>aa,BLITZ_MIN_CARD_RANGE:()=>vt,BLITZ_MAX_CARD_RANGE:()=>ta,BLITZ_CARD_COUNT:()=>J,BLACK_NUMBERS:()=>Xr,BLACKJACK_VALUE:()=>h,BLACKJACK_MULTIPLIER:()=>Qa,BASE_PAYOUT_MULTIPLIERS:()=>K,AmericanRoulette:()=>ba,AdvancedDice:()=>Ga,AMERICAN_HOUSE_EDGE:()=>z,AMERICAN_BASKET:()=>Ha,ACE_SOFT_BONUS:()=>Pt});module.exports=an(oe);var Na;((r)=>{r.UNSUPPORTED_EDGE="UNSUPPORTED_EDGE";r.INPUT_VALIDATION_ERROR="INPUT_VALIDATION_ERROR"})(Na||={});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 y;((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"})(y||={});var ka=require("@betorigami/guard");class B{gameId;constructor(t){this.gameId=t}getGameResult(t){let a=this.supportedEdgeConfigurations.includes(t.edge);return ka.Guard.against(!a,()=>l.createUnsupportedEdgeError(`${this.gameId} does not support ${t.edge}% edge. Supported edge configurations include: ${this.supportedEdgeConfigurations}`)),this.determineGameResult(t)}}var Gt=require("big.js");var st=O(require("big.js"));class x{static withMultiplier(t,a){return new st.default(t).times(new st.default(100-a).div(100))}static withWinChance(t,a){return st.default(100-t).div(a)}}var W=0,g=1e4,Zt=g-W+1,wa=0.01,Va=98,nn=(t)=>{if(t<W)throw l.createValidationError(`Lower bound ${t} is below minimum allowed value ${W}`)},en=(t)=>{if(t>g)throw l.createValidationError(`Upper bound ${t} is above maximum allowed value ${g}`)},At=(t)=>{if(nn(t.lower),en(t.upper),t.lower>=t.upper)throw l.createValidationError(`Lower bound ${t.lower} must be less than ${t.upper}`)},on=(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")},Ia=(t,a)=>a>=t.lower&&a<=t.upper,Ua=(t)=>t.upper-t.lower+1,pt=(t,a)=>a>t.lower&&a<t.upper,Bt=(t)=>t.upper-t.lower-1,Za;((n)=>{n.ROLL_BETWEEN="ROLL_BETWEEN";n.ROLL_OUTSIDE="ROLL_OUTSIDE";n.ROLL_BETWEEN_TWO="ROLL_BETWEEN_TWO"})(Za||={});var Mt=(t)=>{let r=(()=>{switch(t.mode){case"ROLL_BETWEEN":return At(t.bounds),Bt(t.bounds);case"ROLL_OUTSIDE":return At(t.bounds),Zt-Ua(t.bounds);case"ROLL_BETWEEN_TWO":return At(t.firstBounds),At(t.secondBounds),on(t.firstBounds,t.secondBounds),Bt(t.firstBounds)+Bt(t.secondBounds)}})(),n=Gt.Big(r).div(Zt).mul(100);if(n.lt(wa))throw l.createValidationError("Win chance too low");if(n.gt(Va))throw l.createValidationError("Win chance too high");return n},cn=(t)=>{Mt(t)};class Ga 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=Mt(r),o=t.getRandomInt({min:W,max:g}),c=o.value,i=(()=>{switch(r.mode){case"ROLL_BETWEEN":return pt(r.bounds,c);case"ROLL_OUTSIDE":return!Ia(r.bounds,c);case"ROLL_BETWEEN_TWO":return pt(r.firstBounds,c)||pt(r.secondBounds,c)}})()?x.withWinChance(a,n):new Gt.Big(0);return{isFinished:!0,payout:{legs:[{amount:r.betAmount.mul(i)}]},payoutMultiplier:i,outputs:{result:o.values},randomValues:o}}}var L=O(require("big.js"));var yt=require("@betorigami/guard");var Ma=0,Fa=51,mt=Array.from({length:52},(t,a)=>a),Ja=["Spades","Hearts","Diamonds","Clubs"],Et=["Ace","Two","Three","Four","Five","Six","Seven","Eight","Nine","Ten","Jack","Queen","King"],Ya=["Jack","Queen","King"],Ft={Hearts:"red",Diamonds:"red",Spades:"black",Clubs:"black"};class N{value;constructor(t){let a=mt[t];yt.Guard.againstNullOrUndefined(a,`Invalid card value: ${t}`),this.value=a}get suit(){let t=Math.floor(this.value/13),a=Ja[t];return yt.Guard.againstNullOrUndefined(a,`Invalid suit index: ${t}`),a}get rank(){let t=this.value%13,a=Et[t];return yt.Guard.againstNullOrUndefined(a,`Invalid rank index: ${t}`),a}toDto(){return{rank:this.rank,suit:this.suit,cardValue:this.value}}}var $a=O(require("big.js")),T=(t)=>t.legs.reduce((a,r)=>a.add(r.amount),new $a.default("0"));var ln=["Clubs","Diamonds","Hearts","Spades"],un=["Ace","2","3","4","5","6","7","8","9","10","Jack","Queen","King"],dn={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"},za;((n)=>{n.PLAYER_WIN="PLAYER_WIN";n.TIE="TIE";n.BANKER_WIN="BANKER_WIN"})(za||={});var qa;((n)=>{n.PLAYER="PLAYER";n.TIE="TIE";n.BANKER="BANKER"})(qa||={});var sn={["PLAYER_WIN"]:{betType:"PLAYER",multiplier:2},["TIE"]:{betType:"TIE",multiplier:9},["BANKER_WIN"]:{betType:"BANKER",multiplier:1.95}},Jt=(t)=>{return new L.default(0).add(t.bets.reduce((r,n)=>r.add(n.amount),new L.default(0)))},An=(t,a)=>t==="TIE"&&(a==="PLAYER"||a==="BANKER");class Xa extends B{constructor(){super("BACCARAT")}get supportedEdgeConfigurations(){return[1]}getBetAmount(t){return Jt(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 S of o.slice(0,2)){let _=this.mapRandomValueToCard(S),dt=this.mapRandomValueToCardValue(S);e.push(_),i=(i+dt)%10}let u=[],d=0;for(let S of c.slice(0,2)){let _=this.mapRandomValueToCard(S),dt=this.mapRandomValueToCardValue(S);u.push(_),d=(d+dt)%10}if(!this.isNaturalWin(i,d)){let S=this.shouldDrawThirdPlayerCard(i),_=null;if(S)_=this.mapRandomValueToCardValue(o[2]),e.push(this.mapRandomValueToCard(o[2])),i=(i+_)%10;if(this.shouldDrawThirdBankerCard(d,_))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=Jt(a),{betType:m,multiplier:p}=sn[A],D={legs:a.bets.map((S)=>{if(S.type===m)return{amount:S.amount.mul(p)};return{amount:An(A,S.type)?S.amount:new L.default("0")}})},F=T(D),ut=s.gt(0)?F.div(s):new L.default(0);return{isFinished:!0,payout:D,payoutMultiplier:ut,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 N(t);return{suit:a.suit,rank:dn[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 ft;((o)=>{o.WIN="WIN";o.LOSE="LOSE";o.PUSH="PUSH";o.PLAYER_BLACKJACK="PLAYER_BLACKJACK"})(ft||={});var St;((r)=>{r.WON="WON";r.LOST="LOST"})(St||={});var Ot;((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"})(Ot||={});var Ht;((o)=>{o.EXACT_PAIR="EXACT_PAIR";o.COLORED_PAIR="COLORED_PAIR";o.MIXED_PAIR="MIXED_PAIR";o.LOSS="LOSS"})(Ht||={});var Dt;((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"})(Dt||={});var Qa=2.5,Wa=2,ga=1,La=0,Yt=17,ht=21,h=21,Ct=63,$t=0.5,xt=3,R=1,k=1,pn=13,Pt=10,zt=10,K={PLAYER_BLACKJACK:Qa,WIN:Wa,PUSH:ga,LOSE:La},qt={EXACT_PAIR:26,COLORED_PAIR:11,MIXED_PAIR:7,LOSS:0},Xt={SUITED_TRIPS:101,STRAIGHT_FLUSH:51,THREE_OF_A_KIND:31,STRAIGHT:11,FLUSH:5,LOSS:0};var b=O(require("big.js")),E=require("@betorigami/guard"),sr=require("@xstate/store");var Ka=require("@betorigami/guard");class f extends N{get numericRank(){if(Ya.includes(this.rank))return zt;return Et.indexOf(this.rank)+1}static fromValue(t){return Ka.Guard.against(!mt.includes(t),`Invalid card value: ${t}`),new f(t)}}class v{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+Pt<=ht)this.softHandValue=this.hardHandValue+Pt}get cardCount(){return this.cards.length}get hasSoftHandValue(){return this.softHandValue!==null}get isBusted(){return this.hardHandValue>ht}get isBlackjack(){return this.cardCount===2&&this.highestHandValue===h}get highestHandValue(){return this.softHandValue!==null?this.softHandValue:this.hardHandValue}}class tt{cards;value;constructor(t){this.cards=t.map((a)=>f.fromValue(a)),this.value=new v(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 at extends tt{otherCards;upCard;holeCard;constructor(t,a,r=[]){super([t,a,...r]);this.otherCards=r;this.upCard=f.fromValue(t),this.holeCard=f.fromValue(a)}static withInitialDeal(t){return new at(t.upCard,t.holeCard)}addDrawnCards(t){return new at(this.upCard.value,this.holeCard.value,[...this.otherCards,...t])}toDto(t=!1){if(t)return super.toDto();return{cards:[this.upCard.toDto()],value:new v([this.upCard]).highestHandValue}}}class w extends tt{static withInitialDeal(t){return new w(t)}addDrawnCards(t){return new w([...this.rawValues,...t])}}var rt=require("@betorigami/guard");class nt{source;index=0;constructor(t){this.source=t}static from(t,a){return rt.Guard.against(a<=0,`Count must be positive, got ${a}`),rt.Guard.against(t.values.length!==a,`Expected ${a} values, got ${t.values.length}`),new nt(t)}get consumedValues(){return this.source.values.slice(0,this.index)}toMultipleRandomValues(){return this.source}takeOne(){let t=this.source.values[this.index];return rt.Guard.againstUndefined(t,"RandomValuePool exhausted"),this.index+=1,t}take(t){rt.Guard.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}}var Qt=require("@betorigami/guard"),va=O(require("fast-deep-equal"));class bt{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)Qt.Guard.against(!va.default(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);Qt.Guard.against(!a,()=>l.createUnsupportedEdgeError(`${this.gameId} does not support ${t}% edge. Supported edge configurations include: ${this.supportedEdgeConfigurations}`))}}var P=O(require("big.js"));var jt=require("@betorigami/guard");var tr=(t)=>{let a=t.pairBonus!==null?{amount:P.default(t.pairBonus.betAmount).mul(t.pairBonus.payoutMultiplier)}:null,r=t.threeCardBonus!==null?{amount:P.default(t.threeCardBonus.betAmount).mul(t.threeCardBonus.payoutMultiplier)}:null;return[a,r].filter((n)=>n!==null)},ar=(t)=>{let a=t.betAmounts.mainBetAmount,n=t.actionType==="BLACKJACK_DOUBLE_DOWN"?a.mul(R):P.default(0),o=t.insuranceOutcome!==void 0?t.insuranceStake:P.default(0),c=a.plus(n).mul(K[t.outcome]),e=t.insuranceOutcome==="WON"?o.mul(xt):P.default(0),i=tr(t.sideBetResults),u=[{amount:c},...t.insuranceOutcome!==void 0?[{amount:e}]:[],...i],d=T({legs:u}),A=a.plus(o).plus(n).plus(t.betAmounts.pairBonusAmount).plus(t.betAmounts.threeCardBonusAmount);jt.Guard.against(A.eq(0),"Total bet amount cannot be zero");let s=d.div(A);jt.Guard.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(k);break}return{payouts:u,totalBetAmount:A,multiplier:s,additionalBetAmount:m}},rr=(t)=>{let a=t.betAmounts.mainBetAmount,r=t.mainHandDoubledDown?a.mul(R):P.default(0),n=t.splitHandDoubledDown?a.mul(R):P.default(0),o=t.insuranceOutcome!==void 0?t.insuranceStake:P.default(0),c=a.plus(r).mul(K[t.mainOutcome]),e=a.plus(n).mul(K[t.splitOutcome]),i=t.insuranceOutcome==="WON"?o.mul(xt):P.default(0),u=tr(t.sideBetResults),d=[{amount:c},{amount:e},...t.insuranceOutcome!==void 0?[{amount:i}]:[],...u],A=T({legs:d}),s=a.plus(a).plus(o).plus(r).plus(n).plus(t.betAmounts.pairBonusAmount).plus(t.betAmounts.threeCardBonusAmount);jt.Guard.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(R);break;case"BLACKJACK_SPLIT":p=a.mul(k);break}return{payouts:d,totalBetAmount:s,multiplier:m,additionalBetAmount:p}};var Wt=(t,a)=>a(t.mul($t));var er=require("@betorigami/guard"),gt=(t)=>t.every((a)=>a===t[0]),nr=(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.Guard.againstUndefined(o,"Previous value cannot be undefined"),r===o+1})},or={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},Bn={...or,Ace:14},mn=(t)=>nr(t.map((a)=>or[a]))||nr(t.map((a)=>Bn[a])),cr=(t,a)=>{let r=f.fromValue(t),n=f.fromValue(a);if(r.rank!==n.rank)return"LOSS";if(t===a)return"EXACT_PAIR";if(Ft[r.suit]===Ft[n.suit])return"COLORED_PAIR";return"MIXED_PAIR"},ir=(t,a)=>({betAmount:t,result:a,payoutMultiplier:qt[a]}),lr=(t,a,r)=>{let n=f.fromValue(t),o=f.fromValue(a),c=f.fromValue(r),e=[n.rank,o.rank,c.rank],i=gt([n.suit,o.suit,c.suit]),u=gt(e),d=mn(e);if(gt([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"},ur=(t,a)=>({betAmount:t,result:a,payoutMultiplier:Xt[a]});var En={state:{isFinished:!1,phase:"uninitialised",multiplier:b.default(0)},config:{},playerArgument:{type:"START",mainBetAmount:"0",pairBonusAmount:"0",threeCardBonusAmount:"0"}},H=(t)=>f.fromValue(t).value;function yn(t){E.Guard.against(t.phase!=="in-progress","Expected a started, in-progress game state")}function dr(t){E.Guard.against(t.phase!=="awaiting-insurance","Expected game to be awaiting insurance decision")}function Lt(t){E.Guard.against(t.phase!=="in-progress"&&t.phase!=="playing-main-hand"&&t.phase!=="playing-split-hand","Expected a started, in-progress game state")}var Ar=(t,a)=>{let r=a;while(r.highestHandValue<Yt)r=r.addDrawnCards([H(t.takeOne())]);return r},Kt=(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"},pr=(t)=>t.insuranceOutcome===void 0?b.default(0):t.calculateStake(t.betAmounts.mainBetAmount),Br=(t)=>{let{payouts:a,multiplier:r,additionalBetAmount:n}=ar({outcome:t.outcome,insuranceOutcome:t.insuranceOutcome,insuranceStake:pr(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}},fn=(t)=>{let a=Ar(t.randomValuePool,t.dealerHand),r=Kt(t.playerHand,a);return Br({...t,dealerHand:a,outcome:r})},Sn=(t)=>{let r=t.mainHand.isBusted&&t.splitHand.isBusted?t.dealerHand:Ar(t.randomValuePool,t.dealerHand),n=Kt(t.mainHand,r),o=Kt(t.splitHand,r),{payouts:c,multiplier:e,additionalBetAmount:i}=rr({hasSplit:!0,mainOutcome:n,splitOutcome:o,insuranceOutcome:t.insuranceOutcome,insuranceStake:pr(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 mr extends bt{roundInsuranceStake;constructor(t,a){super("BLACKJACK",t);this.roundInsuranceStake=a}get supportedEdgeConfigurations(){return[1]}generateRandomValues(t){return nt.from(t.getRandomIntsWithReplacement({min:Ma,max:Fa,count:Ct}),Ct)}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.Guard.againstNever(a,"Invalid state received")}}createGameStore(){let t=(o)=>{let c=Wt(o,this.roundInsuranceStake);return E.Guard.against(o.gt(0)&&c.eq(0),"Insurance stake rounds below the smallest unit this currency supports"),c},a=(o)=>Br({...o,calculateStake:t}),r=(o)=>fn({...o,calculateStake:t}),n=(o)=>Sn({...o,calculateStake:t});return sr.createStore({context:En,on:{START:(o,c)=>{let{state:e}=o;E.Guard.against(e.phase!=="uninitialised","START action requires a fresh game");let i=H(c.randomValuePool.takeOne()),u=H(c.randomValuePool.takeOne()),d=H(c.randomValuePool.takeOne()),A=H(c.randomValuePool.takeOne()),s=w.withInitialDeal([i,u]),m=at.withInitialDeal({upCard:d,holeCard:A}),p={mainBetAmount:b.default(c.mainBetAmount),pairBonusAmount:b.default(c.pairBonusAmount),threeCardBonusAmount:b.default(c.threeCardBonusAmount)},C={pairBonus:b.default(c.pairBonusAmount).gt(0)?ir(c.pairBonusAmount,cr(i,u)):null,threeCardBonus:b.default(c.threeCardBonusAmount).gt(0)?ur(c.threeCardBonusAmount,lr(i,u,d)):null},D={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:C},config:{},playerArgument:D};let F={playerHand:s,dealerHand:m,randomValuePool:c.randomValuePool,playerArgument:D,betAmounts:p,sideBetResults:C};if(s.isBlackjack&&m.isBlackjack)return a({...F,outcome:"PUSH"});if(s.isBlackjack)return a({...F,outcome:"PLAYER_BLACKJACK"});if(m.isBlackjack)return a({...F,outcome:"LOSE"});return{state:{...e,isFinished:!1,phase:"in-progress",playerHand:s,dealerHand:m,insuranceOutcome:void 0,betAmounts:p,sideBetResults:C},config:{},playerArgument:D}},BLACKJACK_BUY_INSURANCE:(o,c)=>{let{state:e}=o;dr(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;dr(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(Lt(e),e.phase){case"playing-main-hand":{let i=e.mainHand.addDrawnCards([H(c.randomValuePool.takeOne())]);if(i.isBusted||i.highestHandValue===h){if(e.splitHand.highestHandValue===h)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([H(c.randomValuePool.takeOne())]);if(i.isBusted||i.highestHandValue===h)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([H(c.randomValuePool.takeOne())]);if(i.isBusted)return a({...e,playerHand:i,outcome:"LOSE",randomValuePool:c.randomValuePool,playerArgument:{type:"BLACKJACK_HIT"}});if(i.highestHandValue===h)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.Guard.againstNever(e,"Invalid phase for HIT action")}},BLACKJACK_STAND:(o,c)=>{let{state:e}=o;switch(Lt(e),e.phase){case"playing-main-hand":{if(e.splitHand.highestHandValue===h)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.Guard.againstNever(e,"Invalid phase for STAND action")}},BLACKJACK_DOUBLE_DOWN:(o,c)=>{let{state:e}=o;switch(Lt(e),e.phase){case"playing-main-hand":{E.Guard.against(e.mainHand.cards.length!==2,"Double down is only allowed as the first action");let i=e.mainHand.addDrawnCards([H(c.randomValuePool.takeOne())]),{betAmounts:u}=e;if(e.splitHand.highestHandValue===h)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(R)}}case"playing-split-hand":{E.Guard.against(e.splitHand.cards.length!==2,"Double down is only allowed as the first action");let i=e.splitHand.addDrawnCards([H(c.randomValuePool.takeOne())]);return n({...e,splitHand:i,randomValuePool:c.randomValuePool,playerArgument:{type:"BLACKJACK_DOUBLE_DOWN"},splitHandDoubledDown:!0})}case"in-progress":{E.Guard.against(e.playerHand.cards.length!==2,"Double down is only allowed as the first action");let i=e.playerHand.addDrawnCards([H(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.Guard.againstNever(e,"Invalid phase for DOUBLE_DOWN action")}},BLACKJACK_SPLIT:(o,c)=>{let{state:e}=o;yn(e);let{playerHand:i,betAmounts:u,sideBetResults:d}=e;E.Guard.against(i.cards.length!==2,"Split is only allowed with exactly 2 cards");let A=i.cards[0],s=i.cards[1];E.Guard.againstUndefined(A,"First card is missing"),E.Guard.againstUndefined(s,"Second card is missing"),E.Guard.against(A.rank!==s.rank,"Split requires two cards of the same rank");let m=H(c.randomValuePool.takeOne()),p=H(c.randomValuePool.takeOne()),C=w.withInitialDeal([A.value,m]),D=w.withInitialDeal([s.value,p]);if(A.rank==="Ace")return n({...e,mainHand:C,splitHand:D,randomValuePool:c.randomValuePool,playerArgument:{type:"BLACKJACK_SPLIT"},mainHandDoubledDown:!1,splitHandDoubledDown:!1});let ut=C.highestHandValue===h,S=D.highestHandValue===h;if(ut&&S)return n({mainHand:C,splitHand:D,dealerHand:e.dealerHand,randomValuePool:c.randomValuePool,playerArgument:{type:"BLACKJACK_SPLIT"},insuranceOutcome:e.insuranceOutcome,mainHandDoubledDown:!1,splitHandDoubledDown:!1,betAmounts:u,sideBetResults:d});if(ut)return{state:{...e,phase:"playing-split-hand",mainHand:C,splitHand:D,mainHandDoubledDown:!1,splitHandDoubledDown:!1},config:{},playerArgument:{type:"BLACKJACK_SPLIT"},additionalBetAmount:u.mainBetAmount.mul(k)};return{state:{...e,phase:"playing-main-hand",multiplier:b.default(0),mainHand:C,splitHand:D,mainHandDoubledDown:!1},config:{},playerArgument:{type:"BLACKJACK_SPLIT"},additionalBetAmount:u.mainBetAmount.mul(k)}}}})}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.Guard.againstUndefined(r,"First player card is missing"),E.Guard.againstUndefined(n,"Second player card is missing"),r.rank===n.rank)a.push("BLACKJACK_SPLIT")}return a}default:E.Guard.againstNever(t,"Invalid phase for getting valid actions")}}}var Y=O(require("big.js")),ra=require("@betorigami/guard");var vt=0,ta=51,J=52,aa=52;var On=()=>({minPicks:5,maxPicks:36}),Er=(t)=>t.length===new Set(t).size,yr=(t)=>{let a=Y.default(1),r=Y.default(J);for(let n=0;n<t;n+=1)a=a.mul(Y.default(J-n).div(r));return a};class fr extends B{constructor(){super("BLITZ")}get supportedEdgeConfigurations(){return[2]}getBetAmount(t){return t.betAmount}determineGameResult({generator:t,gameInputs:a,edge:r}){ra.Guard.against(a.pickCount<1||a.pickCount>J,`pickCount must be between 1 and ${J}`),ra.Guard.againstNonInteger(a.pickCount,"pickCount must be an integer");let n=t.getRandomIntsWithReplacement({min:vt,max:ta,count:aa}),o=n.values.slice(0,a.pickCount),c=Er(o),e=yr(a.pickCount),i=c?x.withMultiplier(Y.default(1).div(e),r):Y.default(0);return{isFinished:!0,payout:{legs:[{amount:a.betAmount.mul(i)}]},payoutMultiplier:i,outputs:{result:n.values,cards:o.map((u)=>new N(u).toDto())},randomValues:n}}}var na=0,Tt=4294967295,ea;((o)=>{o.EASY="EASY";o.MEDIUM="MEDIUM";o.HARD="HARD";o.EXPERT="EXPERT"})(ea||={});var Hn=["YELLOW","ORANGE","YELLOW","RED","YELLOW","ORANGE","YELLOW","RED","YELLOW","ORANGE","YELLOW","RED","YELLOW","ORANGE","YELLOW","ORANGE","YELLOW","RED"],Dn={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:Hn},hn=["YELLOW","ORANGE","YELLOW","RED","YELLOW","ORANGE","YELLOW","RED","YELLOW","ORANGE","YELLOW","RED","YELLOW","ORANGE","YELLOW","ORANGE","YELLOW","RED"],Cn={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:hn},xn=["YELLOW","ORANGE","YELLOW","ORANGE","YELLOW","RED","YELLOW","ORANGE","YELLOW","ORANGE","YELLOW","RED","YELLOW","ORANGE","YELLOW","ORANGE","YELLOW","RED"],Pn={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:xn},bn=["YELLOW","ORANGE","YELLOW","YELLOW","RED","YELLOW","YELLOW","ORANGE","YELLOW","YELLOW","ORANGE","YELLOW","YELLOW","RED","YELLOW","YELLOW","ORANGE","YELLOW"],jn={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:bn},Tn=(t)=>{let a=Rt[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)},Rt={EASY:Dn,MEDIUM:Cn,HARD:Pn,EXPERT:jn};var _t=require("@betorigami/guard"),Sr=O(require("big.js"));class Or extends B{constructor(){super("DARTS")}get supportedEdgeConfigurations(){return[2]}getBetAmount(t){return t.betAmount}determineGameResult({generator:t,gameInputs:a}){let r=t.getRandomIntsWithReplacement({min:na,max:Tt,count:2}),n=r.values[0],o=r.values[1];_t.Guard.againstUndefined(n,"Random number generator returned no value for clockWiseRotation"),_t.Guard.againstUndefined(o,"Random number generator returned no value for distanceFromCentre");let c=a.difficultyLevel,e=Sr.default(Rn(c,n,o));return{isFinished:!0,payout:{legs:[{amount:a.betAmount.mul(e)}]},payoutMultiplier:e,outputs:{result:r.values},randomValues:r}}}var Rn=(t,a,r)=>{let n=Rt[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 _n(n,a);return c.ringFour},_n=(t,a)=>{let r=t.segments.length,n=Math.floor(a/(Tt+1)*r),o=t.segments[n];return _t.Guard.againstUndefined(o,`Segment index ${n} out of bounds`),t.multipliers.ringThree[o]};var Hr=O(require("big.js"));class j{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 Dr;((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"})(Dr||={});var Nn={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},kn={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},wn={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},Vn={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},In={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},hr=new j(new Map([[1,Nn],[2,kn],[3,wn],[4,Vn],[8,In]])),Un={2:"PAIR",3:"THREE_OF_A_KIND",4:"FOUR_OF_A_KIND",5:"FIVE_OF_A_KIND"};class Cr 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=hr.getMultipliers(a),c=n.values,e=Hr.default(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=Un[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"}}var oa=O(require("big.js"));var xr;((r)=>{r.ABOVE="ABOVE";r.BELOW="BELOW"})(xr||={});var ca=0,Nt=1e4,Pr=Nt-ca+1,br=(t)=>{let a=t.direction==="ABOVE"?Nt-t.selectedValue:t.selectedValue;return new oa.default(a).div(Pr).mul(100)},jr=(t,a)=>t.direction==="ABOVE"?a>t.selectedValue:a<t.selectedValue;class Tr 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:ca,max:Nt}),o=br(r),e=jr(r,n.value)?x.withWinChance(a,o):new oa.default(0);return{isFinished:!0,payout:{legs:[{amount:r.betAmount.mul(e)}]},payoutMultiplier:e,outputs:{result:n.values},randomValues:n}}}var Ir=O(require("big.js"));var et=require("@betorigami/guard");var ia;((o)=>{o.CLASSIC="CLASSIC";o.LOW_RISK="LOW_RISK";o.MEDIUM_RISK="MEDIUM_RISK";o.HIGH_RISK="HIGH_RISK"})(ia||={});var Rr=[1,2,3,4,5,6,7,8,9,10],la=(t)=>{return Rr.includes(t)};var _r={[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]}},Nr={[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]}},kr={[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]}},wr={[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]}},Vr={[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]}},ua=new j(new Map([[1,_r],[2,Nr],[3,kr],[4,wr],[8,Vr]]));class Ur 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}){et.Guard.againstEmptyArray(r.selectedNumbers,()=>l.createValidationError("No numbers selected")),et.Guard.against(r.selectedNumbers.length>10,()=>l.createValidationError("Maximum of 10 numbers can be selected"));for(let s of r.selectedNumbers)et.Guard.againstNonInteger(s,()=>l.createValidationError("Only integers can be selected")),et.Guard.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(!la(c))throw new Error(`Invalid tile count: ${c}`);let d=ua.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 Ir.default(d);return{isFinished:!0,payout:{legs:[{amount:r.betAmount.mul(A)}]},payoutMultiplier:A,outputs:{result:n.values},randomValues:n}}}var V=O(require("big.js"));var da=(t,a)=>{return t.gt(a)?t:a};var sa=(t,a)=>{return t.lt(a)?t:a};class Zr 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.default(16777216),e=new V.default(1),i=new V.default(1e6),u=n.value,d=new V.default(u-1).div(o),A=(100-a)/100,s=c.div(d.mul(c).plus(1)).mul(A),m=da(e,sa(s,i)),p=m.gte(r.targetMultiplier)?new V.default(r.targetMultiplier):new V.default(0);return{isFinished:!0,payout:{legs:[{amount:r.betAmount.mul(p)}]},payoutMultiplier:p,outputs:{randomMultiplier:m,result:n.values},randomValues:n}}}var ot=O(require("big.js"));var kt=(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 Gr 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 ot.default(kt(25-r.minesCount,r.selectedTiles.length)).div(new ot.default(kt(25,r.selectedTiles.length))),m=r.hasCashedOut&&!i?new ot.default(d).div(A):new ot.default(0);return{isFinished:u,payout:{legs:[{amount:r.betAmount.mul(m)}]},payoutMultiplier:m,outputs:{result:e.values},randomValues:e}}}var Mr=require("big.js");var Aa;((n)=>{n.LOW_RISK="LOW_RISK";n.MEDIUM_RISK="MEDIUM_RISK";n.HIGH_RISK="HIGH_RISK"})(Aa||={});var Zn=[8,9,10,11,12,13,14,15,16],Gn={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]}},Mn={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]}},Fn={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]}},Jn={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]}},Yn={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]}},pa=new j(new Map([[1,Gn],[2,Mn],[3,Fn],[4,Jn],[8,Yn]]));class Fr 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=pa.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=Mr.Big(A);return{isFinished:!0,payout:{legs:[{amount:a.betAmount.mul(s)}]},payoutMultiplier:s,outputs:{result:i.values},randomValues:i}}}var lt=require("big.js");var wt=[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],Ba=[37,...wt],ma=[[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]],Ea=[[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]],ya=[[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]],fa=[[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]],Sa=[[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]],Oa=[[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]],Ha=[0,1,2,3,37],Da=[[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]],ha=[[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 Vt;((r)=>{r.AMERICAN="AMERICAN";r.EUROPEAN="EUROPEAN"})(Vt||={});var $=2.7,z=5.3;var It=(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)&&ct(a.value)))throw l.createValidationError("Invalid straight bet.");if(!t.splitBets.every((a)=>a.amount.gte(0)&&$n(a.values)))throw l.createValidationError("Invalid split bet.");if(!t.streetBets.every((a)=>a.amount.gte(0)&&zn(a.values)))throw l.createValidationError("Invalid street bet.");if(!t.cornerBets.every((a)=>a.amount.gte(0)&&qn(a.values)))throw l.createValidationError("Invalid corner bet.");if(!t.doubleStreetBets.every((a)=>a.amount.gte(0)&&Xn(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.")},ct=(t)=>{return wt.includes(t)},$n=(t)=>{if(t.length!==2)return!1;if(!t.every(ct))return!1;return ma.some(([a,r])=>a===t[0]&&r===t[1])},zn=(t)=>{if(t.length!==3)return!1;if(!t.every(ct))return!1;return ya.some(([a,r,n])=>a===t[0]&&r===t[1]&&n===t[2])},qn=(t)=>{if(t.length!==4)return!1;if(!t.every(ct))return!1;return Sa.some(([a,r,n,o])=>a===t[0]&&r===t[1]&&n===t[2]&&o===t[3])},Xn=(t)=>{if(t.length!==6)return!1;if(!t.every(ct))return!1;return Da.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 Ut=(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)&&it(a.value)))throw l.createValidationError("Invalid straight bet.");if(!t.splitBets.every((a)=>a.amount.gte(0)&&Qn(a.values)))throw l.createValidationError("Invalid split bet.");if(!t.streetBets.every((a)=>a.amount.gte(0)&&Wn(a.values)))throw l.createValidationError("Invalid street bet.");if(!t.cornerBets.every((a)=>a.amount.gte(0)&&gn(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)&&Ln(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.")},it=(t)=>{return Ba.includes(t)};function Qn(t){if(t.length!==2)return!1;if(!t.every(it))return!1;return Ea.some(([a,r])=>a===t[0]&&r===t[1])}var Wn=(t)=>{if(t.length!==3)return!1;if(!t.every(it))return!1;return fa.some(([a,r,n])=>a===t[0]&&r===t[1]&&n===t[2])},gn=(t)=>{if(t.length!==4)return!1;if(!t.every(it))return!1;return Oa.some(([a,r,n,o])=>a===t[0]&&r===t[1]&&n===t[2]&&o===t[3])},Ln=(t)=>{if(t.length!==6)return!1;if(!t.every(it))return!1;return ha.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 Kn=(t,a)=>{let r=a===$&&t.type==="EUROPEAN",n=a===z&&t.type==="AMERICAN";if(!r&&!n)throw l.createValidationError(`Attempted to play ${t.type} roulette on edge ${a}`)},Ca=(t,a)=>{if(Kn(t,a),t.type==="EUROPEAN")It(t.inputs);else Ut(t.inputs)};var Jr={straightBets:36,splitBets:18,streetBets:12,cornerBets:9,basketBets:7,doubleStreetBets:6,parityBets:2,colorBets:2,halfBets:2,columnBets:3,dozenBets:3},Yr=[3,6,9,12,15,18,21,24,27,30,33,36],$r=[2,5,8,11,14,17,20,23,26,29,32,35],zr=[1,4,7,10,13,16,19,22,25,28,31,34],qr=[1,3,5,7,9,12,14,16,18,19,21,23,25,27,30,32,34,36],Xr=[2,4,6,8,10,11,13,15,17,20,22,24,26,28,29,31,33,35];class xa 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=T(o);return{payoutMultiplier:n.gt(0)?c.div(n):new lt.Big(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 lt.Big(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 qr.includes(a)&&r.color==="RED"||Xr.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 Yr.includes(a)&&r.column==="TOP"||$r.includes(a)&&r.column==="MIDDLE"||zr.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 lt.Big(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=Jr[r],o=this.betPredicates[r];return t[r].map((c)=>{if(!o(c,a))return{amount:new lt.Big("0")};return{amount:c.amount.mul(n||0)}})})}}class Pa extends xa{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[$]}validateInputs(t){It(t)}}class ba extends xa{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[z]}validateInputs(t){Ut(t)}isWinningBasketBet(t,a){return Ha.some((r)=>r===a)}}class ja extends B{europeanGame;americanGame;constructor(){super("ROULETTE");this.europeanGame=new Pa,this.americanGame=new ba}get supportedEdgeConfigurations(){return[$,z]}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(Ca(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 vn=(t)=>{return new ja().getBetAmount(t)};var gr=require("big.js");var q;((n)=>{n.LOW_RISK="LOW_RISK";n.MEDIUM_RISK="MEDIUM_RISK";n.HIGH_RISK="HIGH_RISK"})(q||={});var X;((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"})(X||={});var te={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}}},ae={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}}},re={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}}},ne={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}}},ee={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}}},Qr=new j(new Map([[1,te],[2,ae],[3,re],[4,ne],[8,ee]]));var Wr={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 Lr 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(X).includes(a.segments))throw new Error("Invalid segments value");if(!Object.values(q).includes(a.riskLevel))throw new Error("Invalid risk level");let o=Qr.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=Wr[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 gr.Big(A);return{isFinished:!0,payout:{legs:[{amount:a.betAmount.mul(s)}]},payoutMultiplier:s,outputs:{result:u.values},randomValues:u}}}
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,s)=>(s=n==null?{}:e(i(n)),o(r||!n||!n.__esModule||!a.call(n,`default`)?t(s,`default`,{value:n,enumerable:!0}):s,n));let c=require("@betorigami/guard"),l=require("big.js");l=s(l,1);let u=require("@xstate/store"),d=require("fast-deep-equal");d=s(d,1);const f=Array.from({length:52},(e,t)=>t),p=[`Spades`,`Hearts`,`Diamonds`,`Clubs`],m=[`Ace`,`Two`,`Three`,`Four`,`Five`,`Six`,`Seven`,`Eight`,`Nine`,`Ten`,`Jack`,`Queen`,`King`],h=[`Jack`,`Queen`,`King`],g={Hearts:`red`,Diamonds:`red`,Spades:`black`,Clubs:`black`};let ee=function(e){return e.UNSUPPORTED_EDGE=`UNSUPPORTED_EDGE`,e.INPUT_VALIDATION_ERROR=`INPUT_VALIDATION_ERROR`,e}({});var _=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 te=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 v=class{gameId;constructor(e){this.gameId=e}getGameResult(e){let t=this.supportedEdgeConfigurations.includes(e.edge);return c.Guard.against(!t,()=>_.createUnsupportedEdgeError(`${this.gameId} does not support ${e.edge}% edge. Supported edge configurations include: ${this.supportedEdgeConfigurations}`)),this.determineGameResult(e)}},y=class{static withMultiplier(e,t){return new l.default(e).times(new l.default(100-t).div(100))}static withWinChance(e,t){return(0,l.default)(100-e).div(t)}};const b=1e4,x=10001,ne=e=>{if(e<0)throw _.createValidationError(`Lower bound ${e} is below minimum allowed value 0`)},re=e=>{if(e>1e4)throw _.createValidationError(`Upper bound ${e} is above maximum allowed value ${b}`)},S=e=>{if(ne(e.lower),re(e.upper),e.lower>=e.upper)throw _.createValidationError(`Lower bound ${e.lower} must be less than ${e.upper}`)},ie=(e,t)=>{let[n,r]=e.lower<=t.lower?[e,t]:[t,e];if(n.upper>r.lower)throw _.createValidationError(`Bounds must not overlap`)},ae=(e,t)=>t>=e.lower&&t<=e.upper,C=e=>e.upper-e.lower+1,w=(e,t)=>t>e.lower&&t<e.upper,T=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 E=e=>{let t=(()=>{switch(e.mode){case`ROLL_BETWEEN`:return S(e.bounds),T(e.bounds);case`ROLL_OUTSIDE`:return S(e.bounds),x-C(e.bounds);case`ROLL_BETWEEN_TWO`:return S(e.firstBounds),S(e.secondBounds),ie(e.firstBounds,e.secondBounds),T(e.firstBounds)+T(e.secondBounds)}})(),n=(0,l.Big)(t).div(x).mul(100);if(n.lt(.01))throw _.createValidationError(`Win chance too low`);if(n.gt(98))throw _.createValidationError(`Win chance too high`);return n},se=e=>{E(e)};var ce=class extends v{constructor(){super(`ADVANCED_DICE`)}get supportedEdgeConfigurations(){return[1,2,3,4,8]}getBetAmount(e){return e.betAmount}determineGameResult({generator:e,edge:t,gameInputs:n}){let r=E(n),i=e.getRandomInt({min:0,max:b}),a=i.value,o=(()=>{switch(n.mode){case`ROLL_BETWEEN`:return w(n.bounds,a);case`ROLL_OUTSIDE`:return!ae(n.bounds,a);case`ROLL_BETWEEN_TWO`:return w(n.firstBounds,a)||w(n.secondBounds,a)}})()?y.withWinChance(t,r):new l.Big(0);return{isFinished:!0,payout:{legs:[{amount:n.betAmount.mul(o)}]},payoutMultiplier:o,outputs:{result:i.values},randomValues:i}}},D=class{value;constructor(e){let t=f[e];c.Guard.againstNullOrUndefined(t,`Invalid card value: ${e}`),this.value=t}get suit(){let e=Math.floor(this.value/13),t=p[e];return c.Guard.againstNullOrUndefined(t,`Invalid suit index: ${e}`),t}get rank(){let e=this.value%13,t=m[e];return c.Guard.againstNullOrUndefined(t,`Invalid rank index: ${e}`),t}toDto(){return{rank:this.rank,suit:this.suit,cardValue:this.value}}};const O=e=>e.legs.reduce((e,t)=>e.add(t.amount),new l.default(`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}},k=e=>new l.default(0).add(e.bets.reduce((e,t)=>e.add(t.amount),new l.default(0))),he=(e,t)=>e===`TIE`&&(t===`PLAYER`||t===`BANKER`);var ge=class extends v{constructor(){super(`BACCARAT`)}get supportedEdgeConfigurations(){return[1]}getBetAmount(e){return k(e)}determineGameResult({generator:e,gameInputs:t}){this.validateGameInputs(t);let n=e.getRandomIntsWithReplacement({min:0,max:51,count:6}),r=n.values,i=r.slice(0,3),a=r.slice(3,6),o=[],s=0;for(let e of i.slice(0,2)){let t=this.mapRandomValueToCard(e),n=this.mapRandomValueToCardValue(e);o.push(t),s=(s+n)%10}let c=[],u=0;for(let e of a.slice(0,2)){let t=this.mapRandomValueToCard(e),n=this.mapRandomValueToCardValue(e);c.push(t),u=(u+n)%10}if(!this.isNaturalWin(s,u)){let e=this.shouldDrawThirdPlayerCard(s),t=null;e&&(t=this.mapRandomValueToCardValue(i[2]),o.push(this.mapRandomValueToCard(i[2])),s=(s+t)%10),this.shouldDrawThirdBankerCard(u,t)&&(c.push(this.mapRandomValueToCard(a[2])),u=(u+this.mapRandomValueToCardValue(a[2]))%10)}let d;d=s===u?`TIE`:s>u?`PLAYER_WIN`:`BANKER_WIN`;let f=k(t),{betType:p,multiplier:m}=me[d],h={legs:t.bets.map(e=>e.type===p?{amount:e.amount.mul(m)}:{amount:he(d,e.type)?e.amount:new l.default(`0`)})},g=O(h);return{isFinished:!0,payout:h,payoutMultiplier:f.gt(0)?g.div(f):new l.default(0),outputs:{playerCards:o,playerHandValue:s,bankerCards:c,bankerHandValue:u,gameOutcome:d,result:n.values},randomValues:n}}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 D(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 Se=2.5,A=.5,j={PLAYER_BLACKJACK:Se,WIN:2,PUSH:1,LOSE:0},M={EXACT_PAIR:26,COLORED_PAIR:11,MIXED_PAIR:7,LOSS:0},Ce={SUITED_TRIPS:101,STRAIGHT_FLUSH:51,THREE_OF_A_KIND:31,STRAIGHT:11,FLUSH:5,LOSS:0};var N=class e extends D{get numericRank(){return h.includes(this.rank)?10:m.indexOf(this.rank)+1}static fromValue(t){return c.Guard.against(!f.includes(t),`Invalid card value: ${t}`),new e(t)}},we=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}},Te=class{cards;value;constructor(e){this.cards=e.map(e=>N.fromValue(e)),this.value=new we(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}}},Ee=class e extends Te{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 we([this.upCard]).highestHandValue}}},P=class e extends Te{static withInitialDeal(t){return new e(t)}addDrawnCards(t){return new e([...this.rawValues,...t])}},De=class e{source;index=0;constructor(e){this.source=e}static from(t,n){return c.Guard.against(n<=0,`Count must be positive, got ${n}`),c.Guard.against(t.values.length!==n,`Expected ${n} values, got ${t.values.length}`),new e(t)}get consumedValues(){return this.source.values.slice(0,this.index)}toMultipleRandomValues(){return this.source}takeOne(){let e=this.source.values[this.index];return c.Guard.againstUndefined(e,`RandomValuePool exhausted`),this.index+=1,e}take(e){c.Guard.against(this.index+e>this.source.values.length,`RandomValuePool exhausted: requested ${e} but only ${this.source.values.length-this.index} remain`);let t=this.source.values.slice(this.index,this.index+e);return this.index+=e,t}},Oe=class{gameId;edge;constructor(e,t){this.gameId=e,this.edge=t,this.validateEdge(t)}play(e,t,n=[]){let r=this.createGameStore(),i=this.generateRandomValues(e),a=i.toMultipleRandomValues();for(let e of n)r.send({...e.playerArgument,randomValuePool:i});let o=n[n.length-1];o&&c.Guard.against(!(0,d.default)(o.state,this.toExternalState(r.getSnapshot().context.state)),`The final state of the game does not match the expected state based on the previous actions`),r.send({...t,randomValuePool:i});let s=r.getSnapshot().context;return{playerArgument:s.playerArgument,state:this.toExternalState(s.state),config:s.config,additionalBetAmount:s.additionalBetAmount,proof:{proofHash:a.proofHash,proofString:a.proofString}}}validateEdge(e){let t=this.supportedEdgeConfigurations.includes(e);c.Guard.against(!t,()=>_.createUnsupportedEdgeError(`${this.gameId} does not support ${e}% edge. Supported edge configurations include: ${this.supportedEdgeConfigurations}`))}};const ke=e=>[e.pairBonus===null?null:{amount:(0,l.default)(e.pairBonus.betAmount).mul(e.pairBonus.payoutMultiplier)},e.threeCardBonus===null?null:{amount:(0,l.default)(e.threeCardBonus.betAmount).mul(e.threeCardBonus.payoutMultiplier)}].filter(e=>e!==null),Ae=e=>{let t=e.betAmounts.mainBetAmount,n=e.actionType===`BLACKJACK_DOUBLE_DOWN`?t.mul(1):(0,l.default)(0),r=e.insuranceOutcome===void 0?(0,l.default)(0):e.insuranceStake,i=t.plus(n).mul(j[e.outcome]),a=e.insuranceOutcome===`WON`?r.mul(3):(0,l.default)(0),o=ke(e.sideBetResults),s=[{amount:i},...e.insuranceOutcome===void 0?[]:[{amount:a}],...o],u=O({legs:s}),d=t.plus(r).plus(n).plus(e.betAmounts.pairBonusAmount).plus(e.betAmounts.threeCardBonusAmount);c.Guard.against(d.eq(0),`Total bet amount cannot be zero`);let f=u.div(d);c.Guard.against(e.actionType===`BLACKJACK_SPLIT`,`SPLIT action type is not valid for standard multiplier calculation`);let p;switch(e.actionType){case`BLACKJACK_DOUBLE_DOWN`:p=n;break;case`BLACKJACK_BUY_INSURANCE`:p=e.insuranceStake;break;case`BLACKJACK_SPLIT`:p=t.mul(1)}return{payouts:s,totalBetAmount:d,multiplier:f,additionalBetAmount:p}},je=e=>{let t=e.betAmounts.mainBetAmount,n=e.mainHandDoubledDown?t.mul(1):(0,l.default)(0),r=e.splitHandDoubledDown?t.mul(1):(0,l.default)(0),i=e.insuranceOutcome===void 0?(0,l.default)(0):e.insuranceStake,a=t.plus(n).mul(j[e.mainOutcome]),o=t.plus(r).mul(j[e.splitOutcome]),s=e.insuranceOutcome===`WON`?i.mul(3):(0,l.default)(0),u=ke(e.sideBetResults),d=[{amount:a},{amount:o},...e.insuranceOutcome===void 0?[]:[{amount:s}],...u],f=O({legs:d}),p=t.plus(t).plus(i).plus(n).plus(r).plus(e.betAmounts.pairBonusAmount).plus(e.betAmounts.threeCardBonusAmount);c.Guard.against(p.eq(0),`Total bet amount cannot be zero`);let m=f.div(p),h;switch(e.actionType){case`BLACKJACK_DOUBLE_DOWN`:h=t.mul(1);break;case`BLACKJACK_SPLIT`:h=t.mul(1)}return{payouts:d,totalBetAmount:p,multiplier:m,additionalBetAmount:h}},Me=(e,t)=>t(e.mul(A)),F=e=>e.every(t=>t===e[0]),Ne=e=>{let t=[...e].sort((e,t)=>e-t);return t.every((e,n)=>{let r=t[n-1];return n===0||(c.Guard.againstUndefined(r,`Previous value cannot be undefined`),e===r+1)})},Pe={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},Fe={...Pe,Ace:14},Ie=e=>Ne(e.map(e=>Pe[e]))||Ne(e.map(e=>Fe[e])),Le=(e,t)=>{let n=N.fromValue(e),r=N.fromValue(t);return n.rank===r.rank?e===t?`EXACT_PAIR`:g[n.suit]===g[r.suit]?`COLORED_PAIR`:`MIXED_PAIR`:`LOSS`},Re=(e,t)=>({betAmount:e,result:t,payoutMultiplier:M[t]}),ze=(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=Ie(o);return F([e,t,n])?`SUITED_TRIPS`:s&&l?`STRAIGHT_FLUSH`:c?`THREE_OF_A_KIND`:l?`STRAIGHT`:s?`FLUSH`:`LOSS`},Be=(e,t)=>({betAmount:e,result:t,payoutMultiplier:Ce[t]}),Ve={state:{isFinished:!1,phase:`uninitialised`,multiplier:(0,l.default)(0)},config:{},playerArgument:{type:`START`,mainBetAmount:`0`,pairBonusAmount:`0`,threeCardBonusAmount:`0`}},I=e=>N.fromValue(e).value;function He(e){c.Guard.against(e.phase!==`in-progress`,`Expected a started, in-progress game state`)}function Ue(e){c.Guard.against(e.phase!==`awaiting-insurance`,`Expected game to be awaiting insurance decision`)}function L(e){c.Guard.against(e.phase!==`in-progress`&&e.phase!==`playing-main-hand`&&e.phase!==`playing-split-hand`,`Expected a started, in-progress game state`)}const We=(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`},Ge=e=>e.insuranceOutcome===void 0?(0,l.default)(0):e.calculateStake(e.betAmounts.mainBetAmount),Ke=e=>{let{payouts:t,multiplier:n,additionalBetAmount:r}=Ae({outcome:e.outcome,insuranceOutcome:e.insuranceOutcome,insuranceStake:Ge(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}},qe=e=>{let t=We(e.randomValuePool,e.dealerHand),n=R(e.playerHand,t);return Ke({...e,dealerHand:t,outcome:n})},Je=e=>{let t=e.mainHand.isBusted&&e.splitHand.isBusted?e.dealerHand:We(e.randomValuePool,e.dealerHand),n=R(e.mainHand,t),r=R(e.splitHand,t),{payouts:i,multiplier:a,additionalBetAmount:o}=je({hasSplit:!0,mainOutcome:n,splitOutcome:r,insuranceOutcome:e.insuranceOutcome,insuranceStake:Ge(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 Ye=class extends Oe{roundInsuranceStake;constructor(e,t){super(`BLACKJACK`,e),this.roundInsuranceStake=t}get supportedEdgeConfigurations(){return[1]}generateRandomValues(e){return De.from(e.getRandomIntsWithReplacement({min:0,max:51,count:63}),63)}toExternalState(e){let t=e.phase;switch(t){case`awaiting-insurance`:return{isFinished:!1,phase:`awaiting-insurance`,multiplier:e.multiplier,playerHand:e.playerHand.toDto(),dealerHand:e.dealerHand.toDto(!1),sideBetResults:e.sideBetResults};case`in-progress`:return{isFinished:!1,phase:`player-turn`,multiplier:e.multiplier,playerHand:e.playerHand.toDto(),dealerHand:e.dealerHand.toDto(!1),sideBetResults:e.sideBetResults};case`playing-main-hand`:return{isFinished:!1,phase:`playing-main-hand`,multiplier:e.multiplier,mainHand:e.mainHand.toDto(),splitHand:e.splitHand.toDto(),dealerHand:e.dealerHand.toDto(!1),sideBetResults:e.sideBetResults};case`playing-split-hand`:return{isFinished:!1,phase:`playing-split-hand`,multiplier:e.multiplier,mainHand:e.mainHand.toDto(),splitHand:e.splitHand.toDto(),dealerHand:e.dealerHand.toDto(!1),sideBetResults:e.sideBetResults};case`finished`:return{isFinished:!0,payout:e.payout,multiplier:e.multiplier,randomValues:e.randomValues,outcome:e.outcome,playerHand:e.playerHand.toDto(),dealerHand:e.dealerHand.toDto(!0),sideBetResults:e.sideBetResults,...e.insuranceOutcome!==void 0&&{insuranceOutcome:e.insuranceOutcome}};case`split-finished`:return{isFinished:!0,payout:e.payout,multiplier:e.multiplier,randomValues:e.randomValues,mainOutcome:e.mainOutcome,splitOutcome:e.splitOutcome,mainHand:e.mainHand.toDto(),splitHand:e.splitHand.toDto(),dealerHand:e.dealerHand.toDto(!0),sideBetResults:e.sideBetResults,...e.insuranceOutcome!==void 0&&{insuranceOutcome:e.insuranceOutcome}};case`uninitialised`:throw Error(`Cannot convert uninitialised state to external state`);default:c.Guard.againstNever(t,`Invalid state received`)}}createGameStore(){let e=e=>{let t=Me(e,this.roundInsuranceStake);return c.Guard.against(e.gt(0)&&t.eq(0),`Insurance stake rounds below the smallest unit this currency supports`),t},t=t=>Ke({...t,calculateStake:e}),n=t=>qe({...t,calculateStake:e}),r=t=>Je({...t,calculateStake:e});return(0,u.createStore)({context:Ve,on:{START:(e,n)=>{let{state:r}=e;c.Guard.against(r.phase!==`uninitialised`,`START action requires a fresh game`);let i=I(n.randomValuePool.takeOne()),a=I(n.randomValuePool.takeOne()),o=I(n.randomValuePool.takeOne()),s=I(n.randomValuePool.takeOne()),u=P.withInitialDeal([i,a]),d=Ee.withInitialDeal({upCard:o,holeCard:s}),f={mainBetAmount:(0,l.default)(n.mainBetAmount),pairBonusAmount:(0,l.default)(n.pairBonusAmount),threeCardBonusAmount:(0,l.default)(n.threeCardBonusAmount)},p={pairBonus:(0,l.default)(n.pairBonusAmount).gt(0)?Re(n.pairBonusAmount,Le(i,a)):null,threeCardBonus:(0,l.default)(n.threeCardBonusAmount).gt(0)?Be(n.threeCardBonusAmount,ze(i,a,o)):null},m={type:`START`,mainBetAmount:n.mainBetAmount,pairBonusAmount:n.pairBonusAmount,threeCardBonusAmount:n.threeCardBonusAmount};if(d.upCard.rank===`Ace`)return{state:{...r,isFinished:!1,phase:`awaiting-insurance`,playerHand:u,dealerHand:d,betAmounts:f,sideBetResults:p},config:{},playerArgument:m};let h={playerHand:u,dealerHand:d,randomValuePool:n.randomValuePool,playerArgument:m,betAmounts:f,sideBetResults:p};return u.isBlackjack&&d.isBlackjack?t({...h,outcome:`PUSH`}):u.isBlackjack?t({...h,outcome:`PLAYER_BLACKJACK`}):d.isBlackjack?t({...h,outcome:`LOSE`}):{state:{...r,isFinished:!1,phase:`in-progress`,playerHand:u,dealerHand:d,insuranceOutcome:void 0,betAmounts:f,sideBetResults:p},config:{},playerArgument:m}},BLACKJACK_BUY_INSURANCE:(n,r)=>{let{state:i}=n;Ue(i);let{playerHand:a,dealerHand:o,betAmounts:s,sideBetResults:c}=i,l={...i,randomValuePool:r.randomValuePool,playerArgument:{type:`BLACKJACK_BUY_INSURANCE`},betAmounts:s,sideBetResults:c};return a.isBlackjack&&o.isBlackjack?t({...l,outcome:`PUSH`,insuranceOutcome:`WON`}):a.isBlackjack?t({...l,outcome:`PLAYER_BLACKJACK`,insuranceOutcome:`LOST`}):o.isBlackjack?t({...l,outcome:`LOSE`,insuranceOutcome:`WON`}):{state:{...i,phase:`in-progress`,insuranceOutcome:`LOST`},config:{},playerArgument:{type:`BLACKJACK_BUY_INSURANCE`},additionalBetAmount:e(s.mainBetAmount)}},BLACKJACK_REJECT_INSURANCE:(e,n)=>{let{state:r}=e;Ue(r);let{playerHand:i,dealerHand:a,betAmounts:o,sideBetResults:s}=r,c={playerHand:i,dealerHand:a,randomValuePool:n.randomValuePool,playerArgument:{type:`BLACKJACK_REJECT_INSURANCE`},betAmounts:o,sideBetResults:s};return i.isBlackjack&&a.isBlackjack?t({...c,outcome:`PUSH`}):i.isBlackjack?t({...c,outcome:`PLAYER_BLACKJACK`}):a.isBlackjack?t({...c,outcome:`LOSE`}):{state:{...r,phase:`in-progress`,insuranceOutcome:void 0},config:{},playerArgument:{type:`BLACKJACK_REJECT_INSURANCE`}}},BLACKJACK_HIT:(e,i)=>{let{state:a}=e;switch(L(a),a.phase){case`playing-main-hand`:{let e=a.mainHand.addDrawnCards([I(i.randomValuePool.takeOne())]);return e.isBusted||e.highestHandValue===21?a.splitHand.highestHandValue===21?r({...a,mainHand:e,splitHandDoubledDown:!1,randomValuePool:i.randomValuePool,playerArgument:{type:`BLACKJACK_HIT`}}):{state:{...a,phase:`playing-split-hand`,mainHand:e,splitHandDoubledDown:!1},config:{},playerArgument:{type:`BLACKJACK_HIT`}}:{state:{...a,mainHand:e},config:{},playerArgument:{type:`BLACKJACK_HIT`}}}case`playing-split-hand`:{let e=a.splitHand.addDrawnCards([I(i.randomValuePool.takeOne())]);return e.isBusted||e.highestHandValue===21?r({...a,splitHand:e,randomValuePool:i.randomValuePool,playerArgument:{type:`BLACKJACK_HIT`}}):{state:{...a,splitHand:e},config:{},playerArgument:{type:`BLACKJACK_HIT`}}}case`in-progress`:{let e=a.playerHand.addDrawnCards([I(i.randomValuePool.takeOne())]);return e.isBusted?t({...a,playerHand:e,outcome:`LOSE`,randomValuePool:i.randomValuePool,playerArgument:{type:`BLACKJACK_HIT`}}):e.highestHandValue===21?n({...a,playerHand:e,randomValuePool:i.randomValuePool,playerArgument:{type:`BLACKJACK_HIT`}}):{state:{...a,phase:`in-progress`,playerHand:e},config:{},playerArgument:{type:`BLACKJACK_HIT`}}}default:c.Guard.againstNever(a,`Invalid phase for HIT action`)}},BLACKJACK_STAND:(e,t)=>{let{state:i}=e;switch(L(i),i.phase){case`playing-main-hand`:return i.splitHand.highestHandValue===21?r({...i,splitHandDoubledDown:!1,randomValuePool:t.randomValuePool,playerArgument:{type:`BLACKJACK_STAND`}}):{state:{...i,phase:`playing-split-hand`,splitHandDoubledDown:!1},config:{},playerArgument:{type:`BLACKJACK_STAND`}};case`playing-split-hand`:return r({...i,splitHandDoubledDown:i.splitHandDoubledDown,randomValuePool:t.randomValuePool,playerArgument:{type:`BLACKJACK_STAND`}});case`in-progress`:return n({...i,randomValuePool:t.randomValuePool,playerArgument:{type:`BLACKJACK_STAND`}});default:c.Guard.againstNever(i,`Invalid phase for STAND action`)}},BLACKJACK_DOUBLE_DOWN:(e,i)=>{let{state:a}=e;switch(L(a),a.phase){case`playing-main-hand`:{c.Guard.against(a.mainHand.cards.length!==2,`Double down is only allowed as the first action`);let e=a.mainHand.addDrawnCards([I(i.randomValuePool.takeOne())]),{betAmounts:t}=a;return a.splitHand.highestHandValue===21?r({...a,mainHand:e,mainHandDoubledDown:!0,splitHandDoubledDown:!1,randomValuePool:i.randomValuePool,playerArgument:{type:`BLACKJACK_DOUBLE_DOWN`}}):{state:{...a,phase:`playing-split-hand`,mainHand:e,mainHandDoubledDown:!0,splitHandDoubledDown:!1},config:{},playerArgument:{type:`BLACKJACK_DOUBLE_DOWN`},additionalBetAmount:t.mainBetAmount.mul(1)}}case`playing-split-hand`:{c.Guard.against(a.splitHand.cards.length!==2,`Double down is only allowed as the first action`);let e=a.splitHand.addDrawnCards([I(i.randomValuePool.takeOne())]);return r({...a,splitHand:e,randomValuePool:i.randomValuePool,playerArgument:{type:`BLACKJACK_DOUBLE_DOWN`},splitHandDoubledDown:!0})}case`in-progress`:{c.Guard.against(a.playerHand.cards.length!==2,`Double down is only allowed as the first action`);let e=a.playerHand.addDrawnCards([I(i.randomValuePool.takeOne())]);return e.isBusted?t({...a,playerHand:e,outcome:`LOSE`,randomValuePool:i.randomValuePool,playerArgument:{type:`BLACKJACK_DOUBLE_DOWN`}}):n({...a,playerHand:e,randomValuePool:i.randomValuePool,playerArgument:{type:`BLACKJACK_DOUBLE_DOWN`}})}default:c.Guard.againstNever(a,`Invalid phase for DOUBLE_DOWN action`)}},BLACKJACK_SPLIT:(e,t)=>{let{state:n}=e;He(n);let{playerHand:i,betAmounts:a,sideBetResults:o}=n;c.Guard.against(i.cards.length!==2,`Split is only allowed with exactly 2 cards`);let s=i.cards[0],u=i.cards[1];c.Guard.againstUndefined(s,`First card is missing`),c.Guard.againstUndefined(u,`Second card is missing`),c.Guard.against(s.rank!==u.rank,`Split requires two cards of the same rank`);let d=I(t.randomValuePool.takeOne()),f=I(t.randomValuePool.takeOne()),p=P.withInitialDeal([s.value,d]),m=P.withInitialDeal([u.value,f]);if(s.rank===`Ace`)return r({...n,mainHand:p,splitHand:m,randomValuePool:t.randomValuePool,playerArgument:{type:`BLACKJACK_SPLIT`},mainHandDoubledDown:!1,splitHandDoubledDown:!1});let h=p.highestHandValue===21,g=m.highestHandValue===21;return h&&g?r({mainHand:p,splitHand:m,dealerHand:n.dealerHand,randomValuePool:t.randomValuePool,playerArgument:{type:`BLACKJACK_SPLIT`},insuranceOutcome:n.insuranceOutcome,mainHandDoubledDown:!1,splitHandDoubledDown:!1,betAmounts:a,sideBetResults:o}):h?{state:{...n,phase:`playing-split-hand`,mainHand:p,splitHand:m,mainHandDoubledDown:!1,splitHandDoubledDown:!1},config:{},playerArgument:{type:`BLACKJACK_SPLIT`},additionalBetAmount:a.mainBetAmount.mul(1)}:{state:{...n,phase:`playing-main-hand`,multiplier:(0,l.default)(0),mainHand:p,splitHand:m,mainHandDoubledDown:!1},config:{},playerArgument:{type:`BLACKJACK_SPLIT`},additionalBetAmount:a.mainBetAmount.mul(1)}}}})}getValidNextActionTypes(e){if(e.isFinished)return[];switch(e.phase){case`awaiting-insurance`:return[`BLACKJACK_BUY_INSURANCE`,`BLACKJACK_REJECT_INSURANCE`];case`playing-main-hand`:{let t=[`BLACKJACK_HIT`,`BLACKJACK_STAND`];return e.mainHand.cards.length===2&&t.push(`BLACKJACK_DOUBLE_DOWN`),t}case`playing-split-hand`:{let t=[`BLACKJACK_HIT`,`BLACKJACK_STAND`];return e.splitHand.cards.length===2&&t.push(`BLACKJACK_DOUBLE_DOWN`),t}case`player-turn`:{let t=[`BLACKJACK_HIT`,`BLACKJACK_STAND`];if(e.playerHand.cards.length===2){t.push(`BLACKJACK_DOUBLE_DOWN`);let n=e.playerHand.cards[0],r=e.playerHand.cards[1];c.Guard.againstUndefined(n,`First player card is missing`),c.Guard.againstUndefined(r,`Second player card is missing`),n.rank===r.rank&&t.push(`BLACKJACK_SPLIT`)}return t}default:c.Guard.againstNever(e,`Invalid phase for getting valid actions`)}}};const Xe=()=>({minPicks:5,maxPicks:36}),Ze=e=>e.length===new Set(e).size,Qe=e=>{let t=(0,l.default)(1),n=(0,l.default)(52);for(let r=0;r<e;r+=1)t=t.mul((0,l.default)(52-r).div(n));return t};var $e=class extends v{constructor(){super(`BLITZ`)}get supportedEdgeConfigurations(){return[2]}getBetAmount(e){return e.betAmount}determineGameResult({generator:e,gameInputs:t,edge:n}){c.Guard.against(t.pickCount<1||t.pickCount>52,`pickCount must be between 1 and 52`),c.Guard.againstNonInteger(t.pickCount,`pickCount must be an integer`);let r=e.getRandomIntsWithReplacement({min:0,max:51,count:52}),i=r.values.slice(0,t.pickCount),a=Ze(i),o=Qe(t.pickCount),s=a?y.withMultiplier((0,l.default)(1).div(o),n):(0,l.default)(0);return{isFinished:!0,payout:{legs:[{amount:t.betAmount.mul(s)}]},payoutMultiplier:s,outputs:{result:r.values,cards:i.map(e=>new D(e).toDto())},randomValues:r}}};const et=4294967295;let tt=function(e){return e.EASY=`EASY`,e.MEDIUM=`MEDIUM`,e.HARD=`HARD`,e.EXPERT=`EXPERT`,e}({});const nt={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`]},rt={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`]},it={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`]},at={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`]},ot=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:nt,MEDIUM:rt,HARD:it,EXPERT:at};var st=class extends v{constructor(){super(`DARTS`)}get supportedEdgeConfigurations(){return[2]}getBetAmount(e){return e.betAmount}determineGameResult({generator:e,gameInputs:t}){let n=e.getRandomIntsWithReplacement({min:0,max:et,count:2}),r=n.values[0],i=n.values[1];c.Guard.againstUndefined(r,`Random number generator returned no value for clockWiseRotation`),c.Guard.againstUndefined(i,`Random number generator returned no value for distanceFromCentre`);let a=t.difficultyLevel,o=(0,l.default)(ct(a,r,i));return{isFinished:!0,payout:{legs:[{amount:t.betAmount.mul(o)}]},payoutMultiplier:o,outputs:{result:n.values},randomValues:n}}};const ct=(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?lt(r,t):a.ringFour},lt=(e,t)=>{let n=e.segments.length,r=Math.floor(t/4294967296*n),i=e.segments[r];return c.Guard.againstUndefined(i,`Segment index ${r} out of bounds`),e.multipliers.ringThree[i]};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 ut=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}]])),ft={2:`PAIR`,3:`THREE_OF_A_KIND`,4:`FOUR_OF_A_KIND`,5:`FIVE_OF_A_KIND`};var pt=class extends v{constructor(){super(`DIAMONDS`)}get supportedEdgeConfigurations(){return[1,2,3,4,8]}getBetAmount(e){return e.betAmount}determineGameResult({generator:e,edge:t,gameInputs:n}){let r=e.getRandomIntsWithReplacement({min:0,max:6,count:5}),i=dt.getMultipliers(t),a=r.values,o=(0,l.default)(this.calculatePayoutMultiplier(i,a));return{isFinished:!0,payout:{legs:[{amount:n.betAmount.mul(o)}]},payoutMultiplier:o,outputs:{result:r.values},randomValues:r}}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=ft[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 mt=function(e){return e.ABOVE=`ABOVE`,e.BELOW=`BELOW`,e}({});const V=1e4,ht=10001,gt=e=>{let t=e.direction===`ABOVE`?V-e.selectedValue:e.selectedValue;return new l.default(t).div(ht).mul(100)},_t=(e,t)=>e.direction===`ABOVE`?t>e.selectedValue:t<e.selectedValue;var vt=class extends v{constructor(){super(`DICE`)}get supportedEdgeConfigurations(){return[1,2,3,4,8]}getBetAmount(e){return e.betAmount}determineGameResult({generator:e,edge:t,gameInputs:n}){let r=e.getRandomInt({min:0,max:V}),i=gt(n),a=_t(n,r.value)?y.withWinChance(t,i):new l.default(0);return{isFinished:!0,payout:{legs:[{amount:n.betAmount.mul(a)}]},payoutMultiplier:a,outputs:{result:r.values},randomValues:r}}};let yt=function(e){return e.CLASSIC=`CLASSIC`,e.LOW_RISK=`LOW_RISK`,e.MEDIUM_RISK=`MEDIUM_RISK`,e.HIGH_RISK=`HIGH_RISK`,e}({});const bt=[1,2,3,4,5,6,7,8,9,10],xt=e=>bt.includes(e),St={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]}},Ct={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]}},wt={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]}},Tt={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]}},Et={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]}},Dt=new B(new Map([[1,St],[2,Ct],[3,wt],[4,Tt],[8,Et]]));var Ot=class extends v{constructor(){super(`KENO`)}get supportedEdgeConfigurations(){return[1,2,3,4,8]}getBetAmount(e){return e.betAmount}determineGameResult({generator:e,edge:t,gameInputs:n}){c.Guard.againstEmptyArray(n.selectedNumbers,()=>_.createValidationError(`No numbers selected`)),c.Guard.against(n.selectedNumbers.length>10,()=>_.createValidationError(`Maximum of 10 numbers can be selected`));for(let e of n.selectedNumbers)c.Guard.againstNonInteger(e,()=>_.createValidationError(`Only integers can be selected`)),c.Guard.against(e<0||e>39,()=>_.createValidationError(`Invalid number selected`));let r=e.getUniqueRandomInts({min:0,max:39,count:10}),i=n.selectedNumbers.filter(e=>r.values.includes(e)),a=n.selectedNumbers.length;if(!xt(a))throw Error(`Invalid tile count: ${a}`);let o=Dt.getMultipliers(t)[a][n.riskLevel][i.length];if(o===void 0)throw Error(`No multiplier found for matching tile count ${i.length}`);let s=new l.default(o);return{isFinished:!0,payout:{legs:[{amount:n.betAmount.mul(s)}]},payoutMultiplier:s,outputs:{result:r.values},randomValues:r}}};const kt=(e,t)=>e.gt(t)?e:t,At=(e,t)=>e.lt(t)?e:t;var jt=class extends v{constructor(){super(`LIMBO`)}get supportedEdgeConfigurations(){return[1,2,3,4,8]}getBetAmount(e){return e.betAmount}determineGameResult({generator:e,edge:t,gameInputs:n}){let r=e.getRandomInt({min:1,max:4294967295}),i=r.max,a=new l.default(16777216),o=new l.default(1),s=new l.default(1e6),c=r.value,u=new l.default(c-1).div(i),d=(100-t)/100,f=a.div(u.mul(a).plus(1)).mul(d),p=kt(o,At(f,s)),m=p.gte(n.targetMultiplier)?new l.default(n.targetMultiplier):new l.default(0);return{isFinished:!0,payout:{legs:[{amount:n.betAmount.mul(m)}]},payoutMultiplier:m,outputs:{randomMultiplier:p,result:r.values},randomValues:r}}};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 Mt=class extends v{constructor(){super(`MINES`)}get supportedEdgeConfigurations(){return[1,2,3,4,8]}getBetAmount(e){return e.betAmount}determineGameResult({generator:e,edge:t,gameInputs:n}){if(n.minesCount<=0||n.minesCount>24)throw Error(`Must select between 1 and 24 mines.`);if(n.selectedTiles.length>25-n.minesCount)throw Error(`Cannot select more tiles than available safe tiles (total tiles minus mines).`);let r=e.getUniqueRandomInts({min:1,max:25,count:n.minesCount}),i=r.values.some(e=>n.selectedTiles.includes(e)),a=n.hasCashedOut||i,o=(100-t)/100,s=new l.default(H(25-n.minesCount,n.selectedTiles.length)).div(new l.default(H(25,n.selectedTiles.length))),c=n.hasCashedOut&&!i?new l.default(o).div(s):new l.default(0);return{isFinished:a,payout:{legs:[{amount:n.betAmount.mul(c)}]},payoutMultiplier:c,outputs:{result:r.values},randomValues:r}}};let Nt=function(e){return e.LOW_RISK=`LOW_RISK`,e.MEDIUM_RISK=`MEDIUM_RISK`,e.HIGH_RISK=`HIGH_RISK`,e}({});const Pt=[8,9,10,11,12,13,14,15,16],Ft=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 It=class extends v{constructor(){super(`PLINKO`)}get supportedEdgeConfigurations(){return[1,2,3,4,8]}getBetAmount(e){return e.betAmount}determineGameResult({generator:e,gameInputs:t,edge:n}){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 r=t.numberOfRows,i=Ft.getMultipliers(n)[t.riskLevel][r],a=e.getRandomIntsWithReplacement({min:0,max:1,count:t.numberOfRows}),o=a.values.reduce((e,t)=>e+t,0),s=i[o];if(s===void 0)throw Error(`No payout found for end position ${o}`);let c=(0,l.Big)(s);return{isFinished:!0,payout:{legs:[{amount:t.betAmount.mul(c)}]},payoutMultiplier:c,outputs:{result:a.values},randomValues:a}}};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],Lt=[37,...U],Rt=[[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]],zt=[[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]],Bt=[[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]],Vt=[[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]],Ht=[[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]],Ut=[[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]],Wt=[0,1,2,3,37],Gt=[[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]],Kt=[[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}({}),qt=function(e){return e.AMERICAN=`AMERICAN`,e.EUROPEAN=`EUROPEAN`,e}({});const Y=2.7,X=5.3,Jt=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 _.createValidationError(`Must place at least a single bet.`);if(!e.straightBets.every(e=>e.amount.gte(0)&&Z(e.value)))throw _.createValidationError(`Invalid straight bet.`);if(!e.splitBets.every(e=>e.amount.gte(0)&&Yt(e.values)))throw _.createValidationError(`Invalid split bet.`);if(!e.streetBets.every(e=>e.amount.gte(0)&&Xt(e.values)))throw _.createValidationError(`Invalid street bet.`);if(!e.cornerBets.every(e=>e.amount.gte(0)&&Zt(e.values)))throw _.createValidationError(`Invalid corner bet.`);if(!e.doubleStreetBets.every(e=>e.amount.gte(0)&&Qt(e.values)))throw _.createValidationError(`Invalid double street bet.`);if(!e.parityBets.every(e=>e.amount.gte(0)&&Object.values(W).includes(e.parity)))throw _.createValidationError(`Invalid parity bet.`);if(!e.colorBets.every(e=>e.amount.gte(0)&&Object.values(G).includes(e.color)))throw _.createValidationError(`Invalid color bet.`);if(!e.halfBets.every(e=>e.amount.gte(0)&&Object.values(K).includes(e.half)))throw _.createValidationError(`Invalid half bet.`);if(!e.columnBets.every(e=>e.amount.gte(0)&&Object.values(q).includes(e.column)))throw _.createValidationError(`Invalid column bet.`);if(!e.dozenBets.every(e=>e.amount.gte(0)&&Object.values(J).includes(e.dozen)))throw _.createValidationError(`Invalid dozen bet.`)},Z=e=>U.includes(e),Yt=e=>e.length!==2||!e.every(Z)?!1:Rt.some(([t,n])=>t===e[0]&&n===e[1]),Xt=e=>e.length!==3||!e.every(Z)?!1:Bt.some(([t,n,r])=>t===e[0]&&n===e[1]&&r===e[2]),Zt=e=>e.length!==4||!e.every(Z)?!1:Ht.some(([t,n,r,i])=>t===e[0]&&n===e[1]&&r===e[2]&&i===e[3]),Qt=e=>e.length!==6||!e.every(Z)?!1:Gt.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]),$t=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 _.createValidationError(`Must place at least a single bet.`);if(!e.straightBets.every(e=>e.amount.gte(0)&&Q(e.value)))throw _.createValidationError(`Invalid straight bet.`);if(!e.splitBets.every(e=>e.amount.gte(0)&&en(e.values)))throw _.createValidationError(`Invalid split bet.`);if(!e.streetBets.every(e=>e.amount.gte(0)&&tn(e.values)))throw _.createValidationError(`Invalid street bet.`);if(!e.cornerBets.every(e=>e.amount.gte(0)&&nn(e.values)))throw _.createValidationError(`Invalid corner bet.`);if(!e.basketBets.every(e=>e.amount.gte(0)))throw _.createValidationError(`Invalid basket bet.`);if(!e.doubleStreetBets.every(e=>e.amount.gte(0)&&rn(e.values)))throw _.createValidationError(`Invalid double street bet.`);if(!e.parityBets.every(e=>e.amount.gte(0)&&Object.values(W).includes(e.parity)))throw _.createValidationError(`Invalid parity bet.`);if(!e.colorBets.every(e=>e.amount.gte(0)&&Object.values(G).includes(e.color)))throw _.createValidationError(`Invalid color bet.`);if(!e.halfBets.every(e=>e.amount.gte(0)&&Object.values(K).includes(e.half)))throw _.createValidationError(`Invalid half bet.`);if(!e.columnBets.every(e=>e.amount.gte(0)&&Object.values(q).includes(e.column)))throw _.createValidationError(`Invalid column bet.`);if(!e.dozenBets.every(e=>e.amount.gte(0)&&Object.values(J).includes(e.dozen)))throw _.createValidationError(`Invalid dozen bet.`)},Q=e=>Lt.includes(e);function en(e){return e.length!==2||!e.every(Q)?!1:zt.some(([t,n])=>t===e[0]&&n===e[1])}const tn=e=>e.length!==3||!e.every(Q)?!1:Vt.some(([t,n,r])=>t===e[0]&&n===e[1]&&r===e[2]),nn=e=>e.length!==4||!e.every(Q)?!1:Ut.some(([t,n,r,i])=>t===e[0]&&n===e[1]&&r===e[2]&&i===e[3]),rn=e=>e.length!==6||!e.every(Q)?!1:Kt.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]),an=(e,t)=>{let n=t===2.7&&e.type===`EUROPEAN`,r=t===5.3&&e.type===`AMERICAN`;if(!n&&!r)throw _.createValidationError(`Attempted to play ${e.type} roulette on edge ${t}`)},on=(e,t)=>{an(e,t),e.type===`EUROPEAN`?Jt(e.inputs):$t(e.inputs)},sn={straightBets:36,splitBets:18,streetBets:12,cornerBets:9,basketBets:7,doubleStreetBets:6,parityBets:2,colorBets:2,halfBets:2,columnBets:3,dozenBets:3},$=[3,6,9,12,15,18,21,24,27,30,33,36],cn=[2,5,8,11,14,17,20,23,26,29,32,35],ln=[1,4,7,10,13,16,19,22,25,28,31,34],un=[1,3,5,7,9,12,14,16,18,19,21,23,25,27,30,32,34,36],dn=[2,4,6,8,10,11,13,15,17,20,22,24,26,28,29,31,33,35];var fn=class extends v{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 n=this.getBetTotals(e),r=this.calculateTotalBetAmount(n),i={legs:this.calculatePayoutLegs(e,t)},a=O(i);return{payoutMultiplier:r.gt(0)?a.div(r):new l.Big(0),payout:i}}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 l.Big(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 un.includes(t)&&n.color===`RED`||dn.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 $.includes(t)&&n.column===`TOP`||cn.includes(t)&&n.column===`MIDDLE`||ln.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 l.Big(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(n=>{let r=sn[n],i=this.betPredicates[n];return e[n].map(e=>i(e,t)?{amount:e.amount.mul(r||0)}:{amount:new l.Big(`0`)})})}},pn=class extends fn{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){Jt(e)}},mn=class extends fn{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){$t(e)}isWinningBasketBet(e,t){return Wt.some(e=>e===t)}},hn=class extends v{europeanGame;americanGame;constructor(){super(`ROULETTE`),this.europeanGame=new pn,this.americanGame=new mn}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(on(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 gn=e=>new hn().getBetAmount(e);let _n=function(e){return e.LOW_RISK=`LOW_RISK`,e.MEDIUM_RISK=`MEDIUM_RISK`,e.HIGH_RISK=`HIGH_RISK`,e}({}),vn=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 yn=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}}}]])),bn={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 xn=class extends v{constructor(){super(`WHEEL`)}get supportedEdgeConfigurations(){return[1,2,3,4,8]}getBetAmount(e){return e.betAmount}determineGameResult({generator:e,gameInputs:t,edge:n}){if(!Object.values(vn).includes(t.segments))throw Error(`Invalid segments value`);if(!Object.values(_n).includes(t.riskLevel))throw Error(`Invalid risk level`);let r=yn.getMultipliers(n)[t.riskLevel];if(r===void 0)throw Error(`No multipliers found for risk level ${t.riskLevel}`);let i=r[t.segments];if(i===void 0)throw Error(`No multipliers found for segment ${t.segments}`);let a=bn[t.riskLevel];if(a===void 0)throw Error(`No patterns found for risk level ${t.riskLevel}`);let o=a[t.segments];if(o===void 0)throw Error(`No patterns found for segment ${t.segments}`);let s=e.getRandomInt({min:0,max:o.length-1}),c=o[s.value];if(c===void 0)throw Error(`No pattern found for segment ${t.segments} and value ${s.value}`);let u=i[c];if(u===void 0)throw Error(`No payout found for picked segment ${c}`);let d=new l.Big(u);return{isFinished:!0,payout:{legs:[{amount:t.betAmount.mul(d)}]},payoutMultiplier:d,outputs:{result:s.values},randomValues:s}}};exports.ACE_SOFT_BONUS=10,exports.AMERICAN_BASKET=Wt,exports.AMERICAN_HOUSE_EDGE=X,exports.AdvancedDice=ce,exports.AmericanRoulette=mn,exports.BASE_PAYOUT_MULTIPLIERS=j,exports.BLACKJACK_MULTIPLIER=Se,exports.BLACKJACK_VALUE=21,exports.BLACK_NUMBERS=dn,exports.BLITZ_CARD_COUNT=52,exports.BLITZ_MAX_CARD_RANGE=51,exports.BLITZ_MIN_CARD_RANGE=0,exports.BLITZ_RANDOM_NUMBER_COUNT=52,exports.BOTTOM_COLUMN=ln,exports.BUST_VALUE=21,exports.Baccarat=ge,exports.BaccaratBetType=pe,exports.BaccaratOutcome=fe,exports.Blackjack=Ye,exports.BlackjackActionType=ye,exports.BlackjackOutcome=_e,exports.Blitz=$e,exports.CARDS_PER_SUIT=13,exports.CARD_RANKS=m,exports.CARD_SUITS=p,exports.CARD_SUIT_COLORS=g,exports.CARD_VALUES=f,exports.Color=G,exports.Column=q,exports.DARTS_BOARD_CONFIGS=z,exports.DARTS_DIFFICULTY_LEVEL=tt,exports.DARTS_MAX_VALUE=et,exports.DARTS_MIN_VALUE=0,exports.DEALER_STAND_VALUE=17,exports.DICE_EFFECTIVE_RANGE=ht,exports.DICE_MAX_ROLL=V,exports.DICE_MIN_ROLL=0,exports.DOUBLE_DOWN_BET_SIZE_FACTOR=1,exports.Darts=st,exports.Diamonds=pt,exports.DiamondsResultType=ut,exports.Dice=vt,exports.DiceDirection=mt,exports.Dozen=J,exports.EFFECTIVE_RANGE=x,exports.EUROPEAN_HOUSE_EDGE=Y,exports.EuropeanRoulette=pn,exports.FACE_CARD_RANKS=h,exports.FACE_CARD_VALUE=10,exports.GameError=_,exports.GameErrorCode=ee,exports.Half=K,exports.INSURANCE_BET_SIZE_FACTOR=A,exports.INSURANCE_WIN_MULTIPLIER=3,exports.InsuranceOutcome=ve,exports.Keno=Ot,exports.KenoRiskLevel=yt,exports.LOSE_MULTIPLIER=0,exports.Limbo=jt,exports.MAX_CARDS_PER_ROUND=63,exports.MAX_CARD_VALUE=51,exports.MAX_WIN_CHANCE=98,exports.MIDDLE_COLUMN=cn,exports.MIN_CARD_VALUE=0,exports.MIN_WIN_CHANCE=.01,exports.Mines=Mt,exports.MultiActionGame=Oe,exports.MultiplierCalculator=y,exports.OrigamiGame=te,exports.PAIR_BONUS_PAYOUTS=M,exports.PAYOUT_MULTIPLIERS=sn,exports.PLINKO_ROW_COUNTS=Pt,exports.PUSH_MULTIPLIER=1,exports.PairBonusType=be,exports.Parity=W,exports.Plinko=It,exports.PlinkoRiskLevel=Nt,exports.RANDOM_MAX_VALUE=b,exports.RANDOM_MIN_VALUE=0,exports.RED_NUMBERS=un,exports.RandomValuePool=De,exports.RollType=oe,exports.Roulette=hn,exports.RouletteType=qt,exports.SPLIT_BET_SIZE_FACTOR=1,exports.SingleActionGame=v,exports.THREE_CARD_BONUS_PAYOUTS=Ce,exports.TILE_COUNTS=bt,exports.TOP_COLUMN=$,exports.ThreeCardBonusType=xe,exports.VALID_AMERICAN_CORNERS=Ut,exports.VALID_AMERICAN_DOUBLE_STREETS=Kt,exports.VALID_AMERICAN_SPLITS=zt,exports.VALID_AMERICAN_STRAIGHTS=Lt,exports.VALID_AMERICAN_STREETS=Vt,exports.VALID_EUROPEAN_CORNERS=Ht,exports.VALID_EUROPEAN_DOUBLE_STREETS=Gt,exports.VALID_EUROPEAN_SPLITS=Rt,exports.VALID_EUROPEAN_STRAIGHTS=U,exports.VALID_EUROPEAN_STREETS=Bt,exports.VALID_RANKS=ue,exports.VALID_SUITS=le,exports.WIN_MULTIPLIER=2,exports.Wheel=xn,exports.WheelRiskLevel=_n,exports.WheelSegments=vn,exports.advancedDiceGetExclusiveBoundsRange=T,exports.advancedDiceGetInclusiveBoundsRange=C,exports.advancedDiceIsWithinBoundsExclusive=w,exports.advancedDiceIsWithinBoundsInclusive=ae,exports.bigMax=kt,exports.bigMin=At,exports.calculateAdvancedDiceWinChance=E,exports.calculateBaccaratBetAmount=k,exports.calculateBlitzWinChance=Qe,exports.calculateDiceWinChance=gt,exports.calculateInsuranceStake=Me,exports.calculateRouletteBetAmount=gn,exports.diamondsMultipliers=dt,exports.getBlitzDefaults=Xe,exports.getMaxMultiplierForDifficulty=ot,exports.hasBlitzWon=Ze,exports.hasDiceWon=_t,exports.isTileCount=xt,exports.kenoMultipliers=Dt,exports.nCr=H,exports.plinkoMultipliers=Ft,exports.rtp92Multipliers=Et,exports.rtp96Multipliers=Tt,exports.rtp97Multipliers=wt,exports.rtp98Multipliers=Ct,exports.rtp99Multipliers=St,exports.sumPayout=O,exports.validateAdvancedDiceInputs=se,exports.validateRouletteGameInputs=on;