import{a as T,b,r as s,c as N,j as t}from"./vendor-CmAScyG3.js";import{F as p}from"./page-FortuneWheel.ts-CaqHFvhq.js";import{R as f,W as v,F as w,H as O}from"./page-index.tsx-D0oEuWOa.js";import{u as I}from"./page-useConfigWheel.tsx-CttGGJtP.js";import{u as r}from"./page-fortuneWheel.ts-BU2wXqek.js";import{u as P}from"./page-useWheelAvailable.tsx-DKmHJibQ.js";try{let e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="b117d88b-6787-4ec3-a2f2-798dc737089a",e._sentryDebugIdIdentifier="sentry-dbid-b117d88b-6787-4ec3-a2f2-798dc737089a")}catch{}const x={CATEGORY:"category",CURRENCY:"currency",PROVIDERS:"name",POPUP:"popup",NOTIFICATION_ID:"notificationId",SUBPOPUP:"subpopup",STATUS:"status",METHOD:"method",MODE:"mode",CLICK_ID:"clid",LANG:"lang",SEARCH_RESULT:"search_result",BONUS_ID:"bonusId",UTM_MEDIUM:"utm_medium",UTM_SOURCE:"utm_source",UTM_CAMPAIGN:"utm_campaign",PAGE:"page",TOURNAMENT:"tournament",LIVE_CASINO:"live-casino",URL_ALIAS:"url_alias",BRAND:"b",TOKEN:"token",AUTH_TOKEN:"authToken"},g={popup:{signIn:"sign-in",signUp:"sign-up",recovery:"recovery",recoveryComplete:"recovery-complete",deposit:"deposit",withdraw:"withdraw",winWheel:"win-wheel",regWheel:"reg-wheel",aviatorReg:"aviatore-registration",changePassword:"change-password",changeEmail:"change-email",depositResult:"deposit-result",withdrawResult:"withdraw-result",failDeposit:"deposit-failed",bonus:"bonus",cancelBonus:"cancel-bonus",changeLanguage:"change-language",provider:"provider",sortProvider:"sort-provider",gameSearch:"game-search",logoutConfirm:"logout-confirm",password:"password",sideMenu:"side-menu",countries:"countries",invite:"invite",inviteNull:"invite-null",sortTransaction:"sort-transaction",share:"share",coinStrikeReg:"coin-strike-registration",promocodeApply:"promocode-apply",phoneCountries:"phone-countries",welcomeBonusNotification:"notification-welcome",firstDepositNotification:"notification-first-deposit",transferToMainNotification:"notification-transfer-to-main",wageringCounterNotification:"notification-wagering-counter",bonusAddedNotification:"notification-bonus-added",independenceDayCounterNotification:"notification-independence-counter",independenceDayFinalNotification:"notification-independence-final",independenceDayNotification:"notification-independence-day",moneyBonusNotification:"notification-bonus-money",cashoutConfirmNotification:"notification-cashout-confirm",utilizationBalance:"notification-utilization-balance",firstFailedDeposit:"notification-first-failed-deposit",secondFailedDeposit:"notification-second-failed-deposit",thirdFailedDeposit:"notification-third-failed-deposit",freespinAvailableNotification:"notification-freespin-available",freespinAssignedNotification:"notification-freespin-assigned",freespinAccuredNotification:"notification-freespin-accured",passwordRegistration:"password-registration-confirm",collectPhone:"collect-phone",landingGame:"landing-game",rewardsLevel:"reward-level",rewardsLevelCompleted:"reward-level-completed",rewardsRank:"reward-rank",rewardsRankCompleted:"reward-rank-completed",boosterInfo:"booster-info",boosterActivate:"booster-activate",loyaltyOnboarding:"loyalty-onboarding",rollbackInfo:"rollback-info",rankUp:"rank-up",levelRankUp:"level-rank-up",boosterAvailable:"booster-available",daysWithoutProgress:"days-without-progress",levelDanger:"level-danger",rollback:"rollback",CashbackAccumulationAvailable:"cashback-accumulation-available",CashbackAccumulationExpiring:"cashback-accumulation-expiring",fortuneWheel:"fortune-wheel",fortuneWheelWin:"fortune-wheel-win",fortuneWheelConditions:"fortune-wheel-conditions",fortuneWheelError:"fortune-wheel-error"},page:{profile:"profile",password:"password",invite:"invite",inviteNull:"invite-null"},subpopup:{selectBank:"bank-select"}},U=e=>(localStorage.getItem(e)||"").replace(/\"/g,""),j=(e,n)=>{localStorage.setItem(e,n)},B=e=>{localStorage.removeItem(e)},H="lang",K="authToken",Y="recoveryToken",V="clickId",z="currencyFromLink",$="utmMedium",q="utmSource",J="utmCampaign",Q="userCountry",X="userIP",Z="sideMenu",_="modalFortuneWheelSeen",ee="url_alias",oe="mode",te="b",ne="landing_demo_popup_shown",ae="landing_demo_redirect_done";var y=(e=>(e.CURRENCY="search",e.LANGUAGE="language-search",e.PROVIDER="provider-search",e.BANKS="banks-search",e))(y||{});const ie="v1.13.06",C=()=>{const e=T(),n=b();return{openPopup:i=>{const a=new URLSearchParams(n.search);a.delete("popup"),setTimeout(()=>{a.append("popup",i),e({search:`?${a.toString()}`},{replace:!0})},100)},closePopup:()=>{const i=new URLSearchParams(n.search);i.delete("popup"),e({search:`?${i.toString()}`},{replace:!0})}}},se=()=>{const e=I(),n=P(),{openPopup:l}=C(),c=r(o=>o.sectionList),i=r(o=>o.nextAvailableAt),a=r(o=>o.step),m=r(o=>o.setSectionList),A=r(o=>o.clear),u=r(o=>o.setError);s.useEffect(()=>{const o=U(_);(!o||!(o==="true"))&&(localStorage.setItem(_,"false"),l(g.popup.fortuneWheel))},[]),s.useEffect(()=>{e.isSuccess&&e.data&&Array.isArray(e.data.sections)&&(m(e.data),u(""))},[e.isSuccess,e.data,m,u]),s.useEffect(()=>{var o;e.isError&&u(((o=e.error)==null?void 0:o.message)||"Failed to load wheel config")},[e.isError,e.error,u]),s.useEffect(()=>{a===p.SUCCESS||a===p.FAILED?(setTimeout(()=>l(g.popup.fortuneWheelWin),100),n.refetch()):a===p.ERROR&&setTimeout(()=>l(g.popup.fortuneWheelError),100)},[a]);const E=Array.isArray(c)&&c.length>0,h=e.isPending&&!E||n.isPending,d=e.isError||!e.isPending&&!E||n.isError,R=N("FortuneWheelPage",{FortuneWheelPage__error:d});s.useEffect(()=>()=>A(),[]);const S=s.useMemo(()=>d?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"FortuneWheelPage__errorBox",children:"Failed to load wheel config"}),t.jsx(f,{isLoading:!0})]}):h?t.jsxs(t.Fragment,{children:[t.jsx(v,{}),t.jsx(f,{isLoading:!0})]}):t.jsxs(t.Fragment,{children:[t.jsx(w,{sections:c,nextAt:i,step:a}),t.jsx(f,{})]}),[d,h,c,i,a]);return t.jsxs("div",{className:R,children:[t.jsx(O,{}),t.jsx("div",{className:"FortuneWheelPage__content",children:S})]})};export{ie as A,se as F,x as G,_ as S,g as a,K as b,H as c,Q as d,z as e,X as f,U as g,y as h,Z as i,Y as j,ae as k,ee as l,oe as m,ne as n,V as o,$ as p,q,B as r,j as s,J as t,C as u,te as v};
//# sourceMappingURL=page-FortuneWheelContainer.tsx-BbtPZTCU.js.map