@blueking/bkui-form 0.0.46 → 0.0.48
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 +5 -3
- package/dist/bkui-form-es.js +1351 -704
- package/dist/bkui-form-es.js.map +1 -1
- package/dist/bkui-form-umd-min.js +5 -3
- package/dist/bkui-form-umd.js +1351 -704
- 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],
|
|
193
|
+
for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.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 (
|
|
201
|
+
if (e.indexOf(n) >= 0) 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 = (/*#__PURE__*/function () {
|
|
1379
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(url) {
|
|
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,6 +1915,8 @@
|
|
|
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
|
+
|
|
1918
1920
|
function getDefaultExportFromCjs (x) {
|
|
1919
1921
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
1920
1922
|
}
|
|
@@ -1936,7 +1938,6 @@
|
|
|
1936
1938
|
(function (exports) {
|
|
1937
1939
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1938
1940
|
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
|
|
1940
1941
|
class _CodeOrName {
|
|
1941
1942
|
}
|
|
1942
1943
|
exports._CodeOrName = _CodeOrName;
|
|
@@ -3945,7 +3946,7 @@
|
|
|
3945
3946
|
}
|
|
3946
3947
|
subschema.extendSubschemaMode = extendSubschemaMode;
|
|
3947
3948
|
|
|
3948
|
-
var resolve$
|
|
3949
|
+
var resolve$1 = {};
|
|
3949
3950
|
|
|
3950
3951
|
// do not edit .js files directly - edit src/index.jst
|
|
3951
3952
|
|
|
@@ -4086,10 +4087,10 @@
|
|
|
4086
4087
|
return str.replace(/~/g, '~0').replace(/\//g, '~1');
|
|
4087
4088
|
}
|
|
4088
4089
|
|
|
4089
|
-
Object.defineProperty(resolve$
|
|
4090
|
-
resolve$
|
|
4090
|
+
Object.defineProperty(resolve$1, "__esModule", { value: true });
|
|
4091
|
+
resolve$1.getSchemaRefs = resolve$1.resolveUrl = resolve$1.normalizeId = resolve$1._getFullPath = resolve$1.getFullPath = resolve$1.inlineRef = void 0;
|
|
4091
4092
|
const util_1$m = util;
|
|
4092
|
-
const equal$
|
|
4093
|
+
const equal$2 = fastDeepEqual;
|
|
4093
4094
|
const traverse = jsonSchemaTraverse.exports;
|
|
4094
4095
|
// TODO refactor to use keyword definitions
|
|
4095
4096
|
const SIMPLE_INLINED = new Set([
|
|
@@ -4119,7 +4120,7 @@
|
|
|
4119
4120
|
return false;
|
|
4120
4121
|
return countKeys(schema) <= limit;
|
|
4121
4122
|
}
|
|
4122
|
-
resolve$
|
|
4123
|
+
resolve$1.inlineRef = inlineRef;
|
|
4123
4124
|
const REF_KEYWORDS = new Set([
|
|
4124
4125
|
"$ref",
|
|
4125
4126
|
"$recursiveRef",
|
|
@@ -4161,22 +4162,22 @@
|
|
|
4161
4162
|
const p = resolver.parse(id);
|
|
4162
4163
|
return _getFullPath(resolver, p);
|
|
4163
4164
|
}
|
|
4164
|
-
resolve$
|
|
4165
|
+
resolve$1.getFullPath = getFullPath;
|
|
4165
4166
|
function _getFullPath(resolver, p) {
|
|
4166
4167
|
const serialized = resolver.serialize(p);
|
|
4167
4168
|
return serialized.split("#")[0] + "#";
|
|
4168
4169
|
}
|
|
4169
|
-
resolve$
|
|
4170
|
+
resolve$1._getFullPath = _getFullPath;
|
|
4170
4171
|
const TRAILING_SLASH_HASH = /#\/?$/;
|
|
4171
4172
|
function normalizeId(id) {
|
|
4172
4173
|
return id ? id.replace(TRAILING_SLASH_HASH, "") : "";
|
|
4173
4174
|
}
|
|
4174
|
-
resolve$
|
|
4175
|
+
resolve$1.normalizeId = normalizeId;
|
|
4175
4176
|
function resolveUrl(resolver, baseId, id) {
|
|
4176
4177
|
id = normalizeId(id);
|
|
4177
4178
|
return resolver.resolve(baseId, id);
|
|
4178
4179
|
}
|
|
4179
|
-
resolve$
|
|
4180
|
+
resolve$1.resolveUrl = resolveUrl;
|
|
4180
4181
|
const ANCHOR = /^[a-z_][-a-z0-9._]*$/i;
|
|
4181
4182
|
function getSchemaRefs(schema, baseId) {
|
|
4182
4183
|
if (typeof schema == "boolean")
|
|
@@ -4231,14 +4232,14 @@
|
|
|
4231
4232
|
});
|
|
4232
4233
|
return localRefs;
|
|
4233
4234
|
function checkAmbiguosRef(sch1, sch2, ref) {
|
|
4234
|
-
if (sch2 !== undefined && !equal$
|
|
4235
|
+
if (sch2 !== undefined && !equal$2(sch1, sch2))
|
|
4235
4236
|
throw ambiguos(ref);
|
|
4236
4237
|
}
|
|
4237
4238
|
function ambiguos(ref) {
|
|
4238
4239
|
return new Error(`reference "${ref}" resolves to more than one schema`);
|
|
4239
4240
|
}
|
|
4240
4241
|
}
|
|
4241
|
-
resolve$
|
|
4242
|
+
resolve$1.getSchemaRefs = getSchemaRefs;
|
|
4242
4243
|
|
|
4243
4244
|
Object.defineProperty(validate$1, "__esModule", { value: true });
|
|
4244
4245
|
validate$1.getData = validate$1.KeywordCxt = validate$1.validateFunctionCode = void 0;
|
|
@@ -4251,7 +4252,7 @@
|
|
|
4251
4252
|
const subschema_1 = subschema;
|
|
4252
4253
|
const codegen_1$n = codegen;
|
|
4253
4254
|
const names_1$3 = names$1;
|
|
4254
|
-
const resolve_1$2 = resolve$
|
|
4255
|
+
const resolve_1$2 = resolve$1;
|
|
4255
4256
|
const util_1$l = util;
|
|
4256
4257
|
const errors_1 = errors;
|
|
4257
4258
|
// schema compilation - generates validation function, subschemaCode (below) is used for subschemas
|
|
@@ -4773,7 +4774,7 @@
|
|
|
4773
4774
|
var ref_error = {};
|
|
4774
4775
|
|
|
4775
4776
|
Object.defineProperty(ref_error, "__esModule", { value: true });
|
|
4776
|
-
const resolve_1$1 = resolve$
|
|
4777
|
+
const resolve_1$1 = resolve$1;
|
|
4777
4778
|
class MissingRefError extends Error {
|
|
4778
4779
|
constructor(resolver, baseId, ref, msg) {
|
|
4779
4780
|
super(msg || `can't resolve reference ${ref} from id ${baseId}`);
|
|
@@ -4790,7 +4791,7 @@
|
|
|
4790
4791
|
const codegen_1$m = codegen;
|
|
4791
4792
|
const validation_error_1 = validation_error;
|
|
4792
4793
|
const names_1$2 = names$1;
|
|
4793
|
-
const resolve_1 = resolve$
|
|
4794
|
+
const resolve_1 = resolve$1;
|
|
4794
4795
|
const util_1$k = util;
|
|
4795
4796
|
const validate_1$1 = validate$1;
|
|
4796
4797
|
class SchemaEnv {
|
|
@@ -4916,7 +4917,7 @@
|
|
|
4916
4917
|
const schOrFunc = root.refs[ref];
|
|
4917
4918
|
if (schOrFunc)
|
|
4918
4919
|
return schOrFunc;
|
|
4919
|
-
let _sch = resolve
|
|
4920
|
+
let _sch = resolve.call(this, root, ref);
|
|
4920
4921
|
if (_sch === undefined) {
|
|
4921
4922
|
const schema = (_a = root.localRefs) === null || _a === void 0 ? void 0 : _a[ref]; // TODO maybe localRefs should hold SchemaEnv
|
|
4922
4923
|
const { schemaId } = this.opts;
|
|
@@ -4946,7 +4947,7 @@
|
|
|
4946
4947
|
}
|
|
4947
4948
|
// resolve and compile the references ($ref)
|
|
4948
4949
|
// TODO returns AnySchemaObject (if the schema can be inlined) or validation function
|
|
4949
|
-
function resolve
|
|
4950
|
+
function resolve(root, // information about the root schema for the current schema
|
|
4950
4951
|
ref // reference to resolve
|
|
4951
4952
|
) {
|
|
4952
4953
|
let sch;
|
|
@@ -5057,770 +5058,1416 @@
|
|
|
5057
5058
|
|
|
5058
5059
|
var uri$1 = {};
|
|
5059
5060
|
|
|
5060
|
-
var
|
|
5061
|
-
|
|
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
|
-
|
|
5061
|
+
var uri_all = {exports: {}};
|
|
5062
|
+
|
|
5063
|
+
/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */
|
|
5064
|
+
|
|
5065
|
+
(function (module, exports) {
|
|
5066
|
+
(function (global, factory) {
|
|
5067
|
+
factory(exports) ;
|
|
5068
|
+
}(commonjsGlobal, (function (exports) {
|
|
5069
|
+
function merge() {
|
|
5070
|
+
for (var _len = arguments.length, sets = Array(_len), _key = 0; _key < _len; _key++) {
|
|
5071
|
+
sets[_key] = arguments[_key];
|
|
5072
|
+
}
|
|
5073
|
+
|
|
5074
|
+
if (sets.length > 1) {
|
|
5075
|
+
sets[0] = sets[0].slice(0, -1);
|
|
5076
|
+
var xl = sets.length - 1;
|
|
5077
|
+
for (var x = 1; x < xl; ++x) {
|
|
5078
|
+
sets[x] = sets[x].slice(1, -1);
|
|
5079
|
+
}
|
|
5080
|
+
sets[xl] = sets[xl].slice(1);
|
|
5081
|
+
return sets.join('');
|
|
5082
|
+
} else {
|
|
5083
|
+
return sets[0];
|
|
5084
|
+
}
|
|
5085
|
+
}
|
|
5086
|
+
function subexp(str) {
|
|
5087
|
+
return "(?:" + str + ")";
|
|
5088
|
+
}
|
|
5089
|
+
function typeOf(o) {
|
|
5090
|
+
return o === undefined ? "undefined" : o === null ? "null" : Object.prototype.toString.call(o).split(" ").pop().split("]").shift().toLowerCase();
|
|
5091
|
+
}
|
|
5092
|
+
function toUpperCase(str) {
|
|
5093
|
+
return str.toUpperCase();
|
|
5094
|
+
}
|
|
5095
|
+
function toArray(obj) {
|
|
5096
|
+
return obj !== undefined && obj !== null ? obj instanceof Array ? obj : typeof obj.length !== "number" || obj.split || obj.setInterval || obj.call ? [obj] : Array.prototype.slice.call(obj) : [];
|
|
5097
|
+
}
|
|
5098
|
+
function assign(target, source) {
|
|
5099
|
+
var obj = target;
|
|
5100
|
+
if (source) {
|
|
5101
|
+
for (var key in source) {
|
|
5102
|
+
obj[key] = source[key];
|
|
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
|
+
};
|
|
5104
5171
|
}
|
|
5172
|
+
var URI_PROTOCOL = buildExps(false);
|
|
5105
5173
|
|
|
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
|
-
}
|
|
5174
|
+
var IRI_PROTOCOL = buildExps(true);
|
|
5147
5175
|
|
|
5148
|
-
|
|
5149
|
-
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
|
|
5155
|
-
|
|
5156
|
-
|
|
5157
|
-
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
output.error = true;
|
|
5161
|
-
break
|
|
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
|
+
|
|
5183
|
+
try {
|
|
5184
|
+
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
|
|
5185
|
+
_arr.push(_s.value);
|
|
5186
|
+
|
|
5187
|
+
if (i && _arr.length === i) break;
|
|
5162
5188
|
}
|
|
5163
|
-
|
|
5164
|
-
|
|
5189
|
+
} catch (err) {
|
|
5190
|
+
_d = true;
|
|
5191
|
+
_e = err;
|
|
5192
|
+
} finally {
|
|
5193
|
+
try {
|
|
5194
|
+
if (!_n && _i["return"]) _i["return"]();
|
|
5195
|
+
} finally {
|
|
5196
|
+
if (_d) throw _e;
|
|
5165
5197
|
}
|
|
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
|
|
5174
5198
|
}
|
|
5199
|
+
|
|
5200
|
+
return _arr;
|
|
5175
5201
|
}
|
|
5176
|
-
|
|
5177
|
-
|
|
5178
|
-
|
|
5179
|
-
|
|
5180
|
-
|
|
5202
|
+
|
|
5203
|
+
return function (arr, i) {
|
|
5204
|
+
if (Array.isArray(arr)) {
|
|
5205
|
+
return arr;
|
|
5206
|
+
} else if (Symbol.iterator in Object(arr)) {
|
|
5207
|
+
return sliceIterator(arr, i);
|
|
5181
5208
|
} else {
|
|
5182
|
-
|
|
5209
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
|
5183
5210
|
}
|
|
5184
|
-
}
|
|
5185
|
-
|
|
5186
|
-
return output
|
|
5187
|
-
}
|
|
5211
|
+
};
|
|
5212
|
+
}();
|
|
5188
5213
|
|
|
5189
|
-
function normalizeIPv6$1 (host) {
|
|
5190
|
-
if (findToken(host, ':') < 2) { return { host, isIPV6: false } }
|
|
5191
|
-
const ipv6 = getIPV6(host);
|
|
5192
5214
|
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5215
|
+
|
|
5216
|
+
|
|
5217
|
+
|
|
5218
|
+
|
|
5219
|
+
|
|
5220
|
+
|
|
5221
|
+
|
|
5222
|
+
|
|
5223
|
+
|
|
5224
|
+
|
|
5225
|
+
|
|
5226
|
+
var toConsumableArray = function (arr) {
|
|
5227
|
+
if (Array.isArray(arr)) {
|
|
5228
|
+
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
|
|
5229
|
+
|
|
5230
|
+
return arr2;
|
|
5201
5231
|
} else {
|
|
5202
|
-
return
|
|
5232
|
+
return Array.from(arr);
|
|
5203
5233
|
}
|
|
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]);
|
|
5204
5277
|
}
|
|
5205
5278
|
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
skip = false;
|
|
5222
|
-
}
|
|
5223
|
-
out += c;
|
|
5224
|
-
}
|
|
5225
|
-
}
|
|
5226
|
-
return out
|
|
5279
|
+
/**
|
|
5280
|
+
* A generic `Array#map` utility function.
|
|
5281
|
+
* @private
|
|
5282
|
+
* @param {Array} array The array to iterate over.
|
|
5283
|
+
* @param {Function} callback The function that gets called for every array
|
|
5284
|
+
* item.
|
|
5285
|
+
* @returns {Array} A new array of values returned by the callback function.
|
|
5286
|
+
*/
|
|
5287
|
+
function map(array, fn) {
|
|
5288
|
+
var result = [];
|
|
5289
|
+
var length = array.length;
|
|
5290
|
+
while (length--) {
|
|
5291
|
+
result[length] = fn(array[length]);
|
|
5292
|
+
}
|
|
5293
|
+
return result;
|
|
5227
5294
|
}
|
|
5228
5295
|
|
|
5229
|
-
|
|
5230
|
-
|
|
5231
|
-
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
-
|
|
5235
|
-
|
|
5236
|
-
|
|
5237
|
-
|
|
5238
|
-
|
|
5239
|
-
|
|
5240
|
-
|
|
5241
|
-
|
|
5242
|
-
|
|
5243
|
-
|
|
5244
|
-
|
|
5245
|
-
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
|
|
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('')
|
|
5296
|
+
/**
|
|
5297
|
+
* A simple `Array#map`-like wrapper to work with domain name strings or email
|
|
5298
|
+
* addresses.
|
|
5299
|
+
* @private
|
|
5300
|
+
* @param {String} domain The domain name or email address.
|
|
5301
|
+
* @param {Function} callback The function that gets called for every
|
|
5302
|
+
* character.
|
|
5303
|
+
* @returns {Array} A new string of characters returned by the callback
|
|
5304
|
+
* function.
|
|
5305
|
+
*/
|
|
5306
|
+
function mapDomain(string, fn) {
|
|
5307
|
+
var parts = string.split('@');
|
|
5308
|
+
var result = '';
|
|
5309
|
+
if (parts.length > 1) {
|
|
5310
|
+
// In email addresses, only the domain name should be punycoded. Leave
|
|
5311
|
+
// the local part (i.e. everything up to `@`) intact.
|
|
5312
|
+
result = parts[0] + '@';
|
|
5313
|
+
string = parts[1];
|
|
5314
|
+
}
|
|
5315
|
+
// Avoid `split(regex)` for IE8 compatibility. See #17.
|
|
5316
|
+
string = string.replace(regexSeparators, '\x2E');
|
|
5317
|
+
var labels = string.split('.');
|
|
5318
|
+
var encoded = map(labels, fn).join('.');
|
|
5319
|
+
return result + encoded;
|
|
5267
5320
|
}
|
|
5268
5321
|
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
|
|
5277
|
-
|
|
5278
|
-
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
|
|
5322
|
+
/**
|
|
5323
|
+
* Creates an array containing the numeric code points of each Unicode
|
|
5324
|
+
* character in the string. While JavaScript uses UCS-2 internally,
|
|
5325
|
+
* this function will convert a pair of surrogate halves (each of which
|
|
5326
|
+
* UCS-2 exposes as separate characters) into a single code point,
|
|
5327
|
+
* matching UTF-16.
|
|
5328
|
+
* @see `punycode.ucs2.encode`
|
|
5329
|
+
* @see <https://mathiasbynens.be/notes/javascript-encoding>
|
|
5330
|
+
* @memberOf punycode.ucs2
|
|
5331
|
+
* @name decode
|
|
5332
|
+
* @param {String} string The Unicode input string (UCS-2).
|
|
5333
|
+
* @returns {Array} The new array of code points.
|
|
5334
|
+
*/
|
|
5335
|
+
function ucs2decode(string) {
|
|
5336
|
+
var output = [];
|
|
5337
|
+
var counter = 0;
|
|
5338
|
+
var length = string.length;
|
|
5339
|
+
while (counter < length) {
|
|
5340
|
+
var value = string.charCodeAt(counter++);
|
|
5341
|
+
if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
|
|
5342
|
+
// It's a high surrogate, and there is a next character.
|
|
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;
|
|
5290
5358
|
}
|
|
5291
5359
|
|
|
5292
|
-
|
|
5293
|
-
|
|
5360
|
+
/**
|
|
5361
|
+
* Creates a string based on an array of numeric code points.
|
|
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
|
+
};
|
|
5294
5371
|
|
|
5295
|
-
|
|
5296
|
-
|
|
5297
|
-
|
|
5298
|
-
|
|
5372
|
+
/**
|
|
5373
|
+
* Converts a basic code point into a digit/integer.
|
|
5374
|
+
* @see `digitToBasic()`
|
|
5375
|
+
* @private
|
|
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
|
+
};
|
|
5299
5393
|
|
|
5300
|
-
|
|
5301
|
-
|
|
5302
|
-
|
|
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
|
+
};
|
|
5303
5410
|
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
|
|
5312
|
-
|
|
5313
|
-
|
|
5314
|
-
|
|
5315
|
-
|
|
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
|
+
};
|
|
5316
5425
|
|
|
5317
|
-
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
|
|
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
|
+
}
|
|
5321
5449
|
|
|
5322
|
-
|
|
5323
|
-
|
|
5324
|
-
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
-
|
|
5328
|
-
|
|
5329
|
-
normalizeIPv6: normalizeIPv6$1,
|
|
5330
|
-
stringArrayToHexStripped
|
|
5331
|
-
};
|
|
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
|
+
}
|
|
5332
5457
|
|
|
5333
|
-
|
|
5334
|
-
|
|
5458
|
+
// Main decoding loop: start just after the last delimiter if any basic code
|
|
5459
|
+
// points were copied; start at the beginning otherwise.
|
|
5335
5460
|
|
|
5336
|
-
|
|
5337
|
-
return typeof wsComponents.secure === 'boolean' ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === 'wss'
|
|
5338
|
-
}
|
|
5461
|
+
for (var index = basic > 0 ? basic + 1 : 0; index < inputLength;) /* no final expression */{
|
|
5339
5462
|
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
5463
|
+
// `index` is the index of the next character to be consumed.
|
|
5464
|
+
// Decode a generalized variable-length integer into `delta`,
|
|
5465
|
+
// which gets added to `i`. The overflow checking is easier
|
|
5466
|
+
// if we increase `i` as we go, then subtract off its starting
|
|
5467
|
+
// value at the end to obtain `delta`.
|
|
5468
|
+
var oldi = i;
|
|
5469
|
+
for (var w = 1, k = base;; /* no condition */k += base) {
|
|
5344
5470
|
|
|
5345
|
-
|
|
5346
|
-
|
|
5471
|
+
if (index >= inputLength) {
|
|
5472
|
+
error$1('invalid-input');
|
|
5473
|
+
}
|
|
5347
5474
|
|
|
5348
|
-
|
|
5349
|
-
const secure = String(components.scheme).toLowerCase() === 'https';
|
|
5475
|
+
var digit = basicToDigit(input.charCodeAt(index++));
|
|
5350
5476
|
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
|
|
5354
|
-
}
|
|
5477
|
+
if (digit >= base || digit > floor((maxInt - i) / w)) {
|
|
5478
|
+
error$1('overflow');
|
|
5479
|
+
}
|
|
5355
5480
|
|
|
5356
|
-
|
|
5357
|
-
|
|
5358
|
-
components.path = '/';
|
|
5359
|
-
}
|
|
5481
|
+
i += digit * w;
|
|
5482
|
+
var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
|
|
5360
5483
|
|
|
5361
|
-
|
|
5362
|
-
|
|
5363
|
-
|
|
5484
|
+
if (digit < t) {
|
|
5485
|
+
break;
|
|
5486
|
+
}
|
|
5364
5487
|
|
|
5365
|
-
|
|
5366
|
-
|
|
5488
|
+
var baseMinusT = base - t;
|
|
5489
|
+
if (w > floor(maxInt / baseMinusT)) {
|
|
5490
|
+
error$1('overflow');
|
|
5491
|
+
}
|
|
5367
5492
|
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
wsComponents.secure = isSecure(wsComponents);
|
|
5493
|
+
w *= baseMinusT;
|
|
5494
|
+
}
|
|
5371
5495
|
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
wsComponents.path = undefined;
|
|
5375
|
-
wsComponents.query = undefined;
|
|
5496
|
+
var out = output.length + 1;
|
|
5497
|
+
bias = adapt(i - oldi, out, oldi == 0);
|
|
5376
5498
|
|
|
5377
|
-
|
|
5378
|
-
|
|
5499
|
+
// `i` was supposed to wrap around from `out` to `0`,
|
|
5500
|
+
// incrementing `n` each time, so we'll fix that now:
|
|
5501
|
+
if (floor(i / out) > maxInt - n) {
|
|
5502
|
+
error$1('overflow');
|
|
5503
|
+
}
|
|
5379
5504
|
|
|
5380
|
-
|
|
5381
|
-
|
|
5382
|
-
if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === '') {
|
|
5383
|
-
wsComponents.port = undefined;
|
|
5384
|
-
}
|
|
5505
|
+
n += floor(i / out);
|
|
5506
|
+
i %= out;
|
|
5385
5507
|
|
|
5386
|
-
|
|
5387
|
-
|
|
5388
|
-
|
|
5389
|
-
wsComponents.secure = undefined;
|
|
5390
|
-
}
|
|
5508
|
+
// Insert `n` at position `i` of the output.
|
|
5509
|
+
output.splice(i++, 0, n);
|
|
5510
|
+
}
|
|
5391
5511
|
|
|
5392
|
-
|
|
5393
|
-
|
|
5394
|
-
const [path, query] = wsComponents.resourceName.split('?');
|
|
5395
|
-
wsComponents.path = (path && path !== '/' ? path : undefined);
|
|
5396
|
-
wsComponents.query = query;
|
|
5397
|
-
wsComponents.resourceName = undefined;
|
|
5398
|
-
}
|
|
5512
|
+
return String.fromCodePoint.apply(String, output);
|
|
5513
|
+
};
|
|
5399
5514
|
|
|
5400
|
-
|
|
5401
|
-
|
|
5515
|
+
/**
|
|
5516
|
+
* Converts a string of Unicode symbols (e.g. a domain name label) to a
|
|
5517
|
+
* Punycode string of ASCII-only symbols.
|
|
5518
|
+
* @memberOf punycode
|
|
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 = [];
|
|
5402
5524
|
|
|
5403
|
-
|
|
5404
|
-
|
|
5525
|
+
// Convert the input in UCS-2 to an array of Unicode code points.
|
|
5526
|
+
input = ucs2decode(input);
|
|
5405
5527
|
|
|
5406
|
-
|
|
5407
|
-
|
|
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
|
-
}
|
|
5528
|
+
// Cache the length.
|
|
5529
|
+
var inputLength = input.length;
|
|
5426
5530
|
|
|
5427
|
-
|
|
5428
|
-
|
|
5531
|
+
// Initialize the state.
|
|
5532
|
+
var n = initialN;
|
|
5533
|
+
var delta = 0;
|
|
5534
|
+
var bias = initialBias;
|
|
5429
5535
|
|
|
5430
|
-
|
|
5431
|
-
|
|
5432
|
-
|
|
5433
|
-
|
|
5434
|
-
const schemeHandler = SCHEMES$1[urnScheme];
|
|
5536
|
+
// Handle the basic code points.
|
|
5537
|
+
var _iteratorNormalCompletion = true;
|
|
5538
|
+
var _didIteratorError = false;
|
|
5539
|
+
var _iteratorError = undefined;
|
|
5435
5540
|
|
|
5436
|
-
|
|
5437
|
-
|
|
5438
|
-
|
|
5541
|
+
try {
|
|
5542
|
+
for (var _iterator = input[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
5543
|
+
var _currentValue2 = _step.value;
|
|
5439
5544
|
|
|
5440
|
-
|
|
5441
|
-
|
|
5442
|
-
|
|
5545
|
+
if (_currentValue2 < 0x80) {
|
|
5546
|
+
output.push(stringFromCharCode(_currentValue2));
|
|
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
|
+
}
|
|
5443
5563
|
|
|
5444
|
-
|
|
5445
|
-
|
|
5446
|
-
}
|
|
5564
|
+
var basicLength = output.length;
|
|
5565
|
+
var handledCPCount = basicLength;
|
|
5447
5566
|
|
|
5448
|
-
|
|
5449
|
-
|
|
5450
|
-
uuidComponents.uuid = uuidComponents.nss;
|
|
5451
|
-
uuidComponents.nss = undefined;
|
|
5567
|
+
// `handledCPCount` is the number of code points that have been handled;
|
|
5568
|
+
// `basicLength` is the number of basic code points.
|
|
5452
5569
|
|
|
5453
|
-
|
|
5454
|
-
|
|
5455
|
-
|
|
5570
|
+
// Finish the basic string with a delimiter unless it's empty.
|
|
5571
|
+
if (basicLength) {
|
|
5572
|
+
output.push(delimiter);
|
|
5573
|
+
}
|
|
5456
5574
|
|
|
5457
|
-
|
|
5458
|
-
|
|
5575
|
+
// Main encoding loop:
|
|
5576
|
+
while (handledCPCount < inputLength) {
|
|
5459
5577
|
|
|
5460
|
-
|
|
5461
|
-
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5578
|
+
// All non-basic code points < n have been handled already. Find the next
|
|
5579
|
+
// larger one:
|
|
5580
|
+
var m = maxInt;
|
|
5581
|
+
var _iteratorNormalCompletion2 = true;
|
|
5582
|
+
var _didIteratorError2 = false;
|
|
5583
|
+
var _iteratorError2 = undefined;
|
|
5466
5584
|
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
|
-
|
|
5470
|
-
parse: httpParse,
|
|
5471
|
-
serialize: httpSerialize
|
|
5472
|
-
};
|
|
5585
|
+
try {
|
|
5586
|
+
for (var _iterator2 = input[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
|
5587
|
+
var currentValue = _step2.value;
|
|
5473
5588
|
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
serialize: httpSerialize
|
|
5479
|
-
};
|
|
5589
|
+
if (currentValue >= n && currentValue < m) {
|
|
5590
|
+
m = currentValue;
|
|
5591
|
+
}
|
|
5592
|
+
}
|
|
5480
5593
|
|
|
5481
|
-
|
|
5482
|
-
|
|
5483
|
-
|
|
5484
|
-
|
|
5485
|
-
|
|
5486
|
-
|
|
5594
|
+
// Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
|
|
5595
|
+
// but guard against overflow.
|
|
5596
|
+
} catch (err) {
|
|
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
|
+
}
|
|
5487
5610
|
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
|
|
5491
|
-
|
|
5492
|
-
serialize: ws.serialize
|
|
5493
|
-
};
|
|
5611
|
+
var handledCPCountPlusOne = handledCPCount + 1;
|
|
5612
|
+
if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
|
|
5613
|
+
error$1('overflow');
|
|
5614
|
+
}
|
|
5494
5615
|
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
|
|
5499
|
-
|
|
5500
|
-
|
|
5616
|
+
delta += (m - n) * handledCPCountPlusOne;
|
|
5617
|
+
n = m;
|
|
5618
|
+
|
|
5619
|
+
var _iteratorNormalCompletion3 = true;
|
|
5620
|
+
var _didIteratorError3 = false;
|
|
5621
|
+
var _iteratorError3 = undefined;
|
|
5622
|
+
|
|
5623
|
+
try {
|
|
5624
|
+
for (var _iterator3 = input[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
|
|
5625
|
+
var _currentValue = _step3.value;
|
|
5501
5626
|
|
|
5502
|
-
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
|
|
5506
|
-
|
|
5627
|
+
if (_currentValue < n && ++delta > maxInt) {
|
|
5628
|
+
error$1('overflow');
|
|
5629
|
+
}
|
|
5630
|
+
if (_currentValue == n) {
|
|
5631
|
+
// Represent delta as a generalized variable-length integer.
|
|
5632
|
+
var q = delta;
|
|
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
|
+
}
|
|
5664
|
+
|
|
5665
|
+
++delta;
|
|
5666
|
+
++n;
|
|
5667
|
+
}
|
|
5668
|
+
return output.join('');
|
|
5507
5669
|
};
|
|
5508
5670
|
|
|
5509
|
-
|
|
5510
|
-
|
|
5511
|
-
|
|
5512
|
-
|
|
5513
|
-
|
|
5514
|
-
|
|
5515
|
-
|
|
5671
|
+
/**
|
|
5672
|
+
* Converts a Punycode string representing a domain name or an email address
|
|
5673
|
+
* to Unicode. Only the Punycoded parts of the input will be converted, i.e.
|
|
5674
|
+
* it doesn't matter if you call it on a string that has already been
|
|
5675
|
+
* converted to Unicode.
|
|
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
|
+
});
|
|
5516
5686
|
};
|
|
5517
5687
|
|
|
5518
|
-
|
|
5688
|
+
/**
|
|
5689
|
+
* Converts a Unicode string representing a domain name or an email address to
|
|
5690
|
+
* Punycode. Only the non-ASCII parts of the domain name will be converted,
|
|
5691
|
+
* i.e. it doesn't matter if you call it with a domain that's already in
|
|
5692
|
+
* ASCII.
|
|
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
|
+
});
|
|
5703
|
+
};
|
|
5519
5704
|
|
|
5520
|
-
|
|
5521
|
-
|
|
5705
|
+
/*--------------------------------------------------------------------------*/
|
|
5706
|
+
|
|
5707
|
+
/** Define the public API */
|
|
5708
|
+
var punycode = {
|
|
5709
|
+
/**
|
|
5710
|
+
* A string representing the current Punycode.js version number.
|
|
5711
|
+
* @memberOf punycode
|
|
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
|
|
5730
|
+
};
|
|
5522
5731
|
|
|
5523
|
-
|
|
5524
|
-
|
|
5525
|
-
|
|
5526
|
-
|
|
5527
|
-
|
|
5528
|
-
|
|
5529
|
-
|
|
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;
|
|
5530
5818
|
}
|
|
5531
5819
|
|
|
5532
|
-
function
|
|
5533
|
-
|
|
5534
|
-
const resolved = resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true);
|
|
5535
|
-
return serialize(resolved, { ...schemelessOptions, skipEscape: true })
|
|
5820
|
+
function _stripLeadingZeros(str) {
|
|
5821
|
+
return str.replace(/^0*(.*)/, "$1") || "0";
|
|
5536
5822
|
}
|
|
5823
|
+
function _normalizeIPv4(host, protocol) {
|
|
5824
|
+
var matches = host.match(protocol.IPV4ADDRESS) || [];
|
|
5537
5825
|
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
5541
|
-
|
|
5542
|
-
|
|
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;
|
|
5826
|
+
var _matches = slicedToArray(matches, 2),
|
|
5827
|
+
address = _matches[1];
|
|
5828
|
+
|
|
5829
|
+
if (address) {
|
|
5830
|
+
return address.split(".").map(_stripLeadingZeros).join(".");
|
|
5562
5831
|
} else {
|
|
5563
|
-
|
|
5564
|
-
|
|
5565
|
-
|
|
5566
|
-
|
|
5832
|
+
return host;
|
|
5833
|
+
}
|
|
5834
|
+
}
|
|
5835
|
+
function _normalizeIPv6(host, protocol) {
|
|
5836
|
+
var matches = host.match(protocol.IPV6ADDRESS) || [];
|
|
5837
|
+
|
|
5838
|
+
var _matches2 = slicedToArray(matches, 3),
|
|
5839
|
+
address = _matches2[1],
|
|
5840
|
+
zone = _matches2[2];
|
|
5841
|
+
|
|
5842
|
+
if (address) {
|
|
5843
|
+
var _address$toLowerCase$ = address.toLowerCase().split('::').reverse(),
|
|
5844
|
+
_address$toLowerCase$2 = slicedToArray(_address$toLowerCase$, 2),
|
|
5845
|
+
last = _address$toLowerCase$2[0],
|
|
5846
|
+
first = _address$toLowerCase$2[1];
|
|
5847
|
+
|
|
5848
|
+
var firstFields = first ? first.split(":").map(_stripLeadingZeros) : [];
|
|
5849
|
+
var lastFields = last.split(":").map(_stripLeadingZeros);
|
|
5850
|
+
var isLastFieldIPv4Address = protocol.IPV4ADDRESS.test(lastFields[lastFields.length - 1]);
|
|
5851
|
+
var fieldCount = isLastFieldIPv4Address ? 7 : 8;
|
|
5852
|
+
var lastFieldsStart = lastFields.length - fieldCount;
|
|
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(":");
|
|
5567
5879
|
} else {
|
|
5568
|
-
|
|
5880
|
+
newHost = fields.join(":");
|
|
5569
5881
|
}
|
|
5570
|
-
|
|
5571
|
-
|
|
5572
|
-
|
|
5882
|
+
if (zone) {
|
|
5883
|
+
newHost += "%" + zone;
|
|
5884
|
+
}
|
|
5885
|
+
return newHost;
|
|
5886
|
+
} else {
|
|
5887
|
+
return host;
|
|
5888
|
+
}
|
|
5889
|
+
}
|
|
5890
|
+
var URI_PARSE = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i;
|
|
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
|
+
}
|
|
5573
5913
|
} else {
|
|
5574
|
-
|
|
5575
|
-
|
|
5576
|
-
|
|
5577
|
-
|
|
5578
|
-
|
|
5579
|
-
|
|
5580
|
-
|
|
5581
|
-
|
|
5914
|
+
//IE FIX for improper RegExp matching
|
|
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
|
+
}
|
|
5582
5927
|
}
|
|
5583
|
-
|
|
5584
|
-
|
|
5585
|
-
|
|
5586
|
-
|
|
5587
|
-
|
|
5588
|
-
|
|
5928
|
+
if (components.host) {
|
|
5929
|
+
//normalize IP hosts
|
|
5930
|
+
components.host = _normalizeIPv6(_normalizeIPv4(components.host, protocol), protocol);
|
|
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);
|
|
5961
|
+
} else {
|
|
5962
|
+
//normalize encodings
|
|
5963
|
+
_normalizeComponentEncoding(components, protocol);
|
|
5964
|
+
}
|
|
5965
|
+
//perform scheme specific parsing
|
|
5966
|
+
if (schemeHandler && schemeHandler.parse) {
|
|
5967
|
+
schemeHandler.parse(components, options);
|
|
5968
|
+
}
|
|
5969
|
+
} else {
|
|
5970
|
+
components.error = components.error || "URI can not be parsed.";
|
|
5589
5971
|
}
|
|
5590
|
-
|
|
5591
|
-
}
|
|
5592
|
-
|
|
5593
|
-
target.fragment = relative.fragment;
|
|
5594
|
-
|
|
5595
|
-
return target
|
|
5972
|
+
return components;
|
|
5596
5973
|
}
|
|
5597
5974
|
|
|
5598
|
-
function
|
|
5599
|
-
|
|
5600
|
-
|
|
5601
|
-
|
|
5602
|
-
|
|
5603
|
-
|
|
5604
|
-
|
|
5605
|
-
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
|
|
5609
|
-
|
|
5610
|
-
|
|
5611
|
-
|
|
5612
|
-
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
|
|
5618
|
-
|
|
5619
|
-
|
|
5620
|
-
|
|
5621
|
-
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
|
|
5625
|
-
|
|
5626
|
-
|
|
5627
|
-
|
|
5628
|
-
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
|
|
5633
|
-
|
|
5634
|
-
|
|
5635
|
-
|
|
5636
|
-
|
|
5637
|
-
|
|
5975
|
+
function _recomposeAuthority(components, options) {
|
|
5976
|
+
var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL;
|
|
5977
|
+
var uriTokens = [];
|
|
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("");
|
|
6023
|
+
}
|
|
5638
6024
|
|
|
5639
|
-
|
|
5640
|
-
|
|
6025
|
+
function serialize(components) {
|
|
6026
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
5641
6027
|
|
|
5642
|
-
|
|
5643
|
-
|
|
5644
|
-
|
|
6028
|
+
var protocol = options.iri ? IRI_PROTOCOL : URI_PROTOCOL;
|
|
6029
|
+
var uriTokens = [];
|
|
6030
|
+
//find scheme handler
|
|
6031
|
+
var schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
|
|
6032
|
+
//perform scheme specific serialization
|
|
6033
|
+
if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(components, options);
|
|
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
|
|
5645
6038
|
|
|
5646
|
-
|
|
5647
|
-
|
|
5648
|
-
|
|
5649
|
-
|
|
5650
|
-
|
|
6039
|
+
//if host component is a domain name
|
|
6040
|
+
else if (options.domainHost || schemeHandler && schemeHandler.domainHost) {
|
|
6041
|
+
//convert IDN via punycode
|
|
6042
|
+
try {
|
|
6043
|
+
components.host = !options.iri ? punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase()) : punycode.toUnicode(components.host);
|
|
6044
|
+
} catch (e) {
|
|
6045
|
+
components.error = components.error || "Host's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e;
|
|
6046
|
+
}
|
|
6047
|
+
}
|
|
5651
6048
|
}
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
|
|
5658
|
-
const authority = recomposeAuthority(components);
|
|
5659
|
-
if (authority !== undefined) {
|
|
5660
|
-
if (options.reference !== 'suffix') {
|
|
5661
|
-
uriTokens.push('//');
|
|
6049
|
+
//normalize encoding
|
|
6050
|
+
_normalizeComponentEncoding(components, protocol);
|
|
6051
|
+
if (options.reference !== "suffix" && components.scheme) {
|
|
6052
|
+
uriTokens.push(components.scheme);
|
|
6053
|
+
uriTokens.push(":");
|
|
5662
6054
|
}
|
|
5663
|
-
|
|
5664
|
-
|
|
5665
|
-
|
|
5666
|
-
|
|
5667
|
-
|
|
6055
|
+
var authority = _recomposeAuthority(components, options);
|
|
6056
|
+
if (authority !== undefined) {
|
|
6057
|
+
if (options.reference !== "suffix") {
|
|
6058
|
+
uriTokens.push("//");
|
|
6059
|
+
}
|
|
6060
|
+
uriTokens.push(authority);
|
|
6061
|
+
if (components.path && components.path.charAt(0) !== "/") {
|
|
6062
|
+
uriTokens.push("/");
|
|
6063
|
+
}
|
|
5668
6064
|
}
|
|
5669
|
-
|
|
5670
|
-
|
|
5671
|
-
|
|
5672
|
-
|
|
5673
|
-
|
|
5674
|
-
|
|
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);
|
|
5675
6074
|
}
|
|
5676
|
-
|
|
5677
|
-
|
|
5678
|
-
|
|
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);
|
|
5679
6082
|
}
|
|
6083
|
+
return uriTokens.join(""); //merge tokens into a string
|
|
6084
|
+
}
|
|
5680
6085
|
|
|
5681
|
-
|
|
5682
|
-
|
|
6086
|
+
function resolveComponents(base, relative) {
|
|
6087
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
6088
|
+
var skipNormalization = arguments[3];
|
|
5683
6089
|
|
|
5684
|
-
|
|
5685
|
-
|
|
5686
|
-
|
|
6090
|
+
var target = {};
|
|
6091
|
+
if (!skipNormalization) {
|
|
6092
|
+
base = parse(serialize(base, options), options); //normalize base components
|
|
6093
|
+
relative = parse(serialize(relative, options), options); //normalize relative components
|
|
6094
|
+
}
|
|
6095
|
+
options = options || {};
|
|
6096
|
+
if (!options.tolerant && relative.scheme) {
|
|
6097
|
+
target.scheme = relative.scheme;
|
|
6098
|
+
//target.authority = relative.authority;
|
|
6099
|
+
target.userinfo = relative.userinfo;
|
|
6100
|
+
target.host = relative.host;
|
|
6101
|
+
target.port = relative.port;
|
|
6102
|
+
target.path = removeDotSegments(relative.path || "");
|
|
6103
|
+
target.query = relative.query;
|
|
6104
|
+
} else {
|
|
6105
|
+
if (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) {
|
|
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;
|
|
6141
|
+
}
|
|
6142
|
+
target.fragment = relative.fragment;
|
|
6143
|
+
return target;
|
|
6144
|
+
}
|
|
5687
6145
|
|
|
5688
|
-
|
|
5689
|
-
|
|
5690
|
-
|
|
5691
|
-
return uriTokens.join('')
|
|
6146
|
+
function resolve(baseURI, relativeURI, options) {
|
|
6147
|
+
var schemelessOptions = assign({ scheme: 'null' }, options);
|
|
6148
|
+
return serialize(resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true), schemelessOptions);
|
|
5692
6149
|
}
|
|
5693
6150
|
|
|
5694
|
-
|
|
6151
|
+
function normalize(uri, options) {
|
|
6152
|
+
if (typeof uri === "string") {
|
|
6153
|
+
uri = serialize(parse(uri, options), options);
|
|
6154
|
+
} else if (typeOf(uri) === "object") {
|
|
6155
|
+
uri = parse(serialize(uri, options), options);
|
|
6156
|
+
}
|
|
6157
|
+
return uri;
|
|
6158
|
+
}
|
|
5695
6159
|
|
|
5696
|
-
function
|
|
5697
|
-
|
|
5698
|
-
|
|
5699
|
-
|
|
5700
|
-
|
|
5701
|
-
return true
|
|
6160
|
+
function equal(uriA, uriB, options) {
|
|
6161
|
+
if (typeof uriA === "string") {
|
|
6162
|
+
uriA = serialize(parse(uriA, options), options);
|
|
6163
|
+
} else if (typeOf(uriA) === "object") {
|
|
6164
|
+
uriA = serialize(uriA, options);
|
|
5702
6165
|
}
|
|
5703
|
-
|
|
5704
|
-
|
|
6166
|
+
if (typeof uriB === "string") {
|
|
6167
|
+
uriB = serialize(parse(uriB, options), options);
|
|
6168
|
+
} else if (typeOf(uriB) === "object") {
|
|
6169
|
+
uriB = serialize(uriB, options);
|
|
6170
|
+
}
|
|
6171
|
+
return uriA === uriB;
|
|
5705
6172
|
}
|
|
5706
6173
|
|
|
5707
|
-
|
|
6174
|
+
function escapeComponent(str, options) {
|
|
6175
|
+
return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.ESCAPE : IRI_PROTOCOL.ESCAPE, pctEncChar);
|
|
6176
|
+
}
|
|
5708
6177
|
|
|
5709
|
-
function
|
|
5710
|
-
|
|
5711
|
-
|
|
5712
|
-
|
|
5713
|
-
|
|
5714
|
-
|
|
5715
|
-
|
|
5716
|
-
|
|
5717
|
-
|
|
5718
|
-
|
|
5719
|
-
|
|
5720
|
-
|
|
5721
|
-
|
|
5722
|
-
|
|
5723
|
-
|
|
5724
|
-
|
|
5725
|
-
|
|
5726
|
-
|
|
5727
|
-
|
|
5728
|
-
|
|
5729
|
-
|
|
5730
|
-
|
|
5731
|
-
|
|
5732
|
-
|
|
5733
|
-
|
|
5734
|
-
|
|
5735
|
-
|
|
5736
|
-
|
|
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';
|
|
6178
|
+
function unescapeComponent(str, options) {
|
|
6179
|
+
return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.PCT_ENCODED : IRI_PROTOCOL.PCT_ENCODED, pctDecChars);
|
|
6180
|
+
}
|
|
6181
|
+
|
|
6182
|
+
var handler = {
|
|
6183
|
+
scheme: "http",
|
|
6184
|
+
domainHost: true,
|
|
6185
|
+
parse: function parse(components, options) {
|
|
6186
|
+
//report missing host
|
|
6187
|
+
if (!components.host) {
|
|
6188
|
+
components.error = components.error || "HTTP URIs must have a host.";
|
|
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;
|
|
5759
6206
|
}
|
|
6207
|
+
};
|
|
6208
|
+
|
|
6209
|
+
var handler$1 = {
|
|
6210
|
+
scheme: "https",
|
|
6211
|
+
domainHost: handler.domainHost,
|
|
6212
|
+
parse: handler.parse,
|
|
6213
|
+
serialize: handler.serialize
|
|
6214
|
+
};
|
|
5760
6215
|
|
|
5761
|
-
|
|
5762
|
-
|
|
5763
|
-
|
|
6216
|
+
function isSecure(wsComponents) {
|
|
6217
|
+
return typeof wsComponents.secure === 'boolean' ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === "wss";
|
|
6218
|
+
}
|
|
6219
|
+
//RFC 6455
|
|
6220
|
+
var handler$2 = {
|
|
6221
|
+
scheme: "ws",
|
|
6222
|
+
domainHost: true,
|
|
6223
|
+
parse: function parse(components, options) {
|
|
6224
|
+
var wsComponents = components;
|
|
6225
|
+
//indicate if the secure flag is set
|
|
6226
|
+
wsComponents.secure = isSecure(wsComponents);
|
|
6227
|
+
//construct resouce name
|
|
6228
|
+
wsComponents.resourceName = (wsComponents.path || '/') + (wsComponents.query ? '?' + wsComponents.query : '');
|
|
6229
|
+
wsComponents.path = undefined;
|
|
6230
|
+
wsComponents.query = undefined;
|
|
6231
|
+
return wsComponents;
|
|
6232
|
+
},
|
|
6233
|
+
serialize: function serialize(wsComponents, options) {
|
|
6234
|
+
//normalize the default port
|
|
6235
|
+
if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === "") {
|
|
6236
|
+
wsComponents.port = undefined;
|
|
6237
|
+
}
|
|
6238
|
+
//ensure scheme matches secure flag
|
|
6239
|
+
if (typeof wsComponents.secure === 'boolean') {
|
|
6240
|
+
wsComponents.scheme = wsComponents.secure ? 'wss' : 'ws';
|
|
6241
|
+
wsComponents.secure = undefined;
|
|
6242
|
+
}
|
|
6243
|
+
//reconstruct path from resource name
|
|
6244
|
+
if (wsComponents.resourceName) {
|
|
6245
|
+
var _wsComponents$resourc = wsComponents.resourceName.split('?'),
|
|
6246
|
+
_wsComponents$resourc2 = slicedToArray(_wsComponents$resourc, 2),
|
|
6247
|
+
path = _wsComponents$resourc2[0],
|
|
6248
|
+
query = _wsComponents$resourc2[1];
|
|
6249
|
+
|
|
6250
|
+
wsComponents.path = path && path !== '/' ? path : undefined;
|
|
6251
|
+
wsComponents.query = query;
|
|
6252
|
+
wsComponents.resourceName = undefined;
|
|
6253
|
+
}
|
|
6254
|
+
//forbid fragment component
|
|
6255
|
+
wsComponents.fragment = undefined;
|
|
6256
|
+
return wsComponents;
|
|
5764
6257
|
}
|
|
6258
|
+
};
|
|
5765
6259
|
|
|
5766
|
-
|
|
5767
|
-
|
|
6260
|
+
var handler$3 = {
|
|
6261
|
+
scheme: "wss",
|
|
6262
|
+
domainHost: handler$2.domainHost,
|
|
6263
|
+
parse: handler$2.parse,
|
|
6264
|
+
serialize: handler$2.serialize
|
|
6265
|
+
};
|
|
5768
6266
|
|
|
5769
|
-
|
|
5770
|
-
|
|
5771
|
-
|
|
5772
|
-
|
|
5773
|
-
|
|
5774
|
-
|
|
5775
|
-
|
|
5776
|
-
|
|
5777
|
-
|
|
6267
|
+
var O = {};
|
|
6268
|
+
//RFC 3986
|
|
6269
|
+
var UNRESERVED$$ = "[A-Za-z0-9\\-\\.\\_\\~" + ("\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF" ) + "]";
|
|
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("@");
|
|
5778
6344
|
}
|
|
5779
|
-
|
|
5780
|
-
|
|
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;
|
|
5781
6379
|
}
|
|
6380
|
+
};
|
|
5782
6381
|
|
|
5783
|
-
|
|
5784
|
-
|
|
5785
|
-
|
|
5786
|
-
|
|
5787
|
-
|
|
5788
|
-
|
|
5789
|
-
|
|
5790
|
-
|
|
5791
|
-
|
|
5792
|
-
|
|
5793
|
-
|
|
5794
|
-
|
|
5795
|
-
|
|
6382
|
+
var URN_PARSE = /^([^\:]+)\:(.*)/;
|
|
6383
|
+
//RFC 2141
|
|
6384
|
+
var handler$5 = {
|
|
6385
|
+
scheme: "urn",
|
|
6386
|
+
parse: function parse$$1(components, options) {
|
|
6387
|
+
var matches = components.path && components.path.match(URN_PARSE);
|
|
6388
|
+
var urnComponents = components;
|
|
6389
|
+
if (matches) {
|
|
6390
|
+
var scheme = options.scheme || urnComponents.scheme || "urn";
|
|
6391
|
+
var nid = matches[1].toLowerCase();
|
|
6392
|
+
var nss = matches[2];
|
|
6393
|
+
var urnScheme = scheme + ":" + (options.nid || nid);
|
|
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.";
|
|
6403
|
+
}
|
|
6404
|
+
return urnComponents;
|
|
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;
|
|
5796
6418
|
}
|
|
6419
|
+
};
|
|
5797
6420
|
|
|
5798
|
-
|
|
5799
|
-
|
|
5800
|
-
|
|
6421
|
+
var UUID = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/;
|
|
6422
|
+
//RFC 4122
|
|
6423
|
+
var handler$6 = {
|
|
6424
|
+
scheme: "urn:uuid",
|
|
6425
|
+
parse: function parse(urnComponents, options) {
|
|
6426
|
+
var uuidComponents = urnComponents;
|
|
6427
|
+
uuidComponents.uuid = uuidComponents.nss;
|
|
6428
|
+
uuidComponents.nss = undefined;
|
|
6429
|
+
if (!options.tolerant && (!uuidComponents.uuid || !uuidComponents.uuid.match(UUID))) {
|
|
6430
|
+
uuidComponents.error = uuidComponents.error || "UUID is not valid.";
|
|
6431
|
+
}
|
|
6432
|
+
return uuidComponents;
|
|
6433
|
+
},
|
|
6434
|
+
serialize: function serialize(uuidComponents, options) {
|
|
6435
|
+
var urnComponents = uuidComponents;
|
|
6436
|
+
//normalize UUID
|
|
6437
|
+
urnComponents.nss = (uuidComponents.uuid || "").toLowerCase();
|
|
6438
|
+
return urnComponents;
|
|
5801
6439
|
}
|
|
5802
|
-
} else {
|
|
5803
|
-
parsed.error = parsed.error || 'URI can not be parsed.';
|
|
5804
|
-
}
|
|
5805
|
-
return parsed
|
|
5806
|
-
}
|
|
5807
|
-
|
|
5808
|
-
const fastUri = {
|
|
5809
|
-
SCHEMES,
|
|
5810
|
-
normalize,
|
|
5811
|
-
resolve,
|
|
5812
|
-
resolveComponents,
|
|
5813
|
-
equal: equal$2,
|
|
5814
|
-
serialize,
|
|
5815
|
-
parse
|
|
5816
6440
|
};
|
|
5817
6441
|
|
|
5818
|
-
|
|
5819
|
-
|
|
5820
|
-
|
|
6442
|
+
SCHEMES[handler.scheme] = handler;
|
|
6443
|
+
SCHEMES[handler$1.scheme] = handler$1;
|
|
6444
|
+
SCHEMES[handler$2.scheme] = handler$2;
|
|
6445
|
+
SCHEMES[handler$3.scheme] = handler$3;
|
|
6446
|
+
SCHEMES[handler$4.scheme] = handler$4;
|
|
6447
|
+
SCHEMES[handler$5.scheme] = handler$5;
|
|
6448
|
+
SCHEMES[handler$6.scheme] = handler$6;
|
|
6449
|
+
|
|
6450
|
+
exports.SCHEMES = SCHEMES;
|
|
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 });
|
|
6464
|
+
|
|
6465
|
+
})));
|
|
6466
|
+
|
|
6467
|
+
}(uri_all, uri_all.exports));
|
|
5821
6468
|
|
|
5822
6469
|
Object.defineProperty(uri$1, "__esModule", { value: true });
|
|
5823
|
-
const uri =
|
|
6470
|
+
const uri = uri_all.exports;
|
|
5824
6471
|
uri.code = 'require("ajv/dist/runtime/uri").default';
|
|
5825
6472
|
uri$1.default = uri;
|
|
5826
6473
|
|
|
@@ -5841,7 +6488,7 @@
|
|
|
5841
6488
|
const rules_1 = rules;
|
|
5842
6489
|
const compile_1 = compile;
|
|
5843
6490
|
const codegen_2 = codegen;
|
|
5844
|
-
const resolve_1 = resolve$
|
|
6491
|
+
const resolve_1 = resolve$1;
|
|
5845
6492
|
const dataType_1 = dataType;
|
|
5846
6493
|
const util_1 = util;
|
|
5847
6494
|
const $dataRefSchema = require$$9;
|
|
@@ -8957,7 +9604,7 @@
|
|
|
8957
9604
|
message = _theRule.message;
|
|
8958
9605
|
var valid = true;
|
|
8959
9606
|
if (isExpression(validator)) {
|
|
8960
|
-
valid =
|
|
9607
|
+
valid = executeExpression(validator, instance);
|
|
8961
9608
|
} else if (typeof validator === 'function') {
|
|
8962
9609
|
valid = validator(instance);
|
|
8963
9610
|
// eslint-disable-next-line no-eval
|
|
@@ -9121,7 +9768,7 @@
|
|
|
9121
9768
|
};
|
|
9122
9769
|
// 校验schema是否正常
|
|
9123
9770
|
var validateSchema = /*#__PURE__*/function () {
|
|
9124
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(schema) {
|
|
9771
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(schema) {
|
|
9125
9772
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
9126
9773
|
while (1) switch (_context.prev = _context.next) {
|
|
9127
9774
|
case 0:
|
|
@@ -9346,7 +9993,7 @@
|
|
|
9346
9993
|
},
|
|
9347
9994
|
loadDataSource: function loadDataSource() {
|
|
9348
9995
|
var _this3 = this;
|
|
9349
|
-
return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
9996
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
9350
9997
|
var _this3$widgetSchema, _this3$widgetSchema$u, _this3$widgetSchema$u2;
|
|
9351
9998
|
var xhrConfig, url, params, reset, _this3$httpAdapter, _this3$httpAdapter$re, http, responseParse, remoteURL, requestParams;
|
|
9352
9999
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
@@ -9361,8 +10008,8 @@
|
|
|
9361
10008
|
_this3$httpAdapter = _this3.httpAdapter, _this3$httpAdapter$re = _this3$httpAdapter.request, http = _this3$httpAdapter$re === void 0 ? request : _this3$httpAdapter$re, responseParse = _this3$httpAdapter.responseParse;
|
|
9362
10009
|
_context.prev = 4;
|
|
9363
10010
|
_this3.loading = true;
|
|
9364
|
-
remoteURL =
|
|
9365
|
-
requestParams = isObj(params) ?
|
|
10011
|
+
remoteURL = executeExpression(url, _this3);
|
|
10012
|
+
requestParams = isObj(params) ? executeExpression(params, _this3) : params;
|
|
9366
10013
|
_context.next = 10;
|
|
9367
10014
|
return http(remoteURL, _objectSpread2(_objectSpread2({}, reset), {}, {
|
|
9368
10015
|
params: requestParams,
|
|
@@ -10543,17 +11190,17 @@
|
|
|
10543
11190
|
}
|
|
10544
11191
|
};
|
|
10545
11192
|
},
|
|
10546
|
-
|
|
10547
|
-
|
|
10548
|
-
|
|
10549
|
-
},
|
|
11193
|
+
// created() {
|
|
11194
|
+
// // 注册widget TreeNode
|
|
11195
|
+
// this.widgetTree.addWidgetNode(this.path, this, 'group');
|
|
11196
|
+
// },
|
|
10550
11197
|
mounted: function mounted() {
|
|
10551
11198
|
// 更新样式
|
|
10552
11199
|
this.$forceUpdate();
|
|
10553
11200
|
},
|
|
10554
|
-
|
|
10555
|
-
|
|
10556
|
-
},
|
|
11201
|
+
// beforeDestroy() {
|
|
11202
|
+
// this.widgetTree.removeWidgetNode(this.path, this);
|
|
11203
|
+
// },
|
|
10557
11204
|
methods: {
|
|
10558
11205
|
setState: function setState(key, value) {
|
|
10559
11206
|
if (Reflect.has(this.state, key)) {
|
|
@@ -11059,7 +11706,7 @@
|
|
|
11059
11706
|
options.fileObj.xhr = xhr;
|
|
11060
11707
|
var formData = new FormData();
|
|
11061
11708
|
options.data.forEach(function (item) {
|
|
11062
|
-
formData.append(item.name,
|
|
11709
|
+
formData.append(item.name, executeExpression(item.value, _this.$parent.$parent));
|
|
11063
11710
|
});
|
|
11064
11711
|
formData.append(options.fileName, options.fileObj.origin);
|
|
11065
11712
|
xhr.onreadystatechange = function () {
|
|
@@ -11082,12 +11729,12 @@
|
|
|
11082
11729
|
if (Array.isArray(options.header)) {
|
|
11083
11730
|
options.header.forEach(function (head) {
|
|
11084
11731
|
var headerKey = head.name;
|
|
11085
|
-
var headerVal =
|
|
11732
|
+
var headerVal = executeExpression(head.value, _this.$parent.$parent);
|
|
11086
11733
|
xhr.setRequestHeader(headerKey, headerVal);
|
|
11087
11734
|
});
|
|
11088
11735
|
} else {
|
|
11089
11736
|
var headerKey = options.header.name;
|
|
11090
|
-
var headerVal =
|
|
11737
|
+
var headerVal = executeExpression(options.header.value, this.$parent.$parent);
|
|
11091
11738
|
xhr.setRequestHeader(headerKey, headerVal);
|
|
11092
11739
|
}
|
|
11093
11740
|
}
|
|
@@ -11111,13 +11758,13 @@
|
|
|
11111
11758
|
handleResCode: function handleResCode(res) {
|
|
11112
11759
|
var successed = true;
|
|
11113
11760
|
if (this.isUploadSuccessed) {
|
|
11114
|
-
successed =
|
|
11761
|
+
successed = executeExpression(this.isUploadSuccessed, this.$parent.$parent, [], {
|
|
11115
11762
|
response: res
|
|
11116
11763
|
});
|
|
11117
11764
|
}
|
|
11118
11765
|
if (!successed) return;
|
|
11119
11766
|
if (this.responseHandler) {
|
|
11120
|
-
var files =
|
|
11767
|
+
var files = executeExpression(this.responseHandler, this.$parent.$parent, [], {
|
|
11121
11768
|
response: res
|
|
11122
11769
|
});
|
|
11123
11770
|
this.$emit('input', files);
|
|
@@ -11455,7 +12102,7 @@
|
|
|
11455
12102
|
},
|
|
11456
12103
|
methods: {
|
|
11457
12104
|
initFormData: function initFormData() {
|
|
11458
|
-
this.rootData =
|
|
12105
|
+
this.rootData = merge(Schema.getSchemaDefaultValue(createProxy(this.schema, this)) || {}, this.value);
|
|
11459
12106
|
this.emitFormValueChange(this.rootData, this.value);
|
|
11460
12107
|
},
|
|
11461
12108
|
emitFormValueChange: function emitFormValueChange(newValue, oldValue) {
|