@maptiler/sdk 2.1.0 → 2.2.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.
@@ -6,7 +6,7 @@ export { LanguageGeocoding, MapStyle, MapStyleVariant, ReferenceMapStyle, Servic
6
6
  import { v4 } from 'uuid';
7
7
 
8
8
  var name = "@maptiler/sdk";
9
- var version = "2.1.0";
9
+ var version = "2.2.0";
10
10
  var description = "The Javascript & TypeScript map SDK tailored for MapTiler Cloud";
11
11
  var module = "dist/maptiler-sdk.mjs";
12
12
  var types = "dist/maptiler-sdk.d.ts";
@@ -42,32 +42,25 @@ var repository = {
42
42
  var scripts = {
43
43
  build: "rm -rf dist/* && NODE_ENV=production rollup -c",
44
44
  dev: "rm -rf dist/* && NODE_ENV=development rollup -c -w",
45
- "format:fix": "prettier --write \"src/**/*.{js,ts,tsx}\"",
46
- format: "prettier -c \"src/**/*.{js,ts,tsx}\"",
47
- "lint:fix": "eslint --fix \"src/**/*.{js,ts}\"",
48
- lint: "eslint \"src/**/*.{js,ts}\"",
45
+ biome: "biome check --max-diagnostics=1000",
46
+ "biome:fix": "npx @biomejs/biome check --max-diagnostics=1000 --write",
49
47
  doc: "rm -rf docs/* && typedoc --out docs && cp -r images docs/",
50
- prepare: "npm run format:fix && npm run lint:fix && npm run build && npm run test",
48
+ prepare: "npm run biome:fix && npm run build && npm run test",
51
49
  "test:dev": "vitest dev",
52
50
  test: "vitest run"
53
51
  };
54
52
  var author = "MapTiler";
55
53
  var devDependencies = {
56
- "@rollup/plugin-commonjs": "^24.1.0",
57
- "@rollup/plugin-json": "^6.0.0",
58
- "@rollup/plugin-node-resolve": "^15.0.2",
54
+ "@biomejs/biome": "1.8.3",
55
+ "@rollup/plugin-commonjs": "^26.0.1",
56
+ "@rollup/plugin-json": "^6.1.0",
57
+ "@rollup/plugin-node-resolve": "^15.2.3",
59
58
  "@types/uuid": "^9.0.2",
60
59
  "@types/xmldom": "^0.1.31",
61
- "@typescript-eslint/eslint-plugin": "^6.9.0",
62
- "@typescript-eslint/parser": "^6.9.0",
63
- eslint: "^8.52.0",
64
- "eslint-config-prettier": "^9.0.0",
65
- "eslint-plugin-prettier": "^5.0.1",
66
- prettier: "^3.0.3",
67
- rollup: "^3.20.6",
68
- "rollup-plugin-copy-merge": "^1.0.0",
69
- "rollup-plugin-dts": "^5.3.0",
70
- "rollup-plugin-esbuild": "^5.0.0",
60
+ rollup: "^4.18.0",
61
+ "rollup-plugin-copy-merge": "^1.0.2",
62
+ "rollup-plugin-dts": "^6.1.1",
63
+ "rollup-plugin-esbuild": "^6.1.1",
71
64
  "rollup-plugin-node-globals": "^1.4.0",
72
65
  "rollup-plugin-shell": "^1.0.9",
73
66
  "rollup-plugin-string": "^3.0.0",
@@ -241,9 +234,9 @@ function getBrowserLanguage() {
241
234
  if (typeof navigator === "undefined") {
242
235
  return `name:${Intl.DateTimeFormat().resolvedOptions().locale.split("-")[0]}`;
243
236
  }
244
- const canditatelangs = Array.from(
245
- new Set(navigator.languages.map((l) => `name:${l.split("-")[0]}`))
246
- ).filter((l) => languageCodeSet.has(l));
237
+ const canditatelangs = Array.from(new Set(navigator.languages.map((l) => `name:${l.split("-")[0]}`))).filter(
238
+ (l) => languageCodeSet.has(l)
239
+ );
247
240
  return canditatelangs.length ? canditatelangs[0] : Language.LOCAL;
248
241
  }
249
242
 
@@ -259,25 +252,14 @@ const defaults = {
259
252
  };
260
253
  Object.freeze(defaults);
261
254
 
262
- var __defProp$a = Object.defineProperty;
263
- var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
264
- var __publicField$7 = (obj, key, value) => {
265
- __defNormalProp$a(obj, typeof key !== "symbol" ? key + "" : key, value);
266
- return value;
267
- };
268
255
  const MAPTILER_SESSION_ID = v4();
269
256
  class SdkConfig extends EventEmitter {
270
257
  constructor() {
271
- super();
258
+ super(...arguments);
272
259
  /**
273
260
  * The primary language. By default, the language of the web browser is used.
274
261
  */
275
- __publicField$7(this, "primaryLanguage", defaults.primaryLanguage);
276
- /**
277
- * The secondary language, to overwrite the default language defined in the map style.
278
- * This settings is highly dependant on the style compatibility and may not work in most cases.
279
- */
280
- __publicField$7(this, "secondaryLanguage");
262
+ this.primaryLanguage = defaults.primaryLanguage;
281
263
  /**
282
264
  * Setting on whether of not the SDK runs with a session logic.
283
265
  * A "session" is started at the initialization of the SDK and finished when the browser
@@ -285,21 +267,21 @@ class SdkConfig extends EventEmitter {
285
267
  * When `session` is enabled (default: true), the extra URL param `mtsid` is added to queries
286
268
  * on the MapTiler Cloud API. This allows MapTiler to enable "session based billing".
287
269
  */
288
- __publicField$7(this, "session", true);
270
+ this.session = true;
289
271
  /**
290
272
  * Enables client-side caching of requests for tiles and fonts.
291
273
  * The cached requests persist multiple browser sessions and will be reused when possible.
292
274
  * Works only for requests to the MapTiler Cloud API when sessions are enabled.
293
275
  */
294
- __publicField$7(this, "caching", true);
276
+ this.caching = true;
295
277
  /**
296
278
  * Unit to be used
297
279
  */
298
- __publicField$7(this, "_unit", "metric");
280
+ this._unit = "metric";
299
281
  /**
300
282
  * MapTiler Cloud API key
301
283
  */
302
- __publicField$7(this, "_apiKey", "");
284
+ this._apiKey = "";
303
285
  }
304
286
  /**
305
287
  * Set the unit system
@@ -349,25 +331,17 @@ class LogoControl extends maplibregl.LogoControl {
349
331
  }
350
332
  }
351
333
 
352
- var __defProp$9 = Object.defineProperty;
353
- var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
354
- var __publicField$6 = (obj, key, value) => {
355
- __defNormalProp$9(obj, typeof key !== "symbol" ? key + "" : key, value);
356
- return value;
357
- };
358
334
  class MaptilerLogoControl extends LogoControl {
359
335
  constructor(options = {}) {
360
- var _a, _b;
361
336
  super(options);
362
- __publicField$6(this, "logoURL", "");
363
- __publicField$6(this, "linkURL", "");
364
- this.logoURL = (_a = options.logoURL) != null ? _a : defaults.maptilerLogoURL;
365
- this.linkURL = (_b = options.linkURL) != null ? _b : defaults.maptilerURL;
337
+ this.logoURL = "";
338
+ this.linkURL = "";
339
+ this.logoURL = options.logoURL ?? defaults.maptilerLogoURL;
340
+ this.linkURL = options.linkURL ?? defaults.maptilerURL;
366
341
  }
367
342
  onAdd(map) {
368
- var _a;
369
343
  this._map = map;
370
- this._compact = (_a = this.options.compact) != null ? _a : false;
344
+ this._compact = this.options.compact ?? false;
371
345
  this._container = window.document.createElement("div");
372
346
  this._container.className = "maplibregl-ctrl";
373
347
  const anchor = window.document.createElement("a");
@@ -395,97 +369,66 @@ class MaptilerLogoControl extends LogoControl {
395
369
  }
396
370
  }
397
371
 
398
- var __async$2 = (__this, __arguments, generator) => {
399
- return new Promise((resolve, reject) => {
400
- var fulfilled = (value) => {
401
- try {
402
- step(generator.next(value));
403
- } catch (e) {
404
- reject(e);
405
- }
406
- };
407
- var rejected = (value) => {
408
- try {
409
- step(generator.throw(value));
410
- } catch (e) {
411
- reject(e);
412
- }
413
- };
414
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
415
- step((generator = generator.apply(__this, __arguments)).next());
416
- });
417
- };
418
372
  const LOCAL_CACHE_PROTOCOL_SOURCE = "localcache_source";
419
373
  const LOCAL_CACHE_PROTOCOL_DATA = "localcache";
420
374
  const LOCAL_CACHE_NAME = "maptiler_sdk";
421
375
  const CACHE_LIMIT_ITEMS = 1e3;
422
376
  const CACHE_LIMIT_CHECK_INTERVAL = 100;
377
+ const CACHE_API_AVAILABLE = typeof caches !== "undefined";
423
378
  function localCacheTransformRequest(reqUrl, resourceType) {
424
- if (config$1.caching && config$1.session && reqUrl.host === defaults.maptilerApiHost) {
425
- if (resourceType == "Source" && reqUrl.href.includes("tiles.json")) {
426
- return reqUrl.href.replace(
427
- "https://",
428
- `${LOCAL_CACHE_PROTOCOL_SOURCE}://`
429
- );
430
- } else if (resourceType == "Tile" || resourceType == "Glyphs") {
379
+ if (CACHE_API_AVAILABLE && config$1.caching && config$1.session && reqUrl.host === defaults.maptilerApiHost) {
380
+ if (resourceType === "Source" && reqUrl.href.includes("tiles.json")) {
381
+ return reqUrl.href.replace("https://", `${LOCAL_CACHE_PROTOCOL_SOURCE}://`);
382
+ }
383
+ if (resourceType === "Tile" || resourceType === "Glyphs") {
431
384
  return reqUrl.href.replace("https://", `${LOCAL_CACHE_PROTOCOL_DATA}://`);
432
385
  }
433
386
  }
434
387
  return reqUrl.href;
435
388
  }
436
389
  let cacheInstance;
437
- function getCache() {
438
- return __async$2(this, null, function* () {
439
- if (!cacheInstance) {
440
- cacheInstance = yield caches.open(LOCAL_CACHE_NAME);
441
- }
442
- return cacheInstance;
443
- });
390
+ async function getCache() {
391
+ if (!cacheInstance) {
392
+ cacheInstance = await caches.open(LOCAL_CACHE_NAME);
393
+ }
394
+ return cacheInstance;
444
395
  }
445
396
  let cachePutCounter = 0;
446
- function limitCache() {
447
- return __async$2(this, null, function* () {
448
- const cache = yield getCache();
449
- const keys = yield cache.keys();
450
- const toPurge = keys.slice(0, Math.max(keys.length - CACHE_LIMIT_ITEMS, 0));
451
- for (const key of toPurge) {
452
- cache.delete(key);
453
- }
454
- });
397
+ async function limitCache() {
398
+ const cache = await getCache();
399
+ const keys = await cache.keys();
400
+ const toPurge = keys.slice(0, Math.max(keys.length - CACHE_LIMIT_ITEMS, 0));
401
+ for (const key of toPurge) {
402
+ cache.delete(key);
403
+ }
455
404
  }
456
405
  function registerLocalCacheProtocol() {
457
406
  addProtocol(
458
407
  LOCAL_CACHE_PROTOCOL_SOURCE,
459
- (params, abortController) => __async$2(this, null, function* () {
408
+ async (params, abortController) => {
460
409
  if (!params.url)
461
410
  throw new Error("");
462
- params.url = params.url.replace(
463
- `${LOCAL_CACHE_PROTOCOL_SOURCE}://`,
464
- "https://"
465
- );
411
+ params.url = params.url.replace(`${LOCAL_CACHE_PROTOCOL_SOURCE}://`, "https://");
466
412
  const requestInit = params;
467
413
  requestInit.signal = abortController.signal;
468
- const response = yield fetch(params.url, requestInit);
469
- const json = yield response.json();
414
+ const response = await fetch(params.url, requestInit);
415
+ const json = await response.json();
470
416
  if (json.tiles && json.tiles.length > 0) {
471
- json.tiles[0] += "&last-modified=" + response.headers.get("Last-Modified");
417
+ json.tiles[0] += `&last-modified=${response.headers.get("Last-Modified")}`;
472
418
  }
473
419
  return {
474
420
  data: json,
475
421
  cacheControl: response.headers.get("Cache-Control"),
476
422
  expires: response.headers.get("Expires")
477
423
  };
478
- })
424
+ }
479
425
  );
480
426
  addProtocol(
481
427
  LOCAL_CACHE_PROTOCOL_DATA,
482
- (params, abortController) => __async$2(this, null, function* () {
428
+ async (params, abortController) => {
483
429
  if (!params.url)
484
430
  throw new Error("");
485
- params.url = params.url.replace(
486
- `${LOCAL_CACHE_PROTOCOL_DATA}://`,
487
- "https://"
488
- );
431
+ params.url = params.url.replace(`${LOCAL_CACHE_PROTOCOL_DATA}://`, "https://");
489
432
  const url = new URL(params.url);
490
433
  const cacheableUrl = new URL(url);
491
434
  cacheableUrl.searchParams.delete("mtsid");
@@ -494,70 +437,49 @@ function registerLocalCacheProtocol() {
494
437
  const fetchableUrl = new URL(url);
495
438
  fetchableUrl.searchParams.delete("last-modified");
496
439
  const fetchUrl = fetchableUrl.toString();
497
- const respond = (response) => __async$2(this, null, function* () {
440
+ const respond = async (response2) => {
498
441
  return {
499
- data: yield response.arrayBuffer(),
500
- cacheControl: response.headers.get("Cache-Control"),
501
- expires: response.headers.get("Expires")
442
+ data: await response2.arrayBuffer(),
443
+ cacheControl: response2.headers.get("Cache-Control"),
444
+ expires: response2.headers.get("Expires")
502
445
  };
503
- });
504
- const cache = yield getCache();
505
- const cacheMatch = yield cache.match(cacheKey);
446
+ };
447
+ const cache = await getCache();
448
+ const cacheMatch = await cache.match(cacheKey);
506
449
  if (cacheMatch) {
507
450
  return respond(cacheMatch);
508
- } else {
509
- const requestInit = params;
510
- requestInit.signal = abortController.signal;
511
- const response = yield fetch(fetchUrl, requestInit);
512
- if (response.status >= 200 && response.status < 300) {
513
- cache.put(cacheKey, response.clone()).catch(() => {
514
- });
515
- if (++cachePutCounter > CACHE_LIMIT_CHECK_INTERVAL) {
516
- limitCache();
517
- cachePutCounter = 0;
518
- }
451
+ }
452
+ const requestInit = params;
453
+ requestInit.signal = abortController.signal;
454
+ const response = await fetch(fetchUrl, requestInit);
455
+ if (response.status >= 200 && response.status < 300) {
456
+ cache.put(cacheKey, response.clone()).catch(() => {
457
+ });
458
+ if (++cachePutCounter > CACHE_LIMIT_CHECK_INTERVAL) {
459
+ limitCache();
460
+ cachePutCounter = 0;
519
461
  }
520
- return respond(response);
521
462
  }
522
- })
463
+ return respond(response);
464
+ }
523
465
  );
524
466
  }
525
467
 
526
- var __defProp$8 = Object.defineProperty;
527
- var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
528
- var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
529
- var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
530
- var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
531
- var __spreadValues$5 = (a, b) => {
532
- for (var prop in b || (b = {}))
533
- if (__hasOwnProp$5.call(b, prop))
534
- __defNormalProp$8(a, prop, b[prop]);
535
- if (__getOwnPropSymbols$5)
536
- for (var prop of __getOwnPropSymbols$5(b)) {
537
- if (__propIsEnum$5.call(b, prop))
538
- __defNormalProp$8(a, prop, b[prop]);
539
- }
540
- return a;
541
- };
542
468
  function enableRTL() {
543
- if (maplibregl.getRTLTextPluginStatus() === "unavailable") {
544
- maplibregl.setRTLTextPlugin(
545
- defaults.rtlPluginURL,
546
- (err) => {
547
- if (err)
548
- console.error(err);
549
- },
550
- true
551
- // Lazy load the plugin
552
- );
469
+ const status = maplibregl.getRTLTextPluginStatus();
470
+ if (status === "unavailable" || status === "requested") {
471
+ try {
472
+ maplibregl.setRTLTextPlugin(defaults.rtlPluginURL, true);
473
+ } catch (e) {
474
+ }
553
475
  }
554
476
  }
555
477
  function bindAll(fns, context) {
556
- fns.forEach((fn) => {
478
+ for (const fn of fns) {
557
479
  if (typeof context[fn] !== "function")
558
- return;
480
+ continue;
559
481
  context[fn] = context[fn].bind(context);
560
- });
482
+ }
561
483
  }
562
484
  function DOMcreate(tagName, className, container) {
563
485
  const el = window.document.createElement(tagName);
@@ -594,15 +516,16 @@ function maptilerCloudTransformRequest(url, resourceType) {
594
516
  };
595
517
  }
596
518
  function combineTransformRequest(userDefinedRTF) {
597
- return function(url, resourceType) {
598
- var _a;
519
+ return (url, resourceType) => {
599
520
  if (userDefinedRTF !== void 0 && userDefinedRTF !== null) {
600
521
  const rp = userDefinedRTF(url, resourceType);
601
- const rp2 = maptilerCloudTransformRequest((_a = rp == null ? void 0 : rp.url) != null ? _a : "", resourceType);
602
- return __spreadValues$5(__spreadValues$5({}, rp), rp2);
603
- } else {
604
- return maptilerCloudTransformRequest(url, resourceType);
522
+ const rp2 = maptilerCloudTransformRequest(rp?.url ?? "", resourceType);
523
+ return {
524
+ ...rp,
525
+ ...rp2
526
+ };
605
527
  }
528
+ return maptilerCloudTransformRequest(url, resourceType);
606
529
  };
607
530
  }
608
531
  function generateRandomString() {
@@ -619,6 +542,35 @@ function jsonParseNoThrow(doc) {
619
542
  }
620
543
  return null;
621
544
  }
545
+ function getWebGLSupportError() {
546
+ const gl = document.createElement("canvas").getContext("webgl2");
547
+ if (!gl) {
548
+ if (typeof WebGL2RenderingContext !== "undefined") {
549
+ return "Graphic rendering with WebGL2 has been disabled or is not supported by your graphic card. The map cannot be displayed.";
550
+ }
551
+ return "Your browser does not support graphic rendering with WebGL2. The map cannot be displayed.";
552
+ }
553
+ return null;
554
+ }
555
+ function displayNoWebGlWarning(container) {
556
+ const webglError = getWebGLSupportError();
557
+ if (!webglError)
558
+ return;
559
+ let actualContainer = null;
560
+ if (typeof container === "string") {
561
+ actualContainer = document.getElementById(container);
562
+ } else if (container instanceof HTMLElement) {
563
+ actualContainer = container;
564
+ }
565
+ if (!actualContainer) {
566
+ throw new Error("The Map container must be provided.");
567
+ }
568
+ const errorMessageDiv = document.createElement("div");
569
+ errorMessageDiv.innerHTML = webglError;
570
+ errorMessageDiv.classList.add("no-webgl-support-div");
571
+ actualContainer.appendChild(errorMessageDiv);
572
+ throw new Error(webglError);
573
+ }
622
574
 
623
575
  function styleToStyle(style) {
624
576
  if (!style) {
@@ -627,9 +579,8 @@ function styleToStyle(style) {
627
579
  if (typeof style === "string" || style instanceof String) {
628
580
  if (!style.startsWith("http") && style.toLowerCase().includes(".json")) {
629
581
  return style;
630
- } else {
631
- return expandMapStyle(style);
632
582
  }
583
+ return expandMapStyle(style);
633
584
  }
634
585
  if (style instanceof MapStyleVariant) {
635
586
  return style.getExpandedStyleURL();
@@ -640,31 +591,15 @@ function styleToStyle(style) {
640
591
  return style;
641
592
  }
642
593
 
643
- var __defProp$7 = Object.defineProperty;
644
- var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
645
- var __publicField$5 = (obj, key, value) => {
646
- __defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
647
- return value;
648
- };
649
594
  class MaptilerTerrainControl {
650
595
  constructor() {
651
- __publicField$5(this, "_map");
652
- __publicField$5(this, "_container");
653
- __publicField$5(this, "_terrainButton");
654
596
  bindAll(["_toggleTerrain", "_updateTerrainIcon"], this);
655
597
  }
656
598
  onAdd(map) {
657
599
  this._map = map;
658
600
  this._container = DOMcreate("div", "maplibregl-ctrl maplibregl-ctrl-group");
659
- this._terrainButton = DOMcreate(
660
- "button",
661
- "maplibregl-ctrl-terrain",
662
- this._container
663
- );
664
- DOMcreate("span", "maplibregl-ctrl-icon", this._terrainButton).setAttribute(
665
- "aria-hidden",
666
- "true"
667
- );
601
+ this._terrainButton = DOMcreate("button", "maplibregl-ctrl-terrain", this._container);
602
+ DOMcreate("span", "maplibregl-ctrl-icon", this._terrainButton).setAttribute("aria-hidden", "true");
668
603
  this._terrainButton.type = "button";
669
604
  this._terrainButton.addEventListener("click", this._toggleTerrain);
670
605
  this._updateTerrainIcon();
@@ -689,14 +624,10 @@ class MaptilerTerrainControl {
689
624
  this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled");
690
625
  if (this._map.hasTerrain()) {
691
626
  this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled");
692
- this._terrainButton.title = this._map._getUIString(
693
- "TerrainControl.Disable"
694
- );
627
+ this._terrainButton.title = this._map._getUIString("TerrainControl.Disable");
695
628
  } else {
696
629
  this._terrainButton.classList.add("maplibregl-ctrl-terrain");
697
- this._terrainButton.title = this._map._getUIString(
698
- "TerrainControl.Enable"
699
- );
630
+ this._terrainButton.title = this._map._getUIString("TerrainControl.Enable");
700
631
  }
701
632
  }
702
633
  }
@@ -707,12 +638,6 @@ class NavigationControl extends maplibregl.NavigationControl {
707
638
  }
708
639
  }
709
640
 
710
- var __defProp$6 = Object.defineProperty;
711
- var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
712
- var __publicField$4 = (obj, key, value) => {
713
- __defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
714
- return value;
715
- };
716
641
  class MaptilerNavigationControl extends NavigationControl {
717
642
  constructor() {
718
643
  super({
@@ -723,20 +648,14 @@ class MaptilerNavigationControl extends NavigationControl {
723
648
  /**
724
649
  * Overloading: Limit how flat the compass icon can get
725
650
  */
726
- __publicField$4(this, "_rotateCompassArrow", () => {
651
+ this._rotateCompassArrow = () => {
727
652
  const rotate = this.options.visualizePitch ? `scale(${Math.min(
728
653
  1.5,
729
- 1 / Math.pow(
730
- Math.cos(this._map.transform.pitch * (Math.PI / 180)),
731
- 0.5
732
- )
654
+ 1 / Math.cos(this._map.transform.pitch * (Math.PI / 180)) ** 0.5
733
655
  )}) rotateX(${Math.min(70, this._map.transform.pitch)}deg) rotateZ(${this._map.transform.angle * (180 / Math.PI)}deg)` : `rotate(${this._map.transform.angle * (180 / Math.PI)}deg)`;
734
656
  this._compassIcon.style.transform = rotate;
735
- });
736
- this._compass.removeEventListener(
737
- "click",
738
- this._compass.clickFunction
739
- );
657
+ };
658
+ this._compass.removeEventListener("click", this._compass.clickFunction);
740
659
  this._compass.addEventListener("click", (e) => {
741
660
  {
742
661
  const currentPitch = this._map.getPitch();
@@ -768,57 +687,30 @@ class GeolocateControl extends maplibregl.GeolocateControl {
768
687
  }
769
688
  }
770
689
 
771
- var __defProp$5 = Object.defineProperty;
772
- var __defProps$3 = Object.defineProperties;
773
- var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
774
- var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
775
- var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
776
- var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
777
- var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
778
- var __spreadValues$4 = (a, b) => {
779
- for (var prop in b || (b = {}))
780
- if (__hasOwnProp$4.call(b, prop))
781
- __defNormalProp$5(a, prop, b[prop]);
782
- if (__getOwnPropSymbols$4)
783
- for (var prop of __getOwnPropSymbols$4(b)) {
784
- if (__propIsEnum$4.call(b, prop))
785
- __defNormalProp$5(a, prop, b[prop]);
786
- }
787
- return a;
788
- };
789
- var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
790
- var __publicField$3 = (obj, key, value) => {
791
- __defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
792
- return value;
793
- };
794
690
  const Marker$1 = maplibregl.Marker;
795
691
  const LngLat$1 = maplibregl.LngLat;
796
692
  const LngLatBounds$1 = maplibregl.LngLatBounds;
797
693
  class MaptilerGeolocateControl extends GeolocateControl {
798
694
  constructor() {
799
695
  super(...arguments);
800
- __publicField$3(this, "lastUpdatedCenter", new LngLat$1(0, 0));
696
+ this.lastUpdatedCenter = new LngLat$1(0, 0);
801
697
  /**
802
698
  * Update the camera location to center on the current position
803
699
  *
804
700
  * @param {Position} position the Geolocation API Position
805
701
  * @private
806
702
  */
807
- __publicField$3(this, "_updateCamera", (position) => {
808
- var _a, _b, _c;
809
- const center = new LngLat$1(
810
- position.coords.longitude,
811
- position.coords.latitude
812
- );
703
+ this._updateCamera = (position) => {
704
+ const center = new LngLat$1(position.coords.longitude, position.coords.latitude);
813
705
  const radius = position.coords.accuracy;
814
706
  const bearing = this._map.getBearing();
815
- const options = __spreadProps$3(__spreadValues$4({
816
- bearing
817
- }, this.options.fitBoundsOptions), {
707
+ const options = {
708
+ bearing,
709
+ ...this.options.fitBoundsOptions,
818
710
  linear: true
819
- });
711
+ };
820
712
  const currentMapZoom = this._map.getZoom();
821
- if (currentMapZoom > ((_c = (_b = (_a = this.options) == null ? void 0 : _a.fitBoundsOptions) == null ? void 0 : _b.maxZoom) != null ? _c : 30)) {
713
+ if (currentMapZoom > (this.options?.fitBoundsOptions?.maxZoom ?? 30)) {
822
714
  options.zoom = currentMapZoom;
823
715
  }
824
716
  this._map.fitBounds(LngLatBounds$1.fromLngLat(center, radius), options, {
@@ -847,28 +739,15 @@ class MaptilerGeolocateControl extends GeolocateControl {
847
739
  }
848
740
  this.lastUpdatedCenter = this._map.getCenter();
849
741
  });
850
- });
851
- __publicField$3(this, "_setupUI", (supported) => {
742
+ };
743
+ this._setupUI = (supported) => {
852
744
  this.lastUpdatedCenter = this._map.getCenter();
853
- this._container.addEventListener(
854
- "contextmenu",
855
- (e) => e.preventDefault()
856
- );
857
- this._geolocateButton = DOMcreate(
858
- "button",
859
- "maplibregl-ctrl-geolocate",
860
- this._container
861
- );
862
- DOMcreate(
863
- "span",
864
- "maplibregl-ctrl-icon",
865
- this._geolocateButton
866
- ).setAttribute("aria-hidden", "true");
745
+ this._container.addEventListener("contextmenu", (e) => e.preventDefault());
746
+ this._geolocateButton = DOMcreate("button", "maplibregl-ctrl-geolocate", this._container);
747
+ DOMcreate("span", "maplibregl-ctrl-icon", this._geolocateButton).setAttribute("aria-hidden", "true");
867
748
  this._geolocateButton.type = "button";
868
749
  if (supported === false) {
869
- const title = this._map._getUIString(
870
- "GeolocateControl.LocationNotAvailable"
871
- );
750
+ const title = this._map._getUIString("GeolocateControl.LocationNotAvailable");
872
751
  this._geolocateButton.disabled = true;
873
752
  this._geolocateButton.title = title;
874
753
  this._geolocateButton.setAttribute("aria-label", title);
@@ -884,10 +763,7 @@ class MaptilerGeolocateControl extends GeolocateControl {
884
763
  if (this.options.showUserLocation) {
885
764
  this._dotElement = DOMcreate("div", "maplibregl-user-location-dot");
886
765
  this._userLocationDotMarker = new Marker$1({ element: this._dotElement });
887
- this._circleElement = DOMcreate(
888
- "div",
889
- "maplibregl-user-location-accuracy-circle"
890
- );
766
+ this._circleElement = DOMcreate("div", "maplibregl-user-location-accuracy-circle");
891
767
  this._accuracyCircleMarker = new Marker$1({
892
768
  element: this._circleElement,
893
769
  pitchAlignment: "map"
@@ -901,27 +777,21 @@ class MaptilerGeolocateControl extends GeolocateControl {
901
777
  if (this.options.trackUserLocation) {
902
778
  this._map.on("moveend", (event) => {
903
779
  const fromResize = event.originalEvent && event.originalEvent.type === "resize";
904
- const movingDistance = this.lastUpdatedCenter.distanceTo(
905
- this._map.getCenter()
906
- );
780
+ const movingDistance = this.lastUpdatedCenter.distanceTo(this._map.getCenter());
907
781
  if (!event.geolocateSource && this._watchState === "ACTIVE_LOCK" && !fromResize && movingDistance > 1) {
908
782
  this._watchState = "BACKGROUND";
909
- this._geolocateButton.classList.add(
910
- "maplibregl-ctrl-geolocate-background"
911
- );
912
- this._geolocateButton.classList.remove(
913
- "maplibregl-ctrl-geolocate-active"
914
- );
783
+ this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");
784
+ this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active");
915
785
  this.fire(new Event("trackuserlocationend"));
916
786
  }
917
787
  });
918
788
  }
919
- });
920
- __publicField$3(this, "_onZoom", () => {
789
+ };
790
+ this._onZoom = () => {
921
791
  if (this.options.showUserLocation && this.options.showAccuracyCircle) {
922
792
  this._updateCircleRadius();
923
793
  }
924
- });
794
+ };
925
795
  }
926
796
  _updateCircleRadius() {
927
797
  if (this._watchState !== "BACKGROUND" && this._watchState !== "ACTIVE_LOCK") {
@@ -933,10 +803,7 @@ class MaptilerGeolocateControl extends GeolocateControl {
933
803
  ];
934
804
  const projectedLocation = this._map.project(lastKnownLocation);
935
805
  const a = this._map.unproject([projectedLocation.x, projectedLocation.y]);
936
- const b = this._map.unproject([
937
- projectedLocation.x + 20,
938
- projectedLocation.y
939
- ]);
806
+ const b = this._map.unproject([projectedLocation.x + 20, projectedLocation.y]);
940
807
  const metersPerPixel = a.distanceTo(b) / 20;
941
808
  const circleDiameter = Math.ceil(2 * this._accuracy / metersPerPixel);
942
809
  this._circleElement.style.width = `${circleDiameter}px`;
@@ -956,29 +823,6 @@ class FullscreenControl extends maplibregl.FullscreenControl {
956
823
  }
957
824
  }
958
825
 
959
- var __defProp$4 = Object.defineProperty;
960
- var __defProps$2 = Object.defineProperties;
961
- var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
962
- var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
963
- var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
964
- var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
965
- var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
966
- var __spreadValues$3 = (a, b) => {
967
- for (var prop in b || (b = {}))
968
- if (__hasOwnProp$3.call(b, prop))
969
- __defNormalProp$4(a, prop, b[prop]);
970
- if (__getOwnPropSymbols$3)
971
- for (var prop of __getOwnPropSymbols$3(b)) {
972
- if (__propIsEnum$3.call(b, prop))
973
- __defNormalProp$4(a, prop, b[prop]);
974
- }
975
- return a;
976
- };
977
- var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
978
- var __publicField$2 = (obj, key, value) => {
979
- __defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
980
- return value;
981
- };
982
826
  var __accessCheck = (obj, member, msg) => {
983
827
  if (!member.has(obj))
984
828
  throw TypeError("Cannot " + msg);
@@ -994,7 +838,7 @@ var __privateAdd = (obj, member, value) => {
994
838
  };
995
839
  var __privateSet = (obj, member, value, setter) => {
996
840
  __accessCheck(obj, member, "write to private field");
997
- setter ? setter.call(obj, value) : member.set(obj, value);
841
+ member.set(obj, value);
998
842
  return value;
999
843
  };
1000
844
  var __privateMethod = (obj, member, method) => {
@@ -1008,21 +852,20 @@ class Minimap {
1008
852
  __privateAdd(this, _setParentBounds);
1009
853
  __privateAdd(this, _syncMaps);
1010
854
  __privateAdd(this, _options, void 0);
1011
- __publicField$2(this, "map");
1012
855
  __privateAdd(this, _parentMap, void 0);
1013
856
  __privateAdd(this, _container, void 0);
1014
857
  __privateAdd(this, _canvasContainer, void 0);
1015
858
  __privateAdd(this, _parentRect, void 0);
1016
859
  __privateAdd(this, _differentStyle, false);
1017
860
  __privateAdd(this, _desync, void 0);
1018
- var _a;
1019
861
  if (options.style !== void 0)
1020
862
  __privateSet(this, _differentStyle, true);
1021
- __privateSet(this, _options, __spreadProps$2(__spreadValues$3(__spreadProps$2(__spreadValues$3({
863
+ __privateSet(this, _options, {
1022
864
  // set defaults
1023
865
  zoomAdjust: -4,
1024
- position: "top-right"
1025
- }, mapOptions), {
866
+ position: "top-right",
867
+ // inherit map options
868
+ ...mapOptions,
1026
869
  // override any lingering control options
1027
870
  forceNoAttributionControl: true,
1028
871
  attributionControl: false,
@@ -1031,14 +874,16 @@ class Minimap {
1031
874
  maptilerLogo: false,
1032
875
  minimap: false,
1033
876
  hash: false,
1034
- pitchAdjust: false
1035
- }), options), {
1036
- containerStyle: __spreadValues$3({
877
+ pitchAdjust: false,
878
+ // override map options with new user defined minimap options
879
+ ...options,
880
+ containerStyle: {
1037
881
  border: "1px solid #000",
1038
882
  width: "400px",
1039
- height: "300px"
1040
- }, (_a = options.containerStyle) != null ? _a : {})
1041
- }));
883
+ height: "300px",
884
+ ...options.containerStyle ?? {}
885
+ }
886
+ });
1042
887
  if (options.lockZoom !== void 0) {
1043
888
  __privateGet(this, _options).minZoom = options.lockZoom;
1044
889
  __privateGet(this, _options).maxZoom = options.lockZoom;
@@ -1152,12 +997,15 @@ addParentRect_fn = function(rect) {
1152
997
  id: "parentRectOutline",
1153
998
  type: "line",
1154
999
  source: "parentRect",
1155
- layout: __spreadValues$3({}, rect.lineLayout),
1156
- paint: __spreadValues$3({
1000
+ layout: {
1001
+ ...rect.lineLayout
1002
+ },
1003
+ paint: {
1157
1004
  "line-color": "#FFF",
1158
1005
  "line-width": 1,
1159
- "line-opacity": 0.85
1160
- }, rect.linePaint)
1006
+ "line-opacity": 0.85,
1007
+ ...rect.linePaint
1008
+ }
1161
1009
  });
1162
1010
  }
1163
1011
  if (rect.fillPaint !== void 0) {
@@ -1166,10 +1014,11 @@ addParentRect_fn = function(rect) {
1166
1014
  type: "fill",
1167
1015
  source: "parentRect",
1168
1016
  layout: {},
1169
- paint: __spreadValues$3({
1017
+ paint: {
1170
1018
  "fill-color": "#08F",
1171
- "fill-opacity": 0.135
1172
- }, rect.fillPaint)
1019
+ "fill-opacity": 0.135,
1020
+ ...rect.fillPaint
1021
+ }
1173
1022
  });
1174
1023
  }
1175
1024
  __privateMethod(this, _setParentBounds, setParentBounds_fn).call(this);
@@ -1188,13 +1037,7 @@ setParentBounds_fn = function() {
1188
1037
  const southWest = unproject([0, height]);
1189
1038
  const southEast = unproject([width, height]);
1190
1039
  __privateGet(this, _parentRect).geometry.coordinates = [
1191
- [
1192
- southWest.toArray(),
1193
- southEast.toArray(),
1194
- northEast.toArray(),
1195
- northWest.toArray(),
1196
- southWest.toArray()
1197
- ]
1040
+ [southWest.toArray(), southEast.toArray(), northEast.toArray(), northWest.toArray(), southWest.toArray()]
1198
1041
  ];
1199
1042
  const source = this.map.getSource("parentRect");
1200
1043
  source.setData(__privateGet(this, _parentRect));
@@ -1217,12 +1060,11 @@ syncMaps_fn = function() {
1217
1060
  this.map.off("move", minimapCallback);
1218
1061
  };
1219
1062
  const sync = (which) => {
1220
- var _a;
1221
1063
  off();
1222
1064
  const from = which === "parent" ? __privateGet(this, _parentMap) : this.map;
1223
1065
  const to = which === "parent" ? this.map : __privateGet(this, _parentMap);
1224
1066
  const center = from.getCenter();
1225
- const zoom = from.getZoom() + ((_a = __privateGet(this, _options).zoomAdjust) != null ? _a : -4) * (which === "parent" ? 1 : -1);
1067
+ const zoom = from.getZoom() + (__privateGet(this, _options).zoomAdjust ?? -4) * (which === "parent" ? 1 : -1);
1226
1068
  const bearing = from.getBearing();
1227
1069
  const pitch = from.getPitch();
1228
1070
  to.jumpTo({
@@ -1240,65 +1082,20 @@ syncMaps_fn = function() {
1240
1082
  };
1241
1083
  };
1242
1084
 
1243
- var __defProp$3 = Object.defineProperty;
1244
- var __defProps$1 = Object.defineProperties;
1245
- var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
1246
- var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
1247
- var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
1248
- var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
1249
- var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1250
- var __spreadValues$2 = (a, b) => {
1251
- for (var prop in b || (b = {}))
1252
- if (__hasOwnProp$2.call(b, prop))
1253
- __defNormalProp$3(a, prop, b[prop]);
1254
- if (__getOwnPropSymbols$2)
1255
- for (var prop of __getOwnPropSymbols$2(b)) {
1256
- if (__propIsEnum$2.call(b, prop))
1257
- __defNormalProp$3(a, prop, b[prop]);
1258
- }
1259
- return a;
1260
- };
1261
- var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
1262
- var __publicField$1 = (obj, key, value) => {
1263
- __defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
1264
- return value;
1265
- };
1266
- var __async$1 = (__this, __arguments, generator) => {
1267
- return new Promise((resolve, reject) => {
1268
- var fulfilled = (value) => {
1269
- try {
1270
- step(generator.next(value));
1271
- } catch (e) {
1272
- reject(e);
1273
- }
1274
- };
1275
- var rejected = (value) => {
1276
- try {
1277
- step(generator.throw(value));
1278
- } catch (e) {
1279
- reject(e);
1280
- }
1281
- };
1282
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
1283
- step((generator = generator.apply(__this, __arguments)).next());
1284
- });
1285
- };
1286
1085
  const GeolocationType = {
1287
1086
  POINT: "POINT",
1288
1087
  COUNTRY: "COUNTRY"
1289
1088
  };
1290
1089
  class Map extends maplibregl.Map {
1291
1090
  constructor(options) {
1292
- var _a, _b, _c;
1091
+ displayNoWebGlWarning(options.container);
1293
1092
  if (options.apiKey) {
1294
1093
  config$1.apiKey = options.apiKey;
1295
1094
  }
1296
1095
  const style = styleToStyle(options.style);
1297
1096
  const hashPreConstructor = location.hash;
1298
1097
  if (!config$1.apiKey) {
1299
- console.warn(
1300
- "MapTiler Cloud API key is not set. Visit https://maptiler.com and try Cloud for free!"
1301
- );
1098
+ console.warn("MapTiler Cloud API key is not set. Visit https://maptiler.com and try Cloud for free!");
1302
1099
  }
1303
1100
  let attributionControlOptions = {
1304
1101
  compact: false
@@ -1306,31 +1103,36 @@ class Map extends maplibregl.Map {
1306
1103
  if (options.customAttribution) {
1307
1104
  attributionControlOptions.customAttribution = options.customAttribution;
1308
1105
  } else if (options.attributionControl && typeof options.attributionControl === "object") {
1309
- attributionControlOptions = __spreadValues$2(__spreadValues$2({}, attributionControlOptions), options.attributionControl);
1106
+ attributionControlOptions = {
1107
+ ...attributionControlOptions,
1108
+ ...options.attributionControl
1109
+ };
1310
1110
  }
1311
- super(__spreadProps$1(__spreadValues$2({}, options), {
1111
+ super({
1112
+ ...options,
1312
1113
  style,
1313
1114
  maplibreLogo: false,
1314
1115
  transformRequest: combineTransformRequest(options.transformRequest),
1315
1116
  attributionControl: options.forceNoAttributionControl === true ? false : attributionControlOptions
1316
- }));
1317
- __publicField$1(this, "isTerrainEnabled", false);
1318
- __publicField$1(this, "terrainExaggeration", 1);
1319
- __publicField$1(this, "primaryLanguage");
1320
- __publicField$1(this, "terrainGrowing", false);
1321
- __publicField$1(this, "terrainFlattening", false);
1322
- __publicField$1(this, "minimap");
1323
- __publicField$1(this, "forceLanguageUpdate");
1324
- __publicField$1(this, "languageAlwaysBeenStyle");
1325
- __publicField$1(this, "isReady", false);
1326
- if (config$1.caching) {
1117
+ });
1118
+ this.isTerrainEnabled = false;
1119
+ this.terrainExaggeration = 1;
1120
+ this.terrainGrowing = false;
1121
+ this.terrainFlattening = false;
1122
+ this.isReady = false;
1123
+ if (config$1.caching && !CACHE_API_AVAILABLE) {
1124
+ console.warn(
1125
+ "The cache API is only available in secure contexts. More info at https://developer.mozilla.org/en-US/docs/Web/API/Cache"
1126
+ );
1127
+ }
1128
+ if (config$1.caching && CACHE_API_AVAILABLE) {
1327
1129
  registerLocalCacheProtocol();
1328
1130
  }
1329
- this.primaryLanguage = (_a = options.language) != null ? _a : config$1.primaryLanguage;
1131
+ this.primaryLanguage = options.language ?? config$1.primaryLanguage;
1330
1132
  this.forceLanguageUpdate = this.primaryLanguage === Language.STYLE || this.primaryLanguage === Language.STYLE_LOCK ? false : true;
1331
1133
  this.languageAlwaysBeenStyle = this.primaryLanguage === Language.STYLE;
1332
- this.terrainExaggeration = (_b = options.terrainExaggeration) != null ? _b : this.terrainExaggeration;
1333
- this.once("styledata", () => __async$1(this, null, function* () {
1134
+ this.terrainExaggeration = options.terrainExaggeration ?? this.terrainExaggeration;
1135
+ this.once("styledata", async () => {
1334
1136
  if (!options.geolocate) {
1335
1137
  return;
1336
1138
  }
@@ -1342,7 +1144,7 @@ class Map extends maplibregl.Map {
1342
1144
  }
1343
1145
  try {
1344
1146
  if (options.geolocate === GeolocationType.COUNTRY) {
1345
- yield this.fitToIpBounds();
1147
+ await this.fitToIpBounds();
1346
1148
  return;
1347
1149
  }
1348
1150
  } catch (e) {
@@ -1350,12 +1152,12 @@ class Map extends maplibregl.Map {
1350
1152
  }
1351
1153
  let ipLocatedCameraHash;
1352
1154
  try {
1353
- yield this.centerOnIpPoint(options.zoom);
1155
+ await this.centerOnIpPoint(options.zoom);
1354
1156
  ipLocatedCameraHash = this.getCameraHash();
1355
1157
  } catch (e) {
1356
1158
  console.warn(e.message);
1357
1159
  }
1358
- const locationResult = yield navigator.permissions.query({
1160
+ const locationResult = await navigator.permissions.query({
1359
1161
  name: "geolocation"
1360
1162
  });
1361
1163
  if (locationResult.state === "granted") {
@@ -1393,7 +1195,7 @@ class Map extends maplibregl.Map {
1393
1195
  }
1394
1196
  );
1395
1197
  }
1396
- }));
1198
+ });
1397
1199
  this.on("styledata", () => {
1398
1200
  this.setPrimaryLanguage(this.primaryLanguage);
1399
1201
  });
@@ -1402,32 +1204,27 @@ class Map extends maplibregl.Map {
1402
1204
  this.enableTerrain(this.terrainExaggeration);
1403
1205
  }
1404
1206
  });
1405
- this.once("load", () => __async$1(this, null, function* () {
1207
+ this.once("load", () => {
1406
1208
  enableRTL();
1407
- }));
1408
- this.once("load", () => __async$1(this, null, function* () {
1209
+ });
1210
+ this.once("load", async () => {
1409
1211
  let tileJsonContent = { logo: null };
1410
1212
  try {
1411
1213
  const possibleSources = Object.keys(this.style.sourceCaches).map((sourceName) => this.getSource(sourceName)).filter(
1412
- (s) => s && "url" in s && typeof s.url === "string" && (s == null ? void 0 : s.url.includes("tiles.json"))
1413
- );
1414
- const styleUrl = new URL(
1415
- possibleSources[0].url
1214
+ (s) => s && "url" in s && typeof s.url === "string" && s?.url.includes("tiles.json")
1416
1215
  );
1216
+ const styleUrl = new URL(possibleSources[0].url);
1417
1217
  if (!styleUrl.searchParams.has("key")) {
1418
1218
  styleUrl.searchParams.append("key", config$1.apiKey);
1419
1219
  }
1420
- const tileJsonRes = yield fetch(styleUrl.href);
1421
- tileJsonContent = yield tileJsonRes.json();
1220
+ const tileJsonRes = await fetch(styleUrl.href);
1221
+ tileJsonContent = await tileJsonRes.json();
1422
1222
  } catch (e) {
1423
1223
  }
1424
1224
  if (options.forceNoAttributionControl !== true) {
1425
1225
  if ("logo" in tileJsonContent && tileJsonContent.logo) {
1426
1226
  const logoURL = tileJsonContent.logo;
1427
- this.addControl(
1428
- new MaptilerLogoControl({ logoURL }),
1429
- options.logoPosition
1430
- );
1227
+ this.addControl(new MaptilerLogoControl({ logoURL }), options.logoPosition);
1431
1228
  } else if (options.maptilerLogo) {
1432
1229
  this.addControl(new MaptilerLogoControl(), options.logoPosition);
1433
1230
  }
@@ -1474,7 +1271,7 @@ class Map extends maplibregl.Map {
1474
1271
  }
1475
1272
  this.isReady = true;
1476
1273
  this.fire("ready", { target: this });
1477
- }));
1274
+ });
1478
1275
  let loadEventTriggered = false;
1479
1276
  let terrainEventTriggered = false;
1480
1277
  let terrainEventData;
@@ -1485,7 +1282,6 @@ class Map extends maplibregl.Map {
1485
1282
  }
1486
1283
  });
1487
1284
  this.once("style.load", () => {
1488
- var _a2;
1489
1285
  const { minimap } = options;
1490
1286
  if (typeof minimap === "object") {
1491
1287
  const {
@@ -1535,7 +1331,7 @@ class Map extends maplibregl.Map {
1535
1331
  pixelRatio,
1536
1332
  validateStyle
1537
1333
  });
1538
- this.addControl(this.minimap, (_a2 = minimap.position) != null ? _a2 : "bottom-left");
1334
+ this.addControl(this.minimap, minimap.position ?? "bottom-left");
1539
1335
  } else if (minimap === true) {
1540
1336
  this.minimap = new Minimap({}, options);
1541
1337
  this.addControl(this.minimap, "bottom-left");
@@ -1560,9 +1356,7 @@ class Map extends maplibregl.Map {
1560
1356
  };
1561
1357
  this.on("terrain", terrainCallback);
1562
1358
  if (options.terrain) {
1563
- this.enableTerrain(
1564
- (_c = options.terrainExaggeration) != null ? _c : this.terrainExaggeration
1565
- );
1359
+ this.enableTerrain(options.terrainExaggeration ?? this.terrainExaggeration);
1566
1360
  }
1567
1361
  }
1568
1362
  /**
@@ -1571,15 +1365,13 @@ class Map extends maplibregl.Map {
1571
1365
  * otherwise, it is resolved as a result of the "load" event.
1572
1366
  * @returns
1573
1367
  */
1574
- onLoadAsync() {
1575
- return __async$1(this, null, function* () {
1576
- return new Promise((resolve) => {
1577
- if (this.loaded()) {
1578
- return resolve(this);
1579
- }
1580
- this.once("load", () => {
1581
- resolve(this);
1582
- });
1368
+ async onLoadAsync() {
1369
+ return new Promise((resolve) => {
1370
+ if (this.loaded()) {
1371
+ return resolve(this);
1372
+ }
1373
+ this.once("load", () => {
1374
+ resolve(this);
1583
1375
  });
1584
1376
  });
1585
1377
  }
@@ -1591,15 +1383,13 @@ class Map extends maplibregl.Map {
1591
1383
  * dealt with. This happens after the "load" event, due to the asynchronous nature
1592
1384
  * of some built-in controls.
1593
1385
  */
1594
- onReadyAsync() {
1595
- return __async$1(this, null, function* () {
1596
- return new Promise((resolve) => {
1597
- if (this.isReady) {
1598
- return resolve(this);
1599
- }
1600
- this.once("ready", () => {
1601
- resolve(this);
1602
- });
1386
+ async onReadyAsync() {
1387
+ return new Promise((resolve) => {
1388
+ if (this.isReady) {
1389
+ return resolve(this);
1390
+ }
1391
+ this.once("ready", () => {
1392
+ resolve(this);
1603
1393
  });
1604
1394
  });
1605
1395
  }
@@ -1610,15 +1400,13 @@ class Map extends maplibregl.Map {
1610
1400
  * otherwise, it is resolved as a result of the "loadWithTerrain" event.
1611
1401
  * @returns
1612
1402
  */
1613
- onLoadWithTerrainAsync() {
1614
- return __async$1(this, null, function* () {
1615
- return new Promise((resolve) => {
1616
- if (this.isReady && this.terrain) {
1617
- return resolve(this);
1618
- }
1619
- this.once("loadWithTerrain", () => {
1620
- resolve(this);
1621
- });
1403
+ async onLoadWithTerrainAsync() {
1404
+ return new Promise((resolve) => {
1405
+ if (this.isReady && this.terrain) {
1406
+ return resolve(this);
1407
+ }
1408
+ this.once("loadWithTerrain", () => {
1409
+ resolve(this);
1622
1410
  });
1623
1411
  });
1624
1412
  }
@@ -1630,8 +1418,7 @@ class Map extends maplibregl.Map {
1630
1418
  * - a longer form with the prefix `"maptiler://"` (eg. `"maptiler://streets-v2"`)
1631
1419
  */
1632
1420
  setStyle(style, options) {
1633
- var _a;
1634
- (_a = this.minimap) == null ? void 0 : _a.setStyle(style);
1421
+ this.minimap?.setStyle(style);
1635
1422
  this.forceLanguageUpdate = true;
1636
1423
  this.once("idle", () => {
1637
1424
  this.forceLanguageUpdate = false;
@@ -1658,8 +1445,7 @@ class Map extends maplibregl.Map {
1658
1445
  * @returns `this`
1659
1446
  */
1660
1447
  addLayer(layer, beforeId) {
1661
- var _a;
1662
- (_a = this.minimap) == null ? void 0 : _a.addLayer(layer, beforeId);
1448
+ this.minimap?.addLayer(layer, beforeId);
1663
1449
  return super.addLayer(layer, beforeId);
1664
1450
  }
1665
1451
  /**
@@ -1676,8 +1462,7 @@ class Map extends maplibregl.Map {
1676
1462
  * ```
1677
1463
  */
1678
1464
  moveLayer(id, beforeId) {
1679
- var _a;
1680
- (_a = this.minimap) == null ? void 0 : _a.moveLayer(id, beforeId);
1465
+ this.minimap?.moveLayer(id, beforeId);
1681
1466
  return super.moveLayer(id, beforeId);
1682
1467
  }
1683
1468
  /**
@@ -1695,8 +1480,7 @@ class Map extends maplibregl.Map {
1695
1480
  * ```
1696
1481
  */
1697
1482
  removeLayer(id) {
1698
- var _a;
1699
- (_a = this.minimap) == null ? void 0 : _a.removeLayer(id);
1483
+ this.minimap?.removeLayer(id);
1700
1484
  return super.removeLayer(id);
1701
1485
  }
1702
1486
  /**
@@ -1711,8 +1495,7 @@ class Map extends maplibregl.Map {
1711
1495
  * layer will not be rendered at all zoom levels in the zoom range.
1712
1496
  */
1713
1497
  setLayerZoomRange(layerId, minzoom, maxzoom) {
1714
- var _a;
1715
- (_a = this.minimap) == null ? void 0 : _a.setLayerZoomRange(layerId, minzoom, maxzoom);
1498
+ this.minimap?.setLayerZoomRange(layerId, minzoom, maxzoom);
1716
1499
  return super.setLayerZoomRange(layerId, minzoom, maxzoom);
1717
1500
  }
1718
1501
  /**
@@ -1727,8 +1510,7 @@ class Map extends maplibregl.Map {
1727
1510
  * To clear the filter, pass `null` or `undefined` as the second parameter.
1728
1511
  */
1729
1512
  setFilter(layerId, filter, options) {
1730
- var _a;
1731
- (_a = this.minimap) == null ? void 0 : _a.setFilter(layerId, filter, options);
1513
+ this.minimap?.setFilter(layerId, filter, options);
1732
1514
  return super.setFilter(layerId, filter, options);
1733
1515
  }
1734
1516
  /**
@@ -1746,8 +1528,7 @@ class Map extends maplibregl.Map {
1746
1528
  * ```
1747
1529
  */
1748
1530
  setPaintProperty(layerId, name, value, options) {
1749
- var _a;
1750
- (_a = this.minimap) == null ? void 0 : _a.setPaintProperty(layerId, name, value, options);
1531
+ this.minimap?.setPaintProperty(layerId, name, value, options);
1751
1532
  return super.setPaintProperty(layerId, name, value, options);
1752
1533
  }
1753
1534
  /**
@@ -1764,8 +1545,7 @@ class Map extends maplibregl.Map {
1764
1545
  * @returns `this`
1765
1546
  */
1766
1547
  setLayoutProperty(layerId, name, value, options) {
1767
- var _a;
1768
- (_a = this.minimap) == null ? void 0 : _a.setLayoutProperty(layerId, name, value, options);
1548
+ this.minimap?.setLayoutProperty(layerId, name, value, options);
1769
1549
  return super.setLayoutProperty(layerId, name, value, options);
1770
1550
  }
1771
1551
  /**
@@ -1780,8 +1560,7 @@ class Map extends maplibregl.Map {
1780
1560
  * ```
1781
1561
  */
1782
1562
  setGlyphs(glyphsUrl, options) {
1783
- var _a;
1784
- (_a = this.minimap) == null ? void 0 : _a.setGlyphs(glyphsUrl, options);
1563
+ this.minimap?.setGlyphs(glyphsUrl, options);
1785
1564
  return super.setGlyphs(glyphsUrl, options);
1786
1565
  }
1787
1566
  getStyleLanguage() {
@@ -1791,16 +1570,14 @@ class Map extends maplibregl.Map {
1791
1570
  return null;
1792
1571
  if ("maptiler:language" in this.style.stylesheet.metadata && typeof this.style.stylesheet.metadata["maptiler:language"] === "string") {
1793
1572
  return this.style.stylesheet.metadata["maptiler:language"];
1794
- } else {
1795
- return null;
1796
1573
  }
1574
+ return null;
1797
1575
  }
1798
1576
  /**
1799
1577
  * Define the primary language of the map. Note that not all the languages shorthands provided are available.
1800
1578
  */
1801
1579
  setLanguage(language) {
1802
- var _a, _b;
1803
- (_b = (_a = this.minimap) == null ? void 0 : _a.map) == null ? void 0 : _b.setLanguage(language);
1580
+ this.minimap?.map?.setLanguage(language);
1804
1581
  this.onStyleReady(() => {
1805
1582
  this.setPrimaryLanguage(language);
1806
1583
  });
@@ -1846,7 +1623,7 @@ class Map extends maplibregl.Map {
1846
1623
  }
1847
1624
  let langStr = Language.LOCAL;
1848
1625
  let replacer = `{${langStr}}`;
1849
- if (languageNonStyle == Language.VISITOR) {
1626
+ if (languageNonStyle === Language.VISITOR) {
1850
1627
  langStr = getBrowserLanguage();
1851
1628
  replacer = [
1852
1629
  "case",
@@ -1855,18 +1632,11 @@ class Map extends maplibregl.Map {
1855
1632
  "case",
1856
1633
  ["==", ["get", langStr], ["get", Language.LOCAL]],
1857
1634
  ["get", Language.LOCAL],
1858
- [
1859
- "format",
1860
- ["get", langStr],
1861
- { "font-scale": 0.8 },
1862
- "\n",
1863
- ["get", Language.LOCAL],
1864
- { "font-scale": 1.1 }
1865
- ]
1635
+ ["format", ["get", langStr], { "font-scale": 0.8 }, "\n", ["get", Language.LOCAL], { "font-scale": 1.1 }]
1866
1636
  ],
1867
1637
  ["get", Language.LOCAL]
1868
1638
  ];
1869
- } else if (languageNonStyle == Language.VISITOR_ENGLISH) {
1639
+ } else if (languageNonStyle === Language.VISITOR_ENGLISH) {
1870
1640
  langStr = Language.ENGLISH;
1871
1641
  replacer = [
1872
1642
  "case",
@@ -1875,36 +1645,19 @@ class Map extends maplibregl.Map {
1875
1645
  "case",
1876
1646
  ["==", ["get", langStr], ["get", Language.LOCAL]],
1877
1647
  ["get", Language.LOCAL],
1878
- [
1879
- "format",
1880
- ["get", langStr],
1881
- { "font-scale": 0.8 },
1882
- "\n",
1883
- ["get", Language.LOCAL],
1884
- { "font-scale": 1.1 }
1885
- ]
1648
+ ["format", ["get", langStr], { "font-scale": 0.8 }, "\n", ["get", Language.LOCAL], { "font-scale": 1.1 }]
1886
1649
  ],
1887
1650
  ["get", Language.LOCAL]
1888
1651
  ];
1889
1652
  } else if (languageNonStyle === Language.AUTO) {
1890
1653
  langStr = getBrowserLanguage();
1891
- replacer = [
1892
- "case",
1893
- ["has", langStr],
1894
- ["get", langStr],
1895
- ["get", Language.LOCAL]
1896
- ];
1654
+ replacer = ["case", ["has", langStr], ["get", langStr], ["get", Language.LOCAL]];
1897
1655
  } else if (languageNonStyle === Language.LOCAL) {
1898
1656
  langStr = Language.LOCAL;
1899
1657
  replacer = `{${langStr}}`;
1900
1658
  } else {
1901
1659
  langStr = languageNonStyle;
1902
- replacer = [
1903
- "case",
1904
- ["has", langStr],
1905
- ["get", langStr],
1906
- ["get", Language.LOCAL]
1907
- ];
1660
+ replacer = ["case", ["has", langStr], ["get", langStr], ["get", Language.LOCAL]];
1908
1661
  }
1909
1662
  const { layers } = this.getStyle();
1910
1663
  for (const genericLayer of layers) {
@@ -1974,7 +1727,7 @@ class Map extends maplibregl.Map {
1974
1727
  }
1975
1728
  const positionInLoop = (performance.now() - startTime) / durationMs;
1976
1729
  if (positionInLoop < 0.99) {
1977
- const exaggerationFactor = 1 - Math.pow(1 - positionInLoop, 4);
1730
+ const exaggerationFactor = 1 - (1 - positionInLoop) ** 4;
1978
1731
  const newExaggeration = currentExaggeration + exaggerationFactor * deltaExaggeration;
1979
1732
  this.terrain.exaggeration = newExaggeration;
1980
1733
  requestAnimationFrame(updateExaggeration);
@@ -1997,7 +1750,7 @@ class Map extends maplibregl.Map {
1997
1750
  console.warn("Terrain exaggeration cannot be negative.");
1998
1751
  return;
1999
1752
  }
2000
- const dataEventTerrainGrow = (evt) => __async$1(this, null, function* () {
1753
+ const dataEventTerrainGrow = async (evt) => {
2001
1754
  if (!this.terrain) {
2002
1755
  return;
2003
1756
  }
@@ -2016,7 +1769,7 @@ class Map extends maplibregl.Map {
2016
1769
  }
2017
1770
  this.off("data", dataEventTerrainGrow);
2018
1771
  this.growTerrain(exaggeration);
2019
- });
1772
+ };
2020
1773
  const addTerrain = () => {
2021
1774
  this.isTerrainEnabled = true;
2022
1775
  this.terrainExaggeration = exaggeration;
@@ -2066,7 +1819,7 @@ class Map extends maplibregl.Map {
2066
1819
  }
2067
1820
  const positionInLoop = (performance.now() - startTime) / animationLoopDuration;
2068
1821
  if (positionInLoop < 0.99) {
2069
- const exaggerationFactor = Math.pow(1 - positionInLoop, 4);
1822
+ const exaggerationFactor = (1 - positionInLoop) ** 4;
2070
1823
  const newExaggeration = currentExaggeration * exaggerationFactor;
2071
1824
  this.terrain.exaggeration = newExaggeration;
2072
1825
  requestAnimationFrame(updateExaggeration);
@@ -2114,29 +1867,18 @@ class Map extends maplibregl.Map {
2114
1867
  });
2115
1868
  }
2116
1869
  }
2117
- fitToIpBounds() {
2118
- return __async$1(this, null, function* () {
2119
- const ipGeolocateResult = yield geolocation.info();
2120
- this.fitBounds(
2121
- ipGeolocateResult.country_bounds,
2122
- {
2123
- duration: 0,
2124
- padding: 100
2125
- }
2126
- );
1870
+ async fitToIpBounds() {
1871
+ const ipGeolocateResult = await geolocation.info();
1872
+ this.fitBounds(ipGeolocateResult.country_bounds, {
1873
+ duration: 0,
1874
+ padding: 100
2127
1875
  });
2128
1876
  }
2129
- centerOnIpPoint(zoom) {
2130
- return __async$1(this, null, function* () {
2131
- var _a, _b;
2132
- const ipGeolocateResult = yield geolocation.info();
2133
- this.jumpTo({
2134
- center: [
2135
- (_a = ipGeolocateResult == null ? void 0 : ipGeolocateResult.longitude) != null ? _a : 0,
2136
- (_b = ipGeolocateResult == null ? void 0 : ipGeolocateResult.latitude) != null ? _b : 0
2137
- ],
2138
- zoom: zoom || 11
2139
- });
1877
+ async centerOnIpPoint(zoom) {
1878
+ const ipGeolocateResult = await geolocation.info();
1879
+ this.jumpTo({
1880
+ center: [ipGeolocateResult?.longitude ?? 0, ipGeolocateResult?.latitude ?? 0],
1881
+ zoom: zoom || 11
2140
1882
  });
2141
1883
  }
2142
1884
  getCameraHash() {
@@ -2302,22 +2044,6 @@ class MapMouseEvent extends maplibregl.MapMouseEvent {
2302
2044
  }
2303
2045
  }
2304
2046
 
2305
- var __defProp$2 = Object.defineProperty;
2306
- var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
2307
- var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
2308
- var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
2309
- var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2310
- var __spreadValues$1 = (a, b) => {
2311
- for (var prop in b || (b = {}))
2312
- if (__hasOwnProp$1.call(b, prop))
2313
- __defNormalProp$2(a, prop, b[prop]);
2314
- if (__getOwnPropSymbols$1)
2315
- for (var prop of __getOwnPropSymbols$1(b)) {
2316
- if (__propIsEnum$1.call(b, prop))
2317
- __defNormalProp$2(a, prop, b[prop]);
2318
- }
2319
- return a;
2320
- };
2321
2047
  function str2xml(str) {
2322
2048
  if (typeof DOMParser !== "undefined") {
2323
2049
  const doc = new DOMParser().parseFromString(str, "application/xml");
@@ -2325,9 +2051,8 @@ function str2xml(str) {
2325
2051
  throw new Error("The provided string is not valid XML");
2326
2052
  }
2327
2053
  return doc;
2328
- } else {
2329
- throw new Error("No XML parser found");
2330
2054
  }
2055
+ throw new Error("No XML parser found");
2331
2056
  }
2332
2057
  function hasChildNodeWithName(doc, nodeName) {
2333
2058
  if (!doc.hasChildNodes()) {
@@ -2348,14 +2073,13 @@ function xml2str(node) {
2348
2073
  throw new Error("No XML serializer found");
2349
2074
  }
2350
2075
  function gpx(doc) {
2351
- if (typeof doc === "string")
2352
- doc = str2xml(doc);
2353
- if (!hasChildNodeWithName(doc, "gpx")) {
2076
+ const actualDoc = typeof doc === "string" ? str2xml(doc) : doc;
2077
+ if (!hasChildNodeWithName(actualDoc, "gpx")) {
2354
2078
  throw new Error("The XML document is not valid GPX");
2355
2079
  }
2356
- const tracks = get(doc, "trk");
2357
- const routes = get(doc, "rte");
2358
- const waypoints = get(doc, "wpt");
2080
+ const tracks = get(actualDoc, "trk");
2081
+ const routes = get(actualDoc, "rte");
2082
+ const waypoints = get(actualDoc, "wpt");
2359
2083
  const gj = {
2360
2084
  type: "FeatureCollection",
2361
2085
  features: []
@@ -2376,10 +2100,10 @@ function gpx(doc) {
2376
2100
  return gj;
2377
2101
  }
2378
2102
  function kml(doc, xml2string) {
2379
- var _a;
2380
- if (typeof doc === "string")
2381
- doc = str2xml(doc);
2382
- if (!hasChildNodeWithName(doc, "kml")) {
2103
+ let actualDoc = doc;
2104
+ if (typeof actualDoc === "string")
2105
+ actualDoc = str2xml(actualDoc);
2106
+ if (!hasChildNodeWithName(actualDoc, "kml")) {
2383
2107
  throw new Error("The XML document is not valid KML");
2384
2108
  }
2385
2109
  const gj = {
@@ -2389,33 +2113,27 @@ function kml(doc, xml2string) {
2389
2113
  const styleIndex = {};
2390
2114
  const styleByHash = {};
2391
2115
  const styleMapIndex = {};
2392
- const placemarks = get(doc, "Placemark");
2393
- const styles = get(doc, "Style");
2394
- const styleMaps = get(doc, "StyleMap");
2116
+ const placemarks = get(actualDoc, "Placemark");
2117
+ const styles = get(actualDoc, "Style");
2118
+ const styleMaps = get(actualDoc, "StyleMap");
2395
2119
  for (const style of Array.from(styles)) {
2396
- const hash = okhash(
2397
- xml2string !== void 0 ? xml2string(style) : xml2str(style)
2398
- ).toString(16);
2399
- styleIndex["#" + attr(style, "id")] = hash;
2120
+ const hash = okhash(xml2string !== void 0 ? xml2string(style) : xml2str(style)).toString(16);
2121
+ styleIndex[`#${attr(style, "id")}`] = hash;
2400
2122
  styleByHash[hash] = style;
2401
2123
  }
2402
2124
  for (const styleMap of Array.from(styleMaps)) {
2403
- styleIndex["#" + attr(styleMap, "id")] = okhash(
2125
+ styleIndex[`#${attr(styleMap, "id")}`] = okhash(
2404
2126
  xml2string !== void 0 ? xml2string(styleMap) : xml2str(styleMap)
2405
2127
  ).toString(16);
2406
2128
  const pairs = get(styleMap, "Pair");
2407
2129
  const pairsMap = {};
2408
2130
  for (const pair of Array.from(pairs)) {
2409
- pairsMap[(_a = nodeVal(get1(pair, "key"))) != null ? _a : ""] = nodeVal(
2410
- get1(pair, "styleUrl")
2411
- );
2131
+ pairsMap[nodeVal(get1(pair, "key")) ?? ""] = nodeVal(get1(pair, "styleUrl"));
2412
2132
  }
2413
- styleMapIndex["#" + attr(styleMap, "id")] = pairsMap;
2133
+ styleMapIndex[`#${attr(styleMap, "id")}`] = pairsMap;
2414
2134
  }
2415
2135
  for (const placemark of Array.from(placemarks)) {
2416
- gj.features = gj.features.concat(
2417
- getPlacemark(placemark, styleIndex, styleByHash, styleMapIndex)
2418
- );
2136
+ gj.features = gj.features.concat(getPlacemark(placemark, styleIndex, styleByHash, styleMapIndex));
2419
2137
  }
2420
2138
  return gj;
2421
2139
  }
@@ -2424,28 +2142,28 @@ function kmlColor(v) {
2424
2142
  return ["#000000", 1];
2425
2143
  let color = "";
2426
2144
  let opacity = 1;
2427
- if (v.substring(0, 1) === "#")
2428
- v = v.substring(1);
2429
- if (v.length === 6 || v.length === 3)
2430
- color = v;
2431
- if (v.length === 8) {
2432
- opacity = parseInt(v.substring(0, 2), 16) / 255;
2433
- color = "#" + v.substring(6, 8) + v.substring(4, 6) + v.substring(2, 4);
2434
- }
2435
- return [color != null ? color : "#000000", opacity != null ? opacity : 1];
2145
+ let validV = v;
2146
+ if (validV.substring(0, 1) === "#")
2147
+ validV = validV.substring(1);
2148
+ if (validV.length === 6 || validV.length === 3)
2149
+ color = validV;
2150
+ if (validV.length === 8) {
2151
+ opacity = Number.parseInt(validV.substring(0, 2), 16) / 255;
2152
+ color = `#${validV.substring(6, 8)}${validV.substring(4, 6)}${validV.substring(2, 4)}`;
2153
+ }
2154
+ return [color ?? "#000000", opacity ?? 1];
2436
2155
  }
2437
2156
  function gxCoord(v) {
2438
2157
  return numarray(v.split(" "));
2439
2158
  }
2440
2159
  function gxCoords(root) {
2441
- var _a;
2442
2160
  let elems = get(root, "coord");
2443
2161
  const coords = [];
2444
2162
  const times = [];
2445
2163
  if (elems.length === 0)
2446
2164
  elems = get(root, "gx:coord");
2447
2165
  for (const elem of Array.from(elems)) {
2448
- coords.push(gxCoord((_a = nodeVal(elem)) != null ? _a : ""));
2166
+ coords.push(gxCoord(nodeVal(elem) ?? ""));
2449
2167
  }
2450
2168
  const timeElems = get(root, "when");
2451
2169
  for (const timeElem of Array.from(timeElems))
@@ -2456,9 +2174,12 @@ function gxCoords(root) {
2456
2174
  };
2457
2175
  }
2458
2176
  function getGeometry(root) {
2459
- var _a, _b, _c;
2460
2177
  const geotypes = ["Polygon", "LineString", "Point", "Track", "gx:Track"];
2461
- let geomNode, geomNodes, i, j, k;
2178
+ let geomNode;
2179
+ let geomNodes;
2180
+ let i;
2181
+ let j;
2182
+ let k;
2462
2183
  const geoms = [];
2463
2184
  const coordTimes = [];
2464
2185
  if (get1(root, "MultiGeometry") !== null) {
@@ -2478,18 +2199,18 @@ function getGeometry(root) {
2478
2199
  if (geotypes[i] === "Point") {
2479
2200
  geoms.push({
2480
2201
  type: "Point",
2481
- coordinates: coord1((_a = nodeVal(get1(geomNode, "coordinates"))) != null ? _a : "")
2202
+ coordinates: coord1(nodeVal(get1(geomNode, "coordinates")) ?? "")
2482
2203
  });
2483
2204
  } else if (geotypes[i] === "LineString") {
2484
2205
  geoms.push({
2485
2206
  type: "LineString",
2486
- coordinates: coord((_b = nodeVal(get1(geomNode, "coordinates"))) != null ? _b : "")
2207
+ coordinates: coord(nodeVal(get1(geomNode, "coordinates")) ?? "")
2487
2208
  });
2488
2209
  } else if (geotypes[i] === "Polygon") {
2489
2210
  const rings = get(geomNode, "LinearRing");
2490
2211
  const coords = [];
2491
2212
  for (k = 0; k < rings.length; k++) {
2492
- coords.push(coord((_c = nodeVal(get1(rings[k], "coordinates"))) != null ? _c : ""));
2213
+ coords.push(coord(nodeVal(get1(rings[k], "coordinates")) ?? ""));
2493
2214
  }
2494
2215
  geoms.push({
2495
2216
  type: "Polygon",
@@ -2510,7 +2231,6 @@ function getGeometry(root) {
2510
2231
  return { geoms, coordTimes };
2511
2232
  }
2512
2233
  function getPlacemark(root, styleIndex, styleByHash, styleMapIndex) {
2513
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
2514
2234
  const geomsAndTimes = getGeometry(root);
2515
2235
  const properties = {};
2516
2236
  const name = nodeVal(get1(root, "name"));
@@ -2532,16 +2252,16 @@ function getPlacemark(root, styleIndex, styleByHash, styleMapIndex) {
2532
2252
  properties.address = address;
2533
2253
  if (styleUrl) {
2534
2254
  if (styleUrl[0] !== "#")
2535
- styleUrl = "#" + styleUrl;
2255
+ styleUrl = `#${styleUrl}`;
2536
2256
  properties.styleUrl = styleUrl;
2537
2257
  if (styleIndex[styleUrl]) {
2538
2258
  properties.styleHash = styleIndex[styleUrl];
2539
2259
  }
2540
2260
  if (styleMapIndex[styleUrl]) {
2541
2261
  properties.styleMapHash = styleMapIndex[styleUrl];
2542
- properties.styleHash = styleIndex[(_a = styleMapIndex[styleUrl].normal) != null ? _a : ""];
2262
+ properties.styleHash = styleIndex[styleMapIndex[styleUrl].normal ?? ""];
2543
2263
  }
2544
- const style = styleByHash[(_b = properties.styleHash) != null ? _b : ""];
2264
+ const style = styleByHash[properties.styleHash ?? ""];
2545
2265
  if (style) {
2546
2266
  if (!lineStyle)
2547
2267
  lineStyle = get1(style, "LineStyle");
@@ -2567,18 +2287,18 @@ function getPlacemark(root, styleIndex, styleByHash, styleMapIndex) {
2567
2287
  properties.timespan = { begin, end };
2568
2288
  }
2569
2289
  if (timeStamp !== null) {
2570
- properties.timestamp = (_c = nodeVal(get1(timeStamp, "when"))) != null ? _c : (/* @__PURE__ */ new Date()).toISOString();
2290
+ properties.timestamp = nodeVal(get1(timeStamp, "when")) ?? (/* @__PURE__ */ new Date()).toISOString();
2571
2291
  }
2572
2292
  if (lineStyle !== null) {
2573
2293
  const linestyles = kmlColor(nodeVal(get1(lineStyle, "color")));
2574
2294
  const color = linestyles[0];
2575
2295
  const opacity = linestyles[1];
2576
- const width = parseFloat((_d = nodeVal(get1(lineStyle, "width"))) != null ? _d : "");
2296
+ const width = Number.parseFloat(nodeVal(get1(lineStyle, "width")) ?? "");
2577
2297
  if (color)
2578
2298
  properties.stroke = color;
2579
- if (!isNaN(opacity))
2299
+ if (!Number.isNaN(opacity))
2580
2300
  properties["stroke-opacity"] = opacity;
2581
- if (!isNaN(width))
2301
+ if (!Number.isNaN(width))
2582
2302
  properties["stroke-width"] = width;
2583
2303
  }
2584
2304
  if (polyStyle) {
@@ -2589,7 +2309,7 @@ function getPlacemark(root, styleIndex, styleByHash, styleMapIndex) {
2589
2309
  const outline = nodeVal(get1(polyStyle, "outline"));
2590
2310
  if (pcolor)
2591
2311
  properties.fill = pcolor;
2592
- if (!isNaN(popacity))
2312
+ if (!Number.isNaN(popacity))
2593
2313
  properties["fill-opacity"] = popacity;
2594
2314
  if (fill)
2595
2315
  properties["fill-opacity"] = fill === "1" ? properties["fill-opacity"] || 1 : 0;
@@ -2597,16 +2317,17 @@ function getPlacemark(root, styleIndex, styleByHash, styleMapIndex) {
2597
2317
  properties["stroke-opacity"] = outline === "1" ? properties["stroke-opacity"] || 1 : 0;
2598
2318
  }
2599
2319
  if (extendedData) {
2600
- const datas = get(extendedData, "Data"), simpleDatas = get(extendedData, "SimpleData");
2320
+ const datas = get(extendedData, "Data");
2321
+ const simpleDatas = get(extendedData, "SimpleData");
2601
2322
  for (i = 0; i < datas.length; i++) {
2602
- properties[(_e = datas[i].getAttribute("name")) != null ? _e : ""] = (_f = nodeVal(get1(datas[i], "value"))) != null ? _f : "";
2323
+ properties[datas[i].getAttribute("name") ?? ""] = nodeVal(get1(datas[i], "value")) ?? "";
2603
2324
  }
2604
2325
  for (i = 0; i < simpleDatas.length; i++) {
2605
- properties[(_g = simpleDatas[i].getAttribute("name")) != null ? _g : ""] = (_h = nodeVal(simpleDatas[i])) != null ? _h : "";
2326
+ properties[simpleDatas[i].getAttribute("name") ?? ""] = nodeVal(simpleDatas[i]) ?? "";
2606
2327
  }
2607
2328
  }
2608
2329
  if (visibility !== null) {
2609
- properties.visibility = (_i = nodeVal(visibility)) != null ? _i : "";
2330
+ properties.visibility = nodeVal(visibility) ?? "";
2610
2331
  }
2611
2332
  if (geomsAndTimes.coordTimes.length !== 0) {
2612
2333
  properties.coordTimes = geomsAndTimes.coordTimes.length === 1 ? geomsAndTimes.coordTimes[0] : geomsAndTimes.coordTimes;
@@ -2620,7 +2341,7 @@ function getPlacemark(root, styleIndex, styleByHash, styleMapIndex) {
2620
2341
  properties
2621
2342
  };
2622
2343
  if (attr(root, "id"))
2623
- feature.id = (_j = attr(root, "id")) != null ? _j : void 0;
2344
+ feature.id = attr(root, "id") ?? void 0;
2624
2345
  return [feature];
2625
2346
  }
2626
2347
  function getPoints(node, pointname) {
@@ -2677,7 +2398,10 @@ function getTrack(node) {
2677
2398
  }
2678
2399
  if (track.length === 0)
2679
2400
  return;
2680
- const properties = __spreadValues$1(__spreadValues$1({}, getProperties(node)), getLineStyle(get1(node, "extensions")));
2401
+ const properties = {
2402
+ ...getProperties(node),
2403
+ ...getLineStyle(get1(node, "extensions"))
2404
+ };
2681
2405
  if (times.length !== 0)
2682
2406
  properties.coordTimes = track.length === 1 ? times[0] : times;
2683
2407
  if (heartRates.length !== 0) {
@@ -2692,22 +2416,24 @@ function getTrack(node) {
2692
2416
  coordinates: track[0]
2693
2417
  }
2694
2418
  };
2695
- } else {
2696
- return {
2697
- type: "Feature",
2698
- properties,
2699
- geometry: {
2700
- type: "MultiLineString",
2701
- coordinates: track
2702
- }
2703
- };
2704
2419
  }
2420
+ return {
2421
+ type: "Feature",
2422
+ properties,
2423
+ geometry: {
2424
+ type: "MultiLineString",
2425
+ coordinates: track
2426
+ }
2427
+ };
2705
2428
  }
2706
2429
  function getRoute(node) {
2707
2430
  const line = getPoints(node, "rtept");
2708
2431
  if (line === void 0)
2709
2432
  return;
2710
- const prop = __spreadValues$1(__spreadValues$1({}, getProperties(node)), getLineStyle(get1(node, "extensions")));
2433
+ const prop = {
2434
+ ...getProperties(node),
2435
+ ...getLineStyle(get1(node, "extensions"))
2436
+ };
2711
2437
  return {
2712
2438
  type: "Feature",
2713
2439
  properties: prop,
@@ -2718,7 +2444,7 @@ function getRoute(node) {
2718
2444
  };
2719
2445
  }
2720
2446
  function getPoint(node) {
2721
- const prop = __spreadValues$1(__spreadValues$1({}, getProperties(node)), getMulti(node, ["sym"]));
2447
+ const prop = { ...getProperties(node), ...getMulti(node, ["sym"]) };
2722
2448
  return {
2723
2449
  type: "Feature",
2724
2450
  properties: prop,
@@ -2729,19 +2455,18 @@ function getPoint(node) {
2729
2455
  };
2730
2456
  }
2731
2457
  function getLineStyle(extensions) {
2732
- var _a, _b;
2733
2458
  const style = {};
2734
2459
  if (extensions) {
2735
2460
  const lineStyle = get1(extensions, "line");
2736
2461
  if (lineStyle) {
2737
2462
  const color = nodeVal(get1(lineStyle, "color"));
2738
- const opacity = parseFloat((_a = nodeVal(get1(lineStyle, "opacity"))) != null ? _a : "0");
2739
- const width = parseFloat((_b = nodeVal(get1(lineStyle, "width"))) != null ? _b : "0");
2463
+ const opacity = Number.parseFloat(nodeVal(get1(lineStyle, "opacity")) ?? "0");
2464
+ const width = Number.parseFloat(nodeVal(get1(lineStyle, "width")) ?? "0");
2740
2465
  if (color)
2741
2466
  style.stroke = color;
2742
- if (!isNaN(opacity))
2467
+ if (!Number.isNaN(opacity))
2743
2468
  style["stroke-opacity"] = opacity;
2744
- if (!isNaN(width))
2469
+ if (!Number.isNaN(width))
2745
2470
  style["stroke-width"] = width * 96 / 25.4;
2746
2471
  }
2747
2472
  }
@@ -2760,9 +2485,10 @@ function getProperties(node) {
2760
2485
  if (links.length !== 0) {
2761
2486
  prop.links = [];
2762
2487
  for (const l of Array.from(links)) {
2763
- const link = __spreadValues$1({
2764
- href: attr(l, "href")
2765
- }, getMulti(l, ["text", "type"]));
2488
+ const link = {
2489
+ href: attr(l, "href"),
2490
+ ...getMulti(l, ["text", "type"])
2491
+ };
2766
2492
  prop.links.push(link);
2767
2493
  }
2768
2494
  }
@@ -2784,8 +2510,7 @@ function attr(x, y) {
2784
2510
  return x.getAttribute(y);
2785
2511
  }
2786
2512
  function attrf(x, y) {
2787
- var _a;
2788
- return parseFloat((_a = attr(x, y)) != null ? _a : "0");
2513
+ return Number.parseFloat(attr(x, y) ?? "0");
2789
2514
  }
2790
2515
  function get1(x, y) {
2791
2516
  const n = get(x, y);
@@ -2797,7 +2522,7 @@ function norm(el) {
2797
2522
  return el;
2798
2523
  }
2799
2524
  function numarray(x) {
2800
- return x.map(parseFloat).map((n) => isNaN(n) ? null : n);
2525
+ return x.map(Number.parseFloat).map((n) => Number.isNaN(n) ? null : n);
2801
2526
  }
2802
2527
  function nodeVal(x) {
2803
2528
  if (x)
@@ -2805,14 +2530,13 @@ function nodeVal(x) {
2805
2530
  return x && x.textContent;
2806
2531
  }
2807
2532
  function getMulti(x, ys) {
2808
- var _a;
2809
2533
  const o = {};
2810
2534
  let n;
2811
2535
  let k;
2812
2536
  for (k = 0; k < ys.length; k++) {
2813
2537
  n = get1(x, ys[k]);
2814
2538
  if (n)
2815
- o[ys[k]] = (_a = nodeVal(n)) != null ? _a : "";
2539
+ o[ys[k]] = nodeVal(n) ?? "";
2816
2540
  }
2817
2541
  return o;
2818
2542
  }
@@ -2827,61 +2551,55 @@ function coord(v) {
2827
2551
  return out;
2828
2552
  }
2829
2553
  function coordPair(x) {
2830
- var _a, _b;
2831
2554
  const ll = [attrf(x, "lon"), attrf(x, "lat")];
2832
2555
  const ele = get1(x, "ele");
2833
2556
  const heartRate = get1(x, "gpxtpx:hr") || get1(x, "hr");
2834
2557
  const time = get1(x, "time");
2835
2558
  let e;
2836
2559
  if (ele) {
2837
- e = parseFloat((_a = nodeVal(ele)) != null ? _a : "0");
2838
- if (!isNaN(e))
2560
+ e = Number.parseFloat(nodeVal(ele) ?? "0");
2561
+ if (!Number.isNaN(e))
2839
2562
  ll.push(e);
2840
2563
  }
2841
2564
  return {
2842
2565
  coordinates: ll,
2843
2566
  time: time ? nodeVal(time) : null,
2844
- heartRate: heartRate !== null ? parseFloat((_b = nodeVal(heartRate)) != null ? _b : "0") : null
2567
+ heartRate: heartRate !== null ? Number.parseFloat(nodeVal(heartRate) ?? "0") : null
2845
2568
  };
2846
2569
  }
2847
2570
  function gpxOrKml(doc) {
2571
+ let actualDoc = doc;
2848
2572
  try {
2849
- if (typeof doc === "string")
2850
- doc = str2xml(doc);
2573
+ if (typeof actualDoc === "string")
2574
+ actualDoc = str2xml(actualDoc);
2851
2575
  } catch (e) {
2852
2576
  return null;
2853
2577
  }
2854
2578
  try {
2855
- const result = gpx(doc);
2579
+ const result = gpx(actualDoc);
2856
2580
  return result;
2857
2581
  } catch (e) {
2858
2582
  }
2859
2583
  try {
2860
- const result = kml(doc);
2584
+ const result = kml(actualDoc);
2861
2585
  return result;
2862
2586
  } catch (e) {
2863
2587
  }
2864
2588
  return null;
2865
2589
  }
2866
2590
 
2867
- var __defProp$1 = Object.defineProperty;
2868
- var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2869
- var __publicField = (obj, key, value) => {
2870
- __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
2871
- return value;
2872
- };
2873
2591
  function componentToHex(c) {
2874
2592
  const hex = c.toString(16);
2875
- return hex.length == 1 ? "0" + hex : hex;
2593
+ return hex.length === 1 ? `0${hex}` : hex;
2876
2594
  }
2877
2595
  function rgbToHex(rgb) {
2878
- return "#" + componentToHex(rgb[0]) + componentToHex(rgb[1]) + componentToHex(rgb[2]) + (rgb.length === 4 ? componentToHex(rgb[3]) : "");
2596
+ return `#${componentToHex(rgb[0])}${componentToHex(rgb[1])}${componentToHex(rgb[2])}${rgb.length === 4 ? componentToHex(rgb[3]) : ""}`;
2879
2597
  }
2880
2598
  class ColorRamp extends Array {
2881
2599
  constructor(options = {}) {
2882
2600
  super();
2883
- __publicField(this, "min", 0);
2884
- __publicField(this, "max", 1);
2601
+ this.min = 0;
2602
+ this.max = 1;
2885
2603
  if ("min" in options) {
2886
2604
  this.min = options.min;
2887
2605
  }
@@ -2909,8 +2627,8 @@ class ColorRamp extends Array {
2909
2627
  setStops(stops, options = { clone: true }) {
2910
2628
  const colorRamp = options.clone ? this.clone() : this;
2911
2629
  colorRamp.length = 0;
2912
- let min = Infinity;
2913
- let max = -Infinity;
2630
+ let min = Number.POSITIVE_INFINITY;
2631
+ let max = Number.NEGATIVE_INFINITY;
2914
2632
  for (let i = 0; i < stops.length; i += 1) {
2915
2633
  min = Math.min(min, stops[i].value);
2916
2634
  max = Math.max(max, stops[i].value);
@@ -2920,9 +2638,7 @@ class ColorRamp extends Array {
2920
2638
  // we want to make sure we do a deep copy and not a reference
2921
2639
  });
2922
2640
  }
2923
- colorRamp.sort(
2924
- (a, b) => a.value < b.value ? -1 : 1
2925
- );
2641
+ colorRamp.sort((a, b) => a.value < b.value ? -1 : 1);
2926
2642
  this.min = min;
2927
2643
  this.max = max;
2928
2644
  return colorRamp;
@@ -2953,9 +2669,8 @@ class ColorRamp extends Array {
2953
2669
  at(pos) {
2954
2670
  if (pos < 0) {
2955
2671
  return this[this.length + pos];
2956
- } else {
2957
- return this[pos];
2958
2672
  }
2673
+ return this[pos];
2959
2674
  }
2960
2675
  clone() {
2961
2676
  return new ColorRamp({ stops: this.getRawColorStops() });
@@ -3018,10 +2733,7 @@ class ColorRamp extends Array {
3018
2733
  */
3019
2734
  getColorRelative(value, options = { smooth: true }) {
3020
2735
  const bounds = this.getBounds();
3021
- return this.getColor(
3022
- bounds.min + value * (bounds.max - bounds.min),
3023
- options
3024
- );
2736
+ return this.getColor(bounds.min + value * (bounds.max - bounds.min), options);
3025
2737
  }
3026
2738
  getCanvasStrip(options = {
3027
2739
  horizontal: true,
@@ -3064,42 +2776,42 @@ class ColorRamp extends Array {
3064
2776
  if (method === "ease-in-square") {
3065
2777
  stops = Array.from({ length: samples }, (_, i) => {
3066
2778
  const x = i * step;
3067
- const y = Math.pow(x, 2);
2779
+ const y = x ** 2;
3068
2780
  const color = inputNormalized.getColor(y);
3069
2781
  return { value: x, color };
3070
2782
  });
3071
2783
  } else if (method === "ease-out-square") {
3072
2784
  stops = Array.from({ length: samples }, (_, i) => {
3073
2785
  const x = i * step;
3074
- const y = 1 - Math.pow(1 - x, 2);
2786
+ const y = 1 - (1 - x) ** 2;
3075
2787
  const color = inputNormalized.getColor(y);
3076
2788
  return { value: x, color };
3077
2789
  });
3078
2790
  } else if (method === "ease-out-sqrt") {
3079
2791
  stops = Array.from({ length: samples }, (_, i) => {
3080
2792
  const x = i * step;
3081
- const y = Math.pow(x, 0.5);
2793
+ const y = x ** 0.5;
3082
2794
  const color = inputNormalized.getColor(y);
3083
2795
  return { value: x, color };
3084
2796
  });
3085
2797
  } else if (method === "ease-in-sqrt") {
3086
2798
  stops = Array.from({ length: samples }, (_, i) => {
3087
2799
  const x = i * step;
3088
- const y = 1 - Math.pow(1 - x, 0.5);
2800
+ const y = 1 - (1 - x) ** 0.5;
3089
2801
  const color = inputNormalized.getColor(y);
3090
2802
  return { value: x, color };
3091
2803
  });
3092
2804
  } else if (method === "ease-out-exp") {
3093
2805
  stops = Array.from({ length: samples }, (_, i) => {
3094
2806
  const x = i * step;
3095
- const y = 1 - Math.pow(2, -10 * x);
2807
+ const y = 1 - 2 ** (-10 * x);
3096
2808
  const color = inputNormalized.getColor(y);
3097
2809
  return { value: x, color };
3098
2810
  });
3099
2811
  } else if (method === "ease-in-exp") {
3100
2812
  stops = Array.from({ length: samples }, (_, i) => {
3101
2813
  const x = i * step;
3102
- const y = Math.pow(2, 10 * x - 10);
2814
+ const y = 2 ** (10 * x - 10);
3103
2815
  const color = inputNormalized.getColor(y);
3104
2816
  return { value: x, color };
3105
2817
  });
@@ -3120,11 +2832,11 @@ class ColorRamp extends Array {
3120
2832
  color: stops[0].color.slice()
3121
2833
  });
3122
2834
  stops[1].value += 1e-3;
3123
- stops.forEach((s) => {
2835
+ for (const s of stops) {
3124
2836
  if (s.color.length === 3) {
3125
2837
  s.color.push(255);
3126
2838
  }
3127
- });
2839
+ }
3128
2840
  stops[0].color[3] = 0;
3129
2841
  return new ColorRamp({ stops });
3130
2842
  }
@@ -3938,83 +3650,48 @@ function lerpZoomNumberValues(znv, z) {
3938
3650
  return 0;
3939
3651
  }
3940
3652
  function paintColorOptionsToPaintSpec(color) {
3941
- return [
3942
- "interpolate",
3943
- ["linear"],
3944
- ["zoom"],
3945
- ...color.map((el) => [el.zoom, el.value]).flat()
3946
- ];
3653
+ return ["interpolate", ["linear"], ["zoom"], ...color.flatMap((el) => [el.zoom, el.value])];
3947
3654
  }
3948
3655
  function rampedOptionsToLayerPaintSpec(ramp) {
3949
- return [
3950
- "interpolate",
3951
- ["linear"],
3952
- ["zoom"],
3953
- ...ramp.map((el) => [el.zoom, el.value]).flat()
3954
- ];
3656
+ return ["interpolate", ["linear"], ["zoom"], ...ramp.flatMap((el) => [el.zoom, el.value])];
3955
3657
  }
3956
3658
  function computeRampedOutlineWidth(lineWidth, outlineWidth) {
3957
3659
  if (typeof outlineWidth === "number" && typeof lineWidth === "number") {
3958
3660
  return 2 * outlineWidth + lineWidth;
3959
- } else if (typeof outlineWidth === "number" && Array.isArray(lineWidth)) {
3960
- return [
3961
- "interpolate",
3962
- ["linear"],
3963
- ["zoom"],
3964
- ...lineWidth.map((el) => [el.zoom, 2 * outlineWidth + el.value]).flat()
3965
- ];
3966
- } else if (typeof lineWidth === "number" && Array.isArray(outlineWidth)) {
3967
- return [
3968
- "interpolate",
3969
- ["linear"],
3970
- ["zoom"],
3971
- ...outlineWidth.map((el) => [el.zoom, 2 * el.value + lineWidth]).flat()
3972
- ];
3661
+ }
3662
+ if (typeof outlineWidth === "number" && Array.isArray(lineWidth)) {
3663
+ return ["interpolate", ["linear"], ["zoom"], ...lineWidth.flatMap((el) => [el.zoom, 2 * outlineWidth + el.value])];
3664
+ }
3665
+ if (typeof lineWidth === "number" && Array.isArray(outlineWidth)) {
3666
+ return ["interpolate", ["linear"], ["zoom"], ...outlineWidth.flatMap((el) => [el.zoom, 2 * el.value + lineWidth])];
3973
3667
  }
3974
3668
  if (Array.isArray(lineWidth) && Array.isArray(outlineWidth)) {
3975
3669
  const allStops = Array.from(
3976
- /* @__PURE__ */ new Set([
3977
- ...lineWidth.map((el) => el.zoom),
3978
- ...outlineWidth.map((el) => el.zoom)
3979
- ])
3670
+ /* @__PURE__ */ new Set([...lineWidth.map((el) => el.zoom), ...outlineWidth.map((el) => el.zoom)])
3980
3671
  ).sort((a, b) => a < b ? -1 : 1);
3981
3672
  return [
3982
3673
  "interpolate",
3983
3674
  ["linear"],
3984
3675
  ["zoom"],
3985
- ...allStops.map((z) => [
3986
- z,
3987
- 2 * lerpZoomNumberValues(outlineWidth, z) + lerpZoomNumberValues(lineWidth, z)
3988
- ]).flat()
3676
+ ...allStops.flatMap((z) => [z, 2 * lerpZoomNumberValues(outlineWidth, z) + lerpZoomNumberValues(lineWidth, z)])
3989
3677
  ];
3990
3678
  }
3991
3679
  return 0;
3992
3680
  }
3993
3681
  function rampedPropertyValueWeight(ramp, property) {
3994
- return [
3995
- "interpolate",
3996
- ["linear"],
3997
- ["get", property],
3998
- ...ramp.map((el) => [el.propertyValue, el.value]).flat()
3999
- ];
3682
+ return ["interpolate", ["linear"], ["get", property], ...ramp.flatMap((el) => [el.propertyValue, el.value])];
4000
3683
  }
4001
3684
  function dashArrayMaker(pattern) {
4002
3685
  const startTrimmedPattern = pattern.trimStart();
4003
- const fixedPattern = `${startTrimmedPattern}${" ".repeat(
4004
- pattern.length - startTrimmedPattern.length
4005
- )}`;
3686
+ const fixedPattern = `${startTrimmedPattern}${" ".repeat(pattern.length - startTrimmedPattern.length)}`;
4006
3687
  const patternArr = Array.from(fixedPattern);
4007
3688
  const isOnlyDashesAndSpaces = patternArr.every((c) => c === " " || c === "_");
4008
3689
  if (!isOnlyDashesAndSpaces) {
4009
- throw new Error(
4010
- "A dash pattern must be composed only of whitespace and underscore characters."
4011
- );
3690
+ throw new Error("A dash pattern must be composed only of whitespace and underscore characters.");
4012
3691
  }
4013
3692
  const hasBothDashesAndWhitespaces = patternArr.some((c) => c === "_") && patternArr.some((c) => c === " ");
4014
3693
  if (!hasBothDashesAndWhitespaces) {
4015
- throw new Error(
4016
- "A dash pattern must contain at least one underscore and one whitespace character"
4017
- );
3694
+ throw new Error("A dash pattern must contain at least one underscore and one whitespace character");
4018
3695
  }
4019
3696
  const dashArray = [1];
4020
3697
  for (let i = 1; i < patternArr.length; i += 1) {
@@ -4029,111 +3706,46 @@ function dashArrayMaker(pattern) {
4029
3706
  return dashArray;
4030
3707
  }
4031
3708
  function colorDrivenByProperty(style, property) {
4032
- return [
4033
- "interpolate",
4034
- ["linear"],
4035
- ["get", property],
4036
- ...style.map((el) => [el.value, el.color]).flat()
4037
- ];
3709
+ return ["interpolate", ["linear"], ["get", property], ...style.flatMap((el) => [el.value, el.color])];
4038
3710
  }
4039
3711
  function radiusDrivenByProperty(style, property, zoomCompensation = true) {
4040
3712
  if (!zoomCompensation) {
4041
- return [
4042
- "interpolate",
4043
- ["linear"],
4044
- ["get", property],
4045
- ...style.map((el) => [el.value, el.pointRadius]).flat()
4046
- ];
3713
+ return ["interpolate", ["linear"], ["get", property], ...style.flatMap((el) => [el.value, el.pointRadius])];
4047
3714
  }
4048
3715
  return [
4049
3716
  "interpolate",
4050
3717
  ["linear"],
4051
3718
  ["zoom"],
4052
3719
  0,
4053
- [
4054
- "interpolate",
4055
- ["linear"],
4056
- ["get", property],
4057
- ...style.map((el) => [el.value, el.pointRadius * 0.025]).flat()
4058
- ],
3720
+ ["interpolate", ["linear"], ["get", property], ...style.flatMap((el) => [el.value, el.pointRadius * 0.025])],
4059
3721
  2,
4060
- [
4061
- "interpolate",
4062
- ["linear"],
4063
- ["get", property],
4064
- ...style.map((el) => [el.value, el.pointRadius * 0.05]).flat()
4065
- ],
3722
+ ["interpolate", ["linear"], ["get", property], ...style.flatMap((el) => [el.value, el.pointRadius * 0.05])],
4066
3723
  4,
4067
- [
4068
- "interpolate",
4069
- ["linear"],
4070
- ["get", property],
4071
- ...style.map((el) => [el.value, el.pointRadius * 0.1]).flat()
4072
- ],
3724
+ ["interpolate", ["linear"], ["get", property], ...style.flatMap((el) => [el.value, el.pointRadius * 0.1])],
4073
3725
  8,
4074
- [
4075
- "interpolate",
4076
- ["linear"],
4077
- ["get", property],
4078
- ...style.map((el) => [el.value, el.pointRadius * 0.25]).flat()
4079
- ],
3726
+ ["interpolate", ["linear"], ["get", property], ...style.flatMap((el) => [el.value, el.pointRadius * 0.25])],
4080
3727
  16,
4081
- [
4082
- "interpolate",
4083
- ["linear"],
4084
- ["get", property],
4085
- ...style.map((el) => [el.value, el.pointRadius]).flat()
4086
- ]
3728
+ ["interpolate", ["linear"], ["get", property], ...style.flatMap((el) => [el.value, el.pointRadius])]
4087
3729
  ];
4088
3730
  }
4089
3731
  function radiusDrivenByPropertyHeatmap(style, property, zoomCompensation = true) {
4090
3732
  if (!zoomCompensation) {
4091
- return [
4092
- "interpolate",
4093
- ["linear"],
4094
- ["get", property],
4095
- ...style.map((el) => [el.propertyValue, el.value]).flat()
4096
- ];
3733
+ return ["interpolate", ["linear"], ["get", property], ...style.flatMap((el) => [el.propertyValue, el.value])];
4097
3734
  }
4098
3735
  return [
4099
3736
  "interpolate",
4100
3737
  ["linear"],
4101
3738
  ["zoom"],
4102
3739
  0,
4103
- [
4104
- "interpolate",
4105
- ["linear"],
4106
- ["get", property],
4107
- ...style.map((el) => [el.propertyValue, el.value * 0.025]).flat()
4108
- ],
3740
+ ["interpolate", ["linear"], ["get", property], ...style.flatMap((el) => [el.propertyValue, el.value * 0.025])],
4109
3741
  2,
4110
- [
4111
- "interpolate",
4112
- ["linear"],
4113
- ["get", property],
4114
- ...style.map((el) => [el.propertyValue, el.value * 0.05]).flat()
4115
- ],
3742
+ ["interpolate", ["linear"], ["get", property], ...style.flatMap((el) => [el.propertyValue, el.value * 0.05])],
4116
3743
  4,
4117
- [
4118
- "interpolate",
4119
- ["linear"],
4120
- ["get", property],
4121
- ...style.map((el) => [el.propertyValue, el.value * 0.1]).flat()
4122
- ],
3744
+ ["interpolate", ["linear"], ["get", property], ...style.flatMap((el) => [el.propertyValue, el.value * 0.1])],
4123
3745
  8,
4124
- [
4125
- "interpolate",
4126
- ["linear"],
4127
- ["get", property],
4128
- ...style.map((el) => [el.propertyValue, el.value * 0.25]).flat()
4129
- ],
3746
+ ["interpolate", ["linear"], ["get", property], ...style.flatMap((el) => [el.propertyValue, el.value * 0.25])],
4130
3747
  16,
4131
- [
4132
- "interpolate",
4133
- ["linear"],
4134
- ["get", property],
4135
- ...style.map((el) => [el.propertyValue, el.value]).flat()
4136
- ]
3748
+ ["interpolate", ["linear"], ["get", property], ...style.flatMap((el) => [el.propertyValue, el.value])]
4137
3749
  ];
4138
3750
  }
4139
3751
  function opacityDrivenByProperty(colorramp, property) {
@@ -4144,11 +3756,11 @@ function opacityDrivenByProperty(colorramp, property) {
4144
3756
  "interpolate",
4145
3757
  ["linear"],
4146
3758
  ["get", property],
4147
- ...colorramp.getRawColorStops().map((el) => {
3759
+ ...colorramp.getRawColorStops().flatMap((el) => {
4148
3760
  const value = el.value;
4149
3761
  const color = el.color;
4150
3762
  return [value, color.length === 4 ? color[3] / 255 : 1];
4151
- }).flat()
3763
+ })
4152
3764
  ];
4153
3765
  }
4154
3766
  function heatmapIntensityFromColorRamp(colorRamp, steps = 10) {
@@ -4163,92 +3775,42 @@ function heatmapIntensityFromColorRamp(colorRamp, steps = 10) {
4163
3775
  ];
4164
3776
  }
4165
3777
 
4166
- var __defProp = Object.defineProperty;
4167
- var __defProps = Object.defineProperties;
4168
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4169
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
4170
- var __hasOwnProp = Object.prototype.hasOwnProperty;
4171
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
4172
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4173
- var __spreadValues = (a, b) => {
4174
- for (var prop in b || (b = {}))
4175
- if (__hasOwnProp.call(b, prop))
4176
- __defNormalProp(a, prop, b[prop]);
4177
- if (__getOwnPropSymbols)
4178
- for (var prop of __getOwnPropSymbols(b)) {
4179
- if (__propIsEnum.call(b, prop))
4180
- __defNormalProp(a, prop, b[prop]);
4181
- }
4182
- return a;
4183
- };
4184
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
4185
- var __async = (__this, __arguments, generator) => {
4186
- return new Promise((resolve, reject) => {
4187
- var fulfilled = (value) => {
4188
- try {
4189
- step(generator.next(value));
4190
- } catch (e) {
4191
- reject(e);
4192
- }
4193
- };
4194
- var rejected = (value) => {
4195
- try {
4196
- step(generator.throw(value));
4197
- } catch (e) {
4198
- reject(e);
4199
- }
4200
- };
4201
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
4202
- step((generator = generator.apply(__this, __arguments)).next());
4203
- });
4204
- };
4205
- function addPolyline(_0, _1) {
4206
- return __async(this, arguments, function* (map, options, fetchOptions = {}) {
4207
- var _a, _b, _c;
4208
- if (!options.sourceId && !options.data) {
4209
- throw new Error(
4210
- "Creating a polyline layer requires an existing .sourceId or a valid .data property"
4211
- );
3778
+ async function addPolyline(map, options, fetchOptions = {}) {
3779
+ if (!options.sourceId && !options.data) {
3780
+ throw new Error("Creating a polyline layer requires an existing .sourceId or a valid .data property");
3781
+ }
3782
+ let data = options.data;
3783
+ if (typeof data === "string") {
3784
+ if (isUUID(data)) {
3785
+ data = `https://api.maptiler.com/data/${options.data}/features.json?key=${config$1.apiKey}`;
3786
+ } else if (data.split(".").pop()?.toLowerCase().trim() === "gpx") {
3787
+ const res = await fetch(data, fetchOptions);
3788
+ const gpxStr = await res.text();
3789
+ data = gpx(gpxStr);
3790
+ } else if (data.split(".").pop()?.toLowerCase().trim() === "kml") {
3791
+ const res = await fetch(data, fetchOptions);
3792
+ const kmlStr = await res.text();
3793
+ data = kml(kmlStr);
3794
+ } else {
3795
+ const tmpData = jsonParseNoThrow(data) ?? gpxOrKml(data);
3796
+ if (tmpData)
3797
+ data = tmpData;
4212
3798
  }
4213
- let data = options.data;
4214
- if (typeof data === "string") {
4215
- if (isUUID(data)) {
4216
- data = `https://api.maptiler.com/data/${options.data}/features.json?key=${config$1.apiKey}`;
4217
- } else if (((_a = data.split(".").pop()) == null ? void 0 : _a.toLowerCase().trim()) === "gpx") {
4218
- const res = yield fetch(data, fetchOptions);
4219
- const gpxStr = yield res.text();
4220
- data = gpx(gpxStr);
4221
- } else if (((_b = data.split(".").pop()) == null ? void 0 : _b.toLowerCase().trim()) === "kml") {
4222
- const res = yield fetch(data, fetchOptions);
4223
- const kmlStr = yield res.text();
4224
- data = kml(kmlStr);
4225
- } else {
4226
- const tmpData = (_c = jsonParseNoThrow(
4227
- data
4228
- )) != null ? _c : gpxOrKml(data);
4229
- if (tmpData)
4230
- data = tmpData;
4231
- }
4232
- if (!data) {
4233
- throw new Error(
4234
- "Polyline data was provided as string but is incompatible with valid formats."
4235
- );
4236
- }
3799
+ if (!data) {
3800
+ throw new Error("Polyline data was provided as string but is incompatible with valid formats.");
4237
3801
  }
4238
- return addGeoJSONPolyline(map, __spreadProps(__spreadValues({}, options), {
4239
- data
4240
- }));
3802
+ }
3803
+ return addGeoJSONPolyline(map, {
3804
+ ...options,
3805
+ data
4241
3806
  });
4242
3807
  }
4243
3808
  function addGeoJSONPolyline(map, options) {
4244
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
4245
3809
  if (options.layerId && map.getLayer(options.layerId)) {
4246
- throw new Error(
4247
- `A layer already exists with the layer id: ${options.layerId}`
4248
- );
3810
+ throw new Error(`A layer already exists with the layer id: ${options.layerId}`);
4249
3811
  }
4250
- const sourceId = (_a = options.sourceId) != null ? _a : generateRandomSourceName();
4251
- const layerId = (_b = options.layerId) != null ? _b : generateRandomLayerName();
3812
+ const sourceId = options.sourceId ?? generateRandomSourceName();
3813
+ const layerId = options.layerId ?? generateRandomLayerName();
4252
3814
  const returnedInfo = {
4253
3815
  polylineLayerId: layerId,
4254
3816
  polylineOutlineLayerId: "",
@@ -4260,16 +3822,16 @@ function addGeoJSONPolyline(map, options) {
4260
3822
  data: options.data
4261
3823
  });
4262
3824
  }
4263
- const lineWidth = (_c = options.lineWidth) != null ? _c : 3;
4264
- const lineColor = (_d = options.lineColor) != null ? _d : getRandomColor();
4265
- const lineOpacity = (_e = options.lineOpacity) != null ? _e : 1;
4266
- const lineBlur = (_f = options.lineBlur) != null ? _f : 0;
4267
- const lineGapWidth = (_g = options.lineGapWidth) != null ? _g : 0;
4268
- let lineDashArray = (_h = options.lineDashArray) != null ? _h : null;
4269
- const outlineWidth = (_i = options.outlineWidth) != null ? _i : 1;
4270
- const outlineColor = (_j = options.outlineColor) != null ? _j : "#FFFFFF";
4271
- const outlineOpacity = (_k = options.outlineOpacity) != null ? _k : 1;
4272
- const outlineBlur = (_l = options.outlineBlur) != null ? _l : 0;
3825
+ const lineWidth = options.lineWidth ?? 3;
3826
+ const lineColor = options.lineColor ?? getRandomColor();
3827
+ const lineOpacity = options.lineOpacity ?? 1;
3828
+ const lineBlur = options.lineBlur ?? 0;
3829
+ const lineGapWidth = options.lineGapWidth ?? 0;
3830
+ let lineDashArray = options.lineDashArray ?? null;
3831
+ const outlineWidth = options.outlineWidth ?? 1;
3832
+ const outlineColor = options.outlineColor ?? "#FFFFFF";
3833
+ const outlineOpacity = options.outlineOpacity ?? 1;
3834
+ const outlineBlur = options.outlineBlur ?? 0;
4273
3835
  if (typeof lineDashArray === "string") {
4274
3836
  lineDashArray = dashArrayMaker(lineDashArray);
4275
3837
  }
@@ -4282,11 +3844,11 @@ function addGeoJSONPolyline(map, options) {
4282
3844
  type: "line",
4283
3845
  source: sourceId,
4284
3846
  layout: {
4285
- "line-join": (_m = options.lineJoin) != null ? _m : "round",
4286
- "line-cap": (_n = options.lineCap) != null ? _n : "round"
3847
+ "line-join": options.lineJoin ?? "round",
3848
+ "line-cap": options.lineCap ?? "round"
4287
3849
  },
4288
- minzoom: (_o = options.minzoom) != null ? _o : 0,
4289
- maxzoom: (_p = options.maxzoom) != null ? _p : 23,
3850
+ minzoom: options.minzoom ?? 0,
3851
+ maxzoom: options.maxzoom ?? 23,
4290
3852
  paint: {
4291
3853
  "line-opacity": typeof outlineOpacity === "number" ? outlineOpacity : rampedOptionsToLayerPaintSpec(outlineOpacity),
4292
3854
  "line-color": typeof outlineColor === "string" ? outlineColor : paintColorOptionsToPaintSpec(outlineColor),
@@ -4303,32 +3865,35 @@ function addGeoJSONPolyline(map, options) {
4303
3865
  type: "line",
4304
3866
  source: sourceId,
4305
3867
  layout: {
4306
- "line-join": (_q = options.lineJoin) != null ? _q : "round",
4307
- "line-cap": (_r = options.lineCap) != null ? _r : "round"
3868
+ "line-join": options.lineJoin ?? "round",
3869
+ "line-cap": options.lineCap ?? "round"
4308
3870
  },
4309
- minzoom: (_s = options.minzoom) != null ? _s : 0,
4310
- maxzoom: (_t = options.maxzoom) != null ? _t : 23,
4311
- paint: __spreadValues({
3871
+ minzoom: options.minzoom ?? 0,
3872
+ maxzoom: options.maxzoom ?? 23,
3873
+ paint: {
4312
3874
  "line-opacity": typeof lineOpacity === "number" ? lineOpacity : rampedOptionsToLayerPaintSpec(lineOpacity),
4313
3875
  "line-color": typeof lineColor === "string" ? lineColor : paintColorOptionsToPaintSpec(lineColor),
4314
3876
  "line-width": typeof lineWidth === "number" ? lineWidth : rampedOptionsToLayerPaintSpec(lineWidth),
4315
3877
  "line-blur": typeof lineBlur === "number" ? lineBlur : rampedOptionsToLayerPaintSpec(lineBlur),
4316
- "line-gap-width": typeof lineGapWidth === "number" ? lineGapWidth : rampedOptionsToLayerPaintSpec(lineGapWidth)
4317
- }, lineDashArray && { "line-dasharray": lineDashArray })
3878
+ "line-gap-width": typeof lineGapWidth === "number" ? lineGapWidth : rampedOptionsToLayerPaintSpec(lineGapWidth),
3879
+ // For some reasons passing "line-dasharray" with the value "undefined"
3880
+ // results in no showing the line while it should have the same behavior
3881
+ // of not adding the property "line-dasharray" as all.
3882
+ // As a workaround, we are inlining the addition of the prop with a conditional
3883
+ // which is less readable.
3884
+ ...lineDashArray && { "line-dasharray": lineDashArray }
3885
+ }
4318
3886
  },
4319
3887
  options.beforeId
4320
3888
  );
4321
3889
  return returnedInfo;
4322
3890
  }
4323
3891
  function addPolygon(map, options) {
4324
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
4325
3892
  if (options.layerId && map.getLayer(options.layerId)) {
4326
- throw new Error(
4327
- `A layer already exists with the layer id: ${options.layerId}`
4328
- );
3893
+ throw new Error(`A layer already exists with the layer id: ${options.layerId}`);
4329
3894
  }
4330
- const sourceId = (_a = options.sourceId) != null ? _a : generateRandomSourceName();
4331
- const layerId = (_b = options.layerId) != null ? _b : generateRandomLayerName();
3895
+ const sourceId = options.sourceId ?? generateRandomSourceName();
3896
+ const layerId = options.layerId ?? generateRandomLayerName();
4332
3897
  const returnedInfo = {
4333
3898
  polygonLayerId: layerId,
4334
3899
  polygonOutlineLayerId: options.outline ? `${layerId}_outline` : "",
@@ -4344,31 +3909,32 @@ function addPolygon(map, options) {
4344
3909
  data
4345
3910
  });
4346
3911
  }
4347
- let outlineDashArray = (_c = options.outlineDashArray) != null ? _c : null;
4348
- const outlineWidth = (_d = options.outlineWidth) != null ? _d : 1;
4349
- const outlineColor = (_e = options.outlineColor) != null ? _e : "#FFFFFF";
4350
- const outlineOpacity = (_f = options.outlineOpacity) != null ? _f : 1;
4351
- const outlineBlur = (_g = options.outlineBlur) != null ? _g : 0;
4352
- const fillColor = (_h = options.fillColor) != null ? _h : getRandomColor();
4353
- const fillOpacity = (_i = options.fillOpacity) != null ? _i : 1;
4354
- const outlinePosition = (_j = options.outlinePosition) != null ? _j : "center";
4355
- const pattern = (_k = options.pattern) != null ? _k : null;
3912
+ let outlineDashArray = options.outlineDashArray ?? null;
3913
+ const outlineWidth = options.outlineWidth ?? 1;
3914
+ const outlineColor = options.outlineColor ?? "#FFFFFF";
3915
+ const outlineOpacity = options.outlineOpacity ?? 1;
3916
+ const outlineBlur = options.outlineBlur ?? 0;
3917
+ const fillColor = options.fillColor ?? getRandomColor();
3918
+ const fillOpacity = options.fillOpacity ?? 1;
3919
+ const outlinePosition = options.outlinePosition ?? "center";
3920
+ const pattern = options.pattern ?? null;
4356
3921
  if (typeof outlineDashArray === "string") {
4357
3922
  outlineDashArray = dashArrayMaker(outlineDashArray);
4358
3923
  }
4359
3924
  const addLayers = (patternImageId = null) => {
4360
- var _a2, _b2, _c2, _d2, _e2, _f2;
4361
3925
  map.addLayer(
4362
3926
  {
4363
3927
  id: layerId,
4364
3928
  type: "fill",
4365
3929
  source: sourceId,
4366
- minzoom: (_a2 = options.minzoom) != null ? _a2 : 0,
4367
- maxzoom: (_b2 = options.maxzoom) != null ? _b2 : 23,
4368
- paint: __spreadValues({
3930
+ minzoom: options.minzoom ?? 0,
3931
+ maxzoom: options.maxzoom ?? 23,
3932
+ paint: {
4369
3933
  "fill-color": typeof fillColor === "string" ? fillColor : paintColorOptionsToPaintSpec(fillColor),
4370
- "fill-opacity": typeof fillOpacity === "number" ? fillOpacity : rampedOptionsToLayerPaintSpec(fillOpacity)
4371
- }, patternImageId && { "fill-pattern": patternImageId })
3934
+ "fill-opacity": typeof fillOpacity === "number" ? fillOpacity : rampedOptionsToLayerPaintSpec(fillOpacity),
3935
+ // Adding a pattern if provided
3936
+ ...patternImageId && { "fill-pattern": patternImageId }
3937
+ }
4372
3938
  },
4373
3939
  options.beforeId
4374
3940
  );
@@ -4405,20 +3971,26 @@ function addPolygon(map, options) {
4405
3971
  type: "line",
4406
3972
  source: sourceId,
4407
3973
  layout: {
4408
- "line-join": (_c2 = options.outlineJoin) != null ? _c2 : "round",
4409
- "line-cap": (_d2 = options.outlineCap) != null ? _d2 : "butt"
3974
+ "line-join": options.outlineJoin ?? "round",
3975
+ "line-cap": options.outlineCap ?? "butt"
4410
3976
  },
4411
- minzoom: (_e2 = options.minzoom) != null ? _e2 : 0,
4412
- maxzoom: (_f2 = options.maxzoom) != null ? _f2 : 23,
4413
- paint: __spreadValues({
3977
+ minzoom: options.minzoom ?? 0,
3978
+ maxzoom: options.maxzoom ?? 23,
3979
+ paint: {
4414
3980
  "line-opacity": typeof outlineOpacity === "number" ? outlineOpacity : rampedOptionsToLayerPaintSpec(outlineOpacity),
4415
3981
  "line-color": typeof outlineColor === "string" ? outlineColor : paintColorOptionsToPaintSpec(outlineColor),
4416
3982
  "line-width": typeof outlineWidth === "number" ? outlineWidth : rampedOptionsToLayerPaintSpec(outlineWidth),
4417
3983
  "line-blur": typeof outlineBlur === "number" ? outlineBlur : rampedOptionsToLayerPaintSpec(outlineBlur),
4418
- "line-offset": computedOutlineOffset
4419
- }, outlineDashArray && {
4420
- "line-dasharray": outlineDashArray
4421
- })
3984
+ "line-offset": computedOutlineOffset,
3985
+ // For some reasons passing "line-dasharray" with the value "undefined"
3986
+ // results in no showing the line while it should have the same behavior
3987
+ // of not adding the property "line-dasharray" as all.
3988
+ // As a workaround, we are inlining the addition of the prop with a conditional
3989
+ // which is less readable.
3990
+ ...outlineDashArray && {
3991
+ "line-dasharray": outlineDashArray
3992
+ }
3993
+ }
4422
3994
  },
4423
3995
  options.beforeId
4424
3996
  );
@@ -4442,33 +4014,27 @@ function addPolygon(map, options) {
4442
4014
  return returnedInfo;
4443
4015
  }
4444
4016
  function addPoint(map, options) {
4445
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
4446
4017
  if (options.layerId && map.getLayer(options.layerId)) {
4447
- throw new Error(
4448
- `A layer already exists with the layer id: ${options.layerId}`
4449
- );
4018
+ throw new Error(`A layer already exists with the layer id: ${options.layerId}`);
4450
4019
  }
4451
- const minPointRadius = (_a = options.minPointRadius) != null ? _a : 10;
4452
- const maxPointRadius = (_b = options.maxPointRadius) != null ? _b : 50;
4453
- const cluster = (_c = options.cluster) != null ? _c : false;
4020
+ const minPointRadius = options.minPointRadius ?? 10;
4021
+ const maxPointRadius = options.maxPointRadius ?? 50;
4022
+ const cluster = options.cluster ?? false;
4454
4023
  const nbDefaultDataDrivenStyleSteps = 20;
4455
- const colorramp = Array.isArray(options.pointColor) ? options.pointColor : ColorRampCollection.TURBO.scale(
4456
- 10,
4457
- options.cluster ? 1e4 : 1e3
4458
- ).resample("ease-out-square");
4024
+ const colorramp = Array.isArray(options.pointColor) ? options.pointColor : ColorRampCollection.TURBO.scale(10, options.cluster ? 1e4 : 1e3).resample("ease-out-square");
4459
4025
  const colorRampBounds = colorramp.getBounds();
4460
- const sourceId = (_d = options.sourceId) != null ? _d : generateRandomSourceName();
4461
- const layerId = (_e = options.layerId) != null ? _e : generateRandomLayerName();
4462
- const showLabel = (_f = options.showLabel) != null ? _f : cluster;
4463
- const alignOnViewport = (_g = options.alignOnViewport) != null ? _g : true;
4464
- const outline = (_h = options.outline) != null ? _h : false;
4465
- const outlineOpacity = (_i = options.outlineOpacity) != null ? _i : 1;
4466
- const outlineWidth = (_j = options.outlineWidth) != null ? _j : 1;
4467
- const outlineColor = (_k = options.outlineColor) != null ? _k : "#FFFFFF";
4026
+ const sourceId = options.sourceId ?? generateRandomSourceName();
4027
+ const layerId = options.layerId ?? generateRandomLayerName();
4028
+ const showLabel = options.showLabel ?? cluster;
4029
+ const alignOnViewport = options.alignOnViewport ?? true;
4030
+ const outline = options.outline ?? false;
4031
+ const outlineOpacity = options.outlineOpacity ?? 1;
4032
+ const outlineWidth = options.outlineWidth ?? 1;
4033
+ const outlineColor = options.outlineColor ?? "#FFFFFF";
4468
4034
  let pointOpacity;
4469
- const zoomCompensation = (_l = options.zoomCompensation) != null ? _l : true;
4470
- const minzoom = (_m = options.minzoom) != null ? _m : 0;
4471
- const maxzoom = (_n = options.maxzoom) != null ? _n : 23;
4035
+ const zoomCompensation = options.zoomCompensation ?? true;
4036
+ const minzoom = options.minzoom ?? 0;
4037
+ const maxzoom = options.maxzoom ?? 23;
4472
4038
  if (typeof options.pointOpacity === "number") {
4473
4039
  pointOpacity = options.pointOpacity;
4474
4040
  } else if (Array.isArray(options.pointOpacity)) {
@@ -4504,36 +4070,34 @@ function addPoint(map, options) {
4504
4070
  }
4505
4071
  if (cluster) {
4506
4072
  returnedInfo.clusterLayerId = `${layerId}_cluster`;
4507
- const clusterStyle = Array.from(
4508
- { length: nbDefaultDataDrivenStyleSteps },
4509
- (_, i) => {
4510
- const value = colorRampBounds.min + i * (colorRampBounds.max - colorRampBounds.min) / (nbDefaultDataDrivenStyleSteps - 1);
4511
- return {
4512
- value,
4513
- pointRadius: minPointRadius + (maxPointRadius - minPointRadius) * Math.pow(i / (nbDefaultDataDrivenStyleSteps - 1), 0.5),
4514
- color: colorramp.getColorHex(value)
4515
- };
4516
- }
4517
- );
4073
+ const clusterStyle = Array.from({ length: nbDefaultDataDrivenStyleSteps }, (_, i) => {
4074
+ const value = colorRampBounds.min + i * (colorRampBounds.max - colorRampBounds.min) / (nbDefaultDataDrivenStyleSteps - 1);
4075
+ return {
4076
+ value,
4077
+ pointRadius: minPointRadius + (maxPointRadius - minPointRadius) * (i / (nbDefaultDataDrivenStyleSteps - 1)) ** 0.5,
4078
+ color: colorramp.getColorHex(value)
4079
+ };
4080
+ });
4518
4081
  map.addLayer(
4519
4082
  {
4520
4083
  id: returnedInfo.clusterLayerId,
4521
4084
  type: "circle",
4522
4085
  source: sourceId,
4523
4086
  filter: ["has", "point_count"],
4524
- paint: __spreadValues({
4087
+ paint: {
4525
4088
  // 'circle-color': options.pointColor ?? colorDrivenByProperty(clusterStyle, "point_count"),
4526
4089
  "circle-color": typeof options.pointColor === "string" ? options.pointColor : colorDrivenByProperty(clusterStyle, "point_count"),
4527
4090
  "circle-radius": typeof options.pointRadius === "number" ? options.pointRadius : Array.isArray(options.pointRadius) ? rampedOptionsToLayerPaintSpec(options.pointRadius) : radiusDrivenByProperty(clusterStyle, "point_count", false),
4528
4091
  "circle-pitch-alignment": alignOnViewport ? "viewport" : "map",
4529
4092
  "circle-pitch-scale": "map",
4530
4093
  // scale with camera distance regardless of viewport/biewport alignement
4531
- "circle-opacity": pointOpacity
4532
- }, outline && {
4533
- "circle-stroke-opacity": typeof outlineOpacity === "number" ? outlineOpacity : rampedOptionsToLayerPaintSpec(outlineOpacity),
4534
- "circle-stroke-width": typeof outlineWidth === "number" ? outlineWidth : rampedOptionsToLayerPaintSpec(outlineWidth),
4535
- "circle-stroke-color": typeof outlineColor === "string" ? outlineColor : paintColorOptionsToPaintSpec(outlineColor)
4536
- }),
4094
+ "circle-opacity": pointOpacity,
4095
+ ...outline && {
4096
+ "circle-stroke-opacity": typeof outlineOpacity === "number" ? outlineOpacity : rampedOptionsToLayerPaintSpec(outlineOpacity),
4097
+ "circle-stroke-width": typeof outlineWidth === "number" ? outlineWidth : rampedOptionsToLayerPaintSpec(outlineWidth),
4098
+ "circle-stroke-color": typeof outlineColor === "string" ? outlineColor : paintColorOptionsToPaintSpec(outlineColor)
4099
+ }
4100
+ },
4537
4101
  minzoom,
4538
4102
  maxzoom
4539
4103
  },
@@ -4545,19 +4109,20 @@ function addPoint(map, options) {
4545
4109
  type: "circle",
4546
4110
  source: sourceId,
4547
4111
  filter: ["!", ["has", "point_count"]],
4548
- paint: __spreadValues({
4112
+ paint: {
4549
4113
  "circle-pitch-alignment": alignOnViewport ? "viewport" : "map",
4550
4114
  "circle-pitch-scale": "map",
4551
4115
  // scale with camera distance regardless of viewport/biewport alignement
4552
4116
  // 'circle-color': options.pointColor ?? clusterStyle[0].color,
4553
4117
  "circle-color": typeof options.pointColor === "string" ? options.pointColor : colorramp.getColorHex(colorramp.getBounds().min),
4554
4118
  "circle-radius": typeof options.pointRadius === "number" ? options.pointRadius : Array.isArray(options.pointRadius) ? rampedOptionsToLayerPaintSpec(options.pointRadius) : clusterStyle[0].pointRadius * 0.75,
4555
- "circle-opacity": pointOpacity
4556
- }, outline && {
4557
- "circle-stroke-opacity": typeof outlineOpacity === "number" ? outlineOpacity : rampedOptionsToLayerPaintSpec(outlineOpacity),
4558
- "circle-stroke-width": typeof outlineWidth === "number" ? outlineWidth : rampedOptionsToLayerPaintSpec(outlineWidth),
4559
- "circle-stroke-color": typeof outlineColor === "string" ? outlineColor : paintColorOptionsToPaintSpec(outlineColor)
4560
- }),
4119
+ "circle-opacity": pointOpacity,
4120
+ ...outline && {
4121
+ "circle-stroke-opacity": typeof outlineOpacity === "number" ? outlineOpacity : rampedOptionsToLayerPaintSpec(outlineOpacity),
4122
+ "circle-stroke-width": typeof outlineWidth === "number" ? outlineWidth : rampedOptionsToLayerPaintSpec(outlineWidth),
4123
+ "circle-stroke-color": typeof outlineColor === "string" ? outlineColor : paintColorOptionsToPaintSpec(outlineColor)
4124
+ }
4125
+ },
4561
4126
  minzoom,
4562
4127
  maxzoom
4563
4128
  },
@@ -4579,23 +4144,16 @@ function addPoint(map, options) {
4579
4144
  { zoom: 16, value: minPointRadius * 1 }
4580
4145
  ]) : minPointRadius;
4581
4146
  if (options.property && Array.isArray(options.pointColor)) {
4582
- const dataDrivenStyle = Array.from(
4583
- { length: nbDefaultDataDrivenStyleSteps },
4584
- (_, i) => {
4585
- const value = colorRampBounds.min + i * (colorRampBounds.max - colorRampBounds.min) / (nbDefaultDataDrivenStyleSteps - 1);
4586
- return {
4587
- value,
4588
- pointRadius: typeof options.pointRadius === "number" ? options.pointRadius : minPointRadius + (maxPointRadius - minPointRadius) * Math.pow(i / (nbDefaultDataDrivenStyleSteps - 1), 0.5),
4589
- color: typeof options.pointColor === "string" ? options.pointColor : colorramp.getColorHex(value)
4590
- };
4591
- }
4592
- );
4147
+ const dataDrivenStyle = Array.from({ length: nbDefaultDataDrivenStyleSteps }, (_, i) => {
4148
+ const value = colorRampBounds.min + i * (colorRampBounds.max - colorRampBounds.min) / (nbDefaultDataDrivenStyleSteps - 1);
4149
+ return {
4150
+ value,
4151
+ pointRadius: typeof options.pointRadius === "number" ? options.pointRadius : minPointRadius + (maxPointRadius - minPointRadius) * (i / (nbDefaultDataDrivenStyleSteps - 1)) ** 0.5,
4152
+ color: typeof options.pointColor === "string" ? options.pointColor : colorramp.getColorHex(value)
4153
+ };
4154
+ });
4593
4155
  pointColor = colorDrivenByProperty(dataDrivenStyle, options.property);
4594
- pointRadius = radiusDrivenByProperty(
4595
- dataDrivenStyle,
4596
- options.property,
4597
- zoomCompensation
4598
- );
4156
+ pointRadius = radiusDrivenByProperty(dataDrivenStyle, options.property, zoomCompensation);
4599
4157
  }
4600
4158
  map.addLayer(
4601
4159
  {
@@ -4606,18 +4164,19 @@ function addPoint(map, options) {
4606
4164
  // Contrary to labels, we want to see the small one in front. Weirdly "circle-sort-key" works in the opposite direction as "symbol-sort-key".
4607
4165
  "circle-sort-key": options.property ? ["/", 1, ["get", options.property]] : 0
4608
4166
  },
4609
- paint: __spreadValues({
4167
+ paint: {
4610
4168
  "circle-pitch-alignment": alignOnViewport ? "viewport" : "map",
4611
4169
  "circle-pitch-scale": "map",
4612
4170
  // scale with camera distance regardless of viewport/biewport alignement
4613
4171
  "circle-color": pointColor,
4614
4172
  "circle-opacity": pointOpacity,
4615
- "circle-radius": pointRadius
4616
- }, outline && {
4617
- "circle-stroke-opacity": typeof outlineOpacity === "number" ? outlineOpacity : rampedOptionsToLayerPaintSpec(outlineOpacity),
4618
- "circle-stroke-width": typeof outlineWidth === "number" ? outlineWidth : rampedOptionsToLayerPaintSpec(outlineWidth),
4619
- "circle-stroke-color": typeof outlineColor === "string" ? outlineColor : paintColorOptionsToPaintSpec(outlineColor)
4620
- }),
4173
+ "circle-radius": pointRadius,
4174
+ ...outline && {
4175
+ "circle-stroke-opacity": typeof outlineOpacity === "number" ? outlineOpacity : rampedOptionsToLayerPaintSpec(outlineOpacity),
4176
+ "circle-stroke-width": typeof outlineWidth === "number" ? outlineWidth : rampedOptionsToLayerPaintSpec(outlineWidth),
4177
+ "circle-stroke-color": typeof outlineColor === "string" ? outlineColor : paintColorOptionsToPaintSpec(outlineColor)
4178
+ }
4179
+ },
4621
4180
  minzoom,
4622
4181
  maxzoom
4623
4182
  },
@@ -4626,30 +4185,20 @@ function addPoint(map, options) {
4626
4185
  }
4627
4186
  if (showLabel !== false && (options.cluster || options.property)) {
4628
4187
  returnedInfo.labelLayerId = `${layerId}_label`;
4629
- const labelColor = (_o = options.labelColor) != null ? _o : "#fff";
4630
- const labelSize = (_p = options.labelSize) != null ? _p : 12;
4188
+ const labelColor = options.labelColor ?? "#fff";
4189
+ const labelSize = options.labelSize ?? 12;
4631
4190
  map.addLayer(
4632
4191
  {
4633
4192
  id: returnedInfo.labelLayerId,
4634
4193
  type: "symbol",
4635
4194
  source: sourceId,
4636
- filter: [
4637
- "has",
4638
- options.cluster ? "point_count" : options.property
4639
- ],
4195
+ filter: ["has", options.cluster ? "point_count" : options.property],
4640
4196
  layout: {
4641
4197
  "text-field": options.cluster ? "{point_count_abbreviated}" : `{${options.property}}`,
4642
4198
  "text-font": ["Noto Sans Regular"],
4643
4199
  "text-size": labelSize,
4644
4200
  "text-pitch-alignment": alignOnViewport ? "viewport" : "map",
4645
- "symbol-sort-key": [
4646
- "/",
4647
- 1,
4648
- [
4649
- "get",
4650
- options.cluster ? "point_count" : options.property
4651
- ]
4652
- ]
4201
+ "symbol-sort-key": ["/", 1, ["get", options.cluster ? "point_count" : options.property]]
4653
4202
  // so that the largest value goes on top
4654
4203
  },
4655
4204
  paint: {
@@ -4665,18 +4214,15 @@ function addPoint(map, options) {
4665
4214
  return returnedInfo;
4666
4215
  }
4667
4216
  function addHeatmap(map, options) {
4668
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
4669
4217
  if (options.layerId && map.getLayer(options.layerId)) {
4670
- throw new Error(
4671
- `A layer already exists with the layer id: ${options.layerId}`
4672
- );
4673
- }
4674
- const sourceId = (_a = options.sourceId) != null ? _a : generateRandomSourceName();
4675
- const layerId = (_b = options.layerId) != null ? _b : generateRandomLayerName();
4676
- const minzoom = (_c = options.minzoom) != null ? _c : 0;
4677
- const maxzoom = (_d = options.maxzoom) != null ? _d : 23;
4678
- const zoomCompensation = (_e = options.zoomCompensation) != null ? _e : true;
4679
- const opacity = (_f = options.opacity) != null ? _f : [
4218
+ throw new Error(`A layer already exists with the layer id: ${options.layerId}`);
4219
+ }
4220
+ const sourceId = options.sourceId ?? generateRandomSourceName();
4221
+ const layerId = options.layerId ?? generateRandomLayerName();
4222
+ const minzoom = options.minzoom ?? 0;
4223
+ const maxzoom = options.maxzoom ?? 23;
4224
+ const zoomCompensation = options.zoomCompensation ?? true;
4225
+ const opacity = options.opacity ?? [
4680
4226
  { zoom: minzoom, value: 0 },
4681
4227
  { zoom: minzoom + 0.25, value: 1 },
4682
4228
  { zoom: maxzoom - 0.25, value: 1 },
@@ -4690,13 +4236,13 @@ function addHeatmap(map, options) {
4690
4236
  if (!colorRamp.hasTransparentStart()) {
4691
4237
  colorRamp = colorRamp.transparentStart();
4692
4238
  }
4693
- const intensity = (_g = options.intensity) != null ? _g : [
4239
+ const intensity = options.intensity ?? [
4694
4240
  { zoom: 0, value: 0.01 },
4695
4241
  { zoom: 4, value: 0.2 },
4696
4242
  { zoom: 16, value: 1 }
4697
4243
  ];
4698
- const property = (_h = options.property) != null ? _h : null;
4699
- const propertyValueWeight = (_i = options.weight) != null ? _i : 1;
4244
+ const property = options.property ?? null;
4245
+ const propertyValueWeight = options.weight ?? 1;
4700
4246
  let heatmapWeight = 1;
4701
4247
  if (property) {
4702
4248
  if (typeof propertyValueWeight === "number") {
@@ -4717,9 +4263,7 @@ function addHeatmap(map, options) {
4717
4263
  if (typeof propertyValueWeight === "number") {
4718
4264
  heatmapWeight = propertyValueWeight;
4719
4265
  } else if (Array.isArray(propertyValueWeight)) {
4720
- console.warn(
4721
- "The options `.propertyValueWeights` can only be used when `.property` is provided."
4722
- );
4266
+ console.warn("The options `.propertyValueWeights` can only be used when `.property` is provided.");
4723
4267
  }
4724
4268
  }
4725
4269
  const defaultRadiusZoomRamping = [
@@ -4729,29 +4273,19 @@ function addHeatmap(map, options) {
4729
4273
  { zoom: 8, value: 50 * 0.25 },
4730
4274
  { zoom: 16, value: 50 }
4731
4275
  ];
4732
- const radius = (_j = options.radius) != null ? _j : zoomCompensation ? defaultRadiusZoomRamping : 10;
4276
+ const radius = options.radius ?? (zoomCompensation ? defaultRadiusZoomRamping : 10);
4733
4277
  let radiusHeatmap = 1;
4734
4278
  if (typeof radius === "number") {
4735
4279
  radiusHeatmap = radius;
4736
4280
  } else if (Array.isArray(radius) && "zoom" in radius[0]) {
4737
4281
  radiusHeatmap = rampedOptionsToLayerPaintSpec(radius);
4738
4282
  } else if (property && Array.isArray(radius) && "propertyValue" in radius[0]) {
4739
- radiusHeatmap = radiusDrivenByPropertyHeatmap(
4740
- radius,
4741
- property,
4742
- zoomCompensation
4743
- );
4283
+ radiusHeatmap = radiusDrivenByPropertyHeatmap(radius, property, zoomCompensation);
4744
4284
  } else if (!property && Array.isArray(radius) && "propertyValue" in radius[0]) {
4745
- radiusHeatmap = rampedOptionsToLayerPaintSpec(
4746
- defaultRadiusZoomRamping
4747
- );
4748
- console.warn(
4749
- "The option `.radius` can only be property-driven if the option `.property` is provided."
4750
- );
4285
+ radiusHeatmap = rampedOptionsToLayerPaintSpec(defaultRadiusZoomRamping);
4286
+ console.warn("The option `.radius` can only be property-driven if the option `.property` is provided.");
4751
4287
  } else {
4752
- radiusHeatmap = rampedOptionsToLayerPaintSpec(
4753
- defaultRadiusZoomRamping
4754
- );
4288
+ radiusHeatmap = rampedOptionsToLayerPaintSpec(defaultRadiusZoomRamping);
4755
4289
  }
4756
4290
  const returnedInfo = {
4757
4291
  heatmapLayerId: layerId,
@@ -4775,14 +4309,10 @@ function addHeatmap(map, options) {
4775
4309
  maxzoom,
4776
4310
  paint: {
4777
4311
  "heatmap-weight": heatmapWeight,
4778
- "heatmap-intensity": typeof intensity === "number" ? intensity : rampedOptionsToLayerPaintSpec(
4779
- intensity
4780
- ),
4312
+ "heatmap-intensity": typeof intensity === "number" ? intensity : rampedOptionsToLayerPaintSpec(intensity),
4781
4313
  "heatmap-color": heatmapIntensityFromColorRamp(colorRamp),
4782
4314
  "heatmap-radius": radiusHeatmap,
4783
- "heatmap-opacity": typeof opacity === "number" ? opacity : rampedOptionsToLayerPaintSpec(
4784
- opacity
4785
- )
4315
+ "heatmap-opacity": typeof opacity === "number" ? opacity : rampedOptionsToLayerPaintSpec(opacity)
4786
4316
  }
4787
4317
  });
4788
4318
  return returnedInfo;
@@ -4837,12 +4367,12 @@ const MapMLGL = maplibregl.Map;
4837
4367
  const MarkerMLGL = maplibregl.Marker;
4838
4368
  const PopupMLGL = maplibregl.Popup;
4839
4369
  const StyleMLGL = maplibregl.Style;
4840
- const CanvasSourceMLGL = maplibregl.CanvasSource;
4841
- const GeoJSONSourceMLGL = maplibregl.GeoJSONSource;
4370
+ maplibregl.CanvasSource;
4371
+ maplibregl.GeoJSONSource;
4842
4372
  const ImageSourceMLGL = maplibregl.ImageSource;
4843
4373
  const RasterTileSourceMLGL = maplibregl.RasterTileSource;
4844
- const RasterDEMTileSourceMLGL = maplibregl.RasterDEMTileSource;
4845
- const VectorTileSourceMLGL = maplibregl.VectorTileSource;
4374
+ maplibregl.RasterDEMTileSource;
4375
+ maplibregl.VectorTileSource;
4846
4376
  const VideoSourceMLGL = maplibregl.VideoSource;
4847
4377
  maplibregl.NavigationControl;
4848
4378
  maplibregl.GeolocateControl;
@@ -4856,9 +4386,9 @@ const ScrollZoomHandlerMLGL = maplibregl.ScrollZoomHandler;
4856
4386
  const CooperativeGesturesHandlerMLGL = maplibregl.CooperativeGesturesHandler;
4857
4387
  const KeyboardHandlerMLGL = maplibregl.KeyboardHandler;
4858
4388
  const TwoFingersTouchPitchHandlerMLGL = maplibregl.TwoFingersTouchPitchHandler;
4859
- const MapWheelEventMLGL = maplibregl.MapWheelEvent;
4860
- const MapTouchEventMLGL = maplibregl.MapTouchEvent;
4861
- const MapMouseEventMLGL = maplibregl.MapMouseEvent;
4389
+ maplibregl.MapWheelEvent;
4390
+ maplibregl.MapTouchEvent;
4391
+ maplibregl.MapMouseEvent;
4862
4392
 
4863
- export { AJAXError, AttributionControl, BoxZoomHandler, BoxZoomHandlerMLGL, CanvasSource, CanvasSourceMLGL, ColorRamp, ColorRampCollection, CooperativeGesturesHandler, CooperativeGesturesHandlerMLGL, DoubleClickZoomHandler, DragPanHandler, DragRotateHandler, EdgeInsets, Evented, FullscreenControl, GeoJSONSource, GeoJSONSourceMLGL, GeolocateControl, GeolocationType, Hash, ImageSource, ImageSourceMLGL, KeyboardHandler, KeyboardHandlerMLGL, Language, LngLat, LngLatBounds, LogoControl, Map, MapMLGL, MapMouseEvent, MapMouseEventMLGL, MapTouchEvent, MapTouchEventMLGL, MapWheelEvent, MapWheelEventMLGL, MaptilerGeolocateControl, MaptilerLogoControl, MaptilerNavigationControl, MaptilerTerrainControl, Marker, MarkerMLGL, MercatorCoordinate, NavigationControl, Point, Popup, PopupMLGL, RasterDEMTileSource, RasterDEMTileSourceMLGL, RasterTileSource, RasterTileSourceMLGL, ScaleControl, ScrollZoomHandler, ScrollZoomHandlerMLGL, SdkConfig, Style, StyleMLGL, TerrainControl, TwoFingersTouchPitchHandler, TwoFingersTouchPitchHandlerMLGL, TwoFingersTouchRotateHandler, TwoFingersTouchZoomHandler, TwoFingersTouchZoomRotateHandler, VectorTileSource, VectorTileSourceMLGL, VideoSource, VideoSourceMLGL, addProtocol, addSourceType, clearPrewarmedResources, config$1 as config, config as configMLGL, getBrowserLanguage, getMapLibreVersion, getMaxParallelImageRequests, getRTLTextPluginStatus, getVersion, getWorkerCount, getWorkerUrl, gpx, gpxOrKml, hasChildNodeWithName, helpers, importScriptInWorkers, isLanguageSupported, kml, prewarm, removeProtocol, setMaxParallelImageRequests, setRTLTextPlugin, setWorkerCount, setWorkerUrl, str2xml, xml2str };
4393
+ export { AttributionControl, BoxZoomHandler, BoxZoomHandlerMLGL, CanvasSource, ColorRamp, ColorRampCollection, CooperativeGesturesHandler, CooperativeGesturesHandlerMLGL, DoubleClickZoomHandler, DragPanHandler, DragRotateHandler, EdgeInsets, Evented, FullscreenControl, GeoJSONSource, GeolocateControl, GeolocationType, Hash, ImageSource, ImageSourceMLGL, KeyboardHandler, KeyboardHandlerMLGL, Language, LngLat, LngLatBounds, LogoControl, Map, MapMLGL, MapMouseEvent, MapTouchEvent, MapWheelEvent, MaptilerGeolocateControl, MaptilerLogoControl, MaptilerNavigationControl, MaptilerTerrainControl, Marker, MarkerMLGL, MercatorCoordinate, NavigationControl, Point, Popup, PopupMLGL, RasterDEMTileSource, RasterTileSource, RasterTileSourceMLGL, ScaleControl, ScrollZoomHandler, ScrollZoomHandlerMLGL, SdkConfig, Style, StyleMLGL, TerrainControl, TwoFingersTouchPitchHandler, TwoFingersTouchPitchHandlerMLGL, TwoFingersTouchRotateHandler, TwoFingersTouchZoomHandler, TwoFingersTouchZoomRotateHandler, VectorTileSource, VideoSource, VideoSourceMLGL, addProtocol, addSourceType, clearPrewarmedResources, config$1 as config, config as configMLGL, getBrowserLanguage, getMapLibreVersion, getMaxParallelImageRequests, getRTLTextPluginStatus, getVersion, getWorkerCount, getWorkerUrl, gpx, gpxOrKml, hasChildNodeWithName, helpers, importScriptInWorkers, isLanguageSupported, kml, prewarm, removeProtocol, setMaxParallelImageRequests, setRTLTextPlugin, setWorkerCount, setWorkerUrl, str2xml, xml2str };
4864
4394
  //# sourceMappingURL=maptiler-sdk.mjs.map