Liferay.Loader.define("portal-search-ranking-web@2.0.50/js/components/ResultRankingsForm.es", ['module', 'exports', 'require', '@frontend-taglib-clay$clayui/layout', '@frontend-taglib-clay$clayui/tabs', 'frontend-js-react-web$prop-types', 'frontend-js-react-web$react', '../ThemeContext.es', '../utils/FormValueDebugger.es', '../utils/api.es', '../utils/constants.es', '../utils/util.es', './PageToolbar.es', './alias/Alias.es', './list/List.es', './shared/ErrorBoundary.es', './shared/HiddenInputs.es'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.default = void 0;

    var _layout = _interopRequireDefault(require("@frontend-taglib-clay$clayui/layout"));

    var _tabs = _interopRequireDefault(require("@frontend-taglib-clay$clayui/tabs"));

    var _propTypes = require("frontend-js-react-web$prop-types");

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

    var _ThemeContext = _interopRequireDefault(require("../ThemeContext.es"));

    var _FormValueDebugger = _interopRequireDefault(require("../utils/FormValueDebugger.es"));

    var _api = require("../utils/api.es");

    var _constants = require("../utils/constants.es");

    var _util = require("../utils/util.es");

    var _PageToolbar = _interopRequireDefault(require("./PageToolbar.es"));

    var _Alias = _interopRequireDefault(require("./alias/Alias.es"));

    var _List = _interopRequireDefault(require("./list/List.es"));

    var _ErrorBoundary = _interopRequireDefault(require("./shared/ErrorBoundary.es"));

    var _HiddenInputs = _interopRequireDefault(require("./shared/HiddenInputs.es"));

    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 _interopRequireDefault(obj) {
      return obj && obj.__esModule ? obj : { default: obj };
    }

    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);
    }

    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 _toConsumableArray(arr) {
      return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
    }

    function _nonIterableSpread() {
      throw new TypeError("Invalid attempt to spread non-iterable instance");
    }

    function _iterableToArray(iter) {
      if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
    }

    function _arrayWithoutHoles(arr) {
      if (Array.isArray(arr)) {
        for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
          arr2[i] = arr[i];
        }return arr2;
      }
    }

    function _classCallCheck(instance, Constructor) {
      if (!(instance instanceof Constructor)) {
        throw new TypeError("Cannot call a class as a function");
      }
    }

    function _defineProperties(target, props) {
      for (var i = 0; i < props.length; i++) {
        var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);
      }
    }

    function _createClass(Constructor, protoProps, staticProps) {
      if (protoProps) _defineProperties(Constructor.prototype, protoProps);if (staticProps) _defineProperties(Constructor, staticProps);return Constructor;
    }

    function _possibleConstructorReturn(self, call) {
      if (call && (_typeof(call) === "object" || typeof call === "function")) {
        return call;
      }return _assertThisInitialized(self);
    }

    function _getPrototypeOf(o) {
      _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
        return o.__proto__ || Object.getPrototypeOf(o);
      };return _getPrototypeOf(o);
    }

    function _assertThisInitialized(self) {
      if (self === void 0) {
        throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
      }return self;
    }

    function _inherits(subClass, superClass) {
      if (typeof superClass !== "function" && superClass !== null) {
        throw new TypeError("Super expression must either be null or a function");
      }subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });if (superClass) _setPrototypeOf(subClass, superClass);
    }

    function _setPrototypeOf(o, p) {
      _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
        o.__proto__ = p;return o;
      };return _setPrototypeOf(o, p);
    }

    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 DELTA = _constants.DEFAULT_DELTA.label;

    var ResultRankingsForm = /*#__PURE__*/function (_Component) {
      _inherits(ResultRankingsForm, _Component);

      function ResultRankingsForm(props) {
        var _this;

        _classCallCheck(this, ResultRankingsForm);

        _this = _possibleConstructorReturn(this, _getPrototypeOf(ResultRankingsForm).call(this, props));

        _defineProperty(_assertThisInitialized(_this), "state", {
          /**
           * Number of the active tab.
           * @type {number}
           */
          activeTabKeyValue: 0,

          /**
           * A list of strings of aliases.
           * @type {Array}
           */
          aliases: _this.props.initialAliases,

          /**
           * Stores the original start and end indexes for submitting to be able
           * to update the stored pinned ids.
           * @type {Object}
           */
          dataLoadIndex: {
            pinned: {
              end: 0,
              start: 0
            }
          },

          /**
           * Display a loading spinner under the hidden results tab while data
           * is fetching.
           * @type {boolean}
           */
          dataLoadingHidden: false,

          /**
           * Display a loading spinner under the visible results tab while data
           * is fetching.
           * @type {boolean}
           */
          dataLoadingVisible: false,

          /**
           * Map of all the data. Key is the ID and value is the data object.
           * @type {Object}
           */
          dataMap: {},

          /**
           * Display an error message when a data fetch request fails.
           * @type {boolean}
           */
          displayError: false,

          /**
           * Display an error message when a data fetch request fails for the
           * hidden results tab.
           * @type {boolean}
           */
          displayErrorHidden: false,

          /**
           * "Pagination" for items loaded in hidden label.
           * @type {number}
           */
          hiddenCur: 0,

          /**
           * Indicates whether ranking is active or inactive.
           * @type {boolean}
           */
          inactive: _this.props.initialInactive,

          /**
           * A full list of IDs which include hidden and pinned items. This is
           * equivalent to the IDs in dataMap, but in a sorted order.
           * @type {Array}
           */
          resultIds: [],

          /**
           * The list of IDs that are currently hidden.
           * @type {Array}
           */
          resultIdsHidden: [],

          /**
           * The list of IDs that are currently pinned. This is in sorted order.
           * @type {Array}
           */
          resultIdsPinned: [],

          /**
           * Toggles on and off the debugger form.
           * @type {boolean}
           */
          showDebugger: false,

          /**
           * Total number of hidden results returned from the fetch request.
           * @type {number}
           */
          totalResultsHiddenCount: 0,

          /**
           * Total number of non-hidden results returned from the fetch request.
           * @type {number}
           */
          totalResultsVisibleCount: 0,

          /**
           * "Pagination" for items loaded in visible label.
           * @type {number}
           */
          visibleCur: 0,

          /**
           * Determines if the form submission is save as draft or publish.
           * @type {string}
           */
          workflowAction: ''
        });

        _defineProperty(_assertThisInitialized(_this), "_getHiddenAdded", function () {
          return _this.state.resultIdsHidden.filter(function (item) {
            return !_this._initialResultIdsHidden.includes(item);
          });
        });

        _defineProperty(_assertThisInitialized(_this), "_getHiddenRemoved", function () {
          return _this._initialResultIdsHidden.filter(function (item) {
            return !_this.state.resultIdsHidden.includes(item);
          });
        });

        _defineProperty(_assertThisInitialized(_this), "_getResultIdsVisible", function () {
          var _this$state = _this.state,
              resultIds = _this$state.resultIds,
              resultIdsPinned = _this$state.resultIdsPinned;
          var notPinnedOrHiddenIds = resultIds.filter(function (id) {
            return _this._isNotPinnedOrHidden(id);
          });
          return [].concat(_toConsumableArray(resultIdsPinned), _toConsumableArray(notPinnedOrHiddenIds));
        });

        _defineProperty(_assertThisInitialized(_this), "_handleActive", function () {
          _this.setState(function (state) {
            return {
              inactive: !state.inactive
            };
          });
        });

        _defineProperty(_assertThisInitialized(_this), "_handleClickPin", function (ids) {
          var pin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;

          _this.setState(function (state) {
            return {
              dataMap: (0, _util.updateDataMap)(state.dataMap, ids, {
                hidden: false,
                pinned: pin
              }),
              resultIdsHidden: (0, _util.removeIdFromList)(state.resultIdsHidden, ids),
              resultIdsPinned: pin ? [].concat(_toConsumableArray(state.resultIdsPinned), _toConsumableArray(ids)) : (0, _util.removeIdFromList)(state.resultIdsPinned, ids)
            };
          });
        });

        _defineProperty(_assertThisInitialized(_this), "_handleClickHide", function (ids) {
          var hide = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;

          _this.setState(function (state) {
            return {
              dataMap: (0, _util.updateDataMap)(state.dataMap, ids, {
                hidden: hide,
                pinned: false
              }),
              resultIdsHidden: hide ? [].concat(_toConsumableArray(ids), _toConsumableArray(state.resultIdsHidden)) : (0, _util.removeIdFromList)(state.resultIdsHidden, ids),
              resultIdsPinned: hide ? (0, _util.removeIdFromList)(state.resultIdsPinned, ids) : state.resultIdsPinned
            };
          });
        });

        _defineProperty(_assertThisInitialized(_this), "_handleFetchResultsDataVisible", function () {
          var _fetchDocuments;

          _this.setState({
            dataLoadingVisible: true,
            displayError: false
          });

          var _this$context = _this.context,
              companyId = _this$context.companyId,
              namespace = _this$context.namespace;
          return (0, _api.fetchDocuments)(_this.props.fetchDocumentsVisibleUrl, (_fetchDocuments = {}, _defineProperty(_fetchDocuments, "".concat(namespace, "companyId"), companyId), _defineProperty(_fetchDocuments, "".concat(namespace, "from"), DELTA * _this.state.visibleCur), _defineProperty(_fetchDocuments, "".concat(namespace, "keywords"), _this.props.searchQuery), _defineProperty(_fetchDocuments, "".concat(namespace, "size"), DELTA), _fetchDocuments)).then(function (_ref) {
            var items = _ref.items,
                total = _ref.total;
            var fetchedItems = items || {}; // Get existing results to update its addedResult property.

            var existingFetchedIds = fetchedItems.filter(function (_ref2) {
              var id = _ref2.id;
              return _this.state.resultIds.includes(id);
            }).map(function (_ref3) {
              var id = _ref3.id;
              return id;
            }); // Remove duplicate results from the new list of results to
            // avoid duplicate key errors.

            var newItems = fetchedItems.filter(function (_ref4) {
              var id = _ref4.id;
              return !_this.state.resultIds.includes(id);
            });
            var newIds = newItems.map(function (_ref5) {
              var id = _ref5.id;
              return id;
            });
            var newPinnedIds = newItems.filter(function (_ref6) {
              var pinned = _ref6.pinned;
              return pinned;
            }).map(function (_ref7) {
              var id = _ref7.id;
              return id;
            }); // Keep history of all initially pinned results to update the
            // end index of pinned results.

            _this._initialResultIdsPinned = [].concat(_toConsumableArray(_this._initialResultIdsPinned), _toConsumableArray(newPinnedIds));

            _this.setState(function (state) {
              return {
                dataLoadingVisible: false,
                dataMap: _objectSpread(_objectSpread({}, (0, _util.updateDataMap)(state.dataMap, existingFetchedIds, {
                  addedResult: false
                })), (0, _util.resultsDataToMap)(newItems)),
                resultIds: [].concat(_toConsumableArray(state.resultIds), _toConsumableArray(newIds)),
                resultIdsPinned: [].concat(_toConsumableArray(state.resultIdsPinned), _toConsumableArray(newPinnedIds)),
                totalResultsVisibleCount: total,
                visibleCur: state.visibleCur + 1
              };
            }, function () {
              _this._updateDataLoadIndex('pinned', _this._initialResultIdsPinned);
            });
          }).catch(function (error) {
            // Delay showing error message so the user has confirmation
            // when attempting to reload the content after an error.
            setTimeout(function () {

              _this.setState({
                dataLoadingVisible: false,
                displayError: true
              });
            }, 1000);
          });
        });

        _defineProperty(_assertThisInitialized(_this), "_handleFetchResultsDataHidden", function () {
          var _fetchDocuments2;

          _this.setState({
            dataLoadingHidden: true,
            displayError: false
          });

          var _this$context2 = _this.context,
              companyId = _this$context2.companyId,
              namespace = _this$context2.namespace;
          return (0, _api.fetchDocuments)(_this.props.fetchDocumentsHiddenUrl, (_fetchDocuments2 = {}, _defineProperty(_fetchDocuments2, "".concat(namespace, "companyId"), companyId), _defineProperty(_fetchDocuments2, "".concat(namespace, "from"), DELTA * _this.state.hiddenCur), _defineProperty(_fetchDocuments2, "".concat(namespace, "keywords"), _this.props.searchQuery), _defineProperty(_fetchDocuments2, "".concat(namespace, "size"), DELTA), _fetchDocuments2)).then(function (_ref8) {
            var items = _ref8.items,
                total = _ref8.total;
            var fetchedItems = items || {}; // Get already existing results in order to set addedResult
            // property to false in setState.

            var existingFetchedIds = fetchedItems.filter(function (_ref9) {
              var id = _ref9.id;
              return _this.state.resultIds.includes(id);
            }).map(function (_ref10) {
              var id = _ref10.id;
              return id;
            }); // Remove duplicate results from the new list of results to
            // avoid duplicate key errors.

            var newItems = fetchedItems.filter(function (_ref11) {
              var id = _ref11.id;
              return !_this.state.resultIds.includes(id);
            });
            var newIds = newItems.map(function (_ref12) {
              var id = _ref12.id;
              return id;
            }); // Keep history of all initial results, to get the difference
            // for addedResults and for all added/removed hidden/pinned

            _this._initialResultIdsHidden = [].concat(_toConsumableArray(_this._initialResultIdsHidden), _toConsumableArray(newIds));

            _this.setState(function (state) {
              return {
                dataLoadingHidden: false,
                dataMap: _objectSpread(_objectSpread({}, (0, _util.updateDataMap)(state.dataMap, existingFetchedIds, {
                  addedResult: false
                })), (0, _util.resultsDataToMap)(newItems)),
                hiddenCur: state.hiddenCur + 1,
                resultIds: [].concat(_toConsumableArray(state.resultIds), _toConsumableArray(newIds)),
                resultIdsHidden: [].concat(_toConsumableArray(state.resultIdsHidden), _toConsumableArray(newIds)),
                totalResultsHiddenCount: total
              };
            });
          }).catch(function (error) {
            // Delay showing error message so the user has confirmation
            // when attempting to reload the content after an error.
            setTimeout(function () {

              _this.setState({
                dataLoadingHidden: false,
                displayError: true
              });
            }, 1000);
          });
        });

        _defineProperty(_assertThisInitialized(_this), "_handleMove", function (fromIndex, toIndex) {
          if (!(0, _util.isNil)(fromIndex) && !(0, _util.isNil)(toIndex) && fromIndex !== toIndex) {
            _this.setState(function (state) {
              return {
                resultIdsPinned: (0, _util.move)(state.resultIdsPinned, fromIndex, toIndex)
              };
            });
          }
        });

        _defineProperty(_assertThisInitialized(_this), "_handlePublish", function () {
          var _fetchResponse;

          var namespace = _this.context.namespace;
          (0, _api.fetchResponse)(_this.props.validateFormUrl, (_fetchResponse = {}, _defineProperty(_fetchResponse, "".concat(namespace, "aliases"), _this.state.aliases), _defineProperty(_fetchResponse, "".concat(namespace, "inactive"), _this.state.inactive), _defineProperty(_fetchResponse, "".concat(namespace, "keywords"), _this.props.searchQuery), _defineProperty(_fetchResponse, "".concat(namespace, "resultsRankingUid"), _this.props.resultsRankingUid), _fetchResponse)).then(function (response) {
            if (response.errors.length) {
              response.errors.forEach(function (message) {
                Liferay.Util.openToast({
                  message: message,
                  type: 'danger'
                });
              });
            } else {
              _this.setState({
                workflowAction: _this.context.constants.WORKFLOW_ACTION_PUBLISH
              }, function () {
                submitForm(document[_this.props.formName]);
              });
            }
          });
        });

        _defineProperty(_assertThisInitialized(_this), "_handleUpdateAliases", function (keywords) {
          _this.setState({
            aliases: keywords.map(function (_ref13) {
              var value = _ref13.value;
              return value;
            })
          });
        });

        _defineProperty(_assertThisInitialized(_this), "_handleUpdateAddResultIds", function (addedResultsDataList) {
          var mappedData = (0, _util.resultsDataToMap)(addedResultsDataList); // Make sure that all added results that are not part of the original
          // search results get marked as pinned and addedResult.

          var preMappedData = (0, _util.updateDataMap)(mappedData, addedResultsDataList.filter(function (_ref14) {
            var id = _ref14.id;
            return !_this.state.resultIds.includes(id);
          }).map(function (_ref15) {
            var id = _ref15.id;
            return id;
          }), {
            addedResult: true,
            pinned: true
          }); // Make sure that all added results that are part of the original
          // search results get marked with as pinned (not addedResult).

          var newMappedData = (0, _util.updateDataMap)(preMappedData, addedResultsDataList.filter(function (_ref16) {
            var id = _ref16.id;
            return _this.state.resultIds.includes(id);
          }).map(function (_ref17) {
            var id = _ref17.id;
            return id;
          }), {
            pinned: true
          });
          var addedResultsIds = addedResultsDataList.map(function (_ref18) {
            var id = _ref18.id;
            return id;
          });

          _this.setState(function (state) {
            return {
              dataMap: _objectSpread(_objectSpread({}, state.dataMap), newMappedData),
              resultIds: [].concat(_toConsumableArray(state.resultIds), _toConsumableArray(addedResultsIds.filter(function (id) {
                return !state.resultIds.includes(id);
              }))),
              // Remove any results from hidden if they are getting pinned
              // and considered as an addedResult.
              resultIdsHidden: state.resultIdsHidden.filter(function (id) {
                return !addedResultsIds.includes(id);
              }),
              resultIdsPinned: [].concat(_toConsumableArray(addedResultsDataList.filter(function (result) {
                return !state.resultIdsPinned.includes(result.id);
              }).map(function (_ref19) {
                var id = _ref19.id;
                return id;
              })), _toConsumableArray(state.resultIdsPinned))
            };
          });
        });

        _defineProperty(_assertThisInitialized(_this), "_hasMoreData", function (totalCount, cur) {
          var delta = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DELTA;
          return cur * delta < totalCount;
        });

        _defineProperty(_assertThisInitialized(_this), "_isNotPinnedOrHidden", function (id) {
          var _this$state2 = _this.state,
              resultIdsHidden = _this$state2.resultIdsHidden,
              resultIdsPinned = _this$state2.resultIdsPinned;
          return !resultIdsPinned.includes(id) && !resultIdsHidden.includes(id);
        });

        _defineProperty(_assertThisInitialized(_this), "_updateDataLoadIndex", function (property, list) {
          var increment = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DELTA;

          _this.setState(function (_ref20) {
            var dataLoadIndex = _ref20.dataLoadIndex;
            var maxValue = list.length - 1;
            var newValue = dataLoadIndex[property].end + increment;
            return {
              dataLoadIndex: _objectSpread(_objectSpread({}, dataLoadIndex), {}, _defineProperty({}, property, _objectSpread(_objectSpread({}, dataLoadIndex[property]), {}, {
                end: newValue > maxValue ? maxValue : newValue
              })))
            };
          });
        });

        _defineProperty(_assertThisInitialized(_this), "_setActiveTabKeyValue", function (value) {
          _this.setState({
            activeTabKeyValue: value
          });
        });

        _this._initialResultIdsHidden = [];
        _this._initialResultIdsPinned = [];
        return _this;
      }

      _createClass(ResultRankingsForm, [{
        key: "componentDidMount",
        value: function componentDidMount() {
          this._handleFetchResultsDataVisible();

          this._handleFetchResultsDataHidden();
        }
        /**
         * Gets the added changes in hidden from the initial and current states.
         */

      }, {
        key: "render",
        value: function render() {
          var _this2 = this;

          var namespace = this.context.namespace;
          var _this$props = this.props,
              cancelUrl = _this$props.cancelUrl,
              fetchDocumentsSearchUrl = _this$props.fetchDocumentsSearchUrl,
              searchQuery = _this$props.searchQuery;
          var _this$state3 = this.state,
              activeTabKeyValue = _this$state3.activeTabKeyValue,
              aliases = _this$state3.aliases,
              dataLoadIndex = _this$state3.dataLoadIndex,
              dataLoadingHidden = _this$state3.dataLoadingHidden,
              dataLoadingVisible = _this$state3.dataLoadingVisible,
              dataMap = _this$state3.dataMap,
              displayError = _this$state3.displayError,
              displayErrorHidden = _this$state3.displayErrorHidden,
              hiddenCur = _this$state3.hiddenCur,
              inactive = _this$state3.inactive,
              resultIdsHidden = _this$state3.resultIdsHidden,
              resultIdsPinned = _this$state3.resultIdsPinned,
              showDebugger = _this$state3.showDebugger,
              totalResultsHiddenCount = _this$state3.totalResultsHiddenCount,
              totalResultsVisibleCount = _this$state3.totalResultsVisibleCount,
              visibleCur = _this$state3.visibleCur,
              workflowAction = _this$state3.workflowAction;
          return (/*#__PURE__*/_react.default.createElement("div", {
              className: "result-rankings-form-root"
            }, /*#__PURE__*/_react.default.createElement(_HiddenInputs.default, {
              valueMap: {
                aliases: aliases,
                hiddenIdsAdded: this._getHiddenAdded(),
                hiddenIdsRemoved: this._getHiddenRemoved(),
                inactive: inactive,
                pinnedIds: resultIdsPinned,
                pinnedIdsEndIndex: dataLoadIndex.pinned.end,
                pinnedIdsStartIndex: dataLoadIndex.pinned.start,
                workflowAction: workflowAction
              }
            }), /*#__PURE__*/_react.default.createElement(_PageToolbar.default, {
              inactive: inactive,
              onCancel: cancelUrl,
              onChangeActive: this._handleActive,
              onPublish: this._handlePublish
            }), /*#__PURE__*/_react.default.createElement(_layout.default.ContainerFluid, {
              className: "result-rankings-container",
              formSize: "lg"
            }, /*#__PURE__*/_react.default.createElement(_layout.default.Sheet, {
              className: "form-section-header"
            }, /*#__PURE__*/_react.default.createElement("label", null, Liferay.Language.get('query')), /*#__PURE__*/_react.default.createElement("h2", {
              className: "sheet-title"
            }, "".concat(searchQuery)), /*#__PURE__*/_react.default.createElement(_ErrorBoundary.default, {
              component: Liferay.Language.get('aliases'),
              toast: true
            }, /*#__PURE__*/_react.default.createElement(_Alias.default, {
              keywords: aliases,
              onChange: this._handleUpdateAliases
            }))), /*#__PURE__*/_react.default.createElement(_layout.default.Sheet, {
              className: "form-section-body"
            }, /*#__PURE__*/_react.default.createElement("div", {
              className: "results-title sheet-text"
            }, Liferay.Language.get('results')), /*#__PURE__*/_react.default.createElement(_ErrorBoundary.default, null, /*#__PURE__*/_react.default.createElement("div", {
              className: "form-section-results-list"
            }, /*#__PURE__*/_react.default.createElement("nav", {
              "aria-label": Liferay.Language.get('visible-hidden-results'),
              className: "navbar navbar-expand-md navbar-underline navigation-bar navigation-bar-light"
            }, /*#__PURE__*/_react.default.createElement(_tabs.default, {
              className: "navbar-nav"
            }, /*#__PURE__*/_react.default.createElement(_tabs.default.Item, {
              active: activeTabKeyValue === 0,
              "aria-label": Liferay.Language.get('visible-results'),
              onClick: function onClick() {
                return _this2._setActiveTabKeyValue(0);
              },
              role: "tab"
            }, Liferay.Language.get('visible')), /*#__PURE__*/_react.default.createElement(_tabs.default.Item, {
              active: activeTabKeyValue === 1,
              "aria-label": Liferay.Language.get('hidden-results'),
              onClick: function onClick() {
                return _this2._setActiveTabKeyValue(1);
              },
              role: "tab"
            }, Liferay.Language.get('hidden')))), /*#__PURE__*/_react.default.createElement(_tabs.default.Content, {
              activeIndex: activeTabKeyValue
            }, /*#__PURE__*/_react.default.createElement(_tabs.default.TabPane, null, /*#__PURE__*/_react.default.createElement(_List.default, {
              dataLoading: dataLoadingVisible,
              dataMap: dataMap,
              displayError: displayError,
              fetchDocumentsSearchUrl: fetchDocumentsSearchUrl,
              onAddResultSubmit: this._handleUpdateAddResultIds,
              onClickHide: this._handleClickHide,
              onClickPin: this._handleClickPin,
              onLoadResults: this._handleFetchResultsDataVisible,
              onMove: this._handleMove,
              resultIds: this._getResultIdsVisible(),
              resultIdsPinned: this.state.resultIdsPinned,
              showLoadMore: this._hasMoreData(totalResultsVisibleCount, visibleCur)
            })), /*#__PURE__*/_react.default.createElement(_tabs.default.TabPane, null, /*#__PURE__*/_react.default.createElement(_List.default, {
              dataLoading: dataLoadingHidden,
              dataMap: dataMap,
              displayError: displayErrorHidden,
              onClickHide: this._handleClickHide,
              onClickPin: this._handleClickPin,
              onLoadResults: this._handleFetchResultsDataHidden,
              resultIds: resultIdsHidden,
              showLoadMore: this._hasMoreData(totalResultsHiddenCount, hiddenCur)
            }))))))), showDebugger && /*#__PURE__*/_react.default.createElement(_FormValueDebugger.default, {
              values: [{
                name: "".concat(namespace, "aliases"),
                value: aliases
              }, {
                name: "".concat(namespace, "hiddenIdsAdded"),
                value: this._getHiddenAdded()
              }, {
                name: "".concat(namespace, "hiddenIdsRemoved"),
                value: this._getHiddenRemoved()
              }, {
                name: "".concat(namespace, "pinnedIds"),
                value: resultIdsPinned
              }, {
                name: "".concat(namespace, "pinnedIdsEndIndex"),
                value: dataLoadIndex.pinned.end
              }, {
                name: "".concat(namespace, "pinnedIdsStartIndex"),
                value: dataLoadIndex.pinned.start
              }, {
                name: "".concat(namespace, "workflowAction"),
                value: workflowAction
              }]
            }))
          );
        }
      }]);

      return ResultRankingsForm;
    }(_react.Component);

    _defineProperty(ResultRankingsForm, "contextType", _ThemeContext.default);

    _defineProperty(ResultRankingsForm, "defaultProps", {
      initialAliases: []
    });

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