@maptiler/sdk 1.0.8 → 1.0.9

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.
@@ -1,5 +1,5 @@
1
1
  import * as maplibre_gl from 'maplibre-gl';
2
- import maplibre_gl__default, { MapOptions as MapOptions$1, StyleSpecification, ControlPosition, StyleOptions, LogoOptions as LogoOptions$1 } from 'maplibre-gl';
2
+ import maplibre_gl__default, { MapOptions as MapOptions$1, StyleSpecification, ControlPosition, StyleOptions, Map as Map$1, LogoOptions as LogoOptions$1 } from 'maplibre-gl';
3
3
  export * from 'maplibre-gl';
4
4
  import * as _mapbox_mapbox_gl_supported from '@mapbox/mapbox-gl-supported';
5
5
  import { FetchFunction, ReferenceMapStyle, MapStyleVariant } from '@maptiler/client';
@@ -254,8 +254,6 @@ declare type MapOptions = Omit<MapOptions$1, "style" | "maplibreLogo"> & {
254
254
  * The Map class can be instanciated to display a map in a `<div>`
255
255
  */
256
256
  declare class Map extends maplibre_gl__default.Map {
257
- private languageShouldUpdate;
258
- private isStyleInitialized;
259
257
  private isTerrainEnabled;
260
258
  private terrainExaggeration;
261
259
  private primaryLanguage;
@@ -349,14 +347,149 @@ declare class Map extends maplibre_gl__default.Map {
349
347
  getMaptilerSessionId(): string;
350
348
  }
351
349
 
352
- declare const GeolocateControl$1: typeof maplibre_gl.GeolocateControl;
350
+ /**
351
+ * This is an extension of MapLibre Marker to make it fully type compatible with the SDK
352
+ */
353
+
354
+ declare class Marker extends maplibre_gl__default.Marker {
355
+ addTo(map: Map | Map$1): this;
356
+ }
357
+
358
+ /**
359
+ * This is an extension of MapLibre Popup to make it fully type compatible with the SDK
360
+ */
361
+
362
+ declare class Popup extends maplibre_gl__default.Popup {
363
+ addTo(map: Map | Map$1): this;
364
+ }
365
+
366
+ /**
367
+ * This is an extension of MapLibre Style to make it fully type compatible with the SDK
368
+ */
369
+
370
+ declare class Style extends maplibre_gl__default.Style {
371
+ constructor(map: Map, options?: StyleOptions);
372
+ }
373
+
374
+ /**
375
+ * This is an extension of MapLibre CanvasSource to make it fully type compatible with the SDK
376
+ */
377
+
378
+ declare class CanvasSource extends maplibre_gl__default.CanvasSource {
379
+ onAdd(map: Map | Map$1): void;
380
+ }
381
+
382
+ /**
383
+ * This is an extension of MapLibre GeoJSONSource to make it fully type compatible with the SDK
384
+ */
385
+
386
+ declare class GeoJSONSource extends maplibre_gl__default.GeoJSONSource {
387
+ onAdd(map: Map | Map$1): void;
388
+ }
389
+
390
+ /**
391
+ * This is an extension of MapLibre ImageSource to make it fully type compatible with the SDK
392
+ */
393
+
394
+ declare class ImageSource extends maplibre_gl__default.ImageSource {
395
+ onAdd(map: Map | Map$1): void;
396
+ }
397
+
398
+ /**
399
+ * This is an extension of MapLibre RasterTileSource to make it fully type compatible with the SDK
400
+ */
401
+
402
+ declare class RasterTileSource extends maplibre_gl__default.RasterTileSource {
403
+ onAdd(map: Map | Map$1): void;
404
+ }
405
+
406
+ /**
407
+ * This is an extension of MapLibre RasterDEMTileSource to make it fully type compatible with the SDK
408
+ */
409
+
410
+ declare class RasterDEMTileSource extends maplibre_gl__default.RasterDEMTileSource {
411
+ onAdd(map: Map | Map$1): void;
412
+ }
413
+
414
+ /**
415
+ * This is an extension of MapLibre VectorTileSource to make it fully type compatible with the SDK
416
+ */
417
+
418
+ declare class VectorTileSource extends maplibre_gl__default.VectorTileSource {
419
+ onAdd(map: Map | Map$1): void;
420
+ }
421
+
422
+ /**
423
+ * This is an extension of MapLibre VideoSource to make it fully type compatible with the SDK
424
+ */
425
+
426
+ declare class VideoSource extends maplibre_gl__default.VideoSource {
427
+ onAdd(map: Map | Map$1): void;
428
+ }
429
+
430
+ /**
431
+ * This is an extension of MapLibre NavigationControl to make it fully type compatible with the SDK
432
+ */
433
+
434
+ declare class NavigationControl extends maplibre_gl__default.NavigationControl {
435
+ onAdd(map: Map | Map$1): HTMLElement;
436
+ }
437
+
438
+ /**
439
+ * This is an extension of MapLibre GeolocateControl to make it fully type compatible with the SDK
440
+ */
441
+
442
+ declare class GeolocateControl extends maplibre_gl__default.GeolocateControl {
443
+ onAdd(map: Map | Map$1): HTMLElement;
444
+ }
445
+
446
+ /**
447
+ * This is an extension of MapLibre AttributionControl to make it fully type compatible with the SDK
448
+ */
449
+
450
+ declare class AttributionControl extends maplibre_gl__default.AttributionControl {
451
+ onAdd(map: Map | Map$1): HTMLElement;
452
+ }
453
+
454
+ /**
455
+ * This is an extension of MapLibre LogoControl to make it fully type compatible with the SDK
456
+ */
457
+
458
+ declare class LogoControl extends maplibre_gl__default.LogoControl {
459
+ onAdd(map: Map | Map$1): HTMLElement;
460
+ }
461
+
462
+ /**
463
+ * This is an extension of MapLibre ScaleControl to make it fully type compatible with the SDK
464
+ */
465
+
466
+ declare class ScaleControl extends maplibre_gl__default.ScaleControl {
467
+ onAdd(map: Map | Map$1): HTMLElement;
468
+ }
469
+
470
+ /**
471
+ * This is an extension of MapLibre FullscreenControl to make it fully type compatible with the SDK
472
+ */
473
+
474
+ declare class FullscreenControl extends maplibre_gl__default.FullscreenControl {
475
+ onAdd(map: Map | Map$1): HTMLElement;
476
+ }
477
+
478
+ /**
479
+ * This is an extension of MapLibre TerrainControl to make it fully type compatible with the SDK
480
+ */
481
+
482
+ declare class TerrainControl extends maplibre_gl__default.TerrainControl {
483
+ onAdd(map: Map | Map$1): HTMLElement;
484
+ }
485
+
353
486
  /**
354
487
  * The MaptilerGeolocateControl is an extension of the original GeolocateControl
355
488
  * with a few changes. In this version, the active mode persists as long as the
356
489
  * location is still centered. This means it's robust to rotation, pitch and zoom.
357
490
  *
358
491
  */
359
- declare class MaptilerGeolocateControl extends GeolocateControl$1 {
492
+ declare class MaptilerGeolocateControl extends GeolocateControl {
360
493
  private lastUpdatedCenter;
361
494
  /**
362
495
  * Update the camera location to center on the current position
@@ -378,7 +511,7 @@ declare type LogoOptions = LogoOptions$1 & {
378
511
  * This LogoControl extends the MapLibre LogoControl but instead can use any image URL and
379
512
  * any link URL. By default this is using MapTiler logo and URL.
380
513
  */
381
- declare class MaptilerLogoControl extends maplibre_gl__default.LogoControl {
514
+ declare class MaptilerLogoControl extends LogoControl {
382
515
  private logoURL;
383
516
  private linkURL;
384
517
  constructor(options?: LogoOptions);
@@ -583,28 +716,6 @@ declare class Point {
583
716
  declare const supported: _mapbox_mapbox_gl_supported.IsSupported;
584
717
  declare const setRTLTextPlugin: (url: string, callback: (error?: Error) => void, deferred?: boolean) => void;
585
718
  declare const getRTLTextPluginStatus: () => string;
586
- declare const NavigationControl: typeof maplibre_gl.NavigationControl;
587
- declare const GeolocateControl: typeof maplibre_gl.GeolocateControl;
588
- declare const AttributionControl: typeof maplibre_gl.AttributionControl;
589
- declare const LogoControl: typeof maplibre_gl.LogoControl;
590
- declare const ScaleControl: typeof maplibre_gl.ScaleControl;
591
- declare const FullscreenControl: typeof maplibre_gl.FullscreenControl;
592
- declare const TerrainControl: typeof maplibre_gl.TerrainControl;
593
- declare const Popup: typeof maplibre_gl.Popup;
594
- declare const Marker: typeof maplibre_gl.Marker;
595
- declare const Style: typeof maplibre_gl.Style;
596
- declare const LngLat: typeof maplibre_gl.LngLat;
597
- declare const LngLatBounds: typeof maplibre_gl.LngLatBounds;
598
- declare const MercatorCoordinate: typeof maplibre_gl.MercatorCoordinate;
599
- declare const Evented: typeof maplibre_gl.Evented;
600
- declare const AJAXError: typeof maplibre_gl.AJAXError;
601
- declare const CanvasSource: typeof maplibre_gl.CanvasSource;
602
- declare const GeoJSONSource: typeof maplibre_gl.GeoJSONSource;
603
- declare const ImageSource: typeof maplibre_gl.ImageSource;
604
- declare const RasterDEMTileSource: typeof maplibre_gl.RasterDEMTileSource;
605
- declare const RasterTileSource: typeof maplibre_gl.RasterTileSource;
606
- declare const VectorTileSource: typeof maplibre_gl.VectorTileSource;
607
- declare const VideoSource: typeof maplibre_gl.VideoSource;
608
719
  declare const prewarm: () => void;
609
720
  declare const clearPrewarmedResources: () => void;
610
721
  declare const version: string;
@@ -615,4 +726,51 @@ declare const workerUrl: string;
615
726
  declare const addProtocol: (customProtocol: string, loadFn: (requestParameters: maplibre_gl.RequestParameters, callback: maplibre_gl.ResponseCallback<any>) => maplibre_gl.Cancelable) => void;
616
727
  declare const removeProtocol: (customProtocol: string) => void;
617
728
 
618
- export { AJAXError, AttributionControl, CanvasSource, Evented, FullscreenControl, GeoJSONSource, GeolocateControl, GeolocationType, ImageSource, Language, LanguageKey, LanguageString, LngLat, LngLatBounds, LogoControl, Map, MapOptions, MaptilerGeolocateControl, MaptilerLogoControl, MaptilerTerrainControl, Marker, Matrix2, MercatorCoordinate, NavigationControl, Point, Popup, RasterDEMTileSource, RasterTileSource, ScaleControl, SdkConfig, Style, TerrainControl, Unit, VectorTileSource, VideoSource, addProtocol, clearPrewarmedResources, clearStorage, config, getRTLTextPluginStatus, maxParallelImageRequests, prewarm, removeProtocol, setRTLTextPlugin, supported, version, workerCount, workerUrl };
729
+ declare const NavigationControlMLGL: typeof maplibre_gl.NavigationControl;
730
+ declare type NavigationControlMLGL = InstanceType<typeof NavigationControlMLGL>;
731
+ declare const GeolocateControlMLGL: typeof maplibre_gl.GeolocateControl;
732
+ declare type GeolocateControlMLGL = InstanceType<typeof GeolocateControlMLGL>;
733
+ declare const AttributionControlMLGL: typeof maplibre_gl.AttributionControl;
734
+ declare type AttributionControlMLGL = InstanceType<typeof AttributionControlMLGL>;
735
+ declare const LogoControlMLGL: typeof maplibre_gl.LogoControl;
736
+ declare type LogoControlMLGL = InstanceType<typeof LogoControlMLGL>;
737
+ declare const ScaleControlMLGL: typeof maplibre_gl.ScaleControl;
738
+ declare type ScaleControlMLGL = InstanceType<typeof ScaleControlMLGL>;
739
+ declare const FullscreenControlMLGL: typeof maplibre_gl.FullscreenControl;
740
+ declare type FullscreenControlMLGL = InstanceType<typeof FullscreenControlMLGL>;
741
+ declare const TerrainControlMLGL: typeof maplibre_gl.TerrainControl;
742
+ declare type TerrainControlMLGL = InstanceType<typeof TerrainControlMLGL>;
743
+ declare const MarkerMLGL: typeof maplibre_gl.Marker;
744
+ declare type MarkerMLGL = InstanceType<typeof MarkerMLGL>;
745
+ declare const PopupMLGL: typeof maplibre_gl.Popup;
746
+ declare type PopupMLGL = InstanceType<typeof PopupMLGL>;
747
+ declare const StyleMLGL: typeof maplibre_gl.Style;
748
+ declare type StyleMLGL = InstanceType<typeof StyleMLGL>;
749
+ declare const LngLat: typeof maplibre_gl.LngLat;
750
+ declare type LngLat = InstanceType<typeof LngLat>;
751
+ declare const LngLatBounds: typeof maplibre_gl.LngLatBounds;
752
+ declare type LngLatBounds = InstanceType<typeof LngLatBounds>;
753
+ declare const MercatorCoordinate: typeof maplibre_gl.MercatorCoordinate;
754
+ declare type MercatorCoordinate = InstanceType<typeof MercatorCoordinate>;
755
+ declare const Evented: typeof maplibre_gl.Evented;
756
+ declare type Evented = InstanceType<typeof Evented>;
757
+ declare const AJAXError: typeof maplibre_gl.AJAXError;
758
+ declare type AJAXError = InstanceType<typeof AJAXError>;
759
+ declare const CanvasSourceMLGL: typeof maplibre_gl.CanvasSource;
760
+ declare type CanvasSourceMLGL = InstanceType<typeof CanvasSourceMLGL>;
761
+ declare const GeoJSONSourceMLGL: typeof maplibre_gl.GeoJSONSource;
762
+ declare type GeoJSONSourceMLGL = InstanceType<typeof GeoJSONSourceMLGL>;
763
+ declare const ImageSourceMLGL: typeof maplibre_gl.ImageSource;
764
+ declare type ImageSourceMLGL = InstanceType<typeof ImageSourceMLGL>;
765
+ declare const RasterDEMTileSourceMLGL: typeof maplibre_gl.RasterDEMTileSource;
766
+ declare type RasterDEMTileSourceMLGL = InstanceType<typeof RasterDEMTileSourceMLGL>;
767
+ declare const RasterTileSourceMLGL: typeof maplibre_gl.RasterTileSource;
768
+ declare type RasterTileSourceMLGL = InstanceType<typeof RasterTileSourceMLGL>;
769
+ declare const VectorTileSourceMLGL: typeof maplibre_gl.VectorTileSource;
770
+ declare type VectorTileSourceMLGL = InstanceType<typeof VectorTileSourceMLGL>;
771
+ declare const VideoSourceMLGL: typeof maplibre_gl.VideoSource;
772
+ declare type VideoSourceMLGL = InstanceType<typeof VideoSourceMLGL>;
773
+ declare const MapMLGL: typeof maplibre_gl.Map;
774
+ declare type MapMLGL = InstanceType<typeof MapMLGL>;
775
+
776
+ export { AJAXError, AttributionControl, AttributionControlMLGL, CanvasSource, CanvasSourceMLGL, Evented, FullscreenControl, FullscreenControlMLGL, GeoJSONSource, GeoJSONSourceMLGL, GeolocateControl, GeolocateControlMLGL, GeolocationType, ImageSource, ImageSourceMLGL, Language, LanguageKey, LanguageString, LngLat, LngLatBounds, LogoControl, LogoControlMLGL, Map, MapMLGL, MapOptions, MaptilerGeolocateControl, MaptilerLogoControl, MaptilerTerrainControl, Marker, MarkerMLGL, Matrix2, MercatorCoordinate, NavigationControl, NavigationControlMLGL, Point, Popup, PopupMLGL, RasterDEMTileSource, RasterDEMTileSourceMLGL, RasterTileSource, RasterTileSourceMLGL, ScaleControl, ScaleControlMLGL, SdkConfig, Style, StyleMLGL, TerrainControl, TerrainControlMLGL, Unit, VectorTileSource, VectorTileSourceMLGL, VideoSource, VideoSourceMLGL, addProtocol, clearPrewarmedResources, clearStorage, config, getRTLTextPluginStatus, maxParallelImageRequests, prewarm, removeProtocol, setRTLTextPlugin, supported, version, workerCount, workerUrl };
@@ -1 +1 @@
1
- import m from"maplibre-gl";export*from"maplibre-gl";import{Base64 as D}from"js-base64";import{v4 as z}from"uuid";import F from"events";import{config as x,expandMapStyle as V,MapStyleVariant as Z,ReferenceMapStyle as q,MapStyle as J,mapStylePresetList as W,geolocation as v}from"@maptiler/client";import{LanguageGeocoding as ne,MapStyle as oe,MapStyleVariant as se,ReferenceMapStyle as le,ServiceError as ce,coordinates as he,data as ue,geocoding as ge,geolocation as pe,staticMaps as de}from"@maptiler/client";const L={AUTO:"auto",LATIN:"latin",NON_LATIN:"nonlatin",LOCAL:"",ALBANIAN:"sq",AMHARIC:"am",ARABIC:"ar",ARMENIAN:"hy",AZERBAIJANI:"az",BASQUE:"eu",BELORUSSIAN:"be",BOSNIAN:"bs",BRETON:"br",BULGARIAN:"bg",CATALAN:"ca",CHINESE:"zh",CORSICAN:"co",CROATIAN:"hr",CZECH:"cs",DANISH:"da",DUTCH:"nl",ENGLISH:"en",ESPERANTO:"eo",ESTONIAN:"et",FINNISH:"fi",FRENCH:"fr",FRISIAN:"fy",GEORGIAN:"ka",GERMAN:"de",GREEK:"el",HEBREW:"he",HINDI:"hi",HUNGARIAN:"hu",ICELANDIC:"is",INDONESIAN:"id",IRISH:"ga",ITALIAN:"it",JAPANESE:"ja",JAPANESE_HIRAGANA:"ja-Hira",JAPANESE_KANA:"ja_kana",JAPANESE_LATIN:"ja_rm",JAPANESE_2018:"ja-Latn",KANNADA:"kn",KAZAKH:"kk",KOREAN:"ko",KOREAN_LATIN:"ko-Latn",KURDISH:"ku",ROMAN_LATIN:"la",LATVIAN:"lv",LITHUANIAN:"lt",LUXEMBOURGISH:"lb",MACEDONIAN:"mk",MALAYALAM:"ml",MALTESE:"mt",NORWEGIAN:"no",OCCITAN:"oc",POLISH:"pl",PORTUGUESE:"pt",ROMANIAN:"ro",ROMANSH:"rm",RUSSIAN:"ru",SCOTTISH_GAELIC:"gd",SERBIAN_CYRILLIC:"sr",SERBIAN_LATIN:"sr-Latn",SLOVAK:"sk",SLOVENE:"sl",SPANISH:"es",SWEDISH:"sv",TAMIL:"ta",TELUGU:"te",THAI:"th",TURKISH:"tr",UKRAINIAN:"uk",WELSH:"cy"},Y=new Set(Object.values(L));function E(r){return Y.has(r)}const X=new Set(Object.values(L));function T(){if(typeof navigator>"u")return Intl.DateTimeFormat().resolvedOptions().locale.split("-")[0];const r=Array.from(new Set(navigator.languages.map(t=>t.split("-")[0]))).filter(t=>X.has(t));return r.length?r[0]:L.LATIN}class N extends F{constructor(){super(),this.primaryLanguage=L.AUTO,this.secondaryLanguage=null,this.session=!0,this._unit="metric",this._apiKey=""}set unit(t){this._unit=t,this.emit("unit",t)}get unit(){return this._unit}set apiKey(t){this._apiKey=t,x.apiKey=t,this.emit("apiKey",t)}get apiKey(){return this._apiKey}set fetch(t){x.fetch=t}get fetch(){return x.fetch}}const y=new N,p={maptilerLogoURL:"https://api.maptiler.com/resources/logo.svg",maptilerURL:"https://www.maptiler.com/",maptilerApiHost:"api.maptiler.com",rtlPluginURL:"https://cdn.maptiler.com/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.min.js",primaryLanguage:L.AUTO,secondaryLanguage:L.LOCAL,terrainSourceURL:"https://api.maptiler.com/tiles/terrain-rgb-v2/tiles.json",terrainSourceId:"maptiler-terrain"};Object.freeze(p);class I extends m.LogoControl{constructor(t={}){var e,n;super(t),this.logoURL="",this.linkURL="",this.logoURL=(e=t.logoURL)!=null?e:p.maptilerLogoURL,this.linkURL=(n=t.linkURL)!=null?n:p.maptilerURL}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=window.document.createElement("div"),this._container.className="maplibregl-ctrl";const e=window.document.createElement("a");return e.style.backgroundRepeat="no-repeat",e.style.cursor="pointer",e.style.display="block",e.style.height="23px",e.style.margin="0 0 -4px -4px",e.style.overflow="hidden",e.style.width="88px",e.style.backgroundImage=`url(${this.logoURL})`,e.style.backgroundSize="100px 30px",e.style.width="100px",e.style.height="30px",e.target="_blank",e.rel="noopener nofollow",e.href=this.linkURL,e.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),e.setAttribute("rel","noopener nofollow"),this._container.appendChild(e),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}}function Q(){m.getRTLTextPluginStatus()==="unavailable"&&m.setRTLTextPlugin(p.rtlPluginURL,null,!0)}function tt(r,t){r.forEach(e=>{!t[e]||(t[e]=t[e].bind(t))})}function S(r,t,e){const n=window.document.createElement(r);return t!==void 0&&(n.className=t),e&&e.appendChild(n),n}function et(r){r.parentNode&&r.parentNode.removeChild(r)}function w(r){return r?typeof r=="string"||r instanceof String?!r.startsWith("http")&&r.toLowerCase().includes(".json")?r:V(r):r instanceof Z?r.getExpandedStyleURL():r instanceof q?r.getDefaultVariant().getExpandedStyleURL():r:J[W[0].referenceStyleID].getDefaultVariant().getExpandedStyleURL()}class R{constructor(){tt(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(t){return this._map=t,this._container=S("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=S("button","maplibregl-ctrl-terrain",this._container),S("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){et(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}_toggleTerrain(){this._map.hasTerrain()?this._map.disableTerrain():this._map.enableTerrain(),this._updateTerrainIcon()}_updateTerrainIcon(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.hasTerrain()?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))}}class rt extends m.NavigationControl{constructor(){super({showCompass:!0,showZoom:!0,visualizePitch:!0}),this._compass.removeEventListener("click",this._compass.clickFunction),this._compass.addEventListener("click",t=>{this._map.getPitch()===0?this._map.easeTo({pitch:Math.min(this._map.getMaxPitch(),80)}):this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})})}_createButton(t,e){const n=super._createButton(t,e);return n.clickFunction=e,n}_rotateCompassArrow(){const t=this.options.visualizePitch?`scale(${Math.min(1.5,1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5))}) 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)`;this._compassIcon.style.transform=t}}var it=Object.defineProperty,at=Object.defineProperties,nt=Object.getOwnPropertyDescriptors,P=Object.getOwnPropertySymbols,ot=Object.prototype.hasOwnProperty,st=Object.prototype.propertyIsEnumerable,O=(r,t,e)=>t in r?it(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,lt=(r,t)=>{for(var e in t||(t={}))ot.call(t,e)&&O(r,e,t[e]);if(P)for(var e of P(t))st.call(t,e)&&O(r,e,t[e]);return r},ct=(r,t)=>at(r,nt(t));const ht=m.GeolocateControl,U=m.Marker,M=m.LngLat;class k extends ht{constructor(){super(...arguments),this.lastUpdatedCenter=new M(0,0)}_updateCamera(t){const e=new M(t.coords.longitude,t.coords.latitude),n=t.coords.accuracy,c=this._map.getBearing(),g=ct(lt({bearing:c},this.options.fitBoundsOptions),{linear:!0}),s=this._map.getZoom();s>this.options.fitBoundsOptions.maxZoom&&(g.zoom=s),this._map.fitBounds(e.toBounds(n),g,{geolocateSource:!0});let i=!1;const a=()=>{i=!0};this._map.once("click",a),this._map.once("dblclick",a),this._map.once("dragstart",a),this._map.once("mousedown",a),this._map.once("touchstart",a),this._map.once("wheel",a),this._map.once("moveend",()=>{this._map.off("click",a),this._map.off("dblclick",a),this._map.off("dragstart",a),this._map.off("mousedown",a),this._map.off("touchstart",a),this._map.off("wheel",a),!i&&(this.lastUpdatedCenter=this._map.getCenter())})}_setupUI(t){if(this.lastUpdatedCenter=this._map.getCenter(),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this._geolocateButton=S("button","maplibregl-ctrl-geolocate",this._container),S("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",t===!1){const e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}else{const e=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=S("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new U(this._dotElement),this._circleElement=S("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new U({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("move",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("moveend",e=>{const n=e.originalEvent&&e.originalEvent.type==="resize",c=this.lastUpdatedCenter.distanceTo(this._map.getCenter());!e.geolocateSource&&this._watchState==="ACTIVE_LOCK"&&!n&&c>1&&(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new Event("trackuserlocationend")))})}_updateCircleRadius(){if(this._watchState!=="BACKGROUND"&&this._watchState!=="ACTIVE_LOCK")return;const t=[this._lastKnownPosition.coords.longitude,this._lastKnownPosition.coords.latitude],e=this._map.project(t),n=this._map.unproject([e.x,e.y]),c=this._map.unproject([e.x+20,e.y]),g=n.distanceTo(c)/20,s=Math.ceil(2*this._accuracy/g);this._circleElement.style.width=`${s}px`,this._circleElement.style.height=`${s}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}}var ut=Object.defineProperty,gt=Object.defineProperties,pt=Object.getOwnPropertyDescriptors,B=Object.getOwnPropertySymbols,dt=Object.prototype.hasOwnProperty,mt=Object.prototype.propertyIsEnumerable,$=(r,t,e)=>t in r?ut(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,H=(r,t)=>{for(var e in t||(t={}))dt.call(t,e)&&$(r,e,t[e]);if(B)for(var e of B(t))mt.call(t,e)&&$(r,e,t[e]);return r},j=(r,t)=>gt(r,pt(t)),C=(r,t,e)=>new Promise((n,c)=>{var g=a=>{try{i(e.next(a))}catch(u){c(u)}},s=a=>{try{i(e.throw(a))}catch(u){c(u)}},i=a=>a.done?n(a.value):Promise.resolve(a.value).then(g,s);i((e=e.apply(r,t)).next())});const K=z(),G={POINT:"POINT",COUNTRY:"COUNTRY"};class yt extends m.Map{constructor(t){var e,n;t.apiKey&&(y.apiKey=t.apiKey);const c=w(t.style),g=location.hash;y.apiKey||console.warn("MapTiler Cloud API key is not set. Visit https://maptiler.com and try Cloud for free!"),super(j(H({},t),{style:c,maplibreLogo:!1,transformRequest:s=>{let i=null;try{i=new URL(s)}catch{return{url:s,headers:{}}}return i.host===p.maptilerApiHost&&(i.searchParams.has("key")||i.searchParams.append("key",y.apiKey),y.session&&i.searchParams.append("mtsid",K)),{url:i.href,headers:{}}}})),this.languageShouldUpdate=!1,this.isStyleInitialized=!1,this.isTerrainEnabled=!1,this.terrainExaggeration=1,this.primaryLanguage=null,this.secondaryLanguage=null,this.primaryLanguage=(e=t.language)!=null?e:y.primaryLanguage,this.secondaryLanguage=y.secondaryLanguage,this.once("styledata",()=>C(this,null,function*(){if(t.geolocate===!1||t.center||t.hash&&!!g)return;try{if(t.geolocate===G.COUNTRY){yield this.fitToIpBounds();return}}catch(i){console.warn(i.message)}let s=null;try{yield this.centerOnIpPoint(t.zoom),s=this.getCameraHash()}catch(i){console.warn(i.message)}(yield navigator.permissions.query({name:"geolocation"})).state==="granted"&&navigator.geolocation.getCurrentPosition(i=>{s===this.getCameraHash()&&this.easeTo({center:[i.coords.longitude,i.coords.latitude],zoom:t.zoom||12,duration:2e3})},null,{maximumAge:24*3600*1e3,timeout:5e3,enableHighAccuracy:!1})})),this.on("styledata",()=>{this.setPrimaryLanguage(this.primaryLanguage),this.setSecondaryLanguage(this.secondaryLanguage)}),this.on("styledata",()=>{this.getTerrain()===null&&this.isTerrainEnabled&&this.enableTerrain(this.terrainExaggeration)}),this.once("load",()=>C(this,null,function*(){Q()})),this.once("load",()=>C(this,null,function*(){let s={logo:null};try{const i=Object.keys(this.style.sourceCaches).map(u=>this.getSource(u)).filter(u=>typeof u.url=="string"&&u.url.includes("tiles.json")),a=new URL(i[0].url);a.searchParams.has("key")||a.searchParams.append("key",y.apiKey),s=yield(yield fetch(a.href)).json()}catch{}if("logo"in s&&s.logo){const i=s.logo;this.addControl(new I({logoURL:i}),t.logoPosition),t.attributionControl===!1&&this.addControl(new m.AttributionControl(t))}else t.maptilerLogo&&this.addControl(new I,t.logoPosition);if(t.scaleControl){const i=t.scaleControl===!0||t.scaleControl===void 0?"bottom-right":t.scaleControl,a=new m.ScaleControl({unit:y.unit});this.addControl(a,i),y.on("unit",u=>{a.setUnit(u)})}if(t.navigationControl!==!1){const i=t.navigationControl===!0||t.navigationControl===void 0?"top-right":t.navigationControl;this.addControl(new rt,i)}if(t.geolocateControl!==!1){const i=t.geolocateControl===!0||t.geolocateControl===void 0?"top-right":t.geolocateControl;this.addControl(new k({positionOptions:{enableHighAccuracy:!0,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!0,showAccuracyCircle:!0,showUserLocation:!0}),i)}if(t.terrainControl){const i=t.terrainControl===!0||t.terrainControl===void 0?"top-right":t.terrainControl;this.addControl(new R,i)}if(t.fullscreenControl){const i=t.fullscreenControl===!0||t.fullscreenControl===void 0?"top-right":t.fullscreenControl;this.addControl(new m.FullscreenControl({}),i)}})),t.terrain&&this.enableTerrain((n=t.terrainExaggeration)!=null?n:this.terrainExaggeration)}setStyle(t,e){return super.setStyle(w(t),e)}setLanguage(t=p.primaryLanguage){if(t===L.AUTO)return this.setLanguage(T());this.setPrimaryLanguage(t)}setPrimaryLanguage(t=p.primaryLanguage){!E(t)||(this.primaryLanguage=t,this.onStyleReady(()=>{if(t===L.AUTO)return this.setPrimaryLanguage(T());const e=this.getStyle().layers,n=/^\s*{\s*name\s*(:\s*(\S*))?\s*}$/,c=/^\s*name\s*(:\s*(\S*))?\s*$/,g=/^\s*{\s*name\s*(:\s*(\S*))?\s*}(\s*){\s*name\s*(:\s*(\S*))?\s*}$/,s=/^(.*)({\s*name\s*(:\s*(\S*))?\s*})(.*)$/,i=t?`name:${t}`:"name",a=["case",["has",i],["get",i],["get","name:latin"]];for(let u=0;u<e.length;u+=1){const h=e[u],f=h.layout;if(!f||!f["text-field"])continue;const o=this.getLayoutProperty(h.id,"text-field");let d;if(Array.isArray(o)&&o.length>=2&&o[0].trim().toLowerCase()==="concat"){const l=o.slice();for(let A=0;A<o.length;A+=1){const _=o[A];if((typeof _=="string"||_ instanceof String)&&n.exec(_.toString())){l[A]=a;break}else if(Array.isArray(_)&&_.length>=2&&_[0].trim().toLowerCase()==="get"&&c.exec(_[1].toString())){l[A]=a;break}else if(Array.isArray(_)&&_.length===4&&_[0].trim().toLowerCase()==="case"){l[A]=a;break}}this.setLayoutProperty(h.id,"text-field",l)}else if(Array.isArray(o)&&o.length>=2&&o[0].trim().toLowerCase()==="get"&&c.exec(o[1].toString())){const l=a;this.setLayoutProperty(h.id,"text-field",l)}else if((typeof o=="string"||o instanceof String)&&n.exec(o.toString())){const l=a;this.setLayoutProperty(h.id,"text-field",l)}else if(Array.isArray(o)&&o.length===4&&o[0].trim().toLowerCase()==="case"){const l=a;this.setLayoutProperty(h.id,"text-field",l)}else if((typeof o=="string"||o instanceof String)&&(d=g.exec(o.toString()))!==null){const l=`{${i}}${d[3]}{name${d[4]||""}}`;this.setLayoutProperty(h.id,"text-field",l)}else if((typeof o=="string"||o instanceof String)&&(d=s.exec(o.toString()))!==null){const l=`${d[1]}{${i}}${d[5]}`;this.setLayoutProperty(h.id,"text-field",l)}}}))}setSecondaryLanguage(t=p.secondaryLanguage){!E(t)||(this.secondaryLanguage=t,this.onStyleReady(()=>{if(t===L.AUTO)return this.setSecondaryLanguage(T());const e=this.getStyle().layers,n=/^\s*{\s*name\s*(:\s*(\S*))?\s*}$/,c=/^\s*name\s*(:\s*(\S*))?\s*$/,g=/^\s*{\s*name\s*(:\s*(\S*))?\s*}(\s*){\s*name\s*(:\s*(\S*))?\s*}$/;let s;for(let i=0;i<e.length;i+=1){const a=e[i],u=a.layout;if(!u||!u["text-field"])continue;const h=this.getLayoutProperty(a.id,"text-field");let f;if(Array.isArray(h)&&h.length>=2&&h[0].trim().toLowerCase()==="concat"){f=h.slice();let o=0;for(let d=0;d<h.length;d+=1){const l=h[d];if((typeof l=="string"||l instanceof String)&&n.exec(l.toString())){if(o===1){f[d]=`{name:${t}}`;break}o+=1}else if(Array.isArray(l)&&l.length>=2&&l[0].trim().toLowerCase()==="get"&&c.exec(l[1].toString())){if(o===1){f[d][1]=`name:${t}`;break}o+=1}else if(Array.isArray(l)&&l.length===4&&l[0].trim().toLowerCase()==="case"){if(o===1){f[d]=["get",`name:${t}`];break}o+=1}}this.setLayoutProperty(a.id,"text-field",f)}else if((typeof h=="string"||h instanceof String)&&(s=g.exec(h.toString()))!==null){const o=t?`name:${t}`:"name";f=`{name${s[1]||""}}${s[3]}{${o}}`,this.setLayoutProperty(a.id,"text-field",f)}}}))}getPrimaryLanguage(){return this.primaryLanguage}getSecondaryLanguage(){return this.secondaryLanguage}getTerrainExaggeration(){return this.terrainExaggeration}hasTerrain(){return this.isTerrainEnabled}enableTerrain(t=this.terrainExaggeration){if(t<0){console.warn("Terrain exaggeration cannot be negative.");return}const e=this.getTerrain(),n=()=>{this.isTerrainEnabled=!0,this.terrainExaggeration=t,this.addSource(p.terrainSourceId,{type:"raster-dem",url:p.terrainSourceURL}),this.setTerrain({source:p.terrainSourceId,exaggeration:t})};if(e){this.setTerrain(j(H({},e),{exaggeration:t}));return}this.loaded()||this.isTerrainEnabled?n():this.once("load",()=>{this.getTerrain()&&this.getSource(p.terrainSourceId)||n()})}disableTerrain(){this.isTerrainEnabled=!1,this.setTerrain(null),this.getSource(p.terrainSourceId)&&this.removeSource(p.terrainSourceId)}setTerrainExaggeration(t){this.enableTerrain(t)}onStyleReady(t){this.isStyleLoaded()?t():this.once("styledata",()=>{t()})}fitToIpBounds(){return C(this,null,function*(){const t=yield v.info();this.fitBounds(t.country_bounds,{duration:0,padding:100})})}centerOnIpPoint(t){return C(this,null,function*(){const e=yield v.info();this.jumpTo({center:[e.longitude,e.latitude],zoom:t||11})})}getCameraHash(){const t=new Float32Array(5),e=this.getCenter();return t[0]=e.lng,t[1]=e.lat,t[2]=this.getZoom(),t[3]=this.getPitch(),t[4]=this.getBearing(),D.fromUint8Array(new Uint8Array(t.buffer))}getSdkConfig(){return y}getMaptilerSessionId(){return K}}class b{constructor(t,e){this.x=t,this.y=e}_matMult(t){const e=t[0]*this.x+t[1]*this.y,n=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=n,this}_add(t){return this.x+=t.x,this.y+=t.y,this}_sub(t){return this.x-=t.x,this.y-=t.y,this}_mult(t){return this.x*=t,this.y*=t,this}_div(t){return this.x/=t,this.y/=t,this}_multByPoint(t){return this.x*=t.x,this.y*=t.y,this}_divByPoint(t){return this.x/=t.x,this.y/=t.y,this}_unit(){return this._div(this.mag()),this}_perp(){const t=this.y;return this.y=this.x,this.x=-t,this}_rotate(t){const e=Math.cos(t),n=Math.sin(t),c=e*this.x-n*this.y,g=n*this.x+e*this.y;return this.x=c,this.y=g,this}_rotateAround(t,e){const n=Math.cos(t),c=Math.sin(t),g=e.x+n*(this.x-e.x)-c*(this.y-e.y),s=e.y+c*(this.x-e.x)+n*(this.y-e.y);return this.x=g,this.y=s,this}_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}clone(){return new b(this.x,this.y)}add(t){return this.clone()._add(t)}sub(t){return this.clone()._sub(t)}multByPoint(t){return this.clone()._multByPoint(t)}divByPoint(t){return this.clone()._divByPoint(t)}mult(t){return this.clone()._mult(t)}div(t){return this.clone()._div(t)}rotate(t){return this.clone()._rotate(t)}rotateAround(t,e){return this.clone()._rotateAround(t,e)}matMult(t){return this.clone()._matMult(t)}unit(){return this.clone()._unit()}perp(){return this.clone()._perp()}round(){return this.clone()._round()}mag(){return Math.sqrt(this.x*this.x+this.y*this.y)}equals(t){return this.x===t.x&&this.y===t.y}dist(t){return Math.sqrt(this.distSqr(t))}distSqr(t){const e=t.x-this.x,n=t.y-this.y;return e*e+n*n}angle(){return Math.atan2(this.y,this.x)}angleTo(t){return Math.atan2(this.y-t.y,this.x-t.x)}angleWith(t){return this.angleWithSep(t.x,t.y)}angleWithSep(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)}static convert(t){return t instanceof b?t:Array.isArray(t)?new b(t[0],t[1]):t}}const{supported:ft,setRTLTextPlugin:_t,getRTLTextPluginStatus:Lt,NavigationControl:St,GeolocateControl:At,AttributionControl:Ct,LogoControl:bt,ScaleControl:xt,FullscreenControl:Tt,TerrainControl:It,Popup:vt,Marker:Et,Style:Nt,LngLat:wt,LngLatBounds:Rt,MercatorCoordinate:Pt,Evented:Ot,AJAXError:Ut,CanvasSource:Mt,GeoJSONSource:kt,ImageSource:Bt,RasterDEMTileSource:$t,RasterTileSource:Ht,VectorTileSource:jt,VideoSource:Kt,prewarm:Gt,clearPrewarmedResources:Dt,version:zt,workerCount:Ft,maxParallelImageRequests:Vt,clearStorage:Zt,workerUrl:qt,addProtocol:Jt,removeProtocol:Wt}=m;export{Ut as AJAXError,Ct as AttributionControl,Mt as CanvasSource,Ot as Evented,Tt as FullscreenControl,kt as GeoJSONSource,At as GeolocateControl,G as GeolocationType,Bt as ImageSource,L as Language,ne as LanguageGeocoding,wt as LngLat,Rt as LngLatBounds,bt as LogoControl,yt as Map,oe as MapStyle,se as MapStyleVariant,k as MaptilerGeolocateControl,I as MaptilerLogoControl,R as MaptilerTerrainControl,Et as Marker,Pt as MercatorCoordinate,St as NavigationControl,b as Point,vt as Popup,$t as RasterDEMTileSource,Ht as RasterTileSource,le as ReferenceMapStyle,xt as ScaleControl,N as SdkConfig,ce as ServiceError,Nt as Style,It as TerrainControl,jt as VectorTileSource,Kt as VideoSource,Jt as addProtocol,Dt as clearPrewarmedResources,Zt as clearStorage,y as config,he as coordinates,ue as data,ge as geocoding,pe as geolocation,Lt as getRTLTextPluginStatus,Vt as maxParallelImageRequests,Gt as prewarm,Wt as removeProtocol,_t as setRTLTextPlugin,de as staticMaps,ft as supported,zt as version,Ft as workerCount,qt as workerUrl};
1
+ import n from"maplibre-gl";export*from"maplibre-gl";import{Base64 as q}from"js-base64";import{v4 as W}from"uuid";import Y from"events";import{config as T,expandMapStyle as X,MapStyleVariant as Q,ReferenceMapStyle as tt,MapStyle as et,mapStylePresetList as rt,geolocation as v}from"@maptiler/client";import{LanguageGeocoding as me,MapStyle as ye,MapStyleVariant as Ae,ReferenceMapStyle as Le,ServiceError as Se,coordinates as fe,data as _e,geocoding as Ce,geolocation as xe,staticMaps as Te}from"@maptiler/client";const S={AUTO:"auto",LATIN:"latin",NON_LATIN:"nonlatin",LOCAL:"",ALBANIAN:"sq",AMHARIC:"am",ARABIC:"ar",ARMENIAN:"hy",AZERBAIJANI:"az",BASQUE:"eu",BELORUSSIAN:"be",BOSNIAN:"bs",BRETON:"br",BULGARIAN:"bg",CATALAN:"ca",CHINESE:"zh",CORSICAN:"co",CROATIAN:"hr",CZECH:"cs",DANISH:"da",DUTCH:"nl",ENGLISH:"en",ESPERANTO:"eo",ESTONIAN:"et",FINNISH:"fi",FRENCH:"fr",FRISIAN:"fy",GEORGIAN:"ka",GERMAN:"de",GREEK:"el",HEBREW:"he",HINDI:"hi",HUNGARIAN:"hu",ICELANDIC:"is",INDONESIAN:"id",IRISH:"ga",ITALIAN:"it",JAPANESE:"ja",JAPANESE_HIRAGANA:"ja-Hira",JAPANESE_KANA:"ja_kana",JAPANESE_LATIN:"ja_rm",JAPANESE_2018:"ja-Latn",KANNADA:"kn",KAZAKH:"kk",KOREAN:"ko",KOREAN_LATIN:"ko-Latn",KURDISH:"ku",ROMAN_LATIN:"la",LATVIAN:"lv",LITHUANIAN:"lt",LUXEMBOURGISH:"lb",MACEDONIAN:"mk",MALAYALAM:"ml",MALTESE:"mt",NORWEGIAN:"no",OCCITAN:"oc",POLISH:"pl",PORTUGUESE:"pt",ROMANIAN:"ro",ROMANSH:"rm",RUSSIAN:"ru",SCOTTISH_GAELIC:"gd",SERBIAN_CYRILLIC:"sr",SERBIAN_LATIN:"sr-Latn",SLOVAK:"sk",SLOVENE:"sl",SPANISH:"es",SWEDISH:"sv",TAMIL:"ta",TELUGU:"te",THAI:"th",TURKISH:"tr",UKRAINIAN:"uk",WELSH:"cy"},at=new Set(Object.values(S));function E(r){return at.has(r)}const nt=new Set(Object.values(S));function b(){if(typeof navigator>"u")return Intl.DateTimeFormat().resolvedOptions().locale.split("-")[0];const r=Array.from(new Set(navigator.languages.map(t=>t.split("-")[0]))).filter(t=>nt.has(t));return r.length?r[0]:S.LATIN}class N extends Y{constructor(){super(),this.primaryLanguage=S.AUTO,this.secondaryLanguage=null,this.session=!0,this._unit="metric",this._apiKey=""}set unit(t){this._unit=t,this.emit("unit",t)}get unit(){return this._unit}set apiKey(t){this._apiKey=t,T.apiKey=t,this.emit("apiKey",t)}get apiKey(){return this._apiKey}set fetch(t){T.fetch=t}get fetch(){return T.fetch}}const y=new N,p={maptilerLogoURL:"https://api.maptiler.com/resources/logo.svg",maptilerURL:"https://www.maptiler.com/",maptilerApiHost:"api.maptiler.com",rtlPluginURL:"https://cdn.maptiler.com/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.min.js",primaryLanguage:S.AUTO,secondaryLanguage:S.LOCAL,terrainSourceURL:"https://api.maptiler.com/tiles/terrain-rgb-v2/tiles.json",terrainSourceId:"maptiler-terrain"};Object.freeze(p);class w extends n.LogoControl{onAdd(t){return super.onAdd(t)}}class I extends w{constructor(t={}){var e,i;super(t),this.logoURL="",this.linkURL="",this.logoURL=(e=t.logoURL)!=null?e:p.maptilerLogoURL,this.linkURL=(i=t.linkURL)!=null?i:p.maptilerURL}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=window.document.createElement("div"),this._container.className="maplibregl-ctrl";const e=window.document.createElement("a");return e.style.backgroundRepeat="no-repeat",e.style.cursor="pointer",e.style.display="block",e.style.height="23px",e.style.margin="0 0 -4px -4px",e.style.overflow="hidden",e.style.width="88px",e.style.backgroundImage=`url(${this.logoURL})`,e.style.backgroundSize="100px 30px",e.style.width="100px",e.style.height="30px",e.target="_blank",e.rel="noopener nofollow",e.href=this.linkURL,e.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),e.setAttribute("rel","noopener nofollow"),this._container.appendChild(e),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}}function ot(){n.getRTLTextPluginStatus()==="unavailable"&&n.setRTLTextPlugin(p.rtlPluginURL,null,!0)}function it(r,t){r.forEach(e=>{!t[e]||(t[e]=t[e].bind(t))})}function f(r,t,e){const i=window.document.createElement(r);return t!==void 0&&(i.className=t),e&&e.appendChild(i),i}function st(r){r.parentNode&&r.parentNode.removeChild(r)}function R(r){return r?typeof r=="string"||r instanceof String?!r.startsWith("http")&&r.toLowerCase().includes(".json")?r:X(r):r instanceof Q?r.getExpandedStyleURL():r instanceof tt?r.getDefaultVariant().getExpandedStyleURL():r:et[rt[0].referenceStyleID].getDefaultVariant().getExpandedStyleURL()}class P{constructor(){it(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(t){return this._map=t,this._container=f("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=f("button","maplibregl-ctrl-terrain",this._container),f("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){st(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}_toggleTerrain(){this._map.hasTerrain()?this._map.disableTerrain():this._map.enableTerrain(),this._updateTerrainIcon()}_updateTerrainIcon(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.hasTerrain()?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))}}class M extends n.NavigationControl{onAdd(t){return super.onAdd(t)}}class lt extends M{constructor(){super({showCompass:!0,showZoom:!0,visualizePitch:!0}),this._compass.removeEventListener("click",this._compass.clickFunction),this._compass.addEventListener("click",t=>{this._map.getPitch()===0?this._map.easeTo({pitch:Math.min(this._map.getMaxPitch(),80)}):this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})})}_createButton(t,e){const i=super._createButton(t,e);return i.clickFunction=e,i}_rotateCompassArrow(){const t=this.options.visualizePitch?`scale(${Math.min(1.5,1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5))}) 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)`;this._compassIcon.style.transform=t}}class O extends n.GeolocateControl{onAdd(t){return super.onAdd(t)}}var ct=Object.defineProperty,ht=Object.defineProperties,ut=Object.getOwnPropertyDescriptors,U=Object.getOwnPropertySymbols,dt=Object.prototype.hasOwnProperty,gt=Object.prototype.propertyIsEnumerable,k=(r,t,e)=>t in r?ct(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,pt=(r,t)=>{for(var e in t||(t={}))dt.call(t,e)&&k(r,e,t[e]);if(U)for(var e of U(t))gt.call(t,e)&&k(r,e,t[e]);return r},mt=(r,t)=>ht(r,ut(t));const B=n.Marker,$=n.LngLat;class G extends O{constructor(){super(...arguments),this.lastUpdatedCenter=new $(0,0)}_updateCamera(t){const e=new $(t.coords.longitude,t.coords.latitude),i=t.coords.accuracy,h=this._map.getBearing(),g=mt(pt({bearing:h},this.options.fitBoundsOptions),{linear:!0}),l=this._map.getZoom();l>this.options.fitBoundsOptions.maxZoom&&(g.zoom=l),this._map.fitBounds(e.toBounds(i),g,{geolocateSource:!0});let a=!1;const o=()=>{a=!0};this._map.once("click",o),this._map.once("dblclick",o),this._map.once("dragstart",o),this._map.once("mousedown",o),this._map.once("touchstart",o),this._map.once("wheel",o),this._map.once("moveend",()=>{this._map.off("click",o),this._map.off("dblclick",o),this._map.off("dragstart",o),this._map.off("mousedown",o),this._map.off("touchstart",o),this._map.off("wheel",o),!a&&(this.lastUpdatedCenter=this._map.getCenter())})}_setupUI(t){if(this.lastUpdatedCenter=this._map.getCenter(),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this._geolocateButton=f("button","maplibregl-ctrl-geolocate",this._container),f("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",t===!1){const e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}else{const e=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=f("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new B(this._dotElement),this._circleElement=f("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new B({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("move",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("moveend",e=>{const i=e.originalEvent&&e.originalEvent.type==="resize",h=this.lastUpdatedCenter.distanceTo(this._map.getCenter());!e.geolocateSource&&this._watchState==="ACTIVE_LOCK"&&!i&&h>1&&(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new Event("trackuserlocationend")))})}_updateCircleRadius(){if(this._watchState!=="BACKGROUND"&&this._watchState!=="ACTIVE_LOCK")return;const t=[this._lastKnownPosition.coords.longitude,this._lastKnownPosition.coords.latitude],e=this._map.project(t),i=this._map.unproject([e.x,e.y]),h=this._map.unproject([e.x+20,e.y]),g=i.distanceTo(h)/20,l=Math.ceil(2*this._accuracy/g);this._circleElement.style.width=`${l}px`,this._circleElement.style.height=`${l}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}}class H extends n.AttributionControl{onAdd(t){return super.onAdd(t)}}class j extends n.ScaleControl{onAdd(t){return super.onAdd(t)}}class K extends n.FullscreenControl{onAdd(t){return super.onAdd(t)}}var yt=Object.defineProperty,At=Object.defineProperties,Lt=Object.getOwnPropertyDescriptors,D=Object.getOwnPropertySymbols,St=Object.prototype.hasOwnProperty,ft=Object.prototype.propertyIsEnumerable,V=(r,t,e)=>t in r?yt(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,F=(r,t)=>{for(var e in t||(t={}))St.call(t,e)&&V(r,e,t[e]);if(D)for(var e of D(t))ft.call(t,e)&&V(r,e,t[e]);return r},z=(r,t)=>At(r,Lt(t)),C=(r,t,e)=>new Promise((i,h)=>{var g=o=>{try{a(e.next(o))}catch(d){h(d)}},l=o=>{try{a(e.throw(o))}catch(d){h(d)}},a=o=>o.done?i(o.value):Promise.resolve(o.value).then(g,l);a((e=e.apply(r,t)).next())});const J=W(),Z={POINT:"POINT",COUNTRY:"COUNTRY"};class _t extends n.Map{constructor(t){var e,i;t.apiKey&&(y.apiKey=t.apiKey);const h=R(t.style),g=location.hash;y.apiKey||console.warn("MapTiler Cloud API key is not set. Visit https://maptiler.com and try Cloud for free!"),super(z(F({},t),{style:h,maplibreLogo:!1,transformRequest:l=>{let a=null;try{a=new URL(l)}catch{return{url:l,headers:{}}}return a.host===p.maptilerApiHost&&(a.searchParams.has("key")||a.searchParams.append("key",y.apiKey),y.session&&a.searchParams.append("mtsid",J)),{url:a.href,headers:{}}}})),this.isTerrainEnabled=!1,this.terrainExaggeration=1,this.primaryLanguage=null,this.secondaryLanguage=null,this.primaryLanguage=(e=t.language)!=null?e:y.primaryLanguage,this.secondaryLanguage=y.secondaryLanguage,this.once("styledata",()=>C(this,null,function*(){if(!t.geolocate||t.center||t.hash&&!!g)return;try{if(t.geolocate===Z.COUNTRY){yield this.fitToIpBounds();return}}catch(a){console.warn(a.message)}let l=null;try{yield this.centerOnIpPoint(t.zoom),l=this.getCameraHash()}catch(a){console.warn(a.message)}(yield navigator.permissions.query({name:"geolocation"})).state==="granted"&&navigator.geolocation.getCurrentPosition(a=>{l===this.getCameraHash()&&this.easeTo({center:[a.coords.longitude,a.coords.latitude],zoom:t.zoom||12,duration:2e3})},null,{maximumAge:24*3600*1e3,timeout:5e3,enableHighAccuracy:!1})})),this.on("styledata",()=>{this.setPrimaryLanguage(this.primaryLanguage),this.setSecondaryLanguage(this.secondaryLanguage)}),this.on("styledata",()=>{this.getTerrain()===null&&this.isTerrainEnabled&&this.enableTerrain(this.terrainExaggeration)}),this.once("load",()=>C(this,null,function*(){ot()})),this.once("load",()=>C(this,null,function*(){let l={logo:null};try{const a=Object.keys(this.style.sourceCaches).map(d=>this.getSource(d)).filter(d=>typeof d.url=="string"&&d.url.includes("tiles.json")),o=new URL(a[0].url);o.searchParams.has("key")||o.searchParams.append("key",y.apiKey),l=yield(yield fetch(o.href)).json()}catch{}if("logo"in l&&l.logo){const a=l.logo;this.addControl(new I({logoURL:a}),t.logoPosition),t.attributionControl===!1&&this.addControl(new H(t))}else t.maptilerLogo&&this.addControl(new I,t.logoPosition);if(t.scaleControl){const a=t.scaleControl===!0||t.scaleControl===void 0?"bottom-right":t.scaleControl,o=new j({unit:y.unit});this.addControl(o,a),y.on("unit",d=>{o.setUnit(d)})}if(t.navigationControl!==!1){const a=t.navigationControl===!0||t.navigationControl===void 0?"top-right":t.navigationControl;this.addControl(new lt,a)}if(t.geolocateControl!==!1){const a=t.geolocateControl===!0||t.geolocateControl===void 0?"top-right":t.geolocateControl;this.addControl(new G({positionOptions:{enableHighAccuracy:!0,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!0,showAccuracyCircle:!0,showUserLocation:!0}),a)}if(t.terrainControl){const a=t.terrainControl===!0||t.terrainControl===void 0?"top-right":t.terrainControl;this.addControl(new P,a)}if(t.fullscreenControl){const a=t.fullscreenControl===!0||t.fullscreenControl===void 0?"top-right":t.fullscreenControl;this.addControl(new K({}),a)}})),t.terrain&&this.enableTerrain((i=t.terrainExaggeration)!=null?i:this.terrainExaggeration)}setStyle(t,e){return super.setStyle(R(t),e)}setLanguage(t=p.primaryLanguage){if(t===S.AUTO)return this.setLanguage(b());this.setPrimaryLanguage(t)}setPrimaryLanguage(t=p.primaryLanguage){!E(t)||(this.primaryLanguage=t,this.onStyleReady(()=>{if(t===S.AUTO)return this.setPrimaryLanguage(b());const e=this.getStyle().layers,i=/^\s*{\s*name\s*(:\s*(\S*))?\s*}$/,h=/^\s*name\s*(:\s*(\S*))?\s*$/,g=/^\s*{\s*name\s*(:\s*(\S*))?\s*}(\s*){\s*name\s*(:\s*(\S*))?\s*}$/,l=/^(.*)({\s*name\s*(:\s*(\S*))?\s*})(.*)$/,a=t?`name:${t}`:"name",o=["case",["has",a],["get",a],["get","name:latin"]];for(let d=0;d<e.length;d+=1){const u=e[d],A=u.layout;if(!A||!A["text-field"])continue;const s=this.getLayoutProperty(u.id,"text-field");let m;if(Array.isArray(s)&&s.length>=2&&s[0].trim().toLowerCase()==="concat"){const c=s.slice();for(let _=0;_<s.length;_+=1){const L=s[_];if((typeof L=="string"||L instanceof String)&&i.exec(L.toString())){c[_]=o;break}else if(Array.isArray(L)&&L.length>=2&&L[0].trim().toLowerCase()==="get"&&h.exec(L[1].toString())){c[_]=o;break}else if(Array.isArray(L)&&L.length===4&&L[0].trim().toLowerCase()==="case"){c[_]=o;break}}this.setLayoutProperty(u.id,"text-field",c)}else if(Array.isArray(s)&&s.length>=2&&s[0].trim().toLowerCase()==="get"&&h.exec(s[1].toString())){const c=o;this.setLayoutProperty(u.id,"text-field",c)}else if((typeof s=="string"||s instanceof String)&&i.exec(s.toString())){const c=o;this.setLayoutProperty(u.id,"text-field",c)}else if(Array.isArray(s)&&s.length===4&&s[0].trim().toLowerCase()==="case"){const c=o;this.setLayoutProperty(u.id,"text-field",c)}else if((typeof s=="string"||s instanceof String)&&(m=g.exec(s.toString()))!==null){const c=`{${a}}${m[3]}{name${m[4]||""}}`;this.setLayoutProperty(u.id,"text-field",c)}else if((typeof s=="string"||s instanceof String)&&(m=l.exec(s.toString()))!==null){const c=`${m[1]}{${a}}${m[5]}`;this.setLayoutProperty(u.id,"text-field",c)}}}))}setSecondaryLanguage(t=p.secondaryLanguage){!E(t)||(this.secondaryLanguage=t,this.onStyleReady(()=>{if(t===S.AUTO)return this.setSecondaryLanguage(b());const e=this.getStyle().layers,i=/^\s*{\s*name\s*(:\s*(\S*))?\s*}$/,h=/^\s*name\s*(:\s*(\S*))?\s*$/,g=/^\s*{\s*name\s*(:\s*(\S*))?\s*}(\s*){\s*name\s*(:\s*(\S*))?\s*}$/;let l;for(let a=0;a<e.length;a+=1){const o=e[a],d=o.layout;if(!d||!d["text-field"])continue;const u=this.getLayoutProperty(o.id,"text-field");let A;if(Array.isArray(u)&&u.length>=2&&u[0].trim().toLowerCase()==="concat"){A=u.slice();let s=0;for(let m=0;m<u.length;m+=1){const c=u[m];if((typeof c=="string"||c instanceof String)&&i.exec(c.toString())){if(s===1){A[m]=`{name:${t}}`;break}s+=1}else if(Array.isArray(c)&&c.length>=2&&c[0].trim().toLowerCase()==="get"&&h.exec(c[1].toString())){if(s===1){A[m][1]=`name:${t}`;break}s+=1}else if(Array.isArray(c)&&c.length===4&&c[0].trim().toLowerCase()==="case"){if(s===1){A[m]=["get",`name:${t}`];break}s+=1}}this.setLayoutProperty(o.id,"text-field",A)}else if((typeof u=="string"||u instanceof String)&&(l=g.exec(u.toString()))!==null){const s=t?`name:${t}`:"name";A=`{name${l[1]||""}}${l[3]}{${s}}`,this.setLayoutProperty(o.id,"text-field",A)}}}))}getPrimaryLanguage(){return this.primaryLanguage}getSecondaryLanguage(){return this.secondaryLanguage}getTerrainExaggeration(){return this.terrainExaggeration}hasTerrain(){return this.isTerrainEnabled}enableTerrain(t=this.terrainExaggeration){if(t<0){console.warn("Terrain exaggeration cannot be negative.");return}const e=this.getTerrain(),i=()=>{this.isTerrainEnabled=!0,this.terrainExaggeration=t,this.addSource(p.terrainSourceId,{type:"raster-dem",url:p.terrainSourceURL}),this.setTerrain({source:p.terrainSourceId,exaggeration:t})};if(e){this.setTerrain(z(F({},e),{exaggeration:t}));return}this.loaded()||this.isTerrainEnabled?i():this.once("load",()=>{this.getTerrain()&&this.getSource(p.terrainSourceId)||i()})}disableTerrain(){this.isTerrainEnabled=!1,this.setTerrain(null),this.getSource(p.terrainSourceId)&&this.removeSource(p.terrainSourceId)}setTerrainExaggeration(t){this.enableTerrain(t)}onStyleReady(t){this.isStyleLoaded()?t():this.once("styledata",()=>{t()})}fitToIpBounds(){return C(this,null,function*(){const t=yield v.info();this.fitBounds(t.country_bounds,{duration:0,padding:100})})}centerOnIpPoint(t){return C(this,null,function*(){const e=yield v.info();this.jumpTo({center:[e.longitude,e.latitude],zoom:t||11})})}getCameraHash(){const t=new Float32Array(5),e=this.getCenter();return t[0]=e.lng,t[1]=e.lat,t[2]=this.getZoom(),t[3]=this.getPitch(),t[4]=this.getBearing(),q.fromUint8Array(new Uint8Array(t.buffer))}getSdkConfig(){return y}getMaptilerSessionId(){return J}}class Ct extends n.Marker{addTo(t){return super.addTo(t)}}class xt extends n.Popup{addTo(t){return super.addTo(t)}}class Tt extends n.Style{constructor(t,e={}){super(t,e)}}class bt extends n.CanvasSource{onAdd(t){super.onAdd(t)}}class It extends n.GeoJSONSource{onAdd(t){super.onAdd(t)}}class vt extends n.ImageSource{onAdd(t){super.onAdd(t)}}class Et extends n.RasterTileSource{onAdd(t){super.onAdd(t)}}class Nt extends n.RasterDEMTileSource{onAdd(t){super.onAdd(t)}}class wt extends n.VectorTileSource{onAdd(t){super.onAdd(t)}}class Rt extends n.VideoSource{onAdd(t){super.onAdd(t)}}class Pt extends n.TerrainControl{onAdd(t){return super.onAdd(t)}}class x{constructor(t,e){this.x=t,this.y=e}_matMult(t){const e=t[0]*this.x+t[1]*this.y,i=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=i,this}_add(t){return this.x+=t.x,this.y+=t.y,this}_sub(t){return this.x-=t.x,this.y-=t.y,this}_mult(t){return this.x*=t,this.y*=t,this}_div(t){return this.x/=t,this.y/=t,this}_multByPoint(t){return this.x*=t.x,this.y*=t.y,this}_divByPoint(t){return this.x/=t.x,this.y/=t.y,this}_unit(){return this._div(this.mag()),this}_perp(){const t=this.y;return this.y=this.x,this.x=-t,this}_rotate(t){const e=Math.cos(t),i=Math.sin(t),h=e*this.x-i*this.y,g=i*this.x+e*this.y;return this.x=h,this.y=g,this}_rotateAround(t,e){const i=Math.cos(t),h=Math.sin(t),g=e.x+i*(this.x-e.x)-h*(this.y-e.y),l=e.y+h*(this.x-e.x)+i*(this.y-e.y);return this.x=g,this.y=l,this}_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}clone(){return new x(this.x,this.y)}add(t){return this.clone()._add(t)}sub(t){return this.clone()._sub(t)}multByPoint(t){return this.clone()._multByPoint(t)}divByPoint(t){return this.clone()._divByPoint(t)}mult(t){return this.clone()._mult(t)}div(t){return this.clone()._div(t)}rotate(t){return this.clone()._rotate(t)}rotateAround(t,e){return this.clone()._rotateAround(t,e)}matMult(t){return this.clone()._matMult(t)}unit(){return this.clone()._unit()}perp(){return this.clone()._perp()}round(){return this.clone()._round()}mag(){return Math.sqrt(this.x*this.x+this.y*this.y)}equals(t){return this.x===t.x&&this.y===t.y}dist(t){return Math.sqrt(this.distSqr(t))}distSqr(t){const e=t.x-this.x,i=t.y-this.y;return e*e+i*i}angle(){return Math.atan2(this.y,this.x)}angleTo(t){return Math.atan2(this.y-t.y,this.x-t.x)}angleWith(t){return this.angleWithSep(t.x,t.y)}angleWithSep(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)}static convert(t){return t instanceof x?t:Array.isArray(t)?new x(t[0],t[1]):t}}const{supported:Mt,setRTLTextPlugin:Ot,getRTLTextPluginStatus:Ut,LngLat:kt,LngLatBounds:Bt,MercatorCoordinate:$t,Evented:Gt,AJAXError:Ht,prewarm:jt,clearPrewarmedResources:Kt,version:Dt,workerCount:Vt,maxParallelImageRequests:Ft,clearStorage:zt,workerUrl:Jt,addProtocol:Zt,removeProtocol:qt}=n,Wt=n.Map,Yt=n.Marker,Xt=n.Popup,Qt=n.Style,te=n.CanvasSource,ee=n.GeoJSONSource,re=n.ImageSource,ae=n.RasterTileSource,ne=n.RasterDEMTileSource,oe=n.VectorTileSource,ie=n.VideoSource;n.NavigationControl,n.GeolocateControl,n.AttributionControl,n.LogoControl,n.ScaleControl,n.FullscreenControl,n.TerrainControl;export{Ht as AJAXError,H as AttributionControl,bt as CanvasSource,te as CanvasSourceMLGL,Gt as Evented,K as FullscreenControl,It as GeoJSONSource,ee as GeoJSONSourceMLGL,O as GeolocateControl,Z as GeolocationType,vt as ImageSource,re as ImageSourceMLGL,S as Language,me as LanguageGeocoding,kt as LngLat,Bt as LngLatBounds,w as LogoControl,_t as Map,Wt as MapMLGL,ye as MapStyle,Ae as MapStyleVariant,G as MaptilerGeolocateControl,I as MaptilerLogoControl,P as MaptilerTerrainControl,Ct as Marker,Yt as MarkerMLGL,$t as MercatorCoordinate,M as NavigationControl,x as Point,xt as Popup,Xt as PopupMLGL,Nt as RasterDEMTileSource,ne as RasterDEMTileSourceMLGL,Et as RasterTileSource,ae as RasterTileSourceMLGL,Le as ReferenceMapStyle,j as ScaleControl,N as SdkConfig,Se as ServiceError,Tt as Style,Qt as StyleMLGL,Pt as TerrainControl,wt as VectorTileSource,oe as VectorTileSourceMLGL,Rt as VideoSource,ie as VideoSourceMLGL,Zt as addProtocol,Kt as clearPrewarmedResources,zt as clearStorage,y as config,fe as coordinates,_e as data,Ce as geocoding,xe as geolocation,Ut as getRTLTextPluginStatus,Ft as maxParallelImageRequests,jt as prewarm,qt as removeProtocol,Ot as setRTLTextPlugin,Te as staticMaps,Mt as supported,Dt as version,Vt as workerCount,Jt as workerUrl};
@@ -142,7 +142,13 @@ const defaults = {
142
142
  };
143
143
  Object.freeze(defaults);
144
144
 
145
- class MaptilerLogoControl extends maplibregl__default.LogoControl {
145
+ class LogoControl extends maplibregl__default.LogoControl {
146
+ onAdd(map) {
147
+ return super.onAdd(map);
148
+ }
149
+ }
150
+
151
+ class MaptilerLogoControl extends LogoControl {
146
152
  constructor(options = {}) {
147
153
  var _a, _b;
148
154
  super(options);
@@ -287,7 +293,13 @@ class MaptilerTerrainControl {
287
293
  }
288
294
  }
289
295
 
290
- class MaptilerNavigationControl extends maplibregl__default.NavigationControl {
296
+ class NavigationControl extends maplibregl__default.NavigationControl {
297
+ onAdd(map) {
298
+ return super.onAdd(map);
299
+ }
300
+ }
301
+
302
+ class MaptilerNavigationControl extends NavigationControl {
291
303
  constructor() {
292
304
  super({
293
305
  showCompass: true,
@@ -327,6 +339,12 @@ class MaptilerNavigationControl extends maplibregl__default.NavigationControl {
327
339
  }
328
340
  }
329
341
 
342
+ class GeolocateControl extends maplibregl__default.GeolocateControl {
343
+ onAdd(map) {
344
+ return super.onAdd(map);
345
+ }
346
+ }
347
+
330
348
  var __defProp$1 = Object.defineProperty;
331
349
  var __defProps$1 = Object.defineProperties;
332
350
  var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
@@ -346,10 +364,9 @@ var __spreadValues$1 = (a, b) => {
346
364
  return a;
347
365
  };
348
366
  var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
349
- const GeolocateControl$1 = maplibregl__default.GeolocateControl;
350
367
  const Marker$1 = maplibregl__default.Marker;
351
368
  const LngLat$1 = maplibregl__default.LngLat;
352
- class MaptilerGeolocateControl extends GeolocateControl$1 {
369
+ class MaptilerGeolocateControl extends GeolocateControl {
353
370
  constructor() {
354
371
  super(...arguments);
355
372
  this.lastUpdatedCenter = new LngLat$1(0, 0);
@@ -491,6 +508,24 @@ class MaptilerGeolocateControl extends GeolocateControl$1 {
491
508
  }
492
509
  }
493
510
 
511
+ class AttributionControl extends maplibregl__default.AttributionControl {
512
+ onAdd(map) {
513
+ return super.onAdd(map);
514
+ }
515
+ }
516
+
517
+ class ScaleControl extends maplibregl__default.ScaleControl {
518
+ onAdd(map) {
519
+ return super.onAdd(map);
520
+ }
521
+ }
522
+
523
+ class FullscreenControl extends maplibregl__default.FullscreenControl {
524
+ onAdd(map) {
525
+ return super.onAdd(map);
526
+ }
527
+ }
528
+
494
529
  var __defProp = Object.defineProperty;
495
530
  var __defProps = Object.defineProperties;
496
531
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
@@ -575,8 +610,6 @@ class Map extends maplibregl__default.Map {
575
610
  };
576
611
  }
577
612
  }));
578
- this.languageShouldUpdate = false;
579
- this.isStyleInitialized = false;
580
613
  this.isTerrainEnabled = false;
581
614
  this.terrainExaggeration = 1;
582
615
  this.primaryLanguage = null;
@@ -584,7 +617,7 @@ class Map extends maplibregl__default.Map {
584
617
  this.primaryLanguage = (_a = options.language) != null ? _a : config.primaryLanguage;
585
618
  this.secondaryLanguage = config.secondaryLanguage;
586
619
  this.once("styledata", () => __async(this, null, function* () {
587
- if (options.geolocate === false) {
620
+ if (!options.geolocate) {
588
621
  return;
589
622
  }
590
623
  if (options.center) {
@@ -667,14 +700,14 @@ class Map extends maplibregl__default.Map {
667
700
  options.logoPosition
668
701
  );
669
702
  if (options.attributionControl === false) {
670
- this.addControl(new maplibregl__default.AttributionControl(options));
703
+ this.addControl(new AttributionControl(options));
671
704
  }
672
705
  } else if (options.maptilerLogo) {
673
706
  this.addControl(new MaptilerLogoControl(), options.logoPosition);
674
707
  }
675
708
  if (options.scaleControl) {
676
709
  const position = options.scaleControl === true || options.scaleControl === void 0 ? "bottom-right" : options.scaleControl;
677
- const scaleControl = new maplibregl__default.ScaleControl({ unit: config.unit });
710
+ const scaleControl = new ScaleControl({ unit: config.unit });
678
711
  this.addControl(scaleControl, position);
679
712
  config.on("unit", (unit) => {
680
713
  scaleControl.setUnit(unit);
@@ -709,7 +742,7 @@ class Map extends maplibregl__default.Map {
709
742
  }
710
743
  if (options.fullscreenControl) {
711
744
  const position = options.fullscreenControl === true || options.fullscreenControl === void 0 ? "top-right" : options.fullscreenControl;
712
- this.addControl(new maplibregl__default.FullscreenControl({}), position);
745
+ this.addControl(new FullscreenControl({}), position);
713
746
  }
714
747
  }));
715
748
  if (options.terrain) {
@@ -968,6 +1001,72 @@ class Map extends maplibregl__default.Map {
968
1001
  }
969
1002
  }
970
1003
 
1004
+ class Marker extends maplibregl__default.Marker {
1005
+ addTo(map) {
1006
+ return super.addTo(map);
1007
+ }
1008
+ }
1009
+
1010
+ class Popup extends maplibregl__default.Popup {
1011
+ addTo(map) {
1012
+ return super.addTo(map);
1013
+ }
1014
+ }
1015
+
1016
+ class Style extends maplibregl__default.Style {
1017
+ constructor(map, options = {}) {
1018
+ super(map, options);
1019
+ }
1020
+ }
1021
+
1022
+ class CanvasSource extends maplibregl__default.CanvasSource {
1023
+ onAdd(map) {
1024
+ super.onAdd(map);
1025
+ }
1026
+ }
1027
+
1028
+ class GeoJSONSource extends maplibregl__default.GeoJSONSource {
1029
+ onAdd(map) {
1030
+ super.onAdd(map);
1031
+ }
1032
+ }
1033
+
1034
+ class ImageSource extends maplibregl__default.ImageSource {
1035
+ onAdd(map) {
1036
+ super.onAdd(map);
1037
+ }
1038
+ }
1039
+
1040
+ class RasterTileSource extends maplibregl__default.RasterTileSource {
1041
+ onAdd(map) {
1042
+ super.onAdd(map);
1043
+ }
1044
+ }
1045
+
1046
+ class RasterDEMTileSource extends maplibregl__default.RasterDEMTileSource {
1047
+ onAdd(map) {
1048
+ super.onAdd(map);
1049
+ }
1050
+ }
1051
+
1052
+ class VectorTileSource extends maplibregl__default.VectorTileSource {
1053
+ onAdd(map) {
1054
+ super.onAdd(map);
1055
+ }
1056
+ }
1057
+
1058
+ class VideoSource extends maplibregl__default.VideoSource {
1059
+ onAdd(map) {
1060
+ super.onAdd(map);
1061
+ }
1062
+ }
1063
+
1064
+ class TerrainControl extends maplibregl__default.TerrainControl {
1065
+ onAdd(map) {
1066
+ return super.onAdd(map);
1067
+ }
1068
+ }
1069
+
971
1070
  class Point {
972
1071
  constructor(x, y) {
973
1072
  this.x = x;
@@ -1123,28 +1222,11 @@ const {
1123
1222
  supported,
1124
1223
  setRTLTextPlugin,
1125
1224
  getRTLTextPluginStatus,
1126
- NavigationControl,
1127
- GeolocateControl,
1128
- AttributionControl,
1129
- LogoControl,
1130
- ScaleControl,
1131
- FullscreenControl,
1132
- TerrainControl,
1133
- Popup,
1134
- Marker,
1135
- Style,
1136
1225
  LngLat,
1137
1226
  LngLatBounds,
1138
1227
  MercatorCoordinate,
1139
1228
  Evented,
1140
1229
  AJAXError,
1141
- CanvasSource,
1142
- GeoJSONSource,
1143
- ImageSource,
1144
- RasterDEMTileSource,
1145
- RasterTileSource,
1146
- VectorTileSource,
1147
- VideoSource,
1148
1230
  prewarm,
1149
1231
  clearPrewarmedResources,
1150
1232
  version,
@@ -1155,6 +1237,24 @@ const {
1155
1237
  addProtocol,
1156
1238
  removeProtocol
1157
1239
  } = maplibregl__default;
1240
+ const MapMLGL = maplibregl__default.Map;
1241
+ const MarkerMLGL = maplibregl__default.Marker;
1242
+ const PopupMLGL = maplibregl__default.Popup;
1243
+ const StyleMLGL = maplibregl__default.Style;
1244
+ const CanvasSourceMLGL = maplibregl__default.CanvasSource;
1245
+ const GeoJSONSourceMLGL = maplibregl__default.GeoJSONSource;
1246
+ const ImageSourceMLGL = maplibregl__default.ImageSource;
1247
+ const RasterTileSourceMLGL = maplibregl__default.RasterTileSource;
1248
+ const RasterDEMTileSourceMLGL = maplibregl__default.RasterDEMTileSource;
1249
+ const VectorTileSourceMLGL = maplibregl__default.VectorTileSource;
1250
+ const VideoSourceMLGL = maplibregl__default.VideoSource;
1251
+ maplibregl__default.NavigationControl;
1252
+ maplibregl__default.GeolocateControl;
1253
+ maplibregl__default.AttributionControl;
1254
+ maplibregl__default.LogoControl;
1255
+ maplibregl__default.ScaleControl;
1256
+ maplibregl__default.FullscreenControl;
1257
+ maplibregl__default.TerrainControl;
1158
1258
 
1159
- export { AJAXError, AttributionControl, CanvasSource, Evented, FullscreenControl, GeoJSONSource, GeolocateControl, GeolocationType, ImageSource, Language, LngLat, LngLatBounds, LogoControl, Map, MaptilerGeolocateControl, MaptilerLogoControl, MaptilerTerrainControl, Marker, MercatorCoordinate, NavigationControl, Point, Popup, RasterDEMTileSource, RasterTileSource, ScaleControl, SdkConfig, Style, TerrainControl, VectorTileSource, VideoSource, addProtocol, clearPrewarmedResources, clearStorage, config, getRTLTextPluginStatus, maxParallelImageRequests, prewarm, removeProtocol, setRTLTextPlugin, supported, version, workerCount, workerUrl };
1259
+ export { AJAXError, AttributionControl, CanvasSource, CanvasSourceMLGL, Evented, FullscreenControl, GeoJSONSource, GeoJSONSourceMLGL, GeolocateControl, GeolocationType, ImageSource, ImageSourceMLGL, Language, LngLat, LngLatBounds, LogoControl, Map, MapMLGL, MaptilerGeolocateControl, MaptilerLogoControl, MaptilerTerrainControl, Marker, MarkerMLGL, MercatorCoordinate, NavigationControl, Point, Popup, PopupMLGL, RasterDEMTileSource, RasterDEMTileSourceMLGL, RasterTileSource, RasterTileSourceMLGL, ScaleControl, SdkConfig, Style, StyleMLGL, TerrainControl, VectorTileSource, VectorTileSourceMLGL, VideoSource, VideoSourceMLGL, addProtocol, clearPrewarmedResources, clearStorage, config, getRTLTextPluginStatus, maxParallelImageRequests, prewarm, removeProtocol, setRTLTextPlugin, supported, version, workerCount, workerUrl };
1160
1260
  //# sourceMappingURL=maptiler-sdk.mjs.map