azure-maps-control 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.
@@ -265,7 +265,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
265
265
  return Url;
266
266
  }());
267
267
 
268
- var version = "2.2.2";
268
+ var version = "2.3.0";
269
269
 
270
270
  /**
271
271
  * A helper class that provides methods for getting various forms of the map controls current version.
@@ -306,27 +306,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
306
306
  var tooltipContent = document.createElement("span");
307
307
  tooltipContent.innerText = name;
308
308
  tooltipContent.classList.add('tooltiptext');
309
- // mimics default edge tooltip theming
310
- if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
311
- tooltipContent.classList.add('dark');
312
- }
313
- var themeQuery = window.matchMedia('(prefers-color-scheme: dark)');
314
- var onThemeChange = function (e) {
315
- var isDark = e.matches;
316
- if (isDark && !tooltipContent.classList.contains('dark')) {
317
- tooltipContent.classList.add('dark');
318
- }
319
- else if (!isDark && tooltipContent.classList.contains('dark')) {
320
- tooltipContent.classList.remove('dark');
321
- }
322
- };
323
- // compensate for browsers where MediaQueryList is not derived from EventTarget (pre iOS13 Safari)
324
- if (typeof themeQuery.addEventListener === 'function') {
325
- themeQuery.addEventListener('change', function (e) { return onThemeChange(e); });
326
- }
327
- else if (typeof themeQuery.addListener === 'function') {
328
- themeQuery.addListener(function (e) { return onThemeChange(e); });
329
- }
330
309
  if (navigator.userAgent.indexOf('Edg') != -1) {
331
310
  tooltipContent.classList.add('edge');
332
311
  }
@@ -666,7 +645,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
666
645
  * Build the outermost container for the control, applies styling including any listeners for auto styling.
667
646
  */
668
647
  ControlBase.prototype.buildContainer = function (map, style, ariaLabel, tagName) {
669
- var _this = this;
670
648
  this._map = map;
671
649
  this._container = document.createElement(tagName || "div");
672
650
  this._container.classList.add("azure-maps-control-container");
@@ -675,11 +653,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
675
653
  }
676
654
  // Set the style or add the auto listener.
677
655
  if (style.toLowerCase() === exports.ControlStyle.auto) {
678
- this._map.styles.definitions().then(function (definitions) {
679
- if (_this._map) {
680
- _this._map.events.add("stylechanged", _this._onStyleChange);
681
- }
682
- });
656
+ if (this._map) {
657
+ this._map.events.add("stylechanged", this._onStyleChange);
658
+ }
683
659
  }
684
660
  else {
685
661
  this._container.classList.add(style);
@@ -4457,6 +4433,12 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
4457
4433
  _this.hasFocus = false;
4458
4434
  _this.styleButtons = new Dictionary();
4459
4435
  _this.styleIcons = new Dictionary();
4436
+ // we need to rely on this to avoid potentially redundant thumbnail requests and .blob calls
4437
+ _this.thumbnailCache = {
4438
+ assumedConfiguration: undefined,
4439
+ response: new Dictionary(),
4440
+ blob: new Dictionary()
4441
+ };
4460
4442
  /**
4461
4443
  * Callback handler for the style changing.
4462
4444
  */
@@ -4470,6 +4452,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
4470
4452
  if (!_this.styleOpsGrid) {
4471
4453
  return;
4472
4454
  }
4455
+ // do not recreate the styleOpsGrid if it is initialized and configuration object reference has not changed
4456
+ if (_this.styleOpsGrid.children.length > 0 && _this.thumbnailCache.assumedConfiguration === definitions) {
4457
+ return;
4458
+ }
4459
+ _this.thumbnailCache.assumedConfiguration = definitions;
4473
4460
  Array.from(_this.styleOpsGrid.children).forEach(function (element) { return element.remove(); });
4474
4461
  _this.styleButtons.clear();
4475
4462
  _this.populateOpsGridFromDefinitions(definitions);
@@ -4514,6 +4501,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
4514
4501
  }
4515
4502
  });
4516
4503
  container.addEventListener("focusout", function (event) {
4504
+ if (event.target === currStyleButton) {
4505
+ // on focusout from reveal button -> reset the tabIndex on the styleOpsGrid elements that could have been set to -1 on esc key press
4506
+ Array.from(styleOpsGrid.children).forEach(function (e) { return e.removeAttribute('tabIndex'); });
4507
+ }
4517
4508
  if (!(event.relatedTarget instanceof Node && container.contains(event.relatedTarget))) {
4518
4509
  _this.hasFocus = false;
4519
4510
  if (!_this.hasMouse) {
@@ -4528,6 +4519,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
4528
4519
  if (event.keyCode === 27) {
4529
4520
  event.stopPropagation();
4530
4521
  currStyleButton.focus();
4522
+ Array.from(styleOpsGrid.children).forEach(function (e) { return e.setAttribute('tabIndex', "-1"); });
4531
4523
  if (container.classList.contains(StyleControl.Css.inUse)) {
4532
4524
  container.classList.remove(StyleControl.Css.inUse);
4533
4525
  styleOpsGrid.classList.add("hidden-accessible-element");
@@ -4570,6 +4562,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
4570
4562
  _super.prototype.onRemove.call(this);
4571
4563
  this.styleOpsGrid = null;
4572
4564
  this.styleButtons.clear();
4565
+ this.thumbnailCache.response.clear();
4566
+ this.thumbnailCache.blob.clear();
4567
+ this.thumbnailCache.assumedConfiguration = undefined;
4573
4568
  this.map.events.remove("stylechanged", this.onStyleChange);
4574
4569
  this.map.events.remove("mapconfigurationchanged", this.onMapConfigurationChange);
4575
4570
  };
@@ -4629,7 +4624,18 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
4629
4624
  styleOptionButton.setAttribute("type", "button");
4630
4625
  var styleIconImage = new Image();
4631
4626
  fetchIconPromise
4632
- .then(function (response) { return response.blob(); })
4627
+ .then(function (response) {
4628
+ if (_this.thumbnailCache.blob.has(response.url)) {
4629
+ return _this.thumbnailCache.blob.get(response.url);
4630
+ }
4631
+ else {
4632
+ // we need the response.clone() to allow reading over body multiple times since response objects are cached
4633
+ // and can be reused across multiple invocations
4634
+ var blobPromise = response.clone().blob();
4635
+ _this.thumbnailCache.blob.set(response.url, blobPromise);
4636
+ return blobPromise;
4637
+ }
4638
+ })
4633
4639
  .then(function (blob) {
4634
4640
  var iconUrl = URL.createObjectURL(blob);
4635
4641
  styleIconImage.src = iconUrl;
@@ -4737,7 +4743,14 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
4737
4743
  if (mapServiceOptions.transformRequest) {
4738
4744
  merge_1(requestParams, mapServiceOptions.transformRequest(requestParams.url, "Thumbnail"));
4739
4745
  }
4740
- var fetchThumbnailPromise = fetch(requestParams.url, { headers: requestParams.headers });
4746
+ var fetchThumbnailPromise;
4747
+ if (_this.thumbnailCache.response.has(requestParams.url)) {
4748
+ fetchThumbnailPromise = Promise.resolve(_this.thumbnailCache.response.get(requestParams.url));
4749
+ }
4750
+ else {
4751
+ fetchThumbnailPromise = fetch(requestParams.url, { headers: requestParams.headers });
4752
+ _this.thumbnailCache.response.set(requestParams.url, fetchThumbnailPromise);
4753
+ }
4741
4754
  // Add button for each style
4742
4755
  var styleOptionButton = _this.buildSelectStyleBtn(style.name, definitions, fetchThumbnailPromise);
4743
4756
  _this.styleOpsGrid.appendChild(styleOptionButton);
@@ -10015,7 +10028,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
10015
10028
  };
10016
10029
  ZoomControl.prototype.updateZoomButtonsState = function () {
10017
10030
  var zoomInDisabled = this.map.getCamera().zoom >= this.map._getMap().getMaxZoom();
10018
- // small values need special handling, since depending on the height of the map view
10031
+ // small values need special handling, since depending on the height of the map view
10019
10032
  // the actual zoom we can zoom out to can be above or below 0 when the entire map fits the height into the view
10020
10033
  // use web mercator bounds to check if entire latitude range is visible
10021
10034
  var reachedLatitudeBoundaries = BoundingBox.getSouth(this.map.getCamera().bounds) <= -WEBMERCATOR_MAXLAT
@@ -10027,7 +10040,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
10027
10040
  }
10028
10041
  if (this.zoomOutButton && this.zoomOutButton.disabled != zoomOutDisabled) {
10029
10042
  this.zoomOutButton.disabled = zoomOutDisabled;
10030
- this.zoomInButton.setAttribute("aria-label", zoomInDisabled ? "Zoom Out disabled" : "Zoom Out");
10043
+ this.zoomOutButton.setAttribute("aria-label", zoomInDisabled ? "Zoom Out disabled" : "Zoom Out");
10031
10044
  }
10032
10045
  };
10033
10046
  ZoomControl.prototype.constructZoomInButton = function (map) {
@@ -10120,6 +10133,72 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
10120
10133
 
10121
10134
  var cloneDeepWith_1 = cloneDeepWith;
10122
10135
 
10136
+ /**
10137
+ * A hidden HTML element that is used to provide accessibility to shapes such as bubble.
10138
+ */
10139
+ var AccessibleIndicator = /** @class */ (function () {
10140
+ /**
10141
+ * Constructs an AccessibleIndicator object by initializing a hidden `div` element.
10142
+ * @internal
10143
+ */
10144
+ function AccessibleIndicator(options) {
10145
+ var _this = this;
10146
+ /**
10147
+ * Attaches the indicator to the HTML document in a hidden style.
10148
+ * @param map The map.
10149
+ */
10150
+ this.attach = function (map) {
10151
+ // If attaching to a different map, remove popup on current map
10152
+ if (_this.map !== map) {
10153
+ // If map was defined the indicator was attached to another map.
10154
+ if (_this.map) {
10155
+ _this.detachFromCurrentMap();
10156
+ }
10157
+ _this.map = map;
10158
+ _this.map.indicators._getCollectionDiv().appendChild(_this.element);
10159
+ _this.map.indicators.add(_this);
10160
+ }
10161
+ };
10162
+ /**
10163
+ * Removes the indicator from the map and the HTML document.
10164
+ */
10165
+ this.remove = function () {
10166
+ _this.detachFromCurrentMap();
10167
+ _this.element.remove();
10168
+ };
10169
+ /**
10170
+ * Get the DOM element of the indicator.
10171
+ * @returns The DOM element of the indicator.
10172
+ */
10173
+ this.getElement = function () {
10174
+ return _this.element;
10175
+ };
10176
+ this.detachFromCurrentMap = function () {
10177
+ if (_this.map) {
10178
+ _this.map.indicators.remove(_this);
10179
+ delete _this.map;
10180
+ }
10181
+ };
10182
+ this.element = document.createElement("div");
10183
+ // Set tabindex to 0 to make the element focusable.
10184
+ this.element.setAttribute("tabindex", "0");
10185
+ // Set the role to option, and it's container to listbox so the reader will read the listbox as a list.
10186
+ // For example, NVDA will read "data point, {posinset} of {setsize}" when the indicator is focused.
10187
+ this.element.setAttribute("role", "option");
10188
+ if (options === null || options === void 0 ? void 0 : options.setSize)
10189
+ this.element.setAttribute("aria-setsize", options.setSize.toString());
10190
+ if (options === null || options === void 0 ? void 0 : options.positionInSet)
10191
+ this.element.setAttribute("aria-posinset", options.positionInSet.toString());
10192
+ this.element.setAttribute("aria-label", "data point");
10193
+ this.element.classList.add(AccessibleIndicator.Css.hidden);
10194
+ }
10195
+ // CSS class names.
10196
+ AccessibleIndicator.Css = {
10197
+ hidden: "hidden-accessible-element"
10198
+ };
10199
+ return AccessibleIndicator;
10200
+ }());
10201
+
10123
10202
  var __extends$k = (window && window.__extends) || (function () {
10124
10203
  var extendStatics = function (d, b) {
10125
10204
  extendStatics = Object.setPrototypeOf ||
@@ -10233,19 +10312,24 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
10233
10312
  * Get reference to Mapbox Map
10234
10313
  * @internal
10235
10314
  */
10236
- Source.prototype._setMap = function (map) {
10315
+ Source.prototype._setMap = function (map, shouldInvokeEvent) {
10316
+ if (shouldInvokeEvent === void 0) { shouldInvokeEvent = true; }
10237
10317
  if (map == null || map === undefined) {
10238
10318
  var temp = this.map;
10239
10319
  delete this.map;
10240
- this._invokeEvent("sourceremoved", this);
10241
- if (temp) {
10242
- temp.events.invoke("sourceremoved", this);
10320
+ if (shouldInvokeEvent) {
10321
+ this._invokeEvent("sourceremoved", this);
10322
+ if (temp) {
10323
+ temp.events.invoke("sourceremoved", this);
10324
+ }
10243
10325
  }
10244
10326
  }
10245
10327
  else {
10246
10328
  this.map = map;
10247
- this._invokeEvent("sourceadded", this);
10248
- this.map.events.invoke("sourceadded", this);
10329
+ if (shouldInvokeEvent) {
10330
+ this._invokeEvent("sourceadded", this);
10331
+ this.map.events.invoke("sourceadded", this);
10332
+ }
10249
10333
  }
10250
10334
  };
10251
10335
  return Source;
@@ -10566,6 +10650,27 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
10566
10650
  }
10567
10651
  return geoJsonSource;
10568
10652
  };
10653
+ DataSource.prototype._isDeepEqual = function (other) {
10654
+ if (this.constructor !== other.constructor) {
10655
+ return false;
10656
+ }
10657
+ var source = this._buildSource();
10658
+ var otherSource = other._buildSource();
10659
+ return source.type === otherSource.type &&
10660
+ // no data comparison since it is costly and not needed. If geojson data is different, but other source properties are same, we treat it as an update.
10661
+ //source.data === otherSource.data &&
10662
+ source.maxzoom === otherSource.maxzoom &&
10663
+ source.cluster === otherSource.cluster &&
10664
+ source.clusterRadius === otherSource.clusterRadius &&
10665
+ source.tolerance === otherSource.tolerance &&
10666
+ source.lineMetrics === otherSource.lineMetrics &&
10667
+ JSON.stringify(source.clusterProperties) === JSON.stringify(otherSource.clusterProperties) &&
10668
+ source.buffer === otherSource.buffer &&
10669
+ source.clusterMinPoints === otherSource.clusterMinPoints &&
10670
+ source.generateId === otherSource.generateId &&
10671
+ source.promoteId === otherSource.promoteId &&
10672
+ source.filter === otherSource.filter;
10673
+ };
10569
10674
  /**
10570
10675
  * @internal
10571
10676
  */
@@ -10847,6 +10952,26 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
10847
10952
  }
10848
10953
  return vectorSource;
10849
10954
  };
10955
+ /**
10956
+ * @internal
10957
+ */
10958
+ VectorTileSource.prototype._isDeepEqual = function (other) {
10959
+ if (this.constructor !== other.constructor) {
10960
+ return false;
10961
+ }
10962
+ var source = this._buildSource();
10963
+ var otherSource = other._buildSource();
10964
+ return source.type === otherSource.type &&
10965
+ source.url === otherSource.url &&
10966
+ ((source.tiles === undefined && otherSource.tiles === undefined) ||
10967
+ (source.tiles && otherSource.tiles && source.tiles.length === otherSource.tiles.length && source.tiles.every(function (value, idx) { return value === otherSource.tiles[idx]; }))) &&
10968
+ source.minzoom === otherSource.minzoom &&
10969
+ source.maxzoom === otherSource.maxzoom &&
10970
+ source.bounds === otherSource.bounds &&
10971
+ source.attribution === otherSource.attribution &&
10972
+ source.promoteId === otherSource.promoteId &&
10973
+ source.scheme === otherSource.scheme;
10974
+ };
10850
10975
  return VectorTileSource;
10851
10976
  }(Source));
10852
10977
 
@@ -10978,7 +11103,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
10978
11103
  // and can be used to determine which events are ours vs Mapbox's.
10979
11104
  Layer.LayerEvents = {
10980
11105
  layeradded: undefined,
10981
- layerremoved: undefined
11106
+ layerremoved: undefined,
11107
+ focusin: undefined,
11108
+ focusout: undefined,
10982
11109
  };
10983
11110
  return Layer;
10984
11111
  }(EventEmitter));
@@ -11133,6 +11260,44 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
11133
11260
  * @default 8
11134
11261
  */
11135
11262
  _this.radius = 8;
11263
+ /**
11264
+ * @internal
11265
+ * Specifies whether to create focusable indicators for the bubbles.
11266
+ * The default highlighting style is provided if the source is DataSource with Shape:
11267
+ * ```ts
11268
+ * const datasource = new DataSource('bubble-source');
11269
+ * datasource.setShapes([new Shape(new Point([-122.335, 47.62]))]);
11270
+ * this.map.sources.add(datasource);
11271
+ * const layer = new BubbleLayer(datasource, 'bubble', {
11272
+ * radius: 10,
11273
+ * color: 'cyan',
11274
+ * createIndicators: true,
11275
+ * });
11276
+ * ```
11277
+ *
11278
+ * For other sources, you can provide the accessibilityIdKey option to specify the property name of the feature to use as the accessibility id.
11279
+ * ```ts
11280
+ * const vtSource = new VectorTileSource("indoorTiles", { tiles, // provide your tile urls });
11281
+ * this.map.sources.add(vtSource);
11282
+ * const layer = new BubbleLayer(vtSource, 'bubble', {
11283
+ * createIndicators: true,
11284
+ * accessibilityIdKey: '{add your ID here}'
11285
+ * });
11286
+ * ```
11287
+ *
11288
+ * If you want to customize the highlighting style, you can use the focusin/focusout events to change the style of the bubble.
11289
+ * ```ts
11290
+ * this.map.events.add('focusin', 'bubble', (e) => { handle the style highlight });
11291
+ * ```
11292
+ *
11293
+ * Note: We treat this as an internal option for now because we hadn't fully decided the default styling for the indicators.
11294
+ * Once we decide, we will make this a public option or remove it.
11295
+ */
11296
+ _this.createIndicators = false;
11297
+ /**
11298
+ * @internal
11299
+ */
11300
+ _this.accessibilityIdKey = undefined;
11136
11301
  return _this;
11137
11302
  }
11138
11303
  return BubbleLayerOptions;
@@ -11153,6 +11318,63 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
11153
11318
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
11154
11319
  };
11155
11320
  })();
11321
+ var __awaiter$1 = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
11322
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
11323
+ return new (P || (P = Promise))(function (resolve, reject) {
11324
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
11325
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
11326
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
11327
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
11328
+ });
11329
+ };
11330
+ var __generator$1 = (window && window.__generator) || function (thisArg, body) {
11331
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
11332
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
11333
+ function verb(n) { return function (v) { return step([n, v]); }; }
11334
+ function step(op) {
11335
+ if (f) throw new TypeError("Generator is already executing.");
11336
+ while (_) try {
11337
+ 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;
11338
+ if (y = 0, t) op = [op[0] & 2, t.value];
11339
+ switch (op[0]) {
11340
+ case 0: case 1: t = op; break;
11341
+ case 4: _.label++; return { value: op[1], done: false };
11342
+ case 5: _.label++; y = op[1]; op = [0]; continue;
11343
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
11344
+ default:
11345
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
11346
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
11347
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
11348
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
11349
+ if (t[2]) _.ops.pop();
11350
+ _.trys.pop(); continue;
11351
+ }
11352
+ op = body.call(thisArg, _);
11353
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
11354
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
11355
+ }
11356
+ };
11357
+ var __read$3 = (window && window.__read) || function (o, n) {
11358
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
11359
+ if (!m) return o;
11360
+ var i = m.call(o), r, ar = [], e;
11361
+ try {
11362
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
11363
+ }
11364
+ catch (error) { e = { error: error }; }
11365
+ finally {
11366
+ try {
11367
+ if (r && !r.done && (m = i["return"])) m.call(i);
11368
+ }
11369
+ finally { if (e) throw e.error; }
11370
+ }
11371
+ return ar;
11372
+ };
11373
+ var __spreadArray = (window && window.__spreadArray) || function (to, from) {
11374
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
11375
+ to[j] = from[i];
11376
+ return to;
11377
+ };
11156
11378
  /**
11157
11379
  * Renders Point objects as scalable circles (bubbles).
11158
11380
  */
@@ -11166,6 +11388,93 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
11166
11388
  */
11167
11389
  function BubbleLayer(source, id, options) {
11168
11390
  var _this = _super.call(this, id) || this;
11391
+ _this.accessibleIndicator = [];
11392
+ /** @internal */
11393
+ _this._setAccessibleIndicator = function () { return __awaiter$1(_this, void 0, void 0, function () {
11394
+ var renderedShapes, accessibilityIdKey, createIndicator, insertHiddenBefore, insertHiddenInFront, attach;
11395
+ var _this = this;
11396
+ return __generator$1(this, function (_a) {
11397
+ this.accessibleIndicator.forEach(function (indicator) { return indicator.remove(); });
11398
+ this.accessibleIndicator = [];
11399
+ renderedShapes = this.map.layers.getRenderedShapes(this.map.getCamera().bounds, this);
11400
+ accessibilityIdKey = this.options.accessibilityIdKey || (this._getDataSource() ? Shape._shapeIdPropName : undefined);
11401
+ createIndicator = function (renderedShapes, idx) {
11402
+ var curRenderedShape = renderedShapes[idx];
11403
+ var bubbleFeature = curRenderedShape instanceof Shape ? curRenderedShape.toJson() : curRenderedShape;
11404
+ var indicator = new AccessibleIndicator({ positionInSet: idx + 1, setSize: renderedShapes.length });
11405
+ var element = indicator.getElement();
11406
+ var _a = __read$3(_this.map.positionsToPixels([_this.getFirstCoordinate(bubbleFeature.geometry.coordinates)]), 1), pixel = _a[0];
11407
+ element.addEventListener('focusin', function (event) {
11408
+ _this.accessibleIndicator.filter(function (i) { return i !== indicator; }).forEach(function (indicator) { return indicator.remove(); });
11409
+ // insert previous and next popups
11410
+ if (idx - 1 >= 0) {
11411
+ insertHiddenBefore(indicator, createIndicator(renderedShapes, idx - 1));
11412
+ }
11413
+ if (idx + 1 < renderedShapes.length) {
11414
+ attach(createIndicator(renderedShapes, idx + 1));
11415
+ }
11416
+ // if we are on boundaries: add the first / last indicator
11417
+ // to maintain indicators on full page navigation cycle
11418
+ if (idx >= 2 && idx == renderedShapes.length - 1) {
11419
+ insertHiddenInFront(createIndicator(renderedShapes, 0));
11420
+ }
11421
+ if (idx == 0 && renderedShapes.length >= 2) {
11422
+ attach(createIndicator(renderedShapes, renderedShapes.length - 1));
11423
+ }
11424
+ if (accessibilityIdKey !== undefined) {
11425
+ _this.map._getMap().setPaintProperty(_this.id, 'circle-stroke-color', ['case', ['==', ['get', accessibilityIdKey], bubbleFeature.properties[accessibilityIdKey]], '#000000', _this.options.strokeColor]);
11426
+ }
11427
+ var focusEvent = {
11428
+ target: element,
11429
+ type: 'focusin',
11430
+ map: _this.map,
11431
+ shape: curRenderedShape,
11432
+ originalEvent: event,
11433
+ pixel: pixel
11434
+ };
11435
+ _this._invokeEvent('focusin', focusEvent);
11436
+ });
11437
+ element.addEventListener('focusout', function (event) {
11438
+ if (accessibilityIdKey !== undefined) {
11439
+ _this.map._getMap().setPaintProperty(_this.id, 'circle-stroke-color', ['case', ['==', ['get', accessibilityIdKey], bubbleFeature.properties[accessibilityIdKey]], _this.options.strokeColor, _this.options.strokeColor]);
11440
+ }
11441
+ var focusEvent = {
11442
+ target: element,
11443
+ type: 'focusout',
11444
+ map: _this.map,
11445
+ shape: curRenderedShape,
11446
+ originalEvent: event,
11447
+ pixel: pixel
11448
+ };
11449
+ _this._invokeEvent('focusout', focusEvent);
11450
+ });
11451
+ _this.accessibleIndicator.push(indicator);
11452
+ return indicator;
11453
+ };
11454
+ insertHiddenBefore = function (base, toInsert) {
11455
+ toInsert.attach(_this.map);
11456
+ var elementToSwapIn = toInsert.getElement();
11457
+ var baseElement = base.getElement();
11458
+ baseElement.parentElement.insertBefore(elementToSwapIn, baseElement);
11459
+ };
11460
+ insertHiddenInFront = function (toInsert) {
11461
+ toInsert.attach(_this.map);
11462
+ var elementToSwapIn = toInsert.getElement();
11463
+ var parent = elementToSwapIn.parentElement;
11464
+ parent.insertBefore(elementToSwapIn, parent.firstElementChild);
11465
+ };
11466
+ attach = function (popup) {
11467
+ popup.attach(_this.map);
11468
+ };
11469
+ if (renderedShapes.length > 0) {
11470
+ attach(createIndicator(renderedShapes, 0));
11471
+ }
11472
+ if (renderedShapes.length > 1) {
11473
+ attach(createIndicator(renderedShapes, renderedShapes.length - 1));
11474
+ }
11475
+ return [2 /*return*/];
11476
+ });
11477
+ }); };
11169
11478
  _this.options = new BubbleLayerOptions().merge(cloneDeepWith_1(options, BubbleLayerOptions._cloneCustomizer));
11170
11479
  _this.options.source = source || _this.options.source;
11171
11480
  return _this;
@@ -11213,6 +11522,73 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
11213
11522
  }
11214
11523
  this.options = newOptions;
11215
11524
  };
11525
+ BubbleLayer.prototype.onAdd = function (map) {
11526
+ var _this = this;
11527
+ _super.prototype.onAdd.call(this, map);
11528
+ if (this.options.createIndicators) {
11529
+ // Wait for map idle for the first time to ensure `layer.getRenderedShapes` return correct shapes.
11530
+ map.events.addOnce('idle', this._setAccessibleIndicator);
11531
+ // The rendered shapes may be changed when map is moved. Update the indicators when map is moved.
11532
+ map.events.add('moveend', this._setAccessibleIndicator);
11533
+ var dataSource = this._getDataSource();
11534
+ if (dataSource) {
11535
+ // The rendered shapes may be changed when data is added. Update the indicators when data is added.
11536
+ map.events.add('dataadded', dataSource, function () {
11537
+ // Wait for map idle to ensure `layer.getRenderedShapes` return correct shapes.
11538
+ map.events.addOnce('idle', _this._setAccessibleIndicator);
11539
+ });
11540
+ }
11541
+ else {
11542
+ var sourceId_1 = typeof this.options.source === 'string' ? this.options.source : this.options.source.getId();
11543
+ map.events.add('sourcedata', function (mapDataEvent) {
11544
+ var _a;
11545
+ // There's chances that mapDataEvent.isSourceLoaded doesn't update correctly when using flyTo, thus we check by using map.isSourceLoaded.
11546
+ if (((_a = mapDataEvent.source) === null || _a === void 0 ? void 0 : _a.getId()) === sourceId_1 && map._getMap().isSourceLoaded(sourceId_1)) {
11547
+ // Source event will be fired multiple times, and we are only interested when the source is loaded.
11548
+ // Thus design a cache key that only changed when camera & style properties are changed.
11549
+ var curCacheKey = _this._getSourceDataEventCacheKey();
11550
+ if (curCacheKey !== _this.sourceDataEventCacheKey) {
11551
+ _this._setAccessibleIndicator();
11552
+ _this.sourceDataEventCacheKey = curCacheKey;
11553
+ }
11554
+ }
11555
+ });
11556
+ }
11557
+ }
11558
+ };
11559
+ BubbleLayer.prototype.onRemove = function () {
11560
+ if (this.options.createIndicators) {
11561
+ this.map.events.remove('idle', this._setAccessibleIndicator);
11562
+ this.map.events.remove('moveend', this._setAccessibleIndicator);
11563
+ var dataSource = this._getDataSource();
11564
+ if (dataSource) {
11565
+ this.map.events.remove('dataadded', dataSource, this._setAccessibleIndicator);
11566
+ }
11567
+ else {
11568
+ this.map.events.remove('sourcedata', this._setAccessibleIndicator);
11569
+ }
11570
+ }
11571
+ _super.prototype.onRemove.call(this);
11572
+ };
11573
+ BubbleLayer.prototype._getSourceDataEventCacheKey = function () {
11574
+ if (!this.map) {
11575
+ return undefined;
11576
+ }
11577
+ var mapConfiguration = this.map.getServiceOptions().mapConfiguration;
11578
+ return __spreadArray(__spreadArray([], __read$3(this.map.getCamera().bounds)), [
11579
+ this.map.getCamera().zoom,
11580
+ this.map.getCamera().pitch,
11581
+ this.map.getStyle().style,
11582
+ mapConfiguration instanceof Object ? mapConfiguration.id : mapConfiguration
11583
+ ]).join(',');
11584
+ };
11585
+ BubbleLayer.prototype._getDataSource = function () {
11586
+ var source = typeof this.options.source === 'string' ? this.map.sources.getById(this.options.source) : this.options.source;
11587
+ if (source instanceof DataSource) {
11588
+ return source;
11589
+ }
11590
+ return undefined;
11591
+ };
11216
11592
  /**
11217
11593
  * @internal
11218
11594
  */
@@ -11264,6 +11640,17 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
11264
11640
  ids.add(this.options.source);
11265
11641
  return ids;
11266
11642
  };
11643
+ /**
11644
+ * The coordinates can be nested, so we need to get the first coordinate.
11645
+ * @param coordinates The property from the Geometry. Can be Position, Position[], Position[][], etc.
11646
+ * @returns
11647
+ */
11648
+ BubbleLayer.prototype.getFirstCoordinate = function (coordinates) {
11649
+ if (!Array.isArray(coordinates[0])) {
11650
+ return coordinates;
11651
+ }
11652
+ return this.getFirstCoordinate(coordinates[0]);
11653
+ };
11267
11654
  return BubbleLayer;
11268
11655
  }(Layer));
11269
11656
 
@@ -12331,7 +12718,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
12331
12718
  };
12332
12719
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
12333
12720
  };
12334
- var __read$3 = (window && window.__read) || function (o, n) {
12721
+ var __read$4 = (window && window.__read) || function (o, n) {
12335
12722
  var m = typeof Symbol === "function" && o[Symbol.iterator];
12336
12723
  if (!m) return o;
12337
12724
  var i = m.call(o), r, ar = [], e;
@@ -12347,7 +12734,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
12347
12734
  }
12348
12735
  return ar;
12349
12736
  };
12350
- var __spreadArray = (window && window.__spreadArray) || function (to, from) {
12737
+ var __spreadArray$1 = (window && window.__spreadArray) || function (to, from) {
12351
12738
  for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
12352
12739
  to[j] = from[i];
12353
12740
  return to;
@@ -12422,7 +12809,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
12422
12809
  finally { if (e_1) throw e_1.error; }
12423
12810
  }
12424
12811
  // Then execute the standard merge behavior.
12425
- var merged = _super.prototype.merge.apply(this, __spreadArray([], __read$3(valueList)));
12812
+ var merged = _super.prototype.merge.apply(this, __spreadArray$1([], __read$4(valueList)));
12426
12813
  if (isNewColorSet) {
12427
12814
  merged.fillPattern = undefined;
12428
12815
  }
@@ -13753,7 +14140,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
13753
14140
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13754
14141
  };
13755
14142
  })();
13756
- var __read$4 = (window && window.__read) || function (o, n) {
14143
+ var __read$5 = (window && window.__read) || function (o, n) {
13757
14144
  var m = typeof Symbol === "function" && o[Symbol.iterator];
13758
14145
  if (!m) return o;
13759
14146
  var i = m.call(o), r, ar = [], e;
@@ -13865,7 +14252,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
13865
14252
  */
13866
14253
  _this._onDown = function (event) {
13867
14254
  _this.map.popups._addDraggedPopup(_this);
13868
- var _a = __read$4(_this.map.positionsToPixels([_this.options.position]), 1), anchorPixel = _a[0];
14255
+ var _a = __read$5(_this.map.positionsToPixels([_this.options.position]), 1), anchorPixel = _a[0];
13869
14256
  if (event.type === "mousedown") {
13870
14257
  event = event;
13871
14258
  _this.dragOffset = [
@@ -14029,7 +14416,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
14029
14416
  pixel[0] + this.dragOffset[0],
14030
14417
  pixel[1] + this.dragOffset[1]
14031
14418
  ];
14032
- var _a = __read$4(this.map.pixelsToPositions([anchorPixel]), 1), anchorPos = _a[0];
14419
+ var _a = __read$5(this.map.pixelsToPositions([anchorPixel]), 1), anchorPos = _a[0];
14033
14420
  this.options.position = anchorPos;
14034
14421
  this.marker.setLngLat(this.options.position);
14035
14422
  this._invokeEvent("drag", { type: "drag", target: this });
@@ -14183,7 +14570,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
14183
14570
  posY = pt.y;
14184
14571
  }
14185
14572
  else {
14186
- var _a = __read$4(map.positionsToPixels([options.position]), 1), _b = __read$4(_a[0], 2), x = _b[0], y = _b[1];
14573
+ var _a = __read$5(map.positionsToPixels([options.position]), 1), _b = __read$5(_a[0], 2), x = _b[0], y = _b[1];
14187
14574
  posX = x;
14188
14575
  posY = y;
14189
14576
  }
@@ -14672,6 +15059,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
14672
15059
  defaultRegion: {
14673
15060
  code: "NGT",
14674
15061
  strings: "en/resource.json"
15062
+ },
15063
+ latn: {
15064
+ code: "NGT-Latn",
15065
+ strings: "en/resource.json"
14675
15066
  }
14676
15067
  },
14677
15068
  ar: {
@@ -14718,6 +15109,18 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
14718
15109
  us: {
14719
15110
  code: "en-US",
14720
15111
  strings: "en/resource.json"
15112
+ },
15113
+ au: {
15114
+ code: "en-AU",
15115
+ strings: "en/resource.json"
15116
+ },
15117
+ gb: {
15118
+ code: "en-GB",
15119
+ strings: "en/resource.json"
15120
+ },
15121
+ nz: {
15122
+ code: "en-NZ",
15123
+ strings: "en/resource.json"
14721
15124
  }
14722
15125
  },
14723
15126
  es: {
@@ -14843,14 +15246,31 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
14843
15246
  }
14844
15247
  },
14845
15248
  zh: {
15249
+ // per https://microsoft.sharepoint.com/sites/globalreadiness/SitePages/Language-fallback.aspx
15250
+ // Chinese - Neutral (zh) fallbacks to en-US
14846
15251
  defaultRegion: {
14847
- code: "zh-Hant",
14848
- strings: "zh-tw/resource.json"
15252
+ code: "zh",
15253
+ strings: "en/resource.json"
15254
+ }
15255
+ },
15256
+ "zh-hans": {
15257
+ defaultRegion: {
15258
+ code: "zh-Hans",
15259
+ strings: "zh-cn/resource.json"
15260
+ },
15261
+ cn: {
15262
+ code: "zh-Hans-CN",
15263
+ strings: "zh-cn/resource.json"
14849
15264
  }
14850
15265
  },
14851
15266
  "zh-hant": {
15267
+ // per discussion with global readiness team, we were explicitly asked to not fallback zh-hant to zh-tw
14852
15268
  defaultRegion: {
14853
15269
  code: "zh-Hant",
15270
+ strings: "en/resource.json"
15271
+ },
15272
+ tw: {
15273
+ code: "zh-Hant-TW",
14854
15274
  strings: "zh-tw/resource.json"
14855
15275
  }
14856
15276
  }
@@ -15067,7 +15487,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
15067
15487
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15068
15488
  };
15069
15489
  })();
15070
- var __read$5 = (window && window.__read) || function (o, n) {
15490
+ var __read$6 = (window && window.__read) || function (o, n) {
15071
15491
  var m = typeof Symbol === "function" && o[Symbol.iterator];
15072
15492
  if (!m) return o;
15073
15493
  var i = m.call(o), r, ar = [], e;
@@ -15083,7 +15503,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
15083
15503
  }
15084
15504
  return ar;
15085
15505
  };
15086
- var __spreadArray$1 = (window && window.__spreadArray) || function (to, from) {
15506
+ var __spreadArray$2 = (window && window.__spreadArray) || function (to, from) {
15087
15507
  for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
15088
15508
  to[j] = from[i];
15089
15509
  return to;
@@ -15220,7 +15640,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
15220
15640
  for (var _i = 0; _i < arguments.length; _i++) {
15221
15641
  valueList[_i] = arguments[_i];
15222
15642
  }
15223
- var merged = _super.prototype.merge.apply(this, __spreadArray$1([], __read$5(valueList)));
15643
+ var merged = _super.prototype.merge.apply(this, __spreadArray$2([], __read$6(valueList)));
15224
15644
  if (merged.authType === exports.AuthenticationType.subscriptionKey) {
15225
15645
  merged.authContext = merged.aadAppId = merged.getToken = undefined;
15226
15646
  }
@@ -15479,7 +15899,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
15479
15899
  /**
15480
15900
  * Specifies which set of geopolitically disputed borders and labels are displayed on the map. The View parameter (also referred to as “user region parameter”) is a 2-letter ISO-3166 Country Code that will show the correct maps for that country/region. Country/Regions that are not on the View list or if unspecified will default to the “Unified” View.
15481
15901
  * Please see the supported [Views]{@link https://aka.ms/AzureMapsLocalizationViews }.
15482
- * It is your responsibility to determine the location of your users, and then set the View parameter correctly for that location. The View parameter in Azure Maps must be used in compliance with applicable laws, including those regarding mapping, of the country where maps, images and other data and third party content that You are authorized to access via Azure Maps is made available.
15902
+ * It is your responsibility to determine the location of your users, and then set the View parameter correctly for that location. The View parameter in Azure Maps must be used in compliance with applicable laws, including those regarding mapping, of the country/region where maps, images and other data and third party content that You are authorized to access via Azure Maps is made available.
15483
15903
  * @param view The new default view
15484
15904
  */
15485
15905
  function setView(view) {
@@ -15891,10 +16311,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
15891
16311
  if (add) {
15892
16312
  this.logoAnchor = document.createElement("a");
15893
16313
  this.logoAnchor.className = "azure-map-logo";
15894
- this.logoAnchor.href = "https://microsoft.com";
16314
+ this.logoAnchor.href = "https://aka.ms/azuremaps";
15895
16315
  this.logoAnchor.setAttribute("aria-label", "Microsoft");
16316
+ this.logoAnchor.setAttribute("target", "_blank");
15896
16317
  this.container.appendChild(this.logoAnchor);
15897
- this.logoTooltip = buildAccessibleTooltip("Visit microsoft.com");
16318
+ this.logoTooltip = buildAccessibleTooltip("Visit azure.microsoft.com");
15898
16319
  this.container.appendChild(this.logoTooltip);
15899
16320
  positionTooltip(this.logoTooltip, this.logoAnchor);
15900
16321
  }
@@ -15919,7 +16340,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
15919
16340
  return __assign$4.apply(this, arguments);
15920
16341
  };
15921
16342
 
15922
- var __awaiter$1 = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
16343
+ var __awaiter$2 = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
15923
16344
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15924
16345
  return new (P || (P = Promise))(function (resolve, reject) {
15925
16346
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -15928,7 +16349,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
15928
16349
  step((generator = generator.apply(thisArg, _arguments || [])).next());
15929
16350
  });
15930
16351
  };
15931
- var __generator$1 = (window && window.__generator) || function (thisArg, body) {
16352
+ var __generator$2 = (window && window.__generator) || function (thisArg, body) {
15932
16353
  var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
15933
16354
  return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
15934
16355
  function verb(n) { return function (v) { return step([n, v]); }; }
@@ -15955,7 +16376,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
15955
16376
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
15956
16377
  }
15957
16378
  };
15958
- var __read$6 = (window && window.__read) || function (o, n) {
16379
+ var __read$7 = (window && window.__read) || function (o, n) {
15959
16380
  var m = typeof Symbol === "function" && o[Symbol.iterator];
15960
16381
  if (!m) return o;
15961
16382
  var i = m.call(o), r, ar = [], e;
@@ -15971,6 +16392,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
15971
16392
  }
15972
16393
  return ar;
15973
16394
  };
16395
+ var __spreadArray$3 = (window && window.__spreadArray) || function (to, from) {
16396
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
16397
+ to[j] = from[i];
16398
+ return to;
16399
+ };
15974
16400
 
15975
16401
  /**
15976
16402
  * @private
@@ -16107,14 +16533,17 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
16107
16533
  var trafficOptions = _this.map.getTraffic();
16108
16534
  if (trafficOptions.flow !== "none") {
16109
16535
  var trafficFlowComponent = _this.map.layers.getLayerById("traffic_" + trafficOptions.flow);
16536
+ if (!trafficFlowComponent && ['absolute', 'relative-delay'].includes(trafficOptions.flow)) {
16537
+ // Fallback to relative if deprecated flow type is used
16538
+ trafficFlowComponent = _this.map.layers.getLayerById("traffic_relative");
16539
+ }
16110
16540
  if (trafficFlowComponent) {
16111
- _this.lastFlowMode = trafficOptions.flow;
16541
+ _this.lastFlowMode = trafficFlowComponent.getId().replace("traffic_", "");
16112
16542
  trafficFlowComponent._updateLayoutProperty("visibility", "visible", "none");
16113
16543
  }
16114
16544
  }
16115
16545
  };
16116
16546
  this.removeFromMap = function () {
16117
- var trafficOptions = _this.map.getTraffic();
16118
16547
  if (_this.lastFlowMode != "none") {
16119
16548
  var trafficFlowComponent = _this.map.layers.getLayerById("traffic_" + _this.lastFlowMode);
16120
16549
  if (trafficFlowComponent) {
@@ -16848,7 +17277,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
16848
17277
  };
16849
17278
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
16850
17279
  };
16851
- var __read$7 = (window && window.__read) || function (o, n) {
17280
+ var __read$8 = (window && window.__read) || function (o, n) {
16852
17281
  var m = typeof Symbol === "function" && o[Symbol.iterator];
16853
17282
  if (!m) return o;
16854
17283
  var i = m.call(o), r, ar = [], e;
@@ -17046,7 +17475,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
17046
17475
  var callbacks = new Dictionary(this.mapCallbackHandler.getEventCallbacks(eventType, layer));
17047
17476
  if (callbacks) {
17048
17477
  callbacks.forEach(function (_a, callback) {
17049
- var _b = __read$7(_a, 2), _ = _b[0], once = _b[1];
17478
+ var _b = __read$8(_a, 2), _ = _b[0], once = _b[1];
17050
17479
  // Invoking a listener this way circumvents the fire once logic in the modified callback.
17051
17480
  // So we check if the callback was added as a fire once and if so remove it here.
17052
17481
  if (once) {
@@ -17075,7 +17504,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
17075
17504
  this._removeListener(eventType, target, callback);
17076
17505
  }
17077
17506
  else {
17078
- target._removeEventListener(eventType, callback);
17507
+ target === null || target === void 0 ? void 0 : target._removeEventListener(eventType, callback);
17079
17508
  }
17080
17509
  }
17081
17510
  }
@@ -17154,7 +17583,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
17154
17583
  eventDict.forEach(function (callbackDict, eventType) {
17155
17584
  callbackDict.forEach(function (_a) {
17156
17585
  var e_6, _b;
17157
- var _c = __read$7(_a, 1), modifiedCallback = _c[0];
17586
+ var _c = __read$8(_a, 1), modifiedCallback = _c[0];
17158
17587
  try {
17159
17588
  for (var _d = __values$a(layer._getLayerIds()), _e = _d.next(); !_e.done; _e = _d.next()) {
17160
17589
  var mbLayerId = _e.value;
@@ -17187,7 +17616,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
17187
17616
  eventDict.forEach(function (callbackDict, eventType) {
17188
17617
  callbackDict.forEach(function (_a) {
17189
17618
  var e_7, _b;
17190
- var _c = __read$7(_a, 1), modifiedCallback = _c[0];
17619
+ var _c = __read$8(_a, 1), modifiedCallback = _c[0];
17191
17620
  try {
17192
17621
  for (var _d = __values$a(layer._getLayerIds()), _e = _d.next(); !_e.done; _e = _d.next()) {
17193
17622
  var mbLayerId = _e.value;
@@ -17565,10 +17994,15 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
17565
17994
  return ids;
17566
17995
  };
17567
17996
  FundamentalMapLayer.prototype._updateLayoutProperty = function (name, newValue, oldValue, subValue) {
17568
- var _this = this;
17997
+ if (isEqual_1(newValue, oldValue))
17998
+ return;
17999
+ var map = this.map._getMap();
17569
18000
  this.layers.forEach(function (layer) {
17570
- if (!(isEqual_1(newValue, oldValue))) {
17571
- _this.map._getMap().setLayoutProperty(layer.id, name, subValue || newValue);
18001
+ if (map.getLayer(layer.id)) {
18002
+ map.setLayoutProperty(layer.id, name, subValue || newValue);
18003
+ }
18004
+ else {
18005
+ console.warn("Could not update layout property " + name + " for layer " + layer.id + " to " + (subValue || newValue));
17572
18006
  }
17573
18007
  });
17574
18008
  };
@@ -17586,7 +18020,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
17586
18020
  };
17587
18021
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
17588
18022
  };
17589
- var __read$8 = (window && window.__read) || function (o, n) {
18023
+ var __read$9 = (window && window.__read) || function (o, n) {
17590
18024
  var m = typeof Symbol === "function" && o[Symbol.iterator];
17591
18025
  if (!m) return o;
17592
18026
  var i = m.call(o), r, ar = [], e;
@@ -17602,7 +18036,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
17602
18036
  }
17603
18037
  return ar;
17604
18038
  };
17605
- var __spreadArray$2 = (window && window.__spreadArray) || function (to, from) {
18039
+ var __spreadArray$4 = (window && window.__spreadArray) || function (to, from) {
17606
18040
  for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
17607
18041
  to[j] = from[i];
17608
18042
  return to;
@@ -17663,10 +18097,12 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
17663
18097
  // Place the new layer behind the specified before layer.
17664
18098
  var layerIndex = this.layerIndex.findIndex(function (l) { return l.getId() === layer.getId(); });
17665
18099
  var userLayerIndex = this.userLayers.findIndex(function (ul) { return ul.layer.getId() === layer.getId(); });
17666
- var tempLayer = this.layerIndex[layerIndex];
17667
18100
  this._removeMapboxLayers(layer);
17668
18101
  this._addMapboxLayers(layer, before);
17669
- this.map.events._disableLayerEvents(tempLayer);
18102
+ var tempLayer = this.layerIndex[layerIndex];
18103
+ if (tempLayer) {
18104
+ this.map.events._disableLayerEvents(tempLayer);
18105
+ }
17670
18106
  this.map.events._enableLayerEvents(layer);
17671
18107
  this.layerIndex.splice(layerIndex, 1);
17672
18108
  var beforeIndex = this.layerIndex.findIndex(function (l) { return l.getId() === before; });
@@ -17674,7 +18110,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
17674
18110
  if (!(layer instanceof FundamentalMapLayer)) {
17675
18111
  this.userLayers[userLayerIndex] = { layer: layer, before: before };
17676
18112
  }
17677
- tempLayer.onRemove();
18113
+ if (tempLayer) {
18114
+ tempLayer.onRemove();
18115
+ }
17678
18116
  layer.onAdd(this.map);
17679
18117
  }
17680
18118
  else {
@@ -17885,9 +18323,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
17885
18323
  LayerManager.prototype.clear = function () {
17886
18324
  for (var layerIndexIndex = this.layerIndex.length - 1; layerIndexIndex >= 0; layerIndexIndex--) {
17887
18325
  var tempLayer = this.layerIndex[layerIndexIndex];
17888
- this._removeMapboxLayers(tempLayer, true);
17889
- this.layerIndex.splice(layerIndexIndex, 1);
17890
- tempLayer.onRemove();
18326
+ if (tempLayer) {
18327
+ this._removeMapboxLayers(tempLayer, true);
18328
+ this.layerIndex.splice(layerIndexIndex, 1);
18329
+ tempLayer.onRemove();
18330
+ }
17891
18331
  }
17892
18332
  this.userLayers = [];
17893
18333
  };
@@ -18038,7 +18478,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
18038
18478
  // If a specified layer hasn't been added to the map throw an error.
18039
18479
  var index = this_1.layerIndex.findIndex(function (l) { return l.getId() === layerId; });
18040
18480
  if (index > -1) {
18041
- layerIds.push.apply(layerIds, __spreadArray$2([], __read$8(this_1.layerIndex[index]._getLayerIds()
18481
+ layerIds.push.apply(layerIds, __spreadArray$4([], __read$9(this_1.layerIndex[index]._getLayerIds()
18042
18482
  .filter(function (id) { return !!_this.map._getMap().getLayer(id); }))));
18043
18483
  }
18044
18484
  else {
@@ -18327,6 +18767,37 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
18327
18767
  FundamentalMapSource.prototype._buildSource = function () {
18328
18768
  return this.source;
18329
18769
  };
18770
+ /**
18771
+ * @internal
18772
+ */
18773
+ FundamentalMapSource.prototype._isDeepEqual = function (other) {
18774
+ if (this.constructor !== other.constructor) {
18775
+ return false;
18776
+ }
18777
+ var source = this.source;
18778
+ var otherSource = other.source;
18779
+ var baseEqual = source.type === otherSource.type &&
18780
+ source.url === otherSource.url
18781
+ && ((source.tiles === undefined && otherSource.tiles === undefined) ||
18782
+ (source.tiles && otherSource.tiles && source.tiles.length === otherSource.tiles.length && source.tiles.every(function (value, idx) { return value === otherSource.tiles[idx]; })))
18783
+ && source.minzoom === otherSource.minzoom
18784
+ && source.maxzoom === otherSource.maxzoom
18785
+ && source.bounds === otherSource.bounds
18786
+ && source.attribution === otherSource.attribution;
18787
+ var rasterEqual = source.type !== "raster" || (source.type === "raster"
18788
+ && source.type === otherSource.type
18789
+ && source.tileSize === otherSource.tileSize
18790
+ && source.scheme === otherSource.scheme);
18791
+ var rasterDemEqual = source.type !== "raster-dem" || (source.type === "raster-dem"
18792
+ && source.type === otherSource.type
18793
+ && source.tileSize === otherSource.tileSize
18794
+ && source.encoding === otherSource.encoding);
18795
+ var vectorEqual = source.type !== "vector" || (source.type === "vector"
18796
+ && source.type === otherSource.type
18797
+ && source.promoteId === otherSource.promoteId
18798
+ && source.scheme === otherSource.scheme);
18799
+ return baseEqual && rasterEqual && rasterDemEqual && vectorEqual;
18800
+ };
18330
18801
  /**
18331
18802
  * Updates the source info to convert the tiles to url strings.
18332
18803
  * @param sourceDef The original source info.
@@ -18623,39 +19094,52 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
18623
19094
  var _this = this;
18624
19095
  if (sources) {
18625
19096
  Object.keys(sources).forEach(function (sourceId) {
19097
+ var sourceToAdd = sources[sourceId];
19098
+ var newSource;
19099
+ if (sourceToAdd.type === "vector") {
19100
+ newSource = new FundamentalMapSource(sourceId, {
19101
+ name: sourceId,
19102
+ tiles: sourceToAdd.tiles,
19103
+ type: "vector",
19104
+ url: sourceToAdd.url
19105
+ });
19106
+ }
19107
+ else if (sourceToAdd.type === "raster") {
19108
+ newSource = new FundamentalMapSource(sourceId, {
19109
+ name: sourceId,
19110
+ tiles: sourceToAdd.tiles,
19111
+ type: "raster",
19112
+ url: sourceToAdd.url
19113
+ });
19114
+ }
19115
+ else {
19116
+ // Do not throw for the source of unknown type.
19117
+ // throw new Error(`Unable to construct source with ID ${sourceId}.`);
19118
+ // no other handling for the source we don't sync into the state here
19119
+ return;
19120
+ }
18626
19121
  if (!_this.sources.has(sourceId)) {
18627
- var sourceToAdd = sources[sourceId];
18628
- if (sourceToAdd.type === "vector") {
18629
- var newSource = new FundamentalMapSource(sourceId, {
18630
- name: sourceId,
18631
- tiles: sourceToAdd.tiles,
18632
- type: "vector",
18633
- url: sourceToAdd.url
18634
- });
18635
- _this.sources.set(sourceId, newSource);
18636
- newSource._setMap(_this.map);
18637
- }
18638
- else if (sourceToAdd.type === "raster") {
18639
- var newSource = new FundamentalMapSource(sourceId, {
18640
- name: sourceId,
18641
- tiles: sourceToAdd.tiles,
18642
- type: "raster",
18643
- url: sourceToAdd.url
18644
- });
18645
- _this.sources.set(sourceId, newSource);
18646
- newSource._setMap(_this.map);
18647
- }
18648
- else {
18649
- throw new Error("Unable to construct source with ID " + sourceId + ".");
18650
- }
19122
+ _this.sources.set(sourceId, newSource);
19123
+ newSource._setMap(_this.map);
18651
19124
  }
18652
- });
18653
- Object.keys(this.sources).forEach(function (sourceId) {
18654
- if (!sources.hasOwnProperty(sourceId)) {
18655
- _this.sources.get(sourceId)._setMap(null);
18656
- _this.sources.delete(sourceId);
19125
+ else if (_this.sources.has(sourceId) && !_this.sources.get(sourceId)._isDeepEqual(newSource)) {
19126
+ // source with same id but different properties: update
19127
+ _this.sources.set(sourceId, newSource);
19128
+ newSource._setMap(_this.map, false);
18657
19129
  }
18658
19130
  });
19131
+ // counter-intuitive: below is a bug and will do nothing since Object.keys(this.sources) will always return [], it should rather be:
19132
+ // Array.from(this.sources.keys()).forEach(sourceId => {
19133
+ // however, we have seen the first party users are compensating for this with their code containing explicit azm.sources.remove but not containing the check for existing
19134
+ // such removal will cause the exception, since the source would already be removed
19135
+ //
19136
+ // given this bug was here historically, we keep the removal unfixed here (already fixed in v3) to make sure we don't cause any unintented side effects for existing users
19137
+ // Object.keys(this.sources).forEach(sourceId => {
19138
+ // if (!sources.hasOwnProperty(sourceId)) {
19139
+ // this.sources.get(sourceId)._setMap(null);
19140
+ // this.sources.delete(sourceId);
19141
+ // }
19142
+ // });
18659
19143
  }
18660
19144
  };
18661
19145
  return SourceManager;
@@ -18781,7 +19265,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
18781
19265
  };
18782
19266
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
18783
19267
  };
18784
- var __read$9 = (window && window.__read) || function (o, n) {
19268
+ var __read$a = (window && window.__read) || function (o, n) {
18785
19269
  var m = typeof Symbol === "function" && o[Symbol.iterator];
18786
19270
  if (!m) return o;
18787
19271
  var i = m.call(o), r, ar = [], e;
@@ -18797,7 +19281,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
18797
19281
  }
18798
19282
  return ar;
18799
19283
  };
18800
- var __spreadArray$3 = (window && window.__spreadArray) || function (to, from) {
19284
+ var __spreadArray$5 = (window && window.__spreadArray) || function (to, from) {
18801
19285
  for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
18802
19286
  to[j] = from[i];
18803
19287
  return to;
@@ -18872,7 +19356,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
18872
19356
  }
18873
19357
  finally { if (e_1) throw e_1.error; }
18874
19358
  }
18875
- return _super.prototype.merge.apply(this, __spreadArray$3([], __read$9(valuesList)));
19359
+ return _super.prototype.merge.apply(this, __spreadArray$5([], __read$a(valuesList)));
18876
19360
  };
18877
19361
  return CameraBoundsOptions;
18878
19362
  }(Options));
@@ -19345,7 +19829,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
19345
19829
  };
19346
19830
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
19347
19831
  };
19348
- var __read$a = (window && window.__read) || function (o, n) {
19832
+ var __read$b = (window && window.__read) || function (o, n) {
19349
19833
  var m = typeof Symbol === "function" && o[Symbol.iterator];
19350
19834
  if (!m) return o;
19351
19835
  var i = m.call(o), r, ar = [], e;
@@ -19361,7 +19845,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
19361
19845
  }
19362
19846
  return ar;
19363
19847
  };
19364
- var __spreadArray$4 = (window && window.__spreadArray) || function (to, from) {
19848
+ var __spreadArray$6 = (window && window.__spreadArray) || function (to, from) {
19365
19849
  for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
19366
19850
  to[j] = from[i];
19367
19851
  return to;
@@ -19472,7 +19956,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
19472
19956
  /**
19473
19957
  * Specifies which set of geopolitically disputed borders and labels are displayed on the map. The View parameter (also referred to as “user region parameter”) is a 2-letter ISO-3166 Country Code that will show the correct maps for that country/region. Country/Regions that are not on the View list or if unspecified will default to the “Unified” View.
19474
19958
  * Please see the supported [Views]{@link https://aka.ms/AzureMapsLocalizationViews}
19475
- * It is your responsibility to determine the location of your users, and then set the View parameter correctly for that location. The View parameter in Azure Maps must be used in compliance with applicable laws, including those regarding mapping, of the country where maps, images and other data and third party content that You are authorized to access via Azure Maps is made available.
19959
+ * It is your responsibility to determine the location of your users, and then set the View parameter correctly for that location. The View parameter in Azure Maps must be used in compliance with applicable laws, including those regarding mapping, of the country/region where maps, images and other data and third party content that You are authorized to access via Azure Maps is made available.
19476
19960
  * default: `undefined`
19477
19961
  * @default undefined
19478
19962
  */
@@ -19481,6 +19965,13 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
19481
19965
  * @deprecated use `view` instead.
19482
19966
  */
19483
19967
  _this.userRegion = _this.view;
19968
+ /**
19969
+ * allows substituting a default MapControl's style transformer with custom one
19970
+ * Default style transformer is meant to update the incoming fetched style to desired state, as well as to synchronize the SDK state with style state
19971
+ * and move additional layers over
19972
+ * @internal
19973
+ */
19974
+ _this.customStyleTransform = undefined;
19484
19975
  return _this;
19485
19976
  }
19486
19977
  /**
@@ -19520,7 +20011,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
19520
20011
  finally { if (e_1) throw e_1.error; }
19521
20012
  }
19522
20013
  // Then execute the standard merge behavior.
19523
- return _super.prototype.merge.apply(this, __spreadArray$4([], __read$a(valueList)));
20014
+ return _super.prototype.merge.apply(this, __spreadArray$6([], __read$b(valueList)));
19524
20015
  };
19525
20016
  return StyleOptions;
19526
20017
  }(Options));
@@ -19562,7 +20053,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
19562
20053
  };
19563
20054
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
19564
20055
  };
19565
- var __read$b = (window && window.__read) || function (o, n) {
20056
+ var __read$c = (window && window.__read) || function (o, n) {
19566
20057
  var m = typeof Symbol === "function" && o[Symbol.iterator];
19567
20058
  if (!m) return o;
19568
20059
  var i = m.call(o), r, ar = [], e;
@@ -19578,7 +20069,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
19578
20069
  }
19579
20070
  return ar;
19580
20071
  };
19581
- var __spreadArray$5 = (window && window.__spreadArray) || function (to, from) {
20072
+ var __spreadArray$7 = (window && window.__spreadArray) || function (to, from) {
19582
20073
  for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
19583
20074
  to[j] = from[i];
19584
20075
  return to;
@@ -19813,10 +20304,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
19813
20304
  // won't change default behavior in Options as usually that's what desired
19814
20305
  // instead capture it here and reassign.
19815
20306
  var currentTransforms = this._transformers;
19816
- var transformersToMerge = valueList ? valueList.filter(function (value) { return value !== undefined; }).reduce(function (flattened, value) { return __spreadArray$5(__spreadArray$5([], __read$b(flattened)), __read$b(value._transformers || [])); }, []) : [];
20307
+ var transformersToMerge = valueList ? valueList.filter(function (value) { return value !== undefined; }).reduce(function (flattened, value) { return __spreadArray$7(__spreadArray$7([], __read$c(flattened)), __read$c(value._transformers || [])); }, []) : [];
19817
20308
  // Then execute the standard merge behavior.
19818
20309
  // If subscription key auth method isn't being used then the subscription key property should be undefined.
19819
- var merged = _super.prototype.merge.apply(this, __spreadArray$5([], __read$b(valueList)));
20310
+ var merged = _super.prototype.merge.apply(this, __spreadArray$7([], __read$c(valueList)));
19820
20311
  if (merged.authOptions.authType !== exports.AuthenticationType.subscriptionKey) {
19821
20312
  merged["subscription-key"] = merged.subscriptionKey = undefined;
19822
20313
  }
@@ -19828,7 +20319,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
19828
20319
  if (merged.mapConfiguration && typeof merged.mapConfiguration !== 'string') {
19829
20320
  merged.mapConfiguration = __assign$7(__assign$7({}, merged.mapConfiguration), { defaultConfiguration: merged.mapConfiguration.defaultConfiguration || merged.mapConfiguration['defaultStyle'], configurations: merged.mapConfiguration.configurations || merged.mapConfiguration['styles'] });
19830
20321
  }
19831
- this._transformers = __spreadArray$5(__spreadArray$5([], __read$b(currentTransforms || [])), __read$b(transformersToMerge.filter(function (toMerge) { return !currentTransforms.includes(toMerge); })));
20322
+ this._transformers = __spreadArray$7(__spreadArray$7([], __read$c(currentTransforms || [])), __read$c(transformersToMerge.filter(function (toMerge) { return !currentTransforms.includes(toMerge); })));
19832
20323
  if (this.transformRequest && !this._transformers.includes(this.transformRequest)) {
19833
20324
  this._transformers.push(this.transformRequest);
19834
20325
  }
@@ -20024,7 +20515,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
20024
20515
  };
20025
20516
  return __assign$8.apply(this, arguments);
20026
20517
  };
20027
- var __awaiter$2 = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
20518
+ var __awaiter$3 = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
20028
20519
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
20029
20520
  return new (P || (P = Promise))(function (resolve, reject) {
20030
20521
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -20033,7 +20524,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
20033
20524
  step((generator = generator.apply(thisArg, _arguments || [])).next());
20034
20525
  });
20035
20526
  };
20036
- var __generator$2 = (window && window.__generator) || function (thisArg, body) {
20527
+ var __generator$3 = (window && window.__generator) || function (thisArg, body) {
20037
20528
  var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
20038
20529
  return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
20039
20530
  function verb(n) { return function (v) { return step([n, v]); }; }
@@ -20060,7 +20551,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
20060
20551
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
20061
20552
  }
20062
20553
  };
20063
- var __read$c = (window && window.__read) || function (o, n) {
20554
+ var __read$d = (window && window.__read) || function (o, n) {
20064
20555
  var m = typeof Symbol === "function" && o[Symbol.iterator];
20065
20556
  if (!m) return o;
20066
20557
  var i = m.call(o), r, ar = [], e;
@@ -20076,7 +20567,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
20076
20567
  }
20077
20568
  return ar;
20078
20569
  };
20079
- var __spreadArray$6 = (window && window.__spreadArray) || function (to, from) {
20570
+ var __spreadArray$8 = (window && window.__spreadArray) || function (to, from) {
20080
20571
  for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
20081
20572
  to[j] = from[i];
20082
20573
  return to;
@@ -20103,6 +20594,13 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
20103
20594
  * Preserve the map configuration that was used before the indoor map configuration was set
20104
20595
  */
20105
20596
  this.preservedPreindoorMapConfiguration = undefined;
20597
+ /**
20598
+ * The state of the progressive loading
20599
+ */
20600
+ this._progressiveLoadingState = {
20601
+ mapStyle: undefined,
20602
+ pendingVisibilityChange: undefined,
20603
+ };
20106
20604
  this._deferLayerGroupVisibilities = function (layerGroupLayers, initLayerGroups) {
20107
20605
  var validInitLayerGroups = initLayerGroups.filter(function (groupName) { return groupName in layerGroupLayers; });
20108
20606
  // If the initial layer groups are invalid, skip the progressive loading.
@@ -20110,11 +20608,19 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
20110
20608
  return;
20111
20609
  var map = _this.map._getMap();
20112
20610
  var currentZoomLevel = map.getZoom();
20113
- // Select the layers to be deferred
20611
+ var currentMapStyle = _this.map.getStyle().style;
20612
+ // Cancel and release previous pending callback, if any.
20613
+ if (_this._progressiveLoadingState.pendingVisibilityChange) {
20614
+ _this.map.events.remove('load', _this._progressiveLoadingState.pendingVisibilityChange);
20615
+ _this._progressiveLoadingState.pendingVisibilityChange = null;
20616
+ }
20617
+ // Keep the current map style for future comparison.
20618
+ _this._progressiveLoadingState.mapStyle = currentMapStyle;
20619
+ // Select deferrable layers
20114
20620
  var deferredLayers = Object.entries(layerGroupLayers).reduce(function (deferred, _a) {
20115
- var _b = __read$c(_a, 2), groupName = _b[0], layers = _b[1];
20621
+ var _b = __read$d(_a, 2), groupName = _b[0], layers = _b[1];
20116
20622
  var isInInitialLayerGroup = validInitLayerGroups.includes(groupName);
20117
- return __spreadArray$6(__spreadArray$6([], __read$c(deferred)), __read$c(layers.filter(function (layer) {
20623
+ return __spreadArray$8(__spreadArray$8([], __read$d(deferred)), __read$d(layers.filter(function (layer) {
20118
20624
  var _a;
20119
20625
  // Exclude custom layers
20120
20626
  if (layer.type === 'custom')
@@ -20137,30 +20643,40 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
20137
20643
  return false;
20138
20644
  }
20139
20645
  }
20140
- // Defer visible layers only.
20646
+ // Select visible layers only.
20141
20647
  return ((_a = layer.layout) === null || _a === void 0 ? void 0 : _a.visibility) !== 'none';
20142
20648
  })));
20143
20649
  }, []);
20144
- // Hide the deferred layers at initial load, therefore we can save the render time.
20650
+ // Hide the deferrable layers at initial load, therefore we can save the render time.
20145
20651
  deferredLayers.forEach(function (layer) {
20652
+ // Since this happens before sending style object into the map rendering,
20653
+ // we only need to update the style object, but not necessary to update maplibre's layout properties.
20146
20654
  layer.layout = layer.layout || {};
20147
20655
  layer.layout.visibility = 'none';
20148
20656
  });
20149
- // Make the deferred layers visible once the map instance is fully loaded
20150
- _this.map.events.addOnce('load', function () {
20657
+ // Make the deferred layers visible once the map instance is fully loaded.
20658
+ _this._progressiveLoadingState.pendingVisibilityChange = function () {
20659
+ // Release the callback.
20660
+ _this._progressiveLoadingState.pendingVisibilityChange = null;
20661
+ // Bail out the callback once map style has changed.
20662
+ var nextMapStyle = _this.map.getStyle().style;
20663
+ if (currentMapStyle !== nextMapStyle)
20664
+ return;
20665
+ // Make deferred layers visible
20151
20666
  deferredLayers.forEach(function (layer) {
20667
+ // This happens after the map rendering; Therefore, we need to update
20668
+ // both the style object and the maplibre's layout properties.
20152
20669
  layer.layout.visibility = 'visible';
20153
20670
  map.setLayoutProperty(layer.id, 'visibility', 'visible');
20154
20671
  });
20155
- });
20672
+ };
20673
+ _this.map.events.addOnce('load', _this._progressiveLoadingState.pendingVisibilityChange);
20156
20674
  };
20157
- this._onStyleData = function () {
20158
- _this._lookUpAsync(_this.map.getStyle()).then(function (style) {
20159
- _this.map.events.invoke("stylechanged", {
20160
- style: style.name,
20161
- map: _this.map,
20162
- type: "stylechanged"
20163
- });
20675
+ this._onStyleData = function (definition) {
20676
+ _this.map.events.invoke("stylechanged", {
20677
+ style: definition.name,
20678
+ map: _this.map,
20679
+ type: "stylechanged"
20164
20680
  });
20165
20681
  };
20166
20682
  /**
@@ -20183,9 +20699,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
20183
20699
  || definitions.configurations[0];
20184
20700
  }
20185
20701
  };
20186
- this._lookUpAsync = function (options) { return __awaiter$2(_this, void 0, void 0, function () {
20702
+ this._lookUpAsync = function (options) { return __awaiter$3(_this, void 0, void 0, function () {
20187
20703
  var definitions, result;
20188
- return __generator$2(this, function (_a) {
20704
+ return __generator$3(this, function (_a) {
20189
20705
  switch (_a.label) {
20190
20706
  case 0: return [4 /*yield*/, this.definitions()];
20191
20707
  case 1:
@@ -20267,7 +20783,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
20267
20783
  return baseName in styleNamesMap ? styleNamesMap[baseName] : baseName;
20268
20784
  };
20269
20785
  if (!this.serviceOptions.mapConfiguration) {
20270
- newPromise = new HijackablePromise(this._request(this.serviceOptions.staticAssetsDomain, constants.stylePath + "/" + constants.styleResourcePath, "StyleDefinitions", { version: this.serviceOptions.styleDefinitionsVersion }).then(function (definitions) { return ({
20786
+ var ensureAuthentication = this.map.authentication ? this.map.authentication.initialize() : Promise.resolve();
20787
+ newPromise = new HijackablePromise(ensureAuthentication.then(function () { return _this._request(_this.serviceOptions.staticAssetsDomain, constants.stylePath + "/" + constants.styleResourcePath, "StyleDefinitions", { version: _this.serviceOptions.styleDefinitionsVersion }).then(function (definitions) { return ({
20271
20788
  version: isNaN(definitions.version) ? 0 : parseFloat(definitions.version),
20272
20789
  defaultConfiguration: definitions.defaultStyle,
20273
20790
  configurations: definitions.styles
@@ -20294,19 +20811,25 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
20294
20811
  domain: _this.serviceOptions.staticAssetsDomain,
20295
20812
  path: constants.stylePath + "/" + constants.styleResourcePath + "/" + style.name,
20296
20813
  queryParams: {
20297
- styleVersion: _this.serviceOptions.styleDefinitionsVersion,
20814
+ // Use the style version from the API response if it's available,
20815
+ // otherwise fallback to the version specified in the serviceOptions.
20816
+ // This is needed for flight testing the 2023-01-01 style version.
20817
+ styleVersion: definitions.version !== undefined && definitions.version !== null
20818
+ ? definitions.version
20819
+ : _this.serviceOptions.styleDefinitionsVersion
20298
20820
  // thus far we don't need to differentiate based on parameter here, as stylePatch will be called on cached styles as well
20299
20821
  //language: styleOptions.language
20300
20822
  },
20301
20823
  protocol: "https"
20302
20824
  }).toString(),
20303
20825
  }); })
20304
- }); }));
20826
+ }); }); }));
20305
20827
  }
20306
20828
  else if (typeof this.serviceOptions.mapConfiguration === 'string') {
20307
- newPromise = new HijackablePromise(this._request(this.serviceOptions.domain, constants.styleResourcePath + "/mapconfigurations/metadata/" + this.serviceOptions.mapConfiguration, "StyleDefinitions"
20829
+ var ensureAuthentication = this.map.authentication ? this.map.authentication.initialize() : Promise.resolve();
20830
+ newPromise = new HijackablePromise(ensureAuthentication.then(function () { return _this._request(_this.serviceOptions.domain, constants.styleResourcePath + "/mapconfigurations/metadata/" + _this.serviceOptions.mapConfiguration, "StyleDefinitions"
20308
20831
  // reassign properties from legacy mapConfiguration to new structure if needed
20309
- ).then(function (definitions) { return (__assign$8(__assign$8({}, definitions), { defaultConfiguration: definitions.defaultConfiguration || definitions['defaultStyle'], configurations: definitions.configurations || definitions['styles'] })); }));
20832
+ ).then(function (definitions) { return (__assign$8(__assign$8({}, definitions), { defaultConfiguration: definitions.defaultConfiguration || definitions['defaultStyle'], configurations: definitions.configurations || definitions['styles'] })); }); }));
20310
20833
  }
20311
20834
  else {
20312
20835
  newPromise = HijackablePromise.resolve(this.serviceOptions.mapConfiguration);
@@ -20337,23 +20860,183 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
20337
20860
  if (styleDefinition.style) {
20338
20861
  return styleDefinition.style;
20339
20862
  }
20340
- throw Error("Style definition does not contain neither URL nor style object.");
20863
+ throw Error("Style definition neither contains URL nor style object.");
20864
+ };
20865
+ StyleManager.prototype.deriveNewStyleAndLayerGroups = function (previousStyle, nextStyle) {
20866
+ var _a, _b, _c, _d, _e, _f;
20867
+ // Layers in the next style with default properties that do not align with current StyleOptions
20868
+ // should be modified before they are applied to the map.
20869
+ var styleOptions = this.map.getStyle();
20870
+ var trafficOptions = this.map.getTraffic();
20871
+ var layersGroups = {};
20872
+ for (var i = 0; i < nextStyle.layers.length; i++) {
20873
+ var nextLayer = nextStyle.layers[i];
20874
+ var layerGroup = LayerGroupComparator.getLayerGroup(nextLayer);
20875
+ if (!layerGroup) {
20876
+ layersGroups[nextLayer.id] = [nextLayer];
20877
+ continue;
20878
+ }
20879
+ if (!layersGroups[layerGroup]) {
20880
+ layersGroups[layerGroup] = [];
20881
+ }
20882
+ var layerGroupLayers = layersGroups[layerGroup];
20883
+ layerGroupLayers.push(nextLayer);
20884
+ // 1. Set visiblity of fill-extrusion layers according to StyleOptions.showBuildingModels
20885
+ if (!styleOptions.showBuildingModels && nextLayer.type === "fill-extrusion") {
20886
+ nextLayer.layout = (_a = nextLayer.layout) !== null && _a !== void 0 ? _a : {};
20887
+ nextLayer.layout.visibility = "none";
20888
+ }
20889
+ else if (nextLayer.type === "fill-extrusion") {
20890
+ nextLayer.layout = (_b = nextLayer.layout) !== null && _b !== void 0 ? _b : {};
20891
+ nextLayer.layout.visibility = "visible";
20892
+ }
20893
+ // 2. Set visibility of traffic layers depending on traffic settings.
20894
+ if (trafficOptions.flow !== "none" && layerGroup) {
20895
+ if (layerGroup === "traffic_" + trafficOptions.flow && nextLayer.type == "line") {
20896
+ nextLayer.layout = (_c = nextLayer.layout) !== null && _c !== void 0 ? _c : {};
20897
+ nextLayer.layout.visibility = "visible";
20898
+ }
20899
+ }
20900
+ // 3. Set visibility of labels
20901
+ var isLabelLayerGroup = layerGroup === 'labels' || layerGroup === 'labels_places' || layerGroup === 'labels_indoor';
20902
+ if (isLabelLayerGroup && nextLayer.type === 'symbol') {
20903
+ if (styleOptions.showLabels && ((_d = nextLayer.layout) === null || _d === void 0 ? void 0 : _d.visibility) !== "none") {
20904
+ nextLayer.layout = (_e = nextLayer.layout) !== null && _e !== void 0 ? _e : {};
20905
+ nextLayer.layout.visibility = "visible";
20906
+ }
20907
+ else {
20908
+ nextLayer.layout = (_f = nextLayer.layout) !== null && _f !== void 0 ? _f : {};
20909
+ nextLayer.layout.visibility = "none";
20910
+ }
20911
+ }
20912
+ }
20913
+ return [nextStyle, layersGroups];
20914
+ };
20915
+ StyleManager.prototype.injectUserLayersIntoStyle = function (previousStyle, nextStyle, layerGroupLayers) {
20916
+ // Custom layers added to mapbox through this SDK should be carried over to the next style.
20917
+ return !previousStyle
20918
+ ? nextStyle
20919
+ : this.map.layers._getUserLayers().reduce(function (style, userLayer) {
20920
+ if (userLayer.layer instanceof WebGLLayer) {
20921
+ // mapbox custom layers cannot be serialized and preserved,
20922
+ // return to continue to the next user layer.
20923
+ return style;
20924
+ }
20925
+ var before = layerGroupLayers[userLayer.before] && layerGroupLayers[userLayer.before].length > 0
20926
+ ? layerGroupLayers[userLayer.before][0]
20927
+ : undefined;
20928
+ var layer = previousStyle.layers.find(function (layer) { return layer.id === userLayer.layer.getId(); });
20929
+ // when setStyle diff attempt is unsuccesful, _load will be called on the style that may have already injected user layers -> clean it up
20930
+ var existingLayerIdx = nextStyle.layers.findIndex(function (layer) { return layer.id === userLayer.layer.getId(); });
20931
+ if (existingLayerIdx > -1) {
20932
+ nextStyle.layers.splice(existingLayerIdx, 1);
20933
+ }
20934
+ if (layer) {
20935
+ var sourcesToCopy = new Set(Array.from(userLayer.layer._getSourceIds())
20936
+ .map(function (sourceId) { return previousStyle.sources[sourceId] ? { source: previousStyle.sources[sourceId], id: sourceId } : undefined; })
20937
+ .filter(function (source) { return source !== undefined; }));
20938
+ var insertIdx = before ? style.layers.findIndex(function (layer) { return layer.id === before.id; }) : -1;
20939
+ if (insertIdx > -1) {
20940
+ style.layers.splice(insertIdx, 0, layer);
20941
+ }
20942
+ else {
20943
+ style.layers.push(layer);
20944
+ }
20945
+ sourcesToCopy.forEach(function (_a) {
20946
+ var source = _a.source, id = _a.id;
20947
+ style.sources[id] = source;
20948
+ });
20949
+ }
20950
+ return style;
20951
+ }, __assign$8({}, nextStyle));
20341
20952
  };
20342
20953
  /**
20343
20954
  * @internal
20344
20955
  */
20345
20956
  StyleManager.prototype.setStyle = function (styleOptions, diff) {
20957
+ var _this = this;
20346
20958
  if (diff === void 0) { diff = true; }
20347
- try {
20348
- this.map._getMap().setStyle(this.getStyle(styleOptions), {
20349
- diff: diff,
20350
- stylePatch: this._stylePatch.bind(this),
20351
- validate: this.serviceOptions.validateStyle
20352
- });
20959
+ var transformStyleFunc;
20960
+ var targetDefinition = this._lookUp(styleOptions);
20961
+ if (!targetDefinition) {
20962
+ throw Error("Style definition " + styleOptions.style + " is not available.");
20963
+ }
20964
+ if (!targetDefinition.url && !targetDefinition.style) {
20965
+ throw Error("Style definition neither contains URL nor style object.");
20966
+ }
20967
+ var styleDataCallback = function () { return _this._onStyleData(targetDefinition); };
20968
+ var patchStyleEvent = function () {
20969
+ // FIXME: below diffing will be soon fixed on the maplibre side
20970
+ // If there was a previous styledata change event attached, remove it.
20971
+ // When the sprite url changes between style changes then maplibre can't perform the diff
20972
+ // In such cases it recalculate the style again. Removing previous attached
20973
+ // event listener makes sure that style changed event is not fired twice in these cases.
20974
+ _this.map.events.remove("styledata", styleDataCallback);
20975
+ _this.map.events.addOnce("styledata", styleDataCallback);
20976
+ };
20977
+ if (styleOptions && styleOptions.customStyleTransform) {
20978
+ transformStyleFunc = function (prev, next) {
20979
+ var target = styleOptions.customStyleTransform(prev, next);
20980
+ patchStyleEvent();
20981
+ return target;
20982
+ };
20353
20983
  }
20354
- catch (e) {
20355
- throw e;
20984
+ else {
20985
+ transformStyleFunc = function (previousStyle, style) {
20986
+ // make sure we always have a shallow clone to prevent mutating explicit json(rather then url) styles being set
20987
+ var nextStyle = __assign$8(__assign$8({}, style), { layers: __spreadArray$8([], __read$d(style.layers)), sources: __assign$8({}, style.sources) });
20988
+ var shouldProgressiveLoading = (styleOptions.progressiveLoading &&
20989
+ // The feature only effective at the initial load.
20990
+ !_this.map._isLoaded());
20991
+ // Shallow-clone the style object and duplicate layer.layout properties to avoid side-effects.
20992
+ if (shouldProgressiveLoading && Array.isArray(style === null || style === void 0 ? void 0 : style.layers)) {
20993
+ nextStyle = __assign$8({}, style);
20994
+ nextStyle.layers = nextStyle.layers.map(function (layer) {
20995
+ var nextLayer = __assign$8({}, layer);
20996
+ if (layer.layout) {
20997
+ nextLayer.layout = __assign$8({}, layer.layout);
20998
+ }
20999
+ return nextLayer;
21000
+ });
21001
+ }
21002
+ // 1. derive the base new style (without user layers) and layer groups
21003
+ var _a = __read$d(_this.deriveNewStyleAndLayerGroups(previousStyle, nextStyle), 2), targetStyle = _a[0], layerGroupLayers = _a[1];
21004
+ // 2. side effect: progressively render map layers to the canvas to shorten the time to the first meaningful render.
21005
+ if (shouldProgressiveLoading) {
21006
+ var initLayerGroups = styleOptions.progressiveLoadingInitialLayerGroups;
21007
+ if (Array.isArray(initLayerGroups) && initLayerGroups.length > 0) {
21008
+ _this._deferLayerGroupVisibilities(layerGroupLayers, initLayerGroups);
21009
+ }
21010
+ }
21011
+ // 3. copy user layers and sources from previous style into new one
21012
+ var targetStyleWithUserLayers = _this.injectUserLayersIntoStyle(previousStyle, targetStyle, layerGroupLayers);
21013
+ // 4. side effects: sync our control's LayerManager and SourceManager
21014
+ var nextFundamentalLayers = Object.entries(layerGroupLayers).map(function (_a) {
21015
+ var _b = __read$d(_a, 2), layerGroupId = _b[0], layers = _b[1];
21016
+ return _this._buildFundamentalLayerFrom(layers, layerGroupId);
21017
+ });
21018
+ var layerIndex = _this.map.layers._getUserLayers().reduce(function (layerIndex, userLayer) {
21019
+ var layerInsertIndex = userLayer.before ? layerIndex.findIndex(function (layer) { return layer.getId() === userLayer.before; }) : -1;
21020
+ if (layerInsertIndex > -1) {
21021
+ layerIndex.splice(layerInsertIndex, 0, userLayer.layer);
21022
+ }
21023
+ else {
21024
+ layerIndex.push(userLayer.layer);
21025
+ }
21026
+ return layerIndex;
21027
+ }, nextFundamentalLayers);
21028
+ _this.map.layers['layerIndex'] = layerIndex;
21029
+ _this.map.sources._syncSources(targetStyleWithUserLayers.sources);
21030
+ // 5. temporarily patch style data event
21031
+ patchStyleEvent();
21032
+ return targetStyleWithUserLayers;
21033
+ };
20356
21034
  }
21035
+ this.map._getMap().setStyle(targetDefinition.url || targetDefinition.style, {
21036
+ diff: diff,
21037
+ validate: this.serviceOptions.validateStyle,
21038
+ transformStyle: transformStyleFunc
21039
+ });
20357
21040
  };
20358
21041
  /**
20359
21042
  * Gets the color theme (light/dark) for the style type specified by the style options.
@@ -20366,8 +21049,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
20366
21049
  return style.theme.toLowerCase();
20367
21050
  };
20368
21051
  StyleManager.prototype.getThemeAsync = function (styleOptions) {
20369
- return __awaiter$2(this, void 0, void 0, function () {
20370
- return __generator$2(this, function (_a) {
21052
+ return __awaiter$3(this, void 0, void 0, function () {
21053
+ return __generator$3(this, function (_a) {
20371
21054
  switch (_a.label) {
20372
21055
  case 0: return [4 /*yield*/, this._lookUpAsync(styleOptions)];
20373
21056
  case 1: return [2 /*return*/, (_a.sent()).theme];
@@ -20418,145 +21101,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
20418
21101
  StyleManager.prototype.clearStyleSet = function () {
20419
21102
  this.unsetIndoorState();
20420
21103
  };
20421
- /**
20422
- * Function invoked by mapbox after a style is fetched but before it is committed to the map state.
20423
- *
20424
- * @param previousStyle The current style.
20425
- * @param nextStyle The next style which is to be applied.
20426
- * @param preserveLayer Preserve a layer from the previous style in the next style.
20427
- * @param updatePaintProperty Modify paint properties of a layer in the next style before the style is applied.
20428
- * @param updateLayoutProperty Modify layout properties of a layer in the next style before the style is applied.
20429
- * @param updateFilter Modify filter property of a layer in the next style before the style is applied.
20430
- */
20431
- StyleManager.prototype._stylePatch = function (previousStyle, nextStyle, preserveLayer, updatePaintProperty, updateLayoutProperty, updateFilter) {
20432
- var _this = this;
20433
- // Layers in the next style with default properties that do not align with current StyleOptions
20434
- // should be modified before they are applied to the map.
20435
- var styleOptions = this.map.getStyle();
20436
- var trafficOptions = this.map.getTraffic();
20437
- // force a replacement of language placeholder in the tileset url to avoid resolution to a same cache with placeholders on language change
20438
- nextStyle.sources = Object.entries(nextStyle.sources).reduce(function (newSources, _a) {
20439
- var _b = __read$c(_a, 2), sourceKey = _b[0], source = _b[1];
20440
- var newSource = __assign$8({}, source);
20441
- if ('url' in newSource && typeof newSource.url === 'string') {
20442
- if (newSource.url.includes(constants.languagePlaceHolder)) {
20443
- newSource.url = newSource.url.replace(constants.languagePlaceHolder, styleOptions.language);
20444
- }
20445
- }
20446
- newSources[sourceKey] = newSource;
20447
- return newSources;
20448
- }, {});
20449
- var shouldProgressiveLoading = (styleOptions.progressiveLoading &&
20450
- // The feature only effective at the initial load.
20451
- !this.map._isLoaded());
20452
- var setLayerVisibility = function (layer, visibility) {
20453
- var _a;
20454
- if (!shouldProgressiveLoading) {
20455
- // No need to apply the visibility change to maplibre while progressive loading is enabled.
20456
- // This can save a lot of CPU time.
20457
- updateLayoutProperty(layer.id, 'visibility', visibility);
20458
- }
20459
- layer.layout = (_a = layer.layout) !== null && _a !== void 0 ? _a : {};
20460
- layer.layout.visibility = visibility;
20461
- };
20462
- var layerGroupLayers = {};
20463
- nextStyle.layers.forEach(function (nextLayer) {
20464
- var _a;
20465
- var layerGroup = LayerGroupComparator.getLayerGroup(nextLayer);
20466
- if (layerGroup) {
20467
- // Set visibility of fill-extrusion layers according to StyleOptions.showBuildingModels
20468
- if (nextLayer.type === 'fill-extrusion') {
20469
- setLayerVisibility(nextLayer, styleOptions.showBuildingModels ? 'visible' : 'none');
20470
- }
20471
- // Set visibility of traffic layers depending on traffic settings.
20472
- if (trafficOptions.flow !== 'none' &&
20473
- layerGroup === "traffic_" + trafficOptions.flow &&
20474
- nextLayer.type == 'line') {
20475
- setLayerVisibility(nextLayer, 'visible');
20476
- }
20477
- // Set visibility of labels
20478
- var isLabelLayerGroup = layerGroup === 'labels' || layerGroup === 'labels_places' || layerGroup === 'labels_indoor';
20479
- if (isLabelLayerGroup && nextLayer.type === 'symbol') {
20480
- var isLayerVisible = ((_a = nextLayer.layout) === null || _a === void 0 ? void 0 : _a.visibility) !== 'none';
20481
- setLayerVisibility(nextLayer, isLayerVisible && styleOptions.showLabels ? 'visible' : 'none');
20482
- }
20483
- // Once this _stylePatch returns control to maplibre the next style will be applied immediately in the same context.
20484
- // To avoid potential data races update LayerManager with new a new set of FundamentalMapLayers from here instead of
20485
- // waiting for a styledata.load event to trigger a sync in a different context.
20486
- if (layerGroupLayers[layerGroup]) {
20487
- layerGroupLayers[layerGroup].push(nextLayer);
20488
- }
20489
- else {
20490
- layerGroupLayers[layerGroup] = [nextLayer];
20491
- }
20492
- }
20493
- });
20494
- if (shouldProgressiveLoading) {
20495
- var initLayerGroups = styleOptions.progressiveLoadingInitialLayerGroups;
20496
- if (Array.isArray(initLayerGroups) && initLayerGroups.length > 0) {
20497
- this._deferLayerGroupVisibilities(layerGroupLayers, initLayerGroups);
20498
- }
20499
- }
20500
- // A FundamentalMapLayer (grouped layer) representation of the next style must be built.
20501
- var previousLayers = this.map.layers.getLayers();
20502
- var nextLayers = Object.entries(layerGroupLayers).map(function (_a) {
20503
- var _b = __read$c(_a, 2), layerGroupName = _b[0], layerGroupMapboxLayers = _b[1];
20504
- return _this._buildFundamentalLayerFrom(layerGroupMapboxLayers, layerGroupName);
20505
- });
20506
- // Update FundamentalMapLayers in LayerManager
20507
- var userLayers = this.map.layers._getUserLayers();
20508
- var layersToRemove = previousLayers.filter(function (c) {
20509
- return (nextLayers.findIndex(function (n) { return c.getId() === n.getId(); }) < 0 &&
20510
- userLayers.findIndex(function (n) { return c.getId() === n.layer.getId(); }) < 0);
20511
- });
20512
- var prevNextIntersection = nextLayers.filter(function (n) { return previousLayers.find(function (c) { return c.getId() === n.getId(); }); });
20513
- var ePrevNextIntersection = prevNextIntersection.entries();
20514
- var replace = ePrevNextIntersection.next();
20515
- nextLayers.forEach(function (newFundamentalLayer) {
20516
- if (replace.value && replace.value[1].getId() === newFundamentalLayer.getId()) {
20517
- // Replace the existing layer with this ID with the new one.
20518
- var insertBefore = previousLayers.findIndex(function (l) { return l.getId() === newFundamentalLayer.getId(); });
20519
- _this.map.layers.remove(newFundamentalLayer.getId());
20520
- _this.map.layers.add(newFundamentalLayer, previousLayers[insertBefore].getId());
20521
- replace = ePrevNextIntersection.next();
20522
- }
20523
- else {
20524
- if (replace.value) {
20525
- // Insert new layer before the next common layer.
20526
- _this.map.layers.add(newFundamentalLayer, replace.value[1]);
20527
- }
20528
- else {
20529
- _this.map.layers.add(newFundamentalLayer);
20530
- }
20531
- }
20532
- });
20533
- layersToRemove.forEach(function (layer) {
20534
- _this.map.layers.remove(layer);
20535
- });
20536
- // Layers added to mapbox through this SDK since loading the last style should be
20537
- // carried over to the next style.
20538
- userLayers.forEach(function (userLayer) {
20539
- if (userLayer.layer instanceof WebGLLayer) {
20540
- // mapbox custom layers cannot be serialized and preserved,
20541
- // return to continue to the next user layer.
20542
- return;
20543
- }
20544
- var before = undefined;
20545
- if (_this.map.layers.getLayerById(userLayer.before)) {
20546
- var beforeCandidates = _this.map.layers.getLayerById(userLayer.before)._buildLayers();
20547
- before = (beforeCandidates.length > 0) ? beforeCandidates[0] : undefined;
20548
- }
20549
- preserveLayer(userLayer.layer.getId(), before === null || before === void 0 ? void 0 : before.id);
20550
- _this.map.layers.move(userLayer.layer, userLayer.before);
20551
- });
20552
- this.map.sources._syncSources(nextStyle.sources);
20553
- // If there was a previous styledata change event attached, remove it.
20554
- // When the sprite url changes between style changes then mapbox can't perform the diff
20555
- // In such cases it recalculate the style again. Removing previous attached
20556
- // event listener makes sure that style changed event is not fired twice in these cases.
20557
- this.map.events.remove("styledata", this._onStyleData);
20558
- this.map.events.addOnce("styledata", this._onStyleData);
20559
- };
20560
21104
  StyleManager.prototype._buildFundamentalLayerFrom = function (layers, id) {
20561
21105
  if (layers && layers.length > 0) {
20562
21106
  var newLayer = new FundamentalMapLayer(layers, id);
@@ -20597,27 +21141,30 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
20597
21141
  * Fetches a json resource at the specified domain and path.
20598
21142
  */
20599
21143
  StyleManager.prototype._request = function (domain, path, resourceType, customQueryParams) {
20600
- var _a;
21144
+ var _a, _b;
20601
21145
  if (customQueryParams === void 0) { customQueryParams = {}; }
20602
- return __awaiter$2(this, void 0, void 0, function () {
21146
+ return __awaiter$3(this, void 0, void 0, function () {
20603
21147
  var requestParams, fetchOptions;
20604
- var _b;
20605
- return __generator$2(this, function (_c) {
20606
- switch (_c.label) {
21148
+ var _c;
21149
+ return __generator$3(this, function (_d) {
21150
+ switch (_d.label) {
20607
21151
  case 0:
20608
21152
  requestParams = {
20609
21153
  url: new Url({
20610
21154
  protocol: "https",
20611
21155
  domain: domain,
20612
21156
  path: path,
20613
- queryParams: __assign$8((_b = {}, _b[constants.apiVersionQueryParameter] = this.serviceOptions.styleAPIVersion, _b), customQueryParams)
21157
+ queryParams: __assign$8((_c = {}, _c[constants.apiVersionQueryParameter] = this.serviceOptions.styleAPIVersion,
21158
+ // Generate a hash code to avoid cache conflict
21159
+ // TODO: Remove this once style version 2023-01-01 is publicly available
21160
+ _c.hash = StyleManager._hashCode((_a = this.map.authentication) === null || _a === void 0 ? void 0 : _a.getToken()), _c), customQueryParams)
20614
21161
  }).toString()
20615
21162
  };
20616
21163
  if (typeof this.serviceOptions.transformRequest === "function" && resourceType) {
20617
21164
  // If a transformRequest(...) was specified use it.
20618
21165
  requestParams = this.serviceOptions.transformRequest(requestParams.url, resourceType);
20619
21166
  }
20620
- (_a = this.map.authentication) === null || _a === void 0 ? void 0 : _a.signRequest(requestParams);
21167
+ (_b = this.map.authentication) === null || _b === void 0 ? void 0 : _b.signRequest(requestParams);
20621
21168
  fetchOptions = {
20622
21169
  method: "GET",
20623
21170
  mode: "cors",
@@ -20634,11 +21181,26 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
20634
21181
  throw new Error("HTTP " + response.status + ": " + response.statusText + " ");
20635
21182
  }
20636
21183
  })];
20637
- case 1: return [2 /*return*/, _c.sent()];
21184
+ case 1: return [2 /*return*/, _d.sent()];
20638
21185
  }
20639
21186
  });
20640
21187
  });
20641
21188
  };
21189
+ /**
21190
+ * A basic helper function to generate a hash from an input string.
21191
+ */
21192
+ StyleManager._hashCode = function (str) {
21193
+ if (str === void 0) { str = ""; }
21194
+ var chr, hash = 0;
21195
+ if (!str)
21196
+ return hash;
21197
+ for (var i = 0; i < str.length; i++) {
21198
+ chr = str.charCodeAt(i);
21199
+ hash = (hash << 5) - hash + chr;
21200
+ hash |= 0; // Convert to 32bit integer
21201
+ }
21202
+ return hash;
21203
+ };
20642
21204
  return StyleManager;
20643
21205
  }());
20644
21206
 
@@ -20647,6 +21209,123 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
20647
21209
  */
20648
21210
  var isHMREnabled = function () { return 'ENVIRONMENT' in window && !!window['ENVIRONMENT']['hmr']; };
20649
21211
 
21212
+ var __values$j = (window && window.__values) || function(o) {
21213
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
21214
+ if (m) return m.call(o);
21215
+ if (o && typeof o.length === "number") return {
21216
+ next: function () {
21217
+ if (o && i >= o.length) o = void 0;
21218
+ return { value: o && o[i++], done: !o };
21219
+ }
21220
+ };
21221
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
21222
+ };
21223
+ /**
21224
+ * @internal
21225
+ * A manager for the map control's hidden indicators.
21226
+ * Exposed through the `indicators` property of the `atlas.Map` class.
21227
+ * Cannot be instantiated by the user.
21228
+ */
21229
+ var AccessibleIndicatorManager = /** @class */ (function () {
21230
+ /**
21231
+ * Constructs the indicator manager to be exposed only through the `indicators` property of the `Map` class.
21232
+ * @param map The map whose indicators are being managed by this.
21233
+ * @internal
21234
+ */
21235
+ function AccessibleIndicatorManager(map) {
21236
+ this.map = map;
21237
+ this.indicators = new Set();
21238
+ }
21239
+ /**
21240
+ * Adds an indicator to the map
21241
+ * @param indicator The indicator(s) to add.
21242
+ */
21243
+ AccessibleIndicatorManager.prototype.add = function (indicator) {
21244
+ var e_1, _a;
21245
+ indicator = Array.isArray(indicator) ? indicator : [indicator];
21246
+ try {
21247
+ for (var indicator_1 = __values$j(indicator), indicator_1_1 = indicator_1.next(); !indicator_1_1.done; indicator_1_1 = indicator_1.next()) {
21248
+ var i = indicator_1_1.value;
21249
+ if (!this.indicators.has(i)) {
21250
+ this.indicators.add(i);
21251
+ i.attach(this.map);
21252
+ }
21253
+ }
21254
+ }
21255
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
21256
+ finally {
21257
+ try {
21258
+ if (indicator_1_1 && !indicator_1_1.done && (_a = indicator_1.return)) _a.call(indicator_1);
21259
+ }
21260
+ finally { if (e_1) throw e_1.error; }
21261
+ }
21262
+ };
21263
+ /**
21264
+ * Removes all indicators from the map.
21265
+ */
21266
+ AccessibleIndicatorManager.prototype.clear = function () {
21267
+ var _this = this;
21268
+ this.indicators.forEach(function (indicator) {
21269
+ _this.indicators.delete(indicator);
21270
+ indicator.remove();
21271
+ });
21272
+ };
21273
+ /**
21274
+ * Removes an indicator from the map
21275
+ * @param indicator The indicator(s) to remove.
21276
+ */
21277
+ AccessibleIndicatorManager.prototype.remove = function (indicator) {
21278
+ var e_2, _a;
21279
+ indicator = Array.isArray(indicator) ? indicator : [indicator];
21280
+ try {
21281
+ for (var indicator_2 = __values$j(indicator), indicator_2_1 = indicator_2.next(); !indicator_2_1.done; indicator_2_1 = indicator_2.next()) {
21282
+ var i = indicator_2_1.value;
21283
+ if (this.indicators.has(i)) {
21284
+ this.indicators.delete(i);
21285
+ i.remove();
21286
+ }
21287
+ }
21288
+ }
21289
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
21290
+ finally {
21291
+ try {
21292
+ if (indicator_2_1 && !indicator_2_1.done && (_a = indicator_2.return)) _a.call(indicator_2);
21293
+ }
21294
+ finally { if (e_2) throw e_2.error; }
21295
+ }
21296
+ };
21297
+ /**
21298
+ * Returns the indicators currently attached to the map.
21299
+ */
21300
+ AccessibleIndicatorManager.prototype.getIndicators = function () {
21301
+ return Array.from(this.indicators);
21302
+ };
21303
+ /**
21304
+ * Returns the div element that should contain all the indicator containers.
21305
+ * Creates it if it doesn't already exist.
21306
+ * @internal
21307
+ */
21308
+ AccessibleIndicatorManager.prototype._getCollectionDiv = function () {
21309
+ var collection = this.map.getMapContainer()
21310
+ .querySelector("." + AccessibleIndicatorManager.Css.collection);
21311
+ if (!collection) {
21312
+ // If the collection div doesn't exist create it.
21313
+ collection = document.createElement("div");
21314
+ collection.setAttribute("aria-label", "map data");
21315
+ // Set the container role to listbox, and the descents' role to option, so the reader will read the listbox as a list.
21316
+ // For example, NVDA will read "data point, 1 of 1" when the indicator is focused.
21317
+ collection.setAttribute("role", "listbox");
21318
+ collection.classList.add(AccessibleIndicatorManager.Css.collection);
21319
+ this.map.getMapContainer().appendChild(collection);
21320
+ }
21321
+ return collection;
21322
+ };
21323
+ AccessibleIndicatorManager.Css = {
21324
+ collection: "accessible-indicator-collection-container"
21325
+ };
21326
+ return AccessibleIndicatorManager;
21327
+ }());
21328
+
20650
21329
  var __extends$18 = (window && window.__extends) || (function () {
20651
21330
  var extendStatics = function (d, b) {
20652
21331
  extendStatics = Object.setPrototypeOf ||
@@ -20673,7 +21352,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
20673
21352
  };
20674
21353
  return __assign$9.apply(this, arguments);
20675
21354
  };
20676
- var __awaiter$3 = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
21355
+ var __awaiter$4 = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
20677
21356
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
20678
21357
  return new (P || (P = Promise))(function (resolve, reject) {
20679
21358
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -20682,7 +21361,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
20682
21361
  step((generator = generator.apply(thisArg, _arguments || [])).next());
20683
21362
  });
20684
21363
  };
20685
- var __generator$3 = (window && window.__generator) || function (thisArg, body) {
21364
+ var __generator$4 = (window && window.__generator) || function (thisArg, body) {
20686
21365
  var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
20687
21366
  return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
20688
21367
  function verb(n) { return function (v) { return step([n, v]); }; }
@@ -20709,7 +21388,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
20709
21388
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
20710
21389
  }
20711
21390
  };
20712
- var __read$d = (window && window.__read) || function (o, n) {
21391
+ var __read$e = (window && window.__read) || function (o, n) {
20713
21392
  var m = typeof Symbol === "function" && o[Symbol.iterator];
20714
21393
  if (!m) return o;
20715
21394
  var i = m.call(o), r, ar = [], e;
@@ -20725,12 +21404,12 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
20725
21404
  }
20726
21405
  return ar;
20727
21406
  };
20728
- var __spreadArray$7 = (window && window.__spreadArray) || function (to, from) {
21407
+ var __spreadArray$9 = (window && window.__spreadArray) || function (to, from) {
20729
21408
  for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
20730
21409
  to[j] = from[i];
20731
21410
  return to;
20732
21411
  };
20733
- var __values$j = (window && window.__values) || function(o) {
21412
+ var __values$k = (window && window.__values) || function(o) {
20734
21413
  var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
20735
21414
  if (m) return m.call(o);
20736
21415
  if (o && typeof o.length === "number") return {
@@ -20836,6 +21515,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
20836
21515
  _this.markers = new HtmlMarkerManager(_this);
20837
21516
  _this.sources = new SourceManager(_this);
20838
21517
  _this.popups = new PopupManager(_this);
21518
+ _this.indicators = new AccessibleIndicatorManager(_this);
20839
21519
  // Add CSS classes and set attributes for DOM elements.
20840
21520
  _this.map.getContainer().classList.add(Map.Css.container);
20841
21521
  _this.map.getCanvasContainer().classList.add(Map.Css.canvasContainer);
@@ -20876,9 +21556,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
20876
21556
  _this._setAutoResize(_this.styleOptions.autoResize);
20877
21557
  _this.map.showTileBoundaries = _this.styleOptions.showTileBoundaries;
20878
21558
  _this.localizedStringsPromise = Localizer.getStrings(_this.styleOptions.language);
20879
- var stylesInit = _this.styles.initStyleset();
20880
- Promise.all([authManInit, stylesInit]).then(function (_a) {
20881
- var _b = __read$d(_a, 2), _ = _b[0], definitions = _b[1];
21559
+ authManInit
21560
+ // reuses this.styles.initPromise if initStyleset is already called
21561
+ .then(function () { return _this.styles.definitions(); })
21562
+ .then(function (definitions) {
20882
21563
  // Check that the map hasn't been removed for any reason.
20883
21564
  // If so no need to finish styling the map.
20884
21565
  if (_this.removed) {
@@ -20908,7 +21589,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
20908
21589
  _this.events.invoke("error", errorData);
20909
21590
  });
20910
21591
  // --> Set initial camera state of map
20911
- _this.setCamera(__assign$9(__assign$9({}, options), { type: "jump", duration: 0 }));
21592
+ _this.setCamera(__assign$9(__assign$9({
21593
+ // Default minZoom to ensure the map doesn't zoom out to unsupported zoom levels.
21594
+ minZoom: 1 }, options), { type: "jump", duration: 0 }));
20912
21595
  _this.flowDelegate = new FlowServiceDelegate(_this);
20913
21596
  _this.accessibleMapDelegate = new AccessibleMapDelegate(_this);
20914
21597
  _this.userInteractionDelegate = new UserInteractionDelegate(_this, options);
@@ -20939,6 +21622,16 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
20939
21622
  }
20940
21623
  return _this;
20941
21624
  }
21625
+ Object.defineProperty(Map.prototype, "isDisposed", {
21626
+ /**
21627
+ * Returns true if the map has been disposed.
21628
+ */
21629
+ get: function () {
21630
+ return this.removed;
21631
+ },
21632
+ enumerable: false,
21633
+ configurable: true
21634
+ });
20942
21635
  /**
20943
21636
  * Returns the HTMLCanvasElement that the map is drawn to.
20944
21637
  */
@@ -20975,6 +21668,19 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
20975
21668
  else {
20976
21669
  this.accessibleMapDelegate.removeFromMap();
20977
21670
  }
21671
+ var shouldReloadStyle = this.styles.serviceOptions.mapConfiguration !== this.serviceOptions.mapConfiguration
21672
+ || this.styles.serviceOptions.staticAssetsDomain !== this.serviceOptions.staticAssetsDomain
21673
+ || this.styles.serviceOptions.styleDefinitionsVersion !== this.serviceOptions.styleDefinitionsVersion
21674
+ || this.styles.serviceOptions.domain !== this.serviceOptions.domain
21675
+ || this.styles.serviceOptions.styleAPIVersion !== this.serviceOptions.styleAPIVersion;
21676
+ // NOTE: only perform a reload when the style dependent properties are changed
21677
+ //|| this.styles.serviceOptions.validateStyle !== this.serviceOptions.validateStyle
21678
+ //|| this.styles.serviceOptions.transformRequest !== this.serviceOptions.transformRequest
21679
+ this.styles.serviceOptions = this.serviceOptions;
21680
+ if (shouldReloadStyle) {
21681
+ this.styles.initPromise = null;
21682
+ this.setStyle({});
21683
+ }
20978
21684
  };
20979
21685
  /**
20980
21686
  * Adds request transformer
@@ -21003,6 +21709,12 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
21003
21709
  if (!mapboxCameraOptions) {
21004
21710
  throw new Error("The map cannot be fit to the current canvas with the given CameraBoundsOptions.");
21005
21711
  }
21712
+ if ('pitch' in options) {
21713
+ mapboxCameraOptions.pitch = options.pitch;
21714
+ }
21715
+ if ('bearing' in options) {
21716
+ mapboxCameraOptions.bearing = options.bearing;
21717
+ }
21006
21718
  this.map.setMaxZoom(cameraBoundsOptions.maxZoom);
21007
21719
  this._invokeEvent("maxzoomchanged", this.map.getMaxZoom());
21008
21720
  maxBounds = this._generateSafeBounds(cameraBoundsOptions.maxBounds);
@@ -21125,8 +21837,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
21125
21837
  // If this function is restructured such that a styledata event won't always trigger
21126
21838
  // if the language is changed, then either those delegates need changed
21127
21839
  // or the styledata event manually invoked.
21840
+ var noDiffOnLanguageViewChange = diff && (this.styleOptions.language === newOptions.language && this.styleOptions.view === newOptions.view);
21128
21841
  this.styleOptions = newOptions;
21129
- this._setStyleComponents(newOptions, diff);
21842
+ this._setStyleComponents(newOptions, noDiffOnLanguageViewChange);
21130
21843
  };
21131
21844
  /**
21132
21845
  * Returns the map control's current style settings.
@@ -21517,7 +22230,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
21517
22230
  urls = layer.getOptions().subdomains || [];
21518
22231
  }
21519
22232
  // Add the tile urls to the layer, but don't update the map yet.
21520
- urls.push.apply(urls, __spreadArray$7([], __read$d(tileSources)));
22233
+ urls.push.apply(urls, __spreadArray$9([], __read$e(tileSources)));
21521
22234
  layer._setOptionsNoUpdate({
21522
22235
  subdomains: urls
21523
22236
  });
@@ -21539,7 +22252,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
21539
22252
  Map.prototype.removeLayers = function (layerNames) {
21540
22253
  var e_1, _a;
21541
22254
  try {
21542
- for (var layerNames_1 = __values$j(layerNames), layerNames_1_1 = layerNames_1.next(); !layerNames_1_1.done; layerNames_1_1 = layerNames_1.next()) {
22255
+ for (var layerNames_1 = __values$k(layerNames), layerNames_1_1 = layerNames_1.next(); !layerNames_1_1.done; layerNames_1_1 = layerNames_1.next()) {
21543
22256
  var layerName = layerNames_1_1.value;
21544
22257
  // Previously calling removeLayers for layers that didn't exist in the map just did nothing.
21545
22258
  // Now, LayerManager will throw an error, so we need to check if the layer exists before calling remove.
@@ -21681,14 +22394,19 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
21681
22394
  this.layers.clear();
21682
22395
  this.sources.clear();
21683
22396
  this.markers.clear();
22397
+ this.indicators.clear();
21684
22398
  };
21685
22399
  /**
21686
22400
  * Clean up the map's resources. Map will not function correctly after calling this method.
21687
22401
  */
21688
22402
  Map.prototype.dispose = function () {
22403
+ var _a;
21689
22404
  this.clear();
21690
22405
  this.map.remove();
22406
+ (_a = this.authentication) === null || _a === void 0 ? void 0 : _a.dispose();
21691
22407
  this.removed = true;
22408
+ // Remove event listeners
22409
+ window.removeEventListener("resize", this._windowResizeCallback);
21692
22410
  while (this.getMapContainer().firstChild) {
21693
22411
  var currChild = this.getMapContainer().firstChild;
21694
22412
  this.getMapContainer().removeChild(currChild);
@@ -21729,7 +22447,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
21729
22447
  var e_2, _a;
21730
22448
  var positions = [];
21731
22449
  try {
21732
- for (var pixels_1 = __values$j(pixels), pixels_1_1 = pixels_1.next(); !pixels_1_1.done; pixels_1_1 = pixels_1.next()) {
22450
+ for (var pixels_1 = __values$k(pixels), pixels_1_1 = pixels_1.next(); !pixels_1_1.done; pixels_1_1 = pixels_1.next()) {
21733
22451
  var pixel = pixels_1_1.value;
21734
22452
  var lngLat = this.map.unproject(pixel);
21735
22453
  positions.push(new Position(lngLat.lng, lngLat.lat));
@@ -21752,7 +22470,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
21752
22470
  var e_3, _a;
21753
22471
  var pixels = [];
21754
22472
  try {
21755
- for (var positions_1 = __values$j(positions), positions_1_1 = positions_1.next(); !positions_1_1.done; positions_1_1 = positions_1.next()) {
22473
+ for (var positions_1 = __values$k(positions), positions_1_1 = positions_1.next(); !positions_1_1.done; positions_1_1 = positions_1.next()) {
21756
22474
  var position = positions_1_1.value;
21757
22475
  var point = this.map.project(position);
21758
22476
  pixels.push(new Pixel(point.x, point.y));
@@ -21800,8 +22518,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
21800
22518
  */
21801
22519
  Map.prototype._rebuildStyle = function (diff) {
21802
22520
  if (diff === void 0) { diff = true; }
21803
- return __awaiter$3(this, void 0, void 0, function () {
21804
- return __generator$3(this, function (_a) {
22521
+ return __awaiter$4(this, void 0, void 0, function () {
22522
+ return __generator$4(this, function (_a) {
21805
22523
  this.styles.setStyle(this.styleOptions, diff);
21806
22524
  this.imageSprite._restoreImages();
21807
22525
  return [2 /*return*/];
@@ -22017,7 +22735,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
22017
22735
  return Map;
22018
22736
  }(EventEmitter));
22019
22737
 
22020
- var __read$e = (window && window.__read) || function (o, n) {
22738
+ var __read$f = (window && window.__read) || function (o, n) {
22021
22739
  var m = typeof Symbol === "function" && o[Symbol.iterator];
22022
22740
  if (!m) return o;
22023
22741
  var i = m.call(o), r, ar = [], e;
@@ -22033,7 +22751,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
22033
22751
  }
22034
22752
  return ar;
22035
22753
  };
22036
- var __spreadArray$8 = (window && window.__spreadArray) || function (to, from) {
22754
+ var __spreadArray$a = (window && window.__spreadArray) || function (to, from) {
22037
22755
  for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
22038
22756
  to[j] = from[i];
22039
22757
  return to;
@@ -22179,7 +22897,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
22179
22897
  lineLength = 50;
22180
22898
  }
22181
22899
  var lines = c.split(/<(tr|div|br|li|h[0-9]|p>)/);
22182
- longestStringLength = Math.max.apply(Math, __spreadArray$8([], __read$e((lines.map(function (el) { return el.replace(/<[a-zA-Z0-9\s=\/]+>/g, "").length; }))))) - 1;
22900
+ longestStringLength = Math.max.apply(Math, __spreadArray$a([], __read$f((lines.map(function (el) { return el.replace(/<[a-zA-Z0-9\s=\/]+>/g, "").length; }))))) - 1;
22183
22901
  var w = Math.ceil(longestStringLength * 3.5);
22184
22902
  if (w < width) {
22185
22903
  width = w;