Liferay.Loader.define('portal-workflow-metrics-web@2.0.42/js/components/sla/form-page/util/slaFormUtil.es', ['module', 'exports', 'require'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.validateNodeKeys = exports.validateName = exports.validateHours = exports.validateDuration = exports.hasErrors = void 0;

    /**
     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
     *
     * The contents of this file are subject to the terms of the Liferay Enterprise
     * Subscription License ("License"). You may not use this file except in
     * compliance with the License. You can obtain a copy of the License by
     * contacting Liferay, Inc. See the License for the specific language governing
     * permissions and limitations under the License, including but not limited to
     * distribution rights of the Software.
     */
    var hasErrors = function hasErrors(errors) {
      return Object.keys(errors).some(function (key) {
        return errors[key];
      });
    };

    exports.hasErrors = hasErrors;

    var validateDuration = function validateDuration(days, hours) {
      if (!days && !hours) {
        return Liferay.Language.get('a-duration-time-is-required');
      }

      return '';
    };

    exports.validateDuration = validateDuration;

    var validateHours = function validateHours(hours) {
      var hoursRegex = /([01][0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])?/;

      if (hours && hours.trim().length && hours.match(hoursRegex)) {
        return '';
      }

      return Liferay.Language.get('value-must-be-an-hour-below');
    };

    exports.validateHours = validateHours;

    var validateName = function validateName(name) {
      if (!name || !name.trim()) {
        return Liferay.Language.get('a-name-is-required');
      }

      return '';
    };

    exports.validateName = validateName;

    var validateNodeKeys = function validateNodeKeys(nodeKeys) {
      if (!nodeKeys || !nodeKeys.length) {
        return Liferay.Language.get('at-least-one-parameter-is-required');
      }

      return '';
    };

    exports.validateNodeKeys = validateNodeKeys;
    //# sourceMappingURL=slaFormUtil.es.js.map
  }
});
//# sourceMappingURL=slaFormUtil.es.js.map