@mapbox/mapbox-gl-style-spec 14.2.0-beta.1 → 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.es.js CHANGED
@@ -8781,1177 +8781,6 @@ function format(style, space = 2) {
8781
8781
  return stringify(style, { indent: space });
8782
8782
  }
8783
8783
 
8784
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
8785
-
8786
- function getDefaultExportFromCjs (x) {
8787
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
8788
- }
8789
-
8790
- var url = {};
8791
-
8792
- var punycode$1 = {exports: {}};
8793
-
8794
- /*! https://mths.be/punycode v1.3.2 by @mathias */
8795
- punycode$1.exports;
8796
-
8797
- (function (module, exports) {
8798
- (function (root) {
8799
- /** Detect free variables */
8800
- var freeExports = exports && !exports.nodeType && exports;
8801
- var freeModule = module && !module.nodeType && module;
8802
- var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal;
8803
- if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal) {
8804
- root = freeGlobal;
8805
- }
8806
- /**
8807
- * The `punycode` object.
8808
- * @name punycode
8809
- * @type Object
8810
- */
8811
- var punycode,
8812
- /** Highest positive signed 32-bit float value */
8813
- maxInt = 2147483647,
8814
- // aka. 0x7FFFFFFF or 2^31-1
8815
- /** Bootstring parameters */
8816
- base = 36, tMin = 1, tMax = 26, skew = 38, damp = 700, initialBias = 72, initialN = 128,
8817
- // 0x80
8818
- delimiter = '-',
8819
- // '\x2D'
8820
- /** Regular expressions */
8821
- regexPunycode = /^xn--/, regexNonASCII = /[^\x20-\x7E]/,
8822
- // unprintable ASCII chars + non-ASCII chars
8823
- regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g,
8824
- // RFC 3490 separators
8825
- /** Error messages */
8826
- errors = {
8827
- 'overflow': 'Overflow: input needs wider integers to process',
8828
- 'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
8829
- 'invalid-input': 'Invalid input'
8830
- },
8831
- /** Convenience shortcuts */
8832
- baseMinusTMin = base - tMin, floor = Math.floor, stringFromCharCode = String.fromCharCode,
8833
- /** Temporary variable */
8834
- key;
8835
- /*--------------------------------------------------------------------------*/
8836
- /**
8837
- * A generic error utility function.
8838
- * @private
8839
- * @param {String} type The error type.
8840
- * @returns {Error} Throws a `RangeError` with the applicable error message.
8841
- */
8842
- function error(type) {
8843
- throw RangeError(errors[type]);
8844
- }
8845
- /**
8846
- * A generic `Array#map` utility function.
8847
- * @private
8848
- * @param {Array} array The array to iterate over.
8849
- * @param {Function} callback The function that gets called for every array
8850
- * item.
8851
- * @returns {Array} A new array of values returned by the callback function.
8852
- */
8853
- function map(array, fn) {
8854
- var length = array.length;
8855
- var result = [];
8856
- while (length--) {
8857
- result[length] = fn(array[length]);
8858
- }
8859
- return result;
8860
- }
8861
- /**
8862
- * A simple `Array#map`-like wrapper to work with domain name strings or email
8863
- * addresses.
8864
- * @private
8865
- * @param {String} domain The domain name or email address.
8866
- * @param {Function} callback The function that gets called for every
8867
- * character.
8868
- * @returns {Array} A new string of characters returned by the callback
8869
- * function.
8870
- */
8871
- function mapDomain(string, fn) {
8872
- var parts = string.split('@');
8873
- var result = '';
8874
- if (parts.length > 1) {
8875
- // In email addresses, only the domain name should be punycoded. Leave
8876
- // the local part (i.e. everything up to `@`) intact.
8877
- result = parts[0] + '@';
8878
- string = parts[1];
8879
- }
8880
- // Avoid `split(regex)` for IE8 compatibility. See #17.
8881
- string = string.replace(regexSeparators, '.');
8882
- var labels = string.split('.');
8883
- var encoded = map(labels, fn).join('.');
8884
- return result + encoded;
8885
- }
8886
- /**
8887
- * Creates an array containing the numeric code points of each Unicode
8888
- * character in the string. While JavaScript uses UCS-2 internally,
8889
- * this function will convert a pair of surrogate halves (each of which
8890
- * UCS-2 exposes as separate characters) into a single code point,
8891
- * matching UTF-16.
8892
- * @see `punycode.ucs2.encode`
8893
- * @see <https://mathiasbynens.be/notes/javascript-encoding>
8894
- * @memberOf punycode.ucs2
8895
- * @name decode
8896
- * @param {String} string The Unicode input string (UCS-2).
8897
- * @returns {Array} The new array of code points.
8898
- */
8899
- function ucs2decode(string) {
8900
- var output = [], counter = 0, length = string.length, value, extra;
8901
- while (counter < length) {
8902
- value = string.charCodeAt(counter++);
8903
- if (value >= 55296 && value <= 56319 && counter < length) {
8904
- // high surrogate, and there is a next character
8905
- extra = string.charCodeAt(counter++);
8906
- if ((extra & 64512) == 56320) {
8907
- // low surrogate
8908
- output.push(((value & 1023) << 10) + (extra & 1023) + 65536);
8909
- } else {
8910
- // unmatched surrogate; only append this code unit, in case the next
8911
- // code unit is the high surrogate of a surrogate pair
8912
- output.push(value);
8913
- counter--;
8914
- }
8915
- } else {
8916
- output.push(value);
8917
- }
8918
- }
8919
- return output;
8920
- }
8921
- /**
8922
- * Creates a string based on an array of numeric code points.
8923
- * @see `punycode.ucs2.decode`
8924
- * @memberOf punycode.ucs2
8925
- * @name encode
8926
- * @param {Array} codePoints The array of numeric code points.
8927
- * @returns {String} The new Unicode string (UCS-2).
8928
- */
8929
- function ucs2encode(array) {
8930
- return map(array, function (value) {
8931
- var output = '';
8932
- if (value > 65535) {
8933
- value -= 65536;
8934
- output += stringFromCharCode(value >>> 10 & 1023 | 55296);
8935
- value = 56320 | value & 1023;
8936
- }
8937
- output += stringFromCharCode(value);
8938
- return output;
8939
- }).join('');
8940
- }
8941
- /**
8942
- * Converts a basic code point into a digit/integer.
8943
- * @see `digitToBasic()`
8944
- * @private
8945
- * @param {Number} codePoint The basic numeric code point value.
8946
- * @returns {Number} The numeric value of a basic code point (for use in
8947
- * representing integers) in the range `0` to `base - 1`, or `base` if
8948
- * the code point does not represent a value.
8949
- */
8950
- function basicToDigit(codePoint) {
8951
- if (codePoint - 48 < 10) {
8952
- return codePoint - 22;
8953
- }
8954
- if (codePoint - 65 < 26) {
8955
- return codePoint - 65;
8956
- }
8957
- if (codePoint - 97 < 26) {
8958
- return codePoint - 97;
8959
- }
8960
- return base;
8961
- }
8962
- /**
8963
- * Converts a digit/integer into a basic code point.
8964
- * @see `basicToDigit()`
8965
- * @private
8966
- * @param {Number} digit The numeric value of a basic code point.
8967
- * @returns {Number} The basic code point whose value (when used for
8968
- * representing integers) is `digit`, which needs to be in the range
8969
- * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
8970
- * used; else, the lowercase form is used. The behavior is undefined
8971
- * if `flag` is non-zero and `digit` has no uppercase form.
8972
- */
8973
- function digitToBasic(digit, flag) {
8974
- // 0..25 map to ASCII a..z or A..Z
8975
- // 26..35 map to ASCII 0..9
8976
- return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
8977
- }
8978
- /**
8979
- * Bias adaptation function as per section 3.4 of RFC 3492.
8980
- * http://tools.ietf.org/html/rfc3492#section-3.4
8981
- * @private
8982
- */
8983
- function adapt(delta, numPoints, firstTime) {
8984
- var k = 0;
8985
- delta = firstTime ? floor(delta / damp) : delta >> 1;
8986
- delta += floor(delta / numPoints);
8987
- for (; delta > baseMinusTMin * tMax >> 1; k += base) {
8988
- delta = floor(delta / baseMinusTMin);
8989
- }
8990
- return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
8991
- }
8992
- /**
8993
- * Converts a Punycode string of ASCII-only symbols to a string of Unicode
8994
- * symbols.
8995
- * @memberOf punycode
8996
- * @param {String} input The Punycode string of ASCII-only symbols.
8997
- * @returns {String} The resulting string of Unicode symbols.
8998
- */
8999
- function decode(input) {
9000
- // Don't use UCS-2
9001
- var output = [], inputLength = input.length, out, i = 0, n = initialN, bias = initialBias, basic, j, index, oldi, w, k, digit, t,
9002
- /** Cached calculation results */
9003
- baseMinusT;
9004
- // Handle the basic code points: let `basic` be the number of input code
9005
- // points before the last delimiter, or `0` if there is none, then copy
9006
- // the first basic code points to the output.
9007
- basic = input.lastIndexOf(delimiter);
9008
- if (basic < 0) {
9009
- basic = 0;
9010
- }
9011
- for (j = 0; j < basic; ++j) {
9012
- // if it's not a basic code point
9013
- if (input.charCodeAt(j) >= 128) {
9014
- error('not-basic');
9015
- }
9016
- output.push(input.charCodeAt(j));
9017
- }
9018
- // Main decoding loop: start just after the last delimiter if any basic code
9019
- // points were copied; start at the beginning otherwise.
9020
- for (index = basic > 0 ? basic + 1 : 0; index < inputLength;) {
9021
- // `index` is the index of the next character to be consumed.
9022
- // Decode a generalized variable-length integer into `delta`,
9023
- // which gets added to `i`. The overflow checking is easier
9024
- // if we increase `i` as we go, then subtract off its starting
9025
- // value at the end to obtain `delta`.
9026
- for (oldi = i, w = 1, k = base;; k += base) {
9027
- if (index >= inputLength) {
9028
- error('invalid-input');
9029
- }
9030
- digit = basicToDigit(input.charCodeAt(index++));
9031
- if (digit >= base || digit > floor((maxInt - i) / w)) {
9032
- error('overflow');
9033
- }
9034
- i += digit * w;
9035
- t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
9036
- if (digit < t) {
9037
- break;
9038
- }
9039
- baseMinusT = base - t;
9040
- if (w > floor(maxInt / baseMinusT)) {
9041
- error('overflow');
9042
- }
9043
- w *= baseMinusT;
9044
- }
9045
- out = output.length + 1;
9046
- bias = adapt(i - oldi, out, oldi == 0);
9047
- // `i` was supposed to wrap around from `out` to `0`,
9048
- // incrementing `n` each time, so we'll fix that now:
9049
- if (floor(i / out) > maxInt - n) {
9050
- error('overflow');
9051
- }
9052
- n += floor(i / out);
9053
- i %= out;
9054
- // Insert `n` at position `i` of the output
9055
- output.splice(i++, 0, n);
9056
- }
9057
- return ucs2encode(output);
9058
- }
9059
- /**
9060
- * Converts a string of Unicode symbols (e.g. a domain name label) to a
9061
- * Punycode string of ASCII-only symbols.
9062
- * @memberOf punycode
9063
- * @param {String} input The string of Unicode symbols.
9064
- * @returns {String} The resulting Punycode string of ASCII-only symbols.
9065
- */
9066
- function encode(input) {
9067
- var n, delta, handledCPCount, basicLength, bias, j, m, q, k, t, currentValue, output = [],
9068
- /** `inputLength` will hold the number of code points in `input`. */
9069
- inputLength,
9070
- /** Cached calculation results */
9071
- handledCPCountPlusOne, baseMinusT, qMinusT;
9072
- // Convert the input in UCS-2 to Unicode
9073
- input = ucs2decode(input);
9074
- // Cache the length
9075
- inputLength = input.length;
9076
- // Initialize the state
9077
- n = initialN;
9078
- delta = 0;
9079
- bias = initialBias;
9080
- // Handle the basic code points
9081
- for (j = 0; j < inputLength; ++j) {
9082
- currentValue = input[j];
9083
- if (currentValue < 128) {
9084
- output.push(stringFromCharCode(currentValue));
9085
- }
9086
- }
9087
- handledCPCount = basicLength = output.length;
9088
- // `handledCPCount` is the number of code points that have been handled;
9089
- // `basicLength` is the number of basic code points.
9090
- // Finish the basic string - if it is not empty - with a delimiter
9091
- if (basicLength) {
9092
- output.push(delimiter);
9093
- }
9094
- // Main encoding loop:
9095
- while (handledCPCount < inputLength) {
9096
- // All non-basic code points < n have been handled already. Find the next
9097
- // larger one:
9098
- for (m = maxInt, j = 0; j < inputLength; ++j) {
9099
- currentValue = input[j];
9100
- if (currentValue >= n && currentValue < m) {
9101
- m = currentValue;
9102
- }
9103
- }
9104
- // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
9105
- // but guard against overflow
9106
- handledCPCountPlusOne = handledCPCount + 1;
9107
- if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
9108
- error('overflow');
9109
- }
9110
- delta += (m - n) * handledCPCountPlusOne;
9111
- n = m;
9112
- for (j = 0; j < inputLength; ++j) {
9113
- currentValue = input[j];
9114
- if (currentValue < n && ++delta > maxInt) {
9115
- error('overflow');
9116
- }
9117
- if (currentValue == n) {
9118
- // Represent delta as a generalized variable-length integer
9119
- for (q = delta, k = base;; k += base) {
9120
- t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
9121
- if (q < t) {
9122
- break;
9123
- }
9124
- qMinusT = q - t;
9125
- baseMinusT = base - t;
9126
- output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)));
9127
- q = floor(qMinusT / baseMinusT);
9128
- }
9129
- output.push(stringFromCharCode(digitToBasic(q, 0)));
9130
- bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
9131
- delta = 0;
9132
- ++handledCPCount;
9133
- }
9134
- }
9135
- ++delta;
9136
- ++n;
9137
- }
9138
- return output.join('');
9139
- }
9140
- /**
9141
- * Converts a Punycode string representing a domain name or an email address
9142
- * to Unicode. Only the Punycoded parts of the input will be converted, i.e.
9143
- * it doesn't matter if you call it on a string that has already been
9144
- * converted to Unicode.
9145
- * @memberOf punycode
9146
- * @param {String} input The Punycoded domain name or email address to
9147
- * convert to Unicode.
9148
- * @returns {String} The Unicode representation of the given Punycode
9149
- * string.
9150
- */
9151
- function toUnicode(input) {
9152
- return mapDomain(input, function (string) {
9153
- return regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string;
9154
- });
9155
- }
9156
- /**
9157
- * Converts a Unicode string representing a domain name or an email address to
9158
- * Punycode. Only the non-ASCII parts of the domain name will be converted,
9159
- * i.e. it doesn't matter if you call it with a domain that's already in
9160
- * ASCII.
9161
- * @memberOf punycode
9162
- * @param {String} input The domain name or email address to convert, as a
9163
- * Unicode string.
9164
- * @returns {String} The Punycode representation of the given domain name or
9165
- * email address.
9166
- */
9167
- function toASCII(input) {
9168
- return mapDomain(input, function (string) {
9169
- return regexNonASCII.test(string) ? 'xn--' + encode(string) : string;
9170
- });
9171
- }
9172
- /*--------------------------------------------------------------------------*/
9173
- /** Define the public API */
9174
- punycode = {
9175
- /**
9176
- * A string representing the current Punycode.js version number.
9177
- * @memberOf punycode
9178
- * @type String
9179
- */
9180
- 'version': '1.3.2',
9181
- /**
9182
- * An object of methods to convert from JavaScript's internal character
9183
- * representation (UCS-2) to Unicode code points, and back.
9184
- * @see <https://mathiasbynens.be/notes/javascript-encoding>
9185
- * @memberOf punycode
9186
- * @type Object
9187
- */
9188
- 'ucs2': {
9189
- 'decode': ucs2decode,
9190
- 'encode': ucs2encode
9191
- },
9192
- 'decode': decode,
9193
- 'encode': encode,
9194
- 'toASCII': toASCII,
9195
- 'toUnicode': toUnicode
9196
- };
9197
- /** Expose `punycode` */
9198
- // Some AMD build optimizers, like r.js, check for specific condition patterns
9199
- // like the following:
9200
- if (freeExports && freeModule) {
9201
- if (module.exports == freeExports) {
9202
- // in Node.js or RingoJS v0.8.0+
9203
- freeModule.exports = punycode;
9204
- } else {
9205
- // in Narwhal or RingoJS v0.7.0-
9206
- for (key in punycode) {
9207
- punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);
9208
- }
9209
- }
9210
- } else {
9211
- // in Rhino or a web browser
9212
- root.punycode = punycode;
9213
- }
9214
- }(commonjsGlobal));
9215
- } (punycode$1, punycode$1.exports));
9216
-
9217
- var punycodeExports = punycode$1.exports;
9218
-
9219
- var util$1 = {
9220
- isString: function (arg) {
9221
- return typeof arg === 'string';
9222
- },
9223
- isObject: function (arg) {
9224
- return typeof arg === 'object' && arg !== null;
9225
- },
9226
- isNull: function (arg) {
9227
- return arg === null;
9228
- },
9229
- isNullOrUndefined: function (arg) {
9230
- return arg == null;
9231
- }
9232
- };
9233
-
9234
- var querystring$1 = {};
9235
-
9236
- // If obj.hasOwnProperty has been overridden, then calling
9237
- // obj.hasOwnProperty(prop) will break.
9238
- // See: https://github.com/joyent/node/issues/1707
9239
- function hasOwnProperty(obj, prop) {
9240
- return Object.prototype.hasOwnProperty.call(obj, prop);
9241
- }
9242
- var decode = function (qs, sep, eq, options) {
9243
- sep = sep || '&';
9244
- eq = eq || '=';
9245
- var obj = {};
9246
- if (typeof qs !== 'string' || qs.length === 0) {
9247
- return obj;
9248
- }
9249
- var regexp = /\+/g;
9250
- qs = qs.split(sep);
9251
- var maxKeys = 1000;
9252
- if (options && typeof options.maxKeys === 'number') {
9253
- maxKeys = options.maxKeys;
9254
- }
9255
- var len = qs.length;
9256
- // maxKeys <= 0 means that we should not limit keys count
9257
- if (maxKeys > 0 && len > maxKeys) {
9258
- len = maxKeys;
9259
- }
9260
- for (var i = 0; i < len; ++i) {
9261
- var x = qs[i].replace(regexp, '%20'), idx = x.indexOf(eq), kstr, vstr, k, v;
9262
- if (idx >= 0) {
9263
- kstr = x.substr(0, idx);
9264
- vstr = x.substr(idx + 1);
9265
- } else {
9266
- kstr = x;
9267
- vstr = '';
9268
- }
9269
- k = decodeURIComponent(kstr);
9270
- v = decodeURIComponent(vstr);
9271
- if (!hasOwnProperty(obj, k)) {
9272
- obj[k] = v;
9273
- } else if (Array.isArray(obj[k])) {
9274
- obj[k].push(v);
9275
- } else {
9276
- obj[k] = [
9277
- obj[k],
9278
- v
9279
- ];
9280
- }
9281
- }
9282
- return obj;
9283
- };
9284
-
9285
- var stringifyPrimitive = function (v) {
9286
- switch (typeof v) {
9287
- case 'string':
9288
- return v;
9289
- case 'boolean':
9290
- return v ? 'true' : 'false';
9291
- case 'number':
9292
- return isFinite(v) ? v : '';
9293
- default:
9294
- return '';
9295
- }
9296
- };
9297
- var encode = function (obj, sep, eq, name) {
9298
- sep = sep || '&';
9299
- eq = eq || '=';
9300
- if (obj === null) {
9301
- obj = undefined;
9302
- }
9303
- if (typeof obj === 'object') {
9304
- return Object.keys(obj).map(function (k) {
9305
- var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;
9306
- if (Array.isArray(obj[k])) {
9307
- return obj[k].map(function (v) {
9308
- return ks + encodeURIComponent(stringifyPrimitive(v));
9309
- }).join(sep);
9310
- } else {
9311
- return ks + encodeURIComponent(stringifyPrimitive(obj[k]));
9312
- }
9313
- }).join(sep);
9314
- }
9315
- if (!name)
9316
- return '';
9317
- return encodeURIComponent(stringifyPrimitive(name)) + eq + encodeURIComponent(stringifyPrimitive(obj));
9318
- };
9319
-
9320
- querystring$1.decode = querystring$1.parse = decode;
9321
- querystring$1.encode = querystring$1.stringify = encode;
9322
-
9323
- var punycode = punycodeExports;
9324
- var util = util$1;
9325
- url.parse = urlParse;
9326
- url.resolve = urlResolve;
9327
- url.resolveObject = urlResolveObject;
9328
- url.format = urlFormat;
9329
- url.Url = Url;
9330
- function Url() {
9331
- this.protocol = null;
9332
- this.slashes = null;
9333
- this.auth = null;
9334
- this.host = null;
9335
- this.port = null;
9336
- this.hostname = null;
9337
- this.hash = null;
9338
- this.search = null;
9339
- this.query = null;
9340
- this.pathname = null;
9341
- this.path = null;
9342
- this.href = null;
9343
- }
9344
- // Reference: RFC 3986, RFC 1808, RFC 2396
9345
- // define these here so at least they only have to be
9346
- // compiled once on the first module load.
9347
- var protocolPattern = /^([a-z0-9.+-]+:)/i, portPattern = /:[0-9]*$/,
9348
- // Special case for a simple path URL
9349
- simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,
9350
- // RFC 2396: characters reserved for delimiting URLs.
9351
- // We actually just auto-escape these.
9352
- delims = [
9353
- '<',
9354
- '>',
9355
- '"',
9356
- '`',
9357
- ' ',
9358
- '\r',
9359
- '\n',
9360
- '\t'
9361
- ],
9362
- // RFC 2396: characters not allowed for various reasons.
9363
- unwise = [
9364
- '{',
9365
- '}',
9366
- '|',
9367
- '\\',
9368
- '^',
9369
- '`'
9370
- ].concat(delims),
9371
- // Allowed by RFCs, but cause of XSS attacks. Always escape these.
9372
- autoEscape = ['\''].concat(unwise),
9373
- // Characters that are never ever allowed in a hostname.
9374
- // Note that any invalid chars are also handled, but these
9375
- // are the ones that are *expected* to be seen, so we fast-path
9376
- // them.
9377
- nonHostChars = [
9378
- '%',
9379
- '/',
9380
- '?',
9381
- ';',
9382
- '#'
9383
- ].concat(autoEscape), hostEndingChars = [
9384
- '/',
9385
- '?',
9386
- '#'
9387
- ], hostnameMaxLen = 255, hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/, hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,
9388
- // protocols that can allow "unsafe" and "unwise" chars.
9389
- unsafeProtocol = {
9390
- 'javascript': true,
9391
- 'javascript:': true
9392
- },
9393
- // protocols that never have a hostname.
9394
- hostlessProtocol = {
9395
- 'javascript': true,
9396
- 'javascript:': true
9397
- },
9398
- // protocols that always contain a // bit.
9399
- slashedProtocol = {
9400
- 'http': true,
9401
- 'https': true,
9402
- 'ftp': true,
9403
- 'gopher': true,
9404
- 'file': true,
9405
- 'http:': true,
9406
- 'https:': true,
9407
- 'ftp:': true,
9408
- 'gopher:': true,
9409
- 'file:': true
9410
- }, querystring = querystring$1;
9411
- function urlParse(url, parseQueryString, slashesDenoteHost) {
9412
- if (url && util.isObject(url) && url instanceof Url)
9413
- return url;
9414
- var u = new Url();
9415
- u.parse(url, parseQueryString, slashesDenoteHost);
9416
- return u;
9417
- }
9418
- Url.prototype.parse = function (url, parseQueryString, slashesDenoteHost) {
9419
- if (!util.isString(url)) {
9420
- throw new TypeError('Parameter \'url\' must be a string, not ' + typeof url);
9421
- }
9422
- // Copy chrome, IE, opera backslash-handling behavior.
9423
- // Back slashes before the query string get converted to forward slashes
9424
- // See: https://code.google.com/p/chromium/issues/detail?id=25916
9425
- var queryIndex = url.indexOf('?'), splitter = queryIndex !== -1 && queryIndex < url.indexOf('#') ? '?' : '#', uSplit = url.split(splitter), slashRegex = /\\/g;
9426
- uSplit[0] = uSplit[0].replace(slashRegex, '/');
9427
- url = uSplit.join(splitter);
9428
- var rest = url;
9429
- // trim before proceeding.
9430
- // This is to support parse stuff like " http://foo.com \n"
9431
- rest = rest.trim();
9432
- if (!slashesDenoteHost && url.split('#').length === 1) {
9433
- // Try fast path regexp
9434
- var simplePath = simplePathPattern.exec(rest);
9435
- if (simplePath) {
9436
- this.path = rest;
9437
- this.href = rest;
9438
- this.pathname = simplePath[1];
9439
- if (simplePath[2]) {
9440
- this.search = simplePath[2];
9441
- if (parseQueryString) {
9442
- this.query = querystring.parse(this.search.substr(1));
9443
- } else {
9444
- this.query = this.search.substr(1);
9445
- }
9446
- } else if (parseQueryString) {
9447
- this.search = '';
9448
- this.query = {};
9449
- }
9450
- return this;
9451
- }
9452
- }
9453
- var proto = protocolPattern.exec(rest);
9454
- if (proto) {
9455
- proto = proto[0];
9456
- var lowerProto = proto.toLowerCase();
9457
- this.protocol = lowerProto;
9458
- rest = rest.substr(proto.length);
9459
- }
9460
- // figure out if it's got a host
9461
- // user@server is *always* interpreted as a hostname, and url
9462
- // resolution will treat //foo/bar as host=foo,path=bar because that's
9463
- // how the browser resolves relative URLs.
9464
- if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) {
9465
- var slashes = rest.substr(0, 2) === '//';
9466
- if (slashes && !(proto && hostlessProtocol[proto])) {
9467
- rest = rest.substr(2);
9468
- this.slashes = true;
9469
- }
9470
- }
9471
- if (!hostlessProtocol[proto] && (slashes || proto && !slashedProtocol[proto])) {
9472
- // there's a hostname.
9473
- // the first instance of /, ?, ;, or # ends the host.
9474
- //
9475
- // If there is an @ in the hostname, then non-host chars *are* allowed
9476
- // to the left of the last @ sign, unless some host-ending character
9477
- // comes *before* the @-sign.
9478
- // URLs are obnoxious.
9479
- //
9480
- // ex:
9481
- // http://a@b@c/ => user:a@b host:c
9482
- // http://a@b?@c => user:a host:c path:/?@c
9483
- // v0.12 TODO(isaacs): This is not quite how Chrome does things.
9484
- // Review our test case against browsers more comprehensively.
9485
- // find the first instance of any hostEndingChars
9486
- var hostEnd = -1;
9487
- for (var i = 0; i < hostEndingChars.length; i++) {
9488
- var hec = rest.indexOf(hostEndingChars[i]);
9489
- if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))
9490
- hostEnd = hec;
9491
- }
9492
- // at this point, either we have an explicit point where the
9493
- // auth portion cannot go past, or the last @ char is the decider.
9494
- var auth, atSign;
9495
- if (hostEnd === -1) {
9496
- // atSign can be anywhere.
9497
- atSign = rest.lastIndexOf('@');
9498
- } else {
9499
- // atSign must be in auth portion.
9500
- // http://a@b/c@d => host:b auth:a path:/c@d
9501
- atSign = rest.lastIndexOf('@', hostEnd);
9502
- }
9503
- // Now we have a portion which is definitely the auth.
9504
- // Pull that off.
9505
- if (atSign !== -1) {
9506
- auth = rest.slice(0, atSign);
9507
- rest = rest.slice(atSign + 1);
9508
- this.auth = decodeURIComponent(auth);
9509
- }
9510
- // the host is the remaining to the left of the first non-host char
9511
- hostEnd = -1;
9512
- for (var i = 0; i < nonHostChars.length; i++) {
9513
- var hec = rest.indexOf(nonHostChars[i]);
9514
- if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))
9515
- hostEnd = hec;
9516
- }
9517
- // if we still have not hit it, then the entire thing is a host.
9518
- if (hostEnd === -1)
9519
- hostEnd = rest.length;
9520
- this.host = rest.slice(0, hostEnd);
9521
- rest = rest.slice(hostEnd);
9522
- // pull out port.
9523
- this.parseHost();
9524
- // we've indicated that there is a hostname,
9525
- // so even if it's empty, it has to be present.
9526
- this.hostname = this.hostname || '';
9527
- // if hostname begins with [ and ends with ]
9528
- // assume that it's an IPv6 address.
9529
- var ipv6Hostname = this.hostname[0] === '[' && this.hostname[this.hostname.length - 1] === ']';
9530
- // validate a little.
9531
- if (!ipv6Hostname) {
9532
- var hostparts = this.hostname.split(/\./);
9533
- for (var i = 0, l = hostparts.length; i < l; i++) {
9534
- var part = hostparts[i];
9535
- if (!part)
9536
- continue;
9537
- if (!part.match(hostnamePartPattern)) {
9538
- var newpart = '';
9539
- for (var j = 0, k = part.length; j < k; j++) {
9540
- if (part.charCodeAt(j) > 127) {
9541
- // we replace non-ASCII char with a temporary placeholder
9542
- // we need this to make sure size of hostname is not
9543
- // broken by replacing non-ASCII by nothing
9544
- newpart += 'x';
9545
- } else {
9546
- newpart += part[j];
9547
- }
9548
- }
9549
- // we test again with ASCII char only
9550
- if (!newpart.match(hostnamePartPattern)) {
9551
- var validParts = hostparts.slice(0, i);
9552
- var notHost = hostparts.slice(i + 1);
9553
- var bit = part.match(hostnamePartStart);
9554
- if (bit) {
9555
- validParts.push(bit[1]);
9556
- notHost.unshift(bit[2]);
9557
- }
9558
- if (notHost.length) {
9559
- rest = '/' + notHost.join('.') + rest;
9560
- }
9561
- this.hostname = validParts.join('.');
9562
- break;
9563
- }
9564
- }
9565
- }
9566
- }
9567
- if (this.hostname.length > hostnameMaxLen) {
9568
- this.hostname = '';
9569
- } else {
9570
- // hostnames are always lower case.
9571
- this.hostname = this.hostname.toLowerCase();
9572
- }
9573
- if (!ipv6Hostname) {
9574
- // IDNA Support: Returns a punycoded representation of "domain".
9575
- // It only converts parts of the domain name that
9576
- // have non-ASCII characters, i.e. it doesn't matter if
9577
- // you call it with a domain that already is ASCII-only.
9578
- this.hostname = punycode.toASCII(this.hostname);
9579
- }
9580
- var p = this.port ? ':' + this.port : '';
9581
- var h = this.hostname || '';
9582
- this.host = h + p;
9583
- this.href += this.host;
9584
- // strip [ and ] from the hostname
9585
- // the host field still retains them, though
9586
- if (ipv6Hostname) {
9587
- this.hostname = this.hostname.substr(1, this.hostname.length - 2);
9588
- if (rest[0] !== '/') {
9589
- rest = '/' + rest;
9590
- }
9591
- }
9592
- }
9593
- // now rest is set to the post-host stuff.
9594
- // chop off any delim chars.
9595
- if (!unsafeProtocol[lowerProto]) {
9596
- // First, make 100% sure that any "autoEscape" chars get
9597
- // escaped, even if encodeURIComponent doesn't think they
9598
- // need to be.
9599
- for (var i = 0, l = autoEscape.length; i < l; i++) {
9600
- var ae = autoEscape[i];
9601
- if (rest.indexOf(ae) === -1)
9602
- continue;
9603
- var esc = encodeURIComponent(ae);
9604
- if (esc === ae) {
9605
- esc = escape(ae);
9606
- }
9607
- rest = rest.split(ae).join(esc);
9608
- }
9609
- }
9610
- // chop off from the tail first.
9611
- var hash = rest.indexOf('#');
9612
- if (hash !== -1) {
9613
- // got a fragment string.
9614
- this.hash = rest.substr(hash);
9615
- rest = rest.slice(0, hash);
9616
- }
9617
- var qm = rest.indexOf('?');
9618
- if (qm !== -1) {
9619
- this.search = rest.substr(qm);
9620
- this.query = rest.substr(qm + 1);
9621
- if (parseQueryString) {
9622
- this.query = querystring.parse(this.query);
9623
- }
9624
- rest = rest.slice(0, qm);
9625
- } else if (parseQueryString) {
9626
- // no query string, but parseQueryString still requested
9627
- this.search = '';
9628
- this.query = {};
9629
- }
9630
- if (rest)
9631
- this.pathname = rest;
9632
- if (slashedProtocol[lowerProto] && this.hostname && !this.pathname) {
9633
- this.pathname = '/';
9634
- }
9635
- //to support http.request
9636
- if (this.pathname || this.search) {
9637
- var p = this.pathname || '';
9638
- var s = this.search || '';
9639
- this.path = p + s;
9640
- }
9641
- // finally, reconstruct the href based on what has been validated.
9642
- this.href = this.format();
9643
- return this;
9644
- };
9645
- // format a parsed object into a url string
9646
- function urlFormat(obj) {
9647
- // ensure it's an object, and not a string url.
9648
- // If it's an obj, this is a no-op.
9649
- // this way, you can call url_format() on strings
9650
- // to clean up potentially wonky urls.
9651
- if (util.isString(obj))
9652
- obj = urlParse(obj);
9653
- if (!(obj instanceof Url))
9654
- return Url.prototype.format.call(obj);
9655
- return obj.format();
9656
- }
9657
- Url.prototype.format = function () {
9658
- var auth = this.auth || '';
9659
- if (auth) {
9660
- auth = encodeURIComponent(auth);
9661
- auth = auth.replace(/%3A/i, ':');
9662
- auth += '@';
9663
- }
9664
- var protocol = this.protocol || '', pathname = this.pathname || '', hash = this.hash || '', host = false, query = '';
9665
- if (this.host) {
9666
- host = auth + this.host;
9667
- } else if (this.hostname) {
9668
- host = auth + (this.hostname.indexOf(':') === -1 ? this.hostname : '[' + this.hostname + ']');
9669
- if (this.port) {
9670
- host += ':' + this.port;
9671
- }
9672
- }
9673
- if (this.query && util.isObject(this.query) && Object.keys(this.query).length) {
9674
- query = querystring.stringify(this.query);
9675
- }
9676
- var search = this.search || query && '?' + query || '';
9677
- if (protocol && protocol.substr(-1) !== ':')
9678
- protocol += ':';
9679
- // only the slashedProtocols get the //. Not mailto:, xmpp:, etc.
9680
- // unless they had them to begin with.
9681
- if (this.slashes || (!protocol || slashedProtocol[protocol]) && host !== false) {
9682
- host = '//' + (host || '');
9683
- if (pathname && pathname.charAt(0) !== '/')
9684
- pathname = '/' + pathname;
9685
- } else if (!host) {
9686
- host = '';
9687
- }
9688
- if (hash && hash.charAt(0) !== '#')
9689
- hash = '#' + hash;
9690
- if (search && search.charAt(0) !== '?')
9691
- search = '?' + search;
9692
- pathname = pathname.replace(/[?#]/g, function (match) {
9693
- return encodeURIComponent(match);
9694
- });
9695
- search = search.replace('#', '%23');
9696
- return protocol + host + pathname + search + hash;
9697
- };
9698
- function urlResolve(source, relative) {
9699
- return urlParse(source, false, true).resolve(relative);
9700
- }
9701
- Url.prototype.resolve = function (relative) {
9702
- return this.resolveObject(urlParse(relative, false, true)).format();
9703
- };
9704
- function urlResolveObject(source, relative) {
9705
- if (!source)
9706
- return relative;
9707
- return urlParse(source, false, true).resolveObject(relative);
9708
- }
9709
- Url.prototype.resolveObject = function (relative) {
9710
- if (util.isString(relative)) {
9711
- var rel = new Url();
9712
- rel.parse(relative, false, true);
9713
- relative = rel;
9714
- }
9715
- var result = new Url();
9716
- var tkeys = Object.keys(this);
9717
- for (var tk = 0; tk < tkeys.length; tk++) {
9718
- var tkey = tkeys[tk];
9719
- result[tkey] = this[tkey];
9720
- }
9721
- // hash is always overridden, no matter what.
9722
- // even href="" will remove it.
9723
- result.hash = relative.hash;
9724
- // if the relative url is empty, then there's nothing left to do here.
9725
- if (relative.href === '') {
9726
- result.href = result.format();
9727
- return result;
9728
- }
9729
- // hrefs like //foo/bar always cut to the protocol.
9730
- if (relative.slashes && !relative.protocol) {
9731
- // take everything except the protocol from relative
9732
- var rkeys = Object.keys(relative);
9733
- for (var rk = 0; rk < rkeys.length; rk++) {
9734
- var rkey = rkeys[rk];
9735
- if (rkey !== 'protocol')
9736
- result[rkey] = relative[rkey];
9737
- }
9738
- //urlParse appends trailing / to urls like http://www.example.com
9739
- if (slashedProtocol[result.protocol] && result.hostname && !result.pathname) {
9740
- result.path = result.pathname = '/';
9741
- }
9742
- result.href = result.format();
9743
- return result;
9744
- }
9745
- if (relative.protocol && relative.protocol !== result.protocol) {
9746
- // if it's a known url protocol, then changing
9747
- // the protocol does weird things
9748
- // first, if it's not file:, then we MUST have a host,
9749
- // and if there was a path
9750
- // to begin with, then we MUST have a path.
9751
- // if it is file:, then the host is dropped,
9752
- // because that's known to be hostless.
9753
- // anything else is assumed to be absolute.
9754
- if (!slashedProtocol[relative.protocol]) {
9755
- var keys = Object.keys(relative);
9756
- for (var v = 0; v < keys.length; v++) {
9757
- var k = keys[v];
9758
- result[k] = relative[k];
9759
- }
9760
- result.href = result.format();
9761
- return result;
9762
- }
9763
- result.protocol = relative.protocol;
9764
- if (!relative.host && !hostlessProtocol[relative.protocol]) {
9765
- var relPath = (relative.pathname || '').split('/');
9766
- while (relPath.length && !(relative.host = relPath.shift()));
9767
- if (!relative.host)
9768
- relative.host = '';
9769
- if (!relative.hostname)
9770
- relative.hostname = '';
9771
- if (relPath[0] !== '')
9772
- relPath.unshift('');
9773
- if (relPath.length < 2)
9774
- relPath.unshift('');
9775
- result.pathname = relPath.join('/');
9776
- } else {
9777
- result.pathname = relative.pathname;
9778
- }
9779
- result.search = relative.search;
9780
- result.query = relative.query;
9781
- result.host = relative.host || '';
9782
- result.auth = relative.auth;
9783
- result.hostname = relative.hostname || relative.host;
9784
- result.port = relative.port;
9785
- // to support http.request
9786
- if (result.pathname || result.search) {
9787
- var p = result.pathname || '';
9788
- var s = result.search || '';
9789
- result.path = p + s;
9790
- }
9791
- result.slashes = result.slashes || relative.slashes;
9792
- result.href = result.format();
9793
- return result;
9794
- }
9795
- 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];
9796
- // if the url is a non-slashed url, then relative
9797
- // links like ../.. should be able
9798
- // to crawl up to the hostname, as well. This is strange.
9799
- // result.protocol has already been set by now.
9800
- // Later on, put the first path part into the host field.
9801
- if (psychotic) {
9802
- result.hostname = '';
9803
- result.port = null;
9804
- if (result.host) {
9805
- if (srcPath[0] === '')
9806
- srcPath[0] = result.host;
9807
- else
9808
- srcPath.unshift(result.host);
9809
- }
9810
- result.host = '';
9811
- if (relative.protocol) {
9812
- relative.hostname = null;
9813
- relative.port = null;
9814
- if (relative.host) {
9815
- if (relPath[0] === '')
9816
- relPath[0] = relative.host;
9817
- else
9818
- relPath.unshift(relative.host);
9819
- }
9820
- relative.host = null;
9821
- }
9822
- mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === '');
9823
- }
9824
- if (isRelAbs) {
9825
- // it's absolute.
9826
- result.host = relative.host || relative.host === '' ? relative.host : result.host;
9827
- result.hostname = relative.hostname || relative.hostname === '' ? relative.hostname : result.hostname;
9828
- result.search = relative.search;
9829
- result.query = relative.query;
9830
- srcPath = relPath; // fall through to the dot-handling below.
9831
- } else if (relPath.length) {
9832
- // it's relative
9833
- // throw away the existing file, and take the new path instead.
9834
- if (!srcPath)
9835
- srcPath = [];
9836
- srcPath.pop();
9837
- srcPath = srcPath.concat(relPath);
9838
- result.search = relative.search;
9839
- result.query = relative.query;
9840
- } else if (!util.isNullOrUndefined(relative.search)) {
9841
- // just pull out the search.
9842
- // like href='?foo'.
9843
- // Put this after the other two cases because it simplifies the booleans
9844
- if (psychotic) {
9845
- result.hostname = result.host = srcPath.shift();
9846
- //occationaly the auth can get stuck only in host
9847
- //this especially happens in cases like
9848
- //url.resolveObject('mailto:local1@domain1', 'local2@domain2')
9849
- var authInHost = result.host && result.host.indexOf('@') > 0 ? result.host.split('@') : false;
9850
- if (authInHost) {
9851
- result.auth = authInHost.shift();
9852
- result.host = result.hostname = authInHost.shift();
9853
- }
9854
- }
9855
- result.search = relative.search;
9856
- result.query = relative.query;
9857
- //to support http.request
9858
- if (!util.isNull(result.pathname) || !util.isNull(result.search)) {
9859
- result.path = (result.pathname ? result.pathname : '') + (result.search ? result.search : '');
9860
- }
9861
- result.href = result.format();
9862
- return result;
9863
- }
9864
- if (!srcPath.length) {
9865
- // no path at all. easy.
9866
- // we've already handled the other stuff above.
9867
- result.pathname = null;
9868
- //to support http.request
9869
- if (result.search) {
9870
- result.path = '/' + result.search;
9871
- } else {
9872
- result.path = null;
9873
- }
9874
- result.href = result.format();
9875
- return result;
9876
- }
9877
- // if a url ENDs in . or .., then it must get a trailing slash.
9878
- // however, if it ends in anything else non-slashy,
9879
- // then it must NOT get a trailing slash.
9880
- var last = srcPath.slice(-1)[0];
9881
- var hasTrailingSlash = (result.host || relative.host || srcPath.length > 1) && (last === '.' || last === '..') || last === '';
9882
- // strip single dots, resolve double dots to parent dir
9883
- // if the path tries to go above the root, `up` ends up > 0
9884
- var up = 0;
9885
- for (var i = srcPath.length; i >= 0; i--) {
9886
- last = srcPath[i];
9887
- if (last === '.') {
9888
- srcPath.splice(i, 1);
9889
- } else if (last === '..') {
9890
- srcPath.splice(i, 1);
9891
- up++;
9892
- } else if (up) {
9893
- srcPath.splice(i, 1);
9894
- up--;
9895
- }
9896
- }
9897
- // if the path is allowed to go above the root, restore leading ..s
9898
- if (!mustEndAbs && !removeAllDots) {
9899
- for (; up--; up) {
9900
- srcPath.unshift('..');
9901
- }
9902
- }
9903
- if (mustEndAbs && srcPath[0] !== '' && (!srcPath[0] || srcPath[0].charAt(0) !== '/')) {
9904
- srcPath.unshift('');
9905
- }
9906
- if (hasTrailingSlash && srcPath.join('/').substr(-1) !== '/') {
9907
- srcPath.push('');
9908
- }
9909
- var isAbsolute = srcPath[0] === '' || srcPath[0] && srcPath[0].charAt(0) === '/';
9910
- // put the host back
9911
- if (psychotic) {
9912
- result.hostname = result.host = isAbsolute ? '' : srcPath.length ? srcPath.shift() : '';
9913
- //occationaly the auth can get stuck only in host
9914
- //this especially happens in cases like
9915
- //url.resolveObject('mailto:local1@domain1', 'local2@domain2')
9916
- var authInHost = result.host && result.host.indexOf('@') > 0 ? result.host.split('@') : false;
9917
- if (authInHost) {
9918
- result.auth = authInHost.shift();
9919
- result.host = result.hostname = authInHost.shift();
9920
- }
9921
- }
9922
- mustEndAbs = mustEndAbs || result.host && srcPath.length;
9923
- if (mustEndAbs && !isAbsolute) {
9924
- srcPath.unshift('');
9925
- }
9926
- if (!srcPath.length) {
9927
- result.pathname = null;
9928
- result.path = null;
9929
- } else {
9930
- result.pathname = srcPath.join('/');
9931
- }
9932
- //to support request.http
9933
- if (!util.isNull(result.pathname) || !util.isNull(result.search)) {
9934
- result.path = (result.pathname ? result.pathname : '') + (result.search ? result.search : '');
9935
- }
9936
- result.auth = relative.auth || result.auth;
9937
- result.slashes = result.slashes || relative.slashes;
9938
- result.href = result.format();
9939
- return result;
9940
- };
9941
- Url.prototype.parseHost = function () {
9942
- var host = this.host;
9943
- var port = portPattern.exec(host);
9944
- if (port) {
9945
- port = port[0];
9946
- if (port !== ':') {
9947
- this.port = port.substr(1);
9948
- }
9949
- host = host.substr(0, host.length - port.length);
9950
- }
9951
- if (host)
9952
- this.hostname = host;
9953
- };
9954
-
9955
8784
  //
9956
8785
  function getPropertyReference(propertyName) {
9957
8786
  for (let i = 0; i < v8.layout.length; i++) {
@@ -10109,7 +8938,7 @@ function migrateToV8 (style) {
10109
8938
  });
10110
8939
  });
10111
8940
  function migrateFontstackURL(input) {
10112
- const inputParsed = url.parse(input);
8941
+ const inputParsed = new URL(input);
10113
8942
  const inputPathnameParts = inputParsed.pathname.split('/');
10114
8943
  if (inputParsed.protocol !== 'mapbox:') {
10115
8944
  return input;
@@ -10318,6 +9147,10 @@ function isValidNativeType(provided, allowedTypes) {
10318
9147
  });
10319
9148
  }
10320
9149
 
9150
+ function getDefaultExportFromCjs (x) {
9151
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
9152
+ }
9153
+
10321
9154
  var csscolorparser = {};
10322
9155
 
10323
9156
  var parseCSSColor_1;