define(["cardBuilder","appSettings","dom","apphost","layoutManager","imageLoader","globalize","scrollStyles","emby-button","paper-icon-button-light","emby-itemscontainer"],function(cardBuilder,appSettings,dom,appHost,layoutManager,imageLoader,globalize){"use strict";function getDefaultSection(index){switch(index){case 0:return"smalllibrarytiles";case 1:return"activerecordings";case 2:return"resume";case 3:return"resumeaudio";case 4:return"nextup";case 5:return"latestmedia";case 6:return"latesttvrecordings";default:return""}}function loadSection(page,apiClient,user,userSettings,index){var userId=user.Id,section=userSettings.get("homesection"+index)||getDefaultSection(index);"folders"===section&&(section=getDefaultSection()[0]);var elem=page.querySelector(".section"+index);return"latestmedia"===section?loadRecentlyAdded(elem,apiClient,user):"librarytiles"===section?loadLibraryTiles(elem,apiClient,user,"backdrop",index):"smalllibrarytiles"===section?loadLibraryTiles(elem,apiClient,user,"smallBackdrop",index):"smalllibrarytiles-automobile"===section?loadLibraryTiles(elem,apiClient,user,"smallBackdrop",index):"librarytiles-automobile"===section?loadLibraryTiles(elem,apiClient,user,"backdrop",index):"librarybuttons"===section?loadlibraryButtons(elem,apiClient,userId,index):"resume"===section?loadResumeVideo(elem,apiClient,userId):"resumeaudio"===section?loadResumeAudio(elem,apiClient,userId):"activerecordings"===section?loadActiveRecordings(elem,apiClient,userId):"nextup"===section?loadNextUp(elem,apiClient,userId):"latesttvrecordings"===section?loadLatestLiveTvRecordings(elem,apiClient,userId):"latestchannelmedia"===section?loadLatestChannelMedia(elem,apiClient,userId):(elem.innerHTML="",Promise.resolve())}function getUserViews(apiClient,userId){return apiClient.getUserViews({},userId||apiClient.getCurrentUserId()).then(function(result){return result.Items})}function enableScrollX(){return!layoutManager.desktop}function getSquareShape(){return enableScrollX()?"overflowSquare":"square"}function getThumbShape(){return enableScrollX()?"overflowBackdrop":"backdrop"}function getPortraitShape(){return enableScrollX()?"overflowPortrait":"portrait"}function getLibraryButtonsHtml(items){var html="";html+="