vue3-google-map 0.14.1 → 0.16.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.
Files changed (38) hide show
  1. package/README.md +57 -0
  2. package/dist/index.cjs.js +20 -0
  3. package/dist/index.es.js +1568 -0
  4. package/dist/index.umd.js +20 -0
  5. package/dist/themes/index.cjs.js +1 -0
  6. package/dist/themes/index.es.js +1294 -0
  7. package/dist/types/@types/index.d.ts +4 -4
  8. package/dist/types/components/Circle.d.ts +18 -13
  9. package/dist/types/components/CustomControl.vue.d.ts +28 -20
  10. package/dist/types/components/CustomMarker.vue.d.ts +22 -19
  11. package/dist/types/components/GoogleMap.vue.d.ts +409 -263
  12. package/dist/types/components/HeatmapLayer.d.ts +24 -21
  13. package/dist/types/components/InfoWindow.vue.d.ts +24 -17
  14. package/dist/types/components/Marker.d.ts +18 -13
  15. package/dist/types/components/MarkerCluster.d.ts +22 -15
  16. package/dist/types/components/Polygon.d.ts +18 -13
  17. package/dist/types/components/Polyline.d.ts +18 -13
  18. package/dist/types/components/Rectangle.d.ts +18 -13
  19. package/dist/types/components/index.d.ts +11 -11
  20. package/dist/types/composables/index.d.ts +1 -1
  21. package/dist/types/composables/useSetupMapComponent.d.ts +10 -10
  22. package/dist/types/index.d.ts +1 -3
  23. package/dist/types/shared/index.d.ts +14 -14
  24. package/dist/{themes/types → types/themes}/aubergine.d.ts +2 -2
  25. package/dist/{themes/types → types/themes}/dark.d.ts +6 -6
  26. package/dist/{themes/types → types/themes}/grey.d.ts +2 -2
  27. package/dist/{themes/types → types/themes}/index.d.ts +8 -8
  28. package/dist/{themes/types → types/themes}/minimal.d.ts +2 -2
  29. package/dist/{themes/types → types/themes}/retro.d.ts +2 -2
  30. package/dist/{themes/types → types/themes}/roadways.d.ts +2 -2
  31. package/dist/{themes/types → types/themes}/roadwaysMinimal.d.ts +2 -2
  32. package/dist/{themes/types → types/themes}/ultraLight.d.ts +2 -2
  33. package/dist/types/utils/index.d.ts +13 -13
  34. package/package.json +28 -43
  35. package/dist/cjs/index.js +0 -94
  36. package/dist/es/index.js +0 -87
  37. package/dist/themes/es/index.js +0 -28
  38. package/dist/types/shims-google-maps-d.d.ts +0 -15
@@ -0,0 +1,1568 @@
1
+ (function(){"use strict";try{if(typeof document<"u"){var d=document.createElement("style");d.appendChild(document.createTextNode(".mapdiv[data-v-7d660dd5]{width:100%;height:100%}.info-window-wrapper[data-v-45a4606d]{display:none}.mapdiv .info-window-wrapper[data-v-45a4606d]{display:inline-block}.custom-marker-wrapper[data-v-c7599d50]{display:none}.mapdiv .custom-marker-wrapper[data-v-c7599d50]{display:inline-block}")),document.head.appendChild(d)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
2
+ var Oe = Object.defineProperty;
3
+ var xe = (o, e, t) => e in o ? Oe(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
4
+ var V = (o, e, t) => (xe(o, typeof e != "symbol" ? e + "" : e, t), t);
5
+ import { defineComponent as k, ref as v, provide as q, watch as b, onMounted as ge, onBeforeUnmount as S, markRaw as M, toRef as L, openBlock as F, createElementBlock as G, createElementVNode as Y, renderSlot as U, normalizeProps as Pe, guardReactiveProps as Se, inject as y, computed as z, withDirectives as Le, vShow as Ie, Comment as ve, mergeProps as ye, createCommentVNode as Ce } from "vue";
6
+ const I = Symbol("map"), E = Symbol("api"), _e = Symbol("marker"), ke = Symbol("markerCluster"), H = Symbol("CustomMarker"), we = Symbol("mapTilesLoaded"), P = [
7
+ "click",
8
+ "dblclick",
9
+ "drag",
10
+ "dragend",
11
+ "dragstart",
12
+ "mousedown",
13
+ "mousemove",
14
+ "mouseout",
15
+ "mouseover",
16
+ "mouseup",
17
+ "rightclick"
18
+ ];
19
+ var Ee = function o(e, t) {
20
+ if (e === t)
21
+ return !0;
22
+ if (e && t && typeof e == "object" && typeof t == "object") {
23
+ if (e.constructor !== t.constructor)
24
+ return !1;
25
+ var n, s, r;
26
+ if (Array.isArray(e)) {
27
+ if (n = e.length, n != t.length)
28
+ return !1;
29
+ for (s = n; s-- !== 0; )
30
+ if (!o(e[s], t[s]))
31
+ return !1;
32
+ return !0;
33
+ }
34
+ if (e.constructor === RegExp)
35
+ return e.source === t.source && e.flags === t.flags;
36
+ if (e.valueOf !== Object.prototype.valueOf)
37
+ return e.valueOf() === t.valueOf();
38
+ if (e.toString !== Object.prototype.toString)
39
+ return e.toString() === t.toString();
40
+ if (r = Object.keys(e), n = r.length, n !== Object.keys(t).length)
41
+ return !1;
42
+ for (s = n; s-- !== 0; )
43
+ if (!Object.prototype.hasOwnProperty.call(t, r[s]))
44
+ return !1;
45
+ for (s = n; s-- !== 0; ) {
46
+ var a = r[s];
47
+ if (!o(e[a], t[a]))
48
+ return !1;
49
+ }
50
+ return !0;
51
+ }
52
+ return e !== e && t !== t;
53
+ };
54
+ const ne = "__googleMapsScriptId";
55
+ class O {
56
+ /**
57
+ * Creates an instance of Loader using [[LoaderOptions]]. No defaults are set
58
+ * using this library, instead the defaults are set by the Google Maps
59
+ * JavaScript API server.
60
+ *
61
+ * ```
62
+ * const loader = Loader({apiKey, version: 'weekly', libraries: ['places']});
63
+ * ```
64
+ */
65
+ constructor({ apiKey: e, channel: t, client: n, id: s = ne, libraries: r = [], language: a, region: l, version: i, mapIds: p, nonce: u, retries: c = 3, url: h = "https://maps.googleapis.com/maps/api/js" }) {
66
+ if (this.CALLBACK = "__googleMapsCallback", this.callbacks = [], this.done = !1, this.loading = !1, this.errors = [], this.version = i, this.apiKey = e, this.channel = t, this.client = n, this.id = s || ne, this.libraries = r, this.language = a, this.region = l, this.mapIds = p, this.nonce = u, this.retries = c, this.url = h, O.instance) {
67
+ if (!Ee(this.options, O.instance.options))
68
+ throw new Error(`Loader must not be called again with different options. ${JSON.stringify(this.options)} !== ${JSON.stringify(O.instance.options)}`);
69
+ return O.instance;
70
+ }
71
+ O.instance = this;
72
+ }
73
+ get options() {
74
+ return {
75
+ version: this.version,
76
+ apiKey: this.apiKey,
77
+ channel: this.channel,
78
+ client: this.client,
79
+ id: this.id,
80
+ libraries: this.libraries,
81
+ language: this.language,
82
+ region: this.region,
83
+ mapIds: this.mapIds,
84
+ nonce: this.nonce,
85
+ url: this.url
86
+ };
87
+ }
88
+ get failed() {
89
+ return this.done && !this.loading && this.errors.length >= this.retries + 1;
90
+ }
91
+ /**
92
+ * CreateUrl returns the Google Maps JavaScript API script url given the [[LoaderOptions]].
93
+ *
94
+ * @ignore
95
+ */
96
+ createUrl() {
97
+ let e = this.url;
98
+ return e += `?callback=${this.CALLBACK}`, this.apiKey && (e += `&key=${this.apiKey}`), this.channel && (e += `&channel=${this.channel}`), this.client && (e += `&client=${this.client}`), this.libraries.length > 0 && (e += `&libraries=${this.libraries.join(",")}`), this.language && (e += `&language=${this.language}`), this.region && (e += `&region=${this.region}`), this.version && (e += `&v=${this.version}`), this.mapIds && (e += `&map_ids=${this.mapIds.join(",")}`), e;
99
+ }
100
+ deleteScript() {
101
+ const e = document.getElementById(this.id);
102
+ e && e.remove();
103
+ }
104
+ /**
105
+ * Load the Google Maps JavaScript API script and return a Promise.
106
+ */
107
+ load() {
108
+ return this.loadPromise();
109
+ }
110
+ /**
111
+ * Load the Google Maps JavaScript API script and return a Promise.
112
+ *
113
+ * @ignore
114
+ */
115
+ loadPromise() {
116
+ return new Promise((e, t) => {
117
+ this.loadCallback((n) => {
118
+ n ? t(n.error) : e(window.google);
119
+ });
120
+ });
121
+ }
122
+ /**
123
+ * Load the Google Maps JavaScript API script with a callback.
124
+ */
125
+ loadCallback(e) {
126
+ this.callbacks.push(e), this.execute();
127
+ }
128
+ /**
129
+ * Set the script on document.
130
+ */
131
+ setScript() {
132
+ if (document.getElementById(this.id)) {
133
+ this.callback();
134
+ return;
135
+ }
136
+ const e = this.createUrl(), t = document.createElement("script");
137
+ t.id = this.id, t.type = "text/javascript", t.src = e, t.onerror = this.loadErrorCallback.bind(this), t.defer = !0, t.async = !0, this.nonce && (t.nonce = this.nonce), document.head.appendChild(t);
138
+ }
139
+ /**
140
+ * Reset the loader state.
141
+ */
142
+ reset() {
143
+ this.deleteScript(), this.done = !1, this.loading = !1, this.errors = [], this.onerrorEvent = null;
144
+ }
145
+ resetIfRetryingFailed() {
146
+ this.failed && this.reset();
147
+ }
148
+ loadErrorCallback(e) {
149
+ if (this.errors.push(e), this.errors.length <= this.retries) {
150
+ const t = this.errors.length * Math.pow(2, this.errors.length);
151
+ console.log(`Failed to load Google Maps script, retrying in ${t} ms.`), setTimeout(() => {
152
+ this.deleteScript(), this.setScript();
153
+ }, t);
154
+ } else
155
+ this.onerrorEvent = e, this.callback();
156
+ }
157
+ setCallback() {
158
+ window.__googleMapsCallback = this.callback.bind(this);
159
+ }
160
+ callback() {
161
+ this.done = !0, this.loading = !1, this.callbacks.forEach((e) => {
162
+ e(this.onerrorEvent);
163
+ }), this.callbacks = [];
164
+ }
165
+ execute() {
166
+ if (this.resetIfRetryingFailed(), this.done)
167
+ this.callback();
168
+ else {
169
+ if (window.google && window.google.maps && window.google.maps.version) {
170
+ console.warn("Google Maps already loaded outside @googlemaps/js-api-loader.This may result in undesirable behavior as options and script parameters may not match."), this.callback();
171
+ return;
172
+ }
173
+ this.loading || (this.loading = !0, this.setCallback(), this.setScript());
174
+ }
175
+ }
176
+ }
177
+ function $e(o) {
178
+ return class extends o.OverlayView {
179
+ constructor(n) {
180
+ super();
181
+ V(this, "element");
182
+ V(this, "opts");
183
+ const { element: s, ...r } = n;
184
+ this.element = s, this.opts = r, this.opts.map && this.setMap(this.opts.map);
185
+ }
186
+ getPosition() {
187
+ return this.opts.position ? this.opts.position instanceof o.LatLng ? this.opts.position : new o.LatLng(this.opts.position) : null;
188
+ }
189
+ getVisible() {
190
+ if (!this.element)
191
+ return !1;
192
+ const n = this.element;
193
+ return n.style.display !== "none" && n.style.visibility !== "hidden" && (n.style.opacity === "" || Number(n.style.opacity) > 0.01);
194
+ }
195
+ onAdd() {
196
+ if (!this.element)
197
+ return;
198
+ const n = this.getPanes();
199
+ n && n.overlayMouseTarget.appendChild(this.element);
200
+ }
201
+ draw() {
202
+ if (!this.element)
203
+ return;
204
+ const s = this.getProjection().fromLatLngToDivPixel(this.getPosition());
205
+ if (s) {
206
+ this.element.style.position = "absolute";
207
+ const r = this.element.offsetHeight, a = this.element.offsetWidth;
208
+ let l, i;
209
+ switch (this.opts.anchorPoint) {
210
+ case "TOP_CENTER":
211
+ l = s.x - a / 2, i = s.y;
212
+ break;
213
+ case "BOTTOM_CENTER":
214
+ l = s.x - a / 2, i = s.y - r;
215
+ break;
216
+ case "LEFT_CENTER":
217
+ l = s.x, i = s.y - r / 2;
218
+ break;
219
+ case "RIGHT_CENTER":
220
+ l = s.x - a, i = s.y - r / 2;
221
+ break;
222
+ case "TOP_LEFT":
223
+ l = s.x, i = s.y;
224
+ break;
225
+ case "TOP_RIGHT":
226
+ l = s.x - a, i = s.y;
227
+ break;
228
+ case "BOTTOM_LEFT":
229
+ l = s.x, i = s.y - r;
230
+ break;
231
+ case "BOTTOM_RIGHT":
232
+ l = s.x - a, i = s.y - r;
233
+ break;
234
+ default:
235
+ l = s.x - a / 2, i = s.y - r / 2;
236
+ }
237
+ this.element.style.left = l + "px", this.element.style.top = i + "px", this.element.style.transform = `translateX(${this.opts.offsetX || 0}px) translateY(${this.opts.offsetY || 0}px)`, this.opts.zIndex && (this.element.style.zIndex = this.opts.zIndex.toString());
238
+ }
239
+ }
240
+ onRemove() {
241
+ this.element && this.element.remove();
242
+ }
243
+ setOptions(n) {
244
+ this.opts = n, this.draw();
245
+ }
246
+ };
247
+ }
248
+ let oe;
249
+ const re = [
250
+ "bounds_changed",
251
+ "center_changed",
252
+ "click",
253
+ "dblclick",
254
+ "drag",
255
+ "dragend",
256
+ "dragstart",
257
+ "heading_changed",
258
+ "idle",
259
+ "maptypeid_changed",
260
+ "mousemove",
261
+ "mouseout",
262
+ "mouseover",
263
+ "projection_changed",
264
+ "resize",
265
+ "rightclick",
266
+ "tilesloaded",
267
+ "tilt_changed",
268
+ "zoom_changed"
269
+ ], je = k({
270
+ props: {
271
+ apiPromise: {
272
+ type: Promise
273
+ },
274
+ apiKey: {
275
+ type: String,
276
+ default: ""
277
+ },
278
+ version: {
279
+ type: String,
280
+ default: "weekly"
281
+ },
282
+ libraries: {
283
+ type: Array,
284
+ default: () => ["places"]
285
+ },
286
+ region: {
287
+ type: String,
288
+ required: !1
289
+ },
290
+ language: {
291
+ type: String,
292
+ required: !1
293
+ },
294
+ backgroundColor: {
295
+ type: String,
296
+ required: !1
297
+ },
298
+ center: {
299
+ type: Object,
300
+ default: () => ({ lat: 0, lng: 0 })
301
+ },
302
+ clickableIcons: {
303
+ type: Boolean,
304
+ required: !1,
305
+ default: void 0
306
+ },
307
+ controlSize: {
308
+ type: Number,
309
+ required: !1
310
+ },
311
+ disableDefaultUi: {
312
+ type: Boolean,
313
+ required: !1,
314
+ default: void 0
315
+ },
316
+ disableDoubleClickZoom: {
317
+ type: Boolean,
318
+ required: !1,
319
+ default: void 0
320
+ },
321
+ draggable: {
322
+ type: Boolean,
323
+ required: !1,
324
+ default: void 0
325
+ },
326
+ draggableCursor: {
327
+ type: String,
328
+ required: !1
329
+ },
330
+ draggingCursor: {
331
+ type: String,
332
+ required: !1
333
+ },
334
+ fullscreenControl: {
335
+ type: Boolean,
336
+ required: !1,
337
+ default: void 0
338
+ },
339
+ fullscreenControlPosition: {
340
+ type: String,
341
+ required: !1
342
+ },
343
+ gestureHandling: {
344
+ type: String,
345
+ required: !1
346
+ },
347
+ heading: {
348
+ type: Number,
349
+ required: !1
350
+ },
351
+ keyboardShortcuts: {
352
+ type: Boolean,
353
+ required: !1,
354
+ default: void 0
355
+ },
356
+ mapTypeControl: {
357
+ type: Boolean,
358
+ required: !1,
359
+ default: void 0
360
+ },
361
+ mapTypeControlOptions: {
362
+ type: Object,
363
+ required: !1
364
+ },
365
+ mapTypeId: {
366
+ type: [Number, String],
367
+ required: !1
368
+ },
369
+ mapId: {
370
+ type: String,
371
+ required: !1
372
+ },
373
+ maxZoom: {
374
+ type: Number,
375
+ required: !1
376
+ },
377
+ minZoom: {
378
+ type: Number,
379
+ required: !1
380
+ },
381
+ noClear: {
382
+ type: Boolean,
383
+ required: !1,
384
+ default: void 0
385
+ },
386
+ panControl: {
387
+ type: Boolean,
388
+ required: !1,
389
+ default: void 0
390
+ },
391
+ panControlPosition: {
392
+ type: String,
393
+ required: !1
394
+ },
395
+ restriction: {
396
+ type: Object,
397
+ required: !1
398
+ },
399
+ rotateControl: {
400
+ type: Boolean,
401
+ required: !1,
402
+ default: void 0
403
+ },
404
+ rotateControlPosition: {
405
+ type: String,
406
+ required: !1
407
+ },
408
+ scaleControl: {
409
+ type: Boolean,
410
+ required: !1,
411
+ default: void 0
412
+ },
413
+ scaleControlStyle: {
414
+ type: Number,
415
+ required: !1
416
+ },
417
+ scrollwheel: {
418
+ type: Boolean,
419
+ required: !1,
420
+ default: void 0
421
+ },
422
+ streetView: {
423
+ type: Object,
424
+ required: !1
425
+ },
426
+ streetViewControl: {
427
+ type: Boolean,
428
+ required: !1,
429
+ default: void 0
430
+ },
431
+ streetViewControlPosition: {
432
+ type: String,
433
+ required: !1
434
+ },
435
+ styles: {
436
+ type: Array,
437
+ required: !1
438
+ },
439
+ tilt: {
440
+ type: Number,
441
+ required: !1
442
+ },
443
+ zoom: {
444
+ type: Number,
445
+ required: !1
446
+ },
447
+ zoomControl: {
448
+ type: Boolean,
449
+ required: !1,
450
+ default: void 0
451
+ },
452
+ zoomControlPosition: {
453
+ type: String,
454
+ required: !1
455
+ }
456
+ },
457
+ emits: re,
458
+ setup(o, { emit: e }) {
459
+ const t = v(), n = v(!1), s = v(), r = v(), a = v(!1);
460
+ q(I, s), q(E, r), q(we, a);
461
+ const l = () => {
462
+ const c = { ...o };
463
+ Object.keys(c).forEach((m) => {
464
+ c[m] === void 0 && delete c[m];
465
+ });
466
+ const f = (m) => {
467
+ var g;
468
+ return m ? { position: (g = r.value) == null ? void 0 : g.ControlPosition[m] } : {};
469
+ }, d = {
470
+ scaleControlOptions: o.scaleControlStyle ? { style: o.scaleControlStyle } : {},
471
+ panControlOptions: f(o.panControlPosition),
472
+ zoomControlOptions: f(o.zoomControlPosition),
473
+ rotateControlOptions: f(o.rotateControlPosition),
474
+ streetViewControlOptions: f(o.streetViewControlPosition),
475
+ fullscreenControlOptions: f(o.fullscreenControlPosition),
476
+ disableDefaultUI: o.disableDefaultUi
477
+ };
478
+ return { ...c, ...d };
479
+ }, i = b(
480
+ [r, s],
481
+ ([c, h]) => {
482
+ const f = c, d = h;
483
+ f && d && (f.event.addListenerOnce(d, "tilesloaded", () => {
484
+ a.value = !0;
485
+ }), setTimeout(i, 0));
486
+ },
487
+ { immediate: !0 }
488
+ ), p = () => {
489
+ try {
490
+ const { apiKey: c, region: h, version: f, language: d, libraries: m } = o;
491
+ oe = new O({ apiKey: c, region: h, version: f, language: d, libraries: m });
492
+ } catch (c) {
493
+ console.error(c);
494
+ }
495
+ }, u = (c) => {
496
+ r.value = M(c.maps), s.value = M(new c.maps.Map(t.value, l()));
497
+ const h = $e(r.value);
498
+ r.value[H] = h, re.forEach((d) => {
499
+ var m;
500
+ (m = s.value) == null || m.addListener(d, (g) => e(d, g));
501
+ }), n.value = !0;
502
+ const f = Object.keys(o).filter(
503
+ (d) => !["apiPromise", "apiKey", "version", "libraries", "region", "language", "center", "zoom"].includes(d)
504
+ ).map((d) => L(o, d));
505
+ b(
506
+ [() => o.center, () => o.zoom, ...f],
507
+ ([d, m], [g, C]) => {
508
+ var ee, te, se;
509
+ const { center: w, zoom: j, ..._ } = l();
510
+ (ee = s.value) == null || ee.setOptions(_), m !== void 0 && m !== C && ((te = s.value) == null || te.setZoom(m));
511
+ const Z = !g || d.lng !== g.lng || d.lat !== g.lat;
512
+ d && Z && ((se = s.value) == null || se.panTo(d));
513
+ }
514
+ );
515
+ };
516
+ return ge(() => {
517
+ o.apiPromise && o.apiPromise instanceof Promise ? o.apiPromise.then(u) : (p(), oe.load().then(u));
518
+ }), S(() => {
519
+ var c;
520
+ a.value = !1, s.value && ((c = r.value) == null || c.event.clearInstanceListeners(s.value));
521
+ }), { mapRef: t, ready: n, map: s, api: r, mapTilesLoaded: a };
522
+ }
523
+ });
524
+ const K = (o, e) => {
525
+ const t = o.__vccOpts || o;
526
+ for (const [n, s] of e)
527
+ t[n] = s;
528
+ return t;
529
+ }, Te = {
530
+ ref: "mapRef",
531
+ class: "mapdiv"
532
+ };
533
+ function qe(o, e, t, n, s, r) {
534
+ return F(), G("div", null, [
535
+ Y("div", Te, null, 512),
536
+ U(o.$slots, "default", Pe(Se({ ready: o.ready, map: o.map, api: o.api, mapTilesLoaded: o.mapTilesLoaded })), void 0, !0)
537
+ ]);
538
+ }
539
+ const vt = /* @__PURE__ */ K(je, [["render", qe], ["__scopeId", "data-v-7d660dd5"]]);
540
+ function Re(o) {
541
+ return o && o.__esModule && Object.prototype.hasOwnProperty.call(o, "default") ? o.default : o;
542
+ }
543
+ var Ae = function o(e, t) {
544
+ if (e === t)
545
+ return !0;
546
+ if (e && t && typeof e == "object" && typeof t == "object") {
547
+ if (e.constructor !== t.constructor)
548
+ return !1;
549
+ var n, s, r;
550
+ if (Array.isArray(e)) {
551
+ if (n = e.length, n != t.length)
552
+ return !1;
553
+ for (s = n; s-- !== 0; )
554
+ if (!o(e[s], t[s]))
555
+ return !1;
556
+ return !0;
557
+ }
558
+ if (e.constructor === RegExp)
559
+ return e.source === t.source && e.flags === t.flags;
560
+ if (e.valueOf !== Object.prototype.valueOf)
561
+ return e.valueOf() === t.valueOf();
562
+ if (e.toString !== Object.prototype.toString)
563
+ return e.toString() === t.toString();
564
+ if (r = Object.keys(e), n = r.length, n !== Object.keys(t).length)
565
+ return !1;
566
+ for (s = n; s-- !== 0; )
567
+ if (!Object.prototype.hasOwnProperty.call(t, r[s]))
568
+ return !1;
569
+ for (s = n; s-- !== 0; ) {
570
+ var a = r[s];
571
+ if (!o(e[a], t[a]))
572
+ return !1;
573
+ }
574
+ return !0;
575
+ }
576
+ return e !== e && t !== t;
577
+ };
578
+ const A = /* @__PURE__ */ Re(Ae), Ze = (o) => o === "Marker", Be = (o) => o === H, $ = (o, e, t, n) => {
579
+ const s = v(), r = y(I, v()), a = y(E, v()), l = y(ke, v()), i = z(
580
+ () => !!(l.value && a.value && (s.value instanceof a.value.Marker || s.value instanceof a.value[H]))
581
+ );
582
+ return b(
583
+ [r, t],
584
+ (p, [u, c]) => {
585
+ var f, d, m;
586
+ const h = !A(t.value, c) || r.value !== u;
587
+ !r.value || !a.value || !h || (s.value ? (s.value.setOptions(t.value), i.value && ((f = l.value) == null || f.removeMarker(s.value), (d = l.value) == null || d.addMarker(s.value))) : (Ze(o) ? s.value = M(
588
+ new a.value[o](t.value)
589
+ ) : Be(o) ? s.value = M(
590
+ new a.value[o](t.value)
591
+ ) : s.value = M(
592
+ new a.value[o]({
593
+ ...t.value,
594
+ map: r.value
595
+ })
596
+ ), i.value ? (m = l.value) == null || m.addMarker(s.value) : s.value.setMap(r.value), e.forEach((g) => {
597
+ var C;
598
+ (C = s.value) == null || C.addListener(g, (w) => n(g, w));
599
+ })));
600
+ },
601
+ {
602
+ immediate: !0
603
+ }
604
+ ), S(() => {
605
+ var p, u;
606
+ s.value && ((p = a.value) == null || p.event.clearInstanceListeners(s.value), i.value ? (u = l.value) == null || u.removeMarker(s.value) : s.value.setMap(null));
607
+ }), s;
608
+ }, ie = [
609
+ "animation_changed",
610
+ "click",
611
+ "dblclick",
612
+ "rightclick",
613
+ "dragstart",
614
+ "dragend",
615
+ "drag",
616
+ "mouseover",
617
+ "mousedown",
618
+ "mouseout",
619
+ "mouseup",
620
+ "draggable_changed",
621
+ "clickable_changed",
622
+ "contextmenu",
623
+ "cursor_changed",
624
+ "flat_changed",
625
+ "rightclick",
626
+ "zindex_changed",
627
+ "icon_changed",
628
+ "position_changed",
629
+ "shape_changed",
630
+ "title_changed",
631
+ "visible_changed"
632
+ ], yt = k({
633
+ name: "Marker",
634
+ props: {
635
+ options: {
636
+ type: Object,
637
+ required: !0
638
+ }
639
+ },
640
+ emits: ie,
641
+ setup(o, { emit: e, expose: t, slots: n }) {
642
+ const s = L(o, "options"), r = $("Marker", ie, s, e);
643
+ return q(_e, r), t({ marker: r }), () => {
644
+ var a;
645
+ return (a = n.default) == null ? void 0 : a.call(n);
646
+ };
647
+ }
648
+ }), Ct = k({
649
+ name: "Polyline",
650
+ props: {
651
+ options: {
652
+ type: Object,
653
+ required: !0
654
+ }
655
+ },
656
+ emits: P,
657
+ setup(o, { emit: e }) {
658
+ const t = L(o, "options");
659
+ return { polyline: $("Polyline", P, t, e) };
660
+ },
661
+ render: () => null
662
+ }), _t = k({
663
+ name: "Polygon",
664
+ props: {
665
+ options: {
666
+ type: Object,
667
+ required: !0
668
+ }
669
+ },
670
+ emits: P,
671
+ setup(o, { emit: e }) {
672
+ const t = L(o, "options");
673
+ return { polygon: $("Polygon", P, t, e) };
674
+ },
675
+ render: () => null
676
+ }), ae = P.concat(["bounds_changed"]), kt = k({
677
+ name: "Rectangle",
678
+ props: {
679
+ options: {
680
+ type: Object,
681
+ required: !0
682
+ }
683
+ },
684
+ emits: ae,
685
+ setup(o, { emit: e }) {
686
+ const t = L(o, "options");
687
+ return { rectangle: $("Rectangle", ae, t, e) };
688
+ },
689
+ render: () => null
690
+ }), le = P.concat(["center_changed", "radius_changed"]), wt = k({
691
+ name: "Circle",
692
+ props: {
693
+ options: {
694
+ type: Object,
695
+ required: !0
696
+ }
697
+ },
698
+ emits: le,
699
+ setup(o, { emit: e }) {
700
+ const t = L(o, "options");
701
+ return { circle: $("Circle", le, t, e) };
702
+ },
703
+ render: () => null
704
+ }), Ne = k({
705
+ props: {
706
+ position: {
707
+ type: String,
708
+ required: !0
709
+ },
710
+ index: {
711
+ type: Number,
712
+ default: 1
713
+ }
714
+ },
715
+ emits: ["content:loaded"],
716
+ setup(o, { emit: e }) {
717
+ const t = v(null), n = y(I, v()), s = y(E, v()), r = y(we, v(!1)), a = v(!1), l = b(
718
+ [r, s, t],
719
+ ([u, c, h]) => {
720
+ c && u && h && (i(o.position), a.value = !0, e("content:loaded"), setTimeout(l, 0));
721
+ },
722
+ { immediate: !0 }
723
+ ), i = (u) => {
724
+ if (n.value && s.value && t.value) {
725
+ const c = s.value.ControlPosition[u];
726
+ n.value.controls[c].push(t.value);
727
+ }
728
+ }, p = (u) => {
729
+ if (n.value && s.value) {
730
+ let c = null;
731
+ const h = s.value.ControlPosition[u];
732
+ n.value.controls[h].forEach((f, d) => {
733
+ f === t.value && (c = d);
734
+ }), c !== null && n.value.controls[h].removeAt(c);
735
+ }
736
+ };
737
+ return S(() => p(o.position)), b(
738
+ () => o.position,
739
+ (u, c) => {
740
+ p(c), i(u);
741
+ }
742
+ ), b(
743
+ () => o.index,
744
+ (u) => {
745
+ u && t.value && (t.value.index = o.index);
746
+ }
747
+ ), { controlRef: t, showContent: a };
748
+ }
749
+ }), ze = { ref: "controlRef" };
750
+ function De(o, e, t, n, s, r) {
751
+ return Le((F(), G("div", ze, [
752
+ U(o.$slots, "default")
753
+ ], 512)), [
754
+ [Ie, o.showContent]
755
+ ]);
756
+ }
757
+ const bt = /* @__PURE__ */ K(Ne, [["render", De]]), ce = ["closeclick", "content_changed", "domready", "position_changed", "visible", "zindex_changed"], Fe = k({
758
+ inheritAttrs: !1,
759
+ props: {
760
+ options: {
761
+ type: Object,
762
+ default: () => ({})
763
+ }
764
+ },
765
+ emits: ce,
766
+ setup(o, { slots: e, emit: t, expose: n }) {
767
+ const s = v(), r = v(), a = y(I, v()), l = y(E, v()), i = y(_e, v());
768
+ let p;
769
+ const u = z(() => {
770
+ var f;
771
+ return (f = e.default) == null ? void 0 : f.call(e).some((d) => d.type !== ve);
772
+ }), c = (f) => {
773
+ var d;
774
+ return (d = s.value) == null ? void 0 : d.open({ map: a.value, anchor: i.value, ...f });
775
+ }, h = () => {
776
+ var f;
777
+ return (f = s.value) == null ? void 0 : f.close();
778
+ };
779
+ return ge(() => {
780
+ b(
781
+ [a, () => o.options],
782
+ ([f, d], [m, g]) => {
783
+ const C = !A(d, g) || a.value !== m;
784
+ a.value && l.value && C && (s.value ? (s.value.setOptions({
785
+ ...d,
786
+ content: u.value ? r.value : d.content
787
+ }), i.value || c()) : (s.value = M(
788
+ new l.value.InfoWindow({
789
+ ...d,
790
+ content: u.value ? r.value : d.content
791
+ })
792
+ ), i.value ? p = i.value.addListener("click", () => {
793
+ c();
794
+ }) : c(), ce.forEach((w) => {
795
+ var j;
796
+ (j = s.value) == null || j.addListener(w, (_) => t(w, _));
797
+ })));
798
+ },
799
+ {
800
+ immediate: !0
801
+ }
802
+ );
803
+ }), S(() => {
804
+ var f;
805
+ p && p.remove(), s.value && ((f = l.value) == null || f.event.clearInstanceListeners(s.value), h());
806
+ }), n({ infoWindow: s, open: c, close: h }), { infoWindow: s, infoWindowRef: r, hasSlotContent: u, open: c, close: h };
807
+ }
808
+ });
809
+ const Ge = {
810
+ key: 0,
811
+ class: "info-window-wrapper"
812
+ };
813
+ function Ue(o, e, t, n, s, r) {
814
+ return o.hasSlotContent ? (F(), G("div", Ge, [
815
+ Y("div", ye({ ref: "infoWindowRef" }, o.$attrs), [
816
+ U(o.$slots, "default", {}, void 0, !0)
817
+ ], 16)
818
+ ])) : Ce("", !0);
819
+ }
820
+ const Mt = /* @__PURE__ */ K(Fe, [["render", Ue], ["__scopeId", "data-v-45a4606d"]]);
821
+ function J(o, e, t, n, s, r) {
822
+ if (s - n <= t)
823
+ return;
824
+ const a = n + s >> 1;
825
+ be(o, e, a, n, s, r % 2), J(o, e, t, n, a - 1, r + 1), J(o, e, t, a + 1, s, r + 1);
826
+ }
827
+ function be(o, e, t, n, s, r) {
828
+ for (; s > n; ) {
829
+ if (s - n > 600) {
830
+ const p = s - n + 1, u = t - n + 1, c = Math.log(p), h = 0.5 * Math.exp(2 * c / 3), f = 0.5 * Math.sqrt(c * h * (p - h) / p) * (u - p / 2 < 0 ? -1 : 1), d = Math.max(n, Math.floor(t - u * h / p + f)), m = Math.min(s, Math.floor(t + (p - u) * h / p + f));
831
+ be(o, e, t, d, m, r);
832
+ }
833
+ const a = e[2 * t + r];
834
+ let l = n, i = s;
835
+ for (T(o, e, n, t), e[2 * s + r] > a && T(o, e, n, s); l < i; ) {
836
+ for (T(o, e, l, i), l++, i--; e[2 * l + r] < a; )
837
+ l++;
838
+ for (; e[2 * i + r] > a; )
839
+ i--;
840
+ }
841
+ e[2 * n + r] === a ? T(o, e, n, i) : (i++, T(o, e, i, s)), i <= t && (n = i + 1), t <= i && (s = i - 1);
842
+ }
843
+ }
844
+ function T(o, e, t, n) {
845
+ W(o, t, n), W(e, 2 * t, 2 * n), W(e, 2 * t + 1, 2 * n + 1);
846
+ }
847
+ function W(o, e, t) {
848
+ const n = o[e];
849
+ o[e] = o[t], o[t] = n;
850
+ }
851
+ function He(o, e, t, n, s, r, a) {
852
+ const l = [0, o.length - 1, 0], i = [];
853
+ let p, u;
854
+ for (; l.length; ) {
855
+ const c = l.pop(), h = l.pop(), f = l.pop();
856
+ if (h - f <= a) {
857
+ for (let g = f; g <= h; g++)
858
+ p = e[2 * g], u = e[2 * g + 1], p >= t && p <= s && u >= n && u <= r && i.push(o[g]);
859
+ continue;
860
+ }
861
+ const d = Math.floor((f + h) / 2);
862
+ p = e[2 * d], u = e[2 * d + 1], p >= t && p <= s && u >= n && u <= r && i.push(o[d]);
863
+ const m = (c + 1) % 2;
864
+ (c === 0 ? t <= p : n <= u) && (l.push(f), l.push(d - 1), l.push(m)), (c === 0 ? s >= p : r >= u) && (l.push(d + 1), l.push(h), l.push(m));
865
+ }
866
+ return i;
867
+ }
868
+ function Ke(o, e, t, n, s, r) {
869
+ const a = [0, o.length - 1, 0], l = [], i = s * s;
870
+ for (; a.length; ) {
871
+ const p = a.pop(), u = a.pop(), c = a.pop();
872
+ if (u - c <= r) {
873
+ for (let g = c; g <= u; g++)
874
+ ue(e[2 * g], e[2 * g + 1], t, n) <= i && l.push(o[g]);
875
+ continue;
876
+ }
877
+ const h = Math.floor((c + u) / 2), f = e[2 * h], d = e[2 * h + 1];
878
+ ue(f, d, t, n) <= i && l.push(o[h]);
879
+ const m = (p + 1) % 2;
880
+ (p === 0 ? t - s <= f : n - s <= d) && (a.push(c), a.push(h - 1), a.push(m)), (p === 0 ? t + s >= f : n + s >= d) && (a.push(h + 1), a.push(u), a.push(m));
881
+ }
882
+ return l;
883
+ }
884
+ function ue(o, e, t, n) {
885
+ const s = o - t, r = e - n;
886
+ return s * s + r * r;
887
+ }
888
+ const Ve = (o) => o[0], We = (o) => o[1];
889
+ class pe {
890
+ constructor(e, t = Ve, n = We, s = 64, r = Float64Array) {
891
+ this.nodeSize = s, this.points = e;
892
+ const a = e.length < 65536 ? Uint16Array : Uint32Array, l = this.ids = new a(e.length), i = this.coords = new r(e.length * 2);
893
+ for (let p = 0; p < e.length; p++)
894
+ l[p] = p, i[2 * p] = t(e[p]), i[2 * p + 1] = n(e[p]);
895
+ J(l, i, s, 0, l.length - 1, 0);
896
+ }
897
+ range(e, t, n, s) {
898
+ return He(this.ids, this.coords, e, t, n, s, this.nodeSize);
899
+ }
900
+ within(e, t, n) {
901
+ return Ke(this.ids, this.coords, e, t, n, this.nodeSize);
902
+ }
903
+ }
904
+ const Je = {
905
+ minZoom: 0,
906
+ // min zoom to generate clusters on
907
+ maxZoom: 16,
908
+ // max zoom level to cluster the points on
909
+ minPoints: 2,
910
+ // minimum points to form a cluster
911
+ radius: 40,
912
+ // cluster radius in pixels
913
+ extent: 512,
914
+ // tile extent (radius is calculated relative to it)
915
+ nodeSize: 64,
916
+ // size of the KD-tree leaf node, affects performance
917
+ log: !1,
918
+ // whether to log timing info
919
+ // whether to generate numeric ids for input features (in vector tiles)
920
+ generateId: !1,
921
+ // a reduce function for calculating custom cluster properties
922
+ reduce: null,
923
+ // (accumulated, props) => { accumulated.sum += props.sum; }
924
+ // properties to use for individual points when running the reducer
925
+ map: (o) => o
926
+ // props => ({sum: props.my_value})
927
+ }, D = Math.fround || ((o) => (e) => (o[0] = +e, o[0]))(new Float32Array(1));
928
+ class Xe {
929
+ constructor(e) {
930
+ this.options = R(Object.create(Je), e), this.trees = new Array(this.options.maxZoom + 1);
931
+ }
932
+ load(e) {
933
+ const { log: t, minZoom: n, maxZoom: s, nodeSize: r } = this.options;
934
+ t && console.time("total time");
935
+ const a = `prepare ${e.length} points`;
936
+ t && console.time(a), this.points = e;
937
+ let l = [];
938
+ for (let i = 0; i < e.length; i++)
939
+ e[i].geometry && l.push(Qe(e[i], i));
940
+ this.trees[s + 1] = new pe(l, he, fe, r, Float32Array), t && console.timeEnd(a);
941
+ for (let i = s; i >= n; i--) {
942
+ const p = +Date.now();
943
+ l = this._cluster(l, i), this.trees[i] = new pe(l, he, fe, r, Float32Array), t && console.log("z%d: %d clusters in %dms", i, l.length, +Date.now() - p);
944
+ }
945
+ return t && console.timeEnd("total time"), this;
946
+ }
947
+ getClusters(e, t) {
948
+ let n = ((e[0] + 180) % 360 + 360) % 360 - 180;
949
+ const s = Math.max(-90, Math.min(90, e[1]));
950
+ let r = e[2] === 180 ? 180 : ((e[2] + 180) % 360 + 360) % 360 - 180;
951
+ const a = Math.max(-90, Math.min(90, e[3]));
952
+ if (e[2] - e[0] >= 360)
953
+ n = -180, r = 180;
954
+ else if (n > r) {
955
+ const u = this.getClusters([n, s, 180, a], t), c = this.getClusters([-180, s, r, a], t);
956
+ return u.concat(c);
957
+ }
958
+ const l = this.trees[this._limitZoom(t)], i = l.range(B(n), N(a), B(r), N(s)), p = [];
959
+ for (const u of i) {
960
+ const c = l.points[u];
961
+ p.push(c.numPoints ? de(c) : this.points[c.index]);
962
+ }
963
+ return p;
964
+ }
965
+ getChildren(e) {
966
+ const t = this._getOriginId(e), n = this._getOriginZoom(e), s = "No cluster with the specified id.", r = this.trees[n];
967
+ if (!r)
968
+ throw new Error(s);
969
+ const a = r.points[t];
970
+ if (!a)
971
+ throw new Error(s);
972
+ const l = this.options.radius / (this.options.extent * Math.pow(2, n - 1)), i = r.within(a.x, a.y, l), p = [];
973
+ for (const u of i) {
974
+ const c = r.points[u];
975
+ c.parentId === e && p.push(c.numPoints ? de(c) : this.points[c.index]);
976
+ }
977
+ if (p.length === 0)
978
+ throw new Error(s);
979
+ return p;
980
+ }
981
+ getLeaves(e, t, n) {
982
+ t = t || 10, n = n || 0;
983
+ const s = [];
984
+ return this._appendLeaves(s, e, t, n, 0), s;
985
+ }
986
+ getTile(e, t, n) {
987
+ const s = this.trees[this._limitZoom(e)], r = Math.pow(2, e), { extent: a, radius: l } = this.options, i = l / a, p = (n - i) / r, u = (n + 1 + i) / r, c = {
988
+ features: []
989
+ };
990
+ return this._addTileFeatures(
991
+ s.range((t - i) / r, p, (t + 1 + i) / r, u),
992
+ s.points,
993
+ t,
994
+ n,
995
+ r,
996
+ c
997
+ ), t === 0 && this._addTileFeatures(
998
+ s.range(1 - i / r, p, 1, u),
999
+ s.points,
1000
+ r,
1001
+ n,
1002
+ r,
1003
+ c
1004
+ ), t === r - 1 && this._addTileFeatures(
1005
+ s.range(0, p, i / r, u),
1006
+ s.points,
1007
+ -1,
1008
+ n,
1009
+ r,
1010
+ c
1011
+ ), c.features.length ? c : null;
1012
+ }
1013
+ getClusterExpansionZoom(e) {
1014
+ let t = this._getOriginZoom(e) - 1;
1015
+ for (; t <= this.options.maxZoom; ) {
1016
+ const n = this.getChildren(e);
1017
+ if (t++, n.length !== 1)
1018
+ break;
1019
+ e = n[0].properties.cluster_id;
1020
+ }
1021
+ return t;
1022
+ }
1023
+ _appendLeaves(e, t, n, s, r) {
1024
+ const a = this.getChildren(t);
1025
+ for (const l of a) {
1026
+ const i = l.properties;
1027
+ if (i && i.cluster ? r + i.point_count <= s ? r += i.point_count : r = this._appendLeaves(e, i.cluster_id, n, s, r) : r < s ? r++ : e.push(l), e.length === n)
1028
+ break;
1029
+ }
1030
+ return r;
1031
+ }
1032
+ _addTileFeatures(e, t, n, s, r, a) {
1033
+ for (const l of e) {
1034
+ const i = t[l], p = i.numPoints;
1035
+ let u, c, h;
1036
+ if (p)
1037
+ u = Me(i), c = i.x, h = i.y;
1038
+ else {
1039
+ const m = this.points[i.index];
1040
+ u = m.properties, c = B(m.geometry.coordinates[0]), h = N(m.geometry.coordinates[1]);
1041
+ }
1042
+ const f = {
1043
+ type: 1,
1044
+ geometry: [[
1045
+ Math.round(this.options.extent * (c * r - n)),
1046
+ Math.round(this.options.extent * (h * r - s))
1047
+ ]],
1048
+ tags: u
1049
+ };
1050
+ let d;
1051
+ p ? d = i.id : this.options.generateId ? d = i.index : this.points[i.index].id && (d = this.points[i.index].id), d !== void 0 && (f.id = d), a.features.push(f);
1052
+ }
1053
+ }
1054
+ _limitZoom(e) {
1055
+ return Math.max(this.options.minZoom, Math.min(Math.floor(+e), this.options.maxZoom + 1));
1056
+ }
1057
+ _cluster(e, t) {
1058
+ const n = [], { radius: s, extent: r, reduce: a, minPoints: l } = this.options, i = s / (r * Math.pow(2, t));
1059
+ for (let p = 0; p < e.length; p++) {
1060
+ const u = e[p];
1061
+ if (u.zoom <= t)
1062
+ continue;
1063
+ u.zoom = t;
1064
+ const c = this.trees[t + 1], h = c.within(u.x, u.y, i), f = u.numPoints || 1;
1065
+ let d = f;
1066
+ for (const m of h) {
1067
+ const g = c.points[m];
1068
+ g.zoom > t && (d += g.numPoints || 1);
1069
+ }
1070
+ if (d > f && d >= l) {
1071
+ let m = u.x * f, g = u.y * f, C = a && f > 1 ? this._map(u, !0) : null;
1072
+ const w = (p << 5) + (t + 1) + this.points.length;
1073
+ for (const j of h) {
1074
+ const _ = c.points[j];
1075
+ if (_.zoom <= t)
1076
+ continue;
1077
+ _.zoom = t;
1078
+ const Z = _.numPoints || 1;
1079
+ m += _.x * Z, g += _.y * Z, _.parentId = w, a && (C || (C = this._map(u, !0)), a(C, this._map(_)));
1080
+ }
1081
+ u.parentId = w, n.push(Ye(m / d, g / d, w, d, C));
1082
+ } else if (n.push(u), d > 1)
1083
+ for (const m of h) {
1084
+ const g = c.points[m];
1085
+ g.zoom <= t || (g.zoom = t, n.push(g));
1086
+ }
1087
+ }
1088
+ return n;
1089
+ }
1090
+ // get index of the point from which the cluster originated
1091
+ _getOriginId(e) {
1092
+ return e - this.points.length >> 5;
1093
+ }
1094
+ // get zoom of the point from which the cluster originated
1095
+ _getOriginZoom(e) {
1096
+ return (e - this.points.length) % 32;
1097
+ }
1098
+ _map(e, t) {
1099
+ if (e.numPoints)
1100
+ return t ? R({}, e.properties) : e.properties;
1101
+ const n = this.points[e.index].properties, s = this.options.map(n);
1102
+ return t && s === n ? R({}, s) : s;
1103
+ }
1104
+ }
1105
+ function Ye(o, e, t, n, s) {
1106
+ return {
1107
+ x: D(o),
1108
+ // weighted cluster center; round for consistency with Float32Array index
1109
+ y: D(e),
1110
+ zoom: 1 / 0,
1111
+ // the last zoom the cluster was processed at
1112
+ id: t,
1113
+ // encodes index of the first child of the cluster and its zoom level
1114
+ parentId: -1,
1115
+ // parent cluster id
1116
+ numPoints: n,
1117
+ properties: s
1118
+ };
1119
+ }
1120
+ function Qe(o, e) {
1121
+ const [t, n] = o.geometry.coordinates;
1122
+ return {
1123
+ x: D(B(t)),
1124
+ // projected point coordinates
1125
+ y: D(N(n)),
1126
+ zoom: 1 / 0,
1127
+ // the last zoom the point was processed at
1128
+ index: e,
1129
+ // index of the source feature in the original input array,
1130
+ parentId: -1
1131
+ // parent cluster id
1132
+ };
1133
+ }
1134
+ function de(o) {
1135
+ return {
1136
+ type: "Feature",
1137
+ id: o.id,
1138
+ properties: Me(o),
1139
+ geometry: {
1140
+ type: "Point",
1141
+ coordinates: [et(o.x), tt(o.y)]
1142
+ }
1143
+ };
1144
+ }
1145
+ function Me(o) {
1146
+ const e = o.numPoints, t = e >= 1e4 ? `${Math.round(e / 1e3)}k` : e >= 1e3 ? `${Math.round(e / 100) / 10}k` : e;
1147
+ return R(R({}, o.properties), {
1148
+ cluster: !0,
1149
+ cluster_id: o.id,
1150
+ point_count: e,
1151
+ point_count_abbreviated: t
1152
+ });
1153
+ }
1154
+ function B(o) {
1155
+ return o / 360 + 0.5;
1156
+ }
1157
+ function N(o) {
1158
+ const e = Math.sin(o * Math.PI / 180), t = 0.5 - 0.25 * Math.log((1 + e) / (1 - e)) / Math.PI;
1159
+ return t < 0 ? 0 : t > 1 ? 1 : t;
1160
+ }
1161
+ function et(o) {
1162
+ return (o - 0.5) * 360;
1163
+ }
1164
+ function tt(o) {
1165
+ const e = (180 - o * 360) * Math.PI / 180;
1166
+ return 360 * Math.atan(Math.exp(e)) / Math.PI - 90;
1167
+ }
1168
+ function R(o, e) {
1169
+ for (const t in e)
1170
+ o[t] = e[t];
1171
+ return o;
1172
+ }
1173
+ function he(o) {
1174
+ return o.x;
1175
+ }
1176
+ function fe(o) {
1177
+ return o.y;
1178
+ }
1179
+ /*! *****************************************************************************
1180
+ Copyright (c) Microsoft Corporation.
1181
+
1182
+ Permission to use, copy, modify, and/or distribute this software for any
1183
+ purpose with or without fee is hereby granted.
1184
+
1185
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
1186
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
1187
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
1188
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
1189
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
1190
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
1191
+ PERFORMANCE OF THIS SOFTWARE.
1192
+ ***************************************************************************** */
1193
+ function st(o, e) {
1194
+ var t = {};
1195
+ for (var n in o)
1196
+ Object.prototype.hasOwnProperty.call(o, n) && e.indexOf(n) < 0 && (t[n] = o[n]);
1197
+ if (o != null && typeof Object.getOwnPropertySymbols == "function")
1198
+ for (var s = 0, n = Object.getOwnPropertySymbols(o); s < n.length; s++)
1199
+ e.indexOf(n[s]) < 0 && Object.prototype.propertyIsEnumerable.call(o, n[s]) && (t[n[s]] = o[n[s]]);
1200
+ return t;
1201
+ }
1202
+ class X {
1203
+ constructor({ markers: e, position: t }) {
1204
+ this.markers = e, t && (t instanceof google.maps.LatLng ? this._position = t : this._position = new google.maps.LatLng(t));
1205
+ }
1206
+ get bounds() {
1207
+ if (!(this.markers.length === 0 && !this._position))
1208
+ return this.markers.reduce((e, t) => e.extend(t.getPosition()), new google.maps.LatLngBounds(this._position, this._position));
1209
+ }
1210
+ get position() {
1211
+ return this._position || this.bounds.getCenter();
1212
+ }
1213
+ /**
1214
+ * Get the count of **visible** markers.
1215
+ */
1216
+ get count() {
1217
+ return this.markers.filter((e) => e.getVisible()).length;
1218
+ }
1219
+ /**
1220
+ * Add a marker to the cluster.
1221
+ */
1222
+ push(e) {
1223
+ this.markers.push(e);
1224
+ }
1225
+ /**
1226
+ * Cleanup references and remove marker from map.
1227
+ */
1228
+ delete() {
1229
+ this.marker && (this.marker.setMap(null), delete this.marker), this.markers.length = 0;
1230
+ }
1231
+ }
1232
+ class nt {
1233
+ constructor({ maxZoom: e = 16 }) {
1234
+ this.maxZoom = e;
1235
+ }
1236
+ /**
1237
+ * Helper function to bypass clustering based upon some map state such as
1238
+ * zoom, number of markers, etc.
1239
+ *
1240
+ * ```typescript
1241
+ * cluster({markers, map}: AlgorithmInput): Cluster[] {
1242
+ * if (shouldBypassClustering(map)) {
1243
+ * return this.noop({markers, map})
1244
+ * }
1245
+ * }
1246
+ * ```
1247
+ */
1248
+ noop({ markers: e }) {
1249
+ return ot(e);
1250
+ }
1251
+ }
1252
+ const ot = (o) => o.map((t) => new X({
1253
+ position: t.getPosition(),
1254
+ markers: [t]
1255
+ }));
1256
+ class rt extends nt {
1257
+ constructor(e) {
1258
+ var { maxZoom: t, radius: n = 60 } = e, s = st(e, ["maxZoom", "radius"]);
1259
+ super({ maxZoom: t }), this.superCluster = new Xe(Object.assign({ maxZoom: this.maxZoom, radius: n }, s)), this.state = { zoom: null };
1260
+ }
1261
+ calculate(e) {
1262
+ let t = !1;
1263
+ if (!A(e.markers, this.markers)) {
1264
+ t = !0, this.markers = [...e.markers];
1265
+ const s = this.markers.map((r) => ({
1266
+ type: "Feature",
1267
+ geometry: {
1268
+ type: "Point",
1269
+ coordinates: [
1270
+ r.getPosition().lng(),
1271
+ r.getPosition().lat()
1272
+ ]
1273
+ },
1274
+ properties: { marker: r }
1275
+ }));
1276
+ this.superCluster.load(s);
1277
+ }
1278
+ const n = { zoom: e.map.getZoom() };
1279
+ return t || this.state.zoom > this.maxZoom && n.zoom > this.maxZoom || (t = t || !A(this.state, n)), this.state = n, t && (this.clusters = this.cluster(e)), { clusters: this.clusters, changed: t };
1280
+ }
1281
+ cluster({ map: e }) {
1282
+ return this.superCluster.getClusters([-180, -90, 180, 90], Math.round(e.getZoom())).map(this.transformCluster.bind(this));
1283
+ }
1284
+ transformCluster({ geometry: { coordinates: [e, t] }, properties: n }) {
1285
+ if (n.cluster)
1286
+ return new X({
1287
+ markers: this.superCluster.getLeaves(n.cluster_id, 1 / 0).map((s) => s.properties.marker),
1288
+ position: new google.maps.LatLng({ lat: t, lng: e })
1289
+ });
1290
+ {
1291
+ const s = n.marker;
1292
+ return new X({
1293
+ markers: [s],
1294
+ position: s.getPosition()
1295
+ });
1296
+ }
1297
+ }
1298
+ }
1299
+ class it {
1300
+ constructor(e, t) {
1301
+ this.markers = { sum: e.length };
1302
+ const n = t.map((r) => r.count), s = n.reduce((r, a) => r + a, 0);
1303
+ this.clusters = {
1304
+ count: t.length,
1305
+ markers: {
1306
+ mean: s / t.length,
1307
+ sum: s,
1308
+ min: Math.min(...n),
1309
+ max: Math.max(...n)
1310
+ }
1311
+ };
1312
+ }
1313
+ }
1314
+ class at {
1315
+ /**
1316
+ * The default render function for the library used by {@link MarkerClusterer}.
1317
+ *
1318
+ * Currently set to use the following:
1319
+ *
1320
+ * ```typescript
1321
+ * // change color if this cluster has more markers than the mean cluster
1322
+ * const color =
1323
+ * count > Math.max(10, stats.clusters.markers.mean)
1324
+ * ? "#ff0000"
1325
+ * : "#0000ff";
1326
+ *
1327
+ * // create svg url with fill color
1328
+ * const svg = window.btoa(`
1329
+ * <svg fill="${color}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 240">
1330
+ * <circle cx="120" cy="120" opacity=".6" r="70" />
1331
+ * <circle cx="120" cy="120" opacity=".3" r="90" />
1332
+ * <circle cx="120" cy="120" opacity=".2" r="110" />
1333
+ * <circle cx="120" cy="120" opacity=".1" r="130" />
1334
+ * </svg>`);
1335
+ *
1336
+ * // create marker using svg icon
1337
+ * return new google.maps.Marker({
1338
+ * position,
1339
+ * icon: {
1340
+ * url: `data:image/svg+xml;base64,${svg}`,
1341
+ * scaledSize: new google.maps.Size(45, 45),
1342
+ * },
1343
+ * label: {
1344
+ * text: String(count),
1345
+ * color: "rgba(255,255,255,0.9)",
1346
+ * fontSize: "12px",
1347
+ * },
1348
+ * // adjust zIndex to be above other markers
1349
+ * zIndex: 1000 + count,
1350
+ * });
1351
+ * ```
1352
+ */
1353
+ render({ count: e, position: t }, n) {
1354
+ const s = e > Math.max(10, n.clusters.markers.mean) ? "#ff0000" : "#0000ff", r = window.btoa(`
1355
+ <svg fill="${s}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 240">
1356
+ <circle cx="120" cy="120" opacity=".6" r="70" />
1357
+ <circle cx="120" cy="120" opacity=".3" r="90" />
1358
+ <circle cx="120" cy="120" opacity=".2" r="110" />
1359
+ </svg>`);
1360
+ return new google.maps.Marker({
1361
+ position: t,
1362
+ icon: {
1363
+ url: `data:image/svg+xml;base64,${r}`,
1364
+ scaledSize: new google.maps.Size(45, 45)
1365
+ },
1366
+ label: {
1367
+ text: String(e),
1368
+ color: "rgba(255,255,255,0.9)",
1369
+ fontSize: "12px"
1370
+ },
1371
+ title: `Cluster of ${e} markers`,
1372
+ // adjust zIndex to be above other markers
1373
+ zIndex: Number(google.maps.Marker.MAX_ZINDEX) + e
1374
+ });
1375
+ }
1376
+ }
1377
+ function lt(o, e) {
1378
+ for (let t in e.prototype)
1379
+ o.prototype[t] = e.prototype[t];
1380
+ }
1381
+ class Q {
1382
+ constructor() {
1383
+ lt(Q, google.maps.OverlayView);
1384
+ }
1385
+ }
1386
+ var x;
1387
+ (function(o) {
1388
+ o.CLUSTERING_BEGIN = "clusteringbegin", o.CLUSTERING_END = "clusteringend", o.CLUSTER_CLICK = "click";
1389
+ })(x || (x = {}));
1390
+ const ct = (o, e, t) => {
1391
+ t.fitBounds(e.bounds);
1392
+ };
1393
+ class ut extends Q {
1394
+ constructor({ map: e, markers: t = [], algorithm: n = new rt({}), renderer: s = new at(), onClusterClick: r = ct }) {
1395
+ super(), this.markers = [...t], this.clusters = [], this.algorithm = n, this.renderer = s, this.onClusterClick = r, e && this.setMap(e);
1396
+ }
1397
+ addMarker(e, t) {
1398
+ this.markers.includes(e) || (this.markers.push(e), t || this.render());
1399
+ }
1400
+ addMarkers(e, t) {
1401
+ e.forEach((n) => {
1402
+ this.addMarker(n, !0);
1403
+ }), t || this.render();
1404
+ }
1405
+ removeMarker(e, t) {
1406
+ const n = this.markers.indexOf(e);
1407
+ return n === -1 ? !1 : (e.setMap(null), this.markers.splice(n, 1), t || this.render(), !0);
1408
+ }
1409
+ removeMarkers(e, t) {
1410
+ let n = !1;
1411
+ return e.forEach((s) => {
1412
+ n = this.removeMarker(s, !0) || n;
1413
+ }), n && !t && this.render(), n;
1414
+ }
1415
+ clearMarkers(e) {
1416
+ this.markers.length = 0, e || this.render();
1417
+ }
1418
+ /**
1419
+ * Recalculates and draws all the marker clusters.
1420
+ */
1421
+ render() {
1422
+ const e = this.getMap();
1423
+ if (e instanceof google.maps.Map && this.getProjection()) {
1424
+ google.maps.event.trigger(this, x.CLUSTERING_BEGIN, this);
1425
+ const { clusters: t, changed: n } = this.algorithm.calculate({
1426
+ markers: this.markers,
1427
+ map: e,
1428
+ mapCanvasProjection: this.getProjection()
1429
+ });
1430
+ (n || n == null) && (this.reset(), this.clusters = t, this.renderClusters()), google.maps.event.trigger(this, x.CLUSTERING_END, this);
1431
+ }
1432
+ }
1433
+ onAdd() {
1434
+ this.idleListener = this.getMap().addListener("idle", this.render.bind(this)), this.render();
1435
+ }
1436
+ onRemove() {
1437
+ google.maps.event.removeListener(this.idleListener), this.reset();
1438
+ }
1439
+ reset() {
1440
+ this.markers.forEach((e) => e.setMap(null)), this.clusters.forEach((e) => e.delete()), this.clusters = [];
1441
+ }
1442
+ renderClusters() {
1443
+ const e = new it(this.markers, this.clusters), t = this.getMap();
1444
+ this.clusters.forEach((n) => {
1445
+ n.markers.length === 1 ? n.marker = n.markers[0] : (n.marker = this.renderer.render(n, e), this.onClusterClick && n.marker.addListener(
1446
+ "click",
1447
+ /* istanbul ignore next */
1448
+ (s) => {
1449
+ google.maps.event.trigger(this, x.CLUSTER_CLICK, n), this.onClusterClick(s, n, t);
1450
+ }
1451
+ )), n.marker.setMap(t);
1452
+ });
1453
+ }
1454
+ }
1455
+ const me = Object.values(x), Ot = k({
1456
+ name: "MarkerCluster",
1457
+ props: {
1458
+ options: {
1459
+ type: Object,
1460
+ default: () => ({})
1461
+ }
1462
+ },
1463
+ emits: me,
1464
+ setup(o, { emit: e, expose: t, slots: n }) {
1465
+ const s = v(), r = y(I, v()), a = y(E, v());
1466
+ return q(ke, s), b(
1467
+ r,
1468
+ () => {
1469
+ r.value && (s.value = M(new ut({ map: r.value, ...o.options })), me.forEach((l) => {
1470
+ var i;
1471
+ (i = s.value) == null || i.addListener(l, (p) => e(l, p));
1472
+ }));
1473
+ },
1474
+ {
1475
+ immediate: !0
1476
+ }
1477
+ ), S(() => {
1478
+ var l;
1479
+ s.value && ((l = a.value) == null || l.event.clearInstanceListeners(s.value), s.value.clearMarkers(), s.value.setMap(null));
1480
+ }), t({ markerCluster: s }), () => {
1481
+ var l;
1482
+ return (l = n.default) == null ? void 0 : l.call(n);
1483
+ };
1484
+ }
1485
+ }), pt = k({
1486
+ inheritAttrs: !1,
1487
+ props: {
1488
+ options: {
1489
+ type: Object,
1490
+ required: !0
1491
+ }
1492
+ },
1493
+ setup(o, { slots: e, emit: t, expose: n }) {
1494
+ const s = v(), r = z(() => {
1495
+ var i;
1496
+ return (i = e.default) == null ? void 0 : i.call(e).some((p) => p.type !== ve);
1497
+ }), a = z(() => ({
1498
+ ...o.options,
1499
+ element: s.value
1500
+ })), l = $(H, [], a, t);
1501
+ return n({
1502
+ customMarker: l
1503
+ }), { customMarkerRef: s, customMarker: l, hasSlotContent: r };
1504
+ }
1505
+ });
1506
+ const dt = {
1507
+ key: 0,
1508
+ class: "custom-marker-wrapper"
1509
+ };
1510
+ function ht(o, e, t, n, s, r) {
1511
+ return o.hasSlotContent ? (F(), G("div", dt, [
1512
+ Y("div", ye({
1513
+ ref: "customMarkerRef",
1514
+ style: { cursor: o.$attrs.onClick ? "pointer" : void 0 }
1515
+ }, o.$attrs), [
1516
+ U(o.$slots, "default", {}, void 0, !0)
1517
+ ], 16)
1518
+ ])) : Ce("", !0);
1519
+ }
1520
+ const xt = /* @__PURE__ */ K(pt, [["render", ht], ["__scopeId", "data-v-c7599d50"]]), Pt = k({
1521
+ name: "HeatmapLayer",
1522
+ props: {
1523
+ options: {
1524
+ type: Object,
1525
+ default: () => ({})
1526
+ }
1527
+ },
1528
+ setup(o) {
1529
+ const e = v(), t = y(I, v()), n = y(E, v());
1530
+ return b(
1531
+ [t, () => o.options],
1532
+ ([s, r], [a, l]) => {
1533
+ var p;
1534
+ const i = !A(r, l) || t.value !== a;
1535
+ if (t.value && n.value && i) {
1536
+ const u = structuredClone(r);
1537
+ if (u.data && !(u.data instanceof n.value.MVCArray)) {
1538
+ const c = n.value.LatLng;
1539
+ u.data = (p = u.data) == null ? void 0 : p.map((h) => h instanceof c || "location" in h && (h.location instanceof c || h.location === null) ? h : "location" in h ? { ...h, location: new c(h.location) } : new c(h));
1540
+ }
1541
+ e.value ? e.value.setOptions(u) : e.value = M(
1542
+ new n.value.visualization.HeatmapLayer({
1543
+ ...u,
1544
+ map: t.value
1545
+ })
1546
+ );
1547
+ }
1548
+ },
1549
+ { immediate: !0 }
1550
+ ), S(() => {
1551
+ e.value && e.value.setMap(null);
1552
+ }), { heatmapLayer: e };
1553
+ },
1554
+ render: () => null
1555
+ });
1556
+ export {
1557
+ wt as Circle,
1558
+ bt as CustomControl,
1559
+ xt as CustomMarker,
1560
+ vt as GoogleMap,
1561
+ Pt as HeatmapLayer,
1562
+ Mt as InfoWindow,
1563
+ yt as Marker,
1564
+ Ot as MarkerCluster,
1565
+ _t as Polygon,
1566
+ Ct as Polyline,
1567
+ kt as Rectangle
1568
+ };