Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-simple-maps

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-simple-maps - npm Package Compare versions

Comparing version 4.0.0-beta.1 to 4.0.0-beta.2

600

dist/index.es.js

@@ -8,5 +8,31 @@ import React, { createContext, useMemo, useCallback, useContext, forwardRef, useState, useEffect, memo, useRef, Fragment } from 'react';

function _iterableToArrayLimit(arr, i) {
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
if (null != _i) {
var _s,
_e,
_x,
_r,
_arr = [],
_n = !0,
_d = !1;
try {
if (_x = (_i = _i.call(arr)).next, 0 === i) {
if (Object(_i) !== _i) return;
_n = !1;
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
} catch (err) {
_d = !0, _e = err;
} finally {
try {
if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return;
} finally {
if (_d) throw _e;
}
}
return _arr;
}
}
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {

@@ -18,6 +44,4 @@ var symbols = Object.getOwnPropertySymbols(object);

}
return keys;
}
function _objectSpread2(target) {

@@ -32,6 +56,4 @@ for (var i = 1; i < arguments.length; i++) {

}
return target;
}
function _typeof(obj) {

@@ -46,4 +68,4 @@ "@babel/helpers - typeof";

}
function _defineProperty(obj, key, value) {
key = _toPropertyKey(key);
if (key in obj) {

@@ -59,6 +81,4 @@ Object.defineProperty(obj, key, {

}
return obj;
}
function _extends() {

@@ -68,3 +88,2 @@ _extends = Object.assign ? Object.assign.bind() : function (target) {

var source = arguments[i];
for (var key in source) {

@@ -76,3 +95,2 @@ if (Object.prototype.hasOwnProperty.call(source, key)) {

}
return target;

@@ -82,3 +100,2 @@ };

}
function _objectWithoutPropertiesLoose(source, excluded) {

@@ -89,3 +106,2 @@ if (source == null) return {};

var key, i;
for (i = 0; i < sourceKeys.length; i++) {

@@ -96,16 +112,10 @@ key = sourceKeys[i];

}
return target;
}
function _objectWithoutProperties(source, excluded) {
if (source == null) return {};
var target = _objectWithoutPropertiesLoose(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {

@@ -118,44 +128,10 @@ key = sourceSymbolKeys[i];

}
return target;
}
function _slicedToArray(arr, i) {
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
}
function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
function _iterableToArrayLimit(arr, i) {
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
if (_i == null) return;
var _arr = [];
var _n = true;
var _d = false;
var _s, _e;
try {
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
if (i && _arr.length === i) break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i["return"] != null) _i["return"]();
} finally {
if (_d) throw _e;
}
}
return _arr;
}
function _unsupportedIterableToArray(o, minLen) {

@@ -169,31 +145,38 @@ if (!o) return;

}
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _toPrimitive(input, hint) {
if (typeof input !== "object" || input === null) return input;
var prim = input[Symbol.toPrimitive];
if (prim !== undefined) {
var res = prim.call(input, hint || "default");
if (typeof res !== "object") return res;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (hint === "string" ? String : Number)(input);
}
function _toPropertyKey(arg) {
var key = _toPrimitive(arg, "string");
return typeof key === "symbol" ? key : String(key);
}
var _excluded$a = ["width", "height", "projection", "projectionConfig"];
var geoPath = d3Geo.geoPath,
projections = _objectWithoutProperties(d3Geo, ["geoPath"]);
projections = _objectWithoutProperties(d3Geo, ["geoPath"]);
var MapContext = createContext();
var makeProjection = function makeProjection(_ref) {
var _ref$projectionConfig = _ref.projectionConfig,
projectionConfig = _ref$projectionConfig === void 0 ? {} : _ref$projectionConfig,
_ref$projection = _ref.projection,
projection = _ref$projection === void 0 ? "geoEqualEarth" : _ref$projection,
_ref$width = _ref.width,
width = _ref$width === void 0 ? 800 : _ref$width,
_ref$height = _ref.height,
height = _ref$height === void 0 ? 600 : _ref$height;
projectionConfig = _ref$projectionConfig === void 0 ? {} : _ref$projectionConfig,
_ref$projection = _ref.projection,
projection = _ref$projection === void 0 ? "geoEqualEarth" : _ref$projection,
_ref$width = _ref.width,
width = _ref$width === void 0 ? 800 : _ref$width,
_ref$height = _ref.height,
height = _ref$height === void 0 ? 600 : _ref$height;
var isFunc = typeof projection === "function";

@@ -209,26 +192,21 @@ if (isFunc) return projection;

};
var MapProvider = function MapProvider(_ref2) {
var width = _ref2.width,
height = _ref2.height,
projection = _ref2.projection,
projectionConfig = _ref2.projectionConfig,
restProps = _objectWithoutProperties(_ref2, _excluded$a);
height = _ref2.height,
projection = _ref2.projection,
projectionConfig = _ref2.projectionConfig,
restProps = _objectWithoutProperties(_ref2, _excluded$a);
var _ref3 = projectionConfig.center || [],
_ref4 = _slicedToArray(_ref3, 2),
cx = _ref4[0],
cy = _ref4[1];
_ref4 = _slicedToArray(_ref3, 2),
cx = _ref4[0],
cy = _ref4[1];
var _ref5 = projectionConfig.rotate || [],
_ref6 = _slicedToArray(_ref5, 3),
rx = _ref6[0],
ry = _ref6[1],
rz = _ref6[2];
_ref6 = _slicedToArray(_ref5, 3),
rx = _ref6[0],
ry = _ref6[1],
rz = _ref6[2];
var _ref7 = projectionConfig.parallels || [],
_ref8 = _slicedToArray(_ref7, 2),
p1 = _ref8[0],
p2 = _ref8[1];
_ref8 = _slicedToArray(_ref7, 2),
p1 = _ref8[0],
p2 = _ref8[1];
var s = projectionConfig.scale || null;

@@ -261,3 +239,2 @@ var projMemo = useMemo(function () {

};
MapProvider.propTypes = {

@@ -269,3 +246,2 @@ width: PropTypes.number,

};
var useMapContext = function useMapContext() {

@@ -278,13 +254,12 @@ return useContext(MapContext);

var _ref$width = _ref.width,
width = _ref$width === void 0 ? 800 : _ref$width,
_ref$height = _ref.height,
height = _ref$height === void 0 ? 600 : _ref$height,
_ref$projection = _ref.projection,
projection = _ref$projection === void 0 ? "geoEqualEarth" : _ref$projection,
_ref$projectionConfig = _ref.projectionConfig,
projectionConfig = _ref$projectionConfig === void 0 ? {} : _ref$projectionConfig,
_ref$className = _ref.className,
className = _ref$className === void 0 ? "" : _ref$className,
restProps = _objectWithoutProperties(_ref, _excluded$9);
width = _ref$width === void 0 ? 800 : _ref$width,
_ref$height = _ref.height,
height = _ref$height === void 0 ? 600 : _ref$height,
_ref$projection = _ref.projection,
projection = _ref$projection === void 0 ? "geoEqualEarth" : _ref$projection,
_ref$projectionConfig = _ref.projectionConfig,
projectionConfig = _ref$projectionConfig === void 0 ? {} : _ref$projectionConfig,
_ref$className = _ref.className,
className = _ref$className === void 0 ? "" : _ref$className,
restProps = _objectWithoutProperties(_ref, _excluded$9);
return /*#__PURE__*/React.createElement(MapProvider, {

@@ -320,3 +295,2 @@ width: width,

}
return res.json();

@@ -329,7 +303,5 @@ })["catch"](function (error) {

var isTopojson = geographies.type === "Topology";
if (!isTopojson) {
return parseGeographies ? parseGeographies(geographies.features || geographies) : geographies.features || geographies;
}
var feats = feature(geographies, geographies.objects[Object.keys(geographies.objects)[0]]).features;

@@ -387,16 +359,12 @@ return parseGeographies ? parseGeographies(feats) : feats;

var geography = _ref.geography,
parseGeographies = _ref.parseGeographies;
parseGeographies = _ref.parseGeographies;
var _useContext = useContext(MapContext),
path = _useContext.path;
path = _useContext.path;
var _useState = useState({}),
_useState2 = _slicedToArray(_useState, 2),
output = _useState2[0],
setOutput = _useState2[1];
_useState2 = _slicedToArray(_useState, 2),
output = _useState2[0],
setOutput = _useState2[1];
useEffect(function () {
if ((typeof window === "undefined" ? "undefined" : _typeof(window)) === "undefined") return;
if (!geography) return;
if (isString(geography)) {

@@ -418,16 +386,14 @@ fetchGeographies(geography).then(function (geos) {

}, [geography, parseGeographies]);
var _useMemo = useMemo(function () {
var mesh = output.mesh || {};
var preparedMesh = prepareMesh(mesh.outline, mesh.borders, path);
return {
geographies: prepareFeatures(output.geographies, path),
outline: preparedMesh.outline,
borders: preparedMesh.borders
};
}, [output, path]),
geographies = _useMemo.geographies,
outline = _useMemo.outline,
borders = _useMemo.borders;
var mesh = output.mesh || {};
var preparedMesh = prepareMesh(mesh.outline, mesh.borders, path);
return {
geographies: prepareFeatures(output.geographies, path),
outline: preparedMesh.outline,
borders: preparedMesh.borders
};
}, [output, path]),
geographies = _useMemo.geographies,
outline = _useMemo.outline,
borders = _useMemo.borders;
return {

@@ -443,20 +409,17 @@ geographies: geographies,

var geography = _ref.geography,
children = _ref.children,
parseGeographies = _ref.parseGeographies,
_ref$className = _ref.className,
className = _ref$className === void 0 ? "" : _ref$className,
restProps = _objectWithoutProperties(_ref, _excluded$8);
children = _ref.children,
parseGeographies = _ref.parseGeographies,
_ref$className = _ref.className,
className = _ref$className === void 0 ? "" : _ref$className,
restProps = _objectWithoutProperties(_ref, _excluded$8);
var _useContext = useContext(MapContext),
path = _useContext.path,
projection = _useContext.projection;
path = _useContext.path,
projection = _useContext.projection;
var _useGeographies = useGeographies({
geography: geography,
parseGeographies: parseGeographies
}),
geographies = _useGeographies.geographies,
outline = _useGeographies.outline,
borders = _useGeographies.borders;
geography: geography,
parseGeographies: parseGeographies
}),
geographies = _useGeographies.geographies,
outline = _useGeographies.outline,
borders = _useGeographies.borders;
return /*#__PURE__*/React.createElement("g", _extends({

@@ -484,24 +447,21 @@ ref: ref,

var geography = _ref.geography,
onMouseEnter = _ref.onMouseEnter,
onMouseLeave = _ref.onMouseLeave,
onMouseDown = _ref.onMouseDown,
onMouseUp = _ref.onMouseUp,
onFocus = _ref.onFocus,
onBlur = _ref.onBlur,
_ref$style = _ref.style,
style = _ref$style === void 0 ? {} : _ref$style,
_ref$className = _ref.className,
className = _ref$className === void 0 ? "" : _ref$className,
restProps = _objectWithoutProperties(_ref, _excluded$7);
onMouseEnter = _ref.onMouseEnter,
onMouseLeave = _ref.onMouseLeave,
onMouseDown = _ref.onMouseDown,
onMouseUp = _ref.onMouseUp,
onFocus = _ref.onFocus,
onBlur = _ref.onBlur,
_ref$style = _ref.style,
style = _ref$style === void 0 ? {} : _ref$style,
_ref$className = _ref.className,
className = _ref$className === void 0 ? "" : _ref$className,
restProps = _objectWithoutProperties(_ref, _excluded$7);
var _useState = useState(false),
_useState2 = _slicedToArray(_useState, 2),
isPressed = _useState2[0],
setPressed = _useState2[1];
_useState2 = _slicedToArray(_useState, 2),
isPressed = _useState2[0],
setPressed = _useState2[1];
var _useState3 = useState(false),
_useState4 = _slicedToArray(_useState3, 2),
isFocused = _useState4[0],
setFocus = _useState4[1];
_useState4 = _slicedToArray(_useState3, 2),
isFocused = _useState4[0],
setFocus = _useState4[1];
function handleMouseEnter(evt) {

@@ -511,3 +471,2 @@ setFocus(true);

}
function handleMouseLeave(evt) {

@@ -518,3 +477,2 @@ setFocus(false);

}
function handleFocus(evt) {

@@ -524,3 +482,2 @@ setFocus(true);

}
function handleBlur(evt) {

@@ -531,3 +488,2 @@ setFocus(false);

}
function handleMouseDown(evt) {

@@ -537,3 +493,2 @@ setPressed(true);

}
function handleMouseUp(evt) {

@@ -543,3 +498,2 @@ setPressed(false);

}
return /*#__PURE__*/React.createElement("path", _extends({

@@ -576,14 +530,12 @@ ref: ref,

var _ref$fill = _ref.fill,
fill = _ref$fill === void 0 ? "transparent" : _ref$fill,
_ref$stroke = _ref.stroke,
stroke = _ref$stroke === void 0 ? "currentcolor" : _ref$stroke,
_ref$step = _ref.step,
step = _ref$step === void 0 ? [10, 10] : _ref$step,
_ref$className = _ref.className,
className = _ref$className === void 0 ? "" : _ref$className,
restProps = _objectWithoutProperties(_ref, _excluded$6);
fill = _ref$fill === void 0 ? "transparent" : _ref$fill,
_ref$stroke = _ref.stroke,
stroke = _ref$stroke === void 0 ? "currentcolor" : _ref$stroke,
_ref$step = _ref.step,
step = _ref$step === void 0 ? [10, 10] : _ref$step,
_ref$className = _ref.className,
className = _ref$className === void 0 ? "" : _ref$className,
restProps = _objectWithoutProperties(_ref, _excluded$6);
var _useContext = useContext(MapContext),
path = _useContext.path;
path = _useContext.path;
return /*#__PURE__*/React.createElement("path", _extends({

@@ -614,8 +566,6 @@ ref: ref,

};
var ZoomPanProvider = function ZoomPanProvider(_ref) {
var _ref$value = _ref.value,
value = _ref$value === void 0 ? defaultValue : _ref$value,
restProps = _objectWithoutProperties(_ref, _excluded$5);
value = _ref$value === void 0 ? defaultValue : _ref$value,
restProps = _objectWithoutProperties(_ref, _excluded$5);
return /*#__PURE__*/React.createElement(ZoomPanContext.Provider, _extends({

@@ -625,3 +575,2 @@ value: value

};
ZoomPanProvider.propTypes = {

@@ -633,3 +582,2 @@ x: PropTypes.number,

};
var useZoomPanContext = function useZoomPanContext() {

@@ -641,31 +589,27 @@ return useContext(ZoomPanContext);

var center = _ref.center,
filterZoomEvent = _ref.filterZoomEvent,
onMoveStart = _ref.onMoveStart,
onMoveEnd = _ref.onMoveEnd,
onMove = _ref.onMove,
_ref$translateExtent = _ref.translateExtent,
translateExtent = _ref$translateExtent === void 0 ? [[-Infinity, -Infinity], [Infinity, Infinity]] : _ref$translateExtent,
_ref$scaleExtent = _ref.scaleExtent,
scaleExtent = _ref$scaleExtent === void 0 ? [1, 8] : _ref$scaleExtent,
_ref$zoom = _ref.zoom,
zoom = _ref$zoom === void 0 ? 1 : _ref$zoom;
filterZoomEvent = _ref.filterZoomEvent,
onMoveStart = _ref.onMoveStart,
onMoveEnd = _ref.onMoveEnd,
onMove = _ref.onMove,
_ref$translateExtent = _ref.translateExtent,
translateExtent = _ref$translateExtent === void 0 ? [[-Infinity, -Infinity], [Infinity, Infinity]] : _ref$translateExtent,
_ref$scaleExtent = _ref.scaleExtent,
scaleExtent = _ref$scaleExtent === void 0 ? [1, 8] : _ref$scaleExtent,
_ref$zoom = _ref.zoom,
zoom = _ref$zoom === void 0 ? 1 : _ref$zoom;
var _useContext = useContext(MapContext),
width = _useContext.width,
height = _useContext.height,
projection = _useContext.projection;
width = _useContext.width,
height = _useContext.height,
projection = _useContext.projection;
var _center = _slicedToArray(center, 2),
lon = _center[0],
lat = _center[1];
lon = _center[0],
lat = _center[1];
var _useState = useState({
x: 0,
y: 0,
k: 1
}),
_useState2 = _slicedToArray(_useState, 2),
position = _useState2[0],
setPosition = _useState2[1];
x: 0,
y: 0,
k: 1
}),
_useState2 = _slicedToArray(_useState, 2),
position = _useState2[0],
setPosition = _useState2[1];
var lastPosition = useRef({

@@ -679,22 +623,16 @@ x: 0,

var bypassEvents = useRef(false);
var _translateExtent = _slicedToArray(translateExtent, 2),
a = _translateExtent[0],
b = _translateExtent[1];
a = _translateExtent[0],
b = _translateExtent[1];
var _a = _slicedToArray(a, 2),
a1 = _a[0],
a2 = _a[1];
a1 = _a[0],
a2 = _a[1];
var _b = _slicedToArray(b, 2),
b1 = _b[0],
b2 = _b[1];
b1 = _b[0],
b2 = _b[1];
var _scaleExtent = _slicedToArray(scaleExtent, 2),
minZoom = _scaleExtent[0],
maxZoom = _scaleExtent[1];
minZoom = _scaleExtent[0],
maxZoom = _scaleExtent[1];
useEffect(function () {
var svg = d3Select.select(mapRef.current);
function handleZoomStart(d3Event) {

@@ -707,7 +645,6 @@ if (!onMoveStart || bypassEvents.current) return;

}
function handleZoom(d3Event) {
if (bypassEvents.current) return;
var transform = d3Event.transform,
sourceEvent = d3Event.sourceEvent;
sourceEvent = d3Event.sourceEvent;
setPosition({

@@ -727,3 +664,2 @@ x: transform.x,

}
function handleZoomEnd(d3Event) {

@@ -734,8 +670,6 @@ if (bypassEvents.current) {

}
var _projection$invert = projection.invert(getCoords(width, height, d3Event.transform)),
_projection$invert2 = _slicedToArray(_projection$invert, 2),
x = _projection$invert2[0],
y = _projection$invert2[1];
_projection$invert2 = _slicedToArray(_projection$invert, 2),
x = _projection$invert2[0],
y = _projection$invert2[1];
lastPosition.current = {

@@ -752,3 +686,2 @@ x: x,

}
function filterFunc(d3Event) {

@@ -758,6 +691,4 @@ if (filterZoomEvent) {

}
return d3Event ? !d3Event.ctrlKey && !d3Event.button : false;
}
var zoom = d3Zoom.zoom().filter(filterFunc).scaleExtent([minZoom, maxZoom]).translateExtent([[a1, a2], [b1, b2]]).on("start", handleZoomStart).on("zoom", handleZoom).on("end", handleZoomEnd);

@@ -796,35 +727,32 @@ zoomRef.current = zoom;

var _ref$center = _ref.center,
center = _ref$center === void 0 ? [0, 0] : _ref$center,
_ref$zoom = _ref.zoom,
zoom = _ref$zoom === void 0 ? 1 : _ref$zoom,
_ref$minZoom = _ref.minZoom,
minZoom = _ref$minZoom === void 0 ? 1 : _ref$minZoom,
_ref$maxZoom = _ref.maxZoom,
maxZoom = _ref$maxZoom === void 0 ? 8 : _ref$maxZoom,
translateExtent = _ref.translateExtent,
filterZoomEvent = _ref.filterZoomEvent,
onMoveStart = _ref.onMoveStart,
onMove = _ref.onMove,
onMoveEnd = _ref.onMoveEnd,
className = _ref.className,
restProps = _objectWithoutProperties(_ref, _excluded$4);
center = _ref$center === void 0 ? [0, 0] : _ref$center,
_ref$zoom = _ref.zoom,
zoom = _ref$zoom === void 0 ? 1 : _ref$zoom,
_ref$minZoom = _ref.minZoom,
minZoom = _ref$minZoom === void 0 ? 1 : _ref$minZoom,
_ref$maxZoom = _ref.maxZoom,
maxZoom = _ref$maxZoom === void 0 ? 8 : _ref$maxZoom,
translateExtent = _ref.translateExtent,
filterZoomEvent = _ref.filterZoomEvent,
onMoveStart = _ref.onMoveStart,
onMove = _ref.onMove,
onMoveEnd = _ref.onMoveEnd,
className = _ref.className,
restProps = _objectWithoutProperties(_ref, _excluded$4);
var _useContext = useContext(MapContext),
width = _useContext.width,
height = _useContext.height;
width = _useContext.width,
height = _useContext.height;
var _useZoomPan = useZoomPan({
center: center,
filterZoomEvent: filterZoomEvent,
onMoveStart: onMoveStart,
onMove: onMove,
onMoveEnd: onMoveEnd,
scaleExtent: [minZoom, maxZoom],
translateExtent: translateExtent,
zoom: zoom
}),
mapRef = _useZoomPan.mapRef,
transformString = _useZoomPan.transformString,
position = _useZoomPan.position;
center: center,
filterZoomEvent: filterZoomEvent,
onMoveStart: onMoveStart,
onMove: onMove,
onMoveEnd: onMoveEnd,
scaleExtent: [minZoom, maxZoom],
translateExtent: translateExtent,
zoom: zoom
}),
mapRef = _useZoomPan.mapRef,
transformString = _useZoomPan.transformString,
position = _useZoomPan.position;
return /*#__PURE__*/React.createElement(ZoomPanProvider, {

@@ -865,16 +793,14 @@ value: {

var _ref$id = _ref.id,
id = _ref$id === void 0 ? "rsm-sphere" : _ref$id,
_ref$fill = _ref.fill,
fill = _ref$fill === void 0 ? "transparent" : _ref$fill,
_ref$stroke = _ref.stroke,
stroke = _ref$stroke === void 0 ? "currentcolor" : _ref$stroke,
_ref$strokeWidth = _ref.strokeWidth,
strokeWidth = _ref$strokeWidth === void 0 ? 0.5 : _ref$strokeWidth,
_ref$className = _ref.className,
className = _ref$className === void 0 ? "" : _ref$className,
restProps = _objectWithoutProperties(_ref, _excluded$3);
id = _ref$id === void 0 ? "rsm-sphere" : _ref$id,
_ref$fill = _ref.fill,
fill = _ref$fill === void 0 ? "transparent" : _ref$fill,
_ref$stroke = _ref.stroke,
stroke = _ref$stroke === void 0 ? "currentcolor" : _ref$stroke,
_ref$strokeWidth = _ref.strokeWidth,
strokeWidth = _ref$strokeWidth === void 0 ? 0.5 : _ref$strokeWidth,
_ref$className = _ref.className,
className = _ref$className === void 0 ? "" : _ref$className,
restProps = _objectWithoutProperties(_ref, _excluded$3);
var _useContext = useContext(MapContext),
path = _useContext.path;
path = _useContext.path;
var spherePath = useMemo(function () {

@@ -914,33 +840,28 @@ return path({

var coordinates = _ref.coordinates,
children = _ref.children,
onMouseEnter = _ref.onMouseEnter,
onMouseLeave = _ref.onMouseLeave,
onMouseDown = _ref.onMouseDown,
onMouseUp = _ref.onMouseUp,
onFocus = _ref.onFocus,
onBlur = _ref.onBlur,
_ref$style = _ref.style,
style = _ref$style === void 0 ? {} : _ref$style,
_ref$className = _ref.className,
className = _ref$className === void 0 ? "" : _ref$className,
restProps = _objectWithoutProperties(_ref, _excluded$2);
children = _ref.children,
onMouseEnter = _ref.onMouseEnter,
onMouseLeave = _ref.onMouseLeave,
onMouseDown = _ref.onMouseDown,
onMouseUp = _ref.onMouseUp,
onFocus = _ref.onFocus,
onBlur = _ref.onBlur,
_ref$style = _ref.style,
style = _ref$style === void 0 ? {} : _ref$style,
_ref$className = _ref.className,
className = _ref$className === void 0 ? "" : _ref$className,
restProps = _objectWithoutProperties(_ref, _excluded$2);
var _useContext = useContext(MapContext),
projection = _useContext.projection;
projection = _useContext.projection;
var _useState = useState(false),
_useState2 = _slicedToArray(_useState, 2),
isPressed = _useState2[0],
setPressed = _useState2[1];
_useState2 = _slicedToArray(_useState, 2),
isPressed = _useState2[0],
setPressed = _useState2[1];
var _useState3 = useState(false),
_useState4 = _slicedToArray(_useState3, 2),
isFocused = _useState4[0],
setFocus = _useState4[1];
_useState4 = _slicedToArray(_useState3, 2),
isFocused = _useState4[0],
setFocus = _useState4[1];
var _projection = projection(coordinates),
_projection2 = _slicedToArray(_projection, 2),
x = _projection2[0],
y = _projection2[1];
_projection2 = _slicedToArray(_projection, 2),
x = _projection2[0],
y = _projection2[1];
function handleMouseEnter(evt) {

@@ -950,3 +871,2 @@ setFocus(true);

}
function handleMouseLeave(evt) {

@@ -957,3 +877,2 @@ setFocus(false);

}
function handleFocus(evt) {

@@ -963,3 +882,2 @@ setFocus(true);

}
function handleBlur(evt) {

@@ -970,3 +888,2 @@ setFocus(false);

}
function handleMouseDown(evt) {

@@ -976,3 +893,2 @@ setPressed(true);

}
function handleMouseUp(evt) {

@@ -982,3 +898,2 @@ setPressed(false);

}
return /*#__PURE__*/React.createElement("g", _extends({

@@ -1014,19 +929,17 @@ ref: ref,

var _ref$from = _ref.from,
from = _ref$from === void 0 ? [0, 0] : _ref$from,
_ref$to = _ref.to,
to = _ref$to === void 0 ? [0, 0] : _ref$to,
coordinates = _ref.coordinates,
_ref$stroke = _ref.stroke,
stroke = _ref$stroke === void 0 ? "currentcolor" : _ref$stroke,
_ref$strokeWidth = _ref.strokeWidth,
strokeWidth = _ref$strokeWidth === void 0 ? 3 : _ref$strokeWidth,
_ref$fill = _ref.fill,
fill = _ref$fill === void 0 ? "transparent" : _ref$fill,
_ref$className = _ref.className,
className = _ref$className === void 0 ? "" : _ref$className,
restProps = _objectWithoutProperties(_ref, _excluded$1);
from = _ref$from === void 0 ? [0, 0] : _ref$from,
_ref$to = _ref.to,
to = _ref$to === void 0 ? [0, 0] : _ref$to,
coordinates = _ref.coordinates,
_ref$stroke = _ref.stroke,
stroke = _ref$stroke === void 0 ? "currentcolor" : _ref$stroke,
_ref$strokeWidth = _ref.strokeWidth,
strokeWidth = _ref$strokeWidth === void 0 ? 3 : _ref$strokeWidth,
_ref$fill = _ref.fill,
fill = _ref$fill === void 0 ? "transparent" : _ref$fill,
_ref$className = _ref.className,
className = _ref$className === void 0 ? "" : _ref$className,
restProps = _objectWithoutProperties(_ref, _excluded$1);
var _useContext = useContext(MapContext),
path = _useContext.path;
path = _useContext.path;
var lineData = {

@@ -1059,22 +972,19 @@ type: "LineString",

var subject = _ref.subject,
children = _ref.children,
connectorProps = _ref.connectorProps,
_ref$dx = _ref.dx,
dx = _ref$dx === void 0 ? 30 : _ref$dx,
_ref$dy = _ref.dy,
dy = _ref$dy === void 0 ? 30 : _ref$dy,
_ref$curve = _ref.curve,
curve = _ref$curve === void 0 ? 0 : _ref$curve,
_ref$className = _ref.className,
className = _ref$className === void 0 ? "" : _ref$className,
restProps = _objectWithoutProperties(_ref, _excluded);
children = _ref.children,
connectorProps = _ref.connectorProps,
_ref$dx = _ref.dx,
dx = _ref$dx === void 0 ? 30 : _ref$dx,
_ref$dy = _ref.dy,
dy = _ref$dy === void 0 ? 30 : _ref$dy,
_ref$curve = _ref.curve,
curve = _ref$curve === void 0 ? 0 : _ref$curve,
_ref$className = _ref.className,
className = _ref$className === void 0 ? "" : _ref$className,
restProps = _objectWithoutProperties(_ref, _excluded);
var _useContext = useContext(MapContext),
projection = _useContext.projection;
projection = _useContext.projection;
var _projection = projection(subject),
_projection2 = _slicedToArray(_projection, 2),
x = _projection2[0],
y = _projection2[1];
_projection2 = _slicedToArray(_projection, 2),
x = _projection2[0],
y = _projection2[1];
var connectorPath = createConnectorPath(dx, dy, curve);

@@ -1081,0 +991,0 @@ return /*#__PURE__*/React.createElement("g", _extends({

'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var React = require('react');

@@ -12,6 +10,3 @@ var PropTypes = require('prop-types');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
function _interopNamespace(e) {
if (e && e.__esModule) return e;
function _interopNamespaceDefault(e) {
var n = Object.create(null);

@@ -29,15 +24,39 @@ if (e) {

}
n["default"] = e;
n.default = e;
return Object.freeze(n);
}
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
var d3Geo__namespace = /*#__PURE__*/_interopNamespace(d3Geo);
var d3Zoom__namespace = /*#__PURE__*/_interopNamespace(d3Zoom);
var d3Select__namespace = /*#__PURE__*/_interopNamespace(d3Select);
var d3Geo__namespace = /*#__PURE__*/_interopNamespaceDefault(d3Geo);
var d3Zoom__namespace = /*#__PURE__*/_interopNamespaceDefault(d3Zoom);
var d3Select__namespace = /*#__PURE__*/_interopNamespaceDefault(d3Select);
function _iterableToArrayLimit(arr, i) {
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
if (null != _i) {
var _s,
_e,
_x,
_r,
_arr = [],
_n = !0,
_d = !1;
try {
if (_x = (_i = _i.call(arr)).next, 0 === i) {
if (Object(_i) !== _i) return;
_n = !1;
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
} catch (err) {
_d = !0, _e = err;
} finally {
try {
if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return;
} finally {
if (_d) throw _e;
}
}
return _arr;
}
}
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {

@@ -49,6 +68,4 @@ var symbols = Object.getOwnPropertySymbols(object);

}
return keys;
}
function _objectSpread2(target) {

@@ -63,6 +80,4 @@ for (var i = 1; i < arguments.length; i++) {

}
return target;
}
function _typeof(obj) {

@@ -77,4 +92,4 @@ "@babel/helpers - typeof";

}
function _defineProperty(obj, key, value) {
key = _toPropertyKey(key);
if (key in obj) {

@@ -90,6 +105,4 @@ Object.defineProperty(obj, key, {

}
return obj;
}
function _extends() {

@@ -99,3 +112,2 @@ _extends = Object.assign ? Object.assign.bind() : function (target) {

var source = arguments[i];
for (var key in source) {

@@ -107,3 +119,2 @@ if (Object.prototype.hasOwnProperty.call(source, key)) {

}
return target;

@@ -113,3 +124,2 @@ };

}
function _objectWithoutPropertiesLoose(source, excluded) {

@@ -120,3 +130,2 @@ if (source == null) return {};

var key, i;
for (i = 0; i < sourceKeys.length; i++) {

@@ -127,16 +136,10 @@ key = sourceKeys[i];

}
return target;
}
function _objectWithoutProperties(source, excluded) {
if (source == null) return {};
var target = _objectWithoutPropertiesLoose(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {

@@ -149,44 +152,10 @@ key = sourceSymbolKeys[i];

}
return target;
}
function _slicedToArray(arr, i) {
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
}
function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
function _iterableToArrayLimit(arr, i) {
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
if (_i == null) return;
var _arr = [];
var _n = true;
var _d = false;
var _s, _e;
try {
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
if (i && _arr.length === i) break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i["return"] != null) _i["return"]();
} finally {
if (_d) throw _e;
}
}
return _arr;
}
function _unsupportedIterableToArray(o, minLen) {

@@ -200,31 +169,38 @@ if (!o) return;

}
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _toPrimitive(input, hint) {
if (typeof input !== "object" || input === null) return input;
var prim = input[Symbol.toPrimitive];
if (prim !== undefined) {
var res = prim.call(input, hint || "default");
if (typeof res !== "object") return res;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (hint === "string" ? String : Number)(input);
}
function _toPropertyKey(arg) {
var key = _toPrimitive(arg, "string");
return typeof key === "symbol" ? key : String(key);
}
var _excluded$a = ["width", "height", "projection", "projectionConfig"];
var geoPath = d3Geo__namespace.geoPath,
projections = _objectWithoutProperties(d3Geo__namespace, ["geoPath"]);
projections = _objectWithoutProperties(d3Geo__namespace, ["geoPath"]);
var MapContext = React.createContext();
var makeProjection = function makeProjection(_ref) {
var _ref$projectionConfig = _ref.projectionConfig,
projectionConfig = _ref$projectionConfig === void 0 ? {} : _ref$projectionConfig,
_ref$projection = _ref.projection,
projection = _ref$projection === void 0 ? "geoEqualEarth" : _ref$projection,
_ref$width = _ref.width,
width = _ref$width === void 0 ? 800 : _ref$width,
_ref$height = _ref.height,
height = _ref$height === void 0 ? 600 : _ref$height;
projectionConfig = _ref$projectionConfig === void 0 ? {} : _ref$projectionConfig,
_ref$projection = _ref.projection,
projection = _ref$projection === void 0 ? "geoEqualEarth" : _ref$projection,
_ref$width = _ref.width,
width = _ref$width === void 0 ? 800 : _ref$width,
_ref$height = _ref.height,
height = _ref$height === void 0 ? 600 : _ref$height;
var isFunc = typeof projection === "function";

@@ -240,26 +216,21 @@ if (isFunc) return projection;

};
var MapProvider = function MapProvider(_ref2) {
var width = _ref2.width,
height = _ref2.height,
projection = _ref2.projection,
projectionConfig = _ref2.projectionConfig,
restProps = _objectWithoutProperties(_ref2, _excluded$a);
height = _ref2.height,
projection = _ref2.projection,
projectionConfig = _ref2.projectionConfig,
restProps = _objectWithoutProperties(_ref2, _excluded$a);
var _ref3 = projectionConfig.center || [],
_ref4 = _slicedToArray(_ref3, 2),
cx = _ref4[0],
cy = _ref4[1];
_ref4 = _slicedToArray(_ref3, 2),
cx = _ref4[0],
cy = _ref4[1];
var _ref5 = projectionConfig.rotate || [],
_ref6 = _slicedToArray(_ref5, 3),
rx = _ref6[0],
ry = _ref6[1],
rz = _ref6[2];
_ref6 = _slicedToArray(_ref5, 3),
rx = _ref6[0],
ry = _ref6[1],
rz = _ref6[2];
var _ref7 = projectionConfig.parallels || [],
_ref8 = _slicedToArray(_ref7, 2),
p1 = _ref8[0],
p2 = _ref8[1];
_ref8 = _slicedToArray(_ref7, 2),
p1 = _ref8[0],
p2 = _ref8[1];
var s = projectionConfig.scale || null;

@@ -288,14 +259,12 @@ var projMemo = React.useMemo(function () {

}, [width, height, proj]);
return /*#__PURE__*/React__default["default"].createElement(MapContext.Provider, _extends({
return /*#__PURE__*/React.createElement(MapContext.Provider, _extends({
value: value
}, restProps));
};
MapProvider.propTypes = {
width: PropTypes__default["default"].number,
height: PropTypes__default["default"].number,
projection: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].func]),
projectionConfig: PropTypes__default["default"].object
width: PropTypes.number,
height: PropTypes.number,
projection: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
projectionConfig: PropTypes.object
};
var useMapContext = function useMapContext() {

@@ -308,14 +277,13 @@ return React.useContext(MapContext);

var _ref$width = _ref.width,
width = _ref$width === void 0 ? 800 : _ref$width,
_ref$height = _ref.height,
height = _ref$height === void 0 ? 600 : _ref$height,
_ref$projection = _ref.projection,
projection = _ref$projection === void 0 ? "geoEqualEarth" : _ref$projection,
_ref$projectionConfig = _ref.projectionConfig,
projectionConfig = _ref$projectionConfig === void 0 ? {} : _ref$projectionConfig,
_ref$className = _ref.className,
className = _ref$className === void 0 ? "" : _ref$className,
restProps = _objectWithoutProperties(_ref, _excluded$9);
return /*#__PURE__*/React__default["default"].createElement(MapProvider, {
width = _ref$width === void 0 ? 800 : _ref$width,
_ref$height = _ref.height,
height = _ref$height === void 0 ? 600 : _ref$height,
_ref$projection = _ref.projection,
projection = _ref$projection === void 0 ? "geoEqualEarth" : _ref$projection,
_ref$projectionConfig = _ref.projectionConfig,
projectionConfig = _ref$projectionConfig === void 0 ? {} : _ref$projectionConfig,
_ref$className = _ref.className,
className = _ref$className === void 0 ? "" : _ref$className,
restProps = _objectWithoutProperties(_ref, _excluded$9);
return /*#__PURE__*/React.createElement(MapProvider, {
width: width,

@@ -325,3 +293,3 @@ height: height,

projectionConfig: projectionConfig
}, /*#__PURE__*/React__default["default"].createElement("svg", _extends({
}, /*#__PURE__*/React.createElement("svg", _extends({
ref: ref,

@@ -334,7 +302,7 @@ viewBox: "0 0 ".concat(width, " ").concat(height),

ComposableMap.propTypes = {
width: PropTypes__default["default"].number,
height: PropTypes__default["default"].number,
projection: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].func]),
projectionConfig: PropTypes__default["default"].object,
className: PropTypes__default["default"].string
width: PropTypes.number,
height: PropTypes.number,
projection: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
projectionConfig: PropTypes.object,
className: PropTypes.string
};

@@ -352,3 +320,2 @@

}
return res.json();

@@ -361,7 +328,5 @@ })["catch"](function (error) {

var isTopojson = geographies.type === "Topology";
if (!isTopojson) {
return parseGeographies ? parseGeographies(geographies.features || geographies) : geographies.features || geographies;
}
var feats = topojsonClient.feature(geographies, geographies.objects[Object.keys(geographies.objects)[0]]).features;

@@ -419,16 +384,12 @@ return parseGeographies ? parseGeographies(feats) : feats;

var geography = _ref.geography,
parseGeographies = _ref.parseGeographies;
parseGeographies = _ref.parseGeographies;
var _useContext = React.useContext(MapContext),
path = _useContext.path;
path = _useContext.path;
var _useState = React.useState({}),
_useState2 = _slicedToArray(_useState, 2),
output = _useState2[0],
setOutput = _useState2[1];
_useState2 = _slicedToArray(_useState, 2),
output = _useState2[0],
setOutput = _useState2[1];
React.useEffect(function () {
if ((typeof window === "undefined" ? "undefined" : _typeof(window)) === "undefined") return;
if (!geography) return;
if (isString(geography)) {

@@ -450,16 +411,14 @@ fetchGeographies(geography).then(function (geos) {

}, [geography, parseGeographies]);
var _useMemo = React.useMemo(function () {
var mesh = output.mesh || {};
var preparedMesh = prepareMesh(mesh.outline, mesh.borders, path);
return {
geographies: prepareFeatures(output.geographies, path),
outline: preparedMesh.outline,
borders: preparedMesh.borders
};
}, [output, path]),
geographies = _useMemo.geographies,
outline = _useMemo.outline,
borders = _useMemo.borders;
var mesh = output.mesh || {};
var preparedMesh = prepareMesh(mesh.outline, mesh.borders, path);
return {
geographies: prepareFeatures(output.geographies, path),
outline: preparedMesh.outline,
borders: preparedMesh.borders
};
}, [output, path]),
geographies = _useMemo.geographies,
outline = _useMemo.outline,
borders = _useMemo.borders;
return {

@@ -475,21 +434,18 @@ geographies: geographies,

var geography = _ref.geography,
children = _ref.children,
parseGeographies = _ref.parseGeographies,
_ref$className = _ref.className,
className = _ref$className === void 0 ? "" : _ref$className,
restProps = _objectWithoutProperties(_ref, _excluded$8);
children = _ref.children,
parseGeographies = _ref.parseGeographies,
_ref$className = _ref.className,
className = _ref$className === void 0 ? "" : _ref$className,
restProps = _objectWithoutProperties(_ref, _excluded$8);
var _useContext = React.useContext(MapContext),
path = _useContext.path,
projection = _useContext.projection;
path = _useContext.path,
projection = _useContext.projection;
var _useGeographies = useGeographies({
geography: geography,
parseGeographies: parseGeographies
}),
geographies = _useGeographies.geographies,
outline = _useGeographies.outline,
borders = _useGeographies.borders;
return /*#__PURE__*/React__default["default"].createElement("g", _extends({
geography: geography,
parseGeographies: parseGeographies
}),
geographies = _useGeographies.geographies,
outline = _useGeographies.outline,
borders = _useGeographies.borders;
return /*#__PURE__*/React.createElement("g", _extends({
ref: ref,

@@ -507,6 +463,6 @@ className: "rsm-geographies ".concat(className)

Geographies.propTypes = {
geography: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].object, PropTypes__default["default"].array]),
children: PropTypes__default["default"].func,
parseGeographies: PropTypes__default["default"].func,
className: PropTypes__default["default"].string
geography: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.array]),
children: PropTypes.func,
parseGeographies: PropTypes.func,
className: PropTypes.string
};

@@ -517,24 +473,21 @@

var geography = _ref.geography,
onMouseEnter = _ref.onMouseEnter,
onMouseLeave = _ref.onMouseLeave,
onMouseDown = _ref.onMouseDown,
onMouseUp = _ref.onMouseUp,
onFocus = _ref.onFocus,
onBlur = _ref.onBlur,
_ref$style = _ref.style,
style = _ref$style === void 0 ? {} : _ref$style,
_ref$className = _ref.className,
className = _ref$className === void 0 ? "" : _ref$className,
restProps = _objectWithoutProperties(_ref, _excluded$7);
onMouseEnter = _ref.onMouseEnter,
onMouseLeave = _ref.onMouseLeave,
onMouseDown = _ref.onMouseDown,
onMouseUp = _ref.onMouseUp,
onFocus = _ref.onFocus,
onBlur = _ref.onBlur,
_ref$style = _ref.style,
style = _ref$style === void 0 ? {} : _ref$style,
_ref$className = _ref.className,
className = _ref$className === void 0 ? "" : _ref$className,
restProps = _objectWithoutProperties(_ref, _excluded$7);
var _useState = React.useState(false),
_useState2 = _slicedToArray(_useState, 2),
isPressed = _useState2[0],
setPressed = _useState2[1];
_useState2 = _slicedToArray(_useState, 2),
isPressed = _useState2[0],
setPressed = _useState2[1];
var _useState3 = React.useState(false),
_useState4 = _slicedToArray(_useState3, 2),
isFocused = _useState4[0],
setFocus = _useState4[1];
_useState4 = _slicedToArray(_useState3, 2),
isFocused = _useState4[0],
setFocus = _useState4[1];
function handleMouseEnter(evt) {

@@ -544,3 +497,2 @@ setFocus(true);

}
function handleMouseLeave(evt) {

@@ -551,3 +503,2 @@ setFocus(false);

}
function handleFocus(evt) {

@@ -557,3 +508,2 @@ setFocus(true);

}
function handleBlur(evt) {

@@ -564,3 +514,2 @@ setFocus(false);

}
function handleMouseDown(evt) {

@@ -570,3 +519,2 @@ setPressed(true);

}
function handleMouseUp(evt) {

@@ -576,4 +524,3 @@ setPressed(false);

}
return /*#__PURE__*/React__default["default"].createElement("path", _extends({
return /*#__PURE__*/React.createElement("path", _extends({
ref: ref,

@@ -594,11 +541,11 @@ tabIndex: "0",

Geography.propTypes = {
geography: PropTypes__default["default"].object,
onMouseEnter: PropTypes__default["default"].func,
onMouseLeave: PropTypes__default["default"].func,
onMouseDown: PropTypes__default["default"].func,
onMouseUp: PropTypes__default["default"].func,
onFocus: PropTypes__default["default"].func,
onBlur: PropTypes__default["default"].func,
style: PropTypes__default["default"].object,
className: PropTypes__default["default"].string
geography: PropTypes.object,
onMouseEnter: PropTypes.func,
onMouseLeave: PropTypes.func,
onMouseDown: PropTypes.func,
onMouseUp: PropTypes.func,
onFocus: PropTypes.func,
onBlur: PropTypes.func,
style: PropTypes.object,
className: PropTypes.string
};

@@ -610,15 +557,13 @@ var Geography$1 = React.memo(Geography);

var _ref$fill = _ref.fill,
fill = _ref$fill === void 0 ? "transparent" : _ref$fill,
_ref$stroke = _ref.stroke,
stroke = _ref$stroke === void 0 ? "currentcolor" : _ref$stroke,
_ref$step = _ref.step,
step = _ref$step === void 0 ? [10, 10] : _ref$step,
_ref$className = _ref.className,
className = _ref$className === void 0 ? "" : _ref$className,
restProps = _objectWithoutProperties(_ref, _excluded$6);
fill = _ref$fill === void 0 ? "transparent" : _ref$fill,
_ref$stroke = _ref.stroke,
stroke = _ref$stroke === void 0 ? "currentcolor" : _ref$stroke,
_ref$step = _ref.step,
step = _ref$step === void 0 ? [10, 10] : _ref$step,
_ref$className = _ref.className,
className = _ref$className === void 0 ? "" : _ref$className,
restProps = _objectWithoutProperties(_ref, _excluded$6);
var _useContext = React.useContext(MapContext),
path = _useContext.path;
return /*#__PURE__*/React__default["default"].createElement("path", _extends({
path = _useContext.path;
return /*#__PURE__*/React.createElement("path", _extends({
ref: ref,

@@ -633,6 +578,6 @@ d: path(d3Geo__namespace.geoGraticule().step(step)()),

Graticule.propTypes = {
fill: PropTypes__default["default"].string,
stroke: PropTypes__default["default"].string,
step: PropTypes__default["default"].array,
className: PropTypes__default["default"].string
fill: PropTypes.string,
stroke: PropTypes.string,
step: PropTypes.array,
className: PropTypes.string
};

@@ -649,20 +594,16 @@ var Graticule$1 = React.memo(Graticule);

};
var ZoomPanProvider = function ZoomPanProvider(_ref) {
var _ref$value = _ref.value,
value = _ref$value === void 0 ? defaultValue : _ref$value,
restProps = _objectWithoutProperties(_ref, _excluded$5);
return /*#__PURE__*/React__default["default"].createElement(ZoomPanContext.Provider, _extends({
value = _ref$value === void 0 ? defaultValue : _ref$value,
restProps = _objectWithoutProperties(_ref, _excluded$5);
return /*#__PURE__*/React.createElement(ZoomPanContext.Provider, _extends({
value: value
}, restProps));
};
ZoomPanProvider.propTypes = {
x: PropTypes__default["default"].number,
y: PropTypes__default["default"].number,
k: PropTypes__default["default"].number,
transformString: PropTypes__default["default"].string
x: PropTypes.number,
y: PropTypes.number,
k: PropTypes.number,
transformString: PropTypes.string
};
var useZoomPanContext = function useZoomPanContext() {

@@ -674,31 +615,27 @@ return React.useContext(ZoomPanContext);

var center = _ref.center,
filterZoomEvent = _ref.filterZoomEvent,
onMoveStart = _ref.onMoveStart,
onMoveEnd = _ref.onMoveEnd,
onMove = _ref.onMove,
_ref$translateExtent = _ref.translateExtent,
translateExtent = _ref$translateExtent === void 0 ? [[-Infinity, -Infinity], [Infinity, Infinity]] : _ref$translateExtent,
_ref$scaleExtent = _ref.scaleExtent,
scaleExtent = _ref$scaleExtent === void 0 ? [1, 8] : _ref$scaleExtent,
_ref$zoom = _ref.zoom,
zoom = _ref$zoom === void 0 ? 1 : _ref$zoom;
filterZoomEvent = _ref.filterZoomEvent,
onMoveStart = _ref.onMoveStart,
onMoveEnd = _ref.onMoveEnd,
onMove = _ref.onMove,
_ref$translateExtent = _ref.translateExtent,
translateExtent = _ref$translateExtent === void 0 ? [[-Infinity, -Infinity], [Infinity, Infinity]] : _ref$translateExtent,
_ref$scaleExtent = _ref.scaleExtent,
scaleExtent = _ref$scaleExtent === void 0 ? [1, 8] : _ref$scaleExtent,
_ref$zoom = _ref.zoom,
zoom = _ref$zoom === void 0 ? 1 : _ref$zoom;
var _useContext = React.useContext(MapContext),
width = _useContext.width,
height = _useContext.height,
projection = _useContext.projection;
width = _useContext.width,
height = _useContext.height,
projection = _useContext.projection;
var _center = _slicedToArray(center, 2),
lon = _center[0],
lat = _center[1];
lon = _center[0],
lat = _center[1];
var _useState = React.useState({
x: 0,
y: 0,
k: 1
}),
_useState2 = _slicedToArray(_useState, 2),
position = _useState2[0],
setPosition = _useState2[1];
x: 0,
y: 0,
k: 1
}),
_useState2 = _slicedToArray(_useState, 2),
position = _useState2[0],
setPosition = _useState2[1];
var lastPosition = React.useRef({

@@ -712,22 +649,16 @@ x: 0,

var bypassEvents = React.useRef(false);
var _translateExtent = _slicedToArray(translateExtent, 2),
a = _translateExtent[0],
b = _translateExtent[1];
a = _translateExtent[0],
b = _translateExtent[1];
var _a = _slicedToArray(a, 2),
a1 = _a[0],
a2 = _a[1];
a1 = _a[0],
a2 = _a[1];
var _b = _slicedToArray(b, 2),
b1 = _b[0],
b2 = _b[1];
b1 = _b[0],
b2 = _b[1];
var _scaleExtent = _slicedToArray(scaleExtent, 2),
minZoom = _scaleExtent[0],
maxZoom = _scaleExtent[1];
minZoom = _scaleExtent[0],
maxZoom = _scaleExtent[1];
React.useEffect(function () {
var svg = d3Select__namespace.select(mapRef.current);
function handleZoomStart(d3Event) {

@@ -740,7 +671,6 @@ if (!onMoveStart || bypassEvents.current) return;

}
function handleZoom(d3Event) {
if (bypassEvents.current) return;
var transform = d3Event.transform,
sourceEvent = d3Event.sourceEvent;
sourceEvent = d3Event.sourceEvent;
setPosition({

@@ -760,3 +690,2 @@ x: transform.x,

}
function handleZoomEnd(d3Event) {

@@ -767,8 +696,6 @@ if (bypassEvents.current) {

}
var _projection$invert = projection.invert(getCoords(width, height, d3Event.transform)),
_projection$invert2 = _slicedToArray(_projection$invert, 2),
x = _projection$invert2[0],
y = _projection$invert2[1];
_projection$invert2 = _slicedToArray(_projection$invert, 2),
x = _projection$invert2[0],
y = _projection$invert2[1];
lastPosition.current = {

@@ -785,3 +712,2 @@ x: x,

}
function filterFunc(d3Event) {

@@ -791,6 +717,4 @@ if (filterZoomEvent) {

}
return d3Event ? !d3Event.ctrlKey && !d3Event.button : false;
}
var zoom = d3Zoom__namespace.zoom().filter(filterFunc).scaleExtent([minZoom, maxZoom]).translateExtent([[a1, a2], [b1, b2]]).on("start", handleZoomStart).on("zoom", handleZoom).on("end", handleZoomEnd);

@@ -829,36 +753,33 @@ zoomRef.current = zoom;

var _ref$center = _ref.center,
center = _ref$center === void 0 ? [0, 0] : _ref$center,
_ref$zoom = _ref.zoom,
zoom = _ref$zoom === void 0 ? 1 : _ref$zoom,
_ref$minZoom = _ref.minZoom,
minZoom = _ref$minZoom === void 0 ? 1 : _ref$minZoom,
_ref$maxZoom = _ref.maxZoom,
maxZoom = _ref$maxZoom === void 0 ? 8 : _ref$maxZoom,
translateExtent = _ref.translateExtent,
filterZoomEvent = _ref.filterZoomEvent,
onMoveStart = _ref.onMoveStart,
onMove = _ref.onMove,
onMoveEnd = _ref.onMoveEnd,
className = _ref.className,
restProps = _objectWithoutProperties(_ref, _excluded$4);
center = _ref$center === void 0 ? [0, 0] : _ref$center,
_ref$zoom = _ref.zoom,
zoom = _ref$zoom === void 0 ? 1 : _ref$zoom,
_ref$minZoom = _ref.minZoom,
minZoom = _ref$minZoom === void 0 ? 1 : _ref$minZoom,
_ref$maxZoom = _ref.maxZoom,
maxZoom = _ref$maxZoom === void 0 ? 8 : _ref$maxZoom,
translateExtent = _ref.translateExtent,
filterZoomEvent = _ref.filterZoomEvent,
onMoveStart = _ref.onMoveStart,
onMove = _ref.onMove,
onMoveEnd = _ref.onMoveEnd,
className = _ref.className,
restProps = _objectWithoutProperties(_ref, _excluded$4);
var _useContext = React.useContext(MapContext),
width = _useContext.width,
height = _useContext.height;
width = _useContext.width,
height = _useContext.height;
var _useZoomPan = useZoomPan({
center: center,
filterZoomEvent: filterZoomEvent,
onMoveStart: onMoveStart,
onMove: onMove,
onMoveEnd: onMoveEnd,
scaleExtent: [minZoom, maxZoom],
translateExtent: translateExtent,
zoom: zoom
}),
mapRef = _useZoomPan.mapRef,
transformString = _useZoomPan.transformString,
position = _useZoomPan.position;
return /*#__PURE__*/React__default["default"].createElement(ZoomPanProvider, {
center: center,
filterZoomEvent: filterZoomEvent,
onMoveStart: onMoveStart,
onMove: onMove,
onMoveEnd: onMoveEnd,
scaleExtent: [minZoom, maxZoom],
translateExtent: translateExtent,
zoom: zoom
}),
mapRef = _useZoomPan.mapRef,
transformString = _useZoomPan.transformString,
position = _useZoomPan.position;
return /*#__PURE__*/React.createElement(ZoomPanProvider, {
value: {

@@ -870,9 +791,9 @@ x: position.x,

}
}, /*#__PURE__*/React__default["default"].createElement("g", {
}, /*#__PURE__*/React.createElement("g", {
ref: mapRef
}, /*#__PURE__*/React__default["default"].createElement("rect", {
}, /*#__PURE__*/React.createElement("rect", {
width: width,
height: height,
fill: "transparent"
}), /*#__PURE__*/React__default["default"].createElement("g", _extends({
}), /*#__PURE__*/React.createElement("g", _extends({
ref: ref,

@@ -885,11 +806,11 @@ transform: transformString,

ZoomableGroup.propTypes = {
center: PropTypes__default["default"].array,
zoom: PropTypes__default["default"].number,
minZoom: PropTypes__default["default"].number,
maxZoom: PropTypes__default["default"].number,
translateExtent: PropTypes__default["default"].arrayOf(PropTypes__default["default"].array),
onMoveStart: PropTypes__default["default"].func,
onMove: PropTypes__default["default"].func,
onMoveEnd: PropTypes__default["default"].func,
className: PropTypes__default["default"].string
center: PropTypes.array,
zoom: PropTypes.number,
minZoom: PropTypes.number,
maxZoom: PropTypes.number,
translateExtent: PropTypes.arrayOf(PropTypes.array),
onMoveStart: PropTypes.func,
onMove: PropTypes.func,
onMoveEnd: PropTypes.func,
className: PropTypes.string
};

@@ -900,16 +821,14 @@

var _ref$id = _ref.id,
id = _ref$id === void 0 ? "rsm-sphere" : _ref$id,
_ref$fill = _ref.fill,
fill = _ref$fill === void 0 ? "transparent" : _ref$fill,
_ref$stroke = _ref.stroke,
stroke = _ref$stroke === void 0 ? "currentcolor" : _ref$stroke,
_ref$strokeWidth = _ref.strokeWidth,
strokeWidth = _ref$strokeWidth === void 0 ? 0.5 : _ref$strokeWidth,
_ref$className = _ref.className,
className = _ref$className === void 0 ? "" : _ref$className,
restProps = _objectWithoutProperties(_ref, _excluded$3);
id = _ref$id === void 0 ? "rsm-sphere" : _ref$id,
_ref$fill = _ref.fill,
fill = _ref$fill === void 0 ? "transparent" : _ref$fill,
_ref$stroke = _ref.stroke,
stroke = _ref$stroke === void 0 ? "currentcolor" : _ref$stroke,
_ref$strokeWidth = _ref.strokeWidth,
strokeWidth = _ref$strokeWidth === void 0 ? 0.5 : _ref$strokeWidth,
_ref$className = _ref.className,
className = _ref$className === void 0 ? "" : _ref$className,
restProps = _objectWithoutProperties(_ref, _excluded$3);
var _useContext = React.useContext(MapContext),
path = _useContext.path;
path = _useContext.path;
var spherePath = React.useMemo(function () {

@@ -920,7 +839,7 @@ return path({

}, [path]);
return /*#__PURE__*/React__default["default"].createElement(React.Fragment, null, /*#__PURE__*/React__default["default"].createElement("defs", null, /*#__PURE__*/React__default["default"].createElement("clipPath", {
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("clipPath", {
id: id
}, /*#__PURE__*/React__default["default"].createElement("path", {
}, /*#__PURE__*/React.createElement("path", {
d: spherePath
}))), /*#__PURE__*/React__default["default"].createElement("path", _extends({
}))), /*#__PURE__*/React.createElement("path", _extends({
ref: ref,

@@ -939,7 +858,7 @@ d: spherePath,

Sphere.propTypes = {
id: PropTypes__default["default"].string,
fill: PropTypes__default["default"].string,
stroke: PropTypes__default["default"].string,
strokeWidth: PropTypes__default["default"].number,
className: PropTypes__default["default"].string
id: PropTypes.string,
fill: PropTypes.string,
stroke: PropTypes.string,
strokeWidth: PropTypes.number,
className: PropTypes.string
};

@@ -951,33 +870,28 @@ var Sphere$1 = React.memo(Sphere);

var coordinates = _ref.coordinates,
children = _ref.children,
onMouseEnter = _ref.onMouseEnter,
onMouseLeave = _ref.onMouseLeave,
onMouseDown = _ref.onMouseDown,
onMouseUp = _ref.onMouseUp,
onFocus = _ref.onFocus,
onBlur = _ref.onBlur,
_ref$style = _ref.style,
style = _ref$style === void 0 ? {} : _ref$style,
_ref$className = _ref.className,
className = _ref$className === void 0 ? "" : _ref$className,
restProps = _objectWithoutProperties(_ref, _excluded$2);
children = _ref.children,
onMouseEnter = _ref.onMouseEnter,
onMouseLeave = _ref.onMouseLeave,
onMouseDown = _ref.onMouseDown,
onMouseUp = _ref.onMouseUp,
onFocus = _ref.onFocus,
onBlur = _ref.onBlur,
_ref$style = _ref.style,
style = _ref$style === void 0 ? {} : _ref$style,
_ref$className = _ref.className,
className = _ref$className === void 0 ? "" : _ref$className,
restProps = _objectWithoutProperties(_ref, _excluded$2);
var _useContext = React.useContext(MapContext),
projection = _useContext.projection;
projection = _useContext.projection;
var _useState = React.useState(false),
_useState2 = _slicedToArray(_useState, 2),
isPressed = _useState2[0],
setPressed = _useState2[1];
_useState2 = _slicedToArray(_useState, 2),
isPressed = _useState2[0],
setPressed = _useState2[1];
var _useState3 = React.useState(false),
_useState4 = _slicedToArray(_useState3, 2),
isFocused = _useState4[0],
setFocus = _useState4[1];
_useState4 = _slicedToArray(_useState3, 2),
isFocused = _useState4[0],
setFocus = _useState4[1];
var _projection = projection(coordinates),
_projection2 = _slicedToArray(_projection, 2),
x = _projection2[0],
y = _projection2[1];
_projection2 = _slicedToArray(_projection, 2),
x = _projection2[0],
y = _projection2[1];
function handleMouseEnter(evt) {

@@ -987,3 +901,2 @@ setFocus(true);

}
function handleMouseLeave(evt) {

@@ -994,3 +907,2 @@ setFocus(false);

}
function handleFocus(evt) {

@@ -1000,3 +912,2 @@ setFocus(true);

}
function handleBlur(evt) {

@@ -1007,3 +918,2 @@ setFocus(false);

}
function handleMouseDown(evt) {

@@ -1013,3 +923,2 @@ setPressed(true);

}
function handleMouseUp(evt) {

@@ -1019,4 +928,3 @@ setPressed(false);

}
return /*#__PURE__*/React__default["default"].createElement("g", _extends({
return /*#__PURE__*/React.createElement("g", _extends({
ref: ref,

@@ -1036,12 +944,12 @@ transform: "translate(".concat(x, ", ").concat(y, ")"),

Marker.propTypes = {
coordinates: PropTypes__default["default"].array,
children: PropTypes__default["default"].oneOfType([PropTypes__default["default"].node, PropTypes__default["default"].arrayOf(PropTypes__default["default"].node)]),
onMouseEnter: PropTypes__default["default"].func,
onMouseLeave: PropTypes__default["default"].func,
onMouseDown: PropTypes__default["default"].func,
onMouseUp: PropTypes__default["default"].func,
onFocus: PropTypes__default["default"].func,
onBlur: PropTypes__default["default"].func,
style: PropTypes__default["default"].object,
className: PropTypes__default["default"].string
coordinates: PropTypes.array,
children: PropTypes.oneOfType([PropTypes.node, PropTypes.arrayOf(PropTypes.node)]),
onMouseEnter: PropTypes.func,
onMouseLeave: PropTypes.func,
onMouseDown: PropTypes.func,
onMouseUp: PropTypes.func,
onFocus: PropTypes.func,
onBlur: PropTypes.func,
style: PropTypes.object,
className: PropTypes.string
};

@@ -1052,19 +960,17 @@

var _ref$from = _ref.from,
from = _ref$from === void 0 ? [0, 0] : _ref$from,
_ref$to = _ref.to,
to = _ref$to === void 0 ? [0, 0] : _ref$to,
coordinates = _ref.coordinates,
_ref$stroke = _ref.stroke,
stroke = _ref$stroke === void 0 ? "currentcolor" : _ref$stroke,
_ref$strokeWidth = _ref.strokeWidth,
strokeWidth = _ref$strokeWidth === void 0 ? 3 : _ref$strokeWidth,
_ref$fill = _ref.fill,
fill = _ref$fill === void 0 ? "transparent" : _ref$fill,
_ref$className = _ref.className,
className = _ref$className === void 0 ? "" : _ref$className,
restProps = _objectWithoutProperties(_ref, _excluded$1);
from = _ref$from === void 0 ? [0, 0] : _ref$from,
_ref$to = _ref.to,
to = _ref$to === void 0 ? [0, 0] : _ref$to,
coordinates = _ref.coordinates,
_ref$stroke = _ref.stroke,
stroke = _ref$stroke === void 0 ? "currentcolor" : _ref$stroke,
_ref$strokeWidth = _ref.strokeWidth,
strokeWidth = _ref$strokeWidth === void 0 ? 3 : _ref$strokeWidth,
_ref$fill = _ref.fill,
fill = _ref$fill === void 0 ? "transparent" : _ref$fill,
_ref$className = _ref.className,
className = _ref$className === void 0 ? "" : _ref$className,
restProps = _objectWithoutProperties(_ref, _excluded$1);
var _useContext = React.useContext(MapContext),
path = _useContext.path;
path = _useContext.path;
var lineData = {

@@ -1074,3 +980,3 @@ type: "LineString",

};
return /*#__PURE__*/React__default["default"].createElement("path", _extends({
return /*#__PURE__*/React.createElement("path", _extends({
ref: ref,

@@ -1086,9 +992,9 @@ d: path(lineData),

Line.propTypes = {
from: PropTypes__default["default"].array,
to: PropTypes__default["default"].array,
coordinates: PropTypes__default["default"].array,
stroke: PropTypes__default["default"].string,
strokeWidth: PropTypes__default["default"].number,
fill: PropTypes__default["default"].string,
className: PropTypes__default["default"].string
from: PropTypes.array,
to: PropTypes.array,
coordinates: PropTypes.array,
stroke: PropTypes.string,
strokeWidth: PropTypes.number,
fill: PropTypes.string,
className: PropTypes.string
};

@@ -1099,28 +1005,25 @@

var subject = _ref.subject,
children = _ref.children,
connectorProps = _ref.connectorProps,
_ref$dx = _ref.dx,
dx = _ref$dx === void 0 ? 30 : _ref$dx,
_ref$dy = _ref.dy,
dy = _ref$dy === void 0 ? 30 : _ref$dy,
_ref$curve = _ref.curve,
curve = _ref$curve === void 0 ? 0 : _ref$curve,
_ref$className = _ref.className,
className = _ref$className === void 0 ? "" : _ref$className,
restProps = _objectWithoutProperties(_ref, _excluded);
children = _ref.children,
connectorProps = _ref.connectorProps,
_ref$dx = _ref.dx,
dx = _ref$dx === void 0 ? 30 : _ref$dx,
_ref$dy = _ref.dy,
dy = _ref$dy === void 0 ? 30 : _ref$dy,
_ref$curve = _ref.curve,
curve = _ref$curve === void 0 ? 0 : _ref$curve,
_ref$className = _ref.className,
className = _ref$className === void 0 ? "" : _ref$className,
restProps = _objectWithoutProperties(_ref, _excluded);
var _useContext = React.useContext(MapContext),
projection = _useContext.projection;
projection = _useContext.projection;
var _projection = projection(subject),
_projection2 = _slicedToArray(_projection, 2),
x = _projection2[0],
y = _projection2[1];
_projection2 = _slicedToArray(_projection, 2),
x = _projection2[0],
y = _projection2[1];
var connectorPath = createConnectorPath(dx, dy, curve);
return /*#__PURE__*/React__default["default"].createElement("g", _extends({
return /*#__PURE__*/React.createElement("g", _extends({
ref: ref,
transform: "translate(".concat(x + dx, ", ").concat(y + dy, ")"),
className: "rsm-annotation ".concat(className)
}, restProps), /*#__PURE__*/React__default["default"].createElement("path", _extends({
}, restProps), /*#__PURE__*/React.createElement("path", _extends({
d: connectorPath,

@@ -1133,9 +1036,9 @@ fill: "transparent",

Annotation.propTypes = {
subject: PropTypes__default["default"].array,
children: PropTypes__default["default"].oneOfType([PropTypes__default["default"].node, PropTypes__default["default"].arrayOf(PropTypes__default["default"].node)]),
dx: PropTypes__default["default"].number,
dy: PropTypes__default["default"].number,
curve: PropTypes__default["default"].number,
connectorProps: PropTypes__default["default"].object,
className: PropTypes__default["default"].string
subject: PropTypes.array,
children: PropTypes.oneOfType([PropTypes.node, PropTypes.arrayOf(PropTypes.node)]),
dx: PropTypes.number,
dy: PropTypes.number,
curve: PropTypes.number,
connectorProps: PropTypes.object,
className: PropTypes.string
};

@@ -1142,0 +1045,0 @@

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("prop-types"),require("d3-geo"),require("topojson-client"),require("d3-zoom"),require("d3-selection")):"function"==typeof define&&define.amd?define(["exports","react","prop-types","d3-geo","topojson-client","d3-zoom","d3-selection"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).reactSimpleMaps=e.reactSimpleMaps||{},e.React,e.PropTypes,e.d3,e.topojson,e.d3,e.d3)}(this,(function(e,t,r,o,n,a,u){"use strict";function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function l(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var i=s(t),c=s(r),f=l(o),d=l(a),p=l(u);function m(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function y(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?m(Object(r),!0).forEach((function(t){v(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):m(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function g(e){return g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},g(e)}function v(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function h(){return h=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},h.apply(this,arguments)}function b(e,t){if(null==e)return{};var r,o,n=function(e,t){if(null==e)return{};var r,o,n={},a=Object.keys(e);for(o=0;o<a.length;o++)r=a[o],t.indexOf(r)>=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)r=a[o],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function j(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var o,n,a=[],u=!0,s=!1;try{for(r=r.call(e);!(u=(o=r.next()).done)&&(a.push(o.value),!t||a.length!==t);u=!0);}catch(e){s=!0,n=e}finally{try{u||null==r.return||r.return()}finally{if(s)throw n}}return a}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return M(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return M(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function M(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r<t;r++)o[r]=e[r];return o}var E=["width","height","projection","projectionConfig"],x=f.geoPath,k=b(f,["geoPath"]),w=t.createContext(),O=function(e){var r=e.width,o=e.height,n=e.projection,a=e.projectionConfig,u=b(e,E),s=j(a.center||[],2),l=s[0],c=s[1],f=j(a.rotate||[],3),d=f[0],p=f[1],m=f[2],y=j(a.parallels||[],2),g=y[0],v=y[1],M=a.scale||null,O=t.useMemo((function(){return function(e){var t=e.projectionConfig,r=void 0===t?{}:t,o=e.projection,n=void 0===o?"geoEqualEarth":o,a=e.width,u=void 0===a?800:a,s=e.height,l=void 0===s?600:s;if("function"==typeof n)return n;var i=k[n]().translate([u/2,l/2]);return[i.center?"center":null,i.rotate?"rotate":null,i.scale?"scale":null,i.parallels?"parallels":null].forEach((function(e){e&&(i=i[e](r[e]||i[e]()))})),i}({projectionConfig:{center:l||0===l||c||0===c?[l,c]:null,rotate:d||0===d||p||0===p?[d,p,m]:null,parallels:g||0===g||v||0===v?[g,v]:null,scale:M},projection:n,width:r,height:o})}),[r,o,n,l,c,d,p,m,g,v,M]),N=t.useCallback(O,[O]),S=t.useMemo((function(){return{width:r,height:o,projection:N,path:x().projection(N)}}),[r,o,N]);return i.default.createElement(w.Provider,h({value:S},u))};O.propTypes={width:c.default.number,height:c.default.number,projection:c.default.oneOfType([c.default.string,c.default.func]),projectionConfig:c.default.object};var N=["width","height","projection","projectionConfig","className"],S=t.forwardRef((function(e,t){var r=e.width,o=void 0===r?800:r,n=e.height,a=void 0===n?600:n,u=e.projection,s=void 0===u?"geoEqualEarth":u,l=e.projectionConfig,c=void 0===l?{}:l,f=e.className,d=void 0===f?"":f,p=b(e,N);return i.default.createElement(O,{width:o,height:a,projection:s,projectionConfig:c},i.default.createElement("svg",h({ref:t,viewBox:"0 0 ".concat(o," ").concat(a),className:"rsm-svg ".concat(d)},p)))}));function P(e,t,r){var o=(e*r.k-e)/2,n=(t*r.k-t)/2;return[e/2-(o+r.x)/r.k,t/2-(n+r.y)/r.k]}function C(e,t){if(!("Topology"===e.type))return t?t(e.features||e):e.features||e;var r=n.feature(e,e.objects[Object.keys(e.objects)[0]]).features;return t?t(r):r}function T(e){return"Topology"===e.type?{outline:n.mesh(e,e.objects[Object.keys(e.objects)[0]],(function(e,t){return e===t})),borders:n.mesh(e,e.objects[Object.keys(e.objects)[0]],(function(e,t){return e!==t}))}:null}function R(e,t){return e?e.map((function(e,r){return y(y({},e),{},{rsmKey:"geo-".concat(r),svgPath:t(e)})})):[]}function Z(e){var r=e.geography,o=e.parseGeographies,n=t.useContext(w).path,a=j(t.useState({}),2),u=a[0],s=a[1];t.useEffect((function(){var e;"undefined"!==("undefined"==typeof window?"undefined":g(window))&&(r&&("string"==typeof r?(e=r,fetch(e).then((function(e){if(!e.ok)throw Error(e.statusText);return e.json()})).catch((function(e){console.log("There was a problem when fetching the data: ",e)}))).then((function(e){e&&s({geographies:C(e,o),mesh:T(e)})})):s({geographies:C(r,o),mesh:T(r)})))}),[r,o]);var l=t.useMemo((function(){var e=u.mesh||{},t=function(e,t,r){return e&&t?{outline:y(y({},e),{},{rsmKey:"outline",svgPath:r(e)}),borders:y(y({},t),{},{rsmKey:"borders",svgPath:r(t)})}:{}}(e.outline,e.borders,n);return{geographies:R(u.geographies,n),outline:t.outline,borders:t.borders}}),[u,n]);return{geographies:l.geographies,outline:l.outline,borders:l.borders}}S.displayName="ComposableMap",S.propTypes={width:c.default.number,height:c.default.number,projection:c.default.oneOfType([c.default.string,c.default.func]),projectionConfig:c.default.object,className:c.default.string};var z=["geography","children","parseGeographies","className"],G=t.forwardRef((function(e,r){var o=e.geography,n=e.children,a=e.parseGeographies,u=e.className,s=void 0===u?"":u,l=b(e,z),c=t.useContext(w),f=c.path,d=c.projection,p=Z({geography:o,parseGeographies:a}),m=p.geographies,y=p.outline,g=p.borders;return i.default.createElement("g",h({ref:r,className:"rsm-geographies ".concat(s)},l),m&&m.length>0&&n({geographies:m,outline:y,borders:g,path:f,projection:d}))}));G.displayName="Geographies",G.propTypes={geography:c.default.oneOfType([c.default.string,c.default.object,c.default.array]),children:c.default.func,parseGeographies:c.default.func,className:c.default.string};var D=["geography","onMouseEnter","onMouseLeave","onMouseDown","onMouseUp","onFocus","onBlur","style","className"],L=t.forwardRef((function(e,r){var o=e.geography,n=e.onMouseEnter,a=e.onMouseLeave,u=e.onMouseDown,s=e.onMouseUp,l=e.onFocus,c=e.onBlur,f=e.style,d=void 0===f?{}:f,p=e.className,m=void 0===p?"":p,y=b(e,D),g=j(t.useState(!1),2),v=g[0],M=g[1],E=j(t.useState(!1),2),x=E[0],k=E[1];return i.default.createElement("path",h({ref:r,tabIndex:"0",className:"rsm-geography ".concat(m),d:o.svgPath,onMouseEnter:function(e){k(!0),n&&n(e)},onMouseLeave:function(e){k(!1),v&&M(!1),a&&a(e)},onFocus:function(e){k(!0),l&&l(e)},onBlur:function(e){k(!1),v&&M(!1),c&&c(e)},onMouseDown:function(e){M(!0),u&&u(e)},onMouseUp:function(e){M(!1),s&&s(e)},style:d[v||x?v?"pressed":"hover":"default"]},y))}));L.displayName="Geography",L.propTypes={geography:c.default.object,onMouseEnter:c.default.func,onMouseLeave:c.default.func,onMouseDown:c.default.func,onMouseUp:c.default.func,onFocus:c.default.func,onBlur:c.default.func,style:c.default.object,className:c.default.string};var A=t.memo(L),B=["fill","stroke","step","className"],F=t.forwardRef((function(e,r){var o=e.fill,n=void 0===o?"transparent":o,a=e.stroke,u=void 0===a?"currentcolor":a,s=e.step,l=void 0===s?[10,10]:s,c=e.className,d=void 0===c?"":c,p=b(e,B),m=t.useContext(w).path;return i.default.createElement("path",h({ref:r,d:m(f.geoGraticule().step(l)()),fill:n,stroke:u,className:"rsm-graticule ".concat(d)},p))}));F.displayName="Graticule",F.propTypes={fill:c.default.string,stroke:c.default.string,step:c.default.array,className:c.default.string};var U=t.memo(F),q=["value"],W=t.createContext(),I={x:0,y:0,k:1,transformString:"translate(0 0) scale(1)"},K=function(e){var t=e.value,r=void 0===t?I:t,o=b(e,q);return i.default.createElement(W.Provider,h({value:r},o))};K.propTypes={x:c.default.number,y:c.default.number,k:c.default.number,transformString:c.default.string};function _(e){var r=e.center,o=e.filterZoomEvent,n=e.onMoveStart,a=e.onMoveEnd,u=e.onMove,s=e.translateExtent,l=void 0===s?[[-1/0,-1/0],[1/0,1/0]]:s,i=e.scaleExtent,c=void 0===i?[1,8]:i,f=e.zoom,m=void 0===f?1:f,y=t.useContext(w),g=y.width,v=y.height,h=y.projection,b=j(r,2),M=b[0],E=b[1],x=j(t.useState({x:0,y:0,k:1}),2),k=x[0],O=x[1],N=t.useRef({x:0,y:0,k:1}),S=t.useRef(),C=t.useRef(),T=t.useRef(!1),R=j(l,2),Z=R[0],z=R[1],G=j(Z,2),D=G[0],L=G[1],A=j(z,2),B=A[0],F=A[1],U=j(c,2),q=U[0],W=U[1];return t.useEffect((function(){var e=p.select(S.current);var t=d.zoom().filter((function(e){return o?o(e):!!e&&(!e.ctrlKey&&!e.button)})).scaleExtent([q,W]).translateExtent([[D,L],[B,F]]).on("start",(function(e){n&&!T.current&&n({coordinates:h.invert(P(g,v,e.transform)),zoom:e.transform.k},e)})).on("zoom",(function(e){if(!T.current){var t=e.transform,r=e.sourceEvent;O({x:t.x,y:t.y,k:t.k,dragging:r}),u&&u({x:t.x,y:t.y,zoom:t.k,dragging:r},e)}})).on("end",(function(e){if(T.current)T.current=!1;else{var t=j(h.invert(P(g,v,e.transform)),2),r=t[0],o=t[1];N.current={x:r,y:o,k:e.transform.k},a&&a({coordinates:[r,o],zoom:e.transform.k},e)}}));C.current=t,e.call(t)}),[g,v,D,L,B,F,q,W,h,n,u,a,o]),t.useEffect((function(){if(M!==N.current.x||E!==N.current.y||m!==N.current.k){var e=h([M,E]),t=e[0]*m,r=e[1]*m,o=p.select(S.current);T.current=!0,o.call(C.current.transform,d.zoomIdentity.translate(g/2-t,v/2-r).scale(m)),O({x:g/2-t,y:v/2-r,k:m}),N.current={x:M,y:E,k:m}}}),[M,E,m,g,v,h]),{mapRef:S,position:k,transformString:"translate(".concat(k.x," ").concat(k.y,") scale(").concat(k.k,")")}}var Q=["center","zoom","minZoom","maxZoom","translateExtent","filterZoomEvent","onMoveStart","onMove","onMoveEnd","className"],$=t.forwardRef((function(e,r){var o=e.center,n=void 0===o?[0,0]:o,a=e.zoom,u=void 0===a?1:a,s=e.minZoom,l=void 0===s?1:s,c=e.maxZoom,f=void 0===c?8:c,d=e.translateExtent,p=e.filterZoomEvent,m=e.onMoveStart,y=e.onMove,g=e.onMoveEnd,v=e.className,j=b(e,Q),M=t.useContext(w),E=M.width,x=M.height,k=_({center:n,filterZoomEvent:p,onMoveStart:m,onMove:y,onMoveEnd:g,scaleExtent:[l,f],translateExtent:d,zoom:u}),O=k.mapRef,N=k.transformString,S=k.position;return i.default.createElement(K,{value:{x:S.x,y:S.y,k:S.k,transformString:N}},i.default.createElement("g",{ref:O},i.default.createElement("rect",{width:E,height:x,fill:"transparent"}),i.default.createElement("g",h({ref:r,transform:N,className:"rsm-zoomable-group ".concat(v)},j))))}));$.displayName="ZoomableGroup",$.propTypes={center:c.default.array,zoom:c.default.number,minZoom:c.default.number,maxZoom:c.default.number,translateExtent:c.default.arrayOf(c.default.array),onMoveStart:c.default.func,onMove:c.default.func,onMoveEnd:c.default.func,className:c.default.string};var H=["id","fill","stroke","strokeWidth","className"],J=t.forwardRef((function(e,r){var o=e.id,n=void 0===o?"rsm-sphere":o,a=e.fill,u=void 0===a?"transparent":a,s=e.stroke,l=void 0===s?"currentcolor":s,c=e.strokeWidth,f=void 0===c?.5:c,d=e.className,p=void 0===d?"":d,m=b(e,H),y=t.useContext(w).path,g=t.useMemo((function(){return y({type:"Sphere"})}),[y]);return i.default.createElement(t.Fragment,null,i.default.createElement("defs",null,i.default.createElement("clipPath",{id:n},i.default.createElement("path",{d:g}))),i.default.createElement("path",h({ref:r,d:g,fill:u,stroke:l,strokeWidth:f,style:{pointerEvents:"none"},className:"rsm-sphere ".concat(p)},m)))}));J.displayName="Sphere",J.propTypes={id:c.default.string,fill:c.default.string,stroke:c.default.string,strokeWidth:c.default.number,className:c.default.string};var V=t.memo(J),X=["coordinates","children","onMouseEnter","onMouseLeave","onMouseDown","onMouseUp","onFocus","onBlur","style","className"],Y=t.forwardRef((function(e,r){var o=e.coordinates,n=e.children,a=e.onMouseEnter,u=e.onMouseLeave,s=e.onMouseDown,l=e.onMouseUp,c=e.onFocus,f=e.onBlur,d=e.style,p=void 0===d?{}:d,m=e.className,y=void 0===m?"":m,g=b(e,X),v=t.useContext(w).projection,M=j(t.useState(!1),2),E=M[0],x=M[1],k=j(t.useState(!1),2),O=k[0],N=k[1],S=j(v(o),2),P=S[0],C=S[1];return i.default.createElement("g",h({ref:r,transform:"translate(".concat(P,", ").concat(C,")"),className:"rsm-marker ".concat(y),onMouseEnter:function(e){N(!0),a&&a(e)},onMouseLeave:function(e){N(!1),E&&x(!1),u&&u(e)},onFocus:function(e){N(!0),c&&c(e)},onBlur:function(e){N(!1),E&&x(!1),f&&f(e)},onMouseDown:function(e){x(!0),s&&s(e)},onMouseUp:function(e){x(!1),l&&l(e)},style:p[E||O?E?"pressed":"hover":"default"]},g),n)}));Y.displayName="Marker",Y.propTypes={coordinates:c.default.array,children:c.default.oneOfType([c.default.node,c.default.arrayOf(c.default.node)]),onMouseEnter:c.default.func,onMouseLeave:c.default.func,onMouseDown:c.default.func,onMouseUp:c.default.func,onFocus:c.default.func,onBlur:c.default.func,style:c.default.object,className:c.default.string};var ee=["from","to","coordinates","stroke","strokeWidth","fill","className"],te=t.forwardRef((function(e,r){var o=e.from,n=void 0===o?[0,0]:o,a=e.to,u=void 0===a?[0,0]:a,s=e.coordinates,l=e.stroke,c=void 0===l?"currentcolor":l,f=e.strokeWidth,d=void 0===f?3:f,p=e.fill,m=void 0===p?"transparent":p,y=e.className,g=void 0===y?"":y,v=b(e,ee),j=t.useContext(w).path,M={type:"LineString",coordinates:s||[n,u]};return i.default.createElement("path",h({ref:r,d:j(M),className:"rsm-line ".concat(g),stroke:c,strokeWidth:d,fill:m},v))}));te.displayName="Line",te.propTypes={from:c.default.array,to:c.default.array,coordinates:c.default.array,stroke:c.default.string,strokeWidth:c.default.number,fill:c.default.string,className:c.default.string};var re=["subject","children","connectorProps","dx","dy","curve","className"],oe=t.forwardRef((function(e,r){var o=e.subject,n=e.children,a=e.connectorProps,u=e.dx,s=void 0===u?30:u,l=e.dy,c=void 0===l?30:l,f=e.curve,d=void 0===f?0:f,p=e.className,m=void 0===p?"":p,y=b(e,re),g=j((0,t.useContext(w).projection)(o),2),v=g[0],M=g[1],E=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:30,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:30,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.5,o=Array.isArray(r)?r:[r,r],n=e/2*o[0],a=t/2*o[1];return"M".concat(0,",",0," Q",-e/2-n,",").concat(-t/2+a," ").concat(-e,",").concat(-t)}(s,c,d);return i.default.createElement("g",h({ref:r,transform:"translate(".concat(v+s,", ").concat(M+c,")"),className:"rsm-annotation ".concat(m)},y),i.default.createElement("path",h({d:E,fill:"transparent",stroke:"#000"},a)),n)}));oe.displayName="Annotation",oe.propTypes={subject:c.default.array,children:c.default.oneOfType([c.default.node,c.default.arrayOf(c.default.node)]),dx:c.default.number,dy:c.default.number,curve:c.default.number,connectorProps:c.default.object,className:c.default.string},e.Annotation=oe,e.ComposableMap=S,e.Geographies=G,e.Geography=A,e.Graticule=U,e.Line=te,e.MapContext=w,e.MapProvider=O,e.Marker=Y,e.Sphere=V,e.ZoomPanContext=W,e.ZoomPanProvider=K,e.ZoomableGroup=$,e.useGeographies=Z,e.useMapContext=function(){return t.useContext(w)},e.useZoomPan=_,e.useZoomPanContext=function(){return t.useContext(W)},Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("prop-types"),require("d3-geo"),require("topojson-client"),require("d3-zoom"),require("d3-selection")):"function"==typeof define&&define.amd?define(["exports","react","prop-types","d3-geo","topojson-client","d3-zoom","d3-selection"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).reactSimpleMaps=e.reactSimpleMaps||{},e.React,e.PropTypes,e.d3,e.topojson,e.d3,e.d3)}(this,(function(e,t,r,o,n,a,s){"use strict";function i(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var c=i(o),u=i(a),l=i(s);function f(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?f(Object(r),!0).forEach((function(t){d(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):f(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function m(e){return m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},m(e)}function d(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function y(){return y=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},y.apply(this,arguments)}function v(e,t){if(null==e)return{};var r,o,n=function(e,t){if(null==e)return{};var r,o,n={},a=Object.keys(e);for(o=0;o<a.length;o++)r=a[o],t.indexOf(r)>=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)r=a[o],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function g(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o,n,a,s,i=[],c=!0,u=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(o=a.call(r)).done)&&(i.push(o.value),i.length!==t);c=!0);}catch(e){u=!0,n=e}finally{try{if(!c&&null!=r.return&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw n}}return i}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return h(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return h(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r<t;r++)o[r]=e[r];return o}var b=["width","height","projection","projectionConfig"],j=c.geoPath,E=v(c,["geoPath"]),M=t.createContext(),x=function(e){var r=e.width,o=e.height,n=e.projection,a=e.projectionConfig,s=v(e,b),i=g(a.center||[],2),c=i[0],u=i[1],l=g(a.rotate||[],3),f=l[0],p=l[1],m=l[2],d=g(a.parallels||[],2),h=d[0],x=d[1],w=a.scale||null,k=t.useMemo((function(){return function(e){var t=e.projectionConfig,r=void 0===t?{}:t,o=e.projection,n=void 0===o?"geoEqualEarth":o,a=e.width,s=void 0===a?800:a,i=e.height,c=void 0===i?600:i;if("function"==typeof n)return n;var u=E[n]().translate([s/2,c/2]);return[u.center?"center":null,u.rotate?"rotate":null,u.scale?"scale":null,u.parallels?"parallels":null].forEach((function(e){e&&(u=u[e](r[e]||u[e]()))})),u}({projectionConfig:{center:c||0===c||u||0===u?[c,u]:null,rotate:f||0===f||p||0===p?[f,p,m]:null,parallels:h||0===h||x||0===x?[h,x]:null,scale:w},projection:n,width:r,height:o})}),[r,o,n,c,u,f,p,m,h,x,w]),O=t.useCallback(k,[k]),N=t.useMemo((function(){return{width:r,height:o,projection:O,path:j().projection(O)}}),[r,o,O]);return t.createElement(M.Provider,y({value:N},s))};x.propTypes={width:r.number,height:r.number,projection:r.oneOfType([r.string,r.func]),projectionConfig:r.object};var w=["width","height","projection","projectionConfig","className"],k=t.forwardRef((function(e,r){var o=e.width,n=void 0===o?800:o,a=e.height,s=void 0===a?600:a,i=e.projection,c=void 0===i?"geoEqualEarth":i,u=e.projectionConfig,l=void 0===u?{}:u,f=e.className,p=void 0===f?"":f,m=v(e,w);return t.createElement(x,{width:n,height:s,projection:c,projectionConfig:l},t.createElement("svg",y({ref:r,viewBox:"0 0 ".concat(n," ").concat(s),className:"rsm-svg ".concat(p)},m)))}));function O(e,t,r){var o=(e*r.k-e)/2,n=(t*r.k-t)/2;return[e/2-(o+r.x)/r.k,t/2-(n+r.y)/r.k]}function N(e,t){if(!("Topology"===e.type))return t?t(e.features||e):e.features||e;var r=n.feature(e,e.objects[Object.keys(e.objects)[0]]).features;return t?t(r):r}function S(e){return"Topology"===e.type?{outline:n.mesh(e,e.objects[Object.keys(e.objects)[0]],(function(e,t){return e===t})),borders:n.mesh(e,e.objects[Object.keys(e.objects)[0]],(function(e,t){return e!==t}))}:null}function P(e,t){return e?e.map((function(e,r){return p(p({},e),{},{rsmKey:"geo-".concat(r),svgPath:t(e)})})):[]}function C(e){var r=e.geography,o=e.parseGeographies,n=t.useContext(M).path,a=g(t.useState({}),2),s=a[0],i=a[1];t.useEffect((function(){var e;"undefined"!==("undefined"==typeof window?"undefined":m(window))&&(r&&("string"==typeof r?(e=r,fetch(e).then((function(e){if(!e.ok)throw Error(e.statusText);return e.json()})).catch((function(e){console.log("There was a problem when fetching the data: ",e)}))).then((function(e){e&&i({geographies:N(e,o),mesh:S(e)})})):i({geographies:N(r,o),mesh:S(r)})))}),[r,o]);var c=t.useMemo((function(){var e=s.mesh||{},t=function(e,t,r){return e&&t?{outline:p(p({},e),{},{rsmKey:"outline",svgPath:r(e)}),borders:p(p({},t),{},{rsmKey:"borders",svgPath:r(t)})}:{}}(e.outline,e.borders,n);return{geographies:P(s.geographies,n),outline:t.outline,borders:t.borders}}),[s,n]);return{geographies:c.geographies,outline:c.outline,borders:c.borders}}k.displayName="ComposableMap",k.propTypes={width:r.number,height:r.number,projection:r.oneOfType([r.string,r.func]),projectionConfig:r.object,className:r.string};var T=["geography","children","parseGeographies","className"],R=t.forwardRef((function(e,r){var o=e.geography,n=e.children,a=e.parseGeographies,s=e.className,i=void 0===s?"":s,c=v(e,T),u=t.useContext(M),l=u.path,f=u.projection,p=C({geography:o,parseGeographies:a}),m=p.geographies,d=p.outline,g=p.borders;return t.createElement("g",y({ref:r,className:"rsm-geographies ".concat(i)},c),m&&m.length>0&&n({geographies:m,outline:d,borders:g,path:l,projection:f}))}));R.displayName="Geographies",R.propTypes={geography:r.oneOfType([r.string,r.object,r.array]),children:r.func,parseGeographies:r.func,className:r.string};var Z=["geography","onMouseEnter","onMouseLeave","onMouseDown","onMouseUp","onFocus","onBlur","style","className"],z=t.forwardRef((function(e,r){var o=e.geography,n=e.onMouseEnter,a=e.onMouseLeave,s=e.onMouseDown,i=e.onMouseUp,c=e.onFocus,u=e.onBlur,l=e.style,f=void 0===l?{}:l,p=e.className,m=void 0===p?"":p,d=v(e,Z),h=g(t.useState(!1),2),b=h[0],j=h[1],E=g(t.useState(!1),2),M=E[0],x=E[1];return t.createElement("path",y({ref:r,tabIndex:"0",className:"rsm-geography ".concat(m),d:o.svgPath,onMouseEnter:function(e){x(!0),n&&n(e)},onMouseLeave:function(e){x(!1),b&&j(!1),a&&a(e)},onFocus:function(e){x(!0),c&&c(e)},onBlur:function(e){x(!1),b&&j(!1),u&&u(e)},onMouseDown:function(e){j(!0),s&&s(e)},onMouseUp:function(e){j(!1),i&&i(e)},style:f[b||M?b?"pressed":"hover":"default"]},d))}));z.displayName="Geography",z.propTypes={geography:r.object,onMouseEnter:r.func,onMouseLeave:r.func,onMouseDown:r.func,onMouseUp:r.func,onFocus:r.func,onBlur:r.func,style:r.object,className:r.string};var G=t.memo(z),D=["fill","stroke","step","className"],L=t.forwardRef((function(e,r){var o=e.fill,n=void 0===o?"transparent":o,a=e.stroke,s=void 0===a?"currentcolor":a,i=e.step,u=void 0===i?[10,10]:i,l=e.className,f=void 0===l?"":l,p=v(e,D),m=t.useContext(M).path;return t.createElement("path",y({ref:r,d:m(c.geoGraticule().step(u)()),fill:n,stroke:s,className:"rsm-graticule ".concat(f)},p))}));L.displayName="Graticule",L.propTypes={fill:r.string,stroke:r.string,step:r.array,className:r.string};var A=t.memo(L),B=["value"],F=t.createContext(),U={x:0,y:0,k:1,transformString:"translate(0 0) scale(1)"},q=function(e){var r=e.value,o=void 0===r?U:r,n=v(e,B);return t.createElement(F.Provider,y({value:o},n))};q.propTypes={x:r.number,y:r.number,k:r.number,transformString:r.string};function W(e){var r=e.center,o=e.filterZoomEvent,n=e.onMoveStart,a=e.onMoveEnd,s=e.onMove,i=e.translateExtent,c=void 0===i?[[-1/0,-1/0],[1/0,1/0]]:i,f=e.scaleExtent,p=void 0===f?[1,8]:f,m=e.zoom,d=void 0===m?1:m,y=t.useContext(M),v=y.width,h=y.height,b=y.projection,j=g(r,2),E=j[0],x=j[1],w=g(t.useState({x:0,y:0,k:1}),2),k=w[0],N=w[1],S=t.useRef({x:0,y:0,k:1}),P=t.useRef(),C=t.useRef(),T=t.useRef(!1),R=g(c,2),Z=R[0],z=R[1],G=g(Z,2),D=G[0],L=G[1],A=g(z,2),B=A[0],F=A[1],U=g(p,2),q=U[0],W=U[1];return t.useEffect((function(){var e=l.select(P.current);var t=u.zoom().filter((function(e){return o?o(e):!!e&&(!e.ctrlKey&&!e.button)})).scaleExtent([q,W]).translateExtent([[D,L],[B,F]]).on("start",(function(e){n&&!T.current&&n({coordinates:b.invert(O(v,h,e.transform)),zoom:e.transform.k},e)})).on("zoom",(function(e){if(!T.current){var t=e.transform,r=e.sourceEvent;N({x:t.x,y:t.y,k:t.k,dragging:r}),s&&s({x:t.x,y:t.y,zoom:t.k,dragging:r},e)}})).on("end",(function(e){if(T.current)T.current=!1;else{var t=g(b.invert(O(v,h,e.transform)),2),r=t[0],o=t[1];S.current={x:r,y:o,k:e.transform.k},a&&a({coordinates:[r,o],zoom:e.transform.k},e)}}));C.current=t,e.call(t)}),[v,h,D,L,B,F,q,W,b,n,s,a,o]),t.useEffect((function(){if(E!==S.current.x||x!==S.current.y||d!==S.current.k){var e=b([E,x]),t=e[0]*d,r=e[1]*d,o=l.select(P.current);T.current=!0,o.call(C.current.transform,u.zoomIdentity.translate(v/2-t,h/2-r).scale(d)),N({x:v/2-t,y:h/2-r,k:d}),S.current={x:E,y:x,k:d}}}),[E,x,d,v,h,b]),{mapRef:P,position:k,transformString:"translate(".concat(k.x," ").concat(k.y,") scale(").concat(k.k,")")}}var I=["center","zoom","minZoom","maxZoom","translateExtent","filterZoomEvent","onMoveStart","onMove","onMoveEnd","className"],K=t.forwardRef((function(e,r){var o=e.center,n=void 0===o?[0,0]:o,a=e.zoom,s=void 0===a?1:a,i=e.minZoom,c=void 0===i?1:i,u=e.maxZoom,l=void 0===u?8:u,f=e.translateExtent,p=e.filterZoomEvent,m=e.onMoveStart,d=e.onMove,g=e.onMoveEnd,h=e.className,b=v(e,I),j=t.useContext(M),E=j.width,x=j.height,w=W({center:n,filterZoomEvent:p,onMoveStart:m,onMove:d,onMoveEnd:g,scaleExtent:[c,l],translateExtent:f,zoom:s}),k=w.mapRef,O=w.transformString,N=w.position;return t.createElement(q,{value:{x:N.x,y:N.y,k:N.k,transformString:O}},t.createElement("g",{ref:k},t.createElement("rect",{width:E,height:x,fill:"transparent"}),t.createElement("g",y({ref:r,transform:O,className:"rsm-zoomable-group ".concat(h)},b))))}));K.displayName="ZoomableGroup",K.propTypes={center:r.array,zoom:r.number,minZoom:r.number,maxZoom:r.number,translateExtent:r.arrayOf(r.array),onMoveStart:r.func,onMove:r.func,onMoveEnd:r.func,className:r.string};var Q=["id","fill","stroke","strokeWidth","className"],$=t.forwardRef((function(e,r){var o=e.id,n=void 0===o?"rsm-sphere":o,a=e.fill,s=void 0===a?"transparent":a,i=e.stroke,c=void 0===i?"currentcolor":i,u=e.strokeWidth,l=void 0===u?.5:u,f=e.className,p=void 0===f?"":f,m=v(e,Q),d=t.useContext(M).path,g=t.useMemo((function(){return d({type:"Sphere"})}),[d]);return t.createElement(t.Fragment,null,t.createElement("defs",null,t.createElement("clipPath",{id:n},t.createElement("path",{d:g}))),t.createElement("path",y({ref:r,d:g,fill:s,stroke:c,strokeWidth:l,style:{pointerEvents:"none"},className:"rsm-sphere ".concat(p)},m)))}));$.displayName="Sphere",$.propTypes={id:r.string,fill:r.string,stroke:r.string,strokeWidth:r.number,className:r.string};var H=t.memo($),J=["coordinates","children","onMouseEnter","onMouseLeave","onMouseDown","onMouseUp","onFocus","onBlur","style","className"],V=t.forwardRef((function(e,r){var o=e.coordinates,n=e.children,a=e.onMouseEnter,s=e.onMouseLeave,i=e.onMouseDown,c=e.onMouseUp,u=e.onFocus,l=e.onBlur,f=e.style,p=void 0===f?{}:f,m=e.className,d=void 0===m?"":m,h=v(e,J),b=t.useContext(M).projection,j=g(t.useState(!1),2),E=j[0],x=j[1],w=g(t.useState(!1),2),k=w[0],O=w[1],N=g(b(o),2),S=N[0],P=N[1];return t.createElement("g",y({ref:r,transform:"translate(".concat(S,", ").concat(P,")"),className:"rsm-marker ".concat(d),onMouseEnter:function(e){O(!0),a&&a(e)},onMouseLeave:function(e){O(!1),E&&x(!1),s&&s(e)},onFocus:function(e){O(!0),u&&u(e)},onBlur:function(e){O(!1),E&&x(!1),l&&l(e)},onMouseDown:function(e){x(!0),i&&i(e)},onMouseUp:function(e){x(!1),c&&c(e)},style:p[E||k?E?"pressed":"hover":"default"]},h),n)}));V.displayName="Marker",V.propTypes={coordinates:r.array,children:r.oneOfType([r.node,r.arrayOf(r.node)]),onMouseEnter:r.func,onMouseLeave:r.func,onMouseDown:r.func,onMouseUp:r.func,onFocus:r.func,onBlur:r.func,style:r.object,className:r.string};var X=["from","to","coordinates","stroke","strokeWidth","fill","className"],Y=t.forwardRef((function(e,r){var o=e.from,n=void 0===o?[0,0]:o,a=e.to,s=void 0===a?[0,0]:a,i=e.coordinates,c=e.stroke,u=void 0===c?"currentcolor":c,l=e.strokeWidth,f=void 0===l?3:l,p=e.fill,m=void 0===p?"transparent":p,d=e.className,g=void 0===d?"":d,h=v(e,X),b=t.useContext(M).path,j={type:"LineString",coordinates:i||[n,s]};return t.createElement("path",y({ref:r,d:b(j),className:"rsm-line ".concat(g),stroke:u,strokeWidth:f,fill:m},h))}));Y.displayName="Line",Y.propTypes={from:r.array,to:r.array,coordinates:r.array,stroke:r.string,strokeWidth:r.number,fill:r.string,className:r.string};var _=["subject","children","connectorProps","dx","dy","curve","className"],ee=t.forwardRef((function(e,r){var o=e.subject,n=e.children,a=e.connectorProps,s=e.dx,i=void 0===s?30:s,c=e.dy,u=void 0===c?30:c,l=e.curve,f=void 0===l?0:l,p=e.className,m=void 0===p?"":p,d=v(e,_),h=g((0,t.useContext(M).projection)(o),2),b=h[0],j=h[1],E=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:30,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:30,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.5,o=Array.isArray(r)?r:[r,r],n=e/2*o[0],a=t/2*o[1];return"M".concat(0,",",0," Q",-e/2-n,",").concat(-t/2+a," ").concat(-e,",").concat(-t)}(i,u,f);return t.createElement("g",y({ref:r,transform:"translate(".concat(b+i,", ").concat(j+u,")"),className:"rsm-annotation ".concat(m)},d),t.createElement("path",y({d:E,fill:"transparent",stroke:"#000"},a)),n)}));ee.displayName="Annotation",ee.propTypes={subject:r.array,children:r.oneOfType([r.node,r.arrayOf(r.node)]),dx:r.number,dy:r.number,curve:r.number,connectorProps:r.object,className:r.string},e.Annotation=ee,e.ComposableMap=k,e.Geographies=R,e.Geography=G,e.Graticule=A,e.Line=Y,e.MapContext=M,e.MapProvider=x,e.Marker=V,e.Sphere=H,e.ZoomPanContext=F,e.ZoomPanProvider=q,e.ZoomableGroup=K,e.useGeographies=C,e.useMapContext=function(){return t.useContext(M)},e.useZoomPan=W,e.useZoomPanContext=function(){return t.useContext(F)}}));
{
"name": "react-simple-maps",
"version": "4.0.0-beta.1",
"version": "4.0.0-beta.2",
"description": "An svg map chart component built with and for React",

@@ -42,5 +42,6 @@ "main": "dist/index.js",

"@babel/register": "^7.18.6",
"@rollup/plugin-babel": "^5.3.1",
"@rollup/plugin-commonjs": "^22.0.1",
"@rollup/plugin-node-resolve": "^13.3.0",
"@rollup/plugin-babel": "^6.0.3",
"@rollup/plugin-commonjs": "^25.0.2",
"@rollup/plugin-node-resolve": "^15.1.0",
"@rollup/plugin-terser": "^0.4.3",
"expect": "^23.5.0",

@@ -51,4 +52,3 @@ "mocha": "^5.2.0",

"react-dom": "^17.0.1",
"rollup": "^2.75.7",
"rollup-plugin-terser": "^7.0.2"
"rollup": "^3.26.0"
},

@@ -55,0 +55,0 @@ "peerDependencies": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc