@geolonia/embed 2.0.0-pre.3 → 2.0.0

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/package.json CHANGED
@@ -1,16 +1,13 @@
1
1
  {
2
2
  "name": "@geolonia/embed",
3
- "version": "2.0.0-pre.3",
3
+ "version": "2.0.0",
4
4
  "description": "Geolonia embed JS API",
5
5
  "main": "dist/embed.js",
6
6
  "types": "src/embed.d.ts",
7
7
  "scripts": {
8
- "analyze": "webpack --mode production --config ./webpack.analyze.config.js",
9
- "start": "webpack serve --mode development --config ./docs/webpack.config.js",
10
- "start:deck": "webpack serve --mode development --config ./docs/webpack.deck-config.js",
11
- "build": "npm run build:embed && npm run build:docs",
12
- "build:docs": "rimraf docs/embed docs/embed-chunks && webpack --mode production --config ./docs/webpack.config.js",
13
- "build:embed": "rimraf dist && webpack --mode production --config ./webpack.config.js && cp ./dist/embed ./dist/embed.js",
8
+ "start": "webpack serve --config ./docs/webpack.config.js",
9
+ "build": "webpack --mode production && cp ./dist/embed.js ./dist/embed && cp -r ./dist/* ./docs/",
10
+ "analyze": "ANALYZE=true webpack --mode production",
14
11
  "format": "prettier-eslint \"./src/**/*.js\" --write",
15
12
  "lint": "eslint \"src/**/*.js\"",
16
13
  "test": "npm run lint && mocha ./src/**/*.test.js --recursive -r jsdom-global/register -r @babel/register",
@@ -44,7 +41,6 @@
44
41
  "prettier-eslint": "^12.0.0",
45
42
  "prettier-eslint-cli": "^5.0.0",
46
43
  "puppeteer": "^9.1.1",
47
- "rimraf": "^3.0.2",
48
44
  "style-loader": "^0.23.1",
49
45
  "svg-inline-loader": "^0.8.2",
50
46
  "webpack": "^5.59.1",
package/src/embed.js CHANGED
@@ -13,11 +13,13 @@ import * as util from './lib/util';
13
13
  import parseAtts from './lib/parse-atts';
14
14
  import parseApiKey from './lib/parse-api-key';
15
15
  import pkg from '../package.json';
16
+ import simpleStyle from './lib/simplestyle';
16
17
 
17
18
  if ( util.checkPermission() ) {
18
19
  let isDOMContentLoaded = false;
19
20
  const alreadyRenderedMaps = [];
20
21
  const plugins = [];
22
+ const isRemoved = Symbol('map-is-removed');
21
23
 
22
24
  /**
23
25
  *
@@ -26,9 +28,14 @@ if ( util.checkPermission() ) {
26
28
  const renderGeoloniaMap = (target) => {
27
29
  const map = new GeoloniaMap(target);
28
30
 
31
+ // detect if the map removed manually
32
+ map.on('remove', () => {
33
+ map[isRemoved] = true;
34
+ });
35
+
29
36
  // plugin
30
37
  const atts = parseAtts(target);
31
- if (isDOMContentLoaded) {
38
+ if (isDOMContentLoaded && !map[isRemoved]) {
32
39
  plugins.forEach((plugin) => plugin(map, target, atts));
33
40
  } else {
34
41
  alreadyRenderedMaps.push({ map, target: target, atts });
@@ -37,9 +44,11 @@ if ( util.checkPermission() ) {
37
44
 
38
45
  document.addEventListener('DOMContentLoaded', () => {
39
46
  isDOMContentLoaded = true;
40
- alreadyRenderedMaps.forEach(({ map, target, atts }) =>
41
- plugins.forEach((plugin) => plugin(map, target, atts)),
42
- );
47
+ alreadyRenderedMaps.forEach(({ map, target, atts }) => {
48
+ if (!map[isRemoved]) {
49
+ plugins.forEach((plugin) => plugin(map, target, atts));
50
+ }
51
+ });
43
52
  // clear
44
53
  alreadyRenderedMaps.splice(0, alreadyRenderedMaps.length);
45
54
  });
@@ -69,6 +78,7 @@ if ( util.checkPermission() ) {
69
78
  }
70
79
 
71
80
  window.geolonia.Map = GeoloniaMap;
81
+ window.geolonia.simpleStyle = simpleStyle;
72
82
  window.geolonia.Marker = GeoloniaMarker;
73
83
  window.geolonia.AmazonLocationServiceMapProvider = AmazonLocationServiceMapProvider;
74
84
  window.geolonia.embedVersion = pkg.version;
@@ -15,6 +15,7 @@ class SimpleStyle {
15
15
  this.json = json;
16
16
 
17
17
  this.options = {
18
+ id: 'geolonia-simple-style',
18
19
  cluster: true,
19
20
  heatmap: false,
20
21
  clusterColor: '#ff0000',
@@ -22,12 +23,16 @@ class SimpleStyle {
22
23
  };
23
24
  }
24
25
 
26
+ getLayerId() {
27
+ return this.options.id;
28
+ }
29
+
25
30
  addTo(map) {
26
31
  const features = this.json.features;
27
32
  const polygonandlines = features.filter((feature) => (feature.geometry.type.toLowerCase() !== 'point'));
28
33
  const points = features.filter((feature) => (feature.geometry.type.toLowerCase() === 'point'));
29
34
 
30
- map.addSource('geolonia-simple-style', {
35
+ map.addSource(this.options.id, {
31
36
  type: 'geojson',
32
37
  data: {
33
38
  type: 'FeatureCollection',
@@ -38,7 +43,7 @@ class SimpleStyle {
38
43
  this.setPolygonGeometries(map);
39
44
  this.setLineGeometries(map);
40
45
 
41
- map.addSource('geolonia-simple-style-points', {
46
+ map.addSource(`${this.options.id}-points`, {
42
47
  type: 'geojson',
43
48
  data: {
44
49
  type: 'FeatureCollection',
@@ -50,9 +55,9 @@ class SimpleStyle {
50
55
  });
51
56
 
52
57
  map.addLayer({
53
- id: 'geolonia-simple-style-polygon-symbol',
58
+ id: `${this.options.id}-polygon-symbol`,
54
59
  type: 'symbol',
55
- source: 'geolonia-simple-style',
60
+ source: this.options.id,
56
61
  filter: ['==', '$type', 'Polygon'],
57
62
  paint: {
58
63
  'text-color': ['string', ['get', 'text-color'], textColor],
@@ -69,9 +74,9 @@ class SimpleStyle {
69
74
  });
70
75
 
71
76
  map.addLayer({
72
- id: 'geolonia-simple-style-linestring-symbol',
77
+ id: `${this.options.id}-linestring-symbol`,
73
78
  type: 'symbol',
74
- source: 'geolonia-simple-style',
79
+ source: this.options.id,
75
80
  filter: ['==', '$type', 'LineString'],
76
81
  paint: {
77
82
  'text-color': ['string', ['get', 'text-color'], textColor],
@@ -109,9 +114,9 @@ class SimpleStyle {
109
114
  */
110
115
  setPolygonGeometries(map) {
111
116
  map.addLayer({
112
- id: 'geolonia-simple-style-polygon',
117
+ id: `${this.options.id}-polygon`,
113
118
  type: 'fill',
114
- source: 'geolonia-simple-style',
119
+ source: this.options.id,
115
120
  filter: ['==', '$type', 'Polygon'],
116
121
  paint: {
117
122
  'fill-color': ['string', ['get', 'fill'], backgroundColor],
@@ -120,7 +125,7 @@ class SimpleStyle {
120
125
  },
121
126
  });
122
127
 
123
- this.setPopup(map, 'geolonia-simple-style-polygon');
128
+ this.setPopup(map, `${this.options.id}-polygon`);
124
129
  }
125
130
 
126
131
  /**
@@ -130,9 +135,9 @@ class SimpleStyle {
130
135
  */
131
136
  setLineGeometries(map) {
132
137
  map.addLayer({
133
- id: 'geolonia-simple-style-linestring',
138
+ id: `${this.options.id}-linestring`,
134
139
  type: 'line',
135
- source: 'geolonia-simple-style',
140
+ source: this.options.id,
136
141
  filter: ['==', '$type', 'LineString'],
137
142
  paint: {
138
143
  'line-width': ['number', ['get', 'stroke-width'], 2],
@@ -145,7 +150,7 @@ class SimpleStyle {
145
150
  },
146
151
  });
147
152
 
148
- this.setPopup(map, 'geolonia-simple-style-linestring');
153
+ this.setPopup(map, `${this.options.id}-linestring`);
149
154
  }
150
155
 
151
156
  /**
@@ -157,7 +162,7 @@ class SimpleStyle {
157
162
  map.addLayer({
158
163
  id: 'circle-simple-style-points',
159
164
  type: 'circle',
160
- source: 'geolonia-simple-style-points',
165
+ source: `${this.options.id}-points`,
161
166
  filter: ['!', ['has', 'point_count']],
162
167
  paint: {
163
168
  'circle-radius': [
@@ -175,9 +180,9 @@ class SimpleStyle {
175
180
  });
176
181
 
177
182
  map.addLayer({
178
- id: 'symbol-simple-style-points',
183
+ id: `${this.options.id}-symbol-points`,
179
184
  type: 'symbol',
180
- source: 'geolonia-simple-style-points',
185
+ source: `${this.options.id}-points`,
181
186
  filter: ['!', ['has', 'point_count']],
182
187
  paint: {
183
188
  'text-color': ['string', ['get', 'text-color'], textColor],
@@ -236,9 +241,9 @@ class SimpleStyle {
236
241
  */
237
242
  setCluster(map) {
238
243
  map.addLayer({
239
- id: 'clusters',
244
+ id: `${this.options.id}-clusters`,
240
245
  type: 'circle',
241
- source: 'geolonia-simple-style-points',
246
+ source: `${this.options.id}-points`,
242
247
  filter: ['has', 'point_count'],
243
248
  paint: {
244
249
  'circle-radius': 20,
@@ -248,9 +253,9 @@ class SimpleStyle {
248
253
  });
249
254
 
250
255
  map.addLayer({
251
- id: 'cluster-count',
256
+ id: `${this.options.id}-cluster-count`,
252
257
  type: 'symbol',
253
- source: 'geolonia-simple-style-points',
258
+ source: `${this.options.id}-points`,
254
259
  filter: ['has', 'point_count'],
255
260
  layout: {
256
261
  'text-field': '{point_count_abbreviated}',
@@ -259,8 +264,8 @@ class SimpleStyle {
259
264
  },
260
265
  });
261
266
 
262
- map.on('click', 'clusters', (e) => {
263
- const features = map.queryRenderedFeatures(e.point, { layers: ['clusters'] });
267
+ map.on('click', `${this.options.id}-clusters`, (e) => {
268
+ const features = map.queryRenderedFeatures(e.point, { layers: [`${this.options.id}-clusters`] });
264
269
  const clusterId = features[0].properties.cluster_id;
265
270
  map.getSource('geolonia-simple-style-points').getClusterExpansionZoom(clusterId, (err, zoom) => {
266
271
  if (err)
@@ -273,11 +278,11 @@ class SimpleStyle {
273
278
  });
274
279
  });
275
280
 
276
- map.on('mouseenter', 'clusters', () => {
281
+ map.on('mouseenter', `${this.options.id}-clusters`, () => {
277
282
  map.getCanvas().style.cursor = 'pointer';
278
283
  });
279
284
 
280
- map.on('mouseleave', 'clusters', () => {
285
+ map.on('mouseleave', `${this.options.id}-clusters`, () => {
281
286
  map.getCanvas().style.cursor = '';
282
287
  });
283
288
  }
@@ -27,6 +27,7 @@ describe('Tests for Maps.', () => {
27
27
 
28
28
  // prepare pupeteer
29
29
  browser = await puppeteer.launch({
30
+ headless: true,
30
31
  args:
31
32
  process.env.NO_SANDBOX === 'true'
32
33
  ? ['--no-sandbox', '--disable-setuid-sandbox'] // for Docker env
@@ -41,7 +42,7 @@ describe('Tests for Maps.', () => {
41
42
  const content = template
42
43
  .replace(/%ORIGIN%/g, 'http://127.0.0.1:8080')
43
44
  .replace(/%API_KEY%/g, process.env.GEOLONIA_API_KEY || 'YOUR-API-KEY')
44
- await page.goto('https://geolonia.com')
45
+ await page.goto('https://geoloniamaps.github.io/basic/')
45
46
  page.on('pageerror', error => capturedErrors.push(error))
46
47
  await page.setContent(content)
47
48
  await sleep(15000)
package/webpack.config.js CHANGED
@@ -1,12 +1,15 @@
1
1
  const path = require('path');
2
+ const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
2
3
 
3
4
  module.exports = {
4
5
  entry: './src/embed.js',
5
6
  output: {
6
7
  path: path.join(__dirname, 'dist'),
7
- filename: 'embed',
8
+ filename: 'embed.js',
8
9
  chunkFilename: path.join('embed-chunks', '[chunkhash].js'),
10
+ clean: true,
9
11
  },
12
+ plugins: process.env.ANALYZE === 'true' ? [new BundleAnalyzerPlugin()] : [],
10
13
  module: {
11
14
  rules: [
12
15
  {
@@ -1 +0,0 @@
1
- (self.webpackChunk_geolonia_embed=self.webpackChunk_geolonia_embed||[]).push([[337],{6613:e=>{function t(e){if(!(this instanceof t))return new t(e);this._bbox=e||[1/0,1/0,-1/0,-1/0],this._valid=!!e}e.exports=t,t.prototype.include=function(e){return this._valid=!0,this._bbox[0]=Math.min(this._bbox[0],e[0]),this._bbox[1]=Math.min(this._bbox[1],e[1]),this._bbox[2]=Math.max(this._bbox[2],e[0]),this._bbox[3]=Math.max(this._bbox[3],e[1]),this},t.prototype.equals=function(e){var o;return o=e instanceof t?e.bbox():e,this._bbox[0]==o[0]&&this._bbox[1]==o[1]&&this._bbox[2]==o[2]&&this._bbox[3]==o[3]},t.prototype.center=function(e){return this._valid?[(this._bbox[0]+this._bbox[2])/2,(this._bbox[1]+this._bbox[3])/2]:null},t.prototype.union=function(e){var o;return this._valid=!0,o=e instanceof t?e.bbox():e,this._bbox[0]=Math.min(this._bbox[0],o[0]),this._bbox[1]=Math.min(this._bbox[1],o[1]),this._bbox[2]=Math.max(this._bbox[2],o[2]),this._bbox[3]=Math.max(this._bbox[3],o[3]),this},t.prototype.bbox=function(){return this._valid?this._bbox:null},t.prototype.contains=function(e){if(!e)return this._fastContains();if(!this._valid)return null;var t=e[0],o=e[1];return this._bbox[0]<=t&&this._bbox[1]<=o&&this._bbox[2]>=t&&this._bbox[3]>=o},t.prototype.intersect=function(e){return this._valid?(o=e instanceof t?e.bbox():e,!(this._bbox[0]>o[2]||this._bbox[2]<o[0]||this._bbox[3]<o[1]||this._bbox[1]>o[3])):null;var o},t.prototype._fastContains=function(){if(!this._valid)return new Function("return null;");var e="return "+this._bbox[0]+"<= ll[0] &&"+this._bbox[1]+"<= ll[1] &&"+this._bbox[2]+">= ll[0] &&"+this._bbox[3]+">= ll[1]";return new Function("ll",e)},t.prototype.polygon=function(){return this._valid?{type:"Polygon",coordinates:[[[this._bbox[0],this._bbox[1]],[this._bbox[2],this._bbox[1]],[this._bbox[2],this._bbox[3]],[this._bbox[0],this._bbox[3]],[this._bbox[0],this._bbox[1]]]]}:null}},7829:e=>{e.exports=function(e){return function e(t){return Array.isArray(t)&&t.length&&"number"==typeof t[0]?[t]:t.reduce((function(t,o){return Array.isArray(o)&&Array.isArray(o[0])?t.concat(e(o)):(t.push(o),t)}),[])}(e)}},4506:(e,t,o)=>{var r=o(9340),n=o(11),i=o(7829);e.exports=function(e){if(!e)return[];var t=n(r(e)),o=[];return t.features.forEach((function(e){e.geometry&&(o=o.concat(i(e.geometry.coordinates)))})),o}},9319:(e,t,o)=>{var r=o(4506),n=o(3692),i=o(6613),s={features:["FeatureCollection"],coordinates:["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],geometry:["Feature"],geometries:["GeometryCollection"]},l=Object.keys(s);function a(e){for(var t=i(),o=r(e),n=0;n<o.length;n++)t.include(o[n]);return t}e.exports=function(e){return a(e).bbox()},e.exports.polygon=function(e){return a(e).polygon()},e.exports.bboxify=function(e){return n(e).map((function(e){e&&l.some((function(t){return!!e[t]&&-1!==s[t].indexOf(e.type)}))&&(e.bbox=a(e).bbox(),this.update(e))}))}},9340:e=>{e.exports=function(e){if(!e||!e.type)return null;var o=t[e.type];return o?"geometry"===o?{type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:e}]}:"feature"===o?{type:"FeatureCollection",features:[e]}:"featurecollection"===o?e:void 0:null};var t={Point:"geometry",MultiPoint:"geometry",LineString:"geometry",MultiLineString:"geometry",Polygon:"geometry",MultiPolygon:"geometry",GeometryCollection:"geometry",Feature:"feature",FeatureCollection:"featurecollection"}},8714:(e,t,o)=>{"use strict";o.r(t),o.d(t,{default:()=>d}),o(7327),o(2526),o(1817),o(9070),o(7941),o(5003),o(9554),o(4747),o(9337),o(3321);var r=o(2739),n=o.n(r),i=o(9319),s=o.n(i),l=o(1235),a=o(8007),u=o.n(a);function c(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,r)}return o}function p(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function f(e,t){for(var o=0;o<t.length;o++){var r=t[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var y="#000000",b="#FFFFFF",h="rgba(255, 0, 0, 0.4)",g="#FFFFFF";const d=function(){function e(t,o){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.json=t,this.options=function(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?c(Object(o),!0).forEach((function(t){p(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):c(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}({cluster:!0,heatmap:!1,clusterColor:"#ff0000"},o)}var t,o;return t=e,(o=[{key:"addTo",value:function(e){var t=this.json.features,o=t.filter((function(e){return"point"!==e.geometry.type.toLowerCase()})),r=t.filter((function(e){return"point"===e.geometry.type.toLowerCase()}));e.addSource("geolonia-simple-style",{type:"geojson",data:{type:"FeatureCollection",features:o}}),this.setPolygonGeometries(e),this.setLineGeometries(e),e.addSource("geolonia-simple-style-points",{type:"geojson",data:{type:"FeatureCollection",features:r},cluster:this.options.cluster,clusterMaxZoom:14,clusterRadius:50}),e.addLayer({id:"geolonia-simple-style-polygon-symbol",type:"symbol",source:"geolonia-simple-style",filter:["==","$type","Polygon"],paint:{"text-color":["string",["get","text-color"],y],"text-halo-color":["string",["get","text-halo-color"],b],"text-halo-width":1},layout:{"text-field":["get","title"],"text-font":["Noto Sans Regular"],"text-size":12,"text-max-width":12,"text-allow-overlap":!1}}),e.addLayer({id:"geolonia-simple-style-linestring-symbol",type:"symbol",source:"geolonia-simple-style",filter:["==","$type","LineString"],paint:{"text-color":["string",["get","text-color"],y],"text-halo-color":["string",["get","text-halo-color"],b],"text-halo-width":1},layout:{"symbol-placement":"line","text-field":["get","title"],"text-font":["Noto Sans Regular"],"text-size":12,"text-max-width":12,"text-allow-overlap":!1}}),this.setPointGeometries(e),this.setCluster(e);var n=e.getContainer();if(!n.dataset||!n.dataset.lng&&!n.dataset.lat){var i=s()(this.json);e.fitBounds(i,{duration:0,padding:30})}}},{key:"setPolygonGeometries",value:function(e){e.addLayer({id:"geolonia-simple-style-polygon",type:"fill",source:"geolonia-simple-style",filter:["==","$type","Polygon"],paint:{"fill-color":["string",["get","fill"],h],"fill-opacity":["number",["get","fill-opacity"],1],"fill-outline-color":["string",["get","stroke"],g]}}),this.setPopup(e,"geolonia-simple-style-polygon")}},{key:"setLineGeometries",value:function(e){e.addLayer({id:"geolonia-simple-style-linestring",type:"line",source:"geolonia-simple-style",filter:["==","$type","LineString"],paint:{"line-width":["number",["get","stroke-width"],2],"line-color":["string",["get","stroke"],h],"line-opacity":["number",["get","stroke-opacity"],1]},layout:{"line-cap":"round","line-join":"round"}}),this.setPopup(e,"geolonia-simple-style-linestring")}},{key:"setPointGeometries",value:function(e){e.addLayer({id:"circle-simple-style-points",type:"circle",source:"geolonia-simple-style-points",filter:["!",["has","point_count"]],paint:{"circle-radius":["case",["==","small",["get","marker-size"]],7,["==","large",["get","marker-size"]],13,9],"circle-color":["string",["get","marker-color"],h],"circle-opacity":["number",["get","fill-opacity"],1],"circle-stroke-width":["number",["get","stroke-width"],1],"circle-stroke-color":["string",["get","stroke"],g],"circle-stroke-opacity":["number",["get","stroke-opacity"],1]}}),e.addLayer({id:"symbol-simple-style-points",type:"symbol",source:"geolonia-simple-style-points",filter:["!",["has","point_count"]],paint:{"text-color":["string",["get","text-color"],y],"text-halo-color":["string",["get","text-halo-color"],b],"text-halo-width":1},layout:{"icon-image":["case",["==","large",["get","marker-size"]],["image",["concat",["get","marker-symbol"],"-15"]],["image",["concat",["get","marker-symbol"],"-11"]]],"text-field":["get","title"],"text-font":["Noto Sans Regular"],"text-size":12,"text-anchor":"top","text-max-width":12,"text-offset":["case",["==","small",["get","marker-size"]],["literal",[0,.6]],["==","large",["get","marker-size"]],["literal",[0,1.2]],["literal",[0,.8]]],"text-allow-overlap":!1}}),this.setPopup(e,"circle-simple-style-points")}},{key:"setPopup",value:function(e,t){e.on("click",t,(function(t){var o=(0,l.Z)(t.features[0]).geometry.coordinates,r=t.features[0].properties.description;r&&(new(n().Popup)).setLngLat(o).setHTML(u()(r)).addTo(e)})),e.on("mouseenter",t,(function(t){t.features[0].properties.description&&(e.getCanvas().style.cursor="pointer")})),e.on("mouseleave",t,(function(){e.getCanvas().style.cursor=""}))}},{key:"setCluster",value:function(e){e.addLayer({id:"clusters",type:"circle",source:"geolonia-simple-style-points",filter:["has","point_count"],paint:{"circle-radius":20,"circle-color":this.options.clusterColor,"circle-opacity":1}}),e.addLayer({id:"cluster-count",type:"symbol",source:"geolonia-simple-style-points",filter:["has","point_count"],layout:{"text-field":"{point_count_abbreviated}","text-size":14,"text-font":["Noto Sans Regular"]}}),e.on("click","clusters",(function(t){var o=e.queryRenderedFeatures(t.point,{layers:["clusters"]}),r=o[0].properties.cluster_id;e.getSource("geolonia-simple-style-points").getClusterExpansionZoom(r,(function(t,r){t||e.easeTo({center:o[0].geometry.coordinates,zoom:r})}))})),e.on("mouseenter","clusters",(function(){e.getCanvas().style.cursor="pointer"})),e.on("mouseleave","clusters",(function(){e.getCanvas().style.cursor=""}))}}])&&f(t.prototype,o),e}()},11:e=>{e.exports=function e(t){switch(t&&t.type||null){case"FeatureCollection":return t.features=t.features.reduce((function(t,o){return t.concat(e(o))}),[]),t;case"Feature":return t.geometry?e(t.geometry).map((function(e){var o={type:"Feature",properties:JSON.parse(JSON.stringify(t.properties)),geometry:e};return void 0!==t.id&&(o.id=t.id),o})):t;case"MultiPoint":return t.coordinates.map((function(e){return{type:"Point",coordinates:e}}));case"MultiPolygon":return t.coordinates.map((function(e){return{type:"Polygon",coordinates:e}}));case"MultiLineString":return t.coordinates.map((function(e){return{type:"LineString",coordinates:e}}));case"GeometryCollection":return t.geometries.map(e).reduce((function(e,t){return e.concat(t)}),[]);case"Point":case"Polygon":case"LineString":return[t]}}},3692:e=>{var t=e.exports=function(e){return new o(e)};function o(e){this.value=e}function r(e,t,o){var r=[],s=[],c=!0;return function e(p){var f=o?n(p):p,y={},b=!0,h={node:f,node_:p,path:[].concat(r),parent:s[s.length-1],parents:s,key:r.slice(-1)[0],isRoot:0===r.length,level:r.length,circular:null,update:function(e,t){h.isRoot||(h.parent.node[h.key]=e),h.node=e,t&&(b=!1)},delete:function(e){delete h.parent.node[h.key],e&&(b=!1)},remove:function(e){l(h.parent.node)?h.parent.node.splice(h.key,1):delete h.parent.node[h.key],e&&(b=!1)},keys:null,before:function(e){y.before=e},after:function(e){y.after=e},pre:function(e){y.pre=e},post:function(e){y.post=e},stop:function(){c=!1},block:function(){b=!1}};if(!c)return h;function g(){if("object"==typeof h.node&&null!==h.node){h.keys&&h.node_===h.node||(h.keys=i(h.node)),h.isLeaf=0==h.keys.length;for(var e=0;e<s.length;e++)if(s[e].node_===p){h.circular=s[e];break}}else h.isLeaf=!0,h.keys=null;h.notLeaf=!h.isLeaf,h.notRoot=!h.isRoot}g();var d=t.call(h,h.node);return void 0!==d&&h.update&&h.update(d),y.before&&y.before.call(h,h.node),b?("object"!=typeof h.node||null===h.node||h.circular||(s.push(h),g(),a(h.keys,(function(t,n){r.push(t),y.pre&&y.pre.call(h,h.node[t],t);var i=e(h.node[t]);o&&u.call(h.node,t)&&(h.node[t]=i.node),i.isLast=n==h.keys.length-1,i.isFirst=0==n,y.post&&y.post.call(h,i),r.pop()})),s.pop()),y.after&&y.after.call(h,h.node),h):h}(e).node}function n(e){if("object"==typeof e&&null!==e){var t;if(l(e))t=[];else if("[object Date]"===s(e))t=new Date(e.getTime?e.getTime():e);else if("[object RegExp]"===s(e))t=new RegExp(e);else if(function(e){return"[object Error]"===s(e)}(e))t={message:e.message};else if(function(e){return"[object Boolean]"===s(e)}(e))t=new Boolean(e);else if(function(e){return"[object Number]"===s(e)}(e))t=new Number(e);else if(function(e){return"[object String]"===s(e)}(e))t=new String(e);else if(Object.create&&Object.getPrototypeOf)t=Object.create(Object.getPrototypeOf(e));else if(e.constructor===Object)t={};else{var o=e.constructor&&e.constructor.prototype||e.__proto__||{},r=function(){};r.prototype=o,t=new r}return a(i(e),(function(o){t[o]=e[o]})),t}return e}o.prototype.get=function(e){for(var t=this.value,o=0;o<e.length;o++){var r=e[o];if(!t||!u.call(t,r)){t=void 0;break}t=t[r]}return t},o.prototype.has=function(e){for(var t=this.value,o=0;o<e.length;o++){var r=e[o];if(!t||!u.call(t,r))return!1;t=t[r]}return!0},o.prototype.set=function(e,t){for(var o=this.value,r=0;r<e.length-1;r++){var n=e[r];u.call(o,n)||(o[n]={}),o=o[n]}return o[e[r]]=t,t},o.prototype.map=function(e){return r(this.value,e,!0)},o.prototype.forEach=function(e){return this.value=r(this.value,e,!1),this.value},o.prototype.reduce=function(e,t){var o=1===arguments.length,r=o?this.value:t;return this.forEach((function(t){this.isRoot&&o||(r=e.call(this,r,t))})),r},o.prototype.paths=function(){var e=[];return this.forEach((function(t){e.push(this.path)})),e},o.prototype.nodes=function(){var e=[];return this.forEach((function(t){e.push(this.node)})),e},o.prototype.clone=function(){var e=[],t=[];return function o(r){for(var s=0;s<e.length;s++)if(e[s]===r)return t[s];if("object"==typeof r&&null!==r){var l=n(r);return e.push(r),t.push(l),a(i(r),(function(e){l[e]=o(r[e])})),e.pop(),t.pop(),l}return r}(this.value)};var i=Object.keys||function(e){var t=[];for(var o in e)t.push(o);return t};function s(e){return Object.prototype.toString.call(e)}var l=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},a=function(e,t){if(e.forEach)return e.forEach(t);for(var o=0;o<e.length;o++)t(e[o],o,e)};a(i(o.prototype),(function(e){t[e]=function(t){var r=[].slice.call(arguments,1),n=new o(t);return n[e].apply(n,r)}}));var u=Object.hasOwnProperty||function(e,t){return t in e}},2868:()=>{},4777:()=>{},9830:()=>{},209:()=>{},7414:()=>{}}]);