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 _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, 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; }

import React from "react";
import { arrayOf, func, node, shape } from "prop-types";
import DeckGL from "deck.gl";
import MultiPathMap from "./MultiPathMap";
import MultiScatterPlotMap from "./MultiScatterPlotMap";
import MultiScreenGridMap from "./MultiScreenGridMap";
import MultiIconMap from "./MultiIconMap";
import MultiSmallPolygonMap from "./MultiSmallPolygonMap";
import MultiChoroplethMap from "./MultiChoroplethMap";
import VectorTilesMap from "../VectorTilesMap/VectorTilesMap";

var MultiLayerMap = function MultiLayerMap(props) {
  var viewport = props.viewport,
      mapLayers = props.mapLayers,
      children = props.children,
      getCursor = props.getCursor,
      onHoverSlide = props.onHoverSlide,
      onLayerClick = props.onLayerClick,
      selectedFoundationDatum = props.selectedFoundationDatum;
  var renderMaps = mapLayers.map(function (layerData, index) {
    var mapType = layerData.mapType;
    return mapType === "PathMap" ? MultiPathMap(_objectSpread({}, layerData, {
      id: mapType + index,
      index: index,
      onHoverSlide: onHoverSlide
    })) : mapType === "ScatterPlotMap" ? MultiScatterPlotMap(_objectSpread({}, layerData, {
      id: mapType + index,
      index: index,
      onHoverSlide: onHoverSlide
    })) : mapType === "ScreenGridMap" ? MultiScreenGridMap(_objectSpread({}, layerData, {
      id: mapType + index,
      index: index
    })) : mapType === "IconMap" ? MultiIconMap(_objectSpread({}, layerData, {
      id: mapType + index,
      index: index,
      onHoverSlide: onHoverSlide,
      viewport: viewport
    })) : mapType === "SmallPolygonMap" ? MultiSmallPolygonMap(_objectSpread({}, layerData, {
      id: mapType + index,
      index: index,
      onHoverSlide: onHoverSlide,
      viewport: viewport
    })) : mapType === "ChoroplethMap" ? MultiChoroplethMap(_objectSpread({}, layerData, {
      id: mapType + index,
      index: index,
      onHoverSlide: onHoverSlide,
      onLayerClick: onLayerClick,
      selectedFoundationDatum: selectedFoundationDatum
    })) : mapType === "VectorTilesMap" || mapType === "vtChoroplethMap" || mapType === "vtScatterPlotMap" ? React.createElement(VectorTilesMap, _extends({}, layerData, {
      key: layerData.vectorTilesID,
      index: index
    })) : null;
  });
  return React.createElement(DeckGL, _extends({
    className: "DeckGL-Map-Layer",
    getCursor: getCursor
  }, viewport), renderMaps, children);
};

MultiLayerMap.propTypes = {
  viewport: shape({}),
  mapLayers: arrayOf(shape({})).isRequired,
  onHoverSlide: func,
  onLayerClick: func,
  getCursor: func,
  children: node,
  selectedFoundationDatum: shape({})
};
MultiLayerMap.defaultProps = {
  getCursor: function getCursor() {
    return "crosshair";
  }
};
export default MultiLayerMap;