define(["exports","./../modules/tabbedview/tabbedview.js","./../modules/emby-elements/emby-scroller/emby-scroller.js","./../modules/emby-elements/emby-button/emby-button.js","./../modules/emby-apiclient/connectionmanager.js","./../modules/mediainfo/mediainfo.js","./../modules/dom.js","./../modules/common/itemmanager/itemmanager.js","./../modules/skinmanager.js"],function(_exports,_tabbedview,_embyScroller,_embyButton,_connectionmanager,_mediainfo,_dom,_itemmanager,_skinmanager){function HomeView(view,params){_tabbedview.default.call(this,view,params),this.selectedItemInfoElement=view.querySelector(".selectedItemInfoInner"),this.enableBackMenu=!0}function clearSelectedItemInfo(instance){instance.selectedItemInfoElement.innerHTML="",instance.selectedItemInfoElementHasContent=!1}function setSelectedInfo(instance,card,item){var html,logoImageUrl,selectedItemInfoElement=instance.selectedItemInfoElement;selectedItemInfoElement&&(!item.ServerId||item.IsCategory?clearSelectedItemInfo(instance):(html="",(logoImageUrl=function(item,options){options=options||{};var logoTypes=_skinmanager.default.getPreferredLogoImageTypes();return _connectionmanager.default.getApiClient(item).getLogoImageUrl(item,options,logoTypes)}(item,{}))&&(html+='<img class="selectedItemInfoLogo" loading="lazy" src="'+logoImageUrl+'" />'),logoImageUrl="Program"===item.Type?_mediainfo.default.getSecondaryMediaInfoHtml(item):_mediainfo.default.getPrimaryMediaInfoHtml(item),html+='<div class="selectedItemInfoDetails"><div class="selectedItemName">',item.AlbumArtist&&(html+=item.AlbumArtist+" - "),item.IsSeries?html+=item.Name:html+=_itemmanager.default.getDisplayName(item),html+="</div>",logoImageUrl&&(html=(html+='<div class="selectedItemMediaInfo mediaInfoItems">')+logoImageUrl+"</div>"),selectedItemInfoElement.innerHTML=html+="</div>",instance.selectedItemInfoElementHasContent=!0,item=card.getBoundingClientRect(),logoImageUrl=Math.min(item.left,.8*_dom.default.getWindowSize().innerWidth),selectedItemInfoElement.style.left=Math.max(logoImageUrl,70)+"px",html&&selectedItemInfoElement.animate&&selectedItemInfoElement.animate([{opacity:"0",offset:0},{opacity:"1",offset:1}],{duration:140,iterations:1,easing:"ease-out"})))}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,require(["css!home_horiz/home.css"]),Object.assign(HomeView.prototype,_tabbedview.default.prototype),HomeView.prototype.getTabs=function(){var items=this.item.UserViews;return function(instance){if(!instance.tabsCreated){instance.tabsCreated=!0;for(var html="",i=0,length=instance.item.UserViews.length;i<length;i++)html+='<div class="tabContent home-horiz-tabContent flex flex-grow focuscontainer-x" data-index="'+i+'"></div>';instance.view.insertAdjacentHTML("afterbegin",html)}}(this),items.map(function(i){return{name:i.Name,id:i.Id+"_"+(i.CollectionType||"")}})},HomeView.prototype.getItem=function(){var apiClient=_connectionmanager.default.currentApiClient();return apiClient.getUserViews({},apiClient.getCurrentUserId()).then(function(result){return{UserViews:result.Items||result}})},HomeView.prototype.setTitle=function(){},HomeView.prototype.onTabChange=function(previousController){_tabbedview.default.prototype.onTabChange.apply(this,arguments),clearSelectedItemInfo(this)},HomeView.prototype.loadTabController=function(id){switch(id.split("_")[1]){case"movies":return Emby.importModule("./home_horiz/views.movies.js");case"music":return Emby.importModule("./home_horiz/views.music.js");case"tvshows":return Emby.importModule("./home_horiz/views.tv.js");case"livetv":return Emby.importModule("./home_horiz/views.livetv.js");default:return Emby.importModule("./home_horiz/folderstab.js")}},HomeView.prototype.getTabControllerParams=function(id){var params=_tabbedview.default.prototype.getTabControllerParams.apply(this,arguments);return id=id.split("_")[0],params.parentId=id,params},HomeView.prototype.getTabControllerOptions=function(id){return{scrollDirection:"x"}},HomeView.prototype.onItemFocused=function(item){setSelectedInfo(this,document.activeElement,item)},HomeView.prototype.onFocusOut=function(){this.selectedItemInfoElement&&this.selectedItemInfoElementHasContent&&clearSelectedItemInfo(this)},HomeView.prototype.onTabControllerCreated=function(controller){_tabbedview.default.prototype.onTabControllerCreated.apply(this,arguments),controller.onItemFocusedExternal=this.onItemFocused.bind(this),controller.onFocusOutExternal=this.onFocusOut.bind(this)},HomeView.prototype.destroy=function(){_tabbedview.default.prototype.destroy.apply(this,arguments)},_exports.default=HomeView});