@maptiler/client 2.5.0 → 2.6.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1360,6 +1360,7 @@ type MapStylePreset = {
1360
1360
  description: string;
1361
1361
  variants: Array<{
1362
1362
  deprecated?: boolean;
1363
+ deprecationMessage?: string;
1363
1364
  id: string;
1364
1365
  name: string;
1365
1366
  variantType: string;
@@ -1399,6 +1400,10 @@ declare class MapStyleVariant {
1399
1400
  * Whether this variant is deprecated or not
1400
1401
  */
1401
1402
  deprecated: boolean;
1403
+ /**
1404
+ * Message to display when the variant is deprecated
1405
+ */
1406
+ deprecationMessage?: string;
1402
1407
  constructor(
1403
1408
  /**
1404
1409
  * Human-friendly name
@@ -1427,7 +1432,11 @@ declare class MapStyleVariant {
1427
1432
  /**
1428
1433
  * Whether this variant is deprecated or not
1429
1434
  */
1430
- deprecated?: boolean);
1435
+ deprecated?: boolean,
1436
+ /**
1437
+ * Message to display when the variant is deprecated
1438
+ */
1439
+ deprecationMessage?: string);
1431
1440
  /**
1432
1441
  * Get the human-friendly name
1433
1442
  * @returns
@@ -1569,17 +1578,47 @@ type MapStyleType = {
1569
1578
  */
1570
1579
  DARK: MapStyleVariant;
1571
1580
  /**
1572
- * Suitable for navigation, with high level of detail on urban areas, plenty of POIs and 3D buildings, in light mode.
1581
+ * Suitable for navigation, with high level of detail on urban areas, plenty of POIs and 3D buildings, with a pastel color palette.
1573
1582
  */
1574
- LIGHT: MapStyleVariant;
1583
+ PASTEL: MapStyleVariant;
1575
1584
  /**
1576
- * Suitable for navigation, with high level of detail on urban areas, plenty of POIs and 3D buildings, in blue night mode.
1585
+ * Streets v2 is deprecated, use streets v4 instead
1577
1586
  */
1578
- NIGHT: MapStyleVariant;
1587
+ DEFAULT_V2: MapStyleVariant;
1579
1588
  /**
1580
- * Suitable for navigation, with high level of detail on urban areas, plenty of POIs and 3D buildings, with a pastel color palette.
1589
+ * Streets v2 is deprecated, use streets v4-dark instead
1581
1590
  */
1582
- PASTEL: MapStyleVariant;
1591
+ DARK_V2: MapStyleVariant;
1592
+ /**
1593
+ * Streets v2 is deprecated, use streets v4-light instead
1594
+ */
1595
+ LIGHT_V2: MapStyleVariant;
1596
+ /**
1597
+ * Streets v2 is deprecated, use streets v4-night instead
1598
+ */
1599
+ NIGHT_V2: MapStyleVariant;
1600
+ /**
1601
+ * Streets v2 is deprecated, use streets v4-pastel instead
1602
+ */
1603
+ PASTEL_V2: MapStyleVariant;
1604
+ };
1605
+ BASE: ReferenceMapStyle & {
1606
+ /**
1607
+ * Light and informative map, for general use.
1608
+ */
1609
+ DEFAULT: MapStyleVariant;
1610
+ /**
1611
+ * Darker version of the base style, for night use.
1612
+ */
1613
+ DARK: MapStyleVariant;
1614
+ /**
1615
+ * Light version of the base style, for day use.
1616
+ */
1617
+ LIGHT: MapStyleVariant;
1618
+ /**
1619
+ * A clear and informative map, for general use.
1620
+ */
1621
+ AI: MapStyleVariant;
1583
1622
  };
1584
1623
  /**
1585
1624
  * Suitable for outdoor activities. With elevation isolines and hillshading.
@@ -1793,6 +1832,18 @@ type MapStyleType = {
1793
1832
  * Vivid terrain map for data overlays and visualisations
1794
1833
  */
1795
1834
  VIVID: MapStyleVariant;
1835
+ /**
1836
+ * Default v2 is deprecated, use DEFAULT instead
1837
+ */
1838
+ DEFAULT_V2: MapStyleVariant;
1839
+ /**
1840
+ * Dark v2 is deprecated, use DARK instead
1841
+ */
1842
+ DARK_V2: MapStyleVariant;
1843
+ /**
1844
+ * Vivid v2 is deprecated, use VIVID instead
1845
+ */
1846
+ VIVID_V2: MapStyleVariant;
1796
1847
  };
1797
1848
  /**
1798
1849
  * Watercolor map for creative use
@@ -1 +1 @@
1
- import we from"quick-lru";function De(){return typeof self<"u"?fetch.bind(self):typeof global<"u"&&global.fetch?global.fetch:null}class q{constructor(){this._apiKey="",this._fetch=De(),this.tileCacheSize=200}set apiKey(n){this._apiKey=n}get apiKey(){return this._apiKey}set fetch(n){this._fetch=n}get fetch(){return this._fetch}}const m=new q,Y={AUTO:{code:null,flag:"auto",name:"Auto",latin:!1,isMode:!0,geocoding:!0},LATIN:{code:"latin",flag:"name:latin",name:"Latin",latin:!0,isMode:!1,geocoding:!1},NON_LATIN:{code:"nonlatin",flag:"name:nonlatin",name:"Non Latin",latin:!1,isMode:!1,geocoding:!1},LOCAL:{code:null,flag:"name",name:"Local",latin:!0,isMode:!1,geocoding:!1}},Z={ALBANIAN:{code:"sq",flag:"name:sq",name:"Albanian",latin:!0,isMode:!1,geocoding:!0},AMHARIC:{code:"am",flag:"name:am",name:"Amharic",latin:!1,isMode:!1,geocoding:!0},ARABIC:{code:"ar",flag:"name:ar",name:"Arabic",latin:!1,isMode:!1,geocoding:!0},ARMENIAN:{code:"hy",flag:"name:hy",name:"Armenian",latin:!1,isMode:!1,geocoding:!0},AZERBAIJANI:{code:"az",flag:"name:az",name:"Azerbaijani",latin:!0,isMode:!1,geocoding:!0},BASQUE:{code:"eu",flag:"name:eu",name:"Basque",latin:!0,isMode:!1,geocoding:!0},BELARUSIAN:{code:"be",flag:"name:be",name:"Belarusian",latin:!1,isMode:!1,geocoding:!0},BENGALI:{code:"bn",flag:"name:bn",name:"Bengali",latin:!0,isMode:!1,geocoding:!0},BOSNIAN:{code:"bs",flag:"name:bs",name:"Bosnian",latin:!0,isMode:!1,geocoding:!0},BRETON:{code:"br",flag:"name:br",name:"Breton",latin:!0,isMode:!1,geocoding:!0},BULGARIAN:{code:"bg",flag:"bg",name:"Bulgarian",latin:!1,isMode:!1,geocoding:!0},CATALAN:{code:"ca",flag:"name:ca",name:"Catalan",latin:!0,isMode:!1,geocoding:!0},CHINESE:{code:"zh",flag:"name:zh",name:"Chinese",latin:!1,isMode:!1,geocoding:!0},TRADITIONAL_CHINESE:{code:"zh-Hant",flag:"name:zh-Hant",name:"Chinese (traditional)",latin:!1,isMode:!1,geocoding:!1},SIMPLIFIED_CHINESE:{code:"zh-Hans",flag:"name:zh-Hans",name:"Chinese (simplified)",latin:!1,isMode:!1,geocoding:!1},CORSICAN:{code:"co",flag:"name:co",name:"Corsican",latin:!0,isMode:!1,geocoding:!0},CROATIAN:{code:"hr",flag:"name:hr",name:"Croatian",latin:!0,isMode:!1,geocoding:!0},CZECH:{code:"cs",flag:"name:cs",name:"Czech",latin:!0,isMode:!1,geocoding:!0},DANISH:{code:"da",flag:"name:da",name:"Danish",latin:!0,isMode:!1,geocoding:!0},DUTCH:{code:"nl",flag:"name:nl",name:"Dutch",latin:!0,isMode:!1,geocoding:!0},GERMAN:{code:"de",flag:"name:de",name:"German",latin:!0,isMode:!1,geocoding:!0},GREEK:{code:"el",flag:"name:el",name:"Greek",latin:!1,isMode:!1,geocoding:!0},ENGLISH:{code:"en",flag:"name:en",name:"English",latin:!0,isMode:!1,geocoding:!0},ESPERANTO:{code:"eo",flag:"name:eo",name:"Esperanto",latin:!0,isMode:!1,geocoding:!0},ESTONIAN:{code:"et",flag:"name:et",name:"Estonian",latin:!0,isMode:!1,geocoding:!0},FINNISH:{code:"fi",flag:"name:fi",name:"Finnish",latin:!0,isMode:!1,geocoding:!0},FRENCH:{code:"fr",flag:"name:fr",name:"French",latin:!0,isMode:!1,geocoding:!0},FRISIAN:{code:"fy",flag:"name:fy",name:"Frisian (West)",latin:!0,isMode:!1,geocoding:!0},GEORGIAN:{code:"ka",flag:"name:ka",name:"Georgian",latin:!1,isMode:!1,geocoding:!0},HEBREW:{code:"he",flag:"name:he",name:"Hebrew",latin:!1,isMode:!1,geocoding:!0},HINDI:{code:"hi",flag:"name:hi",name:"Hindi",latin:!1,isMode:!1,geocoding:!0},HUNGARIAN:{code:"hu",flag:"name:hu",name:"Hungarian",latin:!0,isMode:!1,geocoding:!0},ICELANDIC:{code:"is",flag:"name:is",name:"Icelandic",latin:!0,isMode:!1,geocoding:!0},INDONESIAN:{code:"id",flag:"name:id",name:"Indonesian",latin:!0,isMode:!1,geocoding:!0},IRISH:{code:"ga",flag:"name:ga",name:"Irish",latin:!0,isMode:!1,geocoding:!0},ITALIAN:{code:"it",flag:"name:it",name:"Italian",latin:!0,isMode:!1,geocoding:!0},JAPANESE:{code:"ja",flag:"name:ja",name:"Japanese",latin:!1,isMode:!1,geocoding:!0},JAPANESE_HIRAGANA:{code:"ja-Hira",flag:"name:ja-Hira",name:"Japanese Hiragana form",latin:!1,isMode:!1,geocoding:!1},JAPANESE_2018:{code:"ja-Latn",flag:"name:ja-Latn",name:"Japanese (Latin 2018)",latin:!0,isMode:!1,geocoding:!1},JAPANESE_KANA:{code:"ja_kana",flag:"name:ja_kana",name:"Japanese (Kana)",latin:!1,isMode:!1,geocoding:!1},JAPANESE_LATIN:{code:"ja_rm",flag:"name:ja_rm",name:"Japanese (Latin script)",latin:!0,isMode:!1,geocoding:!1},KANNADA:{code:"kn",flag:"name:kn",name:"Kannada",latin:!0,isMode:!1,geocoding:!0},KAZAKH:{code:"kk",flag:"name:kk",name:"Kazakh",latin:!1,isMode:!1,geocoding:!0},KOREAN:{code:"ko",flag:"name:ko",name:"Korean",latin:!1,isMode:!1,geocoding:!0},KOREAN_LATIN:{code:"ko-Latn",flag:"name:ko-Latn",name:"Korean (Latin script)",latin:!0,isMode:!1,geocoding:!1},KURDISH:{code:"ku",flag:"name:ku",name:"Kurdish",latin:!0,isMode:!1,geocoding:!0},CLASSICAL_LATIN:{code:"la",flag:"name:la",name:"Latin",latin:!0,isMode:!1,geocoding:!0},LATVIAN:{code:"lv",flag:"name:lv",name:"Latvian",latin:!0,isMode:!1,geocoding:!0},LITHUANIAN:{code:"lt",flag:"name:lt",name:"Lithuanian",latin:!0,isMode:!1,geocoding:!0},LUXEMBOURGISH:{code:"lb",flag:"name:lb",name:"Luxembourgish",latin:!0,isMode:!1,geocoding:!0},MACEDONIAN:{code:"mk",flag:"name:mk",name:"Macedonian",latin:!1,isMode:!1,geocoding:!0},MALAYALAM:{code:"ml",flag:"name:ml",name:"Malayalam",latin:!1,isMode:!1,geocoding:!0},MALTESE:{code:"mt",flag:"name:mt",name:"Maltese",latin:!0,isMode:!1,geocoding:!0},NORWEGIAN:{code:"no",flag:"name:no",name:"Norwegian",latin:!0,isMode:!1,geocoding:!0},OCCITAN:{code:"oc",flag:"name:oc",name:"Occitan",latin:!0,isMode:!1,geocoding:!0},PERSIAN:{code:"fa",flag:"name:fa",name:"Persian",latin:!1,isMode:!1,geocoding:!0},POLISH:{code:"pl",flag:"name:pl",name:"Polish",latin:!0,isMode:!1,geocoding:!0},PORTUGUESE:{code:"pt",flag:"name:pt",name:"Portuguese",latin:!0,isMode:!1,geocoding:!0},PUNJABI:{code:"pa",flag:"name:pa",name:"Punjabi",latin:!1,isMode:!1,geocoding:!0},WESTERN_PUNJABI:{code:"pnb",flag:"name:pnb",name:"Western Punjabi",latin:!1,isMode:!1,geocoding:!1},ROMANIAN:{code:"ro",flag:"name:ro",name:"Romanian",latin:!0,isMode:!1,geocoding:!0},ROMANSH:{code:"rm",flag:"name:rm",name:"Romansh",latin:!0,isMode:!1,geocoding:!0},RUSSIAN:{code:"ru",flag:"name:ru",name:"Russian",latin:!1,isMode:!1,geocoding:!0},SERBIAN_CYRILLIC:{code:"sr",flag:"name:sr",name:"Serbian (Cyrillic script)",latin:!1,isMode:!1,geocoding:!0},SERBIAN_LATIN:{code:"sr-Latn",flag:"name:sr-Latn",name:"Serbian (Latin script)",latin:!0,isMode:!1,geocoding:!1},SCOTTISH_GAELIC:{code:"gd",flag:"name:gd",name:"Scottish Gaelic",latin:!0,isMode:!1,geocoding:!0},SLOVAK:{code:"sk",flag:"name:sk",name:"Slovak",latin:!0,isMode:!1,geocoding:!0},SLOVENE:{code:"sl",flag:"name:sl",name:"Slovene",latin:!0,isMode:!1,geocoding:!0},SPANISH:{code:"es",flag:"name:es",name:"Spanish",latin:!0,isMode:!1,geocoding:!0},SWEDISH:{code:"sv",flag:"name:sv",name:"Swedish",latin:!0,isMode:!1,geocoding:!0},TAMIL:{code:"ta",flag:"name:ta",name:"Tamil",latin:!1,isMode:!1,geocoding:!0},TELUGU:{code:"te",flag:"name:te",name:"Telugu",latin:!1,isMode:!1,geocoding:!0},THAI:{code:"th",flag:"name:th",name:"Thai",latin:!1,isMode:!1,geocoding:!0},TURKISH:{code:"tr",flag:"name:tr",name:"Turkish",latin:!0,isMode:!1,geocoding:!0},UKRAINIAN:{code:"uk",flag:"name:uk",name:"Ukrainian",latin:!1,isMode:!1,geocoding:!0},VIETNAMESE:{code:"vi",flag:"name:vi",name:"Vietnamese (Latin script)",latin:!0,isMode:!1,geocoding:!0},WELSH:{code:"cy",flag:"name:cy",name:"Welsh",latin:!0,isMode:!1,geocoding:!0}},A={...Y,...Z};function Q(e,n=A){return e in n?e[e]:null}function T(e,n=A){for(const a of Object.values(n))if(a.code===e)return a;return null}function D(e,n=A){for(const a of Object.values(n))if(a.flag===e)return a;return null}function K(){if(typeof navigator>"u"){const e=Intl.DateTimeFormat().resolvedOptions().locale.split("-")[0];return T(e)??A.ENGLISH}return Array.from(new Set(navigator.languages.map(e=>e.split("-")[0]))).map(e=>T(e)).filter(e=>e)[0]??A.ENGLISH}function j(e){return e!==null&&typeof e=="object"&&"code"in e&&"flag"in e&&"name"in e&&"latin"in e&&"isMode"in e&&"geocoding"in e&&(typeof e.code=="string"||e.code===null)&&typeof e.flag=="string"&&typeof e.name=="string"&&typeof e.latin=="boolean"&&typeof e.isMode=="boolean"&&typeof e.geocoding=="boolean"}function O(e,n=A){return j(e)?D(e.flag,n):typeof e!="string"?null:Q(e,n)||T(e,n)||D(e,n)||null}function Ue(e,n,a=A){const t=O(e,a),o=O(n,a);return t&&o&&t.flag===o.flag}async function f(e,n={}){if(m.fetch===null)throw new Error("The fetch function was not found. If on NodeJS < 18 please specify the fetch function with config.fetch");if(new URL(e).searchParams.get("key").trim()==="")throw new Error("The MapTiler Cloud API key is missing. Set it in `config.apiKey` or get one for free at https://maptiler.com");return m.fetch(e,n)}const p={maptilerApiURL:"https://api.maptiler.com/",mapStyle:"streets-v2"};Object.freeze(p);class h extends Error{constructor(n,a=""){super(`Call to enpoint ${n.url} failed with the status code ${n.status}. ${a}`),this.res=n}}const U={400:"Query too long / Invalid parameters",403:"Key is missing, invalid or restricted"};function X(e,n){const{language:a}=n;if(a===void 0)return;const t=(Array.isArray(a)?a:[a]).map(i=>Ee(i)).filter(i=>i),o=Array.from(new Set(t)).join(",");e.set("language",o)}function Ee(e){const n=e===A.AUTO.flag?K():typeof e=="string"?T(e):j(e)?e.flag===A.AUTO.flag?K():D(e.flag):null;return n?.geocoding?n.code:null}function ee(e,n){const{apiKey:a,limit:t,types:o,excludeTypes:i}=n;e.set("key",a??m.apiKey),t!==void 0&&e.set("limit",String(t)),o!==void 0&&e.set("types",o.join(",")),i!==void 0&&e.set("excludeTypes",String(i)),X(e,n)}function ne(e,n){ee(e,n);const{bbox:a,proximity:t,country:o,fuzzyMatch:i,autocomplete:r}=n;a!==void 0&&e.set("bbox",a.join(",")),t!==void 0&&e.set("proximity",t==="ip"?t:t.join(",")),o!==void 0&&e.set("country",o.join(",")),i!==void 0&&e.set("fuzzyMatch",i?"true":"false"),r!==void 0&&e.set("autocomplete",r?"true":"false")}async function ke(e,n={}){if(typeof e!="string"||e.trim().length===0)throw new Error("The query must be a non-empty string");const a=new URL(`geocoding/${encodeURIComponent(e)}.json`,p.maptilerApiURL);ne(a.searchParams,n);const t=await f(a.toString());if(!t.ok)throw new h(t,U[t.status]??"");return await t.json()}async function Pe(e,n={}){if(!Array.isArray(e)||e.length<2)throw new Error("The position must be an array of form [lng, lat].");const a=new URL(`geocoding/${e[0]},${e[1]}.json`,p.maptilerApiURL);ee(a.searchParams,n);const t=await f(a.toString());if(!t.ok)throw new h(t,U[t.status]??"");return await t.json()}async function Ne(e,n={}){const a=new URL(`geocoding/${e}.json`,p.maptilerApiURL);a.searchParams.set("key",n.apiKey??m.apiKey),X(a.searchParams,n);const t=await f(a.toString());if(!t.ok)throw new h(t,U[t.status]??"");return await t.json()}async function $e(e,n={}){if(!e.length)return[];const a=e.map(r=>encodeURIComponent(r)).join(";"),t=new URL(`geocoding/${a}.json`,p.maptilerApiURL);ne(t.searchParams,n);const o=await f(t.toString());if(!o.ok)throw new h(o,U[o.status]??"");const i=await o.json();return e.length===1?[i]:i}const be={forward:ke,reverse:Pe,byId:Ne,batch:$e},ae={403:"Key is missing, invalid or restricted"};async function Ce(e={}){const n=new URL("geolocation/ip.json",p.maptilerApiURL);n.searchParams.set("key",e.apiKey??m.apiKey),"elevation"in e&&n.searchParams.set("elevation",e.elevation?"true":"false");const a=n.toString(),t=await f(a);if(!t.ok)throw new h(t,t.status in ae?ae[t.status]:"");return await t.json()}const Ke={info:Ce},E={403:"Key is missing, invalid or restricted"};async function je(e,n={}){if(typeof e!="string"||e.trim().length===0)throw new Error("The query must be a non-empty string");const a=new URL(`coordinates/search/${e}.json`,p.maptilerApiURL);a.searchParams.set("key",n.apiKey??m.apiKey),"limit"in n&&a.searchParams.set("limit",n.limit.toString()),"transformations"in n&&a.searchParams.set("transformations",n.transformations.toString()),"exports"in n&&a.searchParams.set("exports",n.exports.toString());const t=a.toString(),o=await f(t);if(!o.ok)throw new h(o,o.status in E?E[o.status]:"");return await o.json()}async function Oe(e,n={}){const a=(Array.isArray(e[0])?e:[e]).map(r=>`${r[0]},${r[1]}`).join(";"),t=new URL(`coordinates/transform/${a}.json`,p.maptilerApiURL);t.searchParams.set("key",n.apiKey??m.apiKey),"sourceCrs"in n&&t.searchParams.set("s_srs",n.sourceCrs.toString()),"targetCrs"in n&&t.searchParams.set("t_srs",n.targetCrs.toString()),"operations"in n&&t.searchParams.set("ops",(Array.isArray(n.operations)?n.operations:[n.operations]).join("|"));const o=t.toString(),i=await f(o);if(!i.ok)throw new h(i,i.status in E?E[i.status]:"");return await i.json()}const He={search:je,transform:Oe},te={403:"Key is missing, invalid or restricted"};async function xe(e,n={}){if(typeof e!="string"||e.trim().length===0)throw new Error("The data ID must be a non-empty string");const a=new URL(`data/${encodeURIComponent(e)}/features.json`,p.maptilerApiURL);a.searchParams.set("key",n.apiKey??m.apiKey);const t=a.toString(),o=await f(t);if(!o.ok)throw new h(o,o.status in te?te[o.status]:"");return await o.json()}const Fe={get:xe};function ie(e){const n=/^maptiler:\/\/(.*)/;let a;const t=e.trim();let o;return t.startsWith("http://")||t.startsWith("https://")?o=t:(a=n.exec(t))!==null?o=`https://api.maptiler.com/maps/${a[1]}/style.json`:o=`https://api.maptiler.com/maps/${t}/style.json`,o}class H{constructor(n,a,t,o,i,r,s=!1){this.name=n,this.variantType=a,this.id=t,this.referenceStyle=o,this.description=i,this.imageURL=r,this.deprecated=s}getName(){return this.name}getFullName(){return`${this.referenceStyle.getName()} ${this.name}`}getType(){return this.variantType}getId(){return this.id}getDescription(){return this.description}getReferenceStyle(){return this.referenceStyle}hasVariant(n){return this.referenceStyle.hasVariant(n)}getVariant(n){const a=this.referenceStyle.getVariant(n);return this.warnIfDeprecated(a),a}getVariants(){return this.referenceStyle.getVariants().filter(n=>n!==this).map(n=>(this.warnIfDeprecated(n),n))}getImageURL(){return this.imageURL}getExpandedStyleURL(){return ie(this.getId())}warnIfDeprecated(n=this){if(!n.deprecated)return n;const a=n.getFullName();return console.warn(`Style "${a}" is deprecated and will be removed in a future version.`),n}}class x{constructor(n,a){this.name=n,this.id=a,this.variants={},this.orderedVariants=[]}getName(){return this.name}getId(){return this.id}addVariant(n){this.variants[n.getType()]=n,this.orderedVariants.push(n)}hasVariant(n){return n in this.variants}getVariant(n){return n in this.variants?this.variants[n]:this.orderedVariants[0]}getVariants(){return Object.values(this.variants)}getDefaultVariant(){return this.orderedVariants[0].warnIfDeprecated()}}const k=[{referenceStyleID:"STREETS",name:"Streets",description:"",variants:[{id:"streets-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"streets-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"streets-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""},{id:"streets-v2-night",name:"Night",variantType:"NIGHT",description:"",imageURL:""},{id:"streets-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""}]},{referenceStyleID:"OUTDOOR",name:"Outdoor",description:"",variants:[{id:"outdoor-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"outdoor-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""}]},{referenceStyleID:"WINTER",name:"Winter",description:"",variants:[{id:"winter-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"winter-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""}]},{referenceStyleID:"SATELLITE",name:"Satellite",description:"",variants:[{id:"satellite",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"HYBRID",name:"Hybrid",description:"",variants:[{id:"hybrid",deprecated:!0,name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"BASIC",name:"Basic",description:"",variants:[{id:"basic-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"basic-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"basic-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"BRIGHT",name:"Bright",description:"",variants:[{id:"bright-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"bright-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"bright-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""},{id:"bright-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""}]},{referenceStyleID:"OPENSTREETMAP",name:"OpenStreetMap",description:"",variants:[{id:"openstreetmap",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"TOPO",name:"Topo",description:"",variants:[{id:"topo-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"topo-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"topo-v2-shiny",name:"Shiny",deprecated:!0,variantType:"SHINY",description:"",imageURL:""},{id:"topo-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""},{id:"topo-v2-topographique",name:"Topographique",variantType:"TOPOGRAPHIQUE",description:"",imageURL:""}]},{referenceStyleID:"VOYAGER",name:"Voyager",description:"",variants:[{id:"voyager-v2",name:"Default",deprecated:!0,variantType:"DEFAULT",description:"",imageURL:""},{id:"voyager-v2-darkmatter",name:"Darkmatter",deprecated:!0,variantType:"DARK",description:"",imageURL:""},{id:"voyager-v2-positron",name:"Positron",deprecated:!0,variantType:"LIGHT",description:"",imageURL:""},{id:"voyager-v2-vintage",name:"Vintage",deprecated:!0,variantType:"VINTAGE",description:"",imageURL:""}]},{referenceStyleID:"TONER",name:"Toner",description:"",variants:[{id:"toner-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"toner-v2-background",name:"Background",variantType:"BACKGROUND",deprecated:!0,description:"",imageURL:""},{id:"toner-v2-lite",name:"Lite",variantType:"LITE",description:"",imageURL:""},{id:"toner-v2-lines",name:"Lines",variantType:"LINES",deprecated:!0,description:"",imageURL:""}]},{referenceStyleID:"DATAVIZ",name:"Dataviz",description:"",variants:[{id:"dataviz",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"dataviz-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"dataviz-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"BACKDROP",name:"Backdrop",description:"",variants:[{id:"backdrop",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"backdrop-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"backdrop-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"OCEAN",name:"Ocean",description:"",variants:[{id:"ocean",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"AQUARELLE",name:"Aquarelle",description:"Watercolor map for creative use",variants:[{id:"aquarelle",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"aquarelle-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"aquarelle-vivid",name:"Vivid",variantType:"VIVID",description:"",imageURL:""}]},{referenceStyleID:"LANDSCAPE",name:"Landscape",description:"Terrain map for data overlays and visualisations",variants:[{id:"landscape",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"landscape-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"landscape-vivid",name:"Vivid",variantType:"VIVID",description:"",imageURL:""}]}];function Ve(e){return new Proxy(e,{get(n,a,t){return n.hasVariant(a)?n.getVariant(a):a.toString().toUpperCase()===a?e.getDefaultVariant():Reflect.get(n,a,t)}})}function Be(){const e={};for(let n=0;n<k.length;n+=1){const a=k[n],t=Ve(new x(a.name,a.referenceStyleID));for(let o=0;o<a.variants.length;o+=1){const i=a.variants[o],r=new H(i.name,i.variantType,i.id,t,i.description,i.imageURL,i.deprecated);t.addVariant(r)}e[a.referenceStyleID]=t}return e}function P(e){if(!e)return oe[k[0].referenceStyleID].getDefaultVariant().getId();if(typeof e=="string"||e instanceof String)return e.trim().toLowerCase();if(e instanceof H)return e.getId();if(e instanceof x)return e.getDefaultVariant().getId()}const oe=Be();function Ge(e){const n=[];function a(i){(i.type==="LineString"||i.type==="MultiLineString")&&n.push(i)}function t(i){i.geometry&&a(i.geometry)}function o(i){for(const r of i.features)r.type==="Feature"?t(r):r.type==="FeatureCollection"&&o(r)}return e.type==="Feature"?t(e):e.type==="FeatureCollection"?o(e):a(e),n}function _e(e,n,a){let t=n[0],o=n[1],i=a[0]-t,r=a[1]-o;if(i!==0||r!==0){const s=((e[0]-t)*i+(e[1]-o)*r)/(i*i+r*r);s>1?(t=a[0],o=a[1]):s>0&&(t+=i*s,o+=r*s)}return i=e[0]-t,r=e[1]-o,i*i+r*r}function F(e,n,a,t,o){let i=t,r;for(let s=n+1;s<a;s++){const c=_e(e[s],e[n],e[a]);c>i&&(r=s,i=c)}i>t&&(r-n>1&&F(e,n,r,t,o),o.push(e[r]),a-r>1&&F(e,r,a,t,o))}function ze(e,n){const a=e.length-1,t=[e[0]];return F(e,0,a,n,t),t.push(e[a]),t}function We(e,n){if(e.length<=2)return e;const a=n!==void 0?n*n:1;return ze(e,a)}const re={extractLineStrings:Ge,simplify:We};function V(e,n=!0){let a=`${e[0]},${e[1]}`;return e.length===3&&n&&(a+=`,${e[2]}`),a}function B(e,n=3e3){let a=e.map(i=>i.join(",")).join("|"),t=5e-6;const o=1e-5;for(;a.length>n;)a=re.simplify(e,t).map(i=>`${i[0]},${i[1]}`).join("|"),t+=o;return a}function Je(e,n,a={}){const t=P(a.style),o=a.hiDPI?"@2x":"",i=a.format??"png";let r=~~(a.width??1024),s=~~(a.height??1024);a.hiDPI&&(r=~~(r/2),s=~~(s/2));const c=new URL(`maps/${encodeURIComponent(t)}/static/${e[0]},${e[1]},${n}/${r}x${s}${o}.${i}`,p.maptilerApiURL);if("attribution"in a&&c.searchParams.set("attribution",a.attribution.toString()),"markers"in a){let d="";const g="markerIcon"in a;g&&(d+=`icon:${a.markerIcon}|`),g&&"markerAnchor"in a&&(d+=`anchor:${a.markerAnchor}|`),g&&a.hiDPI&&(d+="scale:2|");const u=Array.isArray(a.markers[0])?a.markers:[a.markers];d+=u.map(L=>V(L,!g)).join("|"),c.searchParams.set("markers",d)}if("path"in a){let d="";if(d+=`fill:${a.pathFillColor??"none"}|`,"pathStrokeColor"in a&&(d+=`stroke:${a.pathStrokeColor}|`),"pathWidth"in a){const g=a.pathWidth/(a.hiDPI?2:1);d+=`width:${g.toString()}|`}d+=B(a.path),c.searchParams.set("path",d)}return c.searchParams.set("key",a.apiKey??m.apiKey),c.toString()}function qe(e,n={}){const a=P(n.style),t=n.hiDPI?"@2x":"",o=n.format??"png";let i=~~(n.width??1024),r=~~(n.height??1024);n.hiDPI&&(i=~~(i/2),r=~~(r/2));const s=new URL(`maps/${encodeURIComponent(a)}/static/${e[0]},${e[1]},${e[2]},${e[3]}/${i}x${r}${t}.${o}`,p.maptilerApiURL);if("attribution"in n&&s.searchParams.set("attribution",n.attribution.toString()),"padding"in n&&s.searchParams.set("padding",n.padding.toString()),"markers"in n){let c="";const d="markerIcon"in n;d&&(c+=`icon:${n.markerIcon}|`),d&&"markerAnchor"in n&&(c+=`anchor:${n.markerAnchor}|`),d&&n.hiDPI&&(c+="scale:2|");const g=Array.isArray(n.markers[0])?n.markers:[n.markers];c+=g.map(u=>V(u,!d)).join("|"),s.searchParams.set("markers",c)}if("path"in n){let c="";if(c+=`fill:${n.pathFillColor??"none"}|`,"pathStrokeColor"in n&&(c+=`stroke:${n.pathStrokeColor}|`),"pathWidth"in n){const d=n.pathWidth/(n.hiDPI?2:1);c+=`width:${d.toString()}|`}c+=B(n.path),s.searchParams.set("path",c)}return s.searchParams.set("key",n.apiKey??m.apiKey),s.toString()}function Ye(e={}){if(!("markers"in e)&&!("path"in e))throw new Error("Automatic static maps require markers and/or path to be created.");const n=P(e.style),a=e.hiDPI?"@2x":"",t=e.format??"png";let o=~~(e.width??1024),i=~~(e.height??1024);e.hiDPI&&(o=~~(o/2),i=~~(i/2));const r=new URL(`maps/${encodeURIComponent(n)}/static/auto/${o}x${i}${a}.${t}`,p.maptilerApiURL);if("attribution"in e&&r.searchParams.set("attribution",e.attribution.toString()),"padding"in e&&r.searchParams.set("padding",e.padding.toString()),"markers"in e){let s="";const c="markerIcon"in e;c&&(s+=`icon:${e.markerIcon}|`),c&&"markerAnchor"in e&&(s+=`anchor:${e.markerAnchor}|`),c&&e.hiDPI&&(s+="scale:2|");const d=Array.isArray(e.markers[0])?e.markers:[e.markers];s+=d.map(g=>V(g,!c)).join("|"),r.searchParams.set("markers",s)}if("path"in e){let s="";if(s+=`fill:${e.pathFillColor??"none"}|`,"pathStrokeColor"in e&&(s+=`stroke:${e.pathStrokeColor}|`),"pathWidth"in e){const c=e.pathWidth/(e.hiDPI?2:1);s+=`width:${c.toString()}|`}s+=B(e.path),r.searchParams.set("path",s)}return r.searchParams.set("key",e.apiKey??m.apiKey),r.toString()}const Ze={centered:Je,bounded:qe,automatic:Ye},N=63710088e-1,se=2*Math.PI*N;function ce(e){return(180+e)/360}function le(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function de(e){const n=pe(e);return[ce(n[0]),le(n[1])]}function ge(e){return e*360-180}function me(e){const n=180-e*360;return 360/Math.PI*Math.atan(Math.exp(n*Math.PI/180))-90}function Qe(e){return[ge(e[0]),me(e[1])]}function G(e,n){const a=Math.PI/180,t=e[1]*a,o=n[1]*a,i=Math.sin(t)*Math.sin(o)+Math.cos(t)*Math.cos(o)*Math.cos((n[0]-e[0])*a);return N*Math.acos(Math.min(i,1))}function Xe(e){const n=Array(e.length);n[0]=0;const a=n.length;for(let t=1;t<a;t++)n[t]=G(e[t-1],e[t])+n[t-1];return n}function pe(e){const n=e[0],a=e[1],t=360,o=((n+180)%t+t)%t-180;return[o===-180?180:o,a]}function fe(e){return se*Math.cos(e*Math.PI/180)}function he(e,n,a=!0){const t=2**n,o=[e[0]*t,e[1]*t];return a?[~~o[0],~~o[1]]:o}function en(e,n,a=!0){const t=de(e);return he(t,n,a)}function M(e){return e*Math.PI/180}function _(e){return e*180/Math.PI}function nn(e,n,a){const t=G(e,n),o=M(e[0]),i=M(e[1]),r=M(n[0]),s=M(n[1]),c=t/N,d=Math.sin((1-a)*c)/Math.sin(c),g=Math.sin(a*c)/Math.sin(c),u=d*Math.cos(i)*Math.cos(o)+g*Math.cos(s)*Math.cos(r),L=d*Math.cos(i)*Math.sin(o)+g*Math.cos(s)*Math.sin(r),v=d*Math.sin(i)+g*Math.sin(s),R=Math.atan2(v,Math.sqrt(u*u+L*L)),l=Math.atan2(L,u);return[_(l),_(R)]}const ue={EARTH_RADIUS:N,EARTH_CIRCUMFERENCE:se,longitudeToMercatorX:ce,latitudeToMercatorY:le,wgs84ToMercator:de,mercatorXToLongitude:ge,mercatorYToLatitude:me,mercatorToWgs84:Qe,haversineDistanceWgs84:G,wrapWgs84:pe,circumferenceAtLatitude:fe,mercatorToTileIndex:he,wgs84ToTileIndex:en,toRadians:M,toDegrees:_,haversineIntermediateWgs84:nn,haversineCumulatedDistanceWgs84:Xe};let z=null;function ye(){return z||(z=new we({maxSize:m.tileCacheSize})),z}async function Ae(e){const n=new Blob([e]),a=await createImageBitmap(n),t=document.createElement("canvas"),o=t.getContext("2d");t.width=a.width,t.height=a.height,o.drawImage(a,0,0);const i=o.getImageData(0,0,t.width,t.height);return{pixels:i.data,width:t.width,height:t.height,components:i.data.length/(t.width*t.height)}}function Le(){if(m.bufferToPixelData)return m.bufferToPixelData;if(typeof window<"u")return Ae;throw new Error("An image file buffer to pixel data parser is necessary. Specify it in `config.bufferToPixelData`")}function W(){return!!m.bufferToPixelData||typeof window<"u"}const an="terrain-rgb-v2",J=50,tn=1e3;let $=null;const Ie={403:"Key is missing, invalid or restricted"};async function on(e,n){e.length>tn&&console.warn("Computing elevation for complex geometries is discouraged - simplify the geometry before proceeding");const a=Math.ceil(e.length/J),t=Array.from({length:a},()=>null).map((i,r)=>{const s=r*J,c=e.slice(s,s+J).map(g=>g.join(",")).join(";"),d=new URL(`elevation/${c}.json`,p.maptilerApiURL);return d.searchParams.set("key",n),f(d.toString())}),o=await Promise.allSettled(t);return(await Promise.all(o.map(async i=>{if(i.status==="rejected")throw new Error(`Some segments could not be fetched, error: ${i.reason}`);if(!i.value.ok)throw new Error(`Some segments could not be fetched, response: ${i.value.status} ${await i.value.text()}, url: ${i.value.url}`);return i.value.json()}))).flat()}async function rn(e,n,a){if(!$){const l=new URL(`tiles/${an}/tiles.json`,p.maptilerApiURL);l.searchParams.set("key",n);const S=l.toString(),y=await f(S);if(y.ok)$=await y.json();else throw new h(y,Ie[y.status]??"")}const t=Le(),o=$.tiles[0],i=ye(),r=$.maxzoom;let s=~~(a??r);(s>r||s<0)&&(s=r);const c=e.map(l=>ue.wgs84ToTileIndex(l,s,!1)),d=c.map(l=>[~~l[0],~~l[1]]).map(l=>`terrain_${s.toString()}_${l[0].toString()}_${l[1].toString()}`),g=Array.from(new Set(d.filter(l=>!i.has(l)))).map(l=>l.split("_").slice(1)),u=g.map(l=>o.replace("{x}",l[1].toString()).replace("{y}",l[2].toString()).replace("{z}",l[0].toString())).map(l=>f(l)),L=(await Promise.allSettled(u)).map(l=>l.status==="fulfilled"?l.value:null).filter(l=>l),v=L.filter(l=>!l.ok);if(L.length!==u.length)throw new Error("Some tiles could not be fetched.");if(v.length)throw new h(v[0],Ie[v[0].status]??"");const R=await Promise.all(L.map(l=>l.arrayBuffer()));if(!R.every(l=>l.byteLength>0))throw new Error("Some tiles are not available.");return(await Promise.all(R.map(l=>t(l)))).forEach((l,S)=>{const y=g[S],w=`terrain_${y[0].toString()}_${y[1].toString()}_${y[2].toString()}`;i.set(w,l)}),e.map((l,S)=>{const y=d[S],w=c[S],I=i.get(y),Se=Math.min(Math.round(I.width*(w[0]%1)),I.width-1),C=(Math.min(Math.round(I.height*(w[1]%1)),I.height-1)*I.width+Se)*I.components,ve=I.pixels[C],Te=I.pixels[C+1],Me=I.pixels[C+2],Re=-1e4+(ve*256*256+Te*256+Me)*.1;return[l[0],l[1],~~(Re*1e3)/1e3]})}async function sn(e,n={}){return(await b([e],n))[0]}async function b(e,n={}){if(e.length===0)return[];const a=n.apiKey??m.apiKey,t=n.computeOn==="client"?await rn(e,a,n.zoom):await on(e,a);if(n.smoothingKernelSize){const o=~~(n.smoothingKernelSize/2)*2+1,i=t.map(s=>s[2]),r=~~(o/2);for(let s=r;s<i.length-r-1;s+=1){let c=0;for(let d=0;d<o;d+=1){const g=i[s-r+d];c+=g}c/=o,t[s][2]=c}}return t}async function cn(e,n={}){if(e.type!=="LineString")throw new Error("The provided object is not a GeoJSON LineString");n.computeOn??(n.computeOn=W()?"client":"server");const a=structuredClone(e),t=await b(a.coordinates,n);return a.coordinates=t,a}async function ln(e,n={}){if(e.type!=="MultiLineString")throw new Error("The provided object is not a GeoJSON MultiLineString");n.computeOn??(n.computeOn=W()?"client":"server");const a=structuredClone(e),t=a.coordinates.map(c=>c.length),o=a.coordinates.flat(),i=await b(o,n),r=[];let s=0;for(const c of t)r.push(i.slice(s,s+c)),s+=c;return a.coordinates=r,a}const dn={at:sn,batch:b,fromLineString:cn,fromMultiLineString:ln};export{q as ClientConfig,Z as ISOLanguage,A as Language,oe as MapStyle,H as MapStyleVariant,Y as NonISOLanguage,x as ReferenceMapStyle,h as ServiceError,Ue as areSameLanguages,Ae as bufferToPixelDataBrowser,W as canParsePixelData,fe as circumferenceAtLatitude,m as config,He as coordinates,Fe as data,dn as elevation,ie as expandMapStyle,be as geocoding,Ke as geolocation,K as getAutoLanguage,Le as getBufferToPixelDataParser,T as getLanguageInfoFromCode,D as getLanguageInfoFromFlag,Q as getLanguageInfoFromKey,ye as getTileCache,j as isLanguageInfo,k as mapStylePresetList,ue as math,re as misc,Ze as staticMaps,P as styleToStyle,O as toLanguageInfo};
1
+ import we from"quick-lru";function De(){return typeof self<"u"?fetch.bind(self):typeof global<"u"&&global.fetch?global.fetch:null}class q{constructor(){this._apiKey="",this._fetch=De(),this.tileCacheSize=200}set apiKey(a){this._apiKey=a}get apiKey(){return this._apiKey}set fetch(a){this._fetch=a}get fetch(){return this._fetch}}const m=new q,Y={AUTO:{code:null,flag:"auto",name:"Auto",latin:!1,isMode:!0,geocoding:!0},LATIN:{code:"latin",flag:"name:latin",name:"Latin",latin:!0,isMode:!1,geocoding:!1},NON_LATIN:{code:"nonlatin",flag:"name:nonlatin",name:"Non Latin",latin:!1,isMode:!1,geocoding:!1},LOCAL:{code:null,flag:"name",name:"Local",latin:!0,isMode:!1,geocoding:!1}},Z={ALBANIAN:{code:"sq",flag:"name:sq",name:"Albanian",latin:!0,isMode:!1,geocoding:!0},AMHARIC:{code:"am",flag:"name:am",name:"Amharic",latin:!1,isMode:!1,geocoding:!0},ARABIC:{code:"ar",flag:"name:ar",name:"Arabic",latin:!1,isMode:!1,geocoding:!0},ARMENIAN:{code:"hy",flag:"name:hy",name:"Armenian",latin:!1,isMode:!1,geocoding:!0},AZERBAIJANI:{code:"az",flag:"name:az",name:"Azerbaijani",latin:!0,isMode:!1,geocoding:!0},BASQUE:{code:"eu",flag:"name:eu",name:"Basque",latin:!0,isMode:!1,geocoding:!0},BELARUSIAN:{code:"be",flag:"name:be",name:"Belarusian",latin:!1,isMode:!1,geocoding:!0},BENGALI:{code:"bn",flag:"name:bn",name:"Bengali",latin:!0,isMode:!1,geocoding:!0},BOSNIAN:{code:"bs",flag:"name:bs",name:"Bosnian",latin:!0,isMode:!1,geocoding:!0},BRETON:{code:"br",flag:"name:br",name:"Breton",latin:!0,isMode:!1,geocoding:!0},BULGARIAN:{code:"bg",flag:"bg",name:"Bulgarian",latin:!1,isMode:!1,geocoding:!0},CATALAN:{code:"ca",flag:"name:ca",name:"Catalan",latin:!0,isMode:!1,geocoding:!0},CHINESE:{code:"zh",flag:"name:zh",name:"Chinese",latin:!1,isMode:!1,geocoding:!0},TRADITIONAL_CHINESE:{code:"zh-Hant",flag:"name:zh-Hant",name:"Chinese (traditional)",latin:!1,isMode:!1,geocoding:!1},SIMPLIFIED_CHINESE:{code:"zh-Hans",flag:"name:zh-Hans",name:"Chinese (simplified)",latin:!1,isMode:!1,geocoding:!1},CORSICAN:{code:"co",flag:"name:co",name:"Corsican",latin:!0,isMode:!1,geocoding:!0},CROATIAN:{code:"hr",flag:"name:hr",name:"Croatian",latin:!0,isMode:!1,geocoding:!0},CZECH:{code:"cs",flag:"name:cs",name:"Czech",latin:!0,isMode:!1,geocoding:!0},DANISH:{code:"da",flag:"name:da",name:"Danish",latin:!0,isMode:!1,geocoding:!0},DUTCH:{code:"nl",flag:"name:nl",name:"Dutch",latin:!0,isMode:!1,geocoding:!0},GERMAN:{code:"de",flag:"name:de",name:"German",latin:!0,isMode:!1,geocoding:!0},GREEK:{code:"el",flag:"name:el",name:"Greek",latin:!1,isMode:!1,geocoding:!0},ENGLISH:{code:"en",flag:"name:en",name:"English",latin:!0,isMode:!1,geocoding:!0},ESPERANTO:{code:"eo",flag:"name:eo",name:"Esperanto",latin:!0,isMode:!1,geocoding:!0},ESTONIAN:{code:"et",flag:"name:et",name:"Estonian",latin:!0,isMode:!1,geocoding:!0},FINNISH:{code:"fi",flag:"name:fi",name:"Finnish",latin:!0,isMode:!1,geocoding:!0},FRENCH:{code:"fr",flag:"name:fr",name:"French",latin:!0,isMode:!1,geocoding:!0},FRISIAN:{code:"fy",flag:"name:fy",name:"Frisian (West)",latin:!0,isMode:!1,geocoding:!0},GEORGIAN:{code:"ka",flag:"name:ka",name:"Georgian",latin:!1,isMode:!1,geocoding:!0},HEBREW:{code:"he",flag:"name:he",name:"Hebrew",latin:!1,isMode:!1,geocoding:!0},HINDI:{code:"hi",flag:"name:hi",name:"Hindi",latin:!1,isMode:!1,geocoding:!0},HUNGARIAN:{code:"hu",flag:"name:hu",name:"Hungarian",latin:!0,isMode:!1,geocoding:!0},ICELANDIC:{code:"is",flag:"name:is",name:"Icelandic",latin:!0,isMode:!1,geocoding:!0},INDONESIAN:{code:"id",flag:"name:id",name:"Indonesian",latin:!0,isMode:!1,geocoding:!0},IRISH:{code:"ga",flag:"name:ga",name:"Irish",latin:!0,isMode:!1,geocoding:!0},ITALIAN:{code:"it",flag:"name:it",name:"Italian",latin:!0,isMode:!1,geocoding:!0},JAPANESE:{code:"ja",flag:"name:ja",name:"Japanese",latin:!1,isMode:!1,geocoding:!0},JAPANESE_HIRAGANA:{code:"ja-Hira",flag:"name:ja-Hira",name:"Japanese Hiragana form",latin:!1,isMode:!1,geocoding:!1},JAPANESE_2018:{code:"ja-Latn",flag:"name:ja-Latn",name:"Japanese (Latin 2018)",latin:!0,isMode:!1,geocoding:!1},JAPANESE_KANA:{code:"ja_kana",flag:"name:ja_kana",name:"Japanese (Kana)",latin:!1,isMode:!1,geocoding:!1},JAPANESE_LATIN:{code:"ja_rm",flag:"name:ja_rm",name:"Japanese (Latin script)",latin:!0,isMode:!1,geocoding:!1},KANNADA:{code:"kn",flag:"name:kn",name:"Kannada",latin:!0,isMode:!1,geocoding:!0},KAZAKH:{code:"kk",flag:"name:kk",name:"Kazakh",latin:!1,isMode:!1,geocoding:!0},KOREAN:{code:"ko",flag:"name:ko",name:"Korean",latin:!1,isMode:!1,geocoding:!0},KOREAN_LATIN:{code:"ko-Latn",flag:"name:ko-Latn",name:"Korean (Latin script)",latin:!0,isMode:!1,geocoding:!1},KURDISH:{code:"ku",flag:"name:ku",name:"Kurdish",latin:!0,isMode:!1,geocoding:!0},CLASSICAL_LATIN:{code:"la",flag:"name:la",name:"Latin",latin:!0,isMode:!1,geocoding:!0},LATVIAN:{code:"lv",flag:"name:lv",name:"Latvian",latin:!0,isMode:!1,geocoding:!0},LITHUANIAN:{code:"lt",flag:"name:lt",name:"Lithuanian",latin:!0,isMode:!1,geocoding:!0},LUXEMBOURGISH:{code:"lb",flag:"name:lb",name:"Luxembourgish",latin:!0,isMode:!1,geocoding:!0},MACEDONIAN:{code:"mk",flag:"name:mk",name:"Macedonian",latin:!1,isMode:!1,geocoding:!0},MALAYALAM:{code:"ml",flag:"name:ml",name:"Malayalam",latin:!1,isMode:!1,geocoding:!0},MALTESE:{code:"mt",flag:"name:mt",name:"Maltese",latin:!0,isMode:!1,geocoding:!0},NORWEGIAN:{code:"no",flag:"name:no",name:"Norwegian",latin:!0,isMode:!1,geocoding:!0},OCCITAN:{code:"oc",flag:"name:oc",name:"Occitan",latin:!0,isMode:!1,geocoding:!0},PERSIAN:{code:"fa",flag:"name:fa",name:"Persian",latin:!1,isMode:!1,geocoding:!0},POLISH:{code:"pl",flag:"name:pl",name:"Polish",latin:!0,isMode:!1,geocoding:!0},PORTUGUESE:{code:"pt",flag:"name:pt",name:"Portuguese",latin:!0,isMode:!1,geocoding:!0},PUNJABI:{code:"pa",flag:"name:pa",name:"Punjabi",latin:!1,isMode:!1,geocoding:!0},WESTERN_PUNJABI:{code:"pnb",flag:"name:pnb",name:"Western Punjabi",latin:!1,isMode:!1,geocoding:!1},ROMANIAN:{code:"ro",flag:"name:ro",name:"Romanian",latin:!0,isMode:!1,geocoding:!0},ROMANSH:{code:"rm",flag:"name:rm",name:"Romansh",latin:!0,isMode:!1,geocoding:!0},RUSSIAN:{code:"ru",flag:"name:ru",name:"Russian",latin:!1,isMode:!1,geocoding:!0},SERBIAN_CYRILLIC:{code:"sr",flag:"name:sr",name:"Serbian (Cyrillic script)",latin:!1,isMode:!1,geocoding:!0},SERBIAN_LATIN:{code:"sr-Latn",flag:"name:sr-Latn",name:"Serbian (Latin script)",latin:!0,isMode:!1,geocoding:!1},SCOTTISH_GAELIC:{code:"gd",flag:"name:gd",name:"Scottish Gaelic",latin:!0,isMode:!1,geocoding:!0},SLOVAK:{code:"sk",flag:"name:sk",name:"Slovak",latin:!0,isMode:!1,geocoding:!0},SLOVENE:{code:"sl",flag:"name:sl",name:"Slovene",latin:!0,isMode:!1,geocoding:!0},SPANISH:{code:"es",flag:"name:es",name:"Spanish",latin:!0,isMode:!1,geocoding:!0},SWEDISH:{code:"sv",flag:"name:sv",name:"Swedish",latin:!0,isMode:!1,geocoding:!0},TAMIL:{code:"ta",flag:"name:ta",name:"Tamil",latin:!1,isMode:!1,geocoding:!0},TELUGU:{code:"te",flag:"name:te",name:"Telugu",latin:!1,isMode:!1,geocoding:!0},THAI:{code:"th",flag:"name:th",name:"Thai",latin:!1,isMode:!1,geocoding:!0},TURKISH:{code:"tr",flag:"name:tr",name:"Turkish",latin:!0,isMode:!1,geocoding:!0},UKRAINIAN:{code:"uk",flag:"name:uk",name:"Ukrainian",latin:!1,isMode:!1,geocoding:!0},VIETNAMESE:{code:"vi",flag:"name:vi",name:"Vietnamese (Latin script)",latin:!0,isMode:!1,geocoding:!0},WELSH:{code:"cy",flag:"name:cy",name:"Welsh",latin:!0,isMode:!1,geocoding:!0}},v={...Y,...Z};function Q(e,a=v){return e in a?e[e]:null}function T(e,a=v){for(const n of Object.values(a))if(n.code===e)return n;return null}function D(e,a=v){for(const n of Object.values(a))if(n.flag===e)return n;return null}function K(){if(typeof navigator>"u"){const e=Intl.DateTimeFormat().resolvedOptions().locale.split("-")[0];return T(e)??v.ENGLISH}return Array.from(new Set(navigator.languages.map(e=>e.split("-")[0]))).map(e=>T(e)).filter(e=>e)[0]??v.ENGLISH}function j(e){return e!==null&&typeof e=="object"&&"code"in e&&"flag"in e&&"name"in e&&"latin"in e&&"isMode"in e&&"geocoding"in e&&(typeof e.code=="string"||e.code===null)&&typeof e.flag=="string"&&typeof e.name=="string"&&typeof e.latin=="boolean"&&typeof e.isMode=="boolean"&&typeof e.geocoding=="boolean"}function O(e,a=v){return j(e)?D(e.flag,a):typeof e!="string"?null:Q(e,a)||T(e,a)||D(e,a)||null}function Ue(e,a,n=v){const t=O(e,n),o=O(a,n);return t&&o&&t.flag===o.flag}async function f(e,a={}){if(m.fetch===null)throw new Error("The fetch function was not found. If on NodeJS < 18 please specify the fetch function with config.fetch");if(new URL(e).searchParams.get("key").trim()==="")throw new Error("The MapTiler Cloud API key is missing. Set it in `config.apiKey` or get one for free at https://maptiler.com");return m.fetch(e,a)}const p={maptilerApiURL:"https://api.maptiler.com/",mapStyle:"streets-v2"};Object.freeze(p);class h extends Error{constructor(a,n=""){super(`Call to enpoint ${a.url} failed with the status code ${a.status}. ${n}`),this.res=a}}const U={400:"Query too long / Invalid parameters",403:"Key is missing, invalid or restricted"};function X(e,a){const{language:n}=a;if(n===void 0)return;const t=(Array.isArray(n)?n:[n]).map(i=>Ee(i)).filter(i=>i),o=Array.from(new Set(t)).join(",");e.set("language",o)}function Ee(e){const a=e===v.AUTO.flag?K():typeof e=="string"?T(e):j(e)?e.flag===v.AUTO.flag?K():D(e.flag):null;return a?.geocoding?a.code:null}function ee(e,a){const{apiKey:n,limit:t,types:o,excludeTypes:i}=a;e.set("key",n??m.apiKey),t!==void 0&&e.set("limit",String(t)),o!==void 0&&e.set("types",o.join(",")),i!==void 0&&e.set("excludeTypes",String(i)),X(e,a)}function ae(e,a){ee(e,a);const{bbox:n,proximity:t,country:o,fuzzyMatch:i,autocomplete:r}=a;n!==void 0&&e.set("bbox",n.join(",")),t!==void 0&&e.set("proximity",t==="ip"?t:t.join(",")),o!==void 0&&e.set("country",o.join(",")),i!==void 0&&e.set("fuzzyMatch",i?"true":"false"),r!==void 0&&e.set("autocomplete",r?"true":"false")}async function ke(e,a={}){if(typeof e!="string"||e.trim().length===0)throw new Error("The query must be a non-empty string");const n=new URL(`geocoding/${encodeURIComponent(e)}.json`,p.maptilerApiURL);ae(n.searchParams,a);const t=await f(n.toString());if(!t.ok)throw new h(t,U[t.status]??"");return await t.json()}async function Pe(e,a={}){if(!Array.isArray(e)||e.length<2)throw new Error("The position must be an array of form [lng, lat].");const n=new URL(`geocoding/${e[0]},${e[1]}.json`,p.maptilerApiURL);ee(n.searchParams,a);const t=await f(n.toString());if(!t.ok)throw new h(t,U[t.status]??"");return await t.json()}async function Ne(e,a={}){const n=new URL(`geocoding/${e}.json`,p.maptilerApiURL);n.searchParams.set("key",a.apiKey??m.apiKey),X(n.searchParams,a);const t=await f(n.toString());if(!t.ok)throw new h(t,U[t.status]??"");return await t.json()}async function $e(e,a={}){if(!e.length)return[];const n=e.map(r=>encodeURIComponent(r)).join(";"),t=new URL(`geocoding/${n}.json`,p.maptilerApiURL);ae(t.searchParams,a);const o=await f(t.toString());if(!o.ok)throw new h(o,U[o.status]??"");const i=await o.json();return e.length===1?[i]:i}const be={forward:ke,reverse:Pe,byId:Ne,batch:$e},ne={403:"Key is missing, invalid or restricted"};async function Ce(e={}){const a=new URL("geolocation/ip.json",p.maptilerApiURL);a.searchParams.set("key",e.apiKey??m.apiKey),"elevation"in e&&a.searchParams.set("elevation",e.elevation?"true":"false");const n=a.toString(),t=await f(n);if(!t.ok)throw new h(t,t.status in ne?ne[t.status]:"");return await t.json()}const Ke={info:Ce},E={403:"Key is missing, invalid or restricted"};async function je(e,a={}){if(typeof e!="string"||e.trim().length===0)throw new Error("The query must be a non-empty string");const n=new URL(`coordinates/search/${e}.json`,p.maptilerApiURL);n.searchParams.set("key",a.apiKey??m.apiKey),"limit"in a&&n.searchParams.set("limit",a.limit.toString()),"transformations"in a&&n.searchParams.set("transformations",a.transformations.toString()),"exports"in a&&n.searchParams.set("exports",a.exports.toString());const t=n.toString(),o=await f(t);if(!o.ok)throw new h(o,o.status in E?E[o.status]:"");return await o.json()}async function Oe(e,a={}){const n=(Array.isArray(e[0])?e:[e]).map(r=>`${r[0]},${r[1]}`).join(";"),t=new URL(`coordinates/transform/${n}.json`,p.maptilerApiURL);t.searchParams.set("key",a.apiKey??m.apiKey),"sourceCrs"in a&&t.searchParams.set("s_srs",a.sourceCrs.toString()),"targetCrs"in a&&t.searchParams.set("t_srs",a.targetCrs.toString()),"operations"in a&&t.searchParams.set("ops",(Array.isArray(a.operations)?a.operations:[a.operations]).join("|"));const o=t.toString(),i=await f(o);if(!i.ok)throw new h(i,i.status in E?E[i.status]:"");return await i.json()}const He={search:je,transform:Oe},te={403:"Key is missing, invalid or restricted"};async function Ve(e,a={}){if(typeof e!="string"||e.trim().length===0)throw new Error("The data ID must be a non-empty string");const n=new URL(`data/${encodeURIComponent(e)}/features.json`,p.maptilerApiURL);n.searchParams.set("key",a.apiKey??m.apiKey);const t=n.toString(),o=await f(t);if(!o.ok)throw new h(o,o.status in te?te[o.status]:"");return await o.json()}const xe={get:Ve};function ie(e){const a=/^maptiler:\/\/(.*)/;let n;const t=e.trim();let o;return t.startsWith("http://")||t.startsWith("https://")?o=t:(n=a.exec(t))!==null?o=`https://api.maptiler.com/maps/${n[1]}/style.json`:o=`https://api.maptiler.com/maps/${t}/style.json`,o}class H{constructor(a,n,t,o,i,r,s=!1,c){this.name=a,this.variantType=n,this.id=t,this.referenceStyle=o,this.description=i,this.imageURL=r,this.deprecated=s,this.deprecationMessage=c}getName(){return this.name}getFullName(){return`${this.referenceStyle.getName()} ${this.name}`}getType(){return this.variantType}getId(){return this.id}getDescription(){return this.description}getReferenceStyle(){return this.referenceStyle}hasVariant(a){return this.referenceStyle.hasVariant(a)}getVariant(a){const n=this.referenceStyle.getVariant(a);return this.warnIfDeprecated(n),n}getVariants(){return this.referenceStyle.getVariants().filter(a=>a!==this).map(a=>(this.warnIfDeprecated(a),a))}getImageURL(){return this.imageURL}getExpandedStyleURL(){return ie(this.getId())}warnIfDeprecated(a=this){if(!a.deprecated)return a;if(a.deprecationMessage)console.warn(a.deprecationMessage);else{const n=a.getFullName();console.warn(`Style "${n}" is deprecated and will be removed in a future version.`)}return a}}class V{constructor(a,n){this.name=a,this.id=n,this.variants={},this.orderedVariants=[]}getName(){return this.name}getId(){return this.id}addVariant(a){this.variants[a.getType()]=a,this.orderedVariants.push(a)}hasVariant(a){return a in this.variants}getVariant(a){return a in this.variants?this.variants[a]:this.orderedVariants[0]}getVariants(){return Object.values(this.variants)}getDefaultVariant(){return this.orderedVariants[0].warnIfDeprecated()}}const k=[{referenceStyleID:"STREETS",name:"Streets",description:"",variants:[{id:"streets-v4",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"streets-v4-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"streets-v4-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""},{id:"streets-v2",name:"Default v2",variantType:"DEFAULT_V2",description:"",imageURL:"",deprecated:!0,deprecationMessage:'"streets-v2" is deprecated, use "streets-v4" instead'},{id:"streets-v2-dark",name:"Dark v2",variantType:"DARK_V2",description:"",imageURL:"",deprecated:!0,deprecationMessage:'"streets-v2-dark" is deprecated, use "streets-v4-dark" instead'},{id:"streets-v2-light",name:"Light v2",variantType:"LIGHT_V2",description:"",imageURL:"",deprecated:!0,deprecationMessage:'"streets-v2-light" is deprecated, use "streets-v4-light" instead'},{id:"streets-v2-night",name:"Night v2",variantType:"NIGHT_V2",description:"",imageURL:"",deprecated:!0,deprecationMessage:'"streets-v2-night" is deprecated, use "streets-v4-night" instead'},{id:"streets-v2-pastel",name:"Pastel v2",variantType:"PASTEL_V2",description:"",imageURL:"",deprecated:!0,deprecationMessage:'"streets-v2-pastel" is deprecated, use "streets-v4-pastel" instead'}]},{referenceStyleID:"BASE",name:"Base",description:"",variants:[{id:"base-v4",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"base-v4-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"base-v4-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""},{id:"base-v4-ai",name:"Night",variantType:"NIGHT",description:"",imageURL:""}]},{referenceStyleID:"OUTDOOR",name:"Outdoor",description:"",variants:[{id:"outdoor-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"outdoor-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""}]},{referenceStyleID:"WINTER",name:"Winter",description:"",variants:[{id:"winter-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"winter-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""}]},{referenceStyleID:"SATELLITE",name:"Satellite",description:"",variants:[{id:"satellite",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"HYBRID",name:"Hybrid",description:"",variants:[{id:"hybrid",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"BASIC",name:"Basic",description:"",variants:[{id:"basic-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"basic-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"basic-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"BRIGHT",name:"Bright",description:"",variants:[{id:"bright-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"bright-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"bright-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""},{id:"bright-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""}]},{referenceStyleID:"OPENSTREETMAP",name:"OpenStreetMap",description:"",variants:[{id:"openstreetmap",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"TOPO",name:"Topo",description:"",variants:[{id:"topo-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"topo-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"topo-v2-shiny",name:"Shiny",deprecated:!0,variantType:"SHINY",description:"",imageURL:""},{id:"topo-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""},{id:"topo-v2-topographique",name:"Topographique",variantType:"TOPOGRAPHIQUE",description:"",imageURL:""}]},{referenceStyleID:"VOYAGER",name:"Voyager",description:"",variants:[{id:"voyager-v2",name:"Default",deprecated:!0,variantType:"DEFAULT",description:"",imageURL:""},{id:"voyager-v2-darkmatter",name:"Darkmatter",deprecated:!0,variantType:"DARK",description:"",imageURL:""},{id:"voyager-v2-positron",name:"Positron",deprecated:!0,variantType:"LIGHT",description:"",imageURL:""},{id:"voyager-v2-vintage",name:"Vintage",deprecated:!0,variantType:"VINTAGE",description:"",imageURL:""}]},{referenceStyleID:"TONER",name:"Toner",description:"",variants:[{id:"toner-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"toner-v2-background",name:"Background",variantType:"BACKGROUND",deprecated:!0,description:"",imageURL:""},{id:"toner-v2-lite",name:"Lite",variantType:"LITE",description:"",imageURL:""},{id:"toner-v2-lines",name:"Lines",variantType:"LINES",deprecated:!0,description:"",imageURL:""}]},{referenceStyleID:"DATAVIZ",name:"Dataviz",description:"",variants:[{id:"dataviz",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"dataviz-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"dataviz-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"BACKDROP",name:"Backdrop",description:"",variants:[{id:"backdrop",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"backdrop-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"backdrop-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"OCEAN",name:"Ocean",description:"",variants:[{id:"ocean",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"AQUARELLE",name:"Aquarelle",description:"Watercolor map for creative use",variants:[{id:"aquarelle",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"aquarelle-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"aquarelle-vivid",name:"Vivid",variantType:"VIVID",description:"",imageURL:""}]},{referenceStyleID:"LANDSCAPE",name:"Landscape",description:"Terrain map for data overlays and visualisations",variants:[{id:"landscape-v4",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"landscape-v4-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"landscape-v4-vivid",name:"Vivid",variantType:"VIVID",description:"",imageURL:""},{id:"landscape",name:"Default",variantType:"DEFAULT_V2",description:"",imageURL:"",deprecated:!0,deprecationMessage:'"landscape" is deprecated, use "landscape-v4" instead'},{id:"landscape-dark",name:"Dark",variantType:"DARK_V2",description:"",imageURL:"",deprecated:!0,deprecationMessage:'"landscape-dark" is deprecated, use "landscape-v4-dark" instead'},{id:"landscape-vivid",name:"Vivid",variantType:"VIVID_V2",description:"",imageURL:"",deprecated:!0,deprecationMessage:'"landscape-vivid" is deprecated, use "landscape-v4-vivid" instead'}]}];function Fe(e){return new Proxy(e,{get(a,n,t){return a.hasVariant(n)?a.getVariant(n):n.toString().toUpperCase()===n?e.getDefaultVariant():Reflect.get(a,n,t)}})}function _e(){const e={};for(let a=0;a<k.length;a+=1){const n=k[a],t=Fe(new V(n.name,n.referenceStyleID));for(let o=0;o<n.variants.length;o+=1){const i=n.variants[o],r=new H(i.name,i.variantType,i.id,t,i.description,i.imageURL,i.deprecated);t.addVariant(r)}e[n.referenceStyleID]=t}return e}function P(e){if(!e)return oe[k[0].referenceStyleID].getDefaultVariant().getId();if(typeof e=="string"||e instanceof String)return e.trim().toLowerCase();if(e instanceof H)return e.getId();if(e instanceof V)return e.getDefaultVariant().getId()}const oe=_e();function Be(e){const a=[];function n(i){(i.type==="LineString"||i.type==="MultiLineString")&&a.push(i)}function t(i){i.geometry&&n(i.geometry)}function o(i){for(const r of i.features)r.type==="Feature"?t(r):r.type==="FeatureCollection"&&o(r)}return e.type==="Feature"?t(e):e.type==="FeatureCollection"?o(e):n(e),a}function Ge(e,a,n){let t=a[0],o=a[1],i=n[0]-t,r=n[1]-o;if(i!==0||r!==0){const s=((e[0]-t)*i+(e[1]-o)*r)/(i*i+r*r);s>1?(t=n[0],o=n[1]):s>0&&(t+=i*s,o+=r*s)}return i=e[0]-t,r=e[1]-o,i*i+r*r}function x(e,a,n,t,o){let i=t,r;for(let s=a+1;s<n;s++){const c=Ge(e[s],e[a],e[n]);c>i&&(r=s,i=c)}i>t&&(r-a>1&&x(e,a,r,t,o),o.push(e[r]),n-r>1&&x(e,r,n,t,o))}function ze(e,a){const n=e.length-1,t=[e[0]];return x(e,0,n,a,t),t.push(e[n]),t}function We(e,a){if(e.length<=2)return e;const n=a!==void 0?a*a:1;return ze(e,n)}const re={extractLineStrings:Be,simplify:We};function F(e,a=!0){let n=`${e[0]},${e[1]}`;return e.length===3&&a&&(n+=`,${e[2]}`),n}function _(e,a=3e3){let n=e.map(i=>i.join(",")).join("|"),t=5e-6;const o=1e-5;for(;n.length>a;)n=re.simplify(e,t).map(i=>`${i[0]},${i[1]}`).join("|"),t+=o;return n}function Je(e,a,n={}){const t=P(n.style),o=n.hiDPI?"@2x":"",i=n.format??"png";let r=~~(n.width??1024),s=~~(n.height??1024);n.hiDPI&&(r=~~(r/2),s=~~(s/2));const c=new URL(`maps/${encodeURIComponent(t)}/static/${e[0]},${e[1]},${a}/${r}x${s}${o}.${i}`,p.maptilerApiURL);if("attribution"in n&&c.searchParams.set("attribution",n.attribution.toString()),"markers"in n){let l="";const g="markerIcon"in n;g&&(l+=`icon:${n.markerIcon}|`),g&&"markerAnchor"in n&&(l+=`anchor:${n.markerAnchor}|`),g&&n.hiDPI&&(l+="scale:2|");const u=Array.isArray(n.markers[0])?n.markers:[n.markers];l+=u.map(L=>F(L,!g)).join("|"),c.searchParams.set("markers",l)}if("path"in n){let l="";if(l+=`fill:${n.pathFillColor??"none"}|`,"pathStrokeColor"in n&&(l+=`stroke:${n.pathStrokeColor}|`),"pathWidth"in n){const g=n.pathWidth/(n.hiDPI?2:1);l+=`width:${g.toString()}|`}l+=_(n.path),c.searchParams.set("path",l)}return c.searchParams.set("key",n.apiKey??m.apiKey),c.toString()}function qe(e,a={}){const n=P(a.style),t=a.hiDPI?"@2x":"",o=a.format??"png";let i=~~(a.width??1024),r=~~(a.height??1024);a.hiDPI&&(i=~~(i/2),r=~~(r/2));const s=new URL(`maps/${encodeURIComponent(n)}/static/${e[0]},${e[1]},${e[2]},${e[3]}/${i}x${r}${t}.${o}`,p.maptilerApiURL);if("attribution"in a&&s.searchParams.set("attribution",a.attribution.toString()),"padding"in a&&s.searchParams.set("padding",a.padding.toString()),"markers"in a){let c="";const l="markerIcon"in a;l&&(c+=`icon:${a.markerIcon}|`),l&&"markerAnchor"in a&&(c+=`anchor:${a.markerAnchor}|`),l&&a.hiDPI&&(c+="scale:2|");const g=Array.isArray(a.markers[0])?a.markers:[a.markers];c+=g.map(u=>F(u,!l)).join("|"),s.searchParams.set("markers",c)}if("path"in a){let c="";if(c+=`fill:${a.pathFillColor??"none"}|`,"pathStrokeColor"in a&&(c+=`stroke:${a.pathStrokeColor}|`),"pathWidth"in a){const l=a.pathWidth/(a.hiDPI?2:1);c+=`width:${l.toString()}|`}c+=_(a.path),s.searchParams.set("path",c)}return s.searchParams.set("key",a.apiKey??m.apiKey),s.toString()}function Ye(e={}){if(!("markers"in e)&&!("path"in e))throw new Error("Automatic static maps require markers and/or path to be created.");const a=P(e.style),n=e.hiDPI?"@2x":"",t=e.format??"png";let o=~~(e.width??1024),i=~~(e.height??1024);e.hiDPI&&(o=~~(o/2),i=~~(i/2));const r=new URL(`maps/${encodeURIComponent(a)}/static/auto/${o}x${i}${n}.${t}`,p.maptilerApiURL);if("attribution"in e&&r.searchParams.set("attribution",e.attribution.toString()),"padding"in e&&r.searchParams.set("padding",e.padding.toString()),"markers"in e){let s="";const c="markerIcon"in e;c&&(s+=`icon:${e.markerIcon}|`),c&&"markerAnchor"in e&&(s+=`anchor:${e.markerAnchor}|`),c&&e.hiDPI&&(s+="scale:2|");const l=Array.isArray(e.markers[0])?e.markers:[e.markers];s+=l.map(g=>F(g,!c)).join("|"),r.searchParams.set("markers",s)}if("path"in e){let s="";if(s+=`fill:${e.pathFillColor??"none"}|`,"pathStrokeColor"in e&&(s+=`stroke:${e.pathStrokeColor}|`),"pathWidth"in e){const c=e.pathWidth/(e.hiDPI?2:1);s+=`width:${c.toString()}|`}s+=_(e.path),r.searchParams.set("path",s)}return r.searchParams.set("key",e.apiKey??m.apiKey),r.toString()}const Ze={centered:Je,bounded:qe,automatic:Ye},N=63710088e-1,se=2*Math.PI*N;function ce(e){return(180+e)/360}function de(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function le(e){const a=pe(e);return[ce(a[0]),de(a[1])]}function ge(e){return e*360-180}function me(e){const a=180-e*360;return 360/Math.PI*Math.atan(Math.exp(a*Math.PI/180))-90}function Qe(e){return[ge(e[0]),me(e[1])]}function B(e,a){const n=Math.PI/180,t=e[1]*n,o=a[1]*n,i=Math.sin(t)*Math.sin(o)+Math.cos(t)*Math.cos(o)*Math.cos((a[0]-e[0])*n);return N*Math.acos(Math.min(i,1))}function Xe(e){const a=Array(e.length);a[0]=0;const n=a.length;for(let t=1;t<n;t++)a[t]=B(e[t-1],e[t])+a[t-1];return a}function pe(e){const a=e[0],n=e[1],t=360,o=((a+180)%t+t)%t-180;return[o===-180?180:o,n]}function fe(e){return se*Math.cos(e*Math.PI/180)}function he(e,a,n=!0){const t=2**a,o=[e[0]*t,e[1]*t];return n?[~~o[0],~~o[1]]:o}function ea(e,a,n=!0){const t=le(e);return he(t,a,n)}function M(e){return e*Math.PI/180}function G(e){return e*180/Math.PI}function aa(e,a,n){const t=B(e,a),o=M(e[0]),i=M(e[1]),r=M(a[0]),s=M(a[1]),c=t/N,l=Math.sin((1-n)*c)/Math.sin(c),g=Math.sin(n*c)/Math.sin(c),u=l*Math.cos(i)*Math.cos(o)+g*Math.cos(s)*Math.cos(r),L=l*Math.cos(i)*Math.sin(o)+g*Math.cos(s)*Math.sin(r),S=l*Math.sin(i)+g*Math.sin(s),R=Math.atan2(S,Math.sqrt(u*u+L*L)),d=Math.atan2(L,u);return[G(d),G(R)]}const ue={EARTH_RADIUS:N,EARTH_CIRCUMFERENCE:se,longitudeToMercatorX:ce,latitudeToMercatorY:de,wgs84ToMercator:le,mercatorXToLongitude:ge,mercatorYToLatitude:me,mercatorToWgs84:Qe,haversineDistanceWgs84:B,wrapWgs84:pe,circumferenceAtLatitude:fe,mercatorToTileIndex:he,wgs84ToTileIndex:ea,toRadians:M,toDegrees:G,haversineIntermediateWgs84:aa,haversineCumulatedDistanceWgs84:Xe};let z=null;function ye(){return z||(z=new we({maxSize:m.tileCacheSize})),z}async function ve(e){const a=new Blob([e]),n=await createImageBitmap(a),t=document.createElement("canvas"),o=t.getContext("2d");t.width=n.width,t.height=n.height,o.drawImage(n,0,0);const i=o.getImageData(0,0,t.width,t.height);return{pixels:i.data,width:t.width,height:t.height,components:i.data.length/(t.width*t.height)}}function Le(){if(m.bufferToPixelData)return m.bufferToPixelData;if(typeof window<"u")return ve;throw new Error("An image file buffer to pixel data parser is necessary. Specify it in `config.bufferToPixelData`")}function W(){return!!m.bufferToPixelData||typeof window<"u"}const na="terrain-rgb-v2",J=50,ta=1e3;let $=null;const Ae={403:"Key is missing, invalid or restricted"};async function ia(e,a){e.length>ta&&console.warn("Computing elevation for complex geometries is discouraged - simplify the geometry before proceeding");const n=Math.ceil(e.length/J),t=Array.from({length:n},()=>null).map((i,r)=>{const s=r*J,c=e.slice(s,s+J).map(g=>g.join(",")).join(";"),l=new URL(`elevation/${c}.json`,p.maptilerApiURL);return l.searchParams.set("key",a),f(l.toString())}),o=await Promise.allSettled(t);return(await Promise.all(o.map(async i=>{if(i.status==="rejected")throw new Error(`Some segments could not be fetched, error: ${i.reason}`);if(!i.value.ok)throw new Error(`Some segments could not be fetched, response: ${i.value.status} ${await i.value.text()}, url: ${i.value.url}`);return i.value.json()}))).flat()}async function oa(e,a,n){if(!$){const d=new URL(`tiles/${na}/tiles.json`,p.maptilerApiURL);d.searchParams.set("key",a);const I=d.toString(),y=await f(I);if(y.ok)$=await y.json();else throw new h(y,Ae[y.status]??"")}const t=Le(),o=$.tiles[0],i=ye(),r=$.maxzoom;let s=~~(n??r);(s>r||s<0)&&(s=r);const c=e.map(d=>ue.wgs84ToTileIndex(d,s,!1)),l=c.map(d=>[~~d[0],~~d[1]]).map(d=>`terrain_${s.toString()}_${d[0].toString()}_${d[1].toString()}`),g=Array.from(new Set(l.filter(d=>!i.has(d)))).map(d=>d.split("_").slice(1)),u=g.map(d=>o.replace("{x}",d[1].toString()).replace("{y}",d[2].toString()).replace("{z}",d[0].toString())).map(d=>f(d)),L=(await Promise.allSettled(u)).map(d=>d.status==="fulfilled"?d.value:null).filter(d=>d),S=L.filter(d=>!d.ok);if(L.length!==u.length)throw new Error("Some tiles could not be fetched.");if(S.length)throw new h(S[0],Ae[S[0].status]??"");const R=await Promise.all(L.map(d=>d.arrayBuffer()));if(!R.every(d=>d.byteLength>0))throw new Error("Some tiles are not available.");return(await Promise.all(R.map(d=>t(d)))).forEach((d,I)=>{const y=g[I],w=`terrain_${y[0].toString()}_${y[1].toString()}_${y[2].toString()}`;i.set(w,d)}),e.map((d,I)=>{const y=l[I],w=c[I],A=i.get(y),Ie=Math.min(Math.round(A.width*(w[0]%1)),A.width-1),C=(Math.min(Math.round(A.height*(w[1]%1)),A.height-1)*A.width+Ie)*A.components,Se=A.pixels[C],Te=A.pixels[C+1],Me=A.pixels[C+2],Re=-1e4+(Se*256*256+Te*256+Me)*.1;return[d[0],d[1],~~(Re*1e3)/1e3]})}async function ra(e,a={}){return(await b([e],a))[0]}async function b(e,a={}){if(e.length===0)return[];const n=a.apiKey??m.apiKey,t=a.computeOn==="client"?await oa(e,n,a.zoom):await ia(e,n);if(a.smoothingKernelSize){const o=~~(a.smoothingKernelSize/2)*2+1,i=t.map(s=>s[2]),r=~~(o/2);for(let s=r;s<i.length-r-1;s+=1){let c=0;for(let l=0;l<o;l+=1){const g=i[s-r+l];c+=g}c/=o,t[s][2]=c}}return t}async function sa(e,a={}){if(e.type!=="LineString")throw new Error("The provided object is not a GeoJSON LineString");a.computeOn??(a.computeOn=W()?"client":"server");const n=structuredClone(e),t=await b(n.coordinates,a);return n.coordinates=t,n}async function ca(e,a={}){if(e.type!=="MultiLineString")throw new Error("The provided object is not a GeoJSON MultiLineString");a.computeOn??(a.computeOn=W()?"client":"server");const n=structuredClone(e),t=n.coordinates.map(c=>c.length),o=n.coordinates.flat(),i=await b(o,a),r=[];let s=0;for(const c of t)r.push(i.slice(s,s+c)),s+=c;return n.coordinates=r,n}const da={at:ra,batch:b,fromLineString:sa,fromMultiLineString:ca};export{q as ClientConfig,Z as ISOLanguage,v as Language,oe as MapStyle,H as MapStyleVariant,Y as NonISOLanguage,V as ReferenceMapStyle,h as ServiceError,Ue as areSameLanguages,ve as bufferToPixelDataBrowser,W as canParsePixelData,fe as circumferenceAtLatitude,m as config,He as coordinates,xe as data,da as elevation,ie as expandMapStyle,be as geocoding,Ke as geolocation,K as getAutoLanguage,Le as getBufferToPixelDataParser,T as getLanguageInfoFromCode,D as getLanguageInfoFromFlag,Q as getLanguageInfoFromKey,ye as getTileCache,j as isLanguageInfo,k as mapStylePresetList,ue as math,re as misc,Ze as staticMaps,P as styleToStyle,O as toLanguageInfo};
@@ -1289,7 +1289,7 @@ function expandMapStyle(style) {
1289
1289
  return expandedStyle;
1290
1290
  }
1291
1291
  class MapStyleVariant {
1292
- constructor(name, variantType, id, referenceStyle, description, imageURL, deprecated = false) {
1292
+ constructor(name, variantType, id, referenceStyle, description, imageURL, deprecated = false, deprecationMessage) {
1293
1293
  this.name = name;
1294
1294
  this.variantType = variantType;
1295
1295
  this.id = id;
@@ -1297,6 +1297,7 @@ class MapStyleVariant {
1297
1297
  this.description = description;
1298
1298
  this.imageURL = imageURL;
1299
1299
  this.deprecated = deprecated;
1300
+ this.deprecationMessage = deprecationMessage;
1300
1301
  }
1301
1302
  /**
1302
1303
  * Get the human-friendly name
@@ -1382,10 +1383,14 @@ class MapStyleVariant {
1382
1383
  warnIfDeprecated(variant = this) {
1383
1384
  if (!variant.deprecated)
1384
1385
  return variant;
1385
- const name = variant.getFullName();
1386
- console.warn(
1387
- `Style "${name}" is deprecated and will be removed in a future version.`
1388
- );
1386
+ if (variant.deprecationMessage) {
1387
+ console.warn(variant.deprecationMessage);
1388
+ } else {
1389
+ const name = variant.getFullName();
1390
+ console.warn(
1391
+ `Style "${name}" is deprecated and will be removed in a future version.`
1392
+ );
1393
+ }
1389
1394
  return variant;
1390
1395
  }
1391
1396
  }
@@ -1463,37 +1468,103 @@ const mapStylePresetList = [
1463
1468
  description: "",
1464
1469
  variants: [
1465
1470
  {
1466
- id: "streets-v2",
1471
+ id: "streets-v4",
1467
1472
  name: "Default",
1468
1473
  variantType: "DEFAULT",
1469
1474
  description: "",
1470
1475
  imageURL: ""
1471
1476
  },
1472
1477
  {
1473
- id: "streets-v2-dark",
1478
+ id: "streets-v4-dark",
1474
1479
  name: "Dark",
1475
1480
  variantType: "DARK",
1476
1481
  description: "",
1477
1482
  imageURL: ""
1478
1483
  },
1479
1484
  {
1480
- id: "streets-v2-light",
1481
- name: "Light",
1482
- variantType: "LIGHT",
1485
+ id: "streets-v4-pastel",
1486
+ name: "Pastel",
1487
+ variantType: "PASTEL",
1483
1488
  description: "",
1484
1489
  imageURL: ""
1485
1490
  },
1491
+ {
1492
+ id: "streets-v2",
1493
+ name: "Default v2",
1494
+ variantType: "DEFAULT_V2",
1495
+ description: "",
1496
+ imageURL: "",
1497
+ deprecated: true,
1498
+ deprecationMessage: `"streets-v2" is deprecated, use "streets-v4" instead`
1499
+ },
1500
+ {
1501
+ id: "streets-v2-dark",
1502
+ name: "Dark v2",
1503
+ variantType: "DARK_V2",
1504
+ description: "",
1505
+ imageURL: "",
1506
+ deprecated: true,
1507
+ deprecationMessage: `"streets-v2-dark" is deprecated, use "streets-v4-dark" instead`
1508
+ },
1509
+ {
1510
+ id: "streets-v2-light",
1511
+ name: "Light v2",
1512
+ variantType: "LIGHT_V2",
1513
+ description: "",
1514
+ imageURL: "",
1515
+ deprecated: true,
1516
+ deprecationMessage: `"streets-v2-light" is deprecated, use "streets-v4-light" instead`
1517
+ },
1486
1518
  {
1487
1519
  id: "streets-v2-night",
1488
- name: "Night",
1489
- variantType: "NIGHT",
1520
+ name: "Night v2",
1521
+ variantType: "NIGHT_V2",
1490
1522
  description: "",
1491
- imageURL: ""
1523
+ imageURL: "",
1524
+ deprecated: true,
1525
+ deprecationMessage: `"streets-v2-night" is deprecated, use "streets-v4-night" instead`
1492
1526
  },
1493
1527
  {
1494
1528
  id: "streets-v2-pastel",
1495
- name: "Pastel",
1496
- variantType: "PASTEL",
1529
+ name: "Pastel v2",
1530
+ variantType: "PASTEL_V2",
1531
+ description: "",
1532
+ imageURL: "",
1533
+ deprecated: true,
1534
+ deprecationMessage: `"streets-v2-pastel" is deprecated, use "streets-v4-pastel" instead`
1535
+ }
1536
+ ]
1537
+ },
1538
+ {
1539
+ referenceStyleID: "BASE",
1540
+ name: "Base",
1541
+ description: "",
1542
+ variants: [
1543
+ {
1544
+ id: "base-v4",
1545
+ name: "Default",
1546
+ variantType: "DEFAULT",
1547
+ description: "",
1548
+ imageURL: ""
1549
+ },
1550
+ {
1551
+ id: "base-v4-dark",
1552
+ name: "Dark",
1553
+ variantType: "DARK",
1554
+ description: "",
1555
+ imageURL: ""
1556
+ },
1557
+ {
1558
+ id: "base-v4-light",
1559
+ name: "Light",
1560
+ variantType: "LIGHT",
1561
+ description: "",
1562
+ imageURL: ""
1563
+ },
1564
+ {
1565
+ id: "base-v4-ai",
1566
+ name: "Night",
1567
+ variantType: "NIGHT",
1497
1568
  description: "",
1498
1569
  imageURL: ""
1499
1570
  }
@@ -1562,7 +1633,6 @@ const mapStylePresetList = [
1562
1633
  variants: [
1563
1634
  {
1564
1635
  id: "hybrid",
1565
- deprecated: true,
1566
1636
  name: "Default",
1567
1637
  variantType: "DEFAULT",
1568
1638
  description: "",
@@ -1870,25 +1940,52 @@ const mapStylePresetList = [
1870
1940
  description: "Terrain map for data overlays and visualisations",
1871
1941
  variants: [
1872
1942
  {
1873
- id: "landscape",
1943
+ id: "landscape-v4",
1874
1944
  name: "Default",
1875
1945
  variantType: "DEFAULT",
1876
1946
  description: "",
1877
1947
  imageURL: ""
1878
1948
  },
1879
1949
  {
1880
- id: "landscape-dark",
1950
+ id: "landscape-v4-dark",
1881
1951
  name: "Dark",
1882
1952
  variantType: "DARK",
1883
1953
  description: "",
1884
1954
  imageURL: ""
1885
1955
  },
1886
1956
  {
1887
- id: "landscape-vivid",
1957
+ id: "landscape-v4-vivid",
1888
1958
  name: "Vivid",
1889
1959
  variantType: "VIVID",
1890
1960
  description: "",
1891
1961
  imageURL: ""
1962
+ },
1963
+ {
1964
+ id: "landscape",
1965
+ name: "Default",
1966
+ variantType: "DEFAULT_V2",
1967
+ description: "",
1968
+ imageURL: "",
1969
+ deprecated: true,
1970
+ deprecationMessage: `"landscape" is deprecated, use "landscape-v4" instead`
1971
+ },
1972
+ {
1973
+ id: "landscape-dark",
1974
+ name: "Dark",
1975
+ variantType: "DARK_V2",
1976
+ description: "",
1977
+ imageURL: "",
1978
+ deprecated: true,
1979
+ deprecationMessage: `"landscape-dark" is deprecated, use "landscape-v4-dark" instead`
1980
+ },
1981
+ {
1982
+ id: "landscape-vivid",
1983
+ name: "Vivid",
1984
+ variantType: "VIVID_V2",
1985
+ description: "",
1986
+ imageURL: "",
1987
+ deprecated: true,
1988
+ deprecationMessage: `"landscape-vivid" is deprecated, use "landscape-v4-vivid" instead`
1892
1989
  }
1893
1990
  ]
1894
1991
  }