angular.module("app").service("packageManager",["core","modal",function(a,e){var filterByType=function(a,e){if(!e)return a;var r={};for(var t in a){var n=a[t];n&&n.type===e&&(r[t]=n)}return r};this.hasInstallablePackages=function(){return Object.keys(a.packages.installable).length>0},this.hasUpgradeablePackages=function(){return Object.keys(a.packages.upgradeable).length>0},this.hasForcedUpgrades=function(){return Object.keys(this.getForcedUpgrades()).length>0},this.isInstallable=function(e){return a.packages&&a.packages.installable&&void 0!==a.packages.installable[e]},this.isUpgradeable=function(e){return a.packages&&a.packages.upgradeable&&void 0!==a.packages.upgradeable[e]},this.getInstallable=function(e){return filterByType(a.packages.installable,e)},this.getUpgradeable=function(e){return filterByType(a.packages.upgradeable,e)},this.getForcedUpgrades=function(){var e={};if(a&&a.packages&&a.packages.upgradeable)for(var r in a.packages.upgradeable){var t=a.packages.upgradeable[r];t.candidate&&!0===t.candidate.force&&(e[r]=t)}return e},this.getHoldback=function(){return a.packages.holdback},this.getInstalledVersion=function(e){return void 0!==a.packages.installed[e]&&a.packages.installed[e].version},this.checkForcedUpgrades=function(){this.hasForcedUpgrades()&&e.show("PackageManagerModal",null,{overviewMode:"forcedUpgrades",mode:"overview",package:null})}}]);