@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.
@@ -182,7 +182,7 @@ function _objectWithoutProperties(e, t) {
182
182
  i = _objectWithoutPropertiesLoose(e, t);
183
183
  if (Object.getOwnPropertySymbols) {
184
184
  var n = Object.getOwnPropertySymbols(e);
185
- for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
185
+ for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
186
186
  }
187
187
  return i;
188
188
  }
@@ -190,7 +190,7 @@ function _objectWithoutPropertiesLoose(r, e) {
190
190
  if (null == r) return {};
191
191
  var t = {};
192
192
  for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
193
- if (-1 !== e.indexOf(n)) continue;
193
+ if (e.indexOf(n) >= 0) continue;
194
194
  t[n] = r[n];
195
195
  }
196
196
  return t;
@@ -584,11 +584,11 @@ var valueType = function valueType(value) {
584
584
  }
585
585
  return _typeof(value);
586
586
  };
587
- var _merge = function merge(target, source) {
587
+ var merge = function merge(target, source) {
588
588
  if (isObj(source)) {
589
589
  return Object.keys(source).reduce(function (pre, key) {
590
590
  var _target;
591
- pre[key] = _merge(((_target = target) === null || _target === void 0 ? void 0 : _target[key]) || {}, source[key]);
591
+ pre[key] = merge(((_target = target) === null || _target === void 0 ? void 0 : _target[key]) || {}, source[key]);
592
592
  return pre;
593
593
  }, JSON.parse(JSON.stringify(target)));
594
594
  }
@@ -596,7 +596,7 @@ var _merge = function merge(target, source) {
596
596
  target = Array.isArray(target) ? target : [];
597
597
  return source.map(function (item, index) {
598
598
  if (target[index]) {
599
- return _merge(target[index], item);
599
+ return merge(target[index], item);
600
600
  }
601
601
  return item;
602
602
  });
@@ -1367,8 +1367,8 @@ var defaultConfig = {
1367
1367
  headers: {},
1368
1368
  cache: 'no-cache'
1369
1369
  };
1370
- var request = (/*#__PURE__*/function () {
1371
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(url) {
1370
+ var request = ( /*#__PURE__*/(function () {
1371
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(url) {
1372
1372
  var config,
1373
1373
  _mergeDeep,
1374
1374
  params,
@@ -1477,7 +1477,7 @@ var request = (/*#__PURE__*/function () {
1477
1477
  return function (_x) {
1478
1478
  return _ref.apply(this, arguments);
1479
1479
  };
1480
- }());
1480
+ })());
1481
1481
 
1482
1482
  var props$1 = {
1483
1483
  // 表单值
@@ -1714,7 +1714,7 @@ var getContext = function getContext(instance) {
1714
1714
  }
1715
1715
  };
1716
1716
  };
1717
- var _executeExpression = function executeExpression(expression, instance) {
1717
+ var executeExpression = function executeExpression(expression, instance) {
1718
1718
  var $dep = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
1719
1719
  var $args = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1720
1720
  var _getContext = getContext(instance),
@@ -1772,7 +1772,7 @@ var _executeExpression = function executeExpression(expression, instance) {
1772
1772
  }
1773
1773
  if (isObj(expression)) {
1774
1774
  Object.keys(expression).forEach(function (key) {
1775
- expression[key] = _executeExpression(expression[key], instance);
1775
+ expression[key] = executeExpression(expression[key], instance);
1776
1776
  });
1777
1777
  return expression;
1778
1778
  }
@@ -1829,7 +1829,7 @@ var resolveReaction = function resolveReaction(crtInsPath, targetPath, reaction,
1829
1829
  });
1830
1830
  }
1831
1831
  if (typeof reaction.if === 'string') {
1832
- fullfill = _executeExpression(reaction.if, crtInstance, deps);
1832
+ fullfill = executeExpression(reaction.if, crtInstance, deps);
1833
1833
  }
1834
1834
  var operations = fullfill ? reaction.then : reaction.else;
1835
1835
  executeOperations(operations, operateInstance, deps);
@@ -1841,20 +1841,20 @@ var executeOperations = function executeOperations(operations, instance, deps) {
1841
1841
  Object.keys(operations.state).forEach(function (key) {
1842
1842
  var val = operations.state[key];
1843
1843
  if (typeof val === 'string' && /^{{.+}}$/.test(val.trim())) {
1844
- val = _executeExpression(val, instance, deps);
1844
+ val = executeExpression(val, instance, deps);
1845
1845
  }
1846
1846
  instance.setState(key, val);
1847
1847
  });
1848
1848
  }
1849
1849
  if (Array.isArray(operations.actions)) {
1850
1850
  operations.actions.forEach(function (item) {
1851
- _executeExpression(item, instance, deps);
1851
+ executeExpression(item, instance, deps);
1852
1852
  });
1853
1853
  }
1854
1854
  }
1855
1855
  };
1856
1856
  var parsePath = function parsePath(path, instance) {
1857
- return isExpression(path) ? _executeExpression(path, instance) : path;
1857
+ return isExpression(path) ? executeExpression(path, instance) : path;
1858
1858
  };
1859
1859
  var reactionRegister = function reactionRegister(path) {
1860
1860
  var reactions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
@@ -1907,6 +1907,8 @@ var reactionDispatch = function reactionDispatch(path, typeName) {
1907
1907
  }
1908
1908
  };
1909
1909
 
1910
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
1911
+
1910
1912
  function getDefaultExportFromCjs (x) {
1911
1913
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
1912
1914
  }
@@ -1928,7 +1930,6 @@ var code$1 = {};
1928
1930
  (function (exports) {
1929
1931
  Object.defineProperty(exports, "__esModule", { value: true });
1930
1932
  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;
1931
- // eslint-disable-next-line @typescript-eslint/no-extraneous-class
1932
1933
  class _CodeOrName {
1933
1934
  }
1934
1935
  exports._CodeOrName = _CodeOrName;
@@ -3937,7 +3938,7 @@ function extendSubschemaMode(subschema, { jtdDiscriminator, jtdMetadata, composi
3937
3938
  }
3938
3939
  subschema.extendSubschemaMode = extendSubschemaMode;
3939
3940
 
3940
- var resolve$2 = {};
3941
+ var resolve$1 = {};
3941
3942
 
3942
3943
  // do not edit .js files directly - edit src/index.jst
3943
3944
 
@@ -4078,10 +4079,10 @@ function escapeJsonPtr(str) {
4078
4079
  return str.replace(/~/g, '~0').replace(/\//g, '~1');
4079
4080
  }
4080
4081
 
4081
- Object.defineProperty(resolve$2, "__esModule", { value: true });
4082
- resolve$2.getSchemaRefs = resolve$2.resolveUrl = resolve$2.normalizeId = resolve$2._getFullPath = resolve$2.getFullPath = resolve$2.inlineRef = void 0;
4082
+ Object.defineProperty(resolve$1, "__esModule", { value: true });
4083
+ resolve$1.getSchemaRefs = resolve$1.resolveUrl = resolve$1.normalizeId = resolve$1._getFullPath = resolve$1.getFullPath = resolve$1.inlineRef = void 0;
4083
4084
  const util_1$m = util;
4084
- const equal$3 = fastDeepEqual;
4085
+ const equal$2 = fastDeepEqual;
4085
4086
  const traverse = jsonSchemaTraverse.exports;
4086
4087
  // TODO refactor to use keyword definitions
4087
4088
  const SIMPLE_INLINED = new Set([
@@ -4111,7 +4112,7 @@ function inlineRef(schema, limit = true) {
4111
4112
  return false;
4112
4113
  return countKeys(schema) <= limit;
4113
4114
  }
4114
- resolve$2.inlineRef = inlineRef;
4115
+ resolve$1.inlineRef = inlineRef;
4115
4116
  const REF_KEYWORDS = new Set([
4116
4117
  "$ref",
4117
4118
  "$recursiveRef",
@@ -4153,22 +4154,22 @@ function getFullPath(resolver, id = "", normalize) {
4153
4154
  const p = resolver.parse(id);
4154
4155
  return _getFullPath(resolver, p);
4155
4156
  }
4156
- resolve$2.getFullPath = getFullPath;
4157
+ resolve$1.getFullPath = getFullPath;
4157
4158
  function _getFullPath(resolver, p) {
4158
4159
  const serialized = resolver.serialize(p);
4159
4160
  return serialized.split("#")[0] + "#";
4160
4161
  }
4161
- resolve$2._getFullPath = _getFullPath;
4162
+ resolve$1._getFullPath = _getFullPath;
4162
4163
  const TRAILING_SLASH_HASH = /#\/?$/;
4163
4164
  function normalizeId(id) {
4164
4165
  return id ? id.replace(TRAILING_SLASH_HASH, "") : "";
4165
4166
  }
4166
- resolve$2.normalizeId = normalizeId;
4167
+ resolve$1.normalizeId = normalizeId;
4167
4168
  function resolveUrl(resolver, baseId, id) {
4168
4169
  id = normalizeId(id);
4169
4170
  return resolver.resolve(baseId, id);
4170
4171
  }
4171
- resolve$2.resolveUrl = resolveUrl;
4172
+ resolve$1.resolveUrl = resolveUrl;
4172
4173
  const ANCHOR = /^[a-z_][-a-z0-9._]*$/i;
4173
4174
  function getSchemaRefs(schema, baseId) {
4174
4175
  if (typeof schema == "boolean")
@@ -4223,14 +4224,14 @@ function getSchemaRefs(schema, baseId) {
4223
4224
  });
4224
4225
  return localRefs;
4225
4226
  function checkAmbiguosRef(sch1, sch2, ref) {
4226
- if (sch2 !== undefined && !equal$3(sch1, sch2))
4227
+ if (sch2 !== undefined && !equal$2(sch1, sch2))
4227
4228
  throw ambiguos(ref);
4228
4229
  }
4229
4230
  function ambiguos(ref) {
4230
4231
  return new Error(`reference "${ref}" resolves to more than one schema`);
4231
4232
  }
4232
4233
  }
4233
- resolve$2.getSchemaRefs = getSchemaRefs;
4234
+ resolve$1.getSchemaRefs = getSchemaRefs;
4234
4235
 
4235
4236
  Object.defineProperty(validate$1, "__esModule", { value: true });
4236
4237
  validate$1.getData = validate$1.KeywordCxt = validate$1.validateFunctionCode = void 0;
@@ -4243,7 +4244,7 @@ const keyword_1 = keyword;
4243
4244
  const subschema_1 = subschema;
4244
4245
  const codegen_1$n = codegen;
4245
4246
  const names_1$3 = names$1;
4246
- const resolve_1$2 = resolve$2;
4247
+ const resolve_1$2 = resolve$1;
4247
4248
  const util_1$l = util;
4248
4249
  const errors_1 = errors;
4249
4250
  // schema compilation - generates validation function, subschemaCode (below) is used for subschemas
@@ -4765,7 +4766,7 @@ validation_error.default = ValidationError;
4765
4766
  var ref_error = {};
4766
4767
 
4767
4768
  Object.defineProperty(ref_error, "__esModule", { value: true });
4768
- const resolve_1$1 = resolve$2;
4769
+ const resolve_1$1 = resolve$1;
4769
4770
  class MissingRefError extends Error {
4770
4771
  constructor(resolver, baseId, ref, msg) {
4771
4772
  super(msg || `can't resolve reference ${ref} from id ${baseId}`);
@@ -4782,7 +4783,7 @@ compile.resolveSchema = compile.getCompilingSchema = compile.resolveRef = compil
4782
4783
  const codegen_1$m = codegen;
4783
4784
  const validation_error_1 = validation_error;
4784
4785
  const names_1$2 = names$1;
4785
- const resolve_1 = resolve$2;
4786
+ const resolve_1 = resolve$1;
4786
4787
  const util_1$k = util;
4787
4788
  const validate_1$1 = validate$1;
4788
4789
  class SchemaEnv {
@@ -4908,7 +4909,7 @@ function resolveRef(root, baseId, ref) {
4908
4909
  const schOrFunc = root.refs[ref];
4909
4910
  if (schOrFunc)
4910
4911
  return schOrFunc;
4911
- let _sch = resolve$1.call(this, root, ref);
4912
+ let _sch = resolve.call(this, root, ref);
4912
4913
  if (_sch === undefined) {
4913
4914
  const schema = (_a = root.localRefs) === null || _a === void 0 ? void 0 : _a[ref]; // TODO maybe localRefs should hold SchemaEnv
4914
4915
  const { schemaId } = this.opts;
@@ -4938,7 +4939,7 @@ function sameSchemaEnv(s1, s2) {
4938
4939
  }
4939
4940
  // resolve and compile the references ($ref)
4940
4941
  // TODO returns AnySchemaObject (if the schema can be inlined) or validation function
4941
- function resolve$1(root, // information about the root schema for the current schema
4942
+ function resolve(root, // information about the root schema for the current schema
4942
4943
  ref // reference to resolve
4943
4944
  ) {
4944
4945
  let sch;
@@ -5049,770 +5050,1416 @@ var require$$9 = {
5049
5050
 
5050
5051
  var uri$1 = {};
5051
5052
 
5052
- var fastUri$1 = {exports: {}};
5053
-
5054
- const HEX$1 = {
5055
- 0: 0,
5056
- 1: 1,
5057
- 2: 2,
5058
- 3: 3,
5059
- 4: 4,
5060
- 5: 5,
5061
- 6: 6,
5062
- 7: 7,
5063
- 8: 8,
5064
- 9: 9,
5065
- a: 10,
5066
- A: 10,
5067
- b: 11,
5068
- B: 11,
5069
- c: 12,
5070
- C: 12,
5071
- d: 13,
5072
- D: 13,
5073
- e: 14,
5074
- E: 14,
5075
- f: 15,
5076
- F: 15
5077
- };
5078
-
5079
- var scopedChars = {
5080
- HEX: HEX$1
5081
- };
5082
-
5083
- const { HEX } = scopedChars;
5084
-
5085
- const IPV4_REG = /^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u;
5086
-
5087
- function normalizeIPv4$1 (host) {
5088
- if (findToken(host, '.') < 3) { return { host, isIPV4: false } }
5089
- const matches = host.match(IPV4_REG) || [];
5090
- const [address] = matches;
5091
- if (address) {
5092
- return { host: stripLeadingZeros(address, '.'), isIPV4: true }
5093
- } else {
5094
- return { host, isIPV4: false }
5095
- }
5053
+ var uri_all = {exports: {}};
5054
+
5055
+ /** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */
5056
+
5057
+ (function (module, exports) {
5058
+ (function (global, factory) {
5059
+ factory(exports) ;
5060
+ }(commonjsGlobal, (function (exports) {
5061
+ function merge() {
5062
+ for (var _len = arguments.length, sets = Array(_len), _key = 0; _key < _len; _key++) {
5063
+ sets[_key] = arguments[_key];
5064
+ }
5065
+
5066
+ if (sets.length > 1) {
5067
+ sets[0] = sets[0].slice(0, -1);
5068
+ var xl = sets.length - 1;
5069
+ for (var x = 1; x < xl; ++x) {
5070
+ sets[x] = sets[x].slice(1, -1);
5071
+ }
5072
+ sets[xl] = sets[xl].slice(1);
5073
+ return sets.join('');
5074
+ } else {
5075
+ return sets[0];
5076
+ }
5077
+ }
5078
+ function subexp(str) {
5079
+ return "(?:" + str + ")";
5080
+ }
5081
+ function typeOf(o) {
5082
+ return o === undefined ? "undefined" : o === null ? "null" : Object.prototype.toString.call(o).split(" ").pop().split("]").shift().toLowerCase();
5083
+ }
5084
+ function toUpperCase(str) {
5085
+ return str.toUpperCase();
5086
+ }
5087
+ function toArray(obj) {
5088
+ 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) : [];
5089
+ }
5090
+ function assign(target, source) {
5091
+ var obj = target;
5092
+ if (source) {
5093
+ for (var key in source) {
5094
+ obj[key] = source[key];
5095
+ }
5096
+ }
5097
+ return obj;
5098
+ }
5099
+
5100
+ function buildExps(isIRI) {
5101
+ var ALPHA$$ = "[A-Za-z]",
5102
+ DIGIT$$ = "[0-9]",
5103
+ HEXDIG$$ = merge(DIGIT$$, "[A-Fa-f]"),
5104
+ PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)),
5105
+ //expanded
5106
+ GEN_DELIMS$$ = "[\\:\\/\\?\\#\\[\\]\\@]",
5107
+ SUB_DELIMS$$ = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",
5108
+ RESERVED$$ = merge(GEN_DELIMS$$, SUB_DELIMS$$),
5109
+ UCSCHAR$$ = isIRI ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]",
5110
+ //subset, excludes bidi control characters
5111
+ IPRIVATE$$ = isIRI ? "[\\uE000-\\uF8FF]" : "[]",
5112
+ //subset
5113
+ UNRESERVED$$ = merge(ALPHA$$, DIGIT$$, "[\\-\\.\\_\\~]", UCSCHAR$$);
5114
+ subexp(ALPHA$$ + merge(ALPHA$$, DIGIT$$, "[\\+\\-\\.]") + "*");
5115
+ subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]")) + "*");
5116
+ 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$$),
5117
+ //relaxed parsing rules
5118
+ IPV4ADDRESS$ = subexp(DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$),
5119
+ H16$ = subexp(HEXDIG$$ + "{1,4}"),
5120
+ LS32$ = subexp(subexp(H16$ + "\\:" + H16$) + "|" + IPV4ADDRESS$),
5121
+ IPV6ADDRESS1$ = subexp(subexp(H16$ + "\\:") + "{6}" + LS32$),
5122
+ // 6( h16 ":" ) ls32
5123
+ IPV6ADDRESS2$ = subexp("\\:\\:" + subexp(H16$ + "\\:") + "{5}" + LS32$),
5124
+ // "::" 5( h16 ":" ) ls32
5125
+ IPV6ADDRESS3$ = subexp(subexp(H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{4}" + LS32$),
5126
+ //[ h16 ] "::" 4( h16 ":" ) ls32
5127
+ IPV6ADDRESS4$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,1}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{3}" + LS32$),
5128
+ //[ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
5129
+ IPV6ADDRESS5$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,2}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{2}" + LS32$),
5130
+ //[ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
5131
+ IPV6ADDRESS6$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,3}" + H16$) + "?\\:\\:" + H16$ + "\\:" + LS32$),
5132
+ //[ *3( h16 ":" ) h16 ] "::" h16 ":" ls32
5133
+ IPV6ADDRESS7$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,4}" + H16$) + "?\\:\\:" + LS32$),
5134
+ //[ *4( h16 ":" ) h16 ] "::" ls32
5135
+ IPV6ADDRESS8$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,5}" + H16$) + "?\\:\\:" + H16$),
5136
+ //[ *5( h16 ":" ) h16 ] "::" h16
5137
+ IPV6ADDRESS9$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,6}" + H16$) + "?\\:\\:"),
5138
+ //[ *6( h16 ":" ) h16 ] "::"
5139
+ IPV6ADDRESS$ = subexp([IPV6ADDRESS1$, IPV6ADDRESS2$, IPV6ADDRESS3$, IPV6ADDRESS4$, IPV6ADDRESS5$, IPV6ADDRESS6$, IPV6ADDRESS7$, IPV6ADDRESS8$, IPV6ADDRESS9$].join("|")),
5140
+ ZONEID$ = subexp(subexp(UNRESERVED$$ + "|" + PCT_ENCODED$) + "+");
5141
+ //RFC 6874, with relaxed parsing rules
5142
+ subexp("[vV]" + HEXDIG$$ + "+\\." + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]") + "+");
5143
+ //RFC 6874
5144
+ subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$)) + "*");
5145
+ var PCHAR$ = subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@]"));
5146
+ subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\@]")) + "+");
5147
+ subexp(subexp(PCHAR$ + "|" + merge("[\\/\\?]", IPRIVATE$$)) + "*");
5148
+ return {
5149
+ NOT_SCHEME: new RegExp(merge("[^]", ALPHA$$, DIGIT$$, "[\\+\\-\\.]"), "g"),
5150
+ NOT_USERINFO: new RegExp(merge("[^\\%\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"),
5151
+ NOT_HOST: new RegExp(merge("[^\\%\\[\\]\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"),
5152
+ NOT_PATH: new RegExp(merge("[^\\%\\/\\:\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"),
5153
+ NOT_PATH_NOSCHEME: new RegExp(merge("[^\\%\\/\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"),
5154
+ NOT_QUERY: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]", IPRIVATE$$), "g"),
5155
+ NOT_FRAGMENT: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]"), "g"),
5156
+ ESCAPE: new RegExp(merge("[^]", UNRESERVED$$, SUB_DELIMS$$), "g"),
5157
+ UNRESERVED: new RegExp(UNRESERVED$$, "g"),
5158
+ OTHER_CHARS: new RegExp(merge("[^\\%]", UNRESERVED$$, RESERVED$$), "g"),
5159
+ PCT_ENCODED: new RegExp(PCT_ENCODED$, "g"),
5160
+ IPV4ADDRESS: new RegExp("^(" + IPV4ADDRESS$ + ")$"),
5161
+ IPV6ADDRESS: new RegExp("^\\[?(" + IPV6ADDRESS$ + ")" + subexp(subexp("\\%25|\\%(?!" + HEXDIG$$ + "{2})") + "(" + ZONEID$ + ")") + "?\\]?$") //RFC 6874, with relaxed parsing rules
5162
+ };
5096
5163
  }
5164
+ var URI_PROTOCOL = buildExps(false);
5097
5165
 
5098
- /**
5099
- * @param {string[]} input
5100
- * @param {boolean} [keepZero=false]
5101
- * @returns {string|undefined}
5102
- */
5103
- function stringArrayToHexStripped (input, keepZero = false) {
5104
- let acc = '';
5105
- let strip = true;
5106
- for (const c of input) {
5107
- if (HEX[c] === undefined) return undefined
5108
- if (c !== '0' && strip === true) strip = false;
5109
- if (!strip) acc += c;
5110
- }
5111
- if (keepZero && acc.length === 0) acc = '0';
5112
- return acc
5113
- }
5114
-
5115
- function getIPV6 (input) {
5116
- let tokenCount = 0;
5117
- const output = { error: false, address: '', zone: '' };
5118
- const address = [];
5119
- const buffer = [];
5120
- let isZone = false;
5121
- let endipv6Encountered = false;
5122
- let endIpv6 = false;
5123
-
5124
- function consume () {
5125
- if (buffer.length) {
5126
- if (isZone === false) {
5127
- const hex = stringArrayToHexStripped(buffer);
5128
- if (hex !== undefined) {
5129
- address.push(hex);
5130
- } else {
5131
- output.error = true;
5132
- return false
5133
- }
5134
- }
5135
- buffer.length = 0;
5136
- }
5137
- return true
5138
- }
5166
+ var IRI_PROTOCOL = buildExps(true);
5139
5167
 
5140
- for (let i = 0; i < input.length; i++) {
5141
- const cursor = input[i];
5142
- if (cursor === '[' || cursor === ']') { continue }
5143
- if (cursor === ':') {
5144
- if (endipv6Encountered === true) {
5145
- endIpv6 = true;
5146
- }
5147
- if (!consume()) { break }
5148
- tokenCount++;
5149
- address.push(':');
5150
- if (tokenCount > 7) {
5151
- // not valid
5152
- output.error = true;
5153
- break
5168
+ var slicedToArray = function () {
5169
+ function sliceIterator(arr, i) {
5170
+ var _arr = [];
5171
+ var _n = true;
5172
+ var _d = false;
5173
+ var _e = undefined;
5174
+
5175
+ try {
5176
+ for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
5177
+ _arr.push(_s.value);
5178
+
5179
+ if (i && _arr.length === i) break;
5154
5180
  }
5155
- if (i - 1 >= 0 && input[i - 1] === ':') {
5156
- endipv6Encountered = true;
5181
+ } catch (err) {
5182
+ _d = true;
5183
+ _e = err;
5184
+ } finally {
5185
+ try {
5186
+ if (!_n && _i["return"]) _i["return"]();
5187
+ } finally {
5188
+ if (_d) throw _e;
5157
5189
  }
5158
- continue
5159
- } else if (cursor === '%') {
5160
- if (!consume()) { break }
5161
- // switch to zone detection
5162
- isZone = true;
5163
- } else {
5164
- buffer.push(cursor);
5165
- continue
5166
5190
  }
5191
+
5192
+ return _arr;
5167
5193
  }
5168
- if (buffer.length) {
5169
- if (isZone) {
5170
- output.zone = buffer.join('');
5171
- } else if (endIpv6) {
5172
- address.push(buffer.join(''));
5194
+
5195
+ return function (arr, i) {
5196
+ if (Array.isArray(arr)) {
5197
+ return arr;
5198
+ } else if (Symbol.iterator in Object(arr)) {
5199
+ return sliceIterator(arr, i);
5173
5200
  } else {
5174
- address.push(stringArrayToHexStripped(buffer));
5201
+ throw new TypeError("Invalid attempt to destructure non-iterable instance");
5175
5202
  }
5176
- }
5177
- output.address = address.join('');
5178
- return output
5179
- }
5203
+ };
5204
+ }();
5180
5205
 
5181
- function normalizeIPv6$1 (host) {
5182
- if (findToken(host, ':') < 2) { return { host, isIPV6: false } }
5183
- const ipv6 = getIPV6(host);
5184
5206
 
5185
- if (!ipv6.error) {
5186
- let newHost = ipv6.address;
5187
- let escapedHost = ipv6.address;
5188
- if (ipv6.zone) {
5189
- newHost += '%' + ipv6.zone;
5190
- escapedHost += '%25' + ipv6.zone;
5191
- }
5192
- return { host: newHost, escapedHost, isIPV6: true }
5207
+
5208
+
5209
+
5210
+
5211
+
5212
+
5213
+
5214
+
5215
+
5216
+
5217
+
5218
+ var toConsumableArray = function (arr) {
5219
+ if (Array.isArray(arr)) {
5220
+ for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
5221
+
5222
+ return arr2;
5193
5223
  } else {
5194
- return { host, isIPV6: false }
5224
+ return Array.from(arr);
5195
5225
  }
5226
+ };
5227
+
5228
+ /** Highest positive signed 32-bit float value */
5229
+
5230
+ var maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1
5231
+
5232
+ /** Bootstring parameters */
5233
+ var base = 36;
5234
+ var tMin = 1;
5235
+ var tMax = 26;
5236
+ var skew = 38;
5237
+ var damp = 700;
5238
+ var initialBias = 72;
5239
+ var initialN = 128; // 0x80
5240
+ var delimiter = '-'; // '\x2D'
5241
+
5242
+ /** Regular expressions */
5243
+ var regexPunycode = /^xn--/;
5244
+ var regexNonASCII = /[^\0-\x7E]/; // non-ASCII chars
5245
+ var regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g; // RFC 3490 separators
5246
+
5247
+ /** Error messages */
5248
+ var errors = {
5249
+ 'overflow': 'Overflow: input needs wider integers to process',
5250
+ 'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
5251
+ 'invalid-input': 'Invalid input'
5252
+ };
5253
+
5254
+ /** Convenience shortcuts */
5255
+ var baseMinusTMin = base - tMin;
5256
+ var floor = Math.floor;
5257
+ var stringFromCharCode = String.fromCharCode;
5258
+
5259
+ /*--------------------------------------------------------------------------*/
5260
+
5261
+ /**
5262
+ * A generic error utility function.
5263
+ * @private
5264
+ * @param {String} type The error type.
5265
+ * @returns {Error} Throws a `RangeError` with the applicable error message.
5266
+ */
5267
+ function error$1(type) {
5268
+ throw new RangeError(errors[type]);
5196
5269
  }
5197
5270
 
5198
- function stripLeadingZeros (str, token) {
5199
- let out = '';
5200
- let skip = true;
5201
- const l = str.length;
5202
- for (let i = 0; i < l; i++) {
5203
- const c = str[i];
5204
- if (c === '0' && skip) {
5205
- if ((i + 1 <= l && str[i + 1] === token) || i + 1 === l) {
5206
- out += c;
5207
- skip = false;
5208
- }
5209
- } else {
5210
- if (c === token) {
5211
- skip = true;
5212
- } else {
5213
- skip = false;
5214
- }
5215
- out += c;
5216
- }
5217
- }
5218
- return out
5271
+ /**
5272
+ * A generic `Array#map` utility function.
5273
+ * @private
5274
+ * @param {Array} array The array to iterate over.
5275
+ * @param {Function} callback The function that gets called for every array
5276
+ * item.
5277
+ * @returns {Array} A new array of values returned by the callback function.
5278
+ */
5279
+ function map(array, fn) {
5280
+ var result = [];
5281
+ var length = array.length;
5282
+ while (length--) {
5283
+ result[length] = fn(array[length]);
5284
+ }
5285
+ return result;
5219
5286
  }
5220
5287
 
5221
- function findToken (str, token) {
5222
- let ind = 0;
5223
- for (let i = 0; i < str.length; i++) {
5224
- if (str[i] === token) ind++;
5225
- }
5226
- return ind
5227
- }
5228
-
5229
- const RDS1 = /^\.\.?\//u;
5230
- const RDS2 = /^\/\.(?:\/|$)/u;
5231
- const RDS3 = /^\/\.\.(?:\/|$)/u;
5232
- const RDS5 = /^\/?(?:.|\n)*?(?=\/|$)/u;
5233
-
5234
- function removeDotSegments$1 (input) {
5235
- const output = [];
5236
-
5237
- while (input.length) {
5238
- if (input.match(RDS1)) {
5239
- input = input.replace(RDS1, '');
5240
- } else if (input.match(RDS2)) {
5241
- input = input.replace(RDS2, '/');
5242
- } else if (input.match(RDS3)) {
5243
- input = input.replace(RDS3, '/');
5244
- output.pop();
5245
- } else if (input === '.' || input === '..') {
5246
- input = '';
5247
- } else {
5248
- const im = input.match(RDS5);
5249
- if (im) {
5250
- const s = im[0];
5251
- input = input.slice(s.length);
5252
- output.push(s);
5253
- } else {
5254
- throw new Error('Unexpected dot segment condition')
5255
- }
5256
- }
5257
- }
5258
- return output.join('')
5288
+ /**
5289
+ * A simple `Array#map`-like wrapper to work with domain name strings or email
5290
+ * addresses.
5291
+ * @private
5292
+ * @param {String} domain The domain name or email address.
5293
+ * @param {Function} callback The function that gets called for every
5294
+ * character.
5295
+ * @returns {Array} A new string of characters returned by the callback
5296
+ * function.
5297
+ */
5298
+ function mapDomain(string, fn) {
5299
+ var parts = string.split('@');
5300
+ var result = '';
5301
+ if (parts.length > 1) {
5302
+ // In email addresses, only the domain name should be punycoded. Leave
5303
+ // the local part (i.e. everything up to `@`) intact.
5304
+ result = parts[0] + '@';
5305
+ string = parts[1];
5306
+ }
5307
+ // Avoid `split(regex)` for IE8 compatibility. See #17.
5308
+ string = string.replace(regexSeparators, '\x2E');
5309
+ var labels = string.split('.');
5310
+ var encoded = map(labels, fn).join('.');
5311
+ return result + encoded;
5259
5312
  }
5260
5313
 
5261
- function normalizeComponentEncoding$1 (components, esc) {
5262
- const func = esc !== true ? escape : unescape;
5263
- if (components.scheme !== undefined) {
5264
- components.scheme = func(components.scheme);
5265
- }
5266
- if (components.userinfo !== undefined) {
5267
- components.userinfo = func(components.userinfo);
5268
- }
5269
- if (components.host !== undefined) {
5270
- components.host = func(components.host);
5271
- }
5272
- if (components.path !== undefined) {
5273
- components.path = func(components.path);
5274
- }
5275
- if (components.query !== undefined) {
5276
- components.query = func(components.query);
5277
- }
5278
- if (components.fragment !== undefined) {
5279
- components.fragment = func(components.fragment);
5280
- }
5281
- return components
5314
+ /**
5315
+ * Creates an array containing the numeric code points of each Unicode
5316
+ * character in the string. While JavaScript uses UCS-2 internally,
5317
+ * this function will convert a pair of surrogate halves (each of which
5318
+ * UCS-2 exposes as separate characters) into a single code point,
5319
+ * matching UTF-16.
5320
+ * @see `punycode.ucs2.encode`
5321
+ * @see <https://mathiasbynens.be/notes/javascript-encoding>
5322
+ * @memberOf punycode.ucs2
5323
+ * @name decode
5324
+ * @param {String} string The Unicode input string (UCS-2).
5325
+ * @returns {Array} The new array of code points.
5326
+ */
5327
+ function ucs2decode(string) {
5328
+ var output = [];
5329
+ var counter = 0;
5330
+ var length = string.length;
5331
+ while (counter < length) {
5332
+ var value = string.charCodeAt(counter++);
5333
+ if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
5334
+ // It's a high surrogate, and there is a next character.
5335
+ var extra = string.charCodeAt(counter++);
5336
+ if ((extra & 0xFC00) == 0xDC00) {
5337
+ // Low surrogate.
5338
+ output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
5339
+ } else {
5340
+ // It's an unmatched surrogate; only append this code unit, in case the
5341
+ // next code unit is the high surrogate of a surrogate pair.
5342
+ output.push(value);
5343
+ counter--;
5344
+ }
5345
+ } else {
5346
+ output.push(value);
5347
+ }
5348
+ }
5349
+ return output;
5282
5350
  }
5283
5351
 
5284
- function recomposeAuthority$1 (components) {
5285
- const uriTokens = [];
5352
+ /**
5353
+ * Creates a string based on an array of numeric code points.
5354
+ * @see `punycode.ucs2.decode`
5355
+ * @memberOf punycode.ucs2
5356
+ * @name encode
5357
+ * @param {Array} codePoints The array of numeric code points.
5358
+ * @returns {String} The new Unicode string (UCS-2).
5359
+ */
5360
+ var ucs2encode = function ucs2encode(array) {
5361
+ return String.fromCodePoint.apply(String, toConsumableArray(array));
5362
+ };
5286
5363
 
5287
- if (components.userinfo !== undefined) {
5288
- uriTokens.push(components.userinfo);
5289
- uriTokens.push('@');
5290
- }
5364
+ /**
5365
+ * Converts a basic code point into a digit/integer.
5366
+ * @see `digitToBasic()`
5367
+ * @private
5368
+ * @param {Number} codePoint The basic numeric code point value.
5369
+ * @returns {Number} The numeric value of a basic code point (for use in
5370
+ * representing integers) in the range `0` to `base - 1`, or `base` if
5371
+ * the code point does not represent a value.
5372
+ */
5373
+ var basicToDigit = function basicToDigit(codePoint) {
5374
+ if (codePoint - 0x30 < 0x0A) {
5375
+ return codePoint - 0x16;
5376
+ }
5377
+ if (codePoint - 0x41 < 0x1A) {
5378
+ return codePoint - 0x41;
5379
+ }
5380
+ if (codePoint - 0x61 < 0x1A) {
5381
+ return codePoint - 0x61;
5382
+ }
5383
+ return base;
5384
+ };
5291
5385
 
5292
- if (components.host !== undefined) {
5293
- let host = unescape(components.host);
5294
- const ipV4res = normalizeIPv4$1(host);
5386
+ /**
5387
+ * Converts a digit/integer into a basic code point.
5388
+ * @see `basicToDigit()`
5389
+ * @private
5390
+ * @param {Number} digit The numeric value of a basic code point.
5391
+ * @returns {Number} The basic code point whose value (when used for
5392
+ * representing integers) is `digit`, which needs to be in the range
5393
+ * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
5394
+ * used; else, the lowercase form is used. The behavior is undefined
5395
+ * if `flag` is non-zero and `digit` has no uppercase form.
5396
+ */
5397
+ var digitToBasic = function digitToBasic(digit, flag) {
5398
+ // 0..25 map to ASCII a..z or A..Z
5399
+ // 26..35 map to ASCII 0..9
5400
+ return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
5401
+ };
5295
5402
 
5296
- if (ipV4res.isIPV4) {
5297
- host = ipV4res.host;
5298
- } else {
5299
- const ipV6res = normalizeIPv6$1(ipV4res.host);
5300
- if (ipV6res.isIPV6 === true) {
5301
- host = `[${ipV6res.escapedHost}]`;
5302
- } else {
5303
- host = components.host;
5304
- }
5305
- }
5306
- uriTokens.push(host);
5307
- }
5403
+ /**
5404
+ * Bias adaptation function as per section 3.4 of RFC 3492.
5405
+ * https://tools.ietf.org/html/rfc3492#section-3.4
5406
+ * @private
5407
+ */
5408
+ var adapt = function adapt(delta, numPoints, firstTime) {
5409
+ var k = 0;
5410
+ delta = firstTime ? floor(delta / damp) : delta >> 1;
5411
+ delta += floor(delta / numPoints);
5412
+ for (; /* no initialization */delta > baseMinusTMin * tMax >> 1; k += base) {
5413
+ delta = floor(delta / baseMinusTMin);
5414
+ }
5415
+ return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
5416
+ };
5308
5417
 
5309
- if (typeof components.port === 'number' || typeof components.port === 'string') {
5310
- uriTokens.push(':');
5311
- uriTokens.push(String(components.port));
5312
- }
5418
+ /**
5419
+ * Converts a Punycode string of ASCII-only symbols to a string of Unicode
5420
+ * symbols.
5421
+ * @memberOf punycode
5422
+ * @param {String} input The Punycode string of ASCII-only symbols.
5423
+ * @returns {String} The resulting string of Unicode symbols.
5424
+ */
5425
+ var decode = function decode(input) {
5426
+ // Don't use UCS-2.
5427
+ var output = [];
5428
+ var inputLength = input.length;
5429
+ var i = 0;
5430
+ var n = initialN;
5431
+ var bias = initialBias;
5432
+
5433
+ // Handle the basic code points: let `basic` be the number of input code
5434
+ // points before the last delimiter, or `0` if there is none, then copy
5435
+ // the first basic code points to the output.
5436
+
5437
+ var basic = input.lastIndexOf(delimiter);
5438
+ if (basic < 0) {
5439
+ basic = 0;
5440
+ }
5313
5441
 
5314
- return uriTokens.length ? uriTokens.join('') : undefined
5315
- }
5316
- var utils = {
5317
- recomposeAuthority: recomposeAuthority$1,
5318
- normalizeComponentEncoding: normalizeComponentEncoding$1,
5319
- removeDotSegments: removeDotSegments$1,
5320
- normalizeIPv4: normalizeIPv4$1,
5321
- normalizeIPv6: normalizeIPv6$1,
5322
- stringArrayToHexStripped
5323
- };
5442
+ for (var j = 0; j < basic; ++j) {
5443
+ // if it's not a basic code point
5444
+ if (input.charCodeAt(j) >= 0x80) {
5445
+ error$1('not-basic');
5446
+ }
5447
+ output.push(input.charCodeAt(j));
5448
+ }
5324
5449
 
5325
- const UUID_REG = /^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu;
5326
- const URN_REG = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;
5450
+ // Main decoding loop: start just after the last delimiter if any basic code
5451
+ // points were copied; start at the beginning otherwise.
5327
5452
 
5328
- function isSecure (wsComponents) {
5329
- return typeof wsComponents.secure === 'boolean' ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === 'wss'
5330
- }
5453
+ for (var index = basic > 0 ? basic + 1 : 0; index < inputLength;) /* no final expression */{
5331
5454
 
5332
- function httpParse (components) {
5333
- if (!components.host) {
5334
- components.error = components.error || 'HTTP URIs must have a host.';
5335
- }
5455
+ // `index` is the index of the next character to be consumed.
5456
+ // Decode a generalized variable-length integer into `delta`,
5457
+ // which gets added to `i`. The overflow checking is easier
5458
+ // if we increase `i` as we go, then subtract off its starting
5459
+ // value at the end to obtain `delta`.
5460
+ var oldi = i;
5461
+ for (var w = 1, k = base;; /* no condition */k += base) {
5336
5462
 
5337
- return components
5338
- }
5463
+ if (index >= inputLength) {
5464
+ error$1('invalid-input');
5465
+ }
5339
5466
 
5340
- function httpSerialize (components) {
5341
- const secure = String(components.scheme).toLowerCase() === 'https';
5467
+ var digit = basicToDigit(input.charCodeAt(index++));
5342
5468
 
5343
- // normalize the default port
5344
- if (components.port === (secure ? 443 : 80) || components.port === '') {
5345
- components.port = undefined;
5346
- }
5469
+ if (digit >= base || digit > floor((maxInt - i) / w)) {
5470
+ error$1('overflow');
5471
+ }
5347
5472
 
5348
- // normalize the empty path
5349
- if (!components.path) {
5350
- components.path = '/';
5351
- }
5473
+ i += digit * w;
5474
+ var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
5352
5475
 
5353
- // NOTE: We do not parse query strings for HTTP URIs
5354
- // as WWW Form Url Encoded query strings are part of the HTML4+ spec,
5355
- // and not the HTTP spec.
5476
+ if (digit < t) {
5477
+ break;
5478
+ }
5356
5479
 
5357
- return components
5358
- }
5480
+ var baseMinusT = base - t;
5481
+ if (w > floor(maxInt / baseMinusT)) {
5482
+ error$1('overflow');
5483
+ }
5359
5484
 
5360
- function wsParse (wsComponents) {
5361
- // indicate if the secure flag is set
5362
- wsComponents.secure = isSecure(wsComponents);
5485
+ w *= baseMinusT;
5486
+ }
5363
5487
 
5364
- // construct resouce name
5365
- wsComponents.resourceName = (wsComponents.path || '/') + (wsComponents.query ? '?' + wsComponents.query : '');
5366
- wsComponents.path = undefined;
5367
- wsComponents.query = undefined;
5488
+ var out = output.length + 1;
5489
+ bias = adapt(i - oldi, out, oldi == 0);
5368
5490
 
5369
- return wsComponents
5370
- }
5491
+ // `i` was supposed to wrap around from `out` to `0`,
5492
+ // incrementing `n` each time, so we'll fix that now:
5493
+ if (floor(i / out) > maxInt - n) {
5494
+ error$1('overflow');
5495
+ }
5371
5496
 
5372
- function wsSerialize (wsComponents) {
5373
- // normalize the default port
5374
- if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === '') {
5375
- wsComponents.port = undefined;
5376
- }
5497
+ n += floor(i / out);
5498
+ i %= out;
5377
5499
 
5378
- // ensure scheme matches secure flag
5379
- if (typeof wsComponents.secure === 'boolean') {
5380
- wsComponents.scheme = (wsComponents.secure ? 'wss' : 'ws');
5381
- wsComponents.secure = undefined;
5382
- }
5500
+ // Insert `n` at position `i` of the output.
5501
+ output.splice(i++, 0, n);
5502
+ }
5383
5503
 
5384
- // reconstruct path from resource name
5385
- if (wsComponents.resourceName) {
5386
- const [path, query] = wsComponents.resourceName.split('?');
5387
- wsComponents.path = (path && path !== '/' ? path : undefined);
5388
- wsComponents.query = query;
5389
- wsComponents.resourceName = undefined;
5390
- }
5504
+ return String.fromCodePoint.apply(String, output);
5505
+ };
5391
5506
 
5392
- // forbid fragment component
5393
- wsComponents.fragment = undefined;
5507
+ /**
5508
+ * Converts a string of Unicode symbols (e.g. a domain name label) to a
5509
+ * Punycode string of ASCII-only symbols.
5510
+ * @memberOf punycode
5511
+ * @param {String} input The string of Unicode symbols.
5512
+ * @returns {String} The resulting Punycode string of ASCII-only symbols.
5513
+ */
5514
+ var encode = function encode(input) {
5515
+ var output = [];
5394
5516
 
5395
- return wsComponents
5396
- }
5517
+ // Convert the input in UCS-2 to an array of Unicode code points.
5518
+ input = ucs2decode(input);
5397
5519
 
5398
- function urnParse (urnComponents, options) {
5399
- if (!urnComponents.path) {
5400
- urnComponents.error = 'URN can not be parsed';
5401
- return urnComponents
5402
- }
5403
- const matches = urnComponents.path.match(URN_REG);
5404
- if (matches) {
5405
- const scheme = options.scheme || urnComponents.scheme || 'urn';
5406
- urnComponents.nid = matches[1].toLowerCase();
5407
- urnComponents.nss = matches[2];
5408
- const urnScheme = `${scheme}:${options.nid || urnComponents.nid}`;
5409
- const schemeHandler = SCHEMES$1[urnScheme];
5410
- urnComponents.path = undefined;
5411
-
5412
- if (schemeHandler) {
5413
- urnComponents = schemeHandler.parse(urnComponents, options);
5414
- }
5415
- } else {
5416
- urnComponents.error = urnComponents.error || 'URN can not be parsed.';
5417
- }
5520
+ // Cache the length.
5521
+ var inputLength = input.length;
5418
5522
 
5419
- return urnComponents
5420
- }
5523
+ // Initialize the state.
5524
+ var n = initialN;
5525
+ var delta = 0;
5526
+ var bias = initialBias;
5421
5527
 
5422
- function urnSerialize (urnComponents, options) {
5423
- const scheme = options.scheme || urnComponents.scheme || 'urn';
5424
- const nid = urnComponents.nid.toLowerCase();
5425
- const urnScheme = `${scheme}:${options.nid || nid}`;
5426
- const schemeHandler = SCHEMES$1[urnScheme];
5528
+ // Handle the basic code points.
5529
+ var _iteratorNormalCompletion = true;
5530
+ var _didIteratorError = false;
5531
+ var _iteratorError = undefined;
5427
5532
 
5428
- if (schemeHandler) {
5429
- urnComponents = schemeHandler.serialize(urnComponents, options);
5430
- }
5533
+ try {
5534
+ for (var _iterator = input[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
5535
+ var _currentValue2 = _step.value;
5431
5536
 
5432
- const uriComponents = urnComponents;
5433
- const nss = urnComponents.nss;
5434
- uriComponents.path = `${nid || options.nid}:${nss}`;
5537
+ if (_currentValue2 < 0x80) {
5538
+ output.push(stringFromCharCode(_currentValue2));
5539
+ }
5540
+ }
5541
+ } catch (err) {
5542
+ _didIteratorError = true;
5543
+ _iteratorError = err;
5544
+ } finally {
5545
+ try {
5546
+ if (!_iteratorNormalCompletion && _iterator.return) {
5547
+ _iterator.return();
5548
+ }
5549
+ } finally {
5550
+ if (_didIteratorError) {
5551
+ throw _iteratorError;
5552
+ }
5553
+ }
5554
+ }
5435
5555
 
5436
- options.skipEscape = true;
5437
- return uriComponents
5438
- }
5556
+ var basicLength = output.length;
5557
+ var handledCPCount = basicLength;
5439
5558
 
5440
- function urnuuidParse (urnComponents, options) {
5441
- const uuidComponents = urnComponents;
5442
- uuidComponents.uuid = uuidComponents.nss;
5443
- uuidComponents.nss = undefined;
5559
+ // `handledCPCount` is the number of code points that have been handled;
5560
+ // `basicLength` is the number of basic code points.
5444
5561
 
5445
- if (!options.tolerant && (!uuidComponents.uuid || !UUID_REG.test(uuidComponents.uuid))) {
5446
- uuidComponents.error = uuidComponents.error || 'UUID is not valid.';
5447
- }
5562
+ // Finish the basic string with a delimiter unless it's empty.
5563
+ if (basicLength) {
5564
+ output.push(delimiter);
5565
+ }
5448
5566
 
5449
- return uuidComponents
5450
- }
5567
+ // Main encoding loop:
5568
+ while (handledCPCount < inputLength) {
5451
5569
 
5452
- function urnuuidSerialize (uuidComponents) {
5453
- const urnComponents = uuidComponents;
5454
- // normalize UUID
5455
- urnComponents.nss = (uuidComponents.uuid || '').toLowerCase();
5456
- return urnComponents
5457
- }
5570
+ // All non-basic code points < n have been handled already. Find the next
5571
+ // larger one:
5572
+ var m = maxInt;
5573
+ var _iteratorNormalCompletion2 = true;
5574
+ var _didIteratorError2 = false;
5575
+ var _iteratorError2 = undefined;
5458
5576
 
5459
- const http = {
5460
- scheme: 'http',
5461
- domainHost: true,
5462
- parse: httpParse,
5463
- serialize: httpSerialize
5464
- };
5577
+ try {
5578
+ for (var _iterator2 = input[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
5579
+ var currentValue = _step2.value;
5465
5580
 
5466
- const https = {
5467
- scheme: 'https',
5468
- domainHost: http.domainHost,
5469
- parse: httpParse,
5470
- serialize: httpSerialize
5471
- };
5581
+ if (currentValue >= n && currentValue < m) {
5582
+ m = currentValue;
5583
+ }
5584
+ }
5472
5585
 
5473
- const ws = {
5474
- scheme: 'ws',
5475
- domainHost: true,
5476
- parse: wsParse,
5477
- serialize: wsSerialize
5478
- };
5586
+ // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
5587
+ // but guard against overflow.
5588
+ } catch (err) {
5589
+ _didIteratorError2 = true;
5590
+ _iteratorError2 = err;
5591
+ } finally {
5592
+ try {
5593
+ if (!_iteratorNormalCompletion2 && _iterator2.return) {
5594
+ _iterator2.return();
5595
+ }
5596
+ } finally {
5597
+ if (_didIteratorError2) {
5598
+ throw _iteratorError2;
5599
+ }
5600
+ }
5601
+ }
5479
5602
 
5480
- const wss = {
5481
- scheme: 'wss',
5482
- domainHost: ws.domainHost,
5483
- parse: ws.parse,
5484
- serialize: ws.serialize
5485
- };
5603
+ var handledCPCountPlusOne = handledCPCount + 1;
5604
+ if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
5605
+ error$1('overflow');
5606
+ }
5486
5607
 
5487
- const urn = {
5488
- scheme: 'urn',
5489
- parse: urnParse,
5490
- serialize: urnSerialize,
5491
- skipNormalize: true
5492
- };
5608
+ delta += (m - n) * handledCPCountPlusOne;
5609
+ n = m;
5493
5610
 
5494
- const urnuuid = {
5495
- scheme: 'urn:uuid',
5496
- parse: urnuuidParse,
5497
- serialize: urnuuidSerialize,
5498
- skipNormalize: true
5611
+ var _iteratorNormalCompletion3 = true;
5612
+ var _didIteratorError3 = false;
5613
+ var _iteratorError3 = undefined;
5614
+
5615
+ try {
5616
+ for (var _iterator3 = input[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
5617
+ var _currentValue = _step3.value;
5618
+
5619
+ if (_currentValue < n && ++delta > maxInt) {
5620
+ error$1('overflow');
5621
+ }
5622
+ if (_currentValue == n) {
5623
+ // Represent delta as a generalized variable-length integer.
5624
+ var q = delta;
5625
+ for (var k = base;; /* no condition */k += base) {
5626
+ var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
5627
+ if (q < t) {
5628
+ break;
5629
+ }
5630
+ var qMinusT = q - t;
5631
+ var baseMinusT = base - t;
5632
+ output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)));
5633
+ q = floor(qMinusT / baseMinusT);
5634
+ }
5635
+
5636
+ output.push(stringFromCharCode(digitToBasic(q, 0)));
5637
+ bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
5638
+ delta = 0;
5639
+ ++handledCPCount;
5640
+ }
5641
+ }
5642
+ } catch (err) {
5643
+ _didIteratorError3 = true;
5644
+ _iteratorError3 = err;
5645
+ } finally {
5646
+ try {
5647
+ if (!_iteratorNormalCompletion3 && _iterator3.return) {
5648
+ _iterator3.return();
5649
+ }
5650
+ } finally {
5651
+ if (_didIteratorError3) {
5652
+ throw _iteratorError3;
5653
+ }
5654
+ }
5655
+ }
5656
+
5657
+ ++delta;
5658
+ ++n;
5659
+ }
5660
+ return output.join('');
5499
5661
  };
5500
5662
 
5501
- const SCHEMES$1 = {
5502
- http,
5503
- https,
5504
- ws,
5505
- wss,
5506
- urn,
5507
- 'urn:uuid': urnuuid
5663
+ /**
5664
+ * Converts a Punycode string representing a domain name or an email address
5665
+ * to Unicode. Only the Punycoded parts of the input will be converted, i.e.
5666
+ * it doesn't matter if you call it on a string that has already been
5667
+ * converted to Unicode.
5668
+ * @memberOf punycode
5669
+ * @param {String} input The Punycoded domain name or email address to
5670
+ * convert to Unicode.
5671
+ * @returns {String} The Unicode representation of the given Punycode
5672
+ * string.
5673
+ */
5674
+ var toUnicode = function toUnicode(input) {
5675
+ return mapDomain(input, function (string) {
5676
+ return regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string;
5677
+ });
5508
5678
  };
5509
5679
 
5510
- var schemes = SCHEMES$1;
5680
+ /**
5681
+ * Converts a Unicode string representing a domain name or an email address to
5682
+ * Punycode. Only the non-ASCII parts of the domain name will be converted,
5683
+ * i.e. it doesn't matter if you call it with a domain that's already in
5684
+ * ASCII.
5685
+ * @memberOf punycode
5686
+ * @param {String} input The domain name or email address to convert, as a
5687
+ * Unicode string.
5688
+ * @returns {String} The Punycode representation of the given domain name or
5689
+ * email address.
5690
+ */
5691
+ var toASCII = function toASCII(input) {
5692
+ return mapDomain(input, function (string) {
5693
+ return regexNonASCII.test(string) ? 'xn--' + encode(string) : string;
5694
+ });
5695
+ };
5511
5696
 
5512
- const { normalizeIPv6, normalizeIPv4, removeDotSegments, recomposeAuthority, normalizeComponentEncoding } = utils;
5513
- const SCHEMES = schemes;
5697
+ /*--------------------------------------------------------------------------*/
5698
+
5699
+ /** Define the public API */
5700
+ var punycode = {
5701
+ /**
5702
+ * A string representing the current Punycode.js version number.
5703
+ * @memberOf punycode
5704
+ * @type String
5705
+ */
5706
+ 'version': '2.1.0',
5707
+ /**
5708
+ * An object of methods to convert from JavaScript's internal character
5709
+ * representation (UCS-2) to Unicode code points, and back.
5710
+ * @see <https://mathiasbynens.be/notes/javascript-encoding>
5711
+ * @memberOf punycode
5712
+ * @type Object
5713
+ */
5714
+ 'ucs2': {
5715
+ 'decode': ucs2decode,
5716
+ 'encode': ucs2encode
5717
+ },
5718
+ 'decode': decode,
5719
+ 'encode': encode,
5720
+ 'toASCII': toASCII,
5721
+ 'toUnicode': toUnicode
5722
+ };
5514
5723
 
5515
- function normalize (uri, options) {
5516
- if (typeof uri === 'string') {
5517
- uri = serialize(parse(uri, options), options);
5518
- } else if (typeof uri === 'object') {
5519
- uri = parse(serialize(uri, options), options);
5520
- }
5521
- return uri
5724
+ /**
5725
+ * URI.js
5726
+ *
5727
+ * @fileoverview An RFC 3986 compliant, scheme extendable URI parsing/validating/resolving library for JavaScript.
5728
+ * @author <a href="mailto:gary.court@gmail.com">Gary Court</a>
5729
+ * @see http://github.com/garycourt/uri-js
5730
+ */
5731
+ /**
5732
+ * Copyright 2011 Gary Court. All rights reserved.
5733
+ *
5734
+ * Redistribution and use in source and binary forms, with or without modification, are
5735
+ * permitted provided that the following conditions are met:
5736
+ *
5737
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
5738
+ * conditions and the following disclaimer.
5739
+ *
5740
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
5741
+ * of conditions and the following disclaimer in the documentation and/or other materials
5742
+ * provided with the distribution.
5743
+ *
5744
+ * THIS SOFTWARE IS PROVIDED BY GARY COURT ``AS IS'' AND ANY EXPRESS OR IMPLIED
5745
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
5746
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARY COURT OR
5747
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
5748
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
5749
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
5750
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
5751
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
5752
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5753
+ *
5754
+ * The views and conclusions contained in the software and documentation are those of the
5755
+ * authors and should not be interpreted as representing official policies, either expressed
5756
+ * or implied, of Gary Court.
5757
+ */
5758
+ var SCHEMES = {};
5759
+ function pctEncChar(chr) {
5760
+ var c = chr.charCodeAt(0);
5761
+ var e = void 0;
5762
+ 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();
5763
+ return e;
5764
+ }
5765
+ function pctDecChars(str) {
5766
+ var newStr = "";
5767
+ var i = 0;
5768
+ var il = str.length;
5769
+ while (i < il) {
5770
+ var c = parseInt(str.substr(i + 1, 2), 16);
5771
+ if (c < 128) {
5772
+ newStr += String.fromCharCode(c);
5773
+ i += 3;
5774
+ } else if (c >= 194 && c < 224) {
5775
+ if (il - i >= 6) {
5776
+ var c2 = parseInt(str.substr(i + 4, 2), 16);
5777
+ newStr += String.fromCharCode((c & 31) << 6 | c2 & 63);
5778
+ } else {
5779
+ newStr += str.substr(i, 6);
5780
+ }
5781
+ i += 6;
5782
+ } else if (c >= 224) {
5783
+ if (il - i >= 9) {
5784
+ var _c = parseInt(str.substr(i + 4, 2), 16);
5785
+ var c3 = parseInt(str.substr(i + 7, 2), 16);
5786
+ newStr += String.fromCharCode((c & 15) << 12 | (_c & 63) << 6 | c3 & 63);
5787
+ } else {
5788
+ newStr += str.substr(i, 9);
5789
+ }
5790
+ i += 9;
5791
+ } else {
5792
+ newStr += str.substr(i, 3);
5793
+ i += 3;
5794
+ }
5795
+ }
5796
+ return newStr;
5797
+ }
5798
+ function _normalizeComponentEncoding(components, protocol) {
5799
+ function decodeUnreserved(str) {
5800
+ var decStr = pctDecChars(str);
5801
+ return !decStr.match(protocol.UNRESERVED) ? str : decStr;
5802
+ }
5803
+ if (components.scheme) components.scheme = String(components.scheme).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_SCHEME, "");
5804
+ if (components.userinfo !== undefined) components.userinfo = String(components.userinfo).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_USERINFO, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
5805
+ 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);
5806
+ 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);
5807
+ if (components.query !== undefined) components.query = String(components.query).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_QUERY, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
5808
+ if (components.fragment !== undefined) components.fragment = String(components.fragment).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_FRAGMENT, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
5809
+ return components;
5522
5810
  }
5523
5811
 
5524
- function resolve (baseURI, relativeURI, options) {
5525
- const schemelessOptions = Object.assign({ scheme: 'null' }, options);
5526
- const resolved = resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true);
5527
- return serialize(resolved, { ...schemelessOptions, skipEscape: true })
5812
+ function _stripLeadingZeros(str) {
5813
+ return str.replace(/^0*(.*)/, "$1") || "0";
5528
5814
  }
5815
+ function _normalizeIPv4(host, protocol) {
5816
+ var matches = host.match(protocol.IPV4ADDRESS) || [];
5529
5817
 
5530
- function resolveComponents (base, relative, options, skipNormalization) {
5531
- const target = {};
5532
- if (!skipNormalization) {
5533
- base = parse(serialize(base, options), options); // normalize base components
5534
- relative = parse(serialize(relative, options), options); // normalize relative components
5535
- }
5536
- options = options || {};
5537
-
5538
- if (!options.tolerant && relative.scheme) {
5539
- target.scheme = relative.scheme;
5540
- // target.authority = relative.authority;
5541
- target.userinfo = relative.userinfo;
5542
- target.host = relative.host;
5543
- target.port = relative.port;
5544
- target.path = removeDotSegments(relative.path || '');
5545
- target.query = relative.query;
5546
- } else {
5547
- if (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) {
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;
5818
+ var _matches = slicedToArray(matches, 2),
5819
+ address = _matches[1];
5820
+
5821
+ if (address) {
5822
+ return address.split(".").map(_stripLeadingZeros).join(".");
5554
5823
  } else {
5555
- if (!relative.path) {
5556
- target.path = base.path;
5557
- if (relative.query !== undefined) {
5558
- target.query = relative.query;
5824
+ return host;
5825
+ }
5826
+ }
5827
+ function _normalizeIPv6(host, protocol) {
5828
+ var matches = host.match(protocol.IPV6ADDRESS) || [];
5829
+
5830
+ var _matches2 = slicedToArray(matches, 3),
5831
+ address = _matches2[1],
5832
+ zone = _matches2[2];
5833
+
5834
+ if (address) {
5835
+ var _address$toLowerCase$ = address.toLowerCase().split('::').reverse(),
5836
+ _address$toLowerCase$2 = slicedToArray(_address$toLowerCase$, 2),
5837
+ last = _address$toLowerCase$2[0],
5838
+ first = _address$toLowerCase$2[1];
5839
+
5840
+ var firstFields = first ? first.split(":").map(_stripLeadingZeros) : [];
5841
+ var lastFields = last.split(":").map(_stripLeadingZeros);
5842
+ var isLastFieldIPv4Address = protocol.IPV4ADDRESS.test(lastFields[lastFields.length - 1]);
5843
+ var fieldCount = isLastFieldIPv4Address ? 7 : 8;
5844
+ var lastFieldsStart = lastFields.length - fieldCount;
5845
+ var fields = Array(fieldCount);
5846
+ for (var x = 0; x < fieldCount; ++x) {
5847
+ fields[x] = firstFields[x] || lastFields[lastFieldsStart + x] || '';
5848
+ }
5849
+ if (isLastFieldIPv4Address) {
5850
+ fields[fieldCount - 1] = _normalizeIPv4(fields[fieldCount - 1], protocol);
5851
+ }
5852
+ var allZeroFields = fields.reduce(function (acc, field, index) {
5853
+ if (!field || field === "0") {
5854
+ var lastLongest = acc[acc.length - 1];
5855
+ if (lastLongest && lastLongest.index + lastLongest.length === index) {
5856
+ lastLongest.length++;
5857
+ } else {
5858
+ acc.push({ index: index, length: 1 });
5859
+ }
5860
+ }
5861
+ return acc;
5862
+ }, []);
5863
+ var longestZeroFields = allZeroFields.sort(function (a, b) {
5864
+ return b.length - a.length;
5865
+ })[0];
5866
+ var newHost = void 0;
5867
+ if (longestZeroFields && longestZeroFields.length > 1) {
5868
+ var newFirst = fields.slice(0, longestZeroFields.index);
5869
+ var newLast = fields.slice(longestZeroFields.index + longestZeroFields.length);
5870
+ newHost = newFirst.join(":") + "::" + newLast.join(":");
5559
5871
  } else {
5560
- target.query = base.query;
5872
+ newHost = fields.join(":");
5561
5873
  }
5562
- } else {
5563
- if (relative.path.charAt(0) === '/') {
5564
- target.path = removeDotSegments(relative.path);
5874
+ if (zone) {
5875
+ newHost += "%" + zone;
5876
+ }
5877
+ return newHost;
5878
+ } else {
5879
+ return host;
5880
+ }
5881
+ }
5882
+ var URI_PARSE = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i;
5883
+ var NO_MATCH_IS_UNDEFINED = "".match(/(){0}/)[1] === undefined;
5884
+ function parse(uriString) {
5885
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
5886
+
5887
+ var components = {};
5888
+ var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL;
5889
+ if (options.reference === "suffix") uriString = (options.scheme ? options.scheme + ":" : "") + "//" + uriString;
5890
+ var matches = uriString.match(URI_PARSE);
5891
+ if (matches) {
5892
+ if (NO_MATCH_IS_UNDEFINED) {
5893
+ //store each component
5894
+ components.scheme = matches[1];
5895
+ components.userinfo = matches[3];
5896
+ components.host = matches[4];
5897
+ components.port = parseInt(matches[5], 10);
5898
+ components.path = matches[6] || "";
5899
+ components.query = matches[7];
5900
+ components.fragment = matches[8];
5901
+ //fix port number
5902
+ if (isNaN(components.port)) {
5903
+ components.port = matches[5];
5904
+ }
5565
5905
  } else {
5566
- if ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) {
5567
- target.path = '/' + relative.path;
5568
- } else if (!base.path) {
5569
- target.path = relative.path;
5570
- } else {
5571
- target.path = base.path.slice(0, base.path.lastIndexOf('/') + 1) + relative.path;
5572
- }
5573
- target.path = removeDotSegments(target.path);
5906
+ //IE FIX for improper RegExp matching
5907
+ //store each component
5908
+ components.scheme = matches[1] || undefined;
5909
+ components.userinfo = uriString.indexOf("@") !== -1 ? matches[3] : undefined;
5910
+ components.host = uriString.indexOf("//") !== -1 ? matches[4] : undefined;
5911
+ components.port = parseInt(matches[5], 10);
5912
+ components.path = matches[6] || "";
5913
+ components.query = uriString.indexOf("?") !== -1 ? matches[7] : undefined;
5914
+ components.fragment = uriString.indexOf("#") !== -1 ? matches[8] : undefined;
5915
+ //fix port number
5916
+ if (isNaN(components.port)) {
5917
+ components.port = uriString.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? matches[4] : undefined;
5918
+ }
5574
5919
  }
5575
- target.query = relative.query;
5576
- }
5577
- // target.authority = base.authority;
5578
- target.userinfo = base.userinfo;
5579
- target.host = base.host;
5580
- target.port = base.port;
5920
+ if (components.host) {
5921
+ //normalize IP hosts
5922
+ components.host = _normalizeIPv6(_normalizeIPv4(components.host, protocol), protocol);
5923
+ }
5924
+ //determine reference type
5925
+ if (components.scheme === undefined && components.userinfo === undefined && components.host === undefined && components.port === undefined && !components.path && components.query === undefined) {
5926
+ components.reference = "same-document";
5927
+ } else if (components.scheme === undefined) {
5928
+ components.reference = "relative";
5929
+ } else if (components.fragment === undefined) {
5930
+ components.reference = "absolute";
5931
+ } else {
5932
+ components.reference = "uri";
5933
+ }
5934
+ //check for reference errors
5935
+ if (options.reference && options.reference !== "suffix" && options.reference !== components.reference) {
5936
+ components.error = components.error || "URI is not a " + options.reference + " reference.";
5937
+ }
5938
+ //find scheme handler
5939
+ var schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
5940
+ //check if scheme can't handle IRIs
5941
+ if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
5942
+ //if host component is a domain name
5943
+ if (components.host && (options.domainHost || schemeHandler && schemeHandler.domainHost)) {
5944
+ //convert Unicode IDN -> ASCII IDN
5945
+ try {
5946
+ components.host = punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase());
5947
+ } catch (e) {
5948
+ components.error = components.error || "Host's domain name can not be converted to ASCII via punycode: " + e;
5949
+ }
5950
+ }
5951
+ //convert IRI -> URI
5952
+ _normalizeComponentEncoding(components, URI_PROTOCOL);
5953
+ } else {
5954
+ //normalize encodings
5955
+ _normalizeComponentEncoding(components, protocol);
5956
+ }
5957
+ //perform scheme specific parsing
5958
+ if (schemeHandler && schemeHandler.parse) {
5959
+ schemeHandler.parse(components, options);
5960
+ }
5961
+ } else {
5962
+ components.error = components.error || "URI can not be parsed.";
5581
5963
  }
5582
- target.scheme = base.scheme;
5583
- }
5584
-
5585
- target.fragment = relative.fragment;
5586
-
5587
- return target
5964
+ return components;
5588
5965
  }
5589
5966
 
5590
- function equal$2 (uriA, uriB, options) {
5591
- if (typeof uriA === 'string') {
5592
- uriA = unescape(uriA);
5593
- uriA = serialize(normalizeComponentEncoding(parse(uriA, options), true), { ...options, skipEscape: true });
5594
- } else if (typeof uriA === 'object') {
5595
- uriA = serialize(normalizeComponentEncoding(uriA, true), { ...options, skipEscape: true });
5596
- }
5597
-
5598
- if (typeof uriB === 'string') {
5599
- uriB = unescape(uriB);
5600
- uriB = serialize(normalizeComponentEncoding(parse(uriB, options), true), { ...options, skipEscape: true });
5601
- } else if (typeof uriB === 'object') {
5602
- uriB = serialize(normalizeComponentEncoding(uriB, true), { ...options, skipEscape: true });
5603
- }
5604
-
5605
- return uriA.toLowerCase() === uriB.toLowerCase()
5606
- }
5607
-
5608
- function serialize (cmpts, opts) {
5609
- const components = {
5610
- host: cmpts.host,
5611
- scheme: cmpts.scheme,
5612
- userinfo: cmpts.userinfo,
5613
- port: cmpts.port,
5614
- path: cmpts.path,
5615
- query: cmpts.query,
5616
- nid: cmpts.nid,
5617
- nss: cmpts.nss,
5618
- uuid: cmpts.uuid,
5619
- fragment: cmpts.fragment,
5620
- reference: cmpts.reference,
5621
- resourceName: cmpts.resourceName,
5622
- secure: cmpts.secure,
5623
- error: ''
5624
- };
5625
- const options = Object.assign({}, opts);
5626
- const uriTokens = [];
5627
-
5628
- // find scheme handler
5629
- const schemeHandler = SCHEMES[(options.scheme || components.scheme || '').toLowerCase()];
5967
+ function _recomposeAuthority(components, options) {
5968
+ var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL;
5969
+ var uriTokens = [];
5970
+ if (components.userinfo !== undefined) {
5971
+ uriTokens.push(components.userinfo);
5972
+ uriTokens.push("@");
5973
+ }
5974
+ if (components.host !== undefined) {
5975
+ //normalize IP hosts, add brackets and escape zone separator for IPv6
5976
+ uriTokens.push(_normalizeIPv6(_normalizeIPv4(String(components.host), protocol), protocol).replace(protocol.IPV6ADDRESS, function (_, $1, $2) {
5977
+ return "[" + $1 + ($2 ? "%25" + $2 : "") + "]";
5978
+ }));
5979
+ }
5980
+ if (typeof components.port === "number" || typeof components.port === "string") {
5981
+ uriTokens.push(":");
5982
+ uriTokens.push(String(components.port));
5983
+ }
5984
+ return uriTokens.length ? uriTokens.join("") : undefined;
5985
+ }
5986
+
5987
+ var RDS1 = /^\.\.?\//;
5988
+ var RDS2 = /^\/\.(\/|$)/;
5989
+ var RDS3 = /^\/\.\.(\/|$)/;
5990
+ var RDS5 = /^\/?(?:.|\n)*?(?=\/|$)/;
5991
+ function removeDotSegments(input) {
5992
+ var output = [];
5993
+ while (input.length) {
5994
+ if (input.match(RDS1)) {
5995
+ input = input.replace(RDS1, "");
5996
+ } else if (input.match(RDS2)) {
5997
+ input = input.replace(RDS2, "/");
5998
+ } else if (input.match(RDS3)) {
5999
+ input = input.replace(RDS3, "/");
6000
+ output.pop();
6001
+ } else if (input === "." || input === "..") {
6002
+ input = "";
6003
+ } else {
6004
+ var im = input.match(RDS5);
6005
+ if (im) {
6006
+ var s = im[0];
6007
+ input = input.slice(s.length);
6008
+ output.push(s);
6009
+ } else {
6010
+ throw new Error("Unexpected dot segment condition");
6011
+ }
6012
+ }
6013
+ }
6014
+ return output.join("");
6015
+ }
5630
6016
 
5631
- // perform scheme specific serialization
5632
- if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(components, options);
6017
+ function serialize(components) {
6018
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
5633
6019
 
5634
- if (components.path !== undefined) {
5635
- if (!options.skipEscape) {
5636
- components.path = escape(components.path);
6020
+ var protocol = options.iri ? IRI_PROTOCOL : URI_PROTOCOL;
6021
+ var uriTokens = [];
6022
+ //find scheme handler
6023
+ var schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
6024
+ //perform scheme specific serialization
6025
+ if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(components, options);
6026
+ if (components.host) {
6027
+ //if host component is an IPv6 address
6028
+ if (protocol.IPV6ADDRESS.test(components.host)) ;
6029
+ //TODO: normalize IPv6 address as per RFC 5952
5637
6030
 
5638
- if (components.scheme !== undefined) {
5639
- components.path = components.path.split('%3A').join(':');
5640
- }
5641
- } else {
5642
- components.path = unescape(components.path);
6031
+ //if host component is a domain name
6032
+ else if (options.domainHost || schemeHandler && schemeHandler.domainHost) {
6033
+ //convert IDN via punycode
6034
+ try {
6035
+ components.host = !options.iri ? punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase()) : punycode.toUnicode(components.host);
6036
+ } catch (e) {
6037
+ components.error = components.error || "Host's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e;
6038
+ }
6039
+ }
5643
6040
  }
5644
- }
5645
-
5646
- if (options.reference !== 'suffix' && components.scheme) {
5647
- uriTokens.push(components.scheme, ':');
5648
- }
5649
-
5650
- const authority = recomposeAuthority(components);
5651
- if (authority !== undefined) {
5652
- if (options.reference !== 'suffix') {
5653
- uriTokens.push('//');
6041
+ //normalize encoding
6042
+ _normalizeComponentEncoding(components, protocol);
6043
+ if (options.reference !== "suffix" && components.scheme) {
6044
+ uriTokens.push(components.scheme);
6045
+ uriTokens.push(":");
5654
6046
  }
5655
-
5656
- uriTokens.push(authority);
5657
-
5658
- if (components.path && components.path.charAt(0) !== '/') {
5659
- uriTokens.push('/');
6047
+ var authority = _recomposeAuthority(components, options);
6048
+ if (authority !== undefined) {
6049
+ if (options.reference !== "suffix") {
6050
+ uriTokens.push("//");
6051
+ }
6052
+ uriTokens.push(authority);
6053
+ if (components.path && components.path.charAt(0) !== "/") {
6054
+ uriTokens.push("/");
6055
+ }
5660
6056
  }
5661
- }
5662
- if (components.path !== undefined) {
5663
- let s = components.path;
5664
-
5665
- if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
5666
- s = removeDotSegments(s);
6057
+ if (components.path !== undefined) {
6058
+ var s = components.path;
6059
+ if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
6060
+ s = removeDotSegments(s);
6061
+ }
6062
+ if (authority === undefined) {
6063
+ s = s.replace(/^\/\//, "/%2F"); //don't allow the path to start with "//"
6064
+ }
6065
+ uriTokens.push(s);
5667
6066
  }
5668
-
5669
- if (authority === undefined) {
5670
- s = s.replace(/^\/\//u, '/%2F'); // don't allow the path to start with "//"
6067
+ if (components.query !== undefined) {
6068
+ uriTokens.push("?");
6069
+ uriTokens.push(components.query);
6070
+ }
6071
+ if (components.fragment !== undefined) {
6072
+ uriTokens.push("#");
6073
+ uriTokens.push(components.fragment);
5671
6074
  }
6075
+ return uriTokens.join(""); //merge tokens into a string
6076
+ }
5672
6077
 
5673
- uriTokens.push(s);
5674
- }
6078
+ function resolveComponents(base, relative) {
6079
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
6080
+ var skipNormalization = arguments[3];
5675
6081
 
5676
- if (components.query !== undefined) {
5677
- uriTokens.push('?', components.query);
5678
- }
6082
+ var target = {};
6083
+ if (!skipNormalization) {
6084
+ base = parse(serialize(base, options), options); //normalize base components
6085
+ relative = parse(serialize(relative, options), options); //normalize relative components
6086
+ }
6087
+ options = options || {};
6088
+ if (!options.tolerant && relative.scheme) {
6089
+ target.scheme = relative.scheme;
6090
+ //target.authority = relative.authority;
6091
+ target.userinfo = relative.userinfo;
6092
+ target.host = relative.host;
6093
+ target.port = relative.port;
6094
+ target.path = removeDotSegments(relative.path || "");
6095
+ target.query = relative.query;
6096
+ } else {
6097
+ if (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) {
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.path) {
6106
+ target.path = base.path;
6107
+ if (relative.query !== undefined) {
6108
+ target.query = relative.query;
6109
+ } else {
6110
+ target.query = base.query;
6111
+ }
6112
+ } else {
6113
+ if (relative.path.charAt(0) === "/") {
6114
+ target.path = removeDotSegments(relative.path);
6115
+ } else {
6116
+ if ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) {
6117
+ target.path = "/" + relative.path;
6118
+ } else if (!base.path) {
6119
+ target.path = relative.path;
6120
+ } else {
6121
+ target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative.path;
6122
+ }
6123
+ target.path = removeDotSegments(target.path);
6124
+ }
6125
+ target.query = relative.query;
6126
+ }
6127
+ //target.authority = base.authority;
6128
+ target.userinfo = base.userinfo;
6129
+ target.host = base.host;
6130
+ target.port = base.port;
6131
+ }
6132
+ target.scheme = base.scheme;
6133
+ }
6134
+ target.fragment = relative.fragment;
6135
+ return target;
6136
+ }
5679
6137
 
5680
- if (components.fragment !== undefined) {
5681
- uriTokens.push('#', components.fragment);
5682
- }
5683
- return uriTokens.join('')
6138
+ function resolve(baseURI, relativeURI, options) {
6139
+ var schemelessOptions = assign({ scheme: 'null' }, options);
6140
+ return serialize(resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true), schemelessOptions);
5684
6141
  }
5685
6142
 
5686
- const hexLookUp = Array.from({ length: 127 }, (_v, k) => /[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(k)));
6143
+ function normalize(uri, options) {
6144
+ if (typeof uri === "string") {
6145
+ uri = serialize(parse(uri, options), options);
6146
+ } else if (typeOf(uri) === "object") {
6147
+ uri = parse(serialize(uri, options), options);
6148
+ }
6149
+ return uri;
6150
+ }
5687
6151
 
5688
- function nonSimpleDomain (value) {
5689
- let code = 0;
5690
- for (let i = 0, len = value.length; i < len; ++i) {
5691
- code = value.charCodeAt(i);
5692
- if (code > 126 || hexLookUp[code]) {
5693
- return true
6152
+ function equal(uriA, uriB, options) {
6153
+ if (typeof uriA === "string") {
6154
+ uriA = serialize(parse(uriA, options), options);
6155
+ } else if (typeOf(uriA) === "object") {
6156
+ uriA = serialize(uriA, options);
5694
6157
  }
5695
- }
5696
- return false
6158
+ if (typeof uriB === "string") {
6159
+ uriB = serialize(parse(uriB, options), options);
6160
+ } else if (typeOf(uriB) === "object") {
6161
+ uriB = serialize(uriB, options);
6162
+ }
6163
+ return uriA === uriB;
5697
6164
  }
5698
6165
 
5699
- const URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
6166
+ function escapeComponent(str, options) {
6167
+ return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.ESCAPE : IRI_PROTOCOL.ESCAPE, pctEncChar);
6168
+ }
5700
6169
 
5701
- function parse (uri, opts) {
5702
- const options = Object.assign({}, opts);
5703
- const parsed = {
5704
- scheme: undefined,
5705
- userinfo: undefined,
5706
- host: '',
5707
- port: undefined,
5708
- path: '',
5709
- query: undefined,
5710
- fragment: undefined
5711
- };
5712
- const gotEncoding = uri.indexOf('%') !== -1;
5713
- let isIP = false;
5714
- if (options.reference === 'suffix') uri = (options.scheme ? options.scheme + ':' : '') + '//' + uri;
5715
-
5716
- const matches = uri.match(URI_PARSE);
5717
-
5718
- if (matches) {
5719
- // store each component
5720
- parsed.scheme = matches[1];
5721
- parsed.userinfo = matches[3];
5722
- parsed.host = matches[4];
5723
- parsed.port = parseInt(matches[5], 10);
5724
- parsed.path = matches[6] || '';
5725
- parsed.query = matches[7];
5726
- parsed.fragment = matches[8];
5727
-
5728
- // fix port number
5729
- if (isNaN(parsed.port)) {
5730
- parsed.port = matches[5];
5731
- }
5732
- if (parsed.host) {
5733
- const ipv4result = normalizeIPv4(parsed.host);
5734
- if (ipv4result.isIPV4 === false) {
5735
- const ipv6result = normalizeIPv6(ipv4result.host);
5736
- parsed.host = ipv6result.host.toLowerCase();
5737
- isIP = ipv6result.isIPV6;
5738
- } else {
5739
- parsed.host = ipv4result.host;
5740
- isIP = true;
5741
- }
5742
- }
5743
- if (parsed.scheme === undefined && parsed.userinfo === undefined && parsed.host === undefined && parsed.port === undefined && parsed.query === undefined && !parsed.path) {
5744
- parsed.reference = 'same-document';
5745
- } else if (parsed.scheme === undefined) {
5746
- parsed.reference = 'relative';
5747
- } else if (parsed.fragment === undefined) {
5748
- parsed.reference = 'absolute';
5749
- } else {
5750
- parsed.reference = 'uri';
6170
+ function unescapeComponent(str, options) {
6171
+ return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.PCT_ENCODED : IRI_PROTOCOL.PCT_ENCODED, pctDecChars);
6172
+ }
6173
+
6174
+ var handler = {
6175
+ scheme: "http",
6176
+ domainHost: true,
6177
+ parse: function parse(components, options) {
6178
+ //report missing host
6179
+ if (!components.host) {
6180
+ components.error = components.error || "HTTP URIs must have a host.";
6181
+ }
6182
+ return components;
6183
+ },
6184
+ serialize: function serialize(components, options) {
6185
+ var secure = String(components.scheme).toLowerCase() === "https";
6186
+ //normalize the default port
6187
+ if (components.port === (secure ? 443 : 80) || components.port === "") {
6188
+ components.port = undefined;
6189
+ }
6190
+ //normalize the empty path
6191
+ if (!components.path) {
6192
+ components.path = "/";
6193
+ }
6194
+ //NOTE: We do not parse query strings for HTTP URIs
6195
+ //as WWW Form Url Encoded query strings are part of the HTML4+ spec,
6196
+ //and not the HTTP spec.
6197
+ return components;
5751
6198
  }
6199
+ };
6200
+
6201
+ var handler$1 = {
6202
+ scheme: "https",
6203
+ domainHost: handler.domainHost,
6204
+ parse: handler.parse,
6205
+ serialize: handler.serialize
6206
+ };
5752
6207
 
5753
- // check for reference errors
5754
- if (options.reference && options.reference !== 'suffix' && options.reference !== parsed.reference) {
5755
- parsed.error = parsed.error || 'URI is not a ' + options.reference + ' reference.';
6208
+ function isSecure(wsComponents) {
6209
+ return typeof wsComponents.secure === 'boolean' ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === "wss";
6210
+ }
6211
+ //RFC 6455
6212
+ var handler$2 = {
6213
+ scheme: "ws",
6214
+ domainHost: true,
6215
+ parse: function parse(components, options) {
6216
+ var wsComponents = components;
6217
+ //indicate if the secure flag is set
6218
+ wsComponents.secure = isSecure(wsComponents);
6219
+ //construct resouce name
6220
+ wsComponents.resourceName = (wsComponents.path || '/') + (wsComponents.query ? '?' + wsComponents.query : '');
6221
+ wsComponents.path = undefined;
6222
+ wsComponents.query = undefined;
6223
+ return wsComponents;
6224
+ },
6225
+ serialize: function serialize(wsComponents, options) {
6226
+ //normalize the default port
6227
+ if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === "") {
6228
+ wsComponents.port = undefined;
6229
+ }
6230
+ //ensure scheme matches secure flag
6231
+ if (typeof wsComponents.secure === 'boolean') {
6232
+ wsComponents.scheme = wsComponents.secure ? 'wss' : 'ws';
6233
+ wsComponents.secure = undefined;
6234
+ }
6235
+ //reconstruct path from resource name
6236
+ if (wsComponents.resourceName) {
6237
+ var _wsComponents$resourc = wsComponents.resourceName.split('?'),
6238
+ _wsComponents$resourc2 = slicedToArray(_wsComponents$resourc, 2),
6239
+ path = _wsComponents$resourc2[0],
6240
+ query = _wsComponents$resourc2[1];
6241
+
6242
+ wsComponents.path = path && path !== '/' ? path : undefined;
6243
+ wsComponents.query = query;
6244
+ wsComponents.resourceName = undefined;
6245
+ }
6246
+ //forbid fragment component
6247
+ wsComponents.fragment = undefined;
6248
+ return wsComponents;
5756
6249
  }
6250
+ };
5757
6251
 
5758
- // find scheme handler
5759
- const schemeHandler = SCHEMES[(options.scheme || parsed.scheme || '').toLowerCase()];
6252
+ var handler$3 = {
6253
+ scheme: "wss",
6254
+ domainHost: handler$2.domainHost,
6255
+ parse: handler$2.parse,
6256
+ serialize: handler$2.serialize
6257
+ };
5760
6258
 
5761
- // check if scheme can't handle IRIs
5762
- if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
5763
- // if host component is a domain name
5764
- if (parsed.host && (options.domainHost || (schemeHandler && schemeHandler.domainHost)) && isIP === false && nonSimpleDomain(parsed.host)) {
5765
- // convert Unicode IDN -> ASCII IDN
5766
- try {
5767
- parsed.host = URL.domainToASCII(parsed.host.toLowerCase());
5768
- } catch (e) {
5769
- parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
6259
+ var O = {};
6260
+ //RFC 3986
6261
+ var UNRESERVED$$ = "[A-Za-z0-9\\-\\.\\_\\~" + ("\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF" ) + "]";
6262
+ var HEXDIG$$ = "[0-9A-Fa-f]"; //case-insensitive
6263
+ var PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)); //expanded
6264
+ //RFC 5322, except these symbols as per RFC 6068: @ : / ? # [ ] & ; =
6265
+ //const ATEXT$$ = "[A-Za-z0-9\\!\\#\\$\\%\\&\\'\\*\\+\\-\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~]";
6266
+ //const WSP$$ = "[\\x20\\x09]";
6267
+ //const OBS_QTEXT$$ = "[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]"; //(%d1-8 / %d11-12 / %d14-31 / %d127)
6268
+ //const QTEXT$$ = merge("[\\x21\\x23-\\x5B\\x5D-\\x7E]", OBS_QTEXT$$); //%d33 / %d35-91 / %d93-126 / obs-qtext
6269
+ //const VCHAR$$ = "[\\x21-\\x7E]";
6270
+ //const WSP$$ = "[\\x20\\x09]";
6271
+ //const OBS_QP$ = subexp("\\\\" + merge("[\\x00\\x0D\\x0A]", OBS_QTEXT$$)); //%d0 / CR / LF / obs-qtext
6272
+ //const FWS$ = subexp(subexp(WSP$$ + "*" + "\\x0D\\x0A") + "?" + WSP$$ + "+");
6273
+ //const QUOTED_PAIR$ = subexp(subexp("\\\\" + subexp(VCHAR$$ + "|" + WSP$$)) + "|" + OBS_QP$);
6274
+ //const QUOTED_STRING$ = subexp('\\"' + subexp(FWS$ + "?" + QCONTENT$) + "*" + FWS$ + "?" + '\\"');
6275
+ var ATEXT$$ = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]";
6276
+ var QTEXT$$ = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]";
6277
+ var VCHAR$$ = merge(QTEXT$$, "[\\\"\\\\]");
6278
+ var SOME_DELIMS$$ = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]";
6279
+ var UNRESERVED = new RegExp(UNRESERVED$$, "g");
6280
+ var PCT_ENCODED = new RegExp(PCT_ENCODED$, "g");
6281
+ var NOT_LOCAL_PART = new RegExp(merge("[^]", ATEXT$$, "[\\.]", '[\\"]', VCHAR$$), "g");
6282
+ var NOT_HFNAME = new RegExp(merge("[^]", UNRESERVED$$, SOME_DELIMS$$), "g");
6283
+ var NOT_HFVALUE = NOT_HFNAME;
6284
+ function decodeUnreserved(str) {
6285
+ var decStr = pctDecChars(str);
6286
+ return !decStr.match(UNRESERVED) ? str : decStr;
6287
+ }
6288
+ var handler$4 = {
6289
+ scheme: "mailto",
6290
+ parse: function parse$$1(components, options) {
6291
+ var mailtoComponents = components;
6292
+ var to = mailtoComponents.to = mailtoComponents.path ? mailtoComponents.path.split(",") : [];
6293
+ mailtoComponents.path = undefined;
6294
+ if (mailtoComponents.query) {
6295
+ var unknownHeaders = false;
6296
+ var headers = {};
6297
+ var hfields = mailtoComponents.query.split("&");
6298
+ for (var x = 0, xl = hfields.length; x < xl; ++x) {
6299
+ var hfield = hfields[x].split("=");
6300
+ switch (hfield[0]) {
6301
+ case "to":
6302
+ var toAddrs = hfield[1].split(",");
6303
+ for (var _x = 0, _xl = toAddrs.length; _x < _xl; ++_x) {
6304
+ to.push(toAddrs[_x]);
6305
+ }
6306
+ break;
6307
+ case "subject":
6308
+ mailtoComponents.subject = unescapeComponent(hfield[1], options);
6309
+ break;
6310
+ case "body":
6311
+ mailtoComponents.body = unescapeComponent(hfield[1], options);
6312
+ break;
6313
+ default:
6314
+ unknownHeaders = true;
6315
+ headers[unescapeComponent(hfield[0], options)] = unescapeComponent(hfield[1], options);
6316
+ break;
6317
+ }
6318
+ }
6319
+ if (unknownHeaders) mailtoComponents.headers = headers;
6320
+ }
6321
+ mailtoComponents.query = undefined;
6322
+ for (var _x2 = 0, _xl2 = to.length; _x2 < _xl2; ++_x2) {
6323
+ var addr = to[_x2].split("@");
6324
+ addr[0] = unescapeComponent(addr[0]);
6325
+ if (!options.unicodeSupport) {
6326
+ //convert Unicode IDN -> ASCII IDN
6327
+ try {
6328
+ addr[1] = punycode.toASCII(unescapeComponent(addr[1], options).toLowerCase());
6329
+ } catch (e) {
6330
+ mailtoComponents.error = mailtoComponents.error || "Email address's domain name can not be converted to ASCII via punycode: " + e;
6331
+ }
6332
+ } else {
6333
+ addr[1] = unescapeComponent(addr[1], options).toLowerCase();
6334
+ }
6335
+ to[_x2] = addr.join("@");
5770
6336
  }
5771
- }
5772
- // convert IRI -> URI
6337
+ return mailtoComponents;
6338
+ },
6339
+ serialize: function serialize$$1(mailtoComponents, options) {
6340
+ var components = mailtoComponents;
6341
+ var to = toArray(mailtoComponents.to);
6342
+ if (to) {
6343
+ for (var x = 0, xl = to.length; x < xl; ++x) {
6344
+ var toAddr = String(to[x]);
6345
+ var atIdx = toAddr.lastIndexOf("@");
6346
+ var localPart = toAddr.slice(0, atIdx).replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_LOCAL_PART, pctEncChar);
6347
+ var domain = toAddr.slice(atIdx + 1);
6348
+ //convert IDN via punycode
6349
+ try {
6350
+ domain = !options.iri ? punycode.toASCII(unescapeComponent(domain, options).toLowerCase()) : punycode.toUnicode(domain);
6351
+ } catch (e) {
6352
+ components.error = components.error || "Email address's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e;
6353
+ }
6354
+ to[x] = localPart + "@" + domain;
6355
+ }
6356
+ components.path = to.join(",");
6357
+ }
6358
+ var headers = mailtoComponents.headers = mailtoComponents.headers || {};
6359
+ if (mailtoComponents.subject) headers["subject"] = mailtoComponents.subject;
6360
+ if (mailtoComponents.body) headers["body"] = mailtoComponents.body;
6361
+ var fields = [];
6362
+ for (var name in headers) {
6363
+ if (headers[name] !== O[name]) {
6364
+ 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));
6365
+ }
6366
+ }
6367
+ if (fields.length) {
6368
+ components.query = fields.join("&");
6369
+ }
6370
+ return components;
5773
6371
  }
6372
+ };
5774
6373
 
5775
- if (!schemeHandler || (schemeHandler && !schemeHandler.skipNormalize)) {
5776
- if (gotEncoding && parsed.scheme !== undefined) {
5777
- parsed.scheme = unescape(parsed.scheme);
5778
- }
5779
- if (gotEncoding && parsed.host !== undefined) {
5780
- parsed.host = unescape(parsed.host);
5781
- }
5782
- if (parsed.path) {
5783
- parsed.path = escape(unescape(parsed.path));
5784
- }
5785
- if (parsed.fragment) {
5786
- parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
5787
- }
6374
+ var URN_PARSE = /^([^\:]+)\:(.*)/;
6375
+ //RFC 2141
6376
+ var handler$5 = {
6377
+ scheme: "urn",
6378
+ parse: function parse$$1(components, options) {
6379
+ var matches = components.path && components.path.match(URN_PARSE);
6380
+ var urnComponents = components;
6381
+ if (matches) {
6382
+ var scheme = options.scheme || urnComponents.scheme || "urn";
6383
+ var nid = matches[1].toLowerCase();
6384
+ var nss = matches[2];
6385
+ var urnScheme = scheme + ":" + (options.nid || nid);
6386
+ var schemeHandler = SCHEMES[urnScheme];
6387
+ urnComponents.nid = nid;
6388
+ urnComponents.nss = nss;
6389
+ urnComponents.path = undefined;
6390
+ if (schemeHandler) {
6391
+ urnComponents = schemeHandler.parse(urnComponents, options);
6392
+ }
6393
+ } else {
6394
+ urnComponents.error = urnComponents.error || "URN can not be parsed.";
6395
+ }
6396
+ return urnComponents;
6397
+ },
6398
+ serialize: function serialize$$1(urnComponents, options) {
6399
+ var scheme = options.scheme || urnComponents.scheme || "urn";
6400
+ var nid = urnComponents.nid;
6401
+ var urnScheme = scheme + ":" + (options.nid || nid);
6402
+ var schemeHandler = SCHEMES[urnScheme];
6403
+ if (schemeHandler) {
6404
+ urnComponents = schemeHandler.serialize(urnComponents, options);
6405
+ }
6406
+ var uriComponents = urnComponents;
6407
+ var nss = urnComponents.nss;
6408
+ uriComponents.path = (nid || options.nid) + ":" + nss;
6409
+ return uriComponents;
5788
6410
  }
6411
+ };
5789
6412
 
5790
- // perform scheme specific parsing
5791
- if (schemeHandler && schemeHandler.parse) {
5792
- schemeHandler.parse(parsed, options);
6413
+ var UUID = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/;
6414
+ //RFC 4122
6415
+ var handler$6 = {
6416
+ scheme: "urn:uuid",
6417
+ parse: function parse(urnComponents, options) {
6418
+ var uuidComponents = urnComponents;
6419
+ uuidComponents.uuid = uuidComponents.nss;
6420
+ uuidComponents.nss = undefined;
6421
+ if (!options.tolerant && (!uuidComponents.uuid || !uuidComponents.uuid.match(UUID))) {
6422
+ uuidComponents.error = uuidComponents.error || "UUID is not valid.";
6423
+ }
6424
+ return uuidComponents;
6425
+ },
6426
+ serialize: function serialize(uuidComponents, options) {
6427
+ var urnComponents = uuidComponents;
6428
+ //normalize UUID
6429
+ urnComponents.nss = (uuidComponents.uuid || "").toLowerCase();
6430
+ return urnComponents;
5793
6431
  }
5794
- } else {
5795
- parsed.error = parsed.error || 'URI can not be parsed.';
5796
- }
5797
- return parsed
5798
- }
5799
-
5800
- const fastUri = {
5801
- SCHEMES,
5802
- normalize,
5803
- resolve,
5804
- resolveComponents,
5805
- equal: equal$2,
5806
- serialize,
5807
- parse
5808
6432
  };
5809
6433
 
5810
- fastUri$1.exports = fastUri;
5811
- fastUri$1.exports.default = fastUri;
5812
- fastUri$1.exports.fastUri = fastUri;
6434
+ SCHEMES[handler.scheme] = handler;
6435
+ SCHEMES[handler$1.scheme] = handler$1;
6436
+ SCHEMES[handler$2.scheme] = handler$2;
6437
+ SCHEMES[handler$3.scheme] = handler$3;
6438
+ SCHEMES[handler$4.scheme] = handler$4;
6439
+ SCHEMES[handler$5.scheme] = handler$5;
6440
+ SCHEMES[handler$6.scheme] = handler$6;
6441
+
6442
+ exports.SCHEMES = SCHEMES;
6443
+ exports.pctEncChar = pctEncChar;
6444
+ exports.pctDecChars = pctDecChars;
6445
+ exports.parse = parse;
6446
+ exports.removeDotSegments = removeDotSegments;
6447
+ exports.serialize = serialize;
6448
+ exports.resolveComponents = resolveComponents;
6449
+ exports.resolve = resolve;
6450
+ exports.normalize = normalize;
6451
+ exports.equal = equal;
6452
+ exports.escapeComponent = escapeComponent;
6453
+ exports.unescapeComponent = unescapeComponent;
6454
+
6455
+ Object.defineProperty(exports, '__esModule', { value: true });
6456
+
6457
+ })));
6458
+
6459
+ }(uri_all, uri_all.exports));
5813
6460
 
5814
6461
  Object.defineProperty(uri$1, "__esModule", { value: true });
5815
- const uri = fastUri$1.exports;
6462
+ const uri = uri_all.exports;
5816
6463
  uri.code = 'require("ajv/dist/runtime/uri").default';
5817
6464
  uri$1.default = uri;
5818
6465
 
@@ -5833,7 +6480,7 @@ const ref_error_1 = ref_error;
5833
6480
  const rules_1 = rules;
5834
6481
  const compile_1 = compile;
5835
6482
  const codegen_2 = codegen;
5836
- const resolve_1 = resolve$2;
6483
+ const resolve_1 = resolve$1;
5837
6484
  const dataType_1 = dataType;
5838
6485
  const util_1 = util;
5839
6486
  const $dataRefSchema = require$$9;
@@ -8949,7 +9596,7 @@ var validate = function validate(rule, instance) {
8949
9596
  message = _theRule.message;
8950
9597
  var valid = true;
8951
9598
  if (isExpression(validator)) {
8952
- valid = _executeExpression(validator, instance);
9599
+ valid = executeExpression(validator, instance);
8953
9600
  } else if (typeof validator === 'function') {
8954
9601
  valid = validator(instance);
8955
9602
  // eslint-disable-next-line no-eval
@@ -9113,7 +9760,7 @@ var validateFormWithResult = function validateFormWithResult(widgetTree) {
9113
9760
  };
9114
9761
  // 校验schema是否正常
9115
9762
  var validateSchema = /*#__PURE__*/function () {
9116
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(schema) {
9763
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(schema) {
9117
9764
  return _regeneratorRuntime().wrap(function _callee$(_context) {
9118
9765
  while (1) switch (_context.prev = _context.next) {
9119
9766
  case 0:
@@ -9338,7 +9985,7 @@ var Widget = Vue.extend({
9338
9985
  },
9339
9986
  loadDataSource: function loadDataSource() {
9340
9987
  var _this3 = this;
9341
- return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
9988
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
9342
9989
  var _this3$widgetSchema, _this3$widgetSchema$u, _this3$widgetSchema$u2;
9343
9990
  var xhrConfig, url, params, reset, _this3$httpAdapter, _this3$httpAdapter$re, http, responseParse, remoteURL, requestParams;
9344
9991
  return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -9353,8 +10000,8 @@ var Widget = Vue.extend({
9353
10000
  _this3$httpAdapter = _this3.httpAdapter, _this3$httpAdapter$re = _this3$httpAdapter.request, http = _this3$httpAdapter$re === void 0 ? request : _this3$httpAdapter$re, responseParse = _this3$httpAdapter.responseParse;
9354
10001
  _context.prev = 4;
9355
10002
  _this3.loading = true;
9356
- remoteURL = _executeExpression(url, _this3);
9357
- requestParams = isObj(params) ? _executeExpression(params, _this3) : params;
10003
+ remoteURL = executeExpression(url, _this3);
10004
+ requestParams = isObj(params) ? executeExpression(params, _this3) : params;
9358
10005
  _context.next = 10;
9359
10006
  return http(remoteURL, _objectSpread2(_objectSpread2({}, reset), {}, {
9360
10007
  params: requestParams,
@@ -10535,17 +11182,17 @@ var CommonGroupWrap = Vue.extend({
10535
11182
  }
10536
11183
  };
10537
11184
  },
10538
- created: function created() {
10539
- // 注册widget TreeNode
10540
- this.widgetTree.addWidgetNode(this.path, this, 'group');
10541
- },
11185
+ // created() {
11186
+ // // 注册widget TreeNode
11187
+ // this.widgetTree.addWidgetNode(this.path, this, 'group');
11188
+ // },
10542
11189
  mounted: function mounted() {
10543
11190
  // 更新样式
10544
11191
  this.$forceUpdate();
10545
11192
  },
10546
- beforeDestroy: function beforeDestroy() {
10547
- this.widgetTree.removeWidgetNode(this.path, this);
10548
- },
11193
+ // beforeDestroy() {
11194
+ // this.widgetTree.removeWidgetNode(this.path, this);
11195
+ // },
10549
11196
  methods: {
10550
11197
  setState: function setState(key, value) {
10551
11198
  if (Reflect.has(this.state, key)) {
@@ -11051,7 +11698,7 @@ var UploadWidget = Vue.extend({
11051
11698
  options.fileObj.xhr = xhr;
11052
11699
  var formData = new FormData();
11053
11700
  options.data.forEach(function (item) {
11054
- formData.append(item.name, _executeExpression(item.value, _this.$parent.$parent));
11701
+ formData.append(item.name, executeExpression(item.value, _this.$parent.$parent));
11055
11702
  });
11056
11703
  formData.append(options.fileName, options.fileObj.origin);
11057
11704
  xhr.onreadystatechange = function () {
@@ -11074,12 +11721,12 @@ var UploadWidget = Vue.extend({
11074
11721
  if (Array.isArray(options.header)) {
11075
11722
  options.header.forEach(function (head) {
11076
11723
  var headerKey = head.name;
11077
- var headerVal = _executeExpression(head.value, _this.$parent.$parent);
11724
+ var headerVal = executeExpression(head.value, _this.$parent.$parent);
11078
11725
  xhr.setRequestHeader(headerKey, headerVal);
11079
11726
  });
11080
11727
  } else {
11081
11728
  var headerKey = options.header.name;
11082
- var headerVal = _executeExpression(options.header.value, this.$parent.$parent);
11729
+ var headerVal = executeExpression(options.header.value, this.$parent.$parent);
11083
11730
  xhr.setRequestHeader(headerKey, headerVal);
11084
11731
  }
11085
11732
  }
@@ -11103,13 +11750,13 @@ var UploadWidget = Vue.extend({
11103
11750
  handleResCode: function handleResCode(res) {
11104
11751
  var successed = true;
11105
11752
  if (this.isUploadSuccessed) {
11106
- successed = _executeExpression(this.isUploadSuccessed, this.$parent.$parent, [], {
11753
+ successed = executeExpression(this.isUploadSuccessed, this.$parent.$parent, [], {
11107
11754
  response: res
11108
11755
  });
11109
11756
  }
11110
11757
  if (!successed) return;
11111
11758
  if (this.responseHandler) {
11112
- var files = _executeExpression(this.responseHandler, this.$parent.$parent, [], {
11759
+ var files = executeExpression(this.responseHandler, this.$parent.$parent, [], {
11113
11760
  response: res
11114
11761
  });
11115
11762
  this.$emit('input', files);
@@ -11447,7 +12094,7 @@ function createForm() {
11447
12094
  },
11448
12095
  methods: {
11449
12096
  initFormData: function initFormData() {
11450
- this.rootData = _merge(Schema.getSchemaDefaultValue(createProxy(this.schema, this)) || {}, this.value);
12097
+ this.rootData = merge(Schema.getSchemaDefaultValue(createProxy(this.schema, this)) || {}, this.value);
11451
12098
  this.emitFormValueChange(this.rootData, this.value);
11452
12099
  },
11453
12100
  emitFormValueChange: function emitFormValueChange(newValue, oldValue) {