Liferay.Loader.define("asset-taglib@5.4.12/asset_categories_selector/AssetCategoriesSelector.es", ['module', 'exports', 'require', 'frontend-js-react-web$prop-types', 'frontend-js-react-web$react', './AssetVocabularyCategoriesSelector.es'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.default = void 0;

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

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

    var _AssetVocabularyCategoriesSelector = _interopRequireDefault(require("./AssetVocabularyCategoriesSelector.es"));

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

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

    function AssetCategoriesSelector(_ref) {
      var className = _ref.className,
          eventName = _ref.eventName,
          groupIds = _ref.groupIds,
          id = _ref.id,
          inputName = _ref.inputName,
          onVocabulariesChange = _ref.onVocabulariesChange,
          portletURL = _ref.portletURL,
          useFallbackInput = _ref.useFallbackInput,
          _ref$vocabularies = _ref.vocabularies,
          vocabularies = _ref$vocabularies === void 0 ? [] : _ref$vocabularies;
      return (/*#__PURE__*/_react.default.createElement("div", {
          id: id,
          class: className
        }, vocabularies.map(function (vocabulary, index) {
          var label = vocabulary.group ? "".concat(vocabulary.title, " (").concat(vocabulary.group, ")") : vocabulary.title;
          var vocabularyInputName = inputName + vocabulary.id;
          return (/*#__PURE__*/_react.default.createElement(_AssetVocabularyCategoriesSelector.default, {
              eventName: eventName,
              groupIds: groupIds,
              id: "namespace_assetCategoriesSelector_".concat(vocabulary.id),
              inputName: vocabularyInputName,
              key: vocabulary.id,
              label: label,
              onSelectedItemsChange: function onSelectedItemsChange(selectedItems) {
                var newVocabulary = _objectSpread(_objectSpread({}, vocabulary), {}, {
                  selectedItems: selectedItems
                });

                onVocabulariesChange([].concat(_toConsumableArray(vocabularies.slice(0, index)), [newVocabulary], _toConsumableArray(vocabularies.slice(index + 1))));
              },
              portletURL: portletURL,
              required: vocabulary.required,
              selectedItems: vocabulary.selectedItems,
              singleSelect: vocabulary.singleSelect,
              sourceItemsVocabularyIds: [vocabulary.id],
              useFallbackInput: useFallbackInput
            })
          );
        }))
      );
    }

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