google-maps-js-api-react
Advanced tools
Comparing version 1.2.2 to 1.2.3
@@ -1,2 +0,2 @@ | ||
var e=require("react"),n=require("fast-deep-equal"),t=require("google-maps-js-api-loader"),o=require("react-dom"),r=require("marker-cluster");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=/*#__PURE__*/a(e),i=/*#__PURE__*/a(n),l=/*#__PURE__*/a(t),c=/*#__PURE__*/a(r);function s(){return s=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},s.apply(this,arguments)}function d(e,n){return d=Object.setPrototypeOf||function(e,n){return e.__proto__=n,e},d(e,n)}function f(e,n){if(null==e)return{};var t,o,r={},a=Object.keys(e);for(o=0;o<a.length;o++)n.indexOf(t=a[o])>=0||(r[t]=e[t]);return r}var g,p=e.createContext(null),v=function(){return e.useContext(p)};!function(e){e.CLICK="click",e.CONTEXT_MENU="contextmenu",e.DOUBLE_CLICK="dblclick",e.DRAG="drag",e.DRAG_END="dragend",e.DRAG_START="dragstart",e.MOUSE_MOVE="mousemove",e.MOUSE_OUT="mouseout",e.MOUSE_OVER="mouseover",e.RIGHT_CLICK="rightclick",e.BOUNDS_CHANGED="bounds_changed",e.CENTER_CHANGED="center_changed",e.HEADING_CHANGED="heading_changed",e.IDLE="idle",e.MAP_TYPE_ID_CHANGED="maptypeid_changed",e.PROJECTION_CHANGED="projection_changed",e.RESIZE="resize",e.TILES_LOADED="tilesloaded",e.TILT_CHANGED="tilt_changed",e.ZOOM_CHANGED="zoom_changed",e.ANIMATION_CHANGED="animation_changed",e.CLICKABLE_CHANGED="clickable_changed",e.CURSOR_CHANGED="cursor_changed",e.DRAGGABLE_CHANGED="draggable_changed",e.FLAT_CHANGED="flat_changed",e.ICON_CHANGED="icon_changed",e.MOUSE_DOWN="mousedown",e.MOUSE_UP="mouseup",e.POSITION_CHANGED="position_changed",e.SHAPE_CHANGED="shape_changed",e.TITLE_CHANGED="title_changed",e.VISIBLE_CHANGED="visible_changed",e.Z_INDEX_CHANGED="zindex_changed"}(g||(g={}));var C=Object.freeze({onClick:g.CLICK,onDoubleClick:g.DOUBLE_CLICK,onDrag:g.DRAG,onDragEnd:g.DRAG_END,onDragStart:g.DRAG_START,onContextMenu:g.CONTEXT_MENU,onMouseMove:g.MOUSE_MOVE,onMouseOut:g.MOUSE_OUT,onMouseOver:g.MOUSE_OVER,onRightClick:g.RIGHT_CLICK,onBoundsChanged:g.BOUNDS_CHANGED,onCenterChanged:g.CENTER_CHANGED,onHeadingChanged:g.HEADING_CHANGED,onIdle:g.IDLE,onMapTypeIdChanged:g.MAP_TYPE_ID_CHANGED,onProjectionChanged:g.PROJECTION_CHANGED,onResize:g.RESIZE,onTilesLoaded:g.TILES_LOADED,onTiltChanged:g.TILT_CHANGED,onZoomChanged:g.ZOOM_CHANGED,onAnimationChanged:g.ANIMATION_CHANGED,onClickableChanged:g.CLICKABLE_CHANGED,onCursorChanged:g.CURSOR_CHANGED,onDraggableChanged:g.DRAGGABLE_CHANGED,onFlatChanged:g.FLAT_CHANGED,onIconChanged:g.ICON_CHANGED,onMouseDown:g.MOUSE_DOWN,onMouseUp:g.MOUSE_UP,onPositionChanged:g.POSITION_CHANGED,onShapeChanged:g.SHAPE_CHANGED,onTitleChanged:g.TITLE_CHANGED,onVisibleChanged:g.VISIBLE_CHANGED,onZIndexChanged:g.Z_INDEX_CHANGED}),E=function(){};function h(n,t){return void 0===t&&(t={}),function(o,r){return n(function(n,t,o){if(0===t.length&&0===n.length)return E;n=Array.from(new Set(n)).reverse();var r=(t=Array.from(new Set(t)).reverse()).length,a=function(n,o){var a=e.useRef([]);e.useEffect(function(){var e=n.current;if(e){var u=a.current;if(u.length)for(var l=r;l--;){var c=t[l],s=o[c];i.default(s,u[l])||(e.set(c,s),u[l]=s)}else for(var d=r;d--;)u[d]=o[t[d]]}})};if(0===n.length)return a;var u=function(t,r){for(var a=function(a){var u=n[a],i=r[u];e.useEffect(function(){var e=t.current;if(e&&i){var n=o[u],r=e.addListener(C[u],n?function(){i.apply(void 0,[this.get(n)].concat([].slice.call(arguments),[this]))}:function(){i.apply(void 0,[].slice.call(arguments).concat([this]))});return function(){return r.remove()}}},[i])},u=n.length;u--;)a(u)};if(0===r)return u;for(var l=[],c=n.length;c--;){var s=n[c],d=o[s];d&&t.includes(d)&&(l.push(s),n.splice(c,1))}var f=l.length;return 0===f?function(e,n){u(e,n),a(e,n)}:(0===n.length&&(u=E),function(n,a){var c=e.useRef({isTriggeredBySetStateMap:new Map,prevStateArr:[]});u(n,a);for(var s=c.current.isTriggeredBySetStateMap,d=function(t){var r=l[t],u=a[r];e.useEffect(function(){var e=n.current;if(e&&u){var t=o[r],a=e.addListener(C[r],function(){s.has(t)?s.delete(t):u.apply(void 0,[this.get(t)].concat([].slice.call(arguments),[this]))});return function(){return a.remove()}}},[u])},g=f;g--;)d(g);e.useEffect(function(){var e=n.current;if(e){var o=c.current.prevStateArr;if(o.length)for(var u=r;u--;){var l=t[u],d=a[l];i.default(d,o[u])||(s.set(l,!0),e.set(l,d),o[u]=d)}else for(var f=r;f--;)o[f]=a[t[f]]}})})}(o,r,t))}}var _,D=["children","className","style","defaultOptions","onMount","onUnmount"],A=h(function(n){return function(t){var o=t.children,r=t.className,a=t.style,i=t.defaultOptions,l=t.onMount,c=t.onUnmount,d=f(t,D),g=e.useRef(null),v=e.useRef(),C=e.useState(),h=C[0],_=C[1];return e.useEffect(function(){var e=new google.maps.Map(g.current,s({},i,d));v.current=e,google.maps.event.addListenerOnce(e,"idle",function(){_(e),(l||E)(e)});var n=new Set;Object.defineProperty(e,"__blockingOverlayViews",{value:n,writable:!1});var t=e.addListener("mousedown",function(e){n.has(e.domEvent.target)&&e.stop()});return function(){t.remove(),(c||E)()}},[]),n(v,d),u.default.createElement("div",{ref:g,className:r,style:a},o&&h&&u.default.createElement(p.Provider,{value:h},"function"==typeof o?o(h):o))}},{onCenterChanged:"center",onHeadingChanged:"heading",onMapTypeIdChanged:"mapTypeId",onTiltChanged:"tilt",onZoomChanged:"zoom",onBoundsChanged:"bounds"}),O=["defaultOptions","onMount","onUnmount"],N=h(function(n){return function(t){var o=t.defaultOptions,r=t.onMount,a=t.onUnmount,u=f(t,O),i=v(),l=e.useRef();return e.useEffect(function(){var e=new google.maps.Marker(s({map:i},o,u));return l.current=e,(r||E)(e),function(){e.setMap(null),(a||E)()}},[]),n(l,u),null}},{onAnimationChanged:"animation",onCursorChanged:"cursor",onDraggableChanged:"draggable",onIconChanged:"icon",onPositionChanged:"position",onShapeChanged:"shape",onTitleChanged:"title",onVisibleChanged:"visible",onZIndexChanged:"zIndex"}),m=function(n){void 0===n&&(n={});var o=e.useState(l.default.status),r=o[0],a=o[1];return e.useEffect(function(){r!==t.LoaderStatus.LOADED&&l.default.load().then(function(){a(t.LoaderStatus.LOADED),(n.onLoaded||E)()},function(e){a(t.LoaderStatus.ERROR),(n.onError||E)(e)})},[]),r},L=e.createContext(l.default.status),y=["lat","lng","onAdd","onDraw","onRemove","component","mapPaneLayer","preventMapDragging"];l.default.completion.then(function(){_=/*#__PURE__*/function(e){var n,t;function o(n,t,o){var r;return(r=e.call(this)||this)._style=void 0,r._latLng=void 0,r._onDraw=void 0,r._style=n,r._latLng=new google.maps.LatLng(t[0],t[1]),r.setCallbacks(o),r}t=e,(n=o).prototype=Object.create(t.prototype),n.prototype.constructor=n,d(n,t);var r=o.prototype;return r.setCallbacks=function(e){this.onAdd=e[0]||E,this._onDraw=e[1]||E,this.onRemove=e[2]||E},r.setCoords=function(e){this._latLng=new google.maps.LatLng(e[0],e[1]),this.draw()},r.draw=function(){var e=this.getProjection().fromLatLngToDivPixel(this._latLng);if(e){var n=e.x,t=e.y,o=this._style;o.left=n+"px",o.top=t+"px",this._onDraw(n,t)}},o}(google.maps.OverlayView)});var S=e.forwardRef(function(n,t){var r=n.lat,a=n.lng,i=n.onAdd,l=n.onDraw,c=n.onRemove,d=n.component,g=void 0===d?"div":d,p=n.mapPaneLayer,C=void 0===p?"overlayMouseTarget":p,E=n.preventMapDragging,h=f(n,y),D=v(),A=e.useRef({}),O=[r,a],N=[i,l,c],m=e.useCallback(function(e){var n=A.current,o=D.__blockingOverlayViews;if(e){if(n.el!==e){var r;null==(r=n.overlay)||r.setMap(null),n.el=e,E&&o.add(e);var a=e.style;a.position="absolute";var u=new _(a,O,N);n.overlay=u,u.setMap(D)}}else n.overlay&&(n.overlay.setMap(null),E&&o.delete(n.el),delete n.el,delete n.overlay);!function(e,n){e&&("object"==typeof e?e.current=n:e(n))}(t,e)},[t]);return e.useEffect(function(){var e=A.current,n=e.overlay;e.isNotFirstRender&&n&&n.setCallbacks(N)},N),e.useEffect(function(){var e,n=A.current;n.isNotFirstRender?null==(e=n.overlay)||e.setCoords(O):n.isNotFirstRender=!0},O),o.createPortal(u.default.createElement(g,s({ref:m},h)),D.__gm.panes[C])}),G=function(){var e;if(null!=(e=l.default.options.libraries)&&e.includes("places"))return new google.maps.places.AutocompleteService;throw Error("Places library not loaded")},M=function(e){var n;if(void 0===e&&(e=null),null!=(n=l.default.options.libraries)&&n.includes("places"))return new google.maps.places.PlacesService(e);throw Error("Places library not loaded")};Object.defineProperty(exports,"Loader",{enumerable:!0,get:function(){return l.default}}),Object.defineProperty(exports,"LoaderStatus",{enumerable:!0,get:function(){return t.LoaderStatus}}),exports.GoogleMapLoader=function(e){var n=m(e),t=e.children;return t?u.default.createElement(L.Provider,{value:n},t):null},exports.OverlayView=S,exports.createGoogleMapComponent=A,exports.createMarkerComponent=N,exports.useAutocompleteService=function(n){var o=e.useState(function(){return l.default.status===t.LoaderStatus.LOADED?G():void 0}),r=o[0],a=o[1];return e.useEffect(function(){r||(n?l.default.load():l.default.completion).then(function(){return a(G())})},[]),r},exports.useGoogleMap=v,exports.useGoogleMapLoader=m,exports.useGoogleMapStatus=function(){return e.useContext(L)},exports.useMarkerCluster=function(n,t,o){var r,a,u=(r=function(){return new c.default(t,o)},(a=e.useRef()).current||(a.current=r())),i=e.useState([]),l=i[0][0],s=i[1],d=e.useRef();return e.useEffect(function(){return function(){return u.cleanUp()}},[]),e.useEffect(function(){var e=function(){var e=d.current;e&&s([function(){return u.getPoints.apply(u,e.concat([].slice.call(arguments)))}])};if(null!=o&&o.asyncMode)return u.loadAsync(n).then(e),function(){var e;n!==u.points&&(null==(e=u.worker)||e.terminate(),u.worker=void 0)};u.load(n),e()},[n]),{handleBoundsChange:function(e,n){var t=e.getSouthWest(),o=e.getNorthEast(),r=[n.getZoom(),t.lng(),t.lat(),o.lng(),o.lat()];d.current=r,u.points&&s([function(e,n,t){return u.getPoints.apply(u,r.concat([e,n,t]))}])},getPoints:l,markerCluster:u}},exports.usePlacesService=function(n,o){void 0===o&&(o=null);var r=e.useState(function(){return"function"!=typeof o&&l.default.status===t.LoaderStatus.LOADED?M(o):void 0}),a=r[0],u=r[1];return e.useEffect(function(){a||(n?l.default.load():l.default.completion).then(function(){return u(M("function"!=typeof o?o:o()))})},[]),a}; | ||
var e=require("react"),n=require("fast-deep-equal"),t=require("google-maps-js-api-loader"),o=require("react-dom"),r=require("marker-cluster");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=/*#__PURE__*/a(e),i=/*#__PURE__*/a(n),l=/*#__PURE__*/a(t),c=/*#__PURE__*/a(r);function s(){return s=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},s.apply(this,arguments)}function d(e,n){return d=Object.setPrototypeOf||function(e,n){return e.__proto__=n,e},d(e,n)}function f(e,n){if(null==e)return{};var t,o,r={},a=Object.keys(e);for(o=0;o<a.length;o++)n.indexOf(t=a[o])>=0||(r[t]=e[t]);return r}var g,p=e.createContext(null),C=function(){return e.useContext(p)};!function(e){e.CLICK="click",e.CONTEXT_MENU="contextmenu",e.DOUBLE_CLICK="dblclick",e.DRAG="drag",e.DRAG_END="dragend",e.DRAG_START="dragstart",e.MOUSE_MOVE="mousemove",e.MOUSE_OUT="mouseout",e.MOUSE_OVER="mouseover",e.RIGHT_CLICK="rightclick",e.BOUNDS_CHANGED="bounds_changed",e.CENTER_CHANGED="center_changed",e.HEADING_CHANGED="heading_changed",e.IDLE="idle",e.MAP_TYPE_ID_CHANGED="maptypeid_changed",e.PROJECTION_CHANGED="projection_changed",e.RESIZE="resize",e.TILES_LOADED="tilesloaded",e.TILT_CHANGED="tilt_changed",e.ZOOM_CHANGED="zoom_changed",e.ANIMATION_CHANGED="animation_changed",e.CLICKABLE_CHANGED="clickable_changed",e.CURSOR_CHANGED="cursor_changed",e.DRAGGABLE_CHANGED="draggable_changed",e.FLAT_CHANGED="flat_changed",e.ICON_CHANGED="icon_changed",e.MOUSE_DOWN="mousedown",e.MOUSE_UP="mouseup",e.POSITION_CHANGED="position_changed",e.SHAPE_CHANGED="shape_changed",e.TITLE_CHANGED="title_changed",e.VISIBLE_CHANGED="visible_changed",e.Z_INDEX_CHANGED="zindex_changed"}(g||(g={}));var v=Object.freeze({onClick:g.CLICK,onDoubleClick:g.DOUBLE_CLICK,onDrag:g.DRAG,onDragEnd:g.DRAG_END,onDragStart:g.DRAG_START,onContextMenu:g.CONTEXT_MENU,onMouseMove:g.MOUSE_MOVE,onMouseOut:g.MOUSE_OUT,onMouseOver:g.MOUSE_OVER,onRightClick:g.RIGHT_CLICK,onBoundsChanged:g.BOUNDS_CHANGED,onCenterChanged:g.CENTER_CHANGED,onHeadingChanged:g.HEADING_CHANGED,onIdle:g.IDLE,onMapTypeIdChanged:g.MAP_TYPE_ID_CHANGED,onProjectionChanged:g.PROJECTION_CHANGED,onResize:g.RESIZE,onTilesLoaded:g.TILES_LOADED,onTiltChanged:g.TILT_CHANGED,onZoomChanged:g.ZOOM_CHANGED,onAnimationChanged:g.ANIMATION_CHANGED,onClickableChanged:g.CLICKABLE_CHANGED,onCursorChanged:g.CURSOR_CHANGED,onDraggableChanged:g.DRAGGABLE_CHANGED,onFlatChanged:g.FLAT_CHANGED,onIconChanged:g.ICON_CHANGED,onMouseDown:g.MOUSE_DOWN,onMouseUp:g.MOUSE_UP,onPositionChanged:g.POSITION_CHANGED,onShapeChanged:g.SHAPE_CHANGED,onTitleChanged:g.TITLE_CHANGED,onVisibleChanged:g.VISIBLE_CHANGED,onZIndexChanged:g.Z_INDEX_CHANGED}),E=function(){};function h(n,t){return void 0===t&&(t={}),function(o,r){return n(function(n,t,o){if(0===t.length&&0===n.length)return E;n=Array.from(new Set(n)).reverse();var r=(t=Array.from(new Set(t)).reverse()).length,a=function(n,o){var a=e.useRef([]);e.useEffect(function(){var e=n.current;if(e){var u=a.current;if(u.length)for(var l=r;l--;){var c=t[l],s=o[c];i.default(s,u[l])||(e.set(c,s),u[l]=s)}else for(var d=r;d--;)u[d]=o[t[d]]}})};if(0===n.length)return a;var u=function(t,r){for(var a=function(a){var u=n[a],i=r[u];e.useEffect(function(){var e=t.current;if(e&&i){var n=o[u],r=e.addListener(v[u],n?function(){i.apply(void 0,[this.get(n)].concat([].slice.call(arguments),[this]))}:function(){i.apply(void 0,[].slice.call(arguments).concat([this]))});return function(){return r.remove()}}},[i])},u=n.length;u--;)a(u)};if(0===r)return u;for(var l=[],c=n.length;c--;){var s=n[c],d=o[s];d&&t.includes(d)&&(l.push(s),n.splice(c,1))}var f=l.length;return 0===f?function(e,n){u(e,n),a(e,n)}:(0===n.length&&(u=E),function(n,a){var c=e.useRef({isTriggeredBySetStateMap:new Map,prevStateArr:[]});u(n,a);for(var s=c.current.isTriggeredBySetStateMap,d=function(t){var r=l[t],u=a[r];e.useEffect(function(){var e=n.current;if(e&&u){var t=o[r],a=e.addListener(v[r],function(){s.has(t)?s.delete(t):u.apply(void 0,[this.get(t)].concat([].slice.call(arguments),[this]))});return function(){return a.remove()}}},[u])},g=f;g--;)d(g);e.useEffect(function(){var e=n.current;if(e){var o=c.current.prevStateArr;if(o.length)for(var u=r;u--;){var l=t[u],d=a[l];i.default(d,o[u])||(s.set(l,!0),e.set(l,d),o[u]=d)}else for(var f=r;f--;)o[f]=a[t[f]]}})})}(o,r,t))}}var _,D=["children","className","style","defaultOptions","onMount","onUnmount"],A=h(function(n){return function(t){var o=t.children,r=t.className,a=t.style,i=t.defaultOptions,l=t.onMount,c=t.onUnmount,d=f(t,D),g=e.useRef(null),C=e.useRef(),v=e.useState(),h=v[0],_=v[1];return e.useEffect(function(){var e=new google.maps.Map(g.current,s({},i,d));return C.current=e,google.maps.event.addListenerOnce(e,"idle",function(){_(e),(l||E)(e)}),c},[]),n(C,d),u.default.createElement("div",{ref:g,className:r,style:a},o&&h&&u.default.createElement(p.Provider,{value:h},"function"==typeof o?o(h):o))}},{onCenterChanged:"center",onHeadingChanged:"heading",onMapTypeIdChanged:"mapTypeId",onTiltChanged:"tilt",onZoomChanged:"zoom",onBoundsChanged:"bounds"}),N=["defaultOptions","onMount","onUnmount"],O=h(function(n){return function(t){var o=t.defaultOptions,r=t.onMount,a=t.onUnmount,u=f(t,N),i=C(),l=e.useRef();return e.useEffect(function(){var e=new google.maps.Marker(s({map:i},o,u));return l.current=e,(r||E)(e),function(){e.setMap(null),(a||E)()}},[]),n(l,u),null}},{onAnimationChanged:"animation",onCursorChanged:"cursor",onDraggableChanged:"draggable",onIconChanged:"icon",onPositionChanged:"position",onShapeChanged:"shape",onTitleChanged:"title",onVisibleChanged:"visible",onZIndexChanged:"zIndex"}),m=function(n){void 0===n&&(n={});var o=e.useState(l.default.status),r=o[0],a=o[1];return e.useEffect(function(){r!==t.LoaderStatus.LOADED&&l.default.load().then(function(){a(t.LoaderStatus.LOADED),(n.onLoaded||E)()},function(e){a(t.LoaderStatus.ERROR),(n.onError||E)(e)})},[]),r},L=e.createContext(l.default.status),G=["lat","lng","onAdd","onDraw","onRemove","component","mapPaneLayer","preventMapDragging"];l.default.completion.then(function(){_=/*#__PURE__*/function(e){var n,t;function o(n,t,o){var r;return(r=e.call(this)||this)._style=void 0,r._latLng=void 0,r._onDraw=void 0,r._style=n,r._latLng=new google.maps.LatLng(t[0],t[1]),r.setCallbacks(o),r}t=e,(n=o).prototype=Object.create(t.prototype),n.prototype.constructor=n,d(n,t);var r=o.prototype;return r.setCallbacks=function(e){this.onAdd=e[0]||E,this._onDraw=e[1]||E,this.onRemove=e[2]||E},r.setCoords=function(e){this._latLng=new google.maps.LatLng(e[0],e[1]),this.draw()},r.draw=function(){var e=this.getProjection().fromLatLngToDivPixel(this._latLng);if(e){var n=e.x,t=e.y,o=this._style;o.left=n+"px",o.top=t+"px",this._onDraw(n,t)}},o}(google.maps.OverlayView)});var S=e.forwardRef(function(n,t){var r=n.lat,a=n.lng,i=n.onAdd,l=n.onDraw,c=n.onRemove,d=n.component,g=void 0===d?"div":d,p=n.mapPaneLayer,v=void 0===p?"overlayMouseTarget":p,E=n.preventMapDragging,h=f(n,G),D=C(),A=e.useRef({}),N=[r,a],O=[i,l,c],m=e.useCallback(function(e){var n=A.current;if(e){if(n.el!==e){var o;null==(o=n.overlay)||o.setMap(null),n.el=e,E&&e.addEventListener("mousedown",function(e){e.preventDefault(),e.stopPropagation()});var r=e.style;r.position="absolute";var a=new _(r,N,O);n.overlay=a,a.setMap(D)}}else n.overlay&&(n.overlay.setMap(null),delete n.el,delete n.overlay);!function(e,n){e&&("object"==typeof e?e.current=n:e(n))}(t,e)},[t]);return e.useEffect(function(){var e=A.current,n=e.overlay;e.isNotFirstRender&&n&&n.setCallbacks(O)},O),e.useEffect(function(){var e,n=A.current;n.isNotFirstRender?null==(e=n.overlay)||e.setCoords(N):n.isNotFirstRender=!0},N),o.createPortal(u.default.createElement(g,s({ref:m},h)),D.__gm.panes[v])}),y=function(){var e;if(null!=(e=l.default.options.libraries)&&e.includes("places"))return new google.maps.places.AutocompleteService;throw Error("Places library not loaded")},M=function(e){var n;if(void 0===e&&(e=null),null!=(n=l.default.options.libraries)&&n.includes("places"))return new google.maps.places.PlacesService(e);throw Error("Places library not loaded")};Object.defineProperty(exports,"Loader",{enumerable:!0,get:function(){return l.default}}),Object.defineProperty(exports,"LoaderStatus",{enumerable:!0,get:function(){return t.LoaderStatus}}),exports.GoogleMapLoader=function(e){var n=m(e),t=e.children;return t?u.default.createElement(L.Provider,{value:n},t):null},exports.OverlayView=S,exports.createGoogleMapComponent=A,exports.createMarkerComponent=O,exports.useAutocompleteService=function(n){var o=e.useState(function(){return l.default.status===t.LoaderStatus.LOADED?y():void 0}),r=o[0],a=o[1];return e.useEffect(function(){r||(n?l.default.load():l.default.completion).then(function(){return a(y())})},[]),r},exports.useGoogleMap=C,exports.useGoogleMapLoader=m,exports.useGoogleMapStatus=function(){return e.useContext(L)},exports.useMarkerCluster=function(n,t,o){var r,a,u=(r=function(){return new c.default(t,o)},(a=e.useRef()).current||(a.current=r())),i=e.useState([]),l=i[0][0],s=i[1],d=e.useRef();return e.useEffect(function(){return function(){return u.cleanUp()}},[]),e.useEffect(function(){var e=function(){var e=d.current;e&&s([function(){return u.getPoints.apply(u,e.concat([].slice.call(arguments)))}])};if(null!=o&&o.asyncMode)return u.loadAsync(n).then(e),function(){var e;n!==u.points&&(null==(e=u.worker)||e.terminate(),u.worker=void 0)};u.load(n),e()},[n]),{handleBoundsChange:function(e,n){var t=e.getSouthWest(),o=e.getNorthEast(),r=[n.getZoom(),t.lng(),t.lat(),o.lng(),o.lat()];d.current=r,u.points&&s([function(e,n,t){return u.getPoints.apply(u,r.concat([e,n,t]))}])},getPoints:l,markerCluster:u}},exports.usePlacesService=function(n,o){void 0===o&&(o=null);var r=e.useState(function(){return"function"!=typeof o&&l.default.status===t.LoaderStatus.LOADED?M(o):void 0}),a=r[0],u=r[1];return e.useEffect(function(){a||(n?l.default.load():l.default.completion).then(function(){return u(M("function"!=typeof o?o:o()))})},[]),a}; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import n,{createContext as e,useContext as t,useRef as o,useEffect as r,useState as a,forwardRef as i,useCallback as l}from"react";import u from"fast-deep-equal";import c,{LoaderStatus as s}from"google-maps-js-api-loader";export{default as Loader,LoaderStatus}from"google-maps-js-api-loader";import{createPortal as d}from"react-dom";import g from"marker-cluster";function f(){return f=Object.assign||function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o])}return n},f.apply(this,arguments)}function v(n,e){return v=Object.setPrototypeOf||function(n,e){return n.__proto__=e,n},v(n,e)}function p(n,e){if(null==n)return{};var t,o,r={},a=Object.keys(n);for(o=0;o<a.length;o++)e.indexOf(t=a[o])>=0||(r[t]=n[t]);return r}var C,h=e(null),E=function(){return t(h)};!function(n){n.CLICK="click",n.CONTEXT_MENU="contextmenu",n.DOUBLE_CLICK="dblclick",n.DRAG="drag",n.DRAG_END="dragend",n.DRAG_START="dragstart",n.MOUSE_MOVE="mousemove",n.MOUSE_OUT="mouseout",n.MOUSE_OVER="mouseover",n.RIGHT_CLICK="rightclick",n.BOUNDS_CHANGED="bounds_changed",n.CENTER_CHANGED="center_changed",n.HEADING_CHANGED="heading_changed",n.IDLE="idle",n.MAP_TYPE_ID_CHANGED="maptypeid_changed",n.PROJECTION_CHANGED="projection_changed",n.RESIZE="resize",n.TILES_LOADED="tilesloaded",n.TILT_CHANGED="tilt_changed",n.ZOOM_CHANGED="zoom_changed",n.ANIMATION_CHANGED="animation_changed",n.CLICKABLE_CHANGED="clickable_changed",n.CURSOR_CHANGED="cursor_changed",n.DRAGGABLE_CHANGED="draggable_changed",n.FLAT_CHANGED="flat_changed",n.ICON_CHANGED="icon_changed",n.MOUSE_DOWN="mousedown",n.MOUSE_UP="mouseup",n.POSITION_CHANGED="position_changed",n.SHAPE_CHANGED="shape_changed",n.TITLE_CHANGED="title_changed",n.VISIBLE_CHANGED="visible_changed",n.Z_INDEX_CHANGED="zindex_changed"}(C||(C={}));var _=Object.freeze({onClick:C.CLICK,onDoubleClick:C.DOUBLE_CLICK,onDrag:C.DRAG,onDragEnd:C.DRAG_END,onDragStart:C.DRAG_START,onContextMenu:C.CONTEXT_MENU,onMouseMove:C.MOUSE_MOVE,onMouseOut:C.MOUSE_OUT,onMouseOver:C.MOUSE_OVER,onRightClick:C.RIGHT_CLICK,onBoundsChanged:C.BOUNDS_CHANGED,onCenterChanged:C.CENTER_CHANGED,onHeadingChanged:C.HEADING_CHANGED,onIdle:C.IDLE,onMapTypeIdChanged:C.MAP_TYPE_ID_CHANGED,onProjectionChanged:C.PROJECTION_CHANGED,onResize:C.RESIZE,onTilesLoaded:C.TILES_LOADED,onTiltChanged:C.TILT_CHANGED,onZoomChanged:C.ZOOM_CHANGED,onAnimationChanged:C.ANIMATION_CHANGED,onClickableChanged:C.CLICKABLE_CHANGED,onCursorChanged:C.CURSOR_CHANGED,onDraggableChanged:C.DRAGGABLE_CHANGED,onFlatChanged:C.FLAT_CHANGED,onIconChanged:C.ICON_CHANGED,onMouseDown:C.MOUSE_DOWN,onMouseUp:C.MOUSE_UP,onPositionChanged:C.POSITION_CHANGED,onShapeChanged:C.SHAPE_CHANGED,onTitleChanged:C.TITLE_CHANGED,onVisibleChanged:C.VISIBLE_CHANGED,onZIndexChanged:C.Z_INDEX_CHANGED}),D=function(){};function A(n,e){return void 0===e&&(e={}),function(t,a){return n(function(n,e,t){if(0===e.length&&0===n.length)return D;n=Array.from(new Set(n)).reverse();var a=(e=Array.from(new Set(e)).reverse()).length,i=function(n,t){var i=o([]);r(function(){var o=n.current;if(o){var r=i.current;if(r.length)for(var l=a;l--;){var c=e[l],s=t[c];u(s,r[l])||(o.set(c,s),r[l]=s)}else for(var d=a;d--;)r[d]=t[e[d]]}})};if(0===n.length)return i;var l=function(e,o){for(var a=function(a){var i=n[a],l=o[i];r(function(){var n=e.current;if(n&&l){var o=t[i],r=n.addListener(_[i],o?function(){l.apply(void 0,[this.get(o)].concat([].slice.call(arguments),[this]))}:function(){l.apply(void 0,[].slice.call(arguments).concat([this]))});return function(){return r.remove()}}},[l])},i=n.length;i--;)a(i)};if(0===a)return l;for(var c=[],s=n.length;s--;){var d=n[s],g=t[d];g&&e.includes(g)&&(c.push(d),n.splice(s,1))}var f=c.length;return 0===f?function(n,e){l(n,e),i(n,e)}:(0===n.length&&(l=D),function(n,i){var s=o({isTriggeredBySetStateMap:new Map,prevStateArr:[]});l(n,i);for(var d=s.current.isTriggeredBySetStateMap,g=function(e){var o=c[e],a=i[o];r(function(){var e=n.current;if(e&&a){var r=t[o],i=e.addListener(_[o],function(){d.has(r)?d.delete(r):a.apply(void 0,[this.get(r)].concat([].slice.call(arguments),[this]))});return function(){return i.remove()}}},[a])},v=f;v--;)g(v);r(function(){var t=n.current;if(t){var o=s.current.prevStateArr;if(o.length)for(var r=a;r--;){var l=e[r],c=i[l];u(c,o[r])||(d.set(l,!0),t.set(l,c),o[r]=c)}else for(var g=a;g--;)o[g]=i[e[g]]}})})}(t,a,e))}}var m,N=["children","className","style","defaultOptions","onMount","onUnmount"],O=A(function(e){return function(t){var i=t.children,l=t.className,u=t.style,c=t.defaultOptions,s=t.onMount,d=t.onUnmount,g=p(t,N),v=o(null),C=o(),E=a(),_=E[0],A=E[1];return r(function(){var n=new google.maps.Map(v.current,f({},c,g));C.current=n,google.maps.event.addListenerOnce(n,"idle",function(){A(n),(s||D)(n)});var e=new Set;Object.defineProperty(n,"__blockingOverlayViews",{value:e,writable:!1});var t=n.addListener("mousedown",function(n){e.has(n.domEvent.target)&&n.stop()});return function(){t.remove(),(d||D)()}},[]),e(C,g),n.createElement("div",{ref:v,className:l,style:u},i&&_&&n.createElement(h.Provider,{value:_},"function"==typeof i?i(_):i))}},{onCenterChanged:"center",onHeadingChanged:"heading",onMapTypeIdChanged:"mapTypeId",onTiltChanged:"tilt",onZoomChanged:"zoom",onBoundsChanged:"bounds"}),y=["defaultOptions","onMount","onUnmount"],L=A(function(n){return function(e){var t=e.defaultOptions,a=e.onMount,i=e.onUnmount,l=p(e,y),u=E(),c=o();return r(function(){var n=new google.maps.Marker(f({map:u},t,l));return c.current=n,(a||D)(n),function(){n.setMap(null),(i||D)()}},[]),n(c,l),null}},{onAnimationChanged:"animation",onCursorChanged:"cursor",onDraggableChanged:"draggable",onIconChanged:"icon",onPositionChanged:"position",onShapeChanged:"shape",onTitleChanged:"title",onVisibleChanged:"visible",onZIndexChanged:"zIndex"}),I=function(n){void 0===n&&(n={});var e=a(c.status),t=e[0],o=e[1];return r(function(){t!==s.LOADED&&c.load().then(function(){o(s.LOADED),(n.onLoaded||D)()},function(e){o(s.ERROR),(n.onError||D)(e)})},[]),t},G=e(c.status),M=function(){return t(G)},T=function(e){var t=I(e),o=e.children;return o?n.createElement(G.Provider,{value:t},o):null},H=["lat","lng","onAdd","onDraw","onRemove","component","mapPaneLayer","preventMapDragging"];c.completion.then(function(){m=/*#__PURE__*/function(n){var e,t;function o(e,t,o){var r;return(r=n.call(this)||this)._style=void 0,r._latLng=void 0,r._onDraw=void 0,r._style=e,r._latLng=new google.maps.LatLng(t[0],t[1]),r.setCallbacks(o),r}t=n,(e=o).prototype=Object.create(t.prototype),e.prototype.constructor=e,v(e,t);var r=o.prototype;return r.setCallbacks=function(n){this.onAdd=n[0]||D,this._onDraw=n[1]||D,this.onRemove=n[2]||D},r.setCoords=function(n){this._latLng=new google.maps.LatLng(n[0],n[1]),this.draw()},r.draw=function(){var n=this.getProjection().fromLatLngToDivPixel(this._latLng);if(n){var e=n.x,t=n.y,o=this._style;o.left=e+"px",o.top=t+"px",this._onDraw(e,t)}},o}(google.maps.OverlayView)});var S=i(function(e,t){var a=e.lat,i=e.lng,u=e.onAdd,c=e.onDraw,s=e.onRemove,g=e.component,v=void 0===g?"div":g,C=e.mapPaneLayer,h=void 0===C?"overlayMouseTarget":C,_=e.preventMapDragging,D=p(e,H),A=E(),N=o({}),O=[a,i],y=[u,c,s],L=l(function(n){var e=N.current,o=A.__blockingOverlayViews;if(n){if(e.el!==n){var r;null==(r=e.overlay)||r.setMap(null),e.el=n,_&&o.add(n);var a=n.style;a.position="absolute";var i=new m(a,O,y);e.overlay=i,i.setMap(A)}}else e.overlay&&(e.overlay.setMap(null),_&&o.delete(e.el),delete e.el,delete e.overlay);!function(n,e){n&&("object"==typeof n?n.current=e:n(e))}(t,n)},[t]);return r(function(){var n=N.current,e=n.overlay;n.isNotFirstRender&&e&&e.setCallbacks(y)},y),r(function(){var n,e=N.current;e.isNotFirstRender?null==(n=e.overlay)||n.setCoords(O):e.isNotFirstRender=!0},O),d(n.createElement(v,f({ref:L},D)),A.__gm.panes[h])}),R=function(n,e,t){var i,l,u=(i=function(){return new g(e,t)},(l=o()).current||(l.current=i())),c=a([]),s=c[0][0],d=c[1],f=o();return r(function(){return function(){return u.cleanUp()}},[]),r(function(){var e=function(){var n=f.current;n&&d([function(){return u.getPoints.apply(u,n.concat([].slice.call(arguments)))}])};if(null!=t&&t.asyncMode)return u.loadAsync(n).then(e),function(){var e;n!==u.points&&(null==(e=u.worker)||e.terminate(),u.worker=void 0)};u.load(n),e()},[n]),{handleBoundsChange:function(n,e){var t=n.getSouthWest(),o=n.getNorthEast(),r=[e.getZoom(),t.lng(),t.lat(),o.lng(),o.lat()];f.current=r,u.points&&d([function(n,e,t){return u.getPoints.apply(u,r.concat([n,e,t]))}])},getPoints:s,markerCluster:u}},b=function(){var n;if(null!=(n=c.options.libraries)&&n.includes("places"))return new google.maps.places.AutocompleteService;throw Error("Places library not loaded")},w=function(n){var e=a(function(){return c.status===s.LOADED?b():void 0}),t=e[0],o=e[1];return r(function(){t||(n?c.load():c.completion).then(function(){return o(b())})},[]),t},P=function(n){var e;if(void 0===n&&(n=null),null!=(e=c.options.libraries)&&e.includes("places"))return new google.maps.places.PlacesService(n);throw Error("Places library not loaded")},U=function(n,e){void 0===e&&(e=null);var t=a(function(){return"function"!=typeof e&&c.status===s.LOADED?P(e):void 0}),o=t[0],i=t[1];return r(function(){o||(n?c.load():c.completion).then(function(){return i(P("function"!=typeof e?e:e()))})},[]),o};export{T as GoogleMapLoader,S as OverlayView,O as createGoogleMapComponent,L as createMarkerComponent,w as useAutocompleteService,E as useGoogleMap,I as useGoogleMapLoader,M as useGoogleMapStatus,R as useMarkerCluster,U as usePlacesService}; | ||
import n,{createContext as e,useContext as t,useRef as o,useEffect as r,useState as a,forwardRef as i,useCallback as u}from"react";import l from"fast-deep-equal";import c,{LoaderStatus as s}from"google-maps-js-api-loader";export{default as Loader,LoaderStatus}from"google-maps-js-api-loader";import{createPortal as d}from"react-dom";import g from"marker-cluster";function f(){return f=Object.assign||function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o])}return n},f.apply(this,arguments)}function v(n,e){return v=Object.setPrototypeOf||function(n,e){return n.__proto__=e,n},v(n,e)}function p(n,e){if(null==n)return{};var t,o,r={},a=Object.keys(n);for(o=0;o<a.length;o++)e.indexOf(t=a[o])>=0||(r[t]=n[t]);return r}var C,h=e(null),E=function(){return t(h)};!function(n){n.CLICK="click",n.CONTEXT_MENU="contextmenu",n.DOUBLE_CLICK="dblclick",n.DRAG="drag",n.DRAG_END="dragend",n.DRAG_START="dragstart",n.MOUSE_MOVE="mousemove",n.MOUSE_OUT="mouseout",n.MOUSE_OVER="mouseover",n.RIGHT_CLICK="rightclick",n.BOUNDS_CHANGED="bounds_changed",n.CENTER_CHANGED="center_changed",n.HEADING_CHANGED="heading_changed",n.IDLE="idle",n.MAP_TYPE_ID_CHANGED="maptypeid_changed",n.PROJECTION_CHANGED="projection_changed",n.RESIZE="resize",n.TILES_LOADED="tilesloaded",n.TILT_CHANGED="tilt_changed",n.ZOOM_CHANGED="zoom_changed",n.ANIMATION_CHANGED="animation_changed",n.CLICKABLE_CHANGED="clickable_changed",n.CURSOR_CHANGED="cursor_changed",n.DRAGGABLE_CHANGED="draggable_changed",n.FLAT_CHANGED="flat_changed",n.ICON_CHANGED="icon_changed",n.MOUSE_DOWN="mousedown",n.MOUSE_UP="mouseup",n.POSITION_CHANGED="position_changed",n.SHAPE_CHANGED="shape_changed",n.TITLE_CHANGED="title_changed",n.VISIBLE_CHANGED="visible_changed",n.Z_INDEX_CHANGED="zindex_changed"}(C||(C={}));var _=Object.freeze({onClick:C.CLICK,onDoubleClick:C.DOUBLE_CLICK,onDrag:C.DRAG,onDragEnd:C.DRAG_END,onDragStart:C.DRAG_START,onContextMenu:C.CONTEXT_MENU,onMouseMove:C.MOUSE_MOVE,onMouseOut:C.MOUSE_OUT,onMouseOver:C.MOUSE_OVER,onRightClick:C.RIGHT_CLICK,onBoundsChanged:C.BOUNDS_CHANGED,onCenterChanged:C.CENTER_CHANGED,onHeadingChanged:C.HEADING_CHANGED,onIdle:C.IDLE,onMapTypeIdChanged:C.MAP_TYPE_ID_CHANGED,onProjectionChanged:C.PROJECTION_CHANGED,onResize:C.RESIZE,onTilesLoaded:C.TILES_LOADED,onTiltChanged:C.TILT_CHANGED,onZoomChanged:C.ZOOM_CHANGED,onAnimationChanged:C.ANIMATION_CHANGED,onClickableChanged:C.CLICKABLE_CHANGED,onCursorChanged:C.CURSOR_CHANGED,onDraggableChanged:C.DRAGGABLE_CHANGED,onFlatChanged:C.FLAT_CHANGED,onIconChanged:C.ICON_CHANGED,onMouseDown:C.MOUSE_DOWN,onMouseUp:C.MOUSE_UP,onPositionChanged:C.POSITION_CHANGED,onShapeChanged:C.SHAPE_CHANGED,onTitleChanged:C.TITLE_CHANGED,onVisibleChanged:C.VISIBLE_CHANGED,onZIndexChanged:C.Z_INDEX_CHANGED}),D=function(){};function A(n,e){return void 0===e&&(e={}),function(t,a){return n(function(n,e,t){if(0===e.length&&0===n.length)return D;n=Array.from(new Set(n)).reverse();var a=(e=Array.from(new Set(e)).reverse()).length,i=function(n,t){var i=o([]);r(function(){var o=n.current;if(o){var r=i.current;if(r.length)for(var u=a;u--;){var c=e[u],s=t[c];l(s,r[u])||(o.set(c,s),r[u]=s)}else for(var d=a;d--;)r[d]=t[e[d]]}})};if(0===n.length)return i;var u=function(e,o){for(var a=function(a){var i=n[a],u=o[i];r(function(){var n=e.current;if(n&&u){var o=t[i],r=n.addListener(_[i],o?function(){u.apply(void 0,[this.get(o)].concat([].slice.call(arguments),[this]))}:function(){u.apply(void 0,[].slice.call(arguments).concat([this]))});return function(){return r.remove()}}},[u])},i=n.length;i--;)a(i)};if(0===a)return u;for(var c=[],s=n.length;s--;){var d=n[s],g=t[d];g&&e.includes(g)&&(c.push(d),n.splice(s,1))}var f=c.length;return 0===f?function(n,e){u(n,e),i(n,e)}:(0===n.length&&(u=D),function(n,i){var s=o({isTriggeredBySetStateMap:new Map,prevStateArr:[]});u(n,i);for(var d=s.current.isTriggeredBySetStateMap,g=function(e){var o=c[e],a=i[o];r(function(){var e=n.current;if(e&&a){var r=t[o],i=e.addListener(_[o],function(){d.has(r)?d.delete(r):a.apply(void 0,[this.get(r)].concat([].slice.call(arguments),[this]))});return function(){return i.remove()}}},[a])},v=f;v--;)g(v);r(function(){var t=n.current;if(t){var o=s.current.prevStateArr;if(o.length)for(var r=a;r--;){var u=e[r],c=i[u];l(c,o[r])||(d.set(u,!0),t.set(u,c),o[r]=c)}else for(var g=a;g--;)o[g]=i[e[g]]}})})}(t,a,e))}}var m,N=["children","className","style","defaultOptions","onMount","onUnmount"],O=A(function(e){return function(t){var i=t.children,u=t.className,l=t.style,c=t.defaultOptions,s=t.onMount,d=t.onUnmount,g=p(t,N),v=o(null),C=o(),E=a(),_=E[0],A=E[1];return r(function(){var n=new google.maps.Map(v.current,f({},c,g));return C.current=n,google.maps.event.addListenerOnce(n,"idle",function(){A(n),(s||D)(n)}),d},[]),e(C,g),n.createElement("div",{ref:v,className:u,style:l},i&&_&&n.createElement(h.Provider,{value:_},"function"==typeof i?i(_):i))}},{onCenterChanged:"center",onHeadingChanged:"heading",onMapTypeIdChanged:"mapTypeId",onTiltChanged:"tilt",onZoomChanged:"zoom",onBoundsChanged:"bounds"}),L=["defaultOptions","onMount","onUnmount"],I=A(function(n){return function(e){var t=e.defaultOptions,a=e.onMount,i=e.onUnmount,u=p(e,L),l=E(),c=o();return r(function(){var n=new google.maps.Marker(f({map:l},t,u));return c.current=n,(a||D)(n),function(){n.setMap(null),(i||D)()}},[]),n(c,u),null}},{onAnimationChanged:"animation",onCursorChanged:"cursor",onDraggableChanged:"draggable",onIconChanged:"icon",onPositionChanged:"position",onShapeChanged:"shape",onTitleChanged:"title",onVisibleChanged:"visible",onZIndexChanged:"zIndex"}),G=function(n){void 0===n&&(n={});var e=a(c.status),t=e[0],o=e[1];return r(function(){t!==s.LOADED&&c.load().then(function(){o(s.LOADED),(n.onLoaded||D)()},function(e){o(s.ERROR),(n.onError||D)(e)})},[]),t},y=e(c.status),M=function(){return t(y)},T=function(e){var t=G(e),o=e.children;return o?n.createElement(y.Provider,{value:t},o):null},H=["lat","lng","onAdd","onDraw","onRemove","component","mapPaneLayer","preventMapDragging"];c.completion.then(function(){m=/*#__PURE__*/function(n){var e,t;function o(e,t,o){var r;return(r=n.call(this)||this)._style=void 0,r._latLng=void 0,r._onDraw=void 0,r._style=e,r._latLng=new google.maps.LatLng(t[0],t[1]),r.setCallbacks(o),r}t=n,(e=o).prototype=Object.create(t.prototype),e.prototype.constructor=e,v(e,t);var r=o.prototype;return r.setCallbacks=function(n){this.onAdd=n[0]||D,this._onDraw=n[1]||D,this.onRemove=n[2]||D},r.setCoords=function(n){this._latLng=new google.maps.LatLng(n[0],n[1]),this.draw()},r.draw=function(){var n=this.getProjection().fromLatLngToDivPixel(this._latLng);if(n){var e=n.x,t=n.y,o=this._style;o.left=e+"px",o.top=t+"px",this._onDraw(e,t)}},o}(google.maps.OverlayView)});var S=i(function(e,t){var a=e.lat,i=e.lng,l=e.onAdd,c=e.onDraw,s=e.onRemove,g=e.component,v=void 0===g?"div":g,C=e.mapPaneLayer,h=void 0===C?"overlayMouseTarget":C,_=e.preventMapDragging,D=p(e,H),A=E(),N=o({}),O=[a,i],L=[l,c,s],I=u(function(n){var e=N.current;if(n){if(e.el!==n){var o;null==(o=e.overlay)||o.setMap(null),e.el=n,_&&n.addEventListener("mousedown",function(n){n.preventDefault(),n.stopPropagation()});var r=n.style;r.position="absolute";var a=new m(r,O,L);e.overlay=a,a.setMap(A)}}else e.overlay&&(e.overlay.setMap(null),delete e.el,delete e.overlay);!function(n,e){n&&("object"==typeof n?n.current=e:n(e))}(t,n)},[t]);return r(function(){var n=N.current,e=n.overlay;n.isNotFirstRender&&e&&e.setCallbacks(L)},L),r(function(){var n,e=N.current;e.isNotFirstRender?null==(n=e.overlay)||n.setCoords(O):e.isNotFirstRender=!0},O),d(n.createElement(v,f({ref:I},D)),A.__gm.panes[h])}),R=function(n,e,t){var i,u,l=(i=function(){return new g(e,t)},(u=o()).current||(u.current=i())),c=a([]),s=c[0][0],d=c[1],f=o();return r(function(){return function(){return l.cleanUp()}},[]),r(function(){var e=function(){var n=f.current;n&&d([function(){return l.getPoints.apply(l,n.concat([].slice.call(arguments)))}])};if(null!=t&&t.asyncMode)return l.loadAsync(n).then(e),function(){var e;n!==l.points&&(null==(e=l.worker)||e.terminate(),l.worker=void 0)};l.load(n),e()},[n]),{handleBoundsChange:function(n,e){var t=n.getSouthWest(),o=n.getNorthEast(),r=[e.getZoom(),t.lng(),t.lat(),o.lng(),o.lat()];f.current=r,l.points&&d([function(n,e,t){return l.getPoints.apply(l,r.concat([n,e,t]))}])},getPoints:s,markerCluster:l}},P=function(){var n;if(null!=(n=c.options.libraries)&&n.includes("places"))return new google.maps.places.AutocompleteService;throw Error("Places library not loaded")},b=function(n){var e=a(function(){return c.status===s.LOADED?P():void 0}),t=e[0],o=e[1];return r(function(){t||(n?c.load():c.completion).then(function(){return o(P())})},[]),t},U=function(n){var e;if(void 0===n&&(n=null),null!=(e=c.options.libraries)&&e.includes("places"))return new google.maps.places.PlacesService(n);throw Error("Places library not loaded")},w=function(n,e){void 0===e&&(e=null);var t=a(function(){return"function"!=typeof e&&c.status===s.LOADED?U(e):void 0}),o=t[0],i=t[1];return r(function(){o||(n?c.load():c.completion).then(function(){return i(U("function"!=typeof e?e:e()))})},[]),o};export{T as GoogleMapLoader,S as OverlayView,O as createGoogleMapComponent,I as createMarkerComponent,b as useAutocompleteService,E as useGoogleMap,G as useGoogleMapLoader,M as useGoogleMapStatus,R as useMarkerCluster,w as usePlacesService}; | ||
//# sourceMappingURL=index.modern.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("react"),require("fast-deep-equal"),require("google-maps-js-api-loader"),require("react-dom"),require("marker-cluster")):"function"==typeof define&&define.amd?define(["exports","react","fast-deep-equal","google-maps-js-api-loader","react-dom","marker-cluster"],n):n((e||self).googleMapsJsApiReact={},e.react,e.fastDeepEqual,e.googleMapsJsApiLoader,e.reactDom,e.markerCluster)}(this,function(e,n,t,o,r,a){function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=/*#__PURE__*/u(n),l=/*#__PURE__*/u(t),c=/*#__PURE__*/u(o),s=/*#__PURE__*/u(a);function d(){return d=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},d.apply(this,arguments)}function f(e,n){return f=Object.setPrototypeOf||function(e,n){return e.__proto__=n,e},f(e,n)}function g(e,n){if(null==e)return{};var t,o,r={},a=Object.keys(e);for(o=0;o<a.length;o++)n.indexOf(t=a[o])>=0||(r[t]=e[t]);return r}var p,v=n.createContext(null),C=function(){return n.useContext(v)};!function(e){e.CLICK="click",e.CONTEXT_MENU="contextmenu",e.DOUBLE_CLICK="dblclick",e.DRAG="drag",e.DRAG_END="dragend",e.DRAG_START="dragstart",e.MOUSE_MOVE="mousemove",e.MOUSE_OUT="mouseout",e.MOUSE_OVER="mouseover",e.RIGHT_CLICK="rightclick",e.BOUNDS_CHANGED="bounds_changed",e.CENTER_CHANGED="center_changed",e.HEADING_CHANGED="heading_changed",e.IDLE="idle",e.MAP_TYPE_ID_CHANGED="maptypeid_changed",e.PROJECTION_CHANGED="projection_changed",e.RESIZE="resize",e.TILES_LOADED="tilesloaded",e.TILT_CHANGED="tilt_changed",e.ZOOM_CHANGED="zoom_changed",e.ANIMATION_CHANGED="animation_changed",e.CLICKABLE_CHANGED="clickable_changed",e.CURSOR_CHANGED="cursor_changed",e.DRAGGABLE_CHANGED="draggable_changed",e.FLAT_CHANGED="flat_changed",e.ICON_CHANGED="icon_changed",e.MOUSE_DOWN="mousedown",e.MOUSE_UP="mouseup",e.POSITION_CHANGED="position_changed",e.SHAPE_CHANGED="shape_changed",e.TITLE_CHANGED="title_changed",e.VISIBLE_CHANGED="visible_changed",e.Z_INDEX_CHANGED="zindex_changed"}(p||(p={}));var E=Object.freeze({onClick:p.CLICK,onDoubleClick:p.DOUBLE_CLICK,onDrag:p.DRAG,onDragEnd:p.DRAG_END,onDragStart:p.DRAG_START,onContextMenu:p.CONTEXT_MENU,onMouseMove:p.MOUSE_MOVE,onMouseOut:p.MOUSE_OUT,onMouseOver:p.MOUSE_OVER,onRightClick:p.RIGHT_CLICK,onBoundsChanged:p.BOUNDS_CHANGED,onCenterChanged:p.CENTER_CHANGED,onHeadingChanged:p.HEADING_CHANGED,onIdle:p.IDLE,onMapTypeIdChanged:p.MAP_TYPE_ID_CHANGED,onProjectionChanged:p.PROJECTION_CHANGED,onResize:p.RESIZE,onTilesLoaded:p.TILES_LOADED,onTiltChanged:p.TILT_CHANGED,onZoomChanged:p.ZOOM_CHANGED,onAnimationChanged:p.ANIMATION_CHANGED,onClickableChanged:p.CLICKABLE_CHANGED,onCursorChanged:p.CURSOR_CHANGED,onDraggableChanged:p.DRAGGABLE_CHANGED,onFlatChanged:p.FLAT_CHANGED,onIconChanged:p.ICON_CHANGED,onMouseDown:p.MOUSE_DOWN,onMouseUp:p.MOUSE_UP,onPositionChanged:p.POSITION_CHANGED,onShapeChanged:p.SHAPE_CHANGED,onTitleChanged:p.TITLE_CHANGED,onVisibleChanged:p.VISIBLE_CHANGED,onZIndexChanged:p.Z_INDEX_CHANGED}),h=function(){};function _(e,t){return void 0===t&&(t={}),function(o,r){return e(function(e,t,o){if(0===t.length&&0===e.length)return h;e=Array.from(new Set(e)).reverse();var r=(t=Array.from(new Set(t)).reverse()).length,a=function(e,o){var a=n.useRef([]);n.useEffect(function(){var n=e.current;if(n){var u=a.current;if(u.length)for(var i=r;i--;){var c=t[i],s=o[c];l.default(s,u[i])||(n.set(c,s),u[i]=s)}else for(var d=r;d--;)u[d]=o[t[d]]}})};if(0===e.length)return a;var u=function(t,r){for(var a=function(a){var u=e[a],i=r[u];n.useEffect(function(){var e=t.current;if(e&&i){var n=o[u],r=e.addListener(E[u],n?function(){i.apply(void 0,[this.get(n)].concat([].slice.call(arguments),[this]))}:function(){i.apply(void 0,[].slice.call(arguments).concat([this]))});return function(){return r.remove()}}},[i])},u=e.length;u--;)a(u)};if(0===r)return u;for(var i=[],c=e.length;c--;){var s=e[c],d=o[s];d&&t.includes(d)&&(i.push(s),e.splice(c,1))}var f=i.length;return 0===f?function(e,n){u(e,n),a(e,n)}:(0===e.length&&(u=h),function(e,a){var c=n.useRef({isTriggeredBySetStateMap:new Map,prevStateArr:[]});u(e,a);for(var s=c.current.isTriggeredBySetStateMap,d=function(t){var r=i[t],u=a[r];n.useEffect(function(){var n=e.current;if(n&&u){var t=o[r],a=n.addListener(E[r],function(){s.has(t)?s.delete(t):u.apply(void 0,[this.get(t)].concat([].slice.call(arguments),[this]))});return function(){return a.remove()}}},[u])},g=f;g--;)d(g);n.useEffect(function(){var n=e.current;if(n){var o=c.current.prevStateArr;if(o.length)for(var u=r;u--;){var i=t[u],d=a[i];l.default(d,o[u])||(s.set(i,!0),n.set(i,d),o[u]=d)}else for(var f=r;f--;)o[f]=a[t[f]]}})})}(o,r,t))}}var D,A=["children","className","style","defaultOptions","onMount","onUnmount"],m=_(function(e){return function(t){var o=t.children,r=t.className,a=t.style,u=t.defaultOptions,l=t.onMount,c=t.onUnmount,s=g(t,A),f=n.useRef(null),p=n.useRef(),C=n.useState(),E=C[0],_=C[1];return n.useEffect(function(){var e=new google.maps.Map(f.current,d({},u,s));p.current=e,google.maps.event.addListenerOnce(e,"idle",function(){_(e),(l||h)(e)});var n=new Set;Object.defineProperty(e,"__blockingOverlayViews",{value:n,writable:!1});var t=e.addListener("mousedown",function(e){n.has(e.domEvent.target)&&e.stop()});return function(){t.remove(),(c||h)()}},[]),e(p,s),i.default.createElement("div",{ref:f,className:r,style:a},o&&E&&i.default.createElement(v.Provider,{value:E},"function"==typeof o?o(E):o))}},{onCenterChanged:"center",onHeadingChanged:"heading",onMapTypeIdChanged:"mapTypeId",onTiltChanged:"tilt",onZoomChanged:"zoom",onBoundsChanged:"bounds"}),O=["defaultOptions","onMount","onUnmount"],N=_(function(e){return function(t){var o=t.defaultOptions,r=t.onMount,a=t.onUnmount,u=g(t,O),i=C(),l=n.useRef();return n.useEffect(function(){var e=new google.maps.Marker(d({map:i},o,u));return l.current=e,(r||h)(e),function(){e.setMap(null),(a||h)()}},[]),e(l,u),null}},{onAnimationChanged:"animation",onCursorChanged:"cursor",onDraggableChanged:"draggable",onIconChanged:"icon",onPositionChanged:"position",onShapeChanged:"shape",onTitleChanged:"title",onVisibleChanged:"visible",onZIndexChanged:"zIndex"}),L=function(e){void 0===e&&(e={});var t=n.useState(c.default.status),r=t[0],a=t[1];return n.useEffect(function(){r!==o.LoaderStatus.LOADED&&c.default.load().then(function(){a(o.LoaderStatus.LOADED),(e.onLoaded||h)()},function(n){a(o.LoaderStatus.ERROR),(e.onError||h)(n)})},[]),r},y=n.createContext(c.default.status),S=["lat","lng","onAdd","onDraw","onRemove","component","mapPaneLayer","preventMapDragging"];c.default.completion.then(function(){D=/*#__PURE__*/function(e){var n,t;function o(n,t,o){var r;return(r=e.call(this)||this)._style=void 0,r._latLng=void 0,r._onDraw=void 0,r._style=n,r._latLng=new google.maps.LatLng(t[0],t[1]),r.setCallbacks(o),r}t=e,(n=o).prototype=Object.create(t.prototype),n.prototype.constructor=n,f(n,t);var r=o.prototype;return r.setCallbacks=function(e){this.onAdd=e[0]||h,this._onDraw=e[1]||h,this.onRemove=e[2]||h},r.setCoords=function(e){this._latLng=new google.maps.LatLng(e[0],e[1]),this.draw()},r.draw=function(){var e=this.getProjection().fromLatLngToDivPixel(this._latLng);if(e){var n=e.x,t=e.y,o=this._style;o.left=n+"px",o.top=t+"px",this._onDraw(n,t)}},o}(google.maps.OverlayView)});var G=n.forwardRef(function(e,t){var o=e.lat,a=e.lng,u=e.onAdd,l=e.onDraw,c=e.onRemove,s=e.component,f=void 0===s?"div":s,p=e.mapPaneLayer,v=void 0===p?"overlayMouseTarget":p,E=e.preventMapDragging,h=g(e,S),_=C(),A=n.useRef({}),m=[o,a],O=[u,l,c],N=n.useCallback(function(e){var n=A.current,o=_.__blockingOverlayViews;if(e){if(n.el!==e){var r;null==(r=n.overlay)||r.setMap(null),n.el=e,E&&o.add(e);var a=e.style;a.position="absolute";var u=new D(a,m,O);n.overlay=u,u.setMap(_)}}else n.overlay&&(n.overlay.setMap(null),E&&o.delete(n.el),delete n.el,delete n.overlay);!function(e,n){e&&("object"==typeof e?e.current=n:e(n))}(t,e)},[t]);return n.useEffect(function(){var e=A.current,n=e.overlay;e.isNotFirstRender&&n&&n.setCallbacks(O)},O),n.useEffect(function(){var e,n=A.current;n.isNotFirstRender?null==(e=n.overlay)||e.setCoords(m):n.isNotFirstRender=!0},m),r.createPortal(i.default.createElement(f,d({ref:N},h)),_.__gm.panes[v])}),M=function(){var e;if(null!=(e=c.default.options.libraries)&&e.includes("places"))return new google.maps.places.AutocompleteService;throw Error("Places library not loaded")},I=function(e){var n;if(void 0===e&&(e=null),null!=(n=c.default.options.libraries)&&n.includes("places"))return new google.maps.places.PlacesService(e);throw Error("Places library not loaded")};Object.defineProperty(e,"Loader",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(e,"LoaderStatus",{enumerable:!0,get:function(){return o.LoaderStatus}}),e.GoogleMapLoader=function(e){var n=L(e),t=e.children;return t?i.default.createElement(y.Provider,{value:n},t):null},e.OverlayView=G,e.createGoogleMapComponent=m,e.createMarkerComponent=N,e.useAutocompleteService=function(e){var t=n.useState(function(){return c.default.status===o.LoaderStatus.LOADED?M():void 0}),r=t[0],a=t[1];return n.useEffect(function(){r||(e?c.default.load():c.default.completion).then(function(){return a(M())})},[]),r},e.useGoogleMap=C,e.useGoogleMapLoader=L,e.useGoogleMapStatus=function(){return n.useContext(y)},e.useMarkerCluster=function(e,t,o){var r,a,u=(r=function(){return new s.default(t,o)},(a=n.useRef()).current||(a.current=r())),i=n.useState([]),l=i[0][0],c=i[1],d=n.useRef();return n.useEffect(function(){return function(){return u.cleanUp()}},[]),n.useEffect(function(){var n=function(){var e=d.current;e&&c([function(){return u.getPoints.apply(u,e.concat([].slice.call(arguments)))}])};if(null!=o&&o.asyncMode)return u.loadAsync(e).then(n),function(){var n;e!==u.points&&(null==(n=u.worker)||n.terminate(),u.worker=void 0)};u.load(e),n()},[e]),{handleBoundsChange:function(e,n){var t=e.getSouthWest(),o=e.getNorthEast(),r=[n.getZoom(),t.lng(),t.lat(),o.lng(),o.lat()];d.current=r,u.points&&c([function(e,n,t){return u.getPoints.apply(u,r.concat([e,n,t]))}])},getPoints:l,markerCluster:u}},e.usePlacesService=function(e,t){void 0===t&&(t=null);var r=n.useState(function(){return"function"!=typeof t&&c.default.status===o.LoaderStatus.LOADED?I(t):void 0}),a=r[0],u=r[1];return n.useEffect(function(){a||(e?c.default.load():c.default.completion).then(function(){return u(I("function"!=typeof t?t:t()))})},[]),a}}); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("react"),require("fast-deep-equal"),require("google-maps-js-api-loader"),require("react-dom"),require("marker-cluster")):"function"==typeof define&&define.amd?define(["exports","react","fast-deep-equal","google-maps-js-api-loader","react-dom","marker-cluster"],n):n((e||self).googleMapsJsApiReact={},e.react,e.fastDeepEqual,e.googleMapsJsApiLoader,e.reactDom,e.markerCluster)}(this,function(e,n,t,o,r,a){function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=/*#__PURE__*/u(n),l=/*#__PURE__*/u(t),c=/*#__PURE__*/u(o),s=/*#__PURE__*/u(a);function d(){return d=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},d.apply(this,arguments)}function f(e,n){return f=Object.setPrototypeOf||function(e,n){return e.__proto__=n,e},f(e,n)}function g(e,n){if(null==e)return{};var t,o,r={},a=Object.keys(e);for(o=0;o<a.length;o++)n.indexOf(t=a[o])>=0||(r[t]=e[t]);return r}var p,C=n.createContext(null),E=function(){return n.useContext(C)};!function(e){e.CLICK="click",e.CONTEXT_MENU="contextmenu",e.DOUBLE_CLICK="dblclick",e.DRAG="drag",e.DRAG_END="dragend",e.DRAG_START="dragstart",e.MOUSE_MOVE="mousemove",e.MOUSE_OUT="mouseout",e.MOUSE_OVER="mouseover",e.RIGHT_CLICK="rightclick",e.BOUNDS_CHANGED="bounds_changed",e.CENTER_CHANGED="center_changed",e.HEADING_CHANGED="heading_changed",e.IDLE="idle",e.MAP_TYPE_ID_CHANGED="maptypeid_changed",e.PROJECTION_CHANGED="projection_changed",e.RESIZE="resize",e.TILES_LOADED="tilesloaded",e.TILT_CHANGED="tilt_changed",e.ZOOM_CHANGED="zoom_changed",e.ANIMATION_CHANGED="animation_changed",e.CLICKABLE_CHANGED="clickable_changed",e.CURSOR_CHANGED="cursor_changed",e.DRAGGABLE_CHANGED="draggable_changed",e.FLAT_CHANGED="flat_changed",e.ICON_CHANGED="icon_changed",e.MOUSE_DOWN="mousedown",e.MOUSE_UP="mouseup",e.POSITION_CHANGED="position_changed",e.SHAPE_CHANGED="shape_changed",e.TITLE_CHANGED="title_changed",e.VISIBLE_CHANGED="visible_changed",e.Z_INDEX_CHANGED="zindex_changed"}(p||(p={}));var v=Object.freeze({onClick:p.CLICK,onDoubleClick:p.DOUBLE_CLICK,onDrag:p.DRAG,onDragEnd:p.DRAG_END,onDragStart:p.DRAG_START,onContextMenu:p.CONTEXT_MENU,onMouseMove:p.MOUSE_MOVE,onMouseOut:p.MOUSE_OUT,onMouseOver:p.MOUSE_OVER,onRightClick:p.RIGHT_CLICK,onBoundsChanged:p.BOUNDS_CHANGED,onCenterChanged:p.CENTER_CHANGED,onHeadingChanged:p.HEADING_CHANGED,onIdle:p.IDLE,onMapTypeIdChanged:p.MAP_TYPE_ID_CHANGED,onProjectionChanged:p.PROJECTION_CHANGED,onResize:p.RESIZE,onTilesLoaded:p.TILES_LOADED,onTiltChanged:p.TILT_CHANGED,onZoomChanged:p.ZOOM_CHANGED,onAnimationChanged:p.ANIMATION_CHANGED,onClickableChanged:p.CLICKABLE_CHANGED,onCursorChanged:p.CURSOR_CHANGED,onDraggableChanged:p.DRAGGABLE_CHANGED,onFlatChanged:p.FLAT_CHANGED,onIconChanged:p.ICON_CHANGED,onMouseDown:p.MOUSE_DOWN,onMouseUp:p.MOUSE_UP,onPositionChanged:p.POSITION_CHANGED,onShapeChanged:p.SHAPE_CHANGED,onTitleChanged:p.TITLE_CHANGED,onVisibleChanged:p.VISIBLE_CHANGED,onZIndexChanged:p.Z_INDEX_CHANGED}),h=function(){};function _(e,t){return void 0===t&&(t={}),function(o,r){return e(function(e,t,o){if(0===t.length&&0===e.length)return h;e=Array.from(new Set(e)).reverse();var r=(t=Array.from(new Set(t)).reverse()).length,a=function(e,o){var a=n.useRef([]);n.useEffect(function(){var n=e.current;if(n){var u=a.current;if(u.length)for(var i=r;i--;){var c=t[i],s=o[c];l.default(s,u[i])||(n.set(c,s),u[i]=s)}else for(var d=r;d--;)u[d]=o[t[d]]}})};if(0===e.length)return a;var u=function(t,r){for(var a=function(a){var u=e[a],i=r[u];n.useEffect(function(){var e=t.current;if(e&&i){var n=o[u],r=e.addListener(v[u],n?function(){i.apply(void 0,[this.get(n)].concat([].slice.call(arguments),[this]))}:function(){i.apply(void 0,[].slice.call(arguments).concat([this]))});return function(){return r.remove()}}},[i])},u=e.length;u--;)a(u)};if(0===r)return u;for(var i=[],c=e.length;c--;){var s=e[c],d=o[s];d&&t.includes(d)&&(i.push(s),e.splice(c,1))}var f=i.length;return 0===f?function(e,n){u(e,n),a(e,n)}:(0===e.length&&(u=h),function(e,a){var c=n.useRef({isTriggeredBySetStateMap:new Map,prevStateArr:[]});u(e,a);for(var s=c.current.isTriggeredBySetStateMap,d=function(t){var r=i[t],u=a[r];n.useEffect(function(){var n=e.current;if(n&&u){var t=o[r],a=n.addListener(v[r],function(){s.has(t)?s.delete(t):u.apply(void 0,[this.get(t)].concat([].slice.call(arguments),[this]))});return function(){return a.remove()}}},[u])},g=f;g--;)d(g);n.useEffect(function(){var n=e.current;if(n){var o=c.current.prevStateArr;if(o.length)for(var u=r;u--;){var i=t[u],d=a[i];l.default(d,o[u])||(s.set(i,!0),n.set(i,d),o[u]=d)}else for(var f=r;f--;)o[f]=a[t[f]]}})})}(o,r,t))}}var D,A=["children","className","style","defaultOptions","onMount","onUnmount"],m=_(function(e){return function(t){var o=t.children,r=t.className,a=t.style,u=t.defaultOptions,l=t.onMount,c=t.onUnmount,s=g(t,A),f=n.useRef(null),p=n.useRef(),E=n.useState(),v=E[0],_=E[1];return n.useEffect(function(){var e=new google.maps.Map(f.current,d({},u,s));return p.current=e,google.maps.event.addListenerOnce(e,"idle",function(){_(e),(l||h)(e)}),c},[]),e(p,s),i.default.createElement("div",{ref:f,className:r,style:a},o&&v&&i.default.createElement(C.Provider,{value:v},"function"==typeof o?o(v):o))}},{onCenterChanged:"center",onHeadingChanged:"heading",onMapTypeIdChanged:"mapTypeId",onTiltChanged:"tilt",onZoomChanged:"zoom",onBoundsChanged:"bounds"}),N=["defaultOptions","onMount","onUnmount"],O=_(function(e){return function(t){var o=t.defaultOptions,r=t.onMount,a=t.onUnmount,u=g(t,N),i=E(),l=n.useRef();return n.useEffect(function(){var e=new google.maps.Marker(d({map:i},o,u));return l.current=e,(r||h)(e),function(){e.setMap(null),(a||h)()}},[]),e(l,u),null}},{onAnimationChanged:"animation",onCursorChanged:"cursor",onDraggableChanged:"draggable",onIconChanged:"icon",onPositionChanged:"position",onShapeChanged:"shape",onTitleChanged:"title",onVisibleChanged:"visible",onZIndexChanged:"zIndex"}),L=function(e){void 0===e&&(e={});var t=n.useState(c.default.status),r=t[0],a=t[1];return n.useEffect(function(){r!==o.LoaderStatus.LOADED&&c.default.load().then(function(){a(o.LoaderStatus.LOADED),(e.onLoaded||h)()},function(n){a(o.LoaderStatus.ERROR),(e.onError||h)(n)})},[]),r},y=n.createContext(c.default.status),G=["lat","lng","onAdd","onDraw","onRemove","component","mapPaneLayer","preventMapDragging"];c.default.completion.then(function(){D=/*#__PURE__*/function(e){var n,t;function o(n,t,o){var r;return(r=e.call(this)||this)._style=void 0,r._latLng=void 0,r._onDraw=void 0,r._style=n,r._latLng=new google.maps.LatLng(t[0],t[1]),r.setCallbacks(o),r}t=e,(n=o).prototype=Object.create(t.prototype),n.prototype.constructor=n,f(n,t);var r=o.prototype;return r.setCallbacks=function(e){this.onAdd=e[0]||h,this._onDraw=e[1]||h,this.onRemove=e[2]||h},r.setCoords=function(e){this._latLng=new google.maps.LatLng(e[0],e[1]),this.draw()},r.draw=function(){var e=this.getProjection().fromLatLngToDivPixel(this._latLng);if(e){var n=e.x,t=e.y,o=this._style;o.left=n+"px",o.top=t+"px",this._onDraw(n,t)}},o}(google.maps.OverlayView)});var M=n.forwardRef(function(e,t){var o=e.lat,a=e.lng,u=e.onAdd,l=e.onDraw,c=e.onRemove,s=e.component,f=void 0===s?"div":s,p=e.mapPaneLayer,C=void 0===p?"overlayMouseTarget":p,v=e.preventMapDragging,h=g(e,G),_=E(),A=n.useRef({}),m=[o,a],N=[u,l,c],O=n.useCallback(function(e){var n=A.current;if(e){if(n.el!==e){var o;null==(o=n.overlay)||o.setMap(null),n.el=e,v&&e.addEventListener("mousedown",function(e){e.preventDefault(),e.stopPropagation()});var r=e.style;r.position="absolute";var a=new D(r,m,N);n.overlay=a,a.setMap(_)}}else n.overlay&&(n.overlay.setMap(null),delete n.el,delete n.overlay);!function(e,n){e&&("object"==typeof e?e.current=n:e(n))}(t,e)},[t]);return n.useEffect(function(){var e=A.current,n=e.overlay;e.isNotFirstRender&&n&&n.setCallbacks(N)},N),n.useEffect(function(){var e,n=A.current;n.isNotFirstRender?null==(e=n.overlay)||e.setCoords(m):n.isNotFirstRender=!0},m),r.createPortal(i.default.createElement(f,d({ref:O},h)),_.__gm.panes[C])}),S=function(){var e;if(null!=(e=c.default.options.libraries)&&e.includes("places"))return new google.maps.places.AutocompleteService;throw Error("Places library not loaded")},I=function(e){var n;if(void 0===e&&(e=null),null!=(n=c.default.options.libraries)&&n.includes("places"))return new google.maps.places.PlacesService(e);throw Error("Places library not loaded")};Object.defineProperty(e,"Loader",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(e,"LoaderStatus",{enumerable:!0,get:function(){return o.LoaderStatus}}),e.GoogleMapLoader=function(e){var n=L(e),t=e.children;return t?i.default.createElement(y.Provider,{value:n},t):null},e.OverlayView=M,e.createGoogleMapComponent=m,e.createMarkerComponent=O,e.useAutocompleteService=function(e){var t=n.useState(function(){return c.default.status===o.LoaderStatus.LOADED?S():void 0}),r=t[0],a=t[1];return n.useEffect(function(){r||(e?c.default.load():c.default.completion).then(function(){return a(S())})},[]),r},e.useGoogleMap=E,e.useGoogleMapLoader=L,e.useGoogleMapStatus=function(){return n.useContext(y)},e.useMarkerCluster=function(e,t,o){var r,a,u=(r=function(){return new s.default(t,o)},(a=n.useRef()).current||(a.current=r())),i=n.useState([]),l=i[0][0],c=i[1],d=n.useRef();return n.useEffect(function(){return function(){return u.cleanUp()}},[]),n.useEffect(function(){var n=function(){var e=d.current;e&&c([function(){return u.getPoints.apply(u,e.concat([].slice.call(arguments)))}])};if(null!=o&&o.asyncMode)return u.loadAsync(e).then(n),function(){var n;e!==u.points&&(null==(n=u.worker)||n.terminate(),u.worker=void 0)};u.load(e),n()},[e]),{handleBoundsChange:function(e,n){var t=e.getSouthWest(),o=e.getNorthEast(),r=[n.getZoom(),t.lng(),t.lat(),o.lng(),o.lat()];d.current=r,u.points&&c([function(e,n,t){return u.getPoints.apply(u,r.concat([e,n,t]))}])},getPoints:l,markerCluster:u}},e.usePlacesService=function(e,t){void 0===t&&(t=null);var r=n.useState(function(){return"function"!=typeof t&&c.default.status===o.LoaderStatus.LOADED?I(t):void 0}),a=r[0],u=r[1];return n.useEffect(function(){a||(e?c.default.load():c.default.completion).then(function(){return u(I("function"!=typeof t?t:t()))})},[]),a}}); | ||
//# sourceMappingURL=index.umd.js.map |
{ | ||
"name": "google-maps-js-api-react", | ||
"version": "1.2.2", | ||
"version": "1.2.3", | ||
"description": "Library for convenient work of Google Maps JavaScript API with React", | ||
@@ -5,0 +5,0 @@ "author": "Krombik", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
234168
407