(()=>{function t(t,e,n,i){var o=this,r={PENDING:"badge-info",EXECUTING:"badge-info",SUCCESSFUL:"badge-success",FAILED:"badge-danger"};_.assign(o,{getOperationsCount:function(){return o.operations?o.operations.length:0},getOperationsTooltip:function(){var t=_.countBy(o.operations,"status");return _.reduce(t,function(t,e,n){e=e,n=n,o={PENDING:i.getPlural(e,"1 operation pending","{{$count}} operations pending",{}),EXECUTING:i.getPlural(e,"1 operation executing","{{$count}} operations executing",{}),FAILED:i.getPlural(e,"1 operation failed","{{$count}} operations failed",{}),SUCCESSFUL:i.getPlural(e,"1 operation successful","{{$count}} operations successful",{})};var o,e=e?o[n]:"";return t&&e&&(t+="<br>"),t+e},"")||i.getString("No recent operations found")},getOperationsBadgeClass:function(){var t=_.countBy(o.operations,"status"),t=_.keys(t);if(0===t.length)return"badge-light";if(1===t.length)return r[t[0]];if(_.includes(t,"EXECUTING"))return r.EXECUTING;if(_.includes(t,"PENDING"))return r.PENDING;return"badge-warning"},openOperationsModal:function(){return e.open({size:"md",component:"c8yUiOperationsTimelineModal",resolve:{title:function(){return{icon:"list",text:o.modalTitle}},timelineHeader:function(){return n("Recent operations")},operations:function(){return o.operations},extraButtons:function(){return[{label:n("View history"),action:function(){return t.path("/device/".concat(o.context.id,"/control"))},cls:"btn-primary"}]}}}).result}})}t.$inject=["$location","$uibModal","gettext","gettextCatalog"],angular.module("c8y.genericUi").component("c8yGenericUiOperationListButton",{templateUrl:":::PLUGIN_PATH:::/generic-ui-operation-list-button.html",controllerAs:"vm",controller:t,bindings:{operations:"<",modalTitle:"@",context:"<"}})})();