Liferay.Loader.define("portal-workflow-metrics-web@2.0.46/js/components/filter/SLAStatusFilter.es", ['module', 'exports', 'require', 'frontend-js-react-web$react', '../../shared/components/filter/Filter.es', '../../shared/components/filter/hooks/useFilterName.es', '../../shared/components/filter/hooks/useFilterStatic.es', '../../shared/components/filter/util/filterConstants.es'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    function _typeof(obj) {
      "@babel/helpers - typeof";
      if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
        _typeof = function _typeof(obj) {
          return typeof obj;
        };
      } else {
        _typeof = function _typeof(obj) {
          return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
        };
      }return _typeof(obj);
    }

    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.slaStatusConstants = exports.default = void 0;

    var _react = _interopRequireWildcard(require("frontend-js-react-web$react"));

    var _Filter = _interopRequireDefault(require("../../shared/components/filter/Filter.es"));

    var _useFilterName = require("../../shared/components/filter/hooks/useFilterName.es");

    var _useFilterStatic2 = require("../../shared/components/filter/hooks/useFilterStatic.es");

    var _filterConstants = _interopRequireDefault(require("../../shared/components/filter/util/filterConstants.es"));

    function _interopRequireDefault(obj) {
      return obj && obj.__esModule ? obj : { default: obj };
    }

    function _getRequireWildcardCache() {
      if (typeof WeakMap !== "function") return null;var cache = new WeakMap();_getRequireWildcardCache = function _getRequireWildcardCache() {
        return cache;
      };return cache;
    }

    function _interopRequireWildcard(obj) {
      if (obj && obj.__esModule) {
        return obj;
      }if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") {
        return { default: obj };
      }var cache = _getRequireWildcardCache();if (cache && cache.has(obj)) {
        return cache.get(obj);
      }var newObj = {};var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;for (var key in obj) {
        if (Object.prototype.hasOwnProperty.call(obj, key)) {
          var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;if (desc && (desc.get || desc.set)) {
            Object.defineProperty(newObj, key, desc);
          } else {
            newObj[key] = obj[key];
          }
        }
      }newObj.default = obj;if (cache) {
        cache.set(obj, newObj);
      }return newObj;
    }

    function _extends() {
      _extends = Object.assign || function (target) {
        for (var i = 1; i < arguments.length; i++) {
          var source = arguments[i];for (var key in source) {
            if (Object.prototype.hasOwnProperty.call(source, key)) {
              target[key] = source[key];
            }
          }
        }return target;
      };return _extends.apply(this, arguments);
    }

    function ownKeys(object, enumerableOnly) {
      var keys = Object.keys(object);if (Object.getOwnPropertySymbols) {
        var symbols = Object.getOwnPropertySymbols(object);if (enumerableOnly) symbols = symbols.filter(function (sym) {
          return Object.getOwnPropertyDescriptor(object, sym).enumerable;
        });keys.push.apply(keys, symbols);
      }return keys;
    }

    function _objectSpread(target) {
      for (var i = 1; i < arguments.length; i++) {
        var source = arguments[i] != null ? arguments[i] : {};if (i % 2) {
          ownKeys(Object(source), true).forEach(function (key) {
            _defineProperty(target, key, source[key]);
          });
        } else if (Object.getOwnPropertyDescriptors) {
          Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
        } else {
          ownKeys(Object(source)).forEach(function (key) {
            Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
          });
        }
      }return target;
    }

    function _defineProperty(obj, key, value) {
      if (key in obj) {
        Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true });
      } else {
        obj[key] = value;
      }return obj;
    }

    var slaStatusConstants = {
      onTime: 'OnTime',
      overdue: 'Overdue',
      untracked: 'Untracked'
    };
    exports.slaStatusConstants = slaStatusConstants;
    var slaStatuses = [{
      key: slaStatusConstants.onTime,
      name: Liferay.Language.get('on-time')
    }, {
      key: slaStatusConstants.overdue,
      name: Liferay.Language.get('overdue')
    }, {
      key: slaStatusConstants.untracked,
      name: Liferay.Language.get('untracked')
    }];

    var SLAStatusFilter = function SLAStatusFilter(_ref) {
      var className = _ref.className,
          _ref$filterKey = _ref.filterKey,
          filterKey = _ref$filterKey === void 0 ? _filterConstants.default.slaStatus.key : _ref$filterKey,
          _ref$options = _ref.options,
          options = _ref$options === void 0 ? {} : _ref$options,
          _ref$prefixKey = _ref.prefixKey,
          prefixKey = _ref$prefixKey === void 0 ? '' : _ref$prefixKey;
      options = _objectSpread({
        hideControl: false,
        multiple: true,
        position: 'left',
        withSelectionTitle: true,
        withoutRouteParams: false
      }, options);

      var _useFilterStatic = (0, _useFilterStatic2.useFilterStatic)(_objectSpread({
        filterKey: filterKey,
        prefixKey: prefixKey,
        staticItems: slaStatuses
      }, options)),
          items = _useFilterStatic.items,
          selectedItems = _useFilterStatic.selectedItems;

      var defaultItem = (0, _react.useMemo)(function () {
        return items ? items[0] : undefined;
      }, [items]);
      var filterName = (0, _useFilterName.useFilterName)(options.multiple, selectedItems, Liferay.Language.get('sla-status'), options.withSelectionTitle);
      return (/*#__PURE__*/_react.default.createElement(_Filter.default, _extends({
          defaultItem: defaultItem,
          elementClasses: className,
          filterKey: filterKey,
          items: items,
          name: filterName,
          prefixKey: prefixKey
        }, options))
      );
    };

    var _default = SLAStatusFilter;
    exports.default = _default;
    //# sourceMappingURL=SLAStatusFilter.es.js.map
  }
});
//# sourceMappingURL=SLAStatusFilter.es.js.map