@maptiler/sdk 2.2.2 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/maptiler-sdk.mjs +874 -920
- package/dist/maptiler-sdk.mjs.map +1 -1
- package/dist/src/Map.d.ts +4 -4
- package/dist/src/MaptilerGeolocateControl.d.ts +1 -1
- package/dist/src/MaptilerNavigationControl.d.ts +2 -1
- package/dist/src/config.d.ts +3 -3
- package/dist/src/defaults.d.ts +2 -2
- package/dist/src/helpers/index.d.ts +2 -0
- package/dist/src/helpers/screenshot.d.ts +19 -0
- package/dist/src/index.d.ts +1 -1
- package/dist/src/language.d.ts +96 -130
- package/package.json +12 -10
- package/readme.md +31 -0
- package/vite.config-es.ts +1 -1
- package/vite.config-umd.ts +3 -1
package/dist/maptiler-sdk.mjs
CHANGED
|
@@ -4,14 +4,14 @@ var me = (r) => {
|
|
|
4
4
|
};
|
|
5
5
|
var at = (r, e, t) => e in r ? rt(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
6
6
|
var T = (r, e, t) => at(r, typeof e != "symbol" ? e + "" : e, t), re = (r, e, t) => e.has(r) || me("Cannot " + t);
|
|
7
|
-
var L = (r, e, t) => (re(r, e, "read from private field"), t ? t.call(r) : e.get(r)),
|
|
7
|
+
var L = (r, e, t) => (re(r, e, "read from private field"), t ? t.call(r) : e.get(r)), U = (r, e, t) => e.has(r) ? me("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t), $ = (r, e, t, o) => (re(r, e, "write to private field"), o ? o.call(r, t) : e.set(r, t), t), k = (r, e, t) => (re(r, e, "access private method"), t);
|
|
8
8
|
import f from "maplibre-gl";
|
|
9
|
-
import nt from "
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
import { v4 as
|
|
13
|
-
import { Base64 as
|
|
14
|
-
const
|
|
9
|
+
import { Language as nt, getLanguageInfoFromCode as fe, config as ae, MapStyle as lt, mapStylePresetList as it, expandMapStyle as st, MapStyleVariant as ct, ReferenceMapStyle as ut, getLanguageInfoFromFlag as dt, toLanguageInfo as pt, geolocation as ge } from "@maptiler/client";
|
|
10
|
+
import { MapStyle as oa, MapStyleVariant as ra, ReferenceMapStyle as aa, ServiceError as na, areSameLanguages as la, bufferToPixelDataBrowser as ia, circumferenceAtLatitude as sa, coordinates as ca, data as ua, elevation as da, expandMapStyle as pa, geocoding as ha, geolocation as ma, getAutoLanguage as fa, getBufferToPixelDataParser as ga, getLanguageInfoFromCode as ya, getLanguageInfoFromFlag as va, getLanguageInfoFromKey as La, getTileCache as wa, isLanguageInfo as Ca, mapStylePresetList as ba, math as Sa, misc as Aa, staticMaps as Ta, styleToStyle as Ra, toLanguageInfo as _a } from "@maptiler/client";
|
|
11
|
+
import ht from "events";
|
|
12
|
+
import { v4 as mt } from "uuid";
|
|
13
|
+
import { Base64 as ft } from "js-base64";
|
|
14
|
+
const gt = "@maptiler/sdk", yt = "2.3.0", vt = "The Javascript & TypeScript map SDK tailored for MapTiler Cloud", Lt = "dist/maptiler-sdk.mjs", wt = "dist/maptiler-sdk.d.ts", Ct = "dist/maptiler-sdk.css", bt = "module", St = {
|
|
15
15
|
".": {
|
|
16
16
|
import: "./dist/maptiler-sdk.mjs",
|
|
17
17
|
types: "./dist/maptiler-sdk.d.ts"
|
|
@@ -22,7 +22,7 @@ const ht = "@maptiler/sdk", mt = "2.2.2", ft = "The Javascript & TypeScript map
|
|
|
22
22
|
"./style.css": {
|
|
23
23
|
import: "./dist/maptiler-sdk.css"
|
|
24
24
|
}
|
|
25
|
-
},
|
|
25
|
+
}, At = [
|
|
26
26
|
"maptiler",
|
|
27
27
|
"map",
|
|
28
28
|
"sdk",
|
|
@@ -30,194 +30,106 @@ const ht = "@maptiler/sdk", mt = "2.2.2", ft = "The Javascript & TypeScript map
|
|
|
30
30
|
"cloud",
|
|
31
31
|
"webGL",
|
|
32
32
|
"maplibre"
|
|
33
|
-
],
|
|
33
|
+
], Tt = "https://docs.maptiler.com/sdk-js/", Rt = "BSD-3-Clause", _t = {
|
|
34
34
|
type: "git",
|
|
35
35
|
url: "https://github.com/maptiler/maptiler-sdk-js.git"
|
|
36
|
-
},
|
|
36
|
+
}, Et = {
|
|
37
37
|
biome: "biome check --max-diagnostics=1000",
|
|
38
38
|
"biome:fix": "npx @biomejs/biome check --max-diagnostics=1000 --write",
|
|
39
39
|
doc: "rm -rf docs/* && typedoc --out docs && cp -r images docs/",
|
|
40
40
|
test: "vitest run",
|
|
41
41
|
"build-css": "node scripts/replace-path-with-content.js src/style/style_template.css dist/tmp_maptiler-sdk.css && cat node_modules/maplibre-gl/dist/maplibre-gl.css dist/tmp_maptiler-sdk.css > dist/maptiler-sdk.css && rm dist/tmp_maptiler-sdk.css && cp dist/maptiler-sdk.css build/maptiler-sdk.css",
|
|
42
|
-
"build-umd": "NODE_ENV=production
|
|
43
|
-
"build-es": "NODE_ENV=production
|
|
42
|
+
"build-umd": "tsc && NODE_ENV=production vite build -c vite.config-umd.ts",
|
|
43
|
+
"build-es": "tsc && NODE_ENV=production vite build -c vite.config-es.ts",
|
|
44
44
|
build: "npm run build-es; npm run build-umd; npm run build-css",
|
|
45
|
-
make: "npm run biome:fix && npm run build"
|
|
46
|
-
|
|
45
|
+
make: "npm run biome:fix && npm run build",
|
|
46
|
+
"dev-umd": "npm run build-css && tsc && NODE_ENV=dev vite build -w -c vite.config-umd.ts",
|
|
47
|
+
help: "vite build --help"
|
|
48
|
+
}, xt = "MapTiler", It = {
|
|
47
49
|
"@biomejs/biome": "1.8.3",
|
|
48
50
|
"@types/uuid": "^9.0.2",
|
|
49
51
|
"@types/xmldom": "^0.1.31",
|
|
52
|
+
"@xmldom/xmldom": "^0.8.10",
|
|
50
53
|
serve: "^14.2.0",
|
|
51
54
|
terser: "^5.17.1",
|
|
52
55
|
typedoc: "^0.24.8",
|
|
53
56
|
typescript: "^5.1.6",
|
|
54
|
-
vitest: "^0.34.2",
|
|
55
57
|
vite: "^5.3.4",
|
|
56
|
-
"vite-plugin-dts": "^4.0.0-beta.0"
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
"vite-plugin-dts": "^4.0.0-beta.0",
|
|
59
|
+
vitest: "^0.34.2"
|
|
60
|
+
}, Mt = {
|
|
61
|
+
"@maptiler/client": "^2.0.0",
|
|
59
62
|
events: "^3.3.0",
|
|
60
63
|
"js-base64": "^3.7.4",
|
|
61
|
-
"maplibre-gl": "4.
|
|
62
|
-
uuid: "^9.0.0"
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
author: Et,
|
|
64
|
+
"maplibre-gl": "^4.7.0",
|
|
65
|
+
uuid: "^9.0.0"
|
|
66
|
+
}, Pt = {
|
|
67
|
+
name: gt,
|
|
68
|
+
version: yt,
|
|
69
|
+
description: vt,
|
|
70
|
+
module: Lt,
|
|
71
|
+
types: wt,
|
|
72
|
+
style: Ct,
|
|
73
|
+
type: bt,
|
|
74
|
+
exports: St,
|
|
75
|
+
keywords: At,
|
|
76
|
+
homepage: Tt,
|
|
77
|
+
license: Rt,
|
|
78
|
+
repository: _t,
|
|
79
|
+
scripts: Et,
|
|
80
|
+
author: xt,
|
|
79
81
|
devDependencies: It,
|
|
80
|
-
dependencies:
|
|
82
|
+
dependencies: Mt
|
|
81
83
|
}, C = {
|
|
82
84
|
/**
|
|
83
|
-
*
|
|
84
|
-
* Note
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
*
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
*/
|
|
124
|
-
LOCAL: "name",
|
|
125
|
-
/**
|
|
126
|
-
* International name
|
|
127
|
-
*/
|
|
128
|
-
INTERNATIONAL: "name_int",
|
|
129
|
-
ALBANIAN: "name:sq",
|
|
130
|
-
AMHARIC: "name:am",
|
|
131
|
-
ARABIC: "name:ar",
|
|
132
|
-
ARMENIAN: "name:hy",
|
|
133
|
-
AZERBAIJANI: "name:az",
|
|
134
|
-
BASQUE: "name:eu",
|
|
135
|
-
BELORUSSIAN: "name:be",
|
|
136
|
-
BENGALI: "name:bn",
|
|
137
|
-
BOSNIAN: "name:bs",
|
|
138
|
-
BRETON: "name:br",
|
|
139
|
-
BULGARIAN: "name:bg",
|
|
140
|
-
CATALAN: "name:ca",
|
|
141
|
-
CHINESE: "name:zh",
|
|
142
|
-
TRADITIONAL_CHINESE: "name:zh-Hant",
|
|
143
|
-
SIMPLIFIED_CHINESE: "name:zh-Hans",
|
|
144
|
-
CORSICAN: "name:co",
|
|
145
|
-
CROATIAN: "name:hr",
|
|
146
|
-
CZECH: "name:cs",
|
|
147
|
-
DANISH: "name:da",
|
|
148
|
-
DUTCH: "name:nl",
|
|
149
|
-
ENGLISH: "name:en",
|
|
150
|
-
ESPERANTO: "name:eo",
|
|
151
|
-
ESTONIAN: "name:et",
|
|
152
|
-
FINNISH: "name:fi",
|
|
153
|
-
FRENCH: "name:fr",
|
|
154
|
-
FRISIAN: "name:fy",
|
|
155
|
-
GEORGIAN: "name:ka",
|
|
156
|
-
GERMAN: "name:de",
|
|
157
|
-
GREEK: "name:el",
|
|
158
|
-
HEBREW: "name:he",
|
|
159
|
-
HINDI: "name:hi",
|
|
160
|
-
HUNGARIAN: "name:hu",
|
|
161
|
-
ICELANDIC: "name:is",
|
|
162
|
-
INDONESIAN: "name:id",
|
|
163
|
-
IRISH: "name:ga",
|
|
164
|
-
ITALIAN: "name:it",
|
|
165
|
-
JAPANESE: "name:ja",
|
|
166
|
-
JAPANESE_HIRAGANA: "name:ja-Hira",
|
|
167
|
-
JAPANESE_KANA: "name:ja_kana",
|
|
168
|
-
JAPANESE_LATIN: "name:ja_rm",
|
|
169
|
-
JAPANESE_2018: "name:ja-Latn",
|
|
170
|
-
KANNADA: "name:kn",
|
|
171
|
-
KAZAKH: "name:kk",
|
|
172
|
-
KOREAN: "name:ko",
|
|
173
|
-
KOREAN_LATIN: "name:ko-Latn",
|
|
174
|
-
KURDISH: "name:ku",
|
|
175
|
-
ROMAN_LATIN: "name:la",
|
|
176
|
-
LATVIAN: "name:lv",
|
|
177
|
-
LITHUANIAN: "name:lt",
|
|
178
|
-
LUXEMBOURGISH: "name:lb",
|
|
179
|
-
MACEDONIAN: "name:mk",
|
|
180
|
-
MALAYALAM: "name:ml",
|
|
181
|
-
MALTESE: "name:mt",
|
|
182
|
-
NORWEGIAN: "name:no",
|
|
183
|
-
OCCITAN: "name:oc",
|
|
184
|
-
PERSIAN: "name:fa",
|
|
185
|
-
POLISH: "name:pl",
|
|
186
|
-
PORTUGUESE: "name:pt",
|
|
187
|
-
PUNJABI: "name:pa",
|
|
188
|
-
WESTERN_PUNJABI: "name:pnb",
|
|
189
|
-
ROMANIAN: "name:ro",
|
|
190
|
-
ROMANSH: "name:rm",
|
|
191
|
-
RUSSIAN: "name:ru",
|
|
192
|
-
SCOTTISH_GAELIC: "name:gd",
|
|
193
|
-
SERBIAN_CYRILLIC: "name:sr",
|
|
194
|
-
SERBIAN_LATIN: "name:sr-Latn",
|
|
195
|
-
SLOVAK: "name:sk",
|
|
196
|
-
SLOVENE: "name:sl",
|
|
197
|
-
SPANISH: "name:es",
|
|
198
|
-
SWEDISH: "name:sv",
|
|
199
|
-
TAMIL: "name:ta",
|
|
200
|
-
TELUGU: "name:te",
|
|
201
|
-
THAI: "name:th",
|
|
202
|
-
TURKISH: "name:tr",
|
|
203
|
-
UKRAINIAN: "name:uk",
|
|
204
|
-
URDU: "name:ur",
|
|
205
|
-
VIETNAMIAN_LATIN: "name:vi",
|
|
206
|
-
WELSH: "name:cy"
|
|
207
|
-
}, xt = new Set(Object.values(C));
|
|
208
|
-
function ge(r) {
|
|
209
|
-
return xt.has(r);
|
|
210
|
-
}
|
|
211
|
-
const Nt = new Set(Object.values(C));
|
|
85
|
+
* Language mode to display labels in both the local language and the language of the visitor's device, concatenated.
|
|
86
|
+
* Note that if those two languages are the same, labels won't be duplicated.
|
|
87
|
+
*/
|
|
88
|
+
VISITOR: {
|
|
89
|
+
code: null,
|
|
90
|
+
flag: "visitor",
|
|
91
|
+
name: "Visitor",
|
|
92
|
+
latin: !0,
|
|
93
|
+
isMode: !0,
|
|
94
|
+
geocoding: !1
|
|
95
|
+
},
|
|
96
|
+
/**
|
|
97
|
+
* Language mode to display labels in both the local language and English, concatenated.
|
|
98
|
+
* Note that if those two languages are the same, labels won't be duplicated.
|
|
99
|
+
*/
|
|
100
|
+
VISITOR_ENGLISH: {
|
|
101
|
+
code: null,
|
|
102
|
+
flag: "visitor_en",
|
|
103
|
+
name: "Visitor English",
|
|
104
|
+
latin: !0,
|
|
105
|
+
isMode: !0,
|
|
106
|
+
geocoding: !1
|
|
107
|
+
},
|
|
108
|
+
/**
|
|
109
|
+
* Language mode to display labels in a language enforced in the style.
|
|
110
|
+
*/
|
|
111
|
+
STYLE: { code: null, flag: "style", name: "Style", latin: !1, isMode: !0, geocoding: !1 },
|
|
112
|
+
/**
|
|
113
|
+
* Language mode to display labels in a language enforced in the style. The language cannot be further modified.
|
|
114
|
+
*/
|
|
115
|
+
STYLE_LOCK: {
|
|
116
|
+
code: null,
|
|
117
|
+
flag: "style_lock",
|
|
118
|
+
name: "Style Lock",
|
|
119
|
+
latin: !1,
|
|
120
|
+
isMode: !0,
|
|
121
|
+
geocoding: !1
|
|
122
|
+
},
|
|
123
|
+
...nt
|
|
124
|
+
};
|
|
212
125
|
function ye() {
|
|
213
|
-
if (typeof navigator > "u")
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
);
|
|
218
|
-
return r.length ? r[0] : C.LOCAL;
|
|
126
|
+
if (typeof navigator > "u") {
|
|
127
|
+
const e = Intl.DateTimeFormat().resolvedOptions().locale.split("-")[0], t = fe(e);
|
|
128
|
+
return t || C.ENGLISH;
|
|
129
|
+
}
|
|
130
|
+
return Array.from(new Set(navigator.languages.map((e) => e.split("-")[0]))).map((e) => fe(e)).filter((e) => e)[0] ?? C.LOCAL;
|
|
219
131
|
}
|
|
220
|
-
const
|
|
132
|
+
const O = {
|
|
221
133
|
maptilerLogoURL: "https://api.maptiler.com/resources/logo.svg",
|
|
222
134
|
maptilerURL: "https://www.maptiler.com/",
|
|
223
135
|
maptilerApiHost: "api.maptiler.com",
|
|
@@ -227,15 +139,15 @@ const k = {
|
|
|
227
139
|
terrainSourceURL: "https://api.maptiler.com/tiles/terrain-rgb-v2/tiles.json",
|
|
228
140
|
terrainSourceId: "maptiler-terrain"
|
|
229
141
|
};
|
|
230
|
-
Object.freeze(
|
|
231
|
-
const
|
|
232
|
-
class
|
|
142
|
+
Object.freeze(O);
|
|
143
|
+
const Be = mt();
|
|
144
|
+
class kt extends ht {
|
|
233
145
|
constructor() {
|
|
234
146
|
super(...arguments);
|
|
235
147
|
/**
|
|
236
148
|
* The primary language. By default, the language of the web browser is used.
|
|
237
149
|
*/
|
|
238
|
-
T(this, "primaryLanguage",
|
|
150
|
+
T(this, "primaryLanguage", O.primaryLanguage);
|
|
239
151
|
/**
|
|
240
152
|
* The secondary language, to overwrite the default language defined in the map style.
|
|
241
153
|
* This settings is highly dependant on the style compatibility and may not work in most cases.
|
|
@@ -301,9 +213,9 @@ class Mt extends nt {
|
|
|
301
213
|
return ae.fetch;
|
|
302
214
|
}
|
|
303
215
|
}
|
|
304
|
-
const
|
|
305
|
-
function
|
|
306
|
-
if (ce &&
|
|
216
|
+
const M = new kt(), { addProtocol: ve } = f, ie = "localcache_source", se = "localcache", Ft = "maptiler_sdk", Ot = 1e3, Bt = 100, ce = typeof caches < "u";
|
|
217
|
+
function Nt(r, e) {
|
|
218
|
+
if (ce && M.caching && M.session && r.host === O.maptilerApiHost) {
|
|
307
219
|
if (e === "Source" && r.href.includes("tiles.json"))
|
|
308
220
|
return r.href.replace("https://", `${ie}://`);
|
|
309
221
|
if (e === "Tile" || e === "Glyphs")
|
|
@@ -312,16 +224,16 @@ function Ft(r, e) {
|
|
|
312
224
|
return r.href;
|
|
313
225
|
}
|
|
314
226
|
let ne;
|
|
315
|
-
async function
|
|
316
|
-
return ne || (ne = await caches.open(
|
|
227
|
+
async function Ne() {
|
|
228
|
+
return ne || (ne = await caches.open(Ft)), ne;
|
|
317
229
|
}
|
|
318
230
|
let Le = 0;
|
|
319
|
-
async function
|
|
320
|
-
const r = await
|
|
231
|
+
async function zt() {
|
|
232
|
+
const r = await Ne(), e = await r.keys(), t = e.slice(0, Math.max(e.length - Ot, 0));
|
|
321
233
|
for (const o of t)
|
|
322
234
|
r.delete(o);
|
|
323
235
|
}
|
|
324
|
-
function
|
|
236
|
+
function Dt() {
|
|
325
237
|
ve(
|
|
326
238
|
ie,
|
|
327
239
|
async (r, e) => {
|
|
@@ -345,18 +257,18 @@ function zt() {
|
|
|
345
257
|
o.searchParams.delete("mtsid"), o.searchParams.delete("key");
|
|
346
258
|
const a = o.toString(), n = new URL(t);
|
|
347
259
|
n.searchParams.delete("last-modified");
|
|
348
|
-
const l = n.toString(), i = async (
|
|
349
|
-
data: await
|
|
350
|
-
cacheControl:
|
|
351
|
-
expires:
|
|
352
|
-
}),
|
|
260
|
+
const l = n.toString(), i = async (d) => ({
|
|
261
|
+
data: await d.arrayBuffer(),
|
|
262
|
+
cacheControl: d.headers.get("Cache-Control"),
|
|
263
|
+
expires: d.headers.get("Expires")
|
|
264
|
+
}), u = await Ne(), h = await u.match(a);
|
|
353
265
|
if (h)
|
|
354
266
|
return i(h);
|
|
355
|
-
const
|
|
356
|
-
|
|
357
|
-
const
|
|
358
|
-
return
|
|
359
|
-
}), ++Le >
|
|
267
|
+
const c = r;
|
|
268
|
+
c.signal = e.signal;
|
|
269
|
+
const s = await fetch(l, c);
|
|
270
|
+
return s.status >= 200 && s.status < 300 && (u.put(a, s.clone()).catch(() => {
|
|
271
|
+
}), ++Le > Bt && (zt(), Le = 0)), i(s);
|
|
360
272
|
}
|
|
361
273
|
);
|
|
362
274
|
}
|
|
@@ -365,22 +277,22 @@ function Ut() {
|
|
|
365
277
|
const r = f.getRTLTextPluginStatus();
|
|
366
278
|
if (r === "unavailable" || r === "requested")
|
|
367
279
|
try {
|
|
368
|
-
f.setRTLTextPlugin(
|
|
280
|
+
f.setRTLTextPlugin(O.rtlPluginURL, !0);
|
|
369
281
|
} catch {
|
|
370
282
|
}
|
|
371
283
|
}
|
|
372
|
-
function
|
|
284
|
+
function Gt(r, e) {
|
|
373
285
|
for (const t of r)
|
|
374
286
|
typeof e[t] == "function" && (e[t] = e[t].bind(e));
|
|
375
287
|
}
|
|
376
|
-
function
|
|
288
|
+
function Z(r, e, t) {
|
|
377
289
|
const o = window.document.createElement(r);
|
|
378
290
|
return e !== void 0 && (o.className = e), t && t.appendChild(o), o;
|
|
379
291
|
}
|
|
380
292
|
function ze(r) {
|
|
381
293
|
r.parentNode && r.parentNode.removeChild(r);
|
|
382
294
|
}
|
|
383
|
-
function
|
|
295
|
+
function we(r, e) {
|
|
384
296
|
let t = null;
|
|
385
297
|
try {
|
|
386
298
|
t = new URL(r);
|
|
@@ -389,23 +301,23 @@ function Ae(r, e) {
|
|
|
389
301
|
url: r
|
|
390
302
|
};
|
|
391
303
|
}
|
|
392
|
-
return t.host ===
|
|
393
|
-
url:
|
|
304
|
+
return t.host === O.maptilerApiHost && (t.searchParams.has("key") || t.searchParams.append("key", M.apiKey), M.session && t.searchParams.append("mtsid", Be)), {
|
|
305
|
+
url: Nt(t, e)
|
|
394
306
|
};
|
|
395
307
|
}
|
|
396
308
|
function Ce(r) {
|
|
397
309
|
return (e, t) => {
|
|
398
310
|
if (r != null) {
|
|
399
|
-
const o = r(e, t), a =
|
|
311
|
+
const o = r(e, t), a = we((o == null ? void 0 : o.url) ?? "", t);
|
|
400
312
|
return {
|
|
401
313
|
...o,
|
|
402
314
|
...a
|
|
403
315
|
};
|
|
404
316
|
}
|
|
405
|
-
return
|
|
317
|
+
return we(e, t);
|
|
406
318
|
};
|
|
407
319
|
}
|
|
408
|
-
function
|
|
320
|
+
function De() {
|
|
409
321
|
return Math.random().toString(36).substring(2);
|
|
410
322
|
}
|
|
411
323
|
function ee(r) {
|
|
@@ -418,11 +330,11 @@ function Ht(r) {
|
|
|
418
330
|
}
|
|
419
331
|
return null;
|
|
420
332
|
}
|
|
421
|
-
function
|
|
333
|
+
function Vt() {
|
|
422
334
|
return document.createElement("canvas").getContext("webgl2") ? null : typeof WebGL2RenderingContext < "u" ? "Graphic rendering with WebGL2 has been disabled or is not supported by your graphic card. The map cannot be displayed." : "Your browser does not support graphic rendering with WebGL2. The map cannot be displayed.";
|
|
423
335
|
}
|
|
424
|
-
function
|
|
425
|
-
const e =
|
|
336
|
+
function $t(r) {
|
|
337
|
+
const e = Vt();
|
|
426
338
|
if (!e) return;
|
|
427
339
|
let t = null;
|
|
428
340
|
if (typeof r == "string" ? t = document.getElementById(r) : r instanceof HTMLElement && (t = r), !t)
|
|
@@ -430,52 +342,52 @@ function Vt(r) {
|
|
|
430
342
|
const o = document.createElement("div");
|
|
431
343
|
throw o.innerHTML = e, o.classList.add("no-webgl-support-div"), t.appendChild(o), new Error(e);
|
|
432
344
|
}
|
|
433
|
-
let
|
|
345
|
+
let xo = class extends f.Marker {
|
|
434
346
|
addTo(e) {
|
|
435
347
|
return super.addTo(e);
|
|
436
348
|
}
|
|
437
349
|
};
|
|
438
|
-
class
|
|
350
|
+
class Mo extends f.Popup {
|
|
439
351
|
addTo(e) {
|
|
440
352
|
return super.addTo(e);
|
|
441
353
|
}
|
|
442
354
|
}
|
|
443
|
-
class
|
|
355
|
+
class Po extends f.Style {
|
|
444
356
|
constructor(e, t = {}) {
|
|
445
357
|
super(e, t);
|
|
446
358
|
}
|
|
447
359
|
}
|
|
448
|
-
class
|
|
360
|
+
class ko extends f.CanvasSource {
|
|
449
361
|
onAdd(e) {
|
|
450
362
|
super.onAdd(e);
|
|
451
363
|
}
|
|
452
364
|
}
|
|
453
|
-
class
|
|
365
|
+
class Fo extends f.GeoJSONSource {
|
|
454
366
|
onAdd(e) {
|
|
455
367
|
super.onAdd(e);
|
|
456
368
|
}
|
|
457
369
|
}
|
|
458
|
-
class
|
|
370
|
+
class Oo extends f.ImageSource {
|
|
459
371
|
onAdd(e) {
|
|
460
372
|
super.onAdd(e);
|
|
461
373
|
}
|
|
462
374
|
}
|
|
463
|
-
class
|
|
375
|
+
class Bo extends f.RasterTileSource {
|
|
464
376
|
onAdd(e) {
|
|
465
377
|
super.onAdd(e);
|
|
466
378
|
}
|
|
467
379
|
}
|
|
468
|
-
class
|
|
380
|
+
class No extends f.RasterDEMTileSource {
|
|
469
381
|
onAdd(e) {
|
|
470
382
|
super.onAdd(e);
|
|
471
383
|
}
|
|
472
384
|
}
|
|
473
|
-
class
|
|
385
|
+
class zo extends f.VectorTileSource {
|
|
474
386
|
onAdd(e) {
|
|
475
387
|
super.onAdd(e);
|
|
476
388
|
}
|
|
477
389
|
}
|
|
478
|
-
class
|
|
390
|
+
class Do extends f.VideoSource {
|
|
479
391
|
onAdd(e) {
|
|
480
392
|
super.onAdd(e);
|
|
481
393
|
}
|
|
@@ -485,82 +397,82 @@ class jt extends f.NavigationControl {
|
|
|
485
397
|
return super.onAdd(e);
|
|
486
398
|
}
|
|
487
399
|
}
|
|
488
|
-
class
|
|
400
|
+
class Kt extends f.GeolocateControl {
|
|
489
401
|
onAdd(e) {
|
|
490
402
|
return super.onAdd(e);
|
|
491
403
|
}
|
|
492
404
|
}
|
|
493
|
-
class
|
|
405
|
+
class Uo extends f.AttributionControl {
|
|
494
406
|
onAdd(e) {
|
|
495
407
|
return super.onAdd(e);
|
|
496
408
|
}
|
|
497
409
|
}
|
|
498
|
-
class
|
|
410
|
+
class Zt extends f.LogoControl {
|
|
499
411
|
onAdd(e) {
|
|
500
412
|
return super.onAdd(e);
|
|
501
413
|
}
|
|
502
414
|
}
|
|
503
|
-
class
|
|
415
|
+
class Wt extends f.ScaleControl {
|
|
504
416
|
onAdd(e) {
|
|
505
417
|
return super.onAdd(e);
|
|
506
418
|
}
|
|
507
419
|
}
|
|
508
|
-
class
|
|
420
|
+
class Yt extends f.FullscreenControl {
|
|
509
421
|
onAdd(e) {
|
|
510
422
|
return super.onAdd(e);
|
|
511
423
|
}
|
|
512
424
|
}
|
|
513
|
-
class
|
|
425
|
+
class Go extends f.TerrainControl {
|
|
514
426
|
onAdd(e) {
|
|
515
427
|
return super.onAdd(e);
|
|
516
428
|
}
|
|
517
429
|
}
|
|
518
|
-
class
|
|
430
|
+
class Ho extends f.BoxZoomHandler {
|
|
519
431
|
constructor(e, t) {
|
|
520
432
|
super(e, t);
|
|
521
433
|
}
|
|
522
434
|
}
|
|
523
|
-
class
|
|
435
|
+
class Vo extends f.ScrollZoomHandler {
|
|
524
436
|
constructor(e, t) {
|
|
525
437
|
super(e, t);
|
|
526
438
|
}
|
|
527
439
|
}
|
|
528
|
-
class
|
|
440
|
+
class $o extends f.CooperativeGesturesHandler {
|
|
529
441
|
constructor(e, t) {
|
|
530
442
|
super(e, t);
|
|
531
443
|
}
|
|
532
444
|
}
|
|
533
|
-
class
|
|
445
|
+
class jo extends f.KeyboardHandler {
|
|
534
446
|
constructor(e) {
|
|
535
447
|
super(e);
|
|
536
448
|
}
|
|
537
449
|
}
|
|
538
|
-
class
|
|
450
|
+
class Ko extends f.TwoFingersTouchPitchHandler {
|
|
539
451
|
constructor(e) {
|
|
540
452
|
super(e);
|
|
541
453
|
}
|
|
542
454
|
}
|
|
543
|
-
class
|
|
455
|
+
class Zo extends f.MapWheelEvent {
|
|
544
456
|
constructor(e, t, o) {
|
|
545
457
|
super(e, t, o);
|
|
546
458
|
}
|
|
547
459
|
}
|
|
548
|
-
class
|
|
460
|
+
class Wo extends f.MapTouchEvent {
|
|
549
461
|
constructor(e, t, o) {
|
|
550
462
|
super(e, t, o);
|
|
551
463
|
}
|
|
552
464
|
}
|
|
553
|
-
class
|
|
465
|
+
class Yo extends f.MapMouseEvent {
|
|
554
466
|
constructor(e, t, o, a = {}) {
|
|
555
467
|
super(e, t, o, a);
|
|
556
468
|
}
|
|
557
469
|
}
|
|
558
|
-
class
|
|
470
|
+
class be extends Zt {
|
|
559
471
|
constructor(t = {}) {
|
|
560
472
|
super(t);
|
|
561
473
|
T(this, "logoURL", "");
|
|
562
474
|
T(this, "linkURL", "");
|
|
563
|
-
this.logoURL = t.logoURL ??
|
|
475
|
+
this.logoURL = t.logoURL ?? O.maptilerLogoURL, this.linkURL = t.linkURL ?? O.maptilerURL;
|
|
564
476
|
}
|
|
565
477
|
onAdd(t) {
|
|
566
478
|
this._map = t, this._compact = this.options.compact ?? !1, this._container = window.document.createElement("div"), this._container.className = "maplibregl-ctrl";
|
|
@@ -571,15 +483,15 @@ class we extends Kt {
|
|
|
571
483
|
function Se(r) {
|
|
572
484
|
return r ? typeof r == "string" || r instanceof String ? !r.startsWith("http") && r.toLowerCase().includes(".json") ? r : st(r) : r instanceof ct ? r.getExpandedStyleURL() : r instanceof ut ? r.getDefaultVariant().getExpandedStyleURL() : r : lt[it[0].referenceStyleID].getDefaultVariant().getExpandedStyleURL();
|
|
573
485
|
}
|
|
574
|
-
class
|
|
486
|
+
class qt {
|
|
575
487
|
constructor() {
|
|
576
488
|
T(this, "_map");
|
|
577
489
|
T(this, "_container");
|
|
578
490
|
T(this, "_terrainButton");
|
|
579
|
-
|
|
491
|
+
Gt(["_toggleTerrain", "_updateTerrainIcon"], this);
|
|
580
492
|
}
|
|
581
493
|
onAdd(e) {
|
|
582
|
-
return this._map = e, this._container =
|
|
494
|
+
return this._map = e, this._container = Z("div", "maplibregl-ctrl maplibregl-ctrl-group"), this._terrainButton = Z("button", "maplibregl-ctrl-terrain", this._container), Z("span", "maplibregl-ctrl-icon", this._terrainButton).setAttribute("aria-hidden", "true"), this._terrainButton.type = "button", this._terrainButton.addEventListener("click", this._toggleTerrain), this._updateTerrainIcon(), this._map.on("terrain", this._updateTerrainIcon), this._container;
|
|
583
495
|
}
|
|
584
496
|
onRemove() {
|
|
585
497
|
ze(this._container), this._map.off("terrain", this._updateTerrainIcon), this._map = void 0;
|
|
@@ -592,11 +504,11 @@ class Yt {
|
|
|
592
504
|
}
|
|
593
505
|
}
|
|
594
506
|
class Jt extends jt {
|
|
595
|
-
constructor() {
|
|
507
|
+
constructor(t = {}) {
|
|
596
508
|
super({
|
|
597
|
-
showCompass: !0,
|
|
598
|
-
showZoom: !0,
|
|
599
|
-
visualizePitch: !0
|
|
509
|
+
showCompass: t.showCompass ?? !0,
|
|
510
|
+
showZoom: t.showZoom ?? !0,
|
|
511
|
+
visualizePitch: t.visualizePitch ?? !0
|
|
600
512
|
});
|
|
601
513
|
/**
|
|
602
514
|
* Overloading: Limit how flat the compass icon can get
|
|
@@ -608,9 +520,9 @@ class Jt extends jt {
|
|
|
608
520
|
)}) rotateX(${Math.min(70, this._map.transform.pitch)}deg) rotateZ(${this._map.transform.angle * (180 / Math.PI)}deg)` : `rotate(${this._map.transform.angle * (180 / Math.PI)}deg)`;
|
|
609
521
|
this._compassIcon.style.transform = t;
|
|
610
522
|
});
|
|
611
|
-
this._compass.removeEventListener("click", this._compass.clickFunction), this._compass.addEventListener("click", (
|
|
612
|
-
this._map.getPitch() === 0 ? this._map.easeTo({ pitch: Math.min(this._map.getMaxPitch(), 80) }) : this.options.visualizePitch ? this._map.resetNorthPitch({}, { originalEvent:
|
|
613
|
-
});
|
|
523
|
+
this._compass && (this._compass.removeEventListener("click", this._compass.clickFunction), this._compass.addEventListener("click", (o) => {
|
|
524
|
+
this._map.getPitch() === 0 ? this._map.easeTo({ pitch: Math.min(this._map.getMaxPitch(), 80) }) : this.options.visualizePitch ? this._map.resetNorthPitch({}, { originalEvent: o }) : this._map.resetNorth({}, { originalEvent: o });
|
|
525
|
+
}));
|
|
614
526
|
}
|
|
615
527
|
/**
|
|
616
528
|
* Overloading: the button now stores its click callback so that we can later on delete it and replace it
|
|
@@ -620,8 +532,8 @@ class Jt extends jt {
|
|
|
620
532
|
return a.clickFunction = o, a;
|
|
621
533
|
}
|
|
622
534
|
}
|
|
623
|
-
const
|
|
624
|
-
class
|
|
535
|
+
const Ae = f.Marker, Te = f.LngLat, Xt = f.LngLatBounds;
|
|
536
|
+
class Qt extends Kt {
|
|
625
537
|
constructor() {
|
|
626
538
|
super(...arguments);
|
|
627
539
|
T(this, "lastUpdatedCenter", new Te(0, 0));
|
|
@@ -632,39 +544,41 @@ class Xt extends $t {
|
|
|
632
544
|
* @private
|
|
633
545
|
*/
|
|
634
546
|
T(this, "_updateCamera", (t) => {
|
|
635
|
-
var
|
|
547
|
+
var c, s;
|
|
636
548
|
const o = new Te(t.coords.longitude, t.coords.latitude), a = t.coords.accuracy, l = {
|
|
637
549
|
bearing: this._map.getBearing(),
|
|
638
550
|
...this.options.fitBoundsOptions,
|
|
639
551
|
linear: !0
|
|
640
552
|
}, i = this._map.getZoom();
|
|
641
|
-
i > (((
|
|
553
|
+
i > (((s = (c = this.options) == null ? void 0 : c.fitBoundsOptions) == null ? void 0 : s.maxZoom) ?? 30) && (l.zoom = i), this._map.fitBounds(Xt.fromLngLat(o, a), l, {
|
|
642
554
|
geolocateSource: !0
|
|
643
555
|
// tag this camera change so it won't cause the control to change to background state
|
|
644
556
|
});
|
|
645
|
-
let
|
|
557
|
+
let u = !1;
|
|
646
558
|
const h = () => {
|
|
647
|
-
|
|
559
|
+
u = !0;
|
|
648
560
|
};
|
|
649
561
|
this._map.once("click", h), this._map.once("dblclick", h), this._map.once("dragstart", h), this._map.once("mousedown", h), this._map.once("touchstart", h), this._map.once("wheel", h), this._map.once("moveend", () => {
|
|
650
|
-
this._map.off("click", h), this._map.off("dblclick", h), this._map.off("dragstart", h), this._map.off("mousedown", h), this._map.off("touchstart", h), this._map.off("wheel", h), !
|
|
562
|
+
this._map.off("click", h), this._map.off("dblclick", h), this._map.off("dragstart", h), this._map.off("mousedown", h), this._map.off("touchstart", h), this._map.off("wheel", h), !u && (this.lastUpdatedCenter = this._map.getCenter());
|
|
651
563
|
});
|
|
652
564
|
});
|
|
653
|
-
T(this, "
|
|
654
|
-
if (this.
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
565
|
+
T(this, "_finishSetupUI", (t) => {
|
|
566
|
+
if (this._map) {
|
|
567
|
+
if (t === !1) {
|
|
568
|
+
const o = this._map._getUIString("GeolocateControl.LocationNotAvailable");
|
|
569
|
+
this._geolocateButton.disabled = !0, this._geolocateButton.title = o, this._geolocateButton.setAttribute("aria-label", o);
|
|
570
|
+
} else {
|
|
571
|
+
const o = this._map._getUIString("GeolocateControl.FindMyLocation");
|
|
572
|
+
this._geolocateButton.disabled = !1, this._geolocateButton.title = o, this._geolocateButton.setAttribute("aria-label", o);
|
|
573
|
+
}
|
|
574
|
+
this.options.trackUserLocation && (this._geolocateButton.setAttribute("aria-pressed", "false"), this._watchState = "OFF"), this.options.showUserLocation && (this._dotElement = Z("div", "maplibregl-user-location-dot"), this._userLocationDotMarker = new Ae({ element: this._dotElement }), this._circleElement = Z("div", "maplibregl-user-location-accuracy-circle"), this._accuracyCircleMarker = new Ae({
|
|
575
|
+
element: this._circleElement,
|
|
576
|
+
pitchAlignment: "map"
|
|
577
|
+
}), this.options.trackUserLocation && (this._watchState = "OFF"), this._map.on("move", this._onZoom)), this._geolocateButton.addEventListener("click", this.trigger.bind(this)), this._setup = !0, this.options.trackUserLocation && this._map.on("moveend", (o) => {
|
|
578
|
+
const a = o.originalEvent && o.originalEvent.type === "resize", n = this.lastUpdatedCenter.distanceTo(this._map.getCenter());
|
|
579
|
+
!o.geolocateSource && this._watchState === "ACTIVE_LOCK" && !a && n > 1 && (this._watchState = "BACKGROUND", this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"), this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"), this.fire(new Event("trackuserlocationend")));
|
|
580
|
+
});
|
|
660
581
|
}
|
|
661
|
-
this.options.trackUserLocation && (this._geolocateButton.setAttribute("aria-pressed", "false"), this._watchState = "OFF"), this.options.showUserLocation && (this._dotElement = V("div", "maplibregl-user-location-dot"), this._userLocationDotMarker = new be({ element: this._dotElement }), this._circleElement = V("div", "maplibregl-user-location-accuracy-circle"), this._accuracyCircleMarker = new be({
|
|
662
|
-
element: this._circleElement,
|
|
663
|
-
pitchAlignment: "map"
|
|
664
|
-
}), this.options.trackUserLocation && (this._watchState = "OFF"), this._map.on("move", this._onZoom)), this._geolocateButton.addEventListener("click", this.trigger.bind(this)), this._setup = !0, this.options.trackUserLocation && this._map.on("moveend", (o) => {
|
|
665
|
-
const a = o.originalEvent && o.originalEvent.type === "resize", n = this.lastUpdatedCenter.distanceTo(this._map.getCenter());
|
|
666
|
-
!o.geolocateSource && this._watchState === "ACTIVE_LOCK" && !a && n > 1 && (this._watchState = "BACKGROUND", this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"), this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"), this.fire(new Event("trackuserlocationend")));
|
|
667
|
-
});
|
|
668
582
|
});
|
|
669
583
|
T(this, "_onZoom", () => {
|
|
670
584
|
this.options.showUserLocation && this.options.showAccuracyCircle && this._updateCircleRadius();
|
|
@@ -680,18 +594,18 @@ class Xt extends $t {
|
|
|
680
594
|
this._circleElement.style.width = `${i}px`, this._circleElement.style.height = `${i}px`;
|
|
681
595
|
}
|
|
682
596
|
}
|
|
683
|
-
var
|
|
597
|
+
var F, z, G, H, B, Y, x, Ue, N, Ge;
|
|
684
598
|
class le {
|
|
685
599
|
constructor(e, t) {
|
|
686
|
-
|
|
687
|
-
|
|
600
|
+
U(this, x);
|
|
601
|
+
U(this, F);
|
|
688
602
|
T(this, "map");
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
e.style !== void 0 && $(this,
|
|
603
|
+
U(this, z);
|
|
604
|
+
U(this, G);
|
|
605
|
+
U(this, H);
|
|
606
|
+
U(this, B, !1);
|
|
607
|
+
U(this, Y);
|
|
608
|
+
e.style !== void 0 && $(this, B, !0), $(this, F, {
|
|
695
609
|
// set defaults
|
|
696
610
|
zoomAdjust: -4,
|
|
697
611
|
position: "top-right",
|
|
@@ -714,52 +628,52 @@ class le {
|
|
|
714
628
|
height: "300px",
|
|
715
629
|
...e.containerStyle ?? {}
|
|
716
630
|
}
|
|
717
|
-
}), e.lockZoom !== void 0 && (L(this,
|
|
631
|
+
}), e.lockZoom !== void 0 && (L(this, F).minZoom = e.lockZoom, L(this, F).maxZoom = e.lockZoom);
|
|
718
632
|
}
|
|
719
633
|
setStyle(e, t) {
|
|
720
|
-
L(this,
|
|
634
|
+
L(this, B) || this.map.setStyle(e, t), k(this, x, N).call(this);
|
|
721
635
|
}
|
|
722
636
|
addLayer(e, t) {
|
|
723
|
-
return L(this,
|
|
637
|
+
return L(this, B) || this.map.addLayer(e, t), k(this, x, N).call(this), this.map;
|
|
724
638
|
}
|
|
725
639
|
moveLayer(e, t) {
|
|
726
|
-
return L(this,
|
|
640
|
+
return L(this, B) || this.map.moveLayer(e, t), k(this, x, N).call(this), this.map;
|
|
727
641
|
}
|
|
728
642
|
removeLayer(e) {
|
|
729
|
-
return L(this,
|
|
643
|
+
return L(this, B) || this.map.removeLayer(e), k(this, x, N).call(this), this;
|
|
730
644
|
}
|
|
731
645
|
setLayerZoomRange(e, t, o) {
|
|
732
|
-
return L(this,
|
|
646
|
+
return L(this, B) || this.map.setLayerZoomRange(e, t, o), k(this, x, N).call(this), this;
|
|
733
647
|
}
|
|
734
648
|
setFilter(e, t, o) {
|
|
735
|
-
return L(this,
|
|
649
|
+
return L(this, B) || this.map.setFilter(e, t, o), k(this, x, N).call(this), this;
|
|
736
650
|
}
|
|
737
651
|
setPaintProperty(e, t, o, a) {
|
|
738
|
-
return L(this,
|
|
652
|
+
return L(this, B) || this.map.setPaintProperty(e, t, o, a), k(this, x, N).call(this), this;
|
|
739
653
|
}
|
|
740
654
|
setLayoutProperty(e, t, o, a) {
|
|
741
|
-
return L(this,
|
|
655
|
+
return L(this, B) || this.map.setLayoutProperty(e, t, o, a), k(this, x, N).call(this), this;
|
|
742
656
|
}
|
|
743
657
|
setGlyphs(e, t) {
|
|
744
|
-
return L(this,
|
|
658
|
+
return L(this, B) || this.map.setGlyphs(e, t), k(this, x, N).call(this), this;
|
|
745
659
|
}
|
|
746
660
|
onAdd(e) {
|
|
747
|
-
$(this, z, e), $(this,
|
|
748
|
-
for (const [t, o] of Object.entries(L(this,
|
|
749
|
-
L(this,
|
|
750
|
-
return L(this,
|
|
661
|
+
$(this, z, e), $(this, G, Z("div", "maplibregl-ctrl maplibregl-ctrl-group"));
|
|
662
|
+
for (const [t, o] of Object.entries(L(this, F).containerStyle))
|
|
663
|
+
L(this, G).style.setProperty(t, o);
|
|
664
|
+
return L(this, F).container = L(this, G), L(this, F).zoom = e.getZoom() + L(this, F).zoomAdjust, this.map = new to(L(this, F)), this.map.once("style.load", () => {
|
|
751
665
|
this.map.resize();
|
|
752
666
|
}), this.map.once("load", () => {
|
|
753
|
-
|
|
754
|
-
}), L(this,
|
|
667
|
+
k(this, x, Ue).call(this, L(this, F).parentRect), $(this, Y, k(this, x, Ge).call(this));
|
|
668
|
+
}), L(this, G);
|
|
755
669
|
}
|
|
756
670
|
onRemove() {
|
|
757
671
|
var e;
|
|
758
|
-
(e = L(this, Y)) == null || e.call(this), ze(L(this,
|
|
672
|
+
(e = L(this, Y)) == null || e.call(this), ze(L(this, G));
|
|
759
673
|
}
|
|
760
674
|
}
|
|
761
|
-
|
|
762
|
-
e === void 0 || e.linePaint === void 0 && e.fillPaint === void 0 || ($(this,
|
|
675
|
+
F = new WeakMap(), z = new WeakMap(), G = new WeakMap(), H = new WeakMap(), B = new WeakMap(), Y = new WeakMap(), x = new WeakSet(), Ue = function(e) {
|
|
676
|
+
e === void 0 || e.linePaint === void 0 && e.fillPaint === void 0 || ($(this, H, {
|
|
763
677
|
type: "Feature",
|
|
764
678
|
properties: {
|
|
765
679
|
name: "parentRect"
|
|
@@ -770,7 +684,7 @@ O = new WeakMap(), z = new WeakMap(), H = new WeakMap(), G = new WeakMap(), F =
|
|
|
770
684
|
}
|
|
771
685
|
}), this.map.addSource("parentRect", {
|
|
772
686
|
type: "geojson",
|
|
773
|
-
data: L(this,
|
|
687
|
+
data: L(this, H)
|
|
774
688
|
}), (e.lineLayout !== void 0 || e.linePaint !== void 0) && this.map.addLayer({
|
|
775
689
|
id: "parentRectOutline",
|
|
776
690
|
type: "line",
|
|
@@ -794,15 +708,15 @@ O = new WeakMap(), z = new WeakMap(), H = new WeakMap(), G = new WeakMap(), F =
|
|
|
794
708
|
"fill-opacity": 0.135,
|
|
795
709
|
...e.fillPaint
|
|
796
710
|
}
|
|
797
|
-
}),
|
|
798
|
-
},
|
|
799
|
-
if (L(this,
|
|
800
|
-
const { devicePixelRatio: e } = window, t = L(this, z).getCanvas(), o = t.width / e, a = t.height / e, n = L(this, z).unproject.bind(L(this, z)), l = n([0, 0]), i = n([o, 0]),
|
|
801
|
-
L(this,
|
|
802
|
-
[
|
|
803
|
-
], this.map.getSource("parentRect").setData(L(this,
|
|
804
|
-
},
|
|
805
|
-
const { pitchAdjust: e } = L(this,
|
|
711
|
+
}), k(this, x, N).call(this));
|
|
712
|
+
}, N = function() {
|
|
713
|
+
if (L(this, H) === void 0) return;
|
|
714
|
+
const { devicePixelRatio: e } = window, t = L(this, z).getCanvas(), o = t.width / e, a = t.height / e, n = L(this, z).unproject.bind(L(this, z)), l = n([0, 0]), i = n([o, 0]), u = n([0, a]), h = n([o, a]);
|
|
715
|
+
L(this, H).geometry.coordinates = [
|
|
716
|
+
[u.toArray(), h.toArray(), i.toArray(), l.toArray(), u.toArray()]
|
|
717
|
+
], this.map.getSource("parentRect").setData(L(this, H));
|
|
718
|
+
}, Ge = function() {
|
|
719
|
+
const { pitchAdjust: e } = L(this, F), t = () => {
|
|
806
720
|
l("parent");
|
|
807
721
|
}, o = () => {
|
|
808
722
|
l("minimap");
|
|
@@ -812,27 +726,27 @@ O = new WeakMap(), z = new WeakMap(), H = new WeakMap(), G = new WeakMap(), F =
|
|
|
812
726
|
L(this, z).off("move", t), this.map.off("move", o);
|
|
813
727
|
}, l = (i) => {
|
|
814
728
|
n();
|
|
815
|
-
const
|
|
729
|
+
const u = i === "parent" ? L(this, z) : this.map, h = i === "parent" ? this.map : L(this, z), c = u.getCenter(), s = u.getZoom() + L(this, F).zoomAdjust * (i === "parent" ? 1 : -1), d = u.getBearing(), p = u.getPitch();
|
|
816
730
|
h.jumpTo({
|
|
817
|
-
center:
|
|
818
|
-
zoom:
|
|
819
|
-
bearing:
|
|
820
|
-
pitch: e ?
|
|
821
|
-
}),
|
|
731
|
+
center: c,
|
|
732
|
+
zoom: s,
|
|
733
|
+
bearing: d,
|
|
734
|
+
pitch: e ? p : 0
|
|
735
|
+
}), k(this, x, N).call(this), a();
|
|
822
736
|
};
|
|
823
737
|
return a(), () => {
|
|
824
738
|
n();
|
|
825
739
|
};
|
|
826
740
|
};
|
|
827
|
-
const
|
|
741
|
+
const eo = {
|
|
828
742
|
POINT: "POINT",
|
|
829
743
|
COUNTRY: "COUNTRY"
|
|
830
744
|
};
|
|
831
|
-
class
|
|
745
|
+
class to extends f.Map {
|
|
832
746
|
constructor(t) {
|
|
833
|
-
|
|
747
|
+
$t(t.container), t.apiKey && (M.apiKey = t.apiKey);
|
|
834
748
|
const o = Se(t.style), a = location.hash;
|
|
835
|
-
|
|
749
|
+
M.apiKey || console.warn("MapTiler Cloud API key is not set. Visit https://maptiler.com and try Cloud for free!");
|
|
836
750
|
let n = {
|
|
837
751
|
compact: !1
|
|
838
752
|
};
|
|
@@ -856,37 +770,37 @@ class eo extends f.Map {
|
|
|
856
770
|
T(this, "forceLanguageUpdate");
|
|
857
771
|
T(this, "languageAlwaysBeenStyle");
|
|
858
772
|
T(this, "isReady", !1);
|
|
859
|
-
|
|
773
|
+
M.caching && !ce && console.warn(
|
|
860
774
|
"The cache API is only available in secure contexts. More info at https://developer.mozilla.org/en-US/docs/Web/API/Cache"
|
|
861
|
-
),
|
|
775
|
+
), M.caching && ce && Dt(), this.primaryLanguage = t.language ?? M.primaryLanguage, this.forceLanguageUpdate = !(this.primaryLanguage === C.STYLE || this.primaryLanguage === C.STYLE_LOCK), this.languageAlwaysBeenStyle = this.primaryLanguage === C.STYLE, this.terrainExaggeration = t.terrainExaggeration ?? this.terrainExaggeration, this.once("styledata", async () => {
|
|
862
776
|
if (!t.geolocate || t.center || t.hash && a)
|
|
863
777
|
return;
|
|
864
778
|
try {
|
|
865
|
-
if (t.geolocate ===
|
|
779
|
+
if (t.geolocate === eo.COUNTRY) {
|
|
866
780
|
await this.fitToIpBounds();
|
|
867
781
|
return;
|
|
868
782
|
}
|
|
869
|
-
} catch (
|
|
870
|
-
console.warn(
|
|
783
|
+
} catch (d) {
|
|
784
|
+
console.warn(d.message);
|
|
871
785
|
}
|
|
872
|
-
let
|
|
786
|
+
let c;
|
|
873
787
|
try {
|
|
874
|
-
await this.centerOnIpPoint(t.zoom),
|
|
875
|
-
} catch (
|
|
876
|
-
console.warn(
|
|
788
|
+
await this.centerOnIpPoint(t.zoom), c = this.getCameraHash();
|
|
789
|
+
} catch (d) {
|
|
790
|
+
console.warn(d.message);
|
|
877
791
|
}
|
|
878
792
|
(await navigator.permissions.query({
|
|
879
793
|
name: "geolocation"
|
|
880
794
|
})).state === "granted" && navigator.geolocation.getCurrentPosition(
|
|
881
795
|
// success callback
|
|
882
|
-
(
|
|
883
|
-
|
|
884
|
-
center: [
|
|
796
|
+
(d) => {
|
|
797
|
+
c === this.getCameraHash() && (this.terrain ? this.easeTo({
|
|
798
|
+
center: [d.coords.longitude, d.coords.latitude],
|
|
885
799
|
zoom: t.zoom || 12,
|
|
886
800
|
duration: 2e3
|
|
887
801
|
}) : this.once("terrain", () => {
|
|
888
802
|
this.easeTo({
|
|
889
|
-
center: [
|
|
803
|
+
center: [d.coords.longitude, d.coords.latitude],
|
|
890
804
|
zoom: t.zoom || 12,
|
|
891
805
|
duration: 2e3
|
|
892
806
|
});
|
|
@@ -908,34 +822,34 @@ class eo extends f.Map {
|
|
|
908
822
|
}), this.on("styledata", () => {
|
|
909
823
|
this.getTerrain() === null && this.isTerrainEnabled && this.enableTerrain(this.terrainExaggeration);
|
|
910
824
|
}), this.once("load", async () => {
|
|
911
|
-
let
|
|
825
|
+
let c = { logo: null };
|
|
912
826
|
try {
|
|
913
|
-
const
|
|
827
|
+
const s = Object.keys(this.style.sourceCaches).map((m) => this.getSource(m)).filter(
|
|
914
828
|
(m) => m && "url" in m && typeof m.url == "string" && (m == null ? void 0 : m.url.includes("tiles.json"))
|
|
915
|
-
),
|
|
916
|
-
|
|
829
|
+
), d = new URL(s[0].url);
|
|
830
|
+
d.searchParams.has("key") || d.searchParams.append("key", M.apiKey), c = await (await fetch(d.href)).json();
|
|
917
831
|
} catch {
|
|
918
832
|
}
|
|
919
833
|
if (t.forceNoAttributionControl !== !0)
|
|
920
|
-
if ("logo" in
|
|
921
|
-
const
|
|
922
|
-
this.addControl(new
|
|
923
|
-
} else t.maptilerLogo && this.addControl(new
|
|
834
|
+
if ("logo" in c && c.logo) {
|
|
835
|
+
const s = c.logo;
|
|
836
|
+
this.addControl(new be({ logoURL: s }), t.logoPosition);
|
|
837
|
+
} else t.maptilerLogo && this.addControl(new be(), t.logoPosition);
|
|
924
838
|
if (t.scaleControl) {
|
|
925
|
-
const
|
|
926
|
-
this.addControl(
|
|
927
|
-
|
|
839
|
+
const s = t.scaleControl === !0 || t.scaleControl === void 0 ? "bottom-right" : t.scaleControl, d = new Wt({ unit: M.unit });
|
|
840
|
+
this.addControl(d, s), M.on("unit", (p) => {
|
|
841
|
+
d.setUnit(p);
|
|
928
842
|
});
|
|
929
843
|
}
|
|
930
844
|
if (t.navigationControl !== !1) {
|
|
931
|
-
const
|
|
932
|
-
this.addControl(new Jt(),
|
|
845
|
+
const s = t.navigationControl === !0 || t.navigationControl === void 0 ? "top-right" : t.navigationControl;
|
|
846
|
+
this.addControl(new Jt(), s);
|
|
933
847
|
}
|
|
934
848
|
if (t.geolocateControl !== !1) {
|
|
935
|
-
const
|
|
849
|
+
const s = t.geolocateControl === !0 || t.geolocateControl === void 0 ? "top-right" : t.geolocateControl;
|
|
936
850
|
this.addControl(
|
|
937
851
|
// new maplibregl.GeolocateControl({
|
|
938
|
-
new
|
|
852
|
+
new Qt({
|
|
939
853
|
positionOptions: {
|
|
940
854
|
enableHighAccuracy: !0,
|
|
941
855
|
maximumAge: 0,
|
|
@@ -948,80 +862,80 @@ class eo extends f.Map {
|
|
|
948
862
|
showAccuracyCircle: !0,
|
|
949
863
|
showUserLocation: !0
|
|
950
864
|
}),
|
|
951
|
-
|
|
865
|
+
s
|
|
952
866
|
);
|
|
953
867
|
}
|
|
954
868
|
if (t.terrainControl) {
|
|
955
|
-
const
|
|
956
|
-
this.addControl(new
|
|
869
|
+
const s = t.terrainControl === !0 || t.terrainControl === void 0 ? "top-right" : t.terrainControl;
|
|
870
|
+
this.addControl(new qt(), s);
|
|
957
871
|
}
|
|
958
872
|
if (t.fullscreenControl) {
|
|
959
|
-
const
|
|
960
|
-
this.addControl(new
|
|
873
|
+
const s = t.fullscreenControl === !0 || t.fullscreenControl === void 0 ? "top-right" : t.fullscreenControl;
|
|
874
|
+
this.addControl(new Yt({}), s);
|
|
961
875
|
}
|
|
962
876
|
this.isReady = !0, this.fire("ready", { target: this });
|
|
963
877
|
});
|
|
964
|
-
let l = !1, i = !1,
|
|
878
|
+
let l = !1, i = !1, u;
|
|
965
879
|
this.once("ready", () => {
|
|
966
|
-
l = !0, i && this.fire("loadWithTerrain",
|
|
880
|
+
l = !0, i && this.fire("loadWithTerrain", u);
|
|
967
881
|
}), this.once("style.load", () => {
|
|
968
|
-
const { minimap:
|
|
969
|
-
if (typeof
|
|
882
|
+
const { minimap: c } = t;
|
|
883
|
+
if (typeof c == "object") {
|
|
970
884
|
const {
|
|
971
|
-
zoom:
|
|
972
|
-
center:
|
|
973
|
-
style:
|
|
885
|
+
zoom: s,
|
|
886
|
+
center: d,
|
|
887
|
+
style: p,
|
|
974
888
|
language: m,
|
|
975
|
-
apiKey:
|
|
976
|
-
maptilerLogo:
|
|
977
|
-
antialias:
|
|
978
|
-
refreshExpiredTiles:
|
|
979
|
-
maxBounds:
|
|
980
|
-
scrollZoom:
|
|
981
|
-
minZoom:
|
|
982
|
-
maxZoom:
|
|
983
|
-
boxZoom:
|
|
889
|
+
apiKey: y,
|
|
890
|
+
maptilerLogo: b,
|
|
891
|
+
antialias: P,
|
|
892
|
+
refreshExpiredTiles: w,
|
|
893
|
+
maxBounds: _,
|
|
894
|
+
scrollZoom: E,
|
|
895
|
+
minZoom: R,
|
|
896
|
+
maxZoom: D,
|
|
897
|
+
boxZoom: V,
|
|
984
898
|
locale: W,
|
|
985
|
-
fadeDuration:
|
|
986
|
-
crossSourceCollisions:
|
|
899
|
+
fadeDuration: q,
|
|
900
|
+
crossSourceCollisions: J,
|
|
987
901
|
clickTolerance: Xe,
|
|
988
902
|
bounds: Qe,
|
|
989
903
|
fitBoundsOptions: et,
|
|
990
904
|
pixelRatio: tt,
|
|
991
905
|
validateStyle: ot
|
|
992
906
|
} = t;
|
|
993
|
-
this.minimap = new le(
|
|
994
|
-
zoom:
|
|
995
|
-
center:
|
|
996
|
-
style:
|
|
907
|
+
this.minimap = new le(c, {
|
|
908
|
+
zoom: s,
|
|
909
|
+
center: d,
|
|
910
|
+
style: p,
|
|
997
911
|
language: m,
|
|
998
|
-
apiKey:
|
|
912
|
+
apiKey: y,
|
|
999
913
|
container: "null",
|
|
1000
|
-
maptilerLogo:
|
|
1001
|
-
antialias:
|
|
1002
|
-
refreshExpiredTiles:
|
|
1003
|
-
maxBounds:
|
|
1004
|
-
scrollZoom:
|
|
1005
|
-
minZoom:
|
|
1006
|
-
maxZoom:
|
|
1007
|
-
boxZoom:
|
|
914
|
+
maptilerLogo: b,
|
|
915
|
+
antialias: P,
|
|
916
|
+
refreshExpiredTiles: w,
|
|
917
|
+
maxBounds: _,
|
|
918
|
+
scrollZoom: E,
|
|
919
|
+
minZoom: R,
|
|
920
|
+
maxZoom: D,
|
|
921
|
+
boxZoom: V,
|
|
1008
922
|
locale: W,
|
|
1009
|
-
fadeDuration:
|
|
1010
|
-
crossSourceCollisions:
|
|
923
|
+
fadeDuration: q,
|
|
924
|
+
crossSourceCollisions: J,
|
|
1011
925
|
clickTolerance: Xe,
|
|
1012
926
|
bounds: Qe,
|
|
1013
927
|
fitBoundsOptions: et,
|
|
1014
928
|
pixelRatio: tt,
|
|
1015
929
|
validateStyle: ot
|
|
1016
|
-
}), this.addControl(this.minimap,
|
|
1017
|
-
} else
|
|
930
|
+
}), this.addControl(this.minimap, c.position ?? "bottom-left");
|
|
931
|
+
} else c === !0 ? (this.minimap = new le({}, t), this.addControl(this.minimap, "bottom-left")) : c !== void 0 && c !== !1 && (this.minimap = new le({}, t), this.addControl(this.minimap, c));
|
|
1018
932
|
});
|
|
1019
|
-
const h = (
|
|
1020
|
-
|
|
933
|
+
const h = (c) => {
|
|
934
|
+
c.terrain && (i = !0, u = {
|
|
1021
935
|
type: "loadWithTerrain",
|
|
1022
936
|
target: this,
|
|
1023
|
-
terrain:
|
|
1024
|
-
}, this.off("terrain", h), l && this.fire("loadWithTerrain",
|
|
937
|
+
terrain: c.terrain
|
|
938
|
+
}, this.off("terrain", h), l && this.fire("loadWithTerrain", u));
|
|
1025
939
|
};
|
|
1026
940
|
this.on("terrain", h), t.terrain && this.enableTerrain(t.terrainExaggeration ?? this.terrainExaggeration);
|
|
1027
941
|
}
|
|
@@ -1225,7 +1139,7 @@ class eo extends f.Map {
|
|
|
1225
1139
|
return (a = this.minimap) == null || a.setGlyphs(t, o), super.setGlyphs(t, o);
|
|
1226
1140
|
}
|
|
1227
1141
|
getStyleLanguage() {
|
|
1228
|
-
return !this.style.stylesheet.metadata || typeof this.style.stylesheet.metadata != "object" ? null : "maptiler:language" in this.style.stylesheet.metadata && typeof this.style.stylesheet.metadata["maptiler:language"] == "string" ? this.style.stylesheet.metadata["maptiler:language"] : null;
|
|
1142
|
+
return !this.style.stylesheet.metadata || typeof this.style.stylesheet.metadata != "object" ? null : "maptiler:language" in this.style.stylesheet.metadata && typeof this.style.stylesheet.metadata["maptiler:language"] == "string" ? dt(this.style.stylesheet.metadata["maptiler:language"]) : null;
|
|
1229
1143
|
}
|
|
1230
1144
|
/**
|
|
1231
1145
|
* Define the primary language of the map. Note that not all the languages shorthands provided are available.
|
|
@@ -1240,68 +1154,78 @@ class eo extends f.Map {
|
|
|
1240
1154
|
* Define the primary language of the map. Note that not all the languages shorthands provided are available.
|
|
1241
1155
|
*/
|
|
1242
1156
|
setPrimaryLanguage(t) {
|
|
1243
|
-
const o = this.getStyleLanguage();
|
|
1244
|
-
if (!
|
|
1245
|
-
|
|
1246
|
-
if (!ge(t)) {
|
|
1247
|
-
console.warn(`The language "${t}" is not supported.`);
|
|
1157
|
+
const o = this.getStyleLanguage(), a = pt(t, C);
|
|
1158
|
+
if (!a) {
|
|
1159
|
+
console.warn(`The language "${a}" is not supported.`);
|
|
1248
1160
|
return;
|
|
1249
1161
|
}
|
|
1250
|
-
if (this.primaryLanguage ===
|
|
1162
|
+
if (!(a.flag === C.STYLE.flag && o && (o.flag === C.AUTO.flag || o.flag === C.VISITOR.flag)) && (a.flag !== C.STYLE.flag && (this.languageAlwaysBeenStyle = !1), this.languageAlwaysBeenStyle || this.primaryLanguage === a && !this.forceLanguageUpdate))
|
|
1163
|
+
return;
|
|
1164
|
+
if (this.primaryLanguage.flag === C.STYLE_LOCK.flag) {
|
|
1251
1165
|
console.warn(
|
|
1252
1166
|
"The language cannot be changed because this map has been instantiated with the STYLE_LOCK language flag."
|
|
1253
1167
|
);
|
|
1254
1168
|
return;
|
|
1255
1169
|
}
|
|
1256
|
-
this.primaryLanguage =
|
|
1257
|
-
let
|
|
1258
|
-
if (
|
|
1170
|
+
this.primaryLanguage = a;
|
|
1171
|
+
let n = a;
|
|
1172
|
+
if (a.flag === C.STYLE.flag) {
|
|
1259
1173
|
if (!o) {
|
|
1260
|
-
console.warn("The style has no default languages.");
|
|
1174
|
+
console.warn("The style has no default languages or has an invalid one.");
|
|
1261
1175
|
return;
|
|
1262
1176
|
}
|
|
1263
|
-
|
|
1264
|
-
console.warn("The language defined in the style is not valid.");
|
|
1265
|
-
return;
|
|
1266
|
-
}
|
|
1267
|
-
a = o;
|
|
1177
|
+
n = o;
|
|
1268
1178
|
}
|
|
1269
|
-
let
|
|
1270
|
-
|
|
1179
|
+
let l = C.LOCAL.flag, i = `{${l}}`;
|
|
1180
|
+
n.flag === C.VISITOR.flag ? (l = ye().flag, i = [
|
|
1271
1181
|
"case",
|
|
1272
|
-
["all", ["has",
|
|
1182
|
+
["all", ["has", l], ["has", C.LOCAL.flag]],
|
|
1273
1183
|
[
|
|
1274
1184
|
"case",
|
|
1275
|
-
["==", ["get",
|
|
1276
|
-
["get", C.LOCAL],
|
|
1277
|
-
[
|
|
1278
|
-
|
|
1185
|
+
["==", ["get", l], ["get", C.LOCAL.flag]],
|
|
1186
|
+
["get", C.LOCAL.flag],
|
|
1187
|
+
[
|
|
1188
|
+
"format",
|
|
1189
|
+
["get", l],
|
|
1190
|
+
{ "font-scale": 0.8 },
|
|
1191
|
+
`
|
|
1192
|
+
`,
|
|
1193
|
+
["get", C.LOCAL.flag],
|
|
1194
|
+
{ "font-scale": 1.1 }
|
|
1195
|
+
]
|
|
1279
1196
|
],
|
|
1280
|
-
["get", C.LOCAL]
|
|
1281
|
-
]) :
|
|
1197
|
+
["get", C.LOCAL.flag]
|
|
1198
|
+
]) : n.flag === C.VISITOR_ENGLISH.flag ? (l = C.ENGLISH.flag, i = [
|
|
1282
1199
|
"case",
|
|
1283
|
-
["all", ["has",
|
|
1200
|
+
["all", ["has", l], ["has", C.LOCAL.flag]],
|
|
1284
1201
|
[
|
|
1285
1202
|
"case",
|
|
1286
|
-
["==", ["get",
|
|
1287
|
-
["get", C.LOCAL],
|
|
1288
|
-
[
|
|
1289
|
-
|
|
1203
|
+
["==", ["get", l], ["get", C.LOCAL.flag]],
|
|
1204
|
+
["get", C.LOCAL.flag],
|
|
1205
|
+
[
|
|
1206
|
+
"format",
|
|
1207
|
+
["get", l],
|
|
1208
|
+
{ "font-scale": 0.8 },
|
|
1209
|
+
`
|
|
1210
|
+
`,
|
|
1211
|
+
["get", C.LOCAL.flag],
|
|
1212
|
+
{ "font-scale": 1.1 }
|
|
1213
|
+
]
|
|
1290
1214
|
],
|
|
1291
|
-
["get", C.LOCAL]
|
|
1292
|
-
]) :
|
|
1293
|
-
const { layers:
|
|
1294
|
-
for (const
|
|
1295
|
-
if (
|
|
1215
|
+
["get", C.LOCAL.flag]
|
|
1216
|
+
]) : n.flag === C.AUTO.flag ? (l = ye().flag, i = ["case", ["has", l], ["get", l], ["get", C.LOCAL.flag]]) : n === C.LOCAL ? (l = C.LOCAL.flag, i = `{${l}}`) : (l = n.flag, i = ["case", ["has", l], ["get", l], ["get", C.LOCAL.flag]]);
|
|
1217
|
+
const { layers: u } = this.getStyle();
|
|
1218
|
+
for (const h of u) {
|
|
1219
|
+
if (h.type !== "symbol")
|
|
1296
1220
|
continue;
|
|
1297
|
-
const
|
|
1298
|
-
if (!s || !("url" in s && typeof s.url == "string") || new URL(s.url).host !==
|
|
1221
|
+
const c = h, s = this.getSource(c.source);
|
|
1222
|
+
if (!s || !("url" in s && typeof s.url == "string") || new URL(s.url).host !== O.maptilerApiHost)
|
|
1299
1223
|
continue;
|
|
1300
|
-
const { id:
|
|
1301
|
-
if (!
|
|
1224
|
+
const { id: p, layout: m } = c;
|
|
1225
|
+
if (!m || !("text-field" in m))
|
|
1302
1226
|
continue;
|
|
1303
|
-
const
|
|
1304
|
-
typeof
|
|
1227
|
+
const y = this.getLayoutProperty(p, "text-field");
|
|
1228
|
+
typeof y == "string" && (y.toLowerCase().includes("ref") || y.toLowerCase().includes("housenumber")) || this.setLayoutProperty(p, "text-field", i);
|
|
1305
1229
|
}
|
|
1306
1230
|
}
|
|
1307
1231
|
/**
|
|
@@ -1331,13 +1255,13 @@ class eo extends f.Map {
|
|
|
1331
1255
|
const a = performance.now(), n = this.terrain.exaggeration, l = t - n, i = () => {
|
|
1332
1256
|
if (!this.terrain || this.terrainFlattening)
|
|
1333
1257
|
return;
|
|
1334
|
-
const
|
|
1335
|
-
if (
|
|
1336
|
-
const h = 1 - (1 -
|
|
1337
|
-
this.terrain.exaggeration =
|
|
1258
|
+
const u = (performance.now() - a) / o;
|
|
1259
|
+
if (u < 0.99) {
|
|
1260
|
+
const h = 1 - (1 - u) ** 4, c = n + h * l;
|
|
1261
|
+
this.terrain.exaggeration = c, requestAnimationFrame(i);
|
|
1338
1262
|
} else
|
|
1339
1263
|
this.terrainGrowing = !1, this.terrainFlattening = !1, this.terrain.exaggeration = t;
|
|
1340
|
-
this.triggerRepaint();
|
|
1264
|
+
this._elevationFreeze = !1, this.triggerRepaint();
|
|
1341
1265
|
};
|
|
1342
1266
|
this.terrainGrowing = !0, this.terrainFlattening = !1, requestAnimationFrame(i);
|
|
1343
1267
|
}
|
|
@@ -1352,11 +1276,11 @@ class eo extends f.Map {
|
|
|
1352
1276
|
const o = async (n) => {
|
|
1353
1277
|
!this.terrain || n.type !== "data" || n.dataType !== "source" || !("source" in n) || n.sourceId !== "maptiler-terrain" || n.source.type !== "raster-dem" || n.isSourceLoaded && (this.off("data", o), this.growTerrain(t));
|
|
1354
1278
|
}, a = () => {
|
|
1355
|
-
this.isTerrainEnabled = !0, this.terrainExaggeration = t, this.on("data", o), this.addSource(
|
|
1279
|
+
this.isTerrainEnabled = !0, this.terrainExaggeration = t, this.on("data", o), this.addSource(O.terrainSourceId, {
|
|
1356
1280
|
type: "raster-dem",
|
|
1357
|
-
url:
|
|
1281
|
+
url: O.terrainSourceURL
|
|
1358
1282
|
}), this.setTerrain({
|
|
1359
|
-
source:
|
|
1283
|
+
source: O.terrainSourceId,
|
|
1360
1284
|
exaggeration: 0
|
|
1361
1285
|
});
|
|
1362
1286
|
};
|
|
@@ -1365,7 +1289,7 @@ class eo extends f.Map {
|
|
|
1365
1289
|
return;
|
|
1366
1290
|
}
|
|
1367
1291
|
this.loaded() || this.isTerrainEnabled ? a() : this.once("load", () => {
|
|
1368
|
-
this.getTerrain() && this.getSource(
|
|
1292
|
+
this.getTerrain() && this.getSource(O.terrainSourceId) || a();
|
|
1369
1293
|
});
|
|
1370
1294
|
}
|
|
1371
1295
|
/**
|
|
@@ -1379,11 +1303,11 @@ class eo extends f.Map {
|
|
|
1379
1303
|
if (!this.terrain || this.terrainGrowing)
|
|
1380
1304
|
return;
|
|
1381
1305
|
const l = (performance.now() - o) / t;
|
|
1382
|
-
if (l < 0.99) {
|
|
1383
|
-
const i = (1 - l) ** 4,
|
|
1384
|
-
this.terrain.exaggeration =
|
|
1306
|
+
if (this._elevationFreeze = !1, l < 0.99) {
|
|
1307
|
+
const i = (1 - l) ** 4, u = a * i;
|
|
1308
|
+
this.terrain.exaggeration = u, requestAnimationFrame(n);
|
|
1385
1309
|
} else
|
|
1386
|
-
this.terrain.exaggeration = 0, this.terrainGrowing = !1, this.terrainFlattening = !1, this.setTerrain(), this.getSource(
|
|
1310
|
+
this.terrain.exaggeration = 0, this.terrainGrowing = !1, this.terrainFlattening = !1, this.setTerrain(), this.getSource(O.terrainSourceId) && this.removeSource(O.terrainSourceId);
|
|
1387
1311
|
this.triggerRepaint();
|
|
1388
1312
|
};
|
|
1389
1313
|
this.terrainGrowing = !1, this.terrainFlattening = !0, requestAnimationFrame(n);
|
|
@@ -1408,14 +1332,14 @@ class eo extends f.Map {
|
|
|
1408
1332
|
});
|
|
1409
1333
|
}
|
|
1410
1334
|
async fitToIpBounds() {
|
|
1411
|
-
const t = await
|
|
1335
|
+
const t = await ge.info();
|
|
1412
1336
|
this.fitBounds(t.country_bounds, {
|
|
1413
1337
|
duration: 0,
|
|
1414
1338
|
padding: 100
|
|
1415
1339
|
});
|
|
1416
1340
|
}
|
|
1417
1341
|
async centerOnIpPoint(t) {
|
|
1418
|
-
const o = await
|
|
1342
|
+
const o = await ge.info();
|
|
1419
1343
|
this.jumpTo({
|
|
1420
1344
|
center: [(o == null ? void 0 : o.longitude) ?? 0, (o == null ? void 0 : o.latitude) ?? 0],
|
|
1421
1345
|
zoom: t || 11
|
|
@@ -1423,7 +1347,7 @@ class eo extends f.Map {
|
|
|
1423
1347
|
}
|
|
1424
1348
|
getCameraHash() {
|
|
1425
1349
|
const t = new Float32Array(5), o = this.getCenter();
|
|
1426
|
-
return t[0] = o.lng, t[1] = o.lat, t[2] = this.getZoom(), t[3] = this.getPitch(), t[4] = this.getBearing(),
|
|
1350
|
+
return t[0] = o.lng, t[1] = o.lat, t[2] = this.getZoom(), t[3] = this.getPitch(), t[4] = this.getBearing(), ft.fromUint8Array(new Uint8Array(t.buffer));
|
|
1427
1351
|
}
|
|
1428
1352
|
/**
|
|
1429
1353
|
* Get the SDK config object.
|
|
@@ -1431,7 +1355,7 @@ class eo extends f.Map {
|
|
|
1431
1355
|
* that do not directly have access to the SDK configuration but do have access to a Map instance.
|
|
1432
1356
|
*/
|
|
1433
1357
|
getSdkConfig() {
|
|
1434
|
-
return
|
|
1358
|
+
return M;
|
|
1435
1359
|
}
|
|
1436
1360
|
/**
|
|
1437
1361
|
* Get the MapTiler session ID. Convenient to dispatch to externaly built component
|
|
@@ -1439,7 +1363,7 @@ class eo extends f.Map {
|
|
|
1439
1363
|
* @returns
|
|
1440
1364
|
*/
|
|
1441
1365
|
getMaptilerSessionId() {
|
|
1442
|
-
return
|
|
1366
|
+
return Be;
|
|
1443
1367
|
}
|
|
1444
1368
|
/**
|
|
1445
1369
|
* Updates the requestManager's transform request with a new function.
|
|
@@ -1456,7 +1380,7 @@ class eo extends f.Map {
|
|
|
1456
1380
|
return super.setTransformRequest(Ce(t)), this;
|
|
1457
1381
|
}
|
|
1458
1382
|
}
|
|
1459
|
-
function
|
|
1383
|
+
function de(r) {
|
|
1460
1384
|
if (typeof DOMParser < "u") {
|
|
1461
1385
|
const e = new DOMParser().parseFromString(r, "application/xml");
|
|
1462
1386
|
if (e.querySelector("parsererror"))
|
|
@@ -1465,7 +1389,7 @@ function pe(r) {
|
|
|
1465
1389
|
}
|
|
1466
1390
|
throw new Error("No XML parser found");
|
|
1467
1391
|
}
|
|
1468
|
-
function
|
|
1392
|
+
function He(r, e) {
|
|
1469
1393
|
if (!r.hasChildNodes())
|
|
1470
1394
|
return !1;
|
|
1471
1395
|
for (const t of Array.from(r.childNodes)) {
|
|
@@ -1475,71 +1399,71 @@ function Ge(r, e) {
|
|
|
1475
1399
|
}
|
|
1476
1400
|
return !1;
|
|
1477
1401
|
}
|
|
1478
|
-
function
|
|
1402
|
+
function Re(r) {
|
|
1479
1403
|
if (typeof XMLSerializer < "u")
|
|
1480
1404
|
return new XMLSerializer().serializeToString(r);
|
|
1481
1405
|
throw new Error("No XML serializer found");
|
|
1482
1406
|
}
|
|
1483
1407
|
function Ve(r) {
|
|
1484
|
-
const e = typeof r == "string" ?
|
|
1485
|
-
if (!
|
|
1408
|
+
const e = typeof r == "string" ? de(r) : r;
|
|
1409
|
+
if (!He(e, "gpx"))
|
|
1486
1410
|
throw new Error("The XML document is not valid GPX");
|
|
1487
|
-
const t =
|
|
1411
|
+
const t = I(e, "trk"), o = I(e, "rte"), a = I(e, "wpt"), n = {
|
|
1488
1412
|
type: "FeatureCollection",
|
|
1489
1413
|
features: []
|
|
1490
1414
|
};
|
|
1491
1415
|
for (const l of Array.from(t)) {
|
|
1492
|
-
const i =
|
|
1416
|
+
const i = no(l);
|
|
1493
1417
|
i && n.features.push(i);
|
|
1494
1418
|
}
|
|
1495
1419
|
for (const l of Array.from(o)) {
|
|
1496
|
-
const i =
|
|
1420
|
+
const i = lo(l);
|
|
1497
1421
|
i && n.features.push(i);
|
|
1498
1422
|
}
|
|
1499
1423
|
for (const l of Array.from(a))
|
|
1500
|
-
n.features.push(
|
|
1424
|
+
n.features.push(io(l));
|
|
1501
1425
|
return n;
|
|
1502
1426
|
}
|
|
1503
|
-
function
|
|
1427
|
+
function $e(r, e) {
|
|
1504
1428
|
let t = r;
|
|
1505
|
-
if (typeof t == "string" && (t =
|
|
1429
|
+
if (typeof t == "string" && (t = de(t)), !He(t, "kml"))
|
|
1506
1430
|
throw new Error("The XML document is not valid KML");
|
|
1507
1431
|
const o = {
|
|
1508
1432
|
type: "FeatureCollection",
|
|
1509
1433
|
features: []
|
|
1510
|
-
}, a = {}, n = {}, l = {}, i =
|
|
1511
|
-
for (const
|
|
1512
|
-
const
|
|
1513
|
-
a[`#${
|
|
1514
|
-
}
|
|
1515
|
-
for (const
|
|
1516
|
-
a[`#${
|
|
1517
|
-
e !== void 0 ? e(
|
|
1434
|
+
}, a = {}, n = {}, l = {}, i = I(t, "Placemark"), u = I(t, "Style"), h = I(t, "StyleMap");
|
|
1435
|
+
for (const c of Array.from(u)) {
|
|
1436
|
+
const s = Ee(e !== void 0 ? e(c) : Re(c)).toString(16);
|
|
1437
|
+
a[`#${j(c, "id")}`] = s, n[s] = c;
|
|
1438
|
+
}
|
|
1439
|
+
for (const c of Array.from(h)) {
|
|
1440
|
+
a[`#${j(c, "id")}`] = Ee(
|
|
1441
|
+
e !== void 0 ? e(c) : Re(c)
|
|
1518
1442
|
).toString(16);
|
|
1519
|
-
const
|
|
1520
|
-
for (const
|
|
1521
|
-
|
|
1522
|
-
l[`#${
|
|
1443
|
+
const s = I(c, "Pair"), d = {};
|
|
1444
|
+
for (const p of Array.from(s))
|
|
1445
|
+
d[S(v(p, "key")) ?? ""] = S(v(p, "styleUrl"));
|
|
1446
|
+
l[`#${j(c, "id")}`] = d;
|
|
1523
1447
|
}
|
|
1524
|
-
for (const
|
|
1525
|
-
o.features = o.features.concat(
|
|
1448
|
+
for (const c of Array.from(i))
|
|
1449
|
+
o.features = o.features.concat(ao(c, a, n, l));
|
|
1526
1450
|
return o;
|
|
1527
1451
|
}
|
|
1528
|
-
function
|
|
1452
|
+
function _e(r) {
|
|
1529
1453
|
if (r === null) return ["#000000", 1];
|
|
1530
1454
|
let e = "", t = 1, o = r;
|
|
1531
1455
|
return o.substring(0, 1) === "#" && (o = o.substring(1)), (o.length === 6 || o.length === 3) && (e = o), o.length === 8 && (t = Number.parseInt(o.substring(0, 2), 16) / 255, e = `#${o.substring(6, 8)}${o.substring(4, 6)}${o.substring(2, 4)}`), [e ?? "#000000", t ?? 1];
|
|
1532
1456
|
}
|
|
1533
|
-
function
|
|
1457
|
+
function oo(r) {
|
|
1534
1458
|
return Ze(r.split(" "));
|
|
1535
1459
|
}
|
|
1536
|
-
function
|
|
1537
|
-
let e =
|
|
1460
|
+
function ro(r) {
|
|
1461
|
+
let e = I(r, "coord");
|
|
1538
1462
|
const t = [], o = [];
|
|
1539
|
-
e.length === 0 && (e =
|
|
1463
|
+
e.length === 0 && (e = I(r, "gx:coord"));
|
|
1540
1464
|
for (const n of Array.from(e))
|
|
1541
|
-
t.push(
|
|
1542
|
-
const a =
|
|
1465
|
+
t.push(oo(S(n) ?? ""));
|
|
1466
|
+
const a = I(r, "when");
|
|
1543
1467
|
for (const n of Array.from(a)) o.push(S(n));
|
|
1544
1468
|
return {
|
|
1545
1469
|
coords: t,
|
|
@@ -1549,84 +1473,84 @@ function oo(r) {
|
|
|
1549
1473
|
function Q(r) {
|
|
1550
1474
|
const e = ["Polygon", "LineString", "Point", "Track", "gx:Track"];
|
|
1551
1475
|
let t, o, a, n, l;
|
|
1552
|
-
const i = [],
|
|
1553
|
-
if (
|
|
1554
|
-
return Q(
|
|
1555
|
-
if (
|
|
1556
|
-
return Q(
|
|
1557
|
-
if (
|
|
1558
|
-
return Q(
|
|
1476
|
+
const i = [], u = [];
|
|
1477
|
+
if (v(r, "MultiGeometry") !== null)
|
|
1478
|
+
return Q(v(r, "MultiGeometry"));
|
|
1479
|
+
if (v(r, "MultiTrack") !== null)
|
|
1480
|
+
return Q(v(r, "MultiTrack"));
|
|
1481
|
+
if (v(r, "gx:MultiTrack") !== null)
|
|
1482
|
+
return Q(v(r, "gx:MultiTrack"));
|
|
1559
1483
|
for (a = 0; a < e.length; a++)
|
|
1560
|
-
if (o =
|
|
1484
|
+
if (o = I(r, e[a]), o) {
|
|
1561
1485
|
for (n = 0; n < o.length; n++)
|
|
1562
1486
|
if (t = o[n], e[a] === "Point")
|
|
1563
1487
|
i.push({
|
|
1564
1488
|
type: "Point",
|
|
1565
|
-
coordinates: We(S(
|
|
1489
|
+
coordinates: We(S(v(t, "coordinates")) ?? "")
|
|
1566
1490
|
});
|
|
1567
1491
|
else if (e[a] === "LineString")
|
|
1568
1492
|
i.push({
|
|
1569
1493
|
type: "LineString",
|
|
1570
|
-
coordinates:
|
|
1494
|
+
coordinates: Ie(S(v(t, "coordinates")) ?? "")
|
|
1571
1495
|
});
|
|
1572
1496
|
else if (e[a] === "Polygon") {
|
|
1573
|
-
const h =
|
|
1497
|
+
const h = I(t, "LinearRing"), c = [];
|
|
1574
1498
|
for (l = 0; l < h.length; l++)
|
|
1575
|
-
|
|
1499
|
+
c.push(Ie(S(v(h[l], "coordinates")) ?? ""));
|
|
1576
1500
|
i.push({
|
|
1577
1501
|
type: "Polygon",
|
|
1578
|
-
coordinates:
|
|
1502
|
+
coordinates: c
|
|
1579
1503
|
});
|
|
1580
1504
|
} else if (e[a] === "Track" || e[a] === "gx:Track") {
|
|
1581
|
-
const h =
|
|
1505
|
+
const h = ro(t);
|
|
1582
1506
|
i.push({
|
|
1583
1507
|
type: "LineString",
|
|
1584
1508
|
coordinates: h.coords
|
|
1585
|
-
}), h.times.length &&
|
|
1509
|
+
}), h.times.length && u.push(h.times);
|
|
1586
1510
|
}
|
|
1587
1511
|
}
|
|
1588
|
-
return { geoms: i, coordTimes:
|
|
1512
|
+
return { geoms: i, coordTimes: u };
|
|
1589
1513
|
}
|
|
1590
|
-
function
|
|
1591
|
-
const a = Q(r), n = {}, l = S(
|
|
1592
|
-
let
|
|
1514
|
+
function ao(r, e, t, o) {
|
|
1515
|
+
const a = Q(r), n = {}, l = S(v(r, "name")), i = S(v(r, "address")), u = S(v(r, "description")), h = v(r, "TimeSpan"), c = v(r, "TimeStamp"), s = v(r, "ExtendedData"), d = v(r, "visibility");
|
|
1516
|
+
let p, m = S(v(r, "styleUrl")), y = v(r, "LineStyle"), b = v(r, "PolyStyle");
|
|
1593
1517
|
if (!a.geoms.length) return [];
|
|
1594
1518
|
if (l && (n.name = l), i && (n.address = i), m) {
|
|
1595
1519
|
m[0] !== "#" && (m = `#${m}`), n.styleUrl = m, e[m] && (n.styleHash = e[m]), o[m] && (n.styleMapHash = o[m], n.styleHash = e[o[m].normal ?? ""]);
|
|
1596
|
-
const
|
|
1597
|
-
if (
|
|
1598
|
-
|
|
1599
|
-
const
|
|
1600
|
-
if (
|
|
1601
|
-
const
|
|
1602
|
-
if (
|
|
1603
|
-
const
|
|
1604
|
-
|
|
1520
|
+
const w = t[n.styleHash ?? ""];
|
|
1521
|
+
if (w) {
|
|
1522
|
+
y || (y = v(w, "LineStyle")), b || (b = v(w, "PolyStyle"));
|
|
1523
|
+
const _ = v(w, "IconStyle");
|
|
1524
|
+
if (_) {
|
|
1525
|
+
const E = v(_, "Icon");
|
|
1526
|
+
if (E) {
|
|
1527
|
+
const R = S(v(E, "href"));
|
|
1528
|
+
R && (n.icon = R);
|
|
1605
1529
|
}
|
|
1606
1530
|
}
|
|
1607
1531
|
}
|
|
1608
1532
|
}
|
|
1609
|
-
if (
|
|
1610
|
-
const
|
|
1611
|
-
|
|
1533
|
+
if (u && (n.description = u), h) {
|
|
1534
|
+
const w = S(v(h, "begin")), _ = S(v(h, "end"));
|
|
1535
|
+
w && _ && (n.timespan = { begin: w, end: _ });
|
|
1612
1536
|
}
|
|
1613
|
-
if (
|
|
1614
|
-
const
|
|
1615
|
-
|
|
1537
|
+
if (c !== null && (n.timestamp = S(v(c, "when")) ?? (/* @__PURE__ */ new Date()).toISOString()), y !== null) {
|
|
1538
|
+
const w = _e(S(v(y, "color"))), _ = w[0], E = w[1], R = Number.parseFloat(S(v(y, "width")) ?? "");
|
|
1539
|
+
_ && (n.stroke = _), Number.isNaN(E) || (n["stroke-opacity"] = E), Number.isNaN(R) || (n["stroke-width"] = R);
|
|
1616
1540
|
}
|
|
1617
|
-
if (
|
|
1618
|
-
const
|
|
1619
|
-
|
|
1541
|
+
if (b) {
|
|
1542
|
+
const w = _e(S(v(b, "color"))), _ = w[0], E = w[1], R = S(v(b, "fill")), D = S(v(b, "outline"));
|
|
1543
|
+
_ && (n.fill = _), Number.isNaN(E) || (n["fill-opacity"] = E), R && (n["fill-opacity"] = R === "1" ? n["fill-opacity"] || 1 : 0), D && (n["stroke-opacity"] = D === "1" ? n["stroke-opacity"] || 1 : 0);
|
|
1620
1544
|
}
|
|
1621
|
-
if (
|
|
1622
|
-
const
|
|
1623
|
-
for (
|
|
1624
|
-
n[
|
|
1625
|
-
for (
|
|
1626
|
-
n[
|
|
1545
|
+
if (s) {
|
|
1546
|
+
const w = I(s, "Data"), _ = I(s, "SimpleData");
|
|
1547
|
+
for (p = 0; p < w.length; p++)
|
|
1548
|
+
n[w[p].getAttribute("name") ?? ""] = S(v(w[p], "value")) ?? "";
|
|
1549
|
+
for (p = 0; p < _.length; p++)
|
|
1550
|
+
n[_[p].getAttribute("name") ?? ""] = S(_[p]) ?? "";
|
|
1627
1551
|
}
|
|
1628
|
-
|
|
1629
|
-
const
|
|
1552
|
+
d !== null && (n.visibility = S(d) ?? ""), a.coordTimes.length !== 0 && (n.coordTimes = a.coordTimes.length === 1 ? a.coordTimes[0] : a.coordTimes);
|
|
1553
|
+
const P = {
|
|
1630
1554
|
type: "Feature",
|
|
1631
1555
|
geometry: a.geoms.length === 1 ? a.geoms[0] : {
|
|
1632
1556
|
type: "GeometryCollection",
|
|
@@ -1634,16 +1558,16 @@ function ro(r, e, t, o) {
|
|
|
1634
1558
|
},
|
|
1635
1559
|
properties: n
|
|
1636
1560
|
};
|
|
1637
|
-
return
|
|
1561
|
+
return j(r, "id") && (P.id = j(r, "id") ?? void 0), [P];
|
|
1638
1562
|
}
|
|
1639
|
-
function
|
|
1640
|
-
const t =
|
|
1563
|
+
function je(r, e) {
|
|
1564
|
+
const t = I(r, e), o = [], a = [];
|
|
1641
1565
|
let n = [];
|
|
1642
1566
|
const l = t.length;
|
|
1643
1567
|
if (!(l < 2)) {
|
|
1644
1568
|
for (let i = 0; i < l; i++) {
|
|
1645
|
-
const
|
|
1646
|
-
o.push(
|
|
1569
|
+
const u = Ye(t[i]);
|
|
1570
|
+
o.push(u.coordinates), u.time && a.push(u.time), (u.heartRate || n.length) && (n.length === 0 && (n = new Array(i).fill(null)), n.push(u.heartRate));
|
|
1647
1571
|
}
|
|
1648
1572
|
return {
|
|
1649
1573
|
line: o,
|
|
@@ -1652,20 +1576,20 @@ function $e(r, e) {
|
|
|
1652
1576
|
};
|
|
1653
1577
|
}
|
|
1654
1578
|
}
|
|
1655
|
-
function
|
|
1656
|
-
const e =
|
|
1579
|
+
function no(r) {
|
|
1580
|
+
const e = I(r, "trkseg"), t = [], o = [], a = [];
|
|
1657
1581
|
let n;
|
|
1658
1582
|
for (let i = 0; i < e.length; i++)
|
|
1659
|
-
if (n =
|
|
1583
|
+
if (n = je(e[i], "trkpt"), n !== void 0 && (n.line && t.push(n.line), n.times && n.times.length && o.push(n.times), a.length || n.heartRates && n.heartRates.length)) {
|
|
1660
1584
|
if (!a.length)
|
|
1661
|
-
for (let
|
|
1662
|
-
a.push(new Array(t[
|
|
1585
|
+
for (let u = 0; u < i; u++)
|
|
1586
|
+
a.push(new Array(t[u].length).fill(null));
|
|
1663
1587
|
n.heartRates && n.heartRates.length ? a.push(n.heartRates) : a.push(new Array(n.line.length).fill(null));
|
|
1664
1588
|
}
|
|
1665
1589
|
if (t.length === 0) return;
|
|
1666
1590
|
const l = {
|
|
1667
|
-
...
|
|
1668
|
-
...Ke(
|
|
1591
|
+
...pe(r),
|
|
1592
|
+
...Ke(v(r, "extensions"))
|
|
1669
1593
|
};
|
|
1670
1594
|
return o.length !== 0 && (l.coordTimes = t.length === 1 ? o[0] : o), a.length !== 0 && (l.heartRates = t.length === 1 ? a[0] : a), t.length === 1 ? {
|
|
1671
1595
|
type: "Feature",
|
|
@@ -1683,13 +1607,13 @@ function ao(r) {
|
|
|
1683
1607
|
}
|
|
1684
1608
|
};
|
|
1685
1609
|
}
|
|
1686
|
-
function
|
|
1687
|
-
const e =
|
|
1610
|
+
function lo(r) {
|
|
1611
|
+
const e = je(r, "rtept");
|
|
1688
1612
|
return e === void 0 ? void 0 : {
|
|
1689
1613
|
type: "Feature",
|
|
1690
1614
|
properties: {
|
|
1691
|
-
...
|
|
1692
|
-
...Ke(
|
|
1615
|
+
...pe(r),
|
|
1616
|
+
...Ke(v(r, "extensions"))
|
|
1693
1617
|
},
|
|
1694
1618
|
geometry: {
|
|
1695
1619
|
type: "LineString",
|
|
@@ -1697,10 +1621,10 @@ function no(r) {
|
|
|
1697
1621
|
}
|
|
1698
1622
|
};
|
|
1699
1623
|
}
|
|
1700
|
-
function
|
|
1624
|
+
function io(r) {
|
|
1701
1625
|
return {
|
|
1702
1626
|
type: "Feature",
|
|
1703
|
-
properties: { ...
|
|
1627
|
+
properties: { ...pe(r), ...ue(r, ["sym"]) },
|
|
1704
1628
|
geometry: {
|
|
1705
1629
|
type: "Point",
|
|
1706
1630
|
coordinates: Ye(r).coordinates
|
|
@@ -1710,15 +1634,15 @@ function lo(r) {
|
|
|
1710
1634
|
function Ke(r) {
|
|
1711
1635
|
const e = {};
|
|
1712
1636
|
if (r) {
|
|
1713
|
-
const t =
|
|
1637
|
+
const t = v(r, "line");
|
|
1714
1638
|
if (t) {
|
|
1715
|
-
const o = S(
|
|
1639
|
+
const o = S(v(t, "color")), a = Number.parseFloat(S(v(t, "opacity")) ?? "0"), n = Number.parseFloat(S(v(t, "width")) ?? "0");
|
|
1716
1640
|
o && (e.stroke = o), Number.isNaN(a) || (e["stroke-opacity"] = a), Number.isNaN(n) || (e["stroke-width"] = n * 96 / 25.4);
|
|
1717
1641
|
}
|
|
1718
1642
|
}
|
|
1719
1643
|
return e;
|
|
1720
1644
|
}
|
|
1721
|
-
function
|
|
1645
|
+
function pe(r) {
|
|
1722
1646
|
const e = ue(r, [
|
|
1723
1647
|
"name",
|
|
1724
1648
|
"cmt",
|
|
@@ -1726,12 +1650,12 @@ function de(r) {
|
|
|
1726
1650
|
"type",
|
|
1727
1651
|
"time",
|
|
1728
1652
|
"keywords"
|
|
1729
|
-
]), t =
|
|
1653
|
+
]), t = I(r, "link");
|
|
1730
1654
|
if (t.length !== 0) {
|
|
1731
1655
|
e.links = [];
|
|
1732
1656
|
for (const o of Array.from(t)) {
|
|
1733
1657
|
const a = {
|
|
1734
|
-
href:
|
|
1658
|
+
href: j(o, "href"),
|
|
1735
1659
|
...ue(o, ["text", "type"])
|
|
1736
1660
|
};
|
|
1737
1661
|
e.links.push(a);
|
|
@@ -1739,52 +1663,52 @@ function de(r) {
|
|
|
1739
1663
|
}
|
|
1740
1664
|
return e;
|
|
1741
1665
|
}
|
|
1742
|
-
function
|
|
1666
|
+
function Ee(r) {
|
|
1743
1667
|
let e = 0;
|
|
1744
1668
|
if (!r || !r.length) return e;
|
|
1745
1669
|
for (let t = 0; t < r.length; t++)
|
|
1746
1670
|
e = (e << 5) - e + r.charCodeAt(t) | 0;
|
|
1747
1671
|
return e;
|
|
1748
1672
|
}
|
|
1749
|
-
function
|
|
1673
|
+
function I(r, e) {
|
|
1750
1674
|
return r.getElementsByTagName(e);
|
|
1751
1675
|
}
|
|
1752
|
-
function
|
|
1676
|
+
function j(r, e) {
|
|
1753
1677
|
return r.getAttribute(e);
|
|
1754
1678
|
}
|
|
1755
|
-
function
|
|
1756
|
-
return Number.parseFloat(
|
|
1679
|
+
function xe(r, e) {
|
|
1680
|
+
return Number.parseFloat(j(r, e) ?? "0");
|
|
1757
1681
|
}
|
|
1758
|
-
function
|
|
1759
|
-
const t =
|
|
1682
|
+
function v(r, e) {
|
|
1683
|
+
const t = I(r, e);
|
|
1760
1684
|
return t.length ? t[0] : null;
|
|
1761
1685
|
}
|
|
1762
|
-
function
|
|
1686
|
+
function so(r) {
|
|
1763
1687
|
return r.normalize && r.normalize(), r;
|
|
1764
1688
|
}
|
|
1765
1689
|
function Ze(r) {
|
|
1766
1690
|
return r.map(Number.parseFloat).map((e) => Number.isNaN(e) ? null : e);
|
|
1767
1691
|
}
|
|
1768
1692
|
function S(r) {
|
|
1769
|
-
return r &&
|
|
1693
|
+
return r && so(r), r && r.textContent;
|
|
1770
1694
|
}
|
|
1771
1695
|
function ue(r, e) {
|
|
1772
1696
|
const t = {};
|
|
1773
1697
|
let o, a;
|
|
1774
1698
|
for (a = 0; a < e.length; a++)
|
|
1775
|
-
o =
|
|
1699
|
+
o = v(r, e[a]), o && (t[e[a]] = S(o) ?? "");
|
|
1776
1700
|
return t;
|
|
1777
1701
|
}
|
|
1778
1702
|
function We(r) {
|
|
1779
1703
|
return Ze(r.replace(/\s*/g, "").split(","));
|
|
1780
1704
|
}
|
|
1781
|
-
function
|
|
1705
|
+
function Ie(r) {
|
|
1782
1706
|
const e = r.replace(/^\s*|\s*$/g, "").split(/\s+/), t = [];
|
|
1783
1707
|
for (const o of e) t.push(We(o));
|
|
1784
1708
|
return t;
|
|
1785
1709
|
}
|
|
1786
1710
|
function Ye(r) {
|
|
1787
|
-
const e = [
|
|
1711
|
+
const e = [xe(r, "lon"), xe(r, "lat")], t = v(r, "ele"), o = v(r, "gpxtpx:hr") || v(r, "hr"), a = v(r, "time");
|
|
1788
1712
|
let n;
|
|
1789
1713
|
return t && (n = Number.parseFloat(S(t) ?? "0"), Number.isNaN(n) || e.push(n)), {
|
|
1790
1714
|
coordinates: e,
|
|
@@ -1792,10 +1716,10 @@ function Ye(r) {
|
|
|
1792
1716
|
heartRate: o !== null ? Number.parseFloat(S(o) ?? "0") : null
|
|
1793
1717
|
};
|
|
1794
1718
|
}
|
|
1795
|
-
function
|
|
1719
|
+
function co(r) {
|
|
1796
1720
|
let e = r;
|
|
1797
1721
|
try {
|
|
1798
|
-
typeof e == "string" && (e =
|
|
1722
|
+
typeof e == "string" && (e = de(e));
|
|
1799
1723
|
} catch {
|
|
1800
1724
|
return null;
|
|
1801
1725
|
}
|
|
@@ -1804,7 +1728,7 @@ function so(r) {
|
|
|
1804
1728
|
} catch {
|
|
1805
1729
|
}
|
|
1806
1730
|
try {
|
|
1807
|
-
return
|
|
1731
|
+
return $e(e);
|
|
1808
1732
|
} catch {
|
|
1809
1733
|
}
|
|
1810
1734
|
return null;
|
|
@@ -1813,7 +1737,7 @@ function X(r) {
|
|
|
1813
1737
|
const e = r.toString(16);
|
|
1814
1738
|
return e.length === 1 ? `0${e}` : e;
|
|
1815
1739
|
}
|
|
1816
|
-
function
|
|
1740
|
+
function uo(r) {
|
|
1817
1741
|
return `#${X(r[0])}${X(r[1])}${X(r[2])}${r.length === 4 ? X(r[3]) : ""}`;
|
|
1818
1742
|
}
|
|
1819
1743
|
class g extends Array {
|
|
@@ -1847,18 +1771,18 @@ class g extends Array {
|
|
|
1847
1771
|
color: t[i].color.slice()
|
|
1848
1772
|
// we want to make sure we do a deep copy and not a reference
|
|
1849
1773
|
});
|
|
1850
|
-
return a.sort((i,
|
|
1774
|
+
return a.sort((i, u) => i.value < u.value ? -1 : 1), this.min = n, this.max = l, a;
|
|
1851
1775
|
}
|
|
1852
1776
|
scale(t, o, a = { clone: !0 }) {
|
|
1853
|
-
const n = a.clone, l = this[0].value,
|
|
1854
|
-
for (let
|
|
1855
|
-
const m = (this[
|
|
1856
|
-
n ?
|
|
1777
|
+
const n = a.clone, l = this[0].value, u = this.at(-1).value - l, h = o - t, c = [];
|
|
1778
|
+
for (let s = 0; s < this.length; s += 1) {
|
|
1779
|
+
const m = (this[s].value - l) / u * h + t;
|
|
1780
|
+
n ? c.push({
|
|
1857
1781
|
value: m,
|
|
1858
|
-
color: this[
|
|
1859
|
-
}) : this[
|
|
1782
|
+
color: this[s].color.slice()
|
|
1783
|
+
}) : this[s].value = m;
|
|
1860
1784
|
}
|
|
1861
|
-
return n ? new g({ stops:
|
|
1785
|
+
return n ? new g({ stops: c }) : this;
|
|
1862
1786
|
}
|
|
1863
1787
|
// for some reason, I had to reimplement this
|
|
1864
1788
|
at(t) {
|
|
@@ -1895,9 +1819,9 @@ class g extends Array {
|
|
|
1895
1819
|
const n = this[a].color;
|
|
1896
1820
|
if (!o.smooth)
|
|
1897
1821
|
return n.slice();
|
|
1898
|
-
const l = this[a].value, i = this[a + 1].value,
|
|
1822
|
+
const l = this[a].value, i = this[a + 1].value, u = this[a + 1].color, h = (i - t) / (i - l);
|
|
1899
1823
|
return n.map(
|
|
1900
|
-
(
|
|
1824
|
+
(c, s) => Math.round(c * h + u[s] * (1 - h))
|
|
1901
1825
|
);
|
|
1902
1826
|
}
|
|
1903
1827
|
return [0, 0, 0];
|
|
@@ -1909,7 +1833,7 @@ class g extends Array {
|
|
|
1909
1833
|
smooth: !0,
|
|
1910
1834
|
withAlpha: !1
|
|
1911
1835
|
}) {
|
|
1912
|
-
return
|
|
1836
|
+
return uo(this.getColor(t, o));
|
|
1913
1837
|
}
|
|
1914
1838
|
/**
|
|
1915
1839
|
* Get the color of the color ramp at a relative position in [0, 1]
|
|
@@ -1927,12 +1851,12 @@ class g extends Array {
|
|
|
1927
1851
|
o.width = t.horizontal ? t.size : 1, o.height = t.horizontal ? 1 : t.size;
|
|
1928
1852
|
const a = o.getContext("2d");
|
|
1929
1853
|
if (!a) throw new Error("Canvs context is missing");
|
|
1930
|
-
const n = a.getImageData(0, 0, o.width, o.height), l = n.data, i = t.size,
|
|
1931
|
-
for (let
|
|
1932
|
-
const
|
|
1854
|
+
const n = a.getImageData(0, 0, o.width, o.height), l = n.data, i = t.size, u = this[0].value, s = (this.at(-1).value - u) / i;
|
|
1855
|
+
for (let d = 0; d < i; d += 1) {
|
|
1856
|
+
const p = this.getColor(u + d * s, {
|
|
1933
1857
|
smooth: t.smooth
|
|
1934
1858
|
});
|
|
1935
|
-
l[
|
|
1859
|
+
l[d * 4] = p[0], l[d * 4 + 1] = p[1], l[d * 4 + 2] = p[2], l[d * 4 + 3] = p.length > 3 ? p[3] : 255;
|
|
1936
1860
|
}
|
|
1937
1861
|
return a.putImageData(n, 0, 0), o;
|
|
1938
1862
|
}
|
|
@@ -1943,34 +1867,34 @@ class g extends Array {
|
|
|
1943
1867
|
const a = this.getBounds(), n = this.scale(0, 1), l = 1 / (o - 1);
|
|
1944
1868
|
let i;
|
|
1945
1869
|
if (t === "ease-in-square")
|
|
1946
|
-
i = Array.from({ length: o }, (
|
|
1947
|
-
const
|
|
1948
|
-
return { value:
|
|
1870
|
+
i = Array.from({ length: o }, (c, s) => {
|
|
1871
|
+
const d = s * l, p = d ** 2, m = n.getColor(p);
|
|
1872
|
+
return { value: d, color: m };
|
|
1949
1873
|
});
|
|
1950
1874
|
else if (t === "ease-out-square")
|
|
1951
|
-
i = Array.from({ length: o }, (
|
|
1952
|
-
const
|
|
1953
|
-
return { value:
|
|
1875
|
+
i = Array.from({ length: o }, (c, s) => {
|
|
1876
|
+
const d = s * l, p = 1 - (1 - d) ** 2, m = n.getColor(p);
|
|
1877
|
+
return { value: d, color: m };
|
|
1954
1878
|
});
|
|
1955
1879
|
else if (t === "ease-out-sqrt")
|
|
1956
|
-
i = Array.from({ length: o }, (
|
|
1957
|
-
const
|
|
1958
|
-
return { value:
|
|
1880
|
+
i = Array.from({ length: o }, (c, s) => {
|
|
1881
|
+
const d = s * l, p = d ** 0.5, m = n.getColor(p);
|
|
1882
|
+
return { value: d, color: m };
|
|
1959
1883
|
});
|
|
1960
1884
|
else if (t === "ease-in-sqrt")
|
|
1961
|
-
i = Array.from({ length: o }, (
|
|
1962
|
-
const
|
|
1963
|
-
return { value:
|
|
1885
|
+
i = Array.from({ length: o }, (c, s) => {
|
|
1886
|
+
const d = s * l, p = 1 - (1 - d) ** 0.5, m = n.getColor(p);
|
|
1887
|
+
return { value: d, color: m };
|
|
1964
1888
|
});
|
|
1965
1889
|
else if (t === "ease-out-exp")
|
|
1966
|
-
i = Array.from({ length: o }, (
|
|
1967
|
-
const
|
|
1968
|
-
return { value:
|
|
1890
|
+
i = Array.from({ length: o }, (c, s) => {
|
|
1891
|
+
const d = s * l, p = 1 - 2 ** (-10 * d), m = n.getColor(p);
|
|
1892
|
+
return { value: d, color: m };
|
|
1969
1893
|
});
|
|
1970
1894
|
else if (t === "ease-in-exp")
|
|
1971
|
-
i = Array.from({ length: o }, (
|
|
1972
|
-
const
|
|
1973
|
-
return { value:
|
|
1895
|
+
i = Array.from({ length: o }, (c, s) => {
|
|
1896
|
+
const d = s * l, p = 2 ** (10 * d - 10), m = n.getColor(p);
|
|
1897
|
+
return { value: d, color: m };
|
|
1974
1898
|
});
|
|
1975
1899
|
else
|
|
1976
1900
|
throw new Error("Invalid ressampling method.");
|
|
@@ -1996,7 +1920,7 @@ class g extends Array {
|
|
|
1996
1920
|
return this[0].color.length === 4 && this[0].color[3] === 0;
|
|
1997
1921
|
}
|
|
1998
1922
|
}
|
|
1999
|
-
const
|
|
1923
|
+
const qe = {
|
|
2000
1924
|
/**
|
|
2001
1925
|
* A fully transparent [0, 0, 0, 0] colorramp to hide data.
|
|
2002
1926
|
* Defined in interval [0, 1], without unit.
|
|
@@ -2751,7 +2675,29 @@ const Je = {
|
|
|
2751
2675
|
{ value: 1, color: [222, 245, 229, 255] }
|
|
2752
2676
|
]
|
|
2753
2677
|
})
|
|
2754
|
-
}
|
|
2678
|
+
};
|
|
2679
|
+
async function po(r, e = {}) {
|
|
2680
|
+
const t = e.download ?? !1, o = await ho(r);
|
|
2681
|
+
if (t) {
|
|
2682
|
+
const a = e.filename ?? "maptiler_screenshot.png", n = document.createElement("a");
|
|
2683
|
+
n.style.display = "none", document.body.appendChild(n), n.href = URL.createObjectURL(o), n.download = a, n.click(), setTimeout(() => {
|
|
2684
|
+
document.body.removeChild(n), URL.revokeObjectURL(n.href);
|
|
2685
|
+
}, 0);
|
|
2686
|
+
}
|
|
2687
|
+
return o;
|
|
2688
|
+
}
|
|
2689
|
+
function ho(r) {
|
|
2690
|
+
return new Promise((e, t) => {
|
|
2691
|
+
r.redraw(), r.once("idle", () => {
|
|
2692
|
+
r.getCanvas().toBlob((o) => {
|
|
2693
|
+
if (!o)
|
|
2694
|
+
return t(Error("Screenshot could not be created."));
|
|
2695
|
+
e(o);
|
|
2696
|
+
}, "image/png");
|
|
2697
|
+
});
|
|
2698
|
+
});
|
|
2699
|
+
}
|
|
2700
|
+
const Me = [
|
|
2755
2701
|
// https://colorhunt.co/palette/1d5b79468b97ef6262f3aa60
|
|
2756
2702
|
["#1D5B79", "#468B97", "#EF6262", "#F3AA60"],
|
|
2757
2703
|
// https://colorhunt.co/palette/614bc333bbc585e6c5c8ffe0
|
|
@@ -2772,15 +2718,15 @@ const Je = {
|
|
|
2772
2718
|
["#10A19D", "#540375", "#FF7000", "#FFBF00"]
|
|
2773
2719
|
];
|
|
2774
2720
|
function he() {
|
|
2775
|
-
return
|
|
2721
|
+
return Me[~~(Math.random() * Me.length)][~~(Math.random() * 4)];
|
|
2776
2722
|
}
|
|
2777
2723
|
function te() {
|
|
2778
|
-
return `maptiler_source_${
|
|
2724
|
+
return `maptiler_source_${De()}`;
|
|
2779
2725
|
}
|
|
2780
2726
|
function oe() {
|
|
2781
|
-
return `maptiler_layer_${
|
|
2727
|
+
return `maptiler_layer_${De()}`;
|
|
2782
2728
|
}
|
|
2783
|
-
function
|
|
2729
|
+
function Pe(r, e) {
|
|
2784
2730
|
if (e <= r[0].zoom)
|
|
2785
2731
|
return r[0].value;
|
|
2786
2732
|
if (e >= r[r.length - 1].zoom)
|
|
@@ -2792,13 +2738,13 @@ function Me(r, e) {
|
|
|
2792
2738
|
}
|
|
2793
2739
|
return 0;
|
|
2794
2740
|
}
|
|
2795
|
-
function
|
|
2741
|
+
function K(r) {
|
|
2796
2742
|
return ["interpolate", ["linear"], ["zoom"], ...r.flatMap((e) => [e.zoom, e.value])];
|
|
2797
2743
|
}
|
|
2798
|
-
function
|
|
2744
|
+
function A(r) {
|
|
2799
2745
|
return ["interpolate", ["linear"], ["zoom"], ...r.flatMap((e) => [e.zoom, e.value])];
|
|
2800
2746
|
}
|
|
2801
|
-
function
|
|
2747
|
+
function mo(r, e) {
|
|
2802
2748
|
if (typeof e == "number" && typeof r == "number")
|
|
2803
2749
|
return 2 * e + r;
|
|
2804
2750
|
if (typeof e == "number" && Array.isArray(r))
|
|
@@ -2813,15 +2759,15 @@ function uo(r, e) {
|
|
|
2813
2759
|
"interpolate",
|
|
2814
2760
|
["linear"],
|
|
2815
2761
|
["zoom"],
|
|
2816
|
-
...t.flatMap((o) => [o, 2 *
|
|
2762
|
+
...t.flatMap((o) => [o, 2 * Pe(e, o) + Pe(r, o)])
|
|
2817
2763
|
];
|
|
2818
2764
|
}
|
|
2819
2765
|
return 0;
|
|
2820
2766
|
}
|
|
2821
|
-
function
|
|
2767
|
+
function fo(r, e) {
|
|
2822
2768
|
return ["interpolate", ["linear"], ["get", e], ...r.flatMap((t) => [t.propertyValue, t.value])];
|
|
2823
2769
|
}
|
|
2824
|
-
function
|
|
2770
|
+
function Je(r) {
|
|
2825
2771
|
const e = r.trimStart(), t = `${e}${" ".repeat(r.length - e.length)}`, o = Array.from(t);
|
|
2826
2772
|
if (!o.every((i) => i === " " || i === "_"))
|
|
2827
2773
|
throw new Error("A dash pattern must be composed only of whitespace and underscore characters.");
|
|
@@ -2829,15 +2775,15 @@ function qe(r) {
|
|
|
2829
2775
|
throw new Error("A dash pattern must contain at least one underscore and one whitespace character");
|
|
2830
2776
|
const l = [1];
|
|
2831
2777
|
for (let i = 1; i < o.length; i += 1) {
|
|
2832
|
-
const
|
|
2833
|
-
|
|
2778
|
+
const u = o[i - 1], h = o[i];
|
|
2779
|
+
u === h ? l[l.length - 1] += 1 : l.push(1);
|
|
2834
2780
|
}
|
|
2835
2781
|
return l;
|
|
2836
2782
|
}
|
|
2837
|
-
function
|
|
2783
|
+
function ke(r, e) {
|
|
2838
2784
|
return ["interpolate", ["linear"], ["get", e], ...r.flatMap((t) => [t.value, t.color])];
|
|
2839
2785
|
}
|
|
2840
|
-
function
|
|
2786
|
+
function Fe(r, e, t = !0) {
|
|
2841
2787
|
return t ? [
|
|
2842
2788
|
"interpolate",
|
|
2843
2789
|
["linear"],
|
|
@@ -2854,7 +2800,7 @@ function Oe(r, e, t = !0) {
|
|
|
2854
2800
|
["interpolate", ["linear"], ["get", e], ...r.flatMap((o) => [o.value, o.pointRadius])]
|
|
2855
2801
|
] : ["interpolate", ["linear"], ["get", e], ...r.flatMap((o) => [o.value, o.pointRadius])];
|
|
2856
2802
|
}
|
|
2857
|
-
function
|
|
2803
|
+
function go(r, e, t = !0) {
|
|
2858
2804
|
return t ? [
|
|
2859
2805
|
"interpolate",
|
|
2860
2806
|
["linear"],
|
|
@@ -2871,7 +2817,7 @@ function ho(r, e, t = !0) {
|
|
|
2871
2817
|
["interpolate", ["linear"], ["get", e], ...r.flatMap((o) => [o.propertyValue, o.value])]
|
|
2872
2818
|
] : ["interpolate", ["linear"], ["get", e], ...r.flatMap((o) => [o.propertyValue, o.value])];
|
|
2873
2819
|
}
|
|
2874
|
-
function
|
|
2820
|
+
function Oe(r, e) {
|
|
2875
2821
|
return r.every((t) => t.color[3] === r[0].color[3]) ? r[0].color[3] ? r[0].color[3] / 255 : 1 : [
|
|
2876
2822
|
"interpolate",
|
|
2877
2823
|
["linear"],
|
|
@@ -2882,7 +2828,7 @@ function ke(r, e) {
|
|
|
2882
2828
|
})
|
|
2883
2829
|
];
|
|
2884
2830
|
}
|
|
2885
|
-
function
|
|
2831
|
+
function yo(r, e = 10) {
|
|
2886
2832
|
return [
|
|
2887
2833
|
"interpolate",
|
|
2888
2834
|
["linear"],
|
|
@@ -2893,33 +2839,33 @@ function mo(r, e = 10) {
|
|
|
2893
2839
|
}).flat()
|
|
2894
2840
|
];
|
|
2895
2841
|
}
|
|
2896
|
-
async function
|
|
2842
|
+
async function vo(r, e, t = {}) {
|
|
2897
2843
|
var a, n;
|
|
2898
2844
|
if (!e.sourceId && !e.data)
|
|
2899
2845
|
throw new Error("Creating a polyline layer requires an existing .sourceId or a valid .data property");
|
|
2900
2846
|
let o = e.data;
|
|
2901
2847
|
if (typeof o == "string") {
|
|
2902
2848
|
if (ee(o))
|
|
2903
|
-
o = `https://api.maptiler.com/data/${e.data}/features.json?key=${
|
|
2849
|
+
o = `https://api.maptiler.com/data/${e.data}/features.json?key=${M.apiKey}`;
|
|
2904
2850
|
else if (((a = o.split(".").pop()) == null ? void 0 : a.toLowerCase().trim()) === "gpx") {
|
|
2905
2851
|
const i = await (await fetch(o, t)).text();
|
|
2906
2852
|
o = Ve(i);
|
|
2907
2853
|
} else if (((n = o.split(".").pop()) == null ? void 0 : n.toLowerCase().trim()) === "kml") {
|
|
2908
2854
|
const i = await (await fetch(o, t)).text();
|
|
2909
|
-
o =
|
|
2855
|
+
o = $e(i);
|
|
2910
2856
|
} else {
|
|
2911
|
-
const l = Ht(o) ??
|
|
2857
|
+
const l = Ht(o) ?? co(o);
|
|
2912
2858
|
l && (o = l);
|
|
2913
2859
|
}
|
|
2914
2860
|
if (!o)
|
|
2915
2861
|
throw new Error("Polyline data was provided as string but is incompatible with valid formats.");
|
|
2916
2862
|
}
|
|
2917
|
-
return
|
|
2863
|
+
return Lo(r, {
|
|
2918
2864
|
...e,
|
|
2919
2865
|
data: o
|
|
2920
2866
|
});
|
|
2921
2867
|
}
|
|
2922
|
-
function
|
|
2868
|
+
function Lo(r, e) {
|
|
2923
2869
|
if (e.layerId && r.getLayer(e.layerId))
|
|
2924
2870
|
throw new Error(`A layer already exists with the layer id: ${e.layerId}`);
|
|
2925
2871
|
const t = e.sourceId ?? te(), o = e.layerId ?? oe(), a = {
|
|
@@ -2931,14 +2877,14 @@ function go(r, e) {
|
|
|
2931
2877
|
type: "geojson",
|
|
2932
2878
|
data: e.data
|
|
2933
2879
|
});
|
|
2934
|
-
const n = e.lineWidth ?? 3, l = e.lineColor ?? he(), i = e.lineOpacity ?? 1,
|
|
2935
|
-
let
|
|
2936
|
-
const
|
|
2937
|
-
if (typeof
|
|
2938
|
-
const
|
|
2939
|
-
a.polylineOutlineLayerId =
|
|
2880
|
+
const n = e.lineWidth ?? 3, l = e.lineColor ?? he(), i = e.lineOpacity ?? 1, u = e.lineBlur ?? 0, h = e.lineGapWidth ?? 0;
|
|
2881
|
+
let c = e.lineDashArray ?? null;
|
|
2882
|
+
const s = e.outlineWidth ?? 1, d = e.outlineColor ?? "#FFFFFF", p = e.outlineOpacity ?? 1, m = e.outlineBlur ?? 0;
|
|
2883
|
+
if (typeof c == "string" && (c = Je(c)), e.outline === !0) {
|
|
2884
|
+
const y = `${o}_outline`;
|
|
2885
|
+
a.polylineOutlineLayerId = y, r.addLayer(
|
|
2940
2886
|
{
|
|
2941
|
-
id:
|
|
2887
|
+
id: y,
|
|
2942
2888
|
type: "line",
|
|
2943
2889
|
source: t,
|
|
2944
2890
|
layout: {
|
|
@@ -2948,10 +2894,10 @@ function go(r, e) {
|
|
|
2948
2894
|
minzoom: e.minzoom ?? 0,
|
|
2949
2895
|
maxzoom: e.maxzoom ?? 23,
|
|
2950
2896
|
paint: {
|
|
2951
|
-
"line-opacity": typeof
|
|
2952
|
-
"line-color": typeof
|
|
2953
|
-
"line-width":
|
|
2954
|
-
"line-blur": typeof m == "number" ? m :
|
|
2897
|
+
"line-opacity": typeof p == "number" ? p : A(p),
|
|
2898
|
+
"line-color": typeof d == "string" ? d : K(d),
|
|
2899
|
+
"line-width": mo(n, s),
|
|
2900
|
+
"line-blur": typeof m == "number" ? m : A(m)
|
|
2955
2901
|
}
|
|
2956
2902
|
},
|
|
2957
2903
|
e.beforeId
|
|
@@ -2969,23 +2915,23 @@ function go(r, e) {
|
|
|
2969
2915
|
minzoom: e.minzoom ?? 0,
|
|
2970
2916
|
maxzoom: e.maxzoom ?? 23,
|
|
2971
2917
|
paint: {
|
|
2972
|
-
"line-opacity": typeof i == "number" ? i :
|
|
2973
|
-
"line-color": typeof l == "string" ? l :
|
|
2974
|
-
"line-width": typeof n == "number" ? n :
|
|
2975
|
-
"line-blur": typeof
|
|
2976
|
-
"line-gap-width": typeof h == "number" ? h :
|
|
2918
|
+
"line-opacity": typeof i == "number" ? i : A(i),
|
|
2919
|
+
"line-color": typeof l == "string" ? l : K(l),
|
|
2920
|
+
"line-width": typeof n == "number" ? n : A(n),
|
|
2921
|
+
"line-blur": typeof u == "number" ? u : A(u),
|
|
2922
|
+
"line-gap-width": typeof h == "number" ? h : A(h),
|
|
2977
2923
|
// For some reasons passing "line-dasharray" with the value "undefined"
|
|
2978
2924
|
// results in no showing the line while it should have the same behavior
|
|
2979
2925
|
// of not adding the property "line-dasharray" as all.
|
|
2980
2926
|
// As a workaround, we are inlining the addition of the prop with a conditional
|
|
2981
2927
|
// which is less readable.
|
|
2982
|
-
...
|
|
2928
|
+
...c && { "line-dasharray": c }
|
|
2983
2929
|
}
|
|
2984
2930
|
},
|
|
2985
2931
|
e.beforeId
|
|
2986
2932
|
), a;
|
|
2987
2933
|
}
|
|
2988
|
-
function
|
|
2934
|
+
function wo(r, e) {
|
|
2989
2935
|
if (e.layerId && r.getLayer(e.layerId))
|
|
2990
2936
|
throw new Error(`A layer already exists with the layer id: ${e.layerId}`);
|
|
2991
2937
|
const t = e.sourceId ?? te(), o = e.layerId ?? oe(), a = {
|
|
@@ -2994,16 +2940,16 @@ function yo(r, e) {
|
|
|
2994
2940
|
polygonSourceId: t
|
|
2995
2941
|
};
|
|
2996
2942
|
if (e.data && !r.getSource(t)) {
|
|
2997
|
-
let
|
|
2998
|
-
typeof
|
|
2943
|
+
let y = e.data;
|
|
2944
|
+
typeof y == "string" && ee(y) && (y = `https://api.maptiler.com/data/${y}/features.json?key=${M.apiKey}`), r.addSource(t, {
|
|
2999
2945
|
type: "geojson",
|
|
3000
|
-
data:
|
|
2946
|
+
data: y
|
|
3001
2947
|
});
|
|
3002
2948
|
}
|
|
3003
2949
|
let n = e.outlineDashArray ?? null;
|
|
3004
|
-
const l = e.outlineWidth ?? 1, i = e.outlineColor ?? "#FFFFFF",
|
|
3005
|
-
typeof n == "string" && (n =
|
|
3006
|
-
const m = (
|
|
2950
|
+
const l = e.outlineWidth ?? 1, i = e.outlineColor ?? "#FFFFFF", u = e.outlineOpacity ?? 1, h = e.outlineBlur ?? 0, c = e.fillColor ?? he(), s = e.fillOpacity ?? 1, d = e.outlinePosition ?? "center", p = e.pattern ?? null;
|
|
2951
|
+
typeof n == "string" && (n = Je(n));
|
|
2952
|
+
const m = (y = null) => {
|
|
3007
2953
|
if (r.addLayer(
|
|
3008
2954
|
{
|
|
3009
2955
|
id: o,
|
|
@@ -3012,26 +2958,26 @@ function yo(r, e) {
|
|
|
3012
2958
|
minzoom: e.minzoom ?? 0,
|
|
3013
2959
|
maxzoom: e.maxzoom ?? 23,
|
|
3014
2960
|
paint: {
|
|
3015
|
-
"fill-color": typeof
|
|
3016
|
-
"fill-opacity": typeof
|
|
2961
|
+
"fill-color": typeof c == "string" ? c : K(c),
|
|
2962
|
+
"fill-opacity": typeof s == "number" ? s : A(s),
|
|
3017
2963
|
// Adding a pattern if provided
|
|
3018
|
-
...
|
|
2964
|
+
...y && { "fill-pattern": y }
|
|
3019
2965
|
}
|
|
3020
2966
|
},
|
|
3021
2967
|
e.beforeId
|
|
3022
2968
|
), e.outline === !0) {
|
|
3023
|
-
let
|
|
3024
|
-
|
|
3025
|
-
l.map(({ zoom:
|
|
3026
|
-
zoom:
|
|
3027
|
-
value: 0.5 *
|
|
2969
|
+
let b;
|
|
2970
|
+
d === "inside" ? typeof l == "number" ? b = 0.5 * l : b = A(
|
|
2971
|
+
l.map(({ zoom: P, value: w }) => ({
|
|
2972
|
+
zoom: P,
|
|
2973
|
+
value: 0.5 * w
|
|
3028
2974
|
}))
|
|
3029
|
-
) :
|
|
3030
|
-
l.map((
|
|
3031
|
-
zoom:
|
|
3032
|
-
value: -0.5 *
|
|
2975
|
+
) : d === "outside" ? typeof l == "number" ? b = -0.5 * l : b = A(
|
|
2976
|
+
l.map((P) => ({
|
|
2977
|
+
zoom: P.zoom,
|
|
2978
|
+
value: -0.5 * P.value
|
|
3033
2979
|
}))
|
|
3034
|
-
) :
|
|
2980
|
+
) : b = 0, r.addLayer(
|
|
3035
2981
|
{
|
|
3036
2982
|
id: a.polygonOutlineLayerId,
|
|
3037
2983
|
type: "line",
|
|
@@ -3043,11 +2989,11 @@ function yo(r, e) {
|
|
|
3043
2989
|
minzoom: e.minzoom ?? 0,
|
|
3044
2990
|
maxzoom: e.maxzoom ?? 23,
|
|
3045
2991
|
paint: {
|
|
3046
|
-
"line-opacity": typeof
|
|
3047
|
-
"line-color": typeof i == "string" ? i :
|
|
3048
|
-
"line-width": typeof l == "number" ? l :
|
|
3049
|
-
"line-blur": typeof h == "number" ? h :
|
|
3050
|
-
"line-offset":
|
|
2992
|
+
"line-opacity": typeof u == "number" ? u : A(u),
|
|
2993
|
+
"line-color": typeof i == "string" ? i : K(i),
|
|
2994
|
+
"line-width": typeof l == "number" ? l : A(l),
|
|
2995
|
+
"line-blur": typeof h == "number" ? h : A(h),
|
|
2996
|
+
"line-offset": b,
|
|
3051
2997
|
// For some reasons passing "line-dasharray" with the value "undefined"
|
|
3052
2998
|
// results in no showing the line while it should have the same behavior
|
|
3053
2999
|
// of not adding the property "line-dasharray" as all.
|
|
@@ -3062,103 +3008,103 @@ function yo(r, e) {
|
|
|
3062
3008
|
);
|
|
3063
3009
|
}
|
|
3064
3010
|
};
|
|
3065
|
-
return
|
|
3066
|
-
r.addImage(
|
|
3067
|
-
}).catch((
|
|
3011
|
+
return p ? r.hasImage(p) ? m(p) : r.loadImage(p).then((y) => {
|
|
3012
|
+
r.addImage(p, y.data), m(p);
|
|
3013
|
+
}).catch((y) => (console.error("Could not load the pattern image.", y.message), m())) : m(), a;
|
|
3068
3014
|
}
|
|
3069
|
-
function
|
|
3015
|
+
function Co(r, e) {
|
|
3070
3016
|
if (e.layerId && r.getLayer(e.layerId))
|
|
3071
3017
|
throw new Error(`A layer already exists with the layer id: ${e.layerId}`);
|
|
3072
|
-
const t = e.minPointRadius ?? 10, o = e.maxPointRadius ?? 50, a = e.cluster ?? !1, n = 20, l = Array.isArray(e.pointColor) ? e.pointColor :
|
|
3073
|
-
let
|
|
3074
|
-
const
|
|
3075
|
-
typeof e.pointOpacity == "number" ?
|
|
3076
|
-
{ zoom:
|
|
3077
|
-
{ zoom:
|
|
3078
|
-
{ zoom:
|
|
3079
|
-
{ zoom:
|
|
3018
|
+
const t = e.minPointRadius ?? 10, o = e.maxPointRadius ?? 50, a = e.cluster ?? !1, n = 20, l = Array.isArray(e.pointColor) ? e.pointColor : qe.TURBO.scale(10, e.cluster ? 1e4 : 1e3).resample("ease-out-square"), i = l.getBounds(), u = e.sourceId ?? te(), h = e.layerId ?? oe(), c = e.showLabel ?? a, s = e.alignOnViewport ?? !0, d = e.outline ?? !1, p = e.outlineOpacity ?? 1, m = e.outlineWidth ?? 1, y = e.outlineColor ?? "#FFFFFF";
|
|
3019
|
+
let b;
|
|
3020
|
+
const P = e.zoomCompensation ?? !0, w = e.minzoom ?? 0, _ = e.maxzoom ?? 23;
|
|
3021
|
+
typeof e.pointOpacity == "number" ? b = e.pointOpacity : Array.isArray(e.pointOpacity) ? b = A(e.pointOpacity) : e.cluster ? b = Oe(l, "point_count") : e.property ? b = Oe(l, e.property) : b = A([
|
|
3022
|
+
{ zoom: w, value: 0 },
|
|
3023
|
+
{ zoom: w + 0.25, value: 1 },
|
|
3024
|
+
{ zoom: _ - 0.25, value: 1 },
|
|
3025
|
+
{ zoom: _, value: 0 }
|
|
3080
3026
|
]);
|
|
3081
|
-
const
|
|
3027
|
+
const E = {
|
|
3082
3028
|
pointLayerId: h,
|
|
3083
3029
|
clusterLayerId: "",
|
|
3084
3030
|
labelLayerId: "",
|
|
3085
|
-
pointSourceId:
|
|
3031
|
+
pointSourceId: u
|
|
3086
3032
|
};
|
|
3087
|
-
if (e.data && !r.getSource(
|
|
3088
|
-
let
|
|
3089
|
-
typeof
|
|
3033
|
+
if (e.data && !r.getSource(u)) {
|
|
3034
|
+
let R = e.data;
|
|
3035
|
+
typeof R == "string" && ee(R) && (R = `https://api.maptiler.com/data/${R}/features.json?key=${M.apiKey}`), r.addSource(u, {
|
|
3090
3036
|
type: "geojson",
|
|
3091
|
-
data:
|
|
3037
|
+
data: R,
|
|
3092
3038
|
cluster: a
|
|
3093
3039
|
});
|
|
3094
3040
|
}
|
|
3095
3041
|
if (a) {
|
|
3096
|
-
|
|
3097
|
-
const
|
|
3098
|
-
const W = i.min +
|
|
3042
|
+
E.clusterLayerId = `${h}_cluster`;
|
|
3043
|
+
const R = Array.from({ length: n }, (D, V) => {
|
|
3044
|
+
const W = i.min + V * (i.max - i.min) / (n - 1);
|
|
3099
3045
|
return {
|
|
3100
3046
|
value: W,
|
|
3101
|
-
pointRadius: t + (o - t) * (
|
|
3047
|
+
pointRadius: t + (o - t) * (V / (n - 1)) ** 0.5,
|
|
3102
3048
|
color: l.getColorHex(W)
|
|
3103
3049
|
};
|
|
3104
3050
|
});
|
|
3105
3051
|
r.addLayer(
|
|
3106
3052
|
{
|
|
3107
|
-
id:
|
|
3053
|
+
id: E.clusterLayerId,
|
|
3108
3054
|
type: "circle",
|
|
3109
|
-
source:
|
|
3055
|
+
source: u,
|
|
3110
3056
|
filter: ["has", "point_count"],
|
|
3111
3057
|
paint: {
|
|
3112
3058
|
// 'circle-color': options.pointColor ?? colorDrivenByProperty(clusterStyle, "point_count"),
|
|
3113
|
-
"circle-color": typeof e.pointColor == "string" ? e.pointColor :
|
|
3114
|
-
"circle-radius": typeof e.pointRadius == "number" ? e.pointRadius : Array.isArray(e.pointRadius) ?
|
|
3115
|
-
"circle-pitch-alignment":
|
|
3059
|
+
"circle-color": typeof e.pointColor == "string" ? e.pointColor : ke(R, "point_count"),
|
|
3060
|
+
"circle-radius": typeof e.pointRadius == "number" ? e.pointRadius : Array.isArray(e.pointRadius) ? A(e.pointRadius) : Fe(R, "point_count", !1),
|
|
3061
|
+
"circle-pitch-alignment": s ? "viewport" : "map",
|
|
3116
3062
|
"circle-pitch-scale": "map",
|
|
3117
3063
|
// scale with camera distance regardless of viewport/biewport alignement
|
|
3118
|
-
"circle-opacity":
|
|
3119
|
-
...
|
|
3120
|
-
"circle-stroke-opacity": typeof
|
|
3121
|
-
"circle-stroke-width": typeof m == "number" ? m :
|
|
3122
|
-
"circle-stroke-color": typeof
|
|
3064
|
+
"circle-opacity": b,
|
|
3065
|
+
...d && {
|
|
3066
|
+
"circle-stroke-opacity": typeof p == "number" ? p : A(p),
|
|
3067
|
+
"circle-stroke-width": typeof m == "number" ? m : A(m),
|
|
3068
|
+
"circle-stroke-color": typeof y == "string" ? y : K(y)
|
|
3123
3069
|
}
|
|
3124
3070
|
},
|
|
3125
|
-
minzoom:
|
|
3126
|
-
maxzoom:
|
|
3071
|
+
minzoom: w,
|
|
3072
|
+
maxzoom: _
|
|
3127
3073
|
},
|
|
3128
3074
|
e.beforeId
|
|
3129
3075
|
), r.addLayer(
|
|
3130
3076
|
{
|
|
3131
|
-
id:
|
|
3077
|
+
id: E.pointLayerId,
|
|
3132
3078
|
type: "circle",
|
|
3133
|
-
source:
|
|
3079
|
+
source: u,
|
|
3134
3080
|
filter: ["!", ["has", "point_count"]],
|
|
3135
3081
|
paint: {
|
|
3136
|
-
"circle-pitch-alignment":
|
|
3082
|
+
"circle-pitch-alignment": s ? "viewport" : "map",
|
|
3137
3083
|
"circle-pitch-scale": "map",
|
|
3138
3084
|
// scale with camera distance regardless of viewport/biewport alignement
|
|
3139
3085
|
// 'circle-color': options.pointColor ?? clusterStyle[0].color,
|
|
3140
3086
|
"circle-color": typeof e.pointColor == "string" ? e.pointColor : l.getColorHex(l.getBounds().min),
|
|
3141
|
-
"circle-radius": typeof e.pointRadius == "number" ? e.pointRadius : Array.isArray(e.pointRadius) ?
|
|
3142
|
-
"circle-opacity":
|
|
3143
|
-
...
|
|
3144
|
-
"circle-stroke-opacity": typeof
|
|
3145
|
-
"circle-stroke-width": typeof m == "number" ? m :
|
|
3146
|
-
"circle-stroke-color": typeof
|
|
3087
|
+
"circle-radius": typeof e.pointRadius == "number" ? e.pointRadius : Array.isArray(e.pointRadius) ? A(e.pointRadius) : R[0].pointRadius * 0.75,
|
|
3088
|
+
"circle-opacity": b,
|
|
3089
|
+
...d && {
|
|
3090
|
+
"circle-stroke-opacity": typeof p == "number" ? p : A(p),
|
|
3091
|
+
"circle-stroke-width": typeof m == "number" ? m : A(m),
|
|
3092
|
+
"circle-stroke-color": typeof y == "string" ? y : K(y)
|
|
3147
3093
|
}
|
|
3148
3094
|
},
|
|
3149
|
-
minzoom:
|
|
3150
|
-
maxzoom:
|
|
3095
|
+
minzoom: w,
|
|
3096
|
+
maxzoom: _
|
|
3151
3097
|
},
|
|
3152
3098
|
e.beforeId
|
|
3153
3099
|
);
|
|
3154
3100
|
} else {
|
|
3155
|
-
let
|
|
3101
|
+
let R = typeof e.pointColor == "string" ? e.pointColor : Array.isArray(e.pointColor) ? e.pointColor.getColorHex(e.pointColor.getBounds().min) : he(), D = typeof e.pointRadius == "number" ? P ? A([
|
|
3156
3102
|
{ zoom: 0, value: e.pointRadius * 0.025 },
|
|
3157
3103
|
{ zoom: 2, value: e.pointRadius * 0.05 },
|
|
3158
3104
|
{ zoom: 4, value: e.pointRadius * 0.1 },
|
|
3159
3105
|
{ zoom: 8, value: e.pointRadius * 0.25 },
|
|
3160
3106
|
{ zoom: 16, value: e.pointRadius * 1 }
|
|
3161
|
-
]) : e.pointRadius : Array.isArray(e.pointRadius) ?
|
|
3107
|
+
]) : e.pointRadius : Array.isArray(e.pointRadius) ? A(e.pointRadius) : P ? A([
|
|
3162
3108
|
{ zoom: 0, value: t * 0.05 },
|
|
3163
3109
|
{ zoom: 2, value: t * 0.1 },
|
|
3164
3110
|
{ zoom: 4, value: t * 0.2 },
|
|
@@ -3166,74 +3112,74 @@ function vo(r, e) {
|
|
|
3166
3112
|
{ zoom: 16, value: t * 1 }
|
|
3167
3113
|
]) : t;
|
|
3168
3114
|
if (e.property && Array.isArray(e.pointColor)) {
|
|
3169
|
-
const
|
|
3170
|
-
const
|
|
3115
|
+
const V = Array.from({ length: n }, (W, q) => {
|
|
3116
|
+
const J = i.min + q * (i.max - i.min) / (n - 1);
|
|
3171
3117
|
return {
|
|
3172
|
-
value:
|
|
3173
|
-
pointRadius: typeof e.pointRadius == "number" ? e.pointRadius : t + (o - t) * (
|
|
3174
|
-
color: typeof e.pointColor == "string" ? e.pointColor : l.getColorHex(
|
|
3118
|
+
value: J,
|
|
3119
|
+
pointRadius: typeof e.pointRadius == "number" ? e.pointRadius : t + (o - t) * (q / (n - 1)) ** 0.5,
|
|
3120
|
+
color: typeof e.pointColor == "string" ? e.pointColor : l.getColorHex(J)
|
|
3175
3121
|
};
|
|
3176
3122
|
});
|
|
3177
|
-
|
|
3123
|
+
R = ke(V, e.property), D = Fe(V, e.property, P);
|
|
3178
3124
|
}
|
|
3179
3125
|
r.addLayer(
|
|
3180
3126
|
{
|
|
3181
|
-
id:
|
|
3127
|
+
id: E.pointLayerId,
|
|
3182
3128
|
type: "circle",
|
|
3183
|
-
source:
|
|
3129
|
+
source: u,
|
|
3184
3130
|
layout: {
|
|
3185
3131
|
// Contrary to labels, we want to see the small one in front. Weirdly "circle-sort-key" works in the opposite direction as "symbol-sort-key".
|
|
3186
3132
|
"circle-sort-key": e.property ? ["/", 1, ["get", e.property]] : 0
|
|
3187
3133
|
},
|
|
3188
3134
|
paint: {
|
|
3189
|
-
"circle-pitch-alignment":
|
|
3135
|
+
"circle-pitch-alignment": s ? "viewport" : "map",
|
|
3190
3136
|
"circle-pitch-scale": "map",
|
|
3191
3137
|
// scale with camera distance regardless of viewport/biewport alignement
|
|
3192
|
-
"circle-color":
|
|
3193
|
-
"circle-opacity":
|
|
3194
|
-
"circle-radius":
|
|
3195
|
-
...
|
|
3196
|
-
"circle-stroke-opacity": typeof
|
|
3197
|
-
"circle-stroke-width": typeof m == "number" ? m :
|
|
3198
|
-
"circle-stroke-color": typeof
|
|
3138
|
+
"circle-color": R,
|
|
3139
|
+
"circle-opacity": b,
|
|
3140
|
+
"circle-radius": D,
|
|
3141
|
+
...d && {
|
|
3142
|
+
"circle-stroke-opacity": typeof p == "number" ? p : A(p),
|
|
3143
|
+
"circle-stroke-width": typeof m == "number" ? m : A(m),
|
|
3144
|
+
"circle-stroke-color": typeof y == "string" ? y : K(y)
|
|
3199
3145
|
}
|
|
3200
3146
|
},
|
|
3201
|
-
minzoom:
|
|
3202
|
-
maxzoom:
|
|
3147
|
+
minzoom: w,
|
|
3148
|
+
maxzoom: _
|
|
3203
3149
|
},
|
|
3204
3150
|
e.beforeId
|
|
3205
3151
|
);
|
|
3206
3152
|
}
|
|
3207
|
-
if (
|
|
3208
|
-
|
|
3209
|
-
const
|
|
3153
|
+
if (c !== !1 && (e.cluster || e.property)) {
|
|
3154
|
+
E.labelLayerId = `${h}_label`;
|
|
3155
|
+
const R = e.labelColor ?? "#fff", D = e.labelSize ?? 12;
|
|
3210
3156
|
r.addLayer(
|
|
3211
3157
|
{
|
|
3212
|
-
id:
|
|
3158
|
+
id: E.labelLayerId,
|
|
3213
3159
|
type: "symbol",
|
|
3214
|
-
source:
|
|
3160
|
+
source: u,
|
|
3215
3161
|
filter: ["has", e.cluster ? "point_count" : e.property],
|
|
3216
3162
|
layout: {
|
|
3217
3163
|
"text-field": e.cluster ? "{point_count_abbreviated}" : `{${e.property}}`,
|
|
3218
3164
|
"text-font": ["Noto Sans Regular"],
|
|
3219
|
-
"text-size":
|
|
3220
|
-
"text-pitch-alignment":
|
|
3165
|
+
"text-size": D,
|
|
3166
|
+
"text-pitch-alignment": s ? "viewport" : "map",
|
|
3221
3167
|
"symbol-sort-key": ["/", 1, ["get", e.cluster ? "point_count" : e.property]]
|
|
3222
3168
|
// so that the largest value goes on top
|
|
3223
3169
|
},
|
|
3224
3170
|
paint: {
|
|
3225
|
-
"text-color":
|
|
3226
|
-
"text-opacity":
|
|
3171
|
+
"text-color": R,
|
|
3172
|
+
"text-opacity": b
|
|
3227
3173
|
},
|
|
3228
|
-
minzoom:
|
|
3229
|
-
maxzoom:
|
|
3174
|
+
minzoom: w,
|
|
3175
|
+
maxzoom: _
|
|
3230
3176
|
},
|
|
3231
3177
|
e.beforeId
|
|
3232
3178
|
);
|
|
3233
3179
|
}
|
|
3234
|
-
return
|
|
3180
|
+
return E;
|
|
3235
3181
|
}
|
|
3236
|
-
function
|
|
3182
|
+
function bo(r, e) {
|
|
3237
3183
|
if (e.layerId && r.getLayer(e.layerId))
|
|
3238
3184
|
throw new Error(`A layer already exists with the layer id: ${e.layerId}`);
|
|
3239
3185
|
const t = e.sourceId ?? te(), o = e.layerId ?? oe(), a = e.minzoom ?? 0, n = e.maxzoom ?? 23, l = e.zoomCompensation ?? !0, i = e.opacity ?? [
|
|
@@ -3242,218 +3188,226 @@ function Lo(r, e) {
|
|
|
3242
3188
|
{ zoom: n - 0.25, value: 1 },
|
|
3243
3189
|
{ zoom: n, value: 0 }
|
|
3244
3190
|
];
|
|
3245
|
-
let
|
|
3246
|
-
const h =
|
|
3247
|
-
(h.min !== 0 || h.max !== 1) && (
|
|
3248
|
-
const
|
|
3191
|
+
let u = Array.isArray(e.colorRamp) ? e.colorRamp : qe.TURBO.transparentStart();
|
|
3192
|
+
const h = u.getBounds();
|
|
3193
|
+
(h.min !== 0 || h.max !== 1) && (u = u.scale(0, 1)), u.hasTransparentStart() || (u = u.transparentStart());
|
|
3194
|
+
const c = e.intensity ?? [
|
|
3249
3195
|
{ zoom: 0, value: 0.01 },
|
|
3250
3196
|
{ zoom: 4, value: 0.2 },
|
|
3251
3197
|
{ zoom: 16, value: 1 }
|
|
3252
|
-
],
|
|
3253
|
-
let
|
|
3254
|
-
|
|
3198
|
+
], s = e.property ?? null, d = e.weight ?? 1;
|
|
3199
|
+
let p = 1;
|
|
3200
|
+
s ? typeof d == "number" ? (p = d, typeof e.weight == "number" && console.warn(
|
|
3255
3201
|
"The option `.property` is ignored when `.propertyValueWeights` is not of type `PropertyValueWeights`"
|
|
3256
|
-
)) : Array.isArray(
|
|
3202
|
+
)) : Array.isArray(d) ? p = fo(d, s) : console.warn(
|
|
3257
3203
|
"The option `.property` is ignored when `.propertyValueWeights` is not of type `PropertyValueWeights`"
|
|
3258
|
-
) : typeof
|
|
3204
|
+
) : typeof d == "number" ? p = d : Array.isArray(d) && console.warn("The options `.propertyValueWeights` can only be used when `.property` is provided.");
|
|
3259
3205
|
const m = [
|
|
3260
3206
|
{ zoom: 0, value: 50 * 0.025 },
|
|
3261
3207
|
{ zoom: 2, value: 50 * 0.05 },
|
|
3262
3208
|
{ zoom: 4, value: 50 * 0.1 },
|
|
3263
3209
|
{ zoom: 8, value: 50 * 0.25 },
|
|
3264
3210
|
{ zoom: 16, value: 50 }
|
|
3265
|
-
],
|
|
3266
|
-
let
|
|
3267
|
-
typeof
|
|
3268
|
-
const
|
|
3211
|
+
], y = e.radius ?? (l ? m : 10);
|
|
3212
|
+
let b = 1;
|
|
3213
|
+
typeof y == "number" ? b = y : Array.isArray(y) && "zoom" in y[0] ? b = A(y) : s && Array.isArray(y) && "propertyValue" in y[0] ? b = go(y, s, l) : !s && Array.isArray(y) && "propertyValue" in y[0] ? (b = A(m), console.warn("The option `.radius` can only be property-driven if the option `.property` is provided.")) : b = A(m);
|
|
3214
|
+
const P = {
|
|
3269
3215
|
heatmapLayerId: o,
|
|
3270
3216
|
heatmapSourceId: t
|
|
3271
3217
|
};
|
|
3272
3218
|
if (e.data && !r.getSource(t)) {
|
|
3273
|
-
let
|
|
3274
|
-
typeof
|
|
3219
|
+
let w = e.data;
|
|
3220
|
+
typeof w == "string" && ee(w) && (w = `https://api.maptiler.com/data/${w}/features.json?key=${M.apiKey}`), r.addSource(t, {
|
|
3275
3221
|
type: "geojson",
|
|
3276
|
-
data:
|
|
3222
|
+
data: w
|
|
3277
3223
|
});
|
|
3278
3224
|
}
|
|
3279
|
-
return r.addLayer(
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
}
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3225
|
+
return r.addLayer(
|
|
3226
|
+
{
|
|
3227
|
+
id: o,
|
|
3228
|
+
type: "heatmap",
|
|
3229
|
+
source: t,
|
|
3230
|
+
minzoom: a,
|
|
3231
|
+
maxzoom: n,
|
|
3232
|
+
paint: {
|
|
3233
|
+
"heatmap-weight": p,
|
|
3234
|
+
"heatmap-intensity": typeof c == "number" ? c : A(c),
|
|
3235
|
+
"heatmap-color": yo(u),
|
|
3236
|
+
"heatmap-radius": b,
|
|
3237
|
+
"heatmap-opacity": typeof i == "number" ? i : A(i)
|
|
3238
|
+
}
|
|
3239
|
+
},
|
|
3240
|
+
e.beforeId
|
|
3241
|
+
), P;
|
|
3242
|
+
}
|
|
3243
|
+
const qo = {
|
|
3244
|
+
addPolyline: vo,
|
|
3245
|
+
addPolygon: wo,
|
|
3246
|
+
addPoint: Co,
|
|
3247
|
+
addHeatmap: bo,
|
|
3248
|
+
takeScreenshot: po
|
|
3299
3249
|
};
|
|
3300
3250
|
Ut();
|
|
3301
|
-
function
|
|
3302
|
-
return
|
|
3303
|
-
}
|
|
3304
|
-
const
|
|
3305
|
-
setRTLTextPlugin:
|
|
3306
|
-
getRTLTextPluginStatus:
|
|
3307
|
-
LngLat:
|
|
3308
|
-
LngLatBounds:
|
|
3251
|
+
function Jo() {
|
|
3252
|
+
return Pt.version;
|
|
3253
|
+
}
|
|
3254
|
+
const Xo = f.Map, Qo = f.Marker, er = f.Popup, tr = f.Style, or = f.CanvasSource, rr = f.GeoJSONSource, ar = f.ImageSource, nr = f.RasterTileSource, lr = f.RasterDEMTileSource, ir = f.VectorTileSource, sr = f.VideoSource, cr = f.NavigationControl, ur = f.GeolocateControl, dr = f.AttributionControl, pr = f.LogoControl, hr = f.ScaleControl, mr = f.FullscreenControl, fr = f.TerrainControl, gr = f.BoxZoomHandler, yr = f.ScrollZoomHandler, vr = f.CooperativeGesturesHandler, Lr = f.KeyboardHandler, wr = f.TwoFingersTouchPitchHandler, Cr = f.MapWheelEvent, br = f.MapTouchEvent, Sr = f.MapMouseEvent, Ar = f.config, Tr = f.getVersion, {
|
|
3255
|
+
setRTLTextPlugin: Rr,
|
|
3256
|
+
getRTLTextPluginStatus: _r,
|
|
3257
|
+
LngLat: Er,
|
|
3258
|
+
LngLatBounds: xr,
|
|
3309
3259
|
MercatorCoordinate: Ir,
|
|
3310
|
-
Evented:
|
|
3311
|
-
AJAXError:
|
|
3312
|
-
prewarm:
|
|
3313
|
-
clearPrewarmedResources:
|
|
3314
|
-
Hash:
|
|
3315
|
-
Point:
|
|
3316
|
-
EdgeInsets:
|
|
3317
|
-
DragRotateHandler:
|
|
3318
|
-
DragPanHandler:
|
|
3319
|
-
TwoFingersTouchZoomRotateHandler:
|
|
3320
|
-
DoubleClickZoomHandler:
|
|
3321
|
-
TwoFingersTouchZoomHandler:
|
|
3322
|
-
TwoFingersTouchRotateHandler:
|
|
3323
|
-
getWorkerCount:
|
|
3324
|
-
setWorkerCount:
|
|
3325
|
-
getMaxParallelImageRequests:
|
|
3326
|
-
setMaxParallelImageRequests:
|
|
3327
|
-
getWorkerUrl:
|
|
3328
|
-
setWorkerUrl:
|
|
3329
|
-
addSourceType:
|
|
3330
|
-
importScriptInWorkers:
|
|
3331
|
-
addProtocol:
|
|
3332
|
-
removeProtocol:
|
|
3260
|
+
Evented: Mr,
|
|
3261
|
+
AJAXError: Pr,
|
|
3262
|
+
prewarm: kr,
|
|
3263
|
+
clearPrewarmedResources: Fr,
|
|
3264
|
+
Hash: Or,
|
|
3265
|
+
Point: Br,
|
|
3266
|
+
EdgeInsets: Nr,
|
|
3267
|
+
DragRotateHandler: zr,
|
|
3268
|
+
DragPanHandler: Dr,
|
|
3269
|
+
TwoFingersTouchZoomRotateHandler: Ur,
|
|
3270
|
+
DoubleClickZoomHandler: Gr,
|
|
3271
|
+
TwoFingersTouchZoomHandler: Hr,
|
|
3272
|
+
TwoFingersTouchRotateHandler: Vr,
|
|
3273
|
+
getWorkerCount: $r,
|
|
3274
|
+
setWorkerCount: jr,
|
|
3275
|
+
getMaxParallelImageRequests: Kr,
|
|
3276
|
+
setMaxParallelImageRequests: Zr,
|
|
3277
|
+
getWorkerUrl: Wr,
|
|
3278
|
+
setWorkerUrl: Yr,
|
|
3279
|
+
addSourceType: qr,
|
|
3280
|
+
importScriptInWorkers: Jr,
|
|
3281
|
+
addProtocol: Xr,
|
|
3282
|
+
removeProtocol: Qr
|
|
3333
3283
|
} = f;
|
|
3334
3284
|
export {
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3285
|
+
Pr as AJAXError,
|
|
3286
|
+
Uo as AttributionControl,
|
|
3287
|
+
dr as AttributionControlMLGL,
|
|
3288
|
+
Ho as BoxZoomHandler,
|
|
3289
|
+
gr as BoxZoomHandlerMLGL,
|
|
3290
|
+
ko as CanvasSource,
|
|
3291
|
+
or as CanvasSourceMLGL,
|
|
3342
3292
|
g as ColorRamp,
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3293
|
+
qe as ColorRampCollection,
|
|
3294
|
+
$o as CooperativeGesturesHandler,
|
|
3295
|
+
vr as CooperativeGesturesHandlerMLGL,
|
|
3296
|
+
Gr as DoubleClickZoomHandler,
|
|
3297
|
+
Dr as DragPanHandler,
|
|
3298
|
+
zr as DragRotateHandler,
|
|
3299
|
+
Nr as EdgeInsets,
|
|
3300
|
+
Mr as Evented,
|
|
3301
|
+
Yt as FullscreenControl,
|
|
3302
|
+
mr as FullscreenControlMLGL,
|
|
3303
|
+
Fo as GeoJSONSource,
|
|
3304
|
+
rr as GeoJSONSourceMLGL,
|
|
3305
|
+
Kt as GeolocateControl,
|
|
3306
|
+
ur as GeolocateControlMLGL,
|
|
3307
|
+
eo as GeolocationType,
|
|
3308
|
+
Or as Hash,
|
|
3309
|
+
Oo as ImageSource,
|
|
3310
|
+
ar as ImageSourceMLGL,
|
|
3311
|
+
jo as KeyboardHandler,
|
|
3312
|
+
Lr as KeyboardHandlerMLGL,
|
|
3363
3313
|
C as Language,
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
Yo as
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
we as MaptilerLogoControl,
|
|
3314
|
+
Er as LngLat,
|
|
3315
|
+
xr as LngLatBounds,
|
|
3316
|
+
Zt as LogoControl,
|
|
3317
|
+
pr as LogoControlMLGL,
|
|
3318
|
+
to as Map,
|
|
3319
|
+
Xo as MapMLGL,
|
|
3320
|
+
Yo as MapMouseEvent,
|
|
3321
|
+
Sr as MapMouseEventMLGL,
|
|
3322
|
+
oa as MapStyle,
|
|
3323
|
+
ra as MapStyleVariant,
|
|
3324
|
+
Wo as MapTouchEvent,
|
|
3325
|
+
br as MapTouchEventMLGL,
|
|
3326
|
+
Zo as MapWheelEvent,
|
|
3327
|
+
Cr as MapWheelEventMLGL,
|
|
3328
|
+
Qt as MaptilerGeolocateControl,
|
|
3329
|
+
be as MaptilerLogoControl,
|
|
3381
3330
|
Jt as MaptilerNavigationControl,
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3331
|
+
qt as MaptilerTerrainControl,
|
|
3332
|
+
xo as Marker,
|
|
3333
|
+
Qo as MarkerMLGL,
|
|
3385
3334
|
Ir as MercatorCoordinate,
|
|
3386
|
-
|
|
3335
|
+
cr as NavigationControMLGL,
|
|
3387
3336
|
jt as NavigationControl,
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3337
|
+
Br as Point,
|
|
3338
|
+
Mo as Popup,
|
|
3339
|
+
er as PopupMLGL,
|
|
3340
|
+
No as RasterDEMTileSource,
|
|
3341
|
+
lr as RasterDEMTileSourceMLGL,
|
|
3342
|
+
Bo as RasterTileSource,
|
|
3343
|
+
nr as RasterTileSourceMLGL,
|
|
3344
|
+
aa as ReferenceMapStyle,
|
|
3345
|
+
Wt as ScaleControl,
|
|
3346
|
+
hr as ScaleControlMLGL,
|
|
3347
|
+
Vo as ScrollZoomHandler,
|
|
3348
|
+
yr as ScrollZoomHandlerMLGL,
|
|
3349
|
+
kt as SdkConfig,
|
|
3350
|
+
na as ServiceError,
|
|
3351
|
+
Po as Style,
|
|
3352
|
+
tr as StyleMLGL,
|
|
3353
|
+
fr as TerrainControMLGL,
|
|
3354
|
+
Go as TerrainControl,
|
|
3355
|
+
Ko as TwoFingersTouchPitchHandler,
|
|
3356
|
+
wr as TwoFingersTouchPitchHandlerMLGL,
|
|
3357
|
+
Vr as TwoFingersTouchRotateHandler,
|
|
3358
|
+
Hr as TwoFingersTouchZoomHandler,
|
|
3359
|
+
Ur as TwoFingersTouchZoomRotateHandler,
|
|
3360
|
+
zo as VectorTileSource,
|
|
3361
|
+
ir as VectorTileSourceMLGL,
|
|
3362
|
+
Do as VideoSource,
|
|
3363
|
+
sr as VideoSourceMLGL,
|
|
3364
|
+
Xr as addProtocol,
|
|
3365
|
+
qr as addSourceType,
|
|
3366
|
+
la as areSameLanguages,
|
|
3367
|
+
ia as bufferToPixelDataBrowser,
|
|
3368
|
+
sa as circumferenceAtLatitude,
|
|
3369
|
+
Fr as clearPrewarmedResources,
|
|
3370
|
+
M as config,
|
|
3371
|
+
Ar as configMLGL,
|
|
3372
|
+
ca as coordinates,
|
|
3373
|
+
ua as data,
|
|
3374
|
+
da as elevation,
|
|
3375
|
+
pa as expandMapStyle,
|
|
3376
|
+
ha as geocoding,
|
|
3377
|
+
ma as geolocation,
|
|
3378
|
+
fa as getAutoLanguage,
|
|
3429
3379
|
ye as getBrowserLanguage,
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3380
|
+
ga as getBufferToPixelDataParser,
|
|
3381
|
+
ya as getLanguageInfoFromCode,
|
|
3382
|
+
va as getLanguageInfoFromFlag,
|
|
3383
|
+
La as getLanguageInfoFromKey,
|
|
3384
|
+
Tr as getMapLibreVersion,
|
|
3385
|
+
Kr as getMaxParallelImageRequests,
|
|
3386
|
+
_r as getRTLTextPluginStatus,
|
|
3387
|
+
wa as getTileCache,
|
|
3388
|
+
Jo as getVersion,
|
|
3389
|
+
$r as getWorkerCount,
|
|
3390
|
+
Wr as getWorkerUrl,
|
|
3438
3391
|
Ve as gpx,
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3392
|
+
co as gpxOrKml,
|
|
3393
|
+
He as hasChildNodeWithName,
|
|
3394
|
+
qo as helpers,
|
|
3395
|
+
Jr as importScriptInWorkers,
|
|
3396
|
+
Ca as isLanguageInfo,
|
|
3397
|
+
$e as kml,
|
|
3398
|
+
ba as mapStylePresetList,
|
|
3399
|
+
Sa as math,
|
|
3400
|
+
Aa as misc,
|
|
3401
|
+
kr as prewarm,
|
|
3402
|
+
Qr as removeProtocol,
|
|
3403
|
+
Zr as setMaxParallelImageRequests,
|
|
3404
|
+
Rr as setRTLTextPlugin,
|
|
3405
|
+
jr as setWorkerCount,
|
|
3406
|
+
Yr as setWorkerUrl,
|
|
3407
|
+
Ta as staticMaps,
|
|
3408
|
+
de as str2xml,
|
|
3409
|
+
Ra as styleToStyle,
|
|
3410
|
+
_a as toLanguageInfo,
|
|
3411
|
+
Re as xml2str
|
|
3458
3412
|
};
|
|
3459
3413
|
//# sourceMappingURL=maptiler-sdk.mjs.map
|