Liferay.Loader.define("layout-content-page-editor-web@2.0.170/page_editor/plugins/experience/index", ['module', 'exports', 'require', 'frontend-js-react-web$react', '../../core/AppContext', './components/ExperienceToolbarSection', './reducers/index'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.default = void 0;

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

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

    var _ExperienceToolbarSection = _interopRequireDefault(require("./components/ExperienceToolbarSection"));

    var _index = _interopRequireDefault(require("./reducers/index"));

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

    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 renderExperiencesSection() {
      var Component = this.Component;
      var selectId = "".concat(this.toolbarId, "_").concat(this.toolbarPluginId);
      return (/*#__PURE__*/_react.default.createElement(Component, null, /*#__PURE__*/_react.default.createElement(_ExperienceToolbarSection.default, {
          selectId: selectId
        }))
      );
    }
    /**
     * Entry-point for "Experience" (toolbar drop-down) functionality.
     */

    var Experience = /*#__PURE__*/function () {
      function Experience(_ref) {
        var app = _ref.app,
            toolbarPlugin = _ref.toolbarPlugin;

        _classCallCheck(this, Experience);

        this.Actions = app.Actions;
        this.Component = (0, _AppContext.Component)(app);
        this.dispatch = app.dispatch;
        this.toolbarId = app.config.toolbarId;
        this.toolbarPluginId = toolbarPlugin.toolbarPluginId;

        if (app.store.availableSegmentsExperiences !== undefined && app.store.availableSegmentsExperiences !== null && app.config.singleSegmentsExperienceMode !== true) {
          this.activate = experiencesActivate.bind(this);
          this.renderToolbarSection = renderExperiencesSection.bind(this);
        }
      }

      _createClass(Experience, [{
        key: "deactivate",
        value: function deactivate() {
          this.dispatch(this.Actions.unloadReducer(Experience.name));
        }
      }]);

      return Experience;
    }();

    exports.default = Experience;

    function experiencesActivate() {
      this.dispatch(this.Actions.loadReducer(_index.default, Experience.name));
    }
    //# sourceMappingURL=index.js.map
  }
});
//# sourceMappingURL=index.js.map