@maptiler/sdk 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/maptiler-sdk.min.mjs +3 -3
- package/dist/maptiler-sdk.mjs +13 -11
- package/dist/maptiler-sdk.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import m from"maplibre-gl";import{Base64 as Xt}from"js-base64";import Qt from"events";import{config as Te,expandMapStyle as eo,MapStyleVariant as to,ReferenceMapStyle as oo,MapStyle as ro,mapStylePresetList as ao,geolocation as Je}from"@maptiler/client";import{LanguageGeocoding as ml,MapStyle as dl,MapStyleVariant as vl,ReferenceMapStyle as gl,ServiceError as yl,bufferToPixelDataBrowser as fl,circumferenceAtLatitude as Ll,coordinates as Al,data as wl,elevation as bl,expandMapStyle as Sl,geocoding as Cl,geolocation as Tl,getAutoLanguageGeocoding as Il,getBufferToPixelDataParser as Rl,getTileCache as El,mapStylePresetList as xl,math as Pl,misc as Ol,staticMaps as _l,styleToStyle as Nl}from"@maptiler/client";import{v4 as lo}from"uuid";var no="@maptiler/sdk",io="2.0.1",so="The Javascript & TypeScript map SDK tailored for MapTiler Cloud",uo="dist/maptiler-sdk.mjs",co="dist/maptiler-sdk.d.ts",po="dist/maptiler-sdk.css",ho="module",mo={".":{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"}},vo=["maptiler","map","sdk","webmap","cloud","webGL","maplibre"],go="https://docs.maptiler.com/sdk-js/",yo="BSD-3-Clause",fo={type:"git",url:"https://github.com/maptiler/maptiler-sdk-js.git"},Lo={build:"rm -rf dist/* && NODE_ENV=production rollup -c",dev:"rm -rf dist/* && NODE_ENV=development rollup -c -w","format:fix":'prettier --write "src/**/*.{js,ts,tsx}"',format:'prettier -c "src/**/*.{js,ts,tsx}"',"lint:fix":'eslint --fix "src/**/*.{js,ts}"',lint:'eslint "src/**/*.{js,ts}"',doc:"rm -rf docs/* && typedoc --out docs && cp -r images docs/",prepare:"npm run format:fix && npm run lint:fix && npm run build && npm run test","test:dev":"vitest dev",test:"vitest run"},Ao="MapTiler",wo={"@rollup/plugin-commonjs":"^24.1.0","@rollup/plugin-json":"^6.0.0","@rollup/plugin-node-resolve":"^15.0.2","@types/uuid":"^9.0.2","@types/xmldom":"^0.1.31","@typescript-eslint/eslint-plugin":"^6.9.0","@typescript-eslint/parser":"^6.9.0",eslint:"^8.52.0","eslint-config-prettier":"^9.0.0","eslint-plugin-prettier":"^5.0.1",prettier:"^3.0.3",rollup:"^3.20.6","rollup-plugin-copy-merge":"^1.0.0","rollup-plugin-dts":"^5.3.0","rollup-plugin-esbuild":"^5.0.0","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"},bo={"@maptiler/client":"^1.8.1",events:"^3.3.0","js-base64":"^3.7.4","maplibre-gl":"4.1.2",uuid:"^9.0.0"},So={name:no,version:io,description:so,module:uo,types:co,style:po,type:ho,exports:mo,keywords:vo,homepage:go,license:yo,repository:fo,scripts:Lo,author:Ao,devDependencies:wo,dependencies:bo};const C={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"},Co=new Set(Object.values(C));function Ie(t){return Co.has(t)}const To=new Set(Object.values(C));function Re(){if(typeof navigator>"u")return`name:${Intl.DateTimeFormat().resolvedOptions().locale.split("-")[0]}`;const t=Array.from(new Set(navigator.languages.map(e=>`name:${e.split("-")[0]}`))).filter(e=>To.has(e));return t.length?t[0]:C.LOCAL}const V={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:C.STYLE,secondaryLanguage:C.LOCAL,terrainSourceURL:"https://api.maptiler.com/tiles/terrain-rgb-v2/tiles.json",terrainSourceId:"maptiler-terrain"};Object.freeze(V);var Io=Object.defineProperty,Ro=(t,e,o)=>e in t?Io(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,ce=(t,e,o)=>(Ro(t,typeof e!="symbol"?e+"":e,o),o);const Xe=lo();let Qe=class extends Qt{constructor(){super(),ce(this,"primaryLanguage",V.primaryLanguage),ce(this,"secondaryLanguage"),ce(this,"session",!0),ce(this,"caching",!0),ce(this,"_unit","metric"),ce(this,"_apiKey","")}set unit(e){this._unit=e,this.emit("unit",e)}get unit(){return this._unit}set apiKey(e){this._apiKey=e,Te.apiKey=e,this.emit("apiKey",e)}get apiKey(){return this._apiKey}set fetch(e){Te.fetch=e}get fetch(){return Te.fetch}};const H=new Qe;class et extends m.LogoControl{onAdd(e){return super.onAdd(e)}}var Eo=Object.defineProperty,xo=(t,e,o)=>e in t?Eo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,tt=(t,e,o)=>(xo(t,typeof e!="symbol"?e+"":e,o),o);class Ee extends et{constructor(e={}){var o,r;super(e),tt(this,"logoURL",""),tt(this,"linkURL",""),this.logoURL=(o=e.logoURL)!=null?o:V.maptilerLogoURL,this.linkURL=(r=e.linkURL)!=null?r:V.maptilerURL}onAdd(e){var o;this._map=e,this._compact=(o=this.options.compact)!=null?o:!1,this._container=window.document.createElement("div"),this._container.className="maplibregl-ctrl";const r=window.document.createElement("a");return r.style.backgroundRepeat="no-repeat",r.style.cursor="pointer",r.style.display="block",r.style.height="23px",r.style.margin="0 0 -4px -4px",r.style.overflow="hidden",r.style.width="88px",r.style.backgroundImage=`url(${this.logoURL})`,r.style.backgroundSize="100px 30px",r.style.width="100px",r.style.height="30px",r.target="_blank",r.rel="noopener",r.href=this.linkURL,r.setAttribute("aria-label","MapTiler logo"),r.setAttribute("rel","noopener"),this._container.appendChild(r),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}}var ve=(t,e,o)=>new Promise((r,a)=>{var l=n=>{try{s(o.next(n))}catch(u){a(u)}},i=n=>{try{s(o.throw(n))}catch(u){a(u)}},s=n=>n.done?r(n.value):Promise.resolve(n.value).then(l,i);s((o=o.apply(t,e)).next())});const xe="localcache_source",Pe="localcache",Po="maptiler_sdk",Oo=1e3,_o=100;function No(t,e){if(H.caching&&H.session&&t.host===V.maptilerApiHost){if(e=="Source")return t.href.replace("https://",`${xe}://`);if(e=="Tile"||e=="Glyphs")return t.href.replace("https://",`${Pe}://`)}return t.href}let Oe;function ot(){return ve(this,null,function*(){return Oe||(Oe=yield caches.open(Po)),Oe})}let rt=0;function Mo(){return ve(this,null,function*(){const t=yield ot(),e=yield t.keys(),o=e.slice(0,Math.max(e.length-Oo,0));for(const r of o)t.delete(r)})}function $o(){Ke(xe,(t,e)=>ve(this,null,function*(){if(!t.url)throw new Error("");t.url=t.url.replace(`${xe}://`,"https://");const o=t;o.signal=e.signal;const r=yield fetch(t.url,o),a=yield r.json();return a.tiles[0]+="&last-modified="+r.headers.get("Last-Modified"),{data:a,cacheControl:r.headers.get("Cache-Control"),expires:r.headers.get("Expires")}})),Ke(Pe,(t,e)=>ve(this,null,function*(){if(!t.url)throw new Error("");t.url=t.url.replace(`${Pe}://`,"https://");const o=new URL(t.url),r=new URL(o);r.searchParams.delete("mtsid"),r.searchParams.delete("key");const a=r.toString(),l=new URL(o);l.searchParams.delete("last-modified");const i=l.toString(),s=c=>ve(this,null,function*(){return{data:yield c.arrayBuffer(),cacheControl:c.headers.get("Cache-Control"),expires:c.headers.get("Expires")}}),n=yield ot(),u=yield n.match(a);if(u)return s(u);{const c=t;c.signal=e.signal;const p=yield fetch(i,c);return p.status>=200&&p.status<300&&(n.put(a,p.clone()).catch(()=>{}),++rt>_o&&(Mo(),rt=0)),s(p)}}))}var ko=Object.defineProperty,at=Object.getOwnPropertySymbols,Fo=Object.prototype.hasOwnProperty,zo=Object.prototype.propertyIsEnumerable,lt=(t,e,o)=>e in t?ko(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,nt=(t,e)=>{for(var o in e||(e={}))Fo.call(e,o)&<(t,o,e[o]);if(at)for(var o of at(e))zo.call(e,o)&<(t,o,e[o]);return t};function Bo(){m.getRTLTextPluginStatus()==="unavailable"&&m.setRTLTextPlugin(V.rtlPluginURL,t=>{t&&console.error(t)},!0)}function Uo(t,e){t.forEach(o=>{typeof e[o]=="function"&&(e[o]=e[o].bind(e))})}function oe(t,e,o){const r=window.document.createElement(t);return e!==void 0&&(r.className=e),o&&o.appendChild(r),r}function it(t){t.parentNode&&t.parentNode.removeChild(t)}function st(t,e){let o=null;try{o=new URL(t)}catch{return{url:t}}return o.host===V.maptilerApiHost&&(o.searchParams.has("key")||o.searchParams.append("key",H.apiKey),H.session&&o.searchParams.append("mtsid",Xe)),{url:No(o,e)}}function ut(t){return function(e,o){var r;if(t!==void 0){const a=t(e,o),l=st((r=a?.url)!=null?r:"",o);return nt(nt({},a),l)}else return st(e,o)}}function ct(){return Math.random().toString(36).substring(2)}function ge(t){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(t)}function Ho(t){try{return JSON.parse(t)}catch{}return null}function pt(t){return t?typeof t=="string"||t instanceof String?!t.startsWith("http")&&t.toLowerCase().includes(".json")?t:eo(t):t instanceof to?t.getExpandedStyleURL():t instanceof oo?t.getDefaultVariant().getExpandedStyleURL():t:ro[ao[0].referenceStyleID].getDefaultVariant().getExpandedStyleURL()}var jo=Object.defineProperty,Do=(t,e,o)=>e in t?jo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,_e=(t,e,o)=>(Do(t,typeof e!="symbol"?e+"":e,o),o);class ht{constructor(){_e(this,"_map"),_e(this,"_container"),_e(this,"_terrainButton"),Uo(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(e){return this._map=e,this._container=oe("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=oe("button","maplibregl-ctrl-terrain",this._container),oe("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(){it(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 mt extends m.NavigationControl{onAdd(e){return super.onAdd(e)}}var Go=Object.defineProperty,Vo=(t,e,o)=>e in t?Go(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,Wo=(t,e,o)=>(Vo(t,typeof e!="symbol"?e+"":e,o),o);class dt extends mt{constructor(){super({showCompass:!0,showZoom:!0,visualizePitch:!0}),Wo(this,"_rotateCompassArrow",()=>{const e=this.options.visualizePitch?`scale(${Math.min(1.5,1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5))}) rotateX(${Math.min(70,this._map.transform.pitch)}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=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,o){const r=super._createButton(e,o);return r.clickFunction=o,r}}class vt extends m.GeolocateControl{onAdd(e){return super.onAdd(e)}}var Zo=Object.defineProperty,Ko=Object.defineProperties,Yo=Object.getOwnPropertyDescriptors,gt=Object.getOwnPropertySymbols,qo=Object.prototype.hasOwnProperty,Jo=Object.prototype.propertyIsEnumerable,Ne=(t,e,o)=>e in t?Zo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,Xo=(t,e)=>{for(var o in e||(e={}))qo.call(e,o)&&Ne(t,o,e[o]);if(gt)for(var o of gt(e))Jo.call(e,o)&&Ne(t,o,e[o]);return t},Qo=(t,e)=>Ko(t,Yo(e)),ye=(t,e,o)=>(Ne(t,typeof e!="symbol"?e+"":e,o),o);const yt=m.Marker,ft=m.LngLat,er=m.LngLatBounds;class Lt extends vt{constructor(){super(...arguments),ye(this,"lastUpdatedCenter",new ft(0,0)),ye(this,"_updateCamera",e=>{var o,r,a;const l=new ft(e.coords.longitude,e.coords.latitude),i=e.coords.accuracy,s=this._map.getBearing(),n=Qo(Xo({bearing:s},this.options.fitBoundsOptions),{linear:!0}),u=this._map.getZoom();u>((a=(r=(o=this.options)==null?void 0:o.fitBoundsOptions)==null?void 0:r.maxZoom)!=null?a:30)&&(n.zoom=u),this._map.fitBounds(er.fromLngLat(l,i),n,{geolocateSource:!0});let c=!1;const p=()=>{c=!0};this._map.once("click",p),this._map.once("dblclick",p),this._map.once("dragstart",p),this._map.once("mousedown",p),this._map.once("touchstart",p),this._map.once("wheel",p),this._map.once("moveend",()=>{this._map.off("click",p),this._map.off("dblclick",p),this._map.off("dragstart",p),this._map.off("mousedown",p),this._map.off("touchstart",p),this._map.off("wheel",p),!c&&(this.lastUpdatedCenter=this._map.getCenter())})}),ye(this,"_setupUI",e=>{if(this.lastUpdatedCenter=this._map.getCenter(),this._container.addEventListener("contextmenu",o=>o.preventDefault()),this._geolocateButton=oe("button","maplibregl-ctrl-geolocate",this._container),oe("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",e===!1){const o=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=o,this._geolocateButton.setAttribute("aria-label",o)}else{const o=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=o,this._geolocateButton.setAttribute("aria-label",o)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=oe("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new yt({element:this._dotElement}),this._circleElement=oe("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new yt({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",o=>{const r=o.originalEvent&&o.originalEvent.type==="resize",a=this.lastUpdatedCenter.distanceTo(this._map.getCenter());!o.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")))})}),ye(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],o=this._map.project(e),r=this._map.unproject([o.x,o.y]),a=this._map.unproject([o.x+20,o.y]),l=r.distanceTo(a)/20,i=Math.ceil(2*this._accuracy/l);this._circleElement.style.width=`${i}px`,this._circleElement.style.height=`${i}px`}}class At extends m.AttributionControl{onAdd(e){return super.onAdd(e)}}class wt extends m.ScaleControl{onAdd(e){return super.onAdd(e)}}class bt extends m.FullscreenControl{onAdd(e){return super.onAdd(e)}}var tr=Object.defineProperty,or=Object.defineProperties,rr=Object.getOwnPropertyDescriptors,St=Object.getOwnPropertySymbols,ar=Object.prototype.hasOwnProperty,lr=Object.prototype.propertyIsEnumerable,Me=(t,e,o)=>e in t?tr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,pe=(t,e)=>{for(var o in e||(e={}))ar.call(e,o)&&Me(t,o,e[o]);if(St)for(var o of St(e))lr.call(e,o)&&Me(t,o,e[o]);return t},Ct=(t,e)=>or(t,rr(e)),nr=(t,e,o)=>(Me(t,typeof e!="symbol"?e+"":e,o),o),$e=(t,e,o)=>{if(!e.has(t))throw TypeError("Cannot "+o)},f=(t,e,o)=>($e(t,e,"read from private field"),o?o.call(t):e.get(t)),X=(t,e,o)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,o)},he=(t,e,o,r)=>($e(t,e,"write to private field"),r?r.call(t,o):e.set(t,o),o),W=(t,e,o)=>($e(t,e,"access private method"),o),Z,Q,ae,Tt,le,Y,fe,ke,It,K,q,Fe,Rt;let ze=class{constructor(e,o){X(this,ke),X(this,K),X(this,Fe),X(this,Z,void 0),nr(this,"map"),X(this,Q,void 0),X(this,ae,void 0),X(this,Tt,void 0),X(this,le,void 0),X(this,Y,!1),X(this,fe,void 0);var r;e.style!==void 0&&he(this,Y,!0),he(this,Z,Ct(pe(Ct(pe({zoomAdjust:-4,position:"top-right"},o),{forceNoAttributionControl:!0,attributionControl:!1,navigationControl:!1,geolocateControl:!1,maptilerLogo:!1,minimap:!1,hash:!1,pitchAdjust:!1}),e),{containerStyle:pe({border:"1px solid #000",width:"400px",height:"300px"},(r=e.containerStyle)!=null?r:{})})),e.lockZoom!==void 0&&(f(this,Z).minZoom=e.lockZoom,f(this,Z).maxZoom=e.lockZoom)}setStyle(e,o){f(this,Y)||this.map.setStyle(e,o),W(this,K,q).call(this)}addLayer(e,o){return f(this,Y)||this.map.addLayer(e,o),W(this,K,q).call(this),this.map}moveLayer(e,o){return f(this,Y)||this.map.moveLayer(e,o),W(this,K,q).call(this),this.map}removeLayer(e){return f(this,Y)||this.map.removeLayer(e),W(this,K,q).call(this),this}setLayerZoomRange(e,o,r){return f(this,Y)||this.map.setLayerZoomRange(e,o,r),W(this,K,q).call(this),this}setFilter(e,o,r){return f(this,Y)||this.map.setFilter(e,o,r),W(this,K,q).call(this),this}setPaintProperty(e,o,r,a){return f(this,Y)||this.map.setPaintProperty(e,o,r,a),W(this,K,q).call(this),this}setLayoutProperty(e,o,r,a){return f(this,Y)||this.map.setLayoutProperty(e,o,r,a),W(this,K,q).call(this),this}setGlyphs(e,o){return f(this,Y)||this.map.setGlyphs(e,o),W(this,K,q).call(this),this}onAdd(e){he(this,Q,e),he(this,ae,oe("div","maplibregl-ctrl maplibregl-ctrl-group"));for(const[o,r]of Object.entries(f(this,Z).containerStyle))f(this,ae).style.setProperty(o,r);return f(this,Z).container=f(this,ae),f(this,Z).zoom=e.getZoom()+f(this,Z).zoomAdjust,this.map=new Pt(f(this,Z)),this.map.once("style.load",()=>{this.map.resize()}),this.map.once("load",()=>{W(this,ke,It).call(this,f(this,Z).parentRect),he(this,fe,W(this,Fe,Rt).call(this))}),f(this,ae)}onRemove(){var e;(e=f(this,fe))==null||e.call(this),it(f(this,ae))}};Z=new WeakMap,Q=new WeakMap,ae=new WeakMap,Tt=new WeakMap,le=new WeakMap,Y=new WeakMap,fe=new WeakMap,ke=new WeakSet,It=function(t){t===void 0||t.linePaint===void 0&&t.fillPaint===void 0||(he(this,le,{type:"Feature",properties:{name:"parentRect"},geometry:{type:"Polygon",coordinates:[[[],[],[],[],[]]]}}),this.map.addSource("parentRect",{type:"geojson",data:f(this,le)}),(t.lineLayout!==void 0||t.linePaint!==void 0)&&this.map.addLayer({id:"parentRectOutline",type:"line",source:"parentRect",layout:pe({},t.lineLayout),paint:pe({"line-color":"#FFF","line-width":1,"line-opacity":.85},t.linePaint)}),t.fillPaint!==void 0&&this.map.addLayer({id:"parentRectFill",type:"fill",source:"parentRect",layout:{},paint:pe({"fill-color":"#08F","fill-opacity":.135},t.fillPaint)}),W(this,K,q).call(this))},K=new WeakSet,q=function(){if(f(this,le)===void 0)return;const{devicePixelRatio:t}=window,e=f(this,Q).getCanvas(),o=e.width/t,r=e.height/t,a=f(this,Q).unproject.bind(f(this,Q)),l=a([0,0]),i=a([o,0]),s=a([0,r]),n=a([o,r]);f(this,le).geometry.coordinates=[[s.toArray(),n.toArray(),i.toArray(),l.toArray(),s.toArray()]],this.map.getSource("parentRect").setData(f(this,le))},Fe=new WeakSet,Rt=function(){const{pitchAdjust:t}=f(this,Z),e=()=>{l("parent")},o=()=>{l("minimap")},r=()=>{f(this,Q).on("move",e),this.map.on("move",o)},a=()=>{f(this,Q).off("move",e),this.map.off("move",o)},l=i=>{var s;a();const n=i==="parent"?f(this,Q):this.map,u=i==="parent"?this.map:f(this,Q),c=n.getCenter(),p=n.getZoom()+((s=f(this,Z).zoomAdjust)!=null?s:-4)*(i==="parent"?1:-1),h=n.getBearing(),L=n.getPitch();u.jumpTo({center:c,zoom:p,bearing:h,pitch:t?L:0}),W(this,K,q).call(this),r()};return r(),()=>{a()}};var ir=Object.defineProperty,sr=Object.defineProperties,ur=Object.getOwnPropertyDescriptors,Et=Object.getOwnPropertySymbols,cr=Object.prototype.hasOwnProperty,pr=Object.prototype.propertyIsEnumerable,Be=(t,e,o)=>e in t?ir(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,hr=(t,e)=>{for(var o in e||(e={}))cr.call(e,o)&&Be(t,o,e[o]);if(Et)for(var o of Et(e))pr.call(e,o)&&Be(t,o,e[o]);return t},mr=(t,e)=>sr(t,ur(e)),ee=(t,e,o)=>(Be(t,typeof e!="symbol"?e+"":e,o),o),te=(t,e,o)=>new Promise((r,a)=>{var l=n=>{try{s(o.next(n))}catch(u){a(u)}},i=n=>{try{s(o.throw(n))}catch(u){a(u)}},s=n=>n.done?r(n.value):Promise.resolve(n.value).then(l,i);s((o=o.apply(t,e)).next())});const xt={POINT:"POINT",COUNTRY:"COUNTRY"};class Pt extends m.Map{constructor(e){var o,r,a;e.apiKey&&(H.apiKey=e.apiKey);const l=pt(e.style),i=location.hash;H.apiKey||console.warn("MapTiler Cloud API key is not set. Visit https://maptiler.com and try Cloud for free!"),super(mr(hr({},e),{style:l,maplibreLogo:!1,transformRequest:ut(e.transformRequest)})),ee(this,"isTerrainEnabled",!1),ee(this,"terrainExaggeration",1),ee(this,"primaryLanguage"),ee(this,"terrainGrowing",!1),ee(this,"terrainFlattening",!1),ee(this,"minimap"),ee(this,"forceLanguageUpdate"),ee(this,"languageAlwaysBeenStyle"),ee(this,"isReady",!1),H.caching&&$o(),this.primaryLanguage=(o=e.language)!=null?o:H.primaryLanguage,this.forceLanguageUpdate=!(this.primaryLanguage===C.STYLE||this.primaryLanguage===C.STYLE_LOCK),this.languageAlwaysBeenStyle=this.primaryLanguage===C.STYLE,this.terrainExaggeration=(r=e.terrainExaggeration)!=null?r:this.terrainExaggeration,this.once("styledata",()=>te(this,null,function*(){if(!e.geolocate||e.center||e.hash&&i)return;try{if(e.geolocate===xt.COUNTRY){yield this.fitToIpBounds();return}}catch(h){console.warn(h.message)}let p;try{yield this.centerOnIpPoint(e.zoom),p=this.getCameraHash()}catch(h){console.warn(h.message)}(yield navigator.permissions.query({name:"geolocation"})).state==="granted"&&navigator.geolocation.getCurrentPosition(h=>{p===this.getCameraHash()&&(this.terrain?this.easeTo({center:[h.coords.longitude,h.coords.latitude],zoom:e.zoom||12,duration:2e3}):this.once("terrain",()=>{this.easeTo({center:[h.coords.longitude,h.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",()=>te(this,null,function*(){Bo()})),this.once("load",()=>te(this,null,function*(){let p={logo:null};try{const h=Object.keys(this.style.sourceCaches).map(A=>this.getSource(A)).filter(A=>A&&"url"in A&&typeof A.url=="string"&&A?.url.includes("tiles.json")),L=new URL(h[0].url);L.searchParams.has("key")||L.searchParams.append("key",H.apiKey),p=yield(yield fetch(L.href)).json()}catch{}if(e.forceNoAttributionControl!==!0)if("logo"in p&&p.logo){const h=p.logo;this.addControl(new Ee({logoURL:h}),e.logoPosition),e.attributionControl===!1&&this.addControl(new At({customAttribution:e.customAttribution}))}else e.maptilerLogo&&this.addControl(new Ee,e.logoPosition);if(e.scaleControl){const h=e.scaleControl===!0||e.scaleControl===void 0?"bottom-right":e.scaleControl,L=new wt({unit:H.unit});this.addControl(L,h),H.on("unit",A=>{L.setUnit(A)})}if(e.navigationControl!==!1){const h=e.navigationControl===!0||e.navigationControl===void 0?"top-right":e.navigationControl;this.addControl(new dt,h)}if(e.geolocateControl!==!1){const h=e.geolocateControl===!0||e.geolocateControl===void 0?"top-right":e.geolocateControl;this.addControl(new Lt({positionOptions:{enableHighAccuracy:!0,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!0,showAccuracyCircle:!0,showUserLocation:!0}),h)}if(e.terrainControl){const h=e.terrainControl===!0||e.terrainControl===void 0?"top-right":e.terrainControl;this.addControl(new ht,h)}if(e.fullscreenControl){const h=e.fullscreenControl===!0||e.fullscreenControl===void 0?"top-right":e.fullscreenControl;this.addControl(new bt({}),h)}this.isReady=!0,this.fire("ready",{target:this})}));let s=!1,n=!1,u;this.once("ready",()=>{s=!0,n&&this.fire("loadWithTerrain",u)}),this.once("style.load",()=>{var p;const{minimap:h}=e;if(typeof h=="object"){const{zoom:L,center:A,style:g,language:k,apiKey:M,maptilerLogo:R,antialias:z,refreshExpiredTiles:F,maxBounds:_,scrollZoom:E,minZoom:I,maxZoom:w,boxZoom:T,locale:b,fadeDuration:B,crossSourceCollisions:y,clickTolerance:S,bounds:O,fitBoundsOptions:N,pixelRatio:$,validateStyle:j}=e;this.minimap=new ze(h,{zoom:L,center:A,style:g,language:k,apiKey:M,container:"null",maptilerLogo:R,antialias:z,refreshExpiredTiles:F,maxBounds:_,scrollZoom:E,minZoom:I,maxZoom:w,boxZoom:T,locale:b,fadeDuration:B,crossSourceCollisions:y,clickTolerance:S,bounds:O,fitBoundsOptions:N,pixelRatio:$,validateStyle:j}),this.addControl(this.minimap,(p=h.position)!=null?p:"bottom-left")}else h===!0?(this.minimap=new ze({},e),this.addControl(this.minimap,"bottom-left")):h!==void 0&&h!==!1&&(this.minimap=new ze({},e),this.addControl(this.minimap,h))});const c=p=>{p.terrain&&(n=!0,u={type:"loadWithTerrain",target:this,terrain:p.terrain},this.off("terrain",c),s&&this.fire("loadWithTerrain",u))};this.on("terrain",c),e.terrain&&this.enableTerrain((a=e.terrainExaggeration)!=null?a:this.terrainExaggeration)}onLoadAsync(){return te(this,null,function*(){return new Promise(e=>{if(this.loaded())return e(this);this.once("load",()=>{e(this)})})})}onReadyAsync(){return te(this,null,function*(){return new Promise(e=>{if(this.isReady)return e(this);this.once("ready",()=>{e(this)})})})}onLoadWithTerrainAsync(){return te(this,null,function*(){return new Promise(e=>{if(this.isReady&&this.terrain)return e(this);this.once("loadWithTerrain",()=>{e(this)})})})}setStyle(e,o){var r;return(r=this.minimap)==null||r.setStyle(e),this.forceLanguageUpdate=!0,this.once("idle",()=>{this.forceLanguageUpdate=!1}),super.setStyle(pt(e),o)}addLayer(e,o){var r;return(r=this.minimap)==null||r.addLayer(e,o),super.addLayer(e,o)}moveLayer(e,o){var r;return(r=this.minimap)==null||r.moveLayer(e,o),super.moveLayer(e,o)}removeLayer(e){var o;return(o=this.minimap)==null||o.removeLayer(e),super.removeLayer(e)}setLayerZoomRange(e,o,r){var a;return(a=this.minimap)==null||a.setLayerZoomRange(e,o,r),super.setLayerZoomRange(e,o,r)}setFilter(e,o,r){var a;return(a=this.minimap)==null||a.setFilter(e,o,r),super.setFilter(e,o,r)}setPaintProperty(e,o,r,a){var l;return(l=this.minimap)==null||l.setPaintProperty(e,o,r,a),super.setPaintProperty(e,o,r,a)}setLayoutProperty(e,o,r,a){var l;return(l=this.minimap)==null||l.setLayoutProperty(e,o,r,a),super.setLayoutProperty(e,o,r,a)}setGlyphs(e,o){var r;return(r=this.minimap)==null||r.setGlyphs(e,o),super.setGlyphs(e,o)}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){var o,r;(r=(o=this.minimap)==null?void 0:o.map)==null||r.setLanguage(e),this.onStyleReady(()=>{this.setPrimaryLanguage(e)})}setPrimaryLanguage(e){const o=this.getStyleLanguage();if(!(e===C.STYLE&&(o===C.AUTO||o===C.VISITOR))&&(e!==C.STYLE&&(this.languageAlwaysBeenStyle=!1),this.languageAlwaysBeenStyle||this.primaryLanguage===e&&!this.forceLanguageUpdate))return;if(!Ie(e)){console.warn(`The language "${e}" is not supported.`);return}if(this.primaryLanguage===C.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===C.STYLE){if(!o){console.warn("The style has no default languages.");return}if(!Ie(o)){console.warn("The language defined in the style is not valid.");return}r=o}let a=C.LOCAL,l=`{${a}}`;r==C.VISITOR?(a=Re(),l=["case",["all",["has",a],["has",C.LOCAL]],["case",["==",["get",a],["get",C.LOCAL]],["get",C.LOCAL],["format",["get",a],{"font-scale":.8},`
|
|
2
|
-
`,["get",
|
|
3
|
-
`,["get",C.LOCAL],{"font-scale":1.1}]],["get",C.LOCAL]]):r===C.AUTO?(a=Re(),l=["case",["has",a],["get",a],["get",C.LOCAL]]):r===C.LOCAL?(a=C.LOCAL,l=`{${a}}`):(a=r,l=["case",["has",a],["get",a],["get",C.LOCAL]]);const{layers:i}=this.getStyle();for(const s of i){if(s.type!=="symbol")continue;const n=s,u=this.getSource(n.source);if(!u||!("url"in u&&typeof u.url=="string")||new URL(u.url).host!==V.maptilerApiHost)continue;const{id:c,layout:p}=n;if(!p||!("text-field"in p))continue;const h=this.getLayoutProperty(c,"text-field");typeof h=="string"&&(h.toLowerCase().includes("ref")||h.toLowerCase().includes("housenumber"))||this.setLayoutProperty(c,"text-field",l)}}getPrimaryLanguage(){return this.primaryLanguage}getTerrainExaggeration(){return this.terrainExaggeration}hasTerrain(){return this.isTerrainEnabled}growTerrain(e,o=1e3){if(!this.terrain)return;const r=performance.now(),a=this.terrain.exaggeration,l=e-a,i=()=>{if(!this.terrain||this.terrainFlattening)return;const s=(performance.now()-r)/o;if(s<.99){const n=1-Math.pow(1-s,4),u=a+n*l;this.terrain.exaggeration=u,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 o=a=>te(this,null,function*(){!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",o),this.growTerrain(e))}),r=()=>{this.isTerrainEnabled=!0,this.terrainExaggeration=e,this.on("data",o),this.addSource(V.terrainSourceId,{type:"raster-dem",url:V.terrainSourceURL}),this.setTerrain({source:V.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(V.terrainSourceId)||r()})}disableTerrain(){if(!this.terrain)return;this.isTerrainEnabled=!1;const e=1*1e3,o=performance.now(),r=this.terrain.exaggeration,a=()=>{if(!this.terrain||this.terrainGrowing)return;const l=(performance.now()-o)/e;if(l<.99){const i=Math.pow(1-l,4),s=r*i;this.terrain.exaggeration=s,requestAnimationFrame(a)}else this.terrain.exaggeration=0,this.terrainGrowing=!1,this.terrainFlattening=!1,this.setTerrain(),this.getSource(V.terrainSourceId)&&this.removeSource(V.terrainSourceId);this.triggerRepaint()};this.terrainGrowing=!1,this.terrainFlattening=!0,requestAnimationFrame(a)}setTerrainExaggeration(e,o=!0){!o&&this.terrain?(this.terrainExaggeration=e,this.terrain.exaggeration=e,this.triggerRepaint()):this.enableTerrain(e)}onStyleReady(e){this.isStyleLoaded()?e():this.once("styledata",()=>{e()})}fitToIpBounds(){return te(this,null,function*(){const e=yield Je.info();this.fitBounds(e.country_bounds,{duration:0,padding:100})})}centerOnIpPoint(e){return te(this,null,function*(){var o,r;const a=yield Je.info();this.jumpTo({center:[(o=a?.longitude)!=null?o:0,(r=a?.latitude)!=null?r:0],zoom:e||11})})}getCameraHash(){const e=new Float32Array(5),o=this.getCenter();return e[0]=o.lng,e[1]=o.lat,e[2]=this.getZoom(),e[3]=this.getPitch(),e[4]=this.getBearing(),Xt.fromUint8Array(new Uint8Array(e.buffer))}getSdkConfig(){return H}getMaptilerSessionId(){return Xe}setTransformRequest(e){return super.setTransformRequest(ut(e)),this}}class dr extends m.Marker{addTo(e){return super.addTo(e)}}class vr extends m.Popup{addTo(e){return super.addTo(e)}}class gr extends m.Style{constructor(e,o={}){super(e,o)}}class yr extends m.CanvasSource{onAdd(e){super.onAdd(e)}}class fr extends m.GeoJSONSource{onAdd(e){super.onAdd(e)}}class Lr extends m.ImageSource{onAdd(e){super.onAdd(e)}}class Ar extends m.RasterTileSource{onAdd(e){super.onAdd(e)}}class wr extends m.RasterDEMTileSource{onAdd(e){super.onAdd(e)}}class br extends m.VectorTileSource{onAdd(e){super.onAdd(e)}}class Sr extends m.VideoSource{onAdd(e){super.onAdd(e)}}class Cr extends m.TerrainControl{onAdd(e){return super.onAdd(e)}}class Tr extends m.BoxZoomHandler{constructor(e,o){super(e,o)}}class Ir extends m.ScrollZoomHandler{constructor(e,o){super(e,o)}}class Rr extends m.CooperativeGesturesHandler{constructor(e,o){super(e,o)}}class Er extends m.KeyboardHandler{constructor(e){super(e)}}class xr extends m.TwoFingersTouchPitchHandler{constructor(e){super(e)}}class Pr extends m.MapWheelEvent{constructor(e,o,r){super(e,o,r)}}class Or extends m.MapTouchEvent{constructor(e,o,r){super(e,o,r)}}class _r extends m.MapMouseEvent{constructor(e,o,r,a={}){super(e,o,r,a)}}var Nr=Object.defineProperty,Ot=Object.getOwnPropertySymbols,Mr=Object.prototype.hasOwnProperty,$r=Object.prototype.propertyIsEnumerable,_t=(t,e,o)=>e in t?Nr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,ne=(t,e)=>{for(var o in e||(e={}))Mr.call(e,o)&&_t(t,o,e[o]);if(Ot)for(var o of Ot(e))$r.call(e,o)&&_t(t,o,e[o]);return t};function Le(t){if(typeof DOMParser<"u"){const e=new DOMParser().parseFromString(t,"application/xml");if(e.querySelector("parsererror"))throw new Error("The provided string is not valid XML");return e}else throw new Error("No XML parser found")}function Ue(t,e){if(!t.hasChildNodes())return!1;for(const o of Array.from(t.childNodes)){const r=o.nodeName;if(typeof r=="string"&&r.trim().toLowerCase()===e.toLowerCase())return!0}return!1}function He(t){if(typeof XMLSerializer<"u")return new XMLSerializer().serializeToString(t);throw new Error("No XML serializer found")}function je(t){if(typeof t=="string"&&(t=Le(t)),!Ue(t,"gpx"))throw new Error("The XML document is not valid GPX");const e=U(t,"trk"),o=U(t,"rte"),r=U(t,"wpt"),a={type:"FeatureCollection",features:[]};for(const l of Array.from(e)){const i=Br(l);i&&a.features.push(i)}for(const l of Array.from(o)){const i=Ur(l);i&&a.features.push(i)}for(const l of Array.from(r))a.features.push(Hr(l));return a}function De(t,e){var o;if(typeof t=="string"&&(t=Le(t)),!Ue(t,"kml"))throw new Error("The XML document is not valid KML");const r={type:"FeatureCollection",features:[]},a={},l={},i={},s=U(t,"Placemark"),n=U(t,"Style"),u=U(t,"StyleMap");for(const c of Array.from(n)){const p=kt(e!==void 0?e(c):He(c)).toString(16);a["#"+ie(c,"id")]=p,l[p]=c}for(const c of Array.from(u)){a["#"+ie(c,"id")]=kt(e!==void 0?e(c):He(c)).toString(16);const p=U(c,"Pair"),h={};for(const L of Array.from(p))h[(o=x(v(L,"key")))!=null?o:""]=x(v(L,"styleUrl"));i["#"+ie(c,"id")]=h}for(const c of Array.from(s))r.features=r.features.concat(zr(c,a,l,i));return r}function Nt(t){if(t===null)return["#000000",1];let e="",o=1;return t.substring(0,1)==="#"&&(t=t.substring(1)),(t.length===6||t.length===3)&&(e=t),t.length===8&&(o=parseInt(t.substring(0,2),16)/255,e="#"+t.substring(6,8)+t.substring(4,6)+t.substring(2,4)),[e??"#000000",o??1]}function kr(t){return zt(t.split(" "))}function Fr(t){var e;let o=U(t,"coord");const r=[],a=[];o.length===0&&(o=U(t,"gx:coord"));for(const i of Array.from(o))r.push(kr((e=x(i))!=null?e:""));const l=U(t,"when");for(const i of Array.from(l))a.push(x(i));return{coords:r,times:a}}function Ae(t){var e,o,r;const a=["Polygon","LineString","Point","Track","gx:Track"];let l,i,s,n,u;const c=[],p=[];if(v(t,"MultiGeometry")!==null)return Ae(v(t,"MultiGeometry"));if(v(t,"MultiTrack")!==null)return Ae(v(t,"MultiTrack"));if(v(t,"gx:MultiTrack")!==null)return Ae(v(t,"gx:MultiTrack"));for(s=0;s<a.length;s++)if(i=U(t,a[s]),i){for(n=0;n<i.length;n++)if(l=i[n],a[s]==="Point")c.push({type:"Point",coordinates:Bt((e=x(v(l,"coordinates")))!=null?e:"")});else if(a[s]==="LineString")c.push({type:"LineString",coordinates:Ut((o=x(v(l,"coordinates")))!=null?o:"")});else if(a[s]==="Polygon"){const h=U(l,"LinearRing"),L=[];for(u=0;u<h.length;u++)L.push(Ut((r=x(v(h[u],"coordinates")))!=null?r:""));c.push({type:"Polygon",coordinates:L})}else if(a[s]==="Track"||a[s]==="gx:Track"){const h=Fr(l);c.push({type:"LineString",coordinates:h.coords}),h.times.length&&p.push(h.times)}}return{geoms:c,coordTimes:p}}function zr(t,e,o,r){var a,l,i,s,n,u,c,p,h,L;const A=Ae(t),g={},k=x(v(t,"name")),M=x(v(t,"address")),R=x(v(t,"description")),z=v(t,"TimeSpan"),F=v(t,"TimeStamp"),_=v(t,"ExtendedData"),E=v(t,"visibility");let I,w=x(v(t,"styleUrl")),T=v(t,"LineStyle"),b=v(t,"PolyStyle");if(!A.geoms.length)return[];if(k&&(g.name=k),M&&(g.address=M),w){w[0]!=="#"&&(w="#"+w),g.styleUrl=w,e[w]&&(g.styleHash=e[w]),r[w]&&(g.styleMapHash=r[w],g.styleHash=e[(a=r[w].normal)!=null?a:""]);const y=o[(l=g.styleHash)!=null?l:""];if(y){T||(T=v(y,"LineStyle")),b||(b=v(y,"PolyStyle"));const S=v(y,"IconStyle");if(S){const O=v(S,"Icon");if(O){const N=x(v(O,"href"));N&&(g.icon=N)}}}}if(R&&(g.description=R),z){const y=x(v(z,"begin")),S=x(v(z,"end"));y&&S&&(g.timespan={begin:y,end:S})}if(F!==null&&(g.timestamp=(i=x(v(F,"when")))!=null?i:new Date().toISOString()),T!==null){const y=Nt(x(v(T,"color"))),S=y[0],O=y[1],N=parseFloat((s=x(v(T,"width")))!=null?s:"");S&&(g.stroke=S),isNaN(O)||(g["stroke-opacity"]=O),isNaN(N)||(g["stroke-width"]=N)}if(b){const y=Nt(x(v(b,"color"))),S=y[0],O=y[1],N=x(v(b,"fill")),$=x(v(b,"outline"));S&&(g.fill=S),isNaN(O)||(g["fill-opacity"]=O),N&&(g["fill-opacity"]=N==="1"?g["fill-opacity"]||1:0),$&&(g["stroke-opacity"]=$==="1"?g["stroke-opacity"]||1:0)}if(_){const y=U(_,"Data"),S=U(_,"SimpleData");for(I=0;I<y.length;I++)g[(n=y[I].getAttribute("name"))!=null?n:""]=(u=x(v(y[I],"value")))!=null?u:"";for(I=0;I<S.length;I++)g[(c=S[I].getAttribute("name"))!=null?c:""]=(p=x(S[I]))!=null?p:""}E!==null&&(g.visibility=(h=x(E))!=null?h:""),A.coordTimes.length!==0&&(g.coordTimes=A.coordTimes.length===1?A.coordTimes[0]:A.coordTimes);const B={type:"Feature",geometry:A.geoms.length===1?A.geoms[0]:{type:"GeometryCollection",geometries:A.geoms},properties:g};return ie(t,"id")&&(B.id=(L=ie(t,"id"))!=null?L:void 0),[B]}function Mt(t,e){const o=U(t,e),r=[],a=[];let l=[];const i=o.length;if(!(i<2)){for(let s=0;s<i;s++){const n=Ht(o[s]);r.push(n.coordinates),n.time&&a.push(n.time),(n.heartRate||l.length)&&(l.length===0&&(l=new Array(s).fill(null)),l.push(n.heartRate))}return{line:r,times:a,heartRates:l}}}function Br(t){const e=U(t,"trkseg"),o=[],r=[],a=[];let l;for(let s=0;s<e.length;s++)if(l=Mt(e[s],"trkpt"),l!==void 0&&(l.line&&o.push(l.line),l.times&&l.times.length&&r.push(l.times),a.length||l.heartRates&&l.heartRates.length)){if(!a.length)for(let n=0;n<s;n++)a.push(new Array(o[n].length).fill(null));l.heartRates&&l.heartRates.length?a.push(l.heartRates):a.push(new Array(l.line.length).fill(null))}if(o.length===0)return;const i=ne(ne({},Ge(t)),$t(v(t,"extensions")));return r.length!==0&&(i.coordTimes=o.length===1?r[0]:r),a.length!==0&&(i.heartRates=o.length===1?a[0]:a),o.length===1?{type:"Feature",properties:i,geometry:{type:"LineString",coordinates:o[0]}}:{type:"Feature",properties:i,geometry:{type:"MultiLineString",coordinates:o}}}function Ur(t){const e=Mt(t,"rtept");return e===void 0?void 0:{type:"Feature",properties:ne(ne({},Ge(t)),$t(v(t,"extensions"))),geometry:{type:"LineString",coordinates:e.line}}}function Hr(t){return{type:"Feature",properties:ne(ne({},Ge(t)),Ve(t,["sym"])),geometry:{type:"Point",coordinates:Ht(t).coordinates}}}function $t(t){var e,o;const r={};if(t){const a=v(t,"line");if(a){const l=x(v(a,"color")),i=parseFloat((e=x(v(a,"opacity")))!=null?e:"0"),s=parseFloat((o=x(v(a,"width")))!=null?o:"0");l&&(r.stroke=l),isNaN(i)||(r["stroke-opacity"]=i),isNaN(s)||(r["stroke-width"]=s*96/25.4)}}return r}function Ge(t){const e=Ve(t,["name","cmt","desc","type","time","keywords"]),o=U(t,"link");if(o.length!==0){e.links=[];for(const r of Array.from(o)){const a=ne({href:ie(r,"href")},Ve(r,["text","type"]));e.links.push(a)}}return e}function kt(t){let e=0;if(!t||!t.length)return e;for(let o=0;o<t.length;o++)e=(e<<5)-e+t.charCodeAt(o)|0;return e}function U(t,e){return t.getElementsByTagName(e)}function ie(t,e){return t.getAttribute(e)}function Ft(t,e){var o;return parseFloat((o=ie(t,e))!=null?o:"0")}function v(t,e){const o=U(t,e);return o.length?o[0]:null}function jr(t){return t.normalize&&t.normalize(),t}function zt(t){return t.map(parseFloat).map(e=>isNaN(e)?null:e)}function x(t){return t&&jr(t),t&&t.textContent}function Ve(t,e){var o;const r={};let a,l;for(l=0;l<e.length;l++)a=v(t,e[l]),a&&(r[e[l]]=(o=x(a))!=null?o:"");return r}function Bt(t){return zt(t.replace(/\s*/g,"").split(","))}function Ut(t){const e=t.replace(/^\s*|\s*$/g,"").split(/\s+/),o=[];for(const r of e)o.push(Bt(r));return o}function Ht(t){var e,o;const r=[Ft(t,"lon"),Ft(t,"lat")],a=v(t,"ele"),l=v(t,"gpxtpx:hr")||v(t,"hr"),i=v(t,"time");let s;return a&&(s=parseFloat((e=x(a))!=null?e:"0"),isNaN(s)||r.push(s)),{coordinates:r,time:i?x(i):null,heartRate:l!==null?parseFloat((o=x(l))!=null?o:"0"):null}}function jt(t){try{typeof t=="string"&&(t=Le(t))}catch{return null}try{return je(t)}catch{}try{return De(t)}catch{}return null}var Dr=Object.defineProperty,Gr=(t,e,o)=>e in t?Dr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,Dt=(t,e,o)=>(Gr(t,typeof e!="symbol"?e+"":e,o),o);function we(t){const e=t.toString(16);return e.length==1?"0"+e:e}function Vr(t){return"#"+we(t[0])+we(t[1])+we(t[2])+(t.length===4?we(t[3]):"")}class d extends Array{constructor(e={}){super(),Dt(this,"min",0),Dt(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 d({stops:e.map(o=>({value:o[0],color:o[1]}))})}setStops(e,o={clone:!0}){const r=o.clone?this.clone():this;r.length=0;let a=1/0,l=-1/0;for(let i=0;i<e.length;i+=1)a=Math.min(a,e[i].value),l=Math.max(l,e[i].value),r.push({value:e[i].value,color:e[i].color.slice()});return r.sort((i,s)=>i.value<s.value?-1:1),this.min=a,this.max=l,r}scale(e,o,r={clone:!0}){const a=r.clone,l=this[0].value,i=this.at(-1).value-l,s=o-e,n=[];for(let u=0;u<this.length;u+=1){const c=(this[u].value-l)/i*s+e;a?n.push({value:c,color:this[u].color.slice()}):this[u].value=c}return a?new d({stops:n}):this}at(e){return e<0?this[this.length+e]:this[e]}clone(){return new d({stops:this.getRawColorStops()})}getRawColorStops(){const e=[];for(let o=0;o<this.length;o+=1)e.push({value:this[o].value,color:this[o].color});return e}reverse(e={clone:!0}){const o=e.clone?this.clone():this;for(let r=0;r<~~(o.length/2);r+=1){const a=o[r].color;o[r].color=o.at(-(r+1)).color,o.at(-(r+1)).color=a}return o}getBounds(){return{min:this.min,max:this.max}}getColor(e,o={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(!o.smooth)return a.slice();const l=this[r].value,i=this[r+1].value,s=this[r+1].color,n=(i-e)/(i-l);return a.map((u,c)=>Math.round(u*n+s[c]*(1-n)))}return[0,0,0]}getColorHex(e,o={smooth:!0,withAlpha:!1}){return Vr(this.getColor(e,o))}getColorRelative(e,o={smooth:!0}){const r=this.getBounds();return this.getColor(r.min+e*(r.max-r.min),o)}getCanvasStrip(e={horizontal:!0,size:512,smooth:!0}){const o=document.createElement("canvas");o.width=e.horizontal?e.size:1,o.height=e.horizontal?1:e.size;const r=o.getContext("2d");if(!r)throw new Error("Canvs context is missing");const a=r.getImageData(0,0,o.width,o.height),l=a.data,i=e.size,s=this[0].value,n=(this.at(-1).value-s)/i;for(let u=0;u<i;u+=1){const c=this.getColor(s+u*n,{smooth:e.smooth});l[u*4]=c[0],l[u*4+1]=c[1],l[u*4+2]=c[2],l[u*4+3]=c.length>3?c[3]:255}return r.putImageData(a,0,0),o}resample(e,o=15){const r=this.getBounds(),a=this.scale(0,1),l=1/(o-1);let i;if(e==="ease-in-square")i=Array.from({length:o},(s,n)=>{const u=n*l,c=Math.pow(u,2),p=a.getColor(c);return{value:u,color:p}});else if(e==="ease-out-square")i=Array.from({length:o},(s,n)=>{const u=n*l,c=1-Math.pow(1-u,2),p=a.getColor(c);return{value:u,color:p}});else if(e==="ease-out-sqrt")i=Array.from({length:o},(s,n)=>{const u=n*l,c=Math.pow(u,.5),p=a.getColor(c);return{value:u,color:p}});else if(e==="ease-in-sqrt")i=Array.from({length:o},(s,n)=>{const u=n*l,c=1-Math.pow(1-u,.5),p=a.getColor(c);return{value:u,color:p}});else if(e==="ease-out-exp")i=Array.from({length:o},(s,n)=>{const u=n*l,c=1-Math.pow(2,-10*u),p=a.getColor(c);return{value:u,color:p}});else if(e==="ease-in-exp")i=Array.from({length:o},(s,n)=>{const u=n*l,c=Math.pow(2,10*u-10),p=a.getColor(c);return{value:u,color:p}});else throw new Error("Invalid ressampling method.");return new d({stops:i}).scale(r.min,r.max)}transparentStart(){const e=this.getRawColorStops();return e.unshift({value:e[0].value,color:e[0].color.slice()}),e[1].value+=.001,e.forEach(o=>{o.color.length===3&&o.color.push(255)}),e[0].color[3]=0,new d({stops:e})}hasTransparentStart(){return this[0].color.length===4&&this[0].color[3]===0}}const We={NULL:new d({stops:[{value:0,color:[0,0,0,0]},{value:1,color:[0,0,0,0]}]}),GRAY:new d({stops:[{value:0,color:[0,0,0]},{value:1,color:[255,255,255]}]}),JET:new d({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 d({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 d({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 d({stops:[{value:0,color:[255,0,255]},{value:1,color:[255,255,0]}]}),SUMMER:new d({stops:[{value:0,color:[0,128,102]},{value:1,color:[255,255,102]}]}),AUTOMN:new d({stops:[{value:0,color:[255,0,0]},{value:1,color:[255,255,0]}]}),WINTER:new d({stops:[{value:0,color:[0,0,255]},{value:1,color:[0,255,128]}]}),BONE:new d({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 d({stops:[{value:0,color:[0,0,0]},{value:.804,color:[255,160,102]},{value:1,color:[255,199,127]}]}),GREYS:new d({stops:[{value:0,color:[0,0,0]},{value:1,color:[255,255,255]}]}),YIGNBU:new d({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 d({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 d({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 d({stops:[{value:0,color:[0,0,255]},{value:1,color:[255,0,0]}]}),RDBU:new d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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]}]})},Gt=[["#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 Ze(){return Gt[~~(Math.random()*Gt.length)][~~(Math.random()*4)]}function be(){return`maptiler_source_${ct()}`}function Se(){return`maptiler_layer_${ct()}`}function Vt(t,e){if(e<=t[0].zoom)return t[0].value;if(e>=t[t.length-1].zoom)return t[t.length-1].value;for(let o=0;o<t.length-1;o+=1)if(e>=t[o].zoom&&e<t[o+1].zoom){const r=t[o+1].zoom-t[o].zoom,a=(e-t[o].zoom)/r;return a*t[o+1].value+(1-a)*t[o].value}return 0}function se(t){return["interpolate",["linear"],["zoom"],...t.map(e=>[e.zoom,e.value]).flat()]}function P(t){return["interpolate",["linear"],["zoom"],...t.map(e=>[e.zoom,e.value]).flat()]}function Wr(t,e){if(typeof e=="number"&&typeof t=="number")return 2*e+t;if(typeof e=="number"&&Array.isArray(t))return["interpolate",["linear"],["zoom"],...t.map(o=>[o.zoom,2*e+o.value]).flat()];if(typeof t=="number"&&Array.isArray(e))return["interpolate",["linear"],["zoom"],...e.map(o=>[o.zoom,2*o.value+t]).flat()];if(Array.isArray(t)&&Array.isArray(e)){const o=Array.from(new Set([...t.map(r=>r.zoom),...e.map(r=>r.zoom)])).sort((r,a)=>r<a?-1:1);return["interpolate",["linear"],["zoom"],...o.map(r=>[r,2*Vt(e,r)+Vt(t,r)]).flat()]}return 0}function Zr(t,e){return["interpolate",["linear"],["get",e],...t.map(o=>[o.propertyValue,o.value]).flat()]}function Wt(t){const e=t.trimStart(),o=`${e}${" ".repeat(t.length-e.length)}`,r=Array.from(o);if(!r.every(l=>l===" "||l==="_"))throw new Error("A dash pattern must be composed only of whitespace and underscore characters.");if(!(r.some(l=>l==="_")&&r.some(l=>l===" ")))throw new Error("A dash pattern must contain at least one underscore and one whitespace character");const a=[1];for(let l=1;l<r.length;l+=1){const i=r[l-1],s=r[l];i===s?a[a.length-1]+=1:a.push(1)}return a}function Zt(t,e){return["interpolate",["linear"],["get",e],...t.map(o=>[o.value,o.color]).flat()]}function Kt(t,e,o=!0){return o?["interpolate",["linear"],["zoom"],0,["interpolate",["linear"],["get",e],...t.map(r=>[r.value,r.pointRadius*.025]).flat()],2,["interpolate",["linear"],["get",e],...t.map(r=>[r.value,r.pointRadius*.05]).flat()],4,["interpolate",["linear"],["get",e],...t.map(r=>[r.value,r.pointRadius*.1]).flat()],8,["interpolate",["linear"],["get",e],...t.map(r=>[r.value,r.pointRadius*.25]).flat()],16,["interpolate",["linear"],["get",e],...t.map(r=>[r.value,r.pointRadius]).flat()]]:["interpolate",["linear"],["get",e],...t.map(r=>[r.value,r.pointRadius]).flat()]}function Kr(t,e,o=!0){return o?["interpolate",["linear"],["zoom"],0,["interpolate",["linear"],["get",e],...t.map(r=>[r.propertyValue,r.value*.025]).flat()],2,["interpolate",["linear"],["get",e],...t.map(r=>[r.propertyValue,r.value*.05]).flat()],4,["interpolate",["linear"],["get",e],...t.map(r=>[r.propertyValue,r.value*.1]).flat()],8,["interpolate",["linear"],["get",e],...t.map(r=>[r.propertyValue,r.value*.25]).flat()],16,["interpolate",["linear"],["get",e],...t.map(r=>[r.propertyValue,r.value]).flat()]]:["interpolate",["linear"],["get",e],...t.map(r=>[r.propertyValue,r.value]).flat()]}function Yt(t,e){return t.every(o=>o.color[3]===t[0].color[3])?t[0].color[3]?t[0].color[3]/255:1:["interpolate",["linear"],["get",e],...t.getRawColorStops().map(o=>{const r=o.value,a=o.color;return[r,a.length===4?a[3]/255:1]}).flat()]}function Yr(t,e=10){return["interpolate",["linear"],["heatmap-density"],...Array.from({length:e+1},(o,r)=>{const a=r/e;return[a,t.getColorHex(a)]}).flat()]}var qr=Object.defineProperty,Jr=Object.defineProperties,Xr=Object.getOwnPropertyDescriptors,qt=Object.getOwnPropertySymbols,Qr=Object.prototype.hasOwnProperty,ea=Object.prototype.propertyIsEnumerable,Jt=(t,e,o)=>e in t?qr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,ue=(t,e)=>{for(var o in e||(e={}))Qr.call(e,o)&&Jt(t,o,e[o]);if(qt)for(var o of qt(e))ea.call(e,o)&&Jt(t,o,e[o]);return t},ta=(t,e)=>Jr(t,Xr(e)),oa=(t,e,o)=>new Promise((r,a)=>{var l=n=>{try{s(o.next(n))}catch(u){a(u)}},i=n=>{try{s(o.throw(n))}catch(u){a(u)}},s=n=>n.done?r(n.value):Promise.resolve(n.value).then(l,i);s((o=o.apply(t,e)).next())});function ra(t,e){return oa(this,arguments,function*(o,r,a={}){var l,i,s;if(!r.sourceId&&!r.data)throw new Error("Creating a polyline layer requires an existing .sourceId or a valid .data property");let n=r.data;if(typeof n=="string"){if(ge(n))n=`https://api.maptiler.com/data/${r.data}/features.json?key=${H.apiKey}`;else if(((l=n.split(".").pop())==null?void 0:l.toLowerCase().trim())==="gpx"){const u=yield(yield fetch(n,a)).text();n=je(u)}else if(((i=n.split(".").pop())==null?void 0:i.toLowerCase().trim())==="kml"){const u=yield(yield fetch(n,a)).text();n=De(u)}else{const u=(s=Ho(n))!=null?s:jt(n);u&&(n=u)}if(!n)throw new Error("Polyline data was provided as string but is incompatible with valid formats.")}return aa(o,ta(ue({},r),{data:n}))})}function aa(t,e){var o,r,a,l,i,s,n,u,c,p,h,L,A,g,k,M,R,z,F,_;if(e.layerId&&t.getLayer(e.layerId))throw new Error(`A layer already exists with the layer id: ${e.layerId}`);const E=(o=e.sourceId)!=null?o:be(),I=(r=e.layerId)!=null?r:Se(),w={polylineLayerId:I,polylineOutlineLayerId:"",polylineSourceId:E};e.data&&!t.getSource(E)&&t.addSource(E,{type:"geojson",data:e.data});const T=(a=e.lineWidth)!=null?a:3,b=(l=e.lineColor)!=null?l:Ze(),B=(i=e.lineOpacity)!=null?i:1,y=(s=e.lineBlur)!=null?s:0,S=(n=e.lineGapWidth)!=null?n:0;let O=(u=e.lineDashArray)!=null?u:null;const N=(c=e.outlineWidth)!=null?c:1,$=(p=e.outlineColor)!=null?p:"#FFFFFF",j=(h=e.outlineOpacity)!=null?h:1,D=(L=e.outlineBlur)!=null?L:0;if(typeof O=="string"&&(O=Wt(O)),e.outline===!0){const J=`${I}_outline`;w.polylineOutlineLayerId=J,t.addLayer({id:J,type:"line",source:E,layout:{"line-join":(A=e.lineJoin)!=null?A:"round","line-cap":(g=e.lineCap)!=null?g:"round"},minzoom:(k=e.minzoom)!=null?k:0,maxzoom:(M=e.maxzoom)!=null?M:23,paint:{"line-opacity":typeof j=="number"?j:P(j),"line-color":typeof $=="string"?$:se($),"line-width":Wr(T,N),"line-blur":typeof D=="number"?D:P(D)}},e.beforeId)}return t.addLayer({id:I,type:"line",source:E,layout:{"line-join":(R=e.lineJoin)!=null?R:"round","line-cap":(z=e.lineCap)!=null?z:"round"},minzoom:(F=e.minzoom)!=null?F:0,maxzoom:(_=e.maxzoom)!=null?_:23,paint:ue({"line-opacity":typeof B=="number"?B:P(B),"line-color":typeof b=="string"?b:se(b),"line-width":typeof T=="number"?T:P(T),"line-blur":typeof y=="number"?y:P(y),"line-gap-width":typeof S=="number"?S:P(S)},O&&{"line-dasharray":O})},e.beforeId),w}function la(t,e){var o,r,a,l,i,s,n,u,c,p,h;if(e.layerId&&t.getLayer(e.layerId))throw new Error(`A layer already exists with the layer id: ${e.layerId}`);const L=(o=e.sourceId)!=null?o:be(),A=(r=e.layerId)!=null?r:Se(),g={polygonLayerId:A,polygonOutlineLayerId:e.outline?`${A}_outline`:"",polygonSourceId:L};if(e.data&&!t.getSource(L)){let b=e.data;typeof b=="string"&&ge(b)&&(b=`https://api.maptiler.com/data/${b}/features.json?key=${H.apiKey}`),t.addSource(L,{type:"geojson",data:b})}let k=(a=e.outlineDashArray)!=null?a:null;const M=(l=e.outlineWidth)!=null?l:1,R=(i=e.outlineColor)!=null?i:"#FFFFFF",z=(s=e.outlineOpacity)!=null?s:1,F=(n=e.outlineBlur)!=null?n:0,_=(u=e.fillColor)!=null?u:Ze(),E=(c=e.fillOpacity)!=null?c:1,I=(p=e.outlinePosition)!=null?p:"center",w=(h=e.pattern)!=null?h:null;typeof k=="string"&&(k=Wt(k));const T=(b=null)=>{var B,y,S,O,N,$;if(t.addLayer({id:A,type:"fill",source:L,minzoom:(B=e.minzoom)!=null?B:0,maxzoom:(y=e.maxzoom)!=null?y:23,paint:ue({"fill-color":typeof _=="string"?_:se(_),"fill-opacity":typeof E=="number"?E:P(E)},b&&{"fill-pattern":b})},e.beforeId),e.outline===!0){let j;I==="inside"?typeof M=="number"?j=.5*M:j=P(M.map(({zoom:D,value:J})=>({zoom:D,value:.5*J}))):I==="outside"?typeof M=="number"?j=-.5*M:j=P(M.map(D=>({zoom:D.zoom,value:-.5*D.value}))):j=0,t.addLayer({id:g.polygonOutlineLayerId,type:"line",source:L,layout:{"line-join":(S=e.outlineJoin)!=null?S:"round","line-cap":(O=e.outlineCap)!=null?O:"butt"},minzoom:(N=e.minzoom)!=null?N:0,maxzoom:($=e.maxzoom)!=null?$:23,paint:ue({"line-opacity":typeof z=="number"?z:P(z),"line-color":typeof R=="string"?R:se(R),"line-width":typeof M=="number"?M:P(M),"line-blur":typeof F=="number"?F:P(F),"line-offset":j},k&&{"line-dasharray":k})},e.beforeId)}};return w?t.hasImage(w)?T(w):t.loadImage(w).then(b=>{t.addImage(w,b.data),T(w)}).catch(b=>(console.error("Could not load the pattern image.",b.message),T())):T(),g}function na(t,e){var o,r,a,l,i,s,n,u,c,p,h,L,A,g,k,M;if(e.layerId&&t.getLayer(e.layerId))throw new Error(`A layer already exists with the layer id: ${e.layerId}`);const R=(o=e.minPointRadius)!=null?o:10,z=(r=e.maxPointRadius)!=null?r:50,F=(a=e.cluster)!=null?a:!1,_=20,E=Array.isArray(e.pointColor)?e.pointColor:We.TURBO.scale(10,e.cluster?1e4:1e3).resample("ease-out-square"),I=E.getBounds(),w=(l=e.sourceId)!=null?l:be(),T=(i=e.layerId)!=null?i:Se(),b=(s=e.showLabel)!=null?s:F,B=(n=e.alignOnViewport)!=null?n:!0,y=(u=e.outline)!=null?u:!1,S=(c=e.outlineOpacity)!=null?c:1,O=(p=e.outlineWidth)!=null?p:1,N=(h=e.outlineColor)!=null?h:"#FFFFFF";let $;const j=(L=e.zoomCompensation)!=null?L:!0,D=(A=e.minzoom)!=null?A:0,J=(g=e.maxzoom)!=null?g:23;typeof e.pointOpacity=="number"?$=e.pointOpacity:Array.isArray(e.pointOpacity)?$=P(e.pointOpacity):e.cluster?$=Yt(E,"point_count"):e.property?$=Yt(E,e.property):$=P([{zoom:D,value:0},{zoom:D+.25,value:1},{zoom:J-.25,value:1},{zoom:J,value:0}]);const re={pointLayerId:T,clusterLayerId:"",labelLayerId:"",pointSourceId:w};if(e.data&&!t.getSource(w)){let G=e.data;typeof G=="string"&&ge(G)&&(G=`https://api.maptiler.com/data/${G}/features.json?key=${H.apiKey}`),t.addSource(w,{type:"geojson",data:G,cluster:F})}if(F){re.clusterLayerId=`${T}_cluster`;const G=Array.from({length:_},(me,de)=>{const Ce=I.min+de*(I.max-I.min)/(_-1);return{value:Ce,pointRadius:R+(z-R)*Math.pow(de/(_-1),.5),color:E.getColorHex(Ce)}});t.addLayer({id:re.clusterLayerId,type:"circle",source:w,filter:["has","point_count"],paint:ue({"circle-color":typeof e.pointColor=="string"?e.pointColor:Zt(G,"point_count"),"circle-radius":typeof e.pointRadius=="number"?e.pointRadius:Array.isArray(e.pointRadius)?P(e.pointRadius):Kt(G,"point_count",!1),"circle-pitch-alignment":B?"viewport":"map","circle-pitch-scale":"map","circle-opacity":$},y&&{"circle-stroke-opacity":typeof S=="number"?S:P(S),"circle-stroke-width":typeof O=="number"?O:P(O),"circle-stroke-color":typeof N=="string"?N:se(N)}),minzoom:D,maxzoom:J},e.beforeId),t.addLayer({id:re.pointLayerId,type:"circle",source:w,filter:["!",["has","point_count"]],paint:ue({"circle-pitch-alignment":B?"viewport":"map","circle-pitch-scale":"map","circle-color":typeof e.pointColor=="string"?e.pointColor:E.getColorHex(E.getBounds().min),"circle-radius":typeof e.pointRadius=="number"?e.pointRadius:Array.isArray(e.pointRadius)?P(e.pointRadius):G[0].pointRadius*.75,"circle-opacity":$},y&&{"circle-stroke-opacity":typeof S=="number"?S:P(S),"circle-stroke-width":typeof O=="number"?O:P(O),"circle-stroke-color":typeof N=="string"?N:se(N)}),minzoom:D,maxzoom:J},e.beforeId)}else{let G=typeof e.pointColor=="string"?e.pointColor:Array.isArray(e.pointColor)?e.pointColor.getColorHex(e.pointColor.getBounds().min):Ze(),me=typeof e.pointRadius=="number"?j?P([{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)?P(e.pointRadius):j?P([{zoom:0,value:R*.05},{zoom:2,value:R*.1},{zoom:4,value:R*.2},{zoom:8,value:R*.5},{zoom:16,value:R*1}]):R;if(e.property&&Array.isArray(e.pointColor)){const de=Array.from({length:_},(Ce,Ye)=>{const qe=I.min+Ye*(I.max-I.min)/(_-1);return{value:qe,pointRadius:typeof e.pointRadius=="number"?e.pointRadius:R+(z-R)*Math.pow(Ye/(_-1),.5),color:typeof e.pointColor=="string"?e.pointColor:E.getColorHex(qe)}});G=Zt(de,e.property),me=Kt(de,e.property,j)}t.addLayer({id:re.pointLayerId,type:"circle",source:w,layout:{"circle-sort-key":e.property?["/",1,["get",e.property]]:0},paint:ue({"circle-pitch-alignment":B?"viewport":"map","circle-pitch-scale":"map","circle-color":G,"circle-opacity":$,"circle-radius":me},y&&{"circle-stroke-opacity":typeof S=="number"?S:P(S),"circle-stroke-width":typeof O=="number"?O:P(O),"circle-stroke-color":typeof N=="string"?N:se(N)}),minzoom:D,maxzoom:J},e.beforeId)}if(b!==!1&&(e.cluster||e.property)){re.labelLayerId=`${T}_label`;const G=(k=e.labelColor)!=null?k:"#fff",me=(M=e.labelSize)!=null?M:12;t.addLayer({id:re.labelLayerId,type:"symbol",source:w,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":me,"text-pitch-alignment":B?"viewport":"map","symbol-sort-key":["/",1,["get",e.cluster?"point_count":e.property]]},paint:{"text-color":G,"text-opacity":$},minzoom:D,maxzoom:J},e.beforeId)}return re}function ia(t,e){var o,r,a,l,i,s,n,u,c,p;if(e.layerId&&t.getLayer(e.layerId))throw new Error(`A layer already exists with the layer id: ${e.layerId}`);const h=(o=e.sourceId)!=null?o:be(),L=(r=e.layerId)!=null?r:Se(),A=(a=e.minzoom)!=null?a:0,g=(l=e.maxzoom)!=null?l:23,k=(i=e.zoomCompensation)!=null?i:!0,M=(s=e.opacity)!=null?s:[{zoom:A,value:0},{zoom:A+.25,value:1},{zoom:g-.25,value:1},{zoom:g,value:0}];let R=Array.isArray(e.colorRamp)?e.colorRamp:We.TURBO.transparentStart();const z=R.getBounds();(z.min!==0||z.max!==1)&&(R=R.scale(0,1)),R.hasTransparentStart()||(R=R.transparentStart());const F=(n=e.intensity)!=null?n:[{zoom:0,value:.01},{zoom:4,value:.2},{zoom:16,value:1}],_=(u=e.property)!=null?u:null,E=(c=e.weight)!=null?c:1;let I=1;_?typeof E=="number"?(I=E,typeof e.weight=="number"&&console.warn("The option `.property` is ignored when `.propertyValueWeights` is not of type `PropertyValueWeights`")):Array.isArray(E)?I=Zr(E,_):console.warn("The option `.property` is ignored when `.propertyValueWeights` is not of type `PropertyValueWeights`"):typeof E=="number"?I=E:Array.isArray(E)&&console.warn("The options `.propertyValueWeights` can only be used when `.property` is provided.");const w=[{zoom:0,value:50*.025},{zoom:2,value:50*.05},{zoom:4,value:50*.1},{zoom:8,value:50*.25},{zoom:16,value:50}],T=(p=e.radius)!=null?p:k?w:10;let b=1;typeof T=="number"?b=T:Array.isArray(T)&&"zoom"in T[0]?b=P(T):_&&Array.isArray(T)&&"propertyValue"in T[0]?b=Kr(T,_,k):!_&&Array.isArray(T)&&"propertyValue"in T[0]?(b=P(w),console.warn("The option `.radius` can only be property-driven if the option `.property` is provided.")):b=P(w);const B={heatmapLayerId:L,heatmapSourceId:h};if(e.data&&!t.getSource(h)){let y=e.data;typeof y=="string"&&ge(y)&&(y=`https://api.maptiler.com/data/${y}/features.json?key=${H.apiKey}`),t.addSource(h,{type:"geojson",data:y})}return t.addLayer({id:L,type:"heatmap",source:h,minzoom:A,maxzoom:g,paint:{"heatmap-weight":I,"heatmap-intensity":typeof F=="number"?F:P(F),"heatmap-color":Yr(R),"heatmap-radius":b,"heatmap-opacity":typeof M=="number"?M:P(M)}}),B}const sa={addPolyline:ra,addPolygon:la,addPoint:na,addHeatmap:ia},{setRTLTextPlugin:ua,getRTLTextPluginStatus:ca,LngLat:pa,LngLatBounds:ha,MercatorCoordinate:ma,Evented:da,AJAXError:va,prewarm:ga,clearPrewarmedResources:ya,addProtocol:Ke,removeProtocol:fa,Hash:La,Point:Aa,config:wa,EdgeInsets:ba,DragRotateHandler:Sa,DragPanHandler:Ca,TwoFingersTouchZoomRotateHandler:Ta,DoubleClickZoomHandler:Ia,TwoFingersTouchZoomHandler:Ra,TwoFingersTouchRotateHandler:Ea,getWorkerCount:xa,setWorkerCount:Pa,getMaxParallelImageRequests:Oa,setMaxParallelImageRequests:_a,getWorkerUrl:Na,setWorkerUrl:Ma,addSourceType:$a,importScriptInWorkers:ka}=m;function Fa(){return So.version}function za(){return m.getVersion()}const Ba=m.Map,Ua=m.Marker,Ha=m.Popup,ja=m.Style,Da=m.CanvasSource,Ga=m.GeoJSONSource,Va=m.ImageSource,Wa=m.RasterTileSource,Za=m.RasterDEMTileSource,Ka=m.VectorTileSource,Ya=m.VideoSource;m.NavigationControl,m.GeolocateControl,m.AttributionControl,m.LogoControl,m.ScaleControl,m.FullscreenControl,m.TerrainControl;const qa=m.BoxZoomHandler,Ja=m.ScrollZoomHandler,Xa=m.CooperativeGesturesHandler,Qa=m.KeyboardHandler,el=m.TwoFingersTouchPitchHandler,tl=m.MapWheelEvent,ol=m.MapTouchEvent,rl=m.MapMouseEvent;export{va as AJAXError,At as AttributionControl,Tr as BoxZoomHandler,qa as BoxZoomHandlerMLGL,yr as CanvasSource,Da as CanvasSourceMLGL,d as ColorRamp,We as ColorRampCollection,Rr as CooperativeGesturesHandler,Xa as CooperativeGesturesHandlerMLGL,Ia as DoubleClickZoomHandler,Ca as DragPanHandler,Sa as DragRotateHandler,ba as EdgeInsets,da as Evented,bt as FullscreenControl,fr as GeoJSONSource,Ga as GeoJSONSourceMLGL,vt as GeolocateControl,xt as GeolocationType,La as Hash,Lr as ImageSource,Va as ImageSourceMLGL,Er as KeyboardHandler,Qa as KeyboardHandlerMLGL,C as Language,ml as LanguageGeocoding,pa as LngLat,ha as LngLatBounds,et as LogoControl,Pt as Map,Ba as MapMLGL,_r as MapMouseEvent,rl as MapMouseEventMLGL,dl as MapStyle,vl as MapStyleVariant,Or as MapTouchEvent,ol as MapTouchEventMLGL,Pr as MapWheelEvent,tl as MapWheelEventMLGL,Lt as MaptilerGeolocateControl,Ee as MaptilerLogoControl,dt as MaptilerNavigationControl,ht as MaptilerTerrainControl,dr as Marker,Ua as MarkerMLGL,ma as MercatorCoordinate,mt as NavigationControl,Aa as Point,vr as Popup,Ha as PopupMLGL,wr as RasterDEMTileSource,Za as RasterDEMTileSourceMLGL,Ar as RasterTileSource,Wa as RasterTileSourceMLGL,gl as ReferenceMapStyle,wt as ScaleControl,Ir as ScrollZoomHandler,Ja as ScrollZoomHandlerMLGL,Qe as SdkConfig,yl as ServiceError,gr as Style,ja as StyleMLGL,Cr as TerrainControl,xr as TwoFingersTouchPitchHandler,el as TwoFingersTouchPitchHandlerMLGL,Ea as TwoFingersTouchRotateHandler,Ra as TwoFingersTouchZoomHandler,Ta as TwoFingersTouchZoomRotateHandler,br as VectorTileSource,Ka as VectorTileSourceMLGL,Sr as VideoSource,Ya as VideoSourceMLGL,Ke as addProtocol,$a as addSourceType,fl as bufferToPixelDataBrowser,Ll as circumferenceAtLatitude,ya as clearPrewarmedResources,H as config,wa as configMLGL,Al as coordinates,wl as data,bl as elevation,Sl as expandMapStyle,Cl as geocoding,Tl as geolocation,Il as getAutoLanguageGeocoding,Re as getBrowserLanguage,Rl as getBufferToPixelDataParser,za as getMapLibreVersion,Oa as getMaxParallelImageRequests,ca as getRTLTextPluginStatus,El as getTileCache,Fa as getVersion,xa as getWorkerCount,Na as getWorkerUrl,je as gpx,jt as gpxOrKml,Ue as hasChildNodeWithName,sa as helpers,ka as importScriptInWorkers,Ie as isLanguageSupported,De as kml,xl as mapStylePresetList,Pl as math,Ol as misc,ga as prewarm,fa as removeProtocol,_a as setMaxParallelImageRequests,ua as setRTLTextPlugin,Pa as setWorkerCount,Ma as setWorkerUrl,_l as staticMaps,Le as str2xml,Nl as styleToStyle,He as xml2str};
|
|
1
|
+
import h from"maplibre-gl";import{Base64 as Qt}from"js-base64";import eo from"events";import{config as Te,expandMapStyle as to,MapStyleVariant as oo,ReferenceMapStyle as ro,MapStyle as ao,mapStylePresetList as lo,geolocation as Je}from"@maptiler/client";import{LanguageGeocoding as ml,MapStyle as dl,MapStyleVariant as gl,ReferenceMapStyle as vl,ServiceError as yl,bufferToPixelDataBrowser as fl,circumferenceAtLatitude as Ll,coordinates as Al,data as wl,elevation as bl,expandMapStyle as Sl,geocoding as Cl,geolocation as Tl,getAutoLanguageGeocoding as Il,getBufferToPixelDataParser as Rl,getTileCache as El,mapStylePresetList as xl,math as Pl,misc as Ol,staticMaps as _l,styleToStyle as Nl}from"@maptiler/client";import{v4 as no}from"uuid";var io="@maptiler/sdk",so="2.0.2",uo="The Javascript & TypeScript map SDK tailored for MapTiler Cloud",co="dist/maptiler-sdk.mjs",po="dist/maptiler-sdk.d.ts",ho="dist/maptiler-sdk.css",mo="module",go={".":{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"}},vo=["maptiler","map","sdk","webmap","cloud","webGL","maplibre"],yo="https://docs.maptiler.com/sdk-js/",fo="BSD-3-Clause",Lo={type:"git",url:"https://github.com/maptiler/maptiler-sdk-js.git"},Ao={build:"rm -rf dist/* && NODE_ENV=production rollup -c",dev:"rm -rf dist/* && NODE_ENV=development rollup -c -w","format:fix":'prettier --write "src/**/*.{js,ts,tsx}"',format:'prettier -c "src/**/*.{js,ts,tsx}"',"lint:fix":'eslint --fix "src/**/*.{js,ts}"',lint:'eslint "src/**/*.{js,ts}"',doc:"rm -rf docs/* && typedoc --out docs && cp -r images docs/",prepare:"npm run format:fix && npm run lint:fix && npm run build && npm run test","test:dev":"vitest dev",test:"vitest run"},wo="MapTiler",bo={"@rollup/plugin-commonjs":"^24.1.0","@rollup/plugin-json":"^6.0.0","@rollup/plugin-node-resolve":"^15.0.2","@types/uuid":"^9.0.2","@types/xmldom":"^0.1.31","@typescript-eslint/eslint-plugin":"^6.9.0","@typescript-eslint/parser":"^6.9.0",eslint:"^8.52.0","eslint-config-prettier":"^9.0.0","eslint-plugin-prettier":"^5.0.1",prettier:"^3.0.3",rollup:"^3.20.6","rollup-plugin-copy-merge":"^1.0.0","rollup-plugin-dts":"^5.3.0","rollup-plugin-esbuild":"^5.0.0","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"},So={"@maptiler/client":"^1.8.1",events:"^3.3.0","js-base64":"^3.7.4","maplibre-gl":"^4.1.3",uuid:"^9.0.0"},Co={name:io,version:so,description:uo,module:co,types:po,style:ho,type:mo,exports:go,keywords:vo,homepage:yo,license:fo,repository:Lo,scripts:Ao,author:wo,devDependencies:bo,dependencies:So};const S={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"},To=new Set(Object.values(S));function Ie(t){return To.has(t)}const Io=new Set(Object.values(S));function Re(){if(typeof navigator>"u")return`name:${Intl.DateTimeFormat().resolvedOptions().locale.split("-")[0]}`;const t=Array.from(new Set(navigator.languages.map(e=>`name:${e.split("-")[0]}`))).filter(e=>Io.has(e));return t.length?t[0]:S.LOCAL}const V={maptilerLogoURL:"https://api.maptiler.com/resources/logo.svg",maptilerURL:"https://www.maptiler.com/",maptilerApiHost:"api.maptiler.com",rtlPluginURL:"https://cdn.maptiler.com/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.min.js",primaryLanguage:S.STYLE,secondaryLanguage:S.LOCAL,terrainSourceURL:"https://api.maptiler.com/tiles/terrain-rgb-v2/tiles.json",terrainSourceId:"maptiler-terrain"};Object.freeze(V);var Ro=Object.defineProperty,Eo=(t,e,o)=>e in t?Ro(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,ce=(t,e,o)=>(Eo(t,typeof e!="symbol"?e+"":e,o),o);const Xe=no();let Qe=class extends eo{constructor(){super(),ce(this,"primaryLanguage",V.primaryLanguage),ce(this,"secondaryLanguage"),ce(this,"session",!0),ce(this,"caching",!0),ce(this,"_unit","metric"),ce(this,"_apiKey","")}set unit(e){this._unit=e,this.emit("unit",e)}get unit(){return this._unit}set apiKey(e){this._apiKey=e,Te.apiKey=e,this.emit("apiKey",e)}get apiKey(){return this._apiKey}set fetch(e){Te.fetch=e}get fetch(){return Te.fetch}};const j=new Qe;class et extends h.LogoControl{onAdd(e){return super.onAdd(e)}}var xo=Object.defineProperty,Po=(t,e,o)=>e in t?xo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,tt=(t,e,o)=>(Po(t,typeof e!="symbol"?e+"":e,o),o);class Ee extends et{constructor(e={}){var o,r;super(e),tt(this,"logoURL",""),tt(this,"linkURL",""),this.logoURL=(o=e.logoURL)!=null?o:V.maptilerLogoURL,this.linkURL=(r=e.linkURL)!=null?r:V.maptilerURL}onAdd(e){var o;this._map=e,this._compact=(o=this.options.compact)!=null?o:!1,this._container=window.document.createElement("div"),this._container.className="maplibregl-ctrl";const r=window.document.createElement("a");return r.style.backgroundRepeat="no-repeat",r.style.cursor="pointer",r.style.display="block",r.style.height="23px",r.style.margin="0 0 -4px -4px",r.style.overflow="hidden",r.style.width="88px",r.style.backgroundImage=`url(${this.logoURL})`,r.style.backgroundSize="100px 30px",r.style.width="100px",r.style.height="30px",r.target="_blank",r.rel="noopener",r.href=this.linkURL,r.setAttribute("aria-label","MapTiler logo"),r.setAttribute("rel","noopener"),this._container.appendChild(r),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}}var ge=(t,e,o)=>new Promise((r,a)=>{var l=n=>{try{s(o.next(n))}catch(u){a(u)}},i=n=>{try{s(o.throw(n))}catch(u){a(u)}},s=n=>n.done?r(n.value):Promise.resolve(n.value).then(l,i);s((o=o.apply(t,e)).next())});const xe="localcache_source",Pe="localcache",Oo="maptiler_sdk",_o=1e3,No=100;function Mo(t,e){if(j.caching&&j.session&&t.host===V.maptilerApiHost){if(e=="Source"&&t.href.includes("tiles.json"))return t.href.replace("https://",`${xe}://`);if(e=="Tile"||e=="Glyphs")return t.href.replace("https://",`${Pe}://`)}return t.href}let Oe;function ot(){return ge(this,null,function*(){return Oe||(Oe=yield caches.open(Oo)),Oe})}let rt=0;function $o(){return ge(this,null,function*(){const t=yield ot(),e=yield t.keys(),o=e.slice(0,Math.max(e.length-_o,0));for(const r of o)t.delete(r)})}function ko(){Ke(xe,(t,e)=>ge(this,null,function*(){if(!t.url)throw new Error("");t.url=t.url.replace(`${xe}://`,"https://");const o=t;o.signal=e.signal;const r=yield fetch(t.url,o),a=yield 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")}})),Ke(Pe,(t,e)=>ge(this,null,function*(){if(!t.url)throw new Error("");t.url=t.url.replace(`${Pe}://`,"https://");const o=new URL(t.url),r=new URL(o);r.searchParams.delete("mtsid"),r.searchParams.delete("key");const a=r.toString(),l=new URL(o);l.searchParams.delete("last-modified");const i=l.toString(),s=c=>ge(this,null,function*(){return{data:yield c.arrayBuffer(),cacheControl:c.headers.get("Cache-Control"),expires:c.headers.get("Expires")}}),n=yield ot(),u=yield n.match(a);if(u)return s(u);{const c=t;c.signal=e.signal;const p=yield fetch(i,c);return p.status>=200&&p.status<300&&(n.put(a,p.clone()).catch(()=>{}),++rt>No&&($o(),rt=0)),s(p)}}))}var Fo=Object.defineProperty,at=Object.getOwnPropertySymbols,zo=Object.prototype.hasOwnProperty,Bo=Object.prototype.propertyIsEnumerable,lt=(t,e,o)=>e in t?Fo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,nt=(t,e)=>{for(var o in e||(e={}))zo.call(e,o)&<(t,o,e[o]);if(at)for(var o of at(e))Bo.call(e,o)&<(t,o,e[o]);return t};function Uo(){h.getRTLTextPluginStatus()==="unavailable"&&h.setRTLTextPlugin(V.rtlPluginURL,t=>{t&&console.error(t)},!0)}function Ho(t,e){t.forEach(o=>{typeof e[o]=="function"&&(e[o]=e[o].bind(e))})}function oe(t,e,o){const r=window.document.createElement(t);return e!==void 0&&(r.className=e),o&&o.appendChild(r),r}function it(t){t.parentNode&&t.parentNode.removeChild(t)}function st(t,e){let o=null;try{o=new URL(t)}catch{return{url:t}}return o.host===V.maptilerApiHost&&(o.searchParams.has("key")||o.searchParams.append("key",j.apiKey),j.session&&o.searchParams.append("mtsid",Xe)),{url:Mo(o,e)}}function ut(t){return function(e,o){var r;if(t!==void 0){const a=t(e,o),l=st((r=a?.url)!=null?r:"",o);return nt(nt({},a),l)}else return st(e,o)}}function ct(){return Math.random().toString(36).substring(2)}function ve(t){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(t)}function jo(t){try{return JSON.parse(t)}catch{}return null}function pt(t){return t?typeof t=="string"||t instanceof String?!t.startsWith("http")&&t.toLowerCase().includes(".json")?t:to(t):t instanceof oo?t.getExpandedStyleURL():t instanceof ro?t.getDefaultVariant().getExpandedStyleURL():t:ao[lo[0].referenceStyleID].getDefaultVariant().getExpandedStyleURL()}var Do=Object.defineProperty,Go=(t,e,o)=>e in t?Do(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,_e=(t,e,o)=>(Go(t,typeof e!="symbol"?e+"":e,o),o);class ht{constructor(){_e(this,"_map"),_e(this,"_container"),_e(this,"_terrainButton"),Ho(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(e){return this._map=e,this._container=oe("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=oe("button","maplibregl-ctrl-terrain",this._container),oe("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(){it(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 mt extends h.NavigationControl{onAdd(e){return super.onAdd(e)}}var Vo=Object.defineProperty,Wo=(t,e,o)=>e in t?Vo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,Zo=(t,e,o)=>(Wo(t,typeof e!="symbol"?e+"":e,o),o);class dt extends mt{constructor(){super({showCompass:!0,showZoom:!0,visualizePitch:!0}),Zo(this,"_rotateCompassArrow",()=>{const e=this.options.visualizePitch?`scale(${Math.min(1.5,1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5))}) rotateX(${Math.min(70,this._map.transform.pitch)}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=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,o){const r=super._createButton(e,o);return r.clickFunction=o,r}}class gt extends h.GeolocateControl{onAdd(e){return super.onAdd(e)}}var Ko=Object.defineProperty,Yo=Object.defineProperties,qo=Object.getOwnPropertyDescriptors,vt=Object.getOwnPropertySymbols,Jo=Object.prototype.hasOwnProperty,Xo=Object.prototype.propertyIsEnumerable,Ne=(t,e,o)=>e in t?Ko(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,Qo=(t,e)=>{for(var o in e||(e={}))Jo.call(e,o)&&Ne(t,o,e[o]);if(vt)for(var o of vt(e))Xo.call(e,o)&&Ne(t,o,e[o]);return t},er=(t,e)=>Yo(t,qo(e)),ye=(t,e,o)=>(Ne(t,typeof e!="symbol"?e+"":e,o),o);const yt=h.Marker,ft=h.LngLat,tr=h.LngLatBounds;class Lt extends gt{constructor(){super(...arguments),ye(this,"lastUpdatedCenter",new ft(0,0)),ye(this,"_updateCamera",e=>{var o,r,a;const l=new ft(e.coords.longitude,e.coords.latitude),i=e.coords.accuracy,s=this._map.getBearing(),n=er(Qo({bearing:s},this.options.fitBoundsOptions),{linear:!0}),u=this._map.getZoom();u>((a=(r=(o=this.options)==null?void 0:o.fitBoundsOptions)==null?void 0:r.maxZoom)!=null?a:30)&&(n.zoom=u),this._map.fitBounds(tr.fromLngLat(l,i),n,{geolocateSource:!0});let c=!1;const p=()=>{c=!0};this._map.once("click",p),this._map.once("dblclick",p),this._map.once("dragstart",p),this._map.once("mousedown",p),this._map.once("touchstart",p),this._map.once("wheel",p),this._map.once("moveend",()=>{this._map.off("click",p),this._map.off("dblclick",p),this._map.off("dragstart",p),this._map.off("mousedown",p),this._map.off("touchstart",p),this._map.off("wheel",p),!c&&(this.lastUpdatedCenter=this._map.getCenter())})}),ye(this,"_setupUI",e=>{if(this.lastUpdatedCenter=this._map.getCenter(),this._container.addEventListener("contextmenu",o=>o.preventDefault()),this._geolocateButton=oe("button","maplibregl-ctrl-geolocate",this._container),oe("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",e===!1){const o=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=o,this._geolocateButton.setAttribute("aria-label",o)}else{const o=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=o,this._geolocateButton.setAttribute("aria-label",o)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=oe("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new yt({element:this._dotElement}),this._circleElement=oe("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new yt({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",o=>{const r=o.originalEvent&&o.originalEvent.type==="resize",a=this.lastUpdatedCenter.distanceTo(this._map.getCenter());!o.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")))})}),ye(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],o=this._map.project(e),r=this._map.unproject([o.x,o.y]),a=this._map.unproject([o.x+20,o.y]),l=r.distanceTo(a)/20,i=Math.ceil(2*this._accuracy/l);this._circleElement.style.width=`${i}px`,this._circleElement.style.height=`${i}px`}}class At extends h.AttributionControl{onAdd(e){return super.onAdd(e)}}class wt extends h.ScaleControl{onAdd(e){return super.onAdd(e)}}class bt extends h.FullscreenControl{onAdd(e){return super.onAdd(e)}}var or=Object.defineProperty,rr=Object.defineProperties,ar=Object.getOwnPropertyDescriptors,St=Object.getOwnPropertySymbols,lr=Object.prototype.hasOwnProperty,nr=Object.prototype.propertyIsEnumerable,Me=(t,e,o)=>e in t?or(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,pe=(t,e)=>{for(var o in e||(e={}))lr.call(e,o)&&Me(t,o,e[o]);if(St)for(var o of St(e))nr.call(e,o)&&Me(t,o,e[o]);return t},Ct=(t,e)=>rr(t,ar(e)),ir=(t,e,o)=>(Me(t,typeof e!="symbol"?e+"":e,o),o),$e=(t,e,o)=>{if(!e.has(t))throw TypeError("Cannot "+o)},L=(t,e,o)=>($e(t,e,"read from private field"),o?o.call(t):e.get(t)),X=(t,e,o)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,o)},he=(t,e,o,r)=>($e(t,e,"write to private field"),r?r.call(t,o):e.set(t,o),o),W=(t,e,o)=>($e(t,e,"access private method"),o),Z,Q,ae,Tt,le,Y,fe,ke,It,K,q,Fe,Rt;let ze=class{constructor(e,o){X(this,ke),X(this,K),X(this,Fe),X(this,Z,void 0),ir(this,"map"),X(this,Q,void 0),X(this,ae,void 0),X(this,Tt,void 0),X(this,le,void 0),X(this,Y,!1),X(this,fe,void 0);var r;e.style!==void 0&&he(this,Y,!0),he(this,Z,Ct(pe(Ct(pe({zoomAdjust:-4,position:"top-right"},o),{forceNoAttributionControl:!0,attributionControl:!1,navigationControl:!1,geolocateControl:!1,maptilerLogo:!1,minimap:!1,hash:!1,pitchAdjust:!1}),e),{containerStyle:pe({border:"1px solid #000",width:"400px",height:"300px"},(r=e.containerStyle)!=null?r:{})})),e.lockZoom!==void 0&&(L(this,Z).minZoom=e.lockZoom,L(this,Z).maxZoom=e.lockZoom)}setStyle(e,o){L(this,Y)||this.map.setStyle(e,o),W(this,K,q).call(this)}addLayer(e,o){return L(this,Y)||this.map.addLayer(e,o),W(this,K,q).call(this),this.map}moveLayer(e,o){return L(this,Y)||this.map.moveLayer(e,o),W(this,K,q).call(this),this.map}removeLayer(e){return L(this,Y)||this.map.removeLayer(e),W(this,K,q).call(this),this}setLayerZoomRange(e,o,r){return L(this,Y)||this.map.setLayerZoomRange(e,o,r),W(this,K,q).call(this),this}setFilter(e,o,r){return L(this,Y)||this.map.setFilter(e,o,r),W(this,K,q).call(this),this}setPaintProperty(e,o,r,a){return L(this,Y)||this.map.setPaintProperty(e,o,r,a),W(this,K,q).call(this),this}setLayoutProperty(e,o,r,a){return L(this,Y)||this.map.setLayoutProperty(e,o,r,a),W(this,K,q).call(this),this}setGlyphs(e,o){return L(this,Y)||this.map.setGlyphs(e,o),W(this,K,q).call(this),this}onAdd(e){he(this,Q,e),he(this,ae,oe("div","maplibregl-ctrl maplibregl-ctrl-group"));for(const[o,r]of Object.entries(L(this,Z).containerStyle))L(this,ae).style.setProperty(o,r);return L(this,Z).container=L(this,ae),L(this,Z).zoom=e.getZoom()+L(this,Z).zoomAdjust,this.map=new Ot(L(this,Z)),this.map.once("style.load",()=>{this.map.resize()}),this.map.once("load",()=>{W(this,ke,It).call(this,L(this,Z).parentRect),he(this,fe,W(this,Fe,Rt).call(this))}),L(this,ae)}onRemove(){var e;(e=L(this,fe))==null||e.call(this),it(L(this,ae))}};Z=new WeakMap,Q=new WeakMap,ae=new WeakMap,Tt=new WeakMap,le=new WeakMap,Y=new WeakMap,fe=new WeakMap,ke=new WeakSet,It=function(t){t===void 0||t.linePaint===void 0&&t.fillPaint===void 0||(he(this,le,{type:"Feature",properties:{name:"parentRect"},geometry:{type:"Polygon",coordinates:[[[],[],[],[],[]]]}}),this.map.addSource("parentRect",{type:"geojson",data:L(this,le)}),(t.lineLayout!==void 0||t.linePaint!==void 0)&&this.map.addLayer({id:"parentRectOutline",type:"line",source:"parentRect",layout:pe({},t.lineLayout),paint:pe({"line-color":"#FFF","line-width":1,"line-opacity":.85},t.linePaint)}),t.fillPaint!==void 0&&this.map.addLayer({id:"parentRectFill",type:"fill",source:"parentRect",layout:{},paint:pe({"fill-color":"#08F","fill-opacity":.135},t.fillPaint)}),W(this,K,q).call(this))},K=new WeakSet,q=function(){if(L(this,le)===void 0)return;const{devicePixelRatio:t}=window,e=L(this,Q).getCanvas(),o=e.width/t,r=e.height/t,a=L(this,Q).unproject.bind(L(this,Q)),l=a([0,0]),i=a([o,0]),s=a([0,r]),n=a([o,r]);L(this,le).geometry.coordinates=[[s.toArray(),n.toArray(),i.toArray(),l.toArray(),s.toArray()]],this.map.getSource("parentRect").setData(L(this,le))},Fe=new WeakSet,Rt=function(){const{pitchAdjust:t}=L(this,Z),e=()=>{l("parent")},o=()=>{l("minimap")},r=()=>{L(this,Q).on("move",e),this.map.on("move",o)},a=()=>{L(this,Q).off("move",e),this.map.off("move",o)},l=i=>{var s;a();const n=i==="parent"?L(this,Q):this.map,u=i==="parent"?this.map:L(this,Q),c=n.getCenter(),p=n.getZoom()+((s=L(this,Z).zoomAdjust)!=null?s:-4)*(i==="parent"?1:-1),v=n.getBearing(),m=n.getPitch();u.jumpTo({center:c,zoom:p,bearing:v,pitch:t?m:0}),W(this,K,q).call(this),r()};return r(),()=>{a()}};var sr=Object.defineProperty,ur=Object.defineProperties,cr=Object.getOwnPropertyDescriptors,Et=Object.getOwnPropertySymbols,pr=Object.prototype.hasOwnProperty,hr=Object.prototype.propertyIsEnumerable,Be=(t,e,o)=>e in t?sr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,xt=(t,e)=>{for(var o in e||(e={}))pr.call(e,o)&&Be(t,o,e[o]);if(Et)for(var o of Et(e))hr.call(e,o)&&Be(t,o,e[o]);return t},mr=(t,e)=>ur(t,cr(e)),ee=(t,e,o)=>(Be(t,typeof e!="symbol"?e+"":e,o),o),te=(t,e,o)=>new Promise((r,a)=>{var l=n=>{try{s(o.next(n))}catch(u){a(u)}},i=n=>{try{s(o.throw(n))}catch(u){a(u)}},s=n=>n.done?r(n.value):Promise.resolve(n.value).then(l,i);s((o=o.apply(t,e)).next())});const Pt={POINT:"POINT",COUNTRY:"COUNTRY"};class Ot extends h.Map{constructor(e){var o,r,a,l;e.apiKey&&(j.apiKey=e.apiKey);const i=pt(e.style),s=location.hash;j.apiKey||console.warn("MapTiler Cloud API key is not set. Visit https://maptiler.com and try Cloud for free!"),super(xt(mr(xt({},e),{style:i,maplibreLogo:!1,transformRequest:ut(e.transformRequest)}),(o=e.attributionControl)!=null?o:{attributionControl:!1})),ee(this,"isTerrainEnabled",!1),ee(this,"terrainExaggeration",1),ee(this,"primaryLanguage"),ee(this,"terrainGrowing",!1),ee(this,"terrainFlattening",!1),ee(this,"minimap"),ee(this,"forceLanguageUpdate"),ee(this,"languageAlwaysBeenStyle"),ee(this,"isReady",!1),j.caching&&ko(),this.primaryLanguage=(r=e.language)!=null?r:j.primaryLanguage,this.forceLanguageUpdate=!(this.primaryLanguage===S.STYLE||this.primaryLanguage===S.STYLE_LOCK),this.languageAlwaysBeenStyle=this.primaryLanguage===S.STYLE,this.terrainExaggeration=(a=e.terrainExaggeration)!=null?a:this.terrainExaggeration,this.once("styledata",()=>te(this,null,function*(){if(!e.geolocate||e.center||e.hash&&s)return;try{if(e.geolocate===Pt.COUNTRY){yield this.fitToIpBounds();return}}catch(m){console.warn(m.message)}let v;try{yield this.centerOnIpPoint(e.zoom),v=this.getCameraHash()}catch(m){console.warn(m.message)}(yield navigator.permissions.query({name:"geolocation"})).state==="granted"&&navigator.geolocation.getCurrentPosition(m=>{v===this.getCameraHash()&&(this.terrain?this.easeTo({center:[m.coords.longitude,m.coords.latitude],zoom:e.zoom||12,duration:2e3}):this.once("terrain",()=>{this.easeTo({center:[m.coords.longitude,m.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",()=>te(this,null,function*(){Uo()})),this.once("load",()=>te(this,null,function*(){let v={logo:null};try{const m=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")),T=new URL(m[0].url);T.searchParams.has("key")||T.searchParams.append("key",j.apiKey),v=yield(yield fetch(T.href)).json()}catch{}if(e.forceNoAttributionControl!==!0)if("logo"in v&&v.logo){const m=v.logo;this.addControl(new Ee({logoURL:m}),e.logoPosition),e.attributionControl||this.addControl(new At({customAttribution:e.customAttribution}))}else e.maptilerLogo&&this.addControl(new Ee,e.logoPosition);if(e.scaleControl){const m=e.scaleControl===!0||e.scaleControl===void 0?"bottom-right":e.scaleControl,T=new wt({unit:j.unit});this.addControl(T,m),j.on("unit",g=>{T.setUnit(g)})}if(e.navigationControl!==!1){const m=e.navigationControl===!0||e.navigationControl===void 0?"top-right":e.navigationControl;this.addControl(new dt,m)}if(e.geolocateControl!==!1){const m=e.geolocateControl===!0||e.geolocateControl===void 0?"top-right":e.geolocateControl;this.addControl(new Lt({positionOptions:{enableHighAccuracy:!0,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!0,showAccuracyCircle:!0,showUserLocation:!0}),m)}if(e.terrainControl){const m=e.terrainControl===!0||e.terrainControl===void 0?"top-right":e.terrainControl;this.addControl(new ht,m)}if(e.fullscreenControl){const m=e.fullscreenControl===!0||e.fullscreenControl===void 0?"top-right":e.fullscreenControl;this.addControl(new bt({}),m)}this.isReady=!0,this.fire("ready",{target:this})}));let n=!1,u=!1,c;this.once("ready",()=>{n=!0,u&&this.fire("loadWithTerrain",c)}),this.once("style.load",()=>{var v;const{minimap:m}=e;if(typeof m=="object"){const{zoom:T,center:g,style:k,language:M,apiKey:R,maptilerLogo:z,antialias:F,refreshExpiredTiles:_,maxBounds:E,scrollZoom:I,minZoom:A,maxZoom:C,boxZoom:w,locale:B,fadeDuration:f,crossSourceCollisions:b,clickTolerance:O,bounds:N,fitBoundsOptions:$,pixelRatio:D,validateStyle:H}=e;this.minimap=new ze(m,{zoom:T,center:g,style:k,language:M,apiKey:R,container:"null",maptilerLogo:z,antialias:F,refreshExpiredTiles:_,maxBounds:E,scrollZoom:I,minZoom:A,maxZoom:C,boxZoom:w,locale:B,fadeDuration:f,crossSourceCollisions:b,clickTolerance:O,bounds:N,fitBoundsOptions:$,pixelRatio:D,validateStyle:H}),this.addControl(this.minimap,(v=m.position)!=null?v:"bottom-left")}else m===!0?(this.minimap=new ze({},e),this.addControl(this.minimap,"bottom-left")):m!==void 0&&m!==!1&&(this.minimap=new ze({},e),this.addControl(this.minimap,m))});const p=v=>{v.terrain&&(u=!0,c={type:"loadWithTerrain",target:this,terrain:v.terrain},this.off("terrain",p),n&&this.fire("loadWithTerrain",c))};this.on("terrain",p),e.terrain&&this.enableTerrain((l=e.terrainExaggeration)!=null?l:this.terrainExaggeration)}onLoadAsync(){return te(this,null,function*(){return new Promise(e=>{if(this.loaded())return e(this);this.once("load",()=>{e(this)})})})}onReadyAsync(){return te(this,null,function*(){return new Promise(e=>{if(this.isReady)return e(this);this.once("ready",()=>{e(this)})})})}onLoadWithTerrainAsync(){return te(this,null,function*(){return new Promise(e=>{if(this.isReady&&this.terrain)return e(this);this.once("loadWithTerrain",()=>{e(this)})})})}setStyle(e,o){var r;return(r=this.minimap)==null||r.setStyle(e),this.forceLanguageUpdate=!0,this.once("idle",()=>{this.forceLanguageUpdate=!1}),super.setStyle(pt(e),o)}addLayer(e,o){var r;return(r=this.minimap)==null||r.addLayer(e,o),super.addLayer(e,o)}moveLayer(e,o){var r;return(r=this.minimap)==null||r.moveLayer(e,o),super.moveLayer(e,o)}removeLayer(e){var o;return(o=this.minimap)==null||o.removeLayer(e),super.removeLayer(e)}setLayerZoomRange(e,o,r){var a;return(a=this.minimap)==null||a.setLayerZoomRange(e,o,r),super.setLayerZoomRange(e,o,r)}setFilter(e,o,r){var a;return(a=this.minimap)==null||a.setFilter(e,o,r),super.setFilter(e,o,r)}setPaintProperty(e,o,r,a){var l;return(l=this.minimap)==null||l.setPaintProperty(e,o,r,a),super.setPaintProperty(e,o,r,a)}setLayoutProperty(e,o,r,a){var l;return(l=this.minimap)==null||l.setLayoutProperty(e,o,r,a),super.setLayoutProperty(e,o,r,a)}setGlyphs(e,o){var r;return(r=this.minimap)==null||r.setGlyphs(e,o),super.setGlyphs(e,o)}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){var o,r;(r=(o=this.minimap)==null?void 0:o.map)==null||r.setLanguage(e),this.onStyleReady(()=>{this.setPrimaryLanguage(e)})}setPrimaryLanguage(e){const o=this.getStyleLanguage();if(!(e===S.STYLE&&(o===S.AUTO||o===S.VISITOR))&&(e!==S.STYLE&&(this.languageAlwaysBeenStyle=!1),this.languageAlwaysBeenStyle||this.primaryLanguage===e&&!this.forceLanguageUpdate))return;if(!Ie(e)){console.warn(`The language "${e}" is not supported.`);return}if(this.primaryLanguage===S.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===S.STYLE){if(!o){console.warn("The style has no default languages.");return}if(!Ie(o)){console.warn("The language defined in the style is not valid.");return}r=o}let a=S.LOCAL,l=`{${a}}`;r==S.VISITOR?(a=Re(),l=["case",["all",["has",a],["has",S.LOCAL]],["case",["==",["get",a],["get",S.LOCAL]],["get",S.LOCAL],["format",["get",a],{"font-scale":.8},`
|
|
2
|
+
`,["get",S.LOCAL],{"font-scale":1.1}]],["get",S.LOCAL]]):r==S.VISITOR_ENGLISH?(a=S.ENGLISH,l=["case",["all",["has",a],["has",S.LOCAL]],["case",["==",["get",a],["get",S.LOCAL]],["get",S.LOCAL],["format",["get",a],{"font-scale":.8},`
|
|
3
|
+
`,["get",S.LOCAL],{"font-scale":1.1}]],["get",S.LOCAL]]):r===S.AUTO?(a=Re(),l=["case",["has",a],["get",a],["get",S.LOCAL]]):r===S.LOCAL?(a=S.LOCAL,l=`{${a}}`):(a=r,l=["case",["has",a],["get",a],["get",S.LOCAL]]);const{layers:i}=this.getStyle();for(const s of i){if(s.type!=="symbol")continue;const n=s,u=this.getSource(n.source);if(!u||!("url"in u&&typeof u.url=="string")||new URL(u.url).host!==V.maptilerApiHost)continue;const{id:c,layout:p}=n;if(!p||!("text-field"in p))continue;const v=this.getLayoutProperty(c,"text-field");typeof v=="string"&&(v.toLowerCase().includes("ref")||v.toLowerCase().includes("housenumber"))||this.setLayoutProperty(c,"text-field",l)}}getPrimaryLanguage(){return this.primaryLanguage}getTerrainExaggeration(){return this.terrainExaggeration}hasTerrain(){return this.isTerrainEnabled}growTerrain(e,o=1e3){if(!this.terrain)return;const r=performance.now(),a=this.terrain.exaggeration,l=e-a,i=()=>{if(!this.terrain||this.terrainFlattening)return;const s=(performance.now()-r)/o;if(s<.99){const n=1-Math.pow(1-s,4),u=a+n*l;this.terrain.exaggeration=u,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 o=a=>te(this,null,function*(){!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",o),this.growTerrain(e))}),r=()=>{this.isTerrainEnabled=!0,this.terrainExaggeration=e,this.on("data",o),this.addSource(V.terrainSourceId,{type:"raster-dem",url:V.terrainSourceURL}),this.setTerrain({source:V.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(V.terrainSourceId)||r()})}disableTerrain(){if(!this.terrain)return;this.isTerrainEnabled=!1;const e=1*1e3,o=performance.now(),r=this.terrain.exaggeration,a=()=>{if(!this.terrain||this.terrainGrowing)return;const l=(performance.now()-o)/e;if(l<.99){const i=Math.pow(1-l,4),s=r*i;this.terrain.exaggeration=s,requestAnimationFrame(a)}else this.terrain.exaggeration=0,this.terrainGrowing=!1,this.terrainFlattening=!1,this.setTerrain(),this.getSource(V.terrainSourceId)&&this.removeSource(V.terrainSourceId);this.triggerRepaint()};this.terrainGrowing=!1,this.terrainFlattening=!0,requestAnimationFrame(a)}setTerrainExaggeration(e,o=!0){!o&&this.terrain?(this.terrainExaggeration=e,this.terrain.exaggeration=e,this.triggerRepaint()):this.enableTerrain(e)}onStyleReady(e){this.isStyleLoaded()?e():this.once("styledata",()=>{e()})}fitToIpBounds(){return te(this,null,function*(){const e=yield Je.info();this.fitBounds(e.country_bounds,{duration:0,padding:100})})}centerOnIpPoint(e){return te(this,null,function*(){var o,r;const a=yield Je.info();this.jumpTo({center:[(o=a?.longitude)!=null?o:0,(r=a?.latitude)!=null?r:0],zoom:e||11})})}getCameraHash(){const e=new Float32Array(5),o=this.getCenter();return e[0]=o.lng,e[1]=o.lat,e[2]=this.getZoom(),e[3]=this.getPitch(),e[4]=this.getBearing(),Qt.fromUint8Array(new Uint8Array(e.buffer))}getSdkConfig(){return j}getMaptilerSessionId(){return Xe}setTransformRequest(e){return super.setTransformRequest(ut(e)),this}}class dr extends h.Marker{addTo(e){return super.addTo(e)}}class gr extends h.Popup{addTo(e){return super.addTo(e)}}class vr extends h.Style{constructor(e,o={}){super(e,o)}}class yr extends h.CanvasSource{onAdd(e){super.onAdd(e)}}class fr extends h.GeoJSONSource{onAdd(e){super.onAdd(e)}}class Lr extends h.ImageSource{onAdd(e){super.onAdd(e)}}class Ar extends h.RasterTileSource{onAdd(e){super.onAdd(e)}}class wr extends h.RasterDEMTileSource{onAdd(e){super.onAdd(e)}}class br extends h.VectorTileSource{onAdd(e){super.onAdd(e)}}class Sr extends h.VideoSource{onAdd(e){super.onAdd(e)}}class Cr extends h.TerrainControl{onAdd(e){return super.onAdd(e)}}class Tr extends h.BoxZoomHandler{constructor(e,o){super(e,o)}}class Ir extends h.ScrollZoomHandler{constructor(e,o){super(e,o)}}class Rr extends h.CooperativeGesturesHandler{constructor(e,o){super(e,o)}}class Er extends h.KeyboardHandler{constructor(e){super(e)}}class xr extends h.TwoFingersTouchPitchHandler{constructor(e){super(e)}}class Pr extends h.MapWheelEvent{constructor(e,o,r){super(e,o,r)}}class Or extends h.MapTouchEvent{constructor(e,o,r){super(e,o,r)}}class _r extends h.MapMouseEvent{constructor(e,o,r,a={}){super(e,o,r,a)}}var Nr=Object.defineProperty,_t=Object.getOwnPropertySymbols,Mr=Object.prototype.hasOwnProperty,$r=Object.prototype.propertyIsEnumerable,Nt=(t,e,o)=>e in t?Nr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,ne=(t,e)=>{for(var o in e||(e={}))Mr.call(e,o)&&Nt(t,o,e[o]);if(_t)for(var o of _t(e))$r.call(e,o)&&Nt(t,o,e[o]);return t};function Le(t){if(typeof DOMParser<"u"){const e=new DOMParser().parseFromString(t,"application/xml");if(e.querySelector("parsererror"))throw new Error("The provided string is not valid XML");return e}else throw new Error("No XML parser found")}function Ue(t,e){if(!t.hasChildNodes())return!1;for(const o of Array.from(t.childNodes)){const r=o.nodeName;if(typeof r=="string"&&r.trim().toLowerCase()===e.toLowerCase())return!0}return!1}function He(t){if(typeof XMLSerializer<"u")return new XMLSerializer().serializeToString(t);throw new Error("No XML serializer found")}function je(t){if(typeof t=="string"&&(t=Le(t)),!Ue(t,"gpx"))throw new Error("The XML document is not valid GPX");const e=U(t,"trk"),o=U(t,"rte"),r=U(t,"wpt"),a={type:"FeatureCollection",features:[]};for(const l of Array.from(e)){const i=Br(l);i&&a.features.push(i)}for(const l of Array.from(o)){const i=Ur(l);i&&a.features.push(i)}for(const l of Array.from(r))a.features.push(Hr(l));return a}function De(t,e){var o;if(typeof t=="string"&&(t=Le(t)),!Ue(t,"kml"))throw new Error("The XML document is not valid KML");const r={type:"FeatureCollection",features:[]},a={},l={},i={},s=U(t,"Placemark"),n=U(t,"Style"),u=U(t,"StyleMap");for(const c of Array.from(n)){const p=Ft(e!==void 0?e(c):He(c)).toString(16);a["#"+ie(c,"id")]=p,l[p]=c}for(const c of Array.from(u)){a["#"+ie(c,"id")]=Ft(e!==void 0?e(c):He(c)).toString(16);const p=U(c,"Pair"),v={};for(const m of Array.from(p))v[(o=x(y(m,"key")))!=null?o:""]=x(y(m,"styleUrl"));i["#"+ie(c,"id")]=v}for(const c of Array.from(s))r.features=r.features.concat(zr(c,a,l,i));return r}function Mt(t){if(t===null)return["#000000",1];let e="",o=1;return t.substring(0,1)==="#"&&(t=t.substring(1)),(t.length===6||t.length===3)&&(e=t),t.length===8&&(o=parseInt(t.substring(0,2),16)/255,e="#"+t.substring(6,8)+t.substring(4,6)+t.substring(2,4)),[e??"#000000",o??1]}function kr(t){return Bt(t.split(" "))}function Fr(t){var e;let o=U(t,"coord");const r=[],a=[];o.length===0&&(o=U(t,"gx:coord"));for(const i of Array.from(o))r.push(kr((e=x(i))!=null?e:""));const l=U(t,"when");for(const i of Array.from(l))a.push(x(i));return{coords:r,times:a}}function Ae(t){var e,o,r;const a=["Polygon","LineString","Point","Track","gx:Track"];let l,i,s,n,u;const c=[],p=[];if(y(t,"MultiGeometry")!==null)return Ae(y(t,"MultiGeometry"));if(y(t,"MultiTrack")!==null)return Ae(y(t,"MultiTrack"));if(y(t,"gx:MultiTrack")!==null)return Ae(y(t,"gx:MultiTrack"));for(s=0;s<a.length;s++)if(i=U(t,a[s]),i){for(n=0;n<i.length;n++)if(l=i[n],a[s]==="Point")c.push({type:"Point",coordinates:Ut((e=x(y(l,"coordinates")))!=null?e:"")});else if(a[s]==="LineString")c.push({type:"LineString",coordinates:Ht((o=x(y(l,"coordinates")))!=null?o:"")});else if(a[s]==="Polygon"){const v=U(l,"LinearRing"),m=[];for(u=0;u<v.length;u++)m.push(Ht((r=x(y(v[u],"coordinates")))!=null?r:""));c.push({type:"Polygon",coordinates:m})}else if(a[s]==="Track"||a[s]==="gx:Track"){const v=Fr(l);c.push({type:"LineString",coordinates:v.coords}),v.times.length&&p.push(v.times)}}return{geoms:c,coordTimes:p}}function zr(t,e,o,r){var a,l,i,s,n,u,c,p,v,m;const T=Ae(t),g={},k=x(y(t,"name")),M=x(y(t,"address")),R=x(y(t,"description")),z=y(t,"TimeSpan"),F=y(t,"TimeStamp"),_=y(t,"ExtendedData"),E=y(t,"visibility");let I,A=x(y(t,"styleUrl")),C=y(t,"LineStyle"),w=y(t,"PolyStyle");if(!T.geoms.length)return[];if(k&&(g.name=k),M&&(g.address=M),A){A[0]!=="#"&&(A="#"+A),g.styleUrl=A,e[A]&&(g.styleHash=e[A]),r[A]&&(g.styleMapHash=r[A],g.styleHash=e[(a=r[A].normal)!=null?a:""]);const f=o[(l=g.styleHash)!=null?l:""];if(f){C||(C=y(f,"LineStyle")),w||(w=y(f,"PolyStyle"));const b=y(f,"IconStyle");if(b){const O=y(b,"Icon");if(O){const N=x(y(O,"href"));N&&(g.icon=N)}}}}if(R&&(g.description=R),z){const f=x(y(z,"begin")),b=x(y(z,"end"));f&&b&&(g.timespan={begin:f,end:b})}if(F!==null&&(g.timestamp=(i=x(y(F,"when")))!=null?i:new Date().toISOString()),C!==null){const f=Mt(x(y(C,"color"))),b=f[0],O=f[1],N=parseFloat((s=x(y(C,"width")))!=null?s:"");b&&(g.stroke=b),isNaN(O)||(g["stroke-opacity"]=O),isNaN(N)||(g["stroke-width"]=N)}if(w){const f=Mt(x(y(w,"color"))),b=f[0],O=f[1],N=x(y(w,"fill")),$=x(y(w,"outline"));b&&(g.fill=b),isNaN(O)||(g["fill-opacity"]=O),N&&(g["fill-opacity"]=N==="1"?g["fill-opacity"]||1:0),$&&(g["stroke-opacity"]=$==="1"?g["stroke-opacity"]||1:0)}if(_){const f=U(_,"Data"),b=U(_,"SimpleData");for(I=0;I<f.length;I++)g[(n=f[I].getAttribute("name"))!=null?n:""]=(u=x(y(f[I],"value")))!=null?u:"";for(I=0;I<b.length;I++)g[(c=b[I].getAttribute("name"))!=null?c:""]=(p=x(b[I]))!=null?p:""}E!==null&&(g.visibility=(v=x(E))!=null?v:""),T.coordTimes.length!==0&&(g.coordTimes=T.coordTimes.length===1?T.coordTimes[0]:T.coordTimes);const B={type:"Feature",geometry:T.geoms.length===1?T.geoms[0]:{type:"GeometryCollection",geometries:T.geoms},properties:g};return ie(t,"id")&&(B.id=(m=ie(t,"id"))!=null?m:void 0),[B]}function $t(t,e){const o=U(t,e),r=[],a=[];let l=[];const i=o.length;if(!(i<2)){for(let s=0;s<i;s++){const n=jt(o[s]);r.push(n.coordinates),n.time&&a.push(n.time),(n.heartRate||l.length)&&(l.length===0&&(l=new Array(s).fill(null)),l.push(n.heartRate))}return{line:r,times:a,heartRates:l}}}function Br(t){const e=U(t,"trkseg"),o=[],r=[],a=[];let l;for(let s=0;s<e.length;s++)if(l=$t(e[s],"trkpt"),l!==void 0&&(l.line&&o.push(l.line),l.times&&l.times.length&&r.push(l.times),a.length||l.heartRates&&l.heartRates.length)){if(!a.length)for(let n=0;n<s;n++)a.push(new Array(o[n].length).fill(null));l.heartRates&&l.heartRates.length?a.push(l.heartRates):a.push(new Array(l.line.length).fill(null))}if(o.length===0)return;const i=ne(ne({},Ge(t)),kt(y(t,"extensions")));return r.length!==0&&(i.coordTimes=o.length===1?r[0]:r),a.length!==0&&(i.heartRates=o.length===1?a[0]:a),o.length===1?{type:"Feature",properties:i,geometry:{type:"LineString",coordinates:o[0]}}:{type:"Feature",properties:i,geometry:{type:"MultiLineString",coordinates:o}}}function Ur(t){const e=$t(t,"rtept");return e===void 0?void 0:{type:"Feature",properties:ne(ne({},Ge(t)),kt(y(t,"extensions"))),geometry:{type:"LineString",coordinates:e.line}}}function Hr(t){return{type:"Feature",properties:ne(ne({},Ge(t)),Ve(t,["sym"])),geometry:{type:"Point",coordinates:jt(t).coordinates}}}function kt(t){var e,o;const r={};if(t){const a=y(t,"line");if(a){const l=x(y(a,"color")),i=parseFloat((e=x(y(a,"opacity")))!=null?e:"0"),s=parseFloat((o=x(y(a,"width")))!=null?o:"0");l&&(r.stroke=l),isNaN(i)||(r["stroke-opacity"]=i),isNaN(s)||(r["stroke-width"]=s*96/25.4)}}return r}function Ge(t){const e=Ve(t,["name","cmt","desc","type","time","keywords"]),o=U(t,"link");if(o.length!==0){e.links=[];for(const r of Array.from(o)){const a=ne({href:ie(r,"href")},Ve(r,["text","type"]));e.links.push(a)}}return e}function Ft(t){let e=0;if(!t||!t.length)return e;for(let o=0;o<t.length;o++)e=(e<<5)-e+t.charCodeAt(o)|0;return e}function U(t,e){return t.getElementsByTagName(e)}function ie(t,e){return t.getAttribute(e)}function zt(t,e){var o;return parseFloat((o=ie(t,e))!=null?o:"0")}function y(t,e){const o=U(t,e);return o.length?o[0]:null}function jr(t){return t.normalize&&t.normalize(),t}function Bt(t){return t.map(parseFloat).map(e=>isNaN(e)?null:e)}function x(t){return t&&jr(t),t&&t.textContent}function Ve(t,e){var o;const r={};let a,l;for(l=0;l<e.length;l++)a=y(t,e[l]),a&&(r[e[l]]=(o=x(a))!=null?o:"");return r}function Ut(t){return Bt(t.replace(/\s*/g,"").split(","))}function Ht(t){const e=t.replace(/^\s*|\s*$/g,"").split(/\s+/),o=[];for(const r of e)o.push(Ut(r));return o}function jt(t){var e,o;const r=[zt(t,"lon"),zt(t,"lat")],a=y(t,"ele"),l=y(t,"gpxtpx:hr")||y(t,"hr"),i=y(t,"time");let s;return a&&(s=parseFloat((e=x(a))!=null?e:"0"),isNaN(s)||r.push(s)),{coordinates:r,time:i?x(i):null,heartRate:l!==null?parseFloat((o=x(l))!=null?o:"0"):null}}function Dt(t){try{typeof t=="string"&&(t=Le(t))}catch{return null}try{return je(t)}catch{}try{return De(t)}catch{}return null}var Dr=Object.defineProperty,Gr=(t,e,o)=>e in t?Dr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,Gt=(t,e,o)=>(Gr(t,typeof e!="symbol"?e+"":e,o),o);function we(t){const e=t.toString(16);return e.length==1?"0"+e:e}function Vr(t){return"#"+we(t[0])+we(t[1])+we(t[2])+(t.length===4?we(t[3]):"")}class d extends Array{constructor(e={}){super(),Gt(this,"min",0),Gt(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 d({stops:e.map(o=>({value:o[0],color:o[1]}))})}setStops(e,o={clone:!0}){const r=o.clone?this.clone():this;r.length=0;let a=1/0,l=-1/0;for(let i=0;i<e.length;i+=1)a=Math.min(a,e[i].value),l=Math.max(l,e[i].value),r.push({value:e[i].value,color:e[i].color.slice()});return r.sort((i,s)=>i.value<s.value?-1:1),this.min=a,this.max=l,r}scale(e,o,r={clone:!0}){const a=r.clone,l=this[0].value,i=this.at(-1).value-l,s=o-e,n=[];for(let u=0;u<this.length;u+=1){const c=(this[u].value-l)/i*s+e;a?n.push({value:c,color:this[u].color.slice()}):this[u].value=c}return a?new d({stops:n}):this}at(e){return e<0?this[this.length+e]:this[e]}clone(){return new d({stops:this.getRawColorStops()})}getRawColorStops(){const e=[];for(let o=0;o<this.length;o+=1)e.push({value:this[o].value,color:this[o].color});return e}reverse(e={clone:!0}){const o=e.clone?this.clone():this;for(let r=0;r<~~(o.length/2);r+=1){const a=o[r].color;o[r].color=o.at(-(r+1)).color,o.at(-(r+1)).color=a}return o}getBounds(){return{min:this.min,max:this.max}}getColor(e,o={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(!o.smooth)return a.slice();const l=this[r].value,i=this[r+1].value,s=this[r+1].color,n=(i-e)/(i-l);return a.map((u,c)=>Math.round(u*n+s[c]*(1-n)))}return[0,0,0]}getColorHex(e,o={smooth:!0,withAlpha:!1}){return Vr(this.getColor(e,o))}getColorRelative(e,o={smooth:!0}){const r=this.getBounds();return this.getColor(r.min+e*(r.max-r.min),o)}getCanvasStrip(e={horizontal:!0,size:512,smooth:!0}){const o=document.createElement("canvas");o.width=e.horizontal?e.size:1,o.height=e.horizontal?1:e.size;const r=o.getContext("2d");if(!r)throw new Error("Canvs context is missing");const a=r.getImageData(0,0,o.width,o.height),l=a.data,i=e.size,s=this[0].value,n=(this.at(-1).value-s)/i;for(let u=0;u<i;u+=1){const c=this.getColor(s+u*n,{smooth:e.smooth});l[u*4]=c[0],l[u*4+1]=c[1],l[u*4+2]=c[2],l[u*4+3]=c.length>3?c[3]:255}return r.putImageData(a,0,0),o}resample(e,o=15){const r=this.getBounds(),a=this.scale(0,1),l=1/(o-1);let i;if(e==="ease-in-square")i=Array.from({length:o},(s,n)=>{const u=n*l,c=Math.pow(u,2),p=a.getColor(c);return{value:u,color:p}});else if(e==="ease-out-square")i=Array.from({length:o},(s,n)=>{const u=n*l,c=1-Math.pow(1-u,2),p=a.getColor(c);return{value:u,color:p}});else if(e==="ease-out-sqrt")i=Array.from({length:o},(s,n)=>{const u=n*l,c=Math.pow(u,.5),p=a.getColor(c);return{value:u,color:p}});else if(e==="ease-in-sqrt")i=Array.from({length:o},(s,n)=>{const u=n*l,c=1-Math.pow(1-u,.5),p=a.getColor(c);return{value:u,color:p}});else if(e==="ease-out-exp")i=Array.from({length:o},(s,n)=>{const u=n*l,c=1-Math.pow(2,-10*u),p=a.getColor(c);return{value:u,color:p}});else if(e==="ease-in-exp")i=Array.from({length:o},(s,n)=>{const u=n*l,c=Math.pow(2,10*u-10),p=a.getColor(c);return{value:u,color:p}});else throw new Error("Invalid ressampling method.");return new d({stops:i}).scale(r.min,r.max)}transparentStart(){const e=this.getRawColorStops();return e.unshift({value:e[0].value,color:e[0].color.slice()}),e[1].value+=.001,e.forEach(o=>{o.color.length===3&&o.color.push(255)}),e[0].color[3]=0,new d({stops:e})}hasTransparentStart(){return this[0].color.length===4&&this[0].color[3]===0}}const We={NULL:new d({stops:[{value:0,color:[0,0,0,0]},{value:1,color:[0,0,0,0]}]}),GRAY:new d({stops:[{value:0,color:[0,0,0]},{value:1,color:[255,255,255]}]}),JET:new d({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 d({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 d({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 d({stops:[{value:0,color:[255,0,255]},{value:1,color:[255,255,0]}]}),SUMMER:new d({stops:[{value:0,color:[0,128,102]},{value:1,color:[255,255,102]}]}),AUTOMN:new d({stops:[{value:0,color:[255,0,0]},{value:1,color:[255,255,0]}]}),WINTER:new d({stops:[{value:0,color:[0,0,255]},{value:1,color:[0,255,128]}]}),BONE:new d({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 d({stops:[{value:0,color:[0,0,0]},{value:.804,color:[255,160,102]},{value:1,color:[255,199,127]}]}),GREYS:new d({stops:[{value:0,color:[0,0,0]},{value:1,color:[255,255,255]}]}),YIGNBU:new d({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 d({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 d({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 d({stops:[{value:0,color:[0,0,255]},{value:1,color:[255,0,0]}]}),RDBU:new d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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]}]})},Vt=[["#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 Ze(){return Vt[~~(Math.random()*Vt.length)][~~(Math.random()*4)]}function be(){return`maptiler_source_${ct()}`}function Se(){return`maptiler_layer_${ct()}`}function Wt(t,e){if(e<=t[0].zoom)return t[0].value;if(e>=t[t.length-1].zoom)return t[t.length-1].value;for(let o=0;o<t.length-1;o+=1)if(e>=t[o].zoom&&e<t[o+1].zoom){const r=t[o+1].zoom-t[o].zoom,a=(e-t[o].zoom)/r;return a*t[o+1].value+(1-a)*t[o].value}return 0}function se(t){return["interpolate",["linear"],["zoom"],...t.map(e=>[e.zoom,e.value]).flat()]}function P(t){return["interpolate",["linear"],["zoom"],...t.map(e=>[e.zoom,e.value]).flat()]}function Wr(t,e){if(typeof e=="number"&&typeof t=="number")return 2*e+t;if(typeof e=="number"&&Array.isArray(t))return["interpolate",["linear"],["zoom"],...t.map(o=>[o.zoom,2*e+o.value]).flat()];if(typeof t=="number"&&Array.isArray(e))return["interpolate",["linear"],["zoom"],...e.map(o=>[o.zoom,2*o.value+t]).flat()];if(Array.isArray(t)&&Array.isArray(e)){const o=Array.from(new Set([...t.map(r=>r.zoom),...e.map(r=>r.zoom)])).sort((r,a)=>r<a?-1:1);return["interpolate",["linear"],["zoom"],...o.map(r=>[r,2*Wt(e,r)+Wt(t,r)]).flat()]}return 0}function Zr(t,e){return["interpolate",["linear"],["get",e],...t.map(o=>[o.propertyValue,o.value]).flat()]}function Zt(t){const e=t.trimStart(),o=`${e}${" ".repeat(t.length-e.length)}`,r=Array.from(o);if(!r.every(l=>l===" "||l==="_"))throw new Error("A dash pattern must be composed only of whitespace and underscore characters.");if(!(r.some(l=>l==="_")&&r.some(l=>l===" ")))throw new Error("A dash pattern must contain at least one underscore and one whitespace character");const a=[1];for(let l=1;l<r.length;l+=1){const i=r[l-1],s=r[l];i===s?a[a.length-1]+=1:a.push(1)}return a}function Kt(t,e){return["interpolate",["linear"],["get",e],...t.map(o=>[o.value,o.color]).flat()]}function Yt(t,e,o=!0){return o?["interpolate",["linear"],["zoom"],0,["interpolate",["linear"],["get",e],...t.map(r=>[r.value,r.pointRadius*.025]).flat()],2,["interpolate",["linear"],["get",e],...t.map(r=>[r.value,r.pointRadius*.05]).flat()],4,["interpolate",["linear"],["get",e],...t.map(r=>[r.value,r.pointRadius*.1]).flat()],8,["interpolate",["linear"],["get",e],...t.map(r=>[r.value,r.pointRadius*.25]).flat()],16,["interpolate",["linear"],["get",e],...t.map(r=>[r.value,r.pointRadius]).flat()]]:["interpolate",["linear"],["get",e],...t.map(r=>[r.value,r.pointRadius]).flat()]}function Kr(t,e,o=!0){return o?["interpolate",["linear"],["zoom"],0,["interpolate",["linear"],["get",e],...t.map(r=>[r.propertyValue,r.value*.025]).flat()],2,["interpolate",["linear"],["get",e],...t.map(r=>[r.propertyValue,r.value*.05]).flat()],4,["interpolate",["linear"],["get",e],...t.map(r=>[r.propertyValue,r.value*.1]).flat()],8,["interpolate",["linear"],["get",e],...t.map(r=>[r.propertyValue,r.value*.25]).flat()],16,["interpolate",["linear"],["get",e],...t.map(r=>[r.propertyValue,r.value]).flat()]]:["interpolate",["linear"],["get",e],...t.map(r=>[r.propertyValue,r.value]).flat()]}function qt(t,e){return t.every(o=>o.color[3]===t[0].color[3])?t[0].color[3]?t[0].color[3]/255:1:["interpolate",["linear"],["get",e],...t.getRawColorStops().map(o=>{const r=o.value,a=o.color;return[r,a.length===4?a[3]/255:1]}).flat()]}function Yr(t,e=10){return["interpolate",["linear"],["heatmap-density"],...Array.from({length:e+1},(o,r)=>{const a=r/e;return[a,t.getColorHex(a)]}).flat()]}var qr=Object.defineProperty,Jr=Object.defineProperties,Xr=Object.getOwnPropertyDescriptors,Jt=Object.getOwnPropertySymbols,Qr=Object.prototype.hasOwnProperty,ea=Object.prototype.propertyIsEnumerable,Xt=(t,e,o)=>e in t?qr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,ue=(t,e)=>{for(var o in e||(e={}))Qr.call(e,o)&&Xt(t,o,e[o]);if(Jt)for(var o of Jt(e))ea.call(e,o)&&Xt(t,o,e[o]);return t},ta=(t,e)=>Jr(t,Xr(e)),oa=(t,e,o)=>new Promise((r,a)=>{var l=n=>{try{s(o.next(n))}catch(u){a(u)}},i=n=>{try{s(o.throw(n))}catch(u){a(u)}},s=n=>n.done?r(n.value):Promise.resolve(n.value).then(l,i);s((o=o.apply(t,e)).next())});function ra(t,e){return oa(this,arguments,function*(o,r,a={}){var l,i,s;if(!r.sourceId&&!r.data)throw new Error("Creating a polyline layer requires an existing .sourceId or a valid .data property");let n=r.data;if(typeof n=="string"){if(ve(n))n=`https://api.maptiler.com/data/${r.data}/features.json?key=${j.apiKey}`;else if(((l=n.split(".").pop())==null?void 0:l.toLowerCase().trim())==="gpx"){const u=yield(yield fetch(n,a)).text();n=je(u)}else if(((i=n.split(".").pop())==null?void 0:i.toLowerCase().trim())==="kml"){const u=yield(yield fetch(n,a)).text();n=De(u)}else{const u=(s=jo(n))!=null?s:Dt(n);u&&(n=u)}if(!n)throw new Error("Polyline data was provided as string but is incompatible with valid formats.")}return aa(o,ta(ue({},r),{data:n}))})}function aa(t,e){var o,r,a,l,i,s,n,u,c,p,v,m,T,g,k,M,R,z,F,_;if(e.layerId&&t.getLayer(e.layerId))throw new Error(`A layer already exists with the layer id: ${e.layerId}`);const E=(o=e.sourceId)!=null?o:be(),I=(r=e.layerId)!=null?r:Se(),A={polylineLayerId:I,polylineOutlineLayerId:"",polylineSourceId:E};e.data&&!t.getSource(E)&&t.addSource(E,{type:"geojson",data:e.data});const C=(a=e.lineWidth)!=null?a:3,w=(l=e.lineColor)!=null?l:Ze(),B=(i=e.lineOpacity)!=null?i:1,f=(s=e.lineBlur)!=null?s:0,b=(n=e.lineGapWidth)!=null?n:0;let O=(u=e.lineDashArray)!=null?u:null;const N=(c=e.outlineWidth)!=null?c:1,$=(p=e.outlineColor)!=null?p:"#FFFFFF",D=(v=e.outlineOpacity)!=null?v:1,H=(m=e.outlineBlur)!=null?m:0;if(typeof O=="string"&&(O=Zt(O)),e.outline===!0){const J=`${I}_outline`;A.polylineOutlineLayerId=J,t.addLayer({id:J,type:"line",source:E,layout:{"line-join":(T=e.lineJoin)!=null?T:"round","line-cap":(g=e.lineCap)!=null?g:"round"},minzoom:(k=e.minzoom)!=null?k:0,maxzoom:(M=e.maxzoom)!=null?M:23,paint:{"line-opacity":typeof D=="number"?D:P(D),"line-color":typeof $=="string"?$:se($),"line-width":Wr(C,N),"line-blur":typeof H=="number"?H:P(H)}},e.beforeId)}return t.addLayer({id:I,type:"line",source:E,layout:{"line-join":(R=e.lineJoin)!=null?R:"round","line-cap":(z=e.lineCap)!=null?z:"round"},minzoom:(F=e.minzoom)!=null?F:0,maxzoom:(_=e.maxzoom)!=null?_:23,paint:ue({"line-opacity":typeof B=="number"?B:P(B),"line-color":typeof w=="string"?w:se(w),"line-width":typeof C=="number"?C:P(C),"line-blur":typeof f=="number"?f:P(f),"line-gap-width":typeof b=="number"?b:P(b)},O&&{"line-dasharray":O})},e.beforeId),A}function la(t,e){var o,r,a,l,i,s,n,u,c,p,v;if(e.layerId&&t.getLayer(e.layerId))throw new Error(`A layer already exists with the layer id: ${e.layerId}`);const m=(o=e.sourceId)!=null?o:be(),T=(r=e.layerId)!=null?r:Se(),g={polygonLayerId:T,polygonOutlineLayerId:e.outline?`${T}_outline`:"",polygonSourceId:m};if(e.data&&!t.getSource(m)){let w=e.data;typeof w=="string"&&ve(w)&&(w=`https://api.maptiler.com/data/${w}/features.json?key=${j.apiKey}`),t.addSource(m,{type:"geojson",data:w})}let k=(a=e.outlineDashArray)!=null?a:null;const M=(l=e.outlineWidth)!=null?l:1,R=(i=e.outlineColor)!=null?i:"#FFFFFF",z=(s=e.outlineOpacity)!=null?s:1,F=(n=e.outlineBlur)!=null?n:0,_=(u=e.fillColor)!=null?u:Ze(),E=(c=e.fillOpacity)!=null?c:1,I=(p=e.outlinePosition)!=null?p:"center",A=(v=e.pattern)!=null?v:null;typeof k=="string"&&(k=Zt(k));const C=(w=null)=>{var B,f,b,O,N,$;if(t.addLayer({id:T,type:"fill",source:m,minzoom:(B=e.minzoom)!=null?B:0,maxzoom:(f=e.maxzoom)!=null?f:23,paint:ue({"fill-color":typeof _=="string"?_:se(_),"fill-opacity":typeof E=="number"?E:P(E)},w&&{"fill-pattern":w})},e.beforeId),e.outline===!0){let D;I==="inside"?typeof M=="number"?D=.5*M:D=P(M.map(({zoom:H,value:J})=>({zoom:H,value:.5*J}))):I==="outside"?typeof M=="number"?D=-.5*M:D=P(M.map(H=>({zoom:H.zoom,value:-.5*H.value}))):D=0,t.addLayer({id:g.polygonOutlineLayerId,type:"line",source:m,layout:{"line-join":(b=e.outlineJoin)!=null?b:"round","line-cap":(O=e.outlineCap)!=null?O:"butt"},minzoom:(N=e.minzoom)!=null?N:0,maxzoom:($=e.maxzoom)!=null?$:23,paint:ue({"line-opacity":typeof z=="number"?z:P(z),"line-color":typeof R=="string"?R:se(R),"line-width":typeof M=="number"?M:P(M),"line-blur":typeof F=="number"?F:P(F),"line-offset":D},k&&{"line-dasharray":k})},e.beforeId)}};return A?t.hasImage(A)?C(A):t.loadImage(A).then(w=>{t.addImage(A,w.data),C(A)}).catch(w=>(console.error("Could not load the pattern image.",w.message),C())):C(),g}function na(t,e){var o,r,a,l,i,s,n,u,c,p,v,m,T,g,k,M;if(e.layerId&&t.getLayer(e.layerId))throw new Error(`A layer already exists with the layer id: ${e.layerId}`);const R=(o=e.minPointRadius)!=null?o:10,z=(r=e.maxPointRadius)!=null?r:50,F=(a=e.cluster)!=null?a:!1,_=20,E=Array.isArray(e.pointColor)?e.pointColor:We.TURBO.scale(10,e.cluster?1e4:1e3).resample("ease-out-square"),I=E.getBounds(),A=(l=e.sourceId)!=null?l:be(),C=(i=e.layerId)!=null?i:Se(),w=(s=e.showLabel)!=null?s:F,B=(n=e.alignOnViewport)!=null?n:!0,f=(u=e.outline)!=null?u:!1,b=(c=e.outlineOpacity)!=null?c:1,O=(p=e.outlineWidth)!=null?p:1,N=(v=e.outlineColor)!=null?v:"#FFFFFF";let $;const D=(m=e.zoomCompensation)!=null?m:!0,H=(T=e.minzoom)!=null?T:0,J=(g=e.maxzoom)!=null?g:23;typeof e.pointOpacity=="number"?$=e.pointOpacity:Array.isArray(e.pointOpacity)?$=P(e.pointOpacity):e.cluster?$=qt(E,"point_count"):e.property?$=qt(E,e.property):$=P([{zoom:H,value:0},{zoom:H+.25,value:1},{zoom:J-.25,value:1},{zoom:J,value:0}]);const re={pointLayerId:C,clusterLayerId:"",labelLayerId:"",pointSourceId:A};if(e.data&&!t.getSource(A)){let G=e.data;typeof G=="string"&&ve(G)&&(G=`https://api.maptiler.com/data/${G}/features.json?key=${j.apiKey}`),t.addSource(A,{type:"geojson",data:G,cluster:F})}if(F){re.clusterLayerId=`${C}_cluster`;const G=Array.from({length:_},(me,de)=>{const Ce=I.min+de*(I.max-I.min)/(_-1);return{value:Ce,pointRadius:R+(z-R)*Math.pow(de/(_-1),.5),color:E.getColorHex(Ce)}});t.addLayer({id:re.clusterLayerId,type:"circle",source:A,filter:["has","point_count"],paint:ue({"circle-color":typeof e.pointColor=="string"?e.pointColor:Kt(G,"point_count"),"circle-radius":typeof e.pointRadius=="number"?e.pointRadius:Array.isArray(e.pointRadius)?P(e.pointRadius):Yt(G,"point_count",!1),"circle-pitch-alignment":B?"viewport":"map","circle-pitch-scale":"map","circle-opacity":$},f&&{"circle-stroke-opacity":typeof b=="number"?b:P(b),"circle-stroke-width":typeof O=="number"?O:P(O),"circle-stroke-color":typeof N=="string"?N:se(N)}),minzoom:H,maxzoom:J},e.beforeId),t.addLayer({id:re.pointLayerId,type:"circle",source:A,filter:["!",["has","point_count"]],paint:ue({"circle-pitch-alignment":B?"viewport":"map","circle-pitch-scale":"map","circle-color":typeof e.pointColor=="string"?e.pointColor:E.getColorHex(E.getBounds().min),"circle-radius":typeof e.pointRadius=="number"?e.pointRadius:Array.isArray(e.pointRadius)?P(e.pointRadius):G[0].pointRadius*.75,"circle-opacity":$},f&&{"circle-stroke-opacity":typeof b=="number"?b:P(b),"circle-stroke-width":typeof O=="number"?O:P(O),"circle-stroke-color":typeof N=="string"?N:se(N)}),minzoom:H,maxzoom:J},e.beforeId)}else{let G=typeof e.pointColor=="string"?e.pointColor:Array.isArray(e.pointColor)?e.pointColor.getColorHex(e.pointColor.getBounds().min):Ze(),me=typeof e.pointRadius=="number"?D?P([{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)?P(e.pointRadius):D?P([{zoom:0,value:R*.05},{zoom:2,value:R*.1},{zoom:4,value:R*.2},{zoom:8,value:R*.5},{zoom:16,value:R*1}]):R;if(e.property&&Array.isArray(e.pointColor)){const de=Array.from({length:_},(Ce,Ye)=>{const qe=I.min+Ye*(I.max-I.min)/(_-1);return{value:qe,pointRadius:typeof e.pointRadius=="number"?e.pointRadius:R+(z-R)*Math.pow(Ye/(_-1),.5),color:typeof e.pointColor=="string"?e.pointColor:E.getColorHex(qe)}});G=Kt(de,e.property),me=Yt(de,e.property,D)}t.addLayer({id:re.pointLayerId,type:"circle",source:A,layout:{"circle-sort-key":e.property?["/",1,["get",e.property]]:0},paint:ue({"circle-pitch-alignment":B?"viewport":"map","circle-pitch-scale":"map","circle-color":G,"circle-opacity":$,"circle-radius":me},f&&{"circle-stroke-opacity":typeof b=="number"?b:P(b),"circle-stroke-width":typeof O=="number"?O:P(O),"circle-stroke-color":typeof N=="string"?N:se(N)}),minzoom:H,maxzoom:J},e.beforeId)}if(w!==!1&&(e.cluster||e.property)){re.labelLayerId=`${C}_label`;const G=(k=e.labelColor)!=null?k:"#fff",me=(M=e.labelSize)!=null?M:12;t.addLayer({id:re.labelLayerId,type:"symbol",source:A,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":me,"text-pitch-alignment":B?"viewport":"map","symbol-sort-key":["/",1,["get",e.cluster?"point_count":e.property]]},paint:{"text-color":G,"text-opacity":$},minzoom:H,maxzoom:J},e.beforeId)}return re}function ia(t,e){var o,r,a,l,i,s,n,u,c,p;if(e.layerId&&t.getLayer(e.layerId))throw new Error(`A layer already exists with the layer id: ${e.layerId}`);const v=(o=e.sourceId)!=null?o:be(),m=(r=e.layerId)!=null?r:Se(),T=(a=e.minzoom)!=null?a:0,g=(l=e.maxzoom)!=null?l:23,k=(i=e.zoomCompensation)!=null?i:!0,M=(s=e.opacity)!=null?s:[{zoom:T,value:0},{zoom:T+.25,value:1},{zoom:g-.25,value:1},{zoom:g,value:0}];let R=Array.isArray(e.colorRamp)?e.colorRamp:We.TURBO.transparentStart();const z=R.getBounds();(z.min!==0||z.max!==1)&&(R=R.scale(0,1)),R.hasTransparentStart()||(R=R.transparentStart());const F=(n=e.intensity)!=null?n:[{zoom:0,value:.01},{zoom:4,value:.2},{zoom:16,value:1}],_=(u=e.property)!=null?u:null,E=(c=e.weight)!=null?c:1;let I=1;_?typeof E=="number"?(I=E,typeof e.weight=="number"&&console.warn("The option `.property` is ignored when `.propertyValueWeights` is not of type `PropertyValueWeights`")):Array.isArray(E)?I=Zr(E,_):console.warn("The option `.property` is ignored when `.propertyValueWeights` is not of type `PropertyValueWeights`"):typeof E=="number"?I=E:Array.isArray(E)&&console.warn("The options `.propertyValueWeights` can only be used when `.property` is provided.");const A=[{zoom:0,value:50*.025},{zoom:2,value:50*.05},{zoom:4,value:50*.1},{zoom:8,value:50*.25},{zoom:16,value:50}],C=(p=e.radius)!=null?p:k?A:10;let w=1;typeof C=="number"?w=C:Array.isArray(C)&&"zoom"in C[0]?w=P(C):_&&Array.isArray(C)&&"propertyValue"in C[0]?w=Kr(C,_,k):!_&&Array.isArray(C)&&"propertyValue"in C[0]?(w=P(A),console.warn("The option `.radius` can only be property-driven if the option `.property` is provided.")):w=P(A);const B={heatmapLayerId:m,heatmapSourceId:v};if(e.data&&!t.getSource(v)){let f=e.data;typeof f=="string"&&ve(f)&&(f=`https://api.maptiler.com/data/${f}/features.json?key=${j.apiKey}`),t.addSource(v,{type:"geojson",data:f})}return t.addLayer({id:m,type:"heatmap",source:v,minzoom:T,maxzoom:g,paint:{"heatmap-weight":I,"heatmap-intensity":typeof F=="number"?F:P(F),"heatmap-color":Yr(R),"heatmap-radius":w,"heatmap-opacity":typeof M=="number"?M:P(M)}}),B}const sa={addPolyline:ra,addPolygon:la,addPoint:na,addHeatmap:ia},{setRTLTextPlugin:ua,getRTLTextPluginStatus:ca,LngLat:pa,LngLatBounds:ha,MercatorCoordinate:ma,Evented:da,AJAXError:ga,prewarm:va,clearPrewarmedResources:ya,addProtocol:Ke,removeProtocol:fa,Hash:La,Point:Aa,config:wa,EdgeInsets:ba,DragRotateHandler:Sa,DragPanHandler:Ca,TwoFingersTouchZoomRotateHandler:Ta,DoubleClickZoomHandler:Ia,TwoFingersTouchZoomHandler:Ra,TwoFingersTouchRotateHandler:Ea,getWorkerCount:xa,setWorkerCount:Pa,getMaxParallelImageRequests:Oa,setMaxParallelImageRequests:_a,getWorkerUrl:Na,setWorkerUrl:Ma,addSourceType:$a,importScriptInWorkers:ka}=h;function Fa(){return Co.version}function za(){return h.getVersion()}const Ba=h.Map,Ua=h.Marker,Ha=h.Popup,ja=h.Style,Da=h.CanvasSource,Ga=h.GeoJSONSource,Va=h.ImageSource,Wa=h.RasterTileSource,Za=h.RasterDEMTileSource,Ka=h.VectorTileSource,Ya=h.VideoSource;h.NavigationControl,h.GeolocateControl,h.AttributionControl,h.LogoControl,h.ScaleControl,h.FullscreenControl,h.TerrainControl;const qa=h.BoxZoomHandler,Ja=h.ScrollZoomHandler,Xa=h.CooperativeGesturesHandler,Qa=h.KeyboardHandler,el=h.TwoFingersTouchPitchHandler,tl=h.MapWheelEvent,ol=h.MapTouchEvent,rl=h.MapMouseEvent;export{ga as AJAXError,At as AttributionControl,Tr as BoxZoomHandler,qa as BoxZoomHandlerMLGL,yr as CanvasSource,Da as CanvasSourceMLGL,d as ColorRamp,We as ColorRampCollection,Rr as CooperativeGesturesHandler,Xa as CooperativeGesturesHandlerMLGL,Ia as DoubleClickZoomHandler,Ca as DragPanHandler,Sa as DragRotateHandler,ba as EdgeInsets,da as Evented,bt as FullscreenControl,fr as GeoJSONSource,Ga as GeoJSONSourceMLGL,gt as GeolocateControl,Pt as GeolocationType,La as Hash,Lr as ImageSource,Va as ImageSourceMLGL,Er as KeyboardHandler,Qa as KeyboardHandlerMLGL,S as Language,ml as LanguageGeocoding,pa as LngLat,ha as LngLatBounds,et as LogoControl,Ot as Map,Ba as MapMLGL,_r as MapMouseEvent,rl as MapMouseEventMLGL,dl as MapStyle,gl as MapStyleVariant,Or as MapTouchEvent,ol as MapTouchEventMLGL,Pr as MapWheelEvent,tl as MapWheelEventMLGL,Lt as MaptilerGeolocateControl,Ee as MaptilerLogoControl,dt as MaptilerNavigationControl,ht as MaptilerTerrainControl,dr as Marker,Ua as MarkerMLGL,ma as MercatorCoordinate,mt as NavigationControl,Aa as Point,gr as Popup,Ha as PopupMLGL,wr as RasterDEMTileSource,Za as RasterDEMTileSourceMLGL,Ar as RasterTileSource,Wa as RasterTileSourceMLGL,vl as ReferenceMapStyle,wt as ScaleControl,Ir as ScrollZoomHandler,Ja as ScrollZoomHandlerMLGL,Qe as SdkConfig,yl as ServiceError,vr as Style,ja as StyleMLGL,Cr as TerrainControl,xr as TwoFingersTouchPitchHandler,el as TwoFingersTouchPitchHandlerMLGL,Ea as TwoFingersTouchRotateHandler,Ra as TwoFingersTouchZoomHandler,Ta as TwoFingersTouchZoomRotateHandler,br as VectorTileSource,Ka as VectorTileSourceMLGL,Sr as VideoSource,Ya as VideoSourceMLGL,Ke as addProtocol,$a as addSourceType,fl as bufferToPixelDataBrowser,Ll as circumferenceAtLatitude,ya as clearPrewarmedResources,j as config,wa as configMLGL,Al as coordinates,wl as data,bl as elevation,Sl as expandMapStyle,Cl as geocoding,Tl as geolocation,Il as getAutoLanguageGeocoding,Re as getBrowserLanguage,Rl as getBufferToPixelDataParser,za as getMapLibreVersion,Oa as getMaxParallelImageRequests,ca as getRTLTextPluginStatus,El as getTileCache,Fa as getVersion,xa as getWorkerCount,Na as getWorkerUrl,je as gpx,Dt as gpxOrKml,Ue as hasChildNodeWithName,sa as helpers,ka as importScriptInWorkers,Ie as isLanguageSupported,De as kml,xl as mapStylePresetList,Pl as math,Ol as misc,va as prewarm,fa as removeProtocol,_a as setMaxParallelImageRequests,ua as setRTLTextPlugin,Pa as setWorkerCount,Ma as setWorkerUrl,_l as staticMaps,Le as str2xml,Nl as styleToStyle,He as xml2str};
|
package/dist/maptiler-sdk.mjs
CHANGED
|
@@ -6,7 +6,7 @@ export { LanguageGeocoding, MapStyle, MapStyleVariant, ReferenceMapStyle, Servic
|
|
|
6
6
|
import { v4 } from 'uuid';
|
|
7
7
|
|
|
8
8
|
var name = "@maptiler/sdk";
|
|
9
|
-
var version = "2.0.
|
|
9
|
+
var version = "2.0.2";
|
|
10
10
|
var description = "The Javascript & TypeScript map SDK tailored for MapTiler Cloud";
|
|
11
11
|
var module = "dist/maptiler-sdk.mjs";
|
|
12
12
|
var types = "dist/maptiler-sdk.d.ts";
|
|
@@ -83,7 +83,7 @@ var dependencies = {
|
|
|
83
83
|
"@maptiler/client": "^1.8.1",
|
|
84
84
|
events: "^3.3.0",
|
|
85
85
|
"js-base64": "^3.7.4",
|
|
86
|
-
"maplibre-gl": "4.1.
|
|
86
|
+
"maplibre-gl": "^4.1.3",
|
|
87
87
|
uuid: "^9.0.0"
|
|
88
88
|
};
|
|
89
89
|
var packagejson = {
|
|
@@ -422,7 +422,7 @@ const CACHE_LIMIT_ITEMS = 1e3;
|
|
|
422
422
|
const CACHE_LIMIT_CHECK_INTERVAL = 100;
|
|
423
423
|
function localCacheTransformRequest(reqUrl, resourceType) {
|
|
424
424
|
if (config$1.caching && config$1.session && reqUrl.host === defaults.maptilerApiHost) {
|
|
425
|
-
if (resourceType == "Source") {
|
|
425
|
+
if (resourceType == "Source" && reqUrl.href.includes("tiles.json")) {
|
|
426
426
|
return reqUrl.href.replace(
|
|
427
427
|
"https://",
|
|
428
428
|
`${LOCAL_CACHE_PROTOCOL_SOURCE}://`
|
|
@@ -467,7 +467,9 @@ function registerLocalCacheProtocol() {
|
|
|
467
467
|
requestInit.signal = abortController.signal;
|
|
468
468
|
const response = yield fetch(params.url, requestInit);
|
|
469
469
|
const json = yield response.json();
|
|
470
|
-
json.tiles
|
|
470
|
+
if (json.tiles && json.tiles.length > 0) {
|
|
471
|
+
json.tiles[0] += "&last-modified=" + response.headers.get("Last-Modified");
|
|
472
|
+
}
|
|
471
473
|
return {
|
|
472
474
|
data: json,
|
|
473
475
|
cacheControl: response.headers.get("Cache-Control"),
|
|
@@ -1293,7 +1295,7 @@ const GeolocationType = {
|
|
|
1293
1295
|
};
|
|
1294
1296
|
class Map extends maplibregl.Map {
|
|
1295
1297
|
constructor(options) {
|
|
1296
|
-
var _a, _b, _c;
|
|
1298
|
+
var _a, _b, _c, _d;
|
|
1297
1299
|
if (options.apiKey) {
|
|
1298
1300
|
config$1.apiKey = options.apiKey;
|
|
1299
1301
|
}
|
|
@@ -1304,11 +1306,11 @@ class Map extends maplibregl.Map {
|
|
|
1304
1306
|
"MapTiler Cloud API key is not set. Visit https://maptiler.com and try Cloud for free!"
|
|
1305
1307
|
);
|
|
1306
1308
|
}
|
|
1307
|
-
super(__spreadProps$1(__spreadValues$2({}, options), {
|
|
1309
|
+
super(__spreadValues$2(__spreadProps$1(__spreadValues$2({}, options), {
|
|
1308
1310
|
style,
|
|
1309
1311
|
maplibreLogo: false,
|
|
1310
1312
|
transformRequest: combineTransformRequest(options.transformRequest)
|
|
1311
|
-
}));
|
|
1313
|
+
}), (_a = options.attributionControl) != null ? _a : { attributionControl: false }));
|
|
1312
1314
|
__publicField$1(this, "isTerrainEnabled", false);
|
|
1313
1315
|
__publicField$1(this, "terrainExaggeration", 1);
|
|
1314
1316
|
__publicField$1(this, "primaryLanguage");
|
|
@@ -1321,10 +1323,10 @@ class Map extends maplibregl.Map {
|
|
|
1321
1323
|
if (config$1.caching) {
|
|
1322
1324
|
registerLocalCacheProtocol();
|
|
1323
1325
|
}
|
|
1324
|
-
this.primaryLanguage = (
|
|
1326
|
+
this.primaryLanguage = (_b = options.language) != null ? _b : config$1.primaryLanguage;
|
|
1325
1327
|
this.forceLanguageUpdate = this.primaryLanguage === Language.STYLE || this.primaryLanguage === Language.STYLE_LOCK ? false : true;
|
|
1326
1328
|
this.languageAlwaysBeenStyle = this.primaryLanguage === Language.STYLE;
|
|
1327
|
-
this.terrainExaggeration = (
|
|
1329
|
+
this.terrainExaggeration = (_c = options.terrainExaggeration) != null ? _c : this.terrainExaggeration;
|
|
1328
1330
|
this.once("styledata", () => __async$1(this, null, function* () {
|
|
1329
1331
|
if (!options.geolocate) {
|
|
1330
1332
|
return;
|
|
@@ -1423,7 +1425,7 @@ class Map extends maplibregl.Map {
|
|
|
1423
1425
|
new MaptilerLogoControl({ logoURL }),
|
|
1424
1426
|
options.logoPosition
|
|
1425
1427
|
);
|
|
1426
|
-
if (options.attributionControl
|
|
1428
|
+
if (!options.attributionControl) {
|
|
1427
1429
|
this.addControl(
|
|
1428
1430
|
new AttributionControl({
|
|
1429
1431
|
customAttribution: options.customAttribution
|
|
@@ -1563,7 +1565,7 @@ class Map extends maplibregl.Map {
|
|
|
1563
1565
|
this.on("terrain", terrainCallback);
|
|
1564
1566
|
if (options.terrain) {
|
|
1565
1567
|
this.enableTerrain(
|
|
1566
|
-
(
|
|
1568
|
+
(_d = options.terrainExaggeration) != null ? _d : this.terrainExaggeration
|
|
1567
1569
|
);
|
|
1568
1570
|
}
|
|
1569
1571
|
}
|