define(["../list/list","pluginManager","mainTabsManager","globalize","cardStyle","emby-linkbutton"],function(ListPage,pluginManager,mainTabsManager,globalize){"use strict";function getTabs(){return[{href:"plugins",name:globalize.translate("TabMyPlugins")},{href:"plugincatalog",name:globalize.translate("TabCatalog")}]}function sortPlugins(plugin1,plugin2){return plugin1.Name>plugin2.Name?1:-1}function PluginsPage(view,params){view.classList.add("withTabs"),view.setAttribute("style","padding-top:0!important;"),params.serverId=ApiClient.serverId(),this.supportsPlayback=!1,this.supportsViewSettings=!1,this.enableTotalRecordCountDisplay=!1,this.enableAlphaNumericShortcuts=!1,ListPage.call(this,view,params),view.addEventListener("viewshow",function(){mainTabsManager.setTabs(this,0,getTabs)})}return Object.assign(PluginsPage.prototype,ListPage.prototype),PluginsPage.prototype.getItems=function(query){return ApiClient.getInstalledPlugins().then(function(plugins){return ApiClient.getJSON(ApiClient.getUrl("web/configurationpages")+"?pageType=PluginConfiguration").then(function(configPages){for(var i=0,length=plugins.length;i<length;i++)!function(plugin,pluginConfigurationPages){plugin.ServerId=ApiClient.serverId(),plugin.Type="Plugin",plugin.PrimaryImageAspectRatio=16/9;var configPage=pluginConfigurationPages.filter(function(pluginConfigurationPage){return pluginConfigurationPage.PluginId===plugin.Id})[0];plugin.ConfigPageUrl=configPage?pluginManager.getConfigurationPageUrl(configPage.Name):null}(plugins[i],configPages);var totalRecordCount=(plugins=plugins.sort(sortPlugins)).length;return query&&(query.StartIndex&&(plugins=plugins.slice(query.StartIndex)),null!=query.Limit&&query.Limit<plugins.length&&(plugins.length=query.Limit)),{Items:plugins,TotalRecordCount:totalRecordCount}})})},PluginsPage.prototype.getSettingsKey=function(){return"plugins"},PluginsPage.prototype.setTitle=function(){},PluginsPage.prototype.getCardOptions=function(items,settings){var options=ListPage.prototype.getCardOptions.apply(this,arguments);return(options=Object.assign(options,{centerText:!0,overlayText:!1,showParentTitle:!1,draggable:!1,multiSelect:!1})).fields.push("Version"),options},PluginsPage.prototype.getSortMenuOptions=function(){return[]},PluginsPage.prototype.getVisibleFilters=function(){return[]},PluginsPage.prototype.getVisibleViewSettings=function(){return{settings:[],fields:[]}},PluginsPage});