define(["exports","./../modules/emby-apiclient/connectionmanager.js","./../modules/layoutmanager.js","./../modules/cardbuilder/cardbuilder.js","./../modules/tabbedview/basetab.js","./../modules/emby-elements/emby-itemscontainer/emby-itemscontainer.js","./../modules/emby-elements/emby-scroller/emby-scroller.js"],function(_exports,_connectionmanager,_layoutmanager,_cardbuilder,_basetab,_embyItemscontainer,_embyScroller){function TvFavoritesTab(view,params){_basetab.default.apply(this,arguments),this.view=view,this.params=params,this.apiClient=_connectionmanager.default.getApiClient(params.serverId);var seriesItemsContainer=view.querySelector(".seriesItems"),seriesItemsContainer=(seriesItemsContainer.getListOptions=function(items){return{renderer:_cardbuilder.default,options:{shape:"auto",centerText:!0,fields:this.enableFocusPreview()?[]:["Name"]},virtualScrollLayout:"vertical-grid"}}.bind(this),seriesItemsContainer.fetchData=function(items){var apiClient=this.apiClient,parentId=this.params.parentId;return apiClient.getItems(apiClient.getCurrentUserId(),{SortBy:"SortName",SortOrder:"Ascending",IncludeItemTypes:"Series",Recursive:!0,Fields:this.getRequestedItemFields()+",PrimaryImageAspectRatio",ImageTypeLimit:1,EnableImageTypes:this.getRequestedImageTypes(),StartIndex:0,parentId:parentId,IsFavorite:!0})}.bind(this),seriesItemsContainer.parentContainer=view.querySelector(".favoriteSeriesSection"),this.seriesItemsContainer=seriesItemsContainer,this.addFocusBehavior(this.seriesItemsContainer),view.querySelector(".episodeItems"));seriesItemsContainer.getListOptions=function(items){return{renderer:_cardbuilder.default,options:{shape:"auto",fields:["ParentName","Name"],centerText:!0},virtualScrollLayout:"vertical-grid"}}.bind(this),seriesItemsContainer.fetchData=function(items){var apiClient=this.apiClient,parentId=this.params.parentId;return apiClient.getItems(apiClient.getCurrentUserId(),{SortBy:"SeriesName,SortName",SortOrder:"Ascending",IncludeItemTypes:"Episode",Recursive:!0,Fields:this.getRequestedItemFields()+",PrimaryImageAspectRatio",ImageTypeLimit:1,EnableImageTypes:this.getRequestedImageTypes(),StartIndex:0,parentId:parentId,IsFavorite:!0})}.bind(this),seriesItemsContainer.parentContainer=view.querySelector(".favoriteEpisodesSection"),this.episodeItemsContainer=seriesItemsContainer,this.addFocusBehavior(this.episodeItemsContainer),params.parentId&&(this.seriesItemsContainer.setAttribute("data-parentid",params.parentId),this.episodeItemsContainer.setAttribute("data-parentid",params.parentId))}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,Object.assign(TvFavoritesTab.prototype,_basetab.default.prototype),TvFavoritesTab.prototype.supportsFocusPreview=function(){return!0},TvFavoritesTab.prototype.enableFocusPreview=function(){return _layoutmanager.default.tv&&this.supportsFocusPreview()},TvFavoritesTab.prototype.onResume=function(options){var promises,instance;_basetab.default.prototype.onResume.apply(this,arguments),options.refresh&&((promises=[]).push(this.seriesItemsContainer.resume(options)),promises.push(this.episodeItemsContainer.resume(options)),instance=this,Promise.all(promises).then(function(){options.autoFocus&&instance.autoFocus(),instance.fillFocusPreviewIfNeeded()}))},TvFavoritesTab.prototype.onPause=function(){_basetab.default.prototype.onPause.apply(this,arguments);var seriesItemsContainer=this.seriesItemsContainer,seriesItemsContainer=(seriesItemsContainer&&seriesItemsContainer.pause&&seriesItemsContainer.pause(),this.episodeItemsContainer);seriesItemsContainer&&seriesItemsContainer.pause&&seriesItemsContainer.pause()},TvFavoritesTab.prototype.destroy=function(){_basetab.default.prototype.destroy.apply(this,arguments),this.view=null,this.params=null,this.apiClient=null,this.seriesItemsContainer=null,this.episodeItemsContainer=null},_exports.default=TvFavoritesTab});