axios 0.27.0 → 0.27.1
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/CHANGELOG.md +7 -1
- package/dist/axios.js +2169 -1468
- package/dist/axios.map +1 -1
- package/dist/axios.min.js +11 -3
- package/dist/axios.min.map +1 -1
- package/lib/adapters/http.js +4 -2
- package/lib/adapters/xhr.js +5 -9
- package/lib/env/data.js +1 -1
- package/lib/utils.js +0 -18
- package/package.json +1 -1
package/dist/axios.js
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
/* axios v0.27.
|
2
|
-
/* axios v0.26.1 | (c) 2022 by Matt Zabriskie */
|
1
|
+
/* axios v0.27.1 | (c) 2022 by Matt Zabriskie */
|
3
2
|
(function webpackUniversalModuleDefinition(root, factory) {
|
4
3
|
if(typeof exports === 'object' && typeof module === 'object')
|
5
4
|
module.exports = factory();
|
@@ -126,7 +125,6 @@ var buildURL = __webpack_require__(/*! ./../helpers/buildURL */ "./lib/helpers/b
|
|
126
125
|
var buildFullPath = __webpack_require__(/*! ../core/buildFullPath */ "./lib/core/buildFullPath.js");
|
127
126
|
var parseHeaders = __webpack_require__(/*! ./../helpers/parseHeaders */ "./lib/helpers/parseHeaders.js");
|
128
127
|
var isURLSameOrigin = __webpack_require__(/*! ./../helpers/isURLSameOrigin */ "./lib/helpers/isURLSameOrigin.js");
|
129
|
-
var url = __webpack_require__(/*! url */ "./node_modules/url/url.js");
|
130
128
|
var transitionalDefaults = __webpack_require__(/*! ../defaults/transitional */ "./lib/defaults/transitional.js");
|
131
129
|
var AxiosError = __webpack_require__(/*! ../core/AxiosError */ "./lib/core/AxiosError.js");
|
132
130
|
var CanceledError = __webpack_require__(/*! ../cancel/CanceledError */ "./lib/cancel/CanceledError.js");
|
@@ -147,10 +145,6 @@ module.exports = function xhrAdapter(config) {
|
|
147
145
|
}
|
148
146
|
}
|
149
147
|
|
150
|
-
if (utils.isFormData(requestData)) {
|
151
|
-
delete requestHeaders['Content-Type']; // Let the browser set it
|
152
|
-
}
|
153
|
-
|
154
148
|
var request = new XMLHttpRequest();
|
155
149
|
|
156
150
|
// HTTP basic authentication
|
@@ -161,8 +155,6 @@ module.exports = function xhrAdapter(config) {
|
|
161
155
|
}
|
162
156
|
|
163
157
|
var fullPath = buildFullPath(config.baseURL, config.url);
|
164
|
-
var parsed = url.parse(fullPath);
|
165
|
-
var protocol = utils.getProtocol(parsed.protocol);
|
166
158
|
|
167
159
|
request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
|
168
160
|
|
@@ -329,16 +321,15 @@ module.exports = function xhrAdapter(config) {
|
|
329
321
|
requestData = null;
|
330
322
|
}
|
331
323
|
|
332
|
-
|
333
|
-
|
334
|
-
return;
|
335
|
-
}
|
324
|
+
var tokens = fullPath.split(':', 2);
|
325
|
+
var protocol = tokens.length > 1 && tokens[0];
|
336
326
|
|
337
|
-
if (
|
338
|
-
reject(new AxiosError('Unsupported protocol ' + protocol, AxiosError.ERR_BAD_REQUEST, config));
|
327
|
+
if (protocol && [ 'http', 'https', 'file' ].indexOf(protocol) === -1) {
|
328
|
+
reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
|
339
329
|
return;
|
340
330
|
}
|
341
331
|
|
332
|
+
|
342
333
|
// Send the request
|
343
334
|
request.send(requestData);
|
344
335
|
});
|
@@ -398,6 +389,7 @@ axios.CanceledError = __webpack_require__(/*! ./cancel/CanceledError */ "./lib/c
|
|
398
389
|
axios.CancelToken = __webpack_require__(/*! ./cancel/CancelToken */ "./lib/cancel/CancelToken.js");
|
399
390
|
axios.isCancel = __webpack_require__(/*! ./cancel/isCancel */ "./lib/cancel/isCancel.js");
|
400
391
|
axios.VERSION = __webpack_require__(/*! ./env/data */ "./lib/env/data.js").version;
|
392
|
+
axios.toFormData = __webpack_require__(/*! ./helpers/toFormData */ "./lib/helpers/toFormData.js");
|
401
393
|
|
402
394
|
// Expose AxiosError class
|
403
395
|
axios.AxiosError = __webpack_require__(/*! ../lib/core/AxiosError */ "./lib/core/AxiosError.js");
|
@@ -752,13 +744,23 @@ utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData
|
|
752
744
|
|
753
745
|
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
754
746
|
/*eslint func-names:0*/
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
747
|
+
|
748
|
+
function generateHTTPMethod(isForm) {
|
749
|
+
return function httpMethod(url, data, config) {
|
750
|
+
return this.request(mergeConfig(config || {}, {
|
751
|
+
method: method,
|
752
|
+
headers: isForm ? {
|
753
|
+
'Content-Type': 'multipart/form-data'
|
754
|
+
} : {},
|
755
|
+
url: url,
|
756
|
+
data: data
|
757
|
+
}));
|
758
|
+
};
|
759
|
+
}
|
760
|
+
|
761
|
+
Axios.prototype[method] = generateHTTPMethod();
|
762
|
+
|
763
|
+
Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
|
762
764
|
});
|
763
765
|
|
764
766
|
module.exports = Axios;
|
@@ -1258,6 +1260,7 @@ var utils = __webpack_require__(/*! ../utils */ "./lib/utils.js");
|
|
1258
1260
|
var normalizeHeaderName = __webpack_require__(/*! ../helpers/normalizeHeaderName */ "./lib/helpers/normalizeHeaderName.js");
|
1259
1261
|
var AxiosError = __webpack_require__(/*! ../core/AxiosError */ "./lib/core/AxiosError.js");
|
1260
1262
|
var transitionalDefaults = __webpack_require__(/*! ./transitional */ "./lib/defaults/transitional.js");
|
1263
|
+
var toFormData = __webpack_require__(/*! ../helpers/toFormData */ "./lib/helpers/toFormData.js");
|
1261
1264
|
|
1262
1265
|
var DEFAULT_CONTENT_TYPE = {
|
1263
1266
|
'Content-Type': 'application/x-www-form-urlencoded'
|
@@ -1322,10 +1325,20 @@ var defaults = {
|
|
1322
1325
|
setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
|
1323
1326
|
return data.toString();
|
1324
1327
|
}
|
1325
|
-
|
1328
|
+
|
1329
|
+
var isObjectPayload = utils.isObject(data);
|
1330
|
+
var contentType = headers && headers['Content-Type'];
|
1331
|
+
|
1332
|
+
var isFileList;
|
1333
|
+
|
1334
|
+
if ((isFileList = utils.isFileList(data)) || (isObjectPayload && contentType === 'multipart/form-data')) {
|
1335
|
+
var _FormData = this.env && this.env.FormData;
|
1336
|
+
return toFormData(isFileList ? {'files[]': data} : data, _FormData && new _FormData());
|
1337
|
+
} else if (isObjectPayload || contentType === 'application/json') {
|
1326
1338
|
setContentTypeIfUnset(headers, 'application/json');
|
1327
1339
|
return stringifySafely(data);
|
1328
1340
|
}
|
1341
|
+
|
1329
1342
|
return data;
|
1330
1343
|
}],
|
1331
1344
|
|
@@ -1363,6 +1376,10 @@ var defaults = {
|
|
1363
1376
|
maxContentLength: -1,
|
1364
1377
|
maxBodyLength: -1,
|
1365
1378
|
|
1379
|
+
env: {
|
1380
|
+
FormData: __webpack_require__(/*! ./env/FormData */ "./lib/helpers/null.js")
|
1381
|
+
},
|
1382
|
+
|
1366
1383
|
validateStatus: function validateStatus(status) {
|
1367
1384
|
return status >= 200 && status < 300;
|
1368
1385
|
},
|
@@ -1414,7 +1431,7 @@ module.exports = {
|
|
1414
1431
|
/***/ (function(module, exports) {
|
1415
1432
|
|
1416
1433
|
module.exports = {
|
1417
|
-
"version": "0.
|
1434
|
+
"version": "0.27.1"
|
1418
1435
|
};
|
1419
1436
|
|
1420
1437
|
/***/ }),
|
@@ -1768,6 +1785,19 @@ module.exports = function normalizeHeaderName(headers, normalizedName) {
|
|
1768
1785
|
};
|
1769
1786
|
|
1770
1787
|
|
1788
|
+
/***/ }),
|
1789
|
+
|
1790
|
+
/***/ "./lib/helpers/null.js":
|
1791
|
+
/*!*****************************!*\
|
1792
|
+
!*** ./lib/helpers/null.js ***!
|
1793
|
+
\*****************************/
|
1794
|
+
/*! no static exports found */
|
1795
|
+
/***/ (function(module, exports) {
|
1796
|
+
|
1797
|
+
// eslint-disable-next-line strict
|
1798
|
+
module.exports = null;
|
1799
|
+
|
1800
|
+
|
1771
1801
|
/***/ }),
|
1772
1802
|
|
1773
1803
|
/***/ "./lib/helpers/parseHeaders.js":
|
@@ -1872,6 +1902,91 @@ module.exports = function spread(callback) {
|
|
1872
1902
|
};
|
1873
1903
|
|
1874
1904
|
|
1905
|
+
/***/ }),
|
1906
|
+
|
1907
|
+
/***/ "./lib/helpers/toFormData.js":
|
1908
|
+
/*!***********************************!*\
|
1909
|
+
!*** ./lib/helpers/toFormData.js ***!
|
1910
|
+
\***********************************/
|
1911
|
+
/*! no static exports found */
|
1912
|
+
/***/ (function(module, exports, __webpack_require__) {
|
1913
|
+
|
1914
|
+
"use strict";
|
1915
|
+
/* WEBPACK VAR INJECTION */(function(Buffer) {
|
1916
|
+
|
1917
|
+
var utils = __webpack_require__(/*! ../utils */ "./lib/utils.js");
|
1918
|
+
|
1919
|
+
/**
|
1920
|
+
* Convert a data object to FormData
|
1921
|
+
* @param {Object} obj
|
1922
|
+
* @param {?Object} [formData]
|
1923
|
+
* @returns {Object}
|
1924
|
+
**/
|
1925
|
+
|
1926
|
+
function toFormData(obj, formData) {
|
1927
|
+
// eslint-disable-next-line no-param-reassign
|
1928
|
+
formData = formData || new FormData();
|
1929
|
+
|
1930
|
+
var stack = [];
|
1931
|
+
|
1932
|
+
function convertValue(value) {
|
1933
|
+
if (value === null) return '';
|
1934
|
+
|
1935
|
+
if (utils.isDate(value)) {
|
1936
|
+
return value.toISOString();
|
1937
|
+
}
|
1938
|
+
|
1939
|
+
if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
|
1940
|
+
return typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
|
1941
|
+
}
|
1942
|
+
|
1943
|
+
return value;
|
1944
|
+
}
|
1945
|
+
|
1946
|
+
function build(data, parentKey) {
|
1947
|
+
if (utils.isPlainObject(data) || utils.isArray(data)) {
|
1948
|
+
if (stack.indexOf(data) !== -1) {
|
1949
|
+
throw Error('Circular reference detected in ' + parentKey);
|
1950
|
+
}
|
1951
|
+
|
1952
|
+
stack.push(data);
|
1953
|
+
|
1954
|
+
utils.forEach(data, function each(value, key) {
|
1955
|
+
if (utils.isUndefined(value)) return;
|
1956
|
+
var fullKey = parentKey ? parentKey + '.' + key : key;
|
1957
|
+
var arr;
|
1958
|
+
|
1959
|
+
if (value && !parentKey && typeof value === 'object') {
|
1960
|
+
if (utils.endsWith(key, '{}')) {
|
1961
|
+
// eslint-disable-next-line no-param-reassign
|
1962
|
+
value = JSON.stringify(value);
|
1963
|
+
} else if (utils.endsWith(key, '[]') && (arr = utils.toArray(value))) {
|
1964
|
+
// eslint-disable-next-line func-names
|
1965
|
+
arr.forEach(function(el) {
|
1966
|
+
!utils.isUndefined(el) && formData.append(fullKey, convertValue(el));
|
1967
|
+
});
|
1968
|
+
return;
|
1969
|
+
}
|
1970
|
+
}
|
1971
|
+
|
1972
|
+
build(value, fullKey);
|
1973
|
+
});
|
1974
|
+
|
1975
|
+
stack.pop();
|
1976
|
+
} else {
|
1977
|
+
formData.append(parentKey, convertValue(data));
|
1978
|
+
}
|
1979
|
+
}
|
1980
|
+
|
1981
|
+
build(obj);
|
1982
|
+
|
1983
|
+
return formData;
|
1984
|
+
}
|
1985
|
+
|
1986
|
+
module.exports = toFormData;
|
1987
|
+
|
1988
|
+
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/node-libs-browser/node_modules/buffer/index.js */ "./node_modules/node-libs-browser/node_modules/buffer/index.js").Buffer))
|
1989
|
+
|
1875
1990
|
/***/ }),
|
1876
1991
|
|
1877
1992
|
/***/ "./lib/helpers/validator.js":
|
@@ -1988,20 +2103,20 @@ var bind = __webpack_require__(/*! ./helpers/bind */ "./lib/helpers/bind.js");
|
|
1988
2103
|
|
1989
2104
|
var toString = Object.prototype.toString;
|
1990
2105
|
|
1991
|
-
|
1992
|
-
|
1993
|
-
|
1994
|
-
|
2106
|
+
// eslint-disable-next-line func-names
|
2107
|
+
var kindOf = (function(cache) {
|
2108
|
+
// eslint-disable-next-line func-names
|
2109
|
+
return function(thing) {
|
2110
|
+
var str = toString.call(thing);
|
2111
|
+
return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
|
2112
|
+
};
|
2113
|
+
})(Object.create(null));
|
1995
2114
|
|
1996
|
-
|
1997
|
-
|
1998
|
-
|
1999
|
-
|
2000
|
-
|
2001
|
-
* @returns {String} Protocol if the value is not undefined or null
|
2002
|
-
*/
|
2003
|
-
function getProtocol(protocol) {
|
2004
|
-
return protocol || 'http:';
|
2115
|
+
function kindOfTest(type) {
|
2116
|
+
type = type.toLowerCase();
|
2117
|
+
return function isKindOf(thing) {
|
2118
|
+
return kindOf(thing) === type;
|
2119
|
+
};
|
2005
2120
|
}
|
2006
2121
|
|
2007
2122
|
/**
|
@@ -2038,22 +2153,12 @@ function isBuffer(val) {
|
|
2038
2153
|
/**
|
2039
2154
|
* Determine if a value is an ArrayBuffer
|
2040
2155
|
*
|
2156
|
+
* @function
|
2041
2157
|
* @param {Object} val The value to test
|
2042
2158
|
* @returns {boolean} True if value is an ArrayBuffer, otherwise false
|
2043
2159
|
*/
|
2044
|
-
|
2045
|
-
return toString.call(val) === '[object ArrayBuffer]';
|
2046
|
-
}
|
2160
|
+
var isArrayBuffer = kindOfTest('ArrayBuffer');
|
2047
2161
|
|
2048
|
-
/**
|
2049
|
-
* Determine if a value is a FormData
|
2050
|
-
*
|
2051
|
-
* @param {Object} val The value to test
|
2052
|
-
* @returns {boolean} True if value is an FormData, otherwise false
|
2053
|
-
*/
|
2054
|
-
function isFormData(val) {
|
2055
|
-
return toString.call(val) === '[object FormData]';
|
2056
|
-
}
|
2057
2162
|
|
2058
2163
|
/**
|
2059
2164
|
* Determine if a value is a view on an ArrayBuffer
|
@@ -2108,7 +2213,7 @@ function isObject(val) {
|
|
2108
2213
|
* @return {boolean} True if value is a plain Object, otherwise false
|
2109
2214
|
*/
|
2110
2215
|
function isPlainObject(val) {
|
2111
|
-
if (
|
2216
|
+
if (kindOf(val) !== 'object') {
|
2112
2217
|
return false;
|
2113
2218
|
}
|
2114
2219
|
|
@@ -2119,32 +2224,38 @@ function isPlainObject(val) {
|
|
2119
2224
|
/**
|
2120
2225
|
* Determine if a value is a Date
|
2121
2226
|
*
|
2227
|
+
* @function
|
2122
2228
|
* @param {Object} val The value to test
|
2123
2229
|
* @returns {boolean} True if value is a Date, otherwise false
|
2124
2230
|
*/
|
2125
|
-
|
2126
|
-
return toString.call(val) === '[object Date]';
|
2127
|
-
}
|
2231
|
+
var isDate = kindOfTest('Date');
|
2128
2232
|
|
2129
2233
|
/**
|
2130
2234
|
* Determine if a value is a File
|
2131
2235
|
*
|
2236
|
+
* @function
|
2132
2237
|
* @param {Object} val The value to test
|
2133
2238
|
* @returns {boolean} True if value is a File, otherwise false
|
2134
2239
|
*/
|
2135
|
-
|
2136
|
-
return toString.call(val) === '[object File]';
|
2137
|
-
}
|
2240
|
+
var isFile = kindOfTest('File');
|
2138
2241
|
|
2139
2242
|
/**
|
2140
2243
|
* Determine if a value is a Blob
|
2141
2244
|
*
|
2245
|
+
* @function
|
2142
2246
|
* @param {Object} val The value to test
|
2143
2247
|
* @returns {boolean} True if value is a Blob, otherwise false
|
2144
2248
|
*/
|
2145
|
-
|
2146
|
-
|
2147
|
-
|
2249
|
+
var isBlob = kindOfTest('Blob');
|
2250
|
+
|
2251
|
+
/**
|
2252
|
+
* Determine if a value is a FileList
|
2253
|
+
*
|
2254
|
+
* @function
|
2255
|
+
* @param {Object} val The value to test
|
2256
|
+
* @returns {boolean} True if value is a File, otherwise false
|
2257
|
+
*/
|
2258
|
+
var isFileList = kindOfTest('FileList');
|
2148
2259
|
|
2149
2260
|
/**
|
2150
2261
|
* Determine if a value is a Function
|
@@ -2167,14 +2278,27 @@ function isStream(val) {
|
|
2167
2278
|
}
|
2168
2279
|
|
2169
2280
|
/**
|
2170
|
-
* Determine if a value is a
|
2281
|
+
* Determine if a value is a FormData
|
2171
2282
|
*
|
2283
|
+
* @param {Object} thing The value to test
|
2284
|
+
* @returns {boolean} True if value is an FormData, otherwise false
|
2285
|
+
*/
|
2286
|
+
function isFormData(thing) {
|
2287
|
+
var pattern = '[object FormData]';
|
2288
|
+
return thing && (
|
2289
|
+
(typeof FormData === 'function' && thing instanceof FormData) ||
|
2290
|
+
toString.call(thing) === pattern ||
|
2291
|
+
(isFunction(thing.toString) && thing.toString() === pattern)
|
2292
|
+
);
|
2293
|
+
}
|
2294
|
+
|
2295
|
+
/**
|
2296
|
+
* Determine if a value is a URLSearchParams object
|
2297
|
+
* @function
|
2172
2298
|
* @param {Object} val The value to test
|
2173
2299
|
* @returns {boolean} True if value is a URLSearchParams object, otherwise false
|
2174
2300
|
*/
|
2175
|
-
|
2176
|
-
return toString.call(val) === '[object URLSearchParams]';
|
2177
|
-
}
|
2301
|
+
var isURLSearchParams = kindOfTest('URLSearchParams');
|
2178
2302
|
|
2179
2303
|
/**
|
2180
2304
|
* Trim excess whitespace off the beginning and end of a string
|
@@ -2367,9 +2491,49 @@ function toFlatObject(sourceObj, destObj, filter) {
|
|
2367
2491
|
return destObj;
|
2368
2492
|
}
|
2369
2493
|
|
2494
|
+
/*
|
2495
|
+
* determines whether a string ends with the characters of a specified string
|
2496
|
+
* @param {String} str
|
2497
|
+
* @param {String} searchString
|
2498
|
+
* @param {Number} [position= 0]
|
2499
|
+
* @returns {boolean}
|
2500
|
+
*/
|
2501
|
+
function endsWith(str, searchString, position) {
|
2502
|
+
str = String(str);
|
2503
|
+
if (position === undefined || position > str.length) {
|
2504
|
+
position = str.length;
|
2505
|
+
}
|
2506
|
+
position -= searchString.length;
|
2507
|
+
var lastIndex = str.indexOf(searchString, position);
|
2508
|
+
return lastIndex !== -1 && lastIndex === position;
|
2509
|
+
}
|
2510
|
+
|
2511
|
+
|
2512
|
+
/**
|
2513
|
+
* Returns new array from array like object
|
2514
|
+
* @param {*} [thing]
|
2515
|
+
* @returns {Array}
|
2516
|
+
*/
|
2517
|
+
function toArray(thing) {
|
2518
|
+
if (!thing) return null;
|
2519
|
+
var i = thing.length;
|
2520
|
+
if (isUndefined(i)) return null;
|
2521
|
+
var arr = new Array(i);
|
2522
|
+
while (i-- > 0) {
|
2523
|
+
arr[i] = thing[i];
|
2524
|
+
}
|
2525
|
+
return arr;
|
2526
|
+
}
|
2527
|
+
|
2528
|
+
// eslint-disable-next-line func-names
|
2529
|
+
var isTypedArray = (function(TypedArray) {
|
2530
|
+
// eslint-disable-next-line func-names
|
2531
|
+
return function(thing) {
|
2532
|
+
return TypedArray && thing instanceof TypedArray;
|
2533
|
+
};
|
2534
|
+
})(typeof Uint8Array !== 'undefined' && Object.getPrototypeOf(Uint8Array));
|
2535
|
+
|
2370
2536
|
module.exports = {
|
2371
|
-
supportedProtocols: supportedProtocols,
|
2372
|
-
getProtocol: getProtocol,
|
2373
2537
|
isArray: isArray,
|
2374
2538
|
isArrayBuffer: isArrayBuffer,
|
2375
2539
|
isBuffer: isBuffer,
|
@@ -2393,1519 +2557,2089 @@ module.exports = {
|
|
2393
2557
|
trim: trim,
|
2394
2558
|
stripBOM: stripBOM,
|
2395
2559
|
inherits: inherits,
|
2396
|
-
toFlatObject: toFlatObject
|
2560
|
+
toFlatObject: toFlatObject,
|
2561
|
+
kindOf: kindOf,
|
2562
|
+
kindOfTest: kindOfTest,
|
2563
|
+
endsWith: endsWith,
|
2564
|
+
toArray: toArray,
|
2565
|
+
isTypedArray: isTypedArray,
|
2566
|
+
isFileList: isFileList
|
2397
2567
|
};
|
2398
2568
|
|
2399
2569
|
|
2400
2570
|
/***/ }),
|
2401
2571
|
|
2402
|
-
/***/ "./node_modules/
|
2403
|
-
|
2404
|
-
!*** ./node_modules/
|
2405
|
-
|
2406
|
-
/*! no static exports found */
|
2407
|
-
/***/ (function(module, exports, __webpack_require__) {
|
2408
|
-
|
2409
|
-
/* WEBPACK VAR INJECTION */(function(module, global) {var __WEBPACK_AMD_DEFINE_RESULT__;/*! https://mths.be/punycode v1.4.1 by @mathias */
|
2410
|
-
;(function(root) {
|
2411
|
-
|
2412
|
-
/** Detect free variables */
|
2413
|
-
var freeExports = true && exports &&
|
2414
|
-
!exports.nodeType && exports;
|
2415
|
-
var freeModule = true && module &&
|
2416
|
-
!module.nodeType && module;
|
2417
|
-
var freeGlobal = typeof global == 'object' && global;
|
2418
|
-
if (
|
2419
|
-
freeGlobal.global === freeGlobal ||
|
2420
|
-
freeGlobal.window === freeGlobal ||
|
2421
|
-
freeGlobal.self === freeGlobal
|
2422
|
-
) {
|
2423
|
-
root = freeGlobal;
|
2424
|
-
}
|
2425
|
-
|
2426
|
-
/**
|
2427
|
-
* The `punycode` object.
|
2428
|
-
* @name punycode
|
2429
|
-
* @type Object
|
2430
|
-
*/
|
2431
|
-
var punycode,
|
2432
|
-
|
2433
|
-
/** Highest positive signed 32-bit float value */
|
2434
|
-
maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1
|
2435
|
-
|
2436
|
-
/** Bootstring parameters */
|
2437
|
-
base = 36,
|
2438
|
-
tMin = 1,
|
2439
|
-
tMax = 26,
|
2440
|
-
skew = 38,
|
2441
|
-
damp = 700,
|
2442
|
-
initialBias = 72,
|
2443
|
-
initialN = 128, // 0x80
|
2444
|
-
delimiter = '-', // '\x2D'
|
2445
|
-
|
2446
|
-
/** Regular expressions */
|
2447
|
-
regexPunycode = /^xn--/,
|
2448
|
-
regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars
|
2449
|
-
regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators
|
2450
|
-
|
2451
|
-
/** Error messages */
|
2452
|
-
errors = {
|
2453
|
-
'overflow': 'Overflow: input needs wider integers to process',
|
2454
|
-
'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
|
2455
|
-
'invalid-input': 'Invalid input'
|
2456
|
-
},
|
2457
|
-
|
2458
|
-
/** Convenience shortcuts */
|
2459
|
-
baseMinusTMin = base - tMin,
|
2460
|
-
floor = Math.floor,
|
2461
|
-
stringFromCharCode = String.fromCharCode,
|
2462
|
-
|
2463
|
-
/** Temporary variable */
|
2464
|
-
key;
|
2465
|
-
|
2466
|
-
/*--------------------------------------------------------------------------*/
|
2467
|
-
|
2468
|
-
/**
|
2469
|
-
* A generic error utility function.
|
2470
|
-
* @private
|
2471
|
-
* @param {String} type The error type.
|
2472
|
-
* @returns {Error} Throws a `RangeError` with the applicable error message.
|
2473
|
-
*/
|
2474
|
-
function error(type) {
|
2475
|
-
throw new RangeError(errors[type]);
|
2476
|
-
}
|
2477
|
-
|
2478
|
-
/**
|
2479
|
-
* A generic `Array#map` utility function.
|
2480
|
-
* @private
|
2481
|
-
* @param {Array} array The array to iterate over.
|
2482
|
-
* @param {Function} callback The function that gets called for every array
|
2483
|
-
* item.
|
2484
|
-
* @returns {Array} A new array of values returned by the callback function.
|
2485
|
-
*/
|
2486
|
-
function map(array, fn) {
|
2487
|
-
var length = array.length;
|
2488
|
-
var result = [];
|
2489
|
-
while (length--) {
|
2490
|
-
result[length] = fn(array[length]);
|
2491
|
-
}
|
2492
|
-
return result;
|
2493
|
-
}
|
2494
|
-
|
2495
|
-
/**
|
2496
|
-
* A simple `Array#map`-like wrapper to work with domain name strings or email
|
2497
|
-
* addresses.
|
2498
|
-
* @private
|
2499
|
-
* @param {String} domain The domain name or email address.
|
2500
|
-
* @param {Function} callback The function that gets called for every
|
2501
|
-
* character.
|
2502
|
-
* @returns {Array} A new string of characters returned by the callback
|
2503
|
-
* function.
|
2504
|
-
*/
|
2505
|
-
function mapDomain(string, fn) {
|
2506
|
-
var parts = string.split('@');
|
2507
|
-
var result = '';
|
2508
|
-
if (parts.length > 1) {
|
2509
|
-
// In email addresses, only the domain name should be punycoded. Leave
|
2510
|
-
// the local part (i.e. everything up to `@`) intact.
|
2511
|
-
result = parts[0] + '@';
|
2512
|
-
string = parts[1];
|
2513
|
-
}
|
2514
|
-
// Avoid `split(regex)` for IE8 compatibility. See #17.
|
2515
|
-
string = string.replace(regexSeparators, '\x2E');
|
2516
|
-
var labels = string.split('.');
|
2517
|
-
var encoded = map(labels, fn).join('.');
|
2518
|
-
return result + encoded;
|
2519
|
-
}
|
2520
|
-
|
2521
|
-
/**
|
2522
|
-
* Creates an array containing the numeric code points of each Unicode
|
2523
|
-
* character in the string. While JavaScript uses UCS-2 internally,
|
2524
|
-
* this function will convert a pair of surrogate halves (each of which
|
2525
|
-
* UCS-2 exposes as separate characters) into a single code point,
|
2526
|
-
* matching UTF-16.
|
2527
|
-
* @see `punycode.ucs2.encode`
|
2528
|
-
* @see <https://mathiasbynens.be/notes/javascript-encoding>
|
2529
|
-
* @memberOf punycode.ucs2
|
2530
|
-
* @name decode
|
2531
|
-
* @param {String} string The Unicode input string (UCS-2).
|
2532
|
-
* @returns {Array} The new array of code points.
|
2533
|
-
*/
|
2534
|
-
function ucs2decode(string) {
|
2535
|
-
var output = [],
|
2536
|
-
counter = 0,
|
2537
|
-
length = string.length,
|
2538
|
-
value,
|
2539
|
-
extra;
|
2540
|
-
while (counter < length) {
|
2541
|
-
value = string.charCodeAt(counter++);
|
2542
|
-
if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
|
2543
|
-
// high surrogate, and there is a next character
|
2544
|
-
extra = string.charCodeAt(counter++);
|
2545
|
-
if ((extra & 0xFC00) == 0xDC00) { // low surrogate
|
2546
|
-
output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
|
2547
|
-
} else {
|
2548
|
-
// unmatched surrogate; only append this code unit, in case the next
|
2549
|
-
// code unit is the high surrogate of a surrogate pair
|
2550
|
-
output.push(value);
|
2551
|
-
counter--;
|
2552
|
-
}
|
2553
|
-
} else {
|
2554
|
-
output.push(value);
|
2555
|
-
}
|
2556
|
-
}
|
2557
|
-
return output;
|
2558
|
-
}
|
2559
|
-
|
2560
|
-
/**
|
2561
|
-
* Creates a string based on an array of numeric code points.
|
2562
|
-
* @see `punycode.ucs2.decode`
|
2563
|
-
* @memberOf punycode.ucs2
|
2564
|
-
* @name encode
|
2565
|
-
* @param {Array} codePoints The array of numeric code points.
|
2566
|
-
* @returns {String} The new Unicode string (UCS-2).
|
2567
|
-
*/
|
2568
|
-
function ucs2encode(array) {
|
2569
|
-
return map(array, function(value) {
|
2570
|
-
var output = '';
|
2571
|
-
if (value > 0xFFFF) {
|
2572
|
-
value -= 0x10000;
|
2573
|
-
output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
|
2574
|
-
value = 0xDC00 | value & 0x3FF;
|
2575
|
-
}
|
2576
|
-
output += stringFromCharCode(value);
|
2577
|
-
return output;
|
2578
|
-
}).join('');
|
2579
|
-
}
|
2580
|
-
|
2581
|
-
/**
|
2582
|
-
* Converts a basic code point into a digit/integer.
|
2583
|
-
* @see `digitToBasic()`
|
2584
|
-
* @private
|
2585
|
-
* @param {Number} codePoint The basic numeric code point value.
|
2586
|
-
* @returns {Number} The numeric value of a basic code point (for use in
|
2587
|
-
* representing integers) in the range `0` to `base - 1`, or `base` if
|
2588
|
-
* the code point does not represent a value.
|
2589
|
-
*/
|
2590
|
-
function basicToDigit(codePoint) {
|
2591
|
-
if (codePoint - 48 < 10) {
|
2592
|
-
return codePoint - 22;
|
2593
|
-
}
|
2594
|
-
if (codePoint - 65 < 26) {
|
2595
|
-
return codePoint - 65;
|
2596
|
-
}
|
2597
|
-
if (codePoint - 97 < 26) {
|
2598
|
-
return codePoint - 97;
|
2599
|
-
}
|
2600
|
-
return base;
|
2601
|
-
}
|
2602
|
-
|
2603
|
-
/**
|
2604
|
-
* Converts a digit/integer into a basic code point.
|
2605
|
-
* @see `basicToDigit()`
|
2606
|
-
* @private
|
2607
|
-
* @param {Number} digit The numeric value of a basic code point.
|
2608
|
-
* @returns {Number} The basic code point whose value (when used for
|
2609
|
-
* representing integers) is `digit`, which needs to be in the range
|
2610
|
-
* `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
|
2611
|
-
* used; else, the lowercase form is used. The behavior is undefined
|
2612
|
-
* if `flag` is non-zero and `digit` has no uppercase form.
|
2613
|
-
*/
|
2614
|
-
function digitToBasic(digit, flag) {
|
2615
|
-
// 0..25 map to ASCII a..z or A..Z
|
2616
|
-
// 26..35 map to ASCII 0..9
|
2617
|
-
return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
|
2618
|
-
}
|
2619
|
-
|
2620
|
-
/**
|
2621
|
-
* Bias adaptation function as per section 3.4 of RFC 3492.
|
2622
|
-
* https://tools.ietf.org/html/rfc3492#section-3.4
|
2623
|
-
* @private
|
2624
|
-
*/
|
2625
|
-
function adapt(delta, numPoints, firstTime) {
|
2626
|
-
var k = 0;
|
2627
|
-
delta = firstTime ? floor(delta / damp) : delta >> 1;
|
2628
|
-
delta += floor(delta / numPoints);
|
2629
|
-
for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {
|
2630
|
-
delta = floor(delta / baseMinusTMin);
|
2631
|
-
}
|
2632
|
-
return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
|
2633
|
-
}
|
2634
|
-
|
2635
|
-
/**
|
2636
|
-
* Converts a Punycode string of ASCII-only symbols to a string of Unicode
|
2637
|
-
* symbols.
|
2638
|
-
* @memberOf punycode
|
2639
|
-
* @param {String} input The Punycode string of ASCII-only symbols.
|
2640
|
-
* @returns {String} The resulting string of Unicode symbols.
|
2641
|
-
*/
|
2642
|
-
function decode(input) {
|
2643
|
-
// Don't use UCS-2
|
2644
|
-
var output = [],
|
2645
|
-
inputLength = input.length,
|
2646
|
-
out,
|
2647
|
-
i = 0,
|
2648
|
-
n = initialN,
|
2649
|
-
bias = initialBias,
|
2650
|
-
basic,
|
2651
|
-
j,
|
2652
|
-
index,
|
2653
|
-
oldi,
|
2654
|
-
w,
|
2655
|
-
k,
|
2656
|
-
digit,
|
2657
|
-
t,
|
2658
|
-
/** Cached calculation results */
|
2659
|
-
baseMinusT;
|
2660
|
-
|
2661
|
-
// Handle the basic code points: let `basic` be the number of input code
|
2662
|
-
// points before the last delimiter, or `0` if there is none, then copy
|
2663
|
-
// the first basic code points to the output.
|
2664
|
-
|
2665
|
-
basic = input.lastIndexOf(delimiter);
|
2666
|
-
if (basic < 0) {
|
2667
|
-
basic = 0;
|
2668
|
-
}
|
2669
|
-
|
2670
|
-
for (j = 0; j < basic; ++j) {
|
2671
|
-
// if it's not a basic code point
|
2672
|
-
if (input.charCodeAt(j) >= 0x80) {
|
2673
|
-
error('not-basic');
|
2674
|
-
}
|
2675
|
-
output.push(input.charCodeAt(j));
|
2676
|
-
}
|
2677
|
-
|
2678
|
-
// Main decoding loop: start just after the last delimiter if any basic code
|
2679
|
-
// points were copied; start at the beginning otherwise.
|
2680
|
-
|
2681
|
-
for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {
|
2682
|
-
|
2683
|
-
// `index` is the index of the next character to be consumed.
|
2684
|
-
// Decode a generalized variable-length integer into `delta`,
|
2685
|
-
// which gets added to `i`. The overflow checking is easier
|
2686
|
-
// if we increase `i` as we go, then subtract off its starting
|
2687
|
-
// value at the end to obtain `delta`.
|
2688
|
-
for (oldi = i, w = 1, k = base; /* no condition */; k += base) {
|
2689
|
-
|
2690
|
-
if (index >= inputLength) {
|
2691
|
-
error('invalid-input');
|
2692
|
-
}
|
2693
|
-
|
2694
|
-
digit = basicToDigit(input.charCodeAt(index++));
|
2695
|
-
|
2696
|
-
if (digit >= base || digit > floor((maxInt - i) / w)) {
|
2697
|
-
error('overflow');
|
2698
|
-
}
|
2699
|
-
|
2700
|
-
i += digit * w;
|
2701
|
-
t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
|
2702
|
-
|
2703
|
-
if (digit < t) {
|
2704
|
-
break;
|
2705
|
-
}
|
2706
|
-
|
2707
|
-
baseMinusT = base - t;
|
2708
|
-
if (w > floor(maxInt / baseMinusT)) {
|
2709
|
-
error('overflow');
|
2710
|
-
}
|
2711
|
-
|
2712
|
-
w *= baseMinusT;
|
2713
|
-
|
2714
|
-
}
|
2715
|
-
|
2716
|
-
out = output.length + 1;
|
2717
|
-
bias = adapt(i - oldi, out, oldi == 0);
|
2718
|
-
|
2719
|
-
// `i` was supposed to wrap around from `out` to `0`,
|
2720
|
-
// incrementing `n` each time, so we'll fix that now:
|
2721
|
-
if (floor(i / out) > maxInt - n) {
|
2722
|
-
error('overflow');
|
2723
|
-
}
|
2724
|
-
|
2725
|
-
n += floor(i / out);
|
2726
|
-
i %= out;
|
2727
|
-
|
2728
|
-
// Insert `n` at position `i` of the output
|
2729
|
-
output.splice(i++, 0, n);
|
2730
|
-
|
2731
|
-
}
|
2732
|
-
|
2733
|
-
return ucs2encode(output);
|
2734
|
-
}
|
2735
|
-
|
2736
|
-
/**
|
2737
|
-
* Converts a string of Unicode symbols (e.g. a domain name label) to a
|
2738
|
-
* Punycode string of ASCII-only symbols.
|
2739
|
-
* @memberOf punycode
|
2740
|
-
* @param {String} input The string of Unicode symbols.
|
2741
|
-
* @returns {String} The resulting Punycode string of ASCII-only symbols.
|
2742
|
-
*/
|
2743
|
-
function encode(input) {
|
2744
|
-
var n,
|
2745
|
-
delta,
|
2746
|
-
handledCPCount,
|
2747
|
-
basicLength,
|
2748
|
-
bias,
|
2749
|
-
j,
|
2750
|
-
m,
|
2751
|
-
q,
|
2752
|
-
k,
|
2753
|
-
t,
|
2754
|
-
currentValue,
|
2755
|
-
output = [],
|
2756
|
-
/** `inputLength` will hold the number of code points in `input`. */
|
2757
|
-
inputLength,
|
2758
|
-
/** Cached calculation results */
|
2759
|
-
handledCPCountPlusOne,
|
2760
|
-
baseMinusT,
|
2761
|
-
qMinusT;
|
2762
|
-
|
2763
|
-
// Convert the input in UCS-2 to Unicode
|
2764
|
-
input = ucs2decode(input);
|
2765
|
-
|
2766
|
-
// Cache the length
|
2767
|
-
inputLength = input.length;
|
2768
|
-
|
2769
|
-
// Initialize the state
|
2770
|
-
n = initialN;
|
2771
|
-
delta = 0;
|
2772
|
-
bias = initialBias;
|
2773
|
-
|
2774
|
-
// Handle the basic code points
|
2775
|
-
for (j = 0; j < inputLength; ++j) {
|
2776
|
-
currentValue = input[j];
|
2777
|
-
if (currentValue < 0x80) {
|
2778
|
-
output.push(stringFromCharCode(currentValue));
|
2779
|
-
}
|
2780
|
-
}
|
2781
|
-
|
2782
|
-
handledCPCount = basicLength = output.length;
|
2783
|
-
|
2784
|
-
// `handledCPCount` is the number of code points that have been handled;
|
2785
|
-
// `basicLength` is the number of basic code points.
|
2786
|
-
|
2787
|
-
// Finish the basic string - if it is not empty - with a delimiter
|
2788
|
-
if (basicLength) {
|
2789
|
-
output.push(delimiter);
|
2790
|
-
}
|
2791
|
-
|
2792
|
-
// Main encoding loop:
|
2793
|
-
while (handledCPCount < inputLength) {
|
2794
|
-
|
2795
|
-
// All non-basic code points < n have been handled already. Find the next
|
2796
|
-
// larger one:
|
2797
|
-
for (m = maxInt, j = 0; j < inputLength; ++j) {
|
2798
|
-
currentValue = input[j];
|
2799
|
-
if (currentValue >= n && currentValue < m) {
|
2800
|
-
m = currentValue;
|
2801
|
-
}
|
2802
|
-
}
|
2803
|
-
|
2804
|
-
// Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
|
2805
|
-
// but guard against overflow
|
2806
|
-
handledCPCountPlusOne = handledCPCount + 1;
|
2807
|
-
if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
|
2808
|
-
error('overflow');
|
2809
|
-
}
|
2810
|
-
|
2811
|
-
delta += (m - n) * handledCPCountPlusOne;
|
2812
|
-
n = m;
|
2813
|
-
|
2814
|
-
for (j = 0; j < inputLength; ++j) {
|
2815
|
-
currentValue = input[j];
|
2816
|
-
|
2817
|
-
if (currentValue < n && ++delta > maxInt) {
|
2818
|
-
error('overflow');
|
2819
|
-
}
|
2820
|
-
|
2821
|
-
if (currentValue == n) {
|
2822
|
-
// Represent delta as a generalized variable-length integer
|
2823
|
-
for (q = delta, k = base; /* no condition */; k += base) {
|
2824
|
-
t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
|
2825
|
-
if (q < t) {
|
2826
|
-
break;
|
2827
|
-
}
|
2828
|
-
qMinusT = q - t;
|
2829
|
-
baseMinusT = base - t;
|
2830
|
-
output.push(
|
2831
|
-
stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
|
2832
|
-
);
|
2833
|
-
q = floor(qMinusT / baseMinusT);
|
2834
|
-
}
|
2835
|
-
|
2836
|
-
output.push(stringFromCharCode(digitToBasic(q, 0)));
|
2837
|
-
bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
|
2838
|
-
delta = 0;
|
2839
|
-
++handledCPCount;
|
2840
|
-
}
|
2841
|
-
}
|
2842
|
-
|
2843
|
-
++delta;
|
2844
|
-
++n;
|
2845
|
-
|
2846
|
-
}
|
2847
|
-
return output.join('');
|
2848
|
-
}
|
2849
|
-
|
2850
|
-
/**
|
2851
|
-
* Converts a Punycode string representing a domain name or an email address
|
2852
|
-
* to Unicode. Only the Punycoded parts of the input will be converted, i.e.
|
2853
|
-
* it doesn't matter if you call it on a string that has already been
|
2854
|
-
* converted to Unicode.
|
2855
|
-
* @memberOf punycode
|
2856
|
-
* @param {String} input The Punycoded domain name or email address to
|
2857
|
-
* convert to Unicode.
|
2858
|
-
* @returns {String} The Unicode representation of the given Punycode
|
2859
|
-
* string.
|
2860
|
-
*/
|
2861
|
-
function toUnicode(input) {
|
2862
|
-
return mapDomain(input, function(string) {
|
2863
|
-
return regexPunycode.test(string)
|
2864
|
-
? decode(string.slice(4).toLowerCase())
|
2865
|
-
: string;
|
2866
|
-
});
|
2867
|
-
}
|
2868
|
-
|
2869
|
-
/**
|
2870
|
-
* Converts a Unicode string representing a domain name or an email address to
|
2871
|
-
* Punycode. Only the non-ASCII parts of the domain name will be converted,
|
2872
|
-
* i.e. it doesn't matter if you call it with a domain that's already in
|
2873
|
-
* ASCII.
|
2874
|
-
* @memberOf punycode
|
2875
|
-
* @param {String} input The domain name or email address to convert, as a
|
2876
|
-
* Unicode string.
|
2877
|
-
* @returns {String} The Punycode representation of the given domain name or
|
2878
|
-
* email address.
|
2879
|
-
*/
|
2880
|
-
function toASCII(input) {
|
2881
|
-
return mapDomain(input, function(string) {
|
2882
|
-
return regexNonASCII.test(string)
|
2883
|
-
? 'xn--' + encode(string)
|
2884
|
-
: string;
|
2885
|
-
});
|
2886
|
-
}
|
2887
|
-
|
2888
|
-
/*--------------------------------------------------------------------------*/
|
2889
|
-
|
2890
|
-
/** Define the public API */
|
2891
|
-
punycode = {
|
2892
|
-
/**
|
2893
|
-
* A string representing the current Punycode.js version number.
|
2894
|
-
* @memberOf punycode
|
2895
|
-
* @type String
|
2896
|
-
*/
|
2897
|
-
'version': '1.4.1',
|
2898
|
-
/**
|
2899
|
-
* An object of methods to convert from JavaScript's internal character
|
2900
|
-
* representation (UCS-2) to Unicode code points, and back.
|
2901
|
-
* @see <https://mathiasbynens.be/notes/javascript-encoding>
|
2902
|
-
* @memberOf punycode
|
2903
|
-
* @type Object
|
2904
|
-
*/
|
2905
|
-
'ucs2': {
|
2906
|
-
'decode': ucs2decode,
|
2907
|
-
'encode': ucs2encode
|
2908
|
-
},
|
2909
|
-
'decode': decode,
|
2910
|
-
'encode': encode,
|
2911
|
-
'toASCII': toASCII,
|
2912
|
-
'toUnicode': toUnicode
|
2913
|
-
};
|
2914
|
-
|
2915
|
-
/** Expose `punycode` */
|
2916
|
-
// Some AMD build optimizers, like r.js, check for specific condition patterns
|
2917
|
-
// like the following:
|
2918
|
-
if (
|
2919
|
-
true
|
2920
|
-
) {
|
2921
|
-
!(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
|
2922
|
-
return punycode;
|
2923
|
-
}).call(exports, __webpack_require__, exports, module),
|
2924
|
-
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
2925
|
-
} else {}
|
2926
|
-
|
2927
|
-
}(this));
|
2928
|
-
|
2929
|
-
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/module.js */ "./node_modules/webpack/buildin/module.js")(module), __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
|
2930
|
-
|
2931
|
-
/***/ }),
|
2932
|
-
|
2933
|
-
/***/ "./node_modules/querystring-es3/decode.js":
|
2934
|
-
/*!************************************************!*\
|
2935
|
-
!*** ./node_modules/querystring-es3/decode.js ***!
|
2936
|
-
\************************************************/
|
2572
|
+
/***/ "./node_modules/base64-js/index.js":
|
2573
|
+
/*!*****************************************!*\
|
2574
|
+
!*** ./node_modules/base64-js/index.js ***!
|
2575
|
+
\*****************************************/
|
2937
2576
|
/*! no static exports found */
|
2938
2577
|
/***/ (function(module, exports, __webpack_require__) {
|
2939
2578
|
|
2940
2579
|
"use strict";
|
2941
|
-
// Copyright Joyent, Inc. and other Node contributors.
|
2942
|
-
//
|
2943
|
-
// Permission is hereby granted, free of charge, to any person obtaining a
|
2944
|
-
// copy of this software and associated documentation files (the
|
2945
|
-
// "Software"), to deal in the Software without restriction, including
|
2946
|
-
// without limitation the rights to use, copy, modify, merge, publish,
|
2947
|
-
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
2948
|
-
// persons to whom the Software is furnished to do so, subject to the
|
2949
|
-
// following conditions:
|
2950
|
-
//
|
2951
|
-
// The above copyright notice and this permission notice shall be included
|
2952
|
-
// in all copies or substantial portions of the Software.
|
2953
|
-
//
|
2954
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
2955
|
-
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
2956
|
-
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
2957
|
-
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
2958
|
-
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
2959
|
-
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
2960
|
-
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
2961
2580
|
|
2962
2581
|
|
2582
|
+
exports.byteLength = byteLength
|
2583
|
+
exports.toByteArray = toByteArray
|
2584
|
+
exports.fromByteArray = fromByteArray
|
2963
2585
|
|
2964
|
-
|
2965
|
-
|
2966
|
-
|
2967
|
-
function hasOwnProperty(obj, prop) {
|
2968
|
-
return Object.prototype.hasOwnProperty.call(obj, prop);
|
2969
|
-
}
|
2586
|
+
var lookup = []
|
2587
|
+
var revLookup = []
|
2588
|
+
var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
|
2970
2589
|
|
2971
|
-
|
2972
|
-
|
2973
|
-
|
2974
|
-
|
2590
|
+
var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
|
2591
|
+
for (var i = 0, len = code.length; i < len; ++i) {
|
2592
|
+
lookup[i] = code[i]
|
2593
|
+
revLookup[code.charCodeAt(i)] = i
|
2594
|
+
}
|
2975
2595
|
|
2976
|
-
|
2977
|
-
|
2978
|
-
|
2596
|
+
// Support decoding URL-safe base64 strings, as Node.js does.
|
2597
|
+
// See: https://en.wikipedia.org/wiki/Base64#URL_applications
|
2598
|
+
revLookup['-'.charCodeAt(0)] = 62
|
2599
|
+
revLookup['_'.charCodeAt(0)] = 63
|
2979
2600
|
|
2980
|
-
|
2981
|
-
|
2601
|
+
function getLens (b64) {
|
2602
|
+
var len = b64.length
|
2982
2603
|
|
2983
|
-
|
2984
|
-
|
2985
|
-
maxKeys = options.maxKeys;
|
2604
|
+
if (len % 4 > 0) {
|
2605
|
+
throw new Error('Invalid string. Length must be a multiple of 4')
|
2986
2606
|
}
|
2987
2607
|
|
2988
|
-
|
2989
|
-
//
|
2990
|
-
|
2991
|
-
|
2992
|
-
}
|
2608
|
+
// Trim off extra bytes after placeholder bytes are found
|
2609
|
+
// See: https://github.com/beatgammit/base64-js/issues/42
|
2610
|
+
var validLen = b64.indexOf('=')
|
2611
|
+
if (validLen === -1) validLen = len
|
2993
2612
|
|
2994
|
-
|
2995
|
-
|
2996
|
-
|
2997
|
-
kstr, vstr, k, v;
|
2613
|
+
var placeHoldersLen = validLen === len
|
2614
|
+
? 0
|
2615
|
+
: 4 - (validLen % 4)
|
2998
2616
|
|
2999
|
-
|
3000
|
-
|
3001
|
-
vstr = x.substr(idx + 1);
|
3002
|
-
} else {
|
3003
|
-
kstr = x;
|
3004
|
-
vstr = '';
|
3005
|
-
}
|
2617
|
+
return [validLen, placeHoldersLen]
|
2618
|
+
}
|
3006
2619
|
|
3007
|
-
|
3008
|
-
|
2620
|
+
// base64 is 4/3 + up to two characters of the original data
|
2621
|
+
function byteLength (b64) {
|
2622
|
+
var lens = getLens(b64)
|
2623
|
+
var validLen = lens[0]
|
2624
|
+
var placeHoldersLen = lens[1]
|
2625
|
+
return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
|
2626
|
+
}
|
3009
2627
|
|
3010
|
-
|
3011
|
-
|
3012
|
-
|
3013
|
-
|
3014
|
-
|
3015
|
-
|
3016
|
-
|
2628
|
+
function _byteLength (b64, validLen, placeHoldersLen) {
|
2629
|
+
return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
|
2630
|
+
}
|
2631
|
+
|
2632
|
+
function toByteArray (b64) {
|
2633
|
+
var tmp
|
2634
|
+
var lens = getLens(b64)
|
2635
|
+
var validLen = lens[0]
|
2636
|
+
var placeHoldersLen = lens[1]
|
2637
|
+
|
2638
|
+
var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
|
2639
|
+
|
2640
|
+
var curByte = 0
|
2641
|
+
|
2642
|
+
// if there are placeholders, only get up to the last complete 4 chars
|
2643
|
+
var len = placeHoldersLen > 0
|
2644
|
+
? validLen - 4
|
2645
|
+
: validLen
|
2646
|
+
|
2647
|
+
var i
|
2648
|
+
for (i = 0; i < len; i += 4) {
|
2649
|
+
tmp =
|
2650
|
+
(revLookup[b64.charCodeAt(i)] << 18) |
|
2651
|
+
(revLookup[b64.charCodeAt(i + 1)] << 12) |
|
2652
|
+
(revLookup[b64.charCodeAt(i + 2)] << 6) |
|
2653
|
+
revLookup[b64.charCodeAt(i + 3)]
|
2654
|
+
arr[curByte++] = (tmp >> 16) & 0xFF
|
2655
|
+
arr[curByte++] = (tmp >> 8) & 0xFF
|
2656
|
+
arr[curByte++] = tmp & 0xFF
|
3017
2657
|
}
|
3018
2658
|
|
3019
|
-
|
3020
|
-
|
2659
|
+
if (placeHoldersLen === 2) {
|
2660
|
+
tmp =
|
2661
|
+
(revLookup[b64.charCodeAt(i)] << 2) |
|
2662
|
+
(revLookup[b64.charCodeAt(i + 1)] >> 4)
|
2663
|
+
arr[curByte++] = tmp & 0xFF
|
2664
|
+
}
|
3021
2665
|
|
3022
|
-
|
3023
|
-
|
3024
|
-
|
2666
|
+
if (placeHoldersLen === 1) {
|
2667
|
+
tmp =
|
2668
|
+
(revLookup[b64.charCodeAt(i)] << 10) |
|
2669
|
+
(revLookup[b64.charCodeAt(i + 1)] << 4) |
|
2670
|
+
(revLookup[b64.charCodeAt(i + 2)] >> 2)
|
2671
|
+
arr[curByte++] = (tmp >> 8) & 0xFF
|
2672
|
+
arr[curByte++] = tmp & 0xFF
|
2673
|
+
}
|
3025
2674
|
|
2675
|
+
return arr
|
2676
|
+
}
|
3026
2677
|
|
3027
|
-
|
2678
|
+
function tripletToBase64 (num) {
|
2679
|
+
return lookup[num >> 18 & 0x3F] +
|
2680
|
+
lookup[num >> 12 & 0x3F] +
|
2681
|
+
lookup[num >> 6 & 0x3F] +
|
2682
|
+
lookup[num & 0x3F]
|
2683
|
+
}
|
3028
2684
|
|
3029
|
-
|
3030
|
-
|
3031
|
-
|
3032
|
-
|
3033
|
-
|
3034
|
-
|
2685
|
+
function encodeChunk (uint8, start, end) {
|
2686
|
+
var tmp
|
2687
|
+
var output = []
|
2688
|
+
for (var i = start; i < end; i += 3) {
|
2689
|
+
tmp =
|
2690
|
+
((uint8[i] << 16) & 0xFF0000) +
|
2691
|
+
((uint8[i + 1] << 8) & 0xFF00) +
|
2692
|
+
(uint8[i + 2] & 0xFF)
|
2693
|
+
output.push(tripletToBase64(tmp))
|
2694
|
+
}
|
2695
|
+
return output.join('')
|
2696
|
+
}
|
3035
2697
|
|
3036
|
-
|
3037
|
-
|
3038
|
-
|
3039
|
-
|
3040
|
-
|
3041
|
-
|
3042
|
-
// without limitation the rights to use, copy, modify, merge, publish,
|
3043
|
-
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
3044
|
-
// persons to whom the Software is furnished to do so, subject to the
|
3045
|
-
// following conditions:
|
3046
|
-
//
|
3047
|
-
// The above copyright notice and this permission notice shall be included
|
3048
|
-
// in all copies or substantial portions of the Software.
|
3049
|
-
//
|
3050
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
3051
|
-
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
3052
|
-
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
3053
|
-
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
3054
|
-
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
3055
|
-
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
3056
|
-
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
2698
|
+
function fromByteArray (uint8) {
|
2699
|
+
var tmp
|
2700
|
+
var len = uint8.length
|
2701
|
+
var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
|
2702
|
+
var parts = []
|
2703
|
+
var maxChunkLength = 16383 // must be multiple of 3
|
3057
2704
|
|
2705
|
+
// go through the array every three bytes, we'll deal with trailing stuff later
|
2706
|
+
for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
|
2707
|
+
parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
|
2708
|
+
}
|
3058
2709
|
|
2710
|
+
// pad the end with zeros, but make sure to not forget the extra bytes
|
2711
|
+
if (extraBytes === 1) {
|
2712
|
+
tmp = uint8[len - 1]
|
2713
|
+
parts.push(
|
2714
|
+
lookup[tmp >> 2] +
|
2715
|
+
lookup[(tmp << 4) & 0x3F] +
|
2716
|
+
'=='
|
2717
|
+
)
|
2718
|
+
} else if (extraBytes === 2) {
|
2719
|
+
tmp = (uint8[len - 2] << 8) + uint8[len - 1]
|
2720
|
+
parts.push(
|
2721
|
+
lookup[tmp >> 10] +
|
2722
|
+
lookup[(tmp >> 4) & 0x3F] +
|
2723
|
+
lookup[(tmp << 2) & 0x3F] +
|
2724
|
+
'='
|
2725
|
+
)
|
2726
|
+
}
|
3059
2727
|
|
3060
|
-
|
3061
|
-
|
3062
|
-
case 'string':
|
3063
|
-
return v;
|
2728
|
+
return parts.join('')
|
2729
|
+
}
|
3064
2730
|
|
3065
|
-
case 'boolean':
|
3066
|
-
return v ? 'true' : 'false';
|
3067
2731
|
|
3068
|
-
|
3069
|
-
return isFinite(v) ? v : '';
|
2732
|
+
/***/ }),
|
3070
2733
|
|
3071
|
-
|
3072
|
-
|
3073
|
-
|
3074
|
-
|
2734
|
+
/***/ "./node_modules/ieee754/index.js":
|
2735
|
+
/*!***************************************!*\
|
2736
|
+
!*** ./node_modules/ieee754/index.js ***!
|
2737
|
+
\***************************************/
|
2738
|
+
/*! no static exports found */
|
2739
|
+
/***/ (function(module, exports) {
|
3075
2740
|
|
3076
|
-
|
3077
|
-
|
3078
|
-
|
3079
|
-
|
3080
|
-
|
2741
|
+
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
2742
|
+
exports.read = function (buffer, offset, isLE, mLen, nBytes) {
|
2743
|
+
var e, m
|
2744
|
+
var eLen = (nBytes * 8) - mLen - 1
|
2745
|
+
var eMax = (1 << eLen) - 1
|
2746
|
+
var eBias = eMax >> 1
|
2747
|
+
var nBits = -7
|
2748
|
+
var i = isLE ? (nBytes - 1) : 0
|
2749
|
+
var d = isLE ? -1 : 1
|
2750
|
+
var s = buffer[offset + i]
|
2751
|
+
|
2752
|
+
i += d
|
2753
|
+
|
2754
|
+
e = s & ((1 << (-nBits)) - 1)
|
2755
|
+
s >>= (-nBits)
|
2756
|
+
nBits += eLen
|
2757
|
+
for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
|
2758
|
+
|
2759
|
+
m = e & ((1 << (-nBits)) - 1)
|
2760
|
+
e >>= (-nBits)
|
2761
|
+
nBits += mLen
|
2762
|
+
for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
|
2763
|
+
|
2764
|
+
if (e === 0) {
|
2765
|
+
e = 1 - eBias
|
2766
|
+
} else if (e === eMax) {
|
2767
|
+
return m ? NaN : ((s ? -1 : 1) * Infinity)
|
2768
|
+
} else {
|
2769
|
+
m = m + Math.pow(2, mLen)
|
2770
|
+
e = e - eBias
|
3081
2771
|
}
|
2772
|
+
return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
|
2773
|
+
}
|
3082
2774
|
|
3083
|
-
|
3084
|
-
|
3085
|
-
|
3086
|
-
|
3087
|
-
|
3088
|
-
|
3089
|
-
|
3090
|
-
|
3091
|
-
|
3092
|
-
|
3093
|
-
|
2775
|
+
exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
|
2776
|
+
var e, m, c
|
2777
|
+
var eLen = (nBytes * 8) - mLen - 1
|
2778
|
+
var eMax = (1 << eLen) - 1
|
2779
|
+
var eBias = eMax >> 1
|
2780
|
+
var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
|
2781
|
+
var i = isLE ? 0 : (nBytes - 1)
|
2782
|
+
var d = isLE ? 1 : -1
|
2783
|
+
var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
|
2784
|
+
|
2785
|
+
value = Math.abs(value)
|
2786
|
+
|
2787
|
+
if (isNaN(value) || value === Infinity) {
|
2788
|
+
m = isNaN(value) ? 1 : 0
|
2789
|
+
e = eMax
|
2790
|
+
} else {
|
2791
|
+
e = Math.floor(Math.log(value) / Math.LN2)
|
2792
|
+
if (value * (c = Math.pow(2, -e)) < 1) {
|
2793
|
+
e--
|
2794
|
+
c *= 2
|
2795
|
+
}
|
2796
|
+
if (e + eBias >= 1) {
|
2797
|
+
value += rt / c
|
2798
|
+
} else {
|
2799
|
+
value += rt * Math.pow(2, 1 - eBias)
|
2800
|
+
}
|
2801
|
+
if (value * c >= 2) {
|
2802
|
+
e++
|
2803
|
+
c /= 2
|
2804
|
+
}
|
3094
2805
|
|
2806
|
+
if (e + eBias >= eMax) {
|
2807
|
+
m = 0
|
2808
|
+
e = eMax
|
2809
|
+
} else if (e + eBias >= 1) {
|
2810
|
+
m = ((value * c) - 1) * Math.pow(2, mLen)
|
2811
|
+
e = e + eBias
|
2812
|
+
} else {
|
2813
|
+
m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
|
2814
|
+
e = 0
|
2815
|
+
}
|
3095
2816
|
}
|
3096
2817
|
|
3097
|
-
|
3098
|
-
return encodeURIComponent(stringifyPrimitive(name)) + eq +
|
3099
|
-
encodeURIComponent(stringifyPrimitive(obj));
|
3100
|
-
};
|
2818
|
+
for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
|
3101
2819
|
|
3102
|
-
|
3103
|
-
|
3104
|
-
}
|
2820
|
+
e = (e << mLen) | m
|
2821
|
+
eLen += mLen
|
2822
|
+
for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
|
3105
2823
|
|
3106
|
-
|
3107
|
-
if (xs.map) return xs.map(f);
|
3108
|
-
var res = [];
|
3109
|
-
for (var i = 0; i < xs.length; i++) {
|
3110
|
-
res.push(f(xs[i], i));
|
3111
|
-
}
|
3112
|
-
return res;
|
2824
|
+
buffer[offset + i - d] |= s * 128
|
3113
2825
|
}
|
3114
2826
|
|
3115
|
-
var objectKeys = Object.keys || function (obj) {
|
3116
|
-
var res = [];
|
3117
|
-
for (var key in obj) {
|
3118
|
-
if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key);
|
3119
|
-
}
|
3120
|
-
return res;
|
3121
|
-
};
|
3122
|
-
|
3123
2827
|
|
3124
2828
|
/***/ }),
|
3125
2829
|
|
3126
|
-
/***/ "./node_modules/
|
3127
|
-
|
3128
|
-
!*** ./node_modules/
|
3129
|
-
|
2830
|
+
/***/ "./node_modules/node-libs-browser/node_modules/buffer/index.js":
|
2831
|
+
/*!*********************************************************************!*\
|
2832
|
+
!*** ./node_modules/node-libs-browser/node_modules/buffer/index.js ***!
|
2833
|
+
\*********************************************************************/
|
3130
2834
|
/*! no static exports found */
|
3131
2835
|
/***/ (function(module, exports, __webpack_require__) {
|
3132
2836
|
|
3133
2837
|
"use strict";
|
2838
|
+
/* WEBPACK VAR INJECTION */(function(global) {/*!
|
2839
|
+
* The buffer module from node.js, for the browser.
|
2840
|
+
*
|
2841
|
+
* @author Feross Aboukhadijeh <http://feross.org>
|
2842
|
+
* @license MIT
|
2843
|
+
*/
|
2844
|
+
/* eslint-disable no-proto */
|
3134
2845
|
|
3135
2846
|
|
3136
|
-
exports.decode = exports.parse = __webpack_require__(/*! ./decode */ "./node_modules/querystring-es3/decode.js");
|
3137
|
-
exports.encode = exports.stringify = __webpack_require__(/*! ./encode */ "./node_modules/querystring-es3/encode.js");
|
3138
|
-
|
3139
|
-
|
3140
|
-
/***/ }),
|
3141
2847
|
|
3142
|
-
|
3143
|
-
|
3144
|
-
|
3145
|
-
\*********************************/
|
3146
|
-
/*! no static exports found */
|
3147
|
-
/***/ (function(module, exports, __webpack_require__) {
|
2848
|
+
var base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js")
|
2849
|
+
var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js")
|
2850
|
+
var isArray = __webpack_require__(/*! isarray */ "./node_modules/node-libs-browser/node_modules/isarray/index.js")
|
3148
2851
|
|
3149
|
-
|
3150
|
-
|
3151
|
-
|
3152
|
-
// Permission is hereby granted, free of charge, to any person obtaining a
|
3153
|
-
// copy of this software and associated documentation files (the
|
3154
|
-
// "Software"), to deal in the Software without restriction, including
|
3155
|
-
// without limitation the rights to use, copy, modify, merge, publish,
|
3156
|
-
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
3157
|
-
// persons to whom the Software is furnished to do so, subject to the
|
3158
|
-
// following conditions:
|
3159
|
-
//
|
3160
|
-
// The above copyright notice and this permission notice shall be included
|
3161
|
-
// in all copies or substantial portions of the Software.
|
3162
|
-
//
|
3163
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
3164
|
-
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
3165
|
-
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
3166
|
-
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
3167
|
-
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
3168
|
-
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
3169
|
-
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
3170
|
-
|
3171
|
-
|
3172
|
-
|
3173
|
-
var punycode = __webpack_require__(/*! punycode */ "./node_modules/node-libs-browser/node_modules/punycode/punycode.js");
|
3174
|
-
var util = __webpack_require__(/*! ./util */ "./node_modules/url/util.js");
|
3175
|
-
|
3176
|
-
exports.parse = urlParse;
|
3177
|
-
exports.resolve = urlResolve;
|
3178
|
-
exports.resolveObject = urlResolveObject;
|
3179
|
-
exports.format = urlFormat;
|
3180
|
-
|
3181
|
-
exports.Url = Url;
|
3182
|
-
|
3183
|
-
function Url() {
|
3184
|
-
this.protocol = null;
|
3185
|
-
this.slashes = null;
|
3186
|
-
this.auth = null;
|
3187
|
-
this.host = null;
|
3188
|
-
this.port = null;
|
3189
|
-
this.hostname = null;
|
3190
|
-
this.hash = null;
|
3191
|
-
this.search = null;
|
3192
|
-
this.query = null;
|
3193
|
-
this.pathname = null;
|
3194
|
-
this.path = null;
|
3195
|
-
this.href = null;
|
3196
|
-
}
|
3197
|
-
|
3198
|
-
// Reference: RFC 3986, RFC 1808, RFC 2396
|
3199
|
-
|
3200
|
-
// define these here so at least they only have to be
|
3201
|
-
// compiled once on the first module load.
|
3202
|
-
var protocolPattern = /^([a-z0-9.+-]+:)/i,
|
3203
|
-
portPattern = /:[0-9]*$/,
|
3204
|
-
|
3205
|
-
// Special case for a simple path URL
|
3206
|
-
simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,
|
3207
|
-
|
3208
|
-
// RFC 2396: characters reserved for delimiting URLs.
|
3209
|
-
// We actually just auto-escape these.
|
3210
|
-
delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'],
|
3211
|
-
|
3212
|
-
// RFC 2396: characters not allowed for various reasons.
|
3213
|
-
unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims),
|
3214
|
-
|
3215
|
-
// Allowed by RFCs, but cause of XSS attacks. Always escape these.
|
3216
|
-
autoEscape = ['\''].concat(unwise),
|
3217
|
-
// Characters that are never ever allowed in a hostname.
|
3218
|
-
// Note that any invalid chars are also handled, but these
|
3219
|
-
// are the ones that are *expected* to be seen, so we fast-path
|
3220
|
-
// them.
|
3221
|
-
nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape),
|
3222
|
-
hostEndingChars = ['/', '?', '#'],
|
3223
|
-
hostnameMaxLen = 255,
|
3224
|
-
hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,
|
3225
|
-
hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,
|
3226
|
-
// protocols that can allow "unsafe" and "unwise" chars.
|
3227
|
-
unsafeProtocol = {
|
3228
|
-
'javascript': true,
|
3229
|
-
'javascript:': true
|
3230
|
-
},
|
3231
|
-
// protocols that never have a hostname.
|
3232
|
-
hostlessProtocol = {
|
3233
|
-
'javascript': true,
|
3234
|
-
'javascript:': true
|
3235
|
-
},
|
3236
|
-
// protocols that always contain a // bit.
|
3237
|
-
slashedProtocol = {
|
3238
|
-
'http': true,
|
3239
|
-
'https': true,
|
3240
|
-
'ftp': true,
|
3241
|
-
'gopher': true,
|
3242
|
-
'file': true,
|
3243
|
-
'http:': true,
|
3244
|
-
'https:': true,
|
3245
|
-
'ftp:': true,
|
3246
|
-
'gopher:': true,
|
3247
|
-
'file:': true
|
3248
|
-
},
|
3249
|
-
querystring = __webpack_require__(/*! querystring */ "./node_modules/querystring-es3/index.js");
|
3250
|
-
|
3251
|
-
function urlParse(url, parseQueryString, slashesDenoteHost) {
|
3252
|
-
if (url && util.isObject(url) && url instanceof Url) return url;
|
3253
|
-
|
3254
|
-
var u = new Url;
|
3255
|
-
u.parse(url, parseQueryString, slashesDenoteHost);
|
3256
|
-
return u;
|
3257
|
-
}
|
3258
|
-
|
3259
|
-
Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {
|
3260
|
-
if (!util.isString(url)) {
|
3261
|
-
throw new TypeError("Parameter 'url' must be a string, not " + typeof url);
|
3262
|
-
}
|
3263
|
-
|
3264
|
-
// Copy chrome, IE, opera backslash-handling behavior.
|
3265
|
-
// Back slashes before the query string get converted to forward slashes
|
3266
|
-
// See: https://code.google.com/p/chromium/issues/detail?id=25916
|
3267
|
-
var queryIndex = url.indexOf('?'),
|
3268
|
-
splitter =
|
3269
|
-
(queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#',
|
3270
|
-
uSplit = url.split(splitter),
|
3271
|
-
slashRegex = /\\/g;
|
3272
|
-
uSplit[0] = uSplit[0].replace(slashRegex, '/');
|
3273
|
-
url = uSplit.join(splitter);
|
3274
|
-
|
3275
|
-
var rest = url;
|
3276
|
-
|
3277
|
-
// trim before proceeding.
|
3278
|
-
// This is to support parse stuff like " http://foo.com \n"
|
3279
|
-
rest = rest.trim();
|
3280
|
-
|
3281
|
-
if (!slashesDenoteHost && url.split('#').length === 1) {
|
3282
|
-
// Try fast path regexp
|
3283
|
-
var simplePath = simplePathPattern.exec(rest);
|
3284
|
-
if (simplePath) {
|
3285
|
-
this.path = rest;
|
3286
|
-
this.href = rest;
|
3287
|
-
this.pathname = simplePath[1];
|
3288
|
-
if (simplePath[2]) {
|
3289
|
-
this.search = simplePath[2];
|
3290
|
-
if (parseQueryString) {
|
3291
|
-
this.query = querystring.parse(this.search.substr(1));
|
3292
|
-
} else {
|
3293
|
-
this.query = this.search.substr(1);
|
3294
|
-
}
|
3295
|
-
} else if (parseQueryString) {
|
3296
|
-
this.search = '';
|
3297
|
-
this.query = {};
|
3298
|
-
}
|
3299
|
-
return this;
|
3300
|
-
}
|
3301
|
-
}
|
3302
|
-
|
3303
|
-
var proto = protocolPattern.exec(rest);
|
3304
|
-
if (proto) {
|
3305
|
-
proto = proto[0];
|
3306
|
-
var lowerProto = proto.toLowerCase();
|
3307
|
-
this.protocol = lowerProto;
|
3308
|
-
rest = rest.substr(proto.length);
|
3309
|
-
}
|
3310
|
-
|
3311
|
-
// figure out if it's got a host
|
3312
|
-
// user@server is *always* interpreted as a hostname, and url
|
3313
|
-
// resolution will treat //foo/bar as host=foo,path=bar because that's
|
3314
|
-
// how the browser resolves relative URLs.
|
3315
|
-
if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) {
|
3316
|
-
var slashes = rest.substr(0, 2) === '//';
|
3317
|
-
if (slashes && !(proto && hostlessProtocol[proto])) {
|
3318
|
-
rest = rest.substr(2);
|
3319
|
-
this.slashes = true;
|
3320
|
-
}
|
3321
|
-
}
|
3322
|
-
|
3323
|
-
if (!hostlessProtocol[proto] &&
|
3324
|
-
(slashes || (proto && !slashedProtocol[proto]))) {
|
3325
|
-
|
3326
|
-
// there's a hostname.
|
3327
|
-
// the first instance of /, ?, ;, or # ends the host.
|
3328
|
-
//
|
3329
|
-
// If there is an @ in the hostname, then non-host chars *are* allowed
|
3330
|
-
// to the left of the last @ sign, unless some host-ending character
|
3331
|
-
// comes *before* the @-sign.
|
3332
|
-
// URLs are obnoxious.
|
3333
|
-
//
|
3334
|
-
// ex:
|
3335
|
-
// http://a@b@c/ => user:a@b host:c
|
3336
|
-
// http://a@b?@c => user:a host:c path:/?@c
|
3337
|
-
|
3338
|
-
// v0.12 TODO(isaacs): This is not quite how Chrome does things.
|
3339
|
-
// Review our test case against browsers more comprehensively.
|
3340
|
-
|
3341
|
-
// find the first instance of any hostEndingChars
|
3342
|
-
var hostEnd = -1;
|
3343
|
-
for (var i = 0; i < hostEndingChars.length; i++) {
|
3344
|
-
var hec = rest.indexOf(hostEndingChars[i]);
|
3345
|
-
if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))
|
3346
|
-
hostEnd = hec;
|
3347
|
-
}
|
3348
|
-
|
3349
|
-
// at this point, either we have an explicit point where the
|
3350
|
-
// auth portion cannot go past, or the last @ char is the decider.
|
3351
|
-
var auth, atSign;
|
3352
|
-
if (hostEnd === -1) {
|
3353
|
-
// atSign can be anywhere.
|
3354
|
-
atSign = rest.lastIndexOf('@');
|
3355
|
-
} else {
|
3356
|
-
// atSign must be in auth portion.
|
3357
|
-
// http://a@b/c@d => host:b auth:a path:/c@d
|
3358
|
-
atSign = rest.lastIndexOf('@', hostEnd);
|
3359
|
-
}
|
3360
|
-
|
3361
|
-
// Now we have a portion which is definitely the auth.
|
3362
|
-
// Pull that off.
|
3363
|
-
if (atSign !== -1) {
|
3364
|
-
auth = rest.slice(0, atSign);
|
3365
|
-
rest = rest.slice(atSign + 1);
|
3366
|
-
this.auth = decodeURIComponent(auth);
|
3367
|
-
}
|
3368
|
-
|
3369
|
-
// the host is the remaining to the left of the first non-host char
|
3370
|
-
hostEnd = -1;
|
3371
|
-
for (var i = 0; i < nonHostChars.length; i++) {
|
3372
|
-
var hec = rest.indexOf(nonHostChars[i]);
|
3373
|
-
if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))
|
3374
|
-
hostEnd = hec;
|
3375
|
-
}
|
3376
|
-
// if we still have not hit it, then the entire thing is a host.
|
3377
|
-
if (hostEnd === -1)
|
3378
|
-
hostEnd = rest.length;
|
3379
|
-
|
3380
|
-
this.host = rest.slice(0, hostEnd);
|
3381
|
-
rest = rest.slice(hostEnd);
|
3382
|
-
|
3383
|
-
// pull out port.
|
3384
|
-
this.parseHost();
|
3385
|
-
|
3386
|
-
// we've indicated that there is a hostname,
|
3387
|
-
// so even if it's empty, it has to be present.
|
3388
|
-
this.hostname = this.hostname || '';
|
3389
|
-
|
3390
|
-
// if hostname begins with [ and ends with ]
|
3391
|
-
// assume that it's an IPv6 address.
|
3392
|
-
var ipv6Hostname = this.hostname[0] === '[' &&
|
3393
|
-
this.hostname[this.hostname.length - 1] === ']';
|
3394
|
-
|
3395
|
-
// validate a little.
|
3396
|
-
if (!ipv6Hostname) {
|
3397
|
-
var hostparts = this.hostname.split(/\./);
|
3398
|
-
for (var i = 0, l = hostparts.length; i < l; i++) {
|
3399
|
-
var part = hostparts[i];
|
3400
|
-
if (!part) continue;
|
3401
|
-
if (!part.match(hostnamePartPattern)) {
|
3402
|
-
var newpart = '';
|
3403
|
-
for (var j = 0, k = part.length; j < k; j++) {
|
3404
|
-
if (part.charCodeAt(j) > 127) {
|
3405
|
-
// we replace non-ASCII char with a temporary placeholder
|
3406
|
-
// we need this to make sure size of hostname is not
|
3407
|
-
// broken by replacing non-ASCII by nothing
|
3408
|
-
newpart += 'x';
|
3409
|
-
} else {
|
3410
|
-
newpart += part[j];
|
3411
|
-
}
|
3412
|
-
}
|
3413
|
-
// we test again with ASCII char only
|
3414
|
-
if (!newpart.match(hostnamePartPattern)) {
|
3415
|
-
var validParts = hostparts.slice(0, i);
|
3416
|
-
var notHost = hostparts.slice(i + 1);
|
3417
|
-
var bit = part.match(hostnamePartStart);
|
3418
|
-
if (bit) {
|
3419
|
-
validParts.push(bit[1]);
|
3420
|
-
notHost.unshift(bit[2]);
|
3421
|
-
}
|
3422
|
-
if (notHost.length) {
|
3423
|
-
rest = '/' + notHost.join('.') + rest;
|
3424
|
-
}
|
3425
|
-
this.hostname = validParts.join('.');
|
3426
|
-
break;
|
3427
|
-
}
|
3428
|
-
}
|
3429
|
-
}
|
3430
|
-
}
|
2852
|
+
exports.Buffer = Buffer
|
2853
|
+
exports.SlowBuffer = SlowBuffer
|
2854
|
+
exports.INSPECT_MAX_BYTES = 50
|
3431
2855
|
|
3432
|
-
|
3433
|
-
|
3434
|
-
|
3435
|
-
|
3436
|
-
|
3437
|
-
|
2856
|
+
/**
|
2857
|
+
* If `Buffer.TYPED_ARRAY_SUPPORT`:
|
2858
|
+
* === true Use Uint8Array implementation (fastest)
|
2859
|
+
* === false Use Object implementation (most compatible, even IE6)
|
2860
|
+
*
|
2861
|
+
* Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
|
2862
|
+
* Opera 11.6+, iOS 4.2+.
|
2863
|
+
*
|
2864
|
+
* Due to various browser bugs, sometimes the Object implementation will be used even
|
2865
|
+
* when the browser supports typed arrays.
|
2866
|
+
*
|
2867
|
+
* Note:
|
2868
|
+
*
|
2869
|
+
* - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
|
2870
|
+
* See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
|
2871
|
+
*
|
2872
|
+
* - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
|
2873
|
+
*
|
2874
|
+
* - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
|
2875
|
+
* incorrect length in some situations.
|
3438
2876
|
|
3439
|
-
|
3440
|
-
|
3441
|
-
|
3442
|
-
|
3443
|
-
|
3444
|
-
|
3445
|
-
}
|
2877
|
+
* We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
|
2878
|
+
* get the Object implementation, which is slower but behaves correctly.
|
2879
|
+
*/
|
2880
|
+
Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
|
2881
|
+
? global.TYPED_ARRAY_SUPPORT
|
2882
|
+
: typedArraySupport()
|
3446
2883
|
|
3447
|
-
|
3448
|
-
|
3449
|
-
|
3450
|
-
|
2884
|
+
/*
|
2885
|
+
* Export kMaxLength after typed array support is determined.
|
2886
|
+
*/
|
2887
|
+
exports.kMaxLength = kMaxLength()
|
3451
2888
|
|
3452
|
-
|
3453
|
-
|
3454
|
-
|
3455
|
-
|
3456
|
-
|
3457
|
-
|
3458
|
-
|
3459
|
-
|
2889
|
+
function typedArraySupport () {
|
2890
|
+
try {
|
2891
|
+
var arr = new Uint8Array(1)
|
2892
|
+
arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
|
2893
|
+
return arr.foo() === 42 && // typed array instances can be augmented
|
2894
|
+
typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
|
2895
|
+
arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
|
2896
|
+
} catch (e) {
|
2897
|
+
return false
|
3460
2898
|
}
|
2899
|
+
}
|
3461
2900
|
|
3462
|
-
|
3463
|
-
|
3464
|
-
|
2901
|
+
function kMaxLength () {
|
2902
|
+
return Buffer.TYPED_ARRAY_SUPPORT
|
2903
|
+
? 0x7fffffff
|
2904
|
+
: 0x3fffffff
|
2905
|
+
}
|
3465
2906
|
|
3466
|
-
|
3467
|
-
|
3468
|
-
|
3469
|
-
|
3470
|
-
|
3471
|
-
|
3472
|
-
|
3473
|
-
|
3474
|
-
|
3475
|
-
|
3476
|
-
|
3477
|
-
|
2907
|
+
function createBuffer (that, length) {
|
2908
|
+
if (kMaxLength() < length) {
|
2909
|
+
throw new RangeError('Invalid typed array length')
|
2910
|
+
}
|
2911
|
+
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
2912
|
+
// Return an augmented `Uint8Array` instance, for best performance
|
2913
|
+
that = new Uint8Array(length)
|
2914
|
+
that.__proto__ = Buffer.prototype
|
2915
|
+
} else {
|
2916
|
+
// Fallback: Return an object instance of the Buffer class
|
2917
|
+
if (that === null) {
|
2918
|
+
that = new Buffer(length)
|
3478
2919
|
}
|
2920
|
+
that.length = length
|
3479
2921
|
}
|
3480
2922
|
|
2923
|
+
return that
|
2924
|
+
}
|
3481
2925
|
|
3482
|
-
|
3483
|
-
|
3484
|
-
|
3485
|
-
|
3486
|
-
|
3487
|
-
|
3488
|
-
|
3489
|
-
|
3490
|
-
|
3491
|
-
|
3492
|
-
|
3493
|
-
|
3494
|
-
|
3495
|
-
}
|
3496
|
-
rest = rest.slice(0, qm);
|
3497
|
-
} else if (parseQueryString) {
|
3498
|
-
// no query string, but parseQueryString still requested
|
3499
|
-
this.search = '';
|
3500
|
-
this.query = {};
|
3501
|
-
}
|
3502
|
-
if (rest) this.pathname = rest;
|
3503
|
-
if (slashedProtocol[lowerProto] &&
|
3504
|
-
this.hostname && !this.pathname) {
|
3505
|
-
this.pathname = '/';
|
2926
|
+
/**
|
2927
|
+
* The Buffer constructor returns instances of `Uint8Array` that have their
|
2928
|
+
* prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
|
2929
|
+
* `Uint8Array`, so the returned instances will have all the node `Buffer` methods
|
2930
|
+
* and the `Uint8Array` methods. Square bracket notation works as expected -- it
|
2931
|
+
* returns a single octet.
|
2932
|
+
*
|
2933
|
+
* The `Uint8Array` prototype remains unmodified.
|
2934
|
+
*/
|
2935
|
+
|
2936
|
+
function Buffer (arg, encodingOrOffset, length) {
|
2937
|
+
if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
|
2938
|
+
return new Buffer(arg, encodingOrOffset, length)
|
3506
2939
|
}
|
3507
2940
|
|
3508
|
-
//
|
3509
|
-
if (
|
3510
|
-
|
3511
|
-
|
3512
|
-
|
2941
|
+
// Common case.
|
2942
|
+
if (typeof arg === 'number') {
|
2943
|
+
if (typeof encodingOrOffset === 'string') {
|
2944
|
+
throw new Error(
|
2945
|
+
'If encoding is specified then the first argument must be a string'
|
2946
|
+
)
|
2947
|
+
}
|
2948
|
+
return allocUnsafe(this, arg)
|
3513
2949
|
}
|
2950
|
+
return from(this, arg, encodingOrOffset, length)
|
2951
|
+
}
|
3514
2952
|
|
3515
|
-
|
3516
|
-
this.href = this.format();
|
3517
|
-
return this;
|
3518
|
-
};
|
2953
|
+
Buffer.poolSize = 8192 // not used by this implementation
|
3519
2954
|
|
3520
|
-
//
|
3521
|
-
function
|
3522
|
-
|
3523
|
-
|
3524
|
-
// this way, you can call url_format() on strings
|
3525
|
-
// to clean up potentially wonky urls.
|
3526
|
-
if (util.isString(obj)) obj = urlParse(obj);
|
3527
|
-
if (!(obj instanceof Url)) return Url.prototype.format.call(obj);
|
3528
|
-
return obj.format();
|
2955
|
+
// TODO: Legacy, not needed anymore. Remove in next major version.
|
2956
|
+
Buffer._augment = function (arr) {
|
2957
|
+
arr.__proto__ = Buffer.prototype
|
2958
|
+
return arr
|
3529
2959
|
}
|
3530
2960
|
|
3531
|
-
|
3532
|
-
|
3533
|
-
|
3534
|
-
auth = encodeURIComponent(auth);
|
3535
|
-
auth = auth.replace(/%3A/i, ':');
|
3536
|
-
auth += '@';
|
2961
|
+
function from (that, value, encodingOrOffset, length) {
|
2962
|
+
if (typeof value === 'number') {
|
2963
|
+
throw new TypeError('"value" argument must not be a number')
|
3537
2964
|
}
|
3538
2965
|
|
3539
|
-
|
3540
|
-
|
3541
|
-
hash = this.hash || '',
|
3542
|
-
host = false,
|
3543
|
-
query = '';
|
3544
|
-
|
3545
|
-
if (this.host) {
|
3546
|
-
host = auth + this.host;
|
3547
|
-
} else if (this.hostname) {
|
3548
|
-
host = auth + (this.hostname.indexOf(':') === -1 ?
|
3549
|
-
this.hostname :
|
3550
|
-
'[' + this.hostname + ']');
|
3551
|
-
if (this.port) {
|
3552
|
-
host += ':' + this.port;
|
3553
|
-
}
|
2966
|
+
if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
|
2967
|
+
return fromArrayBuffer(that, value, encodingOrOffset, length)
|
3554
2968
|
}
|
3555
2969
|
|
3556
|
-
if (
|
3557
|
-
|
3558
|
-
Object.keys(this.query).length) {
|
3559
|
-
query = querystring.stringify(this.query);
|
2970
|
+
if (typeof value === 'string') {
|
2971
|
+
return fromString(that, value, encodingOrOffset)
|
3560
2972
|
}
|
3561
2973
|
|
3562
|
-
|
2974
|
+
return fromObject(that, value)
|
2975
|
+
}
|
3563
2976
|
|
3564
|
-
|
2977
|
+
/**
|
2978
|
+
* Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
|
2979
|
+
* if value is a number.
|
2980
|
+
* Buffer.from(str[, encoding])
|
2981
|
+
* Buffer.from(array)
|
2982
|
+
* Buffer.from(buffer)
|
2983
|
+
* Buffer.from(arrayBuffer[, byteOffset[, length]])
|
2984
|
+
**/
|
2985
|
+
Buffer.from = function (value, encodingOrOffset, length) {
|
2986
|
+
return from(null, value, encodingOrOffset, length)
|
2987
|
+
}
|
3565
2988
|
|
3566
|
-
|
3567
|
-
|
3568
|
-
|
3569
|
-
|
3570
|
-
|
3571
|
-
|
3572
|
-
|
3573
|
-
|
2989
|
+
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
2990
|
+
Buffer.prototype.__proto__ = Uint8Array.prototype
|
2991
|
+
Buffer.__proto__ = Uint8Array
|
2992
|
+
if (typeof Symbol !== 'undefined' && Symbol.species &&
|
2993
|
+
Buffer[Symbol.species] === Buffer) {
|
2994
|
+
// Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
|
2995
|
+
Object.defineProperty(Buffer, Symbol.species, {
|
2996
|
+
value: null,
|
2997
|
+
configurable: true
|
2998
|
+
})
|
3574
2999
|
}
|
3575
|
-
|
3576
|
-
if (hash && hash.charAt(0) !== '#') hash = '#' + hash;
|
3577
|
-
if (search && search.charAt(0) !== '?') search = '?' + search;
|
3578
|
-
|
3579
|
-
pathname = pathname.replace(/[?#]/g, function(match) {
|
3580
|
-
return encodeURIComponent(match);
|
3581
|
-
});
|
3582
|
-
search = search.replace('#', '%23');
|
3583
|
-
|
3584
|
-
return protocol + host + pathname + search + hash;
|
3585
|
-
};
|
3586
|
-
|
3587
|
-
function urlResolve(source, relative) {
|
3588
|
-
return urlParse(source, false, true).resolve(relative);
|
3589
3000
|
}
|
3590
3001
|
|
3591
|
-
|
3592
|
-
|
3593
|
-
|
3594
|
-
|
3595
|
-
|
3596
|
-
|
3597
|
-
return urlParse(source, false, true).resolveObject(relative);
|
3002
|
+
function assertSize (size) {
|
3003
|
+
if (typeof size !== 'number') {
|
3004
|
+
throw new TypeError('"size" argument must be a number')
|
3005
|
+
} else if (size < 0) {
|
3006
|
+
throw new RangeError('"size" argument must not be negative')
|
3007
|
+
}
|
3598
3008
|
}
|
3599
3009
|
|
3600
|
-
|
3601
|
-
|
3602
|
-
|
3603
|
-
|
3604
|
-
relative = rel;
|
3010
|
+
function alloc (that, size, fill, encoding) {
|
3011
|
+
assertSize(size)
|
3012
|
+
if (size <= 0) {
|
3013
|
+
return createBuffer(that, size)
|
3605
3014
|
}
|
3606
|
-
|
3607
|
-
|
3608
|
-
|
3609
|
-
|
3610
|
-
|
3611
|
-
|
3015
|
+
if (fill !== undefined) {
|
3016
|
+
// Only pay attention to encoding if it's a string. This
|
3017
|
+
// prevents accidentally sending in a number that would
|
3018
|
+
// be interpretted as a start offset.
|
3019
|
+
return typeof encoding === 'string'
|
3020
|
+
? createBuffer(that, size).fill(fill, encoding)
|
3021
|
+
: createBuffer(that, size).fill(fill)
|
3612
3022
|
}
|
3023
|
+
return createBuffer(that, size)
|
3024
|
+
}
|
3613
3025
|
|
3614
|
-
|
3615
|
-
|
3616
|
-
|
3026
|
+
/**
|
3027
|
+
* Creates a new filled Buffer instance.
|
3028
|
+
* alloc(size[, fill[, encoding]])
|
3029
|
+
**/
|
3030
|
+
Buffer.alloc = function (size, fill, encoding) {
|
3031
|
+
return alloc(null, size, fill, encoding)
|
3032
|
+
}
|
3033
|
+
|
3034
|
+
function allocUnsafe (that, size) {
|
3035
|
+
assertSize(size)
|
3036
|
+
that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
|
3037
|
+
if (!Buffer.TYPED_ARRAY_SUPPORT) {
|
3038
|
+
for (var i = 0; i < size; ++i) {
|
3039
|
+
that[i] = 0
|
3040
|
+
}
|
3041
|
+
}
|
3042
|
+
return that
|
3043
|
+
}
|
3044
|
+
|
3045
|
+
/**
|
3046
|
+
* Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
|
3047
|
+
* */
|
3048
|
+
Buffer.allocUnsafe = function (size) {
|
3049
|
+
return allocUnsafe(null, size)
|
3050
|
+
}
|
3051
|
+
/**
|
3052
|
+
* Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
3053
|
+
*/
|
3054
|
+
Buffer.allocUnsafeSlow = function (size) {
|
3055
|
+
return allocUnsafe(null, size)
|
3056
|
+
}
|
3057
|
+
|
3058
|
+
function fromString (that, string, encoding) {
|
3059
|
+
if (typeof encoding !== 'string' || encoding === '') {
|
3060
|
+
encoding = 'utf8'
|
3061
|
+
}
|
3062
|
+
|
3063
|
+
if (!Buffer.isEncoding(encoding)) {
|
3064
|
+
throw new TypeError('"encoding" must be a valid string encoding')
|
3065
|
+
}
|
3066
|
+
|
3067
|
+
var length = byteLength(string, encoding) | 0
|
3068
|
+
that = createBuffer(that, length)
|
3069
|
+
|
3070
|
+
var actual = that.write(string, encoding)
|
3071
|
+
|
3072
|
+
if (actual !== length) {
|
3073
|
+
// Writing a hex string, for example, that contains invalid characters will
|
3074
|
+
// cause everything after the first invalid character to be ignored. (e.g.
|
3075
|
+
// 'abxxcd' will be treated as 'ab')
|
3076
|
+
that = that.slice(0, actual)
|
3077
|
+
}
|
3078
|
+
|
3079
|
+
return that
|
3080
|
+
}
|
3081
|
+
|
3082
|
+
function fromArrayLike (that, array) {
|
3083
|
+
var length = array.length < 0 ? 0 : checked(array.length) | 0
|
3084
|
+
that = createBuffer(that, length)
|
3085
|
+
for (var i = 0; i < length; i += 1) {
|
3086
|
+
that[i] = array[i] & 255
|
3087
|
+
}
|
3088
|
+
return that
|
3089
|
+
}
|
3090
|
+
|
3091
|
+
function fromArrayBuffer (that, array, byteOffset, length) {
|
3092
|
+
array.byteLength // this throws if `array` is not a valid ArrayBuffer
|
3093
|
+
|
3094
|
+
if (byteOffset < 0 || array.byteLength < byteOffset) {
|
3095
|
+
throw new RangeError('\'offset\' is out of bounds')
|
3096
|
+
}
|
3097
|
+
|
3098
|
+
if (array.byteLength < byteOffset + (length || 0)) {
|
3099
|
+
throw new RangeError('\'length\' is out of bounds')
|
3100
|
+
}
|
3101
|
+
|
3102
|
+
if (byteOffset === undefined && length === undefined) {
|
3103
|
+
array = new Uint8Array(array)
|
3104
|
+
} else if (length === undefined) {
|
3105
|
+
array = new Uint8Array(array, byteOffset)
|
3106
|
+
} else {
|
3107
|
+
array = new Uint8Array(array, byteOffset, length)
|
3108
|
+
}
|
3109
|
+
|
3110
|
+
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
3111
|
+
// Return an augmented `Uint8Array` instance, for best performance
|
3112
|
+
that = array
|
3113
|
+
that.__proto__ = Buffer.prototype
|
3114
|
+
} else {
|
3115
|
+
// Fallback: Return an object instance of the Buffer class
|
3116
|
+
that = fromArrayLike(that, array)
|
3117
|
+
}
|
3118
|
+
return that
|
3119
|
+
}
|
3120
|
+
|
3121
|
+
function fromObject (that, obj) {
|
3122
|
+
if (Buffer.isBuffer(obj)) {
|
3123
|
+
var len = checked(obj.length) | 0
|
3124
|
+
that = createBuffer(that, len)
|
3125
|
+
|
3126
|
+
if (that.length === 0) {
|
3127
|
+
return that
|
3128
|
+
}
|
3617
3129
|
|
3618
|
-
|
3619
|
-
|
3620
|
-
result.href = result.format();
|
3621
|
-
return result;
|
3130
|
+
obj.copy(that, 0, 0, len)
|
3131
|
+
return that
|
3622
3132
|
}
|
3623
3133
|
|
3624
|
-
|
3625
|
-
|
3626
|
-
|
3627
|
-
|
3628
|
-
|
3629
|
-
|
3630
|
-
|
3631
|
-
result[rkey] = relative[rkey];
|
3134
|
+
if (obj) {
|
3135
|
+
if ((typeof ArrayBuffer !== 'undefined' &&
|
3136
|
+
obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
|
3137
|
+
if (typeof obj.length !== 'number' || isnan(obj.length)) {
|
3138
|
+
return createBuffer(that, 0)
|
3139
|
+
}
|
3140
|
+
return fromArrayLike(that, obj)
|
3632
3141
|
}
|
3633
3142
|
|
3634
|
-
|
3635
|
-
|
3636
|
-
result.hostname && !result.pathname) {
|
3637
|
-
result.path = result.pathname = '/';
|
3143
|
+
if (obj.type === 'Buffer' && isArray(obj.data)) {
|
3144
|
+
return fromArrayLike(that, obj.data)
|
3638
3145
|
}
|
3146
|
+
}
|
3147
|
+
|
3148
|
+
throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
|
3149
|
+
}
|
3639
3150
|
|
3640
|
-
|
3641
|
-
|
3151
|
+
function checked (length) {
|
3152
|
+
// Note: cannot use `length < kMaxLength()` here because that fails when
|
3153
|
+
// length is NaN (which is otherwise coerced to zero.)
|
3154
|
+
if (length >= kMaxLength()) {
|
3155
|
+
throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
|
3156
|
+
'size: 0x' + kMaxLength().toString(16) + ' bytes')
|
3642
3157
|
}
|
3158
|
+
return length | 0
|
3159
|
+
}
|
3643
3160
|
|
3644
|
-
|
3645
|
-
|
3646
|
-
|
3647
|
-
|
3648
|
-
|
3649
|
-
|
3650
|
-
|
3651
|
-
|
3652
|
-
|
3653
|
-
|
3654
|
-
|
3655
|
-
|
3656
|
-
|
3657
|
-
|
3161
|
+
function SlowBuffer (length) {
|
3162
|
+
if (+length != length) { // eslint-disable-line eqeqeq
|
3163
|
+
length = 0
|
3164
|
+
}
|
3165
|
+
return Buffer.alloc(+length)
|
3166
|
+
}
|
3167
|
+
|
3168
|
+
Buffer.isBuffer = function isBuffer (b) {
|
3169
|
+
return !!(b != null && b._isBuffer)
|
3170
|
+
}
|
3171
|
+
|
3172
|
+
Buffer.compare = function compare (a, b) {
|
3173
|
+
if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
|
3174
|
+
throw new TypeError('Arguments must be Buffers')
|
3175
|
+
}
|
3176
|
+
|
3177
|
+
if (a === b) return 0
|
3178
|
+
|
3179
|
+
var x = a.length
|
3180
|
+
var y = b.length
|
3181
|
+
|
3182
|
+
for (var i = 0, len = Math.min(x, y); i < len; ++i) {
|
3183
|
+
if (a[i] !== b[i]) {
|
3184
|
+
x = a[i]
|
3185
|
+
y = b[i]
|
3186
|
+
break
|
3187
|
+
}
|
3188
|
+
}
|
3189
|
+
|
3190
|
+
if (x < y) return -1
|
3191
|
+
if (y < x) return 1
|
3192
|
+
return 0
|
3193
|
+
}
|
3194
|
+
|
3195
|
+
Buffer.isEncoding = function isEncoding (encoding) {
|
3196
|
+
switch (String(encoding).toLowerCase()) {
|
3197
|
+
case 'hex':
|
3198
|
+
case 'utf8':
|
3199
|
+
case 'utf-8':
|
3200
|
+
case 'ascii':
|
3201
|
+
case 'latin1':
|
3202
|
+
case 'binary':
|
3203
|
+
case 'base64':
|
3204
|
+
case 'ucs2':
|
3205
|
+
case 'ucs-2':
|
3206
|
+
case 'utf16le':
|
3207
|
+
case 'utf-16le':
|
3208
|
+
return true
|
3209
|
+
default:
|
3210
|
+
return false
|
3211
|
+
}
|
3212
|
+
}
|
3213
|
+
|
3214
|
+
Buffer.concat = function concat (list, length) {
|
3215
|
+
if (!isArray(list)) {
|
3216
|
+
throw new TypeError('"list" argument must be an Array of Buffers')
|
3217
|
+
}
|
3218
|
+
|
3219
|
+
if (list.length === 0) {
|
3220
|
+
return Buffer.alloc(0)
|
3221
|
+
}
|
3222
|
+
|
3223
|
+
var i
|
3224
|
+
if (length === undefined) {
|
3225
|
+
length = 0
|
3226
|
+
for (i = 0; i < list.length; ++i) {
|
3227
|
+
length += list[i].length
|
3228
|
+
}
|
3229
|
+
}
|
3230
|
+
|
3231
|
+
var buffer = Buffer.allocUnsafe(length)
|
3232
|
+
var pos = 0
|
3233
|
+
for (i = 0; i < list.length; ++i) {
|
3234
|
+
var buf = list[i]
|
3235
|
+
if (!Buffer.isBuffer(buf)) {
|
3236
|
+
throw new TypeError('"list" argument must be an Array of Buffers')
|
3237
|
+
}
|
3238
|
+
buf.copy(buffer, pos)
|
3239
|
+
pos += buf.length
|
3240
|
+
}
|
3241
|
+
return buffer
|
3242
|
+
}
|
3243
|
+
|
3244
|
+
function byteLength (string, encoding) {
|
3245
|
+
if (Buffer.isBuffer(string)) {
|
3246
|
+
return string.length
|
3247
|
+
}
|
3248
|
+
if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
|
3249
|
+
(ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
|
3250
|
+
return string.byteLength
|
3251
|
+
}
|
3252
|
+
if (typeof string !== 'string') {
|
3253
|
+
string = '' + string
|
3254
|
+
}
|
3255
|
+
|
3256
|
+
var len = string.length
|
3257
|
+
if (len === 0) return 0
|
3258
|
+
|
3259
|
+
// Use a for loop to avoid recursion
|
3260
|
+
var loweredCase = false
|
3261
|
+
for (;;) {
|
3262
|
+
switch (encoding) {
|
3263
|
+
case 'ascii':
|
3264
|
+
case 'latin1':
|
3265
|
+
case 'binary':
|
3266
|
+
return len
|
3267
|
+
case 'utf8':
|
3268
|
+
case 'utf-8':
|
3269
|
+
case undefined:
|
3270
|
+
return utf8ToBytes(string).length
|
3271
|
+
case 'ucs2':
|
3272
|
+
case 'ucs-2':
|
3273
|
+
case 'utf16le':
|
3274
|
+
case 'utf-16le':
|
3275
|
+
return len * 2
|
3276
|
+
case 'hex':
|
3277
|
+
return len >>> 1
|
3278
|
+
case 'base64':
|
3279
|
+
return base64ToBytes(string).length
|
3280
|
+
default:
|
3281
|
+
if (loweredCase) return utf8ToBytes(string).length // assume utf8
|
3282
|
+
encoding = ('' + encoding).toLowerCase()
|
3283
|
+
loweredCase = true
|
3284
|
+
}
|
3285
|
+
}
|
3286
|
+
}
|
3287
|
+
Buffer.byteLength = byteLength
|
3288
|
+
|
3289
|
+
function slowToString (encoding, start, end) {
|
3290
|
+
var loweredCase = false
|
3291
|
+
|
3292
|
+
// No need to verify that "this.length <= MAX_UINT32" since it's a read-only
|
3293
|
+
// property of a typed array.
|
3294
|
+
|
3295
|
+
// This behaves neither like String nor Uint8Array in that we set start/end
|
3296
|
+
// to their upper/lower bounds if the value passed is out of range.
|
3297
|
+
// undefined is handled specially as per ECMA-262 6th Edition,
|
3298
|
+
// Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
|
3299
|
+
if (start === undefined || start < 0) {
|
3300
|
+
start = 0
|
3301
|
+
}
|
3302
|
+
// Return early if start > this.length. Done here to prevent potential uint32
|
3303
|
+
// coercion fail below.
|
3304
|
+
if (start > this.length) {
|
3305
|
+
return ''
|
3306
|
+
}
|
3307
|
+
|
3308
|
+
if (end === undefined || end > this.length) {
|
3309
|
+
end = this.length
|
3310
|
+
}
|
3311
|
+
|
3312
|
+
if (end <= 0) {
|
3313
|
+
return ''
|
3314
|
+
}
|
3315
|
+
|
3316
|
+
// Force coersion to uint32. This will also coerce falsey/NaN values to 0.
|
3317
|
+
end >>>= 0
|
3318
|
+
start >>>= 0
|
3319
|
+
|
3320
|
+
if (end <= start) {
|
3321
|
+
return ''
|
3322
|
+
}
|
3323
|
+
|
3324
|
+
if (!encoding) encoding = 'utf8'
|
3325
|
+
|
3326
|
+
while (true) {
|
3327
|
+
switch (encoding) {
|
3328
|
+
case 'hex':
|
3329
|
+
return hexSlice(this, start, end)
|
3330
|
+
|
3331
|
+
case 'utf8':
|
3332
|
+
case 'utf-8':
|
3333
|
+
return utf8Slice(this, start, end)
|
3334
|
+
|
3335
|
+
case 'ascii':
|
3336
|
+
return asciiSlice(this, start, end)
|
3337
|
+
|
3338
|
+
case 'latin1':
|
3339
|
+
case 'binary':
|
3340
|
+
return latin1Slice(this, start, end)
|
3341
|
+
|
3342
|
+
case 'base64':
|
3343
|
+
return base64Slice(this, start, end)
|
3344
|
+
|
3345
|
+
case 'ucs2':
|
3346
|
+
case 'ucs-2':
|
3347
|
+
case 'utf16le':
|
3348
|
+
case 'utf-16le':
|
3349
|
+
return utf16leSlice(this, start, end)
|
3350
|
+
|
3351
|
+
default:
|
3352
|
+
if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
|
3353
|
+
encoding = (encoding + '').toLowerCase()
|
3354
|
+
loweredCase = true
|
3355
|
+
}
|
3356
|
+
}
|
3357
|
+
}
|
3358
|
+
|
3359
|
+
// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
|
3360
|
+
// Buffer instances.
|
3361
|
+
Buffer.prototype._isBuffer = true
|
3362
|
+
|
3363
|
+
function swap (b, n, m) {
|
3364
|
+
var i = b[n]
|
3365
|
+
b[n] = b[m]
|
3366
|
+
b[m] = i
|
3367
|
+
}
|
3368
|
+
|
3369
|
+
Buffer.prototype.swap16 = function swap16 () {
|
3370
|
+
var len = this.length
|
3371
|
+
if (len % 2 !== 0) {
|
3372
|
+
throw new RangeError('Buffer size must be a multiple of 16-bits')
|
3373
|
+
}
|
3374
|
+
for (var i = 0; i < len; i += 2) {
|
3375
|
+
swap(this, i, i + 1)
|
3376
|
+
}
|
3377
|
+
return this
|
3378
|
+
}
|
3379
|
+
|
3380
|
+
Buffer.prototype.swap32 = function swap32 () {
|
3381
|
+
var len = this.length
|
3382
|
+
if (len % 4 !== 0) {
|
3383
|
+
throw new RangeError('Buffer size must be a multiple of 32-bits')
|
3384
|
+
}
|
3385
|
+
for (var i = 0; i < len; i += 4) {
|
3386
|
+
swap(this, i, i + 3)
|
3387
|
+
swap(this, i + 1, i + 2)
|
3388
|
+
}
|
3389
|
+
return this
|
3390
|
+
}
|
3391
|
+
|
3392
|
+
Buffer.prototype.swap64 = function swap64 () {
|
3393
|
+
var len = this.length
|
3394
|
+
if (len % 8 !== 0) {
|
3395
|
+
throw new RangeError('Buffer size must be a multiple of 64-bits')
|
3396
|
+
}
|
3397
|
+
for (var i = 0; i < len; i += 8) {
|
3398
|
+
swap(this, i, i + 7)
|
3399
|
+
swap(this, i + 1, i + 6)
|
3400
|
+
swap(this, i + 2, i + 5)
|
3401
|
+
swap(this, i + 3, i + 4)
|
3402
|
+
}
|
3403
|
+
return this
|
3404
|
+
}
|
3405
|
+
|
3406
|
+
Buffer.prototype.toString = function toString () {
|
3407
|
+
var length = this.length | 0
|
3408
|
+
if (length === 0) return ''
|
3409
|
+
if (arguments.length === 0) return utf8Slice(this, 0, length)
|
3410
|
+
return slowToString.apply(this, arguments)
|
3411
|
+
}
|
3412
|
+
|
3413
|
+
Buffer.prototype.equals = function equals (b) {
|
3414
|
+
if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
|
3415
|
+
if (this === b) return true
|
3416
|
+
return Buffer.compare(this, b) === 0
|
3417
|
+
}
|
3418
|
+
|
3419
|
+
Buffer.prototype.inspect = function inspect () {
|
3420
|
+
var str = ''
|
3421
|
+
var max = exports.INSPECT_MAX_BYTES
|
3422
|
+
if (this.length > 0) {
|
3423
|
+
str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
|
3424
|
+
if (this.length > max) str += ' ... '
|
3425
|
+
}
|
3426
|
+
return '<Buffer ' + str + '>'
|
3427
|
+
}
|
3428
|
+
|
3429
|
+
Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
|
3430
|
+
if (!Buffer.isBuffer(target)) {
|
3431
|
+
throw new TypeError('Argument must be a Buffer')
|
3432
|
+
}
|
3433
|
+
|
3434
|
+
if (start === undefined) {
|
3435
|
+
start = 0
|
3436
|
+
}
|
3437
|
+
if (end === undefined) {
|
3438
|
+
end = target ? target.length : 0
|
3439
|
+
}
|
3440
|
+
if (thisStart === undefined) {
|
3441
|
+
thisStart = 0
|
3442
|
+
}
|
3443
|
+
if (thisEnd === undefined) {
|
3444
|
+
thisEnd = this.length
|
3445
|
+
}
|
3446
|
+
|
3447
|
+
if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
|
3448
|
+
throw new RangeError('out of range index')
|
3449
|
+
}
|
3450
|
+
|
3451
|
+
if (thisStart >= thisEnd && start >= end) {
|
3452
|
+
return 0
|
3453
|
+
}
|
3454
|
+
if (thisStart >= thisEnd) {
|
3455
|
+
return -1
|
3456
|
+
}
|
3457
|
+
if (start >= end) {
|
3458
|
+
return 1
|
3459
|
+
}
|
3460
|
+
|
3461
|
+
start >>>= 0
|
3462
|
+
end >>>= 0
|
3463
|
+
thisStart >>>= 0
|
3464
|
+
thisEnd >>>= 0
|
3465
|
+
|
3466
|
+
if (this === target) return 0
|
3467
|
+
|
3468
|
+
var x = thisEnd - thisStart
|
3469
|
+
var y = end - start
|
3470
|
+
var len = Math.min(x, y)
|
3471
|
+
|
3472
|
+
var thisCopy = this.slice(thisStart, thisEnd)
|
3473
|
+
var targetCopy = target.slice(start, end)
|
3474
|
+
|
3475
|
+
for (var i = 0; i < len; ++i) {
|
3476
|
+
if (thisCopy[i] !== targetCopy[i]) {
|
3477
|
+
x = thisCopy[i]
|
3478
|
+
y = targetCopy[i]
|
3479
|
+
break
|
3480
|
+
}
|
3481
|
+
}
|
3482
|
+
|
3483
|
+
if (x < y) return -1
|
3484
|
+
if (y < x) return 1
|
3485
|
+
return 0
|
3486
|
+
}
|
3487
|
+
|
3488
|
+
// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
|
3489
|
+
// OR the last index of `val` in `buffer` at offset <= `byteOffset`.
|
3490
|
+
//
|
3491
|
+
// Arguments:
|
3492
|
+
// - buffer - a Buffer to search
|
3493
|
+
// - val - a string, Buffer, or number
|
3494
|
+
// - byteOffset - an index into `buffer`; will be clamped to an int32
|
3495
|
+
// - encoding - an optional encoding, relevant is val is a string
|
3496
|
+
// - dir - true for indexOf, false for lastIndexOf
|
3497
|
+
function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
|
3498
|
+
// Empty buffer means no match
|
3499
|
+
if (buffer.length === 0) return -1
|
3500
|
+
|
3501
|
+
// Normalize byteOffset
|
3502
|
+
if (typeof byteOffset === 'string') {
|
3503
|
+
encoding = byteOffset
|
3504
|
+
byteOffset = 0
|
3505
|
+
} else if (byteOffset > 0x7fffffff) {
|
3506
|
+
byteOffset = 0x7fffffff
|
3507
|
+
} else if (byteOffset < -0x80000000) {
|
3508
|
+
byteOffset = -0x80000000
|
3509
|
+
}
|
3510
|
+
byteOffset = +byteOffset // Coerce to Number.
|
3511
|
+
if (isNaN(byteOffset)) {
|
3512
|
+
// byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
|
3513
|
+
byteOffset = dir ? 0 : (buffer.length - 1)
|
3514
|
+
}
|
3515
|
+
|
3516
|
+
// Normalize byteOffset: negative offsets start from the end of the buffer
|
3517
|
+
if (byteOffset < 0) byteOffset = buffer.length + byteOffset
|
3518
|
+
if (byteOffset >= buffer.length) {
|
3519
|
+
if (dir) return -1
|
3520
|
+
else byteOffset = buffer.length - 1
|
3521
|
+
} else if (byteOffset < 0) {
|
3522
|
+
if (dir) byteOffset = 0
|
3523
|
+
else return -1
|
3524
|
+
}
|
3525
|
+
|
3526
|
+
// Normalize val
|
3527
|
+
if (typeof val === 'string') {
|
3528
|
+
val = Buffer.from(val, encoding)
|
3529
|
+
}
|
3530
|
+
|
3531
|
+
// Finally, search either indexOf (if dir is true) or lastIndexOf
|
3532
|
+
if (Buffer.isBuffer(val)) {
|
3533
|
+
// Special case: looking for empty string/buffer always fails
|
3534
|
+
if (val.length === 0) {
|
3535
|
+
return -1
|
3536
|
+
}
|
3537
|
+
return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
|
3538
|
+
} else if (typeof val === 'number') {
|
3539
|
+
val = val & 0xFF // Search for a byte value [0-255]
|
3540
|
+
if (Buffer.TYPED_ARRAY_SUPPORT &&
|
3541
|
+
typeof Uint8Array.prototype.indexOf === 'function') {
|
3542
|
+
if (dir) {
|
3543
|
+
return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
|
3544
|
+
} else {
|
3545
|
+
return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
|
3658
3546
|
}
|
3659
|
-
|
3660
|
-
|
3661
|
-
|
3662
|
-
|
3663
|
-
|
3664
|
-
|
3665
|
-
|
3666
|
-
|
3667
|
-
|
3668
|
-
|
3669
|
-
|
3670
|
-
|
3671
|
-
|
3547
|
+
}
|
3548
|
+
return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
|
3549
|
+
}
|
3550
|
+
|
3551
|
+
throw new TypeError('val must be string, number or Buffer')
|
3552
|
+
}
|
3553
|
+
|
3554
|
+
function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
|
3555
|
+
var indexSize = 1
|
3556
|
+
var arrLength = arr.length
|
3557
|
+
var valLength = val.length
|
3558
|
+
|
3559
|
+
if (encoding !== undefined) {
|
3560
|
+
encoding = String(encoding).toLowerCase()
|
3561
|
+
if (encoding === 'ucs2' || encoding === 'ucs-2' ||
|
3562
|
+
encoding === 'utf16le' || encoding === 'utf-16le') {
|
3563
|
+
if (arr.length < 2 || val.length < 2) {
|
3564
|
+
return -1
|
3565
|
+
}
|
3566
|
+
indexSize = 2
|
3567
|
+
arrLength /= 2
|
3568
|
+
valLength /= 2
|
3569
|
+
byteOffset /= 2
|
3570
|
+
}
|
3571
|
+
}
|
3572
|
+
|
3573
|
+
function read (buf, i) {
|
3574
|
+
if (indexSize === 1) {
|
3575
|
+
return buf[i]
|
3672
3576
|
} else {
|
3673
|
-
|
3674
|
-
}
|
3675
|
-
|
3676
|
-
|
3677
|
-
|
3678
|
-
|
3679
|
-
|
3680
|
-
|
3681
|
-
|
3682
|
-
|
3683
|
-
|
3684
|
-
|
3685
|
-
|
3686
|
-
|
3687
|
-
result.slashes = result.slashes || relative.slashes;
|
3688
|
-
result.href = result.format();
|
3689
|
-
return result;
|
3690
|
-
}
|
3691
|
-
|
3692
|
-
var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'),
|
3693
|
-
isRelAbs = (
|
3694
|
-
relative.host ||
|
3695
|
-
relative.pathname && relative.pathname.charAt(0) === '/'
|
3696
|
-
),
|
3697
|
-
mustEndAbs = (isRelAbs || isSourceAbs ||
|
3698
|
-
(result.host && relative.pathname)),
|
3699
|
-
removeAllDots = mustEndAbs,
|
3700
|
-
srcPath = result.pathname && result.pathname.split('/') || [],
|
3701
|
-
relPath = relative.pathname && relative.pathname.split('/') || [],
|
3702
|
-
psychotic = result.protocol && !slashedProtocol[result.protocol];
|
3703
|
-
|
3704
|
-
// if the url is a non-slashed url, then relative
|
3705
|
-
// links like ../.. should be able
|
3706
|
-
// to crawl up to the hostname, as well. This is strange.
|
3707
|
-
// result.protocol has already been set by now.
|
3708
|
-
// Later on, put the first path part into the host field.
|
3709
|
-
if (psychotic) {
|
3710
|
-
result.hostname = '';
|
3711
|
-
result.port = null;
|
3712
|
-
if (result.host) {
|
3713
|
-
if (srcPath[0] === '') srcPath[0] = result.host;
|
3714
|
-
else srcPath.unshift(result.host);
|
3715
|
-
}
|
3716
|
-
result.host = '';
|
3717
|
-
if (relative.protocol) {
|
3718
|
-
relative.hostname = null;
|
3719
|
-
relative.port = null;
|
3720
|
-
if (relative.host) {
|
3721
|
-
if (relPath[0] === '') relPath[0] = relative.host;
|
3722
|
-
else relPath.unshift(relative.host);
|
3577
|
+
return buf.readUInt16BE(i * indexSize)
|
3578
|
+
}
|
3579
|
+
}
|
3580
|
+
|
3581
|
+
var i
|
3582
|
+
if (dir) {
|
3583
|
+
var foundIndex = -1
|
3584
|
+
for (i = byteOffset; i < arrLength; i++) {
|
3585
|
+
if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
|
3586
|
+
if (foundIndex === -1) foundIndex = i
|
3587
|
+
if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
|
3588
|
+
} else {
|
3589
|
+
if (foundIndex !== -1) i -= i - foundIndex
|
3590
|
+
foundIndex = -1
|
3723
3591
|
}
|
3724
|
-
|
3725
|
-
|
3726
|
-
|
3727
|
-
|
3728
|
-
|
3729
|
-
|
3730
|
-
|
3731
|
-
|
3732
|
-
|
3733
|
-
|
3734
|
-
relative.hostname : result.hostname;
|
3735
|
-
result.search = relative.search;
|
3736
|
-
result.query = relative.query;
|
3737
|
-
srcPath = relPath;
|
3738
|
-
// fall through to the dot-handling below.
|
3739
|
-
} else if (relPath.length) {
|
3740
|
-
// it's relative
|
3741
|
-
// throw away the existing file, and take the new path instead.
|
3742
|
-
if (!srcPath) srcPath = [];
|
3743
|
-
srcPath.pop();
|
3744
|
-
srcPath = srcPath.concat(relPath);
|
3745
|
-
result.search = relative.search;
|
3746
|
-
result.query = relative.query;
|
3747
|
-
} else if (!util.isNullOrUndefined(relative.search)) {
|
3748
|
-
// just pull out the search.
|
3749
|
-
// like href='?foo'.
|
3750
|
-
// Put this after the other two cases because it simplifies the booleans
|
3751
|
-
if (psychotic) {
|
3752
|
-
result.hostname = result.host = srcPath.shift();
|
3753
|
-
//occationaly the auth can get stuck only in host
|
3754
|
-
//this especially happens in cases like
|
3755
|
-
//url.resolveObject('mailto:local1@domain1', 'local2@domain2')
|
3756
|
-
var authInHost = result.host && result.host.indexOf('@') > 0 ?
|
3757
|
-
result.host.split('@') : false;
|
3758
|
-
if (authInHost) {
|
3759
|
-
result.auth = authInHost.shift();
|
3760
|
-
result.host = result.hostname = authInHost.shift();
|
3592
|
+
}
|
3593
|
+
} else {
|
3594
|
+
if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
|
3595
|
+
for (i = byteOffset; i >= 0; i--) {
|
3596
|
+
var found = true
|
3597
|
+
for (var j = 0; j < valLength; j++) {
|
3598
|
+
if (read(arr, i + j) !== read(val, j)) {
|
3599
|
+
found = false
|
3600
|
+
break
|
3601
|
+
}
|
3761
3602
|
}
|
3603
|
+
if (found) return i
|
3762
3604
|
}
|
3763
|
-
|
3764
|
-
|
3765
|
-
|
3766
|
-
|
3767
|
-
|
3768
|
-
|
3605
|
+
}
|
3606
|
+
|
3607
|
+
return -1
|
3608
|
+
}
|
3609
|
+
|
3610
|
+
Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
|
3611
|
+
return this.indexOf(val, byteOffset, encoding) !== -1
|
3612
|
+
}
|
3613
|
+
|
3614
|
+
Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
|
3615
|
+
return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
|
3616
|
+
}
|
3617
|
+
|
3618
|
+
Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
|
3619
|
+
return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
|
3620
|
+
}
|
3621
|
+
|
3622
|
+
function hexWrite (buf, string, offset, length) {
|
3623
|
+
offset = Number(offset) || 0
|
3624
|
+
var remaining = buf.length - offset
|
3625
|
+
if (!length) {
|
3626
|
+
length = remaining
|
3627
|
+
} else {
|
3628
|
+
length = Number(length)
|
3629
|
+
if (length > remaining) {
|
3630
|
+
length = remaining
|
3769
3631
|
}
|
3770
|
-
result.href = result.format();
|
3771
|
-
return result;
|
3772
3632
|
}
|
3773
3633
|
|
3774
|
-
|
3775
|
-
|
3776
|
-
|
3777
|
-
|
3778
|
-
|
3779
|
-
|
3780
|
-
|
3634
|
+
// must be an even number of digits
|
3635
|
+
var strLen = string.length
|
3636
|
+
if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
|
3637
|
+
|
3638
|
+
if (length > strLen / 2) {
|
3639
|
+
length = strLen / 2
|
3640
|
+
}
|
3641
|
+
for (var i = 0; i < length; ++i) {
|
3642
|
+
var parsed = parseInt(string.substr(i * 2, 2), 16)
|
3643
|
+
if (isNaN(parsed)) return i
|
3644
|
+
buf[offset + i] = parsed
|
3645
|
+
}
|
3646
|
+
return i
|
3647
|
+
}
|
3648
|
+
|
3649
|
+
function utf8Write (buf, string, offset, length) {
|
3650
|
+
return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
|
3651
|
+
}
|
3652
|
+
|
3653
|
+
function asciiWrite (buf, string, offset, length) {
|
3654
|
+
return blitBuffer(asciiToBytes(string), buf, offset, length)
|
3655
|
+
}
|
3656
|
+
|
3657
|
+
function latin1Write (buf, string, offset, length) {
|
3658
|
+
return asciiWrite(buf, string, offset, length)
|
3659
|
+
}
|
3660
|
+
|
3661
|
+
function base64Write (buf, string, offset, length) {
|
3662
|
+
return blitBuffer(base64ToBytes(string), buf, offset, length)
|
3663
|
+
}
|
3664
|
+
|
3665
|
+
function ucs2Write (buf, string, offset, length) {
|
3666
|
+
return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
|
3667
|
+
}
|
3668
|
+
|
3669
|
+
Buffer.prototype.write = function write (string, offset, length, encoding) {
|
3670
|
+
// Buffer#write(string)
|
3671
|
+
if (offset === undefined) {
|
3672
|
+
encoding = 'utf8'
|
3673
|
+
length = this.length
|
3674
|
+
offset = 0
|
3675
|
+
// Buffer#write(string, encoding)
|
3676
|
+
} else if (length === undefined && typeof offset === 'string') {
|
3677
|
+
encoding = offset
|
3678
|
+
length = this.length
|
3679
|
+
offset = 0
|
3680
|
+
// Buffer#write(string, offset[, length][, encoding])
|
3681
|
+
} else if (isFinite(offset)) {
|
3682
|
+
offset = offset | 0
|
3683
|
+
if (isFinite(length)) {
|
3684
|
+
length = length | 0
|
3685
|
+
if (encoding === undefined) encoding = 'utf8'
|
3781
3686
|
} else {
|
3782
|
-
|
3687
|
+
encoding = length
|
3688
|
+
length = undefined
|
3783
3689
|
}
|
3784
|
-
|
3785
|
-
|
3690
|
+
// legacy write(string, encoding, offset, length) - remove in v0.13
|
3691
|
+
} else {
|
3692
|
+
throw new Error(
|
3693
|
+
'Buffer.write(string, encoding, offset[, length]) is no longer supported'
|
3694
|
+
)
|
3695
|
+
}
|
3696
|
+
|
3697
|
+
var remaining = this.length - offset
|
3698
|
+
if (length === undefined || length > remaining) length = remaining
|
3699
|
+
|
3700
|
+
if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
|
3701
|
+
throw new RangeError('Attempt to write outside buffer bounds')
|
3786
3702
|
}
|
3787
3703
|
|
3788
|
-
|
3789
|
-
|
3790
|
-
|
3791
|
-
|
3792
|
-
|
3793
|
-
|
3794
|
-
|
3704
|
+
if (!encoding) encoding = 'utf8'
|
3705
|
+
|
3706
|
+
var loweredCase = false
|
3707
|
+
for (;;) {
|
3708
|
+
switch (encoding) {
|
3709
|
+
case 'hex':
|
3710
|
+
return hexWrite(this, string, offset, length)
|
3711
|
+
|
3712
|
+
case 'utf8':
|
3713
|
+
case 'utf-8':
|
3714
|
+
return utf8Write(this, string, offset, length)
|
3795
3715
|
|
3796
|
-
|
3797
|
-
|
3798
|
-
|
3799
|
-
|
3800
|
-
|
3801
|
-
|
3802
|
-
|
3803
|
-
|
3804
|
-
|
3805
|
-
|
3806
|
-
|
3807
|
-
|
3808
|
-
|
3716
|
+
case 'ascii':
|
3717
|
+
return asciiWrite(this, string, offset, length)
|
3718
|
+
|
3719
|
+
case 'latin1':
|
3720
|
+
case 'binary':
|
3721
|
+
return latin1Write(this, string, offset, length)
|
3722
|
+
|
3723
|
+
case 'base64':
|
3724
|
+
// Warning: maxLength not taken into account in base64Write
|
3725
|
+
return base64Write(this, string, offset, length)
|
3726
|
+
|
3727
|
+
case 'ucs2':
|
3728
|
+
case 'ucs-2':
|
3729
|
+
case 'utf16le':
|
3730
|
+
case 'utf-16le':
|
3731
|
+
return ucs2Write(this, string, offset, length)
|
3732
|
+
|
3733
|
+
default:
|
3734
|
+
if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
|
3735
|
+
encoding = ('' + encoding).toLowerCase()
|
3736
|
+
loweredCase = true
|
3809
3737
|
}
|
3810
3738
|
}
|
3739
|
+
}
|
3811
3740
|
|
3812
|
-
|
3813
|
-
|
3814
|
-
|
3815
|
-
|
3741
|
+
Buffer.prototype.toJSON = function toJSON () {
|
3742
|
+
return {
|
3743
|
+
type: 'Buffer',
|
3744
|
+
data: Array.prototype.slice.call(this._arr || this, 0)
|
3745
|
+
}
|
3746
|
+
}
|
3747
|
+
|
3748
|
+
function base64Slice (buf, start, end) {
|
3749
|
+
if (start === 0 && end === buf.length) {
|
3750
|
+
return base64.fromByteArray(buf)
|
3751
|
+
} else {
|
3752
|
+
return base64.fromByteArray(buf.slice(start, end))
|
3753
|
+
}
|
3754
|
+
}
|
3755
|
+
|
3756
|
+
function utf8Slice (buf, start, end) {
|
3757
|
+
end = Math.min(buf.length, end)
|
3758
|
+
var res = []
|
3759
|
+
|
3760
|
+
var i = start
|
3761
|
+
while (i < end) {
|
3762
|
+
var firstByte = buf[i]
|
3763
|
+
var codePoint = null
|
3764
|
+
var bytesPerSequence = (firstByte > 0xEF) ? 4
|
3765
|
+
: (firstByte > 0xDF) ? 3
|
3766
|
+
: (firstByte > 0xBF) ? 2
|
3767
|
+
: 1
|
3768
|
+
|
3769
|
+
if (i + bytesPerSequence <= end) {
|
3770
|
+
var secondByte, thirdByte, fourthByte, tempCodePoint
|
3771
|
+
|
3772
|
+
switch (bytesPerSequence) {
|
3773
|
+
case 1:
|
3774
|
+
if (firstByte < 0x80) {
|
3775
|
+
codePoint = firstByte
|
3776
|
+
}
|
3777
|
+
break
|
3778
|
+
case 2:
|
3779
|
+
secondByte = buf[i + 1]
|
3780
|
+
if ((secondByte & 0xC0) === 0x80) {
|
3781
|
+
tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
|
3782
|
+
if (tempCodePoint > 0x7F) {
|
3783
|
+
codePoint = tempCodePoint
|
3784
|
+
}
|
3785
|
+
}
|
3786
|
+
break
|
3787
|
+
case 3:
|
3788
|
+
secondByte = buf[i + 1]
|
3789
|
+
thirdByte = buf[i + 2]
|
3790
|
+
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
|
3791
|
+
tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
|
3792
|
+
if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
|
3793
|
+
codePoint = tempCodePoint
|
3794
|
+
}
|
3795
|
+
}
|
3796
|
+
break
|
3797
|
+
case 4:
|
3798
|
+
secondByte = buf[i + 1]
|
3799
|
+
thirdByte = buf[i + 2]
|
3800
|
+
fourthByte = buf[i + 3]
|
3801
|
+
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
|
3802
|
+
tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
|
3803
|
+
if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
|
3804
|
+
codePoint = tempCodePoint
|
3805
|
+
}
|
3806
|
+
}
|
3807
|
+
}
|
3808
|
+
}
|
3809
|
+
|
3810
|
+
if (codePoint === null) {
|
3811
|
+
// we did not generate a valid codePoint so insert a
|
3812
|
+
// replacement char (U+FFFD) and advance only 1 byte
|
3813
|
+
codePoint = 0xFFFD
|
3814
|
+
bytesPerSequence = 1
|
3815
|
+
} else if (codePoint > 0xFFFF) {
|
3816
|
+
// encode to utf16 (surrogate pair dance)
|
3817
|
+
codePoint -= 0x10000
|
3818
|
+
res.push(codePoint >>> 10 & 0x3FF | 0xD800)
|
3819
|
+
codePoint = 0xDC00 | codePoint & 0x3FF
|
3816
3820
|
}
|
3821
|
+
|
3822
|
+
res.push(codePoint)
|
3823
|
+
i += bytesPerSequence
|
3817
3824
|
}
|
3818
3825
|
|
3819
|
-
|
3820
|
-
|
3821
|
-
|
3826
|
+
return decodeCodePointsArray(res)
|
3827
|
+
}
|
3828
|
+
|
3829
|
+
// Based on http://stackoverflow.com/a/22747272/680742, the browser with
|
3830
|
+
// the lowest limit is Chrome, with 0x10000 args.
|
3831
|
+
// We go 1 magnitude less, for safety
|
3832
|
+
var MAX_ARGUMENTS_LENGTH = 0x1000
|
3833
|
+
|
3834
|
+
function decodeCodePointsArray (codePoints) {
|
3835
|
+
var len = codePoints.length
|
3836
|
+
if (len <= MAX_ARGUMENTS_LENGTH) {
|
3837
|
+
return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
|
3822
3838
|
}
|
3823
3839
|
|
3824
|
-
|
3825
|
-
|
3840
|
+
// Decode in chunks to avoid "call stack size exceeded".
|
3841
|
+
var res = ''
|
3842
|
+
var i = 0
|
3843
|
+
while (i < len) {
|
3844
|
+
res += String.fromCharCode.apply(
|
3845
|
+
String,
|
3846
|
+
codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
|
3847
|
+
)
|
3826
3848
|
}
|
3849
|
+
return res
|
3850
|
+
}
|
3851
|
+
|
3852
|
+
function asciiSlice (buf, start, end) {
|
3853
|
+
var ret = ''
|
3854
|
+
end = Math.min(buf.length, end)
|
3855
|
+
|
3856
|
+
for (var i = start; i < end; ++i) {
|
3857
|
+
ret += String.fromCharCode(buf[i] & 0x7F)
|
3858
|
+
}
|
3859
|
+
return ret
|
3860
|
+
}
|
3861
|
+
|
3862
|
+
function latin1Slice (buf, start, end) {
|
3863
|
+
var ret = ''
|
3864
|
+
end = Math.min(buf.length, end)
|
3865
|
+
|
3866
|
+
for (var i = start; i < end; ++i) {
|
3867
|
+
ret += String.fromCharCode(buf[i])
|
3868
|
+
}
|
3869
|
+
return ret
|
3870
|
+
}
|
3871
|
+
|
3872
|
+
function hexSlice (buf, start, end) {
|
3873
|
+
var len = buf.length
|
3827
3874
|
|
3828
|
-
|
3829
|
-
|
3875
|
+
if (!start || start < 0) start = 0
|
3876
|
+
if (!end || end < 0 || end > len) end = len
|
3830
3877
|
|
3831
|
-
|
3832
|
-
|
3833
|
-
|
3834
|
-
|
3835
|
-
|
3836
|
-
|
3837
|
-
|
3838
|
-
|
3839
|
-
|
3840
|
-
|
3841
|
-
|
3842
|
-
|
3878
|
+
var out = ''
|
3879
|
+
for (var i = start; i < end; ++i) {
|
3880
|
+
out += toHex(buf[i])
|
3881
|
+
}
|
3882
|
+
return out
|
3883
|
+
}
|
3884
|
+
|
3885
|
+
function utf16leSlice (buf, start, end) {
|
3886
|
+
var bytes = buf.slice(start, end)
|
3887
|
+
var res = ''
|
3888
|
+
for (var i = 0; i < bytes.length; i += 2) {
|
3889
|
+
res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
|
3890
|
+
}
|
3891
|
+
return res
|
3892
|
+
}
|
3893
|
+
|
3894
|
+
Buffer.prototype.slice = function slice (start, end) {
|
3895
|
+
var len = this.length
|
3896
|
+
start = ~~start
|
3897
|
+
end = end === undefined ? len : ~~end
|
3898
|
+
|
3899
|
+
if (start < 0) {
|
3900
|
+
start += len
|
3901
|
+
if (start < 0) start = 0
|
3902
|
+
} else if (start > len) {
|
3903
|
+
start = len
|
3904
|
+
}
|
3905
|
+
|
3906
|
+
if (end < 0) {
|
3907
|
+
end += len
|
3908
|
+
if (end < 0) end = 0
|
3909
|
+
} else if (end > len) {
|
3910
|
+
end = len
|
3911
|
+
}
|
3912
|
+
|
3913
|
+
if (end < start) end = start
|
3914
|
+
|
3915
|
+
var newBuf
|
3916
|
+
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
3917
|
+
newBuf = this.subarray(start, end)
|
3918
|
+
newBuf.__proto__ = Buffer.prototype
|
3919
|
+
} else {
|
3920
|
+
var sliceLen = end - start
|
3921
|
+
newBuf = new Buffer(sliceLen, undefined)
|
3922
|
+
for (var i = 0; i < sliceLen; ++i) {
|
3923
|
+
newBuf[i] = this[i + start]
|
3843
3924
|
}
|
3844
3925
|
}
|
3845
3926
|
|
3846
|
-
|
3927
|
+
return newBuf
|
3928
|
+
}
|
3929
|
+
|
3930
|
+
/*
|
3931
|
+
* Need to make sure that buffer isn't trying to write out of bounds.
|
3932
|
+
*/
|
3933
|
+
function checkOffset (offset, ext, length) {
|
3934
|
+
if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
|
3935
|
+
if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
|
3936
|
+
}
|
3937
|
+
|
3938
|
+
Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
|
3939
|
+
offset = offset | 0
|
3940
|
+
byteLength = byteLength | 0
|
3941
|
+
if (!noAssert) checkOffset(offset, byteLength, this.length)
|
3942
|
+
|
3943
|
+
var val = this[offset]
|
3944
|
+
var mul = 1
|
3945
|
+
var i = 0
|
3946
|
+
while (++i < byteLength && (mul *= 0x100)) {
|
3947
|
+
val += this[offset + i] * mul
|
3948
|
+
}
|
3949
|
+
|
3950
|
+
return val
|
3951
|
+
}
|
3952
|
+
|
3953
|
+
Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
|
3954
|
+
offset = offset | 0
|
3955
|
+
byteLength = byteLength | 0
|
3956
|
+
if (!noAssert) {
|
3957
|
+
checkOffset(offset, byteLength, this.length)
|
3958
|
+
}
|
3959
|
+
|
3960
|
+
var val = this[offset + --byteLength]
|
3961
|
+
var mul = 1
|
3962
|
+
while (byteLength > 0 && (mul *= 0x100)) {
|
3963
|
+
val += this[offset + --byteLength] * mul
|
3964
|
+
}
|
3965
|
+
|
3966
|
+
return val
|
3967
|
+
}
|
3968
|
+
|
3969
|
+
Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
|
3970
|
+
if (!noAssert) checkOffset(offset, 1, this.length)
|
3971
|
+
return this[offset]
|
3972
|
+
}
|
3973
|
+
|
3974
|
+
Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
|
3975
|
+
if (!noAssert) checkOffset(offset, 2, this.length)
|
3976
|
+
return this[offset] | (this[offset + 1] << 8)
|
3977
|
+
}
|
3978
|
+
|
3979
|
+
Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
|
3980
|
+
if (!noAssert) checkOffset(offset, 2, this.length)
|
3981
|
+
return (this[offset] << 8) | this[offset + 1]
|
3982
|
+
}
|
3983
|
+
|
3984
|
+
Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
|
3985
|
+
if (!noAssert) checkOffset(offset, 4, this.length)
|
3986
|
+
|
3987
|
+
return ((this[offset]) |
|
3988
|
+
(this[offset + 1] << 8) |
|
3989
|
+
(this[offset + 2] << 16)) +
|
3990
|
+
(this[offset + 3] * 0x1000000)
|
3991
|
+
}
|
3992
|
+
|
3993
|
+
Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
|
3994
|
+
if (!noAssert) checkOffset(offset, 4, this.length)
|
3995
|
+
|
3996
|
+
return (this[offset] * 0x1000000) +
|
3997
|
+
((this[offset + 1] << 16) |
|
3998
|
+
(this[offset + 2] << 8) |
|
3999
|
+
this[offset + 3])
|
4000
|
+
}
|
4001
|
+
|
4002
|
+
Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
|
4003
|
+
offset = offset | 0
|
4004
|
+
byteLength = byteLength | 0
|
4005
|
+
if (!noAssert) checkOffset(offset, byteLength, this.length)
|
4006
|
+
|
4007
|
+
var val = this[offset]
|
4008
|
+
var mul = 1
|
4009
|
+
var i = 0
|
4010
|
+
while (++i < byteLength && (mul *= 0x100)) {
|
4011
|
+
val += this[offset + i] * mul
|
4012
|
+
}
|
4013
|
+
mul *= 0x80
|
4014
|
+
|
4015
|
+
if (val >= mul) val -= Math.pow(2, 8 * byteLength)
|
4016
|
+
|
4017
|
+
return val
|
4018
|
+
}
|
4019
|
+
|
4020
|
+
Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
|
4021
|
+
offset = offset | 0
|
4022
|
+
byteLength = byteLength | 0
|
4023
|
+
if (!noAssert) checkOffset(offset, byteLength, this.length)
|
4024
|
+
|
4025
|
+
var i = byteLength
|
4026
|
+
var mul = 1
|
4027
|
+
var val = this[offset + --i]
|
4028
|
+
while (i > 0 && (mul *= 0x100)) {
|
4029
|
+
val += this[offset + --i] * mul
|
4030
|
+
}
|
4031
|
+
mul *= 0x80
|
4032
|
+
|
4033
|
+
if (val >= mul) val -= Math.pow(2, 8 * byteLength)
|
4034
|
+
|
4035
|
+
return val
|
4036
|
+
}
|
4037
|
+
|
4038
|
+
Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
|
4039
|
+
if (!noAssert) checkOffset(offset, 1, this.length)
|
4040
|
+
if (!(this[offset] & 0x80)) return (this[offset])
|
4041
|
+
return ((0xff - this[offset] + 1) * -1)
|
4042
|
+
}
|
4043
|
+
|
4044
|
+
Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
|
4045
|
+
if (!noAssert) checkOffset(offset, 2, this.length)
|
4046
|
+
var val = this[offset] | (this[offset + 1] << 8)
|
4047
|
+
return (val & 0x8000) ? val | 0xFFFF0000 : val
|
4048
|
+
}
|
4049
|
+
|
4050
|
+
Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
|
4051
|
+
if (!noAssert) checkOffset(offset, 2, this.length)
|
4052
|
+
var val = this[offset + 1] | (this[offset] << 8)
|
4053
|
+
return (val & 0x8000) ? val | 0xFFFF0000 : val
|
4054
|
+
}
|
4055
|
+
|
4056
|
+
Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
|
4057
|
+
if (!noAssert) checkOffset(offset, 4, this.length)
|
4058
|
+
|
4059
|
+
return (this[offset]) |
|
4060
|
+
(this[offset + 1] << 8) |
|
4061
|
+
(this[offset + 2] << 16) |
|
4062
|
+
(this[offset + 3] << 24)
|
4063
|
+
}
|
4064
|
+
|
4065
|
+
Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
|
4066
|
+
if (!noAssert) checkOffset(offset, 4, this.length)
|
4067
|
+
|
4068
|
+
return (this[offset] << 24) |
|
4069
|
+
(this[offset + 1] << 16) |
|
4070
|
+
(this[offset + 2] << 8) |
|
4071
|
+
(this[offset + 3])
|
4072
|
+
}
|
4073
|
+
|
4074
|
+
Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
|
4075
|
+
if (!noAssert) checkOffset(offset, 4, this.length)
|
4076
|
+
return ieee754.read(this, offset, true, 23, 4)
|
4077
|
+
}
|
4078
|
+
|
4079
|
+
Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
|
4080
|
+
if (!noAssert) checkOffset(offset, 4, this.length)
|
4081
|
+
return ieee754.read(this, offset, false, 23, 4)
|
4082
|
+
}
|
4083
|
+
|
4084
|
+
Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
|
4085
|
+
if (!noAssert) checkOffset(offset, 8, this.length)
|
4086
|
+
return ieee754.read(this, offset, true, 52, 8)
|
4087
|
+
}
|
4088
|
+
|
4089
|
+
Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
|
4090
|
+
if (!noAssert) checkOffset(offset, 8, this.length)
|
4091
|
+
return ieee754.read(this, offset, false, 52, 8)
|
4092
|
+
}
|
4093
|
+
|
4094
|
+
function checkInt (buf, value, offset, ext, max, min) {
|
4095
|
+
if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
|
4096
|
+
if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
|
4097
|
+
if (offset + ext > buf.length) throw new RangeError('Index out of range')
|
4098
|
+
}
|
4099
|
+
|
4100
|
+
Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
|
4101
|
+
value = +value
|
4102
|
+
offset = offset | 0
|
4103
|
+
byteLength = byteLength | 0
|
4104
|
+
if (!noAssert) {
|
4105
|
+
var maxBytes = Math.pow(2, 8 * byteLength) - 1
|
4106
|
+
checkInt(this, value, offset, byteLength, maxBytes, 0)
|
4107
|
+
}
|
4108
|
+
|
4109
|
+
var mul = 1
|
4110
|
+
var i = 0
|
4111
|
+
this[offset] = value & 0xFF
|
4112
|
+
while (++i < byteLength && (mul *= 0x100)) {
|
4113
|
+
this[offset + i] = (value / mul) & 0xFF
|
4114
|
+
}
|
4115
|
+
|
4116
|
+
return offset + byteLength
|
4117
|
+
}
|
4118
|
+
|
4119
|
+
Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
|
4120
|
+
value = +value
|
4121
|
+
offset = offset | 0
|
4122
|
+
byteLength = byteLength | 0
|
4123
|
+
if (!noAssert) {
|
4124
|
+
var maxBytes = Math.pow(2, 8 * byteLength) - 1
|
4125
|
+
checkInt(this, value, offset, byteLength, maxBytes, 0)
|
4126
|
+
}
|
3847
4127
|
|
3848
|
-
|
3849
|
-
|
4128
|
+
var i = byteLength - 1
|
4129
|
+
var mul = 1
|
4130
|
+
this[offset + i] = value & 0xFF
|
4131
|
+
while (--i >= 0 && (mul *= 0x100)) {
|
4132
|
+
this[offset + i] = (value / mul) & 0xFF
|
3850
4133
|
}
|
3851
4134
|
|
3852
|
-
|
3853
|
-
|
3854
|
-
|
4135
|
+
return offset + byteLength
|
4136
|
+
}
|
4137
|
+
|
4138
|
+
Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
|
4139
|
+
value = +value
|
4140
|
+
offset = offset | 0
|
4141
|
+
if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
|
4142
|
+
if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
|
4143
|
+
this[offset] = (value & 0xff)
|
4144
|
+
return offset + 1
|
4145
|
+
}
|
4146
|
+
|
4147
|
+
function objectWriteUInt16 (buf, value, offset, littleEndian) {
|
4148
|
+
if (value < 0) value = 0xffff + value + 1
|
4149
|
+
for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
|
4150
|
+
buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
|
4151
|
+
(littleEndian ? i : 1 - i) * 8
|
4152
|
+
}
|
4153
|
+
}
|
4154
|
+
|
4155
|
+
Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
|
4156
|
+
value = +value
|
4157
|
+
offset = offset | 0
|
4158
|
+
if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
|
4159
|
+
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
4160
|
+
this[offset] = (value & 0xff)
|
4161
|
+
this[offset + 1] = (value >>> 8)
|
3855
4162
|
} else {
|
3856
|
-
|
4163
|
+
objectWriteUInt16(this, value, offset, true)
|
3857
4164
|
}
|
4165
|
+
return offset + 2
|
4166
|
+
}
|
3858
4167
|
|
3859
|
-
|
3860
|
-
|
3861
|
-
|
3862
|
-
|
4168
|
+
Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
|
4169
|
+
value = +value
|
4170
|
+
offset = offset | 0
|
4171
|
+
if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
|
4172
|
+
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
4173
|
+
this[offset] = (value >>> 8)
|
4174
|
+
this[offset + 1] = (value & 0xff)
|
4175
|
+
} else {
|
4176
|
+
objectWriteUInt16(this, value, offset, false)
|
4177
|
+
}
|
4178
|
+
return offset + 2
|
4179
|
+
}
|
4180
|
+
|
4181
|
+
function objectWriteUInt32 (buf, value, offset, littleEndian) {
|
4182
|
+
if (value < 0) value = 0xffffffff + value + 1
|
4183
|
+
for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
|
4184
|
+
buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
|
4185
|
+
}
|
4186
|
+
}
|
4187
|
+
|
4188
|
+
Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
|
4189
|
+
value = +value
|
4190
|
+
offset = offset | 0
|
4191
|
+
if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
|
4192
|
+
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
4193
|
+
this[offset + 3] = (value >>> 24)
|
4194
|
+
this[offset + 2] = (value >>> 16)
|
4195
|
+
this[offset + 1] = (value >>> 8)
|
4196
|
+
this[offset] = (value & 0xff)
|
4197
|
+
} else {
|
4198
|
+
objectWriteUInt32(this, value, offset, true)
|
4199
|
+
}
|
4200
|
+
return offset + 4
|
4201
|
+
}
|
4202
|
+
|
4203
|
+
Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
|
4204
|
+
value = +value
|
4205
|
+
offset = offset | 0
|
4206
|
+
if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
|
4207
|
+
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
4208
|
+
this[offset] = (value >>> 24)
|
4209
|
+
this[offset + 1] = (value >>> 16)
|
4210
|
+
this[offset + 2] = (value >>> 8)
|
4211
|
+
this[offset + 3] = (value & 0xff)
|
4212
|
+
} else {
|
4213
|
+
objectWriteUInt32(this, value, offset, false)
|
4214
|
+
}
|
4215
|
+
return offset + 4
|
4216
|
+
}
|
4217
|
+
|
4218
|
+
Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
|
4219
|
+
value = +value
|
4220
|
+
offset = offset | 0
|
4221
|
+
if (!noAssert) {
|
4222
|
+
var limit = Math.pow(2, 8 * byteLength - 1)
|
4223
|
+
|
4224
|
+
checkInt(this, value, offset, byteLength, limit - 1, -limit)
|
3863
4225
|
}
|
3864
|
-
result.auth = relative.auth || result.auth;
|
3865
|
-
result.slashes = result.slashes || relative.slashes;
|
3866
|
-
result.href = result.format();
|
3867
|
-
return result;
|
3868
|
-
};
|
3869
4226
|
|
3870
|
-
|
3871
|
-
var
|
3872
|
-
var
|
3873
|
-
|
3874
|
-
|
3875
|
-
if (
|
3876
|
-
|
4227
|
+
var i = 0
|
4228
|
+
var mul = 1
|
4229
|
+
var sub = 0
|
4230
|
+
this[offset] = value & 0xFF
|
4231
|
+
while (++i < byteLength && (mul *= 0x100)) {
|
4232
|
+
if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
|
4233
|
+
sub = 1
|
3877
4234
|
}
|
3878
|
-
|
4235
|
+
this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
|
3879
4236
|
}
|
3880
|
-
if (host) this.hostname = host;
|
3881
|
-
};
|
3882
4237
|
|
4238
|
+
return offset + byteLength
|
4239
|
+
}
|
3883
4240
|
|
3884
|
-
|
4241
|
+
Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
|
4242
|
+
value = +value
|
4243
|
+
offset = offset | 0
|
4244
|
+
if (!noAssert) {
|
4245
|
+
var limit = Math.pow(2, 8 * byteLength - 1)
|
3885
4246
|
|
3886
|
-
|
3887
|
-
|
3888
|
-
!*** ./node_modules/url/util.js ***!
|
3889
|
-
\**********************************/
|
3890
|
-
/*! no static exports found */
|
3891
|
-
/***/ (function(module, exports, __webpack_require__) {
|
4247
|
+
checkInt(this, value, offset, byteLength, limit - 1, -limit)
|
4248
|
+
}
|
3892
4249
|
|
3893
|
-
|
4250
|
+
var i = byteLength - 1
|
4251
|
+
var mul = 1
|
4252
|
+
var sub = 0
|
4253
|
+
this[offset + i] = value & 0xFF
|
4254
|
+
while (--i >= 0 && (mul *= 0x100)) {
|
4255
|
+
if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
|
4256
|
+
sub = 1
|
4257
|
+
}
|
4258
|
+
this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
|
4259
|
+
}
|
3894
4260
|
|
4261
|
+
return offset + byteLength
|
4262
|
+
}
|
3895
4263
|
|
3896
|
-
|
3897
|
-
|
3898
|
-
|
3899
|
-
|
3900
|
-
|
3901
|
-
|
3902
|
-
|
3903
|
-
|
3904
|
-
|
3905
|
-
|
3906
|
-
|
3907
|
-
|
4264
|
+
Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
|
4265
|
+
value = +value
|
4266
|
+
offset = offset | 0
|
4267
|
+
if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
|
4268
|
+
if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
|
4269
|
+
if (value < 0) value = 0xff + value + 1
|
4270
|
+
this[offset] = (value & 0xff)
|
4271
|
+
return offset + 1
|
4272
|
+
}
|
4273
|
+
|
4274
|
+
Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
|
4275
|
+
value = +value
|
4276
|
+
offset = offset | 0
|
4277
|
+
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
|
4278
|
+
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
4279
|
+
this[offset] = (value & 0xff)
|
4280
|
+
this[offset + 1] = (value >>> 8)
|
4281
|
+
} else {
|
4282
|
+
objectWriteUInt16(this, value, offset, true)
|
4283
|
+
}
|
4284
|
+
return offset + 2
|
4285
|
+
}
|
4286
|
+
|
4287
|
+
Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
|
4288
|
+
value = +value
|
4289
|
+
offset = offset | 0
|
4290
|
+
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
|
4291
|
+
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
4292
|
+
this[offset] = (value >>> 8)
|
4293
|
+
this[offset + 1] = (value & 0xff)
|
4294
|
+
} else {
|
4295
|
+
objectWriteUInt16(this, value, offset, false)
|
4296
|
+
}
|
4297
|
+
return offset + 2
|
4298
|
+
}
|
4299
|
+
|
4300
|
+
Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
|
4301
|
+
value = +value
|
4302
|
+
offset = offset | 0
|
4303
|
+
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
|
4304
|
+
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
4305
|
+
this[offset] = (value & 0xff)
|
4306
|
+
this[offset + 1] = (value >>> 8)
|
4307
|
+
this[offset + 2] = (value >>> 16)
|
4308
|
+
this[offset + 3] = (value >>> 24)
|
4309
|
+
} else {
|
4310
|
+
objectWriteUInt32(this, value, offset, true)
|
4311
|
+
}
|
4312
|
+
return offset + 4
|
4313
|
+
}
|
4314
|
+
|
4315
|
+
Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
|
4316
|
+
value = +value
|
4317
|
+
offset = offset | 0
|
4318
|
+
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
|
4319
|
+
if (value < 0) value = 0xffffffff + value + 1
|
4320
|
+
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
4321
|
+
this[offset] = (value >>> 24)
|
4322
|
+
this[offset + 1] = (value >>> 16)
|
4323
|
+
this[offset + 2] = (value >>> 8)
|
4324
|
+
this[offset + 3] = (value & 0xff)
|
4325
|
+
} else {
|
4326
|
+
objectWriteUInt32(this, value, offset, false)
|
4327
|
+
}
|
4328
|
+
return offset + 4
|
4329
|
+
}
|
4330
|
+
|
4331
|
+
function checkIEEE754 (buf, value, offset, ext, max, min) {
|
4332
|
+
if (offset + ext > buf.length) throw new RangeError('Index out of range')
|
4333
|
+
if (offset < 0) throw new RangeError('Index out of range')
|
4334
|
+
}
|
4335
|
+
|
4336
|
+
function writeFloat (buf, value, offset, littleEndian, noAssert) {
|
4337
|
+
if (!noAssert) {
|
4338
|
+
checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
|
4339
|
+
}
|
4340
|
+
ieee754.write(buf, value, offset, littleEndian, 23, 4)
|
4341
|
+
return offset + 4
|
4342
|
+
}
|
4343
|
+
|
4344
|
+
Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
|
4345
|
+
return writeFloat(this, value, offset, true, noAssert)
|
4346
|
+
}
|
4347
|
+
|
4348
|
+
Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
|
4349
|
+
return writeFloat(this, value, offset, false, noAssert)
|
4350
|
+
}
|
4351
|
+
|
4352
|
+
function writeDouble (buf, value, offset, littleEndian, noAssert) {
|
4353
|
+
if (!noAssert) {
|
4354
|
+
checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
|
4355
|
+
}
|
4356
|
+
ieee754.write(buf, value, offset, littleEndian, 52, 8)
|
4357
|
+
return offset + 8
|
4358
|
+
}
|
4359
|
+
|
4360
|
+
Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
|
4361
|
+
return writeDouble(this, value, offset, true, noAssert)
|
4362
|
+
}
|
4363
|
+
|
4364
|
+
Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
|
4365
|
+
return writeDouble(this, value, offset, false, noAssert)
|
4366
|
+
}
|
4367
|
+
|
4368
|
+
// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
|
4369
|
+
Buffer.prototype.copy = function copy (target, targetStart, start, end) {
|
4370
|
+
if (!start) start = 0
|
4371
|
+
if (!end && end !== 0) end = this.length
|
4372
|
+
if (targetStart >= target.length) targetStart = target.length
|
4373
|
+
if (!targetStart) targetStart = 0
|
4374
|
+
if (end > 0 && end < start) end = start
|
4375
|
+
|
4376
|
+
// Copy 0 bytes; we're done
|
4377
|
+
if (end === start) return 0
|
4378
|
+
if (target.length === 0 || this.length === 0) return 0
|
4379
|
+
|
4380
|
+
// Fatal error conditions
|
4381
|
+
if (targetStart < 0) {
|
4382
|
+
throw new RangeError('targetStart out of bounds')
|
4383
|
+
}
|
4384
|
+
if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
|
4385
|
+
if (end < 0) throw new RangeError('sourceEnd out of bounds')
|
4386
|
+
|
4387
|
+
// Are we oob?
|
4388
|
+
if (end > this.length) end = this.length
|
4389
|
+
if (target.length - targetStart < end - start) {
|
4390
|
+
end = target.length - targetStart + start
|
4391
|
+
}
|
4392
|
+
|
4393
|
+
var len = end - start
|
4394
|
+
var i
|
4395
|
+
|
4396
|
+
if (this === target && start < targetStart && targetStart < end) {
|
4397
|
+
// descending copy from end
|
4398
|
+
for (i = len - 1; i >= 0; --i) {
|
4399
|
+
target[i + targetStart] = this[i + start]
|
4400
|
+
}
|
4401
|
+
} else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
|
4402
|
+
// ascending copy from start
|
4403
|
+
for (i = 0; i < len; ++i) {
|
4404
|
+
target[i + targetStart] = this[i + start]
|
4405
|
+
}
|
4406
|
+
} else {
|
4407
|
+
Uint8Array.prototype.set.call(
|
4408
|
+
target,
|
4409
|
+
this.subarray(start, start + len),
|
4410
|
+
targetStart
|
4411
|
+
)
|
4412
|
+
}
|
4413
|
+
|
4414
|
+
return len
|
4415
|
+
}
|
4416
|
+
|
4417
|
+
// Usage:
|
4418
|
+
// buffer.fill(number[, offset[, end]])
|
4419
|
+
// buffer.fill(buffer[, offset[, end]])
|
4420
|
+
// buffer.fill(string[, offset[, end]][, encoding])
|
4421
|
+
Buffer.prototype.fill = function fill (val, start, end, encoding) {
|
4422
|
+
// Handle string cases:
|
4423
|
+
if (typeof val === 'string') {
|
4424
|
+
if (typeof start === 'string') {
|
4425
|
+
encoding = start
|
4426
|
+
start = 0
|
4427
|
+
end = this.length
|
4428
|
+
} else if (typeof end === 'string') {
|
4429
|
+
encoding = end
|
4430
|
+
end = this.length
|
4431
|
+
}
|
4432
|
+
if (val.length === 1) {
|
4433
|
+
var code = val.charCodeAt(0)
|
4434
|
+
if (code < 256) {
|
4435
|
+
val = code
|
4436
|
+
}
|
4437
|
+
}
|
4438
|
+
if (encoding !== undefined && typeof encoding !== 'string') {
|
4439
|
+
throw new TypeError('encoding must be a string')
|
4440
|
+
}
|
4441
|
+
if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
|
4442
|
+
throw new TypeError('Unknown encoding: ' + encoding)
|
4443
|
+
}
|
4444
|
+
} else if (typeof val === 'number') {
|
4445
|
+
val = val & 255
|
4446
|
+
}
|
4447
|
+
|
4448
|
+
// Invalid ranges are not set to a default, so can range check early.
|
4449
|
+
if (start < 0 || this.length < start || this.length < end) {
|
4450
|
+
throw new RangeError('Out of range index')
|
4451
|
+
}
|
4452
|
+
|
4453
|
+
if (end <= start) {
|
4454
|
+
return this
|
4455
|
+
}
|
4456
|
+
|
4457
|
+
start = start >>> 0
|
4458
|
+
end = end === undefined ? this.length : end >>> 0
|
4459
|
+
|
4460
|
+
if (!val) val = 0
|
4461
|
+
|
4462
|
+
var i
|
4463
|
+
if (typeof val === 'number') {
|
4464
|
+
for (i = start; i < end; ++i) {
|
4465
|
+
this[i] = val
|
4466
|
+
}
|
4467
|
+
} else {
|
4468
|
+
var bytes = Buffer.isBuffer(val)
|
4469
|
+
? val
|
4470
|
+
: utf8ToBytes(new Buffer(val, encoding).toString())
|
4471
|
+
var len = bytes.length
|
4472
|
+
for (i = 0; i < end - start; ++i) {
|
4473
|
+
this[i + start] = bytes[i % len]
|
4474
|
+
}
|
4475
|
+
}
|
4476
|
+
|
4477
|
+
return this
|
4478
|
+
}
|
4479
|
+
|
4480
|
+
// HELPER FUNCTIONS
|
4481
|
+
// ================
|
4482
|
+
|
4483
|
+
var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
|
4484
|
+
|
4485
|
+
function base64clean (str) {
|
4486
|
+
// Node strips out invalid characters like \n and \t from the string, base64-js does not
|
4487
|
+
str = stringtrim(str).replace(INVALID_BASE64_RE, '')
|
4488
|
+
// Node converts strings with length < 2 to ''
|
4489
|
+
if (str.length < 2) return ''
|
4490
|
+
// Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
|
4491
|
+
while (str.length % 4 !== 0) {
|
4492
|
+
str = str + '='
|
4493
|
+
}
|
4494
|
+
return str
|
4495
|
+
}
|
4496
|
+
|
4497
|
+
function stringtrim (str) {
|
4498
|
+
if (str.trim) return str.trim()
|
4499
|
+
return str.replace(/^\s+|\s+$/g, '')
|
4500
|
+
}
|
4501
|
+
|
4502
|
+
function toHex (n) {
|
4503
|
+
if (n < 16) return '0' + n.toString(16)
|
4504
|
+
return n.toString(16)
|
4505
|
+
}
|
4506
|
+
|
4507
|
+
function utf8ToBytes (string, units) {
|
4508
|
+
units = units || Infinity
|
4509
|
+
var codePoint
|
4510
|
+
var length = string.length
|
4511
|
+
var leadSurrogate = null
|
4512
|
+
var bytes = []
|
4513
|
+
|
4514
|
+
for (var i = 0; i < length; ++i) {
|
4515
|
+
codePoint = string.charCodeAt(i)
|
4516
|
+
|
4517
|
+
// is surrogate component
|
4518
|
+
if (codePoint > 0xD7FF && codePoint < 0xE000) {
|
4519
|
+
// last char was a lead
|
4520
|
+
if (!leadSurrogate) {
|
4521
|
+
// no lead yet
|
4522
|
+
if (codePoint > 0xDBFF) {
|
4523
|
+
// unexpected trail
|
4524
|
+
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
4525
|
+
continue
|
4526
|
+
} else if (i + 1 === length) {
|
4527
|
+
// unpaired lead
|
4528
|
+
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
4529
|
+
continue
|
4530
|
+
}
|
4531
|
+
|
4532
|
+
// valid lead
|
4533
|
+
leadSurrogate = codePoint
|
4534
|
+
|
4535
|
+
continue
|
4536
|
+
}
|
4537
|
+
|
4538
|
+
// 2 leads in a row
|
4539
|
+
if (codePoint < 0xDC00) {
|
4540
|
+
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
4541
|
+
leadSurrogate = codePoint
|
4542
|
+
continue
|
4543
|
+
}
|
4544
|
+
|
4545
|
+
// valid surrogate pair
|
4546
|
+
codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
|
4547
|
+
} else if (leadSurrogate) {
|
4548
|
+
// valid bmp char, but last char was a lead
|
4549
|
+
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
4550
|
+
}
|
4551
|
+
|
4552
|
+
leadSurrogate = null
|
4553
|
+
|
4554
|
+
// encode utf8
|
4555
|
+
if (codePoint < 0x80) {
|
4556
|
+
if ((units -= 1) < 0) break
|
4557
|
+
bytes.push(codePoint)
|
4558
|
+
} else if (codePoint < 0x800) {
|
4559
|
+
if ((units -= 2) < 0) break
|
4560
|
+
bytes.push(
|
4561
|
+
codePoint >> 0x6 | 0xC0,
|
4562
|
+
codePoint & 0x3F | 0x80
|
4563
|
+
)
|
4564
|
+
} else if (codePoint < 0x10000) {
|
4565
|
+
if ((units -= 3) < 0) break
|
4566
|
+
bytes.push(
|
4567
|
+
codePoint >> 0xC | 0xE0,
|
4568
|
+
codePoint >> 0x6 & 0x3F | 0x80,
|
4569
|
+
codePoint & 0x3F | 0x80
|
4570
|
+
)
|
4571
|
+
} else if (codePoint < 0x110000) {
|
4572
|
+
if ((units -= 4) < 0) break
|
4573
|
+
bytes.push(
|
4574
|
+
codePoint >> 0x12 | 0xF0,
|
4575
|
+
codePoint >> 0xC & 0x3F | 0x80,
|
4576
|
+
codePoint >> 0x6 & 0x3F | 0x80,
|
4577
|
+
codePoint & 0x3F | 0x80
|
4578
|
+
)
|
4579
|
+
} else {
|
4580
|
+
throw new Error('Invalid code point')
|
4581
|
+
}
|
4582
|
+
}
|
4583
|
+
|
4584
|
+
return bytes
|
4585
|
+
}
|
4586
|
+
|
4587
|
+
function asciiToBytes (str) {
|
4588
|
+
var byteArray = []
|
4589
|
+
for (var i = 0; i < str.length; ++i) {
|
4590
|
+
// Node's code seems to be doing this and not & 0x7F..
|
4591
|
+
byteArray.push(str.charCodeAt(i) & 0xFF)
|
3908
4592
|
}
|
4593
|
+
return byteArray
|
4594
|
+
}
|
4595
|
+
|
4596
|
+
function utf16leToBytes (str, units) {
|
4597
|
+
var c, hi, lo
|
4598
|
+
var byteArray = []
|
4599
|
+
for (var i = 0; i < str.length; ++i) {
|
4600
|
+
if ((units -= 2) < 0) break
|
4601
|
+
|
4602
|
+
c = str.charCodeAt(i)
|
4603
|
+
hi = c >> 8
|
4604
|
+
lo = c % 256
|
4605
|
+
byteArray.push(lo)
|
4606
|
+
byteArray.push(hi)
|
4607
|
+
}
|
4608
|
+
|
4609
|
+
return byteArray
|
4610
|
+
}
|
4611
|
+
|
4612
|
+
function base64ToBytes (str) {
|
4613
|
+
return base64.toByteArray(base64clean(str))
|
4614
|
+
}
|
4615
|
+
|
4616
|
+
function blitBuffer (src, dst, offset, length) {
|
4617
|
+
for (var i = 0; i < length; ++i) {
|
4618
|
+
if ((i + offset >= dst.length) || (i >= src.length)) break
|
4619
|
+
dst[i + offset] = src[i]
|
4620
|
+
}
|
4621
|
+
return i
|
4622
|
+
}
|
4623
|
+
|
4624
|
+
function isnan (val) {
|
4625
|
+
return val !== val // eslint-disable-line no-self-compare
|
4626
|
+
}
|
4627
|
+
|
4628
|
+
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
|
4629
|
+
|
4630
|
+
/***/ }),
|
4631
|
+
|
4632
|
+
/***/ "./node_modules/node-libs-browser/node_modules/isarray/index.js":
|
4633
|
+
/*!**********************************************************************!*\
|
4634
|
+
!*** ./node_modules/node-libs-browser/node_modules/isarray/index.js ***!
|
4635
|
+
\**********************************************************************/
|
4636
|
+
/*! no static exports found */
|
4637
|
+
/***/ (function(module, exports) {
|
4638
|
+
|
4639
|
+
var toString = {}.toString;
|
4640
|
+
|
4641
|
+
module.exports = Array.isArray || function (arr) {
|
4642
|
+
return toString.call(arr) == '[object Array]';
|
3909
4643
|
};
|
3910
4644
|
|
3911
4645
|
|
@@ -3940,39 +4674,6 @@ try {
|
|
3940
4674
|
module.exports = g;
|
3941
4675
|
|
3942
4676
|
|
3943
|
-
/***/ }),
|
3944
|
-
|
3945
|
-
/***/ "./node_modules/webpack/buildin/module.js":
|
3946
|
-
/*!***********************************!*\
|
3947
|
-
!*** (webpack)/buildin/module.js ***!
|
3948
|
-
\***********************************/
|
3949
|
-
/*! no static exports found */
|
3950
|
-
/***/ (function(module, exports) {
|
3951
|
-
|
3952
|
-
module.exports = function(module) {
|
3953
|
-
if (!module.webpackPolyfill) {
|
3954
|
-
module.deprecate = function() {};
|
3955
|
-
module.paths = [];
|
3956
|
-
// module.parent = undefined by default
|
3957
|
-
if (!module.children) module.children = [];
|
3958
|
-
Object.defineProperty(module, "loaded", {
|
3959
|
-
enumerable: true,
|
3960
|
-
get: function() {
|
3961
|
-
return module.l;
|
3962
|
-
}
|
3963
|
-
});
|
3964
|
-
Object.defineProperty(module, "id", {
|
3965
|
-
enumerable: true,
|
3966
|
-
get: function() {
|
3967
|
-
return module.i;
|
3968
|
-
}
|
3969
|
-
});
|
3970
|
-
module.webpackPolyfill = 1;
|
3971
|
-
}
|
3972
|
-
return module;
|
3973
|
-
};
|
3974
|
-
|
3975
|
-
|
3976
4677
|
/***/ })
|
3977
4678
|
|
3978
4679
|
/******/ });
|