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AD,OAAA,QAAAvG,IAAAwG,UAAA,GAAAA,UAAA,GAAG,CAAC,GACxB5F,EAAAA,EAAAA,IAAoB,QAASoE,GAC7B/C,EAAAA,EAAeC,MAAKgB,EAAAA,EAAAA,IAAS,CAAE7C,SAAU,IAAKC,MAAO,OAAQP,IAC/D,ECTEnC,oBCAiCA,KACjC,MAAM6I,EAA4B/J,EAAAA,EAAMC,WAAW8J,SAC7CC,EAAWpF,KAAKqF,MACpBxI,EAAAA,EAAGyI,SAAQvI,EAAAA,EAAAA,GAAe,UAAW,eAGvC,QAAY,OAARqI,QAAQ,IAARA,IAAAA,EAAUG,aAIPJ,EAASK,UAAU,E,2CCfrB,MAAMnE,EAAuC,UACvCoE,EAAmB,W","sources":["newelements/Casino/GameSingleViewRenderer/__partials/GameViewContainer/utils/construct-view-url.ts","newelements/Casino/GameSingleViewRenderer/__partials/GameViewContainer/utils/index.ts","newelements/Casino/GameSingleViewRenderer/__partials/GameViewContainer/utils/check-is-game-already-cached.ts","newelements/Casino/GameSingleViewRenderer/__partials/GameViewContainer/utils/reconstruct-and-redirect-to-game-view.ts","newelements/Casino/GameSingleViewRenderer/__partials/GameViewContainer/utils/extract-game-info-from-search-query.ts","newelements/Casino/GameSingleViewRenderer/__partials/GameViewContainer/utils/encode-game-id-with-prefix.ts","newelements/Casino/GameSingleViewRenderer/__partials/GameViewContainer/utils/normalize-stringified-query.ts","newelements/Casino/GameSingleViewRenderer/__partials/GameViewContainer/utils/get-route-length.ts","utils/account/open-login-view.ts","utils/account/index.ts","utils/account/check-is-user-logged-in.ts","utils/constants/casino/url-queries.ts"],"sourcesContent":["import qs from 'qs';\nimport { UtilsAccount } from 'utils/account';\nimport LS from 'utils/bom-dom-manipulation/local-storage';\nimport { UNCATEGORIZED } from 'utils/constants/casino/casino_categories';\nimport { CUSTOM_CATEGORIES } from 'utils/constants/casino/custom-categories';\nimport { CASINO_MULTIVIEW_ENABLED_QUERY_VALUE } from 'utils/constants/casino/url-queries';\nimport SpringConfigs from 'utils/constants/swarm/spring-configs';\nimport { gameUrl } from 'utils/generic/game-url';\nimport {\n  getCasinoParams,\n  getCurrentPageArea,\n  mountPoint,\n  sbRedirect\n} from 'utils/generic/route-manipulation';\nimport { storageKeyName } from 'utils/generic/storage-key-name';\nimport { isMobile } from 'utils/is-mobile';\nimport { fromAllCapitalizedToDasherized } from 'utils/string-manipulation/dasherized-to-all-capitalized';\nimport {\n  ECasinoGameMode,\n  ECasinoGameView,\n  ECasinoGameViewOrder\n} from 'interfaces/casino-data';\nimport { NewCasinoGame } from 'interfaces/new-casino';\nimport { AFTER_SIGN_IN_ACTION_TYPES, AfterSignIn } from 'services/afterSignIn';\nimport { UtilsCasino } from './index';\nimport { browserHistory } from 'configure/history';\nimport { addQuery, saveCurrentLocation } from 'components/QueryRoute';\nimport store from 'store';\nimport { batchActions, setSelectedCasinoGame } from 'store/actions';\nimport {\n  addCachedGame,\n  addCachedGameId,\n  setCachedGameInactive,\n  setCachedGameMode,\n  setCachedGamesInactive\n} from 'store/actions/new-casino';\n\nconst RESOLVE_AFTER_SIGNIN_DURATION = 300;\nexport interface IConstructGameViewUrl {\n  game: NewCasinoGame;\n  mode: ECasinoGameMode;\n  view?: ECasinoGameView;\n  selectedCategory?: string;\n  tournament?: {\n    id: string;\n  };\n  gameIndexToChange?: 0 | 1;\n  queriesToRemove?: string[];\n}\n\nexport const constructAndRedirectToGameView = ({\n  game,\n  mode,\n  view = ECasinoGameView.SINGLE,\n  selectedCategory,\n  tournament,\n  gameIndexToChange,\n  queriesToRemove\n}: IConstructGameViewUrl): void => {\n  const isUserLoggedIn = UtilsAccount.checkIsUserLoggedIn();\n\n  // This function is responsible for redirecting out to the game page\n  const redirectToGameUrl = () => {\n    window.open(\n      gameUrl({\n        gameId: game.extearnal_game_id,\n        gameType: mode,\n        gameOptions: game.game_options\n      }),\n      '_self'\n    );\n  };\n\n  // This function is responsible for changing the route in the project session\n  const transitionToGameUrl = (\n    saveUrl?: boolean,\n    showInUrl?: boolean,\n    firstGameMode?: string\n  ) => {\n    return new Promise(resolve => {\n      !saveUrl && LS.setItem(storageKeyName('casino', 'GAMES_FETCHED'), 'true');\n\n      if (view === ECasinoGameView.SINGLE) {\n        const gameCategorySection = `${\n          SpringConfigs.DECENTRALIZED_CASINO_URL\n            ? game.cats[0]\n            : game.cats[0]?.id || UNCATEGORIZED\n        }`;\n\n        const providerSection = `${fromAllCapitalizedToDasherized(\n          game.provider_title\n        )}`;\n\n        const gameSection = `${game.id}-${\n          game.extearnal_game_id\n        }-${fromAllCapitalizedToDasherized(game.name)}`;\n\n        const categorySection = selectedCategory || CUSTOM_CATEGORIES.all.id;\n\n        const queryObj = qs.parse(window.location.search, {\n          ignoreQueryPrefix: true\n        });\n\n        const queriesToRemoveObj = (queriesToRemove || []).reduce(\n          (acc, query) => {\n            acc[query] = undefined;\n\n            return acc;\n          },\n          {} as Record<string, string | undefined>\n        );\n\n        const relativePath = [\n          categorySection,\n          gameCategorySection,\n          providerSection,\n          gameSection\n        ];\n\n        const currentPageArea = getCurrentPageArea();\n\n        if (currentPageArea && currentPageArea !== 'casino') {\n          const queryObject: Record<string, string> = {\n            mode\n          };\n\n          if (mode === 'real' && !isUserLoggedIn) {\n            queryObject.accounts = '*';\n            queryObject.login = '*';\n          }\n\n          sbRedirect(\n            `${SpringConfigs.PAGE_URLS.casino}/${\n              SpringConfigs.CASINO_MOUNT_PATH\n            }/${relativePath.join('/')}?${qs.stringify(queryObject)}`,\n            false,\n            true\n          );\n          saveCurrentLocation();\n\n          setTimeout(() => {\n            resolve(true);\n          }, RESOLVE_AFTER_SIGNIN_DURATION);\n\n          return;\n        }\n\n        if (saveUrl && (window.hasPopup || showInUrl)) {\n          const gameRoute = {\n            pathname: `${mountPoint(\n              window.getPathname(),\n              false,\n              true\n            )}/${relativePath.join('/')}`,\n            search: qs.stringify({\n              ...queryObj,\n              mode,\n              tournamentId: tournament?.id,\n              ...queriesToRemoveObj,\n              ...(showInUrl ? {} : { accounts: undefined, login: undefined })\n            })\n          };\n\n          if (showInUrl) {\n            history.pushState(\n              {},\n              '',\n              `${gameRoute.pathname}?${gameRoute.search}`\n            );\n          }\n\n          if (window.hasPopup) {\n            LS.setItem(\n              storageKeyName('casino', 'SELECTED_GAME_URL'),\n              JSON.stringify(gameRoute)\n            );\n          }\n\n          return;\n        }\n\n        store.dispatch(setSelectedCasinoGame(game));\n\n        // new way to add cached game\n        store.dispatch(addCachedGameId(game.extearnal_game_id));\n        store.dispatch(\n          batchActions(\n            setCachedGamesInactive(game.extearnal_game_id),\n            addCachedGame(game)\n          )\n        );\n        store.dispatch(setCachedGameMode({ id: game.extearnal_game_id, mode }));\n\n        if (\n          window.location.pathname.includes(\n            `/${SpringConfigs.SPORTSBOOK_MOUNT_PATH}/`\n          )\n        ) {\n          browserHistory.push({\n            pathname: `${mountPoint(window.getPathname(), false, true).replace(\n              `/${SpringConfigs.CASINO_MOUNT_PATH}`,\n              ''\n            )}`,\n            search: qs.stringify({\n              gameId: game.extearnal_game_id,\n              mode,\n              accounts: undefined,\n              login: undefined,\n              ...(!!queryObj.type && { type: queryObj.type })\n            })\n          });\n          saveCurrentLocation();\n\n          setTimeout(() => {\n            resolve(true);\n          }, RESOLVE_AFTER_SIGNIN_DURATION);\n\n          return;\n        }\n\n        browserHistory.push({\n          pathname: `${mountPoint(\n            window.getPathname(),\n            false,\n            true\n          )}/${relativePath.join('/')}`,\n          search: qs.stringify({\n            ...queryObj,\n            mode,\n            accounts: undefined,\n            login: undefined,\n            tournamentId: tournament?.id,\n            ...queriesToRemoveObj\n          })\n        });\n        saveCurrentLocation();\n\n        setTimeout(() => {\n          resolve(true);\n        }, RESOLVE_AFTER_SIGNIN_DURATION);\n\n        return;\n      }\n\n      if (view === ECasinoGameView.MULTI) {\n        const searchParams = Object.fromEntries(\n          new URLSearchParams(window.location.search)\n        );\n\n        // case when multiview is already open, and we want to change one of the games\n        if (searchParams.multiview === CASINO_MULTIVIEW_ENABLED_QUERY_VALUE) {\n          const gamesInfo =\n            UtilsCasino.extractGameInfoFromSearchParams(searchParams);\n\n          const gameToChange = gamesInfo[gameIndexToChange || 0];\n\n          store.dispatch(\n            batchActions(\n              setCachedGameInactive(gameToChange.id),\n              addCachedGame(game)\n            )\n          );\n          store.dispatch(\n            batchActions(\n              setCachedGameMode({ id: game.extearnal_game_id, mode }),\n              setCachedGameMode({\n                id: gameToChange.id,\n                mode: ECasinoGameMode.FUN\n              })\n            )\n          );\n\n          const queryToUpdate = addQuery({\n            [UtilsCasino.encodeGameIdWithPrefix(\n              gameToChange.order,\n              gameToChange.id\n            )]: undefined,\n            [UtilsCasino.encodeGameIdWithPrefix(\n              gameToChange.order,\n              game.extearnal_game_id\n            )]: mode\n          });\n\n          browserHistory.push({\n            ...queryToUpdate,\n            search: UtilsCasino.normalizeStringifiedQuery(queryToUpdate.search)\n          });\n          saveCurrentLocation();\n\n          setTimeout(() => {\n            resolve(true);\n          }, RESOLVE_AFTER_SIGNIN_DURATION);\n\n          return;\n        }\n\n        // case when multiview is not open, and we want to open it\n        const currentGameInfo = getCasinoParams();\n        const categorySection = selectedCategory || CUSTOM_CATEGORIES.all.id;\n\n        const queryObj = qs.parse(window.location.search, {\n          ignoreQueryPrefix: true\n        });\n\n        store.dispatch(addCachedGame(game));\n        store.dispatch(setCachedGameMode({ id: game.extearnal_game_id, mode }));\n\n        let pathname = `${mountPoint(\n          window.getPathname(),\n          false,\n          true\n        )}/${categorySection}`;\n\n        if (\n          window.location.pathname.includes(\n            `/${SpringConfigs.SPORTSBOOK_MOUNT_PATH}/`\n          )\n        ) {\n          delete queryObj.gameId;\n\n          pathname = pathname.replace(\n            `/${SpringConfigs.CASINO_MOUNT_PATH}/${categorySection}`,\n            ''\n          );\n        }\n\n        browserHistory.push({\n          pathname,\n          search: UtilsCasino.normalizeStringifiedQuery(\n            qs.stringify(\n              {\n                ...queryObj,\n                multiview: CASINO_MULTIVIEW_ENABLED_QUERY_VALUE,\n                [UtilsCasino.encodeGameIdWithPrefix(\n                  ECasinoGameViewOrder.FIRST,\n                  currentGameInfo.gameExternalId\n                )]: firstGameMode || searchParams.mode,\n                [UtilsCasino.encodeGameIdWithPrefix(\n                  ECasinoGameViewOrder.SECOND,\n                  game.extearnal_game_id\n                )]: mode,\n                accounts: undefined,\n                login: undefined,\n                mode: undefined\n              },\n              { addQueryPrefix: true }\n            )\n          )\n        });\n        saveCurrentLocation();\n\n        setTimeout(() => {\n          resolve(true);\n        }, RESOLVE_AFTER_SIGNIN_DURATION);\n      }\n    });\n  };\n\n  /**  CHECKS FOR REAL MODE GAME OPENING  **/\n\n  const currentPageArea = getCurrentPageArea();\n\n  if (\n    mode === ECasinoGameMode.REAL &&\n    !isUserLoggedIn &&\n    (!currentPageArea || currentPageArea === 'casino')\n  ) {\n    window.hasPopup && transitionToGameUrl(true);\n\n    const searchParams = Object.fromEntries(\n      new URLSearchParams(window.location.search)\n    );\n\n    const firstGameMode = searchParams.mode;\n\n    let query: { [key: string]: string } = { mode };\n\n    if (searchParams.multiview === CASINO_MULTIVIEW_ENABLED_QUERY_VALUE) {\n      for (const param in searchParams) {\n        if (param.indexOf(game.extearnal_game_id) >= 0) {\n          query = { [param]: mode };\n        }\n      }\n    }\n\n    UtilsAccount.openLoginView({ query });\n\n    transitionToGameUrl(true, true, firstGameMode);\n\n    const transitionFn = transitionToGameUrl.bind(\n      undefined,\n      false,\n      undefined,\n      firstGameMode\n    );\n\n    const afterSignIn = new AfterSignIn();\n    afterSignIn.appendAction(\n      AFTER_SIGN_IN_ACTION_TYPES.CONSTRUCT_CASINO_VIEW_URL,\n      transitionFn\n    );\n\n    return;\n  }\n\n  if (!SpringConfigs.CASINO_MOBILE_IFRAME && isMobile()) {\n    redirectToGameUrl();\n  } else {\n    transitionToGameUrl();\n  }\n};\n","import { ECasinoGameViewOrder } from 'interfaces/casino-data';\nimport { checkIsGameAlreadyCached } from './check-is-game-already-cached';\nimport {\n  constructAndRedirectToGameView,\n  IConstructGameViewUrl\n} from './construct-view-url';\nimport {\n  decodeGameIdWithPrefix,\n  encodeGameIdWithPrefix\n} from './encode-game-id-with-prefix';\nimport {\n  extractGameInfoFromSearchParams,\n  IGameInfo\n} from './extract-game-info-from-search-query';\nimport { getRouteLength } from './get-route-length';\nimport { normalizeStringifiedQuery } from './normalize-stringified-query';\nimport { reconstructAndRedirectToGameView } from './reconstruct-and-redirect-to-game-view';\n\ntype TUtilsCasinoProps = {\n  checkIsGameAlreadyCached: (gameId: string) => boolean;\n  constructAndRedirectToGameView: (props: IConstructGameViewUrl) => void;\n  reconstructAndRedirectToGameView: (\n    callbackAfterSignin?: () => void,\n    routeToSaveInStorage?: string\n  ) => void;\n  extractGameInfoFromSearchParams: (\n    searchParams: Record<string, string | undefined>\n  ) => IGameInfo[];\n  encodeGameIdWithPrefix: (order: ECasinoGameViewOrder, id: string) => string;\n  decodeGameIdWithPrefix: (id: string) => {\n    order: number;\n    gameId: string | number;\n  };\n  normalizeStringifiedQuery: (stringifiedQuery: string) => string;\n  getRouteLength: () => number | undefined;\n};\n\nexport const UtilsCasino: TUtilsCasinoProps = {\n  checkIsGameAlreadyCached,\n  constructAndRedirectToGameView,\n  reconstructAndRedirectToGameView,\n  extractGameInfoFromSearchParams,\n  encodeGameIdWithPrefix,\n  decodeGameIdWithPrefix,\n  normalizeStringifiedQuery,\n  getRouteLength\n};\n","import { NewCasinoGame } from 'interfaces/new-casino';\nimport store from 'store';\n\ntype TGameId = NewCasinoGame['id'];\n\nexport const checkIsGameAlreadyCached = (gameId: TGameId) => {\n  const storeState = store.getState();\n  const cachedGames = storeState.newCasinoStore.cachedGames;\n\n  return !!cachedGames[gameId]?.data;\n};\n","import { UtilsAccount } from 'utils/account';\nimport { AFTER_SIGN_IN_ACTION_TYPES, AfterSignIn } from 'services/afterSignIn';\nimport { saveCurrentLocation } from 'components/QueryRoute';\n\nexport const reconstructAndRedirectToGameView = (\n  callbackAfterSignin?: () => void,\n  routeToSaveInStorage?: string,\n  saveRouteKey?: 'casinoSingleGame' | 'login'\n) => {\n  UtilsAccount.openLoginView({\n    routeToSaveInStorage\n  });\n\n  if (saveRouteKey) {\n    saveCurrentLocation(saveRouteKey, routeToSaveInStorage);\n  } else {\n    saveCurrentLocation();\n  }\n\n  const afterSignIn = new AfterSignIn();\n  afterSignIn.appendAction(\n    AFTER_SIGN_IN_ACTION_TYPES.RECONSTRUCT_CASINO_VIEW_URL,\n    () => {\n      return new Promise(resolve => {\n        callbackAfterSignin?.();\n        resolve(true);\n      });\n    }\n  );\n};\n","import { ECasinoGameMode, ECasinoGameViewOrder } from 'interfaces/casino-data';\nimport { UtilsCasino } from './index';\n\nexport interface IGameInfo {\n  id: string;\n  mode: ECasinoGameMode;\n  order: ECasinoGameViewOrder;\n}\n\nexport const extractGameInfoFromSearchParams = (\n  searchParams: Record<string, string | undefined>\n) => {\n  const paramsTuples = Object.entries(searchParams);\n\n  return paramsTuples.reduce((acc, [key, value]) => {\n    if (\n      value &&\n      [ECasinoGameMode.REAL, ECasinoGameMode.FUN].includes(\n        value as ECasinoGameMode\n      )\n    ) {\n      const { order, gameId } = UtilsCasino.decodeGameIdWithPrefix(key);\n\n      if (!Number.isNaN(order) && !Number.isNaN(gameId)) {\n        acc.push({\n          id: `${gameId}`,\n          mode: value as ECasinoGameMode,\n          order: order\n        });\n      }\n    }\n\n    return acc;\n  }, [] as IGameInfo[]);\n};\n","import { ECasinoGameViewOrder } from 'interfaces/casino-data';\n\nexport const encodeGameIdWithPrefix = (\n  order: ECasinoGameViewOrder,\n  id: string\n) => {\n  return `${order}-${id}`;\n};\n\nexport const decodeGameIdWithPrefix = (id: string) => {\n  const [order, gameId] = id.split('-');\n\n  return {\n    order: parseInt(order),\n    gameId\n  };\n};\n","import { ECasinoGameMode, ECasinoGameViewOrder } from 'interfaces/casino-data';\n\nexport const normalizeStringifiedQuery = (stringifiedQuery: string) => {\n  const splittedQuery = stringifiedQuery.slice(1).split('&');\n  const firstGameIndex = splittedQuery.findIndex(\n    query =>\n      query.startsWith(`${ECasinoGameViewOrder.FIRST}-`) &&\n      (query.endsWith(`${ECasinoGameMode.FUN}`) ||\n        query.endsWith(`${ECasinoGameMode.REAL}`))\n  );\n\n  const secondGameIndex = splittedQuery.findIndex(\n    query =>\n      query.startsWith(`${ECasinoGameViewOrder.SECOND}-`) &&\n      (query.endsWith(`${ECasinoGameMode.FUN}`) ||\n        query.endsWith(`${ECasinoGameMode.REAL}`))\n  );\n\n  if (firstGameIndex < 0 && secondGameIndex < 0) {\n    return stringifiedQuery;\n  }\n\n  if (firstGameIndex > secondGameIndex) {\n    const temp = splittedQuery[firstGameIndex];\n    splittedQuery[firstGameIndex] = splittedQuery[secondGameIndex];\n    splittedQuery[secondGameIndex] = temp;\n  }\n\n  return `?${splittedQuery.join('&')}`;\n};\n","import SpringConfigs from 'utils/constants/swarm/spring-configs';\n\nexport const getRouteLength = () => {\n  return window\n    .getPathname()\n    .split(`/${SpringConfigs.CASINO_MOUNT_PATH}/`)?.[1]\n    ?.split('/').length;\n};\n","import { browserHistory } from 'configure/history';\nimport { addQuery, saveCurrentLocation } from 'components/QueryRoute';\n\ntype TOpenLoginViewProps = {\n  routeToSaveInStorage?: string;\n  query?: Record<string, any>;\n};\n\nexport const openLoginView = ({\n  routeToSaveInStorage,\n  query = {}\n}: TOpenLoginViewProps = {}) => {\n  saveCurrentLocation('login', routeToSaveInStorage);\n  browserHistory.push(addQuery({ accounts: '*', login: '*', ...query }));\n};\n","import { checkIsUserLoggedIn } from './check-is-user-logged-in';\nimport { openLoginView } from './open-login-view';\n\nexport const UtilsAccount = {\n  openLoginView,\n  checkIsUserLoggedIn\n};\n","import LS from 'utils/bom-dom-manipulation/local-storage';\nimport { storageKeyName } from 'utils/generic/storage-key-name';\nimport { InitialUserData } from 'interfaces/authentication';\nimport store from 'store';\n\nexport const checkIsUserLoggedIn = () => {\n  const userData: InitialUserData = store.getState().userData;\n  const authData = JSON.parse(\n    LS.getItem(storageKeyName('account', 'AUTH_DATA'))\n  );\n\n  if (authData?.auth_token) {\n    return true;\n  }\n\n  return userData.isLoggedIn;\n};\n","export const CASINO_MULTIVIEW_ENABLED_QUERY_VALUE = 'enabled';\nexport const CASINO_MULTIVIEW = 'multiview';\n"],"names":["RESOLVE_AFTER_SIGNIN_DURATION","UtilsCasino","checkIsGameAlreadyCached","gameId","_cachedGames$gameId","store","getState","newCasinoStore","cachedGames","data","constructAndRedirectToGameView","_ref","game","mode","view","ECasinoGameView","SINGLE","selectedCategory","tournament","gameIndexToChange","queriesToRemove","isUserLoggedIn","UtilsAccount","checkIsUserLoggedIn","transitionToGameUrl","saveUrl","showInUrl","firstGameMode","Promise","resolve","LS","setItem","storageKeyName","_game$cats$","gameCategorySection","SpringConfigs","DECENTRALIZED_CASINO_URL","cats","id","UNCATEGORIZED","providerSection","fromAllCapitalizedToDasherized","provider_title","gameSection","extearnal_game_id","name","categorySection","CUSTOM_CATEGORIES","all","queryObj","qs","window","location","search","ignoreQueryPrefix","queriesToRemoveObj","reduce","acc","query","undefined","relativePath","currentPageArea","getCurrentPageArea","queryObject","accounts","login","sbRedirect","PAGE_URLS","casino","CASINO_MOUNT_PATH","join","saveCurrentLocation","setTimeout","hasPopup","gameRoute","pathname","mountPoint","getPathname","tournamentId","history","pushState","JSON","stringify","dispatch","setSelectedCasinoGame","addCachedGameId","batchActions","setCachedGamesInactive","addCachedGame","setCachedGameMode","includes","SPORTSBOOK_MOUNT_PATH","browserHistory","push","replace","type","MULTI","searchParams","Object","fromEntries","URLSearchParams","multiview","CASINO_MULTIVIEW_ENABLED_QUERY_VALUE","gameToChange","extractGameInfoFromSearchParams","setCachedGameInactive","ECasinoGameMode","FUN","queryToUpdate","addQuery","encodeGameIdWithPrefix","order","normalizeStringifiedQuery","currentGameInfo","getCasinoParams","ECasinoGameViewOrder","FIRST","gameExternalId","SECOND","addQueryPrefix","REAL","CASINO_MOBILE_IFRAME","isMobile","open","gameUrl","gameType","gameOptions","game_options","param","indexOf","openLoginView","transitionFn","bind","AfterSignIn","appendAction","AFTER_SIGN_IN_ACTION_TYPES","CONSTRUCT_CASINO_VIEW_URL","reconstructAndRedirectToGameView","callbackAfterSignin","routeToSaveInStorage","saveRouteKey","RECONSTRUCT_CASINO_VIEW_URL","entries","key","value","decodeGameIdWithPrefix","Number","isNaN","split","parseInt","stringifiedQuery","splittedQuery","slice","firstGameIndex","findIndex","startsWith","endsWith","secondGameIndex","temp","getRouteLength","_window$getPathname$s","_window$getPathname$s2","length","arguments","userData","authData","parse","getItem","auth_token","isLoggedIn","CASINO_MULTIVIEW"],"sourceRoot":""}