define(["exports","./../modules/common/globalize.js","./../modules/layoutmanager.js","./../modules/tabbedview/basetab.js","./../modules/emby-elements/emby-itemscontainer/emby-itemscontainer.js","./../modules/emby-elements/emby-scroller/emby-scroller.js","./../modules/tabbedview/sectionscontroller.js","./../modules/common/itemmanager/itemmanager.js","./../modules/emby-apiclient/connectionmanager.js","./../modules/approuter.js"],function(_exports,_globalize,_layoutmanager,_basetab,_embyItemscontainer,_embyScroller,_sectionscontroller,_itemmanager,_connectionmanager,_approuter){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0;function TvSuggestionsTab(view,params){_basetab.default.apply(this,arguments),_sectionscontroller.default.apply(this,arguments),this.view=view,this.params=params}Object.assign(TvSuggestionsTab.prototype,_basetab.default.prototype),Object.assign(TvSuggestionsTab.prototype,_sectionscontroller.default.prototype),TvSuggestionsTab.prototype.onSpotlightButtonCustomAction=function(options){var _item$Id,item=options.item;if(null==(_item$Id=item.Id)||!_item$Id.startsWith("tv_"))return _sectionscontroller.default.prototype.onSpotlightButtonCustomAction.apply(this,arguments);_item$Id="/tv?serverId="+_connectionmanager.default.getApiClient(item).serverId()+"&parentId="+item.ParentId,1<(item=item.Id.split("_")).length&&(_item$Id+="&tab="+item[1]),_approuter.default.show(_item$Id)},TvSuggestionsTab.prototype.fetchSections=function(){var sections=[],enableFocusPreview=this.enableFocusPreview(),parentId=this.params.parentId,serverId=this.serverId(),serverId=("x"===this.scrollDirection()&&this.options.addCategories&&sections.push({Id:"Spotlight",Name:" ",SectionType:"spotlight",CollectionType:"tvshows",Monitor:[],ListOptions:{shape:"backdrop",multiSelect:!1,overlayText:!0,fields:["Name"],cardClass:"wideSpotlightCard",coverImage:!0},QueryOptions:{SortBy:"Random",IncludeItemTypes:"Series",Recursive:!0,ParentId:parentId,EnableImageTypes:"Backdrop,Logo",ImageTypes:"Backdrop",Fields:"Taglines",ImageTypeLimit:1,Limit:1},CommandOptions:{},RefreshInterval:3e4,SpotlightButtons:[{Name:_globalize.default.translate("Shows"),Id:"tv_shows",ParentId:parentId,ServerId:serverId,Icon:_itemmanager.default.getDefaultIcon({Type:"Series"}),Type:"AppCategory",IsFolder:!0},{Name:_globalize.default.translate("Favorites"),Id:"tv_favorites",ParentId:parentId,ServerId:serverId,Icon:"favorite",Type:"AppCategory",IsFolder:!0},{Name:_globalize.default.translate("Upcoming"),Id:"tv_upcoming",ParentId:parentId,ServerId:serverId,Icon:"dvr",Type:"AppCategory",IsFolder:!0}]}),sections.push({Name:_globalize.default.translate("HeaderContinueWatching"),SectionType:"resume",CollectionType:"tvshows",Monitor:["videoplayback","markplayed"],ListOptions:{fields:enableFocusPreview?[]:["ParentName","Name"],preferThumb:!0},QueryOptions:{IncludeItemTypes:"Episode",ParentId:parentId,Recursive:!0},CommandOptions:{removeFromResume:!0}}),sections.push({Name:_globalize.default.translate("HeaderLatestEpisodes"),SectionType:"latestmedia",CollectionType:"tvshows",Monitor:["videoplayback","markplayed"],ListOptions:{fields:enableFocusPreview?[]:["Name","ProductionYear"]},QueryOptions:{IncludeItemTypes:"Episode",ParentId:parentId,Recursive:!0}}),new Date(Date.now()));return serverId.setTime(serverId.getTime()-12096e5),sections.push({Name:_globalize.default.translate("RecentlyReleasedEpisodes"),CollectionType:"tvshows",Monitor:["videoplayback","markplayed"],ListOptions:{fields:enableFocusPreview?[]:["ParentName","Name"],preferThumb:!0},QueryOptions:{IncludeItemTypes:"Episode",Recursive:!0,SortBy:"ProductionYear,PremiereDate,SortParentIndexNumber,SortIndexNumber",SortOrder:"Descending,Descending,Ascending,Ascending",MinPremiereDate:serverId.toISOString(),IsUnaired:!1,ParentId:parentId}}),Promise.resolve(sections)},TvSuggestionsTab.prototype.enablePushDownFocusPreview=function(){return _layoutmanager.default.tv&&"y"===this.scrollDirection()},TvSuggestionsTab.prototype.enablePushDownFocusPreview=function(){return _layoutmanager.default.tv&&"y"===this.scrollDirection()},TvSuggestionsTab.prototype.onResume=function(options){return _basetab.default.prototype.onResume.apply(this,arguments),_sectionscontroller.default.prototype.onResume.apply(this,arguments)},TvSuggestionsTab.prototype.onPause=function(){_basetab.default.prototype.onPause.apply(this,arguments),_sectionscontroller.default.prototype.onPause.apply(this,arguments)},TvSuggestionsTab.prototype.destroy=function(){_basetab.default.prototype.destroy.apply(this,arguments),_sectionscontroller.default.prototype.destroy.apply(this,arguments)};_exports.default=TvSuggestionsTab});