UNPKG

@deatog/react-google-maps-api

Version:
1 lines 140 kB
import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import{createContext as r,useContext as s,memo as o,useState as i,useRef as a,useEffect as l,PureComponent as p,useMemo as h,Children as c,isValidElement as u,cloneElement as d,createRef as g}from"react";import*as m from"react-dom";import{createPortal as v}from"react-dom";function f(e){return f="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},f(e)}function y(e){var t=function(e,t){if("object"!=f(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=f(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==f(t)?t:t+""}function b(e,t,n){return(t=y(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function w(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var M,C;var x=w(function(){if(C)return M;C=1;var e=process.env.NODE_ENV;return M=function(t,n,r,s,o,i,a,l){if("production"!==e&&void 0===n)throw new Error("invariant requires an error message argument");if(!t){var p;if(void 0===n)p=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var h=[r,s,o,i,a,l],c=0;(p=new Error(n.replace(/%s/g,(function(){return h[c++]})))).name="Invariant Violation"}throw p.framesToPop=1,p}}}()),L=r(null);function k(){x(!!s,"useGoogleMap is React hook and requires React version 16.8+");var e=s(L);return x(!!e,"useGoogleMap needs a GoogleMap available up in the tree"),e}function P(e,t,n,r){var s,o,i={};return s=e,o=(e,s)=>{var o=n[s];o!==t[s]&&(i[s]=o,e(r,o))},Object.keys(s).forEach((e=>o(s[e],e))),i}function O(e,t,n){var r,s,o,i=(r=n,s=function(n,r,s){return"function"==typeof e[s]&&n.push(google.maps.event.addListener(t,r,e[s])),n},o=[],Object.keys(r).reduce((function(e,t){return s(e,r[t],t)}),o));return i}function E(e){google.maps.event.removeListener(e)}function S(){(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).forEach(E)}function D(e){var{updaterMap:t,eventMap:n,prevProps:r,nextProps:s,instance:o}=e,i=O(s,o,n);return P(t,r,s,o),i}var I={onDblClick:"dblclick",onDragEnd:"dragend",onDragStart:"dragstart",onMapTypeIdChanged:"maptypeid_changed",onMouseMove:"mousemove",onMouseOut:"mouseout",onMouseOver:"mouseover",onMouseDown:"mousedown",onMouseUp:"mouseup",onRightClick:"rightclick",onTilesLoaded:"tilesloaded",onBoundsChanged:"bounds_changed",onCenterChanged:"center_changed",onClick:"click",onDrag:"drag",onHeadingChanged:"heading_changed",onIdle:"idle",onProjectionChanged:"projection_changed",onResize:"resize",onTiltChanged:"tilt_changed",onZoomChanged:"zoom_changed"},j={extraMapTypes(e,t){t.forEach((function(t,n){e.mapTypes.set(String(n),t)}))},center(e,t){e.setCenter(t)},clickableIcons(e,t){e.setClickableIcons(t)},heading(e,t){e.setHeading(t)},mapTypeId(e,t){e.setMapTypeId(t)},options(e,t){e.setOptions(t)},streetView(e,t){e.setStreetView(t)},tilt(e,t){e.setTilt(t)},zoom(e,t){e.setZoom(t)}};o((function(t){var{children:n,options:r,id:s,mapContainerStyle:o,mapContainerClassName:p,center:h,onClick:c,onDblClick:u,onDrag:d,onDragEnd:g,onDragStart:m,onMouseMove:v,onMouseOut:f,onMouseOver:y,onMouseDown:b,onMouseUp:w,onRightClick:M,onCenterChanged:C,onLoad:x,onUnmount:k}=t,[P,O]=i(null),E=a(null);return l((()=>{r&&null!==P&&P.setOptions(r)}),[P,r]),l((()=>{null!==P&&void 0!==h&&P.setCenter(h)}),[P,h]),l((()=>{if(P&&u){var e=google.maps.event.addListener(P,"dblclick",u);return()=>{e.remove()}}}),[P,u]),l((()=>{if(P&&g){var e=google.maps.event.addListener(P,"dragend",g);return()=>{e.remove()}}}),[P,g]),l((()=>{if(P&&m){var e=google.maps.event.addListener(P,"dragstart",m);return()=>{e.remove()}}}),[P,m]),l((()=>{if(P&&b){var e=google.maps.event.addListener(P,"mousedown",b);return()=>{e.remove()}}}),[P,b]),l((()=>{if(P&&v){var e=google.maps.event.addListener(P,"mousemove",v);return()=>{e.remove()}}}),[P,v]),l((()=>{if(P&&f){var e=google.maps.event.addListener(P,"mouseout",f);return()=>{e.remove()}}}),[P,f]),l((()=>{if(P&&y){var e=google.maps.event.addListener(P,"mouseover",y);return()=>{e.remove()}}}),[P,y]),l((()=>{if(P&&w){var e=google.maps.event.addListener(P,"mouseup",w);return()=>{e.remove()}}}),[P,w]),l((()=>{if(P&&M){var e=google.maps.event.addListener(P,"rightclick",M);return()=>{e.remove()}}}),[P,M]),l((()=>{if(P&&c){var e=google.maps.event.addListener(P,"click",c);return()=>{e.remove()}}}),[P,c]),l((()=>{if(P&&d){var e=google.maps.event.addListener(P,"drag",d);return()=>{e.remove()}}}),[P,d]),l((()=>{if(P&&C){var e=google.maps.event.addListener(P,"center_changed",C);return()=>{e.remove()}}}),[c]),l((()=>{P&&x&&x(P)}),[P,x]),l((()=>{if(P&&k)return()=>{k(P)}}),[P,k]),l((()=>{var e=null===E.current?null:new google.maps.Map(E.current,r);O(e)}),[]),e("div",{id:s,ref:E,style:o,className:p,children:e(L.Provider,{value:P,children:null!==P?n:null})})}));class B extends p{constructor(){super(...arguments),b(this,"state",{map:null}),b(this,"registeredEvents",[]),b(this,"mapRef",null),b(this,"getInstance",(()=>null===this.mapRef?null:new google.maps.Map(this.mapRef,this.props.options))),b(this,"panTo",(e=>{var t=this.getInstance();t&&t.panTo(e)})),b(this,"setMapCallback",(()=>{null!==this.state.map&&this.props.onLoad&&this.props.onLoad(this.state.map)})),b(this,"getRef",(e=>{this.mapRef=e}))}componentDidMount(){var e=this.getInstance();this.registeredEvents=D({updaterMap:j,eventMap:I,prevProps:{},nextProps:this.props,instance:e}),this.setState((function(){return{map:e}}),this.setMapCallback)}componentDidUpdate(e){null!==this.state.map&&(S(this.registeredEvents),this.registeredEvents=D({updaterMap:j,eventMap:I,prevProps:e,nextProps:this.props,instance:this.state.map}))}componentWillUnmount(){null!==this.state.map&&(this.props.onUnmount&&this.props.onUnmount(this.state.map),S(this.registeredEvents))}render(){return e("div",{id:this.props.id,ref:this.getRef,style:this.props.mapContainerStyle,className:this.props.mapContainerClassName,children:e(L.Provider,{value:this.state.map,children:null!==this.state.map?this.props.children:null})})}}function T(e,t,n,r,s,o,i){try{var a=e[o](i),l=a.value}catch(e){return void n(e)}a.done?t(l):Promise.resolve(l).then(r,s)}function U(e){return function(){var t=this,n=arguments;return new Promise((function(r,s){var o=e.apply(t,n);function i(e){T(o,r,s,i,a,"next",e)}function a(e){T(o,r,s,i,a,"throw",e)}i(void 0)}))}}function z(e){var{googleMapsApiKey:t,googleMapsClientId:n,version:r="weekly",language:s,region:o,libraries:i,channel:a,mapIds:l,authReferrerPolicy:p,apiUrl:h="https://maps.googleapis.com"}=e,c=[];return x(t&&n||!(t&&n),"You need to specify either googleMapsApiKey or googleMapsClientId for @deatog/react-google-maps-api load script to work. You cannot use both at the same time."),t?c.push("key=".concat(t)):n&&c.push("client=".concat(n)),r&&c.push("v=".concat(r)),s&&c.push("language=".concat(s)),o&&c.push("region=".concat(o)),i&&i.length&&c.push("libraries=".concat(i.sort().join(","))),a&&c.push("channel=".concat(a)),l&&l.length&&c.push("map_ids=".concat(l.join(","))),p&&c.push("auth_referrer_policy=".concat(p)),c.push("loading=async"),c.push("callback=initMap"),"".concat(h,"/maps/api/js?").concat(c.join("&"))}var _="undefined"!=typeof document;function R(e){var{url:t,id:n,nonce:r}=e;return _?new Promise((function(e,s){var o=document.getElementById(n),i=window;if(o){var a=o.getAttribute("data-state");if(o.src===t&&"error"!==a){if("ready"===a)return e(n);var l=i.initMap,p=o.onerror;return i.initMap=function(){l&&l(),e(n)},void(o.onerror=function(e){p&&p(e),s(e)})}o.remove()}var h=document.createElement("script");h.type="text/javascript",h.src=t,h.id=n,h.async=!0,h.nonce=r||"",h.onerror=function(e){h.setAttribute("data-state","error"),s(e)},i.initMap=function(){h.setAttribute("data-state","ready"),e(n)},document.head.appendChild(h)})).catch((e=>{throw console.error("injectScript error: ",e),e})):Promise.reject(new Error("document is undefined"))}function A(e){var t=e.href;return!(!t||0!==t.indexOf("https://fonts.googleapis.com/css?family=Roboto")&&0!==t.indexOf("https://fonts.googleapis.com/css?family=Google+Sans+Text"))||("style"===e.tagName.toLowerCase()&&e.styleSheet&&e.styleSheet.cssText&&0===e.styleSheet.cssText.replace("\r\n","").indexOf(".gm-style")?(e.styleSheet.cssText="",!0):"style"===e.tagName.toLowerCase()&&e.innerHTML&&0===e.innerHTML.replace("\r\n","").indexOf(".gm-style")?(e.innerHTML="",!0):"style"===e.tagName.toLowerCase()&&!e.styleSheet&&!e.innerHTML)}function Z(){var e=document.getElementsByTagName("head")[0];if(e){var t=e.insertBefore.bind(e);e.insertBefore=function(n,r){return A(n)||Reflect.apply(t,e,[n,r]),n};var n=e.appendChild.bind(e);e.appendChild=function(t){return A(t)||Reflect.apply(n,e,[t]),t}}}var W=!1;function V(){return e("div",{children:"Loading..."})}var N,H={id:"script-loader",version:"weekly"};class G extends p{constructor(){super(...arguments),b(this,"check",null),b(this,"state",{loaded:!1}),b(this,"cleanupCallback",(()=>{delete window.google.maps,this.injectScript()})),b(this,"isCleaningUp",U((function*(){return new Promise((function(e){if(W){if(_)var t=window.setInterval((function(){W||(window.clearInterval(t),e())}),1)}else e()}))}))),b(this,"cleanup",(()=>{W=!0;var e=document.getElementById(this.props.id);e&&e.parentNode&&e.parentNode.removeChild(e),Array.prototype.slice.call(document.getElementsByTagName("script")).filter((function(e){return"string"==typeof e.src&&e.src.includes("maps.googleapis")})).forEach((function(e){e.parentNode&&e.parentNode.removeChild(e)})),Array.prototype.slice.call(document.getElementsByTagName("link")).filter((function(e){return"https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Google+Sans"===e.href})).forEach((function(e){e.parentNode&&e.parentNode.removeChild(e)})),Array.prototype.slice.call(document.getElementsByTagName("style")).filter((function(e){return void 0!==e.innerText&&e.innerText.length>0&&e.innerText.includes(".gm-")})).forEach((function(e){e.parentNode&&e.parentNode.removeChild(e)}))})),b(this,"injectScript",(()=>{this.props.preventGoogleFontsLoading&&Z(),x(!!this.props.id,'LoadScript requires "id" prop to be a string: %s',this.props.id),R({id:this.props.id,nonce:this.props.nonce,url:z(this.props)}).then((()=>{this.props.onLoad&&this.props.onLoad(),this.setState((function(){return{loaded:!0}}))})).catch((e=>{this.props.onError&&this.props.onError(e),console.error("\n There has been an Error with loading Google Maps API script, please check that you provided correct google API key (".concat(this.props.googleMapsApiKey||"-",") or Client ID (").concat(this.props.googleMapsClientId||"-",") to <LoadScript />\n Otherwise it is a Network issue.\n "))}))})),b(this,"getRef",(e=>{this.check=e}))}componentDidMount(){if(_){if(window.google&&window.google.maps&&!W)return void console.error("google api is already presented");this.isCleaningUp().then(this.injectScript).catch((function(e){console.error("Error at injecting script after cleaning up: ",e)}))}}componentDidUpdate(e){this.props.libraries!==e.libraries&&console.warn("Performance warning! LoadScript has been reloaded unintentionally! You should not pass `libraries` prop as new array. Please keep an array of libraries as static class property for Components and PureComponents, or just a const variable outside of component, or somewhere in config files or ENV variables"),_&&e.language!==this.props.language&&(this.cleanup(),this.setState((function(){return{loaded:!1}}),this.cleanupCallback))}componentWillUnmount(){if(_){this.cleanup();window.setTimeout((()=>{this.check||(delete window.google,W=!1)}),1),this.props.onUnmount&&this.props.onUnmount()}}render(){return t(n,{children:[e("div",{ref:this.getRef}),this.state.loaded?this.props.children:this.props.loadingElement||e(V,{})]})}}function F(e,t){if(null==e)return{};var n,r,s=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function K(e){var{id:t=H.id,version:n=H.version,nonce:r,googleMapsApiKey:s,googleMapsClientId:o,language:p,region:h,libraries:c,preventGoogleFontsLoading:u,channel:d,mapIds:g,authReferrerPolicy:m,apiUrl:v="https://maps.googleapis.com"}=e,f=a(!1),[y,b]=i(!1),[w,M]=i(void 0);l((function(){return f.current=!0,()=>{f.current=!1}}),[]),l((function(){_&&u&&Z()}),[u]),l((function(){y&&x(!!window.google,"useLoadScript was marked as loaded, but window.google is not present. Something went wrong.")}),[y]);var C=z({version:n,googleMapsApiKey:s,googleMapsClientId:o,language:p,region:h,libraries:c,channel:d,mapIds:g,authReferrerPolicy:m,apiUrl:v});l((function(){function e(){f.current&&(b(!0),N=C)}_&&(window.google&&window.google.maps&&N===C?e():R({id:t,url:C,nonce:r}).then(e).catch((function(e){f.current&&M(e),console.warn("\n There has been an Error with loading Google Maps API script, please check that you provided correct google API key (".concat(s||"-",") or Client ID (").concat(o||"-",")\n Otherwise it is a Network issue.\n ")),console.error(e)})))}),[t,C,r]);var L=a(void 0);return l((function(){L.current&&c!==L.current&&console.warn("Performance warning! LoadScript has been reloaded unintentionally! You should not pass `libraries` prop as new array. Please keep an array of libraries as static class property for Components and PureComponents, or just a const variable outside of component, or somewhere in config files or ENV variables"),L.current=c}),[c]),{isLoaded:y,loadError:w,url:C}}b(G,"defaultProps",H);var Y=["loadingElement","onLoad","onError","onUnmount","children"],q=e(V,{});var J=o((function(e){var{loadingElement:t,onLoad:n,onError:r,onUnmount:s,children:o}=e,i=F(e,Y),{isLoaded:a,loadError:p}=K(i);return l((function(){a&&"function"==typeof n&&n()}),[a,n]),l((function(){p&&"function"==typeof r&&r(p)}),[p,r]),l((function(){return()=>{s&&s()}}),[s]),a?o:t||q}));function X(e,t,n,r){return new(n||(n=Promise))((function(t,s){function o(e){try{a(r.next(e))}catch(e){s(e)}}function i(e){try{a(r.throw(e))}catch(e){s(e)}}function a(e){var r;e.done?t(e.value):(r=e.value,r instanceof n?r:new n((function(e){e(r)}))).then(o,i)}a((r=r.apply(e,[])).next())}))}function $(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}"function"==typeof SuppressedError&&SuppressedError;var Q,ee=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var r,s,o;if(Array.isArray(t)){if((r=t.length)!=n.length)return!1;for(s=r;0!=s--;)if(!e(t[s],n[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((r=(o=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(s=r;0!=s--;)if(!Object.prototype.hasOwnProperty.call(n,o[s]))return!1;for(s=r;0!=s--;){var i=o[s];if(!e(t[i],n[i]))return!1}return!0}return t!=t&&n!=n},te=$(ee),ne="__googleMapsScriptId";!function(e){e[e.INITIALIZED=0]="INITIALIZED",e[e.LOADING=1]="LOADING",e[e.SUCCESS=2]="SUCCESS",e[e.FAILURE=3]="FAILURE"}(Q||(Q={}));class re{constructor(e){var{apiKey:t,authReferrerPolicy:n,channel:r,client:s,id:o=ne,language:i,libraries:a=[],mapIds:l,nonce:p,region:h,retries:c=3,url:u="https://maps.googleapis.com/maps/api/js",version:d}=e;if(this.callbacks=[],this.done=!1,this.loading=!1,this.errors=[],this.apiKey=t,this.authReferrerPolicy=n,this.channel=r,this.client=s,this.id=o||ne,this.language=i,this.libraries=a,this.mapIds=l,this.nonce=p,this.region=h,this.retries=c,this.url=u,this.version=d,re.instance){if(!te(this.options,re.instance.options))throw new Error("Loader must not be called again with different options. ".concat(JSON.stringify(this.options)," !== ").concat(JSON.stringify(re.instance.options)));return re.instance}re.instance=this}get options(){return{version:this.version,apiKey:this.apiKey,channel:this.channel,client:this.client,id:this.id,libraries:this.libraries,language:this.language,region:this.region,mapIds:this.mapIds,nonce:this.nonce,url:this.url,authReferrerPolicy:this.authReferrerPolicy}}get status(){return this.errors.length?Q.FAILURE:this.done?Q.SUCCESS:this.loading?Q.LOADING:Q.INITIALIZED}get failed(){return this.done&&!this.loading&&this.errors.length>=this.retries+1}createUrl(){var e=this.url;return e+="?callback=__googleMapsCallback&loading=async",this.apiKey&&(e+="&key=".concat(this.apiKey)),this.channel&&(e+="&channel=".concat(this.channel)),this.client&&(e+="&client=".concat(this.client)),this.libraries.length>0&&(e+="&libraries=".concat(this.libraries.join(","))),this.language&&(e+="&language=".concat(this.language)),this.region&&(e+="&region=".concat(this.region)),this.version&&(e+="&v=".concat(this.version)),this.mapIds&&(e+="&map_ids=".concat(this.mapIds.join(","))),this.authReferrerPolicy&&(e+="&auth_referrer_policy=".concat(this.authReferrerPolicy)),e}deleteScript(){var e=document.getElementById(this.id);e&&e.remove()}load(){return this.loadPromise()}loadPromise(){return new Promise(((e,t)=>{this.loadCallback((n=>{n?t(n.error):e(window.google)}))}))}importLibrary(e){return this.execute(),google.maps.importLibrary(e)}loadCallback(e){this.callbacks.push(e),this.execute()}setScript(){var e,t;if(document.getElementById(this.id))this.callback();else{var n={key:this.apiKey,channel:this.channel,client:this.client,libraries:this.libraries.length&&this.libraries,v:this.version,mapIds:this.mapIds,language:this.language,region:this.region,authReferrerPolicy:this.authReferrerPolicy};Object.keys(n).forEach((e=>!n[e]&&delete n[e])),(null===(t=null===(e=null===window||void 0===window?void 0:window.google)||void 0===e?void 0:e.maps)||void 0===t?void 0:t.importLibrary)||(e=>{var t,n,r,s="The Google Maps JavaScript API",o="google",i="importLibrary",a="__ib__",l=document,p=window,h=(p=p[o]||(p[o]={})).maps||(p.maps={}),c=new Set,u=new URLSearchParams,d=()=>t||(t=new Promise(((i,p)=>X(this,0,void 0,(function*(){var d;for(r in yield n=l.createElement("script"),n.id=this.id,u.set("libraries",[...c]+""),e)u.set(r.replace(/[A-Z]/g,(e=>"_"+e[0].toLowerCase())),e[r]);u.set("callback",o+".maps."+a),n.src=this.url+"?"+u,h[a]=i,n.onerror=()=>t=p(Error(s+" could not load.")),n.nonce=this.nonce||(null===(d=l.querySelector("script[nonce]"))||void 0===d?void 0:d.nonce)||"",l.head.append(n)})))));h[i]?console.warn(s+" only loads once. Ignoring:",e):h[i]=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return c.add(e)&&d().then((()=>h[i](e,...n)))}})(n);var r=this.libraries.map((e=>this.importLibrary(e)));r.length||r.push(this.importLibrary("core")),Promise.all(r).then((()=>this.callback()),(e=>{var t=new ErrorEvent("error",{error:e});this.loadErrorCallback(t)}))}}reset(){this.deleteScript(),this.done=!1,this.loading=!1,this.errors=[],this.onerrorEvent=null}resetIfRetryingFailed(){this.failed&&this.reset()}loadErrorCallback(e){if(this.errors.push(e),this.errors.length<=this.retries){var t=this.errors.length*Math.pow(2,this.errors.length);console.error("Failed to load Google Maps script, retrying in ".concat(t," ms.")),setTimeout((()=>{this.deleteScript(),this.setScript()}),t)}else this.onerrorEvent=e,this.callback()}callback(){this.done=!0,this.loading=!1,this.callbacks.forEach((e=>{e(this.onerrorEvent)})),this.callbacks=[]}execute(){if(this.resetIfRetryingFailed(),!this.loading)if(this.done)this.callback();else{if(window.google&&window.google.maps&&window.google.maps.version)return console.warn("Google Maps already loaded outside @googlemaps/js-api-loader. This may result in undesirable behavior as options and script parameters may not match."),void this.callback();this.loading=!0,this.setScript()}}}var se=["maps"];function oe(e){var{id:t=H.id,version:n=H.version,nonce:r,googleMapsApiKey:s,language:o,region:p,libraries:c=se,preventGoogleFontsLoading:u,mapIds:d,authReferrerPolicy:g}=e,m=a(!1),[v,f]=i(!1),[y,b]=i(void 0);l((function(){return m.current=!0,()=>{m.current=!1}}),[]);var w=h((()=>new re({id:t,apiKey:s,version:n,libraries:c,language:o||"en",region:p||"US",mapIds:d||[],nonce:r||"",authReferrerPolicy:g||"origin"})),[t,s,n,c,o,p,d,r,g]);l((function(){v||w.load().then((()=>{m.current&&f(!0)})).catch((e=>{b(e)}))}),[]),l((()=>{_&&u&&Z()}),[u]);var M=a();return l((()=>{M.current&&c!==M.current&&console.warn("Performance warning! LoadScript has been reloaded unintentionally! You should not pass `libraries` prop as new array. Please keep an array of libraries as static class property for Components and PureComponents, or just a const variable outside of component, or somewhere in config files or ENV variables"),M.current=c}),[c]),{isLoaded:v,loadError:y}}function ie(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ae(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ie(Object(n),!0).forEach((function(t){b(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ie(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var le={},pe={options(e,t){e.setOptions(t)}};var he=o((function(e){var{options:t,onLoad:n,onUnmount:r}=e,o=s(L),[a,p]=i(null);return l((()=>{null!==a&&a.setMap(o)}),[o]),l((()=>{t&&null!==a&&a.setOptions(t)}),[a,t]),l((()=>{var e=new google.maps.TrafficLayer(ae(ae({},t),{},{map:o}));return p(e),n&&n(e),()=>{null!==a&&(r&&r(a),a.setMap(null))}}),[]),null}));class ce extends p{constructor(){super(...arguments),b(this,"state",{trafficLayer:null}),b(this,"setTrafficLayerCallback",(()=>{null!==this.state.trafficLayer&&this.props.onLoad&&this.props.onLoad(this.state.trafficLayer)})),b(this,"registeredEvents",[])}componentDidMount(){var e=new google.maps.TrafficLayer(ae(ae({},this.props.options),{},{map:this.context}));this.registeredEvents=D({updaterMap:pe,eventMap:le,prevProps:{},nextProps:this.props,instance:e}),this.setState((function(){return{trafficLayer:e}}),this.setTrafficLayerCallback)}componentDidUpdate(e){null!==this.state.trafficLayer&&(S(this.registeredEvents),this.registeredEvents=D({updaterMap:pe,eventMap:le,prevProps:e,nextProps:this.props,instance:this.state.trafficLayer}))}componentWillUnmount(){null!==this.state.trafficLayer&&(this.props.onUnmount&&this.props.onUnmount(this.state.trafficLayer),S(this.registeredEvents),this.state.trafficLayer.setMap(null))}render(){return null}}b(ce,"contextType",L);var ue=o((function(e){var{onLoad:t,onUnmount:n}=e,r=s(L),[o,a]=i(null);return l((()=>{null!==o&&o.setMap(r)}),[r]),l((()=>{var e=new google.maps.BicyclingLayer;return a(e),e.setMap(r),t&&t(e),()=>{null!==e&&(n&&n(e),e.setMap(null))}}),[]),null}));class de extends p{constructor(){super(...arguments),b(this,"state",{bicyclingLayer:null}),b(this,"setBicyclingLayerCallback",(()=>{null!==this.state.bicyclingLayer&&(this.state.bicyclingLayer.setMap(this.context),this.props.onLoad&&this.props.onLoad(this.state.bicyclingLayer))}))}componentDidMount(){var e=new google.maps.BicyclingLayer;this.setState((()=>({bicyclingLayer:e})),this.setBicyclingLayerCallback)}componentWillUnmount(){null!==this.state.bicyclingLayer&&(this.props.onUnmount&&this.props.onUnmount(this.state.bicyclingLayer),this.state.bicyclingLayer.setMap(null))}render(){return null}}b(de,"contextType",L);var ge=o((function(e){var{onLoad:t,onUnmount:n}=e,r=s(L),[o,a]=i(null);return l((()=>{null!==o&&o.setMap(r)}),[r]),l((()=>{var e=new google.maps.TransitLayer;return a(e),e.setMap(r),t&&t(e),()=>{null!==o&&(n&&n(o),o.setMap(null))}}),[]),null}));class me extends p{constructor(){super(...arguments),b(this,"state",{transitLayer:null}),b(this,"setTransitLayerCallback",(()=>{null!==this.state.transitLayer&&(this.state.transitLayer.setMap(this.context),this.props.onLoad&&this.props.onLoad(this.state.transitLayer))}))}componentDidMount(){var e=new google.maps.TransitLayer;this.setState((function(){return{transitLayer:e}}),this.setTransitLayerCallback)}componentWillUnmount(){null!==this.state.transitLayer&&(this.props.onUnmount&&this.props.onUnmount(this.state.transitLayer),this.state.transitLayer.setMap(null))}render(){return null}}function ve(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function fe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ve(Object(n),!0).forEach((function(t){b(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ve(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}b(me,"contextType",L);var ye={onCircleComplete:"circlecomplete",onMarkerComplete:"markercomplete",onOverlayComplete:"overlaycomplete",onPolygonComplete:"polygoncomplete",onPolylineComplete:"polylinecomplete",onRectangleComplete:"rectanglecomplete"},be={drawingMode(e,t){e.setDrawingMode(t)},options(e,t){e.setOptions(t)}};var we=o((function(e){var{options:t,drawingMode:n,onCircleComplete:r,onMarkerComplete:o,onOverlayComplete:i,onPolygonComplete:a,onPolylineComplete:p,onRectangleComplete:c,onLoad:u,onUnmount:d}=e,g=s(L),m=h((()=>(x(!!google.maps.drawing,"Did you include prop libraries={['drawing']} in the URL? %s",google.maps.drawing),new google.maps.drawing.DrawingManager(fe(fe({},t),{},{map:g})))),[]);return l((()=>{if(g)return m.setMap(g),()=>{m.setMap(null)}}),[m,g]),l((()=>{t&&m.setOptions(t)}),[m,t]),l((()=>{m.setDrawingMode(null!=n?n:null)}),[m,n]),l((()=>{if(r){var e=google.maps.event.addListener(m,"circlecomplete",r);return()=>{e.remove()}}}),[m,r]),l((()=>{if(o){var e=google.maps.event.addListener(m,"markercomplete",o);return()=>{e.remove()}}}),[m,o]),l((()=>{if(i){var e=google.maps.event.addListener(m,"overlaycomplete",i);return()=>{e.remove()}}}),[m,i]),l((()=>{if(a){var e=google.maps.event.addListener(m,"polygoncomplete",a);return()=>{e.remove()}}}),[m,a]),l((()=>{if(p){var e=google.maps.event.addListener(m,"polylinecomplete",p);return()=>{e.remove()}}}),[m,p]),l((()=>{if(c){var e=google.maps.event.addListener(m,"rectanglecomplete",c);return()=>{e.remove()}}}),[m,c]),l((()=>{u&&u(m)}),[m,u]),l((()=>{if(d)return()=>{d(m)}}),[m,d]),null}));class Me extends p{constructor(e){super(e),b(this,"registeredEvents",[]),b(this,"state",{drawingManager:null}),b(this,"setDrawingManagerCallback",(()=>{null!==this.state.drawingManager&&this.props.onLoad&&this.props.onLoad(this.state.drawingManager)})),x(!!google.maps.drawing,"Did you include prop libraries={['drawing']} in the URL? %s",google.maps.drawing)}componentDidMount(){var e=new google.maps.drawing.DrawingManager(fe(fe({},this.props.options),{},{map:this.context}));this.registeredEvents=D({updaterMap:be,eventMap:ye,prevProps:{},nextProps:this.props,instance:e}),this.setState((function(){return{drawingManager:e}}),this.setDrawingManagerCallback)}componentDidUpdate(e){null!==this.state.drawingManager&&(S(this.registeredEvents),this.registeredEvents=D({updaterMap:be,eventMap:ye,prevProps:e,nextProps:this.props,instance:this.state.drawingManager}))}componentWillUnmount(){null!==this.state.drawingManager&&(this.props.onUnmount&&this.props.onUnmount(this.state.drawingManager),S(this.registeredEvents),this.state.drawingManager.setMap(null))}render(){return null}}function Ce(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function xe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ce(Object(n),!0).forEach((function(t){b(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ce(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}b(Me,"contextType",L);var Le={onAnimationChanged:"animation_changed",onClick:"click",onClickableChanged:"clickable_changed",onCursorChanged:"cursor_changed",onDblClick:"dblclick",onDrag:"drag",onDragEnd:"dragend",onDraggableChanged:"draggable_changed",onDragStart:"dragstart",onFlatChanged:"flat_changed",onIconChanged:"icon_changed",onMouseDown:"mousedown",onMouseOut:"mouseout",onMouseOver:"mouseover",onMouseUp:"mouseup",onPositionChanged:"position_changed",onRightClick:"rightclick",onShapeChanged:"shape_changed",onTitleChanged:"title_changed",onVisibleChanged:"visible_changed",onZindexChanged:"zindex_changed"},ke={animation(e,t){e.setAnimation(t)},clickable(e,t){e.setClickable(t)},cursor(e,t){e.setCursor(t)},draggable(e,t){e.setDraggable(t)},icon(e,t){e.setIcon(t)},label(e,t){e.setLabel(t)},map(e,t){e.setMap(t)},opacity(e,t){e.setOpacity(t)},options(e,t){e.setOptions(t)},position(e,t){e.setPosition(t)},shape(e,t){e.setShape(t)},title(e,t){e.setTitle(t)},visible(e,t){e.setVisible(t)},zIndex(e,t){e.setZIndex(t)}},Pe={};var Oe=o((function(t){var{position:r,options:o,clusterer:i,noClustererRedraw:a,children:p,draggable:g,visible:m,animation:v,clickable:f,cursor:y,icon:b,label:w,opacity:M,shape:C,title:x,zIndex:k,onClick:P,onDblClick:O,onDrag:E,onDragEnd:S,onDragStart:D,onMouseOut:I,onMouseOver:j,onMouseUp:B,onMouseDown:T,onRightClick:U,onClickableChanged:z,onCursorChanged:_,onAnimationChanged:R,onDraggableChanged:A,onFlatChanged:Z,onIconChanged:W,onPositionChanged:V,onShapeChanged:N,onTitleChanged:H,onVisibleChanged:G,onZindexChanged:F,onLoad:K,onUnmount:Y}=t,q=s(L),J=h((()=>{var e=xe(xe(xe({},o||Pe),i?Pe:{map:q}),{},{position:r});return new google.maps.Marker(e)}),[]);l((()=>{o&&J.setOptions(o)}),[J,o]),l((()=>{void 0!==g&&J.setDraggable(g)}),[J,g]),l((()=>{r&&J.setPosition(r)}),[J,r]),l((()=>{void 0!==m&&J.setVisible(m)}),[J,m]),l((()=>{J.setAnimation(v)}),[J,v]),l((()=>{void 0!==f&&J.setClickable(f)}),[J,f]),l((()=>{void 0!==y&&J.setCursor(y)}),[J,y]),l((()=>{void 0!==b&&J.setIcon(b)}),[J,b]),l((()=>{void 0!==w&&J.setLabel(w)}),[J,w]),l((()=>{void 0!==M&&J.setOpacity(M)}),[J,M]),l((()=>{void 0!==C&&J.setShape(C)}),[J,C]),l((()=>{void 0!==x&&J.setTitle(x)}),[J,x]),l((()=>{void 0!==k&&J.setZIndex(k)}),[J,k]),l((()=>{if(O){var e=google.maps.event.addListener(J,"dblclick",O);return()=>{e.remove()}}}),[J,O]),l((()=>{if(S){var e=google.maps.event.addListener(J,"dragend",S);return()=>{e.remove()}}}),[J,S]),l((()=>{if(D){var e=google.maps.event.addListener(J,"dragstart",D);return()=>{e.remove()}}}),[J,D]),l((()=>{if(T){var e=google.maps.event.addListener(J,"mousedown",T);return()=>{e.remove()}}}),[J,T]),l((()=>{if(I){var e=google.maps.event.addListener(J,"mouseout",I);return()=>{e.remove()}}}),[J,I]),l((()=>{if(j){var e=google.maps.event.addListener(J,"mouseover",j);return()=>{e.remove()}}}),[J,j]),l((()=>{if(B){var e=google.maps.event.addListener(J,"mouseup",B);return()=>{e.remove()}}}),[J,B]),l((()=>{if(U){var e=google.maps.event.addListener(J,"rightclick",U);return()=>{e.remove()}}}),[J,U]),l((()=>{if(P){var e=google.maps.event.addListener(J,"click",P);return()=>{e.remove()}}}),[J,P]),l((()=>{if(E){var e=google.maps.event.addListener(J,"drag",E);return()=>{e.remove()}}}),[J,E]),l((()=>{if(z){var e=google.maps.event.addListener(J,"clickable_changed",z);return()=>{e.remove()}}}),[J,z]),l((()=>{if(_){var e=google.maps.event.addListener(J,"cursor_changed",_);return()=>{e.remove()}}}),[J,_]),l((()=>{if(R){var e=google.maps.event.addListener(J,"animation_changed",R);return()=>{e.remove()}}}),[J,R]),l((()=>{if(A){var e=google.maps.event.addListener(J,"draggable_changed",A);return()=>{e.remove()}}}),[J,A]),l((()=>{if(Z){var e=google.maps.event.addListener(J,"flat_changed",Z);return()=>{e.remove()}}}),[J,Z]),l((()=>{if(W){var e=google.maps.event.addListener(J,"icon_changed",W);return()=>{e.remove()}}}),[J,W]),l((()=>{if(V){var e=google.maps.event.addListener(J,"position_changed",V);return()=>{e.remove()}}}),[J,V]),l((()=>{if(N){var e=google.maps.event.addListener(J,"shape_changed",N);return()=>{e.remove()}}}),[J,N]),l((()=>{if(H){var e=google.maps.event.addListener(J,"title_changed",H);return()=>{e.remove()}}}),[J,H]),l((()=>{if(G){var e=google.maps.event.addListener(J,"visible_changed",G);return()=>{e.remove()}}}),[J,G]),l((()=>{if(F){var e=google.maps.event.addListener(J,"zindex_changed",F);return()=>{e.remove()}}}),[J,F]),l((()=>(i?i.addMarker(J,!!a):J.setMap(q),()=>{i?i.removeMarker(J,!!a):J.setMap(null)})),[J,q,i,a]),l((()=>{K&&K(J)}),[J,K]),l((()=>{Y&&Y(J)}),[J,Y]);var X=h((()=>p?c.map(p,(e=>u(e)?d(e,{anchor:J}):e)):null),[p,J]);return e(n,{children:X})||null}));class Ee extends p{constructor(){super(...arguments),b(this,"registeredEvents",[])}componentDidMount(){var e=this;return U((function*(){var t=xe(xe(xe({},e.props.options||Pe),e.props.clusterer?Pe:{map:e.context}),{},{position:e.props.position});e.marker=new google.maps.Marker(t),e.props.clusterer?e.props.clusterer.addMarker(e.marker,!!e.props.noClustererRedraw):e.marker.setMap(e.context),e.registeredEvents=D({updaterMap:ke,eventMap:Le,prevProps:{},nextProps:e.props,instance:e.marker}),e.props.onLoad&&e.props.onLoad(e.marker)}))()}componentDidUpdate(e){this.marker&&(S(this.registeredEvents),this.registeredEvents=D({updaterMap:ke,eventMap:Le,prevProps:e,nextProps:this.props,instance:this.marker}))}componentWillUnmount(){this.marker&&(this.props.onUnmount&&this.props.onUnmount(this.marker),S(this.registeredEvents),this.props.clusterer?this.props.clusterer.removeMarker(this.marker,!!this.props.noClustererRedraw):this.marker&&this.marker.setMap(null))}render(){return(this.props.children?c.map(this.props.children,(e=>u(e)?d(e,{anchor:this.marker}):e)):null)||null}}b(Ee,"contextType",L);var Se=function(){function e(t,n){t.getClusterer().extend(e,google.maps.OverlayView),this.cluster=t,this.clusterClassName=this.cluster.getClusterer().getClusterClass(),this.className=this.clusterClassName,this.styles=n,this.center=void 0,this.div=null,this.sums=null,this.visible=!1,this.boundsChangedListener=null,this.url="",this.height=0,this.width=0,this.anchorText=[0,0],this.anchorIcon=[0,0],this.textColor="black",this.textSize=11,this.textDecoration="none",this.fontWeight="bold",this.fontStyle="normal",this.fontFamily="Arial,sans-serif",this.backgroundPosition="0 0",this.cMouseDownInCluster=null,this.cDraggingMapByCluster=null,this.timeOut=null,this.setMap(t.getMap()),this.onBoundsChanged=this.onBoundsChanged.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this.onClick=this.onClick.bind(this),this.onMouseOver=this.onMouseOver.bind(this),this.onMouseOut=this.onMouseOut.bind(this),this.onAdd=this.onAdd.bind(this),this.onRemove=this.onRemove.bind(this),this.draw=this.draw.bind(this),this.hide=this.hide.bind(this),this.show=this.show.bind(this),this.useStyle=this.useStyle.bind(this),this.setCenter=this.setCenter.bind(this),this.getPosFromLatLng=this.getPosFromLatLng.bind(this)}return e.prototype.onBoundsChanged=function(){this.cDraggingMapByCluster=this.cMouseDownInCluster},e.prototype.onMouseDown=function(){this.cMouseDownInCluster=!0,this.cDraggingMapByCluster=!1},e.prototype.onClick=function(e){if(this.cMouseDownInCluster=!1,!this.cDraggingMapByCluster){var t=this.cluster.getClusterer();if(google.maps.event.trigger(t,"click",this.cluster),google.maps.event.trigger(t,"clusterclick",this.cluster),t.getZoomOnClick()){var n=t.getMaxZoom(),r=this.cluster.getBounds(),s=t.getMap();null!==s&&"fitBounds"in s&&s.fitBounds(r),this.timeOut=window.setTimeout((function(){var e=t.getMap();if(null!==e){"fitBounds"in e&&e.fitBounds(r);var s=e.getZoom()||0;null!==n&&s>n&&e.setZoom(n+1)}}),100)}e.cancelBubble=!0,e.stopPropagation&&e.stopPropagation()}},e.prototype.onMouseOver=function(){google.maps.event.trigger(this.cluster.getClusterer(),"mouseover",this.cluster)},e.prototype.onMouseOut=function(){google.maps.event.trigger(this.cluster.getClusterer(),"mouseout",this.cluster)},e.prototype.onAdd=function(){var e;this.div=document.createElement("div"),this.div.className=this.className,this.visible&&this.show(),null===(e=this.getPanes())||void 0===e||e.overlayMouseTarget.appendChild(this.div);var t=this.getMap();null!==t&&(this.boundsChangedListener=google.maps.event.addListener(t,"bounds_changed",this.onBoundsChanged),this.div.addEventListener("mousedown",this.onMouseDown),this.div.addEventListener("click",this.onClick),this.div.addEventListener("mouseover",this.onMouseOver),this.div.addEventListener("mouseout",this.onMouseOut))},e.prototype.onRemove=function(){this.div&&this.div.parentNode&&(this.hide(),null!==this.boundsChangedListener&&google.maps.event.removeListener(this.boundsChangedListener),this.div.removeEventListener("mousedown",this.onMouseDown),this.div.removeEventListener("click",this.onClick),this.div.removeEventListener("mouseover",this.onMouseOver),this.div.removeEventListener("mouseout",this.onMouseOut),this.div.parentNode.removeChild(this.div),null!==this.timeOut&&(window.clearTimeout(this.timeOut),this.timeOut=null),this.div=null)},e.prototype.draw=function(){if(this.visible&&null!==this.div&&this.center){var e=this.getPosFromLatLng(this.center);this.div.style.top=null!==e?"".concat(e.y,"px"):"0",this.div.style.left=null!==e?"".concat(e.x,"px"):"0"}},e.prototype.hide=function(){this.div&&(this.div.style.display="none"),this.visible=!1},e.prototype.show=function(){var e,t,n,r,s,o;if(this.div&&this.center){var i=null===this.sums||void 0===this.sums.title||""===this.sums.title?this.cluster.getClusterer().getTitle():this.sums.title,a=this.backgroundPosition.split(" "),l=parseInt((null===(e=a[0])||void 0===e?void 0:e.replace(/^\s+|\s+$/g,""))||"0",10),p=parseInt((null===(t=a[1])||void 0===t?void 0:t.replace(/^\s+|\s+$/g,""))||"0",10),h=this.getPosFromLatLng(this.center);this.div.className=this.className,this.div.setAttribute("style","cursor: pointer; position: absolute; top: ".concat(null!==h?"".concat(h.y,"px"):"0","; left: ").concat(null!==h?"".concat(h.x,"px"):"0","; width: ").concat(this.width,"px; height: ").concat(this.height,"px; "));var c=document.createElement("img");c.alt=i,c.src=this.url,c.width=this.width,c.height=this.height,c.setAttribute("style","position: absolute; top: ".concat(p,"px; left: ").concat(l,"px")),this.cluster.getClusterer().enableRetinaIcons||(c.style.clip="rect(-".concat(p,"px, -").concat(l+this.width,"px, -").concat(p+this.height,", -").concat(l,")"));var u=document.createElement("div");u.setAttribute("style","position: absolute; top: ".concat(this.anchorText[0],"px; left: ").concat(this.anchorText[1],"px; color: ").concat(this.textColor,"; font-size: ").concat(this.textSize,"px; font-family: ").concat(this.fontFamily,"; font-weight: ").concat(this.fontWeight,"; fontStyle: ").concat(this.fontStyle,"; text-decoration: ").concat(this.textDecoration,"; text-align: center; width: ").concat(this.width,"px; line-height: ").concat(this.height,"px")),(null===(n=this.sums)||void 0===n?void 0:n.text)&&(u.innerText="".concat(null===(r=this.sums)||void 0===r?void 0:r.text)),(null===(s=this.sums)||void 0===s?void 0:s.html)&&(u.innerHTML="".concat(null===(o=this.sums)||void 0===o?void 0:o.html)),this.div.innerHTML="",this.div.appendChild(c),this.div.appendChild(u),this.div.title=i,this.div.style.display=""}this.visible=!0},e.prototype.useStyle=function(e){this.sums=e;var t=this.cluster.getClusterer().getStyles(),n=t[Math.min(t.length-1,Math.max(0,e.index-1))];n&&(this.url=n.url,this.height=n.height,this.width=n.width,n.className&&(this.className="".concat(this.clusterClassName," ").concat(n.className)),this.anchorText=n.anchorText||[0,0],this.anchorIcon=n.anchorIcon||[this.height/2,this.width/2],this.textColor=n.textColor||"black",this.textSize=n.textSize||11,this.textDecoration=n.textDecoration||"none",this.fontWeight=n.fontWeight||"bold",this.fontStyle=n.fontStyle||"normal",this.fontFamily=n.fontFamily||"Arial,sans-serif",this.backgroundPosition=n.backgroundPosition||"0 0")},e.prototype.setCenter=function(e){this.center=e},e.prototype.getPosFromLatLng=function(e){var t=this.getProjection().fromLatLngToDivPixel(e);return null!==t&&(t.x-=this.anchorIcon[1],t.y-=this.anchorIcon[0]),t},e}(),De=function(){function e(e){this.markerClusterer=e,this.map=this.markerClusterer.getMap(),this.gridSize=this.markerClusterer.getGridSize(),this.minClusterSize=this.markerClusterer.getMinimumClusterSize(),this.averageCenter=this.markerClusterer.getAverageCenter(),this.markers=[],this.center=void 0,this.bounds=null,this.clusterIcon=new Se(this,this.markerClusterer.getStyles()),this.getSize=this.getSize.bind(this),this.getMarkers=this.getMarkers.bind(this),this.getCenter=this.getCenter.bind(this),this.getMap=this.getMap.bind(this),this.getClusterer=this.getClusterer.bind(this),this.getBounds=this.getBounds.bind(this),this.remove=this.remove.bind(this),this.addMarker=this.addMarker.bind(this),this.isMarkerInClusterBounds=this.isMarkerInClusterBounds.bind(this),this.calculateBounds=this.calculateBounds.bind(this),this.updateIcon=this.updateIcon.bind(this),this.isMarkerAlreadyAdded=this.isMarkerAlreadyAdded.bind(this)}return e.prototype.getSize=function(){return this.markers.length},e.prototype.getMarkers=function(){return this.markers},e.prototype.getCenter=function(){return this.center},e.prototype.getMap=function(){return this.map},e.prototype.getClusterer=function(){return this.markerClusterer},e.prototype.getBounds=function(){for(var e=new google.maps.LatLngBounds(this.center,this.center),t=0,n=this.getMarkers();t<n.length;t++){var r=n[t].getPosition();r&&e.extend(r)}return e},e.prototype.remove=function(){this.clusterIcon.setMap(null),this.markers=[],delete this.markers},e.prototype.addMarker=function(e){var t,n;if(this.isMarkerAlreadyAdded(e))return!1;if(this.center){if(this.averageCenter&&(n=e.getPosition())){var r=this.markers.length+1;this.center=new google.maps.LatLng((this.center.lat()*(r-1)+n.lat())/r,(this.center.lng()*(r-1)+n.lng())/r),this.calculateBounds()}}else(n=e.getPosition())&&(this.center=n,this.calculateBounds());e.isAdded=!0,this.markers.push(e);var s=this.markers.length,o=this.markerClusterer.getMaxZoom(),i=null===(t=this.map)||void 0===t?void 0:t.getZoom();if(null!==o&&void 0!==i&&i>o)e.getMap()!==this.map&&e.setMap(this.map);else if(s<this.minClusterSize)e.getMap()!==this.map&&e.setMap(this.map);else if(s===this.minClusterSize)for(var a=0,l=this.markers;a<l.length;a++){l[a].setMap(null)}else e.setMap(null);return!0},e.prototype.isMarkerInClusterBounds=function(e){if(null!==this.bounds){var t=e.getPosition();if(t)return this.bounds.contains(t)}return!1},e.prototype.calculateBounds=function(){this.bounds=this.markerClusterer.getExtendedBounds(new google.maps.LatLngBounds(this.center,this.center))},e.prototype.updateIcon=function(){var e,t=this.markers.length,n=this.markerClusterer.getMaxZoom(),r=null===(e=this.map)||void 0===e?void 0:e.getZoom();null!==n&&void 0!==r&&r>n||t<this.minClusterSize?this.clusterIcon.hide():(this.center&&this.clusterIcon.setCenter(this.center),this.clusterIcon.useStyle(this.markerClusterer.getCalculator()(this.markers,this.markerClusterer.getStyles().length)),this.clusterIcon.show())},e.prototype.isMarkerAlreadyAdded=function(e){if(this.markers.includes)return this.markers.includes(e);for(var t=0;t<this.markers.length;t++)if(e===this.markers[t])return!0;return!1},e}();function Ie(e,t){var n=e.length,r=n.toString().length,s=Math.min(r,t);return{text:n.toString(),index:s,title:""}}var je=[53,56,66,78,90],Be=function(){function e(t,n,r){void 0===n&&(n=[]),void 0===r&&(r={}),this.getMinimumClusterSize=this.getMinimumClusterSize.bind(this),this.setMinimumClusterSize=this.setMinimumClusterSize.bind(this),this.getEnableRetinaIcons=this.getEnableRetinaIcons.bind(this),this.setEnableRetinaIcons=this.setEnableRetinaIcons.bind(this),this.addToClosestCluster=this.addToClosestCluster.bind(this),this.getImageExtension=this.getImageExtension.bind(this),this.setImageExtension=this.setImageExtension.bind(this),this.getExtendedBounds=this.getExtendedBounds.bind(this),this.getAverageCenter=this.getAverageCenter.bind(this),this.setAverageCenter=this.setAverageCenter.bind(this),this.getTotalClusters=this.getTotalClusters.bind(this),this.fitMapToMarkers=this.fitMapToMarkers.bind(this),this.getIgnoreHidden=this.getIgnoreHidden.bind(this),this.setIgnoreHidden=this.setIgnoreHidden.bind(this),this.getClusterClass=this.getClusterClass.bind(this),this.setClusterClass=this.setClusterClass.bind(this),this.getTotalMarkers=this.getTotalMarkers.bind(this),this.getZoomOnClick=this.getZoomOnClick.bind(this),this.setZoomOnClick=this.setZoomOnClick.bind(this),this.getBatchSizeIE=this.getBatchSizeIE.bind(this),this.setBatchSizeIE=this.setBatchSizeIE.bind(this),this.createClusters=this.createClusters.bind(this),this.onZoomChanged=this.onZoomChanged.bind(this),this.getImageSizes=this.getImageSizes.bind(this),this.setImageSizes=this.setImageSizes.bind(this),this.getCalculator=this.getCalculator.bind(this),this.setCalculator=this.setCalculator.bind(this),this.removeMarkers=this.removeMarkers.bind(this),this.resetViewport=this.resetViewport.bind(this),this.getImagePath=this.getImagePath.bind(this),this.setImagePath=this.setImagePath.bind(this),this.pushMarkerTo=this.pushMarkerTo.bind(this),this.removeMarker=this.removeMarker.bind(this),this.clearMarkers=this.clearMarkers.bind(this),this.setupStyles=this.setupStyles.bind(this),this.getGridSize=this.getGridSize.bind(this),this.setGridSize=this.setGridSize.bind(this),this.getClusters=this.getClusters.bind(this),this.getMaxZoom=this.getMaxZoom.bind(this),this.setMaxZoom=this.setMaxZoom.bind(this),this.getMarkers=this.getMarkers.bind(this),this.addMarkers=this.addMarkers.bind(this),this.getStyles=this.getStyles.bind(this),this.setStyles=this.setStyles.bind(this),this.addMarker=this.addMarker.bind(this),this.onRemove=this.onRemove.bind(this),this.getTitle=this.getTitle.bind(this),this.setTitle=this.setTitle.bind(this),this.repaint=this.repaint.bind(this),this.onIdle=this.onIdle.bind(this),this.redraw=this.redraw.bind(this),this.onAdd=this.onAdd.bind(this),this.draw=this.draw.bind(this),this.extend=this.extend.bind(this),this.extend(e,google.maps.OverlayView),this.markers=new Set,this.clusters=[],this.listeners=[],this.activeMap=null,this.ready=!1,this.gridSize=r.gridSize||60,this.minClusterSize=r.minimumClusterSize||2,this.maxZoom=r.maxZoom||null,this.styles=r.styles||[],this.title=r.title||"",this.zoomOnClick=!0,void 0!==r.zoomOnClick&&(this.zoomOnClick=r.zoomOnClick),this.averageCenter=!1,void 0!==r.averageCenter&&(this.averageCenter=r.averageCenter),this.ignoreHidden=!1,void 0!==r.ignoreHidden&&(this.ignoreHidden=r.ignoreHidden),this.enableRetinaIcons=!1,void 0!==r.enableRetinaIcons&&(this.enableRetinaIcons=r.enableRetinaIcons),this.imagePath=r.imagePath||"https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m",this.imageExtension=r.imageExtension||"png",this.imageSizes=r.imageSizes||je,this.calculator=r.calculator||Ie,this.batchSize=r.batchSize||2e3,this.batchSizeIE=r.batchSizeIE||500,this.clusterClass=r.clusterClass||"cluster",-1!==navigator.userAgent.toLowerCase().indexOf("msie")&&(this.batchSize=this.batchSizeIE),this.timerRefStatic=null,this.setupStyles(),this.addMarkers(n,!0),this.setMap(t)}return e.prototype.onZoomChanged=function(){var e,t;this.resetViewport(!1),(null===(e=this.getMap())||void 0===e?void 0:e.getZoom())!==(this.get("minZoom")||0)&&(null===(t=this.getMap())||void 0===t?void 0:t.getZoom())!==this.get("maxZoom")||google.maps.event.trigger(this,"idle")},e.prototype.onIdle=function(){this.redraw()},e.prototype.onAdd=function(){var e=this.getMap();this.activeMap=e,this.ready=!0,this.repaint(),null!==e&&(this.listeners=[google.maps.event.addListener(e,"zoom_changed",this.onZoomChanged),google.maps.event.addListener(e,"idle",this.onIdle)])},e.prototype.onRemove=function(){for(var e=this.markers.values(),t=e.next();!t.done;){var n=t.value;n.getMap()!==this.activeMap&&n.setMap(this.activeMap),t=e.next()}for(var r=0,s=this.clusters;r<s.length;r++){s[r].remove()}this.clusters=[];for(var o=0,i=this.listeners;o<i.length;o++){var a=i[o];google.maps.event.removeListener(a)}this.listeners=[],this.activeMap=null,this.ready=!1},e.prototype.draw=function(){},e.prototype.getMap=function(){return null},e.prototype.getPanes=function(){return null},e.prototype.getProjection=function(){return{fromContainerPixelToLatLng:function(){return null},fromDivPixelToLatLng:function(){return null},fromLatLngToContainerPixel:function(){return null},fromLatLngToDivPixel:function(){return null},getVisibleRegion:function(){return null},getWorldWidth:function(){return 0}}},e.prototype.setMap=function(){},e.prototype.addListener=function(){return{remove:function(){}}},e.prototype.bindTo=function(){},e.prototype.get=function(){},e.prototype.notify=function(){},e.prototype.set=function(){},e.prototype.setValues=function(){},e.prototype.unbind=function(){},e.prototype.unbindAll=function(){},e.prototype.setupStyles=function(){if(!(this.styles.length>0))for(var e=0;e<this.imageSizes.length;e++)this.styles.push({url:"".concat(this.imagePath+(e+1),".").concat(this.imageExtension),height:this.imageSizes[e]||0,width:this.imageSizes[e]||0})},e.prototype.fitMapToMarkers=function(){for(var e=this.getMar