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AAA,IAAQ,sMAMoB,CAAM,KAAD,uPAON,EAAG,KAAD,kW","sources":["app-react/services/game-search/game-search-result.ts","app-react/services/game-search/game-search.service.tsx"],"sourcesContent":["import {GameInfo, OpenGameParameters} from '../games/game-info';\r\nimport {IServiceFactoryExtended} from '../service-factory-extended.interface';\r\nimport {SuggestedLinkConfiguration} from '../configurations/config-data-sections/game-search-box.configuration';\r\nimport {OrbitUserFlowAnalyticsCategory} from \"../analytics/analytics.service.interface\";\r\n\r\nexport interface ISearchSuggestion {\r\n readonly key: string;\r\n readonly text: string;\r\n readonly linkIconClass: string;\r\n readonly type: string;\r\n readonly gameInfo: GameInfo | null;\r\n executeAction(): Promise;\r\n}\r\n\r\nexport const SUGGESTED_CATEGORIES = \"Suggested_Categories\";\r\n\r\n\r\nexport class GameSuggestion implements ISearchSuggestion {\r\n constructor(private services: IServiceFactoryExtended,\r\n private _gameInfo: GameInfo,\r\n private _analyticsLabel: string,\r\n private _index?: number,\r\n private _aiSortingType?: string) {\r\n\r\n }\r\n\r\n get gameInfo(): GameInfo {\r\n return this._gameInfo;\r\n }\r\n\r\n get type(): string {\r\n return this._analyticsLabel;\r\n }\r\n\r\n get key(): string {\r\n return this._gameInfo.gameType + '_' + this._gameInfo.title;\r\n }\r\n\r\n get text(): string {\r\n return this._gameInfo.title;\r\n }\r\n\r\n get linkIconClass(): string {\r\n return this._gameInfo.gameCategory;\r\n }\r\n\r\n async executeAction(): Promise {\r\n\r\n const openGameParams: OpenGameParameters = {\r\n isRealMode: true,\r\n pageName: 'Search',\r\n gameIndex: this._index,\r\n listTitle: this.type,\r\n aiSortingType: this._aiSortingType,\r\n showIntermediatePage: (await this.services.cmsSegmentation).isCstatus === false //Show intermediate page only for user with cStatus == false, TASK 1832892\r\n };\r\n\r\n await this._gameInfo.open(openGameParams);\r\n }\r\n}\r\n\r\n\r\nexport class SearchLinkSuggestion implements ISearchSuggestion {\r\n constructor(private _linkConfig: SuggestedLinkConfiguration,\r\n private services: IServiceFactoryExtended,\r\n private _analyticsAction: string) {\r\n if (this._linkConfig.menuItemKey) {\r\n\r\n }\r\n }\r\n\r\n\r\n\r\n get gameInfo(): GameInfo | null {\r\n return null;\r\n }\r\n\r\n get type(): string {\r\n return this._analyticsAction;\r\n }\r\n\r\n get key(): string {\r\n return this._linkConfig.text;\r\n }\r\n\r\n get text(): string {\r\n return this.services.translation.translate(this._linkConfig.text);\r\n }\r\n\r\n get linkIconClass(): string {\r\n return 'link';\r\n }\r\n\r\n async executeAction(): Promise {\r\n this.services.analytics.sendOrbitUserFlowEvent(OrbitUserFlowAnalyticsCategory.Search, this.type, this.text);\r\n if (this._linkConfig.linkId) {\r\n await this.services.linksNavigation.navigateLink({\r\n linkId: this._linkConfig.linkId,\r\n linkHash: this._linkConfig.linkHash\r\n });\r\n }\r\n else if (this._linkConfig.menuItemKey) {\r\n const menuItem = (await this.services.gameSearch).getMenuItemAction(this._linkConfig.menuItemKey);\r\n if (menuItem) {\r\n await menuItem.execute({\r\n linkHash: this._linkConfig.linkHash\r\n });\r\n } else {\r\n this.services.logger.error(`Could not find menu item action ${this._linkConfig.menuItemKey} for search suggestion link ${this.key}`);\r\n }\r\n } else {\r\n this.services.logger.error(`Navigation for search suggestion link ${this.key} not specified`)\r\n }\r\n\r\n }\r\n}\r\n\r\n\r\n\r\nexport class VideoSlidesFilterPreviewSuggestion implements ISearchSuggestion {\r\n constructor(private services: IServiceFactoryExtended,\r\n private _gameInfo: GameInfo,\r\n private _videoSlidesFilterPreviewId: string,\r\n private _analyticsAction: string) {\r\n\r\n }\r\n\r\n get gameInfo(): GameInfo | null {\r\n return this._gameInfo;\r\n }\r\n\r\n get type(): string {\r\n return this._analyticsAction;\r\n }\r\n\r\n get key(): string {\r\n return \"VideoSlidesFilterPreviewSuggestion\" + this._videoSlidesFilterPreviewId;\r\n }\r\n\r\n get text(): string {\r\n return this.services.gamesFilter.getFiltersDefinitions([this._videoSlidesFilterPreviewId])[this._videoSlidesFilterPreviewId]?.text ?? this._videoSlidesFilterPreviewId;\r\n }\r\n\r\n get linkIconClass(): string {\r\n return 'explore';\r\n }\r\n\r\n async executeAction(): Promise {\r\n this.services.videoSlides.navigateToFilter(this._videoSlidesFilterPreviewId);\r\n }\r\n\r\n}\r\n\r\nexport class GameSearchResult {\r\n constructor(private _games: ISearchSuggestion[], private _suggestedCategories: ISearchSuggestion[], private _suggestedGames: ISearchSuggestion[], private _suggestedVideoSlidesFilterListPreview: ISearchSuggestion[]) {}\r\n\r\n get suggestedGames(): ISearchSuggestion[] {\r\n return this._suggestedGames;\r\n }\r\n\r\n get games(): ISearchSuggestion[] {\r\n return this._games;\r\n }\r\n\r\n get suggestedCategories(): ISearchSuggestion[] {\r\n return this._suggestedCategories;\r\n }\r\n\r\n get suggestedVideoSlidesFilterListPreview(): ISearchSuggestion[] {\r\n return this._suggestedVideoSlidesFilterListPreview;\r\n }\r\n}\r\n","import React, {createRef} from \"react\";\r\nimport {ServiceBase} from '../ServiceBase';\r\nimport {IGameSearchService} from './game-search.service.interface';\r\nimport {DomEventSubscription} from '../../../utils/event-listener-registration';\r\nimport {action, computed, observable, makeObservable} from 'mobx';\r\nimport {\r\n SearchLinkSuggestion,\r\n GameSearchResult,\r\n GameSuggestion,\r\n ISearchSuggestion,\r\n SUGGESTED_CATEGORIES,\r\n VideoSlidesFilterPreviewSuggestion\r\n} from './game-search-result';\r\nimport {SuggestedLinkConfiguration} from '../configurations/config-data-sections/game-search-box.configuration';\r\nimport {Check} from '@sparkware/app-utils';\r\nimport {IServiceFactoryExtended} from '../service-factory-extended.interface';\r\nimport {GameInfo, gameInfoComparerByTitle} from '../games/game-info';\r\nimport {IModalDialogHandler} from \"../dialog/dialog.service.interface\";\r\nimport {GameSearchComponent} from \"../../components/game-search/game-search.component\";\r\nimport {removeSpecialCharacters} from \"../../../utils/string-helpers\";\r\nimport {LIST_TYPE_ID} from \"../../../common/const/ai-trending-list-ids-map\";\r\nimport {IOverlayConsumer} from \"../overlay/overlay-consumer.interface\";\r\nimport {MenuItemKey} from \"../configurations/config-data-sections/generated-config-const\";\r\nimport {IMenuItemAction} from \"../menu-item-action-factory/menu-item-action.interface\";\r\nimport {\r\n MenuItemDefaultConfigReader\r\n} from \"../menu-items-common/menu-item-config-reader/menu-item-default-config-reader\";\r\nimport {OrbitUserFlowAnalyticsCategory} from \"../analytics/analytics.service.interface\";\r\nimport {IMenuItemActionFactoryService} from \"../menu-item-action-factory/menu-item-action-factory.service.interface\";\r\n\r\nexport class GameSearchService extends ServiceBase implements IGameSearchService, IOverlayConsumer {\r\n\r\n private _closeMobileSideMenuOnSearchClose: boolean = false;\r\n\r\n constructor(services: IServiceFactoryExtended,\r\n private readonly menuItemActionFactory: IMenuItemActionFactoryService) {\r\n super(services);\r\n\r\n makeObservable(this);\r\n\r\n this.services.overlay.registerConsumer(this);\r\n\r\n this._menuItemConfigReader = new MenuItemDefaultConfigReader(services);\r\n\r\n\r\n this.reaction(() => this.services.games.gamesMap,\r\n () => {\r\n //this is to avoid circular dependency between this service and ISearchSuggestion implementations\r\n setTimeout(() => {\r\n this._resetGamesSearchListCache();\r\n this.search(this.currentSearchText);\r\n });\r\n\r\n }, {\r\n fireImmediately: true\r\n });\r\n\r\n this.reaction(() => {\r\n return {\r\n trendingRecommendedGamesForPlayerByBets: this.services.aiEngine.trendingRecommendedGamesForPlayerByBets,\r\n aiRecommendedGames: this.services.aiEngine.aiRecommendedGames\r\n }\r\n },\r\n () => {\r\n if (!this.isSearchInProgress) {\r\n this._setDefaultSearchResult();\r\n }\r\n });\r\n\r\n this._setDefaultSearchResult();\r\n }\r\n\r\n private readonly _menuItemConfigReader: MenuItemDefaultConfigReader;\r\n\r\n private _miniOrbitSearchBoxDialogHandler: IModalDialogHandler | null = null;\r\n\r\n private _searchInputRef: React.RefObject = createRef();\r\n private _searchComponentRef: React.RefObject = createRef();\r\n private _searchResultComponentRef: React.RefObject = createRef();\r\n\r\n private _gamesSearchListCache: GameInfo[] | null = null;\r\n private get gamesSearchList(): GameInfo[] {\r\n if (!this._gamesSearchListCache) {\r\n this._gamesSearchListCache = this._buildGamesSearchList()\r\n }\r\n\r\n return this._gamesSearchListCache;\r\n }\r\n\r\n getMenuItemAction(key: MenuItemKey): IMenuItemAction {\r\n return this.menuItemActionFactory.getMenuItemAction(key, this._menuItemConfigReader);\r\n }\r\n _resetGamesSearchListCache() {\r\n this._gamesSearchListCache = null;\r\n }\r\n\r\n private _buildGamesSearchList(): GameInfo[] {\r\n return Object.values(this.services.games.gamesMap).sort(gameInfoComparerByTitle);\r\n }\r\n\r\n private _openMiniOrbitSearchDialog(): void {\r\n this.services.dialog.showModal((dialogHandler) => {\r\n this._miniOrbitSearchBoxDialogHandler = dialogHandler;\r\n return ();\r\n }, {\r\n title: ' ',\r\n onClosed: () => this.closeSearchResult(),\r\n forceFullscreenTablet: true\r\n });\r\n }\r\n\r\n get needsOverlay(): boolean {\r\n return this.isSearchBoxOpened;\r\n }\r\n\r\n getOverlayZIndex(): number | undefined {\r\n return undefined;\r\n }\r\n\r\n onOverlayClicked() {\r\n this.closeSearchResult();\r\n }\r\n\r\n private _openFullOrbitSearchResult() {\r\n this._disposeDocumentClickSubscription();\r\n /*\r\n * Handle search result close on document click\r\n * Wonder why we use setTimeout? From React 17 the events are bound to react-dom root element instead of window.document\r\n * Read more here: https://github.com/facebook/react/issues/20636\r\n */\r\n setTimeout(() => {\r\n this._documentClickSubscription = this.services.dom.subscribeTo.click(this._handleClickOutsideSearchComponent);\r\n });\r\n\r\n }\r\n\r\n get searchInputRef() {\r\n return this._searchInputRef;\r\n }\r\n\r\n get searchComponentRef() {\r\n return this._searchComponentRef;\r\n }\r\n\r\n get searchResultComponentRef() {\r\n return this._searchResultComponentRef;\r\n }\r\n\r\n async openSearchResult(): Promise {\r\n if (this.isSearchBoxOpened) { //No need to open it if is already opened\r\n return;\r\n }\r\n\r\n if (this.services.miniOrbit.isEnabled) {\r\n this._openMiniOrbitSearchDialog();\r\n } else {\r\n this._openFullOrbitSearchResult();\r\n }\r\n\r\n this._setIsSearchBoxOpened(true);\r\n\r\n this.searchInputRef?.current?.focus();\r\n\r\n if (this.services.device.isMobile) {\r\n const sideMenu = await this.services.sideMenu;\r\n this._closeMobileSideMenuOnSearchClose = !sideMenu.isMobileMenuOpen;\r\n if (!sideMenu.isMobileMenuOpen) {\r\n sideMenu.openMobileMenu();\r\n }\r\n }\r\n\r\n this.services.analytics.sendOrbitUserFlowEvent(\"Navigation\", this.services.routing.currentRoute?.data?.arenaType || 'Header', 'Search_Open');\r\n }\r\n\r\n\r\n private _documentClickSubscription: DomEventSubscription | null = null;\r\n\r\n private _disposeDocumentClickSubscription() {\r\n if (this._documentClickSubscription) {\r\n this._documentClickSubscription.dispose();\r\n this._documentClickSubscription = null;\r\n }\r\n }\r\n\r\n\r\n private _closeMiniOrbitSearchDialog = () => {\r\n if (this._miniOrbitSearchBoxDialogHandler) {\r\n this._miniOrbitSearchBoxDialogHandler.close();\r\n this._miniOrbitSearchBoxDialogHandler = null;\r\n }\r\n };\r\n\r\n\r\n private _closeFullOrbitSearchResult = () => {\r\n this._disposeDocumentClickSubscription();\r\n };\r\n\r\n private _handleClickOutsideSearchComponent = (event) => {\r\n if (this._searchComponentRef.current && !this._searchComponentRef.current.contains(event.target)) {\r\n this.closeSearchResult();\r\n }\r\n }\r\n\r\n closeSearchResult = async () => {\r\n if (!this.isSearchBoxOpened) { //if is already closed don't close it again\r\n return;\r\n }\r\n if (this.services.miniOrbit.isEnabled) {\r\n this._closeMiniOrbitSearchDialog();\r\n } else {\r\n this._closeFullOrbitSearchResult();\r\n }\r\n\r\n if (this._closeMobileSideMenuOnSearchClose) {\r\n this._closeMobileSideMenuOnSearchClose = false;\r\n (await this.services.sideMenu).closeMobileMenu();\r\n }\r\n\r\n this._setIsSearchBoxOpened(false);\r\n\r\n //Will called when search box close or when game is selected (And closing the results as well)\r\n if (this.isSearchInProgress)\r\n this.services.analytics.sendOrbitUserFlowEvent(OrbitUserFlowAnalyticsCategory.Search, 'Entry', this.currentSearchText);\r\n\r\n this._setCurrentSearchText('');\r\n this._setDefaultSearchResult();\r\n };\r\n\r\n private _getGameSuggestion() {\r\n const gamesSuggestions: GameSuggestion[] = [];\r\n let aiSortingTypeForAnalytics: string = \"byactiveusers\";\r\n let aiGames = this.services.aiEngine.trendingRecommendedGamesForPlayerByActiveUsers;\r\n\r\n if (!(aiGames?.length > 0)) {\r\n aiSortingTypeForAnalytics = 'config';\r\n aiGames = this.services.configuration.data.search.suggestedGames;\r\n }\r\n\r\n aiGames.forEach(gameType => {\r\n const gameInfo = this.services.games.gamesMap[gameType];\r\n\r\n if (!Check.isNullOrUndefined(gameInfo)) {\r\n gamesSuggestions.push(new GameSuggestion(this.services, gameInfo, `Suggested_Games_${aiSortingTypeForAnalytics}`, gamesSuggestions.length, aiSortingTypeForAnalytics))\r\n }\r\n });\r\n\r\n return gamesSuggestions.slice(0, 6);\r\n }\r\n\r\n private _getDefaultVideoSlidesFilterListPreviewSuggestion() {\r\n const VideoSlidesFilterPreviewSuggestions: VideoSlidesFilterPreviewSuggestion[] = [];\r\n let videoSlidesFilterPreviewIds = this.services.configuration.data.search.videoSlidesFilterPreviewIds;\r\n if (!Check.isNullOrUndefined(videoSlidesFilterPreviewIds)) {\r\n videoSlidesFilterPreviewIds.forEach(id => {\r\n const gameInfo = this.services.videoSlides.firstGameForFilter(id);\r\n if (!Check.isNullOrUndefined(gameInfo)) {\r\n VideoSlidesFilterPreviewSuggestions.push(new VideoSlidesFilterPreviewSuggestion(this.services, gameInfo, id, \"???\"))\r\n }\r\n })\r\n }\r\n\r\n return VideoSlidesFilterPreviewSuggestions;\r\n }\r\n\r\n private _setDefaultSearchResult() {\r\n const quickLinks = this.services.configuration.data.search.quickLinks\r\n .map(quickLinkConfig => new SearchLinkSuggestion(quickLinkConfig, this.services, 'Quick_Links'));\r\n\r\n this._setSearchResult(new GameSearchResult([], quickLinks, this._getGameSuggestion(), this._getDefaultVideoSlidesFilterListPreviewSuggestion()));\r\n }\r\n\r\n @computed\r\n get isSearchInProgress(): boolean {\r\n return this.currentSearchText.length >= 2;\r\n }\r\n\r\n @observable.ref\r\n isSearchBoxOpened: boolean = false;\r\n @action.bound\r\n private _setIsSearchBoxOpened(value: boolean) {\r\n this.isSearchBoxOpened = value;\r\n }\r\n\r\n @observable.ref\r\n currentSearchText: string = '';\r\n\r\n @action.bound\r\n private _setCurrentSearchText(value: string): void {\r\n this.currentSearchText = value;\r\n }\r\n\r\n search(text: string): void {\r\n text = text || '';\r\n\r\n if (!this.isSearchBoxOpened && text.length > 0) {\r\n this.openSearchResult();\r\n }\r\n\r\n this._setCurrentSearchText(text);\r\n\r\n if (this.isSearchInProgress) { //we only search if there are at least 2 characters typed in the search box\r\n let regEx = new RegExp(removeSpecialCharacters(text), 'gi');\r\n this._setSearchResult(this._getSearchResult(regEx));\r\n } else {\r\n this._setDefaultSearchResult();\r\n }\r\n }\r\n\r\n\r\n private _getSearchResult(regEx: RegExp): GameSearchResult {\r\n let games = this._searchForGames(regEx);\r\n let suggestedCategories: ISearchSuggestion[];\r\n if (games.length === 0) {\r\n suggestedCategories = this._getDefaultSuggestedCategories();\r\n } else {\r\n suggestedCategories = this._searchForSuggestedCategories(regEx);\r\n }\r\n\r\n return new GameSearchResult(games, suggestedCategories, this._getGameSuggestion(), this._getDefaultVideoSlidesFilterListPreviewSuggestion());\r\n }\r\n\r\n @observable.ref\r\n searchResult: GameSearchResult;\r\n\r\n @action.bound\r\n private _setSearchResult(value: GameSearchResult) {\r\n this.searchResult = value;\r\n }\r\n\r\n private _searchForGames(regEx: RegExp): ISearchSuggestion[] {\r\n\r\n const result: GameInfo[] = [];\r\n const gameTypeToGameInfoObj = {};\r\n const themesIds = this.services.gamesTheme.findThemes(regEx);\r\n const vendorsIds = this.services.gamesVendor.findVendors(regEx);\r\n\r\n this.gamesSearchList.forEach((gameInfo) => {\r\n if (removeSpecialCharacters(gameInfo.title).match(regEx)\r\n || this._matchGameByTheme(gameInfo, themesIds)\r\n || this._matchGameByVendor(gameInfo, vendorsIds)) {\r\n result.push(gameInfo);\r\n gameTypeToGameInfoObj[gameInfo.gameType] = gameInfo;\r\n }\r\n });\r\n\r\n const sortedResultGameTypes = this.services.aiEngine.sortGamesByAI(result.map(gameInfo => gameInfo.gameType), LIST_TYPE_ID.ACTIVE_USERS);\r\n return sortedResultGameTypes.map((gameType, index) => new GameSuggestion(this.services, gameTypeToGameInfoObj[gameType], `Search_Results`, index, 'byactiveusers'));\r\n }\r\n\r\n private _matchGameByTheme(gameInfo: GameInfo, themesIds: number[]) {\r\n for (let themeId of gameInfo.themeIds) {\r\n if (themesIds.includes(themeId)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n private _matchGameByVendor(gameInfo: GameInfo, vendorsIds: number[]) {\r\n return vendorsIds.includes(gameInfo.vendorId)\r\n }\r\n\r\n private _searchForSuggestedCategories(regEx: RegExp): ISearchSuggestion[] {\r\n let suggestedCategoriesOptions = this.services.configuration.data.search.suggestedCategories.suggestedCategoriesOptions;\r\n if (!suggestedCategoriesOptions) {\r\n return this._getDefaultSuggestedCategories();\r\n }\r\n\r\n for (let i = 0; i < suggestedCategoriesOptions.length; i++) {\r\n let option = suggestedCategoriesOptions[i];\r\n let result: ISearchSuggestion[] = [];\r\n if (option.search.match(regEx) && option.categories && option.categories.length > 0) {\r\n result = option.categories.map(categoryConfig => this._createSuggestedCategory(categoryConfig))\r\n // TODO: Remove this after updating the Check signatures. Let type inference do the magic\r\n .filter((categorySuggestion): categorySuggestion is ISearchSuggestion => !Check.isNullOrUndefined(categorySuggestion));\r\n }\r\n\r\n if (result.length > 0) {\r\n return result;\r\n }\r\n }\r\n\r\n return this._getDefaultSuggestedCategories();\r\n }\r\n\r\n private _getDefaultSuggestedCategories(): ISearchSuggestion[] {\r\n return this.services.configuration.data.search.suggestedCategories.defaultSuggestedCategories\r\n .map(suggestedCategory => this._createSuggestedCategory(suggestedCategory))\r\n // TODO: Remove this after updating the Check signatures. Let type inference do the magic\r\n .filter((suggestion): suggestion is ISearchSuggestion => !Check.isNullOrUndefined(suggestion));\r\n }\r\n\r\n _createSuggestedCategory(categoryConfig: SuggestedLinkConfiguration): ISearchSuggestion | null {\r\n if (categoryConfig.gameID) {\r\n let gameInfo = this.services.games.gamesMap[categoryConfig.gameID];\r\n if (!gameInfo) {\r\n this.services.logger.error(`Game type ${categoryConfig.gameID} is in the search suggested categories but this game is not configured to be in this site!`);\r\n return null;\r\n }\r\n return new GameSuggestion(this.services, gameInfo, SUGGESTED_CATEGORIES);\r\n }\r\n return new SearchLinkSuggestion(categoryConfig, this.services, SUGGESTED_CATEGORIES);\r\n }\r\n}\r\n"],"names":["SUGGESTED_CATEGORIES","GameSuggestion","services","_gameInfo","_analyticsLabel","_index","_aiSortingType","this","gameType","title","gameCategory","type","cmsSegmentation","isCstatus","openGameParams","isRealMode","pageName","gameIndex","listTitle","aiSortingType","showIntermediatePage","open","SearchLinkSuggestion","_linkConfig","_analyticsAction","menuItemKey","text","translation","translate","analytics","sendOrbitUserFlowEvent","OrbitUserFlowAnalyticsCategory","linkId","linksNavigation","navigateLink","linkHash","gameSearch","menuItem","getMenuItemAction","execute","logger","error","key","VideoSlidesFilterPreviewSuggestion","_videoSlidesFilterPreviewId","gamesFilter","getFiltersDefinitions","videoSlides","navigateToFilter","GameSearchResult","_games","_suggestedCategories","_suggestedGames","_suggestedVideoSlidesFilterListPreview","GameSearchService","observable","action","menuItemActionFactory","_closeMobileSideMenuOnSearchClose","_menuItemConfigReader","_miniOrbitSearchBoxDialogHandler","_searchInputRef","createRef","_searchComponentRef","_searchResultComponentRef","_gamesSearchListCache","_documentClickSubscription","_closeMiniOrbitSearchDialog","close","_closeFullOrbitSearchResult","_disposeDocumentClickSubscription","_handleClickOutsideSearchComponent","event","current","contains","target","closeSearchResult","isSearchBoxOpened","miniOrbit","isEnabled","sideMenu","closeMobileMenu","_setIsSearchBoxOpened","isSearchInProgress","currentSearchText","_setCurrentSearchText","_setDefaultSearchResult","makeObservable","overlay","registerConsumer","MenuItemDefaultConfigReader","reaction","games","gamesMap","setTimeout","_resetGamesSearchListCache","search","fireImmediately","trendingRecommendedGamesForPlayerByBets","aiEngine","aiRecommendedGames","_buildGamesSearchList","Object","values","sort","gameInfoComparerByTitle","dialog","showModal","dialogHandler","onClosed","forceFullscreenTablet","dom","subscribeTo","click","_openMiniOrbitSearchDialog","_openFullOrbitSearchResult","searchInputRef","focus","device","isMobile","isMobileMenuOpen","openMobileMenu","routing","currentRoute","data","arenaType","dispose","gamesSuggestions","aiSortingTypeForAnalytics","aiGames","trendingRecommendedGamesForPlayerByActiveUsers","length","configuration","suggestedGames","forEach","gameInfo","Check","push","slice","VideoSlidesFilterPreviewSuggestions","videoSlidesFilterPreviewIds","id","firstGameForFilter","quickLinks","map","quickLinkConfig","_setSearchResult","_getGameSuggestion","_getDefaultVideoSlidesFilterListPreviewSuggestion","value","openSearchResult","regEx","RegExp","removeSpecialCharacters","_getSearchResult","suggestedCategories","_searchForGames","_getDefaultSuggestedCategories","_searchForSuggestedCategories","searchResult","result","gameTypeToGameInfoObj","themesIds","gamesTheme","findThemes","vendorsIds","gamesVendor","findVendors","gamesSearchList","match","_matchGameByTheme","_matchGameByVendor","sortGamesByAI","LIST_TYPE_ID","index","themeIds","themeId","includes","vendorId","suggestedCategoriesOptions","i","option","categories","categoryConfig","_createSuggestedCategory","filter","categorySuggestion","defaultSuggestedCategories","suggestedCategory","suggestion","gameID","ServiceBase","computed"],"sourceRoot":""}