define(["../list/list","itemHelper","scripts/taskbutton","loading","layoutManager","imageLoader","dom","globalize","mainTabsManager","cardBuilder","emby-linkbutton","emby-itemscontainer","cardStyle"],function(ListPage,itemHelper,taskButton,loading,layoutManager,imageLoader,dom,globalize,mainTabsManager,cardBuilder){"use strict";function addVirtualFolder(){var view=this;require(["medialibrarycreator"],function(medialibrarycreator){(new medialibrarycreator).show({collectionTypeOptions:function(){var options=[{name:"",value:""},{value:"movies",message:getLink("MovieLibraryHelp","https://github.com/MediaBrowser/Wiki/wiki/Movie%20naming")},{value:"music"},{value:"tvshows",message:getLink("TvLibraryHelp","https://github.com/MediaBrowser/Wiki/wiki/TV%20naming")}];ApiClient.isMinServerVersion("3.6.0.75")&&options.push({value:"audiobooks"});options.push({value:"books",message:getLink("BookLibraryHelp","https://github.com/MediaBrowser/Wiki/wiki/Book%20naming")}),options.push({value:"games",message:globalize.translate("MessageGamePluginRequired")}),options.push({value:"musicvideos"}),options.push({value:"homevideos"}),options.push({name:globalize.translate("MixedContent"),value:"mixed",message:globalize.translate("MessageUnsetContentHelp")});for(var i=1,length=options.length;i<length;i++)options[i].name||(options[i].name=itemHelper.getContentTypeName(options[i].value));return options}().filter(function(f){return!f.hidden}),refresh:"true"===view.getAttribute("data-refreshlibrary")}).then(function(hasChanges){hasChanges&&view.querySelector(".itemsContainer").notifyRefreshNeeded(!0)})})}function getLink(text,url){return globalize.translate(text,'<a is="emby-linkbutton" class="button-link" href="'+url+'" target="_blank" data-autohide="true">',"</a>")}function getTabs(){return[{href:"librarysetup/library.html",name:globalize.translate("HeaderLibraries")},{href:"librarysetup/advanced.html",name:globalize.translate("TabAdvanced")}]}function onViewShow(e){this.classList.contains("withTabs")&&mainTabsManager.setTabs(this,0,getTabs),this.querySelector(".btnRefresh")&&taskButton({mode:"on",progressElem:this.querySelector(".refreshProgress"),taskKey:"RefreshLibrary",button:this.querySelector(".btnRefresh")})}function onWizardNextClick(){Dashboard.navigate("wizard/wizardsettings.html")}function LibrarySetupPage(view,params){params.serverId=ApiClient.serverId(),ListPage.call(this,view,params),view.addEventListener("viewshow",onViewShow),view.addEventListener("addvirtualfolder",addVirtualFolder);var btnWizardNext=view.querySelector(".btnWizardNext");btnWizardNext&&btnWizardNext.addEventListener("click",onWizardNextClick)}return Object.assign(LibrarySetupPage.prototype,ListPage.prototype),LibrarySetupPage.prototype.getItems=function(sortBy,startIndex,limit){return ApiClient.getVirtualFolders().then(function(items){return items.push({Name:globalize.translate("ButtonAddMediaLibrary"),Type:"AddVirtualFolder"}),items})},LibrarySetupPage.prototype.setTitle=function(){},LibrarySetupPage.prototype.getItemsHtml=function(items){return cardBuilder.getCardsHtml({items:items,shape:"backdrop",showTitle:!0,centerText:!0,overlayMoreButton:!0,overlayText:!1,multiSelect:!1,action:"edit",cardLayout:!0,centerPlayButton:!1,hoverPlayButton:!1,defaultCardImageIcon:"folder",showContentType:!0,defaultBackground:!0,showLibraryFolders:!0})},LibrarySetupPage});