vue-maplibre-compare 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1078 @@
1
+ import { ref as P, defineComponent as Se, watch as j, onMounted as Je, onBeforeUnmount as Xe, computed as Ye, createElementBlock as Qe, openBlock as se, normalizeStyle as et, createElementVNode as ne, createBlock as Me, createCommentVNode as tt, Teleport as rt, renderSlot as nt, resolveComponent as ot } from "vue";
2
+ import le from "maplibre-gl";
3
+ var T = Uint8Array, Z = Uint16Array, it = Int32Array, ze = new T([
4
+ 0,
5
+ 0,
6
+ 0,
7
+ 0,
8
+ 0,
9
+ 0,
10
+ 0,
11
+ 0,
12
+ 1,
13
+ 1,
14
+ 1,
15
+ 1,
16
+ 2,
17
+ 2,
18
+ 2,
19
+ 2,
20
+ 3,
21
+ 3,
22
+ 3,
23
+ 3,
24
+ 4,
25
+ 4,
26
+ 4,
27
+ 4,
28
+ 5,
29
+ 5,
30
+ 5,
31
+ 5,
32
+ 0,
33
+ /* unused */
34
+ 0,
35
+ 0,
36
+ /* impossible */
37
+ 0
38
+ ]), Te = new T([
39
+ 0,
40
+ 0,
41
+ 0,
42
+ 0,
43
+ 1,
44
+ 1,
45
+ 2,
46
+ 2,
47
+ 3,
48
+ 3,
49
+ 4,
50
+ 4,
51
+ 5,
52
+ 5,
53
+ 6,
54
+ 6,
55
+ 7,
56
+ 7,
57
+ 8,
58
+ 8,
59
+ 9,
60
+ 9,
61
+ 10,
62
+ 10,
63
+ 11,
64
+ 11,
65
+ 12,
66
+ 12,
67
+ 13,
68
+ 13,
69
+ /* unused */
70
+ 0,
71
+ 0
72
+ ]), at = new T([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), Oe = function(e, r) {
73
+ for (var t = new Z(31), n = 0; n < 31; ++n)
74
+ t[n] = r += 1 << e[n - 1];
75
+ for (var o = new it(t[30]), n = 1; n < 30; ++n)
76
+ for (var i = t[n]; i < t[n + 1]; ++i)
77
+ o[i] = i - t[n] << 5 | n;
78
+ return { b: t, r: o };
79
+ }, Ae = Oe(ze, 2), Ue = Ae.b, st = Ae.r;
80
+ Ue[28] = 258, st[258] = 28;
81
+ var lt = Oe(Te, 0), ct = lt.b, ce = new Z(32768);
82
+ for (var y = 0; y < 32768; ++y) {
83
+ var B = (y & 43690) >> 1 | (y & 21845) << 1;
84
+ B = (B & 52428) >> 2 | (B & 13107) << 2, B = (B & 61680) >> 4 | (B & 3855) << 4, ce[y] = ((B & 65280) >> 8 | (B & 255) << 8) >> 1;
85
+ }
86
+ var _ = (function(e, r, t) {
87
+ for (var n = e.length, o = 0, i = new Z(r); o < n; ++o)
88
+ e[o] && ++i[e[o] - 1];
89
+ var a = new Z(r);
90
+ for (o = 1; o < r; ++o)
91
+ a[o] = a[o - 1] + i[o - 1] << 1;
92
+ var s;
93
+ if (t) {
94
+ s = new Z(1 << r);
95
+ var l = 15 - r;
96
+ for (o = 0; o < n; ++o)
97
+ if (e[o])
98
+ for (var c = o << 4 | e[o], h = r - e[o], u = a[e[o] - 1]++ << h, d = u | (1 << h) - 1; u <= d; ++u)
99
+ s[ce[u] >> l] = c;
100
+ } else
101
+ for (s = new Z(n), o = 0; o < n; ++o)
102
+ e[o] && (s[o] = ce[a[e[o] - 1]++] >> 15 - e[o]);
103
+ return s;
104
+ }), K = new T(288);
105
+ for (var y = 0; y < 144; ++y)
106
+ K[y] = 8;
107
+ for (var y = 144; y < 256; ++y)
108
+ K[y] = 9;
109
+ for (var y = 256; y < 280; ++y)
110
+ K[y] = 7;
111
+ for (var y = 280; y < 288; ++y)
112
+ K[y] = 8;
113
+ var ke = new T(32);
114
+ for (var y = 0; y < 32; ++y)
115
+ ke[y] = 5;
116
+ var ut = /* @__PURE__ */ _(K, 9, 1), ht = /* @__PURE__ */ _(ke, 5, 1), oe = function(e) {
117
+ for (var r = e[0], t = 1; t < e.length; ++t)
118
+ e[t] > r && (r = e[t]);
119
+ return r;
120
+ }, A = function(e, r, t) {
121
+ var n = r / 8 | 0;
122
+ return (e[n] | e[n + 1] << 8) >> (r & 7) & t;
123
+ }, ie = function(e, r) {
124
+ var t = r / 8 | 0;
125
+ return (e[t] | e[t + 1] << 8 | e[t + 2] << 16) >> (r & 7);
126
+ }, dt = function(e) {
127
+ return (e + 7) / 8 | 0;
128
+ }, ft = function(e, r, t) {
129
+ return (t == null || t > e.length) && (t = e.length), new T(e.subarray(r, t));
130
+ }, mt = [
131
+ "unexpected EOF",
132
+ "invalid block type",
133
+ "invalid length/literal",
134
+ "invalid distance",
135
+ "stream finished",
136
+ "no stream handler",
137
+ ,
138
+ "no callback",
139
+ "invalid UTF-8 data",
140
+ "extra field too long",
141
+ "date not in range 1980-2099",
142
+ "filename too long",
143
+ "stream finishing",
144
+ "invalid zip data"
145
+ // determined by unknown compression method
146
+ ], z = function(e, r, t) {
147
+ var n = new Error(r || mt[e]);
148
+ if (n.code = e, Error.captureStackTrace && Error.captureStackTrace(n, z), !t)
149
+ throw n;
150
+ return n;
151
+ }, he = function(e, r, t, n) {
152
+ var o = e.length, i = 0;
153
+ if (!o || r.f && !r.l)
154
+ return t || new T(0);
155
+ var a = !t, s = a || r.i != 2, l = r.i;
156
+ a && (t = new T(o * 3));
157
+ var c = function(be) {
158
+ var Ce = t.length;
159
+ if (be > Ce) {
160
+ var Le = new T(Math.max(Ce * 2, be));
161
+ Le.set(t), t = Le;
162
+ }
163
+ }, h = r.f || 0, u = r.p || 0, d = r.b || 0, v = r.l, g = r.d, f = r.m, S = r.n, b = o * 8;
164
+ do {
165
+ if (!v) {
166
+ h = A(e, u, 1);
167
+ var U = A(e, u + 1, 3);
168
+ if (u += 3, U)
169
+ if (U == 1)
170
+ v = ut, g = ht, f = 9, S = 5;
171
+ else if (U == 2) {
172
+ var V = A(e, u, 31) + 257, X = A(e, u + 10, 15) + 4, m = V + A(e, u + 5, 31) + 1;
173
+ u += 14;
174
+ for (var w = new T(m), E = new T(19), x = 0; x < X; ++x)
175
+ E[at[x]] = A(e, u + x * 3, 7);
176
+ u += X * 3;
177
+ for (var W = oe(E), Y = (1 << W) - 1, Q = _(E, W, 1), x = 0; x < m; ) {
178
+ var q = Q[A(e, u, Y)];
179
+ u += q & 15;
180
+ var M = q >> 4;
181
+ if (M < 16)
182
+ w[x++] = M;
183
+ else {
184
+ var R = 0, G = 0;
185
+ for (M == 16 ? (G = 3 + A(e, u, 3), u += 2, R = w[x - 1]) : M == 17 ? (G = 3 + A(e, u, 7), u += 3) : M == 18 && (G = 11 + A(e, u, 127), u += 7); G--; )
186
+ w[x++] = R;
187
+ }
188
+ }
189
+ var pe = w.subarray(0, V), $ = w.subarray(V);
190
+ f = oe(pe), S = oe($), v = _(pe, f, 1), g = _($, S, 1);
191
+ } else
192
+ z(1);
193
+ else {
194
+ var M = dt(u) + 4, D = e[M - 4] | e[M - 3] << 8, k = M + D;
195
+ if (k > o) {
196
+ l && z(0);
197
+ break;
198
+ }
199
+ s && c(d + D), t.set(e.subarray(M, k), d), r.b = d += D, r.p = u = k * 8, r.f = h;
200
+ continue;
201
+ }
202
+ if (u > b) {
203
+ l && z(0);
204
+ break;
205
+ }
206
+ }
207
+ s && c(d + 131072);
208
+ for (var We = (1 << f) - 1, qe = (1 << S) - 1, ee = u; ; ee = u) {
209
+ var R = v[ie(e, u) & We], H = R >> 4;
210
+ if (u += R & 15, u > b) {
211
+ l && z(0);
212
+ break;
213
+ }
214
+ if (R || z(2), H < 256)
215
+ t[d++] = H;
216
+ else if (H == 256) {
217
+ ee = u, v = null;
218
+ break;
219
+ } else {
220
+ var ge = H - 254;
221
+ if (H > 264) {
222
+ var x = H - 257, N = ze[x];
223
+ ge = A(e, u, (1 << N) - 1) + Ue[x], u += N;
224
+ }
225
+ var te = g[ie(e, u) & qe], re = te >> 4;
226
+ te || z(3), u += te & 15;
227
+ var $ = ct[re];
228
+ if (re > 3) {
229
+ var N = Te[re];
230
+ $ += ie(e, u) & (1 << N) - 1, u += N;
231
+ }
232
+ if (u > b) {
233
+ l && z(0);
234
+ break;
235
+ }
236
+ s && c(d + 131072);
237
+ var ye = d + ge;
238
+ if (d < $) {
239
+ var we = i - $, Ge = Math.min($, ye);
240
+ for (we + d < 0 && z(3); d < Ge; ++d)
241
+ t[d] = n[we + d];
242
+ }
243
+ for (; d < ye; ++d)
244
+ t[d] = t[d - $];
245
+ }
246
+ }
247
+ r.l = v, r.p = ee, r.b = d, r.f = h, v && (h = 1, r.m = f, r.d = g, r.n = S);
248
+ } while (!h);
249
+ return d != t.length && a ? ft(t, 0, d) : t.subarray(0, d);
250
+ }, vt = /* @__PURE__ */ new T(0), pt = function(e) {
251
+ (e[0] != 31 || e[1] != 139 || e[2] != 8) && z(6, "invalid gzip data");
252
+ var r = e[3], t = 10;
253
+ r & 4 && (t += (e[10] | e[11] << 8) + 2);
254
+ for (var n = (r >> 3 & 1) + (r >> 4 & 1); n > 0; n -= !e[t++])
255
+ ;
256
+ return t + (r & 2);
257
+ }, gt = function(e) {
258
+ var r = e.length;
259
+ return (e[r - 4] | e[r - 3] << 8 | e[r - 2] << 16 | e[r - 1] << 24) >>> 0;
260
+ }, yt = function(e, r) {
261
+ return ((e[0] & 15) != 8 || e[0] >> 4 > 7 || (e[0] << 8 | e[1]) % 31) && z(6, "invalid zlib data"), (e[1] >> 5 & 1) == 1 && z(6, "invalid zlib data: " + (e[1] & 32 ? "need" : "unexpected") + " dictionary"), (e[1] >> 3 & 4) + 2;
262
+ };
263
+ function wt(e, r) {
264
+ return he(e, { i: 2 }, r, r);
265
+ }
266
+ function bt(e, r) {
267
+ var t = pt(e);
268
+ return t + 8 > e.length && z(6, "invalid gzip data"), he(e.subarray(t, -8), { i: 2 }, new T(gt(e)), r);
269
+ }
270
+ function Ct(e, r) {
271
+ return he(e.subarray(yt(e), -4), { i: 2 }, r, r);
272
+ }
273
+ function Lt(e, r) {
274
+ return e[0] == 31 && e[1] == 139 && e[2] == 8 ? bt(e, r) : (e[0] & 15) != 8 || e[0] >> 4 > 7 || (e[0] << 8 | e[1]) % 31 ? wt(e, r) : Ct(e, r);
275
+ }
276
+ var Et = typeof TextDecoder < "u" && /* @__PURE__ */ new TextDecoder(), xt = 0;
277
+ try {
278
+ Et.decode(vt, { stream: !0 }), xt = 1;
279
+ } catch {
280
+ }
281
+ var St = Object.defineProperty, F = Math.pow, p = (e, r) => St(e, "name", { value: r, configurable: !0 }), C = (e, r, t) => new Promise((n, o) => {
282
+ var i = (l) => {
283
+ try {
284
+ s(t.next(l));
285
+ } catch (c) {
286
+ o(c);
287
+ }
288
+ }, a = (l) => {
289
+ try {
290
+ s(t.throw(l));
291
+ } catch (c) {
292
+ o(c);
293
+ }
294
+ }, s = (l) => l.done ? n(l.value) : Promise.resolve(l.value).then(i, a);
295
+ s((t = t.apply(e, r)).next());
296
+ });
297
+ p((e, r) => {
298
+ let t = !1, n = "", o = L.GridLayer.extend({ createTile: p((i, a) => {
299
+ let s = document.createElement("img"), l = new AbortController(), c = l.signal;
300
+ return s.cancel = () => {
301
+ l.abort();
302
+ }, t || (e.getHeader().then((h) => {
303
+ h.tileType === 1 ? console.error("Error: archive contains MVT vector tiles, but leafletRasterLayer is for displaying raster tiles. See https://github.com/protomaps/PMTiles/tree/main/js for details.") : h.tileType === 2 ? n = "image/png" : h.tileType === 3 ? n = "image/jpeg" : h.tileType === 4 ? n = "image/webp" : h.tileType === 5 && (n = "image/avif");
304
+ }), t = !0), e.getZxy(i.z, i.x, i.y, c).then((h) => {
305
+ if (h) {
306
+ let u = new Blob([h.data], { type: n }), d = window.URL.createObjectURL(u);
307
+ s.src = d, s.cancel = void 0, a(void 0, s);
308
+ }
309
+ }).catch((h) => {
310
+ if (h.name !== "AbortError") throw h;
311
+ }), s;
312
+ }, "createTile"), _removeTile: p(function(i) {
313
+ let a = this._tiles[i];
314
+ a && (a.el.cancel && a.el.cancel(), a.el.width = 0, a.el.height = 0, a.el.deleted = !0, L.DomUtil.remove(a.el), delete this._tiles[i], this.fire("tileunload", { tile: a.el, coords: this._keyToTileCoords(i) }));
315
+ }, "_removeTile") });
316
+ return new o(r);
317
+ }, "leafletRasterLayer");
318
+ var Mt = p((e) => (r, t) => {
319
+ if (t instanceof AbortController) return e(r, t);
320
+ let n = new AbortController();
321
+ return e(r, n).then((o) => t(void 0, o.data, o.cacheControl || "", o.expires || ""), (o) => t(o)).catch((o) => t(o)), { cancel: p(() => n.abort(), "cancel") };
322
+ }, "v3compat"), $e = class {
323
+ constructor(r) {
324
+ this.tilev4 = p((t, n) => C(this, null, function* () {
325
+ if (t.type === "json") {
326
+ let v = t.url.substr(10), g = this.tiles.get(v);
327
+ if (g || (g = new Ee(v), this.tiles.set(v, g)), this.metadata) return { data: yield g.getTileJson(t.url) };
328
+ let f = yield g.getHeader();
329
+ return (f.minLon >= f.maxLon || f.minLat >= f.maxLat) && console.error(`Bounds of PMTiles archive ${f.minLon},${f.minLat},${f.maxLon},${f.maxLat} are not valid.`), { data: { tiles: [`${t.url}/{z}/{x}/{y}`], minzoom: f.minZoom, maxzoom: f.maxZoom, bounds: [f.minLon, f.minLat, f.maxLon, f.maxLat] } };
330
+ }
331
+ let o = new RegExp(/pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/), i = t.url.match(o);
332
+ if (!i) throw new Error("Invalid PMTiles protocol URL");
333
+ let a = i[1], s = this.tiles.get(a);
334
+ s || (s = new Ee(a), this.tiles.set(a, s));
335
+ let l = i[2], c = i[3], h = i[4], u = yield s.getHeader(), d = yield s?.getZxy(+l, +c, +h, n.signal);
336
+ if (d) return { data: new Uint8Array(d.data), cacheControl: d.cacheControl, expires: d.expires };
337
+ if (u.tileType === 1) {
338
+ if (this.errorOnMissingTile) throw new Error("Tile not found.");
339
+ return { data: new Uint8Array() };
340
+ }
341
+ return { data: null };
342
+ }), "tilev4"), this.tile = Mt(this.tilev4), this.tiles = /* @__PURE__ */ new Map(), this.metadata = r?.metadata || !1, this.errorOnMissingTile = r?.errorOnMissingTile || !1;
343
+ }
344
+ add(r) {
345
+ this.tiles.set(r.source.getKey(), r);
346
+ }
347
+ get(r) {
348
+ return this.tiles.get(r);
349
+ }
350
+ };
351
+ p($e, "Protocol");
352
+ var zt = $e;
353
+ function Be(e, r) {
354
+ return (r >>> 0) * 4294967296 + (e >>> 0);
355
+ }
356
+ p(Be, "toNum");
357
+ function Pe(e, r) {
358
+ let t = r.buf, n = t[r.pos++], o = (n & 112) >> 4;
359
+ if (n < 128 || (n = t[r.pos++], o |= (n & 127) << 3, n < 128) || (n = t[r.pos++], o |= (n & 127) << 10, n < 128) || (n = t[r.pos++], o |= (n & 127) << 17, n < 128) || (n = t[r.pos++], o |= (n & 127) << 24, n < 128) || (n = t[r.pos++], o |= (n & 1) << 31, n < 128)) return Be(e, o);
360
+ throw new Error("Expected varint not more than 10 bytes");
361
+ }
362
+ p(Pe, "readVarintRemainder");
363
+ function I(e) {
364
+ let r = e.buf, t = r[e.pos++], n = t & 127;
365
+ return t < 128 || (t = r[e.pos++], n |= (t & 127) << 7, t < 128) || (t = r[e.pos++], n |= (t & 127) << 14, t < 128) || (t = r[e.pos++], n |= (t & 127) << 21, t < 128) ? n : (t = r[e.pos], n |= (t & 15) << 28, Pe(n, e));
366
+ }
367
+ p(I, "readVarint");
368
+ function de(e, r, t, n) {
369
+ if (n === 0) {
370
+ t === 1 && (r[0] = e - 1 - r[0], r[1] = e - 1 - r[1]);
371
+ let o = r[0];
372
+ r[0] = r[1], r[1] = o;
373
+ }
374
+ }
375
+ p(de, "rotate");
376
+ function De(e, r) {
377
+ let t = F(2, e), n = r, o = r, i = r, a = [0, 0], s = 1;
378
+ for (; s < t; ) n = 1 & i / 2, o = 1 & (i ^ n), de(s, a, n, o), a[0] += s * n, a[1] += s * o, i = i / 4, s *= 2;
379
+ return [e, a[0], a[1]];
380
+ }
381
+ p(De, "idOnLevel");
382
+ var Tt = [0, 1, 5, 21, 85, 341, 1365, 5461, 21845, 87381, 349525, 1398101, 5592405, 22369621, 89478485, 357913941, 1431655765, 5726623061, 22906492245, 91625968981, 366503875925, 1466015503701, 5864062014805, 23456248059221, 93824992236885, 375299968947541, 1501199875790165];
383
+ function Re(e, r, t) {
384
+ if (e > 26) throw new Error("Tile zoom level exceeds max safe number limit (26)");
385
+ if (r > F(2, e) - 1 || t > F(2, e) - 1) throw new Error("tile x/y outside zoom level bounds");
386
+ let n = Tt[e], o = F(2, e), i = 0, a = 0, s = 0, l = [r, t], c = o / 2;
387
+ for (; c > 0; ) i = (l[0] & c) > 0 ? 1 : 0, a = (l[1] & c) > 0 ? 1 : 0, s += c * c * (3 * i ^ a), de(c, l, i, a), c = c / 2;
388
+ return n + s;
389
+ }
390
+ p(Re, "zxyToTileId");
391
+ function Ot(e) {
392
+ let r = 0;
393
+ for (let t = 0; t < 27; t++) {
394
+ let n = (1 << t) * (1 << t);
395
+ if (r + n > e) return De(t, e - r);
396
+ r += n;
397
+ }
398
+ throw new Error("Tile zoom level exceeds max safe number limit (26)");
399
+ }
400
+ p(Ot, "tileIdToZxy");
401
+ var At = ((e) => (e[e.Unknown = 0] = "Unknown", e[e.None = 1] = "None", e[e.Gzip = 2] = "Gzip", e[e.Brotli = 3] = "Brotli", e[e.Zstd = 4] = "Zstd", e))(At || {});
402
+ function J(e, r) {
403
+ return C(this, null, function* () {
404
+ if (r === 1 || r === 0) return e;
405
+ if (r === 2) {
406
+ if (typeof globalThis.DecompressionStream > "u") return Lt(new Uint8Array(e));
407
+ let t = new Response(e).body;
408
+ if (!t) throw new Error("Failed to read response stream");
409
+ let n = t.pipeThrough(new globalThis.DecompressionStream("gzip"));
410
+ return new Response(n).arrayBuffer();
411
+ }
412
+ throw new Error("Compression method not supported");
413
+ });
414
+ }
415
+ p(J, "defaultDecompress");
416
+ var Ut = ((e) => (e[e.Unknown = 0] = "Unknown", e[e.Mvt = 1] = "Mvt", e[e.Png = 2] = "Png", e[e.Jpeg = 3] = "Jpeg", e[e.Webp = 4] = "Webp", e[e.Avif = 5] = "Avif", e))(Ut || {});
417
+ function He(e) {
418
+ return e === 1 ? ".mvt" : e === 2 ? ".png" : e === 3 ? ".jpg" : e === 4 ? ".webp" : e === 5 ? ".avif" : "";
419
+ }
420
+ p(He, "tileTypeExt");
421
+ var kt = 127;
422
+ function Ie(e, r) {
423
+ let t = 0, n = e.length - 1;
424
+ for (; t <= n; ) {
425
+ let o = n + t >> 1, i = r - e[o].tileId;
426
+ if (i > 0) t = o + 1;
427
+ else if (i < 0) n = o - 1;
428
+ else return e[o];
429
+ }
430
+ return n >= 0 && (e[n].runLength === 0 || r - e[n].tileId < e[n].runLength) ? e[n] : null;
431
+ }
432
+ p(Ie, "findTile");
433
+ var $t = class {
434
+ constructor(r) {
435
+ this.file = r;
436
+ }
437
+ getKey() {
438
+ return this.file.name;
439
+ }
440
+ getBytes(r, t) {
441
+ return C(this, null, function* () {
442
+ return { data: yield this.file.slice(r, r + t).arrayBuffer() };
443
+ });
444
+ }
445
+ };
446
+ p($t, "FileSource");
447
+ var Ze = class {
448
+ constructor(r, t = new Headers()) {
449
+ this.url = r, this.customHeaders = t, this.mustReload = !1;
450
+ let n = "";
451
+ "navigator" in globalThis && (n = globalThis.navigator.userAgent || "");
452
+ let o = n.indexOf("Windows") > -1, i = /Chrome|Chromium|Edg|OPR|Brave/.test(n);
453
+ this.chromeWindowsNoCache = !1, o && i && (this.chromeWindowsNoCache = !0);
454
+ }
455
+ getKey() {
456
+ return this.url;
457
+ }
458
+ setHeaders(r) {
459
+ this.customHeaders = r;
460
+ }
461
+ getBytes(r, t, n, o) {
462
+ return C(this, null, function* () {
463
+ let i, a;
464
+ n ? a = n : (i = new AbortController(), a = i.signal);
465
+ let s = new Headers(this.customHeaders);
466
+ s.set("range", `bytes=${r}-${r + t - 1}`);
467
+ let l;
468
+ this.mustReload ? l = "reload" : this.chromeWindowsNoCache && (l = "no-store");
469
+ let c = yield fetch(this.url, { signal: a, cache: l, headers: s });
470
+ if (r === 0 && c.status === 416) {
471
+ let d = c.headers.get("Content-Range");
472
+ if (!d || !d.startsWith("bytes */")) throw new Error("Missing content-length on 416 response");
473
+ let v = +d.substr(8);
474
+ c = yield fetch(this.url, { signal: a, cache: "reload", headers: { range: `bytes=0-${v - 1}` } });
475
+ }
476
+ let h = c.headers.get("Etag");
477
+ if (h != null && h.startsWith("W/") && (h = null), c.status === 416 || o && h && h !== o) throw this.mustReload = !0, new ue(`Server returned non-matching ETag ${o} after one retry. Check browser extensions and servers for issues that may affect correct ETag headers.`);
478
+ if (c.status >= 300) throw new Error(`Bad response code: ${c.status}`);
479
+ let u = c.headers.get("Content-Length");
480
+ if (c.status === 200 && (!u || +u > t)) throw i && i.abort(), new Error("Server returned no content-length header or content-length exceeding request. Check that your storage backend supports HTTP Byte Serving.");
481
+ return { data: yield c.arrayBuffer(), etag: h || void 0, cacheControl: c.headers.get("Cache-Control") || void 0, expires: c.headers.get("Expires") || void 0 };
482
+ });
483
+ }
484
+ };
485
+ p(Ze, "FetchSource");
486
+ var Bt = Ze;
487
+ function O(e, r) {
488
+ let t = e.getUint32(r + 4, !0), n = e.getUint32(r + 0, !0);
489
+ return t * F(2, 32) + n;
490
+ }
491
+ p(O, "getUint64");
492
+ function Ne(e, r) {
493
+ let t = new DataView(e), n = t.getUint8(7);
494
+ if (n > 3) throw new Error(`Archive is spec version ${n} but this library supports up to spec version 3`);
495
+ return { specVersion: n, rootDirectoryOffset: O(t, 8), rootDirectoryLength: O(t, 16), jsonMetadataOffset: O(t, 24), jsonMetadataLength: O(t, 32), leafDirectoryOffset: O(t, 40), leafDirectoryLength: O(t, 48), tileDataOffset: O(t, 56), tileDataLength: O(t, 64), numAddressedTiles: O(t, 72), numTileEntries: O(t, 80), numTileContents: O(t, 88), clustered: t.getUint8(96) === 1, internalCompression: t.getUint8(97), tileCompression: t.getUint8(98), tileType: t.getUint8(99), minZoom: t.getUint8(100), maxZoom: t.getUint8(101), minLon: t.getInt32(102, !0) / 1e7, minLat: t.getInt32(106, !0) / 1e7, maxLon: t.getInt32(110, !0) / 1e7, maxLat: t.getInt32(114, !0) / 1e7, centerZoom: t.getUint8(118), centerLon: t.getInt32(119, !0) / 1e7, centerLat: t.getInt32(123, !0) / 1e7, etag: r };
496
+ }
497
+ p(Ne, "bytesToHeader");
498
+ function fe(e) {
499
+ let r = { buf: new Uint8Array(e), pos: 0 }, t = I(r), n = [], o = 0;
500
+ for (let i = 0; i < t; i++) {
501
+ let a = I(r);
502
+ n.push({ tileId: o + a, offset: 0, length: 0, runLength: 1 }), o += a;
503
+ }
504
+ for (let i = 0; i < t; i++) n[i].runLength = I(r);
505
+ for (let i = 0; i < t; i++) n[i].length = I(r);
506
+ for (let i = 0; i < t; i++) {
507
+ let a = I(r);
508
+ a === 0 && i > 0 ? n[i].offset = n[i - 1].offset + n[i - 1].length : n[i].offset = a - 1;
509
+ }
510
+ return n;
511
+ }
512
+ p(fe, "deserializeIndex");
513
+ var je = class extends Error {
514
+ };
515
+ p(je, "EtagMismatch");
516
+ var ue = je;
517
+ function me(e, r) {
518
+ return C(this, null, function* () {
519
+ let t = yield e.getBytes(0, 16384);
520
+ if (new DataView(t.data).getUint16(0, !0) !== 19792) throw new Error("Wrong magic number for PMTiles archive");
521
+ let n = t.data.slice(0, kt), o = Ne(n, t.etag), i = t.data.slice(o.rootDirectoryOffset, o.rootDirectoryOffset + o.rootDirectoryLength), a = `${e.getKey()}|${o.etag || ""}|${o.rootDirectoryOffset}|${o.rootDirectoryLength}`, s = fe(yield r(i, o.internalCompression));
522
+ return [o, [a, s.length, s]];
523
+ });
524
+ }
525
+ p(me, "getHeaderAndRoot");
526
+ function ve(e, r, t, n, o) {
527
+ return C(this, null, function* () {
528
+ let i = yield e.getBytes(t, n, void 0, o.etag), a = yield r(i.data, o.internalCompression), s = fe(a);
529
+ if (s.length === 0) throw new Error("Empty directory is invalid");
530
+ return s;
531
+ });
532
+ }
533
+ p(ve, "getDirectory");
534
+ var Pt = class {
535
+ constructor(r = 100, t = !0, n = J) {
536
+ this.cache = /* @__PURE__ */ new Map(), this.maxCacheEntries = r, this.counter = 1, this.decompress = n;
537
+ }
538
+ getHeader(r) {
539
+ return C(this, null, function* () {
540
+ let t = r.getKey(), n = this.cache.get(t);
541
+ if (n) return n.lastUsed = this.counter++, n.data;
542
+ let o = yield me(r, this.decompress);
543
+ return o[1] && this.cache.set(o[1][0], { lastUsed: this.counter++, data: o[1][2] }), this.cache.set(t, { lastUsed: this.counter++, data: o[0] }), this.prune(), o[0];
544
+ });
545
+ }
546
+ getDirectory(r, t, n, o) {
547
+ return C(this, null, function* () {
548
+ let i = `${r.getKey()}|${o.etag || ""}|${t}|${n}`, a = this.cache.get(i);
549
+ if (a) return a.lastUsed = this.counter++, a.data;
550
+ let s = yield ve(r, this.decompress, t, n, o);
551
+ return this.cache.set(i, { lastUsed: this.counter++, data: s }), this.prune(), s;
552
+ });
553
+ }
554
+ prune() {
555
+ if (this.cache.size > this.maxCacheEntries) {
556
+ let r = 1 / 0, t;
557
+ this.cache.forEach((n, o) => {
558
+ n.lastUsed < r && (r = n.lastUsed, t = o);
559
+ }), t && this.cache.delete(t);
560
+ }
561
+ }
562
+ invalidate(r) {
563
+ return C(this, null, function* () {
564
+ this.cache.delete(r.getKey());
565
+ });
566
+ }
567
+ };
568
+ p(Pt, "ResolvedValueCache");
569
+ var _e = class {
570
+ constructor(r = 100, t = !0, n = J) {
571
+ this.cache = /* @__PURE__ */ new Map(), this.invalidations = /* @__PURE__ */ new Map(), this.maxCacheEntries = r, this.counter = 1, this.decompress = n;
572
+ }
573
+ getHeader(r) {
574
+ return C(this, null, function* () {
575
+ let t = r.getKey(), n = this.cache.get(t);
576
+ if (n) return n.lastUsed = this.counter++, yield n.data;
577
+ let o = new Promise((i, a) => {
578
+ me(r, this.decompress).then((s) => {
579
+ s[1] && this.cache.set(s[1][0], { lastUsed: this.counter++, data: Promise.resolve(s[1][2]) }), i(s[0]), this.prune();
580
+ }).catch((s) => {
581
+ a(s);
582
+ });
583
+ });
584
+ return this.cache.set(t, { lastUsed: this.counter++, data: o }), o;
585
+ });
586
+ }
587
+ getDirectory(r, t, n, o) {
588
+ return C(this, null, function* () {
589
+ let i = `${r.getKey()}|${o.etag || ""}|${t}|${n}`, a = this.cache.get(i);
590
+ if (a) return a.lastUsed = this.counter++, yield a.data;
591
+ let s = new Promise((l, c) => {
592
+ ve(r, this.decompress, t, n, o).then((h) => {
593
+ l(h), this.prune();
594
+ }).catch((h) => {
595
+ c(h);
596
+ });
597
+ });
598
+ return this.cache.set(i, { lastUsed: this.counter++, data: s }), s;
599
+ });
600
+ }
601
+ prune() {
602
+ if (this.cache.size >= this.maxCacheEntries) {
603
+ let r = 1 / 0, t;
604
+ this.cache.forEach((n, o) => {
605
+ n.lastUsed < r && (r = n.lastUsed, t = o);
606
+ }), t && this.cache.delete(t);
607
+ }
608
+ }
609
+ invalidate(r) {
610
+ return C(this, null, function* () {
611
+ let t = r.getKey();
612
+ if (this.invalidations.get(t)) return yield this.invalidations.get(t);
613
+ this.cache.delete(r.getKey());
614
+ let n = new Promise((o, i) => {
615
+ this.getHeader(r).then((a) => {
616
+ o(), this.invalidations.delete(t);
617
+ }).catch((a) => {
618
+ i(a);
619
+ });
620
+ });
621
+ this.invalidations.set(t, n);
622
+ });
623
+ }
624
+ };
625
+ p(_e, "SharedPromiseCache");
626
+ var Dt = _e, Fe = class {
627
+ constructor(r, t, n) {
628
+ typeof r == "string" ? this.source = new Bt(r) : this.source = r, n ? this.decompress = n : this.decompress = J, t ? this.cache = t : this.cache = new Dt();
629
+ }
630
+ getHeader() {
631
+ return C(this, null, function* () {
632
+ return yield this.cache.getHeader(this.source);
633
+ });
634
+ }
635
+ getZxyAttempt(r, t, n, o) {
636
+ return C(this, null, function* () {
637
+ let i = Re(r, t, n), a = yield this.cache.getHeader(this.source);
638
+ if (r < a.minZoom || r > a.maxZoom) return;
639
+ let s = a.rootDirectoryOffset, l = a.rootDirectoryLength;
640
+ for (let c = 0; c <= 3; c++) {
641
+ let h = yield this.cache.getDirectory(this.source, s, l, a), u = Ie(h, i);
642
+ if (u) {
643
+ if (u.runLength > 0) {
644
+ let d = yield this.source.getBytes(a.tileDataOffset + u.offset, u.length, o, a.etag);
645
+ return { data: yield this.decompress(d.data, a.tileCompression), cacheControl: d.cacheControl, expires: d.expires };
646
+ }
647
+ s = a.leafDirectoryOffset + u.offset, l = u.length;
648
+ } else return;
649
+ }
650
+ throw new Error("Maximum directory depth exceeded");
651
+ });
652
+ }
653
+ getZxy(r, t, n, o) {
654
+ return C(this, null, function* () {
655
+ try {
656
+ return yield this.getZxyAttempt(r, t, n, o);
657
+ } catch (i) {
658
+ if (i instanceof ue) return this.cache.invalidate(this.source), yield this.getZxyAttempt(r, t, n, o);
659
+ throw i;
660
+ }
661
+ });
662
+ }
663
+ getMetadataAttempt() {
664
+ return C(this, null, function* () {
665
+ let r = yield this.cache.getHeader(this.source), t = yield this.source.getBytes(r.jsonMetadataOffset, r.jsonMetadataLength, void 0, r.etag), n = yield this.decompress(t.data, r.internalCompression), o = new TextDecoder("utf-8");
666
+ return JSON.parse(o.decode(n));
667
+ });
668
+ }
669
+ getMetadata() {
670
+ return C(this, null, function* () {
671
+ try {
672
+ return yield this.getMetadataAttempt();
673
+ } catch (r) {
674
+ if (r instanceof ue) return this.cache.invalidate(this.source), yield this.getMetadataAttempt();
675
+ throw r;
676
+ }
677
+ });
678
+ }
679
+ getTileJson(r) {
680
+ return C(this, null, function* () {
681
+ let t = yield this.getHeader(), n = yield this.getMetadata(), o = He(t.tileType);
682
+ return { tilejson: "3.0.0", scheme: "xyz", tiles: [`${r}/{z}/{x}/{y}${o}`], vector_layers: n.vector_layers, attribution: n.attribution, description: n.description, name: n.name, version: n.version, bounds: [t.minLon, t.minLat, t.maxLon, t.maxLat], center: [t.centerLon, t.centerLat, t.centerZoom], minzoom: t.minZoom, maxzoom: t.maxZoom };
683
+ });
684
+ }
685
+ };
686
+ p(Fe, "PMTiles");
687
+ var Ee = Fe;
688
+ function Rt(e) {
689
+ return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
690
+ }
691
+ var ae, xe;
692
+ function Ht() {
693
+ if (xe) return ae;
694
+ xe = 1;
695
+ function e(t, n) {
696
+ var o = t.getCenter(), i = t.getZoom(), a = t.getBearing(), s = t.getPitch();
697
+ n.forEach(function(l) {
698
+ l.jumpTo({
699
+ center: o,
700
+ zoom: i,
701
+ bearing: a,
702
+ pitch: s
703
+ });
704
+ });
705
+ }
706
+ function r() {
707
+ var t, n = arguments.length;
708
+ if (n === 1)
709
+ t = arguments[0];
710
+ else {
711
+ t = [];
712
+ for (var o = 0; o < n; o++)
713
+ t.push(arguments[o]);
714
+ }
715
+ var i = [];
716
+ t.forEach(function(c, h) {
717
+ i[h] = l.bind(null, c, t.filter(function(u, d) {
718
+ return d !== h;
719
+ }));
720
+ });
721
+ function a() {
722
+ t.forEach(function(c, h) {
723
+ c.on("move", i[h]);
724
+ });
725
+ }
726
+ function s() {
727
+ t.forEach(function(c, h) {
728
+ c.off("move", i[h]);
729
+ });
730
+ }
731
+ function l(c, h) {
732
+ s(), e(c, h), a();
733
+ }
734
+ return a(), function() {
735
+ s(), i = [], t = [];
736
+ };
737
+ }
738
+ return ae = r, ae;
739
+ }
740
+ var It = Ht();
741
+ const Zt = /* @__PURE__ */ Rt(It);
742
+ class Nt {
743
+ events = /* @__PURE__ */ new Map();
744
+ on(r, t) {
745
+ const n = this.events.get(r) || [];
746
+ n.push(t), this.events.set(r, n);
747
+ }
748
+ off(r, t) {
749
+ const n = this.events.get(r);
750
+ if (n) {
751
+ const o = n.indexOf(t);
752
+ o > -1 && (n.splice(o, 1), n.length === 0 ? this.events.delete(r) : this.events.set(r, n));
753
+ }
754
+ }
755
+ emit(r, ...t) {
756
+ const n = this.events.get(r);
757
+ n && n.forEach((o) => o(...t));
758
+ }
759
+ }
760
+ function jt(e, r, t, n = {}) {
761
+ const o = {
762
+ orientation: "vertical",
763
+ mousemove: !1,
764
+ ...n
765
+ }, i = o.orientation === "horizontal", a = P(null), s = P(null), l = P(null), c = P(null), h = new Nt();
766
+ let u = null, d = null, v = !1;
767
+ const g = (m) => {
768
+ if (!l.value || !s.value) return;
769
+ const w = i ? l.value.height : l.value.width, E = Math.min(m, w), x = i ? `translate(0, ${E}px)` : `translate(${E}px, 0)`;
770
+ s.value.style.transform = x;
771
+ const W = i ? `rect(0, 999em, ${E}px, 0)` : `rect(0, ${E}px, ${l.value.height}px, 0)`, Y = i ? `rect(${E}px, 999em, ${l.value.height}px, 0)` : `rect(0, 999em, ${l.value.height}px, ${E}px)`, Q = e.getContainer(), q = r.getContainer();
772
+ Q.style.clip = W, q.style.clip = Y, c.value = E;
773
+ }, f = (m) => {
774
+ const E = (m.touches ? m.touches[0] : m).clientX - (l.value?.left ?? 0);
775
+ return Math.min(Math.max(E, 0), l.value?.width ?? 0);
776
+ }, S = (m) => {
777
+ const E = (m.touches ? m.touches[0] : m).clientY - (l.value?.top ?? 0);
778
+ return Math.min(Math.max(E, 0), l.value?.height ?? 0);
779
+ }, b = (m) => {
780
+ m.preventDefault(), o.mousemove && (s.value.style.pointerEvents = m.touches ? "auto" : "none", a.value.style.pointerEvents = m.touches ? "auto" : "none"), g(i ? S(m) : f(m));
781
+ }, U = () => {
782
+ document.body.style.userSelect = "", document.body.style.webkitUserSelect = "", document.body.style.mozUserSelect = "", document.body.style.msUserSelect = "";
783
+ }, M = () => {
784
+ document.removeEventListener("mousemove", b), document.removeEventListener("mouseup", M), U(), h.emit("slideend", { currentPosition: c.value });
785
+ }, D = () => {
786
+ document.removeEventListener("touchmove", b), document.removeEventListener("touchend", D), U(), h.emit("slideend", { currentPosition: c.value });
787
+ }, k = (m) => {
788
+ m.preventDefault(), document.body.style.userSelect = "none", document.body.style.webkitUserSelect = "none", document.body.style.mozUserSelect = "none", document.body.style.msUserSelect = "none", m.touches ? (document.addEventListener("touchmove", b, { passive: !1 }), document.addEventListener("touchend", D)) : (document.addEventListener("mousemove", b), document.addEventListener("mouseup", M));
789
+ };
790
+ return {
791
+ /** Manually initialize the slider (useful when called after maps are ready) */
792
+ initialize: () => {
793
+ if (v || !t) return;
794
+ const m = typeof t == "string" ? document.querySelector(t) : t;
795
+ if (!m) throw new Error("Invalid container element for map compare.");
796
+ v = !0, s.value = document.createElement("div"), s.value.className = i ? "maplibre-compare maplibre-compare-horizontal" : "maplibre-compare", a.value = document.createElement("div"), a.value.className = i ? "compare-swiper-horizontal" : "compare-swiper-vertical", s.value.appendChild(a.value), m.appendChild(s.value), l.value = r.getContainer().getBoundingClientRect();
797
+ const w = (i ? l.value.height : l.value.width) / 2;
798
+ g(w), u = Zt(e, r), d = () => {
799
+ l.value = r.getContainer().getBoundingClientRect(), c.value && g(c.value);
800
+ }, r.on("resize", d), o.mousemove && (e.getContainer().addEventListener("mousemove", b), r.getContainer().addEventListener("mousemove", b)), a.value.addEventListener("mousedown", k), a.value.addEventListener("touchstart", k);
801
+ },
802
+ /** Unmount the slider */
803
+ unmount: () => {
804
+ if (!v) return;
805
+ v = !1, u?.(), d && r.off("resize", d);
806
+ const m = e.getContainer(), w = r.getContainer();
807
+ m && (m.style.clip = "", m.removeEventListener("mousemove", b)), w && (w.style.clip = "", w.removeEventListener("mousemove", b)), a.value?.removeEventListener("mousedown", k), a.value?.removeEventListener("touchstart", k), s.value?.remove(), a.value = null, s.value = null, l.value = null, c.value = null;
808
+ },
809
+ /** Manually set slider position */
810
+ setSlider: (m) => g(m),
811
+ /** Listen to events (`slideend`) */
812
+ on: (m, w) => {
813
+ h.on(m, w);
814
+ },
815
+ /** Remove event */
816
+ off: (m, w) => {
817
+ h.off(m, w);
818
+ }
819
+ };
820
+ }
821
+ const _t = new zt();
822
+ le.addProtocol("pmtiles", _t.tile);
823
+ const Ft = Se({
824
+ name: "MapCompare",
825
+ props: {
826
+ mapStyleA: {
827
+ type: [String, Object],
828
+ required: !0
829
+ },
830
+ mapStyleB: {
831
+ type: [String, Object],
832
+ required: !0
833
+ },
834
+ mapLayersA: {
835
+ type: Array,
836
+ default: () => []
837
+ },
838
+ mapLayersB: {
839
+ type: Array,
840
+ default: () => []
841
+ },
842
+ center: {
843
+ type: Array,
844
+ default: () => [0, 0]
845
+ },
846
+ zoom: {
847
+ type: Number,
848
+ default: 1
849
+ },
850
+ bearing: {
851
+ type: Number,
852
+ default: 0
853
+ },
854
+ pitch: {
855
+ type: Number,
856
+ default: 0
857
+ },
858
+ swiperOptions: {
859
+ type: Object,
860
+ default: () => ({
861
+ thickness: 4,
862
+ orientation: "vertical",
863
+ grabThickness: 20,
864
+ handleSize: 40,
865
+ lineColor: "white",
866
+ handleColor: "white",
867
+ handleShadowColor: "rgba(0, 0, 0, 0.3)",
868
+ arrowColor: "#666",
869
+ darkMode: !1
870
+ })
871
+ }
872
+ },
873
+ setup(e, { slots: r }) {
874
+ const t = P(), n = P(), o = P(), i = P(null);
875
+ let a = null, s = null, l = null;
876
+ const c = (v) => {
877
+ const g = v === "A" ? a : s, f = v === "A" ? e.mapLayersA : e.mapLayersB;
878
+ if (!g || !g.isStyleLoaded()) return;
879
+ const S = g.getStyle();
880
+ !S || !S.layers || f && f.length > 0 && S.layers.forEach((b) => {
881
+ f.includes(b.id) ? g.setLayoutProperty(b.id, "visibility", "visible") : g.setLayoutProperty(b.id, "visibility", "none");
882
+ });
883
+ }, h = () => {
884
+ if (!a || !s || !t.value) return;
885
+ l && (l.unmount(), l = null), l = jt(a, s, t.value, {
886
+ orientation: e.swiperOptions?.orientation ?? "vertical",
887
+ mousemove: !1
888
+ }), l.initialize();
889
+ const g = (e.swiperOptions?.orientation ?? "vertical") === "horizontal" ? ".compare-swiper-horizontal" : ".compare-swiper-vertical", f = t.value.querySelector(g);
890
+ f && (i.value = f, r.icon && i.value.classList.add("has-custom-icon"));
891
+ }, u = async () => {
892
+ !n.value || !o.value || !t.value || (a = new le.Map({
893
+ container: n.value,
894
+ style: e.mapStyleA,
895
+ center: e.center,
896
+ zoom: e.zoom,
897
+ bearing: e.bearing,
898
+ pitch: e.pitch
899
+ }), s = new le.Map({
900
+ container: o.value,
901
+ style: e.mapStyleB,
902
+ center: e.center,
903
+ zoom: e.zoom,
904
+ bearing: e.bearing,
905
+ pitch: e.pitch
906
+ }), await Promise.all([
907
+ new Promise((v) => {
908
+ a.loaded() ? v() : a.on("load", () => v());
909
+ }),
910
+ new Promise((v) => {
911
+ s.loaded() ? v() : s.on("load", () => v());
912
+ })
913
+ ]), h(), c("A"), c("B"));
914
+ };
915
+ j(() => e.mapLayersA, () => {
916
+ c("A");
917
+ }, { deep: !0 }), j(() => e.mapLayersB, () => {
918
+ c("B");
919
+ }, { deep: !0 }), j(() => e.mapStyleA, () => {
920
+ a?.setStyle(e.mapStyleA);
921
+ }, { deep: !0 }), j(() => e.mapStyleB, () => {
922
+ s?.setStyle(e.mapStyleB);
923
+ }, { deep: !0 }), j(() => e.swiperOptions?.orientation, () => {
924
+ a && s && a.loaded() && s.loaded() && h();
925
+ }), Je(() => {
926
+ u();
927
+ }), Xe(() => {
928
+ l?.unmount(), l = null, a && (a.remove(), a = null), s && (s.remove(), s = null);
929
+ });
930
+ const d = Ye(() => {
931
+ const v = e.swiperOptions?.darkMode ?? !1, g = {
932
+ dark: {
933
+ lineColor: "#333",
934
+ handleColor: "#333",
935
+ handleShadowColor: "rgba(0, 0, 0, 0.3)",
936
+ arrowColor: "#999"
937
+ },
938
+ light: {
939
+ lineColor: "white",
940
+ handleColor: "white",
941
+ handleShadowColor: "rgba(0, 0, 0, 0.3)",
942
+ arrowColor: "#666"
943
+ }
944
+ }, f = v ? g.dark : g.light, S = e.swiperOptions?.lineColor ?? f.lineColor, b = e.swiperOptions?.handleColor ?? f.handleColor, U = e.swiperOptions?.arrowColor ?? f.arrowColor;
945
+ return {
946
+ thickness: e.swiperOptions?.thickness ?? 4,
947
+ grabThickness: e.swiperOptions?.grabThickness ?? 4,
948
+ handleSize: e.swiperOptions?.handleSize ?? 40,
949
+ lineColor: S,
950
+ handleColor: b,
951
+ handleShadowColor: f.handleShadowColor,
952
+ arrowColor: U
953
+ };
954
+ });
955
+ return {
956
+ containerRef: t,
957
+ mapARef: n,
958
+ mapBRef: o,
959
+ swiperRef: i,
960
+ hasIconSlot: !!r.icon,
961
+ swiperOpts: d
962
+ };
963
+ }
964
+ }), Ke = (e, r) => {
965
+ const t = e.__vccOpts || e;
966
+ for (const [n, o] of r)
967
+ t[n] = o;
968
+ return t;
969
+ }, Kt = {
970
+ ref: "mapARef",
971
+ class: "map map-a"
972
+ }, Vt = {
973
+ ref: "mapBRef",
974
+ class: "map map-b"
975
+ }, Wt = { class: "custom-swiper-icon" };
976
+ function qt(e, r, t, n, o, i) {
977
+ return se(), Qe("div", {
978
+ ref: "containerRef",
979
+ class: "map-compare-container",
980
+ style: et({
981
+ "--swiper-thickness": `${e.swiperOpts.thickness}px`,
982
+ "--swiper-grab-thickness": `${Math.max(e.swiperOpts.grabThickness, e.swiperOpts.thickness)}px`,
983
+ "--swiper-handle-size": `${e.swiperOpts.handleSize}px`,
984
+ "--swiper-line-color": e.swiperOpts.lineColor,
985
+ "--swiper-handle-color": e.swiperOpts.handleColor,
986
+ "--swiper-handle-shadow-color": e.swiperOpts.handleShadowColor,
987
+ "--swiper-arrow-color": e.swiperOpts.arrowColor
988
+ })
989
+ }, [
990
+ ne("div", Kt, null, 512),
991
+ ne("div", Vt, null, 512),
992
+ e.swiperRef && e.hasIconSlot ? (se(), Me(rt, {
993
+ key: 0,
994
+ to: e.swiperRef
995
+ }, [
996
+ ne("div", Wt, [
997
+ nt(e.$slots, "icon", {}, void 0, !0)
998
+ ])
999
+ ], 8, ["to"])) : tt("", !0)
1000
+ ], 4);
1001
+ }
1002
+ const Ve = /* @__PURE__ */ Ke(Ft, [["render", qt], ["__scopeId", "data-v-cfcdf130"]]), Gt = Se({
1003
+ name: "LayerCompare",
1004
+ components: {
1005
+ MapCompare: Ve
1006
+ },
1007
+ props: {
1008
+ mapStyle: {
1009
+ type: [String, Object],
1010
+ required: !0
1011
+ },
1012
+ mapLayersA: {
1013
+ type: Array,
1014
+ default: () => []
1015
+ },
1016
+ mapLayersB: {
1017
+ type: Array,
1018
+ default: () => []
1019
+ },
1020
+ center: {
1021
+ type: Array,
1022
+ default: () => [0, 0]
1023
+ },
1024
+ zoom: {
1025
+ type: Number,
1026
+ default: 1
1027
+ },
1028
+ bearing: {
1029
+ type: Number,
1030
+ default: 0
1031
+ },
1032
+ pitch: {
1033
+ type: Number,
1034
+ default: 0
1035
+ },
1036
+ swiperOptions: {
1037
+ type: Object,
1038
+ default: () => ({
1039
+ thickness: 4,
1040
+ grabThickness: 20,
1041
+ orientation: "vertical",
1042
+ handleSize: 40,
1043
+ lineColor: "white",
1044
+ handleColor: "white",
1045
+ handleShadowColor: "rgba(0, 0, 0, 0.3)",
1046
+ arrowColor: "#666"
1047
+ })
1048
+ }
1049
+ },
1050
+ setup() {
1051
+ return {};
1052
+ }
1053
+ });
1054
+ function Jt(e, r, t, n, o, i) {
1055
+ const a = ot("MapCompare");
1056
+ return se(), Me(a, {
1057
+ "map-style-a": e.mapStyle,
1058
+ "map-style-b": e.mapStyle,
1059
+ "swiper-options": e.swiperOptions,
1060
+ "map-layers-a": e.mapLayersA,
1061
+ "map-layers-b": e.mapLayersB,
1062
+ center: e.center,
1063
+ zoom: e.zoom,
1064
+ bearing: e.bearing,
1065
+ pitch: e.pitch
1066
+ }, null, 8, ["map-style-a", "map-style-b", "swiper-options", "map-layers-a", "map-layers-b", "center", "zoom", "bearing", "pitch"]);
1067
+ }
1068
+ const Xt = /* @__PURE__ */ Ke(Gt, [["render", Jt]]), sr = {
1069
+ install(e) {
1070
+ e.component("MapCompare", Ve), e.component("LayerCompare", Xt);
1071
+ }
1072
+ };
1073
+ export {
1074
+ Xt as LayerCompare,
1075
+ Ve as MapCompare,
1076
+ sr as MapComparePlugin,
1077
+ sr as default
1078
+ };