"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.mapDispatch = mapDispatch;
exports.default = void 0;

var _reselect = require("reselect");

var _redux = require("redux");

var _reactRedux = require("react-redux");

var _components = require("@patternplate/components");

var _pool = require("../selectors/pool");

var _actions = require("../actions");

const selectWidgetSrc = (0, _reselect.createSelector)(state => state.staticBase, (staticBase, manifest) => `${staticBase}/widgets.js`);
const selectThemes = (0, _reselect.createSelector)(state => state.config.ui, ui => _components.themes.getThemes(ui));

function mapProps(state) {
  const location = state.routing.locationBeforeTransitions;
  return {
    base: state.base,
    hash: location.hash,
    pathname: location.pathname,
    query: location.query,
    widgetSrc: selectWidgetSrc(state),
    widgetState: {
      themes: selectThemes(state),
      base: state.base,
      pool: (0, _pool.flat)(state)
    }
  };
}

function mapDispatch(dispatch) {
  return (0, _redux.bindActionCreators)({
    scrollTo: _actions.scrollTo
  }, dispatch);
}

var _default = (0, _reactRedux.connect)(mapProps, mapDispatch)(_components.Markdown);

exports.default = _default;
//# sourceMappingURL=markdown.js.map