"use strict";(self.webpackChunkcrashlogic=self.webpackChunkcrashlogic||[]).push([[954],{1954:(e,t,n)=>{n.r(t),n.d(t,{default:()=>U});var u=n(8416),a=n(5694),o=n(6606),r=n(1100),i=n.n(r),l=n(7156),c=n.n(l),s=n(6345),d=n(701),f=n(3953),v=n(8030),p=n(9234),b=n(8513),y=n(342),m=n(2663);function h(e){return h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},h(e)}function g(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);t&&(u=u.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,u)}return n}function B(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,u=new Array(t);n0),We(e.isAutoBet&&e.autoBet>0),De(e.autoBet),Ye(e.autoBet>0||e.autoCashout>1))}),[ue.pending,ue.current]),(0,u.useEffect)((function(){var e,t;switch($e({text:m.xf&&"999"!==m.xJ?le:ce,textSmall:se,value:"",type:O,halfValue:""}),J.enabled&&((null===(e=J.selected)||void 0===e?void 0:e.type)===s.BonusTypes.FreeBet?(null===ue.current&&null===ue.pending&&Be(J.selected.bet),$e({text:"".concat(ve," (").concat(J.selected.remainingCount,")"),textSmall:se,value:"",type:_,halfValue:""})):(null===(t=J.selected)||void 0===t?void 0:t.type)===s.BonusTypes.FreeAmount&&$e({text:de,textSmall:se,value:"",type:_,halfValue:""})),L){case N:ue.pending&&$e({text:ie,textSmall:se,value:"",type:w,halfValue:""});break;case T:(ue.current||ue.pending)&&$e({text:ie,textSmall:se,value:"",type:w,halfValue:""});break;case j:if(!g&&ue.current||g&&ue.current&&!ae){var n=(ue.current.betInfo[0].win>0?ue.current.betInfo[1].bet:ue.current.bet)*(ne-(2===ue.current.winType?1:0));$e({text:fe,textSmall:se,value:(U0))}),[ue.current,L]),(0,u.useEffect)((function(){function e(e){var t,n;"emwindow"===(null==e||null===(t=e.data)||void 0===t?void 0:t.sender)&&"stopAutospins"===(null==e||null===(n=e.data)||void 0===n?void 0:n.name)&&(A(b.actions.updateStopAutoBets()),De(0),We(!1))}return window.addEventListener("message",e),m.xf||C("GalaxsysStopAutoPlay",(function(){A(b.actions.updateStopAutoBets()),De(0),We(!1)})),function(){window.removeEventListener("message",e),m.xf||P("GalaxsysStopAutoPlay")}}),[]),(0,u.useEffect)((function(){var e,t,n=ue.current||{};((null===(e=n.betInfo)||void 0===e||null===(e=e[0])||void 0===e?void 0:e.win)>0?(null===(t=n.betInfo)||void 0===t||null===(t=t[1])||void 0===t?void 0:t.bet)||0:n.bet)*(ne-(2===n.winType?1:0))>=U&&be.current&&L===j&&(be.current=!1,A(b.actions.addNotification((0,o.getNotificationById)(X,998)))),L===T&&(be.current=!0)}),[null===(r=ue.current)||void 0===r?void 0:r.bet,U,ne,L]);var ze=function(){var e=Re?+(0,o.toNumberString)(Ee):0;d.settings.playSound("bet");var t=(null==J?void 0:J.selected)||null,n=(t||{}).isGalaxsysBonus,u=V(t);if(0!==e&&e<1.01)A(b.actions.addNotification((0,o.getNotificationById)(X,11)));else{if(m.xf&&Q-Pe<0)return A(b.actions.addNotification((0,o.getNotificationById)(X,4))),void(Q>=M&&Be({value:M,validationValue:ge}));if(!Pe||PeM)Be({value:M,validationValue:ge});else{var r={gameId:z,activeGameId:m.N2,partnerId:m.y_,token:ee,bet:Pe,combination:{autoCashout:e,isAutoBet:Me&&je>0,index:h},betType:u,bonusId:(null==t?void 0:t.id)||0,autoBet:je,index:h,isGalaxsysBonus:n};if(A(b.actions.addPendingStake(r)),L===T)if(m.xf)(0,a.batch)((function(){A(b.actions.addNotification((0,o.getNotificationById)(X,0))),A(b.actions.addDemoTicket({index:h}))}));else{A(b.actions.setPlayerPressed({index:h,pressed:!0}));var i=new y.Kb.AddStake(r);(0,f.requestToServer)(i)}}}},Ze=function(e){var t;if(H){var n=(null===(t=ue.current)||void 0===t?void 0:t.stakeId)||0;if(!n||m.xf){if(ne<1.01)return void A(b.actions.addNotification((0,o.getNotificationById)(X,999)));A(b.actions.cashoutDemoTicket({index:h,cashoutType:e}))}else{A(b.actions.setPlayerPressed({index:h,pressed:!0,halfPressed:1===e}));var u=new y.Kb.StopStake({gameId:z,stakeId:n,ping:Z,token:ee,index:h,cashoutType:e});(0,f.requestToServer)(u)}}},et=function(){var e;if(H){d.settings.playSound("cancel");var t=V((null==J?void 0:J.selected)||null),n=(null===(e=ue.current)||void 0===e?void 0:e.stakeId)||0;if(Me&&!K&&(K=!0,m.xf||k("GalaxsysAutoPlay",{state:"finish",remainingCount:je})),null===i()||void 0===i()||i().removeItem("pending_autobet_".concat(h)),null===i()||void 0===i()||i().removeItem("autobet_count_".concat(h)),!n||m.xf)A(b.actions.cancelMyTicket({index:h,stakeId:n}));else{A(b.actions.setPlayerPressed({index:h,pressed:!0}));var u=new y.Kb.CancelStake({gameId:z,stakeId:n,token:ee,index:h,bet:+(0,o.toNumberString)(ge),betType:t});(0,f.requestToServer)(u)}}};(0,u.useEffect)((function(){!J.enabled&&je>0&&(A(b.actions.cancelAutoBetData({index:h})),null===i()||void 0===i()||i().removeItem("pending_autobet_".concat(h)),null===i()||void 0===i()||i().removeItem("autobet_count_".concat(h)))}),[J.enabled]);var tt=(0,u.useCallback)((function(){Oe(Re?0:2.5),Ke(!Re)}),[Re]),nt=(0,u.useCallback)((function(){Me&&ut(),Re&&tt(),Ye((function(e){return e&&(null===i()||void 0===i()||i().removeItem("autobet_count_".concat(h)),null===i()||void 0===i()||i().removeItem("pending_autobet_".concat(h))),!e}))}),[Le,Me,Re]),ut=(0,u.useCallback)((function(){(L===T||L===j&&null===ue.current)&&Me&&et(),We((function(e){return e?(null===i()||void 0===i()||i().removeItem("autobet_count_".concat(h)),null===i()||void 0===i()||i().removeItem("pending_autobet_".concat(h)),De(0)):De(10),!e}))}),[J,L,ue.current,ge,Me,Re,Ee,h,me.current,z]),at=(0,u.useCallback)((function(e){var t=e.currentTarget.dataset.quickbet;xe(+t)}),[]),ot=(0,u.useCallback)((function(){A(b.actions.openPopup({name:v.BASE_POPUP_NAMES.KEYBOARD,args:{title:ce,getter:ge,setter:Be,config:{extended:!0,dot:!0}}}))}),[ge]),rt=(0,u.useCallback)((function(){A(b.actions.openPopup({name:v.BASE_POPUP_NAMES.KEYBOARD,args:{type:s.KEYBOARD_POPUP_NAMES.AUTO_CASHOUT,title:re,getter:Ee,setter:Oe,config:{extended:!1,dot:!0}}}))}),[Ee]),it=(0,u.useCallback)((function(){A(b.actions.openPopup({name:v.BASE_POPUP_NAMES.KEYBOARD,args:{type:s.KEYBOARD_POPUP_NAMES.AUTO_BET,title:oe,getter:je,setter:De,config:{extended:!1,dot:!1}}}))}),[je]),lt=(0,u.useCallback)((function(){var e;switch(Xe.type){case O:case _:ze();break;case E:Ze((null===(e=ue.current)||void 0===e?void 0:e.betInfo[0].win)>0?y.AS.FullAfterPartial:y.AS.Full);break;case w:var t;Me&&null!==(t=ue.current)&&void 0!==t&&t.stakeId&&De(je+1),et();break;default:ze()}}),[h,Xe,ge,Re,Ee,ue.current,J,Me,je,Q,z,Z,L]);(0,u.useEffect)((function(){var e;Me&&!ue.current&&(null===(e=me.current)||void 0===e||e.focus())}),[Me]),(0,u.useEffect)((function(){var e;Re&&!ue.current&&(null===(e=ye.current)||void 0===e||e.focus())}),[Re]);var ct=(0,u.useMemo)((function(){return!(!ue.current&&!ue.pending)||""}),[ue]),st=Xe.type===E||Xe.type===w&&!Me,dt=S((null==ue||null===(l=ue.current)||void 0===l?void 0:l.betInfo)||[],2),ft=dt[0],vt=dt[1],pt=null==ft?void 0:ft.win,bt=null==vt?void 0:vt.win,yt=Xe;return null!=ue&&ue.current||null!=ue&&ue.pending||Xe.type!==E||(yt=B(B({},yt),{},{type:O,text:m.xf&&"999"!==m.xJ?le:ce})),B(B({},yt),{},{buttonState:yt,info1Win:pt,info2Win:bt,isAuto:Le,toggleAutoPart:nt,stake:ue,status:L,culture:m.TG,currencyId:Y,precision:W,bonuses:J,quickBets:$,disabled:ct,disableAutobet:st,cashoutRef:ye,autoCashout:Ee,isAutoCashout:Re,isAutoBet:Me,bet:ge,betRef:pe,autoBetRef:me,autoBet:je,handleAutoCashoutChange:tt,handleAutoBetChange:ut,handleQuickBetClick:at,handleAllInClick:ke,handleDoubleBetClick:Ce,handleBetInputClick:ot,handleAutoCashoutInputClick:rt,handleAutoBetInputClick:it,handlePartialCashout:function(){var e=Pe*ne>U?y.AS.Full:y.AS.Partial;m.xf?ne>1?Ze(e):A(b.actions.addNotification((0,o.getNotificationById)(X,999))):Ze(e)},handleButtonClick:lt,handleIncrementBet:He,handleDecrementBet:Je,handleBetInputChange:Ae,handleBetInputKey:Se,handleAutoCashoutInputChange:_e,handleAutoCashoutInputKey:Ne,handleAutoBetInputChange:Ve,handleAutoBetInputKey:Ge,resources:X})}}}]);