azure-maps-control 2.1.11 → 2.1.12

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.
@@ -43487,7 +43487,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
43487
43487
  return Url;
43488
43488
  }());
43489
43489
 
43490
- var version = "2.1.11";
43490
+ var version = "2.1.12";
43491
43491
 
43492
43492
  /**
43493
43493
  * A helper class that provides methods for getting various forms of the map controls current version.
@@ -43549,24 +43549,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
43549
43549
  else if (typeof themeQuery.addListener === 'function') {
43550
43550
  themeQuery.addListener(function (e) { return onThemeChange(e); });
43551
43551
  }
43552
- if (navigator.userAgent.indexOf('Edg') != -1) {
43553
- tooltipContent.classList.add('edge');
43554
- }
43555
- else if (navigator.userAgent.indexOf('Chrome') != -1) {
43556
- tooltipContent.classList.add('chrome');
43557
- }
43558
- else if (navigator.userAgent.indexOf('Safari') != -1) {
43559
- tooltipContent.classList.add('safari');
43560
- }
43561
- else if (navigator.userAgent.indexOf('Firefox') != -1) {
43562
- tooltipContent.classList.add('firefox');
43563
- }
43564
- if (navigator.userAgent.indexOf('Windows') != -1) {
43565
- tooltipContent.classList.add('win');
43566
- }
43567
- else if (navigator.userAgent.indexOf('Macintosh') != -1) {
43568
- tooltipContent.classList.add('mac');
43569
- }
43570
43552
  return tooltipContent;
43571
43553
  };
43572
43554
  /**
@@ -43814,9 +43796,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
43814
43796
  delete _this._observer;
43815
43797
  }
43816
43798
  // If the style is anything but blank the style definition should decide the theme.
43817
- _this._map.styles.getThemeAsync(_this._map.getStyle()).then(function (theme) {
43818
- _this._setTheme(theme);
43819
- });
43799
+ var theme = _this._map.styles.getTheme(_this._map.getStyle());
43800
+ _this._setTheme(theme);
43820
43801
  }
43821
43802
  };
43822
43803
  /**
@@ -43867,8 +43848,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
43867
43848
  }
43868
43849
  // Set the style or add the auto listener.
43869
43850
  if (style.toLowerCase() === exports.ControlStyle.auto) {
43870
- this._map.styles.definitions().then(function (definitions) {
43851
+ this._map.styles.initialize().then(function () {
43871
43852
  if (_this._map) {
43853
+ _this._onStyleChange();
43872
43854
  _this._map.events.add("styledata", _this._onStyleChange);
43873
43855
  }
43874
43856
  });
@@ -43914,11 +43896,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
43914
43896
  * @default ControlStyle.light
43915
43897
  */
43916
43898
  _this.style = exports.ControlStyle.light;
43917
- /**
43918
- * Inverts the direction of map rotation controls.
43919
- * @default false
43920
- */
43921
- _this.inverted = false;
43922
43899
  return _this;
43923
43900
  }
43924
43901
  return CompassControlOptions;
@@ -44057,7 +44034,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
44057
44034
  rotationRightButton.setAttribute("type", "button");
44058
44035
  rotationRightButton.addEventListener("click", function () {
44059
44036
  map.setCamera({
44060
- bearing: map.getCamera().bearing - (_this.options.inverted ? -1 : 1) * _this.options.rotationDegreesDelta,
44037
+ bearing: map.getCamera().bearing - _this.options.rotationDegreesDelta,
44061
44038
  duration: CompassControl.RotationDuration,
44062
44039
  type: "ease",
44063
44040
  }, true);
@@ -44074,7 +44051,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
44074
44051
  rotationLeftButton.setAttribute("type", "button");
44075
44052
  rotationLeftButton.addEventListener("click", function () {
44076
44053
  map.setCamera({
44077
- bearing: map.getCamera().bearing + (_this.options.inverted ? -1 : 1) * _this.options.rotationDegreesDelta,
44054
+ bearing: map.getCamera().bearing + _this.options.rotationDegreesDelta,
44078
44055
  duration: CompassControl.RotationDuration,
44079
44056
  type: "ease"
44080
44057
  }, true);
@@ -44106,11 +44083,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
44106
44083
  * @default ControlStyle.light
44107
44084
  */
44108
44085
  _this.style = exports.ControlStyle.light;
44109
- /**
44110
- * Inverts the direction of map pitch controls.
44111
- * @default false
44112
- */
44113
- _this.inverted = false;
44114
44086
  return _this;
44115
44087
  }
44116
44088
  return PitchControlOptions;
@@ -44137,21 +44109,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
44137
44109
  _this.updatePitchButtonsState = function () {
44138
44110
  var minPitchReached = _this.map.getCamera().pitch <= 0;
44139
44111
  var maxPitchReached = _this.map.getCamera().pitch >= 60;
44140
- if (_this.options.inverted) {
44141
- if (_this.pitchIncrementButton && _this.pitchIncrementButton.disabled != minPitchReached) {
44142
- _this.pitchIncrementButton.disabled = minPitchReached;
44143
- }
44144
- if (_this.pitchDecrementButton && _this.pitchDecrementButton.disabled != maxPitchReached) {
44145
- _this.pitchDecrementButton.disabled = maxPitchReached;
44146
- }
44112
+ if (_this.pitchIncrementButton && _this.pitchIncrementButton.disabled != maxPitchReached) {
44113
+ _this.pitchIncrementButton.disabled = maxPitchReached;
44147
44114
  }
44148
- else {
44149
- if (_this.pitchIncrementButton && _this.pitchIncrementButton.disabled != maxPitchReached) {
44150
- _this.pitchIncrementButton.disabled = maxPitchReached;
44151
- }
44152
- if (_this.pitchDecrementButton && _this.pitchDecrementButton.disabled != minPitchReached) {
44153
- _this.pitchDecrementButton.disabled = minPitchReached;
44154
- }
44115
+ if (_this.pitchDecrementButton && _this.pitchDecrementButton.disabled != minPitchReached) {
44116
+ _this.pitchDecrementButton.disabled = minPitchReached;
44155
44117
  }
44156
44118
  };
44157
44119
  _this.options = new PitchControlOptions().merge(options);
@@ -44216,7 +44178,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
44216
44178
  this.map = map;
44217
44179
  this.container = container;
44218
44180
  map.events.add('pitch', this.pitchChanged);
44219
- this.updatePitchButtonsState();
44220
44181
  return container;
44221
44182
  };
44222
44183
  PitchControl.prototype.onRemove = function () {
@@ -44285,7 +44246,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
44285
44246
  pitchDecrementButton.setAttribute("type", "button");
44286
44247
  pitchDecrementButton.addEventListener("click", function () {
44287
44248
  map.setCamera({
44288
- pitch: map.getCamera().pitch - (_this.options.inverted ? -1 : 1) * _this.options.pitchDegreesDelta,
44249
+ pitch: map.getCamera().pitch - _this.options.pitchDegreesDelta,
44289
44250
  duration: PitchControl.PITCH_DURATION_MS,
44290
44251
  type: "ease"
44291
44252
  }, true);
@@ -44302,7 +44263,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
44302
44263
  pitchIncrementButton.setAttribute("type", "button");
44303
44264
  pitchIncrementButton.addEventListener("click", function () {
44304
44265
  map.setCamera({
44305
- pitch: map.getCamera().pitch + (_this.options.inverted ? -1 : 1) * _this.options.pitchDegreesDelta,
44266
+ pitch: map.getCamera().pitch + _this.options.pitchDegreesDelta,
44306
44267
  duration: PitchControl.PITCH_DURATION_MS,
44307
44268
  type: "ease"
44308
44269
  }, true);
@@ -46798,699 +46759,80 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
46798
46759
  var cloneDeep_1 = cloneDeep;
46799
46760
 
46800
46761
  /**
46801
- * This function is like `assignValue` except that it doesn't assign
46802
- * `undefined` values.
46803
- *
46804
- * @private
46805
- * @param {Object} object The object to modify.
46806
- * @param {string} key The key of the property to assign.
46807
- * @param {*} value The value to assign.
46808
- */
46809
- function assignMergeValue(object, key, value) {
46810
- if ((value !== undefined && !eq_1(object[key], value)) ||
46811
- (value === undefined && !(key in object))) {
46812
- _baseAssignValue(object, key, value);
46813
- }
46814
- }
46815
-
46816
- var _assignMergeValue = assignMergeValue;
46817
-
46818
- /**
46819
- * Creates a base function for methods like `_.forIn` and `_.forOwn`.
46820
- *
46821
- * @private
46822
- * @param {boolean} [fromRight] Specify iterating from right to left.
46823
- * @returns {Function} Returns the new base function.
46762
+ * The options for a StyleControl object.
46824
46763
  */
46825
- function createBaseFor(fromRight) {
46826
- return function(object, iteratee, keysFunc) {
46827
- var index = -1,
46828
- iterable = Object(object),
46829
- props = keysFunc(object),
46830
- length = props.length;
46831
-
46832
- while (length--) {
46833
- var key = props[fromRight ? length : ++index];
46834
- if (iteratee(iterable[key], key, iterable) === false) {
46835
- break;
46836
- }
46764
+ var StyleControlOptions = /** @class */ (function (_super) {
46765
+ __extends(StyleControlOptions, _super);
46766
+ function StyleControlOptions() {
46767
+ var _this = _super !== null && _super.apply(this, arguments) || this;
46768
+ /**
46769
+ * The layout to display the styles in.
46770
+ * <p>`"icons"`: A row of clickable icons for each style.</p>
46771
+ * <p>`"list"`: A scrollable list with the icons and names for each style.</p>
46772
+ * Default `"icons"`
46773
+ * @default "icons"
46774
+ */
46775
+ _this.layout = "icons";
46776
+ /**
46777
+ * The map styles to show in the control.
46778
+ * Style names are case sensitive.
46779
+ * If an included style isn't supported by the map it will be ignored.
46780
+ * Available styles can be found in the
46781
+ * [supported styles]{@link https://docs.microsoft.com/en-us/azure/azure-maps/supported-map-styles} article.
46782
+ * If "all" is specified, all map styles will be shown.
46783
+ * Default `["road", "grayscale_light", "grayscale_dark", "night", "road_shaded_relief"]`
46784
+ * @default ["road", "grayscale_light", "grayscale_dark", "night", "road_shaded_relief"]
46785
+ */
46786
+ _this.mapStyles = [
46787
+ "road",
46788
+ "grayscale_light",
46789
+ "grayscale_dark",
46790
+ "night",
46791
+ "road_shaded_relief",
46792
+ ];
46793
+ /**
46794
+ * The style of the control.
46795
+ * Default `ControlStyle.light`.
46796
+ * @default ControlStyle.light
46797
+ */
46798
+ _this.style = exports.ControlStyle.light;
46799
+ /**
46800
+ * Whether to let style control automatically set the style, once user select a map style.
46801
+ * If set to `false`, then clicking on style will not set the set the style automatically.
46802
+ * Default `true`
46803
+ */
46804
+ _this.autoSelectionMode = true;
46805
+ return _this;
46837
46806
  }
46838
- return object;
46839
- };
46840
- }
46841
-
46842
- var _createBaseFor = createBaseFor;
46843
-
46844
- /**
46845
- * The base implementation of `baseForOwn` which iterates over `object`
46846
- * properties returned by `keysFunc` and invokes `iteratee` for each property.
46847
- * Iteratee functions may exit iteration early by explicitly returning `false`.
46848
- *
46849
- * @private
46850
- * @param {Object} object The object to iterate over.
46851
- * @param {Function} iteratee The function invoked per iteration.
46852
- * @param {Function} keysFunc The function to get the keys of `object`.
46853
- * @returns {Object} Returns `object`.
46854
- */
46855
- var baseFor = _createBaseFor();
46856
-
46857
- var _baseFor = baseFor;
46858
-
46859
- /**
46860
- * This method is like `_.isArrayLike` except that it also checks if `value`
46861
- * is an object.
46862
- *
46863
- * @static
46864
- * @memberOf _
46865
- * @since 4.0.0
46866
- * @category Lang
46867
- * @param {*} value The value to check.
46868
- * @returns {boolean} Returns `true` if `value` is an array-like object,
46869
- * else `false`.
46870
- * @example
46871
- *
46872
- * _.isArrayLikeObject([1, 2, 3]);
46873
- * // => true
46874
- *
46875
- * _.isArrayLikeObject(document.body.children);
46876
- * // => true
46877
- *
46878
- * _.isArrayLikeObject('abc');
46879
- * // => false
46880
- *
46881
- * _.isArrayLikeObject(_.noop);
46882
- * // => false
46883
- */
46884
- function isArrayLikeObject(value) {
46885
- return isObjectLike_1(value) && isArrayLike_1(value);
46886
- }
46887
-
46888
- var isArrayLikeObject_1 = isArrayLikeObject;
46889
-
46890
- /** `Object#toString` result references. */
46891
- var objectTag$3 = '[object Object]';
46892
-
46893
- /** Used for built-in method references. */
46894
- var funcProto$2 = Function.prototype,
46895
- objectProto$d = Object.prototype;
46896
-
46897
- /** Used to resolve the decompiled source of functions. */
46898
- var funcToString$2 = funcProto$2.toString;
46899
-
46900
- /** Used to check objects for own properties. */
46901
- var hasOwnProperty$a = objectProto$d.hasOwnProperty;
46902
-
46903
- /** Used to infer the `Object` constructor. */
46904
- var objectCtorString = funcToString$2.call(Object);
46905
-
46906
- /**
46907
- * Checks if `value` is a plain object, that is, an object created by the
46908
- * `Object` constructor or one with a `[[Prototype]]` of `null`.
46909
- *
46910
- * @static
46911
- * @memberOf _
46912
- * @since 0.8.0
46913
- * @category Lang
46914
- * @param {*} value The value to check.
46915
- * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
46916
- * @example
46917
- *
46918
- * function Foo() {
46919
- * this.a = 1;
46920
- * }
46921
- *
46922
- * _.isPlainObject(new Foo);
46923
- * // => false
46924
- *
46925
- * _.isPlainObject([1, 2, 3]);
46926
- * // => false
46927
- *
46928
- * _.isPlainObject({ 'x': 0, 'y': 0 });
46929
- * // => true
46930
- *
46931
- * _.isPlainObject(Object.create(null));
46932
- * // => true
46933
- */
46934
- function isPlainObject(value) {
46935
- if (!isObjectLike_1(value) || _baseGetTag(value) != objectTag$3) {
46936
- return false;
46937
- }
46938
- var proto = _getPrototype(value);
46939
- if (proto === null) {
46940
- return true;
46941
- }
46942
- var Ctor = hasOwnProperty$a.call(proto, 'constructor') && proto.constructor;
46943
- return typeof Ctor == 'function' && Ctor instanceof Ctor &&
46944
- funcToString$2.call(Ctor) == objectCtorString;
46945
- }
46946
-
46947
- var isPlainObject_1 = isPlainObject;
46948
-
46949
- /**
46950
- * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
46951
- *
46952
- * @private
46953
- * @param {Object} object The object to query.
46954
- * @param {string} key The key of the property to get.
46955
- * @returns {*} Returns the property value.
46956
- */
46957
- function safeGet(object, key) {
46958
- if (key === 'constructor' && typeof object[key] === 'function') {
46959
- return;
46960
- }
46961
-
46962
- if (key == '__proto__') {
46963
- return;
46964
- }
46965
-
46966
- return object[key];
46967
- }
46968
-
46969
- var _safeGet = safeGet;
46807
+ return StyleControlOptions;
46808
+ }(Options));
46970
46809
 
46971
46810
  /**
46972
- * Converts `value` to a plain object flattening inherited enumerable string
46973
- * keyed properties of `value` to own properties of the plain object.
46974
- *
46975
- * @static
46976
- * @memberOf _
46977
- * @since 3.0.0
46978
- * @category Lang
46979
- * @param {*} value The value to convert.
46980
- * @returns {Object} Returns the converted plain object.
46981
- * @example
46982
- *
46983
- * function Foo() {
46984
- * this.b = 2;
46985
- * }
46986
- *
46987
- * Foo.prototype.c = 3;
46988
- *
46989
- * _.assign({ 'a': 1 }, new Foo);
46990
- * // => { 'a': 1, 'b': 2 }
46991
- *
46992
- * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
46993
- * // => { 'a': 1, 'b': 2, 'c': 3 }
46811
+ * A control for changing the style of the map.
46994
46812
  */
46995
- function toPlainObject(value) {
46996
- return _copyObject(value, keysIn_1(value));
46997
- }
46998
-
46999
- var toPlainObject_1 = toPlainObject;
47000
-
47001
- /**
47002
- * A specialized version of `baseMerge` for arrays and objects which performs
47003
- * deep merges and tracks traversed objects enabling objects with circular
47004
- * references to be merged.
47005
- *
47006
- * @private
47007
- * @param {Object} object The destination object.
47008
- * @param {Object} source The source object.
47009
- * @param {string} key The key of the value to merge.
47010
- * @param {number} srcIndex The index of `source`.
47011
- * @param {Function} mergeFunc The function to merge values.
47012
- * @param {Function} [customizer] The function to customize assigned values.
47013
- * @param {Object} [stack] Tracks traversed source values and their merged
47014
- * counterparts.
47015
- */
47016
- function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
47017
- var objValue = _safeGet(object, key),
47018
- srcValue = _safeGet(source, key),
47019
- stacked = stack.get(srcValue);
47020
-
47021
- if (stacked) {
47022
- _assignMergeValue(object, key, stacked);
47023
- return;
47024
- }
47025
- var newValue = customizer
47026
- ? customizer(objValue, srcValue, (key + ''), object, source, stack)
47027
- : undefined;
47028
-
47029
- var isCommon = newValue === undefined;
47030
-
47031
- if (isCommon) {
47032
- var isArr = isArray_1(srcValue),
47033
- isBuff = !isArr && isBuffer_1(srcValue),
47034
- isTyped = !isArr && !isBuff && isTypedArray_1(srcValue);
47035
-
47036
- newValue = srcValue;
47037
- if (isArr || isBuff || isTyped) {
47038
- if (isArray_1(objValue)) {
47039
- newValue = objValue;
47040
- }
47041
- else if (isArrayLikeObject_1(objValue)) {
47042
- newValue = _copyArray(objValue);
47043
- }
47044
- else if (isBuff) {
47045
- isCommon = false;
47046
- newValue = _cloneBuffer(srcValue, true);
47047
- }
47048
- else if (isTyped) {
47049
- isCommon = false;
47050
- newValue = _cloneTypedArray(srcValue, true);
47051
- }
47052
- else {
47053
- newValue = [];
47054
- }
47055
- }
47056
- else if (isPlainObject_1(srcValue) || isArguments_1(srcValue)) {
47057
- newValue = objValue;
47058
- if (isArguments_1(objValue)) {
47059
- newValue = toPlainObject_1(objValue);
47060
- }
47061
- else if (!isObject_1(objValue) || isFunction_1(objValue)) {
47062
- newValue = _initCloneObject(srcValue);
47063
- }
47064
- }
47065
- else {
47066
- isCommon = false;
47067
- }
47068
- }
47069
- if (isCommon) {
47070
- // Recursively merge objects and arrays (susceptible to call stack limits).
47071
- stack.set(srcValue, newValue);
47072
- mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
47073
- stack['delete'](srcValue);
47074
- }
47075
- _assignMergeValue(object, key, newValue);
47076
- }
47077
-
47078
- var _baseMergeDeep = baseMergeDeep;
47079
-
47080
- /**
47081
- * The base implementation of `_.merge` without support for multiple sources.
47082
- *
47083
- * @private
47084
- * @param {Object} object The destination object.
47085
- * @param {Object} source The source object.
47086
- * @param {number} srcIndex The index of `source`.
47087
- * @param {Function} [customizer] The function to customize merged values.
47088
- * @param {Object} [stack] Tracks traversed source values and their merged
47089
- * counterparts.
47090
- */
47091
- function baseMerge(object, source, srcIndex, customizer, stack) {
47092
- if (object === source) {
47093
- return;
47094
- }
47095
- _baseFor(source, function(srcValue, key) {
47096
- stack || (stack = new _Stack);
47097
- if (isObject_1(srcValue)) {
47098
- _baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
47099
- }
47100
- else {
47101
- var newValue = customizer
47102
- ? customizer(_safeGet(object, key), srcValue, (key + ''), object, source, stack)
47103
- : undefined;
47104
-
47105
- if (newValue === undefined) {
47106
- newValue = srcValue;
47107
- }
47108
- _assignMergeValue(object, key, newValue);
47109
- }
47110
- }, keysIn_1);
47111
- }
47112
-
47113
- var _baseMerge = baseMerge;
47114
-
47115
- /**
47116
- * This method returns the first argument it receives.
47117
- *
47118
- * @static
47119
- * @since 0.1.0
47120
- * @memberOf _
47121
- * @category Util
47122
- * @param {*} value Any value.
47123
- * @returns {*} Returns `value`.
47124
- * @example
47125
- *
47126
- * var object = { 'a': 1 };
47127
- *
47128
- * console.log(_.identity(object) === object);
47129
- * // => true
47130
- */
47131
- function identity(value) {
47132
- return value;
47133
- }
47134
-
47135
- var identity_1 = identity;
47136
-
47137
- /**
47138
- * A faster alternative to `Function#apply`, this function invokes `func`
47139
- * with the `this` binding of `thisArg` and the arguments of `args`.
47140
- *
47141
- * @private
47142
- * @param {Function} func The function to invoke.
47143
- * @param {*} thisArg The `this` binding of `func`.
47144
- * @param {Array} args The arguments to invoke `func` with.
47145
- * @returns {*} Returns the result of `func`.
47146
- */
47147
- function apply(func, thisArg, args) {
47148
- switch (args.length) {
47149
- case 0: return func.call(thisArg);
47150
- case 1: return func.call(thisArg, args[0]);
47151
- case 2: return func.call(thisArg, args[0], args[1]);
47152
- case 3: return func.call(thisArg, args[0], args[1], args[2]);
47153
- }
47154
- return func.apply(thisArg, args);
47155
- }
47156
-
47157
- var _apply = apply;
47158
-
47159
- /* Built-in method references for those with the same name as other `lodash` methods. */
47160
- var nativeMax = Math.max;
47161
-
47162
- /**
47163
- * A specialized version of `baseRest` which transforms the rest array.
47164
- *
47165
- * @private
47166
- * @param {Function} func The function to apply a rest parameter to.
47167
- * @param {number} [start=func.length-1] The start position of the rest parameter.
47168
- * @param {Function} transform The rest array transform.
47169
- * @returns {Function} Returns the new function.
47170
- */
47171
- function overRest(func, start, transform) {
47172
- start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
47173
- return function() {
47174
- var args = arguments,
47175
- index = -1,
47176
- length = nativeMax(args.length - start, 0),
47177
- array = Array(length);
47178
-
47179
- while (++index < length) {
47180
- array[index] = args[start + index];
47181
- }
47182
- index = -1;
47183
- var otherArgs = Array(start + 1);
47184
- while (++index < start) {
47185
- otherArgs[index] = args[index];
47186
- }
47187
- otherArgs[start] = transform(array);
47188
- return _apply(func, this, otherArgs);
47189
- };
47190
- }
47191
-
47192
- var _overRest = overRest;
47193
-
47194
- /**
47195
- * Creates a function that returns `value`.
47196
- *
47197
- * @static
47198
- * @memberOf _
47199
- * @since 2.4.0
47200
- * @category Util
47201
- * @param {*} value The value to return from the new function.
47202
- * @returns {Function} Returns the new constant function.
47203
- * @example
47204
- *
47205
- * var objects = _.times(2, _.constant({ 'a': 1 }));
47206
- *
47207
- * console.log(objects);
47208
- * // => [{ 'a': 1 }, { 'a': 1 }]
47209
- *
47210
- * console.log(objects[0] === objects[1]);
47211
- * // => true
47212
- */
47213
- function constant(value) {
47214
- return function() {
47215
- return value;
47216
- };
47217
- }
47218
-
47219
- var constant_1 = constant;
47220
-
47221
- /**
47222
- * The base implementation of `setToString` without support for hot loop shorting.
47223
- *
47224
- * @private
47225
- * @param {Function} func The function to modify.
47226
- * @param {Function} string The `toString` result.
47227
- * @returns {Function} Returns `func`.
47228
- */
47229
- var baseSetToString = !_defineProperty ? identity_1 : function(func, string) {
47230
- return _defineProperty(func, 'toString', {
47231
- 'configurable': true,
47232
- 'enumerable': false,
47233
- 'value': constant_1(string),
47234
- 'writable': true
47235
- });
47236
- };
47237
-
47238
- var _baseSetToString = baseSetToString;
47239
-
47240
- /** Used to detect hot functions by number of calls within a span of milliseconds. */
47241
- var HOT_COUNT = 800,
47242
- HOT_SPAN = 16;
47243
-
47244
- /* Built-in method references for those with the same name as other `lodash` methods. */
47245
- var nativeNow = Date.now;
47246
-
47247
- /**
47248
- * Creates a function that'll short out and invoke `identity` instead
47249
- * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
47250
- * milliseconds.
47251
- *
47252
- * @private
47253
- * @param {Function} func The function to restrict.
47254
- * @returns {Function} Returns the new shortable function.
47255
- */
47256
- function shortOut(func) {
47257
- var count = 0,
47258
- lastCalled = 0;
47259
-
47260
- return function() {
47261
- var stamp = nativeNow(),
47262
- remaining = HOT_SPAN - (stamp - lastCalled);
47263
-
47264
- lastCalled = stamp;
47265
- if (remaining > 0) {
47266
- if (++count >= HOT_COUNT) {
47267
- return arguments[0];
47268
- }
47269
- } else {
47270
- count = 0;
47271
- }
47272
- return func.apply(undefined, arguments);
47273
- };
47274
- }
47275
-
47276
- var _shortOut = shortOut;
47277
-
47278
- /**
47279
- * Sets the `toString` method of `func` to return `string`.
47280
- *
47281
- * @private
47282
- * @param {Function} func The function to modify.
47283
- * @param {Function} string The `toString` result.
47284
- * @returns {Function} Returns `func`.
47285
- */
47286
- var setToString = _shortOut(_baseSetToString);
47287
-
47288
- var _setToString = setToString;
47289
-
47290
- /**
47291
- * The base implementation of `_.rest` which doesn't validate or coerce arguments.
47292
- *
47293
- * @private
47294
- * @param {Function} func The function to apply a rest parameter to.
47295
- * @param {number} [start=func.length-1] The start position of the rest parameter.
47296
- * @returns {Function} Returns the new function.
47297
- */
47298
- function baseRest(func, start) {
47299
- return _setToString(_overRest(func, start, identity_1), func + '');
47300
- }
47301
-
47302
- var _baseRest = baseRest;
47303
-
47304
- /**
47305
- * Checks if the given arguments are from an iteratee call.
47306
- *
47307
- * @private
47308
- * @param {*} value The potential iteratee value argument.
47309
- * @param {*} index The potential iteratee index or key argument.
47310
- * @param {*} object The potential iteratee object argument.
47311
- * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
47312
- * else `false`.
47313
- */
47314
- function isIterateeCall(value, index, object) {
47315
- if (!isObject_1(object)) {
47316
- return false;
47317
- }
47318
- var type = typeof index;
47319
- if (type == 'number'
47320
- ? (isArrayLike_1(object) && _isIndex(index, object.length))
47321
- : (type == 'string' && index in object)
47322
- ) {
47323
- return eq_1(object[index], value);
47324
- }
47325
- return false;
47326
- }
47327
-
47328
- var _isIterateeCall = isIterateeCall;
47329
-
47330
- /**
47331
- * Creates a function like `_.assign`.
47332
- *
47333
- * @private
47334
- * @param {Function} assigner The function to assign values.
47335
- * @returns {Function} Returns the new assigner function.
47336
- */
47337
- function createAssigner(assigner) {
47338
- return _baseRest(function(object, sources) {
47339
- var index = -1,
47340
- length = sources.length,
47341
- customizer = length > 1 ? sources[length - 1] : undefined,
47342
- guard = length > 2 ? sources[2] : undefined;
47343
-
47344
- customizer = (assigner.length > 3 && typeof customizer == 'function')
47345
- ? (length--, customizer)
47346
- : undefined;
47347
-
47348
- if (guard && _isIterateeCall(sources[0], sources[1], guard)) {
47349
- customizer = length < 3 ? undefined : customizer;
47350
- length = 1;
47351
- }
47352
- object = Object(object);
47353
- while (++index < length) {
47354
- var source = sources[index];
47355
- if (source) {
47356
- assigner(object, source, index, customizer);
47357
- }
47358
- }
47359
- return object;
47360
- });
47361
- }
47362
-
47363
- var _createAssigner = createAssigner;
47364
-
47365
- /**
47366
- * This method is like `_.assign` except that it recursively merges own and
47367
- * inherited enumerable string keyed properties of source objects into the
47368
- * destination object. Source properties that resolve to `undefined` are
47369
- * skipped if a destination value exists. Array and plain object properties
47370
- * are merged recursively. Other objects and value types are overridden by
47371
- * assignment. Source objects are applied from left to right. Subsequent
47372
- * sources overwrite property assignments of previous sources.
47373
- *
47374
- * **Note:** This method mutates `object`.
47375
- *
47376
- * @static
47377
- * @memberOf _
47378
- * @since 0.5.0
47379
- * @category Object
47380
- * @param {Object} object The destination object.
47381
- * @param {...Object} [sources] The source objects.
47382
- * @returns {Object} Returns `object`.
47383
- * @example
47384
- *
47385
- * var object = {
47386
- * 'a': [{ 'b': 2 }, { 'd': 4 }]
47387
- * };
47388
- *
47389
- * var other = {
47390
- * 'a': [{ 'c': 3 }, { 'e': 5 }]
47391
- * };
47392
- *
47393
- * _.merge(object, other);
47394
- * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
47395
- */
47396
- var merge = _createAssigner(function(object, source, srcIndex) {
47397
- _baseMerge(object, source, srcIndex);
47398
- });
47399
-
47400
- var merge_1 = merge;
47401
-
47402
- /**
47403
- * The options for a StyleControl object.
47404
- */
47405
- var StyleControlOptions = /** @class */ (function (_super) {
47406
- __extends(StyleControlOptions, _super);
47407
- function StyleControlOptions() {
47408
- var _this = _super !== null && _super.apply(this, arguments) || this;
47409
- /**
47410
- * The layout to display the styles in.
47411
- * <p>`"icons"`: A row of clickable icons for each style.</p>
47412
- * <p>`"list"`: A scrollable list with the icons and names for each style.</p>
47413
- * Default `"icons"`
47414
- * @default "icons"
47415
- */
47416
- _this.layout = "icons";
47417
- /**
47418
- * The map styles to show in the control.
47419
- * Style names are case sensitive.
47420
- * If an included style isn't supported by the map it will be ignored.
47421
- * Available styles can be found in the
47422
- * [supported styles]{@link https://docs.microsoft.com/en-us/azure/azure-maps/supported-map-styles} article.
47423
- * If "all" is specified, all map styles will be shown.
47424
- * Default `["road", "grayscale_light", "grayscale_dark", "night", "road_shaded_relief"]`
47425
- * @default ["road", "grayscale_light", "grayscale_dark", "night", "road_shaded_relief"]
47426
- */
47427
- _this.mapStyles = [
47428
- "road",
47429
- "grayscale_light",
47430
- "grayscale_dark",
47431
- "night",
47432
- "road_shaded_relief",
47433
- ];
47434
- /**
47435
- * The style of the control.
47436
- * Default `ControlStyle.light`.
47437
- * @default ControlStyle.light
47438
- */
47439
- _this.style = exports.ControlStyle.light;
47440
- /**
47441
- * Whether to let style control automatically set the style, once user select a map style.
47442
- * If set to `false`, then clicking on style will not set the set the style automatically.
47443
- * Default `true`
47444
- */
47445
- _this.autoSelectionMode = true;
47446
- /**
47447
- * theme
47448
- * when unset - all styles are selectable
47449
- */
47450
- _this.theme = undefined;
47451
- return _this;
47452
- }
47453
- return StyleControlOptions;
47454
- }(Options));
47455
-
47456
- /**
47457
- * A control for changing the style of the map.
47458
- */
47459
- var StyleControl = /** @class */ (function (_super) {
47460
- __extends(StyleControl, _super);
47461
- /**
47462
- * Constructs a StyleControl.
47463
- * @param options The options for the control.
47464
- */
47465
- function StyleControl(options) {
47466
- var _this = _super.call(this) || this;
47467
- _this.styleOpsGrid = null;
47468
- _this.hasMouse = false;
47469
- _this.hasFocus = false;
47470
- _this.styleButtons = new Dictionary();
47471
- _this.styleIcons = new Dictionary();
47472
- /**
47473
- * Callback handler for the style changing.
47474
- */
47475
- _this.onStyleChange = function () {
47476
- if (_this.options.autoSelectionMode) {
47477
- var newStyle = _this.map.getStyle().style;
47478
- _this.setSelectedStyle(newStyle);
47479
- }
47480
- };
47481
- _this.onStylesetChange = function (definitions) {
47482
- if (!_this.styleOpsGrid) {
47483
- return;
47484
- }
47485
- Array.from(_this.styleOpsGrid.children).forEach(function (element) { return element.remove(); });
47486
- _this.populateOpsGridFromDefinitions(definitions);
47487
- };
47488
- _this.mapToFriendlyStyleName = function (name, styleset) {
47489
- var style = styleset.styles.find(function (style) { return style.name === name; });
47490
- return (style === null || style === void 0 ? void 0 : style.displayName) || name;
47491
- };
47492
- _this.options = new StyleControlOptions().merge(cloneDeep_1(options));
47493
- return _this;
46813
+ var StyleControl = /** @class */ (function (_super) {
46814
+ __extends(StyleControl, _super);
46815
+ /**
46816
+ * Constructs a StyleControl.
46817
+ * @param options The options for the control.
46818
+ */
46819
+ function StyleControl(options) {
46820
+ var _this = _super.call(this) || this;
46821
+ _this.hasMouse = false;
46822
+ _this.hasFocus = false;
46823
+ _this.styleButtons = new Dictionary();
46824
+ _this.styleIcons = new Dictionary();
46825
+ /**
46826
+ * Callback handler for the style changing.
46827
+ */
46828
+ _this.onStyleChange = function () {
46829
+ if (_this.options.autoSelectionMode) {
46830
+ var newStyle = _this.map.getStyle().style;
46831
+ _this.setSelectedStyle(newStyle);
46832
+ }
46833
+ };
46834
+ _this.options = new StyleControlOptions().merge(cloneDeep_1(options));
46835
+ return _this;
47494
46836
  }
47495
46837
  /**
47496
46838
  * Initialization method for the control which is called when added to the map.
@@ -47502,9 +46844,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
47502
46844
  var _this = this;
47503
46845
  this.map = map;
47504
46846
  var container = this.buildContainer(map, this.options.style, "Map Style Control");
47505
- var styleOpsGrid = this.buildStyleOpsGrid();
47506
- this.styleOpsGrid = styleOpsGrid;
47507
- var currStyleButton = this.buildCurrStyleBtn();
46847
+ var styleOpsGrid = this.buildStyleOpsGrid(container);
46848
+ var currStyleButton = this.buildCurrStyleBtn(container, styleOpsGrid);
47508
46849
  var tooltip = buildAccessibleTooltip("Select Style");
47509
46850
  styleOpsGrid.classList.add(options ? options.position || 'top-right' : 'top-right');
47510
46851
  container.addEventListener("mouseover", function () {
@@ -47533,32 +46874,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
47533
46874
  }
47534
46875
  }
47535
46876
  });
47536
- // explictly hijack esc key behavior: we should not interrupt normal tab-navigation flow
47537
- // but focus out via esc from to the parent container should instead bring focus to the reveal button
47538
- styleOpsGrid.addEventListener('keydown', function (event) {
47539
- if (event.keyCode === 27) {
47540
- event.stopPropagation();
47541
- currStyleButton.focus();
47542
- if (container.classList.contains(StyleControl.Css.inUse)) {
47543
- container.classList.remove(StyleControl.Css.inUse);
47544
- styleOpsGrid.classList.add("hidden-accessible-element");
47545
- }
47546
- }
47547
- });
47548
- currStyleButton.addEventListener("click", function (event) {
47549
- if (container.classList.contains(StyleControl.Css.inUse)) {
47550
- container.classList.remove(StyleControl.Css.inUse);
47551
- styleOpsGrid.classList.add("hidden-accessible-element");
47552
- }
47553
- else {
47554
- container.classList.add(StyleControl.Css.inUse);
47555
- styleOpsGrid.classList.remove("hidden-accessible-element");
47556
- // clicking on a reveal button should move the focus to the first styleOpsGrid button
47557
- if (styleOpsGrid.firstElementChild) {
47558
- styleOpsGrid.firstElementChild.focus();
47559
- }
47560
- }
47561
- });
47562
46877
  if (options && StyleControl.InvertOrderPositions.includes(options.position)) {
47563
46878
  container.appendChild(styleOpsGrid);
47564
46879
  container.appendChild(currStyleButton);
@@ -47579,10 +46894,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
47579
46894
  */
47580
46895
  StyleControl.prototype.onRemove = function () {
47581
46896
  _super.prototype.onRemove.call(this);
47582
- this.styleOpsGrid = null;
47583
46897
  this.styleButtons.clear();
47584
46898
  this.map.events.remove("styledata", this.onStyleChange);
47585
- this.map.events.remove("stylesetchanged", this.onStylesetChange);
47586
46899
  };
47587
46900
  /**
47588
46901
  * Set the style that need to be displayed as currently selected.
@@ -47590,22 +46903,19 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
47590
46903
  * @param styleName - Style name that need to be disabled as currently selected
47591
46904
  */
47592
46905
  StyleControl.prototype.setSelectedStyle = function (styleName) {
47593
- var _this = this;
47594
46906
  if (this.styleIcons.has(styleName)) {
47595
- var image_1 = this.currStyleImage;
46907
+ var image = this.currStyleImage;
47596
46908
  var newSrc = this.styleIcons.get(styleName);
47597
- if (image_1.src !== newSrc) {
47598
- image_1.src = newSrc;
46909
+ if (image.src !== newSrc) {
46910
+ image.src = newSrc;
46911
+ }
46912
+ var newAlt = this.mapToFriendlyStyleName(styleName);
46913
+ if (image.alt !== newAlt) {
46914
+ image.alt = newAlt;
46915
+ }
46916
+ if (image.parentElement.lastChild instanceof Text) {
46917
+ image.parentElement.lastChild.textContent = newAlt;
47599
46918
  }
47600
- this.map.styles.definitions().then(function (styleset) {
47601
- var newAlt = _this.mapToFriendlyStyleName(styleName, styleset);
47602
- if (image_1.alt !== newAlt) {
47603
- image_1.alt = newAlt;
47604
- }
47605
- if (image_1.parentElement.lastChild instanceof Text) {
47606
- image_1.parentElement.lastChild.textContent = newAlt;
47607
- }
47608
- });
47609
46919
  }
47610
46920
  };
47611
46921
  /**
@@ -47628,30 +46938,14 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
47628
46938
  styleButton.removeAttribute("disabled");
47629
46939
  }
47630
46940
  };
47631
- StyleControl.prototype.buildSelectStyleBtn = function (name, styleset, fetchIconPromise) {
46941
+ StyleControl.prototype.buildSelectStyleBtn = function (name, icon) {
47632
46942
  var _this = this;
47633
46943
  var styleOptionButton = document.createElement("button");
47634
- var friendlyName = this.mapToFriendlyStyleName(name, styleset);
46944
+ var friendlyName = this.mapToFriendlyStyleName(name);
47635
46945
  styleOptionButton.setAttribute("alt", friendlyName);
47636
46946
  styleOptionButton.setAttribute("type", "button");
47637
46947
  var styleIconImage = new Image();
47638
- fetchIconPromise
47639
- .then(function (response) { return response.blob(); })
47640
- .then(function (blob) {
47641
- var iconUrl = URL.createObjectURL(blob);
47642
- styleIconImage.src = iconUrl;
47643
- if (name === _this.map.getStyle().style) {
47644
- _this.currStyleImage.src = iconUrl;
47645
- _this.currStyleImage.alt = friendlyName;
47646
- if (_this.currStyleImage.parentElement.lastChild.nodeType == Node.TEXT_NODE) {
47647
- _this.currStyleImage.parentElement.lastChild.textContent = friendlyName;
47648
- }
47649
- else {
47650
- _this.currStyleImage.parentElement.appendChild(document.createTextNode(friendlyName));
47651
- }
47652
- }
47653
- _this.styleIcons.set(name, iconUrl);
47654
- });
46948
+ styleIconImage.src = icon;
47655
46949
  if (this.options.layout === "icons") {
47656
46950
  styleIconImage.alt = friendlyName;
47657
46951
  }
@@ -47684,8 +46978,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
47684
46978
  styleOptionButton.appendChild(iconDiv);
47685
46979
  return styleOptionButton;
47686
46980
  };
47687
- StyleControl.prototype.buildCurrStyleBtn = function () {
47688
- var selectCurrButton = document.createElement("button");
46981
+ StyleControl.prototype.buildCurrStyleBtn = function (container, opsGrid) {
46982
+ var selectCurrButton = document.createElement("div");
47689
46983
  if (this.options.layout == 'icons') {
47690
46984
  selectCurrButton.classList.add(StyleControl.Css.button);
47691
46985
  }
@@ -47695,7 +46989,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
47695
46989
  selectCurrButton.classList.add(StyleControl.Css.currentStyle);
47696
46990
  selectCurrButton.setAttribute("aria-label", "Select Style");
47697
46991
  selectCurrButton.setAttribute("alt", "Select Style");
47698
- selectCurrButton.setAttribute("tabindex", "-1");
47699
46992
  this.currStyleImage = new Image();
47700
46993
  selectCurrButton.appendChild(this.currStyleImage);
47701
46994
  var selectCurrButtonIcon = document.createElement("div");
@@ -47703,7 +46996,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
47703
46996
  selectCurrButton.appendChild(selectCurrButtonIcon);
47704
46997
  return selectCurrButton;
47705
46998
  };
47706
- StyleControl.prototype.buildStyleOpsGrid = function () {
46999
+ StyleControl.prototype.buildStyleOpsGrid = function (container) {
47707
47000
  var _this = this;
47708
47001
  var styleOpsGrid = document.createElement("div");
47709
47002
  styleOpsGrid.classList.add(StyleControl.Css.styleOptions);
@@ -47717,54 +47010,86 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
47717
47010
  styleOpsGrid.classList.add("hidden-accessible-element");
47718
47011
  // Once the map's style definition is initialized create a map between style names and icons.
47719
47012
  // If a style is one of those to be shown by the style picker also create it's element.
47720
- this.map.styles.definitions().then(function (definitions) { return __awaiter(_this, void 0, void 0, function () {
47721
- return __generator(this, function (_a) {
47722
- this.onStylesetChange(definitions);
47723
- this.map.events.add("styledata", this.onStyleChange);
47724
- return [2 /*return*/];
47013
+ this.map.styles.initialize().then(function () {
47014
+ var e_1, _a, _b;
47015
+ var styleDef = _this.map.styles.getDef();
47016
+ var currStyle = _this.map.getStyle().style;
47017
+ try {
47018
+ for (var _c = __values(styleDef.styles), _d = _c.next(); !_d.done; _d = _c.next()) {
47019
+ var style = _d.value;
47020
+ var iconUrl = style.thumbnail;
47021
+ // It will make sure anyone using custom endpoint for style definition,
47022
+ // can use there own custom thumbnail url.
47023
+ if (iconUrl.indexOf(constants.stylePathHolder) > -1 ||
47024
+ iconUrl.indexOf(constants.styleResourcePlaceholder) > -1) {
47025
+ iconUrl = new Url({
47026
+ domain: env.staticAssetsDomain,
47027
+ path: style.thumbnail
47028
+ .replace(constants.stylePathHolder, constants.stylePath)
47029
+ .replace(constants.styleResourcePlaceholder, constants.styleResourcePath),
47030
+ queryParams: (_b = {},
47031
+ _b[constants.apiVersionQueryParameter] = constants.styleApiVersion,
47032
+ _b)
47033
+ }).toString();
47034
+ }
47035
+ // Always add a style even if it won't be shown by the style picker.
47036
+ // This way the map's style can be set to something other than the picker.
47037
+ // The style picker will still show the correct icon.
47038
+ _this.styleIcons.set(style.name, iconUrl);
47039
+ if (style.name === currStyle) {
47040
+ _this.currStyleImage.src = iconUrl;
47041
+ _this.currStyleImage.alt = _this.mapToFriendlyStyleName(style.name);
47042
+ _this.currStyleImage.parentElement.appendChild(document.createTextNode(_this.mapToFriendlyStyleName(style.name)));
47043
+ }
47044
+ }
47045
+ }
47046
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
47047
+ finally {
47048
+ try {
47049
+ if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
47050
+ }
47051
+ finally { if (e_1) throw e_1.error; }
47052
+ }
47053
+ if (_this.options.mapStyles === "all") {
47054
+ _this.styleIcons.forEach(function (iconUrl, styleName) {
47055
+ var styleOptionButton = _this.buildSelectStyleBtn(styleName, iconUrl);
47056
+ styleOpsGrid.appendChild(styleOptionButton);
47057
+ _this.styleButtons[styleName] = styleOptionButton;
47058
+ if (_this.options.layout === "icons") {
47059
+ var tooltip = buildAccessibleTooltip(_this.mapToFriendlyStyleName(styleName));
47060
+ styleOpsGrid.appendChild(tooltip);
47061
+ positionTooltip(tooltip, styleOptionButton);
47062
+ }
47063
+ });
47064
+ }
47065
+ else {
47066
+ _this.options.mapStyles.filter(function (styleName) { return _this.styleIcons.has(styleName); }).forEach(function (styleName) {
47067
+ var iconUrl = _this.styleIcons.get(styleName);
47068
+ var styleOptionButton = _this.buildSelectStyleBtn(styleName, iconUrl);
47069
+ styleOpsGrid.appendChild(styleOptionButton);
47070
+ _this.styleButtons[styleName] = styleOptionButton;
47071
+ if (_this.options.layout === "icons") {
47072
+ var tooltip = buildAccessibleTooltip(_this.mapToFriendlyStyleName(styleName));
47073
+ styleOpsGrid.appendChild(tooltip);
47074
+ positionTooltip(tooltip, styleOptionButton);
47075
+ }
47076
+ });
47077
+ }
47078
+ Object.entries(_this.styleButtons).forEach(function (_a) {
47079
+ var _b = __read(_a, 2), styleName = _b[0], button = _b[1];
47080
+ return button.setAttribute('aria-current', styleName === currStyle ? 'true' : 'false');
47725
47081
  });
47726
- }); });
47727
- this.map.events.add("stylesetchanged", this.onStylesetChange);
47082
+ _this.map.events.add("styledata", _this.onStyleChange);
47083
+ });
47728
47084
  return styleOpsGrid;
47729
47085
  };
47730
- StyleControl.prototype.populateOpsGridFromDefinitions = function (definitions) {
47731
- var _this = this;
47732
- if (!this.styleOpsGrid) {
47733
- return;
47734
- }
47735
- var styles = definitions.styles;
47736
- if (Array.isArray(this.options.mapStyles)) {
47737
- styles = styles.filter(function (style) { return _this.options.mapStyles.includes(style.name.split("_indoor")[0]); });
47738
- }
47739
- if (this.options.theme) {
47740
- styles = styles.filter(function (style) { return style.theme === _this.options.theme; });
47741
- }
47742
- styles.forEach(function (style) {
47743
- // Create fetch thumbnail request
47744
- var requestParams = {
47745
- url: style.thumbnail
47746
- };
47747
- style.thumbnail && _this.map.styles._transformStyleRequest(style.thumbnail, requestParams);
47748
- // Apply the users specified transform after ours
47749
- var mapServiceOptions = _this.map.getServiceOptions();
47750
- if (mapServiceOptions.transformRequest) {
47751
- merge_1(requestParams, mapServiceOptions.transformRequest(requestParams.url, "Thumbnail"));
47752
- }
47753
- var fetchThumbnailPromise = fetch(requestParams.url, { headers: requestParams.headers });
47754
- // Add button for each style
47755
- var styleOptionButton = _this.buildSelectStyleBtn(style.name, definitions, fetchThumbnailPromise);
47756
- _this.styleOpsGrid.appendChild(styleOptionButton);
47757
- _this.styleButtons[style.name] = styleOptionButton;
47758
- if (_this.options.layout === "icons") {
47759
- var tooltip = buildAccessibleTooltip(_this.mapToFriendlyStyleName(style.name, definitions));
47760
- _this.styleOpsGrid.appendChild(tooltip);
47761
- positionTooltip(tooltip, styleOptionButton);
47762
- }
47763
- });
47764
- Object.entries(this.styleButtons).forEach(function (_a) {
47765
- var _b = __read(_a, 2), styleName = _b[0], button = _b[1];
47766
- return button.setAttribute('aria-current', styleName === _this.map.getStyle().style ? 'true' : 'false');
47767
- });
47086
+ StyleControl.prototype.mapToFriendlyStyleName = function (name) {
47087
+ // TODO: Bug 9984684 - Revert indoor specific logic her.
47088
+ return StyleControl.StyleNamesMap[name] ?
47089
+ StyleControl.StyleNamesMap[name] :
47090
+ StyleControl.StyleNamesMap[name + "_indoor"] ?
47091
+ StyleControl.StyleNamesMap[name + "_indoor"] :
47092
+ name;
47768
47093
  };
47769
47094
  StyleControl.InvertOrderPositions = [exports.ControlPosition.TopRight, exports.ControlPosition.BottomRight];
47770
47095
  StyleControl.Css = {
@@ -47776,6 +47101,19 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
47776
47101
  styleOptions: "style-options",
47777
47102
  dropdown: "azure-maps-control-dropdown"
47778
47103
  };
47104
+ StyleControl.StyleNamesMap = {
47105
+ road: "Road",
47106
+ satellite: "Satellite",
47107
+ satellite_road_labels: "Hybrid",
47108
+ grayscale_dark: "Grayscale (Dark)",
47109
+ grayscale_light: "Grayscale (Light)",
47110
+ night: "Night",
47111
+ road_shaded_relief: "Terra",
47112
+ blank: "Blank",
47113
+ blank_accessible: "Blank (Accessible)",
47114
+ high_contrast_dark: "High contrast (Dark)",
47115
+ high_contrast_light: "High contrast (Light)"
47116
+ };
47779
47117
  return StyleControl;
47780
47118
  }(ControlBase));
47781
47119
 
@@ -48391,10 +47729,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
48391
47729
  var COMPARE_PARTIAL_FLAG$2 = 1;
48392
47730
 
48393
47731
  /** Used for built-in method references. */
48394
- var objectProto$e = Object.prototype;
47732
+ var objectProto$d = Object.prototype;
48395
47733
 
48396
47734
  /** Used to check objects for own properties. */
48397
- var hasOwnProperty$b = objectProto$e.hasOwnProperty;
47735
+ var hasOwnProperty$a = objectProto$d.hasOwnProperty;
48398
47736
 
48399
47737
  /**
48400
47738
  * A specialized version of `baseIsEqualDeep` for objects with support for
@@ -48422,7 +47760,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
48422
47760
  var index = objLength;
48423
47761
  while (index--) {
48424
47762
  var key = objProps[index];
48425
- if (!(isPartial ? key in other : hasOwnProperty$b.call(other, key))) {
47763
+ if (!(isPartial ? key in other : hasOwnProperty$a.call(other, key))) {
48426
47764
  return false;
48427
47765
  }
48428
47766
  }
@@ -48481,13 +47819,13 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
48481
47819
  /** `Object#toString` result references. */
48482
47820
  var argsTag$3 = '[object Arguments]',
48483
47821
  arrayTag$2 = '[object Array]',
48484
- objectTag$4 = '[object Object]';
47822
+ objectTag$3 = '[object Object]';
48485
47823
 
48486
47824
  /** Used for built-in method references. */
48487
- var objectProto$f = Object.prototype;
47825
+ var objectProto$e = Object.prototype;
48488
47826
 
48489
47827
  /** Used to check objects for own properties. */
48490
- var hasOwnProperty$c = objectProto$f.hasOwnProperty;
47828
+ var hasOwnProperty$b = objectProto$e.hasOwnProperty;
48491
47829
 
48492
47830
  /**
48493
47831
  * A specialized version of `baseIsEqual` for arrays and objects which performs
@@ -48509,11 +47847,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
48509
47847
  objTag = objIsArr ? arrayTag$2 : _getTag(object),
48510
47848
  othTag = othIsArr ? arrayTag$2 : _getTag(other);
48511
47849
 
48512
- objTag = objTag == argsTag$3 ? objectTag$4 : objTag;
48513
- othTag = othTag == argsTag$3 ? objectTag$4 : othTag;
47850
+ objTag = objTag == argsTag$3 ? objectTag$3 : objTag;
47851
+ othTag = othTag == argsTag$3 ? objectTag$3 : othTag;
48514
47852
 
48515
- var objIsObj = objTag == objectTag$4,
48516
- othIsObj = othTag == objectTag$4,
47853
+ var objIsObj = objTag == objectTag$3,
47854
+ othIsObj = othTag == objectTag$3,
48517
47855
  isSameTag = objTag == othTag;
48518
47856
 
48519
47857
  if (isSameTag && isBuffer_1(object)) {
@@ -48530,8 +47868,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
48530
47868
  : _equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
48531
47869
  }
48532
47870
  if (!(bitmask & COMPARE_PARTIAL_FLAG$3)) {
48533
- var objIsWrapped = objIsObj && hasOwnProperty$c.call(object, '__wrapped__'),
48534
- othIsWrapped = othIsObj && hasOwnProperty$c.call(other, '__wrapped__');
47871
+ var objIsWrapped = objIsObj && hasOwnProperty$b.call(object, '__wrapped__'),
47872
+ othIsWrapped = othIsObj && hasOwnProperty$b.call(other, '__wrapped__');
48535
47873
 
48536
47874
  if (objIsWrapped || othIsWrapped) {
48537
47875
  var objUnwrapped = objIsWrapped ? object.value() : object,
@@ -48888,6 +48226,87 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
48888
48226
  return Point;
48889
48227
  }());
48890
48228
 
48229
+ var arrayPoints = createCommonjsModule(function (module, exports) {
48230
+ exports.__esModule = true;
48231
+ function getAddedSquaresAP(dx, dy) {
48232
+ return dx * dx + dy * dy;
48233
+ }
48234
+ function getSqDistAP(p1, p2) {
48235
+ return getAddedSquaresAP(p1[0] - p2[0], p1[1] - p2[1]);
48236
+ }
48237
+ function getSqSegDistAP(p, p1, p2) {
48238
+ var x = p1[0], y = p1[1], dx = p2[0] - x, dy = p2[1] - y;
48239
+ if (dx !== 0 || dy !== 0) {
48240
+ var t = ((p[0] - x) * dx + (p[1] - y) * dy) / getAddedSquaresAP(dx, dy);
48241
+ if (t > 1) {
48242
+ x = p2[0];
48243
+ y = p2[1];
48244
+ }
48245
+ else if (t > 0) {
48246
+ x += dx * t;
48247
+ y += dy * t;
48248
+ }
48249
+ }
48250
+ return getAddedSquaresAP(p[0] - x, p[1] - y);
48251
+ }
48252
+ function simplifyRadialDistAP(points, sqTolerance) {
48253
+ var prevPoint = points[0], point;
48254
+ var newPoints = [prevPoint];
48255
+ for (var i = 1, len = points.length; i < len; i++) {
48256
+ point = points[i];
48257
+ if (getSqDistAP(point, prevPoint) > sqTolerance) {
48258
+ newPoints.push(point);
48259
+ prevPoint = point;
48260
+ }
48261
+ }
48262
+ if (prevPoint !== point) {
48263
+ newPoints.push(point);
48264
+ }
48265
+ return newPoints;
48266
+ }
48267
+ function simplifyDPStepAP(points, first, last, sqTolerance, simplified) {
48268
+ var maxSqDist = sqTolerance, index;
48269
+ for (var i = first + 1; i < last; i++) {
48270
+ var sqDist = getSqSegDistAP(points[i], points[first], points[last]);
48271
+ if (sqDist > maxSqDist) {
48272
+ index = i;
48273
+ maxSqDist = sqDist;
48274
+ }
48275
+ }
48276
+ if (maxSqDist > sqTolerance) {
48277
+ if (index - first > 1) {
48278
+ simplifyDPStepAP(points, first, index, sqTolerance, simplified);
48279
+ }
48280
+ simplified.push(points[index]);
48281
+ if (last - index > 1) {
48282
+ simplifyDPStepAP(points, index, last, sqTolerance, simplified);
48283
+ }
48284
+ }
48285
+ }
48286
+ function simplifyDouglasPeuckerAP(points, sqTolerance) {
48287
+ var last = points.length - 1;
48288
+ var simplified = [points[0]];
48289
+ simplifyDPStepAP(points, 0, last, sqTolerance, simplified);
48290
+ simplified.push(points[last]);
48291
+ return simplified;
48292
+ }
48293
+ function SimplifyAP(points, tolerance, highestQuality) {
48294
+ if (tolerance === void 0) { tolerance = 1; }
48295
+ if (highestQuality === void 0) { highestQuality = false; }
48296
+ if (points.length <= 2) {
48297
+ return points;
48298
+ }
48299
+ var sqTolerance = tolerance * tolerance;
48300
+ points = highestQuality ? points : simplifyRadialDistAP(points, sqTolerance);
48301
+ points = simplifyDouglasPeuckerAP(points, sqTolerance);
48302
+ return points;
48303
+ }
48304
+ exports.SimplifyAP = SimplifyAP;
48305
+ });
48306
+
48307
+ unwrapExports(arrayPoints);
48308
+ var arrayPoints_1 = arrayPoints.SimplifyAP;
48309
+
48891
48310
  //////////////////////
48892
48311
  /// Constants
48893
48312
  //////////////////////
@@ -50964,6 +50383,16 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
50964
50383
  }
50965
50384
  return result;
50966
50385
  }
50386
+ /**
50387
+ * Perform a Douglas-Peucker simplification on an array of positions or pixels.
50388
+ * @param points The position or pixel points to simplify.
50389
+ * @param tolerance A tolerance to use in the simplification.
50390
+ * @returns A new array of the simplified set of points.
50391
+ */
50392
+ function simplify(points, tolerance) {
50393
+ //Perform a Douglas-Peucker simplification of the pixels.
50394
+ return arrayPoints_1(points, tolerance, true);
50395
+ }
50967
50396
 
50968
50397
  /**
50969
50398
  * A GeoJSON Position object - an array that specifies the longitude and latitude of a location. The
@@ -51163,374 +50592,620 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
51163
50592
  }());
51164
50593
 
51165
50594
  /**
51166
- * A helper class that wraps a Geometry or Feature and makes it easy to update and maintain.
50595
+ * An Affine Transform class generated from a set of reference points.
51167
50596
  */
51168
- var Shape = /** @class */ (function (_super) {
51169
- __extends(Shape, _super);
51170
- function Shape(data, id, properties) {
51171
- var _this = _super.call(this) || this;
51172
- var geometry;
51173
- if (data.type === "Feature") {
51174
- var feature = data;
51175
- geometry = cloneDeep_1(feature.geometry);
51176
- properties = feature.properties ? cloneDeep_1(feature.properties) : {};
51177
- id = feature.id == null || feature.id === "" ? uuidRandom() : feature.id;
51178
- }
51179
- else {
51180
- geometry = cloneDeep_1(data);
51181
- id = id == null || id === "" ? uuidRandom() : id;
51182
- properties = properties ? cloneDeep_1(properties) : {};
51183
- }
51184
- // Assign the feature's id to another property to workaround the Mapbox bug
51185
- // that prevents non-numerical ids from being returned by some functions.
51186
- // TODO Remove once this issue if fixed. https://github.com/mapbox/mapbox-gl-js/issues/2716
51187
- properties[Shape._shapeIdPropName] = id;
51188
- // Always create a new feature to guarantee the data matches our definition of a Feature.
51189
- _this.data = new Feature(geometry, properties, id);
51190
- _this._handleCircle();
51191
- return _this;
50597
+ var AffineTransform = /** @class */ (function () {
50598
+ /**
50599
+ * An Affine Transform class generated from a set of reference points.
50600
+ * @param source A set of reference points from the source reference system to transform from.
50601
+ * @param target A set of reference points from the target reference system to transform to.
50602
+ */
50603
+ function AffineTransform(source, target) {
50604
+ this.M = AffineTransform._calculateAffineTransform(source, target);
50605
+ this.inverseM = AffineTransform._calculateAffineTransform(target, source);
51192
50606
  }
51193
50607
  /**
51194
- * Adds or updates an existing property value in the shape.
51195
- * @param key
51196
- * @param value
50608
+ * Converts an array of points from the source reference system to the target reference system.
50609
+ * @param sourcePoints An array of points from the source reference system to transform.
50610
+ * @param decimals Number of decimal places to round the results off to.
50611
+ * @returns An array of points that have been transformed to the target reference system.
51197
50612
  */
51198
- Shape.prototype.addProperty = function (key, value) {
51199
- // Only add the property if it is a new value.
51200
- if (!isEqual_1(this.data.properties[key], value)) {
51201
- this.data.properties[key] = cloneDeep_1(value);
51202
- if (key === "subType" || key === "radius") {
51203
- this._handleCircle();
51204
- }
51205
- if (this.dataSource) {
51206
- this.dataSource._updateSource();
51207
- }
51208
- this._invokeEvent("shapechanged", this);
50613
+ AffineTransform.prototype.toTarget = function (sourcePoints, decimals) {
50614
+ if (typeof sourcePoints !== undefined) {
50615
+ return this.transformArray(sourcePoints, this.M, decimals);
51209
50616
  }
50617
+ throw new Error("Invalid sourcePoints specified.");
51210
50618
  };
51211
50619
  /**
51212
- * Gets the bounding box of the shape
50620
+ * Converts an array of points from the target reference system to the source reference system.
50621
+ * @param targetPoints An array of points from the target reference system to transform.
50622
+ * @param decimals Number of decimal places to round the results off to.
50623
+ * @returns An array of points that have been transformed to the source reference system.
51213
50624
  */
51214
- Shape.prototype.getBounds = function () {
51215
- var e_1, _a, e_2, _b;
51216
- var positions = this.getCoordinates();
51217
- var bbox;
51218
- var geoType = this.getType();
51219
- if (geoType === "Point") {
51220
- if (this.circlePolygon) { // If a circle from the extended GeoJSON spec.
51221
- var pos = this.circlePolygon.geometry.coordinates;
51222
- bbox = BoundingBox.fromPositions(pos[0]);
51223
- }
51224
- else {
51225
- var pos = positions;
51226
- bbox = new BoundingBox(pos, pos);
51227
- }
51228
- }
51229
- else if (geoType === "MultiPoint" || geoType === "LineString") {
51230
- var pos = positions;
51231
- bbox = BoundingBox.fromPositions(pos);
51232
- }
51233
- else if (geoType === "Polygon") {
51234
- var pos = positions;
51235
- // only need to check the exterior ring of Polygon
51236
- bbox = BoundingBox.fromPositions(pos[0]);
50625
+ AffineTransform.prototype.toSource = function (targetPoints, decimals) {
50626
+ if (typeof targetPoints !== undefined) {
50627
+ return this.transformArray(targetPoints, this.inverseM, decimals);
51237
50628
  }
51238
- else if (geoType === "MultiLineString") {
51239
- var pos = positions;
50629
+ throw new Error("Invalid targetPoints specified.");
50630
+ };
50631
+ /**
50632
+ * Applies a transform matrix over a set of points and optionally rounds off the values to a specified number of decimals.
50633
+ * @param points The array of points to transform.
50634
+ * @param transformMatrix The transform matrix to apply.
50635
+ * @param decimals The number of decimals to round each calculated point value off to.
50636
+ * @returns An array of points that have been transformed.
50637
+ */
50638
+ AffineTransform.prototype.transformArray = function (points, transformMatrix, decimals) {
50639
+ var e_1, _a;
50640
+ if (points && Array.isArray(points) && Array.isArray(points[0])) {
50641
+ var pos = [];
51240
50642
  try {
51241
- for (var pos_1 = __values(pos), pos_1_1 = pos_1.next(); !pos_1_1.done; pos_1_1 = pos_1.next()) {
51242
- var p = pos_1_1.value;
51243
- bbox = BoundingBox.merge(bbox, BoundingBox.fromPositions(p));
50643
+ for (var points_1 = __values(points), points_1_1 = points_1.next(); !points_1_1.done; points_1_1 = points_1.next()) {
50644
+ var subPoints = points_1_1.value;
50645
+ pos.push(this.transform(subPoints, transformMatrix, decimals));
51244
50646
  }
51245
50647
  }
51246
50648
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
51247
50649
  finally {
51248
50650
  try {
51249
- if (pos_1_1 && !pos_1_1.done && (_a = pos_1.return)) _a.call(pos_1);
50651
+ if (points_1_1 && !points_1_1.done && (_a = points_1.return)) _a.call(points_1);
51250
50652
  }
51251
50653
  finally { if (e_1) throw e_1.error; }
51252
50654
  }
50655
+ return pos;
51253
50656
  }
51254
- else if (geoType === "MultiPolygon") {
51255
- var pos = positions;
51256
- try {
51257
- for (var pos_2 = __values(pos), pos_2_1 = pos_2.next(); !pos_2_1.done; pos_2_1 = pos_2.next()) {
51258
- var p1 = pos_2_1.value;
51259
- // only need to check the exterior ring of Polygon
51260
- bbox = BoundingBox.merge(bbox, BoundingBox.fromPositions(p1[0]));
51261
- }
51262
- }
51263
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
51264
- finally {
51265
- try {
51266
- if (pos_2_1 && !pos_2_1.done && (_b = pos_2.return)) _b.call(pos_2);
51267
- }
51268
- finally { if (e_2) throw e_2.error; }
51269
- }
51270
- }
51271
- return bbox;
51272
- };
51273
- /**
51274
- * Gets the coordinates of the shape.
51275
- */
51276
- Shape.prototype.getCoordinates = function () {
51277
- return cloneDeep_1(this.data.geometry.coordinates);
51278
- };
51279
- /**
51280
- * If the shape is a circle, this gets its coordinates. Otherwise returns null.
51281
- */
51282
- Shape.prototype.getCircleCoordinates = function () {
51283
- if (this.circlePolygon) {
51284
- return cloneDeep_1(this.circlePolygon.geometry.coordinates[0]);
51285
- }
51286
- else {
51287
- return null;
51288
- }
51289
- };
51290
- /**
51291
- * Gets the id of the shape.
51292
- */
51293
- Shape.prototype.getId = function () {
51294
- return this.data.id;
51295
- };
51296
- /**
51297
- * Gets the properties of the shape.
51298
- */
51299
- Shape.prototype.getProperties = function () {
51300
- return cloneDeep_1(this.data.properties);
51301
- };
51302
- /**
51303
- * Returns a string indicating the type of geometry this shape contains.
51304
- */
51305
- Shape.prototype.getType = function () {
51306
- return this.data.geometry.type;
51307
- };
51308
- /**
51309
- * Indicates if the contained shape is a Circle, defined by the extended GeoJSON specification supported by Azure Maps.
51310
- * [Extended Spec]{@link https://docs.microsoft.com/en-us/azure/azure-maps/extend-geojson}
51311
- */
51312
- Shape.prototype.isCircle = function () {
51313
- return Shape._isCircle(this.data);
50657
+ return null;
51314
50658
  };
51315
50659
  /**
51316
- * Indicates if the contained shape is a Rectangle, defined by the extended GeoJSON specification supported by Azure Maps.
51317
- * [Extended Spec]{@link https://docs.microsoft.com/en-us/azure/azure-maps/extend-geojson}
50660
+ * Applies a transform matrix on a point and optionally rounds off the values to a specified number of decimals.
50661
+ * @param point The point to transform.
50662
+ * @param transformMatrix The transform matrix to apply.
50663
+ * @param decimals The number of decimals to round each calculated point value off to.
50664
+ * @returns An array of points that have been transformed.
51318
50665
  */
51319
- Shape.prototype.isRectangle = function () {
51320
- return Shape._isRectangle(this.data);
50666
+ AffineTransform.prototype.transform = function (point, transformMatrix, decimals) {
50667
+ var x = point[0] * transformMatrix[0][3] + point[1] * transformMatrix[1][3] + transformMatrix[2][3];
50668
+ var y = point[0] * transformMatrix[0][4] + point[1] * transformMatrix[1][4] + transformMatrix[2][4];
50669
+ return typeof decimals === "number" && decimals >= 0 ?
50670
+ [_precision(x, decimals), _precision(y, decimals)] :
50671
+ [_precision(x, 6), _precision(y, 6)];
51321
50672
  };
51322
50673
  /**
51323
- * Updates the coordinates of the shape
51324
- * @param coords Point: Position, LineString: Position[], Polygon: Position[][],
51325
- * MultiPoint: Position[], MultiLineString: Position[][], MultiPolygon: Position[][]
50674
+ * Takes in a set of source and target points can calculates an approximate Affine Transform matrix that best fits the data.
50675
+ * Modified version of this code: https://github.com/commenthol/affinefit
50676
+ * @param sourcePoints A set of source points to transform from.
50677
+ * @param targetPoints A set of target points to transform to.
50678
+ * @returns An Affine Tranform matrix.
51326
50679
  */
51327
- Shape.prototype.setCoordinates = function (coords) {
51328
- // If a Position[] is supplied for a polygon wrap it in an array.
51329
- var newCoords;
51330
- if (this.getType() === "Polygon" &&
51331
- Position._getDimensions(coords) === 1) {
51332
- newCoords = [coords];
51333
- }
51334
- else {
51335
- newCoords = coords;
50680
+ AffineTransform._calculateAffineTransform = function (sourcePoints, targetPoints) {
50681
+ if (sourcePoints.length !== targetPoints.length || sourcePoints.length < 1) {
50682
+ throw new Error("Error: source and target arrays must have the same length.");
51336
50683
  }
51337
- // Only update the coordinates if they've actually changed.
51338
- if (!isEqual_1(this.data.geometry.coordinates, newCoords)) {
51339
- this.data.geometry.coordinates = cloneDeep_1(newCoords);
51340
- this._handleCircle();
51341
- if (this.dataSource) {
51342
- this.dataSource._updateSource();
51343
- }
51344
- this._invokeEvent("shapechanged", this);
50684
+ // Use the smallest dimension of the input.
50685
+ var dim = Math.min(sourcePoints[0].length, targetPoints[0].length);
50686
+ var dimPlusOne = dim + 1;
50687
+ if (sourcePoints.length < dim) {
50688
+ throw new Error("Erorr: At least " + dim + " reference points required.");
51345
50689
  }
51346
- };
51347
- /**
51348
- * Sets the properties on the shape. Overwrites all existing properties.
51349
- * @param properties
51350
- */
51351
- Shape.prototype.setProperties = function (properties) {
51352
- // Assign the feature's id to another property to workaround the Mapbox bug
51353
- // that prevents non-numerical ids from being returned by some functions.
51354
- // TODO Remove once this issue if fixed. https://github.com/mapbox/mapbox-gl-js/issues/2716
51355
- properties[Shape._shapeIdPropName] = this.data.id;
51356
- // Only update the properties if they've actually changed.
51357
- if (!isEqual_1(this.data.properties, properties)) {
51358
- this.data.properties = cloneDeep_1(properties);
51359
- this._handleCircle();
51360
- if (this.dataSource) {
51361
- this.dataSource._updateSource();
50690
+ // Create an empty (dim + 1) x (dim) matrix and fill it.
50691
+ var c = [];
50692
+ var transformMatrix = [];
50693
+ for (var i = 0; i < dimPlusOne; i++) {
50694
+ transformMatrix[i] = [];
50695
+ for (var j = 0; j < dimPlusOne; j++) {
50696
+ if (j < dim) {
50697
+ c[j] = 0;
50698
+ }
50699
+ transformMatrix[i][j] = 0;
50700
+ for (var k = 0; k < sourcePoints.length; k++) {
50701
+ if (j < dim) {
50702
+ if (i < dim) {
50703
+ c[j] += sourcePoints[k][i] * targetPoints[k][j];
50704
+ }
50705
+ else {
50706
+ c[j] += targetPoints[k][j];
50707
+ }
50708
+ }
50709
+ if (i >= dim && j >= dim) {
50710
+ transformMatrix[i][j] += 1;
50711
+ }
50712
+ else if (i >= dim) {
50713
+ transformMatrix[i][j] += sourcePoints[k][j];
50714
+ }
50715
+ else if (j >= dim) {
50716
+ transformMatrix[i][j] += sourcePoints[k][i];
50717
+ }
50718
+ else {
50719
+ transformMatrix[i][j] += sourcePoints[k][i] * sourcePoints[k][j];
50720
+ }
50721
+ }
51362
50722
  }
51363
- this._invokeEvent("shapechanged", this);
51364
- }
51365
- };
51366
- /**
51367
- * Returns a GeoJSON feature that represents the shape.
51368
- */
51369
- Shape.prototype.toJson = function () {
51370
- return JSON.parse(JSON.stringify(this.data));
51371
- };
51372
- /**
51373
- * Just like the toJson() function but will return a polygon feature
51374
- * for any circles as defined by the extended GeoJSON spec.
51375
- * [Extended Spec]{@link https://docs.microsoft.com/en-us/azure/azure-maps/extend-geojson}
51376
- * @internal
51377
- */
51378
- Shape.prototype._toJson = function () {
51379
- return this.circlePolygon || this.data;
51380
- };
51381
- /**
51382
- * @internal
51383
- */
51384
- Shape.prototype._setDataSource = function (dataSource) {
51385
- if (dataSource === undefined || dataSource == null) {
51386
- delete this.dataSource;
50723
+ transformMatrix[i] = transformMatrix[i].concat(c);
51387
50724
  }
51388
- else {
51389
- this.dataSource = dataSource;
50725
+ if (!this._gaussJordanElimination(transformMatrix)) {
50726
+ throw new Error("Error: Singular matrix. Points are likely coplanar.");
51390
50727
  }
50728
+ return transformMatrix;
51391
50729
  };
51392
50730
  /**
51393
- * Check if the shape's wrapped feature is a circle form the extended GeoJSON spec.
51394
- * If so it will calculate a polygon feature that approximates the specified circle.
51395
- * @private
50731
+ * Puts a given matrix (2D array) into the Reduced Row Echelon Form.
50732
+ * Returns True if successful, False if the transformMatrix is singular.
50733
+ * Code from: https://github.com/commenthol/affinefit
51396
50734
  */
51397
- Shape.prototype._handleCircle = function () {
51398
- if (this.isCircle()) {
51399
- var coords = Shape._getCirclePositions(this.data);
51400
- this.circlePolygon = new Feature(new Polygon([coords]), this.data.properties, this.data.id);
51401
- // Set the subType to "Circle" to make sure the case is correct.
51402
- this.data.properties.subType = "Circle";
50735
+ AffineTransform._gaussJordanElimination = function (transformMatrix) {
50736
+ var eps = 1e-10; // 1.0 / Math.pow(10, 10)
50737
+ var dimPlusOne = transformMatrix.length;
50738
+ var w = 2 * dimPlusOne - 1;
50739
+ var tempNum;
50740
+ var tempArray;
50741
+ for (var j = 0; j < dimPlusOne; j++) {
50742
+ var maxrow = j;
50743
+ for (var i = j + 1; i < dimPlusOne; i++) {
50744
+ // Find max pivot.
50745
+ if (Math.abs(transformMatrix[i][j]) > Math.abs(transformMatrix[maxrow][j])) {
50746
+ maxrow = i;
50747
+ }
50748
+ }
50749
+ tempArray = transformMatrix[maxrow];
50750
+ transformMatrix[maxrow] = transformMatrix[j];
50751
+ transformMatrix[j] = tempArray;
50752
+ if (Math.abs(transformMatrix[j][j]) <= eps) {
50753
+ // Is Singular?
50754
+ return false;
50755
+ }
50756
+ for (var _j = j + 1; _j < dimPlusOne; _j++) {
50757
+ // Eliminate column y.
50758
+ tempNum = transformMatrix[_j][j] / transformMatrix[j][j];
50759
+ for (var _i = j; _i < w; _i++) {
50760
+ transformMatrix[_j][_i] -= transformMatrix[j][_i] * tempNum;
50761
+ }
50762
+ }
51403
50763
  }
51404
- else {
51405
- delete this.circlePolygon;
50764
+ for (var j = dimPlusOne - 1; j > -1; j--) {
50765
+ // Backsubstitute.
50766
+ tempNum = transformMatrix[j][j];
50767
+ for (var i = 0; i < j; i++) {
50768
+ for (var _x = w - 1; _x > j - 1; _x--) {
50769
+ transformMatrix[i][_x] -= transformMatrix[j][_x] * transformMatrix[i][j] / tempNum;
50770
+ }
50771
+ }
50772
+ transformMatrix[j][j] /= tempNum;
50773
+ for (var _x2 = dimPlusOne; _x2 < w; _x2++) {
50774
+ // Normalize row y.
50775
+ transformMatrix[j][_x2] /= tempNum;
50776
+ }
51406
50777
  }
50778
+ return true;
51407
50779
  };
51408
- /**
51409
- * Indicates if the specified feature is a circle, defined by the extended GeoJSON specification supported by Azure Maps.
51410
- * [Extended Spec]{@link https://docs.microsoft.com/en-us/azure/azure-maps/extend-geojson}
51411
- * @internal
51412
- */
51413
- Shape._isCircle = function (data) {
51414
- return data && data.geometry &&
51415
- data.geometry.type === "Point" &&
51416
- data.geometry.coordinates && data.properties &&
51417
- typeof data.properties.subType === "string" &&
51418
- data.properties.subType.toLowerCase() === "circle" &&
51419
- typeof data.properties.radius === "number";
51420
- };
51421
- /**
51422
- * Indicates if the specified feature is a rectangle, defined by the extended GeoJSON specification supported by Azure Maps.
51423
- * [Extended Spec]{@link https://docs.microsoft.com/en-us/azure/azure-maps/extend-geojson}
51424
- * @internal
51425
- */
51426
- Shape._isRectangle = function (data) {
51427
- if (data.geometry.type === "Polygon" &&
51428
- data.geometry.coordinates &&
51429
- typeof data.properties.subType === "string" &&
51430
- data.properties.subType.toLowerCase() === "rectangle") {
51431
- // If type is Polygon we can assume the coordinates are a Position[][].
51432
- var coords = data.geometry.coordinates;
51433
- if (coords.length === 1) {
51434
- var ring = coords[0];
51435
- if (ring.length === 5) {
51436
- return ring[0][0] === ring[4][0] &&
51437
- ring[0][1] === ring[4][1];
51438
- }
51439
- else if (ring.length === 4) {
51440
- return true;
51441
- }
51442
- }
50780
+ return AffineTransform;
50781
+ }());
50782
+
50783
+
50784
+
50785
+ var index$1 = /*#__PURE__*/Object.freeze({
50786
+ __proto__: null,
50787
+ AffineTransform: AffineTransform,
50788
+ WEBMERCATOR_MAXLAT: WEBMERCATOR_MAXLAT,
50789
+ _precision: _precision,
50790
+ get AreaUnits () { return AreaUnits; },
50791
+ get DistanceUnits () { return DistanceUnits; },
50792
+ get TimeUnits () { return TimeUnits; },
50793
+ get SpeedUnits () { return SpeedUnits; },
50794
+ get AccelerationUnits () { return AccelerationUnits; },
50795
+ boundingBoxToPolygon: boundingBoxToPolygon,
50796
+ convertDistance: convertDistance,
50797
+ getCardinalSpline: getCardinalSpline,
50798
+ getDestination: getDestination,
50799
+ getDistanceTo: getDistanceTo,
50800
+ getEarthRadius: getEarthRadius,
50801
+ getPathDenormalizedAtAntimerian: getPathDenormalizedAtAntimerian,
50802
+ getPathSplitByAntimeridian: getPathSplitByAntimeridian,
50803
+ getGeodesicPath: getGeodesicPath,
50804
+ getGeodesicPaths: getGeodesicPaths,
50805
+ getHeading: getHeading,
50806
+ getLengthOfPath: getLengthOfPath,
50807
+ getPositionAlongPath: getPositionAlongPath,
50808
+ getRegularPolygonPath: getRegularPolygonPath,
50809
+ getRegularPolygonPaths: getRegularPolygonPaths,
50810
+ interpolate: interpolate,
50811
+ normalizeLatitude: normalizeLatitude,
50812
+ normalizeLongitude: normalizeLongitude,
50813
+ rotatePositions: rotatePositions,
50814
+ getPixelHeading: getPixelHeading,
50815
+ mercatorPixelsToPositions: mercatorPixelsToPositions,
50816
+ mercatorPositionsToPixels: mercatorPositionsToPixels,
50817
+ convertAcceleration: convertAcceleration,
50818
+ convertArea: convertArea,
50819
+ convertSpeed: convertSpeed,
50820
+ convertTimespan: convertTimespan,
50821
+ getAcceleration: getAcceleration,
50822
+ getAccelerationFromSpeeds: getAccelerationFromSpeeds,
50823
+ getAccelerationFromFeatures: getAccelerationFromFeatures,
50824
+ getArea: getArea,
50825
+ getSpeed: getSpeed,
50826
+ getSpeedFromFeatures: getSpeedFromFeatures,
50827
+ getTimespan: getTimespan,
50828
+ getTravelDistance: getTravelDistance,
50829
+ parseTimestamp: parseTimestamp,
50830
+ getConvexHull: getConvexHull,
50831
+ getPositions: getPositions,
50832
+ getPosition: getPosition,
50833
+ getPositionsAlongPath: getPositionsAlongPath,
50834
+ getPointWithHeadingAlongPath: getPointWithHeadingAlongPath,
50835
+ getPointsWithHeadingsAlongPath: getPointsWithHeadingsAlongPath,
50836
+ getClosestPointOnGeometry: getClosestPointOnGeometry,
50837
+ simplify: simplify
50838
+ });
50839
+
50840
+ /**
50841
+ * A helper class that wraps a Geometry or Feature and makes it easy to update and maintain.
50842
+ */
50843
+ var Shape = /** @class */ (function (_super) {
50844
+ __extends(Shape, _super);
50845
+ function Shape(data, id, properties) {
50846
+ var _this = _super.call(this) || this;
50847
+ var geometry;
50848
+ if (data.type === "Feature") {
50849
+ var feature = data;
50850
+ geometry = cloneDeep_1(feature.geometry);
50851
+ properties = feature.properties ? cloneDeep_1(feature.properties) : {};
50852
+ id = feature.id == null || feature.id === "" ? uuidRandom() : feature.id;
51443
50853
  }
51444
- return false;
51445
- };
50854
+ else {
50855
+ geometry = cloneDeep_1(data);
50856
+ id = id == null || id === "" ? uuidRandom() : id;
50857
+ properties = properties ? cloneDeep_1(properties) : {};
50858
+ }
50859
+ // Assign the feature's id to another property to workaround the Mapbox bug
50860
+ // that prevents non-numerical ids from being returned by some functions.
50861
+ // TODO Remove once this issue if fixed. https://github.com/mapbox/mapbox-gl-js/issues/2716
50862
+ properties[Shape._shapeIdPropName] = id;
50863
+ // Always create a new feature to guarantee the data matches our definition of a Feature.
50864
+ _this.data = new Feature(geometry, properties, id);
50865
+ _this._handleCircle();
50866
+ return _this;
50867
+ }
51446
50868
  /**
51447
- * Calculates to positions that should be used to approximate the specified circle feature.
51448
- * @internal
50869
+ * Adds or updates an existing property value in the shape.
50870
+ * @param key
50871
+ * @param value
51449
50872
  */
51450
- Shape._getCirclePositions = function (data) {
51451
- return getRegularPolygonPath(data.geometry.coordinates, data.properties.radius, 72, "meters");
50873
+ Shape.prototype.addProperty = function (key, value) {
50874
+ // Only add the property if it is a new value.
50875
+ if (!isEqual_1(this.data.properties[key], value)) {
50876
+ this.data.properties[key] = cloneDeep_1(value);
50877
+ if (key === "subType" || key === "radius") {
50878
+ this._handleCircle();
50879
+ }
50880
+ if (this.dataSource) {
50881
+ this.dataSource._updateSource();
50882
+ }
50883
+ this._invokeEvent("shapechanged", this);
50884
+ }
51452
50885
  };
51453
50886
  /**
51454
- * Represents the feature property name that the shape's id will be assigned to.
51455
- * This is a workaround for the Mapbox bug preventing non-numerical ids from being returned by some functions.
51456
- * TODO Remove once this issue if fixed.
51457
- * {@link https://github.com/mapbox/mapbox-gl-js/issues/2716}
51458
- * @internal
50887
+ * Gets the bounding box of the shape
51459
50888
  */
51460
- // tslint:disable-next-line: variable-name
51461
- Shape._shapeIdPropName = "_azureMapsShapeId";
51462
- return Shape;
51463
- }(EventEmitter));
51464
-
51465
- /**
51466
- * A GeoJSON BoundingBox object - an array that defines a shape whose edges follow lines of constant longitude,
51467
- * latitude, and elevation. All axes of the most southwesterly point are followed by all axes of the more northeasterly
51468
- * point. The axes order of the BoundingBox follows the axes order of geometries. The full description is detailed in
51469
- * [RFC 7946]{@link https://tools.ietf.org/html/rfc7946#section-5}.
51470
- */
51471
- var BoundingBox = /** @class */ (function (_super) {
51472
- __extends(BoundingBox, _super);
51473
- function BoundingBox(southwestPositionOrPositions, northeastPosition) {
51474
- var _this = this;
51475
- if (southwestPositionOrPositions && northeastPosition) {
51476
- var southwestPosition = southwestPositionOrPositions;
51477
- if (southwestPosition[2] && northeastPosition[2]) {
51478
- _this = _super.call(this, southwestPosition[0], southwestPosition[1], southwestPosition[2] || 0, northeastPosition[0], northeastPosition[1], northeastPosition[2] || 0) || this;
50889
+ Shape.prototype.getBounds = function () {
50890
+ var e_1, _a, e_2, _b;
50891
+ var positions = this.getCoordinates();
50892
+ var bbox;
50893
+ var geoType = this.getType();
50894
+ if (geoType === "Point") {
50895
+ if (this.circlePolygon) { // If a circle from the extended GeoJSON spec.
50896
+ var pos = this.circlePolygon.geometry.coordinates;
50897
+ bbox = BoundingBox.fromPositions(pos[0]);
51479
50898
  }
51480
50899
  else {
51481
- _this = _super.call(this, southwestPosition[0], southwestPosition[1], northeastPosition[0], northeastPosition[1]) || this;
50900
+ var pos = positions;
50901
+ bbox = new BoundingBox(pos, pos);
51482
50902
  }
51483
50903
  }
51484
- else if (southwestPositionOrPositions) {
51485
- var positions = southwestPositionOrPositions;
51486
- if (positions) {
51487
- if (positions.length === 4) {
51488
- // [west, south, east, north]
51489
- _this = _super.call(this, positions[0], positions[1], positions[2], positions[3]) || this;
50904
+ else if (geoType === "MultiPoint" || geoType === "LineString") {
50905
+ var pos = positions;
50906
+ bbox = BoundingBox.fromPositions(pos);
50907
+ }
50908
+ else if (geoType === "Polygon") {
50909
+ var pos = positions;
50910
+ // only need to check the exterior ring of Polygon
50911
+ bbox = BoundingBox.fromPositions(pos[0]);
50912
+ }
50913
+ else if (geoType === "MultiLineString") {
50914
+ var pos = positions;
50915
+ try {
50916
+ for (var pos_1 = __values(pos), pos_1_1 = pos_1.next(); !pos_1_1.done; pos_1_1 = pos_1.next()) {
50917
+ var p = pos_1_1.value;
50918
+ bbox = BoundingBox.merge(bbox, BoundingBox.fromPositions(p));
51490
50919
  }
51491
- else if (positions.length >= 6) {
51492
- // [west, south, elevation1, east, north, elevation2]
51493
- _this = _super.call(this, positions[0], positions[1], positions[2], positions[3], positions[4], positions[5]) || this;
50920
+ }
50921
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
50922
+ finally {
50923
+ try {
50924
+ if (pos_1_1 && !pos_1_1.done && (_a = pos_1.return)) _a.call(pos_1);
51494
50925
  }
50926
+ finally { if (e_1) throw e_1.error; }
51495
50927
  }
51496
50928
  }
51497
- return _this;
51498
- }
51499
- /**
51500
- * Clones a bounding box.
51501
- * @param boundingBox The bounding box to clone.
51502
- */
51503
- BoundingBox.fromBoundingBox = function (boundingBox) {
51504
- var west = BoundingBox.getWest(boundingBox);
51505
- var south = BoundingBox.getSouth(boundingBox);
51506
- var east = BoundingBox.getEast(boundingBox);
51507
- var north = BoundingBox.getNorth(boundingBox);
51508
- return new BoundingBox([west, south, east, north]);
50929
+ else if (geoType === "MultiPolygon") {
50930
+ var pos = positions;
50931
+ try {
50932
+ for (var pos_2 = __values(pos), pos_2_1 = pos_2.next(); !pos_2_1.done; pos_2_1 = pos_2.next()) {
50933
+ var p1 = pos_2_1.value;
50934
+ // only need to check the exterior ring of Polygon
50935
+ bbox = BoundingBox.merge(bbox, BoundingBox.fromPositions(p1[0]));
50936
+ }
50937
+ }
50938
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
50939
+ finally {
50940
+ try {
50941
+ if (pos_2_1 && !pos_2_1.done && (_b = pos_2.return)) _b.call(pos_2);
50942
+ }
50943
+ finally { if (e_2) throw e_2.error; }
50944
+ }
50945
+ }
50946
+ return bbox;
51509
50947
  };
51510
50948
  /**
51511
- * Constructs a BoundingBox from the specified dimensions.
51512
- * @param center The center position of the bounding box.
51513
- * @param width The width of the bounding box.
51514
- * @param height The height of the bounding box.
50949
+ * Gets the coordinates of the shape.
51515
50950
  */
51516
- BoundingBox.fromDimensions = function (center, width, height) {
51517
- var lon = center[0];
51518
- var lat = center[1];
51519
- var north = Math.min(Math.max(lat + height / 2, -85.5), 85.5);
51520
- var south = Math.min(Math.max(lat - height / 2, -85.5), 85.5);
51521
- var east = normalizeLongitude(lon + width / 2);
51522
- var west = normalizeLongitude(lon - width / 2);
51523
- return new BoundingBox([west, south, east, north]);
50951
+ Shape.prototype.getCoordinates = function () {
50952
+ return cloneDeep_1(this.data.geometry.coordinates);
51524
50953
  };
51525
50954
  /**
51526
- * Constructs a BoundingBox from the specified edges.
51527
- * @param west The west edge of the bounding box.
51528
- * @param south The south edge of the bounding box.
51529
- * @param east The east edge of the bounding box.
51530
- * @param north The north edge of the bounding box.
50955
+ * If the shape is a circle, this gets its coordinates. Otherwise returns null.
51531
50956
  */
51532
- BoundingBox.fromEdges = function (west, south, east, north) {
51533
- return new BoundingBox([west, south, east, north]);
50957
+ Shape.prototype.getCircleCoordinates = function () {
50958
+ if (this.circlePolygon) {
50959
+ return cloneDeep_1(this.circlePolygon.geometry.coordinates[0]);
50960
+ }
50961
+ else {
50962
+ return null;
50963
+ }
50964
+ };
50965
+ /**
50966
+ * Gets the id of the shape.
50967
+ */
50968
+ Shape.prototype.getId = function () {
50969
+ return this.data.id;
50970
+ };
50971
+ /**
50972
+ * Gets the properties of the shape.
50973
+ */
50974
+ Shape.prototype.getProperties = function () {
50975
+ return cloneDeep_1(this.data.properties);
50976
+ };
50977
+ /**
50978
+ * Returns a string indicating the type of geometry this shape contains.
50979
+ */
50980
+ Shape.prototype.getType = function () {
50981
+ return this.data.geometry.type;
50982
+ };
50983
+ /**
50984
+ * Indicates if the contained shape is a Circle, defined by the extended GeoJSON specification supported by Azure Maps.
50985
+ * [Extended Spec]{@link https://docs.microsoft.com/en-us/azure/azure-maps/extend-geojson}
50986
+ */
50987
+ Shape.prototype.isCircle = function () {
50988
+ return Shape._isCircle(this.data);
50989
+ };
50990
+ /**
50991
+ * Indicates if the contained shape is a Rectangle, defined by the extended GeoJSON specification supported by Azure Maps.
50992
+ * [Extended Spec]{@link https://docs.microsoft.com/en-us/azure/azure-maps/extend-geojson}
50993
+ */
50994
+ Shape.prototype.isRectangle = function () {
50995
+ return Shape._isRectangle(this.data);
50996
+ };
50997
+ /**
50998
+ * Updates the coordinates of the shape
50999
+ * @param coords Point: Position, LineString: Position[], Polygon: Position[][],
51000
+ * MultiPoint: Position[], MultiLineString: Position[][], MultiPolygon: Position[][]
51001
+ */
51002
+ Shape.prototype.setCoordinates = function (coords) {
51003
+ // If a Position[] is supplied for a polygon wrap it in an array.
51004
+ var newCoords;
51005
+ if (this.getType() === "Polygon" &&
51006
+ Position._getDimensions(coords) === 1) {
51007
+ newCoords = [coords];
51008
+ }
51009
+ else {
51010
+ newCoords = coords;
51011
+ }
51012
+ // Only update the coordinates if they've actually changed.
51013
+ if (!isEqual_1(this.data.geometry.coordinates, newCoords)) {
51014
+ this.data.geometry.coordinates = cloneDeep_1(newCoords);
51015
+ this._handleCircle();
51016
+ if (this.dataSource) {
51017
+ this.dataSource._updateSource();
51018
+ }
51019
+ this._invokeEvent("shapechanged", this);
51020
+ }
51021
+ };
51022
+ /**
51023
+ * Sets the properties on the shape. Overwrites all existing properties.
51024
+ * @param properties
51025
+ */
51026
+ Shape.prototype.setProperties = function (properties) {
51027
+ // Assign the feature's id to another property to workaround the Mapbox bug
51028
+ // that prevents non-numerical ids from being returned by some functions.
51029
+ // TODO Remove once this issue if fixed. https://github.com/mapbox/mapbox-gl-js/issues/2716
51030
+ properties[Shape._shapeIdPropName] = this.data.id;
51031
+ // Only update the properties if they've actually changed.
51032
+ if (!isEqual_1(this.data.properties, properties)) {
51033
+ this.data.properties = cloneDeep_1(properties);
51034
+ this._handleCircle();
51035
+ if (this.dataSource) {
51036
+ this.dataSource._updateSource();
51037
+ }
51038
+ this._invokeEvent("shapechanged", this);
51039
+ }
51040
+ };
51041
+ /**
51042
+ * Returns a GeoJSON feature that represents the shape.
51043
+ */
51044
+ Shape.prototype.toJson = function () {
51045
+ return JSON.parse(JSON.stringify(this.data));
51046
+ };
51047
+ /**
51048
+ * Just like the toJson() function but will return a polygon feature
51049
+ * for any circles as defined by the extended GeoJSON spec.
51050
+ * [Extended Spec]{@link https://docs.microsoft.com/en-us/azure/azure-maps/extend-geojson}
51051
+ * @internal
51052
+ */
51053
+ Shape.prototype._toJson = function () {
51054
+ return this.circlePolygon || this.data;
51055
+ };
51056
+ /**
51057
+ * @internal
51058
+ */
51059
+ Shape.prototype._setDataSource = function (dataSource) {
51060
+ if (dataSource === undefined || dataSource == null) {
51061
+ delete this.dataSource;
51062
+ }
51063
+ else {
51064
+ this.dataSource = dataSource;
51065
+ }
51066
+ };
51067
+ /**
51068
+ * Check if the shape's wrapped feature is a circle form the extended GeoJSON spec.
51069
+ * If so it will calculate a polygon feature that approximates the specified circle.
51070
+ * @private
51071
+ */
51072
+ Shape.prototype._handleCircle = function () {
51073
+ if (this.isCircle()) {
51074
+ var coords = Shape._getCirclePositions(this.data);
51075
+ this.circlePolygon = new Feature(new Polygon([coords]), this.data.properties, this.data.id);
51076
+ // Set the subType to "Circle" to make sure the case is correct.
51077
+ this.data.properties.subType = "Circle";
51078
+ }
51079
+ else {
51080
+ delete this.circlePolygon;
51081
+ }
51082
+ };
51083
+ /**
51084
+ * Indicates if the specified feature is a circle, defined by the extended GeoJSON specification supported by Azure Maps.
51085
+ * [Extended Spec]{@link https://docs.microsoft.com/en-us/azure/azure-maps/extend-geojson}
51086
+ * @internal
51087
+ */
51088
+ Shape._isCircle = function (data) {
51089
+ return data && data.geometry &&
51090
+ data.geometry.type === "Point" &&
51091
+ data.geometry.coordinates && data.properties &&
51092
+ typeof data.properties.subType === "string" &&
51093
+ data.properties.subType.toLowerCase() === "circle" &&
51094
+ typeof data.properties.radius === "number";
51095
+ };
51096
+ /**
51097
+ * Indicates if the specified feature is a rectangle, defined by the extended GeoJSON specification supported by Azure Maps.
51098
+ * [Extended Spec]{@link https://docs.microsoft.com/en-us/azure/azure-maps/extend-geojson}
51099
+ * @internal
51100
+ */
51101
+ Shape._isRectangle = function (data) {
51102
+ if (data.geometry.type === "Polygon" &&
51103
+ data.geometry.coordinates &&
51104
+ typeof data.properties.subType === "string" &&
51105
+ data.properties.subType.toLowerCase() === "rectangle") {
51106
+ // If type is Polygon we can assume the coordinates are a Position[][].
51107
+ var coords = data.geometry.coordinates;
51108
+ if (coords.length === 1) {
51109
+ var ring = coords[0];
51110
+ if (ring.length === 5) {
51111
+ return ring[0][0] === ring[4][0] &&
51112
+ ring[0][1] === ring[4][1];
51113
+ }
51114
+ else if (ring.length === 4) {
51115
+ return true;
51116
+ }
51117
+ }
51118
+ }
51119
+ return false;
51120
+ };
51121
+ /**
51122
+ * Calculates to positions that should be used to approximate the specified circle feature.
51123
+ * @internal
51124
+ */
51125
+ Shape._getCirclePositions = function (data) {
51126
+ return getRegularPolygonPath(data.geometry.coordinates, data.properties.radius, 72, "meters");
51127
+ };
51128
+ /**
51129
+ * Represents the feature property name that the shape's id will be assigned to.
51130
+ * This is a workaround for the Mapbox bug preventing non-numerical ids from being returned by some functions.
51131
+ * TODO Remove once this issue if fixed.
51132
+ * {@link https://github.com/mapbox/mapbox-gl-js/issues/2716}
51133
+ * @internal
51134
+ */
51135
+ // tslint:disable-next-line: variable-name
51136
+ Shape._shapeIdPropName = "_azureMapsShapeId";
51137
+ return Shape;
51138
+ }(EventEmitter));
51139
+
51140
+ /**
51141
+ * A GeoJSON BoundingBox object - an array that defines a shape whose edges follow lines of constant longitude,
51142
+ * latitude, and elevation. All axes of the most southwesterly point are followed by all axes of the more northeasterly
51143
+ * point. The axes order of the BoundingBox follows the axes order of geometries. The full description is detailed in
51144
+ * [RFC 7946]{@link https://tools.ietf.org/html/rfc7946#section-5}.
51145
+ */
51146
+ var BoundingBox = /** @class */ (function (_super) {
51147
+ __extends(BoundingBox, _super);
51148
+ function BoundingBox(southwestPositionOrPositions, northeastPosition) {
51149
+ var _this = this;
51150
+ if (southwestPositionOrPositions && northeastPosition) {
51151
+ var southwestPosition = southwestPositionOrPositions;
51152
+ if (southwestPosition[2] && northeastPosition[2]) {
51153
+ _this = _super.call(this, southwestPosition[0], southwestPosition[1], southwestPosition[2] || 0, northeastPosition[0], northeastPosition[1], northeastPosition[2] || 0) || this;
51154
+ }
51155
+ else {
51156
+ _this = _super.call(this, southwestPosition[0], southwestPosition[1], northeastPosition[0], northeastPosition[1]) || this;
51157
+ }
51158
+ }
51159
+ else if (southwestPositionOrPositions) {
51160
+ var positions = southwestPositionOrPositions;
51161
+ if (positions) {
51162
+ if (positions.length === 4) {
51163
+ // [west, south, east, north]
51164
+ _this = _super.call(this, positions[0], positions[1], positions[2], positions[3]) || this;
51165
+ }
51166
+ else if (positions.length >= 6) {
51167
+ // [west, south, elevation1, east, north, elevation2]
51168
+ _this = _super.call(this, positions[0], positions[1], positions[2], positions[3], positions[4], positions[5]) || this;
51169
+ }
51170
+ }
51171
+ }
51172
+ return _this;
51173
+ }
51174
+ /**
51175
+ * Clones a bounding box.
51176
+ * @param boundingBox The bounding box to clone.
51177
+ */
51178
+ BoundingBox.fromBoundingBox = function (boundingBox) {
51179
+ var west = BoundingBox.getWest(boundingBox);
51180
+ var south = BoundingBox.getSouth(boundingBox);
51181
+ var east = BoundingBox.getEast(boundingBox);
51182
+ var north = BoundingBox.getNorth(boundingBox);
51183
+ return new BoundingBox([west, south, east, north]);
51184
+ };
51185
+ /**
51186
+ * Constructs a BoundingBox from the specified dimensions.
51187
+ * @param center The center position of the bounding box.
51188
+ * @param width The width of the bounding box.
51189
+ * @param height The height of the bounding box.
51190
+ */
51191
+ BoundingBox.fromDimensions = function (center, width, height) {
51192
+ var lon = center[0];
51193
+ var lat = center[1];
51194
+ var north = Math.min(Math.max(lat + height / 2, -85.5), 85.5);
51195
+ var south = Math.min(Math.max(lat - height / 2, -85.5), 85.5);
51196
+ var east = normalizeLongitude(lon + width / 2);
51197
+ var west = normalizeLongitude(lon - width / 2);
51198
+ return new BoundingBox([west, south, east, north]);
51199
+ };
51200
+ /**
51201
+ * Constructs a BoundingBox from the specified edges.
51202
+ * @param west The west edge of the bounding box.
51203
+ * @param south The south edge of the bounding box.
51204
+ * @param east The east edge of the bounding box.
51205
+ * @param north The north edge of the bounding box.
51206
+ */
51207
+ BoundingBox.fromEdges = function (west, south, east, north) {
51208
+ return new BoundingBox([west, south, east, north]);
51534
51209
  };
51535
51210
  /**
51536
51211
  * Determines if a position is within a bounding box.
@@ -52188,7 +51863,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
52188
51863
 
52189
51864
 
52190
51865
 
52191
- var index$1 = /*#__PURE__*/Object.freeze({
51866
+ var index$2 = /*#__PURE__*/Object.freeze({
52192
51867
  __proto__: null,
52193
51868
  Feature: Feature,
52194
51869
  FeatureCollection: FeatureCollection,
@@ -52203,444 +51878,103 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
52203
51878
  GeometryCollection: GeometryCollection
52204
51879
  });
52205
51880
 
52206
- var arrayPoints = createCommonjsModule(function (module, exports) {
52207
- exports.__esModule = true;
52208
- function getAddedSquaresAP(dx, dy) {
52209
- return dx * dx + dy * dy;
52210
- }
52211
- function getSqDistAP(p1, p2) {
52212
- return getAddedSquaresAP(p1[0] - p2[0], p1[1] - p2[1]);
52213
- }
52214
- function getSqSegDistAP(p, p1, p2) {
52215
- var x = p1[0], y = p1[1], dx = p2[0] - x, dy = p2[1] - y;
52216
- if (dx !== 0 || dy !== 0) {
52217
- var t = ((p[0] - x) * dx + (p[1] - y) * dy) / getAddedSquaresAP(dx, dy);
52218
- if (t > 1) {
52219
- x = p2[0];
52220
- y = p2[1];
52221
- }
52222
- else if (t > 0) {
52223
- x += dx * t;
52224
- y += dy * t;
52225
- }
52226
- }
52227
- return getAddedSquaresAP(p[0] - x, p[1] - y);
52228
- }
52229
- function simplifyRadialDistAP(points, sqTolerance) {
52230
- var prevPoint = points[0], point;
52231
- var newPoints = [prevPoint];
52232
- for (var i = 1, len = points.length; i < len; i++) {
52233
- point = points[i];
52234
- if (getSqDistAP(point, prevPoint) > sqTolerance) {
52235
- newPoints.push(point);
52236
- prevPoint = point;
52237
- }
52238
- }
52239
- if (prevPoint !== point) {
52240
- newPoints.push(point);
52241
- }
52242
- return newPoints;
52243
- }
52244
- function simplifyDPStepAP(points, first, last, sqTolerance, simplified) {
52245
- var maxSqDist = sqTolerance, index;
52246
- for (var i = first + 1; i < last; i++) {
52247
- var sqDist = getSqSegDistAP(points[i], points[first], points[last]);
52248
- if (sqDist > maxSqDist) {
52249
- index = i;
52250
- maxSqDist = sqDist;
52251
- }
52252
- }
52253
- if (maxSqDist > sqTolerance) {
52254
- if (index - first > 1) {
52255
- simplifyDPStepAP(points, first, index, sqTolerance, simplified);
52256
- }
52257
- simplified.push(points[index]);
52258
- if (last - index > 1) {
52259
- simplifyDPStepAP(points, index, last, sqTolerance, simplified);
52260
- }
52261
- }
52262
- }
52263
- function simplifyDouglasPeuckerAP(points, sqTolerance) {
52264
- var last = points.length - 1;
52265
- var simplified = [points[0]];
52266
- simplifyDPStepAP(points, 0, last, sqTolerance, simplified);
52267
- simplified.push(points[last]);
52268
- return simplified;
52269
- }
52270
- function SimplifyAP(points, tolerance, highestQuality) {
52271
- if (tolerance === void 0) { tolerance = 1; }
52272
- if (highestQuality === void 0) { highestQuality = false; }
52273
- if (points.length <= 2) {
52274
- return points;
52275
- }
52276
- var sqTolerance = tolerance * tolerance;
52277
- points = highestQuality ? points : simplifyRadialDistAP(points, sqTolerance);
52278
- points = simplifyDouglasPeuckerAP(points, sqTolerance);
52279
- return points;
52280
- }
52281
- exports.SimplifyAP = SimplifyAP;
52282
- });
52283
-
52284
- unwrapExports(arrayPoints);
52285
- var arrayPoints_1 = arrayPoints.SimplifyAP;
52286
-
52287
51881
  /**
52288
- * Perform a Douglas-Peucker simplification on an array of positions or pixels.
52289
- * @param points The position or pixel points to simplify.
52290
- * @param tolerance A tolerance to use in the simplification.
52291
- * @returns A new array of the simplified set of points.
51882
+ * The options for a ZoomControl object.
52292
51883
  */
52293
- function simplify(points, tolerance) {
52294
- //Perform a Douglas-Peucker simplification of the pixels.
52295
- return arrayPoints_1(points, tolerance, true);
52296
- }
51884
+ var ZoomControlOptions = /** @class */ (function (_super) {
51885
+ __extends(ZoomControlOptions, _super);
51886
+ function ZoomControlOptions() {
51887
+ var _this = _super !== null && _super.apply(this, arguments) || this;
51888
+ /**
51889
+ * The extent to which the map will zoom with each click of the control.
51890
+ * Default `1`.
51891
+ * @default 1
51892
+ */
51893
+ _this.zoomDelta = 1;
51894
+ /**
51895
+ * The style of the control.
51896
+ * Default `ControlStyle.light`.
51897
+ * @default ControlStyle.light
51898
+ */
51899
+ _this.style = exports.ControlStyle.light;
51900
+ return _this;
51901
+ }
51902
+ return ZoomControlOptions;
51903
+ }(Options));
52297
51904
 
52298
51905
  /**
52299
- * An Affine Transform class generated from a set of reference points.
51906
+ * A control for changing the zoom of the map.
52300
51907
  */
52301
- var AffineTransform = /** @class */ (function () {
51908
+ var ZoomControl = /** @class */ (function (_super) {
51909
+ __extends(ZoomControl, _super);
52302
51910
  /**
52303
- * An Affine Transform class generated from a set of reference points.
52304
- * @param source A set of reference points from the source reference system to transform from.
52305
- * @param target A set of reference points from the target reference system to transform to.
51911
+ * Constructs a ZoomControl.
51912
+ * @param options The options for the control.
52306
51913
  */
52307
- function AffineTransform(source, target) {
52308
- this.M = AffineTransform._calculateAffineTransform(source, target);
52309
- this.inverseM = AffineTransform._calculateAffineTransform(target, source);
51914
+ function ZoomControl(options) {
51915
+ var _this = _super.call(this) || this;
51916
+ _this.container = null;
51917
+ _this.zoomInButton = null;
51918
+ _this.zoomOutButton = null;
51919
+ _this.zoomChanged = function (event) { return _this.updateZoomButtonsState(); };
51920
+ _this.minZoomChanged = function (zoom) { return _this.updateZoomButtonsState(); };
51921
+ _this.maxZoomChanged = function (zoom) { return _this.updateZoomButtonsState(); };
51922
+ _this.options = new ZoomControlOptions().merge(options);
51923
+ return _this;
52310
51924
  }
52311
51925
  /**
52312
- * Converts an array of points from the source reference system to the target reference system.
52313
- * @param sourcePoints An array of points from the source reference system to transform.
52314
- * @param decimals Number of decimal places to round the results off to.
52315
- * @returns An array of points that have been transformed to the target reference system.
51926
+ * Initialization method for the control which is called when added to the map.
51927
+ * @param map The map that the control will be added to.
51928
+ * @return An HTMLElement to be placed on the map for the control.
52316
51929
  */
52317
- AffineTransform.prototype.toTarget = function (sourcePoints, decimals) {
52318
- if (typeof sourcePoints !== undefined) {
52319
- return this.transformArray(sourcePoints, this.M, decimals);
52320
- }
52321
- throw new Error("Invalid sourcePoints specified.");
51930
+ ZoomControl.prototype.onAdd = function (map) {
51931
+ this.container = this.buildContainer(map, this.options.style, "Zoom Control");
51932
+ this.container.style.flexDirection = "column";
51933
+ this.zoomInButton = this.constructZoomInButton(map);
51934
+ this.zoomOutButton = this.constructZoomOutButton(map);
51935
+ var tooltipZoomIn = buildAccessibleTooltip("Zoom In");
51936
+ var tooltipZoomOut = buildAccessibleTooltip("Zoom Out");
51937
+ this.container.appendChild(this.zoomInButton);
51938
+ this.container.appendChild(tooltipZoomIn);
51939
+ this.container.appendChild(this.zoomOutButton);
51940
+ this.container.appendChild(tooltipZoomOut);
51941
+ positionTooltip(tooltipZoomIn, this.zoomInButton);
51942
+ positionTooltip(tooltipZoomOut, this.zoomOutButton);
51943
+ map.events.add('zoom', this.zoomChanged);
51944
+ map.events.add('minzoomchanged', this.minZoomChanged);
51945
+ map.events.add('maxzoomchanged', this.maxZoomChanged);
51946
+ this.map = map;
51947
+ return this.container;
52322
51948
  };
52323
- /**
52324
- * Converts an array of points from the target reference system to the source reference system.
52325
- * @param targetPoints An array of points from the target reference system to transform.
52326
- * @param decimals Number of decimal places to round the results off to.
52327
- * @returns An array of points that have been transformed to the source reference system.
52328
- */
52329
- AffineTransform.prototype.toSource = function (targetPoints, decimals) {
52330
- if (typeof targetPoints !== undefined) {
52331
- return this.transformArray(targetPoints, this.inverseM, decimals);
51949
+ ZoomControl.prototype.onRemove = function () {
51950
+ if (this.map) {
51951
+ this.map.events.remove('zoom', this.zoomChanged);
51952
+ this.map.events.remove('minzoomchanged', this.minZoomChanged);
51953
+ this.map.events.remove('maxzoomchanged', this.maxZoomChanged);
51954
+ this.map = null;
52332
51955
  }
52333
- throw new Error("Invalid targetPoints specified.");
52334
- };
52335
- /**
52336
- * Applies a transform matrix over a set of points and optionally rounds off the values to a specified number of decimals.
52337
- * @param points The array of points to transform.
52338
- * @param transformMatrix The transform matrix to apply.
52339
- * @param decimals The number of decimals to round each calculated point value off to.
52340
- * @returns An array of points that have been transformed.
52341
- */
52342
- AffineTransform.prototype.transformArray = function (points, transformMatrix, decimals) {
52343
- var e_1, _a;
52344
- if (points && Array.isArray(points) && Array.isArray(points[0])) {
52345
- var pos = [];
52346
- try {
52347
- for (var points_1 = __values(points), points_1_1 = points_1.next(); !points_1_1.done; points_1_1 = points_1.next()) {
52348
- var subPoints = points_1_1.value;
52349
- pos.push(this.transform(subPoints, transformMatrix, decimals));
52350
- }
52351
- }
52352
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
52353
- finally {
52354
- try {
52355
- if (points_1_1 && !points_1_1.done && (_a = points_1.return)) _a.call(points_1);
52356
- }
52357
- finally { if (e_1) throw e_1.error; }
52358
- }
52359
- return pos;
51956
+ if (this.container) {
51957
+ this.container.remove();
51958
+ this.container = null;
51959
+ this.zoomInButton = null;
51960
+ this.zoomOutButton = null;
52360
51961
  }
52361
- return null;
52362
- };
52363
- /**
52364
- * Applies a transform matrix on a point and optionally rounds off the values to a specified number of decimals.
52365
- * @param point The point to transform.
52366
- * @param transformMatrix The transform matrix to apply.
52367
- * @param decimals The number of decimals to round each calculated point value off to.
52368
- * @returns An array of points that have been transformed.
52369
- */
52370
- AffineTransform.prototype.transform = function (point, transformMatrix, decimals) {
52371
- var x = point[0] * transformMatrix[0][3] + point[1] * transformMatrix[1][3] + transformMatrix[2][3];
52372
- var y = point[0] * transformMatrix[0][4] + point[1] * transformMatrix[1][4] + transformMatrix[2][4];
52373
- return typeof decimals === "number" && decimals >= 0 ?
52374
- [_precision(x, decimals), _precision(y, decimals)] :
52375
- [_precision(x, 6), _precision(y, 6)];
52376
51962
  };
52377
- /**
52378
- * Takes in a set of source and target points can calculates an approximate Affine Transform matrix that best fits the data.
52379
- * Modified version of this code: https://github.com/commenthol/affinefit
52380
- * @param sourcePoints A set of source points to transform from.
52381
- * @param targetPoints A set of target points to transform to.
52382
- * @returns An Affine Tranform matrix.
52383
- */
52384
- AffineTransform._calculateAffineTransform = function (sourcePoints, targetPoints) {
52385
- if (sourcePoints.length !== targetPoints.length || sourcePoints.length < 1) {
52386
- throw new Error("Error: source and target arrays must have the same length.");
51963
+ ZoomControl.prototype.updateZoomButtonsState = function () {
51964
+ var zoomInDisabled = this.map.getCamera().zoom >= this.map._getMap().getMaxZoom();
51965
+ // small values need special handling, since depending on the height of the map view
51966
+ // the actual zoom we can zoom out to can be above or below 0 when the entire map fits the height into the view
51967
+ // use web mercator bounds to check if entire latitude range is visible
51968
+ var reachedLatitudeBoundaries = BoundingBox.getSouth(this.map.getCamera().bounds) <= -WEBMERCATOR_MAXLAT
51969
+ && BoundingBox.getNorth(this.map.getCamera().bounds) >= WEBMERCATOR_MAXLAT;
51970
+ var zoomOutDisabled = this.map.getCamera().zoom <= this.map._getMap().getMinZoom() || reachedLatitudeBoundaries;
51971
+ if (this.zoomInButton && this.zoomInButton.disabled != zoomInDisabled) {
51972
+ this.zoomInButton.disabled = zoomInDisabled;
51973
+ this.zoomInButton.setAttribute("aria-label", zoomInDisabled ? "Zoom In disabled" : "Zoom In");
52387
51974
  }
52388
- // Use the smallest dimension of the input.
52389
- var dim = Math.min(sourcePoints[0].length, targetPoints[0].length);
52390
- var dimPlusOne = dim + 1;
52391
- if (sourcePoints.length < dim) {
52392
- throw new Error("Erorr: At least " + dim + " reference points required.");
52393
- }
52394
- // Create an empty (dim + 1) x (dim) matrix and fill it.
52395
- var c = [];
52396
- var transformMatrix = [];
52397
- for (var i = 0; i < dimPlusOne; i++) {
52398
- transformMatrix[i] = [];
52399
- for (var j = 0; j < dimPlusOne; j++) {
52400
- if (j < dim) {
52401
- c[j] = 0;
52402
- }
52403
- transformMatrix[i][j] = 0;
52404
- for (var k = 0; k < sourcePoints.length; k++) {
52405
- if (j < dim) {
52406
- if (i < dim) {
52407
- c[j] += sourcePoints[k][i] * targetPoints[k][j];
52408
- }
52409
- else {
52410
- c[j] += targetPoints[k][j];
52411
- }
52412
- }
52413
- if (i >= dim && j >= dim) {
52414
- transformMatrix[i][j] += 1;
52415
- }
52416
- else if (i >= dim) {
52417
- transformMatrix[i][j] += sourcePoints[k][j];
52418
- }
52419
- else if (j >= dim) {
52420
- transformMatrix[i][j] += sourcePoints[k][i];
52421
- }
52422
- else {
52423
- transformMatrix[i][j] += sourcePoints[k][i] * sourcePoints[k][j];
52424
- }
52425
- }
52426
- }
52427
- transformMatrix[i] = transformMatrix[i].concat(c);
52428
- }
52429
- if (!this._gaussJordanElimination(transformMatrix)) {
52430
- throw new Error("Error: Singular matrix. Points are likely coplanar.");
52431
- }
52432
- return transformMatrix;
52433
- };
52434
- /**
52435
- * Puts a given matrix (2D array) into the Reduced Row Echelon Form.
52436
- * Returns True if successful, False if the transformMatrix is singular.
52437
- * Code from: https://github.com/commenthol/affinefit
52438
- * Modification:
52439
- * 1. Updated epsilon from 1e-10 to 1e-12 to reduce the possibility of valid matrix detected as singular
52440
- * (can happen when points to convert are too close to each other on high LODs)
52441
- */
52442
- AffineTransform._gaussJordanElimination = function (transformMatrix) {
52443
- var eps = 1e-12; // 1.0 / Math.pow(10, 12)
52444
- var dimPlusOne = transformMatrix.length;
52445
- var w = 2 * dimPlusOne - 1;
52446
- var tempNum;
52447
- var tempArray;
52448
- for (var j = 0; j < dimPlusOne; j++) {
52449
- var maxrow = j;
52450
- for (var i = j + 1; i < dimPlusOne; i++) {
52451
- // Find max pivot.
52452
- if (Math.abs(transformMatrix[i][j]) > Math.abs(transformMatrix[maxrow][j])) {
52453
- maxrow = i;
52454
- }
52455
- }
52456
- tempArray = transformMatrix[maxrow];
52457
- transformMatrix[maxrow] = transformMatrix[j];
52458
- transformMatrix[j] = tempArray;
52459
- if (Math.abs(transformMatrix[j][j]) <= eps) {
52460
- // Is Singular?
52461
- return false;
52462
- }
52463
- for (var _j = j + 1; _j < dimPlusOne; _j++) {
52464
- // Eliminate column y.
52465
- tempNum = transformMatrix[_j][j] / transformMatrix[j][j];
52466
- for (var _i = j; _i < w; _i++) {
52467
- transformMatrix[_j][_i] -= transformMatrix[j][_i] * tempNum;
52468
- }
52469
- }
52470
- }
52471
- for (var j = dimPlusOne - 1; j > -1; j--) {
52472
- // Backsubstitute.
52473
- tempNum = transformMatrix[j][j];
52474
- for (var i = 0; i < j; i++) {
52475
- for (var _x = w - 1; _x > j - 1; _x--) {
52476
- transformMatrix[i][_x] -= transformMatrix[j][_x] * transformMatrix[i][j] / tempNum;
52477
- }
52478
- }
52479
- transformMatrix[j][j] /= tempNum;
52480
- for (var _x2 = dimPlusOne; _x2 < w; _x2++) {
52481
- // Normalize row y.
52482
- transformMatrix[j][_x2] /= tempNum;
52483
- }
52484
- }
52485
- return true;
52486
- };
52487
- return AffineTransform;
52488
- }());
52489
-
52490
-
52491
-
52492
- var index$2 = /*#__PURE__*/Object.freeze({
52493
- __proto__: null,
52494
- AffineTransform: AffineTransform,
52495
- WEBMERCATOR_MAXLAT: WEBMERCATOR_MAXLAT,
52496
- _precision: _precision,
52497
- get AreaUnits () { return AreaUnits; },
52498
- get DistanceUnits () { return DistanceUnits; },
52499
- get TimeUnits () { return TimeUnits; },
52500
- get SpeedUnits () { return SpeedUnits; },
52501
- get AccelerationUnits () { return AccelerationUnits; },
52502
- boundingBoxToPolygon: boundingBoxToPolygon,
52503
- convertDistance: convertDistance,
52504
- getCardinalSpline: getCardinalSpline,
52505
- getDestination: getDestination,
52506
- getDistanceTo: getDistanceTo,
52507
- getEarthRadius: getEarthRadius,
52508
- getPathDenormalizedAtAntimerian: getPathDenormalizedAtAntimerian,
52509
- getPathSplitByAntimeridian: getPathSplitByAntimeridian,
52510
- getGeodesicPath: getGeodesicPath,
52511
- getGeodesicPaths: getGeodesicPaths,
52512
- getHeading: getHeading,
52513
- getLengthOfPath: getLengthOfPath,
52514
- getPositionAlongPath: getPositionAlongPath,
52515
- getRegularPolygonPath: getRegularPolygonPath,
52516
- getRegularPolygonPaths: getRegularPolygonPaths,
52517
- interpolate: interpolate,
52518
- normalizeLatitude: normalizeLatitude,
52519
- normalizeLongitude: normalizeLongitude,
52520
- rotatePositions: rotatePositions,
52521
- getPixelHeading: getPixelHeading,
52522
- mercatorPixelsToPositions: mercatorPixelsToPositions,
52523
- mercatorPositionsToPixels: mercatorPositionsToPixels,
52524
- convertAcceleration: convertAcceleration,
52525
- convertArea: convertArea,
52526
- convertSpeed: convertSpeed,
52527
- convertTimespan: convertTimespan,
52528
- getAcceleration: getAcceleration,
52529
- getAccelerationFromSpeeds: getAccelerationFromSpeeds,
52530
- getAccelerationFromFeatures: getAccelerationFromFeatures,
52531
- getArea: getArea,
52532
- getSpeed: getSpeed,
52533
- getSpeedFromFeatures: getSpeedFromFeatures,
52534
- getTimespan: getTimespan,
52535
- getTravelDistance: getTravelDistance,
52536
- parseTimestamp: parseTimestamp,
52537
- getConvexHull: getConvexHull,
52538
- getPositions: getPositions,
52539
- getPosition: getPosition,
52540
- getPositionsAlongPath: getPositionsAlongPath,
52541
- getPointWithHeadingAlongPath: getPointWithHeadingAlongPath,
52542
- getPointsWithHeadingsAlongPath: getPointsWithHeadingsAlongPath,
52543
- getClosestPointOnGeometry: getClosestPointOnGeometry,
52544
- simplify: simplify
52545
- });
52546
-
52547
- /**
52548
- * The options for a ZoomControl object.
52549
- */
52550
- var ZoomControlOptions = /** @class */ (function (_super) {
52551
- __extends(ZoomControlOptions, _super);
52552
- function ZoomControlOptions() {
52553
- var _this = _super !== null && _super.apply(this, arguments) || this;
52554
- /**
52555
- * The extent to which the map will zoom with each click of the control.
52556
- * Default `1`.
52557
- * @default 1
52558
- */
52559
- _this.zoomDelta = 1;
52560
- /**
52561
- * The style of the control.
52562
- * Default `ControlStyle.light`.
52563
- * @default ControlStyle.light
52564
- */
52565
- _this.style = exports.ControlStyle.light;
52566
- return _this;
52567
- }
52568
- return ZoomControlOptions;
52569
- }(Options));
52570
-
52571
- /**
52572
- * A control for changing the zoom of the map.
52573
- */
52574
- var ZoomControl = /** @class */ (function (_super) {
52575
- __extends(ZoomControl, _super);
52576
- /**
52577
- * Constructs a ZoomControl.
52578
- * @param options The options for the control.
52579
- */
52580
- function ZoomControl(options) {
52581
- var _this = _super.call(this) || this;
52582
- _this.container = null;
52583
- _this.zoomInButton = null;
52584
- _this.zoomOutButton = null;
52585
- _this.zoomChanged = function (event) { return _this.updateZoomButtonsState(); };
52586
- _this.minZoomChanged = function (zoom) { return _this.updateZoomButtonsState(); };
52587
- _this.maxZoomChanged = function (zoom) { return _this.updateZoomButtonsState(); };
52588
- _this.options = new ZoomControlOptions().merge(options);
52589
- return _this;
52590
- }
52591
- /**
52592
- * Initialization method for the control which is called when added to the map.
52593
- * @param map The map that the control will be added to.
52594
- * @return An HTMLElement to be placed on the map for the control.
52595
- */
52596
- ZoomControl.prototype.onAdd = function (map) {
52597
- this.container = this.buildContainer(map, this.options.style, "Zoom Control");
52598
- this.container.style.flexDirection = "column";
52599
- this.zoomInButton = this.constructZoomInButton(map);
52600
- this.zoomOutButton = this.constructZoomOutButton(map);
52601
- var tooltipZoomIn = buildAccessibleTooltip("Zoom In");
52602
- var tooltipZoomOut = buildAccessibleTooltip("Zoom Out");
52603
- this.container.appendChild(this.zoomInButton);
52604
- this.container.appendChild(tooltipZoomIn);
52605
- this.container.appendChild(this.zoomOutButton);
52606
- this.container.appendChild(tooltipZoomOut);
52607
- positionTooltip(tooltipZoomIn, this.zoomInButton);
52608
- positionTooltip(tooltipZoomOut, this.zoomOutButton);
52609
- map.events.add('zoom', this.zoomChanged);
52610
- map.events.add('minzoomchanged', this.minZoomChanged);
52611
- map.events.add('maxzoomchanged', this.maxZoomChanged);
52612
- this.map = map;
52613
- return this.container;
52614
- };
52615
- ZoomControl.prototype.onRemove = function () {
52616
- if (this.map) {
52617
- this.map.events.remove('zoom', this.zoomChanged);
52618
- this.map.events.remove('minzoomchanged', this.minZoomChanged);
52619
- this.map.events.remove('maxzoomchanged', this.maxZoomChanged);
52620
- this.map = null;
52621
- }
52622
- if (this.container) {
52623
- this.container.remove();
52624
- this.container = null;
52625
- this.zoomInButton = null;
52626
- this.zoomOutButton = null;
52627
- }
52628
- };
52629
- ZoomControl.prototype.updateZoomButtonsState = function () {
52630
- var zoomInDisabled = this.map.getCamera().zoom >= this.map._getMap().getMaxZoom();
52631
- // small values need special handling, since depending on the height of the map view
52632
- // the actual zoom we can zoom out to can be above or below 0 when the entire map fits the height into the view
52633
- // use web mercator bounds to check if entire latitude range is visible
52634
- var reachedLatitudeBoundaries = BoundingBox.getSouth(this.map.getCamera().bounds) <= -WEBMERCATOR_MAXLAT
52635
- && BoundingBox.getNorth(this.map.getCamera().bounds) >= WEBMERCATOR_MAXLAT;
52636
- var zoomOutDisabled = this.map.getCamera().zoom <= this.map._getMap().getMinZoom() || reachedLatitudeBoundaries;
52637
- if (this.zoomInButton && this.zoomInButton.disabled != zoomInDisabled) {
52638
- this.zoomInButton.disabled = zoomInDisabled;
52639
- this.zoomInButton.setAttribute("aria-label", zoomInDisabled ? "Zoom In disabled" : "Zoom In");
52640
- }
52641
- if (this.zoomOutButton && this.zoomOutButton.disabled != zoomOutDisabled) {
52642
- this.zoomOutButton.disabled = zoomOutDisabled;
52643
- this.zoomInButton.setAttribute("aria-label", zoomInDisabled ? "Zoom Out disabled" : "Zoom Out");
51975
+ if (this.zoomOutButton && this.zoomOutButton.disabled != zoomOutDisabled) {
51976
+ this.zoomOutButton.disabled = zoomOutDisabled;
51977
+ this.zoomInButton.setAttribute("aria-label", zoomInDisabled ? "Zoom Out disabled" : "Zoom Out");
52644
51978
  }
52645
51979
  };
52646
51980
  ZoomControl.prototype.constructZoomInButton = function (map) {
@@ -54855,12 +54189,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
54855
54189
  * @default false
54856
54190
  */
54857
54191
  _this.optional = false;
54858
- /**
54859
- * Size of the additional area around the icon bounding box used for detecting symbol collisions.
54860
- * Default `2`.
54861
- * @default 2
54862
- */
54863
- _this.padding = 2;
54864
54192
  /**
54865
54193
  * Specifies the orientation of the icon when the map is pitched.
54866
54194
  * <p>`"auto"`: Automatically matches the value of `rotationAlignment`.</p>
@@ -54959,16 +54287,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
54959
54287
  * @default false
54960
54288
  */
54961
54289
  _this.ignorePlacement = false;
54962
- /**
54963
- * Text justification options.
54964
- * <p>`"auto"`: The text is aligned towards the anchor position.
54965
- * <p>`"left"`: The text is aligned to the left.
54966
- * <p>`"center"`: The text is centered.
54967
- * <p>`"right"`: The text is aligned to the right.
54968
- * Default `"center"`.
54969
- * @default "center"
54970
- */
54971
- _this.justify = "center";
54972
54290
  /**
54973
54291
  * Specifies an offset distance of the icon from its anchor in ems.
54974
54292
  * Positive values indicate right and down, while negative values indicate left and up.
@@ -54984,13 +54302,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
54984
54302
  * @default false
54985
54303
  */
54986
54304
  _this.optional = false;
54987
- /**
54988
- * Size of the additional area around the text bounding box used for detecting
54989
- * symbol collisions.
54990
- * Default `2`.
54991
- * @default 2
54992
- */
54993
- _this.padding = 2;
54994
54305
  /**
54995
54306
  * Specifies the orientation of the text when the map is pitched.
54996
54307
  * <p>`"auto"`: Automatically matches the value of `rotationAlignment`.</p>
@@ -55102,19 +54413,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
55102
54413
  * @default "point"
55103
54414
  */
55104
54415
  _this.placement = "point";
55105
- /**
55106
- * Determines whether overlapping symbols in the same layer are rendered in the order
55107
- * that they appear in the data source, or by their y position relative to the viewport.
55108
- * To control the order and prioritization of symbols otherwise, use `sortKey`.
55109
- * <p>`"auto"`: Sorts symbols by `sortKey` if set. Otherwise behaves like `"viewport-y"`.
55110
- * <p>`"viewport-y"`: Sorts symbols by their y position if `allowOverlap` is `true` or
55111
- * if `ignorePlacement` is `false`.
55112
- * <p>`"source"`: Sorts symbols by `sortKey` if set. Otherwise, symbols are rendered in the
55113
- * same order as the source data.
55114
- * Default `"auto"`
55115
- * @default "auto"
55116
- */
55117
- _this.zOrder = "auto";
55118
54416
  /**
55119
54417
  * Distance in pixels between two symbol anchors along a line. Must be greater or equal to 1.
55120
54418
  * Default `250`.
@@ -55172,52 +54470,39 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
55172
54470
  this.map.layers.add(this);
55173
54471
  return;
55174
54472
  }
55175
- var thisOpts = this.options;
55176
- var newIconOpts = newOptions.iconOptions;
55177
- var thisIconOpts = thisOpts.iconOptions;
55178
- var newTextOpts = newOptions.textOptions;
55179
- var thisTextOpts = thisOpts.textOptions;
55180
54473
  // Symbol options.
55181
- this._updateBaseProperties(newOptions, thisOpts);
55182
- this._updateLayoutProperty("symbol-spacing", newOptions.lineSpacing, thisOpts.lineSpacing);
55183
- this._updateLayoutProperty("symbol-placement", newOptions.placement, thisOpts.placement);
55184
- this._updateLayoutProperty("symbol-sort-key", newOptions.sortKey, thisOpts.sortKey);
55185
- // REVIEW: @types/mapboxgl-js doesn't show "auto" for "symbol-z-order"
55186
- this._updateLayoutProperty("symbol-z-order", newOptions.zOrder, thisOpts.zOrder);
54474
+ this._updateBaseProperties(newOptions, this.options);
54475
+ this._updateLayoutProperty("symbol-spacing", newOptions.lineSpacing, this.options.lineSpacing);
54476
+ this._updateLayoutProperty("symbol-placement", newOptions.placement, this.options.placement);
55187
54477
  // Icon options.
55188
- this._updateLayoutProperty("icon-allow-overlap", newIconOpts.allowOverlap, thisIconOpts.allowOverlap);
55189
- this._updateLayoutProperty("icon-anchor", newIconOpts.anchor, thisIconOpts.anchor);
55190
- this._updateLayoutProperty("icon-ignore-placement", newIconOpts.ignorePlacement, thisIconOpts.ignorePlacement);
55191
- this._updateLayoutProperty("icon-image", newIconOpts.image, thisIconOpts.image);
55192
- this._updateLayoutProperty("icon-offset", newIconOpts.offset, thisIconOpts.offset);
55193
- this._updatePaintProperty("icon-opacity", newIconOpts.opacity, thisIconOpts.opacity);
55194
- this._updateLayoutProperty("icon-optional", newIconOpts.optional, thisIconOpts.optional);
55195
- this._updateLayoutProperty("icon-padding", newIconOpts.padding, thisIconOpts.padding);
55196
- this._updateLayoutProperty("icon-pitch-alignment", newIconOpts.pitchAlignment, thisIconOpts.pitchAlignment);
55197
- this._updateLayoutProperty("icon-rotate", newIconOpts.rotation, thisIconOpts.rotation);
55198
- this._updateLayoutProperty("icon-rotation-alignment", newIconOpts.rotationAlignment, thisIconOpts.rotationAlignment);
55199
- this._updateLayoutProperty("icon-size", newIconOpts.size, thisIconOpts.size);
54478
+ this._updateLayoutProperty("icon-allow-overlap", newOptions.iconOptions.allowOverlap, this.options.iconOptions.allowOverlap);
54479
+ this._updateLayoutProperty("icon-anchor", newOptions.iconOptions.anchor, this.options.iconOptions.anchor);
54480
+ this._updateLayoutProperty("icon-ignore-placement", newOptions.iconOptions.ignorePlacement, this.options.iconOptions.ignorePlacement);
54481
+ this._updateLayoutProperty("icon-image", newOptions.iconOptions.image, this.options.iconOptions.image);
54482
+ this._updateLayoutProperty("icon-offset", newOptions.iconOptions.offset, this.options.iconOptions.offset);
54483
+ this._updatePaintProperty("icon-opacity", newOptions.iconOptions.opacity, this.options.iconOptions.opacity);
54484
+ this._updateLayoutProperty("icon-optional", newOptions.iconOptions.optional, this.options.iconOptions.optional);
54485
+ this._updateLayoutProperty("icon-pitch-alignment", newOptions.iconOptions.pitchAlignment, this.options.iconOptions.pitchAlignment);
54486
+ this._updateLayoutProperty("icon-rotate", newOptions.iconOptions.rotation, this.options.iconOptions.rotation);
54487
+ this._updateLayoutProperty("icon-rotation-alignment", newOptions.iconOptions.rotationAlignment, this.options.iconOptions.rotationAlignment);
54488
+ this._updateLayoutProperty("icon-size", newOptions.iconOptions.size, this.options.iconOptions.size);
55200
54489
  // Text options.
55201
- this._updateLayoutProperty("text-allow-overlap", newTextOpts.allowOverlap, thisTextOpts.allowOverlap);
55202
- this._updateLayoutProperty("text-anchor", newTextOpts.anchor, thisTextOpts.anchor);
55203
- this._updatePaintProperty("text-color", newTextOpts.color, thisTextOpts.color);
55204
- this._updateLayoutProperty("text-font", newTextOpts.font, thisTextOpts.font);
55205
- this._updateLayoutProperty("text-ignore-placement", newTextOpts.ignorePlacement, thisTextOpts.ignorePlacement);
55206
- this._updateLayoutProperty("text-justify", newTextOpts.justify, thisTextOpts.justify);
55207
- this._updatePaintProperty("text-halo-blur", newTextOpts.haloBlur, thisTextOpts.haloBlur);
55208
- this._updatePaintProperty("text-halo-color", newTextOpts.haloColor, thisTextOpts.haloColor);
55209
- this._updatePaintProperty("text-halo-width", newTextOpts.haloWidth, thisTextOpts.haloWidth);
55210
- this._updateLayoutProperty("text-offset", newTextOpts.offset, thisTextOpts.offset);
55211
- this._updatePaintProperty("text-opacity", newTextOpts.opacity, thisTextOpts.opacity);
55212
- this._updateLayoutProperty("text-optional", newTextOpts.optional, thisTextOpts.optional);
55213
- this._updateLayoutProperty("text-padding", newTextOpts.padding, thisTextOpts.padding);
55214
- this._updateLayoutProperty("text-pitch-alignment", newTextOpts.pitchAlignment, thisTextOpts.pitchAlignment);
55215
- this._updateLayoutProperty("text-radial-offset", newTextOpts.radialOffset, thisTextOpts.radialOffset);
55216
- this._updateLayoutProperty("text-rotate", newTextOpts.rotation, thisTextOpts.rotation);
55217
- this._updateLayoutProperty("text-rotation-alignment", newTextOpts.rotationAlignment, thisTextOpts.rotationAlignment);
55218
- this._updateLayoutProperty("text-size", newTextOpts.size, thisTextOpts.size);
55219
- this._updateLayoutProperty("text-variable-anchor", newTextOpts.variableAnchor, thisTextOpts.variableAnchor);
55220
- this._updateLayoutProperty("text-field", newTextOpts.textField, thisTextOpts.textField);
54490
+ this._updateLayoutProperty("text-allow-overlap", newOptions.textOptions.allowOverlap, this.options.textOptions.allowOverlap);
54491
+ this._updateLayoutProperty("text-anchor", newOptions.textOptions.anchor, this.options.textOptions.anchor);
54492
+ this._updatePaintProperty("text-color", newOptions.textOptions.color, this.options.textOptions.color);
54493
+ this._updateLayoutProperty("text-font", newOptions.textOptions.font, this.options.textOptions.font);
54494
+ this._updateLayoutProperty("text-ignore-placement", newOptions.textOptions.ignorePlacement, this.options.textOptions.ignorePlacement);
54495
+ this._updatePaintProperty("text-halo-blur", newOptions.textOptions.haloBlur, this.options.textOptions.haloBlur);
54496
+ this._updatePaintProperty("text-halo-color", newOptions.textOptions.haloColor, this.options.textOptions.haloColor);
54497
+ this._updatePaintProperty("text-halo-width", newOptions.textOptions.haloWidth, this.options.textOptions.haloWidth);
54498
+ this._updateLayoutProperty("text-offset", newOptions.textOptions.offset, this.options.textOptions.offset);
54499
+ this._updatePaintProperty("text-opacity", newOptions.textOptions.opacity, this.options.textOptions.opacity);
54500
+ this._updateLayoutProperty("text-optional", newOptions.textOptions.optional, this.options.textOptions.optional);
54501
+ this._updateLayoutProperty("text-pitch-alignment", newOptions.textOptions.pitchAlignment, this.options.textOptions.pitchAlignment);
54502
+ this._updateLayoutProperty("text-rotate", newOptions.textOptions.rotation, this.options.textOptions.rotation);
54503
+ this._updateLayoutProperty("text-rotation-alignment", newOptions.textOptions.rotationAlignment, this.options.textOptions.rotationAlignment);
54504
+ this._updateLayoutProperty("text-size", newOptions.textOptions.size, this.options.textOptions.size);
54505
+ this._updateLayoutProperty("text-field", newOptions.textOptions.textField, this.options.textOptions.textField);
55221
54506
  }
55222
54507
  this.options = newOptions;
55223
54508
  };
@@ -55227,11 +54512,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
55227
54512
  SymbolLayer.prototype._buildLayers = function () {
55228
54513
  var layer = __assign(__assign(__assign(__assign({ id: this.id, type: "symbol" }, (this.options.sourceLayer && { "source-layer": this.options.sourceLayer })), { source: this.options.source instanceof Source ?
55229
54514
  this.options.source.getId() :
55230
- this.options.source, layout: __assign(__assign({ visibility: this.options.visible ? "visible" : "none", "symbol-placement": this.options.placement, "symbol-spacing": this.options.lineSpacing, "symbol-z-order": this.options.zOrder,
54515
+ this.options.source, layout: __assign(__assign({ visibility: this.options.visible ? "visible" : "none", "symbol-placement": this.options.placement, "symbol-spacing": this.options.lineSpacing,
55231
54516
  // Text options.
55232
- "text-allow-overlap": this.options.textOptions.allowOverlap, "text-anchor": this.options.textOptions.anchor }, (this.options.textOptions.textField && { "text-field": this.options.textOptions.textField })), { "text-font": this.options.textOptions.font, "text-ignore-placement": this.options.textOptions.ignorePlacement, "text-justify": this.options.textOptions.justify, "text-offset": this.options.textOptions.offset, "text-optional": this.options.textOptions.optional, "text-padding": this.options.textOptions.padding, "text-pitch-alignment": this.options.textOptions.pitchAlignment, "text-rotate": this.options.textOptions.rotation, "text-rotation-alignment": this.options.textOptions.rotationAlignment, "text-size": this.options.textOptions.size,
54517
+ "text-allow-overlap": this.options.textOptions.allowOverlap, "text-anchor": this.options.textOptions.anchor }, (this.options.textOptions.textField && { "text-field": this.options.textOptions.textField })), { "text-font": this.options.textOptions.font, "text-ignore-placement": this.options.textOptions.ignorePlacement, "text-offset": this.options.textOptions.offset, "text-optional": this.options.textOptions.optional, "text-pitch-alignment": this.options.textOptions.pitchAlignment, "text-rotate": this.options.textOptions.rotation, "text-rotation-alignment": this.options.textOptions.rotationAlignment, "text-size": this.options.textOptions.size,
55233
54518
  // Icon options.
55234
- "icon-allow-overlap": this.options.iconOptions.allowOverlap, "icon-anchor": this.options.iconOptions.anchor, "icon-ignore-placement": this.options.iconOptions.ignorePlacement, "icon-image": this.options.iconOptions.image, "icon-offset": this.options.iconOptions.offset, "icon-optional": this.options.iconOptions.optional, "icon-padding": this.options.iconOptions.padding, "icon-pitch-alignment": this.options.iconOptions.pitchAlignment, "icon-rotate": this.options.iconOptions.rotation, "icon-rotation-alignment": this.options.iconOptions.rotationAlignment, "icon-size": this.options.iconOptions.size }), paint: {
54519
+ "icon-allow-overlap": this.options.iconOptions.allowOverlap, "icon-anchor": this.options.iconOptions.anchor, "icon-ignore-placement": this.options.iconOptions.ignorePlacement, "icon-image": this.options.iconOptions.image, "icon-offset": this.options.iconOptions.offset, "icon-optional": this.options.iconOptions.optional, "icon-pitch-alignment": this.options.iconOptions.pitchAlignment, "icon-rotate": this.options.iconOptions.rotation, "icon-rotation-alignment": this.options.iconOptions.rotationAlignment, "icon-size": this.options.iconOptions.size }), paint: {
55235
54520
  // Text options.
55236
54521
  "text-color": this.options.textOptions.color,
55237
54522
  "text-halo-blur": this.options.textOptions.haloBlur,
@@ -55241,17 +54526,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
55241
54526
  // Icon options.
55242
54527
  "icon-opacity": this.options.iconOptions.opacity,
55243
54528
  } }), (this.options.filter && { filter: this.options.filter })), { minzoom: this.options.minZoom, maxzoom: this.options.maxZoom });
55244
- // REVIEW: MapLibre throws style validation error if optional properties show up in style
55245
- // with null/undefined as value.
55246
- if (typeof this.options.sortKey !== "undefined") {
55247
- layer.layout["symbol-sort-key"] = this.options.sortKey;
55248
- }
55249
- if (typeof this.options.textOptions.radialOffset !== "undefined") {
55250
- layer.layout["text-radial-offset"] = this.options.textOptions.radialOffset;
55251
- }
55252
- if (typeof this.options.textOptions.variableAnchor !== "undefined") {
55253
- layer.layout["text-variable-anchor"] = this.options.textOptions.variableAnchor;
55254
- }
55255
54529
  return [layer];
55256
54530
  };
55257
54531
  /**
@@ -55557,6 +54831,65 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
55557
54831
  return Html;
55558
54832
  }());
55559
54833
 
54834
+ /** `Object#toString` result references. */
54835
+ var objectTag$4 = '[object Object]';
54836
+
54837
+ /** Used for built-in method references. */
54838
+ var funcProto$2 = Function.prototype,
54839
+ objectProto$f = Object.prototype;
54840
+
54841
+ /** Used to resolve the decompiled source of functions. */
54842
+ var funcToString$2 = funcProto$2.toString;
54843
+
54844
+ /** Used to check objects for own properties. */
54845
+ var hasOwnProperty$c = objectProto$f.hasOwnProperty;
54846
+
54847
+ /** Used to infer the `Object` constructor. */
54848
+ var objectCtorString = funcToString$2.call(Object);
54849
+
54850
+ /**
54851
+ * Checks if `value` is a plain object, that is, an object created by the
54852
+ * `Object` constructor or one with a `[[Prototype]]` of `null`.
54853
+ *
54854
+ * @static
54855
+ * @memberOf _
54856
+ * @since 0.8.0
54857
+ * @category Lang
54858
+ * @param {*} value The value to check.
54859
+ * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
54860
+ * @example
54861
+ *
54862
+ * function Foo() {
54863
+ * this.a = 1;
54864
+ * }
54865
+ *
54866
+ * _.isPlainObject(new Foo);
54867
+ * // => false
54868
+ *
54869
+ * _.isPlainObject([1, 2, 3]);
54870
+ * // => false
54871
+ *
54872
+ * _.isPlainObject({ 'x': 0, 'y': 0 });
54873
+ * // => true
54874
+ *
54875
+ * _.isPlainObject(Object.create(null));
54876
+ * // => true
54877
+ */
54878
+ function isPlainObject(value) {
54879
+ if (!isObjectLike_1(value) || _baseGetTag(value) != objectTag$4) {
54880
+ return false;
54881
+ }
54882
+ var proto = _getPrototype(value);
54883
+ if (proto === null) {
54884
+ return true;
54885
+ }
54886
+ var Ctor = hasOwnProperty$c.call(proto, 'constructor') && proto.constructor;
54887
+ return typeof Ctor == 'function' && Ctor instanceof Ctor &&
54888
+ funcToString$2.call(Ctor) == objectCtorString;
54889
+ }
54890
+
54891
+ var isPlainObject_1 = isPlainObject;
54892
+
55560
54893
  /**
55561
54894
  * Checks if `value` is likely a DOM element.
55562
54895
  *
@@ -56477,6 +55810,549 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
56477
55810
  return HtmlMarker;
56478
55811
  }(EventEmitter));
56479
55812
 
55813
+ /**
55814
+ * This function is like `assignValue` except that it doesn't assign
55815
+ * `undefined` values.
55816
+ *
55817
+ * @private
55818
+ * @param {Object} object The object to modify.
55819
+ * @param {string} key The key of the property to assign.
55820
+ * @param {*} value The value to assign.
55821
+ */
55822
+ function assignMergeValue(object, key, value) {
55823
+ if ((value !== undefined && !eq_1(object[key], value)) ||
55824
+ (value === undefined && !(key in object))) {
55825
+ _baseAssignValue(object, key, value);
55826
+ }
55827
+ }
55828
+
55829
+ var _assignMergeValue = assignMergeValue;
55830
+
55831
+ /**
55832
+ * Creates a base function for methods like `_.forIn` and `_.forOwn`.
55833
+ *
55834
+ * @private
55835
+ * @param {boolean} [fromRight] Specify iterating from right to left.
55836
+ * @returns {Function} Returns the new base function.
55837
+ */
55838
+ function createBaseFor(fromRight) {
55839
+ return function(object, iteratee, keysFunc) {
55840
+ var index = -1,
55841
+ iterable = Object(object),
55842
+ props = keysFunc(object),
55843
+ length = props.length;
55844
+
55845
+ while (length--) {
55846
+ var key = props[fromRight ? length : ++index];
55847
+ if (iteratee(iterable[key], key, iterable) === false) {
55848
+ break;
55849
+ }
55850
+ }
55851
+ return object;
55852
+ };
55853
+ }
55854
+
55855
+ var _createBaseFor = createBaseFor;
55856
+
55857
+ /**
55858
+ * The base implementation of `baseForOwn` which iterates over `object`
55859
+ * properties returned by `keysFunc` and invokes `iteratee` for each property.
55860
+ * Iteratee functions may exit iteration early by explicitly returning `false`.
55861
+ *
55862
+ * @private
55863
+ * @param {Object} object The object to iterate over.
55864
+ * @param {Function} iteratee The function invoked per iteration.
55865
+ * @param {Function} keysFunc The function to get the keys of `object`.
55866
+ * @returns {Object} Returns `object`.
55867
+ */
55868
+ var baseFor = _createBaseFor();
55869
+
55870
+ var _baseFor = baseFor;
55871
+
55872
+ /**
55873
+ * This method is like `_.isArrayLike` except that it also checks if `value`
55874
+ * is an object.
55875
+ *
55876
+ * @static
55877
+ * @memberOf _
55878
+ * @since 4.0.0
55879
+ * @category Lang
55880
+ * @param {*} value The value to check.
55881
+ * @returns {boolean} Returns `true` if `value` is an array-like object,
55882
+ * else `false`.
55883
+ * @example
55884
+ *
55885
+ * _.isArrayLikeObject([1, 2, 3]);
55886
+ * // => true
55887
+ *
55888
+ * _.isArrayLikeObject(document.body.children);
55889
+ * // => true
55890
+ *
55891
+ * _.isArrayLikeObject('abc');
55892
+ * // => false
55893
+ *
55894
+ * _.isArrayLikeObject(_.noop);
55895
+ * // => false
55896
+ */
55897
+ function isArrayLikeObject(value) {
55898
+ return isObjectLike_1(value) && isArrayLike_1(value);
55899
+ }
55900
+
55901
+ var isArrayLikeObject_1 = isArrayLikeObject;
55902
+
55903
+ /**
55904
+ * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
55905
+ *
55906
+ * @private
55907
+ * @param {Object} object The object to query.
55908
+ * @param {string} key The key of the property to get.
55909
+ * @returns {*} Returns the property value.
55910
+ */
55911
+ function safeGet(object, key) {
55912
+ if (key === 'constructor' && typeof object[key] === 'function') {
55913
+ return;
55914
+ }
55915
+
55916
+ if (key == '__proto__') {
55917
+ return;
55918
+ }
55919
+
55920
+ return object[key];
55921
+ }
55922
+
55923
+ var _safeGet = safeGet;
55924
+
55925
+ /**
55926
+ * Converts `value` to a plain object flattening inherited enumerable string
55927
+ * keyed properties of `value` to own properties of the plain object.
55928
+ *
55929
+ * @static
55930
+ * @memberOf _
55931
+ * @since 3.0.0
55932
+ * @category Lang
55933
+ * @param {*} value The value to convert.
55934
+ * @returns {Object} Returns the converted plain object.
55935
+ * @example
55936
+ *
55937
+ * function Foo() {
55938
+ * this.b = 2;
55939
+ * }
55940
+ *
55941
+ * Foo.prototype.c = 3;
55942
+ *
55943
+ * _.assign({ 'a': 1 }, new Foo);
55944
+ * // => { 'a': 1, 'b': 2 }
55945
+ *
55946
+ * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
55947
+ * // => { 'a': 1, 'b': 2, 'c': 3 }
55948
+ */
55949
+ function toPlainObject(value) {
55950
+ return _copyObject(value, keysIn_1(value));
55951
+ }
55952
+
55953
+ var toPlainObject_1 = toPlainObject;
55954
+
55955
+ /**
55956
+ * A specialized version of `baseMerge` for arrays and objects which performs
55957
+ * deep merges and tracks traversed objects enabling objects with circular
55958
+ * references to be merged.
55959
+ *
55960
+ * @private
55961
+ * @param {Object} object The destination object.
55962
+ * @param {Object} source The source object.
55963
+ * @param {string} key The key of the value to merge.
55964
+ * @param {number} srcIndex The index of `source`.
55965
+ * @param {Function} mergeFunc The function to merge values.
55966
+ * @param {Function} [customizer] The function to customize assigned values.
55967
+ * @param {Object} [stack] Tracks traversed source values and their merged
55968
+ * counterparts.
55969
+ */
55970
+ function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
55971
+ var objValue = _safeGet(object, key),
55972
+ srcValue = _safeGet(source, key),
55973
+ stacked = stack.get(srcValue);
55974
+
55975
+ if (stacked) {
55976
+ _assignMergeValue(object, key, stacked);
55977
+ return;
55978
+ }
55979
+ var newValue = customizer
55980
+ ? customizer(objValue, srcValue, (key + ''), object, source, stack)
55981
+ : undefined;
55982
+
55983
+ var isCommon = newValue === undefined;
55984
+
55985
+ if (isCommon) {
55986
+ var isArr = isArray_1(srcValue),
55987
+ isBuff = !isArr && isBuffer_1(srcValue),
55988
+ isTyped = !isArr && !isBuff && isTypedArray_1(srcValue);
55989
+
55990
+ newValue = srcValue;
55991
+ if (isArr || isBuff || isTyped) {
55992
+ if (isArray_1(objValue)) {
55993
+ newValue = objValue;
55994
+ }
55995
+ else if (isArrayLikeObject_1(objValue)) {
55996
+ newValue = _copyArray(objValue);
55997
+ }
55998
+ else if (isBuff) {
55999
+ isCommon = false;
56000
+ newValue = _cloneBuffer(srcValue, true);
56001
+ }
56002
+ else if (isTyped) {
56003
+ isCommon = false;
56004
+ newValue = _cloneTypedArray(srcValue, true);
56005
+ }
56006
+ else {
56007
+ newValue = [];
56008
+ }
56009
+ }
56010
+ else if (isPlainObject_1(srcValue) || isArguments_1(srcValue)) {
56011
+ newValue = objValue;
56012
+ if (isArguments_1(objValue)) {
56013
+ newValue = toPlainObject_1(objValue);
56014
+ }
56015
+ else if (!isObject_1(objValue) || isFunction_1(objValue)) {
56016
+ newValue = _initCloneObject(srcValue);
56017
+ }
56018
+ }
56019
+ else {
56020
+ isCommon = false;
56021
+ }
56022
+ }
56023
+ if (isCommon) {
56024
+ // Recursively merge objects and arrays (susceptible to call stack limits).
56025
+ stack.set(srcValue, newValue);
56026
+ mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
56027
+ stack['delete'](srcValue);
56028
+ }
56029
+ _assignMergeValue(object, key, newValue);
56030
+ }
56031
+
56032
+ var _baseMergeDeep = baseMergeDeep;
56033
+
56034
+ /**
56035
+ * The base implementation of `_.merge` without support for multiple sources.
56036
+ *
56037
+ * @private
56038
+ * @param {Object} object The destination object.
56039
+ * @param {Object} source The source object.
56040
+ * @param {number} srcIndex The index of `source`.
56041
+ * @param {Function} [customizer] The function to customize merged values.
56042
+ * @param {Object} [stack] Tracks traversed source values and their merged
56043
+ * counterparts.
56044
+ */
56045
+ function baseMerge(object, source, srcIndex, customizer, stack) {
56046
+ if (object === source) {
56047
+ return;
56048
+ }
56049
+ _baseFor(source, function(srcValue, key) {
56050
+ stack || (stack = new _Stack);
56051
+ if (isObject_1(srcValue)) {
56052
+ _baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
56053
+ }
56054
+ else {
56055
+ var newValue = customizer
56056
+ ? customizer(_safeGet(object, key), srcValue, (key + ''), object, source, stack)
56057
+ : undefined;
56058
+
56059
+ if (newValue === undefined) {
56060
+ newValue = srcValue;
56061
+ }
56062
+ _assignMergeValue(object, key, newValue);
56063
+ }
56064
+ }, keysIn_1);
56065
+ }
56066
+
56067
+ var _baseMerge = baseMerge;
56068
+
56069
+ /**
56070
+ * This method returns the first argument it receives.
56071
+ *
56072
+ * @static
56073
+ * @since 0.1.0
56074
+ * @memberOf _
56075
+ * @category Util
56076
+ * @param {*} value Any value.
56077
+ * @returns {*} Returns `value`.
56078
+ * @example
56079
+ *
56080
+ * var object = { 'a': 1 };
56081
+ *
56082
+ * console.log(_.identity(object) === object);
56083
+ * // => true
56084
+ */
56085
+ function identity(value) {
56086
+ return value;
56087
+ }
56088
+
56089
+ var identity_1 = identity;
56090
+
56091
+ /**
56092
+ * A faster alternative to `Function#apply`, this function invokes `func`
56093
+ * with the `this` binding of `thisArg` and the arguments of `args`.
56094
+ *
56095
+ * @private
56096
+ * @param {Function} func The function to invoke.
56097
+ * @param {*} thisArg The `this` binding of `func`.
56098
+ * @param {Array} args The arguments to invoke `func` with.
56099
+ * @returns {*} Returns the result of `func`.
56100
+ */
56101
+ function apply(func, thisArg, args) {
56102
+ switch (args.length) {
56103
+ case 0: return func.call(thisArg);
56104
+ case 1: return func.call(thisArg, args[0]);
56105
+ case 2: return func.call(thisArg, args[0], args[1]);
56106
+ case 3: return func.call(thisArg, args[0], args[1], args[2]);
56107
+ }
56108
+ return func.apply(thisArg, args);
56109
+ }
56110
+
56111
+ var _apply = apply;
56112
+
56113
+ /* Built-in method references for those with the same name as other `lodash` methods. */
56114
+ var nativeMax = Math.max;
56115
+
56116
+ /**
56117
+ * A specialized version of `baseRest` which transforms the rest array.
56118
+ *
56119
+ * @private
56120
+ * @param {Function} func The function to apply a rest parameter to.
56121
+ * @param {number} [start=func.length-1] The start position of the rest parameter.
56122
+ * @param {Function} transform The rest array transform.
56123
+ * @returns {Function} Returns the new function.
56124
+ */
56125
+ function overRest(func, start, transform) {
56126
+ start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
56127
+ return function() {
56128
+ var args = arguments,
56129
+ index = -1,
56130
+ length = nativeMax(args.length - start, 0),
56131
+ array = Array(length);
56132
+
56133
+ while (++index < length) {
56134
+ array[index] = args[start + index];
56135
+ }
56136
+ index = -1;
56137
+ var otherArgs = Array(start + 1);
56138
+ while (++index < start) {
56139
+ otherArgs[index] = args[index];
56140
+ }
56141
+ otherArgs[start] = transform(array);
56142
+ return _apply(func, this, otherArgs);
56143
+ };
56144
+ }
56145
+
56146
+ var _overRest = overRest;
56147
+
56148
+ /**
56149
+ * Creates a function that returns `value`.
56150
+ *
56151
+ * @static
56152
+ * @memberOf _
56153
+ * @since 2.4.0
56154
+ * @category Util
56155
+ * @param {*} value The value to return from the new function.
56156
+ * @returns {Function} Returns the new constant function.
56157
+ * @example
56158
+ *
56159
+ * var objects = _.times(2, _.constant({ 'a': 1 }));
56160
+ *
56161
+ * console.log(objects);
56162
+ * // => [{ 'a': 1 }, { 'a': 1 }]
56163
+ *
56164
+ * console.log(objects[0] === objects[1]);
56165
+ * // => true
56166
+ */
56167
+ function constant(value) {
56168
+ return function() {
56169
+ return value;
56170
+ };
56171
+ }
56172
+
56173
+ var constant_1 = constant;
56174
+
56175
+ /**
56176
+ * The base implementation of `setToString` without support for hot loop shorting.
56177
+ *
56178
+ * @private
56179
+ * @param {Function} func The function to modify.
56180
+ * @param {Function} string The `toString` result.
56181
+ * @returns {Function} Returns `func`.
56182
+ */
56183
+ var baseSetToString = !_defineProperty ? identity_1 : function(func, string) {
56184
+ return _defineProperty(func, 'toString', {
56185
+ 'configurable': true,
56186
+ 'enumerable': false,
56187
+ 'value': constant_1(string),
56188
+ 'writable': true
56189
+ });
56190
+ };
56191
+
56192
+ var _baseSetToString = baseSetToString;
56193
+
56194
+ /** Used to detect hot functions by number of calls within a span of milliseconds. */
56195
+ var HOT_COUNT = 800,
56196
+ HOT_SPAN = 16;
56197
+
56198
+ /* Built-in method references for those with the same name as other `lodash` methods. */
56199
+ var nativeNow = Date.now;
56200
+
56201
+ /**
56202
+ * Creates a function that'll short out and invoke `identity` instead
56203
+ * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
56204
+ * milliseconds.
56205
+ *
56206
+ * @private
56207
+ * @param {Function} func The function to restrict.
56208
+ * @returns {Function} Returns the new shortable function.
56209
+ */
56210
+ function shortOut(func) {
56211
+ var count = 0,
56212
+ lastCalled = 0;
56213
+
56214
+ return function() {
56215
+ var stamp = nativeNow(),
56216
+ remaining = HOT_SPAN - (stamp - lastCalled);
56217
+
56218
+ lastCalled = stamp;
56219
+ if (remaining > 0) {
56220
+ if (++count >= HOT_COUNT) {
56221
+ return arguments[0];
56222
+ }
56223
+ } else {
56224
+ count = 0;
56225
+ }
56226
+ return func.apply(undefined, arguments);
56227
+ };
56228
+ }
56229
+
56230
+ var _shortOut = shortOut;
56231
+
56232
+ /**
56233
+ * Sets the `toString` method of `func` to return `string`.
56234
+ *
56235
+ * @private
56236
+ * @param {Function} func The function to modify.
56237
+ * @param {Function} string The `toString` result.
56238
+ * @returns {Function} Returns `func`.
56239
+ */
56240
+ var setToString = _shortOut(_baseSetToString);
56241
+
56242
+ var _setToString = setToString;
56243
+
56244
+ /**
56245
+ * The base implementation of `_.rest` which doesn't validate or coerce arguments.
56246
+ *
56247
+ * @private
56248
+ * @param {Function} func The function to apply a rest parameter to.
56249
+ * @param {number} [start=func.length-1] The start position of the rest parameter.
56250
+ * @returns {Function} Returns the new function.
56251
+ */
56252
+ function baseRest(func, start) {
56253
+ return _setToString(_overRest(func, start, identity_1), func + '');
56254
+ }
56255
+
56256
+ var _baseRest = baseRest;
56257
+
56258
+ /**
56259
+ * Checks if the given arguments are from an iteratee call.
56260
+ *
56261
+ * @private
56262
+ * @param {*} value The potential iteratee value argument.
56263
+ * @param {*} index The potential iteratee index or key argument.
56264
+ * @param {*} object The potential iteratee object argument.
56265
+ * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
56266
+ * else `false`.
56267
+ */
56268
+ function isIterateeCall(value, index, object) {
56269
+ if (!isObject_1(object)) {
56270
+ return false;
56271
+ }
56272
+ var type = typeof index;
56273
+ if (type == 'number'
56274
+ ? (isArrayLike_1(object) && _isIndex(index, object.length))
56275
+ : (type == 'string' && index in object)
56276
+ ) {
56277
+ return eq_1(object[index], value);
56278
+ }
56279
+ return false;
56280
+ }
56281
+
56282
+ var _isIterateeCall = isIterateeCall;
56283
+
56284
+ /**
56285
+ * Creates a function like `_.assign`.
56286
+ *
56287
+ * @private
56288
+ * @param {Function} assigner The function to assign values.
56289
+ * @returns {Function} Returns the new assigner function.
56290
+ */
56291
+ function createAssigner(assigner) {
56292
+ return _baseRest(function(object, sources) {
56293
+ var index = -1,
56294
+ length = sources.length,
56295
+ customizer = length > 1 ? sources[length - 1] : undefined,
56296
+ guard = length > 2 ? sources[2] : undefined;
56297
+
56298
+ customizer = (assigner.length > 3 && typeof customizer == 'function')
56299
+ ? (length--, customizer)
56300
+ : undefined;
56301
+
56302
+ if (guard && _isIterateeCall(sources[0], sources[1], guard)) {
56303
+ customizer = length < 3 ? undefined : customizer;
56304
+ length = 1;
56305
+ }
56306
+ object = Object(object);
56307
+ while (++index < length) {
56308
+ var source = sources[index];
56309
+ if (source) {
56310
+ assigner(object, source, index, customizer);
56311
+ }
56312
+ }
56313
+ return object;
56314
+ });
56315
+ }
56316
+
56317
+ var _createAssigner = createAssigner;
56318
+
56319
+ /**
56320
+ * This method is like `_.assign` except that it recursively merges own and
56321
+ * inherited enumerable string keyed properties of source objects into the
56322
+ * destination object. Source properties that resolve to `undefined` are
56323
+ * skipped if a destination value exists. Array and plain object properties
56324
+ * are merged recursively. Other objects and value types are overridden by
56325
+ * assignment. Source objects are applied from left to right. Subsequent
56326
+ * sources overwrite property assignments of previous sources.
56327
+ *
56328
+ * **Note:** This method mutates `object`.
56329
+ *
56330
+ * @static
56331
+ * @memberOf _
56332
+ * @since 0.5.0
56333
+ * @category Object
56334
+ * @param {Object} object The destination object.
56335
+ * @param {...Object} [sources] The source objects.
56336
+ * @returns {Object} Returns `object`.
56337
+ * @example
56338
+ *
56339
+ * var object = {
56340
+ * 'a': [{ 'b': 2 }, { 'd': 4 }]
56341
+ * };
56342
+ *
56343
+ * var other = {
56344
+ * 'a': [{ 'c': 3 }, { 'e': 5 }]
56345
+ * };
56346
+ *
56347
+ * _.merge(object, other);
56348
+ * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
56349
+ */
56350
+ var merge = _createAssigner(function(object, source, srcIndex) {
56351
+ _baseMerge(object, source, srcIndex);
56352
+ });
56353
+
56354
+ var merge_1 = merge;
56355
+
56480
56356
  /**
56481
56357
  * A helper class that will parses and splits a culture code into its language and region parts.
56482
56358
  */
@@ -56790,28 +56666,18 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
56790
56666
  */
56791
56667
  Localizer.getStrings = function (locale) {
56792
56668
  var localeData = this.getLocaleData(locale);
56793
- // For default locale no need to make a network request
56794
- // Its value is already defined in LocalizedStrings
56795
- // This will also make sure that request is not made for Bing maps
56796
- if (localeIndex.locales.defaultLanguage.defaultRegion.code === localeData.code) {
56797
- return new Promise(function (resolve) {
56798
- resolve(new LocalizedStrings());
56799
- });
56800
- }
56801
- else {
56802
- // Start a GET request
56803
- var request = new Url({
56804
- domain: env.staticAssetsDomain,
56805
- path: localeIndex.localizationsPath + "/" + localeData.strings
56806
- }).get();
56807
- // Return the response as a LocalizedStrings object.
56808
- return request.then(function (response) {
56809
- return response;
56810
- }, function () {
56811
- // If the request for the localized strings json fails return a default localization in English.
56812
- return new LocalizedStrings();
56813
- });
56814
- }
56669
+ // Start a GET request
56670
+ var request = new Url({
56671
+ domain: env.staticAssetsDomain,
56672
+ path: localeIndex.localizationsPath + "/" + localeData.strings
56673
+ }).get();
56674
+ // Return the response as a LocalizedStrings object.
56675
+ return request.then(function (response) {
56676
+ return response;
56677
+ }, function () {
56678
+ // If the request for the localized strings json fails return a default localization in English.
56679
+ return new LocalizedStrings();
56680
+ });
56815
56681
  };
56816
56682
  /**
56817
56683
  * Gets the best fit locale data based on the specified culture code.
@@ -57037,7 +56903,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
57037
56903
  var defaultStaticAssetsDomain = env.staticAssetsDomain;
57038
56904
  var defaultStyleDefinitionsPath = env.stylePath;
57039
56905
  var defaultStyleDefinitionsVersion = env.styleDefinitionsVersion;
57040
- var defaultStyleAPIVersion = constants.styleApiVersion;
57041
56906
  var defaultAuthOptions = new AuthenticationOptions();
57042
56907
  var hasSetView = false;
57043
56908
  var hasSetDomain = false;
@@ -57083,13 +56948,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
57083
56948
  function getStyleDefinitionsVersion() {
57084
56949
  return defaultStyleDefinitionsVersion;
57085
56950
  }
57086
- /**
57087
- * Gets the default styleAPI version that was provided
57088
- * @internal
57089
- */
57090
- function getStyleAPIVersion() {
57091
- return defaultStyleAPIVersion;
57092
- }
57093
56951
  /**
57094
56952
  * Gets the worker count that will get created.
57095
56953
  */
@@ -57202,9 +57060,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
57202
57060
  defaultStyleDefinitionsVersion = styleDefinitionsVersion;
57203
57061
  hasSetStyleDefinitionsVersion = true;
57204
57062
  }
57205
- function setStyleAPIVersion(styleAPIVersion) {
57206
- defaultStyleAPIVersion = styleAPIVersion;
57207
- }
57208
57063
  /**
57209
57064
  * Sets number of web workers instantiated on a page.
57210
57065
  * By default, it is set to half the number of CPU cores (capped at 6).
@@ -57744,14 +57599,13 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
57744
57599
  this.map = map;
57745
57600
  }
57746
57601
  NearbyGeographySearchService.prototype.request = function (options) {
57747
- var _a;
57748
57602
  var domain = this.map.getServiceOptions().domain;
57749
57603
  var urlOptions = {
57750
57604
  domain: domain,
57751
57605
  path: "search/address/reverse/json",
57752
57606
  queryParams: __assign({ "api-version": "1.0", "language": options.style.language, "limit": 1, "query": normalizeLatitude(options.position[1]) + "," + normalizeLongitude(options.position[0]) }, (options.style.view && { view: options.style.view }))
57753
57607
  };
57754
- return new Url((_a = this.map.authentication) === null || _a === void 0 ? void 0 : _a.signRequest(urlOptions)).get();
57608
+ return new Url(this.map.authentication.signRequest(urlOptions)).get();
57755
57609
  };
57756
57610
  return NearbyGeographySearchService;
57757
57611
  }());
@@ -57912,7 +57766,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
57912
57766
  // Minium distance in pixels a second road must be in order to be considered an intersection.
57913
57767
  this._minIntersectionPixelDistance = 50;
57914
57768
  // The vector tile source id for Azure Maps.
57915
- this._baseVectorTileSourceId = "microsoft.base";
57769
+ this._baseVectorTileSourceId = "vectorTiles";
57916
57770
  /*
57917
57771
  * Show details based on zoom level.
57918
57772
  *
@@ -58331,19 +58185,17 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
58331
58185
  }
58332
58186
  this._lastLang = this._map.getStyle().language.toLowerCase();
58333
58187
  MapViewDescriptor._labelCache._preloadCache(this._lastLang);
58334
- this._map.events.addOnce("idle", function () {
58188
+ this._map.events.addOnce("load", function () {
58335
58189
  if (!_this._disposed) {
58336
58190
  _this._updateCam(true);
58337
58191
  // Add event listeners directly to mapbox because we will be using custom event data.
58338
58192
  // We don't automatically forward all properties of a mapbox event, so the custom data would be lost.
58339
- var baseMap = _this._map._getMap();
58340
- baseMap.on("move", _this._onMove);
58341
- baseMap.on("moveend", _this._onMoveEnd);
58342
- baseMap.on("styledata", _this._onStyleData);
58343
- baseMap.on("rotate", _this._onRotate);
58344
- var canvas = _this._map.getCanvas();
58345
- canvas.addEventListener("mousedown", _this._onPointerDown);
58346
- canvas.addEventListener("touchstart", _this._onPointerDown);
58193
+ _this._map._getMap().on("move", _this._onMove);
58194
+ _this._map._getMap().on("moveend", _this._onMoveEnd);
58195
+ _this._map._getMap().on("styledata", _this._onStyleData);
58196
+ _this._map._getMap().on("rotate", _this._onRotate);
58197
+ _this._map.getCanvas().addEventListener("mousedown", _this._onPointerDown);
58198
+ _this._map.getCanvas().addEventListener("touchstart", _this._onPointerDown);
58347
58199
  }
58348
58200
  });
58349
58201
  this._map.getMapContainer().addEventListener("keydown", this._shortcutListener);
@@ -58353,14 +58205,12 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
58353
58205
  this._disposed = true;
58354
58206
  // Event listeners were added directly to mapbox.
58355
58207
  // Remove them directly from there too.
58356
- var baseMap = this._map._getMap();
58357
- baseMap.off("move", this._onMove);
58358
- baseMap.off("moveend", this._onMoveEnd);
58359
- baseMap.off("styledata", this._onStyleData);
58360
- baseMap.off("rotate", this._onRotate);
58361
- var canvas = this._map.getCanvas();
58362
- canvas.removeEventListener("mousedown", this._onPointerDown);
58363
- canvas.removeEventListener("touchstart", this._onPointerDown);
58208
+ this._map._getMap().off("move", this._onMove);
58209
+ this._map._getMap().off("moveend", this._onMoveEnd);
58210
+ this._map._getMap().off("styledata", this._onStyleData);
58211
+ this._map._getMap().off("rotate", this._onRotate);
58212
+ this._map.getCanvas().removeEventListener("mousedown", this._onPointerDown);
58213
+ this._map.getCanvas().removeEventListener("touchstart", this._onPointerDown);
58364
58214
  this._map.getMapContainer().removeEventListener("keydown", this._shortcutListener);
58365
58215
  };
58366
58216
  MapViewDescriptor.prototype._getEventPos = function (event) {
@@ -59030,16 +58880,14 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
59030
58880
  });
59031
58881
  };
59032
58882
  this.initializeMapLiveStateInfo = function () {
59033
- {
59034
- _this.mapViewDesc = new MapViewDescriptor(_this.map, _this.updateMapState);
59035
- _this.atlasMapLiveStateInfo = document.createElement("div");
59036
- _this.atlasMapLiveStateInfo.setAttribute("tabindex", "-1");
59037
- _this.atlasMapLiveStateInfo.setAttribute("aria-hidden", "true");
59038
- _this.atlasMapLiveStateInfo.id = "atlas-map-state";
59039
- _this.atlasMapLiveStateInfo.classList.add("hidden-accessible-element");
59040
- _this.map.getCanvasContainer().appendChild(_this.atlasMapLiveStateInfo);
59041
- _this.atlasMapLiveStateInfo.setAttribute("aria-live", "assertive");
59042
- }
58883
+ _this.mapViewDesc = new MapViewDescriptor(_this.map, _this.updateMapState);
58884
+ _this.atlasMapLiveStateInfo = document.createElement("div");
58885
+ _this.atlasMapLiveStateInfo.setAttribute("tabindex", "-1");
58886
+ _this.atlasMapLiveStateInfo.setAttribute("aria-hidden", "true");
58887
+ _this.atlasMapLiveStateInfo.id = "atlas-map-state";
58888
+ _this.atlasMapLiveStateInfo.classList.add("hidden-accessible-element");
58889
+ _this.map.getCanvasContainer().appendChild(_this.atlasMapLiveStateInfo);
58890
+ _this.atlasMapLiveStateInfo.setAttribute("aria-live", "assertive");
59043
58891
  };
59044
58892
  this.initializeMapStyleInfo = function () {
59045
58893
  _this.atlasMapStyleInfo = document.createElement("div");
@@ -59548,12 +59396,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
59548
59396
  * @default true
59549
59397
  */
59550
59398
  _this.touchInteraction = true;
59551
- /**
59552
- * Whether touch rotation is enabled for touch devices. This option is not applied if touchInteraction is disabled.
59553
- * default `true`
59554
- * @default true
59555
- */
59556
- _this.touchRotate = true;
59557
59399
  /**
59558
59400
  * Sets the zoom rate of the mouse wheel
59559
59401
  * default `1/450`
@@ -59732,19 +59574,12 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
59732
59574
  this.map._getMap().scrollZoom.disable();
59733
59575
  }
59734
59576
  // Touch
59735
- var touchZoomRotate = this.map._getMap().touchZoomRotate;
59736
59577
  if (options.touchInteraction) {
59737
- touchZoomRotate.enable();
59738
- if (options.touchRotate) {
59739
- touchZoomRotate.enableRotation();
59740
- }
59741
- else {
59742
- touchZoomRotate.disableRotation();
59743
- }
59578
+ this.map._getMap().touchZoomRotate.enable();
59744
59579
  this.pinchZoom.enable();
59745
59580
  }
59746
59581
  else {
59747
- touchZoomRotate.disable();
59582
+ this.map._getMap().touchZoomRotate.disable();
59748
59583
  this.pinchZoom.enable();
59749
59584
  }
59750
59585
  }
@@ -62731,10 +62566,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
62731
62566
  bounds: bbox.join(',')
62732
62567
  });
62733
62568
  var attributionUrl = attributionEndpointOrigin + "/map/attribution";
62734
- var toReplace = { url: attributionUrl, headers: {} };
62569
+ var toReplace = { url: attributionUrl };
62735
62570
  map._substituteDomainLanguageViewAndSignInRequest(attributionUrl, toReplace);
62736
- var targetUrl = "" + toReplace.url + (toReplace.url.includes('?') ? '&' : '?') + params.toString();
62737
- return map._sendRequest(targetUrl, 'Attribution', toReplace.headers).then(function (response) { return response.json(); });
62571
+ var targetUrl = toReplace.url + "&" + params.toString();
62572
+ return map._sendRequest(targetUrl, 'Attribution').then(function (response) { return response.json(); });
62738
62573
  });
62739
62574
  Promise.all(requests).then(function (response) {
62740
62575
  _this.applyAttributionResponse(response);
@@ -62825,32 +62660,20 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
62825
62660
  this.removeAttributionFromSource = function (source) {
62826
62661
  //FundamentalMapSources are handled on style.load
62827
62662
  };
62828
- this.getMapStyleVisibleSources = function () {
62663
+ this.getMapStyleSources = function () {
62829
62664
  var map = _this.map._getMap();
62830
- var style = map.getStyle();
62831
- return Object.entries(style.sources)
62832
- .filter(function (_a) {
62833
- var _b = __read(_a, 1), key = _b[0];
62834
- return style.layers
62835
- .filter(function (layer) { return layer && layer['source'] == key; })
62836
- .reduce(function (isVisible, layer) {
62837
- var isLayerHidden = (layer["layout"] && layer["layout"].visibility === "none") || layer["paint"] && (layer["paint"]["icon-opacity"] === 0 && layer["paint"]["text-opacity"] === 0);
62838
- return !isLayerHidden || isVisible;
62839
- }, false);
62840
- }).map(function (_a) {
62665
+ return Object.entries(map.getStyle().sources).map(function (_a) {
62841
62666
  var _b = __read(_a, 1), key = _b[0];
62842
62667
  return map.getSource(key);
62843
62668
  });
62844
62669
  };
62845
62670
  this.loadAttributionOnceSourcesLoaded = function () {
62846
- var sources = _this.getMapStyleVisibleSources();
62671
+ var sources = _this.getMapStyleSources();
62847
62672
  Promise.all(sources.map(function (source) { return new Promise(function (resolve, reject) {
62848
62673
  if ('tiles' in source) {
62849
62674
  resolve(source);
62850
62675
  }
62851
62676
  else {
62852
- // force source loading as same resolved source in different style will get cached and won't emit events
62853
- source.load();
62854
62677
  source.on('data', function sourceDataListener(event) {
62855
62678
  if (event.sourceDataType == 'metadata') {
62856
62679
  source.off('data', sourceDataListener);
@@ -62872,7 +62695,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
62872
62695
  });
62873
62696
  };
62874
62697
  this.reloadAttribution = function () {
62875
- var sources = _this.getMapStyleVisibleSources();
62698
+ var sources = _this.getMapStyleSources();
62876
62699
  // keep track of all rules as well as registered to determine redundant rules that won't get applied.
62877
62700
  // a rule is considered redundant when it is has same rule attributes(excluding order) as well as endpoints
62878
62701
  // a rule with the minimum order will be picked
@@ -65429,7 +65252,21 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
65429
65252
  request.headers[constants.authorizationHeaderName] = constants.authorizationTokenPrefix + token;
65430
65253
  break;
65431
65254
  case exports.AuthenticationType.subscriptionKey:
65432
- request.headers["subscription-key"] = token;
65255
+ if ("url" in request) {
65256
+ if (request.url.indexOf("?") !== -1) {
65257
+ request.url += "&subscription-key=" + token;
65258
+ }
65259
+ else {
65260
+ request.url += "?&subscription-key=" + token;
65261
+ }
65262
+ }
65263
+ else if ("domain" in request) {
65264
+ request.queryParams = request.queryParams || {};
65265
+ request.queryParams["subscription-key"] = token;
65266
+ }
65267
+ else {
65268
+ throw new Error("Could not determine if the provided object was UrlOptions or RequestParameters");
65269
+ }
65433
65270
  break;
65434
65271
  default:
65435
65272
  throw new Error("An invalid authentication type was specified");
@@ -65987,7 +65824,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
65987
65824
  setTimeout(function () { return modifiedCallback(readyData_1); });
65988
65825
  }
65989
65826
  }
65990
- else if (["minzoomchanged", "maxzoomchanged", "stylesetchanged"].includes(eventType)) {
65827
+ else if (["minzoomchanged", "maxzoomchanged"].includes(eventType)) {
65991
65828
  this.map._addEventListener(eventType, callback, once);
65992
65829
  }
65993
65830
  else {
@@ -66312,9 +66149,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
66312
66149
  * @param id The image's id.
66313
66150
  * If the specified id matches the id of a previously added image the new image will be ignored.
66314
66151
  * @param icon The image to add to the map's sprite. Can be a data URI, inline SVG, or image URL.
66315
- * @param meta Additional options that describe the image
66316
66152
  */
66317
- ImageSpriteManager.prototype.add = function (id, icon, meta) {
66153
+ ImageSpriteManager.prototype.add = function (id, icon) {
66318
66154
  var _this = this;
66319
66155
  return new Promise(function (resolve, reject) {
66320
66156
  // Take no action if the new image uses the id of a previously added image.
@@ -66323,8 +66159,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
66323
66159
  return;
66324
66160
  }
66325
66161
  if (icon instanceof HTMLImageElement || icon instanceof ImageData) {
66326
- _this.map._getMap().addImage(id, icon, meta);
66327
- _this.userImages.set(id, { image: icon, meta: meta });
66162
+ _this.map._getMap().addImage(id, icon);
66163
+ _this.userImages.set(id, icon);
66328
66164
  resolve();
66329
66165
  }
66330
66166
  else if (typeof icon === "string") {
@@ -66348,8 +66184,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
66348
66184
  var imageEle_1 = new Image();
66349
66185
  // Wait for the blob to load into the element.
66350
66186
  imageEle_1.onload = function () {
66351
- _this.map._getMap().addImage(id, imageEle_1, meta);
66352
- _this.userImages.set(id, { image: imageEle_1, meta: meta });
66187
+ _this.map._getMap().addImage(id, imageEle_1);
66188
+ _this.userImages.set(id, imageEle_1);
66353
66189
  resolve();
66354
66190
  };
66355
66191
  // Reject if the blob failed to load in the element.
@@ -66441,7 +66277,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
66441
66277
  // Therefore changing a sprite will cause a full style rebuild.
66442
66278
  this.userImages.forEach(function (image, id) {
66443
66279
  if (!_this.map._getMap().hasImage(id)) {
66444
- _this.map._getMap().addImage(id, image.image, image.meta);
66280
+ _this.map._getMap().addImage(id, image);
66445
66281
  }
66446
66282
  });
66447
66283
  };
@@ -67438,9 +67274,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
67438
67274
  var feature = features_1_1.value;
67439
67275
  if ((dataSource || typeof feature["source"] === "string") &&
67440
67276
  typeof feature.properties[Shape._shapeIdPropName] === "string") {
67441
- var source = dataSource || this.sources.get(feature["source"]);
67442
- if (source instanceof DataSource) {
67443
- var shape = source.getShapeById(feature.properties[Shape._shapeIdPropName]);
67277
+ var source_3 = dataSource || this.sources.get(feature["source"]);
67278
+ if (source_3 instanceof DataSource) {
67279
+ var shape = source_3.getShapeById(feature.properties[Shape._shapeIdPropName]);
67444
67280
  if (shape instanceof Shape) {
67445
67281
  shapesOrFeatures.push(shape);
67446
67282
  continue;
@@ -68045,11 +67881,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68045
67881
  _this.showTileBoundaries = false;
68046
67882
  /**
68047
67883
  * The name of the style to use when rendering the map. Available styles can be found in the
68048
- * [supported styles]{@link https://docs.microsoft.com/en-us/azure/azure-maps/supported-map-styles} article.
68049
- * The default style is defined in the style set.
68050
- * @default undefined
67884
+ * [supported styles]{@link https://docs.microsoft.com/en-us/azure/azure-maps/supported-map-styles} article. The
67885
+ * default style is "road".
68051
67886
  */
68052
- _this.style = undefined;
67887
+ _this.style = "road";
68053
67888
  /**
68054
67889
  * 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.
68055
67890
  * Please see the supported [Views]{@link https://aka.ms/AzureMapsLocalizationViews}
@@ -68160,20 +67995,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68160
67995
  _this.styleDefinitionsPath = getStyleDefinitionsPath();
68161
67996
  /**
68162
67997
  * The style definitions version to request when requesting styles
68163
- * from styleDefinitionsPath.
67998
+ * from styleDefinitionsPath. Recommend using atlas.getStyleDefinitionsVersion
67999
+ * function instead.
68164
68000
  */
68165
68001
  _this.styleDefinitionsVersion = getStyleDefinitionsVersion();
68166
- /**
68167
- * The style API version used when requesting styles and stylesets
68168
- */
68169
- _this.styleAPIVersion = getStyleAPIVersion();
68170
- /**
68171
- * The style set of the map. Determines which styles are available to be picked
68172
- * and what do they consist of (style names, thumbnails, URLs, etc). If passed
68173
- * as a string then the request will be made to resolve it. Use Style Set API
68174
- * for modifications of the style set for all your apps in the field.
68175
- */
68176
- _this.styleSet = undefined;
68177
68002
  /**
68178
68003
  * Enable accessibility
68179
68004
  * default: true
@@ -68395,11 +68220,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68395
68220
  * @internal
68396
68221
  */
68397
68222
  LayerGroupComparator.getLayerGroup = function (layer) {
68398
- var _a;
68399
- if ((layer === null || layer === void 0 ? void 0 : layer.metadata) && layer.metadata['microsoft.maps:layerGroup']) {
68400
- return layer.metadata['microsoft.maps:layerGroup'];
68401
- }
68402
- var layerId = (_a = layer === null || layer === void 0 ? void 0 : layer.id) !== null && _a !== void 0 ? _a : layer;
68223
+ var _a, _b;
68224
+ var layerId = (_b = (_a = layer) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : layer;
68403
68225
  if (!layerId.startsWith("microsoft.")) {
68404
68226
  return undefined;
68405
68227
  }
@@ -68412,131 +68234,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68412
68234
  return LayerGroupComparator;
68413
68235
  }());
68414
68236
 
68415
- var HijackablePromise = /** @class */ (function () {
68416
- function HijackablePromise(origin) {
68417
- var _this = this;
68418
- this.isResolved = function () { return _this._hijackedToResolve !== undefined || _this._toResolve !== undefined; };
68419
- this.isRejected = function () { return _this._hijackedToReject !== undefined || _this._toReject !== undefined; };
68420
- this.resultIfResolved = function () { return _this._hijackedToResolve || _this._toResolve; };
68421
- this.errorIfRejected = function () { return _this._hijackedToReject || _this._toReject; };
68422
- this._thenResolver = function (resolve, reject) {
68423
- if (_this._hijackedToResolve) {
68424
- resolve(_this._hijackedToResolve);
68425
- }
68426
- else if (_this._hijackedToReject) {
68427
- reject(_this._hijackedToReject);
68428
- }
68429
- else {
68430
- // we retain the origin, and check if stays the same as resolved
68431
- // to make sure we do nothing if the promise was switched
68432
- var retainedInvocator_1 = _this.origin;
68433
- _this.origin.then(function (result) {
68434
- // origin was switched
68435
- if (retainedInvocator_1 !== _this.origin) {
68436
- return;
68437
- }
68438
- if (!_this._hijackedToResolve) {
68439
- _this._toResolve = result;
68440
- resolve(result);
68441
- }
68442
- }).catch(function (error) {
68443
- if (!_this._hijackedToReject) {
68444
- _this._toReject = error;
68445
- reject(error);
68446
- }
68447
- });
68448
- }
68449
- };
68450
- this._catchResolver = function (reject) {
68451
- if (_this._hijackedToReject) {
68452
- reject(_this._hijackedToReject);
68453
- }
68454
- else {
68455
- // we retain the origin, and check if stays the same as resolved
68456
- // to make sure we do nothing if the promise was switched
68457
- var retainedInvocator_2 = _this.origin;
68458
- _this.origin.catch(function (error) {
68459
- // origin was switched
68460
- if (retainedInvocator_2 !== _this.origin) {
68461
- return;
68462
- }
68463
- if (!_this._hijackedToReject) {
68464
- _this._toReject = error;
68465
- reject(error);
68466
- }
68467
- });
68468
- }
68469
- };
68470
- this.origin = origin;
68471
- this[Symbol.toStringTag] = this.origin[Symbol.toStringTag];
68472
- }
68473
- HijackablePromise.resolve = function (value) {
68474
- return new HijackablePromise(Promise.resolve(value));
68475
- };
68476
- HijackablePromise.reject = function (error) {
68477
- return new HijackablePromise(Promise.reject(error));
68478
- };
68479
- HijackablePromise.prototype.then = function (onfulfilled, onrejected) {
68480
- var _this = this;
68481
- return new Promise(function (resolve, reject) {
68482
- _this._resolve = resolve;
68483
- _this._reject = reject;
68484
- _this._thenResolver(resolve, reject);
68485
- }).then(onfulfilled, onrejected);
68486
- };
68487
- // tslint:disable-next-line: no-reserved-keywords
68488
- HijackablePromise.prototype.catch = function (onrejected) {
68489
- var _this = this;
68490
- return new Promise(function (_, reject) {
68491
- _this._reject = reject;
68492
- _this._catchResolver(reject);
68493
- }).then(onrejected);
68494
- };
68495
- // tslint:disable-next-line: no-reserved-keywords
68496
- HijackablePromise.prototype.finally = function (onfinally) {
68497
- return this.origin.finally(onfinally);
68498
- };
68499
- HijackablePromise.prototype.hijackAndResolve = function (value) {
68500
- this._hijackedToResolve = value;
68501
- if (this._resolve) {
68502
- this._resolve(value);
68503
- }
68504
- };
68505
- HijackablePromise.prototype.hijackAndReject = function (error) {
68506
- this._hijackedToReject = error;
68507
- if (this._reject) {
68508
- this._reject(error);
68509
- }
68510
- };
68511
- HijackablePromise.prototype.switchWith = function (promise) {
68512
- // switching the origin will discard the original in-progress promise result
68513
- this.origin = promise;
68514
- // then has been invoked on this promise
68515
- if (this._resolve && this._reject) {
68516
- this._thenResolver(this._resolve, this._reject);
68517
- // catch has been invoked on this promise
68518
- }
68519
- else if (this._reject) {
68520
- this._catchResolver(this._reject);
68521
- }
68522
- };
68523
- return HijackablePromise;
68524
- }());
68525
-
68526
- var styleNamesMap = {
68527
- road: "Road",
68528
- satellite: "Satellite",
68529
- satellite_road_labels: "Hybrid",
68530
- grayscale_dark: "Grayscale (Dark)",
68531
- grayscale_light: "Grayscale (Light)",
68532
- night: "Night",
68533
- road_shaded_relief: "Terra",
68534
- blank: "Blank",
68535
- blank_accessible: "Blank (Accessible)",
68536
- high_contrast_dark: "High contrast (Dark)",
68537
- high_contrast_light: "High contrast (Light)"
68538
- };
68539
-
68540
68237
  /**
68541
68238
  * @private
68542
68239
  */
@@ -68549,183 +68246,55 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68549
68246
  */
68550
68247
  function StyleManager(map, serviceOptions) {
68551
68248
  var _this = this;
68552
- this.definitions = function () { return _this.initPromise ? _this.initPromise : _this.initStyleset(); };
68553
- /**
68554
- * Compatability indoor state used in styleDefinition filtering.
68555
- */
68556
- this.indoorState = undefined;
68557
- /**
68558
- * Preserve the styleset that was used before the indoor styleset was set
68559
- */
68560
- this.preservedPreindoorStyleset = undefined;
68249
+ this.apiVersion = "2.0";
68561
68250
  this._onStyleData = function () {
68562
- _this._lookUpAsync(_this.map.getStyle()).then(function (style) {
68563
- _this.map.events.invoke("stylechanged", {
68564
- style: style.name,
68565
- map: _this.map,
68566
- type: "stylechanged"
68567
- });
68251
+ _this.map.events.invoke("stylechanged", {
68252
+ style: _this._lookUp(_this.map.getStyle()).name,
68253
+ map: _this.map,
68254
+ type: "stylechanged"
68568
68255
  });
68569
68256
  };
68570
- /**
68571
- * Looks up the style type info from the style definitions: this is async unsafe
68572
- */
68573
- this._lookUp = function (options) {
68574
- var definitionsFetchError = _this.definitions().errorIfRejected();
68575
- var definitions = _this.definitions().resultIfResolved();
68576
- if (definitionsFetchError) {
68577
- return null;
68578
- }
68579
- else if (definitions === undefined) {
68580
- return null;
68581
- }
68582
- else {
68583
- return definitions.styles.find(function (style) { return style.name === (options.style || definitions.defaultStyle); })
68584
- // retrieve default style definition unless option.style's one was found
68585
- || definitions.styles.find(function (style) { return style.name === definitions.defaultStyle; })
68586
- // no default style in the styleSet -> pick the first style
68587
- || definitions.styles[0];
68588
- }
68589
- };
68590
- this._lookUpAsync = function (options) { return __awaiter(_this, void 0, void 0, function () {
68591
- var definitions, result;
68592
- return __generator(this, function (_a) {
68593
- switch (_a.label) {
68594
- case 0: return [4 /*yield*/, this.definitions()];
68595
- case 1:
68596
- definitions = _a.sent();
68597
- result = definitions.styles.find(function (style) { return style.name === (options.style || definitions.defaultStyle); })
68598
- // retrieve default style definition unless option.style's one was found
68599
- || definitions.styles.find(function (style) { return style.name === definitions.defaultStyle; })
68600
- // no default style in the styleSet -> pick the first style
68601
- || definitions.styles[0];
68602
- return [2 /*return*/, result];
68603
- }
68604
- });
68605
- }); };
68606
68257
  this.map = map;
68607
68258
  this.serviceOptions = serviceOptions;
68608
68259
  }
68609
- StyleManager.prototype.updateIndoorState = function (theme, tilesetId) {
68610
- var _this = this;
68611
- var styleset = this.map.styles.getStyleSet();
68612
- if (styleset) {
68613
- this.preservedPreindoorStyleset = styleset;
68614
- // tilesetId fallback
68615
- // MAGIC: if we are on a default style set - match existing style to the one in the default indoor style set
68616
- var desiredIndoorStyle = this.map.getStyle().style + "_indoor" + (theme === 'dark' ? '_dark' : '') + "_tileset_" + tilesetId;
68617
- this.map.styles.setStyleSet("defaultIndoor_" + tilesetId, styleset === 'microsoft-maps:default' ? desiredIndoorStyle : undefined);
68618
- }
68619
- else {
68620
- this.indoorState = {
68621
- tilesetId: tilesetId,
68622
- theme: theme
68623
- };
68624
- this.initStyleset();
68625
- this.definitions().then(function (definitions) {
68626
- var currentStyle = _this.map.getStyle().style;
68627
- var targetStyleName = currentStyle + "_indoor" + (_this.indoorState.theme == 'dark' ? '_dark' : '');
68628
- _this.map.setStyle({ style: targetStyleName });
68629
- });
68630
- }
68631
- };
68632
- StyleManager.prototype.unsetIndoorState = function () {
68633
- var _this = this;
68634
- var styleset = this.preservedPreindoorStyleset;
68635
- if (styleset) {
68636
- // we need to revert to the styleset that was ap
68637
- this.map.styles.setStyleSet(styleset);
68638
- }
68639
- else {
68640
- this.indoorState = undefined;
68641
- this.initStyleset();
68642
- this.definitions().then(function (definitions) {
68643
- var currentStyle = _this.map.getStyle().style;
68644
- if (currentStyle.includes('_indoor') && currentStyle.split('_indoor')[0]) {
68645
- _this.map.setStyle({ style: currentStyle.split('_indoor')[0] });
68646
- }
68647
- else {
68648
- _this.map.setStyle({ style: undefined });
68649
- }
68650
- });
68651
- }
68652
- };
68653
68260
  /**
68654
- * If this method has been called before then the original promise is returned.
68655
- * Promise is resolved once the style set is successfully fetched and stored.
68261
+ * If this method has been called before the original initialize promise is returned.
68656
68262
  */
68657
- StyleManager.prototype.initStyleset = function () {
68263
+ StyleManager.prototype.initialize = function () {
68658
68264
  var _this = this;
68659
- var newPromise;
68660
- var mapStyleNameToFriendyWhenAvailable = function (styleName) {
68661
- var baseName = _this.indoorState && styleName.includes('_indoor') ? styleName.split('_indoor')[0] : styleName;
68662
- return baseName in styleNamesMap ? styleNamesMap[baseName] : baseName;
68663
- };
68664
- if (!this.serviceOptions.styleSet) {
68665
- newPromise = new HijackablePromise(this._request(this.serviceOptions.staticAssetsDomain, constants.stylePath + "/" + constants.styleResourcePath, "StyleDefinitions").then(function (definitions) { return ({
68666
- version: isNaN(definitions.version) ? 0 : parseFloat(definitions.version),
68667
- defaultStyle: definitions.defaultStyle,
68668
- styles: definitions.styles
68669
- .filter(function (style) { return _this.indoorState ? style.name.includes('indoor') && style.name.endsWith(_this.indoorState.theme == 'dark' ? 'dark' : 'indoor') : !style.name.includes('indoor'); })
68670
- .map(function (style) { return ({
68671
- copyright: style.copyright.join(' '),
68672
- name: style.name,
68673
- displayName: mapStyleNameToFriendyWhenAvailable(style.name),
68674
- theme: style.theme,
68675
- thumbnail: new Url({ domain: _this.serviceOptions.staticAssetsDomain, path: style.thumbnail, protocol: "https" }).toString(),
68676
- url: new Url({
68677
- domain: _this.serviceOptions.staticAssetsDomain,
68678
- path: constants.stylePath + "/" + constants.styleResourcePath + "/" + style.name,
68679
- queryParams: {
68680
- //[constants.apiVersionQueryParameter]: this.serviceOptions.styleDefinitionsVersion,
68681
- // thus far we don't need to differentiate based on parameter here, as stylePatch will be called on cached styles as well
68682
- //language: styleOptions.language
68683
- },
68684
- protocol: "https"
68685
- }).toString(),
68686
- }); })
68687
- }); }));
68688
- }
68689
- else if (typeof this.serviceOptions.styleSet === 'string') {
68690
- newPromise = new HijackablePromise(this._request(this.serviceOptions.domain, constants.styleResourcePath + "/mapconfigurations/metadata/" + this.serviceOptions.styleSet, "StyleDefinitions"));
68691
- }
68692
- else {
68693
- newPromise = HijackablePromise.resolve(this.serviceOptions.styleSet);
68694
- }
68695
- if (this.initPromise) {
68696
- this.initPromise.switchWith(newPromise);
68697
- this.initPromise = newPromise;
68698
- }
68699
- else {
68700
- this.initPromise = newPromise;
68265
+ if (!this.initPromise) {
68266
+ this.initPromise = this._request(this.serviceOptions.staticAssetsDomain, constants.stylePath + "/" + constants.styleResourcePath, "StyleDefinitions")
68267
+ .then(function (response) {
68268
+ _this.definitions = response;
68269
+ }).catch(function (reason) {
68270
+ throw new Error("Failed to retrieve the style definitions: " + reason);
68271
+ });
68701
68272
  }
68702
- // propagate styleset change
68703
- this.initPromise.then(function (styleset) { return _this.map._invokeEvent("stylesetchanged", styleset); });
68273
+ this.styleSet = "base";
68704
68274
  return this.initPromise;
68705
68275
  };
68706
68276
  /**
68707
- * Gets URL or object of the style listed in style definition. Style definition's default style is used if
68708
- * styleOptions.style is not provided or if styleOptions.style is not present in the style definition.
68277
+ * Gets the URL of a style listed in style definition. Style definition's default style is used if
68278
+ * styleName is not provided or if styleName is not present in the style definition.
68709
68279
  */
68710
- StyleManager.prototype.getStyle = function (styleOptions) {
68280
+ StyleManager.prototype.getStyleUrl = function (styleOptions) {
68281
+ var _a;
68711
68282
  var styleDefinition = this._lookUp(styleOptions);
68712
- if (!styleDefinition) {
68713
- throw Error("Style definition is not available.");
68714
- }
68715
- if (styleDefinition.url) {
68716
- return styleDefinition.url;
68717
- }
68718
- if (styleDefinition.style) {
68719
- return styleDefinition.style;
68720
- }
68721
- throw Error("Style definition does not contain neither URL nor style object.");
68283
+ var url = new Url({
68284
+ domain: this.serviceOptions.staticAssetsDomain,
68285
+ path: constants.stylePath + "/" + constants.styleResourcePath + "/" + styleDefinition.name,
68286
+ queryParams: (_a = {},
68287
+ _a[constants.apiVersionQueryParameter] = this.apiVersion,
68288
+ _a["version"] = this.definitions.version,
68289
+ _a),
68290
+ protocol: "https"
68291
+ });
68292
+ return url.toString();
68722
68293
  };
68723
- /**
68724
- * @internal
68725
- */
68726
- StyleManager.prototype.setStyle = function (styleOptions) {
68294
+ StyleManager.prototype.setStyleUrl = function (styleOptions) {
68295
+ var styleUrl = this.getStyleUrl(styleOptions);
68727
68296
  try {
68728
- this.map._getMap().setStyle(this.getStyle(styleOptions), {
68297
+ this.map._getMap().setStyle(styleUrl, {
68729
68298
  diff: true,
68730
68299
  stylePatch: this._stylePatch.bind(this),
68731
68300
  validate: this.serviceOptions.validateStyle
@@ -68740,48 +68309,46 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68740
68309
  */
68741
68310
  StyleManager.prototype.getTheme = function (styleOptions) {
68742
68311
  var style = this._lookUp(styleOptions);
68743
- if (!style) {
68744
- throw Error("Theme is not available.");
68312
+ return style.theme.toLowerCase() || "light";
68313
+ };
68314
+ /**
68315
+ * Bug: 9984684 - Remove this method.
68316
+ * Switch to a different set of styles.
68317
+ * @param styleSet Name of style set to select.
68318
+ */
68319
+ StyleManager.prototype.setStyleSet = function (styleSet) {
68320
+ if (styleSet !== this.styleSet) {
68321
+ this.styleSet = styleSet;
68322
+ this.setStyleUrl(this.map.getStyle());
68745
68323
  }
68746
- return style.theme.toLowerCase();
68747
68324
  };
68748
- StyleManager.prototype.getThemeAsync = function (styleOptions) {
68749
- return __awaiter(this, void 0, void 0, function () {
68750
- return __generator(this, function (_a) {
68751
- switch (_a.label) {
68752
- case 0: return [4 /*yield*/, this._lookUpAsync(styleOptions)];
68753
- case 1: return [2 /*return*/, (_a.sent()).theme];
68754
- }
68755
- });
68756
- });
68325
+ /**
68326
+ * Bug: 9984684 - Remove this method.
68327
+ * Get the current style set.
68328
+ * @param name Name of module to add.
68329
+ */
68330
+ StyleManager.prototype.getStyleSet = function () {
68331
+ return this.styleSet;
68757
68332
  };
68758
68333
  /**
68759
- * Replaces the style set used. Very costly as it reloads all controls and resources.
68334
+ *
68335
+ * @param name Bug 9984684 - Remove this method.
68336
+ * "Reset to base Style Set"
68760
68337
  */
68761
- StyleManager.prototype.setStyleSet = function (styleSet, styleName) {
68762
- var _this = this;
68763
- this.serviceOptions.styleSet = styleSet;
68764
- if (typeof styleSet === 'string') {
68765
- this.initStyleset();
68766
- }
68767
- else {
68768
- if (this.initPromise) {
68769
- this.initPromise.hijackAndResolve(styleSet);
68770
- }
68771
- else {
68772
- this.initPromise = HijackablePromise.resolve(styleSet);
68773
- }
68338
+ StyleManager.prototype.clearStyleSet = function () {
68339
+ if ("base" !== this.styleSet) {
68340
+ this.styleSet = "base";
68341
+ this.setStyleUrl(this.map.getStyle());
68774
68342
  }
68775
- this.definitions().then(function (definitions) {
68776
- var targetStyleName = definitions.defaultStyle;
68777
- if (definitions.styles.find(function (s) { return s.name === styleName; })) {
68778
- targetStyleName = styleName;
68779
- }
68780
- _this.map.setStyle({ style: targetStyleName });
68781
- });
68782
68343
  };
68783
- StyleManager.prototype.getStyleSet = function () {
68784
- return this.serviceOptions.styleSet;
68344
+ /**
68345
+ * Gets the full style definition object.
68346
+ */
68347
+ StyleManager.prototype.getDef = function () {
68348
+ // return this.definitions; // TODO: Restore this line. Bug: 9984684
68349
+ var result = Object.assign({}, this.definitions);
68350
+ result.styles = result.styles.filter(function (style) { return (!style.name.endsWith("_indoor") && !style.name.endsWith("_indoor_dark")); });
68351
+ return result;
68785
68352
  };
68786
68353
  /**
68787
68354
  * Function invoked by mapbox after a style is fetched but before it is committed to the map state.
@@ -68823,7 +68390,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68823
68390
  };
68824
68391
  nextStyle.layers.forEach(function (nextLayer) {
68825
68392
  var _a, _b, _c;
68826
- var layerGroup = LayerGroupComparator.getLayerGroup(nextLayer);
68393
+ var layerGroup = LayerGroupComparator.getLayerGroup(nextLayer.id);
68827
68394
  currentLayerGroupId = currentLayerGroupId ? currentLayerGroupId : layerGroup;
68828
68395
  // Set visiblity of fill-extrusion layers according to StyleOptions.showBuildingModels
68829
68396
  if (!styleOptions.showBuildingModels && nextLayer.type === "fill-extrusion") {
@@ -68918,6 +68485,40 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68918
68485
  }
68919
68486
  throw new Error("Unable to construct fundamental map layer for ID: " + id + ".");
68920
68487
  };
68488
+ /**
68489
+ * Looks up the style type info from the style definition
68490
+ */
68491
+ StyleManager.prototype._lookUp = function (options) {
68492
+ var e_1, _a;
68493
+ // TODO: Remove indoor logic here. Bug: 9984684
68494
+ var styleName = (options.style || this.definitions.defaultStyle)
68495
+ .concat(this.styleSet === "indoor" ? "_indoor" : "")
68496
+ .concat(this.styleSet === "indoor_dark" ? "_indoor_dark" : "");
68497
+ var defaultStyleName = this.definitions.defaultStyle
68498
+ .concat(this.styleSet === "indoor" ? "_indoor" : "")
68499
+ .concat(this.styleSet === "indoor_dark" ? "_indoor_dark" : "");
68500
+ var fallbackStyle;
68501
+ try {
68502
+ for (var _b = __values((this.definitions || {}).styles), _c = _b.next(); !_c.done; _c = _b.next()) {
68503
+ var style = _c.value;
68504
+ if (style.name === styleName) {
68505
+ return style; // Safe when the definition missing requested styleName.
68506
+ // Makes silent decision to use first instance of a style if there are more than one with the same name.
68507
+ }
68508
+ else if (style.name === defaultStyleName) {
68509
+ fallbackStyle = style; // Assumes that the definition contains the default style.
68510
+ }
68511
+ }
68512
+ }
68513
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
68514
+ finally {
68515
+ try {
68516
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
68517
+ }
68518
+ finally { if (e_1) throw e_1.error; }
68519
+ }
68520
+ return fallbackStyle;
68521
+ };
68921
68522
  /**
68922
68523
  * Replace URL placeholders and add StyleManager API version to requests made for style resources.
68923
68524
  * @param params RequestParameters to modify.
@@ -68925,9 +68526,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68925
68526
  * @internal
68926
68527
  */
68927
68528
  StyleManager.prototype._transformStyleRequest = function (url, params) {
68928
- var _a;
68929
68529
  if (url.includes(constants.domainPlaceHolder)) {
68930
- params.url = params.url.replace(constants.domainPlaceHolder, this.serviceOptions.domain);
68530
+ params.url = params.url.replace(constants.domainPlaceHolder, this.serviceOptions.staticAssetsDomain);
68931
68531
  }
68932
68532
  if (url.includes(constants.stylePathHolder)) {
68933
68533
  params.url = params.url.replace(constants.stylePathHolder, constants.stylePath);
@@ -68935,43 +68535,44 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68935
68535
  if (url.includes(constants.styleResourcePlaceholder)) {
68936
68536
  params.url = params.url.replace(constants.styleResourcePlaceholder, constants.styleResourcePath);
68937
68537
  }
68938
- params.url = params.url + ("" + (url.includes('?') ? '&' : '?') + constants.apiVersionQueryParameter + "=" + this.serviceOptions.styleAPIVersion);
68939
- (_a = this.map.authentication) === null || _a === void 0 ? void 0 : _a.signRequest(params);
68538
+ params.url = params.url + ("" + (url.includes('?') ? '&' : '?') + constants.apiVersionQueryParameter + "=" + this.apiVersion);
68940
68539
  };
68941
68540
  /**
68942
68541
  * Fetches a json resource at the specified domain and path.
68943
68542
  */
68944
- StyleManager.prototype._request = function (domain, path, resourceType, customQueryParams) {
68945
- var _a;
68946
- if (customQueryParams === void 0) { customQueryParams = {}; }
68543
+ StyleManager.prototype._request = function (domain, path, resourceType) {
68947
68544
  return __awaiter(this, void 0, void 0, function () {
68948
- var requestParams, fetchOptions;
68949
- var _b;
68950
- return __generator(this, function (_c) {
68951
- switch (_c.label) {
68545
+ var requestParams, url, fetchOptions, request;
68546
+ var _a;
68547
+ return __generator(this, function (_b) {
68548
+ switch (_b.label) {
68952
68549
  case 0:
68953
- requestParams = {
68954
- url: new Url({
68955
- protocol: "https",
68956
- domain: domain,
68957
- path: path,
68958
- queryParams: __assign((_b = {}, _b[constants.apiVersionQueryParameter] = this.serviceOptions.styleAPIVersion, _b), customQueryParams)
68959
- }).toString()
68960
- };
68550
+ url = new Url({
68551
+ protocol: "https",
68552
+ domain: domain,
68553
+ path: path,
68554
+ queryParams: (_a = {},
68555
+ _a[constants.apiVersionQueryParameter] = this.apiVersion,
68556
+ _a["version"] = this.serviceOptions.styleDefinitionsVersion,
68557
+ _a)
68558
+ }).toString();
68961
68559
  if (typeof this.serviceOptions.transformRequest === "function" && resourceType) {
68962
68560
  // If a transformRequest(...) was specified use it.
68963
- requestParams = this.serviceOptions.transformRequest(requestParams.url, resourceType);
68561
+ requestParams = this.serviceOptions.transformRequest(url, resourceType);
68964
68562
  }
68965
- (_a = this.map.authentication) === null || _a === void 0 ? void 0 : _a.signRequest(requestParams);
68966
68563
  fetchOptions = {
68967
68564
  method: "GET",
68968
68565
  mode: "cors",
68969
68566
  };
68970
- requestParams.credentials &&
68971
- (fetchOptions.credentials = requestParams.credentials);
68972
- requestParams.headers &&
68973
- (fetchOptions.headers = requestParams.headers);
68974
- return [4 /*yield*/, fetch(requestParams.url, fetchOptions).then(function (response) {
68567
+ if (requestParams) {
68568
+ requestParams.credentials &&
68569
+ (fetchOptions.credentials = requestParams.credentials);
68570
+ requestParams.headers &&
68571
+ (fetchOptions.headers = requestParams.headers);
68572
+ url = requestParams.url || url;
68573
+ }
68574
+ request = new Request(url, fetchOptions);
68575
+ return [4 /*yield*/, fetch(request).then(function (response) {
68975
68576
  if (response.ok) {
68976
68577
  return response.json();
68977
68578
  }
@@ -68979,7 +68580,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68979
68580
  throw new Error("HTTP " + response.status + ": " + response.statusText + " ");
68980
68581
  }
68981
68582
  })];
68982
- case 1: return [2 /*return*/, _c.sent()];
68583
+ case 1: return [2 /*return*/, _b.sent()];
68983
68584
  }
68984
68585
  });
68985
68586
  });
@@ -69004,6 +68605,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
69004
68605
  */
69005
68606
  function Map(container, options) {
69006
68607
  var _this = _super.call(this) || this;
68608
+ _this.styleSourceIds = new Set();
69007
68609
  // Map state trackers
69008
68610
  _this.removed = false;
69009
68611
  _this.loaded = false;
@@ -69065,7 +68667,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
69065
68667
  }
69066
68668
  _this._substituteDomainLanguageViewAndSignInRequest(url, requestParams);
69067
68669
  }
69068
- else if (resourceType === "Style" || resourceType === "SpriteJSON" || resourceType === "SpriteImage" || resourceType === "Glyphs") {
68670
+ else if (resourceType === "SpriteJSON" || resourceType === "SpriteImage" || resourceType === "Glyphs") {
69069
68671
  _this.styles._transformStyleRequest(url, requestParams);
69070
68672
  }
69071
68673
  // Apply the users specified transform after ours
@@ -69130,9 +68732,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
69130
68732
  _this._setAutoResize(_this.styleOptions.autoResize);
69131
68733
  _this.map.showTileBoundaries = _this.styleOptions.showTileBoundaries;
69132
68734
  _this.localizedStringsPromise = Localizer.getStrings(_this.styleOptions.language);
69133
- var stylesInit = _this.styles.initStyleset();
69134
- Promise.all([authManInit, stylesInit]).then(function (_a) {
69135
- var _b = __read(_a, 2), _ = _b[0], definitions = _b[1];
68735
+ var stylesInit = _this.styles.initialize();
68736
+ Promise.all([authManInit, stylesInit]).then(function () {
69136
68737
  // Check that the map hasn't been removed for any reason.
69137
68738
  // If so no need to finish styling the map.
69138
68739
  if (_this.removed) {
@@ -70045,7 +69646,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
70045
69646
  Map.prototype._rebuildStyle = function () {
70046
69647
  return __awaiter(this, void 0, void 0, function () {
70047
69648
  return __generator(this, function (_a) {
70048
- this.styles.setStyle(this.styleOptions);
69649
+ this.styles.setStyleUrl(this.styleOptions);
70049
69650
  this.imageSprite._restoreImages();
70050
69651
  return [2 /*return*/];
70051
69652
  });
@@ -70108,7 +69709,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
70108
69709
  * @internal
70109
69710
  */
70110
69711
  Map.prototype._substituteDomainLanguageViewAndSignInRequest = function (url, requestParams) {
70111
- var _a;
70112
69712
  if (url.includes(constants.legacyDomainPlaceHolder) || url.includes(constants.domainPlaceHolder)) {
70113
69713
  // Update legacy domain placeholder if found
70114
69714
  var isLegacy = new RegExp("[^{]" + constants.legacyDomainPlaceHolder + "[^}]");
@@ -70126,7 +69726,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
70126
69726
  requestParams.url = requestParams.url.replace(constants.domainPlaceHolder, this.serviceOptions.domain);
70127
69727
  }
70128
69728
  }
70129
- (_a = this.authentication) === null || _a === void 0 ? void 0 : _a.signRequest(requestParams);
69729
+ if (requestParams.url.toLocaleLowerCase().includes(this.serviceOptions.domain.toLocaleLowerCase())) {
69730
+ this.authentication && this.authentication.signRequest(requestParams);
69731
+ }
70130
69732
  if (url.includes(constants.languagePlaceHolder)) {
70131
69733
  requestParams.url = requestParams.url.replace(constants.languagePlaceHolder, this.styleOptions.language);
70132
69734
  }
@@ -70154,18 +69756,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
70154
69756
  * @private
70155
69757
  */
70156
69758
  Map.prototype._setStyleComponents = function (styleOptions) {
70157
- var _this = this;
70158
69759
  if (this.removed) {
70159
69760
  return;
70160
69761
  }
70161
- // Check if the default style is set by the client and if it exists in the current style set
70162
- this.styles.definitions().then(function (styleSet) {
70163
- if (!_this.styleOptions.style || !styleSet.styles.map(function (styleSetStyle) { return styleSetStyle.name; }).includes(_this.styleOptions.style)) {
70164
- _this.styleOptions.style = styleSet.defaultStyle;
70165
- }
70166
- _this.styleOptions = styleOptions;
70167
- _this._rebuildStyle();
70168
- });
69762
+ this.styleOptions = styleOptions;
69763
+ this._rebuildStyle();
70169
69764
  return;
70170
69765
  };
70171
69766
  /**
@@ -70184,6 +69779,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
70184
69779
  if (options.styleDefinitionsPath && !_hasSetStyleDefinitionsPath()) {
70185
69780
  setStyleDefinitionsPath(options.styleDefinitionsPath);
70186
69781
  }
69782
+ if (options.styleDefinitionsVersion && !_hasSetStyleDefinitionsVersion()) {
69783
+ setStyleDefinitionsVersion(options.styleDefinitionsVersion);
69784
+ }
70187
69785
  if (options.workerCount && !_hasWorkerCount()) {
70188
69786
  setWorkerCount(options.workerCount);
70189
69787
  }
@@ -70829,7 +70427,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
70829
70427
  exports.addImageTemplate = addImageTemplate;
70830
70428
  exports.clearPrewarmedResources = clearPrewarmedResources;
70831
70429
  exports.control = index$3;
70832
- exports.data = index$1;
70430
+ exports.data = index$2;
70833
70431
  exports.getAllImageTemplateNames = getAllImageTemplateNames;
70834
70432
  exports.getAuthenticationOptions = getAuthenticationOptions;
70835
70433
  exports.getDomain = getDomain;
@@ -70838,7 +70436,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
70838
70436
  exports.getMaxParallelImageRequests = getMaxParallelImageRequests;
70839
70437
  exports.getSessionId = getSessionId;
70840
70438
  exports.getStaticAssetsDomain = getStaticAssetsDomain;
70841
- exports.getStyleAPIVersion = getStyleAPIVersion;
70842
70439
  exports.getStyleDefinitionsPath = getStyleDefinitionsPath;
70843
70440
  exports.getStyleDefinitionsVersion = getStyleDefinitionsVersion;
70844
70441
  exports.getSubscriptionKey = getSubscriptionKey;
@@ -70849,14 +70446,13 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
70849
70446
  exports.internal = index;
70850
70447
  exports.isSupported = isSupported;
70851
70448
  exports.layer = index$5;
70852
- exports.math = index$2;
70449
+ exports.math = index$1;
70853
70450
  exports.prewarm = prewarm;
70854
70451
  exports.setAuthenticationOptions = setAuthenticationOptions;
70855
70452
  exports.setDomain = setDomain;
70856
70453
  exports.setLanguage = setLanguage;
70857
70454
  exports.setMaxParallelImageRequests = setMaxParallelImageRequests;
70858
70455
  exports.setSessionId = setSessionId;
70859
- exports.setStyleAPIVersion = setStyleAPIVersion;
70860
70456
  exports.setStyleDefinitionsPath = setStyleDefinitionsPath;
70861
70457
  exports.setStyleDefinitionsVersion = setStyleDefinitionsVersion;
70862
70458
  exports.setSubscriptionKey = setSubscriptionKey;