function _templateObject() {
  var data = _taggedTemplateLiteral(["\n  font-family: Helvetica, Arial, sans-serif;\n  font-size: 16px;\n  position: absolute;\n  padding: 4px;\n  margin: 8px;\n  background: rgba(0, 0, 0, 0.75);\n  color: #fff;\n  max-width: 250px;\n  z-index: 9;\n  pointer-events: none;\n"]);

  _templateObject = function _templateObject() {
    return data;
  };

  return data;
}

function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }

import { string, number, arrayOf, oneOfType, shape } from "prop-types";
import { jsx, css } from "@emotion/core";
import { get } from "lodash";
import shortid from "shortid";
import window from "global/window";
var tooltip = css(_templateObject());

var MapTooltip = function MapTooltip(props) {
  var tooltipData = props.tooltipData;
  var x = tooltipData.x;
  var y = tooltipData.y;
  var xPosition = x < get(window, "innerWidth", 1000) * 0.66 ? x : x - get(window, "innerWidth", 1000) * 0.1;
  var yPostition = y < 375 ? y : y - 50;
  var tooltipContent = tooltipData.content.map(function (obj) {
    var value = obj.value ? obj.value : "No Data Available";
    return jsx("div", {
      key: shortid.generate()
    }, "".concat(obj.name, ": ").concat(value.toLocaleString()));
  });
  return jsx("div", {
    css: tooltip,
    style: {
      left: xPosition,
      top: yPostition
    }
  }, tooltipContent);
};

MapTooltip.propTypes = {
  tooltipData: shape({
    x: number,
    y: number,
    content: arrayOf(shape({
      name: string,
      value: oneOfType([number, string])
    }))
  })
};
export default MapTooltip;