@blueking/bkui-form 0.0.45 → 0.0.46
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/bkui-form-es-min.js +3 -5
- package/dist/bkui-form-es.js +704 -1347
- package/dist/bkui-form-es.js.map +1 -1
- package/dist/bkui-form-umd-min.js +3 -5
- package/dist/bkui-form-umd.js +704 -1347
- package/dist/bkui-form-umd.js.map +1 -1
- package/package.json +1 -1
package/dist/bkui-form-umd.js
CHANGED
|
@@ -190,7 +190,7 @@
|
|
|
190
190
|
i = _objectWithoutPropertiesLoose(e, t);
|
|
191
191
|
if (Object.getOwnPropertySymbols) {
|
|
192
192
|
var n = Object.getOwnPropertySymbols(e);
|
|
193
|
-
for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o)
|
|
193
|
+
for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
194
194
|
}
|
|
195
195
|
return i;
|
|
196
196
|
}
|
|
@@ -198,7 +198,7 @@
|
|
|
198
198
|
if (null == r) return {};
|
|
199
199
|
var t = {};
|
|
200
200
|
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
201
|
-
if (e.indexOf(n)
|
|
201
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
202
202
|
t[n] = r[n];
|
|
203
203
|
}
|
|
204
204
|
return t;
|
|
@@ -592,11 +592,11 @@
|
|
|
592
592
|
}
|
|
593
593
|
return _typeof(value);
|
|
594
594
|
};
|
|
595
|
-
var
|
|
595
|
+
var _merge = function merge(target, source) {
|
|
596
596
|
if (isObj(source)) {
|
|
597
597
|
return Object.keys(source).reduce(function (pre, key) {
|
|
598
598
|
var _target;
|
|
599
|
-
pre[key] =
|
|
599
|
+
pre[key] = _merge(((_target = target) === null || _target === void 0 ? void 0 : _target[key]) || {}, source[key]);
|
|
600
600
|
return pre;
|
|
601
601
|
}, JSON.parse(JSON.stringify(target)));
|
|
602
602
|
}
|
|
@@ -604,7 +604,7 @@
|
|
|
604
604
|
target = Array.isArray(target) ? target : [];
|
|
605
605
|
return source.map(function (item, index) {
|
|
606
606
|
if (target[index]) {
|
|
607
|
-
return
|
|
607
|
+
return _merge(target[index], item);
|
|
608
608
|
}
|
|
609
609
|
return item;
|
|
610
610
|
});
|
|
@@ -1375,8 +1375,8 @@
|
|
|
1375
1375
|
headers: {},
|
|
1376
1376
|
cache: 'no-cache'
|
|
1377
1377
|
};
|
|
1378
|
-
var request = (
|
|
1379
|
-
var _ref = _asyncToGenerator(
|
|
1378
|
+
var request = (/*#__PURE__*/function () {
|
|
1379
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(url) {
|
|
1380
1380
|
var config,
|
|
1381
1381
|
_mergeDeep,
|
|
1382
1382
|
params,
|
|
@@ -1485,7 +1485,7 @@
|
|
|
1485
1485
|
return function (_x) {
|
|
1486
1486
|
return _ref.apply(this, arguments);
|
|
1487
1487
|
};
|
|
1488
|
-
}
|
|
1488
|
+
}());
|
|
1489
1489
|
|
|
1490
1490
|
var props$1 = {
|
|
1491
1491
|
// 表单值
|
|
@@ -1722,7 +1722,7 @@
|
|
|
1722
1722
|
}
|
|
1723
1723
|
};
|
|
1724
1724
|
};
|
|
1725
|
-
var
|
|
1725
|
+
var _executeExpression = function executeExpression(expression, instance) {
|
|
1726
1726
|
var $dep = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
1727
1727
|
var $args = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
1728
1728
|
var _getContext = getContext(instance),
|
|
@@ -1780,7 +1780,7 @@
|
|
|
1780
1780
|
}
|
|
1781
1781
|
if (isObj(expression)) {
|
|
1782
1782
|
Object.keys(expression).forEach(function (key) {
|
|
1783
|
-
expression[key] =
|
|
1783
|
+
expression[key] = _executeExpression(expression[key], instance);
|
|
1784
1784
|
});
|
|
1785
1785
|
return expression;
|
|
1786
1786
|
}
|
|
@@ -1837,7 +1837,7 @@
|
|
|
1837
1837
|
});
|
|
1838
1838
|
}
|
|
1839
1839
|
if (typeof reaction.if === 'string') {
|
|
1840
|
-
fullfill =
|
|
1840
|
+
fullfill = _executeExpression(reaction.if, crtInstance, deps);
|
|
1841
1841
|
}
|
|
1842
1842
|
var operations = fullfill ? reaction.then : reaction.else;
|
|
1843
1843
|
executeOperations(operations, operateInstance, deps);
|
|
@@ -1849,20 +1849,20 @@
|
|
|
1849
1849
|
Object.keys(operations.state).forEach(function (key) {
|
|
1850
1850
|
var val = operations.state[key];
|
|
1851
1851
|
if (typeof val === 'string' && /^{{.+}}$/.test(val.trim())) {
|
|
1852
|
-
val =
|
|
1852
|
+
val = _executeExpression(val, instance, deps);
|
|
1853
1853
|
}
|
|
1854
1854
|
instance.setState(key, val);
|
|
1855
1855
|
});
|
|
1856
1856
|
}
|
|
1857
1857
|
if (Array.isArray(operations.actions)) {
|
|
1858
1858
|
operations.actions.forEach(function (item) {
|
|
1859
|
-
|
|
1859
|
+
_executeExpression(item, instance, deps);
|
|
1860
1860
|
});
|
|
1861
1861
|
}
|
|
1862
1862
|
}
|
|
1863
1863
|
};
|
|
1864
1864
|
var parsePath = function parsePath(path, instance) {
|
|
1865
|
-
return isExpression(path) ?
|
|
1865
|
+
return isExpression(path) ? _executeExpression(path, instance) : path;
|
|
1866
1866
|
};
|
|
1867
1867
|
var reactionRegister = function reactionRegister(path) {
|
|
1868
1868
|
var reactions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
@@ -1915,8 +1915,6 @@
|
|
|
1915
1915
|
}
|
|
1916
1916
|
};
|
|
1917
1917
|
|
|
1918
|
-
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
1919
|
-
|
|
1920
1918
|
function getDefaultExportFromCjs (x) {
|
|
1921
1919
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
1922
1920
|
}
|
|
@@ -1938,6 +1936,7 @@
|
|
|
1938
1936
|
(function (exports) {
|
|
1939
1937
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1940
1938
|
exports.regexpCode = exports.getEsmExportName = exports.getProperty = exports.safeStringify = exports.stringify = exports.strConcat = exports.addCodeArg = exports.str = exports._ = exports.nil = exports._Code = exports.Name = exports.IDENTIFIER = exports._CodeOrName = void 0;
|
|
1939
|
+
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
|
|
1941
1940
|
class _CodeOrName {
|
|
1942
1941
|
}
|
|
1943
1942
|
exports._CodeOrName = _CodeOrName;
|
|
@@ -3946,7 +3945,7 @@
|
|
|
3946
3945
|
}
|
|
3947
3946
|
subschema.extendSubschemaMode = extendSubschemaMode;
|
|
3948
3947
|
|
|
3949
|
-
var resolve$
|
|
3948
|
+
var resolve$2 = {};
|
|
3950
3949
|
|
|
3951
3950
|
// do not edit .js files directly - edit src/index.jst
|
|
3952
3951
|
|
|
@@ -4087,10 +4086,10 @@
|
|
|
4087
4086
|
return str.replace(/~/g, '~0').replace(/\//g, '~1');
|
|
4088
4087
|
}
|
|
4089
4088
|
|
|
4090
|
-
Object.defineProperty(resolve$
|
|
4091
|
-
resolve$
|
|
4089
|
+
Object.defineProperty(resolve$2, "__esModule", { value: true });
|
|
4090
|
+
resolve$2.getSchemaRefs = resolve$2.resolveUrl = resolve$2.normalizeId = resolve$2._getFullPath = resolve$2.getFullPath = resolve$2.inlineRef = void 0;
|
|
4092
4091
|
const util_1$m = util;
|
|
4093
|
-
const equal$
|
|
4092
|
+
const equal$3 = fastDeepEqual;
|
|
4094
4093
|
const traverse = jsonSchemaTraverse.exports;
|
|
4095
4094
|
// TODO refactor to use keyword definitions
|
|
4096
4095
|
const SIMPLE_INLINED = new Set([
|
|
@@ -4120,7 +4119,7 @@
|
|
|
4120
4119
|
return false;
|
|
4121
4120
|
return countKeys(schema) <= limit;
|
|
4122
4121
|
}
|
|
4123
|
-
resolve$
|
|
4122
|
+
resolve$2.inlineRef = inlineRef;
|
|
4124
4123
|
const REF_KEYWORDS = new Set([
|
|
4125
4124
|
"$ref",
|
|
4126
4125
|
"$recursiveRef",
|
|
@@ -4162,22 +4161,22 @@
|
|
|
4162
4161
|
const p = resolver.parse(id);
|
|
4163
4162
|
return _getFullPath(resolver, p);
|
|
4164
4163
|
}
|
|
4165
|
-
resolve$
|
|
4164
|
+
resolve$2.getFullPath = getFullPath;
|
|
4166
4165
|
function _getFullPath(resolver, p) {
|
|
4167
4166
|
const serialized = resolver.serialize(p);
|
|
4168
4167
|
return serialized.split("#")[0] + "#";
|
|
4169
4168
|
}
|
|
4170
|
-
resolve$
|
|
4169
|
+
resolve$2._getFullPath = _getFullPath;
|
|
4171
4170
|
const TRAILING_SLASH_HASH = /#\/?$/;
|
|
4172
4171
|
function normalizeId(id) {
|
|
4173
4172
|
return id ? id.replace(TRAILING_SLASH_HASH, "") : "";
|
|
4174
4173
|
}
|
|
4175
|
-
resolve$
|
|
4174
|
+
resolve$2.normalizeId = normalizeId;
|
|
4176
4175
|
function resolveUrl(resolver, baseId, id) {
|
|
4177
4176
|
id = normalizeId(id);
|
|
4178
4177
|
return resolver.resolve(baseId, id);
|
|
4179
4178
|
}
|
|
4180
|
-
resolve$
|
|
4179
|
+
resolve$2.resolveUrl = resolveUrl;
|
|
4181
4180
|
const ANCHOR = /^[a-z_][-a-z0-9._]*$/i;
|
|
4182
4181
|
function getSchemaRefs(schema, baseId) {
|
|
4183
4182
|
if (typeof schema == "boolean")
|
|
@@ -4232,14 +4231,14 @@
|
|
|
4232
4231
|
});
|
|
4233
4232
|
return localRefs;
|
|
4234
4233
|
function checkAmbiguosRef(sch1, sch2, ref) {
|
|
4235
|
-
if (sch2 !== undefined && !equal$
|
|
4234
|
+
if (sch2 !== undefined && !equal$3(sch1, sch2))
|
|
4236
4235
|
throw ambiguos(ref);
|
|
4237
4236
|
}
|
|
4238
4237
|
function ambiguos(ref) {
|
|
4239
4238
|
return new Error(`reference "${ref}" resolves to more than one schema`);
|
|
4240
4239
|
}
|
|
4241
4240
|
}
|
|
4242
|
-
resolve$
|
|
4241
|
+
resolve$2.getSchemaRefs = getSchemaRefs;
|
|
4243
4242
|
|
|
4244
4243
|
Object.defineProperty(validate$1, "__esModule", { value: true });
|
|
4245
4244
|
validate$1.getData = validate$1.KeywordCxt = validate$1.validateFunctionCode = void 0;
|
|
@@ -4252,7 +4251,7 @@
|
|
|
4252
4251
|
const subschema_1 = subschema;
|
|
4253
4252
|
const codegen_1$n = codegen;
|
|
4254
4253
|
const names_1$3 = names$1;
|
|
4255
|
-
const resolve_1$2 = resolve$
|
|
4254
|
+
const resolve_1$2 = resolve$2;
|
|
4256
4255
|
const util_1$l = util;
|
|
4257
4256
|
const errors_1 = errors;
|
|
4258
4257
|
// schema compilation - generates validation function, subschemaCode (below) is used for subschemas
|
|
@@ -4774,7 +4773,7 @@
|
|
|
4774
4773
|
var ref_error = {};
|
|
4775
4774
|
|
|
4776
4775
|
Object.defineProperty(ref_error, "__esModule", { value: true });
|
|
4777
|
-
const resolve_1$1 = resolve$
|
|
4776
|
+
const resolve_1$1 = resolve$2;
|
|
4778
4777
|
class MissingRefError extends Error {
|
|
4779
4778
|
constructor(resolver, baseId, ref, msg) {
|
|
4780
4779
|
super(msg || `can't resolve reference ${ref} from id ${baseId}`);
|
|
@@ -4791,7 +4790,7 @@
|
|
|
4791
4790
|
const codegen_1$m = codegen;
|
|
4792
4791
|
const validation_error_1 = validation_error;
|
|
4793
4792
|
const names_1$2 = names$1;
|
|
4794
|
-
const resolve_1 = resolve$
|
|
4793
|
+
const resolve_1 = resolve$2;
|
|
4795
4794
|
const util_1$k = util;
|
|
4796
4795
|
const validate_1$1 = validate$1;
|
|
4797
4796
|
class SchemaEnv {
|
|
@@ -4917,7 +4916,7 @@
|
|
|
4917
4916
|
const schOrFunc = root.refs[ref];
|
|
4918
4917
|
if (schOrFunc)
|
|
4919
4918
|
return schOrFunc;
|
|
4920
|
-
let _sch = resolve.call(this, root, ref);
|
|
4919
|
+
let _sch = resolve$1.call(this, root, ref);
|
|
4921
4920
|
if (_sch === undefined) {
|
|
4922
4921
|
const schema = (_a = root.localRefs) === null || _a === void 0 ? void 0 : _a[ref]; // TODO maybe localRefs should hold SchemaEnv
|
|
4923
4922
|
const { schemaId } = this.opts;
|
|
@@ -4947,7 +4946,7 @@
|
|
|
4947
4946
|
}
|
|
4948
4947
|
// resolve and compile the references ($ref)
|
|
4949
4948
|
// TODO returns AnySchemaObject (if the schema can be inlined) or validation function
|
|
4950
|
-
function resolve(root, // information about the root schema for the current schema
|
|
4949
|
+
function resolve$1(root, // information about the root schema for the current schema
|
|
4951
4950
|
ref // reference to resolve
|
|
4952
4951
|
) {
|
|
4953
4952
|
let sch;
|
|
@@ -5058,1416 +5057,770 @@
|
|
|
5058
5057
|
|
|
5059
5058
|
var uri$1 = {};
|
|
5060
5059
|
|
|
5061
|
-
var
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
|
|
5090
|
-
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
}
|
|
5095
|
-
|
|
5096
|
-
|
|
5097
|
-
|
|
5098
|
-
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
return obj;
|
|
5106
|
-
}
|
|
5107
|
-
|
|
5108
|
-
function buildExps(isIRI) {
|
|
5109
|
-
var ALPHA$$ = "[A-Za-z]",
|
|
5110
|
-
DIGIT$$ = "[0-9]",
|
|
5111
|
-
HEXDIG$$ = merge(DIGIT$$, "[A-Fa-f]"),
|
|
5112
|
-
PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)),
|
|
5113
|
-
//expanded
|
|
5114
|
-
GEN_DELIMS$$ = "[\\:\\/\\?\\#\\[\\]\\@]",
|
|
5115
|
-
SUB_DELIMS$$ = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",
|
|
5116
|
-
RESERVED$$ = merge(GEN_DELIMS$$, SUB_DELIMS$$),
|
|
5117
|
-
UCSCHAR$$ = isIRI ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]",
|
|
5118
|
-
//subset, excludes bidi control characters
|
|
5119
|
-
IPRIVATE$$ = isIRI ? "[\\uE000-\\uF8FF]" : "[]",
|
|
5120
|
-
//subset
|
|
5121
|
-
UNRESERVED$$ = merge(ALPHA$$, DIGIT$$, "[\\-\\.\\_\\~]", UCSCHAR$$);
|
|
5122
|
-
subexp(ALPHA$$ + merge(ALPHA$$, DIGIT$$, "[\\+\\-\\.]") + "*");
|
|
5123
|
-
subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]")) + "*");
|
|
5124
|
-
var DEC_OCTET_RELAXED$ = subexp(subexp("25[0-5]") + "|" + subexp("2[0-4]" + DIGIT$$) + "|" + subexp("1" + DIGIT$$ + DIGIT$$) + "|" + subexp("0?[1-9]" + DIGIT$$) + "|0?0?" + DIGIT$$),
|
|
5125
|
-
//relaxed parsing rules
|
|
5126
|
-
IPV4ADDRESS$ = subexp(DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$),
|
|
5127
|
-
H16$ = subexp(HEXDIG$$ + "{1,4}"),
|
|
5128
|
-
LS32$ = subexp(subexp(H16$ + "\\:" + H16$) + "|" + IPV4ADDRESS$),
|
|
5129
|
-
IPV6ADDRESS1$ = subexp(subexp(H16$ + "\\:") + "{6}" + LS32$),
|
|
5130
|
-
// 6( h16 ":" ) ls32
|
|
5131
|
-
IPV6ADDRESS2$ = subexp("\\:\\:" + subexp(H16$ + "\\:") + "{5}" + LS32$),
|
|
5132
|
-
// "::" 5( h16 ":" ) ls32
|
|
5133
|
-
IPV6ADDRESS3$ = subexp(subexp(H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{4}" + LS32$),
|
|
5134
|
-
//[ h16 ] "::" 4( h16 ":" ) ls32
|
|
5135
|
-
IPV6ADDRESS4$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,1}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{3}" + LS32$),
|
|
5136
|
-
//[ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
|
|
5137
|
-
IPV6ADDRESS5$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,2}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{2}" + LS32$),
|
|
5138
|
-
//[ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
|
|
5139
|
-
IPV6ADDRESS6$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,3}" + H16$) + "?\\:\\:" + H16$ + "\\:" + LS32$),
|
|
5140
|
-
//[ *3( h16 ":" ) h16 ] "::" h16 ":" ls32
|
|
5141
|
-
IPV6ADDRESS7$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,4}" + H16$) + "?\\:\\:" + LS32$),
|
|
5142
|
-
//[ *4( h16 ":" ) h16 ] "::" ls32
|
|
5143
|
-
IPV6ADDRESS8$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,5}" + H16$) + "?\\:\\:" + H16$),
|
|
5144
|
-
//[ *5( h16 ":" ) h16 ] "::" h16
|
|
5145
|
-
IPV6ADDRESS9$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,6}" + H16$) + "?\\:\\:"),
|
|
5146
|
-
//[ *6( h16 ":" ) h16 ] "::"
|
|
5147
|
-
IPV6ADDRESS$ = subexp([IPV6ADDRESS1$, IPV6ADDRESS2$, IPV6ADDRESS3$, IPV6ADDRESS4$, IPV6ADDRESS5$, IPV6ADDRESS6$, IPV6ADDRESS7$, IPV6ADDRESS8$, IPV6ADDRESS9$].join("|")),
|
|
5148
|
-
ZONEID$ = subexp(subexp(UNRESERVED$$ + "|" + PCT_ENCODED$) + "+");
|
|
5149
|
-
//RFC 6874, with relaxed parsing rules
|
|
5150
|
-
subexp("[vV]" + HEXDIG$$ + "+\\." + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]") + "+");
|
|
5151
|
-
//RFC 6874
|
|
5152
|
-
subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$)) + "*");
|
|
5153
|
-
var PCHAR$ = subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@]"));
|
|
5154
|
-
subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\@]")) + "+");
|
|
5155
|
-
subexp(subexp(PCHAR$ + "|" + merge("[\\/\\?]", IPRIVATE$$)) + "*");
|
|
5156
|
-
return {
|
|
5157
|
-
NOT_SCHEME: new RegExp(merge("[^]", ALPHA$$, DIGIT$$, "[\\+\\-\\.]"), "g"),
|
|
5158
|
-
NOT_USERINFO: new RegExp(merge("[^\\%\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"),
|
|
5159
|
-
NOT_HOST: new RegExp(merge("[^\\%\\[\\]\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"),
|
|
5160
|
-
NOT_PATH: new RegExp(merge("[^\\%\\/\\:\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"),
|
|
5161
|
-
NOT_PATH_NOSCHEME: new RegExp(merge("[^\\%\\/\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"),
|
|
5162
|
-
NOT_QUERY: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]", IPRIVATE$$), "g"),
|
|
5163
|
-
NOT_FRAGMENT: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]"), "g"),
|
|
5164
|
-
ESCAPE: new RegExp(merge("[^]", UNRESERVED$$, SUB_DELIMS$$), "g"),
|
|
5165
|
-
UNRESERVED: new RegExp(UNRESERVED$$, "g"),
|
|
5166
|
-
OTHER_CHARS: new RegExp(merge("[^\\%]", UNRESERVED$$, RESERVED$$), "g"),
|
|
5167
|
-
PCT_ENCODED: new RegExp(PCT_ENCODED$, "g"),
|
|
5168
|
-
IPV4ADDRESS: new RegExp("^(" + IPV4ADDRESS$ + ")$"),
|
|
5169
|
-
IPV6ADDRESS: new RegExp("^\\[?(" + IPV6ADDRESS$ + ")" + subexp(subexp("\\%25|\\%(?!" + HEXDIG$$ + "{2})") + "(" + ZONEID$ + ")") + "?\\]?$") //RFC 6874, with relaxed parsing rules
|
|
5170
|
-
};
|
|
5060
|
+
var fastUri$1 = {exports: {}};
|
|
5061
|
+
|
|
5062
|
+
const HEX$1 = {
|
|
5063
|
+
0: 0,
|
|
5064
|
+
1: 1,
|
|
5065
|
+
2: 2,
|
|
5066
|
+
3: 3,
|
|
5067
|
+
4: 4,
|
|
5068
|
+
5: 5,
|
|
5069
|
+
6: 6,
|
|
5070
|
+
7: 7,
|
|
5071
|
+
8: 8,
|
|
5072
|
+
9: 9,
|
|
5073
|
+
a: 10,
|
|
5074
|
+
A: 10,
|
|
5075
|
+
b: 11,
|
|
5076
|
+
B: 11,
|
|
5077
|
+
c: 12,
|
|
5078
|
+
C: 12,
|
|
5079
|
+
d: 13,
|
|
5080
|
+
D: 13,
|
|
5081
|
+
e: 14,
|
|
5082
|
+
E: 14,
|
|
5083
|
+
f: 15,
|
|
5084
|
+
F: 15
|
|
5085
|
+
};
|
|
5086
|
+
|
|
5087
|
+
var scopedChars = {
|
|
5088
|
+
HEX: HEX$1
|
|
5089
|
+
};
|
|
5090
|
+
|
|
5091
|
+
const { HEX } = scopedChars;
|
|
5092
|
+
|
|
5093
|
+
const IPV4_REG = /^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u;
|
|
5094
|
+
|
|
5095
|
+
function normalizeIPv4$1 (host) {
|
|
5096
|
+
if (findToken(host, '.') < 3) { return { host, isIPV4: false } }
|
|
5097
|
+
const matches = host.match(IPV4_REG) || [];
|
|
5098
|
+
const [address] = matches;
|
|
5099
|
+
if (address) {
|
|
5100
|
+
return { host: stripLeadingZeros(address, '.'), isIPV4: true }
|
|
5101
|
+
} else {
|
|
5102
|
+
return { host, isIPV4: false }
|
|
5103
|
+
}
|
|
5171
5104
|
}
|
|
5172
|
-
var URI_PROTOCOL = buildExps(false);
|
|
5173
|
-
|
|
5174
|
-
var IRI_PROTOCOL = buildExps(true);
|
|
5175
|
-
|
|
5176
|
-
var slicedToArray = function () {
|
|
5177
|
-
function sliceIterator(arr, i) {
|
|
5178
|
-
var _arr = [];
|
|
5179
|
-
var _n = true;
|
|
5180
|
-
var _d = false;
|
|
5181
|
-
var _e = undefined;
|
|
5182
5105
|
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
5106
|
+
/**
|
|
5107
|
+
* @param {string[]} input
|
|
5108
|
+
* @param {boolean} [keepZero=false]
|
|
5109
|
+
* @returns {string|undefined}
|
|
5110
|
+
*/
|
|
5111
|
+
function stringArrayToHexStripped (input, keepZero = false) {
|
|
5112
|
+
let acc = '';
|
|
5113
|
+
let strip = true;
|
|
5114
|
+
for (const c of input) {
|
|
5115
|
+
if (HEX[c] === undefined) return undefined
|
|
5116
|
+
if (c !== '0' && strip === true) strip = false;
|
|
5117
|
+
if (!strip) acc += c;
|
|
5118
|
+
}
|
|
5119
|
+
if (keepZero && acc.length === 0) acc = '0';
|
|
5120
|
+
return acc
|
|
5121
|
+
}
|
|
5122
|
+
|
|
5123
|
+
function getIPV6 (input) {
|
|
5124
|
+
let tokenCount = 0;
|
|
5125
|
+
const output = { error: false, address: '', zone: '' };
|
|
5126
|
+
const address = [];
|
|
5127
|
+
const buffer = [];
|
|
5128
|
+
let isZone = false;
|
|
5129
|
+
let endipv6Encountered = false;
|
|
5130
|
+
let endIpv6 = false;
|
|
5131
|
+
|
|
5132
|
+
function consume () {
|
|
5133
|
+
if (buffer.length) {
|
|
5134
|
+
if (isZone === false) {
|
|
5135
|
+
const hex = stringArrayToHexStripped(buffer);
|
|
5136
|
+
if (hex !== undefined) {
|
|
5137
|
+
address.push(hex);
|
|
5138
|
+
} else {
|
|
5139
|
+
output.error = true;
|
|
5140
|
+
return false
|
|
5141
|
+
}
|
|
5142
|
+
}
|
|
5143
|
+
buffer.length = 0;
|
|
5144
|
+
}
|
|
5145
|
+
return true
|
|
5146
|
+
}
|
|
5186
5147
|
|
|
5187
|
-
|
|
5148
|
+
for (let i = 0; i < input.length; i++) {
|
|
5149
|
+
const cursor = input[i];
|
|
5150
|
+
if (cursor === '[' || cursor === ']') { continue }
|
|
5151
|
+
if (cursor === ':') {
|
|
5152
|
+
if (endipv6Encountered === true) {
|
|
5153
|
+
endIpv6 = true;
|
|
5188
5154
|
}
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
if (_d) throw _e;
|
|
5155
|
+
if (!consume()) { break }
|
|
5156
|
+
tokenCount++;
|
|
5157
|
+
address.push(':');
|
|
5158
|
+
if (tokenCount > 7) {
|
|
5159
|
+
// not valid
|
|
5160
|
+
output.error = true;
|
|
5161
|
+
break
|
|
5197
5162
|
}
|
|
5163
|
+
if (i - 1 >= 0 && input[i - 1] === ':') {
|
|
5164
|
+
endipv6Encountered = true;
|
|
5165
|
+
}
|
|
5166
|
+
continue
|
|
5167
|
+
} else if (cursor === '%') {
|
|
5168
|
+
if (!consume()) { break }
|
|
5169
|
+
// switch to zone detection
|
|
5170
|
+
isZone = true;
|
|
5171
|
+
} else {
|
|
5172
|
+
buffer.push(cursor);
|
|
5173
|
+
continue
|
|
5198
5174
|
}
|
|
5199
|
-
|
|
5200
|
-
return _arr;
|
|
5201
5175
|
}
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
return sliceIterator(arr, i);
|
|
5176
|
+
if (buffer.length) {
|
|
5177
|
+
if (isZone) {
|
|
5178
|
+
output.zone = buffer.join('');
|
|
5179
|
+
} else if (endIpv6) {
|
|
5180
|
+
address.push(buffer.join(''));
|
|
5208
5181
|
} else {
|
|
5209
|
-
|
|
5182
|
+
address.push(stringArrayToHexStripped(buffer));
|
|
5210
5183
|
}
|
|
5211
|
-
}
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5184
|
+
}
|
|
5185
|
+
output.address = address.join('');
|
|
5186
|
+
return output
|
|
5187
|
+
}
|
|
5225
5188
|
|
|
5226
|
-
|
|
5227
|
-
if (
|
|
5228
|
-
|
|
5189
|
+
function normalizeIPv6$1 (host) {
|
|
5190
|
+
if (findToken(host, ':') < 2) { return { host, isIPV6: false } }
|
|
5191
|
+
const ipv6 = getIPV6(host);
|
|
5229
5192
|
|
|
5230
|
-
|
|
5193
|
+
if (!ipv6.error) {
|
|
5194
|
+
let newHost = ipv6.address;
|
|
5195
|
+
let escapedHost = ipv6.address;
|
|
5196
|
+
if (ipv6.zone) {
|
|
5197
|
+
newHost += '%' + ipv6.zone;
|
|
5198
|
+
escapedHost += '%25' + ipv6.zone;
|
|
5199
|
+
}
|
|
5200
|
+
return { host: newHost, escapedHost, isIPV6: true }
|
|
5231
5201
|
} else {
|
|
5232
|
-
return
|
|
5202
|
+
return { host, isIPV6: false }
|
|
5233
5203
|
}
|
|
5234
|
-
};
|
|
5235
|
-
|
|
5236
|
-
/** Highest positive signed 32-bit float value */
|
|
5237
|
-
|
|
5238
|
-
var maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1
|
|
5239
|
-
|
|
5240
|
-
/** Bootstring parameters */
|
|
5241
|
-
var base = 36;
|
|
5242
|
-
var tMin = 1;
|
|
5243
|
-
var tMax = 26;
|
|
5244
|
-
var skew = 38;
|
|
5245
|
-
var damp = 700;
|
|
5246
|
-
var initialBias = 72;
|
|
5247
|
-
var initialN = 128; // 0x80
|
|
5248
|
-
var delimiter = '-'; // '\x2D'
|
|
5249
|
-
|
|
5250
|
-
/** Regular expressions */
|
|
5251
|
-
var regexPunycode = /^xn--/;
|
|
5252
|
-
var regexNonASCII = /[^\0-\x7E]/; // non-ASCII chars
|
|
5253
|
-
var regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g; // RFC 3490 separators
|
|
5254
|
-
|
|
5255
|
-
/** Error messages */
|
|
5256
|
-
var errors = {
|
|
5257
|
-
'overflow': 'Overflow: input needs wider integers to process',
|
|
5258
|
-
'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
|
|
5259
|
-
'invalid-input': 'Invalid input'
|
|
5260
|
-
};
|
|
5261
|
-
|
|
5262
|
-
/** Convenience shortcuts */
|
|
5263
|
-
var baseMinusTMin = base - tMin;
|
|
5264
|
-
var floor = Math.floor;
|
|
5265
|
-
var stringFromCharCode = String.fromCharCode;
|
|
5266
|
-
|
|
5267
|
-
/*--------------------------------------------------------------------------*/
|
|
5268
|
-
|
|
5269
|
-
/**
|
|
5270
|
-
* A generic error utility function.
|
|
5271
|
-
* @private
|
|
5272
|
-
* @param {String} type The error type.
|
|
5273
|
-
* @returns {Error} Throws a `RangeError` with the applicable error message.
|
|
5274
|
-
*/
|
|
5275
|
-
function error$1(type) {
|
|
5276
|
-
throw new RangeError(errors[type]);
|
|
5277
5204
|
}
|
|
5278
5205
|
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
|
|
5292
|
-
|
|
5293
|
-
|
|
5206
|
+
function stripLeadingZeros (str, token) {
|
|
5207
|
+
let out = '';
|
|
5208
|
+
let skip = true;
|
|
5209
|
+
const l = str.length;
|
|
5210
|
+
for (let i = 0; i < l; i++) {
|
|
5211
|
+
const c = str[i];
|
|
5212
|
+
if (c === '0' && skip) {
|
|
5213
|
+
if ((i + 1 <= l && str[i + 1] === token) || i + 1 === l) {
|
|
5214
|
+
out += c;
|
|
5215
|
+
skip = false;
|
|
5216
|
+
}
|
|
5217
|
+
} else {
|
|
5218
|
+
if (c === token) {
|
|
5219
|
+
skip = true;
|
|
5220
|
+
} else {
|
|
5221
|
+
skip = false;
|
|
5222
|
+
}
|
|
5223
|
+
out += c;
|
|
5224
|
+
}
|
|
5225
|
+
}
|
|
5226
|
+
return out
|
|
5294
5227
|
}
|
|
5295
5228
|
|
|
5296
|
-
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
|
|
5300
|
-
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
|
|
5312
|
-
|
|
5313
|
-
|
|
5314
|
-
|
|
5315
|
-
|
|
5316
|
-
|
|
5317
|
-
|
|
5318
|
-
|
|
5319
|
-
|
|
5229
|
+
function findToken (str, token) {
|
|
5230
|
+
let ind = 0;
|
|
5231
|
+
for (let i = 0; i < str.length; i++) {
|
|
5232
|
+
if (str[i] === token) ind++;
|
|
5233
|
+
}
|
|
5234
|
+
return ind
|
|
5235
|
+
}
|
|
5236
|
+
|
|
5237
|
+
const RDS1 = /^\.\.?\//u;
|
|
5238
|
+
const RDS2 = /^\/\.(?:\/|$)/u;
|
|
5239
|
+
const RDS3 = /^\/\.\.(?:\/|$)/u;
|
|
5240
|
+
const RDS5 = /^\/?(?:.|\n)*?(?=\/|$)/u;
|
|
5241
|
+
|
|
5242
|
+
function removeDotSegments$1 (input) {
|
|
5243
|
+
const output = [];
|
|
5244
|
+
|
|
5245
|
+
while (input.length) {
|
|
5246
|
+
if (input.match(RDS1)) {
|
|
5247
|
+
input = input.replace(RDS1, '');
|
|
5248
|
+
} else if (input.match(RDS2)) {
|
|
5249
|
+
input = input.replace(RDS2, '/');
|
|
5250
|
+
} else if (input.match(RDS3)) {
|
|
5251
|
+
input = input.replace(RDS3, '/');
|
|
5252
|
+
output.pop();
|
|
5253
|
+
} else if (input === '.' || input === '..') {
|
|
5254
|
+
input = '';
|
|
5255
|
+
} else {
|
|
5256
|
+
const im = input.match(RDS5);
|
|
5257
|
+
if (im) {
|
|
5258
|
+
const s = im[0];
|
|
5259
|
+
input = input.slice(s.length);
|
|
5260
|
+
output.push(s);
|
|
5261
|
+
} else {
|
|
5262
|
+
throw new Error('Unexpected dot segment condition')
|
|
5263
|
+
}
|
|
5264
|
+
}
|
|
5265
|
+
}
|
|
5266
|
+
return output.join('')
|
|
5320
5267
|
}
|
|
5321
5268
|
|
|
5322
|
-
|
|
5323
|
-
|
|
5324
|
-
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
-
|
|
5328
|
-
|
|
5329
|
-
|
|
5330
|
-
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
var extra = string.charCodeAt(counter++);
|
|
5344
|
-
if ((extra & 0xFC00) == 0xDC00) {
|
|
5345
|
-
// Low surrogate.
|
|
5346
|
-
output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
|
|
5347
|
-
} else {
|
|
5348
|
-
// It's an unmatched surrogate; only append this code unit, in case the
|
|
5349
|
-
// next code unit is the high surrogate of a surrogate pair.
|
|
5350
|
-
output.push(value);
|
|
5351
|
-
counter--;
|
|
5352
|
-
}
|
|
5353
|
-
} else {
|
|
5354
|
-
output.push(value);
|
|
5355
|
-
}
|
|
5356
|
-
}
|
|
5357
|
-
return output;
|
|
5269
|
+
function normalizeComponentEncoding$1 (components, esc) {
|
|
5270
|
+
const func = esc !== true ? escape : unescape;
|
|
5271
|
+
if (components.scheme !== undefined) {
|
|
5272
|
+
components.scheme = func(components.scheme);
|
|
5273
|
+
}
|
|
5274
|
+
if (components.userinfo !== undefined) {
|
|
5275
|
+
components.userinfo = func(components.userinfo);
|
|
5276
|
+
}
|
|
5277
|
+
if (components.host !== undefined) {
|
|
5278
|
+
components.host = func(components.host);
|
|
5279
|
+
}
|
|
5280
|
+
if (components.path !== undefined) {
|
|
5281
|
+
components.path = func(components.path);
|
|
5282
|
+
}
|
|
5283
|
+
if (components.query !== undefined) {
|
|
5284
|
+
components.query = func(components.query);
|
|
5285
|
+
}
|
|
5286
|
+
if (components.fragment !== undefined) {
|
|
5287
|
+
components.fragment = func(components.fragment);
|
|
5288
|
+
}
|
|
5289
|
+
return components
|
|
5358
5290
|
}
|
|
5359
5291
|
|
|
5360
|
-
|
|
5361
|
-
|
|
5362
|
-
* @see `punycode.ucs2.decode`
|
|
5363
|
-
* @memberOf punycode.ucs2
|
|
5364
|
-
* @name encode
|
|
5365
|
-
* @param {Array} codePoints The array of numeric code points.
|
|
5366
|
-
* @returns {String} The new Unicode string (UCS-2).
|
|
5367
|
-
*/
|
|
5368
|
-
var ucs2encode = function ucs2encode(array) {
|
|
5369
|
-
return String.fromCodePoint.apply(String, toConsumableArray(array));
|
|
5370
|
-
};
|
|
5292
|
+
function recomposeAuthority$1 (components) {
|
|
5293
|
+
const uriTokens = [];
|
|
5371
5294
|
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
* @param {Number} codePoint The basic numeric code point value.
|
|
5377
|
-
* @returns {Number} The numeric value of a basic code point (for use in
|
|
5378
|
-
* representing integers) in the range `0` to `base - 1`, or `base` if
|
|
5379
|
-
* the code point does not represent a value.
|
|
5380
|
-
*/
|
|
5381
|
-
var basicToDigit = function basicToDigit(codePoint) {
|
|
5382
|
-
if (codePoint - 0x30 < 0x0A) {
|
|
5383
|
-
return codePoint - 0x16;
|
|
5384
|
-
}
|
|
5385
|
-
if (codePoint - 0x41 < 0x1A) {
|
|
5386
|
-
return codePoint - 0x41;
|
|
5387
|
-
}
|
|
5388
|
-
if (codePoint - 0x61 < 0x1A) {
|
|
5389
|
-
return codePoint - 0x61;
|
|
5390
|
-
}
|
|
5391
|
-
return base;
|
|
5392
|
-
};
|
|
5393
|
-
|
|
5394
|
-
/**
|
|
5395
|
-
* Converts a digit/integer into a basic code point.
|
|
5396
|
-
* @see `basicToDigit()`
|
|
5397
|
-
* @private
|
|
5398
|
-
* @param {Number} digit The numeric value of a basic code point.
|
|
5399
|
-
* @returns {Number} The basic code point whose value (when used for
|
|
5400
|
-
* representing integers) is `digit`, which needs to be in the range
|
|
5401
|
-
* `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
|
|
5402
|
-
* used; else, the lowercase form is used. The behavior is undefined
|
|
5403
|
-
* if `flag` is non-zero and `digit` has no uppercase form.
|
|
5404
|
-
*/
|
|
5405
|
-
var digitToBasic = function digitToBasic(digit, flag) {
|
|
5406
|
-
// 0..25 map to ASCII a..z or A..Z
|
|
5407
|
-
// 26..35 map to ASCII 0..9
|
|
5408
|
-
return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
|
|
5409
|
-
};
|
|
5410
|
-
|
|
5411
|
-
/**
|
|
5412
|
-
* Bias adaptation function as per section 3.4 of RFC 3492.
|
|
5413
|
-
* https://tools.ietf.org/html/rfc3492#section-3.4
|
|
5414
|
-
* @private
|
|
5415
|
-
*/
|
|
5416
|
-
var adapt = function adapt(delta, numPoints, firstTime) {
|
|
5417
|
-
var k = 0;
|
|
5418
|
-
delta = firstTime ? floor(delta / damp) : delta >> 1;
|
|
5419
|
-
delta += floor(delta / numPoints);
|
|
5420
|
-
for (; /* no initialization */delta > baseMinusTMin * tMax >> 1; k += base) {
|
|
5421
|
-
delta = floor(delta / baseMinusTMin);
|
|
5422
|
-
}
|
|
5423
|
-
return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
|
|
5424
|
-
};
|
|
5425
|
-
|
|
5426
|
-
/**
|
|
5427
|
-
* Converts a Punycode string of ASCII-only symbols to a string of Unicode
|
|
5428
|
-
* symbols.
|
|
5429
|
-
* @memberOf punycode
|
|
5430
|
-
* @param {String} input The Punycode string of ASCII-only symbols.
|
|
5431
|
-
* @returns {String} The resulting string of Unicode symbols.
|
|
5432
|
-
*/
|
|
5433
|
-
var decode = function decode(input) {
|
|
5434
|
-
// Don't use UCS-2.
|
|
5435
|
-
var output = [];
|
|
5436
|
-
var inputLength = input.length;
|
|
5437
|
-
var i = 0;
|
|
5438
|
-
var n = initialN;
|
|
5439
|
-
var bias = initialBias;
|
|
5440
|
-
|
|
5441
|
-
// Handle the basic code points: let `basic` be the number of input code
|
|
5442
|
-
// points before the last delimiter, or `0` if there is none, then copy
|
|
5443
|
-
// the first basic code points to the output.
|
|
5444
|
-
|
|
5445
|
-
var basic = input.lastIndexOf(delimiter);
|
|
5446
|
-
if (basic < 0) {
|
|
5447
|
-
basic = 0;
|
|
5448
|
-
}
|
|
5449
|
-
|
|
5450
|
-
for (var j = 0; j < basic; ++j) {
|
|
5451
|
-
// if it's not a basic code point
|
|
5452
|
-
if (input.charCodeAt(j) >= 0x80) {
|
|
5453
|
-
error$1('not-basic');
|
|
5454
|
-
}
|
|
5455
|
-
output.push(input.charCodeAt(j));
|
|
5456
|
-
}
|
|
5457
|
-
|
|
5458
|
-
// Main decoding loop: start just after the last delimiter if any basic code
|
|
5459
|
-
// points were copied; start at the beginning otherwise.
|
|
5295
|
+
if (components.userinfo !== undefined) {
|
|
5296
|
+
uriTokens.push(components.userinfo);
|
|
5297
|
+
uriTokens.push('@');
|
|
5298
|
+
}
|
|
5460
5299
|
|
|
5461
|
-
|
|
5300
|
+
if (components.host !== undefined) {
|
|
5301
|
+
let host = unescape(components.host);
|
|
5302
|
+
const ipV4res = normalizeIPv4$1(host);
|
|
5462
5303
|
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
|
-
|
|
5304
|
+
if (ipV4res.isIPV4) {
|
|
5305
|
+
host = ipV4res.host;
|
|
5306
|
+
} else {
|
|
5307
|
+
const ipV6res = normalizeIPv6$1(ipV4res.host);
|
|
5308
|
+
if (ipV6res.isIPV6 === true) {
|
|
5309
|
+
host = `[${ipV6res.escapedHost}]`;
|
|
5310
|
+
} else {
|
|
5311
|
+
host = components.host;
|
|
5312
|
+
}
|
|
5313
|
+
}
|
|
5314
|
+
uriTokens.push(host);
|
|
5315
|
+
}
|
|
5470
5316
|
|
|
5471
|
-
|
|
5472
|
-
|
|
5473
|
-
|
|
5317
|
+
if (typeof components.port === 'number' || typeof components.port === 'string') {
|
|
5318
|
+
uriTokens.push(':');
|
|
5319
|
+
uriTokens.push(String(components.port));
|
|
5320
|
+
}
|
|
5474
5321
|
|
|
5475
|
-
|
|
5322
|
+
return uriTokens.length ? uriTokens.join('') : undefined
|
|
5323
|
+
}
|
|
5324
|
+
var utils = {
|
|
5325
|
+
recomposeAuthority: recomposeAuthority$1,
|
|
5326
|
+
normalizeComponentEncoding: normalizeComponentEncoding$1,
|
|
5327
|
+
removeDotSegments: removeDotSegments$1,
|
|
5328
|
+
normalizeIPv4: normalizeIPv4$1,
|
|
5329
|
+
normalizeIPv6: normalizeIPv6$1,
|
|
5330
|
+
stringArrayToHexStripped
|
|
5331
|
+
};
|
|
5476
5332
|
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
}
|
|
5333
|
+
const UUID_REG = /^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu;
|
|
5334
|
+
const URN_REG = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;
|
|
5480
5335
|
|
|
5481
|
-
|
|
5482
|
-
|
|
5336
|
+
function isSecure (wsComponents) {
|
|
5337
|
+
return typeof wsComponents.secure === 'boolean' ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === 'wss'
|
|
5338
|
+
}
|
|
5483
5339
|
|
|
5484
|
-
|
|
5485
|
-
|
|
5486
|
-
|
|
5340
|
+
function httpParse (components) {
|
|
5341
|
+
if (!components.host) {
|
|
5342
|
+
components.error = components.error || 'HTTP URIs must have a host.';
|
|
5343
|
+
}
|
|
5487
5344
|
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
error$1('overflow');
|
|
5491
|
-
}
|
|
5345
|
+
return components
|
|
5346
|
+
}
|
|
5492
5347
|
|
|
5493
|
-
|
|
5494
|
-
|
|
5348
|
+
function httpSerialize (components) {
|
|
5349
|
+
const secure = String(components.scheme).toLowerCase() === 'https';
|
|
5495
5350
|
|
|
5496
|
-
|
|
5497
|
-
|
|
5351
|
+
// normalize the default port
|
|
5352
|
+
if (components.port === (secure ? 443 : 80) || components.port === '') {
|
|
5353
|
+
components.port = undefined;
|
|
5354
|
+
}
|
|
5498
5355
|
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
|
|
5503
|
-
}
|
|
5356
|
+
// normalize the empty path
|
|
5357
|
+
if (!components.path) {
|
|
5358
|
+
components.path = '/';
|
|
5359
|
+
}
|
|
5504
5360
|
|
|
5505
|
-
|
|
5506
|
-
|
|
5361
|
+
// NOTE: We do not parse query strings for HTTP URIs
|
|
5362
|
+
// as WWW Form Url Encoded query strings are part of the HTML4+ spec,
|
|
5363
|
+
// and not the HTTP spec.
|
|
5507
5364
|
|
|
5508
|
-
|
|
5509
|
-
|
|
5510
|
-
}
|
|
5365
|
+
return components
|
|
5366
|
+
}
|
|
5511
5367
|
|
|
5512
|
-
|
|
5513
|
-
|
|
5368
|
+
function wsParse (wsComponents) {
|
|
5369
|
+
// indicate if the secure flag is set
|
|
5370
|
+
wsComponents.secure = isSecure(wsComponents);
|
|
5514
5371
|
|
|
5515
|
-
|
|
5516
|
-
|
|
5517
|
-
|
|
5518
|
-
|
|
5519
|
-
* @param {String} input The string of Unicode symbols.
|
|
5520
|
-
* @returns {String} The resulting Punycode string of ASCII-only symbols.
|
|
5521
|
-
*/
|
|
5522
|
-
var encode = function encode(input) {
|
|
5523
|
-
var output = [];
|
|
5372
|
+
// construct resouce name
|
|
5373
|
+
wsComponents.resourceName = (wsComponents.path || '/') + (wsComponents.query ? '?' + wsComponents.query : '');
|
|
5374
|
+
wsComponents.path = undefined;
|
|
5375
|
+
wsComponents.query = undefined;
|
|
5524
5376
|
|
|
5525
|
-
|
|
5526
|
-
|
|
5377
|
+
return wsComponents
|
|
5378
|
+
}
|
|
5527
5379
|
|
|
5528
|
-
|
|
5529
|
-
|
|
5380
|
+
function wsSerialize (wsComponents) {
|
|
5381
|
+
// normalize the default port
|
|
5382
|
+
if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === '') {
|
|
5383
|
+
wsComponents.port = undefined;
|
|
5384
|
+
}
|
|
5530
5385
|
|
|
5531
|
-
|
|
5532
|
-
|
|
5533
|
-
|
|
5534
|
-
|
|
5386
|
+
// ensure scheme matches secure flag
|
|
5387
|
+
if (typeof wsComponents.secure === 'boolean') {
|
|
5388
|
+
wsComponents.scheme = (wsComponents.secure ? 'wss' : 'ws');
|
|
5389
|
+
wsComponents.secure = undefined;
|
|
5390
|
+
}
|
|
5535
5391
|
|
|
5536
|
-
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5392
|
+
// reconstruct path from resource name
|
|
5393
|
+
if (wsComponents.resourceName) {
|
|
5394
|
+
const [path, query] = wsComponents.resourceName.split('?');
|
|
5395
|
+
wsComponents.path = (path && path !== '/' ? path : undefined);
|
|
5396
|
+
wsComponents.query = query;
|
|
5397
|
+
wsComponents.resourceName = undefined;
|
|
5398
|
+
}
|
|
5540
5399
|
|
|
5541
|
-
|
|
5542
|
-
|
|
5543
|
-
var _currentValue2 = _step.value;
|
|
5400
|
+
// forbid fragment component
|
|
5401
|
+
wsComponents.fragment = undefined;
|
|
5544
5402
|
|
|
5545
|
-
|
|
5546
|
-
|
|
5547
|
-
}
|
|
5548
|
-
}
|
|
5549
|
-
} catch (err) {
|
|
5550
|
-
_didIteratorError = true;
|
|
5551
|
-
_iteratorError = err;
|
|
5552
|
-
} finally {
|
|
5553
|
-
try {
|
|
5554
|
-
if (!_iteratorNormalCompletion && _iterator.return) {
|
|
5555
|
-
_iterator.return();
|
|
5556
|
-
}
|
|
5557
|
-
} finally {
|
|
5558
|
-
if (_didIteratorError) {
|
|
5559
|
-
throw _iteratorError;
|
|
5560
|
-
}
|
|
5561
|
-
}
|
|
5562
|
-
}
|
|
5403
|
+
return wsComponents
|
|
5404
|
+
}
|
|
5563
5405
|
|
|
5564
|
-
|
|
5565
|
-
|
|
5406
|
+
function urnParse (urnComponents, options) {
|
|
5407
|
+
if (!urnComponents.path) {
|
|
5408
|
+
urnComponents.error = 'URN can not be parsed';
|
|
5409
|
+
return urnComponents
|
|
5410
|
+
}
|
|
5411
|
+
const matches = urnComponents.path.match(URN_REG);
|
|
5412
|
+
if (matches) {
|
|
5413
|
+
const scheme = options.scheme || urnComponents.scheme || 'urn';
|
|
5414
|
+
urnComponents.nid = matches[1].toLowerCase();
|
|
5415
|
+
urnComponents.nss = matches[2];
|
|
5416
|
+
const urnScheme = `${scheme}:${options.nid || urnComponents.nid}`;
|
|
5417
|
+
const schemeHandler = SCHEMES$1[urnScheme];
|
|
5418
|
+
urnComponents.path = undefined;
|
|
5419
|
+
|
|
5420
|
+
if (schemeHandler) {
|
|
5421
|
+
urnComponents = schemeHandler.parse(urnComponents, options);
|
|
5422
|
+
}
|
|
5423
|
+
} else {
|
|
5424
|
+
urnComponents.error = urnComponents.error || 'URN can not be parsed.';
|
|
5425
|
+
}
|
|
5566
5426
|
|
|
5567
|
-
|
|
5568
|
-
|
|
5427
|
+
return urnComponents
|
|
5428
|
+
}
|
|
5569
5429
|
|
|
5570
|
-
|
|
5571
|
-
|
|
5572
|
-
|
|
5573
|
-
|
|
5430
|
+
function urnSerialize (urnComponents, options) {
|
|
5431
|
+
const scheme = options.scheme || urnComponents.scheme || 'urn';
|
|
5432
|
+
const nid = urnComponents.nid.toLowerCase();
|
|
5433
|
+
const urnScheme = `${scheme}:${options.nid || nid}`;
|
|
5434
|
+
const schemeHandler = SCHEMES$1[urnScheme];
|
|
5574
5435
|
|
|
5575
|
-
|
|
5576
|
-
|
|
5436
|
+
if (schemeHandler) {
|
|
5437
|
+
urnComponents = schemeHandler.serialize(urnComponents, options);
|
|
5438
|
+
}
|
|
5577
5439
|
|
|
5578
|
-
|
|
5579
|
-
|
|
5580
|
-
|
|
5581
|
-
var _iteratorNormalCompletion2 = true;
|
|
5582
|
-
var _didIteratorError2 = false;
|
|
5583
|
-
var _iteratorError2 = undefined;
|
|
5440
|
+
const uriComponents = urnComponents;
|
|
5441
|
+
const nss = urnComponents.nss;
|
|
5442
|
+
uriComponents.path = `${nid || options.nid}:${nss}`;
|
|
5584
5443
|
|
|
5585
|
-
|
|
5586
|
-
|
|
5587
|
-
|
|
5444
|
+
options.skipEscape = true;
|
|
5445
|
+
return uriComponents
|
|
5446
|
+
}
|
|
5588
5447
|
|
|
5589
|
-
|
|
5590
|
-
|
|
5591
|
-
|
|
5592
|
-
|
|
5448
|
+
function urnuuidParse (urnComponents, options) {
|
|
5449
|
+
const uuidComponents = urnComponents;
|
|
5450
|
+
uuidComponents.uuid = uuidComponents.nss;
|
|
5451
|
+
uuidComponents.nss = undefined;
|
|
5593
5452
|
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
|
|
5597
|
-
_didIteratorError2 = true;
|
|
5598
|
-
_iteratorError2 = err;
|
|
5599
|
-
} finally {
|
|
5600
|
-
try {
|
|
5601
|
-
if (!_iteratorNormalCompletion2 && _iterator2.return) {
|
|
5602
|
-
_iterator2.return();
|
|
5603
|
-
}
|
|
5604
|
-
} finally {
|
|
5605
|
-
if (_didIteratorError2) {
|
|
5606
|
-
throw _iteratorError2;
|
|
5607
|
-
}
|
|
5608
|
-
}
|
|
5609
|
-
}
|
|
5453
|
+
if (!options.tolerant && (!uuidComponents.uuid || !UUID_REG.test(uuidComponents.uuid))) {
|
|
5454
|
+
uuidComponents.error = uuidComponents.error || 'UUID is not valid.';
|
|
5455
|
+
}
|
|
5610
5456
|
|
|
5611
|
-
|
|
5612
|
-
|
|
5613
|
-
error$1('overflow');
|
|
5614
|
-
}
|
|
5457
|
+
return uuidComponents
|
|
5458
|
+
}
|
|
5615
5459
|
|
|
5616
|
-
|
|
5617
|
-
|
|
5460
|
+
function urnuuidSerialize (uuidComponents) {
|
|
5461
|
+
const urnComponents = uuidComponents;
|
|
5462
|
+
// normalize UUID
|
|
5463
|
+
urnComponents.nss = (uuidComponents.uuid || '').toLowerCase();
|
|
5464
|
+
return urnComponents
|
|
5465
|
+
}
|
|
5618
5466
|
|
|
5619
|
-
|
|
5620
|
-
|
|
5621
|
-
|
|
5467
|
+
const http = {
|
|
5468
|
+
scheme: 'http',
|
|
5469
|
+
domainHost: true,
|
|
5470
|
+
parse: httpParse,
|
|
5471
|
+
serialize: httpSerialize
|
|
5472
|
+
};
|
|
5622
5473
|
|
|
5623
|
-
|
|
5624
|
-
|
|
5625
|
-
|
|
5474
|
+
const https = {
|
|
5475
|
+
scheme: 'https',
|
|
5476
|
+
domainHost: http.domainHost,
|
|
5477
|
+
parse: httpParse,
|
|
5478
|
+
serialize: httpSerialize
|
|
5479
|
+
};
|
|
5626
5480
|
|
|
5627
|
-
|
|
5628
|
-
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
|
|
5633
|
-
for (var k = base;; /* no condition */k += base) {
|
|
5634
|
-
var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
|
|
5635
|
-
if (q < t) {
|
|
5636
|
-
break;
|
|
5637
|
-
}
|
|
5638
|
-
var qMinusT = q - t;
|
|
5639
|
-
var baseMinusT = base - t;
|
|
5640
|
-
output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)));
|
|
5641
|
-
q = floor(qMinusT / baseMinusT);
|
|
5642
|
-
}
|
|
5643
|
-
|
|
5644
|
-
output.push(stringFromCharCode(digitToBasic(q, 0)));
|
|
5645
|
-
bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
|
|
5646
|
-
delta = 0;
|
|
5647
|
-
++handledCPCount;
|
|
5648
|
-
}
|
|
5649
|
-
}
|
|
5650
|
-
} catch (err) {
|
|
5651
|
-
_didIteratorError3 = true;
|
|
5652
|
-
_iteratorError3 = err;
|
|
5653
|
-
} finally {
|
|
5654
|
-
try {
|
|
5655
|
-
if (!_iteratorNormalCompletion3 && _iterator3.return) {
|
|
5656
|
-
_iterator3.return();
|
|
5657
|
-
}
|
|
5658
|
-
} finally {
|
|
5659
|
-
if (_didIteratorError3) {
|
|
5660
|
-
throw _iteratorError3;
|
|
5661
|
-
}
|
|
5662
|
-
}
|
|
5663
|
-
}
|
|
5481
|
+
const ws = {
|
|
5482
|
+
scheme: 'ws',
|
|
5483
|
+
domainHost: true,
|
|
5484
|
+
parse: wsParse,
|
|
5485
|
+
serialize: wsSerialize
|
|
5486
|
+
};
|
|
5664
5487
|
|
|
5665
|
-
|
|
5666
|
-
|
|
5667
|
-
|
|
5668
|
-
|
|
5488
|
+
const wss = {
|
|
5489
|
+
scheme: 'wss',
|
|
5490
|
+
domainHost: ws.domainHost,
|
|
5491
|
+
parse: ws.parse,
|
|
5492
|
+
serialize: ws.serialize
|
|
5669
5493
|
};
|
|
5670
5494
|
|
|
5671
|
-
|
|
5672
|
-
|
|
5673
|
-
|
|
5674
|
-
|
|
5675
|
-
|
|
5676
|
-
* @memberOf punycode
|
|
5677
|
-
* @param {String} input The Punycoded domain name or email address to
|
|
5678
|
-
* convert to Unicode.
|
|
5679
|
-
* @returns {String} The Unicode representation of the given Punycode
|
|
5680
|
-
* string.
|
|
5681
|
-
*/
|
|
5682
|
-
var toUnicode = function toUnicode(input) {
|
|
5683
|
-
return mapDomain(input, function (string) {
|
|
5684
|
-
return regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string;
|
|
5685
|
-
});
|
|
5495
|
+
const urn = {
|
|
5496
|
+
scheme: 'urn',
|
|
5497
|
+
parse: urnParse,
|
|
5498
|
+
serialize: urnSerialize,
|
|
5499
|
+
skipNormalize: true
|
|
5686
5500
|
};
|
|
5687
5501
|
|
|
5688
|
-
|
|
5689
|
-
|
|
5690
|
-
|
|
5691
|
-
|
|
5692
|
-
|
|
5693
|
-
* @memberOf punycode
|
|
5694
|
-
* @param {String} input The domain name or email address to convert, as a
|
|
5695
|
-
* Unicode string.
|
|
5696
|
-
* @returns {String} The Punycode representation of the given domain name or
|
|
5697
|
-
* email address.
|
|
5698
|
-
*/
|
|
5699
|
-
var toASCII = function toASCII(input) {
|
|
5700
|
-
return mapDomain(input, function (string) {
|
|
5701
|
-
return regexNonASCII.test(string) ? 'xn--' + encode(string) : string;
|
|
5702
|
-
});
|
|
5502
|
+
const urnuuid = {
|
|
5503
|
+
scheme: 'urn:uuid',
|
|
5504
|
+
parse: urnuuidParse,
|
|
5505
|
+
serialize: urnuuidSerialize,
|
|
5506
|
+
skipNormalize: true
|
|
5703
5507
|
};
|
|
5704
5508
|
|
|
5705
|
-
|
|
5706
|
-
|
|
5707
|
-
|
|
5708
|
-
|
|
5709
|
-
|
|
5710
|
-
|
|
5711
|
-
|
|
5712
|
-
* @type String
|
|
5713
|
-
*/
|
|
5714
|
-
'version': '2.1.0',
|
|
5715
|
-
/**
|
|
5716
|
-
* An object of methods to convert from JavaScript's internal character
|
|
5717
|
-
* representation (UCS-2) to Unicode code points, and back.
|
|
5718
|
-
* @see <https://mathiasbynens.be/notes/javascript-encoding>
|
|
5719
|
-
* @memberOf punycode
|
|
5720
|
-
* @type Object
|
|
5721
|
-
*/
|
|
5722
|
-
'ucs2': {
|
|
5723
|
-
'decode': ucs2decode,
|
|
5724
|
-
'encode': ucs2encode
|
|
5725
|
-
},
|
|
5726
|
-
'decode': decode,
|
|
5727
|
-
'encode': encode,
|
|
5728
|
-
'toASCII': toASCII,
|
|
5729
|
-
'toUnicode': toUnicode
|
|
5509
|
+
const SCHEMES$1 = {
|
|
5510
|
+
http,
|
|
5511
|
+
https,
|
|
5512
|
+
ws,
|
|
5513
|
+
wss,
|
|
5514
|
+
urn,
|
|
5515
|
+
'urn:uuid': urnuuid
|
|
5730
5516
|
};
|
|
5731
5517
|
|
|
5732
|
-
|
|
5733
|
-
* URI.js
|
|
5734
|
-
*
|
|
5735
|
-
* @fileoverview An RFC 3986 compliant, scheme extendable URI parsing/validating/resolving library for JavaScript.
|
|
5736
|
-
* @author <a href="mailto:gary.court@gmail.com">Gary Court</a>
|
|
5737
|
-
* @see http://github.com/garycourt/uri-js
|
|
5738
|
-
*/
|
|
5739
|
-
/**
|
|
5740
|
-
* Copyright 2011 Gary Court. All rights reserved.
|
|
5741
|
-
*
|
|
5742
|
-
* Redistribution and use in source and binary forms, with or without modification, are
|
|
5743
|
-
* permitted provided that the following conditions are met:
|
|
5744
|
-
*
|
|
5745
|
-
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
|
5746
|
-
* conditions and the following disclaimer.
|
|
5747
|
-
*
|
|
5748
|
-
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
|
5749
|
-
* of conditions and the following disclaimer in the documentation and/or other materials
|
|
5750
|
-
* provided with the distribution.
|
|
5751
|
-
*
|
|
5752
|
-
* THIS SOFTWARE IS PROVIDED BY GARY COURT ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
|
5753
|
-
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
5754
|
-
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARY COURT OR
|
|
5755
|
-
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
5756
|
-
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
5757
|
-
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
5758
|
-
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
5759
|
-
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
5760
|
-
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
5761
|
-
*
|
|
5762
|
-
* The views and conclusions contained in the software and documentation are those of the
|
|
5763
|
-
* authors and should not be interpreted as representing official policies, either expressed
|
|
5764
|
-
* or implied, of Gary Court.
|
|
5765
|
-
*/
|
|
5766
|
-
var SCHEMES = {};
|
|
5767
|
-
function pctEncChar(chr) {
|
|
5768
|
-
var c = chr.charCodeAt(0);
|
|
5769
|
-
var e = void 0;
|
|
5770
|
-
if (c < 16) e = "%0" + c.toString(16).toUpperCase();else if (c < 128) e = "%" + c.toString(16).toUpperCase();else if (c < 2048) e = "%" + (c >> 6 | 192).toString(16).toUpperCase() + "%" + (c & 63 | 128).toString(16).toUpperCase();else e = "%" + (c >> 12 | 224).toString(16).toUpperCase() + "%" + (c >> 6 & 63 | 128).toString(16).toUpperCase() + "%" + (c & 63 | 128).toString(16).toUpperCase();
|
|
5771
|
-
return e;
|
|
5772
|
-
}
|
|
5773
|
-
function pctDecChars(str) {
|
|
5774
|
-
var newStr = "";
|
|
5775
|
-
var i = 0;
|
|
5776
|
-
var il = str.length;
|
|
5777
|
-
while (i < il) {
|
|
5778
|
-
var c = parseInt(str.substr(i + 1, 2), 16);
|
|
5779
|
-
if (c < 128) {
|
|
5780
|
-
newStr += String.fromCharCode(c);
|
|
5781
|
-
i += 3;
|
|
5782
|
-
} else if (c >= 194 && c < 224) {
|
|
5783
|
-
if (il - i >= 6) {
|
|
5784
|
-
var c2 = parseInt(str.substr(i + 4, 2), 16);
|
|
5785
|
-
newStr += String.fromCharCode((c & 31) << 6 | c2 & 63);
|
|
5786
|
-
} else {
|
|
5787
|
-
newStr += str.substr(i, 6);
|
|
5788
|
-
}
|
|
5789
|
-
i += 6;
|
|
5790
|
-
} else if (c >= 224) {
|
|
5791
|
-
if (il - i >= 9) {
|
|
5792
|
-
var _c = parseInt(str.substr(i + 4, 2), 16);
|
|
5793
|
-
var c3 = parseInt(str.substr(i + 7, 2), 16);
|
|
5794
|
-
newStr += String.fromCharCode((c & 15) << 12 | (_c & 63) << 6 | c3 & 63);
|
|
5795
|
-
} else {
|
|
5796
|
-
newStr += str.substr(i, 9);
|
|
5797
|
-
}
|
|
5798
|
-
i += 9;
|
|
5799
|
-
} else {
|
|
5800
|
-
newStr += str.substr(i, 3);
|
|
5801
|
-
i += 3;
|
|
5802
|
-
}
|
|
5803
|
-
}
|
|
5804
|
-
return newStr;
|
|
5805
|
-
}
|
|
5806
|
-
function _normalizeComponentEncoding(components, protocol) {
|
|
5807
|
-
function decodeUnreserved(str) {
|
|
5808
|
-
var decStr = pctDecChars(str);
|
|
5809
|
-
return !decStr.match(protocol.UNRESERVED) ? str : decStr;
|
|
5810
|
-
}
|
|
5811
|
-
if (components.scheme) components.scheme = String(components.scheme).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_SCHEME, "");
|
|
5812
|
-
if (components.userinfo !== undefined) components.userinfo = String(components.userinfo).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_USERINFO, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
|
|
5813
|
-
if (components.host !== undefined) components.host = String(components.host).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_HOST, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
|
|
5814
|
-
if (components.path !== undefined) components.path = String(components.path).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(components.scheme ? protocol.NOT_PATH : protocol.NOT_PATH_NOSCHEME, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
|
|
5815
|
-
if (components.query !== undefined) components.query = String(components.query).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_QUERY, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
|
|
5816
|
-
if (components.fragment !== undefined) components.fragment = String(components.fragment).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_FRAGMENT, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
|
|
5817
|
-
return components;
|
|
5818
|
-
}
|
|
5518
|
+
var schemes = SCHEMES$1;
|
|
5819
5519
|
|
|
5820
|
-
|
|
5821
|
-
|
|
5520
|
+
const { normalizeIPv6, normalizeIPv4, removeDotSegments, recomposeAuthority, normalizeComponentEncoding } = utils;
|
|
5521
|
+
const SCHEMES = schemes;
|
|
5522
|
+
|
|
5523
|
+
function normalize (uri, options) {
|
|
5524
|
+
if (typeof uri === 'string') {
|
|
5525
|
+
uri = serialize(parse(uri, options), options);
|
|
5526
|
+
} else if (typeof uri === 'object') {
|
|
5527
|
+
uri = parse(serialize(uri, options), options);
|
|
5528
|
+
}
|
|
5529
|
+
return uri
|
|
5822
5530
|
}
|
|
5823
|
-
function _normalizeIPv4(host, protocol) {
|
|
5824
|
-
var matches = host.match(protocol.IPV4ADDRESS) || [];
|
|
5825
5531
|
|
|
5826
|
-
|
|
5827
|
-
|
|
5532
|
+
function resolve (baseURI, relativeURI, options) {
|
|
5533
|
+
const schemelessOptions = Object.assign({ scheme: 'null' }, options);
|
|
5534
|
+
const resolved = resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true);
|
|
5535
|
+
return serialize(resolved, { ...schemelessOptions, skipEscape: true })
|
|
5536
|
+
}
|
|
5828
5537
|
|
|
5829
|
-
|
|
5830
|
-
|
|
5831
|
-
|
|
5832
|
-
|
|
5833
|
-
|
|
5834
|
-
|
|
5835
|
-
|
|
5836
|
-
|
|
5837
|
-
|
|
5838
|
-
|
|
5839
|
-
|
|
5840
|
-
|
|
5841
|
-
|
|
5842
|
-
|
|
5843
|
-
|
|
5844
|
-
|
|
5845
|
-
|
|
5846
|
-
|
|
5847
|
-
|
|
5848
|
-
|
|
5849
|
-
|
|
5850
|
-
|
|
5851
|
-
|
|
5852
|
-
|
|
5853
|
-
var fields = Array(fieldCount);
|
|
5854
|
-
for (var x = 0; x < fieldCount; ++x) {
|
|
5855
|
-
fields[x] = firstFields[x] || lastFields[lastFieldsStart + x] || '';
|
|
5856
|
-
}
|
|
5857
|
-
if (isLastFieldIPv4Address) {
|
|
5858
|
-
fields[fieldCount - 1] = _normalizeIPv4(fields[fieldCount - 1], protocol);
|
|
5859
|
-
}
|
|
5860
|
-
var allZeroFields = fields.reduce(function (acc, field, index) {
|
|
5861
|
-
if (!field || field === "0") {
|
|
5862
|
-
var lastLongest = acc[acc.length - 1];
|
|
5863
|
-
if (lastLongest && lastLongest.index + lastLongest.length === index) {
|
|
5864
|
-
lastLongest.length++;
|
|
5865
|
-
} else {
|
|
5866
|
-
acc.push({ index: index, length: 1 });
|
|
5867
|
-
}
|
|
5868
|
-
}
|
|
5869
|
-
return acc;
|
|
5870
|
-
}, []);
|
|
5871
|
-
var longestZeroFields = allZeroFields.sort(function (a, b) {
|
|
5872
|
-
return b.length - a.length;
|
|
5873
|
-
})[0];
|
|
5874
|
-
var newHost = void 0;
|
|
5875
|
-
if (longestZeroFields && longestZeroFields.length > 1) {
|
|
5876
|
-
var newFirst = fields.slice(0, longestZeroFields.index);
|
|
5877
|
-
var newLast = fields.slice(longestZeroFields.index + longestZeroFields.length);
|
|
5878
|
-
newHost = newFirst.join(":") + "::" + newLast.join(":");
|
|
5879
|
-
} else {
|
|
5880
|
-
newHost = fields.join(":");
|
|
5881
|
-
}
|
|
5882
|
-
if (zone) {
|
|
5883
|
-
newHost += "%" + zone;
|
|
5884
|
-
}
|
|
5885
|
-
return newHost;
|
|
5538
|
+
function resolveComponents (base, relative, options, skipNormalization) {
|
|
5539
|
+
const target = {};
|
|
5540
|
+
if (!skipNormalization) {
|
|
5541
|
+
base = parse(serialize(base, options), options); // normalize base components
|
|
5542
|
+
relative = parse(serialize(relative, options), options); // normalize relative components
|
|
5543
|
+
}
|
|
5544
|
+
options = options || {};
|
|
5545
|
+
|
|
5546
|
+
if (!options.tolerant && relative.scheme) {
|
|
5547
|
+
target.scheme = relative.scheme;
|
|
5548
|
+
// target.authority = relative.authority;
|
|
5549
|
+
target.userinfo = relative.userinfo;
|
|
5550
|
+
target.host = relative.host;
|
|
5551
|
+
target.port = relative.port;
|
|
5552
|
+
target.path = removeDotSegments(relative.path || '');
|
|
5553
|
+
target.query = relative.query;
|
|
5554
|
+
} else {
|
|
5555
|
+
if (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) {
|
|
5556
|
+
// target.authority = relative.authority;
|
|
5557
|
+
target.userinfo = relative.userinfo;
|
|
5558
|
+
target.host = relative.host;
|
|
5559
|
+
target.port = relative.port;
|
|
5560
|
+
target.path = removeDotSegments(relative.path || '');
|
|
5561
|
+
target.query = relative.query;
|
|
5886
5562
|
} else {
|
|
5887
|
-
|
|
5888
|
-
|
|
5889
|
-
|
|
5890
|
-
|
|
5891
|
-
var NO_MATCH_IS_UNDEFINED = "".match(/(){0}/)[1] === undefined;
|
|
5892
|
-
function parse(uriString) {
|
|
5893
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
5894
|
-
|
|
5895
|
-
var components = {};
|
|
5896
|
-
var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL;
|
|
5897
|
-
if (options.reference === "suffix") uriString = (options.scheme ? options.scheme + ":" : "") + "//" + uriString;
|
|
5898
|
-
var matches = uriString.match(URI_PARSE);
|
|
5899
|
-
if (matches) {
|
|
5900
|
-
if (NO_MATCH_IS_UNDEFINED) {
|
|
5901
|
-
//store each component
|
|
5902
|
-
components.scheme = matches[1];
|
|
5903
|
-
components.userinfo = matches[3];
|
|
5904
|
-
components.host = matches[4];
|
|
5905
|
-
components.port = parseInt(matches[5], 10);
|
|
5906
|
-
components.path = matches[6] || "";
|
|
5907
|
-
components.query = matches[7];
|
|
5908
|
-
components.fragment = matches[8];
|
|
5909
|
-
//fix port number
|
|
5910
|
-
if (isNaN(components.port)) {
|
|
5911
|
-
components.port = matches[5];
|
|
5912
|
-
}
|
|
5563
|
+
if (!relative.path) {
|
|
5564
|
+
target.path = base.path;
|
|
5565
|
+
if (relative.query !== undefined) {
|
|
5566
|
+
target.query = relative.query;
|
|
5913
5567
|
} else {
|
|
5914
|
-
|
|
5915
|
-
//store each component
|
|
5916
|
-
components.scheme = matches[1] || undefined;
|
|
5917
|
-
components.userinfo = uriString.indexOf("@") !== -1 ? matches[3] : undefined;
|
|
5918
|
-
components.host = uriString.indexOf("//") !== -1 ? matches[4] : undefined;
|
|
5919
|
-
components.port = parseInt(matches[5], 10);
|
|
5920
|
-
components.path = matches[6] || "";
|
|
5921
|
-
components.query = uriString.indexOf("?") !== -1 ? matches[7] : undefined;
|
|
5922
|
-
components.fragment = uriString.indexOf("#") !== -1 ? matches[8] : undefined;
|
|
5923
|
-
//fix port number
|
|
5924
|
-
if (isNaN(components.port)) {
|
|
5925
|
-
components.port = uriString.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? matches[4] : undefined;
|
|
5926
|
-
}
|
|
5568
|
+
target.query = base.query;
|
|
5927
5569
|
}
|
|
5928
|
-
|
|
5929
|
-
|
|
5930
|
-
|
|
5931
|
-
}
|
|
5932
|
-
//determine reference type
|
|
5933
|
-
if (components.scheme === undefined && components.userinfo === undefined && components.host === undefined && components.port === undefined && !components.path && components.query === undefined) {
|
|
5934
|
-
components.reference = "same-document";
|
|
5935
|
-
} else if (components.scheme === undefined) {
|
|
5936
|
-
components.reference = "relative";
|
|
5937
|
-
} else if (components.fragment === undefined) {
|
|
5938
|
-
components.reference = "absolute";
|
|
5939
|
-
} else {
|
|
5940
|
-
components.reference = "uri";
|
|
5941
|
-
}
|
|
5942
|
-
//check for reference errors
|
|
5943
|
-
if (options.reference && options.reference !== "suffix" && options.reference !== components.reference) {
|
|
5944
|
-
components.error = components.error || "URI is not a " + options.reference + " reference.";
|
|
5945
|
-
}
|
|
5946
|
-
//find scheme handler
|
|
5947
|
-
var schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
|
|
5948
|
-
//check if scheme can't handle IRIs
|
|
5949
|
-
if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
|
|
5950
|
-
//if host component is a domain name
|
|
5951
|
-
if (components.host && (options.domainHost || schemeHandler && schemeHandler.domainHost)) {
|
|
5952
|
-
//convert Unicode IDN -> ASCII IDN
|
|
5953
|
-
try {
|
|
5954
|
-
components.host = punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase());
|
|
5955
|
-
} catch (e) {
|
|
5956
|
-
components.error = components.error || "Host's domain name can not be converted to ASCII via punycode: " + e;
|
|
5957
|
-
}
|
|
5958
|
-
}
|
|
5959
|
-
//convert IRI -> URI
|
|
5960
|
-
_normalizeComponentEncoding(components, URI_PROTOCOL);
|
|
5570
|
+
} else {
|
|
5571
|
+
if (relative.path.charAt(0) === '/') {
|
|
5572
|
+
target.path = removeDotSegments(relative.path);
|
|
5961
5573
|
} else {
|
|
5962
|
-
|
|
5963
|
-
|
|
5964
|
-
|
|
5965
|
-
|
|
5966
|
-
|
|
5967
|
-
|
|
5574
|
+
if ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) {
|
|
5575
|
+
target.path = '/' + relative.path;
|
|
5576
|
+
} else if (!base.path) {
|
|
5577
|
+
target.path = relative.path;
|
|
5578
|
+
} else {
|
|
5579
|
+
target.path = base.path.slice(0, base.path.lastIndexOf('/') + 1) + relative.path;
|
|
5580
|
+
}
|
|
5581
|
+
target.path = removeDotSegments(target.path);
|
|
5968
5582
|
}
|
|
5969
|
-
|
|
5970
|
-
|
|
5583
|
+
target.query = relative.query;
|
|
5584
|
+
}
|
|
5585
|
+
// target.authority = base.authority;
|
|
5586
|
+
target.userinfo = base.userinfo;
|
|
5587
|
+
target.host = base.host;
|
|
5588
|
+
target.port = base.port;
|
|
5971
5589
|
}
|
|
5972
|
-
|
|
5973
|
-
|
|
5590
|
+
target.scheme = base.scheme;
|
|
5591
|
+
}
|
|
5974
5592
|
|
|
5975
|
-
|
|
5976
|
-
|
|
5977
|
-
|
|
5978
|
-
if (components.userinfo !== undefined) {
|
|
5979
|
-
uriTokens.push(components.userinfo);
|
|
5980
|
-
uriTokens.push("@");
|
|
5981
|
-
}
|
|
5982
|
-
if (components.host !== undefined) {
|
|
5983
|
-
//normalize IP hosts, add brackets and escape zone separator for IPv6
|
|
5984
|
-
uriTokens.push(_normalizeIPv6(_normalizeIPv4(String(components.host), protocol), protocol).replace(protocol.IPV6ADDRESS, function (_, $1, $2) {
|
|
5985
|
-
return "[" + $1 + ($2 ? "%25" + $2 : "") + "]";
|
|
5986
|
-
}));
|
|
5987
|
-
}
|
|
5988
|
-
if (typeof components.port === "number" || typeof components.port === "string") {
|
|
5989
|
-
uriTokens.push(":");
|
|
5990
|
-
uriTokens.push(String(components.port));
|
|
5991
|
-
}
|
|
5992
|
-
return uriTokens.length ? uriTokens.join("") : undefined;
|
|
5993
|
-
}
|
|
5994
|
-
|
|
5995
|
-
var RDS1 = /^\.\.?\//;
|
|
5996
|
-
var RDS2 = /^\/\.(\/|$)/;
|
|
5997
|
-
var RDS3 = /^\/\.\.(\/|$)/;
|
|
5998
|
-
var RDS5 = /^\/?(?:.|\n)*?(?=\/|$)/;
|
|
5999
|
-
function removeDotSegments(input) {
|
|
6000
|
-
var output = [];
|
|
6001
|
-
while (input.length) {
|
|
6002
|
-
if (input.match(RDS1)) {
|
|
6003
|
-
input = input.replace(RDS1, "");
|
|
6004
|
-
} else if (input.match(RDS2)) {
|
|
6005
|
-
input = input.replace(RDS2, "/");
|
|
6006
|
-
} else if (input.match(RDS3)) {
|
|
6007
|
-
input = input.replace(RDS3, "/");
|
|
6008
|
-
output.pop();
|
|
6009
|
-
} else if (input === "." || input === "..") {
|
|
6010
|
-
input = "";
|
|
6011
|
-
} else {
|
|
6012
|
-
var im = input.match(RDS5);
|
|
6013
|
-
if (im) {
|
|
6014
|
-
var s = im[0];
|
|
6015
|
-
input = input.slice(s.length);
|
|
6016
|
-
output.push(s);
|
|
6017
|
-
} else {
|
|
6018
|
-
throw new Error("Unexpected dot segment condition");
|
|
6019
|
-
}
|
|
6020
|
-
}
|
|
6021
|
-
}
|
|
6022
|
-
return output.join("");
|
|
5593
|
+
target.fragment = relative.fragment;
|
|
5594
|
+
|
|
5595
|
+
return target
|
|
6023
5596
|
}
|
|
6024
5597
|
|
|
6025
|
-
function
|
|
6026
|
-
|
|
5598
|
+
function equal$2 (uriA, uriB, options) {
|
|
5599
|
+
if (typeof uriA === 'string') {
|
|
5600
|
+
uriA = unescape(uriA);
|
|
5601
|
+
uriA = serialize(normalizeComponentEncoding(parse(uriA, options), true), { ...options, skipEscape: true });
|
|
5602
|
+
} else if (typeof uriA === 'object') {
|
|
5603
|
+
uriA = serialize(normalizeComponentEncoding(uriA, true), { ...options, skipEscape: true });
|
|
5604
|
+
}
|
|
6027
5605
|
|
|
6028
|
-
|
|
6029
|
-
|
|
6030
|
-
|
|
6031
|
-
|
|
6032
|
-
|
|
6033
|
-
|
|
6034
|
-
if (components.host) {
|
|
6035
|
-
//if host component is an IPv6 address
|
|
6036
|
-
if (protocol.IPV6ADDRESS.test(components.host)) ;
|
|
6037
|
-
//TODO: normalize IPv6 address as per RFC 5952
|
|
5606
|
+
if (typeof uriB === 'string') {
|
|
5607
|
+
uriB = unescape(uriB);
|
|
5608
|
+
uriB = serialize(normalizeComponentEncoding(parse(uriB, options), true), { ...options, skipEscape: true });
|
|
5609
|
+
} else if (typeof uriB === 'object') {
|
|
5610
|
+
uriB = serialize(normalizeComponentEncoding(uriB, true), { ...options, skipEscape: true });
|
|
5611
|
+
}
|
|
6038
5612
|
|
|
6039
|
-
|
|
6040
|
-
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
|
|
6044
|
-
|
|
6045
|
-
|
|
6046
|
-
|
|
6047
|
-
|
|
6048
|
-
|
|
6049
|
-
|
|
6050
|
-
|
|
6051
|
-
|
|
6052
|
-
|
|
6053
|
-
|
|
6054
|
-
|
|
6055
|
-
|
|
6056
|
-
|
|
6057
|
-
|
|
6058
|
-
|
|
6059
|
-
|
|
6060
|
-
|
|
6061
|
-
if (components.path && components.path.charAt(0) !== "/") {
|
|
6062
|
-
uriTokens.push("/");
|
|
6063
|
-
}
|
|
6064
|
-
}
|
|
6065
|
-
if (components.path !== undefined) {
|
|
6066
|
-
var s = components.path;
|
|
6067
|
-
if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
|
|
6068
|
-
s = removeDotSegments(s);
|
|
6069
|
-
}
|
|
6070
|
-
if (authority === undefined) {
|
|
6071
|
-
s = s.replace(/^\/\//, "/%2F"); //don't allow the path to start with "//"
|
|
6072
|
-
}
|
|
6073
|
-
uriTokens.push(s);
|
|
6074
|
-
}
|
|
6075
|
-
if (components.query !== undefined) {
|
|
6076
|
-
uriTokens.push("?");
|
|
6077
|
-
uriTokens.push(components.query);
|
|
6078
|
-
}
|
|
6079
|
-
if (components.fragment !== undefined) {
|
|
6080
|
-
uriTokens.push("#");
|
|
6081
|
-
uriTokens.push(components.fragment);
|
|
6082
|
-
}
|
|
6083
|
-
return uriTokens.join(""); //merge tokens into a string
|
|
6084
|
-
}
|
|
5613
|
+
return uriA.toLowerCase() === uriB.toLowerCase()
|
|
5614
|
+
}
|
|
5615
|
+
|
|
5616
|
+
function serialize (cmpts, opts) {
|
|
5617
|
+
const components = {
|
|
5618
|
+
host: cmpts.host,
|
|
5619
|
+
scheme: cmpts.scheme,
|
|
5620
|
+
userinfo: cmpts.userinfo,
|
|
5621
|
+
port: cmpts.port,
|
|
5622
|
+
path: cmpts.path,
|
|
5623
|
+
query: cmpts.query,
|
|
5624
|
+
nid: cmpts.nid,
|
|
5625
|
+
nss: cmpts.nss,
|
|
5626
|
+
uuid: cmpts.uuid,
|
|
5627
|
+
fragment: cmpts.fragment,
|
|
5628
|
+
reference: cmpts.reference,
|
|
5629
|
+
resourceName: cmpts.resourceName,
|
|
5630
|
+
secure: cmpts.secure,
|
|
5631
|
+
error: ''
|
|
5632
|
+
};
|
|
5633
|
+
const options = Object.assign({}, opts);
|
|
5634
|
+
const uriTokens = [];
|
|
6085
5635
|
|
|
6086
|
-
|
|
6087
|
-
|
|
6088
|
-
var skipNormalization = arguments[3];
|
|
5636
|
+
// find scheme handler
|
|
5637
|
+
const schemeHandler = SCHEMES[(options.scheme || components.scheme || '').toLowerCase()];
|
|
6089
5638
|
|
|
6090
|
-
|
|
6091
|
-
|
|
6092
|
-
|
|
6093
|
-
|
|
6094
|
-
|
|
6095
|
-
|
|
6096
|
-
|
|
6097
|
-
|
|
6098
|
-
|
|
6099
|
-
|
|
6100
|
-
target.host = relative.host;
|
|
6101
|
-
target.port = relative.port;
|
|
6102
|
-
target.path = removeDotSegments(relative.path || "");
|
|
6103
|
-
target.query = relative.query;
|
|
5639
|
+
// perform scheme specific serialization
|
|
5640
|
+
if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(components, options);
|
|
5641
|
+
|
|
5642
|
+
if (components.path !== undefined) {
|
|
5643
|
+
if (!options.skipEscape) {
|
|
5644
|
+
components.path = escape(components.path);
|
|
5645
|
+
|
|
5646
|
+
if (components.scheme !== undefined) {
|
|
5647
|
+
components.path = components.path.split('%3A').join(':');
|
|
5648
|
+
}
|
|
6104
5649
|
} else {
|
|
6105
|
-
|
|
6106
|
-
//target.authority = relative.authority;
|
|
6107
|
-
target.userinfo = relative.userinfo;
|
|
6108
|
-
target.host = relative.host;
|
|
6109
|
-
target.port = relative.port;
|
|
6110
|
-
target.path = removeDotSegments(relative.path || "");
|
|
6111
|
-
target.query = relative.query;
|
|
6112
|
-
} else {
|
|
6113
|
-
if (!relative.path) {
|
|
6114
|
-
target.path = base.path;
|
|
6115
|
-
if (relative.query !== undefined) {
|
|
6116
|
-
target.query = relative.query;
|
|
6117
|
-
} else {
|
|
6118
|
-
target.query = base.query;
|
|
6119
|
-
}
|
|
6120
|
-
} else {
|
|
6121
|
-
if (relative.path.charAt(0) === "/") {
|
|
6122
|
-
target.path = removeDotSegments(relative.path);
|
|
6123
|
-
} else {
|
|
6124
|
-
if ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) {
|
|
6125
|
-
target.path = "/" + relative.path;
|
|
6126
|
-
} else if (!base.path) {
|
|
6127
|
-
target.path = relative.path;
|
|
6128
|
-
} else {
|
|
6129
|
-
target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative.path;
|
|
6130
|
-
}
|
|
6131
|
-
target.path = removeDotSegments(target.path);
|
|
6132
|
-
}
|
|
6133
|
-
target.query = relative.query;
|
|
6134
|
-
}
|
|
6135
|
-
//target.authority = base.authority;
|
|
6136
|
-
target.userinfo = base.userinfo;
|
|
6137
|
-
target.host = base.host;
|
|
6138
|
-
target.port = base.port;
|
|
6139
|
-
}
|
|
6140
|
-
target.scheme = base.scheme;
|
|
5650
|
+
components.path = unescape(components.path);
|
|
6141
5651
|
}
|
|
6142
|
-
|
|
6143
|
-
return target;
|
|
6144
|
-
}
|
|
5652
|
+
}
|
|
6145
5653
|
|
|
6146
|
-
|
|
6147
|
-
|
|
6148
|
-
|
|
6149
|
-
}
|
|
5654
|
+
if (options.reference !== 'suffix' && components.scheme) {
|
|
5655
|
+
uriTokens.push(components.scheme, ':');
|
|
5656
|
+
}
|
|
6150
5657
|
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
|
|
6154
|
-
|
|
6155
|
-
uri = parse(serialize(uri, options), options);
|
|
5658
|
+
const authority = recomposeAuthority(components);
|
|
5659
|
+
if (authority !== undefined) {
|
|
5660
|
+
if (options.reference !== 'suffix') {
|
|
5661
|
+
uriTokens.push('//');
|
|
6156
5662
|
}
|
|
6157
|
-
return uri;
|
|
6158
|
-
}
|
|
6159
5663
|
|
|
6160
|
-
|
|
6161
|
-
|
|
6162
|
-
|
|
6163
|
-
|
|
6164
|
-
uriA = serialize(uriA, options);
|
|
5664
|
+
uriTokens.push(authority);
|
|
5665
|
+
|
|
5666
|
+
if (components.path && components.path.charAt(0) !== '/') {
|
|
5667
|
+
uriTokens.push('/');
|
|
6165
5668
|
}
|
|
6166
|
-
|
|
6167
|
-
|
|
6168
|
-
|
|
6169
|
-
|
|
5669
|
+
}
|
|
5670
|
+
if (components.path !== undefined) {
|
|
5671
|
+
let s = components.path;
|
|
5672
|
+
|
|
5673
|
+
if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
|
|
5674
|
+
s = removeDotSegments(s);
|
|
6170
5675
|
}
|
|
6171
|
-
return uriA === uriB;
|
|
6172
|
-
}
|
|
6173
5676
|
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
|
|
5677
|
+
if (authority === undefined) {
|
|
5678
|
+
s = s.replace(/^\/\//u, '/%2F'); // don't allow the path to start with "//"
|
|
5679
|
+
}
|
|
6177
5680
|
|
|
6178
|
-
|
|
6179
|
-
|
|
5681
|
+
uriTokens.push(s);
|
|
5682
|
+
}
|
|
5683
|
+
|
|
5684
|
+
if (components.query !== undefined) {
|
|
5685
|
+
uriTokens.push('?', components.query);
|
|
5686
|
+
}
|
|
5687
|
+
|
|
5688
|
+
if (components.fragment !== undefined) {
|
|
5689
|
+
uriTokens.push('#', components.fragment);
|
|
5690
|
+
}
|
|
5691
|
+
return uriTokens.join('')
|
|
6180
5692
|
}
|
|
6181
5693
|
|
|
6182
|
-
|
|
6183
|
-
|
|
6184
|
-
|
|
6185
|
-
|
|
6186
|
-
|
|
6187
|
-
|
|
6188
|
-
|
|
6189
|
-
|
|
6190
|
-
return components;
|
|
6191
|
-
},
|
|
6192
|
-
serialize: function serialize(components, options) {
|
|
6193
|
-
var secure = String(components.scheme).toLowerCase() === "https";
|
|
6194
|
-
//normalize the default port
|
|
6195
|
-
if (components.port === (secure ? 443 : 80) || components.port === "") {
|
|
6196
|
-
components.port = undefined;
|
|
6197
|
-
}
|
|
6198
|
-
//normalize the empty path
|
|
6199
|
-
if (!components.path) {
|
|
6200
|
-
components.path = "/";
|
|
6201
|
-
}
|
|
6202
|
-
//NOTE: We do not parse query strings for HTTP URIs
|
|
6203
|
-
//as WWW Form Url Encoded query strings are part of the HTML4+ spec,
|
|
6204
|
-
//and not the HTTP spec.
|
|
6205
|
-
return components;
|
|
5694
|
+
const hexLookUp = Array.from({ length: 127 }, (_v, k) => /[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(k)));
|
|
5695
|
+
|
|
5696
|
+
function nonSimpleDomain (value) {
|
|
5697
|
+
let code = 0;
|
|
5698
|
+
for (let i = 0, len = value.length; i < len; ++i) {
|
|
5699
|
+
code = value.charCodeAt(i);
|
|
5700
|
+
if (code > 126 || hexLookUp[code]) {
|
|
5701
|
+
return true
|
|
6206
5702
|
}
|
|
6207
|
-
|
|
5703
|
+
}
|
|
5704
|
+
return false
|
|
5705
|
+
}
|
|
6208
5706
|
|
|
6209
|
-
|
|
6210
|
-
scheme: "https",
|
|
6211
|
-
domainHost: handler.domainHost,
|
|
6212
|
-
parse: handler.parse,
|
|
6213
|
-
serialize: handler.serialize
|
|
6214
|
-
};
|
|
5707
|
+
const URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
|
|
6215
5708
|
|
|
6216
|
-
function
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
|
|
6221
|
-
|
|
6222
|
-
|
|
6223
|
-
|
|
6224
|
-
|
|
6225
|
-
|
|
6226
|
-
|
|
6227
|
-
|
|
6228
|
-
|
|
6229
|
-
|
|
6230
|
-
|
|
6231
|
-
|
|
6232
|
-
|
|
6233
|
-
|
|
6234
|
-
|
|
6235
|
-
|
|
6236
|
-
|
|
6237
|
-
|
|
6238
|
-
|
|
6239
|
-
|
|
6240
|
-
|
|
6241
|
-
|
|
6242
|
-
|
|
6243
|
-
|
|
6244
|
-
|
|
6245
|
-
|
|
6246
|
-
|
|
6247
|
-
|
|
6248
|
-
|
|
6249
|
-
|
|
6250
|
-
|
|
6251
|
-
|
|
6252
|
-
|
|
6253
|
-
|
|
6254
|
-
|
|
6255
|
-
|
|
6256
|
-
|
|
5709
|
+
function parse (uri, opts) {
|
|
5710
|
+
const options = Object.assign({}, opts);
|
|
5711
|
+
const parsed = {
|
|
5712
|
+
scheme: undefined,
|
|
5713
|
+
userinfo: undefined,
|
|
5714
|
+
host: '',
|
|
5715
|
+
port: undefined,
|
|
5716
|
+
path: '',
|
|
5717
|
+
query: undefined,
|
|
5718
|
+
fragment: undefined
|
|
5719
|
+
};
|
|
5720
|
+
const gotEncoding = uri.indexOf('%') !== -1;
|
|
5721
|
+
let isIP = false;
|
|
5722
|
+
if (options.reference === 'suffix') uri = (options.scheme ? options.scheme + ':' : '') + '//' + uri;
|
|
5723
|
+
|
|
5724
|
+
const matches = uri.match(URI_PARSE);
|
|
5725
|
+
|
|
5726
|
+
if (matches) {
|
|
5727
|
+
// store each component
|
|
5728
|
+
parsed.scheme = matches[1];
|
|
5729
|
+
parsed.userinfo = matches[3];
|
|
5730
|
+
parsed.host = matches[4];
|
|
5731
|
+
parsed.port = parseInt(matches[5], 10);
|
|
5732
|
+
parsed.path = matches[6] || '';
|
|
5733
|
+
parsed.query = matches[7];
|
|
5734
|
+
parsed.fragment = matches[8];
|
|
5735
|
+
|
|
5736
|
+
// fix port number
|
|
5737
|
+
if (isNaN(parsed.port)) {
|
|
5738
|
+
parsed.port = matches[5];
|
|
5739
|
+
}
|
|
5740
|
+
if (parsed.host) {
|
|
5741
|
+
const ipv4result = normalizeIPv4(parsed.host);
|
|
5742
|
+
if (ipv4result.isIPV4 === false) {
|
|
5743
|
+
const ipv6result = normalizeIPv6(ipv4result.host);
|
|
5744
|
+
parsed.host = ipv6result.host.toLowerCase();
|
|
5745
|
+
isIP = ipv6result.isIPV6;
|
|
5746
|
+
} else {
|
|
5747
|
+
parsed.host = ipv4result.host;
|
|
5748
|
+
isIP = true;
|
|
5749
|
+
}
|
|
5750
|
+
}
|
|
5751
|
+
if (parsed.scheme === undefined && parsed.userinfo === undefined && parsed.host === undefined && parsed.port === undefined && parsed.query === undefined && !parsed.path) {
|
|
5752
|
+
parsed.reference = 'same-document';
|
|
5753
|
+
} else if (parsed.scheme === undefined) {
|
|
5754
|
+
parsed.reference = 'relative';
|
|
5755
|
+
} else if (parsed.fragment === undefined) {
|
|
5756
|
+
parsed.reference = 'absolute';
|
|
5757
|
+
} else {
|
|
5758
|
+
parsed.reference = 'uri';
|
|
6257
5759
|
}
|
|
6258
|
-
};
|
|
6259
|
-
|
|
6260
|
-
var handler$3 = {
|
|
6261
|
-
scheme: "wss",
|
|
6262
|
-
domainHost: handler$2.domainHost,
|
|
6263
|
-
parse: handler$2.parse,
|
|
6264
|
-
serialize: handler$2.serialize
|
|
6265
|
-
};
|
|
6266
5760
|
|
|
6267
|
-
|
|
6268
|
-
|
|
6269
|
-
|
|
6270
|
-
var HEXDIG$$ = "[0-9A-Fa-f]"; //case-insensitive
|
|
6271
|
-
var PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)); //expanded
|
|
6272
|
-
//RFC 5322, except these symbols as per RFC 6068: @ : / ? # [ ] & ; =
|
|
6273
|
-
//const ATEXT$$ = "[A-Za-z0-9\\!\\#\\$\\%\\&\\'\\*\\+\\-\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~]";
|
|
6274
|
-
//const WSP$$ = "[\\x20\\x09]";
|
|
6275
|
-
//const OBS_QTEXT$$ = "[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]"; //(%d1-8 / %d11-12 / %d14-31 / %d127)
|
|
6276
|
-
//const QTEXT$$ = merge("[\\x21\\x23-\\x5B\\x5D-\\x7E]", OBS_QTEXT$$); //%d33 / %d35-91 / %d93-126 / obs-qtext
|
|
6277
|
-
//const VCHAR$$ = "[\\x21-\\x7E]";
|
|
6278
|
-
//const WSP$$ = "[\\x20\\x09]";
|
|
6279
|
-
//const OBS_QP$ = subexp("\\\\" + merge("[\\x00\\x0D\\x0A]", OBS_QTEXT$$)); //%d0 / CR / LF / obs-qtext
|
|
6280
|
-
//const FWS$ = subexp(subexp(WSP$$ + "*" + "\\x0D\\x0A") + "?" + WSP$$ + "+");
|
|
6281
|
-
//const QUOTED_PAIR$ = subexp(subexp("\\\\" + subexp(VCHAR$$ + "|" + WSP$$)) + "|" + OBS_QP$);
|
|
6282
|
-
//const QUOTED_STRING$ = subexp('\\"' + subexp(FWS$ + "?" + QCONTENT$) + "*" + FWS$ + "?" + '\\"');
|
|
6283
|
-
var ATEXT$$ = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]";
|
|
6284
|
-
var QTEXT$$ = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]";
|
|
6285
|
-
var VCHAR$$ = merge(QTEXT$$, "[\\\"\\\\]");
|
|
6286
|
-
var SOME_DELIMS$$ = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]";
|
|
6287
|
-
var UNRESERVED = new RegExp(UNRESERVED$$, "g");
|
|
6288
|
-
var PCT_ENCODED = new RegExp(PCT_ENCODED$, "g");
|
|
6289
|
-
var NOT_LOCAL_PART = new RegExp(merge("[^]", ATEXT$$, "[\\.]", '[\\"]', VCHAR$$), "g");
|
|
6290
|
-
var NOT_HFNAME = new RegExp(merge("[^]", UNRESERVED$$, SOME_DELIMS$$), "g");
|
|
6291
|
-
var NOT_HFVALUE = NOT_HFNAME;
|
|
6292
|
-
function decodeUnreserved(str) {
|
|
6293
|
-
var decStr = pctDecChars(str);
|
|
6294
|
-
return !decStr.match(UNRESERVED) ? str : decStr;
|
|
6295
|
-
}
|
|
6296
|
-
var handler$4 = {
|
|
6297
|
-
scheme: "mailto",
|
|
6298
|
-
parse: function parse$$1(components, options) {
|
|
6299
|
-
var mailtoComponents = components;
|
|
6300
|
-
var to = mailtoComponents.to = mailtoComponents.path ? mailtoComponents.path.split(",") : [];
|
|
6301
|
-
mailtoComponents.path = undefined;
|
|
6302
|
-
if (mailtoComponents.query) {
|
|
6303
|
-
var unknownHeaders = false;
|
|
6304
|
-
var headers = {};
|
|
6305
|
-
var hfields = mailtoComponents.query.split("&");
|
|
6306
|
-
for (var x = 0, xl = hfields.length; x < xl; ++x) {
|
|
6307
|
-
var hfield = hfields[x].split("=");
|
|
6308
|
-
switch (hfield[0]) {
|
|
6309
|
-
case "to":
|
|
6310
|
-
var toAddrs = hfield[1].split(",");
|
|
6311
|
-
for (var _x = 0, _xl = toAddrs.length; _x < _xl; ++_x) {
|
|
6312
|
-
to.push(toAddrs[_x]);
|
|
6313
|
-
}
|
|
6314
|
-
break;
|
|
6315
|
-
case "subject":
|
|
6316
|
-
mailtoComponents.subject = unescapeComponent(hfield[1], options);
|
|
6317
|
-
break;
|
|
6318
|
-
case "body":
|
|
6319
|
-
mailtoComponents.body = unescapeComponent(hfield[1], options);
|
|
6320
|
-
break;
|
|
6321
|
-
default:
|
|
6322
|
-
unknownHeaders = true;
|
|
6323
|
-
headers[unescapeComponent(hfield[0], options)] = unescapeComponent(hfield[1], options);
|
|
6324
|
-
break;
|
|
6325
|
-
}
|
|
6326
|
-
}
|
|
6327
|
-
if (unknownHeaders) mailtoComponents.headers = headers;
|
|
6328
|
-
}
|
|
6329
|
-
mailtoComponents.query = undefined;
|
|
6330
|
-
for (var _x2 = 0, _xl2 = to.length; _x2 < _xl2; ++_x2) {
|
|
6331
|
-
var addr = to[_x2].split("@");
|
|
6332
|
-
addr[0] = unescapeComponent(addr[0]);
|
|
6333
|
-
if (!options.unicodeSupport) {
|
|
6334
|
-
//convert Unicode IDN -> ASCII IDN
|
|
6335
|
-
try {
|
|
6336
|
-
addr[1] = punycode.toASCII(unescapeComponent(addr[1], options).toLowerCase());
|
|
6337
|
-
} catch (e) {
|
|
6338
|
-
mailtoComponents.error = mailtoComponents.error || "Email address's domain name can not be converted to ASCII via punycode: " + e;
|
|
6339
|
-
}
|
|
6340
|
-
} else {
|
|
6341
|
-
addr[1] = unescapeComponent(addr[1], options).toLowerCase();
|
|
6342
|
-
}
|
|
6343
|
-
to[_x2] = addr.join("@");
|
|
6344
|
-
}
|
|
6345
|
-
return mailtoComponents;
|
|
6346
|
-
},
|
|
6347
|
-
serialize: function serialize$$1(mailtoComponents, options) {
|
|
6348
|
-
var components = mailtoComponents;
|
|
6349
|
-
var to = toArray(mailtoComponents.to);
|
|
6350
|
-
if (to) {
|
|
6351
|
-
for (var x = 0, xl = to.length; x < xl; ++x) {
|
|
6352
|
-
var toAddr = String(to[x]);
|
|
6353
|
-
var atIdx = toAddr.lastIndexOf("@");
|
|
6354
|
-
var localPart = toAddr.slice(0, atIdx).replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_LOCAL_PART, pctEncChar);
|
|
6355
|
-
var domain = toAddr.slice(atIdx + 1);
|
|
6356
|
-
//convert IDN via punycode
|
|
6357
|
-
try {
|
|
6358
|
-
domain = !options.iri ? punycode.toASCII(unescapeComponent(domain, options).toLowerCase()) : punycode.toUnicode(domain);
|
|
6359
|
-
} catch (e) {
|
|
6360
|
-
components.error = components.error || "Email address's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e;
|
|
6361
|
-
}
|
|
6362
|
-
to[x] = localPart + "@" + domain;
|
|
6363
|
-
}
|
|
6364
|
-
components.path = to.join(",");
|
|
6365
|
-
}
|
|
6366
|
-
var headers = mailtoComponents.headers = mailtoComponents.headers || {};
|
|
6367
|
-
if (mailtoComponents.subject) headers["subject"] = mailtoComponents.subject;
|
|
6368
|
-
if (mailtoComponents.body) headers["body"] = mailtoComponents.body;
|
|
6369
|
-
var fields = [];
|
|
6370
|
-
for (var name in headers) {
|
|
6371
|
-
if (headers[name] !== O[name]) {
|
|
6372
|
-
fields.push(name.replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_HFNAME, pctEncChar) + "=" + headers[name].replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_HFVALUE, pctEncChar));
|
|
6373
|
-
}
|
|
6374
|
-
}
|
|
6375
|
-
if (fields.length) {
|
|
6376
|
-
components.query = fields.join("&");
|
|
6377
|
-
}
|
|
6378
|
-
return components;
|
|
5761
|
+
// check for reference errors
|
|
5762
|
+
if (options.reference && options.reference !== 'suffix' && options.reference !== parsed.reference) {
|
|
5763
|
+
parsed.error = parsed.error || 'URI is not a ' + options.reference + ' reference.';
|
|
6379
5764
|
}
|
|
6380
|
-
};
|
|
6381
5765
|
|
|
6382
|
-
|
|
6383
|
-
|
|
6384
|
-
|
|
6385
|
-
scheme
|
|
6386
|
-
|
|
6387
|
-
|
|
6388
|
-
|
|
6389
|
-
|
|
6390
|
-
|
|
6391
|
-
|
|
6392
|
-
|
|
6393
|
-
|
|
6394
|
-
var schemeHandler = SCHEMES[urnScheme];
|
|
6395
|
-
urnComponents.nid = nid;
|
|
6396
|
-
urnComponents.nss = nss;
|
|
6397
|
-
urnComponents.path = undefined;
|
|
6398
|
-
if (schemeHandler) {
|
|
6399
|
-
urnComponents = schemeHandler.parse(urnComponents, options);
|
|
6400
|
-
}
|
|
6401
|
-
} else {
|
|
6402
|
-
urnComponents.error = urnComponents.error || "URN can not be parsed.";
|
|
5766
|
+
// find scheme handler
|
|
5767
|
+
const schemeHandler = SCHEMES[(options.scheme || parsed.scheme || '').toLowerCase()];
|
|
5768
|
+
|
|
5769
|
+
// check if scheme can't handle IRIs
|
|
5770
|
+
if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
|
|
5771
|
+
// if host component is a domain name
|
|
5772
|
+
if (parsed.host && (options.domainHost || (schemeHandler && schemeHandler.domainHost)) && isIP === false && nonSimpleDomain(parsed.host)) {
|
|
5773
|
+
// convert Unicode IDN -> ASCII IDN
|
|
5774
|
+
try {
|
|
5775
|
+
parsed.host = URL.domainToASCII(parsed.host.toLowerCase());
|
|
5776
|
+
} catch (e) {
|
|
5777
|
+
parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
|
|
6403
5778
|
}
|
|
6404
|
-
|
|
6405
|
-
|
|
6406
|
-
serialize: function serialize$$1(urnComponents, options) {
|
|
6407
|
-
var scheme = options.scheme || urnComponents.scheme || "urn";
|
|
6408
|
-
var nid = urnComponents.nid;
|
|
6409
|
-
var urnScheme = scheme + ":" + (options.nid || nid);
|
|
6410
|
-
var schemeHandler = SCHEMES[urnScheme];
|
|
6411
|
-
if (schemeHandler) {
|
|
6412
|
-
urnComponents = schemeHandler.serialize(urnComponents, options);
|
|
6413
|
-
}
|
|
6414
|
-
var uriComponents = urnComponents;
|
|
6415
|
-
var nss = urnComponents.nss;
|
|
6416
|
-
uriComponents.path = (nid || options.nid) + ":" + nss;
|
|
6417
|
-
return uriComponents;
|
|
5779
|
+
}
|
|
5780
|
+
// convert IRI -> URI
|
|
6418
5781
|
}
|
|
6419
|
-
};
|
|
6420
5782
|
|
|
6421
|
-
|
|
6422
|
-
|
|
6423
|
-
|
|
6424
|
-
|
|
6425
|
-
|
|
6426
|
-
|
|
6427
|
-
|
|
6428
|
-
|
|
6429
|
-
|
|
6430
|
-
|
|
6431
|
-
|
|
6432
|
-
|
|
6433
|
-
|
|
6434
|
-
serialize: function serialize(uuidComponents, options) {
|
|
6435
|
-
var urnComponents = uuidComponents;
|
|
6436
|
-
//normalize UUID
|
|
6437
|
-
urnComponents.nss = (uuidComponents.uuid || "").toLowerCase();
|
|
6438
|
-
return urnComponents;
|
|
5783
|
+
if (!schemeHandler || (schemeHandler && !schemeHandler.skipNormalize)) {
|
|
5784
|
+
if (gotEncoding && parsed.scheme !== undefined) {
|
|
5785
|
+
parsed.scheme = unescape(parsed.scheme);
|
|
5786
|
+
}
|
|
5787
|
+
if (gotEncoding && parsed.host !== undefined) {
|
|
5788
|
+
parsed.host = unescape(parsed.host);
|
|
5789
|
+
}
|
|
5790
|
+
if (parsed.path) {
|
|
5791
|
+
parsed.path = escape(unescape(parsed.path));
|
|
5792
|
+
}
|
|
5793
|
+
if (parsed.fragment) {
|
|
5794
|
+
parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
|
|
5795
|
+
}
|
|
6439
5796
|
}
|
|
6440
|
-
};
|
|
6441
5797
|
|
|
6442
|
-
|
|
6443
|
-
|
|
6444
|
-
|
|
6445
|
-
|
|
6446
|
-
|
|
6447
|
-
|
|
6448
|
-
|
|
6449
|
-
|
|
6450
|
-
|
|
6451
|
-
exports.pctEncChar = pctEncChar;
|
|
6452
|
-
exports.pctDecChars = pctDecChars;
|
|
6453
|
-
exports.parse = parse;
|
|
6454
|
-
exports.removeDotSegments = removeDotSegments;
|
|
6455
|
-
exports.serialize = serialize;
|
|
6456
|
-
exports.resolveComponents = resolveComponents;
|
|
6457
|
-
exports.resolve = resolve;
|
|
6458
|
-
exports.normalize = normalize;
|
|
6459
|
-
exports.equal = equal;
|
|
6460
|
-
exports.escapeComponent = escapeComponent;
|
|
6461
|
-
exports.unescapeComponent = unescapeComponent;
|
|
6462
|
-
|
|
6463
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5798
|
+
// perform scheme specific parsing
|
|
5799
|
+
if (schemeHandler && schemeHandler.parse) {
|
|
5800
|
+
schemeHandler.parse(parsed, options);
|
|
5801
|
+
}
|
|
5802
|
+
} else {
|
|
5803
|
+
parsed.error = parsed.error || 'URI can not be parsed.';
|
|
5804
|
+
}
|
|
5805
|
+
return parsed
|
|
5806
|
+
}
|
|
6464
5807
|
|
|
6465
|
-
|
|
5808
|
+
const fastUri = {
|
|
5809
|
+
SCHEMES,
|
|
5810
|
+
normalize,
|
|
5811
|
+
resolve,
|
|
5812
|
+
resolveComponents,
|
|
5813
|
+
equal: equal$2,
|
|
5814
|
+
serialize,
|
|
5815
|
+
parse
|
|
5816
|
+
};
|
|
6466
5817
|
|
|
6467
|
-
|
|
5818
|
+
fastUri$1.exports = fastUri;
|
|
5819
|
+
fastUri$1.exports.default = fastUri;
|
|
5820
|
+
fastUri$1.exports.fastUri = fastUri;
|
|
6468
5821
|
|
|
6469
5822
|
Object.defineProperty(uri$1, "__esModule", { value: true });
|
|
6470
|
-
const uri =
|
|
5823
|
+
const uri = fastUri$1.exports;
|
|
6471
5824
|
uri.code = 'require("ajv/dist/runtime/uri").default';
|
|
6472
5825
|
uri$1.default = uri;
|
|
6473
5826
|
|
|
@@ -6488,7 +5841,7 @@
|
|
|
6488
5841
|
const rules_1 = rules;
|
|
6489
5842
|
const compile_1 = compile;
|
|
6490
5843
|
const codegen_2 = codegen;
|
|
6491
|
-
const resolve_1 = resolve$
|
|
5844
|
+
const resolve_1 = resolve$2;
|
|
6492
5845
|
const dataType_1 = dataType;
|
|
6493
5846
|
const util_1 = util;
|
|
6494
5847
|
const $dataRefSchema = require$$9;
|
|
@@ -9604,7 +8957,7 @@
|
|
|
9604
8957
|
message = _theRule.message;
|
|
9605
8958
|
var valid = true;
|
|
9606
8959
|
if (isExpression(validator)) {
|
|
9607
|
-
valid =
|
|
8960
|
+
valid = _executeExpression(validator, instance);
|
|
9608
8961
|
} else if (typeof validator === 'function') {
|
|
9609
8962
|
valid = validator(instance);
|
|
9610
8963
|
// eslint-disable-next-line no-eval
|
|
@@ -9768,7 +9121,7 @@
|
|
|
9768
9121
|
};
|
|
9769
9122
|
// 校验schema是否正常
|
|
9770
9123
|
var validateSchema = /*#__PURE__*/function () {
|
|
9771
|
-
var _ref = _asyncToGenerator(
|
|
9124
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(schema) {
|
|
9772
9125
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
9773
9126
|
while (1) switch (_context.prev = _context.next) {
|
|
9774
9127
|
case 0:
|
|
@@ -9993,7 +9346,7 @@
|
|
|
9993
9346
|
},
|
|
9994
9347
|
loadDataSource: function loadDataSource() {
|
|
9995
9348
|
var _this3 = this;
|
|
9996
|
-
return _asyncToGenerator(
|
|
9349
|
+
return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
9997
9350
|
var _this3$widgetSchema, _this3$widgetSchema$u, _this3$widgetSchema$u2;
|
|
9998
9351
|
var xhrConfig, url, params, reset, _this3$httpAdapter, _this3$httpAdapter$re, http, responseParse, remoteURL, requestParams;
|
|
9999
9352
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
@@ -10008,8 +9361,8 @@
|
|
|
10008
9361
|
_this3$httpAdapter = _this3.httpAdapter, _this3$httpAdapter$re = _this3$httpAdapter.request, http = _this3$httpAdapter$re === void 0 ? request : _this3$httpAdapter$re, responseParse = _this3$httpAdapter.responseParse;
|
|
10009
9362
|
_context.prev = 4;
|
|
10010
9363
|
_this3.loading = true;
|
|
10011
|
-
remoteURL =
|
|
10012
|
-
requestParams = isObj(params) ?
|
|
9364
|
+
remoteURL = _executeExpression(url, _this3);
|
|
9365
|
+
requestParams = isObj(params) ? _executeExpression(params, _this3) : params;
|
|
10013
9366
|
_context.next = 10;
|
|
10014
9367
|
return http(remoteURL, _objectSpread2(_objectSpread2({}, reset), {}, {
|
|
10015
9368
|
params: requestParams,
|
|
@@ -11342,12 +10695,13 @@
|
|
|
11342
10695
|
};
|
|
11343
10696
|
return h("table", [h("thead", {
|
|
11344
10697
|
"style": theadStyle
|
|
11345
|
-
}, [h("tr", [props === null || props === void 0 ? void 0 : props.map(function (prop) {
|
|
10698
|
+
}, [h("tr", [props === null || props === void 0 ? void 0 : props.map(function (prop, i) {
|
|
11346
10699
|
var _this$schema3, _this$schema3$items, _this$columns$path;
|
|
11347
10700
|
var schemaItem = (_this$schema3 = _this.schema) === null || _this$schema3 === void 0 ? void 0 : (_this$schema3$items = _this$schema3.items) === null || _this$schema3$items === void 0 ? void 0 : _this$schema3$items.properties[prop];
|
|
11348
10701
|
var path = Path.getCurPath(_this.path, "0.".concat(prop));
|
|
11349
10702
|
return h("th", {
|
|
11350
10703
|
"style": _objectSpread2(_objectSpread2({}, thStyle), {}, {
|
|
10704
|
+
paddingLeft: i > 0 ? '10px' : '0px',
|
|
11351
10705
|
display: ((_this$columns$path = _this.columns[path]) === null || _this$columns$path === void 0 ? void 0 : _this$columns$path.visible) === false ? 'none' : ''
|
|
11352
10706
|
})
|
|
11353
10707
|
}, [schemaItem === null || schemaItem === void 0 ? void 0 : schemaItem.title]);
|
|
@@ -11362,7 +10716,7 @@
|
|
|
11362
10716
|
tag: 'tr',
|
|
11363
10717
|
layout: _objectSpread2({}, _this.layout)
|
|
11364
10718
|
})
|
|
11365
|
-
}]), [props !== null && props !== void 0 && props.length ? props.map(function (prop) {
|
|
10719
|
+
}]), [props !== null && props !== void 0 && props.length ? props.map(function (prop, i) {
|
|
11366
10720
|
var _this$schema4, _this$schema4$items, _this$columns$curPath;
|
|
11367
10721
|
var schemaItem = (_this$schema4 = _this.schema) === null || _this$schema4 === void 0 ? void 0 : (_this$schema4$items = _this$schema4.items) === null || _this$schema4$items === void 0 ? void 0 : _this$schema4$items.properties[prop];
|
|
11368
10722
|
var curPath = Path.getCurPath(_this.path, "".concat(index, ".").concat(prop));
|
|
@@ -11370,6 +10724,7 @@
|
|
|
11370
10724
|
var layoutConfig = Layout.findLayoutByProp(lastProp, _this.layout.group || []) || {};
|
|
11371
10725
|
return h("td", {
|
|
11372
10726
|
"style": _objectSpread2(_objectSpread2({}, tdStyle), {}, {
|
|
10727
|
+
paddingLeft: i > 0 ? '10px' : '0px',
|
|
11373
10728
|
display: ((_this$columns$curPath = _this.columns[curPath]) === null || _this$columns$curPath === void 0 ? void 0 : _this$columns$curPath.visible) === false ? 'none' : ''
|
|
11374
10729
|
})
|
|
11375
10730
|
}, [renderSchemaField({
|
|
@@ -11383,7 +10738,9 @@
|
|
|
11383
10738
|
schema: dealSchema(((_this$schema5 = _this.schema) === null || _this$schema5 === void 0 ? void 0 : _this$schema5.items) || {}),
|
|
11384
10739
|
layout: {},
|
|
11385
10740
|
required: false
|
|
11386
|
-
})]), h("td",
|
|
10741
|
+
})]), h("td", {
|
|
10742
|
+
"style": _objectSpread2({}, tdStyle)
|
|
10743
|
+
}, [h("span", {
|
|
11387
10744
|
"style": _objectSpread2(_objectSpread2({}, labelBtnStyle), {}, {
|
|
11388
10745
|
marginBottom: '10px'
|
|
11389
10746
|
}),
|
|
@@ -11702,7 +11059,7 @@
|
|
|
11702
11059
|
options.fileObj.xhr = xhr;
|
|
11703
11060
|
var formData = new FormData();
|
|
11704
11061
|
options.data.forEach(function (item) {
|
|
11705
|
-
formData.append(item.name,
|
|
11062
|
+
formData.append(item.name, _executeExpression(item.value, _this.$parent.$parent));
|
|
11706
11063
|
});
|
|
11707
11064
|
formData.append(options.fileName, options.fileObj.origin);
|
|
11708
11065
|
xhr.onreadystatechange = function () {
|
|
@@ -11725,12 +11082,12 @@
|
|
|
11725
11082
|
if (Array.isArray(options.header)) {
|
|
11726
11083
|
options.header.forEach(function (head) {
|
|
11727
11084
|
var headerKey = head.name;
|
|
11728
|
-
var headerVal =
|
|
11085
|
+
var headerVal = _executeExpression(head.value, _this.$parent.$parent);
|
|
11729
11086
|
xhr.setRequestHeader(headerKey, headerVal);
|
|
11730
11087
|
});
|
|
11731
11088
|
} else {
|
|
11732
11089
|
var headerKey = options.header.name;
|
|
11733
|
-
var headerVal =
|
|
11090
|
+
var headerVal = _executeExpression(options.header.value, this.$parent.$parent);
|
|
11734
11091
|
xhr.setRequestHeader(headerKey, headerVal);
|
|
11735
11092
|
}
|
|
11736
11093
|
}
|
|
@@ -11754,13 +11111,13 @@
|
|
|
11754
11111
|
handleResCode: function handleResCode(res) {
|
|
11755
11112
|
var successed = true;
|
|
11756
11113
|
if (this.isUploadSuccessed) {
|
|
11757
|
-
successed =
|
|
11114
|
+
successed = _executeExpression(this.isUploadSuccessed, this.$parent.$parent, [], {
|
|
11758
11115
|
response: res
|
|
11759
11116
|
});
|
|
11760
11117
|
}
|
|
11761
11118
|
if (!successed) return;
|
|
11762
11119
|
if (this.responseHandler) {
|
|
11763
|
-
var files =
|
|
11120
|
+
var files = _executeExpression(this.responseHandler, this.$parent.$parent, [], {
|
|
11764
11121
|
response: res
|
|
11765
11122
|
});
|
|
11766
11123
|
this.$emit('input', files);
|
|
@@ -12098,7 +11455,7 @@
|
|
|
12098
11455
|
},
|
|
12099
11456
|
methods: {
|
|
12100
11457
|
initFormData: function initFormData() {
|
|
12101
|
-
this.rootData =
|
|
11458
|
+
this.rootData = _merge(Schema.getSchemaDefaultValue(createProxy(this.schema, this)) || {}, this.value);
|
|
12102
11459
|
this.emitFormValueChange(this.rootData, this.value);
|
|
12103
11460
|
},
|
|
12104
11461
|
emitFormValueChange: function emitFormValueChange(newValue, oldValue) {
|