maplibre-gl 3.5.0 → 3.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- /* MapLibre GL JS is licensed under the 3-Clause BSD License. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v3.5.0/LICENSE.txt */
1
+ /* MapLibre GL JS is licensed under the 3-Clause BSD License. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v3.5.2/LICENSE.txt */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4
4
  typeof define === 'function' && define.amd ? define(factory) :
@@ -30,6 +30,377 @@ function define(_, chunk) {
30
30
 
31
31
  define(['exports'], (function (exports) { 'use strict';
32
32
 
33
+ /******************************************************************************
34
+ Copyright (c) Microsoft Corporation.
35
+
36
+ Permission to use, copy, modify, and/or distribute this software for any
37
+ purpose with or without fee is hereby granted.
38
+
39
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
40
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
41
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
42
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
43
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
44
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
45
+ PERFORMANCE OF THIS SOFTWARE.
46
+ ***************************************************************************** */
47
+ /* global Reflect, Promise, SuppressedError, Symbol */
48
+
49
+ var extendStatics = function(d, b) {
50
+ extendStatics = Object.setPrototypeOf ||
51
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
52
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
53
+ return extendStatics(d, b);
54
+ };
55
+
56
+ function __extends(d, b) {
57
+ if (typeof b !== "function" && b !== null)
58
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
59
+ extendStatics(d, b);
60
+ function __() { this.constructor = d; }
61
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
62
+ }
63
+
64
+ var __assign = function() {
65
+ __assign = Object.assign || function __assign(t) {
66
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
67
+ s = arguments[i];
68
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
69
+ }
70
+ return t;
71
+ };
72
+ return __assign.apply(this, arguments);
73
+ };
74
+
75
+ function __rest(s, e) {
76
+ var t = {};
77
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
78
+ t[p] = s[p];
79
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
80
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
81
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
82
+ t[p[i]] = s[p[i]];
83
+ }
84
+ return t;
85
+ }
86
+
87
+ function __decorate(decorators, target, key, desc) {
88
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
89
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
90
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
91
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
92
+ }
93
+
94
+ function __param(paramIndex, decorator) {
95
+ return function (target, key) { decorator(target, key, paramIndex); }
96
+ }
97
+
98
+ function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
99
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
100
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
101
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
102
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
103
+ var _, done = false;
104
+ for (var i = decorators.length - 1; i >= 0; i--) {
105
+ var context = {};
106
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
107
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
108
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
109
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
110
+ if (kind === "accessor") {
111
+ if (result === void 0) continue;
112
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
113
+ if (_ = accept(result.get)) descriptor.get = _;
114
+ if (_ = accept(result.set)) descriptor.set = _;
115
+ if (_ = accept(result.init)) initializers.unshift(_);
116
+ }
117
+ else if (_ = accept(result)) {
118
+ if (kind === "field") initializers.unshift(_);
119
+ else descriptor[key] = _;
120
+ }
121
+ }
122
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
123
+ done = true;
124
+ };
125
+
126
+ function __runInitializers(thisArg, initializers, value) {
127
+ var useValue = arguments.length > 2;
128
+ for (var i = 0; i < initializers.length; i++) {
129
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
130
+ }
131
+ return useValue ? value : void 0;
132
+ };
133
+
134
+ function __propKey(x) {
135
+ return typeof x === "symbol" ? x : "".concat(x);
136
+ };
137
+
138
+ function __setFunctionName(f, name, prefix) {
139
+ if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
140
+ return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
141
+ };
142
+
143
+ function __metadata(metadataKey, metadataValue) {
144
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
145
+ }
146
+
147
+ function __awaiter(thisArg, _arguments, P, generator) {
148
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
149
+ return new (P || (P = Promise))(function (resolve, reject) {
150
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
151
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
152
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
153
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
154
+ });
155
+ }
156
+
157
+ function __generator(thisArg, body) {
158
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
159
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
160
+ function verb(n) { return function (v) { return step([n, v]); }; }
161
+ function step(op) {
162
+ if (f) throw new TypeError("Generator is already executing.");
163
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
164
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
165
+ if (y = 0, t) op = [op[0] & 2, t.value];
166
+ switch (op[0]) {
167
+ case 0: case 1: t = op; break;
168
+ case 4: _.label++; return { value: op[1], done: false };
169
+ case 5: _.label++; y = op[1]; op = [0]; continue;
170
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
171
+ default:
172
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
173
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
174
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
175
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
176
+ if (t[2]) _.ops.pop();
177
+ _.trys.pop(); continue;
178
+ }
179
+ op = body.call(thisArg, _);
180
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
181
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
182
+ }
183
+ }
184
+
185
+ var __createBinding = Object.create ? (function(o, m, k, k2) {
186
+ if (k2 === undefined) k2 = k;
187
+ var desc = Object.getOwnPropertyDescriptor(m, k);
188
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
189
+ desc = { enumerable: true, get: function() { return m[k]; } };
190
+ }
191
+ Object.defineProperty(o, k2, desc);
192
+ }) : (function(o, m, k, k2) {
193
+ if (k2 === undefined) k2 = k;
194
+ o[k2] = m[k];
195
+ });
196
+
197
+ function __exportStar(m, o) {
198
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
199
+ }
200
+
201
+ function __values(o) {
202
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
203
+ if (m) return m.call(o);
204
+ if (o && typeof o.length === "number") return {
205
+ next: function () {
206
+ if (o && i >= o.length) o = void 0;
207
+ return { value: o && o[i++], done: !o };
208
+ }
209
+ };
210
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
211
+ }
212
+
213
+ function __read(o, n) {
214
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
215
+ if (!m) return o;
216
+ var i = m.call(o), r, ar = [], e;
217
+ try {
218
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
219
+ }
220
+ catch (error) { e = { error: error }; }
221
+ finally {
222
+ try {
223
+ if (r && !r.done && (m = i["return"])) m.call(i);
224
+ }
225
+ finally { if (e) throw e.error; }
226
+ }
227
+ return ar;
228
+ }
229
+
230
+ /** @deprecated */
231
+ function __spread() {
232
+ for (var ar = [], i = 0; i < arguments.length; i++)
233
+ ar = ar.concat(__read(arguments[i]));
234
+ return ar;
235
+ }
236
+
237
+ /** @deprecated */
238
+ function __spreadArrays() {
239
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
240
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
241
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
242
+ r[k] = a[j];
243
+ return r;
244
+ }
245
+
246
+ function __spreadArray(to, from, pack) {
247
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
248
+ if (ar || !(i in from)) {
249
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
250
+ ar[i] = from[i];
251
+ }
252
+ }
253
+ return to.concat(ar || Array.prototype.slice.call(from));
254
+ }
255
+
256
+ function __await(v) {
257
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
258
+ }
259
+
260
+ function __asyncGenerator(thisArg, _arguments, generator) {
261
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
262
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
263
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
264
+ function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
265
+ function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
266
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
267
+ function fulfill(value) { resume("next", value); }
268
+ function reject(value) { resume("throw", value); }
269
+ function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
270
+ }
271
+
272
+ function __asyncDelegator(o) {
273
+ var i, p;
274
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
275
+ function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
276
+ }
277
+
278
+ function __asyncValues(o) {
279
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
280
+ var m = o[Symbol.asyncIterator], i;
281
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
282
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
283
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
284
+ }
285
+
286
+ function __makeTemplateObject(cooked, raw) {
287
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
288
+ return cooked;
289
+ };
290
+
291
+ var __setModuleDefault = Object.create ? (function(o, v) {
292
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
293
+ }) : function(o, v) {
294
+ o["default"] = v;
295
+ };
296
+
297
+ function __importStar(mod) {
298
+ if (mod && mod.__esModule) return mod;
299
+ var result = {};
300
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
301
+ __setModuleDefault(result, mod);
302
+ return result;
303
+ }
304
+
305
+ function __importDefault(mod) {
306
+ return (mod && mod.__esModule) ? mod : { default: mod };
307
+ }
308
+
309
+ function __classPrivateFieldGet(receiver, state, kind, f) {
310
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
311
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
312
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
313
+ }
314
+
315
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
316
+ if (kind === "m") throw new TypeError("Private method is not writable");
317
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
318
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
319
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
320
+ }
321
+
322
+ function __classPrivateFieldIn(state, receiver) {
323
+ if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
324
+ return typeof state === "function" ? receiver === state : state.has(receiver);
325
+ }
326
+
327
+ function __addDisposableResource(env, value, async) {
328
+ if (value !== null && value !== void 0) {
329
+ if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
330
+ var dispose;
331
+ if (async) {
332
+ if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
333
+ dispose = value[Symbol.asyncDispose];
334
+ }
335
+ if (dispose === void 0) {
336
+ if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
337
+ dispose = value[Symbol.dispose];
338
+ }
339
+ if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
340
+ env.stack.push({ value: value, dispose: dispose, async: async });
341
+ }
342
+ else if (async) {
343
+ env.stack.push({ async: true });
344
+ }
345
+ return value;
346
+ }
347
+
348
+ var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
349
+ var e = new Error(message);
350
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
351
+ };
352
+
353
+ function __disposeResources(env) {
354
+ function fail(e) {
355
+ env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
356
+ env.hasError = true;
357
+ }
358
+ function next() {
359
+ while (env.stack.length) {
360
+ var rec = env.stack.pop();
361
+ try {
362
+ var result = rec.dispose && rec.dispose.call(rec.value);
363
+ if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
364
+ }
365
+ catch (e) {
366
+ fail(e);
367
+ }
368
+ }
369
+ if (env.hasError) throw env.error;
370
+ }
371
+ return next();
372
+ }
373
+
374
+ var tslib_es6 = {
375
+ __extends: __extends,
376
+ __assign: __assign,
377
+ __rest: __rest,
378
+ __decorate: __decorate,
379
+ __param: __param,
380
+ __metadata: __metadata,
381
+ __awaiter: __awaiter,
382
+ __generator: __generator,
383
+ __createBinding: __createBinding,
384
+ __exportStar: __exportStar,
385
+ __values: __values,
386
+ __read: __read,
387
+ __spread: __spread,
388
+ __spreadArrays: __spreadArrays,
389
+ __spreadArray: __spreadArray,
390
+ __await: __await,
391
+ __asyncGenerator: __asyncGenerator,
392
+ __asyncDelegator: __asyncDelegator,
393
+ __asyncValues: __asyncValues,
394
+ __makeTemplateObject: __makeTemplateObject,
395
+ __importStar: __importStar,
396
+ __importDefault: __importDefault,
397
+ __classPrivateFieldGet: __classPrivateFieldGet,
398
+ __classPrivateFieldSet: __classPrivateFieldSet,
399
+ __classPrivateFieldIn: __classPrivateFieldIn,
400
+ __addDisposableResource: __addDisposableResource,
401
+ __disposeResources: __disposeResources,
402
+ };
403
+
33
404
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
34
405
 
35
406
  function getDefaultExportFromCjs (x) {
@@ -1037,31 +1408,33 @@ function computeVideoFrameParameters(image, x, y, width, height) {
1037
1408
  * @param height - height of the rectangle to read from the image
1038
1409
  * @returns a promise containing the parsed RGBA pixel values of the image, or the error if an error occurred
1039
1410
  */
1040
- async function readImageUsingVideoFrame(image, x, y, width, height) {
1041
- if (typeof VideoFrame === 'undefined') {
1042
- throw new Error('VideoFrame not supported');
1043
- }
1044
- const frame = new VideoFrame(image, { timestamp: 0 });
1045
- try {
1046
- const format = frame === null || frame === void 0 ? void 0 : frame.format;
1047
- if (!format || !(format.startsWith('BGR') || format.startsWith('RGB'))) {
1048
- throw new Error(`Unrecognized format ${format}`);
1411
+ function readImageUsingVideoFrame(image, x, y, width, height) {
1412
+ return __awaiter(this, void 0, void 0, function* () {
1413
+ if (typeof VideoFrame === 'undefined') {
1414
+ throw new Error('VideoFrame not supported');
1049
1415
  }
1050
- const swapBR = format.startsWith('BGR');
1051
- const result = new Uint8ClampedArray(width * height * 4);
1052
- await frame.copyTo(result, computeVideoFrameParameters(image, x, y, width, height));
1053
- if (swapBR) {
1054
- for (let i = 0; i < result.length; i += 4) {
1055
- const tmp = result[i];
1056
- result[i] = result[i + 2];
1057
- result[i + 2] = tmp;
1416
+ const frame = new VideoFrame(image, { timestamp: 0 });
1417
+ try {
1418
+ const format = frame === null || frame === void 0 ? void 0 : frame.format;
1419
+ if (!format || !(format.startsWith('BGR') || format.startsWith('RGB'))) {
1420
+ throw new Error(`Unrecognized format ${format}`);
1421
+ }
1422
+ const swapBR = format.startsWith('BGR');
1423
+ const result = new Uint8ClampedArray(width * height * 4);
1424
+ yield frame.copyTo(result, computeVideoFrameParameters(image, x, y, width, height));
1425
+ if (swapBR) {
1426
+ for (let i = 0; i < result.length; i += 4) {
1427
+ const tmp = result[i];
1428
+ result[i] = result[i + 2];
1429
+ result[i + 2] = tmp;
1430
+ }
1058
1431
  }
1432
+ return result;
1059
1433
  }
1060
- return result;
1061
- }
1062
- finally {
1063
- frame.close();
1064
- }
1434
+ finally {
1435
+ frame.close();
1436
+ }
1437
+ });
1065
1438
  }
1066
1439
  let offscreenCanvas;
1067
1440
  let offscreenCanvasContext;
@@ -1102,16 +1475,18 @@ function readImageDataUsingOffscreenCanvas(imgBitmap, x, y, width, height) {
1102
1475
  * @param height - height of the rectangle to read from the image
1103
1476
  * @returns a promise containing the parsed RGBA pixel values of the image
1104
1477
  */
1105
- async function getImageData(image, x, y, width, height) {
1106
- if (isOffscreenCanvasDistorted()) {
1107
- try {
1108
- return await readImageUsingVideoFrame(image, x, y, width, height);
1109
- }
1110
- catch (e) {
1111
- // fall back to OffscreenCanvas
1478
+ function getImageData(image, x, y, width, height) {
1479
+ return __awaiter(this, void 0, void 0, function* () {
1480
+ if (isOffscreenCanvasDistorted()) {
1481
+ try {
1482
+ return yield readImageUsingVideoFrame(image, x, y, width, height);
1483
+ }
1484
+ catch (e) {
1485
+ // fall back to OffscreenCanvas
1486
+ }
1112
1487
  }
1113
- }
1114
- return readImageDataUsingOffscreenCanvas(image, x, y, width, height);
1488
+ return readImageDataUsingOffscreenCanvas(image, x, y, width, height);
1489
+ });
1115
1490
  }
1116
1491
 
1117
1492
  const now = typeof performance !== 'undefined' && performance && performance.now ?
@@ -11491,7 +11866,6 @@ function serialize(input, transferables) {
11491
11866
  klass.serialize(input, transferables) : {};
11492
11867
  if (!klass.serialize) {
11493
11868
  for (const key in input) {
11494
- // any cast due to https://github.com/facebook/flow/issues/5393
11495
11869
  if (!input.hasOwnProperty(key))
11496
11870
  continue; // eslint-disable-line no-prototype-builtins
11497
11871
  if (registry[name].omit.indexOf(key) >= 0)
@@ -28805,8 +29179,8 @@ class Actor {
28805
29179
  if (callback) {
28806
29180
  this.callbacks[id] = callback;
28807
29181
  }
28808
- const buffers = isSafari(this.globalScope) ? undefined : [];
28809
- this.target.postMessage({
29182
+ const buffers = [];
29183
+ const message = {
28810
29184
  id,
28811
29185
  type,
28812
29186
  hasCallback: !!callback,
@@ -28814,19 +29188,21 @@ class Actor {
28814
29188
  mustQueue,
28815
29189
  sourceMapId: this.mapId,
28816
29190
  data: serialize(data, buffers)
28817
- }, buffers);
29191
+ };
29192
+ this.target.postMessage(message, { transfer: buffers });
28818
29193
  return {
28819
29194
  cancel: () => {
28820
29195
  if (callback) {
28821
29196
  // Set the callback to null so that it never fires after the request is aborted.
28822
29197
  delete this.callbacks[id];
28823
29198
  }
28824
- this.target.postMessage({
29199
+ const cancelMessage = {
28825
29200
  id,
28826
29201
  type: '<cancel>',
28827
29202
  targetMapId,
28828
29203
  sourceMapId: this.mapId
28829
- });
29204
+ };
29205
+ this.target.postMessage(cancelMessage);
28830
29206
  }
28831
29207
  };
28832
29208
  }
@@ -28848,17 +29224,18 @@ class Actor {
28848
29224
  }
28849
29225
  else {
28850
29226
  let completed = false;
28851
- const buffers = isSafari(this.globalScope) ? undefined : [];
29227
+ const buffers = [];
28852
29228
  const done = task.hasCallback ? (err, data) => {
28853
29229
  completed = true;
28854
29230
  delete this.cancelCallbacks[id];
28855
- this.target.postMessage({
29231
+ const responseMessage = {
28856
29232
  id,
28857
29233
  type: '<response>',
28858
29234
  sourceMapId: this.mapId,
28859
29235
  error: err ? serialize(err) : null,
28860
29236
  data: serialize(data, buffers)
28861
- }, buffers);
29237
+ };
29238
+ this.target.postMessage(responseMessage, { transfer: buffers });
28862
29239
  } : (_) => {
28863
29240
  completed = true;
28864
29241
  };
@@ -28868,7 +29245,7 @@ class Actor {
28868
29245
  // task.type == 'loadTile', 'removeTile', etc.
28869
29246
  callback = this.parent[task.type](task.sourceMapId, params, done);
28870
29247
  }
28871
- else if (this.parent.getWorkerSource) {
29248
+ else if ('getWorkerSource' in this.parent) {
28872
29249
  // task.type == sourcetype.method
28873
29250
  const keys = task.type.split('.');
28874
29251
  const scope = this.parent.getWorkerSource(task.sourceMapId, keys[0], params.source);
@@ -31538,6 +31915,7 @@ exports.UniformMatrix4f = UniformMatrix4f;
31538
31915
  exports.UnwrappedTileID = UnwrappedTileID;
31539
31916
  exports.ValidationError = ValidationError;
31540
31917
  exports.ZoomHistory = ZoomHistory;
31918
+ exports.__awaiter = __awaiter;
31541
31919
  exports.add = add$4;
31542
31920
  exports.addDynamicAttributes = addDynamicAttributes;
31543
31921
  exports.arrayBufferToImage = arrayBufferToImage;
@@ -32106,17 +32484,19 @@ class RasterDEMTileWorkerSource {
32106
32484
  constructor() {
32107
32485
  this.loaded = {};
32108
32486
  }
32109
- async loadTile(params, callback) {
32110
- const { uid, encoding, rawImageData, redFactor, greenFactor, blueFactor, baseShift } = params;
32111
- const width = rawImageData.width + 2;
32112
- const height = rawImageData.height + 2;
32113
- const imagePixels = performance.isImageBitmap(rawImageData) ?
32114
- new performance.RGBAImage({ width, height }, await performance.getImageData(rawImageData, -1, -1, width, height)) :
32115
- rawImageData;
32116
- const dem = new performance.DEMData(uid, imagePixels, encoding, redFactor, greenFactor, blueFactor, baseShift);
32117
- this.loaded = this.loaded || {};
32118
- this.loaded[uid] = dem;
32119
- callback(null, dem);
32487
+ loadTile(params, callback) {
32488
+ return performance.__awaiter(this, void 0, void 0, function* () {
32489
+ const { uid, encoding, rawImageData, redFactor, greenFactor, blueFactor, baseShift } = params;
32490
+ const width = rawImageData.width + 2;
32491
+ const height = rawImageData.height + 2;
32492
+ const imagePixels = performance.isImageBitmap(rawImageData) ?
32493
+ new performance.RGBAImage({ width, height }, yield performance.getImageData(rawImageData, -1, -1, width, height)) :
32494
+ rawImageData;
32495
+ const dem = new performance.DEMData(uid, imagePixels, encoding, redFactor, greenFactor, blueFactor, baseShift);
32496
+ this.loaded = this.loaded || {};
32497
+ this.loaded[uid] = dem;
32498
+ callback(null, dem);
32499
+ });
32120
32500
  }
32121
32501
  removeTile(params) {
32122
32502
  const loaded = this.loaded, uid = params.uid;
@@ -33865,10 +34245,10 @@ function applySourceDiff(updateable, diff, promoteId) {
33865
34245
  // note: removeAllProperties gives us a new properties object, so we can skip the clone step
33866
34246
  const cloneProperties = !update.removeAllProperties && (((_a = update.removeProperties) === null || _a === void 0 ? void 0 : _a.length) > 0 || ((_b = update.addOrUpdateProperties) === null || _b === void 0 ? void 0 : _b.length) > 0);
33867
34247
  if (cloneFeature || cloneProperties) {
33868
- feature = { ...feature };
34248
+ feature = Object.assign({}, feature);
33869
34249
  updateable.set(update.id, feature);
33870
34250
  if (cloneProperties) {
33871
- feature.properties = { ...feature.properties };
34251
+ feature.properties = Object.assign({}, feature.properties);
33872
34252
  }
33873
34253
  }
33874
34254
  if (update.newGeometry) {
@@ -33893,34 +34273,11 @@ function applySourceDiff(updateable, diff, promoteId) {
33893
34273
  }
33894
34274
  }
33895
34275
 
33896
- function loadGeoJSONTile(params, callback) {
33897
- const canonical = params.tileID.canonical;
33898
- if (!this._geoJSONIndex) {
33899
- return callback(null, null); // we couldn't load the file
33900
- }
33901
- const geoJSONTile = this._geoJSONIndex.getTile(canonical.z, canonical.x, canonical.y);
33902
- if (!geoJSONTile) {
33903
- return callback(null, null); // nothing in the given tile
33904
- }
33905
- const geojsonWrapper = new GeoJSONWrapper$2(geoJSONTile.features);
33906
- // Encode the geojson-vt tile into binary vector tile form. This
33907
- // is a convenience that allows `FeatureIndex` to operate the same way
33908
- // across `VectorTileSource` and `GeoJSONSource` data.
33909
- let pbf = vtpbf(geojsonWrapper);
33910
- if (pbf.byteOffset !== 0 || pbf.byteLength !== pbf.buffer.byteLength) {
33911
- // Compatibility with node Buffer (https://github.com/mapbox/pbf/issues/35)
33912
- pbf = new Uint8Array(pbf);
33913
- }
33914
- callback(null, {
33915
- vectorTile: geojsonWrapper,
33916
- rawData: pbf.buffer
33917
- });
33918
- }
33919
34276
  /**
33920
34277
  * The {@link WorkerSource} implementation that supports {@link GeoJSONSource}.
33921
34278
  * This class is designed to be easily reused to support custom source types
33922
34279
  * for data formats that can be parsed/converted into an in-memory GeoJSON
33923
- * representation. To do so, create it with
34280
+ * representation. To do so, create it with
33924
34281
  * `new GeoJSONWorkerSource(actor, layerIndex, customLoadGeoJSONFunction)`.
33925
34282
  * For a full example, see [mapbox-gl-topojson](https://github.com/developmentseed/mapbox-gl-topojson).
33926
34283
  */
@@ -33931,7 +34288,7 @@ class GeoJSONWorkerSource extends VectorTileWorkerSource {
33931
34288
  * See {@link GeoJSONWorkerSource#loadGeoJSON}.
33932
34289
  */
33933
34290
  constructor(actor, layerIndex, availableImages, loadGeoJSON) {
33934
- super(actor, layerIndex, availableImages, loadGeoJSONTile);
34291
+ super(actor, layerIndex, availableImages);
33935
34292
  this._dataUpdateable = new Map();
33936
34293
  /**
33937
34294
  * Fetch and parse GeoJSON according to the given params. Calls `callback`
@@ -33980,10 +34337,34 @@ class GeoJSONWorkerSource extends VectorTileWorkerSource {
33980
34337
  }
33981
34338
  return { cancel: () => { } };
33982
34339
  };
34340
+ this.loadVectorData = this.loadGeoJSONTile;
33983
34341
  if (loadGeoJSON) {
33984
34342
  this.loadGeoJSON = loadGeoJSON;
33985
34343
  }
33986
34344
  }
34345
+ loadGeoJSONTile(params, callback) {
34346
+ const canonical = params.tileID.canonical;
34347
+ if (!this._geoJSONIndex) {
34348
+ return callback(null, null); // we couldn't load the file
34349
+ }
34350
+ const geoJSONTile = this._geoJSONIndex.getTile(canonical.z, canonical.x, canonical.y);
34351
+ if (!geoJSONTile) {
34352
+ return callback(null, null); // nothing in the given tile
34353
+ }
34354
+ const geojsonWrapper = new GeoJSONWrapper$2(geoJSONTile.features);
34355
+ // Encode the geojson-vt tile into binary vector tile form. This
34356
+ // is a convenience that allows `FeatureIndex` to operate the same way
34357
+ // across `VectorTileSource` and `GeoJSONSource` data.
34358
+ let pbf = vtpbf(geojsonWrapper);
34359
+ if (pbf.byteOffset !== 0 || pbf.byteLength !== pbf.buffer.byteLength) {
34360
+ // Compatibility with node Buffer (https://github.com/mapbox/pbf/issues/35)
34361
+ pbf = new Uint8Array(pbf);
34362
+ }
34363
+ callback(null, {
34364
+ vectorTile: geojsonWrapper,
34365
+ rawData: pbf.buffer
34366
+ });
34367
+ }
33987
34368
  /**
33988
34369
  * Fetches (if appropriate), parses, and index geojson data into tiles. This
33989
34370
  * preparatory method must be called before {@link GeoJSONWorkerSource#loadTile}
@@ -34265,12 +34646,12 @@ class Worker {
34265
34646
  }
34266
34647
  return layerIndexes;
34267
34648
  }
34268
- getWorkerSource(mapId, type, source) {
34649
+ getWorkerSource(mapId, sourceType, sourceName) {
34269
34650
  if (!this.workerSources[mapId])
34270
34651
  this.workerSources[mapId] = {};
34271
- if (!this.workerSources[mapId][type])
34272
- this.workerSources[mapId][type] = {};
34273
- if (!this.workerSources[mapId][type][source]) {
34652
+ if (!this.workerSources[mapId][sourceType])
34653
+ this.workerSources[mapId][sourceType] = {};
34654
+ if (!this.workerSources[mapId][sourceType][sourceName]) {
34274
34655
  // use a wrapped actor so that we can attach a target mapId param
34275
34656
  // to any messages invoked by the WorkerSource
34276
34657
  const actor = {
@@ -34278,9 +34659,9 @@ class Worker {
34278
34659
  this.actor.send(type, data, callback, mapId);
34279
34660
  }
34280
34661
  };
34281
- this.workerSources[mapId][type][source] = new this.workerSourceTypes[type](actor, this.getLayerIndex(mapId), this.getAvailableImages(mapId));
34662
+ this.workerSources[mapId][sourceType][sourceName] = new this.workerSourceTypes[sourceType](actor, this.getLayerIndex(mapId), this.getAvailableImages(mapId));
34282
34663
  }
34283
- return this.workerSources[mapId][type][source];
34664
+ return this.workerSources[mapId][sourceType][sourceName];
34284
34665
  }
34285
34666
  getDEMWorkerSource(mapId, source) {
34286
34667
  if (!this.demWorkerSources[mapId])
@@ -34303,7 +34684,7 @@ define(['./shared'], (function (performance) { 'use strict';
34303
34684
 
34304
34685
  var name = "maplibre-gl";
34305
34686
  var description = "BSD licensed community fork of mapbox-gl, a WebGL interactive maps library";
34306
- var version$2 = "3.5.0";
34687
+ var version$2 = "3.5.2";
34307
34688
  var main = "dist/maplibre-gl.js";
34308
34689
  var style = "dist/maplibre-gl.css";
34309
34690
  var license = "BSD-3-Clause";
@@ -34322,12 +34703,12 @@ var dependencies = {
34322
34703
  "@mapbox/unitbezier": "^0.0.1",
34323
34704
  "@mapbox/vector-tile": "^1.3.1",
34324
34705
  "@mapbox/whoots-js": "^3.1.0",
34325
- "@maplibre/maplibre-gl-style-spec": "^19.3.2",
34326
- "@types/geojson": "^7946.0.11",
34327
- "@types/mapbox__point-geometry": "^0.1.2",
34328
- "@types/mapbox__vector-tile": "^1.3.1",
34329
- "@types/pbf": "^3.0.3",
34330
- "@types/supercluster": "^7.1.1",
34706
+ "@maplibre/maplibre-gl-style-spec": "^19.3.3",
34707
+ "@types/geojson": "^7946.0.12",
34708
+ "@types/mapbox__point-geometry": "^0.1.3",
34709
+ "@types/mapbox__vector-tile": "^1.3.3",
34710
+ "@types/pbf": "^3.0.4",
34711
+ "@types/supercluster": "^7.1.2",
34331
34712
  earcut: "^2.2.4",
34332
34713
  "geojson-vt": "^3.2.1",
34333
34714
  "gl-matrix": "^3.4.3",
@@ -34344,51 +34725,52 @@ var dependencies = {
34344
34725
  var devDependencies = {
34345
34726
  "@mapbox/mapbox-gl-rtl-text": "^0.2.3",
34346
34727
  "@mapbox/mvt-fixtures": "^3.10.0",
34347
- "@rollup/plugin-commonjs": "^25.0.5",
34728
+ "@rollup/plugin-commonjs": "^25.0.7",
34348
34729
  "@rollup/plugin-json": "^6.0.1",
34349
34730
  "@rollup/plugin-node-resolve": "^15.2.3",
34350
- "@rollup/plugin-replace": "^5.0.3",
34351
- "@rollup/plugin-strip": "^3.0.3",
34731
+ "@rollup/plugin-replace": "^5.0.4",
34732
+ "@rollup/plugin-strip": "^3.0.4",
34352
34733
  "@rollup/plugin-terser": "^0.4.4",
34353
34734
  "@rollup/plugin-typescript": "^11.1.5",
34354
34735
  "@types/benchmark": "^2.1.3",
34355
34736
  "@types/cssnano": "^5.0.0",
34356
34737
  "@types/d3": "^7.4.1",
34357
- "@types/diff": "^5.0.6",
34358
- "@types/earcut": "^2.1.2",
34359
- "@types/eslint": "^8.44.4",
34360
- "@types/gl": "^6.0.3",
34738
+ "@types/diff": "^5.0.7",
34739
+ "@types/earcut": "^2.1.3",
34740
+ "@types/eslint": "^8.44.6",
34741
+ "@types/geojson-vt": "3.2.3",
34742
+ "@types/gl": "^6.0.4",
34361
34743
  "@types/glob": "^8.1.0",
34362
34744
  "@types/jest": "^29.5.3",
34363
34745
  "@types/jsdom": "^21.1.3",
34364
- "@types/minimist": "^1.2.3",
34365
- "@types/murmurhash-js": "^1.0.4",
34746
+ "@types/minimist": "^1.2.4",
34747
+ "@types/murmurhash-js": "^1.0.5",
34366
34748
  "@types/nise": "^1.4.2",
34367
34749
  "@types/node": "^20.8.3",
34368
- "@types/offscreencanvas": "^2019.7.1",
34750
+ "@types/offscreencanvas": "^2019.7.2",
34369
34751
  "@types/pixelmatch": "^5.2.4",
34370
- "@types/pngjs": "^6.0.2",
34371
- "@types/react": "^18.2.28",
34752
+ "@types/pngjs": "^6.0.3",
34753
+ "@types/react": "^18.2.31",
34372
34754
  "@types/react-dom": "^18.2.13",
34373
- "@types/request": "^2.48.10",
34374
- "@types/shuffle-seed": "^1.1.0",
34755
+ "@types/request": "^2.48.11",
34756
+ "@types/shuffle-seed": "^1.1.1",
34375
34757
  "@types/window-or-global": "^1.0.4",
34376
- "@typescript-eslint/eslint-plugin": "^6.7.5",
34377
- "@typescript-eslint/parser": "^6.7.5",
34758
+ "@typescript-eslint/eslint-plugin": "^6.8.0",
34759
+ "@typescript-eslint/parser": "^6.8.0",
34378
34760
  address: "^2.0.1",
34379
34761
  benchmark: "^2.1.4",
34380
34762
  canvas: "^2.11.2",
34381
34763
  cssnano: "^6.0.1",
34382
34764
  d3: "^7.8.5",
34383
34765
  "d3-queue": "^3.0.7",
34384
- "devtools-protocol": "^0.0.1208070",
34766
+ "devtools-protocol": "^0.0.1212569",
34385
34767
  diff: "^5.1.0",
34386
34768
  "dts-bundle-generator": "^8.0.1",
34387
- eslint: "^8.51.0",
34769
+ eslint: "^8.52.0",
34388
34770
  "eslint-config-mourner": "^3.0.0",
34389
34771
  "eslint-plugin-html": "^7.1.0",
34390
34772
  "eslint-plugin-import": "^2.28.1",
34391
- "eslint-plugin-jest": "^27.4.2",
34773
+ "eslint-plugin-jest": "^27.4.3",
34392
34774
  "eslint-plugin-react": "^7.33.2",
34393
34775
  "eslint-plugin-tsdoc": "0.2.17",
34394
34776
  expect: "^29.7.0",
@@ -34402,8 +34784,7 @@ var devDependencies = {
34402
34784
  "json-stringify-pretty-compact": "^4.0.0",
34403
34785
  minimist: "^1.2.8",
34404
34786
  "mock-geolocation": "^1.0.11",
34405
- nise: "^5.1.4",
34406
- "node-plantuml": "^0.9.0",
34787
+ nise: "^5.1.5",
34407
34788
  "npm-font-open-sans": "^1.1.0",
34408
34789
  "npm-run-all": "^4.1.5",
34409
34790
  "pdf-merger-js": "^4.3.0",
@@ -34416,14 +34797,14 @@ var devDependencies = {
34416
34797
  puppeteer: "^21.3.8",
34417
34798
  react: "^18.2.0",
34418
34799
  "react-dom": "^18.2.0",
34419
- rollup: "^4.0.2",
34800
+ rollup: "^4.1.4",
34420
34801
  "rollup-plugin-sourcemaps": "^0.6.3",
34421
34802
  rw: "^1.3.3",
34422
34803
  semver: "^7.5.4",
34423
34804
  "shuffle-seed": "^1.1.6",
34424
34805
  "source-map-explorer": "^2.5.3",
34425
34806
  st: "^3.0.0",
34426
- stylelint: "^15.10.3",
34807
+ stylelint: "^15.11.0",
34427
34808
  "stylelint-config-standard": "^34.0.0",
34428
34809
  "ts-jest": "^29.1.1",
34429
34810
  "ts-node": "^10.9.1",
@@ -34456,7 +34837,6 @@ var scripts = {
34456
34837
  "build-csp": "rollup --configPlugin @rollup/plugin-typescript -c rollup.config.csp.ts",
34457
34838
  "build-csp-dev": "rollup --configPlugin @rollup/plugin-typescript -c rollup.config.csp.ts --environment BUILD:dev",
34458
34839
  "build-css": "postcss -o dist/maplibre-gl.css src/css/maplibre-gl.css",
34459
- "build-diagrams": "cd docs/diagrams; ls *.plantuml | xargs -I {} puml generate --svg {} -o {}.svg",
34460
34840
  "watch-css": "postcss --watch -o dist/maplibre-gl.css src/css/maplibre-gl.css",
34461
34841
  "build-benchmarks": "npm run build-dev && rollup --configPlugin @rollup/plugin-typescript -c test/bench/rollup_config_benchmarks.ts",
34462
34842
  "watch-benchmarks": "rollup --configPlugin @rollup/plugin-typescript -c test/bench/rollup_config_benchmarks.ts --watch",
@@ -35935,7 +36315,7 @@ class Dispatcher {
35935
36315
  const workers = this.workerPool.acquire(mapId);
35936
36316
  for (let i = 0; i < workers.length; i++) {
35937
36317
  const worker = workers[i];
35938
- const actor = new Dispatcher.Actor(worker, parent, mapId);
36318
+ const actor = new performance.Actor(worker, parent, mapId);
35939
36319
  actor.name = `Worker ${i}`;
35940
36320
  this.actors.push(actor);
35941
36321
  }
@@ -35966,7 +36346,6 @@ class Dispatcher {
35966
36346
  this.workerPool.release(this.id);
35967
36347
  }
35968
36348
  }
35969
- Dispatcher.Actor = performance.Actor;
35970
36349
 
35971
36350
  function loadTileJson(options, requestManager, callback) {
35972
36351
  const loaded = function (err, tileJSON) {
@@ -36685,7 +37064,7 @@ class RasterDEMTileSource extends RasterTileSource {
36685
37064
  const url = tile.tileID.canonical.url(this.tiles, this.map.getPixelRatio(), this.scheme);
36686
37065
  const request = this.map._requestManager.transformRequest(url, ResourceType.Tile);
36687
37066
  tile.neighboringTiles = this._getNeighboringTiles(tile.tileID);
36688
- tile.request = ImageRequest.getImage(request, async (err, img, expiry) => {
37067
+ tile.request = ImageRequest.getImage(request, (err, img, expiry) => performance.__awaiter(this, void 0, void 0, function* () {
36689
37068
  delete tile.request;
36690
37069
  if (tile.aborted) {
36691
37070
  tile.state = 'unloaded';
@@ -36699,7 +37078,7 @@ class RasterDEMTileSource extends RasterTileSource {
36699
37078
  if (this.map._refreshExpiredTiles)
36700
37079
  tile.setExpiryData(expiry);
36701
37080
  const transfer = performance.isImageBitmap(img) && performance.offscreenCanvasSupported();
36702
- const rawImageData = transfer ? img : await readImageNow(img);
37081
+ const rawImageData = transfer ? img : yield readImageNow(img);
36703
37082
  const params = {
36704
37083
  uid: tile.uid,
36705
37084
  coord: tile.tileID,
@@ -36716,19 +37095,21 @@ class RasterDEMTileSource extends RasterTileSource {
36716
37095
  tile.actor.send('loadDEMTile', params, done);
36717
37096
  }
36718
37097
  }
36719
- }, this.map._refreshExpiredTiles);
36720
- async function readImageNow(img) {
36721
- if (typeof VideoFrame !== 'undefined' && performance.isOffscreenCanvasDistorted()) {
36722
- const width = img.width + 2;
36723
- const height = img.height + 2;
36724
- try {
36725
- return new performance.RGBAImage({ width, height }, await performance.readImageUsingVideoFrame(img, -1, -1, width, height));
36726
- }
36727
- catch (e) {
36728
- // fall-back to browser canvas decoding
37098
+ }), this.map._refreshExpiredTiles);
37099
+ function readImageNow(img) {
37100
+ return performance.__awaiter(this, void 0, void 0, function* () {
37101
+ if (typeof VideoFrame !== 'undefined' && performance.isOffscreenCanvasDistorted()) {
37102
+ const width = img.width + 2;
37103
+ const height = img.height + 2;
37104
+ try {
37105
+ return new performance.RGBAImage({ width, height }, yield performance.readImageUsingVideoFrame(img, -1, -1, width, height));
37106
+ }
37107
+ catch (e) {
37108
+ // fall-back to browser canvas decoding
37109
+ }
36729
37110
  }
36730
- }
36731
- return performance.browser.getImageData(img, 1);
37111
+ return performance.browser.getImageData(img, 1);
37112
+ });
36732
37113
  }
36733
37114
  function done(err, data) {
36734
37115
  if (err) {
@@ -37062,8 +37443,8 @@ class GeoJSONSource extends performance.Evented {
37062
37443
  performance.extend(data, { resourceTiming });
37063
37444
  // although GeoJSON sources contain no metadata, we fire this event to let the SourceCache
37064
37445
  // know its ok to start requesting tiles.
37065
- this.fire(new performance.Event('data', { ...data, sourceDataType: 'metadata' }));
37066
- this.fire(new performance.Event('data', { ...data, sourceDataType: 'content' }));
37446
+ this.fire(new performance.Event('data', Object.assign(Object.assign({}, data), { sourceDataType: 'metadata' })));
37447
+ this.fire(new performance.Event('data', Object.assign(Object.assign({}, data), { sourceDataType: 'content' })));
37067
37448
  });
37068
37449
  }
37069
37450
  loaded() {
@@ -42674,6 +43055,7 @@ class Style extends performance.Evented {
42674
43055
  return;
42675
43056
  const sources = performance.mapObject(this.sourceCaches, (source) => source.serialize());
42676
43057
  const layers = this._serializeByIds(this._order);
43058
+ const terrain = this.map.getTerrain() || undefined;
42677
43059
  const myStyleSheet = this.stylesheet;
42678
43060
  return performance.filterObject({
42679
43061
  version: myStyleSheet.version,
@@ -42688,7 +43070,8 @@ class Style extends performance.Evented {
42688
43070
  glyphs: myStyleSheet.glyphs,
42689
43071
  transition: myStyleSheet.transition,
42690
43072
  sources,
42691
- layers
43073
+ layers,
43074
+ terrain
42692
43075
  }, (value) => { return value !== undefined; });
42693
43076
  }
42694
43077
  _updateLayer(layer) {
@@ -44422,11 +44805,12 @@ class VertexBuffer {
44422
44805
 
44423
44806
  const cache = new WeakMap();
44424
44807
  function isWebGL2(gl) {
44808
+ var _a;
44425
44809
  if (cache.has(gl)) {
44426
44810
  return cache.get(gl);
44427
44811
  }
44428
44812
  else {
44429
- const value = gl.getParameter(gl.VERSION).startsWith('WebGL 2.0');
44813
+ const value = (_a = gl.getParameter(gl.VERSION)) === null || _a === void 0 ? void 0 : _a.startsWith('WebGL 2.0');
44430
44814
  cache.set(gl, value);
44431
44815
  return value;
44432
44816
  }