@mapbox/mapbox-gl-style-spec 14.1.0 → 14.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -587,12 +587,12 @@
587
587
  },
588
588
  url: {
589
589
  type: "string",
590
- doc: "A URL to a TileJSON resource. Supported protocols are `http:`, `https:`, and `mapbox://<Tileset ID>`."
590
+ doc: "A URL to a TileJSON resource. Supported protocols are `http:`, `https:`, and `mapbox://<Tileset ID>`. Required if `tiles` is not provided."
591
591
  },
592
592
  tiles: {
593
593
  type: "array",
594
594
  value: "string",
595
- doc: "An array of one or more tile source URLs, as in the TileJSON spec."
595
+ doc: "An array of one or more tile source URLs, as in the TileJSON spec. Required if `url` is not provided."
596
596
  },
597
597
  bounds: {
598
598
  type: "array",
@@ -666,12 +666,12 @@
666
666
  },
667
667
  url: {
668
668
  type: "string",
669
- doc: "A URL to a TileJSON resource. Supported protocols are `http:`, `https:`, and `mapbox://<Tileset ID>`."
669
+ doc: "A URL to a TileJSON resource. Supported protocols are `http:`, `https:`, and `mapbox://<Tileset ID>`. Required if `tiles` is not provided."
670
670
  },
671
671
  tiles: {
672
672
  type: "array",
673
673
  value: "string",
674
- doc: "An array of one or more tile source URLs, as in the TileJSON spec."
674
+ doc: "An array of one or more tile source URLs, as in the TileJSON spec. Required if `url` is not provided."
675
675
  },
676
676
  bounds: {
677
677
  type: "array",
@@ -747,12 +747,12 @@
747
747
  },
748
748
  url: {
749
749
  type: "string",
750
- doc: "A URL to a TileJSON resource. Supported protocols are `http:`, `https:`, and `mapbox://<Tileset ID>`."
750
+ doc: "A URL to a TileJSON resource. Supported protocols are `http:`, `https:`, and `mapbox://<Tileset ID>`. Required if `tiles` is not provided."
751
751
  },
752
752
  tiles: {
753
753
  type: "array",
754
754
  value: "string",
755
- doc: "An array of one or more tile source URLs, as in the TileJSON spec."
755
+ doc: "An array of one or more tile source URLs, as in the TileJSON spec. Required if `url` is not provided."
756
756
  },
757
757
  bounds: {
758
758
  type: "array",
@@ -828,12 +828,12 @@
828
828
  },
829
829
  url: {
830
830
  type: "string",
831
- doc: "A URL to a TileJSON resource. Supported protocols are `http:`, `https:`, and `mapbox://<Tileset ID>`."
831
+ doc: "A URL to a TileJSON resource. Supported protocols are `http:`, `https:`, and `mapbox://<Tileset ID>`. Required if `tiles` is not provided."
832
832
  },
833
833
  tiles: {
834
834
  type: "array",
835
835
  value: "string",
836
- doc: "An array of one or more tile source URLs, as in the TileJSON spec."
836
+ doc: "An array of one or more tile source URLs, as in the TileJSON spec. Required if `url` is not provided."
837
837
  },
838
838
  bounds: {
839
839
  type: "array",
@@ -1186,7 +1186,7 @@
1186
1186
  },
1187
1187
  "source-layer": {
1188
1188
  type: "string",
1189
- doc: "Layer to use from a vector tile source. Required for vector tile sources; prohibited for all other source types, including GeoJSON sources."
1189
+ doc: "Layer to use from a vector tile source. Required for vector and raster-array sources; prohibited for all other source types, including GeoJSON sources."
1190
1190
  },
1191
1191
  slot: {
1192
1192
  type: "string",
@@ -6891,7 +6891,12 @@
6891
6891
  required: false,
6892
6892
  "property-type": "data-constant",
6893
6893
  transition: false,
6894
- doc: "Displayed band of raster array source layer",
6894
+ requires: [
6895
+ {
6896
+ source: "raster-array"
6897
+ }
6898
+ ],
6899
+ doc: "Displayed band of raster array source layer. Defaults to the first band if not set.",
6895
6900
  example: "band-name",
6896
6901
  "sdk-support": {
6897
6902
  "basic functionality": {
@@ -8305,12 +8310,6 @@
8305
8310
  },
8306
8311
  transition: true,
8307
8312
  doc: "Controls the intensity of shading near ground and concave angles between walls. Default value 0.0 disables ambient occlusion and values around 0.3 provide the most plausible results for buildings.",
8308
- requires: [
8309
- "lights",
8310
- {
8311
- "!": "fill-extrusion-flood-light-intensity"
8312
- }
8313
- ],
8314
8313
  "sdk-support": {
8315
8314
  "basic functionality": {
8316
8315
  js: "3.0.0",
@@ -8334,10 +8333,7 @@
8334
8333
  transition: true,
8335
8334
  doc: "Shades area near ground and concave angles between walls where the radius defines only vertical impact. Default value 3.0 corresponds to height of one floor and brings the most plausible results for buildings. This property works only with legacy light. When 3D lights are enabled `fill-extrusion-ambient-occlusion-wall-radius` and `fill-extrusion-ambient-occlusion-ground-radius` are used instead.",
8336
8335
  requires: [
8337
- "fill-extrusion-edge-radius",
8338
- {
8339
- "!": "fill-extrusion-flood-light-intensity"
8340
- }
8336
+ "fill-extrusion-edge-radius"
8341
8337
  ],
8342
8338
  "sdk-support": {
8343
8339
  "basic functionality": {
@@ -8362,10 +8358,7 @@
8362
8358
  doc: "Shades area near ground and concave angles between walls where the radius defines only vertical impact. Default value 3.0 corresponds to height of one floor and brings the most plausible results for buildings.",
8363
8359
  requires: [
8364
8360
  "lights",
8365
- "fill-extrusion-edge-radius",
8366
- {
8367
- "!": "fill-extrusion-flood-light-intensity"
8368
- }
8361
+ "fill-extrusion-edge-radius"
8369
8362
  ],
8370
8363
  "sdk-support": {
8371
8364
  "basic functionality": {
@@ -8389,10 +8382,7 @@
8389
8382
  transition: true,
8390
8383
  doc: "The extent of the ambient occlusion effect on the ground beneath the extruded buildings in meters.",
8391
8384
  requires: [
8392
- "lights",
8393
- {
8394
- "!": "fill-extrusion-flood-light-intensity"
8395
- }
8385
+ "lights"
8396
8386
  ],
8397
8387
  "sdk-support": {
8398
8388
  "basic functionality": {
@@ -8410,10 +8400,7 @@
8410
8400
  maximum: 1,
8411
8401
  doc: "Provides a control to futher fine-tune the look of the ambient occlusion on the ground beneath the extruded buildings. Lower values give the effect a more solid look while higher values make it smoother.",
8412
8402
  requires: [
8413
- "lights",
8414
- {
8415
- "!": "fill-extrusion-flood-light-intensity"
8416
- }
8403
+ "lights"
8417
8404
  ],
8418
8405
  transition: true,
8419
8406
  expression: {
@@ -8436,10 +8423,7 @@
8436
8423
  "default": "#ffffff",
8437
8424
  doc: "The color of the flood light effect on the walls of the extruded buildings.",
8438
8425
  requires: [
8439
- "lights",
8440
- {
8441
- "!": "fill-extrusion-ambient-occlusion-intensity"
8442
- }
8426
+ "lights"
8443
8427
  ],
8444
8428
  transition: true,
8445
8429
  expression: {
@@ -8465,10 +8449,7 @@
8465
8449
  maximum: 1,
8466
8450
  doc: "The intensity of the flood light color.",
8467
8451
  requires: [
8468
- "lights",
8469
- {
8470
- "!": "fill-extrusion-ambient-occlusion-intensity"
8471
- }
8452
+ "lights"
8472
8453
  ],
8473
8454
  transition: true,
8474
8455
  expression: {
@@ -8494,10 +8475,7 @@
8494
8475
  minimum: 0,
8495
8476
  doc: "The extent of the flood light effect on the walls of the extruded buildings in meters.",
8496
8477
  requires: [
8497
- "lights",
8498
- {
8499
- "!": "fill-extrusion-ambient-occlusion-intensity"
8500
- }
8478
+ "lights"
8501
8479
  ],
8502
8480
  transition: true,
8503
8481
  expression: {
@@ -8525,13 +8503,9 @@
8525
8503
  type: "number",
8526
8504
  units: "meters",
8527
8505
  "default": 0,
8528
- minimum: 0,
8529
8506
  doc: "The extent of the flood light effect on the ground beneath the extruded buildings in meters.",
8530
8507
  requires: [
8531
- "lights",
8532
- {
8533
- "!": "fill-extrusion-ambient-occlusion-intensity"
8534
- }
8508
+ "lights"
8535
8509
  ],
8536
8510
  transition: true,
8537
8511
  expression: {
@@ -8562,10 +8536,7 @@
8562
8536
  maximum: 1,
8563
8537
  doc: "Provides a control to futher fine-tune the look of the flood light on the ground beneath the extruded buildings. Lower values give the effect a more solid look while higher values make it smoother.",
8564
8538
  requires: [
8565
- "lights",
8566
- {
8567
- "!": "fill-extrusion-ambient-occlusion-intensity"
8568
- }
8539
+ "lights"
8569
8540
  ],
8570
8541
  transition: true,
8571
8542
  expression: {
@@ -8631,7 +8602,7 @@
8631
8602
  "default": 0,
8632
8603
  minimum: 0,
8633
8604
  maximum: 1,
8634
- doc: "This parameter defines the range for the fade-out effect before an automatic content cutoff on pitched map views. The automatic cutoff range is calculated according to the minimum required zoom level of the source and layer. The fade range is expressed in relation to the height of the map view. A value of 1.0 indicates that the content is faded to the same extent as the map's height in pixels, while a value close to zero represents a sharp cutoff. When the value is set to 0.0, the cutoff is completely disabled. Note: The property has no effect on the map if terrain is enabled.",
8605
+ doc: "This parameter defines the range for the fade-out effect before an automatic content cutoff on pitched map views. Fade out is implemented by scaling down and removing buildings in the fade range in a staggered fashion. Opacity is not changed. The fade range is expressed in relation to the height of the map view. A value of 1.0 indicates that the content is faded to the same extent as the map's height in pixels, while a value close to zero represents a sharp cutoff. When the value is set to 0.0, the cutoff is completely disabled. Note: The property has no effect on the map if terrain is enabled.",
8635
8606
  transition: false,
8636
8607
  expression: {
8637
8608
  interpolated: false
@@ -8772,6 +8743,7 @@
8772
8743
  }(passedObj, '', 0);
8773
8744
  }
8774
8745
 
8746
+ //
8775
8747
  function sortKeysBy(obj, reference) {
8776
8748
  const result = {};
8777
8749
  for (const key in reference) {
@@ -8815,1177 +8787,6 @@
8815
8787
  return stringify(style, { indent: space });
8816
8788
  }
8817
8789
 
8818
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
8819
-
8820
- function getDefaultExportFromCjs (x) {
8821
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
8822
- }
8823
-
8824
- var url = {};
8825
-
8826
- var punycode$1 = {exports: {}};
8827
-
8828
- /*! https://mths.be/punycode v1.3.2 by @mathias */
8829
- punycode$1.exports;
8830
-
8831
- (function (module, exports) {
8832
- (function (root) {
8833
- /** Detect free variables */
8834
- var freeExports = exports && !exports.nodeType && exports;
8835
- var freeModule = module && !module.nodeType && module;
8836
- var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal;
8837
- if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal) {
8838
- root = freeGlobal;
8839
- }
8840
- /**
8841
- * The `punycode` object.
8842
- * @name punycode
8843
- * @type Object
8844
- */
8845
- var punycode,
8846
- /** Highest positive signed 32-bit float value */
8847
- maxInt = 2147483647,
8848
- // aka. 0x7FFFFFFF or 2^31-1
8849
- /** Bootstring parameters */
8850
- base = 36, tMin = 1, tMax = 26, skew = 38, damp = 700, initialBias = 72, initialN = 128,
8851
- // 0x80
8852
- delimiter = '-',
8853
- // '\x2D'
8854
- /** Regular expressions */
8855
- regexPunycode = /^xn--/, regexNonASCII = /[^\x20-\x7E]/,
8856
- // unprintable ASCII chars + non-ASCII chars
8857
- regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g,
8858
- // RFC 3490 separators
8859
- /** Error messages */
8860
- errors = {
8861
- 'overflow': 'Overflow: input needs wider integers to process',
8862
- 'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
8863
- 'invalid-input': 'Invalid input'
8864
- },
8865
- /** Convenience shortcuts */
8866
- baseMinusTMin = base - tMin, floor = Math.floor, stringFromCharCode = String.fromCharCode,
8867
- /** Temporary variable */
8868
- key;
8869
- /*--------------------------------------------------------------------------*/
8870
- /**
8871
- * A generic error utility function.
8872
- * @private
8873
- * @param {String} type The error type.
8874
- * @returns {Error} Throws a `RangeError` with the applicable error message.
8875
- */
8876
- function error(type) {
8877
- throw RangeError(errors[type]);
8878
- }
8879
- /**
8880
- * A generic `Array#map` utility function.
8881
- * @private
8882
- * @param {Array} array The array to iterate over.
8883
- * @param {Function} callback The function that gets called for every array
8884
- * item.
8885
- * @returns {Array} A new array of values returned by the callback function.
8886
- */
8887
- function map(array, fn) {
8888
- var length = array.length;
8889
- var result = [];
8890
- while (length--) {
8891
- result[length] = fn(array[length]);
8892
- }
8893
- return result;
8894
- }
8895
- /**
8896
- * A simple `Array#map`-like wrapper to work with domain name strings or email
8897
- * addresses.
8898
- * @private
8899
- * @param {String} domain The domain name or email address.
8900
- * @param {Function} callback The function that gets called for every
8901
- * character.
8902
- * @returns {Array} A new string of characters returned by the callback
8903
- * function.
8904
- */
8905
- function mapDomain(string, fn) {
8906
- var parts = string.split('@');
8907
- var result = '';
8908
- if (parts.length > 1) {
8909
- // In email addresses, only the domain name should be punycoded. Leave
8910
- // the local part (i.e. everything up to `@`) intact.
8911
- result = parts[0] + '@';
8912
- string = parts[1];
8913
- }
8914
- // Avoid `split(regex)` for IE8 compatibility. See #17.
8915
- string = string.replace(regexSeparators, '.');
8916
- var labels = string.split('.');
8917
- var encoded = map(labels, fn).join('.');
8918
- return result + encoded;
8919
- }
8920
- /**
8921
- * Creates an array containing the numeric code points of each Unicode
8922
- * character in the string. While JavaScript uses UCS-2 internally,
8923
- * this function will convert a pair of surrogate halves (each of which
8924
- * UCS-2 exposes as separate characters) into a single code point,
8925
- * matching UTF-16.
8926
- * @see `punycode.ucs2.encode`
8927
- * @see <https://mathiasbynens.be/notes/javascript-encoding>
8928
- * @memberOf punycode.ucs2
8929
- * @name decode
8930
- * @param {String} string The Unicode input string (UCS-2).
8931
- * @returns {Array} The new array of code points.
8932
- */
8933
- function ucs2decode(string) {
8934
- var output = [], counter = 0, length = string.length, value, extra;
8935
- while (counter < length) {
8936
- value = string.charCodeAt(counter++);
8937
- if (value >= 55296 && value <= 56319 && counter < length) {
8938
- // high surrogate, and there is a next character
8939
- extra = string.charCodeAt(counter++);
8940
- if ((extra & 64512) == 56320) {
8941
- // low surrogate
8942
- output.push(((value & 1023) << 10) + (extra & 1023) + 65536);
8943
- } else {
8944
- // unmatched surrogate; only append this code unit, in case the next
8945
- // code unit is the high surrogate of a surrogate pair
8946
- output.push(value);
8947
- counter--;
8948
- }
8949
- } else {
8950
- output.push(value);
8951
- }
8952
- }
8953
- return output;
8954
- }
8955
- /**
8956
- * Creates a string based on an array of numeric code points.
8957
- * @see `punycode.ucs2.decode`
8958
- * @memberOf punycode.ucs2
8959
- * @name encode
8960
- * @param {Array} codePoints The array of numeric code points.
8961
- * @returns {String} The new Unicode string (UCS-2).
8962
- */
8963
- function ucs2encode(array) {
8964
- return map(array, function (value) {
8965
- var output = '';
8966
- if (value > 65535) {
8967
- value -= 65536;
8968
- output += stringFromCharCode(value >>> 10 & 1023 | 55296);
8969
- value = 56320 | value & 1023;
8970
- }
8971
- output += stringFromCharCode(value);
8972
- return output;
8973
- }).join('');
8974
- }
8975
- /**
8976
- * Converts a basic code point into a digit/integer.
8977
- * @see `digitToBasic()`
8978
- * @private
8979
- * @param {Number} codePoint The basic numeric code point value.
8980
- * @returns {Number} The numeric value of a basic code point (for use in
8981
- * representing integers) in the range `0` to `base - 1`, or `base` if
8982
- * the code point does not represent a value.
8983
- */
8984
- function basicToDigit(codePoint) {
8985
- if (codePoint - 48 < 10) {
8986
- return codePoint - 22;
8987
- }
8988
- if (codePoint - 65 < 26) {
8989
- return codePoint - 65;
8990
- }
8991
- if (codePoint - 97 < 26) {
8992
- return codePoint - 97;
8993
- }
8994
- return base;
8995
- }
8996
- /**
8997
- * Converts a digit/integer into a basic code point.
8998
- * @see `basicToDigit()`
8999
- * @private
9000
- * @param {Number} digit The numeric value of a basic code point.
9001
- * @returns {Number} The basic code point whose value (when used for
9002
- * representing integers) is `digit`, which needs to be in the range
9003
- * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
9004
- * used; else, the lowercase form is used. The behavior is undefined
9005
- * if `flag` is non-zero and `digit` has no uppercase form.
9006
- */
9007
- function digitToBasic(digit, flag) {
9008
- // 0..25 map to ASCII a..z or A..Z
9009
- // 26..35 map to ASCII 0..9
9010
- return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
9011
- }
9012
- /**
9013
- * Bias adaptation function as per section 3.4 of RFC 3492.
9014
- * http://tools.ietf.org/html/rfc3492#section-3.4
9015
- * @private
9016
- */
9017
- function adapt(delta, numPoints, firstTime) {
9018
- var k = 0;
9019
- delta = firstTime ? floor(delta / damp) : delta >> 1;
9020
- delta += floor(delta / numPoints);
9021
- for (; delta > baseMinusTMin * tMax >> 1; k += base) {
9022
- delta = floor(delta / baseMinusTMin);
9023
- }
9024
- return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
9025
- }
9026
- /**
9027
- * Converts a Punycode string of ASCII-only symbols to a string of Unicode
9028
- * symbols.
9029
- * @memberOf punycode
9030
- * @param {String} input The Punycode string of ASCII-only symbols.
9031
- * @returns {String} The resulting string of Unicode symbols.
9032
- */
9033
- function decode(input) {
9034
- // Don't use UCS-2
9035
- var output = [], inputLength = input.length, out, i = 0, n = initialN, bias = initialBias, basic, j, index, oldi, w, k, digit, t,
9036
- /** Cached calculation results */
9037
- baseMinusT;
9038
- // Handle the basic code points: let `basic` be the number of input code
9039
- // points before the last delimiter, or `0` if there is none, then copy
9040
- // the first basic code points to the output.
9041
- basic = input.lastIndexOf(delimiter);
9042
- if (basic < 0) {
9043
- basic = 0;
9044
- }
9045
- for (j = 0; j < basic; ++j) {
9046
- // if it's not a basic code point
9047
- if (input.charCodeAt(j) >= 128) {
9048
- error('not-basic');
9049
- }
9050
- output.push(input.charCodeAt(j));
9051
- }
9052
- // Main decoding loop: start just after the last delimiter if any basic code
9053
- // points were copied; start at the beginning otherwise.
9054
- for (index = basic > 0 ? basic + 1 : 0; index < inputLength;) {
9055
- // `index` is the index of the next character to be consumed.
9056
- // Decode a generalized variable-length integer into `delta`,
9057
- // which gets added to `i`. The overflow checking is easier
9058
- // if we increase `i` as we go, then subtract off its starting
9059
- // value at the end to obtain `delta`.
9060
- for (oldi = i, w = 1, k = base;; k += base) {
9061
- if (index >= inputLength) {
9062
- error('invalid-input');
9063
- }
9064
- digit = basicToDigit(input.charCodeAt(index++));
9065
- if (digit >= base || digit > floor((maxInt - i) / w)) {
9066
- error('overflow');
9067
- }
9068
- i += digit * w;
9069
- t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
9070
- if (digit < t) {
9071
- break;
9072
- }
9073
- baseMinusT = base - t;
9074
- if (w > floor(maxInt / baseMinusT)) {
9075
- error('overflow');
9076
- }
9077
- w *= baseMinusT;
9078
- }
9079
- out = output.length + 1;
9080
- bias = adapt(i - oldi, out, oldi == 0);
9081
- // `i` was supposed to wrap around from `out` to `0`,
9082
- // incrementing `n` each time, so we'll fix that now:
9083
- if (floor(i / out) > maxInt - n) {
9084
- error('overflow');
9085
- }
9086
- n += floor(i / out);
9087
- i %= out;
9088
- // Insert `n` at position `i` of the output
9089
- output.splice(i++, 0, n);
9090
- }
9091
- return ucs2encode(output);
9092
- }
9093
- /**
9094
- * Converts a string of Unicode symbols (e.g. a domain name label) to a
9095
- * Punycode string of ASCII-only symbols.
9096
- * @memberOf punycode
9097
- * @param {String} input The string of Unicode symbols.
9098
- * @returns {String} The resulting Punycode string of ASCII-only symbols.
9099
- */
9100
- function encode(input) {
9101
- var n, delta, handledCPCount, basicLength, bias, j, m, q, k, t, currentValue, output = [],
9102
- /** `inputLength` will hold the number of code points in `input`. */
9103
- inputLength,
9104
- /** Cached calculation results */
9105
- handledCPCountPlusOne, baseMinusT, qMinusT;
9106
- // Convert the input in UCS-2 to Unicode
9107
- input = ucs2decode(input);
9108
- // Cache the length
9109
- inputLength = input.length;
9110
- // Initialize the state
9111
- n = initialN;
9112
- delta = 0;
9113
- bias = initialBias;
9114
- // Handle the basic code points
9115
- for (j = 0; j < inputLength; ++j) {
9116
- currentValue = input[j];
9117
- if (currentValue < 128) {
9118
- output.push(stringFromCharCode(currentValue));
9119
- }
9120
- }
9121
- handledCPCount = basicLength = output.length;
9122
- // `handledCPCount` is the number of code points that have been handled;
9123
- // `basicLength` is the number of basic code points.
9124
- // Finish the basic string - if it is not empty - with a delimiter
9125
- if (basicLength) {
9126
- output.push(delimiter);
9127
- }
9128
- // Main encoding loop:
9129
- while (handledCPCount < inputLength) {
9130
- // All non-basic code points < n have been handled already. Find the next
9131
- // larger one:
9132
- for (m = maxInt, j = 0; j < inputLength; ++j) {
9133
- currentValue = input[j];
9134
- if (currentValue >= n && currentValue < m) {
9135
- m = currentValue;
9136
- }
9137
- }
9138
- // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
9139
- // but guard against overflow
9140
- handledCPCountPlusOne = handledCPCount + 1;
9141
- if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
9142
- error('overflow');
9143
- }
9144
- delta += (m - n) * handledCPCountPlusOne;
9145
- n = m;
9146
- for (j = 0; j < inputLength; ++j) {
9147
- currentValue = input[j];
9148
- if (currentValue < n && ++delta > maxInt) {
9149
- error('overflow');
9150
- }
9151
- if (currentValue == n) {
9152
- // Represent delta as a generalized variable-length integer
9153
- for (q = delta, k = base;; k += base) {
9154
- t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
9155
- if (q < t) {
9156
- break;
9157
- }
9158
- qMinusT = q - t;
9159
- baseMinusT = base - t;
9160
- output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)));
9161
- q = floor(qMinusT / baseMinusT);
9162
- }
9163
- output.push(stringFromCharCode(digitToBasic(q, 0)));
9164
- bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
9165
- delta = 0;
9166
- ++handledCPCount;
9167
- }
9168
- }
9169
- ++delta;
9170
- ++n;
9171
- }
9172
- return output.join('');
9173
- }
9174
- /**
9175
- * Converts a Punycode string representing a domain name or an email address
9176
- * to Unicode. Only the Punycoded parts of the input will be converted, i.e.
9177
- * it doesn't matter if you call it on a string that has already been
9178
- * converted to Unicode.
9179
- * @memberOf punycode
9180
- * @param {String} input The Punycoded domain name or email address to
9181
- * convert to Unicode.
9182
- * @returns {String} The Unicode representation of the given Punycode
9183
- * string.
9184
- */
9185
- function toUnicode(input) {
9186
- return mapDomain(input, function (string) {
9187
- return regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string;
9188
- });
9189
- }
9190
- /**
9191
- * Converts a Unicode string representing a domain name or an email address to
9192
- * Punycode. Only the non-ASCII parts of the domain name will be converted,
9193
- * i.e. it doesn't matter if you call it with a domain that's already in
9194
- * ASCII.
9195
- * @memberOf punycode
9196
- * @param {String} input The domain name or email address to convert, as a
9197
- * Unicode string.
9198
- * @returns {String} The Punycode representation of the given domain name or
9199
- * email address.
9200
- */
9201
- function toASCII(input) {
9202
- return mapDomain(input, function (string) {
9203
- return regexNonASCII.test(string) ? 'xn--' + encode(string) : string;
9204
- });
9205
- }
9206
- /*--------------------------------------------------------------------------*/
9207
- /** Define the public API */
9208
- punycode = {
9209
- /**
9210
- * A string representing the current Punycode.js version number.
9211
- * @memberOf punycode
9212
- * @type String
9213
- */
9214
- 'version': '1.3.2',
9215
- /**
9216
- * An object of methods to convert from JavaScript's internal character
9217
- * representation (UCS-2) to Unicode code points, and back.
9218
- * @see <https://mathiasbynens.be/notes/javascript-encoding>
9219
- * @memberOf punycode
9220
- * @type Object
9221
- */
9222
- 'ucs2': {
9223
- 'decode': ucs2decode,
9224
- 'encode': ucs2encode
9225
- },
9226
- 'decode': decode,
9227
- 'encode': encode,
9228
- 'toASCII': toASCII,
9229
- 'toUnicode': toUnicode
9230
- };
9231
- /** Expose `punycode` */
9232
- // Some AMD build optimizers, like r.js, check for specific condition patterns
9233
- // like the following:
9234
- if (freeExports && freeModule) {
9235
- if (module.exports == freeExports) {
9236
- // in Node.js or RingoJS v0.8.0+
9237
- freeModule.exports = punycode;
9238
- } else {
9239
- // in Narwhal or RingoJS v0.7.0-
9240
- for (key in punycode) {
9241
- punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);
9242
- }
9243
- }
9244
- } else {
9245
- // in Rhino or a web browser
9246
- root.punycode = punycode;
9247
- }
9248
- }(commonjsGlobal));
9249
- } (punycode$1, punycode$1.exports));
9250
-
9251
- var punycodeExports = punycode$1.exports;
9252
-
9253
- var util$1 = {
9254
- isString: function (arg) {
9255
- return typeof arg === 'string';
9256
- },
9257
- isObject: function (arg) {
9258
- return typeof arg === 'object' && arg !== null;
9259
- },
9260
- isNull: function (arg) {
9261
- return arg === null;
9262
- },
9263
- isNullOrUndefined: function (arg) {
9264
- return arg == null;
9265
- }
9266
- };
9267
-
9268
- var querystring$1 = {};
9269
-
9270
- // If obj.hasOwnProperty has been overridden, then calling
9271
- // obj.hasOwnProperty(prop) will break.
9272
- // See: https://github.com/joyent/node/issues/1707
9273
- function hasOwnProperty(obj, prop) {
9274
- return Object.prototype.hasOwnProperty.call(obj, prop);
9275
- }
9276
- var decode = function (qs, sep, eq, options) {
9277
- sep = sep || '&';
9278
- eq = eq || '=';
9279
- var obj = {};
9280
- if (typeof qs !== 'string' || qs.length === 0) {
9281
- return obj;
9282
- }
9283
- var regexp = /\+/g;
9284
- qs = qs.split(sep);
9285
- var maxKeys = 1000;
9286
- if (options && typeof options.maxKeys === 'number') {
9287
- maxKeys = options.maxKeys;
9288
- }
9289
- var len = qs.length;
9290
- // maxKeys <= 0 means that we should not limit keys count
9291
- if (maxKeys > 0 && len > maxKeys) {
9292
- len = maxKeys;
9293
- }
9294
- for (var i = 0; i < len; ++i) {
9295
- var x = qs[i].replace(regexp, '%20'), idx = x.indexOf(eq), kstr, vstr, k, v;
9296
- if (idx >= 0) {
9297
- kstr = x.substr(0, idx);
9298
- vstr = x.substr(idx + 1);
9299
- } else {
9300
- kstr = x;
9301
- vstr = '';
9302
- }
9303
- k = decodeURIComponent(kstr);
9304
- v = decodeURIComponent(vstr);
9305
- if (!hasOwnProperty(obj, k)) {
9306
- obj[k] = v;
9307
- } else if (Array.isArray(obj[k])) {
9308
- obj[k].push(v);
9309
- } else {
9310
- obj[k] = [
9311
- obj[k],
9312
- v
9313
- ];
9314
- }
9315
- }
9316
- return obj;
9317
- };
9318
-
9319
- var stringifyPrimitive = function (v) {
9320
- switch (typeof v) {
9321
- case 'string':
9322
- return v;
9323
- case 'boolean':
9324
- return v ? 'true' : 'false';
9325
- case 'number':
9326
- return isFinite(v) ? v : '';
9327
- default:
9328
- return '';
9329
- }
9330
- };
9331
- var encode = function (obj, sep, eq, name) {
9332
- sep = sep || '&';
9333
- eq = eq || '=';
9334
- if (obj === null) {
9335
- obj = undefined;
9336
- }
9337
- if (typeof obj === 'object') {
9338
- return Object.keys(obj).map(function (k) {
9339
- var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;
9340
- if (Array.isArray(obj[k])) {
9341
- return obj[k].map(function (v) {
9342
- return ks + encodeURIComponent(stringifyPrimitive(v));
9343
- }).join(sep);
9344
- } else {
9345
- return ks + encodeURIComponent(stringifyPrimitive(obj[k]));
9346
- }
9347
- }).join(sep);
9348
- }
9349
- if (!name)
9350
- return '';
9351
- return encodeURIComponent(stringifyPrimitive(name)) + eq + encodeURIComponent(stringifyPrimitive(obj));
9352
- };
9353
-
9354
- querystring$1.decode = querystring$1.parse = decode;
9355
- querystring$1.encode = querystring$1.stringify = encode;
9356
-
9357
- var punycode = punycodeExports;
9358
- var util = util$1;
9359
- url.parse = urlParse;
9360
- url.resolve = urlResolve;
9361
- url.resolveObject = urlResolveObject;
9362
- url.format = urlFormat;
9363
- url.Url = Url;
9364
- function Url() {
9365
- this.protocol = null;
9366
- this.slashes = null;
9367
- this.auth = null;
9368
- this.host = null;
9369
- this.port = null;
9370
- this.hostname = null;
9371
- this.hash = null;
9372
- this.search = null;
9373
- this.query = null;
9374
- this.pathname = null;
9375
- this.path = null;
9376
- this.href = null;
9377
- }
9378
- // Reference: RFC 3986, RFC 1808, RFC 2396
9379
- // define these here so at least they only have to be
9380
- // compiled once on the first module load.
9381
- var protocolPattern = /^([a-z0-9.+-]+:)/i, portPattern = /:[0-9]*$/,
9382
- // Special case for a simple path URL
9383
- simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,
9384
- // RFC 2396: characters reserved for delimiting URLs.
9385
- // We actually just auto-escape these.
9386
- delims = [
9387
- '<',
9388
- '>',
9389
- '"',
9390
- '`',
9391
- ' ',
9392
- '\r',
9393
- '\n',
9394
- '\t'
9395
- ],
9396
- // RFC 2396: characters not allowed for various reasons.
9397
- unwise = [
9398
- '{',
9399
- '}',
9400
- '|',
9401
- '\\',
9402
- '^',
9403
- '`'
9404
- ].concat(delims),
9405
- // Allowed by RFCs, but cause of XSS attacks. Always escape these.
9406
- autoEscape = ['\''].concat(unwise),
9407
- // Characters that are never ever allowed in a hostname.
9408
- // Note that any invalid chars are also handled, but these
9409
- // are the ones that are *expected* to be seen, so we fast-path
9410
- // them.
9411
- nonHostChars = [
9412
- '%',
9413
- '/',
9414
- '?',
9415
- ';',
9416
- '#'
9417
- ].concat(autoEscape), hostEndingChars = [
9418
- '/',
9419
- '?',
9420
- '#'
9421
- ], hostnameMaxLen = 255, hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/, hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,
9422
- // protocols that can allow "unsafe" and "unwise" chars.
9423
- unsafeProtocol = {
9424
- 'javascript': true,
9425
- 'javascript:': true
9426
- },
9427
- // protocols that never have a hostname.
9428
- hostlessProtocol = {
9429
- 'javascript': true,
9430
- 'javascript:': true
9431
- },
9432
- // protocols that always contain a // bit.
9433
- slashedProtocol = {
9434
- 'http': true,
9435
- 'https': true,
9436
- 'ftp': true,
9437
- 'gopher': true,
9438
- 'file': true,
9439
- 'http:': true,
9440
- 'https:': true,
9441
- 'ftp:': true,
9442
- 'gopher:': true,
9443
- 'file:': true
9444
- }, querystring = querystring$1;
9445
- function urlParse(url, parseQueryString, slashesDenoteHost) {
9446
- if (url && util.isObject(url) && url instanceof Url)
9447
- return url;
9448
- var u = new Url();
9449
- u.parse(url, parseQueryString, slashesDenoteHost);
9450
- return u;
9451
- }
9452
- Url.prototype.parse = function (url, parseQueryString, slashesDenoteHost) {
9453
- if (!util.isString(url)) {
9454
- throw new TypeError('Parameter \'url\' must be a string, not ' + typeof url);
9455
- }
9456
- // Copy chrome, IE, opera backslash-handling behavior.
9457
- // Back slashes before the query string get converted to forward slashes
9458
- // See: https://code.google.com/p/chromium/issues/detail?id=25916
9459
- var queryIndex = url.indexOf('?'), splitter = queryIndex !== -1 && queryIndex < url.indexOf('#') ? '?' : '#', uSplit = url.split(splitter), slashRegex = /\\/g;
9460
- uSplit[0] = uSplit[0].replace(slashRegex, '/');
9461
- url = uSplit.join(splitter);
9462
- var rest = url;
9463
- // trim before proceeding.
9464
- // This is to support parse stuff like " http://foo.com \n"
9465
- rest = rest.trim();
9466
- if (!slashesDenoteHost && url.split('#').length === 1) {
9467
- // Try fast path regexp
9468
- var simplePath = simplePathPattern.exec(rest);
9469
- if (simplePath) {
9470
- this.path = rest;
9471
- this.href = rest;
9472
- this.pathname = simplePath[1];
9473
- if (simplePath[2]) {
9474
- this.search = simplePath[2];
9475
- if (parseQueryString) {
9476
- this.query = querystring.parse(this.search.substr(1));
9477
- } else {
9478
- this.query = this.search.substr(1);
9479
- }
9480
- } else if (parseQueryString) {
9481
- this.search = '';
9482
- this.query = {};
9483
- }
9484
- return this;
9485
- }
9486
- }
9487
- var proto = protocolPattern.exec(rest);
9488
- if (proto) {
9489
- proto = proto[0];
9490
- var lowerProto = proto.toLowerCase();
9491
- this.protocol = lowerProto;
9492
- rest = rest.substr(proto.length);
9493
- }
9494
- // figure out if it's got a host
9495
- // user@server is *always* interpreted as a hostname, and url
9496
- // resolution will treat //foo/bar as host=foo,path=bar because that's
9497
- // how the browser resolves relative URLs.
9498
- if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) {
9499
- var slashes = rest.substr(0, 2) === '//';
9500
- if (slashes && !(proto && hostlessProtocol[proto])) {
9501
- rest = rest.substr(2);
9502
- this.slashes = true;
9503
- }
9504
- }
9505
- if (!hostlessProtocol[proto] && (slashes || proto && !slashedProtocol[proto])) {
9506
- // there's a hostname.
9507
- // the first instance of /, ?, ;, or # ends the host.
9508
- //
9509
- // If there is an @ in the hostname, then non-host chars *are* allowed
9510
- // to the left of the last @ sign, unless some host-ending character
9511
- // comes *before* the @-sign.
9512
- // URLs are obnoxious.
9513
- //
9514
- // ex:
9515
- // http://a@b@c/ => user:a@b host:c
9516
- // http://a@b?@c => user:a host:c path:/?@c
9517
- // v0.12 TODO(isaacs): This is not quite how Chrome does things.
9518
- // Review our test case against browsers more comprehensively.
9519
- // find the first instance of any hostEndingChars
9520
- var hostEnd = -1;
9521
- for (var i = 0; i < hostEndingChars.length; i++) {
9522
- var hec = rest.indexOf(hostEndingChars[i]);
9523
- if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))
9524
- hostEnd = hec;
9525
- }
9526
- // at this point, either we have an explicit point where the
9527
- // auth portion cannot go past, or the last @ char is the decider.
9528
- var auth, atSign;
9529
- if (hostEnd === -1) {
9530
- // atSign can be anywhere.
9531
- atSign = rest.lastIndexOf('@');
9532
- } else {
9533
- // atSign must be in auth portion.
9534
- // http://a@b/c@d => host:b auth:a path:/c@d
9535
- atSign = rest.lastIndexOf('@', hostEnd);
9536
- }
9537
- // Now we have a portion which is definitely the auth.
9538
- // Pull that off.
9539
- if (atSign !== -1) {
9540
- auth = rest.slice(0, atSign);
9541
- rest = rest.slice(atSign + 1);
9542
- this.auth = decodeURIComponent(auth);
9543
- }
9544
- // the host is the remaining to the left of the first non-host char
9545
- hostEnd = -1;
9546
- for (var i = 0; i < nonHostChars.length; i++) {
9547
- var hec = rest.indexOf(nonHostChars[i]);
9548
- if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))
9549
- hostEnd = hec;
9550
- }
9551
- // if we still have not hit it, then the entire thing is a host.
9552
- if (hostEnd === -1)
9553
- hostEnd = rest.length;
9554
- this.host = rest.slice(0, hostEnd);
9555
- rest = rest.slice(hostEnd);
9556
- // pull out port.
9557
- this.parseHost();
9558
- // we've indicated that there is a hostname,
9559
- // so even if it's empty, it has to be present.
9560
- this.hostname = this.hostname || '';
9561
- // if hostname begins with [ and ends with ]
9562
- // assume that it's an IPv6 address.
9563
- var ipv6Hostname = this.hostname[0] === '[' && this.hostname[this.hostname.length - 1] === ']';
9564
- // validate a little.
9565
- if (!ipv6Hostname) {
9566
- var hostparts = this.hostname.split(/\./);
9567
- for (var i = 0, l = hostparts.length; i < l; i++) {
9568
- var part = hostparts[i];
9569
- if (!part)
9570
- continue;
9571
- if (!part.match(hostnamePartPattern)) {
9572
- var newpart = '';
9573
- for (var j = 0, k = part.length; j < k; j++) {
9574
- if (part.charCodeAt(j) > 127) {
9575
- // we replace non-ASCII char with a temporary placeholder
9576
- // we need this to make sure size of hostname is not
9577
- // broken by replacing non-ASCII by nothing
9578
- newpart += 'x';
9579
- } else {
9580
- newpart += part[j];
9581
- }
9582
- }
9583
- // we test again with ASCII char only
9584
- if (!newpart.match(hostnamePartPattern)) {
9585
- var validParts = hostparts.slice(0, i);
9586
- var notHost = hostparts.slice(i + 1);
9587
- var bit = part.match(hostnamePartStart);
9588
- if (bit) {
9589
- validParts.push(bit[1]);
9590
- notHost.unshift(bit[2]);
9591
- }
9592
- if (notHost.length) {
9593
- rest = '/' + notHost.join('.') + rest;
9594
- }
9595
- this.hostname = validParts.join('.');
9596
- break;
9597
- }
9598
- }
9599
- }
9600
- }
9601
- if (this.hostname.length > hostnameMaxLen) {
9602
- this.hostname = '';
9603
- } else {
9604
- // hostnames are always lower case.
9605
- this.hostname = this.hostname.toLowerCase();
9606
- }
9607
- if (!ipv6Hostname) {
9608
- // IDNA Support: Returns a punycoded representation of "domain".
9609
- // It only converts parts of the domain name that
9610
- // have non-ASCII characters, i.e. it doesn't matter if
9611
- // you call it with a domain that already is ASCII-only.
9612
- this.hostname = punycode.toASCII(this.hostname);
9613
- }
9614
- var p = this.port ? ':' + this.port : '';
9615
- var h = this.hostname || '';
9616
- this.host = h + p;
9617
- this.href += this.host;
9618
- // strip [ and ] from the hostname
9619
- // the host field still retains them, though
9620
- if (ipv6Hostname) {
9621
- this.hostname = this.hostname.substr(1, this.hostname.length - 2);
9622
- if (rest[0] !== '/') {
9623
- rest = '/' + rest;
9624
- }
9625
- }
9626
- }
9627
- // now rest is set to the post-host stuff.
9628
- // chop off any delim chars.
9629
- if (!unsafeProtocol[lowerProto]) {
9630
- // First, make 100% sure that any "autoEscape" chars get
9631
- // escaped, even if encodeURIComponent doesn't think they
9632
- // need to be.
9633
- for (var i = 0, l = autoEscape.length; i < l; i++) {
9634
- var ae = autoEscape[i];
9635
- if (rest.indexOf(ae) === -1)
9636
- continue;
9637
- var esc = encodeURIComponent(ae);
9638
- if (esc === ae) {
9639
- esc = escape(ae);
9640
- }
9641
- rest = rest.split(ae).join(esc);
9642
- }
9643
- }
9644
- // chop off from the tail first.
9645
- var hash = rest.indexOf('#');
9646
- if (hash !== -1) {
9647
- // got a fragment string.
9648
- this.hash = rest.substr(hash);
9649
- rest = rest.slice(0, hash);
9650
- }
9651
- var qm = rest.indexOf('?');
9652
- if (qm !== -1) {
9653
- this.search = rest.substr(qm);
9654
- this.query = rest.substr(qm + 1);
9655
- if (parseQueryString) {
9656
- this.query = querystring.parse(this.query);
9657
- }
9658
- rest = rest.slice(0, qm);
9659
- } else if (parseQueryString) {
9660
- // no query string, but parseQueryString still requested
9661
- this.search = '';
9662
- this.query = {};
9663
- }
9664
- if (rest)
9665
- this.pathname = rest;
9666
- if (slashedProtocol[lowerProto] && this.hostname && !this.pathname) {
9667
- this.pathname = '/';
9668
- }
9669
- //to support http.request
9670
- if (this.pathname || this.search) {
9671
- var p = this.pathname || '';
9672
- var s = this.search || '';
9673
- this.path = p + s;
9674
- }
9675
- // finally, reconstruct the href based on what has been validated.
9676
- this.href = this.format();
9677
- return this;
9678
- };
9679
- // format a parsed object into a url string
9680
- function urlFormat(obj) {
9681
- // ensure it's an object, and not a string url.
9682
- // If it's an obj, this is a no-op.
9683
- // this way, you can call url_format() on strings
9684
- // to clean up potentially wonky urls.
9685
- if (util.isString(obj))
9686
- obj = urlParse(obj);
9687
- if (!(obj instanceof Url))
9688
- return Url.prototype.format.call(obj);
9689
- return obj.format();
9690
- }
9691
- Url.prototype.format = function () {
9692
- var auth = this.auth || '';
9693
- if (auth) {
9694
- auth = encodeURIComponent(auth);
9695
- auth = auth.replace(/%3A/i, ':');
9696
- auth += '@';
9697
- }
9698
- var protocol = this.protocol || '', pathname = this.pathname || '', hash = this.hash || '', host = false, query = '';
9699
- if (this.host) {
9700
- host = auth + this.host;
9701
- } else if (this.hostname) {
9702
- host = auth + (this.hostname.indexOf(':') === -1 ? this.hostname : '[' + this.hostname + ']');
9703
- if (this.port) {
9704
- host += ':' + this.port;
9705
- }
9706
- }
9707
- if (this.query && util.isObject(this.query) && Object.keys(this.query).length) {
9708
- query = querystring.stringify(this.query);
9709
- }
9710
- var search = this.search || query && '?' + query || '';
9711
- if (protocol && protocol.substr(-1) !== ':')
9712
- protocol += ':';
9713
- // only the slashedProtocols get the //. Not mailto:, xmpp:, etc.
9714
- // unless they had them to begin with.
9715
- if (this.slashes || (!protocol || slashedProtocol[protocol]) && host !== false) {
9716
- host = '//' + (host || '');
9717
- if (pathname && pathname.charAt(0) !== '/')
9718
- pathname = '/' + pathname;
9719
- } else if (!host) {
9720
- host = '';
9721
- }
9722
- if (hash && hash.charAt(0) !== '#')
9723
- hash = '#' + hash;
9724
- if (search && search.charAt(0) !== '?')
9725
- search = '?' + search;
9726
- pathname = pathname.replace(/[?#]/g, function (match) {
9727
- return encodeURIComponent(match);
9728
- });
9729
- search = search.replace('#', '%23');
9730
- return protocol + host + pathname + search + hash;
9731
- };
9732
- function urlResolve(source, relative) {
9733
- return urlParse(source, false, true).resolve(relative);
9734
- }
9735
- Url.prototype.resolve = function (relative) {
9736
- return this.resolveObject(urlParse(relative, false, true)).format();
9737
- };
9738
- function urlResolveObject(source, relative) {
9739
- if (!source)
9740
- return relative;
9741
- return urlParse(source, false, true).resolveObject(relative);
9742
- }
9743
- Url.prototype.resolveObject = function (relative) {
9744
- if (util.isString(relative)) {
9745
- var rel = new Url();
9746
- rel.parse(relative, false, true);
9747
- relative = rel;
9748
- }
9749
- var result = new Url();
9750
- var tkeys = Object.keys(this);
9751
- for (var tk = 0; tk < tkeys.length; tk++) {
9752
- var tkey = tkeys[tk];
9753
- result[tkey] = this[tkey];
9754
- }
9755
- // hash is always overridden, no matter what.
9756
- // even href="" will remove it.
9757
- result.hash = relative.hash;
9758
- // if the relative url is empty, then there's nothing left to do here.
9759
- if (relative.href === '') {
9760
- result.href = result.format();
9761
- return result;
9762
- }
9763
- // hrefs like //foo/bar always cut to the protocol.
9764
- if (relative.slashes && !relative.protocol) {
9765
- // take everything except the protocol from relative
9766
- var rkeys = Object.keys(relative);
9767
- for (var rk = 0; rk < rkeys.length; rk++) {
9768
- var rkey = rkeys[rk];
9769
- if (rkey !== 'protocol')
9770
- result[rkey] = relative[rkey];
9771
- }
9772
- //urlParse appends trailing / to urls like http://www.example.com
9773
- if (slashedProtocol[result.protocol] && result.hostname && !result.pathname) {
9774
- result.path = result.pathname = '/';
9775
- }
9776
- result.href = result.format();
9777
- return result;
9778
- }
9779
- if (relative.protocol && relative.protocol !== result.protocol) {
9780
- // if it's a known url protocol, then changing
9781
- // the protocol does weird things
9782
- // first, if it's not file:, then we MUST have a host,
9783
- // and if there was a path
9784
- // to begin with, then we MUST have a path.
9785
- // if it is file:, then the host is dropped,
9786
- // because that's known to be hostless.
9787
- // anything else is assumed to be absolute.
9788
- if (!slashedProtocol[relative.protocol]) {
9789
- var keys = Object.keys(relative);
9790
- for (var v = 0; v < keys.length; v++) {
9791
- var k = keys[v];
9792
- result[k] = relative[k];
9793
- }
9794
- result.href = result.format();
9795
- return result;
9796
- }
9797
- result.protocol = relative.protocol;
9798
- if (!relative.host && !hostlessProtocol[relative.protocol]) {
9799
- var relPath = (relative.pathname || '').split('/');
9800
- while (relPath.length && !(relative.host = relPath.shift()));
9801
- if (!relative.host)
9802
- relative.host = '';
9803
- if (!relative.hostname)
9804
- relative.hostname = '';
9805
- if (relPath[0] !== '')
9806
- relPath.unshift('');
9807
- if (relPath.length < 2)
9808
- relPath.unshift('');
9809
- result.pathname = relPath.join('/');
9810
- } else {
9811
- result.pathname = relative.pathname;
9812
- }
9813
- result.search = relative.search;
9814
- result.query = relative.query;
9815
- result.host = relative.host || '';
9816
- result.auth = relative.auth;
9817
- result.hostname = relative.hostname || relative.host;
9818
- result.port = relative.port;
9819
- // to support http.request
9820
- if (result.pathname || result.search) {
9821
- var p = result.pathname || '';
9822
- var s = result.search || '';
9823
- result.path = p + s;
9824
- }
9825
- result.slashes = result.slashes || relative.slashes;
9826
- result.href = result.format();
9827
- return result;
9828
- }
9829
- var isSourceAbs = result.pathname && result.pathname.charAt(0) === '/', isRelAbs = relative.host || relative.pathname && relative.pathname.charAt(0) === '/', mustEndAbs = isRelAbs || isSourceAbs || result.host && relative.pathname, removeAllDots = mustEndAbs, srcPath = result.pathname && result.pathname.split('/') || [], relPath = relative.pathname && relative.pathname.split('/') || [], psychotic = result.protocol && !slashedProtocol[result.protocol];
9830
- // if the url is a non-slashed url, then relative
9831
- // links like ../.. should be able
9832
- // to crawl up to the hostname, as well. This is strange.
9833
- // result.protocol has already been set by now.
9834
- // Later on, put the first path part into the host field.
9835
- if (psychotic) {
9836
- result.hostname = '';
9837
- result.port = null;
9838
- if (result.host) {
9839
- if (srcPath[0] === '')
9840
- srcPath[0] = result.host;
9841
- else
9842
- srcPath.unshift(result.host);
9843
- }
9844
- result.host = '';
9845
- if (relative.protocol) {
9846
- relative.hostname = null;
9847
- relative.port = null;
9848
- if (relative.host) {
9849
- if (relPath[0] === '')
9850
- relPath[0] = relative.host;
9851
- else
9852
- relPath.unshift(relative.host);
9853
- }
9854
- relative.host = null;
9855
- }
9856
- mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === '');
9857
- }
9858
- if (isRelAbs) {
9859
- // it's absolute.
9860
- result.host = relative.host || relative.host === '' ? relative.host : result.host;
9861
- result.hostname = relative.hostname || relative.hostname === '' ? relative.hostname : result.hostname;
9862
- result.search = relative.search;
9863
- result.query = relative.query;
9864
- srcPath = relPath; // fall through to the dot-handling below.
9865
- } else if (relPath.length) {
9866
- // it's relative
9867
- // throw away the existing file, and take the new path instead.
9868
- if (!srcPath)
9869
- srcPath = [];
9870
- srcPath.pop();
9871
- srcPath = srcPath.concat(relPath);
9872
- result.search = relative.search;
9873
- result.query = relative.query;
9874
- } else if (!util.isNullOrUndefined(relative.search)) {
9875
- // just pull out the search.
9876
- // like href='?foo'.
9877
- // Put this after the other two cases because it simplifies the booleans
9878
- if (psychotic) {
9879
- result.hostname = result.host = srcPath.shift();
9880
- //occationaly the auth can get stuck only in host
9881
- //this especially happens in cases like
9882
- //url.resolveObject('mailto:local1@domain1', 'local2@domain2')
9883
- var authInHost = result.host && result.host.indexOf('@') > 0 ? result.host.split('@') : false;
9884
- if (authInHost) {
9885
- result.auth = authInHost.shift();
9886
- result.host = result.hostname = authInHost.shift();
9887
- }
9888
- }
9889
- result.search = relative.search;
9890
- result.query = relative.query;
9891
- //to support http.request
9892
- if (!util.isNull(result.pathname) || !util.isNull(result.search)) {
9893
- result.path = (result.pathname ? result.pathname : '') + (result.search ? result.search : '');
9894
- }
9895
- result.href = result.format();
9896
- return result;
9897
- }
9898
- if (!srcPath.length) {
9899
- // no path at all. easy.
9900
- // we've already handled the other stuff above.
9901
- result.pathname = null;
9902
- //to support http.request
9903
- if (result.search) {
9904
- result.path = '/' + result.search;
9905
- } else {
9906
- result.path = null;
9907
- }
9908
- result.href = result.format();
9909
- return result;
9910
- }
9911
- // if a url ENDs in . or .., then it must get a trailing slash.
9912
- // however, if it ends in anything else non-slashy,
9913
- // then it must NOT get a trailing slash.
9914
- var last = srcPath.slice(-1)[0];
9915
- var hasTrailingSlash = (result.host || relative.host || srcPath.length > 1) && (last === '.' || last === '..') || last === '';
9916
- // strip single dots, resolve double dots to parent dir
9917
- // if the path tries to go above the root, `up` ends up > 0
9918
- var up = 0;
9919
- for (var i = srcPath.length; i >= 0; i--) {
9920
- last = srcPath[i];
9921
- if (last === '.') {
9922
- srcPath.splice(i, 1);
9923
- } else if (last === '..') {
9924
- srcPath.splice(i, 1);
9925
- up++;
9926
- } else if (up) {
9927
- srcPath.splice(i, 1);
9928
- up--;
9929
- }
9930
- }
9931
- // if the path is allowed to go above the root, restore leading ..s
9932
- if (!mustEndAbs && !removeAllDots) {
9933
- for (; up--; up) {
9934
- srcPath.unshift('..');
9935
- }
9936
- }
9937
- if (mustEndAbs && srcPath[0] !== '' && (!srcPath[0] || srcPath[0].charAt(0) !== '/')) {
9938
- srcPath.unshift('');
9939
- }
9940
- if (hasTrailingSlash && srcPath.join('/').substr(-1) !== '/') {
9941
- srcPath.push('');
9942
- }
9943
- var isAbsolute = srcPath[0] === '' || srcPath[0] && srcPath[0].charAt(0) === '/';
9944
- // put the host back
9945
- if (psychotic) {
9946
- result.hostname = result.host = isAbsolute ? '' : srcPath.length ? srcPath.shift() : '';
9947
- //occationaly the auth can get stuck only in host
9948
- //this especially happens in cases like
9949
- //url.resolveObject('mailto:local1@domain1', 'local2@domain2')
9950
- var authInHost = result.host && result.host.indexOf('@') > 0 ? result.host.split('@') : false;
9951
- if (authInHost) {
9952
- result.auth = authInHost.shift();
9953
- result.host = result.hostname = authInHost.shift();
9954
- }
9955
- }
9956
- mustEndAbs = mustEndAbs || result.host && srcPath.length;
9957
- if (mustEndAbs && !isAbsolute) {
9958
- srcPath.unshift('');
9959
- }
9960
- if (!srcPath.length) {
9961
- result.pathname = null;
9962
- result.path = null;
9963
- } else {
9964
- result.pathname = srcPath.join('/');
9965
- }
9966
- //to support request.http
9967
- if (!util.isNull(result.pathname) || !util.isNull(result.search)) {
9968
- result.path = (result.pathname ? result.pathname : '') + (result.search ? result.search : '');
9969
- }
9970
- result.auth = relative.auth || result.auth;
9971
- result.slashes = result.slashes || relative.slashes;
9972
- result.href = result.format();
9973
- return result;
9974
- };
9975
- Url.prototype.parseHost = function () {
9976
- var host = this.host;
9977
- var port = portPattern.exec(host);
9978
- if (port) {
9979
- port = port[0];
9980
- if (port !== ':') {
9981
- this.port = port.substr(1);
9982
- }
9983
- host = host.substr(0, host.length - port.length);
9984
- }
9985
- if (host)
9986
- this.hostname = host;
9987
- };
9988
-
9989
8790
  //
9990
8791
  function getPropertyReference(propertyName) {
9991
8792
  for (let i = 0; i < v8.layout.length; i++) {
@@ -10045,6 +8846,7 @@
10045
8846
  });
10046
8847
  }
10047
8848
 
8849
+ //
10048
8850
  function eachLayout(layer, callback) {
10049
8851
  for (const k in layer) {
10050
8852
  if (k.indexOf('layout') === 0) {
@@ -10142,7 +8944,7 @@
10142
8944
  });
10143
8945
  });
10144
8946
  function migrateFontstackURL(input) {
10145
- const inputParsed = url.parse(input);
8947
+ const inputParsed = new URL(input);
10146
8948
  const inputPathnameParts = inputParsed.pathname.split('/');
10147
8949
  if (inputParsed.protocol !== 'mapbox:') {
10148
8950
  return input;
@@ -10351,6 +9153,10 @@
10351
9153
  });
10352
9154
  }
10353
9155
 
9156
+ function getDefaultExportFromCjs (x) {
9157
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
9158
+ }
9159
+
10354
9160
  var csscolorparser = {};
10355
9161
 
10356
9162
  var parseCSSColor_1;
@@ -11549,8 +10355,6 @@
11549
10355
  var Color$1 = Color;
11550
10356
 
11551
10357
  //
11552
- // Flow type declarations for Intl cribbed from
11553
- // https://github.com/facebook/flow/issues/1270
11554
10358
  class Collator {
11555
10359
  constructor(caseSensitive, diacriticSensitive, locale) {
11556
10360
  if (caseSensitive)
@@ -12315,7 +11119,7 @@
12315
11119
  'Polygon'
12316
11120
  ];
12317
11121
  class EvaluationContext {
12318
- constructor(options) {
11122
+ constructor(scope, options) {
12319
11123
  this.globals = null;
12320
11124
  this.feature = null;
12321
11125
  this.featureState = null;
@@ -12325,6 +11129,7 @@
12325
11129
  this.canonical = null;
12326
11130
  this.featureTileCoord = null;
12327
11131
  this.featureDistanceData = null;
11132
+ this.scope = scope;
12328
11133
  this.options = options;
12329
11134
  }
12330
11135
  id() {
@@ -12424,7 +11229,7 @@
12424
11229
  overloadIndex++;
12425
11230
  // Use a fresh context for each attempted signature so that, if
12426
11231
  // we eventually succeed, we haven't polluted `context.errors`.
12427
- signatureContext = new ParsingContext$1(context.registry, context.path, null, context.scope, undefined, context.options);
11232
+ signatureContext = new ParsingContext$1(context.registry, context.path, null, context.scope, undefined, context._scope, context.options);
12428
11233
  // First parse all the args, potentially coercing to the
12429
11234
  // types expected by this overload.
12430
11235
  const parsedArgs = [];
@@ -14553,13 +13358,14 @@
14553
13358
  // implementations to infer argument types: Expression#parse() need not
14554
13359
  // check that the output type of the parsed expression matches
14555
13360
  // `expectedType`.
14556
- constructor(registry, path = [], expectedType, scope = new Scope$1(), errors = [], options) {
13361
+ constructor(registry, path = [], expectedType, scope = new Scope$1(), errors = [], _scope, options) {
14557
13362
  this.registry = registry;
14558
13363
  this.path = path;
14559
13364
  this.key = path.map(part => `[${ part }]`).join('');
14560
13365
  this.scope = scope;
14561
13366
  this.errors = errors;
14562
13367
  this.expectedType = expectedType;
13368
+ this._scope = _scope;
14563
13369
  this.options = options;
14564
13370
  }
14565
13371
  /**
@@ -14624,7 +13430,7 @@
14624
13430
  // parsed/compiled result. Expressions that expect an image should
14625
13431
  // not be resolved here so we can later get the available images.
14626
13432
  if (!(parsed instanceof Literal$1) && parsed.type.kind !== 'resolvedImage' && isConstant(parsed)) {
14627
- const ec = new EvaluationContext$1(this.options);
13433
+ const ec = new EvaluationContext$1(this._scope, this.options);
14628
13434
  try {
14629
13435
  parsed = new Literal$1(parsed.type, parsed.evaluate(ec));
14630
13436
  } catch (e) {
@@ -14658,7 +13464,7 @@
14658
13464
  concat(index, expectedType, bindings) {
14659
13465
  const path = typeof index === 'number' ? this.path.concat(index) : this.path;
14660
13466
  const scope = bindings ? this.scope.concat(bindings) : this.scope;
14661
- return new ParsingContext(this.registry, path, expectedType || null, scope, this.errors, this.options);
13467
+ return new ParsingContext(this.registry, path, expectedType || null, scope, this.errors, this._scope, this.options);
14662
13468
  }
14663
13469
  /**
14664
13470
  * Push a parsing (or type checking) error into the `this.errors`
@@ -16270,16 +15076,28 @@
16270
15076
  }
16271
15077
  return value;
16272
15078
  }
15079
+ const FQIDSeparator = '\x1F';
16273
15080
  function getConfig(ctx, key, scope) {
16274
- if (scope.length) {
16275
- key += `\u{1f}${ scope }`;
16276
- }
15081
+ // Create a fully qualified key from the requested scope
15082
+ // and the scope from the current evaluation context
15083
+ key = [
15084
+ key,
15085
+ scope,
15086
+ ctx.scope
15087
+ ].filter(Boolean).join(FQIDSeparator);
16277
15088
  const config = ctx.getConfig(key);
16278
15089
  if (!config)
16279
15090
  return null;
16280
15091
  const {type, value, values, minValue, maxValue, stepValue} = config;
16281
15092
  const defaultValue = config.default.evaluate(ctx);
16282
- let result = value ? value.evaluate(ctx) : defaultValue;
15093
+ let result = defaultValue;
15094
+ if (value) {
15095
+ // temporarily override scope to parent to evaluate config expressions passed from the parent
15096
+ const originalScope = ctx.scope;
15097
+ ctx.scope = (originalScope || '').split(FQIDSeparator).slice(1).join(FQIDSeparator);
15098
+ result = value.evaluate(ctx);
15099
+ ctx.scope = originalScope;
15100
+ }
16283
15101
  if (type)
16284
15102
  result = coerceValue(type, result);
16285
15103
  if (value !== undefined && result !== undefined && values && !values.includes(result)) {
@@ -16418,7 +15236,7 @@
16418
15236
  overloads: [
16419
15237
  [
16420
15238
  [StringType],
16421
- (ctx, [key]) => getConfig(ctx, key.evaluate(ctx), '')
15239
+ (ctx, [key]) => getConfig(ctx, key.evaluate(ctx))
16422
15240
  ],
16423
15241
  [
16424
15242
  [
@@ -16945,6 +15763,7 @@
16945
15763
  return !!spec.expression && spec.expression.interpolated;
16946
15764
  }
16947
15765
 
15766
+ //
16948
15767
  function isFunction(value) {
16949
15768
  return typeof value === 'object' && value !== null && !Array.isArray(value);
16950
15769
  }
@@ -17192,10 +16011,10 @@
17192
16011
  }
17193
16012
 
17194
16013
  class StyleExpression {
17195
- constructor(expression, propertySpec, options) {
16014
+ constructor(expression, propertySpec, scope, options) {
17196
16015
  this.expression = expression;
17197
16016
  this._warningHistory = {};
17198
- this._evaluator = new EvaluationContext$1(options);
16017
+ this._evaluator = new EvaluationContext$1(scope, options);
17199
16018
  this._defaultValue = propertySpec ? getDefaultValue(propertySpec) : null;
17200
16019
  this._enumValues = propertySpec && propertySpec.type === 'enum' ? propertySpec.values : null;
17201
16020
  }
@@ -17252,14 +16071,14 @@
17252
16071
  *
17253
16072
  * @private
17254
16073
  */
17255
- function createExpression(expression, propertySpec, options) {
17256
- const parser = new ParsingContext$1(definitions, [], propertySpec ? getExpectedType(propertySpec) : undefined, undefined, undefined, options);
16074
+ function createExpression(expression, propertySpec, scope, options) {
16075
+ const parser = new ParsingContext$1(definitions, [], propertySpec ? getExpectedType(propertySpec) : undefined, undefined, undefined, scope, options);
17257
16076
  // For string-valued properties, coerce to string at the top level rather than asserting.
17258
16077
  const parsed = parser.parse(expression, undefined, undefined, undefined, propertySpec && propertySpec.type === 'string' ? { typeAnnotation: 'coerce' } : undefined);
17259
16078
  if (!parsed) {
17260
16079
  return error(parser.errors);
17261
16080
  }
17262
- return success(new StyleExpression(parsed, propertySpec, options));
16081
+ return success(new StyleExpression(parsed, propertySpec, scope, options));
17263
16082
  }
17264
16083
  class ZoomConstantExpression {
17265
16084
  constructor(kind, expression, isLightConstant) {
@@ -17300,8 +16119,8 @@
17300
16119
  }
17301
16120
  }
17302
16121
  }
17303
- function createPropertyExpression(expression, propertySpec, options) {
17304
- expression = createExpression(expression, propertySpec, options);
16122
+ function createPropertyExpression(expression, propertySpec, scope, options) {
16123
+ expression = createExpression(expression, propertySpec, scope, options);
17305
16124
  if (expression.result === 'error') {
17306
16125
  return expression;
17307
16126
  }
@@ -17355,11 +16174,11 @@
17355
16174
  };
17356
16175
  }
17357
16176
  }
17358
- function normalizePropertyExpression(value, specification, options) {
16177
+ function normalizePropertyExpression(value, specification, scope, options) {
17359
16178
  if (isFunction(value)) {
17360
16179
  return new StylePropertyFunction(value, specification);
17361
16180
  } else if (isExpression(value) || Array.isArray(value) && value.length > 0) {
17362
- const expression = createPropertyExpression(value, specification, options);
16181
+ const expression = createPropertyExpression(value, specification, scope, options);
17363
16182
  if (expression.result === 'error') {
17364
16183
  // this should have been caught in validation
17365
16184
  throw new Error(expression.value.map(err => `${ err.key }: ${ err.message }`).join(', '));
@@ -18376,6 +17195,7 @@ ${ JSON.stringify(filterExp, null, 2) }
18376
17195
  return style;
18377
17196
  }
18378
17197
 
17198
+ //
18379
17199
  /**
18380
17200
  * Migrate a Mapbox GL Style to the latest version.
18381
17201
  *
@@ -18405,6 +17225,7 @@ ${ JSON.stringify(filterExp, null, 2) }
18405
17225
  return style;
18406
17226
  }
18407
17227
 
17228
+ //
18408
17229
  function composite (style) {
18409
17230
  const styleIDs = [];
18410
17231
  const sourceIDs = [];
@@ -19963,7 +18784,7 @@ ${ JSON.stringify(filterExp, null, 2) }
19963
18784
  'raster-dem'
19964
18785
  ].includes(type)) {
19965
18786
  if (!value.url && !value.tiles) {
19966
- errors.push(new ValidationError(key, value, 'Either "url" or "tiles" is required.'));
18787
+ errors.push(new ValidationWarning(key, value, 'Either "url" or "tiles" is required.'));
19967
18788
  }
19968
18789
  }
19969
18790
  switch (type) {
@@ -21530,6 +20351,7 @@ ${ JSON.stringify(filterExp, null, 2) }
21530
20351
 
21531
20352
  var jsonlint = /*@__PURE__*/getDefaultExportFromCjs(jsonlint$1);
21532
20353
 
20354
+ //
21533
20355
  function readStyle(style) {
21534
20356
  if (style instanceof String || typeof style === 'string' || style instanceof Buffer) {
21535
20357
  try {