@maptiler/client 2.6.0-rc.1 → 2.6.0-rc.3
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/.github/workflows/npm-publish-dry-run.yml +51 -0
- package/.github/workflows/npm-publish.yml +45 -5
- package/CHANGELOG.md +2 -1
- package/dist/maptiler-client.cjs +100 -54
- package/dist/maptiler-client.cjs.map +1 -1
- package/dist/maptiler-client.d.ts +50 -21
- package/dist/maptiler-client.min.mjs +1 -1
- package/dist/maptiler-client.mjs +100 -54
- package/dist/maptiler-client.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1568,7 +1568,11 @@ type MapStyleType = {
|
|
|
1568
1568
|
/**
|
|
1569
1569
|
* Suitable for navigation, with high level of detail on urban areas, plenty of POIs and 3D buildings
|
|
1570
1570
|
*/
|
|
1571
|
-
STREETS:
|
|
1571
|
+
STREETS: MapStyleType["STREETS_V2"];
|
|
1572
|
+
/**
|
|
1573
|
+
* Suitable for navigation, with high level of detail on urban areas, plenty of POIs and 3D buildings
|
|
1574
|
+
*/
|
|
1575
|
+
STREETS_V2: ReferenceMapStyle & {
|
|
1572
1576
|
/**
|
|
1573
1577
|
* Suitable for navigation, with high level of detail on urban areas, plenty of POIs and 3D buildings.
|
|
1574
1578
|
*/
|
|
@@ -1578,31 +1582,36 @@ type MapStyleType = {
|
|
|
1578
1582
|
*/
|
|
1579
1583
|
DARK: MapStyleVariant;
|
|
1580
1584
|
/**
|
|
1581
|
-
* Suitable for navigation, with high level of detail on urban areas, plenty of POIs and 3D buildings,
|
|
1585
|
+
* Suitable for navigation, with high level of detail on urban areas, plenty of POIs and 3D buildings, in light mode.
|
|
1582
1586
|
*/
|
|
1583
|
-
|
|
1587
|
+
LIGHT: MapStyleVariant;
|
|
1584
1588
|
/**
|
|
1585
|
-
*
|
|
1589
|
+
* Suitable for navigation, with high level of detail on urban areas, plenty of POIs and 3D buildings, in night mode.
|
|
1586
1590
|
*/
|
|
1587
|
-
|
|
1591
|
+
NIGHT: MapStyleVariant;
|
|
1588
1592
|
/**
|
|
1589
|
-
*
|
|
1593
|
+
* Suitable for navigation, with high level of detail on urban areas, plenty of POIs and 3D buildings, with a pastel color palette.
|
|
1590
1594
|
*/
|
|
1591
|
-
|
|
1595
|
+
PASTEL: MapStyleVariant;
|
|
1596
|
+
};
|
|
1597
|
+
/**
|
|
1598
|
+
* Suitable for navigation, with high level of detail on urban areas, plenty of POIs and 3D buildings
|
|
1599
|
+
*/
|
|
1600
|
+
STREETS_V4: ReferenceMapStyle & {
|
|
1592
1601
|
/**
|
|
1593
|
-
*
|
|
1602
|
+
* Suitable for navigation, with high level of detail on urban areas, plenty of POIs and 3D buildings.
|
|
1594
1603
|
*/
|
|
1595
|
-
|
|
1604
|
+
DEFAULT: MapStyleVariant;
|
|
1596
1605
|
/**
|
|
1597
|
-
*
|
|
1606
|
+
* Suitable for navigation, with high level of detail on urban areas, plenty of POIs and 3D buildings, in dark mode.
|
|
1598
1607
|
*/
|
|
1599
|
-
|
|
1608
|
+
DARK: MapStyleVariant;
|
|
1600
1609
|
/**
|
|
1601
|
-
*
|
|
1610
|
+
* Suitable for navigation, with high level of detail on urban areas, plenty of POIs and 3D buildings, with a pastel color palette.
|
|
1602
1611
|
*/
|
|
1603
|
-
|
|
1612
|
+
PASTEL: MapStyleVariant;
|
|
1604
1613
|
};
|
|
1605
|
-
|
|
1614
|
+
BASE_V4: ReferenceMapStyle & {
|
|
1606
1615
|
/**
|
|
1607
1616
|
* Light and informative map, for general use.
|
|
1608
1617
|
*/
|
|
@@ -1681,6 +1690,23 @@ type MapStyleType = {
|
|
|
1681
1690
|
*/
|
|
1682
1691
|
LIGHT: MapStyleVariant;
|
|
1683
1692
|
};
|
|
1693
|
+
/**
|
|
1694
|
+
* A minimalist street-oriented style without POI
|
|
1695
|
+
*/
|
|
1696
|
+
BASIC_V2: ReferenceMapStyle & {
|
|
1697
|
+
/**
|
|
1698
|
+
* A minimalist street-oriented style without POI
|
|
1699
|
+
*/
|
|
1700
|
+
DEFAULT: MapStyleVariant;
|
|
1701
|
+
/**
|
|
1702
|
+
* A minimalist street-oriented style without POI, in dark mode
|
|
1703
|
+
*/
|
|
1704
|
+
DARK: MapStyleVariant;
|
|
1705
|
+
/**
|
|
1706
|
+
* A minimalist street-oriented style without POI, in light mode
|
|
1707
|
+
*/
|
|
1708
|
+
LIGHT: MapStyleVariant;
|
|
1709
|
+
};
|
|
1684
1710
|
/**
|
|
1685
1711
|
* A bright street-oriented style, a nice alternative to `streets`
|
|
1686
1712
|
*/
|
|
@@ -1819,7 +1845,8 @@ type MapStyleType = {
|
|
|
1819
1845
|
*/
|
|
1820
1846
|
LIGHT: MapStyleVariant;
|
|
1821
1847
|
};
|
|
1822
|
-
LANDSCAPE:
|
|
1848
|
+
LANDSCAPE: MapStyleType["LANDSCAPE_V2"];
|
|
1849
|
+
LANDSCAPE_V2: ReferenceMapStyle & {
|
|
1823
1850
|
/**
|
|
1824
1851
|
* Light terrain map for data overlays and visualisations
|
|
1825
1852
|
*/
|
|
@@ -1832,18 +1859,20 @@ type MapStyleType = {
|
|
|
1832
1859
|
* Vivid terrain map for data overlays and visualisations
|
|
1833
1860
|
*/
|
|
1834
1861
|
VIVID: MapStyleVariant;
|
|
1862
|
+
};
|
|
1863
|
+
LANDSCAPE_V4: ReferenceMapStyle & {
|
|
1835
1864
|
/**
|
|
1836
|
-
*
|
|
1865
|
+
* Light terrain map for data overlays and visualisations
|
|
1837
1866
|
*/
|
|
1838
|
-
|
|
1867
|
+
DEFAULT: MapStyleVariant;
|
|
1839
1868
|
/**
|
|
1840
|
-
* Dark
|
|
1869
|
+
* Dark terrain map for data overlays and visualisations
|
|
1841
1870
|
*/
|
|
1842
|
-
|
|
1871
|
+
DARK: MapStyleVariant;
|
|
1843
1872
|
/**
|
|
1844
|
-
* Vivid
|
|
1873
|
+
* Vivid terrain map for data overlays and visualisations
|
|
1845
1874
|
*/
|
|
1846
|
-
|
|
1875
|
+
VIVID: MapStyleVariant;
|
|
1847
1876
|
};
|
|
1848
1877
|
/**
|
|
1849
1878
|
* 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(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};
|
|
1
|
+
import De from"quick-lru";function we(){return typeof self<"u"?fetch.bind(self):typeof global<"u"&&global.fetch?global.fetch:null}class q{constructor(){this._apiKey="",this._fetch=we(),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 M(e,a=v){for(const n of Object.values(a))if(n.code===e)return n;return null}function E(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 M(e)??v.ENGLISH}return Array.from(new Set(navigator.languages.map(e=>e.split("-")[0]))).map(e=>M(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)?E(e.flag,a):typeof e!="string"?null:Q(e,a)||M(e,a)||E(e,a)||null}function Ee(e,a,n=v){const t=O(e,n),i=O(a,n);return t&&i&&t.flag===i.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(o=>Ue(o)).filter(o=>o),i=Array.from(new Set(t)).join(",");e.set("language",i)}function Ue(e){const a=e===v.AUTO.flag?K():typeof e=="string"?M(e):j(e)?e.flag===v.AUTO.flag?K():E(e.flag):null;return a?.geocoding?a.code:null}function ee(e,a){const{apiKey:n,limit:t,types:i,excludeTypes:o}=a;e.set("key",n??m.apiKey),t!==void 0&&e.set("limit",String(t)),i!==void 0&&e.set("types",i.join(",")),o!==void 0&&e.set("excludeTypes",String(o)),X(e,a)}function ae(e,a){ee(e,a);const{bbox:n,proximity:t,country:i,fuzzyMatch:o,autocomplete:r}=a;n!==void 0&&e.set("bbox",n.join(",")),t!==void 0&&e.set("proximity",t==="ip"?t:t.join(",")),i!==void 0&&e.set("country",i.join(",")),o!==void 0&&e.set("fuzzyMatch",o?"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 i=await f(t.toString());if(!i.ok)throw new h(i,U[i.status]??"");const o=await i.json();return e.length===1?[o]:o}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},k={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(),i=await f(t);if(!i.ok)throw new h(i,i.status in k?k[i.status]:"");return await i.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 i=t.toString(),o=await f(i);if(!o.ok)throw new h(o,o.status in k?k[o.status]:"");return await o.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(),i=await f(t);if(!i.ok)throw new h(i,i.status in te?te[i.status]:"");return await i.json()}const xe={get:Ve};function ie(e){const a=/^maptiler:\/\/(.*)/;let n;const t=e.trim();let i;return t.startsWith("http://")||t.startsWith("https://")?i=t:(n=a.exec(t))!==null?i=`https://api.maptiler.com/maps/${n[1]}/style.json`:i=`https://api.maptiler.com/maps/${t}/style.json`,i}class H{constructor(a,n,t,i,o,r,s=!1,c){this.name=a,this.variantType=n,this.id=t,this.referenceStyle=i,this.description=o,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 S=[{referenceStyleID:"STREETS_V2",name:"Streets",description:"",variants:[{id:"streets-v2",name:"Default v2",variantType:"DEFAULT",description:"",imageURL:"",deprecated:!0,deprecationMessage:'"streets-v2" is deprecated, use "streets-v4" instead'},{id:"streets-v2-dark",name:"Dark v2",variantType:"DARK",description:"",imageURL:"",deprecated:!0,deprecationMessage:'"streets-v2-dark" is deprecated, use "streets-v4-dark" instead'},{id:"streets-v2-light",name:"Light v2",variantType:"LIGHT",description:"",imageURL:"",deprecated:!0,deprecationMessage:'"streets-v2-light" is deprecated, use "streets-v4-light" instead'},{id:"streets-v2-night",name:"Night v2",variantType:"NIGHT",description:"",imageURL:"",deprecated:!0,deprecationMessage:'"streets-v2-night" is deprecated, use "streets-v4-night" instead'},{id:"streets-v2-pastel",name:"Pastel v2",variantType:"PASTEL",description:"",imageURL:"",deprecated:!0,deprecationMessage:'"streets-v2-pastel" is deprecated, use "streets-v4-pastel" instead'}]},{referenceStyleID:"STREETS_V4",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:""}]},{referenceStyleID:"BASE_V4",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:"Base AI",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_V2",name:"Basic",description:"",variants:[{id:"basic-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:"",deprecated:!0,deprecationMessage:'"basic-v2" is deprecated, use "basic-v4" instead'},{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_V2",name:"Landscape",description:"Terrain map for data overlays and visualisations",variants:[{id:"landscape",name:"Default",variantType:"DEFAULT",description:"",imageURL:"",deprecated:!0,deprecationMessage:'"landscape" is deprecated, use "landscape-v4" instead'},{id:"landscape-dark",name:"Dark",variantType:"DARK",description:"",imageURL:"",deprecated:!0,deprecationMessage:'"landscape-dark" is deprecated, use "landscape-v4-dark" instead'},{id:"landscape-vivid",name:"Vivid",variantType:"VIVID",description:"",imageURL:"",deprecated:!0,deprecationMessage:'"landscape-vivid" is deprecated, use "landscape-v4-vivid" instead'}]},{referenceStyleID:"LANDSCAPE_V4",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:""}]}],Fe={STREETS:"STREETS_V2",BASIC:"BASIC_V2",LANDSCAPE:"LANDSCAPE_V2"};function _e(e,a){S.find(i=>i.referenceStyleID===e)&&console.warn(`Default reference style ${e} already exists, it will be overwritten...`);const n=S.find(i=>i.referenceStyleID===a);if(!n)throw new Error(`Versioned map style not found for reference style: ${a}`);const t={...n,referenceStyleID:e};S.push(t)}Object.entries(Fe).forEach(([e,a])=>{_e(e,a)});function Be(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 Ge(){const e={};for(let a=0;a<S.length;a+=1){const n=S[a],t=Be(new V(n.name,n.referenceStyleID));for(let i=0;i<n.variants.length;i+=1){const o=n.variants[i],r=new H(o.name,o.variantType,o.id,t,o.description,o.imageURL,o.deprecated);t.addVariant(r)}e[n.referenceStyleID]=t}return e}function P(e){if(!e)return oe[S[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=Ge();function ze(e){const a=[];function n(o){(o.type==="LineString"||o.type==="MultiLineString")&&a.push(o)}function t(o){o.geometry&&n(o.geometry)}function i(o){for(const r of o.features)r.type==="Feature"?t(r):r.type==="FeatureCollection"&&i(r)}return e.type==="Feature"?t(e):e.type==="FeatureCollection"?i(e):n(e),a}function We(e,a,n){let t=a[0],i=a[1],o=n[0]-t,r=n[1]-i;if(o!==0||r!==0){const s=((e[0]-t)*o+(e[1]-i)*r)/(o*o+r*r);s>1?(t=n[0],i=n[1]):s>0&&(t+=o*s,i+=r*s)}return o=e[0]-t,r=e[1]-i,o*o+r*r}function x(e,a,n,t,i){let o=t,r;for(let s=a+1;s<n;s++){const c=We(e[s],e[a],e[n]);c>o&&(r=s,o=c)}o>t&&(r-a>1&&x(e,a,r,t,i),i.push(e[r]),n-r>1&&x(e,r,n,t,i))}function Je(e,a){const n=e.length-1,t=[e[0]];return x(e,0,n,a,t),t.push(e[n]),t}function qe(e,a){if(e.length<=2)return e;const n=a!==void 0?a*a:1;return Je(e,n)}const re={extractLineStrings:ze,simplify:qe};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(o=>o.join(",")).join("|"),t=5e-6;const i=1e-5;for(;n.length>a;)n=re.simplify(e,t).map(o=>`${o[0]},${o[1]}`).join("|"),t+=i;return n}function Ye(e,a,n={}){const t=P(n.style),i=n.hiDPI?"@2x":"",o=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}${i}.${o}`,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(A=>F(A,!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 Ze(e,a={}){const n=P(a.style),t=a.hiDPI?"@2x":"",i=a.format??"png";let o=~~(a.width??1024),r=~~(a.height??1024);a.hiDPI&&(o=~~(o/2),r=~~(r/2));const s=new URL(`maps/${encodeURIComponent(n)}/static/${e[0]},${e[1]},${e[2]},${e[3]}/${o}x${r}${t}.${i}`,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 Qe(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 i=~~(e.width??1024),o=~~(e.height??1024);e.hiDPI&&(i=~~(i/2),o=~~(o/2));const r=new URL(`maps/${encodeURIComponent(a)}/static/auto/${i}x${o}${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 Xe={centered:Ye,bounded:Ze,automatic:Qe},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 ea(e){return[ge(e[0]),me(e[1])]}function B(e,a){const n=Math.PI/180,t=e[1]*n,i=a[1]*n,o=Math.sin(t)*Math.sin(i)+Math.cos(t)*Math.cos(i)*Math.cos((a[0]-e[0])*n);return N*Math.acos(Math.min(o,1))}function aa(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,i=((a+180)%t+t)%t-180;return[i===-180?180:i,n]}function fe(e){return se*Math.cos(e*Math.PI/180)}function he(e,a,n=!0){const t=2**a,i=[e[0]*t,e[1]*t];return n?[~~i[0],~~i[1]]:i}function na(e,a,n=!0){const t=le(e);return he(t,a,n)}function R(e){return e*Math.PI/180}function G(e){return e*180/Math.PI}function ta(e,a,n){const t=B(e,a),i=R(e[0]),o=R(e[1]),r=R(a[0]),s=R(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(o)*Math.cos(i)+g*Math.cos(s)*Math.cos(r),A=l*Math.cos(o)*Math.sin(i)+g*Math.cos(s)*Math.sin(r),T=l*Math.sin(o)+g*Math.sin(s),D=Math.atan2(T,Math.sqrt(u*u+A*A)),d=Math.atan2(A,u);return[G(d),G(D)]}const ue={EARTH_RADIUS:N,EARTH_CIRCUMFERENCE:se,longitudeToMercatorX:ce,latitudeToMercatorY:de,wgs84ToMercator:le,mercatorXToLongitude:ge,mercatorYToLatitude:me,mercatorToWgs84:ea,haversineDistanceWgs84:B,wrapWgs84:pe,circumferenceAtLatitude:fe,mercatorToTileIndex:he,wgs84ToTileIndex:na,toRadians:R,toDegrees:G,haversineIntermediateWgs84:ta,haversineCumulatedDistanceWgs84:aa};let z=null;function ye(){return z||(z=new De({maxSize:m.tileCacheSize})),z}async function ve(e){const a=new Blob([e]),n=await createImageBitmap(a),t=document.createElement("canvas"),i=t.getContext("2d");t.width=n.width,t.height=n.height,i.drawImage(n,0,0);const o=i.getImageData(0,0,t.width,t.height);return{pixels:o.data,width:t.width,height:t.height,components:o.data.length/(t.width*t.height)}}function Ae(){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 ia="terrain-rgb-v2",J=50,oa=1e3;let $=null;const Le={403:"Key is missing, invalid or restricted"};async function ra(e,a){e.length>oa&&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((o,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())}),i=await Promise.allSettled(t);return(await Promise.all(i.map(async o=>{if(o.status==="rejected")throw new Error(`Some segments could not be fetched, error: ${o.reason}`);if(!o.value.ok)throw new Error(`Some segments could not be fetched, response: ${o.value.status} ${await o.value.text()}, url: ${o.value.url}`);return o.value.json()}))).flat()}async function sa(e,a,n){if(!$){const d=new URL(`tiles/${ia}/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,Le[y.status]??"")}const t=Ae(),i=$.tiles[0],o=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=>!o.has(d)))).map(d=>d.split("_").slice(1)),u=g.map(d=>i.replace("{x}",d[1].toString()).replace("{y}",d[2].toString()).replace("{z}",d[0].toString())).map(d=>f(d)),A=(await Promise.allSettled(u)).map(d=>d.status==="fulfilled"?d.value:null).filter(d=>d),T=A.filter(d=>!d.ok);if(A.length!==u.length)throw new Error("Some tiles could not be fetched.");if(T.length)throw new h(T[0],Le[T[0].status]??"");const D=await Promise.all(A.map(d=>d.arrayBuffer()));if(!D.every(d=>d.byteLength>0))throw new Error("Some tiles are not available.");return(await Promise.all(D.map(d=>t(d)))).forEach((d,I)=>{const y=g[I],w=`terrain_${y[0].toString()}_${y[1].toString()}_${y[2].toString()}`;o.set(w,d)}),e.map((d,I)=>{const y=l[I],w=c[I],L=o.get(y),Se=Math.min(Math.round(L.width*(w[0]%1)),L.width-1),C=(Math.min(Math.round(L.height*(w[1]%1)),L.height-1)*L.width+Se)*L.components,Ie=L.pixels[C],Te=L.pixels[C+1],Me=L.pixels[C+2],Re=-1e4+(Ie*256*256+Te*256+Me)*.1;return[d[0],d[1],~~(Re*1e3)/1e3]})}async function ca(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 sa(e,n,a.zoom):await ra(e,n);if(a.smoothingKernelSize){const i=~~(a.smoothingKernelSize/2)*2+1,o=t.map(s=>s[2]),r=~~(i/2);for(let s=r;s<o.length-r-1;s+=1){let c=0;for(let l=0;l<i;l+=1){const g=o[s-r+l];c+=g}c/=i,t[s][2]=c}}return t}async function da(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 la(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),i=n.coordinates.flat(),o=await b(i,a),r=[];let s=0;for(const c of t)r.push(o.slice(s,s+c)),s+=c;return n.coordinates=r,n}const ga={at:ca,batch:b,fromLineString:da,fromMultiLineString:la};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,Ee as areSameLanguages,ve as bufferToPixelDataBrowser,W as canParsePixelData,fe as circumferenceAtLatitude,m as config,He as coordinates,xe as data,ga as elevation,ie as expandMapStyle,be as geocoding,Ke as geolocation,K as getAutoLanguage,Ae as getBufferToPixelDataParser,M as getLanguageInfoFromCode,E as getLanguageInfoFromFlag,Q as getLanguageInfoFromKey,ye as getTileCache,j as isLanguageInfo,S as mapStylePresetList,ue as math,re as misc,Xe as staticMaps,P as styleToStyle,O as toLanguageInfo};
|
package/dist/maptiler-client.mjs
CHANGED
|
@@ -1463,35 +1463,14 @@ class ReferenceMapStyle {
|
|
|
1463
1463
|
}
|
|
1464
1464
|
const mapStylePresetList = [
|
|
1465
1465
|
{
|
|
1466
|
-
referenceStyleID: "
|
|
1466
|
+
referenceStyleID: "STREETS_V2",
|
|
1467
1467
|
name: "Streets",
|
|
1468
1468
|
description: "",
|
|
1469
1469
|
variants: [
|
|
1470
|
-
{
|
|
1471
|
-
id: "streets-v4",
|
|
1472
|
-
name: "Default",
|
|
1473
|
-
variantType: "DEFAULT",
|
|
1474
|
-
description: "",
|
|
1475
|
-
imageURL: ""
|
|
1476
|
-
},
|
|
1477
|
-
{
|
|
1478
|
-
id: "streets-v4-dark",
|
|
1479
|
-
name: "Dark",
|
|
1480
|
-
variantType: "DARK",
|
|
1481
|
-
description: "",
|
|
1482
|
-
imageURL: ""
|
|
1483
|
-
},
|
|
1484
|
-
{
|
|
1485
|
-
id: "streets-v4-pastel",
|
|
1486
|
-
name: "Pastel",
|
|
1487
|
-
variantType: "PASTEL",
|
|
1488
|
-
description: "",
|
|
1489
|
-
imageURL: ""
|
|
1490
|
-
},
|
|
1491
1470
|
{
|
|
1492
1471
|
id: "streets-v2",
|
|
1493
1472
|
name: "Default v2",
|
|
1494
|
-
variantType: "
|
|
1473
|
+
variantType: "DEFAULT",
|
|
1495
1474
|
description: "",
|
|
1496
1475
|
imageURL: "",
|
|
1497
1476
|
deprecated: true,
|
|
@@ -1500,7 +1479,7 @@ const mapStylePresetList = [
|
|
|
1500
1479
|
{
|
|
1501
1480
|
id: "streets-v2-dark",
|
|
1502
1481
|
name: "Dark v2",
|
|
1503
|
-
variantType: "
|
|
1482
|
+
variantType: "DARK",
|
|
1504
1483
|
description: "",
|
|
1505
1484
|
imageURL: "",
|
|
1506
1485
|
deprecated: true,
|
|
@@ -1509,7 +1488,7 @@ const mapStylePresetList = [
|
|
|
1509
1488
|
{
|
|
1510
1489
|
id: "streets-v2-light",
|
|
1511
1490
|
name: "Light v2",
|
|
1512
|
-
variantType: "
|
|
1491
|
+
variantType: "LIGHT",
|
|
1513
1492
|
description: "",
|
|
1514
1493
|
imageURL: "",
|
|
1515
1494
|
deprecated: true,
|
|
@@ -1518,7 +1497,7 @@ const mapStylePresetList = [
|
|
|
1518
1497
|
{
|
|
1519
1498
|
id: "streets-v2-night",
|
|
1520
1499
|
name: "Night v2",
|
|
1521
|
-
variantType: "
|
|
1500
|
+
variantType: "NIGHT",
|
|
1522
1501
|
description: "",
|
|
1523
1502
|
imageURL: "",
|
|
1524
1503
|
deprecated: true,
|
|
@@ -1527,7 +1506,7 @@ const mapStylePresetList = [
|
|
|
1527
1506
|
{
|
|
1528
1507
|
id: "streets-v2-pastel",
|
|
1529
1508
|
name: "Pastel v2",
|
|
1530
|
-
variantType: "
|
|
1509
|
+
variantType: "PASTEL",
|
|
1531
1510
|
description: "",
|
|
1532
1511
|
imageURL: "",
|
|
1533
1512
|
deprecated: true,
|
|
@@ -1536,7 +1515,35 @@ const mapStylePresetList = [
|
|
|
1536
1515
|
]
|
|
1537
1516
|
},
|
|
1538
1517
|
{
|
|
1539
|
-
referenceStyleID: "
|
|
1518
|
+
referenceStyleID: "STREETS_V4",
|
|
1519
|
+
name: "Streets",
|
|
1520
|
+
description: "",
|
|
1521
|
+
variants: [
|
|
1522
|
+
{
|
|
1523
|
+
id: "streets-v4",
|
|
1524
|
+
name: "Default",
|
|
1525
|
+
variantType: "DEFAULT",
|
|
1526
|
+
description: "",
|
|
1527
|
+
imageURL: ""
|
|
1528
|
+
},
|
|
1529
|
+
{
|
|
1530
|
+
id: "streets-v4-dark",
|
|
1531
|
+
name: "Dark",
|
|
1532
|
+
variantType: "DARK",
|
|
1533
|
+
description: "",
|
|
1534
|
+
imageURL: ""
|
|
1535
|
+
},
|
|
1536
|
+
{
|
|
1537
|
+
id: "streets-v4-pastel",
|
|
1538
|
+
name: "Pastel",
|
|
1539
|
+
variantType: "PASTEL",
|
|
1540
|
+
description: "",
|
|
1541
|
+
imageURL: ""
|
|
1542
|
+
}
|
|
1543
|
+
]
|
|
1544
|
+
},
|
|
1545
|
+
{
|
|
1546
|
+
referenceStyleID: "BASE_V4",
|
|
1540
1547
|
name: "Base",
|
|
1541
1548
|
description: "",
|
|
1542
1549
|
variants: [
|
|
@@ -1563,7 +1570,7 @@ const mapStylePresetList = [
|
|
|
1563
1570
|
},
|
|
1564
1571
|
{
|
|
1565
1572
|
id: "base-v4-ai",
|
|
1566
|
-
name: "
|
|
1573
|
+
name: "Base AI",
|
|
1567
1574
|
variantType: "NIGHT",
|
|
1568
1575
|
description: "",
|
|
1569
1576
|
imageURL: ""
|
|
@@ -1641,7 +1648,7 @@ const mapStylePresetList = [
|
|
|
1641
1648
|
]
|
|
1642
1649
|
},
|
|
1643
1650
|
{
|
|
1644
|
-
referenceStyleID: "
|
|
1651
|
+
referenceStyleID: "BASIC_V2",
|
|
1645
1652
|
name: "Basic",
|
|
1646
1653
|
description: "",
|
|
1647
1654
|
variants: [
|
|
@@ -1650,7 +1657,9 @@ const mapStylePresetList = [
|
|
|
1650
1657
|
name: "Default",
|
|
1651
1658
|
variantType: "DEFAULT",
|
|
1652
1659
|
description: "",
|
|
1653
|
-
imageURL: ""
|
|
1660
|
+
imageURL: "",
|
|
1661
|
+
deprecated: true,
|
|
1662
|
+
deprecationMessage: `"basic-v2" is deprecated, use "basic-v4" instead`
|
|
1654
1663
|
},
|
|
1655
1664
|
{
|
|
1656
1665
|
id: "basic-v2-dark",
|
|
@@ -1935,61 +1944,98 @@ const mapStylePresetList = [
|
|
|
1935
1944
|
]
|
|
1936
1945
|
},
|
|
1937
1946
|
{
|
|
1938
|
-
referenceStyleID: "
|
|
1947
|
+
referenceStyleID: "LANDSCAPE_V2",
|
|
1939
1948
|
name: "Landscape",
|
|
1940
1949
|
description: "Terrain map for data overlays and visualisations",
|
|
1941
1950
|
variants: [
|
|
1942
1951
|
{
|
|
1943
|
-
id: "landscape
|
|
1952
|
+
id: "landscape",
|
|
1944
1953
|
name: "Default",
|
|
1945
1954
|
variantType: "DEFAULT",
|
|
1946
1955
|
description: "",
|
|
1947
|
-
imageURL: ""
|
|
1956
|
+
imageURL: "",
|
|
1957
|
+
deprecated: true,
|
|
1958
|
+
deprecationMessage: `"landscape" is deprecated, use "landscape-v4" instead`
|
|
1948
1959
|
},
|
|
1949
1960
|
{
|
|
1950
|
-
id: "landscape-
|
|
1961
|
+
id: "landscape-dark",
|
|
1951
1962
|
name: "Dark",
|
|
1952
1963
|
variantType: "DARK",
|
|
1953
1964
|
description: "",
|
|
1954
|
-
imageURL: ""
|
|
1965
|
+
imageURL: "",
|
|
1966
|
+
deprecated: true,
|
|
1967
|
+
deprecationMessage: `"landscape-dark" is deprecated, use "landscape-v4-dark" instead`
|
|
1955
1968
|
},
|
|
1956
1969
|
{
|
|
1957
|
-
id: "landscape-
|
|
1970
|
+
id: "landscape-vivid",
|
|
1958
1971
|
name: "Vivid",
|
|
1959
1972
|
variantType: "VIVID",
|
|
1960
1973
|
description: "",
|
|
1961
|
-
imageURL: ""
|
|
1962
|
-
|
|
1974
|
+
imageURL: "",
|
|
1975
|
+
deprecated: true,
|
|
1976
|
+
deprecationMessage: `"landscape-vivid" is deprecated, use "landscape-v4-vivid" instead`
|
|
1977
|
+
}
|
|
1978
|
+
]
|
|
1979
|
+
},
|
|
1980
|
+
{
|
|
1981
|
+
referenceStyleID: "LANDSCAPE_V4",
|
|
1982
|
+
name: "Landscape",
|
|
1983
|
+
description: "Terrain map for data overlays and visualisations",
|
|
1984
|
+
variants: [
|
|
1963
1985
|
{
|
|
1964
|
-
id: "landscape",
|
|
1986
|
+
id: "landscape-v4",
|
|
1965
1987
|
name: "Default",
|
|
1966
|
-
variantType: "
|
|
1988
|
+
variantType: "DEFAULT",
|
|
1967
1989
|
description: "",
|
|
1968
|
-
imageURL: ""
|
|
1969
|
-
deprecated: true,
|
|
1970
|
-
deprecationMessage: `"landscape" is deprecated, use "landscape-v4" instead`
|
|
1990
|
+
imageURL: ""
|
|
1971
1991
|
},
|
|
1972
1992
|
{
|
|
1973
|
-
id: "landscape-dark",
|
|
1993
|
+
id: "landscape-v4-dark",
|
|
1974
1994
|
name: "Dark",
|
|
1975
|
-
variantType: "
|
|
1995
|
+
variantType: "DARK",
|
|
1976
1996
|
description: "",
|
|
1977
|
-
imageURL: ""
|
|
1978
|
-
deprecated: true,
|
|
1979
|
-
deprecationMessage: `"landscape-dark" is deprecated, use "landscape-v4-dark" instead`
|
|
1997
|
+
imageURL: ""
|
|
1980
1998
|
},
|
|
1981
1999
|
{
|
|
1982
|
-
id: "landscape-vivid",
|
|
2000
|
+
id: "landscape-v4-vivid",
|
|
1983
2001
|
name: "Vivid",
|
|
1984
|
-
variantType: "
|
|
2002
|
+
variantType: "VIVID",
|
|
1985
2003
|
description: "",
|
|
1986
|
-
imageURL: ""
|
|
1987
|
-
deprecated: true,
|
|
1988
|
-
deprecationMessage: `"landscape-vivid" is deprecated, use "landscape-v4-vivid" instead`
|
|
2004
|
+
imageURL: ""
|
|
1989
2005
|
}
|
|
1990
2006
|
]
|
|
1991
2007
|
}
|
|
1992
2008
|
];
|
|
2009
|
+
const defaultReferenceStyleMap = {
|
|
2010
|
+
STREETS: "STREETS_V2",
|
|
2011
|
+
BASIC: "BASIC_V2",
|
|
2012
|
+
LANDSCAPE: "LANDSCAPE_V2"
|
|
2013
|
+
};
|
|
2014
|
+
function applyVersionToDefaultReferenceStyle(defaultKey, referenceKey) {
|
|
2015
|
+
if (mapStylePresetList.find((style) => style.referenceStyleID === defaultKey)) {
|
|
2016
|
+
console.warn(
|
|
2017
|
+
`Default reference style ${defaultKey} already exists, it will be overwritten...`
|
|
2018
|
+
);
|
|
2019
|
+
}
|
|
2020
|
+
const versionedMapStyle = mapStylePresetList.find(
|
|
2021
|
+
(style) => style.referenceStyleID === referenceKey
|
|
2022
|
+
);
|
|
2023
|
+
if (!versionedMapStyle) {
|
|
2024
|
+
throw new Error(
|
|
2025
|
+
`Versioned map style not found for reference style: ${referenceKey}`
|
|
2026
|
+
);
|
|
2027
|
+
}
|
|
2028
|
+
const defaultStyle = {
|
|
2029
|
+
...versionedMapStyle,
|
|
2030
|
+
referenceStyleID: defaultKey
|
|
2031
|
+
};
|
|
2032
|
+
mapStylePresetList.push(defaultStyle);
|
|
2033
|
+
}
|
|
2034
|
+
Object.entries(defaultReferenceStyleMap).forEach(
|
|
2035
|
+
([defaultKey, referenceKey]) => {
|
|
2036
|
+
applyVersionToDefaultReferenceStyle(defaultKey, referenceKey);
|
|
2037
|
+
}
|
|
2038
|
+
);
|
|
1993
2039
|
function makeReferenceStyleProxy(referenceStyle) {
|
|
1994
2040
|
return new Proxy(referenceStyle, {
|
|
1995
2041
|
get(target, prop, receiver) {
|