vue3-google-map 0.27.1 → 0.27.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -5
- package/dist/index.cjs +3481 -4
- package/dist/index.mjs +3444 -2185
- package/dist/index.umd.js +4 -4
- package/dist/themes/index.cjs +816 -1
- package/dist/themes/index.mjs +807 -1293
- package/dist/types/components/AdvancedMarker.vue.d.ts +3 -2
- package/dist/types/components/CustomControl.vue.d.ts +3 -2
- package/dist/types/components/CustomMarker.vue.d.ts +3 -2
- package/dist/types/components/DebouncedMarkerClusterer.d.ts +9 -1
- package/dist/types/components/GoogleMap.vue.d.ts +3 -2
- package/dist/types/components/HeatmapLayer.d.ts +6 -2
- package/dist/types/components/InfoWindow.vue.d.ts +3 -2
- package/dist/types/utils/index.d.ts +14 -0
- package/package.json +20 -21
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,3484 @@
|
|
|
1
|
-
(function(){
|
|
2
|
-
"use strict";var Qe=Object.defineProperty;var et=(t,e,r)=>e in t?Qe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var K=(t,e,r)=>(et(t,typeof e!="symbol"?e+"":e,r),r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("vue"),L=Symbol("map"),x=Symbol("api"),ue=Symbol("marker"),ce=Symbol("markerCluster"),te=Symbol("CustomMarker"),de=Symbol("mapTilesLoaded"),N=["click","dblclick","drag","dragend","dragstart","mousedown","mousemove","mouseout","mouseover","mouseup","rightclick"];function tt(t,e){t.src=e}const rt=t=>{var e,r,n,o="The Google Maps JavaScript API",s="google",i="importLibrary",u="__ib__",a=document,d=window,p=d[s]||(d[s]={}),c=p.maps||(p.maps={}),m=new Set,h=new URLSearchParams,g=()=>e||(e=new Promise(async(f,v)=>{var y;await(r=a.createElement("script")),h.set("libraries",[...m]+"");for(n in t)h.set(n.replace(/[A-Z]/g,k=>"_"+k[0].toLowerCase()),t[n]);h.set("callback",s+".maps."+u),tt(r,"https://maps.googleapis.com/maps/api/js?"+h),c[u]=f,r.onerror=()=>e=v(Error(o+" could not load.")),r.nonce=((y=a.querySelector("script[nonce]"))==null?void 0:y.nonce)||"",a.head.append(r)}));c[i]?console.warn(o+" only loads once. Ignoring:",t):c[i]=(f,...v)=>m.add(f)&&g().then(()=>c[i](f,...v))},nt=t=>`The setOptions() function should only be called once. The options passed to the additional call (${JSON.stringify(t)}) will be ignored.`,ot=t=>`The google.maps.importLibrary() function is already defined, and @googlemaps/js-api-loader will use the existing function instead of overwriting it. The options passed to setOptions (${JSON.stringify(t)}) will be ignored.`,st="No options were set before calling importLibrary. Make sure to configure the loader using setOptions().",at="There already is a script loading the Google Maps JavaScript API, and no google.maps.importLibrary function is defined. @googlemaps/js-api-loader will proceed to bootstrap the API with the specified options, but the existing script might cause problems using the API. Make sure to remove the script loading the API.",fe=process.env.NODE_ENV!=="production"?t=>{console.warn(`[@googlemaps/js-api-loader] ${t}`)}:()=>{},it=process.env.NODE_ENV!=="production"?t=>{console.info(`[@googlemaps/js-api-loader] ${t}`)}:()=>{};let ae=!1;function lt(t){if(ae){fe(nt(t));return}ct(t),ae=!0}async function ut(t){var e,r;if(ae||fe(st),!((r=(e=window==null?void 0:window.google)==null?void 0:e.maps)!=null&&r.importLibrary))throw new Error("google.maps.importLibrary is not installed.");return await google.maps.importLibrary(t)}function ct(t){var r,n;const e=!!((n=(r=window.google)==null?void 0:r.maps)!=null&&n.importLibrary);e?it(ot(t)):process.env.NODE_ENV!=="production"&&document.querySelector('script[src*="maps.googleapis.com/maps/api/js"]')&&fe(at),e||rt(t)}function dt(t){return class extends t.OverlayView{constructor(n){super();K(this,"element");K(this,"opts");const{element:o,...s}=n;this.element=o,this.opts=s,this.opts.map&&this.setMap(this.opts.map)}getPosition(){return this.opts.position?this.opts.position instanceof t.LatLng?this.opts.position:new t.LatLng(this.opts.position):null}getVisible(){if(!this.element)return!1;const n=this.element;return n.style.display!=="none"&&n.style.visibility!=="hidden"&&(n.style.opacity===""||Number(n.style.opacity)>.01)}onAdd(){if(!this.element)return;const n=this.getPanes();n&&n.overlayMouseTarget.appendChild(this.element)}draw(){if(!this.element)return;const n=this.getProjection(),o=n==null?void 0:n.fromLatLngToDivPixel(this.getPosition());if(o){this.element.style.position="absolute";let s,i;switch(this.opts.anchorPoint){case"TOP_CENTER":s="-50%",i="-100%";break;case"BOTTOM_CENTER":s="-50%",i="0";break;case"LEFT_CENTER":s="-100%",i="-50%";break;case"RIGHT_CENTER":s="0",i="-50%";break;case"TOP_LEFT":s="-100%",i="-100%";break;case"TOP_RIGHT":s="0",i="-100%";break;case"BOTTOM_LEFT":s="-100%",i="0";break;case"BOTTOM_RIGHT":s="0",i="0";break;default:s="-50%",i="-50%"}const u=o.x+(this.opts.offsetX||0)+"px",a=o.y+(this.opts.offsetY||0)+"px";this.element.style.transform=`translateX(${s}) translateX(${u}) translateY(${i}) translateY(${a})`,this.opts.zIndex&&(this.element.style.zIndex=this.opts.zIndex.toString())}}onRemove(){this.element&&this.element.remove()}setOptions(n){const{element:o,...s}=n;this.element=o,this.opts=s,this.draw()}}}let ge=!1;const ve=["bounds_changed","center_changed","click","contextmenu","dblclick","drag","dragend","dragstart","heading_changed","idle","isfractionalzoomenabled_changed","mapcapabilities_changed","maptypeid_changed","mousemove","mouseout","mouseover","projection_changed","renderingtype_changed","rightclick","tilesloaded","tilt_changed","zoom_changed"],ft=l.defineComponent({props:{apiPromise:{type:Promise},apiKey:{type:String,default:""},version:{type:String,default:"weekly"},libraries:{type:Array,default:()=>["places","marker"]},region:{type:String,required:!1},language:{type:String,required:!1},backgroundColor:{type:String,required:!1},center:{type:Object,default:()=>({lat:0,lng:0})},clickableIcons:{type:Boolean,required:!1,default:void 0},colorScheme:{type:String,required:!1},controlSize:{type:Number,required:!1},disableDefaultUi:{type:Boolean,required:!1,default:void 0},disableDoubleClickZoom:{type:Boolean,required:!1,default:void 0},draggable:{type:Boolean,required:!1,default:void 0},draggableCursor:{type:String,required:!1},draggingCursor:{type:String,required:!1},fullscreenControl:{type:Boolean,required:!1,default:void 0},fullscreenControlPosition:{type:String,required:!1},gestureHandling:{type:String,required:!1},heading:{type:Number,required:!1},isFractionalZoomEnabled:{type:Boolean,required:!1,default:void 0},keyboardShortcuts:{type:Boolean,required:!1,default:void 0},mapTypeControl:{type:Boolean,required:!1,default:void 0},mapTypeControlOptions:{type:Object,required:!1},mapTypeId:{type:[Number,String],required:!1},mapId:{type:String,required:!1},maxZoom:{type:Number,required:!1},minZoom:{type:Number,required:!1},noClear:{type:Boolean,required:!1,default:void 0},panControl:{type:Boolean,required:!1,default:void 0},panControlPosition:{type:String,required:!1},restriction:{type:Object,required:!1},rotateControl:{type:Boolean,required:!1,default:void 0},rotateControlPosition:{type:String,required:!1},scaleControl:{type:Boolean,required:!1,default:void 0},scaleControlStyle:{type:Number,required:!1},scrollwheel:{type:Boolean,required:!1,default:void 0},streetView:{type:Object,required:!1},streetViewControl:{type:Boolean,required:!1,default:void 0},streetViewControlPosition:{type:String,required:!1},styles:{type:Array,required:!1},tilt:{type:Number,required:!1},zoom:{type:Number,required:!1},zoomControl:{type:Boolean,required:!1,default:void 0},zoomControlPosition:{type:String,required:!1},cameraControl:{type:Boolean,required:!1,default:void 0},cameraControlPosition:{type:String,required:!1}},emits:[...ve],setup(t,{emit:e}){const r=l.ref(),n=l.ref(!1),o=l.ref(),s=l.ref(),i=l.ref(!1);l.provide(L,o),l.provide(x,s),l.provide(de,i);const u=()=>{const c={...t};Object.keys(c).forEach(f=>{c[f]===void 0&&delete c[f]});const h=f=>{var v;return f?{position:(v=s.value)==null?void 0:v.ControlPosition[f]}:{}},g={scaleControlOptions:t.scaleControlStyle?{style:t.scaleControlStyle}:{},panControlOptions:h(t.panControlPosition),zoomControlOptions:h(t.zoomControlPosition),rotateControlOptions:h(t.rotateControlPosition),streetViewControlOptions:h(t.streetViewControlPosition),fullscreenControlOptions:h(t.fullscreenControlPosition),cameraControlOptions:h(t.cameraControlPosition),disableDefaultUI:t.disableDefaultUi};return{...c,...g}},a=l.watch([s,o],([c,m])=>{const h=c,g=m;h&&g&&(h.event.addListenerOnce(g,"tilesloaded",()=>{i.value=!0}),setTimeout(a,0))},{immediate:!0}),d=()=>{const{apiKey:c,region:m,version:h,language:g,libraries:f}=t;lt({key:c,region:m,v:h,language:g,libraries:f})},p=c=>{const m=c?c.maps:google.maps;s.value=l.markRaw(m),o.value=l.markRaw(new m.Map(r.value,u()));const h=dt(s.value);s.value[te]=h,ve.forEach(f=>{var v;(v=o.value)==null||v.addListener(f,y=>e(f,y))}),n.value=!0;const g=Object.keys(t).filter(f=>!["apiPromise","apiKey","version","libraries","region","language","center","zoom"].includes(f)).map(f=>l.toRef(t,f));l.watch([()=>t.center,()=>t.zoom,...g],([f,v],[y,k])=>{var _,M,T;const{center:w,zoom:O,...b}=u();(_=o.value)==null||_.setOptions(b),v!==void 0&&v!==k&&((M=o.value)==null||M.setZoom(v));const E=!y||f.lng!==y.lng||f.lat!==y.lat;f&&E&&((T=o.value)==null||T.panTo(f))})};return l.onMounted(()=>{if(t.apiPromise&&t.apiPromise instanceof Promise)t.apiPromise.then(p);else{ge||(d(),ge=!0);const c=t.libraries&&t.libraries.length>0?t.libraries:["maps","marker"];Promise.all(c.map(m=>ut(m))).then(()=>p())}}),l.onBeforeUnmount(()=>{var c;i.value=!1,o.value&&((c=s.value)==null||c.event.clearInstanceListeners(o.value))}),{mapRef:r,ready:n,map:o,api:s,mapTilesLoaded:i}}});const F=(t,e)=>{const r=t.__vccOpts||t;for(const[n,o]of e)r[n]=o;return r},pt={ref:"mapRef",class:"mapdiv"};function mt(t,e,r,n,o,s){return l.openBlock(),l.createElementBlock("div",null,[l.createElementVNode("div",pt,null,512),l.renderSlot(t.$slots,"default",l.normalizeProps(l.guardReactiveProps({ready:t.ready,map:t.map,api:t.api,mapTilesLoaded:t.mapTilesLoaded})),void 0,!0)])}const ht=F(ft,[["render",mt],["__scopeId","data-v-4e398d5a"]]);function gt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var vt=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,o,s;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!t(e[o],r[o]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(s=Object.keys(e),n=s.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[o]))return!1;for(o=n;o--!==0;){var i=s[o];if(!t(e[i],r[i]))return!1}return!0}return e!==e&&r!==r};const V=gt(vt),ye="click",Ve="gmp-click",ke=["drag","dragend","dragstart",Ve],yt=l.defineComponent({name:"AdvancedMarker",props:{options:{type:Object,required:!0},pinOptions:{type:Object,required:!1}},emits:[...ke,ye],setup(t,{emit:e,expose:r,slots:n}){const o=l.ref(),s=l.computed(()=>{var h;return(h=n.content)==null?void 0:h.call(n).some(g=>g.type!==l.Comment)}),i=l.toRef(t,"options"),u=l.toRef(t,"pinOptions"),a=l.ref(),d=l.inject(L,l.ref()),p=l.inject(x,l.ref()),c=l.inject(ce,l.ref()),m=l.computed(()=>!!(c.value&&p.value&&a.value instanceof google.maps.marker.AdvancedMarkerElement));return l.watch([d,i,u,o],async(h,[g,f,v,y])=>{var _,M,T;const k=!V(i.value,f)||!V(u.value,v),w=o.value!==y,O=k||w||d.value!==g;if(!d.value||!p.value||!O||s.value&&!o.value)return;const{AdvancedMarkerElement:b,PinElement:E}=p.value.marker;if(a.value){const{map:z,content:W,...H}=i.value;Object.assign(a.value,{content:s.value?o.value:u.value?new E(u.value):W,...H}),m.value&&((_=c.value)==null||_.removeMarker(a.value),(M=c.value)==null||M.addMarker(a.value))}else s.value?i.value.content=o.value:u.value&&(i.value.content=new E(u.value)),a.value=l.markRaw(new b(i.value)),m.value?(T=c.value)==null||T.addMarker(a.value):a.value.map=d.value,ke.forEach(z=>{var W;(W=a.value)==null||W.addListener(z,H=>{e(z,H),z===Ve&&e(ye,H)})})},{immediate:!0,flush:"post"}),l.onBeforeUnmount(()=>{var h,g;a.value&&((h=p.value)==null||h.event.clearInstanceListeners(a.value),m.value?(g=c.value)==null||g.removeMarker(a.value):a.value.map=null)}),l.provide(ue,a),r({marker:a}),{hasCustomSlotContent:s,markerRef:o}}});const kt={key:0,class:"advanced-marker-wrapper"};function Et(t,e,r,n,o,s){return l.openBlock(),l.createElementBlock(l.Fragment,null,[t.hasCustomSlotContent?(l.openBlock(),l.createElementBlock("div",kt,[l.createElementVNode("div",l.mergeProps({ref:"markerRef"},t.$attrs),[l.renderSlot(t.$slots,"content")],16)])):l.createCommentVNode("",!0),l.renderSlot(t.$slots,"default")],64)}const wt=F(yt,[["render",Et]]),Ee=t=>t==="Marker",we=t=>t===te,B=(t,e,r,n)=>{const o=l.ref(),s=l.inject(L,l.ref()),i=l.inject(x,l.ref()),u=l.inject(ce,l.ref()),a=l.computed(()=>!!(u.value&&i.value&&(o.value instanceof i.value.Marker||o.value instanceof i.value[te])));return l.watch([s,r],(d,[p,c])=>{var h,g,f;const m=!V(r.value,c)||s.value!==p;if(!(!s.value||!i.value||!m))if(o.value)o.value.setOptions(r.value),a.value&&((h=u.value)==null||h.removeMarker(o.value),(g=u.value)==null||g.addMarker(o.value));else{if(Ee(t))o.value=l.markRaw(new i.value[t](r.value));else if(we(t)){const v=r.value;v.element&&(o.value=l.markRaw(new i.value[t](v)))}else o.value=l.markRaw(new i.value[t]({...r.value,map:s.value}));o.value&&(a.value?(f=u.value)==null||f.addMarker(o.value):(Ee(t)||we(t))&&o.value.setMap(s.value)),e.forEach(v=>{var y;(y=o.value)==null||y.addListener(v,k=>n(v,k))})}},{immediate:!0,flush:"post"}),l.onBeforeUnmount(()=>{var d,p;o.value&&((d=i.value)==null||d.event.clearInstanceListeners(o.value),a.value?(p=u.value)==null||p.removeMarker(o.value):o.value.setMap(null))}),o},_e=["animation_changed","click","dblclick","rightclick","dragstart","dragend","drag","mouseover","mousedown","mouseout","mouseup","draggable_changed","clickable_changed","contextmenu","cursor_changed","flat_changed","zindex_changed","icon_changed","position_changed","shape_changed","title_changed","visible_changed"],_t=l.defineComponent({name:"Marker",props:{options:{type:Object,required:!0}},emits:[..._e],setup(t,{emit:e,expose:r,slots:n}){const o=l.toRef(t,"options"),s=B("Marker",_e,o,e);return l.provide(ue,s),r({marker:s}),()=>{var i;return(i=n.default)==null?void 0:i.call(n)}}}),Ct=l.defineComponent({name:"Polyline",props:{options:{type:Object,required:!0}},emits:[...N],setup(t,{emit:e}){const r=l.toRef(t,"options");return{polyline:B("Polyline",N,r,e)}},render:()=>null}),bt=l.defineComponent({name:"Polygon",props:{options:{type:Object,required:!0}},emits:[...N],setup(t,{emit:e}){const r=l.toRef(t,"options");return{polygon:B("Polygon",N,r,e)}},render:()=>null}),Ce=[...N,"bounds_changed"],Mt=l.defineComponent({name:"Rectangle",props:{options:{type:Object,required:!0}},emits:[...Ce],setup(t,{emit:e}){const r=l.toRef(t,"options");return{rectangle:B("Rectangle",Ce,r,e)}},render:()=>null}),be=[...N,"center_changed","radius_changed"],Ot=l.defineComponent({name:"Circle",props:{options:{type:Object,required:!0}},emits:[...be],setup(t,{emit:e}){const r=l.toRef(t,"options");return{circle:B("Circle",be,r,e)}},render:()=>null}),St=l.defineComponent({props:{position:{type:String,required:!0},index:{type:Number,default:1}},emits:["content:loaded"],setup(t,{emit:e}){const r=l.ref(null),n=l.inject(L,l.ref()),o=l.inject(x,l.ref()),s=l.inject(de,l.ref(!1)),i=l.watch([s,o,r],([d,p,c])=>{p&&d&&c&&(u(t.position),e("content:loaded"),setTimeout(i,0))},{immediate:!0}),u=d=>{if(n.value&&o.value&&r.value){const p=o.value.ControlPosition[d];r.value.index=t.index,n.value.controls[p].push(r.value)}},a=d=>{if(n.value&&o.value){let p=null;const c=o.value.ControlPosition[d];n.value.controls[c].forEach((m,h)=>{m===r.value&&(p=h)}),p!==null&&n.value.controls[c].removeAt(p)}};return l.onBeforeUnmount(()=>a(t.position)),l.watch(()=>t.position,(d,p)=>{a(p),u(d)}),l.watch(()=>t.index,d=>{r.value&&(r.value.index=d)}),{controlRef:r}}});const Tt={ref:"controlRef",class:"custom-control-wrapper"};function Pt(t,e,r,n,o,s){return l.openBlock(),l.createElementBlock("div",Tt,[l.renderSlot(t.$slots,"default",{},void 0,!0)],512)}const At=F(St,[["render",Pt],["__scopeId","data-v-ab9120cd"]]);function Me(t){return t instanceof google.maps.marker.AdvancedMarkerElement?"gmp-click":"click"}const Oe=["closeclick","content_changed","domready","position_changed","visible","zindex_changed"],qt=l.defineComponent({inheritAttrs:!1,props:{options:{type:Object,default:()=>({})},modelValue:{type:Boolean}},emits:[...Oe,"update:modelValue"],setup(t,{slots:e,emit:r,expose:n}){const o=l.ref(),s=l.ref(),i=l.inject(L,l.ref()),u=l.inject(x,l.ref()),a=l.inject(ue,l.ref());let d,p=t.modelValue;const c=l.computed(()=>{var f;return(f=e.default)==null?void 0:f.call(e).some(v=>v.type!==l.Comment)}),m=f=>{p=f,r("update:modelValue",f)},h=f=>{o.value&&(o.value.open({map:i.value,anchor:a.value,...f}),m(!0))},g=()=>{o.value&&(o.value.close(),m(!1))};return l.onMounted(()=>{l.watch([i,()=>t.options],([f,v],[y,k])=>{var O;const w=!V(v,k)||i.value!==y;i.value&&u.value&&w&&(o.value?(o.value.setOptions({...v,content:c.value?s.value:v.content}),a.value||h()):(o.value=l.markRaw(new u.value.InfoWindow({...v,content:c.value?s.value:v.content})),a.value&&(d=a.value.addListener(Me(a.value),()=>h())),(!a.value||p)&&h(),Oe.forEach(b=>{var E;(E=o.value)==null||E.addListener(b,_=>r(b,_))}),(O=o.value)==null||O.addListener("closeclick",()=>m(!1))))},{immediate:!0,flush:"post"}),l.watch(a,(f,v)=>{!o.value||f===v||(d&&(d.remove(),d=void 0),f&&(d=f.addListener(Me(f),()=>h())))},{flush:"post"}),l.watch(()=>t.modelValue,f=>{f!==p&&(f?h():g())})}),l.onBeforeUnmount(()=>{var f;d&&d.remove(),o.value&&((f=u.value)==null||f.event.clearInstanceListeners(o.value),g())}),n({infoWindow:o,open:h,close:g}),{infoWindow:o,infoWindowRef:s,hasSlotContent:c,open:h,close:g}}});const Lt={key:0,class:"info-window-wrapper"};function xt(t,e,r,n,o,s){return t.hasSlotContent?(l.openBlock(),l.createElementBlock("div",Lt,[l.createElementVNode("div",l.mergeProps({ref:"infoWindowRef"},t.$attrs),[l.renderSlot(t.$slots,"default",{},void 0,!0)],16)])):l.createCommentVNode("",!0)}const jt=F(qt,[["render",xt],["__scopeId","data-v-4d4142cf"]]);var Rt=Object.getOwnPropertyNames,It=Object.getOwnPropertySymbols,Nt=Object.prototype.hasOwnProperty;function Se(t,e){return function(n,o,s){return t(n,o,s)&&e(n,o,s)}}function X(t){return function(r,n,o){if(!r||!n||typeof r!="object"||typeof n!="object")return t(r,n,o);var s=o.cache,i=s.get(r),u=s.get(n);if(i&&u)return i===n&&u===r;s.set(r,n),s.set(n,r);var a=t(r,n,o);return s.delete(r),s.delete(n),a}}function Te(t){return Rt(t).concat(It(t))}var Bt=Object.hasOwn||function(t,e){return Nt.call(t,e)};function I(t,e){return t===e||!t&&!e&&t!==t&&e!==e}var $t="__v",Dt="__o",Ut="_owner",Pe=Object.getOwnPropertyDescriptor,Ae=Object.keys;function Zt(t,e,r){var n=t.length;if(e.length!==n)return!1;for(;n-- >0;)if(!r.equals(t[n],e[n],n,n,t,e,r))return!1;return!0}function Vt(t,e){return I(t.getTime(),e.getTime())}function Gt(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function Ft(t,e){return t===e}function qe(t,e,r){var n=t.size;if(n!==e.size)return!1;if(!n)return!0;for(var o=new Array(n),s=t.entries(),i,u,a=0;(i=s.next())&&!i.done;){for(var d=e.entries(),p=!1,c=0;(u=d.next())&&!u.done;){if(o[c]){c++;continue}var m=i.value,h=u.value;if(r.equals(m[0],h[0],a,c,t,e,r)&&r.equals(m[1],h[1],m[0],h[0],t,e,r)){p=o[c]=!0;break}c++}if(!p)return!1;a++}return!0}var zt=I;function Wt(t,e,r){var n=Ae(t),o=n.length;if(Ae(e).length!==o)return!1;for(;o-- >0;)if(!Ge(t,e,r,n[o]))return!1;return!0}function $(t,e,r){var n=Te(t),o=n.length;if(Te(e).length!==o)return!1;for(var s,i,u;o-- >0;)if(s=n[o],!Ge(t,e,r,s)||(i=Pe(t,s),u=Pe(e,s),(i||u)&&(!i||!u||i.configurable!==u.configurable||i.enumerable!==u.enumerable||i.writable!==u.writable)))return!1;return!0}function Ht(t,e){return I(t.valueOf(),e.valueOf())}function Kt(t,e){return t.source===e.source&&t.flags===e.flags}function Le(t,e,r){var n=t.size;if(n!==e.size)return!1;if(!n)return!0;for(var o=new Array(n),s=t.values(),i,u;(i=s.next())&&!i.done;){for(var a=e.values(),d=!1,p=0;(u=a.next())&&!u.done;){if(!o[p]&&r.equals(i.value,u.value,i.value,u.value,t,e,r)){d=o[p]=!0;break}p++}if(!d)return!1}return!0}function Xt(t,e){var r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(t[r]!==e[r])return!1;return!0}function Yt(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function Ge(t,e,r,n){return(n===Ut||n===Dt||n===$t)&&(t.$$typeof||e.$$typeof)?!0:Bt(e,n)&&r.equals(t[n],e[n],n,n,t,e,r)}var Jt="[object Arguments]",Qt="[object Boolean]",er="[object Date]",tr="[object Error]",rr="[object Map]",nr="[object Number]",or="[object Object]",sr="[object RegExp]",ar="[object Set]",ir="[object String]",lr="[object URL]",ur=Array.isArray,xe=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,je=Object.assign,cr=Object.prototype.toString.call.bind(Object.prototype.toString);function dr(t){var e=t.areArraysEqual,r=t.areDatesEqual,n=t.areErrorsEqual,o=t.areFunctionsEqual,s=t.areMapsEqual,i=t.areNumbersEqual,u=t.areObjectsEqual,a=t.arePrimitiveWrappersEqual,d=t.areRegExpsEqual,p=t.areSetsEqual,c=t.areTypedArraysEqual,m=t.areUrlsEqual;return function(g,f,v){if(g===f)return!0;if(g==null||f==null)return!1;var y=typeof g;if(y!==typeof f)return!1;if(y!=="object")return y==="number"?i(g,f,v):y==="function"?o(g,f,v):!1;var k=g.constructor;if(k!==f.constructor)return!1;if(k===Object)return u(g,f,v);if(ur(g))return e(g,f,v);if(xe!=null&&xe(g))return c(g,f,v);if(k===Date)return r(g,f,v);if(k===RegExp)return d(g,f,v);if(k===Map)return s(g,f,v);if(k===Set)return p(g,f,v);var w=cr(g);return w===er?r(g,f,v):w===sr?d(g,f,v):w===rr?s(g,f,v):w===ar?p(g,f,v):w===or?typeof g.then!="function"&&typeof f.then!="function"&&u(g,f,v):w===lr?m(g,f,v):w===tr?n(g,f,v):w===Jt?u(g,f,v):w===Qt||w===nr||w===ir?a(g,f,v):!1}}function fr(t){var e=t.circular,r=t.createCustomConfig,n=t.strict,o={areArraysEqual:n?$:Zt,areDatesEqual:Vt,areErrorsEqual:Gt,areFunctionsEqual:Ft,areMapsEqual:n?Se(qe,$):qe,areNumbersEqual:zt,areObjectsEqual:n?$:Wt,arePrimitiveWrappersEqual:Ht,areRegExpsEqual:Kt,areSetsEqual:n?Se(Le,$):Le,areTypedArraysEqual:n?$:Xt,areUrlsEqual:Yt};if(r&&(o=je({},o,r(o))),e){var s=X(o.areArraysEqual),i=X(o.areMapsEqual),u=X(o.areObjectsEqual),a=X(o.areSetsEqual);o=je({},o,{areArraysEqual:s,areMapsEqual:i,areObjectsEqual:u,areSetsEqual:a})}return o}function pr(t){return function(e,r,n,o,s,i,u){return t(e,r,u)}}function mr(t){var e=t.circular,r=t.comparator,n=t.createState,o=t.equals,s=t.strict;if(n)return function(a,d){var p=n(),c=p.cache,m=c===void 0?e?new WeakMap:void 0:c,h=p.meta;return r(a,d,{cache:m,equals:o,meta:h,strict:s})};if(e)return function(a,d){return r(a,d,{cache:new WeakMap,equals:o,meta:void 0,strict:s})};var i={cache:void 0,equals:o,meta:void 0,strict:s};return function(a,d){return r(a,d,i)}}var Q=j();j({strict:!0});j({circular:!0});j({circular:!0,strict:!0});j({createInternalComparator:function(){return I}});j({strict:!0,createInternalComparator:function(){return I}});j({circular:!0,createInternalComparator:function(){return I}});j({circular:!0,createInternalComparator:function(){return I},strict:!0});function j(t){t===void 0&&(t={});var e=t.circular,r=e===void 0?!1:e,n=t.createInternalComparator,o=t.createState,s=t.strict,i=s===void 0?!1:s,u=fr(t),a=dr(u),d=n?n(a):pr(a);return mr({circular:r,comparator:a,createState:o,equals:d,strict:i})}const Re=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],re=1,D=8;class pe{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[r,n]=new Uint8Array(e,0,2);if(r!==219)throw new Error("Data does not appear to be in a KDBush format.");const o=n>>4;if(o!==re)throw new Error(`Got v${o} data when expected v${re}.`);const s=Re[n&15];if(!s)throw new Error("Unrecognized array type.");const[i]=new Uint16Array(e,2,1),[u]=new Uint32Array(e,4,1);return new pe(u,i,s,e)}constructor(e,r=64,n=Float64Array,o){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=n,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const s=Re.indexOf(this.ArrayType),i=e*2*this.ArrayType.BYTES_PER_ELEMENT,u=e*this.IndexArrayType.BYTES_PER_ELEMENT,a=(8-u%8)%8;if(s<0)throw new Error(`Unexpected typed array class: ${n}.`);o&&o instanceof ArrayBuffer?(this.data=o,this.ids=new this.IndexArrayType(this.data,D,e),this.coords=new this.ArrayType(this.data,D+u+a,e*2),this._pos=e*2,this._finished=!0):(this.data=new ArrayBuffer(D+i+u+a),this.ids=new this.IndexArrayType(this.data,D,e),this.coords=new this.ArrayType(this.data,D+u+a,e*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(re<<4)+s]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=e)}add(e,r){const n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=e,this.coords[this._pos++]=r,n}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return ie(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,r,n,o){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:s,coords:i,nodeSize:u}=this,a=[0,s.length-1,0],d=[];for(;a.length;){const p=a.pop()||0,c=a.pop()||0,m=a.pop()||0;if(c-m<=u){for(let v=m;v<=c;v++){const y=i[2*v],k=i[2*v+1];y>=e&&y<=n&&k>=r&&k<=o&&d.push(s[v])}continue}const h=m+c>>1,g=i[2*h],f=i[2*h+1];g>=e&&g<=n&&f>=r&&f<=o&&d.push(s[h]),(p===0?e<=g:r<=f)&&(a.push(m),a.push(h-1),a.push(1-p)),(p===0?n>=g:o>=f)&&(a.push(h+1),a.push(c),a.push(1-p))}return d}within(e,r,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:o,coords:s,nodeSize:i}=this,u=[0,o.length-1,0],a=[],d=n*n;for(;u.length;){const p=u.pop()||0,c=u.pop()||0,m=u.pop()||0;if(c-m<=i){for(let v=m;v<=c;v++)Ie(s[2*v],s[2*v+1],e,r)<=d&&a.push(o[v]);continue}const h=m+c>>1,g=s[2*h],f=s[2*h+1];Ie(g,f,e,r)<=d&&a.push(o[h]),(p===0?e-n<=g:r-n<=f)&&(u.push(m),u.push(h-1),u.push(1-p)),(p===0?e+n>=g:r+n>=f)&&(u.push(h+1),u.push(c),u.push(1-p))}return a}}function ie(t,e,r,n,o,s){if(o-n<=r)return;const i=n+o>>1;Fe(t,e,i,n,o,s),ie(t,e,r,n,i-1,1-s),ie(t,e,r,i+1,o,1-s)}function Fe(t,e,r,n,o,s){for(;o>n;){if(o-n>600){const d=o-n+1,p=r-n+1,c=Math.log(d),m=.5*Math.exp(2*c/3),h=.5*Math.sqrt(c*m*(d-m)/d)*(p-d/2<0?-1:1),g=Math.max(n,Math.floor(r-p*m/d+h)),f=Math.min(o,Math.floor(r+(d-p)*m/d+h));Fe(t,e,r,g,f,s)}const i=e[2*r+s];let u=n,a=o;for(U(t,e,n,r),e[2*o+s]>i&&U(t,e,n,o);u<a;){for(U(t,e,u,a),u++,a--;e[2*u+s]<i;)u++;for(;e[2*a+s]>i;)a--}e[2*n+s]===i?U(t,e,n,a):(a++,U(t,e,a,o)),a<=r&&(n=a+1),r<=a&&(o=a-1)}}function U(t,e,r,n){ne(t,r,n),ne(e,2*r,2*n),ne(e,2*r+1,2*n+1)}function ne(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function Ie(t,e,r,n){const o=t-r,s=e-n;return o*o+s*s}const hr={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},Ne=Math.fround||(t=>e=>(t[0]=+e,t[0]))(new Float32Array(1)),R=2,A=3,oe=4,P=5,ze=6;class We{constructor(e){this.options=Object.assign(Object.create(hr),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(e){const{log:r,minZoom:n,maxZoom:o}=this.options;r&&console.time("total time");const s=`prepare ${e.length} points`;r&&console.time(s),this.points=e;const i=[];for(let a=0;a<e.length;a++){const d=e[a];if(!d.geometry)continue;const[p,c]=d.geometry.coordinates,m=Ne(Y(p)),h=Ne(J(c));i.push(m,h,1/0,a,-1,1),this.options.reduce&&i.push(0)}let u=this.trees[o+1]=this._createTree(i);r&&console.timeEnd(s);for(let a=o;a>=n;a--){const d=+Date.now();u=this.trees[a]=this._createTree(this._cluster(u,a)),r&&console.log("z%d: %d clusters in %dms",a,u.numItems,+Date.now()-d)}return r&&console.timeEnd("total time"),this}getClusters(e,r){let n=((e[0]+180)%360+360)%360-180;const o=Math.max(-90,Math.min(90,e[1]));let s=e[2]===180?180:((e[2]+180)%360+360)%360-180;const i=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)n=-180,s=180;else if(n>s){const c=this.getClusters([n,o,180,i],r),m=this.getClusters([-180,o,s,i],r);return c.concat(m)}const u=this.trees[this._limitZoom(r)],a=u.range(Y(n),J(i),Y(s),J(o)),d=u.data,p=[];for(const c of a){const m=this.stride*c;p.push(d[m+P]>1?Be(d,m,this.clusterProps):this.points[d[m+A]])}return p}getChildren(e){const r=this._getOriginId(e),n=this._getOriginZoom(e),o="No cluster with the specified id.",s=this.trees[n];if(!s)throw new Error(o);const i=s.data;if(r*this.stride>=i.length)throw new Error(o);const u=this.options.radius/(this.options.extent*Math.pow(2,n-1)),a=i[r*this.stride],d=i[r*this.stride+1],p=s.within(a,d,u),c=[];for(const m of p){const h=m*this.stride;i[h+oe]===e&&c.push(i[h+P]>1?Be(i,h,this.clusterProps):this.points[i[h+A]])}if(c.length===0)throw new Error(o);return c}getLeaves(e,r,n){r=r||10,n=n||0;const o=[];return this._appendLeaves(o,e,r,n,0),o}getTile(e,r,n){const o=this.trees[this._limitZoom(e)],s=Math.pow(2,e),{extent:i,radius:u}=this.options,a=u/i,d=(n-a)/s,p=(n+1+a)/s,c={features:[]};return this._addTileFeatures(o.range((r-a)/s,d,(r+1+a)/s,p),o.data,r,n,s,c),r===0&&this._addTileFeatures(o.range(1-a/s,d,1,p),o.data,s,n,s,c),r===s-1&&this._addTileFeatures(o.range(0,d,a/s,p),o.data,-1,n,s,c),c.features.length?c:null}getClusterExpansionZoom(e){let r=this._getOriginZoom(e)-1;for(;r<=this.options.maxZoom;){const n=this.getChildren(e);if(r++,n.length!==1)break;e=n[0].properties.cluster_id}return r}_appendLeaves(e,r,n,o,s){const i=this.getChildren(r);for(const u of i){const a=u.properties;if(a&&a.cluster?s+a.point_count<=o?s+=a.point_count:s=this._appendLeaves(e,a.cluster_id,n,o,s):s<o?s++:e.push(u),e.length===n)break}return s}_createTree(e){const r=new pe(e.length/this.stride|0,this.options.nodeSize,Float32Array);for(let n=0;n<e.length;n+=this.stride)r.add(e[n],e[n+1]);return r.finish(),r.data=e,r}_addTileFeatures(e,r,n,o,s,i){for(const u of e){const a=u*this.stride,d=r[a+P]>1;let p,c,m;if(d)p=He(r,a,this.clusterProps),c=r[a],m=r[a+1];else{const f=this.points[r[a+A]];p=f.properties;const[v,y]=f.geometry.coordinates;c=Y(v),m=J(y)}const h={type:1,geometry:[[Math.round(this.options.extent*(c*s-n)),Math.round(this.options.extent*(m*s-o))]],tags:p};let g;d||this.options.generateId?g=r[a+A]:g=this.points[r[a+A]].id,g!==void 0&&(h.id=g),i.features.push(h)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,r){const{radius:n,extent:o,reduce:s,minPoints:i}=this.options,u=n/(o*Math.pow(2,r)),a=e.data,d=[],p=this.stride;for(let c=0;c<a.length;c+=p){if(a[c+R]<=r)continue;a[c+R]=r;const m=a[c],h=a[c+1],g=e.within(a[c],a[c+1],u),f=a[c+P];let v=f;for(const y of g){const k=y*p;a[k+R]>r&&(v+=a[k+P])}if(v>f&&v>=i){let y=m*f,k=h*f,w,O=-1;const b=((c/p|0)<<5)+(r+1)+this.points.length;for(const E of g){const _=E*p;if(a[_+R]<=r)continue;a[_+R]=r;const M=a[_+P];y+=a[_]*M,k+=a[_+1]*M,a[_+oe]=b,s&&(w||(w=this._map(a,c,!0),O=this.clusterProps.length,this.clusterProps.push(w)),s(w,this._map(a,_)))}a[c+oe]=b,d.push(y/v,k/v,1/0,b,-1,v),s&&d.push(O)}else{for(let y=0;y<p;y++)d.push(a[c+y]);if(v>1)for(const y of g){const k=y*p;if(!(a[k+R]<=r)){a[k+R]=r;for(let w=0;w<p;w++)d.push(a[k+w])}}}}return d}_getOriginId(e){return e-this.points.length>>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,r,n){if(e[r+P]>1){const i=this.clusterProps[e[r+ze]];return n?Object.assign({},i):i}const o=this.points[e[r+A]].properties,s=this.options.map(o);return n&&s===o?Object.assign({},s):s}}function Be(t,e,r){return{type:"Feature",id:t[e+A],properties:He(t,e,r),geometry:{type:"Point",coordinates:[gr(t[e]),vr(t[e+1])]}}}function He(t,e,r){const n=t[e+P],o=n>=1e4?`${Math.round(n/1e3)}k`:n>=1e3?`${Math.round(n/100)/10}k`:n,s=t[e+ze],i=s===-1?{}:Object.assign({},r[s]);return Object.assign(i,{cluster:!0,cluster_id:t[e+A],point_count:n,point_count_abbreviated:o})}function Y(t){return t/360+.5}function J(t){const e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function gr(t){return(t-.5)*360}function vr(t){const e=(180-t*360)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function me(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]]);return r}class C{static isAdvancedMarkerAvailable(e){return google.maps.marker&&e.getMapCapabilities().isAdvancedMarkersAvailable===!0}static isAdvancedMarker(e){return google.maps.marker&&e instanceof google.maps.marker.AdvancedMarkerElement}static setMap(e,r){this.isAdvancedMarker(e)?e.map=r:e.setMap(r)}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)?!0:e.getVisible()}}class G{constructor({markers:e,position:r}){this.markers=[],e&&(this.markers=e),r&&(r instanceof google.maps.LatLng?this._position=r:this._position=new google.maps.LatLng(r))}get bounds(){if(this.markers.length===0&&!this._position)return;const e=new google.maps.LatLngBounds(this._position,this._position);for(const r of this.markers)e.extend(C.getPosition(r));return e}get position(){return this._position||this.bounds.getCenter()}get count(){return this.markers.filter(e=>C.getVisible(e)).length}push(e){this.markers.push(e)}delete(){this.marker&&(C.setMap(this.marker,null),this.marker=void 0),this.markers.length=0}}function S(t,e="assertion failed"){if(t==null)throw Error(e)}const yr=(t,e,r,n)=>{const o=t.getBounds();S(o);const s=Ke(o,e,n);return r.filter(i=>s.contains(C.getPosition(i)))},Ke=(t,e,r)=>{const{northEast:n,southWest:o}=Er(t,e),s=wr({northEast:n,southWest:o},r);return _r(s,e)},kr=(t,e,r)=>{const n=Ke(t,e,r),o=n.getNorthEast(),s=n.getSouthWest();return[s.lng(),s.lat(),o.lng(),o.lat()]},Er=(t,e)=>{const r=e.fromLatLngToDivPixel(t.getNorthEast()),n=e.fromLatLngToDivPixel(t.getSouthWest());return S(r),S(n),{northEast:r,southWest:n}},wr=({northEast:t,southWest:e},r)=>(t.x+=r,t.y-=r,e.x-=r,e.y+=r,{northEast:t,southWest:e}),_r=({northEast:t,southWest:e},r)=>{const n=r.fromDivPixelToLatLng(e),o=r.fromDivPixelToLatLng(t);return new google.maps.LatLngBounds(n,o)};class Xe{constructor({maxZoom:e=16}){this.maxZoom=e}noop({markers:e}){return br(e)}}class Cr extends Xe{constructor(e){var{viewportPadding:r=60}=e,n=me(e,["viewportPadding"]);super(n),this.viewportPadding=60,this.viewportPadding=r}calculate({markers:e,map:r,mapCanvasProjection:n}){const o=r.getZoom();return S(o),o>=this.maxZoom?{clusters:this.noop({markers:e}),changed:!1}:{clusters:this.cluster({markers:yr(r,n,e,this.viewportPadding),map:r,mapCanvasProjection:n})}}}const br=t=>t.map(r=>new G({position:C.getPosition(r),markers:[r]}));class Mr extends Xe{constructor(e){var{maxZoom:r,radius:n=60}=e,o=me(e,["maxZoom","radius"]);super({maxZoom:r}),this.markers=[],this.clusters=[],this.state={zoom:-1},this.superCluster=new We(Object.assign({maxZoom:this.maxZoom,radius:n},o))}calculate(e){let r=!1,n=e.map.getZoom();S(n),n=Math.round(n);const o={zoom:n};if(!Q(e.markers,this.markers)){r=!0,this.markers=[...e.markers];const s=this.markers.map(i=>{const u=C.getPosition(i);return{type:"Feature",geometry:{type:"Point",coordinates:[u.lng(),u.lat()]},properties:{marker:i}}});this.superCluster.load(s)}return r||(this.state.zoom<=this.maxZoom||o.zoom<=this.maxZoom)&&(r=!Q(this.state,o)),this.state=o,e.markers.length===0?(this.clusters=[],{clusters:this.clusters,changed:r}):(r&&(this.clusters=this.cluster(e)),{clusters:this.clusters,changed:r})}cluster({map:e}){const r=e.getZoom();return S(r),this.superCluster.getClusters([-180,-90,180,90],Math.round(r)).map(n=>this.transformCluster(n))}transformCluster({geometry:{coordinates:[e,r]},properties:n}){if(n.cluster)return new G({markers:this.superCluster.getLeaves(n.cluster_id,1/0).map(s=>s.properties.marker),position:{lat:r,lng:e}});const o=n.marker;return new G({markers:[o],position:C.getPosition(o)})}}class Or extends Cr{constructor(e){var{maxZoom:r,radius:n=60,viewportPadding:o=60}=e,s=me(e,["maxZoom","radius","viewportPadding"]);super({maxZoom:r,viewportPadding:o}),this.markers=[],this.clusters=[],this.superCluster=new We(Object.assign({maxZoom:this.maxZoom,radius:n},s)),this.state={zoom:-1,view:[0,0,0,0]}}calculate(e){const r=this.getViewportState(e);let n=!Q(this.state,r);if(!Q(e.markers,this.markers)){n=!0,this.markers=[...e.markers];const o=this.markers.map(s=>{const i=C.getPosition(s);return{type:"Feature",geometry:{type:"Point",coordinates:[i.lng(),i.lat()]},properties:{marker:s}}});this.superCluster.load(o)}return n&&(this.clusters=this.cluster(e),this.state=r),{clusters:this.clusters,changed:n}}cluster(e){const r=this.getViewportState(e);return this.superCluster.getClusters(r.view,r.zoom).map(n=>this.transformCluster(n))}transformCluster({geometry:{coordinates:[e,r]},properties:n}){if(n.cluster)return new G({markers:this.superCluster.getLeaves(n.cluster_id,1/0).map(s=>s.properties.marker),position:{lat:r,lng:e}});const o=n.marker;return new G({markers:[o],position:C.getPosition(o)})}getViewportState(e){const r=e.map.getZoom(),n=e.map.getBounds();return S(r),S(n),{zoom:Math.round(r),view:kr(n,e.mapCanvasProjection,this.viewportPadding)}}}class Sr{constructor(e,r){this.markers={sum:e.length};const n=r.map(s=>s.count),o=n.reduce((s,i)=>s+i,0);this.clusters={count:r.length,markers:{mean:o/r.length,sum:o,min:Math.min(...n),max:Math.max(...n)}}}}class Tr{render({count:e,position:r},n,o){const i=`<svg fill="${e>Math.max(10,n.clusters.markers.mean)?"#ff0000":"#0000ff"}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 240" width="50" height="50">
|
|
1
|
+
(function() { try { if (typeof document != "undefined") { var elementStyle = document.createElement("style"); elementStyle.nonce = document.head.querySelector("meta[property=csp-nonce]")?.content; elementStyle.appendChild(document.createTextNode(".mapdiv[data-v-4e398d5a] {\n width: 100%;\n height: 100%;\n}\n\n.advanced-marker-wrapper {\n display: none;\n}\n.mapdiv .advanced-marker-wrapper {\n display: inline-block;\n}\n\n.custom-control-wrapper[data-v-ab9120cd] {\n display: none;\n}\n.mapdiv .custom-control-wrapper[data-v-ab9120cd] {\n display: inline-block;\n}\n\n.info-window-wrapper[data-v-e3e9b802] {\n display: none;\n}\n.mapdiv .info-window-wrapper[data-v-e3e9b802] {\n display: inline-block;\n}\n\n.custom-marker-wrapper[data-v-574a274a] {\n display: none;\n}\n.mapdiv .custom-marker-wrapper[data-v-574a274a] {\n display: inline-block;\n}\n/*$vite$:1*/")); document.head.appendChild(elementStyle); } } catch (e) { console.error("vite-plugin-css-injected-by-js", e); }})();
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
//#region \0rolldown/runtime.js
|
|
4
|
+
var __create = Object.create;
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
13
|
+
key = keys[i];
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
|
+
get: ((k) => from[k]).bind(null, key),
|
|
16
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
22
|
+
value: mod,
|
|
23
|
+
enumerable: true
|
|
24
|
+
}) : target, mod));
|
|
25
|
+
//#endregion
|
|
26
|
+
let vue = require("vue");
|
|
27
|
+
//#region src/shared/index.ts
|
|
28
|
+
var mapSymbol = Symbol("map");
|
|
29
|
+
var apiSymbol = Symbol("api");
|
|
30
|
+
var markerSymbol = Symbol("marker");
|
|
31
|
+
var markerClusterSymbol = Symbol("markerCluster");
|
|
32
|
+
var customMarkerClassSymbol = Symbol("CustomMarker");
|
|
33
|
+
/**
|
|
34
|
+
* Utilitary flag for components that need to know the map
|
|
35
|
+
* was fully loaded (including its tiles) to decide their behavior
|
|
36
|
+
*/
|
|
37
|
+
var mapTilesLoadedSymbol = Symbol("mapTilesLoaded");
|
|
38
|
+
var polylineEvents = [
|
|
39
|
+
"click",
|
|
40
|
+
"dblclick",
|
|
41
|
+
"drag",
|
|
42
|
+
"dragend",
|
|
43
|
+
"dragstart",
|
|
44
|
+
"mousedown",
|
|
45
|
+
"mousemove",
|
|
46
|
+
"mouseout",
|
|
47
|
+
"mouseover",
|
|
48
|
+
"mouseup",
|
|
49
|
+
"rightclick"
|
|
50
|
+
];
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region node_modules/.pnpm/@googlemaps+js-api-loader@2.0.2/node_modules/@googlemaps/js-api-loader/dist/index.js
|
|
53
|
+
function setScriptSrc(script, src) {
|
|
54
|
+
script.src = src;
|
|
55
|
+
}
|
|
56
|
+
var bootstrap = (bootstrapParams) => {
|
|
57
|
+
var bootstrapPromise;
|
|
58
|
+
var script;
|
|
59
|
+
var bootstrapParamsKey;
|
|
60
|
+
var PRODUCT_NAME = "The Google Maps JavaScript API";
|
|
61
|
+
var GOOGLE = "google";
|
|
62
|
+
var IMPORT_API_NAME = "importLibrary";
|
|
63
|
+
var PENDING_BOOTSTRAP_KEY = "__ib__";
|
|
64
|
+
var doc = document;
|
|
65
|
+
var global_ = window;
|
|
66
|
+
var google_ = global_[GOOGLE] || (global_[GOOGLE] = {});
|
|
67
|
+
var namespace = google_.maps || (google_.maps = {});
|
|
68
|
+
var libraries = /* @__PURE__ */ new Set();
|
|
69
|
+
var searchParams = new URLSearchParams();
|
|
70
|
+
var triggerBootstrap = () => bootstrapPromise || (bootstrapPromise = new Promise(async (resolve, reject) => {
|
|
71
|
+
await (script = doc.createElement("script"));
|
|
72
|
+
searchParams.set("libraries", [...libraries] + "");
|
|
73
|
+
for (bootstrapParamsKey in bootstrapParams) searchParams.set(bootstrapParamsKey.replace(/[A-Z]/g, (g) => "_" + g[0].toLowerCase()), bootstrapParams[bootstrapParamsKey]);
|
|
74
|
+
searchParams.set("callback", GOOGLE + ".maps." + PENDING_BOOTSTRAP_KEY);
|
|
75
|
+
setScriptSrc(script, "https://maps.googleapis.com/maps/api/js?" + searchParams);
|
|
76
|
+
namespace[PENDING_BOOTSTRAP_KEY] = resolve;
|
|
77
|
+
script.onerror = () => bootstrapPromise = reject(Error(PRODUCT_NAME + " could not load."));
|
|
78
|
+
script.nonce = doc.querySelector("script[nonce]")?.nonce || "";
|
|
79
|
+
doc.head.append(script);
|
|
80
|
+
}));
|
|
81
|
+
namespace[IMPORT_API_NAME] ? console.warn(PRODUCT_NAME + " only loads once. Ignoring:", bootstrapParams) : namespace[IMPORT_API_NAME] = (libraryName, ...args) => libraries.add(libraryName) && triggerBootstrap().then(() => namespace[IMPORT_API_NAME](libraryName, ...args));
|
|
82
|
+
};
|
|
83
|
+
var MSG_REPEATED_SET_OPTIONS = (options) => `The setOptions() function should only be called once. The options passed to the additional call (${JSON.stringify(options)}) will be ignored.`;
|
|
84
|
+
var MSG_IMPORT_LIBRARY_EXISTS = (options) => `The google.maps.importLibrary() function is already defined, and @googlemaps/js-api-loader will use the existing function instead of overwriting it. The options passed to setOptions (${JSON.stringify(options)}) will be ignored.`;
|
|
85
|
+
var MSG_SET_OPTIONS_NOT_CALLED = "No options were set before calling importLibrary. Make sure to configure the loader using setOptions().";
|
|
86
|
+
var MSG_SCRIPT_ELEMENT_EXISTS = "There already is a script loading the Google Maps JavaScript API, and no google.maps.importLibrary function is defined. @googlemaps/js-api-loader will proceed to bootstrap the API with the specified options, but the existing script might cause problems using the API. Make sure to remove the script loading the API.";
|
|
87
|
+
var __DEV__$1 = process.env.NODE_ENV !== "production";
|
|
88
|
+
var logDevWarning = __DEV__$1 ? (message) => {
|
|
89
|
+
console.warn(`[@googlemaps/js-api-loader] ${message}`);
|
|
90
|
+
} : () => {};
|
|
91
|
+
var logDevNotice = __DEV__$1 ? (message) => {
|
|
92
|
+
console.info(`[@googlemaps/js-api-loader] ${message}`);
|
|
93
|
+
} : () => {};
|
|
94
|
+
var __DEV__ = process.env.NODE_ENV !== "production";
|
|
95
|
+
var setOptionsWasCalled_ = false;
|
|
96
|
+
/**
|
|
97
|
+
* Sets the options for the Maps JavaScript API.
|
|
98
|
+
*
|
|
99
|
+
* Has to be called before any library is loaded.
|
|
100
|
+
*
|
|
101
|
+
* See https://developers.google.com/maps/documentation/javascript/load-maps-js-api#required_parameters
|
|
102
|
+
* for the full documentation of available options.
|
|
103
|
+
*
|
|
104
|
+
* @param options The options to set.
|
|
105
|
+
*/
|
|
106
|
+
function setOptions(options) {
|
|
107
|
+
if (setOptionsWasCalled_) {
|
|
108
|
+
logDevWarning(MSG_REPEATED_SET_OPTIONS(options));
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
installImportLibrary_(options);
|
|
112
|
+
setOptionsWasCalled_ = true;
|
|
113
|
+
}
|
|
114
|
+
async function importLibrary(libraryName) {
|
|
115
|
+
if (!setOptionsWasCalled_) logDevWarning(MSG_SET_OPTIONS_NOT_CALLED);
|
|
116
|
+
if (!window?.google?.maps?.importLibrary) throw new Error("google.maps.importLibrary is not installed.");
|
|
117
|
+
return await google.maps.importLibrary(libraryName);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* The installImportLibrary_ function makes sure that a usable version of the
|
|
121
|
+
* `google.maps.importLibrary` function exists.
|
|
122
|
+
*/
|
|
123
|
+
function installImportLibrary_(options) {
|
|
124
|
+
const importLibraryExists = Boolean(window.google?.maps?.importLibrary);
|
|
125
|
+
if (importLibraryExists) logDevNotice(MSG_IMPORT_LIBRARY_EXISTS(options));
|
|
126
|
+
else if (__DEV__) {
|
|
127
|
+
if (document.querySelector("script[src*=\"maps.googleapis.com/maps/api/js\"]")) logDevWarning(MSG_SCRIPT_ELEMENT_EXISTS);
|
|
128
|
+
}
|
|
129
|
+
if (!importLibraryExists) bootstrap(options);
|
|
130
|
+
}
|
|
131
|
+
//#endregion
|
|
132
|
+
//#region src/utils/index.ts
|
|
133
|
+
function isPlainObject(value) {
|
|
134
|
+
if (value === null || typeof value !== "object") return false;
|
|
135
|
+
const proto = Object.getPrototypeOf(value);
|
|
136
|
+
return proto === Object.prototype || proto === null;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Snapshots the plain-data portions of an options object so it can be compared
|
|
140
|
+
* against a future value even if the source (or any of its nested arrays /
|
|
141
|
+
* objects) is mutated in place. This is what enables deep reactivity of
|
|
142
|
+
* `:options` props: without a snapshot insulated from in-place mutation, the
|
|
143
|
+
* change-detection `equal()` check would compare the live value against an old
|
|
144
|
+
* value that shares the same (already-mutated) nested references and therefore
|
|
145
|
+
* never detect a change.
|
|
146
|
+
*
|
|
147
|
+
* Plain objects and arrays are deep-cloned. Non-plain values — DOM nodes, class
|
|
148
|
+
* instances (e.g. `google.maps.LatLng`), and functions — are preserved by
|
|
149
|
+
* reference and compared by identity.
|
|
150
|
+
*/
|
|
151
|
+
function cloneOptions(options) {
|
|
152
|
+
if (Array.isArray(options)) return options.map((item) => cloneOptions(item));
|
|
153
|
+
if (isPlainObject(options)) {
|
|
154
|
+
const result = {};
|
|
155
|
+
for (const key of Object.keys(options)) result[key] = cloneOptions(options[key]);
|
|
156
|
+
return result;
|
|
157
|
+
}
|
|
158
|
+
return options;
|
|
159
|
+
}
|
|
160
|
+
function createCustomMarkerClass(api) {
|
|
161
|
+
return class CustomMarker extends api.OverlayView {
|
|
162
|
+
element;
|
|
163
|
+
opts;
|
|
164
|
+
constructor(opts) {
|
|
165
|
+
super();
|
|
166
|
+
const { element, ...rest } = opts;
|
|
167
|
+
this.element = element;
|
|
168
|
+
this.opts = rest;
|
|
169
|
+
if (this.opts.map) this.setMap(this.opts.map);
|
|
170
|
+
}
|
|
171
|
+
getPosition() {
|
|
172
|
+
return this.opts.position ? this.opts.position instanceof api.LatLng ? this.opts.position : new api.LatLng(this.opts.position) : null;
|
|
173
|
+
}
|
|
174
|
+
getVisible() {
|
|
175
|
+
if (!this.element) return false;
|
|
176
|
+
const element = this.element;
|
|
177
|
+
return element.style.display !== "none" && element.style.visibility !== "hidden" && (element.style.opacity === "" || Number(element.style.opacity) > .01);
|
|
178
|
+
}
|
|
179
|
+
onAdd() {
|
|
180
|
+
if (!this.element) return;
|
|
181
|
+
const panes = this.getPanes();
|
|
182
|
+
if (panes) panes.overlayMouseTarget.appendChild(this.element);
|
|
183
|
+
}
|
|
184
|
+
draw() {
|
|
185
|
+
if (!this.element) return;
|
|
186
|
+
const point = this.getProjection()?.fromLatLngToDivPixel(this.getPosition());
|
|
187
|
+
if (point) {
|
|
188
|
+
this.element.style.position = "absolute";
|
|
189
|
+
let transformX, transformY;
|
|
190
|
+
switch (this.opts.anchorPoint) {
|
|
191
|
+
case "TOP_CENTER":
|
|
192
|
+
transformX = "-50%";
|
|
193
|
+
transformY = "-100%";
|
|
194
|
+
break;
|
|
195
|
+
case "BOTTOM_CENTER":
|
|
196
|
+
transformX = "-50%";
|
|
197
|
+
transformY = "0";
|
|
198
|
+
break;
|
|
199
|
+
case "LEFT_CENTER":
|
|
200
|
+
transformX = "-100%";
|
|
201
|
+
transformY = "-50%";
|
|
202
|
+
break;
|
|
203
|
+
case "RIGHT_CENTER":
|
|
204
|
+
transformX = "0";
|
|
205
|
+
transformY = "-50%";
|
|
206
|
+
break;
|
|
207
|
+
case "TOP_LEFT":
|
|
208
|
+
transformX = "-100%";
|
|
209
|
+
transformY = "-100%";
|
|
210
|
+
break;
|
|
211
|
+
case "TOP_RIGHT":
|
|
212
|
+
transformX = "0";
|
|
213
|
+
transformY = "-100%";
|
|
214
|
+
break;
|
|
215
|
+
case "BOTTOM_LEFT":
|
|
216
|
+
transformX = "-100%";
|
|
217
|
+
transformY = "0";
|
|
218
|
+
break;
|
|
219
|
+
case "BOTTOM_RIGHT":
|
|
220
|
+
transformX = "0";
|
|
221
|
+
transformY = "0";
|
|
222
|
+
break;
|
|
223
|
+
default:
|
|
224
|
+
transformX = "-50%";
|
|
225
|
+
transformY = "-50%";
|
|
226
|
+
}
|
|
227
|
+
const xPos = point.x + (this.opts.offsetX || 0) + "px";
|
|
228
|
+
const yPos = point.y + (this.opts.offsetY || 0) + "px";
|
|
229
|
+
this.element.style.transform = `translateX(${transformX}) translateX(${xPos}) translateY(${transformY}) translateY(${yPos})`;
|
|
230
|
+
if (this.opts.zIndex) this.element.style.zIndex = this.opts.zIndex.toString();
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
onRemove() {
|
|
234
|
+
if (!this.element) return;
|
|
235
|
+
this.element.remove();
|
|
236
|
+
}
|
|
237
|
+
setOptions(opts) {
|
|
238
|
+
const { element, ...rest } = opts;
|
|
239
|
+
this.element = element;
|
|
240
|
+
this.opts = rest;
|
|
241
|
+
this.draw();
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
//#endregion
|
|
246
|
+
//#region src/components/GoogleMap.vue?vue&type=script&lang.ts
|
|
247
|
+
var isOptionsSet = false;
|
|
248
|
+
var mapEvents = [
|
|
249
|
+
"bounds_changed",
|
|
250
|
+
"center_changed",
|
|
251
|
+
"click",
|
|
252
|
+
"contextmenu",
|
|
253
|
+
"dblclick",
|
|
254
|
+
"drag",
|
|
255
|
+
"dragend",
|
|
256
|
+
"dragstart",
|
|
257
|
+
"heading_changed",
|
|
258
|
+
"idle",
|
|
259
|
+
"isfractionalzoomenabled_changed",
|
|
260
|
+
"mapcapabilities_changed",
|
|
261
|
+
"maptypeid_changed",
|
|
262
|
+
"mousemove",
|
|
263
|
+
"mouseout",
|
|
264
|
+
"mouseover",
|
|
265
|
+
"projection_changed",
|
|
266
|
+
"renderingtype_changed",
|
|
267
|
+
"rightclick",
|
|
268
|
+
"tilesloaded",
|
|
269
|
+
"tilt_changed",
|
|
270
|
+
"zoom_changed"
|
|
271
|
+
];
|
|
272
|
+
var GoogleMap_vue_vue_type_script_lang_default = (0, vue.defineComponent)({
|
|
273
|
+
props: {
|
|
274
|
+
apiPromise: { type: Promise },
|
|
275
|
+
apiKey: {
|
|
276
|
+
type: String,
|
|
277
|
+
default: ""
|
|
278
|
+
},
|
|
279
|
+
version: {
|
|
280
|
+
type: String,
|
|
281
|
+
default: "weekly"
|
|
282
|
+
},
|
|
283
|
+
libraries: {
|
|
284
|
+
type: Array,
|
|
285
|
+
default: () => ["places", "marker"]
|
|
286
|
+
},
|
|
287
|
+
region: {
|
|
288
|
+
type: String,
|
|
289
|
+
required: false
|
|
290
|
+
},
|
|
291
|
+
language: {
|
|
292
|
+
type: String,
|
|
293
|
+
required: false
|
|
294
|
+
},
|
|
295
|
+
backgroundColor: {
|
|
296
|
+
type: String,
|
|
297
|
+
required: false
|
|
298
|
+
},
|
|
299
|
+
center: {
|
|
300
|
+
type: Object,
|
|
301
|
+
default: () => ({
|
|
302
|
+
lat: 0,
|
|
303
|
+
lng: 0
|
|
304
|
+
})
|
|
305
|
+
},
|
|
306
|
+
clickableIcons: {
|
|
307
|
+
type: Boolean,
|
|
308
|
+
required: false,
|
|
309
|
+
default: void 0
|
|
310
|
+
},
|
|
311
|
+
colorScheme: {
|
|
312
|
+
type: String,
|
|
313
|
+
required: false
|
|
314
|
+
},
|
|
315
|
+
controlSize: {
|
|
316
|
+
type: Number,
|
|
317
|
+
required: false
|
|
318
|
+
},
|
|
319
|
+
disableDefaultUi: {
|
|
320
|
+
type: Boolean,
|
|
321
|
+
required: false,
|
|
322
|
+
default: void 0
|
|
323
|
+
},
|
|
324
|
+
disableDoubleClickZoom: {
|
|
325
|
+
type: Boolean,
|
|
326
|
+
required: false,
|
|
327
|
+
default: void 0
|
|
328
|
+
},
|
|
329
|
+
draggable: {
|
|
330
|
+
type: Boolean,
|
|
331
|
+
required: false,
|
|
332
|
+
default: void 0
|
|
333
|
+
},
|
|
334
|
+
draggableCursor: {
|
|
335
|
+
type: String,
|
|
336
|
+
required: false
|
|
337
|
+
},
|
|
338
|
+
draggingCursor: {
|
|
339
|
+
type: String,
|
|
340
|
+
required: false
|
|
341
|
+
},
|
|
342
|
+
fullscreenControl: {
|
|
343
|
+
type: Boolean,
|
|
344
|
+
required: false,
|
|
345
|
+
default: void 0
|
|
346
|
+
},
|
|
347
|
+
fullscreenControlPosition: {
|
|
348
|
+
type: String,
|
|
349
|
+
required: false
|
|
350
|
+
},
|
|
351
|
+
gestureHandling: {
|
|
352
|
+
type: String,
|
|
353
|
+
required: false
|
|
354
|
+
},
|
|
355
|
+
heading: {
|
|
356
|
+
type: Number,
|
|
357
|
+
required: false
|
|
358
|
+
},
|
|
359
|
+
isFractionalZoomEnabled: {
|
|
360
|
+
type: Boolean,
|
|
361
|
+
required: false,
|
|
362
|
+
default: void 0
|
|
363
|
+
},
|
|
364
|
+
keyboardShortcuts: {
|
|
365
|
+
type: Boolean,
|
|
366
|
+
required: false,
|
|
367
|
+
default: void 0
|
|
368
|
+
},
|
|
369
|
+
mapTypeControl: {
|
|
370
|
+
type: Boolean,
|
|
371
|
+
required: false,
|
|
372
|
+
default: void 0
|
|
373
|
+
},
|
|
374
|
+
mapTypeControlOptions: {
|
|
375
|
+
type: Object,
|
|
376
|
+
required: false
|
|
377
|
+
},
|
|
378
|
+
mapTypeId: {
|
|
379
|
+
type: [Number, String],
|
|
380
|
+
required: false
|
|
381
|
+
},
|
|
382
|
+
mapId: {
|
|
383
|
+
type: String,
|
|
384
|
+
required: false
|
|
385
|
+
},
|
|
386
|
+
maxZoom: {
|
|
387
|
+
type: Number,
|
|
388
|
+
required: false
|
|
389
|
+
},
|
|
390
|
+
minZoom: {
|
|
391
|
+
type: Number,
|
|
392
|
+
required: false
|
|
393
|
+
},
|
|
394
|
+
noClear: {
|
|
395
|
+
type: Boolean,
|
|
396
|
+
required: false,
|
|
397
|
+
default: void 0
|
|
398
|
+
},
|
|
399
|
+
panControl: {
|
|
400
|
+
type: Boolean,
|
|
401
|
+
required: false,
|
|
402
|
+
default: void 0
|
|
403
|
+
},
|
|
404
|
+
panControlPosition: {
|
|
405
|
+
type: String,
|
|
406
|
+
required: false
|
|
407
|
+
},
|
|
408
|
+
restriction: {
|
|
409
|
+
type: Object,
|
|
410
|
+
required: false
|
|
411
|
+
},
|
|
412
|
+
rotateControl: {
|
|
413
|
+
type: Boolean,
|
|
414
|
+
required: false,
|
|
415
|
+
default: void 0
|
|
416
|
+
},
|
|
417
|
+
rotateControlPosition: {
|
|
418
|
+
type: String,
|
|
419
|
+
required: false
|
|
420
|
+
},
|
|
421
|
+
scaleControl: {
|
|
422
|
+
type: Boolean,
|
|
423
|
+
required: false,
|
|
424
|
+
default: void 0
|
|
425
|
+
},
|
|
426
|
+
scaleControlStyle: {
|
|
427
|
+
type: Number,
|
|
428
|
+
required: false
|
|
429
|
+
},
|
|
430
|
+
scrollwheel: {
|
|
431
|
+
type: Boolean,
|
|
432
|
+
required: false,
|
|
433
|
+
default: void 0
|
|
434
|
+
},
|
|
435
|
+
streetView: {
|
|
436
|
+
type: Object,
|
|
437
|
+
required: false
|
|
438
|
+
},
|
|
439
|
+
streetViewControl: {
|
|
440
|
+
type: Boolean,
|
|
441
|
+
required: false,
|
|
442
|
+
default: void 0
|
|
443
|
+
},
|
|
444
|
+
streetViewControlPosition: {
|
|
445
|
+
type: String,
|
|
446
|
+
required: false
|
|
447
|
+
},
|
|
448
|
+
styles: {
|
|
449
|
+
type: Array,
|
|
450
|
+
required: false
|
|
451
|
+
},
|
|
452
|
+
tilt: {
|
|
453
|
+
type: Number,
|
|
454
|
+
required: false
|
|
455
|
+
},
|
|
456
|
+
zoom: {
|
|
457
|
+
type: Number,
|
|
458
|
+
required: false
|
|
459
|
+
},
|
|
460
|
+
zoomControl: {
|
|
461
|
+
type: Boolean,
|
|
462
|
+
required: false,
|
|
463
|
+
default: void 0
|
|
464
|
+
},
|
|
465
|
+
zoomControlPosition: {
|
|
466
|
+
type: String,
|
|
467
|
+
required: false
|
|
468
|
+
},
|
|
469
|
+
cameraControl: {
|
|
470
|
+
type: Boolean,
|
|
471
|
+
required: false,
|
|
472
|
+
default: void 0
|
|
473
|
+
},
|
|
474
|
+
cameraControlPosition: {
|
|
475
|
+
type: String,
|
|
476
|
+
required: false
|
|
477
|
+
}
|
|
478
|
+
},
|
|
479
|
+
emits: [...mapEvents],
|
|
480
|
+
setup(props, { emit }) {
|
|
481
|
+
const mapRef = (0, vue.ref)();
|
|
482
|
+
const ready = (0, vue.ref)(false);
|
|
483
|
+
const map = (0, vue.ref)();
|
|
484
|
+
const api = (0, vue.ref)();
|
|
485
|
+
const mapTilesLoaded = (0, vue.ref)(false);
|
|
486
|
+
(0, vue.provide)(mapSymbol, map);
|
|
487
|
+
(0, vue.provide)(apiSymbol, api);
|
|
488
|
+
(0, vue.provide)(mapTilesLoadedSymbol, mapTilesLoaded);
|
|
489
|
+
const resolveOptions = () => {
|
|
490
|
+
const options = { ...props };
|
|
491
|
+
Object.keys(options).forEach((key) => {
|
|
492
|
+
if (options[key] === void 0) delete options[key];
|
|
493
|
+
});
|
|
494
|
+
const createControlOptionsWithPosition = (position) => position ? { position: api.value?.ControlPosition[position] } : {};
|
|
495
|
+
const otherOptions = {
|
|
496
|
+
scaleControlOptions: props.scaleControlStyle ? { style: props.scaleControlStyle } : {},
|
|
497
|
+
panControlOptions: createControlOptionsWithPosition(props.panControlPosition),
|
|
498
|
+
zoomControlOptions: createControlOptionsWithPosition(props.zoomControlPosition),
|
|
499
|
+
rotateControlOptions: createControlOptionsWithPosition(props.rotateControlPosition),
|
|
500
|
+
streetViewControlOptions: createControlOptionsWithPosition(props.streetViewControlPosition),
|
|
501
|
+
fullscreenControlOptions: createControlOptionsWithPosition(props.fullscreenControlPosition),
|
|
502
|
+
cameraControlOptions: createControlOptionsWithPosition(props.cameraControlPosition),
|
|
503
|
+
disableDefaultUI: props.disableDefaultUi
|
|
504
|
+
};
|
|
505
|
+
return {
|
|
506
|
+
...options,
|
|
507
|
+
...otherOptions
|
|
508
|
+
};
|
|
509
|
+
};
|
|
510
|
+
const stopWatchingMapApiAndRef = (0, vue.watch)([api, map], ([newApi, newMap]) => {
|
|
511
|
+
const api = newApi;
|
|
512
|
+
const map = newMap;
|
|
513
|
+
if (api && map) {
|
|
514
|
+
api.event.addListenerOnce(map, "tilesloaded", () => {
|
|
515
|
+
mapTilesLoaded.value = true;
|
|
516
|
+
});
|
|
517
|
+
setTimeout(stopWatchingMapApiAndRef, 0);
|
|
518
|
+
}
|
|
519
|
+
}, { immediate: true });
|
|
520
|
+
const setupMapsAPI = () => {
|
|
521
|
+
const { apiKey, region, version, language, libraries } = props;
|
|
522
|
+
setOptions({
|
|
523
|
+
key: apiKey,
|
|
524
|
+
region,
|
|
525
|
+
v: version,
|
|
526
|
+
language,
|
|
527
|
+
libraries
|
|
528
|
+
});
|
|
529
|
+
};
|
|
530
|
+
const setupMap = (_google) => {
|
|
531
|
+
const googleMaps = _google ? _google.maps : google.maps;
|
|
532
|
+
api.value = (0, vue.markRaw)(googleMaps);
|
|
533
|
+
map.value = (0, vue.markRaw)(new googleMaps.Map(mapRef.value, resolveOptions()));
|
|
534
|
+
const CustomMarker = createCustomMarkerClass(api.value);
|
|
535
|
+
api.value[customMarkerClassSymbol] = CustomMarker;
|
|
536
|
+
mapEvents.forEach((event) => {
|
|
537
|
+
map.value?.addListener(event, (e) => emit(event, e));
|
|
538
|
+
});
|
|
539
|
+
ready.value = true;
|
|
540
|
+
(0, vue.watch)([
|
|
541
|
+
() => props.center,
|
|
542
|
+
() => props.zoom,
|
|
543
|
+
...Object.keys(props).filter((key) => ![
|
|
544
|
+
"apiPromise",
|
|
545
|
+
"apiKey",
|
|
546
|
+
"version",
|
|
547
|
+
"libraries",
|
|
548
|
+
"region",
|
|
549
|
+
"language",
|
|
550
|
+
"center",
|
|
551
|
+
"zoom"
|
|
552
|
+
].includes(key)).map((key) => (0, vue.toRef)(props, key))
|
|
553
|
+
], ([center, zoom], [oldCenter, oldZoom]) => {
|
|
554
|
+
const { center: _, zoom: __, ...otherOptions } = resolveOptions();
|
|
555
|
+
map.value?.setOptions(otherOptions);
|
|
556
|
+
if (zoom !== void 0 && zoom !== oldZoom) map.value?.setZoom(zoom);
|
|
557
|
+
const centerHasChanged = !oldCenter || center.lng !== oldCenter.lng || center.lat !== oldCenter.lat;
|
|
558
|
+
if (center && centerHasChanged) map.value?.panTo(center);
|
|
559
|
+
});
|
|
560
|
+
};
|
|
561
|
+
(0, vue.onMounted)(() => {
|
|
562
|
+
if (props.apiPromise && props.apiPromise instanceof Promise) props.apiPromise.then(setupMap);
|
|
563
|
+
else {
|
|
564
|
+
if (!isOptionsSet) {
|
|
565
|
+
setupMapsAPI();
|
|
566
|
+
isOptionsSet = true;
|
|
567
|
+
}
|
|
568
|
+
const librariesToLoad = props.libraries && props.libraries.length > 0 ? props.libraries : ["maps", "marker"];
|
|
569
|
+
Promise.all(librariesToLoad.map((lib) => importLibrary(lib))).then(() => setupMap());
|
|
570
|
+
}
|
|
571
|
+
});
|
|
572
|
+
(0, vue.onBeforeUnmount)(() => {
|
|
573
|
+
mapTilesLoaded.value = false;
|
|
574
|
+
if (map.value) api.value?.event.clearInstanceListeners(map.value);
|
|
575
|
+
});
|
|
576
|
+
return {
|
|
577
|
+
mapRef,
|
|
578
|
+
ready,
|
|
579
|
+
map,
|
|
580
|
+
api,
|
|
581
|
+
mapTilesLoaded
|
|
582
|
+
};
|
|
583
|
+
}
|
|
584
|
+
});
|
|
585
|
+
//#endregion
|
|
586
|
+
//#region \0plugin-vue:export-helper
|
|
587
|
+
var _plugin_vue_export_helper_default = (sfc, props) => {
|
|
588
|
+
const target = sfc.__vccOpts || sfc;
|
|
589
|
+
for (const [key, val] of props) target[key] = val;
|
|
590
|
+
return target;
|
|
591
|
+
};
|
|
592
|
+
//#endregion
|
|
593
|
+
//#region src/components/GoogleMap.vue
|
|
594
|
+
var _hoisted_1$4 = {
|
|
595
|
+
ref: "mapRef",
|
|
596
|
+
class: "mapdiv"
|
|
597
|
+
};
|
|
598
|
+
function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
|
|
599
|
+
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", null, [(0, vue.createElementVNode)("div", _hoisted_1$4, null, 512), (0, vue.renderSlot)(_ctx.$slots, "default", (0, vue.normalizeProps)((0, vue.guardReactiveProps)({
|
|
600
|
+
ready: _ctx.ready,
|
|
601
|
+
map: _ctx.map,
|
|
602
|
+
api: _ctx.api,
|
|
603
|
+
mapTilesLoaded: _ctx.mapTilesLoaded
|
|
604
|
+
})), void 0, true)]);
|
|
605
|
+
}
|
|
606
|
+
var GoogleMap_default = /* @__PURE__ */ _plugin_vue_export_helper_default(GoogleMap_vue_vue_type_script_lang_default, [["render", _sfc_render$4], ["__scopeId", "data-v-4e398d5a"]]);
|
|
607
|
+
//#endregion
|
|
608
|
+
//#region src/components/AdvancedMarker.vue?vue&type=script&lang.ts
|
|
609
|
+
var import_fast_deep_equal = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
610
|
+
module.exports = function equal(a, b) {
|
|
611
|
+
if (a === b) return true;
|
|
612
|
+
if (a && b && typeof a == "object" && typeof b == "object") {
|
|
613
|
+
if (a.constructor !== b.constructor) return false;
|
|
614
|
+
var length, i, keys;
|
|
615
|
+
if (Array.isArray(a)) {
|
|
616
|
+
length = a.length;
|
|
617
|
+
if (length != b.length) return false;
|
|
618
|
+
for (i = length; i-- !== 0;) if (!equal(a[i], b[i])) return false;
|
|
619
|
+
return true;
|
|
620
|
+
}
|
|
621
|
+
if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
|
|
622
|
+
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
|
|
623
|
+
if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
|
|
624
|
+
keys = Object.keys(a);
|
|
625
|
+
length = keys.length;
|
|
626
|
+
if (length !== Object.keys(b).length) return false;
|
|
627
|
+
for (i = length; i-- !== 0;) if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
|
|
628
|
+
for (i = length; i-- !== 0;) {
|
|
629
|
+
var key = keys[i];
|
|
630
|
+
if (!equal(a[key], b[key])) return false;
|
|
631
|
+
}
|
|
632
|
+
return true;
|
|
633
|
+
}
|
|
634
|
+
return a !== a && b !== b;
|
|
635
|
+
};
|
|
636
|
+
})))());
|
|
637
|
+
var legacyClickEventName = "click";
|
|
638
|
+
var newClickEventName = "gmp-click";
|
|
639
|
+
var markerEvents$1 = [
|
|
640
|
+
"drag",
|
|
641
|
+
"dragend",
|
|
642
|
+
"dragstart",
|
|
643
|
+
newClickEventName
|
|
644
|
+
];
|
|
645
|
+
var AdvancedMarker_vue_vue_type_script_lang_default = (0, vue.defineComponent)({
|
|
646
|
+
name: "AdvancedMarker",
|
|
647
|
+
props: {
|
|
648
|
+
options: {
|
|
649
|
+
type: Object,
|
|
650
|
+
required: true
|
|
651
|
+
},
|
|
652
|
+
pinOptions: {
|
|
653
|
+
type: Object,
|
|
654
|
+
required: false
|
|
655
|
+
}
|
|
656
|
+
},
|
|
657
|
+
emits: [...markerEvents$1, legacyClickEventName],
|
|
658
|
+
setup(props, { emit, expose, slots }) {
|
|
659
|
+
const markerRef = (0, vue.ref)();
|
|
660
|
+
const hasCustomSlotContent = (0, vue.computed)(() => slots.content?.().some((vnode) => vnode.type !== vue.Comment));
|
|
661
|
+
const options = (0, vue.toRef)(props, "options");
|
|
662
|
+
const pinOptions = (0, vue.toRef)(props, "pinOptions");
|
|
663
|
+
const marker = (0, vue.ref)();
|
|
664
|
+
const map = (0, vue.inject)(mapSymbol, (0, vue.ref)());
|
|
665
|
+
const api = (0, vue.inject)(apiSymbol, (0, vue.ref)());
|
|
666
|
+
const markerCluster = (0, vue.inject)(markerClusterSymbol, (0, vue.ref)());
|
|
667
|
+
const isMarkerInCluster = (0, vue.computed)(() => !!(markerCluster.value && api.value && marker.value instanceof google.maps.marker.AdvancedMarkerElement));
|
|
668
|
+
let appliedOptions;
|
|
669
|
+
let appliedPinOptions;
|
|
670
|
+
(0, vue.watch)([
|
|
671
|
+
map,
|
|
672
|
+
options,
|
|
673
|
+
pinOptions,
|
|
674
|
+
markerRef
|
|
675
|
+
], async (_, [oldMap, , , oldMarkerRef]) => {
|
|
676
|
+
const hasOptionChange = !appliedOptions || !(0, import_fast_deep_equal.default)(options.value, appliedOptions) || !(0, import_fast_deep_equal.default)(pinOptions.value, appliedPinOptions);
|
|
677
|
+
const hasMarkerRefChange = markerRef.value !== oldMarkerRef;
|
|
678
|
+
const hasChanged = hasOptionChange || hasMarkerRefChange || map.value !== oldMap;
|
|
679
|
+
if (!map.value || !api.value || !hasChanged) return;
|
|
680
|
+
if (hasCustomSlotContent.value && !markerRef.value) return;
|
|
681
|
+
const { AdvancedMarkerElement, PinElement } = api.value.marker;
|
|
682
|
+
if (marker.value) {
|
|
683
|
+
const { map: _, content, ...otherOptions } = options.value;
|
|
684
|
+
Object.assign(marker.value, {
|
|
685
|
+
content: hasCustomSlotContent.value ? markerRef.value : pinOptions.value ? new PinElement(pinOptions.value) : content,
|
|
686
|
+
...otherOptions
|
|
687
|
+
});
|
|
688
|
+
if (isMarkerInCluster.value) {
|
|
689
|
+
markerCluster.value?.removeMarker(marker.value);
|
|
690
|
+
markerCluster.value?.addMarker(marker.value);
|
|
691
|
+
}
|
|
692
|
+
} else {
|
|
693
|
+
if (hasCustomSlotContent.value) options.value.content = markerRef.value;
|
|
694
|
+
else if (pinOptions.value) options.value.content = new PinElement(pinOptions.value);
|
|
695
|
+
marker.value = (0, vue.markRaw)(new AdvancedMarkerElement(options.value));
|
|
696
|
+
if (isMarkerInCluster.value) markerCluster.value?.addMarker(marker.value);
|
|
697
|
+
else marker.value.map = map.value;
|
|
698
|
+
markerEvents$1.forEach((event) => {
|
|
699
|
+
marker.value?.addListener(event, (e) => {
|
|
700
|
+
emit(event, e);
|
|
701
|
+
if (event === newClickEventName) emit(legacyClickEventName, e);
|
|
702
|
+
});
|
|
703
|
+
});
|
|
704
|
+
}
|
|
705
|
+
appliedOptions = cloneOptions(options.value);
|
|
706
|
+
appliedPinOptions = cloneOptions(pinOptions.value);
|
|
707
|
+
}, {
|
|
708
|
+
immediate: true,
|
|
709
|
+
flush: "post",
|
|
710
|
+
deep: true
|
|
711
|
+
});
|
|
712
|
+
(0, vue.onBeforeUnmount)(() => {
|
|
713
|
+
if (marker.value) {
|
|
714
|
+
api.value?.event.clearInstanceListeners(marker.value);
|
|
715
|
+
if (isMarkerInCluster.value) markerCluster.value?.removeMarker(marker.value);
|
|
716
|
+
else marker.value.map = null;
|
|
717
|
+
}
|
|
718
|
+
});
|
|
719
|
+
(0, vue.provide)(markerSymbol, marker);
|
|
720
|
+
expose({ marker });
|
|
721
|
+
return {
|
|
722
|
+
hasCustomSlotContent,
|
|
723
|
+
markerRef
|
|
724
|
+
};
|
|
725
|
+
}
|
|
726
|
+
});
|
|
727
|
+
//#endregion
|
|
728
|
+
//#region src/components/AdvancedMarker.vue
|
|
729
|
+
var _hoisted_1$3 = {
|
|
730
|
+
key: 0,
|
|
731
|
+
class: "advanced-marker-wrapper"
|
|
732
|
+
};
|
|
733
|
+
function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
734
|
+
return (0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, null, [_ctx.hasCustomSlotContent ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$3, [(0, vue.createElementVNode)("div", (0, vue.mergeProps)({ ref: "markerRef" }, _ctx.$attrs), [(0, vue.renderSlot)(_ctx.$slots, "content")], 16)])) : (0, vue.createCommentVNode)("", true), (0, vue.renderSlot)(_ctx.$slots, "default")], 64);
|
|
735
|
+
}
|
|
736
|
+
var AdvancedMarker_default = /* @__PURE__ */ _plugin_vue_export_helper_default(AdvancedMarker_vue_vue_type_script_lang_default, [["render", _sfc_render$3]]);
|
|
737
|
+
//#endregion
|
|
738
|
+
//#region src/composables/useSetupMapComponent.ts
|
|
739
|
+
var isMarkerCtorKey = (key) => key === "Marker";
|
|
740
|
+
var isCustomMarkerCtorKey = (key) => key === customMarkerClassSymbol;
|
|
741
|
+
var useSetupMapComponent = (ctorKey, events, options, emit) => {
|
|
742
|
+
const component = (0, vue.ref)();
|
|
743
|
+
const map = (0, vue.inject)(mapSymbol, (0, vue.ref)());
|
|
744
|
+
const api = (0, vue.inject)(apiSymbol, (0, vue.ref)());
|
|
745
|
+
const markerCluster = (0, vue.inject)(markerClusterSymbol, (0, vue.ref)());
|
|
746
|
+
const isMarkerInCluster = (0, vue.computed)(() => !!(markerCluster.value && api.value && (component.value instanceof api.value.Marker || component.value instanceof api.value[customMarkerClassSymbol])));
|
|
747
|
+
let appliedOptions;
|
|
748
|
+
(0, vue.watch)([map, options], (_, [oldMap]) => {
|
|
749
|
+
const hasChanged = !appliedOptions || !(0, import_fast_deep_equal.default)(options.value, appliedOptions) || map.value !== oldMap;
|
|
750
|
+
if (!map.value || !api.value || !hasChanged) return;
|
|
751
|
+
if (component.value) {
|
|
752
|
+
component.value.setOptions(options.value);
|
|
753
|
+
if (isMarkerInCluster.value) {
|
|
754
|
+
markerCluster.value?.removeMarker(component.value);
|
|
755
|
+
markerCluster.value?.addMarker(component.value);
|
|
756
|
+
}
|
|
757
|
+
} else {
|
|
758
|
+
if (isMarkerCtorKey(ctorKey)) component.value = (0, vue.markRaw)(new api.value[ctorKey](options.value));
|
|
759
|
+
else if (isCustomMarkerCtorKey(ctorKey)) {
|
|
760
|
+
const customMarkerOptions = options.value;
|
|
761
|
+
if (customMarkerOptions.element) component.value = (0, vue.markRaw)(new api.value[ctorKey](customMarkerOptions));
|
|
762
|
+
} else component.value = (0, vue.markRaw)(new api.value[ctorKey]({
|
|
763
|
+
...options.value,
|
|
764
|
+
map: map.value
|
|
765
|
+
}));
|
|
766
|
+
if (component.value) {
|
|
767
|
+
if (isMarkerInCluster.value) markerCluster.value?.addMarker(component.value);
|
|
768
|
+
else if (isMarkerCtorKey(ctorKey) || isCustomMarkerCtorKey(ctorKey)) component.value.setMap(map.value);
|
|
769
|
+
}
|
|
770
|
+
events.forEach((event) => {
|
|
771
|
+
component.value?.addListener(event, (e) => emit(event, e));
|
|
772
|
+
});
|
|
773
|
+
}
|
|
774
|
+
appliedOptions = cloneOptions(options.value);
|
|
775
|
+
}, {
|
|
776
|
+
immediate: true,
|
|
777
|
+
flush: "post",
|
|
778
|
+
deep: true
|
|
779
|
+
});
|
|
780
|
+
(0, vue.onBeforeUnmount)(() => {
|
|
781
|
+
if (component.value) {
|
|
782
|
+
api.value?.event.clearInstanceListeners(component.value);
|
|
783
|
+
if (isMarkerInCluster.value) markerCluster.value?.removeMarker(component.value);
|
|
784
|
+
else component.value.setMap(null);
|
|
785
|
+
}
|
|
786
|
+
});
|
|
787
|
+
return component;
|
|
788
|
+
};
|
|
789
|
+
//#endregion
|
|
790
|
+
//#region src/components/Marker.ts
|
|
791
|
+
var markerEvents = [
|
|
792
|
+
"animation_changed",
|
|
793
|
+
"click",
|
|
794
|
+
"dblclick",
|
|
795
|
+
"rightclick",
|
|
796
|
+
"dragstart",
|
|
797
|
+
"dragend",
|
|
798
|
+
"drag",
|
|
799
|
+
"mouseover",
|
|
800
|
+
"mousedown",
|
|
801
|
+
"mouseout",
|
|
802
|
+
"mouseup",
|
|
803
|
+
"draggable_changed",
|
|
804
|
+
"clickable_changed",
|
|
805
|
+
"contextmenu",
|
|
806
|
+
"cursor_changed",
|
|
807
|
+
"flat_changed",
|
|
808
|
+
"zindex_changed",
|
|
809
|
+
"icon_changed",
|
|
810
|
+
"position_changed",
|
|
811
|
+
"shape_changed",
|
|
812
|
+
"title_changed",
|
|
813
|
+
"visible_changed"
|
|
814
|
+
];
|
|
815
|
+
/**
|
|
816
|
+
* @deprecated The Marker component is deprecated as of February 2024. Use AdvancedMarker instead.
|
|
817
|
+
* The google.maps.Marker API is deprecated and will be removed in a future version.
|
|
818
|
+
* Migrate to AdvancedMarker for the latest features and better performance.
|
|
819
|
+
* @see {@link https://developers.google.com/maps/deprecations} for more information.
|
|
820
|
+
*/
|
|
821
|
+
var Marker_default = (0, vue.defineComponent)({
|
|
822
|
+
name: "Marker",
|
|
823
|
+
props: { options: {
|
|
824
|
+
type: Object,
|
|
825
|
+
required: true
|
|
826
|
+
} },
|
|
827
|
+
emits: [...markerEvents],
|
|
828
|
+
setup(props, { emit, expose, slots }) {
|
|
829
|
+
const marker = useSetupMapComponent("Marker", markerEvents, (0, vue.toRef)(props, "options"), emit);
|
|
830
|
+
(0, vue.provide)(markerSymbol, marker);
|
|
831
|
+
expose({ marker });
|
|
832
|
+
return () => slots.default?.();
|
|
833
|
+
}
|
|
834
|
+
});
|
|
835
|
+
//#endregion
|
|
836
|
+
//#region src/components/Polyline.ts
|
|
837
|
+
var Polyline_default = (0, vue.defineComponent)({
|
|
838
|
+
name: "Polyline",
|
|
839
|
+
props: { options: {
|
|
840
|
+
type: Object,
|
|
841
|
+
required: true
|
|
842
|
+
} },
|
|
843
|
+
emits: [...polylineEvents],
|
|
844
|
+
setup(props, { emit }) {
|
|
845
|
+
return { polyline: useSetupMapComponent("Polyline", polylineEvents, (0, vue.toRef)(props, "options"), emit) };
|
|
846
|
+
},
|
|
847
|
+
render: () => null
|
|
848
|
+
});
|
|
849
|
+
//#endregion
|
|
850
|
+
//#region src/components/Polygon.ts
|
|
851
|
+
var Polygon_default = (0, vue.defineComponent)({
|
|
852
|
+
name: "Polygon",
|
|
853
|
+
props: { options: {
|
|
854
|
+
type: Object,
|
|
855
|
+
required: true
|
|
856
|
+
} },
|
|
857
|
+
emits: [...polylineEvents],
|
|
858
|
+
setup(props, { emit }) {
|
|
859
|
+
return { polygon: useSetupMapComponent("Polygon", polylineEvents, (0, vue.toRef)(props, "options"), emit) };
|
|
860
|
+
},
|
|
861
|
+
render: () => null
|
|
862
|
+
});
|
|
863
|
+
//#endregion
|
|
864
|
+
//#region src/components/Rectangle.ts
|
|
865
|
+
var rectangleEvents = [...polylineEvents, "bounds_changed"];
|
|
866
|
+
var Rectangle_default = (0, vue.defineComponent)({
|
|
867
|
+
name: "Rectangle",
|
|
868
|
+
props: { options: {
|
|
869
|
+
type: Object,
|
|
870
|
+
required: true
|
|
871
|
+
} },
|
|
872
|
+
emits: [...rectangleEvents],
|
|
873
|
+
setup(props, { emit }) {
|
|
874
|
+
return { rectangle: useSetupMapComponent("Rectangle", rectangleEvents, (0, vue.toRef)(props, "options"), emit) };
|
|
875
|
+
},
|
|
876
|
+
render: () => null
|
|
877
|
+
});
|
|
878
|
+
//#endregion
|
|
879
|
+
//#region src/components/Circle.ts
|
|
880
|
+
var circleEvents = [
|
|
881
|
+
...polylineEvents,
|
|
882
|
+
"center_changed",
|
|
883
|
+
"radius_changed"
|
|
884
|
+
];
|
|
885
|
+
var Circle_default = (0, vue.defineComponent)({
|
|
886
|
+
name: "Circle",
|
|
887
|
+
props: { options: {
|
|
888
|
+
type: Object,
|
|
889
|
+
required: true
|
|
890
|
+
} },
|
|
891
|
+
emits: [...circleEvents],
|
|
892
|
+
setup(props, { emit }) {
|
|
893
|
+
return { circle: useSetupMapComponent("Circle", circleEvents, (0, vue.toRef)(props, "options"), emit) };
|
|
894
|
+
},
|
|
895
|
+
render: () => null
|
|
896
|
+
});
|
|
897
|
+
//#endregion
|
|
898
|
+
//#region src/components/CustomControl.vue?vue&type=script&lang.ts
|
|
899
|
+
var CustomControl_vue_vue_type_script_lang_default = (0, vue.defineComponent)({
|
|
900
|
+
props: {
|
|
901
|
+
position: {
|
|
902
|
+
type: String,
|
|
903
|
+
required: true
|
|
904
|
+
},
|
|
905
|
+
index: {
|
|
906
|
+
type: Number,
|
|
907
|
+
default: 1
|
|
908
|
+
}
|
|
909
|
+
},
|
|
910
|
+
emits: ["content:loaded"],
|
|
911
|
+
setup(props, { emit }) {
|
|
912
|
+
const controlRef = (0, vue.ref)(null);
|
|
913
|
+
const map = (0, vue.inject)(mapSymbol, (0, vue.ref)());
|
|
914
|
+
const api = (0, vue.inject)(apiSymbol, (0, vue.ref)());
|
|
915
|
+
const stopWatchingOnMapLoad = (0, vue.watch)([
|
|
916
|
+
(0, vue.inject)(mapTilesLoadedSymbol, (0, vue.ref)(false)),
|
|
917
|
+
api,
|
|
918
|
+
controlRef
|
|
919
|
+
], ([newMapLoadedStatus, newApi, newControlRef]) => {
|
|
920
|
+
if (newApi && newMapLoadedStatus && newControlRef) {
|
|
921
|
+
addControl(props.position);
|
|
922
|
+
emit("content:loaded");
|
|
923
|
+
setTimeout(stopWatchingOnMapLoad, 0);
|
|
924
|
+
}
|
|
925
|
+
}, { immediate: true });
|
|
926
|
+
const addControl = (controlPosition) => {
|
|
927
|
+
if (map.value && api.value && controlRef.value) {
|
|
928
|
+
const position = api.value.ControlPosition[controlPosition];
|
|
929
|
+
controlRef.value.index = props.index;
|
|
930
|
+
map.value.controls[position].push(controlRef.value);
|
|
931
|
+
}
|
|
932
|
+
};
|
|
933
|
+
const removeControl = (controlPosition) => {
|
|
934
|
+
if (map.value && api.value) {
|
|
935
|
+
let contentControlIndex = null;
|
|
936
|
+
const position = api.value.ControlPosition[controlPosition];
|
|
937
|
+
map.value.controls[position].forEach((node, idx) => {
|
|
938
|
+
if (node === controlRef.value) contentControlIndex = idx;
|
|
939
|
+
});
|
|
940
|
+
if (contentControlIndex !== null) map.value.controls[position].removeAt(contentControlIndex);
|
|
941
|
+
}
|
|
942
|
+
};
|
|
943
|
+
(0, vue.onBeforeUnmount)(() => removeControl(props.position));
|
|
944
|
+
(0, vue.watch)(() => props.position, (newPosition, oldPosition) => {
|
|
945
|
+
removeControl(oldPosition);
|
|
946
|
+
addControl(newPosition);
|
|
947
|
+
});
|
|
948
|
+
(0, vue.watch)(() => props.index, (newIndex) => {
|
|
949
|
+
if (!controlRef.value) return;
|
|
950
|
+
controlRef.value.index = newIndex;
|
|
951
|
+
});
|
|
952
|
+
return { controlRef };
|
|
953
|
+
}
|
|
954
|
+
});
|
|
955
|
+
//#endregion
|
|
956
|
+
//#region src/components/CustomControl.vue
|
|
957
|
+
var _hoisted_1$2 = {
|
|
958
|
+
ref: "controlRef",
|
|
959
|
+
class: "custom-control-wrapper"
|
|
960
|
+
};
|
|
961
|
+
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
962
|
+
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$2, [(0, vue.renderSlot)(_ctx.$slots, "default", {}, void 0, true)], 512);
|
|
963
|
+
}
|
|
964
|
+
var CustomControl_default = /* @__PURE__ */ _plugin_vue_export_helper_default(CustomControl_vue_vue_type_script_lang_default, [["render", _sfc_render$2], ["__scopeId", "data-v-ab9120cd"]]);
|
|
965
|
+
//#endregion
|
|
966
|
+
//#region src/components/InfoWindow.vue?vue&type=script&lang.ts
|
|
967
|
+
function getAnchorClickEvent(anchor) {
|
|
968
|
+
return anchor instanceof google.maps.marker.AdvancedMarkerElement ? "gmp-click" : "click";
|
|
969
|
+
}
|
|
970
|
+
var infoWindowEvents = [
|
|
971
|
+
"closeclick",
|
|
972
|
+
"content_changed",
|
|
973
|
+
"domready",
|
|
974
|
+
"position_changed",
|
|
975
|
+
"visible",
|
|
976
|
+
"zindex_changed"
|
|
977
|
+
];
|
|
978
|
+
var InfoWindow_vue_vue_type_script_lang_default = (0, vue.defineComponent)({
|
|
979
|
+
inheritAttrs: false,
|
|
980
|
+
props: {
|
|
981
|
+
options: {
|
|
982
|
+
type: Object,
|
|
983
|
+
default: () => ({})
|
|
984
|
+
},
|
|
985
|
+
modelValue: { type: Boolean }
|
|
986
|
+
},
|
|
987
|
+
emits: [...infoWindowEvents, "update:modelValue"],
|
|
988
|
+
setup(props, { slots, emit, expose }) {
|
|
989
|
+
const infoWindow = (0, vue.ref)();
|
|
990
|
+
const infoWindowRef = (0, vue.ref)();
|
|
991
|
+
const map = (0, vue.inject)(mapSymbol, (0, vue.ref)());
|
|
992
|
+
const api = (0, vue.inject)(apiSymbol, (0, vue.ref)());
|
|
993
|
+
const anchor = (0, vue.inject)(markerSymbol, (0, vue.ref)());
|
|
994
|
+
let anchorClickListener;
|
|
995
|
+
let internalVal = props.modelValue;
|
|
996
|
+
const hasSlotContent = (0, vue.computed)(() => slots.default?.().some((vnode) => vnode.type !== vue.Comment));
|
|
997
|
+
const updateVModel = (val) => {
|
|
998
|
+
internalVal = val;
|
|
999
|
+
emit("update:modelValue", val);
|
|
1000
|
+
};
|
|
1001
|
+
const open = (opts) => {
|
|
1002
|
+
if (infoWindow.value) {
|
|
1003
|
+
infoWindow.value.open({
|
|
1004
|
+
map: map.value,
|
|
1005
|
+
anchor: anchor.value,
|
|
1006
|
+
...opts
|
|
1007
|
+
});
|
|
1008
|
+
updateVModel(true);
|
|
1009
|
+
}
|
|
1010
|
+
};
|
|
1011
|
+
const close = () => {
|
|
1012
|
+
if (infoWindow.value) {
|
|
1013
|
+
infoWindow.value.close();
|
|
1014
|
+
updateVModel(false);
|
|
1015
|
+
}
|
|
1016
|
+
};
|
|
1017
|
+
let appliedOptions;
|
|
1018
|
+
(0, vue.onMounted)(() => {
|
|
1019
|
+
(0, vue.watch)([map, () => props.options], ([_, options], [oldMap]) => {
|
|
1020
|
+
const hasChanged = !appliedOptions || !(0, import_fast_deep_equal.default)(options, appliedOptions) || map.value !== oldMap;
|
|
1021
|
+
if (map.value && api.value && hasChanged) {
|
|
1022
|
+
if (infoWindow.value) {
|
|
1023
|
+
infoWindow.value.setOptions({
|
|
1024
|
+
...options,
|
|
1025
|
+
content: hasSlotContent.value ? infoWindowRef.value : options.content
|
|
1026
|
+
});
|
|
1027
|
+
if (!anchor.value) open();
|
|
1028
|
+
} else {
|
|
1029
|
+
infoWindow.value = (0, vue.markRaw)(new api.value.InfoWindow({
|
|
1030
|
+
...options,
|
|
1031
|
+
content: hasSlotContent.value ? infoWindowRef.value : options.content
|
|
1032
|
+
}));
|
|
1033
|
+
if (anchor.value) anchorClickListener = anchor.value.addListener(getAnchorClickEvent(anchor.value), () => open());
|
|
1034
|
+
if (!anchor.value || internalVal) open();
|
|
1035
|
+
infoWindowEvents.forEach((event) => {
|
|
1036
|
+
infoWindow.value?.addListener(event, (e) => emit(event, e));
|
|
1037
|
+
});
|
|
1038
|
+
infoWindow.value?.addListener("closeclick", () => updateVModel(false));
|
|
1039
|
+
}
|
|
1040
|
+
appliedOptions = cloneOptions(options);
|
|
1041
|
+
}
|
|
1042
|
+
}, {
|
|
1043
|
+
immediate: true,
|
|
1044
|
+
flush: "post",
|
|
1045
|
+
deep: true
|
|
1046
|
+
});
|
|
1047
|
+
(0, vue.watch)(anchor, (newAnchor, oldAnchor) => {
|
|
1048
|
+
if (!infoWindow.value || newAnchor === oldAnchor) return;
|
|
1049
|
+
if (anchorClickListener) {
|
|
1050
|
+
anchorClickListener.remove();
|
|
1051
|
+
anchorClickListener = void 0;
|
|
1052
|
+
}
|
|
1053
|
+
if (newAnchor) anchorClickListener = newAnchor.addListener(getAnchorClickEvent(newAnchor), () => open());
|
|
1054
|
+
}, { flush: "post" });
|
|
1055
|
+
(0, vue.watch)(() => props.modelValue, (val) => {
|
|
1056
|
+
if (val !== internalVal) val ? open() : close();
|
|
1057
|
+
});
|
|
1058
|
+
});
|
|
1059
|
+
(0, vue.onBeforeUnmount)(() => {
|
|
1060
|
+
if (anchorClickListener) anchorClickListener.remove();
|
|
1061
|
+
if (infoWindow.value) {
|
|
1062
|
+
api.value?.event.clearInstanceListeners(infoWindow.value);
|
|
1063
|
+
close();
|
|
1064
|
+
}
|
|
1065
|
+
});
|
|
1066
|
+
expose({
|
|
1067
|
+
infoWindow,
|
|
1068
|
+
open,
|
|
1069
|
+
close
|
|
1070
|
+
});
|
|
1071
|
+
return {
|
|
1072
|
+
infoWindow,
|
|
1073
|
+
infoWindowRef,
|
|
1074
|
+
hasSlotContent,
|
|
1075
|
+
open,
|
|
1076
|
+
close
|
|
1077
|
+
};
|
|
1078
|
+
}
|
|
1079
|
+
});
|
|
1080
|
+
//#endregion
|
|
1081
|
+
//#region src/components/InfoWindow.vue
|
|
1082
|
+
var _hoisted_1$1 = {
|
|
1083
|
+
key: 0,
|
|
1084
|
+
class: "info-window-wrapper"
|
|
1085
|
+
};
|
|
1086
|
+
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1087
|
+
return _ctx.hasSlotContent ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$1, [(0, vue.createElementVNode)("div", (0, vue.mergeProps)({ ref: "infoWindowRef" }, _ctx.$attrs), [(0, vue.renderSlot)(_ctx.$slots, "default", {}, void 0, true)], 16)])) : (0, vue.createCommentVNode)("", true);
|
|
1088
|
+
}
|
|
1089
|
+
var InfoWindow_default = /* @__PURE__ */ _plugin_vue_export_helper_default(InfoWindow_vue_vue_type_script_lang_default, [["render", _sfc_render$1], ["__scopeId", "data-v-e3e9b802"]]);
|
|
1090
|
+
//#endregion
|
|
1091
|
+
//#region node_modules/.pnpm/fast-equals@5.2.2/node_modules/fast-equals/dist/esm/index.mjs
|
|
1092
|
+
var getOwnPropertyNames = Object.getOwnPropertyNames, getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
1093
|
+
var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
1094
|
+
/**
|
|
1095
|
+
* Combine two comparators into a single comparators.
|
|
1096
|
+
*/
|
|
1097
|
+
function combineComparators(comparatorA, comparatorB) {
|
|
1098
|
+
return function isEqual(a, b, state) {
|
|
1099
|
+
return comparatorA(a, b, state) && comparatorB(a, b, state);
|
|
1100
|
+
};
|
|
1101
|
+
}
|
|
1102
|
+
/**
|
|
1103
|
+
* Wrap the provided `areItemsEqual` method to manage the circular state, allowing
|
|
1104
|
+
* for circular references to be safely included in the comparison without creating
|
|
1105
|
+
* stack overflows.
|
|
1106
|
+
*/
|
|
1107
|
+
function createIsCircular(areItemsEqual) {
|
|
1108
|
+
return function isCircular(a, b, state) {
|
|
1109
|
+
if (!a || !b || typeof a !== "object" || typeof b !== "object") return areItemsEqual(a, b, state);
|
|
1110
|
+
var cache = state.cache;
|
|
1111
|
+
var cachedA = cache.get(a);
|
|
1112
|
+
var cachedB = cache.get(b);
|
|
1113
|
+
if (cachedA && cachedB) return cachedA === b && cachedB === a;
|
|
1114
|
+
cache.set(a, b);
|
|
1115
|
+
cache.set(b, a);
|
|
1116
|
+
var result = areItemsEqual(a, b, state);
|
|
1117
|
+
cache.delete(a);
|
|
1118
|
+
cache.delete(b);
|
|
1119
|
+
return result;
|
|
1120
|
+
};
|
|
1121
|
+
}
|
|
1122
|
+
/**
|
|
1123
|
+
* Get the properties to strictly examine, which include both own properties that are
|
|
1124
|
+
* not enumerable and symbol properties.
|
|
1125
|
+
*/
|
|
1126
|
+
function getStrictProperties(object) {
|
|
1127
|
+
return getOwnPropertyNames(object).concat(getOwnPropertySymbols(object));
|
|
1128
|
+
}
|
|
1129
|
+
/**
|
|
1130
|
+
* Whether the object contains the property passed as an own property.
|
|
1131
|
+
*/
|
|
1132
|
+
var hasOwn = Object.hasOwn || (function(object, property) {
|
|
1133
|
+
return hasOwnProperty$1.call(object, property);
|
|
1134
|
+
});
|
|
1135
|
+
/**
|
|
1136
|
+
* Whether the values passed are strictly equal or both NaN.
|
|
1137
|
+
*/
|
|
1138
|
+
function sameValueZeroEqual(a, b) {
|
|
1139
|
+
return a === b || !a && !b && a !== a && b !== b;
|
|
1140
|
+
}
|
|
1141
|
+
var PREACT_VNODE = "__v";
|
|
1142
|
+
var PREACT_OWNER = "__o";
|
|
1143
|
+
var REACT_OWNER = "_owner";
|
|
1144
|
+
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor, keys = Object.keys;
|
|
1145
|
+
/**
|
|
1146
|
+
* Whether the arrays are equal in value.
|
|
1147
|
+
*/
|
|
1148
|
+
function areArraysEqual(a, b, state) {
|
|
1149
|
+
var index = a.length;
|
|
1150
|
+
if (b.length !== index) return false;
|
|
1151
|
+
while (index-- > 0) if (!state.equals(a[index], b[index], index, index, a, b, state)) return false;
|
|
1152
|
+
return true;
|
|
1153
|
+
}
|
|
1154
|
+
/**
|
|
1155
|
+
* Whether the dates passed are equal in value.
|
|
1156
|
+
*/
|
|
1157
|
+
function areDatesEqual(a, b) {
|
|
1158
|
+
return sameValueZeroEqual(a.getTime(), b.getTime());
|
|
1159
|
+
}
|
|
1160
|
+
/**
|
|
1161
|
+
* Whether the errors passed are equal in value.
|
|
1162
|
+
*/
|
|
1163
|
+
function areErrorsEqual(a, b) {
|
|
1164
|
+
return a.name === b.name && a.message === b.message && a.cause === b.cause && a.stack === b.stack;
|
|
1165
|
+
}
|
|
1166
|
+
/**
|
|
1167
|
+
* Whether the functions passed are equal in value.
|
|
1168
|
+
*/
|
|
1169
|
+
function areFunctionsEqual(a, b) {
|
|
1170
|
+
return a === b;
|
|
1171
|
+
}
|
|
1172
|
+
/**
|
|
1173
|
+
* Whether the `Map`s are equal in value.
|
|
1174
|
+
*/
|
|
1175
|
+
function areMapsEqual(a, b, state) {
|
|
1176
|
+
var size = a.size;
|
|
1177
|
+
if (size !== b.size) return false;
|
|
1178
|
+
if (!size) return true;
|
|
1179
|
+
var matchedIndices = new Array(size);
|
|
1180
|
+
var aIterable = a.entries();
|
|
1181
|
+
var aResult;
|
|
1182
|
+
var bResult;
|
|
1183
|
+
var index = 0;
|
|
1184
|
+
while (aResult = aIterable.next()) {
|
|
1185
|
+
if (aResult.done) break;
|
|
1186
|
+
var bIterable = b.entries();
|
|
1187
|
+
var hasMatch = false;
|
|
1188
|
+
var matchIndex = 0;
|
|
1189
|
+
while (bResult = bIterable.next()) {
|
|
1190
|
+
if (bResult.done) break;
|
|
1191
|
+
if (matchedIndices[matchIndex]) {
|
|
1192
|
+
matchIndex++;
|
|
1193
|
+
continue;
|
|
1194
|
+
}
|
|
1195
|
+
var aEntry = aResult.value;
|
|
1196
|
+
var bEntry = bResult.value;
|
|
1197
|
+
if (state.equals(aEntry[0], bEntry[0], index, matchIndex, a, b, state) && state.equals(aEntry[1], bEntry[1], aEntry[0], bEntry[0], a, b, state)) {
|
|
1198
|
+
hasMatch = matchedIndices[matchIndex] = true;
|
|
1199
|
+
break;
|
|
1200
|
+
}
|
|
1201
|
+
matchIndex++;
|
|
1202
|
+
}
|
|
1203
|
+
if (!hasMatch) return false;
|
|
1204
|
+
index++;
|
|
1205
|
+
}
|
|
1206
|
+
return true;
|
|
1207
|
+
}
|
|
1208
|
+
/**
|
|
1209
|
+
* Whether the numbers are equal in value.
|
|
1210
|
+
*/
|
|
1211
|
+
var areNumbersEqual = sameValueZeroEqual;
|
|
1212
|
+
/**
|
|
1213
|
+
* Whether the objects are equal in value.
|
|
1214
|
+
*/
|
|
1215
|
+
function areObjectsEqual(a, b, state) {
|
|
1216
|
+
var properties = keys(a);
|
|
1217
|
+
var index = properties.length;
|
|
1218
|
+
if (keys(b).length !== index) return false;
|
|
1219
|
+
while (index-- > 0) if (!isPropertyEqual(a, b, state, properties[index])) return false;
|
|
1220
|
+
return true;
|
|
1221
|
+
}
|
|
1222
|
+
/**
|
|
1223
|
+
* Whether the objects are equal in value with strict property checking.
|
|
1224
|
+
*/
|
|
1225
|
+
function areObjectsEqualStrict(a, b, state) {
|
|
1226
|
+
var properties = getStrictProperties(a);
|
|
1227
|
+
var index = properties.length;
|
|
1228
|
+
if (getStrictProperties(b).length !== index) return false;
|
|
1229
|
+
var property;
|
|
1230
|
+
var descriptorA;
|
|
1231
|
+
var descriptorB;
|
|
1232
|
+
while (index-- > 0) {
|
|
1233
|
+
property = properties[index];
|
|
1234
|
+
if (!isPropertyEqual(a, b, state, property)) return false;
|
|
1235
|
+
descriptorA = getOwnPropertyDescriptor(a, property);
|
|
1236
|
+
descriptorB = getOwnPropertyDescriptor(b, property);
|
|
1237
|
+
if ((descriptorA || descriptorB) && (!descriptorA || !descriptorB || descriptorA.configurable !== descriptorB.configurable || descriptorA.enumerable !== descriptorB.enumerable || descriptorA.writable !== descriptorB.writable)) return false;
|
|
1238
|
+
}
|
|
1239
|
+
return true;
|
|
1240
|
+
}
|
|
1241
|
+
/**
|
|
1242
|
+
* Whether the primitive wrappers passed are equal in value.
|
|
1243
|
+
*/
|
|
1244
|
+
function arePrimitiveWrappersEqual(a, b) {
|
|
1245
|
+
return sameValueZeroEqual(a.valueOf(), b.valueOf());
|
|
1246
|
+
}
|
|
1247
|
+
/**
|
|
1248
|
+
* Whether the regexps passed are equal in value.
|
|
1249
|
+
*/
|
|
1250
|
+
function areRegExpsEqual(a, b) {
|
|
1251
|
+
return a.source === b.source && a.flags === b.flags;
|
|
1252
|
+
}
|
|
1253
|
+
/**
|
|
1254
|
+
* Whether the `Set`s are equal in value.
|
|
1255
|
+
*/
|
|
1256
|
+
function areSetsEqual(a, b, state) {
|
|
1257
|
+
var size = a.size;
|
|
1258
|
+
if (size !== b.size) return false;
|
|
1259
|
+
if (!size) return true;
|
|
1260
|
+
var matchedIndices = new Array(size);
|
|
1261
|
+
var aIterable = a.values();
|
|
1262
|
+
var aResult;
|
|
1263
|
+
var bResult;
|
|
1264
|
+
while (aResult = aIterable.next()) {
|
|
1265
|
+
if (aResult.done) break;
|
|
1266
|
+
var bIterable = b.values();
|
|
1267
|
+
var hasMatch = false;
|
|
1268
|
+
var matchIndex = 0;
|
|
1269
|
+
while (bResult = bIterable.next()) {
|
|
1270
|
+
if (bResult.done) break;
|
|
1271
|
+
if (!matchedIndices[matchIndex] && state.equals(aResult.value, bResult.value, aResult.value, bResult.value, a, b, state)) {
|
|
1272
|
+
hasMatch = matchedIndices[matchIndex] = true;
|
|
1273
|
+
break;
|
|
1274
|
+
}
|
|
1275
|
+
matchIndex++;
|
|
1276
|
+
}
|
|
1277
|
+
if (!hasMatch) return false;
|
|
1278
|
+
}
|
|
1279
|
+
return true;
|
|
1280
|
+
}
|
|
1281
|
+
/**
|
|
1282
|
+
* Whether the TypedArray instances are equal in value.
|
|
1283
|
+
*/
|
|
1284
|
+
function areTypedArraysEqual(a, b) {
|
|
1285
|
+
var index = a.length;
|
|
1286
|
+
if (b.length !== index) return false;
|
|
1287
|
+
while (index-- > 0) if (a[index] !== b[index]) return false;
|
|
1288
|
+
return true;
|
|
1289
|
+
}
|
|
1290
|
+
/**
|
|
1291
|
+
* Whether the URL instances are equal in value.
|
|
1292
|
+
*/
|
|
1293
|
+
function areUrlsEqual(a, b) {
|
|
1294
|
+
return a.hostname === b.hostname && a.pathname === b.pathname && a.protocol === b.protocol && a.port === b.port && a.hash === b.hash && a.username === b.username && a.password === b.password;
|
|
1295
|
+
}
|
|
1296
|
+
function isPropertyEqual(a, b, state, property) {
|
|
1297
|
+
if ((property === REACT_OWNER || property === PREACT_OWNER || property === PREACT_VNODE) && (a.$$typeof || b.$$typeof)) return true;
|
|
1298
|
+
return hasOwn(b, property) && state.equals(a[property], b[property], property, property, a, b, state);
|
|
1299
|
+
}
|
|
1300
|
+
var ARGUMENTS_TAG = "[object Arguments]";
|
|
1301
|
+
var BOOLEAN_TAG = "[object Boolean]";
|
|
1302
|
+
var DATE_TAG = "[object Date]";
|
|
1303
|
+
var ERROR_TAG = "[object Error]";
|
|
1304
|
+
var MAP_TAG = "[object Map]";
|
|
1305
|
+
var NUMBER_TAG = "[object Number]";
|
|
1306
|
+
var OBJECT_TAG = "[object Object]";
|
|
1307
|
+
var REG_EXP_TAG = "[object RegExp]";
|
|
1308
|
+
var SET_TAG = "[object Set]";
|
|
1309
|
+
var STRING_TAG = "[object String]";
|
|
1310
|
+
var URL_TAG = "[object URL]";
|
|
1311
|
+
var isArray = Array.isArray;
|
|
1312
|
+
var isTypedArray = typeof ArrayBuffer === "function" && ArrayBuffer.isView ? ArrayBuffer.isView : null;
|
|
1313
|
+
var assign = Object.assign;
|
|
1314
|
+
var getTag = Object.prototype.toString.call.bind(Object.prototype.toString);
|
|
1315
|
+
/**
|
|
1316
|
+
* Create a comparator method based on the type-specific equality comparators passed.
|
|
1317
|
+
*/
|
|
1318
|
+
function createEqualityComparator(_a) {
|
|
1319
|
+
var areArraysEqual = _a.areArraysEqual, areDatesEqual = _a.areDatesEqual, areErrorsEqual = _a.areErrorsEqual, areFunctionsEqual = _a.areFunctionsEqual, areMapsEqual = _a.areMapsEqual, areNumbersEqual = _a.areNumbersEqual, areObjectsEqual = _a.areObjectsEqual, arePrimitiveWrappersEqual = _a.arePrimitiveWrappersEqual, areRegExpsEqual = _a.areRegExpsEqual, areSetsEqual = _a.areSetsEqual, areTypedArraysEqual = _a.areTypedArraysEqual, areUrlsEqual = _a.areUrlsEqual;
|
|
1320
|
+
/**
|
|
1321
|
+
* compare the value of the two objects and return true if they are equivalent in values
|
|
1322
|
+
*/
|
|
1323
|
+
return function comparator(a, b, state) {
|
|
1324
|
+
if (a === b) return true;
|
|
1325
|
+
if (a == null || b == null) return false;
|
|
1326
|
+
var type = typeof a;
|
|
1327
|
+
if (type !== typeof b) return false;
|
|
1328
|
+
if (type !== "object") {
|
|
1329
|
+
if (type === "number") return areNumbersEqual(a, b, state);
|
|
1330
|
+
if (type === "function") return areFunctionsEqual(a, b, state);
|
|
1331
|
+
return false;
|
|
1332
|
+
}
|
|
1333
|
+
var constructor = a.constructor;
|
|
1334
|
+
if (constructor !== b.constructor) return false;
|
|
1335
|
+
if (constructor === Object) return areObjectsEqual(a, b, state);
|
|
1336
|
+
if (isArray(a)) return areArraysEqual(a, b, state);
|
|
1337
|
+
if (isTypedArray != null && isTypedArray(a)) return areTypedArraysEqual(a, b, state);
|
|
1338
|
+
if (constructor === Date) return areDatesEqual(a, b, state);
|
|
1339
|
+
if (constructor === RegExp) return areRegExpsEqual(a, b, state);
|
|
1340
|
+
if (constructor === Map) return areMapsEqual(a, b, state);
|
|
1341
|
+
if (constructor === Set) return areSetsEqual(a, b, state);
|
|
1342
|
+
var tag = getTag(a);
|
|
1343
|
+
if (tag === DATE_TAG) return areDatesEqual(a, b, state);
|
|
1344
|
+
if (tag === REG_EXP_TAG) return areRegExpsEqual(a, b, state);
|
|
1345
|
+
if (tag === MAP_TAG) return areMapsEqual(a, b, state);
|
|
1346
|
+
if (tag === SET_TAG) return areSetsEqual(a, b, state);
|
|
1347
|
+
if (tag === OBJECT_TAG) return typeof a.then !== "function" && typeof b.then !== "function" && areObjectsEqual(a, b, state);
|
|
1348
|
+
if (tag === URL_TAG) return areUrlsEqual(a, b, state);
|
|
1349
|
+
if (tag === ERROR_TAG) return areErrorsEqual(a, b, state);
|
|
1350
|
+
if (tag === ARGUMENTS_TAG) return areObjectsEqual(a, b, state);
|
|
1351
|
+
if (tag === BOOLEAN_TAG || tag === NUMBER_TAG || tag === STRING_TAG) return arePrimitiveWrappersEqual(a, b, state);
|
|
1352
|
+
return false;
|
|
1353
|
+
};
|
|
1354
|
+
}
|
|
1355
|
+
/**
|
|
1356
|
+
* Create the configuration object used for building comparators.
|
|
1357
|
+
*/
|
|
1358
|
+
function createEqualityComparatorConfig(_a) {
|
|
1359
|
+
var circular = _a.circular, createCustomConfig = _a.createCustomConfig, strict = _a.strict;
|
|
1360
|
+
var config = {
|
|
1361
|
+
areArraysEqual: strict ? areObjectsEqualStrict : areArraysEqual,
|
|
1362
|
+
areDatesEqual,
|
|
1363
|
+
areErrorsEqual,
|
|
1364
|
+
areFunctionsEqual,
|
|
1365
|
+
areMapsEqual: strict ? combineComparators(areMapsEqual, areObjectsEqualStrict) : areMapsEqual,
|
|
1366
|
+
areNumbersEqual,
|
|
1367
|
+
areObjectsEqual: strict ? areObjectsEqualStrict : areObjectsEqual,
|
|
1368
|
+
arePrimitiveWrappersEqual,
|
|
1369
|
+
areRegExpsEqual,
|
|
1370
|
+
areSetsEqual: strict ? combineComparators(areSetsEqual, areObjectsEqualStrict) : areSetsEqual,
|
|
1371
|
+
areTypedArraysEqual: strict ? areObjectsEqualStrict : areTypedArraysEqual,
|
|
1372
|
+
areUrlsEqual
|
|
1373
|
+
};
|
|
1374
|
+
if (createCustomConfig) config = assign({}, config, createCustomConfig(config));
|
|
1375
|
+
if (circular) {
|
|
1376
|
+
var areArraysEqual$1 = createIsCircular(config.areArraysEqual);
|
|
1377
|
+
var areMapsEqual$1 = createIsCircular(config.areMapsEqual);
|
|
1378
|
+
var areObjectsEqual$1 = createIsCircular(config.areObjectsEqual);
|
|
1379
|
+
var areSetsEqual$1 = createIsCircular(config.areSetsEqual);
|
|
1380
|
+
config = assign({}, config, {
|
|
1381
|
+
areArraysEqual: areArraysEqual$1,
|
|
1382
|
+
areMapsEqual: areMapsEqual$1,
|
|
1383
|
+
areObjectsEqual: areObjectsEqual$1,
|
|
1384
|
+
areSetsEqual: areSetsEqual$1
|
|
1385
|
+
});
|
|
1386
|
+
}
|
|
1387
|
+
return config;
|
|
1388
|
+
}
|
|
1389
|
+
/**
|
|
1390
|
+
* Default equality comparator pass-through, used as the standard `isEqual` creator for
|
|
1391
|
+
* use inside the built comparator.
|
|
1392
|
+
*/
|
|
1393
|
+
function createInternalEqualityComparator(compare) {
|
|
1394
|
+
return function(a, b, _indexOrKeyA, _indexOrKeyB, _parentA, _parentB, state) {
|
|
1395
|
+
return compare(a, b, state);
|
|
1396
|
+
};
|
|
1397
|
+
}
|
|
1398
|
+
/**
|
|
1399
|
+
* Create the `isEqual` function used by the consuming application.
|
|
1400
|
+
*/
|
|
1401
|
+
function createIsEqual(_a) {
|
|
1402
|
+
var circular = _a.circular, comparator = _a.comparator, createState = _a.createState, equals = _a.equals, strict = _a.strict;
|
|
1403
|
+
if (createState) return function isEqual(a, b) {
|
|
1404
|
+
var _a = createState(), _b = _a.cache, cache = _b === void 0 ? circular ? /* @__PURE__ */ new WeakMap() : void 0 : _b, meta = _a.meta;
|
|
1405
|
+
return comparator(a, b, {
|
|
1406
|
+
cache,
|
|
1407
|
+
equals,
|
|
1408
|
+
meta,
|
|
1409
|
+
strict
|
|
1410
|
+
});
|
|
1411
|
+
};
|
|
1412
|
+
if (circular) return function isEqual(a, b) {
|
|
1413
|
+
return comparator(a, b, {
|
|
1414
|
+
cache: /* @__PURE__ */ new WeakMap(),
|
|
1415
|
+
equals,
|
|
1416
|
+
meta: void 0,
|
|
1417
|
+
strict
|
|
1418
|
+
});
|
|
1419
|
+
};
|
|
1420
|
+
var state = {
|
|
1421
|
+
cache: void 0,
|
|
1422
|
+
equals,
|
|
1423
|
+
meta: void 0,
|
|
1424
|
+
strict
|
|
1425
|
+
};
|
|
1426
|
+
return function isEqual(a, b) {
|
|
1427
|
+
return comparator(a, b, state);
|
|
1428
|
+
};
|
|
1429
|
+
}
|
|
1430
|
+
/**
|
|
1431
|
+
* Whether the items passed are deeply-equal in value.
|
|
1432
|
+
*/
|
|
1433
|
+
var deepEqual = createCustomEqual();
|
|
1434
|
+
createCustomEqual({ strict: true });
|
|
1435
|
+
createCustomEqual({ circular: true });
|
|
1436
|
+
createCustomEqual({
|
|
1437
|
+
circular: true,
|
|
1438
|
+
strict: true
|
|
1439
|
+
});
|
|
1440
|
+
createCustomEqual({ createInternalComparator: function() {
|
|
1441
|
+
return sameValueZeroEqual;
|
|
1442
|
+
} });
|
|
1443
|
+
createCustomEqual({
|
|
1444
|
+
strict: true,
|
|
1445
|
+
createInternalComparator: function() {
|
|
1446
|
+
return sameValueZeroEqual;
|
|
1447
|
+
}
|
|
1448
|
+
});
|
|
1449
|
+
createCustomEqual({
|
|
1450
|
+
circular: true,
|
|
1451
|
+
createInternalComparator: function() {
|
|
1452
|
+
return sameValueZeroEqual;
|
|
1453
|
+
}
|
|
1454
|
+
});
|
|
1455
|
+
createCustomEqual({
|
|
1456
|
+
circular: true,
|
|
1457
|
+
createInternalComparator: function() {
|
|
1458
|
+
return sameValueZeroEqual;
|
|
1459
|
+
},
|
|
1460
|
+
strict: true
|
|
1461
|
+
});
|
|
1462
|
+
/**
|
|
1463
|
+
* Create a custom equality comparison method.
|
|
1464
|
+
*
|
|
1465
|
+
* This can be done to create very targeted comparisons in extreme hot-path scenarios
|
|
1466
|
+
* where the standard methods are not performant enough, but can also be used to provide
|
|
1467
|
+
* support for legacy environments that do not support expected features like
|
|
1468
|
+
* `RegExp.prototype.flags` out of the box.
|
|
1469
|
+
*/
|
|
1470
|
+
function createCustomEqual(options) {
|
|
1471
|
+
if (options === void 0) options = {};
|
|
1472
|
+
var _a = options.circular, circular = _a === void 0 ? false : _a, createCustomInternalComparator = options.createInternalComparator, createState = options.createState, _b = options.strict, strict = _b === void 0 ? false : _b;
|
|
1473
|
+
var comparator = createEqualityComparator(createEqualityComparatorConfig(options));
|
|
1474
|
+
return createIsEqual({
|
|
1475
|
+
circular,
|
|
1476
|
+
comparator,
|
|
1477
|
+
createState,
|
|
1478
|
+
equals: createCustomInternalComparator ? createCustomInternalComparator(comparator) : createInternalEqualityComparator(comparator),
|
|
1479
|
+
strict
|
|
1480
|
+
});
|
|
1481
|
+
}
|
|
1482
|
+
//#endregion
|
|
1483
|
+
//#region node_modules/.pnpm/kdbush@4.0.2/node_modules/kdbush/index.js
|
|
1484
|
+
var ARRAY_TYPES = [
|
|
1485
|
+
Int8Array,
|
|
1486
|
+
Uint8Array,
|
|
1487
|
+
Uint8ClampedArray,
|
|
1488
|
+
Int16Array,
|
|
1489
|
+
Uint16Array,
|
|
1490
|
+
Int32Array,
|
|
1491
|
+
Uint32Array,
|
|
1492
|
+
Float32Array,
|
|
1493
|
+
Float64Array
|
|
1494
|
+
];
|
|
1495
|
+
/** @typedef {Int8ArrayConstructor | Uint8ArrayConstructor | Uint8ClampedArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Int32ArrayConstructor | Uint32ArrayConstructor | Float32ArrayConstructor | Float64ArrayConstructor} TypedArrayConstructor */
|
|
1496
|
+
var VERSION = 1;
|
|
1497
|
+
var HEADER_SIZE = 8;
|
|
1498
|
+
var KDBush = class KDBush {
|
|
1499
|
+
/**
|
|
1500
|
+
* Creates an index from raw `ArrayBuffer` data.
|
|
1501
|
+
* @param {ArrayBuffer} data
|
|
1502
|
+
*/
|
|
1503
|
+
static from(data) {
|
|
1504
|
+
if (!(data instanceof ArrayBuffer)) throw new Error("Data must be an instance of ArrayBuffer.");
|
|
1505
|
+
const [magic, versionAndType] = new Uint8Array(data, 0, 2);
|
|
1506
|
+
if (magic !== 219) throw new Error("Data does not appear to be in a KDBush format.");
|
|
1507
|
+
const version = versionAndType >> 4;
|
|
1508
|
+
if (version !== VERSION) throw new Error(`Got v${version} data when expected v${VERSION}.`);
|
|
1509
|
+
const ArrayType = ARRAY_TYPES[versionAndType & 15];
|
|
1510
|
+
if (!ArrayType) throw new Error("Unrecognized array type.");
|
|
1511
|
+
const [nodeSize] = new Uint16Array(data, 2, 1);
|
|
1512
|
+
const [numItems] = new Uint32Array(data, 4, 1);
|
|
1513
|
+
return new KDBush(numItems, nodeSize, ArrayType, data);
|
|
1514
|
+
}
|
|
1515
|
+
/**
|
|
1516
|
+
* Creates an index that will hold a given number of items.
|
|
1517
|
+
* @param {number} numItems
|
|
1518
|
+
* @param {number} [nodeSize=64] Size of the KD-tree node (64 by default).
|
|
1519
|
+
* @param {TypedArrayConstructor} [ArrayType=Float64Array] The array type used for coordinates storage (`Float64Array` by default).
|
|
1520
|
+
* @param {ArrayBuffer} [data] (For internal use only)
|
|
1521
|
+
*/
|
|
1522
|
+
constructor(numItems, nodeSize = 64, ArrayType = Float64Array, data) {
|
|
1523
|
+
if (isNaN(numItems) || numItems < 0) throw new Error(`Unpexpected numItems value: ${numItems}.`);
|
|
1524
|
+
this.numItems = +numItems;
|
|
1525
|
+
this.nodeSize = Math.min(Math.max(+nodeSize, 2), 65535);
|
|
1526
|
+
this.ArrayType = ArrayType;
|
|
1527
|
+
this.IndexArrayType = numItems < 65536 ? Uint16Array : Uint32Array;
|
|
1528
|
+
const arrayTypeIndex = ARRAY_TYPES.indexOf(this.ArrayType);
|
|
1529
|
+
const coordsByteSize = numItems * 2 * this.ArrayType.BYTES_PER_ELEMENT;
|
|
1530
|
+
const idsByteSize = numItems * this.IndexArrayType.BYTES_PER_ELEMENT;
|
|
1531
|
+
const padCoords = (8 - idsByteSize % 8) % 8;
|
|
1532
|
+
if (arrayTypeIndex < 0) throw new Error(`Unexpected typed array class: ${ArrayType}.`);
|
|
1533
|
+
if (data && data instanceof ArrayBuffer) {
|
|
1534
|
+
this.data = data;
|
|
1535
|
+
this.ids = new this.IndexArrayType(this.data, HEADER_SIZE, numItems);
|
|
1536
|
+
this.coords = new this.ArrayType(this.data, HEADER_SIZE + idsByteSize + padCoords, numItems * 2);
|
|
1537
|
+
this._pos = numItems * 2;
|
|
1538
|
+
this._finished = true;
|
|
1539
|
+
} else {
|
|
1540
|
+
this.data = new ArrayBuffer(HEADER_SIZE + coordsByteSize + idsByteSize + padCoords);
|
|
1541
|
+
this.ids = new this.IndexArrayType(this.data, HEADER_SIZE, numItems);
|
|
1542
|
+
this.coords = new this.ArrayType(this.data, HEADER_SIZE + idsByteSize + padCoords, numItems * 2);
|
|
1543
|
+
this._pos = 0;
|
|
1544
|
+
this._finished = false;
|
|
1545
|
+
new Uint8Array(this.data, 0, 2).set([219, (VERSION << 4) + arrayTypeIndex]);
|
|
1546
|
+
new Uint16Array(this.data, 2, 1)[0] = nodeSize;
|
|
1547
|
+
new Uint32Array(this.data, 4, 1)[0] = numItems;
|
|
1548
|
+
}
|
|
1549
|
+
}
|
|
1550
|
+
/**
|
|
1551
|
+
* Add a point to the index.
|
|
1552
|
+
* @param {number} x
|
|
1553
|
+
* @param {number} y
|
|
1554
|
+
* @returns {number} An incremental index associated with the added item (starting from `0`).
|
|
1555
|
+
*/
|
|
1556
|
+
add(x, y) {
|
|
1557
|
+
const index = this._pos >> 1;
|
|
1558
|
+
this.ids[index] = index;
|
|
1559
|
+
this.coords[this._pos++] = x;
|
|
1560
|
+
this.coords[this._pos++] = y;
|
|
1561
|
+
return index;
|
|
1562
|
+
}
|
|
1563
|
+
/**
|
|
1564
|
+
* Perform indexing of the added points.
|
|
1565
|
+
*/
|
|
1566
|
+
finish() {
|
|
1567
|
+
const numAdded = this._pos >> 1;
|
|
1568
|
+
if (numAdded !== this.numItems) throw new Error(`Added ${numAdded} items when expected ${this.numItems}.`);
|
|
1569
|
+
sort(this.ids, this.coords, this.nodeSize, 0, this.numItems - 1, 0);
|
|
1570
|
+
this._finished = true;
|
|
1571
|
+
return this;
|
|
1572
|
+
}
|
|
1573
|
+
/**
|
|
1574
|
+
* Search the index for items within a given bounding box.
|
|
1575
|
+
* @param {number} minX
|
|
1576
|
+
* @param {number} minY
|
|
1577
|
+
* @param {number} maxX
|
|
1578
|
+
* @param {number} maxY
|
|
1579
|
+
* @returns {number[]} An array of indices correponding to the found items.
|
|
1580
|
+
*/
|
|
1581
|
+
range(minX, minY, maxX, maxY) {
|
|
1582
|
+
if (!this._finished) throw new Error("Data not yet indexed - call index.finish().");
|
|
1583
|
+
const { ids, coords, nodeSize } = this;
|
|
1584
|
+
const stack = [
|
|
1585
|
+
0,
|
|
1586
|
+
ids.length - 1,
|
|
1587
|
+
0
|
|
1588
|
+
];
|
|
1589
|
+
const result = [];
|
|
1590
|
+
while (stack.length) {
|
|
1591
|
+
const axis = stack.pop() || 0;
|
|
1592
|
+
const right = stack.pop() || 0;
|
|
1593
|
+
const left = stack.pop() || 0;
|
|
1594
|
+
if (right - left <= nodeSize) {
|
|
1595
|
+
for (let i = left; i <= right; i++) {
|
|
1596
|
+
const x = coords[2 * i];
|
|
1597
|
+
const y = coords[2 * i + 1];
|
|
1598
|
+
if (x >= minX && x <= maxX && y >= minY && y <= maxY) result.push(ids[i]);
|
|
1599
|
+
}
|
|
1600
|
+
continue;
|
|
1601
|
+
}
|
|
1602
|
+
const m = left + right >> 1;
|
|
1603
|
+
const x = coords[2 * m];
|
|
1604
|
+
const y = coords[2 * m + 1];
|
|
1605
|
+
if (x >= minX && x <= maxX && y >= minY && y <= maxY) result.push(ids[m]);
|
|
1606
|
+
if (axis === 0 ? minX <= x : minY <= y) {
|
|
1607
|
+
stack.push(left);
|
|
1608
|
+
stack.push(m - 1);
|
|
1609
|
+
stack.push(1 - axis);
|
|
1610
|
+
}
|
|
1611
|
+
if (axis === 0 ? maxX >= x : maxY >= y) {
|
|
1612
|
+
stack.push(m + 1);
|
|
1613
|
+
stack.push(right);
|
|
1614
|
+
stack.push(1 - axis);
|
|
1615
|
+
}
|
|
1616
|
+
}
|
|
1617
|
+
return result;
|
|
1618
|
+
}
|
|
1619
|
+
/**
|
|
1620
|
+
* Search the index for items within a given radius.
|
|
1621
|
+
* @param {number} qx
|
|
1622
|
+
* @param {number} qy
|
|
1623
|
+
* @param {number} r Query radius.
|
|
1624
|
+
* @returns {number[]} An array of indices correponding to the found items.
|
|
1625
|
+
*/
|
|
1626
|
+
within(qx, qy, r) {
|
|
1627
|
+
if (!this._finished) throw new Error("Data not yet indexed - call index.finish().");
|
|
1628
|
+
const { ids, coords, nodeSize } = this;
|
|
1629
|
+
const stack = [
|
|
1630
|
+
0,
|
|
1631
|
+
ids.length - 1,
|
|
1632
|
+
0
|
|
1633
|
+
];
|
|
1634
|
+
const result = [];
|
|
1635
|
+
const r2 = r * r;
|
|
1636
|
+
while (stack.length) {
|
|
1637
|
+
const axis = stack.pop() || 0;
|
|
1638
|
+
const right = stack.pop() || 0;
|
|
1639
|
+
const left = stack.pop() || 0;
|
|
1640
|
+
if (right - left <= nodeSize) {
|
|
1641
|
+
for (let i = left; i <= right; i++) if (sqDist(coords[2 * i], coords[2 * i + 1], qx, qy) <= r2) result.push(ids[i]);
|
|
1642
|
+
continue;
|
|
1643
|
+
}
|
|
1644
|
+
const m = left + right >> 1;
|
|
1645
|
+
const x = coords[2 * m];
|
|
1646
|
+
const y = coords[2 * m + 1];
|
|
1647
|
+
if (sqDist(x, y, qx, qy) <= r2) result.push(ids[m]);
|
|
1648
|
+
if (axis === 0 ? qx - r <= x : qy - r <= y) {
|
|
1649
|
+
stack.push(left);
|
|
1650
|
+
stack.push(m - 1);
|
|
1651
|
+
stack.push(1 - axis);
|
|
1652
|
+
}
|
|
1653
|
+
if (axis === 0 ? qx + r >= x : qy + r >= y) {
|
|
1654
|
+
stack.push(m + 1);
|
|
1655
|
+
stack.push(right);
|
|
1656
|
+
stack.push(1 - axis);
|
|
1657
|
+
}
|
|
1658
|
+
}
|
|
1659
|
+
return result;
|
|
1660
|
+
}
|
|
1661
|
+
};
|
|
1662
|
+
/**
|
|
1663
|
+
* @param {Uint16Array | Uint32Array} ids
|
|
1664
|
+
* @param {InstanceType<TypedArrayConstructor>} coords
|
|
1665
|
+
* @param {number} nodeSize
|
|
1666
|
+
* @param {number} left
|
|
1667
|
+
* @param {number} right
|
|
1668
|
+
* @param {number} axis
|
|
1669
|
+
*/
|
|
1670
|
+
function sort(ids, coords, nodeSize, left, right, axis) {
|
|
1671
|
+
if (right - left <= nodeSize) return;
|
|
1672
|
+
const m = left + right >> 1;
|
|
1673
|
+
select(ids, coords, m, left, right, axis);
|
|
1674
|
+
sort(ids, coords, nodeSize, left, m - 1, 1 - axis);
|
|
1675
|
+
sort(ids, coords, nodeSize, m + 1, right, 1 - axis);
|
|
1676
|
+
}
|
|
1677
|
+
/**
|
|
1678
|
+
* Custom Floyd-Rivest selection algorithm: sort ids and coords so that
|
|
1679
|
+
* [left..k-1] items are smaller than k-th item (on either x or y axis)
|
|
1680
|
+
* @param {Uint16Array | Uint32Array} ids
|
|
1681
|
+
* @param {InstanceType<TypedArrayConstructor>} coords
|
|
1682
|
+
* @param {number} k
|
|
1683
|
+
* @param {number} left
|
|
1684
|
+
* @param {number} right
|
|
1685
|
+
* @param {number} axis
|
|
1686
|
+
*/
|
|
1687
|
+
function select(ids, coords, k, left, right, axis) {
|
|
1688
|
+
while (right > left) {
|
|
1689
|
+
if (right - left > 600) {
|
|
1690
|
+
const n = right - left + 1;
|
|
1691
|
+
const m = k - left + 1;
|
|
1692
|
+
const z = Math.log(n);
|
|
1693
|
+
const s = .5 * Math.exp(2 * z / 3);
|
|
1694
|
+
const sd = .5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1);
|
|
1695
|
+
select(ids, coords, k, Math.max(left, Math.floor(k - m * s / n + sd)), Math.min(right, Math.floor(k + (n - m) * s / n + sd)), axis);
|
|
1696
|
+
}
|
|
1697
|
+
const t = coords[2 * k + axis];
|
|
1698
|
+
let i = left;
|
|
1699
|
+
let j = right;
|
|
1700
|
+
swapItem(ids, coords, left, k);
|
|
1701
|
+
if (coords[2 * right + axis] > t) swapItem(ids, coords, left, right);
|
|
1702
|
+
while (i < j) {
|
|
1703
|
+
swapItem(ids, coords, i, j);
|
|
1704
|
+
i++;
|
|
1705
|
+
j--;
|
|
1706
|
+
while (coords[2 * i + axis] < t) i++;
|
|
1707
|
+
while (coords[2 * j + axis] > t) j--;
|
|
1708
|
+
}
|
|
1709
|
+
if (coords[2 * left + axis] === t) swapItem(ids, coords, left, j);
|
|
1710
|
+
else {
|
|
1711
|
+
j++;
|
|
1712
|
+
swapItem(ids, coords, j, right);
|
|
1713
|
+
}
|
|
1714
|
+
if (j <= k) left = j + 1;
|
|
1715
|
+
if (k <= j) right = j - 1;
|
|
1716
|
+
}
|
|
1717
|
+
}
|
|
1718
|
+
/**
|
|
1719
|
+
* @param {Uint16Array | Uint32Array} ids
|
|
1720
|
+
* @param {InstanceType<TypedArrayConstructor>} coords
|
|
1721
|
+
* @param {number} i
|
|
1722
|
+
* @param {number} j
|
|
1723
|
+
*/
|
|
1724
|
+
function swapItem(ids, coords, i, j) {
|
|
1725
|
+
swap(ids, i, j);
|
|
1726
|
+
swap(coords, 2 * i, 2 * j);
|
|
1727
|
+
swap(coords, 2 * i + 1, 2 * j + 1);
|
|
1728
|
+
}
|
|
1729
|
+
/**
|
|
1730
|
+
* @param {InstanceType<TypedArrayConstructor>} arr
|
|
1731
|
+
* @param {number} i
|
|
1732
|
+
* @param {number} j
|
|
1733
|
+
*/
|
|
1734
|
+
function swap(arr, i, j) {
|
|
1735
|
+
const tmp = arr[i];
|
|
1736
|
+
arr[i] = arr[j];
|
|
1737
|
+
arr[j] = tmp;
|
|
1738
|
+
}
|
|
1739
|
+
/**
|
|
1740
|
+
* @param {number} ax
|
|
1741
|
+
* @param {number} ay
|
|
1742
|
+
* @param {number} bx
|
|
1743
|
+
* @param {number} by
|
|
1744
|
+
*/
|
|
1745
|
+
function sqDist(ax, ay, bx, by) {
|
|
1746
|
+
const dx = ax - bx;
|
|
1747
|
+
const dy = ay - by;
|
|
1748
|
+
return dx * dx + dy * dy;
|
|
1749
|
+
}
|
|
1750
|
+
//#endregion
|
|
1751
|
+
//#region node_modules/.pnpm/supercluster@8.0.1/node_modules/supercluster/index.js
|
|
1752
|
+
var defaultOptions = {
|
|
1753
|
+
minZoom: 0,
|
|
1754
|
+
maxZoom: 16,
|
|
1755
|
+
minPoints: 2,
|
|
1756
|
+
radius: 40,
|
|
1757
|
+
extent: 512,
|
|
1758
|
+
nodeSize: 64,
|
|
1759
|
+
log: false,
|
|
1760
|
+
generateId: false,
|
|
1761
|
+
reduce: null,
|
|
1762
|
+
map: (props) => props
|
|
1763
|
+
};
|
|
1764
|
+
var fround = Math.fround || ((tmp) => ((x) => {
|
|
1765
|
+
tmp[0] = +x;
|
|
1766
|
+
return tmp[0];
|
|
1767
|
+
}))(new Float32Array(1));
|
|
1768
|
+
var OFFSET_ZOOM = 2;
|
|
1769
|
+
var OFFSET_ID = 3;
|
|
1770
|
+
var OFFSET_PARENT = 4;
|
|
1771
|
+
var OFFSET_NUM = 5;
|
|
1772
|
+
var OFFSET_PROP = 6;
|
|
1773
|
+
var Supercluster = class {
|
|
1774
|
+
constructor(options) {
|
|
1775
|
+
this.options = Object.assign(Object.create(defaultOptions), options);
|
|
1776
|
+
this.trees = new Array(this.options.maxZoom + 1);
|
|
1777
|
+
this.stride = this.options.reduce ? 7 : 6;
|
|
1778
|
+
this.clusterProps = [];
|
|
1779
|
+
}
|
|
1780
|
+
load(points) {
|
|
1781
|
+
const { log, minZoom, maxZoom } = this.options;
|
|
1782
|
+
if (log) console.time("total time");
|
|
1783
|
+
const timerId = `prepare ${points.length} points`;
|
|
1784
|
+
if (log) console.time(timerId);
|
|
1785
|
+
this.points = points;
|
|
1786
|
+
const data = [];
|
|
1787
|
+
for (let i = 0; i < points.length; i++) {
|
|
1788
|
+
const p = points[i];
|
|
1789
|
+
if (!p.geometry) continue;
|
|
1790
|
+
const [lng, lat] = p.geometry.coordinates;
|
|
1791
|
+
const x = fround(lngX(lng));
|
|
1792
|
+
const y = fround(latY(lat));
|
|
1793
|
+
data.push(x, y, Infinity, i, -1, 1);
|
|
1794
|
+
if (this.options.reduce) data.push(0);
|
|
1795
|
+
}
|
|
1796
|
+
let tree = this.trees[maxZoom + 1] = this._createTree(data);
|
|
1797
|
+
if (log) console.timeEnd(timerId);
|
|
1798
|
+
for (let z = maxZoom; z >= minZoom; z--) {
|
|
1799
|
+
const now = +Date.now();
|
|
1800
|
+
tree = this.trees[z] = this._createTree(this._cluster(tree, z));
|
|
1801
|
+
if (log) console.log("z%d: %d clusters in %dms", z, tree.numItems, +Date.now() - now);
|
|
1802
|
+
}
|
|
1803
|
+
if (log) console.timeEnd("total time");
|
|
1804
|
+
return this;
|
|
1805
|
+
}
|
|
1806
|
+
getClusters(bbox, zoom) {
|
|
1807
|
+
let minLng = ((bbox[0] + 180) % 360 + 360) % 360 - 180;
|
|
1808
|
+
const minLat = Math.max(-90, Math.min(90, bbox[1]));
|
|
1809
|
+
let maxLng = bbox[2] === 180 ? 180 : ((bbox[2] + 180) % 360 + 360) % 360 - 180;
|
|
1810
|
+
const maxLat = Math.max(-90, Math.min(90, bbox[3]));
|
|
1811
|
+
if (bbox[2] - bbox[0] >= 360) {
|
|
1812
|
+
minLng = -180;
|
|
1813
|
+
maxLng = 180;
|
|
1814
|
+
} else if (minLng > maxLng) {
|
|
1815
|
+
const easternHem = this.getClusters([
|
|
1816
|
+
minLng,
|
|
1817
|
+
minLat,
|
|
1818
|
+
180,
|
|
1819
|
+
maxLat
|
|
1820
|
+
], zoom);
|
|
1821
|
+
const westernHem = this.getClusters([
|
|
1822
|
+
-180,
|
|
1823
|
+
minLat,
|
|
1824
|
+
maxLng,
|
|
1825
|
+
maxLat
|
|
1826
|
+
], zoom);
|
|
1827
|
+
return easternHem.concat(westernHem);
|
|
1828
|
+
}
|
|
1829
|
+
const tree = this.trees[this._limitZoom(zoom)];
|
|
1830
|
+
const ids = tree.range(lngX(minLng), latY(maxLat), lngX(maxLng), latY(minLat));
|
|
1831
|
+
const data = tree.data;
|
|
1832
|
+
const clusters = [];
|
|
1833
|
+
for (const id of ids) {
|
|
1834
|
+
const k = this.stride * id;
|
|
1835
|
+
clusters.push(data[k + OFFSET_NUM] > 1 ? getClusterJSON(data, k, this.clusterProps) : this.points[data[k + OFFSET_ID]]);
|
|
1836
|
+
}
|
|
1837
|
+
return clusters;
|
|
1838
|
+
}
|
|
1839
|
+
getChildren(clusterId) {
|
|
1840
|
+
const originId = this._getOriginId(clusterId);
|
|
1841
|
+
const originZoom = this._getOriginZoom(clusterId);
|
|
1842
|
+
const errorMsg = "No cluster with the specified id.";
|
|
1843
|
+
const tree = this.trees[originZoom];
|
|
1844
|
+
if (!tree) throw new Error(errorMsg);
|
|
1845
|
+
const data = tree.data;
|
|
1846
|
+
if (originId * this.stride >= data.length) throw new Error(errorMsg);
|
|
1847
|
+
const r = this.options.radius / (this.options.extent * Math.pow(2, originZoom - 1));
|
|
1848
|
+
const x = data[originId * this.stride];
|
|
1849
|
+
const y = data[originId * this.stride + 1];
|
|
1850
|
+
const ids = tree.within(x, y, r);
|
|
1851
|
+
const children = [];
|
|
1852
|
+
for (const id of ids) {
|
|
1853
|
+
const k = id * this.stride;
|
|
1854
|
+
if (data[k + OFFSET_PARENT] === clusterId) children.push(data[k + OFFSET_NUM] > 1 ? getClusterJSON(data, k, this.clusterProps) : this.points[data[k + OFFSET_ID]]);
|
|
1855
|
+
}
|
|
1856
|
+
if (children.length === 0) throw new Error(errorMsg);
|
|
1857
|
+
return children;
|
|
1858
|
+
}
|
|
1859
|
+
getLeaves(clusterId, limit, offset) {
|
|
1860
|
+
limit = limit || 10;
|
|
1861
|
+
offset = offset || 0;
|
|
1862
|
+
const leaves = [];
|
|
1863
|
+
this._appendLeaves(leaves, clusterId, limit, offset, 0);
|
|
1864
|
+
return leaves;
|
|
1865
|
+
}
|
|
1866
|
+
getTile(z, x, y) {
|
|
1867
|
+
const tree = this.trees[this._limitZoom(z)];
|
|
1868
|
+
const z2 = Math.pow(2, z);
|
|
1869
|
+
const { extent, radius } = this.options;
|
|
1870
|
+
const p = radius / extent;
|
|
1871
|
+
const top = (y - p) / z2;
|
|
1872
|
+
const bottom = (y + 1 + p) / z2;
|
|
1873
|
+
const tile = { features: [] };
|
|
1874
|
+
this._addTileFeatures(tree.range((x - p) / z2, top, (x + 1 + p) / z2, bottom), tree.data, x, y, z2, tile);
|
|
1875
|
+
if (x === 0) this._addTileFeatures(tree.range(1 - p / z2, top, 1, bottom), tree.data, z2, y, z2, tile);
|
|
1876
|
+
if (x === z2 - 1) this._addTileFeatures(tree.range(0, top, p / z2, bottom), tree.data, -1, y, z2, tile);
|
|
1877
|
+
return tile.features.length ? tile : null;
|
|
1878
|
+
}
|
|
1879
|
+
getClusterExpansionZoom(clusterId) {
|
|
1880
|
+
let expansionZoom = this._getOriginZoom(clusterId) - 1;
|
|
1881
|
+
while (expansionZoom <= this.options.maxZoom) {
|
|
1882
|
+
const children = this.getChildren(clusterId);
|
|
1883
|
+
expansionZoom++;
|
|
1884
|
+
if (children.length !== 1) break;
|
|
1885
|
+
clusterId = children[0].properties.cluster_id;
|
|
1886
|
+
}
|
|
1887
|
+
return expansionZoom;
|
|
1888
|
+
}
|
|
1889
|
+
_appendLeaves(result, clusterId, limit, offset, skipped) {
|
|
1890
|
+
const children = this.getChildren(clusterId);
|
|
1891
|
+
for (const child of children) {
|
|
1892
|
+
const props = child.properties;
|
|
1893
|
+
if (props && props.cluster) if (skipped + props.point_count <= offset) skipped += props.point_count;
|
|
1894
|
+
else skipped = this._appendLeaves(result, props.cluster_id, limit, offset, skipped);
|
|
1895
|
+
else if (skipped < offset) skipped++;
|
|
1896
|
+
else result.push(child);
|
|
1897
|
+
if (result.length === limit) break;
|
|
1898
|
+
}
|
|
1899
|
+
return skipped;
|
|
1900
|
+
}
|
|
1901
|
+
_createTree(data) {
|
|
1902
|
+
const tree = new KDBush(data.length / this.stride | 0, this.options.nodeSize, Float32Array);
|
|
1903
|
+
for (let i = 0; i < data.length; i += this.stride) tree.add(data[i], data[i + 1]);
|
|
1904
|
+
tree.finish();
|
|
1905
|
+
tree.data = data;
|
|
1906
|
+
return tree;
|
|
1907
|
+
}
|
|
1908
|
+
_addTileFeatures(ids, data, x, y, z2, tile) {
|
|
1909
|
+
for (const i of ids) {
|
|
1910
|
+
const k = i * this.stride;
|
|
1911
|
+
const isCluster = data[k + OFFSET_NUM] > 1;
|
|
1912
|
+
let tags, px, py;
|
|
1913
|
+
if (isCluster) {
|
|
1914
|
+
tags = getClusterProperties(data, k, this.clusterProps);
|
|
1915
|
+
px = data[k];
|
|
1916
|
+
py = data[k + 1];
|
|
1917
|
+
} else {
|
|
1918
|
+
const p = this.points[data[k + OFFSET_ID]];
|
|
1919
|
+
tags = p.properties;
|
|
1920
|
+
const [lng, lat] = p.geometry.coordinates;
|
|
1921
|
+
px = lngX(lng);
|
|
1922
|
+
py = latY(lat);
|
|
1923
|
+
}
|
|
1924
|
+
const f = {
|
|
1925
|
+
type: 1,
|
|
1926
|
+
geometry: [[Math.round(this.options.extent * (px * z2 - x)), Math.round(this.options.extent * (py * z2 - y))]],
|
|
1927
|
+
tags
|
|
1928
|
+
};
|
|
1929
|
+
let id;
|
|
1930
|
+
if (isCluster || this.options.generateId) id = data[k + OFFSET_ID];
|
|
1931
|
+
else id = this.points[data[k + OFFSET_ID]].id;
|
|
1932
|
+
if (id !== void 0) f.id = id;
|
|
1933
|
+
tile.features.push(f);
|
|
1934
|
+
}
|
|
1935
|
+
}
|
|
1936
|
+
_limitZoom(z) {
|
|
1937
|
+
return Math.max(this.options.minZoom, Math.min(Math.floor(+z), this.options.maxZoom + 1));
|
|
1938
|
+
}
|
|
1939
|
+
_cluster(tree, zoom) {
|
|
1940
|
+
const { radius, extent, reduce, minPoints } = this.options;
|
|
1941
|
+
const r = radius / (extent * Math.pow(2, zoom));
|
|
1942
|
+
const data = tree.data;
|
|
1943
|
+
const nextData = [];
|
|
1944
|
+
const stride = this.stride;
|
|
1945
|
+
for (let i = 0; i < data.length; i += stride) {
|
|
1946
|
+
if (data[i + OFFSET_ZOOM] <= zoom) continue;
|
|
1947
|
+
data[i + OFFSET_ZOOM] = zoom;
|
|
1948
|
+
const x = data[i];
|
|
1949
|
+
const y = data[i + 1];
|
|
1950
|
+
const neighborIds = tree.within(data[i], data[i + 1], r);
|
|
1951
|
+
const numPointsOrigin = data[i + OFFSET_NUM];
|
|
1952
|
+
let numPoints = numPointsOrigin;
|
|
1953
|
+
for (const neighborId of neighborIds) {
|
|
1954
|
+
const k = neighborId * stride;
|
|
1955
|
+
if (data[k + OFFSET_ZOOM] > zoom) numPoints += data[k + OFFSET_NUM];
|
|
1956
|
+
}
|
|
1957
|
+
if (numPoints > numPointsOrigin && numPoints >= minPoints) {
|
|
1958
|
+
let wx = x * numPointsOrigin;
|
|
1959
|
+
let wy = y * numPointsOrigin;
|
|
1960
|
+
let clusterProperties;
|
|
1961
|
+
let clusterPropIndex = -1;
|
|
1962
|
+
const id = ((i / stride | 0) << 5) + (zoom + 1) + this.points.length;
|
|
1963
|
+
for (const neighborId of neighborIds) {
|
|
1964
|
+
const k = neighborId * stride;
|
|
1965
|
+
if (data[k + OFFSET_ZOOM] <= zoom) continue;
|
|
1966
|
+
data[k + OFFSET_ZOOM] = zoom;
|
|
1967
|
+
const numPoints2 = data[k + OFFSET_NUM];
|
|
1968
|
+
wx += data[k] * numPoints2;
|
|
1969
|
+
wy += data[k + 1] * numPoints2;
|
|
1970
|
+
data[k + OFFSET_PARENT] = id;
|
|
1971
|
+
if (reduce) {
|
|
1972
|
+
if (!clusterProperties) {
|
|
1973
|
+
clusterProperties = this._map(data, i, true);
|
|
1974
|
+
clusterPropIndex = this.clusterProps.length;
|
|
1975
|
+
this.clusterProps.push(clusterProperties);
|
|
1976
|
+
}
|
|
1977
|
+
reduce(clusterProperties, this._map(data, k));
|
|
1978
|
+
}
|
|
1979
|
+
}
|
|
1980
|
+
data[i + OFFSET_PARENT] = id;
|
|
1981
|
+
nextData.push(wx / numPoints, wy / numPoints, Infinity, id, -1, numPoints);
|
|
1982
|
+
if (reduce) nextData.push(clusterPropIndex);
|
|
1983
|
+
} else {
|
|
1984
|
+
for (let j = 0; j < stride; j++) nextData.push(data[i + j]);
|
|
1985
|
+
if (numPoints > 1) for (const neighborId of neighborIds) {
|
|
1986
|
+
const k = neighborId * stride;
|
|
1987
|
+
if (data[k + OFFSET_ZOOM] <= zoom) continue;
|
|
1988
|
+
data[k + OFFSET_ZOOM] = zoom;
|
|
1989
|
+
for (let j = 0; j < stride; j++) nextData.push(data[k + j]);
|
|
1990
|
+
}
|
|
1991
|
+
}
|
|
1992
|
+
}
|
|
1993
|
+
return nextData;
|
|
1994
|
+
}
|
|
1995
|
+
_getOriginId(clusterId) {
|
|
1996
|
+
return clusterId - this.points.length >> 5;
|
|
1997
|
+
}
|
|
1998
|
+
_getOriginZoom(clusterId) {
|
|
1999
|
+
return (clusterId - this.points.length) % 32;
|
|
2000
|
+
}
|
|
2001
|
+
_map(data, i, clone) {
|
|
2002
|
+
if (data[i + OFFSET_NUM] > 1) {
|
|
2003
|
+
const props = this.clusterProps[data[i + OFFSET_PROP]];
|
|
2004
|
+
return clone ? Object.assign({}, props) : props;
|
|
2005
|
+
}
|
|
2006
|
+
const original = this.points[data[i + OFFSET_ID]].properties;
|
|
2007
|
+
const result = this.options.map(original);
|
|
2008
|
+
return clone && result === original ? Object.assign({}, result) : result;
|
|
2009
|
+
}
|
|
2010
|
+
};
|
|
2011
|
+
function getClusterJSON(data, i, clusterProps) {
|
|
2012
|
+
return {
|
|
2013
|
+
type: "Feature",
|
|
2014
|
+
id: data[i + OFFSET_ID],
|
|
2015
|
+
properties: getClusterProperties(data, i, clusterProps),
|
|
2016
|
+
geometry: {
|
|
2017
|
+
type: "Point",
|
|
2018
|
+
coordinates: [xLng(data[i]), yLat(data[i + 1])]
|
|
2019
|
+
}
|
|
2020
|
+
};
|
|
2021
|
+
}
|
|
2022
|
+
function getClusterProperties(data, i, clusterProps) {
|
|
2023
|
+
const count = data[i + OFFSET_NUM];
|
|
2024
|
+
const abbrev = count >= 1e4 ? `${Math.round(count / 1e3)}k` : count >= 1e3 ? `${Math.round(count / 100) / 10}k` : count;
|
|
2025
|
+
const propIndex = data[i + OFFSET_PROP];
|
|
2026
|
+
const properties = propIndex === -1 ? {} : Object.assign({}, clusterProps[propIndex]);
|
|
2027
|
+
return Object.assign(properties, {
|
|
2028
|
+
cluster: true,
|
|
2029
|
+
cluster_id: data[i + OFFSET_ID],
|
|
2030
|
+
point_count: count,
|
|
2031
|
+
point_count_abbreviated: abbrev
|
|
2032
|
+
});
|
|
2033
|
+
}
|
|
2034
|
+
function lngX(lng) {
|
|
2035
|
+
return lng / 360 + .5;
|
|
2036
|
+
}
|
|
2037
|
+
function latY(lat) {
|
|
2038
|
+
const sin = Math.sin(lat * Math.PI / 180);
|
|
2039
|
+
const y = .5 - .25 * Math.log((1 + sin) / (1 - sin)) / Math.PI;
|
|
2040
|
+
return y < 0 ? 0 : y > 1 ? 1 : y;
|
|
2041
|
+
}
|
|
2042
|
+
function xLng(x) {
|
|
2043
|
+
return (x - .5) * 360;
|
|
2044
|
+
}
|
|
2045
|
+
function yLat(y) {
|
|
2046
|
+
const y2 = (180 - y * 360) * Math.PI / 180;
|
|
2047
|
+
return 360 * Math.atan(Math.exp(y2)) / Math.PI - 90;
|
|
2048
|
+
}
|
|
2049
|
+
//#endregion
|
|
2050
|
+
//#region node_modules/.pnpm/@googlemaps+markerclusterer@2.6.2/node_modules/@googlemaps/markerclusterer/dist/index.esm.mjs
|
|
2051
|
+
/******************************************************************************
|
|
2052
|
+
Copyright (c) Microsoft Corporation.
|
|
2053
|
+
|
|
2054
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
2055
|
+
purpose with or without fee is hereby granted.
|
|
2056
|
+
|
|
2057
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
2058
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
2059
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
2060
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
2061
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
2062
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
2063
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
2064
|
+
***************************************************************************** */
|
|
2065
|
+
function __rest(s, e) {
|
|
2066
|
+
var t = {};
|
|
2067
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
2068
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") {
|
|
2069
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
2070
|
+
}
|
|
2071
|
+
return t;
|
|
2072
|
+
}
|
|
2073
|
+
/**
|
|
2074
|
+
* Copyright 2023 Google LLC
|
|
2075
|
+
*
|
|
2076
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2077
|
+
* you may not use this file except in compliance with the License.
|
|
2078
|
+
* You may obtain a copy of the License at
|
|
2079
|
+
*
|
|
2080
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2081
|
+
*
|
|
2082
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2083
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2084
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2085
|
+
* See the License for the specific language governing permissions and
|
|
2086
|
+
* limitations under the License.
|
|
2087
|
+
*/
|
|
2088
|
+
/**
|
|
2089
|
+
* util class that creates a common set of convenience functions to wrap
|
|
2090
|
+
* shared behavior of Advanced Markers and Markers.
|
|
2091
|
+
*/
|
|
2092
|
+
var MarkerUtils = class {
|
|
2093
|
+
static isAdvancedMarkerAvailable(map) {
|
|
2094
|
+
return google.maps.marker && map.getMapCapabilities().isAdvancedMarkersAvailable === true;
|
|
2095
|
+
}
|
|
2096
|
+
static isAdvancedMarker(marker) {
|
|
2097
|
+
return google.maps.marker && marker instanceof google.maps.marker.AdvancedMarkerElement;
|
|
2098
|
+
}
|
|
2099
|
+
static setMap(marker, map) {
|
|
2100
|
+
if (this.isAdvancedMarker(marker)) marker.map = map;
|
|
2101
|
+
else marker.setMap(map);
|
|
2102
|
+
}
|
|
2103
|
+
static getPosition(marker) {
|
|
2104
|
+
if (this.isAdvancedMarker(marker)) {
|
|
2105
|
+
if (marker.position) {
|
|
2106
|
+
if (marker.position instanceof google.maps.LatLng) return marker.position;
|
|
2107
|
+
if (Number.isFinite(marker.position.lat) && Number.isFinite(marker.position.lng)) return new google.maps.LatLng(marker.position.lat, marker.position.lng);
|
|
2108
|
+
}
|
|
2109
|
+
return new google.maps.LatLng(null);
|
|
2110
|
+
}
|
|
2111
|
+
return marker.getPosition();
|
|
2112
|
+
}
|
|
2113
|
+
static getVisible(marker) {
|
|
2114
|
+
if (this.isAdvancedMarker(marker))
|
|
2115
|
+
/**
|
|
2116
|
+
* Always return true for Advanced Markers because the clusterer
|
|
2117
|
+
* uses getVisible as a way to count legacy markers not as an actual
|
|
2118
|
+
* indicator of visibility for some reason. Even when markers are hidden
|
|
2119
|
+
* Marker.getVisible returns `true` and this is used to set the marker count
|
|
2120
|
+
* on the cluster. See the behavior of Cluster.count
|
|
2121
|
+
*/
|
|
2122
|
+
return true;
|
|
2123
|
+
return marker.getVisible();
|
|
2124
|
+
}
|
|
2125
|
+
};
|
|
2126
|
+
/**
|
|
2127
|
+
* Copyright 2021 Google LLC
|
|
2128
|
+
*
|
|
2129
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2130
|
+
* you may not use this file except in compliance with the License.
|
|
2131
|
+
* You may obtain a copy of the License at
|
|
2132
|
+
*
|
|
2133
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2134
|
+
*
|
|
2135
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2136
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2137
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2138
|
+
* See the License for the specific language governing permissions and
|
|
2139
|
+
* limitations under the License.
|
|
2140
|
+
*/
|
|
2141
|
+
var Cluster = class {
|
|
2142
|
+
constructor({ markers, position }) {
|
|
2143
|
+
this.markers = [];
|
|
2144
|
+
if (markers) this.markers = markers;
|
|
2145
|
+
if (position) if (position instanceof google.maps.LatLng) this._position = position;
|
|
2146
|
+
else this._position = new google.maps.LatLng(position);
|
|
2147
|
+
}
|
|
2148
|
+
get bounds() {
|
|
2149
|
+
if (this.markers.length === 0 && !this._position) return;
|
|
2150
|
+
const bounds = new google.maps.LatLngBounds(this._position, this._position);
|
|
2151
|
+
for (const marker of this.markers) bounds.extend(MarkerUtils.getPosition(marker));
|
|
2152
|
+
return bounds;
|
|
2153
|
+
}
|
|
2154
|
+
get position() {
|
|
2155
|
+
return this._position || this.bounds.getCenter();
|
|
2156
|
+
}
|
|
2157
|
+
/**
|
|
2158
|
+
* Get the count of **visible** markers.
|
|
2159
|
+
*/
|
|
2160
|
+
get count() {
|
|
2161
|
+
return this.markers.filter((m) => MarkerUtils.getVisible(m)).length;
|
|
2162
|
+
}
|
|
2163
|
+
/**
|
|
2164
|
+
* Add a marker to the cluster.
|
|
2165
|
+
*/
|
|
2166
|
+
push(marker) {
|
|
2167
|
+
this.markers.push(marker);
|
|
2168
|
+
}
|
|
2169
|
+
/**
|
|
2170
|
+
* Cleanup references and remove marker from map.
|
|
2171
|
+
*/
|
|
2172
|
+
delete() {
|
|
2173
|
+
if (this.marker) {
|
|
2174
|
+
MarkerUtils.setMap(this.marker, null);
|
|
2175
|
+
this.marker = void 0;
|
|
2176
|
+
}
|
|
2177
|
+
this.markers.length = 0;
|
|
2178
|
+
}
|
|
2179
|
+
};
|
|
2180
|
+
/**
|
|
2181
|
+
* Copyright 2021 Google LLC
|
|
2182
|
+
*
|
|
2183
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2184
|
+
* you may not use this file except in compliance with the License.
|
|
2185
|
+
* You may obtain a copy of the License at
|
|
2186
|
+
*
|
|
2187
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2188
|
+
*
|
|
2189
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2190
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2191
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2192
|
+
* See the License for the specific language governing permissions and
|
|
2193
|
+
* limitations under the License.
|
|
2194
|
+
*/
|
|
2195
|
+
/**
|
|
2196
|
+
* A typescript assertion function used in cases where typescript has to be
|
|
2197
|
+
* convinced that the object in question can not be null.
|
|
2198
|
+
*
|
|
2199
|
+
* @param value
|
|
2200
|
+
* @param message
|
|
2201
|
+
*/
|
|
2202
|
+
function assertNotNull(value, message = "assertion failed") {
|
|
2203
|
+
if (value === null || value === void 0) throw Error(message);
|
|
2204
|
+
}
|
|
2205
|
+
/**
|
|
2206
|
+
* Copyright 2021 Google LLC
|
|
2207
|
+
*
|
|
2208
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2209
|
+
* you may not use this file except in compliance with the License.
|
|
2210
|
+
* You may obtain a copy of the License at
|
|
2211
|
+
*
|
|
2212
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2213
|
+
*
|
|
2214
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2215
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2216
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2217
|
+
* See the License for the specific language governing permissions and
|
|
2218
|
+
* limitations under the License.
|
|
2219
|
+
*/
|
|
2220
|
+
/**
|
|
2221
|
+
* Returns the markers visible in a padded map viewport
|
|
2222
|
+
*
|
|
2223
|
+
* @param map
|
|
2224
|
+
* @param mapCanvasProjection
|
|
2225
|
+
* @param markers The list of marker to filter
|
|
2226
|
+
* @param viewportPaddingPixels The padding in pixel
|
|
2227
|
+
* @returns The list of markers in the padded viewport
|
|
2228
|
+
*/
|
|
2229
|
+
var filterMarkersToPaddedViewport = (map, mapCanvasProjection, markers, viewportPaddingPixels) => {
|
|
2230
|
+
const bounds = map.getBounds();
|
|
2231
|
+
assertNotNull(bounds);
|
|
2232
|
+
const extendedMapBounds = extendBoundsToPaddedViewport(bounds, mapCanvasProjection, viewportPaddingPixels);
|
|
2233
|
+
return markers.filter((marker) => extendedMapBounds.contains(MarkerUtils.getPosition(marker)));
|
|
2234
|
+
};
|
|
2235
|
+
/**
|
|
2236
|
+
* Extends bounds by a number of pixels in each direction
|
|
2237
|
+
*/
|
|
2238
|
+
var extendBoundsToPaddedViewport = (bounds, projection, numPixels) => {
|
|
2239
|
+
const { northEast, southWest } = latLngBoundsToPixelBounds(bounds, projection);
|
|
2240
|
+
return pixelBoundsToLatLngBounds(extendPixelBounds({
|
|
2241
|
+
northEast,
|
|
2242
|
+
southWest
|
|
2243
|
+
}, numPixels), projection);
|
|
2244
|
+
};
|
|
2245
|
+
/**
|
|
2246
|
+
* Gets the extended bounds as a bbox [westLng, southLat, eastLng, northLat]
|
|
2247
|
+
*/
|
|
2248
|
+
var getPaddedViewport = (bounds, projection, pixels) => {
|
|
2249
|
+
const extended = extendBoundsToPaddedViewport(bounds, projection, pixels);
|
|
2250
|
+
const ne = extended.getNorthEast();
|
|
2251
|
+
const sw = extended.getSouthWest();
|
|
2252
|
+
return [
|
|
2253
|
+
sw.lng(),
|
|
2254
|
+
sw.lat(),
|
|
2255
|
+
ne.lng(),
|
|
2256
|
+
ne.lat()
|
|
2257
|
+
];
|
|
2258
|
+
};
|
|
2259
|
+
/**
|
|
2260
|
+
* Converts a LatLng bound to pixels.
|
|
2261
|
+
*
|
|
2262
|
+
* @hidden
|
|
2263
|
+
*/
|
|
2264
|
+
var latLngBoundsToPixelBounds = (bounds, projection) => {
|
|
2265
|
+
const northEast = projection.fromLatLngToDivPixel(bounds.getNorthEast());
|
|
2266
|
+
const southWest = projection.fromLatLngToDivPixel(bounds.getSouthWest());
|
|
2267
|
+
assertNotNull(northEast);
|
|
2268
|
+
assertNotNull(southWest);
|
|
2269
|
+
return {
|
|
2270
|
+
northEast,
|
|
2271
|
+
southWest
|
|
2272
|
+
};
|
|
2273
|
+
};
|
|
2274
|
+
/**
|
|
2275
|
+
* Extends a pixel bounds by numPixels in all directions.
|
|
2276
|
+
*
|
|
2277
|
+
* @hidden
|
|
2278
|
+
*/
|
|
2279
|
+
var extendPixelBounds = ({ northEast, southWest }, numPixels) => {
|
|
2280
|
+
northEast.x += numPixels;
|
|
2281
|
+
northEast.y -= numPixels;
|
|
2282
|
+
southWest.x -= numPixels;
|
|
2283
|
+
southWest.y += numPixels;
|
|
2284
|
+
return {
|
|
2285
|
+
northEast,
|
|
2286
|
+
southWest
|
|
2287
|
+
};
|
|
2288
|
+
};
|
|
2289
|
+
/**
|
|
2290
|
+
* @hidden
|
|
2291
|
+
*/
|
|
2292
|
+
var pixelBoundsToLatLngBounds = ({ northEast, southWest }, projection) => {
|
|
2293
|
+
const sw = projection.fromDivPixelToLatLng(southWest);
|
|
2294
|
+
const ne = projection.fromDivPixelToLatLng(northEast);
|
|
2295
|
+
return new google.maps.LatLngBounds(sw, ne);
|
|
2296
|
+
};
|
|
2297
|
+
/**
|
|
2298
|
+
* Copyright 2021 Google LLC
|
|
2299
|
+
*
|
|
2300
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2301
|
+
* you may not use this file except in compliance with the License.
|
|
2302
|
+
* You may obtain a copy of the License at
|
|
2303
|
+
*
|
|
2304
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2305
|
+
*
|
|
2306
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2307
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2308
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2309
|
+
* See the License for the specific language governing permissions and
|
|
2310
|
+
* limitations under the License.
|
|
2311
|
+
*/
|
|
2312
|
+
/**
|
|
2313
|
+
* @hidden
|
|
2314
|
+
*/
|
|
2315
|
+
var AbstractAlgorithm = class {
|
|
2316
|
+
constructor({ maxZoom = 16 }) {
|
|
2317
|
+
this.maxZoom = maxZoom;
|
|
2318
|
+
}
|
|
2319
|
+
/**
|
|
2320
|
+
* Helper function to bypass clustering based upon some map state such as
|
|
2321
|
+
* zoom, number of markers, etc.
|
|
2322
|
+
*
|
|
2323
|
+
* ```typescript
|
|
2324
|
+
* cluster({markers, map}: AlgorithmInput): Cluster[] {
|
|
2325
|
+
* if (shouldBypassClustering(map)) {
|
|
2326
|
+
* return this.noop({markers})
|
|
2327
|
+
* }
|
|
2328
|
+
* }
|
|
2329
|
+
* ```
|
|
2330
|
+
*/
|
|
2331
|
+
noop({ markers }) {
|
|
2332
|
+
return noop(markers);
|
|
2333
|
+
}
|
|
2334
|
+
};
|
|
2335
|
+
/**
|
|
2336
|
+
* Abstract viewport algorithm proves a class to filter markers by a padded
|
|
2337
|
+
* viewport. This is a common optimization.
|
|
2338
|
+
*
|
|
2339
|
+
* @hidden
|
|
2340
|
+
*/
|
|
2341
|
+
var AbstractViewportAlgorithm = class extends AbstractAlgorithm {
|
|
2342
|
+
constructor(_a) {
|
|
2343
|
+
var { viewportPadding = 60 } = _a, options = __rest(_a, ["viewportPadding"]);
|
|
2344
|
+
super(options);
|
|
2345
|
+
this.viewportPadding = 60;
|
|
2346
|
+
this.viewportPadding = viewportPadding;
|
|
2347
|
+
}
|
|
2348
|
+
calculate({ markers, map, mapCanvasProjection }) {
|
|
2349
|
+
const zoom = map.getZoom();
|
|
2350
|
+
assertNotNull(zoom);
|
|
2351
|
+
if (zoom >= this.maxZoom) return {
|
|
2352
|
+
clusters: this.noop({ markers }),
|
|
2353
|
+
changed: false
|
|
2354
|
+
};
|
|
2355
|
+
return { clusters: this.cluster({
|
|
2356
|
+
markers: filterMarkersToPaddedViewport(map, mapCanvasProjection, markers, this.viewportPadding),
|
|
2357
|
+
map,
|
|
2358
|
+
mapCanvasProjection
|
|
2359
|
+
}) };
|
|
2360
|
+
}
|
|
2361
|
+
};
|
|
2362
|
+
/**
|
|
2363
|
+
* @hidden
|
|
2364
|
+
*/
|
|
2365
|
+
var noop = (markers) => {
|
|
2366
|
+
return markers.map((marker) => new Cluster({
|
|
2367
|
+
position: MarkerUtils.getPosition(marker),
|
|
2368
|
+
markers: [marker]
|
|
2369
|
+
}));
|
|
2370
|
+
};
|
|
2371
|
+
/**
|
|
2372
|
+
* Copyright 2021 Google LLC
|
|
2373
|
+
*
|
|
2374
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2375
|
+
* you may not use this file except in compliance with the License.
|
|
2376
|
+
* You may obtain a copy of the License at
|
|
2377
|
+
*
|
|
2378
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2379
|
+
*
|
|
2380
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2381
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2382
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2383
|
+
* See the License for the specific language governing permissions and
|
|
2384
|
+
* limitations under the License.
|
|
2385
|
+
*/
|
|
2386
|
+
/**
|
|
2387
|
+
* A very fast JavaScript algorithm for geospatial point clustering using KD trees.
|
|
2388
|
+
*
|
|
2389
|
+
* @see https://www.npmjs.com/package/supercluster for more information on options.
|
|
2390
|
+
*/
|
|
2391
|
+
var SuperClusterAlgorithm = class extends AbstractAlgorithm {
|
|
2392
|
+
constructor(_a) {
|
|
2393
|
+
var { maxZoom, radius = 60 } = _a, options = __rest(_a, ["maxZoom", "radius"]);
|
|
2394
|
+
super({ maxZoom });
|
|
2395
|
+
this.markers = [];
|
|
2396
|
+
this.clusters = [];
|
|
2397
|
+
this.state = { zoom: -1 };
|
|
2398
|
+
this.superCluster = new Supercluster(Object.assign({
|
|
2399
|
+
maxZoom: this.maxZoom,
|
|
2400
|
+
radius
|
|
2401
|
+
}, options));
|
|
2402
|
+
}
|
|
2403
|
+
calculate(input) {
|
|
2404
|
+
let changed = false;
|
|
2405
|
+
let zoom = input.map.getZoom();
|
|
2406
|
+
assertNotNull(zoom);
|
|
2407
|
+
zoom = Math.round(zoom);
|
|
2408
|
+
const state = { zoom };
|
|
2409
|
+
if (!deepEqual(input.markers, this.markers)) {
|
|
2410
|
+
changed = true;
|
|
2411
|
+
this.markers = [...input.markers];
|
|
2412
|
+
const points = this.markers.map((marker) => {
|
|
2413
|
+
const position = MarkerUtils.getPosition(marker);
|
|
2414
|
+
return {
|
|
2415
|
+
type: "Feature",
|
|
2416
|
+
geometry: {
|
|
2417
|
+
type: "Point",
|
|
2418
|
+
coordinates: [position.lng(), position.lat()]
|
|
2419
|
+
},
|
|
2420
|
+
properties: { marker }
|
|
2421
|
+
};
|
|
2422
|
+
});
|
|
2423
|
+
this.superCluster.load(points);
|
|
2424
|
+
}
|
|
2425
|
+
if (!changed) {
|
|
2426
|
+
if (this.state.zoom <= this.maxZoom || state.zoom <= this.maxZoom) changed = !deepEqual(this.state, state);
|
|
2427
|
+
}
|
|
2428
|
+
this.state = state;
|
|
2429
|
+
if (input.markers.length === 0) {
|
|
2430
|
+
this.clusters = [];
|
|
2431
|
+
return {
|
|
2432
|
+
clusters: this.clusters,
|
|
2433
|
+
changed
|
|
2434
|
+
};
|
|
2435
|
+
}
|
|
2436
|
+
if (changed) this.clusters = this.cluster(input);
|
|
2437
|
+
return {
|
|
2438
|
+
clusters: this.clusters,
|
|
2439
|
+
changed
|
|
2440
|
+
};
|
|
2441
|
+
}
|
|
2442
|
+
cluster({ map }) {
|
|
2443
|
+
const zoom = map.getZoom();
|
|
2444
|
+
assertNotNull(zoom);
|
|
2445
|
+
return this.superCluster.getClusters([
|
|
2446
|
+
-180,
|
|
2447
|
+
-90,
|
|
2448
|
+
180,
|
|
2449
|
+
90
|
|
2450
|
+
], Math.round(zoom)).map((feature) => this.transformCluster(feature));
|
|
2451
|
+
}
|
|
2452
|
+
transformCluster({ geometry: { coordinates: [lng, lat] }, properties }) {
|
|
2453
|
+
if (properties.cluster) return new Cluster({
|
|
2454
|
+
markers: this.superCluster.getLeaves(properties.cluster_id, Infinity).map((leaf) => leaf.properties.marker),
|
|
2455
|
+
position: {
|
|
2456
|
+
lat,
|
|
2457
|
+
lng
|
|
2458
|
+
}
|
|
2459
|
+
});
|
|
2460
|
+
const marker = properties.marker;
|
|
2461
|
+
return new Cluster({
|
|
2462
|
+
markers: [marker],
|
|
2463
|
+
position: MarkerUtils.getPosition(marker)
|
|
2464
|
+
});
|
|
2465
|
+
}
|
|
2466
|
+
};
|
|
2467
|
+
/**
|
|
2468
|
+
* Copyright 2021 Google LLC
|
|
2469
|
+
*
|
|
2470
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2471
|
+
* you may not use this file except in compliance with the License.
|
|
2472
|
+
* You may obtain a copy of the License at
|
|
2473
|
+
*
|
|
2474
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2475
|
+
*
|
|
2476
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2477
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2478
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2479
|
+
* See the License for the specific language governing permissions and
|
|
2480
|
+
* limitations under the License.
|
|
2481
|
+
*/
|
|
2482
|
+
/**
|
|
2483
|
+
* A very fast JavaScript algorithm for geospatial point clustering using KD trees.
|
|
2484
|
+
*
|
|
2485
|
+
* @see https://www.npmjs.com/package/supercluster for more information on options.
|
|
2486
|
+
*/
|
|
2487
|
+
var SuperClusterViewportAlgorithm = class extends AbstractViewportAlgorithm {
|
|
2488
|
+
constructor(_a) {
|
|
2489
|
+
var { maxZoom, radius = 60, viewportPadding = 60 } = _a, options = __rest(_a, [
|
|
2490
|
+
"maxZoom",
|
|
2491
|
+
"radius",
|
|
2492
|
+
"viewportPadding"
|
|
2493
|
+
]);
|
|
2494
|
+
super({
|
|
2495
|
+
maxZoom,
|
|
2496
|
+
viewportPadding
|
|
2497
|
+
});
|
|
2498
|
+
this.markers = [];
|
|
2499
|
+
this.clusters = [];
|
|
2500
|
+
this.superCluster = new Supercluster(Object.assign({
|
|
2501
|
+
maxZoom: this.maxZoom,
|
|
2502
|
+
radius
|
|
2503
|
+
}, options));
|
|
2504
|
+
this.state = {
|
|
2505
|
+
zoom: -1,
|
|
2506
|
+
view: [
|
|
2507
|
+
0,
|
|
2508
|
+
0,
|
|
2509
|
+
0,
|
|
2510
|
+
0
|
|
2511
|
+
]
|
|
2512
|
+
};
|
|
2513
|
+
}
|
|
2514
|
+
calculate(input) {
|
|
2515
|
+
const state = this.getViewportState(input);
|
|
2516
|
+
let changed = !deepEqual(this.state, state);
|
|
2517
|
+
if (!deepEqual(input.markers, this.markers)) {
|
|
2518
|
+
changed = true;
|
|
2519
|
+
this.markers = [...input.markers];
|
|
2520
|
+
const points = this.markers.map((marker) => {
|
|
2521
|
+
const position = MarkerUtils.getPosition(marker);
|
|
2522
|
+
return {
|
|
2523
|
+
type: "Feature",
|
|
2524
|
+
geometry: {
|
|
2525
|
+
type: "Point",
|
|
2526
|
+
coordinates: [position.lng(), position.lat()]
|
|
2527
|
+
},
|
|
2528
|
+
properties: { marker }
|
|
2529
|
+
};
|
|
2530
|
+
});
|
|
2531
|
+
this.superCluster.load(points);
|
|
2532
|
+
}
|
|
2533
|
+
if (changed) {
|
|
2534
|
+
this.clusters = this.cluster(input);
|
|
2535
|
+
this.state = state;
|
|
2536
|
+
}
|
|
2537
|
+
return {
|
|
2538
|
+
clusters: this.clusters,
|
|
2539
|
+
changed
|
|
2540
|
+
};
|
|
2541
|
+
}
|
|
2542
|
+
cluster(input) {
|
|
2543
|
+
const state = this.getViewportState(input);
|
|
2544
|
+
return this.superCluster.getClusters(state.view, state.zoom).map((feature) => this.transformCluster(feature));
|
|
2545
|
+
}
|
|
2546
|
+
transformCluster({ geometry: { coordinates: [lng, lat] }, properties }) {
|
|
2547
|
+
if (properties.cluster) return new Cluster({
|
|
2548
|
+
markers: this.superCluster.getLeaves(properties.cluster_id, Infinity).map((leaf) => leaf.properties.marker),
|
|
2549
|
+
position: {
|
|
2550
|
+
lat,
|
|
2551
|
+
lng
|
|
2552
|
+
}
|
|
2553
|
+
});
|
|
2554
|
+
const marker = properties.marker;
|
|
2555
|
+
return new Cluster({
|
|
2556
|
+
markers: [marker],
|
|
2557
|
+
position: MarkerUtils.getPosition(marker)
|
|
2558
|
+
});
|
|
2559
|
+
}
|
|
2560
|
+
getViewportState(input) {
|
|
2561
|
+
const mapZoom = input.map.getZoom();
|
|
2562
|
+
const mapBounds = input.map.getBounds();
|
|
2563
|
+
assertNotNull(mapZoom);
|
|
2564
|
+
assertNotNull(mapBounds);
|
|
2565
|
+
return {
|
|
2566
|
+
zoom: Math.round(mapZoom),
|
|
2567
|
+
view: getPaddedViewport(mapBounds, input.mapCanvasProjection, this.viewportPadding)
|
|
2568
|
+
};
|
|
2569
|
+
}
|
|
2570
|
+
};
|
|
2571
|
+
/**
|
|
2572
|
+
* Copyright 2021 Google LLC
|
|
2573
|
+
*
|
|
2574
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2575
|
+
* you may not use this file except in compliance with the License.
|
|
2576
|
+
* You may obtain a copy of the License at
|
|
2577
|
+
*
|
|
2578
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2579
|
+
*
|
|
2580
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2581
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2582
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2583
|
+
* See the License for the specific language governing permissions and
|
|
2584
|
+
* limitations under the License.
|
|
2585
|
+
*/
|
|
2586
|
+
/**
|
|
2587
|
+
* Provides statistics on all clusters in the current render cycle for use in {@link Renderer.render}.
|
|
2588
|
+
*/
|
|
2589
|
+
var ClusterStats = class {
|
|
2590
|
+
constructor(markers, clusters) {
|
|
2591
|
+
this.markers = { sum: markers.length };
|
|
2592
|
+
const clusterMarkerCounts = clusters.map((a) => a.count);
|
|
2593
|
+
const clusterMarkerSum = clusterMarkerCounts.reduce((a, b) => a + b, 0);
|
|
2594
|
+
this.clusters = {
|
|
2595
|
+
count: clusters.length,
|
|
2596
|
+
markers: {
|
|
2597
|
+
mean: clusterMarkerSum / clusters.length,
|
|
2598
|
+
sum: clusterMarkerSum,
|
|
2599
|
+
min: Math.min(...clusterMarkerCounts),
|
|
2600
|
+
max: Math.max(...clusterMarkerCounts)
|
|
2601
|
+
}
|
|
2602
|
+
};
|
|
2603
|
+
}
|
|
2604
|
+
};
|
|
2605
|
+
var DefaultRenderer = class {
|
|
2606
|
+
/**
|
|
2607
|
+
* The default render function for the library used by {@link MarkerClusterer}.
|
|
2608
|
+
*
|
|
2609
|
+
* Currently set to use the following:
|
|
2610
|
+
*
|
|
2611
|
+
* ```typescript
|
|
2612
|
+
* // change color if this cluster has more markers than the mean cluster
|
|
2613
|
+
* const color =
|
|
2614
|
+
* count > Math.max(10, stats.clusters.markers.mean)
|
|
2615
|
+
* ? "#ff0000"
|
|
2616
|
+
* : "#0000ff";
|
|
2617
|
+
*
|
|
2618
|
+
* // create svg url with fill color
|
|
2619
|
+
* const svg = window.btoa(`
|
|
2620
|
+
* <svg fill="${color}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 240">
|
|
2621
|
+
* <circle cx="120" cy="120" opacity=".6" r="70" />
|
|
2622
|
+
* <circle cx="120" cy="120" opacity=".3" r="90" />
|
|
2623
|
+
* <circle cx="120" cy="120" opacity=".2" r="110" />
|
|
2624
|
+
* <circle cx="120" cy="120" opacity=".1" r="130" />
|
|
2625
|
+
* </svg>`);
|
|
2626
|
+
*
|
|
2627
|
+
* // create marker using svg icon
|
|
2628
|
+
* return new google.maps.Marker({
|
|
2629
|
+
* position,
|
|
2630
|
+
* icon: {
|
|
2631
|
+
* url: `data:image/svg+xml;base64,${svg}`,
|
|
2632
|
+
* scaledSize: new google.maps.Size(45, 45),
|
|
2633
|
+
* },
|
|
2634
|
+
* label: {
|
|
2635
|
+
* text: String(count),
|
|
2636
|
+
* color: "rgba(255,255,255,0.9)",
|
|
2637
|
+
* fontSize: "12px",
|
|
2638
|
+
* },
|
|
2639
|
+
* // adjust zIndex to be above other markers
|
|
2640
|
+
* zIndex: 1000 + count,
|
|
2641
|
+
* });
|
|
2642
|
+
* ```
|
|
2643
|
+
*/
|
|
2644
|
+
render({ count, position }, stats, map) {
|
|
2645
|
+
const svg = `<svg fill="${count > Math.max(10, stats.clusters.markers.mean) ? "#ff0000" : "#0000ff"}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 240" width="50" height="50">
|
|
3
2646
|
<circle cx="120" cy="120" opacity=".6" r="70" />
|
|
4
2647
|
<circle cx="120" cy="120" opacity=".3" r="90" />
|
|
5
2648
|
<circle cx="120" cy="120" opacity=".2" r="110" />
|
|
6
|
-
<text x="50%" y="50%" style="fill:#fff" text-anchor="middle" font-size="50" dominant-baseline="middle" font-family="roboto,arial,sans-serif">${
|
|
7
|
-
</svg
|
|
2649
|
+
<text x="50%" y="50%" style="fill:#fff" text-anchor="middle" font-size="50" dominant-baseline="middle" font-family="roboto,arial,sans-serif">${count}</text>
|
|
2650
|
+
</svg>`;
|
|
2651
|
+
const title = `Cluster of ${count} markers`, zIndex = Number(google.maps.Marker.MAX_ZINDEX) + count;
|
|
2652
|
+
if (MarkerUtils.isAdvancedMarkerAvailable(map)) {
|
|
2653
|
+
const svgEl = new DOMParser().parseFromString(svg, "image/svg+xml").documentElement;
|
|
2654
|
+
svgEl.setAttribute("transform", "translate(0 25)");
|
|
2655
|
+
const clusterOptions = {
|
|
2656
|
+
map,
|
|
2657
|
+
position,
|
|
2658
|
+
zIndex,
|
|
2659
|
+
title,
|
|
2660
|
+
content: svgEl
|
|
2661
|
+
};
|
|
2662
|
+
return new google.maps.marker.AdvancedMarkerElement(clusterOptions);
|
|
2663
|
+
}
|
|
2664
|
+
const clusterOptions = {
|
|
2665
|
+
position,
|
|
2666
|
+
zIndex,
|
|
2667
|
+
title,
|
|
2668
|
+
icon: {
|
|
2669
|
+
url: `data:image/svg+xml;base64,${btoa(svg)}`,
|
|
2670
|
+
anchor: new google.maps.Point(25, 25)
|
|
2671
|
+
}
|
|
2672
|
+
};
|
|
2673
|
+
return new google.maps.Marker(clusterOptions);
|
|
2674
|
+
}
|
|
2675
|
+
};
|
|
2676
|
+
/**
|
|
2677
|
+
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
2678
|
+
*
|
|
2679
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2680
|
+
* you may not use this file except in compliance with the License.
|
|
2681
|
+
* You may obtain a copy of the License at
|
|
2682
|
+
*
|
|
2683
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2684
|
+
*
|
|
2685
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2686
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2687
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2688
|
+
* See the License for the specific language governing permissions and
|
|
2689
|
+
* limitations under the License.
|
|
2690
|
+
*/
|
|
2691
|
+
/**
|
|
2692
|
+
* Extends an object's prototype by another's.
|
|
2693
|
+
*
|
|
2694
|
+
* @param type1 The Type to be extended.
|
|
2695
|
+
* @param type2 The Type to extend with.
|
|
2696
|
+
* @ignore
|
|
2697
|
+
*/
|
|
2698
|
+
function extend(type1, type2) {
|
|
2699
|
+
/* istanbul ignore next */
|
|
2700
|
+
for (let property in type2.prototype) type1.prototype[property] = type2.prototype[property];
|
|
2701
|
+
}
|
|
2702
|
+
/**
|
|
2703
|
+
* @ignore
|
|
2704
|
+
*/
|
|
2705
|
+
var OverlayViewSafe = class OverlayViewSafe {
|
|
2706
|
+
constructor() {
|
|
2707
|
+
extend(OverlayViewSafe, google.maps.OverlayView);
|
|
2708
|
+
}
|
|
2709
|
+
};
|
|
2710
|
+
/**
|
|
2711
|
+
* Copyright 2021 Google LLC
|
|
2712
|
+
*
|
|
2713
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2714
|
+
* you may not use this file except in compliance with the License.
|
|
2715
|
+
* You may obtain a copy of the License at
|
|
2716
|
+
*
|
|
2717
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2718
|
+
*
|
|
2719
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2720
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2721
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2722
|
+
* See the License for the specific language governing permissions and
|
|
2723
|
+
* limitations under the License.
|
|
2724
|
+
*/
|
|
2725
|
+
var MarkerClustererEvents;
|
|
2726
|
+
(function(MarkerClustererEvents) {
|
|
2727
|
+
MarkerClustererEvents["CLUSTERING_BEGIN"] = "clusteringbegin";
|
|
2728
|
+
MarkerClustererEvents["CLUSTERING_END"] = "clusteringend";
|
|
2729
|
+
MarkerClustererEvents["CLUSTER_CLICK"] = "click";
|
|
2730
|
+
MarkerClustererEvents["GMP_CLICK"] = "gmp-click";
|
|
2731
|
+
})(MarkerClustererEvents || (MarkerClustererEvents = {}));
|
|
2732
|
+
var defaultOnClusterClickHandler = (_, cluster, map) => {
|
|
2733
|
+
if (cluster.bounds) map.fitBounds(cluster.bounds);
|
|
2734
|
+
};
|
|
2735
|
+
/**
|
|
2736
|
+
* MarkerClusterer creates and manages per-zoom-level clusters for large amounts
|
|
2737
|
+
* of markers. See {@link MarkerClustererOptions} for more details.
|
|
2738
|
+
*
|
|
2739
|
+
*/
|
|
2740
|
+
var MarkerClusterer = class extends OverlayViewSafe {
|
|
2741
|
+
constructor({ map, markers = [], algorithmOptions = {}, algorithm = new SuperClusterAlgorithm(algorithmOptions), renderer = new DefaultRenderer(), onClusterClick = defaultOnClusterClickHandler }) {
|
|
2742
|
+
super();
|
|
2743
|
+
/** @see {@link MarkerClustererOptions.map} */
|
|
2744
|
+
this.map = null;
|
|
2745
|
+
this.idleListener = null;
|
|
2746
|
+
this.markers = [...markers];
|
|
2747
|
+
this.clusters = [];
|
|
2748
|
+
this.algorithm = algorithm;
|
|
2749
|
+
this.renderer = renderer;
|
|
2750
|
+
this.onClusterClick = onClusterClick;
|
|
2751
|
+
if (map) this.setMap(map);
|
|
2752
|
+
}
|
|
2753
|
+
addMarker(marker, noDraw) {
|
|
2754
|
+
if (this.markers.includes(marker)) return;
|
|
2755
|
+
this.markers.push(marker);
|
|
2756
|
+
if (!noDraw) this.render();
|
|
2757
|
+
}
|
|
2758
|
+
addMarkers(markers, noDraw) {
|
|
2759
|
+
markers.forEach((marker) => {
|
|
2760
|
+
this.addMarker(marker, true);
|
|
2761
|
+
});
|
|
2762
|
+
if (!noDraw) this.render();
|
|
2763
|
+
}
|
|
2764
|
+
removeMarker(marker, noDraw) {
|
|
2765
|
+
const index = this.markers.indexOf(marker);
|
|
2766
|
+
if (index === -1) return false;
|
|
2767
|
+
MarkerUtils.setMap(marker, null);
|
|
2768
|
+
this.markers.splice(index, 1);
|
|
2769
|
+
if (!noDraw) this.render();
|
|
2770
|
+
return true;
|
|
2771
|
+
}
|
|
2772
|
+
removeMarkers(markers, noDraw) {
|
|
2773
|
+
let removed = false;
|
|
2774
|
+
markers.forEach((marker) => {
|
|
2775
|
+
removed = this.removeMarker(marker, true) || removed;
|
|
2776
|
+
});
|
|
2777
|
+
if (removed && !noDraw) this.render();
|
|
2778
|
+
return removed;
|
|
2779
|
+
}
|
|
2780
|
+
clearMarkers(noDraw) {
|
|
2781
|
+
this.markers.length = 0;
|
|
2782
|
+
if (!noDraw) this.render();
|
|
2783
|
+
}
|
|
2784
|
+
/**
|
|
2785
|
+
* Recalculates and draws all the marker clusters.
|
|
2786
|
+
*/
|
|
2787
|
+
render() {
|
|
2788
|
+
const map = this.getMap();
|
|
2789
|
+
if (map instanceof google.maps.Map && map.getProjection()) {
|
|
2790
|
+
google.maps.event.trigger(this, MarkerClustererEvents.CLUSTERING_BEGIN, this);
|
|
2791
|
+
const { clusters, changed } = this.algorithm.calculate({
|
|
2792
|
+
markers: this.markers,
|
|
2793
|
+
map,
|
|
2794
|
+
mapCanvasProjection: this.getProjection()
|
|
2795
|
+
});
|
|
2796
|
+
if (changed || changed == void 0) {
|
|
2797
|
+
const singleMarker = /* @__PURE__ */ new Set();
|
|
2798
|
+
for (const cluster of clusters) if (cluster.markers.length == 1) singleMarker.add(cluster.markers[0]);
|
|
2799
|
+
const groupMarkers = [];
|
|
2800
|
+
for (const cluster of this.clusters) {
|
|
2801
|
+
if (cluster.marker == null) continue;
|
|
2802
|
+
if (cluster.markers.length == 1) {
|
|
2803
|
+
if (!singleMarker.has(cluster.marker)) MarkerUtils.setMap(cluster.marker, null);
|
|
2804
|
+
} else groupMarkers.push(cluster.marker);
|
|
2805
|
+
}
|
|
2806
|
+
this.clusters = clusters;
|
|
2807
|
+
this.renderClusters();
|
|
2808
|
+
requestAnimationFrame(() => groupMarkers.forEach((marker) => MarkerUtils.setMap(marker, null)));
|
|
2809
|
+
}
|
|
2810
|
+
google.maps.event.trigger(this, MarkerClustererEvents.CLUSTERING_END, this);
|
|
2811
|
+
}
|
|
2812
|
+
}
|
|
2813
|
+
onAdd() {
|
|
2814
|
+
const map = this.getMap();
|
|
2815
|
+
assertNotNull(map);
|
|
2816
|
+
this.idleListener = map.addListener("idle", this.render.bind(this));
|
|
2817
|
+
this.render();
|
|
2818
|
+
}
|
|
2819
|
+
onRemove() {
|
|
2820
|
+
if (this.idleListener) google.maps.event.removeListener(this.idleListener);
|
|
2821
|
+
this.reset();
|
|
2822
|
+
}
|
|
2823
|
+
reset() {
|
|
2824
|
+
this.markers.forEach((marker) => MarkerUtils.setMap(marker, null));
|
|
2825
|
+
this.clusters.forEach((cluster) => cluster.delete());
|
|
2826
|
+
this.clusters = [];
|
|
2827
|
+
}
|
|
2828
|
+
renderClusters() {
|
|
2829
|
+
const stats = new ClusterStats(this.markers, this.clusters);
|
|
2830
|
+
const map = this.getMap();
|
|
2831
|
+
this.clusters.forEach((cluster) => {
|
|
2832
|
+
if (cluster.markers.length === 1) cluster.marker = cluster.markers[0];
|
|
2833
|
+
else {
|
|
2834
|
+
cluster.marker = this.renderer.render(cluster, stats, map);
|
|
2835
|
+
cluster.markers.forEach((marker) => MarkerUtils.setMap(marker, null));
|
|
2836
|
+
if (this.onClusterClick) {
|
|
2837
|
+
const markerClickEventName = MarkerUtils.isAdvancedMarker(cluster.marker) ? MarkerClustererEvents.GMP_CLICK : MarkerClustererEvents.CLUSTER_CLICK;
|
|
2838
|
+
cluster.marker.addListener(
|
|
2839
|
+
markerClickEventName,
|
|
2840
|
+
/* istanbul ignore next */
|
|
2841
|
+
(event) => {
|
|
2842
|
+
google.maps.event.trigger(this, MarkerClustererEvents.CLUSTER_CLICK, cluster);
|
|
2843
|
+
this.onClusterClick(event, cluster, map);
|
|
2844
|
+
}
|
|
2845
|
+
);
|
|
2846
|
+
}
|
|
2847
|
+
}
|
|
2848
|
+
MarkerUtils.setMap(cluster.marker, map);
|
|
2849
|
+
});
|
|
2850
|
+
}
|
|
2851
|
+
};
|
|
2852
|
+
//#endregion
|
|
2853
|
+
//#region node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObject.js
|
|
2854
|
+
/**
|
|
2855
|
+
* Checks if `value` is the
|
|
2856
|
+
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
|
2857
|
+
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
|
2858
|
+
*
|
|
2859
|
+
* @static
|
|
2860
|
+
* @memberOf _
|
|
2861
|
+
* @since 0.1.0
|
|
2862
|
+
* @category Lang
|
|
2863
|
+
* @param {*} value The value to check.
|
|
2864
|
+
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
|
2865
|
+
* @example
|
|
2866
|
+
*
|
|
2867
|
+
* _.isObject({});
|
|
2868
|
+
* // => true
|
|
2869
|
+
*
|
|
2870
|
+
* _.isObject([1, 2, 3]);
|
|
2871
|
+
* // => true
|
|
2872
|
+
*
|
|
2873
|
+
* _.isObject(_.noop);
|
|
2874
|
+
* // => true
|
|
2875
|
+
*
|
|
2876
|
+
* _.isObject(null);
|
|
2877
|
+
* // => false
|
|
2878
|
+
*/
|
|
2879
|
+
function isObject(value) {
|
|
2880
|
+
var type = typeof value;
|
|
2881
|
+
return value != null && (type == "object" || type == "function");
|
|
2882
|
+
}
|
|
2883
|
+
//#endregion
|
|
2884
|
+
//#region node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_freeGlobal.js
|
|
2885
|
+
/** Detect free variable `global` from Node.js. */
|
|
2886
|
+
var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
|
|
2887
|
+
//#endregion
|
|
2888
|
+
//#region node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_root.js
|
|
2889
|
+
/** Detect free variable `self`. */
|
|
2890
|
+
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
|
2891
|
+
/** Used as a reference to the global object. */
|
|
2892
|
+
var root = freeGlobal || freeSelf || Function("return this")();
|
|
2893
|
+
//#endregion
|
|
2894
|
+
//#region node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/now.js
|
|
2895
|
+
/**
|
|
2896
|
+
* Gets the timestamp of the number of milliseconds that have elapsed since
|
|
2897
|
+
* the Unix epoch (1 January 1970 00:00:00 UTC).
|
|
2898
|
+
*
|
|
2899
|
+
* @static
|
|
2900
|
+
* @memberOf _
|
|
2901
|
+
* @since 2.4.0
|
|
2902
|
+
* @category Date
|
|
2903
|
+
* @returns {number} Returns the timestamp.
|
|
2904
|
+
* @example
|
|
2905
|
+
*
|
|
2906
|
+
* _.defer(function(stamp) {
|
|
2907
|
+
* console.log(_.now() - stamp);
|
|
2908
|
+
* }, _.now());
|
|
2909
|
+
* // => Logs the number of milliseconds it took for the deferred invocation.
|
|
2910
|
+
*/
|
|
2911
|
+
var now = function() {
|
|
2912
|
+
return root.Date.now();
|
|
2913
|
+
};
|
|
2914
|
+
//#endregion
|
|
2915
|
+
//#region node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_trimmedEndIndex.js
|
|
2916
|
+
/** Used to match a single whitespace character. */
|
|
2917
|
+
var reWhitespace = /\s/;
|
|
2918
|
+
/**
|
|
2919
|
+
* Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
|
|
2920
|
+
* character of `string`.
|
|
2921
|
+
*
|
|
2922
|
+
* @private
|
|
2923
|
+
* @param {string} string The string to inspect.
|
|
2924
|
+
* @returns {number} Returns the index of the last non-whitespace character.
|
|
2925
|
+
*/
|
|
2926
|
+
function trimmedEndIndex(string) {
|
|
2927
|
+
var index = string.length;
|
|
2928
|
+
while (index-- && reWhitespace.test(string.charAt(index)));
|
|
2929
|
+
return index;
|
|
2930
|
+
}
|
|
2931
|
+
//#endregion
|
|
2932
|
+
//#region node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseTrim.js
|
|
2933
|
+
/** Used to match leading whitespace. */
|
|
2934
|
+
var reTrimStart = /^\s+/;
|
|
2935
|
+
/**
|
|
2936
|
+
* The base implementation of `_.trim`.
|
|
2937
|
+
*
|
|
2938
|
+
* @private
|
|
2939
|
+
* @param {string} string The string to trim.
|
|
2940
|
+
* @returns {string} Returns the trimmed string.
|
|
2941
|
+
*/
|
|
2942
|
+
function baseTrim(string) {
|
|
2943
|
+
return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string;
|
|
2944
|
+
}
|
|
2945
|
+
//#endregion
|
|
2946
|
+
//#region node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Symbol.js
|
|
2947
|
+
/** Built-in value references. */
|
|
2948
|
+
var Symbol$1 = root.Symbol;
|
|
2949
|
+
//#endregion
|
|
2950
|
+
//#region node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getRawTag.js
|
|
2951
|
+
/** Used for built-in method references. */
|
|
2952
|
+
var objectProto = Object.prototype;
|
|
2953
|
+
/** Used to check objects for own properties. */
|
|
2954
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
2955
|
+
/**
|
|
2956
|
+
* Used to resolve the
|
|
2957
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
2958
|
+
* of values.
|
|
2959
|
+
*/
|
|
2960
|
+
var nativeObjectToString$1 = objectProto.toString;
|
|
2961
|
+
/** Built-in value references. */
|
|
2962
|
+
var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : void 0;
|
|
2963
|
+
/**
|
|
2964
|
+
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
|
|
2965
|
+
*
|
|
2966
|
+
* @private
|
|
2967
|
+
* @param {*} value The value to query.
|
|
2968
|
+
* @returns {string} Returns the raw `toStringTag`.
|
|
2969
|
+
*/
|
|
2970
|
+
function getRawTag(value) {
|
|
2971
|
+
var isOwn = hasOwnProperty.call(value, symToStringTag$1), tag = value[symToStringTag$1];
|
|
2972
|
+
try {
|
|
2973
|
+
value[symToStringTag$1] = void 0;
|
|
2974
|
+
var unmasked = true;
|
|
2975
|
+
} catch (e) {}
|
|
2976
|
+
var result = nativeObjectToString$1.call(value);
|
|
2977
|
+
if (unmasked) if (isOwn) value[symToStringTag$1] = tag;
|
|
2978
|
+
else delete value[symToStringTag$1];
|
|
2979
|
+
return result;
|
|
2980
|
+
}
|
|
2981
|
+
//#endregion
|
|
2982
|
+
//#region node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_objectToString.js
|
|
2983
|
+
/**
|
|
2984
|
+
* Used to resolve the
|
|
2985
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
2986
|
+
* of values.
|
|
2987
|
+
*/
|
|
2988
|
+
var nativeObjectToString = Object.prototype.toString;
|
|
2989
|
+
/**
|
|
2990
|
+
* Converts `value` to a string using `Object.prototype.toString`.
|
|
2991
|
+
*
|
|
2992
|
+
* @private
|
|
2993
|
+
* @param {*} value The value to convert.
|
|
2994
|
+
* @returns {string} Returns the converted string.
|
|
2995
|
+
*/
|
|
2996
|
+
function objectToString(value) {
|
|
2997
|
+
return nativeObjectToString.call(value);
|
|
2998
|
+
}
|
|
2999
|
+
//#endregion
|
|
3000
|
+
//#region node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseGetTag.js
|
|
3001
|
+
/** `Object#toString` result references. */
|
|
3002
|
+
var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
|
|
3003
|
+
/** Built-in value references. */
|
|
3004
|
+
var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : void 0;
|
|
3005
|
+
/**
|
|
3006
|
+
* The base implementation of `getTag` without fallbacks for buggy environments.
|
|
3007
|
+
*
|
|
3008
|
+
* @private
|
|
3009
|
+
* @param {*} value The value to query.
|
|
3010
|
+
* @returns {string} Returns the `toStringTag`.
|
|
3011
|
+
*/
|
|
3012
|
+
function baseGetTag(value) {
|
|
3013
|
+
if (value == null) return value === void 0 ? undefinedTag : nullTag;
|
|
3014
|
+
return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
|
|
3015
|
+
}
|
|
3016
|
+
//#endregion
|
|
3017
|
+
//#region node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObjectLike.js
|
|
3018
|
+
/**
|
|
3019
|
+
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
3020
|
+
* and has a `typeof` result of "object".
|
|
3021
|
+
*
|
|
3022
|
+
* @static
|
|
3023
|
+
* @memberOf _
|
|
3024
|
+
* @since 4.0.0
|
|
3025
|
+
* @category Lang
|
|
3026
|
+
* @param {*} value The value to check.
|
|
3027
|
+
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
3028
|
+
* @example
|
|
3029
|
+
*
|
|
3030
|
+
* _.isObjectLike({});
|
|
3031
|
+
* // => true
|
|
3032
|
+
*
|
|
3033
|
+
* _.isObjectLike([1, 2, 3]);
|
|
3034
|
+
* // => true
|
|
3035
|
+
*
|
|
3036
|
+
* _.isObjectLike(_.noop);
|
|
3037
|
+
* // => false
|
|
3038
|
+
*
|
|
3039
|
+
* _.isObjectLike(null);
|
|
3040
|
+
* // => false
|
|
3041
|
+
*/
|
|
3042
|
+
function isObjectLike(value) {
|
|
3043
|
+
return value != null && typeof value == "object";
|
|
3044
|
+
}
|
|
3045
|
+
//#endregion
|
|
3046
|
+
//#region node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isSymbol.js
|
|
3047
|
+
/** `Object#toString` result references. */
|
|
3048
|
+
var symbolTag = "[object Symbol]";
|
|
3049
|
+
/**
|
|
3050
|
+
* Checks if `value` is classified as a `Symbol` primitive or object.
|
|
3051
|
+
*
|
|
3052
|
+
* @static
|
|
3053
|
+
* @memberOf _
|
|
3054
|
+
* @since 4.0.0
|
|
3055
|
+
* @category Lang
|
|
3056
|
+
* @param {*} value The value to check.
|
|
3057
|
+
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
|
3058
|
+
* @example
|
|
3059
|
+
*
|
|
3060
|
+
* _.isSymbol(Symbol.iterator);
|
|
3061
|
+
* // => true
|
|
3062
|
+
*
|
|
3063
|
+
* _.isSymbol('abc');
|
|
3064
|
+
* // => false
|
|
3065
|
+
*/
|
|
3066
|
+
function isSymbol(value) {
|
|
3067
|
+
return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag;
|
|
3068
|
+
}
|
|
3069
|
+
//#endregion
|
|
3070
|
+
//#region node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/toNumber.js
|
|
3071
|
+
/** Used as references for various `Number` constants. */
|
|
3072
|
+
var NAN = NaN;
|
|
3073
|
+
/** Used to detect bad signed hexadecimal string values. */
|
|
3074
|
+
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
3075
|
+
/** Used to detect binary string values. */
|
|
3076
|
+
var reIsBinary = /^0b[01]+$/i;
|
|
3077
|
+
/** Used to detect octal string values. */
|
|
3078
|
+
var reIsOctal = /^0o[0-7]+$/i;
|
|
3079
|
+
/** Built-in method references without a dependency on `root`. */
|
|
3080
|
+
var freeParseInt = parseInt;
|
|
3081
|
+
/**
|
|
3082
|
+
* Converts `value` to a number.
|
|
3083
|
+
*
|
|
3084
|
+
* @static
|
|
3085
|
+
* @memberOf _
|
|
3086
|
+
* @since 4.0.0
|
|
3087
|
+
* @category Lang
|
|
3088
|
+
* @param {*} value The value to process.
|
|
3089
|
+
* @returns {number} Returns the number.
|
|
3090
|
+
* @example
|
|
3091
|
+
*
|
|
3092
|
+
* _.toNumber(3.2);
|
|
3093
|
+
* // => 3.2
|
|
3094
|
+
*
|
|
3095
|
+
* _.toNumber(Number.MIN_VALUE);
|
|
3096
|
+
* // => 5e-324
|
|
3097
|
+
*
|
|
3098
|
+
* _.toNumber(Infinity);
|
|
3099
|
+
* // => Infinity
|
|
3100
|
+
*
|
|
3101
|
+
* _.toNumber('3.2');
|
|
3102
|
+
* // => 3.2
|
|
3103
|
+
*/
|
|
3104
|
+
function toNumber(value) {
|
|
3105
|
+
if (typeof value == "number") return value;
|
|
3106
|
+
if (isSymbol(value)) return NAN;
|
|
3107
|
+
if (isObject(value)) {
|
|
3108
|
+
var other = typeof value.valueOf == "function" ? value.valueOf() : value;
|
|
3109
|
+
value = isObject(other) ? other + "" : other;
|
|
3110
|
+
}
|
|
3111
|
+
if (typeof value != "string") return value === 0 ? value : +value;
|
|
3112
|
+
value = baseTrim(value);
|
|
3113
|
+
var isBinary = reIsBinary.test(value);
|
|
3114
|
+
return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
|
|
3115
|
+
}
|
|
3116
|
+
//#endregion
|
|
3117
|
+
//#region node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/debounce.js
|
|
3118
|
+
/** Error message constants. */
|
|
3119
|
+
var FUNC_ERROR_TEXT = "Expected a function";
|
|
3120
|
+
var nativeMax = Math.max, nativeMin = Math.min;
|
|
3121
|
+
/**
|
|
3122
|
+
* Creates a debounced function that delays invoking `func` until after `wait`
|
|
3123
|
+
* milliseconds have elapsed since the last time the debounced function was
|
|
3124
|
+
* invoked. The debounced function comes with a `cancel` method to cancel
|
|
3125
|
+
* delayed `func` invocations and a `flush` method to immediately invoke them.
|
|
3126
|
+
* Provide `options` to indicate whether `func` should be invoked on the
|
|
3127
|
+
* leading and/or trailing edge of the `wait` timeout. The `func` is invoked
|
|
3128
|
+
* with the last arguments provided to the debounced function. Subsequent
|
|
3129
|
+
* calls to the debounced function return the result of the last `func`
|
|
3130
|
+
* invocation.
|
|
3131
|
+
*
|
|
3132
|
+
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
|
3133
|
+
* invoked on the trailing edge of the timeout only if the debounced function
|
|
3134
|
+
* is invoked more than once during the `wait` timeout.
|
|
3135
|
+
*
|
|
3136
|
+
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
|
3137
|
+
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
|
3138
|
+
*
|
|
3139
|
+
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
|
3140
|
+
* for details over the differences between `_.debounce` and `_.throttle`.
|
|
3141
|
+
*
|
|
3142
|
+
* @static
|
|
3143
|
+
* @memberOf _
|
|
3144
|
+
* @since 0.1.0
|
|
3145
|
+
* @category Function
|
|
3146
|
+
* @param {Function} func The function to debounce.
|
|
3147
|
+
* @param {number} [wait=0] The number of milliseconds to delay.
|
|
3148
|
+
* @param {Object} [options={}] The options object.
|
|
3149
|
+
* @param {boolean} [options.leading=false]
|
|
3150
|
+
* Specify invoking on the leading edge of the timeout.
|
|
3151
|
+
* @param {number} [options.maxWait]
|
|
3152
|
+
* The maximum time `func` is allowed to be delayed before it's invoked.
|
|
3153
|
+
* @param {boolean} [options.trailing=true]
|
|
3154
|
+
* Specify invoking on the trailing edge of the timeout.
|
|
3155
|
+
* @returns {Function} Returns the new debounced function.
|
|
3156
|
+
* @example
|
|
3157
|
+
*
|
|
3158
|
+
* // Avoid costly calculations while the window size is in flux.
|
|
3159
|
+
* jQuery(window).on('resize', _.debounce(calculateLayout, 150));
|
|
3160
|
+
*
|
|
3161
|
+
* // Invoke `sendMail` when clicked, debouncing subsequent calls.
|
|
3162
|
+
* jQuery(element).on('click', _.debounce(sendMail, 300, {
|
|
3163
|
+
* 'leading': true,
|
|
3164
|
+
* 'trailing': false
|
|
3165
|
+
* }));
|
|
3166
|
+
*
|
|
3167
|
+
* // Ensure `batchLog` is invoked once after 1 second of debounced calls.
|
|
3168
|
+
* var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
|
|
3169
|
+
* var source = new EventSource('/stream');
|
|
3170
|
+
* jQuery(source).on('message', debounced);
|
|
3171
|
+
*
|
|
3172
|
+
* // Cancel the trailing debounced invocation.
|
|
3173
|
+
* jQuery(window).on('popstate', debounced.cancel);
|
|
3174
|
+
*/
|
|
3175
|
+
function debounce(func, wait, options) {
|
|
3176
|
+
var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
|
|
3177
|
+
if (typeof func != "function") throw new TypeError(FUNC_ERROR_TEXT);
|
|
3178
|
+
wait = toNumber(wait) || 0;
|
|
3179
|
+
if (isObject(options)) {
|
|
3180
|
+
leading = !!options.leading;
|
|
3181
|
+
maxing = "maxWait" in options;
|
|
3182
|
+
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
|
|
3183
|
+
trailing = "trailing" in options ? !!options.trailing : trailing;
|
|
3184
|
+
}
|
|
3185
|
+
function invokeFunc(time) {
|
|
3186
|
+
var args = lastArgs, thisArg = lastThis;
|
|
3187
|
+
lastArgs = lastThis = void 0;
|
|
3188
|
+
lastInvokeTime = time;
|
|
3189
|
+
result = func.apply(thisArg, args);
|
|
3190
|
+
return result;
|
|
3191
|
+
}
|
|
3192
|
+
function leadingEdge(time) {
|
|
3193
|
+
lastInvokeTime = time;
|
|
3194
|
+
timerId = setTimeout(timerExpired, wait);
|
|
3195
|
+
return leading ? invokeFunc(time) : result;
|
|
3196
|
+
}
|
|
3197
|
+
function remainingWait(time) {
|
|
3198
|
+
var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
|
|
3199
|
+
return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
|
|
3200
|
+
}
|
|
3201
|
+
function shouldInvoke(time) {
|
|
3202
|
+
var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
|
|
3203
|
+
return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
|
|
3204
|
+
}
|
|
3205
|
+
function timerExpired() {
|
|
3206
|
+
var time = now();
|
|
3207
|
+
if (shouldInvoke(time)) return trailingEdge(time);
|
|
3208
|
+
timerId = setTimeout(timerExpired, remainingWait(time));
|
|
3209
|
+
}
|
|
3210
|
+
function trailingEdge(time) {
|
|
3211
|
+
timerId = void 0;
|
|
3212
|
+
if (trailing && lastArgs) return invokeFunc(time);
|
|
3213
|
+
lastArgs = lastThis = void 0;
|
|
3214
|
+
return result;
|
|
3215
|
+
}
|
|
3216
|
+
function cancel() {
|
|
3217
|
+
if (timerId !== void 0) clearTimeout(timerId);
|
|
3218
|
+
lastInvokeTime = 0;
|
|
3219
|
+
lastArgs = lastCallTime = lastThis = timerId = void 0;
|
|
3220
|
+
}
|
|
3221
|
+
function flush() {
|
|
3222
|
+
return timerId === void 0 ? result : trailingEdge(now());
|
|
3223
|
+
}
|
|
3224
|
+
function debounced() {
|
|
3225
|
+
var time = now(), isInvoking = shouldInvoke(time);
|
|
3226
|
+
lastArgs = arguments;
|
|
3227
|
+
lastThis = this;
|
|
3228
|
+
lastCallTime = time;
|
|
3229
|
+
if (isInvoking) {
|
|
3230
|
+
if (timerId === void 0) return leadingEdge(lastCallTime);
|
|
3231
|
+
if (maxing) {
|
|
3232
|
+
clearTimeout(timerId);
|
|
3233
|
+
timerId = setTimeout(timerExpired, wait);
|
|
3234
|
+
return invokeFunc(lastCallTime);
|
|
3235
|
+
}
|
|
3236
|
+
}
|
|
3237
|
+
if (timerId === void 0) timerId = setTimeout(timerExpired, wait);
|
|
3238
|
+
return result;
|
|
3239
|
+
}
|
|
3240
|
+
debounced.cancel = cancel;
|
|
3241
|
+
debounced.flush = flush;
|
|
3242
|
+
return debounced;
|
|
3243
|
+
}
|
|
3244
|
+
//#endregion
|
|
3245
|
+
//#region src/components/DebouncedMarkerClusterer.ts
|
|
3246
|
+
/**
|
|
3247
|
+
* MarkerClusterer with debounced rendering for batch operations.
|
|
3248
|
+
*
|
|
3249
|
+
* Uses leading+trailing debounce: renders immediately on first call,
|
|
3250
|
+
* then batches subsequent calls and renders once more after the delay.
|
|
3251
|
+
* This provides immediate visual feedback while still batching rapid updates.
|
|
3252
|
+
*/
|
|
3253
|
+
var DebouncedMarkerClusterer = class extends MarkerClusterer {
|
|
3254
|
+
debouncedRender;
|
|
3255
|
+
constructor(options, debounceDelay = 10) {
|
|
3256
|
+
super(options);
|
|
3257
|
+
this.debouncedRender = debounce(() => {
|
|
3258
|
+
super.render();
|
|
3259
|
+
}, debounceDelay, {
|
|
3260
|
+
leading: true,
|
|
3261
|
+
trailing: true
|
|
3262
|
+
});
|
|
3263
|
+
}
|
|
3264
|
+
addMarker(marker, noDraw) {
|
|
3265
|
+
super.addMarker(marker, true);
|
|
3266
|
+
if (!noDraw) this.debouncedRender();
|
|
3267
|
+
}
|
|
3268
|
+
removeMarker(marker, noDraw) {
|
|
3269
|
+
const result = super.removeMarker(marker, true);
|
|
3270
|
+
if (!noDraw) this.debouncedRender();
|
|
3271
|
+
return result;
|
|
3272
|
+
}
|
|
3273
|
+
addMarkers(markers, noDraw) {
|
|
3274
|
+
super.addMarkers(markers, true);
|
|
3275
|
+
if (!noDraw) this.debouncedRender();
|
|
3276
|
+
}
|
|
3277
|
+
removeMarkers(markers, noDraw) {
|
|
3278
|
+
const result = super.removeMarkers(markers, true);
|
|
3279
|
+
if (!noDraw) this.debouncedRender();
|
|
3280
|
+
return result;
|
|
3281
|
+
}
|
|
3282
|
+
clearMarkers(noDraw) {
|
|
3283
|
+
super.clearMarkers(true);
|
|
3284
|
+
if (!noDraw) this.debouncedRender();
|
|
3285
|
+
}
|
|
3286
|
+
/** Renders immediately, canceling any pending debounced render. */
|
|
3287
|
+
render() {
|
|
3288
|
+
this.debouncedRender.cancel();
|
|
3289
|
+
super.render();
|
|
3290
|
+
}
|
|
3291
|
+
/**
|
|
3292
|
+
* Cancels any pending debounced render and replaces `debouncedRender` with a
|
|
3293
|
+
* no-op so that calls arriving after destroy (e.g. `removeMarker` triggered
|
|
3294
|
+
* by child components unmounting after `MarkerCluster.onBeforeUnmount`) cannot
|
|
3295
|
+
* restart the debounce. Without this, a trailing `setTimeout` fires later and
|
|
3296
|
+
* crashes inside `MarkerClusterer.render()` if the Maps API has been torn
|
|
3297
|
+
* down. See issue #376.
|
|
3298
|
+
*/
|
|
3299
|
+
destroy() {
|
|
3300
|
+
this.debouncedRender.cancel();
|
|
3301
|
+
this.debouncedRender = Object.assign(() => {}, { cancel: () => {} });
|
|
3302
|
+
}
|
|
3303
|
+
};
|
|
3304
|
+
//#endregion
|
|
3305
|
+
//#region src/components/SafeSuperClusterViewportAlgorithm.ts
|
|
3306
|
+
/**
|
|
3307
|
+
* Wrapper around SuperClusterViewportAlgorithm that handles empty marker arrays.
|
|
3308
|
+
*
|
|
3309
|
+
* Stopgap for upstream issue googlemaps/js-markerclusterer#1129.
|
|
3310
|
+
* The fix from PR #1014 was only applied to SuperClusterAlgorithm, not
|
|
3311
|
+
* SuperClusterViewportAlgorithm. This wrapper adds the same empty markers check.
|
|
3312
|
+
*
|
|
3313
|
+
* @see https://github.com/googlemaps/js-markerclusterer/issues/1129
|
|
3314
|
+
* @see https://github.com/googlemaps/js-markerclusterer/pull/1130
|
|
3315
|
+
*
|
|
3316
|
+
* TODO: Remove once upstream PR #1130 is released.
|
|
3317
|
+
*/
|
|
3318
|
+
var SafeSuperClusterViewportAlgorithm = class extends SuperClusterViewportAlgorithm {
|
|
3319
|
+
calculate(input) {
|
|
3320
|
+
if (input.markers.length === 0) return {
|
|
3321
|
+
clusters: [],
|
|
3322
|
+
changed: true
|
|
3323
|
+
};
|
|
3324
|
+
return super.calculate(input);
|
|
3325
|
+
}
|
|
3326
|
+
};
|
|
3327
|
+
//#endregion
|
|
3328
|
+
//#region src/components/MarkerCluster.ts
|
|
3329
|
+
var markerClusterEvents = Object.values(MarkerClustererEvents);
|
|
3330
|
+
var MarkerCluster_default = (0, vue.defineComponent)({
|
|
3331
|
+
name: "MarkerCluster",
|
|
3332
|
+
props: {
|
|
3333
|
+
options: {
|
|
3334
|
+
type: Object,
|
|
3335
|
+
default: () => ({})
|
|
3336
|
+
},
|
|
3337
|
+
renderDebounceDelay: {
|
|
3338
|
+
type: Number,
|
|
3339
|
+
default: 10
|
|
3340
|
+
}
|
|
3341
|
+
},
|
|
3342
|
+
emits: markerClusterEvents,
|
|
3343
|
+
setup(props, { emit, expose, slots }) {
|
|
3344
|
+
const markerCluster = (0, vue.ref)();
|
|
3345
|
+
const map = (0, vue.inject)(mapSymbol, (0, vue.ref)());
|
|
3346
|
+
const api = (0, vue.inject)(apiSymbol, (0, vue.ref)());
|
|
3347
|
+
(0, vue.provide)(markerClusterSymbol, markerCluster);
|
|
3348
|
+
(0, vue.watch)(map, () => {
|
|
3349
|
+
if (map.value) {
|
|
3350
|
+
markerCluster.value = (0, vue.markRaw)(new DebouncedMarkerClusterer({
|
|
3351
|
+
map: map.value,
|
|
3352
|
+
algorithm: new SafeSuperClusterViewportAlgorithm(props.options.algorithmOptions ?? {}),
|
|
3353
|
+
...props.options
|
|
3354
|
+
}, props.renderDebounceDelay));
|
|
3355
|
+
markerClusterEvents.forEach((event) => {
|
|
3356
|
+
markerCluster.value?.addListener(event, (e) => emit(event, e));
|
|
3357
|
+
});
|
|
3358
|
+
}
|
|
3359
|
+
}, { immediate: true });
|
|
3360
|
+
(0, vue.onBeforeUnmount)(() => {
|
|
3361
|
+
if (markerCluster.value) {
|
|
3362
|
+
api.value?.event.clearInstanceListeners(markerCluster.value);
|
|
3363
|
+
markerCluster.value.clearMarkers(true);
|
|
3364
|
+
markerCluster.value.setMap(null);
|
|
3365
|
+
markerCluster.value.destroy();
|
|
3366
|
+
}
|
|
3367
|
+
});
|
|
3368
|
+
expose({ markerCluster });
|
|
3369
|
+
return () => slots.default?.();
|
|
3370
|
+
}
|
|
3371
|
+
});
|
|
3372
|
+
//#endregion
|
|
3373
|
+
//#region src/components/CustomMarker.vue?vue&type=script&lang.ts
|
|
3374
|
+
var CustomMarker_vue_vue_type_script_lang_default = (0, vue.defineComponent)({
|
|
3375
|
+
inheritAttrs: false,
|
|
3376
|
+
props: { options: {
|
|
3377
|
+
type: Object,
|
|
3378
|
+
required: true
|
|
3379
|
+
} },
|
|
3380
|
+
setup(props, { slots, emit, expose }) {
|
|
3381
|
+
const customMarkerRef = (0, vue.ref)();
|
|
3382
|
+
const hasSlotContent = (0, vue.computed)(() => slots.default?.().some((vnode) => vnode.type !== vue.Comment));
|
|
3383
|
+
const customMarker = useSetupMapComponent(customMarkerClassSymbol, [], (0, vue.computed)(() => ({
|
|
3384
|
+
...props.options,
|
|
3385
|
+
element: customMarkerRef.value
|
|
3386
|
+
})), emit);
|
|
3387
|
+
expose({ customMarker });
|
|
3388
|
+
return {
|
|
3389
|
+
customMarkerRef,
|
|
3390
|
+
customMarker,
|
|
3391
|
+
hasSlotContent
|
|
3392
|
+
};
|
|
3393
|
+
}
|
|
3394
|
+
});
|
|
3395
|
+
//#endregion
|
|
3396
|
+
//#region src/components/CustomMarker.vue
|
|
3397
|
+
var _hoisted_1 = {
|
|
3398
|
+
key: 0,
|
|
3399
|
+
class: "custom-marker-wrapper"
|
|
3400
|
+
};
|
|
3401
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
3402
|
+
return _ctx.hasSlotContent ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1, [(0, vue.createElementVNode)("div", (0, vue.mergeProps)({
|
|
3403
|
+
ref: "customMarkerRef",
|
|
3404
|
+
style: { cursor: !!_ctx.$attrs.onClick ? "pointer" : void 0 }
|
|
3405
|
+
}, _ctx.$attrs), [(0, vue.renderSlot)(_ctx.$slots, "default", {}, void 0, true)], 16)])) : (0, vue.createCommentVNode)("", true);
|
|
3406
|
+
}
|
|
3407
|
+
var CustomMarker_default = /* @__PURE__ */ _plugin_vue_export_helper_default(CustomMarker_vue_vue_type_script_lang_default, [["render", _sfc_render], ["__scopeId", "data-v-574a274a"]]);
|
|
3408
|
+
//#endregion
|
|
3409
|
+
//#region src/components/HeatmapLayer.ts
|
|
3410
|
+
/**
|
|
3411
|
+
* @deprecated The Heatmap Layer was removed from the Maps JavaScript API as of version 3.65.
|
|
3412
|
+
* It is no longer available on the `weekly` (or any newer) channel and only works if the API is
|
|
3413
|
+
* pinned to version 3.64 or earlier via the `version` prop on `GoogleMap` (or the `v` option of
|
|
3414
|
+
* `@googlemaps/js-api-loader`). That pin is temporary — Google rotates out old versions over time.
|
|
3415
|
+
* Deprecated on May 27, 2025; Google recommends migrating to third-party integrations like deck.gl,
|
|
3416
|
+
* which offers a HeatmapLayer implementation.
|
|
3417
|
+
* @see {@link https://developers.google.com/maps/deprecations} for more information.
|
|
3418
|
+
*/
|
|
3419
|
+
var HeatmapLayer_default = (0, vue.defineComponent)({
|
|
3420
|
+
name: "HeatmapLayer",
|
|
3421
|
+
props: { options: {
|
|
3422
|
+
type: Object,
|
|
3423
|
+
default: () => ({})
|
|
3424
|
+
} },
|
|
3425
|
+
setup(props) {
|
|
3426
|
+
const heatmapLayer = (0, vue.ref)();
|
|
3427
|
+
const map = (0, vue.inject)(mapSymbol, (0, vue.ref)());
|
|
3428
|
+
const api = (0, vue.inject)(apiSymbol, (0, vue.ref)());
|
|
3429
|
+
let appliedOptions;
|
|
3430
|
+
(0, vue.watch)([map, () => props.options], ([_, options], [oldMap]) => {
|
|
3431
|
+
const hasChanged = !appliedOptions || !(0, import_fast_deep_equal.default)(options, appliedOptions) || map.value !== oldMap;
|
|
3432
|
+
if (map.value && api.value && hasChanged) {
|
|
3433
|
+
let opts;
|
|
3434
|
+
if (options.data && !(options.data instanceof api.value.MVCArray)) {
|
|
3435
|
+
const LatLng = api.value.LatLng;
|
|
3436
|
+
const transformedData = options.data.map((point) => {
|
|
3437
|
+
if (point instanceof LatLng || "location" in point && (point.location instanceof LatLng || point.location === null)) return point;
|
|
3438
|
+
else {
|
|
3439
|
+
if ("location" in point) return {
|
|
3440
|
+
...point,
|
|
3441
|
+
location: new LatLng(point.location)
|
|
3442
|
+
};
|
|
3443
|
+
return new LatLng(point);
|
|
3444
|
+
}
|
|
3445
|
+
});
|
|
3446
|
+
opts = {
|
|
3447
|
+
...options,
|
|
3448
|
+
data: transformedData
|
|
3449
|
+
};
|
|
3450
|
+
} else opts = options;
|
|
3451
|
+
if (heatmapLayer.value) heatmapLayer.value.setOptions(opts);
|
|
3452
|
+
else heatmapLayer.value = (0, vue.markRaw)(new api.value.visualization.HeatmapLayer({
|
|
3453
|
+
...opts,
|
|
3454
|
+
map: map.value
|
|
3455
|
+
}));
|
|
3456
|
+
appliedOptions = cloneOptions(options);
|
|
3457
|
+
}
|
|
3458
|
+
}, {
|
|
3459
|
+
immediate: true,
|
|
3460
|
+
deep: true
|
|
3461
|
+
});
|
|
3462
|
+
(0, vue.onBeforeUnmount)(() => {
|
|
3463
|
+
if (heatmapLayer.value) heatmapLayer.value.setMap(null);
|
|
3464
|
+
});
|
|
3465
|
+
return { heatmapLayer };
|
|
3466
|
+
},
|
|
3467
|
+
render: () => null
|
|
3468
|
+
});
|
|
3469
|
+
//#endregion
|
|
3470
|
+
exports.AdvancedMarker = AdvancedMarker_default;
|
|
3471
|
+
exports.Circle = Circle_default;
|
|
3472
|
+
exports.CustomControl = CustomControl_default;
|
|
3473
|
+
exports.CustomMarker = CustomMarker_default;
|
|
3474
|
+
exports.GoogleMap = GoogleMap_default;
|
|
3475
|
+
exports.HeatmapLayer = HeatmapLayer_default;
|
|
3476
|
+
exports.InfoWindow = InfoWindow_default;
|
|
3477
|
+
exports.Marker = Marker_default;
|
|
3478
|
+
exports.MarkerCluster = MarkerCluster_default;
|
|
3479
|
+
exports.Polygon = Polygon_default;
|
|
3480
|
+
exports.Polyline = Polyline_default;
|
|
3481
|
+
exports.Rectangle = Rectangle_default;
|
|
3482
|
+
exports.apiSymbol = apiSymbol;
|
|
3483
|
+
exports.mapSymbol = mapSymbol;
|
|
3484
|
+
exports.mapTilesLoadedSymbol = mapTilesLoadedSymbol;
|