(()=>{function n(n,e){var o=this,r=[{label:e("hours"),valueInSeconds:3600},{label:e("minutes"),valueInSeconds:60},{label:e("seconds"),valueInSeconds:1}];function t(){o.duration=o.ngModelController.$viewValue}function l(){var o=0<arguments.length&&void 0!==arguments[0]?arguments[0]:60,t=o,l=_.last(r);return _.forEach(r,function(n){var e=o/n.valueInSeconds;return e%1!=0||(t=e,l=n,!1)}),{amount:t,unit:l}}function u(n){return n.amount&&n.unit&&n.amount*n.unit.valueInSeconds}_.assign(o,{$onInit:function(){o.ngModelController.$render=t,o.ngModelController.$formatters.push(l),o.ngModelController.$parsers.push(u)},duration:{},units:r}),n.$watch("vm.duration",function(n){o.ngModelController.$setViewValue(_.cloneDeep(n))},!0)}n.$inject=["$scope","gettext"],angular.module("c8y.ui").component("c8yDurationInput",{templateUrl:":::PLUGIN_PATH:::/ui/forms/duration-input.html",require:{ngModelController:"ngModel"},controller:n,controllerAs:"vm"})})();