import{a as T,b,r as s,c as N,j as t}from"./vendor-DWiUHYZz.js";import{F as p}from"./page-FortuneWheel.ts-CaqHFvhq.js";import{R as f,W as O,F as w,H as v}from"./page-index.tsx-GO22z0Zp.js";import{u as I}from"./page-useConfigWheel.tsx-6Dft0d7F.js";import{u as r}from"./page-fortuneWheel.ts-B2ztcL_U.js";import{u as P}from"./page-useWheelAvailable.tsx-dZiG75mt.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]="d16ceefa-b10b-425d-a422-13aa59ca35f4",e._sentryDebugIdIdentifier="sentry-dbid-d16ceefa-b10b-425d-a422-13aa59ca35f4")}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",ie="userCity",se="featured";var C=(e=>(e.CURRENCY="search",e.LANGUAGE="language-search",e.PROVIDER="provider-search",e.BANKS="banks-search",e))(C||{});const re="v1.13.06",y=()=>{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})}}},ce=()=>{const e=I(),n=P(),{openPopup:l}=y(),c=r(o=>o.sectionList),i=r(o=>o.nextAvailableAt),a=r(o=>o.step),E=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)&&(E(e.data),u(""))},[e.isSuccess,e.data,E,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 m=Array.isArray(c)&&c.length>0,h=e.isPending&&!m||n.isPending,d=e.isError||!e.isPending&&!m||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(O,{}),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(v,{}),t.jsx("div",{className:"FortuneWheelPage__content",children:S})]})};export{re as A,ce 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,C as h,Z as i,Y as j,ae as k,ee as l,oe as m,ne as n,se as o,ie as p,V as q,B as r,j as s,$ as t,y as u,q as v,J as w,te as x};