@smartrep/web-widget
Version:
Client side library to load the web widget
1 lines • 40.4 kB
JavaScript
"use strict";(self.webpackChunkWebChat=self.webpackChunkWebChat||[]).push([[728],{2017:e=>{e.exports=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var n,o,s;if(Array.isArray(t)){if((n=t.length)!=r.length)return!1;for(o=n;0!==o--;)if(!e(t[o],r[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((n=(s=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(o=n;0!==o--;)if(!Object.prototype.hasOwnProperty.call(r,s[o]))return!1;for(o=n;0!==o--;){var i=s[o];if(!e(t[i],r[i]))return!1}return!0}return t!=t&&r!=r}},4550:(e,t,r)=>{r.d(t,{J8:()=>B,ST:()=>N,T5:()=>S,c4:()=>m,ko:()=>P});var n=r(6540),o=r(961),s=r(2017);function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},i.apply(null,arguments)}function a(e,t){if(null==e)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}function l(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}const u={NOT_LOADED:"NOT_LOADED",LOADING:"LOADING",LOADED:"LOADED",FAILED:"FAILED",AUTH_FAILURE:"AUTH_FAILURE"};class c{static async load(e,t){var r;const n=e.libraries?e.libraries.split(","):[],o=this.serializeParams(e);this.listeners.push(t),null!=(r=window.google)&&null!=(r=r.maps)&&r.importLibrary?(this.serializedApiParams||(this.loadingStatus=u.LOADED),this.notifyLoadingStatusListeners()):(this.serializedApiParams=o,this.initImportLibrary(e)),this.serializedApiParams&&this.serializedApiParams!==o&&console.warn("[google-maps-api-loader] The maps API has already been loaded with different parameters and will not be loaded again. Refresh the page for new values to have effect.");const s=["maps",...n];await Promise.all(s.map((e=>google.maps.importLibrary(e))))}static serializeParams(e){return[e.v,e.key,e.language,e.region,e.authReferrerPolicy,e.solutionChannel].join("/")}static initImportLibrary(e){if(window.google||(window.google={}),window.google.maps||(window.google.maps={}),window.google.maps.importLibrary)return void console.error("[google-maps-api-loader-internal]: initImportLibrary must only be called once");let t=null;const r=()=>t||(t=new Promise(((t,r)=>{var n;const o=document.createElement("script"),s=new URLSearchParams;for(const[t,r]of Object.entries(e)){const e=t.replace(/[A-Z]/g,(e=>"_"+e[0].toLowerCase()));s.set(e,String(r))}s.set("loading","async"),s.set("callback","__googleMapsCallback__"),o.async=!0,o.src="https://maps.googleapis.com/maps/api/js?"+s.toString(),o.nonce=(null==(n=document.querySelector("script[nonce]"))?void 0:n.nonce)||"",o.onerror=()=>{this.loadingStatus=u.FAILED,this.notifyLoadingStatusListeners(),r(new Error("The Google Maps JavaScript API could not load."))},window.__googleMapsCallback__=()=>{this.loadingStatus=u.LOADED,this.notifyLoadingStatusListeners(),t()},window.gm_authFailure=()=>{this.loadingStatus=u.AUTH_FAILURE,this.notifyLoadingStatusListeners()},this.loadingStatus=u.LOADING,this.notifyLoadingStatusListeners(),document.head.append(o)})),t);google.maps.importLibrary=e=>r().then((()=>google.maps.importLibrary(e)))}static notifyLoadingStatusListeners(){for(const e of this.listeners)e(this.loadingStatus)}}c.loadingStatus=u.NOT_LOADED,c.serializedApiParams=void 0,c.listeners=[];const d=["onLoad","onError","apiKey","version","libraries"],h=["children"],p=n.createContext(null),m=e=>{const{children:t}=e,r=a(e,h),{mapInstances:o,addMapInstance:s,removeMapInstance:u,clearMapInstances:m}=function(){const[e,t]=(0,n.useState)({});return{mapInstances:e,addMapInstance:(e,r="default")=>{t((t=>i({},t,{[r]:e})))},removeMapInstance:(e="default")=>{t((t=>a(t,[e].map(l))))},clearMapInstances:()=>{t({})}}}(),{status:f,loadedLibraries:g,importLibrary:v}=function(e){const{onLoad:t,onError:r,apiKey:o,version:s,libraries:l=[]}=e,u=a(e,d),[h,p]=(0,n.useState)(c.loadingStatus),[m,f]=(0,n.useReducer)(((e,t)=>e[t.name]?e:i({},e,{[t.name]:t.value})),{}),g=(0,n.useMemo)((()=>null==l?void 0:l.join(",")),[l]),v=(0,n.useMemo)((()=>JSON.stringify(i({apiKey:o,version:s},u))),[o,s,u]),y=(0,n.useCallback)((async e=>{var t;if(m[e])return m[e];if(null==(t=google)||null==(t=t.maps)||!t.importLibrary)throw new Error("[api-provider-internal] importLibrary was called before google.maps.importLibrary was defined.");const r=await window.google.maps.importLibrary(e);return f({name:e,value:r}),r}),[m]);return(0,n.useEffect)((()=>{(async()=>{try{const e=i({key:o},u);s&&(e.v=s),(null==g?void 0:g.length)>0&&(e.libraries=g),(void 0===e.channel||e.channel<0||e.channel>999)&&delete e.channel,void 0===e.solutionChannel?e.solutionChannel="GMP_visgl_rgmlibrary_v1_default":""===e.solutionChannel&&delete e.solutionChannel,await c.load(e,(e=>p(e)));for(const e of["core","maps",...l])await y(e);t&&t()}catch(e){r?r(e):console.error("<ApiProvider> failed to load the Google Maps JavaScript API",e)}})()}),[o,g,v]),{status:h,loadedLibraries:m,importLibrary:y}}(r),y=(0,n.useMemo)((()=>({mapInstances:o,addMapInstance:s,removeMapInstance:u,clearMapInstances:m,status:f,loadedLibraries:g,importLibrary:v})),[o,s,u,m,f,g,v]);return n.createElement(p.Provider,{value:y},t)};function f(e,t,r){const n={type:e,map:t,detail:{},stoppable:!1,stop:()=>{}};if(v.includes(e)){const e=n,r=t.getCenter(),o=t.getZoom(),s=t.getHeading()||0,i=t.getTilt()||0,a=t.getBounds();return r&&a&&Number.isFinite(o)||console.warn("[createEvent] at least one of the values from the map returned undefined. This is not expected to happen. Please report an issue at https://github.com/visgl/react-google-maps/issues/new"),e.detail={center:(null==r?void 0:r.toJSON())||{lat:0,lng:0},zoom:o||0,heading:s,tilt:i,bounds:(null==a?void 0:a.toJSON())||{north:90,east:180,south:-90,west:-180}},e}if(y.includes(e)){var o;if(!r)throw new Error("[createEvent] mouse events must provide a srcEvent");const e=n;return e.domEvent=r.domEvent,e.stoppable=!0,e.stop=()=>r.stop(),e.detail={latLng:(null==(o=r.latLng)?void 0:o.toJSON())||null,placeId:r.placeId},e}return n}const g={onBoundsChanged:"bounds_changed",onCenterChanged:"center_changed",onClick:"click",onContextmenu:"contextmenu",onDblclick:"dblclick",onDrag:"drag",onDragend:"dragend",onDragstart:"dragstart",onHeadingChanged:"heading_changed",onIdle:"idle",onIsFractionalZoomEnabledChanged:"isfractionalzoomenabled_changed",onMapCapabilitiesChanged:"mapcapabilities_changed",onMapTypeIdChanged:"maptypeid_changed",onMousemove:"mousemove",onMouseout:"mouseout",onMouseover:"mouseover",onProjectionChanged:"projection_changed",onRenderingTypeChanged:"renderingtype_changed",onTilesLoaded:"tilesloaded",onTiltChanged:"tilt_changed",onZoomChanged:"zoom_changed",onCameraChanged:"bounds_changed"},v=["bounds_changed","center_changed","heading_changed","tilt_changed","zoom_changed"],y=["click","contextmenu","dblclick","mousemove","mouseout","mouseover"],b=Object.keys(g);function E(e,t){const r=(0,n.useRef)(e);return t(e,r.current)||(r.current=e),r.current}const w=new Set(["backgroundColor","clickableIcons","controlSize","disableDefaultUI","disableDoubleClickZoom","draggable","draggableCursor","draggingCursor","fullscreenControl","fullscreenControlOptions","gestureHandling","headingInteractionEnabled","isFractionalZoomEnabled","keyboardShortcuts","mapTypeControl","mapTypeControlOptions","mapTypeId","maxZoom","minZoom","noClear","panControl","panControlOptions","restriction","rotateControl","rotateControlOptions","scaleControl","scaleControlOptions","scrollwheel","streetView","streetViewControl","streetViewControlOptions","styles","tiltInteractionEnabled","zoomControl","zoomControlOptions"]);function k(){var e;return(null==(e=(0,n.useContext)(p))?void 0:e.status)||u.NOT_LOADED}function C(e){return function(e){return!(!e||"object"!=typeof e)&&"lat"in e&&"lng"in e&&Number.isFinite(e.lat)&&Number.isFinite(e.lng)}(e)?e:e.toJSON()}const M=()=>n.createElement("div",{style:{position:"absolute",top:0,left:0,bottom:0,right:0,zIndex:999,display:"flex",flexFlow:"column nowrap",textAlign:"center",justifyContent:"center",fontSize:".8rem",color:"rgba(0,0,0,0.6)",background:"#dddddd",padding:"1rem 1.5rem"}},n.createElement("h2",null,"Error: AuthFailure"),n.createElement("p",null,"A problem with your API key prevents the map from rendering correctly. Please make sure the value of the ",n.createElement("code",null,"APIProvider.apiKey")," prop is correct. Check the error-message in the console for further details."));function O(){return k()===u.LOADED}const L=["id","defaultBounds","defaultCenter","defaultZoom","defaultHeading","defaultTilt","reuseMaps","renderingType","colorScheme"],_=["padding"];class A{static has(e){return this.entries[e]&&this.entries[e].length>0}static pop(e){return this.entries[e]&&this.entries[e].pop()||null}static push(e,t){this.entries[e]||(this.entries[e]=[]),this.entries[e].push(t)}}function I(e,t){const r=O(),[o,s]=(0,n.useState)(null),[l,u]=function(){const[e,t]=(0,n.useState)(null);return[e,(0,n.useCallback)((e=>t(e)),[t])]}(),c=function(e){const t=function(){const[,e]=(0,n.useReducer)((e=>e+1),0);return e}(),r=(0,n.useRef)({center:{lat:0,lng:0},heading:0,tilt:0,zoom:0});return(0,n.useEffect)((()=>{if(!e)return;const n=google.maps.event.addListener(e,"bounds_changed",(()=>{!function(e,t){const r=e.getCenter(),n=e.getZoom(),o=e.getHeading()||0,s=e.getTilt()||0,i=e.getBounds();r&&i&&Number.isFinite(n)||console.warn("[useTrackedCameraState] at least one of the values from the map returned undefined. This is not expected to happen. Please report an issue at https://github.com/visgl/react-google-maps/issues/new"),Object.assign(t.current,{center:(null==r?void 0:r.toJSON())||{lat:0,lng:0},zoom:n||0,heading:o,tilt:s})}(e,r),t()}));return()=>n.remove()}),[e,t]),r}(o),{id:d,defaultBounds:h,defaultCenter:p,defaultZoom:m,defaultHeading:f,defaultTilt:g,reuseMaps:v,renderingType:y,colorScheme:b}=e,E=a(e,L),w=void 0!==e.zoom||void 0!==e.defaultZoom,k=void 0!==e.center||void 0!==e.defaultCenter;h||w&&k||console.warn("<Map> component is missing configuration. You have to provide zoom and center (via the `zoom`/`defaultZoom` and `center`/`defaultCenter` props) or specify the region to show using `defaultBounds`. See https://visgl.github.io/react-google-maps/docs/api-reference/components/map#required"),!E.center&&p&&(E.center=p),!E.zoom&&Number.isFinite(m)&&(E.zoom=m),!E.heading&&Number.isFinite(f)&&(E.heading=f),!E.tilt&&Number.isFinite(g)&&(E.tilt=g);for(const e of Object.keys(E))void 0===E[e]&&delete E[e];const C=(0,n.useRef)(void 0);return(0,n.useEffect)((()=>{if(!l||!r)return;const{addMapInstance:n,removeMapInstance:o}=t,{mapId:u}=e,p=`${u||"default"}:${y||"default"}:${b||"LIGHT"}`;let m,f;if(v&&A.has(p)?(f=A.pop(p),m=f.getDiv(),l.appendChild(m),f.setOptions(E),setTimeout((()=>f.setCenter(f.getCenter())),0)):(m=document.createElement("div"),m.style.height="100%",l.appendChild(m),f=new google.maps.Map(m,i({},E,y?{renderingType:y}:{},b?{colorScheme:b}:{}))),s(f),n(f,d),h){const{padding:e}=h,t=a(h,_);f.fitBounds(t,e)}else w&&k||f.fitBounds({east:180,west:-180,south:-90,north:90});if(C.current){const{mapId:e,cameraState:t}=C.current;e!==u&&f.setOptions(t)}return()=>{C.current={mapId:u,cameraState:c.current},m.remove(),v?A.push(p,f):google.maps.event.clearInstanceListeners(f),s(null),o(d)}}),[l,r,d,e.mapId,e.renderingType,e.colorScheme]),[o,u,c]}A.entries={};const x=n.createContext(null),S=e=>{const{children:t,id:r,className:o,style:a}=e,l=(0,n.useContext)(p),c=k();if(!l)throw new Error("<Map> can only be used inside an <ApiProvider> component.");const[d,h,m]=I(e,l);!function(e,t,r){const o=r.center?C(r.center):null;let s=null,i=null;o&&Number.isFinite(o.lat)&&Number.isFinite(o.lng)&&(s=o.lat,i=o.lng);const a=Number.isFinite(r.zoom)?r.zoom:null,l=Number.isFinite(r.heading)?r.heading:null,u=Number.isFinite(r.tilt)?r.tilt:null;(0,n.useLayoutEffect)((()=>{if(!e)return;const r={};let n=!1;null===s||null===i||t.current.center.lat===s&&t.current.center.lng===i||(r.center={lat:s,lng:i},n=!0),null!==a&&t.current.zoom!==a&&(r.zoom=a,n=!0),null!==l&&t.current.heading!==l&&(r.heading=l,n=!0),null!==u&&t.current.tilt!==u&&(r.tilt=u,n=!0),n&&e.moveCamera(r)}))}(d,m,e),function(e,t){for(const r of b){const o=t[r],s=g[r];(0,n.useEffect)((()=>{if(!e)return;if(!o)return;const t=google.maps.event.addListener(e,s,(t=>{o(f(s,e,t))}));return()=>t.remove()}),[e,s,o])}}(d,e),function(e,t){const r={},o=Object.keys(t);for(const e of o)w.has(e)&&(r[e]=t[e]);(function(e,t,r){(0,n.useEffect)(e,[E(t,r)])})((()=>{e&&e.setOptions(r)}),[r],s)}(d,e);const v=function(e,t){const{viewport:r,viewState:o}=t,s=!!r;return(0,n.useLayoutEffect)((()=>{if(!e||!o)return;const{latitude:t,longitude:r,bearing:n,pitch:s,zoom:i}=o;e.moveCamera({center:{lat:t,lng:r},heading:n,tilt:s,zoom:i+1})}),[e,o]),s}(d,e),y=!!e.controlled;(0,n.useEffect)((()=>{if(d)return v&&d.setOptions({disableDefaultUI:!0}),(v||y)&&d.setOptions({gestureHandling:"none",keyboardShortcuts:!1}),()=>{d.setOptions({gestureHandling:e.gestureHandling,keyboardShortcuts:e.keyboardShortcuts})}}),[d,v,y,e.gestureHandling,e.keyboardShortcuts]);const O=e.center?C(e.center):null;let L=null,_=null;O&&Number.isFinite(O.lat)&&Number.isFinite(O.lng)&&(L=O.lat,_=O.lng);const A=(0,n.useMemo)((()=>{var t,r,n,o,s;return{center:{lat:null!=(t=L)?t:0,lng:null!=(r=_)?r:0},zoom:null!=(n=e.zoom)?n:0,heading:null!=(o=e.heading)?o:0,tilt:null!=(s=e.tilt)?s:0}}),[L,_,e.zoom,e.heading,e.tilt]);(0,n.useLayoutEffect)((()=>{if(!d||!y)return;d.moveCamera(A);const e=d.addListener("bounds_changed",(()=>{d.moveCamera(A)}));return()=>e.remove()}),[d,y,A]);const S=(0,n.useMemo)((()=>i({width:"100%",height:"100%",position:"relative",zIndex:v?-1:0},a)),[a,v]),T=(0,n.useMemo)((()=>({map:d})),[d]);return c===u.AUTH_FAILURE?n.createElement("div",{style:i({position:"relative"},o?{}:S),className:o},n.createElement(M,null)):n.createElement("div",i({ref:h,"data-testid":"map",style:o?void 0:S,className:o},r?{id:r}:{}),d?n.createElement(x.Provider,{value:T},t):null)};S.deckGLViewProps=!0;const T=new Set;const P=(e=null)=>{const t=(0,n.useContext)(p),{map:r}=(0,n.useContext)(x)||{};if(null===t)return function(...e){const t=JSON.stringify(e);T.has(t)||(T.add(t),console.error(...e))}("useMap(): failed to retrieve APIProviderContext. Make sure that the <APIProvider> component exists and that the component you are calling `useMap()` from is a sibling of the <APIProvider>."),null;const{mapInstances:o}=t;return null!==e?o[e]||null:r||o.default||null};function N(e){const t=O(),r=(0,n.useContext)(p);return(0,n.useEffect)((()=>{t&&r&&r.importLibrary(e)}),[t,r,e]),(null==r?void 0:r.loadedLibraries[e])||null}function j(e,t,r){(0,n.useEffect)((()=>{if(!e||!t||!r)return;const n=google.maps.event.addListener(e,t,r);return()=>n.remove()}),[e,t,r])}function D(e,t,r){(0,n.useEffect)((()=>{e&&(e[t]=r)}),[e,t,r])}function z(e,t,r){(0,n.useEffect)((()=>{if(e&&t&&r)return e.addEventListener(t,r),()=>e.removeEventListener(t,r)}),[e,t,r])}function F(e){return e.nodeType===Node.ELEMENT_NODE}const R=n.createContext(null),q={TOP_LEFT:["0%","0%"],TOP_CENTER:["50%","0%"],TOP:["50%","0%"],TOP_RIGHT:["100%","0%"],LEFT_CENTER:["0%","50%"],LEFT_TOP:["0%","0%"],LEFT:["0%","50%"],LEFT_BOTTOM:["0%","100%"],RIGHT_TOP:["100%","0%"],RIGHT:["100%","50%"],RIGHT_CENTER:["100%","50%"],RIGHT_BOTTOM:["100%","100%"],BOTTOM_LEFT:["0%","100%"],BOTTOM_CENTER:["50%","100%"],BOTTOM:["50%","100%"],BOTTOM_RIGHT:["100%","100%"],CENTER:["50%","50%"]},Z=({children:e,styles:t,className:r,anchorPoint:o})=>{const[s,i]=null!=o?o:q.BOTTOM;let a=`-${s}`,l=`-${i}`;s.trimStart().startsWith("-")&&(a=s.substring(1)),i.trimStart().startsWith("-")&&(l=i.substring(1));const u=`translate(50%, 100%) translate(${a}, ${l})`;return n.createElement("div",{style:{transform:u}},n.createElement("div",{className:r,style:t},e))},B=(0,n.forwardRef)(((e,t)=>{const{children:r,style:s,className:i,anchorPoint:a}=e,[l,u]=function(e){const[t,r]=(0,n.useState)(null),[o,s]=(0,n.useState)(null),i=P(),a=N("marker"),{children:l,onClick:u,className:c,onMouseEnter:d,onMouseLeave:h,onDrag:p,onDragStart:m,onDragEnd:f,collisionBehavior:g,clickable:v,draggable:y,position:b,title:E,zIndex:w}=e,k=n.Children.count(l);return(0,n.useEffect)((()=>{if(!i||!a)return;const e=new a.AdvancedMarkerElement;e.map=i,r(e);let t=null;return k>0&&(t=document.createElement("div"),t.isCustomMarker=!0,e.content=t,s(t)),()=>{var n;e.map=null,null==(n=t)||n.remove(),r(null),s(null)}}),[i,a,k]),(0,n.useEffect)((()=>{null==t||!t.content||!F(t.content)||k>0||(t.content.className=null!=c?c:"")}),[t,c,k]),D(t,"position",b),D(t,"title",null!=E?E:""),D(t,"zIndex",w),D(t,"collisionBehavior",g),(0,n.useEffect)((()=>{t&&(t.gmpDraggable=void 0!==y?y:!!(p||m||f))}),[t,y,p,f,m]),(0,n.useEffect)((()=>{if(!t)return;const e=void 0!==v||Boolean(u)||Boolean(d)||Boolean(h);t.gmpClickable=e,e&&null!=t&&t.content&&F(t.content)&&(t.content.style.pointerEvents="none",t.content.firstElementChild&&(t.content.firstElementChild.style.pointerEvents="all"))}),[t,v,u,d,h]),j(t,"click",u),j(t,"drag",p),j(t,"dragstart",m),j(t,"dragend",f),z(null==t?void 0:t.element,"mouseenter",d),z(null==t?void 0:t.element,"mouseleave",h),[t,o]}(e),c=(0,n.useMemo)((()=>l?{marker:l}:null),[l]);return(0,n.useImperativeHandle)(t,(()=>l),[l]),u?n.createElement(R.Provider,{value:c},(0,o.createPortal)(n.createElement(Z,{anchorPoint:a,styles:s,className:i},r),u)):null}));new Set(["animationIterationCount","aspectRatio","borderImageOutset","borderImageSlice","borderImageWidth","boxFlex","boxFlexGroup","boxOrdinalGroup","columnCount","columns","flex","flexGrow","flexPositive","flexShrink","flexNegative","flexOrder","gridArea","gridRow","gridRowEnd","gridRowSpan","gridRowStart","gridColumn","gridColumnEnd","gridColumnSpan","gridColumnStart","fontWeight","lineClamp","lineHeight","opacity","order","orphans","scale","tabSize","widows","zIndex","zoom","fillOpacity","floodOpacity","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth"]);const U=["onClick","onDrag","onDragStart","onDragEnd","onMouseOver","onMouseOut"];(0,n.forwardRef)(((e,t)=>{const r=function(e){const[t,r]=(0,n.useState)(null),o=P(),{onClick:s,onDrag:i,onDragStart:l,onDragEnd:u,onMouseOver:c,onMouseOut:d}=e,h=a(e,U),{position:p,draggable:m}=h;return(0,n.useEffect)((()=>{if(!o)return void(void 0===o&&console.error("<Marker> has to be inside a Map component."));const e=new google.maps.Marker(h);return e.setMap(o),r(e),()=>{e.setMap(null),r(null)}}),[o]),(0,n.useEffect)((()=>{if(!t)return;const e=t,r=google.maps.event;return s&&r.addListener(e,"click",s),i&&r.addListener(e,"drag",i),l&&r.addListener(e,"dragstart",l),u&&r.addListener(e,"dragend",u),c&&r.addListener(e,"mouseover",c),d&&r.addListener(e,"mouseout",d),t.setDraggable(Boolean(m)),()=>{r.clearInstanceListeners(e)}}),[t,m,s,i,l,u,c,d]),(0,n.useEffect)((()=>{t&&h&&t.setOptions(h)}),[t,h]),(0,n.useEffect)((()=>{!m&&p&&t&&t.setPosition(p)}),[m,p,t]),t}(e);return(0,n.useImperativeHandle)(t,(()=>r),[r]),n.createElement(n.Fragment,null)}))},5899:(e,t,r)=>{r.d(t,{w1:()=>ie});var n=Object.getOwnPropertyNames,o=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty;function i(e,t){return function(r,n,o){return e(r,n,o)&&t(r,n,o)}}function a(e){return function(t,r,n){if(!t||!r||"object"!=typeof t||"object"!=typeof r)return e(t,r,n);var o=n.cache,s=o.get(t),i=o.get(r);if(s&&i)return s===r&&i===t;o.set(t,r),o.set(r,t);var a=e(t,r,n);return o.delete(t),o.delete(r),a}}function l(e){return n(e).concat(o(e))}var u=Object.hasOwn||function(e,t){return s.call(e,t)};function c(e,t){return e===t||!e&&!t&&e!=e&&t!=t}var d=Object.getOwnPropertyDescriptor,h=Object.keys;function p(e,t,r){var n=e.length;if(t.length!==n)return!1;for(;n-- >0;)if(!r.equals(e[n],t[n],n,n,e,t,r))return!1;return!0}function m(e,t){return c(e.getTime(),t.getTime())}function f(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function g(e,t){return e===t}function v(e,t,r){var n=e.size;if(n!==t.size)return!1;if(!n)return!0;for(var o,s,i=new Array(n),a=e.entries(),l=0;(o=a.next())&&!o.done;){for(var u=t.entries(),c=!1,d=0;(s=u.next())&&!s.done;)if(i[d])d++;else{var h=o.value,p=s.value;if(r.equals(h[0],p[0],l,d,e,t,r)&&r.equals(h[1],p[1],h[0],p[0],e,t,r)){c=i[d]=!0;break}d++}if(!c)return!1;l++}return!0}var y=c;function b(e,t,r){var n=h(e),o=n.length;if(h(t).length!==o)return!1;for(;o-- >0;)if(!L(e,t,r,n[o]))return!1;return!0}function E(e,t,r){var n,o,s,i=l(e),a=i.length;if(l(t).length!==a)return!1;for(;a-- >0;){if(!L(e,t,r,n=i[a]))return!1;if(o=d(e,n),s=d(t,n),(o||s)&&(!o||!s||o.configurable!==s.configurable||o.enumerable!==s.enumerable||o.writable!==s.writable))return!1}return!0}function w(e,t){return c(e.valueOf(),t.valueOf())}function k(e,t){return e.source===t.source&&e.flags===t.flags}function C(e,t,r){var n=e.size;if(n!==t.size)return!1;if(!n)return!0;for(var o,s,i=new Array(n),a=e.values();(o=a.next())&&!o.done;){for(var l=t.values(),u=!1,c=0;(s=l.next())&&!s.done;){if(!i[c]&&r.equals(o.value,s.value,o.value,s.value,e,t,r)){u=i[c]=!0;break}c++}if(!u)return!1}return!0}function M(e,t){var r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(e[r]!==t[r])return!1;return!0}function O(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function L(e,t,r,n){return!("_owner"!==n&&"__o"!==n&&"__v"!==n||!e.$$typeof&&!t.$$typeof)||u(t,n)&&r.equals(e[n],t[n],n,n,e,t,r)}var _=Array.isArray,A="function"==typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView:null,I=Object.assign,x=Object.prototype.toString.call.bind(Object.prototype.toString),S=T();function T(e){void 0===e&&(e={});var t,r=e.circular,n=void 0!==r&&r,o=e.createInternalComparator,s=e.createState,l=e.strict,u=void 0!==l&&l,c=function(e){var t=e.circular,r=e.createCustomConfig,n=e.strict,o={areArraysEqual:n?E:p,areDatesEqual:m,areErrorsEqual:f,areFunctionsEqual:g,areMapsEqual:n?i(v,E):v,areNumbersEqual:y,areObjectsEqual:n?E:b,arePrimitiveWrappersEqual:w,areRegExpsEqual:k,areSetsEqual:n?i(C,E):C,areTypedArraysEqual:n?E:M,areUrlsEqual:O};if(r&&(o=I({},o,r(o))),t){var s=a(o.areArraysEqual),l=a(o.areMapsEqual),u=a(o.areObjectsEqual),c=a(o.areSetsEqual);o=I({},o,{areArraysEqual:s,areMapsEqual:l,areObjectsEqual:u,areSetsEqual:c})}return o}(e),d=function(e){var t=e.areArraysEqual,r=e.areDatesEqual,n=e.areErrorsEqual,o=e.areFunctionsEqual,s=e.areMapsEqual,i=e.areNumbersEqual,a=e.areObjectsEqual,l=e.arePrimitiveWrappersEqual,u=e.areRegExpsEqual,c=e.areSetsEqual,d=e.areTypedArraysEqual,h=e.areUrlsEqual;return function(e,p,m){if(e===p)return!0;if(null==e||null==p)return!1;var f=typeof e;if(f!==typeof p)return!1;if("object"!==f)return"number"===f?i(e,p,m):"function"===f&&o(e,p,m);var g=e.constructor;if(g!==p.constructor)return!1;if(g===Object)return a(e,p,m);if(_(e))return t(e,p,m);if(null!=A&&A(e))return d(e,p,m);if(g===Date)return r(e,p,m);if(g===RegExp)return u(e,p,m);if(g===Map)return s(e,p,m);if(g===Set)return c(e,p,m);var v=x(e);return"[object Date]"===v?r(e,p,m):"[object RegExp]"===v?u(e,p,m):"[object Map]"===v?s(e,p,m):"[object Set]"===v?c(e,p,m):"[object Object]"===v?"function"!=typeof e.then&&"function"!=typeof p.then&&a(e,p,m):"[object URL]"===v?h(e,p,m):"[object Error]"===v?n(e,p,m):"[object Arguments]"===v?a(e,p,m):("[object Boolean]"===v||"[object Number]"===v||"[object String]"===v)&&l(e,p,m)}}(c);return function(e){var t=e.circular,r=e.comparator,n=e.createState,o=e.equals,s=e.strict;if(n)return function(e,i){var a=n(),l=a.cache,u=void 0===l?t?new WeakMap:void 0:l,c=a.meta;return r(e,i,{cache:u,equals:o,meta:c,strict:s})};if(t)return function(e,t){return r(e,t,{cache:new WeakMap,equals:o,meta:void 0,strict:s})};var i={cache:void 0,equals:o,meta:void 0,strict:s};return function(e,t){return r(e,t,i)}}({circular:n,comparator:d,createState:s,equals:o?o(d):(t=d,function(e,r,n,o,s,i,a){return t(e,r,a)}),strict:u})}T({strict:!0}),T({circular:!0}),T({circular:!0,strict:!0}),T({createInternalComparator:function(){return c}}),T({strict:!0,createInternalComparator:function(){return c}}),T({circular:!0,createInternalComparator:function(){return c}}),T({circular:!0,createInternalComparator:function(){return c},strict:!0});const P=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class N{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[t,r]=new Uint8Array(e,0,2);if(219!==t)throw new Error("Data does not appear to be in a KDBush format.");const n=r>>4;if(1!==n)throw new Error(`Got v${n} data when expected v1.`);const o=P[15&r];if(!o)throw new Error("Unrecognized array type.");const[s]=new Uint16Array(e,2,1),[i]=new Uint32Array(e,4,1);return new N(i,s,o,e)}constructor(e,t=64,r=Float64Array,n){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=r,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const o=P.indexOf(this.ArrayType),s=2*e*this.ArrayType.BYTES_PER_ELEMENT,i=e*this.IndexArrayType.BYTES_PER_ELEMENT,a=(8-i%8)%8;if(o<0)throw new Error(`Unexpected typed array class: ${r}.`);n&&n instanceof ArrayBuffer?(this.data=n,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+i+a,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+s+i+a),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+i+a,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+o]),new Uint16Array(this.data,2,1)[0]=t,new Uint32Array(this.data,4,1)[0]=e)}add(e,t){const r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=e,this.coords[this._pos++]=t,r}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return j(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,r,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:o,coords:s,nodeSize:i}=this,a=[0,o.length-1,0],l=[];for(;a.length;){const u=a.pop()||0,c=a.pop()||0,d=a.pop()||0;if(c-d<=i){for(let i=d;i<=c;i++){const a=s[2*i],u=s[2*i+1];a>=e&&a<=r&&u>=t&&u<=n&&l.push(o[i])}continue}const h=d+c>>1,p=s[2*h],m=s[2*h+1];p>=e&&p<=r&&m>=t&&m<=n&&l.push(o[h]),(0===u?e<=p:t<=m)&&(a.push(d),a.push(h-1),a.push(1-u)),(0===u?r>=p:n>=m)&&(a.push(h+1),a.push(c),a.push(1-u))}return l}within(e,t,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:n,coords:o,nodeSize:s}=this,i=[0,n.length-1,0],a=[],l=r*r;for(;i.length;){const u=i.pop()||0,c=i.pop()||0,d=i.pop()||0;if(c-d<=s){for(let r=d;r<=c;r++)R(o[2*r],o[2*r+1],e,t)<=l&&a.push(n[r]);continue}const h=d+c>>1,p=o[2*h],m=o[2*h+1];R(p,m,e,t)<=l&&a.push(n[h]),(0===u?e-r<=p:t-r<=m)&&(i.push(d),i.push(h-1),i.push(1-u)),(0===u?e+r>=p:t+r>=m)&&(i.push(h+1),i.push(c),i.push(1-u))}return a}}function j(e,t,r,n,o,s){if(o-n<=r)return;const i=n+o>>1;D(e,t,i,n,o,s),j(e,t,r,n,i-1,1-s),j(e,t,r,i+1,o,1-s)}function D(e,t,r,n,o,s){for(;o>n;){if(o-n>600){const i=o-n+1,a=r-n+1,l=Math.log(i),u=.5*Math.exp(2*l/3),c=.5*Math.sqrt(l*u*(i-u)/i)*(a-i/2<0?-1:1);D(e,t,r,Math.max(n,Math.floor(r-a*u/i+c)),Math.min(o,Math.floor(r+(i-a)*u/i+c)),s)}const i=t[2*r+s];let a=n,l=o;for(z(e,t,n,r),t[2*o+s]>i&&z(e,t,n,o);a<l;){for(z(e,t,a,l),a++,l--;t[2*a+s]<i;)a++;for(;t[2*l+s]>i;)l--}t[2*n+s]===i?z(e,t,n,l):(l++,z(e,t,l,o)),l<=r&&(n=l+1),r<=l&&(o=l-1)}}function z(e,t,r,n){F(e,r,n),F(t,2*r,2*n),F(t,2*r+1,2*n+1)}function F(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function R(e,t,r,n){const o=e-r,s=t-n;return o*o+s*s}const q={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e},Z=Math.fround||(B=new Float32Array(1),e=>(B[0]=+e,B[0]));var B;class U{constructor(e){this.options=Object.assign(Object.create(q),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(e){const{log:t,minZoom:r,maxZoom:n}=this.options;t&&console.time("total time");const o=`prepare ${e.length} points`;t&&console.time(o),this.points=e;const s=[];for(let t=0;t<e.length;t++){const r=e[t];if(!r.geometry)continue;const[n,o]=r.geometry.coordinates,i=Z($(n)),a=Z(W(o));s.push(i,a,1/0,t,-1,1),this.options.reduce&&s.push(0)}let i=this.trees[n+1]=this._createTree(s);t&&console.timeEnd(o);for(let e=n;e>=r;e--){const r=+Date.now();i=this.trees[e]=this._createTree(this._cluster(i,e)),t&&console.log("z%d: %d clusters in %dms",e,i.numItems,+Date.now()-r)}return t&&console.timeEnd("total time"),this}getClusters(e,t){let r=((e[0]+180)%360+360)%360-180;const n=Math.max(-90,Math.min(90,e[1]));let o=180===e[2]?180:((e[2]+180)%360+360)%360-180;const s=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)r=-180,o=180;else if(r>o){const e=this.getClusters([r,n,180,s],t),i=this.getClusters([-180,n,o,s],t);return e.concat(i)}const i=this.trees[this._limitZoom(t)],a=i.range($(r),W(s),$(o),W(n)),l=i.data,u=[];for(const e of a){const t=this.stride*e;u.push(l[t+5]>1?G(l,t,this.clusterProps):this.points[l[t+3]])}return u}getChildren(e){const t=this._getOriginId(e),r=this._getOriginZoom(e),n="No cluster with the specified id.",o=this.trees[r];if(!o)throw new Error(n);const s=o.data;if(t*this.stride>=s.length)throw new Error(n);const i=this.options.radius/(this.options.extent*Math.pow(2,r-1)),a=s[t*this.stride],l=s[t*this.stride+1],u=o.within(a,l,i),c=[];for(const t of u){const r=t*this.stride;s[r+4]===e&&c.push(s[r+5]>1?G(s,r,this.clusterProps):this.points[s[r+3]])}if(0===c.length)throw new Error(n);return c}getLeaves(e,t,r){t=t||10,r=r||0;const n=[];return this._appendLeaves(n,e,t,r,0),n}getTile(e,t,r){const n=this.trees[this._limitZoom(e)],o=Math.pow(2,e),{extent:s,radius:i}=this.options,a=i/s,l=(r-a)/o,u=(r+1+a)/o,c={features:[]};return this._addTileFeatures(n.range((t-a)/o,l,(t+1+a)/o,u),n.data,t,r,o,c),0===t&&this._addTileFeatures(n.range(1-a/o,l,1,u),n.data,o,r,o,c),t===o-1&&this._addTileFeatures(n.range(0,l,a/o,u),n.data,-1,r,o,c),c.features.length?c:null}getClusterExpansionZoom(e){let t=this._getOriginZoom(e)-1;for(;t<=this.options.maxZoom;){const r=this.getChildren(e);if(t++,1!==r.length)break;e=r[0].properties.cluster_id}return t}_appendLeaves(e,t,r,n,o){const s=this.getChildren(t);for(const t of s){const s=t.properties;if(s&&s.cluster?o+s.point_count<=n?o+=s.point_count:o=this._appendLeaves(e,s.cluster_id,r,n,o):o<n?o++:e.push(t),e.length===r)break}return o}_createTree(e){const t=new N(e.length/this.stride|0,this.options.nodeSize,Float32Array);for(let r=0;r<e.length;r+=this.stride)t.add(e[r],e[r+1]);return t.finish(),t.data=e,t}_addTileFeatures(e,t,r,n,o,s){for(const i of e){const e=i*this.stride,a=t[e+5]>1;let l,u,c;if(a)l=H(t,e,this.clusterProps),u=t[e],c=t[e+1];else{const r=this.points[t[e+3]];l=r.properties;const[n,o]=r.geometry.coordinates;u=$(n),c=W(o)}const d={type:1,geometry:[[Math.round(this.options.extent*(u*o-r)),Math.round(this.options.extent*(c*o-n))]],tags:l};let h;h=a||this.options.generateId?t[e+3]:this.points[t[e+3]].id,void 0!==h&&(d.id=h),s.features.push(d)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,t){const{radius:r,extent:n,reduce:o,minPoints:s}=this.options,i=r/(n*Math.pow(2,t)),a=e.data,l=[],u=this.stride;for(let r=0;r<a.length;r+=u){if(a[r+2]<=t)continue;a[r+2]=t;const n=a[r],c=a[r+1],d=e.within(a[r],a[r+1],i),h=a[r+5];let p=h;for(const e of d){const r=e*u;a[r+2]>t&&(p+=a[r+5])}if(p>h&&p>=s){let e,s=n*h,i=c*h,m=-1;const f=(r/u<<5)+(t+1)+this.points.length;for(const n of d){const l=n*u;if(a[l+2]<=t)continue;a[l+2]=t;const c=a[l+5];s+=a[l]*c,i+=a[l+1]*c,a[l+4]=f,o&&(e||(e=this._map(a,r,!0),m=this.clusterProps.length,this.clusterProps.push(e)),o(e,this._map(a,l)))}a[r+4]=f,l.push(s/p,i/p,1/0,f,-1,p),o&&l.push(m)}else{for(let e=0;e<u;e++)l.push(a[r+e]);if(p>1)for(const e of d){const r=e*u;if(!(a[r+2]<=t)){a[r+2]=t;for(let e=0;e<u;e++)l.push(a[r+e])}}}}return l}_getOriginId(e){return e-this.points.length>>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,t,r){if(e[t+5]>1){const n=this.clusterProps[e[t+6]];return r?Object.assign({},n):n}const n=this.points[e[t+3]].properties,o=this.options.map(n);return r&&o===n?Object.assign({},o):o}}function G(e,t,r){return{type:"Feature",id:e[t+3],properties:H(e,t,r),geometry:{type:"Point",coordinates:[(n=e[t],360*(n-.5)),J(e[t+1])]}};var n}function H(e,t,r){const n=e[t+5],o=n>=1e4?`${Math.round(n/1e3)}k`:n>=1e3?Math.round(n/100)/10+"k":n,s=e[t+6],i=-1===s?{}:Object.assign({},r[s]);return Object.assign(i,{cluster:!0,cluster_id:e[t+3],point_count:n,point_count_abbreviated:o})}function $(e){return e/360+.5}function W(e){const t=Math.sin(e*Math.PI/180),r=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return r<0?0:r>1?1:r}function J(e){const t=(180-360*e)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}"function"==typeof SuppressedError&&SuppressedError;class K{static isAdvancedMarkerAvailable(e){return google.maps.marker&&!0===e.getMapCapabilities().isAdvancedMarkersAvailable}static isAdvancedMarker(e){return google.maps.marker&&e instanceof google.maps.marker.AdvancedMarkerElement}static setMap(e,t){this.isAdvancedMarker(e)?e.map=t:e.setMap(t)}static getPosition(e){if(this.isAdvancedMarker(e)){if(e.position){if(e.position instanceof google.maps.LatLng)return e.position;if(Number.isFinite(e.position.lat)&&Number.isFinite(e.position.lng))return new google.maps.LatLng(e.position.lat,e.position.lng)}return new google.maps.LatLng(null)}return e.getPosition()}static getVisible(e){return!!this.isAdvancedMarker(e)||e.getVisible()}}class V{constructor({markers:e,position:t}){this.markers=[],e&&(this.markers=e),t&&(t instanceof google.maps.LatLng?this._position=t:this._position=new google.maps.LatLng(t))}get bounds(){if(0===this.markers.length&&!this._position)return;const e=new google.maps.LatLngBounds(this._position,this._position);for(const t of this.markers)e.extend(K.getPosition(t));return e}get position(){return this._position||this.bounds.getCenter()}get count(){return this.markers.filter((e=>K.getVisible(e))).length}push(e){this.markers.push(e)}delete(){this.marker&&(K.setMap(this.marker,null),this.marker=void 0),this.markers.length=0}}function Y(e,t="assertion failed"){if(null==e)throw Error(t)}class X{constructor({maxZoom:e=16}){this.maxZoom=e}noop({markers:e}){return Q(e)}}const Q=e=>e.map((e=>new V({position:K.getPosition(e),markers:[e]})));class ee extends X{constructor(e){var{maxZoom:t,radius:r=60}=e,n=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}(e,["maxZoom","radius"]);super({maxZoom:t}),this.markers=[],this.clusters=[],this.state={zoom:-1},this.superCluster=new U(Object.assign({maxZoom:this.maxZoom,radius:r},n))}calculate(e){let t=!1,r=e.map.getZoom();Y(r),r=Math.round(r);const n={zoom:r};if(!S(e.markers,this.markers)){t=!0,this.markers=[...e.markers];const r=this.markers.map((e=>{const t=K.getPosition(e);return{type:"Feature",geometry:{type:"Point",coordinates:[t.lng(),t.lat()]},properties:{marker:e}}}));this.superCluster.load(r)}return t||(this.state.zoom<=this.maxZoom||n.zoom<=this.maxZoom)&&(t=!S(this.state,n)),this.state=n,0===e.markers.length?(this.clusters=[],{clusters:this.clusters,changed:t}):(t&&(this.clusters=this.cluster(e)),{clusters:this.clusters,changed:t})}cluster({map:e}){const t=e.getZoom();return Y(t),this.superCluster.getClusters([-180,-90,180,90],Math.round(t)).map((e=>this.transformCluster(e)))}transformCluster({geometry:{coordinates:[e,t]},properties:r}){if(r.cluster)return new V({markers:this.superCluster.getLeaves(r.cluster_id,1/0).map((e=>e.properties.marker)),position:{lat:t,lng:e}});const n=r.marker;return new V({markers:[n],position:K.getPosition(n)})}}class te{constructor(e,t){this.markers={sum:e.length};const r=t.map((e=>e.count)),n=r.reduce(((e,t)=>e+t),0);this.clusters={count:t.length,markers:{mean:n/t.length,sum:n,min:Math.min(...r),max:Math.max(...r)}}}}class re{render({count:e,position:t},r,n){const o=`<svg fill="${e>Math.max(10,r.clusters.markers.mean)?"#ff0000":"#0000ff"}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 240" width="50" height="50">\n<circle cx="120" cy="120" opacity=".6" r="70" />\n<circle cx="120" cy="120" opacity=".3" r="90" />\n<circle cx="120" cy="120" opacity=".2" r="110" />\n<text x="50%" y="50%" style="fill:#fff" text-anchor="middle" font-size="50" dominant-baseline="middle" font-family="roboto,arial,sans-serif">${e}</text>\n</svg>`,s=`Cluster of ${e} markers`,i=Number(google.maps.Marker.MAX_ZINDEX)+e;if(K.isAdvancedMarkerAvailable(n)){const e=(new DOMParser).parseFromString(o,"image/svg+xml").documentElement;e.setAttribute("transform","translate(0 25)");const r={map:n,position:t,zIndex:i,title:s,content:e};return new google.maps.marker.AdvancedMarkerElement(r)}const a={position:t,zIndex:i,title:s,icon:{url:`data:image/svg+xml;base64,${btoa(o)}`,anchor:new google.maps.Point(25,25)}};return new google.maps.Marker(a)}}class ne{constructor(){!function(e,t){for(let r in t.prototype)e.prototype[r]=t.prototype[r]}(ne,google.maps.OverlayView)}}var oe;!function(e){e.CLUSTERING_BEGIN="clusteringbegin",e.CLUSTERING_END="clusteringend",e.CLUSTER_CLICK="click",e.GMP_CLICK="gmp-click"}(oe||(oe={}));const se=(e,t,r)=>{t.bounds&&r.fitBounds(t.bounds)};class ie extends ne{constructor({map:e,markers:t=[],algorithmOptions:r={},algorithm:n=new ee(r),renderer:o=new re,onClusterClick:s=se}){super(),this.map=null,this.idleListener=null,this.markers=[...t],this.clusters=[],this.algorithm=n,this.renderer=o,this.onClusterClick=s,e&&this.setMap(e)}addMarker(e,t){this.markers.includes(e)||(this.markers.push(e),t||this.render())}addMarkers(e,t){e.forEach((e=>{this.addMarker(e,!0)})),t||this.render()}removeMarker(e,t){const r=this.markers.indexOf(e);return-1!==r&&(K.setMap(e,null),this.markers.splice(r,1),t||this.render(),!0)}removeMarkers(e,t){let r=!1;return e.forEach((e=>{r=this.removeMarker(e,!0)||r})),r&&!t&&this.render(),r}clearMarkers(e){this.markers.length=0,e||this.render()}render(){const e=this.getMap();if(e instanceof google.maps.Map&&e.getProjection()){google.maps.event.trigger(this,oe.CLUSTERING_BEGIN,this);const{clusters:t,changed:r}=this.algorithm.calculate({markers:this.markers,map:e,mapCanvasProjection:this.getProjection()});if(r||null==r){const e=new Set;for(const r of t)1==r.markers.length&&e.add(r.markers[0]);const r=[];for(const t of this.clusters)null!=t.marker&&(1==t.markers.length?e.has(t.marker)||K.setMap(t.marker,null):r.push(t.marker));this.clusters=t,this.renderClusters(),requestAnimationFrame((()=>r.forEach((e=>K.setMap(e,null)))))}google.maps.event.trigger(this,oe.CLUSTERING_END,this)}}onAdd(){const e=this.getMap();Y(e),this.idleListener=e.addListener("idle",this.render.bind(this)),this.render()}onRemove(){this.idleListener&&google.maps.event.removeListener(this.idleListener),this.reset()}reset(){this.markers.forEach((e=>K.setMap(e,null))),this.clusters.forEach((e=>e.delete())),this.clusters=[]}renderClusters(){const e=new te(this.markers,this.clusters),t=this.getMap();this.clusters.forEach((r=>{if(1===r.markers.length)r.marker=r.markers[0];else if(r.marker=this.renderer.render(r,e,t),r.markers.forEach((e=>K.setMap(e,null))),this.onClusterClick){const e=K.isAdvancedMarker(r.marker)?oe.GMP_CLICK:oe.CLUSTER_CLICK;r.marker.addListener(e,(e=>{google.maps.event.trigger(this,oe.CLUSTER_CLICK,r),this.onClusterClick(e,r,t)}))}K.setMap(r.marker,t)}))}}}}]);