Liferay.Loader.define("depot-web@1.0.90/js/ConnectedSiteDropdownPropsTransformer", ['module', 'exports', 'require', 'frontend-js-web'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.default = propsTransformer;

    var _frontendJsWeb = require("frontend-js-web");

    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 _objectWithoutProperties(source, excluded) {
      if (source == null) return {};var target = _objectWithoutPropertiesLoose(source, excluded);var key, i;if (Object.getOwnPropertySymbols) {
        var sourceSymbolKeys = Object.getOwnPropertySymbols(source);for (i = 0; i < sourceSymbolKeys.length; i++) {
          key = sourceSymbolKeys[i];if (excluded.indexOf(key) >= 0) continue;if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;target[key] = source[key];
        }
      }return target;
    }

    function _objectWithoutPropertiesLoose(source, excluded) {
      if (source == null) return {};var target = {};var sourceKeys = Object.keys(source);var key, i;for (i = 0; i < sourceKeys.length; i++) {
        key = sourceKeys[i];if (excluded.indexOf(key) >= 0) continue;target[key] = source[key];
      }return target;
    }

    var ACTIONS = {
      disconnect: function disconnect(_ref) {
        var disconnectSiteActionURL = _ref.url;

        if (confirm(Liferay.Language.get('removing-this-site-connection-will-not-allow-the-site-to-consume-data-from-this-asset-library-directly'))) {
          submitForm(document.hrefFm, disconnectSiteActionURL);
        }
      },
      shareWebContentStructures: function shareWebContentStructures(_ref2) {
        var shared = _ref2.shared,
            updateDDMStructuresAvailableActionURL = _ref2.url;
        var message = shared ? Liferay.Language.get('after-disabling-structure-and-document-type-sharing,-any-site-content-that-uses-the-structures-or-document-types-will-be-invalid.-do-you-want-to-disable-structure-and-document-type-sharing') : Liferay.Language.get('you-will-not-be-able-to-disconnect-this-site-when-structure-and-document-type-sharing-is-enabled.-in-order-to-disconnect-this-site-from-this-asset-library,-you-must-disable-structure-and-document-type-sharing-first');

        if (confirm(message)) {
          (0, _frontendJsWeb.navigate)(updateDDMStructuresAvailableActionURL);
        }
      }
    };

    function propsTransformer(_ref3) {
      var items = _ref3.items,
          otherProps = _objectWithoutProperties(_ref3, ["items"]);

      return _objectSpread(_objectSpread({}, otherProps), {}, {
        items: items.map(function (item) {
          return _objectSpread(_objectSpread({}, item), {}, {
            onClick: function onClick(event) {
              var _item$data;

              var action = (_item$data = item.data) === null || _item$data === void 0 ? void 0 : _item$data.action;

              if (action) {
                event.preventDefault();
                ACTIONS[action](item.data);
              }
            }
          });
        })
      });
    }
    //# sourceMappingURL=ConnectedSiteDropdownPropsTransformer.js.map
  }
});
//# sourceMappingURL=ConnectedSiteDropdownPropsTransformer.js.map