@maptiler/sdk 2.2.0 → 2.2.1

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,6 @@
1
1
  import maplibregl__default, { LineLayerSpecification, FillLayerSpecification, StyleSpecification, ControlPosition, MapOptions as MapOptions$1, StyleSwapOptions, StyleOptions, LayerSpecification, SourceSpecification, CustomLayerInterface, FilterSpecification, StyleSetterOptions, RequestTransformFunction, Map as Map$1, GestureOptions, LogoControlOptions as LogoControlOptions$1, IControl } from 'maplibre-gl';
2
2
  export * from 'maplibre-gl';
3
+ export { AJAXError, AttributionControl as AttributionControlMLGL, BoxZoomHandler as BoxZoomHandlerMLGL, CanvasSource as CanvasSourceMLGL, CooperativeGesturesHandler as CooperativeGesturesHandlerMLGL, DoubleClickZoomHandler, DragPanHandler, DragRotateHandler, EdgeInsets, Evented, FullscreenControl as FullscreenControlMLGL, GeoJSONSource as GeoJSONSourceMLGL, GeolocateControl as GeolocateControlMLGL, Hash, ImageSource as ImageSourceMLGL, KeyboardHandler as KeyboardHandlerMLGL, LngLat, LngLatBounds, LogoControl as LogoControlMLGL, Map as MapMLGL, MapMouseEvent as MapMouseEventMLGL, MapTouchEvent as MapTouchEventMLGL, MapWheelEvent as MapWheelEventMLGL, Marker as MarkerMLGL, MercatorCoordinate, NavigationControl as NavigationControlMLGL, Point, Popup as PopupMLGL, RasterDEMTileSource as RasterDEMTileSourceMLGL, RasterTileSource as RasterTileSourceMLGL, ScaleControl as ScaleControlMLGL, ScrollZoomHandler as ScrollZoomHandlerMLGL, Style as StyleMLGL, TerrainControl as TerrainControlMLGL, TwoFingersTouchPitchHandler as TwoFingersTouchPitchHandlerMLGL, TwoFingersTouchRotateHandler, TwoFingersTouchZoomHandler, TwoFingersTouchZoomRotateHandler, VectorTileSource as VectorTileSourceMLGL, VideoSource as VideoSourceMLGL, addProtocol, addSourceType, clearPrewarmedResources, config as configMLGL, getVersion as getMapLibreVersion, getMaxParallelImageRequests, getRTLTextPluginStatus, getWorkerCount, getWorkerUrl, importScriptInWorkers, prewarm, removeProtocol, setMaxParallelImageRequests, setRTLTextPlugin, setWorkerCount, setWorkerUrl } from 'maplibre-gl';
3
4
  import { FetchFunction, ReferenceMapStyle, MapStyleVariant } from '@maptiler/client';
4
5
  export { AutomaticStaticMapOptions, BoundedStaticMapOptions, BufferToPixelDataFunction, ByIdGeocodingOptions, CenteredStaticMapOptions, CommonForwardAndReverseGeocodingOptions, CoordinateExport, CoordinateGrid, CoordinateId, CoordinateSearch, CoordinateSearchResult, CoordinateTransformResult, CoordinateTransformation, Coordinates, CoordinatesSearchOptions, CoordinatesTransformOptions, DefaultTransformation, ElevationAtOptions, ElevationBatchOptions, FeatureHierarchy, FetchFunction, GeocodingFeature, GeocodingOptions, GeocodingSearchResult, GeolocationInfoOptions, GeolocationResult, GetDataOptions, LanguageGeocoding, LanguageGeocodingOptions, LanguageGeocodingString, MapStyle, MapStylePreset, MapStyleType, MapStyleVariant, PixelData, ReferenceMapStyle, ReverseGeocodingOptions, ServiceError, StaticMapBaseOptions, StaticMapMarker, TileJSON, XYZ, bufferToPixelDataBrowser, circumferenceAtLatitude, coordinates, data, elevation, expandMapStyle, geocoding, geolocation, getAutoLanguageGeocoding, getBufferToPixelDataParser, getTileCache, mapStylePresetList, math, misc, staticMaps, styleToStyle } from '@maptiler/client';
5
6
  import EventEmitter from 'events';
@@ -209,7 +210,7 @@ declare class SdkConfig extends EventEmitter {
209
210
  */
210
211
  get fetch(): FetchFunction | null;
211
212
  }
212
- declare const config$1: SdkConfig;
213
+ declare const config: SdkConfig;
213
214
 
214
215
  /**
215
216
  * This is an extension adds support for adding a minimap to one of the map's control containers.
@@ -1776,76 +1777,9 @@ declare const helpers: {
1776
1777
  addHeatmap: typeof addHeatmap;
1777
1778
  };
1778
1779
 
1779
- declare const setRTLTextPlugin: typeof maplibregl__default.setRTLTextPlugin;
1780
- declare const getRTLTextPluginStatus: typeof maplibregl__default.getRTLTextPluginStatus;
1781
- declare const LngLat: typeof maplibregl__default.LngLat;
1782
- declare const LngLatBounds: typeof maplibregl__default.LngLatBounds;
1783
- declare const MercatorCoordinate: typeof maplibregl__default.MercatorCoordinate;
1784
- declare const Evented: typeof maplibregl__default.Evented;
1785
- declare const AJAXError: typeof maplibregl__default.AJAXError;
1786
- declare const prewarm: typeof maplibregl__default.prewarm;
1787
- declare const clearPrewarmedResources: typeof maplibregl__default.clearPrewarmedResources;
1788
- declare const addProtocol: typeof maplibregl__default.addProtocol;
1789
- declare const removeProtocol: typeof maplibregl__default.removeProtocol;
1790
- declare const Hash: typeof maplibregl__default.Hash;
1791
- declare const Point: typeof maplibregl__default.Point;
1792
- declare const config: maplibregl__default.Config;
1793
- declare const EdgeInsets: typeof maplibregl__default.EdgeInsets;
1794
- declare const DragRotateHandler: typeof maplibregl__default.DragRotateHandler;
1795
- declare const DragPanHandler: typeof maplibregl__default.DragPanHandler;
1796
- declare const TwoFingersTouchZoomRotateHandler: typeof maplibregl__default.TwoFingersTouchZoomRotateHandler;
1797
- declare const DoubleClickZoomHandler: typeof maplibregl__default.DoubleClickZoomHandler;
1798
- declare const TwoFingersTouchZoomHandler: typeof maplibregl__default.TwoFingersTouchZoomHandler;
1799
- declare const TwoFingersTouchRotateHandler: typeof maplibregl__default.TwoFingersTouchRotateHandler;
1800
- declare const getWorkerCount: typeof maplibregl__default.getWorkerCount;
1801
- declare const setWorkerCount: typeof maplibregl__default.setWorkerCount;
1802
- declare const getMaxParallelImageRequests: typeof maplibregl__default.getMaxParallelImageRequests;
1803
- declare const setMaxParallelImageRequests: typeof maplibregl__default.setMaxParallelImageRequests;
1804
- declare const getWorkerUrl: typeof maplibregl__default.getWorkerUrl;
1805
- declare const setWorkerUrl: typeof maplibregl__default.setWorkerUrl;
1806
- declare const addSourceType: (name: string, SourceType: maplibregl__default.SourceClass) => Promise<void>;
1807
- declare const importScriptInWorkers: typeof maplibregl__default.importScriptInWorkers;
1808
1780
  /**
1809
1781
  * Get the version of MapTiler SDK
1810
1782
  */
1811
1783
  declare function getVersion(): string;
1812
- /**
1813
- * Get the version of MapLibre GL JS
1814
- */
1815
- declare function getMapLibreVersion(): string;
1816
- declare const MapMLGL: typeof maplibregl__default.Map;
1817
- declare const MarkerMLGL: typeof maplibregl__default.Marker;
1818
- declare const PopupMLGL: typeof maplibregl__default.Popup;
1819
- declare const StyleMLGL: typeof maplibregl__default.Style;
1820
- declare const CanvasSourceMLGL: typeof maplibregl__default.CanvasSource;
1821
- declare const GeoJSONSourceMLGL: typeof maplibregl__default.GeoJSONSource;
1822
- declare const ImageSourceMLGL: typeof maplibregl__default.ImageSource;
1823
- declare const RasterTileSourceMLGL: typeof maplibregl__default.RasterTileSource;
1824
- declare const RasterDEMTileSourceMLGL: typeof maplibregl__default.RasterDEMTileSource;
1825
- declare const VectorTileSourceMLGL: typeof maplibregl__default.VectorTileSource;
1826
- declare const VideoSourceMLGL: typeof maplibregl__default.VideoSource;
1827
- declare const BoxZoomHandlerMLGL: typeof maplibregl__default.BoxZoomHandler;
1828
- declare const ScrollZoomHandlerMLGL: typeof maplibregl__default.ScrollZoomHandler;
1829
- declare const CooperativeGesturesHandlerMLGL: typeof maplibregl__default.CooperativeGesturesHandler;
1830
- declare const KeyboardHandlerMLGL: typeof maplibregl__default.KeyboardHandler;
1831
- declare const TwoFingersTouchPitchHandlerMLGL: typeof maplibregl__default.TwoFingersTouchPitchHandler;
1832
- declare const MapWheelEventMLGL: typeof maplibregl__default.MapWheelEvent;
1833
- declare const MapTouchEventMLGL: typeof maplibregl__default.MapTouchEvent;
1834
- declare const MapMouseEventMLGL: typeof maplibregl__default.MapMouseEvent;
1835
-
1836
- declare const NavigationControlMLGL: typeof maplibregl__default.NavigationControl;
1837
- type NavigationControlMLGL = InstanceType<typeof NavigationControlMLGL>;
1838
- declare const GeolocateControlMLGL: typeof maplibregl__default.GeolocateControl;
1839
- type GeolocateControlMLGL = InstanceType<typeof GeolocateControlMLGL>;
1840
- declare const AttributionControlMLGL: typeof maplibregl__default.AttributionControl;
1841
- type AttributionControlMLGL = InstanceType<typeof AttributionControlMLGL>;
1842
- declare const LogoControlMLGL: typeof maplibregl__default.LogoControl;
1843
- type LogoControlMLGL = InstanceType<typeof LogoControlMLGL>;
1844
- declare const ScaleControlMLGL: typeof maplibregl__default.ScaleControl;
1845
- type ScaleControlMLGL = InstanceType<typeof ScaleControlMLGL>;
1846
- declare const FullscreenControlMLGL: typeof maplibregl__default.FullscreenControl;
1847
- type FullscreenControlMLGL = InstanceType<typeof FullscreenControlMLGL>;
1848
- declare const TerrainControlMLGL: typeof maplibregl__default.TerrainControl;
1849
- type TerrainControlMLGL = InstanceType<typeof TerrainControlMLGL>;
1850
-
1851
- export { AJAXError, type ArrayColor, type ArrayColorRamp, type ArrayColorRampStop, AttributionControl, AttributionControlMLGL, BoxZoomHandler, BoxZoomHandlerMLGL, CanvasSource, CanvasSourceMLGL, ColorRamp, ColorRampCollection, type ColorRampOptions, type ColorStop, type CommonShapeLayerOptions, CooperativeGesturesHandler, CooperativeGesturesHandlerMLGL, DoubleClickZoomHandler, DragPanHandler, DragRotateHandler, EdgeInsets, Evented, FullscreenControl, FullscreenControlMLGL, GeoJSONSource, GeoJSONSourceMLGL, GeolocateControl, GeolocateControlMLGL, GeolocationType, Hash, type HeatmapLayerOptions, ImageSource, ImageSourceMLGL, KeyboardHandler, KeyboardHandlerMLGL, Language, type LanguageKey, type LanguageString, type Link, LngLat, LngLatBounds, type LoadWithTerrainEvent, LogoControl, LogoControlMLGL, Map, MapMLGL, MapMouseEvent, MapMouseEventMLGL, type MapOptions, MapTouchEvent, MapTouchEventMLGL, MapWheelEvent, MapWheelEventMLGL, MaptilerGeolocateControl, MaptilerLogoControl, MaptilerNavigationControl, MaptilerTerrainControl, Marker, MarkerMLGL, MercatorCoordinate, type MinimapOptions, type MinimapOptionsInput, NavigationControl, NavigationControlMLGL, type ParentRect, type PlacemarkProperties, Point, type PointLayerOptions, type PolygonLayerOptions, type PolylineLayerOptions, Popup, PopupMLGL, type PropertyValues, RasterDEMTileSource, RasterDEMTileSourceMLGL, RasterTileSource, RasterTileSourceMLGL, type RgbaColor, ScaleControl, ScaleControlMLGL, ScrollZoomHandler, ScrollZoomHandlerMLGL, SdkConfig, Style, StyleMLGL, TerrainControl, TerrainControlMLGL, TwoFingersTouchPitchHandler, TwoFingersTouchPitchHandlerMLGL, TwoFingersTouchRotateHandler, TwoFingersTouchZoomHandler, TwoFingersTouchZoomRotateHandler, type Unit, VectorTileSource, VectorTileSourceMLGL, VideoSource, VideoSourceMLGL, type XMLProperties, type ZoomNumberValues, type ZoomStringValues, 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 };
1784
+
1785
+ export { type ArrayColor, type ArrayColorRamp, type ArrayColorRampStop, AttributionControl, BoxZoomHandler, CanvasSource, ColorRamp, ColorRampCollection, type ColorRampOptions, type ColorStop, type CommonShapeLayerOptions, CooperativeGesturesHandler, FullscreenControl, GeoJSONSource, GeolocateControl, GeolocationType, type HeatmapLayerOptions, ImageSource, KeyboardHandler, Language, type LanguageKey, type LanguageString, type Link, type LoadWithTerrainEvent, LogoControl, Map, MapMouseEvent, type MapOptions, MapTouchEvent, MapWheelEvent, MaptilerGeolocateControl, MaptilerLogoControl, MaptilerNavigationControl, MaptilerTerrainControl, Marker, type MinimapOptions, type MinimapOptionsInput, NavigationControl, type ParentRect, type PlacemarkProperties, type PointLayerOptions, type PolygonLayerOptions, type PolylineLayerOptions, Popup, type PropertyValues, RasterDEMTileSource, RasterTileSource, type RgbaColor, ScaleControl, ScrollZoomHandler, SdkConfig, Style, TerrainControl, TwoFingersTouchPitchHandler, type Unit, VectorTileSource, VideoSource, type XMLProperties, type ZoomNumberValues, type ZoomStringValues, config, getBrowserLanguage, getVersion, gpx, gpxOrKml, hasChildNodeWithName, helpers, isLanguageSupported, kml, str2xml, xml2str };
@@ -1,3 +1,3 @@
1
- import p from"maplibre-gl";import{Base64 as gt}from"js-base64";import yt from"events";import{config as re,expandMapStyle as vt,MapStyleVariant as ft,ReferenceMapStyle as Lt,MapStyle as At,mapStylePresetList as wt,geolocation as be}from"@maptiler/client";import{LanguageGeocoding as Or,MapStyle as Fr,MapStyleVariant as zr,ReferenceMapStyle as Br,ServiceError as $r,bufferToPixelDataBrowser as Ur,circumferenceAtLatitude as Hr,coordinates as Gr,data as Dr,elevation as Wr,expandMapStyle as jr,geocoding as Vr,geolocation as Kr,getAutoLanguageGeocoding as Zr,getBufferToPixelDataParser as Yr,getTileCache as qr,mapStylePresetList as Jr,math as Xr,misc as Qr,staticMaps as ea,styleToStyle as ta}from"@maptiler/client";import{v4 as Ct}from"uuid";var St="@maptiler/sdk",bt="2.2.0",Tt="The Javascript & TypeScript map SDK tailored for MapTiler Cloud",It="dist/maptiler-sdk.mjs",Rt="dist/maptiler-sdk.d.ts",Et="dist/maptiler-sdk.css",xt="module",_t={".":{import:"./dist/maptiler-sdk.mjs",types:"./dist/maptiler-sdk.d.ts"},"./dist/maptiler-sdk.css":{import:"./dist/maptiler-sdk.css"},"./style.css":{import:"./dist/maptiler-sdk.css"}},Nt=["maptiler","map","sdk","webmap","cloud","webGL","maplibre"],Pt="https://docs.maptiler.com/sdk-js/",Mt="BSD-3-Clause",kt={type:"git",url:"https://github.com/maptiler/maptiler-sdk-js.git"},Ot={build:"rm -rf dist/* && NODE_ENV=production rollup -c",dev:"rm -rf dist/* && NODE_ENV=development rollup -c -w",biome:"biome check --max-diagnostics=1000","biome:fix":"npx @biomejs/biome check --max-diagnostics=1000 --write",doc:"rm -rf docs/* && typedoc --out docs && cp -r images docs/",prepare:"npm run biome:fix && npm run build && npm run test","test:dev":"vitest dev",test:"vitest run"},Ft="MapTiler",zt={"@biomejs/biome":"1.8.3","@rollup/plugin-commonjs":"^26.0.1","@rollup/plugin-json":"^6.1.0","@rollup/plugin-node-resolve":"^15.2.3","@types/uuid":"^9.0.2","@types/xmldom":"^0.1.31",rollup:"^4.18.0","rollup-plugin-copy-merge":"^1.0.2","rollup-plugin-dts":"^6.1.1","rollup-plugin-esbuild":"^6.1.1","rollup-plugin-node-globals":"^1.4.0","rollup-plugin-shell":"^1.0.9","rollup-plugin-string":"^3.0.0","rollup-plugin-swc":"^0.2.1",serve:"^14.2.0",terser:"^5.17.1",typedoc:"^0.24.8",typescript:"^5.1.6",vitest:"^0.34.2",xmldom:"^0.6.0"},Bt={"@maptiler/client":"^1.8.1",events:"^3.3.0","js-base64":"^3.7.4","maplibre-gl":"4.4.1",uuid:"^9.0.0"},$t={name:St,version:bt,description:Tt,module:It,types:Rt,style:Et,type:xt,exports:_t,keywords:Nt,homepage:Pt,license:Mt,repository:kt,scripts:Ot,author:Ft,devDependencies:zt,dependencies:Bt};const w={VISITOR:"visitor",VISITOR_ENGLISH:"visitor_en",STYLE:"style",AUTO:"auto",STYLE_LOCK:"style_lock",LATIN:"name:latin",NON_LATIN:"name:nonlatin",LOCAL:"name",INTERNATIONAL:"name_int",ALBANIAN:"name:sq",AMHARIC:"name:am",ARABIC:"name:ar",ARMENIAN:"name:hy",AZERBAIJANI:"name:az",BASQUE:"name:eu",BELORUSSIAN:"name:be",BENGALI:"name:bn",BOSNIAN:"name:bs",BRETON:"name:br",BULGARIAN:"name:bg",CATALAN:"name:ca",CHINESE:"name:zh",TRADITIONAL_CHINESE:"name:zh-Hant",SIMPLIFIED_CHINESE:"name:zh-Hans",CORSICAN:"name:co",CROATIAN:"name:hr",CZECH:"name:cs",DANISH:"name:da",DUTCH:"name:nl",ENGLISH:"name:en",ESPERANTO:"name:eo",ESTONIAN:"name:et",FINNISH:"name:fi",FRENCH:"name:fr",FRISIAN:"name:fy",GEORGIAN:"name:ka",GERMAN:"name:de",GREEK:"name:el",HEBREW:"name:he",HINDI:"name:hi",HUNGARIAN:"name:hu",ICELANDIC:"name:is",INDONESIAN:"name:id",IRISH:"name:ga",ITALIAN:"name:it",JAPANESE:"name:ja",JAPANESE_HIRAGANA:"name:ja-Hira",JAPANESE_KANA:"name:ja_kana",JAPANESE_LATIN:"name:ja_rm",JAPANESE_2018:"name:ja-Latn",KANNADA:"name:kn",KAZAKH:"name:kk",KOREAN:"name:ko",KOREAN_LATIN:"name:ko-Latn",KURDISH:"name:ku",ROMAN_LATIN:"name:la",LATVIAN:"name:lv",LITHUANIAN:"name:lt",LUXEMBOURGISH:"name:lb",MACEDONIAN:"name:mk",MALAYALAM:"name:ml",MALTESE:"name:mt",NORWEGIAN:"name:no",OCCITAN:"name:oc",PERSIAN:"name:fa",POLISH:"name:pl",PORTUGUESE:"name:pt",PUNJABI:"name:pa",WESTERN_PUNJABI:"name:pnb",ROMANIAN:"name:ro",ROMANSH:"name:rm",RUSSIAN:"name:ru",SCOTTISH_GAELIC:"name:gd",SERBIAN_CYRILLIC:"name:sr",SERBIAN_LATIN:"name:sr-Latn",SLOVAK:"name:sk",SLOVENE:"name:sl",SPANISH:"name:es",SWEDISH:"name:sv",TAMIL:"name:ta",TELUGU:"name:te",THAI:"name:th",TURKISH:"name:tr",UKRAINIAN:"name:uk",URDU:"name:ur",VIETNAMIAN_LATIN:"name:vi",WELSH:"name:cy"},Ut=new Set(Object.values(w));function ae(o){return Ut.has(o)}const Ht=new Set(Object.values(w));function ne(){if(typeof navigator>"u")return`name:${Intl.DateTimeFormat().resolvedOptions().locale.split("-")[0]}`;const o=Array.from(new Set(navigator.languages.map(e=>`name:${e.split("-")[0]}`))).filter(e=>Ht.has(e));return o.length?o[0]:w.LOCAL}const N={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:w.STYLE,secondaryLanguage:w.LOCAL,terrainSourceURL:"https://api.maptiler.com/tiles/terrain-rgb-v2/tiles.json",terrainSourceId:"maptiler-terrain"};Object.freeze(N);const Te=Ct();class Ie extends yt{constructor(){super(...arguments),this.primaryLanguage=N.primaryLanguage,this.session=!0,this.caching=!0,this._unit="metric",this._apiKey=""}set unit(e){this._unit=e,this.emit("unit",e)}get unit(){return this._unit}set apiKey(e){this._apiKey=e,re.apiKey=e,this.emit("apiKey",e)}get apiKey(){return this._apiKey}set fetch(e){re.fetch=e}get fetch(){return re.fetch}}const E=new Ie;class Re extends p.LogoControl{onAdd(e){return super.onAdd(e)}}class ie extends Re{constructor(e={}){super(e),this.logoURL="",this.linkURL="",this.logoURL=e.logoURL??N.maptilerLogoURL,this.linkURL=e.linkURL??N.maptilerURL}onAdd(e){this._map=e,this._compact=this.options.compact??!1,this._container=window.document.createElement("div"),this._container.className="maplibregl-ctrl";const t=window.document.createElement("a");return t.style.backgroundRepeat="no-repeat",t.style.cursor="pointer",t.style.display="block",t.style.height="23px",t.style.margin="0 0 -4px -4px",t.style.overflow="hidden",t.style.width="88px",t.style.backgroundImage=`url(${this.logoURL})`,t.style.backgroundSize="100px 30px",t.style.width="100px",t.style.height="30px",t.target="_blank",t.rel="noopener",t.href=this.linkURL,t.setAttribute("aria-label","MapTiler logo"),t.setAttribute("rel","noopener"),this._container.appendChild(t),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}}const le="localcache_source",se="localcache",Gt="maptiler_sdk",Dt=1e3,Wt=100,ce=typeof caches<"u";function jt(o,e){if(ce&&E.caching&&E.session&&o.host===N.maptilerApiHost){if(e==="Source"&&o.href.includes("tiles.json"))return o.href.replace("https://",`${le}://`);if(e==="Tile"||e==="Glyphs")return o.href.replace("https://",`${se}://`)}return o.href}let ue;async function Ee(){return ue||(ue=await caches.open(Gt)),ue}let xe=0;async function Vt(){const o=await Ee(),e=await o.keys(),t=e.slice(0,Math.max(e.length-Dt,0));for(const r of t)o.delete(r)}function Kt(){Se(le,async(o,e)=>{if(!o.url)throw new Error("");o.url=o.url.replace(`${le}://`,"https://");const t=o;t.signal=e.signal;const r=await fetch(o.url,t),a=await r.json();return a.tiles&&a.tiles.length>0&&(a.tiles[0]+=`&last-modified=${r.headers.get("Last-Modified")}`),{data:a,cacheControl:r.headers.get("Cache-Control"),expires:r.headers.get("Expires")}}),Se(se,async(o,e)=>{if(!o.url)throw new Error("");o.url=o.url.replace(`${se}://`,"https://");const t=new URL(o.url),r=new URL(t);r.searchParams.delete("mtsid"),r.searchParams.delete("key");const a=r.toString(),n=new URL(t);n.searchParams.delete("last-modified");const i=n.toString(),l=async g=>({data:await g.arrayBuffer(),cacheControl:g.headers.get("Cache-Control"),expires:g.headers.get("Expires")}),u=await Ee(),s=await u.match(a);if(s)return l(s);const c=o;c.signal=e.signal;const h=await fetch(i,c);return h.status>=200&&h.status<300&&(u.put(a,h.clone()).catch(()=>{}),++xe>Wt&&(Vt(),xe=0)),l(h)})}function Zt(){const o=p.getRTLTextPluginStatus();if(o==="unavailable"||o==="requested")try{p.setRTLTextPlugin(N.rtlPluginURL,!0)}catch{}}function Yt(o,e){for(const t of o)typeof e[t]=="function"&&(e[t]=e[t].bind(e))}function U(o,e,t){const r=window.document.createElement(o);return e!==void 0&&(r.className=e),t&&t.appendChild(r),r}function _e(o){o.parentNode&&o.parentNode.removeChild(o)}function Ne(o,e){let t=null;try{t=new URL(o)}catch{return{url:o}}return t.host===N.maptilerApiHost&&(t.searchParams.has("key")||t.searchParams.append("key",E.apiKey),E.session&&t.searchParams.append("mtsid",Te)),{url:jt(t,e)}}function Pe(o){return(e,t)=>{if(o!=null){const r=o(e,t),a=Ne(r?.url??"",t);return{...r,...a}}return Ne(e,t)}}function Me(){return Math.random().toString(36).substring(2)}function q(o){return/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/gi.test(o)}function qt(o){try{return JSON.parse(o)}catch{}return null}function Jt(){return document.createElement("canvas").getContext("webgl2")?null:typeof WebGL2RenderingContext<"u"?"Graphic rendering with WebGL2 has been disabled or is not supported by your graphic card. The map cannot be displayed.":"Your browser does not support graphic rendering with WebGL2. The map cannot be displayed."}function Xt(o){const e=Jt();if(!e)return;let t=null;if(typeof o=="string"?t=document.getElementById(o):o instanceof HTMLElement&&(t=o),!t)throw new Error("The Map container must be provided.");const r=document.createElement("div");throw r.innerHTML=e,r.classList.add("no-webgl-support-div"),t.appendChild(r),new Error(e)}function ke(o){return o?typeof o=="string"||o instanceof String?!o.startsWith("http")&&o.toLowerCase().includes(".json")?o:vt(o):o instanceof ft?o.getExpandedStyleURL():o instanceof Lt?o.getDefaultVariant().getExpandedStyleURL():o:At[wt[0].referenceStyleID].getDefaultVariant().getExpandedStyleURL()}class Oe{constructor(){Yt(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(e){return this._map=e,this._container=U("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=U("button","maplibregl-ctrl-terrain",this._container),U("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(){_e(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.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))}}class Fe extends p.NavigationControl{onAdd(e){return super.onAdd(e)}}class ze extends Fe{constructor(){super({showCompass:!0,showZoom:!0,visualizePitch:!0}),this._rotateCompassArrow=()=>{const e=this.options.visualizePitch?`scale(${Math.min(1.5,1/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=e},this._compass.removeEventListener("click",this._compass.clickFunction),this._compass.addEventListener("click",e=>{this._map.getPitch()===0?this._map.easeTo({pitch:Math.min(this._map.getMaxPitch(),80)}):this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})})}_createButton(e,t){const r=super._createButton(e,t);return r.clickFunction=t,r}}class Be extends p.GeolocateControl{onAdd(e){return super.onAdd(e)}}const $e=p.Marker,Ue=p.LngLat,Qt=p.LngLatBounds;class He extends Be{constructor(){super(...arguments),this.lastUpdatedCenter=new Ue(0,0),this._updateCamera=e=>{const t=new Ue(e.coords.longitude,e.coords.latitude),r=e.coords.accuracy,a={bearing:this._map.getBearing(),...this.options.fitBoundsOptions,linear:!0},n=this._map.getZoom();n>(this.options?.fitBoundsOptions?.maxZoom??30)&&(a.zoom=n),this._map.fitBounds(Qt.fromLngLat(t,r),a,{geolocateSource:!0});let i=!1;const l=()=>{i=!0};this._map.once("click",l),this._map.once("dblclick",l),this._map.once("dragstart",l),this._map.once("mousedown",l),this._map.once("touchstart",l),this._map.once("wheel",l),this._map.once("moveend",()=>{this._map.off("click",l),this._map.off("dblclick",l),this._map.off("dragstart",l),this._map.off("mousedown",l),this._map.off("touchstart",l),this._map.off("wheel",l),!i&&(this.lastUpdatedCenter=this._map.getCenter())})},this._setupUI=e=>{if(this.lastUpdatedCenter=this._map.getCenter(),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=U("button","maplibregl-ctrl-geolocate",this._container),U("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",e===!1){const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}else{const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=U("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new $e({element:this._dotElement}),this._circleElement=U("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new $e({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",t=>{const r=t.originalEvent&&t.originalEvent.type==="resize",a=this.lastUpdatedCenter.distanceTo(this._map.getCenter());!t.geolocateSource&&this._watchState==="ACTIVE_LOCK"&&!r&&a>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")))})},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}}_updateCircleRadius(){if(this._watchState!=="BACKGROUND"&&this._watchState!=="ACTIVE_LOCK")return;const e=[this._lastKnownPosition.coords.longitude,this._lastKnownPosition.coords.latitude],t=this._map.project(e),r=this._map.unproject([t.x,t.y]),a=this._map.unproject([t.x+20,t.y]),n=r.distanceTo(a)/20,i=Math.ceil(2*this._accuracy/n);this._circleElement.style.width=`${i}px`,this._circleElement.style.height=`${i}px`}}class Ge extends p.ScaleControl{onAdd(e){return super.onAdd(e)}}class De extends p.FullscreenControl{onAdd(e){return super.onAdd(e)}}var pe=(o,e,t)=>{if(!e.has(o))throw TypeError("Cannot "+t)},L=(o,e,t)=>(pe(o,e,"read from private field"),t?t.call(o):e.get(o)),B=(o,e,t)=>{if(e.has(o))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(o):e.set(o,t)},V=(o,e,t,r)=>(pe(o,e,"write to private field"),e.set(o,t),t),P=(o,e,t)=>(pe(o,e,"access private method"),t),M,$,G,We,D,O,J,he,je,k,F,me,Ve;let de=class{constructor(e,t){B(this,he),B(this,k),B(this,me),B(this,M,void 0),B(this,$,void 0),B(this,G,void 0),B(this,We,void 0),B(this,D,void 0),B(this,O,!1),B(this,J,void 0),e.style!==void 0&&V(this,O,!0),V(this,M,{zoomAdjust:-4,position:"top-right",...t,forceNoAttributionControl:!0,attributionControl:!1,navigationControl:!1,geolocateControl:!1,maptilerLogo:!1,minimap:!1,hash:!1,pitchAdjust:!1,...e,containerStyle:{border:"1px solid #000",width:"400px",height:"300px",...e.containerStyle??{}}}),e.lockZoom!==void 0&&(L(this,M).minZoom=e.lockZoom,L(this,M).maxZoom=e.lockZoom)}setStyle(e,t){L(this,O)||this.map.setStyle(e,t),P(this,k,F).call(this)}addLayer(e,t){return L(this,O)||this.map.addLayer(e,t),P(this,k,F).call(this),this.map}moveLayer(e,t){return L(this,O)||this.map.moveLayer(e,t),P(this,k,F).call(this),this.map}removeLayer(e){return L(this,O)||this.map.removeLayer(e),P(this,k,F).call(this),this}setLayerZoomRange(e,t,r){return L(this,O)||this.map.setLayerZoomRange(e,t,r),P(this,k,F).call(this),this}setFilter(e,t,r){return L(this,O)||this.map.setFilter(e,t,r),P(this,k,F).call(this),this}setPaintProperty(e,t,r,a){return L(this,O)||this.map.setPaintProperty(e,t,r,a),P(this,k,F).call(this),this}setLayoutProperty(e,t,r,a){return L(this,O)||this.map.setLayoutProperty(e,t,r,a),P(this,k,F).call(this),this}setGlyphs(e,t){return L(this,O)||this.map.setGlyphs(e,t),P(this,k,F).call(this),this}onAdd(e){V(this,$,e),V(this,G,U("div","maplibregl-ctrl maplibregl-ctrl-group"));for(const[t,r]of Object.entries(L(this,M).containerStyle))L(this,G).style.setProperty(t,r);return L(this,M).container=L(this,G),L(this,M).zoom=e.getZoom()+L(this,M).zoomAdjust,this.map=new Ze(L(this,M)),this.map.once("style.load",()=>{this.map.resize()}),this.map.once("load",()=>{P(this,he,je).call(this,L(this,M).parentRect),V(this,J,P(this,me,Ve).call(this))}),L(this,G)}onRemove(){var e;(e=L(this,J))==null||e.call(this),_e(L(this,G))}};M=new WeakMap,$=new WeakMap,G=new WeakMap,We=new WeakMap,D=new WeakMap,O=new WeakMap,J=new WeakMap,he=new WeakSet,je=function(o){o===void 0||o.linePaint===void 0&&o.fillPaint===void 0||(V(this,D,{type:"Feature",properties:{name:"parentRect"},geometry:{type:"Polygon",coordinates:[[[],[],[],[],[]]]}}),this.map.addSource("parentRect",{type:"geojson",data:L(this,D)}),(o.lineLayout!==void 0||o.linePaint!==void 0)&&this.map.addLayer({id:"parentRectOutline",type:"line",source:"parentRect",layout:{...o.lineLayout},paint:{"line-color":"#FFF","line-width":1,"line-opacity":.85,...o.linePaint}}),o.fillPaint!==void 0&&this.map.addLayer({id:"parentRectFill",type:"fill",source:"parentRect",layout:{},paint:{"fill-color":"#08F","fill-opacity":.135,...o.fillPaint}}),P(this,k,F).call(this))},k=new WeakSet,F=function(){if(L(this,D)===void 0)return;const{devicePixelRatio:o}=window,e=L(this,$).getCanvas(),t=e.width/o,r=e.height/o,a=L(this,$).unproject.bind(L(this,$)),n=a([0,0]),i=a([t,0]),l=a([0,r]),u=a([t,r]);L(this,D).geometry.coordinates=[[l.toArray(),u.toArray(),i.toArray(),n.toArray(),l.toArray()]],this.map.getSource("parentRect").setData(L(this,D))},me=new WeakSet,Ve=function(){const{pitchAdjust:o}=L(this,M),e=()=>{n("parent")},t=()=>{n("minimap")},r=()=>{L(this,$).on("move",e),this.map.on("move",t)},a=()=>{L(this,$).off("move",e),this.map.off("move",t)},n=i=>{a();const l=i==="parent"?L(this,$):this.map,u=i==="parent"?this.map:L(this,$),s=l.getCenter(),c=l.getZoom()+(L(this,M).zoomAdjust??-4)*(i==="parent"?1:-1),h=l.getBearing(),g=l.getPitch();u.jumpTo({center:s,zoom:c,bearing:h,pitch:o?g:0}),P(this,k,F).call(this),r()};return r(),()=>{a()}};const Ke={POINT:"POINT",COUNTRY:"COUNTRY"};class Ze extends p.Map{constructor(e){Xt(e.container),e.apiKey&&(E.apiKey=e.apiKey);const t=ke(e.style),r=location.hash;E.apiKey||console.warn("MapTiler Cloud API key is not set. Visit https://maptiler.com and try Cloud for free!");let a={compact:!1};e.customAttribution?a.customAttribution=e.customAttribution:e.attributionControl&&typeof e.attributionControl=="object"&&(a={...a,...e.attributionControl}),super({...e,style:t,maplibreLogo:!1,transformRequest:Pe(e.transformRequest),attributionControl:e.forceNoAttributionControl===!0?!1:a}),this.isTerrainEnabled=!1,this.terrainExaggeration=1,this.terrainGrowing=!1,this.terrainFlattening=!1,this.isReady=!1,E.caching&&!ce&&console.warn("The cache API is only available in secure contexts. More info at https://developer.mozilla.org/en-US/docs/Web/API/Cache"),E.caching&&ce&&Kt(),this.primaryLanguage=e.language??E.primaryLanguage,this.forceLanguageUpdate=!(this.primaryLanguage===w.STYLE||this.primaryLanguage===w.STYLE_LOCK),this.languageAlwaysBeenStyle=this.primaryLanguage===w.STYLE,this.terrainExaggeration=e.terrainExaggeration??this.terrainExaggeration,this.once("styledata",async()=>{if(!e.geolocate||e.center||e.hash&&r)return;try{if(e.geolocate===Ke.COUNTRY){await this.fitToIpBounds();return}}catch(c){console.warn(c.message)}let s;try{await this.centerOnIpPoint(e.zoom),s=this.getCameraHash()}catch(c){console.warn(c.message)}(await navigator.permissions.query({name:"geolocation"})).state==="granted"&&navigator.geolocation.getCurrentPosition(c=>{s===this.getCameraHash()&&(this.terrain?this.easeTo({center:[c.coords.longitude,c.coords.latitude],zoom:e.zoom||12,duration:2e3}):this.once("terrain",()=>{this.easeTo({center:[c.coords.longitude,c.coords.latitude],zoom:e.zoom||12,duration:2e3})}))},null,{maximumAge:24*3600*1e3,timeout:5e3,enableHighAccuracy:!1})}),this.on("styledata",()=>{this.setPrimaryLanguage(this.primaryLanguage)}),this.on("styledata",()=>{this.getTerrain()===null&&this.isTerrainEnabled&&this.enableTerrain(this.terrainExaggeration)}),this.once("load",()=>{Zt()}),this.once("load",async()=>{let s={logo:null};try{const c=Object.keys(this.style.sourceCaches).map(g=>this.getSource(g)).filter(g=>g&&"url"in g&&typeof g.url=="string"&&g?.url.includes("tiles.json")),h=new URL(c[0].url);h.searchParams.has("key")||h.searchParams.append("key",E.apiKey),s=await(await fetch(h.href)).json()}catch{}if(e.forceNoAttributionControl!==!0)if("logo"in s&&s.logo){const c=s.logo;this.addControl(new ie({logoURL:c}),e.logoPosition)}else e.maptilerLogo&&this.addControl(new ie,e.logoPosition);if(e.scaleControl){const c=e.scaleControl===!0||e.scaleControl===void 0?"bottom-right":e.scaleControl,h=new Ge({unit:E.unit});this.addControl(h,c),E.on("unit",g=>{h.setUnit(g)})}if(e.navigationControl!==!1){const c=e.navigationControl===!0||e.navigationControl===void 0?"top-right":e.navigationControl;this.addControl(new ze,c)}if(e.geolocateControl!==!1){const c=e.geolocateControl===!0||e.geolocateControl===void 0?"top-right":e.geolocateControl;this.addControl(new He({positionOptions:{enableHighAccuracy:!0,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!0,showAccuracyCircle:!0,showUserLocation:!0}),c)}if(e.terrainControl){const c=e.terrainControl===!0||e.terrainControl===void 0?"top-right":e.terrainControl;this.addControl(new Oe,c)}if(e.fullscreenControl){const c=e.fullscreenControl===!0||e.fullscreenControl===void 0?"top-right":e.fullscreenControl;this.addControl(new De({}),c)}this.isReady=!0,this.fire("ready",{target:this})});let n=!1,i=!1,l;this.once("ready",()=>{n=!0,i&&this.fire("loadWithTerrain",l)}),this.once("style.load",()=>{const{minimap:s}=e;if(typeof s=="object"){const{zoom:c,center:h,style:g,language:v,apiKey:f,maptilerLogo:y,antialias:C,refreshExpiredTiles:_,maxBounds:A,scrollZoom:I,minZoom:R,maxZoom:T,boxZoom:z,locale:H,fadeDuration:K,crossSourceCollisions:Z,clickTolerance:Y,bounds:pt,fitBoundsOptions:ht,pixelRatio:mt,validateStyle:dt}=e;this.minimap=new de(s,{zoom:c,center:h,style:g,language:v,apiKey:f,container:"null",maptilerLogo:y,antialias:C,refreshExpiredTiles:_,maxBounds:A,scrollZoom:I,minZoom:R,maxZoom:T,boxZoom:z,locale:H,fadeDuration:K,crossSourceCollisions:Z,clickTolerance:Y,bounds:pt,fitBoundsOptions:ht,pixelRatio:mt,validateStyle:dt}),this.addControl(this.minimap,s.position??"bottom-left")}else s===!0?(this.minimap=new de({},e),this.addControl(this.minimap,"bottom-left")):s!==void 0&&s!==!1&&(this.minimap=new de({},e),this.addControl(this.minimap,s))});const u=s=>{s.terrain&&(i=!0,l={type:"loadWithTerrain",target:this,terrain:s.terrain},this.off("terrain",u),n&&this.fire("loadWithTerrain",l))};this.on("terrain",u),e.terrain&&this.enableTerrain(e.terrainExaggeration??this.terrainExaggeration)}async onLoadAsync(){return new Promise(e=>{if(this.loaded())return e(this);this.once("load",()=>{e(this)})})}async onReadyAsync(){return new Promise(e=>{if(this.isReady)return e(this);this.once("ready",()=>{e(this)})})}async onLoadWithTerrainAsync(){return new Promise(e=>{if(this.isReady&&this.terrain)return e(this);this.once("loadWithTerrain",()=>{e(this)})})}setStyle(e,t){return this.minimap?.setStyle(e),this.forceLanguageUpdate=!0,this.once("idle",()=>{this.forceLanguageUpdate=!1}),super.setStyle(ke(e),t)}addLayer(e,t){return this.minimap?.addLayer(e,t),super.addLayer(e,t)}moveLayer(e,t){return this.minimap?.moveLayer(e,t),super.moveLayer(e,t)}removeLayer(e){return this.minimap?.removeLayer(e),super.removeLayer(e)}setLayerZoomRange(e,t,r){return this.minimap?.setLayerZoomRange(e,t,r),super.setLayerZoomRange(e,t,r)}setFilter(e,t,r){return this.minimap?.setFilter(e,t,r),super.setFilter(e,t,r)}setPaintProperty(e,t,r,a){return this.minimap?.setPaintProperty(e,t,r,a),super.setPaintProperty(e,t,r,a)}setLayoutProperty(e,t,r,a){return this.minimap?.setLayoutProperty(e,t,r,a),super.setLayoutProperty(e,t,r,a)}setGlyphs(e,t){return this.minimap?.setGlyphs(e,t),super.setGlyphs(e,t)}getStyleLanguage(){return!this.style.stylesheet.metadata||typeof this.style.stylesheet.metadata!="object"?null:"maptiler:language"in this.style.stylesheet.metadata&&typeof this.style.stylesheet.metadata["maptiler:language"]=="string"?this.style.stylesheet.metadata["maptiler:language"]:null}setLanguage(e){this.minimap?.map?.setLanguage(e),this.onStyleReady(()=>{this.setPrimaryLanguage(e)})}setPrimaryLanguage(e){const t=this.getStyleLanguage();if(!(e===w.STYLE&&(t===w.AUTO||t===w.VISITOR))&&(e!==w.STYLE&&(this.languageAlwaysBeenStyle=!1),this.languageAlwaysBeenStyle||this.primaryLanguage===e&&!this.forceLanguageUpdate))return;if(!ae(e)){console.warn(`The language "${e}" is not supported.`);return}if(this.primaryLanguage===w.STYLE_LOCK){console.warn("The language cannot be changed because this map has been instantiated with the STYLE_LOCK language flag.");return}this.primaryLanguage=e;let r=e;if(e===w.STYLE){if(!t){console.warn("The style has no default languages.");return}if(!ae(t)){console.warn("The language defined in the style is not valid.");return}r=t}let a=w.LOCAL,n=`{${a}}`;r===w.VISITOR?(a=ne(),n=["case",["all",["has",a],["has",w.LOCAL]],["case",["==",["get",a],["get",w.LOCAL]],["get",w.LOCAL],["format",["get",a],{"font-scale":.8},`
2
- `,["get",w.LOCAL],{"font-scale":1.1}]],["get",w.LOCAL]]):r===w.VISITOR_ENGLISH?(a=w.ENGLISH,n=["case",["all",["has",a],["has",w.LOCAL]],["case",["==",["get",a],["get",w.LOCAL]],["get",w.LOCAL],["format",["get",a],{"font-scale":.8},`
3
- `,["get",w.LOCAL],{"font-scale":1.1}]],["get",w.LOCAL]]):r===w.AUTO?(a=ne(),n=["case",["has",a],["get",a],["get",w.LOCAL]]):r===w.LOCAL?(a=w.LOCAL,n=`{${a}}`):(a=r,n=["case",["has",a],["get",a],["get",w.LOCAL]]);const{layers:i}=this.getStyle();for(const l of i){if(l.type!=="symbol")continue;const u=l,s=this.getSource(u.source);if(!s||!("url"in s&&typeof s.url=="string")||new URL(s.url).host!==N.maptilerApiHost)continue;const{id:c,layout:h}=u;if(!h||!("text-field"in h))continue;const g=this.getLayoutProperty(c,"text-field");typeof g=="string"&&(g.toLowerCase().includes("ref")||g.toLowerCase().includes("housenumber"))||this.setLayoutProperty(c,"text-field",n)}}getPrimaryLanguage(){return this.primaryLanguage}getTerrainExaggeration(){return this.terrainExaggeration}hasTerrain(){return this.isTerrainEnabled}growTerrain(e,t=1e3){if(!this.terrain)return;const r=performance.now(),a=this.terrain.exaggeration,n=e-a,i=()=>{if(!this.terrain||this.terrainFlattening)return;const l=(performance.now()-r)/t;if(l<.99){const u=1-(1-l)**4,s=a+u*n;this.terrain.exaggeration=s,requestAnimationFrame(i)}else this.terrainGrowing=!1,this.terrainFlattening=!1,this.terrain.exaggeration=e;this.triggerRepaint()};this.terrainGrowing=!0,this.terrainFlattening=!1,requestAnimationFrame(i)}enableTerrain(e=this.terrainExaggeration){if(e<0){console.warn("Terrain exaggeration cannot be negative.");return}const t=async a=>{!this.terrain||a.type!=="data"||a.dataType!=="source"||!("source"in a)||a.sourceId!=="maptiler-terrain"||a.source.type!=="raster-dem"||a.isSourceLoaded&&(this.off("data",t),this.growTerrain(e))},r=()=>{this.isTerrainEnabled=!0,this.terrainExaggeration=e,this.on("data",t),this.addSource(N.terrainSourceId,{type:"raster-dem",url:N.terrainSourceURL}),this.setTerrain({source:N.terrainSourceId,exaggeration:0})};if(this.getTerrain()){this.isTerrainEnabled=!0,this.growTerrain(e);return}this.loaded()||this.isTerrainEnabled?r():this.once("load",()=>{this.getTerrain()&&this.getSource(N.terrainSourceId)||r()})}disableTerrain(){if(!this.terrain)return;this.isTerrainEnabled=!1;const e=1*1e3,t=performance.now(),r=this.terrain.exaggeration,a=()=>{if(!this.terrain||this.terrainGrowing)return;const n=(performance.now()-t)/e;if(n<.99){const i=(1-n)**4,l=r*i;this.terrain.exaggeration=l,requestAnimationFrame(a)}else this.terrain.exaggeration=0,this.terrainGrowing=!1,this.terrainFlattening=!1,this.setTerrain(),this.getSource(N.terrainSourceId)&&this.removeSource(N.terrainSourceId);this.triggerRepaint()};this.terrainGrowing=!1,this.terrainFlattening=!0,requestAnimationFrame(a)}setTerrainExaggeration(e,t=!0){!t&&this.terrain?(this.terrainExaggeration=e,this.terrain.exaggeration=e,this.triggerRepaint()):this.enableTerrain(e)}onStyleReady(e){this.isStyleLoaded()?e():this.once("styledata",()=>{e()})}async fitToIpBounds(){const e=await be.info();this.fitBounds(e.country_bounds,{duration:0,padding:100})}async centerOnIpPoint(e){const t=await be.info();this.jumpTo({center:[t?.longitude??0,t?.latitude??0],zoom:e||11})}getCameraHash(){const e=new Float32Array(5),t=this.getCenter();return e[0]=t.lng,e[1]=t.lat,e[2]=this.getZoom(),e[3]=this.getPitch(),e[4]=this.getBearing(),gt.fromUint8Array(new Uint8Array(e.buffer))}getSdkConfig(){return E}getMaptilerSessionId(){return Te}setTransformRequest(e){return super.setTransformRequest(Pe(e)),this}}class eo extends p.Marker{addTo(e){return super.addTo(e)}}class to extends p.Popup{addTo(e){return super.addTo(e)}}class oo extends p.Style{constructor(e,t={}){super(e,t)}}class ro extends p.CanvasSource{onAdd(e){super.onAdd(e)}}class ao extends p.GeoJSONSource{onAdd(e){super.onAdd(e)}}class no extends p.ImageSource{onAdd(e){super.onAdd(e)}}class io extends p.RasterTileSource{onAdd(e){super.onAdd(e)}}class lo extends p.RasterDEMTileSource{onAdd(e){super.onAdd(e)}}class so extends p.VectorTileSource{onAdd(e){super.onAdd(e)}}class co extends p.VideoSource{onAdd(e){super.onAdd(e)}}class uo extends p.AttributionControl{onAdd(e){return super.onAdd(e)}}class po extends p.TerrainControl{onAdd(e){return super.onAdd(e)}}class ho extends p.BoxZoomHandler{constructor(e,t){super(e,t)}}class mo extends p.ScrollZoomHandler{constructor(e,t){super(e,t)}}class go extends p.CooperativeGesturesHandler{constructor(e,t){super(e,t)}}class yo extends p.KeyboardHandler{constructor(e){super(e)}}class vo extends p.TwoFingersTouchPitchHandler{constructor(e){super(e)}}class fo extends p.MapWheelEvent{constructor(e,t,r){super(e,t,r)}}class Lo extends p.MapTouchEvent{constructor(e,t,r){super(e,t,r)}}class Ao extends p.MapMouseEvent{constructor(e,t,r,a={}){super(e,t,r,a)}}function X(o){if(typeof DOMParser<"u"){const e=new DOMParser().parseFromString(o,"application/xml");if(e.querySelector("parsererror"))throw new Error("The provided string is not valid XML");return e}throw new Error("No XML parser found")}function ge(o,e){if(!o.hasChildNodes())return!1;for(const t of Array.from(o.childNodes)){const r=t.nodeName;if(typeof r=="string"&&r.trim().toLowerCase()===e.toLowerCase())return!0}return!1}function ye(o){if(typeof XMLSerializer<"u")return new XMLSerializer().serializeToString(o);throw new Error("No XML serializer found")}function ve(o){const e=typeof o=="string"?X(o):o;if(!ge(e,"gpx"))throw new Error("The XML document is not valid GPX");const t=x(e,"trk"),r=x(e,"rte"),a=x(e,"wpt"),n={type:"FeatureCollection",features:[]};for(const i of Array.from(t)){const l=bo(i);l&&n.features.push(l)}for(const i of Array.from(r)){const l=To(i);l&&n.features.push(l)}for(const i of Array.from(a))n.features.push(Io(i));return n}function fe(o,e){let t=o;if(typeof t=="string"&&(t=X(t)),!ge(t,"kml"))throw new Error("The XML document is not valid KML");const r={type:"FeatureCollection",features:[]},a={},n={},i={},l=x(t,"Placemark"),u=x(t,"Style"),s=x(t,"StyleMap");for(const c of Array.from(u)){const h=Xe(e!==void 0?e(c):ye(c)).toString(16);a[`#${W(c,"id")}`]=h,n[h]=c}for(const c of Array.from(s)){a[`#${W(c,"id")}`]=Xe(e!==void 0?e(c):ye(c)).toString(16);const h=x(c,"Pair"),g={};for(const v of Array.from(h))g[S(d(v,"key"))??""]=S(d(v,"styleUrl"));i[`#${W(c,"id")}`]=g}for(const c of Array.from(l))r.features=r.features.concat(So(c,a,n,i));return r}function Ye(o){if(o===null)return["#000000",1];let e="",t=1,r=o;return r.substring(0,1)==="#"&&(r=r.substring(1)),(r.length===6||r.length===3)&&(e=r),r.length===8&&(t=Number.parseInt(r.substring(0,2),16)/255,e=`#${r.substring(6,8)}${r.substring(4,6)}${r.substring(2,4)}`),[e??"#000000",t??1]}function wo(o){return et(o.split(" "))}function Co(o){let e=x(o,"coord");const t=[],r=[];e.length===0&&(e=x(o,"gx:coord"));for(const n of Array.from(e))t.push(wo(S(n)??""));const a=x(o,"when");for(const n of Array.from(a))r.push(S(n));return{coords:t,times:r}}function Q(o){const e=["Polygon","LineString","Point","Track","gx:Track"];let t,r,a,n,i;const l=[],u=[];if(d(o,"MultiGeometry")!==null)return Q(d(o,"MultiGeometry"));if(d(o,"MultiTrack")!==null)return Q(d(o,"MultiTrack"));if(d(o,"gx:MultiTrack")!==null)return Q(d(o,"gx:MultiTrack"));for(a=0;a<e.length;a++)if(r=x(o,e[a]),r){for(n=0;n<r.length;n++)if(t=r[n],e[a]==="Point")l.push({type:"Point",coordinates:tt(S(d(t,"coordinates"))??"")});else if(e[a]==="LineString")l.push({type:"LineString",coordinates:ot(S(d(t,"coordinates"))??"")});else if(e[a]==="Polygon"){const s=x(t,"LinearRing"),c=[];for(i=0;i<s.length;i++)c.push(ot(S(d(s[i],"coordinates"))??""));l.push({type:"Polygon",coordinates:c})}else if(e[a]==="Track"||e[a]==="gx:Track"){const s=Co(t);l.push({type:"LineString",coordinates:s.coords}),s.times.length&&u.push(s.times)}}return{geoms:l,coordTimes:u}}function So(o,e,t,r){const a=Q(o),n={},i=S(d(o,"name")),l=S(d(o,"address")),u=S(d(o,"description")),s=d(o,"TimeSpan"),c=d(o,"TimeStamp"),h=d(o,"ExtendedData"),g=d(o,"visibility");let v,f=S(d(o,"styleUrl")),y=d(o,"LineStyle"),C=d(o,"PolyStyle");if(!a.geoms.length)return[];if(i&&(n.name=i),l&&(n.address=l),f){f[0]!=="#"&&(f=`#${f}`),n.styleUrl=f,e[f]&&(n.styleHash=e[f]),r[f]&&(n.styleMapHash=r[f],n.styleHash=e[r[f].normal??""]);const A=t[n.styleHash??""];if(A){y||(y=d(A,"LineStyle")),C||(C=d(A,"PolyStyle"));const I=d(A,"IconStyle");if(I){const R=d(I,"Icon");if(R){const T=S(d(R,"href"));T&&(n.icon=T)}}}}if(u&&(n.description=u),s){const A=S(d(s,"begin")),I=S(d(s,"end"));A&&I&&(n.timespan={begin:A,end:I})}if(c!==null&&(n.timestamp=S(d(c,"when"))??new Date().toISOString()),y!==null){const A=Ye(S(d(y,"color"))),I=A[0],R=A[1],T=Number.parseFloat(S(d(y,"width"))??"");I&&(n.stroke=I),Number.isNaN(R)||(n["stroke-opacity"]=R),Number.isNaN(T)||(n["stroke-width"]=T)}if(C){const A=Ye(S(d(C,"color"))),I=A[0],R=A[1],T=S(d(C,"fill")),z=S(d(C,"outline"));I&&(n.fill=I),Number.isNaN(R)||(n["fill-opacity"]=R),T&&(n["fill-opacity"]=T==="1"?n["fill-opacity"]||1:0),z&&(n["stroke-opacity"]=z==="1"?n["stroke-opacity"]||1:0)}if(h){const A=x(h,"Data"),I=x(h,"SimpleData");for(v=0;v<A.length;v++)n[A[v].getAttribute("name")??""]=S(d(A[v],"value"))??"";for(v=0;v<I.length;v++)n[I[v].getAttribute("name")??""]=S(I[v])??""}g!==null&&(n.visibility=S(g)??""),a.coordTimes.length!==0&&(n.coordTimes=a.coordTimes.length===1?a.coordTimes[0]:a.coordTimes);const _={type:"Feature",geometry:a.geoms.length===1?a.geoms[0]:{type:"GeometryCollection",geometries:a.geoms},properties:n};return W(o,"id")&&(_.id=W(o,"id")??void 0),[_]}function qe(o,e){const t=x(o,e),r=[],a=[];let n=[];const i=t.length;if(!(i<2)){for(let l=0;l<i;l++){const u=rt(t[l]);r.push(u.coordinates),u.time&&a.push(u.time),(u.heartRate||n.length)&&(n.length===0&&(n=new Array(l).fill(null)),n.push(u.heartRate))}return{line:r,times:a,heartRates:n}}}function bo(o){const e=x(o,"trkseg"),t=[],r=[],a=[];let n;for(let l=0;l<e.length;l++)if(n=qe(e[l],"trkpt"),n!==void 0&&(n.line&&t.push(n.line),n.times&&n.times.length&&r.push(n.times),a.length||n.heartRates&&n.heartRates.length)){if(!a.length)for(let u=0;u<l;u++)a.push(new Array(t[u].length).fill(null));n.heartRates&&n.heartRates.length?a.push(n.heartRates):a.push(new Array(n.line.length).fill(null))}if(t.length===0)return;const i={...Le(o),...Je(d(o,"extensions"))};return r.length!==0&&(i.coordTimes=t.length===1?r[0]:r),a.length!==0&&(i.heartRates=t.length===1?a[0]:a),t.length===1?{type:"Feature",properties:i,geometry:{type:"LineString",coordinates:t[0]}}:{type:"Feature",properties:i,geometry:{type:"MultiLineString",coordinates:t}}}function To(o){const e=qe(o,"rtept");return e===void 0?void 0:{type:"Feature",properties:{...Le(o),...Je(d(o,"extensions"))},geometry:{type:"LineString",coordinates:e.line}}}function Io(o){return{type:"Feature",properties:{...Le(o),...Ae(o,["sym"])},geometry:{type:"Point",coordinates:rt(o).coordinates}}}function Je(o){const e={};if(o){const t=d(o,"line");if(t){const r=S(d(t,"color")),a=Number.parseFloat(S(d(t,"opacity"))??"0"),n=Number.parseFloat(S(d(t,"width"))??"0");r&&(e.stroke=r),Number.isNaN(a)||(e["stroke-opacity"]=a),Number.isNaN(n)||(e["stroke-width"]=n*96/25.4)}}return e}function Le(o){const e=Ae(o,["name","cmt","desc","type","time","keywords"]),t=x(o,"link");if(t.length!==0){e.links=[];for(const r of Array.from(t)){const a={href:W(r,"href"),...Ae(r,["text","type"])};e.links.push(a)}}return e}function Xe(o){let e=0;if(!o||!o.length)return e;for(let t=0;t<o.length;t++)e=(e<<5)-e+o.charCodeAt(t)|0;return e}function x(o,e){return o.getElementsByTagName(e)}function W(o,e){return o.getAttribute(e)}function Qe(o,e){return Number.parseFloat(W(o,e)??"0")}function d(o,e){const t=x(o,e);return t.length?t[0]:null}function Ro(o){return o.normalize&&o.normalize(),o}function et(o){return o.map(Number.parseFloat).map(e=>Number.isNaN(e)?null:e)}function S(o){return o&&Ro(o),o&&o.textContent}function Ae(o,e){const t={};let r,a;for(a=0;a<e.length;a++)r=d(o,e[a]),r&&(t[e[a]]=S(r)??"");return t}function tt(o){return et(o.replace(/\s*/g,"").split(","))}function ot(o){const e=o.replace(/^\s*|\s*$/g,"").split(/\s+/),t=[];for(const r of e)t.push(tt(r));return t}function rt(o){const e=[Qe(o,"lon"),Qe(o,"lat")],t=d(o,"ele"),r=d(o,"gpxtpx:hr")||d(o,"hr"),a=d(o,"time");let n;return t&&(n=Number.parseFloat(S(t)??"0"),Number.isNaN(n)||e.push(n)),{coordinates:e,time:a?S(a):null,heartRate:r!==null?Number.parseFloat(S(r)??"0"):null}}function at(o){let e=o;try{typeof e=="string"&&(e=X(e))}catch{return null}try{return ve(e)}catch{}try{return fe(e)}catch{}return null}function ee(o){const e=o.toString(16);return e.length===1?`0${e}`:e}function Eo(o){return`#${ee(o[0])}${ee(o[1])}${ee(o[2])}${o.length===4?ee(o[3]):""}`}class m extends Array{constructor(e={}){super(),this.min=0,this.max=1,"min"in e&&(this.min=e.min),"max"in e&&(this.max=e.max),"stops"in e&&this.setStops(e.stops,{clone:!1})}static fromArrayDefinition(e){return new m({stops:e.map(t=>({value:t[0],color:t[1]}))})}setStops(e,t={clone:!0}){const r=t.clone?this.clone():this;r.length=0;let a=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY;for(let i=0;i<e.length;i+=1)a=Math.min(a,e[i].value),n=Math.max(n,e[i].value),r.push({value:e[i].value,color:e[i].color.slice()});return r.sort((i,l)=>i.value<l.value?-1:1),this.min=a,this.max=n,r}scale(e,t,r={clone:!0}){const a=r.clone,n=this[0].value,i=this.at(-1).value-n,l=t-e,u=[];for(let s=0;s<this.length;s+=1){const c=(this[s].value-n)/i*l+e;a?u.push({value:c,color:this[s].color.slice()}):this[s].value=c}return a?new m({stops:u}):this}at(e){return e<0?this[this.length+e]:this[e]}clone(){return new m({stops:this.getRawColorStops()})}getRawColorStops(){const e=[];for(let t=0;t<this.length;t+=1)e.push({value:this[t].value,color:this[t].color});return e}reverse(e={clone:!0}){const t=e.clone?this.clone():this;for(let r=0;r<~~(t.length/2);r+=1){const a=t[r].color;t[r].color=t.at(-(r+1)).color,t.at(-(r+1)).color=a}return t}getBounds(){return{min:this.min,max:this.max}}getColor(e,t={smooth:!0}){if(e<=this[0].value)return this[0].color;if(e>=this.at(-1).value)return this.at(-1).color;for(let r=0;r<this.length-1;r+=1){if(e>this[r+1].value)continue;const a=this[r].color;if(!t.smooth)return a.slice();const n=this[r].value,i=this[r+1].value,l=this[r+1].color,u=(i-e)/(i-n);return a.map((s,c)=>Math.round(s*u+l[c]*(1-u)))}return[0,0,0]}getColorHex(e,t={smooth:!0,withAlpha:!1}){return Eo(this.getColor(e,t))}getColorRelative(e,t={smooth:!0}){const r=this.getBounds();return this.getColor(r.min+e*(r.max-r.min),t)}getCanvasStrip(e={horizontal:!0,size:512,smooth:!0}){const t=document.createElement("canvas");t.width=e.horizontal?e.size:1,t.height=e.horizontal?1:e.size;const r=t.getContext("2d");if(!r)throw new Error("Canvs context is missing");const a=r.getImageData(0,0,t.width,t.height),n=a.data,i=e.size,l=this[0].value,u=(this.at(-1).value-l)/i;for(let s=0;s<i;s+=1){const c=this.getColor(l+s*u,{smooth:e.smooth});n[s*4]=c[0],n[s*4+1]=c[1],n[s*4+2]=c[2],n[s*4+3]=c.length>3?c[3]:255}return r.putImageData(a,0,0),t}resample(e,t=15){const r=this.getBounds(),a=this.scale(0,1),n=1/(t-1);let i;if(e==="ease-in-square")i=Array.from({length:t},(l,u)=>{const s=u*n,c=s**2,h=a.getColor(c);return{value:s,color:h}});else if(e==="ease-out-square")i=Array.from({length:t},(l,u)=>{const s=u*n,c=1-(1-s)**2,h=a.getColor(c);return{value:s,color:h}});else if(e==="ease-out-sqrt")i=Array.from({length:t},(l,u)=>{const s=u*n,c=s**.5,h=a.getColor(c);return{value:s,color:h}});else if(e==="ease-in-sqrt")i=Array.from({length:t},(l,u)=>{const s=u*n,c=1-(1-s)**.5,h=a.getColor(c);return{value:s,color:h}});else if(e==="ease-out-exp")i=Array.from({length:t},(l,u)=>{const s=u*n,c=1-2**(-10*s),h=a.getColor(c);return{value:s,color:h}});else if(e==="ease-in-exp")i=Array.from({length:t},(l,u)=>{const s=u*n,c=2**(10*s-10),h=a.getColor(c);return{value:s,color:h}});else throw new Error("Invalid ressampling method.");return new m({stops:i}).scale(r.min,r.max)}transparentStart(){const e=this.getRawColorStops();e.unshift({value:e[0].value,color:e[0].color.slice()}),e[1].value+=.001;for(const t of e)t.color.length===3&&t.color.push(255);return e[0].color[3]=0,new m({stops:e})}hasTransparentStart(){return this[0].color.length===4&&this[0].color[3]===0}}const we={NULL:new m({stops:[{value:0,color:[0,0,0,0]},{value:1,color:[0,0,0,0]}]}),GRAY:new m({stops:[{value:0,color:[0,0,0]},{value:1,color:[255,255,255]}]}),JET:new m({stops:[{value:0,color:[0,0,131]},{value:.125,color:[0,60,170]},{value:.375,color:[5,255,255]},{value:.625,color:[255,255,0]},{value:.875,color:[250,0,0]},{value:1,color:[128,0,0]}]}),HSV:new m({stops:[{value:0,color:[255,0,0]},{value:.169,color:[253,255,2]},{value:.173,color:[247,255,2]},{value:.337,color:[0,252,4]},{value:.341,color:[0,252,10]},{value:.506,color:[1,249,255]},{value:.671,color:[2,0,253]},{value:.675,color:[8,0,253]},{value:.839,color:[255,0,251]},{value:.843,color:[255,0,245]},{value:1,color:[255,0,6]}]}),HOT:new m({stops:[{value:0,color:[0,0,0]},{value:.3,color:[230,0,0]},{value:.6,color:[255,210,0]},{value:1,color:[255,255,255]}]}),SPRING:new m({stops:[{value:0,color:[255,0,255]},{value:1,color:[255,255,0]}]}),SUMMER:new m({stops:[{value:0,color:[0,128,102]},{value:1,color:[255,255,102]}]}),AUTOMN:new m({stops:[{value:0,color:[255,0,0]},{value:1,color:[255,255,0]}]}),WINTER:new m({stops:[{value:0,color:[0,0,255]},{value:1,color:[0,255,128]}]}),BONE:new m({stops:[{value:0,color:[0,0,0]},{value:.376,color:[84,84,116]},{value:.753,color:[169,200,200]},{value:1,color:[255,255,255]}]}),COPPER:new m({stops:[{value:0,color:[0,0,0]},{value:.804,color:[255,160,102]},{value:1,color:[255,199,127]}]}),GREYS:new m({stops:[{value:0,color:[0,0,0]},{value:1,color:[255,255,255]}]}),YIGNBU:new m({stops:[{value:0,color:[8,29,88]},{value:.125,color:[37,52,148]},{value:.25,color:[34,94,168]},{value:.375,color:[29,145,192]},{value:.5,color:[65,182,196]},{value:.625,color:[127,205,187]},{value:.75,color:[199,233,180]},{value:.875,color:[237,248,217]},{value:1,color:[255,255,217]}]}),GREENS:new m({stops:[{value:0,color:[0,68,27]},{value:.125,color:[0,109,44]},{value:.25,color:[35,139,69]},{value:.375,color:[65,171,93]},{value:.5,color:[116,196,118]},{value:.625,color:[161,217,155]},{value:.75,color:[199,233,192]},{value:.875,color:[229,245,224]},{value:1,color:[247,252,245]}]}),YIORRD:new m({stops:[{value:0,color:[128,0,38]},{value:.125,color:[189,0,38]},{value:.25,color:[227,26,28]},{value:.375,color:[252,78,42]},{value:.5,color:[253,141,60]},{value:.625,color:[254,178,76]},{value:.75,color:[254,217,118]},{value:.875,color:[255,237,160]},{value:1,color:[255,255,204]}]}),BLUERED:new m({stops:[{value:0,color:[0,0,255]},{value:1,color:[255,0,0]}]}),RDBU:new m({stops:[{value:0,color:[5,10,172]},{value:.35,color:[106,137,247]},{value:.5,color:[190,190,190]},{value:.6,color:[220,170,132]},{value:.7,color:[230,145,90]},{value:1,color:[178,10,28]}]}),PICNIC:new m({stops:[{value:0,color:[0,0,255]},{value:.1,color:[51,153,255]},{value:.2,color:[102,204,255]},{value:.3,color:[153,204,255]},{value:.4,color:[204,204,255]},{value:.5,color:[255,255,255]},{value:.6,color:[255,204,255]},{value:.7,color:[255,153,255]},{value:.8,color:[255,102,204]},{value:.9,color:[255,102,102]},{value:1,color:[255,0,0]}]}),RAINBOW:new m({stops:[{value:0,color:[150,0,90]},{value:.125,color:[0,0,200]},{value:.25,color:[0,25,255]},{value:.375,color:[0,152,255]},{value:.5,color:[44,255,150]},{value:.625,color:[151,255,0]},{value:.75,color:[255,234,0]},{value:.875,color:[255,111,0]},{value:1,color:[255,0,0]}]}),PORTLAND:new m({stops:[{value:0,color:[12,51,131]},{value:.25,color:[10,136,186]},{value:.5,color:[242,211,56]},{value:.75,color:[242,143,56]},{value:1,color:[217,30,30]}]}),BLACKBODY:new m({stops:[{value:0,color:[0,0,0]},{value:.2,color:[230,0,0]},{value:.4,color:[230,210,0]},{value:.7,color:[255,255,255]},{value:1,color:[160,200,255]}]}),EARTH:new m({stops:[{value:0,color:[0,0,130]},{value:.1,color:[0,180,180]},{value:.2,color:[40,210,40]},{value:.4,color:[230,230,50]},{value:.6,color:[120,70,20]},{value:1,color:[255,255,255]}]}),ELECTRIC:new m({stops:[{value:0,color:[0,0,0]},{value:.15,color:[30,0,100]},{value:.4,color:[120,0,100]},{value:.6,color:[160,90,0]},{value:.8,color:[230,200,0]},{value:1,color:[255,250,220]}]}),VIRIDIS:new m({stops:[{value:0,color:[68,1,84]},{value:.13,color:[71,44,122]},{value:.25,color:[59,81,139]},{value:.38,color:[44,113,142]},{value:.5,color:[33,144,141]},{value:.63,color:[39,173,129]},{value:.75,color:[92,200,99]},{value:.88,color:[170,220,50]},{value:1,color:[253,231,37]}]}),INFERNO:new m({stops:[{value:0,color:[0,0,4]},{value:.13,color:[31,12,72]},{value:.25,color:[85,15,109]},{value:.38,color:[136,34,106]},{value:.5,color:[186,54,85]},{value:.63,color:[227,89,51]},{value:.75,color:[249,140,10]},{value:.88,color:[249,201,50]},{value:1,color:[252,255,164]}]}),MAGMA:new m({stops:[{value:0,color:[0,0,4]},{value:.13,color:[28,16,68]},{value:.25,color:[79,18,123]},{value:.38,color:[129,37,129]},{value:.5,color:[181,54,122]},{value:.63,color:[229,80,100]},{value:.75,color:[251,135,97]},{value:.88,color:[254,194,135]},{value:1,color:[252,253,191]}]}),PLASMA:new m({stops:[{value:0,color:[13,8,135]},{value:.13,color:[75,3,161]},{value:.25,color:[125,3,168]},{value:.38,color:[168,34,150]},{value:.5,color:[203,70,121]},{value:.63,color:[229,107,93]},{value:.75,color:[248,148,65]},{value:.88,color:[253,195,40]},{value:1,color:[240,249,33]}]}),WARM:new m({stops:[{value:0,color:[125,0,179]},{value:.13,color:[172,0,187]},{value:.25,color:[219,0,170]},{value:.38,color:[255,0,130]},{value:.5,color:[255,63,74]},{value:.63,color:[255,123,0]},{value:.75,color:[234,176,0]},{value:.88,color:[190,228,0]},{value:1,color:[147,255,0]}]}),COOL:new m({stops:[{value:0,color:[125,0,179]},{value:.13,color:[116,0,218]},{value:.25,color:[98,74,237]},{value:.38,color:[68,146,231]},{value:.5,color:[0,204,197]},{value:.63,color:[0,247,146]},{value:.75,color:[0,255,88]},{value:.88,color:[40,255,8]},{value:1,color:[147,255,0]}]}),RAINBOW_SOFT:new m({stops:[{value:0,color:[125,0,179]},{value:.1,color:[199,0,180]},{value:.2,color:[255,0,121]},{value:.3,color:[255,108,0]},{value:.4,color:[222,194,0]},{value:.5,color:[150,255,0]},{value:.6,color:[0,255,55]},{value:.7,color:[0,246,150]},{value:.8,color:[50,167,222]},{value:.9,color:[103,51,235]},{value:1,color:[124,0,186]}]}),BATHYMETRY:new m({stops:[{value:0,color:[40,26,44]},{value:.13,color:[59,49,90]},{value:.25,color:[64,76,139]},{value:.38,color:[63,110,151]},{value:.5,color:[72,142,158]},{value:.63,color:[85,174,163]},{value:.75,color:[120,206,163]},{value:.88,color:[187,230,172]},{value:1,color:[253,254,204]}]}),CDOM:new m({stops:[{value:0,color:[47,15,62]},{value:.13,color:[87,23,86]},{value:.25,color:[130,28,99]},{value:.38,color:[171,41,96]},{value:.5,color:[206,67,86]},{value:.63,color:[230,106,84]},{value:.75,color:[242,149,103]},{value:.88,color:[249,193,135]},{value:1,color:[254,237,176]}]}),CHLOROPHYLL:new m({stops:[{value:0,color:[18,36,20]},{value:.13,color:[25,63,41]},{value:.25,color:[24,91,59]},{value:.38,color:[13,119,72]},{value:.5,color:[18,148,80]},{value:.63,color:[80,173,89]},{value:.75,color:[132,196,122]},{value:.88,color:[175,221,162]},{value:1,color:[215,249,208]}]}),DENSITY:new m({stops:[{value:0,color:[54,14,36]},{value:.13,color:[89,23,80]},{value:.25,color:[110,45,132]},{value:.38,color:[120,77,178]},{value:.5,color:[120,113,213]},{value:.63,color:[115,151,228]},{value:.75,color:[134,185,227]},{value:.88,color:[177,214,227]},{value:1,color:[230,241,241]}]}),FREESURFACE_BLUE:new m({stops:[{value:0,color:[30,4,110]},{value:.13,color:[47,14,176]},{value:.25,color:[41,45,236]},{value:.38,color:[25,99,212]},{value:.5,color:[68,131,200]},{value:.63,color:[114,156,197]},{value:.75,color:[157,181,203]},{value:.88,color:[200,208,216]},{value:1,color:[241,237,236]}]}),FREESURFACE_RED:new m({stops:[{value:0,color:[60,9,18]},{value:.13,color:[100,17,27]},{value:.25,color:[142,20,29]},{value:.38,color:[177,43,27]},{value:.5,color:[192,87,63]},{value:.63,color:[205,125,105]},{value:.75,color:[216,162,148]},{value:.88,color:[227,199,193]},{value:1,color:[241,237,236]}]}),OXYGEN:new m({stops:[{value:0,color:[64,5,5]},{value:.13,color:[106,6,15]},{value:.25,color:[144,26,7]},{value:.38,color:[168,64,3]},{value:.5,color:[188,100,4]},{value:.63,color:[206,136,11]},{value:.75,color:[220,174,25]},{value:.88,color:[231,215,44]},{value:1,color:[248,254,105]}]}),PAR:new m({stops:[{value:0,color:[51,20,24]},{value:.13,color:[90,32,35]},{value:.25,color:[129,44,34]},{value:.38,color:[159,68,25]},{value:.5,color:[182,99,19]},{value:.63,color:[199,134,22]},{value:.75,color:[212,171,35]},{value:.88,color:[221,210,54]},{value:1,color:[225,253,75]}]}),PHASE:new m({stops:[{value:0,color:[145,105,18]},{value:.13,color:[184,71,38]},{value:.25,color:[186,58,115]},{value:.38,color:[160,71,185]},{value:.5,color:[110,97,218]},{value:.63,color:[50,123,164]},{value:.75,color:[31,131,110]},{value:.88,color:[77,129,34]},{value:1,color:[145,105,18]}]}),SALINITY:new m({stops:[{value:0,color:[42,24,108]},{value:.13,color:[33,50,162]},{value:.25,color:[15,90,145]},{value:.38,color:[40,118,137]},{value:.5,color:[59,146,135]},{value:.63,color:[79,175,126]},{value:.75,color:[120,203,104]},{value:.88,color:[193,221,100]},{value:1,color:[253,239,154]}]}),TEMPERATURE:new m({stops:[{value:0,color:[4,35,51]},{value:.13,color:[23,51,122]},{value:.25,color:[85,59,157]},{value:.38,color:[129,79,143]},{value:.5,color:[175,95,130]},{value:.63,color:[222,112,101]},{value:.75,color:[249,146,66]},{value:.88,color:[249,196,65]},{value:1,color:[232,250,91]}]}),TURBIDITY:new m({stops:[{value:0,color:[34,31,27]},{value:.13,color:[65,50,41]},{value:.25,color:[98,69,52]},{value:.38,color:[131,89,57]},{value:.5,color:[161,112,59]},{value:.63,color:[185,140,66]},{value:.75,color:[202,174,88]},{value:.88,color:[216,209,126]},{value:1,color:[233,246,171]}]}),VELOCITY_BLUE:new m({stops:[{value:0,color:[17,32,64]},{value:.13,color:[35,52,116]},{value:.25,color:[29,81,156]},{value:.38,color:[31,113,162]},{value:.5,color:[50,144,169]},{value:.63,color:[87,173,176]},{value:.75,color:[149,196,189]},{value:.88,color:[203,221,211]},{value:1,color:[254,251,230]}]}),VELOCITY_GREEN:new m({stops:[{value:0,color:[23,35,19]},{value:.13,color:[24,64,38]},{value:.25,color:[11,95,45]},{value:.38,color:[39,123,35]},{value:.5,color:[95,146,12]},{value:.63,color:[152,165,18]},{value:.75,color:[201,186,69]},{value:.88,color:[233,216,137]},{value:1,color:[255,253,205]}]}),CUBEHELIX:new m({stops:[{value:0,color:[0,0,0]},{value:.07,color:[22,5,59]},{value:.13,color:[60,4,105]},{value:.2,color:[109,1,135]},{value:.27,color:[161,0,147]},{value:.33,color:[210,2,142]},{value:.4,color:[251,11,123]},{value:.47,color:[255,29,97]},{value:.53,color:[255,54,69]},{value:.6,color:[255,85,46]},{value:.67,color:[255,120,34]},{value:.73,color:[255,157,37]},{value:.8,color:[241,191,57]},{value:.87,color:[224,220,93]},{value:.93,color:[218,241,142]},{value:1,color:[227,253,198]}]}),CIVIDIS:new m({stops:[{value:0,color:[0,32,77,255]},{value:.125,color:[5,54,110,255]},{value:.25,color:[65,77,108,255]},{value:.375,color:[97,100,111,255]},{value:.5,color:[125,124,121,255]},{value:.625,color:[156,149,120,255]},{value:.75,color:[190,175,111,255]},{value:.875,color:[225,204,94,255]},{value:1,color:[255,235,70,255]}]}),TURBO:new m({stops:[{value:0,color:[48,18,59,255]},{value:.125,color:[70,107,227,255]},{value:.25,color:[40,187,236,255]},{value:.375,color:[49,242,153,255]},{value:.5,color:[162,252,60,255]},{value:.625,color:[237,208,58,255]},{value:.75,color:[251,128,34,255]},{value:.875,color:[210,49,5,255]},{value:1,color:[122,4,3,255]}]}),ROCKET:new m({stops:[{value:0,color:[250,235,221,0]},{value:.133,color:[250,235,221,255]},{value:.266,color:[246,170,130,255]},{value:.4,color:[240,96,67,255]},{value:.533,color:[203,27,79,255]},{value:.666,color:[132,30,90,255]},{value:.8,color:[63,27,68,255]},{value:1,color:[3,5,26,255]}]}),MAKO:new m({stops:[{value:0,color:[11,4,5,255]},{value:.125,color:[43,28,53,255]},{value:.25,color:[62,53,107,255]},{value:.375,color:[59,86,152,255]},{value:.5,color:[53,123,162,255]},{value:.625,color:[53,158,170,255]},{value:.75,color:[73,193,173,255]},{value:.875,color:[150,221,181,255]},{value:1,color:[222,245,229,255]}]})},nt=[["#1D5B79","#468B97","#EF6262","#F3AA60"],["#614BC3","#33BBC5","#85E6C5","#C8FFE0"],["#461959","#7A316F","#CD6688","#AED8CC"],["#0079FF","#00DFA2","#F6FA70","#FF0060"],["#39B5E0","#A31ACB","#FF78F0","#F5EA5A"],["#37E2D5","#590696","#C70A80","#FBCB0A"],["#FFD36E","#FFF56D","#99FFCD","#9FB4FF"],["#00EAD3","#FFF5B7","#FF449F","#005F99"],["#10A19D","#540375","#FF7000","#FFBF00"]];function Ce(){return nt[~~(Math.random()*nt.length)][~~(Math.random()*4)]}function te(){return`maptiler_source_${Me()}`}function oe(){return`maptiler_layer_${Me()}`}function it(o,e){if(e<=o[0].zoom)return o[0].value;if(e>=o[o.length-1].zoom)return o[o.length-1].value;for(let t=0;t<o.length-1;t+=1)if(e>=o[t].zoom&&e<o[t+1].zoom){const r=o[t+1].zoom-o[t].zoom,a=(e-o[t].zoom)/r;return a*o[t+1].value+(1-a)*o[t].value}return 0}function j(o){return["interpolate",["linear"],["zoom"],...o.flatMap(e=>[e.zoom,e.value])]}function b(o){return["interpolate",["linear"],["zoom"],...o.flatMap(e=>[e.zoom,e.value])]}function xo(o,e){if(typeof e=="number"&&typeof o=="number")return 2*e+o;if(typeof e=="number"&&Array.isArray(o))return["interpolate",["linear"],["zoom"],...o.flatMap(t=>[t.zoom,2*e+t.value])];if(typeof o=="number"&&Array.isArray(e))return["interpolate",["linear"],["zoom"],...e.flatMap(t=>[t.zoom,2*t.value+o])];if(Array.isArray(o)&&Array.isArray(e)){const t=Array.from(new Set([...o.map(r=>r.zoom),...e.map(r=>r.zoom)])).sort((r,a)=>r<a?-1:1);return["interpolate",["linear"],["zoom"],...t.flatMap(r=>[r,2*it(e,r)+it(o,r)])]}return 0}function _o(o,e){return["interpolate",["linear"],["get",e],...o.flatMap(t=>[t.propertyValue,t.value])]}function lt(o){const e=o.trimStart(),t=`${e}${" ".repeat(o.length-e.length)}`,r=Array.from(t);if(!r.every(n=>n===" "||n==="_"))throw new Error("A dash pattern must be composed only of whitespace and underscore characters.");if(!(r.some(n=>n==="_")&&r.some(n=>n===" ")))throw new Error("A dash pattern must contain at least one underscore and one whitespace character");const a=[1];for(let n=1;n<r.length;n+=1){const i=r[n-1],l=r[n];i===l?a[a.length-1]+=1:a.push(1)}return a}function st(o,e){return["interpolate",["linear"],["get",e],...o.flatMap(t=>[t.value,t.color])]}function ct(o,e,t=!0){return t?["interpolate",["linear"],["zoom"],0,["interpolate",["linear"],["get",e],...o.flatMap(r=>[r.value,r.pointRadius*.025])],2,["interpolate",["linear"],["get",e],...o.flatMap(r=>[r.value,r.pointRadius*.05])],4,["interpolate",["linear"],["get",e],...o.flatMap(r=>[r.value,r.pointRadius*.1])],8,["interpolate",["linear"],["get",e],...o.flatMap(r=>[r.value,r.pointRadius*.25])],16,["interpolate",["linear"],["get",e],...o.flatMap(r=>[r.value,r.pointRadius])]]:["interpolate",["linear"],["get",e],...o.flatMap(r=>[r.value,r.pointRadius])]}function No(o,e,t=!0){return t?["interpolate",["linear"],["zoom"],0,["interpolate",["linear"],["get",e],...o.flatMap(r=>[r.propertyValue,r.value*.025])],2,["interpolate",["linear"],["get",e],...o.flatMap(r=>[r.propertyValue,r.value*.05])],4,["interpolate",["linear"],["get",e],...o.flatMap(r=>[r.propertyValue,r.value*.1])],8,["interpolate",["linear"],["get",e],...o.flatMap(r=>[r.propertyValue,r.value*.25])],16,["interpolate",["linear"],["get",e],...o.flatMap(r=>[r.propertyValue,r.value])]]:["interpolate",["linear"],["get",e],...o.flatMap(r=>[r.propertyValue,r.value])]}function ut(o,e){return o.every(t=>t.color[3]===o[0].color[3])?o[0].color[3]?o[0].color[3]/255:1:["interpolate",["linear"],["get",e],...o.getRawColorStops().flatMap(t=>{const r=t.value,a=t.color;return[r,a.length===4?a[3]/255:1]})]}function Po(o,e=10){return["interpolate",["linear"],["heatmap-density"],...Array.from({length:e+1},(t,r)=>{const a=r/e;return[a,o.getColorHex(a)]}).flat()]}async function Mo(o,e,t={}){if(!e.sourceId&&!e.data)throw new Error("Creating a polyline layer requires an existing .sourceId or a valid .data property");let r=e.data;if(typeof r=="string"){if(q(r))r=`https://api.maptiler.com/data/${e.data}/features.json?key=${E.apiKey}`;else if(r.split(".").pop()?.toLowerCase().trim()==="gpx"){const a=await(await fetch(r,t)).text();r=ve(a)}else if(r.split(".").pop()?.toLowerCase().trim()==="kml"){const a=await(await fetch(r,t)).text();r=fe(a)}else{const a=qt(r)??at(r);a&&(r=a)}if(!r)throw new Error("Polyline data was provided as string but is incompatible with valid formats.")}return ko(o,{...e,data:r})}function ko(o,e){if(e.layerId&&o.getLayer(e.layerId))throw new Error(`A layer already exists with the layer id: ${e.layerId}`);const t=e.sourceId??te(),r=e.layerId??oe(),a={polylineLayerId:r,polylineOutlineLayerId:"",polylineSourceId:t};e.data&&!o.getSource(t)&&o.addSource(t,{type:"geojson",data:e.data});const n=e.lineWidth??3,i=e.lineColor??Ce(),l=e.lineOpacity??1,u=e.lineBlur??0,s=e.lineGapWidth??0;let c=e.lineDashArray??null;const h=e.outlineWidth??1,g=e.outlineColor??"#FFFFFF",v=e.outlineOpacity??1,f=e.outlineBlur??0;if(typeof c=="string"&&(c=lt(c)),e.outline===!0){const y=`${r}_outline`;a.polylineOutlineLayerId=y,o.addLayer({id:y,type:"line",source:t,layout:{"line-join":e.lineJoin??"round","line-cap":e.lineCap??"round"},minzoom:e.minzoom??0,maxzoom:e.maxzoom??23,paint:{"line-opacity":typeof v=="number"?v:b(v),"line-color":typeof g=="string"?g:j(g),"line-width":xo(n,h),"line-blur":typeof f=="number"?f:b(f)}},e.beforeId)}return o.addLayer({id:r,type:"line",source:t,layout:{"line-join":e.lineJoin??"round","line-cap":e.lineCap??"round"},minzoom:e.minzoom??0,maxzoom:e.maxzoom??23,paint:{"line-opacity":typeof l=="number"?l:b(l),"line-color":typeof i=="string"?i:j(i),"line-width":typeof n=="number"?n:b(n),"line-blur":typeof u=="number"?u:b(u),"line-gap-width":typeof s=="number"?s:b(s),...c&&{"line-dasharray":c}}},e.beforeId),a}function Oo(o,e){if(e.layerId&&o.getLayer(e.layerId))throw new Error(`A layer already exists with the layer id: ${e.layerId}`);const t=e.sourceId??te(),r=e.layerId??oe(),a={polygonLayerId:r,polygonOutlineLayerId:e.outline?`${r}_outline`:"",polygonSourceId:t};if(e.data&&!o.getSource(t)){let y=e.data;typeof y=="string"&&q(y)&&(y=`https://api.maptiler.com/data/${y}/features.json?key=${E.apiKey}`),o.addSource(t,{type:"geojson",data:y})}let n=e.outlineDashArray??null;const i=e.outlineWidth??1,l=e.outlineColor??"#FFFFFF",u=e.outlineOpacity??1,s=e.outlineBlur??0,c=e.fillColor??Ce(),h=e.fillOpacity??1,g=e.outlinePosition??"center",v=e.pattern??null;typeof n=="string"&&(n=lt(n));const f=(y=null)=>{if(o.addLayer({id:r,type:"fill",source:t,minzoom:e.minzoom??0,maxzoom:e.maxzoom??23,paint:{"fill-color":typeof c=="string"?c:j(c),"fill-opacity":typeof h=="number"?h:b(h),...y&&{"fill-pattern":y}}},e.beforeId),e.outline===!0){let C;g==="inside"?typeof i=="number"?C=.5*i:C=b(i.map(({zoom:_,value:A})=>({zoom:_,value:.5*A}))):g==="outside"?typeof i=="number"?C=-.5*i:C=b(i.map(_=>({zoom:_.zoom,value:-.5*_.value}))):C=0,o.addLayer({id:a.polygonOutlineLayerId,type:"line",source:t,layout:{"line-join":e.outlineJoin??"round","line-cap":e.outlineCap??"butt"},minzoom:e.minzoom??0,maxzoom:e.maxzoom??23,paint:{"line-opacity":typeof u=="number"?u:b(u),"line-color":typeof l=="string"?l:j(l),"line-width":typeof i=="number"?i:b(i),"line-blur":typeof s=="number"?s:b(s),"line-offset":C,...n&&{"line-dasharray":n}}},e.beforeId)}};return v?o.hasImage(v)?f(v):o.loadImage(v).then(y=>{o.addImage(v,y.data),f(v)}).catch(y=>(console.error("Could not load the pattern image.",y.message),f())):f(),a}function Fo(o,e){if(e.layerId&&o.getLayer(e.layerId))throw new Error(`A layer already exists with the layer id: ${e.layerId}`);const t=e.minPointRadius??10,r=e.maxPointRadius??50,a=e.cluster??!1,n=20,i=Array.isArray(e.pointColor)?e.pointColor:we.TURBO.scale(10,e.cluster?1e4:1e3).resample("ease-out-square"),l=i.getBounds(),u=e.sourceId??te(),s=e.layerId??oe(),c=e.showLabel??a,h=e.alignOnViewport??!0,g=e.outline??!1,v=e.outlineOpacity??1,f=e.outlineWidth??1,y=e.outlineColor??"#FFFFFF";let C;const _=e.zoomCompensation??!0,A=e.minzoom??0,I=e.maxzoom??23;typeof e.pointOpacity=="number"?C=e.pointOpacity:Array.isArray(e.pointOpacity)?C=b(e.pointOpacity):e.cluster?C=ut(i,"point_count"):e.property?C=ut(i,e.property):C=b([{zoom:A,value:0},{zoom:A+.25,value:1},{zoom:I-.25,value:1},{zoom:I,value:0}]);const R={pointLayerId:s,clusterLayerId:"",labelLayerId:"",pointSourceId:u};if(e.data&&!o.getSource(u)){let T=e.data;typeof T=="string"&&q(T)&&(T=`https://api.maptiler.com/data/${T}/features.json?key=${E.apiKey}`),o.addSource(u,{type:"geojson",data:T,cluster:a})}if(a){R.clusterLayerId=`${s}_cluster`;const T=Array.from({length:n},(z,H)=>{const K=l.min+H*(l.max-l.min)/(n-1);return{value:K,pointRadius:t+(r-t)*(H/(n-1))**.5,color:i.getColorHex(K)}});o.addLayer({id:R.clusterLayerId,type:"circle",source:u,filter:["has","point_count"],paint:{"circle-color":typeof e.pointColor=="string"?e.pointColor:st(T,"point_count"),"circle-radius":typeof e.pointRadius=="number"?e.pointRadius:Array.isArray(e.pointRadius)?b(e.pointRadius):ct(T,"point_count",!1),"circle-pitch-alignment":h?"viewport":"map","circle-pitch-scale":"map","circle-opacity":C,...g&&{"circle-stroke-opacity":typeof v=="number"?v:b(v),"circle-stroke-width":typeof f=="number"?f:b(f),"circle-stroke-color":typeof y=="string"?y:j(y)}},minzoom:A,maxzoom:I},e.beforeId),o.addLayer({id:R.pointLayerId,type:"circle",source:u,filter:["!",["has","point_count"]],paint:{"circle-pitch-alignment":h?"viewport":"map","circle-pitch-scale":"map","circle-color":typeof e.pointColor=="string"?e.pointColor:i.getColorHex(i.getBounds().min),"circle-radius":typeof e.pointRadius=="number"?e.pointRadius:Array.isArray(e.pointRadius)?b(e.pointRadius):T[0].pointRadius*.75,"circle-opacity":C,...g&&{"circle-stroke-opacity":typeof v=="number"?v:b(v),"circle-stroke-width":typeof f=="number"?f:b(f),"circle-stroke-color":typeof y=="string"?y:j(y)}},minzoom:A,maxzoom:I},e.beforeId)}else{let T=typeof e.pointColor=="string"?e.pointColor:Array.isArray(e.pointColor)?e.pointColor.getColorHex(e.pointColor.getBounds().min):Ce(),z=typeof e.pointRadius=="number"?_?b([{zoom:0,value:e.pointRadius*.025},{zoom:2,value:e.pointRadius*.05},{zoom:4,value:e.pointRadius*.1},{zoom:8,value:e.pointRadius*.25},{zoom:16,value:e.pointRadius*1}]):e.pointRadius:Array.isArray(e.pointRadius)?b(e.pointRadius):_?b([{zoom:0,value:t*.05},{zoom:2,value:t*.1},{zoom:4,value:t*.2},{zoom:8,value:t*.5},{zoom:16,value:t*1}]):t;if(e.property&&Array.isArray(e.pointColor)){const H=Array.from({length:n},(K,Z)=>{const Y=l.min+Z*(l.max-l.min)/(n-1);return{value:Y,pointRadius:typeof e.pointRadius=="number"?e.pointRadius:t+(r-t)*(Z/(n-1))**.5,color:typeof e.pointColor=="string"?e.pointColor:i.getColorHex(Y)}});T=st(H,e.property),z=ct(H,e.property,_)}o.addLayer({id:R.pointLayerId,type:"circle",source:u,layout:{"circle-sort-key":e.property?["/",1,["get",e.property]]:0},paint:{"circle-pitch-alignment":h?"viewport":"map","circle-pitch-scale":"map","circle-color":T,"circle-opacity":C,"circle-radius":z,...g&&{"circle-stroke-opacity":typeof v=="number"?v:b(v),"circle-stroke-width":typeof f=="number"?f:b(f),"circle-stroke-color":typeof y=="string"?y:j(y)}},minzoom:A,maxzoom:I},e.beforeId)}if(c!==!1&&(e.cluster||e.property)){R.labelLayerId=`${s}_label`;const T=e.labelColor??"#fff",z=e.labelSize??12;o.addLayer({id:R.labelLayerId,type:"symbol",source:u,filter:["has",e.cluster?"point_count":e.property],layout:{"text-field":e.cluster?"{point_count_abbreviated}":`{${e.property}}`,"text-font":["Noto Sans Regular"],"text-size":z,"text-pitch-alignment":h?"viewport":"map","symbol-sort-key":["/",1,["get",e.cluster?"point_count":e.property]]},paint:{"text-color":T,"text-opacity":C},minzoom:A,maxzoom:I},e.beforeId)}return R}function zo(o,e){if(e.layerId&&o.getLayer(e.layerId))throw new Error(`A layer already exists with the layer id: ${e.layerId}`);const t=e.sourceId??te(),r=e.layerId??oe(),a=e.minzoom??0,n=e.maxzoom??23,i=e.zoomCompensation??!0,l=e.opacity??[{zoom:a,value:0},{zoom:a+.25,value:1},{zoom:n-.25,value:1},{zoom:n,value:0}];let u=Array.isArray(e.colorRamp)?e.colorRamp:we.TURBO.transparentStart();const s=u.getBounds();(s.min!==0||s.max!==1)&&(u=u.scale(0,1)),u.hasTransparentStart()||(u=u.transparentStart());const c=e.intensity??[{zoom:0,value:.01},{zoom:4,value:.2},{zoom:16,value:1}],h=e.property??null,g=e.weight??1;let v=1;h?typeof g=="number"?(v=g,typeof e.weight=="number"&&console.warn("The option `.property` is ignored when `.propertyValueWeights` is not of type `PropertyValueWeights`")):Array.isArray(g)?v=_o(g,h):console.warn("The option `.property` is ignored when `.propertyValueWeights` is not of type `PropertyValueWeights`"):typeof g=="number"?v=g:Array.isArray(g)&&console.warn("The options `.propertyValueWeights` can only be used when `.property` is provided.");const f=[{zoom:0,value:50*.025},{zoom:2,value:50*.05},{zoom:4,value:50*.1},{zoom:8,value:50*.25},{zoom:16,value:50}],y=e.radius??(i?f:10);let C=1;typeof y=="number"?C=y:Array.isArray(y)&&"zoom"in y[0]?C=b(y):h&&Array.isArray(y)&&"propertyValue"in y[0]?C=No(y,h,i):!h&&Array.isArray(y)&&"propertyValue"in y[0]?(C=b(f),console.warn("The option `.radius` can only be property-driven if the option `.property` is provided.")):C=b(f);const _={heatmapLayerId:r,heatmapSourceId:t};if(e.data&&!o.getSource(t)){let A=e.data;typeof A=="string"&&q(A)&&(A=`https://api.maptiler.com/data/${A}/features.json?key=${E.apiKey}`),o.addSource(t,{type:"geojson",data:A})}return o.addLayer({id:r,type:"heatmap",source:t,minzoom:a,maxzoom:n,paint:{"heatmap-weight":v,"heatmap-intensity":typeof c=="number"?c:b(c),"heatmap-color":Po(u),"heatmap-radius":C,"heatmap-opacity":typeof l=="number"?l:b(l)}}),_}const Bo={addPolyline:Mo,addPolygon:Oo,addPoint:Fo,addHeatmap:zo},{setRTLTextPlugin:$o,getRTLTextPluginStatus:Uo,LngLat:Ho,LngLatBounds:Go,MercatorCoordinate:Do,Evented:Wo,AJAXError:Pr,prewarm:jo,clearPrewarmedResources:Vo,addProtocol:Se,removeProtocol:Ko,Hash:Zo,Point:Yo,config:qo,EdgeInsets:Jo,DragRotateHandler:Xo,DragPanHandler:Qo,TwoFingersTouchZoomRotateHandler:er,DoubleClickZoomHandler:tr,TwoFingersTouchZoomHandler:or,TwoFingersTouchRotateHandler:rr,getWorkerCount:ar,setWorkerCount:nr,getMaxParallelImageRequests:ir,setMaxParallelImageRequests:lr,getWorkerUrl:sr,setWorkerUrl:cr,addSourceType:ur,importScriptInWorkers:pr}=p;function hr(){return $t.version}function mr(){return p.getVersion()}const dr=p.Map,gr=p.Marker,yr=p.Popup,vr=p.Style;p.CanvasSource,p.GeoJSONSource;const fr=p.ImageSource,Lr=p.RasterTileSource;p.RasterDEMTileSource,p.VectorTileSource;const Ar=p.VideoSource;p.NavigationControl,p.GeolocateControl,p.AttributionControl,p.LogoControl,p.ScaleControl,p.FullscreenControl,p.TerrainControl;const wr=p.BoxZoomHandler,Cr=p.ScrollZoomHandler,Sr=p.CooperativeGesturesHandler,br=p.KeyboardHandler,Tr=p.TwoFingersTouchPitchHandler;p.MapWheelEvent,p.MapTouchEvent,p.MapMouseEvent;export{uo as AttributionControl,ho as BoxZoomHandler,wr as BoxZoomHandlerMLGL,ro as CanvasSource,m as ColorRamp,we as ColorRampCollection,go as CooperativeGesturesHandler,Sr as CooperativeGesturesHandlerMLGL,tr as DoubleClickZoomHandler,Qo as DragPanHandler,Xo as DragRotateHandler,Jo as EdgeInsets,Wo as Evented,De as FullscreenControl,ao as GeoJSONSource,Be as GeolocateControl,Ke as GeolocationType,Zo as Hash,no as ImageSource,fr as ImageSourceMLGL,yo as KeyboardHandler,br as KeyboardHandlerMLGL,w as Language,Or as LanguageGeocoding,Ho as LngLat,Go as LngLatBounds,Re as LogoControl,Ze as Map,dr as MapMLGL,Ao as MapMouseEvent,Fr as MapStyle,zr as MapStyleVariant,Lo as MapTouchEvent,fo as MapWheelEvent,He as MaptilerGeolocateControl,ie as MaptilerLogoControl,ze as MaptilerNavigationControl,Oe as MaptilerTerrainControl,eo as Marker,gr as MarkerMLGL,Do as MercatorCoordinate,Fe as NavigationControl,Yo as Point,to as Popup,yr as PopupMLGL,lo as RasterDEMTileSource,io as RasterTileSource,Lr as RasterTileSourceMLGL,Br as ReferenceMapStyle,Ge as ScaleControl,mo as ScrollZoomHandler,Cr as ScrollZoomHandlerMLGL,Ie as SdkConfig,$r as ServiceError,oo as Style,vr as StyleMLGL,po as TerrainControl,vo as TwoFingersTouchPitchHandler,Tr as TwoFingersTouchPitchHandlerMLGL,rr as TwoFingersTouchRotateHandler,or as TwoFingersTouchZoomHandler,er as TwoFingersTouchZoomRotateHandler,so as VectorTileSource,co as VideoSource,Ar as VideoSourceMLGL,Se as addProtocol,ur as addSourceType,Ur as bufferToPixelDataBrowser,Hr as circumferenceAtLatitude,Vo as clearPrewarmedResources,E as config,qo as configMLGL,Gr as coordinates,Dr as data,Wr as elevation,jr as expandMapStyle,Vr as geocoding,Kr as geolocation,Zr as getAutoLanguageGeocoding,ne as getBrowserLanguage,Yr as getBufferToPixelDataParser,mr as getMapLibreVersion,ir as getMaxParallelImageRequests,Uo as getRTLTextPluginStatus,qr as getTileCache,hr as getVersion,ar as getWorkerCount,sr as getWorkerUrl,ve as gpx,at as gpxOrKml,ge as hasChildNodeWithName,Bo as helpers,pr as importScriptInWorkers,ae as isLanguageSupported,fe as kml,Jr as mapStylePresetList,Xr as math,Qr as misc,jo as prewarm,Ko as removeProtocol,lr as setMaxParallelImageRequests,$o as setRTLTextPlugin,nr as setWorkerCount,cr as setWorkerUrl,ea as staticMaps,X as str2xml,ta as styleToStyle,ye as xml2str};
1
+ import C,{addProtocol as we}from"maplibre-gl";import{AJAXError as Wo,AttributionControl as Ko,BoxZoomHandler as Zo,CanvasSource as Yo,CooperativeGesturesHandler as qo,DoubleClickZoomHandler as Jo,DragPanHandler as Xo,DragRotateHandler as Qo,EdgeInsets as er,Evented as tr,FullscreenControl as or,GeoJSONSource as rr,GeolocateControl as ar,Hash as nr,ImageSource as ir,KeyboardHandler as lr,LngLat as sr,LngLatBounds as cr,LogoControl as ur,Map as pr,MapMouseEvent as hr,MapTouchEvent as mr,MapWheelEvent as dr,Marker as gr,MercatorCoordinate as yr,NavigationControl as vr,Point as fr,Popup as Lr,RasterDEMTileSource as Ar,RasterTileSource as wr,ScaleControl as Cr,ScrollZoomHandler as Sr,Style as br,TerrainControl as Tr,TwoFingersTouchPitchHandler as Ir,TwoFingersTouchRotateHandler as Er,TwoFingersTouchZoomHandler as Rr,TwoFingersTouchZoomRotateHandler as xr,VectorTileSource as Nr,VideoSource as _r,addProtocol as Mr,addSourceType as Pr,clearPrewarmedResources as Or,config as kr,getVersion as Fr,getMaxParallelImageRequests as zr,getRTLTextPluginStatus as Br,getWorkerCount as Ur,getWorkerUrl as Gr,importScriptInWorkers as Hr,prewarm as Dr,removeProtocol as $r,setMaxParallelImageRequests as jr,setRTLTextPlugin as Vr,setWorkerCount as Wr,setWorkerUrl as Kr}from"maplibre-gl";import dt from"events";import{config as re,expandMapStyle as gt,MapStyleVariant as yt,ReferenceMapStyle as vt,MapStyle as ft,mapStylePresetList as Lt,geolocation as Ce}from"@maptiler/client";import{LanguageGeocoding as Yr,MapStyle as qr,MapStyleVariant as Jr,ReferenceMapStyle as Xr,ServiceError as Qr,bufferToPixelDataBrowser as ea,circumferenceAtLatitude as ta,coordinates as oa,data as ra,elevation as aa,expandMapStyle as na,geocoding as ia,geolocation as la,getAutoLanguageGeocoding as sa,getBufferToPixelDataParser as ca,getTileCache as ua,mapStylePresetList as pa,math as ha,misc as ma,staticMaps as da,styleToStyle as ga}from"@maptiler/client";import{v4 as At}from"uuid";import{Base64 as wt}from"js-base64";var Ct="@maptiler/sdk",St="2.2.1",bt="The Javascript & TypeScript map SDK tailored for MapTiler Cloud",Tt="dist/maptiler-sdk.mjs",It="dist/maptiler-sdk.d.ts",Et="dist/maptiler-sdk.css",Rt="module",xt={".":{import:"./dist/maptiler-sdk.mjs",types:"./dist/maptiler-sdk.d.ts"},"./dist/maptiler-sdk.css":{import:"./dist/maptiler-sdk.css"},"./style.css":{import:"./dist/maptiler-sdk.css"}},Nt=["maptiler","map","sdk","webmap","cloud","webGL","maplibre"],_t="https://docs.maptiler.com/sdk-js/",Mt="BSD-3-Clause",Pt={type:"git",url:"https://github.com/maptiler/maptiler-sdk-js.git"},Ot={build:"rm -rf dist/* && NODE_ENV=production rollup -c",dev:"rm -rf dist/* && NODE_ENV=development rollup -c -w",biome:"biome check --max-diagnostics=1000","biome:fix":"npx @biomejs/biome check --max-diagnostics=1000 --write",doc:"rm -rf docs/* && typedoc --out docs && cp -r images docs/",prepare:"npm run biome:fix && npm run build && npm run test","test:dev":"vitest dev",test:"vitest run"},kt="MapTiler",Ft={"@biomejs/biome":"1.8.3","@rollup/plugin-commonjs":"^26.0.1","@rollup/plugin-json":"^6.1.0","@rollup/plugin-node-resolve":"^15.2.3","@types/uuid":"^9.0.2","@types/xmldom":"^0.1.31",rollup:"^4.18.0","rollup-plugin-copy-merge":"^1.0.2","rollup-plugin-dts":"^6.1.1","rollup-plugin-esbuild":"^6.1.1","rollup-plugin-node-globals":"^1.4.0","rollup-plugin-shell":"^1.0.9","rollup-plugin-string":"^3.0.0","rollup-plugin-swc":"^0.2.1",serve:"^14.2.0",terser:"^5.17.1",typedoc:"^0.24.8",typescript:"^5.1.6",vitest:"^0.34.2",xmldom:"^0.6.0"},zt={"@maptiler/client":"^1.8.1",events:"^3.3.0","js-base64":"^3.7.4","maplibre-gl":"4.4.1",uuid:"^9.0.0"},Bt={name:Ct,version:St,description:bt,module:Tt,types:It,style:Et,type:Rt,exports:xt,keywords:Nt,homepage:_t,license:Mt,repository:Pt,scripts:Ot,author:kt,devDependencies:Ft,dependencies:zt};const A={VISITOR:"visitor",VISITOR_ENGLISH:"visitor_en",STYLE:"style",AUTO:"auto",STYLE_LOCK:"style_lock",LATIN:"name:latin",NON_LATIN:"name:nonlatin",LOCAL:"name",INTERNATIONAL:"name_int",ALBANIAN:"name:sq",AMHARIC:"name:am",ARABIC:"name:ar",ARMENIAN:"name:hy",AZERBAIJANI:"name:az",BASQUE:"name:eu",BELORUSSIAN:"name:be",BENGALI:"name:bn",BOSNIAN:"name:bs",BRETON:"name:br",BULGARIAN:"name:bg",CATALAN:"name:ca",CHINESE:"name:zh",TRADITIONAL_CHINESE:"name:zh-Hant",SIMPLIFIED_CHINESE:"name:zh-Hans",CORSICAN:"name:co",CROATIAN:"name:hr",CZECH:"name:cs",DANISH:"name:da",DUTCH:"name:nl",ENGLISH:"name:en",ESPERANTO:"name:eo",ESTONIAN:"name:et",FINNISH:"name:fi",FRENCH:"name:fr",FRISIAN:"name:fy",GEORGIAN:"name:ka",GERMAN:"name:de",GREEK:"name:el",HEBREW:"name:he",HINDI:"name:hi",HUNGARIAN:"name:hu",ICELANDIC:"name:is",INDONESIAN:"name:id",IRISH:"name:ga",ITALIAN:"name:it",JAPANESE:"name:ja",JAPANESE_HIRAGANA:"name:ja-Hira",JAPANESE_KANA:"name:ja_kana",JAPANESE_LATIN:"name:ja_rm",JAPANESE_2018:"name:ja-Latn",KANNADA:"name:kn",KAZAKH:"name:kk",KOREAN:"name:ko",KOREAN_LATIN:"name:ko-Latn",KURDISH:"name:ku",ROMAN_LATIN:"name:la",LATVIAN:"name:lv",LITHUANIAN:"name:lt",LUXEMBOURGISH:"name:lb",MACEDONIAN:"name:mk",MALAYALAM:"name:ml",MALTESE:"name:mt",NORWEGIAN:"name:no",OCCITAN:"name:oc",PERSIAN:"name:fa",POLISH:"name:pl",PORTUGUESE:"name:pt",PUNJABI:"name:pa",WESTERN_PUNJABI:"name:pnb",ROMANIAN:"name:ro",ROMANSH:"name:rm",RUSSIAN:"name:ru",SCOTTISH_GAELIC:"name:gd",SERBIAN_CYRILLIC:"name:sr",SERBIAN_LATIN:"name:sr-Latn",SLOVAK:"name:sk",SLOVENE:"name:sl",SPANISH:"name:es",SWEDISH:"name:sv",TAMIL:"name:ta",TELUGU:"name:te",THAI:"name:th",TURKISH:"name:tr",UKRAINIAN:"name:uk",URDU:"name:ur",VIETNAMIAN_LATIN:"name:vi",WELSH:"name:cy"},Ut=new Set(Object.values(A));function ae(o){return Ut.has(o)}const Gt=new Set(Object.values(A));function ne(){if(typeof navigator>"u")return`name:${Intl.DateTimeFormat().resolvedOptions().locale.split("-")[0]}`;const o=Array.from(new Set(navigator.languages.map(e=>`name:${e.split("-")[0]}`))).filter(e=>Gt.has(e));return o.length?o[0]:A.LOCAL}const M={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:A.STYLE,secondaryLanguage:A.LOCAL,terrainSourceURL:"https://api.maptiler.com/tiles/terrain-rgb-v2/tiles.json",terrainSourceId:"maptiler-terrain"};Object.freeze(M);const Se=At();class be extends dt{constructor(){super(...arguments),this.primaryLanguage=M.primaryLanguage,this.session=!0,this.caching=!0,this._unit="metric",this._apiKey=""}set unit(e){this._unit=e,this.emit("unit",e)}get unit(){return this._unit}set apiKey(e){this._apiKey=e,re.apiKey=e,this.emit("apiKey",e)}get apiKey(){return this._apiKey}set fetch(e){re.fetch=e}get fetch(){return re.fetch}}const R=new be,ie="localcache_source",le="localcache",Ht="maptiler_sdk",Dt=1e3,$t=100,se=typeof caches<"u";function jt(o,e){if(se&&R.caching&&R.session&&o.host===M.maptilerApiHost){if(e==="Source"&&o.href.includes("tiles.json"))return o.href.replace("https://",`${ie}://`);if(e==="Tile"||e==="Glyphs")return o.href.replace("https://",`${le}://`)}return o.href}let ce;async function Te(){return ce||(ce=await caches.open(Ht)),ce}let Ie=0;async function Vt(){const o=await Te(),e=await o.keys(),t=e.slice(0,Math.max(e.length-Dt,0));for(const r of t)o.delete(r)}function Wt(){we(ie,async(o,e)=>{if(!o.url)throw new Error("");o.url=o.url.replace(`${ie}://`,"https://");const t=o;t.signal=e.signal;const r=await fetch(o.url,t),a=await r.json();return a.tiles&&a.tiles.length>0&&(a.tiles[0]+=`&last-modified=${r.headers.get("Last-Modified")}`),{data:a,cacheControl:r.headers.get("Cache-Control"),expires:r.headers.get("Expires")}}),we(le,async(o,e)=>{if(!o.url)throw new Error("");o.url=o.url.replace(`${le}://`,"https://");const t=new URL(o.url),r=new URL(t);r.searchParams.delete("mtsid"),r.searchParams.delete("key");const a=r.toString(),n=new URL(t);n.searchParams.delete("last-modified");const i=n.toString(),l=async d=>({data:await d.arrayBuffer(),cacheControl:d.headers.get("Cache-Control"),expires:d.headers.get("Expires")}),u=await Te(),s=await u.match(a);if(s)return l(s);const c=o;c.signal=e.signal;const p=await fetch(i,c);return p.status>=200&&p.status<300&&(u.put(a,p.clone()).catch(()=>{}),++Ie>$t&&(Vt(),Ie=0)),l(p)})}function Kt(){if(typeof window>"u")return;const o=C.getRTLTextPluginStatus();if(o==="unavailable"||o==="requested")try{C.setRTLTextPlugin(M.rtlPluginURL,!0)}catch{}}function Zt(o,e){for(const t of o)typeof e[t]=="function"&&(e[t]=e[t].bind(e))}function U(o,e,t){const r=window.document.createElement(o);return e!==void 0&&(r.className=e),t&&t.appendChild(r),r}function Ee(o){o.parentNode&&o.parentNode.removeChild(o)}function Re(o,e){let t=null;try{t=new URL(o)}catch{return{url:o}}return t.host===M.maptilerApiHost&&(t.searchParams.has("key")||t.searchParams.append("key",R.apiKey),R.session&&t.searchParams.append("mtsid",Se)),{url:jt(t,e)}}function xe(o){return(e,t)=>{if(o!=null){const r=o(e,t),a=Re(r?.url??"",t);return{...r,...a}}return Re(e,t)}}function Ne(){return Math.random().toString(36).substring(2)}function q(o){return/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/gi.test(o)}function Yt(o){try{return JSON.parse(o)}catch{}return null}function qt(){return document.createElement("canvas").getContext("webgl2")?null:typeof WebGL2RenderingContext<"u"?"Graphic rendering with WebGL2 has been disabled or is not supported by your graphic card. The map cannot be displayed.":"Your browser does not support graphic rendering with WebGL2. The map cannot be displayed."}function Jt(o){const e=qt();if(!e)return;let t=null;if(typeof o=="string"?t=document.getElementById(o):o instanceof HTMLElement&&(t=o),!t)throw new Error("The Map container must be provided.");const r=document.createElement("div");throw r.innerHTML=e,r.classList.add("no-webgl-support-div"),t.appendChild(r),new Error(e)}class Xt extends C.Marker{addTo(e){return super.addTo(e)}}class Qt extends C.Popup{addTo(e){return super.addTo(e)}}class eo extends C.Style{constructor(e,t={}){super(e,t)}}class to extends C.CanvasSource{onAdd(e){super.onAdd(e)}}class oo extends C.GeoJSONSource{onAdd(e){super.onAdd(e)}}class ro extends C.ImageSource{onAdd(e){super.onAdd(e)}}class ao extends C.RasterTileSource{onAdd(e){super.onAdd(e)}}class no extends C.RasterDEMTileSource{onAdd(e){super.onAdd(e)}}class io extends C.VectorTileSource{onAdd(e){super.onAdd(e)}}class lo extends C.VideoSource{onAdd(e){super.onAdd(e)}}class _e extends C.NavigationControl{onAdd(e){return super.onAdd(e)}}class Me extends C.GeolocateControl{onAdd(e){return super.onAdd(e)}}class so extends C.AttributionControl{onAdd(e){return super.onAdd(e)}}class Pe extends C.LogoControl{onAdd(e){return super.onAdd(e)}}class Oe extends C.ScaleControl{onAdd(e){return super.onAdd(e)}}class ke extends C.FullscreenControl{onAdd(e){return super.onAdd(e)}}class co extends C.TerrainControl{onAdd(e){return super.onAdd(e)}}class uo extends C.BoxZoomHandler{constructor(e,t){super(e,t)}}class po extends C.ScrollZoomHandler{constructor(e,t){super(e,t)}}class ho extends C.CooperativeGesturesHandler{constructor(e,t){super(e,t)}}class mo extends C.KeyboardHandler{constructor(e){super(e)}}class go extends C.TwoFingersTouchPitchHandler{constructor(e){super(e)}}class yo extends C.MapWheelEvent{constructor(e,t,r){super(e,t,r)}}class vo extends C.MapTouchEvent{constructor(e,t,r){super(e,t,r)}}class fo extends C.MapMouseEvent{constructor(e,t,r,a={}){super(e,t,r,a)}}class ue extends Pe{constructor(e={}){super(e),this.logoURL="",this.linkURL="",this.logoURL=e.logoURL??M.maptilerLogoURL,this.linkURL=e.linkURL??M.maptilerURL}onAdd(e){this._map=e,this._compact=this.options.compact??!1,this._container=window.document.createElement("div"),this._container.className="maplibregl-ctrl";const t=window.document.createElement("a");return t.style.backgroundRepeat="no-repeat",t.style.cursor="pointer",t.style.display="block",t.style.height="23px",t.style.margin="0 0 -4px -4px",t.style.overflow="hidden",t.style.width="88px",t.style.backgroundImage=`url(${this.logoURL})`,t.style.backgroundSize="100px 30px",t.style.width="100px",t.style.height="30px",t.target="_blank",t.rel="noopener",t.href=this.linkURL,t.setAttribute("aria-label","MapTiler logo"),t.setAttribute("rel","noopener"),this._container.appendChild(t),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}}function Fe(o){return o?typeof o=="string"||o instanceof String?!o.startsWith("http")&&o.toLowerCase().includes(".json")?o:gt(o):o instanceof yt?o.getExpandedStyleURL():o instanceof vt?o.getDefaultVariant().getExpandedStyleURL():o:ft[Lt[0].referenceStyleID].getDefaultVariant().getExpandedStyleURL()}class ze{constructor(){Zt(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(e){return this._map=e,this._container=U("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=U("button","maplibregl-ctrl-terrain",this._container),U("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(){Ee(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.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))}}class Be extends _e{constructor(){super({showCompass:!0,showZoom:!0,visualizePitch:!0}),this._rotateCompassArrow=()=>{const e=this.options.visualizePitch?`scale(${Math.min(1.5,1/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=e},this._compass.removeEventListener("click",this._compass.clickFunction),this._compass.addEventListener("click",e=>{this._map.getPitch()===0?this._map.easeTo({pitch:Math.min(this._map.getMaxPitch(),80)}):this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})})}_createButton(e,t){const r=super._createButton(e,t);return r.clickFunction=t,r}}const Ue=C.Marker,Ge=C.LngLat,Lo=C.LngLatBounds;class He extends Me{constructor(){super(...arguments),this.lastUpdatedCenter=new Ge(0,0),this._updateCamera=e=>{const t=new Ge(e.coords.longitude,e.coords.latitude),r=e.coords.accuracy,a={bearing:this._map.getBearing(),...this.options.fitBoundsOptions,linear:!0},n=this._map.getZoom();n>(this.options?.fitBoundsOptions?.maxZoom??30)&&(a.zoom=n),this._map.fitBounds(Lo.fromLngLat(t,r),a,{geolocateSource:!0});let i=!1;const l=()=>{i=!0};this._map.once("click",l),this._map.once("dblclick",l),this._map.once("dragstart",l),this._map.once("mousedown",l),this._map.once("touchstart",l),this._map.once("wheel",l),this._map.once("moveend",()=>{this._map.off("click",l),this._map.off("dblclick",l),this._map.off("dragstart",l),this._map.off("mousedown",l),this._map.off("touchstart",l),this._map.off("wheel",l),!i&&(this.lastUpdatedCenter=this._map.getCenter())})},this._setupUI=e=>{if(this.lastUpdatedCenter=this._map.getCenter(),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=U("button","maplibregl-ctrl-geolocate",this._container),U("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",e===!1){const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}else{const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=U("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Ue({element:this._dotElement}),this._circleElement=U("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Ue({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",t=>{const r=t.originalEvent&&t.originalEvent.type==="resize",a=this.lastUpdatedCenter.distanceTo(this._map.getCenter());!t.geolocateSource&&this._watchState==="ACTIVE_LOCK"&&!r&&a>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")))})},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}}_updateCircleRadius(){if(this._watchState!=="BACKGROUND"&&this._watchState!=="ACTIVE_LOCK")return;const e=[this._lastKnownPosition.coords.longitude,this._lastKnownPosition.coords.latitude],t=this._map.project(e),r=this._map.unproject([t.x,t.y]),a=this._map.unproject([t.x+20,t.y]),n=r.distanceTo(a)/20,i=Math.ceil(2*this._accuracy/n);this._circleElement.style.width=`${i}px`,this._circleElement.style.height=`${i}px`}}var De=o=>{throw TypeError(o)},pe=(o,e,t)=>e.has(o)||De("Cannot "+t),f=(o,e,t)=>(pe(o,e,"read from private field"),t?t.call(o):e.get(o)),G=(o,e,t)=>e.has(o)?De("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(o):e.set(o,t),W=(o,e,t,r)=>(pe(o,e,"write to private field"),e.set(o,t),t),P=(o,e,t)=>(pe(o,e,"access private method"),t),O,B,D,$e,$,k,J,_,je,F,Ve;class he{constructor(e,t){G(this,_),G(this,O),G(this,B),G(this,D),G(this,$e),G(this,$),G(this,k,!1),G(this,J),e.style!==void 0&&W(this,k,!0),W(this,O,{zoomAdjust:-4,position:"top-right",...t,forceNoAttributionControl:!0,attributionControl:!1,navigationControl:!1,geolocateControl:!1,maptilerLogo:!1,minimap:!1,hash:!1,pitchAdjust:!1,...e,containerStyle:{border:"1px solid #000",width:"400px",height:"300px",...e.containerStyle??{}}}),e.lockZoom!==void 0&&(f(this,O).minZoom=e.lockZoom,f(this,O).maxZoom=e.lockZoom)}setStyle(e,t){f(this,k)||this.map.setStyle(e,t),P(this,_,F).call(this)}addLayer(e,t){return f(this,k)||this.map.addLayer(e,t),P(this,_,F).call(this),this.map}moveLayer(e,t){return f(this,k)||this.map.moveLayer(e,t),P(this,_,F).call(this),this.map}removeLayer(e){return f(this,k)||this.map.removeLayer(e),P(this,_,F).call(this),this}setLayerZoomRange(e,t,r){return f(this,k)||this.map.setLayerZoomRange(e,t,r),P(this,_,F).call(this),this}setFilter(e,t,r){return f(this,k)||this.map.setFilter(e,t,r),P(this,_,F).call(this),this}setPaintProperty(e,t,r,a){return f(this,k)||this.map.setPaintProperty(e,t,r,a),P(this,_,F).call(this),this}setLayoutProperty(e,t,r,a){return f(this,k)||this.map.setLayoutProperty(e,t,r,a),P(this,_,F).call(this),this}setGlyphs(e,t){return f(this,k)||this.map.setGlyphs(e,t),P(this,_,F).call(this),this}onAdd(e){W(this,B,e),W(this,D,U("div","maplibregl-ctrl maplibregl-ctrl-group"));for(const[t,r]of Object.entries(f(this,O).containerStyle))f(this,D).style.setProperty(t,r);return f(this,O).container=f(this,D),f(this,O).zoom=e.getZoom()+f(this,O).zoomAdjust,this.map=new Ke(f(this,O)),this.map.once("style.load",()=>{this.map.resize()}),this.map.once("load",()=>{P(this,_,je).call(this,f(this,O).parentRect),W(this,J,P(this,_,Ve).call(this))}),f(this,D)}onRemove(){var e;(e=f(this,J))==null||e.call(this),Ee(f(this,D))}}O=new WeakMap,B=new WeakMap,D=new WeakMap,$e=new WeakMap,$=new WeakMap,k=new WeakMap,J=new WeakMap,_=new WeakSet,je=function(o){o===void 0||o.linePaint===void 0&&o.fillPaint===void 0||(W(this,$,{type:"Feature",properties:{name:"parentRect"},geometry:{type:"Polygon",coordinates:[[[],[],[],[],[]]]}}),this.map.addSource("parentRect",{type:"geojson",data:f(this,$)}),(o.lineLayout!==void 0||o.linePaint!==void 0)&&this.map.addLayer({id:"parentRectOutline",type:"line",source:"parentRect",layout:{...o.lineLayout},paint:{"line-color":"#FFF","line-width":1,"line-opacity":.85,...o.linePaint}}),o.fillPaint!==void 0&&this.map.addLayer({id:"parentRectFill",type:"fill",source:"parentRect",layout:{},paint:{"fill-color":"#08F","fill-opacity":.135,...o.fillPaint}}),P(this,_,F).call(this))},F=function(){if(f(this,$)===void 0)return;const{devicePixelRatio:o}=window,e=f(this,B).getCanvas(),t=e.width/o,r=e.height/o,a=f(this,B).unproject.bind(f(this,B)),n=a([0,0]),i=a([t,0]),l=a([0,r]),u=a([t,r]);f(this,$).geometry.coordinates=[[l.toArray(),u.toArray(),i.toArray(),n.toArray(),l.toArray()]],this.map.getSource("parentRect").setData(f(this,$))},Ve=function(){const{pitchAdjust:o}=f(this,O),e=()=>{n("parent")},t=()=>{n("minimap")},r=()=>{f(this,B).on("move",e),this.map.on("move",t)},a=()=>{f(this,B).off("move",e),this.map.off("move",t)},n=i=>{a();const l=i==="parent"?f(this,B):this.map,u=i==="parent"?this.map:f(this,B),s=l.getCenter(),c=l.getZoom()+(f(this,O).zoomAdjust??-4)*(i==="parent"?1:-1),p=l.getBearing(),d=l.getPitch();u.jumpTo({center:s,zoom:c,bearing:p,pitch:o?d:0}),P(this,_,F).call(this),r()};return r(),()=>{a()}};const We={POINT:"POINT",COUNTRY:"COUNTRY"};class Ke extends C.Map{constructor(e){Jt(e.container),e.apiKey&&(R.apiKey=e.apiKey);const t=Fe(e.style),r=location.hash;R.apiKey||console.warn("MapTiler Cloud API key is not set. Visit https://maptiler.com and try Cloud for free!");let a={compact:!1};e.customAttribution?a.customAttribution=e.customAttribution:e.attributionControl&&typeof e.attributionControl=="object"&&(a={...a,...e.attributionControl}),super({...e,style:t,maplibreLogo:!1,transformRequest:xe(e.transformRequest),attributionControl:e.forceNoAttributionControl===!0?!1:a}),this.isTerrainEnabled=!1,this.terrainExaggeration=1,this.terrainGrowing=!1,this.terrainFlattening=!1,this.isReady=!1,R.caching&&!se&&console.warn("The cache API is only available in secure contexts. More info at https://developer.mozilla.org/en-US/docs/Web/API/Cache"),R.caching&&se&&Wt(),this.primaryLanguage=e.language??R.primaryLanguage,this.forceLanguageUpdate=!(this.primaryLanguage===A.STYLE||this.primaryLanguage===A.STYLE_LOCK),this.languageAlwaysBeenStyle=this.primaryLanguage===A.STYLE,this.terrainExaggeration=e.terrainExaggeration??this.terrainExaggeration,this.once("styledata",async()=>{if(!e.geolocate||e.center||e.hash&&r)return;try{if(e.geolocate===We.COUNTRY){await this.fitToIpBounds();return}}catch(c){console.warn(c.message)}let s;try{await this.centerOnIpPoint(e.zoom),s=this.getCameraHash()}catch(c){console.warn(c.message)}(await navigator.permissions.query({name:"geolocation"})).state==="granted"&&navigator.geolocation.getCurrentPosition(c=>{s===this.getCameraHash()&&(this.terrain?this.easeTo({center:[c.coords.longitude,c.coords.latitude],zoom:e.zoom||12,duration:2e3}):this.once("terrain",()=>{this.easeTo({center:[c.coords.longitude,c.coords.latitude],zoom:e.zoom||12,duration:2e3})}))},null,{maximumAge:24*3600*1e3,timeout:5e3,enableHighAccuracy:!1})}),this.on("styledata",()=>{this.setPrimaryLanguage(this.primaryLanguage)}),this.on("styledata",()=>{this.getTerrain()===null&&this.isTerrainEnabled&&this.enableTerrain(this.terrainExaggeration)}),this.once("load",async()=>{let s={logo:null};try{const c=Object.keys(this.style.sourceCaches).map(d=>this.getSource(d)).filter(d=>d&&"url"in d&&typeof d.url=="string"&&d?.url.includes("tiles.json")),p=new URL(c[0].url);p.searchParams.has("key")||p.searchParams.append("key",R.apiKey),s=await(await fetch(p.href)).json()}catch{}if(e.forceNoAttributionControl!==!0)if("logo"in s&&s.logo){const c=s.logo;this.addControl(new ue({logoURL:c}),e.logoPosition)}else e.maptilerLogo&&this.addControl(new ue,e.logoPosition);if(e.scaleControl){const c=e.scaleControl===!0||e.scaleControl===void 0?"bottom-right":e.scaleControl,p=new Oe({unit:R.unit});this.addControl(p,c),R.on("unit",d=>{p.setUnit(d)})}if(e.navigationControl!==!1){const c=e.navigationControl===!0||e.navigationControl===void 0?"top-right":e.navigationControl;this.addControl(new Be,c)}if(e.geolocateControl!==!1){const c=e.geolocateControl===!0||e.geolocateControl===void 0?"top-right":e.geolocateControl;this.addControl(new He({positionOptions:{enableHighAccuracy:!0,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!0,showAccuracyCircle:!0,showUserLocation:!0}),c)}if(e.terrainControl){const c=e.terrainControl===!0||e.terrainControl===void 0?"top-right":e.terrainControl;this.addControl(new ze,c)}if(e.fullscreenControl){const c=e.fullscreenControl===!0||e.fullscreenControl===void 0?"top-right":e.fullscreenControl;this.addControl(new ke({}),c)}this.isReady=!0,this.fire("ready",{target:this})});let n=!1,i=!1,l;this.once("ready",()=>{n=!0,i&&this.fire("loadWithTerrain",l)}),this.once("style.load",()=>{const{minimap:s}=e;if(typeof s=="object"){const{zoom:c,center:p,style:d,language:y,apiKey:v,maptilerLogo:g,antialias:w,refreshExpiredTiles:N,maxBounds:L,scrollZoom:I,minZoom:E,maxZoom:T,boxZoom:z,locale:H,fadeDuration:K,crossSourceCollisions:Z,clickTolerance:Y,bounds:ut,fitBoundsOptions:pt,pixelRatio:ht,validateStyle:mt}=e;this.minimap=new he(s,{zoom:c,center:p,style:d,language:y,apiKey:v,container:"null",maptilerLogo:g,antialias:w,refreshExpiredTiles:N,maxBounds:L,scrollZoom:I,minZoom:E,maxZoom:T,boxZoom:z,locale:H,fadeDuration:K,crossSourceCollisions:Z,clickTolerance:Y,bounds:ut,fitBoundsOptions:pt,pixelRatio:ht,validateStyle:mt}),this.addControl(this.minimap,s.position??"bottom-left")}else s===!0?(this.minimap=new he({},e),this.addControl(this.minimap,"bottom-left")):s!==void 0&&s!==!1&&(this.minimap=new he({},e),this.addControl(this.minimap,s))});const u=s=>{s.terrain&&(i=!0,l={type:"loadWithTerrain",target:this,terrain:s.terrain},this.off("terrain",u),n&&this.fire("loadWithTerrain",l))};this.on("terrain",u),e.terrain&&this.enableTerrain(e.terrainExaggeration??this.terrainExaggeration)}async onLoadAsync(){return new Promise(e=>{if(this.loaded())return e(this);this.once("load",()=>{e(this)})})}async onReadyAsync(){return new Promise(e=>{if(this.isReady)return e(this);this.once("ready",()=>{e(this)})})}async onLoadWithTerrainAsync(){return new Promise(e=>{if(this.isReady&&this.terrain)return e(this);this.once("loadWithTerrain",()=>{e(this)})})}setStyle(e,t){return this.minimap?.setStyle(e),this.forceLanguageUpdate=!0,this.once("idle",()=>{this.forceLanguageUpdate=!1}),super.setStyle(Fe(e),t)}addLayer(e,t){return this.minimap?.addLayer(e,t),super.addLayer(e,t)}moveLayer(e,t){return this.minimap?.moveLayer(e,t),super.moveLayer(e,t)}removeLayer(e){return this.minimap?.removeLayer(e),super.removeLayer(e)}setLayerZoomRange(e,t,r){return this.minimap?.setLayerZoomRange(e,t,r),super.setLayerZoomRange(e,t,r)}setFilter(e,t,r){return this.minimap?.setFilter(e,t,r),super.setFilter(e,t,r)}setPaintProperty(e,t,r,a){return this.minimap?.setPaintProperty(e,t,r,a),super.setPaintProperty(e,t,r,a)}setLayoutProperty(e,t,r,a){return this.minimap?.setLayoutProperty(e,t,r,a),super.setLayoutProperty(e,t,r,a)}setGlyphs(e,t){return this.minimap?.setGlyphs(e,t),super.setGlyphs(e,t)}getStyleLanguage(){return!this.style.stylesheet.metadata||typeof this.style.stylesheet.metadata!="object"?null:"maptiler:language"in this.style.stylesheet.metadata&&typeof this.style.stylesheet.metadata["maptiler:language"]=="string"?this.style.stylesheet.metadata["maptiler:language"]:null}setLanguage(e){this.minimap?.map?.setLanguage(e),this.onStyleReady(()=>{this.setPrimaryLanguage(e)})}setPrimaryLanguage(e){const t=this.getStyleLanguage();if(!(e===A.STYLE&&(t===A.AUTO||t===A.VISITOR))&&(e!==A.STYLE&&(this.languageAlwaysBeenStyle=!1),this.languageAlwaysBeenStyle||this.primaryLanguage===e&&!this.forceLanguageUpdate))return;if(!ae(e)){console.warn(`The language "${e}" is not supported.`);return}if(this.primaryLanguage===A.STYLE_LOCK){console.warn("The language cannot be changed because this map has been instantiated with the STYLE_LOCK language flag.");return}this.primaryLanguage=e;let r=e;if(e===A.STYLE){if(!t){console.warn("The style has no default languages.");return}if(!ae(t)){console.warn("The language defined in the style is not valid.");return}r=t}let a=A.LOCAL,n=`{${a}}`;r===A.VISITOR?(a=ne(),n=["case",["all",["has",a],["has",A.LOCAL]],["case",["==",["get",a],["get",A.LOCAL]],["get",A.LOCAL],["format",["get",a],{"font-scale":.8},`
2
+ `,["get",A.LOCAL],{"font-scale":1.1}]],["get",A.LOCAL]]):r===A.VISITOR_ENGLISH?(a=A.ENGLISH,n=["case",["all",["has",a],["has",A.LOCAL]],["case",["==",["get",a],["get",A.LOCAL]],["get",A.LOCAL],["format",["get",a],{"font-scale":.8},`
3
+ `,["get",A.LOCAL],{"font-scale":1.1}]],["get",A.LOCAL]]):r===A.AUTO?(a=ne(),n=["case",["has",a],["get",a],["get",A.LOCAL]]):r===A.LOCAL?(a=A.LOCAL,n=`{${a}}`):(a=r,n=["case",["has",a],["get",a],["get",A.LOCAL]]);const{layers:i}=this.getStyle();for(const l of i){if(l.type!=="symbol")continue;const u=l,s=this.getSource(u.source);if(!s||!("url"in s&&typeof s.url=="string")||new URL(s.url).host!==M.maptilerApiHost)continue;const{id:c,layout:p}=u;if(!p||!("text-field"in p))continue;const d=this.getLayoutProperty(c,"text-field");typeof d=="string"&&(d.toLowerCase().includes("ref")||d.toLowerCase().includes("housenumber"))||this.setLayoutProperty(c,"text-field",n)}}getPrimaryLanguage(){return this.primaryLanguage}getTerrainExaggeration(){return this.terrainExaggeration}hasTerrain(){return this.isTerrainEnabled}growTerrain(e,t=1e3){if(!this.terrain)return;const r=performance.now(),a=this.terrain.exaggeration,n=e-a,i=()=>{if(!this.terrain||this.terrainFlattening)return;const l=(performance.now()-r)/t;if(l<.99){const u=1-(1-l)**4,s=a+u*n;this.terrain.exaggeration=s,requestAnimationFrame(i)}else this.terrainGrowing=!1,this.terrainFlattening=!1,this.terrain.exaggeration=e;this.triggerRepaint()};this.terrainGrowing=!0,this.terrainFlattening=!1,requestAnimationFrame(i)}enableTerrain(e=this.terrainExaggeration){if(e<0){console.warn("Terrain exaggeration cannot be negative.");return}const t=async a=>{!this.terrain||a.type!=="data"||a.dataType!=="source"||!("source"in a)||a.sourceId!=="maptiler-terrain"||a.source.type!=="raster-dem"||a.isSourceLoaded&&(this.off("data",t),this.growTerrain(e))},r=()=>{this.isTerrainEnabled=!0,this.terrainExaggeration=e,this.on("data",t),this.addSource(M.terrainSourceId,{type:"raster-dem",url:M.terrainSourceURL}),this.setTerrain({source:M.terrainSourceId,exaggeration:0})};if(this.getTerrain()){this.isTerrainEnabled=!0,this.growTerrain(e);return}this.loaded()||this.isTerrainEnabled?r():this.once("load",()=>{this.getTerrain()&&this.getSource(M.terrainSourceId)||r()})}disableTerrain(){if(!this.terrain)return;this.isTerrainEnabled=!1;const e=1*1e3,t=performance.now(),r=this.terrain.exaggeration,a=()=>{if(!this.terrain||this.terrainGrowing)return;const n=(performance.now()-t)/e;if(n<.99){const i=(1-n)**4,l=r*i;this.terrain.exaggeration=l,requestAnimationFrame(a)}else this.terrain.exaggeration=0,this.terrainGrowing=!1,this.terrainFlattening=!1,this.setTerrain(),this.getSource(M.terrainSourceId)&&this.removeSource(M.terrainSourceId);this.triggerRepaint()};this.terrainGrowing=!1,this.terrainFlattening=!0,requestAnimationFrame(a)}setTerrainExaggeration(e,t=!0){!t&&this.terrain?(this.terrainExaggeration=e,this.terrain.exaggeration=e,this.triggerRepaint()):this.enableTerrain(e)}onStyleReady(e){this.isStyleLoaded()?e():this.once("styledata",()=>{e()})}async fitToIpBounds(){const e=await Ce.info();this.fitBounds(e.country_bounds,{duration:0,padding:100})}async centerOnIpPoint(e){const t=await Ce.info();this.jumpTo({center:[t?.longitude??0,t?.latitude??0],zoom:e||11})}getCameraHash(){const e=new Float32Array(5),t=this.getCenter();return e[0]=t.lng,e[1]=t.lat,e[2]=this.getZoom(),e[3]=this.getPitch(),e[4]=this.getBearing(),wt.fromUint8Array(new Uint8Array(e.buffer))}getSdkConfig(){return R}getMaptilerSessionId(){return Se}setTransformRequest(e){return super.setTransformRequest(xe(e)),this}}function X(o){if(typeof DOMParser<"u"){const e=new DOMParser().parseFromString(o,"application/xml");if(e.querySelector("parsererror"))throw new Error("The provided string is not valid XML");return e}throw new Error("No XML parser found")}function me(o,e){if(!o.hasChildNodes())return!1;for(const t of Array.from(o.childNodes)){const r=t.nodeName;if(typeof r=="string"&&r.trim().toLowerCase()===e.toLowerCase())return!0}return!1}function de(o){if(typeof XMLSerializer<"u")return new XMLSerializer().serializeToString(o);throw new Error("No XML serializer found")}function ge(o){const e=typeof o=="string"?X(o):o;if(!me(e,"gpx"))throw new Error("The XML document is not valid GPX");const t=x(e,"trk"),r=x(e,"rte"),a=x(e,"wpt"),n={type:"FeatureCollection",features:[]};for(const i of Array.from(t)){const l=So(i);l&&n.features.push(l)}for(const i of Array.from(r)){const l=bo(i);l&&n.features.push(l)}for(const i of Array.from(a))n.features.push(To(i));return n}function ye(o,e){let t=o;if(typeof t=="string"&&(t=X(t)),!me(t,"kml"))throw new Error("The XML document is not valid KML");const r={type:"FeatureCollection",features:[]},a={},n={},i={},l=x(t,"Placemark"),u=x(t,"Style"),s=x(t,"StyleMap");for(const c of Array.from(u)){const p=Je(e!==void 0?e(c):de(c)).toString(16);a[`#${j(c,"id")}`]=p,n[p]=c}for(const c of Array.from(s)){a[`#${j(c,"id")}`]=Je(e!==void 0?e(c):de(c)).toString(16);const p=x(c,"Pair"),d={};for(const y of Array.from(p))d[S(m(y,"key"))??""]=S(m(y,"styleUrl"));i[`#${j(c,"id")}`]=d}for(const c of Array.from(l))r.features=r.features.concat(Co(c,a,n,i));return r}function Ze(o){if(o===null)return["#000000",1];let e="",t=1,r=o;return r.substring(0,1)==="#"&&(r=r.substring(1)),(r.length===6||r.length===3)&&(e=r),r.length===8&&(t=Number.parseInt(r.substring(0,2),16)/255,e=`#${r.substring(6,8)}${r.substring(4,6)}${r.substring(2,4)}`),[e??"#000000",t??1]}function Ao(o){return Qe(o.split(" "))}function wo(o){let e=x(o,"coord");const t=[],r=[];e.length===0&&(e=x(o,"gx:coord"));for(const n of Array.from(e))t.push(Ao(S(n)??""));const a=x(o,"when");for(const n of Array.from(a))r.push(S(n));return{coords:t,times:r}}function Q(o){const e=["Polygon","LineString","Point","Track","gx:Track"];let t,r,a,n,i;const l=[],u=[];if(m(o,"MultiGeometry")!==null)return Q(m(o,"MultiGeometry"));if(m(o,"MultiTrack")!==null)return Q(m(o,"MultiTrack"));if(m(o,"gx:MultiTrack")!==null)return Q(m(o,"gx:MultiTrack"));for(a=0;a<e.length;a++)if(r=x(o,e[a]),r){for(n=0;n<r.length;n++)if(t=r[n],e[a]==="Point")l.push({type:"Point",coordinates:et(S(m(t,"coordinates"))??"")});else if(e[a]==="LineString")l.push({type:"LineString",coordinates:tt(S(m(t,"coordinates"))??"")});else if(e[a]==="Polygon"){const s=x(t,"LinearRing"),c=[];for(i=0;i<s.length;i++)c.push(tt(S(m(s[i],"coordinates"))??""));l.push({type:"Polygon",coordinates:c})}else if(e[a]==="Track"||e[a]==="gx:Track"){const s=wo(t);l.push({type:"LineString",coordinates:s.coords}),s.times.length&&u.push(s.times)}}return{geoms:l,coordTimes:u}}function Co(o,e,t,r){const a=Q(o),n={},i=S(m(o,"name")),l=S(m(o,"address")),u=S(m(o,"description")),s=m(o,"TimeSpan"),c=m(o,"TimeStamp"),p=m(o,"ExtendedData"),d=m(o,"visibility");let y,v=S(m(o,"styleUrl")),g=m(o,"LineStyle"),w=m(o,"PolyStyle");if(!a.geoms.length)return[];if(i&&(n.name=i),l&&(n.address=l),v){v[0]!=="#"&&(v=`#${v}`),n.styleUrl=v,e[v]&&(n.styleHash=e[v]),r[v]&&(n.styleMapHash=r[v],n.styleHash=e[r[v].normal??""]);const L=t[n.styleHash??""];if(L){g||(g=m(L,"LineStyle")),w||(w=m(L,"PolyStyle"));const I=m(L,"IconStyle");if(I){const E=m(I,"Icon");if(E){const T=S(m(E,"href"));T&&(n.icon=T)}}}}if(u&&(n.description=u),s){const L=S(m(s,"begin")),I=S(m(s,"end"));L&&I&&(n.timespan={begin:L,end:I})}if(c!==null&&(n.timestamp=S(m(c,"when"))??new Date().toISOString()),g!==null){const L=Ze(S(m(g,"color"))),I=L[0],E=L[1],T=Number.parseFloat(S(m(g,"width"))??"");I&&(n.stroke=I),Number.isNaN(E)||(n["stroke-opacity"]=E),Number.isNaN(T)||(n["stroke-width"]=T)}if(w){const L=Ze(S(m(w,"color"))),I=L[0],E=L[1],T=S(m(w,"fill")),z=S(m(w,"outline"));I&&(n.fill=I),Number.isNaN(E)||(n["fill-opacity"]=E),T&&(n["fill-opacity"]=T==="1"?n["fill-opacity"]||1:0),z&&(n["stroke-opacity"]=z==="1"?n["stroke-opacity"]||1:0)}if(p){const L=x(p,"Data"),I=x(p,"SimpleData");for(y=0;y<L.length;y++)n[L[y].getAttribute("name")??""]=S(m(L[y],"value"))??"";for(y=0;y<I.length;y++)n[I[y].getAttribute("name")??""]=S(I[y])??""}d!==null&&(n.visibility=S(d)??""),a.coordTimes.length!==0&&(n.coordTimes=a.coordTimes.length===1?a.coordTimes[0]:a.coordTimes);const N={type:"Feature",geometry:a.geoms.length===1?a.geoms[0]:{type:"GeometryCollection",geometries:a.geoms},properties:n};return j(o,"id")&&(N.id=j(o,"id")??void 0),[N]}function Ye(o,e){const t=x(o,e),r=[],a=[];let n=[];const i=t.length;if(!(i<2)){for(let l=0;l<i;l++){const u=ot(t[l]);r.push(u.coordinates),u.time&&a.push(u.time),(u.heartRate||n.length)&&(n.length===0&&(n=new Array(l).fill(null)),n.push(u.heartRate))}return{line:r,times:a,heartRates:n}}}function So(o){const e=x(o,"trkseg"),t=[],r=[],a=[];let n;for(let l=0;l<e.length;l++)if(n=Ye(e[l],"trkpt"),n!==void 0&&(n.line&&t.push(n.line),n.times&&n.times.length&&r.push(n.times),a.length||n.heartRates&&n.heartRates.length)){if(!a.length)for(let u=0;u<l;u++)a.push(new Array(t[u].length).fill(null));n.heartRates&&n.heartRates.length?a.push(n.heartRates):a.push(new Array(n.line.length).fill(null))}if(t.length===0)return;const i={...ve(o),...qe(m(o,"extensions"))};return r.length!==0&&(i.coordTimes=t.length===1?r[0]:r),a.length!==0&&(i.heartRates=t.length===1?a[0]:a),t.length===1?{type:"Feature",properties:i,geometry:{type:"LineString",coordinates:t[0]}}:{type:"Feature",properties:i,geometry:{type:"MultiLineString",coordinates:t}}}function bo(o){const e=Ye(o,"rtept");return e===void 0?void 0:{type:"Feature",properties:{...ve(o),...qe(m(o,"extensions"))},geometry:{type:"LineString",coordinates:e.line}}}function To(o){return{type:"Feature",properties:{...ve(o),...fe(o,["sym"])},geometry:{type:"Point",coordinates:ot(o).coordinates}}}function qe(o){const e={};if(o){const t=m(o,"line");if(t){const r=S(m(t,"color")),a=Number.parseFloat(S(m(t,"opacity"))??"0"),n=Number.parseFloat(S(m(t,"width"))??"0");r&&(e.stroke=r),Number.isNaN(a)||(e["stroke-opacity"]=a),Number.isNaN(n)||(e["stroke-width"]=n*96/25.4)}}return e}function ve(o){const e=fe(o,["name","cmt","desc","type","time","keywords"]),t=x(o,"link");if(t.length!==0){e.links=[];for(const r of Array.from(t)){const a={href:j(r,"href"),...fe(r,["text","type"])};e.links.push(a)}}return e}function Je(o){let e=0;if(!o||!o.length)return e;for(let t=0;t<o.length;t++)e=(e<<5)-e+o.charCodeAt(t)|0;return e}function x(o,e){return o.getElementsByTagName(e)}function j(o,e){return o.getAttribute(e)}function Xe(o,e){return Number.parseFloat(j(o,e)??"0")}function m(o,e){const t=x(o,e);return t.length?t[0]:null}function Io(o){return o.normalize&&o.normalize(),o}function Qe(o){return o.map(Number.parseFloat).map(e=>Number.isNaN(e)?null:e)}function S(o){return o&&Io(o),o&&o.textContent}function fe(o,e){const t={};let r,a;for(a=0;a<e.length;a++)r=m(o,e[a]),r&&(t[e[a]]=S(r)??"");return t}function et(o){return Qe(o.replace(/\s*/g,"").split(","))}function tt(o){const e=o.replace(/^\s*|\s*$/g,"").split(/\s+/),t=[];for(const r of e)t.push(et(r));return t}function ot(o){const e=[Xe(o,"lon"),Xe(o,"lat")],t=m(o,"ele"),r=m(o,"gpxtpx:hr")||m(o,"hr"),a=m(o,"time");let n;return t&&(n=Number.parseFloat(S(t)??"0"),Number.isNaN(n)||e.push(n)),{coordinates:e,time:a?S(a):null,heartRate:r!==null?Number.parseFloat(S(r)??"0"):null}}function rt(o){let e=o;try{typeof e=="string"&&(e=X(e))}catch{return null}try{return ge(e)}catch{}try{return ye(e)}catch{}return null}function ee(o){const e=o.toString(16);return e.length===1?`0${e}`:e}function Eo(o){return`#${ee(o[0])}${ee(o[1])}${ee(o[2])}${o.length===4?ee(o[3]):""}`}class h extends Array{constructor(e={}){super(),this.min=0,this.max=1,"min"in e&&(this.min=e.min),"max"in e&&(this.max=e.max),"stops"in e&&this.setStops(e.stops,{clone:!1})}static fromArrayDefinition(e){return new h({stops:e.map(t=>({value:t[0],color:t[1]}))})}setStops(e,t={clone:!0}){const r=t.clone?this.clone():this;r.length=0;let a=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY;for(let i=0;i<e.length;i+=1)a=Math.min(a,e[i].value),n=Math.max(n,e[i].value),r.push({value:e[i].value,color:e[i].color.slice()});return r.sort((i,l)=>i.value<l.value?-1:1),this.min=a,this.max=n,r}scale(e,t,r={clone:!0}){const a=r.clone,n=this[0].value,i=this.at(-1).value-n,l=t-e,u=[];for(let s=0;s<this.length;s+=1){const c=(this[s].value-n)/i*l+e;a?u.push({value:c,color:this[s].color.slice()}):this[s].value=c}return a?new h({stops:u}):this}at(e){return e<0?this[this.length+e]:this[e]}clone(){return new h({stops:this.getRawColorStops()})}getRawColorStops(){const e=[];for(let t=0;t<this.length;t+=1)e.push({value:this[t].value,color:this[t].color});return e}reverse(e={clone:!0}){const t=e.clone?this.clone():this;for(let r=0;r<~~(t.length/2);r+=1){const a=t[r].color;t[r].color=t.at(-(r+1)).color,t.at(-(r+1)).color=a}return t}getBounds(){return{min:this.min,max:this.max}}getColor(e,t={smooth:!0}){if(e<=this[0].value)return this[0].color;if(e>=this.at(-1).value)return this.at(-1).color;for(let r=0;r<this.length-1;r+=1){if(e>this[r+1].value)continue;const a=this[r].color;if(!t.smooth)return a.slice();const n=this[r].value,i=this[r+1].value,l=this[r+1].color,u=(i-e)/(i-n);return a.map((s,c)=>Math.round(s*u+l[c]*(1-u)))}return[0,0,0]}getColorHex(e,t={smooth:!0,withAlpha:!1}){return Eo(this.getColor(e,t))}getColorRelative(e,t={smooth:!0}){const r=this.getBounds();return this.getColor(r.min+e*(r.max-r.min),t)}getCanvasStrip(e={horizontal:!0,size:512,smooth:!0}){const t=document.createElement("canvas");t.width=e.horizontal?e.size:1,t.height=e.horizontal?1:e.size;const r=t.getContext("2d");if(!r)throw new Error("Canvs context is missing");const a=r.getImageData(0,0,t.width,t.height),n=a.data,i=e.size,l=this[0].value,u=(this.at(-1).value-l)/i;for(let s=0;s<i;s+=1){const c=this.getColor(l+s*u,{smooth:e.smooth});n[s*4]=c[0],n[s*4+1]=c[1],n[s*4+2]=c[2],n[s*4+3]=c.length>3?c[3]:255}return r.putImageData(a,0,0),t}resample(e,t=15){const r=this.getBounds(),a=this.scale(0,1),n=1/(t-1);let i;if(e==="ease-in-square")i=Array.from({length:t},(l,u)=>{const s=u*n,c=s**2,p=a.getColor(c);return{value:s,color:p}});else if(e==="ease-out-square")i=Array.from({length:t},(l,u)=>{const s=u*n,c=1-(1-s)**2,p=a.getColor(c);return{value:s,color:p}});else if(e==="ease-out-sqrt")i=Array.from({length:t},(l,u)=>{const s=u*n,c=s**.5,p=a.getColor(c);return{value:s,color:p}});else if(e==="ease-in-sqrt")i=Array.from({length:t},(l,u)=>{const s=u*n,c=1-(1-s)**.5,p=a.getColor(c);return{value:s,color:p}});else if(e==="ease-out-exp")i=Array.from({length:t},(l,u)=>{const s=u*n,c=1-2**(-10*s),p=a.getColor(c);return{value:s,color:p}});else if(e==="ease-in-exp")i=Array.from({length:t},(l,u)=>{const s=u*n,c=2**(10*s-10),p=a.getColor(c);return{value:s,color:p}});else throw new Error("Invalid ressampling method.");return new h({stops:i}).scale(r.min,r.max)}transparentStart(){const e=this.getRawColorStops();e.unshift({value:e[0].value,color:e[0].color.slice()}),e[1].value+=.001;for(const t of e)t.color.length===3&&t.color.push(255);return e[0].color[3]=0,new h({stops:e})}hasTransparentStart(){return this[0].color.length===4&&this[0].color[3]===0}}const Le={NULL:new h({stops:[{value:0,color:[0,0,0,0]},{value:1,color:[0,0,0,0]}]}),GRAY:new h({stops:[{value:0,color:[0,0,0]},{value:1,color:[255,255,255]}]}),JET:new h({stops:[{value:0,color:[0,0,131]},{value:.125,color:[0,60,170]},{value:.375,color:[5,255,255]},{value:.625,color:[255,255,0]},{value:.875,color:[250,0,0]},{value:1,color:[128,0,0]}]}),HSV:new h({stops:[{value:0,color:[255,0,0]},{value:.169,color:[253,255,2]},{value:.173,color:[247,255,2]},{value:.337,color:[0,252,4]},{value:.341,color:[0,252,10]},{value:.506,color:[1,249,255]},{value:.671,color:[2,0,253]},{value:.675,color:[8,0,253]},{value:.839,color:[255,0,251]},{value:.843,color:[255,0,245]},{value:1,color:[255,0,6]}]}),HOT:new h({stops:[{value:0,color:[0,0,0]},{value:.3,color:[230,0,0]},{value:.6,color:[255,210,0]},{value:1,color:[255,255,255]}]}),SPRING:new h({stops:[{value:0,color:[255,0,255]},{value:1,color:[255,255,0]}]}),SUMMER:new h({stops:[{value:0,color:[0,128,102]},{value:1,color:[255,255,102]}]}),AUTOMN:new h({stops:[{value:0,color:[255,0,0]},{value:1,color:[255,255,0]}]}),WINTER:new h({stops:[{value:0,color:[0,0,255]},{value:1,color:[0,255,128]}]}),BONE:new h({stops:[{value:0,color:[0,0,0]},{value:.376,color:[84,84,116]},{value:.753,color:[169,200,200]},{value:1,color:[255,255,255]}]}),COPPER:new h({stops:[{value:0,color:[0,0,0]},{value:.804,color:[255,160,102]},{value:1,color:[255,199,127]}]}),GREYS:new h({stops:[{value:0,color:[0,0,0]},{value:1,color:[255,255,255]}]}),YIGNBU:new h({stops:[{value:0,color:[8,29,88]},{value:.125,color:[37,52,148]},{value:.25,color:[34,94,168]},{value:.375,color:[29,145,192]},{value:.5,color:[65,182,196]},{value:.625,color:[127,205,187]},{value:.75,color:[199,233,180]},{value:.875,color:[237,248,217]},{value:1,color:[255,255,217]}]}),GREENS:new h({stops:[{value:0,color:[0,68,27]},{value:.125,color:[0,109,44]},{value:.25,color:[35,139,69]},{value:.375,color:[65,171,93]},{value:.5,color:[116,196,118]},{value:.625,color:[161,217,155]},{value:.75,color:[199,233,192]},{value:.875,color:[229,245,224]},{value:1,color:[247,252,245]}]}),YIORRD:new h({stops:[{value:0,color:[128,0,38]},{value:.125,color:[189,0,38]},{value:.25,color:[227,26,28]},{value:.375,color:[252,78,42]},{value:.5,color:[253,141,60]},{value:.625,color:[254,178,76]},{value:.75,color:[254,217,118]},{value:.875,color:[255,237,160]},{value:1,color:[255,255,204]}]}),BLUERED:new h({stops:[{value:0,color:[0,0,255]},{value:1,color:[255,0,0]}]}),RDBU:new h({stops:[{value:0,color:[5,10,172]},{value:.35,color:[106,137,247]},{value:.5,color:[190,190,190]},{value:.6,color:[220,170,132]},{value:.7,color:[230,145,90]},{value:1,color:[178,10,28]}]}),PICNIC:new h({stops:[{value:0,color:[0,0,255]},{value:.1,color:[51,153,255]},{value:.2,color:[102,204,255]},{value:.3,color:[153,204,255]},{value:.4,color:[204,204,255]},{value:.5,color:[255,255,255]},{value:.6,color:[255,204,255]},{value:.7,color:[255,153,255]},{value:.8,color:[255,102,204]},{value:.9,color:[255,102,102]},{value:1,color:[255,0,0]}]}),RAINBOW:new h({stops:[{value:0,color:[150,0,90]},{value:.125,color:[0,0,200]},{value:.25,color:[0,25,255]},{value:.375,color:[0,152,255]},{value:.5,color:[44,255,150]},{value:.625,color:[151,255,0]},{value:.75,color:[255,234,0]},{value:.875,color:[255,111,0]},{value:1,color:[255,0,0]}]}),PORTLAND:new h({stops:[{value:0,color:[12,51,131]},{value:.25,color:[10,136,186]},{value:.5,color:[242,211,56]},{value:.75,color:[242,143,56]},{value:1,color:[217,30,30]}]}),BLACKBODY:new h({stops:[{value:0,color:[0,0,0]},{value:.2,color:[230,0,0]},{value:.4,color:[230,210,0]},{value:.7,color:[255,255,255]},{value:1,color:[160,200,255]}]}),EARTH:new h({stops:[{value:0,color:[0,0,130]},{value:.1,color:[0,180,180]},{value:.2,color:[40,210,40]},{value:.4,color:[230,230,50]},{value:.6,color:[120,70,20]},{value:1,color:[255,255,255]}]}),ELECTRIC:new h({stops:[{value:0,color:[0,0,0]},{value:.15,color:[30,0,100]},{value:.4,color:[120,0,100]},{value:.6,color:[160,90,0]},{value:.8,color:[230,200,0]},{value:1,color:[255,250,220]}]}),VIRIDIS:new h({stops:[{value:0,color:[68,1,84]},{value:.13,color:[71,44,122]},{value:.25,color:[59,81,139]},{value:.38,color:[44,113,142]},{value:.5,color:[33,144,141]},{value:.63,color:[39,173,129]},{value:.75,color:[92,200,99]},{value:.88,color:[170,220,50]},{value:1,color:[253,231,37]}]}),INFERNO:new h({stops:[{value:0,color:[0,0,4]},{value:.13,color:[31,12,72]},{value:.25,color:[85,15,109]},{value:.38,color:[136,34,106]},{value:.5,color:[186,54,85]},{value:.63,color:[227,89,51]},{value:.75,color:[249,140,10]},{value:.88,color:[249,201,50]},{value:1,color:[252,255,164]}]}),MAGMA:new h({stops:[{value:0,color:[0,0,4]},{value:.13,color:[28,16,68]},{value:.25,color:[79,18,123]},{value:.38,color:[129,37,129]},{value:.5,color:[181,54,122]},{value:.63,color:[229,80,100]},{value:.75,color:[251,135,97]},{value:.88,color:[254,194,135]},{value:1,color:[252,253,191]}]}),PLASMA:new h({stops:[{value:0,color:[13,8,135]},{value:.13,color:[75,3,161]},{value:.25,color:[125,3,168]},{value:.38,color:[168,34,150]},{value:.5,color:[203,70,121]},{value:.63,color:[229,107,93]},{value:.75,color:[248,148,65]},{value:.88,color:[253,195,40]},{value:1,color:[240,249,33]}]}),WARM:new h({stops:[{value:0,color:[125,0,179]},{value:.13,color:[172,0,187]},{value:.25,color:[219,0,170]},{value:.38,color:[255,0,130]},{value:.5,color:[255,63,74]},{value:.63,color:[255,123,0]},{value:.75,color:[234,176,0]},{value:.88,color:[190,228,0]},{value:1,color:[147,255,0]}]}),COOL:new h({stops:[{value:0,color:[125,0,179]},{value:.13,color:[116,0,218]},{value:.25,color:[98,74,237]},{value:.38,color:[68,146,231]},{value:.5,color:[0,204,197]},{value:.63,color:[0,247,146]},{value:.75,color:[0,255,88]},{value:.88,color:[40,255,8]},{value:1,color:[147,255,0]}]}),RAINBOW_SOFT:new h({stops:[{value:0,color:[125,0,179]},{value:.1,color:[199,0,180]},{value:.2,color:[255,0,121]},{value:.3,color:[255,108,0]},{value:.4,color:[222,194,0]},{value:.5,color:[150,255,0]},{value:.6,color:[0,255,55]},{value:.7,color:[0,246,150]},{value:.8,color:[50,167,222]},{value:.9,color:[103,51,235]},{value:1,color:[124,0,186]}]}),BATHYMETRY:new h({stops:[{value:0,color:[40,26,44]},{value:.13,color:[59,49,90]},{value:.25,color:[64,76,139]},{value:.38,color:[63,110,151]},{value:.5,color:[72,142,158]},{value:.63,color:[85,174,163]},{value:.75,color:[120,206,163]},{value:.88,color:[187,230,172]},{value:1,color:[253,254,204]}]}),CDOM:new h({stops:[{value:0,color:[47,15,62]},{value:.13,color:[87,23,86]},{value:.25,color:[130,28,99]},{value:.38,color:[171,41,96]},{value:.5,color:[206,67,86]},{value:.63,color:[230,106,84]},{value:.75,color:[242,149,103]},{value:.88,color:[249,193,135]},{value:1,color:[254,237,176]}]}),CHLOROPHYLL:new h({stops:[{value:0,color:[18,36,20]},{value:.13,color:[25,63,41]},{value:.25,color:[24,91,59]},{value:.38,color:[13,119,72]},{value:.5,color:[18,148,80]},{value:.63,color:[80,173,89]},{value:.75,color:[132,196,122]},{value:.88,color:[175,221,162]},{value:1,color:[215,249,208]}]}),DENSITY:new h({stops:[{value:0,color:[54,14,36]},{value:.13,color:[89,23,80]},{value:.25,color:[110,45,132]},{value:.38,color:[120,77,178]},{value:.5,color:[120,113,213]},{value:.63,color:[115,151,228]},{value:.75,color:[134,185,227]},{value:.88,color:[177,214,227]},{value:1,color:[230,241,241]}]}),FREESURFACE_BLUE:new h({stops:[{value:0,color:[30,4,110]},{value:.13,color:[47,14,176]},{value:.25,color:[41,45,236]},{value:.38,color:[25,99,212]},{value:.5,color:[68,131,200]},{value:.63,color:[114,156,197]},{value:.75,color:[157,181,203]},{value:.88,color:[200,208,216]},{value:1,color:[241,237,236]}]}),FREESURFACE_RED:new h({stops:[{value:0,color:[60,9,18]},{value:.13,color:[100,17,27]},{value:.25,color:[142,20,29]},{value:.38,color:[177,43,27]},{value:.5,color:[192,87,63]},{value:.63,color:[205,125,105]},{value:.75,color:[216,162,148]},{value:.88,color:[227,199,193]},{value:1,color:[241,237,236]}]}),OXYGEN:new h({stops:[{value:0,color:[64,5,5]},{value:.13,color:[106,6,15]},{value:.25,color:[144,26,7]},{value:.38,color:[168,64,3]},{value:.5,color:[188,100,4]},{value:.63,color:[206,136,11]},{value:.75,color:[220,174,25]},{value:.88,color:[231,215,44]},{value:1,color:[248,254,105]}]}),PAR:new h({stops:[{value:0,color:[51,20,24]},{value:.13,color:[90,32,35]},{value:.25,color:[129,44,34]},{value:.38,color:[159,68,25]},{value:.5,color:[182,99,19]},{value:.63,color:[199,134,22]},{value:.75,color:[212,171,35]},{value:.88,color:[221,210,54]},{value:1,color:[225,253,75]}]}),PHASE:new h({stops:[{value:0,color:[145,105,18]},{value:.13,color:[184,71,38]},{value:.25,color:[186,58,115]},{value:.38,color:[160,71,185]},{value:.5,color:[110,97,218]},{value:.63,color:[50,123,164]},{value:.75,color:[31,131,110]},{value:.88,color:[77,129,34]},{value:1,color:[145,105,18]}]}),SALINITY:new h({stops:[{value:0,color:[42,24,108]},{value:.13,color:[33,50,162]},{value:.25,color:[15,90,145]},{value:.38,color:[40,118,137]},{value:.5,color:[59,146,135]},{value:.63,color:[79,175,126]},{value:.75,color:[120,203,104]},{value:.88,color:[193,221,100]},{value:1,color:[253,239,154]}]}),TEMPERATURE:new h({stops:[{value:0,color:[4,35,51]},{value:.13,color:[23,51,122]},{value:.25,color:[85,59,157]},{value:.38,color:[129,79,143]},{value:.5,color:[175,95,130]},{value:.63,color:[222,112,101]},{value:.75,color:[249,146,66]},{value:.88,color:[249,196,65]},{value:1,color:[232,250,91]}]}),TURBIDITY:new h({stops:[{value:0,color:[34,31,27]},{value:.13,color:[65,50,41]},{value:.25,color:[98,69,52]},{value:.38,color:[131,89,57]},{value:.5,color:[161,112,59]},{value:.63,color:[185,140,66]},{value:.75,color:[202,174,88]},{value:.88,color:[216,209,126]},{value:1,color:[233,246,171]}]}),VELOCITY_BLUE:new h({stops:[{value:0,color:[17,32,64]},{value:.13,color:[35,52,116]},{value:.25,color:[29,81,156]},{value:.38,color:[31,113,162]},{value:.5,color:[50,144,169]},{value:.63,color:[87,173,176]},{value:.75,color:[149,196,189]},{value:.88,color:[203,221,211]},{value:1,color:[254,251,230]}]}),VELOCITY_GREEN:new h({stops:[{value:0,color:[23,35,19]},{value:.13,color:[24,64,38]},{value:.25,color:[11,95,45]},{value:.38,color:[39,123,35]},{value:.5,color:[95,146,12]},{value:.63,color:[152,165,18]},{value:.75,color:[201,186,69]},{value:.88,color:[233,216,137]},{value:1,color:[255,253,205]}]}),CUBEHELIX:new h({stops:[{value:0,color:[0,0,0]},{value:.07,color:[22,5,59]},{value:.13,color:[60,4,105]},{value:.2,color:[109,1,135]},{value:.27,color:[161,0,147]},{value:.33,color:[210,2,142]},{value:.4,color:[251,11,123]},{value:.47,color:[255,29,97]},{value:.53,color:[255,54,69]},{value:.6,color:[255,85,46]},{value:.67,color:[255,120,34]},{value:.73,color:[255,157,37]},{value:.8,color:[241,191,57]},{value:.87,color:[224,220,93]},{value:.93,color:[218,241,142]},{value:1,color:[227,253,198]}]}),CIVIDIS:new h({stops:[{value:0,color:[0,32,77,255]},{value:.125,color:[5,54,110,255]},{value:.25,color:[65,77,108,255]},{value:.375,color:[97,100,111,255]},{value:.5,color:[125,124,121,255]},{value:.625,color:[156,149,120,255]},{value:.75,color:[190,175,111,255]},{value:.875,color:[225,204,94,255]},{value:1,color:[255,235,70,255]}]}),TURBO:new h({stops:[{value:0,color:[48,18,59,255]},{value:.125,color:[70,107,227,255]},{value:.25,color:[40,187,236,255]},{value:.375,color:[49,242,153,255]},{value:.5,color:[162,252,60,255]},{value:.625,color:[237,208,58,255]},{value:.75,color:[251,128,34,255]},{value:.875,color:[210,49,5,255]},{value:1,color:[122,4,3,255]}]}),ROCKET:new h({stops:[{value:0,color:[250,235,221,0]},{value:.133,color:[250,235,221,255]},{value:.266,color:[246,170,130,255]},{value:.4,color:[240,96,67,255]},{value:.533,color:[203,27,79,255]},{value:.666,color:[132,30,90,255]},{value:.8,color:[63,27,68,255]},{value:1,color:[3,5,26,255]}]}),MAKO:new h({stops:[{value:0,color:[11,4,5,255]},{value:.125,color:[43,28,53,255]},{value:.25,color:[62,53,107,255]},{value:.375,color:[59,86,152,255]},{value:.5,color:[53,123,162,255]},{value:.625,color:[53,158,170,255]},{value:.75,color:[73,193,173,255]},{value:.875,color:[150,221,181,255]},{value:1,color:[222,245,229,255]}]})},at=[["#1D5B79","#468B97","#EF6262","#F3AA60"],["#614BC3","#33BBC5","#85E6C5","#C8FFE0"],["#461959","#7A316F","#CD6688","#AED8CC"],["#0079FF","#00DFA2","#F6FA70","#FF0060"],["#39B5E0","#A31ACB","#FF78F0","#F5EA5A"],["#37E2D5","#590696","#C70A80","#FBCB0A"],["#FFD36E","#FFF56D","#99FFCD","#9FB4FF"],["#00EAD3","#FFF5B7","#FF449F","#005F99"],["#10A19D","#540375","#FF7000","#FFBF00"]];function Ae(){return at[~~(Math.random()*at.length)][~~(Math.random()*4)]}function te(){return`maptiler_source_${Ne()}`}function oe(){return`maptiler_layer_${Ne()}`}function nt(o,e){if(e<=o[0].zoom)return o[0].value;if(e>=o[o.length-1].zoom)return o[o.length-1].value;for(let t=0;t<o.length-1;t+=1)if(e>=o[t].zoom&&e<o[t+1].zoom){const r=o[t+1].zoom-o[t].zoom,a=(e-o[t].zoom)/r;return a*o[t+1].value+(1-a)*o[t].value}return 0}function V(o){return["interpolate",["linear"],["zoom"],...o.flatMap(e=>[e.zoom,e.value])]}function b(o){return["interpolate",["linear"],["zoom"],...o.flatMap(e=>[e.zoom,e.value])]}function Ro(o,e){if(typeof e=="number"&&typeof o=="number")return 2*e+o;if(typeof e=="number"&&Array.isArray(o))return["interpolate",["linear"],["zoom"],...o.flatMap(t=>[t.zoom,2*e+t.value])];if(typeof o=="number"&&Array.isArray(e))return["interpolate",["linear"],["zoom"],...e.flatMap(t=>[t.zoom,2*t.value+o])];if(Array.isArray(o)&&Array.isArray(e)){const t=Array.from(new Set([...o.map(r=>r.zoom),...e.map(r=>r.zoom)])).sort((r,a)=>r<a?-1:1);return["interpolate",["linear"],["zoom"],...t.flatMap(r=>[r,2*nt(e,r)+nt(o,r)])]}return 0}function xo(o,e){return["interpolate",["linear"],["get",e],...o.flatMap(t=>[t.propertyValue,t.value])]}function it(o){const e=o.trimStart(),t=`${e}${" ".repeat(o.length-e.length)}`,r=Array.from(t);if(!r.every(n=>n===" "||n==="_"))throw new Error("A dash pattern must be composed only of whitespace and underscore characters.");if(!(r.some(n=>n==="_")&&r.some(n=>n===" ")))throw new Error("A dash pattern must contain at least one underscore and one whitespace character");const a=[1];for(let n=1;n<r.length;n+=1){const i=r[n-1],l=r[n];i===l?a[a.length-1]+=1:a.push(1)}return a}function lt(o,e){return["interpolate",["linear"],["get",e],...o.flatMap(t=>[t.value,t.color])]}function st(o,e,t=!0){return t?["interpolate",["linear"],["zoom"],0,["interpolate",["linear"],["get",e],...o.flatMap(r=>[r.value,r.pointRadius*.025])],2,["interpolate",["linear"],["get",e],...o.flatMap(r=>[r.value,r.pointRadius*.05])],4,["interpolate",["linear"],["get",e],...o.flatMap(r=>[r.value,r.pointRadius*.1])],8,["interpolate",["linear"],["get",e],...o.flatMap(r=>[r.value,r.pointRadius*.25])],16,["interpolate",["linear"],["get",e],...o.flatMap(r=>[r.value,r.pointRadius])]]:["interpolate",["linear"],["get",e],...o.flatMap(r=>[r.value,r.pointRadius])]}function No(o,e,t=!0){return t?["interpolate",["linear"],["zoom"],0,["interpolate",["linear"],["get",e],...o.flatMap(r=>[r.propertyValue,r.value*.025])],2,["interpolate",["linear"],["get",e],...o.flatMap(r=>[r.propertyValue,r.value*.05])],4,["interpolate",["linear"],["get",e],...o.flatMap(r=>[r.propertyValue,r.value*.1])],8,["interpolate",["linear"],["get",e],...o.flatMap(r=>[r.propertyValue,r.value*.25])],16,["interpolate",["linear"],["get",e],...o.flatMap(r=>[r.propertyValue,r.value])]]:["interpolate",["linear"],["get",e],...o.flatMap(r=>[r.propertyValue,r.value])]}function ct(o,e){return o.every(t=>t.color[3]===o[0].color[3])?o[0].color[3]?o[0].color[3]/255:1:["interpolate",["linear"],["get",e],...o.getRawColorStops().flatMap(t=>{const r=t.value,a=t.color;return[r,a.length===4?a[3]/255:1]})]}function _o(o,e=10){return["interpolate",["linear"],["heatmap-density"],...Array.from({length:e+1},(t,r)=>{const a=r/e;return[a,o.getColorHex(a)]}).flat()]}async function Mo(o,e,t={}){if(!e.sourceId&&!e.data)throw new Error("Creating a polyline layer requires an existing .sourceId or a valid .data property");let r=e.data;if(typeof r=="string"){if(q(r))r=`https://api.maptiler.com/data/${e.data}/features.json?key=${R.apiKey}`;else if(r.split(".").pop()?.toLowerCase().trim()==="gpx"){const a=await(await fetch(r,t)).text();r=ge(a)}else if(r.split(".").pop()?.toLowerCase().trim()==="kml"){const a=await(await fetch(r,t)).text();r=ye(a)}else{const a=Yt(r)??rt(r);a&&(r=a)}if(!r)throw new Error("Polyline data was provided as string but is incompatible with valid formats.")}return Po(o,{...e,data:r})}function Po(o,e){if(e.layerId&&o.getLayer(e.layerId))throw new Error(`A layer already exists with the layer id: ${e.layerId}`);const t=e.sourceId??te(),r=e.layerId??oe(),a={polylineLayerId:r,polylineOutlineLayerId:"",polylineSourceId:t};e.data&&!o.getSource(t)&&o.addSource(t,{type:"geojson",data:e.data});const n=e.lineWidth??3,i=e.lineColor??Ae(),l=e.lineOpacity??1,u=e.lineBlur??0,s=e.lineGapWidth??0;let c=e.lineDashArray??null;const p=e.outlineWidth??1,d=e.outlineColor??"#FFFFFF",y=e.outlineOpacity??1,v=e.outlineBlur??0;if(typeof c=="string"&&(c=it(c)),e.outline===!0){const g=`${r}_outline`;a.polylineOutlineLayerId=g,o.addLayer({id:g,type:"line",source:t,layout:{"line-join":e.lineJoin??"round","line-cap":e.lineCap??"round"},minzoom:e.minzoom??0,maxzoom:e.maxzoom??23,paint:{"line-opacity":typeof y=="number"?y:b(y),"line-color":typeof d=="string"?d:V(d),"line-width":Ro(n,p),"line-blur":typeof v=="number"?v:b(v)}},e.beforeId)}return o.addLayer({id:r,type:"line",source:t,layout:{"line-join":e.lineJoin??"round","line-cap":e.lineCap??"round"},minzoom:e.minzoom??0,maxzoom:e.maxzoom??23,paint:{"line-opacity":typeof l=="number"?l:b(l),"line-color":typeof i=="string"?i:V(i),"line-width":typeof n=="number"?n:b(n),"line-blur":typeof u=="number"?u:b(u),"line-gap-width":typeof s=="number"?s:b(s),...c&&{"line-dasharray":c}}},e.beforeId),a}function Oo(o,e){if(e.layerId&&o.getLayer(e.layerId))throw new Error(`A layer already exists with the layer id: ${e.layerId}`);const t=e.sourceId??te(),r=e.layerId??oe(),a={polygonLayerId:r,polygonOutlineLayerId:e.outline?`${r}_outline`:"",polygonSourceId:t};if(e.data&&!o.getSource(t)){let g=e.data;typeof g=="string"&&q(g)&&(g=`https://api.maptiler.com/data/${g}/features.json?key=${R.apiKey}`),o.addSource(t,{type:"geojson",data:g})}let n=e.outlineDashArray??null;const i=e.outlineWidth??1,l=e.outlineColor??"#FFFFFF",u=e.outlineOpacity??1,s=e.outlineBlur??0,c=e.fillColor??Ae(),p=e.fillOpacity??1,d=e.outlinePosition??"center",y=e.pattern??null;typeof n=="string"&&(n=it(n));const v=(g=null)=>{if(o.addLayer({id:r,type:"fill",source:t,minzoom:e.minzoom??0,maxzoom:e.maxzoom??23,paint:{"fill-color":typeof c=="string"?c:V(c),"fill-opacity":typeof p=="number"?p:b(p),...g&&{"fill-pattern":g}}},e.beforeId),e.outline===!0){let w;d==="inside"?typeof i=="number"?w=.5*i:w=b(i.map(({zoom:N,value:L})=>({zoom:N,value:.5*L}))):d==="outside"?typeof i=="number"?w=-.5*i:w=b(i.map(N=>({zoom:N.zoom,value:-.5*N.value}))):w=0,o.addLayer({id:a.polygonOutlineLayerId,type:"line",source:t,layout:{"line-join":e.outlineJoin??"round","line-cap":e.outlineCap??"butt"},minzoom:e.minzoom??0,maxzoom:e.maxzoom??23,paint:{"line-opacity":typeof u=="number"?u:b(u),"line-color":typeof l=="string"?l:V(l),"line-width":typeof i=="number"?i:b(i),"line-blur":typeof s=="number"?s:b(s),"line-offset":w,...n&&{"line-dasharray":n}}},e.beforeId)}};return y?o.hasImage(y)?v(y):o.loadImage(y).then(g=>{o.addImage(y,g.data),v(y)}).catch(g=>(console.error("Could not load the pattern image.",g.message),v())):v(),a}function ko(o,e){if(e.layerId&&o.getLayer(e.layerId))throw new Error(`A layer already exists with the layer id: ${e.layerId}`);const t=e.minPointRadius??10,r=e.maxPointRadius??50,a=e.cluster??!1,n=20,i=Array.isArray(e.pointColor)?e.pointColor:Le.TURBO.scale(10,e.cluster?1e4:1e3).resample("ease-out-square"),l=i.getBounds(),u=e.sourceId??te(),s=e.layerId??oe(),c=e.showLabel??a,p=e.alignOnViewport??!0,d=e.outline??!1,y=e.outlineOpacity??1,v=e.outlineWidth??1,g=e.outlineColor??"#FFFFFF";let w;const N=e.zoomCompensation??!0,L=e.minzoom??0,I=e.maxzoom??23;typeof e.pointOpacity=="number"?w=e.pointOpacity:Array.isArray(e.pointOpacity)?w=b(e.pointOpacity):e.cluster?w=ct(i,"point_count"):e.property?w=ct(i,e.property):w=b([{zoom:L,value:0},{zoom:L+.25,value:1},{zoom:I-.25,value:1},{zoom:I,value:0}]);const E={pointLayerId:s,clusterLayerId:"",labelLayerId:"",pointSourceId:u};if(e.data&&!o.getSource(u)){let T=e.data;typeof T=="string"&&q(T)&&(T=`https://api.maptiler.com/data/${T}/features.json?key=${R.apiKey}`),o.addSource(u,{type:"geojson",data:T,cluster:a})}if(a){E.clusterLayerId=`${s}_cluster`;const T=Array.from({length:n},(z,H)=>{const K=l.min+H*(l.max-l.min)/(n-1);return{value:K,pointRadius:t+(r-t)*(H/(n-1))**.5,color:i.getColorHex(K)}});o.addLayer({id:E.clusterLayerId,type:"circle",source:u,filter:["has","point_count"],paint:{"circle-color":typeof e.pointColor=="string"?e.pointColor:lt(T,"point_count"),"circle-radius":typeof e.pointRadius=="number"?e.pointRadius:Array.isArray(e.pointRadius)?b(e.pointRadius):st(T,"point_count",!1),"circle-pitch-alignment":p?"viewport":"map","circle-pitch-scale":"map","circle-opacity":w,...d&&{"circle-stroke-opacity":typeof y=="number"?y:b(y),"circle-stroke-width":typeof v=="number"?v:b(v),"circle-stroke-color":typeof g=="string"?g:V(g)}},minzoom:L,maxzoom:I},e.beforeId),o.addLayer({id:E.pointLayerId,type:"circle",source:u,filter:["!",["has","point_count"]],paint:{"circle-pitch-alignment":p?"viewport":"map","circle-pitch-scale":"map","circle-color":typeof e.pointColor=="string"?e.pointColor:i.getColorHex(i.getBounds().min),"circle-radius":typeof e.pointRadius=="number"?e.pointRadius:Array.isArray(e.pointRadius)?b(e.pointRadius):T[0].pointRadius*.75,"circle-opacity":w,...d&&{"circle-stroke-opacity":typeof y=="number"?y:b(y),"circle-stroke-width":typeof v=="number"?v:b(v),"circle-stroke-color":typeof g=="string"?g:V(g)}},minzoom:L,maxzoom:I},e.beforeId)}else{let T=typeof e.pointColor=="string"?e.pointColor:Array.isArray(e.pointColor)?e.pointColor.getColorHex(e.pointColor.getBounds().min):Ae(),z=typeof e.pointRadius=="number"?N?b([{zoom:0,value:e.pointRadius*.025},{zoom:2,value:e.pointRadius*.05},{zoom:4,value:e.pointRadius*.1},{zoom:8,value:e.pointRadius*.25},{zoom:16,value:e.pointRadius*1}]):e.pointRadius:Array.isArray(e.pointRadius)?b(e.pointRadius):N?b([{zoom:0,value:t*.05},{zoom:2,value:t*.1},{zoom:4,value:t*.2},{zoom:8,value:t*.5},{zoom:16,value:t*1}]):t;if(e.property&&Array.isArray(e.pointColor)){const H=Array.from({length:n},(K,Z)=>{const Y=l.min+Z*(l.max-l.min)/(n-1);return{value:Y,pointRadius:typeof e.pointRadius=="number"?e.pointRadius:t+(r-t)*(Z/(n-1))**.5,color:typeof e.pointColor=="string"?e.pointColor:i.getColorHex(Y)}});T=lt(H,e.property),z=st(H,e.property,N)}o.addLayer({id:E.pointLayerId,type:"circle",source:u,layout:{"circle-sort-key":e.property?["/",1,["get",e.property]]:0},paint:{"circle-pitch-alignment":p?"viewport":"map","circle-pitch-scale":"map","circle-color":T,"circle-opacity":w,"circle-radius":z,...d&&{"circle-stroke-opacity":typeof y=="number"?y:b(y),"circle-stroke-width":typeof v=="number"?v:b(v),"circle-stroke-color":typeof g=="string"?g:V(g)}},minzoom:L,maxzoom:I},e.beforeId)}if(c!==!1&&(e.cluster||e.property)){E.labelLayerId=`${s}_label`;const T=e.labelColor??"#fff",z=e.labelSize??12;o.addLayer({id:E.labelLayerId,type:"symbol",source:u,filter:["has",e.cluster?"point_count":e.property],layout:{"text-field":e.cluster?"{point_count_abbreviated}":`{${e.property}}`,"text-font":["Noto Sans Regular"],"text-size":z,"text-pitch-alignment":p?"viewport":"map","symbol-sort-key":["/",1,["get",e.cluster?"point_count":e.property]]},paint:{"text-color":T,"text-opacity":w},minzoom:L,maxzoom:I},e.beforeId)}return E}function Fo(o,e){if(e.layerId&&o.getLayer(e.layerId))throw new Error(`A layer already exists with the layer id: ${e.layerId}`);const t=e.sourceId??te(),r=e.layerId??oe(),a=e.minzoom??0,n=e.maxzoom??23,i=e.zoomCompensation??!0,l=e.opacity??[{zoom:a,value:0},{zoom:a+.25,value:1},{zoom:n-.25,value:1},{zoom:n,value:0}];let u=Array.isArray(e.colorRamp)?e.colorRamp:Le.TURBO.transparentStart();const s=u.getBounds();(s.min!==0||s.max!==1)&&(u=u.scale(0,1)),u.hasTransparentStart()||(u=u.transparentStart());const c=e.intensity??[{zoom:0,value:.01},{zoom:4,value:.2},{zoom:16,value:1}],p=e.property??null,d=e.weight??1;let y=1;p?typeof d=="number"?(y=d,typeof e.weight=="number"&&console.warn("The option `.property` is ignored when `.propertyValueWeights` is not of type `PropertyValueWeights`")):Array.isArray(d)?y=xo(d,p):console.warn("The option `.property` is ignored when `.propertyValueWeights` is not of type `PropertyValueWeights`"):typeof d=="number"?y=d:Array.isArray(d)&&console.warn("The options `.propertyValueWeights` can only be used when `.property` is provided.");const v=[{zoom:0,value:50*.025},{zoom:2,value:50*.05},{zoom:4,value:50*.1},{zoom:8,value:50*.25},{zoom:16,value:50}],g=e.radius??(i?v:10);let w=1;typeof g=="number"?w=g:Array.isArray(g)&&"zoom"in g[0]?w=b(g):p&&Array.isArray(g)&&"propertyValue"in g[0]?w=No(g,p,i):!p&&Array.isArray(g)&&"propertyValue"in g[0]?(w=b(v),console.warn("The option `.radius` can only be property-driven if the option `.property` is provided.")):w=b(v);const N={heatmapLayerId:r,heatmapSourceId:t};if(e.data&&!o.getSource(t)){let L=e.data;typeof L=="string"&&q(L)&&(L=`https://api.maptiler.com/data/${L}/features.json?key=${R.apiKey}`),o.addSource(t,{type:"geojson",data:L})}return o.addLayer({id:r,type:"heatmap",source:t,minzoom:a,maxzoom:n,paint:{"heatmap-weight":y,"heatmap-intensity":typeof c=="number"?c:b(c),"heatmap-color":_o(u),"heatmap-radius":w,"heatmap-opacity":typeof l=="number"?l:b(l)}}),N}const zo={addPolyline:Mo,addPolygon:Oo,addPoint:ko,addHeatmap:Fo};Kt();function Bo(){return Bt.version}export{Wo as AJAXError,so as AttributionControl,Ko as AttributionControlMLGL,uo as BoxZoomHandler,Zo as BoxZoomHandlerMLGL,to as CanvasSource,Yo as CanvasSourceMLGL,h as ColorRamp,Le as ColorRampCollection,ho as CooperativeGesturesHandler,qo as CooperativeGesturesHandlerMLGL,Jo as DoubleClickZoomHandler,Xo as DragPanHandler,Qo as DragRotateHandler,er as EdgeInsets,tr as Evented,ke as FullscreenControl,or as FullscreenControlMLGL,oo as GeoJSONSource,rr as GeoJSONSourceMLGL,Me as GeolocateControl,ar as GeolocateControlMLGL,We as GeolocationType,nr as Hash,ro as ImageSource,ir as ImageSourceMLGL,mo as KeyboardHandler,lr as KeyboardHandlerMLGL,A as Language,Yr as LanguageGeocoding,sr as LngLat,cr as LngLatBounds,Pe as LogoControl,ur as LogoControlMLGL,Ke as Map,pr as MapMLGL,fo as MapMouseEvent,hr as MapMouseEventMLGL,qr as MapStyle,Jr as MapStyleVariant,vo as MapTouchEvent,mr as MapTouchEventMLGL,yo as MapWheelEvent,dr as MapWheelEventMLGL,He as MaptilerGeolocateControl,ue as MaptilerLogoControl,Be as MaptilerNavigationControl,ze as MaptilerTerrainControl,Xt as Marker,gr as MarkerMLGL,yr as MercatorCoordinate,_e as NavigationControl,vr as NavigationControlMLGL,fr as Point,Qt as Popup,Lr as PopupMLGL,no as RasterDEMTileSource,Ar as RasterDEMTileSourceMLGL,ao as RasterTileSource,wr as RasterTileSourceMLGL,Xr as ReferenceMapStyle,Oe as ScaleControl,Cr as ScaleControlMLGL,po as ScrollZoomHandler,Sr as ScrollZoomHandlerMLGL,be as SdkConfig,Qr as ServiceError,eo as Style,br as StyleMLGL,co as TerrainControl,Tr as TerrainControlMLGL,go as TwoFingersTouchPitchHandler,Ir as TwoFingersTouchPitchHandlerMLGL,Er as TwoFingersTouchRotateHandler,Rr as TwoFingersTouchZoomHandler,xr as TwoFingersTouchZoomRotateHandler,io as VectorTileSource,Nr as VectorTileSourceMLGL,lo as VideoSource,_r as VideoSourceMLGL,Mr as addProtocol,Pr as addSourceType,ea as bufferToPixelDataBrowser,ta as circumferenceAtLatitude,Or as clearPrewarmedResources,R as config,kr as configMLGL,oa as coordinates,ra as data,aa as elevation,na as expandMapStyle,ia as geocoding,la as geolocation,sa as getAutoLanguageGeocoding,ne as getBrowserLanguage,ca as getBufferToPixelDataParser,Fr as getMapLibreVersion,zr as getMaxParallelImageRequests,Br as getRTLTextPluginStatus,ua as getTileCache,Bo as getVersion,Ur as getWorkerCount,Gr as getWorkerUrl,ge as gpx,rt as gpxOrKml,me as hasChildNodeWithName,zo as helpers,Hr as importScriptInWorkers,ae as isLanguageSupported,ye as kml,pa as mapStylePresetList,ha as math,ma as misc,Dr as prewarm,$r as removeProtocol,jr as setMaxParallelImageRequests,Vr as setRTLTextPlugin,Wr as setWorkerCount,Kr as setWorkerUrl,da as staticMaps,X as str2xml,ga as styleToStyle,de as xml2str};