(()=>{function t(t,n,s,e,i){var a,r=this;function c(){u(!0),s.getApplicationMO(n.applicationId).then(l).then(function(){a="/managedobjects/".concat(r.mo.id),e.addListener(t.$id,a,e.realtimeActions().UPDATE,function(t,n){return l(n)}),e.start(t.$id,a)}).finally(function(){return u(!1)})}function o(){e.stop(t.$id,a),e.removeSubscriber(t.$id,a)}function u(t){r.refreshingItems.appDetails=t}function l(t){r.mo=t,r.status=t.c8y_Status}_.assign(r,{status:"",realtime:!0,refreshingItems:{},tenantSubscriptions:{},$onInit:function(){c(),i.list(!0,!1).then(function(t){r.smartRulesMsExist=!!t}).catch(function(){r.smartRulesMsExist=!1})},$onDestroy:function(){o()},refresh:function(){o(),c(),t.$broadcast("alarmListRefresh"),t.$broadcast("eventListRefresh"),t.$broadcast("smartRulesListReload")},isRefreshing:function(){return _.includes(r.refreshingItems,!0)},statusVisible:function(){return!_.isEmpty(_.get(r.mo,"c8y_Status"))},subscriptionsVisible:function(){return!_.isEmpty(_.get(r.mo,"c8y_Subscriptions"))}}),t.$watch("vm.realtime",function(t,n){t!==n&&(t?c:o)()})}t.$inject=["$scope","$routeParams","c8yApplication","c8yRealtime","smartRuleTemplatesSvc"],angular.module("c8y.appStatus").component("c8yAppStatus",{bindings:{basePath:"@"},templateUrl:":::PLUGIN_PATH:::/app-status/app-status.html",controller:t,controllerAs:"vm"})})();