"use strict";

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

var _routeViewerOverlay = _interopRequireDefault(require("@opentripplanner/route-viewer-overlay"));

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

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

// connect to the redux store
const mapStateToProps = (state, ownProps) => {
  const viewedRoute = state.otp.ui.viewedRoute;
  const routeData = viewedRoute && state.otp.transitIndex.routes ? state.otp.transitIndex.routes[viewedRoute.routeId] : null;
  let filteredPatterns = routeData === null || routeData === void 0 ? void 0 : routeData.patterns; // If a pattern is selected, hide all other patterns

  if ((viewedRoute === null || viewedRoute === void 0 ? void 0 : viewedRoute.patternId) && (routeData === null || routeData === void 0 ? void 0 : routeData.patterns)) {
    filteredPatterns = {
      [viewedRoute.patternId]: routeData.patterns[viewedRoute.patternId]
    };
  }

  return {
    routeData: { ...routeData,
      patterns: filteredPatterns
    }
  };
};

const mapDispatchToProps = {};

var _default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(_routeViewerOverlay.default);

exports.default = _default;
module.exports = exports.default;

//# sourceMappingURL=connected-route-viewer-overlay.js