@mappedin/marker-cluster 6.0.1-beta.47 → 6.0.1-beta.49

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.
Files changed (2) hide show
  1. package/lib/esm/index.js +1 -1
  2. package/package.json +2 -2
package/lib/esm/index.js CHANGED
@@ -1 +1 @@
1
- var ie=Object.defineProperty,pe=Object.defineProperties;var ge=Object.getOwnPropertyDescriptors;var ne=Object.getOwnPropertySymbols;var Me=Object.prototype.hasOwnProperty,ye=Object.prototype.propertyIsEnumerable;var oe=n=>{throw TypeError(n)};var W=(n,e,t)=>e in n?ie(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,b=(n,e)=>{for(var t in e||(e={}))Me.call(e,t)&&W(n,t,e[t]);if(ne)for(var t of ne(e))ye.call(e,t)&&W(n,t,e[t]);return n},L=(n,e)=>pe(n,ge(e)),i=(n,e)=>ie(n,"name",{value:e,configurable:!0});var c=(n,e,t)=>W(n,typeof e!="symbol"?e+"":e,t),ae=(n,e,t)=>e.has(n)||oe("Cannot "+t);var r=(n,e,t)=>(ae(n,e,"read from private field"),t?t.call(n):e.get(n)),a=(n,e,t)=>e.has(n)?oe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),f=(n,e,t,s)=>(ae(n,e,"write to private field"),s?s.call(n,t):e.set(n,t),t);var h={env:{NODE_ENV:"production",npm_package_version:"6.0.1-beta.47"}};var X="[MappedinJS]";var xe={logState:h.env.NODE_ENV==="test"?3:0,log(...n){this.logState<=0&&console.log(X,...n)},warn(...n){this.logState<=1&&console.warn(X,...n)},error(...n){this.logState<=2&&console.error(X,...n)},assert(...n){console.assert(...n)},time(n){console.time(n)},timeEnd(n){console.timeEnd(n)}},_=xe;var Z=class Z extends Error{};i(Z,"InvalidTokenError");var H=Z;H.prototype.name="InvalidTokenError";function ue(n,e,t=!1){let s=null,o=0;return function(...l){o++,o===1&&t===!0&&n(...l);let m=i(()=>{(!t||o>1)&&n(...l),s=null,o=0},"later");clearTimeout(s),s=setTimeout(m,e)}}i(ue,"debounce");var Q=[0,4,6,8,10],j=i(()=>{let n=new Array(16).fill(0),e=Math.random()*4294967296;for(let s=0;s<n.length;s++)s>0&&(s&3)===0&&(e=Math.random()*4294967296),n[s]=e>>>((s&3)<<3)&255;let t=n.map(s=>s.toString(16).padStart(2,"0"));return t[6]="4"+t[6][1],t[8]=["8","9","a","b"].includes(t[7][0])?t[7]:"a"+t[7][1],Q.map((s,o)=>t.slice(s,o===Q.length-1?void 0:Q[o+1]).join("")).join("-")},"randomId");var B=["red","blue","green","purple","orange","pink","brown","gray","black","magenta","cyan","silver","maroon","teal","aqua"],le=i((n,e,t)=>'<div style="background-color:'.concat(e,";color:white;width:").concat(t,"px;height:").concat(t,"px;border-radius:50%;text-align:center;line-height:").concat(t,"px;border:1px solid white;font-size:").concat(Math.floor(t*.7),'px;">').concat(n,"</div>"),"debugMarkerFn");import{Coordinate as ce}from"@mappedin/mappedin-js";var V=i(n=>parseFloat(n.toFixed(8)),"trimCoordValue"),de=i((n,e)=>{if(n.length===0)return new ce({latitude:0,longitude:0});let t=n.reduce((o,l)=>o+l.latitude,0)/n.length,s=n.reduce((o,l)=>o+l.longitude,0)/n.length;return new ce({latitude:V(t),longitude:V(s),floorId:e!=null?e:n[0].floorId})},"averageCoords"),he=i((n,e)=>n.length===0?"":[...n.map(t=>t.id).sort(),V(e.latitude),V(e.longitude),e.floorId].filter(t=>t!=null).join("-"),"getClusterId"),me=i((n,e)=>{if(e<=0)throw new Error("Buffer must be greater than 0");return{minX:n.x-e/2,minY:n.y-e/2,maxX:n.x+e/2,maxY:n.y+e/2}},"bufferPoint");import Ee from"rbush";var R=i(n=>"".concat(n.x,",").concat(n.y),"serializePoint"),g,ee=class ee extends Ee{constructor(){super(...arguments);a(this,g,new Map);c(this,"load",i(t=>{for(let s of t)r(this,g).set(R(s),s);return super.load(t)},"load"));c(this,"insert",i(t=>(r(this,g).set(R(t),t),super.insert(t)),"insert"));c(this,"remove",i(t=>(r(this,g).delete(R(t)),super.remove(t)),"remove"));c(this,"clear",i(()=>(r(this,g).clear(),super.clear()),"clear"));c(this,"peek",i(()=>r(this,g).values().next().value,"peek"));c(this,"has",i(t=>r(this,g).has(R(t)),"has"));c(this,"find",i(t=>{for(let s of r(this,g).values())if(t(s))return s},"find"));c(this,"toBBox",i(t=>({minX:t.x,minY:t.y,maxX:t.x,maxY:t.y}),"toBBox"));c(this,"compareMinX",i((t,s)=>t.x-s.x,"compareMinX"));c(this,"compareMinY",i((t,s)=>t.y-s.y,"compareMinY"));c(this,"equals",i((t,s)=>t.x===s.x&&t.y===s.y,"equals"))}get size(){return r(this,g).size}};g=new WeakMap,i(ee,"PointRBush");var C=ee;var A,x,M,y,E,F,$,te=class te{constructor(e){a(this,A);a(this,x,{threshold:100});a(this,M,new C);a(this,y,new Map);a(this,E,[]);a(this,F,i(()=>[...r(this,y).values()].map(e=>L(b({},r(this,A).getScreenCoordinateFromCoordinate(e.target.anchorTarget)),{markerId:e.id})),"#getScreenCoordinates"));a(this,$,i(e=>{let t=[e];r(this,M).remove(e);let s=r(this,M).search(me(e,r(this,x).threshold));if(s.length===0)return t;t.push(...s);for(let o of s)r(this,M).remove(o);return t},"#resolveNeighbours"));f(this,A,e)}setOptions(e){if(e.threshold!=null&&e.threshold<=0)throw new Error("Cluster threshold must be greater than 0");f(this,x,b(b({},r(this,x)),e))}load(e){r(this,y).clear();for(let t of e)r(this,y).set(t.id,t)}getClusters(){var l;let e=r(this,F).call(this);r(this,M).clear(),r(this,M).load(e);let t=r(this,M),s=[],o=[];for(;t.size>0;){let m=(l=t.find(w=>r(this,E).includes(w)))!=null?l:t.peek();if(m==null)break;o.push(m);let fe=r(this,$).call(this,m).map(w=>r(this,y).get(w.markerId)).filter(w=>w!=null);s.push(fe)}return f(this,E,o),s}destroy(){r(this,y).clear(),r(this,M).clear(),f(this,E,[])}};A=new WeakMap,x=new WeakMap,M=new WeakMap,y=new WeakMap,E=new WeakMap,F=new WeakMap,$=new WeakMap,i(te,"ScreenDistanceClustering");var N=te;var T,p,d,u,D,v,Y,J,U,K,q,z,P,k,I,S,O,se=class se{constructor(e,t,s){c(this,"id",j());a(this,T);a(this,p);a(this,d);a(this,u,{singleMarkersById:new Map,clustersById:new Map,clusterMarkersByClusterId:new Map,debugMarkersByClusterId:new Map,debugColorsByClusterId:new Map});a(this,D);a(this,v);a(this,Y,i(()=>[...r(this,u).singleMarkersById.values()],"#getMarkers"));a(this,J,i(e=>{r(this,p).updateState(e,{enabled:!1})},"#hideMarker"));a(this,U,i(e=>{r(this,p).updateState(e,{enabled:!0})},"#showMarker"));a(this,K,i(()=>{let e=r(this,d).algorithm;return e.load(r(this,Y).call(this)),e.getClusters()},"#getClusteredMarkers"));a(this,q,i(e=>{var s;let t=de(e.map(o=>o.target.anchorTarget),(s=r(this,d).floor)==null?void 0:s.id);return{id:he(e,t),markers:e,center:t}},"#createCluster"));a(this,z,i(e=>{var o;let t=(o=r(this,u).debugColorsByClusterId.get(e.id))!=null?o:B[0],s=r(this,D).call(this,e);s!=null&&r(this,u).clusterMarkersByClusterId.set(e.id,s);for(let l of e.markers)r(this,d).debug&&(l.contentEl.style.outline="2px solid ".concat(t)),r(this,d).hideClusteredMarkers&&r(this,J).call(this,l);if(r(this,d).debug){(s==null?void 0:s.contentEl.firstChild)instanceof HTMLElement&&(s.contentEl.firstChild.style.opacity="0.25");let l=r(this,p).Markers.add(e.center,le(e.markers.length.toString(),t,20),{rank:"always-visible",zIndex:99});r(this,u).debugMarkersByClusterId.set(e.id,l)}},"#addClusterMarkers"));a(this,P,i(e=>{let t=r(this,u).clusterMarkersByClusterId.get(e.id);if(t!=null&&(r(this,p).Markers.remove(t),r(this,u).clusterMarkersByClusterId.delete(e.id)),r(this,d).debug){let s=r(this,u).debugMarkersByClusterId.get(e.id);s!=null&&(r(this,p).Markers.remove(s),r(this,u).debugMarkersByClusterId.delete(e.id))}for(let s of e.markers)r(this,U).call(this,s)},"#removeClusterMarkers"));a(this,k,i(()=>{let e=new Map(r(this,u).clustersById),t=[],s=r(this,K).call(this);for(let o=0;o<s.length;o++){let l=s[o];if(l.length<r(this,d).minSize)continue;let m=r(this,q).call(this,l);r(this,u).clustersById.has(m.id)?e.delete(m.id):t.push(m)}for(let o of e.values())r(this,P).call(this,o),r(this,u).clustersById.delete(o.id),r(this,d).debug&&r(this,u).debugColorsByClusterId.delete(o.id);for(let o of t){if(r(this,d).debug){let l=B[Math.floor(Math.random()*B.length)];r(this,u).debugColorsByClusterId.set(o.id,l)}r(this,z).call(this,o),r(this,u).clustersById.set(o.id,o)}},"#updateImmediately"));a(this,I,i(()=>{r(this,d).debounce===0?r(this,k).call(this):r(this,v).call(this)},"#update"));a(this,S,i(()=>{r(this,I).call(this)},"#handleCameraChange"));a(this,O,i(()=>{r(this,k).call(this)},"#handleFocus"));c(this,"add",i(e=>{var t,s;if(r(this,d).floor==null)r(this,d).floor=(s=r(this,T).getById("floor",(t=e.target.anchorTarget.floorId)!=null?t:""))!=null?s:null;else if(r(this,d).floor.id!==e.target.anchorTarget.floorId)throw new Error("Cannot cluster markers on different floors!");r(this,u).singleMarkersById.set(e.id,e),r(this,I).call(this)},"add"));c(this,"remove",i(e=>{if(!r(this,u).singleMarkersById.has(e.id)){_.log("Cannot remove marker ".concat(e.id," because it is not in the cluster!"));return}r(this,u).singleMarkersById.delete(e.id),r(this,I).call(this)},"remove"));c(this,"has",i(e=>r(this,u).singleMarkersById.has(e.id),"has"));c(this,"destroy",i(()=>{r(this,d).algorithm.destroy(),r(this,p).off("camera-change",r(this,S)),window.removeEventListener("focus",r(this,O));for(let[,e]of r(this,u).clustersById)r(this,P).call(this,e);for(let e of Object.values(r(this,u)))if(e instanceof Map)e.clear();else throw new Error("Encountered unexpected data type in cache! Potentially failed to clean up MarkerCluster.")},"destroy"));var l,m;let o;if((s==null?void 0:s.algorithm)==null){let G=new N(e);G.setOptions((l=s==null?void 0:s.algorithmOptions)!=null?l:{}),o=G}else o=s.algorithm,o.setOptions((m=s==null?void 0:s.algorithmOptions)!=null?m:{});if(f(this,d,L(b({floor:null,minSize:2,debounce:50,debug:!1,hideClusteredMarkers:!0},s),{algorithm:o})),f(this,p,e),f(this,T,Object.values(r(this,p).getMapData())[0]),r(this,T)==null)throw new Error("No map data found in MapView!");f(this,D,t),f(this,v,ue(r(this,k),r(this,d).debounce)),r(this,p).on("camera-change",r(this,S)),window.addEventListener("focus",r(this,O))}get clusters(){return[...r(this,u).clustersById.values()]}};T=new WeakMap,p=new WeakMap,d=new WeakMap,u=new WeakMap,D=new WeakMap,v=new WeakMap,Y=new WeakMap,J=new WeakMap,U=new WeakMap,K=new WeakMap,q=new WeakMap,z=new WeakMap,P=new WeakMap,k=new WeakMap,I=new WeakMap,S=new WeakMap,O=new WeakMap,i(se,"MarkerCluster");var re=se;export{re as MarkerCluster,C as PointRBush,N as ScreenDistanceClustering};
1
+ var nt=Object.defineProperty,mt=Object.defineProperties;var pt=Object.getOwnPropertyDescriptors;var st=Object.getOwnPropertySymbols;var gt=Object.prototype.hasOwnProperty,Et=Object.prototype.propertyIsEnumerable;var it=n=>{throw TypeError(n)};var W=(n,t,e)=>t in n?nt(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,y=(n,t)=>{for(var e in t||(t={}))gt.call(t,e)&&W(n,e,t[e]);if(st)for(var e of st(t))Et.call(t,e)&&W(n,e,t[e]);return n},P=(n,t)=>mt(n,pt(t)),i=(n,t)=>nt(n,"name",{value:t,configurable:!0});var c=(n,t,e)=>W(n,typeof t!="symbol"?t+"":t,e),ot=(n,t,e)=>t.has(n)||it("Cannot "+e);var r=(n,t,e)=>(ot(n,t,"read from private field"),e?e.call(n):t.get(n)),a=(n,t,e)=>t.has(n)?it("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,e),m=(n,t,e,s)=>(ot(n,t,"write to private field"),s?s.call(n,e):t.set(n,e),e);var h={env:{NODE_ENV:"production",npm_package_version:"6.0.1-beta.49"}};var yt="[MappedinJS]";function bt(n=""){let t="".concat(yt).concat(n?"-".concat(n):"");return{logState:h.env.NODE_ENV==="test"?3:0,log(...e){this.logState<=0&&console.log(t,...e)},warn(...e){this.logState<=1&&console.warn(t,...e)},error(...e){this.logState<=2&&console.error(t,...e)},assert(...e){console.assert(...e)},time(e){console.time(e)},timeEnd(e){console.timeEnd(e)},setLevel(e){0<=e&&e<=3&&(this.logState=e)}}}i(bt,"createLogger");var xt=bt();var v=xt;var H=class H extends Error{};i(H,"InvalidTokenError");var X=H;X.prototype.name="InvalidTokenError";function at(n,t,e=!1){let s=null,o=0;return function(...l){o++,o===1&&e===!0&&n(...l);let f=i(()=>{(!e||o>1)&&n(...l),s=null,o=0},"later");clearTimeout(s),s=setTimeout(f,t)}}i(at,"debounce");var Z=[0,4,6,8,10],Q=i(()=>{let n=new Array(16).fill(0),t=Math.random()*4294967296;for(let s=0;s<n.length;s++)s>0&&(s&3)===0&&(t=Math.random()*4294967296),n[s]=t>>>((s&3)<<3)&255;let e=n.map(s=>s.toString(16).padStart(2,"0"));return e[6]="4"+e[6][1],e[8]=["8","9","a","b"].includes(e[7][0])?e[7]:"a"+e[7][1],Z.map((s,o)=>e.slice(s,o===Z.length-1?void 0:Z[o+1]).join("")).join("-")},"randomId");var V=["red","blue","green","purple","orange","pink","brown","gray","black","magenta","cyan","silver","maroon","teal","aqua"],ut=i((n,t,e)=>'<div style="background-color:'.concat(t,";color:white;width:").concat(e,"px;height:").concat(e,"px;border-radius:50%;text-align:center;line-height:").concat(e,"px;border:1px solid white;font-size:").concat(Math.floor(e*.7),'px;">').concat(n,"</div>"),"debugMarkerFn");import{Coordinate as lt}from"@mappedin/mappedin-js";var B=i(n=>parseFloat(n.toFixed(8)),"trimCoordValue"),ct=i((n,t)=>{if(n.length===0)return new lt({latitude:0,longitude:0});let e=n.reduce((o,l)=>o+l.latitude,0)/n.length,s=n.reduce((o,l)=>o+l.longitude,0)/n.length;return new lt({latitude:B(e),longitude:B(s),floorId:t!=null?t:n[0].floorId})},"averageCoords"),dt=i((n,t)=>n.length===0?"":[...n.map(e=>e.id).sort(),B(t.latitude),B(t.longitude),t.floorId].filter(e=>e!=null).join("-"),"getClusterId"),ht=i((n,t)=>{if(t<=0)throw new Error("Buffer must be greater than 0");return{minX:n.x-t/2,minY:n.y-t/2,maxX:n.x+t/2,maxY:n.y+t/2}},"bufferPoint");import It from"rbush";var R=i(n=>"".concat(n.x,",").concat(n.y),"serializePoint"),g,j=class j extends It{constructor(){super(...arguments);a(this,g,new Map);c(this,"load",i(e=>{for(let s of e)r(this,g).set(R(s),s);return super.load(e)},"load"));c(this,"insert",i(e=>(r(this,g).set(R(e),e),super.insert(e)),"insert"));c(this,"remove",i(e=>(r(this,g).delete(R(e)),super.remove(e)),"remove"));c(this,"clear",i(()=>(r(this,g).clear(),super.clear()),"clear"));c(this,"peek",i(()=>r(this,g).values().next().value,"peek"));c(this,"has",i(e=>r(this,g).has(R(e)),"has"));c(this,"find",i(e=>{for(let s of r(this,g).values())if(e(s))return s},"find"));c(this,"toBBox",i(e=>({minX:e.x,minY:e.y,maxX:e.x,maxY:e.y}),"toBBox"));c(this,"compareMinX",i((e,s)=>e.x-s.x,"compareMinX"));c(this,"compareMinY",i((e,s)=>e.y-s.y,"compareMinY"));c(this,"equals",i((e,s)=>e.x===s.x&&e.y===s.y,"equals"))}get size(){return r(this,g).size}};g=new WeakMap,i(j,"PointRBush");var w=j;var D,b,E,M,x,$,Y,tt=class tt{constructor(t){a(this,D);a(this,b,{threshold:100});a(this,E,new w);a(this,M,new Map);a(this,x,[]);a(this,$,i(()=>[...r(this,M).values()].map(t=>P(y({},r(this,D).getScreenCoordinateFromCoordinate(t.target.anchorTarget)),{markerId:t.id})),"#getScreenCoordinates"));a(this,Y,i(t=>{let e=[t];r(this,E).remove(t);let s=r(this,E).search(ht(t,r(this,b).threshold));if(s.length===0)return e;e.push(...s);for(let o of s)r(this,E).remove(o);return e},"#resolveNeighbours"));m(this,D,t)}setOptions(t){if(t.threshold!=null&&t.threshold<=0)throw new Error("Cluster threshold must be greater than 0");m(this,b,y(y({},r(this,b)),t))}load(t){r(this,M).clear();for(let e of t)r(this,M).set(e.id,e)}getClusters(){var l;let t=r(this,$).call(this);r(this,E).clear(),r(this,E).load(t);let e=r(this,E),s=[],o=[];for(;e.size>0;){let f=(l=e.find(C=>r(this,x).includes(C)))!=null?l:e.peek();if(f==null)break;o.push(f);let ft=r(this,Y).call(this,f).map(C=>r(this,M).get(C.markerId)).filter(C=>C!=null);s.push(ft)}return m(this,x,o),s}destroy(){r(this,M).clear(),r(this,E).clear(),m(this,x,[])}};D=new WeakMap,b=new WeakMap,E=new WeakMap,M=new WeakMap,x=new WeakMap,$=new WeakMap,Y=new WeakMap,i(tt,"ScreenDistanceClustering");var N=tt;var I,p,d,u,S,_,F,K,G,J,U,q,L,T,k,O,A,rt=class rt{constructor(t,e,s){c(this,"id",Q());a(this,I);a(this,p);a(this,d);a(this,u,{singleMarkersById:new Map,clustersById:new Map,clusterMarkersByClusterId:new Map,debugMarkersByClusterId:new Map,debugColorsByClusterId:new Map});a(this,S);a(this,_);a(this,F,i(()=>[...r(this,u).singleMarkersById.values()],"#getMarkers"));a(this,K,i(t=>{r(this,p).updateState(t,{enabled:!1})},"#hideMarker"));a(this,G,i(t=>{r(this,p).updateState(t,{enabled:!0})},"#showMarker"));a(this,J,i(()=>{let t=r(this,d).algorithm;return t.load(r(this,F).call(this)),t.getClusters()},"#getClusteredMarkers"));a(this,U,i(t=>{var s;let e=ct(t.map(o=>o.target.anchorTarget),(s=r(this,d).floor)==null?void 0:s.id);return{id:dt(t,e),markers:t,center:e}},"#createCluster"));a(this,q,i(t=>{var o;let e=(o=r(this,u).debugColorsByClusterId.get(t.id))!=null?o:V[0],s=r(this,S).call(this,t);s!=null&&r(this,u).clusterMarkersByClusterId.set(t.id,s);for(let l of t.markers)r(this,d).debug&&(l.contentEl.style.outline="2px solid ".concat(e)),r(this,d).hideClusteredMarkers&&r(this,K).call(this,l);if(r(this,d).debug){(s==null?void 0:s.contentEl.firstChild)instanceof HTMLElement&&(s.contentEl.firstChild.style.opacity="0.25");let l=r(this,p).Markers.add(t.center,ut(t.markers.length.toString(),e,20),{rank:"always-visible",zIndex:99});r(this,u).debugMarkersByClusterId.set(t.id,l)}},"#addClusterMarkers"));a(this,L,i(t=>{let e=r(this,u).clusterMarkersByClusterId.get(t.id);if(e!=null&&(r(this,p).Markers.remove(e),r(this,u).clusterMarkersByClusterId.delete(t.id)),r(this,d).debug){let s=r(this,u).debugMarkersByClusterId.get(t.id);s!=null&&(r(this,p).Markers.remove(s),r(this,u).debugMarkersByClusterId.delete(t.id))}for(let s of t.markers)r(this,G).call(this,s)},"#removeClusterMarkers"));a(this,T,i(()=>{let t=new Map(r(this,u).clustersById),e=[],s=r(this,J).call(this);for(let o=0;o<s.length;o++){let l=s[o];if(l.length<r(this,d).minSize)continue;let f=r(this,U).call(this,l);r(this,u).clustersById.has(f.id)?t.delete(f.id):e.push(f)}for(let o of t.values())r(this,L).call(this,o),r(this,u).clustersById.delete(o.id),r(this,d).debug&&r(this,u).debugColorsByClusterId.delete(o.id);for(let o of e){if(r(this,d).debug){let l=V[Math.floor(Math.random()*V.length)];r(this,u).debugColorsByClusterId.set(o.id,l)}r(this,q).call(this,o),r(this,u).clustersById.set(o.id,o)}},"#updateImmediately"));a(this,k,i(()=>{r(this,d).debounce===0?r(this,T).call(this):r(this,_).call(this)},"#update"));a(this,O,i(()=>{r(this,k).call(this)},"#handleCameraChange"));a(this,A,i(()=>{r(this,T).call(this)},"#handleFocus"));c(this,"add",i(t=>{var e,s;if(r(this,d).floor==null)r(this,d).floor=(s=r(this,I).getById("floor",(e=t.target.anchorTarget.floorId)!=null?e:""))!=null?s:null;else if(r(this,d).floor.id!==t.target.anchorTarget.floorId)throw new Error("Cannot cluster markers on different floors!");r(this,u).singleMarkersById.set(t.id,t),r(this,k).call(this)},"add"));c(this,"remove",i(t=>{if(!r(this,u).singleMarkersById.has(t.id)){v.log("Cannot remove marker ".concat(t.id," because it is not in the cluster!"));return}r(this,u).singleMarkersById.delete(t.id),r(this,k).call(this)},"remove"));c(this,"has",i(t=>r(this,u).singleMarkersById.has(t.id),"has"));c(this,"destroy",i(()=>{r(this,d).algorithm.destroy(),r(this,p).off("camera-change",r(this,O)),window.removeEventListener("focus",r(this,A));for(let[,t]of r(this,u).clustersById)r(this,L).call(this,t);for(let t of Object.values(r(this,u)))if(t instanceof Map)t.clear();else throw new Error("Encountered unexpected data type in cache! Potentially failed to clean up MarkerCluster.")},"destroy"));var l,f;let o;if((s==null?void 0:s.algorithm)==null){let z=new N(t);z.setOptions((l=s==null?void 0:s.algorithmOptions)!=null?l:{}),o=z}else o=s.algorithm,o.setOptions((f=s==null?void 0:s.algorithmOptions)!=null?f:{});if(m(this,d,P(y({floor:null,minSize:2,debounce:50,debug:!1,hideClusteredMarkers:!0},s),{algorithm:o})),m(this,p,t),m(this,I,Object.values(r(this,p).getMapData())[0]),r(this,I)==null)throw new Error("No map data found in MapView!");m(this,S,e),m(this,_,at(r(this,T),r(this,d).debounce)),r(this,p).on("camera-change",r(this,O)),window.addEventListener("focus",r(this,A))}get clusters(){return[...r(this,u).clustersById.values()]}};I=new WeakMap,p=new WeakMap,d=new WeakMap,u=new WeakMap,S=new WeakMap,_=new WeakMap,F=new WeakMap,K=new WeakMap,G=new WeakMap,J=new WeakMap,U=new WeakMap,q=new WeakMap,L=new WeakMap,T=new WeakMap,k=new WeakMap,O=new WeakMap,A=new WeakMap,i(rt,"MarkerCluster");var et=rt;export{et as MarkerCluster,w as PointRBush,N as ScreenDistanceClustering};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mappedin/marker-cluster",
3
- "version": "6.0.1-beta.47",
3
+ "version": "6.0.1-beta.49",
4
4
  "homepage": "https://developer.mappedin.com/",
5
5
  "private": false,
6
6
  "main": "lib/esm/index.js",
@@ -30,5 +30,5 @@
30
30
  "volta": {
31
31
  "extends": "../../package.json"
32
32
  },
33
- "gitHead": "a26145ebd6397dbdcbe07726be9b6c230d881360"
33
+ "gitHead": "5d18cd3142a8ef7284601cb6b181a242d7ab30da"
34
34
  }