(()=>{function e(a,i,c,o,r){function e(){var e=a.config,t=a.obj;t&&e&&(_.isFunction(e.hideIf)&&(a.hidden=e.hideIf(t)),_.isFunction(e.disableIf))&&(a.disabled=e.disableIf(t))}function s(e){var t,n;!!((t=e)&&t.created&&t.created.then&&t.completed&&t.completed.then)?(n=e).operationConfig.then(function(e){n.created.then(function(){i.success(o.getString('Operation "{{ description | translate }}" will be executed.',e))},l),n.completed.then(function(e){l(),e.status===r.status.SUCCESSFUL?i.success(o.getString('Operation "{{ description | translate }}" succeeded.',e)):e.status===r.status.FAILED&&(e.failureReason?i.danger(o.getString('Operation "{{ description | translate }}" failed: "{{ failureReason | translate }}".',e)):i.danger(o.getString('Operation "{{ description | translate }}" failed.',e)))},l)}):(l(),i.success(c("Operation completed.")))}function u(){l(),i.danger(c("Operation failed."))}function l(){a.pending=!1}a.isApplicable=function(){var e=a.value;return _.isFunction(e)},a.click=function(){var e,t=a.value,n=a.obj,i=a.config.args;_.isFunction(t)&&(i?n&&(e=t.apply(n,i)):e=t()),e&&(a.pending=!0,e.then(s,u))},a.$watch("value",e),a.$watch("obj",e),a.$watch("config",e),a.getBtnText=function(e){return e||c("Run")}}e.$inject=["$scope","c8yAlert","gettext","gettextCatalog","c8yDeviceControl"],angular.module("c8y.assets").controller("RendererButtonCtrl",e)})();