Liferay.Loader.define("app-builder-web@1.0.73/js/pages/apps/index.es", ['module', 'exports', 'require', '@frontend-taglib-clay$clayui/modal', 'frontend-js-react-web$react', 'app-builder-web$react-router-dom', '../../AppContext.es', '../../hooks/useLazy.es', './ListAppsTabs.es'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.default = void 0;

    var _modal = require("@frontend-taglib-clay$clayui/modal");

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

    var _reactRouterDom = require("app-builder-web$react-router-dom");

    var _AppContext = require("../../AppContext.es");

    var _useLazy = _interopRequireDefault(require("../../hooks/useLazy.es"));

    var _ListAppsTabs = _interopRequireDefault(require("./ListAppsTabs.es"));

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

    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 _default = function _default(props) {
      var appsTabs = props.appsTabs;
      var appsTabsKeys = Object.keys(appsTabs);
      var EditPage = (0, _useLazy.default)();

      var appProps = _objectSpread({
        appsTabsKeys: appsTabsKeys
      }, props);

      var editRoutes = appsTabsKeys.map(function (scope) {
        appsTabs[scope] = _objectSpread(_objectSpread({}, appsTabs[scope]), {}, {
          editPath: ["/".concat(scope, "/:dataDefinitionId(\\d+)?/deploy"), "/".concat(scope, "/:dataDefinitionId(\\d+)?/:appId(\\d+)")],
          scope: scope
        });
        var _appsTabs$scope = appsTabs[scope],
            editEntryPoint = _appsTabs$scope.editEntryPoint,
            editPath = _appsTabs$scope.editPath;
        return {
          component: function component(props) {
            return (/*#__PURE__*/_react.default.createElement(EditPage, {
                module: editEntryPoint,
                props: _objectSpread({
                  scope: scope
                }, props)
              })
            );
          },
          path: editPath
        };
      });
      return (/*#__PURE__*/_react.default.createElement("div", {
          className: "app-builder-root"
        }, /*#__PURE__*/_react.default.createElement(_AppContext.AppContextProvider, appProps, /*#__PURE__*/_react.default.createElement(_modal.ClayModalProvider, null, /*#__PURE__*/_react.default.createElement(_reactRouterDom.HashRouter, null, /*#__PURE__*/_react.default.createElement(_reactRouterDom.Switch, null, editRoutes.map(function (route, index) {
          return (/*#__PURE__*/_react.default.createElement(_reactRouterDom.Route, _extends({
              key: index
            }, route))
          );
        }), /*#__PURE__*/_react.default.createElement(_reactRouterDom.Route, {
          component: _ListAppsTabs.default,
          path: "/:tab?"
        }))))))
      );
    };

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