@betorigami/game-calculations 8.1.0 → 9.0.1

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