(()=>{function t(t,n){var i=this,e=t.tenantId,a={},t=_.memoize(function(t){t=o(t.id);return _.get(t,"instances")},function(t){return t.id}),s=null;function c(t){_.forEach(t,function(t){var n=t.applicationId;n&&(a[n]=t)})}function o(t){t=_.get(a,t);return n.getApplicationStatusForTenant(t,e)}_.assign(i,{$onInit:function(){var t={tenantId:e,filters:{pageSize:2e3}};n.getApplicationMOs(t).then(c)},openItem:function(t){(s=s!==t?t:null)&&(t=>{(t=o(t))?i.instancesStatus=n.getInstanceCounts(_.get(t,"details")):i.instancesStatus={}})(t.id)},isOpen:function(t){return s===t},hasApplicationStatus:function(t){t=o(t.id);return!_.isEmpty(t)},memoizedGetSubscriptionInstances:t,instancesStatus:{},getStatusIcon:function(t){t=_.find(n.status.values(),{value:_.get(o(t),"status")});return _.get(t,"icon")},getStringTooltip:function(t){t=_.find(n.status.values(),{value:_.get(o(t),"status")});return _.get(t,"label")}})}t.$inject=["$routeParams","c8yApplication"],angular.module("c8y.tenantApplications").component("c8ySubscribedApplications",{bindings:{associatedApplications:"<",dissociate:"<",tenant:"<"},templateUrl:":::PLUGIN_PATH:::/subscribed-applications/subscribed-applications.html",controller:t,controllerAs:"vm"})})();