"use strict";

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

var _propTypes = _interopRequireDefault(require("prop-types"));

var _react = _interopRequireDefault(require("react"));

var _deck = _interopRequireWildcard(require("deck.gl"));

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }

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); }

var ScreenGridMap = function ScreenGridMap(props) {
  var viewport = props.viewport,
      data = props.data,
      getPosition = props.getPosition,
      opacity = props.opacity,
      colorRange = props.colorRange,
      cellSizePixels = props.cellSizePixels,
      autoHighlight = props.autoHighlight,
      onLayerClick = props.onLayerClick,
      visible = props.visible,
      gpuAggregation = props.gpuAggregation;
  return _react["default"].createElement("div", null, _react["default"].createElement(_deck["default"], _extends({
    className: "DeckGL"
  }, viewport), _react["default"].createElement(_deck.ScreenGridLayer, {
    id: "screengrid-layer",
    className: "ScreenGridMap",
    pickable: true,
    data: data,
    getPosition: getPosition,
    opacity: opacity,
    colorRange: colorRange,
    cellSizePixels: cellSizePixels,
    autoHighlight: autoHighlight,
    onClick: onLayerClick,
    updateTriggers: {
      instanceColors: colorRange
    },
    visible: visible,
    gpuAggregation: gpuAggregation
  })));
};

ScreenGridMap.propTypes = {
  viewport: _propTypes["default"].shape({}),
  data: _propTypes["default"].arrayOf(_propTypes["default"].shape({})).isRequired,
  getPosition: _propTypes["default"].func,
  opacity: _propTypes["default"].number,
  colorRange: _propTypes["default"].arrayOf(_propTypes["default"].arrayOf(_propTypes["default"].number)),
  cellSizePixels: _propTypes["default"].number,
  autoHighlight: _propTypes["default"].bool,
  onLayerClick: _propTypes["default"].func,
  visible: _propTypes["default"].bool,
  gpuAggregation: _propTypes["default"].bool
};
ScreenGridMap.defaultProps = {
  getPosition: function getPosition(d) {
    return d.geometry.coordinates;
  },
  opacity: 0.8,
  colorRange: [[255, 255, 204], [161, 218, 180], [65, 182, 196], [34, 94, 168]],
  cellSizePixels: 25,
  autoHighlight: true,
  visible: true,
  gpuAggregation: false
};
var _default = ScreenGridMap;
exports["default"] = _default;