import connectionManager from"./../modules/emby-apiclient/connectionmanager.js";import events from"./../modules/emby-apiclient/events.js";import globalize from"./../modules/common/globalize.js";import playbackManager from"./../modules/common/playback/playbackmanager.js";import appHeader from"./../modules/appheader/appheader.js";import backdrop from"./../modules/backdrop/backdrop.js";import itemManager from"./../modules/common/itemmanager/itemmanager.js";import layoutManager from"./../modules/layoutmanager.js";import userSettings from"./../modules/common/usersettings/usersettings.js";import BaseView from"./../modules/viewmanager/baseview.js";import SearchFields from"./../search/searchfields.js";import"./../modules/emby-elements/emby-scroller/emby-scroller.js";import"./../modules/emby-elements/emby-tabs/emby-tabs.js";import"./../modules/emby-elements/emby-itemscontainer/emby-itemscontainer.js";import ListController from"./../modules/tabbedview/listcontroller.js";function hideOrShowAll(elems,hide){for(let i=0,length=elems.length;i
')+tabs.map(function(tab,index){var pluralName="all"===tab.Id?tab.Name:itemManager.getPluralItemTypeName(tab.Name);return'"}).join("")+"
");tabs=this.view.querySelector(".searchTabs");(tabs.innerHTML=html)?(tabs.classList.remove("hide"),tabs.querySelector(".searchTabsContainer").addEventListener("tabchange",onSearchTabChange.bind(this))):tabs.classList.add("hide")},ItemsView.prototype.setTitle=function(){var title;!1!==this.params.setTitle&&(title=this.getTitle(),appHeader.setTitle(title||""))},ItemsView.prototype.getSortBySettingsKey=function(sortMenuOptions){return"OnNow"===this.params.type?userSettings.getLiveTvChannelSortSettingsKey():ListController.prototype.getSortBySettingsKey.apply(this,arguments)},ItemsView.prototype.getSortByValue=function(){var query;return"OnNow"===this.params.type?(userSettings.addLiveTvChannelSortingToQuery(query={},globalize),query.SortBy):ListController.prototype.getSortByValue.apply(this,arguments)},ItemsView.prototype.getDefaultSorting=function(){var query;return"OnNow"===this.params.type?(userSettings.addLiveTvChannelSortingToQuery(query={},globalize),{sortBy:query.SortBy,sortOrder:query.SortOrder}):ListController.prototype.getDefaultSorting.apply(this,arguments)},ItemsView.prototype.supportsPlay=function(){var params=this.params,collectionType=this.getParentItem()?.CollectionType;return"downloads"!==params.parentId&&"search"!==params.type&&"missingepisodes"!==params.type&&"playlists"!==collectionType&&"boxsets"!==collectionType&&ListController.prototype.supportsPlay.apply(this,arguments)},ItemsView.prototype.supportsShuffle=function(){var params=this.params,parentItem=this.getParentItem(),itemType=parentItem?.Type,parentItem=parentItem?.CollectionType;return"downloads"!==params.parentId&&"search"!==params.type&&"missingepisodes"!==params.type&&"playlists"!==parentItem&&"boxsets"!==parentItem&&("MusicGenre"===itemType||"Program"!==params.type&&"TvChannel"!==params.type&&"OnNow"!==params.type&&"nextup"!==params.type&&"Game"!==params.type&&"Channel"!==itemType&&"GameSystem"!==itemType&&"GameGenre"!==itemType)&&this.supportsPlay()},ItemsView.prototype.supportsQueue=function(){var params=this.params,collectionType=this.getParentItem()?.CollectionType;if("downloads"!==params.parentId&&"search"!==params.type&&"missingepisodes"!==params.type&&"playlists"!==collectionType&&"boxsets"!==collectionType&&this.supportsPlay()){params=this.getParentItem();if(params)return playbackManager.canQueue(params)}return!1},ItemsView.prototype.getSortMenuOptions=function(){var params=this.params;if("downloads"===params.parentId)return[];switch(params.type){case"nextup":case"search":case"missingepisodes":return[];case"OnNow":return userSettings.getLiveTvChannelSortOrders(globalize);default:return ListController.prototype.getSortMenuOptions.apply(this,arguments)}},ItemsView.prototype.getVisibleFilters=function(){var params=this.params;if("downloads"===params.parentId)return[];switch(params.type){case"nextup":case"OnNow":case"search":case"missingepisodes":return[];default:return ListController.prototype.getVisibleFilters.apply(this,arguments)}},ItemsView.prototype.getDisplayPreset=function(){var params=this.params;return params.mediaTypes?params.mediaTypes.split(",")[0]:ListController.prototype.getDisplayPreset.apply(this,arguments)},ItemsView.prototype.getViewSettingDefaults=function(parentItem,listItems,availableFieldIds){var activeSearchTab,defaults=ListController.prototype.getViewSettingDefaults.apply(this,arguments),params=this.params;return"search"===params.type?(defaults.fields=["Name"],!(activeSearchTab=this.view.querySelector(".emby-searchable-tab-button.emby-tab-button-active"))||"all"===(activeSearchTab=activeSearchTab.getAttribute("data-searchtype"))?(defaults.fields.push("Type"),defaults.fields.push("ProductionYear")):"Movie"===activeSearchTab||"Series"===activeSearchTab||"Trailer"===activeSearchTab?defaults.fields.push("ProductionYear"):"Audio"===activeSearchTab&&(defaults.imageType="list")):"nextup"===params.type&&(defaults.imageType=this.params.defaultView||"thumb"),defaults},ItemsView.prototype.getItemTypes=function(){var paramsType=this.params.type;switch(paramsType){case"nextup":case"missingepisodes":return["Episode"];case"OnNow":return["TvChannel"];case"favoritemovies":return["Movie"];case"search":return[];case"Recordings":return["Episode","Video","Movie"];default:return paramsType?paramsType.split(","):[]}},ItemsView.prototype.getSettingsKey=function(){var values=[],params=(values.push("items"),this.params);return params.type?values.push(params.type):params.mediaTypes?values.push(params.mediaTypes):params.parentId&&values.push(params.parentId),params.IsAiring&&values.push("IsAiring"),params.IsMovie&&values.push("IsMovie"),params.IsKids&&values.push("IsKids"),params.IsSports&&values.push("IsSports"),params.IsNews&&values.push("IsNews"),params.IsSeries&&values.push("IsSeries"),params.IsFavorite&&values.push("IsFavorite"),params.genreId&&values.push("Genre"),params.gameGenreId&&values.push("GameGenre"),params.musicGenreId&&values.push("MusicGenre"),params.studioId&&values.push("Studio"),params.tagId&&values.push("Tag"),params.personId&&values.push("Person"),params.parentId&&values.push("Folder"),values.join("-")};export default ItemsView;