(()=>{function e(i,a,n,t,r){var s,e,l=this,v=60,c={c8yMax:{required_availability:r("Required interval must be a number and cannot be longer than 32767 minutes.")},c8yMin:{required_availability:r("Required interval must be a positive number.")}};function d(){l.device.c8y_RequiredAvailability=l.device.c8y_RequiredAvailability||{},l.device.c8y_RequiredAvailability.responseInterval<0||(""===l.responseInterval||null==l.responseInterval?l.device.c8y_RequiredAvailability=null:(l.device.c8y_RequiredAvailability.responseInterval=l.responseInterval,l.device.c8y_Tracking&&l.device.c8y_Tracking.interval&&l.device.c8y_Tracking.interval!==l.responseInterval*v&&(e=l.device.c8y_Tracking.interval>l.responseInterval*v?r("Changing this value can cause showing false offline statuses and prevent alarms from being created as early as possible"):r("Changing this value can cause showing false online statuses and prevent alarms from being created as early as possible"),i.add({text:e,type:"warning"})),o(l.device.c8y_RequiredAvailability)));var e=_.pick(l.device,["id","c8y_RequiredAvailability"]);return l.saveInProgress=!0,a.save(e).then(function(){l.saveInProgress=!1,u()}).then(function(){i.success(r("Required interval updated."))})}function o(e){var i=e&&0!==e.responseInterval;_.set(l,"responseInterval",i?Math.abs(Number(e.responseInterval)):void 0)}function u(){l.isEditMode?l.isEditMode=!1:(e=l.responseInterval,l.isEditMode=!0)}function y(){l.responseInterval=e,l.isEditMode=!1}_.assign(l,{isEditMode:!1,saveInProgress:!1,maxRequiredIntervalLimit:32767,save:d,switchMaintenance:function(e){a.switchResponseInterval(e)},$doCheck:function(){(()=>{var e=_.get(l.device,"c8y_RequiredAvailability");_.isEqual(e,s)||(o(e),s=e)})()},toggleEdit:u,resetEdit:y,validationHints:function(e){return n.validationHints(e,c)},keyHandler:function(e){return t.handle(e,d,y)},invalid:angular.bind(n,n.invalid,l,"availabilityForm")})}e.$inject=["c8yAlert","c8yDevices","c8yBase","keyboardKeyHandler","gettext"],angular.module("c8y.deviceStatus").component("requiredAvailabilityIntervalSetting",{controller:e,controllerAs:"vm",templateUrl:":::PLUGIN_PATH:::/requiredAvailabilityIntervalSetting.html",bindings:{device:"<",status:"<"}})})();