@blueking/bkui-form 0.0.44 → 0.0.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -190,7 +190,7 @@
190
190
  i = _objectWithoutPropertiesLoose(e, t);
191
191
  if (Object.getOwnPropertySymbols) {
192
192
  var n = Object.getOwnPropertySymbols(e);
193
- for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
193
+ for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
194
194
  }
195
195
  return i;
196
196
  }
@@ -198,7 +198,7 @@
198
198
  if (null == r) return {};
199
199
  var t = {};
200
200
  for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
201
- if (e.indexOf(n) >= 0) continue;
201
+ if (-1 !== e.indexOf(n)) continue;
202
202
  t[n] = r[n];
203
203
  }
204
204
  return t;
@@ -592,11 +592,11 @@
592
592
  }
593
593
  return _typeof(value);
594
594
  };
595
- var merge = function merge(target, source) {
595
+ var _merge = function merge(target, source) {
596
596
  if (isObj(source)) {
597
597
  return Object.keys(source).reduce(function (pre, key) {
598
598
  var _target;
599
- pre[key] = merge(((_target = target) === null || _target === void 0 ? void 0 : _target[key]) || {}, source[key]);
599
+ pre[key] = _merge(((_target = target) === null || _target === void 0 ? void 0 : _target[key]) || {}, source[key]);
600
600
  return pre;
601
601
  }, JSON.parse(JSON.stringify(target)));
602
602
  }
@@ -604,7 +604,7 @@
604
604
  target = Array.isArray(target) ? target : [];
605
605
  return source.map(function (item, index) {
606
606
  if (target[index]) {
607
- return merge(target[index], item);
607
+ return _merge(target[index], item);
608
608
  }
609
609
  return item;
610
610
  });
@@ -1375,8 +1375,8 @@
1375
1375
  headers: {},
1376
1376
  cache: 'no-cache'
1377
1377
  };
1378
- var request = ( /*#__PURE__*/(function () {
1379
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(url) {
1378
+ var request = (/*#__PURE__*/function () {
1379
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(url) {
1380
1380
  var config,
1381
1381
  _mergeDeep,
1382
1382
  params,
@@ -1485,7 +1485,7 @@
1485
1485
  return function (_x) {
1486
1486
  return _ref.apply(this, arguments);
1487
1487
  };
1488
- })());
1488
+ }());
1489
1489
 
1490
1490
  var props$1 = {
1491
1491
  // 表单值
@@ -1722,7 +1722,7 @@
1722
1722
  }
1723
1723
  };
1724
1724
  };
1725
- var executeExpression = function executeExpression(expression, instance) {
1725
+ var _executeExpression = function executeExpression(expression, instance) {
1726
1726
  var $dep = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
1727
1727
  var $args = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1728
1728
  var _getContext = getContext(instance),
@@ -1780,7 +1780,7 @@
1780
1780
  }
1781
1781
  if (isObj(expression)) {
1782
1782
  Object.keys(expression).forEach(function (key) {
1783
- expression[key] = executeExpression(expression[key], instance);
1783
+ expression[key] = _executeExpression(expression[key], instance);
1784
1784
  });
1785
1785
  return expression;
1786
1786
  }
@@ -1826,6 +1826,7 @@
1826
1826
  crtInstance = _ref.instance; // 当前组件实例,用来条件表达式判断
1827
1827
  var _ref2 = widgetTree.widgetMap[targetPath] || {},
1828
1828
  operateInstance = _ref2.instance; // 需要执行操作的组件实例,可能为其他组件也可能为当前组件
1829
+ if (!crtInstance || !operateInstance) return;
1829
1830
  var fullfill = true;
1830
1831
  var deps = [];
1831
1832
  if (reaction.source) {
@@ -1836,7 +1837,7 @@
1836
1837
  });
1837
1838
  }
1838
1839
  if (typeof reaction.if === 'string') {
1839
- fullfill = executeExpression(reaction.if, crtInstance, deps);
1840
+ fullfill = _executeExpression(reaction.if, crtInstance, deps);
1840
1841
  }
1841
1842
  var operations = fullfill ? reaction.then : reaction.else;
1842
1843
  executeOperations(operations, operateInstance, deps);
@@ -1848,20 +1849,20 @@
1848
1849
  Object.keys(operations.state).forEach(function (key) {
1849
1850
  var val = operations.state[key];
1850
1851
  if (typeof val === 'string' && /^{{.+}}$/.test(val.trim())) {
1851
- val = executeExpression(val, instance, deps);
1852
+ val = _executeExpression(val, instance, deps);
1852
1853
  }
1853
1854
  instance.setState(key, val);
1854
1855
  });
1855
1856
  }
1856
1857
  if (Array.isArray(operations.actions)) {
1857
1858
  operations.actions.forEach(function (item) {
1858
- executeExpression(item, instance, deps);
1859
+ _executeExpression(item, instance, deps);
1859
1860
  });
1860
1861
  }
1861
1862
  }
1862
1863
  };
1863
1864
  var parsePath = function parsePath(path, instance) {
1864
- return isExpression(path) ? executeExpression(path, instance) : path;
1865
+ return isExpression(path) ? _executeExpression(path, instance) : path;
1865
1866
  };
1866
1867
  var reactionRegister = function reactionRegister(path) {
1867
1868
  var reactions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
@@ -1914,8 +1915,6 @@
1914
1915
  }
1915
1916
  };
1916
1917
 
1917
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
1918
-
1919
1918
  function getDefaultExportFromCjs (x) {
1920
1919
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
1921
1920
  }
@@ -1937,6 +1936,7 @@
1937
1936
  (function (exports) {
1938
1937
  Object.defineProperty(exports, "__esModule", { value: true });
1939
1938
  exports.regexpCode = exports.getEsmExportName = exports.getProperty = exports.safeStringify = exports.stringify = exports.strConcat = exports.addCodeArg = exports.str = exports._ = exports.nil = exports._Code = exports.Name = exports.IDENTIFIER = exports._CodeOrName = void 0;
1939
+ // eslint-disable-next-line @typescript-eslint/no-extraneous-class
1940
1940
  class _CodeOrName {
1941
1941
  }
1942
1942
  exports._CodeOrName = _CodeOrName;
@@ -3945,7 +3945,7 @@
3945
3945
  }
3946
3946
  subschema.extendSubschemaMode = extendSubschemaMode;
3947
3947
 
3948
- var resolve$1 = {};
3948
+ var resolve$2 = {};
3949
3949
 
3950
3950
  // do not edit .js files directly - edit src/index.jst
3951
3951
 
@@ -4086,10 +4086,10 @@
4086
4086
  return str.replace(/~/g, '~0').replace(/\//g, '~1');
4087
4087
  }
4088
4088
 
4089
- Object.defineProperty(resolve$1, "__esModule", { value: true });
4090
- resolve$1.getSchemaRefs = resolve$1.resolveUrl = resolve$1.normalizeId = resolve$1._getFullPath = resolve$1.getFullPath = resolve$1.inlineRef = void 0;
4089
+ Object.defineProperty(resolve$2, "__esModule", { value: true });
4090
+ resolve$2.getSchemaRefs = resolve$2.resolveUrl = resolve$2.normalizeId = resolve$2._getFullPath = resolve$2.getFullPath = resolve$2.inlineRef = void 0;
4091
4091
  const util_1$m = util;
4092
- const equal$2 = fastDeepEqual;
4092
+ const equal$3 = fastDeepEqual;
4093
4093
  const traverse = jsonSchemaTraverse.exports;
4094
4094
  // TODO refactor to use keyword definitions
4095
4095
  const SIMPLE_INLINED = new Set([
@@ -4119,7 +4119,7 @@
4119
4119
  return false;
4120
4120
  return countKeys(schema) <= limit;
4121
4121
  }
4122
- resolve$1.inlineRef = inlineRef;
4122
+ resolve$2.inlineRef = inlineRef;
4123
4123
  const REF_KEYWORDS = new Set([
4124
4124
  "$ref",
4125
4125
  "$recursiveRef",
@@ -4161,22 +4161,22 @@
4161
4161
  const p = resolver.parse(id);
4162
4162
  return _getFullPath(resolver, p);
4163
4163
  }
4164
- resolve$1.getFullPath = getFullPath;
4164
+ resolve$2.getFullPath = getFullPath;
4165
4165
  function _getFullPath(resolver, p) {
4166
4166
  const serialized = resolver.serialize(p);
4167
4167
  return serialized.split("#")[0] + "#";
4168
4168
  }
4169
- resolve$1._getFullPath = _getFullPath;
4169
+ resolve$2._getFullPath = _getFullPath;
4170
4170
  const TRAILING_SLASH_HASH = /#\/?$/;
4171
4171
  function normalizeId(id) {
4172
4172
  return id ? id.replace(TRAILING_SLASH_HASH, "") : "";
4173
4173
  }
4174
- resolve$1.normalizeId = normalizeId;
4174
+ resolve$2.normalizeId = normalizeId;
4175
4175
  function resolveUrl(resolver, baseId, id) {
4176
4176
  id = normalizeId(id);
4177
4177
  return resolver.resolve(baseId, id);
4178
4178
  }
4179
- resolve$1.resolveUrl = resolveUrl;
4179
+ resolve$2.resolveUrl = resolveUrl;
4180
4180
  const ANCHOR = /^[a-z_][-a-z0-9._]*$/i;
4181
4181
  function getSchemaRefs(schema, baseId) {
4182
4182
  if (typeof schema == "boolean")
@@ -4231,14 +4231,14 @@
4231
4231
  });
4232
4232
  return localRefs;
4233
4233
  function checkAmbiguosRef(sch1, sch2, ref) {
4234
- if (sch2 !== undefined && !equal$2(sch1, sch2))
4234
+ if (sch2 !== undefined && !equal$3(sch1, sch2))
4235
4235
  throw ambiguos(ref);
4236
4236
  }
4237
4237
  function ambiguos(ref) {
4238
4238
  return new Error(`reference "${ref}" resolves to more than one schema`);
4239
4239
  }
4240
4240
  }
4241
- resolve$1.getSchemaRefs = getSchemaRefs;
4241
+ resolve$2.getSchemaRefs = getSchemaRefs;
4242
4242
 
4243
4243
  Object.defineProperty(validate$1, "__esModule", { value: true });
4244
4244
  validate$1.getData = validate$1.KeywordCxt = validate$1.validateFunctionCode = void 0;
@@ -4251,7 +4251,7 @@
4251
4251
  const subschema_1 = subschema;
4252
4252
  const codegen_1$n = codegen;
4253
4253
  const names_1$3 = names$1;
4254
- const resolve_1$2 = resolve$1;
4254
+ const resolve_1$2 = resolve$2;
4255
4255
  const util_1$l = util;
4256
4256
  const errors_1 = errors;
4257
4257
  // schema compilation - generates validation function, subschemaCode (below) is used for subschemas
@@ -4773,7 +4773,7 @@
4773
4773
  var ref_error = {};
4774
4774
 
4775
4775
  Object.defineProperty(ref_error, "__esModule", { value: true });
4776
- const resolve_1$1 = resolve$1;
4776
+ const resolve_1$1 = resolve$2;
4777
4777
  class MissingRefError extends Error {
4778
4778
  constructor(resolver, baseId, ref, msg) {
4779
4779
  super(msg || `can't resolve reference ${ref} from id ${baseId}`);
@@ -4790,7 +4790,7 @@
4790
4790
  const codegen_1$m = codegen;
4791
4791
  const validation_error_1 = validation_error;
4792
4792
  const names_1$2 = names$1;
4793
- const resolve_1 = resolve$1;
4793
+ const resolve_1 = resolve$2;
4794
4794
  const util_1$k = util;
4795
4795
  const validate_1$1 = validate$1;
4796
4796
  class SchemaEnv {
@@ -4916,7 +4916,7 @@
4916
4916
  const schOrFunc = root.refs[ref];
4917
4917
  if (schOrFunc)
4918
4918
  return schOrFunc;
4919
- let _sch = resolve.call(this, root, ref);
4919
+ let _sch = resolve$1.call(this, root, ref);
4920
4920
  if (_sch === undefined) {
4921
4921
  const schema = (_a = root.localRefs) === null || _a === void 0 ? void 0 : _a[ref]; // TODO maybe localRefs should hold SchemaEnv
4922
4922
  const { schemaId } = this.opts;
@@ -4946,7 +4946,7 @@
4946
4946
  }
4947
4947
  // resolve and compile the references ($ref)
4948
4948
  // TODO returns AnySchemaObject (if the schema can be inlined) or validation function
4949
- function resolve(root, // information about the root schema for the current schema
4949
+ function resolve$1(root, // information about the root schema for the current schema
4950
4950
  ref // reference to resolve
4951
4951
  ) {
4952
4952
  let sch;
@@ -5057,1416 +5057,770 @@
5057
5057
 
5058
5058
  var uri$1 = {};
5059
5059
 
5060
- var uri_all = {exports: {}};
5061
-
5062
- /** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */
5063
-
5064
- (function (module, exports) {
5065
- (function (global, factory) {
5066
- factory(exports) ;
5067
- }(commonjsGlobal, (function (exports) {
5068
- function merge() {
5069
- for (var _len = arguments.length, sets = Array(_len), _key = 0; _key < _len; _key++) {
5070
- sets[_key] = arguments[_key];
5071
- }
5072
-
5073
- if (sets.length > 1) {
5074
- sets[0] = sets[0].slice(0, -1);
5075
- var xl = sets.length - 1;
5076
- for (var x = 1; x < xl; ++x) {
5077
- sets[x] = sets[x].slice(1, -1);
5078
- }
5079
- sets[xl] = sets[xl].slice(1);
5080
- return sets.join('');
5081
- } else {
5082
- return sets[0];
5083
- }
5084
- }
5085
- function subexp(str) {
5086
- return "(?:" + str + ")";
5087
- }
5088
- function typeOf(o) {
5089
- return o === undefined ? "undefined" : o === null ? "null" : Object.prototype.toString.call(o).split(" ").pop().split("]").shift().toLowerCase();
5090
- }
5091
- function toUpperCase(str) {
5092
- return str.toUpperCase();
5093
- }
5094
- function toArray(obj) {
5095
- 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) : [];
5096
- }
5097
- function assign(target, source) {
5098
- var obj = target;
5099
- if (source) {
5100
- for (var key in source) {
5101
- obj[key] = source[key];
5102
- }
5103
- }
5104
- return obj;
5105
- }
5106
-
5107
- function buildExps(isIRI) {
5108
- var ALPHA$$ = "[A-Za-z]",
5109
- DIGIT$$ = "[0-9]",
5110
- HEXDIG$$ = merge(DIGIT$$, "[A-Fa-f]"),
5111
- PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)),
5112
- //expanded
5113
- GEN_DELIMS$$ = "[\\:\\/\\?\\#\\[\\]\\@]",
5114
- SUB_DELIMS$$ = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",
5115
- RESERVED$$ = merge(GEN_DELIMS$$, SUB_DELIMS$$),
5116
- UCSCHAR$$ = isIRI ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]",
5117
- //subset, excludes bidi control characters
5118
- IPRIVATE$$ = isIRI ? "[\\uE000-\\uF8FF]" : "[]",
5119
- //subset
5120
- UNRESERVED$$ = merge(ALPHA$$, DIGIT$$, "[\\-\\.\\_\\~]", UCSCHAR$$);
5121
- subexp(ALPHA$$ + merge(ALPHA$$, DIGIT$$, "[\\+\\-\\.]") + "*");
5122
- subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]")) + "*");
5123
- 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$$),
5124
- //relaxed parsing rules
5125
- IPV4ADDRESS$ = subexp(DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$),
5126
- H16$ = subexp(HEXDIG$$ + "{1,4}"),
5127
- LS32$ = subexp(subexp(H16$ + "\\:" + H16$) + "|" + IPV4ADDRESS$),
5128
- IPV6ADDRESS1$ = subexp(subexp(H16$ + "\\:") + "{6}" + LS32$),
5129
- // 6( h16 ":" ) ls32
5130
- IPV6ADDRESS2$ = subexp("\\:\\:" + subexp(H16$ + "\\:") + "{5}" + LS32$),
5131
- // "::" 5( h16 ":" ) ls32
5132
- IPV6ADDRESS3$ = subexp(subexp(H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{4}" + LS32$),
5133
- //[ h16 ] "::" 4( h16 ":" ) ls32
5134
- IPV6ADDRESS4$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,1}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{3}" + LS32$),
5135
- //[ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
5136
- IPV6ADDRESS5$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,2}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{2}" + LS32$),
5137
- //[ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
5138
- IPV6ADDRESS6$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,3}" + H16$) + "?\\:\\:" + H16$ + "\\:" + LS32$),
5139
- //[ *3( h16 ":" ) h16 ] "::" h16 ":" ls32
5140
- IPV6ADDRESS7$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,4}" + H16$) + "?\\:\\:" + LS32$),
5141
- //[ *4( h16 ":" ) h16 ] "::" ls32
5142
- IPV6ADDRESS8$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,5}" + H16$) + "?\\:\\:" + H16$),
5143
- //[ *5( h16 ":" ) h16 ] "::" h16
5144
- IPV6ADDRESS9$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,6}" + H16$) + "?\\:\\:"),
5145
- //[ *6( h16 ":" ) h16 ] "::"
5146
- IPV6ADDRESS$ = subexp([IPV6ADDRESS1$, IPV6ADDRESS2$, IPV6ADDRESS3$, IPV6ADDRESS4$, IPV6ADDRESS5$, IPV6ADDRESS6$, IPV6ADDRESS7$, IPV6ADDRESS8$, IPV6ADDRESS9$].join("|")),
5147
- ZONEID$ = subexp(subexp(UNRESERVED$$ + "|" + PCT_ENCODED$) + "+");
5148
- //RFC 6874, with relaxed parsing rules
5149
- subexp("[vV]" + HEXDIG$$ + "+\\." + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]") + "+");
5150
- //RFC 6874
5151
- subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$)) + "*");
5152
- var PCHAR$ = subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@]"));
5153
- subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\@]")) + "+");
5154
- subexp(subexp(PCHAR$ + "|" + merge("[\\/\\?]", IPRIVATE$$)) + "*");
5155
- return {
5156
- NOT_SCHEME: new RegExp(merge("[^]", ALPHA$$, DIGIT$$, "[\\+\\-\\.]"), "g"),
5157
- NOT_USERINFO: new RegExp(merge("[^\\%\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"),
5158
- NOT_HOST: new RegExp(merge("[^\\%\\[\\]\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"),
5159
- NOT_PATH: new RegExp(merge("[^\\%\\/\\:\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"),
5160
- NOT_PATH_NOSCHEME: new RegExp(merge("[^\\%\\/\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"),
5161
- NOT_QUERY: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]", IPRIVATE$$), "g"),
5162
- NOT_FRAGMENT: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]"), "g"),
5163
- ESCAPE: new RegExp(merge("[^]", UNRESERVED$$, SUB_DELIMS$$), "g"),
5164
- UNRESERVED: new RegExp(UNRESERVED$$, "g"),
5165
- OTHER_CHARS: new RegExp(merge("[^\\%]", UNRESERVED$$, RESERVED$$), "g"),
5166
- PCT_ENCODED: new RegExp(PCT_ENCODED$, "g"),
5167
- IPV4ADDRESS: new RegExp("^(" + IPV4ADDRESS$ + ")$"),
5168
- IPV6ADDRESS: new RegExp("^\\[?(" + IPV6ADDRESS$ + ")" + subexp(subexp("\\%25|\\%(?!" + HEXDIG$$ + "{2})") + "(" + ZONEID$ + ")") + "?\\]?$") //RFC 6874, with relaxed parsing rules
5169
- };
5060
+ var fastUri$1 = {exports: {}};
5061
+
5062
+ const HEX$1 = {
5063
+ 0: 0,
5064
+ 1: 1,
5065
+ 2: 2,
5066
+ 3: 3,
5067
+ 4: 4,
5068
+ 5: 5,
5069
+ 6: 6,
5070
+ 7: 7,
5071
+ 8: 8,
5072
+ 9: 9,
5073
+ a: 10,
5074
+ A: 10,
5075
+ b: 11,
5076
+ B: 11,
5077
+ c: 12,
5078
+ C: 12,
5079
+ d: 13,
5080
+ D: 13,
5081
+ e: 14,
5082
+ E: 14,
5083
+ f: 15,
5084
+ F: 15
5085
+ };
5086
+
5087
+ var scopedChars = {
5088
+ HEX: HEX$1
5089
+ };
5090
+
5091
+ const { HEX } = scopedChars;
5092
+
5093
+ const IPV4_REG = /^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u;
5094
+
5095
+ function normalizeIPv4$1 (host) {
5096
+ if (findToken(host, '.') < 3) { return { host, isIPV4: false } }
5097
+ const matches = host.match(IPV4_REG) || [];
5098
+ const [address] = matches;
5099
+ if (address) {
5100
+ return { host: stripLeadingZeros(address, '.'), isIPV4: true }
5101
+ } else {
5102
+ return { host, isIPV4: false }
5103
+ }
5170
5104
  }
5171
- var URI_PROTOCOL = buildExps(false);
5172
-
5173
- var IRI_PROTOCOL = buildExps(true);
5174
-
5175
- var slicedToArray = function () {
5176
- function sliceIterator(arr, i) {
5177
- var _arr = [];
5178
- var _n = true;
5179
- var _d = false;
5180
- var _e = undefined;
5181
5105
 
5182
- try {
5183
- for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
5184
- _arr.push(_s.value);
5106
+ /**
5107
+ * @param {string[]} input
5108
+ * @param {boolean} [keepZero=false]
5109
+ * @returns {string|undefined}
5110
+ */
5111
+ function stringArrayToHexStripped (input, keepZero = false) {
5112
+ let acc = '';
5113
+ let strip = true;
5114
+ for (const c of input) {
5115
+ if (HEX[c] === undefined) return undefined
5116
+ if (c !== '0' && strip === true) strip = false;
5117
+ if (!strip) acc += c;
5118
+ }
5119
+ if (keepZero && acc.length === 0) acc = '0';
5120
+ return acc
5121
+ }
5122
+
5123
+ function getIPV6 (input) {
5124
+ let tokenCount = 0;
5125
+ const output = { error: false, address: '', zone: '' };
5126
+ const address = [];
5127
+ const buffer = [];
5128
+ let isZone = false;
5129
+ let endipv6Encountered = false;
5130
+ let endIpv6 = false;
5131
+
5132
+ function consume () {
5133
+ if (buffer.length) {
5134
+ if (isZone === false) {
5135
+ const hex = stringArrayToHexStripped(buffer);
5136
+ if (hex !== undefined) {
5137
+ address.push(hex);
5138
+ } else {
5139
+ output.error = true;
5140
+ return false
5141
+ }
5142
+ }
5143
+ buffer.length = 0;
5144
+ }
5145
+ return true
5146
+ }
5185
5147
 
5186
- if (i && _arr.length === i) break;
5148
+ for (let i = 0; i < input.length; i++) {
5149
+ const cursor = input[i];
5150
+ if (cursor === '[' || cursor === ']') { continue }
5151
+ if (cursor === ':') {
5152
+ if (endipv6Encountered === true) {
5153
+ endIpv6 = true;
5187
5154
  }
5188
- } catch (err) {
5189
- _d = true;
5190
- _e = err;
5191
- } finally {
5192
- try {
5193
- if (!_n && _i["return"]) _i["return"]();
5194
- } finally {
5195
- if (_d) throw _e;
5155
+ if (!consume()) { break }
5156
+ tokenCount++;
5157
+ address.push(':');
5158
+ if (tokenCount > 7) {
5159
+ // not valid
5160
+ output.error = true;
5161
+ break
5196
5162
  }
5163
+ if (i - 1 >= 0 && input[i - 1] === ':') {
5164
+ endipv6Encountered = true;
5165
+ }
5166
+ continue
5167
+ } else if (cursor === '%') {
5168
+ if (!consume()) { break }
5169
+ // switch to zone detection
5170
+ isZone = true;
5171
+ } else {
5172
+ buffer.push(cursor);
5173
+ continue
5197
5174
  }
5198
-
5199
- return _arr;
5200
5175
  }
5201
-
5202
- return function (arr, i) {
5203
- if (Array.isArray(arr)) {
5204
- return arr;
5205
- } else if (Symbol.iterator in Object(arr)) {
5206
- return sliceIterator(arr, i);
5176
+ if (buffer.length) {
5177
+ if (isZone) {
5178
+ output.zone = buffer.join('');
5179
+ } else if (endIpv6) {
5180
+ address.push(buffer.join(''));
5207
5181
  } else {
5208
- throw new TypeError("Invalid attempt to destructure non-iterable instance");
5182
+ address.push(stringArrayToHexStripped(buffer));
5209
5183
  }
5210
- };
5211
- }();
5212
-
5213
-
5214
-
5215
-
5216
-
5217
-
5218
-
5219
-
5220
-
5221
-
5222
-
5223
-
5184
+ }
5185
+ output.address = address.join('');
5186
+ return output
5187
+ }
5224
5188
 
5225
- var toConsumableArray = function (arr) {
5226
- if (Array.isArray(arr)) {
5227
- for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
5189
+ function normalizeIPv6$1 (host) {
5190
+ if (findToken(host, ':') < 2) { return { host, isIPV6: false } }
5191
+ const ipv6 = getIPV6(host);
5228
5192
 
5229
- return arr2;
5193
+ if (!ipv6.error) {
5194
+ let newHost = ipv6.address;
5195
+ let escapedHost = ipv6.address;
5196
+ if (ipv6.zone) {
5197
+ newHost += '%' + ipv6.zone;
5198
+ escapedHost += '%25' + ipv6.zone;
5199
+ }
5200
+ return { host: newHost, escapedHost, isIPV6: true }
5230
5201
  } else {
5231
- return Array.from(arr);
5202
+ return { host, isIPV6: false }
5232
5203
  }
5233
- };
5234
-
5235
- /** Highest positive signed 32-bit float value */
5236
-
5237
- var maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1
5238
-
5239
- /** Bootstring parameters */
5240
- var base = 36;
5241
- var tMin = 1;
5242
- var tMax = 26;
5243
- var skew = 38;
5244
- var damp = 700;
5245
- var initialBias = 72;
5246
- var initialN = 128; // 0x80
5247
- var delimiter = '-'; // '\x2D'
5248
-
5249
- /** Regular expressions */
5250
- var regexPunycode = /^xn--/;
5251
- var regexNonASCII = /[^\0-\x7E]/; // non-ASCII chars
5252
- var regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g; // RFC 3490 separators
5253
-
5254
- /** Error messages */
5255
- var errors = {
5256
- 'overflow': 'Overflow: input needs wider integers to process',
5257
- 'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
5258
- 'invalid-input': 'Invalid input'
5259
- };
5260
-
5261
- /** Convenience shortcuts */
5262
- var baseMinusTMin = base - tMin;
5263
- var floor = Math.floor;
5264
- var stringFromCharCode = String.fromCharCode;
5265
-
5266
- /*--------------------------------------------------------------------------*/
5267
-
5268
- /**
5269
- * A generic error utility function.
5270
- * @private
5271
- * @param {String} type The error type.
5272
- * @returns {Error} Throws a `RangeError` with the applicable error message.
5273
- */
5274
- function error$1(type) {
5275
- throw new RangeError(errors[type]);
5276
5204
  }
5277
5205
 
5278
- /**
5279
- * A generic `Array#map` utility function.
5280
- * @private
5281
- * @param {Array} array The array to iterate over.
5282
- * @param {Function} callback The function that gets called for every array
5283
- * item.
5284
- * @returns {Array} A new array of values returned by the callback function.
5285
- */
5286
- function map(array, fn) {
5287
- var result = [];
5288
- var length = array.length;
5289
- while (length--) {
5290
- result[length] = fn(array[length]);
5291
- }
5292
- return result;
5206
+ function stripLeadingZeros (str, token) {
5207
+ let out = '';
5208
+ let skip = true;
5209
+ const l = str.length;
5210
+ for (let i = 0; i < l; i++) {
5211
+ const c = str[i];
5212
+ if (c === '0' && skip) {
5213
+ if ((i + 1 <= l && str[i + 1] === token) || i + 1 === l) {
5214
+ out += c;
5215
+ skip = false;
5216
+ }
5217
+ } else {
5218
+ if (c === token) {
5219
+ skip = true;
5220
+ } else {
5221
+ skip = false;
5222
+ }
5223
+ out += c;
5224
+ }
5225
+ }
5226
+ return out
5293
5227
  }
5294
5228
 
5295
- /**
5296
- * A simple `Array#map`-like wrapper to work with domain name strings or email
5297
- * addresses.
5298
- * @private
5299
- * @param {String} domain The domain name or email address.
5300
- * @param {Function} callback The function that gets called for every
5301
- * character.
5302
- * @returns {Array} A new string of characters returned by the callback
5303
- * function.
5304
- */
5305
- function mapDomain(string, fn) {
5306
- var parts = string.split('@');
5307
- var result = '';
5308
- if (parts.length > 1) {
5309
- // In email addresses, only the domain name should be punycoded. Leave
5310
- // the local part (i.e. everything up to `@`) intact.
5311
- result = parts[0] + '@';
5312
- string = parts[1];
5313
- }
5314
- // Avoid `split(regex)` for IE8 compatibility. See #17.
5315
- string = string.replace(regexSeparators, '\x2E');
5316
- var labels = string.split('.');
5317
- var encoded = map(labels, fn).join('.');
5318
- return result + encoded;
5229
+ function findToken (str, token) {
5230
+ let ind = 0;
5231
+ for (let i = 0; i < str.length; i++) {
5232
+ if (str[i] === token) ind++;
5233
+ }
5234
+ return ind
5235
+ }
5236
+
5237
+ const RDS1 = /^\.\.?\//u;
5238
+ const RDS2 = /^\/\.(?:\/|$)/u;
5239
+ const RDS3 = /^\/\.\.(?:\/|$)/u;
5240
+ const RDS5 = /^\/?(?:.|\n)*?(?=\/|$)/u;
5241
+
5242
+ function removeDotSegments$1 (input) {
5243
+ const output = [];
5244
+
5245
+ while (input.length) {
5246
+ if (input.match(RDS1)) {
5247
+ input = input.replace(RDS1, '');
5248
+ } else if (input.match(RDS2)) {
5249
+ input = input.replace(RDS2, '/');
5250
+ } else if (input.match(RDS3)) {
5251
+ input = input.replace(RDS3, '/');
5252
+ output.pop();
5253
+ } else if (input === '.' || input === '..') {
5254
+ input = '';
5255
+ } else {
5256
+ const im = input.match(RDS5);
5257
+ if (im) {
5258
+ const s = im[0];
5259
+ input = input.slice(s.length);
5260
+ output.push(s);
5261
+ } else {
5262
+ throw new Error('Unexpected dot segment condition')
5263
+ }
5264
+ }
5265
+ }
5266
+ return output.join('')
5319
5267
  }
5320
5268
 
5321
- /**
5322
- * Creates an array containing the numeric code points of each Unicode
5323
- * character in the string. While JavaScript uses UCS-2 internally,
5324
- * this function will convert a pair of surrogate halves (each of which
5325
- * UCS-2 exposes as separate characters) into a single code point,
5326
- * matching UTF-16.
5327
- * @see `punycode.ucs2.encode`
5328
- * @see <https://mathiasbynens.be/notes/javascript-encoding>
5329
- * @memberOf punycode.ucs2
5330
- * @name decode
5331
- * @param {String} string The Unicode input string (UCS-2).
5332
- * @returns {Array} The new array of code points.
5333
- */
5334
- function ucs2decode(string) {
5335
- var output = [];
5336
- var counter = 0;
5337
- var length = string.length;
5338
- while (counter < length) {
5339
- var value = string.charCodeAt(counter++);
5340
- if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
5341
- // It's a high surrogate, and there is a next character.
5342
- var extra = string.charCodeAt(counter++);
5343
- if ((extra & 0xFC00) == 0xDC00) {
5344
- // Low surrogate.
5345
- output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
5346
- } else {
5347
- // It's an unmatched surrogate; only append this code unit, in case the
5348
- // next code unit is the high surrogate of a surrogate pair.
5349
- output.push(value);
5350
- counter--;
5351
- }
5352
- } else {
5353
- output.push(value);
5354
- }
5355
- }
5356
- return output;
5269
+ function normalizeComponentEncoding$1 (components, esc) {
5270
+ const func = esc !== true ? escape : unescape;
5271
+ if (components.scheme !== undefined) {
5272
+ components.scheme = func(components.scheme);
5273
+ }
5274
+ if (components.userinfo !== undefined) {
5275
+ components.userinfo = func(components.userinfo);
5276
+ }
5277
+ if (components.host !== undefined) {
5278
+ components.host = func(components.host);
5279
+ }
5280
+ if (components.path !== undefined) {
5281
+ components.path = func(components.path);
5282
+ }
5283
+ if (components.query !== undefined) {
5284
+ components.query = func(components.query);
5285
+ }
5286
+ if (components.fragment !== undefined) {
5287
+ components.fragment = func(components.fragment);
5288
+ }
5289
+ return components
5357
5290
  }
5358
5291
 
5359
- /**
5360
- * Creates a string based on an array of numeric code points.
5361
- * @see `punycode.ucs2.decode`
5362
- * @memberOf punycode.ucs2
5363
- * @name encode
5364
- * @param {Array} codePoints The array of numeric code points.
5365
- * @returns {String} The new Unicode string (UCS-2).
5366
- */
5367
- var ucs2encode = function ucs2encode(array) {
5368
- return String.fromCodePoint.apply(String, toConsumableArray(array));
5369
- };
5370
-
5371
- /**
5372
- * Converts a basic code point into a digit/integer.
5373
- * @see `digitToBasic()`
5374
- * @private
5375
- * @param {Number} codePoint The basic numeric code point value.
5376
- * @returns {Number} The numeric value of a basic code point (for use in
5377
- * representing integers) in the range `0` to `base - 1`, or `base` if
5378
- * the code point does not represent a value.
5379
- */
5380
- var basicToDigit = function basicToDigit(codePoint) {
5381
- if (codePoint - 0x30 < 0x0A) {
5382
- return codePoint - 0x16;
5383
- }
5384
- if (codePoint - 0x41 < 0x1A) {
5385
- return codePoint - 0x41;
5386
- }
5387
- if (codePoint - 0x61 < 0x1A) {
5388
- return codePoint - 0x61;
5389
- }
5390
- return base;
5391
- };
5392
-
5393
- /**
5394
- * Converts a digit/integer into a basic code point.
5395
- * @see `basicToDigit()`
5396
- * @private
5397
- * @param {Number} digit The numeric value of a basic code point.
5398
- * @returns {Number} The basic code point whose value (when used for
5399
- * representing integers) is `digit`, which needs to be in the range
5400
- * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
5401
- * used; else, the lowercase form is used. The behavior is undefined
5402
- * if `flag` is non-zero and `digit` has no uppercase form.
5403
- */
5404
- var digitToBasic = function digitToBasic(digit, flag) {
5405
- // 0..25 map to ASCII a..z or A..Z
5406
- // 26..35 map to ASCII 0..9
5407
- return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
5408
- };
5409
-
5410
- /**
5411
- * Bias adaptation function as per section 3.4 of RFC 3492.
5412
- * https://tools.ietf.org/html/rfc3492#section-3.4
5413
- * @private
5414
- */
5415
- var adapt = function adapt(delta, numPoints, firstTime) {
5416
- var k = 0;
5417
- delta = firstTime ? floor(delta / damp) : delta >> 1;
5418
- delta += floor(delta / numPoints);
5419
- for (; /* no initialization */delta > baseMinusTMin * tMax >> 1; k += base) {
5420
- delta = floor(delta / baseMinusTMin);
5421
- }
5422
- return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
5423
- };
5424
-
5425
- /**
5426
- * Converts a Punycode string of ASCII-only symbols to a string of Unicode
5427
- * symbols.
5428
- * @memberOf punycode
5429
- * @param {String} input The Punycode string of ASCII-only symbols.
5430
- * @returns {String} The resulting string of Unicode symbols.
5431
- */
5432
- var decode = function decode(input) {
5433
- // Don't use UCS-2.
5434
- var output = [];
5435
- var inputLength = input.length;
5436
- var i = 0;
5437
- var n = initialN;
5438
- var bias = initialBias;
5439
-
5440
- // Handle the basic code points: let `basic` be the number of input code
5441
- // points before the last delimiter, or `0` if there is none, then copy
5442
- // the first basic code points to the output.
5443
-
5444
- var basic = input.lastIndexOf(delimiter);
5445
- if (basic < 0) {
5446
- basic = 0;
5447
- }
5292
+ function recomposeAuthority$1 (components) {
5293
+ const uriTokens = [];
5448
5294
 
5449
- for (var j = 0; j < basic; ++j) {
5450
- // if it's not a basic code point
5451
- if (input.charCodeAt(j) >= 0x80) {
5452
- error$1('not-basic');
5453
- }
5454
- output.push(input.charCodeAt(j));
5455
- }
5456
-
5457
- // Main decoding loop: start just after the last delimiter if any basic code
5458
- // points were copied; start at the beginning otherwise.
5295
+ if (components.userinfo !== undefined) {
5296
+ uriTokens.push(components.userinfo);
5297
+ uriTokens.push('@');
5298
+ }
5459
5299
 
5460
- for (var index = basic > 0 ? basic + 1 : 0; index < inputLength;) /* no final expression */{
5300
+ if (components.host !== undefined) {
5301
+ let host = unescape(components.host);
5302
+ const ipV4res = normalizeIPv4$1(host);
5461
5303
 
5462
- // `index` is the index of the next character to be consumed.
5463
- // Decode a generalized variable-length integer into `delta`,
5464
- // which gets added to `i`. The overflow checking is easier
5465
- // if we increase `i` as we go, then subtract off its starting
5466
- // value at the end to obtain `delta`.
5467
- var oldi = i;
5468
- for (var w = 1, k = base;; /* no condition */k += base) {
5304
+ if (ipV4res.isIPV4) {
5305
+ host = ipV4res.host;
5306
+ } else {
5307
+ const ipV6res = normalizeIPv6$1(ipV4res.host);
5308
+ if (ipV6res.isIPV6 === true) {
5309
+ host = `[${ipV6res.escapedHost}]`;
5310
+ } else {
5311
+ host = components.host;
5312
+ }
5313
+ }
5314
+ uriTokens.push(host);
5315
+ }
5469
5316
 
5470
- if (index >= inputLength) {
5471
- error$1('invalid-input');
5472
- }
5317
+ if (typeof components.port === 'number' || typeof components.port === 'string') {
5318
+ uriTokens.push(':');
5319
+ uriTokens.push(String(components.port));
5320
+ }
5473
5321
 
5474
- var digit = basicToDigit(input.charCodeAt(index++));
5322
+ return uriTokens.length ? uriTokens.join('') : undefined
5323
+ }
5324
+ var utils = {
5325
+ recomposeAuthority: recomposeAuthority$1,
5326
+ normalizeComponentEncoding: normalizeComponentEncoding$1,
5327
+ removeDotSegments: removeDotSegments$1,
5328
+ normalizeIPv4: normalizeIPv4$1,
5329
+ normalizeIPv6: normalizeIPv6$1,
5330
+ stringArrayToHexStripped
5331
+ };
5475
5332
 
5476
- if (digit >= base || digit > floor((maxInt - i) / w)) {
5477
- error$1('overflow');
5478
- }
5333
+ const UUID_REG = /^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu;
5334
+ const URN_REG = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;
5479
5335
 
5480
- i += digit * w;
5481
- var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
5336
+ function isSecure (wsComponents) {
5337
+ return typeof wsComponents.secure === 'boolean' ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === 'wss'
5338
+ }
5482
5339
 
5483
- if (digit < t) {
5484
- break;
5485
- }
5340
+ function httpParse (components) {
5341
+ if (!components.host) {
5342
+ components.error = components.error || 'HTTP URIs must have a host.';
5343
+ }
5486
5344
 
5487
- var baseMinusT = base - t;
5488
- if (w > floor(maxInt / baseMinusT)) {
5489
- error$1('overflow');
5490
- }
5345
+ return components
5346
+ }
5491
5347
 
5492
- w *= baseMinusT;
5493
- }
5348
+ function httpSerialize (components) {
5349
+ const secure = String(components.scheme).toLowerCase() === 'https';
5494
5350
 
5495
- var out = output.length + 1;
5496
- bias = adapt(i - oldi, out, oldi == 0);
5351
+ // normalize the default port
5352
+ if (components.port === (secure ? 443 : 80) || components.port === '') {
5353
+ components.port = undefined;
5354
+ }
5497
5355
 
5498
- // `i` was supposed to wrap around from `out` to `0`,
5499
- // incrementing `n` each time, so we'll fix that now:
5500
- if (floor(i / out) > maxInt - n) {
5501
- error$1('overflow');
5502
- }
5356
+ // normalize the empty path
5357
+ if (!components.path) {
5358
+ components.path = '/';
5359
+ }
5503
5360
 
5504
- n += floor(i / out);
5505
- i %= out;
5361
+ // NOTE: We do not parse query strings for HTTP URIs
5362
+ // as WWW Form Url Encoded query strings are part of the HTML4+ spec,
5363
+ // and not the HTTP spec.
5506
5364
 
5507
- // Insert `n` at position `i` of the output.
5508
- output.splice(i++, 0, n);
5509
- }
5365
+ return components
5366
+ }
5510
5367
 
5511
- return String.fromCodePoint.apply(String, output);
5512
- };
5368
+ function wsParse (wsComponents) {
5369
+ // indicate if the secure flag is set
5370
+ wsComponents.secure = isSecure(wsComponents);
5513
5371
 
5514
- /**
5515
- * Converts a string of Unicode symbols (e.g. a domain name label) to a
5516
- * Punycode string of ASCII-only symbols.
5517
- * @memberOf punycode
5518
- * @param {String} input The string of Unicode symbols.
5519
- * @returns {String} The resulting Punycode string of ASCII-only symbols.
5520
- */
5521
- var encode = function encode(input) {
5522
- var output = [];
5372
+ // construct resouce name
5373
+ wsComponents.resourceName = (wsComponents.path || '/') + (wsComponents.query ? '?' + wsComponents.query : '');
5374
+ wsComponents.path = undefined;
5375
+ wsComponents.query = undefined;
5523
5376
 
5524
- // Convert the input in UCS-2 to an array of Unicode code points.
5525
- input = ucs2decode(input);
5377
+ return wsComponents
5378
+ }
5526
5379
 
5527
- // Cache the length.
5528
- var inputLength = input.length;
5380
+ function wsSerialize (wsComponents) {
5381
+ // normalize the default port
5382
+ if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === '') {
5383
+ wsComponents.port = undefined;
5384
+ }
5529
5385
 
5530
- // Initialize the state.
5531
- var n = initialN;
5532
- var delta = 0;
5533
- var bias = initialBias;
5386
+ // ensure scheme matches secure flag
5387
+ if (typeof wsComponents.secure === 'boolean') {
5388
+ wsComponents.scheme = (wsComponents.secure ? 'wss' : 'ws');
5389
+ wsComponents.secure = undefined;
5390
+ }
5534
5391
 
5535
- // Handle the basic code points.
5536
- var _iteratorNormalCompletion = true;
5537
- var _didIteratorError = false;
5538
- var _iteratorError = undefined;
5392
+ // reconstruct path from resource name
5393
+ if (wsComponents.resourceName) {
5394
+ const [path, query] = wsComponents.resourceName.split('?');
5395
+ wsComponents.path = (path && path !== '/' ? path : undefined);
5396
+ wsComponents.query = query;
5397
+ wsComponents.resourceName = undefined;
5398
+ }
5539
5399
 
5540
- try {
5541
- for (var _iterator = input[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
5542
- var _currentValue2 = _step.value;
5400
+ // forbid fragment component
5401
+ wsComponents.fragment = undefined;
5543
5402
 
5544
- if (_currentValue2 < 0x80) {
5545
- output.push(stringFromCharCode(_currentValue2));
5546
- }
5547
- }
5548
- } catch (err) {
5549
- _didIteratorError = true;
5550
- _iteratorError = err;
5551
- } finally {
5552
- try {
5553
- if (!_iteratorNormalCompletion && _iterator.return) {
5554
- _iterator.return();
5555
- }
5556
- } finally {
5557
- if (_didIteratorError) {
5558
- throw _iteratorError;
5559
- }
5560
- }
5561
- }
5403
+ return wsComponents
5404
+ }
5562
5405
 
5563
- var basicLength = output.length;
5564
- var handledCPCount = basicLength;
5406
+ function urnParse (urnComponents, options) {
5407
+ if (!urnComponents.path) {
5408
+ urnComponents.error = 'URN can not be parsed';
5409
+ return urnComponents
5410
+ }
5411
+ const matches = urnComponents.path.match(URN_REG);
5412
+ if (matches) {
5413
+ const scheme = options.scheme || urnComponents.scheme || 'urn';
5414
+ urnComponents.nid = matches[1].toLowerCase();
5415
+ urnComponents.nss = matches[2];
5416
+ const urnScheme = `${scheme}:${options.nid || urnComponents.nid}`;
5417
+ const schemeHandler = SCHEMES$1[urnScheme];
5418
+ urnComponents.path = undefined;
5419
+
5420
+ if (schemeHandler) {
5421
+ urnComponents = schemeHandler.parse(urnComponents, options);
5422
+ }
5423
+ } else {
5424
+ urnComponents.error = urnComponents.error || 'URN can not be parsed.';
5425
+ }
5565
5426
 
5566
- // `handledCPCount` is the number of code points that have been handled;
5567
- // `basicLength` is the number of basic code points.
5427
+ return urnComponents
5428
+ }
5568
5429
 
5569
- // Finish the basic string with a delimiter unless it's empty.
5570
- if (basicLength) {
5571
- output.push(delimiter);
5572
- }
5430
+ function urnSerialize (urnComponents, options) {
5431
+ const scheme = options.scheme || urnComponents.scheme || 'urn';
5432
+ const nid = urnComponents.nid.toLowerCase();
5433
+ const urnScheme = `${scheme}:${options.nid || nid}`;
5434
+ const schemeHandler = SCHEMES$1[urnScheme];
5573
5435
 
5574
- // Main encoding loop:
5575
- while (handledCPCount < inputLength) {
5436
+ if (schemeHandler) {
5437
+ urnComponents = schemeHandler.serialize(urnComponents, options);
5438
+ }
5576
5439
 
5577
- // All non-basic code points < n have been handled already. Find the next
5578
- // larger one:
5579
- var m = maxInt;
5580
- var _iteratorNormalCompletion2 = true;
5581
- var _didIteratorError2 = false;
5582
- var _iteratorError2 = undefined;
5440
+ const uriComponents = urnComponents;
5441
+ const nss = urnComponents.nss;
5442
+ uriComponents.path = `${nid || options.nid}:${nss}`;
5583
5443
 
5584
- try {
5585
- for (var _iterator2 = input[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
5586
- var currentValue = _step2.value;
5444
+ options.skipEscape = true;
5445
+ return uriComponents
5446
+ }
5587
5447
 
5588
- if (currentValue >= n && currentValue < m) {
5589
- m = currentValue;
5590
- }
5591
- }
5448
+ function urnuuidParse (urnComponents, options) {
5449
+ const uuidComponents = urnComponents;
5450
+ uuidComponents.uuid = uuidComponents.nss;
5451
+ uuidComponents.nss = undefined;
5592
5452
 
5593
- // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
5594
- // but guard against overflow.
5595
- } catch (err) {
5596
- _didIteratorError2 = true;
5597
- _iteratorError2 = err;
5598
- } finally {
5599
- try {
5600
- if (!_iteratorNormalCompletion2 && _iterator2.return) {
5601
- _iterator2.return();
5602
- }
5603
- } finally {
5604
- if (_didIteratorError2) {
5605
- throw _iteratorError2;
5606
- }
5607
- }
5608
- }
5453
+ if (!options.tolerant && (!uuidComponents.uuid || !UUID_REG.test(uuidComponents.uuid))) {
5454
+ uuidComponents.error = uuidComponents.error || 'UUID is not valid.';
5455
+ }
5609
5456
 
5610
- var handledCPCountPlusOne = handledCPCount + 1;
5611
- if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
5612
- error$1('overflow');
5613
- }
5457
+ return uuidComponents
5458
+ }
5614
5459
 
5615
- delta += (m - n) * handledCPCountPlusOne;
5616
- n = m;
5460
+ function urnuuidSerialize (uuidComponents) {
5461
+ const urnComponents = uuidComponents;
5462
+ // normalize UUID
5463
+ urnComponents.nss = (uuidComponents.uuid || '').toLowerCase();
5464
+ return urnComponents
5465
+ }
5617
5466
 
5618
- var _iteratorNormalCompletion3 = true;
5619
- var _didIteratorError3 = false;
5620
- var _iteratorError3 = undefined;
5467
+ const http = {
5468
+ scheme: 'http',
5469
+ domainHost: true,
5470
+ parse: httpParse,
5471
+ serialize: httpSerialize
5472
+ };
5621
5473
 
5622
- try {
5623
- for (var _iterator3 = input[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
5624
- var _currentValue = _step3.value;
5474
+ const https = {
5475
+ scheme: 'https',
5476
+ domainHost: http.domainHost,
5477
+ parse: httpParse,
5478
+ serialize: httpSerialize
5479
+ };
5625
5480
 
5626
- if (_currentValue < n && ++delta > maxInt) {
5627
- error$1('overflow');
5628
- }
5629
- if (_currentValue == n) {
5630
- // Represent delta as a generalized variable-length integer.
5631
- var q = delta;
5632
- for (var k = base;; /* no condition */k += base) {
5633
- var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
5634
- if (q < t) {
5635
- break;
5636
- }
5637
- var qMinusT = q - t;
5638
- var baseMinusT = base - t;
5639
- output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)));
5640
- q = floor(qMinusT / baseMinusT);
5641
- }
5642
-
5643
- output.push(stringFromCharCode(digitToBasic(q, 0)));
5644
- bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
5645
- delta = 0;
5646
- ++handledCPCount;
5647
- }
5648
- }
5649
- } catch (err) {
5650
- _didIteratorError3 = true;
5651
- _iteratorError3 = err;
5652
- } finally {
5653
- try {
5654
- if (!_iteratorNormalCompletion3 && _iterator3.return) {
5655
- _iterator3.return();
5656
- }
5657
- } finally {
5658
- if (_didIteratorError3) {
5659
- throw _iteratorError3;
5660
- }
5661
- }
5662
- }
5481
+ const ws = {
5482
+ scheme: 'ws',
5483
+ domainHost: true,
5484
+ parse: wsParse,
5485
+ serialize: wsSerialize
5486
+ };
5663
5487
 
5664
- ++delta;
5665
- ++n;
5666
- }
5667
- return output.join('');
5488
+ const wss = {
5489
+ scheme: 'wss',
5490
+ domainHost: ws.domainHost,
5491
+ parse: ws.parse,
5492
+ serialize: ws.serialize
5668
5493
  };
5669
5494
 
5670
- /**
5671
- * Converts a Punycode string representing a domain name or an email address
5672
- * to Unicode. Only the Punycoded parts of the input will be converted, i.e.
5673
- * it doesn't matter if you call it on a string that has already been
5674
- * converted to Unicode.
5675
- * @memberOf punycode
5676
- * @param {String} input The Punycoded domain name or email address to
5677
- * convert to Unicode.
5678
- * @returns {String} The Unicode representation of the given Punycode
5679
- * string.
5680
- */
5681
- var toUnicode = function toUnicode(input) {
5682
- return mapDomain(input, function (string) {
5683
- return regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string;
5684
- });
5495
+ const urn = {
5496
+ scheme: 'urn',
5497
+ parse: urnParse,
5498
+ serialize: urnSerialize,
5499
+ skipNormalize: true
5685
5500
  };
5686
5501
 
5687
- /**
5688
- * Converts a Unicode string representing a domain name or an email address to
5689
- * Punycode. Only the non-ASCII parts of the domain name will be converted,
5690
- * i.e. it doesn't matter if you call it with a domain that's already in
5691
- * ASCII.
5692
- * @memberOf punycode
5693
- * @param {String} input The domain name or email address to convert, as a
5694
- * Unicode string.
5695
- * @returns {String} The Punycode representation of the given domain name or
5696
- * email address.
5697
- */
5698
- var toASCII = function toASCII(input) {
5699
- return mapDomain(input, function (string) {
5700
- return regexNonASCII.test(string) ? 'xn--' + encode(string) : string;
5701
- });
5502
+ const urnuuid = {
5503
+ scheme: 'urn:uuid',
5504
+ parse: urnuuidParse,
5505
+ serialize: urnuuidSerialize,
5506
+ skipNormalize: true
5702
5507
  };
5703
5508
 
5704
- /*--------------------------------------------------------------------------*/
5705
-
5706
- /** Define the public API */
5707
- var punycode = {
5708
- /**
5709
- * A string representing the current Punycode.js version number.
5710
- * @memberOf punycode
5711
- * @type String
5712
- */
5713
- 'version': '2.1.0',
5714
- /**
5715
- * An object of methods to convert from JavaScript's internal character
5716
- * representation (UCS-2) to Unicode code points, and back.
5717
- * @see <https://mathiasbynens.be/notes/javascript-encoding>
5718
- * @memberOf punycode
5719
- * @type Object
5720
- */
5721
- 'ucs2': {
5722
- 'decode': ucs2decode,
5723
- 'encode': ucs2encode
5724
- },
5725
- 'decode': decode,
5726
- 'encode': encode,
5727
- 'toASCII': toASCII,
5728
- 'toUnicode': toUnicode
5509
+ const SCHEMES$1 = {
5510
+ http,
5511
+ https,
5512
+ ws,
5513
+ wss,
5514
+ urn,
5515
+ 'urn:uuid': urnuuid
5729
5516
  };
5730
5517
 
5731
- /**
5732
- * URI.js
5733
- *
5734
- * @fileoverview An RFC 3986 compliant, scheme extendable URI parsing/validating/resolving library for JavaScript.
5735
- * @author <a href="mailto:gary.court@gmail.com">Gary Court</a>
5736
- * @see http://github.com/garycourt/uri-js
5737
- */
5738
- /**
5739
- * Copyright 2011 Gary Court. All rights reserved.
5740
- *
5741
- * Redistribution and use in source and binary forms, with or without modification, are
5742
- * permitted provided that the following conditions are met:
5743
- *
5744
- * 1. Redistributions of source code must retain the above copyright notice, this list of
5745
- * conditions and the following disclaimer.
5746
- *
5747
- * 2. Redistributions in binary form must reproduce the above copyright notice, this list
5748
- * of conditions and the following disclaimer in the documentation and/or other materials
5749
- * provided with the distribution.
5750
- *
5751
- * THIS SOFTWARE IS PROVIDED BY GARY COURT ``AS IS'' AND ANY EXPRESS OR IMPLIED
5752
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
5753
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARY COURT OR
5754
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
5755
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
5756
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
5757
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
5758
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
5759
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5760
- *
5761
- * The views and conclusions contained in the software and documentation are those of the
5762
- * authors and should not be interpreted as representing official policies, either expressed
5763
- * or implied, of Gary Court.
5764
- */
5765
- var SCHEMES = {};
5766
- function pctEncChar(chr) {
5767
- var c = chr.charCodeAt(0);
5768
- var e = void 0;
5769
- 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();
5770
- return e;
5771
- }
5772
- function pctDecChars(str) {
5773
- var newStr = "";
5774
- var i = 0;
5775
- var il = str.length;
5776
- while (i < il) {
5777
- var c = parseInt(str.substr(i + 1, 2), 16);
5778
- if (c < 128) {
5779
- newStr += String.fromCharCode(c);
5780
- i += 3;
5781
- } else if (c >= 194 && c < 224) {
5782
- if (il - i >= 6) {
5783
- var c2 = parseInt(str.substr(i + 4, 2), 16);
5784
- newStr += String.fromCharCode((c & 31) << 6 | c2 & 63);
5785
- } else {
5786
- newStr += str.substr(i, 6);
5787
- }
5788
- i += 6;
5789
- } else if (c >= 224) {
5790
- if (il - i >= 9) {
5791
- var _c = parseInt(str.substr(i + 4, 2), 16);
5792
- var c3 = parseInt(str.substr(i + 7, 2), 16);
5793
- newStr += String.fromCharCode((c & 15) << 12 | (_c & 63) << 6 | c3 & 63);
5794
- } else {
5795
- newStr += str.substr(i, 9);
5796
- }
5797
- i += 9;
5798
- } else {
5799
- newStr += str.substr(i, 3);
5800
- i += 3;
5801
- }
5802
- }
5803
- return newStr;
5804
- }
5805
- function _normalizeComponentEncoding(components, protocol) {
5806
- function decodeUnreserved(str) {
5807
- var decStr = pctDecChars(str);
5808
- return !decStr.match(protocol.UNRESERVED) ? str : decStr;
5809
- }
5810
- if (components.scheme) components.scheme = String(components.scheme).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_SCHEME, "");
5811
- if (components.userinfo !== undefined) components.userinfo = String(components.userinfo).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_USERINFO, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
5812
- 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);
5813
- 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);
5814
- if (components.query !== undefined) components.query = String(components.query).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_QUERY, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
5815
- if (components.fragment !== undefined) components.fragment = String(components.fragment).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_FRAGMENT, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
5816
- return components;
5817
- }
5518
+ var schemes = SCHEMES$1;
5818
5519
 
5819
- function _stripLeadingZeros(str) {
5820
- return str.replace(/^0*(.*)/, "$1") || "0";
5520
+ const { normalizeIPv6, normalizeIPv4, removeDotSegments, recomposeAuthority, normalizeComponentEncoding } = utils;
5521
+ const SCHEMES = schemes;
5522
+
5523
+ function normalize (uri, options) {
5524
+ if (typeof uri === 'string') {
5525
+ uri = serialize(parse(uri, options), options);
5526
+ } else if (typeof uri === 'object') {
5527
+ uri = parse(serialize(uri, options), options);
5528
+ }
5529
+ return uri
5821
5530
  }
5822
- function _normalizeIPv4(host, protocol) {
5823
- var matches = host.match(protocol.IPV4ADDRESS) || [];
5824
5531
 
5825
- var _matches = slicedToArray(matches, 2),
5826
- address = _matches[1];
5532
+ function resolve (baseURI, relativeURI, options) {
5533
+ const schemelessOptions = Object.assign({ scheme: 'null' }, options);
5534
+ const resolved = resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true);
5535
+ return serialize(resolved, { ...schemelessOptions, skipEscape: true })
5536
+ }
5827
5537
 
5828
- if (address) {
5829
- return address.split(".").map(_stripLeadingZeros).join(".");
5830
- } else {
5831
- return host;
5832
- }
5833
- }
5834
- function _normalizeIPv6(host, protocol) {
5835
- var matches = host.match(protocol.IPV6ADDRESS) || [];
5836
-
5837
- var _matches2 = slicedToArray(matches, 3),
5838
- address = _matches2[1],
5839
- zone = _matches2[2];
5840
-
5841
- if (address) {
5842
- var _address$toLowerCase$ = address.toLowerCase().split('::').reverse(),
5843
- _address$toLowerCase$2 = slicedToArray(_address$toLowerCase$, 2),
5844
- last = _address$toLowerCase$2[0],
5845
- first = _address$toLowerCase$2[1];
5846
-
5847
- var firstFields = first ? first.split(":").map(_stripLeadingZeros) : [];
5848
- var lastFields = last.split(":").map(_stripLeadingZeros);
5849
- var isLastFieldIPv4Address = protocol.IPV4ADDRESS.test(lastFields[lastFields.length - 1]);
5850
- var fieldCount = isLastFieldIPv4Address ? 7 : 8;
5851
- var lastFieldsStart = lastFields.length - fieldCount;
5852
- var fields = Array(fieldCount);
5853
- for (var x = 0; x < fieldCount; ++x) {
5854
- fields[x] = firstFields[x] || lastFields[lastFieldsStart + x] || '';
5855
- }
5856
- if (isLastFieldIPv4Address) {
5857
- fields[fieldCount - 1] = _normalizeIPv4(fields[fieldCount - 1], protocol);
5858
- }
5859
- var allZeroFields = fields.reduce(function (acc, field, index) {
5860
- if (!field || field === "0") {
5861
- var lastLongest = acc[acc.length - 1];
5862
- if (lastLongest && lastLongest.index + lastLongest.length === index) {
5863
- lastLongest.length++;
5864
- } else {
5865
- acc.push({ index: index, length: 1 });
5866
- }
5867
- }
5868
- return acc;
5869
- }, []);
5870
- var longestZeroFields = allZeroFields.sort(function (a, b) {
5871
- return b.length - a.length;
5872
- })[0];
5873
- var newHost = void 0;
5874
- if (longestZeroFields && longestZeroFields.length > 1) {
5875
- var newFirst = fields.slice(0, longestZeroFields.index);
5876
- var newLast = fields.slice(longestZeroFields.index + longestZeroFields.length);
5877
- newHost = newFirst.join(":") + "::" + newLast.join(":");
5878
- } else {
5879
- newHost = fields.join(":");
5880
- }
5881
- if (zone) {
5882
- newHost += "%" + zone;
5883
- }
5884
- return newHost;
5538
+ function resolveComponents (base, relative, options, skipNormalization) {
5539
+ const target = {};
5540
+ if (!skipNormalization) {
5541
+ base = parse(serialize(base, options), options); // normalize base components
5542
+ relative = parse(serialize(relative, options), options); // normalize relative components
5543
+ }
5544
+ options = options || {};
5545
+
5546
+ if (!options.tolerant && relative.scheme) {
5547
+ target.scheme = relative.scheme;
5548
+ // target.authority = relative.authority;
5549
+ target.userinfo = relative.userinfo;
5550
+ target.host = relative.host;
5551
+ target.port = relative.port;
5552
+ target.path = removeDotSegments(relative.path || '');
5553
+ target.query = relative.query;
5554
+ } else {
5555
+ if (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) {
5556
+ // target.authority = relative.authority;
5557
+ target.userinfo = relative.userinfo;
5558
+ target.host = relative.host;
5559
+ target.port = relative.port;
5560
+ target.path = removeDotSegments(relative.path || '');
5561
+ target.query = relative.query;
5885
5562
  } else {
5886
- return host;
5887
- }
5888
- }
5889
- var URI_PARSE = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i;
5890
- var NO_MATCH_IS_UNDEFINED = "".match(/(){0}/)[1] === undefined;
5891
- function parse(uriString) {
5892
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
5893
-
5894
- var components = {};
5895
- var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL;
5896
- if (options.reference === "suffix") uriString = (options.scheme ? options.scheme + ":" : "") + "//" + uriString;
5897
- var matches = uriString.match(URI_PARSE);
5898
- if (matches) {
5899
- if (NO_MATCH_IS_UNDEFINED) {
5900
- //store each component
5901
- components.scheme = matches[1];
5902
- components.userinfo = matches[3];
5903
- components.host = matches[4];
5904
- components.port = parseInt(matches[5], 10);
5905
- components.path = matches[6] || "";
5906
- components.query = matches[7];
5907
- components.fragment = matches[8];
5908
- //fix port number
5909
- if (isNaN(components.port)) {
5910
- components.port = matches[5];
5911
- }
5563
+ if (!relative.path) {
5564
+ target.path = base.path;
5565
+ if (relative.query !== undefined) {
5566
+ target.query = relative.query;
5912
5567
  } else {
5913
- //IE FIX for improper RegExp matching
5914
- //store each component
5915
- components.scheme = matches[1] || undefined;
5916
- components.userinfo = uriString.indexOf("@") !== -1 ? matches[3] : undefined;
5917
- components.host = uriString.indexOf("//") !== -1 ? matches[4] : undefined;
5918
- components.port = parseInt(matches[5], 10);
5919
- components.path = matches[6] || "";
5920
- components.query = uriString.indexOf("?") !== -1 ? matches[7] : undefined;
5921
- components.fragment = uriString.indexOf("#") !== -1 ? matches[8] : undefined;
5922
- //fix port number
5923
- if (isNaN(components.port)) {
5924
- components.port = uriString.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? matches[4] : undefined;
5925
- }
5568
+ target.query = base.query;
5926
5569
  }
5927
- if (components.host) {
5928
- //normalize IP hosts
5929
- components.host = _normalizeIPv6(_normalizeIPv4(components.host, protocol), protocol);
5930
- }
5931
- //determine reference type
5932
- if (components.scheme === undefined && components.userinfo === undefined && components.host === undefined && components.port === undefined && !components.path && components.query === undefined) {
5933
- components.reference = "same-document";
5934
- } else if (components.scheme === undefined) {
5935
- components.reference = "relative";
5936
- } else if (components.fragment === undefined) {
5937
- components.reference = "absolute";
5938
- } else {
5939
- components.reference = "uri";
5940
- }
5941
- //check for reference errors
5942
- if (options.reference && options.reference !== "suffix" && options.reference !== components.reference) {
5943
- components.error = components.error || "URI is not a " + options.reference + " reference.";
5944
- }
5945
- //find scheme handler
5946
- var schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
5947
- //check if scheme can't handle IRIs
5948
- if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
5949
- //if host component is a domain name
5950
- if (components.host && (options.domainHost || schemeHandler && schemeHandler.domainHost)) {
5951
- //convert Unicode IDN -> ASCII IDN
5952
- try {
5953
- components.host = punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase());
5954
- } catch (e) {
5955
- components.error = components.error || "Host's domain name can not be converted to ASCII via punycode: " + e;
5956
- }
5957
- }
5958
- //convert IRI -> URI
5959
- _normalizeComponentEncoding(components, URI_PROTOCOL);
5570
+ } else {
5571
+ if (relative.path.charAt(0) === '/') {
5572
+ target.path = removeDotSegments(relative.path);
5960
5573
  } else {
5961
- //normalize encodings
5962
- _normalizeComponentEncoding(components, protocol);
5963
- }
5964
- //perform scheme specific parsing
5965
- if (schemeHandler && schemeHandler.parse) {
5966
- schemeHandler.parse(components, options);
5574
+ if ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) {
5575
+ target.path = '/' + relative.path;
5576
+ } else if (!base.path) {
5577
+ target.path = relative.path;
5578
+ } else {
5579
+ target.path = base.path.slice(0, base.path.lastIndexOf('/') + 1) + relative.path;
5580
+ }
5581
+ target.path = removeDotSegments(target.path);
5967
5582
  }
5968
- } else {
5969
- components.error = components.error || "URI can not be parsed.";
5583
+ target.query = relative.query;
5584
+ }
5585
+ // target.authority = base.authority;
5586
+ target.userinfo = base.userinfo;
5587
+ target.host = base.host;
5588
+ target.port = base.port;
5970
5589
  }
5971
- return components;
5972
- }
5590
+ target.scheme = base.scheme;
5591
+ }
5973
5592
 
5974
- function _recomposeAuthority(components, options) {
5975
- var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL;
5976
- var uriTokens = [];
5977
- if (components.userinfo !== undefined) {
5978
- uriTokens.push(components.userinfo);
5979
- uriTokens.push("@");
5980
- }
5981
- if (components.host !== undefined) {
5982
- //normalize IP hosts, add brackets and escape zone separator for IPv6
5983
- uriTokens.push(_normalizeIPv6(_normalizeIPv4(String(components.host), protocol), protocol).replace(protocol.IPV6ADDRESS, function (_, $1, $2) {
5984
- return "[" + $1 + ($2 ? "%25" + $2 : "") + "]";
5985
- }));
5986
- }
5987
- if (typeof components.port === "number" || typeof components.port === "string") {
5988
- uriTokens.push(":");
5989
- uriTokens.push(String(components.port));
5990
- }
5991
- return uriTokens.length ? uriTokens.join("") : undefined;
5992
- }
5993
-
5994
- var RDS1 = /^\.\.?\//;
5995
- var RDS2 = /^\/\.(\/|$)/;
5996
- var RDS3 = /^\/\.\.(\/|$)/;
5997
- var RDS5 = /^\/?(?:.|\n)*?(?=\/|$)/;
5998
- function removeDotSegments(input) {
5999
- var output = [];
6000
- while (input.length) {
6001
- if (input.match(RDS1)) {
6002
- input = input.replace(RDS1, "");
6003
- } else if (input.match(RDS2)) {
6004
- input = input.replace(RDS2, "/");
6005
- } else if (input.match(RDS3)) {
6006
- input = input.replace(RDS3, "/");
6007
- output.pop();
6008
- } else if (input === "." || input === "..") {
6009
- input = "";
6010
- } else {
6011
- var im = input.match(RDS5);
6012
- if (im) {
6013
- var s = im[0];
6014
- input = input.slice(s.length);
6015
- output.push(s);
6016
- } else {
6017
- throw new Error("Unexpected dot segment condition");
6018
- }
6019
- }
6020
- }
6021
- return output.join("");
5593
+ target.fragment = relative.fragment;
5594
+
5595
+ return target
6022
5596
  }
6023
5597
 
6024
- function serialize(components) {
6025
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
5598
+ function equal$2 (uriA, uriB, options) {
5599
+ if (typeof uriA === 'string') {
5600
+ uriA = unescape(uriA);
5601
+ uriA = serialize(normalizeComponentEncoding(parse(uriA, options), true), { ...options, skipEscape: true });
5602
+ } else if (typeof uriA === 'object') {
5603
+ uriA = serialize(normalizeComponentEncoding(uriA, true), { ...options, skipEscape: true });
5604
+ }
5605
+
5606
+ if (typeof uriB === 'string') {
5607
+ uriB = unescape(uriB);
5608
+ uriB = serialize(normalizeComponentEncoding(parse(uriB, options), true), { ...options, skipEscape: true });
5609
+ } else if (typeof uriB === 'object') {
5610
+ uriB = serialize(normalizeComponentEncoding(uriB, true), { ...options, skipEscape: true });
5611
+ }
6026
5612
 
6027
- var protocol = options.iri ? IRI_PROTOCOL : URI_PROTOCOL;
6028
- var uriTokens = [];
6029
- //find scheme handler
6030
- var schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
6031
- //perform scheme specific serialization
6032
- if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(components, options);
6033
- if (components.host) {
6034
- //if host component is an IPv6 address
6035
- if (protocol.IPV6ADDRESS.test(components.host)) ;
6036
- //TODO: normalize IPv6 address as per RFC 5952
5613
+ return uriA.toLowerCase() === uriB.toLowerCase()
5614
+ }
5615
+
5616
+ function serialize (cmpts, opts) {
5617
+ const components = {
5618
+ host: cmpts.host,
5619
+ scheme: cmpts.scheme,
5620
+ userinfo: cmpts.userinfo,
5621
+ port: cmpts.port,
5622
+ path: cmpts.path,
5623
+ query: cmpts.query,
5624
+ nid: cmpts.nid,
5625
+ nss: cmpts.nss,
5626
+ uuid: cmpts.uuid,
5627
+ fragment: cmpts.fragment,
5628
+ reference: cmpts.reference,
5629
+ resourceName: cmpts.resourceName,
5630
+ secure: cmpts.secure,
5631
+ error: ''
5632
+ };
5633
+ const options = Object.assign({}, opts);
5634
+ const uriTokens = [];
6037
5635
 
6038
- //if host component is a domain name
6039
- else if (options.domainHost || schemeHandler && schemeHandler.domainHost) {
6040
- //convert IDN via punycode
6041
- try {
6042
- components.host = !options.iri ? punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase()) : punycode.toUnicode(components.host);
6043
- } catch (e) {
6044
- components.error = components.error || "Host's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e;
6045
- }
6046
- }
6047
- }
6048
- //normalize encoding
6049
- _normalizeComponentEncoding(components, protocol);
6050
- if (options.reference !== "suffix" && components.scheme) {
6051
- uriTokens.push(components.scheme);
6052
- uriTokens.push(":");
6053
- }
6054
- var authority = _recomposeAuthority(components, options);
6055
- if (authority !== undefined) {
6056
- if (options.reference !== "suffix") {
6057
- uriTokens.push("//");
6058
- }
6059
- uriTokens.push(authority);
6060
- if (components.path && components.path.charAt(0) !== "/") {
6061
- uriTokens.push("/");
6062
- }
6063
- }
6064
- if (components.path !== undefined) {
6065
- var s = components.path;
6066
- if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
6067
- s = removeDotSegments(s);
6068
- }
6069
- if (authority === undefined) {
6070
- s = s.replace(/^\/\//, "/%2F"); //don't allow the path to start with "//"
6071
- }
6072
- uriTokens.push(s);
6073
- }
6074
- if (components.query !== undefined) {
6075
- uriTokens.push("?");
6076
- uriTokens.push(components.query);
6077
- }
6078
- if (components.fragment !== undefined) {
6079
- uriTokens.push("#");
6080
- uriTokens.push(components.fragment);
6081
- }
6082
- return uriTokens.join(""); //merge tokens into a string
6083
- }
5636
+ // find scheme handler
5637
+ const schemeHandler = SCHEMES[(options.scheme || components.scheme || '').toLowerCase()];
6084
5638
 
6085
- function resolveComponents(base, relative) {
6086
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
6087
- var skipNormalization = arguments[3];
5639
+ // perform scheme specific serialization
5640
+ if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(components, options);
6088
5641
 
6089
- var target = {};
6090
- if (!skipNormalization) {
6091
- base = parse(serialize(base, options), options); //normalize base components
6092
- relative = parse(serialize(relative, options), options); //normalize relative components
6093
- }
6094
- options = options || {};
6095
- if (!options.tolerant && relative.scheme) {
6096
- target.scheme = relative.scheme;
6097
- //target.authority = relative.authority;
6098
- target.userinfo = relative.userinfo;
6099
- target.host = relative.host;
6100
- target.port = relative.port;
6101
- target.path = removeDotSegments(relative.path || "");
6102
- target.query = relative.query;
5642
+ if (components.path !== undefined) {
5643
+ if (!options.skipEscape) {
5644
+ components.path = escape(components.path);
5645
+
5646
+ if (components.scheme !== undefined) {
5647
+ components.path = components.path.split('%3A').join(':');
5648
+ }
6103
5649
  } else {
6104
- if (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) {
6105
- //target.authority = relative.authority;
6106
- target.userinfo = relative.userinfo;
6107
- target.host = relative.host;
6108
- target.port = relative.port;
6109
- target.path = removeDotSegments(relative.path || "");
6110
- target.query = relative.query;
6111
- } else {
6112
- if (!relative.path) {
6113
- target.path = base.path;
6114
- if (relative.query !== undefined) {
6115
- target.query = relative.query;
6116
- } else {
6117
- target.query = base.query;
6118
- }
6119
- } else {
6120
- if (relative.path.charAt(0) === "/") {
6121
- target.path = removeDotSegments(relative.path);
6122
- } else {
6123
- if ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) {
6124
- target.path = "/" + relative.path;
6125
- } else if (!base.path) {
6126
- target.path = relative.path;
6127
- } else {
6128
- target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative.path;
6129
- }
6130
- target.path = removeDotSegments(target.path);
6131
- }
6132
- target.query = relative.query;
6133
- }
6134
- //target.authority = base.authority;
6135
- target.userinfo = base.userinfo;
6136
- target.host = base.host;
6137
- target.port = base.port;
6138
- }
6139
- target.scheme = base.scheme;
5650
+ components.path = unescape(components.path);
6140
5651
  }
6141
- target.fragment = relative.fragment;
6142
- return target;
6143
- }
5652
+ }
6144
5653
 
6145
- function resolve(baseURI, relativeURI, options) {
6146
- var schemelessOptions = assign({ scheme: 'null' }, options);
6147
- return serialize(resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true), schemelessOptions);
6148
- }
5654
+ if (options.reference !== 'suffix' && components.scheme) {
5655
+ uriTokens.push(components.scheme, ':');
5656
+ }
6149
5657
 
6150
- function normalize(uri, options) {
6151
- if (typeof uri === "string") {
6152
- uri = serialize(parse(uri, options), options);
6153
- } else if (typeOf(uri) === "object") {
6154
- uri = parse(serialize(uri, options), options);
5658
+ const authority = recomposeAuthority(components);
5659
+ if (authority !== undefined) {
5660
+ if (options.reference !== 'suffix') {
5661
+ uriTokens.push('//');
6155
5662
  }
6156
- return uri;
6157
- }
6158
5663
 
6159
- function equal(uriA, uriB, options) {
6160
- if (typeof uriA === "string") {
6161
- uriA = serialize(parse(uriA, options), options);
6162
- } else if (typeOf(uriA) === "object") {
6163
- uriA = serialize(uriA, options);
5664
+ uriTokens.push(authority);
5665
+
5666
+ if (components.path && components.path.charAt(0) !== '/') {
5667
+ uriTokens.push('/');
6164
5668
  }
6165
- if (typeof uriB === "string") {
6166
- uriB = serialize(parse(uriB, options), options);
6167
- } else if (typeOf(uriB) === "object") {
6168
- uriB = serialize(uriB, options);
5669
+ }
5670
+ if (components.path !== undefined) {
5671
+ let s = components.path;
5672
+
5673
+ if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
5674
+ s = removeDotSegments(s);
6169
5675
  }
6170
- return uriA === uriB;
6171
- }
6172
5676
 
6173
- function escapeComponent(str, options) {
6174
- return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.ESCAPE : IRI_PROTOCOL.ESCAPE, pctEncChar);
6175
- }
5677
+ if (authority === undefined) {
5678
+ s = s.replace(/^\/\//u, '/%2F'); // don't allow the path to start with "//"
5679
+ }
6176
5680
 
6177
- function unescapeComponent(str, options) {
6178
- return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.PCT_ENCODED : IRI_PROTOCOL.PCT_ENCODED, pctDecChars);
5681
+ uriTokens.push(s);
5682
+ }
5683
+
5684
+ if (components.query !== undefined) {
5685
+ uriTokens.push('?', components.query);
5686
+ }
5687
+
5688
+ if (components.fragment !== undefined) {
5689
+ uriTokens.push('#', components.fragment);
5690
+ }
5691
+ return uriTokens.join('')
6179
5692
  }
6180
5693
 
6181
- var handler = {
6182
- scheme: "http",
6183
- domainHost: true,
6184
- parse: function parse(components, options) {
6185
- //report missing host
6186
- if (!components.host) {
6187
- components.error = components.error || "HTTP URIs must have a host.";
6188
- }
6189
- return components;
6190
- },
6191
- serialize: function serialize(components, options) {
6192
- var secure = String(components.scheme).toLowerCase() === "https";
6193
- //normalize the default port
6194
- if (components.port === (secure ? 443 : 80) || components.port === "") {
6195
- components.port = undefined;
6196
- }
6197
- //normalize the empty path
6198
- if (!components.path) {
6199
- components.path = "/";
6200
- }
6201
- //NOTE: We do not parse query strings for HTTP URIs
6202
- //as WWW Form Url Encoded query strings are part of the HTML4+ spec,
6203
- //and not the HTTP spec.
6204
- return components;
5694
+ const hexLookUp = Array.from({ length: 127 }, (_v, k) => /[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(k)));
5695
+
5696
+ function nonSimpleDomain (value) {
5697
+ let code = 0;
5698
+ for (let i = 0, len = value.length; i < len; ++i) {
5699
+ code = value.charCodeAt(i);
5700
+ if (code > 126 || hexLookUp[code]) {
5701
+ return true
6205
5702
  }
6206
- };
5703
+ }
5704
+ return false
5705
+ }
6207
5706
 
6208
- var handler$1 = {
6209
- scheme: "https",
6210
- domainHost: handler.domainHost,
6211
- parse: handler.parse,
6212
- serialize: handler.serialize
6213
- };
5707
+ const URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
6214
5708
 
6215
- function isSecure(wsComponents) {
6216
- return typeof wsComponents.secure === 'boolean' ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === "wss";
6217
- }
6218
- //RFC 6455
6219
- var handler$2 = {
6220
- scheme: "ws",
6221
- domainHost: true,
6222
- parse: function parse(components, options) {
6223
- var wsComponents = components;
6224
- //indicate if the secure flag is set
6225
- wsComponents.secure = isSecure(wsComponents);
6226
- //construct resouce name
6227
- wsComponents.resourceName = (wsComponents.path || '/') + (wsComponents.query ? '?' + wsComponents.query : '');
6228
- wsComponents.path = undefined;
6229
- wsComponents.query = undefined;
6230
- return wsComponents;
6231
- },
6232
- serialize: function serialize(wsComponents, options) {
6233
- //normalize the default port
6234
- if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === "") {
6235
- wsComponents.port = undefined;
6236
- }
6237
- //ensure scheme matches secure flag
6238
- if (typeof wsComponents.secure === 'boolean') {
6239
- wsComponents.scheme = wsComponents.secure ? 'wss' : 'ws';
6240
- wsComponents.secure = undefined;
6241
- }
6242
- //reconstruct path from resource name
6243
- if (wsComponents.resourceName) {
6244
- var _wsComponents$resourc = wsComponents.resourceName.split('?'),
6245
- _wsComponents$resourc2 = slicedToArray(_wsComponents$resourc, 2),
6246
- path = _wsComponents$resourc2[0],
6247
- query = _wsComponents$resourc2[1];
6248
-
6249
- wsComponents.path = path && path !== '/' ? path : undefined;
6250
- wsComponents.query = query;
6251
- wsComponents.resourceName = undefined;
6252
- }
6253
- //forbid fragment component
6254
- wsComponents.fragment = undefined;
6255
- return wsComponents;
5709
+ function parse (uri, opts) {
5710
+ const options = Object.assign({}, opts);
5711
+ const parsed = {
5712
+ scheme: undefined,
5713
+ userinfo: undefined,
5714
+ host: '',
5715
+ port: undefined,
5716
+ path: '',
5717
+ query: undefined,
5718
+ fragment: undefined
5719
+ };
5720
+ const gotEncoding = uri.indexOf('%') !== -1;
5721
+ let isIP = false;
5722
+ if (options.reference === 'suffix') uri = (options.scheme ? options.scheme + ':' : '') + '//' + uri;
5723
+
5724
+ const matches = uri.match(URI_PARSE);
5725
+
5726
+ if (matches) {
5727
+ // store each component
5728
+ parsed.scheme = matches[1];
5729
+ parsed.userinfo = matches[3];
5730
+ parsed.host = matches[4];
5731
+ parsed.port = parseInt(matches[5], 10);
5732
+ parsed.path = matches[6] || '';
5733
+ parsed.query = matches[7];
5734
+ parsed.fragment = matches[8];
5735
+
5736
+ // fix port number
5737
+ if (isNaN(parsed.port)) {
5738
+ parsed.port = matches[5];
5739
+ }
5740
+ if (parsed.host) {
5741
+ const ipv4result = normalizeIPv4(parsed.host);
5742
+ if (ipv4result.isIPV4 === false) {
5743
+ const ipv6result = normalizeIPv6(ipv4result.host);
5744
+ parsed.host = ipv6result.host.toLowerCase();
5745
+ isIP = ipv6result.isIPV6;
5746
+ } else {
5747
+ parsed.host = ipv4result.host;
5748
+ isIP = true;
5749
+ }
5750
+ }
5751
+ if (parsed.scheme === undefined && parsed.userinfo === undefined && parsed.host === undefined && parsed.port === undefined && parsed.query === undefined && !parsed.path) {
5752
+ parsed.reference = 'same-document';
5753
+ } else if (parsed.scheme === undefined) {
5754
+ parsed.reference = 'relative';
5755
+ } else if (parsed.fragment === undefined) {
5756
+ parsed.reference = 'absolute';
5757
+ } else {
5758
+ parsed.reference = 'uri';
6256
5759
  }
6257
- };
6258
-
6259
- var handler$3 = {
6260
- scheme: "wss",
6261
- domainHost: handler$2.domainHost,
6262
- parse: handler$2.parse,
6263
- serialize: handler$2.serialize
6264
- };
6265
5760
 
6266
- var O = {};
6267
- //RFC 3986
6268
- var UNRESERVED$$ = "[A-Za-z0-9\\-\\.\\_\\~" + ("\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF" ) + "]";
6269
- var HEXDIG$$ = "[0-9A-Fa-f]"; //case-insensitive
6270
- var PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)); //expanded
6271
- //RFC 5322, except these symbols as per RFC 6068: @ : / ? # [ ] & ; =
6272
- //const ATEXT$$ = "[A-Za-z0-9\\!\\#\\$\\%\\&\\'\\*\\+\\-\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~]";
6273
- //const WSP$$ = "[\\x20\\x09]";
6274
- //const OBS_QTEXT$$ = "[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]"; //(%d1-8 / %d11-12 / %d14-31 / %d127)
6275
- //const QTEXT$$ = merge("[\\x21\\x23-\\x5B\\x5D-\\x7E]", OBS_QTEXT$$); //%d33 / %d35-91 / %d93-126 / obs-qtext
6276
- //const VCHAR$$ = "[\\x21-\\x7E]";
6277
- //const WSP$$ = "[\\x20\\x09]";
6278
- //const OBS_QP$ = subexp("\\\\" + merge("[\\x00\\x0D\\x0A]", OBS_QTEXT$$)); //%d0 / CR / LF / obs-qtext
6279
- //const FWS$ = subexp(subexp(WSP$$ + "*" + "\\x0D\\x0A") + "?" + WSP$$ + "+");
6280
- //const QUOTED_PAIR$ = subexp(subexp("\\\\" + subexp(VCHAR$$ + "|" + WSP$$)) + "|" + OBS_QP$);
6281
- //const QUOTED_STRING$ = subexp('\\"' + subexp(FWS$ + "?" + QCONTENT$) + "*" + FWS$ + "?" + '\\"');
6282
- var ATEXT$$ = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]";
6283
- var QTEXT$$ = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]";
6284
- var VCHAR$$ = merge(QTEXT$$, "[\\\"\\\\]");
6285
- var SOME_DELIMS$$ = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]";
6286
- var UNRESERVED = new RegExp(UNRESERVED$$, "g");
6287
- var PCT_ENCODED = new RegExp(PCT_ENCODED$, "g");
6288
- var NOT_LOCAL_PART = new RegExp(merge("[^]", ATEXT$$, "[\\.]", '[\\"]', VCHAR$$), "g");
6289
- var NOT_HFNAME = new RegExp(merge("[^]", UNRESERVED$$, SOME_DELIMS$$), "g");
6290
- var NOT_HFVALUE = NOT_HFNAME;
6291
- function decodeUnreserved(str) {
6292
- var decStr = pctDecChars(str);
6293
- return !decStr.match(UNRESERVED) ? str : decStr;
6294
- }
6295
- var handler$4 = {
6296
- scheme: "mailto",
6297
- parse: function parse$$1(components, options) {
6298
- var mailtoComponents = components;
6299
- var to = mailtoComponents.to = mailtoComponents.path ? mailtoComponents.path.split(",") : [];
6300
- mailtoComponents.path = undefined;
6301
- if (mailtoComponents.query) {
6302
- var unknownHeaders = false;
6303
- var headers = {};
6304
- var hfields = mailtoComponents.query.split("&");
6305
- for (var x = 0, xl = hfields.length; x < xl; ++x) {
6306
- var hfield = hfields[x].split("=");
6307
- switch (hfield[0]) {
6308
- case "to":
6309
- var toAddrs = hfield[1].split(",");
6310
- for (var _x = 0, _xl = toAddrs.length; _x < _xl; ++_x) {
6311
- to.push(toAddrs[_x]);
6312
- }
6313
- break;
6314
- case "subject":
6315
- mailtoComponents.subject = unescapeComponent(hfield[1], options);
6316
- break;
6317
- case "body":
6318
- mailtoComponents.body = unescapeComponent(hfield[1], options);
6319
- break;
6320
- default:
6321
- unknownHeaders = true;
6322
- headers[unescapeComponent(hfield[0], options)] = unescapeComponent(hfield[1], options);
6323
- break;
6324
- }
6325
- }
6326
- if (unknownHeaders) mailtoComponents.headers = headers;
6327
- }
6328
- mailtoComponents.query = undefined;
6329
- for (var _x2 = 0, _xl2 = to.length; _x2 < _xl2; ++_x2) {
6330
- var addr = to[_x2].split("@");
6331
- addr[0] = unescapeComponent(addr[0]);
6332
- if (!options.unicodeSupport) {
6333
- //convert Unicode IDN -> ASCII IDN
6334
- try {
6335
- addr[1] = punycode.toASCII(unescapeComponent(addr[1], options).toLowerCase());
6336
- } catch (e) {
6337
- mailtoComponents.error = mailtoComponents.error || "Email address's domain name can not be converted to ASCII via punycode: " + e;
6338
- }
6339
- } else {
6340
- addr[1] = unescapeComponent(addr[1], options).toLowerCase();
6341
- }
6342
- to[_x2] = addr.join("@");
6343
- }
6344
- return mailtoComponents;
6345
- },
6346
- serialize: function serialize$$1(mailtoComponents, options) {
6347
- var components = mailtoComponents;
6348
- var to = toArray(mailtoComponents.to);
6349
- if (to) {
6350
- for (var x = 0, xl = to.length; x < xl; ++x) {
6351
- var toAddr = String(to[x]);
6352
- var atIdx = toAddr.lastIndexOf("@");
6353
- var localPart = toAddr.slice(0, atIdx).replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_LOCAL_PART, pctEncChar);
6354
- var domain = toAddr.slice(atIdx + 1);
6355
- //convert IDN via punycode
6356
- try {
6357
- domain = !options.iri ? punycode.toASCII(unescapeComponent(domain, options).toLowerCase()) : punycode.toUnicode(domain);
6358
- } catch (e) {
6359
- components.error = components.error || "Email address's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e;
6360
- }
6361
- to[x] = localPart + "@" + domain;
6362
- }
6363
- components.path = to.join(",");
6364
- }
6365
- var headers = mailtoComponents.headers = mailtoComponents.headers || {};
6366
- if (mailtoComponents.subject) headers["subject"] = mailtoComponents.subject;
6367
- if (mailtoComponents.body) headers["body"] = mailtoComponents.body;
6368
- var fields = [];
6369
- for (var name in headers) {
6370
- if (headers[name] !== O[name]) {
6371
- 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));
6372
- }
6373
- }
6374
- if (fields.length) {
6375
- components.query = fields.join("&");
6376
- }
6377
- return components;
5761
+ // check for reference errors
5762
+ if (options.reference && options.reference !== 'suffix' && options.reference !== parsed.reference) {
5763
+ parsed.error = parsed.error || 'URI is not a ' + options.reference + ' reference.';
6378
5764
  }
6379
- };
6380
5765
 
6381
- var URN_PARSE = /^([^\:]+)\:(.*)/;
6382
- //RFC 2141
6383
- var handler$5 = {
6384
- scheme: "urn",
6385
- parse: function parse$$1(components, options) {
6386
- var matches = components.path && components.path.match(URN_PARSE);
6387
- var urnComponents = components;
6388
- if (matches) {
6389
- var scheme = options.scheme || urnComponents.scheme || "urn";
6390
- var nid = matches[1].toLowerCase();
6391
- var nss = matches[2];
6392
- var urnScheme = scheme + ":" + (options.nid || nid);
6393
- var schemeHandler = SCHEMES[urnScheme];
6394
- urnComponents.nid = nid;
6395
- urnComponents.nss = nss;
6396
- urnComponents.path = undefined;
6397
- if (schemeHandler) {
6398
- urnComponents = schemeHandler.parse(urnComponents, options);
6399
- }
6400
- } else {
6401
- urnComponents.error = urnComponents.error || "URN can not be parsed.";
5766
+ // find scheme handler
5767
+ const schemeHandler = SCHEMES[(options.scheme || parsed.scheme || '').toLowerCase()];
5768
+
5769
+ // check if scheme can't handle IRIs
5770
+ if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
5771
+ // if host component is a domain name
5772
+ if (parsed.host && (options.domainHost || (schemeHandler && schemeHandler.domainHost)) && isIP === false && nonSimpleDomain(parsed.host)) {
5773
+ // convert Unicode IDN -> ASCII IDN
5774
+ try {
5775
+ parsed.host = URL.domainToASCII(parsed.host.toLowerCase());
5776
+ } catch (e) {
5777
+ parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
6402
5778
  }
6403
- return urnComponents;
6404
- },
6405
- serialize: function serialize$$1(urnComponents, options) {
6406
- var scheme = options.scheme || urnComponents.scheme || "urn";
6407
- var nid = urnComponents.nid;
6408
- var urnScheme = scheme + ":" + (options.nid || nid);
6409
- var schemeHandler = SCHEMES[urnScheme];
6410
- if (schemeHandler) {
6411
- urnComponents = schemeHandler.serialize(urnComponents, options);
6412
- }
6413
- var uriComponents = urnComponents;
6414
- var nss = urnComponents.nss;
6415
- uriComponents.path = (nid || options.nid) + ":" + nss;
6416
- return uriComponents;
5779
+ }
5780
+ // convert IRI -> URI
6417
5781
  }
6418
- };
6419
5782
 
6420
- var UUID = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/;
6421
- //RFC 4122
6422
- var handler$6 = {
6423
- scheme: "urn:uuid",
6424
- parse: function parse(urnComponents, options) {
6425
- var uuidComponents = urnComponents;
6426
- uuidComponents.uuid = uuidComponents.nss;
6427
- uuidComponents.nss = undefined;
6428
- if (!options.tolerant && (!uuidComponents.uuid || !uuidComponents.uuid.match(UUID))) {
6429
- uuidComponents.error = uuidComponents.error || "UUID is not valid.";
6430
- }
6431
- return uuidComponents;
6432
- },
6433
- serialize: function serialize(uuidComponents, options) {
6434
- var urnComponents = uuidComponents;
6435
- //normalize UUID
6436
- urnComponents.nss = (uuidComponents.uuid || "").toLowerCase();
6437
- return urnComponents;
5783
+ if (!schemeHandler || (schemeHandler && !schemeHandler.skipNormalize)) {
5784
+ if (gotEncoding && parsed.scheme !== undefined) {
5785
+ parsed.scheme = unescape(parsed.scheme);
5786
+ }
5787
+ if (gotEncoding && parsed.host !== undefined) {
5788
+ parsed.host = unescape(parsed.host);
5789
+ }
5790
+ if (parsed.path) {
5791
+ parsed.path = escape(unescape(parsed.path));
5792
+ }
5793
+ if (parsed.fragment) {
5794
+ parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
5795
+ }
6438
5796
  }
6439
- };
6440
5797
 
6441
- SCHEMES[handler.scheme] = handler;
6442
- SCHEMES[handler$1.scheme] = handler$1;
6443
- SCHEMES[handler$2.scheme] = handler$2;
6444
- SCHEMES[handler$3.scheme] = handler$3;
6445
- SCHEMES[handler$4.scheme] = handler$4;
6446
- SCHEMES[handler$5.scheme] = handler$5;
6447
- SCHEMES[handler$6.scheme] = handler$6;
6448
-
6449
- exports.SCHEMES = SCHEMES;
6450
- exports.pctEncChar = pctEncChar;
6451
- exports.pctDecChars = pctDecChars;
6452
- exports.parse = parse;
6453
- exports.removeDotSegments = removeDotSegments;
6454
- exports.serialize = serialize;
6455
- exports.resolveComponents = resolveComponents;
6456
- exports.resolve = resolve;
6457
- exports.normalize = normalize;
6458
- exports.equal = equal;
6459
- exports.escapeComponent = escapeComponent;
6460
- exports.unescapeComponent = unescapeComponent;
6461
-
6462
- Object.defineProperty(exports, '__esModule', { value: true });
5798
+ // perform scheme specific parsing
5799
+ if (schemeHandler && schemeHandler.parse) {
5800
+ schemeHandler.parse(parsed, options);
5801
+ }
5802
+ } else {
5803
+ parsed.error = parsed.error || 'URI can not be parsed.';
5804
+ }
5805
+ return parsed
5806
+ }
6463
5807
 
6464
- })));
5808
+ const fastUri = {
5809
+ SCHEMES,
5810
+ normalize,
5811
+ resolve,
5812
+ resolveComponents,
5813
+ equal: equal$2,
5814
+ serialize,
5815
+ parse
5816
+ };
6465
5817
 
6466
- }(uri_all, uri_all.exports));
5818
+ fastUri$1.exports = fastUri;
5819
+ fastUri$1.exports.default = fastUri;
5820
+ fastUri$1.exports.fastUri = fastUri;
6467
5821
 
6468
5822
  Object.defineProperty(uri$1, "__esModule", { value: true });
6469
- const uri = uri_all.exports;
5823
+ const uri = fastUri$1.exports;
6470
5824
  uri.code = 'require("ajv/dist/runtime/uri").default';
6471
5825
  uri$1.default = uri;
6472
5826
 
@@ -6487,7 +5841,7 @@
6487
5841
  const rules_1 = rules;
6488
5842
  const compile_1 = compile;
6489
5843
  const codegen_2 = codegen;
6490
- const resolve_1 = resolve$1;
5844
+ const resolve_1 = resolve$2;
6491
5845
  const dataType_1 = dataType;
6492
5846
  const util_1 = util;
6493
5847
  const $dataRefSchema = require$$9;
@@ -9603,7 +8957,7 @@
9603
8957
  message = _theRule.message;
9604
8958
  var valid = true;
9605
8959
  if (isExpression(validator)) {
9606
- valid = executeExpression(validator, instance);
8960
+ valid = _executeExpression(validator, instance);
9607
8961
  } else if (typeof validator === 'function') {
9608
8962
  valid = validator(instance);
9609
8963
  // eslint-disable-next-line no-eval
@@ -9767,7 +9121,7 @@
9767
9121
  };
9768
9122
  // 校验schema是否正常
9769
9123
  var validateSchema = /*#__PURE__*/function () {
9770
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(schema) {
9124
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(schema) {
9771
9125
  return _regeneratorRuntime().wrap(function _callee$(_context) {
9772
9126
  while (1) switch (_context.prev = _context.next) {
9773
9127
  case 0:
@@ -9975,6 +9329,11 @@
9975
9329
  setState: function setState(key, value) {
9976
9330
  if (Reflect.has(this.state, key)) {
9977
9331
  this.state[key] = value;
9332
+ // state变化
9333
+ this.$emit('state-change', {
9334
+ path: this.path,
9335
+ state: this.state
9336
+ });
9978
9337
  } else if (key === 'value') {
9979
9338
  // 特殊处理value设置
9980
9339
  this.$emit('input', {
@@ -9987,7 +9346,7 @@
9987
9346
  },
9988
9347
  loadDataSource: function loadDataSource() {
9989
9348
  var _this3 = this;
9990
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
9349
+ return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
9991
9350
  var _this3$widgetSchema, _this3$widgetSchema$u, _this3$widgetSchema$u2;
9992
9351
  var xhrConfig, url, params, reset, _this3$httpAdapter, _this3$httpAdapter$re, http, responseParse, remoteURL, requestParams;
9993
9352
  return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -10002,8 +9361,8 @@
10002
9361
  _this3$httpAdapter = _this3.httpAdapter, _this3$httpAdapter$re = _this3$httpAdapter.request, http = _this3$httpAdapter$re === void 0 ? request : _this3$httpAdapter$re, responseParse = _this3$httpAdapter.responseParse;
10003
9362
  _context.prev = 4;
10004
9363
  _this3.loading = true;
10005
- remoteURL = executeExpression(url, _this3);
10006
- requestParams = isObj(params) ? executeExpression(params, _this3) : params;
9364
+ remoteURL = _executeExpression(url, _this3);
9365
+ requestParams = isObj(params) ? _executeExpression(params, _this3) : params;
10007
9366
  _context.next = 10;
10008
9367
  return http(remoteURL, _objectSpread2(_objectSpread2({}, reset), {}, {
10009
9368
  params: requestParams,
@@ -11137,14 +10496,98 @@
11137
10496
 
11138
10497
  function _extends(){return _extends=Object.assign?Object.assign.bind():function(a){for(var b,c=1;c<arguments.length;c++)for(var d in b=arguments[c],b)Object.prototype.hasOwnProperty.call(b,d)&&(a[d]=b[d]);return a},_extends.apply(this,arguments)}var normalMerge=["attrs","props","domProps"],toArrayMerge=["class","style","directives"],functionalMerge=["on","nativeOn"],mergeJsxProps=function(a){return a.reduce(function(c,a){for(var b in a)if(!c[b])c[b]=a[b];else if(-1!==normalMerge.indexOf(b))c[b]=_extends({},c[b],a[b]);else if(-1!==toArrayMerge.indexOf(b)){var d=c[b]instanceof Array?c[b]:[c[b]],e=a[b]instanceof Array?a[b]:[a[b]];c[b]=[].concat(d,e);}else if(-1!==functionalMerge.indexOf(b)){for(var f in a[b])if(c[b][f]){var g=c[b][f]instanceof Array?c[b][f]:[c[b][f]],h=a[b][f]instanceof Array?a[b][f]:[a[b][f]];c[b][f]=[].concat(g,h);}else c[b][f]=a[b][f];}else if("hook"===b)for(var i in a[b])c[b][i]=c[b][i]?mergeFn(c[b][i],a[b][i]):a[b][i];else c[b]=a[b];return c},{})},mergeFn=function(a,b){return function(){a&&a.apply(this,arguments),b&&b.apply(this,arguments);}};var helper=mergeJsxProps;
11139
10498
 
10499
+ var CommonGroupWrap = Vue__default["default"].extend({
10500
+ name: 'CommonFieldGroupWrap',
10501
+ inject: ['widgetTree'],
10502
+ props: _objectSpread2(_objectSpread2({}, props), {}, {
10503
+ // 组类型
10504
+ type: {
10505
+ type: String,
10506
+ default: 'default',
10507
+ validator: function validator(value) {
10508
+ return ['default', 'normal', 'card'].includes(value);
10509
+ }
10510
+ },
10511
+ // 是否显示组title
10512
+ showTitle: {
10513
+ type: Boolean,
10514
+ default: false
10515
+ },
10516
+ // 是否显示border
10517
+ border: {
10518
+ type: Boolean,
10519
+ default: false
10520
+ },
10521
+ verifiable: {
10522
+ type: Boolean,
10523
+ default: false
10524
+ },
10525
+ hideEmptyRow: {
10526
+ type: Boolean,
10527
+ default: false
10528
+ },
10529
+ description: {
10530
+ type: String,
10531
+ default: ''
10532
+ },
10533
+ tag: {
10534
+ type: String,
10535
+ default: 'div'
10536
+ }
10537
+ }),
10538
+ data: function data() {
10539
+ return {
10540
+ state: {
10541
+ // 组类型目前只支持visible
10542
+ visible: true
10543
+ }
10544
+ };
10545
+ },
10546
+ created: function created() {
10547
+ // 注册widget TreeNode
10548
+ this.widgetTree.addWidgetNode(this.path, this, 'group');
10549
+ },
10550
+ mounted: function mounted() {
10551
+ // 更新样式
10552
+ this.$forceUpdate();
10553
+ },
10554
+ beforeDestroy: function beforeDestroy() {
10555
+ this.widgetTree.removeWidgetNode(this.path, this);
10556
+ },
10557
+ methods: {
10558
+ setState: function setState(key, value) {
10559
+ if (Reflect.has(this.state, key)) {
10560
+ this.state[key] = value;
10561
+ } else {
10562
+ console.warn("Group unsupported ".concat(key, " state, please check"));
10563
+ }
10564
+ }
10565
+ },
10566
+ render: function render(h) {
10567
+ var _this$layout;
10568
+ var groupContentStyle = _objectSpread2({}, (_this$layout = this.layout) === null || _this$layout === void 0 ? void 0 : _this$layout.container);
10569
+ return h(this.tag, {
10570
+ style: groupContentStyle
10571
+ }, [this.$slots.default]);
10572
+ }
10573
+ });
10574
+
11140
10575
  // 伪数组类型
11141
10576
  var KeyValueArrayWidget = Vue__default["default"].extend({
11142
10577
  name: 'KeyValueArrayWidget',
11143
10578
  props: _objectSpread2({}, props),
10579
+ data: function data() {
10580
+ return {
10581
+ columns: {},
10582
+ showTableHead: false
10583
+ };
10584
+ },
11144
10585
  mounted: function mounted() {
11145
10586
  var _this$value;
11146
10587
  var _this$schema$minItems = this.schema.minItems,
11147
10588
  minItems = _this$schema$minItems === void 0 ? 0 : _this$schema$minItems;
10589
+ var uiOptions = Schema.getUiOptions(this.schema);
10590
+ this.showTableHead = !!uiOptions.showTableHead;
11148
10591
  // 补全minItems项
11149
10592
  if (((_this$value = this.value) === null || _this$value === void 0 ? void 0 : _this$value.length) < minItems) {
11150
10593
  var data = Schema.getSchemaDefaultValue(this.schema.items);
@@ -11186,16 +10629,23 @@
11186
10629
  cursor: this.disabled ? 'not-allowed' : 'pointer',
11187
10630
  display: 'inline-block'
11188
10631
  };
10632
+ var theadStyle = {
10633
+ display: this.showTableHead ? '' : 'none'
10634
+ };
10635
+ var thStyle = {
10636
+ fontSize: '14px',
10637
+ textAlign: 'left',
10638
+ fontWeight: 'normal',
10639
+ color: '#63656E',
10640
+ paddingLeft: '10px',
10641
+ paddingRight: '10px'
10642
+ };
10643
+ var tdStyle = {
10644
+ paddingLeft: '10px',
10645
+ paddingRight: '10px'
10646
+ };
11189
10647
  var properties = (_this$schema = this.schema) === null || _this$schema === void 0 ? void 0 : (_this$schema$items = _this$schema.items) === null || _this$schema$items === void 0 ? void 0 : _this$schema$items.properties;
11190
10648
  var props = orderProperties(Object.keys(properties || {}), (_this$schema2 = this.schema) === null || _this$schema2 === void 0 ? void 0 : (_this$schema2$items = _this$schema2.items) === null || _this$schema2$items === void 0 ? void 0 : _this$schema2$items['ui:order']);
11191
- // props为空时,表示只有一个项
11192
- var keysLen = Object.keys(properties || {}).length;
11193
- var defaultCols = properties ? new Array(keysLen).fill('1fr').concat('20px').join(' ') : '1fr 20px';
11194
- var defaultContainerLayout = _objectSpread2({}, this.layout.container || {
11195
- display: 'grid',
11196
- gridGap: '20px',
11197
- 'grid-template-columns': defaultCols // 默认配置
11198
- });
11199
10649
  var self = this;
11200
10650
  var dealSchema = function dealSchema(schema) {
11201
10651
  return (
@@ -11231,6 +10681,11 @@
11231
10681
  on: {
11232
10682
  input: function input(data) {
11233
10683
  self.handleInput(data);
10684
+ },
10685
+ 'state-change': function stateChange(_ref2) {
10686
+ var path = _ref2.path,
10687
+ state = _ref2.state;
10688
+ _this.$set(_this.columns, path, state);
11234
10689
  }
11235
10690
  },
11236
10691
  style: {
@@ -11238,37 +10693,57 @@
11238
10693
  }
11239
10694
  });
11240
10695
  };
11241
- return h("div", [(_this$value2 = this.value) === null || _this$value2 === void 0 ? void 0 : _this$value2.map(function (_, index) {
11242
- var _this$schema4;
10696
+ return h("table", [h("thead", {
10697
+ "style": theadStyle
10698
+ }, [h("tr", [props === null || props === void 0 ? void 0 : props.map(function (prop, i) {
10699
+ var _this$schema3, _this$schema3$items, _this$columns$path;
10700
+ var schemaItem = (_this$schema3 = _this.schema) === null || _this$schema3 === void 0 ? void 0 : (_this$schema3$items = _this$schema3.items) === null || _this$schema3$items === void 0 ? void 0 : _this$schema3$items.properties[prop];
10701
+ var path = Path.getCurPath(_this.path, "0.".concat(prop));
10702
+ return h("th", {
10703
+ "style": _objectSpread2(_objectSpread2({}, thStyle), {}, {
10704
+ paddingLeft: i > 0 ? '10px' : '0px',
10705
+ display: ((_this$columns$path = _this.columns[path]) === null || _this$columns$path === void 0 ? void 0 : _this$columns$path.visible) === false ? 'none' : ''
10706
+ })
10707
+ }, [schemaItem === null || schemaItem === void 0 ? void 0 : schemaItem.title]);
10708
+ }), h("th")])]), h("tbody", [(_this$value2 = this.value) === null || _this$value2 === void 0 ? void 0 : _this$value2.map(function (_, index) {
10709
+ var _this$schema5;
11243
10710
  var groupPath = Path.getCurPath(_this.path, "".concat(index));
11244
- return h(FieldGroupWrap, helper([{}, {
10711
+ return h(CommonGroupWrap, helper([{}, {
11245
10712
  "props": _objectSpread2(_objectSpread2({}, _this.$props), {}, {
11246
10713
  path: groupPath,
11247
10714
  value: Path.getPathVal(_this.rootData, groupPath),
11248
10715
  schema: _this.schema.items,
11249
- layout: _objectSpread2(_objectSpread2({}, _this.layout), {}, {
11250
- container: _objectSpread2({}, defaultContainerLayout)
11251
- })
10716
+ tag: 'tr',
10717
+ layout: _objectSpread2({}, _this.layout)
11252
10718
  })
11253
- }]), [props !== null && props !== void 0 && props.length ? props.map(function (prop) {
11254
- var _this$schema3, _this$schema3$items;
11255
- var schemaItem = (_this$schema3 = _this.schema) === null || _this$schema3 === void 0 ? void 0 : (_this$schema3$items = _this$schema3.items) === null || _this$schema3$items === void 0 ? void 0 : _this$schema3$items.properties[prop];
10719
+ }]), [props !== null && props !== void 0 && props.length ? props.map(function (prop, i) {
10720
+ var _this$schema4, _this$schema4$items, _this$columns$curPath;
10721
+ var schemaItem = (_this$schema4 = _this.schema) === null || _this$schema4 === void 0 ? void 0 : (_this$schema4$items = _this$schema4.items) === null || _this$schema4$items === void 0 ? void 0 : _this$schema4$items.properties[prop];
11256
10722
  var curPath = Path.getCurPath(_this.path, "".concat(index, ".").concat(prop));
11257
10723
  var lastProp = curPath.split('.').pop();
11258
10724
  var layoutConfig = Layout.findLayoutByProp(lastProp, _this.layout.group || []) || {};
11259
- return renderSchemaField({
10725
+ return h("td", {
10726
+ "style": _objectSpread2(_objectSpread2({}, tdStyle), {}, {
10727
+ paddingLeft: i > 0 ? '10px' : '0px',
10728
+ display: ((_this$columns$curPath = _this.columns[curPath]) === null || _this$columns$curPath === void 0 ? void 0 : _this$columns$curPath.visible) === false ? 'none' : ''
10729
+ })
10730
+ }, [renderSchemaField({
11260
10731
  path: curPath,
11261
10732
  schema: dealSchema(schemaItem),
11262
10733
  layout: layoutConfig,
11263
10734
  required: Schema.isRequired(schemaItem, prop)
11264
- });
11265
- }) : renderSchemaField({
10735
+ })]);
10736
+ }) : h("td", [renderSchemaField({
11266
10737
  path: Path.getCurPath(_this.path, index),
11267
- schema: dealSchema(((_this$schema4 = _this.schema) === null || _this$schema4 === void 0 ? void 0 : _this$schema4.items) || {}),
10738
+ schema: dealSchema(((_this$schema5 = _this.schema) === null || _this$schema5 === void 0 ? void 0 : _this$schema5.items) || {}),
11268
10739
  layout: {},
11269
10740
  required: false
11270
- }), h("span", {
11271
- "style": labelBtnStyle,
10741
+ })]), h("td", {
10742
+ "style": _objectSpread2({}, tdStyle)
10743
+ }, [h("span", {
10744
+ "style": _objectSpread2(_objectSpread2({}, labelBtnStyle), {}, {
10745
+ marginBottom: '10px'
10746
+ }),
11272
10747
  "on": {
11273
10748
  "click": function click() {
11274
10749
  return _this.handleRemoveItem(index);
@@ -11276,7 +10751,7 @@
11276
10751
  }
11277
10752
  }, [h("i", {
11278
10753
  "class": "bk-icon icon-minus-line"
11279
- })])]);
10754
+ })])])]);
11280
10755
  }), h("span", {
11281
10756
  "on": {
11282
10757
  "click": this.handleAddItem
@@ -11284,7 +10759,7 @@
11284
10759
  "style": labelBtnStyle
11285
10760
  }, [h("i", {
11286
10761
  "class": "bk-icon icon-plus-line"
11287
- })])]);
10762
+ })])])]);
11288
10763
  }
11289
10764
  });
11290
10765
 
@@ -11584,7 +11059,7 @@
11584
11059
  options.fileObj.xhr = xhr;
11585
11060
  var formData = new FormData();
11586
11061
  options.data.forEach(function (item) {
11587
- formData.append(item.name, executeExpression(item.value, _this.$parent.$parent));
11062
+ formData.append(item.name, _executeExpression(item.value, _this.$parent.$parent));
11588
11063
  });
11589
11064
  formData.append(options.fileName, options.fileObj.origin);
11590
11065
  xhr.onreadystatechange = function () {
@@ -11607,12 +11082,12 @@
11607
11082
  if (Array.isArray(options.header)) {
11608
11083
  options.header.forEach(function (head) {
11609
11084
  var headerKey = head.name;
11610
- var headerVal = executeExpression(head.value, _this.$parent.$parent);
11085
+ var headerVal = _executeExpression(head.value, _this.$parent.$parent);
11611
11086
  xhr.setRequestHeader(headerKey, headerVal);
11612
11087
  });
11613
11088
  } else {
11614
11089
  var headerKey = options.header.name;
11615
- var headerVal = executeExpression(options.header.value, this.$parent.$parent);
11090
+ var headerVal = _executeExpression(options.header.value, this.$parent.$parent);
11616
11091
  xhr.setRequestHeader(headerKey, headerVal);
11617
11092
  }
11618
11093
  }
@@ -11636,13 +11111,13 @@
11636
11111
  handleResCode: function handleResCode(res) {
11637
11112
  var successed = true;
11638
11113
  if (this.isUploadSuccessed) {
11639
- successed = executeExpression(this.isUploadSuccessed, this.$parent.$parent, [], {
11114
+ successed = _executeExpression(this.isUploadSuccessed, this.$parent.$parent, [], {
11640
11115
  response: res
11641
11116
  });
11642
11117
  }
11643
11118
  if (!successed) return;
11644
11119
  if (this.responseHandler) {
11645
- var files = executeExpression(this.responseHandler, this.$parent.$parent, [], {
11120
+ var files = _executeExpression(this.responseHandler, this.$parent.$parent, [], {
11646
11121
  response: res
11647
11122
  });
11648
11123
  this.$emit('input', files);
@@ -11980,7 +11455,7 @@
11980
11455
  },
11981
11456
  methods: {
11982
11457
  initFormData: function initFormData() {
11983
- this.rootData = merge(Schema.getSchemaDefaultValue(createProxy(this.schema, this)) || {}, this.value);
11458
+ this.rootData = _merge(Schema.getSchemaDefaultValue(createProxy(this.schema, this)) || {}, this.value);
11984
11459
  this.emitFormValueChange(this.rootData, this.value);
11985
11460
  },
11986
11461
  emitFormValueChange: function emitFormValueChange(newValue, oldValue) {