@scenid/react-formulator 2.1.0 → 2.1.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/dist/index.cjs.js +1394 -34
- package/dist/index.esm.js +1396 -35
- package/package.json +4 -2
package/dist/index.esm.js
CHANGED
|
@@ -7,8 +7,6 @@ import { makeStyles as makeStyles$1, useTheme } from '@mui/styles';
|
|
|
7
7
|
import { Autorenew, Delete, Save, Clear, Check, Close } from '@mui/icons-material';
|
|
8
8
|
import Autocomplete, { createFilterOptions } from '@mui/material/Autocomplete';
|
|
9
9
|
import path$3 from 'path';
|
|
10
|
-
import proc from 'process';
|
|
11
|
-
import { fileURLToPath } from 'url';
|
|
12
10
|
import { alpha as alpha$1 } from '@mui/material/styles';
|
|
13
11
|
|
|
14
12
|
function _classCallCheck(instance, Constructor) {
|
|
@@ -1516,9 +1514,9 @@ var engineUserAgent = getBuiltIn$K('navigator', 'userAgent') || '';
|
|
|
1516
1514
|
var global$Y = global$_;
|
|
1517
1515
|
var userAgent$7 = engineUserAgent;
|
|
1518
1516
|
|
|
1519
|
-
var process$
|
|
1517
|
+
var process$6 = global$Y.process;
|
|
1520
1518
|
var Deno$1 = global$Y.Deno;
|
|
1521
|
-
var versions = process$
|
|
1519
|
+
var versions = process$6 && process$6.versions || Deno$1 && Deno$1.version;
|
|
1522
1520
|
var v8 = versions && versions.v8;
|
|
1523
1521
|
var match$1, version$1;
|
|
1524
1522
|
|
|
@@ -1674,13 +1672,13 @@ var toObject$B = function (argument) {
|
|
|
1674
1672
|
var uncurryThis$1p = functionUncurryThis;
|
|
1675
1673
|
var toObject$A = toObject$B;
|
|
1676
1674
|
|
|
1677
|
-
var hasOwnProperty$
|
|
1675
|
+
var hasOwnProperty$3 = uncurryThis$1p({}.hasOwnProperty);
|
|
1678
1676
|
|
|
1679
1677
|
// `HasOwnProperty` abstract operation
|
|
1680
1678
|
// https://tc39.es/ecma262/#sec-hasownproperty
|
|
1681
1679
|
// eslint-disable-next-line es-x/no-object-hasown -- safe
|
|
1682
1680
|
var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
|
|
1683
|
-
return hasOwnProperty$
|
|
1681
|
+
return hasOwnProperty$3(toObject$A(it), key);
|
|
1684
1682
|
};
|
|
1685
1683
|
|
|
1686
1684
|
var uncurryThis$1o = functionUncurryThis;
|
|
@@ -8255,7 +8253,7 @@ var IS_NODE$5 = engineIsNode;
|
|
|
8255
8253
|
|
|
8256
8254
|
var set$1 = global$A.setImmediate;
|
|
8257
8255
|
var clear = global$A.clearImmediate;
|
|
8258
|
-
var process$
|
|
8256
|
+
var process$5 = global$A.process;
|
|
8259
8257
|
var Dispatch = global$A.Dispatch;
|
|
8260
8258
|
var Function$2 = global$A.Function;
|
|
8261
8259
|
var MessageChannel = global$A.MessageChannel;
|
|
@@ -8311,7 +8309,7 @@ if (!set$1 || !clear) {
|
|
|
8311
8309
|
// Node.js 0.8-
|
|
8312
8310
|
if (IS_NODE$5) {
|
|
8313
8311
|
defer = function (id) {
|
|
8314
|
-
process$
|
|
8312
|
+
process$5.nextTick(runner(id));
|
|
8315
8313
|
};
|
|
8316
8314
|
// Sphere (JS game engine) Dispatch API
|
|
8317
8315
|
} else if (Dispatch && Dispatch.now) {
|
|
@@ -8377,7 +8375,7 @@ var IS_NODE$4 = engineIsNode;
|
|
|
8377
8375
|
|
|
8378
8376
|
var MutationObserver = global$y.MutationObserver || global$y.WebKitMutationObserver;
|
|
8379
8377
|
var document$4 = global$y.document;
|
|
8380
|
-
var process$
|
|
8378
|
+
var process$4 = global$y.process;
|
|
8381
8379
|
var Promise$4 = global$y.Promise;
|
|
8382
8380
|
// Node.js 11 shows ExperimentalWarning on getting `queueMicrotask`
|
|
8383
8381
|
var queueMicrotaskDescriptor = getOwnPropertyDescriptor$5(global$y, 'queueMicrotask');
|
|
@@ -8389,7 +8387,7 @@ var flush, head, last, notify$1, toggle, node, promise, then;
|
|
|
8389
8387
|
if (!queueMicrotask) {
|
|
8390
8388
|
flush = function () {
|
|
8391
8389
|
var parent, fn;
|
|
8392
|
-
if (IS_NODE$4 && (parent = process$
|
|
8390
|
+
if (IS_NODE$4 && (parent = process$4.domain)) parent.exit();
|
|
8393
8391
|
while (head) {
|
|
8394
8392
|
fn = head.fn;
|
|
8395
8393
|
head = head.next;
|
|
@@ -8426,7 +8424,7 @@ if (!queueMicrotask) {
|
|
|
8426
8424
|
// Node.js without promises
|
|
8427
8425
|
} else if (IS_NODE$4) {
|
|
8428
8426
|
notify$1 = function () {
|
|
8429
|
-
process$
|
|
8427
|
+
process$4.nextTick(flush);
|
|
8430
8428
|
};
|
|
8431
8429
|
// for other environments - macrotask based on:
|
|
8432
8430
|
// - setImmediate
|
|
@@ -8598,7 +8596,7 @@ var PromiseConstructor = NativePromiseConstructor$3;
|
|
|
8598
8596
|
var PromisePrototype = NativePromisePrototype$2;
|
|
8599
8597
|
var TypeError$4 = global$u.TypeError;
|
|
8600
8598
|
var document$3 = global$u.document;
|
|
8601
|
-
var process$
|
|
8599
|
+
var process$3 = global$u.process;
|
|
8602
8600
|
var newPromiseCapability$1 = newPromiseCapabilityModule$6.f;
|
|
8603
8601
|
var newGenericPromiseCapability = newPromiseCapability$1;
|
|
8604
8602
|
|
|
@@ -8690,7 +8688,7 @@ var onUnhandled = function (state) {
|
|
|
8690
8688
|
if (IS_UNHANDLED) {
|
|
8691
8689
|
result = perform$5(function () {
|
|
8692
8690
|
if (IS_NODE$3) {
|
|
8693
|
-
process$
|
|
8691
|
+
process$3.emit('unhandledRejection', value, promise);
|
|
8694
8692
|
} else dispatchEvent(UNHANDLED_REJECTION, promise, value);
|
|
8695
8693
|
});
|
|
8696
8694
|
// Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
|
|
@@ -8708,7 +8706,7 @@ var onHandleUnhandled = function (state) {
|
|
|
8708
8706
|
call$T(task, global$u, function () {
|
|
8709
8707
|
var promise = state.facade;
|
|
8710
8708
|
if (IS_NODE$3) {
|
|
8711
|
-
process$
|
|
8709
|
+
process$3.emit('rejectionHandled', promise);
|
|
8712
8710
|
} else dispatchEvent(REJECTION_HANDLED, promise, state.value);
|
|
8713
8711
|
});
|
|
8714
8712
|
};
|
|
@@ -8796,7 +8794,7 @@ if (FORCED_PROMISE_CONSTRUCTOR$4) {
|
|
|
8796
8794
|
state.parent = true;
|
|
8797
8795
|
reaction.ok = isCallable$f(onFulfilled) ? onFulfilled : true;
|
|
8798
8796
|
reaction.fail = isCallable$f(onRejected) && onRejected;
|
|
8799
|
-
reaction.domain = IS_NODE$3 ? process$
|
|
8797
|
+
reaction.domain = IS_NODE$3 ? process$3.domain : undefined;
|
|
8800
8798
|
if (state.state == PENDING) state.reactions.add(reaction);
|
|
8801
8799
|
else microtask$1(function () {
|
|
8802
8800
|
callReaction(reaction, state);
|
|
@@ -17068,7 +17066,7 @@ var aCallable = aCallable$Y;
|
|
|
17068
17066
|
var validateArgumentsLength$4 = validateArgumentsLength$8;
|
|
17069
17067
|
var IS_NODE$1 = engineIsNode;
|
|
17070
17068
|
|
|
17071
|
-
var process$
|
|
17069
|
+
var process$2 = global$7.process;
|
|
17072
17070
|
|
|
17073
17071
|
// `queueMicrotask` method
|
|
17074
17072
|
// https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-queuemicrotask
|
|
@@ -17076,7 +17074,7 @@ $$6({ global: true, enumerable: true, dontCallGetSet: true }, {
|
|
|
17076
17074
|
queueMicrotask: function queueMicrotask(fn) {
|
|
17077
17075
|
validateArgumentsLength$4(arguments.length, 1);
|
|
17078
17076
|
aCallable(fn);
|
|
17079
|
-
var domain = IS_NODE$1 && process$
|
|
17077
|
+
var domain = IS_NODE$1 && process$2.domain;
|
|
17080
17078
|
microtask(domain ? domain.bind(fn) : fn);
|
|
17081
17079
|
}
|
|
17082
17080
|
});
|
|
@@ -17743,7 +17741,7 @@ var adapt = function (delta, numPoints, firstTime) {
|
|
|
17743
17741
|
* Converts a string of Unicode symbols (e.g. a domain name label) to a
|
|
17744
17742
|
* Punycode string of ASCII-only symbols.
|
|
17745
17743
|
*/
|
|
17746
|
-
var encode$
|
|
17744
|
+
var encode$3 = function (input) {
|
|
17747
17745
|
var output = [];
|
|
17748
17746
|
|
|
17749
17747
|
// Convert the input in UCS-2 to an array of Unicode code points.
|
|
@@ -17832,7 +17830,7 @@ var stringPunycodeToAscii = function (input) {
|
|
|
17832
17830
|
var i, label;
|
|
17833
17831
|
for (i = 0; i < labels.length; i++) {
|
|
17834
17832
|
label = labels[i];
|
|
17835
|
-
push$3(encoded, exec$1(regexNonASCII, label) ? 'xn--' + encode$
|
|
17833
|
+
push$3(encoded, exec$1(regexNonASCII, label) ? 'xn--' + encode$3(label) : label);
|
|
17836
17834
|
}
|
|
17837
17835
|
return join$2(encoded, '.');
|
|
17838
17836
|
};
|
|
@@ -17889,7 +17887,7 @@ var RequestPrototype = NativeRequest && NativeRequest.prototype;
|
|
|
17889
17887
|
var HeadersPrototype = Headers && Headers.prototype;
|
|
17890
17888
|
var RegExp$1 = global$2.RegExp;
|
|
17891
17889
|
var TypeError$2 = global$2.TypeError;
|
|
17892
|
-
var decodeURIComponent = global$2.decodeURIComponent;
|
|
17890
|
+
var decodeURIComponent$1 = global$2.decodeURIComponent;
|
|
17893
17891
|
var encodeURIComponent$1 = global$2.encodeURIComponent;
|
|
17894
17892
|
var charAt$1 = uncurryThis$1(''.charAt);
|
|
17895
17893
|
var join$1 = uncurryThis$1([].join);
|
|
@@ -17909,7 +17907,7 @@ var percentSequence = function (bytes) {
|
|
|
17909
17907
|
|
|
17910
17908
|
var percentDecode = function (sequence) {
|
|
17911
17909
|
try {
|
|
17912
|
-
return decodeURIComponent(sequence);
|
|
17910
|
+
return decodeURIComponent$1(sequence);
|
|
17913
17911
|
} catch (error) {
|
|
17914
17912
|
return sequence;
|
|
17915
17913
|
}
|
|
@@ -17919,7 +17917,7 @@ var deserialize = function (it) {
|
|
|
17919
17917
|
var result = replace$2(it, plus, ' ');
|
|
17920
17918
|
var bytes = 4;
|
|
17921
17919
|
try {
|
|
17922
|
-
return decodeURIComponent(result);
|
|
17920
|
+
return decodeURIComponent$1(result);
|
|
17923
17921
|
} catch (error) {
|
|
17924
17922
|
while (bytes) {
|
|
17925
17923
|
result = replace$2(result, percentSequence(bytes--), percentDecode);
|
|
@@ -30186,7 +30184,7 @@ function pick(obj, keys) {
|
|
|
30186
30184
|
}, {});
|
|
30187
30185
|
}
|
|
30188
30186
|
|
|
30189
|
-
function hasOwnProperty$
|
|
30187
|
+
function hasOwnProperty$2(obj, prop) {
|
|
30190
30188
|
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
30191
30189
|
}
|
|
30192
30190
|
|
|
@@ -30354,7 +30352,7 @@ function asNumber(value) {
|
|
|
30354
30352
|
function normalizeObject(obj, normalizer) {
|
|
30355
30353
|
const normalized = {};
|
|
30356
30354
|
for (const u in obj) {
|
|
30357
|
-
if (hasOwnProperty$
|
|
30355
|
+
if (hasOwnProperty$2(obj, u)) {
|
|
30358
30356
|
const v = obj[u];
|
|
30359
30357
|
if (v === undefined || v === null) continue;
|
|
30360
30358
|
normalized[normalizer(u)] = asNumber(v);
|
|
@@ -32923,7 +32921,7 @@ class Duration {
|
|
|
32923
32921
|
result = {};
|
|
32924
32922
|
|
|
32925
32923
|
for (const k of orderedUnits$1) {
|
|
32926
|
-
if (hasOwnProperty$
|
|
32924
|
+
if (hasOwnProperty$2(dur.values, k) || hasOwnProperty$2(this.values, k)) {
|
|
32927
32925
|
result[k] = dur.get(k) + this.get(k);
|
|
32928
32926
|
}
|
|
32929
32927
|
}
|
|
@@ -34408,7 +34406,7 @@ function match(input, regex, handlers) {
|
|
|
34408
34406
|
const all = {};
|
|
34409
34407
|
let matchIndex = 1;
|
|
34410
34408
|
for (const i in handlers) {
|
|
34411
|
-
if (hasOwnProperty$
|
|
34409
|
+
if (hasOwnProperty$2(handlers, i)) {
|
|
34412
34410
|
const h = handlers[i],
|
|
34413
34411
|
groups = h.groups ? h.groups + 1 : 1;
|
|
34414
34412
|
if (!h.literal && h.token) {
|
|
@@ -34558,7 +34556,7 @@ function explainFromTokens(locale, input, format) {
|
|
|
34558
34556
|
[result, zone, specificOffset] = matches
|
|
34559
34557
|
? dateTimeFromMatches(matches)
|
|
34560
34558
|
: [null, null, undefined];
|
|
34561
|
-
if (hasOwnProperty$
|
|
34559
|
+
if (hasOwnProperty$2(matches, "a") && hasOwnProperty$2(matches, "H")) {
|
|
34562
34560
|
throw new ConflictingSpecificationError(
|
|
34563
34561
|
"Can't include meridiem when specifying 24-hour format"
|
|
34564
34562
|
);
|
|
@@ -37945,6 +37943,1369 @@ VFileMessage$1.prototype.source = null;
|
|
|
37945
37943
|
VFileMessage$1.prototype.ruleId = null;
|
|
37946
37944
|
VFileMessage$1.prototype.position = null;
|
|
37947
37945
|
|
|
37946
|
+
// for now just expose the builtin process global from node.js
|
|
37947
|
+
var process$1 = commonjsGlobal.process;
|
|
37948
|
+
|
|
37949
|
+
var url = {};
|
|
37950
|
+
|
|
37951
|
+
var punycode$1 = {exports: {}};
|
|
37952
|
+
|
|
37953
|
+
/*! https://mths.be/punycode v1.3.2 by @mathias */
|
|
37954
|
+
|
|
37955
|
+
(function (module, exports) {
|
|
37956
|
+
(function(root) {
|
|
37957
|
+
|
|
37958
|
+
/** Detect free variables */
|
|
37959
|
+
var freeExports = exports &&
|
|
37960
|
+
!exports.nodeType && exports;
|
|
37961
|
+
var freeModule = module &&
|
|
37962
|
+
!module.nodeType && module;
|
|
37963
|
+
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal;
|
|
37964
|
+
if (
|
|
37965
|
+
freeGlobal.global === freeGlobal ||
|
|
37966
|
+
freeGlobal.window === freeGlobal ||
|
|
37967
|
+
freeGlobal.self === freeGlobal
|
|
37968
|
+
) {
|
|
37969
|
+
root = freeGlobal;
|
|
37970
|
+
}
|
|
37971
|
+
|
|
37972
|
+
/**
|
|
37973
|
+
* The `punycode` object.
|
|
37974
|
+
* @name punycode
|
|
37975
|
+
* @type Object
|
|
37976
|
+
*/
|
|
37977
|
+
var punycode,
|
|
37978
|
+
|
|
37979
|
+
/** Highest positive signed 32-bit float value */
|
|
37980
|
+
maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1
|
|
37981
|
+
|
|
37982
|
+
/** Bootstring parameters */
|
|
37983
|
+
base = 36,
|
|
37984
|
+
tMin = 1,
|
|
37985
|
+
tMax = 26,
|
|
37986
|
+
skew = 38,
|
|
37987
|
+
damp = 700,
|
|
37988
|
+
initialBias = 72,
|
|
37989
|
+
initialN = 128, // 0x80
|
|
37990
|
+
delimiter = '-', // '\x2D'
|
|
37991
|
+
|
|
37992
|
+
/** Regular expressions */
|
|
37993
|
+
regexPunycode = /^xn--/,
|
|
37994
|
+
regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars
|
|
37995
|
+
regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators
|
|
37996
|
+
|
|
37997
|
+
/** Error messages */
|
|
37998
|
+
errors = {
|
|
37999
|
+
'overflow': 'Overflow: input needs wider integers to process',
|
|
38000
|
+
'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
|
|
38001
|
+
'invalid-input': 'Invalid input'
|
|
38002
|
+
},
|
|
38003
|
+
|
|
38004
|
+
/** Convenience shortcuts */
|
|
38005
|
+
baseMinusTMin = base - tMin,
|
|
38006
|
+
floor = Math.floor,
|
|
38007
|
+
stringFromCharCode = String.fromCharCode,
|
|
38008
|
+
|
|
38009
|
+
/** Temporary variable */
|
|
38010
|
+
key;
|
|
38011
|
+
|
|
38012
|
+
/*--------------------------------------------------------------------------*/
|
|
38013
|
+
|
|
38014
|
+
/**
|
|
38015
|
+
* A generic error utility function.
|
|
38016
|
+
* @private
|
|
38017
|
+
* @param {String} type The error type.
|
|
38018
|
+
* @returns {Error} Throws a `RangeError` with the applicable error message.
|
|
38019
|
+
*/
|
|
38020
|
+
function error(type) {
|
|
38021
|
+
throw RangeError(errors[type]);
|
|
38022
|
+
}
|
|
38023
|
+
|
|
38024
|
+
/**
|
|
38025
|
+
* A generic `Array#map` utility function.
|
|
38026
|
+
* @private
|
|
38027
|
+
* @param {Array} array The array to iterate over.
|
|
38028
|
+
* @param {Function} callback The function that gets called for every array
|
|
38029
|
+
* item.
|
|
38030
|
+
* @returns {Array} A new array of values returned by the callback function.
|
|
38031
|
+
*/
|
|
38032
|
+
function map(array, fn) {
|
|
38033
|
+
var length = array.length;
|
|
38034
|
+
var result = [];
|
|
38035
|
+
while (length--) {
|
|
38036
|
+
result[length] = fn(array[length]);
|
|
38037
|
+
}
|
|
38038
|
+
return result;
|
|
38039
|
+
}
|
|
38040
|
+
|
|
38041
|
+
/**
|
|
38042
|
+
* A simple `Array#map`-like wrapper to work with domain name strings or email
|
|
38043
|
+
* addresses.
|
|
38044
|
+
* @private
|
|
38045
|
+
* @param {String} domain The domain name or email address.
|
|
38046
|
+
* @param {Function} callback The function that gets called for every
|
|
38047
|
+
* character.
|
|
38048
|
+
* @returns {Array} A new string of characters returned by the callback
|
|
38049
|
+
* function.
|
|
38050
|
+
*/
|
|
38051
|
+
function mapDomain(string, fn) {
|
|
38052
|
+
var parts = string.split('@');
|
|
38053
|
+
var result = '';
|
|
38054
|
+
if (parts.length > 1) {
|
|
38055
|
+
// In email addresses, only the domain name should be punycoded. Leave
|
|
38056
|
+
// the local part (i.e. everything up to `@`) intact.
|
|
38057
|
+
result = parts[0] + '@';
|
|
38058
|
+
string = parts[1];
|
|
38059
|
+
}
|
|
38060
|
+
// Avoid `split(regex)` for IE8 compatibility. See #17.
|
|
38061
|
+
string = string.replace(regexSeparators, '\x2E');
|
|
38062
|
+
var labels = string.split('.');
|
|
38063
|
+
var encoded = map(labels, fn).join('.');
|
|
38064
|
+
return result + encoded;
|
|
38065
|
+
}
|
|
38066
|
+
|
|
38067
|
+
/**
|
|
38068
|
+
* Creates an array containing the numeric code points of each Unicode
|
|
38069
|
+
* character in the string. While JavaScript uses UCS-2 internally,
|
|
38070
|
+
* this function will convert a pair of surrogate halves (each of which
|
|
38071
|
+
* UCS-2 exposes as separate characters) into a single code point,
|
|
38072
|
+
* matching UTF-16.
|
|
38073
|
+
* @see `punycode.ucs2.encode`
|
|
38074
|
+
* @see <https://mathiasbynens.be/notes/javascript-encoding>
|
|
38075
|
+
* @memberOf punycode.ucs2
|
|
38076
|
+
* @name decode
|
|
38077
|
+
* @param {String} string The Unicode input string (UCS-2).
|
|
38078
|
+
* @returns {Array} The new array of code points.
|
|
38079
|
+
*/
|
|
38080
|
+
function ucs2decode(string) {
|
|
38081
|
+
var output = [],
|
|
38082
|
+
counter = 0,
|
|
38083
|
+
length = string.length,
|
|
38084
|
+
value,
|
|
38085
|
+
extra;
|
|
38086
|
+
while (counter < length) {
|
|
38087
|
+
value = string.charCodeAt(counter++);
|
|
38088
|
+
if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
|
|
38089
|
+
// high surrogate, and there is a next character
|
|
38090
|
+
extra = string.charCodeAt(counter++);
|
|
38091
|
+
if ((extra & 0xFC00) == 0xDC00) { // low surrogate
|
|
38092
|
+
output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
|
|
38093
|
+
} else {
|
|
38094
|
+
// unmatched surrogate; only append this code unit, in case the next
|
|
38095
|
+
// code unit is the high surrogate of a surrogate pair
|
|
38096
|
+
output.push(value);
|
|
38097
|
+
counter--;
|
|
38098
|
+
}
|
|
38099
|
+
} else {
|
|
38100
|
+
output.push(value);
|
|
38101
|
+
}
|
|
38102
|
+
}
|
|
38103
|
+
return output;
|
|
38104
|
+
}
|
|
38105
|
+
|
|
38106
|
+
/**
|
|
38107
|
+
* Creates a string based on an array of numeric code points.
|
|
38108
|
+
* @see `punycode.ucs2.decode`
|
|
38109
|
+
* @memberOf punycode.ucs2
|
|
38110
|
+
* @name encode
|
|
38111
|
+
* @param {Array} codePoints The array of numeric code points.
|
|
38112
|
+
* @returns {String} The new Unicode string (UCS-2).
|
|
38113
|
+
*/
|
|
38114
|
+
function ucs2encode(array) {
|
|
38115
|
+
return map(array, function(value) {
|
|
38116
|
+
var output = '';
|
|
38117
|
+
if (value > 0xFFFF) {
|
|
38118
|
+
value -= 0x10000;
|
|
38119
|
+
output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
|
|
38120
|
+
value = 0xDC00 | value & 0x3FF;
|
|
38121
|
+
}
|
|
38122
|
+
output += stringFromCharCode(value);
|
|
38123
|
+
return output;
|
|
38124
|
+
}).join('');
|
|
38125
|
+
}
|
|
38126
|
+
|
|
38127
|
+
/**
|
|
38128
|
+
* Converts a basic code point into a digit/integer.
|
|
38129
|
+
* @see `digitToBasic()`
|
|
38130
|
+
* @private
|
|
38131
|
+
* @param {Number} codePoint The basic numeric code point value.
|
|
38132
|
+
* @returns {Number} The numeric value of a basic code point (for use in
|
|
38133
|
+
* representing integers) in the range `0` to `base - 1`, or `base` if
|
|
38134
|
+
* the code point does not represent a value.
|
|
38135
|
+
*/
|
|
38136
|
+
function basicToDigit(codePoint) {
|
|
38137
|
+
if (codePoint - 48 < 10) {
|
|
38138
|
+
return codePoint - 22;
|
|
38139
|
+
}
|
|
38140
|
+
if (codePoint - 65 < 26) {
|
|
38141
|
+
return codePoint - 65;
|
|
38142
|
+
}
|
|
38143
|
+
if (codePoint - 97 < 26) {
|
|
38144
|
+
return codePoint - 97;
|
|
38145
|
+
}
|
|
38146
|
+
return base;
|
|
38147
|
+
}
|
|
38148
|
+
|
|
38149
|
+
/**
|
|
38150
|
+
* Converts a digit/integer into a basic code point.
|
|
38151
|
+
* @see `basicToDigit()`
|
|
38152
|
+
* @private
|
|
38153
|
+
* @param {Number} digit The numeric value of a basic code point.
|
|
38154
|
+
* @returns {Number} The basic code point whose value (when used for
|
|
38155
|
+
* representing integers) is `digit`, which needs to be in the range
|
|
38156
|
+
* `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
|
|
38157
|
+
* used; else, the lowercase form is used. The behavior is undefined
|
|
38158
|
+
* if `flag` is non-zero and `digit` has no uppercase form.
|
|
38159
|
+
*/
|
|
38160
|
+
function digitToBasic(digit, flag) {
|
|
38161
|
+
// 0..25 map to ASCII a..z or A..Z
|
|
38162
|
+
// 26..35 map to ASCII 0..9
|
|
38163
|
+
return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
|
|
38164
|
+
}
|
|
38165
|
+
|
|
38166
|
+
/**
|
|
38167
|
+
* Bias adaptation function as per section 3.4 of RFC 3492.
|
|
38168
|
+
* http://tools.ietf.org/html/rfc3492#section-3.4
|
|
38169
|
+
* @private
|
|
38170
|
+
*/
|
|
38171
|
+
function adapt(delta, numPoints, firstTime) {
|
|
38172
|
+
var k = 0;
|
|
38173
|
+
delta = firstTime ? floor(delta / damp) : delta >> 1;
|
|
38174
|
+
delta += floor(delta / numPoints);
|
|
38175
|
+
for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {
|
|
38176
|
+
delta = floor(delta / baseMinusTMin);
|
|
38177
|
+
}
|
|
38178
|
+
return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
|
|
38179
|
+
}
|
|
38180
|
+
|
|
38181
|
+
/**
|
|
38182
|
+
* Converts a Punycode string of ASCII-only symbols to a string of Unicode
|
|
38183
|
+
* symbols.
|
|
38184
|
+
* @memberOf punycode
|
|
38185
|
+
* @param {String} input The Punycode string of ASCII-only symbols.
|
|
38186
|
+
* @returns {String} The resulting string of Unicode symbols.
|
|
38187
|
+
*/
|
|
38188
|
+
function decode(input) {
|
|
38189
|
+
// Don't use UCS-2
|
|
38190
|
+
var output = [],
|
|
38191
|
+
inputLength = input.length,
|
|
38192
|
+
out,
|
|
38193
|
+
i = 0,
|
|
38194
|
+
n = initialN,
|
|
38195
|
+
bias = initialBias,
|
|
38196
|
+
basic,
|
|
38197
|
+
j,
|
|
38198
|
+
index,
|
|
38199
|
+
oldi,
|
|
38200
|
+
w,
|
|
38201
|
+
k,
|
|
38202
|
+
digit,
|
|
38203
|
+
t,
|
|
38204
|
+
/** Cached calculation results */
|
|
38205
|
+
baseMinusT;
|
|
38206
|
+
|
|
38207
|
+
// Handle the basic code points: let `basic` be the number of input code
|
|
38208
|
+
// points before the last delimiter, or `0` if there is none, then copy
|
|
38209
|
+
// the first basic code points to the output.
|
|
38210
|
+
|
|
38211
|
+
basic = input.lastIndexOf(delimiter);
|
|
38212
|
+
if (basic < 0) {
|
|
38213
|
+
basic = 0;
|
|
38214
|
+
}
|
|
38215
|
+
|
|
38216
|
+
for (j = 0; j < basic; ++j) {
|
|
38217
|
+
// if it's not a basic code point
|
|
38218
|
+
if (input.charCodeAt(j) >= 0x80) {
|
|
38219
|
+
error('not-basic');
|
|
38220
|
+
}
|
|
38221
|
+
output.push(input.charCodeAt(j));
|
|
38222
|
+
}
|
|
38223
|
+
|
|
38224
|
+
// Main decoding loop: start just after the last delimiter if any basic code
|
|
38225
|
+
// points were copied; start at the beginning otherwise.
|
|
38226
|
+
|
|
38227
|
+
for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {
|
|
38228
|
+
|
|
38229
|
+
// `index` is the index of the next character to be consumed.
|
|
38230
|
+
// Decode a generalized variable-length integer into `delta`,
|
|
38231
|
+
// which gets added to `i`. The overflow checking is easier
|
|
38232
|
+
// if we increase `i` as we go, then subtract off its starting
|
|
38233
|
+
// value at the end to obtain `delta`.
|
|
38234
|
+
for (oldi = i, w = 1, k = base; /* no condition */; k += base) {
|
|
38235
|
+
|
|
38236
|
+
if (index >= inputLength) {
|
|
38237
|
+
error('invalid-input');
|
|
38238
|
+
}
|
|
38239
|
+
|
|
38240
|
+
digit = basicToDigit(input.charCodeAt(index++));
|
|
38241
|
+
|
|
38242
|
+
if (digit >= base || digit > floor((maxInt - i) / w)) {
|
|
38243
|
+
error('overflow');
|
|
38244
|
+
}
|
|
38245
|
+
|
|
38246
|
+
i += digit * w;
|
|
38247
|
+
t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
|
|
38248
|
+
|
|
38249
|
+
if (digit < t) {
|
|
38250
|
+
break;
|
|
38251
|
+
}
|
|
38252
|
+
|
|
38253
|
+
baseMinusT = base - t;
|
|
38254
|
+
if (w > floor(maxInt / baseMinusT)) {
|
|
38255
|
+
error('overflow');
|
|
38256
|
+
}
|
|
38257
|
+
|
|
38258
|
+
w *= baseMinusT;
|
|
38259
|
+
|
|
38260
|
+
}
|
|
38261
|
+
|
|
38262
|
+
out = output.length + 1;
|
|
38263
|
+
bias = adapt(i - oldi, out, oldi == 0);
|
|
38264
|
+
|
|
38265
|
+
// `i` was supposed to wrap around from `out` to `0`,
|
|
38266
|
+
// incrementing `n` each time, so we'll fix that now:
|
|
38267
|
+
if (floor(i / out) > maxInt - n) {
|
|
38268
|
+
error('overflow');
|
|
38269
|
+
}
|
|
38270
|
+
|
|
38271
|
+
n += floor(i / out);
|
|
38272
|
+
i %= out;
|
|
38273
|
+
|
|
38274
|
+
// Insert `n` at position `i` of the output
|
|
38275
|
+
output.splice(i++, 0, n);
|
|
38276
|
+
|
|
38277
|
+
}
|
|
38278
|
+
|
|
38279
|
+
return ucs2encode(output);
|
|
38280
|
+
}
|
|
38281
|
+
|
|
38282
|
+
/**
|
|
38283
|
+
* Converts a string of Unicode symbols (e.g. a domain name label) to a
|
|
38284
|
+
* Punycode string of ASCII-only symbols.
|
|
38285
|
+
* @memberOf punycode
|
|
38286
|
+
* @param {String} input The string of Unicode symbols.
|
|
38287
|
+
* @returns {String} The resulting Punycode string of ASCII-only symbols.
|
|
38288
|
+
*/
|
|
38289
|
+
function encode(input) {
|
|
38290
|
+
var n,
|
|
38291
|
+
delta,
|
|
38292
|
+
handledCPCount,
|
|
38293
|
+
basicLength,
|
|
38294
|
+
bias,
|
|
38295
|
+
j,
|
|
38296
|
+
m,
|
|
38297
|
+
q,
|
|
38298
|
+
k,
|
|
38299
|
+
t,
|
|
38300
|
+
currentValue,
|
|
38301
|
+
output = [],
|
|
38302
|
+
/** `inputLength` will hold the number of code points in `input`. */
|
|
38303
|
+
inputLength,
|
|
38304
|
+
/** Cached calculation results */
|
|
38305
|
+
handledCPCountPlusOne,
|
|
38306
|
+
baseMinusT,
|
|
38307
|
+
qMinusT;
|
|
38308
|
+
|
|
38309
|
+
// Convert the input in UCS-2 to Unicode
|
|
38310
|
+
input = ucs2decode(input);
|
|
38311
|
+
|
|
38312
|
+
// Cache the length
|
|
38313
|
+
inputLength = input.length;
|
|
38314
|
+
|
|
38315
|
+
// Initialize the state
|
|
38316
|
+
n = initialN;
|
|
38317
|
+
delta = 0;
|
|
38318
|
+
bias = initialBias;
|
|
38319
|
+
|
|
38320
|
+
// Handle the basic code points
|
|
38321
|
+
for (j = 0; j < inputLength; ++j) {
|
|
38322
|
+
currentValue = input[j];
|
|
38323
|
+
if (currentValue < 0x80) {
|
|
38324
|
+
output.push(stringFromCharCode(currentValue));
|
|
38325
|
+
}
|
|
38326
|
+
}
|
|
38327
|
+
|
|
38328
|
+
handledCPCount = basicLength = output.length;
|
|
38329
|
+
|
|
38330
|
+
// `handledCPCount` is the number of code points that have been handled;
|
|
38331
|
+
// `basicLength` is the number of basic code points.
|
|
38332
|
+
|
|
38333
|
+
// Finish the basic string - if it is not empty - with a delimiter
|
|
38334
|
+
if (basicLength) {
|
|
38335
|
+
output.push(delimiter);
|
|
38336
|
+
}
|
|
38337
|
+
|
|
38338
|
+
// Main encoding loop:
|
|
38339
|
+
while (handledCPCount < inputLength) {
|
|
38340
|
+
|
|
38341
|
+
// All non-basic code points < n have been handled already. Find the next
|
|
38342
|
+
// larger one:
|
|
38343
|
+
for (m = maxInt, j = 0; j < inputLength; ++j) {
|
|
38344
|
+
currentValue = input[j];
|
|
38345
|
+
if (currentValue >= n && currentValue < m) {
|
|
38346
|
+
m = currentValue;
|
|
38347
|
+
}
|
|
38348
|
+
}
|
|
38349
|
+
|
|
38350
|
+
// Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
|
|
38351
|
+
// but guard against overflow
|
|
38352
|
+
handledCPCountPlusOne = handledCPCount + 1;
|
|
38353
|
+
if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
|
|
38354
|
+
error('overflow');
|
|
38355
|
+
}
|
|
38356
|
+
|
|
38357
|
+
delta += (m - n) * handledCPCountPlusOne;
|
|
38358
|
+
n = m;
|
|
38359
|
+
|
|
38360
|
+
for (j = 0; j < inputLength; ++j) {
|
|
38361
|
+
currentValue = input[j];
|
|
38362
|
+
|
|
38363
|
+
if (currentValue < n && ++delta > maxInt) {
|
|
38364
|
+
error('overflow');
|
|
38365
|
+
}
|
|
38366
|
+
|
|
38367
|
+
if (currentValue == n) {
|
|
38368
|
+
// Represent delta as a generalized variable-length integer
|
|
38369
|
+
for (q = delta, k = base; /* no condition */; k += base) {
|
|
38370
|
+
t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
|
|
38371
|
+
if (q < t) {
|
|
38372
|
+
break;
|
|
38373
|
+
}
|
|
38374
|
+
qMinusT = q - t;
|
|
38375
|
+
baseMinusT = base - t;
|
|
38376
|
+
output.push(
|
|
38377
|
+
stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
|
|
38378
|
+
);
|
|
38379
|
+
q = floor(qMinusT / baseMinusT);
|
|
38380
|
+
}
|
|
38381
|
+
|
|
38382
|
+
output.push(stringFromCharCode(digitToBasic(q, 0)));
|
|
38383
|
+
bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
|
|
38384
|
+
delta = 0;
|
|
38385
|
+
++handledCPCount;
|
|
38386
|
+
}
|
|
38387
|
+
}
|
|
38388
|
+
|
|
38389
|
+
++delta;
|
|
38390
|
+
++n;
|
|
38391
|
+
|
|
38392
|
+
}
|
|
38393
|
+
return output.join('');
|
|
38394
|
+
}
|
|
38395
|
+
|
|
38396
|
+
/**
|
|
38397
|
+
* Converts a Punycode string representing a domain name or an email address
|
|
38398
|
+
* to Unicode. Only the Punycoded parts of the input will be converted, i.e.
|
|
38399
|
+
* it doesn't matter if you call it on a string that has already been
|
|
38400
|
+
* converted to Unicode.
|
|
38401
|
+
* @memberOf punycode
|
|
38402
|
+
* @param {String} input The Punycoded domain name or email address to
|
|
38403
|
+
* convert to Unicode.
|
|
38404
|
+
* @returns {String} The Unicode representation of the given Punycode
|
|
38405
|
+
* string.
|
|
38406
|
+
*/
|
|
38407
|
+
function toUnicode(input) {
|
|
38408
|
+
return mapDomain(input, function(string) {
|
|
38409
|
+
return regexPunycode.test(string)
|
|
38410
|
+
? decode(string.slice(4).toLowerCase())
|
|
38411
|
+
: string;
|
|
38412
|
+
});
|
|
38413
|
+
}
|
|
38414
|
+
|
|
38415
|
+
/**
|
|
38416
|
+
* Converts a Unicode string representing a domain name or an email address to
|
|
38417
|
+
* Punycode. Only the non-ASCII parts of the domain name will be converted,
|
|
38418
|
+
* i.e. it doesn't matter if you call it with a domain that's already in
|
|
38419
|
+
* ASCII.
|
|
38420
|
+
* @memberOf punycode
|
|
38421
|
+
* @param {String} input The domain name or email address to convert, as a
|
|
38422
|
+
* Unicode string.
|
|
38423
|
+
* @returns {String} The Punycode representation of the given domain name or
|
|
38424
|
+
* email address.
|
|
38425
|
+
*/
|
|
38426
|
+
function toASCII(input) {
|
|
38427
|
+
return mapDomain(input, function(string) {
|
|
38428
|
+
return regexNonASCII.test(string)
|
|
38429
|
+
? 'xn--' + encode(string)
|
|
38430
|
+
: string;
|
|
38431
|
+
});
|
|
38432
|
+
}
|
|
38433
|
+
|
|
38434
|
+
/*--------------------------------------------------------------------------*/
|
|
38435
|
+
|
|
38436
|
+
/** Define the public API */
|
|
38437
|
+
punycode = {
|
|
38438
|
+
/**
|
|
38439
|
+
* A string representing the current Punycode.js version number.
|
|
38440
|
+
* @memberOf punycode
|
|
38441
|
+
* @type String
|
|
38442
|
+
*/
|
|
38443
|
+
'version': '1.3.2',
|
|
38444
|
+
/**
|
|
38445
|
+
* An object of methods to convert from JavaScript's internal character
|
|
38446
|
+
* representation (UCS-2) to Unicode code points, and back.
|
|
38447
|
+
* @see <https://mathiasbynens.be/notes/javascript-encoding>
|
|
38448
|
+
* @memberOf punycode
|
|
38449
|
+
* @type Object
|
|
38450
|
+
*/
|
|
38451
|
+
'ucs2': {
|
|
38452
|
+
'decode': ucs2decode,
|
|
38453
|
+
'encode': ucs2encode
|
|
38454
|
+
},
|
|
38455
|
+
'decode': decode,
|
|
38456
|
+
'encode': encode,
|
|
38457
|
+
'toASCII': toASCII,
|
|
38458
|
+
'toUnicode': toUnicode
|
|
38459
|
+
};
|
|
38460
|
+
|
|
38461
|
+
/** Expose `punycode` */
|
|
38462
|
+
// Some AMD build optimizers, like r.js, check for specific condition patterns
|
|
38463
|
+
// like the following:
|
|
38464
|
+
if (freeExports && freeModule) {
|
|
38465
|
+
if (module.exports == freeExports) { // in Node.js or RingoJS v0.8.0+
|
|
38466
|
+
freeModule.exports = punycode;
|
|
38467
|
+
} else { // in Narwhal or RingoJS v0.7.0-
|
|
38468
|
+
for (key in punycode) {
|
|
38469
|
+
punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);
|
|
38470
|
+
}
|
|
38471
|
+
}
|
|
38472
|
+
} else { // in Rhino or a web browser
|
|
38473
|
+
root.punycode = punycode;
|
|
38474
|
+
}
|
|
38475
|
+
|
|
38476
|
+
}(commonjsGlobal));
|
|
38477
|
+
} (punycode$1, punycode$1.exports));
|
|
38478
|
+
|
|
38479
|
+
var util$1 = {
|
|
38480
|
+
isString: function(arg) {
|
|
38481
|
+
return typeof(arg) === 'string';
|
|
38482
|
+
},
|
|
38483
|
+
isObject: function(arg) {
|
|
38484
|
+
return typeof(arg) === 'object' && arg !== null;
|
|
38485
|
+
},
|
|
38486
|
+
isNull: function(arg) {
|
|
38487
|
+
return arg === null;
|
|
38488
|
+
},
|
|
38489
|
+
isNullOrUndefined: function(arg) {
|
|
38490
|
+
return arg == null;
|
|
38491
|
+
}
|
|
38492
|
+
};
|
|
38493
|
+
|
|
38494
|
+
var querystring$1 = {};
|
|
38495
|
+
|
|
38496
|
+
// If obj.hasOwnProperty has been overridden, then calling
|
|
38497
|
+
// obj.hasOwnProperty(prop) will break.
|
|
38498
|
+
// See: https://github.com/joyent/node/issues/1707
|
|
38499
|
+
function hasOwnProperty$1(obj, prop) {
|
|
38500
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
38501
|
+
}
|
|
38502
|
+
|
|
38503
|
+
var decode$1 = function(qs, sep, eq, options) {
|
|
38504
|
+
sep = sep || '&';
|
|
38505
|
+
eq = eq || '=';
|
|
38506
|
+
var obj = {};
|
|
38507
|
+
|
|
38508
|
+
if (typeof qs !== 'string' || qs.length === 0) {
|
|
38509
|
+
return obj;
|
|
38510
|
+
}
|
|
38511
|
+
|
|
38512
|
+
var regexp = /\+/g;
|
|
38513
|
+
qs = qs.split(sep);
|
|
38514
|
+
|
|
38515
|
+
var maxKeys = 1000;
|
|
38516
|
+
if (options && typeof options.maxKeys === 'number') {
|
|
38517
|
+
maxKeys = options.maxKeys;
|
|
38518
|
+
}
|
|
38519
|
+
|
|
38520
|
+
var len = qs.length;
|
|
38521
|
+
// maxKeys <= 0 means that we should not limit keys count
|
|
38522
|
+
if (maxKeys > 0 && len > maxKeys) {
|
|
38523
|
+
len = maxKeys;
|
|
38524
|
+
}
|
|
38525
|
+
|
|
38526
|
+
for (var i = 0; i < len; ++i) {
|
|
38527
|
+
var x = qs[i].replace(regexp, '%20'),
|
|
38528
|
+
idx = x.indexOf(eq),
|
|
38529
|
+
kstr, vstr, k, v;
|
|
38530
|
+
|
|
38531
|
+
if (idx >= 0) {
|
|
38532
|
+
kstr = x.substr(0, idx);
|
|
38533
|
+
vstr = x.substr(idx + 1);
|
|
38534
|
+
} else {
|
|
38535
|
+
kstr = x;
|
|
38536
|
+
vstr = '';
|
|
38537
|
+
}
|
|
38538
|
+
|
|
38539
|
+
k = decodeURIComponent(kstr);
|
|
38540
|
+
v = decodeURIComponent(vstr);
|
|
38541
|
+
|
|
38542
|
+
if (!hasOwnProperty$1(obj, k)) {
|
|
38543
|
+
obj[k] = v;
|
|
38544
|
+
} else if (Array.isArray(obj[k])) {
|
|
38545
|
+
obj[k].push(v);
|
|
38546
|
+
} else {
|
|
38547
|
+
obj[k] = [obj[k], v];
|
|
38548
|
+
}
|
|
38549
|
+
}
|
|
38550
|
+
|
|
38551
|
+
return obj;
|
|
38552
|
+
};
|
|
38553
|
+
|
|
38554
|
+
var stringifyPrimitive = function(v) {
|
|
38555
|
+
switch (typeof v) {
|
|
38556
|
+
case 'string':
|
|
38557
|
+
return v;
|
|
38558
|
+
|
|
38559
|
+
case 'boolean':
|
|
38560
|
+
return v ? 'true' : 'false';
|
|
38561
|
+
|
|
38562
|
+
case 'number':
|
|
38563
|
+
return isFinite(v) ? v : '';
|
|
38564
|
+
|
|
38565
|
+
default:
|
|
38566
|
+
return '';
|
|
38567
|
+
}
|
|
38568
|
+
};
|
|
38569
|
+
|
|
38570
|
+
var encode$2 = function(obj, sep, eq, name) {
|
|
38571
|
+
sep = sep || '&';
|
|
38572
|
+
eq = eq || '=';
|
|
38573
|
+
if (obj === null) {
|
|
38574
|
+
obj = undefined;
|
|
38575
|
+
}
|
|
38576
|
+
|
|
38577
|
+
if (typeof obj === 'object') {
|
|
38578
|
+
return Object.keys(obj).map(function(k) {
|
|
38579
|
+
var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;
|
|
38580
|
+
if (Array.isArray(obj[k])) {
|
|
38581
|
+
return obj[k].map(function(v) {
|
|
38582
|
+
return ks + encodeURIComponent(stringifyPrimitive(v));
|
|
38583
|
+
}).join(sep);
|
|
38584
|
+
} else {
|
|
38585
|
+
return ks + encodeURIComponent(stringifyPrimitive(obj[k]));
|
|
38586
|
+
}
|
|
38587
|
+
}).join(sep);
|
|
38588
|
+
|
|
38589
|
+
}
|
|
38590
|
+
|
|
38591
|
+
if (!name) return '';
|
|
38592
|
+
return encodeURIComponent(stringifyPrimitive(name)) + eq +
|
|
38593
|
+
encodeURIComponent(stringifyPrimitive(obj));
|
|
38594
|
+
};
|
|
38595
|
+
|
|
38596
|
+
querystring$1.decode = querystring$1.parse = decode$1;
|
|
38597
|
+
querystring$1.encode = querystring$1.stringify = encode$2;
|
|
38598
|
+
|
|
38599
|
+
var punycode = punycode$1.exports;
|
|
38600
|
+
var util = util$1;
|
|
38601
|
+
|
|
38602
|
+
url.parse = urlParse;
|
|
38603
|
+
url.resolve = urlResolve;
|
|
38604
|
+
url.resolveObject = urlResolveObject;
|
|
38605
|
+
url.format = urlFormat;
|
|
38606
|
+
|
|
38607
|
+
url.Url = Url;
|
|
38608
|
+
|
|
38609
|
+
function Url() {
|
|
38610
|
+
this.protocol = null;
|
|
38611
|
+
this.slashes = null;
|
|
38612
|
+
this.auth = null;
|
|
38613
|
+
this.host = null;
|
|
38614
|
+
this.port = null;
|
|
38615
|
+
this.hostname = null;
|
|
38616
|
+
this.hash = null;
|
|
38617
|
+
this.search = null;
|
|
38618
|
+
this.query = null;
|
|
38619
|
+
this.pathname = null;
|
|
38620
|
+
this.path = null;
|
|
38621
|
+
this.href = null;
|
|
38622
|
+
}
|
|
38623
|
+
|
|
38624
|
+
// Reference: RFC 3986, RFC 1808, RFC 2396
|
|
38625
|
+
|
|
38626
|
+
// define these here so at least they only have to be
|
|
38627
|
+
// compiled once on the first module load.
|
|
38628
|
+
var protocolPattern = /^([a-z0-9.+-]+:)/i,
|
|
38629
|
+
portPattern = /:[0-9]*$/,
|
|
38630
|
+
|
|
38631
|
+
// Special case for a simple path URL
|
|
38632
|
+
simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,
|
|
38633
|
+
|
|
38634
|
+
// RFC 2396: characters reserved for delimiting URLs.
|
|
38635
|
+
// We actually just auto-escape these.
|
|
38636
|
+
delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'],
|
|
38637
|
+
|
|
38638
|
+
// RFC 2396: characters not allowed for various reasons.
|
|
38639
|
+
unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims),
|
|
38640
|
+
|
|
38641
|
+
// Allowed by RFCs, but cause of XSS attacks. Always escape these.
|
|
38642
|
+
autoEscape = ['\''].concat(unwise),
|
|
38643
|
+
// Characters that are never ever allowed in a hostname.
|
|
38644
|
+
// Note that any invalid chars are also handled, but these
|
|
38645
|
+
// are the ones that are *expected* to be seen, so we fast-path
|
|
38646
|
+
// them.
|
|
38647
|
+
nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape),
|
|
38648
|
+
hostEndingChars = ['/', '?', '#'],
|
|
38649
|
+
hostnameMaxLen = 255,
|
|
38650
|
+
hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,
|
|
38651
|
+
hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,
|
|
38652
|
+
// protocols that can allow "unsafe" and "unwise" chars.
|
|
38653
|
+
unsafeProtocol = {
|
|
38654
|
+
'javascript': true,
|
|
38655
|
+
'javascript:': true
|
|
38656
|
+
},
|
|
38657
|
+
// protocols that never have a hostname.
|
|
38658
|
+
hostlessProtocol = {
|
|
38659
|
+
'javascript': true,
|
|
38660
|
+
'javascript:': true
|
|
38661
|
+
},
|
|
38662
|
+
// protocols that always contain a // bit.
|
|
38663
|
+
slashedProtocol = {
|
|
38664
|
+
'http': true,
|
|
38665
|
+
'https': true,
|
|
38666
|
+
'ftp': true,
|
|
38667
|
+
'gopher': true,
|
|
38668
|
+
'file': true,
|
|
38669
|
+
'http:': true,
|
|
38670
|
+
'https:': true,
|
|
38671
|
+
'ftp:': true,
|
|
38672
|
+
'gopher:': true,
|
|
38673
|
+
'file:': true
|
|
38674
|
+
},
|
|
38675
|
+
querystring = querystring$1;
|
|
38676
|
+
|
|
38677
|
+
function urlParse(url, parseQueryString, slashesDenoteHost) {
|
|
38678
|
+
if (url && util.isObject(url) && url instanceof Url) return url;
|
|
38679
|
+
|
|
38680
|
+
var u = new Url;
|
|
38681
|
+
u.parse(url, parseQueryString, slashesDenoteHost);
|
|
38682
|
+
return u;
|
|
38683
|
+
}
|
|
38684
|
+
|
|
38685
|
+
Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {
|
|
38686
|
+
if (!util.isString(url)) {
|
|
38687
|
+
throw new TypeError("Parameter 'url' must be a string, not " + typeof url);
|
|
38688
|
+
}
|
|
38689
|
+
|
|
38690
|
+
// Copy chrome, IE, opera backslash-handling behavior.
|
|
38691
|
+
// Back slashes before the query string get converted to forward slashes
|
|
38692
|
+
// See: https://code.google.com/p/chromium/issues/detail?id=25916
|
|
38693
|
+
var queryIndex = url.indexOf('?'),
|
|
38694
|
+
splitter =
|
|
38695
|
+
(queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#',
|
|
38696
|
+
uSplit = url.split(splitter),
|
|
38697
|
+
slashRegex = /\\/g;
|
|
38698
|
+
uSplit[0] = uSplit[0].replace(slashRegex, '/');
|
|
38699
|
+
url = uSplit.join(splitter);
|
|
38700
|
+
|
|
38701
|
+
var rest = url;
|
|
38702
|
+
|
|
38703
|
+
// trim before proceeding.
|
|
38704
|
+
// This is to support parse stuff like " http://foo.com \n"
|
|
38705
|
+
rest = rest.trim();
|
|
38706
|
+
|
|
38707
|
+
if (!slashesDenoteHost && url.split('#').length === 1) {
|
|
38708
|
+
// Try fast path regexp
|
|
38709
|
+
var simplePath = simplePathPattern.exec(rest);
|
|
38710
|
+
if (simplePath) {
|
|
38711
|
+
this.path = rest;
|
|
38712
|
+
this.href = rest;
|
|
38713
|
+
this.pathname = simplePath[1];
|
|
38714
|
+
if (simplePath[2]) {
|
|
38715
|
+
this.search = simplePath[2];
|
|
38716
|
+
if (parseQueryString) {
|
|
38717
|
+
this.query = querystring.parse(this.search.substr(1));
|
|
38718
|
+
} else {
|
|
38719
|
+
this.query = this.search.substr(1);
|
|
38720
|
+
}
|
|
38721
|
+
} else if (parseQueryString) {
|
|
38722
|
+
this.search = '';
|
|
38723
|
+
this.query = {};
|
|
38724
|
+
}
|
|
38725
|
+
return this;
|
|
38726
|
+
}
|
|
38727
|
+
}
|
|
38728
|
+
|
|
38729
|
+
var proto = protocolPattern.exec(rest);
|
|
38730
|
+
if (proto) {
|
|
38731
|
+
proto = proto[0];
|
|
38732
|
+
var lowerProto = proto.toLowerCase();
|
|
38733
|
+
this.protocol = lowerProto;
|
|
38734
|
+
rest = rest.substr(proto.length);
|
|
38735
|
+
}
|
|
38736
|
+
|
|
38737
|
+
// figure out if it's got a host
|
|
38738
|
+
// user@server is *always* interpreted as a hostname, and url
|
|
38739
|
+
// resolution will treat //foo/bar as host=foo,path=bar because that's
|
|
38740
|
+
// how the browser resolves relative URLs.
|
|
38741
|
+
if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) {
|
|
38742
|
+
var slashes = rest.substr(0, 2) === '//';
|
|
38743
|
+
if (slashes && !(proto && hostlessProtocol[proto])) {
|
|
38744
|
+
rest = rest.substr(2);
|
|
38745
|
+
this.slashes = true;
|
|
38746
|
+
}
|
|
38747
|
+
}
|
|
38748
|
+
|
|
38749
|
+
if (!hostlessProtocol[proto] &&
|
|
38750
|
+
(slashes || (proto && !slashedProtocol[proto]))) {
|
|
38751
|
+
|
|
38752
|
+
// there's a hostname.
|
|
38753
|
+
// the first instance of /, ?, ;, or # ends the host.
|
|
38754
|
+
//
|
|
38755
|
+
// If there is an @ in the hostname, then non-host chars *are* allowed
|
|
38756
|
+
// to the left of the last @ sign, unless some host-ending character
|
|
38757
|
+
// comes *before* the @-sign.
|
|
38758
|
+
// URLs are obnoxious.
|
|
38759
|
+
//
|
|
38760
|
+
// ex:
|
|
38761
|
+
// http://a@b@c/ => user:a@b host:c
|
|
38762
|
+
// http://a@b?@c => user:a host:c path:/?@c
|
|
38763
|
+
|
|
38764
|
+
// v0.12 TODO(isaacs): This is not quite how Chrome does things.
|
|
38765
|
+
// Review our test case against browsers more comprehensively.
|
|
38766
|
+
|
|
38767
|
+
// find the first instance of any hostEndingChars
|
|
38768
|
+
var hostEnd = -1;
|
|
38769
|
+
for (var i = 0; i < hostEndingChars.length; i++) {
|
|
38770
|
+
var hec = rest.indexOf(hostEndingChars[i]);
|
|
38771
|
+
if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))
|
|
38772
|
+
hostEnd = hec;
|
|
38773
|
+
}
|
|
38774
|
+
|
|
38775
|
+
// at this point, either we have an explicit point where the
|
|
38776
|
+
// auth portion cannot go past, or the last @ char is the decider.
|
|
38777
|
+
var auth, atSign;
|
|
38778
|
+
if (hostEnd === -1) {
|
|
38779
|
+
// atSign can be anywhere.
|
|
38780
|
+
atSign = rest.lastIndexOf('@');
|
|
38781
|
+
} else {
|
|
38782
|
+
// atSign must be in auth portion.
|
|
38783
|
+
// http://a@b/c@d => host:b auth:a path:/c@d
|
|
38784
|
+
atSign = rest.lastIndexOf('@', hostEnd);
|
|
38785
|
+
}
|
|
38786
|
+
|
|
38787
|
+
// Now we have a portion which is definitely the auth.
|
|
38788
|
+
// Pull that off.
|
|
38789
|
+
if (atSign !== -1) {
|
|
38790
|
+
auth = rest.slice(0, atSign);
|
|
38791
|
+
rest = rest.slice(atSign + 1);
|
|
38792
|
+
this.auth = decodeURIComponent(auth);
|
|
38793
|
+
}
|
|
38794
|
+
|
|
38795
|
+
// the host is the remaining to the left of the first non-host char
|
|
38796
|
+
hostEnd = -1;
|
|
38797
|
+
for (var i = 0; i < nonHostChars.length; i++) {
|
|
38798
|
+
var hec = rest.indexOf(nonHostChars[i]);
|
|
38799
|
+
if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))
|
|
38800
|
+
hostEnd = hec;
|
|
38801
|
+
}
|
|
38802
|
+
// if we still have not hit it, then the entire thing is a host.
|
|
38803
|
+
if (hostEnd === -1)
|
|
38804
|
+
hostEnd = rest.length;
|
|
38805
|
+
|
|
38806
|
+
this.host = rest.slice(0, hostEnd);
|
|
38807
|
+
rest = rest.slice(hostEnd);
|
|
38808
|
+
|
|
38809
|
+
// pull out port.
|
|
38810
|
+
this.parseHost();
|
|
38811
|
+
|
|
38812
|
+
// we've indicated that there is a hostname,
|
|
38813
|
+
// so even if it's empty, it has to be present.
|
|
38814
|
+
this.hostname = this.hostname || '';
|
|
38815
|
+
|
|
38816
|
+
// if hostname begins with [ and ends with ]
|
|
38817
|
+
// assume that it's an IPv6 address.
|
|
38818
|
+
var ipv6Hostname = this.hostname[0] === '[' &&
|
|
38819
|
+
this.hostname[this.hostname.length - 1] === ']';
|
|
38820
|
+
|
|
38821
|
+
// validate a little.
|
|
38822
|
+
if (!ipv6Hostname) {
|
|
38823
|
+
var hostparts = this.hostname.split(/\./);
|
|
38824
|
+
for (var i = 0, l = hostparts.length; i < l; i++) {
|
|
38825
|
+
var part = hostparts[i];
|
|
38826
|
+
if (!part) continue;
|
|
38827
|
+
if (!part.match(hostnamePartPattern)) {
|
|
38828
|
+
var newpart = '';
|
|
38829
|
+
for (var j = 0, k = part.length; j < k; j++) {
|
|
38830
|
+
if (part.charCodeAt(j) > 127) {
|
|
38831
|
+
// we replace non-ASCII char with a temporary placeholder
|
|
38832
|
+
// we need this to make sure size of hostname is not
|
|
38833
|
+
// broken by replacing non-ASCII by nothing
|
|
38834
|
+
newpart += 'x';
|
|
38835
|
+
} else {
|
|
38836
|
+
newpart += part[j];
|
|
38837
|
+
}
|
|
38838
|
+
}
|
|
38839
|
+
// we test again with ASCII char only
|
|
38840
|
+
if (!newpart.match(hostnamePartPattern)) {
|
|
38841
|
+
var validParts = hostparts.slice(0, i);
|
|
38842
|
+
var notHost = hostparts.slice(i + 1);
|
|
38843
|
+
var bit = part.match(hostnamePartStart);
|
|
38844
|
+
if (bit) {
|
|
38845
|
+
validParts.push(bit[1]);
|
|
38846
|
+
notHost.unshift(bit[2]);
|
|
38847
|
+
}
|
|
38848
|
+
if (notHost.length) {
|
|
38849
|
+
rest = '/' + notHost.join('.') + rest;
|
|
38850
|
+
}
|
|
38851
|
+
this.hostname = validParts.join('.');
|
|
38852
|
+
break;
|
|
38853
|
+
}
|
|
38854
|
+
}
|
|
38855
|
+
}
|
|
38856
|
+
}
|
|
38857
|
+
|
|
38858
|
+
if (this.hostname.length > hostnameMaxLen) {
|
|
38859
|
+
this.hostname = '';
|
|
38860
|
+
} else {
|
|
38861
|
+
// hostnames are always lower case.
|
|
38862
|
+
this.hostname = this.hostname.toLowerCase();
|
|
38863
|
+
}
|
|
38864
|
+
|
|
38865
|
+
if (!ipv6Hostname) {
|
|
38866
|
+
// IDNA Support: Returns a punycoded representation of "domain".
|
|
38867
|
+
// It only converts parts of the domain name that
|
|
38868
|
+
// have non-ASCII characters, i.e. it doesn't matter if
|
|
38869
|
+
// you call it with a domain that already is ASCII-only.
|
|
38870
|
+
this.hostname = punycode.toASCII(this.hostname);
|
|
38871
|
+
}
|
|
38872
|
+
|
|
38873
|
+
var p = this.port ? ':' + this.port : '';
|
|
38874
|
+
var h = this.hostname || '';
|
|
38875
|
+
this.host = h + p;
|
|
38876
|
+
this.href += this.host;
|
|
38877
|
+
|
|
38878
|
+
// strip [ and ] from the hostname
|
|
38879
|
+
// the host field still retains them, though
|
|
38880
|
+
if (ipv6Hostname) {
|
|
38881
|
+
this.hostname = this.hostname.substr(1, this.hostname.length - 2);
|
|
38882
|
+
if (rest[0] !== '/') {
|
|
38883
|
+
rest = '/' + rest;
|
|
38884
|
+
}
|
|
38885
|
+
}
|
|
38886
|
+
}
|
|
38887
|
+
|
|
38888
|
+
// now rest is set to the post-host stuff.
|
|
38889
|
+
// chop off any delim chars.
|
|
38890
|
+
if (!unsafeProtocol[lowerProto]) {
|
|
38891
|
+
|
|
38892
|
+
// First, make 100% sure that any "autoEscape" chars get
|
|
38893
|
+
// escaped, even if encodeURIComponent doesn't think they
|
|
38894
|
+
// need to be.
|
|
38895
|
+
for (var i = 0, l = autoEscape.length; i < l; i++) {
|
|
38896
|
+
var ae = autoEscape[i];
|
|
38897
|
+
if (rest.indexOf(ae) === -1)
|
|
38898
|
+
continue;
|
|
38899
|
+
var esc = encodeURIComponent(ae);
|
|
38900
|
+
if (esc === ae) {
|
|
38901
|
+
esc = escape(ae);
|
|
38902
|
+
}
|
|
38903
|
+
rest = rest.split(ae).join(esc);
|
|
38904
|
+
}
|
|
38905
|
+
}
|
|
38906
|
+
|
|
38907
|
+
|
|
38908
|
+
// chop off from the tail first.
|
|
38909
|
+
var hash = rest.indexOf('#');
|
|
38910
|
+
if (hash !== -1) {
|
|
38911
|
+
// got a fragment string.
|
|
38912
|
+
this.hash = rest.substr(hash);
|
|
38913
|
+
rest = rest.slice(0, hash);
|
|
38914
|
+
}
|
|
38915
|
+
var qm = rest.indexOf('?');
|
|
38916
|
+
if (qm !== -1) {
|
|
38917
|
+
this.search = rest.substr(qm);
|
|
38918
|
+
this.query = rest.substr(qm + 1);
|
|
38919
|
+
if (parseQueryString) {
|
|
38920
|
+
this.query = querystring.parse(this.query);
|
|
38921
|
+
}
|
|
38922
|
+
rest = rest.slice(0, qm);
|
|
38923
|
+
} else if (parseQueryString) {
|
|
38924
|
+
// no query string, but parseQueryString still requested
|
|
38925
|
+
this.search = '';
|
|
38926
|
+
this.query = {};
|
|
38927
|
+
}
|
|
38928
|
+
if (rest) this.pathname = rest;
|
|
38929
|
+
if (slashedProtocol[lowerProto] &&
|
|
38930
|
+
this.hostname && !this.pathname) {
|
|
38931
|
+
this.pathname = '/';
|
|
38932
|
+
}
|
|
38933
|
+
|
|
38934
|
+
//to support http.request
|
|
38935
|
+
if (this.pathname || this.search) {
|
|
38936
|
+
var p = this.pathname || '';
|
|
38937
|
+
var s = this.search || '';
|
|
38938
|
+
this.path = p + s;
|
|
38939
|
+
}
|
|
38940
|
+
|
|
38941
|
+
// finally, reconstruct the href based on what has been validated.
|
|
38942
|
+
this.href = this.format();
|
|
38943
|
+
return this;
|
|
38944
|
+
};
|
|
38945
|
+
|
|
38946
|
+
// format a parsed object into a url string
|
|
38947
|
+
function urlFormat(obj) {
|
|
38948
|
+
// ensure it's an object, and not a string url.
|
|
38949
|
+
// If it's an obj, this is a no-op.
|
|
38950
|
+
// this way, you can call url_format() on strings
|
|
38951
|
+
// to clean up potentially wonky urls.
|
|
38952
|
+
if (util.isString(obj)) obj = urlParse(obj);
|
|
38953
|
+
if (!(obj instanceof Url)) return Url.prototype.format.call(obj);
|
|
38954
|
+
return obj.format();
|
|
38955
|
+
}
|
|
38956
|
+
|
|
38957
|
+
Url.prototype.format = function() {
|
|
38958
|
+
var auth = this.auth || '';
|
|
38959
|
+
if (auth) {
|
|
38960
|
+
auth = encodeURIComponent(auth);
|
|
38961
|
+
auth = auth.replace(/%3A/i, ':');
|
|
38962
|
+
auth += '@';
|
|
38963
|
+
}
|
|
38964
|
+
|
|
38965
|
+
var protocol = this.protocol || '',
|
|
38966
|
+
pathname = this.pathname || '',
|
|
38967
|
+
hash = this.hash || '',
|
|
38968
|
+
host = false,
|
|
38969
|
+
query = '';
|
|
38970
|
+
|
|
38971
|
+
if (this.host) {
|
|
38972
|
+
host = auth + this.host;
|
|
38973
|
+
} else if (this.hostname) {
|
|
38974
|
+
host = auth + (this.hostname.indexOf(':') === -1 ?
|
|
38975
|
+
this.hostname :
|
|
38976
|
+
'[' + this.hostname + ']');
|
|
38977
|
+
if (this.port) {
|
|
38978
|
+
host += ':' + this.port;
|
|
38979
|
+
}
|
|
38980
|
+
}
|
|
38981
|
+
|
|
38982
|
+
if (this.query &&
|
|
38983
|
+
util.isObject(this.query) &&
|
|
38984
|
+
Object.keys(this.query).length) {
|
|
38985
|
+
query = querystring.stringify(this.query);
|
|
38986
|
+
}
|
|
38987
|
+
|
|
38988
|
+
var search = this.search || (query && ('?' + query)) || '';
|
|
38989
|
+
|
|
38990
|
+
if (protocol && protocol.substr(-1) !== ':') protocol += ':';
|
|
38991
|
+
|
|
38992
|
+
// only the slashedProtocols get the //. Not mailto:, xmpp:, etc.
|
|
38993
|
+
// unless they had them to begin with.
|
|
38994
|
+
if (this.slashes ||
|
|
38995
|
+
(!protocol || slashedProtocol[protocol]) && host !== false) {
|
|
38996
|
+
host = '//' + (host || '');
|
|
38997
|
+
if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname;
|
|
38998
|
+
} else if (!host) {
|
|
38999
|
+
host = '';
|
|
39000
|
+
}
|
|
39001
|
+
|
|
39002
|
+
if (hash && hash.charAt(0) !== '#') hash = '#' + hash;
|
|
39003
|
+
if (search && search.charAt(0) !== '?') search = '?' + search;
|
|
39004
|
+
|
|
39005
|
+
pathname = pathname.replace(/[?#]/g, function(match) {
|
|
39006
|
+
return encodeURIComponent(match);
|
|
39007
|
+
});
|
|
39008
|
+
search = search.replace('#', '%23');
|
|
39009
|
+
|
|
39010
|
+
return protocol + host + pathname + search + hash;
|
|
39011
|
+
};
|
|
39012
|
+
|
|
39013
|
+
function urlResolve(source, relative) {
|
|
39014
|
+
return urlParse(source, false, true).resolve(relative);
|
|
39015
|
+
}
|
|
39016
|
+
|
|
39017
|
+
Url.prototype.resolve = function(relative) {
|
|
39018
|
+
return this.resolveObject(urlParse(relative, false, true)).format();
|
|
39019
|
+
};
|
|
39020
|
+
|
|
39021
|
+
function urlResolveObject(source, relative) {
|
|
39022
|
+
if (!source) return relative;
|
|
39023
|
+
return urlParse(source, false, true).resolveObject(relative);
|
|
39024
|
+
}
|
|
39025
|
+
|
|
39026
|
+
Url.prototype.resolveObject = function(relative) {
|
|
39027
|
+
if (util.isString(relative)) {
|
|
39028
|
+
var rel = new Url();
|
|
39029
|
+
rel.parse(relative, false, true);
|
|
39030
|
+
relative = rel;
|
|
39031
|
+
}
|
|
39032
|
+
|
|
39033
|
+
var result = new Url();
|
|
39034
|
+
var tkeys = Object.keys(this);
|
|
39035
|
+
for (var tk = 0; tk < tkeys.length; tk++) {
|
|
39036
|
+
var tkey = tkeys[tk];
|
|
39037
|
+
result[tkey] = this[tkey];
|
|
39038
|
+
}
|
|
39039
|
+
|
|
39040
|
+
// hash is always overridden, no matter what.
|
|
39041
|
+
// even href="" will remove it.
|
|
39042
|
+
result.hash = relative.hash;
|
|
39043
|
+
|
|
39044
|
+
// if the relative url is empty, then there's nothing left to do here.
|
|
39045
|
+
if (relative.href === '') {
|
|
39046
|
+
result.href = result.format();
|
|
39047
|
+
return result;
|
|
39048
|
+
}
|
|
39049
|
+
|
|
39050
|
+
// hrefs like //foo/bar always cut to the protocol.
|
|
39051
|
+
if (relative.slashes && !relative.protocol) {
|
|
39052
|
+
// take everything except the protocol from relative
|
|
39053
|
+
var rkeys = Object.keys(relative);
|
|
39054
|
+
for (var rk = 0; rk < rkeys.length; rk++) {
|
|
39055
|
+
var rkey = rkeys[rk];
|
|
39056
|
+
if (rkey !== 'protocol')
|
|
39057
|
+
result[rkey] = relative[rkey];
|
|
39058
|
+
}
|
|
39059
|
+
|
|
39060
|
+
//urlParse appends trailing / to urls like http://www.example.com
|
|
39061
|
+
if (slashedProtocol[result.protocol] &&
|
|
39062
|
+
result.hostname && !result.pathname) {
|
|
39063
|
+
result.path = result.pathname = '/';
|
|
39064
|
+
}
|
|
39065
|
+
|
|
39066
|
+
result.href = result.format();
|
|
39067
|
+
return result;
|
|
39068
|
+
}
|
|
39069
|
+
|
|
39070
|
+
if (relative.protocol && relative.protocol !== result.protocol) {
|
|
39071
|
+
// if it's a known url protocol, then changing
|
|
39072
|
+
// the protocol does weird things
|
|
39073
|
+
// first, if it's not file:, then we MUST have a host,
|
|
39074
|
+
// and if there was a path
|
|
39075
|
+
// to begin with, then we MUST have a path.
|
|
39076
|
+
// if it is file:, then the host is dropped,
|
|
39077
|
+
// because that's known to be hostless.
|
|
39078
|
+
// anything else is assumed to be absolute.
|
|
39079
|
+
if (!slashedProtocol[relative.protocol]) {
|
|
39080
|
+
var keys = Object.keys(relative);
|
|
39081
|
+
for (var v = 0; v < keys.length; v++) {
|
|
39082
|
+
var k = keys[v];
|
|
39083
|
+
result[k] = relative[k];
|
|
39084
|
+
}
|
|
39085
|
+
result.href = result.format();
|
|
39086
|
+
return result;
|
|
39087
|
+
}
|
|
39088
|
+
|
|
39089
|
+
result.protocol = relative.protocol;
|
|
39090
|
+
if (!relative.host && !hostlessProtocol[relative.protocol]) {
|
|
39091
|
+
var relPath = (relative.pathname || '').split('/');
|
|
39092
|
+
while (relPath.length && !(relative.host = relPath.shift()));
|
|
39093
|
+
if (!relative.host) relative.host = '';
|
|
39094
|
+
if (!relative.hostname) relative.hostname = '';
|
|
39095
|
+
if (relPath[0] !== '') relPath.unshift('');
|
|
39096
|
+
if (relPath.length < 2) relPath.unshift('');
|
|
39097
|
+
result.pathname = relPath.join('/');
|
|
39098
|
+
} else {
|
|
39099
|
+
result.pathname = relative.pathname;
|
|
39100
|
+
}
|
|
39101
|
+
result.search = relative.search;
|
|
39102
|
+
result.query = relative.query;
|
|
39103
|
+
result.host = relative.host || '';
|
|
39104
|
+
result.auth = relative.auth;
|
|
39105
|
+
result.hostname = relative.hostname || relative.host;
|
|
39106
|
+
result.port = relative.port;
|
|
39107
|
+
// to support http.request
|
|
39108
|
+
if (result.pathname || result.search) {
|
|
39109
|
+
var p = result.pathname || '';
|
|
39110
|
+
var s = result.search || '';
|
|
39111
|
+
result.path = p + s;
|
|
39112
|
+
}
|
|
39113
|
+
result.slashes = result.slashes || relative.slashes;
|
|
39114
|
+
result.href = result.format();
|
|
39115
|
+
return result;
|
|
39116
|
+
}
|
|
39117
|
+
|
|
39118
|
+
var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'),
|
|
39119
|
+
isRelAbs = (
|
|
39120
|
+
relative.host ||
|
|
39121
|
+
relative.pathname && relative.pathname.charAt(0) === '/'
|
|
39122
|
+
),
|
|
39123
|
+
mustEndAbs = (isRelAbs || isSourceAbs ||
|
|
39124
|
+
(result.host && relative.pathname)),
|
|
39125
|
+
removeAllDots = mustEndAbs,
|
|
39126
|
+
srcPath = result.pathname && result.pathname.split('/') || [],
|
|
39127
|
+
relPath = relative.pathname && relative.pathname.split('/') || [],
|
|
39128
|
+
psychotic = result.protocol && !slashedProtocol[result.protocol];
|
|
39129
|
+
|
|
39130
|
+
// if the url is a non-slashed url, then relative
|
|
39131
|
+
// links like ../.. should be able
|
|
39132
|
+
// to crawl up to the hostname, as well. This is strange.
|
|
39133
|
+
// result.protocol has already been set by now.
|
|
39134
|
+
// Later on, put the first path part into the host field.
|
|
39135
|
+
if (psychotic) {
|
|
39136
|
+
result.hostname = '';
|
|
39137
|
+
result.port = null;
|
|
39138
|
+
if (result.host) {
|
|
39139
|
+
if (srcPath[0] === '') srcPath[0] = result.host;
|
|
39140
|
+
else srcPath.unshift(result.host);
|
|
39141
|
+
}
|
|
39142
|
+
result.host = '';
|
|
39143
|
+
if (relative.protocol) {
|
|
39144
|
+
relative.hostname = null;
|
|
39145
|
+
relative.port = null;
|
|
39146
|
+
if (relative.host) {
|
|
39147
|
+
if (relPath[0] === '') relPath[0] = relative.host;
|
|
39148
|
+
else relPath.unshift(relative.host);
|
|
39149
|
+
}
|
|
39150
|
+
relative.host = null;
|
|
39151
|
+
}
|
|
39152
|
+
mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === '');
|
|
39153
|
+
}
|
|
39154
|
+
|
|
39155
|
+
if (isRelAbs) {
|
|
39156
|
+
// it's absolute.
|
|
39157
|
+
result.host = (relative.host || relative.host === '') ?
|
|
39158
|
+
relative.host : result.host;
|
|
39159
|
+
result.hostname = (relative.hostname || relative.hostname === '') ?
|
|
39160
|
+
relative.hostname : result.hostname;
|
|
39161
|
+
result.search = relative.search;
|
|
39162
|
+
result.query = relative.query;
|
|
39163
|
+
srcPath = relPath;
|
|
39164
|
+
// fall through to the dot-handling below.
|
|
39165
|
+
} else if (relPath.length) {
|
|
39166
|
+
// it's relative
|
|
39167
|
+
// throw away the existing file, and take the new path instead.
|
|
39168
|
+
if (!srcPath) srcPath = [];
|
|
39169
|
+
srcPath.pop();
|
|
39170
|
+
srcPath = srcPath.concat(relPath);
|
|
39171
|
+
result.search = relative.search;
|
|
39172
|
+
result.query = relative.query;
|
|
39173
|
+
} else if (!util.isNullOrUndefined(relative.search)) {
|
|
39174
|
+
// just pull out the search.
|
|
39175
|
+
// like href='?foo'.
|
|
39176
|
+
// Put this after the other two cases because it simplifies the booleans
|
|
39177
|
+
if (psychotic) {
|
|
39178
|
+
result.hostname = result.host = srcPath.shift();
|
|
39179
|
+
//occationaly the auth can get stuck only in host
|
|
39180
|
+
//this especially happens in cases like
|
|
39181
|
+
//url.resolveObject('mailto:local1@domain1', 'local2@domain2')
|
|
39182
|
+
var authInHost = result.host && result.host.indexOf('@') > 0 ?
|
|
39183
|
+
result.host.split('@') : false;
|
|
39184
|
+
if (authInHost) {
|
|
39185
|
+
result.auth = authInHost.shift();
|
|
39186
|
+
result.host = result.hostname = authInHost.shift();
|
|
39187
|
+
}
|
|
39188
|
+
}
|
|
39189
|
+
result.search = relative.search;
|
|
39190
|
+
result.query = relative.query;
|
|
39191
|
+
//to support http.request
|
|
39192
|
+
if (!util.isNull(result.pathname) || !util.isNull(result.search)) {
|
|
39193
|
+
result.path = (result.pathname ? result.pathname : '') +
|
|
39194
|
+
(result.search ? result.search : '');
|
|
39195
|
+
}
|
|
39196
|
+
result.href = result.format();
|
|
39197
|
+
return result;
|
|
39198
|
+
}
|
|
39199
|
+
|
|
39200
|
+
if (!srcPath.length) {
|
|
39201
|
+
// no path at all. easy.
|
|
39202
|
+
// we've already handled the other stuff above.
|
|
39203
|
+
result.pathname = null;
|
|
39204
|
+
//to support http.request
|
|
39205
|
+
if (result.search) {
|
|
39206
|
+
result.path = '/' + result.search;
|
|
39207
|
+
} else {
|
|
39208
|
+
result.path = null;
|
|
39209
|
+
}
|
|
39210
|
+
result.href = result.format();
|
|
39211
|
+
return result;
|
|
39212
|
+
}
|
|
39213
|
+
|
|
39214
|
+
// if a url ENDs in . or .., then it must get a trailing slash.
|
|
39215
|
+
// however, if it ends in anything else non-slashy,
|
|
39216
|
+
// then it must NOT get a trailing slash.
|
|
39217
|
+
var last = srcPath.slice(-1)[0];
|
|
39218
|
+
var hasTrailingSlash = (
|
|
39219
|
+
(result.host || relative.host || srcPath.length > 1) &&
|
|
39220
|
+
(last === '.' || last === '..') || last === '');
|
|
39221
|
+
|
|
39222
|
+
// strip single dots, resolve double dots to parent dir
|
|
39223
|
+
// if the path tries to go above the root, `up` ends up > 0
|
|
39224
|
+
var up = 0;
|
|
39225
|
+
for (var i = srcPath.length; i >= 0; i--) {
|
|
39226
|
+
last = srcPath[i];
|
|
39227
|
+
if (last === '.') {
|
|
39228
|
+
srcPath.splice(i, 1);
|
|
39229
|
+
} else if (last === '..') {
|
|
39230
|
+
srcPath.splice(i, 1);
|
|
39231
|
+
up++;
|
|
39232
|
+
} else if (up) {
|
|
39233
|
+
srcPath.splice(i, 1);
|
|
39234
|
+
up--;
|
|
39235
|
+
}
|
|
39236
|
+
}
|
|
39237
|
+
|
|
39238
|
+
// if the path is allowed to go above the root, restore leading ..s
|
|
39239
|
+
if (!mustEndAbs && !removeAllDots) {
|
|
39240
|
+
for (; up--; up) {
|
|
39241
|
+
srcPath.unshift('..');
|
|
39242
|
+
}
|
|
39243
|
+
}
|
|
39244
|
+
|
|
39245
|
+
if (mustEndAbs && srcPath[0] !== '' &&
|
|
39246
|
+
(!srcPath[0] || srcPath[0].charAt(0) !== '/')) {
|
|
39247
|
+
srcPath.unshift('');
|
|
39248
|
+
}
|
|
39249
|
+
|
|
39250
|
+
if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) {
|
|
39251
|
+
srcPath.push('');
|
|
39252
|
+
}
|
|
39253
|
+
|
|
39254
|
+
var isAbsolute = srcPath[0] === '' ||
|
|
39255
|
+
(srcPath[0] && srcPath[0].charAt(0) === '/');
|
|
39256
|
+
|
|
39257
|
+
// put the host back
|
|
39258
|
+
if (psychotic) {
|
|
39259
|
+
result.hostname = result.host = isAbsolute ? '' :
|
|
39260
|
+
srcPath.length ? srcPath.shift() : '';
|
|
39261
|
+
//occationaly the auth can get stuck only in host
|
|
39262
|
+
//this especially happens in cases like
|
|
39263
|
+
//url.resolveObject('mailto:local1@domain1', 'local2@domain2')
|
|
39264
|
+
var authInHost = result.host && result.host.indexOf('@') > 0 ?
|
|
39265
|
+
result.host.split('@') : false;
|
|
39266
|
+
if (authInHost) {
|
|
39267
|
+
result.auth = authInHost.shift();
|
|
39268
|
+
result.host = result.hostname = authInHost.shift();
|
|
39269
|
+
}
|
|
39270
|
+
}
|
|
39271
|
+
|
|
39272
|
+
mustEndAbs = mustEndAbs || (result.host && srcPath.length);
|
|
39273
|
+
|
|
39274
|
+
if (mustEndAbs && !isAbsolute) {
|
|
39275
|
+
srcPath.unshift('');
|
|
39276
|
+
}
|
|
39277
|
+
|
|
39278
|
+
if (!srcPath.length) {
|
|
39279
|
+
result.pathname = null;
|
|
39280
|
+
result.path = null;
|
|
39281
|
+
} else {
|
|
39282
|
+
result.pathname = srcPath.join('/');
|
|
39283
|
+
}
|
|
39284
|
+
|
|
39285
|
+
//to support request.http
|
|
39286
|
+
if (!util.isNull(result.pathname) || !util.isNull(result.search)) {
|
|
39287
|
+
result.path = (result.pathname ? result.pathname : '') +
|
|
39288
|
+
(result.search ? result.search : '');
|
|
39289
|
+
}
|
|
39290
|
+
result.auth = relative.auth || result.auth;
|
|
39291
|
+
result.slashes = result.slashes || relative.slashes;
|
|
39292
|
+
result.href = result.format();
|
|
39293
|
+
return result;
|
|
39294
|
+
};
|
|
39295
|
+
|
|
39296
|
+
Url.prototype.parseHost = function() {
|
|
39297
|
+
var host = this.host;
|
|
39298
|
+
var port = portPattern.exec(host);
|
|
39299
|
+
if (port) {
|
|
39300
|
+
port = port[0];
|
|
39301
|
+
if (port !== ':') {
|
|
39302
|
+
this.port = port.substr(1);
|
|
39303
|
+
}
|
|
39304
|
+
host = host.substr(0, host.length - port.length);
|
|
39305
|
+
}
|
|
39306
|
+
if (host) this.hostname = host;
|
|
39307
|
+
};
|
|
39308
|
+
|
|
37948
39309
|
/**
|
|
37949
39310
|
* @typedef URL
|
|
37950
39311
|
* @property {string} hash
|
|
@@ -38090,7 +39451,7 @@ class VFile$1 {
|
|
|
38090
39451
|
* Defaults to `process.cwd()` (`/` in browsers).
|
|
38091
39452
|
* @type {string}
|
|
38092
39453
|
*/
|
|
38093
|
-
this.cwd =
|
|
39454
|
+
this.cwd = process$1.cwd();
|
|
38094
39455
|
|
|
38095
39456
|
/* eslint-disable no-unused-expressions */
|
|
38096
39457
|
/**
|
|
@@ -38168,7 +39529,7 @@ class VFile$1 {
|
|
|
38168
39529
|
*/
|
|
38169
39530
|
set path(path) {
|
|
38170
39531
|
if (isUrl$1(path)) {
|
|
38171
|
-
path = fileURLToPath(path);
|
|
39532
|
+
path = url.fileURLToPath(path);
|
|
38172
39533
|
}
|
|
38173
39534
|
|
|
38174
39535
|
assertNonEmpty$1(path, 'path');
|
|
@@ -38968,7 +40329,7 @@ class VFile {
|
|
|
38968
40329
|
* Defaults to `process.cwd()` (`/` in browsers).
|
|
38969
40330
|
* @type {string}
|
|
38970
40331
|
*/
|
|
38971
|
-
this.cwd =
|
|
40332
|
+
this.cwd = process$1.cwd();
|
|
38972
40333
|
|
|
38973
40334
|
/* eslint-disable no-unused-expressions */
|
|
38974
40335
|
/**
|
|
@@ -39046,7 +40407,7 @@ class VFile {
|
|
|
39046
40407
|
*/
|
|
39047
40408
|
set path(path) {
|
|
39048
40409
|
if (isUrl(path)) {
|
|
39049
|
-
path = fileURLToPath(path);
|
|
40410
|
+
path = url.fileURLToPath(path);
|
|
39050
40411
|
}
|
|
39051
40412
|
|
|
39052
40413
|
assertNonEmpty(path, 'path');
|
|
@@ -73309,7 +74670,7 @@ https://highlightjs.org/
|
|
|
73309
74670
|
*/
|
|
73310
74671
|
|
|
73311
74672
|
|
|
73312
|
-
const escape = escapeHTML;
|
|
74673
|
+
const escape$1 = escapeHTML;
|
|
73313
74674
|
const inherit = inherit$1;
|
|
73314
74675
|
const NO_MATCH = Symbol("nomatch");
|
|
73315
74676
|
const MAX_KEYWORD_HITS = 7;
|
|
@@ -73869,7 +75230,7 @@ const HLJS = function(hljs) {
|
|
|
73869
75230
|
if (err.message && err.message.includes('Illegal')) {
|
|
73870
75231
|
return {
|
|
73871
75232
|
language: languageName,
|
|
73872
|
-
value: escape(codeToHighlight),
|
|
75233
|
+
value: escape$1(codeToHighlight),
|
|
73873
75234
|
illegal: true,
|
|
73874
75235
|
relevance: 0,
|
|
73875
75236
|
_illegalBy: {
|
|
@@ -73884,7 +75245,7 @@ const HLJS = function(hljs) {
|
|
|
73884
75245
|
} else if (SAFE_MODE) {
|
|
73885
75246
|
return {
|
|
73886
75247
|
language: languageName,
|
|
73887
|
-
value: escape(codeToHighlight),
|
|
75248
|
+
value: escape$1(codeToHighlight),
|
|
73888
75249
|
illegal: false,
|
|
73889
75250
|
relevance: 0,
|
|
73890
75251
|
errorRaised: err,
|
|
@@ -73906,7 +75267,7 @@ const HLJS = function(hljs) {
|
|
|
73906
75267
|
*/
|
|
73907
75268
|
function justTextHighlightResult(code) {
|
|
73908
75269
|
const result = {
|
|
73909
|
-
value: escape(code),
|
|
75270
|
+
value: escape$1(code),
|
|
73910
75271
|
illegal: false,
|
|
73911
75272
|
relevance: 0,
|
|
73912
75273
|
_top: PLAINTEXT_LANGUAGE,
|